(()=>{var t={};t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(e=>{if(!e)return;const{currency:o,products:n,purchase:i,add_to_cart:a,eventsToTrack:r}=t.g._googlesitekit?.wcdata||{},c=r?.includes("add_to_cart"),s=r?.includes("purchase");if(a&&c){const{price:e}=a,n=u(e,o,a);t.g._googlesitekit?.gtagEvent?.("add_to_cart",n)}if(i&&s){const{id:e,totals:o,items:n,user_data:a}=i,r=u(o.total_price,o.currency_code,n,e,o.shipping_total,o.tax_total);t.g._googlesitekit?.gtagUserData&&a&&(r.user_data=a),t.g._googlesitekit?.gtagEvent?.("purchase",r)}const d=e("body");function u(t,e,o){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;const r={value:l(t),currency:e,items:[]};if(n&&(r.transaction_id=n),"number"==typeof i&&(r.shipping=i),"number"==typeof a&&(r.tax=a),o&&o.length)for(const t of o)r.items.push(g(t));else o&&o.id&&(r.items=[g(o)]);return r}function g(t){const{id:e,name:o,price:n,variation:i,quantity:a,categories:r}=t,c={item_id:e,item_name:o,price:l(n)};if(a&&(c.quantity=a),i&&(c.item_variant=i),r&&r?.length){let t=1;for(const e of r)c[t>1?`item_category${t}`:"item_category"]=e.name,t++}return c}function l(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return parseInt(t,10)/10**e}c&&(d.on("added_to_cart",(e,i,a,r)=>{const c=parseInt(r.data("product_id"),10);if(!c)return;const s=n?.find(t=>t?.id===c)||{},{price:d}=s,g=u(d,o,s);t.g._googlesitekit?.gtagEvent?.("add_to_cart",g)}),e(".products-block-post-template .product, .wc-block-product-template .product").each(function(){const i=e(this),a=parseInt(i.find("[data-product_id]").attr("data-product_id"),10);a&&i.on("click",i=>{const r=e(i.target).closest(".wc-block-components-product-button [data-product_id]");if(!r.length||!r.hasClass("add_to_cart_button")||r.hasClass("product_type_variable"))return;const c=n?.find(t=>t?.id===a)||{},{price:s}=c,d=u(s,o,c);t.g._googlesitekit?.gtagEvent?.("add_to_cart",d)})}))})(t.g.jQuery)})();