@spencerboucher/switchyard 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/bridge/lines.js +33 -0
- package/dist/bridge/switchyard-terminal.js +155 -23
- package/dist/switchyard.mjs +3879 -2658
- package/dist/terminal/holder.js +142 -51
- package/package.json +1 -1
- package/web-dist/apple-touch-icon.png +0 -0
- package/web-dist/assets/AutomationView-D7Syv1En.js +2 -0
- package/web-dist/assets/AutomationView-D7Syv1En.js.map +1 -0
- package/web-dist/assets/Checkbox-D6tRfEeI.js +2 -0
- package/web-dist/assets/Checkbox-D6tRfEeI.js.map +1 -0
- package/web-dist/assets/Copy-B6XSAIUd.js +2 -0
- package/web-dist/assets/Copy-B6XSAIUd.js.map +1 -0
- package/web-dist/assets/DangerZone-DfYlxDC1.js +2 -0
- package/web-dist/assets/DangerZone-DfYlxDC1.js.map +1 -0
- package/web-dist/assets/Field-D-Ty7fKT.js +2 -0
- package/web-dist/assets/Field-D-Ty7fKT.js.map +1 -0
- package/web-dist/assets/InteractionCard-DF1EcSpm.js +6 -0
- package/web-dist/assets/InteractionCard-DF1EcSpm.js.map +1 -0
- package/web-dist/assets/Menu-BfOszNC4.js +2 -0
- package/web-dist/assets/Menu-BfOszNC4.js.map +1 -0
- package/web-dist/assets/Overlay-DUQwh6_b.js +2 -0
- package/web-dist/assets/Overlay-DUQwh6_b.js.map +1 -0
- package/web-dist/assets/Priority-CHmzfoHg.js +2 -0
- package/web-dist/assets/Priority-CHmzfoHg.js.map +1 -0
- package/web-dist/assets/{SegmentedControl-D-2BCZzd.js → SegmentedControl-C_hEVQMB.js} +2 -2
- package/web-dist/assets/{SegmentedControl-D-2BCZzd.js.map → SegmentedControl-C_hEVQMB.js.map} +1 -1
- package/web-dist/assets/Select-Cfql4Nwu.js +2 -0
- package/web-dist/assets/Select-Cfql4Nwu.js.map +1 -0
- package/web-dist/assets/Switch-DBfzmqkm.js +2 -0
- package/web-dist/assets/Switch-DBfzmqkm.js.map +1 -0
- package/web-dist/assets/Tabs-BNuL3_Et.js +184 -0
- package/web-dist/assets/Tabs-BNuL3_Et.js.map +1 -0
- package/web-dist/assets/TextArea-CKybrQyn.js +2 -0
- package/web-dist/assets/TextArea-CKybrQyn.js.map +1 -0
- package/web-dist/assets/TextLink-OzzyP2-p.js +2 -0
- package/web-dist/assets/TextLink-OzzyP2-p.js.map +1 -0
- package/web-dist/assets/arrow-down-C-iLrN8I.js +2 -0
- package/web-dist/assets/arrow-down-C-iLrN8I.js.map +1 -0
- package/web-dist/assets/arrow-up-Dj-VTKx4.js +2 -0
- package/web-dist/assets/arrow-up-Dj-VTKx4.js.map +1 -0
- package/web-dist/assets/attention-V86Gye3I.js +2 -0
- package/web-dist/assets/attention-V86Gye3I.js.map +1 -0
- package/web-dist/assets/automations-Cw5Gacgm.js +2 -0
- package/web-dist/assets/automations-Cw5Gacgm.js.map +1 -0
- package/web-dist/assets/board-B8X7TYYR.js +10 -0
- package/web-dist/assets/board-B8X7TYYR.js.map +1 -0
- package/web-dist/assets/code-BKroYJmR.js +12 -0
- package/web-dist/assets/code-BKroYJmR.js.map +1 -0
- package/web-dist/assets/describe-D6KLGKWa.js +5 -0
- package/web-dist/assets/describe-D6KLGKWa.js.map +1 -0
- package/web-dist/assets/enroll-DwT7AcuS.js +2 -0
- package/web-dist/assets/enroll-DwT7AcuS.js.map +1 -0
- package/web-dist/assets/index-B3F7WcYf.css +2 -0
- package/web-dist/assets/index-hxvDvCS7.js +12 -0
- package/web-dist/assets/index-hxvDvCS7.js.map +1 -0
- package/web-dist/assets/logic-B46fwD-8.js +2 -0
- package/web-dist/assets/logic-B46fwD-8.js.map +1 -0
- package/web-dist/assets/more-DQR5uu1c.js +2 -0
- package/web-dist/assets/more-DQR5uu1c.js.map +1 -0
- package/web-dist/assets/queue-DUg1rS8t.js +2 -0
- package/web-dist/assets/queue-DUg1rS8t.js.map +1 -0
- package/web-dist/assets/repo-XzzzEI0d.js +2 -0
- package/web-dist/assets/repo-XzzzEI0d.js.map +1 -0
- package/web-dist/assets/server-BqZ-w6M8.js +2 -0
- package/web-dist/assets/server-BqZ-w6M8.js.map +1 -0
- package/web-dist/assets/settings-DyUu0tJM.js +8 -0
- package/web-dist/assets/settings-DyUu0tJM.js.map +1 -0
- package/web-dist/assets/states-ZhrxQa3K.js +56 -0
- package/web-dist/assets/states-ZhrxQa3K.js.map +1 -0
- package/web-dist/assets/terminal-BOV_MXPZ.js +2 -0
- package/web-dist/assets/terminal-BOV_MXPZ.js.map +1 -0
- package/web-dist/assets/terminal-login-S5CAd5xA.js +2 -0
- package/web-dist/assets/terminal-login-S5CAd5xA.js.map +1 -0
- package/web-dist/assets/useBackTo-BIrCq3W2.js +2 -0
- package/web-dist/assets/useBackTo-BIrCq3W2.js.map +1 -0
- package/web-dist/assets/useNow-Dj7oEiwn.js +2 -0
- package/web-dist/assets/useNow-Dj7oEiwn.js.map +1 -0
- package/web-dist/assets/useResource-CDGSq2At.js +2 -0
- package/web-dist/assets/useResource-CDGSq2At.js.map +1 -0
- package/web-dist/icon-192.png +0 -0
- package/web-dist/icon-512.png +0 -0
- package/web-dist/icon.svg +20 -8
- package/web-dist/index.html +3 -4
- package/web-dist/manifest.webmanifest +1 -1
- package/web-dist/maskable-512.png +0 -0
- package/web-dist/sw.js +1 -1
- package/web-dist/sw.js.map +1 -1
- package/web-dist/assets/AutomationView-BIW_pO0M.js +0 -2
- package/web-dist/assets/AutomationView-BIW_pO0M.js.map +0 -1
- package/web-dist/assets/Badge-BiDp7NKI.js +0 -2
- package/web-dist/assets/Badge-BiDp7NKI.js.map +0 -1
- package/web-dist/assets/InteractionCard-CWxyDv81.js +0 -6
- package/web-dist/assets/InteractionCard-CWxyDv81.js.map +0 -1
- package/web-dist/assets/Menu-BDt1bxwz.js +0 -2
- package/web-dist/assets/Menu-BDt1bxwz.js.map +0 -1
- package/web-dist/assets/Tabs-ByiPklAw.js +0 -184
- package/web-dist/assets/Tabs-ByiPklAw.js.map +0 -1
- package/web-dist/assets/TextArea-BYr88SnV.js +0 -2
- package/web-dist/assets/TextArea-BYr88SnV.js.map +0 -1
- package/web-dist/assets/arrow-left-C6YWM6y6.js +0 -2
- package/web-dist/assets/arrow-left-C6YWM6y6.js.map +0 -1
- package/web-dist/assets/attention-Bya8XHKI.js +0 -2
- package/web-dist/assets/attention-Bya8XHKI.js.map +0 -1
- package/web-dist/assets/automations-DiXKRcnE.js +0 -2
- package/web-dist/assets/automations-DiXKRcnE.js.map +0 -1
- package/web-dist/assets/board-BrLaJwLJ.js +0 -10
- package/web-dist/assets/board-BrLaJwLJ.js.map +0 -1
- package/web-dist/assets/code-DKLO8bzz.js +0 -11
- package/web-dist/assets/code-DKLO8bzz.js.map +0 -1
- package/web-dist/assets/copy-oWgGHmkS.js +0 -2
- package/web-dist/assets/copy-oWgGHmkS.js.map +0 -1
- package/web-dist/assets/describe-DnvH6_fl.js +0 -5
- package/web-dist/assets/describe-DnvH6_fl.js.map +0 -1
- package/web-dist/assets/dist-BE_V9dwJ.js +0 -56
- package/web-dist/assets/dist-BE_V9dwJ.js.map +0 -1
- package/web-dist/assets/enroll-DUDpbJoB.js +0 -2
- package/web-dist/assets/enroll-DUDpbJoB.js.map +0 -1
- package/web-dist/assets/index-DvRcMGEe.css +0 -2
- package/web-dist/assets/index-vIzH1m8u.js +0 -11
- package/web-dist/assets/index-vIzH1m8u.js.map +0 -1
- package/web-dist/assets/logic-xb-QF00E.js +0 -2
- package/web-dist/assets/logic-xb-QF00E.js.map +0 -1
- package/web-dist/assets/more-BP5x45cs.js +0 -2
- package/web-dist/assets/more-BP5x45cs.js.map +0 -1
- package/web-dist/assets/now--XjJC37b.js +0 -2
- package/web-dist/assets/now--XjJC37b.js.map +0 -1
- package/web-dist/assets/plus-BLP-wIYD.js +0 -2
- package/web-dist/assets/plus-BLP-wIYD.js.map +0 -1
- package/web-dist/assets/save-DEvZPWlS.js +0 -2
- package/web-dist/assets/save-DEvZPWlS.js.map +0 -1
- package/web-dist/assets/send-BKjswHxB.js +0 -2
- package/web-dist/assets/send-BKjswHxB.js.map +0 -1
- package/web-dist/assets/server-SxFxIScj.js +0 -2
- package/web-dist/assets/server-SxFxIScj.js.map +0 -1
- package/web-dist/assets/settings-D8T1esWq.js +0 -7
- package/web-dist/assets/settings-D8T1esWq.js.map +0 -1
- package/web-dist/assets/shared-CZ7fcu_B.js +0 -3
- package/web-dist/assets/shared-CZ7fcu_B.js.map +0 -1
- package/web-dist/assets/sliders-horizontal-DAoirila.js +0 -2
- package/web-dist/assets/sliders-horizontal-DAoirila.js.map +0 -1
- package/web-dist/assets/states--geW2Ntl.js +0 -2
- package/web-dist/assets/states--geW2Ntl.js.map +0 -1
- package/web-dist/assets/terminal-login-BJxV78au.js +0 -2
- package/web-dist/assets/terminal-login-BJxV78au.js.map +0 -1
- package/web-dist/assets/trash-C6X2OLrI.js +0 -2
- package/web-dist/assets/trash-C6X2OLrI.js.map +0 -1
- package/web-dist/assets/useNow-jxdoOC_1.js +0 -2
- package/web-dist/assets/useNow-jxdoOC_1.js.map +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./jsx-runtime-D13aM9HY.js";var t={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};t.node;var n=e(t);export{n as t};
|
|
2
|
-
//# sourceMappingURL=copy-oWgGHmkS.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy-oWgGHmkS.js","names":["createLucideIcon","__iconData","Copy"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/copy.mjs"],"sourcesContent":["/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"copy\",\n size: 24,\n node: [\n [\"rect\", { width: \"14\", height: \"14\", x: \"8\", y: \"8\", rx: \"2\", ry: \"2\", key: \"17jyea\" }],\n [\"path\", { d: \"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\", key: \"zix9uf\" }]\n ]\n};\n__iconData.node;\nconst Copy = createLucideIcon(__iconData);\n\nexport { __iconData, Copy as default };\n//# sourceMappingURL=copy.mjs.map\n"],"ignoreList":[0],"mappings":"A,8CASA,IAAMC,EAAa,CACjB,KAAM,OACN,KAAM,GACN,KAAM,CACJ,CAAC,OAAQ,CAAE,MAAO,KAAM,OAAQ,KAAM,EAAG,IAAK,EAAG,IAAK,GAAI,IAAK,GAAI,IAAK,IAAK,QAAS,CAAC,EACvF,CAAC,OAAQ,CAAE,EAAG,0DAA2D,IAAK,QAAS,CAAC,CAC1F,CACF,EACAA,EAAW,KACX,IAAMC,EAAOF,EAAiBC,CAAU,E"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{_ as e,m as t,n,t as r}from"./jsx-runtime-D13aM9HY.js";import{H as i,P as a,T as o,U as s,W as c,d as l,g as u,h as d,m as ee,q as f}from"./states--geW2Ntl.js";import{E as te,P as ne,l as p}from"./index-vIzH1m8u.js";import{n as m}from"./dist-BE_V9dwJ.js";var h={name:`octagon-alert`,size:24,node:[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]],aliases:[`alert-octagon`]};h.node;var re=n(h),g={name:`signal-high`,size:24,node:[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}],[`path`,{d:`M12 20v-8`,key:`i3yub9`}],[`path`,{d:`M17 20V8`,key:`1tkaf5`}]]};g.node;var ie=n(g),_={name:`signal-low`,size:24,node:[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}]]};_.node;var ae=n(_),v={name:`signal-medium`,size:24,node:[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}],[`path`,{d:`M12 20v-8`,key:`i3yub9`}]]};v.node;var y=n(v),b=e(t(),1),x=r();function oe({label:e,hint:t,error:n,children:r,className:i,optional:a}){let o=(0,b.useId)(),s=`${o}-hint`,c=`${o}-err`,l=[t?s:null,n?c:null].filter(Boolean).join(` `);return(0,x.jsxs)(`div`,{className:d(`flex min-w-0 flex-col gap-1`,i),children:[(0,x.jsxs)(`label`,{htmlFor:o,className:`text-sm font-medium`,children:[e,a&&(0,x.jsx)(`span`,{className:`font-normal text-muted`,children:` (optional)`})]}),r({id:o,"aria-invalid":n?!0:void 0,"aria-describedby":l||void 0}),t&&(0,x.jsx)(`p`,{id:s,className:`text-xs text-muted`,children:t}),n&&(0,x.jsx)(S,{id:c,children:n})]})}function S({id:e,children:t}){return(0,x.jsxs)(`p`,{id:e,className:`flex items-start gap-1 text-xs text-danger`,"data-field-error":!0,children:[(0,x.jsx)(u,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0`}),(0,x.jsx)(`span`,{children:t})]})}function C({className:e,children:t,...n}){return(0,x.jsx)(`select`,{className:d(`tap block h-9 w-full min-w-0 rounded-md border border-border bg-surface px-2.5 text-base text-text md:text-sm`,`focus:border-accent focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-0`,`aria-[invalid=true]:border-danger`,e),...n,children:t})}function se({checked:e,onChange:t,label:n,onText:r=`On`,offText:i=`Off`,busy:a,disabled:o,id:s,className:c}){return(0,x.jsxs)(`button`,{id:s,type:`button`,role:`switch`,"aria-checked":e,"aria-label":n,"aria-busy":a||void 0,disabled:o||a,onClick:()=>t(!e),className:d(`tap inline-flex min-h-9 shrink-0 items-center gap-2 rounded-md px-1.5 text-sm`,`hover:bg-surface-2 disabled:opacity-60`,c),children:[(0,x.jsx)(`span`,{"aria-hidden":!0,className:d(`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border transition-colors`,e?`border-accent bg-accent`:`border-border-strong bg-surface-2`),children:(0,x.jsx)(`span`,{className:d(`absolute size-3.5 rounded-full shadow-sm transition-transform`,e?`translate-x-[18px] bg-accent-fg`:`translate-x-[2px] bg-muted`)})}),a?(0,x.jsx)(l,{className:`size-3.5`}):null,(0,x.jsx)(`span`,{className:e?`text-text`:`text-muted`,children:e?r:i})]})}function ce({title:e,description:t,children:n,actions:r,className:i,testId:a}){let o=(0,b.useId)();return(0,x.jsxs)(`section`,{"aria-labelledby":o,"data-testid":a,className:d(`min-w-0 rounded-lg border border-border bg-surface p-4`,i),children:[(0,x.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-2`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`h2`,{id:o,className:`text-base font-semibold`,children:e}),t&&(0,x.jsx)(`p`,{className:`text-sm text-muted`,children:t})]}),r&&(0,x.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r})]}),(0,x.jsx)(`div`,{className:`flex flex-col gap-4`,children:n})]})}var le=[re,ie,y,ae];function ue({priority:e,className:t}){let n=le[e]??y;return(0,x.jsx)(n,{"aria-hidden":!0,className:d(`size-4 shrink-0`,e===0?`text-danger`:`text-muted`,t)})}function de({count:e}){return e>0?(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-sm text-warning`,children:[(0,x.jsx)(u,{"aria-hidden":!0,className:`size-4 shrink-0`}),e===1?`1 failure`:`${e} failures`]}):(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-sm text-muted`,children:[(0,x.jsx)(ne,{"aria-hidden":!0,className:`size-4 shrink-0`}),`No failures`]})}function fe({className:e}){let t=o();return t.state===`live`||t.state===`connecting`&&!t.lastSyncedAt?null:(0,x.jsxs)(`p`,{role:`status`,className:d(`flex items-start gap-1.5 rounded-md border border-border bg-warning-soft px-3 py-1.5 text-sm`,e),children:[(0,x.jsx)(te,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-warning`}),(0,x.jsxs)(`span`,{children:[`Showing last known automations`,t.lastSyncedAt?` from ${ee(t.lastSyncedAt)}`:``,`. Changes are sent once the coordinator is reachable again.`]})]})}var w=(e,t=``)=>`/api/automations/${encodeURIComponent(e)}${t}`,T=f()(e=>({byId:{},deleted:{},put:t=>e(e=>({byId:{...e.byId,[t.id]:t}})),putMany:t=>e(e=>{let n={...e.byId};for(let e of t)n[e.id]=e;return{byId:n}}),remove:t=>e(e=>{let n={...e.byId};return delete n[t],{byId:n,deleted:{...e.deleted,[t]:!0}}})}));function E(e,t){return e?t&&t.updatedAt>e.updatedAt?t:e:t}function pe(){let e=a(e=>e.automations),t=T(e=>e.byId),n=T(e=>e.deleted);return(0,b.useMemo)(()=>{let r={};for(let i of new Set([...Object.keys(e),...Object.keys(t)])){if(n[i])continue;let a=E(e[i],t[i]);a&&(r[i]=a)}return r},[e,t,n])}function me(e){let t=a(t=>e?t.automations[e]:void 0),n=T(t=>e?t.byId[e]:void 0);return T(t=>e?t.deleted[e]:void 0)?void 0:E(t,n)}function he(){let[e,t]=(0,b.useState)({});return{busy:e,toggle:(0,b.useCallback)(async(e,n)=>{t(t=>({...t,[e.id]:!0}));try{let t=await i(w(e.id),{enabled:n});t&&typeof t==`object`&&`id`in t&&T.getState().put(t),p.success(`${e.name} ${n?`enabled`:`disabled`}`)}catch(t){p.error(`Could not ${n?`enable`:`disable`} ${e.name}: ${c(t)}`)}finally{t(t=>({...t,[e.id]:!1}))}},[])}}function ge(e){let[t,n]=(0,b.useState)({});return{busy:t,run:(0,b.useCallback)(async t=>{n(e=>({...e,[t.id]:!0}));try{let n=await s(w(t.id,`/run`)),r=n&&typeof n==`object`?n.state:void 0;p.success(r&&r!==`fired`?`${t.name}: occurrence recorded (${r.replace(/_/g,` `)})`:`${t.name} started`),e?.()}catch(e){p.error(`Could not run ${t.name}: ${c(e)}`)}finally{n(e=>({...e,[t.id]:!1}))}},[e])}}var _e={manual:`Manual`,once:`Once`,cron:`Schedule`,webhook:`Webhook`,dependency:`Dependency`},D=[{value:`fresh`,label:`Fresh`,explanation:`Fresh: a new task per occurrence`},{value:`continue`,label:`Continue`,explanation:`Continue: reuse the task with the same grouping key`},{value:`watch`,label:`Watch`,explanation:`Watch: only raises attention when something relevant changed`}],ve=[{value:`skip`,label:`Skip`,explanation:`Skip: drop the occurrence while earlier work is still open`},{value:`queue_one`,label:`Queue one`,explanation:`Queue one: keep a single pending occurrence and fire it when the open work ends`},{value:`append`,label:`Append`,explanation:`Append: add the new objective to the open task (as a follow-up if it is running)`}],ye=[{value:`skip`,label:`Skip`,explanation:`Skip: occurrences missed while the coordinator was down are recorded and skipped`},{value:`run_once`,label:`Run once`,explanation:`Run once: on return, fire the newest missed occurrence once`}];function O(e){return D.find(t=>t.value===e)?.label??e}var k=[`{{date}}`,`{{time}}`,`{{occurrence}}`,`{{payload.<path>}}`];function A(e){return e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`}function j(e){return String(e).padStart(2,`0`)}function M(e){let t=e%100;if(t>=11&&t<=13)return`${e}th`;switch(e%10){case 1:return`${e}st`;case 2:return`${e}nd`;case 3:return`${e}rd`;default:return`${e}th`}}function N(e){return e&&e[0].toUpperCase()+e.slice(1)}function P(e){return e.split(`
|
|
2
|
-
`).map(e=>e.trim()).filter(e=>e.length>0)}var F=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],I=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],be=[{name:`Minute`,min:0,max:59},{name:`Hour`,min:0,max:23},{name:`Day of month`,min:1,max:31},{name:`Month`,min:1,max:12,names:I.map(e=>e.slice(0,3).toLowerCase())},{name:`Day of week`,min:0,max:7,names:F.map(e=>e.slice(0,3).toLowerCase())}];function L(e,t){let n=e.toLowerCase();if(t.names){let e=t.names.indexOf(n);if(e>=0)return t.min+e}if(!/^\d+$/.test(e))return`"${e}" is not a number`;let r=Number(e);return r<t.min||r>t.max?`${r} is out of range ${t.min}–${t.max}`:r}function xe(e,t){if(e===`*`||e===`?`)return{any:!0,values:[],step:null,extended:!1};if(/[LW#]/i.test(e)&&!t.names?.some(t=>e.toLowerCase().includes(t)))return/^[0-9A-Za-z*?,\-/#]+$/.test(e)?{any:!1,values:[],step:null,extended:!0}:`"${e}" is not valid`;let n=e.split(`,`),r=new Set,i=null;for(let e of n){if(!e)return`empty list item`;let[a,o,s]=e.split(`/`);if(s!==void 0)return`"${e}" has more than one step`;let c=1;if(o!==void 0){if(!/^\d+$/.test(o)||Number(o)<1)return`"${o}" is not a valid step`;c=Number(o)}let l,u;if(a===`*`||a===`?`)l=t.min,u=t.max;else if(a?.includes(`-`)){let[e,n]=a.split(`-`),r=L(e??``,t),i=L(n??``,t);if(typeof r==`string`)return r;if(typeof i==`string`)return i;if(r>i)return`range ${a} runs backwards`;l=r,u=i}else{let e=L(a??``,t);if(typeof e==`string`)return e;l=e,u=o===void 0?e:t.max}for(let e=l;e<=u;e+=c)r.add(e);n.length===1&&o!==void 0&&!a?.includes(`-`)&&(i={every:c,start:l})}let a=[...r].sort((e,t)=>e-t);t.max===7&&(a=[...new Set(a.map(e=>e%7))].sort((e,t)=>e-t));let o=t.max===7?7:t.max-t.min+1;return a.length===o&&!i?{any:!0,values:[],step:null,extended:!1}:{any:!1,values:a,step:i,extended:!1}}function R(e){let t=e.trim();if(!t)return`Enter a cron expression`;let n=t.split(/\s+/);if(n.length!==5)return`Expected 5 fields (minute hour day-of-month month day-of-week), got ${n.length}`;let r=[];for(let e=0;e<5;e++){let t=be[e],i=xe(n[e],t);if(typeof i==`string`)return`${t.name}: ${i}`;r.push(i)}return r}function z(e){let t=R(e);return typeof t==`string`?t:null}function Se(e){if(!e.trim())return`Enter a timezone`;try{return new Intl.DateTimeFormat(void 0,{timeZone:e.trim()}),null}catch{return`Unknown timezone "${e}"`}}function B(e){for(let t=1;t<e.length;t++)if(e[t]!==e[t-1]+1)return!1;return e.length>0}function Ce(e,t){if(e.any&&t.any)return{kind:`freq`,text:`Every minute`};if(e.step&&e.step.start===0&&t.any)return{kind:`freq`,text:e.step.every===1?`Every minute`:`Every ${e.step.every} minutes`};if(e.any)return t.step||t.values.length===0?null:B(t.values)?{kind:`freq`,text:`Every minute from ${j(t.values[0])}:00 to ${j(t.values[t.values.length-1])}:59`}:null;if(t.any)return e.step?null:e.values.length===1&&e.values[0]===0?{kind:`freq`,text:`Every hour`}:{kind:`freq`,text:`Every hour at ${A(e.values.map(e=>`:${j(e)}`))}`};if(t.step&&t.step.start===0&&e.values.length===1&&!e.step){let n=e.values[0]===0?``:` at :${j(e.values[0])}`;return{kind:`freq`,text:t.step.every===1?`Every hour${n}`:`Every ${t.step.every} hours${n}`}}if(e.values.length*t.values.length<=6){let n=[];for(let r of t.values)for(let t of e.values)n.push(`${j(r)}:${j(t)}`);return{kind:`at`,text:A(n)}}if(!B(t.values))return null;let n=t.values[0],r=t.values[t.values.length-1];if(e.step&&e.step.start===0)return{kind:`freq`,text:`Every ${e.step.every} minutes from ${j(n)}:00 to ${j(r)}:59`};if(e.values.length===1){let t=j(e.values[0]);return{kind:`freq`,text:`Every hour from ${j(n)}:${t} to ${j(r)}:${t}`}}return null}function we(e,t){return(e+6)%7-(t+6)%7}function Te(e,t,n){if(!e.any&&!n.any)return null;let r=t.any?null:A(t.values.map(e=>I[e-1])),i=r?` in ${r}`:``;if(!n.any){let e=[...n.values].sort(we),t=e.join(`,`);if(t===`1,2,3,4,5`)return{lead:`Every weekday${i}`,qual:` on weekdays${i}`};if(t===`6,0`)return{lead:`Every Saturday and Sunday${i}`,qual:` on weekends${i}`};let r=e.map(e=>F[e]);return{lead:`Every ${A(r)}${i}`,qual:` on ${A(r.map(e=>`${e}s`))}${i}`}}if(!e.any){if(e.values.length>5)return null;let t=A(e.values.map(M)),n=r||`every month`;return{lead:`On the ${t} of ${n}`,qual:` on the ${t} of ${n}`}}return{lead:`Every day${i}`,qual:i}}function V(e,t){let n=R(e);if(typeof n==`string`||n.some(e=>e.extended))return null;let[r,i,a,o,s]=n,c=Ce(r,i),l=Te(a,o,s);if(!c||!l)return null;let u=c.kind===`at`?`${l.lead} at ${c.text}`:`${c.text}${l.qual}`;return t?`${u} (${t})`:u}function Ee(e,t){return V(e,t)??`Cron ${e.trim()} (${t})`}function H(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function U(e,t={}){let n=t.formatDate??H;switch(e.kind){case`manual`:return`Manual`;case`once`:return e.at&&!Number.isNaN(Date.parse(e.at))?`Once at ${n(e.at)}`:`Once (no time chosen)`;case`cron`:return Ee(e.expr,e.timezone);case`webhook`:return`Webhook`;case`dependency`:{let n=e.taskId?t.taskTitle?.(e.taskId):void 0;return n?`When "${n}" is done`:e.taskId?`When task ${e.taskId} is done`:`When a task is done`}}}function De(e,t){let n=e.trigger;switch(n.kind){case`manual`:return`When run manually`;case`webhook`:{let t=e.filters.filter(e=>e.path.trim());return t.length===0?`When a webhook is received`:`When a webhook is received where ${A(t.map(e=>`${e.path.trim()} = "${e.equals}"`))}`}default:return U(n,t)}}function Oe(e,t={}){let n=e.template.title.trim()||`Untitled task`,r=t.projectName?` in ${t.projectName}`:``,i=t.hostName?` on ${t.hostName}`:` on the project's default host`,a=t.profileName?` with profile ${t.profileName}`:``,o;switch(e.mode){case`continue`:{let t=e.groupingKey?.trim();o=t?`continue the task grouped by "${t}" (or create "${n}")`:`continue the matching task (or create "${n}")`;break}case`watch`:o=`create a watch task "${n}" that only raises attention when something relevant changed`;break;default:o=`create a fresh task "${n}"`}let s=[`${De(e,t)}, ${o}${r}${i}${a}`];if(s.push(e.overlap===`skip`?`skip if previous work is still open`:e.overlap===`queue_one`?`queue one occurrence if previous work is still open`:`append to the open task if previous work is still open`),(e.trigger.kind===`cron`||e.trigger.kind===`once`)&&s.push(e.missed===`skip`?`skip missed runs`:`run missed runs once on return`),e.continuation.enabled){let t=e.continuation;s.push(`continue automatically up to ${t.maxContinuations} times within ${t.maxElapsedMinutes} minutes`)}let c=e.completion.checks;return c&&c.length>0&&s.push(`run ${c.length===1?`1 check`:`${c.length} checks`}`),s.push(e.completion.requireHumanReview?`requires human review`:`no human review required`),N(s.join(`; `))}function W(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}catch{return`UTC`}}function G(e={}){return{name:``,enabled:!0,projectId:e.projectId??``,triggerKind:`manual`,onceAt:``,cronExpr:`0 9 * * 1-5`,cronTimezone:e.timezone??W(),dependencyTaskId:``,filters:[],title:``,objective:``,criteria:``,priority:2,hostId:``,profileId:``,mode:`fresh`,groupingKey:``,overlap:`skip`,missed:`skip`,continuationEnabled:!1,continuationObjective:``,maxContinuations:`5`,maxElapsedMinutes:`60`,maxTokens:``,maxCostUsd:``,checks:``,requireHumanReview:!0}}function ke(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:`${t.getFullYear()}-${j(t.getMonth()+1)}-${j(t.getDate())}T${j(t.getHours())}:${j(t.getMinutes())}`}function K(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toISOString()}function Ae(e,t={}){let n=G({projectId:e.projectId,timezone:t.timezone}),r=e.trigger,i=e.continuation;return{...n,name:e.name,enabled:e.enabled,triggerKind:r.kind,onceAt:r.kind===`once`?ke(r.at):``,cronExpr:r.kind===`cron`?r.expr:n.cronExpr,cronTimezone:r.kind===`cron`?r.timezone:n.cronTimezone,dependencyTaskId:r.kind===`dependency`?r.taskId:``,filters:e.filters.map(e=>({...e})),title:e.template.title,objective:e.template.objective,criteria:e.template.acceptanceCriteria.join(`
|
|
3
|
-
`),priority:e.template.priority,hostId:e.hostId??``,profileId:e.profileId??``,mode:e.mode,groupingKey:e.groupingKey??``,overlap:e.overlap,missed:e.missed,continuationEnabled:i.enabled,continuationObjective:i.enabled?i.objective:``,maxContinuations:i.enabled?String(i.maxContinuations):n.maxContinuations,maxElapsedMinutes:i.enabled?String(i.maxElapsedMinutes):n.maxElapsedMinutes,maxTokens:i.enabled&&i.maxTokens!==null?String(i.maxTokens):``,maxCostUsd:i.enabled&&i.maxCostUsd!==null?String(i.maxCostUsd):``,checks:e.completion.checks?e.completion.checks.join(`
|
|
4
|
-
`):``,requireHumanReview:e.completion.requireHumanReview}}function q(e){return e.trim()===``?NaN:Number(e.trim())}function J(e){return e.trim()===``?null:Number(e.trim())}function je(e){switch(e.triggerKind){case`manual`:return{kind:`manual`};case`once`:return{kind:`once`,at:K(e.onceAt)};case`cron`:return{kind:`cron`,expr:e.cronExpr.trim(),timezone:e.cronTimezone.trim()};case`webhook`:return{kind:`webhook`};case`dependency`:return{kind:`dependency`,taskId:e.dependencyTaskId}}}function Y(e){let t=P(e.checks);return{name:e.name.trim(),enabled:e.enabled,projectId:e.projectId,trigger:je(e),filters:e.filters.filter(e=>e.path.trim()||e.equals.trim()).map(e=>({path:e.path.trim(),equals:e.equals})),template:{title:e.title.trim(),objective:e.objective,acceptanceCriteria:P(e.criteria),priority:e.priority},hostId:e.hostId||null,profileId:e.profileId||null,mode:e.mode,groupingKey:e.groupingKey.trim()||null,overlap:e.overlap,missed:e.missed,continuation:e.continuationEnabled?{enabled:!0,objective:e.continuationObjective.trim(),maxContinuations:q(e.maxContinuations),maxElapsedMinutes:q(e.maxElapsedMinutes),maxTokens:J(e.maxTokens),maxCostUsd:J(e.maxCostUsd)}:{enabled:!1},completion:{checks:t.length>0?t:null,requireHumanReview:e.requireHumanReview}}}var Me={name:`name`,enabled:`enabled`,projectId:`projectId`,trigger:`triggerKind`,"trigger.kind":`triggerKind`,"trigger.at":`onceAt`,"trigger.expr":`cronExpr`,"trigger.timezone":`cronTimezone`,"trigger.taskId":`dependencyTaskId`,"template.title":`title`,"template.objective":`objective`,"template.acceptanceCriteria":`criteria`,"template.priority":`priority`,hostId:`hostId`,profileId:`profileId`,mode:`mode`,groupingKey:`groupingKey`,overlap:`overlap`,missed:`missed`,"continuation.objective":`continuationObjective`,"continuation.maxContinuations":`maxContinuations`,"continuation.maxElapsedMinutes":`maxElapsedMinutes`,"continuation.maxTokens":`maxTokens`,"continuation.maxCostUsd":`maxCostUsd`,"completion.checks":`checks`,"completion.requireHumanReview":`requireHumanReview`};function X(e){let t=e.map(String);if(t[0]===`filters`&&t.length>=3)return`filters.${Number(t[1])}.${t[2]===`equals`?`equals`:`path`}`;if(t[0]===`template`&&t[1]===`acceptanceCriteria`)return`criteria`;if(t[0]===`completion`&&t[1]===`checks`)return`checks`;for(let e=t.length;e>0;e--){let n=Me[t.slice(0,e).join(`.`)];if(n)return n}return`form`}function Z(e,t,n,r){let i=q(e);return!Number.isInteger(i)||i<t||i>n?`${r} must be a whole number from ${t} to ${n}`:null}function Ne(e){let t={},n=(e,n)=>{n&&!t[e]&&(t[e]=n)};switch(e.name.trim()||n(`name`,`Name is required`),e.projectId||n(`projectId`,`Choose a project`),e.title.trim()||n(`title`,`Task title is required`),e.triggerKind){case`once`:K(e.onceAt)||n(`onceAt`,`Choose a date and time`);break;case`cron`:n(`cronExpr`,z(e.cronExpr)),n(`cronTimezone`,Se(e.cronTimezone));break;case`dependency`:e.dependencyTaskId||n(`dependencyTaskId`,`Choose the task to wait for`)}if(e.filters.forEach((e,t)=>{!e.path.trim()&&e.equals.trim()&&n(`filters.${t}.path`,`Enter a payload path`)}),e.mode===`continue`&&!e.groupingKey.trim()&&n(`groupingKey`,`A grouping key is required to continue an existing task`),e.continuationEnabled){if(e.continuationObjective.trim()||n(`continuationObjective`,`An objective is required when continuation is on`),n(`maxContinuations`,Z(e.maxContinuations,1,50,`Max continuations`)),n(`maxElapsedMinutes`,Z(e.maxElapsedMinutes,1,1440,`Max elapsed minutes`)),e.maxTokens.trim()){let t=q(e.maxTokens);(!Number.isInteger(t)||t<=0)&&n(`maxTokens`,`Max tokens must be a positive whole number`)}if(e.maxCostUsd.trim()){let t=q(e.maxCostUsd);(!Number.isFinite(t)||t<=0)&&n(`maxCostUsd`,`Max cost must be a positive amount`)}}let r=Y(e),i=m.safeParse(r);if(!i.success)for(let e of i.error.issues)n(X(e.path),e.message);return{input:i.success&&Object.keys(t).length===0?i.data:null,errors:t}}function Q(e){return e.scheduledFor??e.createdAt}function $(...e){let t=new Map;for(let n of e)for(let e of n??[])t.set(e.id,e);return[...t.values()].sort((e,t)=>t.createdAt.localeCompare(e.createdAt)||Q(t).localeCompare(Q(e)))}function Pe(e){if(Array.isArray(e))return e;if(e&&typeof e==`object`){let t=e;if(Array.isArray(t.items))return t.items;if(Array.isArray(t.occurrences))return t.occurrences}return[]}function Fe(e,t){return`curl -X POST -H 'Authorization: Bearer ${e}' -H 'Content-Type: application/json' -d '{}' ${t}`}export{se as A,fe as C,ue as D,S as E,ge as F,he as I,T as M,me as N,ce as O,pe as P,Ne as S,oe as T,O as _,_e as a,Oe as b,U as c,G as d,X as f,$ as g,W as h,k as i,w as j,C as k,Ae as l,K as m,D as n,Fe as o,H as p,ve as r,V as s,ye as t,Y as u,Pe as v,de as w,z as x,Q as y};
|
|
5
|
-
//# sourceMappingURL=describe-DnvH6_fl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"describe-DnvH6_fl.js","names":["__iconData","__iconData","__iconData","useId","useMemo","useState","useCallback","__toESM","require_react","require_jsx_runtime","apiPatch","useSyncStore","useConnection","apiPost","errorMessage","Spinner","TriangleAlert","cn","formatTime","create","CloudOff","CircleCheck","toast","AutomationInput","__iconData$3","OctagonAlert","createLucideIcon","__iconData$2","SignalHigh","__iconData$1","SignalLow","__iconData","SignalMedium","import_react","import_jsx_runtime","Field","id","hintId","errId","describedBy","hint","error","className","label","optional","children","FieldError","Select","rest","Switch","checked","busy","disabled","onChange","onText","offText","Section","testId","title","description","actions","PRIORITY_ICONS","PriorityIcon","Icon","priority","FailureCount","count","ConnectionNote","connection","automationPath","suffix","useLocalAutomations","set","s","a","byId","list","newer","b","useMergedAutomations","store","local","deleted","out","useMergedAutomation","fromStore","fromLocal","useToggleEnabled","setBusy","res","enabled","e","useRunNow","state","onDone","TRIGGER_KIND_LABELS","MODE_OPTIONS","OVERLAP_OPTIONS","MISSED_OPTIONS","modeLabel","m","mode","TEMPLATE_VARIABLES","listText","items","pad","n","ordinal","mod100","capitalize","lines","text","l","DAY_NAMES","MONTH_NAMES","CRON_FIELDS","d","parseValue","lower","token","def","idx","parseCronField","src","parts","values","step","part","base","stepStr","extra","every","start","end","av","bv","v","i","sorted","full","parseCron","trimmed","expr","fields","parsed","validateCron","validateTimezone","tz","isContiguous","describeTime","h","at","times","hv","mv","first","last","mm","mondayFirst","describeDays","dom","dow","months","mon","inMonths","days","key","names","ords","of","describeCron","f","time","timezone","describeCronOrRaw","formatAbsolute","iso","describeTrigger","fmt","ctx","trigger","triggerClause","t","input","filters","summarizeAutomation","project","host","profile","action","c","checks","localTimezone","emptyDraft","opts","isoToLocalInput","localInputToIso","value","draftFromAutomation","toNumber","toOptionalNumber","draftTrigger","draftToInput","PATH_TO_FIELD","fieldForPath","path","intError","min","max","validateDraft","errors","msg","raw","issue","occurrenceTime","o","mergeOccurrences","lists","normalizeHistory","r","curlExample","url"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/octagon-alert.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/signal-high.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/signal-low.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/signal-medium.mjs","../../src/features/automations/controls.tsx","../../src/features/automations/describe.ts"],"sourcesContent":["/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"octagon-alert\",\n size: 24,\n node: [\n [\"path\", { d: \"M12 16h.01\", key: \"1drbdi\" }],\n [\"path\", { d: \"M12 8v4\", key: \"1got3b\" }],\n [\n \"path\",\n {\n d: \"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z\",\n key: \"1fd625\"\n }\n ]\n ],\n aliases: [\"alert-octagon\"]\n};\n__iconData.node;\nconst OctagonAlert = createLucideIcon(__iconData);\n\nexport { __iconData, OctagonAlert as default };\n//# sourceMappingURL=octagon-alert.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"signal-high\",\n size: 24,\n node: [\n [\"path\", { d: \"M2 20h.01\", key: \"4haj6o\" }],\n [\"path\", { d: \"M7 20v-4\", key: \"j294jx\" }],\n [\"path\", { d: \"M12 20v-8\", key: \"i3yub9\" }],\n [\"path\", { d: \"M17 20V8\", key: \"1tkaf5\" }]\n ]\n};\n__iconData.node;\nconst SignalHigh = createLucideIcon(__iconData);\n\nexport { __iconData, SignalHigh as default };\n//# sourceMappingURL=signal-high.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"signal-low\",\n size: 24,\n node: [\n [\"path\", { d: \"M2 20h.01\", key: \"4haj6o\" }],\n [\"path\", { d: \"M7 20v-4\", key: \"j294jx\" }]\n ]\n};\n__iconData.node;\nconst SignalLow = createLucideIcon(__iconData);\n\nexport { __iconData, SignalLow as default };\n//# sourceMappingURL=signal-low.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"signal-medium\",\n size: 24,\n node: [\n [\"path\", { d: \"M2 20h.01\", key: \"4haj6o\" }],\n [\"path\", { d: \"M7 20v-4\", key: \"j294jx\" }],\n [\"path\", { d: \"M12 20v-8\", key: \"i3yub9\" }]\n ]\n};\n__iconData.node;\nconst SignalMedium = createLucideIcon(__iconData);\n\nexport { __iconData, SignalMedium as default };\n//# sourceMappingURL=signal-medium.mjs.map\n","import type { Automation, Priority } from \"@switchyard/protocol\";\nimport {\n CircleCheck,\n CloudOff,\n OctagonAlert,\n SignalHigh,\n SignalLow,\n SignalMedium,\n TriangleAlert,\n} from \"lucide-react\";\nimport {\n type ReactElement,\n type ReactNode,\n type SelectHTMLAttributes,\n useCallback,\n useId,\n useMemo,\n useState,\n} from \"react\";\nimport { create } from \"zustand\";\nimport { Spinner } from \"../../components/ui/Spinner\";\nimport { toast } from \"../../components/ui/Toast\";\nimport { cn } from \"../../lib/cn\";\nimport { formatTime } from \"../../lib/time\";\nimport { apiPatch, apiPost, errorMessage } from \"../../sync/api\";\nimport { useConnection, useSyncStore } from \"../../sync/store\";\n\n/* Small building blocks shared by the Automations list and editor. */\n\nexport interface FieldControlProps {\n id: string;\n \"aria-invalid\"?: boolean;\n \"aria-describedby\"?: string;\n}\n\n/** Labelled form field with an optional hint and inline error. */\nexport function Field({\n label,\n hint,\n error,\n children,\n className,\n optional,\n}: {\n label: ReactNode;\n hint?: ReactNode;\n error?: string;\n children: (props: FieldControlProps) => ReactElement;\n className?: string;\n optional?: boolean;\n}) {\n const id = useId();\n const hintId = `${id}-hint`;\n const errId = `${id}-err`;\n const describedBy = [hint ? hintId : null, error ? errId : null].filter(Boolean).join(\" \");\n return (\n <div className={cn(\"flex min-w-0 flex-col gap-1\", className)}>\n <label htmlFor={id} className=\"text-sm font-medium\">\n {label}\n {optional && <span className=\"font-normal text-muted\"> (optional)</span>}\n </label>\n {children({\n id,\n \"aria-invalid\": error ? true : undefined,\n \"aria-describedby\": describedBy || undefined,\n })}\n {hint && (\n <p id={hintId} className=\"text-xs text-muted\">\n {hint}\n </p>\n )}\n {error && <FieldError id={errId}>{error}</FieldError>}\n </div>\n );\n}\n\nexport function FieldError({ id, children }: { id?: string; children: ReactNode }) {\n return (\n <p id={id} className=\"flex items-start gap-1 text-xs text-danger\" data-field-error>\n <TriangleAlert aria-hidden className=\"mt-0.5 size-3.5 shrink-0\" />\n <span>{children}</span>\n </p>\n );\n}\n\n/** Native select styled like TextInput. */\nexport function Select({ className, children, ...rest }: SelectHTMLAttributes<HTMLSelectElement>) {\n return (\n <select\n className={cn(\n \"tap block h-9 w-full min-w-0 rounded-md border border-border bg-surface px-2.5 text-base text-text md:text-sm\",\n \"focus:border-accent focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-0\",\n \"aria-[invalid=true]:border-danger\",\n className,\n )}\n {...rest}\n >\n {children}\n </select>\n );\n}\n\n/** Accessible on/off switch with a text label that states the current value. */\nexport function Switch({\n checked,\n onChange,\n label,\n onText = \"On\",\n offText = \"Off\",\n busy,\n disabled,\n id,\n className,\n}: {\n checked: boolean;\n onChange: (next: boolean) => void;\n /** Accessible name. */\n label: string;\n onText?: string;\n offText?: string;\n busy?: boolean;\n disabled?: boolean;\n id?: string;\n className?: string;\n}) {\n return (\n <button\n id={id}\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n aria-label={label}\n aria-busy={busy || undefined}\n disabled={disabled || busy}\n onClick={() => onChange(!checked)}\n className={cn(\n \"tap inline-flex min-h-9 shrink-0 items-center gap-2 rounded-md px-1.5 text-sm\",\n \"hover:bg-surface-2 disabled:opacity-60\",\n className,\n )}\n >\n <span\n aria-hidden\n className={cn(\n \"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border transition-colors\",\n checked ? \"border-accent bg-accent\" : \"border-border-strong bg-surface-2\",\n )}\n >\n <span\n className={cn(\n \"absolute size-3.5 rounded-full shadow-sm transition-transform\",\n checked ? \"translate-x-[18px] bg-accent-fg\" : \"translate-x-[2px] bg-muted\",\n )}\n />\n </span>\n {busy ? <Spinner className=\"size-3.5\" /> : null}\n <span className={checked ? \"text-text\" : \"text-muted\"}>{checked ? onText : offText}</span>\n </button>\n );\n}\n\n/** Titled card section. */\nexport function Section({\n title,\n description,\n children,\n actions,\n className,\n testId,\n}: {\n title: ReactNode;\n description?: ReactNode;\n children: ReactNode;\n actions?: ReactNode;\n className?: string;\n testId?: string;\n}) {\n const id = useId();\n return (\n <section\n aria-labelledby={id}\n data-testid={testId}\n className={cn(\"min-w-0 rounded-lg border border-border bg-surface p-4\", className)}\n >\n <div className=\"mb-3 flex flex-wrap items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <h2 id={id} className=\"text-base font-semibold\">\n {title}\n </h2>\n {description && <p className=\"text-sm text-muted\">{description}</p>}\n </div>\n {actions && <div className=\"flex flex-wrap gap-2\">{actions}</div>}\n </div>\n <div className=\"flex flex-col gap-4\">{children}</div>\n </section>\n );\n}\n\nconst PRIORITY_ICONS = [OctagonAlert, SignalHigh, SignalMedium, SignalLow];\n\nexport function PriorityIcon({ priority, className }: { priority: Priority; className?: string }) {\n const Icon = PRIORITY_ICONS[priority] ?? SignalMedium;\n return (\n <Icon\n aria-hidden\n className={cn(\"size-4 shrink-0\", priority === 0 ? \"text-danger\" : \"text-muted\", className)}\n />\n );\n}\n\n/** Failure count as icon + text; warning tone when > 0. */\nexport function FailureCount({ count }: { count: number }) {\n if (count > 0) {\n return (\n <span className=\"inline-flex items-center gap-1 text-sm text-warning\">\n <TriangleAlert aria-hidden className=\"size-4 shrink-0\" />\n {count === 1 ? \"1 failure\" : `${count} failures`}\n </span>\n );\n }\n return (\n <span className=\"inline-flex items-center gap-1 text-sm text-muted\">\n <CircleCheck aria-hidden className=\"size-4 shrink-0\" />\n No failures\n </span>\n );\n}\n\n/** Inline last-known-data note when the coordinator link is not live. */\nexport function ConnectionNote({ className }: { className?: string }) {\n const connection = useConnection();\n if (connection.state === \"live\") return null;\n if (connection.state === \"connecting\" && !connection.lastSyncedAt) return null;\n return (\n <p\n role=\"status\"\n className={cn(\n \"flex items-start gap-1.5 rounded-md border border-border bg-warning-soft px-3 py-1.5 text-sm\",\n className,\n )}\n >\n <CloudOff aria-hidden className=\"mt-0.5 size-4 shrink-0 text-warning\" />\n <span>\n Showing last known automations\n {connection.lastSyncedAt ? ` from ${formatTime(connection.lastSyncedAt)}` : \"\"}. Changes are\n sent once the coordinator is reachable again.\n </span>\n </p>\n );\n}\n\nexport const automationPath = (id: string, suffix = \"\") =>\n `/api/automations/${encodeURIComponent(id)}${suffix}`;\n\n/* ------------------------------------------------------------------ */\n/* Automations acknowledged over REST (create/patch responses, list */\n/* fallback) so views do not wait for the automation.updated event. */\n/* ------------------------------------------------------------------ */\n\ninterface LocalAutomations {\n byId: Record<string, Automation>;\n deleted: Record<string, true>;\n put(a: Automation): void;\n putMany(list: Automation[]): void;\n remove(id: string): void;\n}\n\nexport const useLocalAutomations = create<LocalAutomations>()((set) => ({\n byId: {},\n deleted: {},\n put: (a) => set((s) => ({ byId: { ...s.byId, [a.id]: a } })),\n putMany: (list) =>\n set((s) => {\n const byId = { ...s.byId };\n for (const a of list) byId[a.id] = a;\n return { byId };\n }),\n remove: (id) =>\n set((s) => {\n const byId = { ...s.byId };\n delete byId[id];\n return { byId, deleted: { ...s.deleted, [id]: true } };\n }),\n}));\n\nfunction newer(a: Automation | undefined, b: Automation | undefined): Automation | undefined {\n if (!a) return b;\n if (!b) return a;\n return b.updatedAt > a.updatedAt ? b : a;\n}\n\n/** Store automations merged with REST acknowledgements (newest updatedAt wins). */\nexport function useMergedAutomations(): Record<string, Automation> {\n const store = useSyncStore((s) => s.automations);\n const local = useLocalAutomations((s) => s.byId);\n const deleted = useLocalAutomations((s) => s.deleted);\n return useMemo(() => {\n const out: Record<string, Automation> = {};\n for (const id of new Set([...Object.keys(store), ...Object.keys(local)])) {\n if (deleted[id]) continue;\n const a = newer(store[id], local[id]);\n if (a) out[id] = a;\n }\n return out;\n }, [store, local, deleted]);\n}\n\nexport function useMergedAutomation(id: string | undefined): Automation | undefined {\n const fromStore = useSyncStore((s) => (id ? s.automations[id] : undefined));\n const fromLocal = useLocalAutomations((s) => (id ? s.byId[id] : undefined));\n const deleted = useLocalAutomations((s) => (id ? s.deleted[id] : undefined));\n return deleted ? undefined : newer(fromStore, fromLocal);\n}\n\n/** Enable/disable with no optimistic success: busy until the coordinator acknowledges. */\nexport function useToggleEnabled() {\n const [busy, setBusy] = useState<Record<string, boolean>>({});\n const toggle = useCallback(async (a: Pick<Automation, \"id\" | \"name\">, enabled: boolean) => {\n setBusy((b) => ({ ...b, [a.id]: true }));\n try {\n const res = await apiPatch<Automation | undefined>(automationPath(a.id), { enabled });\n if (res && typeof res === \"object\" && \"id\" in res) useLocalAutomations.getState().put(res);\n toast.success(`${a.name} ${enabled ? \"enabled\" : \"disabled\"}`);\n } catch (e) {\n toast.error(`Could not ${enabled ? \"enable\" : \"disable\"} ${a.name}: ${errorMessage(e)}`);\n } finally {\n setBusy((b) => ({ ...b, [a.id]: false }));\n }\n }, []);\n return { busy, toggle };\n}\n\n/** Manual \"Run now\": busy until acknowledged; never reports success early. */\nexport function useRunNow(onDone?: () => void) {\n const [busy, setBusy] = useState<Record<string, boolean>>({});\n const run = useCallback(\n async (a: Pick<Automation, \"id\" | \"name\">) => {\n setBusy((b) => ({ ...b, [a.id]: true }));\n try {\n const res = await apiPost<{ state?: string } | undefined>(automationPath(a.id, \"/run\"));\n const state = res && typeof res === \"object\" ? res.state : undefined;\n toast.success(\n state && state !== \"fired\"\n ? `${a.name}: occurrence recorded (${state.replace(/_/g, \" \")})`\n : `${a.name} started`,\n );\n onDone?.();\n } catch (e) {\n toast.error(`Could not run ${a.name}: ${errorMessage(e)}`);\n } finally {\n setBusy((b) => ({ ...b, [a.id]: false }));\n }\n },\n [onDone],\n );\n return { busy, run };\n}\n","import {\n type Automation,\n AutomationInput,\n type Occurrence,\n PRIORITY_LABELS,\n type Priority,\n type Trigger,\n} from \"@switchyard/protocol\";\n\n/*\n * Pure helpers for the Automations feature: a small cron describer, trigger\n * and whole-automation summaries, the editor draft <-> AutomationInput\n * conversion with field-level validation, and history merging.\n */\n\n/* ------------------------------------------------------------------ */\n/* Labels and explanations */\n/* ------------------------------------------------------------------ */\n\nexport type AutomationMode = AutomationInput[\"mode\"];\nexport type OverlapPolicy = AutomationInput[\"overlap\"];\nexport type MissedPolicy = AutomationInput[\"missed\"];\nexport type TriggerKind = Trigger[\"kind\"];\n\nexport const TRIGGER_KIND_LABELS: Record<TriggerKind, string> = {\n manual: \"Manual\",\n once: \"Once\",\n cron: \"Schedule\",\n webhook: \"Webhook\",\n dependency: \"Dependency\",\n};\n\nexport const MODE_OPTIONS: { value: AutomationMode; label: string; explanation: string }[] = [\n { value: \"fresh\", label: \"Fresh\", explanation: \"Fresh: a new task per occurrence\" },\n {\n value: \"continue\",\n label: \"Continue\",\n explanation: \"Continue: reuse the task with the same grouping key\",\n },\n {\n value: \"watch\",\n label: \"Watch\",\n explanation: \"Watch: only raises attention when something relevant changed\",\n },\n];\n\nexport const OVERLAP_OPTIONS: { value: OverlapPolicy; label: string; explanation: string }[] = [\n {\n value: \"skip\",\n label: \"Skip\",\n explanation: \"Skip: drop the occurrence while earlier work is still open\",\n },\n {\n value: \"queue_one\",\n label: \"Queue one\",\n explanation: \"Queue one: keep a single pending occurrence and fire it when the open work ends\",\n },\n {\n value: \"append\",\n label: \"Append\",\n explanation: \"Append: add the new objective to the open task (as a follow-up if it is running)\",\n },\n];\n\nexport const MISSED_OPTIONS: { value: MissedPolicy; label: string; explanation: string }[] = [\n {\n value: \"skip\",\n label: \"Skip\",\n explanation: \"Skip: occurrences missed while the coordinator was down are recorded and skipped\",\n },\n {\n value: \"run_once\",\n label: \"Run once\",\n explanation: \"Run once: on return, fire the newest missed occurrence once\",\n },\n];\n\nexport function modeLabel(mode: AutomationMode): string {\n return MODE_OPTIONS.find((m) => m.value === mode)?.label ?? mode;\n}\n\nexport function priorityLabel(p: Priority): string {\n return PRIORITY_LABELS[p] ?? String(p);\n}\n\nexport const TEMPLATE_VARIABLES = [\"{{date}}\", \"{{time}}\", \"{{occurrence}}\", \"{{payload.<path>}}\"];\n\n/* ------------------------------------------------------------------ */\n/* Text utilities */\n/* ------------------------------------------------------------------ */\n\n/** \"a\", \"a and b\", \"a, b and c\". */\nexport function listText(items: string[]): string {\n if (items.length <= 1) return items[0] ?? \"\";\n return `${items.slice(0, -1).join(\", \")} and ${items[items.length - 1]}`;\n}\n\nfunction pad(n: number): string {\n return String(n).padStart(2, \"0\");\n}\n\nexport function ordinal(n: number): string {\n const mod100 = n % 100;\n if (mod100 >= 11 && mod100 <= 13) return `${n}th`;\n switch (n % 10) {\n case 1:\n return `${n}st`;\n case 2:\n return `${n}nd`;\n case 3:\n return `${n}rd`;\n default:\n return `${n}th`;\n }\n}\n\nfunction capitalize(s: string): string {\n return s ? s[0]!.toUpperCase() + s.slice(1) : s;\n}\n\n/** Non-empty trimmed lines. */\nexport function lines(text: string): string[] {\n return text\n .split(\"\\n\")\n .map((l) => l.trim())\n .filter((l) => l.length > 0);\n}\n\n/* ------------------------------------------------------------------ */\n/* Cron */\n/* ------------------------------------------------------------------ */\n\nconst DAY_NAMES = [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"];\nconst MONTH_NAMES = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n];\n\ninterface FieldDef {\n name: string;\n min: number;\n max: number;\n /** Three-letter aliases mapped to `min + index`. */\n names?: string[];\n}\n\nconst CRON_FIELDS: FieldDef[] = [\n { name: \"Minute\", min: 0, max: 59 },\n { name: \"Hour\", min: 0, max: 23 },\n { name: \"Day of month\", min: 1, max: 31 },\n {\n name: \"Month\",\n min: 1,\n max: 12,\n names: MONTH_NAMES.map((m) => m.slice(0, 3).toLowerCase()),\n },\n {\n name: \"Day of week\",\n min: 0,\n max: 7,\n names: DAY_NAMES.map((d) => d.slice(0, 3).toLowerCase()),\n },\n];\n\nexport interface CronField {\n /** `*` (or `?`): every value. */\n any: boolean;\n /** Expanded, sorted, unique values (empty when `any`). */\n values: number[];\n /** Set when the field is a single `*\\/n` or `a/n` step. */\n step: { every: number; start: number } | null;\n /** Uses croner extensions (L, W, #) the describer does not explain. */\n extended: boolean;\n}\n\nfunction parseValue(token: string, def: FieldDef): number | string {\n const lower = token.toLowerCase();\n if (def.names) {\n const idx = def.names.indexOf(lower);\n if (idx >= 0) return def.min + idx;\n }\n if (!/^\\d+$/.test(token)) return `\"${token}\" is not a number`;\n const n = Number(token);\n if (n < def.min || n > def.max) return `${n} is out of range ${def.min}–${def.max}`;\n return n;\n}\n\n/** Parse one cron field; returns an error message for invalid input. */\nexport function parseCronField(src: string, def: FieldDef): CronField | string {\n if (src === \"*\" || src === \"?\") return { any: true, values: [], step: null, extended: false };\n if (/[LW#]/i.test(src) && !def.names?.some((n) => src.toLowerCase().includes(n))) {\n if (!/^[0-9A-Za-z*?,\\-/#]+$/.test(src)) return `\"${src}\" is not valid`;\n return { any: false, values: [], step: null, extended: true };\n }\n const parts = src.split(\",\");\n const values = new Set<number>();\n let step: CronField[\"step\"] = null;\n for (const part of parts) {\n if (!part) return \"empty list item\";\n const [base, stepStr, extra] = part.split(\"/\");\n if (extra !== undefined) return `\"${part}\" has more than one step`;\n let every = 1;\n if (stepStr !== undefined) {\n if (!/^\\d+$/.test(stepStr) || Number(stepStr) < 1) return `\"${stepStr}\" is not a valid step`;\n every = Number(stepStr);\n }\n let start: number;\n let end: number;\n if (base === \"*\" || base === \"?\") {\n start = def.min;\n end = def.max;\n } else if (base?.includes(\"-\")) {\n const [a, b] = base.split(\"-\");\n const av = parseValue(a ?? \"\", def);\n const bv = parseValue(b ?? \"\", def);\n if (typeof av === \"string\") return av;\n if (typeof bv === \"string\") return bv;\n if (av > bv) return `range ${base} runs backwards`;\n start = av;\n end = bv;\n } else {\n const v = parseValue(base ?? \"\", def);\n if (typeof v === \"string\") return v;\n start = v;\n end = stepStr !== undefined ? def.max : v;\n }\n for (let i = start; i <= end; i += every) values.add(i);\n if (parts.length === 1 && stepStr !== undefined && !base?.includes(\"-\")) {\n step = { every, start };\n }\n }\n let sorted = [...values].sort((a, b) => a - b);\n // Day of week: 7 is Sunday.\n if (def.max === 7) sorted = [...new Set(sorted.map((v) => v % 7))].sort((a, b) => a - b);\n const full = def.max === 7 ? 7 : def.max - def.min + 1;\n if (sorted.length === full && !step)\n return { any: true, values: [], step: null, extended: false };\n return { any: false, values: sorted, step, extended: false };\n}\n\nexport function parseCron(expr: string): CronField[] | string {\n const trimmed = expr.trim();\n if (!trimmed) return \"Enter a cron expression\";\n const fields = trimmed.split(/\\s+/);\n if (fields.length !== 5) {\n return `Expected 5 fields (minute hour day-of-month month day-of-week), got ${fields.length}`;\n }\n const out: CronField[] = [];\n for (let i = 0; i < 5; i++) {\n const def = CRON_FIELDS[i]!;\n const parsed = parseCronField(fields[i]!, def);\n if (typeof parsed === \"string\") return `${def.name}: ${parsed}`;\n out.push(parsed);\n }\n return out;\n}\n\n/** Null when valid, otherwise a message. */\nexport function validateCron(expr: string): string | null {\n const parsed = parseCron(expr);\n return typeof parsed === \"string\" ? parsed : null;\n}\n\n/** Null when the IANA timezone is known to this browser. */\nexport function validateTimezone(tz: string): string | null {\n if (!tz.trim()) return \"Enter a timezone\";\n try {\n new Intl.DateTimeFormat(undefined, { timeZone: tz.trim() });\n return null;\n } catch {\n return `Unknown timezone \"${tz}\"`;\n }\n}\n\nfunction isContiguous(values: number[]): boolean {\n for (let i = 1; i < values.length; i++) if (values[i] !== values[i - 1]! + 1) return false;\n return values.length > 0;\n}\n\ntype TimePhrase = { kind: \"at\"; text: string } | { kind: \"freq\"; text: string };\n\nfunction describeTime(m: CronField, h: CronField): TimePhrase | null {\n if (m.any && h.any) return { kind: \"freq\", text: \"Every minute\" };\n if (m.step && m.step.start === 0 && h.any) {\n return {\n kind: \"freq\",\n text: m.step.every === 1 ? \"Every minute\" : `Every ${m.step.every} minutes`,\n };\n }\n if (m.any) {\n if (h.step || h.values.length === 0) return null;\n if (isContiguous(h.values)) {\n return {\n kind: \"freq\",\n text: `Every minute from ${pad(h.values[0]!)}:00 to ${pad(h.values[h.values.length - 1]!)}:59`,\n };\n }\n return null;\n }\n if (h.any) {\n if (m.step) return null;\n if (m.values.length === 1 && m.values[0] === 0) return { kind: \"freq\", text: \"Every hour\" };\n return {\n kind: \"freq\",\n text: `Every hour at ${listText(m.values.map((v) => `:${pad(v)}`))}`,\n };\n }\n if (h.step && h.step.start === 0 && m.values.length === 1 && !m.step) {\n const at = m.values[0] === 0 ? \"\" : ` at :${pad(m.values[0]!)}`;\n return {\n kind: \"freq\",\n text: h.step.every === 1 ? `Every hour${at}` : `Every ${h.step.every} hours${at}`,\n };\n }\n if (m.values.length * h.values.length <= 6) {\n const times: string[] = [];\n for (const hv of h.values) for (const mv of m.values) times.push(`${pad(hv)}:${pad(mv)}`);\n return { kind: \"at\", text: listText(times) };\n }\n if (!isContiguous(h.values)) return null;\n const first = h.values[0]!;\n const last = h.values[h.values.length - 1]!;\n if (m.step && m.step.start === 0) {\n return {\n kind: \"freq\",\n text: `Every ${m.step.every} minutes from ${pad(first)}:00 to ${pad(last)}:59`,\n };\n }\n if (m.values.length === 1) {\n const mm = pad(m.values[0]!);\n return { kind: \"freq\", text: `Every hour from ${pad(first)}:${mm} to ${pad(last)}:${mm}` };\n }\n return null;\n}\n\n/** Monday-first ordering for day-of-week lists. */\nfunction mondayFirst(a: number, b: number): number {\n return ((a + 6) % 7) - ((b + 6) % 7);\n}\n\nfunction describeDays(\n dom: CronField,\n mon: CronField,\n dow: CronField,\n): { lead: string; qual: string } | null {\n if (!dom.any && !dow.any) return null;\n const months = mon.any ? null : listText(mon.values.map((v) => MONTH_NAMES[v - 1]!));\n const inMonths = months ? ` in ${months}` : \"\";\n if (!dow.any) {\n const days = [...dow.values].sort(mondayFirst);\n const key = days.join(\",\");\n if (key === \"1,2,3,4,5\") {\n return { lead: `Every weekday${inMonths}`, qual: ` on weekdays${inMonths}` };\n }\n if (key === \"6,0\") {\n return { lead: `Every Saturday and Sunday${inMonths}`, qual: ` on weekends${inMonths}` };\n }\n const names = days.map((d) => DAY_NAMES[d]!);\n return {\n lead: `Every ${listText(names)}${inMonths}`,\n qual: ` on ${listText(names.map((n) => `${n}s`))}${inMonths}`,\n };\n }\n if (!dom.any) {\n if (dom.values.length > 5) return null;\n const ords = listText(dom.values.map(ordinal));\n const of = months ? months : \"every month\";\n return { lead: `On the ${ords} of ${of}`, qual: ` on the ${ords} of ${of}` };\n }\n return { lead: `Every day${inMonths}`, qual: inMonths };\n}\n\n/**\n * Human description of a 5-field cron expression (\"Every weekday at 09:00\n * (America/Denver)\"), or null when the expression is outside what this small\n * describer covers.\n */\nexport function describeCron(expr: string, timezone?: string): string | null {\n const parsed = parseCron(expr);\n if (typeof parsed === \"string\") return null;\n if (parsed.some((f) => f.extended)) return null;\n const [m, h, dom, mon, dow] = parsed as [CronField, CronField, CronField, CronField, CronField];\n const time = describeTime(m, h);\n const days = describeDays(dom, mon, dow);\n if (!time || !days) return null;\n const text = time.kind === \"at\" ? `${days.lead} at ${time.text}` : `${time.text}${days.qual}`;\n return timezone ? `${text} (${timezone})` : text;\n}\n\n/** describeCron with the raw-expression fallback. */\nexport function describeCronOrRaw(expr: string, timezone: string): string {\n return describeCron(expr, timezone) ?? `Cron ${expr.trim()} (${timezone})`;\n}\n\n/* ------------------------------------------------------------------ */\n/* Summaries */\n/* ------------------------------------------------------------------ */\n\nexport function formatAbsolute(iso: string): string {\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return iso;\n return d.toLocaleString(undefined, { dateStyle: \"medium\", timeStyle: \"short\" });\n}\n\nexport interface SummaryContext {\n projectName?: string | null;\n /** Name of the explicitly selected host; null/undefined means the project default. */\n hostName?: string | null;\n profileName?: string | null;\n taskTitle?: (taskId: string) => string | undefined;\n formatDate?: (iso: string) => string;\n}\n\n/** Short trigger summary for list rows. */\nexport function describeTrigger(trigger: Trigger, ctx: SummaryContext = {}): string {\n const fmt = ctx.formatDate ?? formatAbsolute;\n switch (trigger.kind) {\n case \"manual\":\n return \"Manual\";\n case \"once\":\n return trigger.at && !Number.isNaN(Date.parse(trigger.at))\n ? `Once at ${fmt(trigger.at)}`\n : \"Once (no time chosen)\";\n case \"cron\":\n return describeCronOrRaw(trigger.expr, trigger.timezone);\n case \"webhook\":\n return \"Webhook\";\n case \"dependency\": {\n const title = trigger.taskId ? ctx.taskTitle?.(trigger.taskId) : undefined;\n if (title) return `When \"${title}\" is done`;\n return trigger.taskId ? `When task ${trigger.taskId} is done` : \"When a task is done\";\n }\n }\n}\n\ntype SummaryInput = Pick<\n AutomationInput,\n | \"trigger\"\n | \"filters\"\n | \"template\"\n | \"mode\"\n | \"groupingKey\"\n | \"overlap\"\n | \"missed\"\n | \"continuation\"\n | \"completion\"\n>;\n\nfunction triggerClause(input: SummaryInput, ctx: SummaryContext): string {\n const t = input.trigger;\n switch (t.kind) {\n case \"manual\":\n return \"When run manually\";\n case \"webhook\": {\n const filters = input.filters.filter((f) => f.path.trim());\n if (filters.length === 0) return \"When a webhook is received\";\n return `When a webhook is received where ${listText(\n filters.map((f) => `${f.path.trim()} = \"${f.equals}\"`),\n )}`;\n }\n default:\n return describeTrigger(t, ctx);\n }\n}\n\n/**\n * One-paragraph description of what the automation does, e.g. 'Every weekday\n * at 09:00 (America/Denver), create a fresh task \"Triage\" in Web on my-server; skip\n * if previous work is still open; skip missed runs; requires human review'.\n */\nexport function summarizeAutomation(input: SummaryInput, ctx: SummaryContext = {}): string {\n const title = input.template.title.trim() || \"Untitled task\";\n const project = ctx.projectName ? ` in ${ctx.projectName}` : \"\";\n const host = ctx.hostName ? ` on ${ctx.hostName}` : \" on the project's default host\";\n const profile = ctx.profileName ? ` with profile ${ctx.profileName}` : \"\";\n let action: string;\n switch (input.mode) {\n case \"continue\": {\n const key = input.groupingKey?.trim();\n action = key\n ? `continue the task grouped by \"${key}\" (or create \"${title}\")`\n : `continue the matching task (or create \"${title}\")`;\n break;\n }\n case \"watch\":\n action = `create a watch task \"${title}\" that only raises attention when something relevant changed`;\n break;\n default:\n action = `create a fresh task \"${title}\"`;\n }\n const parts = [`${triggerClause(input, ctx)}, ${action}${project}${host}${profile}`];\n parts.push(\n input.overlap === \"skip\"\n ? \"skip if previous work is still open\"\n : input.overlap === \"queue_one\"\n ? \"queue one occurrence if previous work is still open\"\n : \"append to the open task if previous work is still open\",\n );\n if (input.trigger.kind === \"cron\" || input.trigger.kind === \"once\") {\n parts.push(input.missed === \"skip\" ? \"skip missed runs\" : \"run missed runs once on return\");\n }\n if (input.continuation.enabled) {\n const c = input.continuation;\n parts.push(\n `continue automatically up to ${c.maxContinuations} times within ${c.maxElapsedMinutes} minutes`,\n );\n }\n const checks = input.completion.checks;\n if (checks && checks.length > 0) {\n parts.push(`run ${checks.length === 1 ? \"1 check\" : `${checks.length} checks`}`);\n }\n parts.push(\n input.completion.requireHumanReview ? \"requires human review\" : \"no human review required\",\n );\n return capitalize(parts.join(\"; \"));\n}\n\n/* ------------------------------------------------------------------ */\n/* Editor draft */\n/* ------------------------------------------------------------------ */\n\n/** Form state: strings for inputs so partial edits survive validation. */\nexport interface AutomationDraft {\n name: string;\n enabled: boolean;\n projectId: string;\n triggerKind: TriggerKind;\n /** datetime-local value (local time, no zone). */\n onceAt: string;\n cronExpr: string;\n cronTimezone: string;\n dependencyTaskId: string;\n filters: { path: string; equals: string }[];\n title: string;\n objective: string;\n /** One criterion per line. */\n criteria: string;\n priority: Priority;\n /** \"\" = project default. */\n hostId: string;\n /** \"\" = project default. */\n profileId: string;\n mode: AutomationMode;\n groupingKey: string;\n overlap: OverlapPolicy;\n missed: MissedPolicy;\n continuationEnabled: boolean;\n continuationObjective: string;\n maxContinuations: string;\n maxElapsedMinutes: string;\n maxTokens: string;\n maxCostUsd: string;\n /** One check per line; empty = project default (null). */\n checks: string;\n requireHumanReview: boolean;\n}\n\nexport function localTimezone(): string {\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone || \"UTC\";\n } catch {\n return \"UTC\";\n }\n}\n\nexport function emptyDraft(opts: { projectId?: string; timezone?: string } = {}): AutomationDraft {\n return {\n name: \"\",\n enabled: true,\n projectId: opts.projectId ?? \"\",\n triggerKind: \"manual\",\n onceAt: \"\",\n cronExpr: \"0 9 * * 1-5\",\n cronTimezone: opts.timezone ?? localTimezone(),\n dependencyTaskId: \"\",\n filters: [],\n title: \"\",\n objective: \"\",\n criteria: \"\",\n priority: 2,\n hostId: \"\",\n profileId: \"\",\n mode: \"fresh\",\n groupingKey: \"\",\n overlap: \"skip\",\n missed: \"skip\",\n continuationEnabled: false,\n continuationObjective: \"\",\n maxContinuations: \"5\",\n maxElapsedMinutes: \"60\",\n maxTokens: \"\",\n maxCostUsd: \"\",\n checks: \"\",\n requireHumanReview: true,\n };\n}\n\n/** ISO -> datetime-local value in this browser's timezone. */\nexport function isoToLocalInput(iso: string | null | undefined): string {\n if (!iso) return \"\";\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return \"\";\n return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`;\n}\n\n/** datetime-local value -> ISO (interpreted as local time), or \"\" when empty/invalid. */\nexport function localInputToIso(value: string): string {\n if (!value) return \"\";\n const d = new Date(value);\n return Number.isNaN(d.getTime()) ? \"\" : d.toISOString();\n}\n\nexport function draftFromAutomation(\n a: Automation | AutomationInput,\n opts: { timezone?: string } = {},\n): AutomationDraft {\n const base = emptyDraft({ projectId: a.projectId, timezone: opts.timezone });\n const t = a.trigger;\n const c = a.continuation;\n return {\n ...base,\n name: a.name,\n enabled: a.enabled,\n triggerKind: t.kind,\n onceAt: t.kind === \"once\" ? isoToLocalInput(t.at) : \"\",\n cronExpr: t.kind === \"cron\" ? t.expr : base.cronExpr,\n cronTimezone: t.kind === \"cron\" ? t.timezone : base.cronTimezone,\n dependencyTaskId: t.kind === \"dependency\" ? t.taskId : \"\",\n filters: a.filters.map((f) => ({ ...f })),\n title: a.template.title,\n objective: a.template.objective,\n criteria: a.template.acceptanceCriteria.join(\"\\n\"),\n priority: a.template.priority,\n hostId: a.hostId ?? \"\",\n profileId: a.profileId ?? \"\",\n mode: a.mode,\n groupingKey: a.groupingKey ?? \"\",\n overlap: a.overlap,\n missed: a.missed,\n continuationEnabled: c.enabled,\n continuationObjective: c.enabled ? c.objective : \"\",\n maxContinuations: c.enabled ? String(c.maxContinuations) : base.maxContinuations,\n maxElapsedMinutes: c.enabled ? String(c.maxElapsedMinutes) : base.maxElapsedMinutes,\n maxTokens: c.enabled && c.maxTokens !== null ? String(c.maxTokens) : \"\",\n maxCostUsd: c.enabled && c.maxCostUsd !== null ? String(c.maxCostUsd) : \"\",\n checks: a.completion.checks ? a.completion.checks.join(\"\\n\") : \"\",\n requireHumanReview: a.completion.requireHumanReview,\n };\n}\n\nfunction toNumber(s: string): number {\n return s.trim() === \"\" ? Number.NaN : Number(s.trim());\n}\n\nfunction toOptionalNumber(s: string): number | null {\n return s.trim() === \"\" ? null : Number(s.trim());\n}\n\nfunction draftTrigger(d: AutomationDraft): Trigger {\n switch (d.triggerKind) {\n case \"manual\":\n return { kind: \"manual\" };\n case \"once\":\n return { kind: \"once\", at: localInputToIso(d.onceAt) };\n case \"cron\":\n return { kind: \"cron\", expr: d.cronExpr.trim(), timezone: d.cronTimezone.trim() };\n case \"webhook\":\n return { kind: \"webhook\" };\n case \"dependency\":\n return { kind: \"dependency\", taskId: d.dependencyTaskId };\n }\n}\n\n/**\n * Build the request body from a draft. The result is shaped like an\n * AutomationInput but is not validated (numbers may be NaN, strings empty);\n * run validateDraft before sending it.\n */\nexport function draftToInput(d: AutomationDraft): AutomationInput {\n const checks = lines(d.checks);\n return {\n name: d.name.trim(),\n enabled: d.enabled,\n projectId: d.projectId,\n trigger: draftTrigger(d),\n filters: d.filters\n .filter((f) => f.path.trim() || f.equals.trim())\n .map((f) => ({ path: f.path.trim(), equals: f.equals })),\n template: {\n title: d.title.trim(),\n objective: d.objective,\n acceptanceCriteria: lines(d.criteria),\n priority: d.priority,\n },\n hostId: d.hostId || null,\n profileId: d.profileId || null,\n mode: d.mode,\n groupingKey: d.groupingKey.trim() || null,\n overlap: d.overlap,\n missed: d.missed,\n continuation: d.continuationEnabled\n ? {\n enabled: true,\n objective: d.continuationObjective.trim(),\n maxContinuations: toNumber(d.maxContinuations),\n maxElapsedMinutes: toNumber(d.maxElapsedMinutes),\n maxTokens: toOptionalNumber(d.maxTokens),\n maxCostUsd: toOptionalNumber(d.maxCostUsd),\n }\n : { enabled: false },\n completion: {\n checks: checks.length > 0 ? checks : null,\n requireHumanReview: d.requireHumanReview,\n },\n };\n}\n\n/** Draft field keys that can carry an inline error. */\nexport type DraftField =\n | keyof AutomationDraft\n | `filters.${number}.path`\n | `filters.${number}.equals`\n | \"form\";\n\nexport type DraftErrors = Partial<Record<DraftField, string>>;\n\nconst PATH_TO_FIELD: Record<string, DraftField> = {\n name: \"name\",\n enabled: \"enabled\",\n projectId: \"projectId\",\n trigger: \"triggerKind\",\n \"trigger.kind\": \"triggerKind\",\n \"trigger.at\": \"onceAt\",\n \"trigger.expr\": \"cronExpr\",\n \"trigger.timezone\": \"cronTimezone\",\n \"trigger.taskId\": \"dependencyTaskId\",\n \"template.title\": \"title\",\n \"template.objective\": \"objective\",\n \"template.acceptanceCriteria\": \"criteria\",\n \"template.priority\": \"priority\",\n hostId: \"hostId\",\n profileId: \"profileId\",\n mode: \"mode\",\n groupingKey: \"groupingKey\",\n overlap: \"overlap\",\n missed: \"missed\",\n \"continuation.objective\": \"continuationObjective\",\n \"continuation.maxContinuations\": \"maxContinuations\",\n \"continuation.maxElapsedMinutes\": \"maxElapsedMinutes\",\n \"continuation.maxTokens\": \"maxTokens\",\n \"continuation.maxCostUsd\": \"maxCostUsd\",\n \"completion.checks\": \"checks\",\n \"completion.requireHumanReview\": \"requireHumanReview\",\n};\n\n/** Map a zod issue path to a draft field. */\nexport function fieldForPath(path: readonly PropertyKey[]): DraftField {\n const parts = path.map(String);\n if (parts[0] === \"filters\" && parts.length >= 3) {\n return `filters.${Number(parts[1])}.${parts[2] === \"equals\" ? \"equals\" : \"path\"}`;\n }\n if (parts[0] === \"template\" && parts[1] === \"acceptanceCriteria\") return \"criteria\";\n if (parts[0] === \"completion\" && parts[1] === \"checks\") return \"checks\";\n for (let n = parts.length; n > 0; n--) {\n const f = PATH_TO_FIELD[parts.slice(0, n).join(\".\")];\n if (f) return f;\n }\n return \"form\";\n}\n\nfunction intError(s: string, min: number, max: number, label: string): string | null {\n const n = toNumber(s);\n if (!Number.isInteger(n) || n < min || n > max) {\n return `${label} must be a whole number from ${min} to ${max}`;\n }\n return null;\n}\n\n/**\n * Validate a draft: friendly checks first (required fields, cron, timezone,\n * number ranges), then AutomationInput.safeParse for anything else.\n */\nexport function validateDraft(d: AutomationDraft): {\n input: AutomationInput | null;\n errors: DraftErrors;\n} {\n const errors: DraftErrors = {};\n const set = (f: DraftField, msg: string | null) => {\n if (msg && !errors[f]) errors[f] = msg;\n };\n if (!d.name.trim()) set(\"name\", \"Name is required\");\n if (!d.projectId) set(\"projectId\", \"Choose a project\");\n if (!d.title.trim()) set(\"title\", \"Task title is required\");\n switch (d.triggerKind) {\n case \"once\":\n if (!localInputToIso(d.onceAt)) set(\"onceAt\", \"Choose a date and time\");\n break;\n case \"cron\":\n set(\"cronExpr\", validateCron(d.cronExpr));\n set(\"cronTimezone\", validateTimezone(d.cronTimezone));\n break;\n case \"dependency\":\n if (!d.dependencyTaskId) set(\"dependencyTaskId\", \"Choose the task to wait for\");\n break;\n }\n d.filters.forEach((f, i) => {\n if (!f.path.trim() && f.equals.trim()) set(`filters.${i}.path`, \"Enter a payload path\");\n });\n if (d.mode === \"continue\" && !d.groupingKey.trim()) {\n set(\"groupingKey\", \"A grouping key is required to continue an existing task\");\n }\n if (d.continuationEnabled) {\n if (!d.continuationObjective.trim()) {\n set(\"continuationObjective\", \"An objective is required when continuation is on\");\n }\n set(\"maxContinuations\", intError(d.maxContinuations, 1, 50, \"Max continuations\"));\n set(\"maxElapsedMinutes\", intError(d.maxElapsedMinutes, 1, 1440, \"Max elapsed minutes\"));\n if (d.maxTokens.trim()) {\n const n = toNumber(d.maxTokens);\n if (!Number.isInteger(n) || n <= 0)\n set(\"maxTokens\", \"Max tokens must be a positive whole number\");\n }\n if (d.maxCostUsd.trim()) {\n const n = toNumber(d.maxCostUsd);\n if (!Number.isFinite(n) || n <= 0) set(\"maxCostUsd\", \"Max cost must be a positive amount\");\n }\n }\n const raw = draftToInput(d);\n const parsed = AutomationInput.safeParse(raw);\n if (!parsed.success) {\n for (const issue of parsed.error.issues) set(fieldForPath(issue.path), issue.message);\n }\n const ok = parsed.success && Object.keys(errors).length === 0;\n return { input: ok ? parsed.data : null, errors };\n}\n\n/* ------------------------------------------------------------------ */\n/* History */\n/* ------------------------------------------------------------------ */\n\nexport function occurrenceTime(o: Occurrence): string {\n return o.scheduledFor ?? o.createdAt;\n}\n\n/** Union by id (later lists win), newest first. */\nexport function mergeOccurrences(...lists: (Occurrence[] | undefined | null)[]): Occurrence[] {\n const byId = new Map<string, Occurrence>();\n for (const list of lists) for (const o of list ?? []) byId.set(o.id, o);\n return [...byId.values()].sort(\n (a, b) =>\n b.createdAt.localeCompare(a.createdAt) || occurrenceTime(b).localeCompare(occurrenceTime(a)),\n );\n}\n\n/** Accept `Occurrence[]` or `{items|occurrences: Occurrence[]}`. */\nexport function normalizeHistory(res: unknown): Occurrence[] {\n if (Array.isArray(res)) return res as Occurrence[];\n if (res && typeof res === \"object\") {\n const r = res as { items?: unknown; occurrences?: unknown };\n if (Array.isArray(r.items)) return r.items as Occurrence[];\n if (Array.isArray(r.occurrences)) return r.occurrences as Occurrence[];\n }\n return [];\n}\n\nexport function curlExample(token: string, url: string): string {\n return `curl -X POST -H 'Authorization: Bearer ${token}' -H 'Content-Type: application/json' -d '{}' ${url}`;\n}\n"],"ignoreList":[0,1,2,3],"mappings":"A,sQASA,IAAMA,EAAa,CACjB,KAAM,gBACN,KAAM,GACN,KAAM,CACJ,CAAC,OAAQ,CAAE,EAAG,aAAc,IAAK,QAAS,CAAC,EAC3C,CAAC,OAAQ,CAAE,EAAG,UAAW,IAAK,QAAS,CAAC,EACxC,CACE,OACA,CACE,EAAG,gPACH,IAAK,QACP,CACF,CACF,EACA,QAAS,CAAC,eAAe,CAC3B,EACAA,EAAW,KACX,IAAMyB,GAAeC,EAAiB1B,CAAU,ECjB1CC,EAAa,CACjB,KAAM,cACN,KAAM,GACN,KAAM,CACJ,CAAC,OAAQ,CAAE,EAAG,YAAa,IAAK,QAAS,CAAC,EAC1C,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAS,CAAC,EACzC,CAAC,OAAQ,CAAE,EAAG,YAAa,IAAK,QAAS,CAAC,EAC1C,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAS,CAAC,CAC3C,CACF,EACAA,EAAW,KACX,IAAM2B,GAAaF,EAAiBzB,C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kI,EAAIlI,EACV,GAAI,MAAM,QAAQkI,EAAE,KAAK,EAAG,OAAOA,EAAE,MACrC,GAAI,MAAM,QAAQA,EAAE,WAAW,EAAG,OAAOA,EAAE,WAC7C,CACA,MAAO,CAAC,CACV,CAEA,SAAgBC,GAAY,EAAe,EAAqB,CAC9D,MAAO,0CAA0CrG,EAAM,gDAAgDsG,GACzG,C"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
function e(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 t(e,t=`|`){return e.map(e=>ue(e)).join(t)}function n(e,t){return typeof t==`bigint`?t.toString():t}var r=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 i(e){return new r(e)}function a(e){return e==null}function o(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function s(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}var c=Symbol(`evaluating`);function l(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==c)return r===void 0&&(r=c,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function u(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function d(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function f(e){return d(e._zod.def)??e._zod.def.shape}function p(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return u(this,t,e),e},enumerable:!0,configurable:!0})}function m(e,t,n){t in e?u(e,t,n):e[t]=n}function h(e,t,n,r){let i=f(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?p(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):m(e,a,r?r(n.value,a):n.value))}}function ee(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?p(e,n,()=>t[n]):m(e,n,r.value))}}function g(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function te(e){return JSON.stringify(e)}function ne(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var re=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ie(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ae=i(()=>{if(T.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function oe(e){if(ie(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ie(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function se(e){return oe(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ce=new Set([`string`,`number`,`symbol`]);function le(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function _(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function v(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 ue(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function de(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var fe={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},pe={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function me(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 h(i,e,he(e,t)),_(e,g(n,{shape:i,checks:[]}))}function he(e,t){let n=f(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 ge(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(he(e,t)),a={};return h(a,e,Reflect.ownKeys(f(e)).filter(e=>!i.has(e))),_(e,g(n,{shape:a,checks:[]}))}function _e(e,t){if(!oe(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=f(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 _(e,g(e._zod.def,{shape:ve(e,t)}))}function ve(e,t){let n={};return h(n,e,Reflect.ownKeys(f(e))),ee(n,t),n}function ye(e,t){if(!oe(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return _(e,g(e._zod.def,{shape:ve(e,t)}))}function be(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 h(n,e,Reflect.ownKeys(f(e))),h(n,t,Reflect.ownKeys(f(t))),_(e,g(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function xe(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(he(t,n)):void 0,o={};return h(o,t,Reflect.ownKeys(f(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),_(t,g(t._zod.def,{shape:o,checks:[]}))}function Se(e,t,n){let r=n?new Set(he(t,n)):void 0,i={};return h(i,t,Reflect.ownKeys(f(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),_(t,g(t._zod.def,{shape:i}))}function y(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 Ce(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 we(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Te(e){return typeof e==`string`?e:e?.message}function Ee(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function De(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function b(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:Te(e.inst?._zod.def?.error?.(e))??Te(a?.(e))??Te(t?.error?.(e))??Te(n.customError?.(e))??Te(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 Oe=/[\uD800-\uDBFF]/;function ke(e){let t=e.length;if(!Oe.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 Ae(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function je(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 Me(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Ne(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ie(e,n,r.value)}}function x(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Pe(e,t,n){return x(e,t,n,!1)}function Fe(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return x(this,n,r(this))},set(e){x(this,n,e)}})}return t}function Ie(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:x(this,t,n.bind(this))},set(e){x(this,t,e)}})}function Le(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Re,ze=!1,Be={configurable:!0,get(){ze=!0}};function S(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Re!==e._zod?Re=void 0:(Re=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Be);let e=ze;ze=!1;try{let r=n(this);return ze?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),ze||=e,r}catch(n){throw delete this[t],ze||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Ve(e,t,n,r){let i=Le(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 He=`~constantCatch`;function Ue(e){let t=()=>e;return t[He]=!0,t}var We,Ge={value:void 0,enumerable:!1},Ke=`captureStackTrace`in Error?Error:null;function qe(e){let t=Ke;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Ke=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function C(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){Ge.value=new a(r);try{Object.defineProperty(n,"_zod",Ge)}finally{Ge.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),Ne(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?qe(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 w=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Je=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(We=globalThis).__zod_globalConfig??(We.__zod_globalConfig={});var T=globalThis.__zod_globalConfig;function E(e){return e&&Object.assign(T,e),T}function Ye(){let e=this._zod;return e.message??=JSON.stringify(e.def,n,2),e.message}function Xe(e){this._zod.message=e}var Ze={get:Ye,set:Xe,enumerable:!0,configurable:!0},Qe={value:void 0,enumerable:!1},$e=new WeakSet([Object.prototype,Error.prototype]),et=C(`$ZodError`,(e,t)=>{e.name=`$ZodError`,Qe.value=t,Object.defineProperty(e,"issues",Qe),Qe.value=void 0,Object.defineProperty(e,"message",Ze);let n=Object.getPrototypeOf(e);$e.has(n)||($e.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})}}))});function tt(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 nt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?tt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function rt(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 it(e,t){return{callee:t?.callee??e,Err:t?.Err}}var at=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 w;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>b(e,o,E())));throw re(n,a?.callee??t),n}return s.value};return t},ot=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=>b(e,o,E())));throw re(n,a?.callee??t),n}return s.value};return t},st=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 w;return a.issues.length?ct(e,a.issues,i):{success:!0,data:a.value}};function ct(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>b(e,n,E()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var lt=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?ct(e,a.issues,i):{success:!0,data:a.value}},ut=Symbol.for(`zod.compile.invalid`),dt=Symbol.for(`zod.compile.fallback`),ft=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==ut)return!0;if(r.definite===!0&&n===void 0)return!1}return pt(e,t,n)});function pt(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[dt]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new w;return a.issues.length===0}var mt=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},ht=e=>{let t=at(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,it(n,a))};return n},gt=e=>{let t=at(e),n=(e,r,i,a)=>t(e,r,i,it(n,a));return n},_t=e=>{let t=ot(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,it(n,a))};return n},vt=e=>{let t=ot(e),n=async(e,r,i,a)=>await t(e,r,i,it(n,a));return n},yt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return st(e)(t,n,i)},bt=e=>(t,n,r)=>st(e)(t,n,r),xt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return lt(e)(t,n,i)},St=e=>async(t,n,r)=>lt(e)(t,n,r),Ct=/^[cC][0-9a-z]{6,}$/,wt=/^[0-9a-z]+$/,Tt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Et=/^[0-9a-vA-V]{20}$/,Dt=/^[A-Za-z0-9]{27}$/,Ot=/^[a-zA-Z0-9_-]{21}$/;function kt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var At=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,jt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Mt=e=>e?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)$/,Nt=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Pt=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Ft(){return new RegExp(Pt,`u`)}var It=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9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=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ht=/^https?$/,Ut=/^\+[1-9]\d{6,14}$/,Wt=`(?:(?:\\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 Gt(e){return RegExp(`^${e}$`)}var Kt=Gt(Wt);function qt(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 Jt(e){return RegExp(`^${qt(e)}$`)}function Yt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${qt({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${qt({precision:e.precision})}`:n;return RegExp(`^${Wt}T(?:${r})$`)}var Xt=/^[\s\S]{0,}$/,Zt=/^-?\d+$/,Qt=/^-?\d+(?:\.\d+)?$/,$t=/^(?:true|false)$/i,en=/^[^A-Z]*$/,tn=/^[^a-z]*$/,D=C(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),nn=e=>{let t=e.value;return!a(t)&&t.length!==void 0},rn={number:`number`,bigint:`bigint`,object:`date`},an=C(`$ZodCheckLessThan`,(e,t)=>{D.init(e,t);let n=rn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:rn[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})}}),on=C(`$ZodCheckGreaterThan`,(e,t)=>{D.init(e,t);let n=rn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:rn[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})}}),sn=C(`$ZodCheckMultipleOf`,(e,t)=>{D.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):s(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})}}),cn=C(`$ZodCheckNumberFormat`,(e,t)=>{D.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=fe[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})}}),ln=C(`$ZodCheckMaxLength`,(e,t)=>{var n;D.init(e,t),(n=e._zod.def).when??(n.when=nn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?ke(r):i)<=t.maximum)return;let a=Ae(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),un=C(`$ZodCheckMinLength`,(e,t)=>{var n;D.init(e,t),(n=e._zod.def).when??(n.when=nn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?ke(r):i)>=t.minimum)return;let a=Ae(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dn=C(`$ZodCheckLengthEquals`,(e,t)=>{var n;D.init(e,t),(n=e._zod.def).when??(n.when=nn),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?ke(r):i;if(a===t.length)return;let o=Ae(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})}}),fn=C(`$ZodCheckStringFormat`,(e,t)=>{var n,r;D.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=()=>{})}),pn=C(`$ZodCheckRegex`,(e,t)=>{fn.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})}}),mn=C(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=en,fn.init(e,t)}),hn=C(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=tn,fn.init(e,t)}),gn=C(`$ZodCheckIncludes`,(e,t)=>{D.init(e,t);let n=le(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})}}),_n=C(`$ZodCheckStartsWith`,(e,t)=>{D.init(e,t);let n=RegExp(`^${le(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})}}),vn=C(`$ZodCheckEndsWith`,(e,t)=>{D.init(e,t);let n=RegExp(`.*${le(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})}}),yn=C(`$ZodCheckOverwrite`,(e,t)=>{D.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),bn=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))}},xn={major:4,minor:6,patch:7},O=C(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=xn;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=y(t),a;for(let o of n){if(o._zod.def.when){if(Ce(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 w;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(De(t.issues,n,e),i||=y(t,n))});else{if(t.issues.length===n)continue;De(t.issues,n,e),i||=y(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(y(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new w;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 w;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Pe(this,`~standard`,wn(this))},set"~standard"(e){x(this,`~standard`,e)}}),Sn=(e,t)=>e.issues.length?{issues:e.issues.map(e=>b(e,t,E()))}:{value:e.value};async function Cn(e,t){let n={async:!0};return Sn(await e._zod.run({value:t,issues:[]},n),n)}function wn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Sn(r,n)}catch{}return Cn(e,t)},vendor:`zod`,version:1}}var Tn=C(`$ZodString`,(e,t)=>{O.init(e,t),e._zod.pattern=t.pattern??Xt,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}}),k=C(`$ZodStringFormat`,(e,t)=>{fn.init(e,t),Tn.init(e,t)}),En=C(`$ZodGUID`,(e,t)=>{t.pattern??=jt,k.init(e,t)}),Dn=C(`$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??=Mt(e)}else t.pattern??=Mt();k.init(e,t)}),On=C(`$ZodEmail`,(e,t)=>{t.pattern??=Nt,k.init(e,t)});function kn(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function An(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?kn(e)||2:jn(e,t)}function jn(e,t){if(!t.normalize&&t.protocol?.source===Ht.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 Mn=/[\t\n\r]/g;function Nn(e){return e.replace(Mn,``)}function Pn(e,t){return t.lastIndex=0,t.test(e.hostname)}function Fn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var In=C(`$ZodURL`,(e,t)=>{k.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=An(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=Nn(r);return}t.hostname&&!Pn(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&&!Fn(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:Nn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ln=C(`$ZodEmoji`,(e,t)=>{t.pattern??=Ft(),k.init(e,t)}),Rn=C(`$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?Ot:kt(t.length),k.init(e,t)}),zn=C(`$ZodCUID`,(e,t)=>{t.pattern??=Ct,k.init(e,t)}),Bn=C(`$ZodCUID2`,(e,t)=>{t.pattern??=wt,k.init(e,t)}),Vn=C(`$ZodULID`,(e,t)=>{t.pattern??=Tt,k.init(e,t)}),Hn=C(`$ZodXID`,(e,t)=>{t.pattern??=Et,k.init(e,t)}),Un=C(`$ZodKSUID`,(e,t)=>{t.pattern??=Dt,k.init(e,t)}),Wn=C(`$ZodISODateTime`,(e,t)=>{t.pattern??=Yt(t),k.init(e,t)}),Gn=C(`$ZodISODate`,(e,t)=>{t.pattern??=Kt,k.init(e,t)}),Kn=C(`$ZodISOTime`,(e,t)=>{t.pattern??=Jt(t),k.init(e,t)}),qn=C(`$ZodISODuration`,(e,t)=>{t.pattern??=At,k.init(e,t)}),Jn=C(`$ZodIPv4`,(e,t)=>{t.pattern??=It,k.init(e,t)}),Yn=/^[0-9a-fA-F:.]+$/;function Xn(e){return Yn.test(e)?kn(`http://[${e}]`):!1}var Zn=C(`$ZodIPv6`,(e,t)=>{t.pattern??=Lt,k.init(e,t),e._zod.check=n=>{Xn(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Qn=C(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Rt,k.init(e,t)});function $n(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:Xn(n)}var er=C(`$ZodCIDRv6`,(e,t)=>{t.pattern??=zt,k.init(e,t),e._zod.check=n=>{$n(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function tr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var nr=/^[0-9a-zA-Z+/]*={0,2}$/,rr=C(`$ZodBase64`,(e,t)=>{t.pattern??=nr,k.init(e,t),e._zod.check=n=>{tr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),ir=/^[A-Za-z0-9_-]*$/;function ar(e){if(!ir.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return tr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var or=C(`$ZodBase64URL`,(e,t)=>{t.pattern??=ir,k.init(e,t),e._zod.check=n=>{ar(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),sr=C(`$ZodE164`,(e,t)=>{t.pattern??=Ut,k.init(e,t)});function cr(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 lr=C(`$ZodJWT`,(e,t)=>{k.init(e,t),e._zod.check=n=>{cr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ur=C(`$ZodNumber`,(e,t)=>{O.init(e,t),e._zod.pattern=Qt,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}}),dr=C(`$ZodNumberFormat`,(e,t)=>{cn.init(e,t),ur.init(e,t)}),fr=C(`$ZodBoolean`,(e,t)=>{O.init(e,t),e._zod.pattern=$t,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}}),pr=C(`$ZodUnknown`,(e,t)=>{O.init(e,t),e._zod.parse=e=>e}),mr=C(`$ZodNever`,(e,t)=>{O.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function hr(e,t){let n=Ee(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Ee(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,De(n.issues,t,e),n}}return i(n,a)}}var gr=e=>Array.isArray(e)?e.length:-1;function _r(e,t,n){e.issues.length&&t.issues.push(...we(n,e.issues)),t.value[n]=e.value}var vr=C(`$ZodArray`,(e,t)=>{O.init(e,t);let n=T.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=>_r(t,r,e)));else if(_r(c,r,e),s&&c.issues.length!==0&&y(c))break}return o.length?Promise.all(o).then(()=>r):r},hr(e,gr)});function yr(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(...we(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var br=[];function xr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:br,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=de(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Sr(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(y(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=>yr(e,n,i,t,d,f))):yr(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 Cr=C(`$ZodObject`,(e,t)=>{O.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 a=i(()=>xr(t));S(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)||u(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 o=ie,s=t.catchall,c,l=T.memoizer;l?.attach(e),e._zod.parse=(t,n)=>{c??=a.value;let r=t.value;if(!o(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=l?l.alloc(e,t,{},n):{};let i=[],u=c.shape,d=n?.abortEarly,f=t.issues.length;for(let e of c.allKeys){if(d&&t.issues.length!==f){if(y(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let a=u[e],o=a._zod.optin,s=a._zod.optout,c=a._zod.run({value:r[e],issues:[]},n);c instanceof Promise?i.push(c.then(n=>yr(n,t,e,r,o,s))):yr(c,t,e,r,o,s)}return s?Sr(i,r,t,n,a.value,e,d===!0):i.length?Promise.all(i).then(()=>t):t}}),wr=C(`$ZodObjectJIT`,(e,t)=>{Cr.init(e,t);let n=e._zod.parse,r=i(()=>xr(t)),a=T.memoizer,o=t=>{let n=r.value,i=n.symbolKeys,o=new bn([`payload`,`ctx`],{shape:t,inst:e,memo:a,syms:i}),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(a?`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[${i.indexOf(e)}]`:te(e),a=`${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 = ${a};
|
|
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 || ${a}) {
|
|
30
|
-
newResult[${r}] = ${n}.value;
|
|
31
|
-
}
|
|
32
|
-
`)):o.write(`
|
|
33
|
-
const ${n}_present = ${a};
|
|
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()},s,c=ie,l=!T.jitless,u=l&&ae.value,d=t.catchall,f;e._zod.parse=(i,a)=>{f??=r.value;let p=i.value;return c(p)?l&&u&&a?.async===!1&&a.jitless!==!0?(s||=o(t.shape),i=s(i,a),d?Sr([],p,i,a,f,e,a?.abortEarly===!0):i):n(i,a):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Tr(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=>!y(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=>b(e,r,E())))}),t)}var Er=C(`$ZodUnion`,(e,t)=>{O.init(e,t),S(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),S(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),S(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)))}),S(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=>o(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=>Tr(t,r,e,i)):Tr(o,r,e,i)}});function Dr(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 Or=C(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Er.init(e,t);let n=e._zod.parse;S(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)||u(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=d(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=i(()=>Dr(t));e._zod.parse=(i,a)=>{let o=i.value;if(!ie(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)}}),kr=C(`$ZodIntersection`,(e,t)=>{O.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])=>jr(e,t,n)):jr(e,i,a)}});function Ar(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(oe(e)&&oe(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=Ar(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=Ar(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 jr(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=Ar(t.value,n.value);if(!c.valid){if(y(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Mr=C(`$ZodRecord`,(e,t)=>{O.init(e,t);let n=T.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!oe(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=>b(e,i,E())),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(...we(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...we(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`&&Qt.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=>b(e,i,E())),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(...we(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...we(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}}),Nr=C(`$ZodEnum`,(t,n)=>{O.init(t,n);let r=e(n.entries),i=new Set(r);t._zod.values=i,S(t,`pattern`,t=>{let n=e(t.def.entries).filter(e=>ce.has(typeof e));return RegExp(n.length?`^(${n.map(e=>le(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),t._zod.parse=(e,n)=>{let a=e.value;return i.has(a)||e.issues.push({code:`invalid_value`,values:r,input:a,inst:t}),e}}),Pr=C(`$ZodLiteral`,(e,t)=>{O.init(e,t);let n=new Set(t.values);e._zod.values=n,S(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?le(e):e?le(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}}),Fr=C(`$ZodTransform`,(e,t)=>{O.init(e,t),e._zod.optin=`optional`,T.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Je(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 w;return n.value=i,n}});function Ir(e,t){return e.value=t.issues.length?void 0:t.value,e}var Lr=C(`$ZodOptional`,(e,t)=>{O.init(e,t),S(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,S(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),S(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${o(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=>Ir(e,t)):Ir(e,r)}return t.innerType._zod.run(e,n)}}),Rr=C(`$ZodExactOptional`,(e,t)=>{Lr.init(e,t),S(e,`values`,e=>e.def.innerType._zod.values),S(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),zr=C(`$ZodNullable`,(e,t)=>{O.init(e,t),S(e,`optin`,e=>e.def.innerType._zod.optin),S(e,`optout`,e=>e.def.innerType._zod.optout),S(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${o(t.source)}|null)$`):void 0}),S(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)}),Br=C(`$ZodDefault`,(e,t)=>{O.init(e,t),e._zod.optin=`defaulted`,S(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=>Vr(e,t)):Vr(r,t)}});function Vr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Hr=C(`$ZodPrefault`,(e,t)=>{O.init(e,t),e._zod.optin=`defaulted`,S(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))}),Ur=C(`$ZodNonOptional`,(e,t)=>{O.init(e,t),S(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=>Wr(t,e)):Wr(i,e)}});function Wr(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 Gr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>b(e,r,E()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Kr=C(`$ZodCatch`,(e,t)=>{O.init(e,t),S(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),S(e,`optout`,e=>e.def.innerType._zod.optout),S(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=>Gr(e,r,t,n)):Gr(e,r,t,n)}}),qr=C(`$ZodPipe`,(e,t)=>{O.init(e,t),S(e,`values`,e=>e.def.in._zod.values),S(e,`optin`,e=>e.def.in._zod.optin),S(e,`optout`,e=>e.def.out._zod.optout),S(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=>Jr(e,t.in,n)):Jr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Jr(e,t.out,n)):Jr(r,t.out,n)}});function Jr(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 Yr=C(`$ZodReadonly`,(e,t)=>{O.init(e,t),S(e,`propValues`,e=>e.def.innerType._zod.propValues),S(e,`values`,e=>e.def.innerType._zod.values),S(e,`optin`,e=>e.def.innerType?._zod?.optin),S(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(Xr):Xr(r)}});function Xr(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Zr=C(`$ZodLazy`,(e,t)=>{O.init(e,t),l(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),S(e,`pattern`,e=>e.innerType?._zod?.pattern),S(e,`propValues`,e=>e.innerType?._zod?.propValues),S(e,`optin`,e=>e.innerType?._zod?.optin??void 0),S(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Qr=C(`$ZodCustom`,(e,t)=>{D.init(e,t),O.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=>$r(t,n,r,e));$r(i,n,r,e)}});function $r(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(Me(e))}}var ei=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},ti=`~memo`,ni=[];function ri(e){return typeof e==`object`&&!!e}function ii(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var ai=new WeakMap,oi=0,si=1,ci=2;function li(e,t,n){let r=ai.get(e);if(r!==void 0)return r?ci:oi;if(t.has(e))return ci;t.add(e);let i=oi,a=e=>{if(i!==ci&&e?._zod){let r=li(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=oi;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?si:o.value?._zod?li(o.value,t,n):oi;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=d(c);s(e?o(e,!0):si),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?li(r,t,!1):si);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),ui(e,i)}function ui(e,t){return t!==si&&ai.set(e,t===ci),t}function di(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var fi,pi=[],mi={alloc(e,t,n){let r=fi;if(!r)return n;fi=void 0;let i={value:n,issues:null};return r.set(t.value,i),pi.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`&&gi(n,e.value))throw new ei;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=li(e,new Set,!1);if(i===oi)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===ci||r?n=!0:r=!0}let l=s.value;if(!ri(l))return t(s,c);let u=c[ti];u||(u={buckets:new WeakMap,backEdges:void 0},c[ti]=u);let d;i===c?d=a:(d=di(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(...ii(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;fi=d;let p=pi.length,m=t(s,c);fi=void 0;let h=pi.length>p?pi.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?ii(e.issues):ni),e)):(h&&(h.issues=m.issues.length?ii(m.issues):ni),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function hi(){return mi}function gi(e,t){let n=e[ti]?.backEdges;return n!==void 0&&ri(t)&&n.has(t)}var _i=()=>{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 n(t){return e[t]??null}let r={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},i={nan:`NaN`};function a(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):i[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${a(e.expected)}, received ${a(je(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${ue(e.values[0])}`:`Invalid option: expected one of ${t(e.values,`|`)}`;case`too_big`:{let t=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=n(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${t}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${t}${e.maximum.toString()}`}case`too_small`:{let t=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=n(e.origin);return r?`Too small: expected ${e.origin} to have ${t}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${t}${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 ${r[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`:``}: ${t(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 vi(){return{localeError:_i()}}var yi,bi=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 xi(){return new bi}(yi=globalThis).__zod_globalRegistry??(yi.__zod_globalRegistry=xi());var Si=globalThis.__zod_globalRegistry;function Ci(e){return e.checks&&=[...e.checks],e}function wi(e,t){return new e(Ci({type:`string`,...v(t)}))}function Ti(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...v(t)})}function Ei(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...v(t)})}function Di(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...v(t)})}function Oi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...v(t)})}function ki(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...v(t)})}function Ai(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...v(t)})}function ji(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...v(t)})}function Mi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...v(t)})}function Ni(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...v(t)})}function Pi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...v(t)})}function Fi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...v(t)})}function Ii(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...v(t)})}function Li(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...v(t)})}function Ri(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...v(t)})}function zi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...v(t)})}function Bi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...v(t)})}function Vi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...v(t)})}function Hi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...v(t)})}function Ui(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...v(t)})}function Wi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...v(t)})}function Gi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...v(t)})}function Ki(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...v(t)})}function qi(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...v(t)})}function Ji(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...v(t)})}function Yi(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...v(t)})}function Xi(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...v(t)})}function Zi(e,t){return new e(Ci({type:`number`,checks:[],...v(t)}))}function Qi(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...v(t)})}function $i(e,t){return new e({type:`boolean`,...v(t)})}function ea(e){return new e({type:`unknown`})}function ta(e,t){return new e({type:`never`,...v(t)})}function na(e,t){return new an({check:`less_than`,...v(t),value:e,inclusive:!1})}function ra(e,t){return new an({check:`less_than`,...v(t),value:e,inclusive:!0})}function ia(e,t){return new on({check:`greater_than`,...v(t),value:e,inclusive:!1})}function aa(e,t){return new on({check:`greater_than`,...v(t),value:e,inclusive:!0})}function oa(e,t){return new sn({check:`multiple_of`,...v(t),value:e})}function sa(e,t){return new ln({check:`max_length`,...v(t),maximum:e})}function ca(e,t){return new un({check:`min_length`,...v(t),minimum:e})}function la(e,t){return new dn({check:`length_equals`,...v(t),length:e})}function ua(e,t){return new pn({check:`string_format`,format:`regex`,...v(t),pattern:e})}function da(e){return new mn({check:`string_format`,format:`lowercase`,...v(e)})}function fa(e){return new hn({check:`string_format`,format:`uppercase`,...v(e)})}function pa(e,t){return new gn({check:`string_format`,format:`includes`,...v(t),includes:e})}function ma(e,t){return new _n({check:`string_format`,format:`starts_with`,...v(t),prefix:e})}function ha(e,t){return new vn({check:`string_format`,format:`ends_with`,...v(t),suffix:e})}function ga(e){return new yn({check:`overwrite`,tx:e})}function _a(e){return ga(t=>t.normalize(e))}function va(){return ga(e=>e.trim())}function ya(){return ga(e=>e.toLowerCase())}function ba(){return ga(e=>e.toUpperCase())}function xa(){return ga(e=>ne(e))}function Sa(e,t,n){return new e({type:`array`,element:t,...v(n)})}function Ca(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...v(n)})}function wa(e,t){let n=Ta(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Me(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(Me(r))}},e(t.value,t)),t);return n}function Ta(e,t){let n=new D({check:`custom`,...v(t)});return n._zod.check=e,n}function Ea(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&u(e,t,n[t]);return e}function Da(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??Si,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 A(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&&Ea(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 Oa(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function ka(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}/${Oa(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+Oa(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);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Aa(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;Aa(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 ja=new Set([`type`,`properties`,`required`,`additionalProperties`]),Ma=[`oneOf`,`anyOf`];function Na(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Pa(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!ja.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]??Na(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}u(n,r,e.length===1?e[0]:Pa(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=Na(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 Fa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of ja)if(t in e)return;let n=t.filter(e=>Ma.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Pa(t);else{let e=n[0],i=Ma.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=>Pa([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ea(e,r))}function Ia(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)):Ea(i,s),Ea(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())Aa(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)??[])Fa(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)}Ea(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,u(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:Ra(t,`input`,e.processors),output:Ra(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 La=(e,t={})=>n=>{let r=Da({...n,processors:t});return j(e,r),ka(r,e),Ia(r,e)},Ra=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Da({...i??{},target:a,io:t,processors:n});return j(e,o),ka(o,e),Ia(o,e)},N=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},P=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},za=(e,t)=>{N(e,`minimum`,t),P(e,`maximum`,t)},Ba=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Va=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Ha=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Ua=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Wa=(e,t)=>N(e,`minimum`,t.minimum),Ga=(e,t)=>P(e,`maximum`,t.maximum),Ka=e=>(t,n)=>{Ua(t,n.format);let[r,i]=e[n.format];N(t,`minimum`,r),P(t,`maximum`,i)},qa={greater_than:(e,t)=>N(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>P(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Ba(e,t.value),number_format:Ka(fe),bigint_format:Ka(pe),min_length:Wa,max_length:Ga,length_equals:(e,t)=>za(e,t.length),min_size:Wa,max_size:Ga,size_equals:(e,t)=>za(e,t.size),string_format:(e,t)=>{Ua(e,t.format),t.pattern&&Va(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)=>Ha(e,t.mime)};function F(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)qa[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&N(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&N(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&P(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&P(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Ba(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Ha(t,i.mime);for(let e of i.patterns??[])Va(t,e);return t}var Ja={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ya=new Map([[nr,Bt],[ir,Vt]]),Xa=e=>Ya.get(e)??e,Za=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=F(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ja[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(Xa);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}))])}},Qa=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=F(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)):A(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}))])}},$a=(e,t,n,r)=>{n.type=`boolean`},eo=(e,t,n,r)=>{n.not={}},to=(t,n,r,i)=>{let a=t._zod.def,o=e(a.entries);o.length===0?r.not={}:(o.every(e=>typeof e==`number`)&&(r.type=`number`),o.every(e=>typeof e==`string`)&&(r.type=`string`),r.enum=o)},no=(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(A(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(A(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}},ro=(e,t,n,r)=>{A(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},io=(e,t,n,r)=>{A(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},ao=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=F(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 oo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?oo(t.out):t.type===`catch`?oo(t.innerType):e._zod.optin}var so=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&A(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)u(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`?oo(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)},co=(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},lo=(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 uo(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=uo(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=>uo(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`)?Qt:Zt).source)),p}var fo=new WeakMap;function po(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 fo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=uo(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 mo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=F(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)u(i.patternProperties,Xa(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=fo.get(t);n||(n=[],fo.set(t,n),t.deferred.push(()=>po(t))),n.push(e)}i.additionalProperties=j(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&oo(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))}},ho=(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`}]},go=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},_o=Symbol();function vo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(A(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),_o):JSON.parse(o)}var yo=(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=vo(i.defaultValue,e,t,n,r);o!==_o&&(n.default=o)},bo=(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=vo(i.defaultValue,e,t,n,r);o!==_o&&(n._prefault=o)},xo=(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{A(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},So=(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},Co=(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},wo=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},To=(e,t,n,r)=>{let i=e._zod.innerType;j(i,t,r);let a=t.seen.get(e);a.ref=i},Eo=new WeakSet([Object.prototype,Error.prototype]);function Do(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 I=C(`ZodError`,(e,t)=>{et.init(e,t),e.name=`ZodError`;let r=Object.getPrototypeOf(e);Eo.has(r)||(Eo.add(r),Do(r,`format`,e=>t=>rt(e,t)),Do(r,`flatten`,e=>t=>nt(e,t)),Do(r,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,n,2)}),Do(r,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,n,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Oo=at(I),ko=ot(I),Ao=st(I),jo=lt(I),Mo=ht(I),No=gt(I),Po=_t(I),Fo=vt(I),Io=yt(I),Lo=bt(I),Ro=xt(I),zo=St(I);function Bo(){T.localeError||E(vi())}function Vo(){T.memoizer||E({memoizer:hi()})}var L=C(`ZodType`,(e,t)=>(Bo(),O.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(g(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 _(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check($s(e,t))},superRefine(e,t){return this.check(ec(e,t))},overwrite(e){return this.check(ga(e))},optional(){return Ns(this)},exactOptional(){return Fs(this)},nullable(){return Ls(this)},nullish(){return Ns(Ls(this))},nonoptional(e){return Us(this,e)},array(){return U(this)},or(e){return G([this,e])},and(e){return Ts(this,e)},transform(e){return qs(this,js(e))},default(e){return zs(this,e)},prefault(e){return Vs(this,e)},catch(e){return Gs(this,e)},pipe(e){return qs(this,e)},readonly(){return Ys(this)},describe(e){let t=this.clone();return Si.add(t,{description:e}),t},meta(...e){if(e.length===0)return Si.get(this);let t=this.clone();return Si.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 Pe(this,`~standard`,{...wn(this),jsonSchema:{input:Ra(this,`input`),output:Ra(this,`output`)}})},set"~standard"(e){x(this,`~standard`,e)},parse:function e(t,n){return Oo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ko(this,t,n,{callee:e})},safeParse(e,t){return Ao(this,e,t)},async safeParseAsync(e,t){return jo(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){x(this,`spa`,e)},validate(e,t){return ft(this,e,t)},validateAsync(e,t){return mt(this,e,t)},encode:function e(t,n){return Mo(this,t,n,{callee:e})},decode:function e(t,n){return No(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Po(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Fo(this,t,n,{callee:e})},safeEncode(e,t){return Io(this,e,t)},safeDecode(e,t){return Lo(this,e,t)},async safeEncodeAsync(e,t){return Ro(this,e,t)},async safeDecodeAsync(e,t){return zo(this,e,t)},toJSONSchema(e){return La(this,{})(e)},get description(){return Si.get(this)?.description},get _def(){return this._zod.def}}),Ho=C(`_ZodString`,(e,t)=>{Tn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r)},Fe({format:e=>F(e).format??null,minLength:e=>F(e).minimum??null,maxLength:e=>F(e).maximum??null},{regex(...e){return this.check(ua(...e))},includes(...e){return this.check(pa(...e))},startsWith(...e){return this.check(ma(...e))},endsWith(...e){return this.check(ha(...e))},min(...e){return this.check(ca(...e))},max(...e){return this.check(sa(...e))},length(...e){return this.check(la(...e))},nonempty(...e){return this.check(ca(1,...e))},lowercase(e){return this.check(da(e))},uppercase(e){return this.check(fa(e))},trim(){return this.check(va())},normalize(...e){return this.check(_a(...e))},toLowerCase(){return this.check(ya())},toUpperCase(){return this.check(ba())},slugify(){return this.check(xa())}})),Uo=C(`ZodString`,(e,t)=>{Tn.init(e,t),Ho.init(e,t)},{email(e){return this.check(Ti(Jo,e))},url(e){return this.check(ji(Zo,e))},jwt(e){return this.check(Ki(fs,e))},emoji(e){return this.check(Mi(Qo,e))},guid(e){return this.check(Ei(Yo,e))},uuid(e){return this.check(Di(Xo,e))},uuidv4(e){return this.check(Oi(Xo,e))},uuidv6(e){return this.check(ki(Xo,e))},uuidv7(e){return this.check(Ai(Xo,e))},nanoid(e){return this.check(Ni($o,e))},cuid(e){return this.check(Pi(es,e))},cuid2(e){return this.check(Fi(ts,e))},ulid(e){return this.check(Ii(ns,e))},base64(e){return this.check(Ui(ls,e))},base64url(e){return this.check(Wi(us,e))},xid(e){return this.check(Li(rs,e))},ksuid(e){return this.check(Ri(is,e))},ipv4(e){return this.check(zi(as,e))},ipv6(e){return this.check(Bi(os,e))},cidrv4(e){return this.check(Vi(ss,e))},cidrv6(e){return this.check(Hi(cs,e))},e164(e){return this.check(Gi(ds,e))},datetime(e){return this.check(qi(Wo,e))},date(e){return this.check(Ji(Go,e))},time(e){return this.check(Yi(Ko,e))},duration(e){return this.check(Xi(qo,e))}});function R(e){return wi(Uo,e)}var z=C(`ZodStringFormat`,(e,t)=>{k.init(e,t),Ho.init(e,t)}),Wo=C(`ZodISODateTime`,(e,t)=>{Wn.init(e,t),z.init(e,t)}),Go=C(`ZodISODate`,(e,t)=>{Gn.init(e,t),z.init(e,t)}),Ko=C(`ZodISOTime`,(e,t)=>{Kn.init(e,t),z.init(e,t)}),qo=C(`ZodISODuration`,(e,t)=>{qn.init(e,t),z.init(e,t)}),Jo=C(`ZodEmail`,(e,t)=>{On.init(e,t),z.init(e,t)}),Yo=C(`ZodGUID`,(e,t)=>{En.init(e,t),z.init(e,t)}),Xo=C(`ZodUUID`,(e,t)=>{Dn.init(e,t),z.init(e,t)}),Zo=C(`ZodURL`,(e,t)=>{In.init(e,t),z.init(e,t)}),Qo=C(`ZodEmoji`,(e,t)=>{Ln.init(e,t),z.init(e,t)}),$o=C(`ZodNanoID`,(e,t)=>{Rn.init(e,t),z.init(e,t)}),es=C(`ZodCUID`,(e,t)=>{zn.init(e,t),z.init(e,t)}),ts=C(`ZodCUID2`,(e,t)=>{Bn.init(e,t),z.init(e,t)}),ns=C(`ZodULID`,(e,t)=>{Vn.init(e,t),z.init(e,t)}),rs=C(`ZodXID`,(e,t)=>{Hn.init(e,t),z.init(e,t)}),is=C(`ZodKSUID`,(e,t)=>{Un.init(e,t),z.init(e,t)}),as=C(`ZodIPv4`,(e,t)=>{Jn.init(e,t),z.init(e,t)}),os=C(`ZodIPv6`,(e,t)=>{Zn.init(e,t),z.init(e,t)}),ss=C(`ZodCIDRv4`,(e,t)=>{Qn.init(e,t),z.init(e,t)}),cs=C(`ZodCIDRv6`,(e,t)=>{er.init(e,t),z.init(e,t)}),ls=C(`ZodBase64`,(e,t)=>{rr.init(e,t),z.init(e,t)}),us=C(`ZodBase64URL`,(e,t)=>{or.init(e,t),z.init(e,t)}),ds=C(`ZodE164`,(e,t)=>{sr.init(e,t),z.init(e,t)}),fs=C(`ZodJWT`,(e,t)=>{lr.init(e,t),z.init(e,t)}),ps=C(`ZodNumber`,(e,t)=>{ur.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r),e.isFinite=!0},Fe({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=F(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=F(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=F(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>F(e).format??null},{gt(e,t){return this.check(ia(e,t))},gte(e,t){return this.check(aa(e,t))},min(e,t){return this.check(aa(e,t))},lt(e,t){return this.check(na(e,t))},lte(e,t){return this.check(ra(e,t))},max(e,t){return this.check(ra(e,t))},int(e){return this.check(hs(e))},safe(e){return this.check(hs(e))},positive(e){return this.check(ia(0,e))},nonnegative(e){return this.check(aa(0,e))},negative(e){return this.check(na(0,e))},nonpositive(e){return this.check(ra(0,e))},multipleOf(e,t){return this.check(oa(e,t))},step(e,t){return this.check(oa(e,t))},finite(){return this}}));function B(e){return Zi(ps,e)}var ms=C(`ZodNumberFormat`,(e,t)=>{dr.init(e,t),ps.init(e,t)});function hs(e){return Qi(ms,e)}var gs=C(`ZodBoolean`,(e,t)=>{fr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(e,t,n,r)});function V(e){return $i(gs,e)}var _s=C(`ZodUnknown`,(e,t)=>{pr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function H(){return ea(_s)}var vs=C(`ZodNever`,(e,t)=>{mr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r)});function ys(e){return ta(vs,e)}var bs=C(`ZodArray`,(e,t)=>{Vo(),vr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.element=t.element},{min(e,t){return this.check(ca(e,t))},nonempty(e){return this.check(ca(1,e))},max(e,t){return this.check(sa(e,t))},length(e,t){return this.check(la(e,t))},unwrap(){return this.element}});function U(e,t){return Sa(bs,e,t)}var xs=C(`ZodObject`,(e,t)=>{Vo(),wr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),Ve(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return q(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(g(this._zod.def,{catchall:e}))},passthrough(){return this.clone(g(this._zod.def,{catchall:H()}))},loose(){return this.clone(g(this._zod.def,{catchall:H()}))},strict(){return this.clone(g(this._zod.def,{catchall:ys()}))},strip(){return this.clone(g(this._zod.def,{catchall:void 0}))},extend(e){return _e(this,e)},safeExtend(e){return ye(this,e)},merge(e){return be(this,e)},pick(e){return me(this,e)},omit(e){return ge(this,e)},partial(...e){return xe(Ms,this,e[0])},exactPartial(...e){return xe(Ps,this,e[0],`exactPartial`)},required(...e){return Se(Hs,this,e[0])}});function W(e,t){return new xs({type:`object`,shape:e??{},...v(t)})}var Ss=C(`ZodUnion`,(e,t)=>{Er.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.options=t.options});function G(e,t){return new Ss({type:`union`,options:e,...v(t)})}var Cs=C(`ZodDiscriminatedUnion`,(e,t)=>{Ss.init(e,t),Or.init(e,t)});function K(e,t,n){return new Cs({type:`union`,options:t,discriminator:e,...v(n)})}var ws=C(`ZodIntersection`,(e,t)=>{kr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r)});function Ts(e,t){return new ws({type:`intersection`,left:e,right:t})}var Es=C(`ZodRecord`,(e,t)=>{Vo(),Mr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Ds(e,t,n){return!t||!t._zod?new Es({type:`record`,keyType:R(),valueType:e,...v(t)}):new Es({type:`record`,keyType:e,valueType:t,...v(n)})}var Os=C(`ZodEnum`,(e,t)=>{Nr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(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 Os({...t,checks:[],...v(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 Os({...t,checks:[],...v(r),entries:i})}});function q(e,t){return new Os({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...v(t)})}var ks=C(`ZodLiteral`,(e,t)=>{Pr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(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 J(e,t){return new ks({type:`literal`,values:Array.isArray(e)?e:[e],...v(t)})}var As=C(`ZodTransform`,(e,t)=>{Vo(),Fr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Je(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Me(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(Me(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function js(e){return new As({type:`transform`,transform:e})}var Ms=C(`ZodOptional`,(e,t)=>{Lr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ns(e){return new Ms({type:`optional`,innerType:e})}var Ps=C(`ZodExactOptional`,(e,t)=>{Rr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fs(e){return new Ps({type:`optional`,innerType:e})}var Is=C(`ZodNullable`,(e,t)=>{zr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ls(e){return new Is({type:`nullable`,innerType:e})}var Rs=C(`ZodDefault`,(e,t)=>{Br.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function zs(e,t){return new Rs({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}var Bs=C(`ZodPrefault`,(e,t)=>{Hr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vs(e,t){return new Bs({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}var Hs=C(`ZodNonOptional`,(e,t)=>{Ur.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Us(e,t){return new Hs({type:`nonoptional`,innerType:e,...v(t)})}var Ws=C(`ZodCatch`,(e,t)=>{Kr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Gs(e,t){return new Ws({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Ue(t)})}var Ks=C(`ZodPipe`,(e,t)=>{qr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),e.in=t.in,e.out=t.out});function qs(e,t){return new Ks({type:`pipe`,in:e,out:t})}var Js=C(`ZodReadonly`,(e,t)=>{Yr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ys(e){return new Js({type:`readonly`,innerType:e})}var Xs=C(`ZodLazy`,(e,t)=>{Zr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Zs(e){return new Xs({type:`lazy`,getter:e})}var Qs=C(`ZodCustom`,(e,t)=>{Qr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r)});function $s(e,t={}){return Ca(Qs,e,t)}function ec(e,t){return wa(e,t)}var tc=W({code:q(`unauthorized.forbidden.not_found.invalid_request.conflict.already_answered.stale_control.host_unreachable.pi_incompatible.native_session_missing.invalid_transition.dependency_cycle.workspace_dirty.workspace_unmerged.workspace_active_sessions.branch_invalid.path_collision.not_a_git_repo.repo_mismatch.enrollment_expired.enrollment_used.device_revoked.unsupported_capability.too_large.ui_tree_too_large.timeout.rate_limited.internal`.split(`.`)),message:R(),details:H().optional()});W({error:tc});var nc=q([`default`,`muted`,`success`,`warning`,`danger`]),rc=W({field:R(),values:U(R())}),ic=W({value:R(),label:R(),description:R().optional(),preview:R().optional()}),ac=W({label:R(),placeholder:R().optional()}),oc=K(`kind`,[W({kind:J(`select`),name:R(),label:R(),options:U(ic),allowOther:ac.optional(),showIf:rc.optional()}),W({kind:J(`multiselect`),name:R(),label:R(),options:U(ic),allowOther:ac.optional(),min:B().int().min(0).optional(),max:B().int().min(1).optional(),showIf:rc.optional()}),W({kind:J(`text`),name:R(),label:R(),placeholder:R().optional(),multiline:V().optional(),prefill:R().optional(),showIf:rc.optional()})]),sc=K(`kind`,[W({kind:J(`file`),path:R()}),W({kind:J(`session`),sessionId:R()}),W({kind:J(`task`),taskId:R()}),W({kind:J(`native_session`),hostId:R(),sessionFile:R()})]),cc=Zs(()=>K(`t`,[W({t:J(`text`),text:R(),tone:nc.optional()}),W({t:J(`markdown`),text:R()}),W({t:J(`code`),text:R(),lang:R().optional()}),W({t:J(`diff`),patch:R()}),W({t:J(`list`),items:U(cc),ordered:V().optional()}),W({t:J(`table`),columns:U(R()),rows:U(U(R()))}),W({t:J(`section`),title:R().optional(),collapsible:V().optional(),children:U(cc)}),W({t:J(`tabs`),tabs:U(W({id:R(),label:R(),children:U(cc)}))}),W({t:J(`progress`),label:R(),value:B().min(0).max(1).optional(),status:q([`running`,`ok`,`error`]).optional()}),W({t:J(`ref`),ref:sc,label:R()}),W({t:J(`form`),formId:R(),fields:U(oc),submitLabel:R(),cancelLabel:R().optional()}),W({t:J(`confirm`),message:R(),confirmLabel:R(),cancelLabel:R(),destructive:V().optional()}),W({t:J(`actions`),actions:U(W({id:R(),label:R(),tone:q([`default`,`primary`,`danger`]).optional()}))})]));function lc(e,t){if(!e.showIf)return!0;let n=t[e.showIf.field];return n===void 0?!1:typeof n==`string`?e.showIf.values.includes(n):Array.isArray(n)?n.some(t=>e.showIf.values.includes(t)):!1}var uc=G([R(),U(R()),W({other:R()})]),dc=K(`kind`,[W({kind:J(`form`),values:Ds(R(),uc)}),W({kind:J(`confirm`),confirmed:V()}),W({kind:J(`action`),actionId:R()}),W({kind:J(`cancel`)})]),Y=R(),X=R(),fc=q([`connected`,`reconnecting`,`unreachable`]),pc=[`prompt`,`steer`,`followUp`,`abort`,`resume`,`rename`,`importInactive`,`extensionDialogs`,`customUi`,`widgetsText`,`widgetsComponent`,`tokenAccounting`,`costAccounting`],mc=W({prompt:V(),steer:V(),followUp:V(),abort:V(),resume:V(),rename:V(),importInactive:V(),extensionDialogs:V(),customUi:V(),widgetsText:V(),widgetsComponent:V(),tokenAccounting:V(),costAccounting:V(),terminal:V().optional(),sessionControls:V().optional(),unsupported:U(W({capability:R(),reason:R()}))}),hc=W({state:q([`running`,`done`,`failed`]),startedAt:Y,finishedAt:Y.nullable(),repositories:B().int(),projectsCreated:B().int(),checkoutsAdded:B().int(),errors:U(R())}),gc=W({id:X,name:R(),platform:q([`darwin`,`linux`]),agentVersion:R(),piVersion:R().nullable(),piCompatible:V(),capabilities:mc.nullable(),connectivity:fc,lastSeenAt:Y.nullable(),revokedAt:Y.nullable(),createdAt:Y,projectFolders:U(R()).optional(),projectScan:hc.nullable().optional()}),_c=R().min(1).refine(e=>!e.startsWith(`/`)&&!e.includes(`\\`),`must be a relative path`).refine(e=>!e.split(`/`).includes(`..`),`must stay inside the repository`).refine(e=>e.split(`/`).every(e=>e.length>0&&e!==`.`),`must be a plain relative path`),vc=W({id:X,name:R().min(1),repoIdentity:R(),defaultProfileId:X.nullable(),defaultHostId:X.nullable(),maxConcurrentRuns:B().int().min(1).max(32),automationEnabled:V(),setupCommand:R().nullable(),checks:U(R()),workspaceSharing:q([`single_writer`,`shared`]),worktreeDir:_c.default(`.worktrees`),createdAt:Y,updatedAt:Y}),yc=W({id:X,projectId:X,hostId:X,path:R(),commonDir:R(),defaultBranch:R(),createdAt:Y}),bc=W({dirty:V(),changedFiles:B().int(),ahead:B().int(),behind:B().int(),unmerged:V()}),xc=W({id:X,checkoutId:X,projectId:X,hostId:X,path:R(),branch:R().nullable(),baseBranch:R().nullable(),provenance:q([`managed`,`discovered`,`main`]),git:bc,setup:W({state:q([`none`,`running`,`succeeded`,`failed`]),log:R()}),archivedAt:Y.nullable(),updatedAt:Y}),Z=q([`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]),Sc=W({provider:R(),id:R(),name:R().nullable(),contextWindow:B().nullable(),reasoning:V(),scoped:V().optional(),thinkingLevels:U(Z)}),Cc=W({name:R().min(1),description:R().nullable(),source:q([`extension`,`prompt`,`skill`])}),wc=W({tokens:B().nullable(),window:B(),percent:B().nullable()}),Tc=[`--mode`,`--fork`,`--no-session`,`-e`,`--extension`],Ec=R().refine(e=>e.startsWith(`--`)||!e.startsWith(`-`),`extra args must be long flags`).refine(e=>!Tc.includes(e.split(`=`)[0])&&!e.startsWith(`--session`),`this flag is managed by Switchyard`),Dc=W({id:X,name:R().min(1),provider:R().nullable(),model:R().nullable(),thinking:Z.nullable(),projectTrust:q([`ask`,`approve`,`ignore`]),extraArgs:U(Ec),resources:q([`all`,`vanilla`]).optional()}),Oc=q([`starting`,`idle`,`running`,`waiting_input`,`interrupted`,`failed`,`stopped`]),kc=W({sessionId:R(),sessionFile:R()}),Ac=W({tokens:B().nullable(),costUsd:B().nullable(),context:wc.nullable().optional()}),jc=W({id:X,title:R(),subtitle:R().nullable(),hostId:X,workspaceId:X.nullable(),projectId:X.nullable(),cwd:R(),nativeHandle:kc.nullable(),profileSnapshot:Dc,runtime:Oc,runtimeDetail:R().nullable(),connectivity:fc,runId:X.nullable(),taskId:X.nullable(),provenance:q([`created`,`imported`,`subagent`]),readOnly:V(),lastActivityAt:Y,archivedAt:Y.nullable(),queue:W({steering:U(R()),followUp:U(R())}),stats:Ac.nullable(),model:Sc.nullable().optional(),thinking:Z.nullable().optional(),compacting:V().optional(),lastAssistantText:R().nullable(),createdAt:Y,terminal:V().optional()}),Mc=K(`enabled`,[W({enabled:J(!1)}),W({enabled:J(!0),objective:R().min(1),maxContinuations:B().int().min(1).max(50),maxElapsedMinutes:B().int().min(1).max(1440),maxTokens:B().int().positive().nullable(),maxCostUsd:B().positive().nullable()})]),Nc=W({checks:U(R()).nullable(),requireHumanReview:V()}),Pc=K(`mode`,[W({mode:J(`new_worktree`),branch:R().nullable(),base:R().nullable()}),W({mode:J(`existing`),workspaceId:X})]),Fc=W({hostId:X.nullable(),profileId:X.nullable(),workspace:Pc,continuation:Mc,completion:Nc}),Ic=q([`backlog`,`ready`,`in_progress`,`review`,`done`,`canceled`]),Lc=G([J(0),J(1),J(2),J(3)]),Rc=[`Urgent`,`High`,`Normal`,`Low`],zc=K(`kind`,[W({kind:J(`manual`)}),W({kind:J(`automation`),automationId:X,occurrenceId:X,routine:V()})]),Bc=W({id:X,projectId:X,title:R().min(1),objective:R(),acceptanceCriteria:U(R()),dependencies:U(X),priority:Lc,position:B(),state:Ic,blocked:W({reason:R()}).nullable(),notBefore:Y.nullable(),policy:Fc,origin:zc,groupingKey:R().nullable(),currentRunId:X.nullable(),sessionId:X.nullable(),review:W({feedback:U(R()),changesRequested:V()}),hiddenFromBoard:V(),lastActivityAt:Y,createdAt:Y,updatedAt:Y}),Vc=q([`queued`,`dispatching`,`uncertain`,`running`,`waiting_input`,`checking`,`succeeded`,`failed`,`interrupted`,`canceled`]),Hc=W({command:R(),exitCode:B().int().nullable(),outputTail:R()}),Uc=W({id:X,taskId:X,sessionId:X.nullable(),hostId:X.nullable(),dispatchKey:R(),attempt:B().int().min(1),state:Vc,controlMode:q([`automation`,`human`]),controlRevision:B().int().min(1),continuationsUsed:B().int().min(0),infraRetries:B().int().min(0),nextAttemptAt:Y.nullable(),startedAt:Y.nullable(),endedAt:Y.nullable(),outcome:W({kind:q([`review`,`failed`,`blocked`,`no_change`,`canceled`]),summary:R()}).nullable(),limits:Mc,usage:W({tokens:B().nullable(),costUsd:B().nullable(),accounting:q([`available`,`unavailable`]),note:R().nullable()}),checks:U(Hc),createdAt:Y,updatedAt:Y}),Wc=K(`kind`,[W({kind:J(`manual`)}),W({kind:J(`once`),at:Y}),W({kind:J(`cron`),expr:R().min(1),timezone:R().min(1)}),W({kind:J(`webhook`)}),W({kind:J(`dependency`),taskId:X})]),Gc=W({title:R().min(1),objective:R(),acceptanceCriteria:U(R()),priority:Lc}),Kc=W({id:X,name:R().min(1),enabled:V(),projectId:X,trigger:Wc,filters:U(W({path:R(),equals:R()})),template:Gc,hostId:X.nullable(),profileId:X.nullable(),mode:q([`fresh`,`continue`,`watch`]),groupingKey:R().nullable(),overlap:q([`skip`,`queue_one`,`append`]),missed:q([`skip`,`run_once`]),continuation:Mc,completion:Nc,nextAt:Y.nullable(),lastEvaluatedAt:Y.nullable(),lastOutcome:R().nullable(),failureCount:B().int().min(0),webhookTokenSet:V(),createdAt:Y,updatedAt:Y}),qc=q([`fired`,`skipped_overlap`,`skipped_missed`,`queued`,`appended`,`failed`,`filtered`]),Jc=W({id:X,automationId:X,key:R(),scheduledFor:Y.nullable(),state:qc,taskId:X.nullable(),reason:R().nullable(),outcome:R().nullable(),createdAt:Y}),Yc=q([`pending`,`resolved`,`expired`,`cancelled`,`unsupported`]),Xc=W({id:X,sessionId:X,revision:B().int().min(1),source:K(`kind`,[W({kind:J(`extension_ui`),method:q([`select`,`confirm`,`input`,`editor`]),piRequestIds:U(R())}),W({kind:J(`unsupported_custom`),title:R().nullable()})]),adapterId:R().nullable(),title:R(),presentation:cc,state:Yc,resolution:W({by:R(),summary:R(),at:Y}).nullable(),createdAt:Y}),Zc=q([`needs_input`,`failed`,`ready_for_review`,`unsupported_interaction`,`host_unreachable`]),Qc=W({id:X,sessionId:X.nullable(),taskId:X.nullable(),projectId:X.nullable(),reason:Zc,severity:q([`info`,`warning`,`critical`]),summary:R(),interactionId:X.nullable(),deepLink:R(),acknowledgedAt:Y.nullable(),resolvedAt:Y.nullable(),createdAt:Y}),$c=W({id:X,name:R(),kind:q([`browser`,`pwa`,`terminal`,`cli`]),createdAt:Y,lastSeenAt:Y.nullable(),revokedAt:Y.nullable(),push:W({subscribed:V(),permission:q([`granted`,`denied`,`default`,`unknown`])}),preferredMobile:V(),enrolledVia:q([`enrollment`,`passkey`,`oidc`,`admin`,`approval`]).default(`enrollment`)}),el=W({toolCallId:R(),name:R(),status:q([`running`,`ok`,`error`]),args:H(),summary:R(),output:R(),startedAt:Y,durationMs:B().nullable(),card:cc.nullable(),adapterId:R().nullable()}),tl=K(`kind`,[W({id:X,sessionId:X,order:B().int(),at:Y,kind:J(`user`),data:W({text:R(),images:B().int().optional()})}),W({id:X,sessionId:X,order:B().int(),at:Y,kind:J(`assistant`),data:W({text:R(),streaming:V().optional()})}),W({id:X,sessionId:X,order:B().int(),at:Y,kind:J(`thinking`),data:W({text:R()})}),W({id:X,sessionId:X,order:B().int(),at:Y,kind:J(`tool`),data:el}),W({id:X,sessionId:X,order:B().int(),at:Y,kind:J(`notice`),data:W({level:q([`info`,`warning`,`error`]),text:R()})}),W({id:X,sessionId:X,order:B().int(),at:Y,kind:J(`interaction`),data:W({interactionId:X})}),W({id:X,sessionId:X,order:B().int(),at:Y,kind:J(`subagent`),data:W({runId:R(),label:R(),status:R(),sessionFile:R().nullable(),linkedSessionId:X.nullable()})}),W({id:X,sessionId:X,order:B().int(),at:Y,kind:J(`system`),data:W({text:R(),suggestion:V().optional()})})]),nl=W({sessionId:X,adapterId:R(),slot:R(),title:R(),node:cc.nullable(),webRenderer:V(),mobileFallback:R().nullable(),updatedAt:Y}),rl=W({sessionId:X.nullable(),adapterId:R().nullable(),level:q([`info`,`warning`,`error`]),message:R(),at:Y}),il=W({id:R(),version:R(),tier:q([`project`,`owner`,`plugin`,`bundled`]),target:W({extension:R(),versionRange:R(),testedVersions:U(R())}),capabilities:U(R()),webRenderer:V(),status:q([`active`,`disabled`,`error`]),detail:R().nullable()}),al=W({id:R(),name:R(),createdAt:Y,lastUsedAt:Y.nullable(),transports:U(R())});W({token:R().min(1),name:R().min(1).max(80),kind:q([`browser`,`pwa`,`terminal`,`cli`])}),W({deviceId:R(),credential:R()}),W({kind:q([`device`,`host`])}),W({token:R(),url:R(),expiresAt:R(),qrSvg:R(),command:R().nullable()}),G([W({token:R().min(1),name:R().min(1).max(80),platform:q([`darwin`,`linux`])}),W({secret:R().min(1),name:R().min(1).max(80),platform:q([`darwin`,`linux`])})]),W({hostId:R(),credential:R()}),W({name:R().min(1),hostId:R(),path:R().min(1),defaultProfileId:R().nullable().optional(),setupCommand:R().nullable().optional(),checks:U(R()).optional(),maxConcurrentRuns:B().int().min(1).max(32).optional(),worktreeDir:_c.optional()}),W({name:R().min(1).optional(),defaultProfileId:R().nullable().optional(),defaultHostId:R().nullable().optional(),maxConcurrentRuns:B().int().min(1).max(32).optional(),automationEnabled:V().optional(),setupCommand:R().nullable().optional(),checks:U(R()).optional(),workspaceSharing:q([`single_writer`,`shared`]).optional(),worktreeDir:_c.optional()}),W({hostId:R(),path:R().min(1)});function ol(e){return e.includes(`\0`)?!1:e===`~`||e.startsWith(`~/`)||e.startsWith(`/`)}W({projectFolders:U(R().trim().min(1).max(1024).refine(ol,`must be an absolute path or start with ~/`)).max(20).optional()}),hc.extend({added:U(W({projectId:R(),name:R(),path:R(),newProject:V()}))}),W({name:R().min(1),provider:R().nullable().default(null),model:R().nullable().default(null),thinking:Z.nullable().default(null),projectTrust:q([`ask`,`approve`,`ignore`]).default(`ask`),extraArgs:U(Ec).default([]),resources:q([`all`,`vanilla`]).default(`all`)}),W({checkoutId:R(),branch:R().min(1),base:R().nullable().optional()}),W({force:W({dirty:V(),unmerged:V()}).default({dirty:!1,unmerged:!1})}),W({projectId:R(),workspace:G([W({existingId:R()}),W({checkoutId:R(),newBranch:R().min(1),base:R().nullable().optional()})]),profileId:R().nullable().optional(),prompt:R().default(``),title:R().optional()}),W({text:R().min(1),mode:q([`prompt`,`steer`,`followUp`]).default(`prompt`),images:U(W({mimeType:R(),data:R()})).default([]),clientMessageId:R().optional()}),W({title:R().min(1).max(200)}),W({provider:R().min(1),modelId:R().min(1)}),W({level:Z}),W({instructions:R().max(4e3).optional()}),W({models:U(Sc)}),W({commands:U(Cc)}),W({model:Sc.nullable(),thinking:Z.nullable()}),W({hostId:R(),sessionFile:R(),projectId:R().nullable().optional()}),W({revision:B().int(),response:dc}),W({status:q([`answered`,`already_answered`]),interaction:Xc}),W({adapterId:R(),actionId:R(),payload:H().optional()}),W({projectId:R(),title:R().min(1).max(300),objective:R().default(``),acceptanceCriteria:U(R()).default([]),dependencies:U(R()).default([]),priority:Lc.default(2),state:q([`backlog`,`ready`]).default(`backlog`),notBefore:R().nullable().optional(),policy:Fc.partial().optional()}),W({title:R().min(1).max(300).optional(),objective:R().optional(),acceptanceCriteria:U(R()).optional(),dependencies:U(R()).optional(),priority:Lc.optional(),position:B().optional(),notBefore:R().nullable().optional(),policy:Fc.partial().optional()}),W({to:Ic,confirm:V().optional(),onRunning:q([`pause`,`stop`]).optional(),position:B().optional()}),W({feedback:U(R().min(1)).min(1)});var sl=G([W({eligible:J(!0),hostId:R(),hostName:R()}),W({eligible:J(!1),wait:q([`dependency`,`host_offline`,`project_limit`,`workspace_occupied`,`scheduled_time`,`invalid_configuration`,`dispatch_paused`,`project_automation_disabled`,`not_ready`,`already_dispatched`,`retry_backoff`]),message:R()})]);W({running:U(W({taskId:R(),runId:R(),sessionId:R().nullable()})),queued:U(W({taskId:R(),eligibility:sl})),dispatchPaused:V()});var cl=W({name:R().min(1),enabled:V().default(!0),projectId:R(),trigger:Wc,filters:U(W({path:R(),equals:R()})).default([]),template:Gc,hostId:R().nullable().default(null),profileId:R().nullable().default(null),mode:q([`fresh`,`continue`,`watch`]).default(`fresh`),groupingKey:R().nullable().default(null),overlap:q([`skip`,`queue_one`,`append`]).default(`skip`),missed:q([`skip`,`run_once`]).default(`skip`),continuation:Mc.default({enabled:!1}),completion:Nc.default({checks:null,requireHumanReview:!0})});W({summary:R(),task:W({title:R(),objective:R(),acceptanceCriteria:U(R()),priority:Lc}),next:U(R())});var ll=W({token:R(),url:R()});W({endpoint:R().url(),keys:W({p256dh:R(),auth:R()}),permission:q([`granted`,`denied`,`default`,`unknown`]).default(`granted`)}),W({quietHours:W({start:R().regex(/^\d{2}:\d{2}$/),end:R().regex(/^\d{2}:\d{2}$/),timezone:R()}).nullable(),privatePreviews:V(),preferredDeviceId:R().nullable()}),G([W({type:J(`show`),title:R(),body:R(),tag:R(),url:R(),renotify:V()}),W({type:J(`clear`),tag:R()})]),W({passkey:W({available:V(),registered:V(),reason:R().nullable()}),oidc:W({label:R()}).nullable()}),W({challengeId:R(),options:H()}),W({challengeId:R(),name:R().min(1).max(80),response:H()}),W({challengeId:R(),options:H()}),W({challengeId:R(),response:H(),deviceName:R().min(1).max(80),kind:q([`browser`,`pwa`])}),W({deviceName:R().min(1).max(80),kind:q([`browser`,`pwa`]),next:R().default(`/`),handoff:V().default(!1)}),W({authorizeUrl:R(),flowId:R().nullable(),pollToken:R().nullable()}),W({flowId:R(),pollToken:R()}),G([W({status:J(`pending`)}),W({status:J(`done`),deviceId:R()})]),W({name:R().min(1).max(80)}),W({userCode:R(),pollToken:R(),verifyUrl:R(),expiresAt:R(),intervalMs:B().int()}),W({userCode:R().min(1),pollToken:R().min(1)}),G([W({status:J(`pending`)}),W({status:J(`denied`)}),W({status:J(`done`),deviceId:R(),credential:R()})]),W({userCode:R(),name:R(),requestedFrom:R(),createdAt:R(),expiresAt:R(),status:q([`pending`,`approved`,`denied`])}),W({passkeys:U(al),passkeyAvailability:W({available:V(),reason:R().nullable()}),oidc:W({issuer:R(),label:R(),ownerMatch:R(),status:q([`ready`,`error`]),error:R().nullable()}).nullable()}),W({device:$c,admin:V(),publicUrl:R()});var ul={"host.updated":gc,"project.updated":vc,"project.deleted":W({id:R()}),"checkout.updated":yc,"workspace.updated":xc,"workspace.removed":W({id:R()}),"profile.updated":Dc,"profile.deleted":W({id:R()}),"session.updated":jc,"transcript.item":tl,"interaction.updated":Xc,"panel.updated":nl,"adapters.updated":W({hostId:R(),adapters:U(il)}),diagnostic:rl,"task.updated":Bc,"task.deleted":W({id:R()}),"run.updated":Uc,"automation.updated":Kc,"automation.deleted":W({id:R()}),"occurrence.created":Jc,"attention.updated":Qc,"device.updated":$c,"settings.updated":W({dispatchPaused:V()})},dl=q(Object.keys(ul)),fl=W({hostId:R().optional(),sessionId:R().optional(),taskId:R().optional(),projectId:R().optional()}),pl=fl.extend({seq:B().int(),id:R(),type:dl,at:R(),data:H()}),ml=fl.extend({eventId:R(),type:q([`session.updated`,`transcript.item`,`interaction.updated`,`panel.updated`,`adapters.updated`,`diagnostic`,`workspace.updated`,`workspace.removed`]),at:R(),data:H()}),hl=W({sessionId:R(),itemId:R(),kind:q([`text`,`thinking`,`tool_args`,`tool_output`]),delta:R(),order:B().int().optional()}),gl=W({hosts:U(gc),projects:U(vc),checkouts:U(yc),workspaces:U(xc),profiles:U(Dc),sessions:U(jc),tasks:U(Bc),runs:U(Uc),automations:U(Kc),attention:U(Qc),interactions:U(Xc),panels:U(nl),devices:U($c),adapters:Ds(R(),U(il)),dispatchPaused:V()}),_l=W({foreground:V(),interactedAt:R().nullable(),viewing:W({sessionId:R()}).nullable()});K(`type`,[W({type:J(`hello`),cursor:B().int().nullable()}),W({type:J(`presence`),presence:_l}),W({type:J(`ping`)})]),K(`type`,[W({type:J(`replay`),seq:B().int(),events:U(pl)}),W({type:J(`snapshot`),seq:B().int(),state:gl}),W({type:J(`event`),event:pl}),W({type:J(`stream`),delta:hl}),W({type:J(`pong`)}),W({type:J(`force_logout`),reason:R()})]);var vl=B().int().min(10).max(1e3),yl=B().int().min(5).max(500);K(`t`,[W({t:J(`in`),d:R()}),W({t:J(`resize`),cols:vl,rows:yl})]);var bl=K(`t`,[W({t:J(`out`),d:R()}),W({t:J(`closed`),reason:R()})]),xl=K(`t`,[W({t:J(`open`),sessionId:R(),cols:vl,rows:yl}),W({t:J(`in`),d:R()}),W({t:J(`resize`),cols:vl,rows:yl}),W({t:J(`close`)})]),Sl=q([`human`,`automation`]),Cl=K(`type`,[W({type:J(`session.start`),sessionId:R(),title:R(),workspacePath:R(),projectId:R().nullable(),profile:Dc,nativeHandle:kc.nullable(),initialPrompt:R().nullable(),dispatchKey:R().nullable(),controlRevision:B().int(),controlMode:q([`automation`,`human`]),origin:Sl,readOnly:V().default(!1)}),W({type:J(`session.prompt`),sessionId:R(),text:R(),images:U(W({mimeType:R(),data:R()})).default([]),mode:q([`prompt`,`steer`,`followUp`]),origin:Sl,controlRevision:B().int()}),W({type:J(`session.abort`),sessionId:R(),clearQueue:V()}),W({type:J(`session.stop`),sessionId:R()}),W({type:J(`session.answer`),sessionId:R(),interactionId:R(),revision:B().int(),response:dc,deviceId:R()}),W({type:J(`session.adapterAction`),sessionId:R(),adapterId:R(),actionId:R(),payload:H()}),W({type:J(`session.setControl`),sessionId:R(),controlRevision:B().int(),mode:q([`automation`,`human`])}),W({type:J(`session.rename`),sessionId:R(),title:R()}),W({type:J(`session.importable`)}),W({type:J(`session.readNative`),sessionFile:R()}),W({type:J(`session.snapshot`),sessionId:R()}),W({type:J(`session.models`),sessionId:R()}),W({type:J(`session.commands`),sessionId:R()}),W({type:J(`session.setModel`),sessionId:R(),provider:R().min(1),modelId:R().min(1)}),W({type:J(`session.setThinking`),sessionId:R(),level:Z}),W({type:J(`session.compact`),sessionId:R(),instructions:R().nullable()}),W({type:J(`checkout.inspect`),path:R()}),W({type:J(`projects.scan`),folder:R().min(1)}),W({type:J(`workspace.discover`),checkoutPath:R(),worktreeDir:R().default(`.worktrees`)}),W({type:J(`workspace.create`),checkoutPath:R(),branch:R(),base:R(),setupCommand:R().nullable(),worktreeDir:R().default(`.worktrees`)}),W({type:J(`workspace.status`),path:R(),base:R().nullable()}),W({type:J(`workspace.remove`),path:R(),checkoutPath:R(),base:R().nullable(),force:W({dirty:V(),unmerged:V()})}),W({type:J(`workspace.diff`),path:R(),base:R().nullable(),file:R().nullable()}),W({type:J(`workspace.files`),path:R(),dir:R()}),W({type:J(`workspace.readFile`),path:R(),file:R()}),W({type:J(`dispatch.start`),dispatchKey:R(),runId:R(),taskId:R(),sessionId:R(),projectId:R(),title:R(),workspace:G([W({path:R()}),W({createFrom:W({checkoutPath:R(),branch:R(),base:R(),setupCommand:R().nullable(),worktreeDir:R().default(`.worktrees`)})})]),nativeHandle:kc.nullable(),profile:Dc,prompt:R(),controlRevision:B().int(),controlMode:q([`automation`,`human`]).default(`automation`)}),W({type:J(`dispatch.reconcile`),dispatchKey:R()}),W({type:J(`checks.run`),sessionId:R(),path:R(),commands:U(R())})]);W({sessionFile:R(),sessionId:R(),cwd:R(),name:R().nullable(),mtime:R(),inactive:V()}),W({path:R(),head:R().nullable(),branch:R().nullable(),bare:V(),detached:V(),locked:V(),prunable:V(),provenance:q([`managed`,`discovered`,`main`]),git:bc.nullable()});var wl=W({root:R(),commonDir:R(),repoIdentity:R(),defaultBranch:R()}).extend({name:R()});W({folder:R(),repositories:U(wl)});var Tl=W({path:R(),oldPath:R().nullable(),added:B().int(),deleted:B().int(),status:q([`added`,`modified`,`deleted`,`renamed`,`untracked`,`binary`])});W({base:R(),files:U(Tl),patch:R().nullable()}),W({name:R(),path:R(),kind:q([`file`,`dir`,`symlink`]),size:B().int().nullable()}),G([W({known:J(!1)}),W({known:J(!0),sessionId:R().nullable(),state:q([`accepted`,`workspace_ready`,`started`,`failed`]),runtime:Oc.nullable(),workspacePath:R().nullable(),nativeHandle:kc.nullable(),error:R().nullable(),errorDetails:Ds(R(),H()).nullable().default(null)})]),W({sessionId:R(),workspacePath:R(),nativeHandle:kc.nullable(),reused:V()}),W({status:q([`answered`,`already_answered`]),interaction:Xc}),W({partial:U(tl),pendingInteractions:U(Xc)}),W({results:U(Hc)});var El=G([W({commandId:R(),ok:J(!0),result:H()}),W({commandId:R(),ok:J(!1),error:tc})]);K(`type`,[W({type:J(`hello`),hostId:R(),credential:R(),name:R(),agentVersion:R(),piVersion:R().nullable(),piCompatible:V(),platform:q([`darwin`,`linux`]),capabilities:mc.nullable(),protocolVersion:B().int()}),W({type:J(`event`),hostSeq:B().int(),event:ml}),W({type:J(`stream`),delta:hl}),W({type:J(`receipt`),receipt:El}),W({type:J(`pong`)}),W({type:J(`term`),streamId:R(),msg:bl})]),K(`type`,[W({type:J(`welcome`),coordinatorVersion:R(),ackedHostSeq:B().int()}),W({type:J(`ack`),hostSeq:B().int()}),W({type:J(`command`),commandId:R(),command:Cl}),W({type:J(`ping`)}),W({type:J(`reject`),error:tc}),W({type:J(`term`),streamId:R(),msg:xl})]);var Dl=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`,Ol=32,kl=16,Al=0xffffffffffff,Q;(function(e){e.Base32IncorrectEncoding=`B32_ENC_INVALID`,e.DecodeTimeInvalidCharacter=`DEC_TIME_CHAR`,e.DecodeTimeValueMalformed=`DEC_TIME_MALFORMED`,e.EncodeTimeNegative=`ENC_TIME_NEG`,e.EncodeTimeSizeExceeded=`ENC_TIME_SIZE_EXCEED`,e.EncodeTimeValueMalformed=`ENC_TIME_MALFORMED`,e.PRNGDetectFailure=`PRNG_DETECT`,e.ULIDInvalid=`ULID_INVALID`,e.Unexpected=`UNEXPECTED`,e.UUIDInvalid=`UUID_INVALID`})(Q||={});var $=class extends Error{constructor(e,t){super(`${t} (${e})`),this.name=`ULIDError`,this.code=e}};function jl(e){let t=Math.floor(e()*Ol)%Ol;return Dl.charAt(t)}function Ml(e,t,n){return t>e.length-1?e:e.substr(0,t)+n+e.substr(t+1)}function Nl(e){let t,n=e.length,r,i,a=e;for(;!t&&n-->=0;){if(r=a[n],i=Dl.indexOf(r),i===-1)throw new $(Q.Base32IncorrectEncoding,`Incorrectly encoded string`);i===31?a=Ml(a,n,Dl[0]):t=Ml(a,n,Dl[i+1])}if(typeof t==`string`)return t;throw new $(Q.Base32IncorrectEncoding,`Failed incrementing string`)}function Pl(e){let t=Fl(),n=t&&(t.crypto||t.msCrypto)||null;if(typeof n?.getRandomValues==`function`)return()=>{let e=new Uint8Array(1);return n.getRandomValues(e),e[0]/256};if(typeof n?.randomBytes==`function`)return()=>n.randomBytes(1).readUInt8()/256;throw new $(Q.PRNGDetectFailure,`Failed to find a reliable PRNG`)}function Fl(){return Rl()?self:typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:null}function Il(e,t){let n=``;for(;e>0;e--)n=jl(t)+n;return n}function Ll(e,t=10){if(isNaN(e))throw new $(Q.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>0xffffffffffff)throw new $(Q.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Al}: ${e}`);if(e<0)throw new $(Q.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new $(Q.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let n,r=``;for(let i=t;i>0;i--)n=e%Ol,r=Dl.charAt(n)+r,e=(e-n)/Ol;return r}function Rl(){return typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope}function zl(e){let t=e||Pl(),n=0,r;return function(e){let i=!e||isNaN(e)?Date.now():e;if(i<=n){let e=r=Nl(r);return Ll(n,10)+e}n=i;let a=r=Il(kl,t);return Ll(i,10)+a}}zl();var Bl=`>=1.4.0 <1.6.0`;export{Kc as a,Rc as c,lc as d,ol as i,Z as l,cl as n,pc as o,ll as r,Ec as s,Bl as t,_c as u};
|
|
56
|
-
//# sourceMappingURL=dist-BE_V9dwJ.js.map
|