import{a as u}from"./chunk-42NRCBQQ.js";import{a as i}from"./chunk-3DEA4WWC.js";import{Fa as d,Tc as g,na as c,qa as l}from"./chunk-GJDGQISV.js";var y=class s{constructor(t){this.serverTimeService=t;this.bindDataDaysRange()}dataDaysRange=d(0);daysRange=g(()=>this.dataDaysRange());bindDataDaysRange(){let t=localStorage.getItem("DataDaysRange"),e=t?parseInt(t):0;this.dataDaysRange.set(e-1)}getFromDateValidation(t){if(this.checkValidDate(t)){let a=new Date(t).setDate(new Date(t).getDate()-this.dataDaysRange());return new Date(a)}else return null}getToDateValidation(t){return this.checkValidDate(t)?new Date(t).setDate(new Date(t).getDate()+this.dataDaysRange()):null}getDateValidation(t){let e=this.serverTimeService.now();t=this.isValidDate(t)?new Date(t):null;let a=this.getFromDateValidation(e),D=this.getToDateValidation(t),o=a,n=t&&new Date(t),r=D?new Date(D):null,m=r||this.calculateToDate(t);return{fromMinDate:o,toMinDate:n,toMaxDate:r,toDate:m}}isValidDate(t){return i.IsNotEmpty(t)&&i.MinDate!==t}calculateToDate(t){if(!t)return null;let a=this.serverTimeService.now().getTime(),o=(t?t.getTime():null)>a,n=new Date;return o&&(n=t),n}checkValidDate(t){return t!==i.MinDate&&i.IsNotEmpty(t)&&this.dataDaysRange()!=-1}get isHideClearDateBtn(){return this.daysRange()!=-1}static \u0275fac=function(e){return new(e||s)(l(u))};static \u0275prov=c({token:s,factory:s.\u0275fac,providedIn:"root"})};export{y as a};
