import{a$ as O,b0 as x,b1 as C,m as p,b2 as R,_ as Y,b3 as d,b4 as r,b5 as f,b6 as S,b7 as U,h as u,ao as h,aZ as P,t as z,aO as j,l as Z}from"./index-BKr2rJhV.js";import{a as A}from"./addDays-DjM7nKyN.js";import{a as c}from"./always-CtAmwIxm.js";import{i as q}from"./init-BDcDHUTz.js";import{c as B}from"./concat-AxOj0lUI.js";import{f as G}from"./formatDistance-qDinyJzC.js";var J=function(){return!0};const K={"@@functional/placeholder":!0};var Q=O(function(t){var s=x(C,0,p(function(e){return e[0].length},t));return R(s,function(){for(var e=0;e<t.length;){if(t[e][0].apply(this,arguments))return t[e][1].apply(this,arguments);e+=1}})}),V=O(function(t){for(var s={},e=0;e<t.length;)s[t[e][0]]=t[e][1],e+=1;return s}),M=Y(function(t,s){return t<=s}),X=Y(function(t,s){return s.match(t)||[]});function I(n,t){const s=d(n);if(isNaN(t))return r(n,NaN);if(!t)return s;const e=s.getDate(),o=r(n,s.getTime());o.setMonth(s.getMonth()+t+1,0);const a=o.getDate();return e>=a?o:(s.setFullYear(o.getFullYear(),o.getMonth(),e),s)}function v(n,t){const{years:s=0,months:e=0,weeks:o=0,days:a=0,hours:i=0,minutes:y=0,seconds:g=0}=t,m=d(n),l=e||s?I(m,e+s*12):m,D=a||o?A(l,a+o*7):l,N=y+i*60,F=(g+N*60)*1e3;return r(n,D.getTime()+F)}const L=f(v,2);function W(n,t){const s=S(n),e=S(t);return+s==+e}const tt=f(U,2),nt=f(G,2);function st(n){const t=d(n),s=t.getFullYear(),e=t.getMonth(),o=r(n,0);return o.setFullYear(s,e+1,0),o.setHours(0,0,0,0),o.getDate()}function $(n,t){return A(n,-t)}function et(n,t){const s=d(n),e=s.getFullYear(),o=s.getDate(),a=r(n,0);a.setFullYear(e,t,15),a.setHours(0,0,0,0);const i=st(a);return s.setMonth(t,Math.min(o,i)),s}function ot(n,t){let s=d(n);return isNaN(+s)?r(n,NaN):(t.year!=null&&s.setFullYear(t.year),t.month!=null&&(s=et(s,t.month)),t.date!=null&&s.setDate(t.date),t.hours!=null&&s.setHours(t.hours),t.minutes!=null&&s.setMinutes(t.minutes),t.seconds!=null&&s.setSeconds(t.seconds),t.milliseconds!=null&&s.setMilliseconds(t.milliseconds),s)}const T=f(ot,2);function at(n,t){return I(n,-t)}function rt(n,t){const{years:s=0,months:e=0,weeks:o=0,days:a=0,hours:i=0,minutes:y=0,seconds:g=0}=t,m=at(n,e+s*12),l=$(m,a+o*7),D=y+i*60,_=(g+D*60)*1e3;return r(n,l.getTime()-_)}const E=f(rt,2);function H(n){return r(n,Date.now())}function it(n){return W(n,H(n))}function ct(n){return W(n,$(H(n),1))}const ut="yyyy-MM-dd",dt="yyyy-MM-dd HH:mm:ss",b=h(dt),Tt=h(ut),bt=n=>{const s=n.getMinutes()<30?T({minutes:30},n):L({hours:1},T({minutes:0},n));return T({seconds:0},s)},k=new Date().getTimezoneOffset(),wt=n=>L({minutes:k},n),Nt=n=>E({minutes:k},n),_t=n=>{if(n==="")throw new RangeError("Invalid time value");const t=Number(n);return Number.isNaN(t)?b(n):String(t).length<=13&&String(t).length>=10?b(t*10**(13-String(t).length)):String(t).length===16&&P("000",String(t))?b(t*10**-3):t},w=tt(new Date),Ft=Q([[it,c("Today")],[ct,c("Yesterday")],[u(w,M(-7)),c("Last 7 days")],[u(w,M(-30)),c("Last 30 days")],[u(w,M(-365)),h("MMMM")],[J,h("Y")]]),ft=n=>({m:"minutes",h:"hours",d:"days",w:"weeks",M:"months",y:"years"})[n],St=u(j(Z,c("")),X(/(\d+\w)/g),p(n=>[ft(z(n)),Number(q(n))]),V),Ot=n=>u(nt(new Date),B(K," ago"))(E(n,new Date));export{dt as D,J as T,Nt as U,K as _,b as a,E as b,Q as c,H as d,v as e,Tt as f,Ft as g,_t as h,St as i,L as j,Ot as k,wt as l,X as m,bt as n,V as o,rt as s,k as t};
