import{_ as Z,k as J,x as K,l as Q,j as W,a as v,y as X,z as ee,m as T,A as ae,C as se,o as oe,c as te,d as e,t as R,e as t,g as f,n as z,B as g,w as y,D as q,f as n,u as o,q as d,s as le,I as B,p as re,i as ie}from"./index-4e8c1b57.js";import{u as ne}from"./vue.f36acd1f-b96688a7.js";import{B as c}from"./BaseInput-1a25812b.js";import{B as de}from"./BaseCheckbox-dff8834d.js";import{_ as ue,G as pe}from"./Turnstile-7971e28c.js";import{u as ce,c as me,a as m,d as ve,e as fe,b as u}from"./index.esm-1201bb6a.js";import"./load-script-8d839500.js";import"./BaseRadio-a051ce67.js";/* empty css                                                                  */const l=_=>(re("data-v-2768f539"),_=_(),ie(),_),_e={class:"main"},he={class:"role-prompt"},we={class:"role-selection"},ge={class:"eu-prompt"},ye=l(()=>e("span",{class:"fwt-700"},"It looks like you are from the European Union (or somewhere close to the EU)!",-1)),be=l(()=>e("a",{href:"https://eu.findingfive.com"},"EU Server",-1)),Ve={class:"signup-section"},Se=l(()=>e("div",{class:"or"}," or ",-1)),ke={id:"signup-form"},Ue={class:"name-row"},Pe=l(()=>e("label",{for:"given-name",class:"label"},"Given name",-1)),xe=l(()=>e("label",{for:"middle-name",class:"label"},"Middle name",-1)),Ae=l(()=>e("label",{for:"family-name",class:"label"},"Family name",-1)),Ie=l(()=>e("label",{for:"email",class:"label"},"Email",-1)),Ee=l(()=>e("label",{for:"password",class:"label"},"Password",-1)),qe=l(()=>e("label",{for:"repeat-password",class:"label"},"Type the above password again",-1)),Be=l(()=>e("a",{href:"https://help.findingfive.com/tos.html"},"Terms of Service",-1)),$e=l(()=>e("a",{href:"https://help.findingfive.com/privacy.html"},"Privacy Policy",-1)),Ce=l(()=>e("span",null,"Sign up",-1)),Fe=`<ul>
    <div>Make sure your password contains:</div>
    <li>A mix of upper- and lowercase letters</li>
    <li>At least one digit and one punctuation</li>
    <li>At least 8 characters</li>
  </ul>`,Te={__name:"SignupView",setup(_){ne({title:"Participate in behavioral research studies on FindingFive!",meta:[{name:"description",content:"Join the community of FindingFive by signing up as a participant or researcher."}]});const h=J(),$=K(),D=Q(),M=W(),w=v(""),G="0x4AAAAAAABn_fBa7iPmz2kb",C=v(null),r=v(localStorage.getItem("ff_user_part")||"");X(r,p=>{localStorage.setItem("ff_user_part",p.trim())});const F=v("US");j();async function j(){F.value=await ee()}const N=T(()=>F.value==="EU"),H=T(()=>window.location.hostname==="eu.findingfive.com"),b=v(!1),{errors:i,handleSubmit:L,isSubmitting:Re}=ce({validationSchema:me({first_name:m().required().max(50).label("Given name"),middle_initial:m().optional().max(50).label("Middle name"),last_name:m().required().max(50).label("Last name"),email:m().email().required().label("Email"),password:m().required().matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,100}$/,"This is not a valid password").label("Password"),repeat_password:m().required("Please retype your password").oneOf([ve("password")],"Passwords do not match"),tos_and_pp:fe().required("You must agree to the Terms of Service and Privacy Policy")})}),{value:V}=u("first_name"),{value:S}=u("middle_initial"),{value:k}=u("last_name"),{value:U}=u("email"),{value:P}=u("password"),{value:x}=u("repeat_password"),{value:A}=u("tos_and_pp"),O=L(async(p,a)=>{if(!w.value){h.pop("You must pass the recaptcha test first","error",2e3);return}$.disablePage(),h.pop("Please wait ...","loading");const I={invitation_code:"EKL2QD80",role:r.value,turnstile_token:w.value,...p},s=await ae(I);if(s.ok)h.remove(),M.push(D.redirectUrl);else{C.value.reset();let E="Unexpected error occurred. Please try again later";if(s.status==400){const Y=await s.json();a.setErrors(Y),E="Please double-check the highlighted fields"}else s.status<500&&(E=(await s.json()).response);await h.pop(E,"error",2e3)}$.disablePage(!0)});return(p,a)=>{const I=se("tippy");return oe(),te("main",_e,[e("div",null,[e("div",he,R(p.$t("signup-role-prompt")),1),e("div",we,[t(g,{class:z(["choice participant",{selected:r.value==="participant"}]),onClick:a[0]||(a[0]=s=>r.value="participant")},{default:f(()=>[t(o(B),{icon:"fa6-solid:user",inline:"true",class:"icon"}),n("Participant ")]),_:1},8,["class"]),t(g,{class:z(["choice researcher",{selected:r.value==="researcher"}]),onClick:a[1]||(a[1]=s=>r.value="researcher")},{default:f(()=>[t(o(B),{icon:"fa6-solid:user-graduate",inline:"true",class:"icon"}),n("Researcher ")]),_:1},8,["class"])])]),y(e("div",ge,[ye,n(" We highly recommend using our "),be,n(" for a faster experience and if your participant data need to be stored in the EU. Please note that your EU server account will not work on the US server (where you are now). ")],512),[[q,r.value==="researcher"&&N.value&&!H.value]]),y(e("section",Ve,[e("div",null,[t(pe,{width:330})]),Se,t(g,{class:"direct-signup-btn",onClick:a[2]||(a[2]=s=>b.value=!b.value)},{default:f(()=>[n(R(p.$t("direct-signup-btn")),1)]),_:1}),y(e("form",ke,[e("div",Ue,[e("div",null,[Pe,t(c,{type:"text",id:"given-name",placeholder:"(required)",modelValue:o(V),"onUpdate:modelValue":a[3]||(a[3]=s=>d(V)?V.value=s:null),error:o(i).first_name},null,8,["modelValue","error"])]),e("div",null,[xe,t(c,{type:"text",id:"middle-name",placeholder:"(optional)",modelValue:o(S),"onUpdate:modelValue":a[4]||(a[4]=s=>d(S)?S.value=s:null),error:o(i).middle_initial},null,8,["modelValue","error"])]),e("div",null,[Ae,t(c,{type:"text",id:"family-name",placeholder:"(required)",modelValue:o(k),"onUpdate:modelValue":a[5]||(a[5]=s=>d(k)?k.value=s:null),error:o(i).last_name},null,8,["modelValue","error"])])]),e("div",null,[Ie,t(c,{type:"email",id:"email",placeholder:"(required)",modelValue:o(U),"onUpdate:modelValue":a[6]||(a[6]=s=>d(U)?U.value=s:null),modelModifiers:{lazy:!0},error:o(i).email},null,8,["modelValue","error"])]),e("div",null,[Ee,y(t(c,{type:"password",id:"password",placeholder:"(required)",modelValue:o(P),"onUpdate:modelValue":a[7]||(a[7]=s=>d(P)?P.value=s:null),error:o(i).password},null,8,["modelValue","error"]),[[I,Fe]])]),e("div",null,[qe,t(c,{type:"password",id:"repeat-password",placeholder:"(required)",modelValue:o(x),"onUpdate:modelValue":a[8]||(a[8]=s=>d(x)?x.value=s:null),error:o(i).repeat_password},null,8,["modelValue","error"])]),e("div",null,[t(de,{modelValue:o(A),"onUpdate:modelValue":a[9]||(a[9]=s=>d(A)?A.value=s:null),error:o(i).tos_and_pp},{default:f(()=>[n("I have read and agree to the "),Be,n(" and "),$e]),_:1},8,["modelValue","error"])]),t(ue,{ref_key:"cfTurnstile",ref:C,modelValue:w.value,"onUpdate:modelValue":a[10]||(a[10]=s=>w.value=s),sitekey:o(G)},null,8,["modelValue","sitekey"]),t(g,{type:"submit",variant:"main",id:"signup-button",onClick:le(o(O),["prevent"])},{default:f(()=>[t(o(B),{icon:"uiw:login",inline:"true"}),Ce]),_:1},8,["onClick"])],512),[[q,r.value&&b.value]])],512),[[q,r.value]])])}}},Ye=Z(Te,[["__scopeId","data-v-2768f539"]]);export{Ye as default};