import{d}from"./chunk-7EAWKBIV.js";import{g as y}from"./chunk-V64RF3DS.js";import{$b as a,I as l,_b as o}from"./chunk-ATD4AEXQ.js";import{Kc as p,Qc as u,Ua as f,ca as s,da as c,fa as r}from"./chunk-BXH3QC5E.js";var M=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=f({type:i});static \u0275inj=c({imports:[p]})}return i})();var v=(()=>{class i{restService;constructor(e){this.restService=e}getSystemSettingsForBusinessUnit(e){let t=new u;return t=t.append("businessUnitID",e),this.restService.get(l.SYSTEM_SETTINGS,t)}static \u0275fac=function(t){return new(t||i)(r(d))};static \u0275prov=s({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var h=(()=>{class i{systemSettingsService;constructor(e){this.systemSettingsService=e}getSystemSettingsForBusinessUnit(e){return this.systemSettingsService.getSystemSettingsForBusinessUnit(e)}static \u0275fac=function(t){return new(t||i)(r(v))};static \u0275prov=s({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var S=(()=>{class i{systemSettingsFacade;loggingService;systemSettingsMap=new Map;constructor(e,t){this.systemSettingsFacade=e,this.loggingService=t}loadSystemSettings(e){return a.isNullOrUndefined(this.systemSettingsMap.get(e))?new Promise((t,g)=>{this.systemSettingsFacade.getSystemSettingsForBusinessUnit(e).subscribe({next:n=>{this.systemSettingsMap.set(e,n),t(n)},error:n=>{g(n)}})}):this.systemSettingsMap.get(e)}getSystemSetting(e){return this.getSystemSettingForBusinessUnit(e,o.getBusinessUnit().id)}getSystemSettingForBusinessUnit(e,t){return a.isNullOrUndefined(this.systemSettingsMap)||a.isNullOrUndefined(this.systemSettingsMap.get(t))?null:this.systemSettingsMap.get(t).find(g=>g.name===e)}getBooleanSettingValue(e){let t=this.getSystemSetting(e);return t.typeOfValue==="B"?t.value==="Y":(this.loggingService.error(t.name+" is not boolean"),!1)}getStringSettingValue(e){let t=this.getSystemSetting(e);return t.typeOfValue==="S"?t.value!==""?t.value:"":(this.loggingService.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;this.loggingService.error(t.name+" is not a number")}clearSystemSettingsMap(){this.systemSettingsMap.clear()}static \u0275fac=function(t){return new(t||i)(r(h),r(y))};static \u0275prov=s({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var b=(()=>{class i{systemSettingsManager;constructor(e){this.systemSettingsManager=e}resolve(){return this.systemSettingsManager.loadSystemSettings(o.getBusinessUnit().id)}static \u0275fac=function(t){return new(t||i)(r(S))};static \u0275prov=s({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();export{M as a,S as b,b as c};
