1import{j as e}from"./vendor-radix-nav-DPstRtdA.js";import{r as s,N as u}from"./vendor-react-BkILtrFN.js";import{s as o}from"./client-CUvvwoXX.js";import"./vendor-radix-overlay-Crsj6URd.js";const h=({children:i})=>{const[t,r]=s.useState("loading");return s.useEffect(()=>{o.auth.getSession().then(({data:{session:a}})=>{if(!a){r("unauthorized");return}o.rpc("has_role",{_user_id:a.user.id,_role:"admin"}).then(({data:n})=>{r(n?"authorized":"unauthorized")})})},[]),t==="loading"?e.jsx("div",{className:"min-h-screen flex items-center justify-center text-muted-foreground",children:"Loadingâ¦"}):t==="unauthorized"?e.jsx(u,{to:"/admin",replace:!0}):e.jsx(e.Fragment,{children:i})};export{h as default}; 2//# sourceMappingURL=ProtectedRoute-EnsfvSxP.js.map
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.