"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[1616],{91616:(e,t,a)=>{a.r(t),a.d(t,{geniallyRandomImageViewScript:()=>u});var n=a(54072),o=a(48237),i=a(68283),r=a(10285),c=a(66264),l=a(84054),s=function(e,t,a,n){return new(a||(a=Promise))((function(o,i){function r(e){try{l(n.next(e))}catch(t){i(t)}}function c(e){try{l(n.throw(e))}catch(t){i(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(r,c)}l((n=n.apply(e,t||[])).next())}))};const u=(e,t)=>{const a=e.item,{config:u}=e,d=u.imageItemRef,m=e=>{if(!e||e.data.type!==o.L.PlayAudio||!e.data.source)return;const{source:a}=e.data;return t.preloadAudio(a),Object.assign(Object.assign({},e.data),{source:a})},g=m(u.onStepAudio),f=m(u.onClickAudio);(g||f)&&(e.slide.audioRequirement=l.w.ShowMute);const h=u.images.filter((e=>!!e.image.source)).map((e=>({source:e.image.source,altText:e.image.altText}))),p=e=>{if(d){const t=h[e];d.alternativeText=t.altText,d.source=t.source}};h.forEach((e=>{t.preloadImage(e.source)})),u.showCoverImage?(u.coverImage.source&&t.preloadImage(u.coverImage.source),d&&(d.alternativeText=u.coverImage.altText)):h.length>0&&p(0);let v=0;const y=(e,a)=>{const o=(e=>{let t;do{a=0,n=h.length-1,a=Math.ceil(a),n=Math.floor(n),t=Math.floor(Math.random()*(n-a+1))+a}while(t===v&&!e&&h.length>1);var a,n;return v=t,t})(a);p(o),e&&g&&t.playAudio(Object.assign(Object.assign({},g),{refId:(0,n.Ak)()}))};let w=Symbol("animationInstance");const b=e=>200+10*(6-e),I=(()=>{let e=0;for(let t=0;t<6;t+=1)e+=b(t);return e})();h.length>1&&(a.markAsInteractive=!0,a.on(c.q.Click,(()=>{var e;a.playAnimation({type:i.x.Wobble,parameters:{delayMs:0,durationMs:I}}),f&&t.playAudio(Object.assign(Object.assign({},f),{playMode:r.F.PlayRestart})),w=Symbol("animationInstance"),e=w,s(void 0,void 0,void 0,(function*(){const n=h.length<=2;y(!0,n);for(let o=0;o<6&&(yield new Promise((e=>t.setTimeout(e,b(o)))),a.parentSlide.isCurrent&&w===e);o+=1)y(!0,!1)}))})))}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/1616.8dbd758d.chunk.js.map