!function(){"use strict";let t=null;function e(e){e.style.display="",t&&t!==e&&c(t),t=e,e.setAttribute("aria-hidden","false")}function c(e){e.style.display="none",e.setAttribute("aria-hidden","true"),t===e&&(t=null)}function n(t){if(!t.getAttribute("data-popup-id"))return;let n=!1;const o=function(){n||e(t)};t.querySelectorAll("[data-preco-popup-close]").forEach(function(e){e.addEventListener("click",function(){c(t),n=!0})});const a=t.getAttribute("data-trigger-type"),r=parseFloat(t.getAttribute("data-trigger-value"))||0;switch(a){case"after_time":setTimeout(o,1e3*Math.max(0,r));break;case"after_add_to_cart":window.jQuery&&window.jQuery(document.body).on("added_to_cart",o);break;case"view_cart_click":document.addEventListener("click",function(c){if(n)return;const o=c.target.closest("a.added_to_cart, a[href]");if(!o)return;const a=window.precoEventTracker?.cartUrl||"",r=o.classList.contains("added_to_cart"),i=a&&o.href&&0===o.href.indexOf(a);(r||i)&&(c.preventDefault(),e(t))});break;case"proceed_to_checkout_click":case"payment_button_click":{const c="payment_button_click"===a?"#place_order, button.wc-block-components-checkout-place-order-button":".checkout-button, a.checkout-button, .wc-proceed-to-checkout a, .wc-block-cart__submit-button, .wc-block-cart__submit-container a";document.addEventListener("click",function(o){n||o.target.closest(c)&&(o.preventDefault(),e(t))});break}}}function o(){document.querySelectorAll("[data-preco-popup]").forEach(n)}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",o):o()}();