function crossupScript(){const t='Prod',e='41.0.0',a='https://api.crossup.ai/brain',o='v1',r='https://seller.crossup.ai',n='https://carousel.crossup.ai',i=JSON.parse('{"cart":"add-to-cart","checkout":"checkout","carousel":"carousel"}'),s='/interactions/',l='/interactions/carousel',c='https://recomendaciones.crossup-templates.pages.dev';let d=false,u=null,p=null,m=false;let g=false,f=false,S=0;const h=[];let y=false;const I='brasilia'===LS.theme.code,_=document.getElementById('modal-cart');let E=0,v=false,w=null,T=[],C=[],L=null,A=null,O=false,b=false,R=null,q=null,N=null,P=null,k=null,U=false,j=false;const F=document.querySelector('body'),D=document.createElement('iframe'),M=document.createElement('div');var $,x,W,H,J,B;$=document,(x=window.posthog||[]).__SV||(window.posthog=x,x._i=[],x.init=function(t,e,a){function o(t,e){var a=e.split('.');2==a.length&&(t=t[a[0]],e=a[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(J=$.createElement('script')).type='text/javascript',J.crossOrigin='anonymous',J.async=!0,J.src=e.api_host.replace('.i.posthog.com','-assets.i.posthog.com')+'/static/array.js',(B=$.getElementsByTagName('script')[0]).parentNode.insertBefore(J,B);var r=x;for(void 0!==a?r=x[a]=[]:a='posthog',r.people=r.people||[],r.toString=function(t){var e='posthog';return'posthog'!==a&&(e+='.'+a),t||(e+=' (stub)'),e},r.people.toString=function(){return r.toString(1)+'.people (stub)'},W='init capture register register_once register_for_session unregister unregister_for_session getFeatureFlag getFeatureFlagPayload isFeatureEnabled reloadFeatureFlags updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures on onFeatureFlags onSessionId getSurveys getActiveMatchingSurveys renderSurvey canRenderSurvey getNextSurveyStep identify setPersonProperties group resetGroups setPersonPropertiesForFlags resetPersonPropertiesForFlags setGroupPropertiesForFlags resetGroupPropertiesForFlags reset get_distinct_id getGroups get_session_id get_session_replay_url alias set_config startSessionRecording stopSessionRecording sessionRecordingStarted captureException loadToolbar get_property getSessionProperty createPersonProfile opt_in_capturing opt_out_capturing has_opted_in_capturing has_opted_out_capturing clear_opt_in_out_capturing debug'.split(' '),H=0;H{setTimeout((()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty('--vh',`${t}px`)}),100)}))}V.innerHTML='\n .cross-up-app::-webkit-scrollbar {\n display: none;\n }\n .cross-up-app {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n .display-none {\n display: none !important;\n }\n\n #modal-cart{\n z-index: 999999999;\n }\n\n','recife'!==LS.theme.name.toLowerCase()&&'cali'!==LS.theme.name.toLowerCase()&&'brasilia'!==LS.theme.name.toLowerCase()&&'rio'!==LS.theme.name.toLowerCase()||(V.innerHTML='\n .cross-up-app::-webkit-scrollbar {\n display: none;\n }\n .cross-up-app {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n .display-none {\n display: none !important;\n }\n\n #modal-cart{\n z-index: 20000;\n }\n\n '),G.appendChild(D),G.appendChild(Q),M.appendChild(G),F.appendChild(M),F.prepend(V),Y(),window.addEventListener('resize',Y),window.addEventListener('orientationchange',Y);let z=window.innerHeight;function K(){scrollPosition=window.pageYOffset,document.body.style.overflow='hidden',document.body.style.top=`-${scrollPosition}px`}function Z(){document.body.style.overflow='',document.body.style.top='',document.body.style.overflow='','simple'===LS.theme.name.toLowerCase()&&F.classList.remove('overflow-none'),window.scrollTo(0,scrollPosition)}function tt(){const t=[],e=[...document.getElementsByClassName('js-cart-item')];if(e.forEach((e=>{t.push(e.dataset.store?e.dataset.store.split('m-')[1]:e.dataset.itemId,e instanceof HTMLDivElement?e.querySelector('a').href.split('variant=')[1]:null)})),0===e.length){LS.cart.items.forEach((e=>{t.push(e.item_id,e.variant_id)}))}return t}function et(t,e){e.forEach((e=>{e.productId.toString()===t.offer.shooter.id.toString()&&(t.offer.shooter.quantity=e.quantity)}))}function at(){const t=document.querySelector('#modal-cart');if(!t)return null;const e=t.cloneNode(true);e.style.visibility='hidden',e.style.display='block',e.style.position='absolute',e.style.pointerEvents='none',document.body.appendChild(e);const a=e.offsetWidth;return document.body.removeChild(e),a}async function ot(t='/comprar/',e=500){I&&(console.log('ES BRASILIA'),await rt(e));let a=t;'/comprar/'===t&&'undefined'!=typeof LS&&LS.country&&(a='US'===LS.country?'/us/buy':'/comprar'),window.location.href=a}async function rt(t=1500){await new Promise((e=>setTimeout(e,t)))}async function nt(t=false){if(null===LS.cart.id||t){let t=function(){const t=LS.cart.items;return t?0===t.length?null:t[0].item_id?t[0].item_id:null:null}();const e=new URLSearchParams({[`quantity[${t}]`]:'1'});await fetch('/cart/update/',{method:'POST',headers:{'X-Requested-With':'XMLHttpRequest'},body:e}).then((t=>t.json())).then((t=>{console.log('/cart/update OK: ',t),LS.cart.id=t.cart.id})).catch((t=>{console.log('/cart/update ERRO: '),console.log('error',t)}))}}async function it(){const t=sessionStorage.getItem('cartId')||localStorage.getItem('cartId')||function(t){const e=`; ${document.cookie}`.split(`; ${t}=`);if(2===e.length)return e.pop().split(';').shift()}('cartId');if(!t)return;if(!LS.cart.id)return;const e=await fetch(`${a}/${o}/interactions/orderId/${t}`,{method:'PATCH',headers:{'Content-Type':'application/json'},body:JSON.stringify({orderId:LS.cart.id.toString()})});var r;200===(await e.json()).status&&(localStorage.removeItem('cartId'),sessionStorage.removeItem('cartId'),r='cartId',document.cookie=r+'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;')}setInterval((()=>{window.innerHeight!==z&&(z=window.innerHeight,Y())}),500),useJquery().then((async F=>{if(async function(){const t=localStorage.getItem('fromWatchMore'),e=localStorage.getItem('prodUrl'),a=window.location.href;if(t&&e!==a){try{await async function(){console.log('REQUEST FROM WATCH MORE AND NOT ACCEPTED');const t=JSON.parse(localStorage.getItem('selectedTargets')),e=JSON.parse(localStorage.getItem('offer'));t&&t.length>0&&e&&await yt(e,true,null,t)}()}catch(t){console.log('Error en requestFromWatchMoreAndNotAccepted: ',t)}localStorage.removeItem('fromWatchMore'),localStorage.removeItem('prodUrl'),localStorage.removeItem('offer'),localStorage.removeItem('payloadToStats'),localStorage.removeItem('selectedTargets')}}(),console.log('VERSION: ',e),'cart'===LS.template&&await Promise.all([nt(true),it()]),sessionStorage.getItem('offer')){const t=sessionStorage.getItem('offer');if(u='undefined'!==t?JSON.parse(t):null,!u)return;const e=sessionStorage.getItem('ids_variants'),a='undefined'!==e?JSON.parse(e):void 0;dt(u,'NEW_OFFER',false,a),sessionStorage.removeItem('offer'),sessionStorage.removeItem('ids_variants')}const $=document.getElementsByClassName('js-ajax-cart-panel'),x=document.getElementsByClassName('ajax-cart').length>0?document.getElementsByClassName('ajax-cart')[0]:document.getElementsByClassName('js-ajax-cart-panel').length>0?document.getElementsByClassName('js-ajax-cart-panel')[0]:_||null;if($.length>0||_){if(O=true,b)return void console.log('POPUP ACTIVE');LS.on(LS.events.productAddedToCart,(async(t,e)=>{if(j)return console.log('IS FROM CARROUSEL'),void(j=false);const a=localStorage.getItem('fromWatchMore'),o=localStorage.getItem('prodUrl'),r=window.location.href;if(a&&o===r)return void await J();if(e||(e=t.detail),t&&t.detail){if(t.detail.quantity_added<=0)return;if(t.detail.cart_item.id){if(h.includes(t.detail.cart_item.id))return;h.push(t.detail.cart_item.id)}}const n=localStorage.getItem('fromWatchMoreCarrousel'),i=localStorage.getItem('prodUrlCarrousel'),s=window.location.href;if(n&&i===s){const t=e&&e.cart_item&&e.cart_item.variant_id?e.cart_item.variant_id:null;return void await B(t)}const{cart_item:l,quantity_added:c}=e,d=(l.unit_price,e.cart_item.product.id),{variant_id:p}=e.cart_item,{quantity:g}=e.cart_item,f=e.cart_item.product.price,S=e.cart_item.product.compare_at_price;if(m)m=false;else{console.log('REQUEST: 1'),E=1;const t={productId:parseInt(d,10),variantId:parseInt(p,10),quantity:parseInt(g,10),unitPrice:parseInt(f,10),compareAtPrice:parseInt(S,10)};try{if(b)return void console.log('POPUP ACTIVE');const e=await V(LS.store.id,[t],void 0,[...new Set(tt())]);if(200!==e.status)return;u=e.data,et(u,[t]),dt(e.data,'NEW_OFFER',false,t.variantId)}catch(t){console.log('Error en request: ',t)}}}));let t=document.querySelectorAll('#go-to-checkout');0===t.length&&(t=document.querySelectorAll('input[name="go_to_checkout"]'),0===t.length&&(t=document.querySelectorAll('button[name="go_to_checkout"]')));let e=t[0];t.length>1&&([e]=t),'cubo'===LS.theme.code&&'cart'!==LS.template&&(e=t[1],!e&&t[0]&&(e=t[0])),(0===$.length&&'cart'===LS.template||'cubo'===LS.theme.code&&'cart'===LS.template)&&([btnCheckoutOculto,e]=document.querySelectorAll('input[name="go_to_checkout"]')),e.addEventListener('click',(async t=>{if(d=true,g)return void Et();t.preventDefault();let e=ct([...document.getElementsByClassName('js-cart-item')]);e=st(e);try{console.log('REQUEST: 2 - 214'),E=2;const t=await V(LS.store.id,e,i.checkout,[...new Set(tt())]);200!==t.status?Et():(u=t.data,et(u,e),console.log('POSTEANDO NEW_OFFER'),dt(t.data,'NEW_OFFER'))}catch(t){console.log('Error en request: ',t),Et()}}))}else{if(O=false,console.log('NO TIENE CARRITO RAPIDO'),b)return void console.log('POPUP ACTIVE');if(LS.product){const t=LS.product.id;let e=LS.variants[0];e&&LS.registerOnChangeVariant((t=>e=t)),F('.js-addtocart').on('click',(async a=>{if(a.currentTarget.classList.contains('contact'))return void console.log('CONTACT');if(a.preventDefault(),j)return console.log('IS FROM CARROUSEL'),void(j=false);console.log('REQUEST: 3 - 250'),E=3;const o=a.currentTarget.closest('form');let r=o?o.querySelector('input[name="quantity"]'):null,n=r&&parseInt(r.value,10)||1,i=e?e.price_number_raw:null,s=e&&e.compare_at_price_number?100*e.compare_at_price_number:null;const l={productId:parseInt(t,10),variantId:e?.id?parseInt(e?.id,10):void 0,quantity:n,unitPrice:i?parseInt(i,10):null,compareAtPrice:s?parseInt(s,10):null};p=vt(o);const c=localStorage.getItem('fromWatchMore'),d=localStorage.getItem('prodUrl'),m=window.location.href,g=localStorage.getItem('fromWatchMoreCarrousel'),f=localStorage.getItem('prodUrlCarrousel'),S=window.location.href;if(c&&d===m)await Tt(p),await J();else if(g&&f===S){const t=e?.id?parseInt(e?.id,10):null;await Tt(p),await B(t)}else try{if(b)return void console.log('POPUP ACTIVE');const t=await V(LS.store.id,[l],void 0,[...new Set(tt())]);200!==t.status?(await Tt(p),await ot()):(u=t.data,et(u,[l]),sessionStorage.setItem('offer',JSON.stringify(u)),sessionStorage.setItem('ids_variants',JSON.stringify(l.variantId)),await Tt(p),await ot())}catch(a){console.log('Error en request: ',a),await Tt(p),await ot()}}))}else{let t='';LS.registerOnChangeVariant((e=>t=e)),z();let e=window.location.search;addEventListener('scroll',(()=>{const t=window.location.search;t!==e&&(e=t,z())})),F('.js-addtocart').on('click',(async e=>{if(e.currentTarget.classList.contains('contact'))return;e.preventDefault();const a=e.currentTarget.closest('form');let o=a?a.querySelector('input[name="quantity"]'):null,r=o&&parseInt(o.value,10)||1,n=e.target.dataset.componentValue;if(n||(n=a.querySelector('input[name=\'add_to_cart\']').value),!t||''===t||null==t||'undefined'===t){const e=a.closest('.js-product-container')?.getAttribute('data-variants');if(e){const a=JSON.parse(e);t=a[0]}}let i=t?t.price_number_raw:null,s=t&&t.compare_at_price_number?100*t.compare_at_price_number:null;const l={productId:parseInt(n,10),variantId:t?.id?parseInt(t?.id,10):void 0,quantity:r,unitPrice:i?parseInt(i,10):null,compareAtPrice:s?parseInt(s,10):null};p=vt(a);try{if(b)return void console.log('POPUP ACTIVE');console.log('REQUEST: 4 - 310'),E=4;const t=await V(LS.store.id,[l],void 0,[...new Set(tt())]);200!==t.status?(I&&_||await Tt(p),await ot()):(u=t.data,et(u,[l]),sessionStorage.setItem('offer',JSON.stringify(u)),sessionStorage.setItem('ids_variants',JSON.stringify(l.variantId)),I&&_||await Tt(p),await ot())}catch(e){console.log('Error en request: ',e),I&&_||await Tt(p),await ot()}}))}if(0===$.length&&'cart'===LS.template||'cubo'===LS.theme.code&&'cart'===LS.template){const t=document.querySelector('#go-to-checkout')?document.querySelector('#go-to-checkout'):document.querySelector('input[name="go_to_checkout"]');t.addEventListener('click',(async function e(a){if(a.preventDefault(),g)return t.removeEventListener('click',e),void t.click();console.log('REQUEST: 5 - 349'),E=5;let o=ct([...document.getElementsByClassName('js-cart-item')]);o=st(o);try{const a=await V(LS.store.id,o,'checkout',[...new Set(tt())],2e3);200!==a.status?(t.removeEventListener('click',e),t.click()):(u=a.data,et(u,o),t.removeEventListener('click',e),dt(a.data,'NEW_OFFER'))}catch(a){console.log('Error en request: ',a),t.removeEventListener('click',e),t.click()}}))}}async function W(){const a=await async function(a,o=i.carrousel,r=[],s=5e3){try{const t=new AbortController,e=setTimeout((()=>t.abort()),s);let i;try{const e=new URLSearchParams;if(e.set('storeId',a),e.set('showingPlace',o),e.set('origin','Tiendanube'),r&&r.length>0){const t=r.filter((t=>null!=t)).map((t=>t.toString()));e.set('cartItems',t.join(','))}const s=`${n}?${e.toString()}`;i=await fetch(s,{method:'GET',cache:'no-store',headers:{'Cache-Control':'no-store'},signal:t.signal})}catch(t){if(clearTimeout(e),'AbortError'===t.name)throw new Error('Timeout');throw t}if(clearTimeout(e),!i.ok)return{status:i.status,data:await i.json()};const l=await i.json();return l.error&&'Carousel module is not active for this store'===l.error?(console.log('Carousel module is not active for this store'),{status:400,data:l}):(P={offer:{...l.data}},{status:i.status,data:{offer:{...l.data}}})}catch(r){if('Timeout'===r.message&&window.posthog)try{posthog.capture('brain_request_timeout',{environment:t,storeId:String(a),storeName:LS.store.name,cartId:LS.cart?.id?String(LS.cart.id):null,isCapped:!!isCapped,origin:'Tiendanube',requestNumber:E,timeout:s.toString(),template:LS.template,theme:LS.theme.code,showingPlace:o,scriptVersion:e})}catch(t){console.error('Error sending PostHog event:',t)}return{status:'Timeout'===r.message?500:r.status||400,data:{message:r.message}}}}(LS.store.id,i.carousel,[...new Set(tt())]);if(200===a.status){const t=document.querySelector('.carrousel-container');if(t)return H(a,'NEW_OFFER_CARROUSEL'),void(t.style.display='block');if('cart'===LS.template){let t=document.getElementsByClassName('js-ajax-cart-list');t&&0!==t.length||(t=document.getElementsByClassName('js-cart-contents'));const e=t[0],a=X(O);e.insertAdjacentElement('afterend',a)}else{let t=document.querySelector('.js-cart-total-container.js-visible-on-cart-filled');t||(t=document.querySelector('[data-store="cart-total"]'));const e=X(O);setTimeout((()=>{t.insertBefore(e,t.firstChild)}),2e3)}H(a,'NEW_OFFER_CARROUSEL')}else{const t=document.querySelector('.carrousel-container');t&&(t.style.display='none')}}function H(t,e){if(t.data.offer.targets.length>12&&(t.data.offer.targets=t.data.offer.targets.slice(0,12)),'NEW_OFFER_CARROUSEL'!==e)return void console.log('NO ES UNA NUEVA OFERTA CARROUSEL');if(!k)return void console.log('NO HAY FRAME CARROUSEL');const a=()=>{U&&k.contentWindow?(console.log('POSTEANDO MESSAGE CARROUSEL'),k.contentWindow.postMessage(JSON.stringify({type:'NEW_OFFER_CAROUSEL',payload:JSON.stringify(t),isFastCart:O}),'*')):(console.log('CARROUSEL FRAME NOT READY, retrying...'),setTimeout(a,300))};k.src&&''!==k.src&&'about:blank'!==k.src||(k.src=c),a()}async function J(){console.log('REQUEST FROM WATCH MORE');const t=JSON.parse(localStorage.getItem('payloadToStats')),e=JSON.parse(localStorage.getItem('selectedTargets')),a=JSON.parse(localStorage.getItem('offer')),o=parseFloat(localStorage.getItem('shooterPriceFromWatchMore')),r=localStorage.getItem('interactionId');if(t&&e&&a){!function(t,e,a){let o=t&&t.variant?a.targets.find((e=>e.id===t.variant.productId)):a.targets.find((e=>e.id===t.productId));o||(o=a.targets[0]);const r=t.variant??a.targets.find((e=>e.id===t.productId)).variants[0]??a.targets[0].variants[0];if(o){if(e.find((t=>t.id===o.id&&t.variantId===r.id))){const a=e.find((t=>t.id===o.id&&t.variantId===r.id));return void(a.quantity+=t.quantity??1)}e.push({id:o.id,name:o.name,variantId:r.id??null,price:r.price??null,promotionalPrice:r.promotionalPrice??null,quantity:t.quantity??1})}}(t,e,a),await St(r,{targetsSelected:e,shooterPrice:o});try{await ht(r)}catch(t){console.log('Error closing interaction FROM WATCH MORE: ',t)}localStorage.removeItem('fromWatchMore'),localStorage.removeItem('payloadToStats'),localStorage.removeItem('selectedTargets'),localStorage.removeItem('offer'),localStorage.removeItem('prodUrl'),localStorage.removeItem('shooterPriceFromWatchMore'),localStorage.removeItem('interactionId'),O||(console.log('REDIRECTING TO CHECKOUT'),await ot())}}async function B(t){console.log('REQUEST FROM WATCH MORE CARROUSEL');const e=JSON.parse(localStorage.getItem('payloadToStatsCarrousel')),a=JSON.parse(localStorage.getItem('selectedTargetsCarrousel')),o=JSON.parse(localStorage.getItem('carrouselOffer')),r=localStorage.getItem('interactionIdCarrousel'),n='null'===r?null:r;if(e&&a&&o){if(function(t,e,a,o){let r=t&&t.productId?a.targets.find((e=>e.id===t.productId)):null;r||(r=a.targets[0]);const n=o?a.targets.find((e=>e.id===t.productId)).variants.find((t=>t.id===o.toString())):t.variant??a.targets.find((e=>e.id===t.productId)).variants[0]??a.targets[0].variants[0];if(r){if(e.find((t=>t.id===r.id&&t.variantId===n.id))){const a=e.find((t=>t.id===r.id&&t.variantId===n.id));return void(a.quantity+=t.quantity??1)}e.push({id:r.id,name:r.name,variantId:n.id??null,price:n.price??null,promotionalPrice:n.promotionalPrice??null,quantity:t.quantity??1})}}(e,a,o.offer,t),n){const t=await _t(n,a,o.offer.targets);'different key value'!==t?.error&&'different key value'!==t?.message||(console.log('different key value'),await It(a,o.offer.targets,r))}else await It(a,o.offer.targets);localStorage.removeItem('payloadToStatsCarrousel'),localStorage.removeItem('selectedTargetsCarrousel'),localStorage.removeItem('carrouselOffer'),localStorage.removeItem('interactionIdCarrousel'),localStorage.removeItem('fromWatchMoreCarrousel'),localStorage.removeItem('prodUrlCarrousel')}}await W();const G={lastCalls:{},throttleTime:1500,popupCloseBlocked:false,popupCloseTime:0,popupCloseBlockDuration:2e3,shouldBlock(t){const e=Date.now();if(this.popupCloseBlocked&&e-this.popupCloseTime=this.popupCloseBlockDuration&&(this.popupCloseBlocked=false,console.log('Desactivado bloqueo por cierre de popup'));const a=this.lastCalls[t];return!(!a||e-a>=this.throttleTime)||(this.lastCalls[t]=e,false)},blockOnPopupClose(){this.popupCloseBlocked=true,this.popupCloseTime=Date.now(),console.log(`Activado bloqueo de ${this.popupCloseBlockDuration}ms por cierre de popup`)}};async function V(r=0,n=[],s=i.cart,l=[],c=5e3){if(0===n.length)return{status:500,data:{message:'No se encontraron ids para la solicitud'}};if(G.shouldBlock('SEARCH_OFFER_SUGGESTION'))return console.log('Request bloqueado por throttling del endpoint'),{status:429,data:{message:'Endpoint en throttling. Esperando.',throttled:true}};s===i.checkout?c=parseInt('1500',10):s===i.cart&&(c=parseInt('5000',10));const d=sessionStorage.getItem('capping_ai'),p=d&&'undefined'!==d&&null!==d,m=p?parseInt(d,10):null,g=m?Math.ceil((m-(new Date).getTime())/1e3):null,f=p&&g>0;!f&&g<0&&sessionStorage.removeItem('capping_ai');try{const t=LS.cart?.id?LS.cart.id:null,e=new Date,i=new AbortController,d=setTimeout((()=>i.abort()),c);let p;try{p=await fetch(`${a}/${o}/suggestions/get-suggestions`,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({ids:n,storeId:`${r}`,showingPlace:`${s}`,origin:'Tiendanube',cartId:t?t.toString():null,cartItems:l.filter((t=>null!=t)).map((t=>t?.toString())),isCapped:!!f,currency:LS.currency.code??'ARS',country:LS.country??'AR'}),signal:i.signal})}catch(t){if(clearTimeout(d),'AbortError'===t.name)throw new Error('Timeout');throw t}clearTimeout(d);const m=new Date-e;if(!p.ok)return{status:p.status,data:await p.json()};const g=await p.json();if(u={offer:{...g.data,responseTime:m}},g.data.isAI&&g.data.cappingTime){const t=(new Date).getTime()+1e3*g.data.cappingTime;sessionStorage.setItem('capping_ai',t)}return{status:p.status,data:{offer:{...g.data,responseTime:m}}}}catch(a){if('Timeout'===a.message&&window.posthog)try{posthog.capture('brain_request_timeout',{environment:t,storeId:String(r),storeName:LS.store.name,cartId:LS.cart?.id?String(LS.cart.id):null,isCapped:!!f,origin:'Tiendanube',requestNumber:E,timeout:c.toString(),template:LS.template,theme:LS.theme.code,showingPlace:s,scriptVersion:e})}catch(t){console.error('Error sending PostHog event:',t)}return{status:'Timeout'===a.message?500:a.status||400,data:{message:a.message}}}}function z(){let t=document.querySelectorAll('a[data-target="#quickshop-modal"]');0===t.length&&(t=document.querySelectorAll('a[data-toggle="#quickshop-modal"]'),0===t.length&&(t=document.querySelectorAll('a[data-component="product-list-item.add-to-cart"]'),0===t.length&&(t=document.querySelectorAll('a[data-component="product-list-item.show-add-to-cart"]'),0===t.length&&(t=document.querySelectorAll('a.js-item-buy-open'))))),t&&t.length>0&&t.forEach((t=>{t.addEventListener('click',(()=>{let e=t.parentElement.parentElement.dataset.quickshopId?.split('quick')[1];e||(e=t.parentElement.parentElement.parentElement.dataset.store?.split('image-')[1],e||(e=t.getAttribute('data-component-value'),e||(e=t.parentElement.parentElement.parentElement.parentElement.dataset.productId,e||(e=t.parentElement.parentElement.parentElement.dataset.store?.split('info-')[1]))));const a=document.querySelector(`input[value="${e}"]`);if(a.parentElement.getElementsByClassName('js-insta-variant').length>0){let t=a.parentElement.getElementsByClassName('js-insta-variant');t=[...t],t.forEach((t=>{t.click()}))}else F(a.parentElement).find('.js-variation-option').change()}))}))}function st(t){const e=[];return t.forEach((t=>{JSON.stringify(e).includes(JSON.stringify(t))||e.push(t)})),e}async function lt(t){try{let e=F(t);LS.addToCartEnhanced(e),await rt(300)}catch(t){return console.log('Error en flowyAddToCart: ',t),null}}function ct(t){const e=LS.cart.items,a=[];return t.forEach((t=>{let o={productId:null,variantId:null,quantity:1,itemId:null,unitPrice:null,compareAtPrice:null};t.dataset&&(t.dataset.itemId&&(o.itemId=t.dataset.itemId),t.dataset.store&&(o.productId=parseFloat(t.dataset.store.split('m-')[1])));let r=t.querySelector('.cart-item-name a')?t.querySelector('.cart-item-name a')?.href:t.querySelector('.cart-item-name')?.href;if(r||(r=t.querySelector('a')?t.querySelector('a')?.href:t.querySelector('.cart-item-name')?.href),r&&(o.variantId=parseFloat(r.split('=')[1])),t.querySelector(`input[name="quantity[${t.dataset.itemId}]"]`)&&(o.quantity=parseInt(t.querySelector(`input[name="quantity[${t.dataset.itemId}]"]`).value,10)),(o.productId||o.variantId)&&(o.productId=o.productId?o.productId.toString():'',o.variantId=o.variantId?o.variantId.toString():'',o.quantity=o.quantity?o.quantity:1,o.itemId=o.itemId?o.itemId.toString():''),!o.productId&&o.itemId){const t=LS?.cart?.items.find((t=>t.id==o.itemId));o.productId=t?t.product.id.toString():'',o.variantId=o.variantId?o.variantId.toString():'',o.quantity=o.quantity?o.quantity:1,o.itemId=o.itemId?o.itemId.toString():''}if(e&&e.length>0){const t=e.find((t=>t.item_id==o.itemId));o.unitPrice=t?.unit_price?parseInt(t?.unit_price,10):null,o.compareAtPrice=null}a.push(o)})),a}async function dt(t,e,a=false,o=void 0){p||await nt();let n=true;if('NEW_OFFER'===e){Y(),n=false,M.addEventListener('click',(async t=>{t.target===M&&await ut()})),S++,f=true,t.hasCartId=!!LS.cart?.id;const{frame:a}=t.offer;if(a&&a.hasFrame&&a.props){const e=a.props,{header:o,borders:r}=e;if(o.hasHeader){Q.classList.remove('display-none');const e=t.offer.mainLanguage??LS.lang?.slice(0,2)??'es';switch(Q.src=o.src[e],Q.style.height=o.height??'6em',Q.style.top=o.relativeTop??'-2em',Q.style.transform='translateX(-50%)',o.location){case'top-left':Q.style.left='10%';break;case'top-center':Q.style.left='50%';break;case'top-right':Q.style.left='90%'}}if(r.hasBorders){const{mainColor:t}=r;t&&(D.style.border=`10px solid ${t}`)}}else Q.classList.add('display-none'),D.style.border='none';D.src&&''!==D.src&&'about:blank'!==D.src?n=true:(D.src=r,D.onload=()=>{M.classList.remove('display-none'),K();let a=setInterval((()=>{y?clearInterval(a):(w=at(),D.contentWindow.postMessage(JSON.stringify({type:`${e}`,payload:JSON.stringify(t),variantId:`${o}`,cartWidth:w}),'*'))}),100)})}else M.removeEventListener('click',(async t=>{t.target===M&&await ut()}));n&&D.contentWindow&&(w=at(),D.contentWindow.postMessage(JSON.stringify({type:`${e}`,payload:JSON.stringify(t),variantId:`${o}`,cartWidth:w}),'*')),a?(M.classList.add('display-none'),f=false,Z()):n&&(M.classList.remove('display-none'),K())}async function ut(){u&&(dt('CERRANDO...','ON_ADD_TO_CART_TEXT'),await yt(u.offer,false,{}),p&&await Tt(p),ft(),u=null,0===$.length&&'cart'!==LS.template&&await ot(),p=null)}function pt(){return ct([...document.getElementsByClassName('js-cart-item')])}function mt(){p=null,T=[],L=null,b=false,R=null,N=null,m=false}function gt(t){const e=document.createElement('form');e.setAttribute('method','POST'),e.setAttribute('action','/add-to-cart');const a=document.createElement('input');a.setAttribute('type','number'),a.setAttribute('name','quantity'),a.setAttribute('value',`${t.quantity||1}`),e.appendChild(a);const o=document.createElement('input');o.setAttribute('type','hidden'),o.setAttribute('name','add_to_cart'),o.setAttribute('value',t.variant.product_id||t.variant.productId||''),e.appendChild(o);const r=t.variant.attr||{};return Object.entries(r).forEach((([t,a],o)=>{const r=document.createElement('input');r.setAttribute('type','hidden'),r.setAttribute('name',`variation[${o}]`),r.setAttribute('value',a),e.appendChild(r)})),e}function ft(){if(Z(),y=false,dt({},'RESET_ALL',true),'checkout'===u.offer.handle.trim().toLowerCase()){g=true;const t=document.querySelector('#go-to-checkout')?document.querySelector('#go-to-checkout'):document.querySelector('input[name="go_to_checkout"]');t?t.click():Et()}else if('simple'===LS.theme.name.toLowerCase())if(v){v=false;const t=document.querySelector('#ajax-cart-backdrop');t&&t.click()}else{const t=document.querySelector('#ajax-cart-backdrop');if('simple'!==LS.theme.name.toLowerCase())t.click();else{const e=document.querySelector('#ajax-cart-details');e&&'none'!==e.style.display?t&&'none'!==t.style.display&&t.click():t&&'none'!==t.style.display&&(t.style.display='none')}}G.blockOnPopupClose()}async function St(t,e){if(!t)return;const r=`${a}/${o}${s}${t}`,n={targetsSelected:e.targetsSelected,shooterPrice:N},i=await fetch(r,{method:'PATCH',headers:{'Content-Type':'application/json'},body:JSON.stringify(n)});await i.json()}async function ht(t){if(!t)return;console.log('closing interaction');const e=`${a}/${o}${s}${t}/close`;await fetch(e,{method:'PATCH',headers:{'Content-Type':'application/json'}})}async function yt(t,e,r=null,n=T){try{const r=n.reduce(((t,e)=>t+(e.promotionalPrice??e.price)),0);e||(quantity=1);const i=t.shooter.variants[0].promotionalPrice??t.shooter.variants[0].price;N=i;let l=0;if(r&&i)if(t.isUpsell){const e=n.reduce(((t,e)=>t+(e.promotionalPrice??e.price)*e.quantity),0),a=i*t.shooter.quantity;l=Math.max(e-a,0)}else l=n.reduce(((t,e)=>t+(e.promotionalPrice??e.price)*e.quantity),0);e&&(t.shooter.profit=Math.max(l,0));let c=sessionStorage.getItem('cartId')||localStorage.getItem('cartId')||function(t){const e=`; ${document.cookie}`.split(`; ${t}=`);if(2===e.length)return e.pop().split(';').shift()}('cartId');c||(c=([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)))),LS.cart.id||(localStorage.setItem('cartId',c),document.cookie=`cartId=${c}`,sessionStorage.setItem('cartId',c));const d=LS.cart.id??c,u=LS.store.id,p=LS.cart.subtotal/100,m='number'!=typeof l||isNaN(l)?0:l,g=t.shooter&&'number'==typeof t.shooter.quantity&&!isNaN(t.shooter.quantity)?t.shooter.quantity:1,f=t.targets??[],S=!!t.isAI&&t.isAI,h=t.aiButtonTextId??null,y=t.aiContentTextId??null,I={id:f&&f.length>0?f[0].id:null,name:f&&f.length>0?f[0].name:null,variantId:f&&f.length>0?f[0].variants[0].id??null:null},_={handle:t.handle??null,offerId:t._id,target:I,targetsSelected:n,targets:f.map((t=>({id:t.id,name:t.name}))),shooter:{id:t.shooter.id,name:t.shooter.name},accepted:e,orderId:d.toString(),cartTotal:p,storeId:u,origin:'Tiendanube',profitPrevious:m??0,shooterQuantity:g??1,cartProducts:[...new Set(tt())].filter((t=>null!=t)).map((t=>t?.toString())),isAI:S,experiment:t.experiment??null,isUpsell:t.isUpsell??false,recommendationId:t.recommendationId??null,model:t.model??null,strategy:t.strategy??null,thresholdForRecommender:t.thresholdForRecommender??null,responseTime:t.responseTime??null,responseTimeBrain:t.elapsedTime??null,textsAI:h&&y?{button:h,content:y}:null},E=`${a}/${o}${s}`,v=await fetch(E,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(_)}),w=await v.json();R=w.data.interaction.interactionId}catch(t){console.log('Error en postStats: ',t)}}async function It(t=C,e=P.offer.targets,r=null){try{const n=t.reduce(((t,e)=>t+(e.promotionalPrice??e.price)),0),i=LS.cart.subtotal/100,s=[...new Set(tt())].filter((t=>null!=t)).map((t=>t?.toString())),c={targetsSelected:t,orderId:LS.cart.id.toString(),origin:'Tiendanube',handle:'carrousel',profit:n,targets:e.map((t=>({id:t.id,name:t.name}))),storeId:LS.store.id,isAI:true,suggestionId:null,cartTotal:i,cartProducts:s,previousInteraction:r||null},d=`${a}/${o}${l}`,u=await fetch(d,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(c)}),p=await u.json();q=p.interactionId}catch(t){console.log('Error en postStatsCarrousel: ',t)}}async function _t(t,e=C,r=P.offer.targets){if(!t)return;const n=[...new Set(tt())],i=LS.cart.subtotal/100,s={targetsSelected:e,targets:r.map((t=>({id:t.id,name:t.name}))),storeId:LS.store.id,origin:'Tiendanube',orderId:LS.cart.id.toString(),cartProducts:n,cartTotal:i},c=`${a}/${o}${l}/${t}`,d=await fetch(c,{method:'PATCH',headers:{'Content-Type':'application/json'},body:JSON.stringify(s)});if(!d.ok){const t=await d.json();return console.log('Error in updateStatsCarrousel:',t),t}return await d.json()}function Et(){let t=x,e=t?.querySelector('.js-ajax-cart-submit');if(!e){if(t=$&&$.length>0?$[0]:null,!t)return;e=t.querySelector('.js-ajax-cart-submit')}let a=t?.querySelector('input[type="submit"]');a||(a=t?.querySelector('button[type="submit"]'));const o=a?.outerHTML;a?.remove(),e&&(e.innerHTML=o);let r=t.querySelector('input[type="submit"]');r||(r=t.querySelector('button[type="submit"]')),r?.click()}function vt(t){const e=[...t.querySelectorAll('.selected')].filter((t=>!t.parentNode.name?.startsWith('properties'))),a=[...t.querySelectorAll('option:checked')].filter((t=>{if(t.parentNode.name?.startsWith('properties'))return false;return!t.closest('#product-shipping-container')}));let o=[];e.length>0&&a.length>0&&a.length>e.length||0===e.length&&a.length>0?o=a:e.length>0&&(o=e);const r=t.querySelector('input[name="quantity"]'),n=t.querySelector('input[name="add_to_cart"]');let i={quantity:r?.value??1,variant:{product_id:n.value,attr:{}}};const s=document.getElementById('campo-personalizado--root');if(s){const t=s.querySelectorAll('input, textarea, select'),e={};t.forEach((t=>{const a=t.getAttribute('name')||'unknown';e[a]=t.value||''})),delete e.unknown,i={...i,customFields:e}}const l=o.filter((t=>/^variation\[\d+\]$/.test(t.parentNode.name)));let c=null;for(let t=0;t'quantity'===t.name));if(-1===e)return void console.error('No se encontrĂ³ el campo \'quantity\'.');let a=parseInt(t[e].value,10);if(isNaN(a))return void console.error('El valor de \'quantity\' no es un nĂºmero.');a=Math.floor(a/2),t[e].value=String(a),await Tt(t)}(t),null;const r=o.cart.id,n=100*parseFloat(o.cart.subtotal);jQuery.fancybox&&jQuery.fancybox.close(),LS.updateCartEnhanced(o.cart,e,a,o.html_cart_items),LS.refreshTotals(o),LS.freeShippingLabelUpdate(o.free_shipping,true),jQuery('.js-ajax-cart-shipping .shipping-calculator-response, #ajax-cart-shipping .js-shipping-calculator-response').hide().empty(),F('.js-empty-ajax-cart').hide();return window.matchMedia('(max-width: 700px)').matches&&F('.backdrop').hide(),F('.js-visible-on-cart-filled').show(),LS.trigger(LS.events.productAddedToCart,{cart_item:o.item,quantity_added:o.quantity_added}),LS.updateCartShipping=()=>{F('.js-shipping-calculator-with-zipcode').length&&F('#cart-shipping-container .js-shipping-input').val()?(F('#cart-shipping-container').show(),LS.calculateShippingOnCart()):LS.updateShippingOnAddToCart()},LS.updateShippingOnShippableCart('addProduct'),LS.cart.id=r,LS.cart.subtotal=n,o.item}catch(t){return console.log('Error en oldFlowyAddToCart: ',t),null}}window.addEventListener('message',(async function(t){const{data:e}=t;if(!(t=>{try{JSON.parse(t)}catch(t){return false}return true})(e))return;if(t.origin!==r&&t.origin!==c)return;const a=JSON.parse(e);if(t.origin===c&&'MESSAGE_READ'===a.type)return;const o=4===E&&I;switch(a.type){case'ADD_TO_CART':{b=true,m=true,dt('AGREGANDO...','ON_ADD_TO_CART_TEXT');let{payload:e}=a;L=e;const r=e&&e.variant?u.offer.targets.find((t=>t.id===e.variant.productId)):u.offer.targets[0],n=e.variant??u.offer.targets[0].variants[0];if(r){if(T.find((t=>t.id===r.id&&t.variantId===n.id))){const t=T.find((t=>t.id===r.id&&t.variantId===n.id));return void(t.quantity+=e.quantity??1)}T.push({id:r.id,name:r.name,variantId:n.id??null,price:n.price??null,promotionalPrice:n.promotionalPrice??null,quantity:e.quantity??1})}R?await St(R,{targetsSelected:T,shooterPrice:N}):await yt(u.offer,true,e,T),m=true;const i=gt(e);if(p)u.offer.isUpsell?(await lt(i),await rt(500)):o&&_||(await Tt(p),await lt(i));else{try{if(LS.cart.items.find((t=>t.variant_id===parseInt(e.variant.id)))&&d||'Simple'===LS.theme.name){d=false;const t=wt(e);await Tt(t)}else await lt(i)}catch(t){console.log('Error chequeando cart items: ',t),await lt(i)}u.offer.isUpsell&&await async function(t){const e=[...document.getElementsByClassName('js-cart-item')];if(t.handle,t.isShooterByProduct){const a=[t.shooter.id],o=ct(e),r=a.map((async t=>{const e=o.filter((e=>e.productId===t||e.variantId===t));for(const t of e){let e=t.itemId;'string'==typeof t.itemId&&(e=parseInt(e,10)),console.log('DELETE ID: ',e),await fetch('/cart/update/',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:new URLSearchParams({[`quantity[${e}]`]:'0'})}).then((t=>console.log('Response: ',t))).then((t=>console.log(t))).catch((t=>console.error('Error:',t))),LS.removeItem(e,true)}}));await Promise.all(r)}else{let a=t.shooter.id;LS.product&&(a=LS.product.id);const o=e.map((async t=>{let e=t.dataset.store;if(e||(v=true,e=LS.cart.items.find((t=>t.product.id.toString()===a.toString())).product.id.toString()),e.includes(a)){let e=t.dataset.itemId;'string'==typeof e&&(e=parseInt(e,10)),await fetch('/cart/update/',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:new URLSearchParams({[`quantity[${e}]`]:'0'})}).then((t=>console.log('Response: ',t))).then((t=>console.log(t))).catch((t=>console.error('Error:',t))),LS.removeItem(e,true)}}));await Promise.all(o)}}(u.offer,e.variant.id)}if(!u.offer.multipleProductsPerPopup||u.offer.isUpsell){try{await ht(R)}catch(t){console.log('Error closing interaction ADD_TO_CART Upsell: ',t)}b=false,ft(),mt(),u=null}p=null;break}case'IGNORE_OFFER':if(dt('CERRANDO...','ON_ADD_TO_CART_TEXT'),b=false,R)try{await ht(R)}catch(t){console.log('Error closing interaction IGNORE_OFFER: ',t)}else{try{await yt(u.offer,false,{})}catch(t){console.log('Error en request: ',t)}p&&(o&&_||await Tt(p))}ft(),u=null,mt();break;case'ERROR':dt('CERRANDO...','ON_ADD_TO_CART_TEXT'),p&&(o&&_||await Tt(p)),ft(),'add-to-cart'===u.offer.handle&&(0===$.length&&'cart'!==LS.template&&!o||I&&!_)&&await ot(),u=null,mt();break;case'WATCH_MORE':{const{payload:t}=a;L=t;const e=t.productId;let o=u.offer.targets[0].urls.canonicalURL;const r=u.offer.targets.find((t=>t.id===e));r&&(o=r.urls.canonicalURL),dt('REDIRIGIENDO...','ON_ADD_TO_CART_TEXT'),u.offer.isUpsell?await yt(u.offer,false,{}):(localStorage.setItem('fromWatchMore','true'),localStorage.setItem('payloadToStats',JSON.stringify(L)),localStorage.setItem('selectedTargets',JSON.stringify(T)),localStorage.setItem('offer',JSON.stringify(u.offer)),localStorage.setItem('prodUrl',o),localStorage.setItem('shooterPriceFromWatchMore',N),localStorage.setItem('interactionId',R)),ft(),await ot(o),u=null,p=null;break}case'WATCH_MORE_CARROUSEL':{const{payload:t}=a;A=t;const e=t.canonicalURL;if(!e)break;localStorage.setItem('fromWatchMoreCarrousel','true'),localStorage.setItem('payloadToStatsCarrousel',JSON.stringify(A)),localStorage.setItem('selectedTargetsCarrousel',JSON.stringify(C)),localStorage.setItem('prodUrlCarrousel',e),localStorage.setItem('interactionIdCarrousel',q),localStorage.setItem('carrouselOffer',JSON.stringify(P)),await ot(e),P=null;break}case'RESIZE':{const{payload:t}=a,{msg:e}=t,{height:o}=e;if(!f&&S>0)break;const r=D.style.height;let n;const i='mobile'===function(){const{userAgent:t}=navigator;if(/mobile/i.test(t))return'mobile';return'desktop'}();if(r){n=r.includes('vh')?parseInt(r.split('vh')[0],10)*(window.innerHeight/100):parseInt(r.slice(0,-2),10);if(Math.abs(o-n)/n<.01)break}o>0?window.innerHeight>=1300?D.style.height='45em':o>.8*window.innerHeight?D.style.height='80vh':i&&o<.6*window.innerHeight?D.style.height='75vh':D.style.height=i?`${o}px`:'45em':window.innerHeight>=1300?D.style.height='45em':D.style.height='100vh';break}case'MESSAGE_READ':console.log('MESSAGE_READ'),y=true;break;case'DELETE_ITEM':{const{payload:t}=a,{variantId:e,productId:o}=t,r=pt().find((t=>t.productId.toString()===o.toString()&&t.variantId.toString()===e.toString()));if(r){const t=T.find((t=>t.id===o.toString()&&t.variantId===e.toString()));T=T.filter((t=>t.id!==o.toString()&&t.variantId!==e.toString())),await St(R,{targetsSelected:T,shooterPrice:N});(await async function(t){LS.removeItem(t.toString(),true);try{const e=await fetch('/cart/update/',{method:'POST',credentials:'same-origin',redirect:'manual',headers:{Accept:'application/json, text/plain, */*','Accept-Encoding':'gzip, deflate, br, zstd','Accept-Language':'es-ES,es;q=0.9','Cache-Control':'no-cache','Content-Type':'application/x-www-form-urlencoded','X-Requested-With':'XMLHttpRequest',Referer:window.location.href},body:new URLSearchParams({[`quantity[${t}]`]:'0'})});return(await e.json()).success?{success:true}:{success:false,error_code:null}}catch(t){return{success:false,error_code:null}}}(r.itemId.toString())).success?dt({error_code:null,variantId:e,productId:o},'ITEM_DELETED'):(T.push(t),await St(R,{targetsSelected:T,shooterPrice:N}),dt({error_code:'error',variantId:e,productId:o},'ITEM_DELETED'))}break}case'CHANGE_QUANTITY':{const{payload:t}=a,{variantId:e,quantity:o,productId:r}=t,n=pt().find((t=>t.productId.toString()===r.toString()&&t.variantId.toString()===e.toString()));if(n){console.log('CHANGING QUANTITY');const t=T.find((t=>t.id===r.toString()&&t.variantId===e.toString()))?.quantity;T=T.map((t=>t.id===r.toString()&&t.variantId===e.toString()?{...t,quantity:o}:t)),console.log('UPDATING STATS'),await St(R,{targetsSelected:T,shooterPrice:N});const a=await async function(t,e){LS.changeQuantity(t.toString(),e.toString());try{const a=await fetch('/cart/update/',{method:'POST',credentials:'same-origin',redirect:'manual',headers:{Accept:'application/json, text/plain, */*','Accept-Encoding':'gzip, deflate, br, zstd','Accept-Language':'es-ES,es;q=0.9','Cache-Control':'no-cache','Content-Type':'application/x-www-form-urlencoded','X-Requested-With':'XMLHttpRequest',Referer:window.location.href},body:new URLSearchParams({[`quantity[${t}]`]:e.toString()})}),o=await a.json();if(!o.success){const t=o.errors;if(t.length>0){const e=t[0].error_code;if('out_of_stock'===e){const a=t[0].requested;return{success:false,error_code:e,requested_quantity:a,available_quantity:t[0].stock}}}}return{success:true}}catch(t){return{success:false,error_code:null}}}(n.itemId.toString(),o.toString());a.success?dt({error_code:null,variantId:e,productId:r},'ITEM_QUANTITY_CHANGED'):(T=T.map((a=>a.id===r.toString()&&a.variantId===e.toString()?{...a,quantity:t}:a)),await St(R,{targetsSelected:T,shooterPrice:N}),'out_of_stock'===a.error_code?dt({error_code:a.error_code,requested_quantity:a.requested_quantity,available_quantity:a.available_quantity,variantId:e,productId:r},'ITEM_QUANTITY_CHANGED'):dt({error_code:'error',variantId:e,productId:r},'ITEM_QUANTITY_CHANGED'))}break}case'ADD_TO_CART_CARROUSEL':{let{payload:t}=a;if(LS.cart.id||await nt(),A=t,!t||!t.variant)break;const e=P.offer.targets,o=t&&t.variant?e.find((e=>e.id===t.variant.productId)):e[0].variants[0],r=t.variant??e[0].variants[0];if(o){if(C.find((t=>t.id===o.id&&t.variantId===r.id))){const e=C.find((t=>t.id===o.id&&t.variantId===r.id));return void(e.quantity+=t.quantity??1)}C.push({id:o.id,name:o.name,variantId:r.id??null,price:r.price??null,promotionalPrice:r.promotionalPrice??null,quantity:t.quantity??1})}if(q){const t=await _t(q,C,e);'different key value'!==t?.error&&'different key value'!==t?.message||(console.log('different key value'),await It(C,e,q))}else await It(C,e);const n=gt(t);j=true,await lt(n);break}case'CARROUSEL_READY':console.log('CAROUSEL READY'),U=true,await W();break;case'EMPTY_CAROUSEL':{console.log('EMPTY CAROUSEL');const t=document.querySelector('.carrousel-container');t&&(t.style.display='none'),U=false,j=false;break}}}))}))}crossupScript();