import{_ as C}from"./B-gxyKwS.js";import{_ as w}from"./DlAUqK2U.js";import{c as d,o as l,a as e,s as N,J as g,x as $,r as q,b as c,w as p,m as n,D as B,d as v,t as L,l as S,a3 as A,N as x}from"./CQHo_aHN.js";import{u as M}from"./CU-5m29H.js";const V={name:"MaterialSymbolsPersonRounded"},D={xmlns:"http://www.w3.org/2000/svg",width:"25px",height:"25px",viewBox:"0 0 24 24"};function R(y,o,u,m,r,_){return l(),d("svg",D,o[0]||(o[0]=[e("path",{fill:"currentColor",d:"M12 12q-1.65 0-2.825-1.175T8 8t1.175-2.825T12 4t2.825 1.175T16 8t-1.175 2.825T12 12m-8 6v-.8q0-.85.438-1.562T5.6 14.55q1.55-.775 3.15-1.162T12 13t3.25.388t3.15 1.162q.725.375 1.163 1.088T20 17.2v.8q0 .825-.587 1.413T18 20H6q-.825 0-1.412-.587T4 18"},null,-1)]))}const U=w(V,[["render",R]]),E={class:"h-20 w-full px-5 shadow-lg md:px-11",style:{background:"linear-gradient(to right, var(--primary), var(--primary-shade))"}},I={class:"flex h-full items-center justify-between 2xl:px-28"},O={class:"flex items-center"},P=["src"],j={class:"flex items-center gap-20 text-xs font-medium text-white md:pr-6 md:text-lg"},z={key:1,class:"relative"},H={style:{color:"var(--primary)"}},J={key:0,class:"absolute right-0 z-50 mt-2 w-40 rounded-lg bg-white py-2 shadow-lg"},F={__name:"NavBar",async setup(y){let o,u;const{data:m,...r}=N(),_=g(()=>r&&r.status&&r.status.value==="authenticated"),{logoSrc:h}=([o,u]=$(()=>M()),o=await o,u(),o),b=g(()=>{var s,t;return((t=(s=m.value)==null?void 0:s.nomeUsuario)==null?void 0:t.split(" ")[0])||""}),a=q(!1),k=async()=>{a.value=!1;try{await r.signOut({redirect:!1}),await x("/")}catch(s){s.message.includes("external URL")&&await x(logoutUrl,{external:!0})}};return window.addEventListener("click",s=>{const t=document.querySelector(".relative");t&&!t.contains(s.target)&&(a.value=!1)}),(s,t)=>{const f=C,T=U;return l(),d("div",E,[e("div",I,[e("div",O,[c(f,{to:"/",class:"block"},{default:p(()=>[e("img",{src:n(h),class:"max-h-16 w-auto cursor-pointer pt-2"},null,8,P)]),_:1})]),e("div",j,[n(_)?(l(),d("div",z,[e("button",{onClick:t[0]||(t[0]=i=>a.value=!n(a)),class:"group flex flex-row rounded-lg bg-white px-3 py-2 font-bold ease-in-out hover:underline hover:underline-offset-8"},[e("p",H,[t[4]||(t[4]=v(" Olá, ")),e("b",null,L(n(b)),1),t[5]||(t[5]=v("! "))]),c(T,{class:"ml-2",style:{color:"var(--primary)"}})]),c(A,{name:"fade"},{default:p(()=>[n(a)?(l(),d("div",J,[e("button",{onClick:k,class:"bold block w-full py-2 pr-6 text-right",onMouseover:t[1]||(t[1]=i=>i.target.style.backgroundColor="rgba(var(--primary-rgb), 0.1)"),onMouseleave:t[2]||(t[2]=i=>i.target.style.backgroundColor=""),style:{color:"var(--primary)"}}," Sair ",32)])):S("",!0)]),_:1})])):(l(),B(f,{key:0,to:"/login"},{default:p(()=>t[3]||(t[3]=[e("p",{class:"group relative rounded-lg bg-white px-3 py-2 font-bold hover:underline hover:underline-offset-8",style:{color:"var(--primary)"}}," Acesse ou Cadastre-se ➜ ",-1)])),_:1,__:[3]}))])])])}}},X=w(F,[["__scopeId","data-v-df35f291"]]);export{X as _};
