1import{a as Ae,u as he,r as d,s as Q,j as e,L as X,t as ge,b as be,c as fe,d as Oe,O as de,e as He,g as Ge}from"./index-D--km7DC.js";import{u as xe}from"./useLocation-Vm7iQKrQ.js";import{B as O}from"./button-lVmdVtdv.js";import{B as Ue}from"./badge-DjV4gsfA.js";import{D as se,a as re,b as oe,c as C,d as De,e as J,f as Te,g as _e,h as $e}from"./dropdown-menu-ByrAJV8l.js";import{u as Je,a as We}from"./use-cargos-avaliacao-DtEQGQcZ.js";import{j as Re}from"./jornada-ai-horizontal-sem-descritor-centralizada-reverso-contornos-DEKhKFt2.js";import{j as Ke}from"./jornada-ai-simbolo-monocromatico-branco-contornos-CO0DgRqB.js";import{u as pe}from"./useQuery-MhPwSa2h.js";import{A as Qe,a as Ye,b as Xe,c as Ze,d as ea,e as aa,f as ta,g as sa}from"./alert-dialog-BRjd2wgE.js";import{o as ra}from"./tabela-vigencia-1EtlZ443.js";import{u as oa,a as ia,b as na,p as la}from"./use-implementation-guide-BdNTXjhr.js";import{L as ca}from"./list-checks-5tF7rfgv.js";import{C as B}from"./check-Be83cdEV.js";import{C as da}from"./chevron-down-DfZWofzl.js";import{C as Le}from"./chevron-up-Cl-74IUD.js";import{E as ma}from"./ellipsis-CrHGB4Zg.js";import{u as ua}from"./ferias.hooks-XNrXZIKj.js";import{u as pa}from"./beneficios.hooks-D5uuCRPT.js";import{u as ha}from"./diagnostico.hooks-BSFH8MPI.js";import{u as fa}from"./use-can-D0DvyN0M.js";import{u as xa}from"./use-mobile-BSuHg9m0.js";import{g as me,s as ga}from"./pending-invite-AEP54Sou.js";import{u as ba}from"./useServerFn-CuIkaT2U.js";import{u as va}from"./use-avatar-url-BqdBvy82.js";import{D as ja,a as wa,b as ya,c as Na,d as ka}from"./dialog-B3KFuQej.js";import{c as Ca}from"./utils-BQHNewu7.js";import{g as Sa,B as Ea}from"./smartGuideSteps-DixkBqc4.js";import{X as ve}from"./x-CjAS2ixB.js";import{L as Ma}from"./lightbulb-D5ost18n.js";import{C as Ia}from"./chevron-left-DrQcpkzq.js";import{C as Aa}from"./chevron-right-ar8dIn--.js";import{S as je}from"./sparkles-DhDAJM6N.js";import{P as we}from"./play-DBNHja8W.js";import{C as Oa}from"./circle-question-mark-CYe2ZGet.js";import{C as Da}from"./circle-check-B1f3NtlI.js";import{R as ye}from"./rotate-ccw-CSDBrmuv.js";import{S as ie}from"./shield-check-NGdZsNAz.js";import{B as Y}from"./building-2-XuCxlrqX.js";import{H as Pe}from"./handshake-QA0Pbpd6.js";import{C as qe}from"./clipboard-list-BTV5t-cv.js";import{C as Ta,l as _a}from"./partner-portal.functions-Gqi01y2H.js";import{M as ne,S as le,a as Be}from"./sun-qV41Viuc.js";import{L as ze}from"./log-out-C8xj2EoF.js";import{c as Z}from"./createLucideIcon-BR4iEKFU.js";import{G as $a}from"./git-branch-Cg7Mi2Y4.js";import{N as Ra}from"./network-CyuYPq8U.js";import{B as La}from"./briefcase-0JdUFpGY.js";import{U as Pa}from"./users-CMbf8kRB.js";import{T as qa}from"./table-2-S-LGUHRw.js";import{T as Ba}from"./trending-up-D4CfVarr.js";import{F as za}from"./file-text-pvG5avg0.js";import{H as Va}from"./history-DXIIObft.js";import{G as Fa}from"./gift-D2UZSZlM.js";import{C as Ha}from"./calendar-days-BSzgan_6.js";import{I as Ga}from"./inbox-C25ti4Tx.js";import"./index-BEYB5-aB.js";import"./index-CU3z_Vzb.js";import"./index-CReOmYtk.js";import"./index-CH5N4Uew.js";import"./Combination-CGLEaeVp.js";import"./index-BWLGMizO.js";import"./index-DFVkI8ez.js";import"./index-DLcUBuST.js";import"./index-DDupPUvR.js";import"./index-ByRA3Mka.js";import"./index-CWMLrtWJ.js";import"./circle-XXnUobb-.js";import"./cargos-avaliacao-C70V-40H.js";import"./impacto-suggestions-DOhOyA83.js";import"./salary-position-C9X2wRGK.js";import"./index-BeTTohI2.js";import"./useMutation-NxVD-SiK.js";import"./auth-middleware-C-w6AGg4.js";import"./types-D1g8DkzT.js";import"./permissions-BYvTN5Ts.js";import"./ajuda-kF_ynt8v.js";const Ua=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],Ja=Z("layout-dashboard",Ua);const Wa=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Ka=Z("panel-left-close",Wa);const Qa=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}
1]],Ya=Z("panel-left-open",Qa);const Xa=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],Za=Z("sliders-vertical",Xa);const et=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],at=Z("user",et);function tt(a){const t=a.totalColaboradores>0,s=t&&a.avaliacaoVerificavel&&a.totalCargos>0&&a.cargosAvaliados>=a.totalCargos,r=s&&a.totalNiveis>0,o=r&&a.tabelasVigentesHoje===1,m=t?a.colaboradoresEnquadrados/a.totalColaboradores:0,u=o&&m>=.8,p=u&&a.impactosDisponiveis>0;return{colaboradores:t,avaliacao:s,niveis:r,tabela:o,enquadramento:u,impacto:p}}const st="v1";function Ne(a,t){return`flowbar:collapsed:${st}:${a}:${t}`}function rt(){const{orgId:a}=Ae(),{user:t}=he(),s=t?.id??null,{actor:r,loading:o,podeGerenciar:m}=oa(),{data:u,isLoading:p}=ia(),c=na(),[j,S]=d.useState(!1),[v,y]=d.useState(null);d.useEffect(()=>{!a||!s||S(localStorage.getItem(Ne(s,a))==="1")},[a,s]);const E=la({actor:r,status:u?.status??null,loading:o||p||!a}),R=()=>{if(!a||!s)return;const l=!j;S(l),localStorage.setItem(Ne(s,a),l?"1":"0")},k=Je(),{data:_}=pe({queryKey:["flowbar",a],enabled:!!a&&E,staleTime:3e4,queryFn:async()=>{const[l,M,g,F]=await Promise.all([Q.from("colaboradores").select("id,nivel_n,faixa",{count:"exact"}).eq("org_id",a).eq("ativo",!0),Q.from("niveis_cargo").select("numero",{count:"exact",head:!0}).eq("org_id",a),Q.from("tabelas_salariais").select("id,vigencia_inicio,vigencia_fim").eq("org_id",a),Q.from("simulacoes_impacto").select("id",{count:"exact",head:!0}).eq("org_id",a)]),L=l.count??0,ee=(l.data??[]).filter(w=>w.nivel_n&&w.faixa).length,H=M.count??0,W=g.data?.length??0,f=ra(g.data??[]).length,b=F.count??0;return{totalColab:L,colabEnquadrados:ee,totalNiveis:H,totalTabelas:W,tabelasVigentesHoje:f,impactosDisponiveis:b}}}),h={..._??{totalColab:0,colabEnquadrados:0,totalNiveis:0,totalTabelas:0,tabelasVigentesHoje:0,impactosDisponiveis:0},totalCargos:k.totalCargosAtivos??0,cargosAvaliados:k.cargosAvaliados??0},$=k.totalCargosAtivos!==void 0&&k.cargosPendentes!==void 0,D=tt({totalColaboradores:h.totalColab,totalCargos:h.totalCargos,cargosAvaliados:h.cargosAvaliados,avaliacaoVerificavel:$,totalNiveis:h.totalNiveis,tabelasVigentesHoje:h.tabelasVigentesHoje,colaboradoresEnquadrados:h.colabEnquadrados,impactosDisponiveis:h.impactosDisponiveis}),N=[{key:"import",label:"Colaboradores",to:"/app/colaboradores",done:D.colaboradores,hint:`${h.totalColab} colaborador(es) ativo(s)`},{key:"aval",label:"Avaliação de cargos",to:"/app/cargos",done:D.avaliacao,hint:`${h.cargosAvaliados}/${h.totalCargos} cargos avaliados`},{key:"agrup",label:"NÃveis",to:"/app/cargos/matriz",done:D.niveis,hint:`${h.totalNiveis} nÃvel(is) definido(s)`},{key:"tabela",label:"Tabela salarial",to:"/app/tabela",done:D.tabela,hint:h.tabelasVigentesHoje===1?"Uma tabela vigente hoje":h.tabelasVigentesHoje>1?`${h.tabelasVigentesHoje} tabelas vigentes hoje â ajuste o conflito`:`${h.totalTabelas} tabela(s), nenhuma vigente hoje`},{key:"enquadrar",label:"Enquadramento salarial",to:"/app/colaboradores",done:D.enquadramento,hint:`${h.colabEnquadrados}/${h.totalColab} com NV e NH preenchidos`},{key:"impacto",label:"Impacto",to:"/app/impacto",done:D.impacto,hint:h.impactosDisponiveis>0?"Cálculo de impacto disponÃvel":"Nenhum cálculo de impacto disponÃvel"}],z=N.filter(l=>l.done).length,T=N.findIndex(l=>!l.done);if(!E)return null;const V=async l=>{try{await c.mutateAsync(l),y(null),ge.success(l==="hidden"?"Guia ocultado para toda a empresa.":"Implantação concluÃda.")}catch(M){ge.error(M instanceof Error?M.message:"Não foi possÃvel alterar o guia.")}};return e.jsxs("div",{className:"border-b bg-card/60 backdrop-blur sticky top-0 z-20",children:[e.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-2 flex items-center gap-2",children:[j?e.jsxs("button",{onClick:R,className:"flex-1 text-xs text-muted-foreground hover:text-foreground text-left flex items-center gap-2",children:[e.jsx(ca,{className:"h-3.5 w-3.5"}),e.jsxs("span",{className:"font-medium",children:[z,"/",N.length," etapas concluÃdas"]}
1),e.jsx("span",{className:"text-muted-foreground/60",children:"â clique para expandir"})]}):e.jsx("ol",{className:"flex-1 flex items-center gap-1 text-xs whitespace-nowrap overflow-x-auto",children:N.map((l,M)=>{const g=M===T,F="flex items-center gap-1.5 px-2.5 py-1 rounded-md transition-colors",L=l.done?"bg-primary/10 text-primary hover:bg-primary/15":g?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted";return e.jsxs("li",{className:"flex items-center",children:[e.jsxs(X,{to:l.to,className:`${F} ${L}`,title:l.hint,children:[e.jsx("span",{className:`inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] ${l.done?"bg-primary text-primary-foreground":"border border-current"}`,children:l.done?e.jsx(B,{className:"h-2.5 w-2.5"}):M+1}),e.jsx("span",{className:"font-medium",children:l.label})]}),M<N.length-1&&e.jsx("span",{className:"mx-1 text-muted-foreground/40",children:"âº"})]},l.key)})}),e.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e.jsx(O,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:R,title:j?"Expandir":"Recolher",children:j?e.jsx(da,{className:"h-3.5 w-3.5"}):e.jsx(Le,{className:"h-3.5 w-3.5"})}),m&&e.jsxs(se,{children:[e.jsx(re,{asChild:!0,children:e.jsx(O,{variant:"ghost",size:"icon",className:"h-6 w-6",title:"Opções do guia",children:e.jsx(ma,{className:"h-3.5 w-3.5"})})}),e.jsxs(oe,{align:"end",children:[e.jsx(C,{onSelect:()=>y("hidden"),children:"Ocultar guia"}),e.jsx(C,{onSelect:()=>y("completed"),children:"Concluir implantação"})]})]})]})]}),e.jsx(Qe,{open:v!==null,onOpenChange:l=>!l&&y(null),children:e.jsxs(Ye,{children:[e.jsxs(Xe,{children:[e.jsx(Ze,{children:v==="completed"?"Concluir a implantação?":"Ocultar o guia de implantação?"}),e.jsx(ea,{children:v==="completed"?e.jsx(e.Fragment,{children:"O guia será ocultado para todos os usuários desta empresa. Essa ação não altera dados, permissões, salários ou configurações dos módulos. O guia poderá ser reativado posteriormente."}):e.jsx(e.Fragment,{children:"O guia será ocultado para todos os usuários desta empresa. Você poderá reativá-lo posteriormente nas configurações."})})]}),e.jsxs(aa,{children:[e.jsx(ta,{disabled:c.isPending,children:"Cancelar"}),e.jsx(sa,{disabled:c.isPending,onClick:l=>{l.preventDefault(),v&&V(v)},children:c.isPending?"Salvandoâ¦":v==="completed"?"Concluir implantação":"Ocultar guia"})]})]})})]})}const ke="jornada:smart-guide-enabled:v1",Ce="jornada:smart-guide-welcome-dismissed:v1",Ve="jornada:smart-guide-completed:v1",A=16;function K(a,t,s){return Math.min(Math.max(a,t),Math.max(t,s))}function ot(a){return Array.isArray(a.selector)?a.selector:[a.selector]}function Se(a){if(typeof document>"u")return null;for(const t of ot(a)){const r=Array.from(document.querySelectorAll(t)).find(o=>{const m=o.getBoundingClientRect(),u=window.getComputedStyle(o);return m.width>0&&m.height>0&&u.display!=="none"&&u.visibility!=="hidden"});if(r)return r}return null}function it(a,t){const s=Math.max(0,Math.min(a.right,t.right)-Math.max(a.left,t.left)),r=Math.max(0,Math.min(a.bottom,t.bottom)-Math.max(a.top,t.top));return s*r}function nt(a,t,s){const r=Math.min(390,Math.max(280,t-A*2)),o=Math.max(220,Math.min(390,s-A*2)),m=Math.max(A,t-r-A),u=Math.max(A,s-o-A),p=[{left:A,top:A},{left:m,top:A},{left:A,top:u},{left:m,top:u}],c={left:a.left-10,top:a.top-10,right:a.right+10,bottom:a.bottom+10},j=p.reduce((S,v)=>{const y=it(c,{left:v.left,top:v.top,right:v.left+r,bottom:v.top+o});return y<S.score?{...v,score:y}:S},{left:p[0].left,top:p[0].top,score:Number.POSITIVE_INFINITY});return{left:K(j.left,A,Math.max(A,t-r-A)),top:K(j.top,A,Math.max(A,s-o-A)),width:r,maxHeight:o}}function lt(){if(typeof window>"u")return new Set;try{const a=window.localStorage.getItem(Ve),t=a?JSON.parse(a):[];return new Set(Array.isArray(t)?t.filter(s=>typeof s=="string"):[])}catch{return new Set}}function ct({collapsed:a=!1}){const t=xe(),s=d.useMemo(()=>Sa(t.pathname),[t.pathname]),[r,o]=d.useState(!1),[m,u]=d.useState(!1),[p,c]=d.useState(!0),[j,S]=d.useState(!0),[v,y]=d.useState(new Set),[E,R]=d.useState([]),[k,_]=d.useState(0),[h,$]=d.useState(!1),[D,N]=d.use
1State(null),z=d.useRef(null),T=E[k]??null,V=v.has(s.key);d.useEffect(()=>{typeof window>"u"||(c(window.localStorage.getItem(ke)!=="0"),S(window.localStorage.getItem(Ce)==="1"),y(lt()),o(!0))},[]),d.useEffect(()=>{!r||typeof window>"u"||window.localStorage.setItem(ke,p?"1":"0")},[p,r]),d.useEffect(()=>{!r||typeof window>"u"||window.localStorage.setItem(Ce,j?"1":"0")},[r,j]),d.useEffect(()=>{!r||typeof window>"u"||window.localStorage.setItem(Ve,JSON.stringify(Array.from(v)))},[v,r]),d.useEffect(()=>{u(!1),$(!1),N(null),R([]),_(0)},[t.pathname]),d.useEffect(()=>{if(!h||!T)return;const f=Se(T);if(!f){k<E.length-1?_(G=>G+1):($(!1),N(null));return}f.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"});let b=window.setTimeout(()=>{N(f.getBoundingClientRect()),z.current?.focus()},220);const w=()=>{window.clearTimeout(b),b=window.setTimeout(()=>N(f.getBoundingClientRect()),20)};return window.addEventListener("resize",w),window.addEventListener("scroll",w,!0),()=>{window.clearTimeout(b),window.removeEventListener("resize",w),window.removeEventListener("scroll",w,!0)}},[T,h,k,E.length]),d.useEffect(()=>{if(!h)return;const f=b=>{b.key==="Escape"&&($(!1),N(null)),b.key==="ArrowRight"&&k<E.length-1&&(N(null),_(w=>w+1)),b.key==="ArrowLeft"&&k>0&&(N(null),_(w=>w-1))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[h,k,E.length]);const l=()=>{const f=s.steps.filter(b=>!!Se(b));f.length!==0&&(S(!0),u(!1),R(f),_(0),N(null),$(!0))},M=f=>{$(!1),N(null),R([]),_(0),f&&y(b=>{const w=new Set(b);return w.add(s.key),w})},g=()=>{y(f=>{const b=new Set(f);return b.delete(s.key),b})},F=()=>{c(f=>{const b=!f;return b||S(!0),b})},L=()=>{c(!0),S(!1),u(!1)},ee=E.length>0?(k+1)/E.length*100:0;let H=null;if(r&&h&&T&&D&&typeof document<"u"){const f=window.innerWidth,b=window.innerHeight,w=8,G=K(D.left-w,0,f),P=K(D.top-w,0,b),ae=K(D.right+w,0,f),te=K(D.bottom+w,0,b),ce=Math.max(0,ae-G),i=Math.max(0,te-P),x=nt(D,f,b);H=be.createPortal(e.jsxs("div",{className:"pointer-events-none fixed inset-0 z-[100]","aria-live":"polite",children:[e.jsx("div",{className:"pointer-events-auto fixed bg-black/55 dark:bg-black/70",style:{left:0,top:0,right:0,height:P}}),e.jsx("div",{className:"pointer-events-auto fixed bg-black/55 dark:bg-black/70",style:{left:0,top:P,width:G,height:i}}),e.jsx("div",{className:"pointer-events-auto fixed bg-black/55 dark:bg-black/70",style:{left:ae,top:P,right:0,height:i}}),e.jsx("div",{className:"pointer-events-auto fixed bg-black/55 dark:bg-black/70",style:{left:0,top:te,right:0,bottom:0}}),e.jsx("div",{className:"fixed rounded-xl border-2 border-primary ring-4 ring-primary/20 shadow-2xl transition-all duration-200",style:{left:G,top:P,width:ce,height:i}}),e.jsxs("div",{ref:z,tabIndex:-1,className:"pointer-events-auto fixed overflow-y-auto rounded-2xl border border-primary/20 bg-card text-card-foreground shadow-2xl outline-none",style:{left:x.left,top:x.top,width:x.width,maxHeight:x.maxHeight},children:[e.jsx("div",{className:"sticky top-0 z-10 h-1 bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${ee}%`}})}),e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-primary",children:["Passo ",k+1," de ",E.length]}),e.jsx("h3",{className:"mt-1 text-lg font-semibold",children:T.title})]}),e.jsx(O,{variant:"ghost",size:"icon",onClick:()=>M(!1),"aria-label":"Fechar guia",children:e.jsx(ve,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"mt-3 text-sm leading-relaxed text-muted-foreground",children:T.description}),T.tip?e.jsxs("div",{className:"mt-4 flex gap-2 rounded-lg border border-primary/15 bg-primary/5 p-3 text-sm",children:[e.jsx(Ma,{className:"mt-0.5 h-4 w-4 shrink-0 text-primary"}),e.jsx("span",{children:T.tip})]}):null,e.jsxs("div",{className:"mt-5 flex items-center justify-between gap-2",children:[e.jsxs(O,{variant:"ghost",size:"sm",onClick:()=>{N(null),_(n=>Math.max(0,n-1))},disabled:k===0,children:[e.jsx(Ia,{className:"mr-1 h-4 w-4"}),"Anterior"]}),k===E.length-1?e.jsx(O,{size:"sm",onClick:()=>M(!0),children:"Concluir"}):e.jsxs(O,{size:"sm",onClick:()=>{N(null),_(n=>Math.min(E.length-1,n+1))},children:["Próximo",e.jsx(Aa,{className:"ml-1 h-4 w-4"})]})]}),e.jsx("div",{className:"mt-3 text-center text-[11px] text-muted-foreground",children:"Use â â para navegar ou Esc para sair."})]})]})]}),document.body)}const W=r&&p&&!j&&!m&&!h&&typeof document<"u"?be.createPortal(e.jsx("div",{className:"fixed bottom-4 right-4 z-[90] max-h-[calc(100vh-2rem)] w-[min(380px,calc(100vw-2rem))] overflow-y-auto rounded-2xl border border-primary/20 bg-card p-4 text-card-foreground shadow-2xl",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:e.jsx(je,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-semibold",children:"Quer conhecer esta tela?"}),e.jsx("p",{className:"mt-1 text-sm leading-relaxed text-muted-foreground",children:"O guia destaca somente os elementos disponÃveis para o seu perfil e explica como usar a tela sem alterar dados. Você pode abri-lo novamente pelo menu lateral."}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(O,{size:"sm",onClick:l,children:[e.jsx(we,{className:"mr-1 h-4 w-4"}),"Começar"]}),e.jsx(O,{size:"sm",variant:"ghost",onClick:()=>S(!0),children:"Agora não"})]})]}),e.jsx("button",{type:"button",onClick:()=>S(!0),className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Fechar convite do guia",children:e.jsx(ve,{className:"h-4 w-4"})})]})}),document.body):null;return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>u(!0),title:"Guia da tela","aria-label":"Abrir guia da tela","data-guide":"smart-guide-button",className:Ca("w-full flex items-center rounded-md px-3 py-2 text-sm transition-colors hover:bg-sidebar-accent/50 text-sidebar-foreground cursor-pointer",a?"
1justify-center":"gap-3"),children:[e.jsx(Oa,{className:"h-4 w-4 shrink-0"}),a?null:e.jsx("span",{className:"truncate",children:"Guia da tela"})]}),e.jsx(ja,{open:m,onOpenChange:u,children:e.jsxs(wa,{className:"sm:max-w-lg",children:[e.jsxs(ya,{children:[e.jsxs(Na,{className:"flex items-center gap-2",children:[e.jsx(je,{className:"h-5 w-5 text-primary"}),"Guia inteligente"]}),e.jsx(ka,{children:"Explica a tela atual e destaca somente os elementos que estão disponÃveis para o seu perfil. O tutorial não grava nem altera dados."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-border bg-muted/20 p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold",children:s.title}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s.subtitle})]}),V?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-primary/10 px-2 py-1 text-xs font-medium text-primary",children:[e.jsx(Da,{className:"h-3.5 w-3.5"}),"ConcluÃdo"]}):null]}),e.jsxs("div",{className:"mt-3 text-xs text-muted-foreground",children:[s.steps.length," explicações preparadas. Passos que não estiverem visÃveis são pulados automaticamente."]})]}),e.jsxs(O,{className:"w-full justify-center",onClick:l,children:[e.jsx(we,{className:"mr-2 h-4 w-4"}),V?"Rever tutorial desta tela":"Iniciar tutorial desta tela"]}),s.nextSuggestion?e.jsxs("div",{className:"rounded-xl border border-primary/15 bg-primary/5 p-4",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-primary",children:"Próximo passo sugerido"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s.nextSuggestion})]}):null,e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-xl border p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Convite de primeiro uso"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Quando ligado, a Jornada.ai pode lembrar que existe um guia. O botão no menu continua disponÃvel mesmo se você desligar o convite."})]}),e.jsx(O,{type:"button",size:"sm",variant:p?"secondary":"outline",onClick:F,"aria-pressed":p,children:p?"Ligado":"Desligado"})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[j?e.jsxs(O,{variant:"ghost",size:"sm",onClick:L,children:[e.jsx(ye,{className:"mr-2 h-4 w-4"}),"Mostrar convite"]}):e.jsx("div",{}),V?e.jsxs(O,{variant:"ghost",size:"sm",onClick:g,children:[e.jsx(ye,{className:"mr-2 h-4 w-4"}),"Zerar progresso"]}):null]})]})]})}),W,H]})}const dt=[{to:"/app/admin/platform",label:"Clientes",icon:Y,exact:!0},{to:"/app/admin/parceiros",label:"Parceiros",icon:Pe},{to:"/app/admin/diagnosticos",label:"Diagnósticos",icon:qe},{to:"/app/admin/billing-shadow",label:"Shadow Billing",icon:Ta}];function Ee({mobile:a=!1}){const t=fe(),{user:s,signOut:r}=he(),{theme:o,resolved:m,setTheme:u}=Oe();return e.jsxs(se,{children:[e.jsx(re,{asChild:!0,children:a?e.jsx(O,{variant:"ghost",size:"icon","aria-label":"Abrir menu da gestão da plataforma",className:"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",children:e.jsx(ie,{className:"h-4 w-4"})}):e.jsxs(O,{variant:"ghost",className:"w-full justify-start text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",children:[e.jsx(ie,{className:"mr-2 h-4 w-4"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-xs",children:s?.email??"Superadmin"})]})}),e.jsxs(oe,{align:a?"end":"start",side:a?"bottom":"top",className:"w-60",children:[e.jsx(De,{className:"text-xs font-normal text-muted-foreground",children:"Ambiente interno da Jornada.ai"}),e.jsx(J,{}),e.jsxs(C,{onClick:()=>t({to:"/app"}),children:[e.jsx(Y,{className:"mr-2 h-4 w-4"}),"Ver área do cliente"]}),e.jsxs(Te,{children:[e.jsxs(_e,{children:[m==="dark"?e.jsx(ne,{className:"mr-2 h-4 w-4"}):e.jsx(le,{className:"mr-2 h-4 w-4"}),"Tema"]}),e.jsxs($e,{children:[e.jsxs(C,{onClick:()=>u("light"),children:[e.jsx(le,{className:"mr-2 h-4 w-4"})," Claro",o==="light"&&e.jsx(B,{className:"ml-auto h-3.5 w-3.5"})]}),e.jsxs(C,{onClick:()=>u("dark"),children:[e.jsx(ne,{className:"mr-2 h-4 w-4"})," Escuro",o==="dark"&&e.jsx(B,{className:"ml-auto h-3.5 w-3.5"})]}),e.jsxs(C,{onClick:()=>u("system"),children:[e.jsx(Be,{className:"mr-2 h-4 w-4"})," Sistema",o==="system"&&e.jsx(B,{className:"ml-auto h-3.5 w-3.5"})]})]})]}),e.jsx(J,{}),e.jsxs(C,{className:"text-destructive focus:text-destructive",onClick:async()=>{await r(),t({to:"/login",search:{invite:void 0,next:"/app/admin/platform"}})},children:[e.jsx(ze,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})}function mt({children:a}){const t=xe(),s=t.pathname.startsWith("/app/diagnosticos");return e.jsxs("div",{className:"flex h-[100dvh] min-h-0 flex-col overflow-hidden bg-muted/30 lg:flex-row",children:[e.jsxs("aside",{className:"border-sidebar-border shrink-0 border-b bg-sidebar text-sidebar-foreground print:hidden lg:relative lg:h-[100dvh] lg:w-64 lg:border-b-0 lg:border-r",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-sidebar-border px-4 py-3 lg:block",children:[e.jsx(X,{to:"/app/admin/platform","aria-label":"Gestão da plataforma Jornada.ai",className:"inline-flex",children:e.jsx("img",{src:Re,alt:"Jornada.ai",className:"h-auto w-[160px] max-w-full object-contain sm:w-[176px]"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"hidden items-center gap-1 text-[11px] font-semibold uppercase tracking-[0.14em] text-sidebar-foreground
1/55 sm:flex lg:mt-3",children:[e.jsx(ie,{className:"h-3.5 w-3.5"}),"Gestão da plataforma"]}),e.jsx("div",{className:"lg:hidden",children:e.jsx(Ee,{mobile:!0})})]})]}),e.jsx("nav",{className:"flex gap-1 overflow-x-auto p-3 lg:block lg:space-y-1 lg:overflow-visible",children:dt.map(r=>{const o=r.label==="Diagnósticos"?t.pathname.startsWith(r.to)||s:"exact"in r&&r.exact?t.pathname===r.to:t.pathname.startsWith(r.to),m=r.icon;return e.jsxs(X,{to:r.to,className:`flex shrink-0 items-center gap-2 rounded-md px-3 py-2 text-sm transition-colors ${o?"bg-sidebar-accent text-sidebar-accent-foreground font-medium":"hover:bg-sidebar-accent/50"}`,children:[e.jsx(m,{className:"h-4 w-4"}),r.label]},r.to)})}),e.jsx("div",{className:"hidden border-t border-sidebar-border p-3 lg:absolute lg:inset-x-0 lg:bottom-0 lg:block",children:e.jsx(Ee,{})})]}),e.jsx("main",{className:"platform-scroll min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain print:overflow-visible",children:e.jsx("div",{className:"mx-auto max-w-[1500px] p-4 print:max-w-none print:p-0 sm:p-6 lg:p-8",children:a})})]})}function Fe(a){const t=String(a??"").trim().match(/^#?([0-9a-f]{6})$/i);return t?{r:parseInt(t[1].slice(0,2),16),g:parseInt(t[1].slice(2,4),16),b:parseInt(t[1].slice(4,6),16)}:null}function ue(a){const t=a/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ut(a){return .2126*ue(a.r)+.7152*ue(a.g)+.0722*ue(a.b)}function Me(a,t){const s=Math.max(a,t),r=Math.min(a,t);return(s+.05)/(r+.05)}function pt(a){const t=Fe(a);if(!t)return"#ffffff";const s=ut(t);return Me(s,0)>=Me(s,1)?"#000000":"#ffffff"}function ht(a){const t=[...a?.palette??[],...a?.primary?[a.primary]:[],...a?.accent?[a.accent]:[]];return t.length?t.every(s=>{const r=Fe(s.hex);return r?Math.max(r.r,r.g,r.b)-Math.min(r.r,r.g,r.b)<=24:!1}):!1}function Ie(a){return a?`oklch(${a})`:null}function ft(a,t){if(!a?.enabled||!a.primary?.oklch)return;const s=Ie(a.primary.oklch),r=Ie(a.accent?.oklch)??s,o=ht(a),m=o&&t==="dark"?`color-mix(in oklab, ${s} 42%, white)`:s,u=o&&t==="dark"?"#000000":pt(a.primary.hex),p={"--primary":m,"--primary-foreground":u,"--ring":m,"--sidebar-primary":m,"--sidebar-primary-foreground":u,"--accent":`color-mix(in oklab, ${r} ${t==="dark"?20:14}%, var(--background))`,"--accent-foreground":"var(--foreground)"};if(o){const c=`color-mix(in oklab, ${s} 82%, black)`;p["--sidebar"]=c,p["--sidebar-foreground"]="#ffffff",p["--sidebar-accent"]=`color-mix(in oklab, ${c} 84%, white)`,p["--sidebar-accent-foreground"]="#ffffff",p["--sidebar-border"]="oklch(1 0 0 / 14%)",p["--sidebar-ring"]=`color-mix(in oklab, ${s} 45%, white)`}return p}function U({to:a,search:t}){const s=fe(),r=`${a}|${JSON.stringify(t??{})}`,o=d.useRef(null);return d.useEffect(()=>{o.current!==r&&(o.current=r,s({to:a,search:t,replace:!0}))},[r]),null}const xt=[{to:"/app",label:"Visão geral",icon:Ja,exact:!0,perm:"dashboard"},{to:"/app/organograma",label:"Organograma",icon:$a,perm:"organograma"},{to:"/app/departamentos",label:"Setores",icon:Ra,perm:"departamentos"},{to:"/app/cargos",label:"Cargos",icon:La,perm:"cargos"},{to:"/app/colaboradores",label:"Colaboradores",icon:Pa,perm:"colaboradores"},{to:"/app/tabela",label:"Tabela salarial",icon:qa,perm:"tabela_salarial"},{to:"/app/impacto",label:"Impacto salarial",icon:Ba,perm:"relatorios"},{to:"/app/politica",label:"PolÃtica de carreira",icon:za,perm:"politica"},{to:"/app/fatores",label:"Fatores & graus",icon:Za,perm:"matriz_pontuacao"},{to:"/app/historico",label:"Histórico",icon:Va,perm:"relatorios"},{to:"/app/ajuda",label:"Central de Ajuda",icon:Ea}],gt={to:"/app/beneficios",label:"BenefÃcios",icon:Fa,perm:"beneficios"},bt={to:"/app/ferias",label:"Férias",icon:Ha,perm:"ferias"},vt={to:"/app/diagnostico",label:"Diagnóstico",icon:qe};function Fs(){const{session:a,loading:t,user:s,signOut:r}=he(),o=Ae(),{theme:m,resolved:u,setTheme:p}=Oe(),c=xe(),j=fe(),{data:S=0}=We(),{can:v}=fa(),y=xa(),E=pa(),R=ua(),k=ha(),_=ba(_a),$=(pe({queryKey:["partner-portal","menu-access"],enabled:!!a,queryFn:()=>_({data:void 0}),staleTime:6e4}).data?.organizations.length??0)>0,D=d.useMemo(()=>{const i=[...xt],x=i.findIndex(q=>q.to==="/app/colaboradores")+1;let n=0;
1E==="disponivel"&&v("beneficios","view")&&(i.splice(x+n,0,gt),n+=1),R==="disponivel"&&v("ferias","view")&&(i.splice(x+n,0,bt),n+=1);const I=v("campanhas","view")||v("resultados","view")||v("plano_acao","view");return k==="disponivel"&&I&&i.splice(x+n,0,vt),i},[E,R,k,v]),{data:N}=pe({queryKey:["me-profile",s?.id],enabled:!!s?.id,staleTime:6e4,queryFn:async()=>{const{data:i}=await Q.from("profiles").select("foto_url").eq("id",s.id).maybeSingle();return i??null}}),z=va(N?.foto_url??null),[T,V]=d.useState(()=>typeof window>"u"?!1:localStorage.getItem("sidebar:collapsed")==="1"),[l,M]=d.useState(!1);d.useEffect(()=>{typeof window>"u"||localStorage.setItem("sidebar:collapsed",T?"1":"0")},[T]),d.useEffect(()=>{y&&M(!1)},[c.pathname,y]),d.useEffect(()=>{if(typeof document>"u"||["/app/onboarding","/app/convite"].includes(c.pathname)||c.pathname.startsWith("/app/parceiro"))return;const n=document.documentElement,I=document.body,q={htmlOverflow:n.style.overflow,bodyOverflow:I.style.overflow,htmlOverscroll:n.style.overscrollBehavior,bodyOverscroll:I.style.overscrollBehavior,htmlHeight:n.style.height,bodyHeight:I.style.height};return n.style.overflow="hidden",I.style.overflow="hidden",n.style.overscrollBehavior="none",I.style.overscrollBehavior="none",n.style.height="100%",I.style.height="100%",()=>{n.style.overflow=q.htmlOverflow,I.style.overflow=q.bodyOverflow,n.style.overscrollBehavior=q.htmlOverscroll,I.style.overscrollBehavior=q.bodyOverscroll,n.style.height=q.htmlHeight,I.style.height=q.bodyHeight}},[c.pathname]);const g=y?!l:T,F=()=>{y?M(i=>!i):V(i=>!i)},L=c.pathname.startsWith("/app/parceiro");if(t||o.loading)return e.jsx("div",{className:"flex min-h-screen items-center justify-center text-muted-foreground",children:"Carregandoâ¦"});if(!a){if(c.pathname==="/app/convite"){const i=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;let x;if(typeof window<"u"){const n=new URLSearchParams(window.location.search).get("token");n&&i.test(n)&&(x=n)}if(!x){const n=c.search?.token;typeof n=="string"&&i.test(n)&&(x=n)}if(!x){const n=me();n&&(x=n)}if(x)return ga(x),typeof window<"u"?(window.location.replace(`/login?invite=${encodeURIComponent(x)}`),e.jsx("div",{className:"flex min-h-screen items-center justify-center text-muted-foreground",children:"Redirecionandoâ¦"})):e.jsx(U,{to:"/login",search:{invite:x,next:void 0}})}return e.jsx(U,{to:"/login",search:{invite:void 0,next:L?"/app/parceiro":void 0}})}const H=["/app/onboarding","/app/convite"].includes(c.pathname)||L;if(!o.orgId&&!H){const i=me();return i?e.jsx(U,{to:"/app/convite",search:{token:i}}):e.jsx(U,{to:"/app/onboarding"})}if(!o.orgId&&c.pathname==="/app/onboarding"&&!c.search?.nova){const i=me();if(i)return e.jsx(U,{to:"/app/convite",search:{token:i}})}if(o.orgId&&c.pathname==="/app/onboarding"&&o.memberships.length>0&&!c.search?.nova)return e.jsx(U,{to:"/app"});if(H)return e.jsx("div",{className:"min-h-screen bg-muted/30",children:e.jsx(de,{})});const W=c.pathname.startsWith("/app/admin/"),f=c.pathname.startsWith("/app/diagnosticos");if((W||f)&&!o.isSuperadmin)return e.jsx(U,{to:f?"/app/diagnostico":"/app"});if(o.isSuperadmin&&(W||f))return e.jsx(mt,{children:e.jsx(de,{})});const b=o.branding.brand_colors,G=ft(b,u==="dark"?"dark":"light"),P={isSuperadmin:o.isSuperadmin,memberships:o.memberships,allOrgs:o.allOrgs},ae=He(P),te=Ge(P),ce=y&&l;return e.jsxs("div",{className:"h-[100dvh] flex bg-muted/30 overflow-hidden overscroll-none",style:G,children:[ce&&e.jsx("div",{className:"fixed inset-0 z-40 bg-background/60 backdrop-blur-sm",onClick:()=>M(!1),"aria-hidden":!0}),e.jsxs("aside",{className:y?`${l?"w-64 fixed inset-y-0 left-0 z-50 shadow-xl":"w-16 sticky top-0"} shrink-0 border-r bg-sidebar text-sidebar-foreground flex flex-col h-[100dvh] transition-[width] duration-200`:`${T?"w-16":"w-64"} shrink-0 border-r bg-sidebar text-sidebar-foreground flex flex-col h-[100dvh] sticky top-0 transition-[width] duration-200`,children:[e.jsx("div",{className:`${g?"p-2 flex items-center justify-center border-b border-sidebar-border":"px-3 py-3 border-b border-sidebar-border flex items-center justify-center"}`,children:e.jsx(X,{to:"/app",onClick:()=>{y&&M(!1)},title:"Jornada.ai","aria-label":"Ir para a visão geral da Jornada.ai",className:`${g?"flex justify-center":"flex w-full items-center justify-center"} focus:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-ring focus-visible:ring-inset`,children:g?e.jsx("img",{src:Ke,alt:"Jornada.ai",className:"h-9 w-9 object-contain mx-auto"}):e.jsx("img",{src:Re,alt:"Jornada.ai",title:"Jornada.ai",className:"w-[196px] max-w-full h-auto object-contain"})})}),e.jsx("div",{"data-guide":"organization-switcher",className:g?"px-2 pt-3":"px-3 pt-3",children:(()=>{const i=o.branding.logo_icon_url||o.branding.favicon_url||o.branding.logo_url||null,x=()=>i?e.jsx("span",{"aria-hidden":"true",className:"h-6 w-8 shrink-0 rounded-sm bg-white p-0.5 flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:i,alt:"",className:"max-h-5 max-w-7 object-contain"})}):e.jsx(Y,{className:"h-4 w-4 shrink-0"}),n=()=>i?e.jsx("span",{"aria-hidden":"true",className:"h-6 w-8 shrink-0 rounded-sm bg-white p-0.5 flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:i,alt:"",className:"max-h-5 max-w-7 object-contain"})}):e.jsx(Y,{className:"h-4 w-4"});return ae?e.jsxs(se,{children:[e.jsx(re,{asChild:!0,children:g?e.jsx(O,{variant:"outline",size:"icon",className:"w-full h-9 border-sidebar-border bg-sidebar-accent text-sidebar-accent-foreground font-medium hover:bg-sidebar-accent/80 hover:text-sidebar-accent-foreground focus-visible:ring-sidebar-ring focus-visible:ring-offset-sidebar",title:o.orgName??"Trocar empresa","aria-label":"Trocar empresa",children:e.jsx(n,{})}):e.jsxs(O,{variant:"outline",size:"sm",className:"w-full justify-start gap-2 border-sidebar-border bg-sidebar-accent text-sidebar-accent-foreground font-medium hover:bg-sidebar-accent/80 hover:text-sidebar-accent-foreground focus-visible:ring-sidebar-ring focus-visible:ring-offset-sidebar",children:[e.jsx(x,{}),e.jsx("span",{className:"truncate flex-1 text-left",children:o.orgName??"Empresa"})]})}),e.jsxs(oe,{align:"start",className:"w-56",children:[o.allOrgs.map(I=>e.jsxs(C,{onClick:()=>o.switchOrg(I.id),children:[e.jsx("span",{className:"flex-1 truncate",children:I.nome}),I.id===o.orgId&&e.jsx(B,{className:"h-4 w-4 ml-2"})]},I.id)),te&&e.jsxs(e.Fragment,{children:[e.jsx(J,{}),e.jsx(C,{onClick:()=>j({to:"/app/onboarding",search:{nova:1}}),children:"+ Nova empresa"})]})]})]}):g?e.jsx("div",{className:"w-full h-9 flex items-center justify-center rounded-md border border-sidebar-border bg-sidebar-accent text-sidebar-accent-foreground",title:o.orgName??"Empresa","aria-label":`Organização ativa: ${o.orgName??"Empresa"}`,children:e.jsx(n,{})}):e.jsxs("div",{className:"w-full flex items-center gap-2 h-9 px-3 rounded-md border border-sidebar-border bg-sidebar-accent text-sidebar-accent-foreground font-medium text-sm","aria-label":"Organização ativa",children:[e.jsx(x,{}),e.jsx("span",{className:"truncate flex-1 text-left",children:o.orgName??"Empresa"})]})})()}),e.jsx("nav",{"data-guide":"main-navigation",className:"sidebar-scroll flex-1 overflow-y-auto p-3 space-y-1",children:D.map(i=>{if(i.perm&&!v(i.perm,"view"))return null;const x=i.exact?c.pathname===i.to:c.pathname.startsWith(i.to),n=i.icon;return e.jsxs(X,{to:i.to,title:g?i.label:void 0,className:`flex items-center ${g?"justify-center":"gap-3"} rounded-md px-3 py-2 text-sm transition-colors ${x?"bg-sidebar-accent text-sidebar-accent-foreground font-medium":"hover:bg-sidebar-accent/50"}`,children:[e.jsx(n,{className:"h-4 w-4 shrink-0"}),!g&&e.jsx("span",{className:"truncate",children:i.label})]},i.to)})}),e.jsx("div",{className:"px-3 pt-3 pb-1",children:e.jsxs("button",{type:"button",onClick:F,title:g?"Expandir menu":"Recolher menu","aria-label":g?"Expandir menu":"Recolher menu",className:`w-full flex items-center ${g?"justify-center":"gap-3"} rounded-md px-3 py-2 text-sm transition-colors hover:bg-sidebar-accent/50 text-sidebar-foreground cursor-pointer`,children:[g?e.jsx(Ya,{className:"h-4 w-4 shrink-0"}):e.jsx(Ka,{className:"h-4 w-4 shrink-0"}),!g&&e.jsx("span",{className:"truncate",children:"Recolher menu"})]})}),e.jsx("div",{className:"px-3 pb-2",children:e.jsx(ct,{collapsed:g})}),e.jsx("div",{className:"p-3 border-t border-sidebar-border space-y-1",children:(()=>
1{const i=(s?.email??"?").split("@")[0].split(/[._-]/).filter(Boolean).slice(0,2).map(n=>n[0]?.toUpperCase()).join("")||"?",x=u==="dark"?ne:le;return e.jsxs(se,{children:[e.jsx(re,{asChild:!0,children:e.jsxs("button",{title:g?s?.email??"Conta":void 0,className:`w-full flex items-center ${g?"justify-center":"gap-2"} rounded-md px-2 py-2 text-sm transition-colors hover:bg-sidebar-accent/50 relative cursor-pointer`,children:[e.jsxs("div",{className:"relative h-7 w-7 shrink-0 rounded-full bg-sidebar-accent text-sidebar-accent-foreground flex items-center justify-center text-xs font-medium overflow-hidden",children:[z?e.jsx("img",{src:z,alt:"Avatar do usuário",className:"h-full w-full object-cover"}):i,S>0&&e.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-destructive"})]}),!g&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"truncate flex-1 text-left text-xs text-sidebar-foreground/70",children:s?.email}),e.jsx(Le,{className:"h-3.5 w-3.5 text-sidebar-foreground/70 shrink-0"})]})]})}),e.jsxs(oe,{align:"end",side:"top",className:"w-56",children:[e.jsx(De,{className:"font-normal text-xs text-muted-foreground truncate",children:s?.email}),e.jsx(J,{}),e.jsxs(C,{onClick:()=>j({to:"/app/convites"}),children:[e.jsx(Ga,{className:"h-4 w-4 mr-2"}),e.jsx("span",{className:"flex-1",children:"Meus convites"}),S>0&&e.jsx(Ue,{variant:"destructive",className:"h-5 px-1.5 text-[10px]",children:S})]}),e.jsxs(C,{onClick:()=>j({to:"/app/perfil"}),children:[e.jsx(at,{className:"h-4 w-4 mr-2"})," Meu perfil"]}),e.jsxs(C,{onClick:()=>j({to:"/app/empresa",search:{tab:"geral"}}),children:[e.jsx(Y,{className:"h-4 w-4 mr-2"})," Minha empresa"]}),($||o.isSuperadmin)&&e.jsx(J,{}),$&&e.jsxs(C,{onClick:()=>j({to:"/app/parceiro"}),children:[e.jsx(Pe,{className:"h-4 w-4 mr-2"})," Ãrea do parceiro"]}),o.isSuperadmin&&e.jsxs(C,{onClick:()=>j({to:"/app/admin/platform"}),children:[e.jsx(ie,{className:"h-4 w-4 mr-2"})," Ir para gestão da plataforma"]}),e.jsx(J,{}),e.jsxs(Te,{children:[e.jsxs(_e,{children:[e.jsx(x,{className:"h-4 w-4 mr-2"}),e.jsxs("span",{children:["Tema: ",m==="system"?"sistema":m==="dark"?"escuro":"claro"]})]}),e.jsxs($e,{children:[e.jsxs(C,{onClick:()=>p("light"),children:[e.jsx(le,{className:"h-4 w-4 mr-2"})," Claro ",m==="light"&&e.jsx(B,{className:"h-3.5 w-3.5 ml-auto"})]}),e.jsxs(C,{onClick:()=>p("dark"),children:[e.jsx(ne,{className:"h-4 w-4 mr-2"})," Escuro ",m==="dark"&&e.jsx(B,{className:"h-3.5 w-3.5 ml-auto"})]}),e.jsxs(C,{onClick:()=>p("system"),children:[e.jsx(Be,{className:"h-4 w-4 mr-2"})," Sistema ",m==="system"&&e.jsx(B,{className:"h-3.5 w-3.5 ml-auto"})]})]})]}),e.jsx(J,{}),e.jsxs(C,{onClick:async()=>{await r(),j({to:"/login",search:{invite:void 0,next:void 0}})},className:"text-destructive focus:text-destructive",children:[e.jsx(ze,{className:"h-4 w-4 mr-2"})," Sair"]})]})]})})()})]}),e.jsxs("main",{"data-guide":"app-main",className:"flex-1 min-w-0 overflow-y-auto overflow-x-hidden h-[100dvh] overscroll-contain",children:[e.jsx("div",{"data-guide":"project-flow",children:e.jsx(rt,{})}),e.jsx("div",{"data-guide":"page-content",className:"max-w-7xl mx-auto p-4 sm:p-6 lg:p-8",children:e.jsx(de,{})})]})]})}export{Fs as component};
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.