import{d}from"./chunk-H2B22MYX.js";import{Pc as y,U as s,V as f,X as r,_b as u,aa as p,ac as l,of as a,p as o,pf as m}from"./chunk-HONMJZOB.js";var M=(()=>{class i{static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275mod=p({type:i})}static{this.\u0275inj=f({imports:[u]})}}return i})();var h=(()=>{class i{constructor(e){this.restService=e}getSystemSettingsForBusinessUnit(e){let t=new l;return t=t.append("businessUnitID",e),this.restService.get(y.SYSTEM_SETTINGS,t)}static{this.\u0275fac=function(t){return new(t||i)(r(d))}}static{this.\u0275prov=s({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var v=(()=>{class i{constructor(e){this.systemSettingsService=e}getSystemSettingsForBusinessUnit(e){return this.systemSettingsService.getSystemSettingsForBusinessUnit(e)}static{this.\u0275fac=function(t){return new(t||i)(r(h))}}static{this.\u0275prov=s({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var g=(()=>{class i{constructor(e){this.systemSettingsFacade=e,this.systemSettingsMap=new Map}loadSystemSettings(e){return m.isNullOrUndefined(this.systemSettingsMap.get(e))?new Promise((t,c)=>{this.systemSettingsFacade.getSystemSettingsForBusinessUnit(e).subscribe({next:n=>{this.systemSettingsMap.set(e,n),t(n)},error:n=>{c(n)}})}):this.systemSettingsMap.get(e)}getSystemSetting(e){return this.getSystemSettingForBusinessUnit(e,a.getBusinessUnit().id)}getSystemSettingForBusinessUnit(e,t){return m.isNullOrUndefined(this.systemSettingsMap)||m.isNullOrUndefined(this.systemSettingsMap.get(t))?null:this.systemSettingsMap.get(t).find(c=>c.name===e)}getBooleanSettingValue(e){let t=this.getSystemSetting(e);return t.typeOfValue==="B"?t.value==="Y":(o(()=>new Error(t.name+" is not boolean")),!1)}getStringSettingValue(e){let t=this.getSystemSetting(e);return t.typeOfValue==="S"?t.value!==""?t.value:"":(o(()=>new Error(t.name+" is not string")),"")}getNumberSettingValue(e){let t=this.getSystemSetting(e);if(t.typeOfValue==="I"||t.typeOfValue==="F"||t.typeOfValue==="L")return t.value!==""?Number(t.value):void 0;o(()=>new Error(t.name+" is not a number"))}clearSystemSettingsMap(){this.systemSettingsMap.clear()}static{this.\u0275fac=function(t){return new(t||i)(r(v))}}static{this.\u0275prov=s({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var I=(()=>{class i{constructor(e){this.systemSettingsManager=e}resolve(){return this.systemSettingsManager.loadSystemSettings(a.getBusinessUnit().id)}static{this.\u0275fac=function(t){return new(t||i)(r(g))}}static{this.\u0275prov=s({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();export{M as a,g as b,I as c};
