UNPKG

@getontime/cli

Version:
3 lines (2 loc) 8.38 kB
import{l as fe,h as x,j as o}from"./vendor-q6fv0YT2.js";import{P as he,T as c,u as ye,a as ve,b as Te,L as be,c as xe,d as we,f as Se,g as Ce,e as m,O as ke}from"./index-B81u4hxi.js";import{g as Oe,a as Ne,b as Pe,c as je,d as Me,e as Ve,f as Fe,h as ze,i as Le,F as b}from"./timer.utils-rGyI9NYa.js";import{M as De}from"./MultiPartProgressBar-BXdLxJpy.js";import{E as Ee}from"./EmptyPage-Bc358YpE.js";import{T as E}from"./TitleCard-Xdr7xwzU.js";import{V as He}from"./ViewLogo-G7EosFIr.js";import{m as H,O as p,V as Ie}from"./ViewParamsEditor-C2-TRP6e.js";import{u as Be}from"./useWindowTitle-Bpmo_HzW.js";import{S as Ze}from"./SuperscriptTime-CA6S2R55.js";import{m as I,i as n,g as _e,a as We}from"./viewUtils-B8Dr4GHH.js";import{g as Ae}from"./presentation.utils-Cl-L3pHN.js";import{g as Ue,h as Re,s as Ke,a as Qe}from"./viewLoader.utils-b42scp-I.js";import{v as $e}from"./validateEvent-Do8yE_DJ.js";import{u as qe}from"./useCustomFields-k4piRt9n.js";import{u as Ge}from"./useProjectData-DdgKoYzk.js";import"./playbackstate-CPQdnF-k.js";import"./getProgress-cLuBFPjh.js";import"./Empty-CJbZxh45.js";import"./Select-BGGVCKqU.js";import"./SwatchPicker-Cm5Eicvv.js";/* empty css */(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new s.Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="6f9f8085-43f9-4070-9ad8-01a1c8d7f187",s._sentryDebugIdIdentifier="sentry-dbid-6f9f8085-43f9-4070-9ad8-01a1c8d7f187")}catch{}})();const Je=[{value:"no-overrides",label:"No Overrides"},{value:c.CountUp,label:"Count Up"},{value:c.CountDown,label:"Count Down"},{value:c.Clock,label:"Clock"}],Xe=(s,t)=>{const e=H(t,[{value:"none",label:"None"},{value:"title",label:"Title"},{value:"note",label:"Note"}]),i=H(t,[{value:"none",label:"None"},{value:"title",label:"Title"},{value:"note",label:"Note"}]);return[{title:p.ClockOptions,collapsible:!0,options:[Ue(s)]},{title:p.TimerOptions,collapsible:!0,options:[Re,Ke,{id:"timerType",title:"Timer type",description:"Override the timer type",type:"option",values:Je,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:p.DataSources,collapsible:!0,options:[{id:"main",title:"Main text",description:"Select the data source for the main text",type:"option",values:e,defaultValue:"title"},{id:"secondary-src",title:"Secondary text",description:"Select the data source for the secondary text",type:"option",values:i,defaultValue:"none"}]},{title:p.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:p.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 Ye(s,t){const e=l=>(t==null?void 0:t.get(l))??s.get(l),i=$e(e("timerType"),c.None);return{hideClock:n(e("hideClock")),hideCards:n(e("hideCards")),hideProgress:n(e("hideProgress")),hideMessage:n(e("hideMessage")),hideSecondary:n(e("hideSecondary")),hideLogo:n(e("hideLogo")),hideTimerSeconds:n(e("hideTimerSeconds")),removeLeadingZeros:!n(e("showLeadingZeros")),mainSource:e("main"),secondarySource:e("secondary-src"),timerType:i===c.None?void 0:i,freezeOvertime:n(e("freezeOvertime")),freezeMessage:e("freezeMessage")??"",hidePhase:n(e("hidePhase")),font:e("font")??void 0,keyColour:I(e("keyColour")),timerColour:I(e("timerColour"))}}function et(){const[s]=fe(),t=x.use(he);return x.useMemo(()=>{const i=t?new URLSearchParams(t.search):void 0;return Ye(s,i)},[t,s])}function tt(){const s=ye(g=>g.mirror),{data:t,status:e}=Ge(),{data:i,status:l}=ve(),{data:f,status:d}=Te(),{data:r,status:a}=qe();return{data:{customFields:r,projectData:t,isMirrored:s,settings:f,viewSettings:i},status:Qe([e,l,d,a])}}function kt(){const{data:s,status:t}=tt();return Be("Timer"),t==="pending"?o.jsx(be,{}):t==="error"?o.jsx(Ee,{text:"There was an error fetching data, please refresh the page."}):o.jsx(ot,{...s})}function ot({customFields:s,projectData:t,isMirrored:e,settings:i,viewSettings:l}){const{eventNext:f,eventNow:d,message:r,time:a,clock:g,timerTypeNow:h,countToEndNow:B,auxTimer:y}=xe(),{hideClock:Z,hideCards:_,hideProgress:W,hideMessage:A,hideSecondary:U,hideLogo:R,hideTimerSeconds:w,removeLeadingZeros:S,mainSource:K,secondarySource:Q,timerType:C,freezeOvertime:k,freezeMessage:O,hidePhase:$,font:N,keyColour:P,timerColour:q}=et(),{getLocalizedString:j}=we(),M=j("common.minutes"),u=C??h,V=Oe(r.timer),{showEndMessage:G,showFinished:v,showWarning:J,showDanger:X}=Ne(h,B,a.phase,k,O,$),F=Pe(a.playback),Y=!Z&&je(u),ee=!W&&Me(u),{showNow:te,nowMain:oe,nowSecondary:se,showNext:ie,nextMain:re,nextSecondary:ae}=Ve(d,f,K,Q,a.playback,a.phase),ne=Fe(a.duration,a.addedTime),le=Se(g),de=_e(k,h,g,a,C),z=We(de,u,M,{removeSeconds:w,removeLeadingZero:S}),me=r.timer.secondarySource==="aux1"?y.aux1:r.timer.secondarySource==="aux2"?y.aux2:r.timer.secondarySource==="aux3"?y.aux3:null,T=ze(r,me,M,w,S,U),L=Ae(l,q,J,X),ce=Le(z,T),ue=!F&&u!==c.Clock,pe={...P&&{"--timer-bg":P},...L&&{"--timer-colour":L},...N&&{"--timer-font":N}},D=Ce(i==null?void 0:i.timeFormat),ge=x.useMemo(()=>Xe(D,s),[s,D]);return o.jsxs("div",{"data-testid":"timer-view",className:m(["stage-timer",e&&"mirror",v&&"stage-timer--finished"]),style:pe,children:[!R&&(t==null?void 0:t.logo)&&o.jsx(He,{name:t.logo,className:"logo"}),o.jsx(Ie,{target:ke.Timer,viewOptions:ge}),o.jsx("div",{className:m(["blackout",r.timer.blackout&&"blackout--active"])}),!A&&o.jsx("div",{className:m(["message-overlay",V&&"message-overlay--active"]),children:o.jsx(b,{mode:"multi",min:32,max:256,className:m(["message",r.timer.blink&&"blink"]),children:r.timer.text})}),Y&&o.jsxs("div",{className:"clock-container",children:[o.jsx("div",{className:"label",children:j("common.time_now")}),o.jsx(Ze,{time:le,className:"clock"})]}),o.jsxs("div",{className:m(["timer-container",r.timer.blink&&!V&&"blink"]),children:[G?o.jsx(b,{mode:"multi",min:64,max:256,className:"end-message",children:O}):o.jsx("div",{className:m(["timer",ue&&"timer--paused",v&&"timer--finished"]),style:{fontSize:`${ce}vw`},"data-type":u,"data-phase":a.phase,children:z}),o.jsx("div",{className:m(["secondary",!T&&"secondary--hidden"]),children:o.jsx(b,{mode:"multi",min:64,max:256,children:T})})]}),ee&&o.jsx(De,{className:m(["progress-container",!F&&"progress-container--paused"]),now:a.current,complete:ne,normalColor:l.normalColor,warning:d==null?void 0:d.timeWarning,warningColor:l.warningColor,danger:d==null?void 0:d.timeDanger,dangerColor:l.dangerColor,hideOvertime:!v}),!_&&o.jsxs(o.Fragment,{children:[te&&o.jsx(E,{className:"event now",label:"now",title:oe,secondary:se}),ie&&o.jsx(E,{className:"event next",label:"next",title:re,secondary:ae})]})]})}export{kt as default}; //# sourceMappingURL=Timer-BbixOGdj.js.map