`;c.id="label-product-"+n,c.innerHTML=o,c.className="cross-item-discount-promise-product",i.appendChild(c)}o++}Object.keys(t.discounts).length>1&&(e.appendChild(n),e.appendChild(i))}(t,e):function(){["wpn-show-cross-items-discounts","wpn-others-cross-items-discounts"].forEach(e=>{let t=document.getElementById(e);t&&t.remove()});const e=document.getElementsByClassName("cross-item-discount-promise-product");for(;e.length>0;)e[0].parentNode.removeChild(e[0])}())}function q(e){function t(e){const t=255,o=255,n=255,r=function(e){if(e.startsWith("#")){let t,o,n;return 7===e.length?(t=parseInt(e.slice(1,3),16),o=parseInt(e.slice(3,5),16),n=parseInt(e.slice(5,7),16)):4===e.length&&(t=parseInt(e[1]+e[1],16),o=parseInt(e[2]+e[2],16),n=parseInt(e[3]+e[3],16)),{r:t,g:o,b:n}}if(e.startsWith("rgb")){const t=e.match(/\d+/g).map(Number);return{r:t[0],g:t[1],b:t[2]}}return{r:255,g:255,b:255}}(e);return Math.sqrt(Math.pow(r.r-t,2)+Math.pow(r.g-o,2)+Math.pow(r.b-n,2))}const o=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(o)return o;const n=document.querySelector('[data-store="head"]');if(!n)return null;const r=getComputedStyle(n).backgroundColor,i=getComputedStyle(n).color,s=t(r),a=t(i);return 0===s&&0===a?null:s>a?r:i}function k(e,t,o){const n=H(e,t);n.length>0&&(!function(e,t,o){let n=document.querySelector('[data-store="product-price-'+o+'"]');null!==n&&e.forEach((function(e){let t=e.discount,i=document.getElementById("label-product-"+e.promiseId);if(Q(e.displayWeekInfo)){let t=!1;if(e.excludedProducts&&(t=e.excludedProducts.includes(String(o))),!t&&Y(e.showPromotionLabelForDevice)){let t=e.discount,i=document.getElementById("label-product-"+e.promiseId);if("combination_product"!==e.subtype&&!1!==e.showSinglePromise&&(null==i&&(i=document.createElement("div"),i.className="text text-primary line-item-discount-product",i.style.position="relative",i.id="label-product-"+e.promiseId),i.innerHTML=e.promise,n.contains(i)||n.appendChild(i)),"progressive"===e.subtype&&t.length>1){document.getElementById("wpn-progressive-table")||n.appendChild(function(e){let t=document.createElement("table");t.className="table table-striped",t.id="wpn-progressive-table",t.style.marginTop="20px";let o=document.createElement("tr"),n=document.createElement("th");n.innerHTML=v("Quantity");let r=document.createElement("th");return r.innerHTML=v("Discount"),o.appendChild(n),o.appendChild(r),t.appendChild(o),function(e,t){e.forEach((function(e){let o=document.createElement("tr"),n=document.createElement("td");n.innerHTML=e.minQuantityToApplyDiscount,o.appendChild(n);let r=document.createElement("td");r.innerHTML=e.percentageToDiscount+"% OFF",o.appendChild(r),t.appendChild(o)}))}(e,t),t}(t))}if("fixed_pack_price"===e.subtype&&t.length>=1){document.getElementById("wpn-fixed-pack-price-table")||n.appendChild(function(e,t){const o=document.createElement("table");o.className="table wpn-fixed-price-table",o.style.marginTop="5px";const n=document.createElement("div");n.style.marginTop="15px";const r=document.createElement("div");return r.style.cssText="color: #424242;font-size: 13px;font-style: normal;font-weight: 600;",r.innerText=e.promise,n.appendChild(r),function(e,t){t.forEach((function(t){let o=document.createElement("tr"),n=document.createElement("td");n.innerHTML=t.minQuantityToApplyDiscount,o.appendChild(n);let r=document.createElement("td");r.style.textAlign="right",r.innerHTML=u(t.fixedPrice),o.appendChild(r),e.appendChild(o)}))}(o,t),n.appendChild(o),n}(e,t))}if("combination_product"===e.subtype){document.getElementById("wpn-combination-product-table")||n.appendChild(Z(e,o))}if("object"==typeof e.promiseDetail&&e.subtype!==r){if(!document.getElementById("wpn-detail-container-promises-line-item-"+e.promiseId)){te(e)&&n.appendChild(te(e))}}}}else if(i&&i.remove(),R(e,t),"object"==typeof e.promiseDetail&&e.subtype!==r){let t=n.querySelector("#wpn-detail-container-promises-line-item-"+e.promiseId);t&&t.remove()}}));const i=document.querySelector('[data-store="product-image-'+o+'"]');if(null!==i){let o=e[0];if((0===o.promise.length||0==o.showSinglePromise||!Y(o.showPromotionLabelForDevice))&&e.length>1)for(const t of e)if(Y(t.showPromotionLabelForDevice)&&t.promise.length>0){o=t;break}Y(o.showPromotionLabelForDevice)&&V(i,o,t)}}(n,o,e),h(t))}function A(e,t=null){let o=0;return e.items.forEach(e=>{null!==t&&e.variant_id===t||(o+=parseFloat(e.unit_price/100)*e.quantity)}),o}async function B(){const e=await d();if(e&&e.templates){const t=e.templates.line_item_label;let o=e.lineItems;if(C())k(LS.product.id,o,t);else{document.querySelectorAll('[data-store^="product-info-"]').forEach(e=>{const n=e.getAttribute("data-store").split("-");if(n.length>=3){k(n[2],o,t)}})}if(!window.location.href.includes("checkout")){P(e,o),function(){const e=document.getElementsByClassName("wpn-product-data"),t=document.getElementsByClassName("wpn-variants"),o=document.getElementsByClassName("wpn-product-variant");for(const e of o)e.addEventListener("click",pe);const n=document.getElementById("wpn-icon-close-gift-modal");n&&n.addEventListener("click",(function(){be(),ge()}));for(const t of e)t.addEventListener("click",me);for(const e of t)e.addEventListener("click",me),(0===parseInt(e.dataset.hasMultipleVariants)||isNaN(parseInt(e.dataset.hasMultipleVariants)))&&e.closest(".wpn-product-card").addEventListener("click",(function(t){pe(t,e.dataset.singleProductId)}));const r=document.getElementById("wpn-button-add-gift"),i=document.getElementById("wpn-button-access-gift");null!==i&&i.addEventListener("click",(function(){fe()}));null!==r&&r.addEventListener("click",Pe);const s=document.querySelectorAll(".wpn-choose-gift-label, .wpn-change-gift-label"),a=document.getElementById("wpn-gift-overlay");a&&a.addEventListener("click",(function(){be(),ge()}));for(const e of s)e.addEventListener("click",ve)}(),function(){let e=q("--label-background");e=e||"#000",document.documentElement.style.setProperty("--label-background",e)}(),E(o),Be(e.templates.progress_promotion_html,o),await ye(LS.cart.subtotal/100),Le(T()),window._currentCartItems=LS.cart.items||[],document.addEventListener("cart.item.removed",(async function(t){const n=t.detail.variant_id,r=se.get("variantId");if(n==r)try{document.body.style.cursor="wait",await Se(),sessionStorage.removeItem("_wpn_variant_selected"),sessionStorage.removeItem("wpn_last_variant_added"),se.clear(),ie.clear(),ye(A(LS.cart,r)),Le(!1),document.body.style.cursor="default"}catch(e){console.error("Error in wpnRemoveCartItem:",e)}Be(e.templates.progress_promotion_html,o,t.detail.item_id),G(o)})),document.addEventListener("cart.viewed",(function(t){Be(e.templates.progress_promotion_html,o,!1),G(o)})),document.addEventListener("cart.item.added",(function(t){ye(A(LS.cart),!0),Le(T()),Be(e.templates.progress_promotion_html,o),G(o)})),document.addEventListener("cart.item.removed",(function(t){let n=t.detail.item_id;G(o),Be(e.templates.progress_promotion_html,o,n)})),h(o)}!function(e,t){document.querySelectorAll("[data-product-id]").forEach(o=>{let n=H(o.dataset.productId,e);if(n.length>0){let e=o.querySelector(c.getProductLabelSelector());if(null!==e){if(null===e.querySelector(".wpn-label-discount")){let e=n[0];if((0===e.promise.length||!Y(e.showPromotionLabelForDevice))&&n.length>1)for(const t of n)if(Y(t.showPromotionLabelForDevice)&&t.promise.length>0){e=t;break}e.promise.length>0&&Y(e.showPromotionLabelForDevice)&&V(o,e,t)}}}})}(o,t)}}const M={es:{"Applies to this products and can be combined with product from other selected categories.":"Aplica a este producto y es combinable con productos de otras categorías seleccionadas.","Applies to this products and can be combined with product from the same category ({{name}}).":"Aplica a este producto y es combinable con productos de la misma categoría ({{name}}).","Buy {{amount}} more to get a {{discount}}":"Compra {{amount}} más para obtener un {{discount}}","Can be combined with any other product from the store.":"Puede ser combinable con cualquier producto de la tienda.","Can be combined with other selected products.":"Promoción combinable con otros productos seleccionados.",Discount:"Descuento","Get a {{discount}} by buying more":"Consigue un {{discount}} comprando más","Hide categories":"Ocultar categorías","Hide products":"Ocultar productos",Quantity:"Cantidad","Show categories":"Mostrar categorías","More discounts":"Más descuentos","Limited time offer!":"¡Oferta por tiempo limitado!","Add {{remaining}} and get {{discount}}!":"Agrega {{remaining}} y obten {{discount}}!","Show products":"Mostrar productos","You already have a {{discount}} for buying in quantity":"Ya tienes un {{discount}} por comprar en cantidad","You already have a {{discount}} for exceeding {{amount}}":"Ya tienes un {{discount}} por superar {{amount}}","You already have a {{discount}}!":"¡Ya tenes un {{discount}}!","You have discounts on your purchase":"Tienes descuentos en tu compra","and more":"y más","Over {{amount}} and get {{discount}} on your purchase":"Supera los {{amount}} y obtén {{discount}} en tu compra","You have reached {{discount}} on your purchase":"Has alcanzado el {{discount}} en tu compra",or:"o","📢 Complement your purchase with {{qty}} {{product}} and get a {{discount}} on {{benefitProduct}}":"📢 Complementa tu compra con {{qty}} {{product}} y accede a un {{discount}} en {{benefitProduct}}","📢 Complement your purchase with {{qty}} {{category}} and get a {{discount}} on {{product}}":"📢 Complementa tu compra con {{qty}} {{category}} y accede a un {{discount}} en {{product}}","📢 By purchasing this product, you get {{discount}} on {{target}}:":"📢 Comprando este produto, accede a un {{discount}} en {{target}}:","the following categories":"las siguientes categorias","the following products":"los siguientes productos","You accessed a {{discount}} on {{product}}":"Accediste a un {{discount}} en {{product}}","Buy this product and access offers":"Compre éste producto y acceda a ofertas","Complement your purchase and access offers":"Complementa tu compra y acceda a ofertass"},pt:{"Applies to this products and can be combined with product from other selected categories.":"Aplica-se a este produto e pode ser combinado com produtos de outras categorias selecionadas.","Applies to this products and can be combined with product from the same category ({{name}}).":"Aplica-se a estes produtos e pode ser combinado com produtos da mesma categoria ({{name}}).","Buy {{amount}} more to get a {{discount}}":"Compre mais R{{amount}} para obter um {{discount}}","Can be combined with any other product from the store.":"Pode ser combinado com qualquer produto da loja.","Can be combined with other selected products.":"Promoção combinável com outros produtos selecionados.",Discount:"Desconto","Limited time offer!":"Oferta por tempo limitado!","Get a {{discount}} by buying more":"Conquiste um {{discount}} comprando mais","Hide categories":"Ocultar categorias","Hide products":"Ocultar produtos",Quantity:"Quantidade","More discounts":"Mais descontos","Show categories":"Mostrar categorias","Show products":"Mostrar produtos","You already have a {{discount}} for buying in quantity":"Você já tem um {{discount}} por comprar em quantidade","You already have a {{discount}} for exceeding {{amount}}":"Você já tem um {{discount}} por ultrapassar {{amount}}","You already have a {{discount}}!":"Você já tem um {{discount}}!","Add {{remaining}} and get {{discount}}!":"Você já tem um {{discount}}!","You have discounts on your purchase":"Você tem descontos em sua compra","and more":"e mais","Over {{amount}} and get {{discount}} on your purchase":"Acima de {{amount}} ganhe {{discount}} em sua compra","You have reached {{discount}} on your purchase":"Você alcançou {{discount}} de desconto na sua compra",or:"ou","📢 Complement your purchase with {{qty}} {{product}} and get a {{discount}} on {{benefitProduct}}":"📢 Complete sua compra com {{qty}} {{product}} e ganhe {{discount}} em {{benefitProduct}}","📢 Complement your purchase with {{qty}} {{category}} and get a {{discount}} on {{product}}":"📢 Complete sua compra com estes categorias e ganhe {{discount}} no {{product}}","📢 By purchasing this product, you get {{discount}} on {{target}}:":"📢 Comprando este produto, você ganha {{discount}} {{target}}:","the following categories":"nas seguintes categorias","the following products":"nos seguintes produtos","You accessed a {{discount}} on {{product}}":"Você obteve um {{discount}} em {{product}}","Buy this product and access offers":"Compre este produto e acesse ofertas","Complement your purchase and access offers":"Complete sua compra e acesse ofertas"}};function j(e,t,o){let n,r=!1;t>=2?(n=v("You already have a {{discount}} for buying in quantity"),r=!0):n=v("Get a {{discount}} by buying more");const i=e.discount[0].percentageToDiscount;return n=n.replace("{{discount}}",i+"% OFF"),{promiseText:n,allRulesCompleted:r,promiseId:e.promiseId}}function O(e,t,o){let n,r=!1,i=0;for(let s of e.discount){const e=parseInt(s.minQuantityToApplyDiscount||0);let a=s.percentageToDiscount+"% OFF";if(t>=e||t>=o?(n=v("You already have a {{discount}} for buying in quantity"),r=!0):(i=o-t,r=!1,n=v("Get a {{discount}} by buying more")),n=n.replace("{{discount}}",a),!r)break}return{promiseText:n,allRulesCompleted:r,promiseId:e.promiseId,remaining:i,total:o,currentQuantity:t}}function D(e,t,o){let n,r=!1,i=0;for(let s of e.discount){const e=s.minQuantityToApplyDiscount||0;let a=`${e}x${s.quantityToDiscount}`;if(t>=e||t>=o?(r=!0,n=v("You already have a {{discount}}!")):(i=o-t,r=!1,n=v("Add {{remaining}} and get {{discount}}!")),n=n.replace("{{remaining}}",i),n=n.replace("{{discount}}",a),!r)break}return{promiseText:n,allRulesCompleted:r,promiseId:e.promiseId,remaining:i,total:o}}function N(e,t){return!!e&&(Object.keys(e).includes("*")&&!!e["*"]||!!e[t])}function F(e,t){let o=null;for(const[n,r]of Object.entries(t))if(r.includes(parseInt(e))){o=n;break}return o}function $(e,t,o){return o.isProductToProduct?N(o.benefitedProducts,t)||N(o.triggerProducts,t):o.isProductToCategory?!!N(o.triggerProducts,t)||null!==F(t,o.productsByCategory):o.isCategoryToProduct?!!N(o.benefitedProducts,t)||null!==F(t,o.productsByCategory):!!o.isCategoryToCategory&&(null!==F(t,o.productsByCategory)||null!==F(t,o.triggerProducts))}function H(e,t){return null!==e&&t&&Array.isArray(t)?t.filter(t=>{let o=t.products;return("combination_product"!==t.subtype?N:$)(o,e,t)}):{}}function R(e,t){const o={progressive:"#wpn-progressive-table",combination_product:"#wpn-combination-product-table",fixed_pack_price:"#wpn-fixed-pack-price-table"};if(o[e.subtype]&&t.length>1){let t=o[e.subtype],n=displayContainer.querySelector(t);n&&n.remove()}}function Y(e){if(3===e||null===e)return!0;const t=function(){let e=navigator.userAgent.toLowerCase();return/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(e)?0:/(mobi|ipod|phone|blackberry|opera mini|fennec|minimo|symbian|psp|nintendo ds|archos|skyfire|puffin|blazer|bolt|gobrowser|iris|maemo|semc|teashark|uzard)/.test(e)?1:2}();return(0===t||1===t)&&1===e||2===t&&2===e}function Q(e){if(!e)return!0;if(0==e.length)return!0;const t=new Date,o=function(){const e=(new Date).getDay();return 0===e?7:e}(),n=t.toTimeString().slice(0,5);return e.some(({weekDay:e,startTime:t,endTime:r})=>(o===e||-1===e)&&n>=t&&n<=r)}function V(e,t,o){let n=e.querySelector(c.getProductLabelSelector());if(null!==n){if(null==n.querySelector(".wpn-label-discount")&&t.promise.length>0){if("utm"===t.subtype&&m(Math.floor(Date.now()/1e3)+b(t.expiryTime)))return;if(!Q(t.displayWeekInfo))return;if(t.excludedProducts&&t.excludedProducts.includes(function(e){return e.dataset.productId?e.dataset.productId:e.dataset.store.split("-")[2]}(e)))return;if(!n.querySelector(".promise-label-discount-"+t.promiseId)){let r,i=document.createElement("div");if(i.className="promise-label-discount-"+t.promiseId,"utm"===t.subtype){const e=window.location.href;p(new URLSearchParams(new URL(e).search),t.utmParams)&&(r=v("Limited time offer!"),i.innerHTML=o.replace(/{{promise}}/i,r),n.appendChild(i))}else r=t.promise,i.innerHTML=o.replace(/{{promise}}/i,r),n.appendChild(i);z(e)}}}}function z(e){e.querySelectorAll('[data-store="product-item-promotion-label"]').forEach(e=>{e.remove()}),e.querySelectorAll('[data-store="product-item-offer-label"]').forEach(e=>{e.remove()})}function W(e){const t=document.querySelector(`.js-cart-item[data-component-value="${e}"]`);if(!t)return 0;const o=t.querySelector('input[name^="quantity["]');return o&&parseInt(o.value,10)||0}function G(e){const t=e.find(e=>"combination_product"===e.subtype);if(!t||!LS.product)return;const o=document.getElementById("wpn-cart-table-combination-product-container");if(!o)return;let n=o.querySelector(".wpn-combination-product-table"),r=document.getElementById("wpn-combination-product-title-promotion"),i=J(t,LS.product.id);r.textContent=i.text,i.isPromoAvailable?(n.style.opacity="1",n.style.pointerEvents="default"):(n.style.opacity="0.3",n.style.pointerEvents="none")}function U(e,t,o,n=null){const[r,i]=function(e,t){let o=0;Object.keys(e).forEach(e=>{const t=W(e);o+=null==t?0:t});const n=parseInt(t.minQuantityToApplyDiscount,10),r=parseInt(t.maxTimesToBeApplied,10);if(!Number.isFinite(n)||n<=0)return[0,o];const i=Math.floor(o/n);return Number.isFinite(r)&&r>0?[Math.min(i,r),o]:[i,o]}(t,e),s=parseInt(e.maxTimesToBeApplied,10);let a=0;return o&&Object.keys(o).length>0?a=function(e){let t=0;return Object.keys(e).forEach(e=>{const o=W(e);t+=null==o?0:o}),t}(o):n&&Object.keys(n).length>0&&(a=function(e){let t=0;return Object.keys(e).forEach(o=>{const n=e[o];Array.isArray(n)&&n.forEach(e=>{const o=W(e.id);t+=null==o?0:o})}),t}(n)),0===i&&0!==a||(0!==i&&0===a||(0===i&&0===a||(r<1||(!Number.isFinite(s)||0===s||!(a>=s)))))}function J(e,t){return e.isProductToProduct?function(){const o=N(e.triggerProducts,t),n=N(e.benefitedProducts,t);if(!o&&!n)return{text:null,isPromoAvailable:!1};const r=e.discount[0],i=U(r,e.triggerProducts,e.benefitedProducts,null);if(o){const t=Object.keys(e.benefitedProducts)[0],o=e.benefitedProducts[t];return{text:i?v("Buy this product and access offers"):v("You accessed a {{discount}} on {{product}}").replace("{{product}}",o.title).replace("{{discount}}",r.promise),isPromoAvailable:i}}return{text:v("Complement your purchase and access offers"),isPromoAvailable:i}}():e.isProductToCategory?function(){const o=N(e.triggerProducts,t),n=null!==F(t,e.productsByCategory);if(!o&&!n)return{text:null,isPromoAvailable:!1};const r=e.discount[0],i=U(r,e.triggerProducts,null,e.productsByCategory);if(o){const t=Object.keys(e.benefitedCategories)[0],o=e.benefitedCategories[t];return{text:i?v("Buy this product and access offers"):v("You accessed a {{discount}} on {{product}}").replace("{{product}}",o.title).replace("{{discount}}",r.promise),isPromoAvailable:i}}return{text:v("Complement your purchase and access offers"),isPromoAvailable:i}}():e.isCategoryToProduct?function(){const o=null!==F(t,e.productsByCategory),n=N(e.benefitedProducts,t);if(!o&&!n)return{text:null,isPromoAvailable:!1};const r=e.discount[0],i=U(r,e.productsByCategory,e.benefitedProducts,null);if(o){const t=Object.keys(e.benefitedProducts)[0],o=e.benefitedProducts[t];return{text:i?v("Buy this product and access offers"):v("You accessed a {{discount}} on {{product}}").replace("{{product}}",o.title).replace("{{discount}}",r.promise),isPromoAvailable:i}}return{text:v("Complement your purchase and access offers"),isPromoAvailable:i}}():e.isCategoryToCategory?function(){const o=F(t,e.triggerProducts),n=F(t,e.productsByCategory);if(!o&&!n)return{text:null,isPromoAvailable:!1};const r=e.discount[0],i=U(r,e.triggerProducts,null,e.productsByCategory);if(o){const t=Object.keys(e.benefitedCategories)[0],o=e.benefitedCategories[t];return{text:i?v("Buy this product and access offers"):v("You accessed a {{discount}} on {{product}}").replace("{{product}}",o.title).replace("{{discount}}",r.promise),isPromoAvailable:i}}return{text:v("Complement your purchase and access offers"),isPromoAvailable:i}}():{text:null,isPromoAvailable:!1}}function Z(e,t){const o=document.createElement("table");o.className="table wpn-combination-product-table",o.style.marginTop="5px";const n=document.createElement("div");n.style.marginTop="15px";const r=document.createElement("div");r.style.cssText="color: #424242;font-size: 13px;font-style: normal;font-weight: 600;";let i=null;return e.isProductToProduct?i=function(){let o=N(e.triggerProducts,t);if(!N(e.benefitedProducts,t)&&!o)return null;const n=e.discount[0];if(console.log(o),o)return{text:v("📢 By purchasing this product, you get {{discount}} on {{target}}:").replace("{{target}}",v("the following products")).replace("{{discount}}",n.promise),items:e.benefitedProducts};const r=e.benefitedProducts[t],i=Object.values(e.triggerProducts)[0];return{text:v("📢 Complement your purchase with {{qty}} {{product}} and get a {{discount}} on {{benefitProduct}}").replace("{{qty}}",n.minQuantityToApplyDiscount).replace("{{product}}",i.title).replace("{{benefitProduct}}",r.title).replace("{{discount}}",n.promise),items:e.triggerProducts}}():e.isProductToCategory?i=function(){let o=N(e.triggerProducts,t);if(!(null!==F(t,e.productsByCategory))&&!o)return null;const n=e.discount[0];if(o)return{text:v("📢 By purchasing this product, you get {{discount}} on {{target}}:").replace("{{target}}",v("the following categories")).replace("{{discount}}",n.promise),items:e.benefitedCategories};const r=v("the following categories"),i=Object.values(e.triggerProducts)[0];let s=v("📢 Complement your purchase with {{qty}} {{product}} and get a {{discount}} on {{benefitProduct}}").replace("{{qty}}",n.minQuantityToApplyDiscount).replace("{{product}}",i.title).replace("{{benefitProduct}}",r).replace("{{discount}}",n.promise);return titles&&(s+=": "+titles),{text:s,items:e.triggerProducts||{}}}():e.isCategoryToProduct?i=function(){let o=null!==F(t,e.productsByCategory);if(!N(e.benefitedProducts,t)&&!o)return null;const n=e.discount[0];if(o)return{text:v("📢 By purchasing this product, you get {{discount}} on {{target}}:").replace("{{target}}",v("the following products")).replace("{{discount}}",n.promise),items:e.benefitedProducts};const r=e.benefitedProducts[t];return{text:v("📢 Complement your purchase with {{qty}} {{category}} and get a {{discount}} on {{product}}").replace("{{qty}}",n.minQuantityToApplyDiscount).replace("{{category}}",triggerCategory.title).replace("{{product}}",r.title).replace("{{discount}}",n.promise),items:e.triggerCategories}}():e.isCategoryToCategory&&(i=function(){let o=F(t,e.triggerProducts),n=F(t,e.productsByCategory);if(!n&&!o)return null;const r=e.discount[0];if(o)return{text:v("📢 By purchasing this product, you get {{discount}} on {{target}}:").replace("{{target}}",v("the following categories")).replace("{{discount}}",r.promise),items:e.benefitedCategories};const i=e.benefitedCategories[n];return{text:v("📢 Complement your purchase with {{qty}} {{category}} and get a {{discount}} on {{product}}").replace("{{qty}}",r.minQuantityToApplyDiscount).replace("{{category}}").replace("{{product}}",i.title).replace("{{discount}}",r.promise),items:e.triggerCategories}}()),i?(r.innerText=i.text,n.appendChild(r),function(e,t){for(const[o,n]of Object.entries(t)){let t=document.createElement("tr"),o=document.createElement("td");o.style="border: 1px solid #ddd;";let r=document.createElement("a"),i=void 0!==n.url?n.url:window.location.origin+"/"+n.title.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s]/g,"").trim().replace(/\s+/g,"-");if(r.href=i,r.text=n.title,r.classList.add("text-primary"),o.appendChild(r),t.appendChild(o),void 0!==n.price&&"$0"!==n.price&&"R$0"!==n.price){let e=document.createElement("td");e.innerHTML=n.price,e.style="border: 1px solid #ddd; text-align:right;width:25%;",t.appendChild(e)}e.appendChild(t)}}(o,i.items),n.appendChild(o),n):null}function K(e,...t){e.innerText=v("Can be combined with any other product from the store.")}function X(e,t,o,n){n&&(e.innerText=v("Can be combined with other selected products.")),t.dataset.showText=v("Show products"),t.dataset.hideText=v("Hide products"),t.innerText=v("Show products")}function ee(e,t,o,n){n&&(e.innerText=v("Applies to this products and can be combined with product from other selected categories."));let r=1===o.names.length,i=o.names[0];if(r){let t=v("Applies to this products and can be combined with product from the same category ({{name}}).");e.innerText=t.replace("{{name}}",i)}t.dataset.showText=v("Show categories"),t.dataset.hideText=v("Hide categories"),t.innerText=v("Show categories")}function te(e){const t={all:K,product:X,category:ee};if(0==e.showSinglePromise)return null;const o=document.createElement("div");o.style.marginTop="10px",o.style.marginBottom="10px";const n=document.createElement("div");o.id="wpn-detail-container-promises-line-item-"+e.promiseId,n.classList.add("text");const r="wpn-promise-detail-"+e.promiseId,i=function(e){const t=document.createElement("div");return t.style.marginTop="10px",t.style.marginBottom="5px",t.classList.add("btn-link"),t.classList.add("wpn-promise-detail-toggler"),t.dataset.target=e,t.dataset.status="hidden",t.addEventListener("click",S),t}(r);let s=e.promiseDetail.filter;if(s in t){(0,t[s])(n,i,e.promiseDetail,parseInt(e.isCombinable))}if(o.appendChild(n),void 0!==e.promiseDetail.names&&e.promiseDetail.names.length>1){o.appendChild(i);const t=document.createElement("div");t.id=r,t.style.display="none";let n=e.promiseDetail.names.join(", ");e.promiseDetail.tooLong&&(n=n+" "+v("and others")),t.innerText=n,o.appendChild(t)}return o}function oe(e,t){const o='[data-store="product-price-'+t+'"]';let n=document.querySelector(o);const r=void 0!==e.showDiscountedPriceOnly&&"1"===e.showDiscountedPriceOnly;if(null!==n&&r){let t=document.createElement("div");t.className="text text-primary user-item-discount",t.style.position="relative",t.innerHTML=e.promise,n.appendChild(t)}re(document.body,e,o,c.getProductNodeComparePriceSelector(),c.getProductNodeCurrentPriceSelector())}function ne(e,t,o,n,r,i){t.dataset.discountSetup||(!function(e,t,o,n,r){if(!e)return;let i=!1;function s(){i||(i=!0,setTimeout(()=>{e.dataset.originalPrice&&delete e.dataset.originalPrice,re(e,t,o,n,r),i=!1},150))}e.querySelectorAll(".js-insta-variant, .btn-variant, [data-option]").forEach(e=>{e.dataset.discountListenerAttached||(e.addEventListener("click",s,{passive:!0}),e.dataset.discountListenerAttached="true")}),e.querySelectorAll(".js-variation-option").forEach(e=>{e.dataset.discountListenerAttached||(e.addEventListener("change",s),e.dataset.discountListenerAttached="true")})}(t,o,n,r,i),t.dataset.discountSetup="true")}function re(e,t,o,n,r){let i;const s=void 0!==t.showDiscountedPriceOnly&&"1"===t.showDiscountedPriceOnly,c=e.dataset.productId?e.dataset.productId:"object"==typeof LS.product?LS.product.id:null;if(!c)return;if(t.subtype===a){let e=null;for(const[o,n]of Object.entries(t.productsByCategory))if(n.includes(parseInt(c))){e=o;break}let o=t.discount.find(t=>t.category===e);if(!o&&(o=t.discount[t.discount.length-1],"-1"!==o.category))return;i=parseFloat(o.percentageToDiscount)/100}else i=parseFloat(t.discount[0].discount)/100;if(0===i)return;let l=e.querySelector(o),d=parseInt(100*i);function u(e){const t=document.createElement("div");t.className="wpn-compare-user-prices",t.style.gap="10px",t.style.display="flex",t.style.justifyContent="center",t.style.marginTop="12px",t.appendChild(e);const o=document.createElement("span");o.className="wpn-discount",o.textContent=d+"%OFF",o.style.marginLeft="5px",t.appendChild(o),l.insertBefore(t,l.firstChild)}if(d=Math.abs(d-Math.floor(d))<.01?Math.floor(d):Math.round(100*d)/100,null!==l){let a=l.querySelector(n),p=l.querySelector(r);if(null==p&&(p=l.querySelector(".js-price-display")),null!==a&&null!==p){let l=x(a,p),m=x(p,a);if(!("originalPrice"in e.dataset)){e.dataset.originalPrice=l,l=parseFloat(l),m=parseFloat(m);const f=m*(1-i);if(m>0&&(s||(m===l?(L(a,l),a.style.display="initial"):(L(a,m),a.style.display="initial")),L(p,f)),z(e),C()&&!s)if(c==LS.product.id){let i=document.createElement("small");i.textContent=d+"%OFF",i.style.fontSize="15px",i.style.fontWeight="500",i.classList.add("wpn-discount-to-apply-span"),p.appendChild(i),ne(0,e,t,o,n,r)}else u(a);else s||u(a)}}}}let ie=le(),se=le(!0),ae=new Map;const ce=async function(){let e=sessionStorage.getItem("_wpn_promotion_with_variants");if(null!==e&&"undefined"!==e)return JSON.parse(e);const t=await d();if(t&&t.lineItems&&(e=t.lineItems.filter(e=>e.discount.some(e=>void 0!==e.variants)),e))return sessionStorage.setItem("_wpn_promotion_with_variants",JSON.stringify(e[0])),e[0];return sessionStorage.setItem("_wpn_promotion_with_variants",JSON.stringify([])),[]}();function le(e=!1){const t=sessionStorage.getItem("_wpn_variant_selected"),o=new Map;if(t){const n=JSON.parse(t);e?Object.entries(n).forEach(([e,t])=>{o.set(e,t)}):Object.entries(n.values).forEach(([e,t])=>{o.set(e,t)})}return o}function de(e,t){return(o=e.discount,new Promise(e=>{!function t(){o&&"function"==typeof o[Symbol.iterator]?e(o):setTimeout(t,500)}()})).then(e=>{const o=e.reduce((e,t)=>(e[t.minQuantityToApplyDiscount]=t,e),{});if(0===ae.size)return{ok:!1,message:"el usuario no tiene nada seleccionado"};let n=new Map(ae),r=o[n.get("productRule")],i=void 0!==n.get("productId")?n.get("productId"):n.get("single-variant-product"),s=n.has("single-variant-product");n.delete("productId"),n.delete("productRule");let a=r.variants[i];if(s)return{ok:!0,variantId:a.variants[0].id,productId:i,minPromotionThreshold:parseInt(r.minQuantityToApplyDiscount)};let c=!1,l=null;for(const e of Object.values(a.variants)){if(0===e.values.length)continue;let t=Object.keys(e.values),o=Object.values(e.values);const r=Array.from(n.keys()),i=Array.from(n.values()),s=t.length===r.length&&t.every(e=>n.has(e));if(c=o.length===i.length&&o.every(e=>Array.from(n.values()).includes(e))&&s,c){l=e.id;break}}return c?{ok:!0,variantId:l,productId:i,minPromotionThreshold:parseInt(r.minQuantityToApplyDiscount)}:{ok:!1,message:"No se encontro la variante en las promociones para: "+t}});var o}function ue(e,t){e.closest(".wpn-container-data-variants").querySelector(".wpn-variant-value").textContent=e.innerText;const o=document.getElementsByClassName("wpn-product-variant"),n=parseInt(e.dataset.productRule);ce.then(e=>{var r,i;const s=function(e){const t={};for(const o in e){const n=e[o];for(const e in n.variants){const o=n.variants[e],r=Array.from(ae.values()),i=Object.values(o.values),s=Object.keys(o.values);let a=!1;for(let e of r)if(i.includes(e)){a=!0;break}if(a)for(let e=0;eparseInt(e.minQuantityToApplyDiscount)>=i).map(e=>e.variants))[0]),a=Object.keys(s);for(let e=0;e{e.style.display="block"}),document.querySelector(".wpn-product-list-container").classList.add("hidden"),document.querySelector(".gift-choose").classList.add("hidden"),document.querySelector(".gift-access").classList.remove("hidden"),document.querySelector("#wpn-button-add-gift").classList.add("hidden"),document.querySelector("#wpn-button-access-gift").classList.remove("hidden")):(document.querySelectorAll(".wpn-access-gift").forEach(e=>{e.style.display="none"}),document.querySelector(".wpn-product-list-container").classList.remove("hidden"),document.querySelector(".gift-choose").classList.remove("hidden"),document.querySelector(".gift-access").classList.add("hidden"),document.querySelector("#wpn-button-add-gift").classList.remove("hidden"),document.querySelector("#wpn-button-access-gift").classList.add("hidden"))}function ge(){(function(){let e=!0;return document.querySelectorAll(".wpn-access-gift").forEach(t=>{"block"!==window.getComputedStyle(t).display&&(e=!1)}),e})()&&sessionStorage.setItem("wpn_showed_confetti_modal","1")}async function ye(e,t=!1){const o=document.getElementsByClassName("wpn-product-container");if(0===o.length)return;const n=document.getElementById("wpn-button-add-container");let r=o[0],i=parseFloat(r.dataset.amountToBeat),s=0;if(0!==se.size){let e=se.get("price");s=void 0!==e?e:0}e-=s;let a=i-parseFloat(e);if(e<=i){const e=document.querySelectorAll(".wpn-remaining-amount.gift");for(let t=0;t0?n.classList.add("disabled"):n.classList.remove("disabled")}else n.classList.remove("disabled");const c=document.getElementsByClassName("wpn-choose-gift-label");for(let e=0;e{e.classList.remove("text-secondary"),e.classList.add("wpn-text-primary")}),fe(!0)):(r.classList.add("show-remaining-amount"),o.forEach(e=>{e.classList.remove("wpn-text-primary"),e.classList.add("text-secondary")}),fe())}}(a),he(se)&&a<=0){sessionStorage.getItem("wpn_showed_confetti_modal")?sessionStorage.setItem("wpn_showed_confetti_modal","1"):(!function(){const e=document.getElementById("confetti-container");for(let t=0;t<200;t++){const t=document.createElement("div");t.classList.add("confetti"),t.style.backgroundColor=`hsl(${360*Math.random()}, 100%, 50%)`,t.style.left=100*Math.random()+"%",t.style.top="0%",e.appendChild(t)}}(),setTimeout(we,500),be())}for(let t=0;t=parseInt(n.dataset.amountToBeat)?n.classList.remove("disabled"):n.classList.add("disabled");let r=n.querySelector(".wpn-product-card"),i=r.querySelector(".wpn-product-data").dataset.productId,s=le(!0).get("productId")==parseInt(i);s&&n.classList.add("disabled"),r.classList.contains("active")&&s&&r.classList.remove("active");let a=r.querySelector(".wpn-variants");a.classList.contains("inactive")||a.classList.add("inactive")}if(0!==se.size&&fe(!1),t&&!he(se)){e{const t=500+1e3*Math.random(),o=-Math.PI/1.5+Math.random()*(2*Math.PI/3),n=20+100*Math.random();e.style.opacity=1,e.style.transition=`all ${t}ms ease-out`,e.style.transform=`translate(${Math.cos(o)*n}px, ${Math.sin(o)*n-100}px)`,setTimeout((function(){e.remove()}),t+50)})}function ve(e){e.target.closest(".wpn-choose-gift-label-container")&&(setTimeout(we,500),be())}function Se(){const e=LS.cart.id;return new Promise((function(t,n){fetch(`${o}/tiendanube/delete-variant-gift?cartId=${e}`,{method:"POST",mode:"cors"}).then(e=>e.json()).then(e=>{t(e.success)}).catch(e=>{console.error("error at remove cart item wpn: ",e),n(e)})}))}function Ce(e){const t=document.querySelectorAll(".js-cart-item");let o=null;const n=Array.from(t).find((function(t){let o=t.querySelector('[data-component="line-item.name"]');if(o||(o=t.querySelector(".cart-item-name")),null==o)return console.error('El item del carro no tiene un elemento hijo con data-component="line-item.name" o .cart-item-name'),null;"A"!==o.tagName&&(o=o.querySelector("a"));let n=o.getAttribute("href");if(n=n.split("="),2!==n.length)return!1;return parseInt(n[1])===parseInt(e)}));return n&&(o=n.dataset.itemId),o}async function Ie(e,t,o=!0,n=!0){const r=Ce(t);if(null==r)return console.log("variant not found in the cart to be removed"),!1;let i=document.querySelector(`.js-cart-quantity-input[data-item-id="${parseInt(r)}"]`),s=0;if(i&&(s=i.value-1),n){await Se()||console.error("error removing wpn item")}let a=[],c=encodeURIComponent(`quantity[${r}]`),l=encodeURIComponent(s);a.push(c+"="+l),a=a.join("&");fetch("/cart/update/",{method:"POST",body:a,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}}).then(e=>{o?window.location.reload():Le(!1)}).catch(e=>(console.error("error updating the cart: ",e),!1))}function Le(e=!0){const t=document.querySelectorAll(".wpn-choose-gift-label"),o=document.querySelectorAll(".wpn-change-gift-label"),n=document.getElementById("wpn-button-add-gift");null!==n&&o.forEach(o=>{e?(o.classList.remove("hidden"),n.textContent=n.dataset.changeGiftText,t.forEach(e=>{e.classList.add("hidden")})):(o.classList.add("hidden"),n.textContent=n.dataset.chooseGiftText,t.forEach(e=>{e.classList.remove("hidden")}))})}async function xe(e){0!==se.size&&await Ie(LS.cart.id,se.get("variantId"),!1,!1),document.body.style.cursor="wait";let t=`${e.productId}_${e.variantId}`,n=LS.cart.id;return null!==n&&await async function(e,t){return new Promise((function(n,r){fetch(`${o}/tiendanube/add-variant-gift?variantsId[]=${[e]}&cartId=${t}`,{method:"POST",mode:"cors"}).then(e=>e.json()).then(e=>{be(),n(e.success)}).catch(e=>{console.error("error at add item to cart wpn: ",e),r(e)})}))}(t,n),e}async function Pe(){try{const e=await de(await ce,ae);if(ae.get("productId")&&ae.delete("productId"),ae.get("productRule")&&ae.delete("productRule"),!e.ok)return void console.error(e.message);const t=ae.get("single-variant-product")?[]:Array.from(ae.values());document.body.style.cursor="wait";if(!await xe(e))return void console.error("processAndAddToCart devolvió null");const o=function(e,t=[]){let o="";if(t&&t.length>0)for(let e=0;e`;let n=`\n \n `;try{return LS.addToCartEnhanced(jQueryNuvem(n)),{ok:!0}}catch(e){return console.error("addItemToCartNuvem error:",e),{ok:!1,message:e.message||"update_error"}}}(e.productId,t);if(!1===o.ok)return void console.error("Falló el addToCartNuvem:",o.message);const n=e.variantId,r=Ee(n);let i=0;const s=100,a=setInterval(()=>{i++;if(Ee(n)>r){clearInterval(a);const t=function(e){let t=document.querySelector(`.wpn-product-data[data-product-id="${e}"]`);if(t){let e=t.querySelector(".price");if(e){let t=e.textContent.trim();return 0===t.length&&(t=0),parseInt(t.match(/[\d.]+/g).join(""))}console.error('Elemento con clase "price" no encontrado.')}else console.error("Producto con el productId especificado no encontrado.");return null}(e.productId),o={variantId:e.variantId,values:Object.fromEntries(ae),productId:e.productId,minPromotionThreshold:e.minPromotionThreshold,price:t};ae.clear(),sessionStorage.setItem("_wpn_variant_selected",JSON.stringify(o)),sessionStorage.setItem("wpn_last_variant_added",e.variantId),document.body.style.cursor="default",window.location.reload()}else i>=s&&(clearInterval(a),document.body.style.cursor="default",console.error("Timeout: El item no se agregó al carrito en el tiempo esperado"))},250)}catch(e){document.body.style.cursor="default",console.error("addItemToCart error:",e)}}function Ee(e){if(!LS.cart.items)return 0;const t=LS.cart.items.find(t=>t.variant_id===e);return t?t.quantity:0}async function Te(e,t){let{isApplied:o,promotionMessage:n}=await function(e){return d().then((function(t){let o=!1,n=0,r="";if(Object.keys(t.crossItems)>0&&Q(t.crossItems.displayWeekInfo)){let i=t.crossItems.discounts;Object.entries(i).forEach(([t,i])=>{let s=parseFloat(t);e<=s&&(s{t.forEach(t=>{if([r,i,s,a].includes(t.subtype))return;let l=parseInt(e.dataset.componentValue),d=e.dataset.itemId,u=!1;if(t.excludedProducts&&0!==t.excludedProducts.length&&(u=t.excludedProducts.includes(String(l))),t.products&&(t.products[l]||t.products["*"])&&!u){c.has(t.promiseId)?c.get(t.promiseId).push(l):c.set(t.promiseId,[l]);let e="",s=0,a=parseInt(t.discount[t.discount.length-1].minQuantityToApplyDiscount),u=c.get(t.promiseId),p=function(e){if(qe.has(e))return qe.get(e);let t=document.querySelector('.js-cart-item[data-component-value="'+e+'"]');return t?qe.has(e)||qe.set(e,t):qe.has(e)&&qe.delete(e),qe.get(e)}(l),m=function(e,t,o,n,s=null){let a=0;if(n){let e=parseInt(n.dataset.itemId);if(e!==parseInt(s)){let t=LS.cart.items.filter(t=>t.item_id===e);const o=t.length>0?t[t.length-1]:null;let n=document.querySelector(`#product_form[data-store="product-form-${e}"] #quantity`);n||(n=document.querySelector(`.cart-quantity-input[data-item-id="${e}"]`));let r=n?parseInt(n.value,10):0;a+=o?o.quantity:r}}let c={progressive:(e,o)=>O(e,o,t),nxm:(e,o)=>D(e,o,t),[i]:(e,t)=>j(e,t)},l=[];for(const o of e.discount)if(o.subtype!==r&&"utm"!==o.subtype){let o=c[e.subtype];o&&l.push(o(e,a,t)),l=l.filter((e,t,o)=>t===o.findIndex(t=>t.promiseId===e.promiseId))}return l}(t,a,0,p,o);u.forEach(o=>{if(p){const r=m.filter(e=>e.allRulesCompleted),i=m.filter(e=>!e.allRulesCompleted);if(i.length>0)e=i[0].promiseText,s=i[0].remaining;else if(r.length>0){let t=r[r.length-1];t&&(e=t.promiseText,s=t.remaining)}n[t.promiseId]||(n[t.promiseId]=[]);n[t.promiseId].some(e=>e.id===o)||n[t.promiseId].push({id:o,lineItemId:d,text:e,remaining:s,total:a,cartItem:p,_wpnIsActiveBySchedule:Q(t.displayWeekInfo)})}})}})}),n}function Ae(e){let t=document.getElementsByClassName("wpn-promo-"+e);for(;t.length>0;)t[0].parentNode.removeChild(t[0])}function Be(e,t,o=null){let n=document.querySelectorAll(".js-cart-item");if(!n)return;let r=ke(n,t,o),i={};Object.keys(r).forEach(t=>{let o,n,s;o=i[t]?i[t].oldProgressBarContainer:document.querySelector(".wpn-promo-"+t),o?(n=o.querySelector(".wpn-progress-container").style.backgroundColor,s=o.querySelector(".wpn-progress-bar").style.backgroundColor):[n,s]=je(),t in i||(i[t]={backgroundColor:n,progressColor:s,oldProgressBarContainer:o});for(const o of r[t]){let n="wpn-progress-bar-container-"+o.id,r=document.getElementById(n);if(o._wpnIsActiveBySchedule){if(document.getElementById(n)){r.getElementsByClassName("wpn-progress-text")[0].innerHTML=o.text}else r=_e(o.cartItem,e,n,o.id,t);Ne("line_items",{progressBarContainer:r,finalText:o.text,remaining:o.remaining,total:o.total,backgroundColor:i[t].backgroundColor,progressColor:i[t].progressColor})}else Ae(t)}})}function Me(e,t){return Math.floor(Math.random()*(t-e))+e}function je(e=!1){let t="#B5B5B5",o="#4F4F4F";if(!e){const e=Me(0,360),n=Me(40,80);t=`hsl(${e}, ${n}%, ${Me(60,80)}%)`,o=`hsl(${e}, ${n}%, ${Me(30,50)}%)`}return[t,o]}function Oe(e,t,o,n){let r=e.querySelector(".wpn-progress-bar");""===e.querySelector(".wpn-progress-container").style.backgroundColor&&""===r.style.backgroundColor&&(e.querySelector(".wpn-progress-container").style.backgroundColor=o,r.style.backgroundColor=n),r.style.width=t+"%"}function De(e){let t=document.querySelector(".wpn-progress-cross-items");t.style.display=0===e.amount?"none":"inherit";let[o,n]=je(!0);const r=Object.keys(e.crossItemDiscounts),i=r[r.length-1];let s=parseInt(i);Oe(t,e.amount>s?100:e.amount/Math.floor(1.2*s)*100,o,n),t.querySelector(".wpn-progress-text").innerText=function(e,t){let o=null,n=null;for(let r in t){if(e<=parseFloat(r)){o=r;break}n=t[r]}let r=v("Over {{amount}} and get {{discount}} on your purchase"),i=Object.keys(t)[0];return o||n?o?(r=r.replace("{{amount}}",u(parseFloat(o))),r=r.replace("{{discount}}",t[o].discount),r):(r=v("You have reached {{discount}} on your purchase"),r=r.replace("{{discount}}",n.discount),r):(r=r.replace("{{amount}}",u(parseFloat(i))),r=r.replace("{{discount}}",t[i].discount),r)}(e.amount,e.crossItemDiscounts)}function Ne(e,t){let o={cross_items:De,line_items:Fe};e in o&&(0,o[e])(t)}function Fe(e){if(!document.getElementsByClassName("js-cart-item").length)return;let t=0===e.remaining?100:100*(e.total-e.remaining)/Math.floor(1.2*e.total);Oe(e.progressBarContainer,t,e.backgroundColor,e.progressColor),e.progressBarContainer.querySelector(".wpn-progress-text").innerText=e.finalText}function $e(){let e=document.getElementById("wpn-progress-cross-items-container");e&&e.remove()}let He=document.querySelector(c.getCartSubtotalSelector());function Re(){B(),async function(){if(2526918!==n){const e=await d(!0);if(e&&e.userItems){let t=e.userItems;if(t.length>0){if(C())oe(t[0],LS.product.id);else{document.querySelectorAll('[data-store^="product-info-"]').forEach(e=>{const o=e.getAttribute("data-store").split("-");if(o.length>=3){const e=o[2];oe(t[0],e)}})}document.querySelectorAll("[data-product-id]").forEach(e=>{re(e,t[0],c.getProductPageProductPriceContainerSelector(),c.getProductPageComparePriceSelector(),c.getProductPageCurrentPriceSelector())})}}}}(),async function(){const e=await d();if(C()&&e){let t=e.crossItems;Object.keys(t).length>0&&_(t)}}()}null!==He&&async function(e){const t=await d();if(t&&t.templates){let o=document.createElement("div");o.innerHTML=t.templates.cross_items_container;let n=e.parentNode;if(n.insertBefore(o,e),0!==Object.keys(t.crossItems).length)if(Q(t.crossItems.displayWeekInfo)){!function(e,t,o){let n=document.getElementById("wpn-progress-cross-items-container");if(!o||!t||n)return;let r=document.createElement("div");r.innerHTML=e,r.id="wpn-progress-cross-items-container",r.classList.add("wpn-progress-template","wpn-progress-cross-items"),t.insertBefore(r,o)}(t.templates.progress_promotion_html,n,e),Ne("cross_items",{amount:LS.cart.subtotal/100,crossItemDiscounts:t.crossItems.discounts})}else $e();document.addEventListener("cart.updated",(function(e){if(Q(t.crossItems.displayWeekInfo)){if(Te(w(e),o),0!==Object.keys(t.crossItems).length){Ne("cross_items",{amount:w(e),crossItemDiscounts:t.crossItems.discounts})}}else $e()})),void 0!==LS.cart&&await Te(LS.cart.subtotal/100,o)}}(He),Re();const Ye=document.querySelector(c.getProductTableSelector());if(null!==Ye){const e={childList:!0,subtree:!1};new MutationObserver(Re).observe(Ye,e)}}});
//# sourceMappingURL=tn_text.js.map