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