!function(){"use strict";function e(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function n(n){return function(n){if(Array.isArray(n))return e(n)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||function(n,t){if(n){if("string"==typeof n)return e(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);return"Object"===r&&n.constructor&&(r=n.constructor.name),"Map"===r||"Set"===r?Array.from(n):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(n,t):void 0}}(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var t=window.ctFrontend;(0,t.registerDynamicChunk)("blocksy_mega_menu",{mount:function(e){var t=e.filter((function(e){return e.closest("ul")})).map((function(e){return parseFloat(n(e.parentNode.classList).find((function(e){return e.match(/^menu-item-\d{1,}/)})).replace("menu-item-",""))}));(function(e,n){return new Promise((function(t){var r=localStorage.getItem(blocksyMegaMenu.persistence_key+":"+e);if(r){var i=JSON.parse(r);if(i&&n.every((function(e){return i.find((function(n){return n.id===e}))})))return void t(JSON.parse(r))}var o=new FormData;o.append("ids",n.join(",")),o.append("menu_id",e),fetch("".concat(ct_localizations.ajax_url,"?action=blc_retrieve_mega_menu_content"),{method:"POST",body:o}).then((function(e){return e.json()})).then((function(n){var r=n.success,i=n.data;r&&i&&(localStorage.setItem(blocksyMegaMenu.persistence_key+":"+e,JSON.stringify(i.content)),t(i.content))}))}))})(e[0].closest('ul[id^="menu-"]').id.replace("menu-",""),t).then((function(t){e.filter((function(e){return e.closest("ul")})).map((function(e){var r=parseFloat(n(e.parentNode.classList).find((function(e){return e.match(/^menu-item-\d{1,}/)})).replace("menu-item-","")),i=t.find((function(e){return e.id===r}));if(i){var o=document.createElement("div");o.innerHTML=e.innerHTML;var a=document.createElement("div");a.innerHTML=i.content,e.innerHTML=a.firstElementChild.innerHTML,e.className=a.firstElementChild.className,n(e.querySelectorAll(".menu-item")).map((function(e){var n=o.querySelector("#".concat(e.id));n&&(e.firstElementChild&&n.firstElementChild&&n.matches(".ct-menu-link")&&(e.firstElementChild.innerHTML=n.firstElementChild.innerHTML),e.firstElementChild&&n.firstElementChild&&n.firstElementChild.matches(".ct-menu-link")&&(e.firstElementChild.outerHTML=n.firstElementChild.outerHTML),e.className=n.className)}))}})),ctEvents.trigger("blocksy:frontend:init")}))}})}();