"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[2417],{68124(e,t,i){i.d(t,{q:()=>m});var n=i(45992),o=i(37577),l=i(23119),r=i(17588),s=i(66264),d=i(60708);var a=i(29973),c=i(50783);const g=e=>{let{isInEditor:t,slides:i,showControls:o,showPagination:l,autoplay:r,options:s,fit:d,onClickSelectedImage:a,onZoomedOut:g,galleryType:u,viewId:m}=e;if(!u)return null;const p=(0,c.BR)(u);return(0,n.jsx)(p,{isInEditor:t,slides:i,showControls:o,showPagination:l,autoplay:r,options:s,fit:d,onClickSelectedImage:a,onZoomedOut:g,viewId:m})},u=o.Ay.div((e=>{let{$isInEditor:t}=e;return{display:"flex",alignItems:"center",height:"100%",cursor:"default",overflow:"hidden",".is-dragging":{cursor:"grabbing","& *":{cursor:"grabbing !important"}},pointerEvents:t?"none":"all"}})),m=e=>{let{isInEditor:t=!1,fit:i,autoplay:c,widgetItem:m,slides:p,showControls:h,showPagination:f=!0,galleryType:v,viewId:y,theme:I,onZoomed:w,t:C}=e;const b=Object.assign({loop:!0,skipSnaps:!0,watchResize:!0},a.Z),E=((e,t)=>{const[i,n]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{if(!e||!t)return;const i=[t.parentSlide.on(d.m.Entered,(()=>{t.visible&&n(!0)})),t.on(s.q.Visible,(()=>{n(!0)})),t.on(s.q.Hidden,(()=>{n(!1)}))];return()=>{i.forEach((e=>e())),n(!1)}}),[e,t]),i})(c,m);return(0,n.jsx)(l.i.Provider,{value:{t:C},children:(0,n.jsx)(o.NP,{theme:I,children:(0,n.jsx)(u,{$isInEditor:t,style:{display:"flex",alignItems:"center",height:"100%"},children:(0,n.jsx)(g,{isInEditor:t,slides:p,showControls:h,showPagination:f,options:b,autoplay:E,onClickSelectedImage:e=>{null===w||void 0===w||w(void 0!==e)},onZoomedOut:()=>{null===w||void 0===w||w(!1)},fit:i,galleryType:v,viewId:y})})})})}},22417(e,t,i){i.d(t,{geniallyGalleryEditorScript:()=>g});var n=i(45992),o=i(54072),l=i(57277),r=i(68124),s=i(50783);const d=(e,t,i)=>{const{width:n,height:o,x:l,y:r}=e,d=e.parentSlide.size,a=d.width>=d.height,c=(0,s.I)(t),g=a?o*c:n,u=a?o:n/c,m=a?g*i:g,p=a?u*i:u,h=l-(m-n)/2,f=r-(p-o)/2;e.setSize(m,p),e.setPosition(h,f)};var a=i(82927);const c=e=>null!==e,g=e=>{let{script:t,editor:i}=e;i.justCreated&&t.mutateConfig((e=>{e.showControls=!i.getIsMobileGenially()})),t.on("configChange",(e=>{let{config:n,prevConfig:o}=e;var l;const r=t.item;if(!r)return;const c=null===o||void 0===o?void 0:o.slideList,{galleryType:g,slideList:u}=n;if(o&&g!==o.galleryType){if(null===(l=i.trackWidgetPresetChange)||void 0===l||l.call(i,`${a.v.scriptId};${g}`),c){const e=u.map((e=>e.image.source));u.push(...(0,s.Mp)(g,e)),t.mutateConfig((e=>{e.slideList=u}))}((e,t,i)=>{const n=(0,s.RM)(t),o=(0,s.RM)(i),l=s.WK.includes(i),r=s.WK.includes(t);d(e,t,l&&r?1:l&&!r?1/o:n)})(r,g,o.galleryType)}const m=(0,s.mJ)(g);r.thumbnail!==m&&(r.thumbnail=m)}));const g=()=>{const{slideList:e,showControls:l,fit:s,galleryType:d}=t.getConfig(),a=e.map((e=>null===e.image.source?null:{image:e.image.source,title:e.title,id:(0,o.Ak)()})).filter(c);return(0,n.jsx)(r.q,{isInEditor:!0,slides:a,showControls:l,autoplay:!1,fit:s,galleryType:d,viewId:"",widgetItem:void 0,theme:i.theme,t:i.t})};(0,l.x)({getTargetNodeItem:()=>t.item,renderApp:g,renderThumbnailApp:g,nodePrefix:"gallery"})({script:t,editor:i})}},57277(e,t,i){i.d(t,{x:()=>o});var n=i(70377);function o(e){let{getTargetNodeItem:t,renderApp:i,renderThumbnailApp:o,nodePrefix:l}=e;return e=>{let{script:r,editor:s}=e,d=null,a=[];function c(e){d&&(n.unmountComponentAtNode(d),d=null),e&&"innerHtml"in e&&(e.innerHtml='<div class="card-iframe"><div style="width: 100%; height: 100%; background: #FF0000; color: #FFFFFF;">Deleted</div><script><\/script></div>')}function g(){d&&n.render(i(),d)}function u(){const e=t(r.getConfig());if(!e)return;const i=`${l}-${e.id}`;"innerHtml"in e&&(e.innerHtml=`<div class="card-iframe"><div id="${i}" class="genially-widget-app" style="width: 100%; height: 100%;"></div></div>`),requestAnimationFrame((()=>{d="idOfFreeNode"in e?document.getElementById(e.idOfFreeNode)||null:document.getElementById(i)||null,g()}))}function m(){o&&a.length&&a.forEach((e=>{const t="true"===e.dataset.critical,{renderingSlideId:i}=e.dataset;n.render(o({important:t,renderingSlideId:i}),e)}))}function p(){const e=t(r.getConfig());e&&"idOfThumbnailFreeNode"in e&&requestAnimationFrame((()=>{const t=document.getElementsByClassName(e.idOfThumbnailFreeNode);a=Array.from(t).filter((e=>e instanceof HTMLElement)),m()}))}r.on("configChange",(e=>{let{config:i,prevConfig:n}=e;const o=t(i),l=n?t(n):void 0;l&&l!==o&&c(l),o&&(o!==l?(u(),p()):(g(),m()))})),r.on("scriptIdChange",(e=>{let{scriptId:t,prevScriptId:i}=e;i!==t&&(c(),u(),p())})),r.on("dispose",(()=>{c(t(r.getConfig()))})),s.on("itemMount",(e=>{let{item:t}=e;t===r.item&&u()})),s.on("slideChange",(()=>{g()})),s.on("itemUnmount",(e=>{let{item:t}=e;t===r.item&&c()})),s.on("itemThumbnailMount",(e=>{let{item:t}=e;t===r.item&&p()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/2417.76e82cec.chunk.js.map