"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[6993],{1067:(n,t,e)=>{e.d(t,{h:()=>o});var i=e(22739);function o(n,t){if(!n)return!1;let e=!1;return(0,i.L)(n.data,(n=>{n.type===t&&(e=!0)})),e}},46993:(n,t,e)=>{e.r(t),e.d(t,{geniallyCountdownViewScript:()=>v});var i=e(48237),o=e(19769),s=e(1067),r=e(66264),c=e(84054),l=e(60708),u=e(46177),d=e(53289),a=e(79883),f=e(62800),m=e(19030);const v=(n,t)=>{var e,v;(0,u.H)(t._logger,m.I.scriptId);let g,h=[],p=!1;null===(e=n.config.onEndAction)||void 0===e||e.preload();const{onEndAction:T}=n.config;let E;T&&(0,s.h)(T,i.L.PlayAudio)&&(n.slide.audioRequirement=c.w.ShowMuteAndOverlay);const y=n.config.textItemRef,w=(0,d.D)(null!==(v=null===y||void 0===y?void 0:y.text)&&void 0!==v?v:""),M=n=>{y&&(y.text=(0,d.x)((0,a.AF)(n),w))},x=n.item;function A(){E&&(t.clearInterval(E),E=void 0)}function I(){if(p||E)return;const e=Date.now(),i=null!==g&&void 0!==g?g:n.config.initialTime.milliseconds;E=t.setInterval((()=>{const o=1e3*Math.floor((Date.now()-e)/1e3),s=Math.max(i-o,0);s<=0&&A(),g=s,M(s),0===s&&((0,f.g)({view:t,widgetItem:x,action:n.config.onEndAction}),h.forEach((n=>n())))}),100)}const _=x.parentSlide;_.on(l.m.Exiting,(()=>{A()})),_.on(l.m.Entering,(()=>{const t=_.items.find((t=>{var e,i;return t.type===o.S.Activity&&"Timer"in t.Options&&(null===(e=t.Options.Timer)||void 0===e?void 0:e.TimerId)===(null===(i=n.item)||void 0===i?void 0:i.id)})),e=n.config.initialTime.milliseconds;t?M(null!==g&&void 0!==g?g:e):(g=e,M(e))})),"print"!==t.viewMode&&_.on(l.m.Entered,(()=>{x.visible?I():x.once(r.q.Visible,(()=>{I()}))}));n.setApi({pause:function(){p=!0,A()},resume:function(){p=!1,I()},restart:()=>{g=n.config.initialTime.milliseconds,A(),I()},isRunning:()=>!p,addOnTimeEndListener:n=>{h.push(n)},removeOnTimeEndListener:n=>{h=h.filter((t=>t!==n))}})}},46177:(n,t,e)=>{e.d(t,{H:()=>i});const i=(n,t)=>{n.info(`[DEPRECATED_TIMER] ${t}`)}},53289:(n,t,e)=>{function i(n){if(n.nodeType===Node.TEXT_NODE&&n.textContent&&""!==n.textContent.trim())return n;if(n.hasChildNodes())for(let t=0;t<n.childNodes.length;t+=1){const e=i(n.childNodes[t]);if(e)return e}return null}function o(n){const t=document.createElement("div");t.innerHTML=n;const e=i(t);return e?function(n){let t="",e=n;for(;e;)e instanceof HTMLElement&&e.style.cssText&&(t=e.style.cssText+t),e=e.parentElement;return t}(e):""}function s(n,t){const e=document.createElement("span");return e.setAttribute("style",t),e.textContent=n.replace(/^\s+/g,(n=>"\xa0".repeat(n.length))).replace(/\s+$/g,(n=>"\xa0".repeat(n.length))),e.outerHTML}e.d(t,{D:()=>o,x:()=>s})},79883:(n,t,e)=>{e.d(t,{EJ:()=>c,AF:()=>r,di:()=>l});const i=function(n){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return n.toString().padStart(t,"0")};function o(n){const t=Math.floor(n/1e3);return{seconds:t%60,minutes:Math.floor(t/60)}}function s(n){const t=function(n){const t=o(n);return{seconds:t.seconds,minutes:t.minutes%60,hours:Math.floor(t.minutes/60)}}(n);return{seconds:t.seconds,minutes:t.minutes,hours:t.hours%24,days:Math.floor(t.hours/24)}}function r(n){const t=o(n);return`${i(t.minutes)}:${i(t.seconds)}`}function c(n){const t=s(n);return`${i(t.days,2)}:${i(t.hours)}:${i(t.minutes)}:${i(t.seconds)}`}function l(){const n=new Date,t=n.getTime();return t-(t+6e4*n.getTimezoneOffset())}},62800:(n,t,e)=>{e.d(t,{g:()=>o});var i=e(57567);function o(n){let{view:t,widgetItem:e,action:o}=n;const s=e.playAnimation({type:i.K.Notification,parameters:{delayMs:0,durationMs:200}});t.setTimeout((()=>{s.stop()}),2500),null===o||void 0===o||o.run()}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/6993.293b602e.chunk.js.map