@kubitnodes/stellaris 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +108 -18
- package/dist/server/index.js +179 -36
- package/package.json +1 -1
- package/web/dist/assets/{BackLink-Cr1RWb4K.js → BackLink-DrYyD7II.js} +1 -1
- package/web/dist/assets/{ChannelView-iK3ug1lV.js → ChannelView-B2sufhRs.js} +1 -1
- package/web/dist/assets/CitizenView-B9u0X7ZY.js +2 -0
- package/web/dist/assets/{CitizensView-CFrD6f7m.js → CitizensView-B60Z7gmH.js} +1 -1
- package/web/dist/assets/KnowledgeView-Cppc2D7_.js +1 -0
- package/web/dist/assets/{Markdown-CYcTTxcR.js → Markdown-B390nfRS.js} +1 -1
- package/web/dist/assets/{MessageItem-DDC_1Jqn.js → MessageItem-D54BS9OS.js} +1 -1
- package/web/dist/assets/MetricsView-CsoRuj4g.js +1 -0
- package/web/dist/assets/{NeedsYouView-I7j_cnda.js → NeedsYouView-BPjjyZRx.js} +1 -1
- package/web/dist/assets/{Overview-DI7LPNEY.js → Overview-BWEXLQaq.js} +1 -1
- package/web/dist/assets/{Pane-BNjb76U4.js → Pane-DvocjNie.js} +1 -1
- package/web/dist/assets/ProjectView-BIC7kE4L.js +1 -0
- package/web/dist/assets/{ProposalView-DrP3Cv9y.js → ProposalView-cPi-EUXR.js} +1 -1
- package/web/dist/assets/{ProposalsView-90rufsQN.js → ProposalsView-Bq7iCMtk.js} +1 -1
- package/web/dist/assets/{RunnersView-iMbemuCe.js → RunnersView-BiJmbsoG.js} +1 -1
- package/web/dist/assets/{SocietyView-C9FdIFZY.js → SocietyView-6iPyxKze.js} +1 -1
- package/web/dist/assets/{SubjectThread-Bw6wEJpH.js → SubjectThread-D2BHnecl.js} +1 -1
- package/web/dist/assets/{TaskFileView-D0n7kzt2.js → TaskFileView-DDs6OHWY.js} +1 -1
- package/web/dist/assets/{TaskView-BZ6U_XpQ.js → TaskView-3_2vs2fy.js} +1 -1
- package/web/dist/assets/{TasksView-CtGF3i-n.js → TasksView-B7a0sWKu.js} +1 -1
- package/web/dist/assets/{ThreadCard-FPtAzvNM.js → ThreadCard-9h03aKCB.js} +1 -1
- package/web/dist/assets/{ThreadForms-LFw2EF6r.js → ThreadForms-uORhDqAo.js} +1 -1
- package/web/dist/assets/{ThreadView-DnDx2SCv.js → ThreadView-DVSe1HGK.js} +1 -1
- package/web/dist/assets/{citizen-Bm_r8vBY.js → citizen-CDTy3g7f.js} +1 -1
- package/web/dist/assets/format-C6tBTRKZ.js +55 -0
- package/web/dist/assets/index-CugUsWCm.js +23 -0
- package/web/dist/assets/{tasks-tFehkpRz.js → tasks-Bh3GaY7V.js} +1 -1
- package/web/dist/assets/{useStickyScroll-XrG6M-hT.js → useStickyScroll-C6bu36lV.js} +1 -1
- package/web/dist/index.html +3 -3
- package/web/dist/assets/CitizenView-BiaYYmCh.js +0 -2
- package/web/dist/assets/KnowledgeView-CR3cXdj0.js +0 -1
- package/web/dist/assets/MetricsView-xdvE7pFA.js +0 -1
- package/web/dist/assets/ProjectView-DYDcDsWg.js +0 -1
- package/web/dist/assets/format-Cj7NW9Y9.js +0 -55
- package/web/dist/assets/index-CthEgIzf.js +0 -23
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dt as e,ut as t}from"./format-
|
|
1
|
+
import{dt as e,ut as t}from"./format-C6tBTRKZ.js";var n=[{phase:`returned`,label:`Sent back`},{phase:`waiting`,label:`Waiting for a holder`},{phase:`working`,label:`Being worked`},{phase:`landing`,label:`Landing`},{phase:`done`,label:`Done`},{phase:`abandoned`,label:`Abandoned`}],r={returned:`bg-orange-500/15 text-orange-300`,waiting:`bg-amber-500/15 text-amber-300`,working:`bg-emerald-500/15 text-emerald-300`,landing:`bg-sky-500/15 text-sky-300`,done:`bg-surface-2 text-fg-secondary`,abandoned:`bg-surface-2 text-fg-muted`};function i(e){return e.status===`done`||e.status===`abandoned`?e.status:e.completing?`landing`:e.returned===void 0?e.status===`claimed`?`working`:`waiting`:`returned`}function a(e,t){let n=i(e);return t.id===e.stage&&n!==`landing`&&n!==`done`&&n!==`abandoned`}function o(e){let t=i(e);return t!==`done`&&t!==`abandoned`}function s(e,t){return e.stages.find(e=>e.id===t)?.name??t}function c(e,n){if(!t(e))return e.action===`approved`?{text:`approved`,tone:r.working}:{text:`rejected`,tone:`bg-red-500/15 text-red-300`};let i=e=>n===void 0?e:s(n,e);if(e.action===`advanced`)return{text:e.to===null?`finished ${i(e.stage)}`:`finished ${i(e.stage)} → ${i(e.to)}`,tone:r.working};if(e.action===`returned`){let t=e.to===null?`an earlier stage`:i(e.to);return{text:`sent back from ${i(e.stage)} to ${t}`,tone:r.returned}}return e.action===`abandoned`?{text:`abandoned`,tone:r.abandoned}:e.action===`landed`?{text:`landed`,tone:r.landing}:{text:`landing failed · back at ${i(e.stage)}`,tone:`bg-red-500/15 text-red-300`}}function l(e){return e.agent===void 0?e.role===void 0?`anyone in the project`:`any ${e.role}`:e.agent}function u(e){return n.map(({phase:t})=>({phase:t,tasks:e.filter(e=>i(e)===t).toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt))})).filter(e=>e.tasks.length>0)}function d(t){let n=i(t);return n===`done`?`All ${t.stages.length} stages done`:n===`abandoned`?`Abandoned`:`Stage ${e(t,t.stage)+1} of ${t.stages.length}`}export{o as a,d as c,u as i,s as l,r as n,a as o,l as r,i as s,n as t,c as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pn as e,un as t}from"./format-
|
|
1
|
+
import{pn as e,un as t}from"./format-C6tBTRKZ.js";var n=e(t(),1);function r(){let e=(0,n.useRef)(null),t=(0,n.useRef)(!0);return(0,n.useLayoutEffect)(()=>{let n=e.current;n!==null&&t.current&&(n.scrollTop=n.scrollHeight)}),{ref:e,onScroll:()=>{let n=e.current;n!==null&&(t.current=n.scrollHeight-n.scrollTop-n.clientHeight<80)}}}export{r as t};
|
package/web/dist/index.html
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
<meta name="color-scheme" content="dark" />
|
|
7
7
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
8
8
|
<title>Stellaris</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/format-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/tasks-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-CugUsWCm.js"></script>
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/format-C6tBTRKZ.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/tasks-Bh3GaY7V.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-D4oCtkuZ.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body class="antialiased">
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{D as e,E as t,H as n,I as r,L as i,P as a,R as o,T as s,a as c,cn as l,ct as u,d,f,g as p,h as m,ln as h,pn as g,t as _,u as v,un as y,v as b,w as x,y as S}from"./format-Cj7NW9Y9.js";import{B as C,H as w,R as T,S as E,T as D,V as O,_ as ee,c as k,f as A,g as te,h as ne,i as re,m as j,p as M,v as N,x as P,y as F}from"./index-CthEgIzf.js";import{t as I}from"./Markdown-CYcTTxcR.js";import{n as L,t as ie}from"./Pane-BNjb76U4.js";import{n as ae,r as R}from"./ThreadForms-LFw2EF6r.js";import{t as oe}from"./useStickyScroll-XrG6M-hT.js";import{a as z,c as se,i as B,l as V,n as ce,o as H,s as le,t as ue}from"./citizen-Bm_r8vBY.js";var U=g(y(),1),W=h(),de={completed:`completed`,timeout:`timed out`,error:`failed`,interrupted:`was interrupted`,blocked:`was blocked`,stopped:`was stopped by you`};function G(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}function K({label:e,tone:t,children:n}){return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`px-0.5 pb-0.5 text-[10px] tracking-wider text-fg-muted uppercase`,children:e}),(0,W.jsx)(`pre`,{className:`max-h-72 overflow-auto rounded-md bg-surface-0/60 p-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words ${t}`,children:n})]})}function fe({step:e,open:t}){if(e.kind===`say`)return(0,W.jsx)(`li`,{className:`py-1.5 text-sm`,title:G(e.at),children:(0,W.jsx)(I,{text:e.text})});if(e.kind===`error`)return(0,W.jsx)(`li`,{className:`py-1 font-mono text-xs break-words text-red-400`,title:G(e.at),children:e.message});if(e.kind===`steer`)return(0,W.jsx)(`li`,{children:(0,W.jsxs)(`details`,{open:t,className:`group rounded-md open:bg-surface-2/30`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-md px-1.5 py-1 text-xs hover:bg-surface-2/40`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`grid w-3 shrink-0 place-items-center text-sky-300`,children:`↳`}),(0,W.jsxs)(`span`,{className:`shrink-0 text-fg-tertiary`,children:[`Took `,ne(e.posts.length)]}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-secondary`,children:e.from.length===0?``:`from ${e.from.join(`, `)}, delivered mid-turn`}),(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-fg-muted`,children:G(e.at)})]}),(0,W.jsx)(`ul`,{className:`space-y-1.5 px-1.5 pb-1.5`,children:e.posts.map(e=>(0,W.jsxs)(`li`,{className:`rounded-md bg-surface-0/40 px-2.5 py-2`,children:[(0,W.jsxs)(`p`,{className:`flex gap-1.5 text-meta`,children:[(0,W.jsx)(`span`,{className:`text-fg-secondary`,children:e.author}),(0,W.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`in `,e.where]}),e.at===``?null:(0,W.jsx)(`span`,{className:`ml-auto shrink-0 font-mono`,children:G(e.at)})]}),(0,W.jsx)(`div`,{className:`mt-1 text-sm`,children:(0,W.jsx)(I,{text:e.body})})]},`${e.at}-${e.author}`))})]})});let n=e.ok===null?(0,W.jsx)(`span`,{"aria-label":`running`,className:`size-1.5 animate-pulse rounded-full bg-amber-300`}):e.ok?(0,W.jsx)(`span`,{"aria-label":`succeeded`,className:`text-[11px] text-emerald-400`,children:`✓`}):(0,W.jsx)(`span`,{"aria-label":`failed`,className:`text-[11px] text-red-400`,children:`✕`});return(0,W.jsx)(`li`,{children:(0,W.jsxs)(`details`,{open:t,className:`group rounded-md open:bg-surface-2/30`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-md px-1.5 py-1 text-xs hover:bg-surface-2/40`,children:[(0,W.jsx)(`span`,{className:`grid w-3 shrink-0 place-items-center`,children:n}),(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-fg-tertiary`,children:te(e.name)}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-fg-secondary`,children:e.summary}),(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-fg-muted`,children:G(e.at)})]}),(0,W.jsxs)(`div`,{className:`space-y-1.5 px-1.5 pb-1.5`,children:[(0,W.jsx)(K,{label:`Input`,tone:`text-fg-secondary`,children:e.detail}),e.output===null?null:(0,W.jsx)(K,{label:e.ok===!1?`Returned an error`:`Returned`,tone:e.ok===!1?`text-red-300`:`text-fg-tertiary`,children:e.output})]})]})})}function q({steps:e}){let[t,n]=(0,U.useState)(!1),r=e.filter(e=>e.kind===`tool`).length;return e.length===0?(0,W.jsx)(`p`,{className:`mt-2 text-meta`,children:`No steps yet.`}):(0,W.jsxs)(W.Fragment,{children:[r===0?null:(0,W.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-meta`,children:[r===1?`1 tool call`:`${r} tool calls`,(0,W.jsx)(`button`,{type:`button`,onClick:()=>n(!t),className:`rounded-md px-1.5 py-0.5 text-fg-tertiary transition-colors hover:bg-surface-2/60 hover:text-fg-primary`,children:t?`Collapse all`:`Expand all`})]}),(0,W.jsx)(`ol`,{className:`mt-1 space-y-0.5`,children:e.map(e=>(0,W.jsx)(fe,{step:e,open:t},e.seq))})]})}function pe({turn:e,running:t,now:n}){return e.end===null?t?(0,W.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-meta`,"aria-live":`polite`,children:[(0,W.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-emerald-400`}),`Working · last step `,_(e.lastAt,n)]}):(0,W.jsx)(`p`,{className:`mt-3 text-meta`,children:`The turn ended without a report.`}):(0,W.jsxs)(`section`,{className:`mt-3 rounded-xl bg-surface-2/40 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`,children:[(0,W.jsxs)(`p`,{className:`text-caps`,children:[`The turn `,de[e.end.exitReason],` `,_(e.end.at,n),e.fromStart?` · ${M(e.startedAt,Date.parse(e.end.at))}`:``]}),e.end.summary===null?null:(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-secondary`,children:e.end.summary})]})}var me=30,he={turn:`turn`,board:`board`,merge:`both kept`},ge={turn:`Changed by a turn`,board:`Written by the board`,merge:`Both versions kept`};function _e(e){return e.status===`added`?`new`:e.status===`deleted`?`deleted`:e.added===null||e.removed===null?`binary`:`+${e.added} −${e.removed}`}function ve(e){return e.files.map(e=>`${e.path} ${_e(e)}`).join(`, `)}function ye(e){return e.startsWith(`@@`)||e.startsWith(`\\`)?`text-fg-muted`:e.startsWith(`+`)?`text-emerald-300`:e.startsWith(`-`)?`text-red-300`:`text-fg-tertiary`}function be({file:e}){return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`p`,{className:`text-xs text-fg-secondary`,children:[e.path,e.status===`modified`?``:(0,W.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,e.status]})]}),e.patch===null?(0,W.jsx)(`p`,{className:`mt-1 text-meta`,children:`A binary file; its contents are not shown.`}):e.patch===``?(0,W.jsx)(`p`,{className:`mt-1 text-meta`,children:`Empty.`}):(0,W.jsx)(`pre`,{className:`mt-1 max-h-96 overflow-auto rounded-md bg-surface-0/60 p-2 font-mono text-[11px] leading-relaxed`,children:e.patch.split(`
|
|
2
|
-
`).map((e,t)=>(0,W.jsx)(`span`,{className:`block whitespace-pre-wrap break-words ${ye(e)}`,children:e===``?` `:e},t))}),e.truncated?(0,W.jsx)(`p`,{className:`mt-1 text-meta`,children:`The rest of this file's change is cut.`}):null]})}function xe({name:e,change:t}){let n=v(e,t.commit,!0);return(0,W.jsxs)(`div`,{className:`space-y-3 px-4 pt-1 pb-3`,children:[(0,W.jsxs)(`p`,{className:`text-xs text-fg-secondary`,children:[t.kind===`merge`?`Two turns on different runners changed the same lines at once. The file kept one turn's version, and this copy holds the other's until the citizen reconciles them.`:t.kind===`board`?`Written by the board: ${t.subject.replace(/^home: /,``)}.`:t.turnId===void 0?t.subject:(0,W.jsx)(T,{to:`/citizen/$name`,params:{name:e},search:{tab:`turns`,turn:t.turnId},className:`text-fg-secondary underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Open the turn that made it`}),(0,W.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,G(t.at)]})]}),n.data===void 0?(0,W.jsx)(`p`,{className:`text-meta`,children:n.isError?`Could not read the change.`:`Reading the change…`}):n.data.map(e=>(0,W.jsx)(be,{file:e},e.path))]})}function Se({name:e,change:t,now:n}){let[r,i]=(0,U.useState)(!1),a=t.files.length===0?t.subject:ve(t);return(0,W.jsx)(`li`,{className:`border-b border-line/60 last:border-b-0`,children:(0,W.jsxs)(`details`,{className:`group`,onToggle:e=>i(e.currentTarget.open),children:[(0,W.jsx)(`summary`,{"aria-label":`${ge[t.kind]} ${_(t.at,n)}: ${a}`,className:`block cursor-pointer list-none px-4 py-2.5 transition-colors hover:bg-surface-2/30 group-open:bg-surface-2/20`,children:(0,W.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,W.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:he[t.kind]}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-secondary`,children:a}),(0,W.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:_(t.at,n)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-fg-muted transition-transform group-open:rotate-90`,children:`▸`})]})}),r?(0,W.jsx)(xe,{name:e,change:t}):null]})})}function Ce({name:e}){let[t,n]=(0,U.useState)(me),r=f(e,t),i=S(3e4);if(r.data===void 0)return(0,W.jsx)(L,{children:r.isError?`Could not read the home's history.`:`Reading the history…`});let{changes:a,more:o}=r.data;return a.length===0?(0,W.jsxs)(L,{children:[e,`'s home has no history yet; it starts with the citizen's first turn.`]}):(0,W.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[(0,W.jsxs)(`p`,{className:`px-4 pt-3 pb-1 text-meta`,children:[`What `,e,`'s turns changed in its memory, skills, and profile, newest first.`]}),(0,W.jsx)(`ol`,{children:a.map(t=>(0,W.jsx)(Se,{name:e,change:t,now:i},t.commit))}),o?(0,W.jsx)(`button`,{type:`button`,onClick:()=>n(t+me),className:`px-4 py-3 text-xs text-fg-tertiary hover:text-fg-primary`,children:`Show earlier changes`}):null]})}function J({title:e,children:t}){return(0,W.jsxs)(`section`,{className:`border-t border-line pt-4 first:border-t-0 first:pt-0`,children:[(0,W.jsx)(`h3`,{className:`text-section`,children:e}),(0,W.jsx)(`div`,{className:`mt-2`,children:t})]})}function we({member:e,charter:t}){let n=p(e.name),r=c(e.name),i=d(e.name),a=S(3e4);return(0,W.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[i.data===void 0||i.data.length===0?null:(0,W.jsxs)(J,{title:`Edits to reconcile`,children:[(0,W.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`Two turns on different runners changed these files at once. Each file kept one version; the other waits beside it until `,e.name,` merges it in and deletes the copy.`]}),(0,W.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:i.data.map(e=>(0,W.jsxs)(`li`,{className:`text-sm`,children:[(0,W.jsx)(`span`,{className:`text-fg-primary`,children:e.file}),(0,W.jsxs)(`span`,{className:`text-meta`,children:[` `,`· `,e.path.slice(e.path.lastIndexOf(`/`)+1),` · left`,` `,_(e.since,a)]})]},e.path))})]}),(0,W.jsx)(J,{title:`Profile`,children:e.profile.trim()===``?(0,W.jsx)(`p`,{className:`text-meta`,children:`No profile yet. The citizen writes its own profile.md.`}):(0,W.jsx)(I,{text:V(e.profile,`Profile`)})}),(0,W.jsx)(J,{title:`Core memory`,children:n.data===void 0?(0,W.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):n.data.body.trim()===``?(0,W.jsx)(`p`,{className:`text-meta`,children:`Empty. Every turn loads this file in full.`}):(0,W.jsx)(I,{text:V(n.data.body,`Core memory`)})}),(0,W.jsx)(J,{title:`Own skills`,children:r.data===void 0?(0,W.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):r.data.length===0?(0,W.jsx)(`p`,{className:`text-meta`,children:`None yet.`}):(0,W.jsx)(`ul`,{className:`space-y-1.5`,children:r.data.map(e=>(0,W.jsxs)(`li`,{className:`text-sm`,children:[(0,W.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),e.summary===``?null:(0,W.jsxs)(`span`,{className:`text-fg-secondary`,children:[` · `,e.summary]})]},e.name))})}),t===void 0?null:(0,W.jsxs)(J,{title:`Charter of ${t.name}`,children:[(0,W.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:t.purpose}),(0,W.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Wakes on mentions, stages, and `,t.wakeTriggers.join(`, `)||`nothing else`,t.resident?` · keeps a warm session`:``,t.reflects?` · reflects`:``]}),(0,W.jsx)(`p`,{className:`mt-2 flex flex-wrap gap-1`,children:t.verbs.map(e=>(0,W.jsx)(`span`,{className:`rounded-md bg-surface-2/70 px-1.5 py-px font-mono text-[11px] text-fg-tertiary`,children:e},e))})]})]})}function Te(e,t){let n=r(e,t?.turnId??null);return{turn:(0,U.useMemo)(()=>t===void 0||n.data===void 0?void 0:ee(n.data,e,t.project,t.thread),[t,n.data,e]),loading:t?.turnId!==void 0&&n.isPending,missing:t!==void 0&&(t.turnId===void 0||n.isError)}}var Y=50;function Ee({name:e,entry:t,now:n,opened:r}){let[i,a]=(0,U.useState)(r),o=(0,U.useRef)(null);(0,U.useEffect)(()=>{r&&o.current?.scrollIntoView({block:`start`})},[r]);let s=E(),c=le(t),l=t.thread===void 0?null:s.get(t.thread)?.title??`a thread`,u=t.error??t.summary??``,d=t.error===null?`text-fg-secondary`:`text-red-300`;return(0,W.jsx)(`li`,{ref:o,className:`border-b border-line/60 last:border-b-0`,children:(0,W.jsxs)(`details`,{className:`group`,open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,W.jsxs)(`summary`,{className:`block cursor-pointer list-none px-4 py-2.5 transition-colors hover:bg-surface-2/30 group-open:bg-surface-2/20`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,W.jsxs)(`span`,{className:`min-w-0 truncate text-fg-secondary`,children:[B(t.project),l===null?``:` · ${l}`]}),(0,W.jsx)(`span`,{className:`text-fg-muted`,children:t.trigger}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-fg-muted`,children:[ue(t),` `,_(t.ts,n)]}),(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-tertiary`,title:t.usage===void 0?void 0:z(t.usage),children:[c,t.toolCalls===void 0?null:`${t.toolCalls} tools`,t.usage===void 0?null:H(t.usage)].filter(e=>e!==null).join(` · `)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-fg-muted transition-transform group-open:rotate-90`,children:`▸`})]}),u.trim()===``?null:(0,W.jsx)(`span`,{className:`mt-1 line-clamp-2 block text-xs leading-relaxed group-open:hidden ${d}`,children:(0,W.jsx)(P,{text:u,links:!1})})]}),i?(0,W.jsx)(De,{name:e,entry:t,text:u,tone:d}):null]})})}function De({name:e,entry:t,text:n,tone:r}){let i=Te(e,t);return(0,W.jsxs)(`div`,{className:`px-4 pt-1 pb-3`,children:[n.trim()===``?null:(0,W.jsx)(`p`,{className:`text-xs leading-relaxed whitespace-pre-wrap ${r}`,children:(0,W.jsx)(P,{text:n})}),(0,W.jsx)(`div`,{className:`mt-2`,children:t.turnId===void 0?(0,W.jsx)(`p`,{className:`text-meta`,children:`This turn ran before turns kept their steps.`}):i.loading?(0,W.jsx)(`p`,{className:`text-meta`,children:`Reading the steps…`}):i.turn===void 0?(0,W.jsx)(`p`,{className:`text-meta`,children:`No steps were kept for this turn.`}):(0,W.jsxs)(W.Fragment,{children:[t.startedAt===void 0?null:(0,W.jsxs)(`p`,{className:`text-caps`,children:[`Started `,G(t.startedAt)]}),(0,W.jsx)(q,{steps:i.turn.steps})]})})]})}function Oe({name:e,opened:t}){let[n,r]=(0,U.useState)(Y),a=i(e,n),o=S(3e4);if(a.data===void 0)return(0,W.jsx)(L,{children:`Reading the turns…`});let s=a.data.toReversed();if(s.length===0)return(0,W.jsxs)(L,{children:[e,` has not finished a turn yet.`]});let c=ce(s),l=c.usage===null?``:` · ${H(c.usage)}${c.withUsage<c.turns?` over ${c.withUsage} of them`:``}`;return(0,W.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[(0,W.jsxs)(`p`,{className:`px-4 pt-3 pb-1 text-meta`,title:c.usage===null?void 0:z(c.usage),children:[c.turns===1?`1 turn`:`${c.turns} turns`,c.failed===0?``:`, ${c.failed} not completed`,l]}),t!==null&&!s.some(e=>e.turnId===t)?(0,W.jsx)(`p`,{className:`px-4 pb-1 text-meta`,children:a.data.length===n?`The turn this address opens is further back; show earlier turns to reach it.`:`The turn this address opens is not in this citizen's history.`}):null,(0,W.jsx)(`ol`,{children:s.map(n=>(0,W.jsx)(Ee,{name:e,entry:n,now:o,opened:t!==null&&n.turnId===t},n.id))}),a.data.length===n?(0,W.jsxs)(`button`,{type:`button`,onClick:()=>r(n+Y),className:`px-4 py-3 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show `,Y,` earlier turns`]}):null]})}function ke(e){return e===void 0?``:`${e.name}${e.id===null?``:` · ${e.id}`}`}function X({label:e,choices:t,value:n,onChange:r,listClassName:i=`inset-x-0`}){let[a,o]=(0,U.useState)(!1),s=(0,U.useRef)(null),c=(0,U.useRef)(null),l=(0,U.useRef)([]),u=t.findIndex(e=>e.value===n);(0,U.useEffect)(()=>{if(!a)return;l.current[Math.max(u,0)]?.focus();let e=e=>{e.target instanceof Node&&s.current?.contains(e.target)===!0||o(!1)};return window.addEventListener(`pointerdown`,e),()=>window.removeEventListener(`pointerdown`,e)},[a,u]);let d=e=>{if(e.key===`Escape`){e.stopPropagation(),o(!1),c.current?.focus();return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let n=(l.current.findIndex(e=>e===document.activeElement)+(e.key===`ArrowDown`?1:-1)+t.length)%t.length;l.current[n]?.focus()},f=t[u];return(0,W.jsxs)(`div`,{ref:s,className:`relative min-w-0 flex-1`,children:[(0,W.jsxs)(`button`,{ref:c,type:`button`,"aria-label":`${e}: ${ke(f)}`,"aria-expanded":a,onClick:()=>o(!a),onKeyDown:a?d:void 0,className:`flex h-7 w-full items-center gap-1.5 rounded-md bg-surface-2/60 px-2.5 text-xs text-fg-secondary transition-colors hover:bg-surface-2 focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:[(0,W.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:[f?.name,f?.id===null||f===void 0?null:(0,W.jsxs)(`span`,{className:`text-fg-tertiary`,children:[` · `,f.id]})]}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`text-[10px] text-fg-muted transition-transform ${a?`rotate-180`:``}`,children:`▾`})]}),a?(0,W.jsx)(`div`,{className:`absolute ${i} top-full z-20 mt-1 max-h-80 overflow-y-auto rounded-xl bg-surface-1/95 p-1 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.08),0_16px_32px_-12px_rgba(0,0,0,0.8)] backdrop-blur-xl`,children:t.map((e,t)=>{let i=e.value===n;return(0,W.jsxs)(`button`,{ref:e=>{l.current[t]=e},type:`button`,"aria-current":i?`true`:void 0,onKeyDown:d,onClick:()=>{r(e.value),o(!1),c.current?.focus()},className:`flex w-full items-start gap-2 rounded-lg px-2.5 py-1.5 text-left transition-colors focus-visible:outline-none ${i?`bg-surface-2/80`:`hover:bg-surface-2/50 focus-visible:bg-surface-2/50`}`,children:[(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`span`,{className:`block truncate text-xs text-fg-secondary`,children:[e.name,e.id===null?null:(0,W.jsxs)(`span`,{className:`text-fg-tertiary`,children:[` · `,e.id]})]}),e.description===``?null:(0,W.jsx)(`span`,{className:`block truncate text-[11px] text-fg-muted`,children:e.description})]}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`w-3 shrink-0 pt-px text-[11px] text-fg-primary`,children:i?`✓`:``})]},e.value)})}):null]})}var Z=``,Q=``;function Ae(e,t){return[{value:Z,name:`CLI default`,id:e.find(e=>e.isDefault)?.name??null,description:`Whatever the CLI runs when no model is set.`},...e.map(e=>({value:e.id,name:e.name,id:e.name===e.id?null:e.id,description:e.description})),...t===null?[]:[{value:t,name:t,id:null,description:`Not in the CLI's list.`}]]}function je(e,t){return[{value:Q,name:`Default`,id:e?.defaultEffort??null,description:`Whatever the model runs unset.`},...(e?.efforts??[]).map(e=>({value:e.id,name:e.id,id:null,description:e.description})),...t===null?[]:[{value:t,name:t,id:null,description:`Not in the model's list.`}]]}function Me({member:t,onDone:n}){let{api:r}=e(),i=l(),a=b(t.cli),s=t.model??Z,c=t.effort??Q,[u,d]=(0,U.useState)(s),[f,p]=(0,U.useState)(c),m=w({mutationFn:async()=>{u!==s&&await r.setModel(t.name,u===Z?null:u),f!==c&&await r.setEffort(t.name,f===Q?null:f)},onSettled:()=>void i.invalidateQueries({queryKey:[`members`]}),onSuccess:n}),h=a.data??[],g=t.model!==void 0&&!h.some(e=>e.id===t.model)?t.model:null,_=e=>h.find(t=>e===Z?t.isDefault:t.id===e),v=_(u)?.efforts??[],y=f!==Q&&!v.some(e=>e.id===f)?f:null,x=e=>{d(e);let t=_(e)?.efforts??[];f!==Q&&!t.some(e=>e.id===f)&&p(Q)},S=u!==s||f!==c;return(0,W.jsxs)(`form`,{"aria-label":`Model of ${t.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),m.mutate()},children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a.isPending?(0,W.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:[`Asking `,t.cli,` for its models…`]}):a.error===null?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:`Model`,choices:Ae(h,g),value:u,onChange:x}),v.length===0&&y===null?null:(0,W.jsx)(`div`,{className:`flex w-32 shrink-0`,children:(0,W.jsx)(X,{label:`Effort`,choices:je(_(u),y),value:f,onChange:p,listClassName:`right-0 w-64`})})]}):(0,W.jsxs)(`p`,{role:`alert`,className:`min-w-0 flex-1 truncate text-xs text-red-400`,children:[t.cli,` did not list its models:`,` `,a.error instanceof o?a.error.message:`the board server did not answer`]}),(0,W.jsx)(k,{onClick:n,children:`Cancel`}),(0,W.jsx)(k,{variant:`primary`,type:`submit`,disabled:m.isPending||!S||a.error!==null,children:m.isPending?`Saving…`:`Save`})]}),(0,W.jsx)(R,{error:m.error})]})}var $=``;function Ne(e,t){let n=t.cli;return[e.status,e.clis.length===0?`offers no CLI yet`:e.clis.join(`, `),n!==null&&e.clis.length>0&&!e.clis.includes(n)?`has no ${n}`:``,e.capabilities.length===0?``:e.capabilities.join(`, `)].filter(e=>e!==``).join(` · `)}function Pe(e,t){return[{value:$,name:`Any runner`,id:null,description:`Pinned to the least busy runner on its next turn outside a project.`},...e.map(e=>({value:e.name,name:e.name,id:e.os,description:Ne(e,t)}))]}function Fe({member:t,onDone:n}){let{api:r}=e(),i=l(),a=s(),o=t.homeRunner??$,[c,u]=(0,U.useState)(o),d=w({mutationFn:()=>r.setRunner(t.name,c===$?null:c),onSuccess:()=>{i.invalidateQueries({queryKey:[`members`]}),n()}});return(0,W.jsxs)(`form`,{"aria-label":`Runner of ${t.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),d.mutate()},children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a.data===void 0?(0,W.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:`Reading the runners…`}):(0,W.jsx)(X,{label:`Runner`,choices:Pe(a.data,t),value:c,onChange:u}),(0,W.jsx)(k,{onClick:n,children:`Cancel`}),(0,W.jsx)(k,{variant:`primary`,type:`submit`,disabled:d.isPending||c===o,children:d.isPending?`Saving…`:`Run here`})]}),(0,W.jsx)(`p`,{className:`text-meta`,children:`Its conversations outside projects start afresh there from its next turn; its memory and skills follow it. Project work runs where each project lives.`}),(0,W.jsx)(R,{error:d.error})]})}function Ie(e){return e.thread===void 0?{channel:e.channel??(e.scope===`society`?`general`:`${e.scope}/general`)}:{threadId:e.thread}}function Le({name:t,turn:n}){let{api:r}=e(),i=l(),[a,o]=(0,U.useState)(!1),s=w({mutationFn:()=>r.stopTurn(n.turnId),onSuccess:()=>{o(!1),i.invalidateQueries({queryKey:[`scheduler`]})}});return(0,W.jsxs)(`div`,{className:`border-t border-line`,children:[(0,W.jsx)(re,{target:Ie(n),initialText:`@${t} `,placeholder:n.steerable?`Message ${t} while it works`:`Message ${t} for its next turn`,className:`px-3 pt-3 pb-2`},n.turnId),n.stoppable?(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pb-3`,children:[(0,W.jsx)(`p`,{className:`min-w-0 flex-1 text-[11px] leading-snug text-fg-muted`,children:a?`Ends the turn now. What it was shown counts as read; its stages stay held.`:n.steerable?`Posts reach the turn at its next step.`:`This runner delivers posts after the turn ends.`}),a?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(k,{onClick:()=>{o(!1),s.reset()},children:`Keep it running`}),(0,W.jsx)(k,{variant:`primary`,disabled:s.isPending,onClick:()=>{s.mutate()},children:s.isPending?`Stopping…`:`Stop the turn`})]}):(0,W.jsx)(k,{onClick:()=>o(!0),children:`Stop…`})]}):null,s.error===null?null:(0,W.jsx)(`div`,{className:`px-3 pb-3`,children:(0,W.jsx)(R,{error:s.error})})]})}function Re({member:t,scopes:n,preferred:r,running:i,paused:a,onDone:o}){let{api:s}=e(),c=l(),[u,d]=(0,U.useState)(`manual`),[f,p]=(0,U.useState)(r!==null&&n.includes(r)?r:n[0]??``),[m,h]=(0,U.useState)(``),g=(0,U.useRef)(null);(0,U.useEffect)(()=>g.current?.focus(),[]);let _=w({mutationFn:()=>s.wake({agent:t.name,project:f,kind:u,...m.trim()===``?{}:{reason:m.trim()}}),onSuccess:()=>{c.invalidateQueries({queryKey:[`scheduler`]}),o()}}),v=B(f),y=u===`reflection`?`Asks ${t.name} to reflect at ${v}: consolidate its memory, skills, and profile, and take no new work. It restarts the reflection clock.`:`Starts a turn for ${t.name} at ${v} as soon as the scheduler takes it.`,b=a?` The society is paused, so it waits until you resume.`:i.includes(f)?` ${t.name} is in a turn there now; this one follows it.`:``;return(0,W.jsxs)(`form`,{"aria-label":`Wake ${t.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),_.mutate()},children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsxs)(`fieldset`,{className:`flex gap-1`,children:[(0,W.jsx)(`legend`,{className:`sr-only`,children:`Kind of turn`}),[`manual`,`reflection`].map(e=>(0,W.jsxs)(`label`,{className:`cursor-pointer rounded-md px-2.5 py-1 text-xs transition-colors has-focus-visible:ring-2 has-focus-visible:ring-fg-primary/30 ${u===e?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[(0,W.jsx)(`input`,{type:`radio`,name:`kind`,value:e,checked:u===e,onChange:()=>d(e),className:`sr-only`}),e===`manual`?`A turn`:`A reflection`]},e))]}),(0,W.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-xs text-fg-tertiary`,children:[`at`,(0,W.jsx)(`select`,{value:f,onChange:e=>p(e.target.value),"aria-label":`Where`,className:`rounded-md bg-surface-2/60 px-2 py-1 text-xs text-fg-primary outline-none`,children:n.map(e=>(0,W.jsx)(`option`,{value:e,children:B(e)},e))})]})]}),(0,W.jsx)(`textarea`,{ref:g,value:m,rows:2,placeholder:u===`reflection`?`Anything to reflect on in particular? Optional.`:`What should it look at? It reads this as the reason it was woken.`,"aria-label":`Reason`,onChange:e=>h(e.target.value),className:`${ae} resize-none`}),(0,W.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-fg-muted`,children:[y,b,` Each turn costs money.`]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,W.jsx)(k,{onClick:o,children:`Cancel`}),(0,W.jsx)(k,{variant:`primary`,type:`submit`,disabled:_.isPending||f===``,children:_.isPending?`Waking…`:u===`reflection`?`Ask for a reflection`:`Wake ${t.name}`})]}),(0,W.jsx)(R,{error:_.error})]})}var ze={working:`bg-emerald-500/15 text-emerald-300`,queued:`bg-amber-500/15 text-amber-300`,idle:`bg-surface-2 text-fg-tertiary`};function Be({project:e,name:t}){let n=(a(e).data??[]).filter(e=>e.status===`claimed`&&e.claimedBy===t);return n.length===0?null:(0,W.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:n.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(T,{to:`/task/$taskId`,params:{taskId:e.id},className:`flex items-center gap-2 rounded-md text-xs text-fg-secondary hover:text-fg-primary`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◇`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,W.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate font-mono text-[11px] text-fg-muted`,children:u(e)?.name??e.stage})]})},e.id))})}function Ve(){let{name:e}=O({from:`/citizen/$name`}),{scope:t,tab:n,turn:r}=C({from:`/citizen/$name`});return(0,W.jsx)(Ue,{name:e,chosen:t??null,tab:n??`now`,turn:r??null},e)}var He=[{tab:`now`,label:`Now`},{tab:`turns`,label:`Turns`},{tab:`memory`,label:`Memory`},{tab:`history`,label:`History`}];function Ue({name:e,chosen:r,tab:i,turn:a}){let o=m(),s=x(),c=t(),l=F(),[u,d]=(0,U.useState)(null),f=o.data?.find(t=>t.name===e);if(f===void 0)return(0,W.jsx)(L,{children:o.data===void 0?`Reading the roster…`:`There is no citizen ${e}.`});let p=n(c.data?.running??[]).filter(t=>t.agent===e),h=[...new Set(p.map(e=>e.scope))],g=p.map(e=>j(e.agent,e.scope,e.thread)),_=n(c.data?.pending??[]).find(t=>t.agent===e),v=h.length>0?`working`:_===void 0?`idle`:`queued`,y=N(l,e)[0],b=y?.model??f.lastModel,S=b??f.model??`CLI default`,C=f.model!==void 0&&f.model!==b?f.model:null,w=s.data?.find(e=>e.name===f.role),E=se(f),O=f.status===`active`&&f.cli!==null;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ie,{leading:f.cli===null?null:(0,W.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-2/70`,children:(0,W.jsx)(D,{cli:f.cli,size:20})}),title:e,subtitle:(0,W.jsxs)(W.Fragment,{children:[f.role,` · `,S,C===null?``:` · set to ${C}`,f.effort===void 0?``:` · ${f.effort} effort`,f.homeRunner===void 0?``:` · on ${f.homeRunner}`,f.status===`retired`?` · retired`:``]}),trailing:(0,W.jsxs)(W.Fragment,{children:[O&&u===null?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(k,{onClick:()=>d(`model`),children:`Model…`}),(0,W.jsx)(k,{onClick:()=>d(`runner`),children:`Runner…`}),(0,W.jsx)(k,{onClick:()=>d(`wake`),children:`Wake…`})]}):null,(0,W.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${ze[v]}`,children:v})]})}),u===`wake`?(0,W.jsx)(Re,{member:f,scopes:E,preferred:r?.split(`/`)[0]??y?.scope??null,running:h,paused:c.data?.paused??!1,onDone:()=>d(null)}):u===`model`?(0,W.jsx)(Me,{member:f,onDone:()=>d(null)}):u===`runner`?(0,W.jsx)(Fe,{member:f,onDone:()=>d(null)}):null,(0,W.jsx)(`nav`,{"aria-label":`Citizen views`,className:`flex gap-1 border-b border-line px-3 py-2`,children:He.map(t=>(0,W.jsx)(T,{to:`/citizen/$name`,params:{name:e},search:{...r===null?{}:{scope:r},...t.tab===`now`?{}:{tab:t.tab}},replace:!0,"aria-current":t.tab===i?`page`:void 0,className:`rounded-md px-2.5 py-1 text-xs transition-colors ${t.tab===i?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:t.label},t.tab))}),i===`turns`?(0,W.jsx)(Oe,{name:e,opened:a},a):i===`memory`?(0,W.jsx)(we,{member:f,charter:w}):i===`history`?(0,W.jsx)(Ce,{name:e}):(0,W.jsx)(Ge,{name:e,chosen:r,lastTurnAt:f.lastTurnAt,state:v,runningScopes:h,runningKeys:g,runningTurns:(c.data?.turns??[]).filter(t=>t.agent===e),queuedScope:_?.scope??null})]})}function We(e){return e.toSorted((e,t)=>e.startedAt.localeCompare(t.startedAt))[0]}function Ge({name:e,chosen:t,lastTurnAt:n,state:r,runningScopes:a,runningKeys:o,runningTurns:s,queuedScope:c}){let l=F(),u=S(5e3),{ref:d,onScroll:f}=oe(),p=N(l,e),m=i(e,1),h=Te(e,p.length===0?m.data?.at(-1):void 0),g=E(),v=e=>e.end===null&&o.includes(j(e.agent,e.scope,e.thread)),y=t?.split(`/`)[0]??null,b=(t?.includes(`/`)===!0?p.find(e=>A(e)===t):void 0)??We(p.filter(e=>e.scope===y&&v(e)))??p.find(e=>A(e)===t)??We(p.filter(v))??p[0]??h.turn,x=e=>e.thread===void 0?B(e.scope):`${B(e.scope)} · ${g.get(e.thread)?.title??`a thread`}`,C=b!==void 0&&v(b),w=b?.scope??a[0]??c,D=(b===void 0?void 0:s.find(e=>e.scope===b.scope&&e.thread===b.thread))??(C?void 0:s[0]);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`section`,{className:`border-b border-line px-4 py-3 text-xs text-fg-tertiary`,children:[(0,W.jsx)(`p`,{children:C?`In a turn at ${B(b.scope)} for ${b.fromStart?``:`at least `}${M(b.startedAt,u)}`:a.length>0?`In a turn at ${a.map(B).join(` and `)}`:c===null?n===void 0?`No turns yet`:`Last turn ${_(n,u)}`:`Queued for a turn at ${B(c)}`}),w===null||w===`society`?null:(0,W.jsx)(Be,{project:w,name:e})]}),(0,W.jsx)(`div`,{ref:d,onScroll:f,className:`flex-1 overflow-y-auto px-4 py-3`,children:b===void 0?(0,W.jsx)(L,{children:r===`working`?`The turn has not reported a step yet.`:h.loading?`Reading the last turn…`:n===void 0?`${e} has not taken a turn yet.`:`${e}'s last turn kept no steps; Turns lists every finished one.`}):(0,W.jsxs)(W.Fragment,{children:[p.length>1?(0,W.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-1.5`,"aria-label":`Turns by conversation`,children:p.toSorted((e,t)=>A(e).localeCompare(A(t))).map(t=>(0,W.jsxs)(T,{to:`/citizen/$name`,params:{name:e},search:{scope:A(t)},replace:!0,"aria-current":t===b?`true`:void 0,className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-[11px] transition-colors ${t===b?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[v(t)?(0,W.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-emerald-400`}):null,x(t)]},A(t)))}):null,(0,W.jsxs)(`p`,{className:`text-caps`,children:[C?`This turn`:`Last turn`,` · `,x(b),` · started`,` `,b.fromStart?G(b.startedAt):`before the earliest step shown`]}),b.fromStart?null:(0,W.jsxs)(`p`,{className:`mt-1 text-meta`,children:[`Earlier steps of this turn are no longer in the server's live buffer`,C?``:`; Turns has the whole turn`,`.`]}),(0,W.jsx)(q,{steps:b.steps}),(0,W.jsx)(pe,{turn:b,running:C,now:u})]})}),D===void 0?null:(0,W.jsx)(Le,{name:e,turn:D})]})}export{Ve as CitizenView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e,ln as t,ot as n,p as r,t as i,y as a}from"./format-Cj7NW9Y9.js";import{R as o,V as s}from"./index-CthEgIzf.js";import{t as c}from"./Markdown-CYcTTxcR.js";import{n as l,t as u}from"./Pane-BNjb76U4.js";import{t as d}from"./BackLink-Cr1RWb4K.js";var f=t(),p=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`;function m(){let{scope:t,topic:m}=s({from:`/knowledge/$scope/$topic`}),h=r(t),g=e(),_=a(3e4),v=t===n,y=v?`the society`:g.data?.find(e=>e.slug===t)?.name??t,b=h.data?.find(e=>e.topic===m),x=v?(0,f.jsx)(o,{to:`/society`,"aria-label":`Back to the society`,className:p,children:`←`}):(0,f.jsx)(o,{to:`/p/$slug`,params:{slug:t},"aria-label":`Back to ${y}`,className:p,children:`←`});return b===void 0?(0,f.jsx)(l,{children:h.data===void 0?`Reading…`:`${y} has no topic ${m}.`}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u,{leading:(0,f.jsx)(d,{fallback:x}),title:b.topic,subtitle:`Knowledge of ${y} · written by ${b.updatedBy} ${i(b.updatedAt,_)}`}),(0,f.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:(0,f.jsx)(c,{text:b.body})})]})}export{m as KnowledgeView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{R as e,_ as t,ln as n,r,t as i,y as a}from"./format-Cj7NW9Y9.js";import{B as o,R as s,b as c,d as l}from"./index-CthEgIzf.js";import{n as u,t as d}from"./Pane-BNjb76U4.js";import{n as f}from"./Overview-DI7LPNEY.js";var p=n(),m=[{window:`24h`,label:`24 hours`},{window:`7d`,label:`7 days`},{window:`all`,label:`All time`}],h={stage:`a stage to take`,mention:`a mention`,user_post:`your post`,heartbeat:`a heartbeat`,task_done:`a finished task`,proposal_decided:`a decided proposal`,ops_event:`a signal`,onboarding:`joining`,manual:`your wake`},g=new Intl.DateTimeFormat(`en`,{month:`short`,day:`numeric`,timeZone:`UTC`});function _(e,t){return t===0?``:`${Math.round(e/t*100)}%`}function v(e){return e.toFixed(1).replace(/\.0$/,``)}function y({part:e,whole:t}){return(0,p.jsxs)(p.Fragment,{children:[e,(0,p.jsx)(`span`,{className:`ml-1.5 inline-block w-9 text-right text-fg-muted`,children:e===0?``:_(e,t)})]})}function b({children:e}){return(0,p.jsx)(`p`,{className:`text-sm text-fg-primary`,children:e})}function x({children:e}){return(0,p.jsx)(`p`,{className:`mt-1 text-meta`,children:e})}function S({label:e,columns:t,rows:n}){return n.length===0?null:(0,p.jsxs)(`table`,{"aria-label":e,className:`mt-3 w-full table-fixed text-sm`,children:[(0,p.jsxs)(`colgroup`,{children:[(0,p.jsx)(`col`,{}),t.slice(1).map(e=>(0,p.jsx)(`col`,{className:`w-24`},e))]}),(0,p.jsx)(`thead`,{children:(0,p.jsx)(`tr`,{children:t.map((e,t)=>(0,p.jsx)(`th`,{scope:`col`,className:`text-caps pb-1 font-normal ${t===0?`text-left`:`text-right`}`,children:e},e))})}),(0,p.jsx)(`tbody`,{children:n.map((e,t)=>(0,p.jsx)(`tr`,{className:`border-t border-line/50`,children:e.map((e,t)=>(0,p.jsx)(`td`,{className:`py-1.5 ${t===0?`pr-3 text-fg-primary`:`text-right text-fg-secondary tabular-nums`}`,children:e},t))},t))})]})}function C({name:e}){let t=l();return e===`user`?(0,p.jsx)(`span`,{children:t(e)}):(0,p.jsx)(s,{to:`/citizen/$name`,params:{name:e},className:`hover:underline`,children:e})}function w(e){return e.window===`24h`?1:e.window===`7d`?7:Math.max(1,e.decisions.byDay.length)}function T(){let{window:n=`7d`}=o({from:`/metrics`}),l=t(n),T=a(6e4),E=(0,p.jsx)(`nav`,{"aria-label":`Window`,className:`flex shrink-0 gap-1`,children:m.map(e=>(0,p.jsx)(s,{to:`/metrics`,search:{window:e.window},"aria-current":e.window===n?`page`:void 0,className:`rounded-md px-2 py-1 text-xs transition-colors ${e.window===n?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`}`,children:e.label},e.window))}),D=(0,p.jsx)(d,{title:`Metrics`,subtitle:`How the society works, counted from its event log`,trailing:E});if(l.data===void 0)return(0,p.jsxs)(p.Fragment,{children:[D,(0,p.jsx)(u,{children:l.error instanceof e?l.error.message:`Counting the event log…`})]});let{idle:O,sentBack:k,messages:A,latency:j,decisions:M,blocked:N}=l.data,P=w(l.data);return(0,p.jsxs)(p.Fragment,{children:[D,(0,p.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[(0,p.jsxs)(f,{title:`Turns that did nothing`,children:[O.turns===0?(0,p.jsx)(x,{children:`No finished turns in this window.`}):(0,p.jsxs)(b,{children:[O.idle,` of `,O.turns,` turns changed nothing on the board`,` `,(0,p.jsx)(`span`,{className:`text-fg-muted`,children:_(O.idle,O.turns)})]}),(0,p.jsxs)(x,{children:[`A turn that took no board action: no post, claim, handover, plan, proposal, decision, or knowledge. Reflections are left out, since they write memory.`,O.unknown>0?` ${O.unknown} ${O.unknown===1?`turn`:`turns`} kept no transcript and could not be counted.`:``]}),(0,p.jsx)(S,{label:`By what woke them`,columns:[`Woken by`,`Turns`,`Did nothing`],rows:O.byTrigger.map(e=>[h[e.trigger]??e.trigger,e.turns,(0,p.jsx)(y,{part:e.idle,whole:e.turns},`idle`)])}),(0,p.jsx)(S,{label:`By citizen`,columns:[`Citizen`,`Turns`,`Did nothing`],rows:O.byAgent.map(e=>[(0,p.jsxs)(`span`,{children:[(0,p.jsx)(C,{name:e.agent}),e.role===null?null:(0,p.jsxs)(`span`,{className:`text-meta`,children:[` · `,e.role]})]},`who`),e.turns,(0,p.jsx)(y,{part:e.idle,whole:e.turns},`idle`)])})]}),(0,p.jsxs)(f,{title:`Work sent back`,children:[k.finished===0?(0,p.jsx)(x,{children:`No task finished in this window.`}):(0,p.jsxs)(b,{children:[k.tasksSentBack,` of `,k.finished,` finished tasks were sent back,`,` `,k.sendBacks,` `,k.sendBacks===1?`time`:`times`,` in all`]}),(0,p.jsx)(S,{label:`Where work came back from`,columns:[`Came back from`,`Times`],rows:k.byStage.map(e=>[`${e.project} · ${e.stage}`,e.count])}),(0,p.jsx)(S,{label:`Who sent work back`,columns:[`Sent back by`,`Times`],rows:k.bySender.map(e=>[(0,p.jsx)(C,{name:e.agent},`who`),e.count])})]}),(0,p.jsxs)(f,{title:`Messages per finished task`,children:[A.finished===0?(0,p.jsx)(x,{children:`No task finished in this window.`}):(0,p.jsxs)(b,{children:[v(A.messages/A.finished),` posts a task, across`,` `,A.finished,` finished `,A.finished===1?`task`:`tasks`]}),(0,p.jsx)(x,{children:`Posts in each finished task's thread, handovers included, the board's own left out.`}),(0,p.jsx)(S,{label:`By project`,columns:[`Project`,`Tasks`,`Posts a task`],rows:A.byProject.map(e=>[e.project,e.finished,v(e.messages/e.finished)])}),(0,p.jsx)(S,{label:`Most talked-over tasks`,columns:[`Task`,`Posts`],rows:A.busiest.map(e=>[(0,p.jsx)(c,{kind:`task`,id:e.taskId,children:e.title},`task`),e.messages])})]}),(0,p.jsxs)(f,{title:`Wake latency`,children:[j.medianMs===null||j.slowestMs===null?(0,p.jsx)(x,{children:`No mention led to a turn in this window.`}):(0,p.jsxs)(b,{children:[r(j.medianMs),` from a mention to its turn, at the median; the slowest took`,` `,r(j.slowestMs)]}),(0,p.jsxs)(x,{children:[`From a post that mentions a citizen to the start of its turn in the same conversation, debounce included.`,j.unanswered>0?` ${j.unanswered} ${j.unanswered===1?`mention has`:`mentions have`} no turn yet.`:``]}),(0,p.jsx)(S,{label:`By citizen`,columns:[`Citizen`,`Mentions`,`Median`,`Slowest`],rows:j.byAgent.map(e=>[(0,p.jsx)(C,{name:e.agent},`who`),e.mentions,r(e.medianMs),r(e.slowestMs)])})]}),(0,p.jsxs)(f,{title:`Your decisions`,children:[M.total===0?(0,p.jsx)(x,{children:`You decided nothing in this window.`}):(0,p.jsxs)(b,{children:[M.total,` `,M.total===1?`decision`:`decisions`,`, about`,` `,v(M.total/P),` a day`]}),(0,p.jsx)(x,{children:`Proposals you decided, questions to you that you answered, and stages you passed or sent back.`}),(0,p.jsx)(S,{label:`By day`,columns:[`Day`,`Proposals`,`Answers`,`Stages`],rows:M.byDay.map(e=>[g.format(new Date(`${e.day}T00:00:00Z`)),e.proposals,e.answers,e.stages])})]}),(0,p.jsx)(f,{title:`Blocked on a capability`,children:N.length===0?(0,p.jsx)(x,{children:`No task waited for a capability no runner offers.`}):(0,p.jsx)(`ul`,{className:`space-y-2`,children:N.map(e=>(0,p.jsxs)(`li`,{children:[(0,p.jsxs)(`p`,{className:`text-sm text-fg-primary`,children:[(0,p.jsx)(c,{kind:`task`,id:e.taskId,children:e.title??e.taskId}),(0,p.jsx)(`span`,{className:e.holds?`text-amber-300`:`text-fg-muted`,children:e.holds?` · blocked now`:` · cleared`})]}),(0,p.jsxs)(`p`,{className:`text-meta`,children:[e.summary,` · since `,i(e.firstAt,T)]})]},e.taskId))})})]})]})}export{T as MetricsView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as e,b as t,c as n,h as r,ln as i,p as a,s as o,t as s,y as c}from"./format-Cj7NW9Y9.js";import{i as l,t as u}from"./tasks-tFehkpRz.js";import{R as d,V as f}from"./index-CthEgIzf.js";import{t as p}from"./Markdown-CYcTTxcR.js";import{n as m,t as h}from"./Pane-BNjb76U4.js";import{n as g,r as _,t as v}from"./Overview-DI7LPNEY.js";var y=i();function b(){let{slug:i}=f({from:`/p/$slug`}),b=t(),x=o(),S=r(),C=e(i),w=n(i),T=a(i),E=c(3e4),D=b.data?.find(e=>e.slug===i);if(D===void 0)return(0,y.jsx)(m,{children:b.data===void 0?`Reading the project…`:`There is no project ${i}.`});let O=(S.data??[]).filter(e=>e.status===`active`&&D.members.includes(e.name)),k=l(C.data??[]),A=w.data?.body.trim()??``;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(h,{title:D.name,subtitle:`${i} · ${D.repo??`a local repository`} · ${D.defaultBranch}`,trailing:(0,y.jsx)(d,{to:`/p/$slug/tasks`,params:{slug:i},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Tasks →`})}),(0,y.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[D.archived===void 0?null:(0,y.jsxs)(`p`,{className:`rounded-lg bg-surface-2/40 px-3 py-2 text-sm text-fg-secondary`,children:[`Archived `,s(D.archived.at,E),` by `,D.archived.by,`:`,` `,D.archived.reason,`. Its channels, tasks, and history stay readable here; nothing more is posted, filed, or joined.`]}),D.archived===void 0?null:(0,y.jsx)(g,{title:`Channels`,children:(0,y.jsx)(`ul`,{className:`space-y-1`,children:(x.data??[]).filter(e=>e.project===i).map(e=>(0,y.jsxs)(`li`,{children:[(0,y.jsxs)(d,{to:`/c/$`,params:{_splat:e.ref},className:`text-sm text-fg-secondary hover:text-fg-primary`,children:[`# `,e.name]}),(0,y.jsxs)(`span`,{className:`text-meta`,children:[` · `,e.messages,` messages`]})]},e.ref))})}),(0,y.jsx)(g,{title:`Members`,children:(0,y.jsx)(v,{members:O,scope:i})}),(0,y.jsx)(g,{title:`Tasks`,children:C.data===void 0?(0,y.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):k.length===0?(0,y.jsx)(`p`,{className:`text-meta`,children:`No tasks yet.`}):(0,y.jsx)(d,{to:`/p/$slug/tasks`,params:{slug:i},className:`flex flex-wrap gap-1.5`,children:k.map(e=>(0,y.jsxs)(`span`,{className:`rounded-md bg-surface-2/60 px-2 py-0.5 text-xs text-fg-secondary`,children:[e.tasks.length,` `,u.find(t=>t.phase===e.phase)?.label.toLowerCase()]},e.phase))})}),(0,y.jsx)(g,{title:`How a task ends`,children:(0,y.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:D.onDone===`merge`?`When its last stage is done, the board merges task/<id> onto ${D.defaultBranch}.`:`When its last stage is done, it is done; nothing is merged.`})}),(0,y.jsx)(g,{title:`Dashboard`,children:w.data===void 0?(0,y.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):A===``?(0,y.jsx)(`p`,{className:`text-meta`,children:`Empty. Agents on the server's machine may edit it.`}):(0,y.jsx)(p,{text:A})}),(0,y.jsx)(g,{title:`Knowledge`,children:(0,y.jsx)(_,{scope:i,topics:T.data,now:E})})]})]})}export{b as ProjectView};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var ee={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,te={};function ne(e,t,n){this.props=e,this.context=t,this.refs=te,this.updater=n||ee}ne.prototype.isReactComponent={},ne.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},ne.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function _(){}_.prototype=ne.prototype;function re(e,t,n){this.props=e,this.context=t,this.refs=te,this.updater=n||ee}var ie=re.prototype=new _;ie.constructor=re,g(ie,ne.prototype),ie.isPureReactComponent=!0;var v=Array.isArray;function ae(){}var y={H:null,A:null,T:null,S:null},oe=Object.prototype.hasOwnProperty;function b(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function se(e,t){return b(e.type,t,e.props)}function ce(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function le(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ue=/\/+/g;function de(e,t){return typeof e==`object`&&e&&e.key!=null?le(``+e.key):t.toString(36)}function fe(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(ae,ae):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function pe(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,pe(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+de(e,0):a,v(o)?(i=``,c!=null&&(i=c.replace(ue,`$&/`)+`/`),pe(o,r,i,``,function(e){return e})):o!=null&&(ce(o)&&(o=se(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ue,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(v(e))for(var u=0;u<e.length;u++)a=e[u],s=l+de(a,u),c+=pe(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+de(a,u++),c+=pe(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return pe(fe(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function me(e,t,n){if(e==null)return e;var r=[],i=0;return pe(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function he(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var ge=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function _e(e){var t=y.T,n={};n.types=t===null?null:t.types,y.T=n;try{var r=e(),i=y.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(ae,ge)}catch(e){ge(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),y.T=t}}function ve(e){var t=y.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else _e(ve.bind(null,e))}var ye={map:me,forEach:function(e,t,n){me(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return me(e,function(){t++}),t},toArray:function(e){return me(e,function(e){return e})||[]},only:function(e){if(!ce(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ye,e.Component=ne,e.Fragment=r,e.Profiler=a,e.PureComponent=re,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=y,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return y.H.useMemoCache(e)}},e.addTransitionType=ve,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!oe.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return b(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)oe.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return b(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=ce,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:he}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=_e,e.unstable_useCacheRefresh=function(){return y.H.useCacheRefresh()},e.use=function(e){return y.H.use(e)},e.useActionState=function(e,t,n){return y.H.useActionState(e,t,n)},e.useCallback=function(e,t){return y.H.useCallback(e,t)},e.useContext=function(e){return y.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return y.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return y.H.useEffect(e,t)},e.useEffectEvent=function(e){return y.H.useEffectEvent(e)},e.useId=function(){return y.H.useId()},e.useImperativeHandle=function(e,t,n){return y.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return y.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return y.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return y.H.useMemo(e,t)},e.useOptimistic=function(e,t){return y.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return y.H.useReducer(e,t,n)},e.useRef=function(e){return y.H.useRef(e)},e.useState=function(e){return y.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return y.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return y.H.useTransition()},e.version=`19.3.0`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),p=o(((e,t)=>{t.exports=f()})),m=l(d(),1),h=p(),ee=m.createContext(void 0),g=e=>{let t=m.useContext(ee);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},te=({client:e,children:t})=>(m.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,h.jsx)(ee.Provider,{value:e,children:t})),ne={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_=new class{#e=ne;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function re(e){setTimeout(e,0)}var ie=typeof window>`u`||`Deno`in globalThis;function v(){}function ae(e,t){return typeof e==`function`?e(t):e}function y(e){return typeof e==`number`&&e>=0&&e!==1/0}function oe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function b(e,t){return typeof e==`function`?e(t):e}function se(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==le(o,t.options))return!1}else if(!de(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function ce(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(ue(t.options.mutationKey)!==ue(a))return!1}else if(!de(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function le(e,t){return(t?.queryKeyHashFn||ue)(e)}function ue(e){return JSON.stringify(e,(e,t)=>ge(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function de(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!de(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!de(e[r],t[r]))return!1;return!0}return!1}var fe=Object.prototype.hasOwnProperty;function pe(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=he(e)&&he(t);if(!r&&!(ge(e)&&ge(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:fe.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=pe(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function me(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function he(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ge(e){if(!_e(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!_e(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function _e(e){return Object.prototype.toString.call(e)===`[object Object]`}function ve(e){return new Promise(t=>{_.setTimeout(t,e)})}function ye(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:pe(e,t)}function be(e){return e}function xe(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Se(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ce=Symbol();function we(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Ce?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Te(e,t){return typeof e==`function`?e(...t):!!e}function Ee(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var De=()=>ie,Oe=()=>De(),ke=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ae=new class extends ke{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},je=re;function Me(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=je,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Ne=Me(),Pe=new class extends ke{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Fe(e){return Math.min(1e3*2**e,3e4)}function Ie(e){return(e??`online`)!==`online`||Pe.isOnline()}var Le=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Re(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(v);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Le(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Ae.isFocused()&&(e.networkMode===`always`||Pe.isOnline())&&e.canRun(),p=()=>Ie(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},ee=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),g=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Oe()?0:3),a=e.retryDelay??Fe,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),ve(o).then(()=>f()?void 0:ee()).then(()=>{t?h(r):g()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?g():ee().then(g),s)}}var ze=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),y(this.gcTime)&&(this.#e=_.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Oe()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(_.clearTimeout(this.#e),this.#e=void 0)}};function Be(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Ee(e,()=>t.signal,()=>n=!0)},u=we(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Se:xe;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?He:Ve,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ve(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Ve(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function He(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Ue=class extends ze{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ke(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ke(this.options);e.data!==void 0&&(this.setState(Ge(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ye(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(v).catch(v):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>b(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ce||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>b(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!oe(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=we(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Be(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Re({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Le&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Le){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...We(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ge(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Ne.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function We(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ie(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ge(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ke(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var qe=class extends ke{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ye(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Xe(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Xe(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof b(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!me(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Ze(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||b(this.options.enabled,this.#t)!==b(t.enabled,this.#t)||b(this.options.staleTime,this.#t)!==b(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||b(this.options.enabled,this.#t)!==b(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return me(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(v)),t}#h(e){return!Oe()&&b(this.options.enabled,this.#t)!==!1&&y(e)}#g(){this.#b();let e=b(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=oe(this.#r.dataUpdatedAt,e)+1;this.#u=_.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return b(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=_.setInterval(()=>{(this.options.refetchIntervalInBackground||Ae.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(_.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(_.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ye(e,t),o=i&&Ze(e,n,t,r);(a||o)&&(l={...l,...We(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=ye(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=ye(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let ee=l.fetchStatus===`fetching`,g=m===`pending`,te=m===`error`,ne=g&&ee,_=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:g,isSuccess:m===`success`,isError:te,isInitialLoading:ne,isLoading:ne,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:ee,isRefetching:ee&&!g,isLoadingError:te&&!_,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:te&&_,isStale:Qe(e,t),refetch:this.refetch,isEnabled:b(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),me(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();Ne.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Je(e,t){return b(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||b(t.retryOnMount,e)!==!1)}function Ye(e,t){return Je(e,t)||e.state.data!==void 0&&Xe(e,t,t.refetchOnMount)}function Xe(e,t,n){if(b(t.enabled,e)!==!1&&b(t.staleTime,e)!==`static`){let r=b(n,e);return r===`always`||r!==!1&&Qe(e,t)}return!1}function Ze(e,t,n,r){return(e!==t||b(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Qe(e,n)}function Qe(e,t){return b(t.enabled,e)!==!1&&e.isStaleByTime(b(t.staleTime,e))}function $e(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var et=class extends ke{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,Ne.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!me(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&($e(e,n).forEach(e=>{e.destroy()}),$e(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=pe(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new qe(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&Ne.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},tt=m.createContext(!1),nt=()=>m.useContext(tt);tt.Provider;function rt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var it=m.createContext(rt()),at=()=>m.useContext(it),ot=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Te(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},st=e=>{m.useEffect(()=>{e.clearReset()},[e])},ct=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Te(n,[e.error,r])),lt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},ut=(e,t)=>e?.suspense&&t.isPending,dt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ft({queries:e,...t},n){let r=g(n),i=nt(),a=at(),o=t.subscribed!==!1,s=m.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{lt(e);let t=r.getQueryCache().get(e.queryHash);ot(e,a,t)}),st(a);let[c]=m.useState(()=>new et(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;m.useSyncExternalStore(m.useCallback(e=>f?c.subscribe(Ne.batchCalls(e)):v,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),m.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>ut(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&ut(n,e)?dt(n,new qe(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let h=l.find((e,t)=>{let n=s[t];return n&&ct({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(h)throw h.error;return u(d())}function pt(e,t,n){let r=nt(),i=at(),a=g(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,lt(o),ot(o,i,s),st(i);let[l]=m.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(m.useSyncExternalStore(m.useCallback(e=>{let t=d?l.subscribe(Ne.batchCalls(e)):v;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),m.useEffect(()=>{l.setOptions(o)},[o,l]),ut(o,u))throw dt(o,l,i);if(ct({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function x(e,t){return pt(e,qe,t)}function mt(e){return e[e.length-1]}function ht(e,t){return typeof e==`function`?e(t):e}var gt=Object.prototype.hasOwnProperty;function _t(e){for(let t in e)if(gt.call(e,t))return!0;return!1}var vt=()=>Object.create(null),yt=(e,t)=>bt(e,t,!0);function bt(e,t,n,r=0){if(e===t)return e;if(r++>500)return t;let i=Array.isArray(e)&&Array.isArray(t);if(!i&&!(xt(e)&&xt(t)))return t;let a=Object.keys(e),o=a.length,s=Object.keys(t),c=s.length;if(i?o!==e.length||c!==t.length||o&&mt(a)!==`${o-1}`||c&&mt(s)!==`${c-1}`:o!==Object.getOwnPropertyNames(e).length||c!==Object.getOwnPropertyNames(t).length||Object.getOwnPropertySymbols(t).length)return t;let l=0,u,d,f;if(i){for(;l<c&&(f=l,d=e[f],u=t[f],u=d===u?d:typeof d==`object`?bt(d,u,n,r):u,u===d);l++);if(l===c&&o===c)return e}else{let i=o===c,p=!0;for(;l<c;l++){f=s[l],d=e[f];let o=t[f];u=d===o?d:typeof d==`object`?bt(d,o,n,r):o,i&&=u===d&&(a[l]===f||gt.call(e,f)),p&&=Object.is(u,o),a[l]=u}if(i)return Object.getOwnPropertySymbols(e).length?t:e;if(p)return t}let p=i?s.fill(0):n?vt():{};for(let o=0;o<c;o++)f=i?o:s[o],i?(d=e[f],o>l&&(u=t[f],u=d===u?d:typeof d==`object`?bt(d,u,n,r):u),p[f]=o<l?d:u):p[f]=a[o];return p}function xt(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function St(e,t,n,r){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0,a=e.length;i<a;i++){let a=e[i],o=t[i];if(a!==o&&!St(a,o,n,r))return!1}return!0}if(xt(e)&&xt(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!St(e[i],t[i],n,r))return!1;return!0}let i=0;if(r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;for(let a in t)if((r||t[a]!==void 0)&&(i--===0||!St(e[a],t[a],n,r)))return!1;return i===0}return!1}function Ct(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var wt=/[\x00-\x1f\x7f"<>`{}]/g;function Tt(e){return e.replace(wt,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function Et(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Tt(t)}var Dt=[`http:`,`https:`,`mailto:`,`tel:`];function Ot(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var kt=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function At(e,t){if(!e)return!1;if(kt.test(e))return!0;let n=Ot(e);return n?!t.has(n):!1}function jt(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=Et(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=Et(r?e.slice(r):e)}return t}function Mt(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Nt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var Pt=m.createContext(null);function Ft(e){return m.useContext(Pt)}var It=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Lt=o(((e,t)=>{t.exports=It()})),Rt=o((e=>{var t=d(),n=Lt();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),zt=o(((e,t)=>{t.exports=Rt()}))();function Bt(e,t){return e===t}function Vt(e,t=e=>e,n){let r=n?.compare??Bt,i=(0,m.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,m.useCallback)(()=>e.get(),[e]);return(0,zt.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function Ht(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ut(e,t=`|`){return e.map(e=>mn(e)).join(t)}function Wt(e,t){return typeof t==`bigint`?t.toString():t}var Gt=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Kt(e){return new Gt(e)}function qt(e){return e==null}function Jt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Yt(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function Xt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Zt(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Qt(e){return Zt(e._zod.def)??e._zod.def.shape}function $t(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Xt(this,t,e),e},enumerable:!0,configurable:!0})}function en(e,t,n){t in e?Xt(e,t,n):e[t]=n}function tn(e,t,n,r){let i=Qt(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?$t(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):en(e,a,r?r(n.value,a):n.value))}}function nn(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?$t(e,n,()=>t[n]):en(e,n,r.value))}}function S(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function rn(e){return JSON.stringify(e)}function an(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var on=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function sn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var cn=Kt(()=>{if(E.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ln(e){if(sn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return sn(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function un(e){return ln(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var dn=new Set([`string`,`number`,`symbol`]);function fn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function pn(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function C(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 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 mn(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function hn(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var gn={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},_n={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function vn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return tn(i,e,yn(e,t)),pn(e,S(n,{shape:i,checks:[]}))}function yn(e,t){let n=Qt(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function bn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(yn(e,t)),a={};return tn(a,e,Reflect.ownKeys(Qt(e)).filter(e=>!i.has(e))),pn(e,S(n,{shape:a,checks:[]}))}function xn(e,t){if(!ln(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Qt(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return pn(e,S(e._zod.def,{shape:Sn(e,t)}))}function Sn(e,t){let n={};return tn(n,e,Reflect.ownKeys(Qt(e))),nn(n,t),n}function Cn(e,t){if(!ln(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return pn(e,S(e._zod.def,{shape:Sn(e,t)}))}function wn(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return tn(n,e,Reflect.ownKeys(Qt(e))),tn(n,t,Reflect.ownKeys(Qt(t))),pn(e,S(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Tn(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(yn(t,n)):void 0,o={};return tn(o,t,Reflect.ownKeys(Qt(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),pn(t,S(t._zod.def,{shape:o,checks:[]}))}function En(e,t,n){let r=n?new Set(yn(t,n)):void 0,i={};return tn(i,t,Reflect.ownKeys(Qt(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),pn(t,S(t._zod.def,{shape:i}))}function Dn(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 On(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 kn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function An(e){return typeof e==`string`?e:e?.message}function jn(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Mn(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:An(e.inst?._zod.def?.error?.(e))??An(a?.(e))??An(t?.error?.(e))??An(n.customError?.(e))??An(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Nn=/[\uD800-\uDBFF]/;function Pn(e){let t=e.length;if(!Nn.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 Fn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function In(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 t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Ln(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Rn(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Hn(e,n,r.value)}}function zn(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Bn(e,t,n){return zn(e,t,n,!1)}function Vn(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return zn(this,n,r(this))},set(e){zn(this,n,e)}})}return t}function Hn(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:zn(this,t,n.bind(this))},set(e){zn(this,t,e)}})}function Un(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Wn,Gn=!1,Kn={configurable:!0,get(){Gn=!0}};function w(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Wn!==e._zod){Wn=void 0;return}Wn=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Kn);let e=Gn;Gn=!1;try{let r=n(this);return Gn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Gn||=e,r}catch(n){throw delete this[t],Gn||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function qn(e,t,n,r){let i=Un(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Jn=`~constantCatch`;function Yn(e){let t=()=>e;return t[Jn]=!0,t}var Xn,Zn={value:void 0,enumerable:!1},Qn=`captureStackTrace`in Error?Error:null;function $n(e){let t=Qn;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Qn=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function T(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Zn.value=new a(r);try{Object.defineProperty(n,"_zod",Zn)}finally{Zn.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Rn(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?$n(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var er=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},tr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Xn=globalThis).__zod_globalConfig??(Xn.__zod_globalConfig={});var E=globalThis.__zod_globalConfig;function D(e){return e&&Object.assign(E,e),E}function nr(){let e=this._zod;return e.message??=JSON.stringify(e.def,Wt,2),e.message}function rr(e){this._zod.message=e}var ir={get:nr,set:rr,enumerable:!0,configurable:!0},ar={value:void 0,enumerable:!1},or=new WeakSet([Object.prototype,Error.prototype]),sr=(e,t)=>{e.name=`$ZodError`,ar.value=t,Object.defineProperty(e,"issues",ar),ar.value=void 0,Object.defineProperty(e,"message",ir);let n=Object.getPrototypeOf(e);or.has(n)||(or.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},cr=T(`$ZodError`,sr);T(`$ZodError`,sr,void 0,{Parent:Error});function lr(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 ur(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?lr(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function dr(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...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 e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function fr(e,t){return{callee:t?.callee??e,Err:t?.Err}}var pr=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new er;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Mn(e,o,D())));throw on(n,a?.callee??t),n}return s.value};return t},mr=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Mn(e,o,D())));throw on(n,a?.callee??t),n}return s.value};return t},hr=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new er;return a.issues.length?gr(e,a.issues,i):{success:!0,data:a.value}};function gr(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Mn(e,n,D()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var _r=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?gr(e,a.issues,i):{success:!0,data:a.value}},vr=Symbol.for(`zod.compile.invalid`),yr=Symbol.for(`zod.compile.fallback`),br=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==vr)return!0;if(r.definite===!0&&n===void 0)return!1}return xr(e,t,n)});function xr(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[yr]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new er;return a.issues.length===0}var Sr=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Cr=e=>{let t=pr(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,fr(n,a))};return n},wr=e=>{let t=pr(e),n=(e,r,i,a)=>t(e,r,i,fr(n,a));return n},Tr=e=>{let t=mr(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,fr(n,a))};return n},Er=e=>{let t=mr(e),n=async(e,r,i,a)=>await t(e,r,i,fr(n,a));return n},Dr=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return hr(e)(t,n,i)},Or=e=>(t,n,r)=>hr(e)(t,n,r),kr=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return _r(e)(t,n,i)},Ar=e=>async(t,n,r)=>_r(e)(t,n,r),jr=/^[cC][0-9a-z]{6,}$/,Mr=/^[0-9a-z]+$/,Nr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Pr=/^[0-9a-vA-V]{20}$/,Fr=/^[A-Za-z0-9]{27}$/,Ir=/^[a-zA-Z0-9_-]{21}$/;function Lr(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Rr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,zr=/^([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})$/,Br=e=>e?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)$/,Vr=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Hr=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Ur(){return new RegExp(Hr,`u`)}var Wr=/^(?:(?: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])$/,Gr=/^(([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}|:))$/,Kr=/^((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])$/,qr=/^(([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])$/,Jr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Xr=/^https?$/,Zr=/^\+[1-9]\d{6,14}$/,Qr=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function $r(e){return RegExp(`^${e}$`)}var ei=$r(Qr);function ti(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 ni(e){return RegExp(`^${ti(e)}$`)}function ri(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${ti({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${ti({precision:e.precision})}`:n;return RegExp(`^${Qr}T(?:${r})$`)}var ii=/^[\s\S]{0,}$/,ai=/^-?\d+$/,oi=/^-?\d+(?:\.\d+)?$/,si=/^(?:true|false)$/i,ci=/^[^A-Z]*$/,li=/^[^a-z]*$/,O=T(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ui=e=>{let t=e.value;return!qt(t)&&t.length!==void 0},di={number:`number`,bigint:`bigint`,object:`date`},fi=T(`$ZodCheckLessThan`,(e,t)=>{O.init(e,t);let n=di[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:di[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})}}),pi=T(`$ZodCheckGreaterThan`,(e,t)=>{O.init(e,t);let n=di[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:di[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})}}),mi=T(`$ZodCheckMultipleOf`,(e,t)=>{O.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Yt(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})}}),hi=T(`$ZodCheckNumberFormat`,(e,t)=>{O.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=gn[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),gi=T(`$ZodCheckMaxLength`,(e,t)=>{var n;O.init(e,t),(n=e._zod.def).when??(n.when=ui),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Pn(r):i)<=t.maximum)return;let a=Fn(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),_i=T(`$ZodCheckMinLength`,(e,t)=>{var n;O.init(e,t),(n=e._zod.def).when??(n.when=ui),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Pn(r):i)>=t.minimum)return;let a=Fn(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),vi=T(`$ZodCheckLengthEquals`,(e,t)=>{var n;O.init(e,t),(n=e._zod.def).when??(n.when=ui),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Pn(r):i;if(a===t.length)return;let o=Fn(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),yi=T(`$ZodCheckStringFormat`,(e,t)=>{var n,r;O.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),bi=T(`$ZodCheckRegex`,(e,t)=>{yi.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})}}),xi=T(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ci,yi.init(e,t)}),Si=T(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=li,yi.init(e,t)}),Ci=T(`$ZodCheckIncludes`,(e,t)=>{O.init(e,t);let n=fn(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),wi=T(`$ZodCheckStartsWith`,(e,t)=>{O.init(e,t);let n=RegExp(`^${fn(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Ti=T(`$ZodCheckEndsWith`,(e,t)=>{O.init(e,t);let n=RegExp(`.*${fn(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Ei=T(`$ZodCheckOverwrite`,(e,t)=>{O.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Di=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
2
|
-
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
3
|
-
`)}\n};`)(...Object.values(this.closed))}},Oi={major:4,minor:6,patch:5},k=T(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Oi;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Dn(t),a;for(let o of n){if(o._zod.def.when){if(On(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new er;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(jn(t.issues,n,e),i||=Dn(t,n))});else{if(t.issues.length===n)continue;jn(t.issues,n,e),i||=Dn(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Dn(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new er;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new er;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Bn(this,`~standard`,ji(this))},set"~standard"(e){zn(this,`~standard`,e)}}),ki=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Mn(e,t,D()))}:{value:e.value};async function Ai(e,t){let n={async:!0};return ki(await e._zod.run({value:t,issues:[]},n),n)}function ji(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return ki(r,n)}catch{}return Ai(e,t)},vendor:`zod`,version:1}}var Mi=T(`$ZodString`,(e,t)=>{k.init(e,t),e._zod.pattern=t.pattern??ii,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}}),A=T(`$ZodStringFormat`,(e,t)=>{yi.init(e,t),Mi.init(e,t)}),Ni=T(`$ZodGUID`,(e,t)=>{t.pattern??=zr,A.init(e,t)}),Pi=T(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Br(e)}else t.pattern??=Br();A.init(e,t)}),Fi=T(`$ZodEmail`,(e,t)=>{t.pattern??=Vr,A.init(e,t)});function Ii(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Li(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Ii(e)||2:Ri(e,t)}function Ri(e,t){if(!t.normalize&&t.protocol?.source===Xr.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var zi=/[\t\n\r]/g;function Bi(e){return e.replace(zi,``)}function Vi(e,t){return t.lastIndex=0,t.test(e.hostname)}function Hi(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Ui=T(`$ZodURL`,(e,t)=>{A.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Li(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Bi(r);return}t.hostname&&!Vi(i,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&&!Hi(i,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?i.href:Bi(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Wi=T(`$ZodEmoji`,(e,t)=>{t.pattern??=Ur(),A.init(e,t)}),Gi=T(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Ir:Lr(t.length),A.init(e,t)}),Ki=T(`$ZodCUID`,(e,t)=>{t.pattern??=jr,A.init(e,t)}),qi=T(`$ZodCUID2`,(e,t)=>{t.pattern??=Mr,A.init(e,t)}),Ji=T(`$ZodULID`,(e,t)=>{t.pattern??=Nr,A.init(e,t)}),Yi=T(`$ZodXID`,(e,t)=>{t.pattern??=Pr,A.init(e,t)}),Xi=T(`$ZodKSUID`,(e,t)=>{t.pattern??=Fr,A.init(e,t)}),Zi=T(`$ZodISODateTime`,(e,t)=>{t.pattern??=ri(t),A.init(e,t)}),Qi=T(`$ZodISODate`,(e,t)=>{t.pattern??=ei,A.init(e,t)}),$i=T(`$ZodISOTime`,(e,t)=>{t.pattern??=ni(t),A.init(e,t)}),ea=T(`$ZodISODuration`,(e,t)=>{t.pattern??=Rr,A.init(e,t)}),ta=T(`$ZodIPv4`,(e,t)=>{t.pattern??=Wr,A.init(e,t)}),na=/^[0-9a-fA-F:.]+$/;function ra(e){return na.test(e)?Ii(`http://[${e}]`):!1}var ia=T(`$ZodIPv6`,(e,t)=>{t.pattern??=Gr,A.init(e,t),e._zod.check=n=>{ra(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),aa=T(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Kr,A.init(e,t)});function oa(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:ra(n)}var sa=T(`$ZodCIDRv6`,(e,t)=>{t.pattern??=qr,A.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})}});function ca(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var la=/^[0-9a-zA-Z+/]*={0,2}$/,ua=T(`$ZodBase64`,(e,t)=>{t.pattern??=la,A.init(e,t),e._zod.check=n=>{ca(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),da=/^[A-Za-z0-9_-]*$/;function fa(e){if(!da.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return ca(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var pa=T(`$ZodBase64URL`,(e,t)=>{t.pattern??=da,A.init(e,t),e._zod.check=n=>{fa(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),ma=T(`$ZodE164`,(e,t)=>{t.pattern??=Zr,A.init(e,t)});function ha(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var ga=T(`$ZodJWT`,(e,t)=>{A.init(e,t),e._zod.check=n=>{ha(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),_a=T(`$ZodNumber`,(e,t)=>{k.init(e,t),e._zod.pattern=oi,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),va=T(`$ZodNumberFormat`,(e,t)=>{hi.init(e,t),_a.init(e,t)}),ya=T(`$ZodBoolean`,(e,t)=>{k.init(e,t),e._zod.pattern=si,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),ba=T(`$ZodUnknown`,(e,t)=>{k.init(e,t),e._zod.parse=e=>e}),xa=T(`$ZodNever`,(e,t)=>{k.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Sa(e,t,n){e.issues.length&&t.issues.push(...kn(n,e.issues)),t.value[n]=e.value}var Ca=T(`$ZodArray`,(e,t)=>{k.init(e,t);let n=E.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Sa(t,r,e)));else if(Sa(c,r,e),s&&c.issues.length!==0&&Dn(c))break}return o.length?Promise.all(o).then(()=>r):r}});function wa(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...kn(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Ta=[];function Ea(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Ta,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=hn(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Da(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(Dn(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>wa(e,n,i,t,d,f))):wa(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Oa=T(`$ZodObject`,(e,t)=>{k.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Kt(()=>Ea(t));w(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Xt(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=sn,o=t.catchall,s,c=E.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(Dn(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>wa(n,t,e,r,a,o))):wa(s,t,e,r,a,o)}return o?Da(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),ka=T(`$ZodObjectJIT`,(e,t)=>{Oa.init(e,t);let n=e._zod.parse,r=Kt(()=>Ea(t)),i=E.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Di([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
4
|
-
let ${e}_ab = false;
|
|
5
|
-
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
6
|
-
const iss = ${e}.issues[i];
|
|
7
|
-
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
|
|
8
|
-
payload.issues.push(iss);
|
|
9
|
-
if (iss.continue !== true) ${e}_ab = true;
|
|
10
|
-
}
|
|
11
|
-
if (${e}_ab && ctx && ctx.abortEarly) {
|
|
12
|
-
payload.value = newResult;
|
|
13
|
-
return payload;
|
|
14
|
-
}`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:rn(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
|
|
15
|
-
const ${n}_present = ${i};
|
|
16
|
-
if (!${n}.issues.length || ${n}_present) {
|
|
17
|
-
if (${n}.issues.length) {${c(n,r)}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (${e}) {
|
|
21
|
-
newResult[${r}] = ${n}.value;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
`)}else f?(o.write(`
|
|
26
|
-
if (${n}.issues.length) {${c(n,r)}
|
|
27
|
-
}
|
|
28
|
-
`),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
|
|
29
|
-
if (${n}.value !== undefined || ${i}) {
|
|
30
|
-
newResult[${r}] = ${n}.value;
|
|
31
|
-
}
|
|
32
|
-
`)):o.write(`
|
|
33
|
-
const ${n}_present = ${i};
|
|
34
|
-
if (${n}.issues.length) {${c(n,r)}
|
|
35
|
-
}
|
|
36
|
-
if (!${n}_present && !${n}.issues.length) {
|
|
37
|
-
payload.issues.push({
|
|
38
|
-
code: "invalid_type",
|
|
39
|
-
expected: "nonoptional",
|
|
40
|
-
input: undefined,
|
|
41
|
-
path: [${r}]
|
|
42
|
-
});
|
|
43
|
-
if (ctx && ctx.abortEarly) {
|
|
44
|
-
payload.value = newResult;
|
|
45
|
-
return payload;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (${n}_present) {
|
|
50
|
-
newResult[${r}] = ${n}.value;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=sn,c=!E.jitless,l=c&&cn.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Da([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Aa(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Dn(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Mn(e,r,D())))}),t)}var ja=T(`$ZodUnion`,(e,t)=>{k.init(e,t),w(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),w(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),w(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),w(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Jt(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Aa(t,r,e,i)):Aa(o,r,e,i)}});function Ma(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Na=T(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,ja.init(e,t);let n=e._zod.parse;w(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||Xt(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=Zt(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=Kt(()=>Ma(t));e._zod.parse=(i,a)=>{let o=i.value;if(!sn(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Pa=T(`$ZodIntersection`,(e,t)=>{k.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Ia(e,t,n)):Ia(e,i,a)}});function Fa(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ln(e)&&ln(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Fa(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}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 i=e[r],a=t[r],o=Fa(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ia(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Fa(t.value,n.value);if(!c.valid){if(Dn(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var La=T(`$ZodRecord`,(e,t)=>{k.init(e,t);let n=E.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ln(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Mn(e,i,D())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...kn(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...kn(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&oi.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Mn(e,i,D())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...kn(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...kn(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Ra=T(`$ZodEnum`,(e,t)=>{k.init(e,t);let n=Ht(t.entries),r=new Set(n);e._zod.values=r,w(e,`pattern`,e=>{let t=Ht(e.def.entries).filter(e=>dn.has(typeof e));return RegExp(t.length?`^(${t.map(e=>fn(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),za=T(`$ZodLiteral`,(e,t)=>{k.init(e,t);let n=new Set(t.values);e._zod.values=n,w(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?fn(e):e?fn(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Ba=T(`$ZodTransform`,(e,t)=>{k.init(e,t),e._zod.optin=`optional`,E.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tr(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new er;return n.value=i,n}});function Va(e,t){return e.value=t.issues.length?void 0:t.value,e}var Ha=T(`$ZodOptional`,(e,t)=>{k.init(e,t),w(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,w(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),w(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Jt(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Va(e,t)):Va(e,r)}return t.innerType._zod.run(e,n)}}),Ua=T(`$ZodExactOptional`,(e,t)=>{Ha.init(e,t),w(e,`values`,e=>e.def.innerType._zod.values),w(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Wa=T(`$ZodNullable`,(e,t)=>{k.init(e,t),w(e,`optin`,e=>e.def.innerType._zod.optin),w(e,`optout`,e=>e.def.innerType._zod.optout),w(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Jt(t.source)}|null)$`):void 0}),w(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ga=T(`$ZodDefault`,(e,t)=>{k.init(e,t),e._zod.optin=`defaulted`,w(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Ka(e,t)):Ka(r,t)}});function Ka(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var qa=T(`$ZodPrefault`,(e,t)=>{k.init(e,t),e._zod.optin=`defaulted`,w(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Ja=T(`$ZodNonOptional`,(e,t)=>{k.init(e,t),w(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Ya(t,e)):Ya(i,e)}});function Ya(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 Xa(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Mn(e,r,D()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Za=T(`$ZodCatch`,(e,t)=>{k.init(e,t),w(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),w(e,`optout`,e=>e.def.innerType._zod.optout),w(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Xa(e,r,t,n)):Xa(e,r,t,n)}}),Qa=T(`$ZodPipe`,(e,t)=>{k.init(e,t),w(e,`values`,e=>e.def.in._zod.values),w(e,`optin`,e=>e.def.in._zod.optin),w(e,`optout`,e=>e.def.out._zod.optout),w(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>$a(e,t.in,n)):$a(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>$a(e,t.out,n)):$a(r,t.out,n)}});function $a(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var eo=T(`$ZodPreprocess`,(e,t)=>{Qa.init(e,t)}),to=T(`$ZodReadonly`,(e,t)=>{k.init(e,t),w(e,`propValues`,e=>e.def.innerType._zod.propValues),w(e,`values`,e=>e.def.innerType._zod.values),w(e,`optin`,e=>e.def.innerType?._zod?.optin),w(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(no):no(r)}});function no(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ro=T(`$ZodCustom`,(e,t)=>{O.init(e,t),k.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>io(t,n,r,e));io(i,n,r,e)}});function io(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ln(e))}}var ao=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},oo=`~memo`,so=[];function co(e){return typeof e==`object`&&!!e}function lo(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var uo=new WeakMap,fo=0,po=1,mo=2;function ho(e,t,n){let r=uo.get(e);if(r!==void 0)return r?mo:fo;if(t.has(e))return mo;t.add(e);let i=fo,a=e=>{if(i!==mo&&e?._zod){let r=ho(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=fo;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?po:o.value?._zod?ho(o.value,t,n):fo;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Zt(c);s(e?o(e,!0):po),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?ho(r,t,!1):po);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 e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),go(e,i)}function go(e,t){return t!==po&&uo.set(e,t===mo),t}function _o(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var vo,yo=[],bo={alloc(e,t,n){let r=vo;if(!r)return n;vo=void 0;let i={value:n,issues:null};return r.set(t.value,i),yo.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&So(n,e.value))throw new ao;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=ho(e,new Set,!1);if(i===fo)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===mo||r?n=!0:r=!0}let l=s.value;if(!co(l))return t(s,c);let u=c[oo];u||(u={buckets:new WeakMap,backEdges:void 0},c[oo]=u);let d;i===c?d=a:(d=_o(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...lo(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;vo=d;let p=yo.length,m=t(s,c);vo=void 0;let h=yo.length>p?yo.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?lo(e.issues):so),e)):(h&&(h.issues=m.issues.length?lo(m.issues):so),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function xo(){return bo}function So(e,t){let n=e[oo]?.backEdges;return n!==void 0&&co(t)&&n.has(t)}var Co=()=>{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(t){return e[t]??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 i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(In(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${mn(e.values[0])}`:`Invalid option: expected one of ${Ut(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${Ut(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function wo(){return{localeError:Co()}}var To,Eo=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Do(){return new Eo}(To=globalThis).__zod_globalRegistry??(To.__zod_globalRegistry=Do());var Oo=globalThis.__zod_globalRegistry;function ko(e){return e.checks&&=[...e.checks],e}function Ao(e,t){return new e(ko({type:`string`,...C(t)}))}function jo(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...C(t)})}function Mo(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...C(t)})}function No(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...C(t)})}function Po(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...C(t)})}function Fo(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...C(t)})}function Io(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...C(t)})}function Lo(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...C(t)})}function Ro(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...C(t)})}function zo(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...C(t)})}function Bo(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...C(t)})}function Vo(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...C(t)})}function Ho(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...C(t)})}function Uo(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...C(t)})}function Wo(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...C(t)})}function Go(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...C(t)})}function Ko(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...C(t)})}function qo(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...C(t)})}function Jo(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...C(t)})}function Yo(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...C(t)})}function Xo(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...C(t)})}function Zo(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...C(t)})}function Qo(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...C(t)})}function $o(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...C(t)})}function es(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...C(t)})}function ts(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...C(t)})}function ns(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...C(t)})}function rs(e,t){return new e(ko({type:`number`,checks:[],...C(t)}))}function is(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...C(t)})}function as(e,t){return new e({type:`boolean`,...C(t)})}function os(e){return new e({type:`unknown`})}function ss(e,t){return new e({type:`never`,...C(t)})}function cs(e,t){return new fi({check:`less_than`,...C(t),value:e,inclusive:!1})}function ls(e,t){return new fi({check:`less_than`,...C(t),value:e,inclusive:!0})}function us(e,t){return new pi({check:`greater_than`,...C(t),value:e,inclusive:!1})}function ds(e,t){return new pi({check:`greater_than`,...C(t),value:e,inclusive:!0})}function fs(e,t){return new mi({check:`multiple_of`,...C(t),value:e})}function ps(e,t){return new gi({check:`max_length`,...C(t),maximum:e})}function ms(e,t){return new _i({check:`min_length`,...C(t),minimum:e})}function hs(e,t){return new vi({check:`length_equals`,...C(t),length:e})}function gs(e,t){return new bi({check:`string_format`,format:`regex`,...C(t),pattern:e})}function _s(e){return new xi({check:`string_format`,format:`lowercase`,...C(e)})}function vs(e){return new Si({check:`string_format`,format:`uppercase`,...C(e)})}function ys(e,t){return new Ci({check:`string_format`,format:`includes`,...C(t),includes:e})}function bs(e,t){return new wi({check:`string_format`,format:`starts_with`,...C(t),prefix:e})}function xs(e,t){return new Ti({check:`string_format`,format:`ends_with`,...C(t),suffix:e})}function Ss(e){return new Ei({check:`overwrite`,tx:e})}function Cs(e){return Ss(t=>t.normalize(e))}function ws(){return Ss(e=>e.trim())}function Ts(){return Ss(e=>e.toLowerCase())}function Es(){return Ss(e=>e.toUpperCase())}function Ds(){return Ss(e=>an(e))}function Os(e,t,n){return new e({type:`array`,element:t,...C(n)})}function ks(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...C(n)})}function As(e,t){let n=js(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ln(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Ln(r))}},e(t.value,t)),t);return n}function js(e,t){let n=new O({check:`custom`,...C(t)});return n._zod.check=e,n}function Ms(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&Xt(e,t,n[t]);return e}function Ns(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??Oo,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 Ps(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function j(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,j(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ms(o.schema,c),t.io===`input`&&M(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Fs(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Is(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Fs(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Fs(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
54
|
-
|
|
55
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ls(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ls(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Rs=new Set([`type`,`properties`,`required`,`additionalProperties`]),zs=[`oneOf`,`anyOf`];function Bs(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Vs(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Rs.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Bs(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Xt(n,r,e.length===1?e[0]:Vs(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Bs(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Hs(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Rs)if(t in e)return;let n=t.filter(e=>zs.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Vs(t);else{let e=n[0],i=zs.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Vs([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ms(e,r))}function Us(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Ms(i,s),Ms(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ls(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Hs(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Ms(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Xt(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Gs(t,`input`,e.processors),output:Gs(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function M(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 M(r.element,n);if(r.type===`set`)return M(r.valueType,n);if(r.type===`lazy`)return M(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 M(r.innerType,n);if(r.type===`intersection`)return M(r.left,n)||M(r.right,n);if(r.type===`record`||r.type===`map`)return M(r.keyType,n)||M(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:M(r.in,n)||M(r.out,n);if(r.type===`object`){for(let e in r.shape)if(M(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(M(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(M(e,n))return!0;return!!(r.rest&&M(r.rest,n))}return!1}var Ws=(e,t={})=>n=>{let r=Ns({...n,processors:t});return j(e,r),Is(r,e),Us(r,e)},Gs=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ns({...i??{},target:a,io:t,processors:n});return j(e,o),Is(o,e),Us(o,e)},Ks=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},qs=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Js=(e,t)=>{Ks(e,`minimum`,t),qs(e,`maximum`,t)},Ys=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Xs=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Zs=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Qs=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},$s=(e,t)=>Ks(e,`minimum`,t.minimum),ec=(e,t)=>qs(e,`maximum`,t.maximum),tc=e=>(t,n)=>{Qs(t,n.format);let[r,i]=e[n.format];Ks(t,`minimum`,r),qs(t,`maximum`,i)},nc={greater_than:(e,t)=>Ks(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>qs(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Ys(e,t.value),number_format:tc(gn),bigint_format:tc(_n),min_length:$s,max_length:ec,length_equals:(e,t)=>Js(e,t.length),min_size:$s,max_size:ec,size_equals:(e,t)=>Js(e,t.size),string_format:(e,t)=>{Qs(e,t.format),t.pattern&&Xs(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)=>Zs(e,t.mime)};function N(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)nc[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Ks(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Ks(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&qs(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&qs(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Ys(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Zs(t,i.mime);for(let e of i.patterns??[])Xs(t,e);return t}var rc={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ic=new Map([[la,Jr],[da,Yr]]),ac=e=>ic.get(e)??e,oc=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=N(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=rc[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(ac);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},sc=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=N(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ps(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},cc=(e,t,n,r)=>{n.type=`boolean`},lc=(e,t,n,r)=>{n.not={}},uc=(e,t,n,r)=>{let i=e._zod.def,a=Ht(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},dc=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ps(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ps(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},fc=(e,t,n,r)=>{Ps(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},pc=(e,t,n,r)=>{Ps(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},mc=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=N(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=j(a.element,t,{...r,path:[...r.path,`items`]})};function hc(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?hc(t.out):t.type===`catch`?hc(t.innerType):e._zod.optin}var gc=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ps(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Xt(i.properties,e,j(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?hc(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=j(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},_c=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>j(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},vc=(e,t,n,r)=>{let i=e._zod.def,a=j(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=j(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function yc(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=yc(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>yc(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?oi:ai).source),p):p}var bc=new WeakMap;function xc(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of bc.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=yc(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Sc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=N(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=j(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)Xt(i.patternProperties,ac(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=j(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=bc.get(t);n||(n=[],bc.set(t,n),t.deferred.push(()=>xc(t))),n.push(e)}i.additionalProperties=j(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&hc(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Cc=(e,t,n,r)=>{let i=e._zod.def,a=j(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},wc=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Tc=Symbol();function Ec(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ps(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Tc):JSON.parse(o)}var Dc=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Ec(i.defaultValue,e,t,n,r);o!==Tc&&(n.default=o)},Oc=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Ec(i.defaultValue,e,t,n,r);o!==Tc&&(n._prefault=o)},kc=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ps(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Ac=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;j(o,t,r);let s=t.seen.get(e);s.ref=o},jc=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Mc=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Nc=new WeakSet([Object.prototype,Error.prototype]);function Pc(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var P=T(`ZodError`,(e,t)=>{cr.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Nc.has(n)||(Nc.add(n),Pc(n,`format`,e=>t=>dr(e,t)),Pc(n,`flatten`,e=>t=>ur(e,t)),Pc(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Wt,2)}),Pc(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Wt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Fc=pr(P),Ic=mr(P),Lc=hr(P),Rc=_r(P),zc=Cr(P),Bc=wr(P),Vc=Tr(P),Hc=Er(P),Uc=Dr(P),Wc=Or(P),Gc=kr(P),Kc=Ar(P);function qc(){E.localeError||D(wo())}function Jc(){E.memoizer||D({memoizer:xo()})}var F=T(`ZodType`,(e,t)=>(qc(),k.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(S(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return pn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(lu(e,t))},superRefine(e,t){return this.check(uu(e,t))},overwrite(e){return this.check(Ss(e))},optional(){return Wl(this)},exactOptional(){return Kl(this)},nullable(){return Jl(this)},nullish(){return Wl(Jl(this))},nonoptional(e){return eu(this,e)},array(){return V(this)},or(e){return Ml([this,e])},and(e){return Il(this,e)},transform(e){return iu(this,Hl(e))},default(e){return Xl(this,e)},prefault(e){return Ql(this,e)},catch(e){return nu(this,e)},pipe(e){return iu(this,e)},readonly(){return su(this)},describe(e){let t=this.clone();return Oo.add(t,{description:e}),t},meta(...e){if(e.length===0)return Oo.get(this);let t=this.clone();return Oo.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 Bn(this,`~standard`,{...ji(this),jsonSchema:{input:Gs(this,`input`),output:Gs(this,`output`)}})},set"~standard"(e){zn(this,`~standard`,e)},parse:function e(t,n){return Fc(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Ic(this,t,n,{callee:e})},safeParse(e,t){return Lc(this,e,t)},async safeParseAsync(e,t){return Rc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){zn(this,`spa`,e)},validate(e,t){return br(this,e,t)},validateAsync(e,t){return Sr(this,e,t)},encode:function e(t,n){return zc(this,t,n,{callee:e})},decode:function e(t,n){return Bc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Vc(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Hc(this,t,n,{callee:e})},safeEncode(e,t){return Uc(this,e,t)},safeDecode(e,t){return Wc(this,e,t)},async safeEncodeAsync(e,t){return Gc(this,e,t)},async safeDecodeAsync(e,t){return Kc(this,e,t)},toJSONSchema(e){return Ws(this,{})(e)},get description(){return Oo.get(this)?.description},get _def(){return this._zod.def}}),Yc=T(`_ZodString`,(e,t)=>{Mi.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oc(e,t,n,r)},Vn({format:e=>N(e).format??null,minLength:e=>N(e).minimum??null,maxLength:e=>N(e).maximum??null},{regex(...e){return this.check(gs(...e))},includes(...e){return this.check(ys(...e))},startsWith(...e){return this.check(bs(...e))},endsWith(...e){return this.check(xs(...e))},min(...e){return this.check(ms(...e))},max(...e){return this.check(ps(...e))},length(...e){return this.check(hs(...e))},nonempty(...e){return this.check(ms(1,...e))},lowercase(e){return this.check(_s(e))},uppercase(e){return this.check(vs(e))},trim(){return this.check(ws())},normalize(...e){return this.check(Cs(...e))},toLowerCase(){return this.check(Ts())},toUpperCase(){return this.check(Es())},slugify(){return this.check(Ds())}})),Xc=T(`ZodString`,(e,t)=>{Mi.init(e,t),Yc.init(e,t)},{email(e){return this.check(jo(tl,e))},url(e){return this.check(Lo(al,e))},jwt(e){return this.check(Qo(xl,e))},emoji(e){return this.check(Ro(sl,e))},guid(e){return this.check(Mo(nl,e))},uuid(e){return this.check(No(rl,e))},uuidv4(e){return this.check(Po(rl,e))},uuidv6(e){return this.check(Fo(rl,e))},uuidv7(e){return this.check(Io(rl,e))},nanoid(e){return this.check(zo(cl,e))},cuid(e){return this.check(Bo(ll,e))},cuid2(e){return this.check(Vo(ul,e))},ulid(e){return this.check(Ho(dl,e))},base64(e){return this.check(Yo(vl,e))},base64url(e){return this.check(Xo(yl,e))},xid(e){return this.check(Uo(fl,e))},ksuid(e){return this.check(Wo(pl,e))},ipv4(e){return this.check(Go(ml,e))},ipv6(e){return this.check(Ko(hl,e))},cidrv4(e){return this.check(qo(gl,e))},cidrv6(e){return this.check(Jo(_l,e))},e164(e){return this.check(Zo(bl,e))},datetime(e){return this.check($o(Zc,e))},date(e){return this.check(es(Qc,e))},time(e){return this.check(ts($c,e))},duration(e){return this.check(ns(el,e))}});function I(e){return Ao(Xc,e)}var L=T(`ZodStringFormat`,(e,t)=>{A.init(e,t),Yc.init(e,t)}),Zc=T(`ZodISODateTime`,(e,t)=>{Zi.init(e,t),L.init(e,t)}),Qc=T(`ZodISODate`,(e,t)=>{Qi.init(e,t),L.init(e,t)}),$c=T(`ZodISOTime`,(e,t)=>{$i.init(e,t),L.init(e,t)}),el=T(`ZodISODuration`,(e,t)=>{ea.init(e,t),L.init(e,t)}),tl=T(`ZodEmail`,(e,t)=>{Fi.init(e,t),L.init(e,t)}),nl=T(`ZodGUID`,(e,t)=>{Ni.init(e,t),L.init(e,t)}),rl=T(`ZodUUID`,(e,t)=>{Pi.init(e,t),L.init(e,t)});function il(e){return No(rl,e)}var al=T(`ZodURL`,(e,t)=>{Ui.init(e,t),L.init(e,t)});function ol(e){return Lo(al,e)}var sl=T(`ZodEmoji`,(e,t)=>{Wi.init(e,t),L.init(e,t)}),cl=T(`ZodNanoID`,(e,t)=>{Gi.init(e,t),L.init(e,t)}),ll=T(`ZodCUID`,(e,t)=>{Ki.init(e,t),L.init(e,t)}),ul=T(`ZodCUID2`,(e,t)=>{qi.init(e,t),L.init(e,t)}),dl=T(`ZodULID`,(e,t)=>{Ji.init(e,t),L.init(e,t)}),fl=T(`ZodXID`,(e,t)=>{Yi.init(e,t),L.init(e,t)}),pl=T(`ZodKSUID`,(e,t)=>{Xi.init(e,t),L.init(e,t)}),ml=T(`ZodIPv4`,(e,t)=>{ta.init(e,t),L.init(e,t)}),hl=T(`ZodIPv6`,(e,t)=>{ia.init(e,t),L.init(e,t)}),gl=T(`ZodCIDRv4`,(e,t)=>{aa.init(e,t),L.init(e,t)}),_l=T(`ZodCIDRv6`,(e,t)=>{sa.init(e,t),L.init(e,t)}),vl=T(`ZodBase64`,(e,t)=>{ua.init(e,t),L.init(e,t)}),yl=T(`ZodBase64URL`,(e,t)=>{pa.init(e,t),L.init(e,t)}),bl=T(`ZodE164`,(e,t)=>{ma.init(e,t),L.init(e,t)}),xl=T(`ZodJWT`,(e,t)=>{ga.init(e,t),L.init(e,t)}),Sl=T(`ZodNumber`,(e,t)=>{_a.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sc(e,t,n,r),e.isFinite=!0},Vn({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=N(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=N(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=N(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>N(e).format??null},{gt(e,t){return this.check(us(e,t))},gte(e,t){return this.check(ds(e,t))},min(e,t){return this.check(ds(e,t))},lt(e,t){return this.check(cs(e,t))},lte(e,t){return this.check(ls(e,t))},max(e,t){return this.check(ls(e,t))},int(e){return this.check(wl(e))},safe(e){return this.check(wl(e))},positive(e){return this.check(us(0,e))},nonnegative(e){return this.check(ds(0,e))},negative(e){return this.check(cs(0,e))},nonpositive(e){return this.check(ls(0,e))},multipleOf(e,t){return this.check(fs(e,t))},step(e,t){return this.check(fs(e,t))},finite(){return this}}));function R(e){return rs(Sl,e)}var Cl=T(`ZodNumberFormat`,(e,t)=>{va.init(e,t),Sl.init(e,t)});function wl(e){return is(Cl,e)}var Tl=T(`ZodBoolean`,(e,t)=>{ya.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cc(e,t,n,r)});function z(e){return as(Tl,e)}var El=T(`ZodUnknown`,(e,t)=>{ba.init(e,t),F.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function B(){return os(El)}var Dl=T(`ZodNever`,(e,t)=>{xa.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lc(e,t,n,r)});function Ol(e){return ss(Dl,e)}var kl=T(`ZodArray`,(e,t)=>{Jc(),Ca.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mc(e,t,n,r),e.element=t.element},{min(e,t){return this.check(ms(e,t))},nonempty(e){return this.check(ms(1,e))},max(e,t){return this.check(ps(e,t))},length(e,t){return this.check(hs(e,t))},unwrap(){return this.element}});function V(e,t){return Os(kl,e,t)}var Al=T(`ZodObject`,(e,t)=>{Jc(),ka.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gc(e,t,n,r),qn(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return U(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(S(this._zod.def,{catchall:e}))},passthrough(){return this.clone(S(this._zod.def,{catchall:B()}))},loose(){return this.clone(S(this._zod.def,{catchall:B()}))},strict(){return this.clone(S(this._zod.def,{catchall:Ol()}))},strip(){return this.clone(S(this._zod.def,{catchall:void 0}))},extend(e){return xn(this,e)},safeExtend(e){return Cn(this,e)},merge(e){return wn(this,e)},pick(e){return vn(this,e)},omit(e){return bn(this,e)},partial(...e){return Tn(Ul,this,e[0])},exactPartial(...e){return Tn(Gl,this,e[0],`exactPartial`)},required(...e){return En($l,this,e[0])}});function H(e,t){return new Al({type:`object`,shape:e??{},...C(t)})}var jl=T(`ZodUnion`,(e,t)=>{ja.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_c(e,t,n,r),e.options=t.options});function Ml(e,t){return new jl({type:`union`,options:e,...C(t)})}var Nl=T(`ZodDiscriminatedUnion`,(e,t)=>{jl.init(e,t),Na.init(e,t)});function Pl(e,t,n){return new Nl({type:`union`,options:t,discriminator:e,...C(n)})}var Fl=T(`ZodIntersection`,(e,t)=>{Pa.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vc(e,t,n,r)});function Il(e,t){return new Fl({type:`intersection`,left:e,right:t})}var Ll=T(`ZodRecord`,(e,t)=>{Jc(),La.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sc(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Rl(e,t,n){return!t||!t._zod?new Ll({type:`record`,keyType:I(),valueType:e,...C(t)}):new Ll({type:`record`,keyType:e,valueType:t,...C(n)})}var zl=T(`ZodEnum`,(e,t)=>{Ra.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uc(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new zl({...t,checks:[],...C(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new zl({...t,checks:[],...C(r),entries:i})}});function U(e,t){return new zl({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...C(t)})}var Bl=T(`ZodLiteral`,(e,t)=>{za.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dc(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function W(e,t){return new Bl({type:`literal`,values:Array.isArray(e)?e:[e],...C(t)})}var Vl=T(`ZodTransform`,(e,t)=>{Jc(),Ba.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pc(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tr(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ln(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ln(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Hl(e){return new Vl({type:`transform`,transform:e})}var Ul=T(`ZodOptional`,(e,t)=>{Ha.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wl(e){return new Ul({type:`optional`,innerType:e})}var Gl=T(`ZodExactOptional`,(e,t)=>{Ua.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kl(e){return new Gl({type:`optional`,innerType:e})}var ql=T(`ZodNullable`,(e,t)=>{Wa.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Jl(e){return new ql({type:`nullable`,innerType:e})}var Yl=T(`ZodDefault`,(e,t)=>{Ga.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Xl(e,t){return new Yl({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():un(t)}})}var Zl=T(`ZodPrefault`,(e,t)=>{qa.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ql(e,t){return new Zl({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():un(t)}})}var $l=T(`ZodNonOptional`,(e,t)=>{Ja.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function eu(e,t){return new $l({type:`nonoptional`,innerType:e,...C(t)})}var tu=T(`ZodCatch`,(e,t)=>{Za.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function nu(e,t){return new tu({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Yn(t)})}var ru=T(`ZodPipe`,(e,t)=>{Qa.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ac(e,t,n,r),e.in=t.in,e.out=t.out});function iu(e,t){return new ru({type:`pipe`,in:e,out:t})}var au=T(`ZodPreprocess`,(e,t)=>{ru.init(e,t),eo.init(e,t)}),ou=T(`ZodReadonly`,(e,t)=>{to.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function su(e){return new ou({type:`readonly`,innerType:e})}var cu=T(`ZodCustom`,(e,t)=>{ro.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fc(e,t,n,r)});function lu(e,t={}){return ks(cu,e,t)}function uu(e,t){return As(e,t)}function du(e,t){return new au({type:`pipe`,in:Hl(e),out:t})}function fu(e){return $o(Zc,e)}var G=I().regex(/^[a-z0-9][a-z0-9-]{0,31}$/,`expected 1-32 lowercase letters, digits, or hyphens, starting with a letter or digit`),K=I().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/,`expected a ULID`),q=I().regex(/^(?:[a-z0-9][a-z0-9-]{0,31}\/)?[a-z0-9][a-z0-9-]{0,31}$/,`expected <channel> or <project>/<channel>`);function pu(e){let t=e.indexOf(`/`);return t===-1?{project:null,channel:e}:{project:e.slice(0,t),channel:e.slice(t+1)}}function mu(e,t){return e===null?t:`${e}/${t}`}var J=du(e=>e instanceof Date?e.toISOString():e,fu()),hu=U([`post_message`,`read_inbox`,`search`,`open_thread`,`close_thread`,`create_task`,`claim_task`,`release_task`,`update_task`,`get_task`,`subscribe`,`unsubscribe`,`propose`,`approve`,`reject`,`create_project`,`join_project`,`leave_project`,`write_knowledge`,`plan_task`,`advance_task`,`configure_project`,`archive_project`]),gu=U([`user_post`,`ops_event`,`heartbeat`]),_u=H({name:G,purpose:I().min(1),verbs:V(hu),wakeTriggers:V(gu).default([`heartbeat`]),reviewDate:I().optional(),maxReplicas:R().int().min(1).default(1),backlogThreshold:R().positive().default(3),resident:z().default(!1),societyScope:z().default(!1),reflects:z().default(!0)}),vu=`user`,yu=`user`,bu=[`post_message`,`read_inbox`,`search`,`open_thread`,`close_thread`,`create_task`,`claim_task`,`release_task`,`update_task`,`get_task`,`subscribe`,`unsubscribe`,`propose`,`join_project`,`leave_project`,`write_knowledge`,`plan_task`,`advance_task`],xu=[`approve`,`reject`],Su=[`create_project`],Cu=[`configure_project`],wu=[`archive_project`];[...bu,...xu,...Su,...Cu,...wu],[...bu,...xu,...Cu],[...bu,...Su,...Cu];var Tu=`asks`,Eu=`society`;function Du(e,t){return t!==null&&e.memberships.includes(t)?t:Eu}var Y=U([`claude`,`codex`]),Ou=H({name:I().min(1),version:W(1),createdAt:J,channels:V(G)}),ku=U([`none`,`merge`]),Au=I().regex(/^s[1-9][0-9]*$/,`expected a stage id such as s1`),ju={name:I().trim().min(1).max(120),role:G.optional(),agent:G.optional(),gate:z().default(!1)};function Mu(e){return e.role===void 0||e.agent===void 0}var Nu={message:`a stage names a role or an agent, not both`},Pu=H(ju).refine(Mu,Nu),Fu=H({id:Au.optional(),...ju}).refine(Mu,Nu),Iu=H({slug:G,name:I().min(1),repo:I().nullable(),defaultBranch:I().min(1),channels:V(G),members:V(G),approvers:V(G),requiredCapabilities:V(I()),createdAt:J,onDone:ku.default(`none`),runner:G.optional(),archived:H({at:J,by:G,reason:I().min(1)}).optional()}),Lu=Ml([H({action:U([`advanced`,`returned`,`abandoned`,`landed`,`reopened`]),stage:Au,to:Au.nullable()}),H({action:U([`approved`,`rejected`])})]);function Ru(e){return`stage`in e}var zu=H({id:K,author:G,channel:q,thread:K.optional(),task:K.optional(),closes:K.optional(),step:Lu.optional(),ts:J,mentions:V(G)}),Bu=U([`open`,`claimed`,`done`,`abandoned`]),Vu=U([`open`,`closed`]),Hu=H({kind:U([`task`,`proposal`]),id:K}),Uu=H({id:K,channel:q,title:I().min(1).max(200),subject:Hu.optional(),state:Vu,openedBy:G,openedAt:J,closedBy:G.optional(),closedAt:J.optional()}),Wu=H({id:Au,name:I().min(1),role:G.optional(),agent:G.optional(),gate:z().default(!1),holders:V(G).default([]),completedBy:G.optional(),completedAt:J.optional()}),Gu=H({from:Au,by:G,at:J}),Ku=H({id:K,project:G,title:I().min(1),status:Bu,createdBy:G,createdAt:J,updatedAt:J,claimedBy:G.optional(),leaseExpiresAt:J.optional(),parentId:K.optional(),blockedBy:V(K),requiredCapabilities:V(I()),stages:V(Wu).min(1),stage:Au,stageSince:J,stageSeq:R().int().positive(),onDone:ku.default(`none`),completing:z().default(!1),returned:Gu.optional()});function qu(e,t){return e.stages.findIndex(e=>e.id===t)}function Ju(e){return e.stages.find(t=>t.id===e.stage)}var Yu=I().trim().min(1).max(120).regex(/^[\w.:/[\]-]+$/,`a model name is one word of letters, digits, and . _ : / - [ ]`),Xu=I().trim().min(1).max(32).regex(/^[a-z][a-z0-9_-]*$/,`an effort is one lowercase word, such as high`),Zu=H({id:Xu,description:I().default(``)}),Qu=H({id:Yu,name:I(),description:I().default(``),isDefault:z().default(!1),efforts:V(Zu).default([]),defaultEffort:Xu.optional()}),$u=U([`active`,`retired`]),ed=H({name:G,role:G,cli:Y.nullable(),model:I().optional(),effort:I().optional(),homeRunner:G.optional(),memberships:V(G),subscriptions:V(q),status:$u,createdAt:J,tokenHash:I().min(1),retiredAt:J.optional(),retiredReason:I().optional()}),td=H({name:G,role:G,cli:Y.nullable(),homeRunner:G.optional(),status:$u,resident:z().default(!1),model:I().optional(),lastModel:I().optional(),effort:I().optional(),skills:V(G).default([]),memberships:V(G),subscriptions:V(q),claimsHeld:R().int().nonnegative().default(0),tasksDone:R().int().nonnegative().default(0),lastTurnAt:J.optional(),lastTurnOutcome:I().optional(),createdAt:J,retiredAt:J.optional()}),nd=U([`linux`,`windows`,`darwin`]),rd=H({name:G,os:nd,clis:V(Y),capabilities:V(I()),status:U([`connected`,`disconnected`]),lastSeen:J.optional()}),id=U([`role`,`member`,`channel`,`reallocation`,`retirement`,`skill`,`archive`]),ad=U([`proposed`,`approved`,`rejected`,`provisioned`,`retired`]),od=H({name:G,role:G,cli:Y,model:I().optional(),homeRunner:G.optional(),memberships:V(G).default([]),subscriptions:V(q).default([]),seedInstructions:I().optional()}),sd=H({project:G.nullable().default(null),name:G,purpose:I().min(1)}),cd=H({description:I().min(1)}),ld=H({agent:G,reason:I().min(1)}),ud=H({project:G,reason:I().min(1)}),dd=H({name:G,summary:I().min(1).max(200),body:I().min(1)}),fd={role:[vu],member:[vu],retirement:[vu],archive:[vu],channel:[vu,`steward`],reallocation:[vu,`steward`],skill:[vu,`steward`]};function pd(e,t){switch(e){case`member`:{let e=od.safeParse(t);if(!e.success)break;let{name:n,role:r,cli:i,memberships:a}=e.data;return`member ${n} as ${r} on ${i}${a.length===0?``:` for ${a.join(`, `)}`}`}case`role`:{let e=_u.safeParse(t);if(!e.success)break;let{name:n,verbs:r,maxReplicas:i}=e.data;return`role ${n} (${r.length} verbs, up to ${i} per project)`}case`channel`:{let e=sd.safeParse(t);if(!e.success)break;return`channel ${mu(e.data.project,e.data.name)}: ${e.data.purpose}`}case`retirement`:{let e=ld.safeParse(t);if(!e.success)break;return`retirement of ${e.data.agent}: ${e.data.reason}`}case`reallocation`:{let e=cd.safeParse(t);if(!e.success)break;return`reallocation: ${e.data.description}`}case`skill`:{let e=dd.safeParse(t);if(!e.success)break;return`skill ${e.data.name}: ${e.data.summary.trim().replace(/\.+$/,``)}`}case`archive`:{let e=ud.safeParse(t);if(!e.success)break;return`archive of project ${e.data.project}: ${e.data.reason}`}}return`${e} ${JSON.stringify(t)}`}var md=H({name:G,summary:I().default(``),scope:U([`own`,`society`]),path:I().min(1)}),hd=H({path:I().min(1),file:I().min(1),since:J}),gd=I().regex(/^[0-9a-f]{40}([0-9a-f]{24})?$/),_d=H({path:I().min(1),status:U([`added`,`modified`,`deleted`]),added:R().int().nonnegative().nullable(),removed:R().int().nonnegative().nullable()}),vd=H({changes:V(H({commit:gd,at:J,kind:U([`turn`,`board`,`merge`]),author:I(),turnId:K.optional(),subject:I(),files:V(_d)})),more:z()}),yd=_d.pick({path:!0,status:!0}).extend({patch:I().nullable(),truncated:z()}),bd=H({topic:G,project:G.nullable(),updatedBy:G,updatedAt:J}),xd=H({id:K,kind:id,proposedBy:G,status:ad,createdAt:J,decidedBy:G.optional(),decidedAt:J.optional(),reason:I().optional(),charter:Rl(I(),B()),provisionedAt:J.optional(),provision:Rl(I(),B()).optional()}),Sd=H({id:K,proposalId:K,decidedBy:G,outcome:U([`approved`,`rejected`]),reason:I().optional(),ts:J});H({channel:q.optional(),body:I().min(1),thread_id:K.optional()}),H({since_cursor:K.nullable().optional(),limit:R().int().positive().max(200).default(50),advance:z().default(!0)}),H({query:I().min(1),project:G.optional(),channel:q.optional(),limit:R().int().positive().max(100).default(20)}),H({task_id:K.optional(),proposal_id:K.optional(),channel:q.optional(),title:I().min(1).max(200).optional()}),H({thread_id:K,summary:I().min(1)}),H({project:G,title:I().min(1).max(200),body:I().default(``),parent_id:K.optional(),required_capabilities:V(I()).default([]),stages:V(Pu).min(1).optional()}),H({task_id:K}),H({task_id:K}),H({task_id:K,stage:Au.optional(),status:U([`abandoned`]).optional(),note:I().min(1).optional(),blocked_by:V(K).optional()}),H({task_id:K}),H({channel:q}),H({channel:q}),H({kind:id,charter:Rl(I(),B()),rationale:I().default(``)}),H({proposal_id:K,reason:I().optional()}),H({proposal_id:K,reason:I().min(1)}),H({slug:G,name:I().min(1).optional(),repo:I().min(1).nullable().default(null),default_branch:I().min(1).default(`main`),on_done:ku.optional()}),H({project:G,agent:G.optional()}),H({project:G,agent:G.optional()}),H({project:G.nullable().default(null),topic:G,body:I().min(1)}),H({task_id:K,stages:V(Fu),on_done:ku.optional()}),H({task_id:K,note:I().min(1).optional()}),H({project:G,on_done:ku}),H({project:G,reason:I().min(1)});var Cd=H({id:K,ts:J,type:U(`society.initialized,project.added,project.configured,project.archived,project.placed,agent.added,agent.configured,agent.placed,message.posted,thread.opened,thread.closed,task.created,task.claimed,task.released,task.updated,task.planned,task.advanced,task.moved,task.completing,task.completed,task.reopened,lease.expired,subscription.changed,proposal.created,proposal.decided,proposal.provisioned,channel.added,role.added,agent.retired,agent.joined,agent.left,knowledge.written,skill.promoted,runner.added,user.signed_in,user.signed_out,user.token_rotated,runner.changed,ops.signal,paused.changed,wake.requested,turn.started,turn.steered,turn.stopped,turn.completed,turn.failed,merge.completed,merge.failed`.split(`,`)),actor:G,payload:Rl(I(),B())}),wd=H({inputTokens:R().int().nonnegative(),outputTokens:R().int().nonnegative(),cacheReadTokens:R().int().nonnegative().default(0),cacheWriteTokens:R().int().nonnegative().default(0)});function Td(e,t){return{inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,cacheReadTokens:e.cacheReadTokens+t.cacheReadTokens,cacheWriteTokens:e.cacheWriteTokens+t.cacheWriteTokens}}var Ed=H({summary:I().min(1),claimsHeld:V(K).default([]),blockedOn:V(I()).default([]),needsUserDecision:z().default(!1),memoryUpdated:z().default(!1)}),Dd=U([`completed`,`timeout`,`error`,`interrupted`,`blocked`,`stopped`]),Od=Pl(`type`,[H({type:W(`turn_started`),agent:G,session:I(),runner:G,model:I().optional()}),H({type:W(`steered`),steer:I().min(1),messages:V(K).optional(),text:I().optional()}),H({type:W(`text`),delta:I()}),H({type:W(`tool_call`),name:I(),input:B()}),H({type:W(`tool_result`),name:I(),ok:z(),output:I().optional()}),H({type:W(`approval_requested`),kind:I(),detail:B()}),H({type:W(`turn_completed`),usage:wd,costUsd:R().nonnegative(),status:Ed.nullable(),exitReason:Dd}),H({type:W(`error`),message:I()})]),kd=H({ts:J,event:Od}),Ad=H({seq:R().int().positive(),ts:J,agent:G,project:G,thread:K.optional(),event:Od});H({protocol:R().int().positive(),version:I().min(1),os:nd,clis:V(Y),residentClis:V(Y).default([]),steerableClis:V(Y).default([]),stoppableClis:V(Y).default([]),branchReads:z().default(!1),branchChanges:z().default(!1),capabilities:V(I()).default([]),slots:R().int().positive().nullable(),turns:V(K).default([])}),H({name:G,version:I()}),H({protocol:R().int().positive(),version:I().min(1).max(64),hostname:I().min(1).max(253),os:nd,clis:V(Y).max(8),capabilities:V(I().min(1).max(64)).max(32).default([])}),H({deviceCode:I().min(1),userCode:I().min(1),expiresAt:J,intervalMs:R().int().positive()}),H({deviceCode:I().min(1)}),Pl(`status`,[H({status:W(`pending`)}),H({status:W(`approved`),name:G,token:I().min(1)}),H({status:W(`denied`)})]);var jd=H({userCode:I().min(1),hostname:I(),os:nd,clis:V(Y),capabilities:V(I()),version:I(),requestedAt:J,expiresAt:J}),Md=H({slug:G,origin:I().nullable(),defaultBranch:I().min(1)}),Nd=Pl(`kind`,[H({kind:W(`home`)}),H({kind:W(`project`),repo:Md,branches:V(I().min(1))}),H({kind:W(`task`),repo:Md,taskId:K})]),Pd=H({turnId:K,agent:G,role:G,cli:Y,model:I().optional(),effort:I().optional(),scope:G,thread:K.optional(),session:I().min(1).nullable(),costSoFarUsd:R().nonnegative(),instructions:I(),prompt:I(),mcp:H({url:I().min(1),token:I().min(1)}),limits:H({timeoutMs:R().int().positive().nullable(),maxTurns:R().int().positive().nullable()}),resident:H({key:I().min(1),idleMs:R().int().positive()}).optional(),workspace:Nd}),Fd=H({branch:I().min(1),head:I().min(1)});H({entries:V(kd)}),H({exitReason:Dd,status:Ed.nullable(),error:I().nullable(),usage:wd,costUsd:R().nonnegative(),sessionCostUsd:R().nonnegative().optional(),session:I().min(1),model:I().nullable(),work:Fd.nullable()}),H({dropWorktree:z()});var Id=H({repo:Md,branch:I().min(1)});H({ok:z(),detail:I()});var Ld=8388608,Rd=I().max(4096).refine(e=>e===``||e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&!e.includes(`\0`)),{message:"a path inside the branch, with no empty, `.`, or `..` segment"}),zd=I().regex(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/),Bd=H({repo:Md,branch:zd,path:Rd}),Vd=H({id:I().min(1),at:J,author:I()}),Hd=Pl(`kind`,[H({kind:W(`file`),path:Rd,commit:Vd,size:R().int().nonnegative(),content:I().nullable()}),H({kind:W(`dir`),path:Rd,commit:Vd,entries:V(H({name:I().min(1),kind:U([`file`,`dir`]),size:R().int().nonnegative().nullable()}))})]),Ud=H({repo:Md,branch:zd}),Wd=H({head:Vd,files:V(H({path:I().min(1),status:U([`added`,`modified`,`deleted`]),added:R().int().nonnegative().nullable(),removed:R().int().nonnegative().nullable(),lastChange:H({author:I(),at:J}).optional()})),total:R().int().nonnegative()}),Gd=H({id:il(),text:I().min(1)});Pl(`type`,[H({type:W(`turn`),job:Pd}),H({type:W(`land`),request:I().min(1),land:Id}),H({type:W(`models`),request:I().min(1),cli:Y}),H({type:W(`file`),request:I().min(1),read:Bd}),H({type:W(`changes`),request:I().min(1),read:Ud}),H({type:W(`steer`),request:I().min(1),turnId:K,steer:Gd}),H({type:W(`stop`),request:I().min(1),turnId:K})]),Pl(`ok`,[H({ok:W(!0),value:B()}),H({ok:W(!1),error:I()})]),H({warm:V(I())}),H({files:Rl(I(),I())}),H({paths:V(I())}),H({files:Rl(I(),I())});var Kd=H({kind:U([`mention`,`stage`,`task_done`,`proposal_decided`,`heartbeat`,`reflection`,`onboarding`,`manual`,`ops_event`,`user_post`]),from:G.optional(),fromUser:z().default(!1),reason:I().default(``),taskId:K.optional(),messageId:K.optional(),channel:q.optional()});H({agent:G,project:G,thread:H({id:K,task:z()}).optional(),trigger:Kd,priority:R().int().min(0).max(2),onboarding:z().default(!1)});function qd(e,t,n){return n===void 0?`${e}/${t}`:`${e}/${t}/${n}`}function Jd(e){let[t,n,r,i]=e.split(`/`);return t===void 0||n===void 0||i!==void 0?null:r===void 0?{agent:t,scope:n}:{agent:t,scope:n,thread:r}}H({id:K.optional(),agent:G,project:G,thread:K.optional(),runner:G,cli:Y.nullable(),session:I().nullable(),trigger:Kd,startedAt:J,endedAt:J.nullable(),exitReason:Dd.nullable(),status:Ed.nullable(),error:I().nullable(),usage:wd.nullable(),costUsd:R().nonnegative().default(0),sessionCostUsd:R().nonnegative().optional(),toolCalls:R().int().nonnegative().default(0),model:I().nullable().default(null),work:Fd.optional(),stoppedBy:G.optional()});var Yd=H({turnId:K,agent:G,scope:G,thread:K.optional(),cli:Y,channel:q.optional(),steerable:z(),stoppable:z()});H({claude:I().optional(),codex:I().optional(),runner:G.optional()}),H({agent:G,project:G,reason:I().default(`manual wake`),kind:U([`manual`,`reflection`]).default(`manual`)});var Xd=H({id:K,turnId:K.optional(),ts:J,outcome:U([`completed`,`failed`]),project:G,thread:K.optional(),trigger:I(),exitReason:I().nullable(),costUsd:R(),usage:wd.optional(),model:I().nullable(),summary:I().nullable(),error:I().nullable(),startedAt:J.optional(),toolCalls:R().int().nonnegative().optional()}),Zd=U([`waiting_stage`,`backlog`,`role_gap`,`churn`,`stale_thread`,`idle_member`,`blocked_capability`,`turn_cost`,`scaled`,`runner`,`home_conflict`]),Qd=[`backlog`,`role_gap`,`churn`,`stale_thread`,`idle_member`,`blocked_capability`,`scaled`],$d=H({kind:Zd,key:I().min(1),summary:I().min(1),value:R(),threshold:R().optional(),project:G.optional(),agent:G.optional(),role:G.optional(),taskId:K.optional()}),ef=U([`24h`,`7d`,`all`]),X=R().int().nonnegative(),tf=R().nonnegative(),nf=H({window:ef,since:J.nullable(),until:J,idle:H({turns:X,idle:X,unknown:X,byTrigger:V(H({trigger:I(),turns:X,idle:X})),byAgent:V(H({agent:G,role:G.nullable(),turns:X,idle:X}))}),sentBack:H({finished:X,sendBacks:X,tasksSentBack:X,byStage:V(H({project:G,stage:I(),count:X})),bySender:V(H({agent:G,count:X}))}),messages:H({finished:X,messages:X,byProject:V(H({project:G,finished:X,messages:X})),busiest:V(H({taskId:K,title:I(),project:G,messages:X}))}),latency:H({mentions:X,unanswered:X,medianMs:tf.nullable(),slowestMs:tf.nullable(),byAgent:V(H({agent:G,mentions:X,medianMs:tf,slowestMs:tf}))}),decisions:H({total:X,byDay:V(H({day:I(),proposals:X,answers:X,stages:X}))}),blocked:V(H({taskId:K,title:I().nullable(),project:G.nullable(),summary:I(),firstAt:J,lastAt:J,holds:z()}))}),rf=U([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]),af=H({clientId:I().min(1),clientSecret:I().min(1),users:V(I().min(1)).min(1)});H({dataDir:I().min(1),host:I().min(1),port:R().int().positive().max(65535),publicUrl:I().min(1).nullable(),logLevel:rf,concurrency:R().int().positive().nullable(),turnTimeoutMs:R().int().positive().nullable(),toolRounds:R().int().positive().nullable(),residentIdleMs:R().int().positive(),github:af.nullable(),trustedProxies:R().int().min(0).max(16)}),H({serverUrl:I().url(),token:I().min(1).nullable(),dataDir:I().min(1),logLevel:rf,slots:R().int().positive().nullable(),clis:V(Y).min(1),capabilities:V(I())});var of=`stellaris.token`;function sf(){return localStorage.getItem(of)}function cf(e){localStorage.setItem(of,e)}function lf(){localStorage.removeItem(of)}var uf=H({github:z()});async function df(){try{let e=uf.safeParse(await(await fetch(`/auth/config`)).json());return e.success?e.data:{github:!1}}catch{return{github:!1}}}var ff=class extends Error{status;constructor(e,t){super(t),this.status=e}},pf=H({name:G,role:G,signIn:H({login:I().min(1),avatarUrl:ol()}).optional()}),mf=td.extend({profile:I()}).array(),hf=H({paused:z(),running:V(I()),pending:V(I()),resident:V(I()),signals:V(I()),turns:V(Yd).default([])});function gf(e){return e.flatMap(e=>{let t=Jd(e);return t===null?[]:[t]})}var _f=zu.extend({body:I()}),vf=_f.array(),yf=H({ref:q,project:G.nullable(),name:G,messages:R().int(),lastMessageId:K.nullable(),lastAt:I().nullable()}),bf=Uu.extend({body:I()}),xf=bf.extend({messages:R().int(),lastMessageId:K.nullable(),lastAuthor:G.nullable().default(null)}),Sf=H({thread:bf,messages:vf}),Cf=H({message:_f,thread:bf.nullable()}),wf=Ku.extend({body:I()}),Tf=xd.extend({body:I()}),Ef=bd.extend({body:I()}),Df=H({body:I()}),Of=H({data:Rl(I(),B()),body:I()});function kf(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}var Af=H({message:I()});async function Z(e,t,n){let r;try{r=await fetch(e,{headers:{authorization:`Bearer ${t}`}})}catch{throw new ff(0,`The board server is not reachable.`)}if(!r.ok){let t=Af.safeParse(await r.json().catch(()=>null));throw new ff(r.status,t.success?t.data.message:`${e} answered ${r.status}`)}return n.parse(await r.json())}async function Q(e,t,n,r,i){let a;try{a=await fetch(t,{method:e,headers:{authorization:`Bearer ${n}`,"content-type":`application/json`},body:JSON.stringify(r)})}catch{throw new ff(0,`The board server is not reachable.`)}if(!a.ok){let e=Af.safeParse(await a.json().catch(()=>null));throw new ff(a.status,e.success?e.data.message:`${t} answered ${a.status}`)}return i.parse(await a.json())}function jf(e,t,n,r){return Q(`POST`,`/api/verbs/${e}`,t,n,r)}var Mf=H({paused:z()}),Nf=H({id:K,ts:I(),signal:$d}),Pf=ed.omit({tokenHash:!0}),Ff=H({signedOut:z()}),If=H({denied:z()}),Lf=H({stopped:z()});function Rf(e){return{me:()=>Z(`/api/me`,e,pf),signOut:()=>Q(`DELETE`,`/api/sign-in`,e,{},Ff),society:()=>Z(`/api/society`,e,Ou),members:()=>Z(`/api/members`,e,mf),projects:()=>Z(`/api/projects`,e,Iu.array()),roles:()=>Z(`/api/roles`,e,_u.array()),scheduler:()=>Z(`/api/scheduler`,e,hf),signals:t=>Z(`/api/signals?limit=${t}`,e,Nf.array()),metrics:t=>Z(`/api/metrics?window=${t}`,e,nf),channels:()=>Z(`/api/channels`,e,yf.array()),channel:t=>Z(`/api/channels/${kf(t)}`,e,vf),threads:()=>Z(`/api/threads`,e,xf.array()),requests:()=>Z(`/api/requests`,e,Cf.array()),thread:t=>Z(`/api/threads/${encodeURIComponent(t)}`,e,Sf),tasks:t=>Z(`/api/projects/${encodeURIComponent(t)}/tasks`,e,wf.array()),task:t=>Z(`/api/tasks/${encodeURIComponent(t)}`,e,wf),taskFile:(t,n)=>Z(`/api/tasks/${encodeURIComponent(t)}/files${n.split(`/`).filter(e=>e!==``).map(e=>`/${encodeURIComponent(e)}`).join(``)}`,e,Hd),taskChanges:t=>Z(`/api/tasks/${encodeURIComponent(t)}/changes`,e,Wd),proposals:()=>Z(`/api/proposals`,e,Tf.array()),proposal:t=>Z(`/api/proposals/${encodeURIComponent(t)}`,e,Tf),skills:()=>Z(`/api/skills`,e,md.array()),turns:(t,n)=>Z(`/api/agents/${encodeURIComponent(t)}/turns?limit=${n}`,e,Xd.array()),transcript:(t,n)=>Z(`/api/agents/${encodeURIComponent(t)}/turns/${encodeURIComponent(n)}`,e,kd.array()),memory:t=>Z(`/api/agents/${encodeURIComponent(t)}/memory`,e,Df),agentSkills:t=>Z(`/api/agents/${encodeURIComponent(t)}/skills`,e,md.array()),history:(t,n)=>Z(`/api/agents/${encodeURIComponent(t)}/history?limit=${n}`,e,vd),change:(t,n)=>Z(`/api/agents/${encodeURIComponent(t)}/history/${encodeURIComponent(n)}`,e,yd.array()),conflicts:t=>Z(`/api/agents/${encodeURIComponent(t)}/conflicts`,e,hd.array()),dashboard:t=>Z(`/api/projects/${encodeURIComponent(t)}/dashboard`,e,Of),knowledge:t=>Z(t===`society`?`/api/society/knowledge`:`/api/projects/${encodeURIComponent(t)}/knowledge`,e,Ef.array()),sendMessage:t=>jf(`post_message`,e,t,_f),openThread:t=>jf(`open_thread`,e,t,bf),closeThread:t=>jf(`close_thread`,e,t,_f),approve:t=>jf(`approve`,e,t,Sd),reject:t=>jf(`reject`,e,t,Sd),wake:t=>Q(`POST`,`/api/wake`,e,t,Cd),setPaused:t=>Q(`POST`,t?`/api/pause`:`/api/resume`,e,{},Mf),stopTurn:t=>Q(`POST`,`/api/turns/${encodeURIComponent(t)}/stop`,e,{},Lf),models:t=>Z(`/api/models/${t}`,e,Qu.array()),runners:()=>Z(`/api/runners`,e,rd.array()),enrollments:()=>Z(`/api/enrollments`,e,jd.array()),approveEnrollment:(t,n)=>Q(`POST`,`/api/enrollments/${encodeURIComponent(t)}/approve`,e,{name:n},rd),denyEnrollment:t=>Q(`POST`,`/api/enrollments/${encodeURIComponent(t)}/deny`,e,{},If),setRunner:(t,n)=>Q(`PUT`,`/api/agents/${encodeURIComponent(t)}/runner`,e,{runner:n},Pf),setModel:(t,n)=>Q(`PUT`,`/api/agents/${encodeURIComponent(t)}/model`,e,{model:n},Pf),setEffort:(t,n)=>Q(`PUT`,`/api/agents/${encodeURIComponent(t)}/effort`,e,{effort:n},Pf)}}var zf=(0,m.createContext)(null);function $(){let e=(0,m.useContext)(zf);if(e===null)throw Error(`useSession needs a signed-in SessionContext`);return e}function Bf(){let{api:e}=$();return x({queryKey:[`society`],queryFn:e.society,staleTime:6e4})}function Vf(){let{api:e}=$();return x({queryKey:[`me`],queryFn:e.me,staleTime:1/0})}function Hf(){let{api:e}=$();return x({queryKey:[`members`],queryFn:e.members,refetchInterval:3e4})}function Uf(){let{api:e}=$();return x({queryKey:[`projects`],queryFn:e.projects,refetchInterval:6e4})}function Wf(){let{api:e}=$();return x({queryKey:[`roles`],queryFn:e.roles,refetchInterval:6e4})}function Gf(){let{api:e}=$();return x({queryKey:[`scheduler`],queryFn:e.scheduler,refetchInterval:3e3})}function Kf(){let{api:e}=$();return x({queryKey:[`requests`],queryFn:e.requests,refetchInterval:6e4})}function qf(e){let{api:t}=$();return x({queryKey:[`signals`],queryFn:()=>t.signals(200),enabled:e,refetchInterval:6e4})}function Jf(e){let{api:t}=$();return x({queryKey:[`metrics`,e],queryFn:()=>t.metrics(e),refetchInterval:6e4})}function Yf(){let{api:e}=$();return x({queryKey:[`channels`],queryFn:e.channels,refetchInterval:6e4})}function Xf(){let{api:e}=$();return x({queryKey:[`threads`],queryFn:e.threads,refetchInterval:6e4})}function Zf(e){let{api:t}=$();return x({queryKey:[`tasks`,e],queryFn:()=>t.tasks(e),refetchInterval:6e4})}function Qf(e){return e.flatMap(e=>e.data??[])}function $f(){let{api:e}=$();return ft({queries:(Uf().data??[]).map(t=>({queryKey:[`tasks`,t.slug],queryFn:()=>e.tasks(t.slug),refetchInterval:6e4})),combine:Qf})}function ep(e){let{api:t}=$();return x({queryKey:[`task`,e],queryFn:()=>t.task(e??``),enabled:e!==null})}function tp(e,t){let{api:n}=$();return x({queryKey:[`task-file`,e,t],queryFn:()=>n.taskFile(e,t),staleTime:3e4,retry:(e,t)=>e<1&&!(t instanceof ff&&(t.status===404||t.status===503))})}function np(e){let{api:t}=$();return x({queryKey:[`task-changes`,e],queryFn:()=>t.taskChanges(e),staleTime:3e4,retry:(e,t)=>e<1&&!(t instanceof ff&&(t.status===404||t.status===503))})}function rp(){let{api:e}=$();return x({queryKey:[`proposals`],queryFn:e.proposals,refetchInterval:6e4})}function ip(e){let{api:t}=$();return x({queryKey:[`proposal`,e],queryFn:()=>t.proposal(e)})}function ap(){let{api:e}=$();return x({queryKey:[`skills`],queryFn:e.skills,staleTime:6e4})}function op(e,t){let{api:n}=$();return x({queryKey:[`turns`,e,t],queryFn:()=>n.turns(e,t),refetchInterval:6e4})}function sp(e,t){let{api:n}=$();return x({queryKey:[`transcript`,e,t],queryFn:()=>n.transcript(e,t??``),enabled:t!==null,staleTime:1/0})}function cp(e){let{api:t}=$();return x({queryKey:[`memory`,e],queryFn:()=>t.memory(e)})}function lp(e){let{api:t}=$();return x({queryKey:[`agent-skills`,e],queryFn:()=>t.agentSkills(e)})}function up(e,t){let{api:n}=$();return x({queryKey:[`history`,e,t],queryFn:()=>n.history(e,t),placeholderData:be})}function dp(e,t,n){let{api:r}=$();return x({queryKey:[`home-change`,e,t],queryFn:()=>r.change(e,t),enabled:n,staleTime:1/0})}function fp(e){let{api:t}=$();return x({queryKey:[`conflicts`,e],queryFn:()=>t.conflicts(e)})}function pp(e){let{api:t}=$();return x({queryKey:[`dashboard`,e],queryFn:()=>t.dashboard(e),refetchInterval:6e4})}function mp(e){let{api:t}=$();return x({queryKey:[`knowledge`,e],queryFn:()=>t.knowledge(e),refetchInterval:12e4})}function hp(){let{api:e}=$();return x({queryKey:[`runners`],queryFn:()=>e.runners(),refetchInterval:6e4})}function gp(){let{api:e}=$();return x({queryKey:[`enrollments`],queryFn:e.enrollments,refetchInterval:5e3})}function _p(e){let{api:t}=$();return x({queryKey:[`models`,e],queryFn:()=>t.models(e??`claude`),enabled:e!==null,staleTime:6e5,retry:!1})}function vp(e){let[t,n]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var yp=[[`day`,86400],[`hour`,3600],[`minute`,60]],bp=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`});function xp(e,t){let n=Math.round((Date.parse(e)-t)/1e3);for(let[e,t]of yp)if(Math.abs(n)>=t)return bp.format(Math.round(n/t),e);return`just now`}function Sp(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function Cp(e,t=220){let n=(e.split(/\n\s*\n/).map(e=>e.trim()).find(e=>e.length>0&&!e.startsWith(`#`))??``).replaceAll(/[*_`>]/g,``).replaceAll(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`}export{Tu as $,ce as $t,Bf as A,St as At,lf as B,kt as Bt,Kf as C,Vt as Ct,$ as D,Nt as Dt,Gf as E,Dt as Et,Xf as F,gt as Ft,ef as G,Re as Gt,gf as H,x as Ht,sp as I,At as It,qd as J,Ae as Jt,Qd as K,Pe as Kt,op as L,Ct as Lt,np as M,ht as Mt,tp as N,Ot as Nt,qf as O,vt as Ot,Zf as P,_t as Pt,Td as Q,le as Qt,ff as R,mt as Rt,rp as S,I as St,hp as T,Pt as Tt,cf as U,Ue as Ut,Rf as V,bt as Vt,sf as W,ze as Wt,Cd as X,ae as Xt,Ld as Y,ke as Yt,Ad as Z,ue as Zt,Jf as _,pu as _t,lp as a,Te as an,ld as at,Uf as b,H as bt,pp as c,g as cn,Ju as ct,fp as d,o as dn,qu as dt,se as en,ud as et,up as f,s as fn,Du as ft,cp as g,mu as gt,Hf as h,vu as ht,zf as i,me as in,cd as it,ep as j,Mt as jt,ap as k,jt as kt,gp as l,p as ln,pd as lt,Vf as m,yu as mt,Cp as n,de as nn,od as nt,$f as o,Ce as on,Eu as ot,mp as p,l as pn,_u as pt,Jd as q,Ne as qt,Sp as r,b as rn,fd as rt,Yf as s,te as sn,dd as st,xp as t,v as tn,sd as tt,dp as u,d as un,Ru as ut,_p as v,V as vt,Wf as w,Ft as wt,ip as x,Rl as xt,vp as y,z as yt,df as z,yt as zt};
|