import{u}from"./useQuery-DHwdh6Ld.js";import{a8 as s,r,w as n,am as o,an as c}from"./index-BX768Frx.js";function d(i=1e3*10){const t=u({...n(),refetchInterval:i}),e=o(),a=s();return r.useEffect(()=>{a.invalidate(),c(e)},[e,a,t.data?.authenticated]),t.isError?{status:"error"}:t.isPending?{status:"loading"}:{status:"ok",isAuthenticated:t.data.authenticated}}function p({status:i,returnUrl:t}){const e=d(1e3),a=s();r.useEffect(()=>{e.status==="ok"&&(i==="logged_in"&&e.isAuthenticated||i==="logged_out"&&!e.isAuthenticated)&&a.navigate({to:t||"/"})},[a,e,i,t])}export{p as a,d as u};
