1import{_ as q}from"./DHB-WuvP.js";import{r as o,E as J,c as d,a as t,d as v,b as V,w as F,j as c,k as s,t as h,G,z as Q,A,H as P,D as x,C as X,i as Y,y as Z,o as p}from"./DmI-g1TT.js";import{_ as W}from"./D_YgPpF0.js";import{_ as ee}from"./CJO7dE1w.js";import{s as te}from"./x_rD_Ya3.js";const se={class:"flex items-center justify-center bg-gradient-to-br from-gray-900 via-purple-900 to-gray-900 mb-8 px-4 sm:px-6 lg:px-8"},ae={class:"max-w-md w-full space-y-6"},re={class:"text-center"},oe={class:"mt-2 text-sm text-gray-400"},ne={class:"bg-gray-800/50 backdrop-blur-xl rounded-2xl shadow-2xl border border-gray-700/50 p-8"},le={key:0,class:"mb-6"},ie={class:"flex items-center justify-between"},ue={class:"flex items-center"},de={class:"w-8 h-8 rounded-full bg-purple-600 flex items-center justify-center text-white text-sm"},pe={class:"ml-3"},ce={class:"text-sm font-medium text-white"},me={class:"mt-4 h-1 w-full bg-gray-700 rounded-full overflow-hidden"},fe={key:1},ge={class:"relative"},ve={class:"relative"},he={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},xe={class:"relative"},be={class:"relative"},ke={class:"flex items-start space-x-3"},ye=["disabled"],we={key:0,class:"mr-3"},_e={key:0,class:"p-4 bg-red-500/10 border border-red-500/20 rounded-xl"},je={class:"flex items-center"},Ce={class:"text-sm text-red-400"},Ae={key:2,class:"space-y-6"},Te={class:"text-center mb-6"},Ve={class:"text-gray-400 text-sm"},Pe={class:"text-white font-medium"},Se={class:"text-center"},Oe={class:"text-sm text-gray-400"},Me=["disabled"],Ne=["disabled"],Be={key:0,class:"mr-3"},We={key:0,class:"p-4 bg-red-500/10 border border-red-500/20 rounded-xl"},Ke={class:"flex items-center"},$e={class:"text-sm text-red-400"},ze={key:3,class:"space-y-6 text-center"},qe={__name:"register",setup(Ie){const j=o(""),m=o(""),w=o(""),b=o(""),C=o(""),k=o(""),_=o(""),S=o(""),T=o(!1),K=o(null),f=o(""),l=o(""),y=o(0),i=o(0),$=["Verifikasi WhatsApp","Selesai"],u=o(!1),n=o(""),z=Z(),O=J().public.baseAPI,I=a=>{_.value="",/^\d{6}$/.test(a)||(_.value="PIN harus berupa 6 digit angka")},H=a=>{K.value=a,S.value="",console.log("Selected country:",a)},R=async()=>{var a;if(n.value="",_.value="",!!U()){u.value=!0;try{const e=await fetch(`${O}/account/register`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({name:j.value,noHp:m.value,email:w.value,password:b.value,password_confirmation:C.value,pin:k.value})}),g=await e.json();e.ok?(i.value=1,N()):g.message?n.value=g.message:g.errors?n.value=(a=g.errors)==null?void 0:a.map(r=>`${r.field}: ${r.message}`).join(" & "):n.value="Terjadi kesalahan saat mendaftar. Silakan coba lagi."}catch(e){console.error("Registration error:",e),n.value="Terjadi kesalahan jaringan. Silakan periksa koneksi internet Anda."}finally{u.value=!1}}},U=()=>j.value.trim()?m.value.trim()?w.value.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(w.value)?b.value?b.value.length<6?(n.value="Kata sandi minimal 6 karakter",!1):b.value!==C.value?(n.value="Konfirmasi kata sandi tidak cocok",!1):k.value?k.value.length!==6||!/^\d{6}$/.test(k.value)?(_.value="PIN harus berupa 6 digit angka",!1):T.value?!0:(n.value="Anda harus menyetujui syarat dan ketentuan",!1):(_.value="PIN harus diisi",!1):(n.value="Kata sandi harus diisi",!1):(n.value="Format email tidak valid",!1):(n.value="Alamat email harus diisi",!1):(n.value="Nomor WhatsApp harus diisi",!1):(n.value="Nama lengkap harus diisi",!1),M=async()=>{if(l.value="",!f.value){l.value="Kode OTP harus diisi";return}if(f.value.length!==6||!/^\d{6}$/.test(f.value)){l.value="Kode OTP harus berupa 6 digit angka";return}u.value=!0;try{const a=await fetch(`${O}/account/validate-otp`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({noHp:m.value,otp:f.value})}),e=await a.json();if(a.ok)i.value=2,setTimeout(()=>{B()},3e3);else if(e.message)l.value=e.message;else if(e.errors){const g=Object.values(e.errors).flat();l.value=g.join(", ")}else l.value="Terjadi kesalahan saat memverifikasi OTP. Silakan coba lagi."}catch(a){console.error("WhatsApp OTP verification error:",a),l.value="Terjadi kesalahan jaringan. Silakan periksa koneksi internet Anda."}finally{u.value=!1}},E=async()=>
1{if(!(y.value>0))try{const a=await fetch(`${O}/account/resend-otp`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({noHp:m.value})}),e=await a.json();a.ok?N():e.message?l.value=e.message:l.value="Terjadi kesalahan saat mengirim ulang kode OTP. Silakan coba lagi."}catch(a){console.error("Resend WhatsApp OTP error:",a),l.value="Terjadi kesalahan jaringan. Silakan periksa koneksi internet Anda."}},N=()=>{y.value=60;const a=te(()=>{y.value--,y.value<=0&&clearInterval(a)},1e3)},D=()=>{i.value>0&&i.value--},B=()=>{z.push("/login")},L=a=>a?a.slice(0,4)+"*".repeat(a.length-7)+a.slice(-3):"";return(a,e)=>{const g=q;return p(),d("div",se,[t("div",ae,[t("div",re,[e[10]||(e[10]=t("div",{class:"mx-auto h-12 w-12 bg-gradient-to-r from-purple-500 to-pink-500 rounded-full flex items-center justify-center mb-3"},[t("svg",{class:"h-6 w-6 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"})])],-1)),e[11]||(e[11]=t("h2",{class:"text-3xl font-extrabold bg-gradient-to-r from-purple-400 to-pink-400 bg-clip-text text-transparent"}," Daftar Akun Baru ",-1)),t("p",oe,[e[9]||(e[9]=v(" Sudah punya akun? ")),V(g,{to:"/login",class:"font-medium text-purple-400 hover:text-purple-300 transition-colors"},{default:F(()=>e[8]||(e[8]=[v("Masuk di sini")])),_:1,__:[8]})])]),t("div",ne,[s(i)>0?(p(),d("div",le,[t("div",ie,[t("div",ue,[t("div",de,h(s(i))+"/2 ",1),t("div",pe,[t("p",ce,h($[s(i)-1]),1)])]),s(i)>1?(p(),d("button",{key:0,onClick:D,class:"text-sm text-gray-400 hover:text-white transition-colors"}," Kembali ")):c("",!0)]),t("div",me,[t("div",{class:"h-full bg-gradient-to-r from-purple-500 to-pink-500 transition-all duration-500 ease-in-out",style:G({width:`${s(i)/2*100}%`})},null,4)])])):c("",!0),s(i)===0?(p(),d("div",fe,[t("form",{class:"space-y-6",onSubmit:Q(R,["prevent"])},[t("div",ge,[A(t("input",{id:"name",name:"name",type:"text",autocomplete:"name",required:"","onUpdate:modelValue":e[0]||(e[0]=r=>x(j)?j.value=r:null),class:"peer w-full px-4 py-3 bg-gray-700/50 border border-gray-600 rounded-xl text-white placeholder-transparent focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-300",placeholder:"Nama Lengkap"},null,512),[[P,s(j)]]),e[12]||(e[12]=t("label",{for:"name",class:"absolute left-4 -top-2.5 bg-gray-800 text-sm text-gray-400 transition-all peer-placeholder-shown:text-sm peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-3.5 peer-placeholder-shown:bg-transparent peer-focus:-top-2.5 peer-focus:text-purple-400 peer-focus:text-xs peer-focus:bg-gray-800"}," Nama Lengkap ",-1))]),V(ee,{modelValue:s(m),"onUpdate:modelValue":e[1]||(e[1]=r=>x(m)?m.value=r:null),label:"Nomor WhatsApp",placeholder:"Masukkan nomor WhatsApp","default-country":"ID","has-error":!!s(S),"error-message":s(S),"helper-text":"Nomor WhatsApp akan digunakan untuk verifikasi akun",onCountryChange:H},null,8,["modelValue","has-error","error-message"]),t("div",ve,[A(t("input",{id:"email",name:"email",type:"email",autocomplete:"email",required:"","onUpdate:modelValue":e[2]||(e[2]=r=>x(w)?w.value=r:null),class:"peer w-full px-4 py-3 bg-gray-700/50 border border-gray-600 rounded-xl text-white placeholder-transparent focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-300",placeholder:"Alamat Email"},null,512),[[P,s(w)]]),e[13]||(e[13]=t("label",{for:"email",class:"absolute left-4 -top-2.5 bg-gray-800 text-sm text-gray-400 transition-all peer-placeholder-shown:text-sm peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-3.5 peer-placeholder-shown:bg-transparent peer-focus:-top-2.5 peer-focus:text-purple-400 peer-focus:text-sm peer-focus:bg-gray-800"}," Alamat Email ",-1))]),t("div",he,[t("div",xe,[A(t("input",{id:"password",name:"password",type:"password",autocomplete:"new-password",required:"","onUpdate:modelValue":e[3]||(e[3]=r=>x(b)?b.value=r:null),class:"peer w-full px-4 py-3 bg-gray-700/50 border border-gray-600 rounded-xl text-white placeholder-transparent focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-300",placeholder:"Password"},null,512),[[P,s(b)]]),e[14]||(e[14]=t("label",{for:"password",class:"absolute left-4 -top-2.5 bg-gray-800 text-sm text-gray-400 transition-all peer-placeholder-shown:text-sm peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-3.5 peer-placeholder-shown:bg-transparent peer-focus:-top-2.5 peer-focus:text-purple-400 peer-focus:text-sm peer-focus:bg-gray-800"}," Password ",-1))]),t("div",be,[A(t("input",{id:"confirm-password",name:"confirm-password",type:"password",autocomplete:"new-password",required:"","onUpdate:modelValue":e[4]||(e[4]=r=>x(C)?C.value=r:null),class:"peer w-full px-4 py-3 bg-gray-700/50 border border-gray-600 rounded-xl text-white placeholder-transparent focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-300",placeholder:"Konfirmasi Password"},null,512),[[P,s(C)]]),e[15]||(e[15]=t("label",{for:"confirm-password",class:"absolute left-4 -top-2.5 bg-gray-800 text-sm text-gray-400 transition-all peer-placeholder-shown:text-sm peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-3.5 peer-placeholder-shown:bg-transparent peer-focus:-top-2.5 peer-focus:text-purple-400 peer-focus:text-sm peer-focus:bg-gray-800"}," Konfirmasi Password ",-1))])]),t("div",null,[e[16]||(e[16]=t("label",{class:"block text-sm font-medium text-gray-400 mb-2"},"PIN (6 digit angka)",-1)),V(W,{modelValue:s(k),"onUpdate:modelValue":e[5]||(e[5]=r=>x(k)?k.value=r:null),error:s(_),onComplete:I,masked:""},null,8,["modelValue","error"])]),t("div",ke,[A(t("input",{id:"terms-and-conditions",name:"terms-and-conditions",type:"checkbox","onUpdate:modelValue":e[6]||(e[6]=r=>x(T)?T.value=r:null),class:"mt-1 h-4 w-4 text-purple-600 focus:ring-purple-500 border-gray-600 rounded bg-gray-700"},null,512),[[X,s(T)]]),e[17]||(e[17]=t("label",{for:"terms-and-conditions",class:"text-sm text-gray-300 leading-5 hover:cursor-pointer"},[v(" Saya menyetujui "),t("a",{href:"#",class:"font-medium text-purple-400 hover:text-purple-300 transition-colors"},"syarat dan ketentuan"),v(" yang berlaku ")],-1))]),t("button",{type:"submit",disabled:s(u),class:"w-full flex justify-center items-center py-3 px-4 border border-transparent roun
1ded-xl text-sm font-medium text-white bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-300 transform hover:scale-[1.02] active:scale-[0.98]"},[s(u)?(p(),d("span",we,e[18]||(e[18]=[t("svg",{class:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})],-1)]))):c("",!0),v(" "+h(s(u)?"Mendaftar...":"Daftar Sekarang"),1)],8,ye),s(n)?(p(),d("div",_e,[t("div",je,[e[19]||(e[19]=t("svg",{class:"h-5 w-5 text-red-400 mr-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),t("p",Ce,h(s(n)),1)])])):c("",!0)],32)])):c("",!0),s(i)===1?(p(),d("div",Ae,[t("div",Te,[e[21]||(e[21]=t("div",{class:"w-16 h-16 mx-auto bg-green-600/20 rounded-full flex items-center justify-center mb-4"},[t("svg",{class:"h-8 w-8 text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"})])],-1)),e[22]||(e[22]=t("h3",{class:"text-xl font-bold text-white mb-2"},"Verifikasi WhatsApp",-1)),t("p",Ve,[e[20]||(e[20]=v(" Kode OTP telah dikirim ke WhatsApp ")),t("span",Pe,h(L(s(m))),1)])]),t("div",null,[e[23]||(e[23]=t("label",{class:"block text-sm font-medium text-gray-400 mb-2"},"Masukkan Kode OTP",-1)),V(W,{modelValue:s(f),"onUpdate:modelValue":e[7]||(e[7]=r=>x(f)?f.value=r:null),error:s(l),onComplete:M,masked:""},null,8,["modelValue","error"])]),t("div",Se,[t("p",Oe,[e[24]||(e[24]=v(" Belum menerima kode? ")),t("button",{type:"button",onClick:E,disabled:s(y)>0,class:"font-medium text-purple-400 hover:text-purple-300 transition-colors disabled:text-gray-500 disabled:cursor-not-allowed"},h(s(y)>0?`Kirim ulang dalam ${s(y)}s`:"Kirim ulang"),9,Me)])]),t("button",{type:"button",onClick:M,disabled:s(u)||s(f).length!==6,class:"w-full flex justify-center items-center py-3 px-4 border border-transparent rounded-xl text-sm font-medium text-white bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-300 transform hover:scale-[1.02] active:scale-[0.98]"},[s(u)?(p(),d("span",Be,e[25]||(e[25]=[t("svg",{class:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})],-1)]))):c("",!0),v(" "+h(s(u)?"Memverifikasi...":"Verifikasi WhatsApp"),1)],8,Ne),s(l)?(p(),d("div",We,[t("div",Ke,[e[26]||(e[26]=t("svg",{class:"h-5 w-5 text-red-400 mr-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),t("p",$e,h(s(l)),1)])])):c("",!0)])):c("",!0),s(i)===2?(p(),d("div",ze,[e[27]||(e[27]=Y('<div class="w-20 h-20 mx-auto bg-green-600/20 rounded-full flex items-center justify-center mb-4"><svg class="h-10 w-10 text-green-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg></div><h3 class="text-2xl font-bold text-white">Pendaftaran Berhasil!</h3><p class="text-gray-400">
1 Akun Anda telah berhasil dibuat. Silakan masuk untuk mulai menggunakan layanan kami. </p>',3)),t("button",{type:"button",onClick:B,class:"w-full flex justify-center items-center py-3 px-4 border border-transparent rounded-xl text-sm font-medium text-white bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 transition-all duration-300 transform hover:scale-[1.02] active:scale-[0.98]"}," Masuk Sekarang ")])):c("",!0)])])])}}};export{qe as default};
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.