"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[3513],{43513(t,e,n){n.d(e,{geniallyStopwatchViewScript:()=>f});var o=n(57567),i=n(66264),s=n(84054),c=n(60708),r=n(46177),a=n(53289),l=n(79883),u=n(62800),d=n(94350);const f=(t,e)=>{var n;let f;(0,r.H)(e._logger,d.M.scriptId),t.config.alarms.forEach((t=>{var e;t.active&&(null===(e=t.action)||void 0===e||e.preload())})),t.slide.audioRequirement=s.w.ShowMute;const m=t.item,p=t.config.startButtonRef;p&&(p.markAsInteractive=!0);const g=t.config.pauseButtonRef;g&&(g.markAsInteractive=!0);const h=t.config.restartButtonRef;h&&(h.markAsInteractive=!0);const v=t.config.textItemRef,w=(0,a.D)(null!==(n=null===v||void 0===v?void 0:v.text)&&void 0!==n?n:""),y=t=>{v&&(v.text=(0,a.x)((0,l.AF)(t),w))};let M=!1;function E(t){M=t,g&&(g.shown=t),p&&(p.shown=!t)}let T=0;const A=new Set;function k(){E(!0);let n=Date.now();f=e.setInterval((()=>{const o=Date.now(),i=o-n;if(n=o,M){T+=i;const t=5999e3;T>t&&(T=t)}const s=1e3*Math.floor(T/1e3);y(s);for(const n of t.config.alarms)n.active&&s>=n.time.milliseconds&&!A.has(n)&&(A.add(n),(0,u.g)({view:e,widgetItem:m,action:n.action}))}),100)}function x(){E(!1),A.clear(),T=0}const b="https://static.genially.com/resources/520b02c3-751c-456c-816b-817a3d8050da.mpga";e.preloadAudio(b);const C=()=>{e.playAudio({source:b})},I="https://static.genially.com/resources/038b75ee-5922-4a44-902c-4a751318bf11.mpga";e.preloadAudio(I);null===p||void 0===p||p.on(i.q.Click,(()=>{E(!0),C()})),null===g||void 0===g||g.on(i.q.Click,(()=>{E(!1);const t=m.playAnimation({type:o.K.Heartbeat,parameters:{delayMs:0,durationMs:2e3}});e.setTimeout((()=>{t.stop()}),2e3),C()})),null===h||void 0===h||h.on(i.q.Click,(()=>{x(),e.playAudio({source:I})})),m.parentSlide.on(c.m.Exiting,(()=>{x(),f&&(e.clearInterval(f),f=void 0)})),m.parentSlide.on(c.m.Entering,(()=>{E(!1),T=0,y(0)})),"print"!==e.viewMode&&m.parentSlide.on(c.m.Entered,(()=>{m.visible?k():m.once(i.q.Visible,(()=>{k()}))}))}},46177(t,e,n){n.d(e,{H:()=>o});const o=(t,e)=>{t.info(`[DEPRECATED_TIMER] ${e}`)}},53289(t,e,n){function o(t){if(t.nodeType===Node.TEXT_NODE&&t.textContent&&""!==t.textContent.trim())return t;if(t.hasChildNodes())for(let e=0;e<t.childNodes.length;e+=1){const n=o(t.childNodes[e]);if(n)return n}return null}function i(t){const e=document.createElement("div");e.innerHTML=t;const n=o(e);return n?function(t){let e="",n=t;for(;n;)n instanceof HTMLElement&&n.style.cssText&&(e=n.style.cssText+e),n=n.parentElement;return e}(n):""}function s(t,e){const n=document.createElement("span");return n.setAttribute("style",e),n.textContent=t.replace(/^\s+/g,(t=>"\xa0".repeat(t.length))).replace(/\s+$/g,(t=>"\xa0".repeat(t.length))),n.outerHTML}n.d(e,{D:()=>i,x:()=>s})},79883(t,e,n){n.d(e,{cQ:()=>l,EJ:()=>r,AF:()=>c,ek:()=>u,di:()=>a});const o=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return t.toString().padStart(e,"0")};function i(t){const e=Math.floor(t/1e3);return{seconds:e%60,minutes:Math.floor(e/60)}}function s(t){const e=function(t){const e=i(t);return{seconds:e.seconds,minutes:e.minutes%60,hours:Math.floor(e.minutes/60)}}(t);return{seconds:e.seconds,minutes:e.minutes,hours:e.hours%24,days:Math.floor(e.hours/24)}}function c(t){const e=i(t);return`${o(e.minutes)}:${o(e.seconds)}`}function r(t){const e=s(t);return`${o(e.days,2)}:${o(e.hours)}:${o(e.minutes)}:${o(e.seconds)}`}function a(){const t=new Date,e=t.getTime();return e-(e+6e4*t.getTimezoneOffset())}const l=100,u=(t,e)=>0===t?0:e/t*100},62800(t,e,n){n.d(e,{g:()=>i});var o=n(57567);function i(t){let{view:e,widgetItem:n,action:i}=t;const s=n.playAnimation({type:o.K.Notification,parameters:{delayMs:0,durationMs:200}});e.setTimeout((()=>{s.stop()}),2500),null===i||void 0===i||i.run()}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/3513.0fc86ff9.chunk.js.map