1import{a as ye}from"./chunk-RTK3L7KN.js";import"./chunk-7JP6Y5S2.js";import{a as be}from"./chunk-4BVONZWO.js";import"./chunk-3WROMZIU.js";import"./chunk-A3E27WDE.js";import{a as G}from"./chunk-7XAKHG4E.js";import{n as ie}from"./chunk-VM5OC7EY.js";import{a as Ce}from"./chunk-QOYYSCB3.js";import{a as xe,b as we}from"./chunk-DJGKYIDP.js";import{a as _e}from"./chunk-A6VWUFA5.js";import{a as fe}from"./chunk-C5Z7LZ75.js";import{a as ve}from"./chunk-CSLXO2TK.js";import{c as B,g as z,u as Z}from"./chunk-7R5JBG5O.js";import{a as pe,b as ue}from"./chunk-AJAJFYAL.js";import"./chunk-Q4WNEHHE.js";import{a as te}from"./chunk-ZHEVVJCK.js";import"./chunk-JNYYNB56.js";import"./chunk-Q2762QK7.js";import"./chunk-XI7OEVLD.js";import{Ca as J,Da as O,Fa as K,Ha as Q,Ja as X,Ka as Y,La as ee,Na as ge,Oa as he,va as W,wa as $,ya as H}from"./chunk-HJ22JSJV.js";import{g as R,h as y,r as q,s as U}from"./chunk-5ALDQSIV.js";import{B as de,C as ce,b as oe,d as I,g as re,h as ne,n as ae,q as se,r as me,z as le}from"./chunk-DZXPISIV.js";import{Ac as m,Bc as S,Ca as _,Cc as T,Ea as L,Kc as A,Rb as p,Sb as u,Ub as j,Vb as D,Wb as N,Wc as P,Xb as l,Yb as r,Zb as n,_b as h,eb as E,fc as C,gb as a,ic as v,lc as x,pb as d,qa as f,ra as g,ua as M,vb as V,vc as b,x as k}from"./chunk-TUX6BVKC.js";import{a as F}from"./chunk-JGDRNPQP.js";var Ve=()=>["/forgot-password"];function je(o,c){if(o&1){let e=C();r(0,"div",24),v("click",function(){let i=f(e).$implicit,s=x();return g(s.openLink(i.link))}),r(1,"img",25),v("click",function(){let i=f(e).$implicit,s=x();return g(s.openLink(i.link))}),n(),r(2,"span",26),v("click",function(){let i=f(e).$implicit,s=x();return g(s.openLink(i.link))}),r(3,"span",27),m(4),n(),h(5,"br"),r(6,"span"),m(7),n()()()}if(o&2){let e=c.$implicit;a(),l("src",e.src,E),a(3),S(e.title),a(3),S(e.description)}}function De(o,c){if(o&1&&(r(0,"fuse-alert",11),m(1),n()),o&2){let e=x();l("appearance","outline")("showIcon",!1)("type",e.alert().type)("@shake",e.alert().type==="error"),a(),T(" ",e.alert().message," ")}}function Ne(o,c){o&1&&(r(0,"mat-error"),m(1," Company Code is required "),n())}function Te(o,c){o&1&&(r(0,"mat-error"),m(1," Username is required "),n())}function Ae(o,c){if(o&1){let e=C();r(0,"mat-icon",28),v("click",function(){f(e),x();let i=b(29);return g(i.type==="password"?i.type="text":i.type="password")}),n()}o&2&&l("svgIcon","heroicons_solid:eye")}function Pe(o,c){if(o&1){let e=C();r(0,"mat-icon",28),v("click",function(){f(e),x();let i=b(29);return g(i.type==="password"?i.type="text":i.type="password")}),n()}o&2&&l("svgIcon","heroicons_solid:eye-slash")}function Re(o,c){o&1&&(r(0,"span"),m(1," Sign in "),n())}function qe(o,c){o&1&&h(0,"mat-progress-spinner",23),o&2&&l("diameter",24)("mode","indeterminate")}var Ie=(()=>{class o{constructor(e,t,i,s,w,Se,Fe,ke,Me,Le,Ee){this.fb=e,this.service=t,this.router=i,this.deviceInfoService=s,this.message=w,this.http=Se,this.handler=Fe,this.dialog=ke,this.masterService=Me,this.userService=Le,this.injector=Ee,this.images=_([]),this.showAlert=_(!1),this.alert=_({type:"success",message:""}),this.isLoading=_(!1),this.dialogRef=_(null),this.formDisabled=P(()=>this.isLoading()),this.successMessage=F({},B),this.url=ee.reports+"api/site/master/token",G.showFeedbackButton(!1),this.initializeForm(),this.loadInitialData()}initializeForm(){this.loginForm=this.fb.group({username:[localStorage.getItem("us"),I.required],password:["",I.required],companyCode:[localStorage.getItem("co"),I.required],remember:localStorage.getItem("re")==="true",ip1:"",ip2:"",device:this.deviceInfoService.getDeviceInfo().os,browser:this.deviceInfoService.getDeviceInfo().browser}),sessionStorage.setItem("device",this.deviceInfoService.getDeviceInfo().os),sessionStorage.setItem("browser",this.deviceInfoService.getDeviceInfo().browser)}loadInitialData(){this.loadCarousel(),this.loadIPAddresses()}loadCarousel(){L(()=>{k({getCarousel:this.masterService.getCarousel()}).subscribe({next:e=>{let t=e.getCarousel.payload,i=[],s=Math.floor(Math.random()*t.length);for(let w=0;w<6;w++)i.push(t[(s+w)%t.length]);this.images.set(i)},error:e=>console.error("Carousel loading error:",e)})},{injector:this.injector})}loadIPAddresses(){let e=new y(this.handler);e.get("https://api.ipify.org/?format=json").subscribe({next:t=>{this.loginForm.get("ip1")?.setValue(t.ip),sessionStorage.setItem("ip1",t.ip)},error:t=>console.error("IP1 loading error:",t)}),e.get("https://ipv4.icanhazip.com",{responseType:"text"}).subscribe({next:t=>{let i=t.replace(` 2`,"");this.loginForm.get("ip2")?.setValue(i),sessionStorage.setItem("ip2",i)},error:t=>console.error("IP2 loading error:",t)})}openLink(e){window.open(e,"_blank")}
2signIn(){if(this.loginForm.invalid)return;let e=this.loginForm.value;Object.assign(ve,{username:e.username,password:e.password,companyCode:e.companyCode,remember:e.remember,ip1:e.ip1,device:this.deviceInfoService.getDeviceInfo().os,browser:this.deviceInfoService.getDeviceInfo().browser}),this.loginForm.disable(),this.showAlert.set(!1),this.isLoading.set(!0),this.service.authenticateUser(e).subscribe({next:t=>this.handleAuthenticationResponse(t),error:t=>this.handleAuthenticationError(t)})}handleAuthenticationResponse(e){if(this.isLoading.set(!1),e.statusCode===200){let t=e.payload;t.id===null?(this.loginForm.enable(),this.alert.set({type:"error",message:t.type}),this.showAlert.set(!0)):(this.service.saveToken(t,this.loginForm.value.remember),sessionStorage.setItem("allowed","true"),this.service.reportToken(),this.handlePostLoginNavigation(t))}else this.handleAuthenticationError(null)}handlePostLoginNavigation(e){if(e.routing==="/company-setup"){this.router.navigate([e.routing]),this.loginForm.enable();return}if(!e.is_pw_changed){this.navigateToPasswordUpdate(e);return}if(e.is_pw_expires){this.showWarning(e),this.navigateToPasswordUpdate(e);return}e.remind_password&&this.showWarning(e),this.router.navigate([e.routing]),this.loginForm.enable()}navigateToPasswordUpdate(e){sessionStorage.setItem("allowed","false"),this.router.navigate(["/update-password"]),this.loginForm.enable()}showWarning(e){this.successMessage.title="Warning!",this.successMessage.icon={show:!0,name:"heroicons_solid:exclamation",color:"warn"},this.successMessage.message=e.remind_message,this.message.open(this.successMessage)}handleAuthenticationError(e){this.isLoading.set(!1),this.loginForm.enable(),e&&console.error("Authentication error:",e.error),this.alert.set({type:"error",message:"Can't connect to our system.."}),this.showAlert.set(!0)}showmodal(){this.open()}open(){let e=this.dialogRef();e&&e.close();let t=this.dialog.open(ye,{panelClass:"app-dialog"});this.dialogRef.set(t)}static{this.\u0275fac=function(t){return new(t||o)(d(le),d(te),d(q),d(Ce),d(Z),d(y),d(R),d(z),d(_e),d(fe),d(M))}}static{this.\u0275cmp=V({type:o,selectors:[["app-login"]],decls:42,vars:17,consts:[["signInNgForm","ngForm"],["passwordField",""],[1,"flex","flex-col","sm:flex-row","items-center","md:items-start","sm:justify-center","md:justify-start","flex-auto","min-w-0"],[1,"relative","hidden","md:flex","flex-auto","items-center","justify-center","h-full","p-2","lg:px-2","overflow-hidden","bg-gray-800","dark:border-r"],[1,"grid","grid-cols-3","gap-5"],[1,"xl:h-100","xl:w-100","md:h-[280px]","md:w-[280px]","rounded-lg","overflow-hidden","bg-white","parent"],[1,"md:flex","md:justify-end","w-full","sm:w-auto","md:h-full","py-8","px-4","sm:p-12","md:p-2","xl:p-12","md:pt-14","sm:rounded-2xl","md:rounded-none","sm:shadow","md:shadow-none","sm:bg-card"],[1,"max-w-[250px]","sm:max-w-[300px]","mx-auto","sm:mx-0","md:p-10","xl:p-2"],[1,"w-full"],["src","images/logo/logo.webp"],[1,"flex","items-baseline","mt-0.5","font-medium"],[1,"mt-8",3,"appearance","showIcon","type"],["autocomplete","off",1,"mt-8",3,"formGroup"],["appearance","outline",1,"w-full","h-18","mb-3","text-lg"],["autocomplete","off","id","companyCode","matInput","",1,"inputs",3,"formControlName"],["autocomplete","off","id","username","matInput","",1,"inputs",3,"formControlName"],["appearance","outline",1,"w-full","h-18","text-lg"],["autocomplete","off","id","password","matInput","","type","password",1,"inputs",3,"formControlName"],["matSuffix","",1,"mr-2","mt-[1px]",3,"svgIcon"],[1,"inline-flex","items-center","justify-between","w-full","mt-1.5"],[3,"color","formControlName"],[1,"text-md","font-medium","text-primary-500","hover:underline",3,"routerLink"],["mat-flat-button","",1,"fuse-mat-button-large","w-full","h-18","mt-6","text-lg",3,"click","color","disabled"],[3,"diameter","mode"],[1,"xl:h-100","xl:w-100","md:h-[280px]","md:w-[280px]","rounded-lg","overflow-hidden","bg-white","parent",3,"click"],[1,"login-tile-image",3,"click","src"],["align","center",1,"float-span","md:text-sm","xl:text-md",3,"click"],[1,"login-tile-title"],["matSuffix","",1,"mr-2","mt-[1px]",3,"click","
2svgIcon"]],template:function(t,i){if(t&1){let s=C();r(0,"div",2)(1,"div",3)(2,"div",4),D(3,je,8,3,"div",5,j),n()(),r(5,"div",6)(6,"div",7)(7,"div",8),h(8,"img",9),n(),r(9,"div",10)(10,"div"),m(11,"Log in to your account."),n()(),p(12,De,2,5,"fuse-alert",11),r(13,"form",12,0)(15,"mat-form-field",13)(16,"mat-label"),m(17,"Client"),n(),h(18,"input",14),p(19,Ne,2,0,"mat-error"),n(),r(20,"mat-form-field",13)(21,"mat-label"),m(22,"Username"),n(),h(23,"input",15),p(24,Te,2,0,"mat-error"),n(),r(25,"mat-form-field",16)(26,"mat-label"),m(27,"Password"),n(),h(28,"input",17,1),p(30,Ae,1,1,"mat-icon",18),p(31,Pe,1,1,"mat-icon",18),r(32,"mat-error"),m(33," Password is required "),n()(),r(34,"div",19)(35,"mat-checkbox",20),m(36," Remember me "),n(),r(37,"a",21),m(38,"Forgot password? "),n()(),r(39,"button",22),v("click",function(){return f(s),g(i.signIn())}),p(40,Re,2,0,"span"),p(41,qe,1,2,"mat-progress-spinner",23),n()()()()()}if(t&2){let s=b(29);a(3),N(i.images()),a(9),u(i.showAlert()?12:-1),a(),l("formGroup",i.loginForm),a(5),l("formControlName","companyCode"),a(),u(i.loginForm.get("companyCode").hasError("required")?19:-1),a(4),l("formControlName","username"),a(),u(i.loginForm.get("username").hasError("required")?24:-1),a(4),l("formControlName","password"),a(2),u(s.type==="password"?30:-1),a(),u(s.type==="text"?31:-1),a(4),l("color","primary")("formControlName","remember"),a(2),l("routerLink",A(16,Ve)),a(2),l("color","primary")("disabled",i.formDisabled()),a(),u(i.formDisabled()?-1:40),a(),u(i.formDisabled()?41:-1)}},dependencies:[ce,ae,oe,re,ne,me,se,de,Q,K,ue,pe,O,J,W,$,H,Y,X,he,ge,we,xe,U,be],styles:[`.parent{position:relative;cursor:hand;cursor:pointer;border-radius:10px}.float-span{position:absolute;left:10px;right:10px;bottom:20px;color:#fff;background-color:gray;padding:5px;border-radius:5px;opacity:.8;cursor:hand;cursor:pointer}.icon{height:15px!important;min-height:40px;padding:3px!important}.mdc-text-field--outlined .mat-mdc-form-field-infix{padding-top:9px!important;padding-bottom:6px!important}.mat-mdc-text-field-wrapper .mat-mdc-form-field-flex .mat-mdc-floating-label{top:16px!important;left:5px!important}.login-tile-image{height:100%!important;width:100%!important}.login-tile-title{font-weight:700!important} 3`],encapsulation:2,data:{animation:ie},changeDetection:0})}}return o})();var Ft=[{path:"",component:Ie}];export{Ft 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.