{"version":3,"file":"react-timer-hook-BY-X-Yfa.js","sources":["../../node_modules/react-timer-hook/dist/index.js"],"sourcesContent":["!function(e,t){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=t(require(\"react\")):\"function\"==typeof define&&define.amd?define([\"react\"],t):\"object\"==typeof exports?exports[\"react-timer-hook\"]=t(require(\"react\")):e[\"react-timer-hook\"]=t(e.react)}(\"undefined\"!=typeof self?self:this,(e=>(()=>{\"use strict\";var t={155:t=>{t.exports=e}},r={};function o(e){var n=r[e];if(void 0!==n)return n.exports;var s=r[e]={exports:{}};return t[e](s,s.exports,o),s.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})};var n={};o.r(n),o.d(n,{default:()=>f,useStopwatch:()=>d,useTime:()=>p,useTimer:()=>l});var s=o(155);class i{static expiryTimestamp(e){const t=new Date(e).getTime()>0;return t||console.warn(\"react-timer-hook: { useTimer } Invalid expiryTimestamp settings\",e),t}static onExpire(e){const t=e&&\"function\"==typeof e;return e&&!t&&console.warn(\"react-timer-hook: { useTimer } Invalid onExpire settings function\",e),t}}class a{static getTimeFromSeconds(e){const t=Math.ceil(e),r=Math.floor(t/86400),o=Math.floor(t%86400/3600),n=Math.floor(t%3600/60);return{totalSeconds:t,seconds:Math.floor(t%60),minutes:n,hours:o,days:r}}static getSecondsFromExpiry(e,t){const r=e-(new Date).getTime();if(r>0){const e=r/1e3;return t?Math.round(e):e}return 0}static getSecondsFromPrevTime(e,t){const r=(new Date).getTime()-e;if(r>0){const e=r/1e3;return t?Math.round(e):e}return 0}static getSecondsFromTimeNow(){const e=new Date;return e.getTime()/1e3-60*e.getTimezoneOffset()}static getFormattedTimeFromSeconds(e,t){const{seconds:r,minutes:o,hours:n}=a.getTimeFromSeconds(e);let s=\"\",i=n;return\"12-hour\"===t&&(s=n>=12?\"pm\":\"am\",i=n%12),{seconds:r,minutes:o,hours:i,ampm:s}}}function c(e,t){const r=(0,s.useRef)();(0,s.useEffect)((()=>{r.current=e})),(0,s.useEffect)((()=>{if(!t)return()=>{};const e=setInterval((()=>{r.current&&r.current()}),t);return()=>clearInterval(e)}),[t])}const u=1e3;function m(e){if(!i.expiryTimestamp(e))return null;const t=a.getSecondsFromExpiry(e),r=Math.floor(1e3*(t-Math.floor(t)));return r>0?r:u}function l(){let{expiryTimestamp:e,onExpire:t,autoStart:r=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[o,n]=(0,s.useState)(e),[l,d]=(0,s.useState)(a.getSecondsFromExpiry(o)),[p,f]=(0,s.useState)(r),[g,S]=(0,s.useState)(r),[T,y]=(0,s.useState)(m(o)),h=(0,s.useCallback)((()=>{i.onExpire(t)&&t(),f(!1),y(null)}),[t]),x=(0,s.useCallback)((()=>{f(!1)}),[]),v=(0,s.useCallback)((function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];y(m(e)),S(t),f(t),n(e),d(a.getSecondsFromExpiry(e))}),[]),F=(0,s.useCallback)((()=>{const e=new Date;e.setMilliseconds(e.getMilliseconds()+1e3*l),v(e)}),[l,v]),b=(0,s.useCallback)((()=>{g?(d(a.getSecondsFromExpiry(o)),f(!0)):F()}),[o,g,F]);return c((()=>{T!==u&&y(u);const e=a.getSecondsFromExpiry(o);d(e),e<=0&&h()}),p?T:null),{...a.getTimeFromSeconds(l),start:b,pause:x,resume:F,restart:v,isRunning:p}}function d(){let{autoStart:e,offsetTimestamp:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[r,o]=(0,s.useState)(a.getSecondsFromExpiry(t,!0)||0),[n,i]=(0,s.useState)(new Date),[u,m]=(0,s.useState)(r+a.getSecondsFromPrevTime(n||0,!0)),[l,d]=(0,s.useState)(e);c((()=>{m(r+a.getSecondsFromPrevTime(n,!0))}),l?1e3:null);const p=(0,s.useCallback)((()=>{const e=new Date;i(e),d(!0),m(r+a.getSecondsFromPrevTime(e,!0))}),[r]),f=(0,s.useCallback)((()=>{o(u),d(!1)}),[u]),g=(0,s.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const r=a.getSecondsFromExpiry(e,!0)||0,n=new Date;i(n),o(r),d(t),m(r+a.getSecondsFromPrevTime(n,!0))}),[]);return{...a.getTimeFromSeconds(u),start:p,pause:f,reset:g,isRunning:l}}function p(){let{format:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[t,r]=(0,s.useState)(a.getSecondsFromTimeNow());return c((()=>{r(a.getSecondsFromTimeNow())}),1e3),{...a.getFormattedTimeFromSeconds(t,e)}}function f(e){if((0,s.useEffect)((()=>{console.warn(\"react-timer-hook: default export useTimer is deprecated, use named exports { useTimer, useStopwatch, useTime } instead\")}),[]),e.expiryTimestamp){const t=l(e);return{...t,startTimer:t.start,stopTimer:t.pause,resetTimer:()=>{}}}const t=d(e);return{...t,startTimer:t.start,stopTimer:t.pause,resetTimer:t.reset}}return n})()));"],"names":["e","t","module","require$$0","this","r","o","n","s","f","d","p","l","i","a","c","u","m","S","T","h","x","v","F","b","g"],"mappings":"6bAAC,SAASA,EAAEC,EAAE,CAAmDC,EAAA,QAAeD,EAAEE,CAAgB,CAAqK,GAAe,OAAO,KAApB,IAAyB,KAAKC,EAAMJ,IAAI,IAAI,CAAc,IAAIC,EAAE,CAAC,IAAIA,GAAG,CAACA,EAAE,QAAQD,CAAC,CAAC,EAAEK,EAAE,CAAA,EAAG,SAASC,EAAEN,EAAE,CAAC,IAAIO,EAAEF,EAAEL,CAAC,EAAE,GAAYO,IAAT,OAAW,OAAOA,EAAE,QAAQ,IAAIC,EAAEH,EAAEL,CAAC,EAAE,CAAC,QAAQ,CAAA,C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