1import{u as T,a as O,b as R,c as U,r as i,j as e,L as _,S as V,p as W,z as u,e as q,E as D}from"./index-C-TaAGmN.js";function H(){const d=T(),[C]=O(),{completeRegistration:k}=R(),{t:S}=U("common"),r=(t,s)=>S(`chrome.auth.${t}`,s),p=C.get("token"),[c,L]=i.useState(""),[a,E]=i.useState(""),[n,P]=i.useState(""),[x,I]=i.useState(!1),[h,M]=i.useState(!1),[g,l]=i.useState(""),[f,b]=i.useState(!1),w=t=>({minLength:t.length>=8,hasUpperCase:/[A-Z]/.test(t),hasLowerCase:/[a-z]/.test(t),hasNumber:/[0-9]/.test(t),hasSpecialChar:/[!@#$%^&*(),.?":{}|<>]/.test(t)}),v=t=>{const s=w(t);return s.minLength&&s.hasUpperCase&&s.hasLowerCase&&s.hasNumber&&s.hasSpecialChar},A=async t=>{if(t.preventDefault(),l(""),!c.trim()||c.trim().length<2){l(r("complete_registration.error.name_too_short","Nome deve ter no mÃnimo 2 caracteres"));return}if(!v(a)){l(r("complete_registration.error.password_invalid","A senha não atende todos os requisitos"));return}if(a!==n){l(r("complete_registration.error.passwords_mismatch","As senhas não conferem"));return}if(!p){l(r("complete_registration.error.invalid_token","Token inválido. Solicite um novo link de cadastro."));return}b(!0);try{const s=await k(p,c.trim(),a),y=localStorage.getItem("pendingInvite");if(y)try{const m=JSON.parse(y),B=await W.join({inviteCode:m.code,userExternalId:s.externalId,referrerExternalId:m.ref});localStorage.removeItem("pendingInvite");const z=r("toast.welcome","Bem-vindo, {{name}}!").replace("{{name}}",s.name),$=r("toast.joined_pool",'Você entrou no bolão "{{name}}"! ð').replace("{{name}}",B.name);u.success(`${z} ${$}`)}catch(m){(q(m)===D.ALREADY_POOL_MEMBER||m.response?.data?.message?.includes("já é membro"))&&localStorage.removeItem("pendingInvite"),u.success(r("toast.welcome","Bem-vindo, {{name}}!").replace("{{name}}",s.name))}else u.success(r("toast.welcome","Bem-vindo, {{name}}!").replace("{{name}}",s.name));const N=localStorage.getItem("redirectAfterLogin");N?(localStorage.removeItem("redirectAfterLogin"),d(N,{replace:!0})):d("/boloes",{replace:!0})}catch(s){l(s.message||r("complete_registration.error.submit_failed","Erro ao completar cadastro. Tente novamente."))}finally{b(!1)}};if(!p)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary-50 via-white to-primary-100 px-4",children:e.jsxs("div",{className:"max-w-md w-full text-center space-y-6",children:[e.jsx(_,{size:"xl",showText:!1}),e.jsxs("div",{className:"bg-white p-8 rounded-2xl shadow-xl space-y-4",children:[e.jsx("div",{className:"mx-auto w-16 h-16 bg-red-100 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("h2",{className:"text-xl font-bold text-gray-900",children:r("complete_registration.invalid_link.title","Link inválido")}),e.jsx("p",{className:"text-sm text-gray-600",children:r("complete_registration.invalid_link.body","Este link de cadastro é inválido ou expirou. Solicite um novo link.")}),e.jsx("button",{onClick:()=>d("/auth"),className:"w-full py-3 px-4 rounded-xl text-base font-semibold text-white bg-gradient-to-r from-primary-600 to-primary-700 hover:from-primary-700 hover:to-primary-800 transition-all duration-200",children:r("complete_registration.invalid_link.back","Voltar para o inÃcio")})]})]})});const o=w(a),j=({show:t,onToggle:s})=>e.jsx("button",{type:"button",onClick:s,className:"absolute inset-y-0 right-0 px-4 flex items-center text-gray-400 hover:text-primary-600 transition-colors",tabIndex:-1,"aria-label":t?r("aria.hide_password","Ocultar senha"):r("aria.show_password","Mostrar senha"),children:t?e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})}):e.jsxs("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})});return e.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary-50 via-white to-primary-100 px-4",children:[e.jsx(V,{title:r("complete_registration.seo.title","Completar Cadastro | Bolão Elite"),description:r("complete_registration.seo.description","Defina seu nome e senha para acessar o Bolão Elite."),noIndex:!0}),e.jsxs("div",{className:"max-w-md w-full space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-3",children:e.jsx(_,{size:"xl",showText:!1})}),e.jsx("h1",{className:"text-3xl sm:text-4xl font-bold bg-gradient-to-r from-primary-600 to-primary-800 bg-clip-text text-transparent",children:"Bolão Elite"})]}),e.jsxs("div",{className:"bg-white p-6 sm:p-8 rounded-2xl shadow-xl",children:[e.jsx("h2",{className:"text-xl font-bold text-gray-900 mb-1",children:r("complete_registration.title","Complete seu cadastro")}),e.jsx("p",{className:"text-sm text-gray-500 mb-6",children:r("complete_registration.subtitle","Escolha seu nome e crie uma senha.")}),g&&e.jsx("div",{className:"bg-red-50 border-l-4 border-red-500 text-red-700 px-4 py-3 rounded-lg text-sm mb-5",children:g}),e.jsxs("form",{onSubmit:A,className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-semibold text-gray-700 mb-2",children:r("complete_registration.label.name","Nome")}),e.jsx("input",{id:"name",type:"text",autoFocus:!0,required:!0,value:c,onChange:t=>L(t.target.value),className:"block w-full px-4 py-3 border border-gray-300 rounded-xl shadow-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent transition-all duration-200 hover:border-primary-300",placeholder:r("complete_registration.placeholder.name","Seu nome")}
1)]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"reg-password",className:"block text-sm font-semibold text-gray-700 mb-2",children:r("label.password","Senha")}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:"reg-password",type:x?"text":"password",autoComplete:"new-password",required:!0,value:a,onChange:t=>E(t.target.value),className:"block w-full px-4 py-3 pr-12 border border-gray-300 rounded-xl shadow-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent transition-all duration-200 hover:border-primary-300",placeholder:r("complete_registration.placeholder.password_min","MÃnimo 8 caracteres")}),e.jsx(j,{show:x,onToggle:()=>I(!x)})]}),a&&e.jsxs("div",{className:"mt-2 space-y-1",children:[e.jsxs("p",{className:`text-xs flex items-center gap-1 ${o.minLength?"text-green-600":"text-red-600"}`,children:[o.minLength?"â":"â"," ",r("complete_registration.rule.min_length","MÃnimo 8 caracteres")]}),e.jsxs("p",{className:`text-xs flex items-center gap-1 ${o.hasUpperCase?"text-green-600":"text-red-600"}`,children:[o.hasUpperCase?"â":"â"," ",r("complete_registration.rule.upper","Pelo menos uma letra maiúscula")]}),e.jsxs("p",{className:`text-xs flex items-center gap-1 ${o.hasLowerCase?"text-green-600":"text-red-600"}`,children:[o.hasLowerCase?"â":"â"," ",r("complete_registration.rule.lower","Pelo menos uma letra minúscula")]}),e.jsxs("p",{className:`text-xs flex items-center gap-1 ${o.hasNumber?"text-green-600":"text-red-600"}`,children:[o.hasNumber?"â":"â"," ",r("complete_registration.rule.number","Pelo menos um número")]}),e.jsxs("p",{className:`text-xs flex items-center gap-1 ${o.hasSpecialChar?"text-green-600":"text-red-600"}`,children:[o.hasSpecialChar?"â":"â"," ",r("complete_registration.rule.special","Pelo menos um caractere especial (@$!%*?&)")]})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"reg-confirm-password",className:"block text-sm font-semibold text-gray-700 mb-2",children:r("complete_registration.label.confirm_password","Confirmar senha")}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:"reg-confirm-password",type:h?"text":"password",autoComplete:"new-password",required:!0,value:n,onChange:t=>P(t.target.value),className:"block w-full px-4 py-3 pr-12 border border-gray-300 rounded-xl shadow-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent transition-all duration-200 hover:border-primary-300",placeholder:r("complete_registration.placeholder.confirm_password","Digite a senha novamente")}),e.jsx(j,{show:h,onToggle:()=>M(!h)})]}),n&&a!==n&&e.jsx("p",{className:"mt-2 text-xs text-red-600",children:r("complete_registration.error.passwords_mismatch","As senhas não conferem")}),n&&a===n&&e.jsxs("p",{className:"mt-2 text-xs text-green-600",children:["â ",r("complete_registration.passwords_match","As senhas conferem")]})]}),e.jsx("button",{type:"submit",disabled:f||!v(a)||a!==n||!c.trim(),className:"w-full flex justify-center py-3.5 px-4 border border-transparent rounded-xl shadow-lg text-base font-semibold text-white bg-gradient-to-r from-primary-600 to-primary-700 hover:from-primary-700 hover:to-primary-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 disabled:opacity-50 disabled:cursor-not-allowed transform transition-all duration-200 hover:scale-[1.02] active:scale-[0.98]",children:f?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r("complete_registration.creating","Criando conta...")]}):r("complete_registration.submit","Criar conta")})]})]})]})]})}export{H as CompleteRegistration}; 2//# sourceMappingURL=CompleteRegistration-BEhh4R-E.js.map
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.