import{a as p}from"./chunk-QJMD2SGW.js";import{i as m}from"./chunk-WTUSPDMW.js";import{f as u}from"./chunk-3H2Q52KW.js";import{G as a,_ as c,ca as h,g as n,ha as o,p as s}from"./chunk-DF3EMM3Z.js";var T=(()=>{class i{constructor(e,t,r){this.http=e,this.apiService=t,this.idleTimeoutService=r,this.constants={},this.constantsLoadedSubject=new n(!1),this.enableTimeout=!1,this.timeoutDuration=20,this.fetchConstants().subscribe()}fetchConstants(){return this.constantsLoadedSubject.value?s(this.constants):this.apiService.portalProperties().pipe(c(e=>{Object.keys(e.body.portalProperties.componentsProperties).forEach(t=>{this.constants[t]=e.body.portalProperties.componentsProperties[t],t==="ENABLE_IDEAL_TIMEOUT"&&(this.enableTimeout=e.body.portalProperties.componentsProperties[t]),t==="IDEAL_TIMEOUT"&&(this.timeoutDuration=e.body.portalProperties.componentsProperties[t])}),this.enableTimeout==!0?(this.idleTimeoutService.setTimeoutDuration(this.timeoutDuration*60*1e3),this.idleTimeoutService.start()):this.idleTimeoutService.stop(),this.constantsLoadedSubject.next(!0)}),a(this.handleError("fetchConstants")))}getConstant(e){return this.constants[e]}areConstantsLoaded(){return this.constantsLoadedSubject.asObservable()}clearConstants(){this.constants={},this.constantsLoadedSubject.next(!1)}handleError(e="operation",t){return r=>(console.error(`${e} failed: ${r.message}`),s(t))}static{this.\u0275fac=function(t){return new(t||i)(o(u),o(m),o(p))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();export{T as a};
