import{Bn as e,Wn as t,vr as n}from"./i18n-CsN8OUP9.js";import{a as r,c as i,i as a,l as o,o as s}from"./cron-CUc13j9u.js";function c(e=()=>void 0){let t=new Set;return{isRunning:e=>t.has(e),async run(n,r,i){if(t.has(n))return{started:!1,value:null};t.add(n);try{return e(n,!0),i?.(),{started:!0,value:await r()}}finally{t.delete(n),e(n,!1)}}}}function l(e){return`${n()??``}\u0000${e}`}async function u(t,n){try{let r=await e(t);return s(n,r)?{jobs:r,refreshError:null,stale:!1}:{jobs:null,refreshError:null,stale:!0}}catch(e){return i(n)?{jobs:null,refreshError:e,stale:!1}:{jobs:null,refreshError:null,stale:!0}}}function d(e){return u(e,r(l(e)))}async function f(e,t){let n=a(l(e)),r;try{r=await t()}catch(e){if(!o(n))return{jobs:null,refreshError:null,stale:!0,value:null};throw e}if(!o(n))return{jobs:null,refreshError:null,stale:!0,value:null};let i=await d(e);return o(n)?i.stale?{jobs:null,refreshError:null,stale:!1,value:r}:{...i,value:r}:{jobs:null,refreshError:null,stale:!0,value:null}}async function p(e,n){let{value:r,...i}=await f(n,()=>t(e));return i}var m={completed:`bg-(--ui-text-quaternary)`,disabled:`bg-(--ui-text-quaternary)`,enabled:`bg-primary`,error:`bg-destructive`,paused:`bg-amber-500`,running:`bg-primary`,scheduled:`bg-primary`};function h(e){return(typeof e.state==`string`?e.state.trim():``)||(e.enabled===!1?`disabled`:`scheduled`)}function g(e){let t=e=>typeof e==`string`?e.trim():``,n=e=>e.length>60?`${e.slice(0,60)}…`:e;return t(e.name)||n(t(e.prompt))||n(t(e.script))||e.id||`Cron job`}export{d as a,f as i,h as n,p as o,g as r,c as s,m as t};