1import{b as c}from"./vendor-query-D7aeqDJ8.js";import{u as d,h as m,v as y,w as l}from"./index-Cpo9q_Rp.js";function p(){var t;const{user:a,loading:s}=d();return{isAdmin:((t=a==null?void 0:a.app_metadata)==null?void 0:t.is_admin)===!0,isLoading:s}}function w(){const{isAdmin:a,isLoading:s}=p();return{...c({queryKey:["admin-analytics"],queryFn:async()=>{const{data:{session:o}}=await m.auth.getSession();if(!o)throw new Error("Not authenticated");const u=`${y}/functions/v1/admin-analytics`,e=await fetch(u,{method:"POST",headers:{Authorization:`Bearer ${o.access_token}`,apikey:l,"Content-Type":"application/json"}});if(!e.ok){let r=`HTTP ${e.status}`;try{const i=await e.json();r=i.error||i.message||i.msg||r}catch{}throw new Error(r)}const n=await e.json();if(!n.success)throw new Error(n.error||"Analytics query failed");return n.analytics},enabled:a&&!s,staleTime:2*60*1e3,refetchInterval:5*60*1e3,retry:2}),isAdmin:a,isAdminLoading:s}}export{w as a,p as u};
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.