var iframeParent_J771BWhrnyeuYpz8nR4D = document.getElementById( 'miniextensions-iframe-embed-J771BWhrnyeuYpz8nR4D' ); iframeParent_J771BWhrnyeuYpz8nR4D.innerHTML = ` `; var eventMethod_J771BWhrnyeuYpz8nR4D_hjVhkrejV0 = window.addEventListener ? "addEventListener" : "attachEvent"; var eventer_J771BWhrnyeuYpz8nR4D_hjVhkrejV0 = window[eventMethod_J771BWhrnyeuYpz8nR4D_hjVhkrejV0]; var messageEvent_J771BWhrnyeuYpz8nR4D_hjVhkrejV0 = eventMethod_J771BWhrnyeuYpz8nR4D_hjVhkrejV0 == "attachEvent" ? "onmessage" : "message"; function toggleModal_J771BWhrnyeuYpz8nR4D_hjVhkrejV0(url, shouldConfirmIfClosing) { var modal_J771BWhrnyeuYpz8nR4D_hjVhkrejV0 = document.querySelector( '.modal-J771BWhrnyeuYpz8nR4D_hjVhkrejV0' ); if (url) { if (modal_J771BWhrnyeuYpz8nR4D_hjVhkrejV0) { modal_J771BWhrnyeuYpz8nR4D_hjVhkrejV0.remove(); } var elem = document.createElement('div'); elem.className = "modal-J771BWhrnyeuYpz8nR4D_hjVhkrejV0 show-modal-J771BWhrnyeuYpz8nR4D_hjVhkrejV0"; elem.innerHTML = ''; document.body.appendChild(elem); } else { if (modal_J771BWhrnyeuYpz8nR4D_hjVhkrejV0) { if (shouldConfirmIfClosing && !window.confirm('Are you sure want to leave? Your unsaved changes will be lost.')) { return; } modal_J771BWhrnyeuYpz8nR4D_hjVhkrejV0.remove(); } } } function windowOnClick_J771BWhrnyeuYpz8nR4D_hjVhkrejV0(event) { var modal_J771BWhrnyeuYpz8nR4D_hjVhkrejV0 = document.querySelector( '.modal-J771BWhrnyeuYpz8nR4D_hjVhkrejV0' ); if (event.target === modal_J771BWhrnyeuYpz8nR4D_hjVhkrejV0) { toggleModal_J771BWhrnyeuYpz8nR4D_hjVhkrejV0(null, true); } } window.addEventListener('click', windowOnClick_J771BWhrnyeuYpz8nR4D_hjVhkrejV0); function debounce_J771BWhrnyeuYpz8nR4D_hjVhkrejV0(func, wait, immediate) { var timeout; return function() { var context = this, args = arguments; var later = function() { timeout = null; if (!immediate) func.apply(context, args); }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) func.apply(context, args); }; }; window.addEventListener('scroll', debounce_J771BWhrnyeuYpz8nR4D_hjVhkrejV0(function(e) { const iframe = document.getElementById('miniExtensionsIframe-J771BWhrnyeuYpz8nR4D_hjVhkrejV0'); if (true && window && iframe && iframe.contentWindow && iframe.contentWindow.postMessage) { const iframeRect = iframe.getBoundingClientRect() const innerHeight = window.innerHeight; if (innerHeight != null && iframeRect != null && iframeRect.top != null) { iframe.contentWindow.postMessage({ type: 'miniExtensionsOnScrollParent', offsetWithScroll: iframeRect.top * -1, id: 'J771BWhrnyeuYpz8nR4D', }, '*'); } } }, 250)); eventer_J771BWhrnyeuYpz8nR4D_hjVhkrejV0(messageEvent_J771BWhrnyeuYpz8nR4D_hjVhkrejV0, function(e) { if (!e.data) return; if (e && e.data && e.data.type && e.data.type === 'miniExtensionsResize') { if (e.data.iframeMessageId != null && e.data.iframeMessageId !== 'hjVhkrejV0') { return; } document.getElementById('miniExtensionsIframe-J771BWhrnyeuYpz8nR4D_hjVhkrejV0').style.height = e.data.height + 'px'; document.getElementById('miniextensions-iframe-embed-J771BWhrnyeuYpz8nR4D').style.height = e.data.height + 'px'; } else if (e && e.data && e.data.type && e.data.type === 'miniExtensionsOpenUrl') { if (e.data.iframeMessageId != null && e.data.iframeMessageId !== 'hjVhkrejV0') { return; } if (e.data.mode === 'replace-parent') { window.location.href = e.data.url; } else if (e.data.newTab || e.data.mode === 'new-tab') { window.open(e.data.url); } else if (e.data.mode === 'replace-iframe' || e.data.mode === 'replace-iframe-not-href') { document.getElementById('miniExtensionsIframe-J771BWhrnyeuYpz8nR4D_hjVhkrejV0').src = e.data.url; if (false || !(e.data.url.startsWith('https://app.miniextensions.com') || e.data.url.startsWith('http://localhost'))) { document.getElementById('miniExtensionsIframe-J771BWhrnyeuYpz8nR4D_hjVhkrejV0').scrolling = 'yes'; } else { document.getElementById('miniExtensionsIframe-J771BWhrnyeuYpz8nR4D_hjVhkrejV0').scrolling = 'no'; } } else if (e.data.mode === 'replace-parent-not-href') { window.location.replace(e.data.url); } else { window.open(e.data.url); } } else if (e && e.data && e.data.type && e.data.type === 'miniExtensionsOpenModalEditor') { if (e.data.iframeMessageId != null && e.data.iframeMessageId !== 'hjVhkrejV0') { return; } const finalUrlObject = new URL(e.data.url); finalUrlObject.searchParams.append( 'iframeMessageId', 'ZtRiLHZoG5' ); finalUrlObject.searchParams.append( 'iframeToCloseMessageId', 'hjVhkrejV0' ); const finalUrl = finalUrlObject.toString(); toggleModal_J771BWhrnyeuYpz8nR4D_hjVhkrejV0(finalUrl, false); } else if (e && e.data && e.data.type && e.data.type === 'miniExtensionsCloseModalEditor') { if (e.data.iframeMessageId != null && e.data.iframeMessageId !== 'hjVhkrejV0') { return; } toggleModal_J771BWhrnyeuYpz8nR4D_hjVhkrejV0(null, false); } else if (e && e.data && e.data.type && e.data.type === 'reloadPortalDataAfterChange') { const iframe = document.getElementById('miniExtensionsIframe-J771BWhrnyeuYpz8nR4D_hjVhkrejV0'); if (iframe && iframe.contentWindow && iframe.contentWindow.postMessage) { iframe.contentWindow.postMessage(e.data, '*'); } } }, false);