import{d as N,r as h,w as T,W as A,C as k,c as m,o as c,b as e,a as f,j as g,t as a,u as o,P as _,F,e as V,g as C,k as B,n as I,v as L,L as P,aq as R,f as S}from"./app-DJb_CRLj.js";import{_ as U}from"./AuthLayout.vue_vue_type_script_setup_true_lang-ogRL1Wue.js";import{_ as W}from"./NumInput.vue_vue_type_script_setup_true_lang-qN87FRoS.js";import{u as D}from"./useRandomStr-7r5tQ8Eq.js";import"./useToastify-DqLaHt3f.js";import"./useHexToRgb-Crf73LpK.js";/* empty css            */const j=(b,n,p)=>{let l=b;const i=()=>{const u=Math.floor(l/60),y=l%60;n.value=("0"+u).slice(-2)+":"+("0"+y).slice(-2)},w=()=>{if(l<=0){clearInterval(d),n.value="00:00",p.value=!0;return}l--,i(),l<60&&(p.value=!0)};i();const d=setInterval(w,1e3)},q={class:"auth-container"},z={class:"logo-container"},E=["src","alt"],G={key:1},H={class:"card shadow-1"},J={class:"card-body"},K={class:"auth-title lts-05 mb-4"},O={class:"form-password mb-4"},Q=["type","name"],X={class:"form-element-row mb-3"},Y=["disabled"],Z={class:"auth-title lts-05"},x={class:"timer"},ee=["textContent"],se=["disabled"],te={class:"send-again"},oe={class:"form-element-row mb-3"},ne=["disabled"],ae={class:"form-element-row w-100 text-center"},re={class:"edit-phone lts-05"},le={class:"auth-footer"},ve=N({layout:U,__name:"Verify",props:{phone:{},status:{},remaining:{},prev:{}},setup(b){const n=b,p=h(""),l=h(!1);n.remaining!==void 0&&j(n.remaining,p,l),T(p,s=>{s==="00:00"&&A.get(route("login"))});const i=k({phone:n.phone,prev:n.prev}),w=()=>{i.post(route("login.process"),{preserveState:!1,replace:!0})};let d=h();const u=k({code:null,phone:n.phone,prev:n.prev}),y=()=>{u.transform(s=>({code:d.value,phone:s.phone,prev:n.prev})).post(route("login.do"),{replace:!0})},v=h(!1),$=k({password:null,phone:n.phone,status:n.status,prev:n.prev}),M=()=>{$.post(route("login.do"),{replace:!0})};return(s,t)=>(c(),m("div",q,[e("div",z,[f(o(_),{class:"logo",href:s.route("index")},{default:g(()=>[s.$page.props.appLogo!=null?(c(),m("img",{key:0,src:s.$page.props.appLogo,alt:s.$page.props.appFullName},null,8,E)):(c(),m("span",G,a(s.$t("messages.word.logo")),1))]),_:1},8,["href"])]),e("div",H,[e("div",J,[s.status=="password"?(c(),m(F,{key:0},[e("div",K,a(s.$t("messages.sentence.enter_password")),1),e("form",{onSubmit:t[2]||(t[2]=V(r=>M(),["prevent"])),class:"auth-form"},[e("div",O,[C(e("input",{class:"form-control text-center fs-6",style:{direction:"ltr"},type:v.value?"text":"password",autocomplete:"off",name:o(D)(15),"onUpdate:modelValue":t[0]||(t[0]=r=>o($).password=r),autofocus:""},null,8,Q),[[B,o($).password]]),e("i",{onClick:t[1]||(t[1]=r=>v.value=!v.value),class:I(v.value?"ri-eye-off-line":"ri-eye-line")},null,2)]),e("div",X,[e("button",{class:"btn btn-primary",type:"submit",disabled:o(u).processing},a(s.$t("messages.word.continue")),9,Y)])],32)],64)):(c(),m(F,{key:1},[e("div",Z,a(s.$t("messages.sentence.enter_authentication_code")),1),e("form",{class:"d-block",onSubmit:V(w,["prevent"])},[e("div",x,[e("span",{textContent:a(p.value)},null,8,ee),C(e("input",{type:"hidden",name:"phone","onUpdate:modelValue":t[3]||(t[3]=r=>o(i).phone=r),disabled:o(i).processing},null,8,se),[[L,o(i).phone]]),e("div",te,[C(e("button",{class:"link"},a(s.$t("messages.sentence.send_again")),513),[[P,l.value]])])])],32),e("form",{onSubmit:t[5]||(t[5]=V(r=>y(),["prevent"])),class:"auth-form"},[f(W,{class:"token-input mb-4 mt-3",style:{direction:"ltr"},placeholder:"- - - - -",type:"tel",inputmode:"numeric",autocomplete:"off",name:o(D)(15),maxlength:"5",modelValue:o(d),"onUpdate:modelValue":t[4]||(t[4]=r=>R(d)?d.value=r:d=r),autofocus:""},null,8,["name","modelValue"]),e("div",oe,[e("button",{class:"btn btn-primary",type:"submit",disabled:o(u).processing},a(s.$t("messages.word.continue")),9,ne)])],32)],64)),e("div",ae,[e("div",re,[f(o(_),{href:s.route("login",{prev:s.prev}),class:"link"},{default:g(()=>[t[6]||(t[6]=e("i",{class:"ri-pencil-line"},null,-1)),S(" "+a(s.$t("messages.sentence.edit_phone_number")),1)]),_:1},8,["href"])])])])]),e("div",le,[f(o(_),{href:s.route("index"),class:"lts-05"},{default:g(()=>[S(a(s.$t("messages.sentence.home_page")),1)]),_:1},8,["href"]),t[7]||(t[7]=e("span",null,null,-1)),f(o(_),{href:s.route("main.products.index"),class:"lts-05"},{default:g(()=>[S(a(s.$t("messages.sentence.product_archive")),1)]),_:1},8,["href"])])]))}});export{ve as default};
