"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[485],{45577:(e,n,t)=>{t.d(n,{q:()=>s});var i=t(45992),o=t(17588),l=t(66264),u=t(60708),d=t(75386),r=t(5441);const s=e=>{let{getItems:n,item:t,menuType:s,theme:a,shouldCloseWhenClickOutside:m=!1,itemSize:c,menuTheme:v}=e;const[h,f]=(0,o.useState)(n()),[g,p]=(0,o.useState)(!1),T=(0,o.useCallback)((()=>{p((e=>!e))}),[]);(0,o.useEffect)((()=>{const e=null===t||void 0===t?void 0:t.on(l.q.Message,(e=>{e===u.m.Entering&&(f(n()),p(!1))}));return()=>{null===e||void 0===e||e()}}),[n,t]);const y=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const t=(0,o.useRef)(null);return(0,o.useEffect)((()=>{const i=n=>{t.current&&!t.current.contains(n.target)&&e(n)};return document.addEventListener("mouseup",i,n),document.addEventListener("touchend",i,n),()=>{document.removeEventListener("mouseup",i,n),document.removeEventListener("touchend",i,n)}}),[t,e,n]),t}((0,o.useCallback)((()=>{m&&g&&p(!1)}),[g,m]),!0);(0,o.useEffect)((()=>{f(n())}),[n]);const w=(0,d.CO)(s);return(0,r.T)({theme:a,children:(0,i.jsx)(w,{items:h,onToggleClick:T,opened:g,ref:y,theme:a,itemSize:c,menuTheme:v})})}},93918:(e,n,t)=>{t.d(n,{N:()=>l,e:()=>d});var i=t(48237);const o=(e,n)=>""===e?n("__new.view.widget.menu.sidebar.emptyTitlePlaceholder"):e,l=(e,n)=>e.map(((e,t)=>{var l;const u=(null===(l=e.menuItemAction.action)||void 0===l?void 0:l.type)===i.L.GoToSlide;return{text:o(e.menuItemName,n),key:t,onClick:()=>{},isLink:u,isActive:!1,isAllowed:u,altText:e.altText}})),u={active:!1,allowed:!1},d=(e,n)=>e.map(((e,t)=>{var l,d;const r=!!(null===(l=e.menuItemAction)||void 0===l?void 0:l.data)&&(null===(s=e.menuItemAction.data)||void 0===s?void 0:s.type)===i.L.GoToSlide;var s;const{active:a,allowed:m}=r&&(null===(d=e.menuItemAction)||void 0===d?void 0:d.data)?n.getGoToSlideState(e.menuItemAction.data):u;return{text:o(e.menuItemName,n.t),key:t,onClick:()=>{var n;return null===(n=e.menuItemAction)||void 0===n?void 0:n.run()},isLink:r,isActive:a,isAllowed:m,altText:e.altText}}))},90485:(e,n,t)=>{t.r(n),t.d(n,{geniallyMenuViewScript:()=>d});var i=t(45992),o=t(41381),l=t(45577),u=t(93918);const d=(e,n)=>{(0,o.p)({getTargetNodeItem:()=>e.item,initialState:void 0,renderApp:()=>{var t,o;const{config:d,item:r}=e,{menuItems:s,menuType:a,menuTheme:m}=d,c=()=>(0,u.e)(s,n),v={width:null!==(t=null===r||void 0===r?void 0:r.width)&&void 0!==t?t:0,height:null!==(o=null===r||void 0===r?void 0:r.height)&&void 0!==o?o:0};return()=>(0,i.jsx)(l.q,{getItems:c,item:r,menuType:a,theme:n.theme,itemSize:v,shouldCloseWhenClickOutside:!0,menuTheme:m})}})(e,n)}},41381:(e,n,t)=>{t.d(n,{p:()=>u});var i=t(70377),o=t(66264),l=t(60708);function u(e){let{getTargetNodeItem:n,renderApp:t,renderThumbnailApp:u,initialState:d}=e,r=!1;const s=[],a=e=>{s.push(e)};return e=>{const m=n(e.config),c=null===m||void 0===m?void 0:m.parentSlide;function v(){if(!m)return;let e=null;if("idOfFreeNode"in m)e=document.getElementById(m.idOfFreeNode);else{const n=document.createElement("div");n.innerHTML=m.source;let t=n.getElementsByClassName("genially-widget-app");t.length||(t=n.getElementsByClassName("genially-widget-gallery"));const{id:i}=t[0];if(!i)return;e=document.getElementById(i)}if(e){const n=o=>{if(r){const l=t({setState:n,onUnmount:a});i.render(l(o),e)}else console.warn('"rerender" was called when the widget was already unmounted. This is a no-op. Did you forget to dispose of an event handler with "onUnmount"?')};r=!0,n(d),s.push((()=>{i.unmountComponentAtNode(e)}))}}function h(){r=!1,s.forEach((e=>{e()})),s.length=0}null===m||void 0===m||m.on(o.q.Mount,(()=>{v()})),null===m||void 0===m||m.on(o.q.Unmount,(()=>{h()})),m&&"isTransversal"in m&&m.isTransversal?v():null===c||void 0===c||c.on(l.m.Entering,(()=>{r||v()})),null===c||void 0===c||c.on(l.m.Exited,(()=>{m&&"isTransversal"in m&&m.isTransversal||r&&h()})),null===c||void 0===c||c.on(l.m.ThumbnailMount,(()=>{!function(){if(!u||!m||!("idOfThumbnailFreeNode"in m))return;const e=document.getElementsByClassName(m.idOfThumbnailFreeNode);Array.from(e).forEach((e=>{i.unmountComponentAtNode(e)}))}(),function(){if(!u||!m||!("idOfThumbnailFreeNode"in m))return;const e=document.getElementsByClassName(m.idOfThumbnailFreeNode);Array.from(e).forEach((e=>{i.render(u(),e)}))}()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/485.2c98ab6a.chunk.js.map