"use strict";var woostifyScrollDetect=function(){"function"==typeof woostifyConditionScrolling&&woostifyConditionScrolling()&&"function"==typeof scrollingDetect&&scrollingDetect()},woostifyFormatNumber=function(e){return e.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")},woostifyAddToCartSection=function(){var e=document.querySelector(".sticky-add-to-cart-section"),t=document.querySelector("form.cart");if(e&&t){var c=e.querySelector(".sticky-atc-button"),o=t.querySelector(".single_add_to_cart_button"),i=e.querySelector(".sticky-atc-price"),n=t.querySelector(".quantity .qty"),r=i.innerHTML,a=JSON.parse(e.querySelector(".sticky-atc-data").getAttribute("data-product")),s=function(e,t){if(n){var c=n.value,o=(e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.price,t=arguments.length>0&&void 0!==arguments[1]?arguments[1]:a.regular_price,function(o){o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c;var i=woostifyFormatNumber(parseFloat(o*e).toFixed(2)),n=woostifyFormatNumber(parseFloat(o*t).toFixed(2)),r="",s="",d="";switch(i=(i=i.replace(/,/g,a.currency_separator)).replace(".",a.currency_decimal),n=(n=n.replace(/,/g,a.currency_separator)).replace(".",a.currency_decimal),a.currency_pos){case"right":s=i+a.currency,d=n+a.currency;break;case"right_space":s=i+" "+a.currency,d=n+" "+a.currency;break;case"left_space":s=a.currency+" "+i,d=a.currency+" "+n;break;default:s=a.currency+i,d=a.currency+n}return e==t?r=s:(r+=""+d+"",r+=""+s+""),r});n.addEventListener("change",(function(){i.innerHTML=o(n.value)}))}};if(s(),e.classList.contains("variations-product")){var d=document.querySelector(".reset_variations"),u="form.variations_form";jQuery(document.body).on("found_variation",u,(function(t,c){e.classList.contains("no-need-update-price")||a.price==a.regular_price||t.currentTarget.closest("#woostify-quick-view-panel")||s(c.display_price,c.display_regular_price)})),jQuery(document.body).on("check_variations",u,(function(e){var t=e.target.querySelector(".woocommerce-variation-add-to-cart-disabled");e.currentTarget.closest("#woostify-quick-view-panel")||(t?c.classList.add("disabled"):c.classList.remove("disabled"))})),d&&(d.onclick=function(){i.innerHTML=r})}e.onclick=function(t){var c=e.querySelector(".sticky-atc-button");if(t.target!==c||c.classList.contains("disabled")){var i=document.getElementById("wpadminbar"),n=i?i.offsetHeight:0,r=jQuery(".variations").offset().top-n;jQuery("html, body").animate({scrollTop:r},300)}else o.click()}}},woostifyStickySection=function(){var e=document.querySelector(".sticky-add-to-cart-section"),t=document.querySelector("form.cart .single_add_to_cart_button");if(e&&t){var c=e.classList.contains("sticky-on-all-devices"),o=e.classList.contains("sticky-on-desktop"),i=e.classList.contains("sticky-on-mobile"),n=(e.querySelector(".sticky-atc-inner"),t.getBoundingClientRect().top||0),r=document.getElementById("wpadminbar"),a=r?r.offsetHeight:0,s=new Event("stickedAddToCart"),d=new Event("unStickedAddToCart");c||o&&window.matchMedia("( min-width: 768px )").matches||i&&window.matchMedia("( max-width: 767px )").matches?n-a>=0?(e.classList.remove("active"),document.documentElement.dispatchEvent(d)):(e.classList.add("active"),document.documentElement.dispatchEvent(s)):(e.classList.remove("active"),document.documentElement.dispatchEvent(d))}};document.addEventListener("DOMContentLoaded",(function(e){window.addEventListener("load",woostifyStickySection),window.addEventListener("resize",woostifyStickySection),window.addEventListener("scroll",(function(){woostifyScrollDetect(),woostifyStickySection()})),woostifyAddToCartSection()}));