@atolis-hq/wake 0.4.48 → 0.4.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +3 -0
  2. package/dist/src/activities/agent/agent-activity.js +9 -3
  3. package/dist/src/activities/contracts/activity.d.ts +14 -0
  4. package/dist/src/artifacts/application/artifact-projection.d.ts +3 -0
  5. package/dist/src/artifacts/application/artifact-projection.js +15 -0
  6. package/dist/src/artifacts/application/artifact-repository.d.ts +13 -0
  7. package/dist/src/artifacts/application/artifact-repository.js +19 -0
  8. package/dist/src/artifacts/application/artifact-service.d.ts +40 -0
  9. package/dist/src/artifacts/application/artifact-service.js +128 -0
  10. package/dist/src/artifacts/contracts/config.d.ts +6 -0
  11. package/dist/src/artifacts/contracts/config.js +19 -0
  12. package/dist/src/artifacts/contracts/event-factory.d.ts +6 -0
  13. package/dist/src/artifacts/contracts/event-factory.js +10 -0
  14. package/dist/src/artifacts/contracts/events.d.ts +33 -0
  15. package/dist/src/artifacts/contracts/events.js +59 -0
  16. package/dist/src/artifacts/contracts/identifiers.d.ts +5 -0
  17. package/dist/src/artifacts/contracts/identifiers.js +8 -0
  18. package/dist/src/artifacts/contracts/paths.d.ts +5 -0
  19. package/dist/src/artifacts/contracts/paths.js +9 -0
  20. package/dist/src/artifacts/contracts/streams.d.ts +7 -0
  21. package/dist/src/artifacts/contracts/streams.js +4 -0
  22. package/dist/src/artifacts/contracts/views.d.ts +20 -0
  23. package/dist/src/artifacts/contracts/views.js +1 -0
  24. package/dist/src/artifacts/domain/artifact-work-item.d.ts +4 -0
  25. package/dist/src/artifacts/domain/artifact-work-item.js +42 -0
  26. package/dist/src/artifacts/index.d.ts +14 -0
  27. package/dist/src/artifacts/index.js +14 -0
  28. package/dist/src/artifacts/infrastructure/file-artifact-store.d.ts +22 -0
  29. package/dist/src/artifacts/infrastructure/file-artifact-store.js +51 -0
  30. package/dist/src/artifacts/infrastructure/mcp-server.d.ts +18 -0
  31. package/dist/src/artifacts/infrastructure/mcp-server.js +135 -0
  32. package/dist/src/artifacts/infrastructure/mcp-session-store.d.ts +25 -0
  33. package/dist/src/artifacts/infrastructure/mcp-session-store.js +61 -0
  34. package/dist/src/bootstrap/artifact-mcp.d.ts +23 -0
  35. package/dist/src/bootstrap/artifact-mcp.js +119 -0
  36. package/dist/src/bootstrap/composition-root.d.ts +2 -0
  37. package/dist/src/bootstrap/composition-root.js +13 -0
  38. package/dist/src/bootstrap/config/root-schema.d.ts +6 -0
  39. package/dist/src/bootstrap/config/root-schema.js +5 -0
  40. package/dist/src/bootstrap/paths.d.ts +1 -0
  41. package/dist/src/bootstrap/paths.js +1 -0
  42. package/dist/src/bootstrap/projection-runtime.js +2 -0
  43. package/dist/src/bootstrap/runner-registry.js +22 -4
  44. package/dist/src/bootstrap/surface-api-work-applications.js +39 -1
  45. package/dist/src/bootstrap/surface-cli-applications.js +12 -1
  46. package/dist/src/bootstrap/version.js +1 -1
  47. package/dist/src/execution/application/execution-activity.d.ts +11 -0
  48. package/dist/src/execution/application/execution-activity.js +26 -10
  49. package/dist/src/execution/application/execution-service.js +1 -1
  50. package/dist/src/execution/contracts/runner.d.ts +10 -0
  51. package/dist/src/execution/infrastructure/runners/claude.d.ts +1 -0
  52. package/dist/src/execution/infrastructure/runners/claude.js +21 -0
  53. package/dist/src/execution/infrastructure/runners/codex.js +12 -0
  54. package/dist/src/execution/infrastructure/runners/fake.d.ts +1 -0
  55. package/dist/src/execution/infrastructure/runners/fake.js +1 -0
  56. package/dist/src/execution/infrastructure/runners/registry.d.ts +3 -1
  57. package/dist/src/execution/infrastructure/runners/registry.js +5 -3
  58. package/dist/src/surfaces/api/contracts/work.d.ts +10 -0
  59. package/dist/src/surfaces/api/routes/applications.d.ts +5 -0
  60. package/dist/src/surfaces/api/routes/read.js +34 -3
  61. package/dist/src/surfaces/api/routes/work.d.ts +1 -1
  62. package/dist/src/surfaces/api/routes/work.js +1 -0
  63. package/dist/src/surfaces/cli/main.d.ts +8 -0
  64. package/dist/src/surfaces/cli/main.js +31 -0
  65. package/dist/src/surfaces/cli/usage.js +1 -0
  66. package/dist/src/surfaces/index.d.ts +1 -0
  67. package/dist/src/surfaces/index.js +1 -0
  68. package/dist/src/surfaces/mcp/stdio.d.ts +3 -0
  69. package/dist/src/surfaces/mcp/stdio.js +5 -0
  70. package/dist/src/surfaces/web-assets/assets/{index-CuAZYm7r.js → index-CuIiUKuh.js} +2 -2
  71. package/dist/src/surfaces/web-assets/index.html +1 -1
  72. package/package.json +3 -1
@@ -10,7 +10,7 @@ Error generating stack: `+e.message+`
10
10
 
11
11
  Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=_t(),d;if(t){let e=typeof t==`string`?de(t):t;ae(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):me(e,{pathname:p});oe(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),oe(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=Mt(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:He([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:He([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?S.createElement(st.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function Et(){let e=ree(),t=qe(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=S.createElement(S.Fragment,null,S.createElement(`p`,null,`💿 Hey developer 👋`),S.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,S.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,S.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),S.createElement(S.Fragment,null,S.createElement(`h2`,null,`Unexpected Application Error!`),S.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?S.createElement(`pre`,{style:i},n):null,o)}var Dt=S.createElement(Et,null),Ot=class extends S.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=mt(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:S.createElement(ct.Provider,{value:this.props.routeContext},S.createElement(lt.Provider,{value:e,children:this.props.component}));return this.context?S.createElement(At,{error:e},t):t}};Ot.contextType=nt;var kt=new WeakMap;function At({children:e,error:t}){let{basename:n}=S.useContext(ot);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=pt(t.digest);if(e){let r=kt.get(t);if(r)throw r;let i=Xe(e.location,n),a=i.absoluteURL||i.to;if(tee(a))throw Error(`Invalid redirect location`);if(Ye&&!kt.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw kt.set(t,n),n}return S.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function jt({routeContext:e,match:t,children:n}){let r=S.useContext(et);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),S.createElement(ct.Provider,{value:e},n)}function Mt(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);ae(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Je(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Dt,o&&(s<0&&c===0?(Vt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?S.createElement(n.route.Component,null):n.route.element?n.route.element:e,S.createElement(jt,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?S.createElement(Ot,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Nt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Pt(e){let t=S.useContext(et);return ae(t,Nt(e)),t}function Ft(e){let t=S.useContext(tt);return ae(t,Nt(e)),t}function It(e){let t=S.useContext(ct);return ae(t,Nt(e)),t}function Lt(e){let t=It(e),n=t.matches[t.matches.length-1];return ae(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Rt(){return Lt(`useRouteId`)}function ree(){let e=S.useContext(lt),t=Ft(`useRouteError`),n=Lt(`useRouteError`);return e===void 0?t.errors?.[n]:e}function zt(){let{router:e}=Pt(`useNavigate`),t=Lt(`useNavigate`),n=S.useRef(!1);return yt(()=>{n.current=!0}),S.useCallback(async(r,i={})=>{oe(n.current,vt),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Bt={};function Vt(e,t,n){!t&&!Bt[e]&&(Bt[e]=!0,oe(!1,n))}S.memo(Ht);function Ht({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Tt(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Ut({to:e,replace:t,state:n,relative:r}){ae(gt(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=S.useContext(ot);oe(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=S.useContext(ct),{pathname:o}=_t(),s=bt(),c=Be(e,ze(a),o,r===`path`),l=JSON.stringify(c);return S.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Wt(e){ae(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Gt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){ae(!gt(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=S.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=de(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=S.useMemo(()=>{let e=Pe(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return oe(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:S.createElement(ot.Provider,{value:c},S.createElement(st.Provider,{children:t,value:h}))}function Kt({children:e,location:t}){return wt(qt(e),t)}S.Component;function qt(e,t=[]){let n=[];return S.Children.forEach(e,(e,r)=>{if(!S.isValidElement(e))return;let i=[...t,r];if(e.type===S.Fragment){n.push.apply(n,qt(e.props.children,i));return}ae(e.type===Wt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ae(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=qt(e.props.children,i)),n.push(a)}),n}var Jt=`get`,Yt=`application/x-www-form-urlencoded`;function Xt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Zt(e){return Xt(e)&&e.tagName.toLowerCase()===`button`}function Qt(e){return Xt(e)&&e.tagName.toLowerCase()===`form`}function $t(e){return Xt(e)&&e.tagName.toLowerCase()===`input`}function en(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function tn(e,t){return e.button===0&&(!t||t===`_self`)&&!en(e)}function nn(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function rn(e,t){let n=nn(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var an=null;function on(){if(an===null)try{new FormData(document.createElement(`form`),0),an=!1}catch{an=!0}return an}var sn=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function cn(e){return e!=null&&!sn.has(e)?(oe(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Yt}"`),null):e}function ln(e,t){let n,r,i,a,o;if(Qt(e)){let o=e.getAttribute(`action`);r=o?Pe(o,t):null,n=e.getAttribute(`method`)||Jt,i=cn(e.getAttribute(`enctype`))||Yt,a=new FormData(e)}else if(Zt(e)||$t(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?Pe(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Jt,i=cn(e.getAttribute(`formenctype`))||cn(o.getAttribute(`enctype`))||Yt,a=new FormData(o,e),!on()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Xt(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Jt,r=null,i=Yt,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function un(e,t){if(e===!1||e==null)throw Error(t)}function dn(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&Pe(i.pathname,t)===`/`?`${Ue(t)}/_root.${r}`:`${Ue(i.pathname)}.${r}`,i}async function fn(e,t){if(e.id in t)return t[e.id];try{let n=await x(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function pn(e){return e!=null&&typeof e.page==`string`}function mn(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function hn(e,t,n){return bn((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await fn(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(mn).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function gn(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function _n(e,t,{includeHydrateFallback:n}={}){return vn(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function vn(e){return[...new Set(e)]}function yn(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function bn(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!pn(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(yn(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function xn(){let e=S.useContext(et);return un(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Sn(){let e=S.useContext(tt);return un(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Cn=S.createContext(void 0);Cn.displayName=`FrameworkContext`;function wn(){let e=S.useContext(Cn);return un(e,`You must render this element inside a <HydratedRouter> element`),e}function Tn(e,t){let n=S.useContext(Cn),[r,i]=S.useState(!1),[a,o]=S.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=S.useRef(null);S.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),S.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:En(s,p),onBlur:En(c,m),onMouseEnter:En(l,p),onMouseLeave:En(u,m),onTouchStart:En(d,p)}]:[a,f,{}]:[!1,f,{}]}function En(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Dn({page:e,...t}){let n=rt(),{nonce:r}=wn(),{router:i}=xn(),a=S.useMemo(()=>me(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?S.createElement(kn,{page:e,matches:a,...t}):S.createElement(An,{page:e,matches:a,...t})):null}function On(e){let{manifest:t,routeModules:n}=wn(),[r,i]=S.useState([]);return S.useEffect(()=>{let r=!1;return hn(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function kn({page:e,matches:t,...n}){let r=_t(),{future:i}=wn(),{basename:a}=xn(),o=S.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=dn(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return S.createElement(S.Fragment,null,o.map(e=>S.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function An({page:e,matches:t,...n}){let r=_t(),{future:i,manifest:a,routeModules:o}=wn(),{basename:s}=xn(),{loaderData:c,matches:l}=Sn(),u=S.useMemo(()=>gn(e,t,l,a,r,`data`),[e,t,l,a,r]),d=S.useMemo(()=>gn(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=S.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=dn(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=S.useMemo(()=>_n(d,a),[d,a]),m=On(d);return S.createElement(S.Fragment,null,f.map(e=>S.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>S.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>S.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function jn(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}S.Component;var Mn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Mn&&(window.__reactRouterVersion=`7.18.2`)}catch{}function Nn({basename:e,children:t,useTransitions:n,window:r}){let i=S.useRef();i.current??=ie({window:r,v5Compat:!0});let a=i.current,[o,s]=S.useState({action:a.action,location:a.location}),c=S.useCallback(e=>{n===!1?s(e):S.startTransition(()=>s(e))},[n]);return S.useLayoutEffect(()=>a.listen(c),[a,c]),S.createElement(Gt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var Pn=S.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=S.useContext(ot),v=typeof l==`string`&&ee.test(l),y=Xe(l,h);l=y.to;let b=ht(l,{relative:r}),x=_t(),te=null;if(o){let e=Be(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:He([h,e.pathname])),te=g.createHref(e)}let[ne,C,re]=Tn(n,p),ie=zn(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function ae(t){e&&e(t),t.defaultPrevented||ie(t)}let oe=!(y.isExternal||i),se=S.createElement(`a`,{...p,...re,href:(oe?te:void 0)||y.absoluteURL||b,onClick:oe?ae:e,ref:jn(m,C),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return ne&&!v?S.createElement(S.Fragment,null,se,S.createElement(Dn,{page:b})):se});Pn.displayName=`Link`;var Fn=S.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Ct(a,{relative:c.relative}),d=_t(),f=S.useContext(tt),{navigator:p,basename:m}=S.useContext(ot),h=f!=null&&oee(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=Pe(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),ee={isActive:b,isPending:x,isTransitioning:h},te=b?e:void 0,ne;ne=typeof n==`function`?n(ee):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let C=typeof i==`function`?i(ee):i;return S.createElement(Pn,{...c,"aria-current":te,className:ne,ref:l,style:C,to:a,viewTransition:o},typeof s==`function`?s(ee):s)});Fn.displayName=`NavLink`;var In=S.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Jt,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=S.useContext(ot),g=aee(),_=Hn(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&ee.test(s);return S.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?S.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});In.displayName=`Form`;function Ln(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Rn(e){let t=S.useContext(et);return ae(t,Ln(e)),t}function zn(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=bt(),d=_t(),f=Ct(e,{relative:o});return S.useCallback(p=>{if(tn(p,t)){p.preventDefault();let t=n===void 0?ue(d)===ue(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?S.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Bn(e){oe(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=S.useRef(nn(e)),n=S.useRef(!1),r=_t(),i=S.useMemo(()=>rn(r.search,n.current?null:t.current),[r.search]),a=bt();return[i,S.useCallback((e,t)=>{let r=nn(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Vn=0,iee=()=>`__${String(++Vn)}__`;function aee(){let{router:e}=Rn(`useSubmit`),{basename:t}=S.useContext(ot),n=Rt(),r=e.fetch,i=e.navigate;return S.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=ln(e,t);if(a.navigate===!1){let e=a.fetcherKey||iee();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Hn(e,{relative:t}={}){let{basename:n}=S.useContext(ot),r=S.useContext(ct);ae(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Ct(e||`.`,{relative:t})},o=_t();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:He([n,a.pathname])),ue(a)}function oee(e,{relative:t}={}){let n=S.useContext(it);ae(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Rn(`useViewTransitionState`),i=Ct(e,{relative:t});if(!n.isTransitioning)return!1;let a=Pe(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Pe(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ae(i.pathname,o)!=null||Ae(i.pathname,a)!=null}var Un=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Wn=new class extends Un{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},see={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Gn=new class{#e=see;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function cee(e){setTimeout(e,0)}var Kn=typeof window>`u`||`Deno`in globalThis;function qn(){}function Jn(e,t){return typeof e==`function`?e(t):e}function Yn(e){return typeof e==`number`&&e>=0&&e!==1/0}function Xn(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Zn(e,t){return typeof e==`function`?e(t):e}function Qn(e,t){return typeof e==`function`?e(t):e}function $n(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==tr(o,t.options))return!1}else if(!rr(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function er(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(nr(t.options.mutationKey)!==nr(a))return!1}else if(!rr(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function tr(e,t){return(t?.queryKeyHashFn||nr)(e)}function nr(e){return JSON.stringify(e,(e,t)=>cr(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function rr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!rr(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!rr(e[r],t[r]))return!1;return!0}return!1}var ir=Object.prototype.hasOwnProperty;function ar(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=sr(e)&&sr(t);if(!r&&!(cr(e)&&cr(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ir.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=ar(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function or(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function sr(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function cr(e){if(!lr(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!lr(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function lr(e){return Object.prototype.toString.call(e)===`[object Object]`}function ur(e){return new Promise(t=>{Gn.setTimeout(t,e)})}function dr(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ar(e,t)}function fr(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function pr(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var mr=Symbol();function hr(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===mr?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function gr(e,t){return typeof e==`function`?e(...t):!!e}function _r(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var vr=(()=>{let e=()=>Kn;return{isServer(){return e()},setIsServer(t){e=t}}})();function yr(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var br=cee;function xr(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=br,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Sr=xr(),Cr=new class extends Un{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function wr(e){return Math.min(1e3*2**e,3e4)}function Tr(e){return(e??`online`)!==`online`||Cr.isOnline()}var Er=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Dr(e){let t=!1,n=0,r,i=yr(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Er(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>Wn.isFocused()&&(e.networkMode===`always`||Cr.isOnline())&&e.canRun(),u=()=>Tr(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(vr.isServer()?0:3),o=e.retryDelay??wr,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),ur(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Or=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Yn(this.gcTime)&&(this.#e=Gn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(vr.isServer()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Gn.clearTimeout(this.#e),this.#e=void 0)}};function kr(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{_r(e,()=>t.signal,()=>n=!0)},u=hr(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?pr:fr;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?jr:Ar,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ar(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Ar(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function jr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Mr=class extends Or{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Fr(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Fr(this.options);e.data!==void 0&&(this.setState(Pr(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=dr(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(qn).catch(qn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Qn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===mr||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Zn(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Xn(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=hr(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?kr(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=Dr({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Er&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Er){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Nr(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Pr(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Sr.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Nr(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Tr(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Pr(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Fr(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Ir=class extends Un{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=yr(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Rr(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return zr(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return zr(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Qn(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!or(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Br(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Qn(this.options.enabled,this.#t)!==Qn(t.enabled,this.#t)||Zn(this.options.staleTime,this.#t)!==Zn(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Qn(this.options.enabled,this.#t)!==Qn(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Hr(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(qn)),t}#g(){this.#b();let e=Zn(this.options.staleTime,this.#t);if(vr.isServer()||this.#r.isStale||!Yn(e))return;let t=Xn(this.#r.dataUpdatedAt,e)+1;this.#d=Gn.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(vr.isServer()||Qn(this.options.enabled,this.#t)===!1||!Yn(this.#p)||this.#p===0)&&(this.#f=Gn.setInterval(()=>{(this.options.refetchIntervalInBackground||Wn.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(Gn.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(Gn.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Rr(e,t),o=i&&Br(e,n,t,r);(a||o)&&(l={...l,...Nr(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=dr(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=dr(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Vr(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Qn(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=yr();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a()}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!or(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){Sr.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Lr(e,t){return Qn(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Qn(t.retryOnMount,e)!==!1)}function Rr(e,t){return Lr(e,t)||e.state.data!==void 0&&zr(e,t,t.refetchOnMount)}function zr(e,t,n){if(Qn(t.enabled,e)!==!1&&Zn(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Vr(e,t)}return!1}function Br(e,t,n,r){return(e!==t||Qn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Vr(e,n)}function Vr(e,t){return Qn(t.enabled,e)!==!1&&e.isStaleByTime(Zn(t.staleTime,e))}function Hr(e,t){return!or(e.getCurrentResult(),t)}var Ur=class extends Or{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Wr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Dr({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Sr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Wr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Gr=class extends Un{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Ur({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Kr(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Kr(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Kr(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Kr(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Sr.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>er(t,e))}findAll(e={}){return this.getAll().filter(t=>er(e,t))}notify(e){Sr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Sr.batch(()=>Promise.all(e.map(e=>e.continue().catch(qn))))}};function Kr(e){return e.options.scope?.id}var qr=class extends Un{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),or(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&nr(t.mutationKey)!==nr(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Wr();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){Sr.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Jr=class extends Un{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??tr(r,t),a=this.get(i);return a||(a=new Mr({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Sr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>$n(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>$n(e,t)):t}notify(e){Sr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Sr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Sr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Yr=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Jr,this.#t=e.mutationCache||new Gr,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Wn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Cr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Zn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Jn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Sr.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Sr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Sr.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Sr.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(qn).catch(qn)}invalidateQueries(e,t={}){return Sr.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Sr.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(qn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(qn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Zn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(qn).catch(qn)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(qn).catch(qn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Cr.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(nr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{rr(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(nr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{rr(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=tr(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===mr&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Xr=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),w=o(((e,t)=>{t.exports=Xr()}))(),Zr=S.createContext(void 0),Qr=e=>{let t=S.useContext(Zr);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},$r=({client:e,children:t})=>(S.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,w.jsx)(Zr.Provider,{value:e,children:t})),ei=S.createContext(!1),ti=()=>S.useContext(ei);ei.Provider;function ni(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ri=S.createContext(ni()),ii=()=>S.useContext(ri),ai=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?gr(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},oi=e=>{S.useEffect(()=>{e.clearReset()},[e])},si=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||gr(n,[e.error,r])),ci=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},li=(e,t)=>e.isLoading&&e.isFetching&&!t,ui=(e,t)=>e?.suspense&&t.isPending,di=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function lee(e,t,n){let r=ti(),i=ii(),a=Qr(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,ci(o),ai(o,i,s),oi(i);let l=!a.getQueryCache().get(o.queryHash),[u]=S.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(S.useSyncExternalStore(S.useCallback(e=>{let t=f?u.subscribe(Sr.batchCalls(e)):qn;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),S.useEffect(()=>{u.setOptions(o)},[o,u]),ui(o,d))throw di(o,u,i);if(si({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!vr.isServer()&&li(d,r)&&(l?di(o,u,i):s?.promise)?.catch(qn).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function fi(e,t){return lee(e,Ir,t)}function pi(e,t){let n=Qr(t),[r]=S.useState(()=>new qr(n,e));S.useEffect(()=>{r.setOptions(e)},[r,e]);let i=S.useSyncExternalStore(S.useCallback(e=>r.subscribe(Sr.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=S.useCallback((e,t)=>{r.mutate(e,t).catch(qn)},[r]);if(i.error&&gr(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var mi=_(),hi=`data:image/svg+xml,%3csvg%20viewBox='0%200%20110%20110'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20transform='translate(55%2055)'%3e%3c!--%20Subtle%20outer%20boundary%20--%3e%3ccircle%20r='54'%20fill='none'%20stroke='%230F766E'%20opacity='.10'%3e%3c/circle%3e%3c!--%20Main%20circular%20sweep%20--%3e%3cpath%20d='M-42.5-11.5%20A44%2044%200%201%200%2042.5-11.5'%20fill='none'%20stroke='%232DD4BF'%20stroke-width='7.5'%20stroke-linecap='round'%3e%3c/path%3e%3c!--%20Upper-left%20secondary%20arc,%20separated%20from%20main%20sweep%20--%3e%3cpath%20d='M-36-25.2%20A44%2044%200%200%201-25.2-36'%20fill='none'%20stroke='%235EEAD4'%20stroke-width='7.5'%20stroke-linecap='round'%3e%3c/path%3e%3c!--%20Upper-right%20secondary%20arc,%20separated%20from%20main%20sweep%20--%3e%3cpath%20d='M25.2-36%20A44%2044%200%200%201%2036-25.2'%20fill='none'%20stroke='%235EEAD4'%20stroke-width='7.5'%20stroke-linecap='round'%3e%3c/path%3e%3c!--%20Subtle%20signal%20rings%20--%3e%3ccircle%20r='25'%20fill='%232DD4BF'%20opacity='.08'%3e%3c/circle%3e%3ccircle%20r='11'%20fill='%232DD4BF'%20opacity='.25'%3e%3c/circle%3e%3c!--%20Tall%20central%20wake%20--%3e%3cpath%20d='M-18%2023%20C-9%2022%20-8%202%200-2%20C8%202%209%2022%2018%2023'%20fill='none'%20stroke='%232DD4BF'%20stroke-width='5'%20stroke-linecap='round'%20stroke-linejoin='round'%3e%3c/path%3e%3c/g%3e%3c/svg%3e`,gi;function _i(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var vi=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},yi=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(gi=globalThis).__zod_globalConfig??(gi.__zod_globalConfig={});var bi=globalThis.__zod_globalConfig;function xi(e){return e&&Object.assign(bi,e),bi}function Si(e,t){return typeof t==`bigint`?t.toString():t}function Ci(e){return e==null}function wi(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var Ti=Symbol(`evaluating`);function Ei(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ti)return r===void 0&&(r=Ti,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Di(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}var Oi=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ki(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ai(e){if(ki(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ki(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ji(e){return Ai(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Mi(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Ni(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}-Number.MAX_VALUE,Number.MAX_VALUE;function Pi(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 Fi(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 Ii(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Li(e){return typeof e==`string`?e:e?.message}function Ri(e,t,n){let r=e.message?e.message:Li(e.inst?._zod.def?.error?.(e))??Li(t?.error?.(e))??Li(n.customError?.(e))??Li(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function zi(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Bi(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Vi=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Si,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Hi=_i(`$ZodError`,Vi),Ui=_i(`$ZodError`,Vi,{Parent:Error});function Wi(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Gi(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];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Ki=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new vi;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ri(e,a,xi())));throw Oi(t,i?.callee),t}return o.value},qi=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ri(e,a,xi())));throw Oi(t,i?.callee),t}return o.value},Ji=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 vi;return a.issues.length?{success:!1,error:new(e??Hi)(a.issues.map(e=>Ri(e,i,xi())))}:{success:!0,data:a.value}},Yi=Ji(Ui),Xi=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?{success:!1,error:new e(a.issues.map(e=>Ri(e,i,xi())))}:{success:!0,data:a.value}},Zi=Xi(Ui),Qi=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ki(e)(t,n,i)},$i=e=>(t,n,r)=>Ki(e)(t,n,r),ea=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qi(e)(t,n,i)},ta=e=>async(t,n,r)=>qi(e)(t,n,r),na=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ji(e)(t,n,i)},ra=e=>(t,n,r)=>Ji(e)(t,n,r),ia=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Xi(e)(t,n,i)},aa=e=>async(t,n,r)=>Xi(e)(t,n,r),oa=_i(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),sa=_i(`$ZodCheckMaxLength`,(e,t)=>{var n;oa.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ci(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=zi(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ca=_i(`$ZodCheckMinLength`,(e,t)=>{var n;oa.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ci(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=zi(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),la=_i(`$ZodCheckLengthEquals`,(e,t)=>{var n;oa.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ci(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=zi(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ua=_i(`$ZodCheckOverwrite`,(e,t)=>{oa.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),da={major:4,minor:4,patch:3},fa=_i(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=da;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Pi(e),i;for(let a of t){if(a._zod.def.when){if(Fi(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new vi;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Pi(e,t))});else{if(e.issues.length===t)continue;r||=Pi(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Pi(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new vi;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new vi;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Ei(e,`~standard`,()=>({validate:t=>{try{let n=Yi(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Zi(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))});function pa(e,t,n){e.issues.length&&t.issues.push(...Ii(n,e.issues)),t.value[n]=e.value}var ma=_i(`$ZodArray`,(e,t)=>{fa.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>pa(t,n,e))):pa(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function ha(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=>!Pi(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=>Ri(e,r,xi())))}),t)}var ga=_i(`$ZodUnion`,(e,t)=>{fa.init(e,t),Ei(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Ei(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Ei(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Ei(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>wi(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=>ha(t,r,e,i)):ha(o,r,e,i)}}),_a=_i(`$ZodIntersection`,(e,t)=>{fa.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])=>ya(e,t,n)):ya(e,i,a)}});function va(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ai(e)&&Ai(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=va(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=va(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 ya(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Pi(e))return e;let o=va(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var ba=_i(`$ZodTransform`,(e,t)=>{fa.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new yi(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.fallback=!0,n));if(i instanceof Promise)throw new vi;return n.value=i,n.fallback=!0,n}});function xa(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Sa=_i(`$ZodOptional`,(e,t)=>{fa.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Ei(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ei(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${wi(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>xa(e,r)):xa(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Ca=_i(`$ZodExactOptional`,(e,t)=>{Sa.init(e,t),Ei(e._zod,`values`,()=>t.innerType._zod.values),Ei(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),wa=_i(`$ZodNullable`,(e,t)=>{fa.init(e,t),Ei(e._zod,`optin`,()=>t.innerType._zod.optin),Ei(e._zod,`optout`,()=>t.innerType._zod.optout),Ei(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${wi(e.source)}|null)$`):void 0}),Ei(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ta=_i(`$ZodDefault`,(e,t)=>{fa.init(e,t),e._zod.optin=`optional`,Ei(e._zod,`values`,()=>t.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=>Ea(e,t)):Ea(r,t)}});function Ea(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Da=_i(`$ZodPrefault`,(e,t)=>{fa.init(e,t),e._zod.optin=`optional`,Ei(e._zod,`values`,()=>t.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))}),Oa=_i(`$ZodNonOptional`,(e,t)=>{fa.init(e,t),Ei(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].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=>ka(t,e)):ka(i,e)}});function ka(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Aa=_i(`$ZodCatch`,(e,t)=>{fa.init(e,t),e._zod.optin=`optional`,Ei(e._zod,`optout`,()=>t.innerType._zod.optout),Ei(e._zod,`values`,()=>t.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(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ri(e,n,xi()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ri(e,n,xi()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),ja=_i(`$ZodPipe`,(e,t)=>{fa.init(e,t),Ei(e._zod,`values`,()=>t.in._zod.values),Ei(e._zod,`optin`,()=>t.in._zod.optin),Ei(e._zod,`optout`,()=>t.out._zod.optout),Ei(e._zod,`propValues`,()=>t.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=>Ma(e,t.in,n)):Ma(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ma(e,t.out,n)):Ma(r,t.out,n)}});function Ma(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Na=_i(`$ZodReadonly`,(e,t)=>{fa.init(e,t),Ei(e._zod,`propValues`,()=>t.innerType._zod.propValues),Ei(e._zod,`values`,()=>t.innerType._zod.values),Ei(e._zod,`optin`,()=>t.innerType?._zod?.optin),Ei(e._zod,`optout`,()=>t.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(Pa):Pa(r)}});function Pa(e){return e.value=Object.freeze(e.value),e}var Fa=_i(`$ZodCustom`,(e,t)=>{oa.init(e,t),fa.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=>Ia(t,n,r,e));Ia(i,n,r,e)}});function Ia(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(Bi(e))}}var La,Ra=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 za(){return new Ra}(La=globalThis).__zod_globalRegistry??(La.__zod_globalRegistry=za());var Ba=globalThis.__zod_globalRegistry;function Va(e,t){return new sa({check:`max_length`,...Ni(t),maximum:e})}function Ha(e,t){return new ca({check:`min_length`,...Ni(t),minimum:e})}function Ua(e,t){return new la({check:`length_equals`,...Ni(t),length:e})}function Wa(e){return new ua({check:`overwrite`,tx:e})}function Ga(e,t,n){return new e({type:`array`,element:t,...Ni(n)})}function Ka(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Ni(n)})}function qa(e,t){let n=Ja(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Bi(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Bi(r))}},e(t.value,t)),t);return n}function Ja(e,t){let n=new oa({check:`custom`,...Ni(t)});return n._zod.check=e,n}function Ya(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??Ba,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Xa(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);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,Xa(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&$a(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 Za(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);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}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+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>
12
12
 
13
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Qa(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)):Object.assign(i,s),Object.assign(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??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);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)}Object.assign(i,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??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}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:to(t,`input`,e.processors),output:to(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function $a(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 $a(r.element,n);if(r.type===`set`)return $a(r.valueType,n);if(r.type===`lazy`)return $a(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`)return $a(r.innerType,n);if(r.type===`intersection`)return $a(r.left,n)||$a(r.right,n);if(r.type===`record`||r.type===`map`)return $a(r.keyType,n)||$a(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:$a(r.in,n)||$a(r.out,n);if(r.type===`object`){for(let e in r.shape)if($a(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if($a(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if($a(e,n))return!0;return!!(r.rest&&$a(r.rest,n))}return!1}var eo=(e,t={})=>n=>{let r=Ya({...n,processors:t});return Xa(e,r),Za(r,e),Qa(r,e)},to=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ya({...i??{},target:a,io:t,processors:n});return Xa(e,o),Za(o,e),Qa(o,e)},no=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ro=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},io=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Xa(a.element,t,{...r,path:[...r.path,`items`]})},ao=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Xa(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},oo=(e,t,n,r)=>{let i=e._zod.def,a=Xa(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Xa(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},so=(e,t,n,r)=>{let i=e._zod.def,a=Xa(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`}]},co=(e,t,n,r)=>{let i=e._zod.def;Xa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},lo=(e,t,n,r)=>{let i=e._zod.def;Xa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},uo=(e,t,n,r)=>{let i=e._zod.def;Xa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},fo=(e,t,n,r)=>{let i=e._zod.def;Xa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},po=(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;Xa(o,t,r);let s=t.seen.get(e);s.ref=o},mo=(e,t,n,r)=>{let i=e._zod.def;Xa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ho=(e,t,n,r)=>{let i=e._zod.def;Xa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},go=_i(`ZodError`,(e,t)=>{Hi.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Gi(e,t)},flatten:{value:t=>Wi(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Si,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Si,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),_o=Ki(go),vo=qi(go),yo=Ji(go),bo=Xi(go),xo=Qi(go),So=$i(go),Co=ea(go),wo=ta(go),To=na(go),Eo=ra(go),Do=ia(go),Oo=aa(go),ko=new WeakMap;function Ao(e,t,n){let r=Object.getPrototypeOf(e),i=ko.get(r);if(i||(i=new Set,ko.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var jo=_i(`ZodType`,(e,t)=>(fa.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:to(e,`input`),output:to(e,`output`)}}),e.toJSONSchema=eo(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>_o(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>yo(e,t,n),e.parseAsync=async(t,n)=>vo(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>bo(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>xo(e,t,n),e.decode=(t,n)=>So(e,t,n),e.encodeAsync=async(t,n)=>Co(e,t,n),e.decodeAsync=async(t,n)=>wo(e,t,n),e.safeEncode=(t,n)=>To(e,t,n),e.safeDecode=(t,n)=>Eo(e,t,n),e.safeEncodeAsync=async(t,n)=>Do(e,t,n),e.safeDecodeAsync=async(t,n)=>Oo(e,t,n),Ao(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Di(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 Mi(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(as(e,t))},superRefine(e,t){return this.check(os(e,t))},overwrite(e){return this.check(Wa(e))},optional(){return Vo(this)},exactOptional(){return Uo(this)},nullable(){return Go(this)},nullish(){return Vo(Go(this))},nonoptional(e){return Zo(this,e)},array(){return No(this)},or(e){return Fo([this,e])},and(e){return Lo(this,e)},transform(e){return ts(this,zo(e))},default(e){return qo(this,e)},prefault(e){return Yo(this,e)},catch(e){return $o(this,e)},pipe(e){return ts(this,e)},readonly(){return rs(this)},describe(e){let t=this.clone();return Ba.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ba.get(this);let t=this.clone();return Ba.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Ba.get(e)?.description},configurable:!0}),e)),Mo=_i(`ZodArray`,(e,t)=>{ma.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e.element=t.element,Ao(e,`ZodArray`,{min(e,t){return this.check(Ha(e,t))},nonempty(e){return this.check(Ha(1,e))},max(e,t){return this.check(Va(e,t))},length(e,t){return this.check(Ua(e,t))},unwrap(){return this.element}})});function No(e,t){return Ga(Mo,e,t)}var Po=_i(`ZodUnion`,(e,t)=>{ga.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.options=t.options});function Fo(e,t){return new Po({type:`union`,options:e,...Ni(t)})}var Io=_i(`ZodIntersection`,(e,t)=>{_a.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r)});function Lo(e,t){return new Io({type:`intersection`,left:e,right:t})}var Ro=_i(`ZodTransform`,(e,t)=>{ba.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new yi(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Bi(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Bi(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function zo(e){return new Ro({type:`transform`,transform:e})}var Bo=_i(`ZodOptional`,(e,t)=>{Sa.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vo(e){return new Bo({type:`optional`,innerType:e})}var Ho=_i(`ZodExactOptional`,(e,t)=>{Ca.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Uo(e){return new Ho({type:`optional`,innerType:e})}var Wo=_i(`ZodNullable`,(e,t)=>{wa.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Go(e){return new Wo({type:`nullable`,innerType:e})}var Ko=_i(`ZodDefault`,(e,t)=>{Ta.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function qo(e,t){return new Ko({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ji(t)}})}var Jo=_i(`ZodPrefault`,(e,t)=>{Da.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yo(e,t){return new Jo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ji(t)}})}var Xo=_i(`ZodNonOptional`,(e,t)=>{Oa.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Zo(e,t){return new Xo({type:`nonoptional`,innerType:e,...Ni(t)})}var Qo=_i(`ZodCatch`,(e,t)=>{Aa.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function $o(e,t){return new Qo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var es=_i(`ZodPipe`,(e,t)=>{ja.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.in=t.in,e.out=t.out});function ts(e,t){return new es({type:`pipe`,in:e,out:t})}var ns=_i(`ZodReadonly`,(e,t)=>{Na.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rs(e){return new ns({type:`readonly`,innerType:e})}var is=_i(`ZodCustom`,(e,t)=>{Fa.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r)});function as(e,t={}){return Ka(is,e,t)}function os(e,t){return qa(e,t)}var ss=e=>e,cs=Object.keys({accepted:!0,completed:!0}),ls={Accepted:cs[0],Completed:cs[1]},us={Active:Object.keys({active:!0})[0]},ds={Adapter:Object.keys({adapter:!0})[0]},fs=Object.keys({failed:!0,succeeded:!0}),ps={Failed:fs[0],Succeeded:fs[1]},ms=Object.keys({starting:!0,started:!0}),hs={Starting:ms[0],Started:ms[1]},gs=ss({Waiting:`waiting`,Done:`done`,Rejected:`rejected`,Blocked:`blocked`,Failed:`failed`}),_s=Object.keys({ready:!0,active:!0,"needs-input":!0,error:!0,finished:!0}),vs={Ready:_s[0],Active:_s[1],NeedsInput:_s[2],Error:_s[3],Finished:_s[4]};Object.keys({stage:!0})[0];var ys=Object.keys({input:!0,agent:!0}),bs={Input:ys[0],Agent:ys[1]},xs=Object.keys({session:!0,run:!0}),Ss={Session:xs[0],Run:xs[1]},Cs=vs,ws=ss({Unknown:`unknown`}),Ts=Object.keys({activity:!0,watch:!0,"watch-gate":!0,reactor:!0}),Es={Activity:Ts[0],Watch:Ts[1],WatchGate:Ts[2],Reactor:Ts[3]};function Ds(e,t){let n=Os(e,t);return{asOf:As(n.asOf,Rs(t,`asOf`)),...Fs(n,`position`,t)}}function Os(e,t){return Bs(e)||zs(t),e}function ks(e,t,n){return Array.isArray(e)||zs(t),e.map((e,r)=>n(e,`${t}[${r}]`))}function As(e,t=``){return typeof e!=`string`&&zs(t),e}function js(e,t){return e===null?null:As(e,t)}function Ms(e,t){return typeof e!=`boolean`&&zs(t),e}function Ns(e,t){return(typeof e!=`number`||!Number.isFinite(e))&&zs(t),e}function Ps(e,t,n){return e[t]===void 0?{}:{[t]:As(e[t],Rs(n,t))}}function Fs(e,t,n){return e[t]===void 0?{}:{[t]:Ns(e[t],Rs(n,t))}}function Is(e,t,n){return e[t]===void 0?{}:{[t]:Ms(e[t],Rs(n,t))}}function Ls(e,t){if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e))return e;if(Array.isArray(e))return e.map((e,n)=>Ls(e,`${t}[${n}]`));let n=Os(e,t);return Object.fromEntries(Object.entries(n).map(([e,n])=>[e,Ls(n,Rs(t,e))]))}function Rs(e,t){return e===``?t:`${e}.${t}`}function zs(e){throw Error(`Invalid Wake API response at ${e===``?`root`:e}`)}function Bs(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Vs=Object.keys({stage:!0})[0];function Hs(e){return(t,n=``)=>{let r=Os(t,n);return{data:e(r.data,Rs(n,`data`)),meta:Ds(r.meta,Rs(n,`meta`))}}}function Us(e){return(t,n=``)=>{let r=Os(t,n),i=Os(r.page,Rs(n,`page`));return{items:ks(r.items,Rs(n,`items`),e),page:{nextCursor:js(i.nextCursor,Rs(n,`page.nextCursor`)),hasMore:Ms(i.hasMore,Rs(n,`page.hasMore`)),...Fs(i,`total`,Rs(n,`page`))},meta:Ds(r.meta,Rs(n,`meta`))}}}var Ws=(e,t=``)=>{let n=Os(e,t);return{dispatchPaused:Ms(n.dispatchPaused,Rs(t,`dispatchPaused`)),...Ps(n,`dispatchPausedUntil`,t),...Ps(n,`dispatchPauseReason`,t),updatedAt:As(n.updatedAt,Rs(t,`updatedAt`)),...n.maintenanceLease===void 0?{}:{maintenanceLease:Gs(n.maintenanceLease,Rs(t,`maintenanceLease`))}}};function Gs(e,t){let n=Os(e,t);return{attemptId:As(n.attemptId,Rs(t,`attemptId`)),phase:As(n.phase,Rs(t,`phase`)),startedAt:As(n.startedAt,Rs(t,`startedAt`)),...Ps(n,`failure`,t)}}var Ks=(e,t=``)=>{let n=Os(e,t),r=As(n.status,Rs(t,`status`));return r!==ls.Accepted&&r!==ls.Completed&&zs(Rs(t,`status`)),{commandId:As(n.commandId,Rs(t,`commandId`)),idempotencyKey:As(n.idempotencyKey,Rs(t,`idempotencyKey`)),acceptedAt:As(n.acceptedAt,Rs(t,`acceptedAt`)),status:r}},qs=(e,t=``)=>{let n=Os(e,t);return{workItemKey:As(n.workItemKey,Rs(t,`workItemKey`)),workItemId:As(n.workItemId,Rs(t,`workItemId`)),objective:As(n.objective,Rs(t,`objective`)),state:As(n.state,Rs(t,`state`)),...Is(n,`frozen`,t),...Is(n,`deleted`,t),...Ps(n,`externalRef`,t),...Ps(n,`lastRunOutcome`,t),relatedWorkItems:ks(n.relatedWorkItems,Rs(t,`relatedWorkItems`),(e,t=``)=>{let n=Os(e,t);return{workItemKey:As(n.workItemKey,Rs(t??``,`workItemKey`)),relation:As(n.relation,Rs(t??``,`relation`))}})}},Js=(e,t=``)=>{let n=Os(e,t);return{workItemKey:As(n.workItemKey,Rs(t,`workItemKey`)),workItemId:As(n.workItemId,Rs(t,`workItemId`)),objective:As(n.objective,Rs(t,`objective`)),condition:As(n.condition,Rs(t,`condition`)),...Is(n,`frozen`,t),...Is(n,`awaitingApproval`,t),...Is(n,`extendEligible`,t),...Ps(n,`workflowName`,t),...Ps(n,Vs,t),...Ps(n,`blockReason`,t),dwellSince:As(n.dwellSince,Rs(t,`dwellSince`)),runCount:Ns(n.runCount,Rs(t,`runCount`)),...Ps(n,`lastRunAt`,t),...Ps(n,`lastRunOutcome`,t),...Fs(n,`lastRunAgeMs`,t),totalTokens:Ns(n.totalTokens,Rs(t,`totalTokens`)),...Fs(n,`inputTokens`,t),...Fs(n,`outputTokens`,t),...Fs(n,`cacheReadTokens`,t),...Fs(n,`cacheWriteTokens`,t),totalCostUsd:Ns(n.totalCostUsd,Rs(t,`totalCostUsd`)),totalDurationMs:Ns(n.totalDurationMs,Rs(t,`totalDurationMs`)),activeRuns:Ys(n.activeRuns,Rs(t,`activeRuns`)),...Ps(n,`externalRef`,t)}};function Ys(e,t){return e===void 0?{}:Object.fromEntries(Object.entries(Os(e,t)).map(([e,n])=>[e,Xs(n,Rs(t,e))]))}function Xs(e,t){let n=Os(e,t),r=As(n.phase,Rs(t,`phase`));return Object.values(hs).includes(r)||zs(Rs(t,`phase`)),{action:As(n.action,Rs(t,`action`)),startedAt:As(n.startedAt,Rs(t,`startedAt`)),elapsedMs:Ns(n.elapsedMs,Rs(t,`elapsedMs`)),phase:r,...Ps(n,`runnerName`,t)}}var Zs=(e,t=``)=>{let n=Os(e,t);return{resourceId:As(n.resourceId,Rs(t,`resourceId`)),adapter:As(n[ds.Adapter],Rs(t,ds.Adapter)),kind:As(n.kind,Rs(t,`kind`)),locatorLabel:As(n.locatorLabel,Rs(t,`locatorLabel`)),capabilities:ks(n.capabilities,Rs(t,`capabilities`),As),...Ps(n,`title`,t),...Ps(n,`externalUrl`,t),...Ps(n,`revision`,t)}},Qs=(e,t=``)=>{let n=Os(e,t),r=n.waitingFor;return{workflowInstanceId:As(n.workflowInstanceId,Rs(t,`workflowInstanceId`)),workItemKey:As(n.workItemKey,Rs(t,`workItemKey`)),workflowName:As(n.workflowName,Rs(t,`workflowName`)),orchestrationGroupId:As(n.orchestrationGroupId,Rs(t,`orchestrationGroupId`)),...Ps(n,`parentWorkflowInstanceId`,t),status:As(n.status,Rs(t,`status`)),currentStage:As(n.currentStage,Rs(t,`currentStage`)),...Ps(n,`blockReason`,t),...Is(n,`retryEligible`,t),...Is(n,`extendEligible`,t),...r===void 0?{}:{waitingFor:{signalKind:As(Os(r,Rs(t,`waitingFor`)).signalKind,Rs(t,`waitingFor.signalKind`))}}}},$s=(e,t=``)=>({diagrams:ks(Os(e,t).diagrams,Rs(t,`diagrams`),ec)});function ec(e,t=``){let n=Os(e,t);return{id:As(n.id,Rs(t,`id`)),label:As(n.label,Rs(t,`label`)),direction:`left-to-right`,stages:ks(n.stages,Rs(t,`stages`),(e,t=``)=>{let n=Os(e,t);return{id:As(n.id,Rs(t,`id`)),label:As(n.label,Rs(t,`label`)),children:ks(n.children,Rs(t,`children`),(e,t=``)=>{let n=Os(e,t);return{id:As(n.id,Rs(t,`id`)),label:As(n.label,Rs(t,`label`)),kind:tc(n.kind,Rs(t,`kind`)),...nc(n,t)}}),...nc(n,t)}}),transitions:ks(n.transitions,Rs(t,`transitions`),(e,t=``)=>{let n=Os(e,t);return{from:As(n.from,Rs(t,`from`)),to:As(n.to,Rs(t,`to`)),label:As(n.label,Rs(t,`label`)),...Ps(n,`fromChildId`,t)}})}}function tc(e,t){let n=As(e,t);return Object.values(Es).includes(n)||zs(t),n}function nc(e,t){let n=e.activeRuns;return{...Ps(e,`status`,t),...Ps(e,`lastOutcome`,t),...Fs(e,`runCount`,t),...Fs(e,`totalDurationMs`,t),...Fs(e,`totalTokens`,t),...Fs(e,`inputTokens`,t),...Fs(e,`outputTokens`,t),...Fs(e,`cacheReadTokens`,t),...Fs(e,`cacheWriteTokens`,t),...Fs(e,`totalCostUsd`,t),...n===void 0?{}:{activeRuns:ks(n,Rs(t,`activeRuns`),(e,t=``)=>{let n=Os(e,t);return{runId:As(n.runId,Rs(t,`runId`)),activity:As(n.activity,Rs(t,`activity`)),startedAt:As(n.startedAt,Rs(t,`startedAt`)),...Ps(n,`runnerName`,t)}})}}}var rc=[`DONE`,`FAILED`,`AMBIGUOUS`];function ic(e,t){let n=Rs(t,`resolution`),r=Os(e,n),i=As(r.sentinel,Rs(n,`sentinel`));return rc.includes(i)||zs(Rs(n,`sentinel`)),{sentinel:i,resolvedAt:As(r.resolvedAt,Rs(n,`resolvedAt`))}}var ac=(e,t=``)=>{let n=Os(e,t),r=n.failure,i=n.resolution;return{runId:As(n.runId,Rs(t,`runId`)),activationId:As(n.activationId,Rs(t,`activationId`)),activity:As(n.activity,Rs(t,`activity`)),workflowInstanceId:As(n.workflowInstanceId,Rs(t,`workflowInstanceId`)),orchestrationGroupId:As(n.orchestrationGroupId,Rs(t,`orchestrationGroupId`)),attempt:Ns(n.attempt,Rs(t,`attempt`)),status:As(n.status,Rs(t,`status`)),active:Ms(n.active,Rs(t,us.Active)),startedAt:As(n.startedAt,Rs(t,`startedAt`)),...Ps(n,`executionStartedAt`,t),...Ps(n,`finishedAt`,t),sentinel:As(n.sentinel,Rs(t,`sentinel`)),...Ps(n,`runnerName`,t),...Ps(n,`runnerModel`,t),...Ps(n,`workflowName`,t),...Ps(n,Vs,t),totalTokens:Ns(n.totalTokens,Rs(t,`totalTokens`)),...Fs(n,`inputTokens`,t),...Fs(n,`outputTokens`,t),...Fs(n,`cacheReadTokens`,t),...Fs(n,`cacheWriteTokens`,t),totalCostUsd:Ns(n.totalCostUsd,Rs(t,`totalCostUsd`)),...n.outcome===void 0?{}:{outcome:Ls(n.outcome,Rs(t,`outcome`))},...r===void 0?{}:{failure:{kind:As(Os(r,Rs(t,`failure`)).kind,Rs(t,`failure.kind`))}},...i===void 0?{}:{resolution:ic(i,t)}}},oc=(e,t=``)=>{let n=Object.keys({conversation:!0})[0],r=Object.keys({stage:!0})[0],i=Os(e,t),a=Os(i.orchestration,Rs(t,`orchestration`)),o=Os(i.execution,Rs(t,`execution`)),s=Os(i.activities,Rs(t,`activities`)),c=i.conversation===void 0?void 0:Os(i.conversation,Rs(t,n));return{work:qs(i.work,Rs(t,`work`)),resources:ks(i.resources,Rs(t,`resources`),Zs),orchestration:{primary:a.primary===null?null:Qs(a.primary,Rs(t,`orchestration.primary`)),children:ks(a.children,Rs(t,`orchestration.children`),Qs),diagram:fc(a.diagram,Rs(t,`orchestration.diagram`))},execution:{runs:ks(o.runs,Rs(t,`execution.runs`),ac),transcriptGroups:ks(o.transcriptGroups,Rs(t,`execution.transcriptGroups`),(e,t=``)=>{let n=Os(e,t);return{groupId:As(n.groupId,Rs(t,`groupId`)),kind:mc(n.kind,Rs(t,`kind`)),...Ps(n,`cli`,t),latestAt:As(n.latestAt,Rs(t,`latestAt`)),runIds:ks(n.runIds,Rs(t,`runIds`),As)}})},activities:s.pullRequest===void 0?{}:{pullRequest:hc(s.pullRequest,Rs(t,`activities.pullRequest`))},conversation:{canCreateEntries:c?.canCreateEntries===!0,entries:c===void 0?[]:ks(c.entries,Rs(t,`${n}.entries`),(e,t=``)=>{let n=Os(e,t);return{entryId:As(n.entryId,Rs(t,`entryId`)),body:As(n.body,Rs(t,`body`)),occurredAt:As(n.occurredAt,Rs(t,`occurredAt`)),origin:As(n.origin,Rs(t,`origin`)),actorId:As(n.actorId,Rs(t,`actorId`)),...Ps(n,`runId`,t),...Ps(n,r,t),...Ps(n,`sourceAdapter`,t),...Ps(n,`sourceResourceId`,t),...Ps(n,`sourceThreadId`,t),deleted:Ms(n.deleted,Rs(t,`deleted`)),representations:ks(n.representations,Rs(t,`representations`),(e,t=``)=>{let n=Os(e,t);return{resourceId:As(n.resourceId,Rs(t,`resourceId`)),externalId:As(n.externalId,Rs(t,`externalId`))}})}})}}},sc=(e,t=``)=>{let n=Os(e,t),r=n.stream;return{id:As(n.id,Rs(t,`id`)),type:As(n.type,Rs(t,`type`)),occurredAt:As(n.occurredAt,Rs(t,`occurredAt`)),position:Ns(n.position,Rs(t,`position`)),...r===void 0?{}:{stream:{kind:As(Os(r,Rs(t,`stream`)).kind,Rs(t,`stream.kind`)),id:As(Os(r,Rs(t,`stream`)).id,Rs(t,`stream.id`))}},...Ps(n,`causationId`,t),...Ps(n,`correlationId`,t),payload:n.payload}},cc=(e,t=``)=>{let n=Os(e,t);return{runnerId:As(n.runnerId,Rs(t,`runnerId`)),status:As(n.status,Rs(t,`status`)),available:Ms(n.available,Rs(t,`available`)),...Ps(n,`detail`,t),updatedAt:As(n.updatedAt,Rs(t,`updatedAt`))}},lc=(e,t=``)=>{let n=Os(e,t);return{runId:As(n.runId,Rs(t,`runId`)),...Ps(n,`groupId`,t),available:Ms(n.available,Rs(t,`available`)),entries:ks(n.entries,Rs(t,`entries`),(e,t=``)=>{let n=Os(e,t);return{occurredAt:As(n.occurredAt,Rs(t,`occurredAt`)),channel:pc(n.channel,Rs(t,`channel`)),text:As(n.text,Rs(t,`text`)),runId:As(n.runId,Rs(t,`runId`)),groupId:As(n.groupId,Rs(t,`groupId`)),...Fs(n,`durationMs`,t)}})}},uc=(e,t=``)=>{let n=Os(e,t);return{groupId:As(n.groupId,Rs(t,`groupId`)),available:Ms(n.available,Rs(t,`available`)),entries:ks(n.entries,Rs(t,`entries`),dc)}};function dc(e,t=``){let n=Os(e,t);return{occurredAt:As(n.occurredAt,Rs(t,`occurredAt`)),channel:pc(n.channel,Rs(t,`channel`)),text:As(n.text,Rs(t,`text`)),runId:As(n.runId,Rs(t,`runId`)),groupId:As(n.groupId,Rs(t,`groupId`)),...Fs(n,`durationMs`,t)}}function fc(e,t){return{href:As(Os(e,t).href,Rs(t,`href`))}}function pc(e,t){let n=As(e,t);return n!==bs.Input&&n!==bs.Agent&&zs(t),n}function mc(e,t){let n=As(e,t);return n!==Ss.Session&&n!==Ss.Run&&zs(t),n}function hc(e,t=``){let n=Os(e,t);return{resourceId:As(n.resourceId,Rs(t,`resourceId`)),state:As(n.state,Rs(t,`state`)),...Is(n,`frozen`,t),...Is(n,`deleted`,t),headRevision:As(n.headRevision,Rs(t,`headRevision`)),baseRevision:As(n.baseRevision,Rs(t,`baseRevision`)),checks:As(n.checks,Rs(t,`checks`))}}var gc=(e,t=``)=>{let n=Os(e,t),r=Os(n.values,Rs(t,`values`));return{collectedAt:As(n.collectedAt,Rs(t,`collectedAt`)),window:_c(n.window,Rs(t,`window`)),values:Object.fromEntries(Object.entries(r).map(([e,n])=>[e,Ns(n,Rs(t,`values.${e}`))]))}};function _c(e,t){let n=Os(e,t);return{days:Ns(n.days,Rs(t,`days`)),from:As(n.from,Rs(t,`from`)),to:As(n.to,Rs(t,`to`))}}var vc=(e,t=``)=>{let n=Os(e,t);return{status:Sc(n.status,Rs(t,`status`)),version:As(n.version,Rs(t,`version`)),checkedAt:As(n.checkedAt,Rs(t,`checkedAt`)),...n.checks===void 0?{}:{checks:ks(n.checks,Rs(t,`checks`),(e,t=``)=>{let n=Os(e,t);return{name:As(n.name,Rs(t,`name`)),status:Sc(n.status,Rs(t,`status`)),...Ps(n,`detail`,t)}})},...n.adapters===void 0?{}:{adapters:ks(n.adapters,Rs(t,`adapters`),(e,t=``)=>{let n=Os(e,t);return{adapter:As(n.adapter,Rs(t,`adapterId`)),provider:As(n.provider,Rs(t,`provider`)),scope:As(n.scope,Rs(t,`scope`)),channel:As(n.channel,Rs(t,`channel`)),status:Cc(n.status,Rs(t,`status`)),successCount:Ns(n.successCount,Rs(t,`successCount`)),failureCount:Ns(n.failureCount,Rs(t,`failureCount`)),...Ps(n,`detail`,t)}})}}},yc=(e,t=``)=>{let n=Os(e,t),r=Rs(t,`configuration`);return{configuration:Os(Ls(n.configuration,r),r)}},bc=(e,t=``)=>({adapters:ks(Os(e,t).adapters,Rs(t,`adapters`),(e,t=``)=>{let n=Os(e,t);return{adapter:As(n.adapter,Rs(t,`adapterId`)),provider:As(n.provider,Rs(t,`provider`)),commands:ks(n.commands,Rs(t,`commands`),(e,t=``)=>({syntax:As(Os(e,t).syntax,Rs(t,`syntax`))}))}})}),xc=(e,t=``)=>({adapters:ks(Os(e,t).adapters,Rs(t,`adapters`),(e,t=``)=>{let n=Os(e,t);return{adapter:As(n.adapter,Rs(t,`adapter`)),provider:As(n.provider,Rs(t,`provider`)),hooks:ks(n.hooks,Rs(t,`hooks`),(e,t=``)=>{let n=Os(e,t);return{scope:As(n.scope,Rs(t,`scope`)),endpoint:As(n.endpoint,Rs(t,`endpoint`)),events:ks(n.events,Rs(t,`events`),As),secret:As(n.secret,Rs(t,`secret`))}})}})});function uee(e,t){try{let t=Os(e,`problem`);return{type:As(t.type,`problem.type`),title:As(t.title,`problem.title`),status:Ns(t.status,`problem.status`),...Ps(t,`detail`,`problem`),...Ps(t,`instance`,`problem`),...Ps(t,`code`,`problem`),...t.retryable===void 0?{}:{retryable:Ms(t.retryable,`problem.retryable`)},...t.current===void 0?{}:{current:Ls(t.current,`problem.current`)},...t.violations===void 0?{}:{violations:ks(t.violations,`problem.violations`,(e,t=``)=>{let n=Os(e,t);return{path:As(n.path,Rs(t,`path`)),message:As(n.message,Rs(t,`message`))}})}}}catch{return{type:`about:blank`,title:`Request failed`,status:t}}}function Sc(e,t){let n=As(e,t);return n!==`ok`&&n!==`degraded`&&zs(t),n}function Cc(e,t){let n=As(e,t);return n!==`ok`&&n!==`degraded`&&n!==ws.Unknown&&zs(t),n}var wc=class extends Error{constructor(e){super(e.title),this.problem=e,this.name=`ApiProblem`}},Tc=class{constructor(e=fetch,t=`/api/v1`){this.fetchImplementation=e,this.baseUrl=t,this.auth={session:async()=>{let e=this.fetchImplementation;return(await e(`${this.baseUrl}/auth/session`)).ok},login:async e=>{let t=this.fetchImplementation;return(await t(`${this.baseUrl}/auth/login`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({accessKey:e})})).ok},redeem:async e=>{let t=this.fetchImplementation;return(await t(`${this.baseUrl}/auth/redeem`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({grant:e})})).ok}},this.board={list:(e,t)=>this.get(`/board${Ec({cursor:e})}`,Us(Js),t)},this.status={get:e=>this.get(`/status`,Hs(e=>e),e)},this.controlPlane={status:e=>this.get(`/control-plane/status`,Hs(Ws),e),pauseDispatch:(e,t)=>this.command(`/control-plane/commands/pause-dispatch`,e,Ks,t),resumeDispatch:(e,t)=>this.command(`/control-plane/commands/resume-dispatch`,e,Ks,t),clearMaintenance:(e,t,n)=>this.request(`/control-plane/commands/clear-maintenance`,Hs(Ks),{method:`POST`,body:JSON.stringify({attemptId:e,idempotencyKey:t}),headers:{"content-type":`application/json`},...n===void 0?{}:{signal:n}})},this.work={list:(e={},t)=>this.get(`/work-items${Ec(e)}`,Us(qs),t),detail:(e,t)=>this.get(`/work-items/${encodeURIComponent(e)}`,Hs(oc),t),transcript:(e,t,n)=>this.get(`/work-items/${encodeURIComponent(e)}/transcripts/${encodeURIComponent(t)}`,Hs(uc),n),message:(e,t,n,r)=>this.request(`/work-items/${encodeURIComponent(e)}/commands/message`,Hs(Ks),{method:`POST`,body:JSON.stringify({idempotencyKey:n,body:t}),headers:{"content-type":`application/json`},...r===void 0?{}:{signal:r}}),command:(e,t,n,r)=>this.command(`/work-items/${encodeURIComponent(e)}/commands/${t}`,n,Ks,r)},this.resources={list:(e,t)=>this.get(`/resources${Ec({cursor:e})}`,Us(Zs),t)},this.orchestration={list:(e,t)=>this.get(`/workflow-instances${Ec({cursor:e})}`,Us(Qs),t)},this.workflowDiagrams={get:(e,t)=>this.get(`/workflow-diagrams${Ec({workItemKey:e})}`,Hs($s),t)},this.execution={runs:(e,t)=>this.get(`/runs${Ec({cursor:e})}`,Us(ac),t),run:(e,t)=>this.get(`/runs/${encodeURIComponent(e)}`,Hs(ac),t),transcript:(e,t)=>this.get(`/runs/${encodeURIComponent(e)}/transcript`,Hs(lc),t),resolveAmbiguousRun:(e,t,n,r)=>this.request(`/runs/${encodeURIComponent(e)}/commands/resolve`,Hs(Ks),{method:`POST`,body:JSON.stringify({idempotencyKey:n,...t}),headers:{"content-type":`application/json`},...r===void 0?{}:{signal:r}}),runners:e=>this.get(`/runners`,Us(cc),e),pauseRunner:(e,t,n)=>this.command(`/runners/${encodeURIComponent(e)}/commands/pause`,t,Ks,n),unpauseRunner:(e,t,n)=>this.command(`/runners/${encodeURIComponent(e)}/commands/unpause`,t,Ks,n)},this.events={list:(e,t,n)=>{let r=typeof t==`string`?t:void 0,i=typeof t==`string`?n:t;return this.get(`/events${Ec({cursor:e,workItemKey:r})}`,Us(sc),i)}},this.observability={metrics:(e=7,t)=>this.get(`/observability/metrics${Ec({days:String(e)})}`,Hs(gc),t)},this.system={health:e=>this.get(`/system/health`,Hs(vc),e),configuration:e=>this.get(`/system/configuration`,Hs(yc),e),commands:e=>this.get(`/system/commands`,Hs(bc),e),webhooks:e=>this.get(`/system/webhooks`,Hs(xc),e)}}async command(e,t,n,r){return this.request(e,Hs(n),{method:`POST`,body:JSON.stringify({idempotencyKey:t}),headers:{"content-type":`application/json`},...r===void 0?{}:{signal:r}})}get(e,t,n){return this.request(e,t,n===void 0?{}:{signal:n})}async request(e,t,n){let r=this.fetchImplementation,i=await r(`${this.baseUrl}${e}`,{...n,headers:{accept:`application/json, application/problem+json`,...n.headers}}),a=await i.json();if(!i.ok)throw new wc(uee(a,i.status));return t(a)}};function Ec(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&t.set(n,r);let n=t.toString();return n===``?``:`?${n}`}var Dc=(0,S.createContext)(null);function Oc(){let e=(0,S.useContext)(Dc);if(e===null)throw Error(`WakeApiClient is not configured`);return e}var kc={prefix:`fas`,iconName:`filter`,icon:[512,512,[],`f0b0`,`M32 64C19.1 64 7.4 71.8 2.4 83.8S.2 109.5 9.4 118.6L192 301.3 192 416c0 8.5 3.4 16.6 9.4 22.6l64 64c9.2 9.2 22.9 11.9 34.9 6.9S320 492.9 320 480l0-178.7 182.6-182.6c9.2-9.2 11.9-22.9 6.9-34.9S492.9 64 480 64L32 64z`]},Ac={prefix:`fas`,iconName:`table-columns`,icon:[448,512,[`columns`],`f0db`,`M0 96C0 60.7 28.7 32 64 32l320 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zm64 64l0 256 128 0 0-256-128 0zm320 0l-128 0 0 256 128 0 0-256z`]},jc={prefix:`fas`,iconName:`paper-plane`,icon:[576,512,[61913],`f1d8`,`M536.4-26.3c9.8-3.5 20.6-1 28 6.3s9.8 18.2 6.3 28l-178 496.9c-5 13.9-18.1 23.1-32.8 23.1-14.2 0-27-8.6-32.3-21.7l-64.2-158c-4.5-11-2.5-23.6 5.2-32.6l94.5-112.4c5.1-6.1 4.7-15-.9-20.6s-14.6-6-20.6-.9L229.2 276.1c-9.1 7.6-21.6 9.6-32.6 5.2L38.1 216.8c-13.1-5.3-21.7-18.1-21.7-32.3 0-14.7 9.2-27.8 23.1-32.8l496.9-178z`]},Mc={prefix:`fas`,iconName:`chevron-right`,icon:[320,512,[9002],`f054`,`M311.1 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L243.2 256 73.9 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z`]},Nc={prefix:`fas`,iconName:`heart-pulse`,icon:[512,512,[`heartbeat`],`f21e`,`M256 107.9L241 87.1C216 52.5 175.9 32 133.1 32 59.6 32 0 91.6 0 165.1l0 2.6c0 23.6 6.2 48 16.6 72.3l106 0c3.2 0 6.1-1.9 7.4-4.9l31.8-76.3c3.7-8.8 12.3-14.6 21.8-14.8s18.3 5.4 22.2 14.1l51.3 113.9 41.4-82.8c4.1-8.1 12.4-13.3 21.5-13.3s17.4 5.1 21.5 13.3l23.2 46.3c1.4 2.7 4.1 4.4 7.2 4.4l123.6 0c10.5-24.3 16.6-48.7 16.6-72.3l0-2.6C512 91.6 452.4 32 378.9 32 336.2 32 296 52.5 271 87.1l-15 20.7zM469.6 288l-97.8 0c-21.2 0-40.6-12-50.1-31l-1.7-3.4-42.5 85.1c-4.1 8.3-12.7 13.5-22 13.3s-17.6-5.7-21.4-14.1l-49.3-109.5-10.5 25.2c-8.7 20.9-29.1 34.5-51.7 34.5l-80.2 0c47.2 73.8 123 141.7 170.4 177.9 12.4 9.4 27.6 14.1 43.1 14.1s30.8-4.6 43.1-14.1C346.6 429.7 422.4 361.8 469.6 288z`]},Pc={prefix:`fas`,iconName:`chart-line`,icon:[512,512,[`line-chart`],`f201`,`M64 64c0-17.7-14.3-32-32-32S0 46.3 0 64L0 400c0 44.2 35.8 80 80 80l400 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L80 416c-8.8 0-16-7.2-16-16L64 64zm406.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L320 210.7 262.6 153.4c-12.5-12.5-32.8-12.5-45.3 0l-96 96c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l73.4-73.4 57.4 57.4c12.5 12.5 32.8 12.5 45.3 0l128-128z`]},Fc={prefix:`fas`,iconName:`play`,icon:[448,512,[9654],`f04b`,`M91.2 36.9c-12.4-6.8-27.4-6.5-39.6 .7S32 57.9 32 72l0 368c0 14.1 7.5 27.2 19.6 34.4s27.2 7.5 39.6 .7l336-184c12.8-7 20.8-20.5 20.8-35.1s-8-28.1-20.8-35.1l-336-184z`]},Ic={prefix:`fas`,iconName:`sliders`,icon:[512,512,[`sliders-h`],`f1de`,`M32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l86.7 0c12.3 28.3 40.5 48 73.3 48s61-19.7 73.3-48L480 128c17.7 0 32-14.3 32-32s-14.3-32-32-32L265.3 64C253 35.7 224.8 16 192 16s-61 19.7-73.3 48L32 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l246.7 0c12.3 28.3 40.5 48 73.3 48s61-19.7 73.3-48l54.7 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-54.7 0c-12.3-28.3-40.5-48-73.3-48s-61 19.7-73.3 48L32 224zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l54.7 0c12.3 28.3 40.5 48 73.3 48s61-19.7 73.3-48L480 448c17.7 0 32-14.3 32-32s-14.3-32-32-32l-246.7 0c-12.3-28.3-40.5-48-73.3-48s-61 19.7-73.3 48L32 384z`]},Lc={prefix:`fas`,iconName:`chevron-down`,icon:[448,512,[],`f078`,`M201.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 338.7 54.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z`]},Rc={prefix:`fas`,iconName:`clock-rotate-left`,icon:[576,512,[`history`],`f1da`,`M288 64c106 0 192 86 192 192S394 448 288 448c-65.2 0-122.9-32.5-157.6-82.3-10.1-14.5-30.1-18-44.6-7.9s-18 30.1-7.9 44.6C124.1 468.6 201 512 288 512 429.4 512 544 397.4 544 256S429.4 0 288 0C202.3 0 126.5 42.1 80 106.7L80 80c0-17.7-14.3-32-32-32S16 62.3 16 80l0 112c0 17.7 14.3 32 32 32l24.6 0c.5 0 1 0 1.5 0l86 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-38.3 0C154.9 102.6 217 64 288 64zm24 88c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 104c0 6.4 2.5 12.5 7 17l72 72c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-65-65 0-94.1z`]},zc={prefix:`fas`,iconName:`hourglass-half`,icon:[384,512,[`hourglass-2`],`f252`,`M32 0C14.3 0 0 14.3 0 32S14.3 64 32 64l0 11c0 42.4 16.9 83.1 46.9 113.1l67.9 67.9-67.9 67.9C48.9 353.9 32 394.6 32 437l0 11c-17.7 0-32 14.3-32 32s14.3 32 32 32l320 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-11c0-42.4-16.9-83.1-46.9-113.1l-67.9-67.9 67.9-67.9c30-30 46.9-70.7 46.9-113.1l0-11c17.7 0 32-14.3 32-32S369.7 0 352 0L32 0zM96 75l0-11 192 0 0 11c0 19-5.6 37.4-16 53L112 128c-10.3-15.6-16-34-16-53zm16 309c3.5-5.3 7.6-10.3 12.1-14.9l67.9-67.9 67.9 67.9c4.6 4.6 8.6 9.6 12.2 14.9L112 384z`]},Bc={prefix:`fas`,iconName:`chevron-left`,icon:[320,512,[9001],`f053`,`M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z`]},Vc={prefix:`fas`,iconName:`arrow-down-wide-short`,icon:[576,512,[`sort-amount-asc`,`sort-amount-down`],`f160`,`M246.6 374.6l-96 96c-12.5 12.5-32.8 12.5-45.3 0l-96-96c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L96 370.7 96 64c0-17.7 14.3-32 32-32s32 14.3 32 32l0 306.7 41.4-41.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3zM320 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l32 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-32 0zm0-128c-17.7 0-32-14.3-32-32s14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-96 0zm0-128c-17.7 0-32-14.3-32-32s14.3-32 32-32l160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-160 0zm0-128c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L320 96z`]},Hc={prefix:`fas`,iconName:`bars`,icon:[448,512,[`navicon`],`f0c9`,`M0 96C0 78.3 14.3 64 32 64l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32L32 448c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z`]},Uc={prefix:`fas`,iconName:`list-check`,icon:[512,512,[`tasks`],`f0ae`,`M133.8 36.3c10.9 7.6 13.5 22.6 5.9 33.4l-56 80c-4.1 5.8-10.5 9.5-17.6 10.1S52 158 47 153L7 113C-2.3 103.6-2.3 88.4 7 79S31.6 69.7 41 79l19.8 19.8 39.6-56.6c7.6-10.9 22.6-13.5 33.4-5.9zm0 160c10.9 7.6 13.5 22.6 5.9 33.4l-56 80c-4.1 5.8-10.5 9.5-17.6 10.1S52 318 47 313L7 273c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l19.8 19.8 39.6-56.6c7.6-10.9 22.6-13.5 33.4-5.9zM224 96c0-17.7 14.3-32 32-32l224 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32zm0 160c0-17.7 14.3-32 32-32l224 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32zM160 416c0-17.7 14.3-32 32-32l288 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-288 0c-17.7 0-32-14.3-32-32zM64 376a40 40 0 1 1 0 80 40 40 0 1 1 0-80z`]};function Wc(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Gc(e){if(Array.isArray(e))return e}function Kc(e){if(Array.isArray(e))return Wc(e)}function dee(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function qc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,ol(r.key),r)}}function Jc(e,t,n){return t&&qc(e.prototype,t),n&&qc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Yc(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=cl(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
13
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Qa(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)):Object.assign(i,s),Object.assign(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??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);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)}Object.assign(i,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??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}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:to(t,`input`,e.processors),output:to(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function $a(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 $a(r.element,n);if(r.type===`set`)return $a(r.valueType,n);if(r.type===`lazy`)return $a(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`)return $a(r.innerType,n);if(r.type===`intersection`)return $a(r.left,n)||$a(r.right,n);if(r.type===`record`||r.type===`map`)return $a(r.keyType,n)||$a(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:$a(r.in,n)||$a(r.out,n);if(r.type===`object`){for(let e in r.shape)if($a(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if($a(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if($a(e,n))return!0;return!!(r.rest&&$a(r.rest,n))}return!1}var eo=(e,t={})=>n=>{let r=Ya({...n,processors:t});return Xa(e,r),Za(r,e),Qa(r,e)},to=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ya({...i??{},target:a,io:t,processors:n});return Xa(e,o),Za(o,e),Qa(o,e)},no=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ro=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},io=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Xa(a.element,t,{...r,path:[...r.path,`items`]})},ao=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Xa(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},oo=(e,t,n,r)=>{let i=e._zod.def,a=Xa(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Xa(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},so=(e,t,n,r)=>{let i=e._zod.def,a=Xa(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`}]},co=(e,t,n,r)=>{let i=e._zod.def;Xa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},lo=(e,t,n,r)=>{let i=e._zod.def;Xa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},uo=(e,t,n,r)=>{let i=e._zod.def;Xa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},fo=(e,t,n,r)=>{let i=e._zod.def;Xa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},po=(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;Xa(o,t,r);let s=t.seen.get(e);s.ref=o},mo=(e,t,n,r)=>{let i=e._zod.def;Xa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ho=(e,t,n,r)=>{let i=e._zod.def;Xa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},go=_i(`ZodError`,(e,t)=>{Hi.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Gi(e,t)},flatten:{value:t=>Wi(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Si,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Si,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),_o=Ki(go),vo=qi(go),yo=Ji(go),bo=Xi(go),xo=Qi(go),So=$i(go),Co=ea(go),wo=ta(go),To=na(go),Eo=ra(go),Do=ia(go),Oo=aa(go),ko=new WeakMap;function Ao(e,t,n){let r=Object.getPrototypeOf(e),i=ko.get(r);if(i||(i=new Set,ko.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var jo=_i(`ZodType`,(e,t)=>(fa.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:to(e,`input`),output:to(e,`output`)}}),e.toJSONSchema=eo(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>_o(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>yo(e,t,n),e.parseAsync=async(t,n)=>vo(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>bo(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>xo(e,t,n),e.decode=(t,n)=>So(e,t,n),e.encodeAsync=async(t,n)=>Co(e,t,n),e.decodeAsync=async(t,n)=>wo(e,t,n),e.safeEncode=(t,n)=>To(e,t,n),e.safeDecode=(t,n)=>Eo(e,t,n),e.safeEncodeAsync=async(t,n)=>Do(e,t,n),e.safeDecodeAsync=async(t,n)=>Oo(e,t,n),Ao(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Di(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 Mi(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(as(e,t))},superRefine(e,t){return this.check(os(e,t))},overwrite(e){return this.check(Wa(e))},optional(){return Vo(this)},exactOptional(){return Uo(this)},nullable(){return Go(this)},nullish(){return Vo(Go(this))},nonoptional(e){return Zo(this,e)},array(){return No(this)},or(e){return Fo([this,e])},and(e){return Lo(this,e)},transform(e){return ts(this,zo(e))},default(e){return qo(this,e)},prefault(e){return Yo(this,e)},catch(e){return $o(this,e)},pipe(e){return ts(this,e)},readonly(){return rs(this)},describe(e){let t=this.clone();return Ba.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ba.get(this);let t=this.clone();return Ba.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Ba.get(e)?.description},configurable:!0}),e)),Mo=_i(`ZodArray`,(e,t)=>{ma.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e.element=t.element,Ao(e,`ZodArray`,{min(e,t){return this.check(Ha(e,t))},nonempty(e){return this.check(Ha(1,e))},max(e,t){return this.check(Va(e,t))},length(e,t){return this.check(Ua(e,t))},unwrap(){return this.element}})});function No(e,t){return Ga(Mo,e,t)}var Po=_i(`ZodUnion`,(e,t)=>{ga.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.options=t.options});function Fo(e,t){return new Po({type:`union`,options:e,...Ni(t)})}var Io=_i(`ZodIntersection`,(e,t)=>{_a.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r)});function Lo(e,t){return new Io({type:`intersection`,left:e,right:t})}var Ro=_i(`ZodTransform`,(e,t)=>{ba.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new yi(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Bi(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Bi(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function zo(e){return new Ro({type:`transform`,transform:e})}var Bo=_i(`ZodOptional`,(e,t)=>{Sa.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vo(e){return new Bo({type:`optional`,innerType:e})}var Ho=_i(`ZodExactOptional`,(e,t)=>{Ca.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Uo(e){return new Ho({type:`optional`,innerType:e})}var Wo=_i(`ZodNullable`,(e,t)=>{wa.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Go(e){return new Wo({type:`nullable`,innerType:e})}var Ko=_i(`ZodDefault`,(e,t)=>{Ta.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function qo(e,t){return new Ko({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ji(t)}})}var Jo=_i(`ZodPrefault`,(e,t)=>{Da.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yo(e,t){return new Jo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ji(t)}})}var Xo=_i(`ZodNonOptional`,(e,t)=>{Oa.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Zo(e,t){return new Xo({type:`nonoptional`,innerType:e,...Ni(t)})}var Qo=_i(`ZodCatch`,(e,t)=>{Aa.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function $o(e,t){return new Qo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var es=_i(`ZodPipe`,(e,t)=>{ja.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.in=t.in,e.out=t.out});function ts(e,t){return new es({type:`pipe`,in:e,out:t})}var ns=_i(`ZodReadonly`,(e,t)=>{Na.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rs(e){return new ns({type:`readonly`,innerType:e})}var is=_i(`ZodCustom`,(e,t)=>{Fa.init(e,t),jo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r)});function as(e,t={}){return Ka(is,e,t)}function os(e,t){return qa(e,t)}var ss=e=>e,cs=Object.keys({accepted:!0,completed:!0}),ls={Accepted:cs[0],Completed:cs[1]},us={Active:Object.keys({active:!0})[0]},ds={Adapter:Object.keys({adapter:!0})[0]},fs=Object.keys({failed:!0,succeeded:!0}),ps={Failed:fs[0],Succeeded:fs[1]},ms=Object.keys({starting:!0,started:!0}),hs={Starting:ms[0],Started:ms[1]},gs=ss({Waiting:`waiting`,Done:`done`,Rejected:`rejected`,Blocked:`blocked`,Failed:`failed`}),_s=Object.keys({ready:!0,active:!0,"needs-input":!0,error:!0,finished:!0}),vs={Ready:_s[0],Active:_s[1],NeedsInput:_s[2],Error:_s[3],Finished:_s[4]};Object.keys({stage:!0})[0];var ys=Object.keys({input:!0,agent:!0}),bs={Input:ys[0],Agent:ys[1]},xs=Object.keys({session:!0,run:!0}),Ss={Session:xs[0],Run:xs[1]},Cs=vs,ws=ss({Unknown:`unknown`}),Ts=Object.keys({activity:!0,watch:!0,"watch-gate":!0,reactor:!0}),Es={Activity:Ts[0],Watch:Ts[1],WatchGate:Ts[2],Reactor:Ts[3]};function Ds(e,t){let n=Os(e,t);return{asOf:As(n.asOf,Rs(t,`asOf`)),...Fs(n,`position`,t)}}function Os(e,t){return Bs(e)||zs(t),e}function ks(e,t,n){return Array.isArray(e)||zs(t),e.map((e,r)=>n(e,`${t}[${r}]`))}function As(e,t=``){return typeof e!=`string`&&zs(t),e}function js(e,t){return e===null?null:As(e,t)}function Ms(e,t){return typeof e!=`boolean`&&zs(t),e}function Ns(e,t){return(typeof e!=`number`||!Number.isFinite(e))&&zs(t),e}function Ps(e,t,n){return e[t]===void 0?{}:{[t]:As(e[t],Rs(n,t))}}function Fs(e,t,n){return e[t]===void 0?{}:{[t]:Ns(e[t],Rs(n,t))}}function Is(e,t,n){return e[t]===void 0?{}:{[t]:Ms(e[t],Rs(n,t))}}function Ls(e,t){if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e))return e;if(Array.isArray(e))return e.map((e,n)=>Ls(e,`${t}[${n}]`));let n=Os(e,t);return Object.fromEntries(Object.entries(n).map(([e,n])=>[e,Ls(n,Rs(t,e))]))}function Rs(e,t){return e===``?t:`${e}.${t}`}function zs(e){throw Error(`Invalid Wake API response at ${e===``?`root`:e}`)}function Bs(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Vs=Object.keys({stage:!0})[0];function Hs(e){return(t,n=``)=>{let r=Os(t,n);return{data:e(r.data,Rs(n,`data`)),meta:Ds(r.meta,Rs(n,`meta`))}}}function Us(e){return(t,n=``)=>{let r=Os(t,n),i=Os(r.page,Rs(n,`page`));return{items:ks(r.items,Rs(n,`items`),e),page:{nextCursor:js(i.nextCursor,Rs(n,`page.nextCursor`)),hasMore:Ms(i.hasMore,Rs(n,`page.hasMore`)),...Fs(i,`total`,Rs(n,`page`))},meta:Ds(r.meta,Rs(n,`meta`))}}}var Ws=(e,t=``)=>{let n=Os(e,t);return{dispatchPaused:Ms(n.dispatchPaused,Rs(t,`dispatchPaused`)),...Ps(n,`dispatchPausedUntil`,t),...Ps(n,`dispatchPauseReason`,t),updatedAt:As(n.updatedAt,Rs(t,`updatedAt`)),...n.maintenanceLease===void 0?{}:{maintenanceLease:Gs(n.maintenanceLease,Rs(t,`maintenanceLease`))}}};function Gs(e,t){let n=Os(e,t);return{attemptId:As(n.attemptId,Rs(t,`attemptId`)),phase:As(n.phase,Rs(t,`phase`)),startedAt:As(n.startedAt,Rs(t,`startedAt`)),...Ps(n,`failure`,t)}}var Ks=(e,t=``)=>{let n=Os(e,t),r=As(n.status,Rs(t,`status`));return r!==ls.Accepted&&r!==ls.Completed&&zs(Rs(t,`status`)),{commandId:As(n.commandId,Rs(t,`commandId`)),idempotencyKey:As(n.idempotencyKey,Rs(t,`idempotencyKey`)),acceptedAt:As(n.acceptedAt,Rs(t,`acceptedAt`)),status:r}},qs=(e,t=``)=>{let n=Os(e,t);return{workItemKey:As(n.workItemKey,Rs(t,`workItemKey`)),workItemId:As(n.workItemId,Rs(t,`workItemId`)),objective:As(n.objective,Rs(t,`objective`)),state:As(n.state,Rs(t,`state`)),...Is(n,`frozen`,t),...Is(n,`deleted`,t),...Ps(n,`externalRef`,t),...Ps(n,`lastRunOutcome`,t),relatedWorkItems:ks(n.relatedWorkItems,Rs(t,`relatedWorkItems`),(e,t=``)=>{let n=Os(e,t);return{workItemKey:As(n.workItemKey,Rs(t??``,`workItemKey`)),relation:As(n.relation,Rs(t??``,`relation`))}})}},Js=(e,t=``)=>{let n=Os(e,t);return{workItemKey:As(n.workItemKey,Rs(t,`workItemKey`)),workItemId:As(n.workItemId,Rs(t,`workItemId`)),objective:As(n.objective,Rs(t,`objective`)),condition:As(n.condition,Rs(t,`condition`)),...Is(n,`frozen`,t),...Is(n,`awaitingApproval`,t),...Is(n,`extendEligible`,t),...Ps(n,`workflowName`,t),...Ps(n,Vs,t),...Ps(n,`blockReason`,t),dwellSince:As(n.dwellSince,Rs(t,`dwellSince`)),runCount:Ns(n.runCount,Rs(t,`runCount`)),...Ps(n,`lastRunAt`,t),...Ps(n,`lastRunOutcome`,t),...Fs(n,`lastRunAgeMs`,t),totalTokens:Ns(n.totalTokens,Rs(t,`totalTokens`)),...Fs(n,`inputTokens`,t),...Fs(n,`outputTokens`,t),...Fs(n,`cacheReadTokens`,t),...Fs(n,`cacheWriteTokens`,t),totalCostUsd:Ns(n.totalCostUsd,Rs(t,`totalCostUsd`)),totalDurationMs:Ns(n.totalDurationMs,Rs(t,`totalDurationMs`)),activeRuns:Ys(n.activeRuns,Rs(t,`activeRuns`)),...Ps(n,`externalRef`,t)}};function Ys(e,t){return e===void 0?{}:Object.fromEntries(Object.entries(Os(e,t)).map(([e,n])=>[e,Xs(n,Rs(t,e))]))}function Xs(e,t){let n=Os(e,t),r=As(n.phase,Rs(t,`phase`));return Object.values(hs).includes(r)||zs(Rs(t,`phase`)),{action:As(n.action,Rs(t,`action`)),startedAt:As(n.startedAt,Rs(t,`startedAt`)),elapsedMs:Ns(n.elapsedMs,Rs(t,`elapsedMs`)),phase:r,...Ps(n,`runnerName`,t)}}var Zs=(e,t=``)=>{let n=Os(e,t);return{resourceId:As(n.resourceId,Rs(t,`resourceId`)),adapter:As(n[ds.Adapter],Rs(t,ds.Adapter)),kind:As(n.kind,Rs(t,`kind`)),locatorLabel:As(n.locatorLabel,Rs(t,`locatorLabel`)),capabilities:ks(n.capabilities,Rs(t,`capabilities`),As),...Ps(n,`title`,t),...Ps(n,`externalUrl`,t),...Ps(n,`revision`,t)}},Qs=(e,t=``)=>{let n=Os(e,t),r=n.waitingFor;return{workflowInstanceId:As(n.workflowInstanceId,Rs(t,`workflowInstanceId`)),workItemKey:As(n.workItemKey,Rs(t,`workItemKey`)),workflowName:As(n.workflowName,Rs(t,`workflowName`)),orchestrationGroupId:As(n.orchestrationGroupId,Rs(t,`orchestrationGroupId`)),...Ps(n,`parentWorkflowInstanceId`,t),status:As(n.status,Rs(t,`status`)),currentStage:As(n.currentStage,Rs(t,`currentStage`)),...Ps(n,`blockReason`,t),...Is(n,`retryEligible`,t),...Is(n,`extendEligible`,t),...r===void 0?{}:{waitingFor:{signalKind:As(Os(r,Rs(t,`waitingFor`)).signalKind,Rs(t,`waitingFor.signalKind`))}}}},$s=(e,t=``)=>({diagrams:ks(Os(e,t).diagrams,Rs(t,`diagrams`),ec)});function ec(e,t=``){let n=Os(e,t);return{id:As(n.id,Rs(t,`id`)),label:As(n.label,Rs(t,`label`)),direction:`left-to-right`,stages:ks(n.stages,Rs(t,`stages`),(e,t=``)=>{let n=Os(e,t);return{id:As(n.id,Rs(t,`id`)),label:As(n.label,Rs(t,`label`)),children:ks(n.children,Rs(t,`children`),(e,t=``)=>{let n=Os(e,t);return{id:As(n.id,Rs(t,`id`)),label:As(n.label,Rs(t,`label`)),kind:tc(n.kind,Rs(t,`kind`)),...nc(n,t)}}),...nc(n,t)}}),transitions:ks(n.transitions,Rs(t,`transitions`),(e,t=``)=>{let n=Os(e,t);return{from:As(n.from,Rs(t,`from`)),to:As(n.to,Rs(t,`to`)),label:As(n.label,Rs(t,`label`)),...Ps(n,`fromChildId`,t)}})}}function tc(e,t){let n=As(e,t);return Object.values(Es).includes(n)||zs(t),n}function nc(e,t){let n=e.activeRuns;return{...Ps(e,`status`,t),...Ps(e,`lastOutcome`,t),...Fs(e,`runCount`,t),...Fs(e,`totalDurationMs`,t),...Fs(e,`totalTokens`,t),...Fs(e,`inputTokens`,t),...Fs(e,`outputTokens`,t),...Fs(e,`cacheReadTokens`,t),...Fs(e,`cacheWriteTokens`,t),...Fs(e,`totalCostUsd`,t),...n===void 0?{}:{activeRuns:ks(n,Rs(t,`activeRuns`),(e,t=``)=>{let n=Os(e,t);return{runId:As(n.runId,Rs(t,`runId`)),activity:As(n.activity,Rs(t,`activity`)),startedAt:As(n.startedAt,Rs(t,`startedAt`)),...Ps(n,`runnerName`,t)}})}}}var rc=[`DONE`,`FAILED`,`AMBIGUOUS`];function ic(e,t){let n=Rs(t,`resolution`),r=Os(e,n),i=As(r.sentinel,Rs(n,`sentinel`));return rc.includes(i)||zs(Rs(n,`sentinel`)),{sentinel:i,resolvedAt:As(r.resolvedAt,Rs(n,`resolvedAt`))}}var ac=(e,t=``)=>{let n=Os(e,t),r=n.failure,i=n.resolution;return{runId:As(n.runId,Rs(t,`runId`)),activationId:As(n.activationId,Rs(t,`activationId`)),activity:As(n.activity,Rs(t,`activity`)),workflowInstanceId:As(n.workflowInstanceId,Rs(t,`workflowInstanceId`)),orchestrationGroupId:As(n.orchestrationGroupId,Rs(t,`orchestrationGroupId`)),attempt:Ns(n.attempt,Rs(t,`attempt`)),status:As(n.status,Rs(t,`status`)),active:Ms(n.active,Rs(t,us.Active)),startedAt:As(n.startedAt,Rs(t,`startedAt`)),...Ps(n,`executionStartedAt`,t),...Ps(n,`finishedAt`,t),sentinel:As(n.sentinel,Rs(t,`sentinel`)),...Ps(n,`runnerName`,t),...Ps(n,`runnerModel`,t),...Ps(n,`workflowName`,t),...Ps(n,Vs,t),totalTokens:Ns(n.totalTokens,Rs(t,`totalTokens`)),...Fs(n,`inputTokens`,t),...Fs(n,`outputTokens`,t),...Fs(n,`cacheReadTokens`,t),...Fs(n,`cacheWriteTokens`,t),totalCostUsd:Ns(n.totalCostUsd,Rs(t,`totalCostUsd`)),...n.outcome===void 0?{}:{outcome:Ls(n.outcome,Rs(t,`outcome`))},...r===void 0?{}:{failure:{kind:As(Os(r,Rs(t,`failure`)).kind,Rs(t,`failure.kind`))}},...i===void 0?{}:{resolution:ic(i,t)}}},oc=(e,t=``)=>{let n=Object.keys({conversation:!0})[0],r=Object.keys({stage:!0})[0],i=Os(e,t),a=Os(i.orchestration,Rs(t,`orchestration`)),o=Os(i.execution,Rs(t,`execution`)),s=Os(i.activities,Rs(t,`activities`)),c=i.artifacts===void 0?[]:ks(i.artifacts,Rs(t,`artifacts`),(e,t=``)=>{let n=Os(e,t);return{revisionId:As(n.revisionId,Rs(t,`revisionId`)),producer:As(n.producer,Rs(t,`producer`)),path:As(n.path,Rs(t,`path`)),occurredAt:As(n.occurredAt,Rs(t,`occurredAt`)),...Ps(n,`mediaType`,t),...Fs(n,`byteLength`,t),...Ps(n,`digest`,t),href:As(n.href,Rs(t,`href`))}}),l=i.conversation===void 0?void 0:Os(i.conversation,Rs(t,n));return{work:qs(i.work,Rs(t,`work`)),resources:ks(i.resources,Rs(t,`resources`),Zs),orchestration:{primary:a.primary===null?null:Qs(a.primary,Rs(t,`orchestration.primary`)),children:ks(a.children,Rs(t,`orchestration.children`),Qs),diagram:fc(a.diagram,Rs(t,`orchestration.diagram`))},execution:{runs:ks(o.runs,Rs(t,`execution.runs`),ac),transcriptGroups:ks(o.transcriptGroups,Rs(t,`execution.transcriptGroups`),(e,t=``)=>{let n=Os(e,t);return{groupId:As(n.groupId,Rs(t,`groupId`)),kind:mc(n.kind,Rs(t,`kind`)),...Ps(n,`cli`,t),latestAt:As(n.latestAt,Rs(t,`latestAt`)),runIds:ks(n.runIds,Rs(t,`runIds`),As)}})},activities:s.pullRequest===void 0?{}:{pullRequest:hc(s.pullRequest,Rs(t,`activities.pullRequest`))},artifacts:c,conversation:{canCreateEntries:l?.canCreateEntries===!0,entries:l===void 0?[]:ks(l.entries,Rs(t,`${n}.entries`),(e,t=``)=>{let n=Os(e,t);return{entryId:As(n.entryId,Rs(t,`entryId`)),body:As(n.body,Rs(t,`body`)),occurredAt:As(n.occurredAt,Rs(t,`occurredAt`)),origin:As(n.origin,Rs(t,`origin`)),actorId:As(n.actorId,Rs(t,`actorId`)),...Ps(n,`runId`,t),...Ps(n,r,t),...Ps(n,`sourceAdapter`,t),...Ps(n,`sourceResourceId`,t),...Ps(n,`sourceThreadId`,t),deleted:Ms(n.deleted,Rs(t,`deleted`)),representations:ks(n.representations,Rs(t,`representations`),(e,t=``)=>{let n=Os(e,t);return{resourceId:As(n.resourceId,Rs(t,`resourceId`)),externalId:As(n.externalId,Rs(t,`externalId`))}})}})}}},sc=(e,t=``)=>{let n=Os(e,t),r=n.stream;return{id:As(n.id,Rs(t,`id`)),type:As(n.type,Rs(t,`type`)),occurredAt:As(n.occurredAt,Rs(t,`occurredAt`)),position:Ns(n.position,Rs(t,`position`)),...r===void 0?{}:{stream:{kind:As(Os(r,Rs(t,`stream`)).kind,Rs(t,`stream.kind`)),id:As(Os(r,Rs(t,`stream`)).id,Rs(t,`stream.id`))}},...Ps(n,`causationId`,t),...Ps(n,`correlationId`,t),payload:n.payload}},cc=(e,t=``)=>{let n=Os(e,t);return{runnerId:As(n.runnerId,Rs(t,`runnerId`)),status:As(n.status,Rs(t,`status`)),available:Ms(n.available,Rs(t,`available`)),...Ps(n,`detail`,t),updatedAt:As(n.updatedAt,Rs(t,`updatedAt`))}},lc=(e,t=``)=>{let n=Os(e,t);return{runId:As(n.runId,Rs(t,`runId`)),...Ps(n,`groupId`,t),available:Ms(n.available,Rs(t,`available`)),entries:ks(n.entries,Rs(t,`entries`),(e,t=``)=>{let n=Os(e,t);return{occurredAt:As(n.occurredAt,Rs(t,`occurredAt`)),channel:pc(n.channel,Rs(t,`channel`)),text:As(n.text,Rs(t,`text`)),runId:As(n.runId,Rs(t,`runId`)),groupId:As(n.groupId,Rs(t,`groupId`)),...Fs(n,`durationMs`,t)}})}},uc=(e,t=``)=>{let n=Os(e,t);return{groupId:As(n.groupId,Rs(t,`groupId`)),available:Ms(n.available,Rs(t,`available`)),entries:ks(n.entries,Rs(t,`entries`),dc)}};function dc(e,t=``){let n=Os(e,t);return{occurredAt:As(n.occurredAt,Rs(t,`occurredAt`)),channel:pc(n.channel,Rs(t,`channel`)),text:As(n.text,Rs(t,`text`)),runId:As(n.runId,Rs(t,`runId`)),groupId:As(n.groupId,Rs(t,`groupId`)),...Fs(n,`durationMs`,t)}}function fc(e,t){return{href:As(Os(e,t).href,Rs(t,`href`))}}function pc(e,t){let n=As(e,t);return n!==bs.Input&&n!==bs.Agent&&zs(t),n}function mc(e,t){let n=As(e,t);return n!==Ss.Session&&n!==Ss.Run&&zs(t),n}function hc(e,t=``){let n=Os(e,t);return{resourceId:As(n.resourceId,Rs(t,`resourceId`)),state:As(n.state,Rs(t,`state`)),...Is(n,`frozen`,t),...Is(n,`deleted`,t),headRevision:As(n.headRevision,Rs(t,`headRevision`)),baseRevision:As(n.baseRevision,Rs(t,`baseRevision`)),checks:As(n.checks,Rs(t,`checks`))}}var gc=(e,t=``)=>{let n=Os(e,t),r=Os(n.values,Rs(t,`values`));return{collectedAt:As(n.collectedAt,Rs(t,`collectedAt`)),window:_c(n.window,Rs(t,`window`)),values:Object.fromEntries(Object.entries(r).map(([e,n])=>[e,Ns(n,Rs(t,`values.${e}`))]))}};function _c(e,t){let n=Os(e,t);return{days:Ns(n.days,Rs(t,`days`)),from:As(n.from,Rs(t,`from`)),to:As(n.to,Rs(t,`to`))}}var vc=(e,t=``)=>{let n=Os(e,t);return{status:Sc(n.status,Rs(t,`status`)),version:As(n.version,Rs(t,`version`)),checkedAt:As(n.checkedAt,Rs(t,`checkedAt`)),...n.checks===void 0?{}:{checks:ks(n.checks,Rs(t,`checks`),(e,t=``)=>{let n=Os(e,t);return{name:As(n.name,Rs(t,`name`)),status:Sc(n.status,Rs(t,`status`)),...Ps(n,`detail`,t)}})},...n.adapters===void 0?{}:{adapters:ks(n.adapters,Rs(t,`adapters`),(e,t=``)=>{let n=Os(e,t);return{adapter:As(n.adapter,Rs(t,`adapterId`)),provider:As(n.provider,Rs(t,`provider`)),scope:As(n.scope,Rs(t,`scope`)),channel:As(n.channel,Rs(t,`channel`)),status:Cc(n.status,Rs(t,`status`)),successCount:Ns(n.successCount,Rs(t,`successCount`)),failureCount:Ns(n.failureCount,Rs(t,`failureCount`)),...Ps(n,`detail`,t)}})}}},yc=(e,t=``)=>{let n=Os(e,t),r=Rs(t,`configuration`);return{configuration:Os(Ls(n.configuration,r),r)}},bc=(e,t=``)=>({adapters:ks(Os(e,t).adapters,Rs(t,`adapters`),(e,t=``)=>{let n=Os(e,t);return{adapter:As(n.adapter,Rs(t,`adapterId`)),provider:As(n.provider,Rs(t,`provider`)),commands:ks(n.commands,Rs(t,`commands`),(e,t=``)=>({syntax:As(Os(e,t).syntax,Rs(t,`syntax`))}))}})}),xc=(e,t=``)=>({adapters:ks(Os(e,t).adapters,Rs(t,`adapters`),(e,t=``)=>{let n=Os(e,t);return{adapter:As(n.adapter,Rs(t,`adapter`)),provider:As(n.provider,Rs(t,`provider`)),hooks:ks(n.hooks,Rs(t,`hooks`),(e,t=``)=>{let n=Os(e,t);return{scope:As(n.scope,Rs(t,`scope`)),endpoint:As(n.endpoint,Rs(t,`endpoint`)),events:ks(n.events,Rs(t,`events`),As),secret:As(n.secret,Rs(t,`secret`))}})}})});function uee(e,t){try{let t=Os(e,`problem`);return{type:As(t.type,`problem.type`),title:As(t.title,`problem.title`),status:Ns(t.status,`problem.status`),...Ps(t,`detail`,`problem`),...Ps(t,`instance`,`problem`),...Ps(t,`code`,`problem`),...t.retryable===void 0?{}:{retryable:Ms(t.retryable,`problem.retryable`)},...t.current===void 0?{}:{current:Ls(t.current,`problem.current`)},...t.violations===void 0?{}:{violations:ks(t.violations,`problem.violations`,(e,t=``)=>{let n=Os(e,t);return{path:As(n.path,Rs(t,`path`)),message:As(n.message,Rs(t,`message`))}})}}}catch{return{type:`about:blank`,title:`Request failed`,status:t}}}function Sc(e,t){let n=As(e,t);return n!==`ok`&&n!==`degraded`&&zs(t),n}function Cc(e,t){let n=As(e,t);return n!==`ok`&&n!==`degraded`&&n!==ws.Unknown&&zs(t),n}var wc=class extends Error{constructor(e){super(e.title),this.problem=e,this.name=`ApiProblem`}},Tc=class{constructor(e=fetch,t=`/api/v1`){this.fetchImplementation=e,this.baseUrl=t,this.auth={session:async()=>{let e=this.fetchImplementation;return(await e(`${this.baseUrl}/auth/session`)).ok},login:async e=>{let t=this.fetchImplementation;return(await t(`${this.baseUrl}/auth/login`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({accessKey:e})})).ok},redeem:async e=>{let t=this.fetchImplementation;return(await t(`${this.baseUrl}/auth/redeem`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({grant:e})})).ok}},this.board={list:(e,t)=>this.get(`/board${Ec({cursor:e})}`,Us(Js),t)},this.status={get:e=>this.get(`/status`,Hs(e=>e),e)},this.controlPlane={status:e=>this.get(`/control-plane/status`,Hs(Ws),e),pauseDispatch:(e,t)=>this.command(`/control-plane/commands/pause-dispatch`,e,Ks,t),resumeDispatch:(e,t)=>this.command(`/control-plane/commands/resume-dispatch`,e,Ks,t),clearMaintenance:(e,t,n)=>this.request(`/control-plane/commands/clear-maintenance`,Hs(Ks),{method:`POST`,body:JSON.stringify({attemptId:e,idempotencyKey:t}),headers:{"content-type":`application/json`},...n===void 0?{}:{signal:n}})},this.work={list:(e={},t)=>this.get(`/work-items${Ec(e)}`,Us(qs),t),detail:(e,t)=>this.get(`/work-items/${encodeURIComponent(e)}`,Hs(oc),t),transcript:(e,t,n)=>this.get(`/work-items/${encodeURIComponent(e)}/transcripts/${encodeURIComponent(t)}`,Hs(uc),n),message:(e,t,n,r)=>this.request(`/work-items/${encodeURIComponent(e)}/commands/message`,Hs(Ks),{method:`POST`,body:JSON.stringify({idempotencyKey:n,body:t}),headers:{"content-type":`application/json`},...r===void 0?{}:{signal:r}}),command:(e,t,n,r)=>this.command(`/work-items/${encodeURIComponent(e)}/commands/${t}`,n,Ks,r)},this.resources={list:(e,t)=>this.get(`/resources${Ec({cursor:e})}`,Us(Zs),t)},this.orchestration={list:(e,t)=>this.get(`/workflow-instances${Ec({cursor:e})}`,Us(Qs),t)},this.workflowDiagrams={get:(e,t)=>this.get(`/workflow-diagrams${Ec({workItemKey:e})}`,Hs($s),t)},this.execution={runs:(e,t)=>this.get(`/runs${Ec({cursor:e})}`,Us(ac),t),run:(e,t)=>this.get(`/runs/${encodeURIComponent(e)}`,Hs(ac),t),transcript:(e,t)=>this.get(`/runs/${encodeURIComponent(e)}/transcript`,Hs(lc),t),resolveAmbiguousRun:(e,t,n,r)=>this.request(`/runs/${encodeURIComponent(e)}/commands/resolve`,Hs(Ks),{method:`POST`,body:JSON.stringify({idempotencyKey:n,...t}),headers:{"content-type":`application/json`},...r===void 0?{}:{signal:r}}),runners:e=>this.get(`/runners`,Us(cc),e),pauseRunner:(e,t,n)=>this.command(`/runners/${encodeURIComponent(e)}/commands/pause`,t,Ks,n),unpauseRunner:(e,t,n)=>this.command(`/runners/${encodeURIComponent(e)}/commands/unpause`,t,Ks,n)},this.events={list:(e,t,n)=>{let r=typeof t==`string`?t:void 0,i=typeof t==`string`?n:t;return this.get(`/events${Ec({cursor:e,workItemKey:r})}`,Us(sc),i)}},this.observability={metrics:(e=7,t)=>this.get(`/observability/metrics${Ec({days:String(e)})}`,Hs(gc),t)},this.system={health:e=>this.get(`/system/health`,Hs(vc),e),configuration:e=>this.get(`/system/configuration`,Hs(yc),e),commands:e=>this.get(`/system/commands`,Hs(bc),e),webhooks:e=>this.get(`/system/webhooks`,Hs(xc),e)}}async command(e,t,n,r){return this.request(e,Hs(n),{method:`POST`,body:JSON.stringify({idempotencyKey:t}),headers:{"content-type":`application/json`},...r===void 0?{}:{signal:r}})}get(e,t,n){return this.request(e,t,n===void 0?{}:{signal:n})}async request(e,t,n){let r=this.fetchImplementation,i=await r(`${this.baseUrl}${e}`,{...n,headers:{accept:`application/json, application/problem+json`,...n.headers}}),a=await i.json();if(!i.ok)throw new wc(uee(a,i.status));return t(a)}};function Ec(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&t.set(n,r);let n=t.toString();return n===``?``:`?${n}`}var Dc=(0,S.createContext)(null);function Oc(){let e=(0,S.useContext)(Dc);if(e===null)throw Error(`WakeApiClient is not configured`);return e}var kc={prefix:`fas`,iconName:`filter`,icon:[512,512,[],`f0b0`,`M32 64C19.1 64 7.4 71.8 2.4 83.8S.2 109.5 9.4 118.6L192 301.3 192 416c0 8.5 3.4 16.6 9.4 22.6l64 64c9.2 9.2 22.9 11.9 34.9 6.9S320 492.9 320 480l0-178.7 182.6-182.6c9.2-9.2 11.9-22.9 6.9-34.9S492.9 64 480 64L32 64z`]},Ac={prefix:`fas`,iconName:`table-columns`,icon:[448,512,[`columns`],`f0db`,`M0 96C0 60.7 28.7 32 64 32l320 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zm64 64l0 256 128 0 0-256-128 0zm320 0l-128 0 0 256 128 0 0-256z`]},jc={prefix:`fas`,iconName:`paper-plane`,icon:[576,512,[61913],`f1d8`,`M536.4-26.3c9.8-3.5 20.6-1 28 6.3s9.8 18.2 6.3 28l-178 496.9c-5 13.9-18.1 23.1-32.8 23.1-14.2 0-27-8.6-32.3-21.7l-64.2-158c-4.5-11-2.5-23.6 5.2-32.6l94.5-112.4c5.1-6.1 4.7-15-.9-20.6s-14.6-6-20.6-.9L229.2 276.1c-9.1 7.6-21.6 9.6-32.6 5.2L38.1 216.8c-13.1-5.3-21.7-18.1-21.7-32.3 0-14.7 9.2-27.8 23.1-32.8l496.9-178z`]},Mc={prefix:`fas`,iconName:`chevron-right`,icon:[320,512,[9002],`f054`,`M311.1 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L243.2 256 73.9 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z`]},Nc={prefix:`fas`,iconName:`heart-pulse`,icon:[512,512,[`heartbeat`],`f21e`,`M256 107.9L241 87.1C216 52.5 175.9 32 133.1 32 59.6 32 0 91.6 0 165.1l0 2.6c0 23.6 6.2 48 16.6 72.3l106 0c3.2 0 6.1-1.9 7.4-4.9l31.8-76.3c3.7-8.8 12.3-14.6 21.8-14.8s18.3 5.4 22.2 14.1l51.3 113.9 41.4-82.8c4.1-8.1 12.4-13.3 21.5-13.3s17.4 5.1 21.5 13.3l23.2 46.3c1.4 2.7 4.1 4.4 7.2 4.4l123.6 0c10.5-24.3 16.6-48.7 16.6-72.3l0-2.6C512 91.6 452.4 32 378.9 32 336.2 32 296 52.5 271 87.1l-15 20.7zM469.6 288l-97.8 0c-21.2 0-40.6-12-50.1-31l-1.7-3.4-42.5 85.1c-4.1 8.3-12.7 13.5-22 13.3s-17.6-5.7-21.4-14.1l-49.3-109.5-10.5 25.2c-8.7 20.9-29.1 34.5-51.7 34.5l-80.2 0c47.2 73.8 123 141.7 170.4 177.9 12.4 9.4 27.6 14.1 43.1 14.1s30.8-4.6 43.1-14.1C346.6 429.7 422.4 361.8 469.6 288z`]},Pc={prefix:`fas`,iconName:`chart-line`,icon:[512,512,[`line-chart`],`f201`,`M64 64c0-17.7-14.3-32-32-32S0 46.3 0 64L0 400c0 44.2 35.8 80 80 80l400 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L80 416c-8.8 0-16-7.2-16-16L64 64zm406.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L320 210.7 262.6 153.4c-12.5-12.5-32.8-12.5-45.3 0l-96 96c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l73.4-73.4 57.4 57.4c12.5 12.5 32.8 12.5 45.3 0l128-128z`]},Fc={prefix:`fas`,iconName:`play`,icon:[448,512,[9654],`f04b`,`M91.2 36.9c-12.4-6.8-27.4-6.5-39.6 .7S32 57.9 32 72l0 368c0 14.1 7.5 27.2 19.6 34.4s27.2 7.5 39.6 .7l336-184c12.8-7 20.8-20.5 20.8-35.1s-8-28.1-20.8-35.1l-336-184z`]},Ic={prefix:`fas`,iconName:`sliders`,icon:[512,512,[`sliders-h`],`f1de`,`M32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l86.7 0c12.3 28.3 40.5 48 73.3 48s61-19.7 73.3-48L480 128c17.7 0 32-14.3 32-32s-14.3-32-32-32L265.3 64C253 35.7 224.8 16 192 16s-61 19.7-73.3 48L32 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l246.7 0c12.3 28.3 40.5 48 73.3 48s61-19.7 73.3-48l54.7 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-54.7 0c-12.3-28.3-40.5-48-73.3-48s-61 19.7-73.3 48L32 224zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l54.7 0c12.3 28.3 40.5 48 73.3 48s61-19.7 73.3-48L480 448c17.7 0 32-14.3 32-32s-14.3-32-32-32l-246.7 0c-12.3-28.3-40.5-48-73.3-48s-61 19.7-73.3 48L32 384z`]},Lc={prefix:`fas`,iconName:`chevron-down`,icon:[448,512,[],`f078`,`M201.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 338.7 54.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z`]},Rc={prefix:`fas`,iconName:`clock-rotate-left`,icon:[576,512,[`history`],`f1da`,`M288 64c106 0 192 86 192 192S394 448 288 448c-65.2 0-122.9-32.5-157.6-82.3-10.1-14.5-30.1-18-44.6-7.9s-18 30.1-7.9 44.6C124.1 468.6 201 512 288 512 429.4 512 544 397.4 544 256S429.4 0 288 0C202.3 0 126.5 42.1 80 106.7L80 80c0-17.7-14.3-32-32-32S16 62.3 16 80l0 112c0 17.7 14.3 32 32 32l24.6 0c.5 0 1 0 1.5 0l86 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-38.3 0C154.9 102.6 217 64 288 64zm24 88c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 104c0 6.4 2.5 12.5 7 17l72 72c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-65-65 0-94.1z`]},zc={prefix:`fas`,iconName:`hourglass-half`,icon:[384,512,[`hourglass-2`],`f252`,`M32 0C14.3 0 0 14.3 0 32S14.3 64 32 64l0 11c0 42.4 16.9 83.1 46.9 113.1l67.9 67.9-67.9 67.9C48.9 353.9 32 394.6 32 437l0 11c-17.7 0-32 14.3-32 32s14.3 32 32 32l320 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-11c0-42.4-16.9-83.1-46.9-113.1l-67.9-67.9 67.9-67.9c30-30 46.9-70.7 46.9-113.1l0-11c17.7 0 32-14.3 32-32S369.7 0 352 0L32 0zM96 75l0-11 192 0 0 11c0 19-5.6 37.4-16 53L112 128c-10.3-15.6-16-34-16-53zm16 309c3.5-5.3 7.6-10.3 12.1-14.9l67.9-67.9 67.9 67.9c4.6 4.6 8.6 9.6 12.2 14.9L112 384z`]},Bc={prefix:`fas`,iconName:`chevron-left`,icon:[320,512,[9001],`f053`,`M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z`]},Vc={prefix:`fas`,iconName:`arrow-down-wide-short`,icon:[576,512,[`sort-amount-asc`,`sort-amount-down`],`f160`,`M246.6 374.6l-96 96c-12.5 12.5-32.8 12.5-45.3 0l-96-96c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L96 370.7 96 64c0-17.7 14.3-32 32-32s32 14.3 32 32l0 306.7 41.4-41.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3zM320 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l32 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-32 0zm0-128c-17.7 0-32-14.3-32-32s14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-96 0zm0-128c-17.7 0-32-14.3-32-32s14.3-32 32-32l160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-160 0zm0-128c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L320 96z`]},Hc={prefix:`fas`,iconName:`bars`,icon:[448,512,[`navicon`],`f0c9`,`M0 96C0 78.3 14.3 64 32 64l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32L32 448c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z`]},Uc={prefix:`fas`,iconName:`list-check`,icon:[512,512,[`tasks`],`f0ae`,`M133.8 36.3c10.9 7.6 13.5 22.6 5.9 33.4l-56 80c-4.1 5.8-10.5 9.5-17.6 10.1S52 158 47 153L7 113C-2.3 103.6-2.3 88.4 7 79S31.6 69.7 41 79l19.8 19.8 39.6-56.6c7.6-10.9 22.6-13.5 33.4-5.9zm0 160c10.9 7.6 13.5 22.6 5.9 33.4l-56 80c-4.1 5.8-10.5 9.5-17.6 10.1S52 318 47 313L7 273c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l19.8 19.8 39.6-56.6c7.6-10.9 22.6-13.5 33.4-5.9zM224 96c0-17.7 14.3-32 32-32l224 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32zm0 160c0-17.7 14.3-32 32-32l224 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32zM160 416c0-17.7 14.3-32 32-32l288 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-288 0c-17.7 0-32-14.3-32-32zM64 376a40 40 0 1 1 0 80 40 40 0 1 1 0-80z`]};function Wc(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Gc(e){if(Array.isArray(e))return e}function Kc(e){if(Array.isArray(e))return Wc(e)}function dee(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function qc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,ol(r.key),r)}}function Jc(e,t,n){return t&&qc(e.prototype,t),n&&qc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Yc(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=cl(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
14
14
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function Xc(e,t,n){return(t=ol(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zc(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Qc(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function $c(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
15
15
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function el(){throw TypeError(`Invalid attempt to spread non-iterable instance.
16
16
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?tl(Object(n),!0).forEach(function(t){Xc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rl(e,t){return Gc(e)||Qc(e,t)||cl(e,t)||$c()}function il(e){return Kc(e)||Zc(e)||cl(e)||el()}function al(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ol(e){var t=al(e,`string`);return typeof t==`symbol`?t:t+``}function sl(e){"@babel/helpers - typeof";return sl=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},sl(e)}function cl(e,t){if(e){if(typeof e==`string`)return Wc(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wc(e,t):void 0}}var ll=function(){},ul={},dl={},fl=null,pl={mark:ll,measure:ll};try{typeof window<`u`&&(ul=window),typeof document<`u`&&(dl=document),typeof MutationObserver<`u`&&(fl=MutationObserver),typeof performance<`u`&&(pl=performance)}catch{}var ml=(ul.navigator||{}).userAgent,hl=ml===void 0?``:ml,gl=ul,_l=dl,vl=fl,yl=pl;gl.document;var bl=!!_l.documentElement&&!!_l.head&&typeof _l.addEventListener==`function`&&typeof _l.createElement==`function`,xl=~hl.indexOf(`MSIE`)||~hl.indexOf(`Trident/`),Sl,Cl=/fa(k|kd|s|r|l|t|d|dr|dl|dt|b|slr|slpr|wsb|tl|ns|nds|es|gt|jr|jfr|jdr|usb|ufsb|udsb|cr|ss|sr|sl|st|sds|sdr|sdl|sdt|sldr|slpdr|pr|ms|vs)?[\-\ ]/,wl=/Font ?Awesome ?([567 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit|Notdog Duo|Notdog|Chisel|Etch|Graphite|Thumbprint|Jelly Fill|Jelly Duo|Jelly|Utility|Utility Fill|Utility Duo|Slab Press|Slab|Slab Duo|Slab Press Duo|Pixel|Mosaic|Vellum|Whiteboard)?.*/i,Tl={classic:{fa:`solid`,fas:`solid`,"fa-solid":`solid`,far:`regular`,"fa-regular":`regular`,fal:`light`,"fa-light":`light`,fat:`thin`,"fa-thin":`thin`,fab:`brands`,"fa-brands":`brands`},duotone:{fa:`solid`,fad:`solid`,"fa-solid":`solid`,"fa-duotone":`solid`,fadr:`regular`,"fa-regular":`regular`,fadl:`light`,"fa-light":`light`,fadt:`thin`,"fa-thin":`thin`},sharp:{fa:`solid`,fass:`solid`,"fa-solid":`solid`,fasr:`regular`,"fa-regular":`regular`,fasl:`light`,"fa-light":`light`,fast:`thin`,"fa-thin":`thin`},"sharp-duotone":{fa:`solid`,fasds:`solid`,"fa-solid":`solid`,fasdr:`regular`,"fa-regular":`regular`,fasdl:`light`,"fa-light":`light`,fasdt:`thin`,"fa-thin":`thin`},slab:{"fa-regular":`regular`,faslr:`regular`},"slab-press":{"fa-regular":`regular`,faslpr:`regular`},"slab-duo":{"fa-regular":`regular`,fasldr:`regular`},"slab-press-duo":{"fa-regular":`regular`,faslpdr:`regular`},thumbprint:{"fa-light":`light`,fatl:`light`},vellum:{"fa-solid":`solid`,favs:`solid`},pixel:{"fa-regular":`regular`,fapr:`regular`},mosaic:{"fa-solid":`solid`,fams:`solid`},whiteboard:{"fa-semibold":`semibold`,fawsb:`semibold`},notdog:{"fa-solid":`solid`,fans:`solid`},"notdog-duo":{"fa-solid":`solid`,fands:`solid`},etch:{"fa-solid":`solid`,faes:`solid`},graphite:{"fa-thin":`thin`,fagt:`thin`},jelly:{"fa-regular":`regular`,fajr:`regular`},"jelly-fill":{"fa-regular":`regular`,fajfr:`regular`},"jelly-duo":{"fa-regular":`regular`,fajdr:`regular`},chisel:{"fa-regular":`regular`,facr:`regular`},utility:{"fa-semibold":`semibold`,fausb:`semibold`},"utility-duo":{"fa-semibold":`semibold`,faudsb:`semibold`},"utility-fill":{"fa-semibold":`semibold`,faufsb:`semibold`}},El={GROUP:`duotone-group`,SWAP_OPACITY:`swap-opacity`,PRIMARY:`primary`,SECONDARY:`secondary`},Dl=[`fa-classic`,`fa-duotone`,`fa-sharp`,`fa-sharp-duotone`,`fa-thumbprint`,`fa-whiteboard`,`fa-notdog`,`fa-notdog-duo`,`fa-chisel`,`fa-etch`,`fa-graphite`,`fa-jelly`,`fa-jelly-fill`,`fa-jelly-duo`,`fa-slab`,`fa-slab-press`,`fa-slab-press-duo`,`fa-slab-duo`,`fa-mosaic`,`fa-pixel`,`fa-vellum`,`fa-utility`,`fa-utility-duo`,`fa-utility-fill`],Ol=`classic`,kl=`duotone`,Al=`sharp`,jl=`sharp-duotone`,Ml=`chisel`,Nl=`etch`,Pl=`graphite`,Fl=`jelly`,Il=`jelly-duo`,Ll=`jelly-fill`,Rl=`mosaic`,zl=`notdog`,Bl=`notdog-duo`,Vl=`pixel`,Hl=`slab`,Ul=`slab-duo`,Wl=`slab-press`,Gl=`slab-press-duo`,Kl=`thumbprint`,ql=`utility`,Jl=`utility-duo`,Yl=`utility-fill`,Xl=`vellum`,Zl=`whiteboard`,Ql=`Classic`,$l=`Duotone`,eu=`Sharp`,tu=`Sharp Duotone`,nu=`Chisel`,ru=`Etch`,iu=`Graphite`,au=`Jelly`,ou=`Jelly Duo`,su=`Jelly Fill`,cu=`Mosaic`,lu=`Notdog`,uu=`Notdog Duo`,du=`Pixel`,fu=`Slab`,pu=`Slab Duo`,mu=`Slab Press`,hu=`Slab Press Duo`,gu=`Thumbprint`,_u=`Utility`,vu=`Utility Duo`,yu=`Utility Fill`,bu=`Vellum`,xu=`Whiteboard`,Su=[Ol,kl,Al,jl,Ml,Nl,Pl,Fl,Il,Ll,Rl,zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl];Sl={},Xc(Xc(Xc(Xc(Xc(Xc(Xc(Xc(Xc(Xc(Sl,Ol,Ql),kl,$l),Al,eu),jl,tu),Ml,nu),Nl,ru),Pl,iu),Fl,au),Il,ou),Ll,su),Xc(Xc(Xc(Xc(Xc(Xc(Xc(Xc(Xc(Xc(Sl,Rl,cu),zl,lu),Bl,uu),Vl,du),Hl,fu),Ul,pu),Wl,mu),Gl,hu),Kl,gu),ql,_u),Xc(Xc(Xc(Xc(Sl,Jl,vu),Yl,yu),Xl,bu),Zl,xu);var Cu={classic:{900:`fas`,400:`far`,normal:`far`,300:`fal`,100:`fat`},duotone:{900:`fad`,400:`fadr`,300:`fadl`,100:`fadt`},sharp:{900:`fass`,400:`fasr`,300:`fasl`,100:`fast`},"sharp-duotone":{900:`fasds`,400:`fasdr`,300:`fasdl`,100:`fasdt`},slab:{400:`faslr`},"slab-press":{400:`faslpr`},"slab-duo":{400:`fasldr`},"slab-press-duo":{400:`faslpdr`},vellum:{900:`favs`},mosaic:{900:`fams`},pixel:{400:`fapr`},whiteboard:{600:`fawsb`},thumbprint:{300:`fatl`},notdog:{900:`fans`},"notdog-duo":{900:`fands`},etch:{900:`faes`},graphite:{100:`fagt`},chisel:{400:`facr`},jelly:{400:`fajr`},"jelly-fill":{400:`fajfr`},"jelly-duo":{400:`fajdr`},utility:{600:`fausb`},"utility-duo":{600:`faudsb`},"utility-fill":{600:`faufsb`}},wu={"Font Awesome 7 Free":{900:`fas`,400:`far`},"Font Awesome 7 Pro":{900:`fas`,400:`far`,normal:`far`,300:`fal`,100:`fat`},"Font Awesome 7 Brands":{400:`fab`,normal:`fab`},"Font Awesome 7 Duotone":{900:`fad`,400:`fadr`,normal:`fadr`,300:`fadl`,100:`fadt`},"Font Awesome 7 Sharp":{900:`fass`,400:`fasr`,normal:`fasr`,300:`fasl`,100:`fast`},"Font Awesome 7 Sharp Duotone":{900:`fasds`,400:`fasdr`,normal:`fasdr`,300:`fasdl`,100:`fasdt`},"Font Awesome 7 Jelly":{400:`fajr`,normal:`fajr`},"Font Awesome 7 Jelly Fill":{400:`fajfr`,normal:`fajfr`},"Font Awesome 7 Jelly Duo":{400:`fajdr`,normal:`fajdr`},"Font Awesome 7 Slab":{400:`faslr`,normal:`faslr`},"Font Awesome 7 Slab Press":{400:`faslpr`,normal:`faslpr`},"Font Awesome 7 Slab Duo":{400:`fasldr`,normal:`fasldr`},"Font Awesome 7 Slab Press Duo":{400:`faslpdr`,normal:`faslpdr`},"Font Awesome 7 Pixel":{400:`fapr`,normal:`fapr`},"Font Awesome 7 Mosaic":{900:`fams`,normal:`fams`},"Font Awesome 7 Vellum":{900:`favs`,normal:`favs`},"Font Awesome 7 Thumbprint":{300:`fatl`,normal:`fatl`},"Font Awesome 7 Notdog":{900:`fans`,normal:`fans`},"Font Awesome 7 Notdog Duo":{900:`fands`,normal:`fands`},"Font Awesome 7 Etch":{900:`faes`,normal:`faes`},"Font Awesome 7 Graphite":{100:`fagt`,normal:`fagt`},"Font Awesome 7 Chisel":{400:`facr`,normal:`facr`},"Font Awesome 7 Whiteboard":{600:`fawsb`,normal:`fawsb`},"Font Awesome 7 Utility":{600:`fausb`,normal:`fausb`},"Font Awesome 7 Utility Duo":{600:`faudsb`,normal:`faudsb`},"Font Awesome 7 Utility Fill":{600:`faufsb`,normal:`faufsb`}},Tu=new Map([[`classic`,{defaultShortPrefixId:`fas`,defaultStyleId:`solid`,styleIds:[`solid`,`regular`,`light`,`thin`,`brands`],futureStyleIds:[],defaultFontWeight:900}],[`duotone`,{defaultShortPrefixId:`fad`,defaultStyleId:`solid`,styleIds:[`solid`,`regular`,`light`,`thin`],futureStyleIds:[],defaultFontWeight:900}],[`sharp`,{defaultShortPrefixId:`fass`,defaultStyleId:`solid`,styleIds:[`solid`,`regular`,`light`,`thin`],futureStyleIds:[],defaultFontWeight:900}],[`sharp-duotone`,{defaultShortPrefixId:`fasds`,defaultStyleId:`solid`,styleIds:[`solid`,`regular`,`light`,`thin`],futureStyleIds:[],defaultFontWeight:900}],[`chisel`,{defaultShortPrefixId:`facr`,defaultStyleId:`regular`,styleIds:[`regular`],futureStyleIds:[],defaultFontWeight:400}],[`etch`,{defaultShortPrefixId:`faes`,defaultStyleId:`solid`,styleIds:[`solid`],futureStyleIds:[],defaultFontWeight:900}],[`graphite`,{defaultShortPrefixId:`fagt`,defaultStyleId:`thin`,styleIds:[`thin`],futureStyleIds:[],defaultFontWeight:100}],[`jelly`,{defaultShortPrefixId:`fajr`,defaultStyleId:`regular`,styleIds:[`regular`],futureStyleIds:[],defaultFontWeight:400}],[`jelly-duo`,{defaultShortPrefixId:`fajdr`,defaultStyleId:`regular`,styleIds:[`regular`],futureStyleIds:[],defaultFontWeight:400}],[`jelly-fill`,{defaultShortPrefixId:`fajfr`,defaultStyleId:`regular`,styleIds:[`regular`],futureStyleIds:[],defaultFontWeight:400}],[`mosaic`,{defaultShortPrefixId:`fams`,defaultStyleId:`solid`,styleIds:[`solid`],futureStyleIds:[],defaultFontWeight:900}],[`notdog`,{defaultShortPrefixId:`fans`,defaultStyleId:`solid`,styleIds:[`solid`],futureStyleIds:[],defaultFontWeight:900}],[`notdog-duo`,{defaultShortPrefixId:`fands`,defaultStyleId:`solid`,styleIds:[`solid`],futureStyleIds:[],defaultFontWeight:900}],[`pixel`,{defaultShortPrefixId:`fapr`,defaultStyleId:`regular`,styleIds:[`regular`],futureStyleIds:[],defaultFontWeight:400}],[`slab`,{defaultShortPrefixId:`faslr`,defaultStyleId:`regular`,styleIds:[`regular`],futureStyleIds:[],defaultFontWeight:400}],[`slab-duo`,{defaultShortPrefixId:`fasldr`,defaultStyleId:`regular`,styleIds:[`regular`],futureStyleIds:[],defaultFontWeight:400}],[`slab-press`,{defaultShortPrefixId:`faslpr`,defaultStyleId:`regular`,styleIds:[`regular`],futureStyleIds:[],defaultFontWeight:400}],[`slab-press-duo`,{defaultShortPrefixId:`faslpdr`,defaultStyleId:`regular`,styleIds:[`regular`],futureStyleIds:[],defaultFontWeight:400}],[`thumbprint`,{defaultShortPrefixId:`fatl`,defaultStyleId:`light`,styleIds:[`light`],futureStyleIds:[],defaultFontWeight:300}],[`utility`,{defaultShortPrefixId:`fausb`,defaultStyleId:`semibold`,styleIds:[`semibold`],futureStyleIds:[],defaultFontWeight:600}],[`utility-duo`,{defaultShortPrefixId:`faudsb`,defaultStyleId:`semibold`,styleIds:[`semibold`],futureStyleIds:[],defaultFontWeight:600}],[`utility-fill`,{defaultShortPrefixId:`faufsb`,defaultStyleId:`semibold`,styleIds:[`semibold`],futureStyleIds:[],defaultFontWeight:600}],[`vellum`,{defaultShortPrefixId:`favs`,defaultStyleId:`solid`,styleIds:[`solid`],futureStyleIds:[],defaultFontWeight:900}],[`whiteboard`,{defaultShortPrefixId:`fawsb`,defaultStyleId:`semibold`,styleIds:[`semibold`],futureStyleIds:[],defaultFontWeight:600}]]),Eu={chisel:{regular:`facr`},classic:{brands:`fab`,light:`fal`,regular:`far`,solid:`fas`,thin:`fat`},duotone:{light:`fadl`,regular:`fadr`,solid:`fad`,thin:`fadt`},etch:{solid:`faes`},graphite:{thin:`fagt`},jelly:{regular:`fajr`},"jelly-duo":{regular:`fajdr`},"jelly-fill":{regular:`fajfr`},mosaic:{solid:`fams`},notdog:{solid:`fans`},"notdog-duo":{solid:`fands`},pixel:{regular:`fapr`},sharp:{light:`fasl`,regular:`fasr`,solid:`fass`,thin:`fast`},"sharp-duotone":{light:`fasdl`,regular:`fasdr`,solid:`fasds`,thin:`fasdt`},slab:{regular:`faslr`},"slab-duo":{regular:`fasldr`},"slab-press":{regular:`faslpr`},"slab-press-duo":{regular:`faslpdr`},thumbprint:{light:`fatl`},utility:{semibold:`fausb`},"utility-duo":{semibold:`faudsb`},"utility-fill":{semibold:`faufsb`},vellum:{solid:`favs`},whiteboard:{semibold:`fawsb`}},Du=[`fak`,`fa-kit`,`fakd`,`fa-kit-duotone`],Ou={kit:{fak:`kit`,"fa-kit":`kit`},"kit-duotone":{fakd:`kit-duotone`,"fa-kit-duotone":`kit-duotone`}},ku=[`kit`];Xc(Xc({},`kit`,`Kit`),`kit-duotone`,`Kit Duotone`);var Au={kit:{"fa-kit":`fak`},"kit-duotone":{"fa-kit-duotone":`fakd`}},ju={"Font Awesome Kit":{400:`fak`,normal:`fak`},"Font Awesome Kit Duotone":{400:`fakd`,normal:`fakd`}},Mu={kit:{fak:`fa-kit`},"kit-duotone":{fakd:`fa-kit-duotone`}},Nu={kit:{kit:`fak`},"kit-duotone":{"kit-duotone":`fakd`}},Pu,Fu={GROUP:`duotone-group`,SWAP_OPACITY:`swap-opacity`,PRIMARY:`primary`,SECONDARY:`secondary`},Iu=[`fa-classic`,`fa-duotone`,`fa-sharp`,`fa-sharp-duotone`,`fa-thumbprint`,`fa-whiteboard`,`fa-notdog`,`fa-notdog-duo`,`fa-chisel`,`fa-etch`,`fa-graphite`,`fa-jelly`,`fa-jelly-fill`,`fa-jelly-duo`,`fa-slab`,`fa-slab-press`,`fa-slab-press-duo`,`fa-slab-duo`,`fa-mosaic`,`fa-pixel`,`fa-vellum`,`fa-utility`,`fa-utility-duo`,`fa-utility-fill`];Pu={},Xc(Xc(Xc(Xc(Xc(Xc(Xc(Xc(Xc(Xc(Pu,`classic`,`Classic`),`duotone`,`Duotone`),`sharp`,`Sharp`),`sharp-duotone`,`Sharp Duotone`),`chisel`,`Chisel`),`etch`,`Etch`),`graphite`,`Graphite`),`jelly`,`Jelly`),`jelly-duo`,`Jelly Duo`),`jelly-fill`,`Jelly Fill`),Xc(Xc(Xc(Xc(Xc(Xc(Xc(Xc(Xc(Xc(Pu,`mosaic`,`Mosaic`),`notdog`,`Notdog`),`notdog-duo`,`Notdog Duo`),`pixel`,`Pixel`),`slab`,`Slab`),`slab-duo`,`Slab Duo`),`slab-press`,`Slab Press`),`slab-press-duo`,`Slab Press Duo`),`thumbprint`,`Thumbprint`),`utility`,`Utility`),Xc(Xc(Xc(Xc(Pu,`utility-duo`,`Utility Duo`),`utility-fill`,`Utility Fill`),`vellum`,`Vellum`),`whiteboard`,`Whiteboard`),Xc(Xc({},`kit`,`Kit`),`kit-duotone`,`Kit Duotone`);var Lu={classic:{"fa-brands":`fab`,"fa-duotone":`fad`,"fa-light":`fal`,"fa-regular":`far`,"fa-solid":`fas`,"fa-thin":`fat`},duotone:{"fa-regular":`fadr`,"fa-light":`fadl`,"fa-thin":`fadt`},sharp:{"fa-solid":`fass`,"fa-regular":`fasr`,"fa-light":`fasl`,"fa-thin":`fast`},"sharp-duotone":{"fa-solid":`fasds`,"fa-regular":`fasdr`,"fa-light":`fasdl`,"fa-thin":`fasdt`},slab:{"fa-regular":`faslr`},"slab-press":{"fa-regular":`faslpr`},"slab-duo":{"fa-regular":`fasldr`},"slab-press-duo":{"fa-regular":`faslpdr`},pixel:{"fa-regular":`fapr`},mosaic:{"fa-solid":`fams`},vellum:{"fa-solid":`favs`},whiteboard:{"fa-semibold":`fawsb`},thumbprint:{"fa-light":`fatl`},notdog:{"fa-solid":`fans`},"notdog-duo":{"fa-solid":`fands`},etch:{"fa-solid":`faes`},graphite:{"fa-thin":`fagt`},jelly:{"fa-regular":`fajr`},"jelly-fill":{"fa-regular":`fajfr`},"jelly-duo":{"fa-regular":`fajdr`},chisel:{"fa-regular":`facr`},utility:{"fa-semibold":`fausb`},"utility-duo":{"fa-semibold":`faudsb`},"utility-fill":{"fa-semibold":`faufsb`}},Ru={classic:[`fas`,`far`,`fal`,`fat`,`fad`],duotone:[`fadr`,`fadl`,`fadt`],sharp:[`fass`,`fasr`,`fasl`,`fast`],"sharp-duotone":[`fasds`,`fasdr`,`fasdl`,`fasdt`],slab:[`faslr`],"slab-press":[`faslpr`],"slab-duo":[`fasldr`],"slab-press-duo":[`faslpdr`],pixel:[`fapr`],mosaic:[`fams`],vellum:[`favs`],whiteboard:[`fawsb`],thumbprint:[`fatl`],notdog:[`fans`],"notdog-duo":[`fands`],etch:[`faes`],graphite:[`fagt`],jelly:[`fajr`],"jelly-fill":[`fajfr`],"jelly-duo":[`fajdr`],chisel:[`facr`],utility:[`fausb`],"utility-duo":[`faudsb`],"utility-fill":[`faufsb`]},zu={classic:{fab:`fa-brands`,fad:`fa-duotone`,fal:`fa-light`,far:`fa-regular`,fas:`fa-solid`,fat:`fa-thin`},duotone:{fadr:`fa-regular`,fadl:`fa-light`,fadt:`fa-thin`},sharp:{fass:`fa-solid`,fasr:`fa-regular`,fasl:`fa-light`,fast:`fa-thin`},"sharp-duotone":{fasds:`fa-solid`,fasdr:`fa-regular`,fasdl:`fa-light`,fasdt:`fa-thin`},slab:{faslr:`fa-regular`},"slab-press":{faslpr:`fa-regular`},"slab-duo":{fasldr:`fa-regular`},"slab-press-duo":{faslpdr:`fa-regular`},pixel:{fapr:`fa-regular`},mosaic:{fams:`fa-solid`},vellum:{favs:`fa-solid`},whiteboard:{fawsb:`fa-semibold`},thumbprint:{fatl:`fa-light`},notdog:{fans:`fa-solid`},"notdog-duo":{fands:`fa-solid`},etch:{faes:`fa-solid`},graphite:{fagt:`fa-thin`},jelly:{fajr:`fa-regular`},"jelly-fill":{fajfr:`fa-regular`},"jelly-duo":{fajdr:`fa-regular`},chisel:{facr:`fa-regular`},utility:{fausb:`fa-semibold`},"utility-duo":{faudsb:`fa-semibold`},"utility-fill":{faufsb:`fa-semibold`}},Bu=`fa.fas.far.fal.fat.fad.fadr.fadl.fadt.fab.fass.fasr.fasl.fast.fasds.fasdr.fasdl.fasdt.faslr.faslpr.fasldr.faslpdr.fapr.fams.favs.fawsb.fatl.fans.fands.faes.fagt.fajr.fajfr.fajdr.facr.fausb.faudsb.faufsb`.split(`.`).concat(Iu,[`fa-solid`,`fa-regular`,`fa-light`,`fa-thin`,`fa-duotone`,`fa-brands`,`fa-semibold`]),Vu=[`solid`,`regular`,`light`,`thin`,`duotone`,`brands`,`semibold`],Hu=[1,2,3,4,5,6,7,8,9,10],fee=Hu.concat([11,12,13,14,15,16,17,18,19,20]),pee=[].concat(il(Object.keys(Ru)),Vu,[`aw`,`fw`,`pull-left`,`pull-right`],[`2xs`,`xs`,`sm`,`lg`,`xl`,`2xl`,`beat`,`beat-fade`,`border`,`bounce`,`buzz`,`canvas-square`,`canvas-roomy`,`fade`,`flip-360`,`flip-both`,`flip-horizontal`,`flip-vertical`,`flip`,`float`,`inverse`,`jello`,`layers`,`layers-bottom-left`,`layers-bottom-right`,`layers-counter`,`layers-text`,`layers-top-left`,`layers-top-right`,`li`,`pull-end`,`pull-start`,`pulse`,`rotate-180`,`rotate-270`,`rotate-90`,`rotate-by`,`shake`,`spin-pulse`,`spin-reverse`,`spin`,`spin-snap`,`spin-snap-4`,`spin-snap-8`,`stack-1x`,`stack-2x`,`stack`,`swing`,`ul`,`wag`,`width-auto`,`width-fixed`,Fu.GROUP,Fu.SWAP_OPACITY,Fu.PRIMARY,Fu.SECONDARY],Hu.map(function(e){return`${e}x`}),fee.map(function(e){return`w-${e}`})),mee={"Font Awesome 5 Free":{900:`fas`,400:`far`},"Font Awesome 5 Pro":{900:`fas`,400:`far`,normal:`far`,300:`fal`},"Font Awesome 5 Brands":{400:`fab`,normal:`fab`},"Font Awesome 5 Duotone":{900:`fad`}},Uu=`___FONT_AWESOME___`,Wu=16,Gu=`fa`,Ku=`svg-inline--fa`,qu=`data-fa-i2svg`,Ju=`data-fa-pseudo-element`,Yu=`data-fa-pseudo-element-pending`,Xu=`data-prefix`,Zu=`data-icon`,Qu=`fontawesome-i2svg`,$u=`async`,ed=[`HTML`,`HEAD`,`STYLE`,`SCRIPT`],td=[`::before`,`::after`,`:before`,`:after`],nd=function(){try{return!0}catch{return!1}}();function rd(e){return new Proxy(e,{get:function(e,t){return t in e?e[t]:e[Ol]}})}var id=nl({},Tl);id[Ol]=nl(nl(nl(nl({},{"fa-duotone":`duotone`}),Tl[Ol]),Ou.kit),Ou[`kit-duotone`]);var ad=rd(id),od=nl({},Eu);od[Ol]=nl(nl(nl(nl({},{duotone:`fad`}),od[Ol]),Nu.kit),Nu[`kit-duotone`]);var sd=rd(od),cd=nl({},zu);cd[Ol]=nl(nl({},cd[Ol]),Mu.kit);var ld=rd(cd),ud=nl({},Lu);ud[Ol]=nl(nl({},ud[Ol]),Au.kit),rd(ud);var dd=Cl,fd=`fa-layers-text`,pd=wl;rd(nl({},Cu));var md=[`class`,`data-prefix`,`data-icon`,`data-fa-transform`,`data-fa-mask`],hd=El,gd=[].concat(il(ku),il(pee)),_d=gl.FontAwesomeConfig||{};function vd(e){var t=_l.querySelector(`script[`+e+`]`);if(t)return t.getAttribute(e)}function yd(e){return e===``?!0:e===`false`?!1:e===`true`||e}_l&&typeof _l.querySelector==`function`&&[[`data-family-prefix`,`familyPrefix`],[`data-css-prefix`,`cssPrefix`],[`data-family-default`,`familyDefault`],[`data-style-default`,`styleDefault`],[`data-replacement-class`,`replacementClass`],[`data-auto-replace-svg`,`autoReplaceSvg`],[`data-auto-add-css`,`autoAddCss`],[`data-search-pseudo-elements`,`searchPseudoElements`],[`data-search-pseudo-elements-warnings`,`searchPseudoElementsWarnings`],[`data-search-pseudo-elements-full-scan`,`searchPseudoElementsFullScan`],[`data-observe-mutations`,`observeMutations`],[`data-mutate-approach`,`mutateApproach`],[`data-keep-original-source`,`keepOriginalSource`],[`data-measure-performance`,`measurePerformance`],[`data-show-missing-icons`,`showMissingIcons`]].forEach(function(e){var t=rl(e,2),n=t[0],r=t[1],i=yd(vd(n));i!=null&&(_d[r]=i)});var bd={styleDefault:`solid`,familyDefault:Ol,cssPrefix:Gu,replacementClass:Ku,autoReplaceSvg:!0,autoAddCss:!0,searchPseudoElements:!1,searchPseudoElementsWarnings:!0,searchPseudoElementsFullScan:!1,observeMutations:!0,mutateApproach:`async`,keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};_d.familyPrefix&&(_d.cssPrefix=_d.familyPrefix);var xd=nl(nl({},bd),_d);xd.autoReplaceSvg||(xd.observeMutations=!1);var Sd={};Object.keys(bd).forEach(function(e){Object.defineProperty(Sd,e,{enumerable:!0,set:function(t){xd[e]=t,Cd.forEach(function(e){return e(Sd)})},get:function(){return xd[e]}})}),Object.defineProperty(Sd,"familyPrefix",{enumerable:!0,set:function(e){xd.cssPrefix=e,Cd.forEach(function(e){return e(Sd)})},get:function(){return xd.cssPrefix}}),gl.FontAwesomeConfig=Sd;var Cd=[];function wd(e){return Cd.push(e),function(){Cd.splice(Cd.indexOf(e),1)}}var Td=Wu,Ed={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function Dd(e){if(!(!e||!bl)){var t=_l.createElement(`style`);t.setAttribute(`type`,`text/css`),t.innerHTML=e;for(var n=_l.head.childNodes,r=null,i=n.length-1;i>-1;i--){var a=n[i],o=(a.tagName||``).toUpperCase();[`STYLE`,`LINK`].indexOf(o)>-1&&(r=a)}return _l.head.insertBefore(t,r),e}}var Od=`0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`;function kd(){for(var e=12,t=``;e-->0;)t+=Od[Math.random()*62|0];return t}function Ad(e){for(var t=[],n=(e||[]).length>>>0;n--;)t[n]=e[n];return t}function jd(e){return e.classList?Ad(e.classList):(e.getAttribute(`class`)||``).split(` `).filter(function(e){return e})}function Md(e){return`${e}`.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function Nd(e){return Object.keys(e||{}).reduce(function(t,n){return t+`${n}="${Md(e[n])}" `},``).trim()}function Pd(e){return Object.keys(e||{}).reduce(function(t,n){return t+`${n}: ${e[n].trim()};`},``)}function Fd(e){return e.size!==Ed.size||e.x!==Ed.x||e.y!==Ed.y||e.rotate!==Ed.rotate||e.flipX||e.flipY}function Id(e){var t=e.transform,n=e.containerWidth,r=e.iconWidth;return{outer:{transform:`translate(${n/2} 256)`},inner:{transform:`${`translate(${t.x*32}, ${t.y*32}) `} ${`scale(${t.size/16*(t.flipX?-1:1)}, ${t.size/16*(t.flipY?-1:1)}) `} ${`rotate(${t.rotate} 0 0)`}`},path:{transform:`translate(${r/2*-1} -256)`}}}function Ld(e){var t=e.transform,n=e.width,r=n===void 0?Wu:n,i=e.height,a=i===void 0?Wu:i,o=e.startCentered,s=o!==void 0&&o,c=``;return c+=s&&xl?`translate(${t.x/Td-r/2}em, ${t.y/Td-a/2}em) `:s?`translate(calc(-50% + ${t.x/Td}em), calc(-50% + ${t.y/Td}em)) `:`translate(${t.x/Td}em, ${t.y/Td}em) `,c+=`scale(${t.size/Td*(t.flipX?-1:1)}, ${t.size/Td*(t.flipY?-1:1)}) `,c+=`rotate(${t.rotate}deg) `,c}var Rd=`:root, :host {
@@ -1115,4 +1115,4 @@ Consider installing the package or pass your own 'workerFactory' to ELK's constr
1115
1115
  ... Falling back to non-web worker version.`);if(!r.workerFactory){var o=e("./elk-worker.min.js").Worker;r.workerFactory=function(e){return new o(e)}}return l(this,n,[r])}return m(n,t),a(n)}(e("./elk-api.js").default);Object.defineProperty(t.exports,"__esModule",{value:!0}),t.exports=g,g.default=g},{"./elk-api.js":1,"./elk-worker.min.js":2,"web-worker":4}],4:[function(e,t,n){t.exports=typeof Worker<`u`?Worker:void 0},{}]},{},[3])(3)})})),bte=qm(),Jm=_te(),xte=vte(),Ste=c(yte(),1);function Cte(){return new Ste.default}var wte=Cte(),Ym=264,Tte=52,Ete=54,Dte=5;function Xm(e){return e===0?Tte:57+e*Ete+(e-1)*Dte}async function Ote(e,t){let n=await wte.layout({id:e.id,layoutOptions:{"elk.algorithm":`layered`,"elk.direction":t,"elk.spacing.nodeNode":`44`,"elk.layered.spacing.nodeNodeBetweenLayers":`88`},children:e.stages.map(e=>({id:e.id,width:Ym,height:Xm(e.children.length)})),edges:e.transitions.map((e,t)=>({id:`${e.from}-${e.to}-${t}`,sources:[e.from],targets:[e.to]}))}),r=(n.children??[]).map(e=>({id:e.id,x:e.x??0,y:t===`RIGHT`?0:e.y??0,width:e.width??Ym,height:e.height??Xm(0)})),i=(n.edges??[]).map((t,n)=>{let r=e.transitions[n];return{id:t.id,label:r?.label??``,from:r?.from??``,to:r?.to??``,...r?.fromChildId===void 0?{}:{fromChildId:r.fromChildId},points:(t.sections??[]).flatMap(e=>[e.startPoint,...e.bendPoints??[],e.endPoint])}});return Object.freeze({width:n.width??Ym,height:n.height??Xm(0),nodes:Object.freeze(r.map(e=>Object.freeze(e))),edges:Object.freeze(i.map(e=>Object.freeze({...e,points:Object.freeze(e.points.map(e=>Object.freeze(e)))})))})}var Zm={diagram:`_diagram_1akxc_1`,dragging:`_dragging_1akxc_45`,canvas:`_canvas_1akxc_50`,canvasLoading:`_canvasLoading_1akxc_56`,edges:`_edges_1akxc_60`,edgeActive:`_edgeActive_1akxc_80`,edgeLabel:`_edgeLabel_1akxc_85`,edgeLabelActive:`_edgeLabelActive_1akxc_101`,stage:`_stage_1akxc_105`,stageCard:`_stageCard_1akxc_116`,stageTitleRow:`_stageTitleRow_1akxc_127`,chips:`_chips_1akxc_137`,metrics:`_metrics_1akxc_138`,stageTotals:`_stageTotals_1akxc_139`,children:`_children_1akxc_152`,childCard:`_childCard_1akxc_158`,childCardWithoutStatus:`_childCardWithoutStatus_1akxc_165`,childStatusDot:`_childStatusDot_1akxc_174`,collapsedStatusDot:`_collapsedStatusDot_1akxc_179`,collapsedStatusDots:`_collapsedStatusDots_1akxc_183`,childTitle:`_childTitle_1akxc_189`,childKindIcon:`_childKindIcon_1akxc_195`,"active-run-pulse":`_active-run-pulse_1akxc_1`,srOnly:`_srOnly_1akxc_258`},Qm={width:0,height:0,nodes:[],edges:[]},kte={activity:xte.faRobot,watch:Jm.faEye,"watch-gate":Jm.faEye,reactor:bte.faBolt};function Ate(e,t){let[n,r]=(0,S.useState)(Qm);return(0,S.useEffect)(()=>{if(t===`DOWN`){r(Qm);return}let n=!0;return Ote(e,t).then(e=>{n&&r(e)}),()=>{n=!1}},[e,t]),n}function jte(){let[e,t]=(0,S.useState)(()=>globalThis.matchMedia?.(`(max-width: 48rem)`).matches?`DOWN`:`RIGHT`);return(0,S.useEffect)(()=>{let e=globalThis.matchMedia?.(`(max-width: 48rem)`);if(e===void 0)return;let n=()=>t(e.matches?`DOWN`:`RIGHT`);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Mte(e){let t=(0,S.useRef)(null),n=(0,S.useRef)(new Map),[r,i]=(0,S.useState)(new Map),a=(0,S.useCallback)((e,t)=>{t===null?n.current.delete(e):n.current.set(e,t)},[]);return(0,S.useLayoutEffect)(()=>{let r=t.current;if(r===null||e.nodes.length===0)return;let a=()=>{let e=r.getBoundingClientRect(),t=new Map;for(let[r,i]of n.current){let n=i.getBoundingClientRect();t.set(r,{left:n.left-e.left,top:n.top-e.top,right:n.right-e.left,bottom:n.bottom-e.top});for(let n of i.querySelectorAll(`[data-diagram-child]`)){let i=n.getBoundingClientRect(),a=n.dataset.diagramChild;a!==void 0&&t.set(`${r}:${a}`,{left:i.left-e.left,top:i.top-e.top,right:i.right-e.left,bottom:i.bottom-e.top})}}i(t)};a();let o=globalThis.ResizeObserver===void 0?void 0:new ResizeObserver(a);o?.observe(r);for(let e of n.current.values())o?.observe(e);return()=>o?.disconnect()},[e]),{anchors:r,canvasRef:t,stageRef:a}}function $m(e){return e.totalTokens===void 0?null:(0,w.jsx)(Wm,{usage:{totalTokens:e.totalTokens,...e.inputTokens===void 0?{}:{inputTokens:e.inputTokens},...e.outputTokens===void 0?{}:{outputTokens:e.outputTokens},...e.cacheReadTokens===void 0?{}:{cacheReadTokens:e.cacheReadTokens},...e.cacheWriteTokens===void 0?{}:{cacheWriteTokens:e.cacheWriteTokens}}})}function Nte(e){return e.kind===`reactor`||e.runCount===void 0&&e.totalDurationMs===void 0&&e.totalCostUsd===void 0&&e.totalTokens===void 0?null:(0,w.jsxs)(`div`,{className:Zm.metrics,children:[e.runCount===void 0?null:(0,w.jsxs)(`span`,{children:[e.runCount,` runs`]}),e.totalDurationMs===void 0?null:(0,w.jsx)(`span`,{children:Rm(e.totalDurationMs)}),e.totalCostUsd===void 0?null:(0,w.jsx)(`span`,{children:Im(e.totalCostUsd)}),e.totalTokens===void 0?null:$m(e)]})}function Pte({child:e,onHover:t,showStatus:n}){let r=(e.activeRuns?.length??0)>0,i=eh(e,r);return(0,w.jsxs)(`article`,{className:`${Zm.childCard} ${Pm.childRun} ${n?``:Zm.childCardWithoutStatus}`,"data-diagram-child":e.id,"data-kind":e.kind,onMouseEnter:()=>t(e.id),onMouseLeave:()=>t(void 0),children:[n?(0,w.jsx)(`span`,{"aria-label":r?`active run`:`${i} status`,className:`${Pm.childRunDot} ${Zm.childStatusDot}`,"data-status":i,"data-active-run":r||void 0,"data-testid":`child-status-${e.id}`,role:`img`}):null,(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`${Pm.childRunTitle} ${Zm.childTitle}`,children:[(0,w.jsx)(T,{className:Zm.childKindIcon,icon:kte[e.kind]}),(0,w.jsx)(`span`,{children:e.label})]}),Nte(e),e.kind===`reactor`?null:e.activeRuns?.map(e=>(0,w.jsxs)(`div`,{className:Pm.childRunMeta,children:[(0,w.jsxs)(`span`,{children:[e.activity,` running`]}),e.runnerName===void 0?null:(0,w.jsxs)(w.Fragment,{children:[` `,`· `,(0,w.jsx)(`span`,{children:e.runnerName})]}),` · `,(0,w.jsx)(`span`,{children:Rm(Math.max(0,Date.now()-new Date(e.startedAt).getTime()))})]},e.runId))]})]})}function eh(e,t=!1){if(t)return`active`;if(e.lastOutcome===void 0)return e.status??`pending`;switch(Bm(e.lastOutcome)){case`good`:return`completed`;case`warning`:return`blocked`;case`bad`:return`failed`;case`info`:return`needs-clarification`;case`neutral`:return`pending`}}function Fte(e){if(e.length<2)return``;let t=`M ${e[0].x} ${e[0].y}`;for(let n=1;n<e.length;n+=1){let r=e[n-1],i=e[n],a=e[n+1];if(a===void 0){t+=` L ${i.x} ${i.y}`;continue}let o=Math.min(10,Math.hypot(i.x-r.x,i.y-r.y)/2),s=Math.min(10,Math.hypot(a.x-i.x,a.y-i.y)/2),c={x:i.x+(r.x-i.x)*o/Math.hypot(r.x-i.x,r.y-i.y),y:i.y+(r.y-i.y)*o/Math.hypot(r.x-i.x,r.y-i.y)},l={x:i.x+(a.x-i.x)*s/Math.hypot(a.x-i.x,a.y-i.y),y:i.y+(a.y-i.y)*s/Math.hypot(a.x-i.x,a.y-i.y)};t+=` L ${c.x} ${c.y} Q ${i.x} ${i.y} ${l.x} ${l.y}`}return t}function th(e,t){return e.fromChildId===void 0?t.stages.find(t=>t.id===e.from)?.children.find(e=>e.kind===`activity`)?.id:e.fromChildId}function nh(e,t,n,r,i){if(e.points.length===0)return e.points;let a=n.get(e.from),o=t.stages.find(t=>t.id===e.from),s=th(e,t),c=o?.children.findIndex(e=>e.id===s)??-1,l=r.get(s===void 0?e.from:`${e.from}:${s}`),u=r.get(e.to);if(l!==void 0&&u!==void 0){let n=i===`RIGHT`?{x:l.right,y:(l.top+l.bottom)/2}:{x:(l.left+l.right)/2,y:l.bottom},a=i===`RIGHT`?{x:u.left,y:u.top+16}:{x:(u.left+u.right)/2,y:u.top};if(i===`RIGHT`){let i=t.stages.filter(t=>t.id!==e.from&&t.id!==e.to).map(e=>r.get(e.id)).filter(e=>e!==void 0&&e.left>=n.x&&e.right<=a.x);if(i.length>0){let e=Math.max(l.bottom,u.bottom,...i.map(e=>e.bottom))+24,t=n.x+18,r=a.x-18;return[n,{x:t,y:n.y},{x:t,y:e},{x:r,y:e},{x:r,y:a.y},a]}if(n.y===a.y)return[n,a];let o=(n.x+a.x)/2;return[n,{x:o,y:n.y},{x:o,y:a.y},a]}if(n.x===a.x)return[n,a];let o=(n.y+a.y)/2;return[n,{x:n.x,y:o},{x:a.x,y:o},a]}if(s===void 0||a===void 0||c<0)return e.points;let d=57+c*59+27;return[i===`RIGHT`?{x:a.x+a.width,y:a.y+d}:{x:a.x+a.width/2,y:a.y+d+52},...e.points.slice(1)]}function Ite(e){if(e.length===0)return;if(e.length===1)return e[0];let t=e.slice(1).map((t,n)=>Math.hypot(t.x-e[n].x,t.y-e[n].y)),n=t.reduce((e,t)=>e+t,0)/2,r=0;for(let i=0;i<t.length;i+=1){let a=t[i];if(r+a>=n){let t=e[i],o=e[i+1],s=(n-r)/a;return{x:t.x+(o.x-t.x)*s,y:t.y+(o.y-t.y)*s}}r+=a}return e.at(-1)}function rh({diagram:e}){let t=jte(),n=Ate(e,t),{anchors:r,canvasRef:i,stageRef:a}=Mte(n),o=(0,S.useRef)(void 0),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(()=>{let t=e.stages.filter(e=>(e.activeRuns?.length??0)>0||e.children.some(e=>(e.activeRuns?.length??0)>0));return new Set(t.map(e=>e.id))}),[d,f]=(0,S.useState)(),p=e.stages.some(e=>e.status!==void 0||e.lastOutcome!==void 0||e.activeRuns!==void 0||e.runCount!==void 0||e.children.some(e=>e.status!==void 0||e.lastOutcome!==void 0||e.activeRuns!==void 0||e.runCount!==void 0)),m=new Map(n.nodes.map(e=>[e.id,e])),h=l.size>0,g=n.width||(t===`RIGHT`?e.stages.length*352:300),_=n.edges.flatMap(n=>nh(n,e,m,r,t)),v=Math.max(0,...Array.from(r.values(),e=>e.bottom),..._.map(e=>e.y)),y=t===`RIGHT`&&v>0?v+20:n.height||(t===`RIGHT`?176:e.stages.length*172),b=t===`DOWN`||n.nodes.length>0&&r.size>0,x=e=>{if(t!==`RIGHT`||e.button!==0)return;let n=e.currentTarget;o.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:n.scrollLeft},n.setPointerCapture(e.pointerId),c(!0)},ee=e=>{let t=o.current;t!==void 0&&t.pointerId===e.pointerId&&(e.currentTarget.scrollLeft=t.scrollLeft-(e.clientX-t.startX))},te=e=>{o.current?.pointerId===e.pointerId&&(o.current=void 0,c(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,w.jsx)(`section`,{"aria-label":`Workflow ${e.label}`,className:`${Zm.diagram} ${s?Zm.dragging:``}`,"data-direction":t,onPointerCancel:te,onPointerDown:x,onPointerMove:ee,onPointerUp:te,children:(0,w.jsxs)(`div`,{ref:i,className:`${Zm.canvas} ${b?``:Zm.canvasLoading}`,"data-direction":t,style:{"--graph-width":`${g}px`,"--graph-height":`${y}px`},children:[(0,w.jsxs)(`svg`,{className:Zm.edges,"aria-hidden":`true`,viewBox:`0 0 ${g} ${y}`,preserveAspectRatio:`none`,children:[(0,w.jsx)(`defs`,{children:(0,w.jsx)(`marker`,{id:`workflow-arrow`,markerWidth:`8`,markerHeight:`8`,refX:`7`,refY:`4`,orient:`auto`,children:(0,w.jsx)(`path`,{d:`M 0 0 L 8 4 L 0 8 z`,fill:`context-stroke`})})}),n.edges.map(n=>{let i=nh(n,e,m,r,t),a=th(n,e)===d;return(0,w.jsx)(`g`,{className:a?Zm.edgeActive:Zm.edge,children:(0,w.jsx)(`path`,{d:Fte(i),markerEnd:`url(#workflow-arrow)`})},n.id)})]}),n.edges.map(n=>{let i=Ite(nh(n,e,m,r,t)),a=th(n,e)===d;return i===void 0||n.label.length===0?null:(0,w.jsx)(`span`,{className:`${Zm.edgeLabel} ${a?Zm.edgeLabelActive:``}`,style:{left:`${i.x}px`,top:`${i.y}px`},children:n.label},`${n.id}-label`)}),e.stages.map((e,n)=>{let r=m.get(e.id),i=t===`RIGHT`||l.has(e.id),o=t===`RIGHT`?n*352:18,s=t===`RIGHT`?20:n*172,c=e.runCount!==void 0||e.totalDurationMs!==void 0||e.totalCostUsd!==void 0||e.totalTokens!==void 0,d=()=>u(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n});return(0,w.jsxs)(`div`,{className:`${Zm.stage} ${Pm.card}`,ref:t=>a(e.id,t),role:`group`,"aria-label":`Stage ${e.id}`,style:t===`RIGHT`?{left:`${r?.x??o}px`,top:`${r?.y??s}px`,width:`${r?.width??264}px`}:void 0,children:[(0,w.jsxs)(`div`,{"aria-expanded":t===`DOWN`?i:void 0,className:`${Zm.stageCard} ${Pm.cardLink}`,onClick:t===`DOWN`?d:void 0,onKeyDown:t===`DOWN`?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),d())}:void 0,role:t===`DOWN`?`button`:void 0,tabIndex:t===`DOWN`?0:void 0,children:[(0,w.jsx)(`div`,{children:(0,w.jsx)(`div`,{className:Zm.stageTitleRow,children:(0,w.jsx)(`strong`,{className:Pm.cardTitle,children:e.label})})}),t===`DOWN`&&p&&!i?(0,w.jsx)(`span`,{className:Zm.collapsedStatusDots,children:e.children.map(t=>(0,w.jsx)(`span`,{"aria-label":`${eh(t,(t.activeRuns?.length??0)>0)} status`,className:`${Pm.childRunDot} ${Zm.childStatusDot} ${Zm.collapsedStatusDot}`,"data-active-run":(t.activeRuns?.length??0)>0||void 0,"data-status":eh(t,(t.activeRuns?.length??0)>0),"data-testid":`collapsed-status-${e.id}-${t.id}`,role:`img`},t.id))}):null,c?(0,w.jsxs)(`div`,{className:Zm.stageTotals,children:[e.runCount===void 0?null:(0,w.jsxs)(`span`,{children:[e.runCount,` runs`]}),e.totalDurationMs===void 0?null:(0,w.jsx)(`span`,{children:Rm(e.totalDurationMs)}),e.totalCostUsd===void 0?null:(0,w.jsx)(`span`,{children:Im(e.totalCostUsd)}),e.totalTokens===void 0?null:$m(e)]}):null]}),i?(0,w.jsx)(`div`,{className:Zm.children,style:t===`DOWN`?{display:`grid`,visibility:`visible`}:void 0,children:e.children.map(e=>(0,w.jsx)(Pte,{child:e,onHover:t===`RIGHT`?f:()=>void 0,showStatus:p},e.id))}):null]},e.id)}),h?null:(0,w.jsx)(`span`,{className:Zm.srOnly,children:`All stages are collapsed.`})]})})}function Lte(){let e=Oc(),[t,n]=(0,S.useState)(`configuration`),r=fi({queryKey:vm.system.configuration,queryFn:({signal:t})=>e.system.configuration(t),refetchInterval:ym.configuration}),i=fi({queryKey:vm.system.commands,queryFn:({signal:t})=>e.system.commands(t),refetchInterval:ym.commands,enabled:t===`commands`}),a=fi({queryKey:vm.workflowDiagrams.get(),queryFn:({signal:t})=>e.workflowDiagrams.get(void 0,t),refetchInterval:ym.workflowDiagrams,enabled:t===`workflows`}),o=fi({queryKey:vm.system.webhooks,queryFn:({signal:t})=>e.system.webhooks(t),refetchInterval:ym.webhooks,enabled:t===`webhooks`}),s=e=>{let t=Array.from(e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)??[]),r=t.indexOf(e.currentTarget);if(r<0)return;let i=e.key===`ArrowRight`?(r+1)%t.length:e.key===`ArrowLeft`?(r-1+t.length)%t.length:void 0;if(i===void 0)return;e.preventDefault();let a=t[i];a!==void 0&&(n(a.dataset.tab),a.focus())},c=(0,w.jsx)(Cm,{actions:(0,w.jsxs)(Tm,{type:`button`,variant:`secondary`,onClick:()=>void(t===`commands`?i.refetch():t===`workflows`?a.refetch():t===`webhooks`?o.refetch():r.refetch()),children:[`Refresh`,` `,t===`commands`?`commands`:t===`workflows`?`workflows`:t===`webhooks`?`webhooks`:`configuration`]})});return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:Pm.tabs,role:`tablist`,"aria-label":`Configuration sections`,children:[(0,w.jsx)(`button`,{type:`button`,role:`tab`,"data-tab":`configuration`,id:`configuration-tab`,"aria-controls":`configuration-panel`,"aria-selected":t===`configuration`,tabIndex:t===`configuration`?0:-1,onKeyDown:s,onClick:()=>n(`configuration`),children:`Configuration`}),(0,w.jsx)(`button`,{type:`button`,role:`tab`,"data-tab":`commands`,id:`commands-tab`,"aria-controls":`commands-panel`,"aria-selected":t===`commands`,tabIndex:t===`commands`?0:-1,onKeyDown:s,onClick:()=>n(`commands`),children:`Commands`}),(0,w.jsx)(`button`,{type:`button`,role:`tab`,"data-tab":`webhooks`,id:`webhooks-tab`,"aria-controls":`webhooks-panel`,"aria-selected":t===`webhooks`,tabIndex:t===`webhooks`?0:-1,onKeyDown:s,onClick:()=>n(`webhooks`),children:`Webhooks`}),(0,w.jsx)(`button`,{type:`button`,role:`tab`,"data-tab":`workflows`,id:`workflows-tab`,"aria-controls":`workflows-panel`,"aria-selected":t===`workflows`,tabIndex:t===`workflows`?0:-1,onKeyDown:s,onClick:()=>n(`workflows`),children:`Workflows`})]}),t===`commands`?(0,w.jsxs)(`section`,{id:`commands-panel`,role:`tabpanel`,"aria-labelledby":`commands-tab`,className:Pm.tabPanel,children:[c,i.isPending?(0,w.jsx)(Dm,{label:`Loading commands`}):i.error&&!i.data?(0,w.jsx)(km,{error:i.error,retry:()=>void i.refetch()}):i.data&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`p`,{children:`Commands and actions recognized by each configured surface adapter.`}),i.data.data.adapters.length===0?(0,w.jsx)(Om,{children:`No adapters expose commands`}):i.data.data.adapters.map(e=>(0,w.jsxs)(wm,{children:[(0,w.jsx)(`h2`,{children:e.adapter}),e.commands.length===0?(0,w.jsx)(Om,{children:`No commands`}):(0,w.jsx)(`ul`,{children:e.commands.map(e=>(0,w.jsx)(`li`,{children:(0,w.jsx)(`code`,{children:e.syntax})},e.syntax))})]},e.adapter))]})]}):t===`webhooks`?(0,w.jsxs)(`section`,{id:`webhooks-panel`,role:`tabpanel`,"aria-labelledby":`webhooks-tab`,className:Pm.tabPanel,children:[c,o.isPending?(0,w.jsx)(Dm,{label:`Loading webhook setup instructions`}):o.error&&!o.data?(0,w.jsx)(km,{error:o.error,retry:()=>void o.refetch()}):o.data?.data.adapters.length===0?(0,w.jsx)(Om,{children:`No webhook-enabled adapters are configured`}):o.data?.data.adapters.flatMap(e=>e.hooks.map(t=>(0,w.jsxs)(wm,{children:[(0,w.jsx)(`h2`,{children:t.scope}),(0,w.jsxs)(`p`,{children:[`Configure this webhook manually in `,e.provider,` when Wake cannot manage it.`]}),(0,w.jsxs)(`p`,{children:[`Payload URL: `,(0,w.jsx)(`code`,{children:t.endpoint})]}),(0,w.jsxs)(`p`,{children:[`Content type: `,(0,w.jsx)(`code`,{children:`application/json`})]}),(0,w.jsxs)(`p`,{children:[`Events: `,(0,w.jsx)(`code`,{children:t.events.join(`, `)})]}),(0,w.jsxs)(`p`,{children:[`Signing secret: `,(0,w.jsx)(`code`,{children:t.secret})]})]},`${e.adapter}:${t.scope}`)))]}):t===`workflows`?(0,w.jsxs)(`section`,{id:`workflows-panel`,role:`tabpanel`,"aria-labelledby":`workflows-tab`,className:Pm.tabPanel,children:[c,a.isPending?(0,w.jsx)(Dm,{label:`Loading workflows`}):a.error&&!a.data?(0,w.jsx)(km,{error:a.error,retry:()=>void a.refetch()}):a.data?.data.diagrams.length===0?(0,w.jsx)(Om,{children:`No workflows are configured`}):a.data?.data.diagrams.map(e=>(0,w.jsxs)(`section`,{"aria-labelledby":`workflow-${e.id}`,children:[(0,w.jsx)(`h2`,{id:`workflow-${e.id}`,children:e.label}),(0,w.jsx)(rh,{diagram:e})]},e.id))]}):(0,w.jsxs)(`section`,{id:`configuration-panel`,role:`tabpanel`,"aria-labelledby":`configuration-tab`,className:Pm.tabPanel,children:[c,r.isPending?(0,w.jsx)(Dm,{label:`Loading redacted configuration`}):r.error&&!r.data?(0,w.jsx)(km,{error:r.error,retry:()=>void r.refetch()}):r.data&&(0,w.jsxs)(wm,{children:[(0,w.jsx)(`p`,{children:`Read-only effective configuration. Secrets are redacted by Wake.`}),(0,w.jsx)(Vee,{value:r.data.data.configuration})]})]})]})}function ih(){let[e,t]=Bn(),n=e.get(`cursor`)??void 0,r=e.getAll(`previous`);return{...n===void 0?{}:{cursor:n},hasPrevious:r.length>0,next(r){let i=new URLSearchParams(e);i.append(`previous`,n??``),i.set(`cursor`,r),t(i)},previous(){let n=r.at(-1);if(n===void 0)return;let i=new URLSearchParams(e);i.delete(`previous`);for(let e of r.slice(0,-1))i.append(`previous`,e);n===``?i.delete(`cursor`):i.set(`cursor`,n),t(i)},setFilter(n,r){let i=new URLSearchParams(e);r===``?i.delete(n):i.set(n,r),i.delete(`cursor`),i.delete(`previous`),t(i,{replace:!0})}}}function ah({navigation:e,nextCursor:t,hasMore:n}){return(0,w.jsxs)(`nav`,{className:Sm.pagination,"aria-label":`Collection pages`,children:[(0,w.jsx)(Tm,{type:`button`,variant:`secondary`,disabled:!e.hasPrevious,onClick:e.previous,children:`Previous page`}),(0,w.jsx)(Tm,{type:`button`,variant:`secondary`,disabled:!n||t===null,onClick:()=>t!==null&&e.next(t),children:`Next page`})]})}function oh(e,t,n){let r=new Intl.DateTimeFormat(t??`en-CA`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`,...n===void 0?{}:{timeZone:n}}),i=Object.fromEntries(r.formatToParts(new Date(e)).map(e=>[e.type,e.value]));return`${i.year}-${i.month}-${i.day} ${i.hour}:${i.minute}`}function sh({value:e,locale:t,timeZone:n}){return(0,w.jsx)(`time`,{dateTime:e,title:e,"aria-label":`${oh(e,t,n)}; exact UTC ${e}`,children:oh(e,t,n)})}function Rte(){let e=Oc(),t=ih();return(0,w.jsx)(zte,{client:e,navigation:t},t.cursor??`initial`)}function zte({client:e,navigation:t}){let n=(0,S.useRef)({page:t.cursor,live:t.cursor}),[r,i]=(0,S.useState)([]),a=fi({queryKey:vm.events.list(t.cursor),queryFn:async({signal:t})=>e.events.list(n.current.live,void 0,t),refetchInterval:e=>e.state.data?.page.hasMore!==!0&&ym.events});return(0,S.useEffect)(()=>{a.data!==void 0&&(i(e=>lh(e,a.data.items)),!a.data.page.hasMore&&a.data.page.nextCursor!==null&&(n.current.live=a.data.page.nextCursor))},[a.data]),(0,w.jsx)(w.Fragment,{children:a.isPending?(0,w.jsx)(Dm,{label:`Loading events`}):a.error&&!a.data?(0,w.jsx)(km,{error:a.error,retry:()=>void a.refetch()}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Bte,{records:r}),a.data&&(0,w.jsx)(ah,{navigation:t,nextCursor:a.data.page.nextCursor,hasMore:a.data.page.hasMore})]})})}function ch({record:e}){let[t,n]=(0,S.useState)(!1);return(0,w.jsxs)(`li`,{className:Pm.event,children:[(0,w.jsxs)(`button`,{type:`button`,className:Pm.eventButton,onClick:()=>n(e=>!e),"aria-expanded":t,children:[(0,w.jsx)(sh,{value:e.occurredAt}),(0,w.jsx)(`span`,{className:Pm.eventType,children:e.type}),(0,w.jsx)(`span`,{className:Pm.eventId,children:e.id}),(0,w.jsx)(`span`,{className:Pm.eventChevron,"aria-hidden":`true`,children:t?`v`:`>`})]}),t&&(0,w.jsx)(`div`,{className:Pm.eventPayload,children:(0,w.jsx)(`pre`,{children:JSON.stringify(e,null,2)})})]})}function Bte({records:e}){let[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(!1),[a,o]=(0,S.useState)(()=>[...e]),[s,c]=(0,S.useState)([]),l=(0,S.useRef)(a.at(-1)?.position??-1),u=t||r;(0,S.useEffect)(()=>{let e=()=>{let e=document.scrollingElement??document.documentElement;i(e.scrollHeight-e.scrollTop-e.clientHeight>1)};return window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),(0,S.useEffect)(()=>{let t=e.filter(e=>e.position>l.current);t.length!==0&&(u?c(e=>lh(e,t)):(o(e=>lh(e,t)),l.current=t.at(-1).position))},[e,u]);let d=(0,S.useMemo)(()=>[...a].sort((e,t)=>t.position-e.position),[a]),f=()=>{o(e=>lh(e,s)),l.current=Math.max(l.current,...s.map(e=>e.position)),c([]),n(!1),i(!1)};return(0,w.jsxs)(`section`,{children:[(0,w.jsxs)(`div`,{className:Pm.toolbar,children:[(0,w.jsx)(Tm,{type:`button`,variant:`secondary`,onClick:()=>u?f():n(!0),children:u?`Resume live view`:`Pause live view`}),s.length>0&&(0,w.jsxs)(Tm,{type:`button`,onClick:f,"aria-live":`polite`,children:[s.length,` new `,s.length===1?`event`:`events`]})]}),d.length===0?(0,w.jsx)(Om,{children:`No events`}):(0,w.jsx)(`ol`,{className:Pm.eventList,children:d.map(e=>(0,w.jsx)(ch,{record:e},e.id))})]})}function lh(e,t,n=200){return[...new Map([...e,...t].map(e=>[e.id,e])).values()].sort((e,t)=>e.position-t.position).slice(-n)}function uh({caption:e,rows:t,rowKey:n,columns:r,tableClassName:i}){return(0,w.jsx)(`div`,{className:Sm.tableWrap,children:(0,w.jsxs)(`table`,{className:[Sm.table,i].filter(Boolean).join(` `),children:[(0,w.jsx)(`caption`,{children:e}),(0,w.jsx)(`thead`,{children:(0,w.jsx)(`tr`,{children:r.map(e=>(0,w.jsx)(`th`,{scope:`col`,children:e.label},e.label))})}),(0,w.jsx)(`tbody`,{children:t.map(e=>(0,w.jsx)(`tr`,{children:r.map(t=>(0,w.jsx)(`td`,{"data-label":t.label,children:(0,w.jsx)(`div`,{children:t.render(e)})},t.label))},n(e)))})]})})}function Vte(){let e=Oc(),[t,n]=(0,S.useState)(`overview`),r=[[`overview`,`Overview`],[`adapters`,`Adapter health`],[`runners`,`Runner availability`],[`maintenance`,`Maintenance recovery`]],i=e=>{let t=Array.from(e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)??[]),n=t.indexOf(e.currentTarget),r=e.key===`ArrowRight`?(n+1)%t.length:e.key===`ArrowLeft`?(n-1+t.length)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:void 0;r!==void 0&&(e.preventDefault(),t[r]?.click(),t[r]?.focus())},a=Qr(),o=fi({queryKey:vm.system.health,queryFn:({signal:t})=>e.system.health(t),refetchInterval:ym.health}),s=fi({queryKey:vm.execution.runners,queryFn:({signal:t})=>e.execution.runners(t),refetchInterval:ym.runners}),c=fi({queryKey:vm.controlPlane.status,queryFn:({signal:t})=>e.controlPlane.status(t),refetchInterval:ym.status}),l=pi({mutationKey:[`control-plane`,`clear-maintenance`],mutationFn:t=>e.controlPlane.clearMaintenance(t,crypto.randomUUID()),onSuccess:()=>{a.invalidateQueries({queryKey:vm.controlPlane.status}),a.invalidateQueries({queryKey:vm.system.health})}}),u=async(t,n)=>{let r=crypto.randomUUID();n?await e.execution.unpauseRunner(t,r):await e.execution.pauseRunner(t,r),await s.refetch()};return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:Pm.tabs,role:`tablist`,"aria-label":`Health sections`,children:r.map(([e,r])=>(0,w.jsx)(`button`,{type:`button`,role:`tab`,id:`health-${e}-tab`,"aria-controls":`health-${e}-panel`,"aria-selected":t===e,tabIndex:t===e?0:-1,onKeyDown:i,onClick:()=>n(e),children:r},e))}),(0,w.jsxs)(`section`,{className:Pm.tabPanel,role:`tabpanel`,id:`health-${t}-panel`,"aria-labelledby":`health-${t}-tab`,children:[(0,w.jsx)(Cm,{actions:(0,w.jsx)(Tm,{type:`button`,variant:`secondary`,onClick:()=>{o.refetch(),s.refetch(),c.refetch()},children:`Refresh health`})}),t===`overview`&&(0,w.jsx)(w.Fragment,{children:o.isPending?(0,w.jsx)(Dm,{label:`Checking health`}):o.error&&!o.data?(0,w.jsx)(km,{error:o.error,retry:()=>void o.refetch()}):o.data&&(0,w.jsx)(Hte,{health:o.data.data})}),t===`maintenance`&&(0,w.jsx)(w.Fragment,{children:c.isPending?(0,w.jsx)(Dm,{label:`Checking maintenance`}):c.error&&!c.data?(0,w.jsx)(km,{error:c.error,retry:()=>void c.refetch()}):c.data?.data.maintenanceLease?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`h2`,{children:`Maintenance recovery`}),(0,w.jsxs)(wm,{children:[(0,w.jsx)(Em,{tone:c.data.data.maintenanceLease.phase===`failed`?`bad`:`warning`,children:c.data.data.maintenanceLease.phase}),(0,w.jsxs)(`p`,{children:[`Started: `,c.data.data.maintenanceLease.startedAt]}),c.data.data.maintenanceLease.failure?(0,w.jsxs)(`p`,{children:[`Failure: `,c.data.data.maintenanceLease.failure]}):(0,w.jsx)(Om,{children:`No maintenance lease`}),c.data.data.maintenanceLease.phase===`failed`?(0,w.jsx)(Tm,{type:`button`,disabled:l.isPending,onClick:()=>{window.confirm(`Clear this failed maintenance lease? This immediately resumes intake and dispatch. Confirm the update attempt is abandoned.`)&&l.mutate(c.data.data.maintenanceLease.attemptId)},children:`Clear failed maintenance`}):(0,w.jsx)(`p`,{children:`Maintenance is active and cannot be cleared until the update fails.`})]})]}):(0,w.jsx)(Om,{children:`No maintenance lease`})}),t===`adapters`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`h2`,{children:`Adapter health`}),o.isPending?(0,w.jsx)(Dm,{label:`Checking adapters`}):o.error&&!o.data?(0,w.jsx)(km,{error:o.error,retry:()=>void o.refetch()}):o.data&&(o.data.data.adapters?.length??0)===0?(0,w.jsx)(Om,{children:`No adapter health reported`}):o.data&&(0,w.jsx)(uh,{caption:`Adapter health`,tableClassName:Pm.adapterHealthTable,rows:o.data.data.adapters,rowKey:e=>`${e.adapter}:${e.scope}:${e.channel}`,columns:[{label:`Adapter`,render:e=>e.adapter},{label:`Scope`,render:e=>e.scope},{label:`Channel`,render:e=>e.channel},{label:`Status`,render:e=>(0,w.jsx)(Em,{tone:e.status===`ok`?`good`:`warning`,children:e.status})},{label:`Successes`,render:e=>e.successCount},{label:`Failures`,render:e=>e.failureCount},{label:`Detail`,render:e=>e.detail??`—`}]})]}),t===`runners`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`h2`,{children:`Runner availability`}),s.isPending?(0,w.jsx)(Dm,{label:`Loading runners`}):s.error&&!s.data?(0,w.jsx)(km,{error:s.error,retry:()=>void s.refetch()}):(s.data?.items.length??0)===0?(0,w.jsx)(Om,{children:`No runners configured`}):(0,w.jsx)(uh,{caption:`Runner availability`,rows:s.data.items,rowKey:e=>e.runnerId,columns:[{label:`Runner`,render:e=>e.runnerId},{label:`Availability`,render:e=>(0,w.jsx)(Em,{tone:e.available?`good`:`warning`,children:e.status})},{label:`Detail`,render:e=>e.detail??`—`},{label:`Control`,render:e=>(0,w.jsx)(Tm,{type:`button`,variant:`secondary`,onClick:()=>void u(e.runnerId,!e.available),children:e.available?`Pause`:`Unpause`})}]})]})]})]})}function Hte({health:e}){let t=e.checks??[],n=t.filter(e=>e.status===`ok`),r=t.filter(e=>e.status===`degraded`),i=[...r,...n];return(0,w.jsxs)(`div`,{className:Pm.healthOverview,children:[(0,w.jsx)(wm,{children:(0,w.jsxs)(`div`,{className:Pm.healthSummary,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:Pm.healthEyebrow,children:`System health`}),(0,w.jsxs)(Em,{tone:e.status===`ok`?`good`:`warning`,children:[`Wake `,e.status]})]}),(0,w.jsxs)(`dl`,{className:Pm.healthMeta,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Version`}),(0,w.jsx)(`dd`,{children:e.version})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Last checked`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(`time`,{dateTime:e.checkedAt,children:new Date(e.checkedAt).toLocaleString()})})]})]})]})}),(0,w.jsxs)(wm,{labelledBy:`health-checks-title`,children:[(0,w.jsxs)(`div`,{className:Pm.healthChecksHeader,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:Pm.healthEyebrow,children:`Checks`}),(0,w.jsx)(`h2`,{id:`health-checks-title`,children:`System checks`})]}),(0,w.jsxs)(`div`,{className:Pm.healthCounts,"aria-label":`Health check counts`,children:[(0,w.jsxs)(`span`,{children:[n.length,` healthy`]}),r.length>0&&(0,w.jsxs)(`span`,{children:[r.length,` need attention`]})]})]}),i.length===0?(0,w.jsx)(Om,{children:`No health checks reported`}):(0,w.jsx)(`ul`,{className:Pm.healthCheckList,children:i.map(e=>(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`strong`,{children:e.name}),e.detail&&(0,w.jsx)(`span`,{children:e.detail})]}),(0,w.jsx)(Em,{tone:e.status===`ok`?`good`:`warning`,children:e.status===`ok`?`Healthy`:`Needs attention`})]},e.name))})]})]})}function Ute({label:e,value:t}){return(0,w.jsxs)(`div`,{className:Sm.tile,role:`group`,"aria-label":e,children:[(0,w.jsx)(`div`,{className:Sm.tileValue,children:t}),(0,w.jsx)(`div`,{className:Sm.tileLabel,children:e})]})}function Wte(){let e=Oc(),t=fi({queryKey:vm.observability.metrics(7),queryFn:({signal:t})=>e.observability.metrics(7,t),refetchInterval:ym.observability});return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Cm,{actions:(0,w.jsx)(Tm,{type:`button`,variant:`secondary`,onClick:()=>void t.refetch(),children:`Refresh metrics`})}),t.isPending?(0,w.jsx)(Dm,{label:`Loading metrics`}):t.error&&!t.data?(0,w.jsx)(km,{error:t.error,retry:()=>void t.refetch()}):Object.keys(t.data?.data.values??{}).length===0?(0,w.jsx)(Om,{children:`No metrics available`}):(0,w.jsx)(`div`,{className:Pm.tiles,children:Object.entries(t.data.data.values).map(([e,t])=>(0,w.jsx)(Ute,{label:e,value:String(t)},e))})]})}function Gte(){let e=Oc(),t=ih(),n=fi({queryKey:vm.execution.runList(t.cursor),queryFn:({signal:n})=>e.execution.runs(t.cursor,n),refetchInterval:e=>bm.runs(e.state.data?.items)});return(0,w.jsxs)(w.Fragment,{children:[n.isPending?(0,w.jsx)(Dm,{label:`Loading runs`}):n.error&&!n.data?(0,w.jsx)(km,{error:n.error,retry:()=>void n.refetch()}):(n.data?.items.length??0)===0?(0,w.jsx)(Om,{children:`No runs`}):(0,w.jsx)(uh,{caption:`Execution runs`,rows:n.data.items,rowKey:e=>e.runId,columns:dh}),n.data&&(0,w.jsx)(ah,{navigation:t,nextCursor:n.data.page.nextCursor,hasMore:n.data.page.hasMore})]})}var dh=[{label:`Run`,render:e=>(0,w.jsx)(Pn,{to:`/runs/${encodeURIComponent(e.runId)}`,children:e.runId})},{label:`Activity`,render:e=>e.activity},{label:`Workflow`,render:e=>e.workflowName??`?`},{label:`Stage`,render:e=>e.stage??`?`},{label:`Runner`,render:e=>Kte(e)},{label:`Status`,render:e=>fh(e)},{label:`Started`,render:e=>(0,w.jsx)(sh,{value:e.startedAt})},{label:`Duration`,render:e=>qte(e)},{label:`Usage`,render:e=>(0,w.jsx)(Wm,{usage:e})},{label:`Cost`,render:e=>Im(e.totalCostUsd)}];function Kte(e){return e.runnerName===void 0?`?`:e.runnerModel===void 0?e.runnerName:`${e.runnerName} (${e.runnerModel})`}function qte(e){let t=e.active?Date.now():e.finishedAt===void 0?void 0:Date.parse(e.finishedAt);return t===void 0?``:Rm(t-Date.parse(e.startedAt))}function fh(e){return e.status===`starting`?`Starting`:e.status===`started`?`Running`:e.resolution?.sentinel??e.sentinel}function Jte(){let{runId:e=``}=St(),t=Oc(),n=fi({queryKey:vm.execution.run(e),queryFn:({signal:n})=>t.execution.run(e,n),refetchInterval:e=>bm.runs(e.state.data===void 0?void 0:[e.state.data.data])}),r=fi({queryKey:vm.execution.transcript(e),queryFn:({signal:n})=>t.execution.transcript(e,n),refetchInterval:ym.historicalRuns,enabled:e!==``});return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`h2`,{children:`Run ${e}`}),n.isPending?(0,w.jsx)(Dm,{label:`Loading run`}):n.error?(0,w.jsx)(km,{error:n.error,retry:()=>void n.refetch()}):n.data&&(0,w.jsxs)(wm,{children:[(0,w.jsx)(Em,{children:fh(n.data.data)}),(0,w.jsxs)(`dl`,{className:Pm.summary,children:[(0,w.jsx)(`dt`,{children:`Activity`}),(0,w.jsx)(`dd`,{children:n.data.data.activity}),(0,w.jsx)(`dt`,{children:`Attempt`}),(0,w.jsx)(`dd`,{children:n.data.data.attempt}),(0,w.jsx)(`dt`,{children:`Started`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(sh,{value:n.data.data.startedAt})}),n.data.data.finishedAt!==void 0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`dt`,{children:`Finished`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(sh,{value:n.data.data.finishedAt})})]})]}),(n.data.data.outcome??n.data.data.failure)!==void 0&&(0,w.jsx)(Vee,{value:n.data.data.outcome??n.data.data.failure}),(0,w.jsx)(`h2`,{children:`Transcript`}),r.data?.data.available?(0,w.jsx)(`ol`,{className:Pm.transcript,"aria-label":`Transcript`,children:r.data.data.entries.map((e,t)=>(0,w.jsxs)(`li`,{className:Pm.transcriptEntry,children:[(0,w.jsxs)(`div`,{className:Pm.transcriptHead,children:[(0,w.jsx)(`span`,{children:e.channel}),(0,w.jsx)(sh,{value:e.occurredAt})]}),(0,w.jsx)(`pre`,{className:Pm.transcriptText,children:e.text})]},`${e.occurredAt}-${t}`))}):(0,w.jsx)(Om,{children:`Transcript unavailable`})]})]})}var Yte=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=`fab`,n=`github`,r=512,i=512,a=[],o=`f09b`,s=`M216.5 362.5c-66-8-112.5-55.5-112.5-117 0-25 9-52 24-70-6.5-16.5-5.5-51.5 2-66 20-2.5 47 8 63 22.5 19-6 39-9 63.5-9s44.5 3 62.5 8.5c15.5-14 43-24.5 63-22 7 13.5 8 48.5 1.5 65.5 16 19 24.5 44.5 24.5 70.5 0 61.5-46.5 108-113.5 116.5 17 11 28.5 35 28.5 62.5l0 52C323 491.5 335.5 500 350.5 494 441 459.5 512 369 512 257 512 115.5 397 0 255.5 0S0 115.5 0 257c0 111 70.5 203 165.5 237.5 13.5 5 26.5-4 26.5-17.5l0-40c-7 3-16 5-24 5-33 0-52.5-18-66.5-51.5-5.5-13.5-11.5-21.5-23-23-6-.5-8-3-8-6 0-6 10-10.5 20-10.5 14.5 0 27 9 40 27.5 10 14.5 20.5 21 33 21s20.5-4.5 32-16c8.5-8.5 15-16 21-21z`;e.definition={prefix:t,iconName:n,icon:[r,i,a,o,s]},e.faGithub=e.definition,e.prefix=t,e.iconName=n,e.width=r,e.height=i,e.ligatures=a,e.unicode=o,e.svgPathData=s,e.aliases=a})),Xte=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=`fas`,n=`arrow-up-right-from-square`,r=512,i=512,a=[`external-link`],o=`f08e`,s=`M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l82.7 0-201.4 201.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3 448 192c0 17.7 14.3 32 32 32s32-14.3 32-32l0-160c0-17.7-14.3-32-32-32L320 0zM80 96C35.8 96 0 131.8 0 176L0 432c0 44.2 35.8 80 80 80l256 0c44.2 0 80-35.8 80-80l0-80c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 80c0 8.8-7.2 16-16 16L80 448c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l80 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L80 96z`;e.definition={prefix:t,iconName:n,icon:[r,i,a,o,s]},e.faArrowUpRightFromSquare=e.definition,e.prefix=t,e.iconName=n,e.width=r,e.height=i,e.ligatures=a,e.unicode=o,e.svgPathData=s,e.aliases=a})),Zte=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=`fas`,n=`file-lines`,r=384,i=512,a=[128441,128462,61686,`file-alt`,`file-text`],o=`f15c`,s=`M0 64C0 28.7 28.7 0 64 0L213.5 0c17 0 33.3 6.7 45.3 18.7L365.3 125.3c12 12 18.7 28.3 18.7 45.3L384 448c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64zm208-5.5l0 93.5c0 13.3 10.7 24 24 24L325.5 176 208 58.5zM120 256c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0zm0 96c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0z`;e.definition={prefix:t,iconName:n,icon:[r,i,a,o,s]},e.faFileLines=e.definition,e.prefix=t,e.iconName=n,e.width=r,e.height=i,e.ligatures=a,e.unicode=o,e.svgPathData=s,e.aliases=a})),Qte=Yte(),$te=Xte(),ene=Zte();function tne({className:e}){return(0,w.jsx)(T,{icon:Qte.faGithub,className:e,"aria-hidden":`true`})}function nne({className:e}){return(0,w.jsx)(T,{icon:ene.faFileLines,className:e,"aria-hidden":`true`})}function rne({className:e}){return(0,w.jsx)(T,{icon:$te.faArrowUpRightFromSquare,className:e,"aria-hidden":`true`})}var ine={github:tne};function ane(){let e=Oc(),t=fi({queryKey:vm.board.list(),queryFn:({signal:t})=>e.board.list(void 0,t),refetchInterval:ym.board}),n=t.data?.items??[];return(0,w.jsx)(w.Fragment,{children:t.isPending?(0,w.jsx)(Dm,{label:`Loading work`}):t.error&&!t.data?(0,w.jsx)(km,{error:t.error,retry:()=>void t.refetch()}):n.length===0?(0,w.jsx)(Om,{children:`No matching work items`}):(0,w.jsx)(uh,{caption:`Work items`,rows:n,rowKey:e=>e.workItemKey,columns:ph})})}var ph=[{label:`Ref`,render:e=>e.externalRef??`?`},{label:`Work item`,render:e=>(0,w.jsx)(Pn,{to:`/work/${encodeURIComponent(e.workItemKey)}`,children:e.objective})},{label:`Condition`,render:e=>(0,w.jsx)(Fm,{variant:`outline`,children:e.condition})},{label:`Workflow`,render:e=>e.workflowName??`?`},{label:`Stage`,render:e=>e.stage??`?`},{label:`Runs`,render:e=>e.runCount},{label:`Last run`,render:e=>e.lastRunAt===void 0?`?`:(0,w.jsx)(sh,{value:e.lastRunAt})},{label:`Outcome`,render:e=>e.lastRunOutcome===void 0?`?`:(0,w.jsx)(Um,{outcome:e.lastRunOutcome})},{label:`Cost`,render:e=>Im(e.totalCostUsd)},{label:`Usage`,render:e=>(0,w.jsx)(Wm,{usage:e})}];function mh(){let{workItemKey:e=``}=St();return(0,w.jsx)(one,{workItemKey:e},e)}function one({workItemKey:e}){let t=Oc(),n=bt(),r=Qr(),i=async()=>{await Promise.all([r.invalidateQueries({queryKey:vm.work.all}),r.invalidateQueries({queryKey:vm.board.list()})])},a=pi({mutationFn:n=>t.work.command(e,n,`web:${n}:${globalThis.crypto.randomUUID()}`),onSuccess:async(e,t)=>{await i(),t===`delete`&&n(`/work`)}}),[o,s]=(0,S.useState)(``),[c,l]=(0,S.useState)(!1),u=(0,S.useRef)(0),d=(0,S.useRef)(null),f=pi({mutationFn:n=>t.work.message(e,n,`web:conversation-message:${globalThis.crypto.randomUUID()}`),onSuccess:async()=>{u.current=oe.filter(e=>e.origin===`agent`).length,l(!0),re.current=!0,ae(!1),s(``),d.current&&(d.current.style.height=``),await i()}}),p=()=>{let e=o.trim();e!==``&&!f.isPending&&f.mutate(e)},m=fi({queryKey:vm.work.detail(e),queryFn:({signal:n})=>t.work.detail(e,n),refetchInterval:ym.openWork,enabled:e!==``}),h=fi({queryKey:vm.workflowDiagrams.get(e),queryFn:({signal:n})=>t.workflowDiagrams.get(e,n),refetchInterval:ym.workflowDiagrams,enabled:e!==``&&m.data?.data.orchestration.primary!==null}),[g,_]=(0,S.useState)(ps.Failed),[v,y]=(0,S.useState)(`Operator determined this run failed.`),[b,x]=(0,S.useState)(`{
1116
1116
  "kind": "done",
1117
1117
  "data": { "status": "DONE" }
1118
- }`),ee=pi({mutationFn:async({runId:n,outcome:r,status:i})=>{let a=globalThis.crypto.randomUUID();if(await t.execution.resolveAmbiguousRun(n,i===ps.Failed?{status:ps.Failed,reason:v}:{status:ps.Succeeded,outcome:r},`web:resolve-ambiguous-run:${a}`),i!==ps.Succeeded)return t.work.command(e,`retry`,`web:retry-after-ambiguous-resolution:${globalThis.crypto.randomUUID()}`)},onSuccess:i}),[te,ne]=(0,S.useState)(`overview`),C=(0,S.useRef)(null),re=(0,S.useRef)(!0),[ie,ae]=(0,S.useState)(!1),oe=[...m.data?.data.conversation.entries??[]].sort((e,t)=>e.occurredAt.localeCompare(t.occurredAt)),se=oe.at(-1),ce=m.data?.data.execution.runs.find(e=>e.active);(0,S.useEffect)(()=>{let e=oe.filter(e=>e.origin===`agent`).length;c&&e>u.current&&l(!1)},[c,oe]),(0,S.useLayoutEffect)(()=>{re.current=!0,ae(!1)},[te]),(0,S.useLayoutEffect)(()=>{te===`conversation`&&re.current&&C.current&&(C.current.scrollTop=C.current.scrollHeight)},[te,se?.entryId,se?.body]);let[le,ue]=(0,S.useState)(),[de,fe]=(0,S.useState)(!1),[pe,me]=(0,S.useState)(),he=fi({queryKey:vm.events.list(``,e),queryFn:({signal:n})=>t.events.list(void 0,e,n),refetchInterval:ym.events,enabled:e!==``}),ge=[...m.data?.data.execution.transcriptGroups??[]].sort((e,t)=>Number(e.kind===`run`)-Number(t.kind===`run`)||t.latestAt.localeCompare(e.latestAt)),_e=m.data?.data.orchestration.primary,ve=[...m.data?.data.execution.runs??[]].filter(e=>e.workflowInstanceId===_e?.workflowInstanceId&&e.status===`ambiguous`).sort((e,t)=>t.startedAt.localeCompare(e.startedAt))[0],ye=_e!=null&&_e.status===`blocked`&&lne(_e.blockReason),be=ge.find(e=>e.groupId===le)??ge[0],xe=fi({queryKey:vm.work.transcript(e,be?.groupId??``),queryFn:({signal:n})=>t.work.transcript(e,be.groupId,n),refetchInterval:ym.historicalRuns,enabled:te===`transcripts`&&e!==``&&be!==void 0}),Se=pe!==void 0&&be?.runIds.includes(pe)?pe:be?.runIds.at(-1),Ce=[...xe.data?.data.entries??[]].sort((e,t)=>e.occurredAt.localeCompare(t.occurredAt)).filter(e=>!de||e.runId===Se),we=e=>{let t=ge.find(t=>t.groupId===e);ue(e),me(t?.runIds.at(-1)),fe(!1)},Te=e=>{let t=Array.from(e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)??[]),n=t.indexOf(e.currentTarget);if(n<0)return;let r=e.key===`ArrowRight`?(n+1)%t.length:e.key===`ArrowLeft`?(n-1+t.length)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:void 0;if(r===void 0)return;e.preventDefault();let i=t[r];if(i===void 0)return;let a=i.dataset.tab;ne(a),i.focus()};return(0,w.jsx)(`div`,{className:`${Pm.detail} ${te===`conversation`?Pm.detailChat:``}`,children:m.isPending?(0,w.jsx)(Dm,{label:`Loading work detail`}):m.error&&!m.data?(0,w.jsx)(km,{error:m.error,retry:()=>void m.refetch()}):m.data?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:Pm.tabs,role:`tablist`,"aria-label":`Work detail sections`,children:[`overview`,`runs`,`events`,`transcripts`,`conversation`].map(e=>(0,w.jsx)(`button`,{type:`button`,role:`tab`,"data-tab":e,id:`work-detail-${e}-tab`,"aria-controls":`work-detail-${e}-panel`,"aria-selected":te===e,tabIndex:te===e?0:-1,onKeyDown:Te,onClick:()=>ne(e),children:e===`overview`?`Overview`:e[0].toUpperCase()+e.slice(1)},e))}),(0,w.jsxs)(`h1`,{className:Pm.workTitle,children:[m.data.data.work.externalRef&&(0,w.jsx)(`span`,{children:m.data.data.work.externalRef}),m.data.data.work.objective]}),te!==`conversation`&&te!==`transcripts`&&(0,w.jsxs)(`div`,{className:Pm.workSummary,children:[(0,w.jsx)(wm,{children:(0,w.jsxs)(`dl`,{className:Pm.summary,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Work identity`}),(0,w.jsx)(`dd`,{children:m.data.data.work.workItemId})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`State`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(Fm,{variant:`outline`,children:m.data.data.work.state})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Workflow`}),(0,w.jsx)(`dd`,{children:m.data.data.orchestration.primary?.workflowName??`?`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Stage`}),(0,w.jsx)(`dd`,{children:m.data.data.orchestration.primary?.currentStage??`Not started`})]}),ye&&(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Blocked because`}),(0,w.jsx)(`dd`,{children:`Ambiguous run requires an operator decision`})]})}),m.data.data.work.lastRunOutcome!==void 0&&(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Last run`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(Um,{outcome:m.data.data.work.lastRunOutcome,title:`Outcome of the most recent run`})})]})})]})}),(0,w.jsxs)(`div`,{className:Pm.actionBar,children:[m.data.data.orchestration.primary?.retryEligible===!0&&(0,w.jsx)(Tm,{type:`button`,disabled:a.isPending,onClick:()=>a.mutate(`retry`),children:`Retry`}),m.data.data.orchestration.primary?.extendEligible===!0&&(0,w.jsx)(Tm,{type:`button`,disabled:a.isPending,onClick:()=>a.mutate(`extend`),children:`Extend`}),(0,w.jsx)(Tm,{type:`button`,disabled:a.isPending,onClick:()=>a.mutate(m.data.data.work.frozen?`unfreeze`:`freeze`),children:m.data.data.work.frozen?`Unfreeze`:`Freeze`}),(0,w.jsx)(Tm,{type:`button`,className:Pm.dangerButton,disabled:a.isPending,onClick:()=>{window.confirm(`Delete this work item from the board and remove its resource correlations?`)&&a.mutate(`delete`)},children:`Delete`}),(0,w.jsx)(Am,{pending:a.isPending,...a.error===null?{}:{message:a.error?.message}})]})]}),te===`runs`?(0,w.jsx)(`section`,{id:`work-detail-runs-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-runs-tab`,children:m.data.data.execution.runs.length===0?(0,w.jsx)(Om,{children:`No runs`}):(0,w.jsx)(uh,{caption:`Runs`,rows:m.data.data.execution.runs,rowKey:e=>e.runId,columns:dh})}):te===`conversation`?(0,w.jsxs)(`section`,{id:`work-detail-conversation-panel`,className:Pm.conversationPanel,role:`tabpanel`,"aria-labelledby":`work-detail-conversation-tab`,children:[(0,w.jsx)(`div`,{ref:C,className:Pm.conversationViewport,role:`region`,"aria-label":`Message history`,tabIndex:0,onScroll:e=>{let t=e.currentTarget;re.current=t.scrollHeight-t.scrollTop-t.clientHeight<64,ae(!re.current)},children:oe.length===0?(0,w.jsx)(Om,{children:`No conversation messages`}):(0,w.jsx)(`ol`,{className:Pm.conversationTimeline,"aria-label":`Conversation`,children:oe.map(e=>{let t=m.data.data.resources.find(t=>t.resourceId===e.sourceResourceId);return(0,w.jsx)(`li`,{children:(0,w.jsxs)(`article`,{className:Pm.conversationEntry,"data-origin":e.origin,children:[(0,w.jsx)(sne,{actorId:e.actorId,sourceAdapter:e.sourceAdapter}),(0,w.jsxs)(`header`,{className:Pm.conversationEntryHead,children:[(0,w.jsx)(`strong`,{children:e.actorId}),(0,w.jsxs)(`span`,{className:Pm.conversationSource,children:[`via `,e.sourceAdapter??e.origin]}),(0,w.jsx)(sh,{value:e.occurredAt}),e.runId!==void 0&&(0,w.jsxs)(`span`,{children:[(0,w.jsxs)(Pn,{to:`/runs/${encodeURIComponent(e.runId)}`,children:[`run `,e.runId]}),e.stage===void 0?``:` (${e.stage})`]}),t!==void 0&&(0,w.jsx)(`span`,{children:t.externalUrl===void 0?t.locatorLabel:(0,w.jsx)(`a`,{href:t.externalUrl,target:`_blank`,rel:`noopener noreferrer`,children:t.locatorLabel})})]}),e.deleted?(0,w.jsx)(`em`,{children:`Message deleted`}):(0,w.jsx)(`div`,{className:Pm.conversationBody,children:e.body}),e.representations.length>0&&(0,w.jsx)(`footer`,{className:Pm.conversationRepresentations,children:e.representations.map(e=>{let t=m.data.data.resources.find(t=>t.resourceId===e.resourceId),n=t?.locatorLabel??e.resourceId;return(0,w.jsxs)(`span`,{children:[`Published to`,` `,t?.externalUrl===void 0?n:(0,w.jsx)(`a`,{href:t.externalUrl,target:`_blank`,rel:`noopener noreferrer`,children:n})]},`${e.resourceId}:${e.externalId}`)})})]})},e.entryId)})})}),(0,w.jsxs)(`div`,{className:Pm.conversationFooter,children:[c&&(0,w.jsxs)(`div`,{className:Pm.conversationProgress,role:`status`,"aria-live":`polite`,children:[ce===void 0?(0,w.jsx)(T,{icon:zc,className:Pm.conversationWaitingIcon,"aria-hidden":`true`}):(0,w.jsx)(`span`,{className:Pm.conversationProgressDot,"data-active-run":`true`}),(0,w.jsx)(`span`,{className:Pm.conversationProgressTitle,children:ce===void 0?`Queued for Wake`:ce.activity}),ce!==void 0&&(0,w.jsxs)(`span`,{className:Pm.conversationProgressMeta,children:[ce.stage!==void 0&&`Stage: ${ce.stage}`,ce.stage!==void 0&&(ce.runnerName!==void 0||ce.runnerModel!==void 0)&&` · `,(ce.runnerName!==void 0||ce.runnerModel!==void 0)&&`Runner: ${ce.runnerName??ce.runnerModel}`]})]}),ie&&(0,w.jsx)(Tm,{className:Pm.conversationLatest,onClick:()=>{re.current=!0,ae(!1),C.current&&(C.current.scrollTop=C.current.scrollHeight)},children:`Jump to latest`}),m.data.data.conversation.canCreateEntries&&(0,w.jsxs)(`form`,{className:Pm.conversationComposer,onSubmit:e=>{e.preventDefault(),p()},children:[(0,w.jsx)(`textarea`,{ref:d,id:`work-conversation-message`,"aria-label":`Message`,value:o,disabled:f.isPending,onChange:e=>{s(e.target.value),e.currentTarget.style.height=`auto`,e.currentTarget.style.height=`${Math.min(e.currentTarget.scrollHeight,192)}px`},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),p())},placeholder:`Add context, answer a question, or direct the current work.`,rows:1}),(0,w.jsxs)(`div`,{className:Pm.conversationComposerActions,children:[(0,w.jsx)(Tm,{type:`submit`,className:Pm.conversationSend,"aria-label":`Send message`,disabled:f.isPending||o.trim()===``,children:(0,w.jsx)(T,{icon:jc,"aria-hidden":`true`})}),(0,w.jsx)(Am,{pending:f.isPending,...f.error===null?{}:{message:f.error?.message}})]})]})]})]}):te===`transcripts`?(0,w.jsxs)(`section`,{id:`work-detail-transcripts-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-transcripts-tab`,children:[(0,w.jsx)(`h2`,{id:`work-transcripts`,children:`Transcript conversations`}),ge.length===0?(0,w.jsx)(Om,{children:`No transcript conversations`}):(0,w.jsxs)(`div`,{className:Pm.transcriptLayout,children:[(0,w.jsx)(`ol`,{className:Pm.transcriptGroups,"aria-label":`Transcript groups`,children:ge.map(e=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(`button`,{type:`button`,className:Pm.transcriptGroup,"aria-pressed":be?.groupId===e.groupId,onClick:()=>we(e.groupId),children:[(0,w.jsx)(`span`,{children:e.groupId}),(0,w.jsx)(`span`,{children:e.kind===`session`?`Session`:`Run fallback`}),e.cli!==void 0&&(0,w.jsx)(`span`,{children:e.cli}),(0,w.jsx)(sh,{value:e.latestAt}),(0,w.jsx)(`span`,{children:e.runIds.join(`, `)})]})},e.groupId))}),(0,w.jsxs)(`div`,{className:Pm.transcriptConversation,children:[be!==void 0&&be.runIds.length>1&&(0,w.jsxs)(`div`,{className:Pm.transcriptFilters,children:[(0,w.jsxs)(`label`,{children:[`Run`,(0,w.jsx)(`select`,{value:Se??``,onChange:e=>me(e.target.value),children:be.runIds.map(e=>(0,w.jsx)(`option`,{value:e,children:e},e))})]}),(0,w.jsxs)(`label`,{children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:de,onChange:e=>fe(e.target.checked)}),`This run only`]})]}),xe.isPending?(0,w.jsx)(Dm,{label:`Loading transcript`}):xe.error?(0,w.jsx)(km,{error:xe.error,retry:()=>void xe.refetch()}):xe.data?.data.available===!1?(0,w.jsx)(Om,{children:`Transcript unavailable`}):Ce.length===0?(0,w.jsx)(Om,{children:`No transcript messages`}):(0,w.jsx)(`ol`,{className:Pm.transcript,"aria-label":`Transcript conversation`,children:Ce.map((e,t)=>(0,w.jsxs)(`li`,{children:[t>0&&Ce[t-1]?.runId!==e.runId&&(0,w.jsxs)(`div`,{className:Pm.transcriptRunSeparator,role:`separator`,"aria-label":`Run ${e.runId}`,children:[`Run `,e.runId]}),(0,w.jsxs)(`article`,{className:e.channel===`input`?Pm.transcriptInput:Pm.transcriptAgent,"aria-label":`${e.channel===`input`?`Input`:`Agent`} message from ${e.runId}`,children:[(0,w.jsxs)(`div`,{className:Pm.transcriptHead,children:[(0,w.jsx)(`span`,{children:e.channel===`input`?`Input`:`Agent`}),(0,w.jsx)(sh,{value:e.occurredAt}),(0,w.jsxs)(`span`,{children:[`Run `,e.runId]}),e.channel===`agent`&&e.durationMs!==void 0&&(0,w.jsx)(`span`,{children:Rm(e.durationMs)})]}),(0,w.jsx)(`pre`,{className:Pm.transcriptText,style:{whiteSpace:`pre-wrap`},children:e.text})]})]},`${e.occurredAt}-${t}`))})]})]})]}):te===`events`?(0,w.jsxs)(`section`,{id:`work-detail-events-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-events-tab`,children:[(0,w.jsx)(`h2`,{id:`work-events`,children:`Events`}),he.isPending?(0,w.jsx)(Dm,{label:`Loading events`}):he.error?(0,w.jsx)(km,{error:he.error,retry:()=>void he.refetch()}):he.data?.items.length?(0,w.jsx)(`ol`,{className:Pm.eventList,children:[...he.data.items].sort((e,t)=>t.position-e.position).map(e=>(0,w.jsx)(ch,{record:e},e.id))}):(0,w.jsx)(Om,{children:`No events`})]}):(0,w.jsxs)(`div`,{id:`work-detail-overview-panel`,className:Pm.overviewLayout,role:`tabpanel`,"aria-labelledby":`work-detail-overview-tab`,children:[(0,w.jsx)(`div`,{className:Pm.overviewWorkflow,children:h.data?.data.diagrams[0]===void 0?null:(0,w.jsx)(rh,{diagram:h.data.data.diagrams[0]})}),(0,w.jsxs)(`aside`,{className:Pm.overviewSidebar,children:[ye&&ve!==void 0&&(0,w.jsxs)(wm,{labelledBy:`ambiguous-run-resolution`,children:[(0,w.jsx)(`h2`,{id:`ambiguous-run-resolution`,className:Pm.sidebarSectionTitle,children:`Resolve ambiguous run`}),(0,w.jsx)(`p`,{children:`Decide what happened before retrying this work. Wake will record your decision, then retry the work item.`}),(0,w.jsxs)(`dl`,{className:Pm.summary,children:[(0,w.jsx)(`dt`,{children:`Run`}),(0,w.jsx)(`dd`,{children:ve.runId}),(0,w.jsx)(`dt`,{children:`Token usage`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(Wm,{usage:ve})}),(0,w.jsx)(`dt`,{children:`Cost`}),(0,w.jsx)(`dd`,{children:Im(ve.totalCostUsd)}),(0,w.jsx)(`dt`,{children:`Pull request`}),(0,w.jsx)(`dd`,{children:m.data.data.activities.pullRequest===void 0?`None recorded`:`Recorded for this work item`})]}),(0,w.jsxs)(`fieldset`,{disabled:ee.isPending,children:[(0,w.jsx)(`legend`,{children:`Actual outcome`}),(0,w.jsxs)(`label`,{children:[(0,w.jsx)(`input`,{type:`radio`,name:`ambiguous-run-outcome`,checked:g===ps.Failed,onChange:()=>_(ps.Failed)}),`Failed`]}),(0,w.jsxs)(`label`,{children:[(0,w.jsx)(`input`,{type:`radio`,name:`ambiguous-run-outcome`,checked:g===ps.Succeeded,onChange:()=>_(ps.Succeeded)}),`Succeeded`]}),g===ps.Failed?(0,w.jsxs)(`label`,{children:[`Reason`,(0,w.jsx)(`textarea`,{value:v,onChange:e=>y(e.target.value)})]}):(0,w.jsxs)(`label`,{children:[`Actual activity outcome (JSON)`,(0,w.jsx)(`textarea`,{value:b,onChange:e=>x(e.target.value)})]})]}),(0,w.jsx)(Tm,{type:`button`,disabled:ee.isPending||g===ps.Failed&&v.trim()===``||g===ps.Succeeded&&gh(b)===void 0,onClick:()=>{let e=g===ps.Succeeded?gh(b):void 0;(g!==ps.Succeeded||e!==void 0)&&ee.mutate({runId:ve.runId,outcome:e,status:g})},children:g===ps.Failed?`Resolve and retry`:`Resolve run`}),g===ps.Succeeded&&gh(b)===void 0&&(0,w.jsx)(`p`,{role:`alert`,children:`The actual activity outcome must be an object with a supported outcome kind.`}),(0,w.jsx)(Am,{pending:ee.isPending,...ee.error===null?{}:{message:ee.error.message}})]}),(0,w.jsxs)(`section`,{"aria-labelledby":`work-resources`,children:[(0,w.jsx)(`h2`,{id:`work-resources`,className:Pm.sidebarSectionTitle,children:`Resources`}),m.data.data.resources.length===0?(0,w.jsx)(Om,{children:`No correlated resources`}):(0,w.jsx)(`ul`,{className:Pm.resourceList,"aria-label":`Resources`,children:m.data.data.resources.map(e=>{let t=ine[e.adapter]??nne,n=e.title??e.locatorLabel,r=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:Pm.resourceCardTop,children:[(0,w.jsx)(t,{className:Pm.resourceCardIcon}),(0,w.jsx)(`span`,{className:Pm.resourceCardTitle,children:n}),e.externalUrl!==void 0&&(0,w.jsx)(rne,{className:Pm.resourceCardExt})]}),(0,w.jsxs)(`div`,{className:Pm.resourceCardMeta,children:[e.title!==void 0&&(0,w.jsx)(`span`,{className:Pm.resourceId,children:e.locatorLabel}),e.capabilities.map(e=>(0,w.jsx)(Fm,{variant:`outline`,children:e},e))]})]});return(0,w.jsx)(`li`,{children:e.externalUrl===void 0?(0,w.jsx)(`div`,{className:Pm.resourceCard,children:r}):(0,w.jsx)(`a`,{className:Pm.resourceCard,href:e.externalUrl,target:`_blank`,rel:`noopener noreferrer`,children:r})},e.resourceId)})})]})]}),(0,w.jsxs)(`section`,{className:Pm.overviewMain,"aria-labelledby":`work-activity`,children:[(0,w.jsx)(`h2`,{id:`work-activity`,className:Pm.sidebarSectionTitle,children:`Activity timeline`}),he.isPending?(0,w.jsx)(Dm,{label:`Loading activity`}):he.error?(0,w.jsx)(km,{error:he.error,retry:()=>void he.refetch()}):hh(m.data.data.execution.runs,he.data?.items??[]).length?(0,w.jsx)(`ol`,{className:Pm.activityTimeline,"aria-label":`Activity timeline`,children:hh(m.data.data.execution.runs,he.data?.items??[]).map(e=>(0,w.jsxs)(`li`,{className:Pm.activityTimelineItem,children:[(0,w.jsx)(`span`,{className:Pm.activityTimelineMarker,"data-kind":e.kind}),(0,w.jsx)(sh,{value:e.occurredAt}),e.kind===`run`?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:Pm.activityTimelineKind,"data-kind":`run`,children:`Run`}),(0,w.jsx)(Pn,{to:`/runs/${encodeURIComponent(e.run.runId)}`,children:e.run.activity}),(0,w.jsxs)(`span`,{className:Pm.activityTimelineDetail,children:[`Stage: `,e.run.stage??`Not assigned`]}),(0,w.jsxs)(`span`,{className:Pm.activityTimelineDetail,children:[`Runner:`,` `,e.run.runnerName??e.run.runnerModel??`Unassigned`]}),(0,w.jsxs)(`span`,{className:Pm.activityTimelineOutcome,children:[`Outcome: `,cne(e.run)]})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:Pm.activityTimelineKind,"data-kind":`event`,children:`Event`}),(0,w.jsx)(`span`,{children:e.event.type}),e.event.stream!==void 0&&(0,w.jsxs)(`span`,{className:Pm.activityTimelineDetail,children:[`Stream: `,e.event.stream.kind]})]})]},e.id))}):(0,w.jsx)(Om,{children:`No activity yet`})]})]})]}):null})}function sne({actorId:e,sourceAdapter:t}){let[n,r]=(0,S.useState)(!1),i=t===`github`&&e.trim()!==``;return(0,w.jsx)(`span`,{className:Pm.conversationAvatar,"aria-label":i?`${e} GitHub avatar`:e,children:i&&!n?(0,w.jsx)(`img`,{src:`https://github.com/${encodeURIComponent(e)}.png?size=64`,alt:``,onError:()=>r(!0)}):e.slice(0,2).toUpperCase()})}function hh(e,t){return[...e.map(e=>({id:`run:${e.runId}`,kind:`run`,occurredAt:e.finishedAt??e.startedAt,run:e})),...t.map(e=>({id:`event:${e.id}`,kind:`event`,occurredAt:e.occurredAt,event:e}))].sort((e,t)=>t.occurredAt.localeCompare(e.occurredAt))}function cne(e){return e.resolution?.sentinel??e.sentinel??e.status}function lne(e){return e!==void 0&&/^run-ambiguous-after-\d+-attempts$/.test(e)}function gh(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t.kind;return typeof n==`string`&&Object.values(gs).includes(n)?t:void 0}catch{return}}function une({client:e=new Tc}){let[t]=(0,S.useState)(()=>new Yr({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,refetchIntervalInBackground:!1}}})),[n,r]=(0,S.useState)();return(0,S.useEffect)(()=>{let t=new URLSearchParams(globalThis.location.search).get(`grant`);(async()=>{if(t!==null){let n=await e.auth.redeem(t);if(globalThis.history.replaceState({},``,`${globalThis.location.pathname}${globalThis.location.hash}`),n)return r(!0)}return e.auth.session().then(r).catch(()=>r(!1))})()},[e]),n===void 0?null:n?(0,w.jsx)($r,{client:t,children:(0,w.jsx)(Dc.Provider,{value:e,children:(0,w.jsx)(fne,{})})}):(0,w.jsx)(dne,{client:e,onAuthenticated:()=>r(!0)})}function dne({client:e,onAuthenticated:t}){let[n,r]=(0,S.useState)(``),[i,a]=(0,S.useState)(!1);async function o(r){r.preventDefault(),await e.auth.redeem(n)?t():a(!0)}return(0,w.jsx)(`main`,{className:`wake-login`,children:(0,w.jsxs)(`div`,{className:`wake-login-panel`,children:[(0,w.jsx)(`section`,{className:`wake-login-brand`,children:(0,w.jsx)(`img`,{className:`wake-login-logo`,src:hi,alt:`Wake logo`})}),(0,w.jsxs)(`section`,{className:`wake-login-card`,children:[(0,w.jsx)(`h1`,{children:`Login`}),(0,w.jsx)(`p`,{children:`Enter a temporary login code, or scan the code from your operator terminal.`}),(0,w.jsxs)(`form`,{onSubmit:o,children:[(0,w.jsx)(`label`,{htmlFor:`access-key`,children:`Temporary login code`}),(0,w.jsx)(`input`,{id:`access-key`,type:`password`,value:n,onChange:e=>r(e.target.value),autoFocus:!0,required:!0}),(0,w.jsx)(`button`,{className:`wake-login-submit`,type:`submit`,children:`Sign in`}),i&&(0,w.jsx)(`p`,{role:`alert`,children:`Unable to sign in.`})]})]})]})})}function fne(){return(0,w.jsx)(Nm,{children:(0,w.jsxs)(Kt,{children:[(0,w.jsx)(Wt,{path:`/`,element:(0,w.jsx)(Ut,{to:`/board`,replace:!0})}),(0,w.jsx)(Wt,{path:`/board`,element:(0,w.jsx)(mte,{})}),(0,w.jsx)(Wt,{path:`/work`,element:(0,w.jsx)(ane,{})}),(0,w.jsx)(Wt,{path:`/work/:workItemKey`,element:(0,w.jsx)(mh,{})}),(0,w.jsx)(Wt,{path:`/events`,element:(0,w.jsx)(Rte,{})}),(0,w.jsx)(Wt,{path:`/runs`,element:(0,w.jsx)(Gte,{})}),(0,w.jsx)(Wt,{path:`/runs/:runId`,element:(0,w.jsx)(Jte,{})}),(0,w.jsx)(Wt,{path:`/observability`,element:(0,w.jsx)(Wte,{})}),(0,w.jsx)(Wt,{path:`/health`,element:(0,w.jsx)(Vte,{})}),(0,w.jsx)(Wt,{path:`/configuration`,element:(0,w.jsx)(Lte,{})}),(0,w.jsx)(Wt,{path:`*`,element:(0,w.jsx)(Ut,{to:`/board`,replace:!0})})]})})}(0,mi.createRoot)(document.getElementById(`root`)).render((0,w.jsx)(S.StrictMode,{children:(0,w.jsx)(Nn,{children:(0,w.jsx)(une,{})})}));
1118
+ }`),ee=pi({mutationFn:async({runId:n,outcome:r,status:i})=>{let a=globalThis.crypto.randomUUID();if(await t.execution.resolveAmbiguousRun(n,i===ps.Failed?{status:ps.Failed,reason:v}:{status:ps.Succeeded,outcome:r},`web:resolve-ambiguous-run:${a}`),i!==ps.Succeeded)return t.work.command(e,`retry`,`web:retry-after-ambiguous-resolution:${globalThis.crypto.randomUUID()}`)},onSuccess:i}),[te,ne]=(0,S.useState)(`overview`),C=(0,S.useRef)(null),re=(0,S.useRef)(!0),[ie,ae]=(0,S.useState)(!1),oe=[...m.data?.data.conversation.entries??[]].sort((e,t)=>e.occurredAt.localeCompare(t.occurredAt)),se=oe.at(-1),ce=m.data?.data.execution.runs.find(e=>e.active);(0,S.useEffect)(()=>{let e=oe.filter(e=>e.origin===`agent`).length;c&&e>u.current&&l(!1)},[c,oe]),(0,S.useLayoutEffect)(()=>{re.current=!0,ae(!1)},[te]),(0,S.useLayoutEffect)(()=>{te===`conversation`&&re.current&&C.current&&(C.current.scrollTop=C.current.scrollHeight)},[te,se?.entryId,se?.body]);let[le,ue]=(0,S.useState)(),[de,fe]=(0,S.useState)(!1),[pe,me]=(0,S.useState)(),he=fi({queryKey:vm.events.list(``,e),queryFn:({signal:n})=>t.events.list(void 0,e,n),refetchInterval:ym.events,enabled:e!==``}),ge=[...m.data?.data.execution.transcriptGroups??[]].sort((e,t)=>Number(e.kind===`run`)-Number(t.kind===`run`)||t.latestAt.localeCompare(e.latestAt)),_e=m.data?.data.orchestration.primary,ve=[...m.data?.data.execution.runs??[]].filter(e=>e.workflowInstanceId===_e?.workflowInstanceId&&e.status===`ambiguous`).sort((e,t)=>t.startedAt.localeCompare(e.startedAt))[0],ye=_e!=null&&_e.status===`blocked`&&lne(_e.blockReason),be=ge.find(e=>e.groupId===le)??ge[0],xe=fi({queryKey:vm.work.transcript(e,be?.groupId??``),queryFn:({signal:n})=>t.work.transcript(e,be.groupId,n),refetchInterval:ym.historicalRuns,enabled:te===`transcripts`&&e!==``&&be!==void 0}),Se=pe!==void 0&&be?.runIds.includes(pe)?pe:be?.runIds.at(-1),Ce=[...xe.data?.data.entries??[]].sort((e,t)=>e.occurredAt.localeCompare(t.occurredAt)).filter(e=>!de||e.runId===Se),we=e=>{let t=ge.find(t=>t.groupId===e);ue(e),me(t?.runIds.at(-1)),fe(!1)},Te=e=>{let t=Array.from(e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)??[]),n=t.indexOf(e.currentTarget);if(n<0)return;let r=e.key===`ArrowRight`?(n+1)%t.length:e.key===`ArrowLeft`?(n-1+t.length)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:void 0;if(r===void 0)return;e.preventDefault();let i=t[r];if(i===void 0)return;let a=i.dataset.tab;ne(a),i.focus()};return(0,w.jsx)(`div`,{className:`${Pm.detail} ${te===`conversation`?Pm.detailChat:``}`,children:m.isPending?(0,w.jsx)(Dm,{label:`Loading work detail`}):m.error&&!m.data?(0,w.jsx)(km,{error:m.error,retry:()=>void m.refetch()}):m.data?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:Pm.tabs,role:`tablist`,"aria-label":`Work detail sections`,children:[`overview`,`runs`,`artifacts`,`events`,`transcripts`,`conversation`].map(e=>(0,w.jsx)(`button`,{type:`button`,role:`tab`,"data-tab":e,id:`work-detail-${e}-tab`,"aria-controls":`work-detail-${e}-panel`,"aria-selected":te===e,tabIndex:te===e?0:-1,onKeyDown:Te,onClick:()=>ne(e),children:e===`overview`?`Overview`:e[0].toUpperCase()+e.slice(1)},e))}),(0,w.jsxs)(`h1`,{className:Pm.workTitle,children:[m.data.data.work.externalRef&&(0,w.jsx)(`span`,{children:m.data.data.work.externalRef}),m.data.data.work.objective]}),te!==`conversation`&&te!==`transcripts`&&(0,w.jsxs)(`div`,{className:Pm.workSummary,children:[(0,w.jsx)(wm,{children:(0,w.jsxs)(`dl`,{className:Pm.summary,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Work identity`}),(0,w.jsx)(`dd`,{children:m.data.data.work.workItemId})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`State`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(Fm,{variant:`outline`,children:m.data.data.work.state})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Workflow`}),(0,w.jsx)(`dd`,{children:m.data.data.orchestration.primary?.workflowName??`?`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Stage`}),(0,w.jsx)(`dd`,{children:m.data.data.orchestration.primary?.currentStage??`Not started`})]}),ye&&(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Blocked because`}),(0,w.jsx)(`dd`,{children:`Ambiguous run requires an operator decision`})]})}),m.data.data.work.lastRunOutcome!==void 0&&(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Last run`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(Um,{outcome:m.data.data.work.lastRunOutcome,title:`Outcome of the most recent run`})})]})})]})}),(0,w.jsxs)(`div`,{className:Pm.actionBar,children:[m.data.data.orchestration.primary?.retryEligible===!0&&(0,w.jsx)(Tm,{type:`button`,disabled:a.isPending,onClick:()=>a.mutate(`retry`),children:`Retry`}),m.data.data.orchestration.primary?.extendEligible===!0&&(0,w.jsx)(Tm,{type:`button`,disabled:a.isPending,onClick:()=>a.mutate(`extend`),children:`Extend`}),(0,w.jsx)(Tm,{type:`button`,disabled:a.isPending,onClick:()=>a.mutate(m.data.data.work.frozen?`unfreeze`:`freeze`),children:m.data.data.work.frozen?`Unfreeze`:`Freeze`}),(0,w.jsx)(Tm,{type:`button`,className:Pm.dangerButton,disabled:a.isPending,onClick:()=>{window.confirm(`Delete this work item from the board and remove its resource correlations?`)&&a.mutate(`delete`)},children:`Delete`}),(0,w.jsx)(Am,{pending:a.isPending,...a.error===null?{}:{message:a.error?.message}})]})]}),te===`runs`?(0,w.jsx)(`section`,{id:`work-detail-runs-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-runs-tab`,children:m.data.data.execution.runs.length===0?(0,w.jsx)(Om,{children:`No runs`}):(0,w.jsx)(uh,{caption:`Runs`,rows:m.data.data.execution.runs,rowKey:e=>e.runId,columns:dh})}):te===`artifacts`?(0,w.jsx)(`section`,{id:`work-detail-artifacts-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-artifacts-tab`,children:m.data.data.artifacts.length===0?(0,w.jsx)(Om,{children:`No published artifacts`}):(0,w.jsx)(uh,{caption:`Published artifacts`,rows:m.data.data.artifacts,rowKey:e=>e.revisionId,columns:[{label:`Producer`,render:e=>e.producer},{label:`Path`,render:e=>(0,w.jsx)(`a`,{href:e.href,children:e.path})},{label:`Type`,render:e=>e.mediaType??`binary`},{label:`Bytes`,render:e=>e.byteLength?.toLocaleString()??`?`}]})}):te===`conversation`?(0,w.jsxs)(`section`,{id:`work-detail-conversation-panel`,className:Pm.conversationPanel,role:`tabpanel`,"aria-labelledby":`work-detail-conversation-tab`,children:[(0,w.jsx)(`div`,{ref:C,className:Pm.conversationViewport,role:`region`,"aria-label":`Message history`,tabIndex:0,onScroll:e=>{let t=e.currentTarget;re.current=t.scrollHeight-t.scrollTop-t.clientHeight<64,ae(!re.current)},children:oe.length===0?(0,w.jsx)(Om,{children:`No conversation messages`}):(0,w.jsx)(`ol`,{className:Pm.conversationTimeline,"aria-label":`Conversation`,children:oe.map(e=>{let t=m.data.data.resources.find(t=>t.resourceId===e.sourceResourceId);return(0,w.jsx)(`li`,{children:(0,w.jsxs)(`article`,{className:Pm.conversationEntry,"data-origin":e.origin,children:[(0,w.jsx)(sne,{actorId:e.actorId,sourceAdapter:e.sourceAdapter}),(0,w.jsxs)(`header`,{className:Pm.conversationEntryHead,children:[(0,w.jsx)(`strong`,{children:e.actorId}),(0,w.jsxs)(`span`,{className:Pm.conversationSource,children:[`via `,e.sourceAdapter??e.origin]}),(0,w.jsx)(sh,{value:e.occurredAt}),e.runId!==void 0&&(0,w.jsxs)(`span`,{children:[(0,w.jsxs)(Pn,{to:`/runs/${encodeURIComponent(e.runId)}`,children:[`run `,e.runId]}),e.stage===void 0?``:` (${e.stage})`]}),t!==void 0&&(0,w.jsx)(`span`,{children:t.externalUrl===void 0?t.locatorLabel:(0,w.jsx)(`a`,{href:t.externalUrl,target:`_blank`,rel:`noopener noreferrer`,children:t.locatorLabel})})]}),e.deleted?(0,w.jsx)(`em`,{children:`Message deleted`}):(0,w.jsx)(`div`,{className:Pm.conversationBody,children:e.body}),e.representations.length>0&&(0,w.jsx)(`footer`,{className:Pm.conversationRepresentations,children:e.representations.map(e=>{let t=m.data.data.resources.find(t=>t.resourceId===e.resourceId),n=t?.locatorLabel??e.resourceId;return(0,w.jsxs)(`span`,{children:[`Published to`,` `,t?.externalUrl===void 0?n:(0,w.jsx)(`a`,{href:t.externalUrl,target:`_blank`,rel:`noopener noreferrer`,children:n})]},`${e.resourceId}:${e.externalId}`)})})]})},e.entryId)})})}),(0,w.jsxs)(`div`,{className:Pm.conversationFooter,children:[c&&(0,w.jsxs)(`div`,{className:Pm.conversationProgress,role:`status`,"aria-live":`polite`,children:[ce===void 0?(0,w.jsx)(T,{icon:zc,className:Pm.conversationWaitingIcon,"aria-hidden":`true`}):(0,w.jsx)(`span`,{className:Pm.conversationProgressDot,"data-active-run":`true`}),(0,w.jsx)(`span`,{className:Pm.conversationProgressTitle,children:ce===void 0?`Queued for Wake`:ce.activity}),ce!==void 0&&(0,w.jsxs)(`span`,{className:Pm.conversationProgressMeta,children:[ce.stage!==void 0&&`Stage: ${ce.stage}`,ce.stage!==void 0&&(ce.runnerName!==void 0||ce.runnerModel!==void 0)&&` · `,(ce.runnerName!==void 0||ce.runnerModel!==void 0)&&`Runner: ${ce.runnerName??ce.runnerModel}`]})]}),ie&&(0,w.jsx)(Tm,{className:Pm.conversationLatest,onClick:()=>{re.current=!0,ae(!1),C.current&&(C.current.scrollTop=C.current.scrollHeight)},children:`Jump to latest`}),m.data.data.conversation.canCreateEntries&&(0,w.jsxs)(`form`,{className:Pm.conversationComposer,onSubmit:e=>{e.preventDefault(),p()},children:[(0,w.jsx)(`textarea`,{ref:d,id:`work-conversation-message`,"aria-label":`Message`,value:o,disabled:f.isPending,onChange:e=>{s(e.target.value),e.currentTarget.style.height=`auto`,e.currentTarget.style.height=`${Math.min(e.currentTarget.scrollHeight,192)}px`},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),p())},placeholder:`Add context, answer a question, or direct the current work.`,rows:1}),(0,w.jsxs)(`div`,{className:Pm.conversationComposerActions,children:[(0,w.jsx)(Tm,{type:`submit`,className:Pm.conversationSend,"aria-label":`Send message`,disabled:f.isPending||o.trim()===``,children:(0,w.jsx)(T,{icon:jc,"aria-hidden":`true`})}),(0,w.jsx)(Am,{pending:f.isPending,...f.error===null?{}:{message:f.error?.message}})]})]})]})]}):te===`transcripts`?(0,w.jsxs)(`section`,{id:`work-detail-transcripts-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-transcripts-tab`,children:[(0,w.jsx)(`h2`,{id:`work-transcripts`,children:`Transcript conversations`}),ge.length===0?(0,w.jsx)(Om,{children:`No transcript conversations`}):(0,w.jsxs)(`div`,{className:Pm.transcriptLayout,children:[(0,w.jsx)(`ol`,{className:Pm.transcriptGroups,"aria-label":`Transcript groups`,children:ge.map(e=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(`button`,{type:`button`,className:Pm.transcriptGroup,"aria-pressed":be?.groupId===e.groupId,onClick:()=>we(e.groupId),children:[(0,w.jsx)(`span`,{children:e.groupId}),(0,w.jsx)(`span`,{children:e.kind===`session`?`Session`:`Run fallback`}),e.cli!==void 0&&(0,w.jsx)(`span`,{children:e.cli}),(0,w.jsx)(sh,{value:e.latestAt}),(0,w.jsx)(`span`,{children:e.runIds.join(`, `)})]})},e.groupId))}),(0,w.jsxs)(`div`,{className:Pm.transcriptConversation,children:[be!==void 0&&be.runIds.length>1&&(0,w.jsxs)(`div`,{className:Pm.transcriptFilters,children:[(0,w.jsxs)(`label`,{children:[`Run`,(0,w.jsx)(`select`,{value:Se??``,onChange:e=>me(e.target.value),children:be.runIds.map(e=>(0,w.jsx)(`option`,{value:e,children:e},e))})]}),(0,w.jsxs)(`label`,{children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:de,onChange:e=>fe(e.target.checked)}),`This run only`]})]}),xe.isPending?(0,w.jsx)(Dm,{label:`Loading transcript`}):xe.error?(0,w.jsx)(km,{error:xe.error,retry:()=>void xe.refetch()}):xe.data?.data.available===!1?(0,w.jsx)(Om,{children:`Transcript unavailable`}):Ce.length===0?(0,w.jsx)(Om,{children:`No transcript messages`}):(0,w.jsx)(`ol`,{className:Pm.transcript,"aria-label":`Transcript conversation`,children:Ce.map((e,t)=>(0,w.jsxs)(`li`,{children:[t>0&&Ce[t-1]?.runId!==e.runId&&(0,w.jsxs)(`div`,{className:Pm.transcriptRunSeparator,role:`separator`,"aria-label":`Run ${e.runId}`,children:[`Run `,e.runId]}),(0,w.jsxs)(`article`,{className:e.channel===`input`?Pm.transcriptInput:Pm.transcriptAgent,"aria-label":`${e.channel===`input`?`Input`:`Agent`} message from ${e.runId}`,children:[(0,w.jsxs)(`div`,{className:Pm.transcriptHead,children:[(0,w.jsx)(`span`,{children:e.channel===`input`?`Input`:`Agent`}),(0,w.jsx)(sh,{value:e.occurredAt}),(0,w.jsxs)(`span`,{children:[`Run `,e.runId]}),e.channel===`agent`&&e.durationMs!==void 0&&(0,w.jsx)(`span`,{children:Rm(e.durationMs)})]}),(0,w.jsx)(`pre`,{className:Pm.transcriptText,style:{whiteSpace:`pre-wrap`},children:e.text})]})]},`${e.occurredAt}-${t}`))})]})]})]}):te===`events`?(0,w.jsxs)(`section`,{id:`work-detail-events-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-events-tab`,children:[(0,w.jsx)(`h2`,{id:`work-events`,children:`Events`}),he.isPending?(0,w.jsx)(Dm,{label:`Loading events`}):he.error?(0,w.jsx)(km,{error:he.error,retry:()=>void he.refetch()}):he.data?.items.length?(0,w.jsx)(`ol`,{className:Pm.eventList,children:[...he.data.items].sort((e,t)=>t.position-e.position).map(e=>(0,w.jsx)(ch,{record:e},e.id))}):(0,w.jsx)(Om,{children:`No events`})]}):(0,w.jsxs)(`div`,{id:`work-detail-overview-panel`,className:Pm.overviewLayout,role:`tabpanel`,"aria-labelledby":`work-detail-overview-tab`,children:[(0,w.jsx)(`div`,{className:Pm.overviewWorkflow,children:h.data?.data.diagrams[0]===void 0?null:(0,w.jsx)(rh,{diagram:h.data.data.diagrams[0]})}),(0,w.jsxs)(`aside`,{className:Pm.overviewSidebar,children:[ye&&ve!==void 0&&(0,w.jsxs)(wm,{labelledBy:`ambiguous-run-resolution`,children:[(0,w.jsx)(`h2`,{id:`ambiguous-run-resolution`,className:Pm.sidebarSectionTitle,children:`Resolve ambiguous run`}),(0,w.jsx)(`p`,{children:`Decide what happened before retrying this work. Wake will record your decision, then retry the work item.`}),(0,w.jsxs)(`dl`,{className:Pm.summary,children:[(0,w.jsx)(`dt`,{children:`Run`}),(0,w.jsx)(`dd`,{children:ve.runId}),(0,w.jsx)(`dt`,{children:`Token usage`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(Wm,{usage:ve})}),(0,w.jsx)(`dt`,{children:`Cost`}),(0,w.jsx)(`dd`,{children:Im(ve.totalCostUsd)}),(0,w.jsx)(`dt`,{children:`Pull request`}),(0,w.jsx)(`dd`,{children:m.data.data.activities.pullRequest===void 0?`None recorded`:`Recorded for this work item`})]}),(0,w.jsxs)(`fieldset`,{disabled:ee.isPending,children:[(0,w.jsx)(`legend`,{children:`Actual outcome`}),(0,w.jsxs)(`label`,{children:[(0,w.jsx)(`input`,{type:`radio`,name:`ambiguous-run-outcome`,checked:g===ps.Failed,onChange:()=>_(ps.Failed)}),`Failed`]}),(0,w.jsxs)(`label`,{children:[(0,w.jsx)(`input`,{type:`radio`,name:`ambiguous-run-outcome`,checked:g===ps.Succeeded,onChange:()=>_(ps.Succeeded)}),`Succeeded`]}),g===ps.Failed?(0,w.jsxs)(`label`,{children:[`Reason`,(0,w.jsx)(`textarea`,{value:v,onChange:e=>y(e.target.value)})]}):(0,w.jsxs)(`label`,{children:[`Actual activity outcome (JSON)`,(0,w.jsx)(`textarea`,{value:b,onChange:e=>x(e.target.value)})]})]}),(0,w.jsx)(Tm,{type:`button`,disabled:ee.isPending||g===ps.Failed&&v.trim()===``||g===ps.Succeeded&&gh(b)===void 0,onClick:()=>{let e=g===ps.Succeeded?gh(b):void 0;(g!==ps.Succeeded||e!==void 0)&&ee.mutate({runId:ve.runId,outcome:e,status:g})},children:g===ps.Failed?`Resolve and retry`:`Resolve run`}),g===ps.Succeeded&&gh(b)===void 0&&(0,w.jsx)(`p`,{role:`alert`,children:`The actual activity outcome must be an object with a supported outcome kind.`}),(0,w.jsx)(Am,{pending:ee.isPending,...ee.error===null?{}:{message:ee.error.message}})]}),(0,w.jsxs)(`section`,{"aria-labelledby":`work-resources`,children:[(0,w.jsx)(`h2`,{id:`work-resources`,className:Pm.sidebarSectionTitle,children:`Resources`}),m.data.data.resources.length===0?(0,w.jsx)(Om,{children:`No correlated resources`}):(0,w.jsx)(`ul`,{className:Pm.resourceList,"aria-label":`Resources`,children:m.data.data.resources.map(e=>{let t=ine[e.adapter]??nne,n=e.title??e.locatorLabel,r=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:Pm.resourceCardTop,children:[(0,w.jsx)(t,{className:Pm.resourceCardIcon}),(0,w.jsx)(`span`,{className:Pm.resourceCardTitle,children:n}),e.externalUrl!==void 0&&(0,w.jsx)(rne,{className:Pm.resourceCardExt})]}),(0,w.jsxs)(`div`,{className:Pm.resourceCardMeta,children:[e.title!==void 0&&(0,w.jsx)(`span`,{className:Pm.resourceId,children:e.locatorLabel}),e.capabilities.map(e=>(0,w.jsx)(Fm,{variant:`outline`,children:e},e))]})]});return(0,w.jsx)(`li`,{children:e.externalUrl===void 0?(0,w.jsx)(`div`,{className:Pm.resourceCard,children:r}):(0,w.jsx)(`a`,{className:Pm.resourceCard,href:e.externalUrl,target:`_blank`,rel:`noopener noreferrer`,children:r})},e.resourceId)})})]})]}),(0,w.jsxs)(`section`,{className:Pm.overviewMain,"aria-labelledby":`work-activity`,children:[(0,w.jsx)(`h2`,{id:`work-activity`,className:Pm.sidebarSectionTitle,children:`Activity timeline`}),he.isPending?(0,w.jsx)(Dm,{label:`Loading activity`}):he.error?(0,w.jsx)(km,{error:he.error,retry:()=>void he.refetch()}):hh(m.data.data.execution.runs,he.data?.items??[]).length?(0,w.jsx)(`ol`,{className:Pm.activityTimeline,"aria-label":`Activity timeline`,children:hh(m.data.data.execution.runs,he.data?.items??[]).map(e=>(0,w.jsxs)(`li`,{className:Pm.activityTimelineItem,children:[(0,w.jsx)(`span`,{className:Pm.activityTimelineMarker,"data-kind":e.kind}),(0,w.jsx)(sh,{value:e.occurredAt}),e.kind===`run`?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:Pm.activityTimelineKind,"data-kind":`run`,children:`Run`}),(0,w.jsx)(Pn,{to:`/runs/${encodeURIComponent(e.run.runId)}`,children:e.run.activity}),(0,w.jsxs)(`span`,{className:Pm.activityTimelineDetail,children:[`Stage: `,e.run.stage??`Not assigned`]}),(0,w.jsxs)(`span`,{className:Pm.activityTimelineDetail,children:[`Runner:`,` `,e.run.runnerName??e.run.runnerModel??`Unassigned`]}),(0,w.jsxs)(`span`,{className:Pm.activityTimelineOutcome,children:[`Outcome: `,cne(e.run)]})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:Pm.activityTimelineKind,"data-kind":`event`,children:`Event`}),(0,w.jsx)(`span`,{children:e.event.type}),e.event.stream!==void 0&&(0,w.jsxs)(`span`,{className:Pm.activityTimelineDetail,children:[`Stream: `,e.event.stream.kind]})]})]},e.id))}):(0,w.jsx)(Om,{children:`No activity yet`})]})]})]}):null})}function sne({actorId:e,sourceAdapter:t}){let[n,r]=(0,S.useState)(!1),i=t===`github`&&e.trim()!==``;return(0,w.jsx)(`span`,{className:Pm.conversationAvatar,"aria-label":i?`${e} GitHub avatar`:e,children:i&&!n?(0,w.jsx)(`img`,{src:`https://github.com/${encodeURIComponent(e)}.png?size=64`,alt:``,onError:()=>r(!0)}):e.slice(0,2).toUpperCase()})}function hh(e,t){return[...e.map(e=>({id:`run:${e.runId}`,kind:`run`,occurredAt:e.finishedAt??e.startedAt,run:e})),...t.map(e=>({id:`event:${e.id}`,kind:`event`,occurredAt:e.occurredAt,event:e}))].sort((e,t)=>t.occurredAt.localeCompare(e.occurredAt))}function cne(e){return e.resolution?.sentinel??e.sentinel??e.status}function lne(e){return e!==void 0&&/^run-ambiguous-after-\d+-attempts$/.test(e)}function gh(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t.kind;return typeof n==`string`&&Object.values(gs).includes(n)?t:void 0}catch{return}}function une({client:e=new Tc}){let[t]=(0,S.useState)(()=>new Yr({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,refetchIntervalInBackground:!1}}})),[n,r]=(0,S.useState)();return(0,S.useEffect)(()=>{let t=new URLSearchParams(globalThis.location.search).get(`grant`);(async()=>{if(t!==null){let n=await e.auth.redeem(t);if(globalThis.history.replaceState({},``,`${globalThis.location.pathname}${globalThis.location.hash}`),n)return r(!0)}return e.auth.session().then(r).catch(()=>r(!1))})()},[e]),n===void 0?null:n?(0,w.jsx)($r,{client:t,children:(0,w.jsx)(Dc.Provider,{value:e,children:(0,w.jsx)(fne,{})})}):(0,w.jsx)(dne,{client:e,onAuthenticated:()=>r(!0)})}function dne({client:e,onAuthenticated:t}){let[n,r]=(0,S.useState)(``),[i,a]=(0,S.useState)(!1);async function o(r){r.preventDefault(),await e.auth.redeem(n)?t():a(!0)}return(0,w.jsx)(`main`,{className:`wake-login`,children:(0,w.jsxs)(`div`,{className:`wake-login-panel`,children:[(0,w.jsx)(`section`,{className:`wake-login-brand`,children:(0,w.jsx)(`img`,{className:`wake-login-logo`,src:hi,alt:`Wake logo`})}),(0,w.jsxs)(`section`,{className:`wake-login-card`,children:[(0,w.jsx)(`h1`,{children:`Login`}),(0,w.jsx)(`p`,{children:`Enter a temporary login code, or scan the code from your operator terminal.`}),(0,w.jsxs)(`form`,{onSubmit:o,children:[(0,w.jsx)(`label`,{htmlFor:`access-key`,children:`Temporary login code`}),(0,w.jsx)(`input`,{id:`access-key`,type:`password`,value:n,onChange:e=>r(e.target.value),autoFocus:!0,required:!0}),(0,w.jsx)(`button`,{className:`wake-login-submit`,type:`submit`,children:`Sign in`}),i&&(0,w.jsx)(`p`,{role:`alert`,children:`Unable to sign in.`})]})]})]})})}function fne(){return(0,w.jsx)(Nm,{children:(0,w.jsxs)(Kt,{children:[(0,w.jsx)(Wt,{path:`/`,element:(0,w.jsx)(Ut,{to:`/board`,replace:!0})}),(0,w.jsx)(Wt,{path:`/board`,element:(0,w.jsx)(mte,{})}),(0,w.jsx)(Wt,{path:`/work`,element:(0,w.jsx)(ane,{})}),(0,w.jsx)(Wt,{path:`/work/:workItemKey`,element:(0,w.jsx)(mh,{})}),(0,w.jsx)(Wt,{path:`/events`,element:(0,w.jsx)(Rte,{})}),(0,w.jsx)(Wt,{path:`/runs`,element:(0,w.jsx)(Gte,{})}),(0,w.jsx)(Wt,{path:`/runs/:runId`,element:(0,w.jsx)(Jte,{})}),(0,w.jsx)(Wt,{path:`/observability`,element:(0,w.jsx)(Wte,{})}),(0,w.jsx)(Wt,{path:`/health`,element:(0,w.jsx)(Vte,{})}),(0,w.jsx)(Wt,{path:`/configuration`,element:(0,w.jsx)(Lte,{})}),(0,w.jsx)(Wt,{path:`*`,element:(0,w.jsx)(Ut,{to:`/board`,replace:!0})})]})})}(0,mi.createRoot)(document.getElementById(`root`)).render((0,w.jsx)(S.StrictMode,{children:(0,w.jsx)(Nn,{children:(0,w.jsx)(une,{})})}));