import{c as h}from"./chunk-33U2WDYB.js";import{c as p}from"./chunk-RIXYHOD2.js";import{F as a,_ as i,ea as c,g as n,ja as s,p as r}from"./chunk-7RF4FE4V.js";var j=(()=>{class o{constructor(t,e){this.http=t,this.apiService=e,this.constants={},this.constantsLoadedSubject=new n(!1),this.fetchConstants().subscribe()}fetchConstants(){return this.constantsLoadedSubject.value?r(this.constants):(console.log("response from portalProperties : "),this.apiService.portalProperties().pipe(i(t=>{console.log("response from portalProperties : "+t.status),Object.keys(t.body.portalProperties.componentsProperties).forEach(e=>{this.constants[e]=t.body.portalProperties.componentsProperties[e]}),this.constantsLoadedSubject.next(!0)}),a(this.handleError("fetchConstants"))))}getConstant(t){return this.constants[t]}areConstantsLoaded(){return this.constantsLoadedSubject.asObservable()}clearConstants(){this.constants={},this.constantsLoadedSubject.next(!1)}handleError(t="operation",e){return l=>(console.error(`${t} failed: ${l.message}`),r(e))}static{this.\u0275fac=function(e){return new(e||o)(s(p),s(h))}}static{this.\u0275prov=c({token:o,factory:o.\u0275fac,providedIn:"root"})}}return o})();export{j as a};
