const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./WebSystemOutageMessaging-Bgu_KZv9.mjs","./C8VztkeY.js","./entry.BR7GDKKL.css","./WebSystemOutageMessaging.Cd-9fIgR.css"])))=>i.map(i=>d[i]);
import{_ as x,u as N,by as c,h as f,bT as S,ak as T,o as u,b as P,c as y,d as n,s as b,a as r,p as l,q as m,l as B,N as q,M as D,aa as M,y as O,f as R,bY as I,b8 as L,bZ as A,Q as U,K as W,L as $}from"./C8VztkeY.js";const z=W(()=>$(()=>import("./WebSystemOutageMessaging-Bgu_KZv9.mjs"),__vite__mapDeps([0,1,2,3]),import.meta.url).then(e=>e.default||e)),K={props:{membership:{type:Object},fromGate:{type:Boolean,default:!1}},async setup(){const{$gql:e}=N(),s=await e.query("getReCAPTCHAPublicKey");return{tenantRecaptchaPublicKey:s==null?void 0:s.data}},data(){return{signupValues:{username:"",locale:{countryCode:null,region:null,compliance:!1}},error:null,message:null,showErrors:!1,signupErrors:{},recaptcha:null,processing:!1,userExists:!1,showForm:!0}},computed:{submitDisabled(){return!this.signupValues.username||!this.signupValues.locale},signupFieldInfo(){return{rows:[{fields:{username:{type:"email_input",label:"Email",placeholder:"Enter Email",required:!0,disabled:this.processing,showErrors:this.showErrors,icon:!1},locale:{type:"locale",required:!0,disabled:this.processing,showErrors:this.showErrors}}}]}},freeMembership(){return this.membership.isFree}},async mounted(){var e;c.isLoggedIn()&&(window.location=((e=f().query)==null?void 0:e.redirectTo)??"/"),this.recaptcha=S(this.tenantRecaptchaPublicKey)},methods:{update(e,s,t){this.signupValues[e]=s,this.signupErrors[e]={errorObj:t}},submitForm(){this.showErrors=T(this.signupErrors??{})>0},login(){return c.getLoginLink()},async handleSubmit(){const{hash:e}=f();try{if(this.error="",this.showErrors)throw new Error("Please correct the issues with this form");this.processing=!0;const s=await this.recaptcha("siteUserRequestMembership");let t=`${window.location.search.substring(1)}${e}`;t=t.replace("redirectTo=","");const a=await c.requestSignup(this.signupValues.username,this.membership.id,this.signupValues.locale.countryCode,this.signupValues.locale.region,this.signupValues.locale.compliance,t,s);if(a!=null&&a.error)if(a.message.includes("User already exists"))this.userExists=!0;else throw new Error(a.message);else this.showForm=!1,this.message=`You're almost done! Check your email and click the link to complete your subscription. <br /><br /> The confirmation email will come from Endeavor Business Media, (${this.$ss.memberships.fromEmail}).`,setTimeout(()=>{c.hideMembershipOverview()},5e3),this.fromGate&&setTimeout(()=>{location.reload()},5e3);this.processing=!1}catch(s){this.error=s,this.processing=!1}}}},G={class:"signup-form"},H={key:0,class:"user-exists"},Y=["href"],j={class:"submit"},Q={class:"links"},Z=["href"];function J(e,s,t,a,i,o){var p,d;const w=z,v=R,E=I,F=L,k=A,V=U;return(p=e.$ss.systemOutage)!=null&&p.disableOmeda?(u(),P(w,{key:0})):(u(),y("div",{key:1,class:O(["membership-signup",(d=e.$ss)!=null&&d.useNewDesign?"new-design":""]),style:l({fontFamily:e.$ss.primaryFontFamily})},[n(V,null,{default:b(()=>{var h,g;return[r("div",G,[r("div",{class:"form-preface",style:l({margin:(h=e.$ss)!=null&&h.useNewDesign?"calc(var(--spacing)/2) calc(var(--spacing)/2) 0 calc(var(--spacing)/2)":"15px"})},[r("h2",{style:l({color:(g=e.$ss)!=null&&g.useNewDesign?"var(--color-black)":e.$ss.baseStyles.primaryColor,fontFamily:e.$ss.primaryFontFamily})}," Let's get started ",4),r("div",{class:"sub-text",style:l({fontFamily:e.$ss.primaryFontFamily})}," Create an account to start your membership. ",4)],4),n(k,{error:i.error,message:i.message,processing:i.processing,padding:"0",class:"form-wrapper"},{default:b(()=>{var _;return[i.userExists?(u(),y("div",H,[n(v,{icon:"mdi:alert","icon-color":"34a853",class:"icon",width:16}),s[1]||(s[1]=m(" An account was found for this email. Please   ")),r("a",{href:o.login()},"login or reset your password",8,Y)])):B("",!0),q(r("form",{class:"form",onSubmit:s[0]||(s[0]=D((...C)=>o.handleSubmit&&o.handleSubmit(...C),["prevent"]))},[n(E,{"field-info":o.signupFieldInfo,"field-values":i.signupValues,onUpdate:o.update},null,8,["field-info","field-values","onUpdate"]),r("div",j,[r("div",Q,[r("a",{href:o.login()},"I already have an account",8,Z)]),n(F,{label:"Register",disabled:o.submitDisabled,type:"submit",onOnClick:o.submitForm},null,8,["disabled","onOnClick"])])],544),[[M,i.showForm]]),r("div",{class:"consent",style:l({backgroundColor:(_=e.$ss)!=null&&_.useNewDesign?"":"#f0f0f0"})},s[2]||(s[2]=[m(" By creating an account, you are agreeing to Endeavor Business Media's "),r("a",{href:"https://www.endeavorbusinessmedia.com/endeavor-terms",target:"_blank",rel:"noopener"},"Terms of Service",-1),m(" and "),r("a",{href:"https://www.endeavorbusinessmedia.com/privacy-policy",target:"_blank",rel:"noopener"},"Privacy Policy",-1)]),4)]}),_:1},8,["error","message","processing"])])]}),_:1})],6))}const ee=x(K,[["render",J],["__scopeId","data-v-d82e4778"]]);export{ee as _};