let e=(e,n)=>{let r=t(e);return{week:r.weeks,day:n.enableWeek?r.days:r.totalDays,hour:n.enableDay?r.hours:r.totalHours,minute:n.enableHour||n.enableDay||n.enableWeek?r.minutes:r.totalMinutes,second:n.enableMinute||n.enableHour||n.enableDay||n.enableWeek?r.seconds:r.totalSeconds}},t=e=>({seconds:e%60,minutes:Math.floor(e/60)%60,hours:Math.floor(e/60/60)%24,days:Math.floor(e/60/60/24)%7,weeks:Math.floor(e/60/60/24/7),months:Math.floor(e/60/60/24/30.4368),totalDays:Math.floor(e/60/60/24),totalHours:Math.floor(e/60/60),totalMinutes:Math.floor(e/60),totalSeconds:e}),n=e=>Number.isNaN(e)||0===e?"00":e<10?`0${e}`:e,r=e=>{let t=new Date().getTime();e||(e=a(0,3,0));let n=Math.ceil((e-t)/1e3);return n>0?n:0},a=(e,t,n)=>{let r=new Date,a=new Date;return r.setDate(a.getDate()+e),r.setHours(a.getHours()+t),r.setMinutes(a.getMinutes()+n),r.setSeconds(a.getSeconds()),r.getTime()},l=(e,t,n)=>{let r=new Date,a=f(`${e}:${t} ${n}`);e=a.hours,t=a.mins;let l=new Date(r.getFullYear(),r.getMonth(),r.getDate(),e,t).getTime(),s=l-r.getTime();return s<0&&(s+=864e5),Math.ceil(s/1e3)},s=(e,t,n)=>r(m(e,t,n)),o=e=>{let t=e?.match(/([+-]\d{2}):(\d{2})$/);if(t?.[1]&&t?.[2]){let e=parseInt(t[1]),n=parseInt(t[2]);return-(60*e+(e>=0?n:-n))}let n=e?.match(/GMT([+-])(\d{2})(\d{2})/);if(n?.[1]&&n?.[2]&&n?.[3]){let e="+"===n[1]?-1:1,t=parseInt(n[2])*e,r=parseInt(n[3])*e;return 60*t+r}return null},i=(e,t)=>{let n=new Date().getTimezoneOffset();return(e=new Date(e.getTime()-6e4*n-36e5*t)).getTime()},u=({endTime:e,timezoneNumber:t,standardType:n})=>{let r=new Date(e);if("specific-time-zone"===n){let n="string"==typeof e?o(e):null;return n?r.getTime()-(n- -(60*t))*6e4:r.getTime()}let a=new Date().getTimezoneOffset(),l="string"==typeof e?o(e):null;return l?r.getTime()+(a-l)*6e4:r.getTime()},m=(e,t,n)=>{if(!e)return 0;let r=new Date(e),a=0;a=t&&parseInt(t)?parseInt(t):parseInt(t.slice(3));let l="number"==typeof e||"string"==typeof e&&e.includes("Z");return l?i(r,a):u({endTime:e,timezoneNumber:a,standardType:n})},g=e=>{let{days:t,hours:n,mins:r,seconds:a=0}=e;return(t??0)*86400+(n??0)*3600+(r??0)*60+(a??0)},d=(e,t)=>{let n=new Date().getTime(),r=(86400*t.days+3600*t.hours+60*t.mins)*1e3;return Math.ceil((r-(n-e)%r)/1e3)},f=e=>{let[t,n,r]=e.toLowerCase().match(/\d+|[a-z]+/g)||[],a=`${Number(t)%12+("am"==r?0:12)}:${n}`.split(":");return{hours:parseInt(a[0]?a[0]:"0"),mins:parseInt(a[1]?a[1]:"0")}};export{r as calculateTime,e as convertTime,l as daily,g as evergreen,n as formatTime,a as getEndTime,m as getStandardEndtime,d as refreshAfterFinish,s as standard};
