1import{Z as e,et as t,i as n}from"./loader-circle-DDE4Av0a.js";var r=t(e(),1);function i(){let[e,t]=(0,r.useState)(null),[i,a]=(0,r.useState)(null),[o,s]=(0,r.useState)(!1),[c,l]=(0,r.useState)(!1),[u,d]=(0,r.useState)(!0),[f,p]=(0,r.useState)(!0);return(0,r.useEffect)(()=>{let e=async e=>{let{data:t}=await n.from(`user_roles`).select(`role`).eq(`user_id`,e).eq(`role`,`admin`).maybeSingle();s(!!t)},r=async e=>{let{data:t}=await n.from(`memberships`).select(`id`).eq(`user_id`,e).eq(`status`,`active`).limit(1).maybeSingle();l(!!t),d(!1)},{data:i}=n.auth.onAuthStateChange((n,i)=>{t(i),a(i?.user??null),i?.user?setTimeout(()=>{e(i.user.id),r(i.user.id)},0):(s(!1),l(!1),d(!1))});return n.auth.getSession().then(({data:n})=>{t(n.session),a(n.session?.user??null),n.session?.user?(e(n.session.user.id),r(n.session.user.id)):d(!1),p(!1)}),()=>i.subscription.unsubscribe()},[]),{user:i,session:e,loading:f,isAdmin:o,hasActiveMembership:c,membershipLoading:u,signOut:async()=>{await n.auth.signOut(),a(null),t(null),s(!1),l(!1),d(!1)}}}export{i as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.