"use strict";(globalThis.blocksyJsonP=globalThis.blocksyJsonP||[]).push([[21],{5021:function(e,t,n){n.r(t),n.d(t,{mount:function(){return c}});var o=n(8043),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 a=new FormData(n[0]);a.append(o.attr("name"),o.val()),[...a.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,[...a.entries()].reduce(function(e,t){let[n,o]=t;return e[n]=o,e},{})]);const d=new URL(c),s=new URLSearchParams(d.search);s.append("blocksy_add_to_cart","yes"),window.ct_customizer_localizations&&s.set("wp_customize","on"),d.search=s.toString(),c=d.toString(),fetch(c,{method:i,body:a}).then(function(e){return e.json()}).then(function(e){let{success:t,data:c}=e;if(!t)return;const{notices:i,fragments:a,cart_hash:d}=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",[a,d,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))}}}]);