import{u as U,c as s,d as I,e as R,j as O,W,P as k,f as L}from"./index-Bsr9DJ3G.js";import{r as g}from"./vendor-DJo4KD8w.js";import{u as M,L as $}from"./routing-DCIgrT7s.js";import{u as x}from"./i18n-BbpF47i1.js";function B(){var h;const{t:A}=x(),e=(r,p)=>A(`AuthWelcome.${r}`,p),n=U(),T=s(n.activeKbId$),t=s(n.activeSession$),c=s(t==null?void 0:t.user$)??null,d=(t==null?void 0:t.kb)??null,u=!!c,a=T!=null&&t==null,f=r=>{n.signOut(r)},o=M(),[y,v]=g.useState(!1),S=I(),w=t==null?void 0:t.client,l=R(()=>L(w)),i=s(l.userData$),P=s(l.isProcessing$)??!1;g.useEffect(()=>{if(!a){if(!u){o.push("/auth/connect");return}if(i!=null&&i.termsAcceptedAt){o.push("/");return}}},[a,u,o,i]);const m=async r=>{if(!r){d&&f(d.id),o.push("/");return}try{await l.acceptTerms(),v(!0),setTimeout(()=>{o.push("/")},1e3)}catch(p){console.error("Terms acceptance error:",p),S.showError(e("errorAcceptingTerms"))}},C=a?"loading":y?"accepted":"form",b=((h=c==null?void 0:c.name)==null?void 0:h.split(" ")[0])??"";return O.jsx(W,{userName:b,termsAcceptedAt:(i==null?void 0:i.termsAcceptedAt)??null,isNewUser:!(i!=null&&i.termsAcceptedAt),status:C,isProcessing:P,onAccept:()=>m(!0),onDecline:()=>m(!1),translations:{loading:e("loading"),welcomeTitle:e("welcomeTitle"),thanksForAccepting:e("thanksForAccepting"),welcomeUser:e("welcomeUser",{firstName:b}),reviewTermsPrompt:e("reviewTermsPrompt"),termsSummaryTitle:e("termsSummaryTitle"),termsSummaryIntro:e("termsSummaryIntro"),acceptableUseTitle:e("acceptableUseTitle"),acceptableUseResponsible:e("acceptableUseResponsible"),acceptableUseRespect:e("acceptableUseRespect"),acceptableUseConduct:e("acceptableUseConduct"),prohibitedContentTitle:e("prohibitedContentTitle"),prohibitedContentIntro:e("prohibitedContentIntro"),prohibitedIllegal:e("prohibitedIllegal"),prohibitedAdult:e("prohibitedAdult"),prohibitedHate:e("prohibitedHate"),prohibitedViolence:e("prohibitedViolence"),prohibitedMisinformation:e("prohibitedMisinformation"),prohibitedPrivacy:e("prohibitedPrivacy"),prohibitedCopyright:e("prohibitedCopyright"),prohibitedMalware:e("prohibitedMalware"),prohibitedSpam:e("prohibitedSpam"),conductTitle:e("conductTitle"),conductDescription:e("conductDescription"),conductLink:e("conductLink"),conductPromotion:e("conductPromotion"),responsibilitiesTitle:e("responsibilitiesTitle"),responsibilitiesSecure:e("responsibilitiesSecure"),responsibilitiesReport:e("responsibilitiesReport"),responsibilitiesAccurate:e("responsibilitiesAccurate"),responsibilitiesComply:e("responsibilitiesComply"),violationsWarning:e("violationsWarning"),readFullTerms:e("readFullTerms"),termsOfService:e("termsOfService"),and:e("and"),privacyPolicy:e("privacyPolicy"),declineAndSignOut:e("declineAndSignOut"),acceptAndContinue:e("acceptAndContinue"),processing:e("processing"),legallyBound:e("legallyBound")},PageLayout:k,Link:$})}export{B as default};
//# sourceMappingURL=page-BMeXKClk.js.map
