1import{t as s,a as i}from"./ClnHdtQV.js";import{u as l,l as u,m as d,n as c,b as v,f as g,j as p}from"./ZPaimFvj.js";import{m}from"./BBtaoddy.js";import{emailRegex as y,passwordRegex as h}from"./BzQM-gab.js";const b=e=>{const{$toast:r}=l(),n=()=>e.value.email.trim()?y.test(e.value.email)?e.value.password.trim()?h.test(e.value.password)?!e.value.firstName||!e.value.lastName?"Please enter the firstName and lastName":e.value.verifyCode?null:"Please enter the correct verify code":"Password can only contain letters, numbers and special characters and length must be 6-20":"Password can not be empty":"Incorrectly formed email":"Email can not be empty";return{handleRegister:async()=>{const a=n();if(a){r.error(a),s("register_error",{error_type:"validation",error_message:a});return}const t=await $fetch("/gateway/user/user/register",{method:"POST",body:{firstName:e.value.firstName,lastName:e.value.lastName,email:e.value.email,code:e.value.verifyCode,password:m(e.value.password),invitationCode:e.value.invitationCode,source:c(),ag:d(),landingPageType:u()}}).catch(o=>{console.log(o)});t?.code===0?(i("kcoZCMissu4aENSmhLE_"),s("sign_up",{method:"email"}),r.success("Account apply success!"),v(t.data.token),g(t.data),p()):(s("register_error",{error_type:"server",error_message:t?.message}),r.error(t?.message||"Server error"))}}};export{b as useRegister};
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.