1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"a68b32a3c46c41d38e944cc0474febdf5d3ae6d1"};var o=(new e.Error).stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="4a08a1cb-552f-4125-aa29-dc3695262ee9",e._sentryDebugIdIdentifier="sentry-dbid-4a08a1cb-552f-4125-aa29-dc3695262ee9")}catch(r){}}();import{j as e}from"./react-vendor-p0zBBjzR.js";import{r as o,N as r}from"./react-router-DGCK6SaC.js";import{a as n}from"./index-DcifxHNr.js";import{h as t}from"./permissionsService-JdZQnSCd.js";import{A as a}from"./roles-TcIJi1Bg.js";import{adminSecurityService as s}from"./adminSecurityService-FnIx19We.js";import"./supabase-vendor-C0quSso9.js";import"./icons-vendor-DSYRbWvH.js";var i=({children:i,requireAdmin:d=!1,requiredPermission:l,requiredLevel:c="read"})=>{const{user:m,loading:u}=n(),[f,b]=o.useState(null);o.useEffect(()=>{!u&&m&&(async()=>{if(!m)return void b(!1);let e=await s.validateSession();e||(e=null!==await s.createSession()),e&&s.resumeSessionMonitor(),b(e)})()},[m,u]),o.useEffect(()=>{const e=(e,o)=>{let r=document.querySelector(`meta[name="${e}"]`);r||(r=document.createElement("meta"),r.setAttribute("name",e),document.head.appendChild(r)),r.setAttribute("content",o)};return e("robots","noindex, nofollow, noarchive"),e("googlebot","noindex, nofollow, noarchive"),e("bingbot","noindex, nofollow, noarchive"),()=>{const e=document.querySelector('meta[name="robots"]');e&&e.remove();const o=document.querySelector('meta[name="googlebot"]');o&&o.remove();const r=document.querySelector('meta[name="bingbot"]');r&&r.remove()}},[]);const p=e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-slate-900",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary"})});return u?p:m?null===f?p:!1===f?e.jsx(r,{to:"/admin/login?reason=session_invalid",replace:!0}):a.includes(m.role)?d&&"admin"!==m.role||l&&!t(m.role,l,c)?e.jsx(r,{to:"/admin",replace:!0}):e.jsx(e.Fragment,{children:i}):e.jsx(r,{to:"/",replace:!0}):e.jsx(r,{to:"/admin/login",replace:!0})};export{i as default};
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.