"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[2417],{68124:(e,t,i)=>{i.d(t,{q:()=>u});var n=i(45992),o=i(37577),l=i(17588),s=i(66264),r=i(60708);var d=i(29973),a=i(88138);const c=e=>{let{isInEditor:t,slides:i,showControls:o,showPagination:l,autoplay:s,options:r,fit:d,onClickSelectedImage:c,onZoomedOut:g,galleryType:u,viewId:m}=e;if(!u)return null;const p=(0,a.BR)(u);return(0,n.jsx)(p,{isInEditor:t,slides:i,showControls:o,showPagination:l,autoplay:s,options:r,fit:d,onClickSelectedImage:c,onZoomedOut:g,viewId:m})},g=o.Ay.div({display:"flex",alignItems:"center",height:"100%",cursor:"default",".is-dragging":{cursor:"grabbing","& *":{cursor:"grabbing !important"}}}),u=e=>{let{isInEditor:t=!1,fit:i,autoplay:a,widgetItem:u,slides:m,showControls:p,showPagination:h=!0,galleryType:f,viewId:y,theme:v,onZoomed:w}=e;const C=Object.assign({loop:!0,skipSnaps:!0,watchResize:!0},d.Z),I=((e,t)=>{const[i,n]=(0,l.useState)(!1);return(0,l.useEffect)((()=>{if(!e||!t)return;const i=[t.parentSlide.on(r.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})(a,u);return(0,n.jsx)(o.NP,{theme:v,children:(0,n.jsx)(g,{style:{display:"flex",alignItems:"center",height:"100%"},children:(0,n.jsx)(c,{isInEditor:t,slides:m,showControls:p,showPagination:h,options:C,autoplay:I,onClickSelectedImage:e=>{null===w||void 0===w||w(void 0!==e)},onZoomedOut:()=>{null===w||void 0===w||w(!1)},fit:i,galleryType:f,viewId:y})})})}},22417:(e,t,i)=>{i.r(t),i.d(t,{geniallyGalleryEditorScript:()=>g});var n=i(45992),o=i(54072),l=i(57277),s=i(68124),r=i(88138);const d=(e,t,i)=>{const{width:n,height:o,x:l,y:s}=e,d=e.parentSlide.size,a=d.width>=d.height,c=(0,r.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=s-(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.justCreatedFromSidebar&&t.mutateConfig((e=>{e.showControls=!i.getIsMobileGenially()})),t.on("configChange",(e=>{let{config:n,prevConfig:o}=e;var l;const s=n.nodeRichContent;if(!s)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,r.Mp)(g,e)),t.mutateConfig((e=>{e.slideList=u}))}((e,t,i)=>{const n=(0,r.RM)(t),o=(0,r.RM)(i),l=r.WK.includes(i),s=r.WK.includes(t);d(e,t,l&&s?1:l&&!s?1/o:n)})(s,g,o.galleryType)}const m=(0,r.mJ)(g);s.thumbnail!==m&&(s.thumbnail=m)})),(0,l.x)({getTargetNodeItem:e=>e.nodeRichContent,renderApp:()=>{const{slideList:e,showControls:l,fit:r,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)(s.q,{isInEditor:!0,slides:a,showControls:l,autoplay:!1,fit:r,galleryType:d,viewId:"",widgetItem:void 0,theme:i.theme})},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,nodePrefix:o}=e;return e=>{let{script:l,editor:s}=e,r=null;function d(e){r&&(n.unmountComponentAtNode(r),r=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 a(){r&&n.render(i(),r)}function c(){const e=t(l.getConfig());if(!e)return;const i=`${o}-${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((()=>{r="idOfFreeNode"in e?document.getElementById(e.idOfFreeNode):document.getElementById(i),a()}))}l.on("configChange",(e=>{let{config:i,prevConfig:n}=e;const o=t(i),l=n?t(n):void 0;l&&l!==o&&d(l),o&&(o!==l?c():a())})),l.on("dispose",(()=>{d(t(l.getConfig()))})),s.on("itemMount",(e=>{let{item:t}=e;t===l.item&&c()})),s.on("itemUnmount",(e=>{let{item:t}=e;t===l.item&&d()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/2417.ca5c949d.chunk.js.map