!function(){"use strict";document.addEventListener("wp_listen_for_consent_change",t=>{const n=t.detail;for(const t in n)n.hasOwnProperty(t)&&t===window.wc_order_attribution.params.consentCategory&&window.wc_order_attribution.setOrderTracking("allow"===n[t])}),document.addEventListener("wp_consent_type_defined",()=>{window.wc_order_attribution.setOrderTracking(wp_has_consent(window.wc_order_attribution.params.consentCategory))})}();
((t,o)=>{if(!t)return;const l=(null===(o=globalThis._googlesitekit)||void 0===o?void 0:o.wcdata)||{},i=l.currency,e=l.products,n=l.purchase,a=l.add_to_cart,c=l.eventsToTrack,r=null==c?void 0:c.includes("add_to_cart"),d=null==c?void 0:c.includes("purchase");if(a&&r){var u,s;const t=h(a.price,i,a);null===(u=globalThis._googlesitekit)||void 0===u||null===(s=u.gtagEvent)||void 0===s||s.call(u,"add_to_cart",t)}if(n&&d){var g,_,p;const t=n.id,o=n.totals,l=n.items,i=n.user_data,e=h(o.total_price,o.currency_code,l,t,o.shipping_total,o.tax_total);null!==(g=globalThis._googlesitekit)&&void 0!==g&&g.gtagUserData&&i&&(e.user_data=i),null===(_=globalThis._googlesitekit)||void 0===_||null===(p=_.gtagEvent)||void 0===p||p.call(_,"purchase",e)}const v=t("body");function h(t,o,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,e=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;const a={value:m(t),currency:o,items:[]};if(i&&(a.transaction_id=i),"number"==typeof e&&(a.shipping=e),"number"==typeof n&&(a.tax=n),l&&l.length)for(const t of l)a.items.push(f(t));else l&&l.id&&(a.items=[f(l)]);return a}function f(t){const o=t.id,l=t.name,i=t.price,e=t.variation,n=t.quantity,a=t.categories,c={item_id:o,item_name:l,price:m(i)};if(n&&(c.quantity=n),e&&(c.item_variant=e),a&&null!=a&&a.length){let t=1;for(const o of a)c[t>1?"item_category".concat(t):"item_category"]=o.name,t++}return c}function m(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return parseInt(t,10)/10**o}r&&(v.on("added_to_cart",(t,o,l,n)=>{var a,c;if(null==n||!n.jquery)return;const r=parseInt(n.data("product_id"),10);if(!r)return;const d=(null==e?void 0:e.find(t=>(null==t?void 0:t.id)===r))||{},u=h(d.price,i,d);null===(a=globalThis._googlesitekit)||void 0===a||null===(c=a.gtagEvent)||void 0===c||c.call(a,"add_to_cart",u)}),t(".products-block-post-template .product, .wc-block-product-template .product").each(function(){const o=t(this),l=parseInt(o.find("[data-product_id]").attr("data-product_id"),10);l&&o.on("click",o=>{var n,a;const c=t(o.target).closest(".wc-block-components-product-button [data-product_id]");if(!c.length||!c.hasClass("add_to_cart_button")||c.hasClass("product_type_variable"))return;const r=(null==e?void 0:e.find(t=>(null==t?void 0:t.id)===l))||{},d=h(r.price,i,r);null===(n=globalThis._googlesitekit)||void 0===n||null===(a=n.gtagEvent)||void 0===a||a.call(n,"add_to_cart",d)})}))})(globalThis.jQuery);
jQuery(function(e){if("undefined"==typeof wc_cart_fragments_params)return!1;var t=!0,r=wc_cart_fragments_params.cart_hash_key;try{t="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("wc","test"),window.sessionStorage.removeItem("wc"),window.localStorage.setItem("wc","test"),window.localStorage.removeItem("wc")}catch(f){t=!1}function n(){t&&sessionStorage.setItem("wc_cart_created",(new Date).getTime())}function o(e){t&&(localStorage.setItem(r,e),sessionStorage.setItem(r,e))}var a={url:wc_cart_fragments_params.wc_ajax_url.toString().replace("%%endpoint%%","get_refreshed_fragments"),type:"POST",data:{time:(new Date).getTime()},timeout:wc_cart_fragments_params.request_timeout,success:function(r){r&&r.fragments&&(e.each(r.fragments,function(t,r){e(t).replaceWith(r)}),t&&(sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(r.fragments)),o(r.cart_hash),r.cart_hash&&n()),e(document.body).trigger("wc_fragments_refreshed"))},error:function(){e(document.body).trigger("wc_fragments_ajax_error")}};function s(){e.ajax(a)}if(t){var i=null;e(document.body).on("wc_fragment_refresh updated_wc_div",function(){s()}),e(document.body).on("added_to_cart removed_from_cart",function(e,t,a){var s=sessionStorage.getItem(r);null!==s&&s!==undefined&&""!==s||n(),sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(t)),o(a)}),e(document.body).on("wc_fragments_refreshed",function(){clearTimeout(i),i=setTimeout(s,864e5)}),e(window).on("storage onstorage",function(e){r===e.originalEvent.key&&localStorage.getItem(r)!==sessionStorage.getItem(r)&&s()}),e(window).on("pageshow",function(t){t.originalEvent.persisted&&(e(".widget_shopping_cart_content").empty(),e(document.body).trigger("wc_fragment_refresh"))});try{var c=JSON.parse(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),_=sessionStorage.getItem(r),g=Cookies.get("woocommerce_cart_hash"),m=sessionStorage.getItem("wc_cart_created");if(null!==_&&_!==undefined&&""!==_||(_=""),null!==g&&g!==undefined&&""!==g||(g=""),_&&(null===m||m===undefined||""===m))throw"No cart_created";if(m){var d=1*m+864e5,w=(new Date).getTime();if(d<w)throw"Fragment expired";i=setTimeout(s,d-w)}if(!c||!c["div.widget_shopping_cart_content"]||_!==g)throw"No fragment";e.each(c,function(t,r){e(t).replaceWith(r)}),e(document.body).trigger("wc_fragments_loaded")}catch(f){s()}}else s();Cookies.get("woocommerce_items_in_cart")>0?e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show():e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide(),e(document.body).on("adding_to_cart",function(){e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()}),"undefined"!=typeof wp&&wp.customize&&wp.customize.selectiveRefresh&&wp.customize.widgetsPreview&&wp.customize.widgetsPreview.WidgetPartial&&wp.customize.selectiveRefresh.bind("partial-content-rendered",function(){s()})});