"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[4691],{87001:(e,n,t)=>{t.d(n,{q:()=>r});var i=t(45992),o=t(17588),l=t(60708);const r=e=>{let{url:n,config:t,view:r,editor:d,palette:a,slide:s,isThumbnail:u=!1,fullSource:c}=e;const f=(0,o.useRef)(null),m=(0,o.useRef)(!1),v=r&&r.isOffline,p=v&&c,g=function(e){var n,t;const i={type:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"config",data:JSON.parse(JSON.stringify(e))};null===(t=null===(n=f.current)||void 0===n?void 0:n.contentWindow)||void 0===t||t.postMessage(i,"*")};return(0,o.useEffect)((()=>d?d.on("documentColorsChanged",(e=>{let{colors:n}=e;g(n,"palette")})):()=>{})),(0,o.useEffect)((()=>s?s.on(l.m.PaletteUpdated,(e=>{g(e.colors,"palette")})):()=>{})),(0,o.useEffect)((()=>{g(t)}),[t]),(0,o.useEffect)((()=>{if(!f.current||m.current)return()=>{};const e=e=>{var n,i,o,l,d;if(e.source===(null===(n=f.current)||void 0===n?void 0:n.contentWindow))if("ready"===e.data.type)d=Object.assign(Object.assign({},t),{isThumbnail:u,appMode:r?"view":"editor",offline:v}),g(a,"palette"),g(d,"init"),m.current=!0;else if("interactivity"===e.data.type){if(u)return;const n=e.data.data;"object"===typeof n?null===(i=null===r||void 0===r?void 0:r.runAction)||void 0===i||i.call(r,n):"string"===typeof n&&(null===(l=null===(o=null===r||void 0===r?void 0:r.getAction)||void 0===o?void 0:o.call(r,n))||void 0===l||l.run())}else"playAudio"===e.data.type&&(null===r||void 0===r||r.playAudio(e.data.data.data))};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}})),(0,i.jsx)("iframe",{ref:f,src:p?void 0:n,srcDoc:p?c:void 0,style:{pointerEvents:r?"auto":"none",width:"100%",height:"100%"},title:"Genially App"})}},13844:(e,n,t)=>{t.d(n,{D:()=>o});var i=t(45992);const o=()=>(0,i.jsx)("div",{style:{backgroundColor:"#414141",width:"100%",height:"100%"}})},96901:(e,n,t)=>{t.d(n,{Y:()=>o,m:()=>i});const i=e=>{let{scriptId:n,developmentUrl:t,version:i="1.0.0"}=e;return t?`${t}/index.html`:`https://plugins.genially.com/${n}/${i}/index.html`},o=e=>e.startsWith("@ai.genially/")},44691:(e,n,t)=>{t.r(n),t.d(n,{geniallyCodeViewScript:()=>a});var i=t(45992),o=t(41381),l=t(87001),r=t(13844);var d=t(96901);const a=(e,n)=>{const t=function(){let{isThumbnail:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var o;const{developmentUrl:r,config:a,scriptId:s,version:u}=e,c=(0,d.m)({scriptId:s,developmentUrl:r,version:u}),f=((e,n)=>{if(window.offlineWidgets&&window.offlineWidgets[`${e}@${n}`]){const{index:t}=window.offlineWidgets[`${e}@${n}`];return t}})(s,u);return(0,i.jsx)(l.q,{palette:n.getDocumentColors(),config:a,view:n,slide:null===(o=e.item)||void 0===o?void 0:o.parentSlide,url:c,isThumbnail:t,fullSource:f})};(0,o.p)({getTargetNodeItem:()=>e.item,initialState:void 0,renderThumbnailApp:()=>(0,d.Y)(e.scriptId||"")?(0,i.jsx)(r.D,{}):t({isThumbnail:!0}),renderApp:()=>()=>t()})(e,n)}},41381:(e,n,t)=>{t.d(n,{p:()=>r});var i=t(70377),o=t(66264),l=t(60708);function r(e){let{getTargetNodeItem:n,renderApp:t,renderThumbnailApp:r,initialState:d}=e,a=!1;const s=[],u=e=>{s.push(e)};return e=>{const c=n(e.config),f=null===c||void 0===c?void 0:c.parentSlide;function m(){if(!c)return;let e=null;if("idOfFreeNode"in c)e=document.getElementById(c.idOfFreeNode);else{const n=document.createElement("div");n.innerHTML=c.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){let n;const o=t=>{a&&n?i.render(n(t),e):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"?')};n=t({setState:o,onUnmount:u}),a=!0,o(d),s.push((()=>{i.unmountComponentAtNode(e)}))}}function v(){a=!1,s.forEach((e=>{e()})),s.length=0}c&&"isTransversal"in c&&c.isTransversal?(null===c||void 0===c||c.on(o.q.Mount,(()=>{m()})),null===c||void 0===c||c.on(o.q.Unmount,(()=>{v()}))):(null===f||void 0===f||f.on(l.m.Entering,(()=>{a||m()})),null===f||void 0===f||f.on(l.m.Exited,(()=>{a&&v()}))),null===f||void 0===f||f.on(l.m.ThumbnailMount,(()=>{!function(){if(!r||!c||!("idOfThumbnailFreeNode"in c))return;const e=document.getElementsByClassName(c.idOfThumbnailFreeNode);Array.from(e).forEach((e=>{i.unmountComponentAtNode(e)}))}(),function(){if(!r||!c||!("idOfThumbnailFreeNode"in c))return;const e=document.getElementsByClassName(c.idOfThumbnailFreeNode);Array.from(e).forEach((e=>{i.render(r(),e)}))}()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/4691.70fa211a.chunk.js.map