((t,o,e,a,r)=>{"use strict";if(o.body.classList.contains("slide-cart")){const e=o.querySelectorAll('a[href="#slide-cart"]');e.length>0&&t.sideMenu(e,{close:"#cart-icon-close",beforeShow(){t.loadCss(a.theme_url+"/styles/wc/modules/basket",null,a.theme_v)}})}let i=!1;const c=(t=!1)=>{for(let e=o.querySelectorAll("#headerwrap .icon-shopping-cart"),a=e.length-1;a>-1;--a)e[a].classList.toggle("tf_loader",t)};t.body.on("added_to_cart removed_from_cart",(e=>{if("added_to_cart"===e.type){c();const e=~~r.ajaxCartSeconds;if(!1===i&&e>0){i=!0;const a=o.querySelector(t.isTouch?"#mobile-menu .cart-icon-link":".header-icons .cart-icon-link");if(null!==a){const r=a.getAttribute("href"),c=o.tfId(r.replace("#",""));null!==c&&(t.on("sidemenushow",((t,a,n)=>{r===t&&setTimeout((()=>{c.matches(":hover")?c.tfOn("mouseleave",(()=>{n.hidePanel(),o.body.classList.remove("tf_auto_cart_open")}),{once:!0,passive:!0}):(n.hidePanel(),o.body.classList.remove("tf_auto_cart_open")),i=!1}),e)}),!0),o.body.classList.add("tf_auto_cart_open"),setTimeout((()=>{a.click()}),100))}}}})).on("adding_to_cart",(()=>{c(!0)})),void 0!==e.wc_add_to_cart_params&&o.body.tfOn("click",(t=>{const o=t.target?.closest(".remove_from_cart_button");o&&(t.preventDefault(),o.classList.remove("tf_close"),o.classList.add("tf_loader"))})),r.ajaxSingleCart&&o.querySelector("form.cart")?.tfOn("submit",(async function(a){if(this.classList.contains("auction_form")||e.location.search.includes("switch-subscription")||null!==this.closest(".product-type-external"))return;a.preventDefault();const i=new FormData(this),n=this.tfClass("single_add_to_cart_button")[0]||this.querySelector('[type="submit"]'),s=n?.classList,d=this.querySelector('[name="add-to-cart"]');if(d&&!s?.contains("loading")){"INPUT"!==d.tagName&&i.set("add-to-cart",d.value),s&&(s.remove("added"),s.add("loading")),t.body.triggerHandler("adding_to_cart",[n,i]);try{const a=await t.fetch(i,null,null,(""+woocommerce_params.wc_ajax_url).replace("%%endpoint%%","theme_add_to_cart"));if(!a)throw"error";if(!a.fragments&&!a.success)throw a.data;const{fragments:c,cart_hash:d}=a;if(c){let t=null;for(let e=Object.keys(c),a=e.length-1;a>-1;--a){t=o.querySelectorAll(e[a]);for(let o=t.length-1;o>-1;--o)t[o].className+=" updating",t[o].outerHTML=c[e[a]]}}s?.add("added");try{t.body.triggerHandler("added_to_cart",[c,d,n])}catch(t){}r.redirect&&(e.location.href=r.redirect)}catch(a){const r=o.createDocumentFragment(),i=o.createElement("div"),c=Array.isArray(a)?a:[a];await t.loadJs(t.url+"js/admin/notification",!!e.TF_Notification);for(let t=0;t<c.length;++t){let e=o.createElement("template");e.innerHTML=c[t],r.appendChild(e.content)}i.className="wc_errors",i.appendChild(r),await TF_Notification.showHide("error",i,3e3)}s?.remove("loading"),c()}}))})(Themify,document,window,themify_vars,themifyScript);