import{_ as O}from"./LogoMain-UW_gcB3O.js";import{U as M,aI as F,bU as E,d2 as H,o as S,H as T,a as t,w as o,c4 as V,b as i,e as y,bo as C,d as _,cG as P,bf as U,G,c3 as W,F as $,aY as r,cH as v,c as q,V as p,d9 as z,f as h,bW as I,bY as Y}from"./index-CUCRxCBw.js";import{c as j}from"./comment-DKhu-3Y_.js";import{_ as J}from"./ReCaptcha-CVJ3WPVA.js";import{F as K}from"./vee-validate.esm-zWmxDNK9.js";import{_ as Q}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{L as X}from"./LoginImage-IB75psry.js";import"./customizer-DW14b1gt.js";const Z={key:0,class:"mt-2"},ee={class:"mt-5 text-right"},te=M({__name:"AuthLogin",setup(w){const g=r(!1);let s=r(!1);const N=r(!1),c=r(!1),u=r(""),d=r(""),m=r("");F(()=>{const e=E();e.isRememberPwd&&(g.value=e.isRememberPwd,d.value=e.loginMsgmutations.username,u.value=e.loginMsgmutations.password,console.log("usersStore....",e.loginMsgmutations),console.log("username....",e.loginMsgmutations.username),console.log("password....",e.loginMsgmutations.password))});const x=H(),l=E(),A=j();function R(e,{setErrors:a}){return s.value=!0,console.log(l),m.value||(s.value=!1,a({apiError:"Please verify reCaptcha"})),console.log("authStore.login....",d.value,u.value,m.value),x.login(d.value,u.value,m.value).then(n=>{n.code==200?(b(),L()):(a({apiError:n.msg}),s.value=!1)}).catch(function(n){a({apiError:n}),s.value=!1})}function b(){console.log("getCurrentMerchant"),x.currentMerchant().then(async e=>{console.log("getCurrentMerchant....",b),await l.SET_MERCHANT_INFO_MUTATIONS().then(()=>{if(console.log("res.data.login...",e.data.login),e.data.login)if(s.value=!1,l.SET_lOGIN_MSG_MUTATIONS({username:d.value,password:u.value}),g.value==!0?l.SET_IS_REMEMBER_PWD(!0):l.SET_IS_REMEMBER_PWD(!1),console.log("res.data.login2...",e.data.login),sessionStorage.getItem("lastRoute")){let a=B(sessionStorage.getItem("lastRoute"));v.push(a)}else v.push("/")})})}function L(){A.noticeList({type:3}).then(e=>{e.code==200&&(l.SET_SHOULD_DASHBOARD_NOTICE_Mutations(!0),l.SET_DASHBOARDNOTICE_INTERVAL(e.data.dashboardNoticeInterval),l.SET_NOTICE_LIST(e.data.itemList))})}function B(e){return e.startsWith("/app")?e.slice(4):e}function k(){v.push("/auth/forgot-password")}const D=e=>(console.log("val....",e),m.value=e,e);return(e,a)=>(S(),T($,null,[t(C(K),{onSubmit:R,class:"mt-7 loginForm"},{default:o(({errors:n})=>[t(V,{modelValue:d.value,"onUpdate:modelValue":a[0]||(a[0]=f=>d.value=f),label:"Email Address",class:"mt-4 mb-8",required:"",density:"comfortable","hide-details":"auto",variant:"outlined",color:"primary"},null,8,["modelValue"]),t(V,{modelValue:u.value,"onUpdate:modelValue":a[1]||(a[1]=f=>u.value=f),label:"Password",required:"",density:"comfortable",variant:"outlined",color:"primary","hide-details":"auto","append-icon":c.value?"mdi-eye":"mdi-eye-off",type:c.value?"text":"password","onClick:append":a[2]||(a[2]=f=>c.value=!c.value),class:"pwdInput"},null,8,["modelValue","append-icon","type"]),i("div",{class:"d-sm-flex align-center mt-4 mb-4 mb-sm-0"},[i("div",{class:"ml-auto mb-4"},[i("a",{onClick:k,class:"text-secondary text-decoration-none cursor-pointer"},"Forgot password?")])]),t(J,{onGetChildren:D}),t(y,{color:"secondary",loading:C(s),block:"",class:"mt-2",variant:"flat",size:"large",disabled:N.value,type:"submit"},{default:o(()=>[...a[3]||(a[3]=[_(" Sign In",-1)])]),_:1},8,["loading","disabled"]),n.apiError?(S(),T("div",Z,[t(P,{color:"error"},{default:o(()=>[_(U(n.apiError),1)]),_:2},1024)])):G("",!0)]),_:1}),i("div",ee,[t(W),t(y,{variant:"plain",to:"/register",class:"mt-2 text-capitalize mr-n2"},{default:o(()=>[...a[4]||(a[4]=[_("Don't Have an account?",-1)])]),_:1})])],64))}}),ae=Q(te,[["__scopeId","data-v-3f6e14d2"]]),oe={class:"pa-0 pa-sm-12"},me=M({__name:"LoginPage",setup(w){return(g,s)=>(S(),q(h,{class:"h-100vh logins","no-gutters":""},{default:o(()=>[t(p,{cols:"12",lg:"7",xl:"7",class:"d-flex align-center bg-lightprimary"},{default:o(()=>[t(z,null,{default:o(()=>[i("div",oe,[t(h,{justify:"center"},{default:o(()=>[t(p,{cols:"12",lg:"10",xl:"6",md:"7"},{default:o(()=>[t(I,{elevation:"0",class:"loginBox"},{default:o(()=>[t(I,{variant:"outlined"},{default:o(()=>[t(Y,{class:"pa-9"},{default:o(()=>[t(h,null,{default:o(()=>[t(p,{cols:"12",md:"7",sm:"7","order-sm":"first",order:"last",class:"text-sm-start text-center"},{default:o(()=>[...s[0]||(s[0]=[i("h2",{class:"text-secondary text-h2"},"Hi, Welcome Back",-1),i("h4",{class:"text-h4"},"Login in to your account",-1)])]),_:1}),t(p,{class:"text-sm-end text-center",sm:"5",cols:"12"},{default:o(()=>[t(O)]),_:1})]),_:1}),t(ae)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})])]),_:1})]),_:1}),t(X)]),_:1}))}});export{me as default};