!function(){"use strict";var e=window.ctFrontend;function n(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}(e)||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.")}()}function t(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}(0,e.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.className=n.className)}))}})),ctEvents.trigger("blocksy:frontend:init")}))}})}();