"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[2641],{2641:(t,e,n)=>{n.r(e),n.d(e,{geniallyCountdownEditorScript:()=>l});var o=n(19769),i=n(46177),s=n(53289),r=n(79883),c=n(19030);const l=t=>{let{script:e,editor:n}=t;(0,i.H)(n.logger,c.I.scriptId);const l=()=>e.getConfig().textItemRef;e.on("configChange",(t=>{let{config:n,prevConfig:i}=t;var c,u;const d=e.item;if(!d)return;const a=null===i||void 0===i?void 0:i.textItemRef,f=l();if(!f)return;a&&(a.textEditable=!0);let m=(0,s.D)(f.text);if((null===i||void 0===i?void 0:i.color)!==n.color){const t=`color: ${n.color}`;m=m.concat(`;${t}`);const e=d.items.find((t=>{let{type:e,name:n}=t;return e===o.S.Svg&&"tempoImg"===n}));e&&e.setColors(n.color)}f.textEditable=!1;const g=n.initialTime.milliseconds;if(f.text=(0,s.x)((0,r.AF)(g),m),(null===(c=null===i||void 0===i?void 0:i.fontFamily)||void 0===c?void 0:c.name)!==(null===(u=n.fontFamily)||void 0===u?void 0:u.name)&&f&&f.setFontFamily(n.fontFamily.name,n.fontFamily.url),(null===i||void 0===i?void 0:i.backgroundColor)!==n.backgroundColor){const t=d.items.find((t=>{let{type:e,name:n}=t;return e===o.S.Svg&&"tempoImg"!==n}));t&&t.setColors(n.backgroundColor)}})),e.on("dispose",(()=>{const t=l();t&&(t.textEditable=!0)})),e.setApi({setTime(t,e){const n=l();if(!n)return;const o=(0,s.D)(n.text),i=60*t*1e3+1e3*e;n.text=(0,s.x)((0,r.AF)(i),o)}})}},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:()=>u,EJ:()=>c,AF:()=>r,ek:()=>d,di:()=>l});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 r(t){const e=i(t);return`${o(e.minutes)}:${o(e.seconds)}`}function c(t){const e=s(t);return`${o(e.days,2)}:${o(e.hours)}:${o(e.minutes)}:${o(e.seconds)}`}function l(){const t=new Date,e=t.getTime();return e-(e+6e4*t.getTimezoneOffset())}const u=100,d=(t,e)=>0===t?0:e/t*100}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/2641.dd048e7a.chunk.js.map