import{a as St}from"./chunk-XN7T54IM.js";import"./chunk-RULWGB4E.js";import{a as Ot}from"./chunk-2HIDUY57.js";import{a as v}from"./chunk-U5Y75IZ5.js";import{a as Mt}from"./chunk-HY3IUHOC.js";import"./chunk-4AEX2WLA.js";import{c as Et,i as S,j as It}from"./chunk-2MELUOYA.js";import{Ea as Pt,va as Tt,wa as I}from"./chunk-WOPE6PPO.js";import{E as yt,F as vt,a as ft,h as _t,i as ht,k as wt,o as Ct,p as xt}from"./chunk-MDIMQ3H3.js";import{a as mt}from"./chunk-CAGDTHS6.js";import{n as gt,q as bt}from"./chunk-TKVDP62Z.js";import{Ad as dt,Bb as _,Bc as it,Ca as b,Db as h,Ec as H,Fa as g,Fc as ot,Ha as Q,Ib as m,Jb as r,Ka as N,Kb as a,Lb as E,Pb as O,Qb as M,Rb as J,Tc as rt,Ub as w,Ud as ct,Xb as f,Yc as R,Za as l,Zb as s,Zc as st,ac as W,cc as A,dc as D,eb as K,fc as X,fd as j,gc as tt,ib as T,jb as L,lc as y,ma as $,mb as Y,mc as c,na as z,nb as G,nc as et,nd as at,oa as U,ob as P,oc as nt,pa as q,pd as pt,qd as lt,ra as x,sd as ut,va as u,wa as d,xb as Z,yc as B}from"./chunk-GJDGQISV.js";import"./chunk-WFMAM73Y.js";import{a as F,b as V}from"./chunk-SNAKHGZS.js";var kt=`
    .p-inputotp {
        display: flex;
        align-items: center;
        gap: dt('inputotp.gap');
    }

    .p-inputotp-input {
        text-align: center;
        width: dt('inputotp.input.width');
    }

    .p-inputotp-input.p-inputtext-sm {
        text-align: center;
        width: dt('inputotp.input.sm.width');
    }

    .p-inputotp-input.p-inputtext-lg {
        text-align: center;
        width: dt('inputotp.input.lg.width');
    }
`;var Ht=["input"],Rt=(i,o,t)=>({$implicit:i,events:o,index:t});function jt(i,o){if(i&1){let t=w();O(0),r(1,"input",2),f("input",function(n){u(t);let p=s().$implicit,C=s();return d(C.onInput(n,p-1))})("focus",function(n){u(t);let p=s(2);return d(p.onInputFocus(n))})("blur",function(n){u(t);let p=s(2);return d(p.onInputBlur(n))})("paste",function(n){u(t);let p=s(2);return d(p.onPaste(n))})("keydown",function(n){u(t);let p=s(2);return d(p.onKeyDown(n))}),a(),M()}if(i&2){let t=s().$implicit,e=s();l(),y(e.cn(e.cx("pcInputText"),e.styleClass)),m("value",e.getModelValue(t))("pSize",e.size())("variant",e.$variant())("invalid",e.invalid())("pAutoFocus",e.getAutofocus(t))("pt",e.ptm("pcInputText"))("unstyled",e.unstyled()),Z("maxlength",t===1?e.length:1)("type",e.inputType)("inputmode",e.inputMode)("name",e.name())("tabindex",e.tabindex)("required",e.required()?"":void 0)("readonly",e.readonly?"":void 0)("disabled",e.$disabled()?"":void 0)}}function $t(i,o){i&1&&J(0)}function zt(i,o){if(i&1&&(O(0),P(1,$t,1,0,"ng-container",3),M()),i&2){let t=s().$implicit,e=s();l(),m("ngTemplateOutlet",e.inputTemplate||e._inputTemplate)("ngTemplateOutletContext",ot(2,Rt,e.getToken(t-1),e.getTemplateEvents(t-1),t))}}function Ut(i,o){if(i&1&&(O(0),P(1,jt,2,17,"ng-container",1)(2,zt,2,6,"ng-container",1),M()),i&2){let t=s();l(),m("ngIf",!t.inputTemplate&&!t._inputTemplate),l(),m("ngIf",t.inputTemplate||t._inputTemplate)}}var qt={root:"p-inputotp p-component",pcInputText:"p-inputotp-input"},Ft=(()=>{class i extends Pt{name="inputotp";style=kt;classes=qt;static \u0275fac=(()=>{let t;return function(n){return(t||(t=N(i)))(n||i)}})();static \u0275prov=z({token:i,factory:i.\u0275fac})}return i})();var Vt=new q("INPUTOTP_INSTANCE"),Qt={provide:ft,useExisting:$(()=>k),multi:!0},k=(()=>{class i extends Mt{componentName="InputOtp";_componentStyle=x(Ft);$pcInputOtp=x(Vt,{optional:!0,skipSelf:!0})??void 0;bindDirectiveInstance=x(S,{self:!0});onAfterViewChecked(){this.bindDirectiveInstance.setAttrs(this.ptms(["host","root"]))}readonly;tabindex=null;length=4;styleClass;mask=!1;integerOnly=!1;autofocus;variant=R();size=R();onChange=new b;onFocus=new b;onBlur=new b;inputTemplate;templates;_inputTemplate;tokens=[];value;$variant=rt(()=>this.variant()||this.config.inputStyle()||this.config.inputVariant());get inputMode(){return this.integerOnly?"numeric":"text"}get inputType(){return this.mask?"password":"text"}onAfterContentInit(){this.templates.forEach(t=>{t.getType()==="input"?this._inputTemplate=t.template:this._inputTemplate=t.template})}getToken(t){return this.tokens[t]}getTemplateEvents(t){return{input:e=>this.onInput(e,t),keydown:e=>this.onKeyDown(e),focus:e=>this.onFocus.emit(e),blur:e=>this.onBlur.emit(e),paste:e=>this.onPaste(e)}}onInput(t,e){let n=t.target.value;if(e===0&&n.length>1){this.handleOnPaste(n,t),t.stopPropagation();return}this.tokens[e]=n,this.updateModel(t),t.inputType==="deleteContentBackward"?this.moveToPrev(t):(t.inputType==="insertText"||t.inputType==="deleteContentForward")&&this.moveToNext(t)}updateModel(t){let e=this.tokens.join("");this.writeModelValue(e),this.onModelChange(e),this.onChange.emit({originalEvent:t,value:e})}updateTokens(){this.value!==null&&this.value!==void 0?Array.isArray(this.value)?this.tokens=[...this.value]:this.tokens=this.value.toString().split(""):this.tokens=[]}getModelValue(t){return this.tokens[t-1]||""}getAutofocus(t){return t===1&&this.autofocus||!1}moveToPrev(t){let e=this.findPrevInput(t.target);e&&(e.focus(),e.select())}moveToNext(t){let e=this.findNextInput(t.target);e&&(e.focus(),e.select())}findNextInput(t){let e=t.nextElementSibling;if(e)return e.nodeName==="INPUT"?e:this.findNextInput(e)}findPrevInput(t){let e=t.previousElementSibling;if(e)return e.nodeName==="INPUT"?e:this.findPrevInput(e)}onInputFocus(t){t.target.select(),this.onFocus.emit(t)}onInputBlur(t){this.onBlur.emit(t)}onKeyDown(t){if(!(t.altKey||t.ctrlKey||t.metaKey))switch(t.key){case"ArrowLeft":this.moveToPrev(t),t.preventDefault();break;case"ArrowUp":case"ArrowDown":t.preventDefault();break;case"Backspace":t.target.value.length===0&&(this.moveToPrev(t),t.preventDefault());break;case"ArrowRight":this.moveToNext(t),t.preventDefault();break;default:let e=t.target,n=e.selectionStart!==e.selectionEnd,p=this.tokens.join("").length>=this.length;(!(!this.integerOnly||/^[0-9]$/.test(t.key))||p&&t.key!=="Delete"&&!n)&&t.preventDefault();break}}onPaste(t){if(!this.$disabled()&&!this.readonly){let e=t.clipboardData.getData("text");e.length&&this.handleOnPaste(e,t),t.preventDefault()}}handleOnPaste(t,e){let n=t.substring(0,this.length+1);(!this.integerOnly||!isNaN(n))&&(this.tokens=n.split(""),this.updateModel(e))}getRange(t){return Array.from({length:t},(e,n)=>n+1)}trackByFn(t){return t}writeControlValue(t,e){t?Array.isArray(t)&&t.length>0?this.value=t.slice(0,this.length):this.value=t.toString().split("").slice(0,this.length):this.value=t,e(this.value),this.updateTokens(),this.cd.markForCheck()}static \u0275fac=(()=>{let t;return function(n){return(t||(t=N(i)))(n||i)}})();static \u0275cmp=T({type:i,selectors:[["p-inputOtp"],["p-inputotp"],["p-input-otp"]],contentQueries:function(e,n,p){if(e&1&&W(p,Ht,4)(p,Tt,4),e&2){let C;A(C=D())&&(n.inputTemplate=C.first),A(C=D())&&(n.templates=C)}},hostVars:2,hostBindings:function(e,n){e&2&&y(n.cx("root"))},inputs:{readonly:[2,"readonly","readonly",j],tabindex:"tabindex",length:"length",styleClass:"styleClass",mask:"mask",integerOnly:"integerOnly",autofocus:[2,"autofocus","autofocus",j],variant:[1,"variant"],size:[1,"size"]},outputs:{onChange:"onChange",onFocus:"onFocus",onBlur:"onBlur"},features:[it([Qt,Ft,{provide:Vt,useExisting:i},{provide:Et,useExisting:i}]),Y([S]),G],decls:1,vars:2,consts:[[4,"ngFor","ngForOf","ngForTrackBy"],[4,"ngIf"],["type","text","pInputText","",3,"input","focus","blur","paste","keydown","value","pSize","variant","invalid","pAutoFocus","pt","unstyled"],[4,"ngTemplateOutlet","ngTemplateOutletContext"]],template:function(e,n){e&1&&P(0,Ut,3,2,"ng-container",0),e&2&&m("ngForOf",n.getRange(n.length))("ngForTrackBy",n.trackByFn)},dependencies:[dt,pt,lt,ut,St,Ot,I,It],encapsulation:2,changeDetection:0})}return i})(),Nt=(()=>{class i{static \u0275fac=function(e){return new(e||i)};static \u0275mod=L({type:i});static \u0275inj=U({imports:[k,I,I]})}return i})();var Lt=["otpInput"],At=(i,o)=>({"rounded-end":i,"border-end-0":o});function Yt(i,o){if(i&1){let t=w();r(0,"form",11),f("submit",function(){u(t);let n=s();return d(n.requestOtp(n.Email()))}),r(1,"h1",12),c(2," Forgot Password "),a(),r(3,"h6",13),c(4," Enter the username or email address to reset password "),a(),r(5,"div",14)(6,"div",15)(7,"span"),E(8,"i",16),a()(),r(9,"input",17),f("input",function(n){u(t);let p=s();return d(p.Email.set(n.target.value))}),a()(),r(10,"div",18)(11,"button",19),c(12," Reset Password "),a()(),r(13,"a",20),c(14,"Return to log in"),a()()}if(i&2){let t=s();l(9),m("value",t.Email()),l(2),m("disabled",!t.Email())}}function Gt(i,o){if(i&1){let t=w();r(0,"form",11),f("submit",function(){u(t);let n=s();return d(n.verifyOtp(n.otpEmail(),n.otp()))}),r(1,"h1",21),c(2," OTP Code Verification "),a(),r(3,"h6",13),c(4," Please enter the 6 digit code sent to "),r(5,"span",22),c(6),a()(),r(7,"div",23)(8,"p-inputOtp",24,0),f("ngModelChange",function(n){u(t);let p=s();return p.otp.set(n),d(p.onInputOtp())}),a()(),r(10,"h6",25),c(11," Didn't get a code? "),r(12,"span",26),f("click",function(){u(t);let n=s();return d(n.requestOtp(n.otpEmail()))}),c(13,"Click to resend"),a()(),r(14,"div",18)(15,"button",19),c(16," Verify "),a()()()}if(i&2){let t=s();l(6),et(t.otpEmail()),l(2),m("integerOnly",!0)("ngModel",t.otp())("autofocus",!0),l(7),m("disabled",!t.otp())}}function Zt(i,o){if(i&1){let t=w();r(0,"i",33),f("click",function(){u(t);let n=s(3);return d(n.showPassword())}),a()}if(i&2){let t=s(3);y(B("",t.showHideClass()," fas"))}}function Jt(i,o){if(i&1&&(r(0,"span",30),_(1,Zt,1,3,"i",32),a()),i&2){let t=s(2);l(),h(t.password()?1:-1)}}function Wt(i,o){if(i&1){let t=w();r(0,"i",33),f("click",function(){u(t);let n=s(3);return d(n.showPassword())}),a()}if(i&2){let t=s(3);y(B("",t.showHideClassConfirm()," fas"))}}function Xt(i,o){if(i&1&&(r(0,"span",30),_(1,Wt,1,3,"i",32),a()),i&2){let t=s(2);l(),h(t.password()?1:-1)}}function te(i,o){if(i&1){let t=w();r(0,"form",11),f("submit",function(){u(t);let n=s();return d(n.changePassword(n.otpEmail(),n.otp(),n.password()))}),r(1,"h1",21),c(2," Create New Password "),a(),r(3,"h6",13),c(4," Create a strong password to keep your account safe "),a(),r(5,"div",27)(6,"div",28)(7,"input",29),f("input",function(n){u(t);let p=s();return d(p.password.set(n.target.value))}),a(),_(8,Jt,2,1,"span",30),a(),r(9,"div",28)(10,"input",31),f("input",function(n){u(t);let p=s();return d(p.confirmPassword.set(n.target.value))}),a(),_(11,Xt,2,1,"span",30),a()(),r(12,"div",18)(13,"button",19),c(14," Change Password "),a()()()}if(i&2){let t=s();l(7),m("type",t.inputType())("ngClass",H(9,At,t.browserType()=="edge",t.browserType()!="edge"))("value",t.password()),l(),h(t.browserType()!="edge"?8:-1),l(2),m("type",t.inputConfirm())("ngClass",H(12,At,t.browserType()=="edge",t.browserType()!="edge"))("value",t.confirmPassword()),l(),h(t.browserType()!="edge"?11:-1),l(2),m("disabled",(!t.password()||!t.confirmPassword())&&t.password()!=t.confirmPassword())}}var Dt=class i{constructor(o){this.httpService=o;document.title="Outlet | Forgot Password Form",Q(()=>{let t=e=>{e.key==="Enter"&&(e.preventDefault(),this.verifyOtp(this.otpEmail(),this.otp()))};this.otpInputEl()?document.querySelector(".otp-input input:last-child").addEventListener("keyup",t):document.removeEventListener("keyup",t)})}otpInputEl=st("otpInput");appVersion=mt.version;showHideClass=g("fas fa-eye fas");showHideClassConfirm=g("fas fa-eye fas");inputType=g("password");inputConfirm=g("password");password=g("");confirmPassword=g("");browserType=g(this.findname_browser());Email=g("");alert=g({Visible:!1,Message:null,Success:!1});toastr=x(gt);state=g("Email");otp=g("");otpEmail=g("");router=x(ct);findname_browser(){var o=window.navigator.userAgent;if(o.indexOf("Edg/")>-1)return"edge";var t={chrome:/chrome/i,safari:/safari/i,firefox:/firefox/i,ie:/internet explorer/i,edge:/edg/i};for(var e in t)if(t[e].test(o))return e;return"unknown"}ngOnInit(){document.body.classList.add("login-body")}ngOnDestroy(){document.body.classList.remove("login-body")}showPassword(){let o=this.showHideClass()=="fas fa-eye fas"?"fas fas fa-eye-slash":"fas fa-eye fas";this.showHideClass.set(o),this.inputType.set(o=="fas fa-eye fas"?"password":"text");let t=this.showHideClassConfirm()=="fas fa-eye fas"?"fas fas fa-eye-slash":"fas fa-eye fas";this.showHideClassConfirm.set(t),this.inputConfirm.set(t=="fas fa-eye fas"?"password":"text")}Submit(){let o={Email:this.Email()};this.httpService.post("/api/login/SubmitForgotPassword",o).subscribe({next:t=>{this.alert.set(V(F({},this.alert()),{Visible:!0,Success:!0,Message:t.Message}))},error:t=>{this.alert.set(V(F({},this.alert()),{Visible:!0,Message:t?.error?.Message?t?.error?.Message:t?.error}))}})}requestOtp(o){this.httpService.post("/api/password/requestotp",{email:o}).subscribe(t=>{this.toastr.info(`OTP sent to ${t.otpEmailTarget}`,v.Info),this.otpEmail.set(t.otpEmailTarget),this.state.set("OTP")})}onInputOtp(){this.otp().length==6&&this.verifyOtp(this.otpEmail(),this.otp())}verifyOtp(o,t){this.httpService.post("/api/password/verifyotp",{email:o,otp:t}).subscribe(e=>{e.success?(this.toastr.info("You can update your password",v.Info),this.state.set("Password")):this.toastr.info("You input the wrong OTP",v.Error)})}changePassword(o,t,e){this.httpService.post("/api/password/change",{email:o,otp:t,newPassword:e}).subscribe(()=>{this.toastr.info("Your password has been changed",v.Info),this.router.navigate(["/"])})}static \u0275fac=function(t){return new(t||i)(K(bt))};static \u0275cmp=T({type:i,selectors:[["POS-auth-forgot-password"]],viewQuery:function(t,e){t&1&&X(e.otpInputEl,Lt,5),t&2&&tt()},decls:15,vars:4,consts:[["otpInput",""],[1,"container-fluid"],[1,"d-flex","justify-content-center","align-items-center","vh-100"],[1,"card",2,"width","30rem"],[1,"card-body","p-12"],[1,"d-flex","copyright",2,"margin-left","20px"],[1,"align-self-center","me-5"],["target","_blank","href","http://www.dealpos.com"],[1,"version",2,"margin-right","18px"],["target","_blank","href","https://changelog.dealpos.com/?categories=cat_gAZdRhBYU7QVl&view=complete&v",1,"text-dark","fst-italic"],[1,"fa-solid","fa-circle-exclamation","ms-2",2,"font-size","16px"],[3,"submit"],[1,"mt-8","fw-normal",2,"margin-bottom","1.3rem"],[1,"fw-normal","text-start",2,"font-size","0.8rem"],[1,"input-group","input-group-lg","mb-3","my-5"],[1,"input-group-text","input-group-text","rounded-start"],[1,"fas","fa-user","fa-lg"],["type","text","data-cy","username","placeholder","Username / Email","aria-label","Username","name","email","aria-describedby","basic-addon1",1,"form-control","form-control-lg","rounded-end","ps-2","border-start-0",2,"height","50px",3,"input","value"],[1,"my-6"],["type","submit",1,"btn","btn-primary","w-100",3,"disabled"],["href","/",1,"mt-6"],[1,"mt-8","fw-normal",2,"margin-bottom","3rem"],[1,"fw-bold"],[1,"mb-3","my-5","d-flex","justify-content-center"],["length","6","name","otp",1,"otp-input",3,"ngModelChange","integerOnly","ngModel","autofocus"],[1,"fw-normal","text-start"],[1,"text-primary","pointer",3,"click"],[1,"mb-3","my-5"],[1,"input-group","input-group-lg","mt-8"],["id","txtPassword","data-cy","password","placeholder","New Password","aria-label","Password","aria-describedby","basic-addon1","autofocus","","name","password",1,"form-control","form-control-lg","rounded-end","ps-5",2,"height","50px",3,"input","type","ngClass","value"],[1,"input-group-text","border-start-0","rounded-end"],["id","txtPassword","data-cy","password","placeholder","Confirm New Password","aria-label","Password","aria-describedby","basic-addon1","autofocus","","name","password",1,"form-control","form-control-lg","rounded-end","ps-5",2,"height","50px",3,"input","type","ngClass","value"],[3,"class"],[3,"click"]],template:function(t,e){t&1&&(r(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4),_(4,Yt,15,2,"form"),_(5,Gt,17,5,"form"),_(6,te,15,15,"form"),a()()(),r(7,"div",5)(8,"span",6),c(9,"powered by :"),a(),E(10,"a",7),a(),r(11,"div",8)(12,"a",9),c(13),E(14,"i",10),a()()()),t&2&&(l(4),h(e.state()=="Email"?4:-1),l(),h(e.state()=="OTP"?5:-1),l(),h(e.state()=="Password"?6:-1),l(7),nt("version ",e.appVersion))},dependencies:[at,vt,xt,_t,ht,yt,Ct,wt,Nt,k],styles:["input[type=submit][_ngcontent-%COMP%]{font-size:1.125rem;width:11.25rem;font-family:Roboto Slab,serif}@media screen and (max-width:768px){.footer-mobile[_ngcontent-%COMP%]{display:flex!important;justify-content:center!important}div.vh-100[_ngcontent-%COMP%]{height:40vh!important}.fixed-bottom[_ngcontent-%COMP%]{position:static!important}input[type=submit][_ngcontent-%COMP%]{width:98%}.card[_ngcontent-%COMP%]{border:none}}  p-inputOtp{width:100%}  p-inputOtp input{flex-grow:1;height:42px}.copyright[_ngcontent-%COMP%]{position:absolute;bottom:1.25rem;left:1.25rem}.copyright[_ngcontent-%COMP%]   a[_ngcontent-%COMP%]{width:8.125rem;height:2.5rem;background-image:url(https://cdn.dealpos.app/public/logo/dealpos_130.png);background-position:left top;background-repeat:no-repeat;background-size:contain}.version[_ngcontent-%COMP%]{bottom:1.25rem;right:1.25rem;position:absolute}@media(max-width:768px){.copyright[_ngcontent-%COMP%], .version[_ngcontent-%COMP%]{position:static;margin-top:10px}.copyright[_ngcontent-%COMP%]{justify-content:center}}.version[_ngcontent-%COMP%]   a[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{color:#fe3a00!important}.version[_ngcontent-%COMP%]   a[_ngcontent-%COMP%]:visited   i[_ngcontent-%COMP%]{color:#f4f4f4!important}.version[_ngcontent-%COMP%]   a[_ngcontent-%COMP%]:visited{margin-left:-10px}"],changeDetection:0})};export{Dt as AuthForgotPasswordComponent};
