(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{27600:(e,t,r)=>{"use strict";r.d(t,{A:()=>l,AuthProvider:()=>c});var s=r(95155),a=r(93004),u=r(35695),n=r(12115),i=r(56104),o=r(35317);let d=(0,n.createContext)(void 0),c=e=>{let{children:t}=e,[r,c]=(0,n.useState)(null),[l,h]=(0,n.useState)(null),[m,f]=(0,n.useState)(!0),p=(0,u.useRouter)();(0,n.useEffect)(()=>{let e=(0,a.hg)(i.j,async e=>{if(c(e),e){let t=(0,o.H9)(i.db,"staffMembers",e.uid),r=await (0,o.x7)(t);r.exists()?h({id:r.id,...r.data()}):(console.warn("No staff member document found for UID: ".concat(e.uid)),h(null))}else h(null);f(!1)});return()=>e()},[]);let v=async()=>{try{await (0,a.CI)(i.j),c(null),h(null),p.push("/login")}catch(e){console.error("Error signing out: ",e)}};return(0,s.jsx)(d.Provider,{value:{user:r,staffMember:l,loading:m,signOut:v},children:t})},l=()=>{let e=(0,n.useContext)(d);if(void 0===e)throw Error("useAuth must be used within an AuthProvider");return e}},32751:(e,t,r)=>{Promise.resolve().then(r.bind(r,33792))},33792:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>o});var s=r(95155),a=r(27600),u=r(35695),n=r(12115),i=r(96280);function o(){let{user:e,loading:t}=(0,a.A)();return(0,n.useEffect)(()=>{t||(e?(0,u.redirect)("/dashboard"):(0,u.redirect)("/login"))},[e,t]),(0,s.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-background",children:(0,s.jsxs)("div",{className:"flex flex-col items-center",children:[(0,s.jsx)(i.A,{className:"h-12 w-12 animate-pulse text-primary"}),(0,s.jsx)("p",{className:"mt-4 text-lg text-muted-foreground",children:"Loading..."})]})})}},35695:(e,t,r)=>{"use strict";var s=r(18999);r.o(s,"redirect")&&r.d(t,{redirect:function(){return s.redirect}}),r.o(s,"usePathname")&&r.d(t,{usePathname:function(){return s.usePathname}}),r.o(s,"useRouter")&&r.d(t,{useRouter:function(){return s.useRouter}})},56104:(e,t,r)=>{"use strict";let s;r.d(t,{db:()=>o,j:()=>i});var a=r(23915),u=r(93004),n=r(35317);s=(0,a.Dk)().length?(0,a.Sx)():(0,a.Wp)({apiKey:"AIzaSyDyptGy3SEJi9TW8b1bQ7tabP2mj_OCHBQ",authDomain:"v9possystem01.firebaseapp.com",databaseURL:"https://v9possystem01-default-rtdb.firebaseio.com",projectId:"v9possystem01",storageBucket:"v9possystem01.appspot.com",messagingSenderId:"457247864721",appId:"1:457247864721:web:26e8f3837ede5e4e1a4c30",measurementId:"G-ET1F44XNX7"});let i=(0,u.xI)(s),o=(0,n.aU)(s)},96280:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(40157).A)("ScanLine",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]])}},e=>{var t=t=>e(e.s=t);e.O(0,[2992,6073,3244,8441,1684,7358],()=>t(32751)),_N_E=e.O()}]);