import{X as e,bt as t,ht as n,vt as r}from"./BT3KAag_.js";import{p as i}from"./D7L6XPS4.js";import{t as a}from"./CHgG1pyP.js";function o(){let a=t(n([])),o=t(n([])),s=t(null),c=t(!1),l=t(!1),u=t(!1);async function d(){r(c,!0),r(u,!1);try{let e=await i();r(a,e.openTasks,!0),r(o,e.todaysMeetings,!0),r(s,e.currentUserPersonId,!0),r(l,!0)}catch(e){console.error(`Failed to load home data:`,e),r(l,!0)}finally{r(c,!1)}}function f(){r(u,!0)}return{get openTasks(){return e(a)},get todaysMeetings(){return e(o)},get currentUserPersonId(){return e(s)},get loading(){return e(c)},get loaded(){return e(l)},get stale(){return e(u)},load:d,markStale:f}}var s=o(),c=null;a.addEntityChangeHandler(e=>{e.entityType!==`event`&&e.entityType!==`task`||(c&&clearTimeout(c),c=setTimeout(()=>{c=null,s.load()},250))});export{s as t};