import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{B_ as t,Cv as n,Gn as r,Gy as i,Hy as a,Ln as o,Sv as s,Zv as c,bv as l,ch as u,dg as d,dv as f,fv as p,hl as m,m_ as h,mv as g,pv as _,sh as v,ty as y,wv as b,xv as x}from"./index-DDwwBb9e.js";var S=e(i()),C=a(),w=e=>e?e===`email_doesn't_match`||e===`LINKING_DIFFERENT_EMAILS_NOT_ALLOWED`?`DIFFERENT_EMAIL_NOT_ALLOWED`:e===`account_already_linked_to_different_user`||e===`account_not_linked`||e===`OAuthAccountNotLinked`?`OAuthAccountNotLinked`:e:null;function T(){let{data:e}=v(),t=w(r()?.get(`error`)),n=u(),i=n.data?.NEXTAUTH_PROVIDER===`auth0`,a=n.data?.NEXTAUTH_PROVIDER===`azure-ad`;return(0,S.useEffect)(()=>{n.data&&(t&&[`DIFFERENT_EMAIL_NOT_ALLOWED`,`OAuthAccountNotLinked`,`SSO_PROVIDER_NOT_ALLOWED`].includes(t)||setTimeout(()=>{if(typeof window<`u`&&typeof document<`u`)if(i){let e=document.referrer;e?.startsWith(window.location.origin)?window.location.href=e:window.location.href=`/`}else window.location.href=`/auth/signin`},5e3))},[n.data,i,a,e,t]),t?(0,C.jsx)(E,{error:t}):(0,C.jsxs)(`div`,{style:{padding:`12px`},children:[`Auth Error: Redirecting back to Sign in... Click `,(0,C.jsx)(`a`,{href:`/`,children:`here`}),` if you are not redirected within 5 seconds.`]})}function E({error:e}){let i=r()?.get(`callbackUrl`)??void 0,a=w(e)??e;return(0,C.jsx)(t,{maxW:`container.md`,paddingTop:`calc(40vh - 164px)`,children:(0,C.jsxs)(_,{children:[(0,C.jsx)(p,{children:(0,C.jsxs)(h,{gap:4,children:[(0,C.jsx)(o,{width:30.69,height:42}),(0,C.jsx)(y,{size:`lg`,as:`h1`,children:`Sign in Error`})]})}),(0,C.jsx)(f,{children:(0,C.jsxs)(n,{status:a===`OAuthAccountNotLinked`?`warning`:`error`,children:[(0,C.jsx)(s,{}),(0,C.jsxs)(l,{gap:4,children:[(0,C.jsx)(b,{fontWeight:`bold`,children:a===`OAuthAccountNotLinked`?`Account already exists`:a}),a===`OAuthAccountNotLinked`?(0,C.jsx)(x,{children:(0,C.jsxs)(d,{gap:1,align:`start`,children:[(0,C.jsxs)(c,{children:[`An account with this email already exists but was created with a different sign-in method (e.g. Google, GitHub).`,(0,C.jsx)(`br`,{}),(0,C.jsx)(`br`,{}),`To link this method, sign in with the method you used originally, then go to`,` `,(0,C.jsx)(`b`,{children:`Settings > Authentication`}),` to link additional sign-in methods.`]}),(0,C.jsx)(g,{asChild:!0,marginTop:4,color:`white`,children:(0,C.jsx)(m,{href:`/auth/signin`,children:`Sign in with another method`})})]})}):a===`DIFFERENT_EMAIL_NOT_ALLOWED`?(0,C.jsx)(x,{children:(0,C.jsxs)(d,{gap:1,align:`start`,children:[(0,C.jsx)(c,{children:`You cannot link an account with a different email address. Please use the same email address as your current account.`}),(0,C.jsx)(g,{asChild:!0,marginTop:4,color:`white`,children:(0,C.jsx)(m,{href:`/settings/authentication`,children:`Back to Settings`})})]})}):a===`SSO_PROVIDER_NOT_ALLOWED`?(0,C.jsx)(x,{children:(0,C.jsxs)(d,{gap:1,align:`start`,children:[(0,C.jsx)(c,{children:`Your organization requires SSO login. Please go back and sign in by entering your company email address in the login form.`}),(0,C.jsx)(g,{asChild:!0,marginTop:4,color:`white`,children:(0,C.jsx)(m,{href:`/`,children:`Back to Login`})})]})}):(0,C.jsxs)(x,{children:[`Redirecting back to sign in, please try again...`,(0,C.jsx)(`br`,{}),(0,C.jsx)(g,{asChild:!0,marginTop:4,color:`white`,children:(0,C.jsx)(m,{href:`/auth/signin${i?`?callbackUrl=${encodeURIComponent(i)}`:``}`,children:`Try Sign In Again`})})]})]})]})})]})})}export{E as SignInError,T as default,w as normalizeErrorCode};
//# sourceMappingURL=error-DNmmfsZh.js.map