import{_ as L}from"./AppTextField.vue_vue_type_script_setup_true_lang-e8a09900.js";import{d as T,l as n,aC as U,k as M,a4 as q,r as F,o as P,b as E,w as t,q as e,n as l,a6 as y,s as a,L as J,ay as x,V as O,x as $,av as G,S as H,H as g,aI as _,bP as Q,b4 as W,W as X,I as b,bQ as Y}from"./index-2e57ee69.js";import{u as k,m as z,a as K}from"./misc-mask-light-8659f0a3.js";import{a as i,V as w}from"./VRow-22fc34ca.js";import{V as Z}from"./VCheckbox-f4762d5d.js";import{V as I}from"./VDivider-29fb9868.js";import{b as S}from"./route-block-83d24a4e.js";import"./VCheckboxBtn-0a0e30be.js";const ee="/assets/auth-v2-register-illustration-bordered-dark-c9ca0f5b.png",ae="/assets/auth-v2-register-illustration-bordered-light-bbf4b217.png",se="/assets/auth-v2-register-illustration-dark-2626622e.png",te="/assets/auth-v2-register-illustration-light-cd143341.png",le={class:"position-relative bg-background rounded-lg w-100 ma-8 me-0"},oe={class:"d-flex align-center justify-center w-100 h-100"},re=l("h5",{class:"text-h5 mb-1"}," Adventure starts here 🚀 ",-1),ne=l("p",{class:"mb-0"}," Make your app management easy and fun! ",-1),ie={class:"d-flex align-center mt-2 mb-4"},ue=l("span",{class:"me-1"},[b(" I agree to "),l("a",{href:"javascript:void(0)",class:"text-primary"},"privacy policy & terms")],-1),de=l("span",null,"Already have an account?",-1),ce=l("span",{class:"mx-4"},"or",-1),me=T({__name:"register",setup(pe){const h=n(),d=n("johnDoe"),c=n("john@example.com"),m=n("john@VUEXY#123"),V=n(!0),v=U(),R=M(),C=q(),D=n({email:void 0,password:void 0}),A=()=>{Y.post("/auth/register",{username:d.value,email:c.value,password:m.value}).then(o=>{const{accessToken:s,userData:u,userAbilities:f}=o.data;return localStorage.setItem("userAbilities",JSON.stringify(f)),C.update(f),localStorage.setItem("userData",JSON.stringify(u)),localStorage.setItem("accessToken",JSON.stringify(s)),R.replace(v.query.to?String(v.query.to):"/"),null}).catch(o=>{const{errors:s}=o.response.data;D.value=s,console.error(o.response.data)})},N=k(te,se,ae,ee,!0),j=k(K,z),p=n(!1),B=()=>{var o;(o=h.value)==null||o.validate().then(({valid:s})=>{s&&A()})};return(o,s)=>{const u=L,f=F("RouterLink");return P(),E(w,{"no-gutters":"",class:"auth-wrapper bg-surface"},{default:t(()=>[e(i,{lg:"8",class:"d-none d-lg-flex"},{default:t(()=>[l("div",le,[l("div",oe,[e(y,{"max-width":"441",src:a(N),class:"auth-illustration mt-16 mb-2"},null,8,["src"])]),e(y,{class:"auth-footer-mask",src:a(j)},null,8,["src"])])]),_:1}),e(i,{cols:"12",lg:"4",class:"d-flex align-center justify-center"},{default:t(()=>[e(J,{flat:"","max-width":500,class:"mt-12 mt-sm-0 pa-4"},{default:t(()=>[e(x,null,{default:t(()=>[e(a(O),{nodes:a($).app.logo,class:"mb-6"},null,8,["nodes"]),re,ne]),_:1}),e(x,null,{default:t(()=>[e(a(G),{ref_key:"refVForm",ref:h,onSubmit:H(B,["prevent"])},{default:t(()=>[e(w,null,{default:t(()=>[e(i,{cols:"12"},{default:t(()=>[e(u,{modelValue:a(d),"onUpdate:modelValue":s[0]||(s[0]=r=>g(d)?d.value=r:null),autofocus:"",rules:[a(_),a(Q)],label:"Username"},null,8,["modelValue","rules"])]),_:1}),e(i,{cols:"12"},{default:t(()=>[e(u,{modelValue:a(c),"onUpdate:modelValue":s[1]||(s[1]=r=>g(c)?c.value=r:null),rules:[a(_),a(W)],label:"Email",type:"email"},null,8,["modelValue","rules"])]),_:1}),e(i,{cols:"12"},{default:t(()=>[e(u,{modelValue:a(m),"onUpdate:modelValue":s[2]||(s[2]=r=>g(m)?m.value=r:null),rules:[a(_)],label:"Password",type:a(p)?"text":"password","append-inner-icon":a(p)?"tabler-eye-off":"tabler-eye","onClick:appendInner":s[3]||(s[3]=r=>p.value=!a(p))},null,8,["modelValue","rules","type","append-inner-icon"]),l("div",ie,[e(Z,{id:"privacy-policy",modelValue:a(V),"onUpdate:modelValue":s[4]||(s[4]=r=>g(V)?V.value=r:null),rules:[a(_)],inline:""},{label:t(()=>[ue]),_:1},8,["modelValue","rules"])]),e(X,{block:"",type:"submit"},{default:t(()=>[b(" Sign up ")]),_:1})]),_:1}),e(i,{cols:"12",class:"text-center text-base"},{default:t(()=>[de,e(f,{class:"text-primary ms-2",to:{name:"login"}},{default:t(()=>[b(" Sign in instead ")]),_:1})]),_:1}),e(i,{cols:"12",class:"d-flex align-center"},{default:t(()=>[e(I),ce,e(I)]),_:1})]),_:1})]),_:1},8,["onSubmit"])]),_:1})]),_:1})]),_:1})]),_:1})}}});typeof S=="function"&&S(me);export{me as default};
