import{a as e,c as t,i as n,l as r,m as i,n as a,o,p as s,r as c,u as l}from"./zh-CN-1C50nlOa.js";function u(e,t){let n=r(e)-+r(t);return n<0?-1:n>0?1:n}function d(e){return l(e,Date.now())}function f(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function p(e,t){return r(e)-+r(t)}function m(e,t){let n=r(e,t?.in);return n.setHours(23,59,59,999),n}function h(e,t){let n=r(e,t?.in);return+m(n,t)==+c(n,t)}function g(t,r,i){let[a,o,s]=e(i?.in,t,t,r),c=u(o,s),l=Math.abs(n(o,s));if(l<1)return 0;o.getMonth()===1&&o.getDate()>27&&o.setDate(30),o.setMonth(o.getMonth()-c*l);let d=u(o,s)===-c;h(a)&&l===1&&u(a,s)===1&&(d=!1);let f=c*(l-+d);return f===0?0:f}function _(e,t,n){let r=p(e,t)/1e3;return f(n?.roundingMethod)(r)}function v(n,r,c){let l=t(),d=c?.locale??l.locale??a,f=u(n,r);if(isNaN(f))throw RangeError(`Invalid time value`);let p=Object.assign({},c,{addSuffix:c?.addSuffix,comparison:f}),[m,h]=e(c?.in,...f>0?[r,n]:[n,r]),v=_(h,m),y=(o(h)-o(m))/1e3,b=Math.round((v-y)/60),x;if(b<2)return c?.includeSeconds?v<5?d.formatDistance(`lessThanXSeconds`,5,p):v<10?d.formatDistance(`lessThanXSeconds`,10,p):v<20?d.formatDistance(`lessThanXSeconds`,20,p):v<40?d.formatDistance(`halfAMinute`,0,p):v<60?d.formatDistance(`lessThanXMinutes`,1,p):d.formatDistance(`xMinutes`,1,p):b===0?d.formatDistance(`lessThanXMinutes`,1,p):d.formatDistance(`xMinutes`,b,p);if(b<45)return d.formatDistance(`xMinutes`,b,p);if(b<90)return d.formatDistance(`aboutXHours`,1,p);if(b<1440){let e=Math.round(b/60);return d.formatDistance(`aboutXHours`,e,p)}else if(b<2520)return d.formatDistance(`xDays`,1,p);else if(b<43200){let e=Math.round(b/s);return d.formatDistance(`xDays`,e,p)}else if(b<43200*2)return x=Math.round(b/i),d.formatDistance(`aboutXMonths`,x,p);if(x=g(h,m),x<12){let e=Math.round(b/i);return d.formatDistance(`xMonths`,e,p)}else{let e=x%12,t=Math.trunc(x/12);return e<3?d.formatDistance(`aboutXYears`,t,p):e<9?d.formatDistance(`overXYears`,t,p):d.formatDistance(`almostXYears`,t+1,p)}}function y(e,t){return v(e,d(e),t)}export{y as t};