UNPKG

@getontime/cli

Version:

Time keeping for live events

2 lines 9.1 kB
(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]=`bd60b747-2a52-475a-a8ea-9bad5368c39d`,e._sentryDebugIdIdentifier=`sentry-dbid-bd60b747-2a52-475a-a8ea-9bad5368c39d`)}catch{}})();import{a as e,n as t,t as n}from"./jsx-runtime-BNC90REB.js";import{$ as r,I as i,Kt as a,et as o,qt as s}from"./useSocket-B9-0Z7zf.js";import"./Button-CsttsbOH.js";import{y as c}from"./useIsSmallScreen-Db4lRgi0.js";import"./Select-CujoWFOD.js";import{K as l}from"./constants-8b9Q9Bj6.js";import"./SwatchPicker-C0WK8dMM.js";import"./viewParamsEditor.store-BcLRa99Z.js";import{r as u}from"./validateEvent-Blu2IJUG.js";import{t as d}from"./useSettings-CeUw01Bu.js";import{a as f}from"./useRundown-BubT2Cyp.js";import"./Input-D-3bhaHU.js";import{t as p}from"./PresetContext-DZh_OrO5.js";import{t as m}from"./viewOptions-z3iLoQCB.js";import"./assets-DU19UGw8.js";import{i as h,s as g,t as _}from"./index-qU8RbaVt.js";import"./Info-QUjDr4I8.js";import"./Empty-CSL3pipV.js";import{i as v,n as y,o as b,t as ee}from"./ViewParamsEditor-ZtF4EeBG.js";import{a as x,i as S,r as te,t as ne}from"./viewUtils-CulstVIy.js";import{t as C}from"./useWindowTitle-Dvj2xEXy.js";import{t as w}from"./useAutoTickingClock-CjJeDQz8.js";import{i as T,n as E,r as D,t as O}from"./common.options-DXL-8UPx.js";import"./useAnimatedProgress-DJlteBY2.js";import{t as k}from"./MultiPartProgressBar-B4jgVUIf.js";import{t as A}from"./useCustomFields-BMD3tm-0.js";import{t as j}from"./viewLoader.utils-BLkafrJE.js";import{t as M}from"./TitleCard-8FH8UfR9.js";import{t as re}from"./ViewLogo-BuLAMmbq.js";import{t as N}from"./SuperscriptTime-Byp3JLgw.js";import{t as P}from"./useProjectData-DHesqFeW.js";import{a as ie,c as ae,i as oe,l as se,n as ce,o as le,r as ue,s as de,t as fe,u as F}from"./timer.utils-DRE1_9vU.js";import{t as pe}from"./presentation.utils-Co5R9T_c.js";var I=e(t(),1),L=[{value:`no-overrides`,label:`No Overrides`},{value:s.CountUp,label:`Count Up`},{value:s.CountDown,label:`Count Down`},{value:s.Clock,label:`Clock`}],me=(e,t)=>{let n=v(t,[{value:`none`,label:`None`},{value:`title`,label:`Title`}]),r=v(t,[{value:`none`,label:`None`},{value:`title`,label:`Title`},{value:`note`,label:`Note`},{value:`parent`,label:`Group Title`}]);return[{title:y.ClockOptions,collapsible:!0,options:[O(e)]},{title:y.TimerOptions,collapsible:!0,options:[D,T,{id:`timerType`,title:`Timer type`,description:`Override the timer type`,type:`option`,values:L,defaultValue:`no-overrides`},{id:`freezeOvertime`,title:`Freeze Overtime`,description:`If active, the timer will not count into negative numbers`,type:`boolean`,defaultValue:!1},{id:`freezeMessage`,title:`Freeze Message`,description:`An optional message to show when the timer is in overtime (must be set in combination with Freeze Overtime)`,type:`string`,defaultValue:``,placeholder:`e.g. Time is up!`},{id:`hidePhase`,title:`Hide progress styles`,description:`Whether to suppress the progress styles (warning, danger and overtime)`,type:`boolean`,defaultValue:!1}]},{title:y.DataSources,collapsible:!0,options:[{id:`main`,title:`Main text`,description:`Select the data source for the main text`,type:`option`,values:n,defaultValue:`title`},{id:`secondary-src`,title:`Secondary text`,description:`Select the data source for the secondary text`,type:`option`,values:r,defaultValue:`none`}]},{title:y.ElementVisibility,collapsible:!0,options:[{id:`hideClock`,title:`Hide Time Now`,description:`Hides the Time Now field`,type:`boolean`,defaultValue:!1},{id:`hideCards`,title:`Hide Cards`,description:`Hides the Now and Next cards`,type:`boolean`,defaultValue:!1},{id:`hideProgress`,title:`Hide progress bar`,description:`Hides the progress bar`,type:`boolean`,defaultValue:!1},{id:`hideMessage`,title:`Hide Timer Message`,description:`Prevents displaying fullscreen messages in the timer`,type:`boolean`,defaultValue:!1},{id:`hideSecondary`,title:`Hide Auxiliary timer / Secondary message`,description:`Prevents the screen from displaying the secondary timer field`,type:`boolean`,defaultValue:!1},{id:`hideLogo`,title:`Hide the project logo`,description:`Prevents the screen from displaying the given project logo`,type:`boolean`,defaultValue:!1}]},{title:y.StyleOverride,collapsible:!0,options:[{id:`font`,title:`Font`,description:`Font family, will use the fonts available in the system`,type:`string`,placeholder:`Open Sans (default)`},{id:`keyColour`,title:`Key Colour`,description:`Background or key colour for entire view. Default: #101010`,type:`colour`,defaultValue:`101010`},{id:`timerColour`,title:`Timer Colour`,description:`Timer colour. Default: #f6f6f6`,type:`colour`,defaultValue:`f6f6f6`}]}]};function R(e,t){let n=n=>t?.get(n)??e.get(n),r=u(n(`timerType`),s.None);return{hideClock:S(n(`hideClock`)),hideCards:S(n(`hideCards`)),hideProgress:S(n(`hideProgress`)),hideMessage:S(n(`hideMessage`)),hideSecondary:S(n(`hideSecondary`)),hideLogo:S(n(`hideLogo`)),hideTimerSeconds:S(n(`hideTimerSeconds`)),removeLeadingZeros:!S(n(`showLeadingZeros`)),mainSource:n(`main`),secondarySource:n(`secondary-src`),timerType:r===s.None?void 0:r,freezeOvertime:S(n(`freezeOvertime`)),freezeMessage:n(`freezeMessage`)??``,hidePhase:S(n(`hidePhase`)),font:n(`font`)??void 0,keyColour:x(n(`keyColour`)),timerColour:x(n(`timerColour`)),timeformat:E(e,t)}}function z(){let[e]=c(),t=(0,I.use)(p);return(0,I.useMemo)(()=>R(e,t?new URLSearchParams(t.search):void 0),[t,e])}function B(){let e=m(e=>e.mirror),{data:t,status:n}=P(),{data:r,status:i}=h(),{data:a,status:o}=d(),{data:s,status:c}=A(),{data:l,status:u}=f(),{entries:p}=l;return{data:{customFields:s,projectData:t,isMirrored:e,settings:a,viewSettings:r,entries:p},status:j([n,i,o,c,u])}}var V=n();function H(){let{data:e,status:t}=B();return C(`Timer`),t===`pending`?(0,V.jsx)(g,{}):t===`error`?(0,V.jsx)(b,{variant:`error`,text:`There was an error fetching data, please refresh the page.`}):(0,V.jsx)(U,{...e})}function U({customFields:e,projectData:t,isMirrored:n,settings:r,viewSettings:c,entries:u}){let{eventNext:d,eventNow:f,message:p,time:m,clock:h,timerTypeNow:g,countToEndNow:v,auxTimer:y}=i(),{hideClock:b,hideCards:x,hideProgress:S,hideMessage:C,hideSecondary:w,hideLogo:T,hideTimerSeconds:E,removeLeadingZeros:D,mainSource:O,secondarySource:A,timerType:j,freezeOvertime:N,freezeMessage:P,hidePhase:L,font:R,keyColour:B,timerColour:H,timeformat:U}=z(),{getLocalizedString:ge}=_(),W=ge(`common.minutes`),G=j??g,K=le(p.timer),{showEndMessage:_e,showFinished:q,showWarning:ve,showDanger:ye}=de(g,v,m.phase,N,P,L),J=ue(m.playback),be=!b&&ie(G),xe=!S&&ae(G),{showNow:Se,nowMain:Ce,nowSecondary:we,showNext:Y,nextMain:Te,nextSecondary:Ee}=fe(f,d,O,A,m.playback,m.phase,u),De=se(m.duration,m.addedTime),X=ne(te(N,g,h,m,j),G,W,{removeSeconds:E,removeLeadingZero:D,clockFormat:U}),Z=oe(p,p.timer.secondarySource===`aux1`?y.aux1:p.timer.secondarySource===`aux2`?y.aux2:p.timer.secondarySource===`aux3`?y.aux3:null,W,E,D,w),Q=pe(c,H,ve,ye),Oe=ce(X,Z),ke=!J&&G!==s.Clock,Ae={...B&&{"--timer-bg":B},...Q&&{"--timer-colour":Q},...R&&{"--timer-font":R}},$=o(r?.timeFormat),je=(0,I.useMemo)(()=>me($,e),[e,$]);return(0,V.jsxs)(`div`,{"data-testid":`timer-view`,className:l([`stage-timer`,n&&`mirror`,q&&`stage-timer--finished`]),style:Ae,children:[!T&&t?.logo&&(0,V.jsx)(re,{name:t.logo,className:`logo`}),(0,V.jsx)(ee,{target:a.Timer,viewOptions:je}),(0,V.jsx)(`div`,{className:l([`blackout`,p.timer.blackout&&`blackout--active`])}),!C&&(0,V.jsx)(`div`,{className:l([`message-overlay`,K&&`message-overlay--active`]),children:(0,V.jsx)(F,{mode:`multi`,min:32,max:256,className:l([`message`,p.timer.blink&&`blink`]),children:p.timer.text})}),be&&(0,V.jsx)(he,{clockFormat:U}),(0,V.jsxs)(`div`,{className:l([`timer-container`,p.timer.blink&&!K&&`blink`]),children:[_e?(0,V.jsx)(F,{mode:`multi`,min:64,max:256,className:`end-message`,children:P}):(0,V.jsx)(`div`,{className:l([`timer`,ke&&`timer--paused`,q&&`timer--finished`]),style:{fontSize:`${Oe}vw`},"data-type":G,"data-phase":m.phase,children:X}),(0,V.jsx)(`div`,{className:l([`secondary`,!Z&&`secondary--hidden`]),children:(0,V.jsx)(F,{mode:`multi`,min:64,max:256,children:Z})})]}),xe&&(0,V.jsx)(k,{className:l([`progress-container`,!J&&`progress-container--paused`]),now:m.current,complete:De,eventId:f?.id,normalColor:c.normalColor,warning:f?.timeWarning,warningColor:c.warningColor,danger:f?.timeDanger,dangerColor:c.dangerColor,hideOvertime:!q}),!x&&(0,V.jsxs)(V.Fragment,{children:[Se&&(0,V.jsx)(M,{className:`event now`,label:`now`,title:Ce,secondary:we}),Y&&(0,V.jsx)(M,{className:`event next`,label:`next`,title:Te,secondary:Ee})]})]})}function he({clockFormat:e}){let t=r(w(),{override:e}),{getLocalizedString:n}=_();return(0,V.jsxs)(`div`,{className:`clock-container`,children:[(0,V.jsx)(`div`,{className:`label`,children:n(`common.time_now`)}),(0,V.jsx)(N,{time:t,className:`clock`})]})}export{H as default}; //# sourceMappingURL=Timer-MRoPksfe.js.map