(()=>{"use strict";var t={n:e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},d:(e,o)=>{for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=jQuery;var o=t.n(e);document.addEventListener("DOMContentLoaded",function(){n.init()});const n={init:function(t){this.holder=document.querySelectorAll(".qi-block-product-list"),this.holder.length&&[...this.holder].map(e=>{n.initItem(e,t)})},getRealCurrentItem:function(t){return"string"==typeof t&&""!==t&&(t=qiBlocksEditor.qodefGetCurrentBlockElement.get(t)),t},initItem:function(t,e){if(!(t=n.getRealCurrentItem(t)))return;const o=t.querySelectorAll(".qi-block-button");o.length&&[...o].map(t=>{n.initButtonAction(t)}),n.initInfoBelowSwap(t,e)},initButtonAction:function(t){const e=t.querySelector(".qodef-m-icon"),i=t.querySelector(".qodef-add-to-cart-button-link");if(e){const o=document.body.classList.contains("wp-admin")?300:0;let n="auto";setTimeout(()=>{t&&t.classList.contains("qodef-type--icon-boxed")?n=parseInt(window.getComputedStyle(t).getPropertyValue("height"),10)+"px":i&&i.classList.contains("qodef-type--icon-boxed")&&(n=parseInt(window.getComputedStyle(i).getPropertyValue("height"),10)+"px"),e.style.width=n},o)}o()(document.body).on("added_to_cart",()=>{const e=setInterval(()=>{let o;o=t.classList.contains("add_to_cart_button")?t.nextElementSibling:t.querySelector(".added_to_cart"),o&&(clearInterval(e),n.setViewButtonMarkup(t,o))},100)})},setViewButtonMarkup:function(t,e){let o,n=["product_type_simple","add_to_cart_button","ajax_add_to_cart","added"];o=t.classList.contains("add_to_cart_button")?t:t.querySelector(".add_to_cart_button");let i=o.getAttribute("class").split(" ");i.length&&i.forEach(t=>{n.includes(t)||e.classList.add(t)}),e.innerHTML=o.innerHTML,e.querySelector(".qodef-m-text").innerHTML=qiBlocks.vars.viewCartText,e.classList.add("qodef--init")},initInfoBelowSwap:function(t,e){if(t.classList.contains("qodef-item-layout--info-below-swap")){const o=t.querySelectorAll(".qodef-e");o.length&&[...o].map(t=>{let o=t.querySelector(".qodef-e-swap-holder");if(o){let t=0;e&&(t=200,o.style.removeProperty("--qodef-max-width"),o.style.removeProperty("--qodef-max-height")),setTimeout(()=>{let t=o.querySelector(".qodef-woo-product-price"),e=o.querySelector(".qodef-e-to-swap .qi-block-button"),n=e?e.getBoundingClientRect().width:0,i=e?e.getBoundingClientRect().height:0,r=t?t.getBoundingClientRect().width:0,d=t?t.getBoundingClientRect().height:0,l=Math.ceil(Math.max(n,r)),a=Math.ceil(Math.max(i,d))+"px",c=o.parentNode.getBoundingClientRect().width;o.style.setProperty("--qodef-max-width",(c<l?c:l)+"px"),o.style.setProperty("--qodef-max-height",a),o.classList.add("qodef--initialized")},t)}})}}}})();