"use strict";(self.blocksyJsonP=self.blocksyJsonP||[]).push([[798],{9798:function(e,t,n){n.r(t),n.d(t,{mount:function(){return c}});var o=n(2194),r=n.n(o);const c=function(e,t){let{event:n}=t;r()&&(ctEvents.trigger("ct:header:update"),function(e){if(!r())return;var t=e.closest("form"),n=t.find("button.button"),o=r()(t)[0].action,c=t.attr("method");void 0!==c&&""!=c||(c="POST");var d=new FormData(t[0]);d.append(n.attr("name"),n.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")),n.removeClass("added"),n.addClass("loading"),r()(document.body).trigger("adding_to_cart",[n,{}]),fetch(o,{method:c,body:d}).then((function(e){return e.text()})).then((function(e,o,c){const d=document.createElement("div");d.innerHTML=e;const i=".woocommerce-error, .wc-block-components-notice-banner.is-error";let s=d.querySelector(i);if(s&&s.innerHTML.length>0){let e=document.querySelector(".woocommerce-notices-wrapper");return e.querySelector(i)&&e.querySelector(i).remove(),void(e&&e.appendChild(s))}r()(document.body).trigger("added_to_cart",[{},e.cart_hash,n,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 n.removeClass("loading")})).finally((function(){return n.removeClass("loading")}))}(r()(e)))}}}]);