(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[272],{1378:(e,s,r)=>{"use strict";r.r(s),r.d(s,{default:()=>c});var a=r(5155),t=r(2108),n=r(5695),u=r(2115);function c(e){let{children:s,params:r}=e,{data:c,status:i}=(0,t.useSession)(),l=(0,n.useRouter)(),[o,d]=(0,u.useState)(""),[f,h]=(0,u.useState)(!0),[m,p]=(0,u.useState)(!1);return((0,u.useEffect)(()=>{(async()=>{let{locale:e}=await r;d(e)})()},[r]),(0,u.useEffect)(()=>{if("loading"!==i&&o&&!m){if(null==c?void 0:c.user){var e;let s=null==(e=c.user.role)?void 0:e.toLowerCase();"client"===s?l.push("/".concat(o,"/client/my-projects")):"freelancer"===s?l.push("/".concat(o,"/freelancer/my-projects")):l.push("/".concat(o)),p(!0);return}h(!1)}},[c,i,l,o,m]),(0,u.useEffect)(()=>{(null==c?void 0:c.user)||p(!1)},[c]),"loading"===i||f)?(0,a.jsx)("div",{className:"d-flex align-items-center justify-content-center loading-container",children:(0,a.jsx)("div",{className:"spinner-border text-primary",role:"status",children:(0,a.jsx)("span",{className:"visually-hidden",children:"Loading..."})})}):(null==c?void 0:c.user)?null:(0,a.jsx)(a.Fragment,{children:s})}},5695:(e,s,r)=>{"use strict";var a=r(8999);r.o(a,"useParams")&&r.d(s,{useParams:function(){return a.useParams}}),r.o(a,"usePathname")&&r.d(s,{usePathname:function(){return a.usePathname}}),r.o(a,"useRouter")&&r.d(s,{useRouter:function(){return a.useRouter}}),r.o(a,"useSearchParams")&&r.d(s,{useSearchParams:function(){return a.useSearchParams}})},6453:(e,s,r)=>{Promise.resolve().then(r.bind(r,1378))}},e=>{e.O(0,[2108,8441,5964,7358],()=>e(e.s=6453)),_N_E=e.O()}]);