vine-context 0.0.0-stage → 0.1.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.
Files changed (34) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +280 -2
  3. package/dist/apps/shell.html +134 -0
  4. package/dist/apps/views.html +124 -0
  5. package/dist/cli.js +7865 -0
  6. package/dist/cli.js.map +1 -0
  7. package/examples/data/graphs/party/.cypherlite/schema/schema.cypher +5 -0
  8. package/examples/data/graphs/party/.cypherlite.lock +1 -0
  9. package/examples/data/graphs/party/.cypherlite.writer +0 -0
  10. package/examples/data/graphs/party/manifest.json +215 -0
  11. package/examples/data/graphs/party/nodes/0-262144-7987dd27c85668d4810609133f705907.parquet +0 -0
  12. package/examples/data/graphs/party/wal/.cypherlite.lock +1 -0
  13. package/examples/data/graphs/party/wal/.cypherlite.writer +0 -0
  14. package/examples/data/graphs/party/wal/00000002.log +0 -0
  15. package/examples/data/hosts/party/changes.jsonl +19 -0
  16. package/examples/data/hosts/party/group.json +5 -0
  17. package/examples/data/hosts/party/sharing.json +1 -0
  18. package/examples/data/identity.json +4 -0
  19. package/models/temporal-claims/instructions.md +78 -0
  20. package/models/temporal-claims/model.yaml +99 -0
  21. package/models/temporal-claims/tools.yaml +348 -0
  22. package/package.json +79 -4
  23. package/plugin/.claude-plugin/plugin.json +8 -0
  24. package/plugin/.codex-plugin/plugin.json +17 -0
  25. package/plugin/.mcp.json +8 -0
  26. package/plugin/codex/hooks.json +11 -0
  27. package/plugin/commands/join.md +22 -0
  28. package/plugin/hooks/hooks.json +11 -0
  29. package/plugin/hooks/register.tsx +2310 -0
  30. package/plugin/hooks/vine-hook.mjs +25 -0
  31. package/plugin/skills/join-context-graph/SKILL.md +36 -0
  32. package/plugin/skills/vine-context/SKILL.md +232 -0
  33. package/plugin/tests/context-graph.test.tsx +830 -0
  34. package/plugin/types/index.d.ts +165 -0
@@ -0,0 +1,124 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <meta name="color-scheme" content="light dark">
7
+ <title>Vine Context</title>
8
+ <!--VINE_VIEW-->
9
+ <style>:root{--bg: var(--color-background-primary, #ffffff);--bg2: var(--color-background-secondary, #f5f5f3);--bg3: var(--color-background-tertiary, #ecebe7);--fg: var(--color-text-primary, #1d1c1a);--fg2: var(--color-text-secondary, #5f5d58);--fg3: var(--color-text-tertiary, #8d8a83);--line: var(--color-border-primary, #dddad3);--line2: var(--color-border-secondary, #ebe8e2);--accent: #2f6fdb;--accent-fg: #ffffff;--ok: var(--color-text-success, #1f7a46);--ok-bg: var(--color-background-success, #e6f4ea);--warn: var(--color-text-warning, #8a5a00);--warn-bg: var(--color-background-warning, #fdf2dc);--bad: var(--color-text-danger, #b3261e);--bad-bg: var(--color-background-danger, #fbe9e7);--radius: var(--border-radius-md, 8px);--font: var(--font-sans, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif);--mono: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);color-scheme:light dark}@media(prefers-color-scheme:dark){:root:not([data-theme=light]){--bg: var(--color-background-primary, #1b1b1a);--bg2: var(--color-background-secondary, #242422);--bg3: var(--color-background-tertiary, #2e2d2b);--fg: var(--color-text-primary, #ecebe7);--fg2: var(--color-text-secondary, #b4b1aa);--fg3: var(--color-text-tertiary, #85827b);--line: var(--color-border-primary, #3a3936);--line2: var(--color-border-secondary, #2f2e2c);--accent: #6b9cf0;--accent-fg: #0d1626;--ok: var(--color-text-success, #7fd39d);--ok-bg: var(--color-background-success, #1b3324);--warn: var(--color-text-warning, #f0c36b);--warn-bg: var(--color-background-warning, #3a2e14);--bad: var(--color-text-danger, #f2a097);--bad-bg: var(--color-background-danger, #3d1f1c)}}:root[data-theme=dark]{--bg: var(--color-background-primary, #1b1b1a);--bg2: var(--color-background-secondary, #242422);--bg3: var(--color-background-tertiary, #2e2d2b);--fg: var(--color-text-primary, #ecebe7);--fg2: var(--color-text-secondary, #b4b1aa);--fg3: var(--color-text-tertiary, #85827b);--line: var(--color-border-primary, #3a3936);--line2: var(--color-border-secondary, #2f2e2c);--accent: #6b9cf0;--accent-fg: #0d1626;--ok: var(--color-text-success, #7fd39d);--ok-bg: var(--color-background-success, #1b3324);--warn: var(--color-text-warning, #f0c36b);--warn-bg: var(--color-background-warning, #3a2e14);--bad: var(--color-text-danger, #f2a097);--bad-bg: var(--color-background-danger, #3d1f1c)}*{box-sizing:border-box}html,body{margin:0;background:var(--bg);color:var(--fg);font:14px/1.45 var(--font)}body{padding:12px}h1{font-size:15px;font-weight:600;margin:0}h1.brand{display:flex;align-items:center;gap:6px}h1.brand svg{height:20px;width:auto;fill:var(--ok);flex:none}h2{font-size:12px;font-weight:600;margin:16px 0 6px;color:var(--fg2);text-transform:uppercase;letter-spacing:.04em}p{margin:4px 0}code,.mono{font-family:var(--mono);font-size:12px}.muted{color:var(--fg2)}.faint{color:var(--fg3);font-size:12px}.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.spread{display:flex;gap:8px;align-items:center;justify-content:space-between;flex-wrap:wrap}.grow{flex:1;min-width:0}.head{display:flex;align-items:center;gap:10px;justify-content:space-between;padding-bottom:10px;border-bottom:1px solid var(--line2);margin-bottom:4px;flex-wrap:wrap}button,select,input{font:inherit;color:var(--fg);background:var(--bg);border:1px solid var(--line);border-radius:6px;padding:5px 10px;min-height:30px}input{min-width:0}button{cursor:pointer;white-space:nowrap}button:hover:not(:disabled){background:var(--bg2)}button:disabled{opacity:.5;cursor:default}button.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-fg);font-weight:500}button.primary:hover:not(:disabled){filter:brightness(1.07);background:var(--accent)}button.danger{color:var(--bad)}button.link{border:0;background:none;color:var(--accent);padding:0 2px;min-height:0}:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.card{border:1px solid var(--line2);border-radius:var(--radius);padding:10px 12px;background:var(--bg)}.list{display:flex;flex-direction:column;gap:6px}.pill{display:inline-flex;align-items:center;gap:4px;padding:1px 8px;border-radius:999px;font-size:12px;background:var(--bg3);color:var(--fg2)}.pill.ok{background:var(--ok-bg);color:var(--ok)}.pill.warn{background:var(--warn-bg);color:var(--warn)}.pill.bad{background:var(--bad-bg);color:var(--bad)}.dot{width:8px;height:8px;border-radius:50%;display:inline-block;background:var(--fg3)}.dot.on{background:var(--ok);box-shadow:0 0 0 3px var(--ok-bg)}.notice{padding:8px 10px;border-radius:6px;background:var(--bg2);color:var(--fg2);font-size:13px}.notice.bad{background:var(--bad-bg);color:var(--bad)}.notice.ok{background:var(--ok-bg);color:var(--ok)}.linkbox{display:flex;gap:6px;align-items:center}.linkbox input{flex:1;font-family:var(--mono);font-size:12px;background:var(--bg2)}.fp{font-family:var(--mono);font-size:12px;padding:1px 6px;border-radius:4px;background:var(--bg3);letter-spacing:.03em}.empty{color:var(--fg3);font-size:13px;padding:6px 0}table{border-collapse:collapse;width:100%;font-size:13px}td,th{text-align:left;padding:4px 8px 4px 0;vertical-align:top;border-bottom:1px solid var(--line2)}th{font-weight:500;color:var(--fg2)}.kv{display:grid;grid-template-columns:max-content 1fr;gap:2px 12px;font-size:13px}.kv dt{color:var(--fg2)}.kv dd{margin:0;word-break:break-word}.tabs{display:flex;flex-wrap:wrap;gap:2px;border-bottom:1px solid var(--line2);margin:8px 0}.tabs button{border:0;border-bottom:2px solid transparent;border-radius:0;background:none;color:var(--fg2);padding:5px 8px}.tabs button[aria-selected=true]{color:var(--fg);border-bottom-color:var(--accent)}.explorer{display:grid;grid-template-columns:1fr 260px;gap:10px}@media(max-width:640px){.explorer{grid-template-columns:1fr}}.canvas{position:relative;border:1px solid var(--line2);border-radius:var(--radius);background:var(--bg2);height:420px;overflow:hidden;touch-action:none}.canvas svg{width:100%;height:100%;display:block;cursor:grab}.canvas svg:active{cursor:grabbing}.canvas .zoom{position:absolute;right:8px;bottom:8px;display:flex;gap:4px}.canvas .zoom button{width:30px;padding:0;background:var(--bg)}.legend{display:flex;flex-wrap:wrap;gap:4px 12px;font-size:12px;color:var(--fg2);margin-top:6px}.legend span{display:inline-flex;align-items:center;gap:5px}.swatch{width:10px;height:10px;border-radius:3px;display:inline-block}.edge-swatch{width:16px;height:0;border-top:2px solid;display:inline-block}.timebar{display:flex;align-items:center;gap:8px;margin:8px 0}.timebar input[type=range]{flex:1;padding:0;border:0;min-height:0}.side{display:flex;flex-direction:column;gap:8px;min-width:0}.ended{text-decoration:line-through;color:var(--fg3)}.pair{display:grid;grid-template-columns:1fr auto 1fr;gap:8px;align-items:stretch}@media(max-width:560px){.pair{grid-template-columns:1fr}.pair .vs{justify-self:center}}.pair .vs{align-self:center;font-size:12px;color:var(--bad);font-weight:600}.side-item{border:1px solid var(--line2);border-radius:6px;padding:8px 10px;background:var(--bg2)}.you{margin:4px 0 12px}.you p{margin:0}.you .row{gap:8px;align-items:center}.you input{min-width:14em}button.link{background:none;border:0;padding:0;color:var(--accent);cursor:pointer;font:inherit;text-decoration:underline}.stack{display:flex;flex-direction:column;gap:8px}.stack.sm{gap:4px}.stack.lg{gap:14px}.stack>h2{margin:8px 0 0}h1.title{font-size:17px}.wrap{overflow-wrap:anywhere}.item{display:flex;gap:10px;align-items:flex-start;justify-content:space-between}.item.center{align-items:center}.item>.row{flex:none;flex-wrap:nowrap}.item p{margin:0}.card.warn{border-color:var(--warn)}.card.ok{border-color:var(--ok)}.card.bad{border-color:var(--bad)}.card.accent{border-color:var(--accent)}.t-warn{color:var(--warn)}.t-ok{color:var(--ok)}.t-bad{color:var(--bad)}.t-accent{color:var(--accent)}.chip{border-radius:999px;color:var(--fg2)}.chip.on{background:var(--accent);border-color:var(--accent);color:var(--accent-fg);font-weight:500}.chip.on:hover:not(:disabled){background:var(--accent);filter:brightness(1.07)}button.link.name{font-weight:600;font-size:14px}button.link.pin{align-self:flex-start;color:var(--fg2);font-size:12px}button.link.pin[aria-pressed=true]{color:var(--accent)}.reply{padding-left:16px}.who{gap:4px 12px;font-size:12px;color:var(--fg3)}.who .on{color:var(--fg2)}.field{display:flex;flex-direction:column;gap:4px}.field label{font-weight:600}.field .linkbox{align-items:flex-start}.field .linkbox input,.field .linkbox textarea{flex:1;font-family:inherit;font-size:inherit;background:var(--bg)}.field select{align-self:flex-start}textarea{font:inherit;color:var(--fg);background:var(--bg);border:1px solid var(--line);border-radius:6px;padding:6px 10px;min-width:0;resize:vertical}button.link.more{align-self:flex-start;font-size:12px;margin:2px 0}
10
+ </style>
11
+ </head>
12
+ <body>
13
+ <div id="root"></div>
14
+ <script>"use strict";(()=>{var tv=Object.defineProperty;var Zn=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var re=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var At=(e,t)=>{for(var n in t)tv(e,n,{get:t[n],enumerable:!0})};var Z={};At(Z,{BIGINT_FORMAT_RANGES:()=>Zo,CONSTANT_CATCH:()=>Ns,Class:()=>Qu,NUMBER_FORMAT_RANGES:()=>Eo,aborted:()=>tt,allowsEval:()=>el,assert:()=>Nv,assertEqual:()=>kv,assertIs:()=>zv,assertNever:()=>Sv,assertNotEqual:()=>$v,assignProp:()=>Je,attachSchema:()=>Do,base64ToUint8Array:()=>b_,base64urlToUint8Array:()=>Bv,cached:()=>Pr,captureStackTrace:()=>$s,cleanEnum:()=>Hv,cleanRegex:()=>Gt,clone:()=>ce,cloneDef:()=>Iv,codePointLength:()=>Ln,constantCatch:()=>sl,createTransparentProxy:()=>Zv,defineLazy:()=>Yu,defineLazyInternal:()=>Q,derived:()=>Gv,esc:()=>et,escapeRegex:()=>_t,explicitlyAborted:()=>rl,extend:()=>jv,finalizeIssue:()=>st,floatSafeRemainder:()=>Oo,getElementAtPath:()=>Tv,getEnumValues:()=>Nr,getLengthableOrigin:()=>jo,getParsedType:()=>Ev,getSizableOrigin:()=>Mo,hexToUint8Array:()=>Wv,hide:()=>Lo,installLazyProp:()=>ew,isObject:()=>jn,isPlainObject:()=>gt,issue:()=>Or,joinValues:()=>xs,jsonStringifyReplacer:()=>Cr,members:()=>il,merge:()=>Uv,mergeDefs:()=>Nt,normalizeParams:()=>P,nullish:()=>ks,numKeys:()=>Av,objectClone:()=>Cv,omit:()=>Mv,optionalKeys:()=>nl,own:()=>hn,parsedType:()=>ol,partial:()=>Fv,pick:()=>Dv,prefixIssues:()=>it,primitiveTypes:()=>tl,promiseAllObject:()=>Ov,propertyKeyTypes:()=>Ao,randomString:()=>Rv,rawShape:()=>Ir,required:()=>Vv,safeExtend:()=>Lv,shallowClone:()=>Ro,sizeCaps:()=>Tr,slugify:()=>Xu,stringifyPrimitive:()=>zs,toZod:()=>Sr,uint8ArrayToBase64:()=>v_,uint8ArrayToBase64url:()=>Jv,uint8ArrayToHex:()=>Kv,unwrapMessage:()=>zr});function kv(e){return e}function $v(e){return e}function Sr(){return e=>e}function zv(e){}function Sv(e){throw new Error("Unexpected value in exhaustive check")}function Nv(e){}function Nr(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function xs(e,t="|"){return e.map(n=>zs(n)).join(t)}function Cr(e,t){return typeof t=="bigint"?t.toString():t}function Pr(e){return new Gu(e)}function ks(e){return e==null}function Gt(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Oo(e,t){let n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}function Yu(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==h_)return r===void 0&&(r=h_,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Cv(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Je(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ir(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Kt(e){return Ir(e._zod.def)??e._zod.def.shape}function g_(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return Je(this,t,r),r},enumerable:!0,configurable:!0})}function __(e,t,n){t in e?Je(e,t,n):e[t]=n}function Mn(e,t,n,r){let o=Kt(t);for(let i of n){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?g_(e,i,()=>{let a=t._zod.def.shape[i];return r?r(a,i):a}):__(e,i,r?r(s.value,i):s.value))}}function Pv(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?g_(e,n,()=>t[n]):__(e,n,r.value))}}function Nt(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Iv(e){return Nt(e._zod.def)}function Tv(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function Ov(e){let t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=r[i];return o})}function Rv(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function et(e){return JSON.stringify(e)}function Xu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function jn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function gt(e){if(jn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(jn(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Ro(e){return gt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Av(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function _t(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ce(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function P(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 Zv(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,i){return t??(t=e()),Reflect.set(t,r,o,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function zs(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function nl(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}function Dv(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return Mn(i,e,Ss(e,t)),ce(e,Nt(n,{shape:i,checks:[]}))}function Ss(e,t){let n=Kt(e),r=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&r.push(o)}return r}function Mv(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Ss(e,t)),s={};return Mn(s,e,Reflect.ownKeys(Kt(e)).filter(a=>!i.has(a))),ce(e,Nt(n,{shape:s,checks:[]}))}function jv(e,t){if(!gt(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=Kt(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 ce(e,Nt(e._zod.def,{shape:y_(e,t)}))}function y_(e,t){let n={};return Mn(n,e,Reflect.ownKeys(Kt(e))),Pv(n,t),n}function Lv(e,t){if(!gt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return ce(e,Nt(e._zod.def,{shape:y_(e,t)}))}function Uv(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 n={};Mn(n,e,Reflect.ownKeys(Kt(e))),Mn(n,t,Reflect.ownKeys(Kt(t)));let r=Nt(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ce(e,r)}function Fv(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ss(t,n)):void 0,u={};return Mn(u,t,Reflect.ownKeys(Kt(t)),e&&((l,p)=>a&&!a.has(p)?l:new e({type:"optional",innerType:l}))),ce(t,Nt(t._zod.def,{shape:u,checks:[]}))}function Vv(e,t,n){let r=n?new Set(Ss(t,n)):void 0,o={};return Mn(o,t,Reflect.ownKeys(Kt(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),ce(t,Nt(t._zod.def,{shape:o}))}function tt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function rl(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function it(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function zr(e){return typeof e=="string"?e:e?.message}function Tr(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let o=r.maximum??r.length??r.size;o>=0&&t.push([o,n])}return t}function Do(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function st(e,t,n){var r;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(r=e).schema??(r.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:zr(e.inst?._zod.def?.error?.(e))??zr(i?.(e))??zr(t?.error?.(e))??zr(n.customError?.(e))??zr(n.localeError?.(e))??"Invalid input",a={};for(let u of Object.keys(e))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(a[u]=e[u]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function Mo(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ln(e){let t=e.length;if(!qv.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}function jo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ol(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 n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Or(...e){let[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function Hv(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function b_(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function v_(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Bv(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return b_(t+n)}function Jv(e){return v_(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Wv(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function Kv(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function il(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Qv(e,n,r.value)}}function hn(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Lo(e,t,n){return hn(e,t,n,!1)}function Gv(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return hn(this,n,r(this))},set(o){hn(this,n,o)}})}return t}function Qv(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:hn(this,t,n.bind(this))},set(r){hn(this,t,r)}})}function Yv(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}function Q(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Ku!==e._zod){Ku=void 0;return}Ku=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Xv);let o=mn;mn=!1;try{let i=n(this);return mn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),mn=mn||o,i}catch(i){throw delete this[t],mn=mn||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function ew(e,t,n,r){let o=Yv(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:i})}})}function sl(e){let t=()=>e;return t[Ns]=!0,t}var Gu,h_,$s,el,Ev,Ao,tl,Eo,Zo,qv,Qu,Ku,mn,Xv,Ns,Oe=re(()=>{gn();Gu=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}};h_=Symbol("evaluating");$s="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};el=Pr(()=>{if(Fe.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});Ev=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}`)}},Ao=new Set(["string","number","symbol"]),tl=new Set(["string","number","bigint","boolean","symbol","undefined"]);Eo={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]},Zo={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};qv=/[\uD800-\uDBFF]/;Qu=class{constructor(...t){}};mn=!1,Xv={configurable:!0,get(){mn=!0}};Ns="~constantCatch"});function tw(e){let t=x_;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return x_=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function y(e,t,n,r){let o={};function i(d){this.def=d,this.constr=h,this.traits=new Set}i.prototype=o;let s=n,a=s&&new WeakSet;function u(d,f){if(d._zod){if(d._zod.traits.has(e))return}else{al.value=new i(f);try{Object.defineProperty(d,"_zod",al)}finally{al.value=void 0}}if(d._zod.traits.add(e),t(d,f),a){let b=Object.getPrototypeOf(d),x=d._zod.constr.prototype,k=b;for(;k&&k!==x;)k=Object.getPrototypeOf(k);let v=k??b;a.has(v)||(a.add(v),il(v,s))}let g=h.prototype;for(let b in g)Object.prototype.hasOwnProperty.call(g,b)&&(b in d||(d[b]=g[b].bind(d)))}let l=r?.Parent??Object;class p extends l{}Object.defineProperty(p,"name",{value:e});function h(d){let f=r?.Parent?tw(p):this;u(f,d);let g=f._zod.deferred;if(g){for(let x of g)x();f._zod.deferred=void 0}let b=globalThis.__zod_globalConfig?.postProcessor;return b&&b(f),f}return Object.defineProperty(h,"init",{value:u}),Object.defineProperty(h,Symbol.hasInstance,{value:d=>r?.Parent&&d instanceof r.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(h,"name",{value:e}),h}function ze(e){return e&&Object.assign(Fe,e),Fe}var w_,Cs,al,x_,Ps,at,_n,Fe,gn=re(()=>{Oe();Cs=Object.freeze({status:"aborted"}),al={value:void 0,enumerable:!1},x_="captureStackTrace"in Error?Error:null;Ps=Symbol("zod_brand"),at=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},_n=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(w_=globalThis).__zod_globalConfig??(w_.__zod_globalConfig={});Fe=globalThis.__zod_globalConfig});function nw(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Cr,2)),e.message}function rw(e){this._zod.message=e}function iw(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Rr(e,t=n=>n.message){let n={},r=[];for(let o of e.issues)o.path.length>0?iw(n,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Ar(e,t=n=>n.message){let n={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let u=n,l=0;for(;l<a.length;){let p=a[l],h=l===a.length-1;if(p==="_errors"){h&&u._errors.push(t(s)),l++;continue}Object.prototype.hasOwnProperty.call(u,p)||Object.defineProperty(u,p,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=u[p];h&&d._errors.push(t(s)),u=d,l++}}}};return r(e),n}function Is(e,t=n=>n.message){let n={errors:[]},r=(o,i=[])=>{var s;for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(u=>r({issues:u},[...i,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...i,...a.path]);else{let u=[...i,...a.path];if(u.length===0){n.errors.push(t(a));continue}let l=n,p=0;for(;p<u.length;){let h=u[p],d=p===u.length-1;typeof h=="string"?(l.properties??(l.properties={}),Object.prototype.hasOwnProperty.call(l.properties,h)||Object.defineProperty(l.properties,h,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),l=l.properties[h]):(l.items??(l.items=[]),(s=l.items)[h]??(s[h]={errors:[]}),l=l.items[h]),d&&l.errors.push(t(a)),p++}}};return r(e),n}function z_(e){let t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(let r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function Ts(e){let t=[],n=[...e.issues].sort((r,o)=>(r.path??[]).length-(o.path??[]).length);for(let r of n)t.push(`\u2716 ${r.message}`),r.path?.length&&t.push(` \u2192 at ${z_(r.path)}`);return t.join(`
15
+ `)}var ow,ul,k_,$_,ll,ct,pl=re(()=>{gn();Oe();ow={get:nw,set:rw,enumerable:!0,configurable:!0},ul={value:void 0,enumerable:!1},k_=new WeakSet([Object.prototype,Error.prototype]),$_=(e,t)=>{e.name="$ZodError",ul.value=t,Object.defineProperty(e,"issues",ul),ul.value=void 0,Object.defineProperty(e,"message",ow);let n=Object.getPrototypeOf(e);k_.has(n)||(k_.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},ll=y("$ZodError",$_),ct=y("$ZodError",$_,void 0,{Parent:Error})});function Os(e,t){return{callee:t?.callee??e,Err:t?.Err}}function S_(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>st(o,n,ze()))),t=void 0,n=void 0),r},set error(o){r=o,t=void 0,n=void 0}}}function uw(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(r[cw]=!0,i=o({value:t,issues:[]},r)):i=e._zod.run({value:t,issues:[]},r),i instanceof Promise)throw new at;return i.issues.length===0}var Er,Uo,Zr,Fo,Dr,Rs,Mr,dl,aw,cw,Un,Fn,As,N_,Es,C_,Zs,P_,Ds,I_,Ms,T_,js,O_,Ls,R_,Us,A_,fl=re(()=>{gn();pl();Oe();Er=e=>{let t=(n,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new at;if(a.issues.length){let u=new(i?.Err??e)(a.issues.map(l=>st(l,s,ze())));throw $s(u,i?.callee??t),u}return a.value};return t},Uo=Er(ct),Zr=e=>{let t=async(n,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let u=new(i?.Err??e)(a.issues.map(l=>st(l,s,ze())));throw $s(u,i?.callee??t),u}return a.value};return t},Fo=Zr(ct),Dr=e=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new at;return i.issues.length?S_(e,i.issues,o):{success:!0,data:i.value}},Rs=Dr(ct);Mr=e=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?S_(e,i.issues,o):{success:!0,data:i.value}},dl=Mr(ct),aw=Symbol.for("zod.compile.invalid"),cw=Symbol.for("zod.compile.fallback"),Un=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==aw)return!0;if(r.definite===!0&&n===void 0)return!1}return uw(e,t,n)});Fn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},As=e=>{let t=Er(e),n=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,a,Os(n,s))};return n},N_=As(ct),Es=e=>{let t=Er(e),n=(r,o,i,s)=>t(r,o,i,Os(n,s));return n},C_=Es(ct),Zs=e=>{let t=Zr(e),n=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,a,Os(n,s))};return n},P_=Zs(ct),Ds=e=>{let t=Zr(e),n=async(r,o,i,s)=>await t(r,o,i,Os(n,s));return n},I_=Ds(ct),Ms=e=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Dr(e)(t,n,o)},T_=Ms(ct),js=e=>(t,n,r)=>Dr(e)(t,n,r),O_=js(ct),Ls=e=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Mr(e)(t,n,o)},R_=Ls(ct),Us=e=>async(t,n,r)=>Mr(e)(t,n,r),A_=Us(ct)});var ft={};At(ft,{anyString:()=>Ll,base64:()=>Tl,base64url:()=>Ol,bigint:()=>Fl,boolean:()=>Vl,browserEmail:()=>_w,cidrv4:()=>Pl,cidrv6:()=>Il,creditCard:()=>Fs,cuid:()=>hl,cuid2:()=>gl,currencyCode:()=>Zl,date:()=>Dl,datetime:()=>jl,domain:()=>Al,duration:()=>xl,e164:()=>El,email:()=>$l,emoji:()=>zl,extendedDuration:()=>lw,guid:()=>kl,hex:()=>Wl,hostname:()=>Rl,html5Email:()=>mw,httpProtocol:()=>Vo,iban:()=>Vs,idnEmail:()=>gw,integer:()=>qo,ipv4:()=>Sl,ipv6:()=>Nl,ksuid:()=>bl,lowercase:()=>Bl,mac:()=>Cl,md5_base64:()=>ww,md5_base64url:()=>xw,md5_hex:()=>vw,nanoid:()=>vl,nanoidOfLength:()=>wl,null:()=>ql,number:()=>Qt,rfc5322Email:()=>hw,sha1_base64:()=>$w,sha1_base64url:()=>zw,sha1_hex:()=>kw,sha256_base64:()=>Nw,sha256_base64url:()=>Cw,sha256_hex:()=>Sw,sha384_base64:()=>Iw,sha384_base64url:()=>Tw,sha384_hex:()=>Pw,sha512_base64:()=>Rw,sha512_base64url:()=>Aw,sha512_hex:()=>Ow,string:()=>Ul,time:()=>Ml,ulid:()=>_l,undefined:()=>Hl,unicodeEmail:()=>E_,uppercase:()=>Jl,uuid:()=>Vn,uuid4:()=>pw,uuid6:()=>dw,uuid7:()=>fw,xid:()=>yl});function wl(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}function zl(){return new RegExp(yw,"u")}function bw(e){return new RegExp(`^${e}$`)}function ml(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 Ml(e){return new RegExp(`^${ml(e)}$`)}function jl(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${ml({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${ml({precision:e.precision})}`:n;return new RegExp(`^${Z_}T(?:${r})$`)}function Ho(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Bo(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var hl,gl,_l,yl,bl,vl,xl,lw,kl,Vn,pw,dw,fw,$l,mw,hw,E_,gw,_w,yw,Sl,Nl,Cl,Pl,Il,Tl,Ol,Rl,Al,Vo,El,Fs,Zl,Vs,Z_,Dl,Ll,Ul,Fl,qo,Qt,Vl,ql,Hl,Bl,Jl,Wl,vw,ww,xw,kw,$w,zw,Sw,Nw,Cw,Pw,Iw,Tw,Ow,Rw,Aw,qn=re(()=>{Oe();hl=/^[cC][0-9a-z]{6,}$/,gl=/^[0-9a-z]+$/,_l=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,yl=/^[0-9a-vA-V]{20}$/,bl=/^[A-Za-z0-9]{27}$/,vl=/^[a-zA-Z0-9_-]{21}$/;xl=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,lw=/^[-+]?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)?)??$/,kl=/^([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})$/,Vn=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)$/,pw=Vn(4),dw=Vn(6),fw=Vn(7),$l=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,mw=/^[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])?)*$/,hw=/^(([^<>()\[\]\\.,;:\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,}))$/,E_=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,gw=E_,_w=/^[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])?)*$/,yw="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";Sl=/^(?:(?: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])$/,Nl=/^(([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}|:))$/,Cl=e=>{let t=_t(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Pl=/^((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])$/,Il=/^(([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])$/,Tl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ol=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Rl=/^(?=.{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])?)*\.?$/,Al=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Vo=/^https?$/,El=/^\+[1-9]\d{6,14}$/,Fs=/^\d(?:[ -]?\d){11,18}$/,Zl=/^(?: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)$/,Vs=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,Z_="(?:(?:\\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])))";Dl=bw(Z_);Ll=/^[\s\S]{0,}$/,Ul=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Fl=/^-?\d+n?$/,qo=/^-?\d+$/,Qt=/^-?\d+(?:\.\d+)?$/,Vl=/^(?:true|false)$/i,ql=/^null$/i,Hl=/^undefined$/i,Bl=/^[^A-Z]*$/,Jl=/^[^a-z]*$/,Wl=/^[0-9a-fA-F]*$/;vw=/^[0-9a-fA-F]{32}$/,ww=Ho(22,"=="),xw=Bo(22),kw=/^[0-9a-fA-F]{40}$/,$w=Ho(27,"="),zw=Bo(27),Sw=/^[0-9a-fA-F]{64}$/,Nw=Ho(43,"="),Cw=Bo(43),Pw=/^[0-9a-fA-F]{96}$/,Iw=Ho(64,""),Tw=Bo(64),Ow=/^[0-9a-fA-F]{128}$/,Rw=Ho(86,"=="),Aw=Bo(86)});function Hs(e,t,n){e.issues.length&&t.issues.push(...it(n,e.issues))}var _e,Kl,Gl,qs,Bs,Js,Ql,Yl,Xl,ep,tp,np,rp,op,ip,jr,sp,ap,cp,up,lp,pp,dp,fp,mp,hp,Ws=re(()=>{gn();qn();Oe();_e=y("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Kl=e=>{let t=e.value;return!ks(t)&&t.size!==void 0},Gl=e=>{let t=e.value;return!ks(t)&&t.length!==void 0},qs={number:"number",bigint:"bigint",object:"date"},Bs=y("$ZodCheckLessThan",(e,t)=>{_e.init(e,t);let n=qs[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:qs[typeof r.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Js=y("$ZodCheckGreaterThan",(e,t)=>{_e.init(e,t);let n=qs[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:qs[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ql=y("$ZodCheckMultipleOf",(e,t)=>{_e.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Oo(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Yl=y("$ZodCheckNumberFormat",(e,t)=>{_e.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,i]=Eo[t.format];e._zod.check=s=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Xl=y("$ZodCheckBigIntFormat",(e,t)=>{_e.init(e,t);let[n,r]=Zo[t.format];e._zod.check=o=>{let i=o.value;i<n&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),i>r&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),ep=y("$ZodCheckMaxSize",(e,t)=>{var n;_e.init(e,t),(n=e._zod.def).when??(n.when=Kl),e._zod.check=r=>{let o=r.value;o.size<=t.maximum||r.issues.push({origin:Mo(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),tp=y("$ZodCheckMinSize",(e,t)=>{var n;_e.init(e,t),(n=e._zod.def).when??(n.when=Kl),e._zod.check=r=>{let o=r.value;o.size>=t.minimum||r.issues.push({origin:Mo(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),np=y("$ZodCheckSizeEquals",(e,t)=>{var n;_e.init(e,t),(n=e._zod.def).when??(n.when=Kl),e._zod.check=r=>{let o=r.value,i=o.size;if(i===t.size)return;let s=i>t.size;r.issues.push({origin:Mo(o),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),rp=y("$ZodCheckMaxLength",(e,t)=>{var n;_e.init(e,t),(n=e._zod.def).when??(n.when=Gl),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Ln(o):i)<=t.maximum)return;let a=jo(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),op=y("$ZodCheckMinLength",(e,t)=>{var n;_e.init(e,t),(n=e._zod.def).when??(n.when=Gl),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Ln(o):i)>=t.minimum)return;let a=jo(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ip=y("$ZodCheckLengthEquals",(e,t)=>{var n;_e.init(e,t),(n=e._zod.def).when??(n.when=Gl),e._zod.check=r=>{let o=r.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?Ln(o):i;if(s===t.length)return;let a=jo(o),u=s>t.length;r.issues.push({origin:a,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),jr=y("$ZodCheckStringFormat",(e,t)=>{var n,r;_e.init(e,t),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),sp=y("$ZodCheckRegex",(e,t)=>{jr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ap=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Bl),jr.init(e,t)}),cp=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Jl),jr.init(e,t)}),up=y("$ZodCheckIncludes",(e,t)=>{_e.init(e,t);let n=_t(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),lp=y("$ZodCheckStartsWith",(e,t)=>{_e.init(e,t);let n=new RegExp(`^${_t(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),pp=y("$ZodCheckEndsWith",(e,t)=>{_e.init(e,t);let n=new RegExp(`.*${_t(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});dp=y("$ZodCheckProperty",(e,t)=>{_e.init(e,t),e._zod.check=n=>{let r=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(o=>Hs(o,n,t.property));Hs(r,n,t.property)}}),fp=y("$ZodCheckProperties",(e,t)=>{_e.init(e,t),Lo(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=r=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map(s=>[s,t.shape[s]]));let o=r.value,i;for(let[s,a]of n){let u=a._zod.run({value:o[s],issues:[]},{});u instanceof Promise?(i??(i=[]),i.push(u.then(l=>Hs(l,r,s)))):Hs(u,r,s)}if(i)return Promise.all(i).then(()=>{})}}),mp=y("$ZodCheckMimeType",(e,t)=>{_e.init(e,t);let n=new Set(t.mime);e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),hp=y("$ZodCheckOverwrite",(e,t)=>{_e.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}})});var Hn,Ks=re(()=>{Hn=class{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split(`
16
+ `).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.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,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
17
+ ${n.join(`
18
+ `)}
19
+ };`)(...Object.values(this.closed))}}});var gp,_p=re(()=>{gp={major:4,minor:6,patch:7}});async function Ew(e,t){let n={async:!0};return X_(await e._zod.run({value:t,issues:[]},n),n)}function ea(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return X_(r,n)}catch{}return Ew(e,t)},vendor:"zod",version:1}}function kp(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ta(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?kp(e)||Jo:ey(e,t)}function ey(e,t){if(!t.normalize&&t.protocol?.source===Vo.source&&!/^https?:\/\//i.test(e))return xp;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse=="function")return n.parse(e)??Jo}return new URL(e)}catch{return Jo}}function Wo(e){return e.replace(Zw,"")}function na(e,t){return t.lastIndex=0,t.test(e.hostname)}function ra(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}function Ko(e){return Dw.test(e)?kp(`http://[${e}]`):!1}function oa(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let o=Number(r);return`${o}`!==r||o<0||o>128?!1:Ko(n)}function Go(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function sa(e){if(!Qo.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Go(n)}function jw(e){let t=e.length,n=1,r=0;for(;t;){let o=e.charCodeAt(--t)-48;n^=1,r+=n?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}function aa(e){return Fs.test(e)?jw(e.replace(Mw,"")):!1}function Lw(e){let t=0,n=e.length;for(let r=4;r<n;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let r=0;r<4;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}function ca(e){return Vs.test(e)?Lw(e):!1}function ua(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}function od(e,t){let n=Tr(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let a=t(i.value);if(a>r&&!s?.skipChecks&&s?.direction!=="backward"){for(let[u,l]of Tr(e._zod.def.checks))if(a>u&&l._zod.def.when(i)){let p=i.issues.length;return l._zod.check(i),i.issues[p].continue=!1,Do(i.issues,p,e),i}}return o(i,s)}}function M_(e,t,n){e.issues.length&&t.issues.push(...it(n,e.issues)),t.value[n]=e.value}function Xs(e,t,n,r,o,i){let s=n in r,a=i==="optional";if(!(!s&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...it(n,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(s||o==="defaulted"&&!a)&&(t.value[n]=void 0):t.value[n]=e.value}}function ty(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:qw,o=r.length?[...t,...r]: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=nl(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function ny(e,t,n,r,o,i,s){let a=[],u=o.keySet,l=o.catchall._zod,p=l.def.type,h=l.optin,d=l.optout,f=0;for(let g in t){if(s&&n.issues.length!==f){if(tt(n,f))break;f=n.issues.length}if(u.has(g))continue;if(g==="__proto__"){p==="never"&&a.push(g);continue}if(p==="never"){a.push(g);continue}let b=l.run({value:t[g],issues:[]},r);b instanceof Promise?e.push(b.then(x=>Xs(x,n,g,t,h,d))):Xs(b,n,g,t,h,d)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>n):n}function j_(e,t,n,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!tt(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>st(s,r,ze())))}),t)}function L_(e,t,n,r){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:n,errors:e.map(i=>i.issues.map(s=>st(s,r,ze())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1,matches:o}),t)}function da(e,t){let n=e._zod,r=n.bag.optionsMap;r||(r=oy(n.def),n.bag.optionsMap=r);let o=r.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}function oy(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let o of r)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,n)}return t}function Lr(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(gt(e)&&gt(t)){let n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=Lr(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 n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t[r],s=Lr(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function U_(e,t,n){let r=new Map,o,i=new Map,s=(l,p)=>{let h;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),h=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let d=String(l.path[0]);i.has(d)||i.set(d,l),h=[d]}else return!1;for(let d of h)r.has(d)||r.set(d,{}),r.get(d)[p]=!0;return!0};for(let l of t.issues)s(l,"l")||e.issues.push(l);for(let l of n.issues)s(l,"r")||e.issues.push(l);let a=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=o?a.filter(p=>o.keys.includes(p)):[];l.length&&e.issues.push({...o,keys:l});for(let p of a)!l.includes(p)&&i.has(p)&&e.issues.push(i.get(p))}let u=Lr(t.value,n.value);if(!u.valid){if(tt(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}function F_(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function V_(e,t,n){e.issues.length&&t.issues.push(...it(n,e.issues)),t.value[n]=e.value}function q_(e,t,n,r,o){for(let i=0;i<n.length;i++){let s=e[i],a=i<r.length;if(!a&&i>=o&&n[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...it(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=r.length&&(n[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}function H_(e,t,n,r,o,i,s){e.issues.length&&(Ao.has(typeof r)?n.issues.push(...it(r,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(a=>st(a,s,ze()))})),t.issues.length&&(Ao.has(typeof r)?n.issues.push(...it(r,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:t.issues.map(a=>st(a,s,ze()))})),n.value.set(e.value,t.value)}function B_(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function J_(e,t){return e.value=t.issues.length?void 0:t.value,e}function W_(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function K_(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 G_(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>st(o,r,ze()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}function Gs(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}function Qs(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>Ys(e,i,t.out,n)):Ys(e,o,t.out,n)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Ys(e,i,t.in,n)):Ys(e,o,t.in,n)}}function Ys(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}function Q_(e){return e.memo||(e.value=Object.freeze(e.value)),e}function Hw(e){let t=e._zod.def,n=t.pattern,r=!!t.format?.includes("int"),o,i;for(let a of t.checks??[]){let u=a._zod.def;u.pattern&&(n=u.pattern),r||(r=!!u.format?.includes("int"));let l=u.minimum??u.length,p=u.maximum??u.length;l!==void 0&&(o===void 0||l>o)&&(o=l),p!==void 0&&(i===void 0||p<i)&&(i=p)}if(n)return n.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Ul({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(r&&s===Qt?qo:s)?.source}function yp(e){let t=e._zod.def,n=e._zod.pattern?.source,r=t.innerType??e._zod.innerType;if(r){let o=r._zod.pattern?.source,i=yp(r);return n&&o&&i&&i!==o?n.replace(Gt(o),()=>Gt(i)):n}if(t.options){let o=t.options.map(yp);if(o.every(Boolean))return`^(${o.map(i=>Gt(i)).join("|")})$`}return Hw(e)}function Y_(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Or(o))}}var B,X_,Bn,le,bp,vp,wp,xp,Jo,Zw,$p,zp,Sp,Np,Cp,Pp,Ip,Tp,Op,Rp,Ap,Ep,Zp,Dw,Dp,Mp,jp,Lp,ia,Up,Qo,Fp,Vp,Mw,qp,Hp,Bp,Jp,la,Wp,Yo,pa,Kp,Gp,Qp,Yp,Xp,ed,td,nd,rd,Uw,Fw,Vw,id,qw,ry,sd,Xo,ad,cd,ud,fa,ld,pd,dd,fd,md,hd,gd,ma,_d,yd,bd,vd,wd,xd,kd,$d,ha,ei,zd,Sd,Nd,Cd,Pd,ti,Id,Ur=re(()=>{Ws();gn();Ks();fl();qn();Oe();_p();Oe();B=y("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=gp;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,u,l)=>{if(a.memo)return a;let p=tt(a),h;for(let d of u){if(d._zod.def.when){if(rl(a)||!d._zod.def.when(a))continue}else if(p)continue;let f=a.issues.length,g=d._zod.check(a);if(g instanceof Promise&&l?.async===!1)throw new at;if(h||g instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await g,a.issues.length!==f&&(Do(a.issues,f,e),p||(p=tt(a,f)))});else{if(a.issues.length===f)continue;Do(a.issues,f,e),p||(p=tt(a,f))}}return h?h.then(()=>a):a},s=(a,u,l)=>{if(tt(a))return a.aborted=!0,a;let p=i(u,o,l);if(p instanceof Promise){if(l.async===!1)throw new at;return p.then(h=>e._zod.parse(h,l))}return e._zod.parse(p,l)};e._zod.run=(a,u)=>{if(u.skipChecks)return e._zod.parse(a,u);if(u.direction==="backward"){let p=e._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});return p instanceof Promise?p.then(h=>s(h,a,u)):s(p,a,u)}let l=e._zod.parse(a,u);if(l instanceof Promise){if(u.async===!1)throw new at;return l.then(p=>i(p,o,u))}return i(l,o,u)}}},{get"~standard"(){return Lo(this,"~standard",ea(this))},set"~standard"(e){hn(this,"~standard",e)}}),X_=(e,t)=>e.issues.length?{issues:e.issues.map(n=>st(n,t,ze()))}:{value:e.value};Bn=y("$ZodString",(e,t)=>{B.init(e,t),e._zod.pattern=t.pattern??Ll,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),le=y("$ZodStringFormat",(e,t)=>{jr.init(e,t),Bn.init(e,t)}),bp=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=kl),le.init(e,t)}),vp=y("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Vn(r))}else t.pattern??(t.pattern=Vn());le.init(e,t)}),wp=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=$l),le.init(e,t)}),xp=1,Jo=2;Zw=/[\t\n\r]/g;$p=y("$ZodURL",(e,t)=>{le.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),o=ta(r,t);if(o===xp){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===Jo){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=Wo(r);return}t.hostname&&!na(o,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!ra(o,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?o.href:Wo(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),zp=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=zl()),le.init(e,t)}),Sp=y("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?vl:wl(t.length)),le.init(e,t)}),Np=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=hl),le.init(e,t)}),Cp=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gl),le.init(e,t)}),Pp=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=_l),le.init(e,t)}),Ip=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=yl),le.init(e,t)}),Tp=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=bl),le.init(e,t)}),Op=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=jl(t)),le.init(e,t)}),Rp=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Dl),le.init(e,t)}),Ap=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ml(t)),le.init(e,t)}),Ep=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=xl),le.init(e,t)}),Zp=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Sl),le.init(e,t)}),Dw=/^[0-9a-fA-F:.]+$/;Dp=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Nl),le.init(e,t),e._zod.check=n=>{Ko(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Mp=y("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Cl(t.delimiter)),le.init(e,t)}),jp=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Pl),le.init(e,t)});Lp=y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Il),le.init(e,t),e._zod.check=n=>{oa(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});ia=/^[0-9a-zA-Z+/]*={0,2}$/,Up=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ia),le.init(e,t),e._zod.check=n=>{Go(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Qo=/^[A-Za-z0-9_-]*$/;Fp=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Qo),le.init(e,t),e._zod.check=n=>{sa(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Vp=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=El),le.init(e,t)}),Mw=/[- ]/g;qp=y("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Fs),le.init(e,t),e._zod.check=n=>{aa(n.value)||n.issues.push({code:"invalid_format",format:"credit_card",input:n.value,inst:e,continue:!t.abort})}});Hp=y("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Vs),le.init(e,t),e._zod.check=n=>{ca(n.value)||n.issues.push({code:"invalid_format",format:"iban",input:n.value,inst:e,continue:!t.abort})}});Bp=y("$ZodJWT",(e,t)=>{le.init(e,t),e._zod.check=n=>{ua(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Jp=y("$ZodCustomStringFormat",(e,t)=>{le.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),la=y("$ZodNumber",(e,t)=>{B.init(e,t),e._zod.pattern=Qt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Wp=y("$ZodNumberFormat",(e,t)=>{Yl.init(e,t),la.init(e,t)}),Yo=y("$ZodBoolean",(e,t)=>{B.init(e,t),e._zod.pattern=Vl,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),pa=y("$ZodBigInt",(e,t)=>{B.init(e,t),e._zod.pattern=Fl,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),Kp=y("$ZodBigIntFormat",(e,t)=>{Xl.init(e,t),pa.init(e,t)}),Gp=y("$ZodSymbol",(e,t)=>{B.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),n}}),Qp=y("$ZodUndefined",(e,t)=>{B.init(e,t),e._zod.pattern=Hl,e._zod.values=new Set([void 0]),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),n}}),Yp=y("$ZodNull",(e,t)=>{B.init(e,t),e._zod.pattern=ql,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Xp=y("$ZodAny",(e,t)=>{B.init(e,t),e._zod.parse=n=>n}),ed=y("$ZodUnknown",(e,t)=>{B.init(e,t),e._zod.parse=n=>n}),td=y("$ZodNever",(e,t)=>{B.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),nd=y("$ZodVoid",(e,t)=>{B.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}}),rd=y("$ZodDate",(e,t)=>{B.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let o=n.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});Uw=e=>Array.isArray(e)?e.length:-1,Fw=e=>e instanceof Map?e.size:-1,Vw=e=>e instanceof Set?e.size:-1;id=y("$ZodArray",(e,t)=>{B.init(e,t);let n=Fe.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=n?n.alloc(e,r,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let u=0;u<i.length;u++){let l=i[u],p=t.element._zod.run({value:l,issues:[]},o);if(p instanceof Promise)s.push(p.then(h=>M_(h,r,u)));else if(M_(p,r,u),a&&p.issues.length!==0&&tt(p))break}return s.length?Promise.all(s).then(()=>r):r},od(e,Uw)});qw=[];ry=y("$ZodObject",(e,t)=>{B.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let l=()=>{let p={...r};return Object.defineProperty(t,"shape",{value:p}),l.raw=p,p};l.raw=r,Object.defineProperty(t,"shape",{get:l})}let o=Pr(()=>ty(t));Q(e,"propValues",l=>{let p=l.def.shape,h={};for(let d in p){let f=p[d]._zod;if(f.values){Object.prototype.hasOwnProperty.call(h,d)||Je(h,d,new Set);for(let g of f.values)h[d].add(g);f.optin!==void 0&&h[d].add(void 0)}}return h});let i=jn,s=t.catchall,a,u=Fe.memoizer;u?.attach(e),e._zod.parse=(l,p)=>{a??(a=o.value);let h=l.value;if(!i(h))return l.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),l;l.value=u?u.alloc(e,l,{},p):{};let d=[],f=a.shape,g=p?.abortEarly,b=l.issues.length;for(let x of a.allKeys){if(g&&l.issues.length!==b){if(tt(l,b))break;b=l.issues.length}if(x==="__proto__")continue;let k=f[x],v=k._zod.optin,N=k._zod.optout,T=k._zod.run({value:h[x],issues:[]},p);T instanceof Promise?d.push(T.then(M=>Xs(M,l,x,h,v,N))):Xs(T,l,x,h,v,N)}return s?ny(d,h,l,p,o.value,e,g===!0):d.length?Promise.all(d).then(()=>l):l}}),sd=y("$ZodObjectJIT",(e,t)=>{ry.init(e,t);let n=e._zod.parse,r=Pr(()=>ty(t)),o=Fe.memoizer,i=f=>{let g=r.value,b=g.symbolKeys,x=new Hn(["payload","ctx"],{shape:f,inst:e,memo:o,syms:b}),k=M=>`shape[${M}]._zod.run({ value: input[${M}], issues: [] }, ctx)`,v=(M,D)=>`
20
+ let ${M}_ab = false;
21
+ for (let i = 0; i < ${M}.issues.length; i++) {
22
+ const iss = ${M}.issues[i];
23
+ iss.path = iss.path ? [${D}, ...iss.path] : [${D}];
24
+ payload.issues.push(iss);
25
+ if (iss.continue !== true) ${M}_ab = true;
26
+ }
27
+ if (${M}_ab && ctx && ctx.abortEarly) {
28
+ payload.value = newResult;
29
+ return payload;
30
+ }`;x.write("const input = payload.value;");let N=Object.create(null),T=0;for(let M of g.allKeys)N[M]=`key_${T++}`;x.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let M of g.allKeys){if(M==="__proto__")continue;let D=N[M],E=typeof M=="symbol"?`syms[${b.indexOf(M)}]`:et(M),ae=`${E} in input`,xe=f[M],he=xe?._zod?.optin,Ne=he!==void 0,I=xe?._zod?.optout==="optional";if(x.write(`const ${D} = ${k(E)};`),Ne&&I){let ke=he==="optional"?`${D}_present`:`${D}.value !== undefined || ${D}_present`;x.write(`
31
+ const ${D}_present = ${ae};
32
+ if (!${D}.issues.length || ${D}_present) {
33
+ if (${D}.issues.length) {${v(D,E)}
34
+ }
35
+
36
+ if (${ke}) {
37
+ newResult[${E}] = ${D}.value;
38
+ }
39
+ }
40
+
41
+ `)}else Ne?(x.write(`
42
+ if (${D}.issues.length) {${v(D,E)}
43
+ }
44
+ `),he==="defaulted"?x.write(`newResult[${E}] = ${D}.value;`):x.write(`
45
+ if (${D}.value !== undefined || ${ae}) {
46
+ newResult[${E}] = ${D}.value;
47
+ }
48
+ `)):x.write(`
49
+ const ${D}_present = ${ae};
50
+ if (${D}.issues.length) {${v(D,E)}
51
+ }
52
+ if (!${D}_present && !${D}.issues.length) {
53
+ payload.issues.push({
54
+ code: "invalid_type",
55
+ expected: "nonoptional",
56
+ input: undefined,
57
+ path: [${E}]
58
+ });
59
+ if (ctx && ctx.abortEarly) {
60
+ payload.value = newResult;
61
+ return payload;
62
+ }
63
+ }
64
+
65
+ if (${D}_present) {
66
+ newResult[${E}] = ${D}.value;
67
+ }
68
+
69
+ `)}return x.write("payload.value = newResult;"),x.write("return payload;"),x.compile()},s,a=jn,u=!Fe.jitless,p=u&&el.value,h=t.catchall,d;e._zod.parse=(f,g)=>{d??(d=r.value);let b=f.value;return a(b)?u&&p&&g?.async===!1&&g.jitless!==!0?(s||(s=i(t.shape)),f=s(f,g),h?ny([],b,f,g,d,e,g?.abortEarly===!0):f):n(f,g):(f.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),f)}});Xo=y("$ZodUnion",(e,t)=>{B.init(e,t),Q(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),Q(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Q(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),Q(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){let o=r.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Gt(i.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let u=a._zod.run({value:r.value,issues:[]},o);if(u instanceof Promise)s.push(u),i=!0;else{if(u.issues.length===0)return u;s.push(u)}}return i?Promise.all(s).then(a=>j_(a,r,e,o)):j_(s,r,e,o)}});ad=y("$ZodXor",(e,t)=>{Xo.init(e,t),t.inclusive=!1;let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let u=a._zod.run({value:r.value,issues:[]},o);u instanceof Promise?(s.push(u),i=!0):s.push(u)}return i?Promise.all(s).then(a=>L_(a,r,e,o)):L_(s,r,e,o)}});cd=y("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Xo.init(e,t);let n=e._zod.parse;Q(e,"propValues",o=>{let i={},s=0;for(let a of o.def.options){let u=a._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);u[o.def.discriminator]?.has(void 0)&&s++;for(let[l,p]of Object.entries(u)){Object.prototype.hasOwnProperty.call(i,l)||Je(i,l,new Set);for(let h of p)i[l].add(h)}}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 r=Pr(()=>oy(t));e._zod.parse=(o,i)=>{let s=o.value;if(!jn(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],u=r.value.get(a);return u&&(a!==void 0||i.direction!=="backward")?u._zod.run(o,i):t.unionFallback||i.direction==="backward"?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(l=>r.value.get(l)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),ud=y("$ZodIntersection",(e,t)=>{B.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([u,l])=>U_(n,u,l)):U_(n,i,s)}});fa=y("$ZodTuple",(e,t)=>{B.init(e,t);let n=t.items,r=Fe.memoizer;r?.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=r?r.alloc(e,o,[],i):[];let a=[],u=F_(n,"optin"),l=F_(n,"optout");if(!t.rest){if(s.length<u)return o.issues.push({code:"too_small",minimum:u,inclusive:!0,input:s,inst:e,origin:"array"}),o;s.length>n.length&&o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let p=new Array(n.length),h=t.rest?i?.abortEarly:void 0,d=!1;for(let f=0;f<n.length;f++){let g=n[f]._zod.run({value:s[f],issues:[]},i);g instanceof Promise?a.push(g.then(b=>{p[f]=b})):(p[f]=g,h&&!d&&g.issues.length&&(d=tt(g)))}if(t.rest&&!d){let f=n.length-1,g=s.slice(n.length),b=o.issues.length;for(let x of g){if(h&&o.issues.length!==b){if(tt(o,b))break;b=o.issues.length}f++;let k=t.rest._zod.run({value:x,issues:[]},i);k instanceof Promise?a.push(k.then(v=>V_(v,o,f))):V_(k,o,f)}}return a.length?Promise.all(a).then(()=>q_(p,o,n,s,l)):q_(p,o,n,s,l)}});ld=y("$ZodRecord",(e,t)=>{B.init(e,t);let n=Fe.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!gt(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};let u=new Set;for(let p of a)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){if(u.add(typeof p=="number"?p.toString():p),p==="__proto__")continue;let h=t.keyType._zod.run({value:p,issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(h.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(g=>st(g,o,ze())),input:p,path:[p],inst:e});continue}let d=h.value;if(d==="__proto__")continue;let f=t.valueType._zod.run({value:i[p],issues:[]},o);f instanceof Promise?s.push(f.then(g=>{g.issues.length&&r.issues.push(...it(p,g.issues)),r.value[d]=g.value})):(f.issues.length&&r.issues.push(...it(p,f.issues)),r.value[d]=f.value)}let l;for(let p in i)if(!u.has(p))if(t.mode==="loose"){if(p==="__proto__")continue;r.value[p]=i[p]}else l=l??[],l.push(p);l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let u;for(let l of Reflect.ownKeys(i)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,l))continue;let p=t.keyType._zod.run({value:l,issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Qt.test(l)&&p.issues.length){let g=t.keyType._zod.run({value:Number(l),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(p=g)}if(p.issues.length){t.mode==="loose"?r.value[l]=i[l]:a?(u=u??[],u.push(l)):r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(g=>st(g,o,ze())),input:l,path:[l],inst:e});continue}let d=p.value;if(d==="__proto__")continue;let f=t.valueType._zod.run({value:i[l],issues:[]},o);f instanceof Promise?s.push(f.then(g=>{g.issues.length&&r.issues.push(...it(l,g.issues)),r.value[d]=g.value})):(f.issues.length&&r.issues.push(...it(l,f.issues)),r.value[d]=f.value)}u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}return s.length?Promise.all(s).then(()=>r):r}}),pd=y("$ZodMap",(e,t)=>{B.init(e,t);let n=Fe.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let s=[];r.value=n?n.alloc(e,r,new Map,o):new Map;let a=o?.abortEarly,u=r.issues.length;for(let[l,p]of i){if(a&&r.issues.length!==u){if(tt(r,u))break;u=r.issues.length}let h=t.keyType._zod.run({value:l,issues:[]},o),d=t.valueType._zod.run({value:p,issues:[]},o);h instanceof Promise||d instanceof Promise?s.push(Promise.all([h,d]).then(([f,g])=>{H_(f,g,r,l,i,e,o)})):H_(h,d,r,l,i,e,o)}return s.length?Promise.all(s).then(()=>r):r},od(e,Fw)});dd=y("$ZodSet",(e,t)=>{B.init(e,t);let n=Fe.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let s=[];r.value=n?n.alloc(e,r,new Set,o):new Set;let a=o?.abortEarly,u=r.issues.length;for(let l of i){if(a&&r.issues.length!==u){if(tt(r,u))break;u=r.issues.length}let p=t.valueType._zod.run({value:l,issues:[]},o);p instanceof Promise?s.push(p.then(h=>B_(h,r))):B_(p,r)}return s.length?Promise.all(s).then(()=>r):r},od(e,Vw)});fd=y("$ZodEnum",(e,t)=>{B.init(e,t);let n=Nr(t.entries),r=new Set(n);e._zod.values=r,Q(e,"pattern",o=>{let i=Nr(o.def.entries).filter(s=>Ao.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>_t(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),md=y("$ZodLiteral",(e,t)=>{B.init(e,t);let n=new Set(t.values);e._zod.values=n,Q(e,"pattern",r=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?_t(i):i?_t(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),hd=y("$ZodFile",(e,t)=>{B.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return o instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),n}}),gd=y("$ZodTransform",(e,t)=>{B.init(e,t),e._zod.optin="optional",Fe.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new _n(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new at;return n.value=o,n}});ma=y("$ZodOptional",(e,t)=>{B.init(e,t),Q(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",Q(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),Q(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Gt(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>J_(n,i)):J_(n,o)}return t.innerType._zod.run(n,r)}}),_d=y("$ZodExactOptional",(e,t)=>{ma.init(e,t),Q(e,"values",n=>n.def.innerType._zod.values),Q(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),yd=y("$ZodNullable",(e,t)=>{B.init(e,t),Q(e,"optin",n=>n.def.innerType._zod.optin),Q(e,"optout",n=>n.def.innerType._zod.optout),Q(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Gt(r.source)}|null)$`):void 0}),Q(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),bd=y("$ZodDefault",(e,t)=>{B.init(e,t),e._zod.optin="defaulted",Q(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>W_(i,t)):W_(o,t)}});vd=y("$ZodPrefault",(e,t)=>{B.init(e,t),e._zod.optin="defaulted",Q(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),wd=y("$ZodNonOptional",(e,t)=>{B.init(e,t),Q(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>K_(i,e)):K_(o,e)}});xd=y("$ZodSuccess",(e,t)=>{B.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new _n("ZodSuccess");let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.issues.length===0,n)):(n.value=o.issues.length===0,n)}});kd=y("$ZodCatch",(e,t)=>{B.init(e,t),Q(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Q(e,"optout",n=>n.def.innerType._zod.optout),Q(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>G_(n,i,t,r)):G_(n,o,t,r)}}),$d=y("$ZodNaN",(e,t)=>{B.init(e,t),e._zod.parse=(n,r)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)}),ha=y("$ZodPipe",(e,t)=>{B.init(e,t),Q(e,"values",n=>n.def.in._zod.values),Q(e,"optin",n=>n.def.in._zod.optin),Q(e,"optout",n=>n.def.out._zod.optout),Q(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>Gs(s,t.in,r)):Gs(i,t.in,r)}let o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Gs(i,t.out,r)):Gs(o,t.out,r)}});ei=y("$ZodCodec",(e,t)=>{B.init(e,t),Q(e,"values",n=>n.def.in._zod.values),Q(e,"optin",n=>n.def.in._zod.optin),Q(e,"optout",n=>n.def.out._zod.optout),Q(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if((r.direction||"forward")==="forward"){let i=t.in._zod.run(n,r);return i instanceof Promise?i.then(s=>Qs(s,t,r)):Qs(i,t,r)}else{let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>Qs(s,t,r)):Qs(i,t,r)}}});zd=y("$ZodPreprocess",(e,t)=>{ha.init(e,t)}),Sd=y("$ZodReadonly",(e,t)=>{B.init(e,t),Q(e,"propValues",n=>n.def.innerType._zod.propValues),Q(e,"values",n=>n.def.innerType._zod.values),Q(e,"optin",n=>n.def.innerType?._zod?.optin),Q(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Q_):Q_(o)}});Nd=y("$ZodTemplateLiteral",(e,t)=>{B.init(e,t);let n=[];for(let r of t.parts)if(typeof r=="object"&&r!==null){let o=yp(r);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);n.push(Gt(o))}else if(r===null||tl.has(typeof r))n.push(_t(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(r,o)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r)}),Cd=y("$ZodFunction",(e,t)=>(B.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?Uo(e._def.input,r):r,i=Reflect.apply(n,this,o);return e._def.output?Uo(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await Fo(e._def.input,r):r,i=await Reflect.apply(n,this,o);return e._def.output?await Fo(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{let r=e.constructor;return Array.isArray(n[0])?new r({type:"function",input:new fa({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new r({type:"function",input:n[0],output:e._def.output})},e.output=n=>{let r=e.constructor;return new r({type:"function",input:e._def.input,output:n})},e)),Pd=y("$ZodPromise",(e,t)=>{B.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then(o=>t.innerType._zod.run({value:o,issues:[]},r))}),ti=y("$ZodLazy",(e,t)=>{B.init(e,t),Yu(e._zod,"innerType",()=>{let n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),Q(e,"pattern",n=>n.innerType?._zod?.pattern),Q(e,"propValues",n=>n.innerType?._zod?.propValues),Q(e,"optin",n=>n.innerType?._zod?.optin??void 0),Q(e,"optout",n=>n.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Id=y("$ZodCustom",(e,t)=>{_e.init(e,t),B.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Y_(i,n,r,e));Y_(o,n,r,e)}})});function ay(e){return e!==null&&typeof e=="object"}function Td(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}function ri(e,t,n){let r=cy.get(e);if(r!==void 0)return r?ni:Fr;if(t.has(e))return ni;t.add(e);let o=Fr,i=p=>{if(o!==ni&&p?._zod){let h=ri(p,t,n);h>o&&(o=h)}},s=(p,h)=>{let d=Fr;for(let f of Reflect.ownKeys(p)){let g=Object.getOwnPropertyDescriptor(p,f);if(h&&!g.enumerable)continue;let b=g.get?ya:g.value?._zod?ri(g.value,t,n):Fr;b>d&&(d=b)}return d},a=p=>{p>o&&(o=p)},u=e._zod.def,l=u.type;switch(l){case"object":{let p=Ir(u);a(p?s(p,!0):ya),i(u.catchall);break}case"array":i(u.element);break;case"tuple":for(let p of u.items)i(p);i(u.rest);break;case"record":case"map":i(u.keyType),i(u.valueType);break;case"set":i(u.valueType);break;case"union":for(let p of u.options)i(p);break;case"intersection":i(u.left),i(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(u.innerType);break;case"pipe":i(u.in),i(u.out);break;case"function":i(u.input),i(u.output);break;case"lazy":{let p=u._cachedInner??(n?e._zod.innerType:void 0);a(p?ri(p,t,!1):ya);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 p in u){let h=Object.getOwnPropertyDescriptor(u,p);if(!h||h.get)continue;let d=h.value;if(!(!d||typeof d!="object")){if(d._zod)i(d);else if(Array.isArray(d))for(let f of d)i(f)}}}return t.delete(e),Bw(e,o)}function Bw(e,t){return t!==ya&&cy.set(e,t===ni),t}function va(e){return ri(e,new Set,!0)!==Fr}function Jw(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}function Vr(){return Ww}function wa(e,t){let n=e[Od]?.backEdges;return n!==void 0&&ay(t)&&n.has(t)}var ba,Od,sy,cy,Fr,ya,ni,ga,_a,Ww,Rd=re(()=>{Oe();ba=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Od="~memo",sy=[];cy=new WeakMap,Fr=0,ya=1,ni=2;_a=[],Ww={alloc(e,t,n){let r=ga;if(!r)return n;ga=void 0;let o={value:n,issues:null};return r.set(t.value,o),_a.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&wa(i,o.value))throw new ba;return n(o,i)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(u,l)=>{if(n===void 0){let k=ri(e,new Set,!1);if(k===Fr)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(u,l);k===ni||r?n=!0:r=!0}let p=u.value;if(!ay(p))return s(u,l);let h=l[Od];h||(h={buckets:new WeakMap,backEdges:void 0},l[Od]=h);let d;o===l?d=i:(d=Jw(h,e),o=l,i=d);let f=d.get(p);if(f)return u.value=f.value,f.issues?f.issues.length&&u.issues.push(...Td(f.issues)):(u.memo=!0,h.backEdges??(h.backEdges=new WeakSet),h.backEdges.add(f.value)),u;ga=d;let g=_a.length,b=s(u,l);ga=void 0;let x=_a.length>g?_a.pop():void 0;return b instanceof Promise?b.then(k=>(x&&(x.issues=k.issues.length?Td(k.issues):sy),k)):(x&&(x.issues=b.issues.length?Td(b.issues):sy),b)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}}});function xa(){return{localeError:Kw()}}var Kw,Ad=re(()=>{Oe();Kw=()=>{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 n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):r[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=ol(i.input),u=o(a,i.input);return`Invalid input: expected ${s}, received ${u}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${zs(i.values[0])}`:`Invalid option: expected one of ${xs(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 ${n[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${xs(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 qr={};At(qr,{en:()=>xa});var Ed=re(()=>{Ad()});function oi(){return new ka}var uy,$a,za,ka,Ve,ii=re(()=>{$a=Symbol("ZodOutput"),za=Symbol("ZodInput"),ka=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let r={...this.get(n)??{}};delete r.id;let o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};(uy=globalThis).__zod_globalRegistry??(uy.__zod_globalRegistry=oi());Ve=globalThis.__zod_globalRegistry});function Qw(e,t){try{return Na(e,{assertOnly:!0})}catch{return t}}function Sa(e,t){try{let n=Na(e),r=si(e,n);return r._zod.bag.validator=Qw(e,n),r}catch(n){if(t?.strict)throw n;return e}}function si(e,t){if(va(e))throw new te("a schema whose subtree contains a reference cycle");let n=ce(e),r=e._zod.run,o=r.__originalRun??r,i=(s,a)=>{if(a?.async||a?.direction==="backward"||a?.skipChecks||a?.[ly]||a&&wa(a,s.value))return o(s,a);let u=t(s.value);return u!==Xe?(s.value=u,s):(a&&(a[ly]=!0),o(s,a))};return i.__originalRun=o,n._zod.bag.fallbackRun=o,n._zod.bag.validator=t,n._zod.run=i,r.__originalRun||Yw(n,e,t),n}function Yw(e,t,n){let r=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;r.safeParse=(s,a)=>{let u=n(s);return u!==Xe?{success:!0,data:u}:i(s,a)}}if(typeof o.parse=="function"){let i=o.parse;r.parse=(s,a)=>{let u=n(s);return u!==Xe?u:i(s,a)}}}function Na(e,t){let n=!0;try{n=va(e)}catch{}if(n)throw new te("a schema whose subtree contains a reference cycle");let r={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new Hn(["input"]),i=$e(o,r,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let s=["INVALID",...r.constants.keys()],a=[Xe,...r.constants.values()],u=o.content.join(`
70
+ `),l=t?.debug?s.length>0?`// Constants: ${s.join(", ")}
71
+ ${u}`:u:"",p=Function,h=`return (input) => {
72
+ ${u}
73
+ }`,d;try{d=new p(...s,h)(...a)}catch(f){throw new te(`this schema (generated code failed to evaluate: ${f.message})`)}return t?.debug&&(d.code=l),d.definite=r.definite,d}function H(e,t){for(let[r,o]of e.constants)if(o===t)return r;let n=`c${e.constantCounter++}`;return e.constants.set(n,t),n}function Wn(e,t){return e.definite=!1,H(e,t)}function V(e){return`v${e.varCounter++}`}function Xw(e,t){let n=e._zod.run({value:t,issues:[]},{});if(n&&typeof n.then=="function")return Xe;let r=n;return r.issues.length===0?r.value:Xe}function Ye(e,t,n,r,o=!0){let i=e.content.length,s=t.constants.size,a=t.constantCounter,u=t.varCounter;try{return $e(e,t,n,r,o)}catch(l){if(!(l instanceof te)||!l.islandable)throw l;if(e.content.length=i,t.constants.size>s){let p=Array.from(t.constants.keys()).slice(s);for(let h of p)t.constants.delete(h)}return t.constantCounter=a,t.varCounter=u,ex(e,t,n,r)}}function ex(e,t,n,r){t.definite=!1;let o=H(t,n),i=H(t,Xw),s=V(t);return e.write(`const ${s} = ${i}(${o}, ${r});`),e.write(`if (${s} === INVALID) return INVALID;`),s}function nx(e,t,n,r){let o=n._zod.def.checks;if(!o||o.length===0)return r;let i=r;for(let s of o){let a=s._zod.def;if(a.when&&!tx.has(a.check))throw new te('check with a custom "when" condition');switch(a.check){case"greater_than":rx(e,t,a,i);break;case"less_than":ox(e,t,a,i);break;case"multiple_of":ix(e,t,a,i);break;case"number_format":gy(e,a,i);break;case"min_length":{let u=yn(a.minimum,"min_length"),l=Zd(e,t,i,`${i}.length >= ${u} && ${i}.length < ${a.minimum*2}`);e.write(`if (${l} < ${u}) return INVALID;`);break}case"max_length":{let u=yn(a.maximum,"max_length"),l=Zd(e,t,i,`${i}.length > ${u}`);e.write(`if (${l} > ${u}) return INVALID;`);break}case"length_equals":{let u=yn(a.length,"length_equals"),l=Zd(e,t,i,`${i}.length >= ${u} && ${i}.length <= ${a.length*2}`);e.write(`if (${l} !== ${u}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${yn(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${yn(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${yn(a.size,"size_equals")}) return INVALID;`);break;case"string_format":i=_y(e,t,a,i);break;case"custom":i=px(e,t,s,i);break;case"bigint_format":sx(e,a,i);break;case"mime_type":ax(e,t,a,i);break;case"property":ux(e,t,a,i);break;case"properties":cx(e,t,a,i);break;case"overwrite":{let u=V(t);lx(e,t,s,i,u),i=u;break}default:throw new te(`check type ${a.check}`)}}return i}function Zd(e,t,n,r){let o=H(t,Ln),i=V(t);return e.write(`const ${i} = typeof ${n} === "string" && ${r} ? ${o}(${n}) : ${n}.length;`),i}function yn(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new te(`${t} bound of type ${typeof e}`);return`${e}`}function hy(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new te("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new te("comparison check with Invalid Date bound");return H(e,t)}throw new te(`comparison check bound of type ${typeof t}`)}function rx(e,t,n,r){let o=n.inclusive?"<":"<=";e.write(`if (${r} ${o} ${hy(t,n.value)}) return INVALID;`)}function ox(e,t,n,r){let o=n.inclusive?">":">=";e.write(`if (${r} ${o} ${hy(t,n.value)}) return INVALID;`)}function ix(e,t,n,r){if(typeof n.value=="bigint"){if(n.value===BigInt(0))throw new te("multiple_of check with a zero divisor");e.write(`if (${r} % ${n.value}n !== 0n) return INVALID;`)}else{let o=H(t,Oo);e.write(`if (${o}(${r}, ${yn(n.value,"multiple_of")}) !== 0) return INVALID;`)}}function gy(e,t,n){let r=t.format;switch(r){case"safeint":e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${n})) return INVALID;`);break;default:throw new te(`number format ${r}`)}}function sx(e,t,n){let r=t.format;if(r)switch(r){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break;default:throw new te(`bigint format ${r}`)}}function ax(e,t,n,r){let o=n.mime;if(o&&o.length>0){let i=H(t,new Set(o));e.write(`if (!${i}.has(${r}.type)) return INVALID;`)}}function cx(e,t,n,r){if(n.when)throw new te('check with a custom "when" condition');e.write(`if (${r} == null) return INVALID;`);let o=n.shape;for(let i of Reflect.ownKeys(o)){let s=typeof i=="symbol"?H(t,i):et(i),a=V(t);e.write(`const ${a} = ${r}[${s}];`),Ye(e,t,o[i],a,!1)}}function ux(e,t,n,r){let o=`${r}[${JSON.stringify(n.property)}]`;$e(e,t,n.schema,o)}function lx(e,t,n,r,o){let i=n._zod.def.tx;if(!i)throw new te("overwrite check without a transform function");if(Kn(i))throw new yt("z.compile: async overwrite transforms are not supported");let s=H(t,i);e.write(`const ${o} = ${s}(${r});`)}function Dd(){throw new at}function jd(e){this.issues.push(e)}function px(e,t,n,r){let o=n._zod.def;if(o.fn){if(Kn(o.fn))throw new yt("z.compile: async .refine() predicates are not supported");let i=Wn(t,o.fn),s=H(t,Dd),a=V(t);return e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),r}if(n._zod.check){if(Kn(n._zod.check))throw new yt("z.compile: async .superRefine() / check functions are not supported");let i=n._zod.check,a=Wn(t,l=>{let p={value:l,issues:[],addIssue:jd};return i(p)instanceof Promise&&Dd(),p.issues.length===0?p.value:Xe}),u=V(t);return e.write(`const ${u} = ${a}(${r});`),e.write(`if (${u} === INVALID) return INVALID;`),u}throw new te("custom check without a predicate or check function")}function _y(e,t,n,r,o=!0){let i=n.format;if(i==="base64"){let l=H(t,Go);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="base64url"){let l=H(t,sa);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="jwt"){let l=H(t,ua),p=H(t,n.alg??null);return e.write(`if (!${l}(${r}, ${p})) return INVALID;`),r}if(i==="ipv6"){let l=H(t,Ko);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="cidrv6"){let l=H(t,oa);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="credit_card"){let l=H(t,aa);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="iban"){let l=H(t,ca);return e.write(`if (!${l}(${r})) return INVALID;`),r}let s=n;if(i==="url"||i==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let l=H(t,ta),p=H(t,n),h=V(t),d=V(t);if(e.write(`const ${h} = ${r}.trim();`),e.write(`const ${d} = ${l}(${h}, ${p});`),e.write(`if (typeof ${d} === "number") return INVALID;`),s.hostname!==void 0){let b=H(t,na);e.write(`if (!${b}(${d}, ${p}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let b=H(t,ra);e.write(`if (!${b}(${d}, ${p}.protocol)) return INVALID;`)}if(!o)return null;let f=V(t),g=s.normalize?`${d}.href`:`${H(t,Wo)}(${h})`;return e.write(`const ${f} = ${g};`),f}let a=n.fn;if(a){if(Kn(a))throw new te(`async string format ${i}`);let l=H(t,a);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(dx.has(i)&&n.pattern){let l=H(t,n.pattern);return e.write(`${l}.lastIndex = 0;`),e.write(`if (!${l}.test(${r})) return INVALID;`),r}let u=n.format;switch(u){case"regex":throw new te("regex format without a pattern");case"lowercase":e.write(`if (${r} !== ${r}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${r} !== ${r}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${r}.includes(${et(n.includes)})) return INVALID;`);break;case"starts_with":{let l=n.prefix;e.write(`if (${r}.slice(0, ${l.length}) !== ${et(l)}) return INVALID;`);break}case"ends_with":{let l=n.suffix;e.write(`if (${r}.slice(-${l.length}) !== ${et(l)}) return INVALID;`);break}default:throw new te(`string format ${u}`)}return r}function $e(e,t,n,r,o=!0){let i=n._zod.def,s=i.type;if(i.coerce)throw new te(`coercion (z.coerce.${s}())`);let a=o||!!i.checks?.length,u;switch(s){case"string":u=fx(e,t,n,r,a);break;case"number":u=mx(e,n,r);break;case"boolean":u=hx(e,r);break;case"bigint":u=gx(e,n,r);break;case"symbol":u=_x(e,r);break;case"undefined":u=yx(e,r);break;case"null":u=bx(e,r);break;case"any":case"unknown":u=r;break;case"never":e.write("return INVALID;"),u=r;break;case"void":u=vx(e,r);break;case"nan":u=wx(e,r);break;case"date":u=xx(e,r);break;case"object":u=kx(e,t,n,r,a);break;case"optional":u=$x(e,t,n,r,a);break;case"nullable":u=Nx(e,t,n,r,a);break;case"array":u=Cx(e,t,n,r,a);break;case"literal":u=Px(e,t,n,r);break;case"enum":u=Ix(e,t,n,r);break;case"readonly":{let l=dy(e,t,n,r),p=V(t);e.write(`const ${p} = Object.freeze(${l});`),u=p;break}case"success":dy(e,t,n,r),u="true";break;case"default":case"prefault":u=Tx(e,t,n,r);break;case"nonoptional":u=Ox(e,t,n,r);break;case"tuple":u=Rx(e,t,n,r);break;case"union":u=Ax(e,t,n,r);break;case"intersection":u=Dx(e,t,n,r);break;case"record":u=Mx(e,t,n,r);break;case"map":u=Lx(e,t,n,r);break;case"set":u=Ux(e,t,n,r);break;case"file":u=Fx(e,r);break;case"template_literal":u=Vx(e,t,n,r);break;case"lazy":u=qx(e,t,n,r);break;case"pipe":u=Hx(e,t,n,r);break;case"custom":u=Bx(e,t,n,r);break;case"transform":u=Kx(e,t,n,r);break;case"catch":u=Wx(e,t,n,r);break;default:throw new te(`schema type ${s}`)}return u===null?null:nx(e,t,n,u)}function fx(e,t,n,r,o=!0){e.write(`if (typeof ${r} !== "string") return INVALID;`);let i=n._zod.def;return i.format===void 0?r:_y(e,t,i,r,o)}function mx(e,t,n){e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`);let r=t._zod.def;return r.check==="number_format"&&r.format&&gy(e,{format:r.format},n),n}function hx(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function gx(e,t,n){e.write(`if (typeof ${n} !== "bigint") return INVALID;`);let r=t._zod.def;if(r.format)switch(r.format){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break}return n}function _x(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function yx(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function bx(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function vx(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function wx(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function xx(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function kx(e,t,n,r,o=!0){let i=n._zod.def;e.write(`if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) return INVALID;`);let s=i.shape,a=Object.keys(s),u=Object.getOwnPropertySymbols(s),l=u.length?[...a,...u]:a,p=v=>typeof v=="symbol"?H(t,v):et(v),h=v=>typeof v=="symbol"?`[${p(v)}]`:et(v),d=s;if(a.includes("__proto__"))throw new te('object shape key "__proto__"');let f=new Map;for(let v of l){let N=d[v],T=p(v),M=V(t);if(e.write(`const ${M} = ${r}[${T}];`),N._zod.optin!==void 0){let D=V(t);e.write(`let ${D} = (() => {`),e.indented(E=>{let ae=Ye(E,t,N,M);E.write(`return ${ae};`)}),e.write("})();"),N._zod.optout==="optional"?(e.write(`if (${D} === INVALID) {`),e.indented(E=>{E.write(`if (${T} in ${r}) return INVALID;`),E.write(`${D} = undefined;`)}),e.write("}")):e.write(`if (${D} === INVALID) return INVALID;`),f.set(v,D)}else{Sx(N)&&e.write(`if (!(${T} in ${r})) return INVALID;`);let D=Ye(e,t,N,M,o);D!==null&&f.set(v,D)}}let g=i.catchall,b="none";if(g){let v=g._zod.def.type;if(v==="never"){let N=a.map(T=>`k !== ${et(T)}`).join(" && ")||"true";e.write(`for (const k in ${r}) {`),e.indented(T=>{T.write(`if (${N}) return INVALID;`)}),e.write("}")}else(v==="unknown"||v==="any")&&!g._zod.def.checks?.length?b="passthrough":b="schema"}let x=V(t),k=l.some(v=>py(d[v])||Md(d[v]));if(!o){if(b==="schema"){let v=a.length>0?H(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(N=>{N.write('if (k === "__proto__") continue;'),v&&N.write(`if (${v}.has(k)) continue;`);let T=V(t);N.write(`const ${T} = ${r}[k];`),Ye(N,t,g,T,!1)}),e.write("}")}return null}if(k){e.write(`const ${x} = {};`);for(let v of l){let N=p(v),T=f.get(v);Md(d[v])?e.write(`if (${N} in ${r}) ${x}[${N}] = ${T};`):py(d[v])?e.write(`if (${T} !== undefined || ${N} in ${r}) ${x}[${N}] = ${T};`):e.write(`${x}[${N}] = ${T};`)}}else{let v=l.map(N=>`${h(N)}: ${f.get(N)}`).join(", ");e.write(`const ${x} = { ${v} };`)}if(b!=="none"){let v=a.length>0?H(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(N=>{if(N.write('if (k === "__proto__") continue;'),v&&N.write(`if (${v}.has(k)) continue;`),b==="passthrough")N.write(`${x}[k] = ${r}[k];`);else{let T=V(t);N.write(`const ${T} = ${r}[k];`);let M=Ye(N,t,g,T);N.write(`${x}[k] = ${M};`)}}),e.write("}")}return x}function $x(e,t,n,r,o=!0){let i=n._zod.def;if(zx(n))return $e(e,t,i.innerType,r,o);if(i.innerType._zod.optin==="defaulted"){let a=V(t),u=V(t);return e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(l=>{l.write(`const ${u} = (() => {`),l.indented(p=>{let h=$e(p,t,i.innerType,r);p.write(`return ${h};`)}),l.write("})();"),l.write(`if (${u} !== INVALID) ${a} = ${u};`)}),e.write("} else {"),e.indented(l=>{let p=$e(l,t,i.innerType,r);l.write(`${a} = ${p};`)}),e.write("}"),a}let s=o?V(t):null;return s&&e.write(`let ${s};`),e.write(`if (${r} !== undefined) {`),e.indented(a=>{let u=$e(a,t,i.innerType,r,o);s&&u!==null&&a.write(`${s} = ${u};`)}),e.write("}"),s}function zx(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function Sx(e){return e._zod.optin===void 0&&Jn(e)}function Jn(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?Jn(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?Jn(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Jn):!0;case"intersection":return!t.left||!t.right?!0:Jn(t.left)&&Jn(t.right);case"pipe":return t.in?Jn(t.in):!0;default:return!0}}function Md(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function py(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&Hr(e)}function Hr(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?Hr(t.innerType):!0;case"union":return t.options?t.options.some(Hr):!0;case"intersection":return!t.left||!t.right||Hr(t.left)||Hr(t.right);case"pipe":return t.out?Hr(t.out):!0;default:return!0}}function Nx(e,t,n,r,o=!0){let i=n._zod.def,s=o?V(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${r} !== null) {`),e.indented(a=>{let u=$e(a,t,i.innerType,r,o);s&&u!==null&&a.write(`${s} = ${u};`)}),e.write("}"),s}function Ld(e,t,n){for(let[r,o]of Tr(t._zod.def.checks))e.write(`if (${n} > ${yn(r,o._zod.def.check)}) return INVALID;`)}function Cx(e,t,n,r,o=!0){let i=n._zod.def;e.write(`if (!Array.isArray(${r})) return INVALID;`),Ld(e,n,`${r}.length`);let s=o?V(t):null,a=V(t),u=V(t);return s&&e.write(`const ${s} = new Array(${r}.length);`),e.write(`for (let ${a} = 0; ${a} < ${r}.length; ${a}++) {`),e.indented(l=>{l.write(`const ${u} = ${r}[${a}];`);let p=Ye(l,t,i.element,u,o);s&&p!==null&&l.write(`${s}[${a}] = ${p};`)}),e.write("}"),s}function Px(e,t,n,r){let i=n._zod.def.values;if(i.length!==1){let a=H(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}let s=i[0];if(typeof s=="number"&&Number.isNaN(s)){let a=H(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}if(typeof s=="string")e.write(`if (${r} !== ${et(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${r} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${r} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${r} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${r} !== ${s}n) return INVALID;`);else throw new te(`literal type ${typeof s}`);return r}function Ix(e,t,n,r){let o=n._zod.values;if(!o)throw new te("enum schema without enumerated values");let i=H(t,o);return e.write(`if (!${i}.has(${r})) return INVALID;`),r}function dy(e,t,n,r){let o=n._zod.def;return $e(e,t,o.innerType,r)}function Tx(e,t,n,r){let o=n._zod.def,s=Object.getOwnPropertyDescriptor(n._zod.def,"defaultValue")?()=>n._zod.def.defaultValue:void 0;if(n._zod.def.type==="prefault"){if(!s)return $e(e,t,o.innerType,r);let u=H(t,s),l=V(t);return e.write(`let ${l} = ${r};`),e.write(`if (${r} === undefined) ${l} = ${u}();`),$e(e,t,o.innerType,l)}let a=V(t);if(s){let u=H(t,s),l=H(t,Ro);e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(p=>{p.write(`${a} = ${l}(${u}());`)}),e.write("} else {"),e.indented(p=>{let h=$e(p,t,o.innerType,r);p.write(`${a} = ${h} === undefined ? ${l}(${u}()) : ${h};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${r} !== undefined) {`),e.indented(u=>{let l=$e(u,t,o.innerType,r);u.write(`${a} = ${l};`)}),e.write("}");return a}function Ox(e,t,n,r){let o=n._zod.def,i=$e(e,t,o.innerType,r),s=V(t);return e.write(`const ${s} = ${i};`),e.write(`if (${s} === undefined) return INVALID;`),s}function Rx(e,t,n,r){let o=n._zod.def,i=o.items,s=o.rest;e.write(`if (!Array.isArray(${r})) return INVALID;`);let a=fy(i,"optin"),u=fy(i,"optout");s?e.write(`if (${r}.length < ${a}) return INVALID;`):e.write(`if (${r}.length < ${a} || ${r}.length > ${i.length}) return INVALID;`);let l=V(t);e.write(`const ${l} = [];`);for(let p=0;p<i.length;p++){let h=i[p];if(p>=u)e.write(`if (${l}.length === ${p}) {`),e.indented(d=>{d.write(`if (${p} < ${r}.length) {`),d.indented(f=>{let g=V(t);f.write(`const ${g} = ${r}[${p}];`);let b=Ye(f,t,h,g);f.write(`${l}[${p}] = ${b};`)}),d.write("} else {"),d.indented(f=>{if(Md(h)){f.write(`${l}.length = ${p};`);return}let g=V(t),b=V(t);f.write(`const ${g} = undefined;`),f.write(`const ${b} = (() => {`),f.indented(x=>{let k=Ye(x,t,h,g);x.write(`return ${k};`)}),f.write("})();"),f.write(`if (${b} === INVALID || ${b} === undefined) ${l}.length = ${p};`),f.write(`else ${l}[${p}] = ${b};`)}),d.write("}")}),e.write("}");else{let d=V(t);e.write(`const ${d} = ${r}[${p}];`);let f=Ye(e,t,h,d);e.write(`${l}[${p}] = ${f};`)}}if(s){let p=V(t),h=V(t);e.write(`for (let ${p} = ${i.length}; ${p} < ${r}.length; ${p}++) {`),e.indented(d=>{d.write(`const ${h} = ${r}[${p}];`);let f=Ye(d,t,s,h);d.write(`${l}[${p}] = ${f};`)}),e.write("}")}return l}function fy(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function Ax(e,t,n,r){let o=n._zod.def,i=o.options;if(o.discriminator)return Ex(e,t,o,r);if(o.inclusive===!1)throw new te("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),r;if(i.length===1)return $e(e,t,i[0],r);if(i.every(u=>u._zod.def.type==="literal"&&!u._zod.def.checks?.length)){let u=new Set(i.flatMap(p=>p._zod.def.values)),l=H(t,u);return e.write(`if (!${l}.has(${r})) return INVALID;`),r}let a=V(t);e.write(`let ${a};`);for(let u=0;u<i.length;u++){let l=i[u];u===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(p=>{let h=$e(p,t,l,r);p.write(`return ${h};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function Ex(e,t,n,r){if(n.unionFallback)throw new te("discriminated union with unionFallback");if(n.options.length===0)return e.write("return INVALID;"),r;let o=V(t),i=V(t);e.write(`const ${o} = ${r}?.[${et(n.discriminator)}];`),e.write(`let ${i};`);let s=!0,a=new Set;for(let u of n.options){let l=u._zod.propValues?.[n.discriminator];if(!l||l.size===0)throw new te("discriminated union option without static discriminator values");for(let d of l){if(a.has(d))throw new te(`duplicate discriminator value ${String(d)}`);a.add(d)}let p=Array.from(l,d=>Zx(t,o,d)),h=s?"if":"else if";e.write(`${h} (${p.join(" || ")}) {`),e.indented(d=>{let f=$e(d,t,u,r);d.write(`${i} = ${f};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),i}function Zx(e,t,n){if(typeof n=="string")return`${t} === ${et(n)}`;if(typeof n=="number")return Number.isNaN(n)?`Number.isNaN(${t})`:`${t} === ${n}`;if(typeof n=="boolean")return`${t} === ${n}`;if(n===null)return`${t} === null`;if(n===void 0)return`${t} === undefined`;if(typeof n=="bigint")return`${t} === ${n}n`;if(typeof n=="symbol"){let r=H(e,n);return`${t} === ${r}`}throw new te(`literal discriminator value ${String(n)}`)}function Dx(e,t,n,r){let o=n._zod.def;t.definite=!1;let i=Ye(e,t,o.left,r),s=Ye(e,t,o.right,r),a=H(t,Lr),u=V(t);return e.write(`const ${u} = ${a}(${i}, ${s});`),e.write(`if (!${u}.valid) return INVALID;`),`${u}.data`}function Mx(e,t,n,r){let o=n._zod.def,i=H(t,gt);e.write(`if (!${i}(${r})) return INVALID;`);let s=V(t),a=V(t),u=V(t);e.write(`const ${s} = {};`);let l=o,p=l.partial?void 0:o.keyType._zod.values;if(p){let f=[];for(let b of p){if(!(typeof b=="string"||typeof b=="number"||typeof b=="symbol"))throw new te(`record key value ${String(b)}`);let x=typeof b=="number"?b.toString():b;if(x==="__proto__")throw new te('record key "__proto__"');f.push(x);let k=H(t,b),v=$e(e,t,o.keyType,k),N=V(t);e.write(`const ${N} = ${r}[${jx(t,x)}];`);let T=Ye(e,t,o.valueType,N);e.write(`${s}[${v}] = ${T};`)}let g=H(t,new Set(f));return e.write(`for (const ${a} in ${r}) {`),e.indented(b=>{b.write(`if (${g}.has(${a})) continue;`),l.mode==="loose"?b.write(`if (${a} !== "__proto__") ${s}[${a}] = ${r}[${a}];`):b.write("return INVALID;")}),e.write("}"),s}let h=o.keyType._zod.def;if(!(h.type==="string"&&h.format===void 0&&!h.coerce&&(h.checks?.length??0)===0)){let f=o.mode==="loose",g=Na(o.keyType);g.definite===!1&&(t.definite=!1);let b=H(t,g),x=H(t,Qt),k=V(t);return my(e,t,r,a,v=>{v.write(`let ${k} = ${b}(${a});`),v.write(`if (${k} === INVALID && typeof ${a} === "string" && ${x}.test(${a})) ${k} = ${b}(Number(${a}));`),f?v.write(`if (${k} === INVALID) { ${s}[${a}] = ${r}[${a}]; continue; }`):v.write(`if (${k} === INVALID) return INVALID;`),v.write(`if (${k} === "__proto__") continue;`);let N=V(t);v.write(`const ${N} = ${r}[${a}];`);let T=Ye(v,t,o.valueType,N);v.write(`${s}[${k}] = ${T};`)}),s}return my(e,t,r,a,f=>{f.write(`const ${u} = ${r}[${a}];`);let g=Ye(f,t,o.valueType,u);f.write(`${s}[${a}] = ${g};`)},"return INVALID;"),s}function my(e,t,n,r,o,i){let s=H(t,Object.prototype.propertyIsEnumerable),a=V(t),u=V(t),l=V(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${n});`),e.write(`const ${u} = Object.getOwnPropertyNames(${n});`),e.write(`for (let ${l} = 0; ${l} < ${u}.length; ${l}++) {`),e.indented(p=>{p.write(`const ${r} = ${u}[${l}];`),p.write(`if (${r} === "__proto__" || !${s}.call(${n}, ${r})) continue;`),o(p)}),e.write("}"),e.write(`for (let ${l} = 0; ${l} < ${a}.length; ${l}++) {`),e.indented(p=>{p.write(`const ${r} = ${a}[${l}];`),p.write(`if (!${s}.call(${n}, ${r})) continue;`),i?p.write(i):o(p)}),e.write("}")}function jx(e,t){return typeof t=="string"?et(t):H(e,t)}function Lx(e,t,n,r){let o=n._zod.def;e.write(`if (!(${r} instanceof Map)) return INVALID;`),Ld(e,n,`${r}.size`);let i=V(t),s=V(t),a=V(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${s}, ${a}] of ${r}) {`),e.indented(u=>{let l=$e(u,t,o.keyType,s),p=$e(u,t,o.valueType,a);u.write(`${i}.set(${l}, ${p});`)}),e.write("}"),i}function Ux(e,t,n,r){let o=n._zod.def;e.write(`if (!(${r} instanceof Set)) return INVALID;`),Ld(e,n,`${r}.size`);let i=V(t),s=V(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${s} of ${r}) {`),e.indented(a=>{let u=$e(a,t,o.valueType,s);a.write(`${i}.add(${u});`)}),e.write("}"),i}function Fx(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function Vx(e,t,n,r){e.write(`if (typeof ${r} !== "string") return INVALID;`);let o=n._zod.pattern;if(o){let i=H(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${r})) return INVALID;`)}return r}function qx(e,t,n,r){let o=n._zod.def,i=Wn(t,o.getter),s=H(t,{parser:null});e.write(`if (!${s}.parser) {`),e.indented(u=>{u.write(`const inner = ${i}();`),u.write(`${s}.parser = function(input) {`),u.indented(l=>{l.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),l.write("return result.issues.length === 0 ? result.value : INVALID;")}),u.write("};")}),e.write("}");let a=V(t);return e.write(`const ${a} = ${s}.parser(${r});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function Hx(e,t,n,r){let o=n._zod.def,i=$e(e,t,o.in,r);if(o.transform){if(Kn(o.transform))throw new yt("z.compile: async transforms in pipes are not supported");let s=o.transform,u=Wn(t,p=>{let h={value:p,issues:[],addIssue:jd},d=s(p,h);return d instanceof Promise?Xe:h.issues.length===0?d:Xe}),l=V(t);return e.write(`const ${l} = ${u}(${i});`),e.write(`if (${l} === INVALID) return INVALID;`),$e(e,t,o.out,l)}else return $e(e,t,o.out,i)}function Kn(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function Bx(e,t,n,r){let o=n._zod.def;if(o.fn){if(Kn(o.fn))throw new yt("z.compile: async custom predicates are not supported");let i=Wn(t,o.fn),s=H(t,Dd),a=V(t);e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new te("custom schema without a predicate function");return r}function Jx(e,t,n){let r=e._zod.run({value:n,issues:[]},{});if(r&&typeof r.then=="function")return Xe;let o=r;return o.issues.length===0?o.value:t()}function Wx(e,t,n,r){let o=n._zod.def;if(!o.catchValue[Ns])throw new te("catch with a callback (only a constant catch value compiles)",!1);let i=V(t);e.write(`let ${i} = (() => {`),e.indented(l=>{let p=Ye(l,t,o.innerType,r);l.write(`return ${p};`)}),e.write("})();");let s=H(t,o.innerType),a=Wn(t,o.catchValue),u=H(t,Jx);return e.write(`if (${i} === INVALID) {`),e.indented(l=>{l.write(`${i} = ${u}(${s}, ${a}, ${r});`),l.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}function Kx(e,t,n,r){let o=n._zod.def;if(o.transform){if(Kn(o.transform))throw new yt("z.compile: async transforms are not supported");let i=o.transform,a=Wn(t,l=>{let p={value:l,issues:[],addIssue:jd},h=i(l,p);return h instanceof Promise?Xe:p.issues.length===0?h:Xe}),u=V(t);return e.write(`const ${u} = ${a}(${r});`),e.write(`if (${u} === INVALID) return INVALID;`),u}return r}var Xe,ly,yt,te,tx,dx,yy=re(()=>{gn();Ks();Rd();qn();Ur();Oe();Xe=Symbol.for("zod.compile.invalid"),ly=Symbol.for("zod.compile.fallback"),yt=class extends Error{constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},te=class extends Error{constructor(t,n=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=n}};tx=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);dx=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 Ca(e){return e.checks&&(e.checks=[...e.checks]),e}function Ud(e,t){return new e(Ca({type:"string",...P(t)}))}function Fd(e,t){return new e(Ca({type:"string",coerce:!0,...P(t)}))}function Pa(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...P(t)})}function Ia(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...P(t)})}function Ta(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...P(t)})}function Oa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...P(t)})}function Ra(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...P(t)})}function Aa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...P(t)})}function ai(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...P(t)})}function Ea(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...P(t)})}function Za(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...P(t)})}function Da(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...P(t)})}function Ma(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...P(t)})}function ja(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...P(t)})}function La(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...P(t)})}function Ua(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...P(t)})}function Fa(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...P(t)})}function Va(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...P(t)})}function Vd(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...P(t)})}function qa(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...P(t)})}function Ha(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...P(t)})}function Ba(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...P(t)})}function Ja(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...P(t)})}function Wa(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...P(t)})}function qd(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...P(t)})}function Hd(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...P(t)})}function Ka(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...P(t)})}function ci(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...P(t)})}function ui(e,t){return new e({type:"string",format:"date",check:"string_format",...P(t)})}function li(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...P(t)})}function pi(e,t){return new e({type:"string",format:"duration",check:"string_format",...P(t)})}function Bd(e,t){return new e(Ca({type:"number",checks:[],...P(t)}))}function Jd(e,t){return new e(Ca({type:"number",coerce:!0,checks:[],...P(t)}))}function Wd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...P(t)})}function Kd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...P(t)})}function Gd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...P(t)})}function Qd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...P(t)})}function Yd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...P(t)})}function Xd(e,t){return new e({type:"boolean",...P(t)})}function ef(e,t){return new e({type:"boolean",coerce:!0,...P(t)})}function tf(e,t){return new e({type:"bigint",...P(t)})}function nf(e,t){return new e({type:"bigint",coerce:!0,...P(t)})}function rf(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...P(t)})}function of(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...P(t)})}function sf(e,t){return new e({type:"symbol",...P(t)})}function af(e,t){return new e({type:"undefined",...P(t)})}function cf(e,t){return new e({type:"null",...P(t)})}function uf(e){return new e({type:"any"})}function lf(e){return new e({type:"unknown"})}function pf(e,t){return new e({type:"never",...P(t)})}function df(e,t){return new e({type:"void",...P(t)})}function ff(e,t){return new e({type:"date",...P(t)})}function mf(e,t){return new e({type:"date",coerce:!0,...P(t)})}function hf(e,t){return new e({type:"nan",...P(t)})}function Ct(e,t){return new Bs({check:"less_than",...P(t),value:e,inclusive:!1})}function ut(e,t){return new Bs({check:"less_than",...P(t),value:e,inclusive:!0})}function Pt(e,t){return new Js({check:"greater_than",...P(t),value:e,inclusive:!1})}function lt(e,t){return new Js({check:"greater_than",...P(t),value:e,inclusive:!0})}function di(e){return Pt(0,e)}function fi(e){return Ct(0,e)}function mi(e){return ut(0,e)}function hi(e){return lt(0,e)}function Yt(e,t){return new Ql({check:"multiple_of",...P(t),value:e})}function Xt(e,t){return new ep({check:"max_size",...P(t),maximum:e})}function It(e,t){return new tp({check:"min_size",...P(t),minimum:e})}function bn(e,t){return new np({check:"size_equals",...P(t),size:e})}function vn(e,t){return new rp({check:"max_length",...P(t),maximum:e})}function Zt(e,t){return new op({check:"min_length",...P(t),minimum:e})}function wn(e,t){return new ip({check:"length_equals",...P(t),length:e})}function Gn(e,t){return new sp({check:"string_format",format:"regex",...P(t),pattern:e})}function Qn(e){return new ap({check:"string_format",format:"lowercase",...P(e)})}function Yn(e){return new cp({check:"string_format",format:"uppercase",...P(e)})}function Xn(e,t){return new up({check:"string_format",format:"includes",...P(t),includes:e})}function er(e,t){return new lp({check:"string_format",format:"starts_with",...P(t),prefix:e})}function tr(e,t){return new pp({check:"string_format",format:"ends_with",...P(t),suffix:e})}function gi(e,t,n){return new dp({check:"property",property:e,schema:t,...P(n)})}function nr(e,t){return new fp({check:"properties",shape:e,...P(t)})}function rr(e,t){return new mp({check:"mime_type",mime:e,...P(t)})}function bt(e){return new hp({check:"overwrite",tx:e})}function or(e){return bt(t=>t.normalize(e))}function ir(){return bt(e=>e.trim())}function sr(){return bt(e=>e.toLowerCase())}function ar(){return bt(e=>e.toUpperCase())}function cr(){return bt(e=>Xu(e))}function gf(e,t,n){return new e({type:"array",element:t,...P(n)})}function Gx(e,t,n){return new e({type:"union",options:t,...P(n)})}function Qx(e,t,n){return new e({type:"union",options:t,inclusive:!1,...P(n)})}function Yx(e,t,n,r){return new e({type:"union",options:n,discriminator:t,...P(r)})}function Xx(e,t,n){return new e({type:"intersection",left:t,right:n})}function ek(e,t,n,r){let o=n instanceof B,i=o?r:n,s=o?n:null;return new e({type:"tuple",items:t,rest:s,...P(i)})}function tk(e,t,n,r){return new e({type:"record",keyType:t,valueType:n,...P(r)})}function nk(e,t,n,r){return new e({type:"map",keyType:t,valueType:n,...P(r)})}function rk(e,t,n){return new e({type:"set",valueType:t,...P(n)})}function ok(e,t,n){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:r,...P(n)})}function ik(e,t,n){return new e({type:"enum",entries:t,...P(n)})}function sk(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...P(n)})}function _f(e,t){return new e({type:"file",...P(t)})}function ak(e,t){return new e({type:"transform",transform:t})}function ck(e,t){return new e({type:"optional",innerType:t})}function uk(e,t){return new e({type:"nullable",innerType:t})}function lk(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():Ro(n)}})}function pk(e,t,n){return new e({type:"nonoptional",innerType:t,...P(n)})}function dk(e,t){return new e({type:"success",innerType:t})}function fk(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:sl(n)})}function mk(e,t,n){return new e({type:"pipe",in:t,out:n})}function hk(e,t){return new e({type:"readonly",innerType:t})}function gk(e,t,n){return new e({type:"template_literal",parts:t,...P(n)})}function _k(e,t){return new e({type:"lazy",getter:t})}function yk(e,t){return new e({type:"promise",innerType:t})}function yf(e,t,n){let r=P(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function bf(e,t,n){return new e({type:"custom",check:"custom",fn:t,...P(n)})}function vf(e,t){let n=by(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Or(o,r.value,n._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Or(i))}},e(r.value,r)),t);return n}function by(e,t){let n=new _e({check:"custom",...P(t)});return n._zod.check=e,n}function wf(e){let t=new _e({check:"describe"});return t._zod.onattach=[n=>{let r=Ve.get(n)??{};Ve.add(n,{...r,description:e})}],t._zod.check=()=>{},t}function xf(e){let t=new _e({check:"meta"});return t._zod.onattach=[n=>{let r=Ve.get(n)??{};Ve.add(n,{...r,...e})}],t._zod.check=()=>{},t}function kf(e,t){let n=P(t),r=n.truthy??["true","1","yes","on","y","enabled"],o=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(r=r.map(f=>typeof f=="string"?f.toLowerCase():f),o=o.map(f=>typeof f=="string"?f.toLowerCase():f));let i=new Set(r),s=new Set(o),a=e.Codec??ei,u=e.Boolean??Yo,l=e.String??Bn,p=new l({type:"string",error:n.error}),h=new u({type:"boolean",error:n.error}),d=new a({type:"pipe",in:p,out:h,transform:((f,g)=>{let b=f;return n.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:((f,g)=>f===!0?r[0]||"true":o[0]||"false"),error:n.error});return d._zod.bag.truthy=r,d._zod.bag.falsy=o,d._zod.bag.case=n.case??"insensitive",d}function ur(e,t,n,r={}){let o=P(r),i={check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...o};return n instanceof RegExp&&(i.pattern=n),new e(i)}var Ga,vy=re(()=>{Ws();ii();Ur();Oe();Ga={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function _i(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&Je(e,r,n[r]);return e}function xn(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??Ve,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 De(e,t,n,r,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(n,i),!0}function pe(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:n.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 p={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,p);else{let d=s.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,d,p)}let h=e._zod.parent;h&&(s.ref||(s.ref=h),pe(h,t,p),t.seen.get(h).isParent=!0)}let u=t.metadataRegistry.get(e);return u&&_i(s.schema,u),t.io==="input"&&nt(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function wy(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function kn(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let u=r.get(a);if(u&&u!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}let o=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let h=e.external.registry.get(s[0])?.id,d=e.external.uri??(g=>g);if(h)return{ref:d(h)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${d("__shared")}#/${a}/${wy(f)}`}}let u="#",l=`${u}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:u};let p=s[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:l+wy(p)}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:u,defId:l}=o(s);a.def={...a.schema},l&&(a.defId=l);let p=a.schema;for(let h in p)delete p[h];p.$ref=u};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>
74
+
75
+ 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 l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){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 $y(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!="object")return;$y(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;n.includes(s)||n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}function ky(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function $f(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!zy.has(s))return null;t.push(i)}let n={},r=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let l of t){let p=l.properties?.[s]??ky(l);p!=null&&(a.some(h=>JSON.stringify(h)===JSON.stringify(p))||a.push(p))}let u=a.length===1?a[0]:$f(a)??{allOf:a};Je(n,s,u)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:n};if(r.size&&(o.required=[...r]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=ky(s);a&&!i.some(u=>JSON.stringify(u)===JSON.stringify(a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function bk(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of zy)if(o in e)return;let n=t.filter(o=>xy.some(i=>Array.isArray(o[i]))),r=null;if(!n.length)r=$f(t);else{let o=n[0],i=xy.find(u=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let s=t.filter(u=>u!==o),a=o[i].map(u=>$f([...s,u]));if(a.some(u=>!u))return;r={[i]:a}}r&&(delete e.allOf,_i(e,r))}function $n(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=a=>{let u=e.seen.get(a);if(u.ref===null)return;let l=u.def??u.schema,p={...l},h=u.ref;if(u.ref=null,h){r(h);let f=e.seen.get(h),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(g)):_i(l,g),_i(l,p),a._zod.parent===h)for(let x in l)x==="$ref"||x==="allOf"||x in p||delete l[x];if(g.$ref&&f.def)for(let x in l)x==="$ref"||x==="allOf"||x in f.def&&JSON.stringify(l[x])===JSON.stringify(f.def[x])&&delete l[x]}let d=a._zod.parent;if(d&&d!==h){r(d);let f=e.seen.get(d);if(f?.schema.$ref&&(l.$ref=f.schema.$ref,f.def))for(let g in l)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(l[g])===JSON.stringify(f.def[g])&&delete l[g]}e.override({zodSchema:a,jsonSchema:l,path:u.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())$y(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let u of e.seen.values())for(let l of[u.schema,u.def]){let p=l?.allOf;if(!Array.isArray(p))continue;let h=a.get(p);h?h.push(l):a.set(p,[l])}for(let u of e.intersections)for(let l of a.get(u)??[])bk(l)}}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)}_i(o,n.defId?n.schema:n.def??n.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 u=a[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,Je(s,u.defId,u.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:Br(t,"input",e.processors),output:Br(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function nt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return nt(r.element,n);if(r.type==="set")return nt(r.valueType,n);if(r.type==="lazy")return nt(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return nt(r.innerType,n);if(r.type==="intersection")return nt(r.left,n)||nt(r.right,n);if(r.type==="record"||r.type==="map")return nt(r.keyType,n)||nt(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:nt(r.in,n)||nt(r.out,n);if(r.type==="object"){for(let o in r.shape)if(nt(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(nt(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(nt(o,n))return!0;return!!(r.rest&&nt(r.rest,n))}return!1}var zy,xy,zf,Br,yi=re(()=>{ii();Oe();zy=new Set(["type","properties","required","additionalProperties"]),xy=["oneOf","anyOf"];zf=(e,t={})=>n=>{let r=xn({...n,processors:t});return pe(e,r),kn(r,e),$n(r,e)},Br=(e,t,n={})=>r=>{let{libraryOptions:o,target:i}=r??{},s=xn({...o??{},target:i,io:t,processors:n});return pe(e,s),kn(s,e),$n(s,e)}});function Me(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)vk[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Jr(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Jr(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Wr(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Wr(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Iy(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&Oy(t,o.mime);for(let i of o.patterns??[])Ty(t,i);return t}function bi(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?bi(t.out):t.type==="catch"?bi(t.innerType):e._zod.optin}function Sf(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let g=e.get(t)?.def;if(!g)return t;let b=Sf(e,g,n);return b===g?t:b}for(let g of["anyOf","oneOf"]){let b=t[g];if(!Array.isArray(b))continue;let x=b.map(k=>Sf(e,k,n));x.some((k,v)=>k!==b[v])&&(t={...t,[g]:x})}let r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.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:u,exclusiveMaximum:l,multipleOf:p,format:h,id:d,...f}=t;return f.enum?f.enum=f.enum.map(g=>typeof g=="number"?String(g):g):typeof f.const=="number"&&(f.const=String(f.const)),o&&(f.type="string",i||(f.pattern=(r.includes("number")?Qt:qo).source)),f}function kk(e){let t=new Map;for(let r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);let n=new Map;for(let r of Nf.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Sf(t,i,new Set);s!==i&&n.set(i,s)}if(n.size)for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&n.get(o.propertyNames);i&&(o.propertyNames=i)}}function Ey(e,t,n,r,o){let i=!1,s=JSON.stringify(e,(a,u)=>typeof u!="bigint"?u:(i=!0,null));return i?(De(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),om):JSON.parse(s)}function vi(e,t){if("_idmap"in e){let r=e,o=xn({...t,processors:Qa}),i={};for(let u of r._idmap.entries()){let[l,p]=u;pe(p,o)}let s={},a={registry:r,uri:t?.uri,defs:i};o.external=a;for(let u of r._idmap.entries()){let[l,p]=u;kn(o,p),Je(s,l,$n(o,p))}if(Object.keys(i).length>0){let u=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[u]:i}}return{schemas:s}}let n=xn({...t,processors:Qa});return pe(e,n),kn(n,e),$n(n,e)}var Jr,Wr,Sy,Iy,Ty,Oy,Ry,Ny,Cy,Py,vk,wk,xk,Ay,Cf,Pf,If,Tf,Of,Rf,Af,Ef,Zf,Df,Mf,jf,Lf,Uf,Ff,Vf,qf,Hf,Bf,Jf,Wf,Kf,Gf,Qf,Yf,Ya,Xf,em,Nf,tm,nm,rm,om,im,sm,am,cm,um,lm,Xa,pm,Qa,wi=re(()=>{qn();Ur();yi();Oe();Jr=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Wr=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Sy=(e,t)=>{Jr(e,"minimum",t),Wr(e,"maximum",t)},Iy=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Ty=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Oy=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},Ry=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Ny=(e,t)=>Jr(e,"minimum",t.minimum),Cy=(e,t)=>Wr(e,"maximum",t.maximum),Py=e=>(t,n)=>{Ry(t,n.format);let[r,o]=e[n.format];Jr(t,"minimum",r),Wr(t,"maximum",o)},vk={greater_than:(e,t)=>Jr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Wr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Iy(e,t.value),number_format:Py(Eo),bigint_format:Py(Zo),min_length:Ny,max_length:Cy,length_equals:(e,t)=>Sy(e,t.length),min_size:Ny,max_size:Cy,size_equals:(e,t)=>Sy(e,t.size),string_format:(e,t)=>{Ry(e,t.format),t.pattern&&Ty(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)=>Oy(e,t.mime)};wk={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},xk=new Map([[ia,Tl],[Qo,Ol]]),Ay=e=>xk.get(e)??e,Cf=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:s,format:a,patterns:u,contentEncoding:l,laxFormat:p}=Me(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=wk[a]??a,o.format===""&&delete o.format,(a==="time"||p)&&delete o.format),l&&(o.contentEncoding=l),u&&u.size>0){let h=[...u].map(Ay);h.length===1?o.pattern=h[0].source:h.length>1&&(o.allOf=[...h.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Pf=(e,t,n,r)=>{let o=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:u,exclusiveMinimum:l,isInt:p}=Me(e);o.type=p?"integer":"number";let h=typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY),d=typeof u=="number"&&u<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(h?f?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof i=="number"&&(o.minimum=i),d?f?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof s=="number"&&(o.maximum=s),a){let g=new Set;for(let k of a)Number.isFinite(k)&&k!==0?g.add(Math.abs(k)):De(e,t,o,r,`A multipleOf divisor of ${k} cannot be represented in JSON Schema`);let[b,...x]=g;b!==void 0&&(o.multipleOf=b),x.length&&(o.allOf=[...o.allOf??[],...x.map(k=>({multipleOf:k}))])}},If=(e,t,n,r)=>{n.type="boolean"},Tf=(e,t,n,r)=>{De(e,t,n,r,"BigInt cannot be represented in JSON Schema")},Of=(e,t,n,r)=>{De(e,t,n,r,"Symbols cannot be represented in JSON Schema")},Rf=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Af=(e,t,n,r)=>{De(e,t,n,r,"Undefined cannot be represented in JSON Schema")},Ef=(e,t,n,r)=>{De(e,t,n,r,"Void cannot be represented in JSON Schema")},Zf=(e,t,n,r)=>{n.not={}},Df=(e,t,n,r)=>{},Mf=(e,t,n,r)=>{},jf=(e,t,n,r)=>{De(e,t,n,r,"Date cannot be represented in JSON Schema")},Lf=(e,t,n,r)=>{let o=e._zod.def,i=Nr(o.entries);if(i.length===0){n.not={};return}i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},Uf=(e,t,n,r)=>{let o=e._zod.def;if(o.values.length===0){n.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(De(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(De(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},Ff=(e,t,n,r)=>{De(e,t,n,r,"NaN cannot be represented in JSON Schema")},Vf=(e,t,n,r)=>{let o=n,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},qf=(e,t,n,r)=>{let o=n;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=Me(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(u=>({contentMediaType:u})))},Hf=(e,t,n,r)=>{n.type="boolean"},Bf=(e,t,n,r)=>{De(e,t,n,r,"Custom types cannot be represented in JSON Schema")},Jf=(e,t,n,r)=>{De(e,t,n,r,"Function types cannot be represented in JSON Schema")},Wf=(e,t,n,r)=>{De(e,t,n,r,"Transforms cannot be represented in JSON Schema")},Kf=(e,t,n,r)=>{De(e,t,n,r,"Map cannot be represented in JSON Schema")},Gf=(e,t,n,r)=>{De(e,t,n,r,"Set cannot be represented in JSON Schema")},Qf=(e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:s,maximum:a}=Me(e);typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=pe(i.element,t,{...r,path:[...r.path,"items"]})};Yf=(e,t,n,r)=>{let o=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&De(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)Je(o.properties,l,pe(s[l],t,{...r,path:[...r.path,"properties",l]}));let u=[];for(let l of Object.keys(s)){let p=i.shape[l];(t.io==="input"?bi(p)===void 0:p._zod.optout===void 0)&&u.push(l)}u.length>0&&(o.required=u),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=pe(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Ya=(e,t,n,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,u)=>pe(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",u]}));i?n.oneOf=s:n.anyOf=s},Xf=(e,t,n,r)=>{let o=e._zod.def,i=pe(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=pe(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,u=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=u,t.intersections.push(u)},em=(e,t,n,r)=>{let o=n,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",u=i.items.map((b,x)=>pe(b,t,{...r,path:[...r.path,s,x]})),l=i.rest?pe(i.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,p=i.items.length;for(;p>0;){let b=i.items[p-1];if(!(t.io==="input"?bi(b)!==void 0:b._zod.optout==="optional"))break;p--}let h=i.items.length,d=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=u,d?o.items=!1:l&&(o.items=l),p>0&&(o.minItems=p),d&&(o.maxItems=h)):t.target==="openapi-3.0"?(o.items={anyOf:u},l&&o.items.anyOf.push(l),p>0&&(o.minItems=p),d&&(o.maxItems=h)):(o.items=u,d?o.additionalItems=!1:l&&(o.additionalItems=l),p>0&&(o.minItems=p),d&&(o.maxItems=h));let{minimum:f,maximum:g}=Me(e);typeof f=="number"&&(o.minItems=f),typeof g=="number"&&(o.maxItems=g)};Nf=new WeakMap;tm=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="object";let s=i.keyType,a=Me(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let p=pe(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let h of a)Je(o.patternProperties,Ay(h).source,p)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=pe(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let p=Nf.get(t);p||(p=[],Nf.set(t,p),t.deferred.push(()=>kk(t))),p.push(e)}o.additionalProperties=pe(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let u=s._zod.values,l=t.io==="input"&&bi(i.valueType)!==void 0;if(u&&!i.partial&&!l){let p=[...u].filter(h=>typeof h=="string"||typeof h=="number");p.length>0&&(o.required=p.map(String))}},nm=(e,t,n,r)=>{let o=e._zod.def,i=pe(o.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},rm=(e,t,n,r)=>{let o=e._zod.def;pe(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},om=Symbol();im=(e,t,n,r)=>{let o=e._zod.def;pe(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s=Ey(o.defaultValue,e,t,n,r);s!==om&&(n.default=s)},sm=(e,t,n,r)=>{let o=e._zod.def;pe(o.innerType,t,r);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Ey(o.defaultValue,e,t,n,r);s!==om&&(n._prefault=s)},am=(e,t,n,r)=>{let o=e._zod.def;pe(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{De(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},cm=(e,t,n,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;pe(s,t,r);let a=t.seen.get(e);a.ref=s},um=(e,t,n,r)=>{let o=e._zod.def;pe(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},lm=(e,t,n,r)=>{let o=e._zod.def;pe(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},Xa=(e,t,n,r)=>{let o=e._zod.def;pe(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},pm=(e,t,n,r)=>{let o=e._zod.innerType;pe(o,t,r);let i=t.seen.get(e);i.ref=o},Qa={string:Cf,number:Pf,boolean:If,bigint:Tf,symbol:Of,null:Rf,undefined:Af,void:Ef,never:Zf,any:Df,unknown:Mf,date:jf,enum:Lf,literal:Uf,nan:Ff,template_literal:Vf,file:qf,success:Hf,custom:Bf,function:Jf,transform:Wf,map:Kf,set:Gf,array:Qf,object:Yf,union:Ya,intersection:Xf,tuple:em,record:tm,nullable:nm,nonoptional:rm,default:im,prefault:sm,catch:am,pipe:cm,readonly:um,promise:lm,optional:Xa,lazy:pm}});var ec,Zy=re(()=>{wi();yi();ec=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 n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=xn({processors:Qa,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return pe(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,kn(this.ctx,t);let r=$n(this.ctx,t),{"~standard":o,...i}=r;return i}}});var Dy={};var My=re(()=>{});var Dt={};At(Dt,{$ZodAny:()=>Xp,$ZodArray:()=>id,$ZodAsyncError:()=>at,$ZodBase64:()=>Up,$ZodBase64URL:()=>Fp,$ZodBigInt:()=>pa,$ZodBigIntFormat:()=>Kp,$ZodBoolean:()=>Yo,$ZodCIDRv4:()=>jp,$ZodCIDRv6:()=>Lp,$ZodCUID:()=>Np,$ZodCUID2:()=>Cp,$ZodCatch:()=>kd,$ZodCheck:()=>_e,$ZodCheckBigIntFormat:()=>Xl,$ZodCheckEndsWith:()=>pp,$ZodCheckGreaterThan:()=>Js,$ZodCheckIncludes:()=>up,$ZodCheckLengthEquals:()=>ip,$ZodCheckLessThan:()=>Bs,$ZodCheckLowerCase:()=>ap,$ZodCheckMaxLength:()=>rp,$ZodCheckMaxSize:()=>ep,$ZodCheckMimeType:()=>mp,$ZodCheckMinLength:()=>op,$ZodCheckMinSize:()=>tp,$ZodCheckMultipleOf:()=>Ql,$ZodCheckNumberFormat:()=>Yl,$ZodCheckOverwrite:()=>hp,$ZodCheckProperties:()=>fp,$ZodCheckProperty:()=>dp,$ZodCheckRegex:()=>sp,$ZodCheckSizeEquals:()=>np,$ZodCheckStartsWith:()=>lp,$ZodCheckStringFormat:()=>jr,$ZodCheckUpperCase:()=>cp,$ZodCodec:()=>ei,$ZodCreditCard:()=>qp,$ZodCustom:()=>Id,$ZodCustomStringFormat:()=>Jp,$ZodCyclicError:()=>ba,$ZodDate:()=>rd,$ZodDefault:()=>bd,$ZodDiscriminatedUnion:()=>cd,$ZodE164:()=>Vp,$ZodEmail:()=>wp,$ZodEmoji:()=>zp,$ZodEncodeError:()=>_n,$ZodEnum:()=>fd,$ZodError:()=>ll,$ZodExactOptional:()=>_d,$ZodFile:()=>hd,$ZodFunction:()=>Cd,$ZodGUID:()=>bp,$ZodIBAN:()=>Hp,$ZodIPv4:()=>Zp,$ZodIPv6:()=>Dp,$ZodISODate:()=>Rp,$ZodISODateTime:()=>Op,$ZodISODuration:()=>Ep,$ZodISOTime:()=>Ap,$ZodIntersection:()=>ud,$ZodJWT:()=>Bp,$ZodKSUID:()=>Tp,$ZodLazy:()=>ti,$ZodLiteral:()=>md,$ZodMAC:()=>Mp,$ZodMap:()=>pd,$ZodNaN:()=>$d,$ZodNanoID:()=>Sp,$ZodNever:()=>td,$ZodNonOptional:()=>wd,$ZodNull:()=>Yp,$ZodNullable:()=>yd,$ZodNumber:()=>la,$ZodNumberFormat:()=>Wp,$ZodObject:()=>ry,$ZodObjectJIT:()=>sd,$ZodOptional:()=>ma,$ZodPipe:()=>ha,$ZodPrefault:()=>vd,$ZodPreprocess:()=>zd,$ZodPromise:()=>Pd,$ZodReadonly:()=>Sd,$ZodRealError:()=>ct,$ZodRecord:()=>ld,$ZodRegistry:()=>ka,$ZodSet:()=>dd,$ZodString:()=>Bn,$ZodStringFormat:()=>le,$ZodSuccess:()=>xd,$ZodSymbol:()=>Gp,$ZodTemplateLiteral:()=>Nd,$ZodTransform:()=>gd,$ZodTuple:()=>fa,$ZodType:()=>B,$ZodULID:()=>Pp,$ZodURL:()=>$p,$ZodUUID:()=>vp,$ZodUndefined:()=>Qp,$ZodUnion:()=>Xo,$ZodUnknown:()=>ed,$ZodVoid:()=>nd,$ZodXID:()=>Ip,$ZodXor:()=>ad,$brand:()=>Ps,$constructor:()=>y,$input:()=>za,$output:()=>$a,Doc:()=>Hn,INVALID:()=>Xe,JSONSchema:()=>Dy,JSONSchemaGenerator:()=>ec,NEVER:()=>Cs,TimePrecision:()=>Ga,URL_BAD_FORMAT:()=>xp,URL_UNPARSEABLE:()=>Jo,ZodCompileAsyncError:()=>yt,ZodCompileUnsupportedError:()=>te,_any:()=>uf,_array:()=>gf,_base64:()=>Ba,_base64url:()=>Ja,_bigint:()=>tf,_boolean:()=>Xd,_catch:()=>fk,_check:()=>by,_cidrv4:()=>qa,_cidrv6:()=>Ha,_coercedBigint:()=>nf,_coercedBoolean:()=>ef,_coercedDate:()=>mf,_coercedNumber:()=>Jd,_coercedString:()=>Fd,_creditCard:()=>qd,_cuid:()=>Da,_cuid2:()=>Ma,_custom:()=>yf,_date:()=>ff,_decode:()=>Es,_decodeAsync:()=>Ds,_default:()=>lk,_discriminatedUnion:()=>Yx,_e164:()=>Wa,_email:()=>Pa,_emoji:()=>Ea,_encode:()=>As,_encodeAsync:()=>Zs,_endsWith:()=>tr,_enum:()=>ok,_file:()=>_f,_float32:()=>Kd,_float64:()=>Gd,_gt:()=>Pt,_gte:()=>lt,_guid:()=>Ia,_iban:()=>Hd,_includes:()=>Xn,_int:()=>Wd,_int32:()=>Qd,_int64:()=>rf,_intersection:()=>Xx,_ipv4:()=>Fa,_ipv6:()=>Va,_isoDate:()=>ui,_isoDateTime:()=>ci,_isoDuration:()=>pi,_isoTime:()=>li,_jwt:()=>Ka,_ksuid:()=>Ua,_lazy:()=>_k,_length:()=>wn,_literal:()=>sk,_lowercase:()=>Qn,_lt:()=>Ct,_lte:()=>ut,_mac:()=>Vd,_map:()=>nk,_max:()=>ut,_maxLength:()=>vn,_maxSize:()=>Xt,_mime:()=>rr,_min:()=>lt,_minLength:()=>Zt,_minSize:()=>It,_multipleOf:()=>Yt,_nan:()=>hf,_nanoid:()=>Za,_nativeEnum:()=>ik,_negative:()=>fi,_never:()=>pf,_nonnegative:()=>hi,_nonoptional:()=>pk,_nonpositive:()=>mi,_normalize:()=>or,_null:()=>cf,_nullable:()=>uk,_number:()=>Bd,_optional:()=>ck,_overwrite:()=>bt,_parse:()=>Er,_parseAsync:()=>Zr,_pipe:()=>mk,_positive:()=>di,_promise:()=>yk,_properties:()=>nr,_property:()=>gi,_readonly:()=>hk,_record:()=>tk,_refine:()=>bf,_regex:()=>Gn,_safeDecode:()=>js,_safeDecodeAsync:()=>Us,_safeEncode:()=>Ms,_safeEncodeAsync:()=>Ls,_safeParse:()=>Dr,_safeParseAsync:()=>Mr,_set:()=>rk,_size:()=>bn,_slugify:()=>cr,_startsWith:()=>er,_string:()=>Ud,_stringFormat:()=>ur,_stringbool:()=>kf,_success:()=>dk,_superRefine:()=>vf,_symbol:()=>sf,_templateLiteral:()=>gk,_toLowerCase:()=>sr,_toUpperCase:()=>ar,_transform:()=>ak,_trim:()=>ir,_tuple:()=>ek,_uint32:()=>Yd,_uint64:()=>of,_ulid:()=>ja,_undefined:()=>af,_union:()=>Gx,_unknown:()=>lf,_uppercase:()=>Yn,_url:()=>ai,_uuid:()=>Ta,_uuidv4:()=>Oa,_uuidv6:()=>Ra,_uuidv7:()=>Aa,_void:()=>df,_xid:()=>La,_xor:()=>Qx,base64Charset:()=>ia,base64urlCharset:()=>Qo,canParseURL:()=>kp,clone:()=>ce,compile:()=>Sa,compileFn:()=>Na,config:()=>ze,createStandardJSONSchemaMethod:()=>Br,createToJSONSchemaMethod:()=>zf,decode:()=>C_,decodeAsync:()=>I_,describe:()=>wf,encode:()=>N_,encodeAsync:()=>P_,extractDefs:()=>kn,finalize:()=>$n,flattenError:()=>Rr,formatError:()=>Ar,getDiscriminatedOption:()=>da,globalConfig:()=>Fe,globalRegistry:()=>Ve,handleUnrepresentable:()=>De,initializeContext:()=>xn,isBackEdge:()=>wa,isRecursiveSchema:()=>va,isValidBase64:()=>Go,isValidBase64URL:()=>sa,isValidCIDRv6:()=>oa,isValidCreditCard:()=>aa,isValidIBAN:()=>ca,isValidIPv6:()=>Ko,isValidJWT:()=>ua,locales:()=>qr,memoizer:()=>Vr,mergeValues:()=>Lr,meta:()=>xf,parse:()=>Uo,parseAsync:()=>Fo,parseURLObject:()=>ey,prettifyError:()=>Ts,process:()=>pe,processSchema:()=>pe,regexes:()=>ft,registry:()=>oi,safeDecode:()=>O_,safeDecodeAsync:()=>A_,safeEncode:()=>T_,safeEncodeAsync:()=>R_,safeParse:()=>Rs,safeParseAsync:()=>dl,standardProps:()=>ea,stripTabAndNewline:()=>Wo,toDotPath:()=>z_,toJSONSchema:()=>vi,toZod:()=>Sr,treeifyError:()=>Is,urlHostnameOk:()=>na,urlProtocolOk:()=>ra,util:()=>Z,validate:()=>Un,validateAsync:()=>Fn,validateURL:()=>ta,version:()=>gp,withParser:()=>si});var pt=re(()=>{gn();fl();pl();Ur();Rd();Ws();_p();Oe();Oe();qn();Ed();ii();Ks();yy();vy();yi();wi();Zy();My()});function xi(e,t){let n=typeof t=="function"?t:(s,a)=>{let u=t[s._zod.def.type];return u?u(s,a):s},r=new Map;function o(s){let a=r.get(s);if(a===jy)return new ti({type:"lazy",getter:()=>r.get(s)});if(a!==void 0)return a;r.set(s,jy);let u=i(s),l=n(u,u!==s);return r.set(s,l),l}function i(s){let a=s._zod.def,u=a.type;switch(u){case"object":{let l=a.shape,p=Object.keys(l),h=!1,d={};for(let g of p){let b=o(l[g]);b!==l[g]&&(h=!0),d[g]=b}let f=a.catchall;return a.catchall&&(f=o(a.catchall),f!==a.catchall&&(h=!0)),h?ce(s,{...a,shape:d,catchall:f}):s}case"array":{let l=o(a.element);return l===a.element?s:ce(s,{...a,element:l})}case"tuple":{let l=a.items,p=!1,h=[];for(let f of l){let g=o(f);g!==f&&(p=!0),h.push(g)}let d=a.rest;return a.rest&&(d=o(a.rest),d!==a.rest&&(p=!0)),p?ce(s,{...a,items:h,rest:d}):s}case"record":case"map":{let l=o(a.keyType),p=o(a.valueType);return l===a.keyType&&p===a.valueType?s:ce(s,{...a,keyType:l,valueType:p})}case"set":{let l=o(a.valueType);return l===a.valueType?s:ce(s,{...a,valueType:l})}case"union":{let l=a.options,p=!1,h=[];for(let d of l){let f=o(d);f!==d&&(p=!0),h.push(f)}return p?ce(s,{...a,options:h}):s}case"intersection":{let l=o(a.left),p=o(a.right);return l===a.left&&p===a.right?s:ce(s,{...a,left:l,right:p})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let l=o(a.innerType);return l===a.innerType?s:ce(s,{...a,innerType:l})}case"pipe":{let l=o(a.in),p=o(a.out);return l===a.in&&p===a.out?s:ce(s,{...a,in:l,out:p})}case"function":{let l=o(a.input),p=o(a.output);return l===a.input&&p===a.output?s:ce(s,{...a,input:l,output:p})}case"lazy":{let l=a.getter,{_cachedInner:p,...h}=a;return ce(s,{...h,getter:()=>o(l())})}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 jy,dm=re(()=>{Ur();Oe();jy=Symbol("z.visit/resolving")});var rc={};At(rc,{endsWith:()=>tr,gt:()=>Pt,gte:()=>lt,includes:()=>Xn,length:()=>wn,lowercase:()=>Qn,lt:()=>Ct,lte:()=>ut,maxLength:()=>vn,maxSize:()=>Xt,mime:()=>rr,minLength:()=>Zt,minSize:()=>It,multipleOf:()=>Yt,negative:()=>fi,nonnegative:()=>hi,nonpositive:()=>mi,normalize:()=>or,overwrite:()=>bt,positive:()=>di,properties:()=>nr,property:()=>gi,regex:()=>Gn,size:()=>bn,slugify:()=>cr,startsWith:()=>er,toLowerCase:()=>sr,toUpperCase:()=>ar,trim:()=>ir,uppercase:()=>Yn});var oc=re(()=>{pt()});function ic(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var Fy,Vy,qy,rt,fm=re(()=>{pt();pt();Oe();Fy=new WeakSet([Object.prototype,Error.prototype]);Vy=(e,t)=>{ll.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);Fy.has(n)||(Fy.add(n),ic(n,"format",r=>o=>Ar(r,o)),ic(n,"flatten",r=>o=>Rr(r,o)),ic(n,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,Cr,2)}),ic(n,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,Cr,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},qy=y("ZodError",Vy),rt=y("ZodError",Vy,void 0,{Parent:Error})});var sc,ac,cc,uc,lc,pc,dc,fc,mc,hc,gc,_c,mm=re(()=>{pt();fm();pt();sc=Er(rt),ac=Zr(rt),cc=Dr(rt),uc=Mr(rt),lc=As(rt),pc=Es(rt),dc=Zs(rt),fc=Ds(rt),mc=Ms(rt),hc=js(rt),gc=Ls(rt),_c=Us(rt)});var ao={};At(ao,{ZodAny:()=>$c,ZodArray:()=>Cc,ZodBase64:()=>ji,ZodBase64URL:()=>Li,ZodBigInt:()=>gr,ZodBigIntFormat:()=>Vi,ZodBoolean:()=>hr,ZodCIDRv4:()=>Di,ZodCIDRv6:()=>Mi,ZodCUID:()=>Ii,ZodCUID2:()=>Ti,ZodCatch:()=>Jc,ZodCodec:()=>oo,ZodCreditCard:()=>bc,ZodCustom:()=>io,ZodCustomStringFormat:()=>zn,ZodDate:()=>Yr,ZodDefault:()=>Uc,ZodDiscriminatedUnion:()=>Ic,ZodE164:()=>Ui,ZodEmail:()=>Si,ZodEmoji:()=>Ci,ZodEnum:()=>pr,ZodExactOptional:()=>Bi,ZodFile:()=>Dc,ZodFunction:()=>ru,ZodGUID:()=>Ni,ZodIBAN:()=>vc,ZodIPv4:()=>Ei,ZodIPv6:()=>Zi,ZodISODate:()=>tn,ZodISODateTime:()=>en,ZodISODuration:()=>rn,ZodISOTime:()=>nn,ZodInstanceOf:()=>su,ZodIntersection:()=>Tc,ZodJWT:()=>Fi,ZodKSUID:()=>Ai,ZodLazy:()=>eu,ZodLiteral:()=>Zc,ZodMAC:()=>yc,ZodMap:()=>Ac,ZodNaN:()=>Kc,ZodNanoID:()=>Pi,ZodNever:()=>Sc,ZodNonOptional:()=>Ji,ZodNull:()=>kc,ZodNullable:()=>Lc,ZodNumber:()=>mr,ZodNumberFormat:()=>Sn,ZodObject:()=>Xr,ZodOptional:()=>no,ZodPipe:()=>ro,ZodPrefault:()=>Vc,ZodPreprocess:()=>Gc,ZodPromise:()=>nu,ZodReadonly:()=>Qc,ZodRecord:()=>lr,ZodSet:()=>Ec,ZodString:()=>fr,ZodStringFormat:()=>fe,ZodSuccess:()=>Bc,ZodSymbol:()=>wc,ZodTemplateLiteral:()=>Xc,ZodTransform:()=>Mc,ZodTuple:()=>Oc,ZodType:()=>K,ZodULID:()=>Oi,ZodURL:()=>Gr,ZodUUID:()=>Tt,ZodUndefined:()=>xc,ZodUnion:()=>eo,ZodUnknown:()=>zc,ZodVoid:()=>Nc,ZodXID:()=>Ri,ZodXor:()=>Pc,_ZodString:()=>zi,_default:()=>Fc,_function:()=>vh,any:()=>th,array:()=>Y,base64:()=>Em,base64url:()=>Zm,bigint:()=>Gm,boolean:()=>Ce,catch:()=>Wc,check:()=>wh,cidrv4:()=>Rm,cidrv6:()=>Am,codec:()=>gh,creditCard:()=>Mm,cuid:()=>zm,cuid2:()=>Sm,currencyCode:()=>qm,custom:()=>Wi,date:()=>rh,describe:()=>xh,discriminatedUnion:()=>to,e164:()=>Dm,email:()=>hm,emoji:()=>km,enum:()=>He,exactOptional:()=>jc,file:()=>dh,float32:()=>Bm,float64:()=>Jm,function:()=>vh,guid:()=>gm,hash:()=>Hm,hex:()=>Vm,hostname:()=>Fm,httpUrl:()=>xm,iban:()=>jm,instanceof:()=>$h,int:()=>ki,int32:()=>Wm,int64:()=>Qm,intersection:()=>_r,invertCodec:()=>_h,ipv4:()=>Im,ipv6:()=>Om,json:()=>Sh,jwt:()=>Lm,keyof:()=>oh,ksuid:()=>Pm,lazy:()=>tu,literal:()=>L,looseObject:()=>qe,looseRecord:()=>ch,mac:()=>Tm,map:()=>uh,meta:()=>kh,nan:()=>hh,nanoid:()=>$m,nativeEnum:()=>ph,never:()=>qi,nonoptional:()=>Hc,null:()=>Qr,nullable:()=>Kr,nullish:()=>fh,number:()=>oe,object:()=>A,optional:()=>de,partialRecord:()=>ah,pipe:()=>$i,prefault:()=>qc,preprocess:()=>so,promise:()=>bh,readonly:()=>Yc,record:()=>me,refine:()=>ou,set:()=>lh,strictObject:()=>ih,string:()=>w,stringFormat:()=>Um,stringbool:()=>zh,success:()=>mh,superRefine:()=>iu,symbol:()=>Xm,templateLiteral:()=>yh,transform:()=>Hi,tuple:()=>Rc,uint32:()=>Km,uint64:()=>Ym,ulid:()=>Nm,undefined:()=>eh,union:()=>ue,unknown:()=>ge,url:()=>wm,uuid:()=>_m,uuidv4:()=>ym,uuidv6:()=>bm,uuidv7:()=>vm,void:()=>nh,xid:()=>Cm,xor:()=>sh});function Sk(){Fe.localeError||ze(xa())}function dr(){Fe.memoizer||ze({memoizer:Vr()})}function w(e){return Ud(fr,e)}function hm(e){return Pa(Si,e)}function gm(e){return Ia(Ni,e)}function _m(e){return Ta(Tt,e)}function ym(e){return Oa(Tt,e)}function bm(e){return Ra(Tt,e)}function vm(e){return Aa(Tt,e)}function wm(e){return ai(Gr,e)}function xm(e){return ai(Gr,{protocol:Vo,hostname:Al,...Z.normalizeParams(e)})}function km(e){return Ea(Ci,e)}function $m(e){return Za(Pi,e)}function zm(e){return Da(Ii,e)}function Sm(e){return Ma(Ti,e)}function Nm(e){return ja(Oi,e)}function Cm(e){return La(Ri,e)}function Pm(e){return Ua(Ai,e)}function Im(e){return Fa(Ei,e)}function Tm(e){return Vd(yc,e)}function Om(e){return Va(Zi,e)}function Rm(e){return qa(Di,e)}function Am(e){return Ha(Mi,e)}function Em(e){return Ba(ji,e)}function Zm(e){return Ja(Li,e)}function Dm(e){return Wa(Ui,e)}function Mm(e){return qd(bc,e)}function jm(e){return Hd(vc,e)}function Lm(e){return Ka(Fi,e)}function Um(e,t,n={}){return ur(zn,e,t,n)}function Fm(e){return ur(zn,"hostname",Rl,e)}function Vm(e){return ur(zn,"hex",Wl,e)}function qm(e){return ur(zn,"currency_code",Zl,e)}function Hm(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,o=ft[r];if(!o)throw new Error(`Unrecognized hash format: ${r}`);return ur(zn,r,o,t)}function oe(e){return Bd(mr,e)}function ki(e){return Wd(Sn,e)}function Bm(e){return Kd(Sn,e)}function Jm(e){return Gd(Sn,e)}function Wm(e){return Qd(Sn,e)}function Km(e){return Yd(Sn,e)}function Ce(e){return Xd(hr,e)}function Gm(e){return tf(gr,e)}function Qm(e){return rf(Vi,e)}function Ym(e){return of(Vi,e)}function Xm(e){return sf(wc,e)}function eh(e){return af(xc,e)}function Qr(e){return cf(kc,e)}function th(){return uf($c)}function ge(){return lf(zc)}function qi(e){return pf(Sc,e)}function nh(e){return df(Nc,e)}function rh(e){return ff(Yr,e)}function Y(e,t){return gf(Cc,e,t)}function oh(e){let t=e._zod.def.shape;return He(Object.keys(t))}function A(e,t){let n={type:"object",shape:e??{},...Z.normalizeParams(t)};return new Xr(n)}function ih(e,t){return new Xr({type:"object",shape:e,catchall:qi(),...Z.normalizeParams(t)})}function qe(e,t){return new Xr({type:"object",shape:e,catchall:ge(),...Z.normalizeParams(t)})}function ue(e,t){return new eo({type:"union",options:e,...Z.normalizeParams(t)})}function sh(e,t){return new Pc({type:"union",options:e,inclusive:!1,...Z.normalizeParams(t)})}function to(e,t,n){return new Ic({type:"union",options:t,discriminator:e,...Z.normalizeParams(n)})}function _r(e,t){return new Tc({type:"intersection",left:e,right:t})}function Rc(e,t,n){let r=t instanceof B,o=r?n:t,i=r?t:null;return new Oc({type:"tuple",items:e,rest:i,...Z.normalizeParams(o)})}function me(e,t,n){return!t||!t._zod?new lr({type:"record",keyType:w(),valueType:e,...Z.normalizeParams(t)}):new lr({type:"record",keyType:e,valueType:t,...Z.normalizeParams(n)})}function ah(e,t,n){return new lr({type:"record",keyType:e,valueType:t,...Z.normalizeParams(n),partial:!0})}function ch(e,t,n){return new lr({type:"record",keyType:e,valueType:t,mode:"loose",...Z.normalizeParams(n)})}function uh(e,t,n){return new Ac({type:"map",keyType:e,valueType:t,...Z.normalizeParams(n)})}function lh(e,t){return new Ec({type:"set",valueType:e,...Z.normalizeParams(t)})}function He(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new pr({type:"enum",entries:n,...Z.normalizeParams(t)})}function ph(e,t){return new pr({type:"enum",entries:e,...Z.normalizeParams(t)})}function L(e,t){return new Zc({type:"literal",values:Array.isArray(e)?e:[e],...Z.normalizeParams(t)})}function dh(e){return _f(Dc,e)}function Hi(e){return new Mc({type:"transform",transform:e})}function de(e){return new no({type:"optional",innerType:e})}function jc(e){return new Bi({type:"optional",innerType:e})}function Kr(e){return new Lc({type:"nullable",innerType:e})}function fh(e){return de(Kr(e))}function Fc(e,t){return new Uc({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Z.shallowClone(t)}})}function qc(e,t){return new Vc({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Z.shallowClone(t)}})}function Hc(e,t){return new Ji({type:"nonoptional",innerType:e,...Z.normalizeParams(t)})}function mh(e){return new Bc({type:"success",innerType:e})}function Wc(e,t){return new Jc({type:"catch",innerType:e,catchValue:typeof t=="function"?t:Z.constantCatch(t)})}function hh(e){return hf(Kc,e)}function $i(e,t){return new ro({type:"pipe",in:e,out:t})}function gh(e,t,n){return new oo({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function _h(e){let t=e._zod.def;return new oo({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function Yc(e){return new Qc({type:"readonly",innerType:e})}function yh(e,t){return new Xc({type:"template_literal",parts:e,...Z.normalizeParams(t)})}function tu(e){return new eu({type:"lazy",getter:e})}function bh(e){return new nu({type:"promise",innerType:e})}function vh(e){return new ru({type:"function",input:Array.isArray(e?.input)?Rc(e?.input):e?.input??Y(ge()),output:e?.output??ge()})}function wh(e){let t=new _e({check:"custom"});return t._zod.check=e,t}function Wi(e,t){return yf(io,e??(()=>!0),t)}function ou(e,t={}){return bf(io,e,t)}function iu(e,t){return vf(e,t)}function $h(e,t={}){let n=new su({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...Z.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}function Sh(e){let t=tu(()=>ue([w(e),oe(),Ce(),Qr(),Y(t),me(w(),t)]));return t}function so(e,t){return new Gc({type:"pipe",in:Hi(e),out:t})}var K,zi,fr,fe,en,tn,nn,rn,Si,Ni,Tt,Gr,Ci,Pi,Ii,Ti,Oi,Ri,Ai,Ei,yc,Zi,Di,Mi,ji,Li,Ui,bc,vc,Fi,zn,mr,Sn,hr,gr,Vi,wc,xc,kc,$c,zc,Sc,Nc,Yr,Cc,Xr,eo,Pc,Ic,Tc,Oc,lr,Ac,Ec,pr,Zc,Dc,Mc,no,Bi,Lc,Uc,Vc,Ji,Bc,Jc,Kc,ro,oo,Gc,Qc,Xc,eu,nu,ru,io,xh,kh,su,zh,Nn=re(()=>{pt();pt();wi();qn();yi();Ad();oc();mm();K=y("ZodType",(e,t)=>(Sk(),B.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Z.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ce(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ou(e,t))},superRefine(e,t){return this.check(iu(e,t))},overwrite(e){return this.check(bt(e))},optional(){return de(this)},exactOptional(){return jc(this)},nullable(){return Kr(this)},nullish(){return de(Kr(this))},nonoptional(e){return Hc(this,e)},array(){return Y(this)},or(e){return ue([this,e])},and(e){return _r(this,e)},transform(e){return $i(this,Hi(e))},default(e){return Fc(this,e)},prefault(e){return qc(this,e)},catch(e){return Wc(this,e)},pipe(e){return $i(this,e)},readonly(){return Yc(this)},describe(e){let t=this.clone();return Ve.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ve.get(this);let t=this.clone();return Ve.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 Z.hide(this,"~standard",{...ea(this),jsonSchema:{input:Br(this,"input"),output:Br(this,"output")}})},set"~standard"(e){Z.own(this,"~standard",e)},parse:function e(t,n){return sc(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ac(this,t,n,{callee:e})},safeParse(e,t){return cc(this,e,t)},async safeParseAsync(e,t){return uc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Z.own(this,"spa",e)},validate(e,t){return Un(this,e,t)},validateAsync(e,t){return Fn(this,e,t)},encode:function e(t,n){return lc(this,t,n,{callee:e})},decode:function e(t,n){return pc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await dc(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await fc(this,t,n,{callee:e})},safeEncode(e,t){return mc(this,e,t)},safeDecode(e,t){return hc(this,e,t)},async safeEncodeAsync(e,t){return gc(this,e,t)},async safeDecodeAsync(e,t){return _c(this,e,t)},toJSONSchema(e){return zf(this,{})(e)},get description(){return Ve.get(this)?.description},get _def(){return this._zod.def}}),zi=y("_ZodString",(e,t)=>{Bn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cf(e,n,r,o)},Z.derived({format:e=>Me(e).format??null,minLength:e=>Me(e).minimum??null,maxLength:e=>Me(e).maximum??null},{regex(...e){return this.check(Gn(...e))},includes(...e){return this.check(Xn(...e))},startsWith(...e){return this.check(er(...e))},endsWith(...e){return this.check(tr(...e))},min(...e){return this.check(Zt(...e))},max(...e){return this.check(vn(...e))},length(...e){return this.check(wn(...e))},nonempty(...e){return this.check(Zt(1,...e))},lowercase(e){return this.check(Qn(e))},uppercase(e){return this.check(Yn(e))},trim(){return this.check(ir())},normalize(...e){return this.check(or(...e))},toLowerCase(){return this.check(sr())},toUpperCase(){return this.check(ar())},slugify(){return this.check(cr())}})),fr=y("ZodString",(e,t)=>{Bn.init(e,t),zi.init(e,t)},{email(e){return this.check(Pa(Si,e))},url(e){return this.check(ai(Gr,e))},jwt(e){return this.check(Ka(Fi,e))},emoji(e){return this.check(Ea(Ci,e))},guid(e){return this.check(Ia(Ni,e))},uuid(e){return this.check(Ta(Tt,e))},uuidv4(e){return this.check(Oa(Tt,e))},uuidv6(e){return this.check(Ra(Tt,e))},uuidv7(e){return this.check(Aa(Tt,e))},nanoid(e){return this.check(Za(Pi,e))},cuid(e){return this.check(Da(Ii,e))},cuid2(e){return this.check(Ma(Ti,e))},ulid(e){return this.check(ja(Oi,e))},base64(e){return this.check(Ba(ji,e))},base64url(e){return this.check(Ja(Li,e))},xid(e){return this.check(La(Ri,e))},ksuid(e){return this.check(Ua(Ai,e))},ipv4(e){return this.check(Fa(Ei,e))},ipv6(e){return this.check(Va(Zi,e))},cidrv4(e){return this.check(qa(Di,e))},cidrv6(e){return this.check(Ha(Mi,e))},e164(e){return this.check(Wa(Ui,e))},datetime(e){return this.check(ci(en,e))},date(e){return this.check(ui(tn,e))},time(e){return this.check(li(nn,e))},duration(e){return this.check(pi(rn,e))}});fe=y("ZodStringFormat",(e,t)=>{le.init(e,t),zi.init(e,t)}),en=y("ZodISODateTime",(e,t)=>{Op.init(e,t),fe.init(e,t)}),tn=y("ZodISODate",(e,t)=>{Rp.init(e,t),fe.init(e,t)}),nn=y("ZodISOTime",(e,t)=>{Ap.init(e,t),fe.init(e,t)}),rn=y("ZodISODuration",(e,t)=>{Ep.init(e,t),fe.init(e,t)}),Si=y("ZodEmail",(e,t)=>{wp.init(e,t),fe.init(e,t)});Ni=y("ZodGUID",(e,t)=>{bp.init(e,t),fe.init(e,t)});Tt=y("ZodUUID",(e,t)=>{vp.init(e,t),fe.init(e,t)});Gr=y("ZodURL",(e,t)=>{$p.init(e,t),fe.init(e,t)});Ci=y("ZodEmoji",(e,t)=>{zp.init(e,t),fe.init(e,t)});Pi=y("ZodNanoID",(e,t)=>{Sp.init(e,t),fe.init(e,t)});Ii=y("ZodCUID",(e,t)=>{Np.init(e,t),fe.init(e,t)});Ti=y("ZodCUID2",(e,t)=>{Cp.init(e,t),fe.init(e,t)});Oi=y("ZodULID",(e,t)=>{Pp.init(e,t),fe.init(e,t)});Ri=y("ZodXID",(e,t)=>{Ip.init(e,t),fe.init(e,t)});Ai=y("ZodKSUID",(e,t)=>{Tp.init(e,t),fe.init(e,t)});Ei=y("ZodIPv4",(e,t)=>{Zp.init(e,t),fe.init(e,t)});yc=y("ZodMAC",(e,t)=>{Mp.init(e,t),fe.init(e,t)});Zi=y("ZodIPv6",(e,t)=>{Dp.init(e,t),fe.init(e,t)});Di=y("ZodCIDRv4",(e,t)=>{jp.init(e,t),fe.init(e,t)});Mi=y("ZodCIDRv6",(e,t)=>{Lp.init(e,t),fe.init(e,t)});ji=y("ZodBase64",(e,t)=>{Up.init(e,t),fe.init(e,t)});Li=y("ZodBase64URL",(e,t)=>{Fp.init(e,t),fe.init(e,t)});Ui=y("ZodE164",(e,t)=>{Vp.init(e,t),fe.init(e,t)});bc=y("ZodCreditCard",(e,t)=>{qp.init(e,t),fe.init(e,t)});vc=y("ZodIBAN",(e,t)=>{Hp.init(e,t),fe.init(e,t)});Fi=y("ZodJWT",(e,t)=>{Bp.init(e,t),fe.init(e,t)});zn=y("ZodCustomStringFormat",(e,t)=>{Jp.init(e,t),fe.init(e,t)});mr=y("ZodNumber",(e,t)=>{la.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pf(e,n,r,o),e.isFinite=!0},Z.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Me(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Me(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:n}=Me(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Me(e).format??null},{gt(e,t){return this.check(Pt(e,t))},gte(e,t){return this.check(lt(e,t))},min(e,t){return this.check(lt(e,t))},lt(e,t){return this.check(Ct(e,t))},lte(e,t){return this.check(ut(e,t))},max(e,t){return this.check(ut(e,t))},int(e){return this.check(ki(e))},safe(e){return this.check(ki(e))},positive(e){return this.check(Pt(0,e))},nonnegative(e){return this.check(lt(0,e))},negative(e){return this.check(Ct(0,e))},nonpositive(e){return this.check(ut(0,e))},multipleOf(e,t){return this.check(Yt(e,t))},step(e,t){return this.check(Yt(e,t))},finite(){return this}}));Sn=y("ZodNumberFormat",(e,t)=>{Wp.init(e,t),mr.init(e,t)});hr=y("ZodBoolean",(e,t)=>{Yo.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>If(e,n,r,o)});gr=y("ZodBigInt",(e,t)=>{pa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tf(e,n,r,o)},Z.derived({minValue:e=>Me(e).minimum??null,maxValue:e=>Me(e).maximum??null,format:e=>Me(e).format??null},{gte(e,t){return this.check(lt(e,t))},min(e,t){return this.check(lt(e,t))},gt(e,t){return this.check(Pt(e,t))},lt(e,t){return this.check(Ct(e,t))},lte(e,t){return this.check(ut(e,t))},max(e,t){return this.check(ut(e,t))},positive(e){return this.check(Pt(BigInt(0),e))},negative(e){return this.check(Ct(BigInt(0),e))},nonpositive(e){return this.check(ut(BigInt(0),e))},nonnegative(e){return this.check(lt(BigInt(0),e))},multipleOf(e,t){return this.check(Yt(e,t))}}));Vi=y("ZodBigIntFormat",(e,t)=>{Kp.init(e,t),gr.init(e,t)});wc=y("ZodSymbol",(e,t)=>{Gp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Of(e,n,r,o)});xc=y("ZodUndefined",(e,t)=>{Qp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Af(e,n,r,o)});kc=y("ZodNull",(e,t)=>{Yp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rf(e,n,r,o)});$c=y("ZodAny",(e,t)=>{Xp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Df(e,n,r,o)});zc=y("ZodUnknown",(e,t)=>{ed.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mf(e,n,r,o)});Sc=y("ZodNever",(e,t)=>{td.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zf(e,n,r,o)});Nc=y("ZodVoid",(e,t)=>{nd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ef(e,n,r,o)});Yr=y("ZodDate",(e,t)=>{rd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jf(e,n,r,o),e.min=(n,r)=>e.check(lt(n,r)),e.max=(n,r)=>e.check(ut(n,r))},Z.derived({minDate:e=>{let{minimum:t}=Me(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=Me(e);return t?new Date(t):null}},{}));Cc=y("ZodArray",(e,t)=>{dr(),id.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qf(e,n,r,o),e.element=t.element},{min(e,t){return this.check(Zt(e,t))},nonempty(e){return this.check(Zt(1,e))},max(e,t){return this.check(vn(e,t))},length(e,t){return this.check(wn(e,t))},unwrap(){return this.element}});Xr=y("ZodObject",(e,t)=>{dr(),sd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yf(e,n,r,o),Z.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return He(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Z.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Z.mergeDefs(this._zod.def,{catchall:ge()}))},loose(){return this.clone(Z.mergeDefs(this._zod.def,{catchall:ge()}))},strict(){return this.clone(Z.mergeDefs(this._zod.def,{catchall:qi()}))},strip(){return this.clone(Z.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return Z.extend(this,e)},safeExtend(e){return Z.safeExtend(this,e)},merge(e){return Z.merge(this,e)},pick(e){return Z.pick(this,e)},omit(e){return Z.omit(this,e)},partial(...e){return Z.partial(no,this,e[0])},exactPartial(...e){return Z.partial(Bi,this,e[0],"exactPartial")},required(...e){return Z.required(Ji,this,e[0])}});eo=y("ZodUnion",(e,t)=>{Xo.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ya(e,n,r,o),e.options=t.options});Pc=y("ZodXor",(e,t)=>{eo.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ya(e,n,r,o),e.options=t.options});Ic=y("ZodDiscriminatedUnion",(e,t)=>{eo.init(e,t),cd.init(e,t)});Tc=y("ZodIntersection",(e,t)=>{ud.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xf(e,n,r,o)});Oc=y("ZodTuple",(e,t)=>{dr(),fa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>em(e,n,r,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 no({type:"optional",innerType:t}))})}});lr=y("ZodRecord",(e,t)=>{dr(),ld.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tm(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});Ac=y("ZodMap",(e,t)=>{dr(),pd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kf(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(It(...n)),e.nonempty=n=>e.check(It(1,n)),e.max=(...n)=>e.check(Xt(...n)),e.size=(...n)=>e.check(bn(...n))});Ec=y("ZodSet",(e,t)=>{dr(),dd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gf(e,n,r,o),e.min=(...n)=>e.check(It(...n)),e.nonempty=n=>e.check(It(1,n)),e.max=(...n)=>e.check(Xt(...n)),e.size=(...n)=>e.check(bn(...n))});pr=y("ZodEnum",(e,t)=>{fd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Lf(e,r,o,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new pr({...t,checks:[],...Z.normalizeParams(o),entries:i})},e.exclude=(r,o)=>{let i={...t.entries};for(let s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new pr({...t,checks:[],...Z.normalizeParams(o),entries:i})}});Zc=y("ZodLiteral",(e,t)=>{md.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uf(e,n,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});Dc=y("ZodFile",(e,t)=>{hd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qf(e,n,r,o),e.min=(n,r)=>e.check(It(n,r)),e.max=(n,r)=>e.check(Xt(n,r)),e.mime=(n,r)=>e.check(rr(Array.isArray(n)?n:[n],r))});Mc=y("ZodTransform",(e,t)=>{dr(),gd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wf(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new _n(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Z.issue(i,n.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=e),n.issues.push(Z.issue(s))}};let o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});no=y("ZodOptional",(e,t)=>{ma.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});Bi=y("ZodExactOptional",(e,t)=>{_d.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});Lc=y("ZodNullable",(e,t)=>{yd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nm(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});Uc=y("ZodDefault",(e,t)=>{bd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>im(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});Vc=y("ZodPrefault",(e,t)=>{vd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sm(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});Ji=y("ZodNonOptional",(e,t)=>{wd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rm(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});Bc=y("ZodSuccess",(e,t)=>{xd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});Jc=y("ZodCatch",(e,t)=>{kd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>am(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});Kc=y("ZodNaN",(e,t)=>{$d.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ff(e,n,r,o)});ro=y("ZodPipe",(e,t)=>{ha.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cm(e,n,r,o),e.in=t.in,e.out=t.out});oo=y("ZodCodec",(e,t)=>{ro.init(e,t),ei.init(e,t)});Gc=y("ZodPreprocess",(e,t)=>{ro.init(e,t),zd.init(e,t)}),Qc=y("ZodReadonly",(e,t)=>{Sd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>um(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});Xc=y("ZodTemplateLiteral",(e,t)=>{Nd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vf(e,n,r,o)});eu=y("ZodLazy",(e,t)=>{ti.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pm(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});nu=y("ZodPromise",(e,t)=>{Pd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lm(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});ru=y("ZodFunction",(e,t)=>{Cd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jf(e,n,r,o)});io=y("ZodCustom",(e,t)=>{Id.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bf(e,n,r,o)});xh=wf,kh=xf,su=y("ZodInstanceOf",(e,t)=>{io.init(e,t)},{properties(e,t){return this.check(nr(e,t))}});zh=(...e)=>kf({Codec:oo,Boolean:hr,String:fr},...e)});function By(e){ze({customError:e})}function Jy(){return ze().customError}var Hy,au,Wy=re(()=>{pt();Hy={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"};au||(au={})});var Cn={};At(Cn,{ZodISODate:()=>tn,ZodISODateTime:()=>en,ZodISODuration:()=>rn,ZodISOTime:()=>nn,date:()=>Ck,datetime:()=>Nk,duration:()=>Ik,time:()=>Pk});function Nk(e){return ci(en,e)}function Ck(e){return ui(tn,e)}function Pk(e){return li(nn,e)}function Ik(e){return pi(rn,e)}var cu=re(()=>{pt();Nn();Nn()});function Ok(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function Ky(e,t){return e.map((n,r)=>r<t?n:n.optional())}function Rk(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Ak(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){let o=n[1]===void 0?void 0:Rk(n[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}function Ek(e,t){return R.transform(r=>r).check(r=>{let o=r.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&&r.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:o,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&r.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:o,inst:e,continue:!0}),t.keySchema)for(let s of i){let a=t.keySchema.safeParse(s);a.success||r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function Nh(e,t){if(e===null)return"z";let n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;let r=String(e);return`${n[0]}${r.length}:${r}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let s of e){let a=Nh(s,t);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let r=Object.keys(e).sort(),o=[];for(let i of r){let s=Nh(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 Ki(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Ki):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,n])=>Zk.has(t)?Ki(n):!Dk.has(t)||typeof n!="object"||n===null?!1:Object.values(n).some(Ki))}function Gy(e){return e===1?"element":"elements"}function Mk(e,t){return R.transform(r=>r).check(r=>{let o=r.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let s=0;s<o.length;s++){let a=Nh(o[s],new Set);if(a===null)continue;let u=i.get(a);if(u===void 0){i.set(a,s);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${u}`,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 u of o)if(t.containsSchema.safeParse(u).success&&++a>=s)break;a<i&&r.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Gy(i)}; found ${a}`,input:o,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&r.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Gy(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}function Qy(e,t){if(e!==!1)return e===void 0||e===!0?R.any():ot(e,t)}function Yy(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return R.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 R.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=Ak(o,t),s=ot(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 R.null();if(o.length===0)return R.never();if(o.length===1)return R.literal(o[0]);if(o.every(s=>typeof s=="string"))return R.enum(o);let i=o.map(s=>R.literal(s));return i.length<2?i[0]:R.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return R.literal(e.const);let n=e.type;if(Array.isArray(n)){let o=n.map(i=>{let s={...e,type:i};return Yy(s,t)});return o.length===0?R.never():o.length===1?o[0]:R.union(o)}if(!n)return R.any();let r;switch(n){case"string":{let o=R.string();if(e.format){let i=e.format;i==="email"?o=o.check(R.email()):i==="uri"||i==="uri-reference"?o=o.check(R.url()):i==="uuid"||i==="guid"?o=o.check(R.uuid()):i==="date-time"?o=o.check(R.iso.datetime({offset:!0})):i==="date"?o=o.check(R.iso.date()):i==="time"?o=o.check(R.regex(jk)):i==="duration"?o=o.check(R.iso.duration()):i==="hostname"?o=o.check(R.hostname()):i==="ipv4"?o=o.check(R.ipv4()):i==="ipv6"?o=o.check(R.ipv6()):i==="mac"?o=o.check(R.mac()):i==="cidr"?o=o.check(R.cidrv4()):i==="cidr-v6"?o=o.check(R.cidrv6()):i==="base64"?o=o.check(R.base64()):i==="base64url"?o=o.check(R.base64url()):i==="e164"?o=o.check(R.e164()):i==="credit_card"?o=o.check(R.creditCard()):i==="iban"?o=o.check(R.iban()):i==="jwt"?o=o.check(R.jwt()):i==="emoji"?o=o.check(R.emoji()):i==="nanoid"?o=o.check(R.nanoid()):i==="cuid"?o=o.check(R.cuid()):i==="cuid2"?o=o.check(R.cuid2()):i==="ulid"?o=o.check(R.ulid()):i==="xid"?o=o.check(R.xid()):i==="ksuid"&&(o=o.check(R.ksuid()))}typeof e.minLength=="number"&&(o=o.min(e.minLength)),typeof e.maxLength=="number"&&(o=o.max(e.maxLength)),e.pattern&&(o=o.regex(new RegExp(e.pattern))),r=o;break}case"number":case"integer":{let o=n==="integer"?R.number().int():R.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(o=o.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(o=o.max(e.maximum)),typeof e.exclusiveMinimum=="number"?o=o.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(o=o.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?o=o.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(o=o.lt(e.maximum)),typeof e.multipleOf=="number"&&(o=o.multipleOf(e.multipleOf)),r=o;break}case"boolean":{r=R.boolean();break}case"null":{r=R.null();break}case"object":{let o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?ot(e.additionalProperties,t):void 0;for(let[h,d]of Object.entries(i)){let f=ot(d,t);Je(o,h,s.has(h)?f:f.optional())}if(e.patternProperties){let h=e.patternProperties,d=Object.keys(h),f=[];for(let b of d){let x=ot(h[b],t),k=R.string().regex(new RegExp(b));f.push(R.looseRecord(k,x))}let g=[];if(Object.keys(o).length>0&&g.push(R.object(o).passthrough()),g.push(...f),g.length===0)r=R.object({}).passthrough();else if(g.length===1)r=g[0];else{let b=R.intersection(g[0],g[1]);for(let x=2;x<g.length;x++)b=R.intersection(b,g[x]);r=b}if(e.additionalProperties===!1){let b=Object.keys(o),x=d.map(v=>new RegExp(v)),k=r;r=r.check(v=>{if(!gt(v.value))return;let N=[];for(let T of Object.keys(v.value))b.includes(T)||x.some(M=>M.test(T))||N.push(T);N.length&&v.issues.push({code:"unrecognized_keys",keys:N,input:v.value,inst:k})})}}else{let h=R.object(o);e.additionalProperties===!1?r=h.strict():a?r=h.catchall(a):r=h.passthrough()}let u=e.propertyNames!==void 0&&e.propertyNames!==!0,l=typeof e.minProperties=="number"?e.minProperties:void 0,p=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(u||l!==void 0||p!==void 0){let h;if(u){let d=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;h=ot(d,t)}r=Ek(r,{keySchema:h,minProperties:l,maxProperties:p})}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(h=>ot(h,t)),u=Ky(a,s),l=Array.isArray(i)?void 0:Qy(i,t),p=R.tuple(u);r=l?p.rest(l):p,typeof e.minItems=="number"&&(r=r.check(R.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(R.maxLength(e.maxItems)))}else if(Array.isArray(i)){let s=typeof e.minItems=="number"?e.minItems:0,a=i.map(h=>ot(h,t)),u=Ky(a,s),l=Qy(e.additionalItems,t),p=R.tuple(u);r=l?p.rest(l):p,typeof e.minItems=="number"&&(r=r.check(R.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(R.maxLength(e.maxItems)))}else if(i!==void 0){let s=ot(i,t),a=R.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),r=a}else r=R.array(R.any());(e.uniqueItems===!0||e.contains!==void 0)&&(r=Mk(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ot(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${n}`)}return r}function ot(e,t){if(typeof e=="boolean")return e?R.any():R.never();let n=Yy(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(l=>ot(l,t)),u=R.union(a);n=r?R.intersection(n,u):u}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(l=>ot(l,t)),u=R.xor(a);n=r?R.intersection(n,u):u}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:R.any();else{let a=r?n:ot(e.allOf[0],t),u=r?0:1;for(let l=u;l<e.allOf.length;l++)a=R.intersection(a,ot(e.allOf[l],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=R.nullable(n)),e.readOnly===!0&&(n=R.readonly(n)),e.default!==void 0&&(n=n.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&&!Ki(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&&!Ki(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))Tk.has(a)||Je(o,a,e[a]);return Object.keys(o).length>0&&t.registry.add(n,o),e.description&&(n=n.describe(e.description)),n}function Ch(e,t){if(typeof e=="boolean")return e?R.any():R.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=Ok(n,t?.defaultTarget),o=n.$defs||n.definitions||{},i={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??Ve};return ot(n,i)}var R,Tk,Zk,Dk,jk,Xy=re(()=>{ii();Oe();oc();cu();Nn();R={...ao,...rc,iso:Cn},Tk=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"]);Zk=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Dk=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);jk=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/});function Ph(e){return xi(e,{object:t=>t.partial(),union:t=>{let n=t._zod.def;return n.discriminator===void 0?t:ue(n.options)}})}var eb=re(()=>{dm();Nn()});function Lk(e,t){if(!t?.length)return e;let n=e._zod.def;return ce(e,Nt(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function tb(e){return Lk(e.out,e.checks)}function Uk(e){return e.in._zod.traits.has("$ZodTransform")?tb(e):e.in}function Ih(e){return xi(e,{pipe:t=>Uk(t._zod.def),default:(t,n)=>n?de(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function Th(e){return xi(e,{pipe:t=>tb(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}var nb=re(()=>{Oe();dm();Nn()});var uu={};At(uu,{bigint:()=>Hk,boolean:()=>qk,date:()=>Bk,number:()=>Vk,string:()=>Fk});function Fk(e){return Fd(fr,e)}function Vk(e){return Jd(mr,e)}function qk(e){return ef(hr,e)}function Hk(e){return nf(gr,e)}function Bk(e){return mf(Yr,e)}var rb=re(()=>{pt();Nn()});var m={};At(m,{$brand:()=>Ps,$input:()=>za,$output:()=>$a,INVALID:()=>Xe,NEVER:()=>Cs,TimePrecision:()=>Ga,ZodAny:()=>$c,ZodArray:()=>Cc,ZodBase64:()=>ji,ZodBase64URL:()=>Li,ZodBigInt:()=>gr,ZodBigIntFormat:()=>Vi,ZodBoolean:()=>hr,ZodCIDRv4:()=>Di,ZodCIDRv6:()=>Mi,ZodCUID:()=>Ii,ZodCUID2:()=>Ti,ZodCatch:()=>Jc,ZodCodec:()=>oo,ZodCompileAsyncError:()=>yt,ZodCompileUnsupportedError:()=>te,ZodCreditCard:()=>bc,ZodCustom:()=>io,ZodCustomStringFormat:()=>zn,ZodDate:()=>Yr,ZodDefault:()=>Uc,ZodDiscriminatedUnion:()=>Ic,ZodE164:()=>Ui,ZodEmail:()=>Si,ZodEmoji:()=>Ci,ZodEnum:()=>pr,ZodError:()=>qy,ZodExactOptional:()=>Bi,ZodFile:()=>Dc,ZodFirstPartyTypeKind:()=>au,ZodFunction:()=>ru,ZodGUID:()=>Ni,ZodIBAN:()=>vc,ZodIPv4:()=>Ei,ZodIPv6:()=>Zi,ZodISODate:()=>tn,ZodISODateTime:()=>en,ZodISODuration:()=>rn,ZodISOTime:()=>nn,ZodInstanceOf:()=>su,ZodIntersection:()=>Tc,ZodIssueCode:()=>Hy,ZodJWT:()=>Fi,ZodKSUID:()=>Ai,ZodLazy:()=>eu,ZodLiteral:()=>Zc,ZodMAC:()=>yc,ZodMap:()=>Ac,ZodNaN:()=>Kc,ZodNanoID:()=>Pi,ZodNever:()=>Sc,ZodNonOptional:()=>Ji,ZodNull:()=>kc,ZodNullable:()=>Lc,ZodNumber:()=>mr,ZodNumberFormat:()=>Sn,ZodObject:()=>Xr,ZodOptional:()=>no,ZodPipe:()=>ro,ZodPrefault:()=>Vc,ZodPreprocess:()=>Gc,ZodPromise:()=>nu,ZodReadonly:()=>Qc,ZodRealError:()=>rt,ZodRecord:()=>lr,ZodSet:()=>Ec,ZodString:()=>fr,ZodStringFormat:()=>fe,ZodSuccess:()=>Bc,ZodSymbol:()=>wc,ZodTemplateLiteral:()=>Xc,ZodTransform:()=>Mc,ZodTuple:()=>Oc,ZodType:()=>K,ZodULID:()=>Oi,ZodURL:()=>Gr,ZodUUID:()=>Tt,ZodUndefined:()=>xc,ZodUnion:()=>eo,ZodUnknown:()=>zc,ZodVoid:()=>Nc,ZodXID:()=>Ri,ZodXor:()=>Pc,_ZodString:()=>zi,_default:()=>Fc,_function:()=>vh,any:()=>th,array:()=>Y,base64:()=>Em,base64url:()=>Zm,bigint:()=>Gm,boolean:()=>Ce,catch:()=>Wc,check:()=>wh,cidrv4:()=>Rm,cidrv6:()=>Am,clone:()=>ce,codec:()=>gh,coerce:()=>uu,compile:()=>Sa,config:()=>ze,core:()=>Dt,creditCard:()=>Mm,cuid:()=>zm,cuid2:()=>Sm,currencyCode:()=>qm,custom:()=>Wi,date:()=>rh,decode:()=>pc,decodeAsync:()=>fc,deepPartial:()=>Ph,describe:()=>xh,discriminatedUnion:()=>to,e164:()=>Dm,email:()=>hm,emoji:()=>km,encode:()=>lc,encodeAsync:()=>dc,endsWith:()=>tr,enum:()=>He,exactOptional:()=>jc,file:()=>dh,flattenError:()=>Rr,float32:()=>Bm,float64:()=>Jm,formatError:()=>Ar,fromJSONSchema:()=>Ch,function:()=>vh,getDiscriminatedOption:()=>da,getErrorMap:()=>Jy,globalRegistry:()=>Ve,gt:()=>Pt,gte:()=>lt,guid:()=>gm,hash:()=>Hm,hex:()=>Vm,hostname:()=>Fm,httpUrl:()=>xm,iban:()=>jm,includes:()=>Xn,input:()=>Ih,instanceof:()=>$h,int:()=>ki,int32:()=>Wm,int64:()=>Qm,intersection:()=>_r,invertCodec:()=>_h,ipv4:()=>Im,ipv6:()=>Om,iso:()=>Cn,json:()=>Sh,jwt:()=>Lm,keyof:()=>oh,ksuid:()=>Pm,lazy:()=>tu,length:()=>wn,literal:()=>L,locales:()=>qr,looseObject:()=>qe,looseRecord:()=>ch,lowercase:()=>Qn,lt:()=>Ct,lte:()=>ut,mac:()=>Tm,map:()=>uh,maxLength:()=>vn,maxSize:()=>Xt,memoizer:()=>Vr,meta:()=>kh,mime:()=>rr,minLength:()=>Zt,minSize:()=>It,multipleOf:()=>Yt,nan:()=>hh,nanoid:()=>$m,nativeEnum:()=>ph,negative:()=>fi,never:()=>qi,nonnegative:()=>hi,nonoptional:()=>Hc,nonpositive:()=>mi,normalize:()=>or,null:()=>Qr,nullable:()=>Kr,nullish:()=>fh,number:()=>oe,object:()=>A,optional:()=>de,output:()=>Th,overwrite:()=>bt,parse:()=>sc,parseAsync:()=>ac,partialRecord:()=>ah,pipe:()=>$i,positive:()=>di,prefault:()=>qc,preprocess:()=>so,prettifyError:()=>Ts,promise:()=>bh,properties:()=>nr,property:()=>gi,readonly:()=>Yc,record:()=>me,refine:()=>ou,regex:()=>Gn,regexes:()=>ft,registry:()=>oi,safeDecode:()=>hc,safeDecodeAsync:()=>_c,safeEncode:()=>mc,safeEncodeAsync:()=>gc,safeParse:()=>cc,safeParseAsync:()=>uc,set:()=>lh,setErrorMap:()=>By,size:()=>bn,slugify:()=>cr,startsWith:()=>er,strictObject:()=>ih,string:()=>w,stringFormat:()=>Um,stringbool:()=>zh,success:()=>mh,superRefine:()=>iu,symbol:()=>Xm,templateLiteral:()=>yh,toJSONSchema:()=>vi,toLowerCase:()=>sr,toUpperCase:()=>ar,toZod:()=>Sr,transform:()=>Hi,treeifyError:()=>Is,trim:()=>ir,tuple:()=>Rc,uint32:()=>Km,uint64:()=>Ym,ulid:()=>Nm,undefined:()=>eh,union:()=>ue,unknown:()=>ge,uppercase:()=>Yn,url:()=>wm,util:()=>Z,uuid:()=>_m,uuidv4:()=>ym,uuidv6:()=>bm,uuidv7:()=>vm,validate:()=>Un,validateAsync:()=>Fn,void:()=>nh,withParser:()=>si,xid:()=>Cm,xor:()=>sh});var lu=re(()=>{pt();Nn();oc();fm();mm();Wy();pt();wi();Xy();eb();nb();Ed();cu();cu();rb()});var ob=re(()=>{lu();lu()});var Oh={};At(Oh,{$brand:()=>Ps,$input:()=>za,$output:()=>$a,INVALID:()=>Xe,NEVER:()=>Cs,TimePrecision:()=>Ga,ZodAny:()=>$c,ZodArray:()=>Cc,ZodBase64:()=>ji,ZodBase64URL:()=>Li,ZodBigInt:()=>gr,ZodBigIntFormat:()=>Vi,ZodBoolean:()=>hr,ZodCIDRv4:()=>Di,ZodCIDRv6:()=>Mi,ZodCUID:()=>Ii,ZodCUID2:()=>Ti,ZodCatch:()=>Jc,ZodCodec:()=>oo,ZodCompileAsyncError:()=>yt,ZodCompileUnsupportedError:()=>te,ZodCreditCard:()=>bc,ZodCustom:()=>io,ZodCustomStringFormat:()=>zn,ZodDate:()=>Yr,ZodDefault:()=>Uc,ZodDiscriminatedUnion:()=>Ic,ZodE164:()=>Ui,ZodEmail:()=>Si,ZodEmoji:()=>Ci,ZodEnum:()=>pr,ZodError:()=>qy,ZodExactOptional:()=>Bi,ZodFile:()=>Dc,ZodFirstPartyTypeKind:()=>au,ZodFunction:()=>ru,ZodGUID:()=>Ni,ZodIBAN:()=>vc,ZodIPv4:()=>Ei,ZodIPv6:()=>Zi,ZodISODate:()=>tn,ZodISODateTime:()=>en,ZodISODuration:()=>rn,ZodISOTime:()=>nn,ZodInstanceOf:()=>su,ZodIntersection:()=>Tc,ZodIssueCode:()=>Hy,ZodJWT:()=>Fi,ZodKSUID:()=>Ai,ZodLazy:()=>eu,ZodLiteral:()=>Zc,ZodMAC:()=>yc,ZodMap:()=>Ac,ZodNaN:()=>Kc,ZodNanoID:()=>Pi,ZodNever:()=>Sc,ZodNonOptional:()=>Ji,ZodNull:()=>kc,ZodNullable:()=>Lc,ZodNumber:()=>mr,ZodNumberFormat:()=>Sn,ZodObject:()=>Xr,ZodOptional:()=>no,ZodPipe:()=>ro,ZodPrefault:()=>Vc,ZodPreprocess:()=>Gc,ZodPromise:()=>nu,ZodReadonly:()=>Qc,ZodRealError:()=>rt,ZodRecord:()=>lr,ZodSet:()=>Ec,ZodString:()=>fr,ZodStringFormat:()=>fe,ZodSuccess:()=>Bc,ZodSymbol:()=>wc,ZodTemplateLiteral:()=>Xc,ZodTransform:()=>Mc,ZodTuple:()=>Oc,ZodType:()=>K,ZodULID:()=>Oi,ZodURL:()=>Gr,ZodUUID:()=>Tt,ZodUndefined:()=>xc,ZodUnion:()=>eo,ZodUnknown:()=>zc,ZodVoid:()=>Nc,ZodXID:()=>Ri,ZodXor:()=>Pc,_ZodString:()=>zi,_default:()=>Fc,_function:()=>vh,any:()=>th,array:()=>Y,base64:()=>Em,base64url:()=>Zm,bigint:()=>Gm,boolean:()=>Ce,catch:()=>Wc,check:()=>wh,cidrv4:()=>Rm,cidrv6:()=>Am,clone:()=>ce,codec:()=>gh,coerce:()=>uu,compile:()=>Sa,config:()=>ze,core:()=>Dt,creditCard:()=>Mm,cuid:()=>zm,cuid2:()=>Sm,currencyCode:()=>qm,custom:()=>Wi,date:()=>rh,decode:()=>pc,decodeAsync:()=>fc,deepPartial:()=>Ph,default:()=>m,describe:()=>xh,discriminatedUnion:()=>to,e164:()=>Dm,email:()=>hm,emoji:()=>km,encode:()=>lc,encodeAsync:()=>dc,endsWith:()=>tr,enum:()=>He,exactOptional:()=>jc,file:()=>dh,flattenError:()=>Rr,float32:()=>Bm,float64:()=>Jm,formatError:()=>Ar,fromJSONSchema:()=>Ch,function:()=>vh,getDiscriminatedOption:()=>da,getErrorMap:()=>Jy,globalRegistry:()=>Ve,gt:()=>Pt,gte:()=>lt,guid:()=>gm,hash:()=>Hm,hex:()=>Vm,hostname:()=>Fm,httpUrl:()=>xm,iban:()=>jm,includes:()=>Xn,input:()=>Ih,instanceof:()=>$h,int:()=>ki,int32:()=>Wm,int64:()=>Qm,intersection:()=>_r,invertCodec:()=>_h,ipv4:()=>Im,ipv6:()=>Om,iso:()=>Cn,json:()=>Sh,jwt:()=>Lm,keyof:()=>oh,ksuid:()=>Pm,lazy:()=>tu,length:()=>wn,literal:()=>L,locales:()=>qr,looseObject:()=>qe,looseRecord:()=>ch,lowercase:()=>Qn,lt:()=>Ct,lte:()=>ut,mac:()=>Tm,map:()=>uh,maxLength:()=>vn,maxSize:()=>Xt,memoizer:()=>Vr,meta:()=>kh,mime:()=>rr,minLength:()=>Zt,minSize:()=>It,multipleOf:()=>Yt,nan:()=>hh,nanoid:()=>$m,nativeEnum:()=>ph,negative:()=>fi,never:()=>qi,nonnegative:()=>hi,nonoptional:()=>Hc,nonpositive:()=>mi,normalize:()=>or,null:()=>Qr,nullable:()=>Kr,nullish:()=>fh,number:()=>oe,object:()=>A,optional:()=>de,output:()=>Th,overwrite:()=>bt,parse:()=>sc,parseAsync:()=>ac,partialRecord:()=>ah,pipe:()=>$i,positive:()=>di,prefault:()=>qc,preprocess:()=>so,prettifyError:()=>Ts,promise:()=>bh,properties:()=>nr,property:()=>gi,readonly:()=>Yc,record:()=>me,refine:()=>ou,regex:()=>Gn,regexes:()=>ft,registry:()=>oi,safeDecode:()=>hc,safeDecodeAsync:()=>_c,safeEncode:()=>mc,safeEncodeAsync:()=>gc,safeParse:()=>cc,safeParseAsync:()=>uc,set:()=>lh,setErrorMap:()=>By,size:()=>bn,slugify:()=>cr,startsWith:()=>er,strictObject:()=>ih,string:()=>w,stringFormat:()=>Um,stringbool:()=>zh,success:()=>mh,superRefine:()=>iu,symbol:()=>Xm,templateLiteral:()=>yh,toJSONSchema:()=>vi,toLowerCase:()=>sr,toUpperCase:()=>ar,toZod:()=>Sr,transform:()=>Hi,treeifyError:()=>Is,trim:()=>ir,tuple:()=>Rc,uint32:()=>Km,uint64:()=>Ym,ulid:()=>Nm,undefined:()=>eh,union:()=>ue,unknown:()=>ge,uppercase:()=>Yn,url:()=>wm,util:()=>Z,uuid:()=>_m,uuidv4:()=>ym,uuidv6:()=>bm,uuidv7:()=>vm,validate:()=>Un,validateAsync:()=>Fn,void:()=>nh,withParser:()=>si,xid:()=>Cm,xor:()=>sh,z:()=>m});var Gi=re(()=>{lu();ob()});var bs,J,Ig,nv,dn,Sg,Tg,Og,Zu,ms,So,Rg,ju,Du,Mu,rv,gs={},_s=[],ov=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,No=Array.isArray;function Wt(e,t){for(var n in t)e[n]=t[n];return e}function Lu(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Co(e,t,n){var r,o,i,s={};for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?bs.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return hs(e,s,r,o,null)}function hs(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Ig,__i:-1,__u:0};return o==null&&J.vnode!=null&&J.vnode(i),i}function be(e){return e.children}function St(e,t){this.props=e,this.context=t}function Dn(e,t){if(t==null)return e.__?Dn(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Dn(e):null}function iv(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],o=[],i=Wt({},t);i.__v=t.__v+1,J.vnode&&J.vnode(i),Uu(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??Dn(t),!!(32&t.__u),o),i.__v=t.__v,i.__.__k[i.__i]=i,Mg(r,i,o),t.__e=t.__=null,i.__e!=n&&Ag(i)}}function Ag(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Ag(e)}function Ng(e){(!e.__d&&(e.__d=!0)&&dn.push(e)&&!ys.__r++||Sg!=J.debounceRendering)&&((Sg=J.debounceRendering)||Tg)(ys)}function ys(){try{for(var e,t=1;dn.length;)dn.length>t&&dn.sort(Og),e=dn.shift(),t=dn.length,iv(e)}finally{dn.length=ys.__r=0}}function Eg(e,t,n,r,o,i,s,a,u,l,p){var h,d,f,g,b,x,k=r&&r.__k||_s,v=t.length;for(u=sv(n,t,k,u,v),h=0;h<v;h++)(f=n.__k[h])!=null&&(d=f.__i!=-1&&k[f.__i]||gs,f.__i=h,x=Uu(e,f,d,o,i,s,a,u,l,p),g=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&Fu(d.ref,null,f),p.push(f.ref,f.__c||g,f)),b==null&&g!=null&&(b=g),4&f.__u?(u=Zg(f,u,e),d.__e&&(d.__e=null)):typeof f.type=="function"&&x!==void 0?u=x:g&&(u=g.nextSibling),f.__u&=-7);return n.__e=b,u}function sv(e,t,n,r,o){var i,s,a,u,l,p=n.length,h=p,d=0;for(e.__k=new Array(o),i=0;i<o;i++)(s=t[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[i]=hs(null,s,null,null,null):No(s)?s=e.__k[i]=hs(be,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[i]=hs(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,u=i+d,s.__=e,s.__b=e.__b+1,a=null,(l=s.__i=av(s,n,u,h))!=-1&&(h--,(a=n[l])&&(a.__u|=2)),a==null||a.__v==null?(l==-1&&(o>p?d--:o<p&&d++),typeof s.type!="function"&&(s.__u|=4)):l!=u&&(l==u-1?d--:l==u+1?d++:(l>u?d--:d++,s.__u|=4))):e.__k[i]=null;if(h)for(i=0;i<p;i++)(a=n[i])!=null&&(2&a.__u)==0&&(a.__e==r&&(r=Dn(a)),Lg(a,a));return r}function Zg(e,t,n){var r,o;if(typeof e.type=="function"){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=Zg(r[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Dn(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Po(e,t){return t=t||[],e==null||typeof e=="boolean"||(No(e)?e.some(function(n){Po(n,t)}):t.push(e)),t}function av(e,t,n,r){var o,i,s,a=e.key,u=e.type,l=t[n],p=l!=null&&(2&l.__u)==0;if(l===null&&a==null||p&&a==l.key&&u==l.type)return n;if(r>(p?1:0)){for(o=n-1,i=n+1;o>=0||i<t.length;)if((l=t[s=o>=0?o--:i++])!=null&&(2&l.__u)==0&&a==l.key&&u==l.type)return s}return-1}function Cg(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ov.test(t)?n:n+"px"}function fs(e,t,n,r,o){var i,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Cg(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Cg(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(Rg,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n[So]=r[So]:(n[So]=ju,e.addEventListener(t,i?Mu:Du,i)):e.removeEventListener(t,i?Mu:Du,i);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Pg(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[ms]==null)t[ms]=ju++;else if(t[ms]<n[So])return;return n(J.event?J.event(t):t)}}}function Uu(e,t,n,r,o,i,s,a,u,l){var p,h,d,f,g,b,x,k,v,N,T,M,D,E,ae,xe,he=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(u=!!(32&n.__u),i=[a=t.__e=n.__e]),(p=J.__b)&&p(t);e:if(typeof he=="function"){h=s.length;try{if(v=t.props,N=he.prototype&&he.prototype.render,T=(p=he.contextType)&&r[p.__c],M=p?T?T.props.value:p.__:r,n.__c?k=(d=t.__c=n.__c).__=d.__E:(N?t.__c=d=new he(v,M):(t.__c=d=new St(v,M),d.constructor=he,d.render=uv),T&&T.sub(d),d.state||(d.state={}),d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),N&&d.__s==null&&(d.__s=d.state),N&&he.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Wt({},d.__s)),Wt(d.__s,he.getDerivedStateFromProps(v,d.__s))),g=d.props,b=d.state,d.__v=t,f)N&&he.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),N&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(N&&he.getDerivedStateFromProps==null&&v!==g&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(v,M),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(v,d.__s,M)===!1){t.__v!=n.__v&&(d.props=v,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(Ne){Ne&&(Ne.__=t)}),_s.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&s.push(d),a=Dn(n);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(v,d.__s,M),N&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(g,b,x)})}if(d.context=M,d.props=v,d.__P=e,d.__e=!1,D=J.__r,E=0,N)d.state=d.__s,d.__d=!1,D&&D(t),p=d.render(d.props,d.state,d.context),_s.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,D&&D(t),p=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++E<25);d.state=d.__s,d.getChildContext!=null&&(r=Wt(Wt({},r),d.getChildContext())),N&&!f&&d.getSnapshotBeforeUpdate!=null&&(x=d.getSnapshotBeforeUpdate(g,b)),ae=p!=null&&p.type===be&&p.key==null?jg(p.props.children):p,a=Eg(e,No(ae)?ae:[ae],t,n,r,o,i,s,a,u,l),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),k&&(d.__E=d.__=null)}catch(Ne){if(s.length=h,t.__v=null,u||i!=null){if(Ne.then){for(t.__u|=u?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;i!=null&&(i[i.indexOf(a)]=null),t.__e=a}else if(i!=null)for(xe=i.length;xe--;)Lu(i[xe])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),Ne.then||Dg(t),J.__e(Ne,t,n)}}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):a=t.__e=cv(n.__e,t,n,r,o,i,s,u,l);return(p=J.diffed)&&p(t),128&t.__u?void 0:a}function Dg(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Dg))}function Mg(e,t,n){for(var r=0;r<n.length;r++)Fu(n[r],n[++r],n[++r]);J.__c&&J.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){J.__e(i,o.__v)}})}function jg(e){return typeof e!="object"||e==null||e.__b>0?e:No(e)?e.map(jg):e.constructor!==void 0?null:Wt({},e)}function cv(e,t,n,r,o,i,s,a,u){var l,p,h,d,f,g,b,x=n.props||gs,k=t.props,v=t.type;if(v=="svg"?o="http://www.w3.org/2000/svg":v=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(l=0;l<i.length;l++)if((f=i[l])&&"setAttribute"in f==!!v&&(v?f.localName==v:f.nodeType==3)){e=f,i[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(k);e=document.createElementNS(o,v,k.is&&k),a&&(J.__m&&J.__m(t,i),a=!1),i=null}if(v==null)x===k||a&&e.data==k||(e.data=k);else{if(i=v=="textarea"&&k.defaultValue!=null?null:i&&bs.call(e.childNodes),!a&&i!=null)for(x={},l=0;l<e.attributes.length;l++)x[(f=e.attributes[l]).name]=f.value;for(l in x)f=x[l],l=="dangerouslySetInnerHTML"?h=f:l=="children"||l in k||l=="value"&&"defaultValue"in k||l=="checked"&&"defaultChecked"in k||fs(e,l,null,f,o);for(l in k)f=k[l],l=="children"?d=f:l=="dangerouslySetInnerHTML"?p=f:l=="value"?g=f:l=="checked"?b=f:a&&typeof f!="function"||x[l]===f||fs(e,l,f,x[l],o);if(p)a||h&&(p.__html==h.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(h&&(e.innerHTML=""),Eg(t.type=="template"?e.content:e,No(d)?d:[d],t,n,r,v=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,s,i?i[0]:n.__k&&Dn(n,0),a,u),i!=null)for(l=i.length;l--;)Lu(i[l]);a&&v!="textarea"||(l="value",v=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||v=="progress"&&!g||v=="option"&&g!=x[l])&&fs(e,l,g,x[l],o),l="checked",b!=null&&b!=e[l]&&fs(e,l,b,x[l],o))}return e}function Fu(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(o){J.__e(o,n)}}function Lg(e,t,n){var r,o;if(J.unmount&&J.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Fu(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){J.__e(i,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&Lg(r[o],t,n||typeof e.type!="function");n||Lu(e.__e),e.__c=e.__=e.__e=void 0}function uv(e,t,n){return this.constructor(e,n)}function Vu(e,t,n){var r,o,i,s;t==document&&(t=document.documentElement),J.__&&J.__(e,t),o=(r=typeof n=="function")?null:n&&n.__k||t.__k,i=[],s=[],Uu(t,e=(!r&&n||t).__k=Co(be,null,[e]),o||gs,gs,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?bs.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r,s),Mg(i,e,s),e.props.children=null}bs=_s.slice,J={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(a){e=a}throw e}},Ig=0,nv=function(e){return e!=null&&e.constructor===void 0},St.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Wt({},this.state),typeof e=="function"&&(e=e(Wt({},n),this.props)),e&&Wt(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ng(this))},St.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ng(this))},St.prototype.render=be,dn=[],Tg=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Og=function(e,t){return e.__v.__b-t.__v.__b},ys.__r=0,Zu=Math.random().toString(8),ms="__d"+Zu,So="__a"+Zu,Rg=/(PointerCapture)$|Capture$/i,ju=0,Du=Pg(!1),Mu=Pg(!0),rv=0;var Io,Ie,qu,Ug,To=0,Kg=[],Te=J,Fg=Te.__b,Vg=Te.__r,qg=Te.diffed,Hg=Te.__c,Bg=Te.unmount,Jg=Te.__;function Bu(e,t){Te.__h&&Te.__h(Ie,e,To||t),To=0;var n=Ie.__H||(Ie.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function j(e){return To=1,Gg(Yg,e)}function Gg(e,t,n){var r=Bu(Io++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Yg(void 0,t),function(a){var u=r.__N?r.__N[0]:r.__[0],l=r.t(u,a);u!==l&&(r.__N=[l,r.__[1]],r.__c.setState({}))}],r.__c=Ie,!Ie.__f)){var o=function(a,u,l){if(!r.__c.__H)return!0;var p=!1,h=r.__c.props!==a;if(r.__c.__H.__.some(function(f){if(f.__N){p=!0;var g=f.__[0];f.__=f.__N,f.__N=void 0,g!==f.__[0]&&(h=!0)}}),i){var d=i.call(this,a,u,l);return p?d||h:d}return!p||h};Ie.__f=!0;var i=Ie.shouldComponentUpdate,s=Ie.componentWillUpdate;Ie.componentWillUpdate=function(a,u,l){if(this.__e){var p=i;i=void 0,o(a,u,l),i=p}s&&s.call(this,a,u,l)},Ie.shouldComponentUpdate=o}return r.__N||r.__}function Ze(e,t){var n=Bu(Io++,3);!Te.__s&&Qg(n.__H,t)&&(n.__=e,n.u=t,Ie.__H.__h.push(n))}function Et(e){return To=5,fn(function(){return{current:e}},[])}function fn(e,t){var n=Bu(Io++,7);return Qg(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ju(e,t){return To=8,fn(function(){return e},t)}function lv(){for(var e;e=Kg.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(vs),t.__h.some(Hu),t.__h=[]}catch(n){t.__h=[],Te.__e(n,e.__v)}}}Te.__b=function(e){Ie=null,Fg&&Fg(e)},Te.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Jg&&Jg(e,t)},Te.__r=function(e){Vg&&Vg(e),Io=0;var t=(Ie=e.__c).__H;t&&(qu===Ie?(t.__h=[],Ie.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(vs),t.__h.some(Hu),t.__h=[],Io=0)),qu=Ie},Te.diffed=function(e){qg&&qg(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Kg.push(t)!==1&&Ug===Te.requestAnimationFrame||((Ug=Te.requestAnimationFrame)||pv)(lv)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),qu=Ie=null},Te.__c=function(e,t){t.some(function(n){try{n.__h.some(vs),n.__h=n.__h.filter(function(r){return!r.__||Hu(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],Te.__e(r,n.__v)}}),Hg&&Hg(e,t)},Te.unmount=function(e){Bg&&Bg(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{vs(r)}catch(o){t=o}}),n.__H=void 0,t&&Te.__e(t,n.__v))};var Wg=typeof requestAnimationFrame=="function";function pv(e){var t,n=function(){clearTimeout(r),Wg&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Wg&&(t=requestAnimationFrame(n))}function vs(e){var t=Ie,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ie=t}function Hu(e){var t=Ie;e.__c=e.__(),Ie=t}function Qg(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Yg(e,t){return typeof t=="function"?t(e):t}function mv(e,t){for(var n in t)e[n]=t[n];return e}function Xg(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function e_(e,t){this.props=e,this.context=t}(e_.prototype=new St).isPureReactComponent=!0,e_.prototype.shouldComponentUpdate=function(e,t){return Xg(this.props,e)||Xg(this.state,t)};var t_=J.__b;J.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),t_&&t_(e)};var AS=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var hv=J.__e;J.__e=function(e,t,n,r){if(e.then){for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k||[]),o.__c(e,t)}hv(e,t,n,r)};var n_=J.unmount;function c_(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=mv({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return c_(r,t,n)})),e}function u_(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return u_(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Wu(){this.__u=0,this.o=null,this.__b=null}function l_(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function ws(){this.i=null,this.l=null}J.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),n_&&n_(e)},(Wu.prototype=new St).__c=function(e,t){var n=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var o=l_(r.__v),i=!1,s=function(){i||r.__z||(i=!0,n.__R=null,o?o(u):u())};n.__R=s;var a=n.__P;n.__P=null;var u=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=u_(l,l.__c.__P,l.__c.__O)}var p;for(r.setState({__a:r.__b=null});p=r.o.pop();)p.__P=a,p.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},Wu.prototype.componentWillUnmount=function(){this.o=[]},Wu.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=c_(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&Co(be,null,e.fallback);return o&&(o.__u&=-33),[Co(be,null,t.__a?null:e.children),o]};var r_=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(ws.prototype=new St).__a=function(e){var t=this,n=l_(t.__v),r=t.l.get(e);return r[0]++,function(o){var i=function(){t.props.revealOrder?(r.push(o),r_(t,e,r)):o()};n?n(i):i()}},ws.prototype.render=function(e){this.i=null,this.l=new Map;var t=Po(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},ws.prototype.componentDidUpdate=ws.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){r_(e,n,t)})};var gv=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,_v=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,yv=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,bv=/[A-Z0-9]/g,vv=typeof document<"u",wv=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function p_(e,t,n){return t.__k==null&&(t.textContent=""),Vu(e,t),typeof n=="function"&&n(),e?e.__c:null}St.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(St.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var o_=J.event;J.event=function(e){return o_&&(e=o_(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var d_,xv={configurable:!0,get:function(){return this.class}},i_=J.vnode;J.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,r=t.type,o={},i=r.indexOf("-")==-1;for(var s in n){var a=n[s];if(!(s==="value"&&"defaultValue"in n&&a==null||vv&&s==="children"&&r==="noscript"||s==="class"||s==="className")){var u=s.toLowerCase();s==="defaultValue"&&"value"in n&&n.value==null?s="value":s==="download"&&a===!0?a="":u==="translate"&&a==="no"?a=!1:u[0]==="o"&&u[1]==="n"?u==="ondoubleclick"?s="ondblclick":u!=="onchange"||r!=="input"&&r!=="textarea"||wv(n.type)?u==="onfocus"?s="onfocusin":u==="onblur"?s="onfocusout":yv.test(s)&&(s=u):u=s="oninput":i&&_v.test(s)?s=s.replace(bv,"-$&").toLowerCase():a===null&&(a=void 0),u==="oninput"&&o[s=u]&&(s="oninputCapture"),o[s]=a}}r=="select"&&(o.multiple&&Array.isArray(o.value)&&(o.value=Po(n.children).forEach(function(l){l.props.selected=o.value.indexOf(l.props.value)!=-1})),o.defaultValue!=null&&(o.value=Po(n.children).forEach(function(l){l.props.selected=o.multiple?o.defaultValue.indexOf(l.props.value)!=-1:o.defaultValue==l.props.value}))),n.class&&!n.className?(o.class=n.class,Object.defineProperty(o,"className",xv)):n.className&&(o.class=o.className=n.className),t.props=o})(e),e.$$typeof=gv,i_&&i_(e)};var s_=J.__r;J.__r=function(e){s_&&s_(e),d_=e.__c};var a_=J.diffed;J.diffed=function(e){a_&&a_(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),d_=null};function f_(e){return!!e.__k&&(Vu(null,e),!0)}function m_(e){return{render:function(t){p_(t,e)},unmount:function(){f_(e)}}}pt();function tc(e){return!!e._zod}function nc(e,t){return tc(e)?Rs(e,t):e.safeParse(t)}function Ly(e){if(!e)return;let t;if(tc(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Uy(e){if(tc(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 n=e._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let r=e.value;if(r!==void 0)return r}Gi();var Pn="io.modelcontextprotocol/related-task",du="2.0",je=Wi(e=>e!==null&&(typeof e=="object"||typeof e=="function")),ib=ue([w(),oe().int()]),sb=w(),gN=qe({ttl:oe().optional(),pollInterval:oe().optional()}),Jk=A({ttl:oe().optional()}),Wk=A({taskId:w()}),Ah=qe({progressToken:ib.optional(),[Pn]:Wk.optional()}),mt=A({_meta:Ah.optional()}),Qi=mt.extend({task:Jk.optional()}),ab=e=>Qi.safeParse(e).success,We=A({method:w(),params:mt.loose().optional()}),vt=A({_meta:Ah.optional()}),wt=A({method:w(),params:vt.loose().optional()}),Ke=qe({_meta:Ah.optional()}),uo=ue([w(),oe().int()]),cb=A({jsonrpc:L(du),id:uo,...We.shape}).strict(),Eh=e=>cb.safeParse(e).success,ub=A({jsonrpc:L(du),...wt.shape}).strict(),lb=e=>ub.safeParse(e).success,Zh=A({jsonrpc:L(du),id:uo,result:Ke}).strict(),Yi=e=>Zh.safeParse(e).success;var se;(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"})(se||(se={}));var Dh=A({jsonrpc:L(du),id:uo.optional(),error:A({code:oe().int(),message:w(),data:ge().optional()})}).strict();var pb=e=>Dh.safeParse(e).success;var db=ue([cb,ub,Zh,Dh]),_N=ue([Zh,Dh]),fu=Ke.strict(),Kk=vt.extend({requestId:uo.optional(),reason:w().optional()}),mu=wt.extend({method:L("notifications/cancelled"),params:Kk}),Gk=A({src:w(),mimeType:w().optional(),sizes:Y(w()).optional(),theme:He(["light","dark"]).optional()}),Xi=A({icons:Y(Gk).optional()}),co=A({name:w(),title:w().optional()}),es=co.extend({...co.shape,...Xi.shape,version:w(),websiteUrl:w().optional(),description:w().optional()}),Qk=_r(A({applyDefaults:Ce().optional()}),me(w(),ge())),Yk=so(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,_r(A({form:Qk.optional(),url:je.optional()}),me(w(),ge()).optional())),Xk=qe({list:je.optional(),cancel:je.optional(),requests:qe({sampling:qe({createMessage:je.optional()}).optional(),elicitation:qe({create:je.optional()}).optional()}).optional()}),e$=qe({list:je.optional(),cancel:je.optional(),requests:qe({tools:qe({call:je.optional()}).optional()}).optional()}),t$=A({experimental:me(w(),je).optional(),sampling:A({context:je.optional(),tools:je.optional()}).optional(),elicitation:Yk.optional(),roots:A({listChanged:Ce().optional()}).optional(),tasks:Xk.optional(),extensions:me(w(),je).optional()}),n$=mt.extend({protocolVersion:w(),capabilities:t$,clientInfo:es}),r$=We.extend({method:L("initialize"),params:n$});var o$=A({experimental:me(w(),je).optional(),logging:je.optional(),completions:je.optional(),prompts:A({listChanged:Ce().optional()}).optional(),resources:A({subscribe:Ce().optional(),listChanged:Ce().optional()}).optional(),tools:A({listChanged:Ce().optional()}).optional(),tasks:e$.optional(),extensions:me(w(),je).optional()}),i$=Ke.extend({protocolVersion:w(),capabilities:o$,serverInfo:es,instructions:w().optional()}),s$=wt.extend({method:L("notifications/initialized"),params:vt.optional()});var lo=We.extend({method:L("ping"),params:mt.optional()}),a$=A({progress:oe(),total:de(oe()),message:de(w())}),c$=A({...vt.shape,...a$.shape,progressToken:ib}),hu=wt.extend({method:L("notifications/progress"),params:c$}),u$=mt.extend({cursor:sb.optional()}),ts=We.extend({params:u$.optional()}),ns=Ke.extend({nextCursor:sb.optional()}),l$=He(["working","input_required","completed","failed","cancelled"]),rs=A({taskId:w(),status:l$,ttl:ue([oe(),Qr()]),createdAt:w(),lastUpdatedAt:w(),pollInterval:de(oe()),statusMessage:de(w())}),gu=Ke.extend({task:rs}),p$=vt.merge(rs),os=wt.extend({method:L("notifications/tasks/status"),params:p$}),_u=We.extend({method:L("tasks/get"),params:mt.extend({taskId:w()})}),yu=Ke.merge(rs),bu=We.extend({method:L("tasks/result"),params:mt.extend({taskId:w()})}),yN=Ke.loose(),vu=ts.extend({method:L("tasks/list")}),wu=ns.extend({tasks:Y(rs)}),xu=We.extend({method:L("tasks/cancel"),params:mt.extend({taskId:w()})}),fb=Ke.merge(rs),mb=A({uri:w(),mimeType:de(w()),_meta:me(w(),ge()).optional()}),hb=mb.extend({text:w()}),Mh=w().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),gb=mb.extend({blob:Mh}),is=He(["user","assistant"]),po=A({audience:Y(is).optional(),priority:oe().min(0).max(1).optional(),lastModified:Cn.datetime({offset:!0}).optional()}),_b=A({...co.shape,...Xi.shape,uri:w(),description:de(w()),mimeType:de(w()),size:de(oe()),annotations:po.optional(),_meta:de(qe({}))}),d$=A({...co.shape,...Xi.shape,uriTemplate:w(),description:de(w()),mimeType:de(w()),annotations:po.optional(),_meta:de(qe({}))}),f$=ts.extend({method:L("resources/list")}),jh=ns.extend({resources:Y(_b)}),m$=ts.extend({method:L("resources/templates/list")}),h$=ns.extend({resourceTemplates:Y(d$)}),Lh=mt.extend({uri:w()}),g$=Lh,_$=We.extend({method:L("resources/read"),params:g$}),Uh=Ke.extend({contents:Y(ue([hb,gb]))}),y$=wt.extend({method:L("notifications/resources/list_changed"),params:vt.optional()}),b$=Lh,v$=We.extend({method:L("resources/subscribe"),params:b$}),w$=Lh,x$=We.extend({method:L("resources/unsubscribe"),params:w$}),k$=vt.extend({uri:w()}),$$=wt.extend({method:L("notifications/resources/updated"),params:k$}),z$=A({name:w(),description:de(w()),required:de(Ce())}),S$=A({...co.shape,...Xi.shape,description:de(w()),arguments:de(Y(z$)),_meta:de(qe({}))}),N$=ts.extend({method:L("prompts/list")}),C$=ns.extend({prompts:Y(S$)}),P$=mt.extend({name:w(),arguments:me(w(),w()).optional()}),I$=We.extend({method:L("prompts/get"),params:P$}),Fh=A({type:L("text"),text:w(),annotations:po.optional(),_meta:me(w(),ge()).optional()}),Vh=A({type:L("image"),data:Mh,mimeType:w(),annotations:po.optional(),_meta:me(w(),ge()).optional()}),qh=A({type:L("audio"),data:Mh,mimeType:w(),annotations:po.optional(),_meta:me(w(),ge()).optional()}),T$=A({type:L("tool_use"),name:w(),id:w(),input:me(w(),ge()),_meta:me(w(),ge()).optional()}),Hh=A({type:L("resource"),resource:ue([hb,gb]),annotations:po.optional(),_meta:me(w(),ge()).optional()}),Bh=_b.extend({type:L("resource_link")}),fo=ue([Fh,Vh,qh,Bh,Hh]),O$=A({role:is,content:fo}),R$=Ke.extend({description:w().optional(),messages:Y(O$)}),A$=wt.extend({method:L("notifications/prompts/list_changed"),params:vt.optional()}),E$=A({title:w().optional(),readOnlyHint:Ce().optional(),destructiveHint:Ce().optional(),idempotentHint:Ce().optional(),openWorldHint:Ce().optional()}),Z$=A({taskSupport:He(["required","optional","forbidden"]).optional()}),ku=A({...co.shape,...Xi.shape,description:w().optional(),inputSchema:A({type:L("object"),properties:me(w(),je).optional(),required:Y(w()).optional()}).catchall(ge()),outputSchema:A({type:L("object"),properties:me(w(),je).optional(),required:Y(w()).optional()}).catchall(ge()).optional(),annotations:E$.optional(),execution:Z$.optional(),_meta:me(w(),ge()).optional()}),Jh=ts.extend({method:L("tools/list")}),D$=ns.extend({tools:Y(ku)}),mo=Ke.extend({content:Y(fo).default([]),structuredContent:me(w(),ge()).optional(),isError:Ce().optional()}),bN=mo.or(Ke.extend({toolResult:ge()})),M$=Qi.extend({name:w(),arguments:me(w(),ge()).optional()}),Wh=We.extend({method:L("tools/call"),params:M$}),j$=wt.extend({method:L("notifications/tools/list_changed"),params:vt.optional()}),vN=A({autoRefresh:Ce().default(!0),debounceMs:oe().int().nonnegative().default(300)}),yb=He(["debug","info","notice","warning","error","critical","alert","emergency"]),L$=mt.extend({level:yb}),U$=We.extend({method:L("logging/setLevel"),params:L$}),F$=vt.extend({level:yb,logger:w().optional(),data:ge()}),V$=wt.extend({method:L("notifications/message"),params:F$}),q$=A({name:w().optional()}),H$=A({hints:Y(q$).optional(),costPriority:oe().min(0).max(1).optional(),speedPriority:oe().min(0).max(1).optional(),intelligencePriority:oe().min(0).max(1).optional()}),B$=A({mode:He(["auto","required","none"]).optional()}),J$=A({type:L("tool_result"),toolUseId:w().describe("The unique identifier for the corresponding tool call."),content:Y(fo).default([]),structuredContent:A({}).loose().optional(),isError:Ce().optional(),_meta:me(w(),ge()).optional()}),W$=to("type",[Fh,Vh,qh]),pu=to("type",[Fh,Vh,qh,T$,J$]),K$=A({role:is,content:ue([pu,Y(pu)]),_meta:me(w(),ge()).optional()}),G$=Qi.extend({messages:Y(K$),modelPreferences:H$.optional(),systemPrompt:w().optional(),includeContext:He(["none","thisServer","allServers"]).optional(),temperature:oe().optional(),maxTokens:oe().int(),stopSequences:Y(w()).optional(),metadata:je.optional(),tools:Y(ku).optional(),toolChoice:B$.optional()}),Q$=We.extend({method:L("sampling/createMessage"),params:G$}),Kh=Ke.extend({model:w(),stopReason:de(He(["endTurn","stopSequence","maxTokens"]).or(w())),role:is,content:W$}),Gh=Ke.extend({model:w(),stopReason:de(He(["endTurn","stopSequence","maxTokens","toolUse"]).or(w())),role:is,content:ue([pu,Y(pu)])}),Y$=A({type:L("boolean"),title:w().optional(),description:w().optional(),default:Ce().optional()}),X$=A({type:L("string"),title:w().optional(),description:w().optional(),minLength:oe().optional(),maxLength:oe().optional(),format:He(["email","uri","date","date-time"]).optional(),default:w().optional()}),ez=A({type:He(["number","integer"]),title:w().optional(),description:w().optional(),minimum:oe().optional(),maximum:oe().optional(),default:oe().optional()}),tz=A({type:L("string"),title:w().optional(),description:w().optional(),enum:Y(w()),default:w().optional()}),nz=A({type:L("string"),title:w().optional(),description:w().optional(),oneOf:Y(A({const:w(),title:w()})),default:w().optional()}),rz=A({type:L("string"),title:w().optional(),description:w().optional(),enum:Y(w()),enumNames:Y(w()).optional(),default:w().optional()}),oz=ue([tz,nz]),iz=A({type:L("array"),title:w().optional(),description:w().optional(),minItems:oe().optional(),maxItems:oe().optional(),items:A({type:L("string"),enum:Y(w())}),default:Y(w()).optional()}),sz=A({type:L("array"),title:w().optional(),description:w().optional(),minItems:oe().optional(),maxItems:oe().optional(),items:A({anyOf:Y(A({const:w(),title:w()}))}),default:Y(w()).optional()}),az=ue([iz,sz]),cz=ue([rz,oz,az]),uz=ue([cz,Y$,X$,ez]),lz=Qi.extend({mode:L("form").optional(),message:w(),requestedSchema:A({type:L("object"),properties:me(w(),uz),required:Y(w()).optional()})}),pz=Qi.extend({mode:L("url"),message:w(),elicitationId:w(),url:w().url()}),dz=ue([lz,pz]),fz=We.extend({method:L("elicitation/create"),params:dz}),mz=vt.extend({elicitationId:w()}),hz=wt.extend({method:L("notifications/elicitation/complete"),params:mz}),gz=Ke.extend({action:He(["accept","decline","cancel"]),content:so(e=>e===null?void 0:e,me(w(),ue([w(),oe(),Ce(),Y(w())])).optional())}),_z=A({type:L("ref/resource"),uri:w()});var yz=A({type:L("ref/prompt"),name:w()}),bz=mt.extend({ref:ue([yz,_z]),argument:A({name:w(),value:w()}),context:A({arguments:me(w(),w()).optional()}).optional()}),vz=We.extend({method:L("completion/complete"),params:bz});var wz=Ke.extend({completion:qe({values:Y(w()).max(100),total:de(oe().int()),hasMore:de(Ce())})}),xz=A({uri:w().startsWith("file://"),name:w().optional(),_meta:me(w(),ge()).optional()}),kz=We.extend({method:L("roots/list"),params:mt.optional()}),$z=Ke.extend({roots:Y(xz)}),zz=wt.extend({method:L("notifications/roots/list_changed"),params:vt.optional()}),wN=ue([lo,r$,vz,U$,I$,N$,f$,m$,_$,v$,x$,Wh,Jh,_u,bu,vu,xu]),xN=ue([mu,hu,s$,zz,os]),kN=ue([fu,Kh,Gh,gz,$z,yu,wu,gu]),$N=ue([lo,Q$,fz,kz,_u,bu,vu,xu]),zN=ue([mu,hu,V$,$$,y$,j$,A$,os,hz]),SN=ue([fu,i$,wz,R$,C$,jh,h$,Uh,mo,D$,yu,wu,gu]),ne=class e extends Error{constructor(t,n,r){super(`MCP error ${t}: ${n}`),this.code=t,this.data=r,this.name="McpError"}static fromError(t,n,r){if(t===se.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new Rh(o.elicitations,n)}return new e(t,n,r)}},Rh=class extends ne{constructor(t,n=`URL elicitation${t.length>1?"s":""} required`){super(se.UrlElicitationRequired,n,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function In(e){return e==="completed"||e==="failed"||e==="cancelled"}var iC=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Qh(e){let n=Ly(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let r=Uy(n);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function Yh(e,t){let n=nc(e,t);if(!n.success)throw n.error;return n.data}var Tz=6e4,$u=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(mu,n=>{this._oncancel(n)}),this.setNotificationHandler(hu,n=>{this._onprogress(n)}),this.setRequestHandler(lo,n=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(_u,async(n,r)=>{let o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new ne(se.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(bu,async(n,r)=>{let o=async()=>{let i=n.params.taskId;if(!await this._taskStore.getTask(i,r.sessionId))throw new ne(se.InvalidParams,`Task not found: ${i}`);if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(i,r.sessionId);){if(a.type==="response"||a.type==="error"){let u=a.message,l=u.id,p=this._requestResolvers.get(l);if(p)if(this._requestResolvers.delete(l),a.type==="response")p(u);else{let h=u,d=new ne(h.error.code,h.error.message,h.error.data);p(d)}else{let h=a.type==="response"?"Response":"Error";this._onerror(new Error(`${h} handler missing for request ${l}`))}continue}await this._transport?.send(a.message,{relatedRequestId:r.requestId})}}let s=await this._taskStore.getTask(i,r.sessionId);if(!s)throw new ne(se.InvalidParams,`Task not found: ${i}`);if(!In(s.status))return await this._waitForTaskUpdate(i,r.signal,r.sessionId),await o();if(In(s.status)){let a=await this._taskStore.getTaskResult(i,r.sessionId);return this._clearTaskQueue(i,r.sessionId),{...a,_meta:{...a._meta,[Pn]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(vu,async(n,r)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(n.params?.cursor,r.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new ne(se.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(xu,async(n,r)=>{try{let o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new ne(se.InvalidParams,`Task not found: ${n.params.taskId}`);if(In(o.status))throw new ne(se.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(n.params.taskId,r.sessionId);let i=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!i)throw new ne(se.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof ne?o:new ne(se.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,n,r,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let n=this._timeoutInfo.get(t);if(!n)return!1;let r=Date.now()-n.startTime;if(n.maxTotalTimeout&&r>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),ne.fromError(se.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:r});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(t){let n=this._timeoutInfo.get(t);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let n=this.transport?.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=i=>{r?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,s)=>{o?.(i,s),Yi(i)||pb(i)?this._onresponse(i):Eh(i)?this._onrequest(i,s):lb(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 r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let n=ne.fromError(se.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of t.values())r(n)}_onerror(t){this.onerror?.(t)}_onnotification(t){let n=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(t,n){let r=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[Pn]?.taskId,s=o?.sessionId,a=this._taskStore,u=!0,l;if(i&&a&&this._taskMessageQueue&&s!==void 0&&(u=!1,l=(async()=>{if(!await a.getTask(i,s))throw new ne(se.InvalidParams,`Task not found: ${i}`);u=!0})()),r===void 0){let g={jsonrpc:"2.0",id:t.id,error:{code:se.MethodNotFound,message:"Method not found"}};if(i&&l){let b={type:"error",message:g,timestamp:Date.now()};l.then(()=>this._enqueueTaskMessage(i,b,s),()=>o?.send(g)).catch(x=>this._onerror(new Error(`Failed to send an error response: ${x}`)))}else i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:g,timestamp:Date.now()},o?.sessionId).catch(b=>this._onerror(new Error(`Failed to enqueue error response: ${b}`))):o?.send(g).catch(b=>this._onerror(new Error(`Failed to send an error response: ${b}`)));return}let p=new AbortController;this._requestHandlerAbortControllers.set(t.id,p);let h=ab(t.params)?t.params.task:void 0,d=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,f={signal:p.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async g=>{if(p.signal.aborted)return;let b={relatedRequestId:t.id};i&&(b.relatedTask={taskId:i}),await this.notification(g,b)},sendRequest:async(g,b,x)=>{if(p.signal.aborted)throw new ne(se.ConnectionClosed,"Request was cancelled");let k={...x,relatedRequestId:t.id};i&&!k.relatedTask&&(k.relatedTask={taskId:i});let v=k.relatedTask?.taskId??i;return v&&d&&await d.updateTaskStatus(v,"input_required"),await this.request(g,b,k)},authInfo:n?.authInfo,requestId:t.id,requestInfo:n?.requestInfo,taskId:i,taskStore:d,taskRequestedTtl:h?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};(l??Promise.resolve()).then(()=>{if(l&&p.signal.aborted)throw new ne(se.ConnectionClosed,"Request was cancelled");h&&this.assertTaskHandlerCapability(t.method)}).then(()=>r(t,f)).then(async g=>{if(p.signal.aborted)return;let b={result:g,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:b,timestamp:Date.now()},o?.sessionId):await o?.send(b)},async g=>{if(p.signal.aborted)return;let b={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(g.code)?g.code:se.InternalError,message:g.message??"Internal error",...g.data!==void 0&&{data:g.data}}};i&&this._taskMessageQueue&&u?await this._enqueueTaskMessage(i,{type:"error",message:b,timestamp:Date.now()},o?.sessionId):await o?.send(b)}).catch(g=>this._onerror(new Error(`Failed to send response: ${g}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===p&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:n,...r}=t.params,o=Number(n),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let s=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(u){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(u);return}i(r)}_onresponse(t){let n=Number(t.id),r=this._requestResolvers.get(n);if(r){if(this._requestResolvers.delete(n),Yi(t))r(t);else{let s=new ne(t.error.code,t.error.message,t.error.data);r(s)}return}let o=this._responseHandlers.get(n);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let i=!1;if(Yi(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,n))}}if(i||this._progressHandlers.delete(n),Yi(t))o(t);else{let s=ne.fromError(t.error.code,t.error.message,t.error.data);o(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,n,r){let{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(t,n,r)}}catch(s){yield{type:"error",error:s instanceof ne?s:new ne(se.InternalError,String(s))}}return}let i;try{let s=await this.request(t,gu,r);if(s.task)i=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new ne(se.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:i},r);if(yield{type:"taskStatus",task:a},In(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},n,r)}:a.status==="failed"?yield{type:"error",error:new ne(se.InternalError,`Task ${i} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new ne(se.InternalError,`Task ${i} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},n,r)};return}let u=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,u)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof ne?s:new ne(se.InternalError,String(s))}}}request(t,n,r){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:u}=r??{};return new Promise((l,p)=>{let h=v=>{p(v)};if(!this._transport){h(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(v){h(v);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:d};r?.onprogress&&(this._progressHandlers.set(d,r.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:d}}),a&&(f.params={...f.params,task:a}),u&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Pn]:u}});let g=v=>{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(v)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(T=>this._onerror(new Error(`Failed to send cancellation: ${T}`)));let N=v instanceof ne?v:new ne(se.RequestTimeout,String(v));p(N)};this._responseHandlers.set(d,v=>{if(!r?.signal?.aborted){if(v instanceof Error)return p(v);try{let N=nc(n,v.result);N.success?l(N.data):p(N.error)}catch(N){p(N)}}}),r?.signal?.addEventListener("abort",()=>{g(r?.signal?.reason)});let b=r?.timeout??Tz,x=()=>g(ne.fromError(se.RequestTimeout,"Request timed out",{timeout:b}));this._setupTimeout(d,b,r?.maxTotalTimeout,x,r?.resetTimeoutOnProgress??!1);let k=u?.taskId;if(k){let v=N=>{let T=this._responseHandlers.get(d);T?T(N):this._onerror(new Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,v),this._enqueueTaskMessage(k,{type:"request",message:f,timestamp:Date.now()}).catch(N=>{this._cleanupTimeout(d),p(N)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(v=>{this._cleanupTimeout(d),p(v)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},yu,n)}async getTaskResult(t,n,r){return this.request({method:"tasks/result",params:t},n,r)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},wu,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},fb,n)}async notification(t,n){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let r=n?.relatedTask?.taskId;if(r){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Pn]:n.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!n?.relatedRequestId&&!n?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};n?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Pn]:n.relatedTask}}}),this._transport?.send(a,n).catch(u=>this._onerror(u))});return}let s={...t,jsonrpc:"2.0"};n?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Pn]:n.relatedTask}}}),await this._transport.send(s,n)}setRequestHandler(t,n){let r=Qh(t);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,i)=>{let s=Yh(t,o);return Promise.resolve(n(s,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,n){let r=Qh(t);this._notificationHandlers.set(r,o=>{let i=Yh(t,o);return Promise.resolve(n(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let n=this._taskProgressTokens.get(t);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,n,r){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,r??this._transport?.sessionId,o)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(t,n);for(let o of r)if(o.type==="request"&&Eh(o.message)){let i=o.message.id,s=this._requestResolvers.get(i);s?(s(new ne(se.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(t,r);i?.pollInterval&&(o=i.pollInterval)}catch{}return new Promise((i,s)=>{if(n.aborted){s(new ne(se.InvalidRequest,"Request cancelled"));return}let a=setTimeout(i,o);n.addEventListener("abort",()=>{clearTimeout(a),s(new ne(se.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){let r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await r.createTask(o,t.id,{method:t.method,params:t.params},n)},getTask:async o=>{let i=await r.getTask(o,n);if(!i)throw new ne(se.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,s)=>{await r.storeTaskResult(o,i,s,n);let a=await r.getTask(o,n);if(a){let u=os.parse({method:"notifications/tasks/status",params:a});await this.notification(u),In(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>r.getTaskResult(o,n),updateTaskStatus:async(o,i,s)=>{let a=await r.getTask(o,n);if(!a)throw new ne(se.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(In(a.status))throw new ne(se.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,i,s,n);let u=await r.getTask(o,n);if(u){let l=os.parse({method:"notifications/tasks/status",params:u});await this.notification(l),In(u.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>r.listTasks(o,n)}}};function bb(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function vb(e,t){let n={...e};for(let r in t){let o=r,i=t[o];if(i===void 0)continue;let s=n[o];bb(s)&&bb(i)?n[o]={...s,...i}:n[o]=i}return n}Gi();Gi();var oT=(e=>typeof Zn<"u"?Zn:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof Zn<"u"?Zn:t)[n]}):e)(function(e){if(typeof Zn<"u")return Zn.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Xh=class extends $u{_registeredMethods=new Set;_eventSlots=new Map;onEventDispatch(t,n){}_ensureEventSlot(t){let n=this._eventSlots.get(t);if(!n){let r=this.eventSchemas[t];if(!r)throw Error(`Unknown event: ${String(t)}`);n={listeners:[]},this._eventSlots.set(t,n);let o=r.shape.method.value;this._registeredMethods.add(o);let i=n;super.setNotificationHandler(r,s=>{let a=s.params;this.onEventDispatch(t,a),i.onHandler?.(a);for(let u of[...i.listeners])u(a)})}return n}setEventHandler(t,n){let r=this._ensureEventSlot(t);r.onHandler&&n&&console.warn(`[MCP Apps] on${String(t)} handler replaced. Use addEventListener("${String(t)}", \u2026) to add multiple listeners without replacing.`),r.onHandler=n}getEventHandler(t){return this._eventSlots.get(t)?.onHandler}addEventListener(t,n){this._ensureEventSlot(t).listeners.push(n)}removeEventListener(t,n){let r=this._eventSlots.get(t);if(!r)return;let o=r.listeners.indexOf(n);o!==-1&&r.listeners.splice(o,1)}setRequestHandler=(t,n)=>{this._assertMethodNotRegistered(t,"setRequestHandler"),super.setRequestHandler(t,n)};setNotificationHandler=(t,n)=>{this._assertMethodNotRegistered(t,"setNotificationHandler"),super.setNotificationHandler(t,n)};warnIfRequestHandlerReplaced(t,n,r){n&&r&&console.warn(`[MCP Apps] ${t} handler replaced. Previous handler will no longer be called.`)}replaceRequestHandler=(t,n)=>{let r=t.shape.method.value;this._registeredMethods.add(r),super.setRequestHandler(t,n)};_assertMethodNotRegistered(t,n){let r=t.shape.method.value;if(this._registeredMethods.has(r))throw Error(`Handler for "${r}" already registered (via ${n}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._registeredMethods.add(r)}},Oz="2026-01-26";var Rz="ui/notifications/tool-input-partial";var eg=class{eventTarget;eventSource;messageListener;constructor(t=window.parent,n){this.eventTarget=t,this.eventSource=n,this.messageListener=r=>{if(n&&r.source!==this.eventSource){console.debug("Ignoring message from unknown source",r);return}let o=db.safeParse(r.data);o.success?(console.debug("Parsed message",o.data),this.onmessage?.(o.data)):r.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",o.error.message,r):(console.error("Failed to parse message",o.error.message,r),this.onerror?.(Error("Invalid JSON-RPC message received: "+o.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,n){t.method!==Rz&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},Az=m.union([m.literal("light"),m.literal("dark")]).describe("Color theme preference for the host environment."),as=m.union([m.literal("inline"),m.literal("fullscreen"),m.literal("pip")]).describe("Display mode for UI presentation."),Ez=m.union([m.literal("--color-background-primary"),m.literal("--color-background-secondary"),m.literal("--color-background-tertiary"),m.literal("--color-background-inverse"),m.literal("--color-background-ghost"),m.literal("--color-background-info"),m.literal("--color-background-danger"),m.literal("--color-background-success"),m.literal("--color-background-warning"),m.literal("--color-background-disabled"),m.literal("--color-text-primary"),m.literal("--color-text-secondary"),m.literal("--color-text-tertiary"),m.literal("--color-text-inverse"),m.literal("--color-text-ghost"),m.literal("--color-text-info"),m.literal("--color-text-danger"),m.literal("--color-text-success"),m.literal("--color-text-warning"),m.literal("--color-text-disabled"),m.literal("--color-border-primary"),m.literal("--color-border-secondary"),m.literal("--color-border-tertiary"),m.literal("--color-border-inverse"),m.literal("--color-border-ghost"),m.literal("--color-border-info"),m.literal("--color-border-danger"),m.literal("--color-border-success"),m.literal("--color-border-warning"),m.literal("--color-border-disabled"),m.literal("--color-ring-primary"),m.literal("--color-ring-secondary"),m.literal("--color-ring-inverse"),m.literal("--color-ring-info"),m.literal("--color-ring-danger"),m.literal("--color-ring-success"),m.literal("--color-ring-warning"),m.literal("--font-sans"),m.literal("--font-mono"),m.literal("--font-weight-normal"),m.literal("--font-weight-medium"),m.literal("--font-weight-semibold"),m.literal("--font-weight-bold"),m.literal("--font-text-xs-size"),m.literal("--font-text-sm-size"),m.literal("--font-text-md-size"),m.literal("--font-text-lg-size"),m.literal("--font-heading-xs-size"),m.literal("--font-heading-sm-size"),m.literal("--font-heading-md-size"),m.literal("--font-heading-lg-size"),m.literal("--font-heading-xl-size"),m.literal("--font-heading-2xl-size"),m.literal("--font-heading-3xl-size"),m.literal("--font-text-xs-line-height"),m.literal("--font-text-sm-line-height"),m.literal("--font-text-md-line-height"),m.literal("--font-text-lg-line-height"),m.literal("--font-heading-xs-line-height"),m.literal("--font-heading-sm-line-height"),m.literal("--font-heading-md-line-height"),m.literal("--font-heading-lg-line-height"),m.literal("--font-heading-xl-line-height"),m.literal("--font-heading-2xl-line-height"),m.literal("--font-heading-3xl-line-height"),m.literal("--border-radius-xs"),m.literal("--border-radius-sm"),m.literal("--border-radius-md"),m.literal("--border-radius-lg"),m.literal("--border-radius-xl"),m.literal("--border-radius-full"),m.literal("--border-width-regular"),m.literal("--shadow-hairline"),m.literal("--shadow-sm"),m.literal("--shadow-md"),m.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Zz=m.record(Ez.describe(`Style variables for theming MCP apps.
76
+
77
+ Individual style keys are optional - hosts may provide any subset of these values.
78
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
79
+
80
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
81
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),m.union([m.string(),m.undefined()]).describe(`Style variables for theming MCP apps.
82
+
83
+ Individual style keys are optional - hosts may provide any subset of these values.
84
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
85
+
86
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
87
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
88
+
89
+ Individual style keys are optional - hosts may provide any subset of these values.
90
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
91
+
92
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
93
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),pT=m.object({method:m.literal("ui/open-link"),params:m.object({url:m.string().describe("URL to open in the host's browser")})}),Dz=m.object({isError:m.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),Mz=m.object({isError:m.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),jz=m.object({isError:m.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),dT=m.object({method:m.literal("ui/notifications/sandbox-proxy-ready"),params:m.object({})}),tg=m.object({connectDomains:m.array(m.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
94
+
95
+ - Maps to CSP \`connect-src\` directive
96
+ - Empty or omitted \u2192 no network connections (secure default)`),resourceDomains:m.array(m.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:m.array(m.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:m.array(m.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'`)")}),ng=m.object({camera:m.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:m.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:m.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:m.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),fT=m.object({method:m.literal("ui/notifications/size-changed"),params:m.object({width:m.number().optional().describe("New width in pixels."),height:m.number().optional().describe("New height in pixels.")})}),Lz=m.object({method:m.literal("ui/notifications/tool-input"),params:m.object({arguments:m.record(m.string(),m.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),Uz=m.object({method:m.literal("ui/notifications/tool-input-partial"),params:m.object({arguments:m.record(m.string(),m.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),Fz=m.object({method:m.literal("ui/notifications/tool-cancelled"),params:m.object({reason:m.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),Vz=m.object({fonts:m.string().optional()}),qz=m.object({variables:Zz.optional().describe("CSS variables for theming the app."),css:Vz.optional().describe("CSS blocks that apps can inject.")}),Hz=m.object({method:m.literal("ui/resource-teardown"),params:m.object({})}),mT=m.record(m.string(),m.unknown()),wb=m.object({text:m.object({}).optional().describe("Host supports text content blocks."),image:m.object({}).optional().describe("Host supports image content blocks."),audio:m.object({}).optional().describe("Host supports audio content blocks."),resource:m.object({}).optional().describe("Host supports resource content blocks."),resourceLink:m.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:m.object({}).optional().describe("Host supports structured content.")}),hT=m.object({method:m.literal("ui/notifications/request-teardown"),params:m.object({}).optional()}),Bz=m.object({experimental:m.record(m.string(),m.record(m.string(),m.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:m.object({}).optional().describe("Host supports opening external URLs."),downloadFile:m.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:m.object({listChanged:m.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:m.object({listChanged:m.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:m.object({}).optional().describe("Host accepts log messages."),sandbox:m.object({permissions:ng.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:tg.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:wb.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:wb.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:m.object({tools:m.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.")}),Jz=m.object({experimental:m.record(m.string(),m.record(m.string(),m.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:m.object({listChanged:m.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:m.array(as).optional().describe("Display modes the app supports.")}),gT=m.object({method:m.literal("ui/notifications/initialized"),params:m.object({}).optional()}),_T=m.object({csp:tg.optional().describe("Content Security Policy configuration for UI resources."),permissions:ng.optional().describe("Sandbox permissions requested by the UI resource."),domain:m.string().optional().describe(`Dedicated origin for view sandbox.
97
+
98
+ Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
99
+
100
+ **Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
101
+ - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
102
+ - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
103
+
104
+ If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:m.boolean().optional().describe(`Visual boundary preference - true if view prefers a visible border.
105
+
106
+ Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
107
+
108
+ - \`true\`: request visible border + background
109
+ - \`false\`: request no visible border + background
110
+ - omitted: host decides border`)}),yT=m.object({method:m.literal("ui/request-display-mode"),params:m.object({mode:as.describe("The display mode being requested.")})}),Wz=m.object({mode:as.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),Kz=m.union([m.literal("model"),m.literal("app")]).describe("Tool visibility scope - who can access the tool."),bT=m.object({resourceUri:m.string().optional(),visibility:m.array(Kz).optional().describe(`Who can access this tool. Default: ["model", "app"]
111
+ - "model": Tool visible to and callable by the agent
112
+ - "app": Tool callable by the app from this server only`),csp:m.never().optional(),permissions:m.never().optional()}),vT=m.object({mimeTypes:m.array(m.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),wT=m.object({method:m.literal("ui/download-file"),params:m.object({contents:m.array(m.union([Hh,Bh])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),xT=m.object({method:m.literal("ui/message"),params:m.object({role:m.literal("user").describe('Message role, currently only "user" is supported.'),content:m.array(fo).describe("Message content blocks (text, image, etc.).")})}),kT=m.object({method:m.literal("ui/notifications/sandbox-resource-ready"),params:m.object({html:m.string().describe("HTML content to load into the inner iframe."),sandbox:m.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:tg.optional().describe("CSP configuration from resource metadata."),permissions:ng.optional().describe("Sandbox permissions from resource metadata.")})}),Gz=m.object({method:m.literal("ui/notifications/tool-result"),params:mo.describe("Standard MCP tool execution result.")}),$b=m.object({toolInfo:m.object({id:uo.optional().describe("JSON-RPC id of the tools/call request."),tool:ku.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Az.optional().describe("Current color theme preference."),styles:qz.optional().describe("Style configuration for theming the app."),displayMode:as.optional().describe("How the UI is currently displayed."),availableDisplayModes:m.array(as).optional().describe("Display modes the host supports."),containerDimensions:m.union([m.object({height:m.number().describe("Fixed container height in pixels.")}),m.object({maxHeight:m.union([m.number(),m.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(m.union([m.object({width:m.number().describe("Fixed container width in pixels.")}),m.object({maxWidth:m.union([m.number(),m.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
113
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:m.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:m.string().optional().describe("User's timezone in IANA format."),userAgent:m.string().optional().describe("Host application identifier."),platform:m.union([m.literal("web"),m.literal("desktop"),m.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:m.object({touch:m.boolean().optional().describe("Whether the device supports touch input."),hover:m.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:m.object({top:m.number().describe("Top safe area inset in pixels."),right:m.number().describe("Right safe area inset in pixels."),bottom:m.number().describe("Bottom safe area inset in pixels."),left:m.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),Qz=m.object({method:m.literal("ui/notifications/host-context-changed"),params:$b.describe("Partial context update containing only changed fields.")}),$T=m.object({method:m.literal("ui/update-model-context"),params:m.object({content:m.array(fo).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:m.record(m.string(),m.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),zT=m.object({method:m.literal("ui/initialize"),params:m.object({appInfo:es.describe("App identification (name and version)."),appCapabilities:Jz.describe("Features and capabilities this app provides."),protocolVersion:m.string().describe("Protocol version this app supports.")})}),Yz=m.object({protocolVersion:m.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:es.describe("Host application identification and version."),hostCapabilities:Bz.describe("Features and capabilities provided by the host."),hostContext:$b.describe("Rich context about the host environment.")}).passthrough(),Xz={target:"draft-2020-12"};async function xb(e,t){let n=e["~standard"];if(n.jsonSchema)return n.jsonSchema[t](Xz);if(n.vendor==="zod"){let{z:r}=await Promise.resolve().then(()=>(Gi(),Oh));return r.toJSONSchema(e,{io:t})}throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function kb(e,t,n=""){let r=await e["~standard"].validate(t);if(r.issues){let o=r.issues.map(i=>{let s=i.path?.map(a=>typeof a=="object"?a.key:a).join(".");return s?`${s}: ${i.message}`:i.message}).join("; ");throw Error(n+o)}return r.value}function zb(e){let t=document.documentElement;t.setAttribute("data-theme",e),t.style.colorScheme=e}function Sb(e,t=document.documentElement){for(let[n,r]of Object.entries(e))r!==void 0&&t.style.setProperty(n,r)}var zu=class e extends Xh{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_assertInitialized(t){if(this._initializedSent)return;let n=`[ext-apps] App.${t}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(n);console.warn(`${n}. This will throw in a future release.`)}eventSchemas={toolinput:Lz,toolinputpartial:Uz,toolresult:Gz,toolcancelled:Fz,hostcontextchanged:Qz};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 n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(t,n){n&&this._assertHandlerTiming(t),super.setEventHandler(t,n)}addEventListener(t,n){this._assertHandlerTiming(t),super.addEventListener(t,n)}onEventDispatch(t,n){t==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...n})}constructor(t,n={},r={autoResize:!0}){super(r),this._appInfo=t,this._capabilities=n,this.options=r,r.allowUnsafeEval||m.config({jitless:!0}),this.setRequestHandler(lo,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=vb(this._capabilities,t)}registerTool(t,n,r){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let o=this,i=()=>{o._initializedSent&&o._capabilities.tools?.listChanged&&o.sendToolListChanged()},s=n.inputSchema!==void 0,a={title:n.title,description:n.description,inputSchema:n.inputSchema,outputSchema:n.outputSchema,annotations:n.annotations,_meta:n._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(u){Object.assign(this,u),i()},remove(){o._registeredTools[t]===a&&(delete o._registeredTools[t],i())},handler:async(u,l)=>{if(!a.enabled)throw Error(`Tool ${t} is disabled`);let p;if(s){let h=a.inputSchema,d=h?await kb(h,u??{},`Invalid input for tool ${t}: `):u??{};p=await r(d,l)}else p=await r(l);return a.outputSchema&&!p.isError&&(p.structuredContent=await kb(a.outputSchema,p.structuredContent,`Invalid output for tool ${t}: `)),p}};return this._registeredTools[t]=a,!this._capabilities.tools&&!this.transport&&this.registerCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),a}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(t,n)=>{let r=this._registeredTools[t.name];if(!r)throw Error(`Tool ${t.name} not found`);return r.handler(t.arguments,n)},this.onlisttools=async(t,n)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([r,o])=>o.enabled).map(async([r,o])=>{let i={name:r,title:o.title,description:o.description,inputSchema:o.inputSchema?await xb(o.inputSchema,"input"):{type:"object",properties:{}}};return o.outputSchema&&(i.outputSchema=await xb(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(Hz,(n,r)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(n.params,r)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(t){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,t),this._oncalltool=t,this.replaceRequestHandler(Wh,(n,r)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(n.params,r)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(t){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,t),this._onlisttools=t,this.replaceRequestHandler(Jh,(n,r)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(n.params,r)})}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${t})`);break}}assertRequestHandlerCapability(t){switch(t){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${t})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${t} registered`)}}assertNotificationCapability(t){}assertTaskCapability(t){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(t){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(t,n){if(this._assertInitialized("callServerTool"),typeof t=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${t}"). Did you mean: callServerTool({ name: "${t}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:t},mo,{onprogress:()=>{},resetTimeoutOnProgress:!0,...n})}async readServerResource(t,n){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:t},Uh,n)}async listServerResources(t,n){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:t},jh,n)}async createSamplingMessage(t,n){this._assertInitialized("createSamplingMessage");let r=t.tools?Gh:Kh;return await this.request({method:"sampling/createMessage",params:t},r,n)}sendMessage(t,n){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:t},jz,n)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,n){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:t},fu,n)}openLink(t,n){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:t},Dz,n)}sendOpenLink=this.openLink;downloadFile(t,n){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:t},Mz,n)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,n){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:t},Wz,n)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,n=0,r=0,o=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let s=document.documentElement,a=s.style.height;s.style.height="max-content";let u=Math.ceil(s.getBoundingClientRect().height);s.style.height=a;let l=Math.ceil(window.innerWidth);(l!==n||u!==r)&&(n=l,r=u,this.sendSizeChanged({width:l,height:u}))}))};o();let i=new ResizeObserver(o);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(t=new eg(window.parent,window.parent),n){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1,await super.connect(t);try{let r=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Oz}},Yz,n);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);this._hostCapabilities=r.hostCapabilities,this._hostInfo=r.hostInfo,this._hostContext=r.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(r){throw this.close(),r}}};var eS=/^[a-z0-9][a-z0-9-]{0,62}$/,Se=(e,t)=>e.length>t?`${e.slice(0,t-1)}\u2026`:e,Nb=(e,t)=>e.length>t?`\u2026${e.slice(e.length-t+1)}`:e,sn=(e,t)=>{let n=Math.max(0,(t-Date.parse(e))/1e3);return n<60?"just now":n<3600?`${Math.round(n/60)}m ago`:n<86400?`${Math.round(n/3600)}h ago`:`${Math.round(n/86400)}d ago`},we=(e,t)=>typeof e.props[t]=="string"?e.props[t]:"";function Cb(e,t){let n=new Map(e.map(a=>[a.id,a])),r=a=>!!a&&!a.ended,o=new Set(t.filter(a=>a.type==="REPLACES"&&r(n.get(a.source))).map(a=>a.target)),i=a=>r(a)&&a.label==="Claim"&&!o.has(a.id),s=e.filter(a=>a.label==="Question"&&!a.ended).map(a=>({q:a,replies:t.filter(u=>u.type==="REPLIES_TO"&&u.target===a.id).map(u=>n.get(u.source)).filter(r).sort((u,l)=>Date.parse(we(u,"recorded_at"))-Date.parse(we(l,"recorded_at"))),answers:t.filter(u=>u.type==="ANSWERS"&&u.target===a.id).map(u=>n.get(u.source)).filter(i)}));return{open:s.filter(a=>!a.answers.length),answered:s.filter(a=>a.answers.length),claims:e.filter(i),withdrawn:e.filter(a=>a.ended).length}}function Pb(e,t){let n=new Map(e.map(d=>[d.id,d])),r=new Map(e.map(d=>[d.key,d])),o=d=>!!d&&!d.ended,i=new Map;for(let d of t){let f=n.get(d.source);d.type==="REPLACES"&&o(f)&&i.set(d.target,f)}let s=d=>o(d)&&d.label==="Claim"&&!i.has(d.id),a=(d,f,g)=>t.filter(b=>b.type===f&&(g==="out"?b.source:b.target)===d).map(b=>n.get(g==="out"?b.target:b.source)).filter(b=>!!b),u=new Map;for(let d of t){if(d.type!=="CONTRADICTS")continue;let f=n.get(d.source),g=n.get(d.target);s(f)&&s(g)&&u.set([f.id,g.id].sort().join("|"),[f,g])}let l=[...u.values()],p=new Set(l.flatMap(([d,f])=>[d.id,f.id])),h=e.filter(d=>d.label==="Claim"&&!s(d));return{byId:n,byKey:r,replacedBy:i,current:s,linked:a,conflicts:l,inConflict:p,history:h}}var tS=5;function rg(e,t,n,r){let o=e.filter(n),i=new Set;if(!r?.length)return{list:o,byMeaning:i};let s=new Set(o.map(t)),a=new Map(e.map(u=>[t(u),u]));for(let u of r){if(i.size>=tS)break;let l=a.get(u);l!==void 0&&!s.has(u)&&(i.add(u),o.push(l))}return{list:o,byMeaning:i}}var Ib=e=>(Array.isArray(e)?e:[]).map(t=>t?.id).filter(t=>typeof t=="string");function yr(e,t){let n=t.toLowerCase().split(/\s+/).filter(Boolean);if(!n.length)return!0;let r=`${e.title} ${we(e,"recorded_by")} ${we(e,"source")} ${e.key}`.toLowerCase();return n.every(o=>r.includes(o))}function an(e,t){let n=a=>typeof t[a]=="string"&&t[a]?String(t[a]):"",r=n("name"),o=n("context"),i=o?` in the context '${o}'`:"",s=o?` the context '${o}'`:" this chat's context";switch(e){case"explore_context":return n("at")?`Open the context explorer as it was at ${n("at")}.`:"Open the context explorer.";case"open_console":return"Open the Vine console.";case"open_contexts":return"Open this chat's contexts.";case"use_context":return n("description")?`Create a context called '${r}' and use it in this chat. It's for: ${n("description")}`:`Use the context '${r}' in this chat.`;case"add_context":return n("description")?`Create a context called '${r}' and add it to this chat. It's for: ${n("description")}`:t.write_here?`Record new items in the context '${r}' unless another of this chat's contexts fits better.`:`Add the context '${r}' to this chat.`;case"remove_context":return`Stop using the context '${r}' in this chat.`;case"link_folder":return t.off?`Stop starting new chats in this folder with the context '${r}'.`:`Start new chats in this folder with the context '${r}'.`;case"describe_context":return`Change the description of${s} to: ${n("description")}`;case"delete_context":return`Delete this machine's copy of the context '${r}' for good. I typed its name to confirm.`;case"set_my_name":return`Change my name in Vine Context to '${r}'.`;case"share_context":return`Make a join code${n("label")?` for ${n("label")}`:""}${n("role")?` with the role ${n("role")}`:""}${i}.`;case"revoke_invite":return`Cancel the join code ${n("id")}${i}.`;case"set_peer_role":return`Change ${r}'s role to ${n("role")}${i}.`;case"remove_peer":return`Remove ${r} from${s}.`;case"start_sharing":return`Go back online with${s}.`;case"stop_sharing":return`Go offline with${s}.`;case"take_back":return`Take back the change ${n("id")}${i}, before it's sent to the other members.`;case"withdraw":return`Withdraw ${n("id")}${i}.`;default:return`Run the Vine Context tool ${e}${Object.keys(t).length?` with ${JSON.stringify(t)}`:""}.`}}var ho={catchUp:e=>`Catch me up on the context '${e}': what changed lately and who changed it, which questions are still open, and any claims that contradict each other. Keep it short, and end with what needs me.`,saveChat:e=>`Record what we've learned in this chat in the context '${e}'. Search it first, so you link to what's already there instead of repeating it. Add a claim for each finding and a question for each thing we still don't know, then tell me what you recorded, with the ids.`,investigate:(e,t)=>`Look into the open question ${e.key} ("${Se(e.title,200)}")${t?` in the context '${t}'`:""}. Search the context for what's already known about it, find out what you can, and reply on its thread with what you find. If that settles it, record a claim that answers it.`,correct:(e,t,n)=>`The claim ${e.key} ("${Se(e.title,200)}")${n?` in the context '${n}'`:""} is wrong or out of date. What's right: ${t}
114
+
115
+ Record it: paraphrase it as a claim that stands alone, and add it with replaces: [${e.key}]${n?` (context: ${n})`:""}.`,settle:(e,t,n)=>`The claims ${e.key} ("${Se(e.title,200)}") and ${t.key} ("${Se(t.title,200)}") contradict each other${n?` in the context '${n}'`:""}. ${e.key} is the one that's right.
116
+
117
+ Settle it so only one stands: withdraw ${t.key} with that as the reason if you may, otherwise record a claim that replaces it (replaces: [${t.key}])${n?` (context: ${n})`:""}. Then tell me what you did.`};function og(e,t,n){let r=`the open question ${e.key} ("${Se(e.title,200)}")${n?` in the context '${n}'`:""}`,o=n?` (context: ${n})`:"";if("text"in t)return`My answer to ${r}: ${t.text}
118
+
119
+ Record it: paraphrase it as a claim that stands alone, and add it with answers: [${e.key}]${o}.`;let i=t.reply;return`Answer ${r} with ${we(i,"recorded_by")||"its"}'s reply ${i.key}: "${Se(i.title,400)}"
120
+
121
+ Paraphrase it as a claim that stands alone and record it with answers: [${e.key}], with source "reply ${i.key}"${o}.`}function Tb(e,t,n){return e?eS.test(e)?n.includes(e)?`There's already a context '${e}' on this machine: turn it on in the list.`:t.trim()?null:"Say what it\u2019s for: every member\u2019s agent reads that to decide what belongs there.":'A context name is lower-case letters, digits and dashes, such as "checkout-incident".':"Give it a name."}var ig=e=>`Join my context graph: /vine-context:join ${e}`;function sg(e){if(e.structuredContent!==void 0)return e.structuredContent;let t=e.content?.find(n=>n.type==="text")?.text??"";try{return JSON.parse(t)}catch{return t}}function Ob(e){e&&(e.theme&&zb(e.theme),e.styles?.variables&&Sb(e.styles.variables))}var Ot=class extends Error{},nS=/IPC not available|-32601|method not found|not supported|serverTools/i;function Rb(){let[e,t]=j(),[n,r]=j(!0);if(Ze(()=>{let a=new zu({name:"vine-context",version:"1"},{availableDisplayModes:["inline","fullscreen","pip"]},{autoResize:!0});a.ontoolinput=u=>t(l=>l&&"app"in l?{...l,input:u.arguments}:l),a.ontoolresult=u=>t(l=>{if(!l||!("app"in l))return l;let p=u;return p.isError?{...l,failed:String(sg(p))}:{...l,data:sg(p),failed:void 0}}),a.onhostcontextchanged=u=>Ob(u),t({app:a}),a.connect().then(()=>{Ob(a.getHostContext()),a.getHostCapabilities()?.serverTools||r(!1)}).catch(u=>t({error:`Couldn't connect to the host: ${u.message}`}))},[]),!e||"error"in e)return e;let{app:o}=e,i=async a=>{await o.sendMessage({role:"user",content:[{type:"text",text:a}]})},s=async(a,u={})=>{if(!n)throw new Ot(`This app can't run ${a} from here.`);let l;try{l=await o.callServerTool({name:a,arguments:u})}catch(h){let d=h?.message??String(h);throw nS.test(d)?(r(!1),new Ot(`This app can't run ${a} from here (${d}).`)):h}let p=sg(l);if(l.isError)throw new Error(typeof p=="string"?p:JSON.stringify(p));return p};return{app:o,input:e.input,data:e.data,failed:e.failed,canCall:n,call:s,say:i,async run(a,u,l){try{return await s(a,u),"called"}catch(p){if(!(p instanceof Ot))throw p;return await i(l),"asked"}}}}function go(e,t,n){Ze(()=>{let r=setInterval(()=>{document.visibilityState==="visible"&&e()},t);return()=>clearInterval(r)},n)}var Tn=e=>{if(typeof e!="string")return"";let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=(Date.now()-t.getTime())/1e3;return n<60?"just now":n<3600?`${Math.round(n/60)} min ago`:n<86400?`${Math.round(n/3600)} h ago`:t.toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})};async function Su(e){try{return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(t);let n=document.activeElement;try{return t.select(),document.execCommand("copy")}catch{return!1}finally{t.remove(),n?.focus?.()}}var rS=0;function c(e,t,n,r,o,i){t||(t={});var s,a,u=t;if("ref"in u)for(a in u={},t)a=="ref"?s=t[a]:u[a]=t[a];var l={type:e,props:u,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--rS,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(a in s)u[a]===void 0&&(u[a]=s[a]);return J.vnode&&J.vnode(l),l}var Ab=e=>!!e&&typeof e=="object"&&!Array.isArray(e),ag=e=>String(e.text??e.title??e.name??e.id??"");function oS(e){let t=Object.entries(e),n=t.filter(([,o])=>Ab(o)),r=t.filter(([,o])=>!Ab(o));return{a:n[0],b:n[1],details:r}}function Eb({item:e}){if(!e)return c("div",{className:"side-item faint",children:"\u2014"});let[,t]=e;return c("div",{className:"side-item",children:[c("p",{children:ag(t)}),c("p",{className:"faint",children:[typeof t.id=="string"&&c("code",{children:t.id})," ",typeof t.recorded_by=="string"&&c(be,{children:["\xB7 ",t.recorded_by]})," ",typeof t.recorded_at=="string"&&c(be,{children:["\xB7 ",Tn(t.recorded_at)]})]})]})}function Zb({b:e}){let[t,n]=j(e.data),[r,o]=j(),[i,s]=j();if(Ze(()=>n(e.data),[e.data]),!t)return c("p",{className:"faint",children:"Waiting for the result\u2026"});let a=Array.isArray(t.result)?t.result:[t.result],u=async()=>{try{let p=await e.call(t.tool,t.input);n(p)}catch(p){o(p.message)}},l=async(p,h,d)=>{s(p);try{await e.say(`Help me settle this conflict: "${h?ag(h):"?"}" (${String(h?.id??"")}) versus "${d?ag(d):"?"}" (${String(d?.id??"")}). Look at the evidence for each, tell me which is better supported, and when I decide, record a claim that replaces the wrong one.`)}catch(f){o(f.message)}};return c("div",{children:[c("div",{className:"head",children:[c("h1",{children:[a.length===0?"No conflicts":`${a.length} conflict${a.length===1?"":"s"}`," ",c("span",{className:"muted",children:["in ",t.where]})]}),c("button",{onClick:u,children:"Refresh"})]}),a.length===0&&c("p",{className:"empty",children:"Nothing contradicts anything else right now."}),c("div",{className:"list",children:a.map((p,h)=>{let{a:d,b:f,details:g}=oS(p);return c("div",{className:"card",children:[c("div",{className:"pair",children:[c(Eb,{item:d}),c("div",{className:"vs",children:f?"vs":""}),c(Eb,{item:f})]}),c("div",{className:"spread",style:{marginTop:6},children:[c("span",{className:"faint",children:g.map(([b,x])=>`${b.replace(/_/g," ")}: ${typeof x=="string"&&/^\d{4}-\d\d-\d\dT/.test(x)?Tn(x):String(x)}`).join(" \xB7 ")}),c("button",{className:"link",disabled:i===h,onClick:()=>l(h,d?.[1],f?.[1]),children:i===h?"Asked your agent":"Ask my agent to help settle it"})]})]},h)})}),r&&c("p",{className:"notice bad",children:r})]})}var iS=["reader","contributor","admin"],sS={reader:"search and read",contributor:"also add and link",admin:"also withdraw anyone's items"};function aS({value:e,onChange:t,disabled:n}){return c("select",{value:e,disabled:n,onChange:r=>t(r.target.value),"aria-label":"Role",children:iS.map(r=>c("option",{value:r,title:sS[r],children:r},r))})}function Db({b:e}){let[t,n]=j(e.data),[r,o]=j(),[i,s]=j(),[a,u]=j(),[l,p]=j(""),[h,d]=j("contributor"),[f,g]=j(),b=async()=>{await k("name","set_my_name",{name:f.trim()}),g(void 0)};Ze(()=>{e.data&&n(e.data)},[e.data]);let x=Ju(async()=>{if(e.canCall)try{n(await e.call("open_console"))}catch(I){s(I.message)}},[e]);go(x,2500,[x]);let k=async(I,ke,Qe={})=>{o(I),s(void 0);try{await e.run(ke,Qe,an(ke,Qe))==="called"&&await x()}catch(kt){s(kt.message)}finally{o(void 0)}};if(!t)return c("p",{className:"faint",children:"Loading\u2026"});let v=I=>`Join my context graph: /vine-context:join ${I}`,N=async I=>{I.code&&(await Su(v(I.code))?(u(I.id),setTimeout(()=>u(void 0),1500)):document.getElementById(`vine-code-${I.id}`)?.select())},T=async()=>{await k("invite","share_context",{...l.trim()?{label:l.trim()}:{},role:h}),p("")},M=t.invites.filter(I=>I.state==="open"),D=t.invites.filter(I=>I.state==="used"),E=t.people.filter(I=>!I.you&&!I.removed_at),ae=t.you.role==="admin",xe=Object.values(t.relays??{}),he=xe.filter(I=>I==="open").length,Ne=(t.links??[]).filter(I=>I.route==="relayed").length;return c("div",{children:[c("div",{className:"head",children:[c("div",{className:"row",children:[c("span",{className:`dot ${t.sharing?"on":""}`,"aria-hidden":!0}),c("h1",{children:[t.sharing?"Syncing":"Offline"," ",c("span",{className:"muted",children:t.using})]})]}),t.sharing?c("button",{className:"danger",disabled:!!r,onClick:()=>k("unshare","stop_sharing"),children:"Go offline"}):ae?c("button",{className:"primary",disabled:!!r,onClick:()=>k("share","start_sharing"),children:"Go online"}):null]}),c("p",{className:"faint",children:["Your copy holds ",t.log.changes," changes",t.log.held?`; ${t.log.held} still on this machine (Undo possible)`:"","."," ",t.sharing&&xe.length>0&&`Signalling relays: ${he} of ${xe.length} connected.`,t.sharing&&xe.length>0&&he===0&&" None are reachable: other members can't find you until one is.",t.sharing&&t.ice?.turn&&` TURN server: ${t.ice.turn}${t.ice.problem?` (not in use: ${t.ice.problem})`:Ne?`, carrying ${Ne} of ${t.links.length} connections`:""}.`]}),c("div",{className:"you",children:f===void 0?c("p",{children:["People see you as ",c("strong",{children:t.you.name})," ",c("span",{className:"fp",children:t.you.fingerprint}),t.you.role?c("span",{className:"faint",children:[" (",t.you.role,")"]}):c("span",{className:"faint",children:" (removed: read only)"})," ",t.you.name_from!=="VINE_USER"&&c("button",{className:"link",onClick:()=>g(t.you.name),children:"Change"}),c("span",{className:"faint",children:[" ",{git:"(from git's user.name)",os:"(from your computer account)",login:"(your login name: set your own)",generated:"(made up: set your own)",VINE_USER:"(set by VINE_USER)",set_my_name:""}[t.you.name_from]??""]})]}):c("div",{className:"row",role:"group","aria-label":"Change your name",children:[c("label",{htmlFor:"vine-name",children:"Your name"}),c("input",{id:"vine-name",value:f,maxLength:40,onInput:I=>g(I.currentTarget.value),onKeyDown:I=>{I.key==="Enter"&&f.trim()&&b(),I.key==="Escape"&&g(void 0)},autoFocus:!0}),c("button",{className:"primary",type:"button",onClick:()=>{b()},disabled:!!r||!f.trim(),children:"Save"}),c("button",{type:"button",onClick:()=>g(void 0),children:"\u2039 Cancel"})]})}),t.sharing&&ae&&c(be,{children:[c("h2",{children:"Invites"}),c("p",{className:"faint",children:"Each join code is for one person: the first machine to use it gets in, with a full copy of the graph. This machine answers it, so it must be online then. An unused code expires. Send it privately."}),M.length===0&&c("p",{className:"empty",children:"No open join codes."}),c("div",{className:"list",children:M.map(I=>c("div",{className:"card",children:[c("div",{className:"spread",children:[c("span",{children:[c("strong",{children:I.label??"Join code"})," ",c("span",{className:"faint",children:["expires ",Tn(I.expires_at)]})]}),c("button",{disabled:!!r,onClick:()=>k(`cancel ${I.id}`,"revoke_invite",{id:I.id}),children:"Cancel"})]}),c("div",{className:"linkbox",children:[c("input",{id:`vine-code-${I.id}`,readOnly:!0,value:v(I.code),onFocus:ke=>ke.currentTarget.select(),"aria-label":"Message to send"}),c("button",{onClick:()=>{N(I)},children:a===I.id?"Copied":"Copy"})]})]},I.id))}),c("div",{className:"row",role:"group","aria-label":"New join code",style:{marginTop:8},children:[c("input",{value:l,maxLength:60,placeholder:"Who it's for (optional)","aria-label":"Who the code is for",onInput:I=>p(I.currentTarget.value),onKeyDown:I=>I.key==="Enter"&&void T()}),c("select",{value:h,"aria-label":"What they can do",onChange:I=>d(I.currentTarget.value),children:[c("option",{value:"contributor",children:"Read and add (contributor)"}),c("option",{value:"reader",children:"Only read (reader)"}),c("option",{value:"admin",children:"Read, add and invite (admin)"})]}),c("button",{disabled:!!r,onClick:()=>{T()},children:"New join code"})]}),D.length>0&&c("p",{className:"faint",children:["In use: ",D.map(I=>`${I.label?`${I.label}: `:""}${I.for.name}`).join(", ")]})]}),c("h2",{children:["People ",c("span",{className:"faint",children:[E.filter(I=>I.online).length," online"]})]}),E.length===0?c("p",{className:"empty",children:ae?"No one else is in this graph yet. Whoever uses a code first is let in, and everyone is told.":"No one else is in this graph."}):c("table",{children:c("tbody",{children:E.map(I=>c("tr",{children:[c("td",{children:[c("span",{className:`dot ${I.online?"on":""}`,"aria-hidden":!0})," ",c("strong",{children:I.name}),I.creator&&c("span",{className:"faint",children:" (made this graph)"}),c("div",{className:"faint",children:[I.agent,I.platform,I.invite?.label&&`via '${I.invite.label}'`,I.joined_at&&`joined ${Tn(I.joined_at)}`].filter(Boolean).join(" \xB7 ")})]}),c("td",{children:c("span",{className:"fp",children:I.fingerprint})}),c("td",{children:ae&&!I.creator?c(aS,{value:I.role??"reader",disabled:!!r,onChange:ke=>k(`role ${I.name}`,"set_peer_role",{name:I.name,role:ke})}):I.role}),c("td",{children:ae&&!I.creator&&c("button",{className:"danger",disabled:!!r,onClick:()=>k(`remove ${I.name}`,"remove_peer",{name:I.name}),children:"Remove"})})]},I.name))})}),i&&c("p",{className:"notice bad",children:i})]})}var cS=4e3,uS=6e3,cs=20,lS=[{tab:"overview",label:"Overview"},{tab:"questions",label:"Questions"},{tab:"claims",label:"Claims"},{tab:"people",label:"People"},{tab:"settings",label:"Settings"}],pS=5,dS=6,Mb=e=>{let t=/^(claim|question|reply|describe)$/.test(e.kind)?e.summary.indexOf(": "):-1;return t<0?{head:"",body:e.summary}:{head:e.summary.slice(0,t+2),body:e.summary.slice(t+2)}},fS=e=>e.startsWith("\u2039")?e:`\u2039 ${e}`,mS={claim:"\u{1F4CC}",question:"\u2753",reply:"\u21B3",link:"\u{1F517}",withdraw:"\u2715",add_member:"\u{1F44B}",remove_member:"\u{1F6AA}",set_role:"\u{1F511}",rename:"\u270E",describe:"\u270E",create:"\u2726"},hS=["reader","contributor","admin"],xt=({tone:e,children:t})=>c("div",{className:`card${e?` ${e}`:""}`,children:t}),ie=({children:e})=>c("p",{className:"faint wrap",children:e}),ht=({children:e,count:t})=>c("h2",{children:[e,t!==void 0&&c("span",{className:"faint",children:[" ",t]})]}),Mt=({active:e,onClick:t,children:n})=>c("button",{className:`chip${e?" on":""}`,"aria-pressed":e,onClick:t,children:n}),Lb=({open:e,onClick:t,children:n})=>c("button",{className:"link more","aria-expanded":e,onClick:t,children:[n," ",c("span",{"aria-hidden":"true",children:e?"\u25B4":"\u25BE"})]});function Nu(e){let[t,n]=j(!1),r=e.list.length-e.first;if(r<=0)return c(be,{children:e.list.map(e.render)});let o=t?e.list:e.latest?e.list.slice(-e.first):e.list.slice(0,e.first),i=c(Lb,{open:t,onClick:()=>n(!t),children:t?`Show fewer ${e.what}`:`${r} ${e.latest?"earlier":"more"} ${r===1&&e.one?e.one:e.what}`});return c(be,{children:[e.latest&&i,o.map(e.render),!e.latest&&i]})}function jb({label:e,hide:t="Less",children:n}){let[r,o]=j(!1);return c(be,{children:[c(Lb,{open:r,onClick:()=>o(!r),children:r?t:e}),r&&n]})}function cn(e){let[t,n]=j(e.value??""),r=o=>{n(o),e.onInput?.(o)};return c("div",{className:"field",children:[e.label&&c("label",{children:e.label}),c("div",{className:"linkbox",children:[e.rows?c("textarea",{rows:e.rows,value:t,placeholder:e.placeholder,autoFocus:e.autoFocus,"aria-label":e.label??e.placeholder,onInput:o=>r(o.currentTarget.value),onKeyDown:o=>o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&e.onSubmit(t)}):c("input",{value:t,placeholder:e.placeholder,autoFocus:e.autoFocus,"aria-label":e.label??e.placeholder,onInput:o=>r(o.currentTarget.value),onKeyDown:o=>o.key==="Enter"&&e.onSubmit(t)}),e.submit&&c("button",{className:"primary",onClick:()=>e.onSubmit(t),children:e.submit})]}),e.help&&c(ie,{children:e.help})]})}function Ub({b:e}){let[t,n]=j(null),[r,o]=j(null),[i,s]=j(!1),[a,u]=j(),[l,p]=j(null),[h,d]=j(null),[f,g]=j("overview"),[b,x]=j({text:"",claims:"current",questions:"open"}),[k,v]=j(null),[N,T]=j(0),[M,D]=j(null),[E,ae]=j(null),[xe,he]=j(null),[Ne,I]=j(null),[ke,Qe]=j(null),[kt,jt]=j(null),[On,un]=j(!1),[Lt,S]=j(!1),[X,ve]=j(!1),[Be,dt]=j(null),[_o,Pu]=j(null),[Wb,Kb]=j(null),ln=Et(null),us=Et(null),yo=Et([]),Le=Et({}),cg=_=>{if(s(!0),u(void 0),_.context===null){o(_.your_contexts),n(null),ln.current=null;return}o(null),n(_),ln.current&&ln.current!==_.context&&(ln.current=null)},Iu=async(_=ln.current)=>{try{cg(await e.call("context_activity",{limit:40,snapshot:!0,..._?{context:_}:{}}))}catch($){s(!0),u($ instanceof Ot?"This app can\u2019t refresh the view by itself. Ask your agent to open the contexts panel again to see the latest.":$.message)}};Ze(()=>{e.data&&typeof e.data=="object"&&"your_contexts"in e.data&&cg(e.data)},[e.data]),go(()=>{e.canCall&&Iu()},cS,[e.canCall]);let ug=Et(!1);Ze(()=>{if(!ug.current){ug.current=!0;return}let _=document.getElementById("vine-top");_||(_=document.createElement("div"),_.id="vine-top",_.style.cssText="position:absolute;top:0;left:0;width:1px;height:0",document.body.prepend(_)),_.scrollIntoView({block:"nearest"})},[f,M,E,xe!==null,Ne,kt?.name,On,Lt,X,Be!==null,_o]),Ze(()=>{if(!h)return;let _=setTimeout(()=>d(null),uS);return()=>clearTimeout(_)},[h]);let Tu=f==="settings"&&!Lt&&!Ne?t?.context??null:null;Ze(()=>{Tu&&(us.current=Tu,Ou())},[Tu]);let Ut=_=>{_?yo.current.push(_):yo.current=[],D(_)},Gb=()=>{yo.current.pop(),D(yo.current.at(-1)??null)},Ou=async()=>{let _=us.current;if(_)try{let $=await e.call("context_details",{name:_});us.current===_&&Qe($)}catch($){p($.message)}},bo=_=>(Qe(null),I(_),us.current=_,Ou()),lg=_=>(ln.current=_,Iu(_)),Re=async(_,$,C)=>{p(null);try{let z=await e.call(_,$);d(C??null),z&&typeof z=="object"&&z.invite?.id&&Kb(z.invite.id)}catch(z){z instanceof Ot?await e.say(an(_,$)).then(()=>d("Asked your agent to do that."),G=>p(G.message)):p(z.message)}await Iu(),await Ou()},Rn=async _=>{ae(null),Ut(null),p(null);try{await e.say(_),d("Handed to your agent.")}catch($){p($.message)}},Ru=async(_,$="Copied.")=>{d(await Su(_)?$:"This app doesn\u2019t allow copying from here: select the text and copy it.")},pg=(l||h)&&c("div",{className:`notice ${l?"bad":"ok"} item`,role:l?"alert":"status",children:[c("span",{className:"grow wrap",children:l??h}),c("button",{className:"link","aria-label":"Dismiss",onClick:()=>{p(null),d(null)},children:"\xD7"})]}),$t=(_,$,C,z)=>c("div",{className:"stack lg",children:[c("div",{className:"stack sm",children:[c("div",{className:"spread",children:[c("h1",{className:"title wrap",children:_}),z&&c("button",{onClick:z.onClick,children:fS(z.label)})]}),$&&c("p",{className:"wrap",children:$})]}),pg,C]});if(!i&&!t&&!r)return c("p",{className:"faint",children:"Loading the context\u2026"});let br=r??t?.your_contexts??[],ls=t?.contexts??[],vo=_=>ls.find($=>$.name===_),dg=_=>{vo(_)?Re("remove_context",{name:_},`'${_}' is off for this chat. It stays on this machine.`):Re(ls.length?"add_context":"use_context",{name:_},`'${_}' is on for this chat.`)},wo=async _=>{await lg(_),await bo(null),S(!1)},Qb=_=>wo(_).then(()=>{T(0),g("settings")}),fg=_=>(Le.current.invite="",wo(_).then(()=>dt("contributor"))),mg=_=>{Re("add_context",{name:_,write_here:!0},`New items go to '${_}' unless another fits better.`)},hg=_=>{let $=t?.folder;if(!$)return null;let C=($.pinned??[]).includes(_);return c("button",{className:"link pin","aria-pressed":C,onClick:()=>{Re("link_folder",C?{name:_,off:!0}:{name:_},C?`New chats in this folder no longer start with '${_}'.`:`New chats in this folder start with '${_}'.`)},children:[C?"\u{1F4CC} On for new chats in ":"\u{1F4CC} Turn on for new chats in ",c("span",{className:"faint",children:Nb($.folder,32)})]})},gg=(_,$)=>{let C=vo(_),z=ke&&ke.name===_?ke:null,G=(z?.role??C?.role)==="admin",O=ls.length>1,W=z?.sharing??($?t?.sharing:void 0),F=$?t?.relays_up:void 0,U=(Ae,Ee,Eu)=>`${z?.items[Ae]??0} ${(z?.items[Ae]??0)===1?Ee:Eu}`,Pe=z?.members===1;return c("div",{className:"stack lg",children:[c("div",{className:"stack sm",children:[c(ht,{children:"This chat"}),c("div",{className:"spread",children:[c("div",{className:"row",children:[c(Mt,{active:!!C,onClick:()=>dg(_),children:C?"\u25C9 On":"\u25CB Off"}),C&&O&&!C.writes_here&&c("button",{onClick:()=>mg(_),children:"\u270E Write here"})]}),C&&!$&&c("button",{onClick:()=>{wo(_)},children:"Open \u203A"})]}),c(ie,{children:C?O?C.writes_here?"Your agent looks things up in this context, and records new items in it unless another context clearly fits better.":"Your agent looks things up in this context, and records a new item in it only when the item fits its description.":"This chat uses this context: your agent looks things up in it and records new claims and questions in it. Turning it off only affects this chat. Your copy stays on this machine.":"This chat isn\u2019t using this context. Turn it on to open it here, share it or change its settings."}),hg(_)]}),c("div",{className:"stack sm",children:[c(ht,{children:"Sharing"}),W===void 0?c("p",{className:"faint",children:"Loading\u2026"}):c("p",{className:"wrap",children:[c("span",{className:W?"t-ok":"t-warn",children:"\u25CF "}),W?Pe?"Only you so far":"Syncing":"Offline",z&&c("span",{className:"muted",children:[!W&&Pe?" \xB7 only you so far":"",Pe?"":` \xB7 ${z.members} members \xB7 ${z.online} of the others online now`,z.open_invites?` \xB7 ${z.open_invites} join code${z.open_invites===1?"":"s"} not used yet`:""]})]}),c(ie,{children:W===!1?"Your copy keeps working. What you write is sent when you\u2019re back online.":F===0?"This machine can\u2019t reach the servers that help members find each other, so nothing syncs right now.":Pe?z?.open_invites?"Nobody has joined yet. Syncing starts when someone uses a join code you sent.":"Nobody else is in this context yet. Invite someone to share it with them.":"Every member keeps a full copy. Changes travel directly between your machines whenever you\u2019re both online."}),C&&c("div",{className:"row",children:[G&&c("button",{className:"primary",onClick:()=>{Le.current.invite="",$?dt("contributor"):fg(_)},children:"+ Invite someone"}),W!==void 0&&(W?c("button",{onClick:()=>{Re("stop_sharing",{context:_},`'${_}' is offline: not syncing until you go online again.`)},children:"Go offline"}):c("button",{onClick:()=>{Re("start_sharing",{context:_},`'${_}' is back online: syncing with the other members.`)},children:"Go online"}))]}),C&&!G&&c(ie,{children:"Only an admin can invite people."})]}),c("div",{className:"stack sm",children:[c(ht,{children:"About"}),z?c(be,{children:[c("dl",{className:"kv",children:[c("dt",{children:"Your role"}),c("dd",{children:z.role??"removed (you keep your copy to read)"}),c("dt",{children:"Made by"}),c("dd",{children:z.yours?"you":z.created_by??"unknown"}),c("dt",{children:"Holds"}),c("dd",{children:[U("Claim","claim","claims")," \xB7 ",U("Question","question","questions")," \xB7 ",U("Reply","reply","replies")]}),z.held>0&&c(be,{children:[c("dt",{children:"Not yet sent"}),c("dd",{children:[z.held," just written, still only on this machine"]})]})]}),c(jb,{label:"Id, storage and history",hide:"Hide id, storage and history",children:c("dl",{className:"kv",children:[c("dt",{children:"Changes"}),c("dd",{children:[z.changes," in all, withdrawn items included"]}),c("dt",{children:"Id"}),c("dd",{className:"mono",children:z.id??"none"}),c("dt",{children:"Stored at"}),c("dd",{className:"mono",children:z.stored_at})]})})]}):c("p",{className:"faint",children:l?"Couldn\u2019t read its details.":"Loading\u2026"})]}),c("div",{className:"stack sm",children:[c(ht,{children:"Delete"}),c(ie,{children:"Deletes this machine\u2019s copy for good. Other members keep theirs. You\u2019ll be asked to confirm."}),c("div",{className:"row",children:c("button",{className:"danger",onClick:()=>{Le.current.del="",jt({name:_,error:null})},children:"Delete from this machine\u2026"})})]})]})};if(kt&&br.includes(kt.name)){let _=kt.name,$=ke&&ke.name===_?ke:null,C=()=>{Le.current.del="",jt(null)},z=W=>{if(W.trim()!==_)return jt({name:_,error:`Type ${_} exactly to delete it. Nothing was deleted.`});Le.current.del="",jt(null),bo(null),ln.current=null,g("overview"),Re("delete_context",{name:_,confirm:_},`'${_}' was deleted from this machine.`)},G=$?Object.values($.items).reduce((W,F)=>W+F,0):null,O=$?$.members-($.role?1:0):null;return $t(`Delete ${_}?`,`This permanently deletes this machine\u2019s copy of '${_}'${G!==null?`: its ${G} item${G===1?"":"s"}, their history`:": its claims, questions and replies, their history"}, the join codes made here, and every chat\u2019s and folder\u2019s link to it. It can\u2019t be undone.`,c("div",{className:"stack lg",children:[c(xt,{tone:"warn",children:c("div",{className:"stack sm",children:[O===null?c("p",{className:"wrap",children:"Other members keep their own copies. If you\u2019re its only member, it\u2019s gone for good."}):O>0?c("p",{className:"wrap",children:[O," other member",O===1?" keeps their":"s keep their"," own copy, and nothing is deleted for them. To get it back you\u2019d need a new join code from one of its admins."]}):c("p",{className:"t-warn wrap",children:"You\u2019re its only member, so this is the only copy: once deleted, it\u2019s gone for good."}),$?.yours&&O!==null&&O>0&&c("p",{className:"t-warn wrap",children:"You made this context. The other members keep syncing with each other, but the join codes you made stop working."}),vo(_)&&c(ie,{children:"To only stop using it in this chat, turn it off instead: it stays on this machine."})]})}),c(cn,{label:`Type ${_} to confirm`,placeholder:_,autoFocus:!0,onInput:W=>Le.current.del=W,onSubmit:z},`delete-${_}`),kt.error&&c("p",{className:"t-bad wrap",children:kt.error}),c("div",{className:"row",children:[c("button",{className:"primary",onClick:C,children:"Keep it"}),c("button",{className:"danger",onClick:()=>z(Le.current.del??""),children:"Delete permanently"})]})]}),{label:"Cancel",onClick:C})}if(xe){let _=()=>he(null),$=()=>{let C=(Le.current.name??"").trim().toLowerCase().replace(/\s+/g,"-"),z=(Le.current.description??"").trim(),G=Tb(C,z,br);if(G)return he({error:G});Le.current.name=Le.current.description="",he(null),S(!1),ln.current=C,Re(t?"add_context":"use_context",{name:C,description:z},`Created '${C}'${t?" and added it to this chat":""}. No one is invited yet: use Invite someone when you want to let a person in.`)};return $t("Create a new context","A context holds what a group knows, as claims and questions, shared with the people you invite.",c("div",{className:"stack lg",children:[c(cn,{label:"Name",placeholder:"e.g. checkout-incident",autoFocus:!0,help:"Short: lower-case letters, digits and dashes.",onInput:C=>Le.current.name=C,onSubmit:$}),c(cn,{label:"What is it for?",placeholder:"What goes in it, in a sentence or two",rows:3,help:"Every member\u2019s agent reads this to decide what belongs there. You can change it later.",onInput:C=>Le.current.description=C,onSubmit:$}),xe.error&&c("p",{className:"t-bad wrap",children:xe.error}),c("div",{className:"row",children:[c("button",{className:"primary",onClick:$,children:"Create"}),c("button",{onClick:_,children:"\u2039 Cancel"})]}),c(ie,{children:"It\u2019s yours: you\u2019re its admin, and it\u2019s added to this chat. Invite people from its People tab, or with Share in the list."})]}),{label:"Cancel",onClick:_})}if(r!==null||Lt){let _=ls.length>1;if(Ne&&br.includes(Ne)){let $=Ne,C=vo($),z=ke&&ke.name===$?ke:null,G=z?z.description:C?.description??null;return $t($,null,c("div",{className:"stack lg",children:[c("div",{className:"stack sm",children:[c(ht,{children:"What it\u2019s for"}),G?c("p",{className:"wrap",children:G}):c("p",{className:"faint wrap",children:"No description yet, so agents won\u2019t know what belongs here."})]}),gg($,!1)]}),{label:"\u2039 Contexts",onClick:()=>{bo(null)}})}return $t("Contexts in this chat",r?br.length?"This chat has no context yet, so your agent will ask which it\u2019s for. Turn one on, or create one.":"A context holds what a group knows, as claims and questions, shared with the people you invite. Create one for this chat, or join one with a code someone sent you.":_?"Your agent reads all of these, and puts each new item in the one whose description fits. \u270E marks where it writes when none clearly does.":"Most chats use one context. Turn another on to use it too: your agent then picks the right one for each item.",c("div",{className:"stack",children:[c("div",{className:"stack sm",children:[c("div",{className:"row",children:c("button",{className:"primary",onClick:()=>{Le.current.name=Le.current.description="",he({error:null})},children:"+ Create new context"})}),c(ie,{children:"Got a join code? Paste it to your agent."})]}),br.map($=>{let C=vo($);return c(xt,{tone:C?"accent":void 0,children:c("div",{className:"stack sm",children:[c("div",{className:"item",children:[c("div",{className:"row grow",children:[c("button",{className:"link name",onClick:()=>{C?wo($):bo($)},children:$}),C&&c("span",{className:"muted",children:["\xB7 ",C.role??"removed"]}),C&&_&&C.writes_here&&c("span",{className:"t-accent",children:"\u270E writes here"})]}),c(Mt,{active:!!C,onClick:()=>dg($),children:C?"\u25C9 On":"\u25CB Off"})]}),C&&c("p",{className:"faint wrap",children:C.description??"No description yet"}),c("div",{className:"spread",children:[c("div",{className:"row",children:[c("button",{onClick:()=>{C?Qb($):bo($)},children:"Settings"}),C?.role==="admin"&&c("button",{onClick:()=>{fg($)},children:"Share"}),C&&_&&!C.writes_here&&c("button",{onClick:()=>mg($),children:"\u270E Write here"})]}),C&&c("button",{onClick:()=>{wo($)},children:"Open \u203A"})]}),hg($)]})},$)}),t?.folder&&br.length>0&&c(ie,{children:"\u{1F4CC} A pinned context is on in every new chat started in that folder, or below it. It\u2019s kept on this machine: nothing is written into the folder."})]}),r?void 0:{label:"Done",onClick:()=>S(!1)})}if(!t)return c("p",{className:"notice bad",children:a??"Couldn\u2019t load the context."});let ps=t.contexts.length>1,zt=ps?{context:t.context}:{},xo=ps?t.context:void 0,Ft=t.you.role==="admin",Vt=Ft?t.invites??[]:[],qt=t.you.role==="admin"||t.you.role==="contributor",Ht=t.snapshot,ye=Ht?Cb(Ht.nodes,Ht.edges):void 0,ee=Ht?Pb(Ht.nodes,Ht.edges):void 0,Bt=Date.now(),vr=new Map(t.recent.filter(_=>_.held&&_.node).map(_=>[_.node,_])),ds=_=>we(_,"recorded_by")===t.you.name,Rt=_=>{let $=we(_,"recorded_by")||"?",C=we(_,"recorded_at");return`${$===t.you.name?"you":$}${C?` \xB7 ${sn(C,Bt)}`:""}`},wr=_=>vr.has(_.key)&&c("span",{className:"t-warn",children:" \xB7 still only on this machine"}),ko=_=>{let $=vr.get(_.key);return $&&c("button",{className:"primary",onClick:()=>{Re("take_back",{id:$.id,...zt},"Taken back. It never left this machine.")},children:"Undo"})},_g=_=>!vr.has(_.key)&&!_.ended&&qt&&(ds(_)||Ft)&&c("button",{onClick:()=>{Ut(null),Re("withdraw",{id:_.key,...zt},"Withdrawn. It stays in the history.")},children:"Withdraw"});if(On)return $t(`Describe ${t.context}`,"What goes in it, and what doesn\u2019t. It syncs to every member, and their agents use it to decide what belongs here.",c(cn,{label:`What is '${t.context}' for?`,value:t.description??"",placeholder:"What goes in it, in a sentence or two",rows:3,submit:"Save",autoFocus:!0,onSubmit:_=>{un(!1),_.trim()&&_.trim()!==t.description&&Re("describe_context",{description:_.trim(),...zt},"Saved. Every member\u2019s agent sees it.")}}),{label:"Cancel",onClick:()=>un(!1)});if(X)return $t("Your name",`Everyone sees you as ${t.you.name}. Each person names themselves: the name travels with your key, to every context on this machine, and every member sees the change.`,c(cn,{label:"The name you\u2019d like others to see",value:t.you.name,submit:"Rename",autoFocus:!0,onSubmit:_=>{ve(!1),_.trim()&&_.trim()!==t.you.name&&Re("set_my_name",{name:_.trim()},`You're now ${_.trim()} in every context on this machine.`)}}),{label:"Cancel",onClick:()=>ve(!1)});let xr=E&&ee?ee.byKey.get(E):void 0;if(xr){let _=$=>$.trim()&&void Rn(ho.correct(xr,$.trim(),xo));return $t("Correct this claim",xr.title,c("div",{className:"stack",children:[c(ie,{children:[Rt(xr)," \xB7 ",xr.key]}),c(cn,{label:"What\u2019s right instead?",placeholder:"In your own words: your agent records it as a claim that replaces this one",rows:3,submit:"Send to agent",autoFocus:!0,onSubmit:_},`correct-${xr.key}`),c(ie,{children:"The old claim stays in the history, marked as replaced, so anyone can see what was believed before."})]}),{label:"Cancel",onClick:()=>ae(null)})}if(Ft&&Be){let _=Be,$=C=>{Le.current.invite="",dt(null),g("people"),Re("share_context",{...C.trim()?{label:C.trim()}:{},..._!=="contributor"?{role:_}:{},...zt},"Join code made. Copy it and send it privately, to that one person.")};return $t(`Invite someone to ${t.context}`,"A join code lets one person in: whoever uses it first. Send it to them privately. It expires in 24 hours if no one uses it.",c("div",{className:"stack",children:[c("div",{className:"field",children:[c("label",{htmlFor:"invite-role",children:"They can"}),c("select",{id:"invite-role",value:_,onChange:C=>dt(C.currentTarget.value),children:[c("option",{value:"contributor",children:"Read and add (contributor)"}),c("option",{value:"reader",children:"Only read (reader)"}),c("option",{value:"admin",children:"Read, add and invite (admin)"})]})]}),c(cn,{label:"Who is it for? (optional)",placeholder:"e.g. Sam: shown when they join, so a code used by someone else stands out",autoFocus:!0,onInput:C=>Le.current.invite=C,onSubmit:$}),c("div",{className:"row",children:c("button",{className:"primary",onClick:()=>$(Le.current.invite??""),children:"Make join code"})}),c(ie,{children:"This machine answers the code, so it must be online when they use it. Everyone in the context is told who joined."})]}),{label:"Cancel",onClick:()=>dt(null)})}let kr=_o?t.people.find(_=>_.fingerprint===_o):void 0;if(kr)return $t(`Remove ${kr.name}?`,`Every member\u2019s machine stops syncing with ${kr.name} and refuses their later changes. What they wrote stays, and they keep the copy they already had.`,c("div",{className:"row",children:c("button",{className:"primary",onClick:()=>{Pu(null),Re("remove_peer",{name:kr.name,...zt},`${kr.name} was removed. They keep the copy they already had.`)},children:["Remove ",kr.name]})}),{label:"Cancel",onClick:()=>Pu(null)});let q=M&&ee?ee.byKey.get(M):void 0;if(q&&ee&&ye){let _={label:yo.current.length>1?"\u2039 Back":"\u2039 Back to the list",onClick:Gb},$=(U,Pe,Ae)=>c("div",{className:"item",children:[c("div",{className:"grow",children:[c("p",{className:`wrap${Ae.label==="Claim"&&!ee.current(Ae)?" ended":""}`,children:[c("span",{className:Pe?`t-${Pe}`:"muted",children:[U," "]}),Se(Ae.title,300)]}),c(ie,{children:[Rt(Ae)," \xB7 ",Ae.key]})]}),c("button",{onClick:()=>Ut(Ae.key),children:"Open \u203A"})]},`${U}-${Ae.key}`),C=(U,Pe,Ae,Ee)=>Ee.length>0&&c("div",{className:"stack sm",children:[c(ht,{count:Ee.length,children:U}),Ee.map(Eu=>$(Pe,Ae,Eu))]},U);if(q.label==="Question"){let U=[...ye.open,...ye.answered].find(Ee=>Ee.q.id===q.id),Pe=!!U?.answers.length,Ae=!Pe&&!q.ended;return $t(q.ended?"Withdrawn question":Pe?"Answered question":"Open question",q.title,c("div",{className:"stack",children:[c(ie,{children:["asked by ",Rt(q)," \xB7 ",q.key,wr(q)]}),C("It\u2019s about","\u2192",void 0,ee.linked(q.id,"ABOUT","out")),U&&U.replies.length>0&&c("div",{className:"stack sm",children:[c(ht,{count:U.replies.length,children:"Thread"}),U.replies.map(Ee=>c("div",{className:"item",children:[c("div",{className:"grow",children:[c("p",{className:"wrap",children:[c("span",{className:"muted",children:"\u21B3 "}),Se(Ee.title,600)]}),c(ie,{children:[Rt(Ee),wr(Ee)]})]}),c("div",{className:"row",children:[ko(Ee),Ae&&qt&&c("button",{onClick:()=>{Rn(og(q,{reply:Ee},xo))},children:"Answer with this"})]})]},Ee.key))]}),U&&C("Answer","\u2713","ok",U.answers),C("Questions about this one","?","warn",ee.linked(q.id,"ABOUT","in")),Ae&&qt&&c(cn,{label:"Your answer",placeholder:"In your own words: your agent records it as a claim that answers this",submit:"Send to agent",autoFocus:!0,onSubmit:Ee=>Ee.trim()&&void Rn(og(q,{text:Ee.trim()},xo))},`answer-${q.key}`),c("div",{className:"row",children:[Ae&&qt&&c("button",{onClick:()=>{Rn(ho.investigate(q,xo))},children:"Ask my agent to look into it"}),c("button",{onClick:()=>{Ru(`${q.title} (${q.key})`)},children:"Copy"}),ko(q),_g(q)]}),Ae&&c(ie,{children:"Agents reply on the thread. Your answer goes to your agent, which records it as a claim that answers the question."})]}),_)}let z=ee.replacedBy.get(q.id),G=q.ended?"Withdrawn claim":z?"Replaced claim":ee.inConflict.has(q.id)?"Claim in conflict":"Claim",O=we(q,"about_from"),W=we(q,"about_to"),F=[...ee.linked(q.id,"CONTRADICTS","out"),...ee.linked(q.id,"CONTRADICTS","in")].filter((U,Pe,Ae)=>Ae.findIndex(Ee=>Ee.id===U.id)===Pe);return $t(G,null,c("div",{className:"stack",children:[c("p",{className:`wrap${ee.current(q)?"":" ended"}`,children:q.title}),c("div",{children:[c(ie,{children:["recorded by ",Rt(q)," \xB7 ",q.key,wr(q)]}),we(q,"source")&&c(ie,{children:["Source: ",we(q,"source")]}),(O||W)&&c(ie,{children:["About ",O&&W?`${O.slice(0,10)} to ${W.slice(0,10)}`:O?`${O.slice(0,10)} onwards`:`up to ${W.slice(0,10)}`]}),q.ended&&c("p",{className:"faint t-warn wrap",children:["Withdrawn",we(q,"withdrawn_by")?` by ${we(q,"withdrawn_by")}`:"",we(q,"withdrawn_at")?` \xB7 ${sn(we(q,"withdrawn_at"),Bt)}`:"",we(q,"withdraw_reason")?`: ${we(q,"withdraw_reason")}`:""]})]}),z&&C("Replaced by","\u2191","ok",[z]),C("Can\u2019t be true alongside","\u26A1","warn",F),C("Answers","?",void 0,ee.linked(q.id,"ANSWERS","out")),C("Evidence for it","+","ok",ee.linked(q.id,"SUPPORTS","in")),C("It\u2019s evidence for","\u2192",void 0,ee.linked(q.id,"SUPPORTS","out")),C("Earlier versions","\u2193",void 0,ee.linked(q.id,"REPLACES","out")),C("Questions about it","?","warn",ee.linked(q.id,"ABOUT","in")),c("div",{className:"row",children:[ee.current(q)&&qt&&!vr.has(q.key)&&c("button",{className:"primary",onClick:()=>ae(q.key),children:"Correct it"}),c("button",{onClick:()=>{Ru(`${q.title} (${q.key})`)},children:"Copy"}),ko(q),_g(q)]}),ee.current(q)&&qt&&c(ie,{children:"Correct it when it\u2019s wrong or out of date: the new claim replaces this one, which stays in the history. Withdraw it when it should never have been recorded."})]}),_)}let Ue=b,$o=(_,$={})=>{T(0),x(C=>({...C,..._===f?{}:{text:""},...$})),g(_)},Yb=async _=>{if(!_||!e.canCall)return v(null);let $=t.context;v({text:_,context:$,ids:null});let C={query:_,kind:"any",limit:50,...zt},z=G=>v(O=>O?.text===_&&O.context===$?G:O);try{let G=await e.call("search",{...C,include_ended:!0}).catch(O=>{if(O instanceof Ot)throw O;return e.call("search",C)});z({text:_,context:$,ids:Ib(G)})}catch{z({text:_,context:$,ids:[],failed:!0})}},Jt=_=>{T(0),x($=>({...$,..._})),_.text!==void 0&&Yb(_.text)},zo=Ue.text&&k&&k.text===Ue.text&&k.context===t.context?k:null,An=t.people.filter(_=>_.role),yg=_=>_.you?0:_.online?1:2,Au=[...An].sort((_,$)=>yg(_)-yg($)).slice(0,dS),bg=An.length-Au.length,vg=An.filter(_=>_.online).length-Au.filter(_=>_.online).length,wg={overview:void 0,questions:ye?.open.length,claims:ye?.claims.length,people:An.length,settings:void 0},Xb=c("button",{className:"primary",onClick:()=>{Re("start_sharing",{...zt},"Back online: syncing with the other members.")},children:"Go online"}),pn=t.digest?.at(-1),$r=t.recent.find(_=>!_.mine&&!_.held&&_.kind!=="create"),xg=pn?.lines[0]&&(!$r||pn.at>=$r.at)?`${Se(pn.lines[0],90)} (${sn(pn.at,Bt)})`:$r?`${$r.by} ${Se($r.summary,80)} (${sn($r.at,Bt)})`:"",ev=c("div",{className:"stack sm",children:[c("div",{className:"spread",children:[c("h1",{className:"title wrap",children:t.context}),c("button",{onClick:()=>S(!0),children:ps?`\u21C4 ${t.contexts.length} contexts`:"\u21C4 Contexts"})]}),ps&&c("div",{className:"row",children:t.contexts.map(_=>c(Mt,{active:_.name===t.context,onClick:()=>{lg(_.name)},children:[_.name,_.writes_here?" \u270E":""]},_.name))}),c("div",{className:"item",children:[t.description?c("p",{className:"grow wrap",children:t.description}):c("p",{className:"grow faint wrap",children:["No description yet",Ft?"":": an admin can add one",", so agents won\u2019t know what belongs here."]}),Ft&&c("button",{className:"link","aria-label":"Edit description",onClick:()=>un(!0),children:"\u270E"})]}),c("div",{className:"row who",children:[c("span",{className:t.sharing?"t-ok":"t-warn",title:t.sharing?`Syncing with the other members \xB7 ${t.relays_up} signalling relay${t.relays_up===1?"":"s"} reachable`:"Not syncing: what you write stays on this machine until you go online",children:t.sharing?"\u21C5 Syncing":"\u25CF Offline"}),c("button",{className:"link",onClick:()=>{Re(t.sharing?"stop_sharing":"start_sharing",{...zt},t.sharing?"Offline: not syncing until you go online again.":"Back online: syncing with the other members.")},children:t.sharing?"Go offline":"Go online"}),c("span",{className:"faint","aria-hidden":"true",children:"|"}),Au.map(_=>c("span",{className:_.online?"on":"",title:`${_.name} \xB7 ${_.role}${_.creator?" \xB7 made this context":""} \xB7 ${_.online?"online now":"offline"} \xB7 key ${_.fingerprint}${_.agent?` \xB7 ${_.agent}`:""}${_.platform?` \xB7 ${_.platform}`:""}`,children:[c("span",{className:_.online?"t-ok":"",children:"\u25CF"})," ",_.name,_.you?" (you)":""]},_.fingerprint)),bg>0&&c("button",{className:"link",onClick:()=>$o("people"),children:["+",bg," more",vg?` \xB7 ${vg} online`:""]})]}),xg&&c(ie,{children:["Latest: ",xg]}),c("div",{className:"tabs",role:"tablist",children:lS.map(_=>c("button",{role:"tab","aria-selected":f===_.tab,onClick:()=>$o(_.tab),children:[_.label,wg[_.tab]!==void 0?` ${wg[_.tab]}`:""]},_.tab))}),a&&c("p",{className:"notice bad wrap",children:a}),pg]}),kg=(_,$)=>c("div",{className:"stack sm",children:[c(cn,{value:Ue.text,placeholder:`Search ${_} by meaning, words, a person or an id`,submit:"Search",onSubmit:C=>Jt({text:C.trim()})},`filter-${f}-${Ue.text}`),Ue.text&&c("div",{className:"row",children:[c("span",{className:"faint",children:["Showing ",_," matching \u201C",Se(Ue.text,40),"\u201D",e.canCall?!zo||zo.ids===null?" \xB7 looking for ones close in meaning\u2026":zo.failed?" \xB7 search by meaning isn\u2019t available, so only words match":$?`, then ${$} close in meaning`:"":""]}),c("button",{className:"link",onClick:()=>Jt({text:""}),children:"\xD7 Clear"})]})]}),$g=_=>_.slice(0,cs+N),zg=_=>_>cs+N&&c("button",{className:"link more",onClick:()=>T($=>$+cs),children:["Show ",Math.min(cs,_-cs-N)," more of ",_]}),En;if(!Ht||!ye||!ee)En=c("p",{className:"faint",children:"Loading\u2026"});else if(f==="overview"){let _=t.recent.filter(O=>O.held&&O.mine),$=ye.open.filter(O=>O.replies.length),C=ye.open.filter(O=>ds(O.q)&&O.replies.length),z=(O,W,F,U)=>c(xt,{tone:W,children:c("div",{className:"item center",children:[c("span",{className:"grow wrap",children:F}),U]})},O),G=[!t.sharing&&z("offline","warn","You\u2019re offline: what you write stays on this machine, and you don\u2019t see what others add, until you\u2019re back.",Xb),t.sharing&&t.relays_up===0&&z("relays","warn","No signalling relay is reachable, so the other members can\u2019t find this machine right now.",null),ee.conflicts.length>0&&z("conflicts","warn",`\u26A1 ${ee.conflicts.length} pair${ee.conflicts.length===1?"":"s"} of claims can\u2019t both be true. Someone needs to say which stands.`,c("button",{className:"primary",onClick:()=>$o("claims",{text:"",claims:"conflicts"}),children:"Settle"})),C.length>0&&z("replies","accent",`\u21B3 ${C.length} of your questions ${C.length===1?"has":"have"} replies: ${Se(C[0].q.title,80)}`,c("button",{className:"primary",onClick:()=>Ut(C[0].q.key),children:"Read"})),ye.open.length>0&&z("questions",void 0,`\u2753 ${ye.open.length} open question${ye.open.length===1?"":"s"}${$.length?`, ${$.length} with replies`:""}.`,c("button",{onClick:()=>$o("questions",{text:"",questions:"open"}),children:"See"})),Ft&&!t.description&&z("describe","accent","This context has no description, so agents can\u2019t tell what belongs in it.",c("button",{className:"primary",onClick:()=>un(!0),children:"Describe"})),Ft&&An.length===1&&!Vt.length&&z("alone","accent","It\u2019s just you here so far.",c("button",{className:"primary",onClick:()=>dt("contributor"),children:"Invite someone"})),Vt.length>0&&z("invites",void 0,`${Vt.length} join code${Vt.length===1?" is":"s are"} waiting to be used.`,c("button",{onClick:()=>$o("people"),children:"See"}))].filter(Boolean);En=c("div",{className:"stack",children:[_.length>0&&c(xt,{tone:"warn",children:c("div",{className:"stack sm",children:[c("p",{className:"t-warn",children:"Just written, still only on this machine:"}),_.map(O=>c("div",{className:"item center",children:[c("span",{className:"grow wrap",children:Se(O.summary,140)}),c("button",{className:"primary",onClick:()=>{Re("take_back",{id:O.id,...zt},"Taken back. It never left this machine.")},children:"Undo"})]},O.id))]})}),c(ht,{count:G.length||void 0,children:"Needs you"}),G.length?c(Nu,{list:G,first:3,what:"things",one:"thing",render:O=>O}):c(xt,{tone:"ok",children:c("span",{className:"t-ok",children:"\u2713 Nothing needs you right now."})}),pn&&pn.lines.length>0&&c(be,{children:[c(ht,{children:"What changed for you"}),c(xt,{tone:"accent",children:c("div",{className:"stack sm",children:[c(Nu,{list:pn.lines.map((O,W)=>({line:O,i:W})),first:3,what:"changes",one:"change",render:({line:O,i:W})=>c("p",{className:"wrap",children:O},W)}),c(ie,{children:sn(pn.at,Bt)})]})})]}),c(ht,{children:"Ask your agent"}),c("div",{className:"row",children:[c("button",{onClick:()=>{Rn(ho.catchUp(t.context))},children:"Catch me up"}),qt&&c("button",{onClick:()=>{Rn(ho.saveChat(t.context))},children:"Save what this chat learned"})]}),c(ht,{children:"Recent activity"}),!t.recent.length&&c(ie,{children:"Nothing yet. What your agent and the other members\u2019 agents record shows up here."}),c(Nu,{list:t.recent,first:pS,what:"changes",one:"change",render:O=>c("div",{className:"item",children:[c("div",{className:"grow",children:[c("p",{className:"wrap",children:[c("span",{className:"muted",children:[mS[O.kind]??"\xB7"," ",O.mine?"you":O.by," ",Mb(O).head]}),Se(Mb(O).body,200)]}),c(ie,{children:[sn(O.at,Bt),O.held&&c("span",{className:"t-warn",children:" \xB7 still only on this machine"})]})]}),O.node&&ee.byKey.has(O.node)&&c("button",{onClick:()=>Ut(O.node),children:"Open \u203A"})]},O.id)}),c(ie,{children:[ye.claims.length," claim",ye.claims.length===1?"":"s"," \xB7 ",ye.open.length," open and ",ye.answered.length," answered question",ye.answered.length===1?"":"s"," \xB7 ",ee.history.length," replaced or withdrawn \xB7 ",t.changes," changes in all",Ht.truncated?" \xB7 showing the latest items only":""]})]})}else if(f==="questions"){let _={open:ye.open,answered:ye.answered,mine:[...ye.open,...ye.answered].filter(O=>ds(O.q))},$=Ue.questions in _?Ue.questions:"open",{list:C,byMeaning:z}=rg(_[$],O=>O.q.key,O=>yr(O.q,Ue.text)||O.replies.some(W=>yr(W,Ue.text))||O.answers.some(W=>yr(W,Ue.text)),zo?.ids),G=O=>{let W=O.q,F=O.answers.length>0;return c(xt,{tone:vr.has(W.key)?"warn":F?"ok":void 0,children:c("div",{className:"stack sm",children:[c("div",{className:"item",children:[c("div",{className:"grow",children:[c("p",{className:"wrap",children:c("strong",{children:Se(W.title,300)})}),c(ie,{children:["asked by ",Rt(W),O.replies.length?` \xB7 ${O.replies.length} repl${O.replies.length===1?"y":"ies"}`:"",z.has(W.key)?" \xB7 close in meaning":"",wr(W)]})]}),c("div",{className:"row",children:[ko(W),F||!qt?c("button",{onClick:()=>Ut(W.key),children:"Open \u203A"}):c("button",{className:"primary",onClick:()=>Ut(W.key),children:"Answer"})]})]}),c(Nu,{list:O.replies,first:2,latest:!0,what:"replies",one:"reply",render:U=>c("div",{className:"reply",children:[c("p",{className:"wrap",children:[c("span",{className:"muted",children:"\u21B3 "}),Se(U.title,240)]}),c(ie,{children:[Rt(U),wr(U)]})]},U.key)}),O.answers.map(U=>c("div",{className:"reply",children:[c("p",{className:"wrap",children:[c("span",{className:"t-ok",children:"\u2713 "}),Se(U.title,300)]}),c(ie,{children:["answered by ",Rt(U)]})]},U.key))]})},W.key)};En=c("div",{className:"stack",children:[c("div",{className:"row",children:[c(Mt,{active:$==="open",onClick:()=>Jt({questions:"open"}),children:["Open ",ye.open.length]}),c(Mt,{active:$==="answered",onClick:()=>Jt({questions:"answered"}),children:["Answered ",ye.answered.length]}),c(Mt,{active:$==="mine",onClick:()=>Jt({questions:"mine"}),children:["Mine ",_.mine.length]})]}),kg("questions",z.size),!C.length&&c("p",{className:"empty",children:Ue.text?"No questions match.":$==="open"?ye.answered.length?"\u2713 Every question has an answer.":"No questions yet. When your agent records something the group needs to find out, it shows up here with its thread.":$==="answered"?"No question has been answered yet.":"You haven\u2019t asked anything here yet."}),$g(C).map(G),zg(C.length),c(ie,{children:"Agents ask and reply. Answer gives your agent your answer, and it records it as a claim."})]})}else if(f==="claims"){let _={current:ye.claims,mine:ye.claims.filter(ds),conflicts:ye.claims.filter(F=>ee.inConflict.has(F.id)),history:ee.history},$=Ue.claims in _?Ue.claims:"current",{list:C,byMeaning:z}=rg(_[$],F=>F.key,F=>yr(F,Ue.text),zo?.ids),G=$==="history"?[]:ee.conflicts.filter(([F,U])=>yr(F,Ue.text)||yr(U,Ue.text)),O=(F,U)=>c("div",{className:"item",children:[c("div",{className:"grow",children:[c("p",{className:"wrap",children:Se(F.title,300)}),c(ie,{children:[Rt(F)," \xB7 ",F.key]})]}),c("div",{className:"row",children:[qt&&c("button",{onClick:()=>{Rn(ho.settle(F,U,xo))},children:"Keep this one"}),c("button",{onClick:()=>Ut(F.key),children:"Open \u203A"})]})]}),W=F=>{let U=ee.linked(F.id,"SUPPORTS","in").filter(ee.current).length;return[ee.linked(F.id,"ANSWERS","out").length?"answers a question":"",U?`${U} in support`:"",ee.linked(F.id,"REPLACES","out").length?"updated":"",we(F,"source")?Se(we(F,"source"),50):""].filter(Boolean).map(Pe=>` \xB7 ${Pe}`).join("")};En=c("div",{className:"stack",children:[c("div",{className:"row",children:[c(Mt,{active:$==="current",onClick:()=>Jt({claims:"current"}),children:["Current ",ye.claims.length]}),c(Mt,{active:$==="mine",onClick:()=>Jt({claims:"mine"}),children:["Mine ",_.mine.length]}),(ee.conflicts.length>0||$==="conflicts")&&c(Mt,{active:$==="conflicts",onClick:()=>Jt({claims:"conflicts"}),children:["\u26A1 Conflicts ",ee.conflicts.length]}),c(Mt,{active:$==="history",onClick:()=>Jt({claims:"history"}),children:["History ",ee.history.length]})]}),kg("claims",z.size),G.map(([F,U])=>c(xt,{tone:"warn",children:c("div",{className:"stack sm",children:[c("strong",{className:"t-warn",children:"\u26A1 These can\u2019t both be true"}),O(F,U),c("span",{className:"faint",children:"\u2014 or \u2014"}),O(U,F)]})},`${F.key}-${U.key}`)),$==="conflicts"&&!G.length&&c(xt,{tone:"ok",children:c("span",{className:"t-ok",children:"\u2713 No claims contradict each other."})}),$!=="conflicts"&&!C.length&&c("p",{className:"empty",children:Ue.text?"No claims match.":$==="current"?"No claims yet. What your agent records as true shows up here. Try \u201CSave what this chat learned\u201D on the Overview.":$==="mine"?"None of the current claims are yours.":"Nothing has been replaced or withdrawn."}),$!=="conflicts"&&$g(C).map(F=>{let U=ee.replacedBy.get(F.id);return c(xt,{tone:vr.has(F.key)||ee.inConflict.has(F.id)?"warn":void 0,children:c("div",{className:"item",children:[c("div",{className:"grow",children:[c("p",{className:`wrap${$==="history"?" ended":""}`,children:[ee.inConflict.has(F.id)&&c("span",{className:"t-warn",children:"\u26A1 "}),Se(F.title,300)]}),c(ie,{children:[Rt(F),z.has(F.key)?" \xB7 close in meaning":"",$==="history"?F.ended?` \xB7 withdrawn${we(F,"withdrawn_by")?` by ${we(F,"withdrawn_by")}`:""}${we(F,"withdraw_reason")?`: ${Se(we(F,"withdraw_reason"),80)}`:""}`:U?` \xB7 replaced by ${U.key}: ${Se(U.title,80)}`:"":W(F),wr(F)]})]}),c("div",{className:"row",children:[ko(F),c("button",{onClick:()=>Ut(F.key),children:"Open \u203A"})]})]})},F.key)}),$!=="conflicts"&&zg(C.length),$==="history"&&c(ie,{children:"Nothing is deleted: replaced and withdrawn claims stay, so anyone can see what the group believed before."})]})}else if(f==="settings")En=gg(t.context,!0);else{let _=t.people.filter(z=>!z.role),$=z=>{let G=Ht.nodes.filter(U=>!U.ended&&we(U,"recorded_by")===z.name),O=U=>G.filter(Pe=>Pe.label===U).length,W=[[O("Claim"),"claim"],[O("Question"),"question"],[O("Reply"),"repl"]].filter(([U])=>U).map(([U,Pe])=>`${U} ${Pe}${Pe==="repl"?U===1?"y":"ies":U===1?"":"s"}`),F=t.recent.find(U=>U.by===z.name);return`${z.joined_at?`joined ${sn(z.joined_at,Bt)}`:""}${W.length?` \xB7 ${W.join(", ")}`:" \xB7 nothing recorded yet"}${F?` \xB7 active ${sn(F.at,Bt)}`:""}`.replace(/^ · /,"")},C=z=>c(xt,{tone:z.you?"accent":void 0,children:c("div",{className:"item center",children:[c("div",{className:"grow",children:[c("p",{children:[c("span",{className:z.online?"t-ok":"muted",children:"\u25CF"})," ",c("strong",{className:z.role?"":"muted",children:z.name}),c("span",{className:"muted",children:[z.you?" (you)":""," \xB7 ",z.role??"removed",z.creator?" \xB7 made this context":"",z.role?z.online?" \xB7 online":" \xB7 offline":""]})]}),c(ie,{children:$(z)}),c(jb,{label:"Key and agent",hide:"Hide key and agent",children:c("p",{className:"faint mono wrap",children:[z.fingerprint,z.agent?` \xB7 ${z.agent}`:"",z.platform?` \xB7 ${z.platform}`:""]})})]}),c("div",{className:"row",children:[z.you&&c("button",{onClick:()=>ve(!0),children:"\u270E Rename"}),Ft&&!z.creator&&!z.you&&z.role&&c(be,{children:[c("select",{"aria-label":`Role of ${z.name}`,value:z.role,onChange:G=>{Re("set_peer_role",{name:z.name,role:G.currentTarget.value,...zt},`${z.name} is now ${G.currentTarget.value}.`)},children:hS.map(G=>c("option",{value:G,children:G},G))}),c("button",{onClick:()=>Pu(z.fingerprint),children:"Remove"})]})]})]})},z.fingerprint);En=c("div",{className:"stack",children:[c(ht,{count:An.length,children:"Members"}),An.map(C),Ft&&c(xt,{tone:"accent",children:c("div",{className:"stack",children:[c("div",{className:"spread",children:[c("span",{children:[c("strong",{children:"Join codes"}),c("span",{className:"muted",children:[" ",Vt.length?`${Vt.length} waiting`:"none waiting"]})]}),c("button",{className:"primary",onClick:()=>dt("contributor"),children:"+ Invite someone"})]}),Vt.length===0?c(ie,{children:"Each code lets one person in: whoever uses it first. Codes stay here until they\u2019re used, cancelled or expire."}):Vt.map(z=>{let G=Math.round(Math.max(0,Date.parse(z.expires_at)-Bt)/36e5);return c("div",{className:"stack sm",children:[c("div",{className:"spread",children:[c("span",{children:[c("strong",{children:z.label?`For ${z.label.replace(/^for\s+/i,"")}`:"No note"}),c("span",{className:"muted",children:[" ","\xB7 ",z.role," \xB7 ",G>=1?`expires in ${G}h`:"expires soon"]}),z.id===Wb&&c("span",{className:"t-ok",children:" \xB7 new: send it now"})]}),c("button",{onClick:()=>{Re("revoke_invite",{id:z.id,...zt},"Cancelled: that code no longer works.")},children:"Cancel"})]}),c("div",{className:"linkbox",children:[c("input",{readOnly:!0,value:ig(z.code),onFocus:O=>O.currentTarget.select(),"aria-label":"Message to send"}),c("button",{onClick:()=>{Ru(ig(z.code),"Copied: send it privately, to that one person.")},children:"Copy"})]})]},z.id)}),!t.sharing&&Vt.length>0&&c("p",{className:"t-warn",children:"You\u2019re offline, so these codes won\u2019t work until you go online."})]})}),_.length>0&&c(ht,{count:_.length,children:"Removed"}),_.map(C)]})}return c("div",{className:"stack lg",children:[ev,En]})}var gS=["#2a78d6","#eb6834","#1baf7a","#eda100","#e87ba4","#008300","#6250d6","#e34948"],_S=["#3987e5","#d95926","#199e70","#c98500","#d55181","#0ca30c","#9085e9","#e66767"],Fb=["","6 4","2 3","10 3 2 3","1 5","12 6"];function yS(){let e=()=>document.documentElement.getAttribute("data-theme")==="dark"||document.documentElement.getAttribute("data-theme")!=="light"&&matchMedia("(prefers-color-scheme: dark)").matches,[t,n]=j(e);return Ze(()=>{let r=matchMedia("(prefers-color-scheme: dark)"),o=()=>n(e());r.addEventListener("change",o);let i=new MutationObserver(o);return i.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>{r.removeEventListener("change",o),i.disconnect()}},[]),t}function bS(e,t,n,r,o){let i=new Map,s=[...new Set(e.map(g=>g.label))];e.forEach((g,b)=>{let x=n.get(g.id);if(x)i.set(g.id,{...x});else{let k=s.indexOf(g.label)/Math.max(s.length,1)*Math.PI*2+b*.37,v=60+b%7*18;i.set(g.id,{x:r/2+Math.cos(k)*v,y:o/2+Math.sin(k)*v})}});let a=e.map(g=>g.id),u=t.filter(g=>i.has(g.source)&&i.has(g.target)),l=Math.sqrt(r*o/Math.max(e.length,1))*.6,p=(2.5*l)**2,d=e.some(g=>!n.has(g.id))?260:60;for(let g=0;g<d;g++){let b=1-g/d,x=new Map(a.map(k=>[k,{x:0,y:0}]));for(let k=0;k<a.length;k++)for(let v=k+1;v<a.length;v++){let N=i.get(a[k]),T=i.get(a[v]),M=N.x-T.x,D=N.y-T.y,E=Math.max(M*M+D*D,1);if(E>p)continue;let ae=l*l/E;M*=ae,D*=ae,x.get(a[k]).x+=M,x.get(a[k]).y+=D,x.get(a[v]).x-=M,x.get(a[v]).y-=D}for(let k of u){let v=i.get(k.source),N=i.get(k.target),T=v.x-N.x,M=v.y-N.y,D=Math.max(Math.sqrt(T*T+M*M),.1),E=(D-l)/D/2;x.get(k.source).x-=T*E,x.get(k.source).y-=M*E,x.get(k.target).x+=T*E,x.get(k.target).y+=M*E}for(let k of a){let v=i.get(k),N=x.get(k);N.x+=(r/2-v.x)*.03,N.y+=(o/2-v.y)*.03;let T=Math.max(Math.sqrt(N.x*N.x+N.y*N.y),.01),M=Math.min(T,12*b+.5);v.x+=N.x/T*M,v.y+=N.y/T*M}}let f=[...i.values()];if(f.length){let g=Math.min(...f.map(E=>E.x)),b=Math.max(...f.map(E=>E.x)),x=Math.min(...f.map(E=>E.y)),k=Math.max(...f.map(E=>E.y)),T=Math.min((r-2*120)/Math.max(b-g,1),(o-2*36)/Math.max(k-x,1),1.5),M=(r-(b-g)*T)/2,D=(o-(k-x)*T)/2;for(let E of f)E.x=M+(E.x-g)*T,E.y=D+(E.y-x)*T}return i}var Cu=(e,t=28)=>e.length>t?e.slice(0,t-1)+"\u2026":e;function Vb({b:e}){let[t,n]=j(e.data),[r,o]=j(""),[i,s]=j(),[a,u]=j(),[l,p]=j(!1),[h,d]=j(),[f,g]=j({x:0,y:0,s:1}),[b,x]=j(),[k,v]=j(),N=Et(new Map),T=Et(void 0),M=yS(),D=640,E=420;Ze(()=>{e.data&&n(e.data)},[e.data]),Ze(()=>{if(!t||k)return;let S=t.schema.time,X=S?t.nodes.flatMap(ve=>[ve.props[S.recorded],S.ended?ve.props[S.ended]:void 0]).map(ve=>Date.parse(String(ve??""))).filter(ve=>!Number.isNaN(ve)):[];X.length&&x({min:Math.min(...X),max:Math.max(...X)})},[t,k]);let ae=M?_S:gS,xe=fn(()=>{let S=new Map;return t?.schema.nodes.forEach((X,ve)=>S.set(X.label,ae[ve]??"var(--fg3)")),S},[t,ae]),he=fn(()=>{let S=new Map;return t?.schema.relationships.forEach((X,ve)=>S.set(X.type,Fb[ve%Fb.length])),S},[t]),Ne=fn(()=>{if(!t)return new Map;let S=bS(t.nodes,t.edges,N.current,D,E);return N.current=S,S},[t]),I=r.trim().toLowerCase(),ke=S=>!I||S.title.toLowerCase().includes(I)||S.key.toLowerCase().includes(I),Qe=t?.nodes.find(S=>S.id===i),kt=fn(()=>{let S=new Set;if(!t||!i)return S;for(let X of t.edges)X.source===i&&S.add(X.target),X.target===i&&S.add(X.source);return S},[t,i]);go(()=>{e.canCall&&k===void 0&&!l&&jt()},2500,[e.canCall,k,l]);let jt=async S=>{p(!0),d(void 0);try{let X=await e.call("explore_context",S?{at:new Date(S).toISOString()}:{});n(X)}catch(X){d(X.message)}finally{p(!1)}};if(!t)return c("p",{className:"faint",children:"Loading the graph\u2026"});let On=new Map(t.nodes.map(S=>[S.id,S])),un=t.nodes.filter(ke),Lt=a&&On.get(a.id);return c("div",{children:[c("div",{className:"head",children:[c("h1",{children:[t.where," ",c("span",{className:"muted",children:["\xB7 ",t.nodes.length," items, ",t.edges.length," links"]})]}),c("div",{className:"row",children:[c("input",{placeholder:"Filter items",value:r,onChange:S=>o(S.target.value),"aria-label":"Filter items",style:{width:170}}),c("button",{disabled:l,onClick:()=>(v(void 0),jt()),children:"Now"})]})]}),b&&b.max>b.min&&c("div",{className:"timebar",children:[c("span",{className:"faint",children:"As of"}),c("input",{type:"range",min:b.min,max:b.max,step:Math.max(1,Math.round((b.max-b.min)/200)),value:k??b.max,onChange:S=>v(Number(S.target.value)),onPointerUp:()=>k&&jt(k),onKeyUp:()=>k&&jt(k),"aria-label":"Show the graph as it stood at this time"}),c("span",{className:"mono",style:{minWidth:150,textAlign:"right"},children:k?new Date(k).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}):"now"})]}),c("div",{className:"explorer",children:[c("div",{children:[c("div",{className:"canvas",children:[t.nodes.length===0?c("p",{className:"empty",style:{padding:16},children:["Nothing in the graph ",k?"at that time":"yet","."]}):c("svg",{viewBox:`0 0 ${D} ${E}`,role:"img","aria-label":`Graph of ${t.nodes.length} items and ${t.edges.length} links`,onPointerDown:S=>{S.target.setPointerCapture?.(S.pointerId),T.current={x:S.clientX,y:S.clientY,vx:f.x,vy:f.y}},onPointerMove:S=>{if(!T.current)return;let X=S.currentTarget.getBoundingClientRect(),ve=D/X.width;g({...f,x:T.current.vx+(S.clientX-T.current.x)*ve,y:T.current.vy+(S.clientY-T.current.y)*ve})},onPointerUp:()=>T.current=void 0,onWheel:S=>g({...f,s:Math.min(4,Math.max(.3,f.s*(S.deltaY>0?.9:1.1)))}),children:[c("defs",{children:c("marker",{id:"arrow",viewBox:"0 0 10 10",refX:"16",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:c("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--fg3)"})})}),c("g",{transform:`translate(${f.x+D/2*(1-f.s)} ${f.y+E/2*(1-f.s)}) scale(${f.s})`,children:[t.edges.map((S,X)=>{let ve=Ne.get(S.source),Be=Ne.get(S.target);if(!ve||!Be)return null;let dt=i&&(S.source===i||S.target===i),_o=i&&!dt||I&&!(ke(On.get(S.source))||ke(On.get(S.target)));return c("line",{x1:ve.x,y1:ve.y,x2:Be.x,y2:Be.y,stroke:dt?"var(--fg)":"var(--fg3)",strokeWidth:dt?2:1.25,strokeDasharray:he.get(S.type),opacity:_o?.15:.85,markerEnd:"url(#arrow)",children:c("title",{children:S.type})},X)}),t.nodes.map(S=>{let X=Ne.get(S.id),ve=I&&!ke(S)||i&&S.id!==i&&!kt.has(S.id),Be=S.id===i;return c("g",{transform:`translate(${X.x} ${X.y})`,opacity:ve?.2:1,style:{cursor:"pointer"},onPointerDown:dt=>dt.stopPropagation(),onClick:()=>s(Be?void 0:S.id),onPointerEnter:()=>u({id:S.id,x:X.x,y:X.y}),onPointerLeave:()=>u(void 0),children:[c("circle",{r:14,fill:"transparent"}),c("circle",{r:Be?9:7,fill:S.ended?"var(--bg2)":xe.get(S.label),stroke:S.ended?xe.get(S.label):"var(--bg2)",strokeWidth:2,strokeDasharray:S.ended?"2 2":void 0}),(Be||kt.has(S.id)||I&&ke(S)||t.nodes.length<=24)&&c("text",{x:11,y:4,fontSize:11,fill:"var(--fg2)",stroke:"var(--bg2)",strokeWidth:3,paintOrder:"stroke",style:{pointerEvents:"none"},className:S.ended?"ended":"",children:Cu(S.title,Be?48:22)})]},S.id)})]}),Lt&&a&&c("foreignObject",{x:Math.min(f.x+D/2*(1-f.s)+a.x*f.s+12,D-250),y:Math.max(f.y+E/2*(1-f.s)+a.y*f.s-10,4),width:240,height:120,style:{pointerEvents:"none"},children:c("div",{className:"card",style:{fontSize:12,padding:"6px 8px",boxShadow:"0 2px 8px rgba(0,0,0,.15)"},children:[c("div",{className:"row",children:[c("span",{className:"swatch",style:{background:xe.get(Lt.label)}}),c("strong",{children:Lt.label}),Lt.ended&&c("span",{className:"pill",children:"ended"})]}),c("div",{children:Cu(Lt.title,110)})]})})]}),c("div",{className:"zoom",children:[c("button",{"aria-label":"Zoom in",onClick:()=>g({...f,s:Math.min(4,f.s*1.25)}),children:"+"}),c("button",{"aria-label":"Zoom out",onClick:()=>g({...f,s:Math.max(.3,f.s/1.25)}),children:"\u2212"}),c("button",{"aria-label":"Reset view",onClick:()=>g({x:0,y:0,s:1}),children:"\u293E"})]})]}),c("div",{className:"legend",children:[t.schema.nodes.map(S=>c("span",{children:[c("span",{className:"swatch",style:{background:xe.get(S.label)}}),S.label]},S.label)),t.schema.relationships.map(S=>c("span",{title:S.description,children:[c("svg",{width:"18",height:"6","aria-hidden":!0,children:c("line",{x1:"0",y1:"3",x2:"18",y2:"3",stroke:"var(--fg3)",strokeWidth:"2",strokeDasharray:he.get(S.type)})}),S.type]},S.type)),t.schema.time?.ended&&c("span",{children:[c("span",{className:"swatch",style:{border:"1.5px dashed var(--fg3)"}})," ended"]})]}),t.truncated&&c("p",{className:"faint",children:"Showing the most recent items only."})]}),c("div",{className:"side",children:Qe?c("div",{className:"card",children:[c("div",{className:"spread",children:[c("div",{className:"row",children:[c("span",{className:"swatch",style:{background:xe.get(Qe.label)}}),c("strong",{children:Qe.label}),Qe.ended&&c("span",{className:"pill",children:"ended"})]}),c("button",{className:"link",onClick:()=>s(void 0),children:"Close"})]}),c("p",{className:Qe.ended?"ended":"",style:{margin:"6px 0"},children:Qe.title}),c("dl",{className:"kv",children:Object.entries(Qe.props).filter(([S,X])=>X!=null&&X!==""&&S!=="text").map(([S,X])=>c("div",{style:{display:"contents"},children:[c("dt",{children:S.replace(/_/g," ")}),c("dd",{children:typeof X=="string"&&/^\d{4}-\d\d-\d\dT/.test(X)?Tn(X):String(X)})]},S))}),c("h2",{children:"Links"}),c("div",{className:"list",children:t.edges.filter(S=>S.source===Qe.id||S.target===Qe.id).map((S,X)=>{let ve=S.source===Qe.id,Be=On.get(ve?S.target:S.source);return c("button",{className:"link",style:{textAlign:"left",whiteSpace:"normal"},onClick:()=>Be&&s(Be.id),children:[c("span",{className:"faint",children:ve?`${S.type} \u2192`:`\u2190 ${S.type}`})," ",Be?Cu(Be.title,60):"?"]},X)})})]}):c("div",{className:"card",style:{maxHeight:460,overflow:"auto"},children:[c("h2",{style:{marginTop:0},children:["Items ",I&&c("span",{className:"faint",children:["(",un.length,")"]})]}),un.length===0&&c("p",{className:"empty",children:"No items match."}),c("div",{className:"list",children:un.slice(0,100).map(S=>c("button",{className:"link",style:{textAlign:"left",whiteSpace:"normal",color:"var(--fg)"},onClick:()=>s(S.id),children:[c("span",{className:"swatch",style:{background:xe.get(S.label),marginRight:6}}),c("span",{className:S.ended?"ended":"",children:Cu(S.title,80)})]},S.id))})]})})]}),h&&c("p",{className:"notice bad",children:h})]})}var qb=e=>Array.isArray(e)?e.join(", "):typeof e=="object"&&e?JSON.stringify(e):String(e);function Hb({b:e,open:t}){let n=e.data,[r,o]=j(),[i,s]=j(),[a,u]=j(!1),[l,p]=j(Date.now()),h=typeof n?.result?.shared_at=="string"?Date.parse(n.result.shared_at):0;if(Ze(()=>{if(!h||h<=Date.now())return;let E=setInterval(()=>p(Date.now()),250);return()=>clearInterval(E)},[h]),!n)return c("p",{className:"faint",children:"Waiting for the result\u2026"});let d=Object.entries(n.input??{}).filter(([,E])=>E!=null&&!(Array.isArray(E)&&E.length===0)),f=d.find(([E])=>E==="text"),g=d.filter(([E])=>E!=="text"),b=typeof n.result?.change=="string"?n.result.change:void 0,x=typeof n.result?.id=="string"?n.result.id:void 0,k=Math.ceil((h-l)/1e3),v=!!(n.undo?.take_back&&b&&k>0),N=!!(n.undo?.withdraw&&x&&!v&&(n.tool==="add_claim"||n.tool==="ask_question")),T=async(E,ae,xe)=>{u(!0),s(void 0);try{let he=await e.run(E,ae,an(E,ae));o(he==="called"?xe:"Asked your agent to do that. Check its reply.")}catch(he){s(he.message)}finally{u(!1)}},M=()=>T("take_back",{id:b},"Taken back. It never left this machine."),D=()=>T("withdraw",{id:x},"Withdrawn. The other members have it, so it stays in the graph's history.");return c("div",{className:"card",children:[c("div",{className:"spread",children:[c("div",{className:"row",children:[c("span",{className:`pill ${r?"":v?"warn":"ok"}`,children:r?"undone":v?"on this machine":"shared"}),c("strong",{children:n.title}),n.result&&typeof n.result.id=="string"&&c("code",{className:"faint",children:n.result.id})]}),!r&&v&&c("button",{disabled:a,onClick:M,title:"It is still only on this machine: Undo removes it without trace",children:["Undo (",k,"s)"]}),!r&&N&&c("button",{disabled:a,onClick:D,title:"Already sent to the other members: withdrawing keeps it in the history",children:"Withdraw"})]}),f&&c("p",{style:{margin:"8px 0",fontSize:15},className:r?"ended":"",children:qb(f[1])}),g.length>0&&c("dl",{className:"kv",style:{marginTop:6},children:g.map(([E,ae])=>c("div",{style:{display:"contents"},children:[c("dt",{children:E.replace(/_/g," ")}),c("dd",{children:qb(ae)})]},E))}),c("div",{className:"spread",style:{marginTop:6},children:[c("p",{className:"faint",style:{margin:0},children:["In ",n.where]}),t&&c("div",{className:"row",children:[c("button",{className:"link",onClick:()=>t("explorer"),children:"Explore graph"}),c("button",{className:"link",onClick:()=>t("console"),children:"Console"})]})]}),r&&c("p",{className:"notice",children:r}),i&&c("p",{className:"notice bad",children:i})]})}var Bb={console:Db,contexts:Ub,explorer:Vb,receipt:Hb,conflicts:Zb},Jb={explorer:"explore_context",console:"open_console"};function vS(){let e=Rb(),[t,n]=j(),[r,o]=j();if(!e)return c("p",{className:"faint",children:"Connecting\u2026"});if("error"in e)return c("p",{className:"notice bad",children:e.error});if(e.failed)return c("p",{className:"notice bad",children:e.failed});let i=async l=>{let p=e.app.getHostContext(),h=l.find(d=>p?.availableDisplayModes?.includes(d));h&&p?.displayMode!==h&&await e.app.requestDisplayMode({mode:h}).catch(()=>{})},s=async l=>{o(void 0);try{n({view:l,data:await e.call(Jb[l])}),await i(["fullscreen","pip"])}catch(p){if(!(p instanceof Ot))return o(p.message);await e.say(an(Jb[l],{}))}},a=async()=>{n(void 0),await i(["inline"])};if(t){let l=Bb[t.view];return c(be,{children:[c("div",{className:"spread",style:{marginBottom:6},children:c("button",{className:"link",onClick:a,children:"\u2190 Back to what was written"})}),c(l,{b:{...e,data:t.data}})]})}let u=Bb[window.__VINE_VIEW__??""];return u?c(be,{children:[c(u,{b:e,open:s}),r&&c("p",{className:"notice bad",children:r})]}):c("p",{className:"notice bad",children:"Unknown view."})}m_(document.getElementById("root")).render(c(vS,{}));})();
122
+ </script>
123
+ </body>
124
+ </html>