@getontime/cli
Version:
Time keeping for live events
2 lines • 2.73 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]=`03a2cb70-550b-490c-a563-344311de506e`,e._sentryDebugIdIdentifier=`sentry-dbid-03a2cb70-550b-490c-a563-344311de506e`)}catch{}})();import{a as e,n as t,t as n}from"./jsx-runtime-BNC90REB.js";import{Rt as r,Ut as i,qt as a}from"./useSocket-B9-0Z7zf.js";import{t as o}from"./playbackstate-C3qVH4fY.js";import{n as s,t as c}from"./viewUtils-CulstVIy.js";var l=(e,t,n)=>{for(;e<t;){let r=Math.floor((e+t)/2);if(r===e)break;n(r)?e=r:t=r}return e},u=e(t(),1),d=n();function f({children:e,mode:t=`multi`,min:n=16,max:r=256,...i}){let a=(0,u.useRef)(null),o=(0,u.useCallback)(()=>{let e=a.current;return e?e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth:!1},[]),s=(0,u.useCallback)(()=>{let e=a.current;if(!e)return;let t=e.style.visibility;e.style.visibility=`hidden`;let i=l(n,r+1,t=>(e.style.fontSize=`${t}px`,!o()));e.style.fontSize=`${i}px`,e.style.visibility=t},[o,n,r]);return(0,u.useEffect)(()=>{let e=a.current;if(!e)return;s();let t=new ResizeObserver(s);return t.observe(e),()=>t.disconnect()},[e,t,s]),(0,d.jsx)(`div`,{ref:a,style:{whiteSpace:t===`single`?`nowrap`:`normal`},...i,children:e})}function p(e){return e.text!==``&&e.visible}function m(e){return e===i.Play||e===i.Roll}function h(e,t){return(e??0)+(t??0)}function g(e){return e!==a.None&&e!==a.Clock}function _(e){return e!==a.Clock}var v={4:28,5:28,6:25,8:18,9:18};function y(e,t){let n=e.length,r=100/(n-1)*1.25;return v[n]&&(r=v[n]),t&&(r*=.6),r}function b(e,t,n,i,o,s){return s||!(e===a.CountDown||t)?{showEndMessage:!1,showFinished:!1,showWarning:!1,showDanger:!1}:{showEndMessage:n===r.Overtime&&i&&o!==``,showFinished:n===r.Overtime,showWarning:n===r.Warning,showDanger:n===r.Danger}}function x(e,t,n,r,i,o){if(!o){if(e.timer.secondarySource===`aux1`||e.timer.secondarySource===`aux2`||e.timer.secondarySource===`aux3`)return c(t,a.CountDown,n,{removeSeconds:r,removeLeadingZero:i});if(e.timer.secondarySource===`secondary`&&e.secondary)return e.secondary}}function S(e,t,n,a,c,l,u){if(c===i.Stop)return{showNow:!1,nowMain:void 0,nowSecondary:void 0,showNext:!1,nextMain:void 0,nextSecondary:void 0};let d=o(c)&&l!==r.Pending,f=d?s(e,n??`title`):void 0,p=d?s(e,a,u):void 0,m=s(d?t:e,n??`title`),h=s(d?t:e,a,u);return{showNow:n!==`none`&&(!!f||!!p),nowMain:f,nowSecondary:p,showNext:n!==`none`&&(!!m||!!h),nextMain:m,nextSecondary:h}}export{_ as a,g as c,x as i,h as l,y as n,p as o,m as r,b as s,S as t,f as u};
//# sourceMappingURL=timer.utils-DRE1_9vU.js.map