"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,t){if(!r())return;var n=e.closest("form"),o=n.find(t.submitter),c=r()(n)[0].action;if("string"!=typeof c)return void n.submit();var i=n.attr("method");void 0!==i&&""!=i||(i="POST");var d=new FormData(n[0]);d.append(o.attr("name"),o.val()),[...d.entries()].reduce((function(e,t){return e+(t[0].indexOf("quantity")>-1?parseInt(t[1],10):0)}),0),n.closest(".quick-view-modal").length&&(n.closest(".quick-view-modal").find(".ct-quick-add").removeClass("added"),n.closest(".quick-view-modal").find(".ct-quick-add").addClass("loading")),o.removeClass("added"),o.addClass("loading"),r()(document.body).trigger("adding_to_cart",[o,[...d.entries()].reduce((function(e,t){let[n,o]=t;return e[n]=o,e}),{})]);const a=new URL(c),s=new URLSearchParams(a.search);s.append("blocksy_add_to_cart","yes"),window.ct_customizer_localizations&&s.set("wp_customize","on"),a.search=s.toString(),c=a.toString(),fetch(c,{method:i,body:d}).then((function(e){return e.json()})).then((function(e){let{success:t,data:c}=e;if(!t)return;const{notices:i,fragments:d,cart_hash:a}=c,s=".woocommerce-error, .wc-block-components-notice-banner.is-error",l=document.createElement("div");l.innerHTML=i;let u=l.querySelector(s);if(u&&u.innerHTML.length>0){let e=document.querySelector(".woocommerce-notices-wrapper");return e.querySelector(s)&&e.querySelector(s).remove(),void(e&&e.appendChild(u))}r()(document.body).trigger("added_to_cart",[d,a,o]),n.closest(".quick-view-modal").length&&(n.closest(".quick-view-modal").find(".ct-quick-add").addClass("added"),n.closest(".quick-view-modal").find(".ct-quick-add").removeClass("loading"))})).catch((function(){return o.removeClass("loading")})).finally((function(){return o.removeClass("loading")}))}(r()(e),n))}}}]);