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