1import{c as se,aE as ta,r as o,aF as Ns,j as e,aG as Je,aH as hs,aI as La,aJ as qa,aK as $a,aL as Oa,f as be,a3 as F,R as w,aq as Ge,aM as Re,U as xe,aN as He,V as he,W as pe,Y as fe,Z as ge,_ as je,$ as ve,a0 as ps,s as d,N as i,ah as Ba,a2 as Ua,u as Va,a4 as Ga,d as Ha,ag as Qa,A as Wa,X as fs,q as H,T as Fs,J as $e,H as Xa,ai as zs,aj as Za,aO as Ls,D as Ja,t as Ka,v as Ya,x as et,ao as qs,aP as Q,h as cs,aQ as st,aR as at,aS as tt,I as rt,B as ot}from"./index-BWsDOjhF.js";import{i as $s}from"./useSimuladoHistory-CwI8G5B7.js";import{C as Qe,a as gs,b as js,c as We}from"./card-D5ucyWKc.js";import{I as B}from"./input-IZFF6cM3.js";import{L as U}from"./label-7QM399kR.js";import{B as ra}from"./badge-CNkDEOkM.js";import{C as ds}from"./checkbox-B3gR88XK.js";import{S as nt}from"./slider-ewSO0p5p.js";import{S as it,a as lt,b as ct,c as dt,d as ke}from"./select-Bh8VrN_H.js";import{T as Os,a as Bs,b as J,c as K,P as mt}from"./tabs-C1vpsVrV.js";import{c as oa,R as ut,I as xt,C as ht}from"./index-fux58Hsi.js";import{u as pt}from"./index-CA1VKcSd.js";import{D as ft,a as gt,b as jt,c as Us,T as Vs}from"./dropdown-menu-z3uofJlj.js";import{K as Gs,I as vt,a as bt,b as de}from"./input-otp-B1CV8RP4.js";import{C as Hs}from"./copy-VJ8sPOq1.js";import{D as vs}from"./download-CSxJbKZP.js";import{T as Xe}from"./trash-2-CoETt2tH.js";import{P as Qs}from"./pencil-CZljw-v8.js";import{S as Ws}from"./save-BnBlVoVS.js";import{U as Nt}from"./user-5ePTdLej.js";import{M as Oe}from"./mail-CjvIM4_z.js";import{P as yt}from"./phone-DubgcFtG.js";import{C as wt}from"./calendar-B460ivwy.js";import{C as Be}from"./credit-card-DnRq-Ck3.js";import{E as ms}from"./eye-off-DvAlnGou.js";import{E as Ue}from"./eye-DaYAKQzo.js";import{G as us}from"./graduation-cap-CLj00zeP.js";import{C as Xs}from"./crown-BIEoBUU1.js";import{R as me}from"./refresh-cw-CfEL4FvD.js";import{T as Ct}from"./type-0RthZL2u.js";import{S as St}from"./search-BZC8gOvv.js";import{R as kt}from"./rotate-ccw-Dnf65NrX.js";import"./chevron-down-D-37YthP.js";import"./chevron-up-CpOaP2tb.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Zs=se("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Rt=se("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const _t=se("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]);/** 17 * @license lucide-react v0.462.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const Js=se("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/** 22 * @license lucide-react v0.462.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */const At=se("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/** 27 * @license lucide-react v0.462.0 - ISC 28 * 29 * This source code is licensed under the ISC license. 30 * See the LICENSE file in the root directory of this source tree. 31 */const Et=se("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/** 32 * @license lucide-react v0.462.0 - ISC 33 * 34 * This source code is licensed under the ISC license. 35 * See the LICENSE file in the root directory of this source tree. 36 */const Dt=se("School",[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2ml
vendor: 4,674 bytes, lines 36-41
36k"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]]);/** 37 * @license lucide-react v0.462.0 - ISC 38 * 39 * This source code is licensed under the ISC license. 40 * See the LICENSE file in the root directory of this source tree. 41 */const Pt=se("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);var ys="Radio",[It,na]=ta(ys),[Tt,Mt]=It(ys),ia=o.forwardRef((l,a)=>{const{__scopeRadio:n,name:m,checked:x=!1,required:p,disabled:N,value:R="on",onCheck:A,form:k,...E}=l,[D,M]=o.useState(null),y=Ns(a,f=>M(f)),u=o.useRef(!1),t=D?k||!!D.closest("form"):!0;return e.jsxs(Tt,{scope:n,checked:x,disabled:N,children:[e.jsx(Je.button,{type:"button",role:"radio","aria-checked":x,"data-state":ma(x),"data-disabled":N?"":void 0,disabled:N,value:R,...E,ref:y,onClick:hs(l.onClick,f=>{x||A==null||A(),t&&(u.current=f.isPropagationStopped(),u.current||f.stopPropagation())})}),t&&e.jsx(da,{control:D,bubbles:!u.current,name:m,value:R,checked:x,required:p,disabled:N,form:k,style:{transform:"translateX(-100%)"}})]})});ia.displayName=ys;var la="RadioIndicator",ca=o.forwardRef((l,a)=>{const{__scopeRadio:n,forceMount:m,...x}=l,p=Mt(la,n);return e.jsx(La,{present:m||p.checked,children:e.jsx(Je.span,{"data-state":ma(p.checked),"data-disabled":p.disabled?"":void 0,...x,ref:a})})});ca.displayName=la;var Ft="RadioBubbleInput",da=o.forwardRef(({__scopeRadio:l,control:a,checked:n,bubbles:m=!0,...x},p)=>{const N=o.useRef(null),R=Ns(N,p),A=qa(n),k=$a(a);return o.useEffect(()=>{const E=N.current;if(!E)return;const D=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(D,"checked").set;if(A!==n&&y){const u=new Event("click",{bubbles:m});y.call(E,n),E.dispatchEvent(u)}},[A,n,m]),e.jsx(Je.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...x,tabIndex:-1,ref:R,style:{...x.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});da.displayName=Ft;function ma(l){return l?"checked":"unchecked"}var zt=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Ke="RadioGroup",[Lt,Mr]=ta(Ke,[oa,na]),ua=oa(),xa=na(),[qt,$t]=Lt(Ke),ha=o.forwardRef((l,a)=>{const{__scopeRadioGroup:n,name:m,defaultValue:x,value:p,required:N=!1,disabled:R=!1,orientation:A,dir:k,loop:E=!0,onValueChange:D,...M}=l,y=ua(n),u=pt(k),[t,f]=Oa({prop:p,defaultProp:x??null,onChange:D,caller:Ke});return e.jsx(qt,{scope:n,name:m,required:N,disabled:R,value:t,onValueChange:f,children:e.jsx(ut,{asChild:!0,...y,orientation:A,dir:u,loop:E,children:e.jsx(Je.div,{role:"radiogroup","aria-required":N,"aria-orientation":A,"data-disabled":R?"":void 0,dir:u,...M,ref:a})})})});ha.displayName=Ke;var pa="RadioGroupItem",fa=o.forwardRef((l,a)=>{const{__scopeRadioGroup:n,disabled:m,...x}=l,p=$t(pa,n),N=p.disabled||m,R=ua(n),A=xa(n),k=o.useRef(null),E=Ns(a,k),D=p.value===x.value,M=o.useRef(!1);return o.useEffect(()=>{const y=t=>{zt.includes(t.key)&&(M.current=!0)},u=()=>M.current=!1;return document.addEventListener("keydown",y),document.addEventListener("keyup",u),()=>{document.removeEventListener("keydown",y),document.removeEventListener("keyup",u)}},[]),e.jsx(xt,{asChild:!0,...R,focusable:!N,active:D,children:e.jsx(ia,{disabled:N,required:p.required,checked:D,...A,...x,name:p.name,ref:E,onCheck:()=>p.onValueChange(x.value),onKeyDown:hs(y=>{y.key==="Enter"&&y.preventDefault()}),onFocus:hs(x.onFocus,()=>{var y;M.current&&((y=k.current)==null||y.click())})})})});fa.displayName=pa;var Ot="RadioGroupIndicator",ga=o.forwardRef((l,a)=>{const{__scopeRadioGroup:n,...m}=l,x=xa(n);return e.jsx(ca,{...x,...m,ref:a})});ga.displayName=Ot;var ja=ha,va=fa,Bt=ga;const Ze=o.forwardRef(({className:l,...a},n)=>e.jsx(ja,{className:be("grid gap-2",l),...a,ref:n}));Ze.displayName=ja.displayName;const ee=o.forwardRef(({className:l,...a},n)=>e.jsx(va,{ref:n,className:be("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",l),...a,children:e.jsx(Bt,{className:"flex items-center justify-center",children:e.jsx(ht,{className:"h-2.5 w-2.5 fill-current text-current"})})}));ee.displayName=va.displayName;function Ks(l=8){const a=[];for(let n=0;n<l;n++){const m=new Uint8Array(5);crypto.getRandomValues(m);const x=Array.from(m).map(p=>p.toString(16).padStart(2,"0")).join("");a.push(`${x.slice(0,5)}-${x.slice(5,10)}`)}return a}
41async function Ut(l){const a=new TextEncoder().encode(l),n=await crypto.subtle.digest("SHA-256",a);return Array.from(new Uint8Array(n)).map(m=>m.toString(16).padStart(2,"0")).join("")}function Vt(){const[l,a]=o.useState([]),[n,m]=o.useState(!0),[x,p]=o.useState(!1),[N,R]=o.useState(""),[A,k]=o.useState(""),[E,D]=o.useState(""),[M,y]=o.useState(""),[u,t]=o.useState(!1),[f,z]=o.useState(!1),[P,W]=o.useState(!1),[L,ae]=o.useState([]),[re,te]=o.useState(!1),[X,Y]=o.useState(!1),[Ne,oe]=o.useState(!1),[ye,we]=o.useState(!1),[ne,ie]=o.useState(!1),V=async()=>{m(!0);const{data:_,error:I}=await d.auth.mfa.listFactors();!I&&_&&a(_.totp.filter(Z=>Z.status==="verified"));const{count:O}=await d.from("mfa_recovery_codes").select("id",{count:"exact",head:!0}).is("used_at",null);we((O??0)>0),m(!1)};o.useEffect(()=>{V()},[]);const _e=async()=>{p(!0);const{data:_,error:I}=await d.auth.mfa.enroll({factorType:"totp",friendlyName:"Autenticador TOTP"});if(I){i.error("Erro ao iniciar configuração: "+I.message),p(!1);return}R(_.totp.qr_code),k(_.totp.secret),D(_.id),p(!1)},Ae=async _=>{await d.from("mfa_recovery_codes").delete().neq("id","00000000-0000-0000-0000-000000000000");const I=await Promise.all(_.map(async O=>({user_id:(await d.auth.getUser()).data.user.id,code_hash:await Ut(O.replace("-",""))})));await d.from("mfa_recovery_codes").insert(I)},Ee=async()=>{if(M.length!==6)return;t(!0);const{error:_}=await d.auth.mfa.challengeAndVerify({factorId:E,code:M});if(_){i.error("Código inválido. Tente novamente."),t(!1);return}const I=Ks(8);await Ae(I),ae(I),te(!0),t(!1)},Ye=async()=>{ie(!0);const _=Ks(8);await Ae(_),ae(_),te(!0),Y(!1),ie(!1),i.success("Novos códigos de recuperação gerados!")},De=()=>{Y(!0),te(!1),ae([]),R(""),k(""),D(""),y(""),i.success("Autenticação em duas etapas ativada com sucesso!"),V()},es=async _=>{z(!0);const{error:I}=await d.auth.mfa.unenroll({factorId:_});I?i.error("Erro ao desativar: "+I.message):(await d.from("mfa_recovery_codes").delete().neq("id","00000000-0000-0000-0000-000000000000"),i.success("Autenticação em duas etapas desativada.")),z(!1),V()},Pe=()=>{navigator.clipboard.writeText(A),W(!0),setTimeout(()=>W(!1),2e3)},le=()=>{const _=L.join(` 42`);navigator.clipboard.writeText(_),oe(!0),setTimeout(()=>oe(!1),2e3),i.success("Códigos copiados!")},Ie=()=>{const _=`Códigos de Recuperação MFA - Fique Tranquilo ENEM 43Gerados em: ${new Date().toLocaleString("pt-BR")} 44 45${L.map((Te,Me)=>`${Me+1}. ${Te}`).join(` 46`)} 47 48IMPORTANTE: Cada código só pode ser usado uma vez. 49Guarde estes códigos em um local seguro.`,I=new Blob([_],{type:"text/plain"}),O=URL.createObjectURL(I),Z=document.createElement("a");Z.href=O,Z.download="codigos-recuperacao-mfa.txt",Z.click(),URL.revokeObjectURL(O)};return n?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(F,{className:"w-4 h-4 animate-spin"})," Carregando..."]}):re&&L.length>0?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-amber-600 dark:text-amber-400",children:[e.jsx(Gs,{className:"w-4 h-4"}),"Códigos de Recuperação"]}),e.jsxs("div",{className:"rounded-lg border border-amber-300 dark:border-amber-700 bg-amber-50 dark:bg-amber-950/30 p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-amber-800 dark:text-amber-300 font-medium",children:"â ï¸ Salve estes códigos agora! Eles não serão exibidos novamente. Use-os para acessar sua conta caso perca o acesso ao aplicativo autenticador."}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:L.map((_,I)=>e.jsx("div",{className:"font-mono text-sm bg-background border border-border rounded px-3 py-1.5 text-center select-all",children:_},I))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Cada código só pode ser usado uma única vez."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 justify-center",children:[e.jsxs(w,{variant:"outline",size:"sm",className:"gap-1.5",onClick:le,children:[Ne?e.jsx(Ge,{className:"w-3.5 h-3.5 text-green-500"}):e.jsx(Hs,{className:"w-3.5 h-3.5"}),"Copiar"]}),e.jsxs(w,{variant:"outline",size:"sm",className:"gap-1.5",onClick:Ie,children:[e.jsx(vs,{className:"w-3.5 h-3.5"}),"Baixar .txt"]})]}),e.jsxs(w,{className:"w-full gap-1.5",size:"sm",onClick:De,children:[e.jsx(Ge,{className:"w-4 h-4"}),"Já salvei meus códigos"]})]}):l.length>0&&!N?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400 font-medium",children:[e.jsx(Re,{className:"w-4 h-4"}),"Autenticação em duas etapas ativada"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Seu aplicativo autenticador (Google Authenticator, Authy, etc.) está configurado."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(w,{variant:"outline",size:"sm",className:"gap-1.5",onClick:Ye,disabled:ne,children:[ne?e.jsx(F,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Gs,{className:"w-3.5 h-3.5"}),ye?"Regenerar códigos de recuperação":"Gerar códigos de recuperação"]}),e.jsxs(xe,{children:[e.jsx(He,{asChild:!0,children:e.jsxs(w,{variant:"outline",size:"sm",className:"gap-1.5 text-destructive border-destructive/30 hover:bg-destructive/10",children:[e.jsx(Xe,{className:"w-3.5 h-3.5"})," Desativar 2FA"]})}),e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsx(fe,{children:"Desativar autenticação em duas etapas?"}),e.jsx(ge,{children:"Sua conta ficará protegida apenas por senha. Os códigos de recuperação também serão removidos. Você pode reativar a qualquer momento."})]}),e.jsxs(je,{children:[e.jsx(ve,{children:"Cancelar"}),e.jsxs(ps,{onClick:()=>es(l[0].id),disabled:f,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[f?e.jsx(F,{className:"w-4 h-4 animate-spin mr-2"}):null,"Desativar"]})]})]})]})]})]}):N?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Escaneie o QR code abaixo com seu aplicativo autenticador (Google Authenticator, Authy, Microsoft Authenticator):"}),e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:N,alt:"QR Code TOTP",className:"w-48 h-48 rounded-lg border border-border"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Ou insira manualmente a chave:"}),e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("code",{className:"text-xs bg-muted px-2 py-1 rounded font-mono select-all break-all max-w-[200px]",children:A}),e.jsx(w,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:Pe,children:P?e.jsx(Ge,{className:"w-3.5 h-3.5 text-green-500"}):e.jsx(Hs,{className:"w-3.5 h-3.5"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(U,{className:"text-xs text-muted-foreground",children:"Digite o código de 6 dÃgitos do app:"}),e.jsx("div",{className:"flex justify-center",children:e.jsx(vt,{maxLength:6,value:M,onChange:y,children:e.jsxs(bt,{children:[e.jsx(de,{index:0}),e.jsx(de,{index:1}),e.jsx(de,{index:2}),e.jsx(de,{index:3}),e.jsx(de,{index:4}),e.jsx(de,{index:5})]})})})]}),e.jsxs("div",{className:"flex gap-2 justify-center",children:[e.jsx(w,{variant:"outline",size:"sm",onClick:()=>{R(""),k(""),D(""),y("")},children:"Cancelar"}),e.jsxs(w,{size:"sm",onClick:Ee,disabled:M.length!==6||u,className:"gap-1.5",children:[u?e.jsx(F,{className:"w-4 h-4 animate-spin"}):e.jsx(Re,{className:"w-4 h-4"}),"Ativar"]})]})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Proteja sua conta com um código de verificação gerado pelo seu celular, além da senha."}),e.jsxs(w,{variant:"outline",size:"sm",onClick:_e,disabled:x,className:"gap-1.5",children:[x?e.jsx(F,{className:"w-4 h-4 animate-spin"}):e.jsx(Re,{className:"w-4 h-4"}),"Configurar autenticação em duas etapas"]})]})}const Gt={monthly:"Plano Mensal",annual:"Plano Anual",free:"Gratuito"},Ht={CREDIT_CARD:"Cartão de crédito",PIX:"PIX",UNDEFINED:"â"},Qt={CONFIRMED:{label:"Pago",cls:"bg-emerald-500/15 text-emerald-700 dark:text-emerald-400"},RECEIVED:{label:"Pago",cls:"bg-emerald-500/15 text-emerald-700 dark:text-emerald-400"},PENDING:{label:"Aguardando",cls:"bg-amber-500/15 text-amber-700 dark:text-amber-400"},OVERDUE:{label:"Vencido",cls:"bg-destructive/15 text-destructive"},REFUNDED:{label:"Reembolsado",cls:"bg-muted text-muted-foreground"},REFUND_PENDING:{label:"Reembolso em processamento",cls:"bg-amber-500/15 text-amber-700 dark:text-amber-400"}};function Wt({userId:l,embedded:a=!1}
49){const[n,m]=o.useState(!0),[x,p]=o.useState([]),[N,R]=o.useState(null),[A,k]=o.useState(null),{isAdmin:E}=Ba();o.useEffect(()=>{let u=!1;return(async()=>{const t=d.from("payments").select("id, plan, amount, status, billing_type, paid_at, created_at, invoice_url, bank_slip_url, nfe_url, asaas_payment_id, nfse_id").order("created_at",{ascending:!1}).limit(50),{data:f,error:z}=l?await t.eq("user_id",l):await t;u||(z?(console.error(z),i.error("Não foi possÃvel carregar histórico de pagamentos.")):p(f??[]),m(!1))})(),()=>{u=!0}},[l]);async function D(u,t){var z;const f=`${u}:${t}`;R(f);try{const{data:P,error:W}=await d.functions.invoke("get-receipt-url",{body:{payment_id:u,document_type:t}});if(W)throw W;if(!(P!=null&&P.url))throw new Error("URL indisponÃvel");window.open(P.url,"_blank","noopener,noreferrer")}catch(P){const W=(z=P==null?void 0:P.message)!=null&&z.includes("not available")?"Documento ainda não disponÃvel. Tente novamente em alguns minutos.":"Não foi possÃvel obter o documento. Tente novamente.";i.error(W)}finally{R(null)}}async function M(u){if(!u.asaas_payment_id){i.error("Pagamento sem ID Asaas.");return}k(u.id);try{const{data:t,error:f}=await d.functions.invoke("asaas-emit-nfse",{body:{asaas_payment_id:u.asaas_payment_id}});if(f)throw f;i.success(`NF emitida${t!=null&&t.nfse_id?` (${t.nfse_id})`:""}.`),p(z=>z.map(P=>P.id===u.id?{...P,nfse_id:(t==null?void 0:t.nfse_id)??P.nfse_id}:P))}catch(t){console.error(t),i.error((t==null?void 0:t.message)||"Falha ao emitir NF.")}finally{k(null)}}const y=e.jsx(e.Fragment,{children:n?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(F,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):x.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"Nenhum pagamento registrado ainda."}):e.jsx("div",{className:"space-y-2",children:x.map(u=>{const t=Qt[u.status]??{label:u.status,cls:"bg-muted text-muted-foreground"},f=u.status==="CONFIRMED"||u.status==="RECEIVED",z=u.paid_at??u.created_at?new Date(u.paid_at??u.created_at).toLocaleDateString("pt-BR"):"â";return e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 p-3 rounded-lg border border-border bg-muted/30",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:Gt[u.plan]??u.plan}),e.jsx(ra,{className:t.cls+" border-0 text-[10px]",children:t.label})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[z," · ",Ht[u.billing_type]??u.billing_type," ·"," ",Number(u.amount).toLocaleString("pt-BR",{style:"currency",currency:"BRL"})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[f&&e.jsx(xs,{icon:vs,label:"Recibo",loading:N===`${u.id}:receipt`,onClick:()=>D(u.id,"receipt")}),u.nfe_url&&e.jsx(xs,{icon:vs,label:"NF",loading:N===`${u.id}:nfe`,onClick:()=>D(u.id,"nfe")}),E&&f&&!u.nfse_id&&u.asaas_payment_id&&e.jsx(xs,{icon:Ua,label:"Emitir NF",loading:A===u.id,onClick:()=>M(u)})]})]},u.id)})})});return a?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Acesse recibos e notas fiscais dos seus pagamentos. Cada acesso é registrado para fins de auditoria (LGPD)."}),y]}):e.jsxs(Qe,{children:[e.jsxs(gs,{className:"pb-4",children:[e.jsxs(js,{className:"text-base flex items-center gap-2",children:[e.jsx(Et,{className:"w-4 h-4 text-primary"})," Histórico de Pagamentos"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Acesse recibos e notas fiscais dos seus pagamentos. Cada acesso é registrado para fins de auditoria (LGPD)."})]}),e.jsx(We,{children:y})]})}function xs({icon:l,label:a,loading:n,onClick:m}){return e.jsxs(w,{variant:"outline",size:"sm",onClick:m,disabled:n,className:"h-8 text-xs gap-1.5",children:[n?e.jsx(F,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(l,{className:"w-3.5 h-3.5"}),a]})}const bs=[{label:"MÃnimo 8 caracteres",test:l=>l.length>=8},{label:"Letra maiúscula",test:l=>/[A-Z]/.test(l)},{label:"Letra minúscula",test:l=>/[a-z]/.test(l)},{label:"Número",test:l=>/\d/.test(l)},{label:"Caractere especial (!@#$...)",test:l=>/[^A-Za-z0-9]/.test(l)}
49],Ys={simulado:"/simulado",flashcards:"/flashcards",cadernos:"/cadernos",anotacoes:"/anotacoes",tags:"/tags",cronograma:"/cronograma",pomodoro:"/pomodoro",metas:"/metas",desempenho:"/desempenho",tutor:"/tutor",estatisticas_enem:"/estatisticas-enem"};function Xt(l){const a=l.replace(/\D/g,"").slice(0,8);return a.length<=2?a:a.length<=4?`${a.slice(0,2)}/${a.slice(2)}`:`${a.slice(0,2)}/${a.slice(2,4)}/${a.slice(4)}`}function ea(l){if(!l)return!0;const a=l.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);if(!a)return!1;const n=parseInt(a[1],10),m=parseInt(a[2],10),x=parseInt(a[3],10);if(m<1||m>12)return!1;const p=new Date(x,m-1,n);return!(p.getFullYear()!==x||p.getMonth()!==m-1||p.getDate()!==n||p>new Date||x<1900)}function Zt(l){const a=l.replace(/\D/g,"").slice(0,11);return a.length<=2?a.length?`(${a}`:"":a.length<=6?`(${a.slice(0,2)}) ${a.slice(2)}`:a.length<=10?`(${a.slice(0,2)}) ${a.slice(2,6)}-${a.slice(6)}`:`(${a.slice(0,2)}) ${a.slice(2,7)}-${a.slice(7)}`}function sa(l){if(!l)return!0;const a=l.replace(/\D/g,"");return a.length===10||a.length===11}function Jt(l){const a=l.replace(/\D/g,"").slice(0,11);return a.length<=3?a:a.length<=6?`${a.slice(0,3)}.${a.slice(3)}`:a.length<=9?`${a.slice(0,3)}.${a.slice(3,6)}.${a.slice(6)}`:`${a.slice(0,3)}.${a.slice(3,6)}.${a.slice(6,9)}-${a.slice(9)}`}function aa(l){if(!l)return!0;const a=l.replace(/\D/g,"");if(a.length!==11||/^(\d)\1{10}$/.test(a))return!1;let n=0;for(let x=0;x<9;x++)n+=parseInt(a[x])*(10-x);let m=n*10%11;if(m===10&&(m=0),m!==parseInt(a[9]))return!1;n=0;for(let x=0;x<10;x++)n+=parseInt(a[x])*(11-x);return m=n*10%11,m===10&&(m=0),m===parseInt(a[10])}function Kt({password:l}){const a=bs.filter(x=>x.test(l)).length,n=a<=1?"Fraca":a<=3?"Média":a===5?"Forte":"Boa",m=a<=1?"bg-destructive":a<=3?"bg-yellow-500":"bg-green-500";return l?e.jsxs("div",{className:"space-y-2 mt-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all ${m}`,style:{width:`${a/5*100}%`}})}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n})]}),e.jsx("ul",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-3 gap-y-0.5",children:bs.map(x=>{const p=x.test(l);return e.jsxs("li",{className:`flex items-center gap-1 text-[11px] ${p?"text-green-600 dark:text-green-400":"text-muted-foreground"}`,children:[p?e.jsx(Ge,{className:"w-3 h-3 shrink-0"}):e.jsx(fs,{className:"w-3 h-3 shrink-0"}),e.jsx("span",{children:x.label})]},x.label)})})]}):null}const Ve=["Matemática","FÃsica","QuÃmica","Biologia","Português","História","Geografia","Filosofia","Sociologia","Inglês","Espanhol","Literatura","Artes","Educação FÃsica"];function Fr(){const l=Va(),[a]=Ga(),{profile:n,updateProfile:m,resetProfile:x}=Ha(),{active:p,planType:N,expiresAt:R,startedAt:A,hasAsaasSub:k,autoRenewCancelAt:E,loading:D}=Qa(),{isFreeTier:M}=Wa();o.useEffect(()=>{a.get("setup_mfa")==="1"&&i.warning("Configuração obrigatória: ative a autenticação em duas etapas (TOTP) para acessar o painel administrativo.",{duration:8e3})},[a]);const[y,u]=o.useState(!1),[t,f]=o.useState(n),z=o.useRef(null),[P,W]=o.useState(!1),[L,ae]=o.useState(""),[re,te]=o.useState(""),[X,Y]=o.useState([]),[Ne,oe]=o.useState(""),[ye,we]=o.useState(""),[ne,ie]=o.useState(""),[V,_e]=o.useState(!1),[Ae,Ee]=o.useState(!1),[Ye,De]=o.useState(!1),[es,Pe]=o.useState(!1),[le,Ie]=o.useState(!1),[_,I]=o.useState(!1),[O,Z]=o.useState(""),[Te,Me]=o.useState(!1),[ws,Cs]=o.useState([]),[ba,Ss]=o.useState(!1),[ce,ss]=o.useState(new Set),[Na,ya]=o.useState(!1),[wa,as]=o.useState(!1),[Ce,ks]=o.useState(!1),[Fe,ts]=o.useState(""),[Rs,_s]=o.useState(!1),[As,Ca]=o.useState(null),[Sa,Es]=o.useState(!1),[Ds,Ps]=o.useState(!1),[Yt,ka]=o.useState(null),[Ra,_a]=o.useState(null),[rs,Aa]=o.useState(7);o.useEffect(()=>{let s=!1;async function r(){const{data:{user:c}}=await d.auth.getUser();if(!c||s)return;const{data:j}=await d.from("payments").select("billing_type, status, paid_at").eq("user_id",c.id).in("status",["CONFIRMED","RECEIVED","PENDING","REFUNDED"]).order("created_at",{ascending:!1}).limit(1).maybeSingle();!s&&j&&(Ca(j.billing_type||null),j.paid_at&&ka(j.paid_at));const{data:v}=await d.from("payments").select("paid_at").eq("user_id",c.id).in("status",["CONFIRMED","RECEIVED","REFUNDED"]).not("paid_at","is",null).order("paid_at",{ascending:!0}).limit(1).maybeSingle();!s&&(v!=null&&v.paid_at)&&_a(v.paid_at)}async function g(){const{data:c}=await d.from("platform_settings").select("value").eq("key","refund_days").maybeSingle();if(!s&&(c!=null&&c.value)){const j=parseInt(String(c.value));!Number.isNaN(j)&&j>0&&Aa(j)}}return r(),g(),()=>{s=!0}},[N]);
49const[Ea,os]=o.useState(!1),[ze,ns]=o.useState(""),[Le,Is]=o.useState(!1),is=o.useCallback(async s=>{if(!s.trim())return i.error("Digite sua senha para continuar."),!1;_e(!0);try{const{data:{user:r}}=await d.auth.getUser();if(!(r!=null&&r.email))return i.error("Erro ao verificar usuário."),!1;const{error:g}=await d.auth.signInWithPassword({email:r.email,password:s});return g?(i.error("Senha incorreta. Tente novamente."),!1):!0}catch{return i.error("Erro ao verificar senha."),!1}finally{_e(!1)}},[]),Ts=async()=>{var r,g;if(t.birthDate&&!ea(t.birthDate)){i.error("Data de nascimento inválida. Use o formato DD/MM/AAAA.");return}if(t.phone&&!sa(t.phone)){i.error("Telefone inválido. Use o formato (11) 99999-9999.");return}if(t.cpf&&!aa(t.cpf)){i.error("CPF inválido. Use o formato 000.000.000-00.");return}if(L){if(!bs.every(c=>c.test(L))){i.error("A nova senha não atende a todos os requisitos.");return}if(L!==re){i.error("A nova senha e a confirmação não coincidem.");return}}m(t);let s=null;try{const{data:{session:c}}=await d.auth.getSession();if(s=c,c!=null&&c.user){const{error:j}=await d.from("profiles").update({full_name:t.name,address_street:t.addressStreet,address_number:t.addressNumber,address_complement:t.addressComplement,address_neighborhood:t.addressNeighborhood,address_city:t.addressCity,address_state:t.addressState,address_zip:t.addressZip}).eq("user_id",c.user.id);j&&console.error("Failed to persist profile to DB:",j);{const{error:v}=await d.rpc("set_my_phone",{p_phone:t.phone||""});v&&(console.error("Failed to persist phone:",v),i.error("Erro ao salvar telefone: "+v.message))}if(t.cpf&&t.cpf.replace(/\D/g,"").length===11){const{error:v}=await d.rpc("set_my_cpf",{p_cpf:t.cpf});v&&(console.error("Failed to persist CPF:",v),v.code==="23505"||(r=v.message)!=null&&r.includes("já cadastrado")?i.error("Este CPF já está cadastrado em outra conta."):i.error("Erro ao salvar CPF: "+v.message))}}}catch(c){console.error("Failed to persist profile to DB:",c)}if(t.email&&t.email!==((g=s==null?void 0:s.user)==null?void 0:g.email))try{const{error:c}=await d.auth.updateUser({email:t.email});c?i.error("Erro ao atualizar e-mail: "+c.message):i.info("Um e-mail de confirmação foi enviado para o novo endereço.")}catch{}if(L)try{const{data:c,error:j}=await d.auth.refreshSession(),v=c.session||s;if(j||!(v!=null&&v.access_token)){i.error("Sua sessão expirou. Faça login novamente para alterar a senha.");return}const{data:C,error:T}=await d.functions.invoke("change-password",{body:{newPassword:L},headers:{Authorization:`Bearer ${v.access_token}`}});let $;if(T&&T.context instanceof Response)try{const h=await T.context.clone().json();$=h==null?void 0:h.error}catch{}if(T||C&&C.error){const h=$||(C==null?void 0:C.error)||(T==null?void 0:T.message)||"Erro ao atualizar senha.";i.error(h),((C==null?void 0:C.code)==="invalid_session"||(C==null?void 0:C.code)==="missing_session")&&(await d.auth.signOut(),l("/auth"));return}i.success("Senha atualizada com sucesso!")}catch(c){i.error("Erro ao atualizar senha: "+((c==null?void 0:c.message)||"desconhecido"));return}u(!1),ae(""),te(""),i.success("Perfil atualizado com sucesso!")},Ms=()=>{f(n),u(!1),ae(""),te("")},Da=s=>{m({resolutionCounting:s}),f(r=>({...r,resolutionCounting:s})),i.success(s==="last"?"Contabilizando apenas a última resolução":"Contabilizando todas as resoluções")},Pa=async()=>{if(X.length===0){i.error("Selecione pelo menos uma matéria!");return}if(await is(Ne))try{const r=localStorage.getItem("simulado_history");if(r){const j=JSON.parse(r).map(v=>{const C=v.questions.filter($=>!X.includes($.subject)),T=C.filter($=>$.isCorrect).length;return{...v,questions:C,totalQuestions:C.length,correct:T,wrong:C.length-T,percentage:C.length>0?Math.round(T/C.length*100):0}}).filter(v=>v.totalQuestions>0);localStorage.setItem("simulado_history",JSON.stringify(j))}const{data:{user:g}}=await d.auth.getUser();g&&await d.from("user_question_answers").delete().eq("user_id",g.id).in("subject",X),i.success(`Histórico de ${X.join(", ")} apagado com sucesso!`),Y([]),oe(""),De(!1)}catch{i.error("Erro ao apagar dados.")}},Ia=async()=>
49{if(!await is(ye))return;const{data:{user:r}}=await d.auth.getUser();if(r){const{error:g}=await d.from("user_simulado_history").delete().eq("user_id",r.id),{error:c}=await d.from("user_question_answers").delete().eq("user_id",r.id),{error:j}=await d.from("user_study_sessions").delete().eq("user_id",r.id);if(g||c||j){console.error("Failed to clear performance:",g||c||j),i.error("Erro ao limpar desempenho. Tente novamente.");return}}$s(),we(""),Ee(!1),i.success("Desempenho limpo!")},Ta=async()=>{var g;if(!await is(ne))return;localStorage.removeItem("favorites"),localStorage.removeItem("notebooks"),localStorage.removeItem("notes"),localStorage.removeItem("flashcards"),localStorage.removeItem("metas"),localStorage.removeItem("schedule"),localStorage.removeItem("simulado_history"),localStorage.removeItem("ft-unlocked-achievements");const{data:{user:r}}=await d.auth.getUser();if(r){const c=r.id;await d.from("user_question_answers").delete().eq("user_id",c),await d.from("user_simulado_history").delete().eq("user_id",c),$s(),await d.from("user_favorites").delete().eq("user_id",c);const j=((g=(await d.from("user_notebooks").select("id").eq("user_id",c)).data)==null?void 0:g.map(v=>v.id))||[];j.length>0&&await d.from("user_notebook_questions").delete().in("notebook_id",j),await d.from("user_notebooks").delete().eq("user_id",c),await d.from("user_notes").delete().eq("user_id",c),await d.from("user_flashcards").delete().eq("user_id",c),await d.from("user_pomodoro_sessions").delete().eq("user_id",c),await d.from("user_schedule_events").delete().eq("user_id",c),await d.from("user_meta_targets").delete().eq("user_id",c),await d.from("question_comments").delete().eq("user_id",c)}x(),ie(""),Pe(!1),i.success("Todos os dados foram redefinidos! Recarregando..."),setTimeout(()=>window.location.reload(),1e3)},Ma=()=>{X.length===Ve.length?Y([]):Y([...Ve])},Fa=s=>{Y(r=>r.includes(s)?r.filter(g=>g!==s):[...r,s])},za=t.name.split(" ").map(s=>s[0]).slice(0,2).join("").toUpperCase();return e.jsxs("div",{className:"p-6 md:p-10 max-w-6xl mx-auto space-y-8",children:[Ce&&e.jsxs("div",{className:"fixed inset-0 z-[9999] flex flex-col items-center justify-center bg-background/95 backdrop-blur-sm",children:[e.jsx(F,{className:"w-8 h-8 animate-spin text-primary mb-3"}),e.jsx("p",{className:"text-sm text-muted-foreground font-medium",children:"Carregando..."})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Meu Perfil"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Gerencie suas informações e configurações"})]}),e.jsx(w,{variant:"ghost",size:"icon",onClick:()=>l(-1),className:"shrink-0",children:e.jsx(fs,{className:"w-5 h-5"})})]}),e.jsx(Qe,{children:e.jsxs(We,{className:"pt-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4 sm:gap-5",children:[e.jsxs("div",{className:"relative shrink-0",children:[t.avatar?e.jsx("img",{src:t.avatar,alt:"Avatar",className:"w-20 h-20 rounded-full object-cover"}):e.jsx("div",{className:"w-20 h-20 rounded-full gradient-teal flex items-center justify-center text-2xl font-bold text-primary-foreground",children:za}),e.jsx("input",{ref:z,type:"file",accept:"image/*",className:"hidden",onChange:async s=>{var g;const r=(g=s.target.files)==null?void 0:g[0];if(r){if(r.size>5*1024*1024){i.error("Imagem muito grande! Máximo 5MB.");return}try{const{data:{session:c}}=await d.auth.getSession(),j=c==null?void 0:c.user;if(!j){i.error("Sessão expirada. Faça login novamente.");return}const v=(r.name.split(".").pop()||"jpg").toLowerCase(),C=`${j.id}/avatar-${Date.now()}.${v}`,{error:T}=await d.storage.from("avatars").upload(C,r,{upsert:!0,cacheControl:"3600",contentType:r.type});if(T)throw T;const{data:$}=d.storage.from("avatars").getPublicUrl(C),h=`${$.publicUrl}?v=${Date.now()}`;await d.from("profiles").update({avatar_url:h}).eq("user_id",j.id),f(b=>({...b,avatar:h})),m({avatar:h}),i.success("Foto de perfil atualizada!")}catch(c){console.error(c),i.error((c==null?void 0:c.message)||"Falha ao enviar foto.")}finally{s.target.value=""}}}}),e.jsxs(ft,{children:[e.jsx(gt,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Opções de foto de perfil",className:"absolute bottom-0 right-0 w-7 h-7 rounded-full bg-primary flex items-center justify-center cursor-pointer hover:bg-primary/90 transition-colors shadow-md",children:e.jsx(Zs,{className:"w-3.5 h-3.5 text-primary-foreground"})})}),e.jsxs(jt,{align:"start",children:[e.jsxs(Us,{onClick:()=>{var s;return(s=z.current)==null?void 0:s.click()},children:[e.jsx(Zs,{className:"w-4 h-4 mr-2"}
49),t.avatar?"Alterar foto":"Enviar foto"]}),t.avatar&&e.jsxs(Us,{className:"text-destructive focus:text-destructive",onClick:async()=>{try{const{data:{session:s}}=await d.auth.getSession(),r=s==null?void 0:s.user;if(r){await d.from("profiles").update({avatar_url:null}).eq("user_id",r.id);const{data:g}=await d.storage.from("avatars").list(r.id);g!=null&&g.length&&await d.storage.from("avatars").remove(g.map(c=>`${r.id}/${c.name}`))}f(g=>({...g,avatar:""})),m({avatar:""}),i.success("Foto de perfil removida!")}catch(s){console.error(s),i.error((s==null?void 0:s.message)||"Falha ao remover foto.")}},children:[e.jsx(Xe,{className:"w-4 h-4 mr-2"}),"Remover foto"]})]})]})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"min-w-0 space-y-1",children:y?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(U,{className:"text-xs text-muted-foreground",children:"Nome completo"}),e.jsx(B,{value:t.name,onChange:s=>f({...t,name:s.target.value})})]}),e.jsxs("div",{children:[e.jsx(U,{className:"text-xs text-muted-foreground",children:"Email"}),e.jsx(B,{value:t.email,onChange:s=>f({...t,email:s.target.value})})]})]}):e.jsx(e.Fragment,{children:e.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-foreground truncate",children:n.name})})}),e.jsx("div",{className:"shrink-0 hidden sm:block",children:y?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(w,{onClick:Ms,variant:"ghost",size:"sm",children:"Cancelar"}),e.jsxs(w,{onClick:Ts,size:"sm",className:"gap-1.5 gradient-teal text-primary-foreground",children:[e.jsx(Ws,{className:"w-3.5 h-3.5"})," Salvar"]})]}):e.jsxs(w,{onClick:()=>u(!0),variant:"outline",size:"sm",className:"gap-1.5",children:[e.jsx(Qs,{className:"w-3.5 h-3.5"})," Editar dados"]})})]}),e.jsx("div",{className:"sm:hidden mt-3",children:y?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(w,{onClick:Ms,variant:"ghost",size:"sm",className:"flex-1",children:"Cancelar"}),e.jsxs(w,{onClick:Ts,size:"sm",className:"flex-1 gap-1.5 gradient-teal text-primary-foreground",children:[e.jsx(Ws,{className:"w-3.5 h-3.5"})," Salvar"]})]}):e.jsxs(w,{onClick:()=>u(!0),variant:"outline",size:"sm",className:"gap-1.5 w-full",children:[e.jsx(Qs,{className:"w-3.5 h-3.5"})," Editar dados"]})})]})]}),e.jsx(H,{}),e.jsxs(Os,{defaultValue:"pessoal",className:"w-full",children:[e.jsxs(Bs,{className:"w-full grid grid-cols-3 mb-4",children:[e.jsxs(J,{value:"pessoal",className:"gap-1.5 text-xs sm:text-sm",children:[e.jsx(Nt,{className:"w-3.5 h-3.5 hidden sm:inline"})," Pessoal"]}),e.jsxs(J,{value:"academico",className:"gap-1.5 text-xs sm:text-sm",children:[e.jsx(Dt,{className:"w-3.5 h-3.5 hidden sm:inline"})," Acadêmico"]}),e.jsxs(J,{value:"objetivos",className:"gap-1.5 text-xs sm:text-sm",children:[e.jsx(Fs,{className:"w-3.5 h-3.5 hidden sm:inline"})," Objetivos"]})]}),e.jsxs(K,{value:"pessoal",className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[e.jsx(ue,{icon:Oe,label:"Email",value:t.email,editing:y,onChange:s=>f({...t,email:s}),placeholder:"[email protected]"}),e.jsx(ue,{icon:yt,label:"Telefone",value:t.phone,editing:y,onChange:s=>f({...t,phone:Zt(s)}),placeholder:"(11) 99999-9999",inputMode:"numeric",maxLength:15,invalid:!!t.phone&&!sa(t.phone),errorMessage:"Formato esperado: (11) 99999-9999"}),e.jsx(ue,{icon:wt,label:"Data de Nascimento",value:t.birthDate,editing:y,onChange:s=>f({...t,birthDate:Xt(s)}),placeholder:"DD/MM/AAAA",inputMode:"numeric",maxLength:10,invalid:!!t.birthDate&&!ea(t.birthDate),errorMessage:"Formato esperado: DD/MM/AAAA"}),e.jsx(ue,{icon:Be,label:"CPF",value:t.cpf,editing:y,onChange:s=>f({...t,cpf:Jt(s)}),placeholder:"000.000.000-00",inputMode:"numeric",maxLength:14,invalid:!!t.cpf&&!aa(t.cpf),errorMessage:"CPF inválido"})]}),y&&e.jsxs(e.Fragment,{children:[e.jsx(H,{}),e.jsxs("p",{className:"text-xs font-semibold text-muted-foreground flex items-center gap-1.5",children:[e.jsx($e,{className:"w-3.5 h-3.5"})," Alterar Senha"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs(U,{className:"text-xs text-muted-foreground flex items-center gap-1.5 mb-1.5",children:[e.jsx($e,{className:"w-3.5 h-3.5"})," Nova senha"]}
49),e.jsxs("div",{className:"relative",children:[e.jsx(B,{type:P?"text":"password",value:L,onChange:s=>ae(s.target.value),placeholder:"Nova senha",minLength:8,pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[^A-Za-z0-9]).{8,}$",title:"MÃnimo 8 caracteres, com maiúscula, minúscula, número e caractere especial"}),e.jsx("button",{type:"button",onClick:()=>W(!P),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:P?e.jsx(ms,{className:"w-4 h-4"}):e.jsx(Ue,{className:"w-4 h-4"})})]}),e.jsx(Kt,{password:L})]}),e.jsxs("div",{children:[e.jsxs(U,{className:"text-xs text-muted-foreground flex items-center gap-1.5 mb-1.5",children:[e.jsx($e,{className:"w-3.5 h-3.5"})," Confirmar senha"]}),e.jsx(B,{type:P?"text":"password",value:re,onChange:s=>te(s.target.value),placeholder:"Confirmar senha",minLength:8,pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[^A-Za-z0-9]).{8,}$",title:"MÃnimo 8 caracteres, com maiúscula, minúscula, número e caractere especial"}),L&&re&&L!==re&&e.jsxs("p",{className:"text-xs text-destructive mt-1.5 flex items-center gap-1",children:[e.jsx(fs,{className:"w-3 h-3"})," As senhas não coincidem."]})]})]})]})]}),e.jsx(K,{value:"academico",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:e.jsxs("div",{children:[e.jsxs(U,{className:"text-xs text-muted-foreground flex items-center gap-1.5 mb-1.5",children:[e.jsx(us,{className:"w-3.5 h-3.5"})," Série"]}),y?e.jsxs(it,{value:t.grade,onValueChange:s=>f({...t,grade:s}),children:[e.jsx(lt,{children:e.jsx(ct,{})}),e.jsxs(dt,{children:[e.jsx(ke,{value:"1º Ano - Ensino Médio",children:"1º Ano - Ensino Médio"}),e.jsx(ke,{value:"2º Ano - Ensino Médio",children:"2º Ano - Ensino Médio"}),e.jsx(ke,{value:"3º Ano - Ensino Médio",children:"3º Ano - Ensino Médio"}),e.jsx(ke,{value:"Cursinho",children:"Cursinho"}),e.jsx(ke,{value:"Já formado",children:"Já formado"})]})]}):e.jsx("p",{className:"text-sm font-medium text-foreground",children:n.grade||"â"})]})})}),e.jsx(K,{value:"objetivos",children:e.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[e.jsx(ue,{icon:us,label:"Curso desejado",value:t.targetCourse,editing:y,onChange:s=>f({...t,targetCourse:s}),placeholder:"Ex: Medicina"}),e.jsx(ue,{icon:Fs,label:"Universidade alvo",value:t.targetUniversity,editing:y,onChange:s=>f({...t,targetUniversity:s}),placeholder:"Ex: USP"}),e.jsxs("div",{children:[e.jsxs(U,{className:"text-xs text-muted-foreground flex items-center gap-1.5 mb-1.5",children:[e.jsx(Xa,{className:"w-3.5 h-3.5"})," Horas de estudo por dia"]}),y?e.jsx(B,{type:"number",min:1,max:16,value:t.studyHoursPerDay,onChange:s=>f({...t,studyHoursPerDay:Number(s.target.value)})}):e.jsxs("p",{className:"text-sm font-medium text-foreground",children:[n.studyHoursPerDay,"h"]})]})]})})]})]})}),e.jsxs(Qe,{children:[e.jsx(gs,{className:"pb-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs(js,{className:"text-base flex items-center gap-2",children:[e.jsx(Xs,{className:"w-4 h-4 text-primary"})," Meu Plano"]}),!D&&(()=>{const s=N==="monthly"||N==="annual";return e.jsxs("div",{className:"flex items-center gap-2",children:[!p&&e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Acesso expirado":"Acesso gratuito"}),e.jsx(ra,{className:be("border-0",p?"gradient-teal text-primary-foreground":s?"bg-destructive text-destructive-foreground":"bg-muted text-muted-foreground"),children:p?"Ativo":s?"Expirado":"Gratuito"})]})})()]})}),e.jsx(We,{className:"space-y-4",children:D?e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(F,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):(()=>{const s=N==="monthly"?"Plano Mensal":N==="annual"?"Plano Anual":N==="admin"?"Acesso Administrador":"Plano Gratuito",r=N==="monthly"||N==="annual",g=!p&&r,c=R?new Date(R):null,j=c?Math.ceil((c.getTime()-Date.now())/(1e3*60*60*24)):null,v=c?c.toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"}):null,C=As==="PIX",T=!C&&k&&!E,$=p&&j!==null&&j<=7;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-semibold text-foreground",children:s}),r&&p&&v&&e.jsx("p",{className:"text-sm text-muted-foreground",children:T?e.jsxs(e.Fragment,{children:["Renova em ",v,j!==null&&j<=30?` · em ${j} dia${j!==1?"s":""}`:""]}):e.jsxs(e.Fragment,{children:["Acesso até ",v,j!==null&&j>=0?` · faltam ${j} dia${j!==1?"s":""}`:""]})}),g&&v&&e.jsxs("p",{className:"text-sm text-destructive",children:["Expirou em ",v]}),!r&&!p&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Desbloqueie acesso completo à plataforma."}),r&&p&&As&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1 flex items-center gap-1.5",children:C?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"inline-flex items-center justify-center px-1.5 h-4 rounded bg-emerald-100 text-emerald-700 text-[9px] font-bold",children:"PIX"}),"Pago via PIX · renovação manual"]}):T?e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-3.5 h-3.5"}),"Cartão de crédito · renovação automática"]}):N==="annual"?e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-3.5 h-3.5"}),"Cartão de crédito · renovação manual"]}):e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-3.5 h-3.5"}),"Cartão · renovação automática desligada"]})})]}),!zs()&&p&&r&&N==="annual"&&(C||!k||!!E)&&e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsxs(w,{size:"sm",className:"gap-1.5",onClick:()=>l("/checkout?type=annual"),children:[e.jsx(me,{className:"w-4 h-4"}),"Renovar"]})}),!zs()&&(g||!p&&!r||$)&&e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border bg-muted/30 p-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:g?"Renove para continuar acessando todas as funcionalidades.":$?`Seu plano expira em ${j} dia${j!==1?"s":""}.`:"Assine para desbloquear acesso completo."}),e.jsxs(w,{size:"sm",className:"gap-1.5 shrink-0",onClick:()=>Za(l),children:[e.jsx(Xs,{className:"w-4 h-4"}),g?"Renovar plano":$?"Renovar":"Assinar"]})]}),p&&r&&!C&&k&&E&&e.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-900 p-3 text-xs text-amber-900 dark:text-amber-100",children:["A renovação automática será desligada em ",e.jsx("strong",{children:new Date(E).toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"})}),"."," ",e.jsx("button",{type:"button",disabled:Ds,onClick:async()=>{Ps(!0);try{const{data:h,error:b}=await d.functions.invoke("asaas-reactivate-auto-renew");if(b||h!=null&&h.error){if((h==null?void 0:h.error)==="needs_checkout"){i.error("Sua assinatura já foi encerrada. Faça o checkout para reativar."),l(`/checkout?type=${N}&reactivate=1`);return}throw new Error((h==null?void 0:h.error)||(b==null?void 0:b.message)||"Falha")}await Ls(),i.success("Renovação automática reativada.")}catch(h){i.error(h.message||"Não foi possÃvel reativar.")}finally{Ps(!1)}},className:"font-semibold text-primary hover:underline disabled:opacity-50",children:Ds?"Reativandoâ¦":"Reativar"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 pt-3 border-t text-xs",children:[e.jsx("button",{type:"button",onClick:()=>Es(!0),className:"text-muted-foreground hover:text-foreground hover:underline",children:"Ver histórico"}),p&&r&&!C&&k&&!E&&e.jsx("button",{type:"button",onClick:()=>as(!0),className:"text-muted-foreground hover:text-foreground hover:underline",children:"Cancelar renovação"}),(()=>{if(!r||!p)return null;const h=Ra||A;if(!h)return null;const b=(Date.now()-new Date(h).getTime())/(1e3*60*60*24);if(b>rs)return null;const G=Math.max(1,Math.ceil(rs-b));return e.jsxs("button",{type:"button",onClick:()=>I(!0),className:"text-muted-foreground hover:text-destructive hover:underline",children:["Solicitar reembolso · ",G,"d"]})})()]}),e.jsx(xe,{open:wa,onOpenChange:h=>{as(h),h||(ts(""),_s(!1))},children:e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsx(fe,{children:"Desativar renovação automática?"}),e.jsxs(ge,{children:["A renovação será desativada em ",e.jsx("strong",{children:R?new Date(R).toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"}):"o fim do perÃodo pago"}),". Seu acesso permanece ativo até essa data. Seu histórico (respostas, anotações e estatÃsticas) é sempre preservado."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Confirme sua senha para continuar"}
49),e.jsxs("div",{className:"relative",children:[e.jsx(B,{type:Rs?"text":"password",value:Fe,onChange:h=>ts(h.target.value),placeholder:"Sua senha",autoComplete:"current-password",disabled:Ce,className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>_s(h=>!h),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:Rs?e.jsx(ms,{className:"w-4 h-4"}):e.jsx(Ue,{className:"w-4 h-4"})})]})]}),e.jsxs(je,{children:[e.jsx(ve,{disabled:Ce,children:"Voltar"}),e.jsx(ps,{disabled:Ce||!Fe,onClick:async h=>{if(h.preventDefault(),!Fe){i.error("Informe sua senha para confirmar.");return}ks(!0);try{const{data:{user:b}}=await d.auth.getUser();if(!(b!=null&&b.email))throw new Error("Sessão inválida. Faça login novamente.");const{error:G}=await d.auth.signInWithPassword({email:b.email,password:Fe});if(G)throw new Error("Senha incorreta. Verifique e tente novamente.");const{data:S,error:q}=await d.functions.invoke("asaas-cancel-subscription");if(q||S!=null&&S.error)throw new Error((S==null?void 0:S.error)||(q==null?void 0:q.message)||"Falha ao cancelar");await Ls(),i.success("Renovação automática desativada com sucesso."),as(!1),ts("")}catch(b){i.error(b.message||"Não foi possÃvel cancelar agora. Tente novamente.")}finally{ks(!1)}},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Ce?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"w-4 h-4 mr-1 animate-spin"})," Verificando..."]}):"Sim, desativar"})]})]})}),e.jsx(xe,{open:_,onOpenChange:h=>{I(h),h?(async()=>{Ss(!0);try{const{data:b,error:G}=await d.functions.invoke("asaas-list-refundable-payments");if(G)throw G;const S=(b==null?void 0:b.payments)??[];ya(!!(b!=null&&b.refund_already_used)),Cs(S),ss(new Set(S.slice(0,1).map(q=>q.id)))}catch(b){console.error("[refund] list error:",b),i.error("Não foi possÃvel carregar seus pagamentos.")}finally{Ss(!1)}})():(Z(""),Me(!1),ss(new Set),Cs([]))},children:e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsx(fe,{children:"Solicitar Reembolso"}),e.jsxs(ge,{children:["Reembolso permitido apenas nos primeiros ",rs," dias após a primeira assinatura. Apenas o primeiro pagamento é elegÃvel. Renovações não são reembolsáveis."]})]}),e.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:ba?e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(F,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):Na?e.jsx("p",{className:"text-sm text-muted-foreground py-2",children:"Você já solicitou e recebeu um reembolso anteriormente. Por isso, não é possÃvel solicitar novo reembolso. Se precisar de ajuda, entre em contato com o suporte."}):ws.length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-2",children:"Nenhum pagamento elegÃvel para reembolso na janela atual."}):ws.map(h=>{const b=ce.has(h.id);return e.jsxs("label",{className:"flex items-center gap-3 p-2 border rounded-md cursor-pointer hover:bg-muted/40",children:[e.jsx(ds,{checked:b,onCheckedChange:G=>{ss(S=>{const q=new Set;return G&&q.add(h.id),q})}}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsxs("div",{className:"font-medium text-foreground",children:["R$ ",Number(h.amount).toFixed(2).replace(".",",")," ",e.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:["(",h.plan==="annual"?"anual":"mensal",")"]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Pago em ",new Date(h.paid_at).toLocaleDateString("pt-BR")," · ",h.billing_type==="PIX"?"PIX":"Cartão"]})]})]},h.id)})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Confirme sua senha para continuar"}),e.jsxs("div",{className:"relative",children:[e.jsx(B,{type:Te?"text":"password",value:O,onChange:h=>Z(h.target.value),placeholder:"Sua senha",autoComplete:"current-password",disabled:le,className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>Me(h=>!h),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,
49children:Te?e.jsx(ms,{className:"w-4 h-4"}):e.jsx(Ue,{className:"w-4 h-4"})})]})]}),e.jsxs(je,{children:[e.jsx(ve,{disabled:le,children:"Cancelar"}),e.jsx(ps,{disabled:le||!O||ce.size===0,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:async h=>{if(h.preventDefault(),!O){i.error("Informe sua senha para confirmar.");return}if(ce.size===0){i.error("Selecione o pagamento para reembolso.");return}if(ce.size>1){i.error("Apenas um pagamento pode ser reembolsado por vez.");return}Ie(!0);try{const{data:{user:b}}=await d.auth.getUser();if(!(b!=null&&b.email))throw new Error("Sessão inválida. Faça login novamente.");const{error:G}=await d.auth.signInWithPassword({email:b.email,password:O});if(G)throw new Error("Senha incorreta. Verifique e tente novamente.");const{data:S,error:q}=await d.functions.invoke("asaas-refund",{body:{payment_ids:Array.from(ce)}});if(q){let Se=q.message;try{const ls=q.context;if(ls&&typeof ls.json=="function"){const qe=await ls.json();qe!=null&&qe.error&&(Se=qe.error)}}catch{}throw new Error(Se)}if(S!=null&&S.error)throw new Error(S.error);const er=(S==null?void 0:S.refunded_payments)??ce.size;if(S!=null&&S.access_revoked)i.success("Reembolso processado. Seu acesso foi encerrado. O valor chega na sua conta nas próximas horas.");else{const Se=S!=null&&S.new_expires_at?new Date(S.new_expires_at).toLocaleDateString("pt-BR"):null;i.success(`Reembolso processado. Você manterá acesso${Se?` até ${Se}`:""}. O valor chega na sua conta nas próximas horas.`)}I(!1),Z(""),setTimeout(()=>window.location.reload(),1500)}catch(b){console.error("Refund error:",b),i.error((b==null?void 0:b.message)||"Erro ao processar reembolso. Tente novamente.")}finally{Ie(!1)}},children:le?e.jsx(F,{className:"w-4 h-4 animate-spin"}):"Reembolsar"})]})]})}),e.jsx(Ja,{open:Sa,onOpenChange:Es,children:e.jsxs(Ka,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[e.jsx(Ya,{children:e.jsx(et,{children:"Histórico de pagamentos"})}),e.jsx(Wt,{embedded:!0})]})})]})})()})]}),e.jsxs(Qe,{children:[e.jsxs(gs,{className:"pb-4",children:[e.jsxs(js,{className:"text-lg flex items-center gap-2",children:[e.jsx(qs,{className:"w-5 h-5 text-primary"})," Configurações"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Personalize a plataforma do seu jeito"})]}),e.jsx(We,{children:e.jsxs(Os,{defaultValue:"geral",className:"w-full",children:[e.jsxs(Bs,{className:"w-full grid grid-cols-3 sm:grid-cols-6 mb-6 h-auto gap-1",children:[e.jsx(J,{value:"geral",className:"text-xs sm:text-sm",children:"Geral"}),e.jsx(J,{value:"layout",className:"text-xs sm:text-sm",children:"Layout"}),e.jsx(J,{value:"questoes",className:"text-xs sm:text-sm",children:"Questões"}),e.jsx(J,{value:"ferramentas",className:"text-xs sm:text-sm",children:"Ferramentas"}),e.jsx(J,{value:"manual",className:"text-xs sm:text-sm",children:"Manual"}),e.jsx(J,{value:"dados",className:"text-xs sm:text-sm",children:"Dados"})]}),e.jsxs(K,{value:"geral",className:"space-y-6 mt-0",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2 mb-3",children:[e.jsx(mt,{className:"w-4 h-4 text-primary"})," Tema de cores"]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[{key:"default",label:"Padrão",colors:"from-emerald-500 to-teal-500"},{key:"blue",label:"Azul",colors:"from-blue-500 to-cyan-500"},{key:"purple",label:"Roxo",colors:"from-purple-500 to-pink-500"},{key:"green",label:"Verde Escuro",colors:"from-green-700 to-emerald-600"}].map(s=>e.jsxs("button",{onClick:()=>{m({colorTheme:s.key}),f(r=>({...r,colorTheme:s.key})),i.success(`Tema "${s.label}" aplicado!`)},className:be("flex flex-col items-center gap-2 p-3 rounded-lg border transition-all",n.colorTheme===s.key?"border-primary bg-primary/5 ring-2 ring-primary/20":"border-border hover:bg-muted/50"),children:[e.jsx("div",{className:be("w-8 h-8 rounded-full bg-gradient-to-br",s.colors)}),e.jsx("span",{className:"text-xs font-medium text-foreground",children:s.label})]},s.key))})]}),e.jsx(H,{}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("p",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[e.jsx(Pt,{className:"w-4 h-4 text-primary"})," Sons e notificações"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Sons ao acertar/errar questões e alertas do Pomodoro."})]}),e.jsx(Q,{checked:n.soundEnabled,onCheckedChange:s=>{m({soundEnabled:s}),f(r=>({...r,soundEnabled:s})),i.success(s?"Sons ativados":"Sons desativados")}})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("p",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[e.jsx(cs,{className:"w-4 h-4 text-primary"})," Dashboard compacto"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Ocultar widgets secundários para uma visão mais limpa."})]}),e.jsx(Q,{checked:n.compactDashboard,onCheckedChange:s=>{m({compactDashboard:s}),f(r=>({...r,compactDashboard:s})),i.success(s?"Dashboard compacto ativado":"Dashboard completo restaurado")}})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("p",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[e.jsx(cs,{className:"w-4 h-4 text-primary"})," Countdown do ENEM"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Mostrar o contador regressivo até a prova e mensagem motivacional no Dashboard."})]}),e.jsx(Q,{checked:!n.hideEnemCountdown,onCheckedChange:s=>{m({hideEnemCountdown:!s}),f(r=>({...r,hideEnemCountdown:!s})),i.success(s?"Countdown ativado":"Countdown ocultado")}})]}),e.jsxs(w,{className:"mt-4 w-full gap-2 bg-primary text-primary-foreground hover:bg-primary/90 font-semibold whitespace-normal h-auto py-2.5",onClick:()=>window.location.reload(),children:[e.jsx(me,{className:"w-4 h-4"}),"Atualizar página para aplicar mudanças"]}),e.jsxs("div",{className:"mt-6 rounded-lg border border-border bg-muted/30 p-4",children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2 mb-2",children:[e.jsx(Oe,{className:"w-4 h-4 text-primary"})," Suporte"]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Precisa de ajuda? Env
49ie sua mensagem diretamente para a equipe Fique Tranquilo."}),Ea?e.jsxs("div",{className:"space-y-3",children:[e.jsx("textarea",{className:"w-full min-h-[120px] rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 resize-y",placeholder:"Descreva sua dúvida ou problema...",value:ze,onChange:s=>ns(s.target.value),maxLength:2e3,disabled:Le}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[ze.length,"/2000"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(w,{variant:"ghost",size:"sm",onClick:()=>{os(!1),ns("")},disabled:Le,children:"Cancelar"}),e.jsxs(w,{size:"sm",className:"gap-2 bg-primary text-primary-foreground hover:bg-primary/90",disabled:!ze.trim()||Le,onClick:async()=>{Is(!0);try{const{data:s,error:r}=await d.functions.invoke("send-support-email",{body:{message:ze.trim()}});if(r)throw r;i.success("Mensagem enviada com sucesso! Responderemos em breve."),ns(""),os(!1)}catch(s){console.error(s),i.error("Erro ao enviar mensagem. Tente novamente.")}finally{Is(!1)}},children:[Le?e.jsx(F,{className:"w-4 h-4 animate-spin"}):e.jsx(Oe,{className:"w-4 h-4"}),"Enviar"]})]})]})]}):e.jsxs(w,{variant:"outline",className:"w-full gap-2",onClick:()=>os(!0),children:[e.jsx(Oe,{className:"w-4 h-4"}),"Entrar em contato com o suporte"]})]})]}),e.jsxs(K,{value:"layout",className:"space-y-6 mt-0",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2 mb-3",children:[e.jsx(Js,{className:"w-4 h-4 text-primary"})," Layout do menu"]}),e.jsxs(Ze,{value:n.menuLayout,onValueChange:s=>{m({menuLayout:s}),i.success("Layout do menu atualizado!")},className:"space-y-2",children:[e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-lg border border-border hover:bg-muted/50 transition-colors",children:[e.jsx(ee,{value:"sidebar",className:"mt-0.5"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Js,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Menu lateral (Sidebar)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Menu vertical fixo na lateral esquerda."})]})]})]}),e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-lg border border-border hover:bg-muted/50 transition-colors",children:[e.jsx(ee,{value:"topbar",className:"mt-0.5"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_t,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Menu horizontal (Topo)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Barra de navegação no topo da página."})]})]})]}),e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-lg border border-border hover:bg-muted/50 transition-colors",children:[e.jsx(ee,{value:"both",className:"mt-0.5"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Rt,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Ambos (Topo + Sidebar)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Itens principais no topo e organização na sidebar."})]})]})]})]})]}),e.jsx(H,{}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-lg",children:"ð"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Ãcones do menu com emojis"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n.useEmojis!==!1?"Usando emojis coloridos no menu":"Usando Ãcones tradicionais no menu"})]})]}),e.jsx(Q,{checked:n.useEmojis!==!1,onCheckedChange:s=>{m({useEmojis:s}),i.success(s?"Emojis ativados!":"Ãcones tradicionais ativados!")}})]}),e.jsxs(w,{className:"mt-4 w-full gap-2 bg-primary text-primary-foreground hover:bg-primary/90 font-semibold whitespace-normal h-auto py-2.5",onClick:()=>window.location.reload(),children:[e.jsx(me,{className:"w-4 h-4"}),"Atualizar página para aplicar mudanças"]})]}),e.jsxs(K,{value:"questoes",className:"space-y-6 mt-0",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2 mb-3",children:[e.jsx(Ct,{className:"w-4 h-4 text-primary"})," Tamanho da fonte nas questões"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Menor"}),e.jsxs("span",{className:"text-sm font-bold text-foreground",children:[n.defaultFontSize,"px"]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Maior"})]}),e.jsx(nt,{value:[n.defaultFontSize],min:14,max:20,step:1,onValueChange:([s])=>{m({defaultFontSize:s}),f(r=>({...r,defaultFontSize:s}))}}),e.jsx("p",{className:"text-xs text-muted-foreground",style:{fontSize:`${n.defaultFontSize}px`},children:"Exemplo de texto neste tamanho."})]})]}),e.jsx(H,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[e.jsx(Vs,{className:"w-4 h-4 text-primary"})," Ocultar tags das questões"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Esconde as etiquetas (mat
49éria, assunto, tópico, dificuldade) nos cards e no visualizador."})]}),e.jsx(Q,{checked:n.hideTags,onCheckedChange:s=>{m({hideTags:s}),f(r=>({...r,hideTags:s})),i.success(s?"Tags ocultadas":"Tags visÃveis")}})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[e.jsx(Vs,{className:"w-4 h-4 text-primary"})," Ocultar competências e habilidades"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Esconde o bloco de competência e habilidade da BNCC/ENEM no visualizador."})]}),e.jsx(Q,{checked:n.hideCompetencias,onCheckedChange:s=>{m({hideCompetencias:s}),f(r=>({...r,hideCompetencias:s})),i.success(s?"Competências ocultadas":"Competências visÃveis")}})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[e.jsx(St,{className:"w-4 h-4 text-primary"})," Salvar última busca"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'Mantém o termo, filtros e resultados da última busca em "Buscar Questões" ao trocar de aba. Desligue para começar sempre com a busca limpa.'})]}),e.jsx(Q,{checked:n.saveLastSearch,onCheckedChange:s=>{if(m({saveLastSearch:s}),f(r=>({...r,saveLastSearch:s})),!s)try{sessionStorage.removeItem("questoes-search-state")}catch{}i.success(s?"Ãltima busca será salva":"Busca não será mais salva")}})]}),e.jsx(H,{}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2 mb-3",children:[e.jsx(cs,{className:"w-4 h-4 text-primary"})," Posição da barra de ferramentas"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Escolha onde exibir os botões de ação (anotar, favoritar, caderno, etc.) nas questões."}),e.jsxs(Ze,{value:n.toolbarPosition||"horizontal",onValueChange:s=>{const r=s;m({toolbarPosition:r}),f(g=>({...g,toolbarPosition:r})),i.success(r==="horizontal"?"Barra horizontal (acima da questão)":"Barra vertical (ao lado da questão)")},className:"space-y-2",children:[e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-lg border border-border hover:bg-muted/50 transition-colors",children:[e.jsx(ee,{value:"horizontal",className:"mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Horizontal (padrão)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Botões em uma linha acima da questão."})]})]}),e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-lg border border-border hover:bg-muted/50 transition-colors",children:[e.jsx(ee,{value:"vertical",className:"mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Vertical (lateral)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Botões em uma coluna fixa ao lado da questão."})]})]})]})]}),e.jsx(H,{}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2 mb-3",children:[e.jsx(qs,{className:"w-4 h-4 text-primary"})," Contabilização de resoluções"]}),e.jsxs(Ze,{value:n.resolutionCounting,onValueChange:s=>Da(s),className:"space-y-2",children:[e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-lg border border-border hover:bg-muted/50 transition-colors",children:[e.jsx(ee,{value:"last",className:"mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Somente a última resolução"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Cada questão só é contabilizada uma única vez."})]})]}),e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-lg border border-border hover:bg-muted/50 transition-colors",children:[e.jsx(ee,{value:"all",className:"mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Todas as resoluções"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualquer resolução será contabilizada."})]})]})]})]}),e.jsx(H,{}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("p",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[e.jsx(Ue,{className:"w-4 h-4 text-primary"})," Mostrar resolução automaticamente"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Exibir a resolução logo após responder, sem precisar clicar."})]}),e.jsx(Q,{checked:n.autoShowResolution,onCheckedChange:s=>{m({autoShowResolution:s}),f(r=>({...r,autoShowResolution:s})),i.success(s?"Resolução automática ativada":"Resolução automática desativada")}})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("p",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[e.jsx(st,{className:"w-4 h-4 text-primary"})," Confirmar antes de responder"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Pedir confirmação antes de revelar o gabarito."})]}),e.jsx(Q,{checked:n.confirmBeforeAnswer,onCheckedChange:s=>{m({confirmBeforeAnswer:s}),f(r=>({...r,confirmBeforeAnswer:s})),i.success(s?"Confirmação ativada":"Confirmação desativada")}})]}),e.jsxs(w,{className:"mt-4 w-full gap-2 bg-primary text-primary-foreground hover:bg-primary/90 font-semibold whitespace-normal h-auto py-2.5",onClick:()=>window.location.reload(),children:[e.jsx(me,{className:"w-4 h-4"}),"Atualizar página para aplicar mudanças"]})]}
49),e.jsx(K,{value:"ferramentas",className:"space-y-4 mt-0",children:e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2 mb-1",children:[e.jsx(At,{className:"w-4 h-4 text-primary"})," Ferramentas ativas"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Escolha quais ferramentas deseja manter visÃveis no menu"}),e.jsx("div",{className:"space-y-2",children:at.map(s=>{var c;const r=((c=n.disabledTools)==null?void 0:c.includes(s.key))??!1,g=M&&(s.key==="nudge"||s.key==="celebracao"||!!Ys[s.key]&&!tt(Ys[s.key]));return e.jsxs("label",{title:g?rt(s.description):void 0,className:be("flex items-center justify-between p-3 rounded-lg border border-border hover:bg-muted/50 transition-colors cursor-pointer",g&&"opacity-60"),children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("p",{className:"text-sm font-medium text-foreground flex items-center gap-1.5",children:[s.label,g&&e.jsx($e,{className:"w-3 h-3 text-foreground shrink-0",strokeWidth:2.5})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description}),g&&e.jsx("p",{className:"text-xs font-medium text-foreground",children:"DisponÃvel apenas para assinantes."})]}),e.jsx(Q,{checked:g?!0:!r,disabled:g,onCheckedChange:j=>{if(g)return;const v=n.disabledTools||[],C=j?v.filter(T=>T!==s.key):[...v,s.key];m({disabledTools:C}),i.success(j?`${s.label} ativado`:`${s.label} desativado`)}})]},s.key)})}),e.jsxs(w,{className:"mt-4 w-full gap-2 bg-primary text-primary-foreground hover:bg-primary/90 font-semibold whitespace-normal h-auto py-2.5",onClick:()=>window.location.reload(),children:[e.jsx(me,{className:"w-4 h-4"}),"Atualizar página para aplicar mudanças"]})]})}),e.jsx(K,{value:"manual",className:"space-y-4 mt-0",children:e.jsxs("div",{className:"text-center space-y-4 py-4",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary/15 flex items-center justify-center mx-auto",children:e.jsx(us,{className:"w-8 h-8 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-foreground",children:"Manual do Aluno"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 max-w-md mx-auto leading-relaxed",children:"Consulte o manual completo da plataforma para aprender a usar todas as ferramentas: questões, simulados, flashcards, cronograma, tutor IA e muito mais."})]}),e.jsxs(w,{onClick:()=>l("/manual"),className:"gap-2",children:[e.jsx(ot,{className:"w-4 h-4"}),"Abrir Manual do Aluno"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"O manual abre em uma nova página com todas as seções organizadas por tema."})]})}),e.jsxs(K,{value:"dados",className:"space-y-3 mt-0",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2 mb-3",children:[e.jsx(Re,{className:"w-4 h-4 text-primary"})," Autenticação em Duas Etapas (TOTP)"]}),e.jsx(Vt,{})]}),e.jsx(H,{}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2 mb-3",children:[e.jsx(Re,{className:"w-4 h-4 text-primary"})," Privacidade e Dados"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(xe,{open:Ae,onOpenChange:s=>{Ee(s),s||we("")},children:[e.jsx(He,{asChild:!0,children:e.jsxs(w,{variant:"outline",className:"w-full justify-start gap-3",children:[e.jsx(Xe,{className:"w-4 h-4 text-destructive"}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Limpar Desempenho"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Remove histórico de simulados, questões resolvidas e sessões de estudo"})]})]})}),e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsx(fe,{children:"Limpar desempenho?"}),e.jsx(ge,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Esta ação vai remover todo o seu desempenho: histórico de simulados, questões resolvidas e sessões de estudo. Isso não pode ser desfeito."}),e.jsxs("div",{children:[e.jsx(U,{className:"text-sm text-foreground font-medium",children:"Digite sua senha para continuar:"}
49),e.jsx(B,{type:"password",value:ye,onChange:s=>we(s.target.value),placeholder:"Insira sua senha",className:"mt-1.5"})]})]})})]}),e.jsxs(je,{children:[e.jsx(ve,{children:"Cancelar"}),e.jsxs(w,{onClick:Ia,disabled:!ye.trim()||V,variant:"destructive",children:[V?e.jsx(F,{className:"w-4 h-4 animate-spin mr-2"}):null,"Confirmar"]})]})]})]}),e.jsxs(xe,{open:Ye,onOpenChange:s=>{De(s),s||(Y([]),oe(""))},children:[e.jsx(He,{asChild:!0,children:e.jsxs(w,{variant:"outline",className:"w-full justify-start gap-3 group hover:bg-accent",children:[e.jsx(Xe,{className:"w-4 h-4 text-destructive"}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Apagar dados por matéria"}),e.jsx("p",{className:"text-xs text-muted-foreground group-hover:text-accent-foreground/80",children:"Apague o histórico de resolução de matérias especÃficas"})]})]})}),e.jsxs(he,{className:"max-w-md max-h-[90vh] flex flex-col",children:[e.jsxs(pe,{className:"flex-1 min-h-0 overflow-hidden",children:[e.jsx(fe,{children:"Apagar seus dados"}),e.jsx(ge,{asChild:!0,children:e.jsxs("div",{className:"space-y-3 overflow-y-auto pr-1 -mr-1 max-h-[calc(90vh-180px)]",children:[e.jsx("p",{children:"Ao excluir seu histórico de resolução, as informações relacionadas à s questões que você já resolveu serão apagadas e não serão mais contabilizados nas seções Desempenho e Evolução."}),e.jsx("p",{className:"text-destructive font-medium",children:"Atenção: Não é possÃvel desfazer essa operação."}),e.jsxs("div",{className:"border border-border rounded-lg p-3 space-y-2",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(ds,{checked:X.length===Ve.length,onCheckedChange:Ma}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"Selecionar todos"})]}),e.jsx(H,{}),Ve.map(s=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(ds,{checked:X.includes(s),onCheckedChange:()=>Fa(s)}),e.jsx("span",{className:"text-sm text-foreground",children:s})]},s))]}),e.jsxs("div",{children:[e.jsx(U,{className:"text-sm text-foreground font-medium",children:"Digite sua senha para continuar:"}),e.jsx(B,{type:"password",value:Ne,onChange:s=>oe(s.target.value),placeholder:"Insira sua senha",className:"mt-1.5"})]})]})})]}),e.jsxs(je,{className:"flex-shrink-0",children:[e.jsx(ve,{children:"Cancelar"}),e.jsxs(w,{onClick:Pa,disabled:X.length===0||!Ne.trim()||V,variant:"destructive",children:[V?e.jsx(F,{className:"w-4 h-4 animate-spin mr-2"}):null,"Apagar meu histórico"]})]})]})]}),e.jsxs(xe,{open:es,onOpenChange:s=>{Pe(s),s||ie("")},children:[e.jsx(He,{asChild:!0,children:e.jsxs(w,{variant:"outline",className:"w-full justify-start gap-3 border-destructive/30 hover:bg-destructive/5",children:[e.jsx(kt,{className:"w-4 h-4 text-destructive"}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium text-destructive",children:"Redefinir todos os dados"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Remove perfil, cadernos, revisões, metas e todo o progresso"})]})]})}),e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsx(fe,{children:"Redefinir todos os dados?"}),e.jsx(ge,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Esta ação é irreversÃvel. Todos os seus dados serão apagados permanentemente, incluindo perfil, cadernos, anotações, revisões, metas e histórico."}),e.jsxs("div",{children:[e.jsx(U,{className:"text-sm text-foreground font-medium",children:"Digite sua senha para continuar:"}),e.jsx(B,{type:"password",value:ne,onChange:s=>ie(s.target.value),placeholder:"Insira sua senha",className:"mt-1.5"})]})]})})]}),e.jsxs(je,{children:[e.jsx(ve,{children:"Cancelar"}),e.jsxs(w,{onClick:Ta,disabled:!ne.trim()||V,variant:"destructive",children:[V?e.jsx(F,{className:"w-4 h-4 animate-spin mr-2"}):null,"Redefinir tudo"]})]})]})]})]})]}),e.jsxs(w,{className:"mt-4 w-full gap-2 bg-primary text-primary-foreground hover:bg-primary/90 font-semibold whitespace-normal h-auto py-2.5",onClick:()=>window.location.reload(),children:[e.jsx(me,{className:"w-4 h-4"}),"Atualizar página para aplicar mudanças"]})]})]})})]})]})}function ue({icon:l,label:a,value:n,editing:m,onChange:x,placeholder:p,inputMode:N,maxLength:R,invalid:A,errorMessage:k}){return e.jsxs("div",{children:[e.jsxs(U,{className:"text-xs text-muted-foreground flex items-center gap-1.5 mb-1.5",children:[e.jsx(l,{className:"w-3.5 h-3.5"})," ",a]}),m?e.jsxs(e.Fragment,{children:[e.jsx(B,{value:n,onChange:E=>x(E.target.value),placeholder:p,inputMode:N,maxLength:R,className:A?"border-destructive focus-visible:ring-destructive":void 0}),A&&k&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:k})]}):e.jsx("p",{className:"text-sm font-medium text-foreground",children:n||"â"})]})}
49export{Fr 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.