@getontime/cli
Version:
Time keeping for live events
2 lines • 1.89 kB
JavaScript
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`f14ad0099eab1969fdd065b56af5fdd3cf530de6`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`c3836148-4b78-4759-95a7-2ccf6132333a`,e._sentryDebugIdIdentifier=`sentry-dbid-c3836148-4b78-4759-95a7-2ccf6132333a`)}catch{}})();import{Ct as e,St as t,wt as n}from"./useSocket-B9-0Z7zf.js";function r(r){let{isAM:c,isPM:l,value:u}=o(r.toLowerCase()),d=a(u);if(d!==null)return d;let[f,p,m]=u.split(/[\s,:.]+/),h=0,g=l;if(f!=null&&p!=null&&m!=null){let r=s(f);r===12&&(c&&(r=0),g=!1),h=r*t,h+=s(p)*e,h+=s(m)*n}else if(f!=null&&p==null&&m==null){let{inferredMillis:e,addAM:t}=i(f,c,l);h=e,g=t<12&&l}else if(f!=null&&p!=null&&m==null){let n=s(f);n===12&&(c&&(n=0),g=!1),h=n*t,h+=s(p)*e}return g&&(h+=12*t),h}function i(r,i,a){let o=r.length,c=0,l=0;if(o===1)a||i?(c=s(r)*t,i&&(l=c)):c=s(r)*e;else if(o===2)a||i?(c=r===`12`&&i?0:s(r)*t,(i||r===`12`)&&(l=12)):c=s(r)*e;else if(o===3)c=s(r[0])*t+s(r.substring(1))*e;else if(o===4)c=s(r.substring(0,2))*t+s(r.substring(2))*e;else if(o>=5){let i=s(r.substring(0,2)),a=s(r.substring(2,4)),o=s(r.substring(4));c=i*t+a*e+o*n}return{inferredMillis:c,addAM:l}}function a(r){let i=/(\d+)h(?:(\d+)(?!s))?/i.exec(r),a=i?s(i[1]):0,o=i?.[2]?s(i[2]):0,c=/(\d+)m(?:(\d+)?)/i.exec(r),l=c?s(c[1]):o,u=c?.[2]?s(c[2]):0,d=/(\d+)s/i.exec(r),f=d?s(d[1]):u;return i||c||d?a*t+l*e+f*n:null}function o(e){return e.endsWith(`pm`)?{isAM:!1,isPM:!0,value:e.slice(0,-2)}:e.endsWith(`p`)?{isAM:!1,isPM:!0,value:e.slice(0,-1)}:e.endsWith(`am`)?{isAM:!0,isPM:!1,value:e.slice(0,-2)}:e.endsWith(`a`)?{isAM:!0,isPM:!1,value:e.slice(0,-1)}:{isAM:!1,isPM:!1,value:e}}function s(e){let t=Number(e);return isNaN(t)?0:Math.abs(t)}export{r as t};
//# sourceMappingURL=parseUserTime-CtxwbCYB.js.map