"use strict";(self.blocksyJsonP=self.blocksyJsonP||[]).push([[798],{798:function(e,t,o){o.r(t),o.d(t,{mount:function(){return c}});var n=o(194),r=o.n(n);const c=function(e,t){let{event:o}=t;r()&&(ctEvents.trigger("ct:header:update"),function(e){if(!r())return;var t=e.closest("form"),o=t.find("button.button"),n=r()(t)[0].action,c=t.attr("method");void 0!==c&&""!=c||(c="POST");var d=new FormData(t[0]);d.append(o.attr("name"),o.val());const a=[...d.entries()].reduce((function(e,t){return e+(t[0].indexOf("quantity")>-1?parseInt(t[1],10):0)}),0);t.closest(".quick-view-modal").length&&(t.closest(".quick-view-modal").find(".ct-quick-add").removeClass("added"),t.closest(".quick-view-modal").find(".ct-quick-add").addClass("loading")),o.removeClass("added"),o.addClass("loading"),r()(document.body).trigger("adding_to_cart",[o,{}]),fetch(n,{method:c,body:d}).then((function(e){return e.text()})).then((function(e,n,c){const d=document.createElement("div");d.innerHTML=e;let i=d.querySelector(".woocommerce-error");if(i&&i.innerHTML.length>0){let e=document.querySelector(".woocommerce-notices-wrapper");return e.querySelector(".woocommerce-error")&&e.querySelector(".woocommerce-error").remove(),void(e&&e.appendChild(i))}r()(document.body).trigger("added_to_cart",[{},e.cart_hash,o,a]),r()(document.body).trigger("wc_fragment_refresh"),t.closest(".quick-view-modal").length&&(t.closest(".quick-view-modal").find(".ct-quick-add").addClass("added"),t.closest(".quick-view-modal").find(".ct-quick-add").removeClass("loading"))})).catch((function(){return o.removeClass("loading")})).finally((function(){return o.removeClass("loading")}))}(r()(e)))}}}]);