import{cG as $,cm as y,cl as w,ct as T,X as C,cS as o,p as S,bB as U,a3 as a,cV as B,aV as R,c7 as l,a2 as p,c0 as c,W as _,V as k,bj as M,l as N,bO as n,bM as F}from"#entry";import{a as H,V as O}from"./CSNDbwpJ.js";import{V as j}from"./D-zBkYGg.js";import{V as A,b as L}from"./RTCSF0Ks.js";import{V as h}from"./R1_j74h_.js";import{V as f}from"./C2L9cD_h.js";import{V as q}from"./CYzMxp8K.js";import{V as D}from"./BgQ5eU58.js";import{V as E}from"./VoZA954X.js";import"./BbcaTmac.js";import"./D_qxKlPu.js";import"./BKDgfSxC.js";import"./Cp3UUybv.js";import"./DmHQoNBb.js";import"./CEoxYnb5.js";import"./BPHK4Dzs.js";const G=["innerHTML"],re={__name:"register",setup(I){const V=$("settings"),{t:g}=y();w({title:`${V.value.title} - ${g("common.register")}`});const d=n(),v=n(),i=n(!1),r=F({email:"",password:"",description:""}),m=n(!1),{$notify:u}=T(),b=async()=>{if(await d.value.validate()){try{i.value=!0;const e=await $fetch("/api/user/register",{method:"POST",body:r}),s=e&&e.role==="admin"&&e.is_active;u(s?"register.first_user":"register.complete"),M("/")}catch(e){u(e,N.ERROR)}i.value=!1}};return(t,e)=>(U(),C(S,{class:"pa-0 pa-md-3"},{default:o(()=>[a(H,{class:"mt-md-5 ma-0",align:"center",justify:"center"},{default:o(()=>[a(O,{class:"pa-0 pa-md-3",cols:"12",md:"6",lg:"5",xl:"4"},{default:o(()=>[a(j,{ref_key:"form",ref:d,modelValue:l(m),"onUpdate:modelValue":e[3]||(e[3]=s=>R(m)?m.value=s:null),onSubmit:B(b,["prevent"])},{default:o(()=>[a(A,null,{default:o(()=>[a(L,null,{default:o(()=>[p(c(t.$t("common.register")),1)]),_:1}),a(h,null,{default:o(()=>[_("p",{innerHTML:t.$t("register.description")},null,8,G),a(f,{ref_key:"email",ref:v,modelValue:l(r).email,"onUpdate:modelValue":e[0]||(e[0]=s=>l(r).email=s),type:"email",rules:t.$valid.email,label:t.$t("common.email"),autocomplete:"email"},null,8,["modelValue","rules","label"]),a(f,{modelValue:l(r).password,"onUpdate:modelValue":e[1]||(e[1]=s=>l(r).password=s),type:"password",rules:[t.$valid.password],label:t.$t("common.password")},null,8,["modelValue","rules","label"]),a(q,{modelValue:l(r).description,"onUpdate:modelValue":e[2]||(e[2]=s=>l(r).description=s),rules:[t.$valid.required(t.$t("common.description"))],label:t.$t("common.description")},null,8,["modelValue","rules","label"])]),_:1}),a(D,null,{default:o(()=>[a(E),a(k,{type:"submit",variant:"outlined","append-icon":"mdi-chevron-right",disabled:!l(m)||l(i),loading:l(i),color:"primary"},{default:o(()=>[p(c(t.$t("common.send")),1)]),_:1},8,["disabled","loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}))}};export{re as default};
