1import{f as ht,c as Ue}from"./product-image.h_NVNI2L.js";import{b as D,I as ee,i as mt}from"./image-path.DZr9LMbE.js";import{f as pt,a as gt}from"./customerApi.D3VKpn5k.js";const se=window.__API_LESS_URL||"https://api-less.cocunat.com",Le={eu:{countries:["AD","AT","BE","HR","CY","EE","FI","GR","IE","LV","LT","LU","MT","MC","NL","PT","SK","SI"],currency:"EUR",club:{club:{amount:48,currency:"EUR"},"club-plus":{amount:69,currency:"EUR"},"club-premium":{amount:89,currency:"EUR"}}},au:{countries:["AU"],currency:"AUD",club:{club:{amount:57,currency:"AUD"},"club-plus":{amount:83,currency:"AUD"},"club-premium":{amount:115,currency:"AUD"}}},ca:{countries:["CA"],currency:"CAD",club:{club:{amount:88,currency:"CAD"},"club-plus":{amount:130,currency:"CAD"},"club-premium":{amount:178,currency:"CAD"}}},co:{countries:["CO"],currency:"COP",club:null},cz:{countries:["CZ"],currency:"CZK",club:null},dk:{countries:["DK"],currency:"DKK",club:null},fr:{countries:["FR"],currency:"EUR",club:{club:{amount:48,currency:"EUR"},"club-plus":{amount:69,currency:"EUR"},"club-premium":{amount:89,currency:"EUR"}}},de:{countries:["DE"],currency:"EUR",club:{club:{amount:48,currency:"EUR"},"club-plus":{amount:69,currency:"EUR"},"club-premium":{amount:89,currency:"EUR"}}},hu:{countries:["HU"],currency:"HUF",club:null},il:{countries:["IL"],currency:"ILS",club:null},it:{countries:["IT"],currency:"EUR",club:{club:{amount:48,currency:"EUR"},"club-plus":{amount:69,currency:"EUR"},"club-premium":{amount:89,currency:"EUR"}}},nz:{countries:["NZ"],currency:"NZD",club:null},no:{countries:["NO"],currency:"NOK",club:null},py:{countries:["PY"],currency:"PYG",club:null},pe:{countries:["PE"],currency:"PEN",club:null},ph:{countries:["PH"],currency:"PHP",club:null},pl:{countries:["PL"],currency:"PLN",club:null},ro:{countries:["RO"],currency:"RON",club:null},sa:{countries:["SA"],currency:"SAR",club:null},mx:{countries:["MX"],currency:"MXN",club:null},es:{countries:["ES"],currency:"EUR",club:{club:{amount:39,currency:"EUR"},"club-plus":{amount:59,currency:"EUR"},"club-premium":{amount:79,currency:"EUR"}}},se:{countries:["SE"],currency:"SEK",club:null},ch:{countries:["CH"],currency:"CHF",club:null},gb:{countries:["GB"],currency:"GBP",club:{club:{amount:47,currency:"GBP"},"club-plus":{amount:69,currency:"GBP"},"club-premium":{amount:89,currency:"GBP"}}},us:{countries:["US"],currency:"USD",club:{club:{amount:64,currency:"USD"},"club-plus":{amount:94,currency:"USD"},"club-premium":{amount:129,currency:"USD"}}},int:{countries:["*"],currency:"USD",club:{club:{amount:64,currency:"USD"},"club-plus":{amount:94,currency:"USD"},"club-premium":{amount:129,currency:"USD"}}}},ve={en:"FREE",es:"GRATIS",fr:"GRATUIT",de:"KOSTENLOS",it:"GRATUITO"};function ft(t){const e=["53102","53093","53239","53123","53251","53206","53252","51832","53176","52074","53342","53210","53183","53299","53110","53117","201","188","220","219","276","255","427"],r=["218","273"];return t==="XX53176"?"club-plus":r.includes(t)?"club-premium":e.includes(t)?"club":null}const _t=new Map([["utm_source","utm_source"],["utm_medium","utm_medium"],["utm_campaign","utm_campaign"],["utm_id","utm_id"],["utm_term","utm_term"],["utm_content","utm_content"],["gclid","gclid"],["dclid","dclid"],["gbraid","gbraid"],["wbraid","wbraid"],["fbclid","fbclid"],["msclkid","msclkid"],["ttclid","ttclid"],["at_gd","at_gd"],["gc_id","gc_id"],["h_ad_id","h_ad_id"],["fbc_id","fbc_id"],["tw_source","tw_source"],["tw_campaign","tw_campaign"],["tw_campaing","tw_campaing"],["tw_medium","tw_medium"],["wickedsource","WickedSource"],["wickedid","WickedID"],["promo","promo"],["promocion","promocion"]]),bt=24,yt=1024;function Ve(t){const e={},r=t instanceof URLSearchParams?t.entries():t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t):[];for(const[n,o]of r){if(Object.keys(e).length>=bt)break;const s=_t.get(String(n).trim().toLowerCase());!s||typeof o!="string"||!o||(e[s]=o.slice(0,yt))}return e}function Ge(t=globalThis.window){try{const e=t?.cocunatExperiments?.cartValue?.();return typeof e=="string"?e:""}catch{return""}}function Ke(t,e=globalThis.window){try{return e?.cocunatExperiments?.track?.(t)===!0}catch{return!1}}const Te=t=>String(t??"").trim(),ze=t=>String(t??"").trim().toLowerCase(),Ct=t=>{if(!t)return!1;const e=t.price?.amount;if(e==null||e==="")return!1;const r=Number(e);return!Number.isFinite(r)||r<=0||!Number(t.variant_id)?!1:Number(t.out_of_stock)!==1};function wt(t,e){const r=t?.exceptions,n=Te(e),s=r&&typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,n)?r[n]:t?.percentage,c=Number(s);return Number.isFinite(c)?Math.min(100,Math.max(0,c)):0}function St(t,e){const r=Array.isArray(t)?t.slice(0,2):[],n=[...Array.isArray(e?.items)?e.items:[],...Array.isArray(e?.gifts)?e.gifts.filter(d=>d?.success!==!1):[]],o=new Set(n.map(d=>
1Te(d?.sku)).filter(Boolean)),s=new Set(n.map(d=>String(d?.variant_id??"").trim()).filter(Boolean)),c=new Set(n.map(d=>ze(d?.handle)).filter(Boolean)),h=new Set,u=new Set,i=new Set;return r.filter(d=>{if(!Ct(d))return!1;const f=Te(d.sku),w=String(d.variant_id??"").trim(),P=ze(d.handle);return o.has(f)||s.has(w)||P&&c.has(P)||h.has(f)||u.has(w)||P&&i.has(P)?!1:(h.add(f),u.add(w),P&&i.add(P),!0)})}function vt(t,e={}){return(t===1?e.deterministic_one_month_label||"1 month":e.deterministic_months_label||"{count} months").replace("{count}",String(t))}function kt(t,e={}){return t===1?e.flex_monthly||"Monthly":t===2&&e.flex_bimonthly?e.flex_bimonthly:t===3&&e.flex_quarterly?e.flex_quarterly:(e.flex_every_label||"Every {count} months").replace("{count}",String(t))}const tt=100;let Ee=null,Ce=null,qe=0,Ye=!1;function ye(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.min(e,tt)}function rt(t,e){if(!t||e===null||e===void 0||e==="")return 0;const r=t.exceptions;if(r&&typeof r=="object"){const n=[String(e)],o=Number.parseInt(String(e),10);Number.isFinite(o)&&n.push(String(o));for(const s of n)if(Object.prototype.hasOwnProperty.call(r,s))return ye(r[s])}return ye(t.percentage)}function Et(t){return t?.subscriberDiscount?.eligible!==!0?0:ye(t.subscriberDiscount.percentage)}function Lt(t){return t?.subscriptions?.club===!0}function Pe(...t){return Math.min(t.reduce((e,r)=>e+ye(r),0),tt)}function Pt({promotion:t,sku:e,subscriberPercentage:r}){return Pe(rt(t,e),r)}function ke({basePrice:t,promoPercent:e=0,subscriberPercent:r=0,firstPurchasePercent:n=0}){const o=Pe(e,r),s=Pe(o,n),c=ye(n)>0,h=ye(r)>0,i=[ye(e)>0&&"promotion",c&&"first_purchase",h&&"subscriber"].filter(Boolean),d=s>0?`${s}%`:"";return{effectivePercent:s,finalPrice:Number(t)*(1-s/100),firstPurchaseActive:c,subscriberActive:h,pairBadge:d,pairLabel:i.length===1&&i[0]!=="promotion"?i[0]:null,badge:c?d:s>0?`-${s}%`:""}}function nt(){qe+=1,Ee=null,Ce=null}function It(){Ye||typeof document>"u"||(Ye=!0,document.addEventListener("cocunat:identity-changed",nt))}const We=Object.freeze({percentage:0,club:!1,product:!1,authenticated:!1});async function it(t){if(typeof window>"u")return We;if(It(),Ee!==null)return Ee;if(!Ce){const e=qe,r=String(t||window.__API_LESS_URL||"https://api-less.cocunat.com").replace(/\/$/,""),n=fetch(`${r}/api/auth/benefits`,{credentials:"include",cache:"no-store"}).then(async o=>{if(!o.ok)throw new Error(`subscriber_benefits_${o.status}`);const s=await o.json();return{percentage:Et(s),club:Lt(s),product:s?.subscriptions?.product===!0,authenticated:s?.authenticated===!0}}).then(o=>(qe===e&&(Ee=o),o)).catch(()=>We).finally(()=>{Ce===n&&(Ce=null)});Ce=n}return Ce}async function At(t){return(await it(t)).percentage}const xt={},Qe="__one_off__",Ut={},we="[data-cbf-sub-option], [data-pdp3-club-onetime-option], [data-pdp3-main-price], [data-pdp3-sticky-cta]",Je="[data-main-discount-badge], [data-cbf-one-time-discount-badge], [data-club-one-time-compare-badge], .sticky-cta-discount";window.Cart||(window.Cart=class{constructor(){this.COOKIE_NAME="cart_id",this.PROMO_COOKIE_NAME="promo_code",this.URL_PARAMS_COOKIE_NAME="url_params",this.COOKIE_EXPIRY_DAYS=365,this.URL_PARAMS_EXPIRY_DAYS=28,this.API_BASE_URL=se+"/api/v2/carts",this.DEFAULT_MARKET="us",this.DEFAULT_LANGUAGE="en",this.DEFAULT_CURRENCY="USD",this.cartId=this.getStoredCartId(),this.isCartOpen=!1,this._emptyCartContentPromise=null,this._priceRenderGeneration=0,this._cartRecoveryPromise=null,this._cartMutationTail=Promise.resolve(),this._firstPurchaseBySku={},this._firstPurchaseQueriedSkus=new Set,this._firstPurchaseBatchInFlight=!1,this._firstPurchaseBatchQueued=!1,this._firstPurchaseListingSettled=!1,this._firstPurchaseIdentityGeneration=0,this.handlePromoCode(),this.storeUrlParameters(),this.currentLocale=this.parseLocaleFromUrl(),document.addEventListener("cocunat:identity-changed",()=>{nt(),this._firstPurchaseBySku={},this._firstPurchaseQueriedSkus=new Set,this._firstPurchaseListingSettled=!1,this._firstPurchaseIdentityGeneration=(this._firstPurchaseIdentityGeneration||0)+1,this.applyToPricesUI(),this.cartId&&this.refreshCart({dispatchUpdated:!0}).catch(()=>{})})}setCurrentLocale(){this.currentLocale=this.parseLocaleFromUrl()}showCartLoading(){const t=document.getElementById("cart-loading-overlay");t&&t.classList.remove("hidden")}hideCartLoading(){const t=document.getElementById("cart-loading-overlay");t&&t.classList.add("hidden")}parseLocaleFromUrl(){const e=window.location.pathname.match(/^\/([a-z]{2})-([a-z]{2,3})/);return e?{language:e[1],market:e[2]}:{language:this.DEFAULT_LANGUAGE,market:this.DEFAULT_MARKET}}getCurrentMarket(){return this.currentLocale?.market||this.DEFAULT_MARKET}getCurrentLanguage(){return this.currentLocale?.language||this.DEFAULT_LANGUAGE}currencyCodeToSymbol(t){return{EUR:"â¬",USD:"$",GBP:"£",JPY:"Â¥",CHF:"â£",CAD:"C$",MXN:"MX$"}[t]||t}formatCurrency(t,e){const r=this.currencyCodeToSymbol(e);if(e==="MXN")return`${r}
1${parseInt(t).toLocaleString("es-MX")}`;const n=parseFloat(t),o=Number.isInteger(n)?String(n):n.toFixed(2);return e==="EUR"?`${o}${r}`:`${r}${o}`}setCookie(t,e,r){const n=new Date;n.setTime(n.getTime()+r*24*60*60*1e3);const o=`expires=${n.toUTCString()}`;document.cookie=`${t}=${e};${o};path=/;SameSite=Lax`}getCookie(t){let e=null;const r=`${t}=`,n=document.cookie.split(";");for(let o of n)if(o=o.trim(),o.indexOf(r)===0)return e=o.substring(r.length,o.length),e==="OPEN"||e==="NEPO"||e==="OPENUS"||e==="NEPOES"||e==="OPENROW"?null:e;return null}deleteCookie(t){document.cookie=`${t}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`}getStoredCartId(){return this.getCookie(this.COOKIE_NAME)}setStoredCartId(t){const e=this.cartId;this.setCookie(this.COOKIE_NAME,t,this.COOKIE_EXPIRY_DAYS),this.cartId=t,e&&e!==t&&this.removeCartIdFromUrl(e),this.updateCartParams()}getStoredPromoCode(){let t=this.getCookie(this.PROMO_COOKIE_NAME);t&&!window.activePromosCodes.includes(t)&&(t=null);const e=t||window?.marketDefaultsParam?.default_promotion||"OPENROW";return this.applyPromoOverride(e)}applyPromoOverride(t){const e=Ut[t];return!e||!window.activePromosCodes||!window.activePromosCodes.includes(e)?t:e}setStoredPromoCode(t){this.setCookie(this.PROMO_COOKIE_NAME,t,this.COOKIE_EXPIRY_DAYS)}handlePromoCode(){const e=new URLSearchParams(window.location.search).get("hotpromo");if(e){const r=this.getStoredPromoCode();(!r||r!==e)&&(this.setStoredPromoCode(e),this.cartId&&this.applyPromotion(e).catch(n=>{}))}}applyPromotion(t){return this.enqueueCartMutation(()=>this._applyPromotion(t))}async _applyPromotion(t){if(!this.cartId)return null;try{this.showCartLoading();const e=this.cartId,r=await fetch(`${this.API_BASE_URL}/promotion/apply`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({cart_id:e,promo_codes:t||"",market:this.getCurrentMarket()})}),n=await r.json().catch(()=>null);return this.requireUsableCartMutationResponse(r,n,"apply promotion",e),this.dispatchCartEvent("cartUpdated",n),this.triggerCheckoutCache(),n}catch(e){throw e}finally{this.hideCartLoading()}}addItem(t,e=1,r=null,n=!1,o=null,s=null,c=null,h=null){return this.enqueueCartMutation(()=>this._addItem(t,e,r,n,o,s,c,h))}async _addItem(t,e=1,r=null,n=!1,o=null,s=null,c=null,h=null){try{this.showCartLoading();const u=this.getStoredPromoCode(),i=this.getCurrentLanguage(),d=this.cartId,f=Ge(),w={variant_id:t,quantity:e,market:r||this.getCurrentMarket(),...d&&{cart_id:d},promo_codes:u||"",language:i,...s?.id&&{menu_source:s.id},...Array.isArray(c)&&c.length>0&&{attributes:c},...f&&{experiments:f}};if(o&&o.toLowerCase().includes("gid://shopify/sellingplan/"))if(w.selling_plan_id=o,h)w.selling_plan_name=h;else{const E=document.querySelector(`.add-to-cart[data-variant-id="${t}"]`),g=E?E.getAttribute("data-selling-plan-name"):null;if(g)w.selling_plan_name=g;else{const m=E?E.getAttribute("data-sku"):null;w.selling_plan_name=m==="53176"?"club-plus":ft(m)||"club"}}const P=await fetch(`${this.API_BASE_URL}/add`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)}),p=await P.json().catch(()=>null);if(!n&&(P.status===404||this.isImmutablePromotionLinkConflict(P,p)))return this.retryMutationAfterUnusableCart(()=>this._addItem(t,e,r,!0,o,s,c,h),d,P.status===404?"cart_not_found":"promotion_link_cart_immutable");this.requireUsableCartMutationResponse(P,p,"add item",d),!this.cartId&&p.uuid&&this.setStoredCartId(p.uuid),this.dispatchCartEvent("cartUpdated",p),this.dispatchCartEvent("openCartDrawer",p),Ke("add_to_cart"),this.triggerCheckoutCache();try{const E=new URL(window.location.href),g=p.items.find(m=>m.variant_id===t&&m.cocunat_discount!==100)||p.items.find(m=>m.variant_id===t);document.dispatchEvent(new CustomEvent("EventAddToCart",{detail:{market:E.pathname.split("/")[1].replace("/",""),url:window.location.href,platform_variant_id:g.platform_variant_id,productId:g.sku,productName:g.title,price:parseFloat((g.total_price/g.quantity).toFixed(2)),currency:g.currency,item_list_id:s?.id,item_list_name:s?.name,rawAddedItem:g,rawCartData:p}}))}catch{}return p}catch(u){throw u}finally{this.hideCartLoading()}}createPack(t,e=null,r=null,n=!1){return this.enqueueCartMutation(()=>this._createPack(t,e,r,n))}async _createPack(t,e=null,r=null,n=!1){if(!Array.isArray(t)||t.length===0)throw new Error("At least one pack item is required");try{this.showCartLoading();const o=this.cartId,s=await fetch(`${this.API_BASE_URL}/create-your-pack`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:t,market:e||this.getCurrentMarket(),language:r||this.getCurrentLanguage(),promo_codes:this.getStoredPromoCode()||"",...o&&{cart_id:o}})}),c=await s.json().catch(()=>null);if(!n&&(s.status===404||this.isImmutablePromotionLinkConflict(s,c)))return this.retryMutationAfterUnusableCart(()=>this._createPack(t,e,r,!0),o,s.status===404?"cart_not_found":"promotion_link_cart_immutable");if(this.requireUsableCartMutationResponse(s,c,"create pack",o),!this.isUsableCartQuote(c)||!c.uuid)throw new Error("The pack response did not contain a cart quote");return this.cartId||this.setStoredCartId(c.uuid),this.dispatchCartEvent("cartUpdated",c),this.dispatchCartEvent("openCartDrawer",c),Ke("add_to_cart"),this.triggerCheckoutCac
1he(),c}finally{this.hideCartLoading()}}convertItemToSubscription(t){return this.enqueueCartMutation(()=>this._convertItemToSubscription(t))}async _convertItemToSubscription(t){const e=Number(t);if(!this.cartId||!Number.isInteger(e)||e<=0)throw new Error("A valid cart and variant are required to switch to a subscription");try{this.showCartLoading();const r=this.cartId,n=await fetch(`${this.API_BASE_URL}/${encodeURIComponent(r)}/items/${e}/subscription`,{method:"PUT",credentials:"include",headers:{Accept:"application/json"}}),o=await n.json().catch(()=>null);if(this.requireUsableCartMutationResponse(n,o,"convert item to subscription",r),!o||!Array.isArray(o.items))throw new Error("The subscription response did not contain a cart quote");return this.dispatchCartEvent("cartUpdated",o),this.triggerCheckoutCache(),o}finally{this.hideCartLoading()}}changeItemSubscriptionPlan(t,e){return this.enqueueCartMutation(()=>this._changeItemSubscriptionPlan(t,e))}async _changeItemSubscriptionPlan(t,e){const r=Number(t),n=String(e||"").trim();if(!this.cartId||!Number.isInteger(r)||r<=0||!/^gid:\/\/shopify\/SellingPlan\/[1-9][0-9]*$/.test(n))throw new Error("A valid cart, variant, and subscription plan are required");try{this.showCartLoading();const o=this.cartId;let s;try{s=await fetch(`${this.API_BASE_URL}/${encodeURIComponent(o)}/items/${r}/subscription`,{method:"PATCH",credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({selling_plan_id:n})})}catch(h){return await this.reconcileSubscriptionPlanChange(r,n,h)}const c=await s.json().catch(()=>null);if((s.status===404||this.isImmutablePromotionLinkConflict(s,c))&&this.requireUsableCartMutationResponse(s,c,"change subscription plan",o),!s.ok){const h=new Error(c?.message||"The subscription plan could not be updated");if(h.code=c?.error,h.status=s.status,s.status>=500||this.isCartStateConflictCode(h.code))return await this.reconcileSubscriptionPlanChange(r,n,h);throw h}return!this.isUsableCartQuote(c)||!this.cartQuoteHasSubscriptionPlan(c,r,n)?await this.reconcileSubscriptionPlanChange(r,n,new Error("The subscription response did not contain the updated cart quote")):(this.dispatchCartEvent("cartUpdated",c),this.triggerCheckoutCache(),{quote:c,requestedPlanApplied:!0,reconciled:!1})}finally{this.hideCartLoading()}}removeItemSubscription(t){return this.enqueueCartMutation(()=>this._removeItemSubscription(t))}async _removeItemSubscription(t){const e=Number(t);if(!this.cartId||!Number.isInteger(e)||e<=0)throw new Error("A valid cart and variant are required to remove a subscription");try{this.showCartLoading();const r=this.cartId;let n;try{n=await fetch(`${this.API_BASE_URL}/${encodeURIComponent(r)}/items/${e}/subscription`,{method:"DELETE",credentials:"include",headers:{Accept:"application/json"}})}catch(s){return await this.reconcileSubscriptionRemoval(e,s)}const o=await n.json().catch(()=>null);if((n.status===404||this.isImmutablePromotionLinkConflict(n,o))&&this.requireUsableCartMutationResponse(n,o,"remove item subscription",r),!n.ok){const s=new Error(o?.message||"The subscription could not be removed");if(s.code=o?.error,s.status=n.status,n.status>=500||this.isCartStateConflictCode(s.code))return await this.reconcileSubscriptionRemoval(e,s);throw s}return!this.isUsableCartQuote(o)||!this.cartQuoteHasOneOffPurchase(o,e)?await this.reconcileSubscriptionRemoval(e,new Error("The subscription response did not contain the one-off cart quote")):(this.dispatchCartEvent("cartUpdated",o),this.triggerCheckoutCache(),{quote:o,requestedOneOffApplied:!0,reconciled:!1})}finally{this.hideCartLoading()}}isUsableCartQuote(t){return!!t&&typeof t=="object"&&typeof t.uuid=="string"&&t.uuid.trim().length>0&&Array.isArray(t.items)&&t.items.every(e=>e&&typeof e=="object"&&Number.isSafeInteger(Number(e.variant_id))&&Number(e.variant_id)>0)}requireUsableCartMutationResponse(t,e,r,n){if(t?.status===404||this.isImmutablePromotionLinkConflict(t,e)){const o=this.detachUnusableCart(t.status===404?"cart_not_found":"promotion_link_cart_immutable",n),s=new Error(e?.message||(t.status===404?"This cart is no longer available":"This recovery cart cannot be modified"));throw s.status=t.status,s.code=e?.error,s.cartDetached=o,s}if(!t.ok){const o=new Error(e?.message||`Cart ${r} failed: ${t.status}`);throw o.status=t.status,o.code=e?.error,o}if(!this.isUsableCartQuote(e))throw new Error(`Cart ${r}
1 returned an invalid quote`);return e}isImmutablePromotionLinkConflict(t,e){return t?.status===409&&e?.error==="promotion_link_cart_immutable"}removeCartIdFromUrl(t=null){try{const e=new URL(window.location.href),r=e.searchParams.get("cart_id");return!r||t!==null&&r!==t?!1:(e.searchParams.delete("cart_id"),window.history.replaceState(window.history.state,"",`${e.pathname}${e.search}${e.hash}`),!0)}catch{return!1}}detachUnusableCart(t="cart_unusable",e=this.cartId){return this.cartId!==e?(this.removeCartIdFromUrl(e),!1):(this.deleteCookie(this.COOKIE_NAME),this.cartId=null,this.removeCartIdFromUrl(e),this.updateCartUI({uuid:"",items:[],items_count:0,total_price:0,total_discount:0,currency:this.DEFAULT_CURRENCY,market:this.currentLocale?.market||this.DEFAULT_MARKET,language:this.currentLocale?.language||this.DEFAULT_LANGUAGE}),this.dispatchCartEvent("cartCleared",{reason:t}),!0)}async retryMutationAfterUnusableCart(t,e,r){const n=this.detachUnusableCart(r,e),o=this._cartRecoveryPromise;if(o){try{await o}catch{}return t()}if(!n)return t();const s=Promise.resolve().then(t);this._cartRecoveryPromise=s;try{return await s}finally{this._cartRecoveryPromise===s&&(this._cartRecoveryPromise=null)}}enqueueCartMutation(t){const e=()=>Promise.resolve().then(t),r=this._cartMutationTail.then(e,e);return this._cartMutationTail=r.catch(()=>{}),r}runCartAction(t){return Promise.resolve(t).catch(e=>null)}cartQuoteHasSubscriptionPlan(t,e,r){const n=String(r||"").trim();return this.isUsableCartQuote(t)&&t.items.some(o=>Number(o.variant_id)===Number(e)&&o.purchaseKind==="product_subscription"&&String(o.sellingPlanId||"").trim()===n)}cartQuoteHasOneOffPurchase(t,e){if(!this.isUsableCartQuote(t))return!1;const r=t.items.filter(n=>Number(n.variant_id)===Number(e)&&!n.from_pack_id);return r.some(n=>n.purchaseKind==="one_off"&&!n.sellingPlanId)&&r.every(n=>n.purchaseKind!=="product_subscription"&&n.purchaseKind!=="club_join"&&!n.sellingPlanId)}isCartStateConflictCode(t){return["cart_conflict","cart_stale","cart_state_conflict","cart_version_conflict","stale_cart"].includes(String(t||"").toLowerCase())}async reconcileSubscriptionPlanChange(t,e,r){try{const n=await this.getCart();if(!this.isUsableCartQuote(n))throw new Error("The refreshed cart response was invalid");return this.dispatchCartEvent("cartUpdated",n),this.triggerCheckoutCache(),{quote:n,requestedPlanApplied:this.cartQuoteHasSubscriptionPlan(n,t,e),reconciled:!0}}catch(n){const o=new Error("The subscription plan result could not be confirmed",{cause:n});throw o.subscriptionPlanStateUnknown=!0,o.patchCause=r,o}}async reconcileSubscriptionRemoval(t,e){try{const r=await this.getCart();if(!this.isUsableCartQuote(r))throw new Error("The refreshed cart response was invalid");return this.dispatchCartEvent("cartUpdated",r),this.triggerCheckoutCache(),{quote:r,requestedOneOffApplied:this.cartQuoteHasOneOffPurchase(r,t),reconciled:!0}}catch(r){const n=new Error("The subscription removal result could not be confirmed",{cause:r});throw n.subscriptionPlanStateUnknown=!0,n.deleteCause=e,n}}removeItem(t,e=1,r=null){return this.enqueueCartMutation(()=>this._removeItem(t,e,r))}async _removeItem(t,e=1,r=null){if(!this.cartId)return null;try{this.showCartLoading();const n=this.getStoredPromoCode(),o=this.cartId,s=await fetch(`${this.API_BASE_URL}/remove`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({variant_id:t,quantity:e,market:r||this.getCurrentMarket(),cart_id:o,promo_codes:n||""})}),c=await s.json().catch(()=>null);return this.requireUsableCartMutationResponse(s,c,"remove item",o),this.dispatchCartEvent("cartUpdated",c),this.triggerCheckoutCache(),c}catch(n){throw n}finally{this.hideCartLoading()}}removePack(t){return this.enqueueCartMutation(()=>this._removePack(t))}async _removePack(t){if(!this.cartId)return null;try{this.showCartLoading();const e=this.getStoredPromoCode(),r=this.cartId,n=await fetch(`${this.API_BASE_URL}/remove-pack`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({from_pack_id:t,cart_id:r,promo_codes:e||""})}),o=await n.json().catch(()=>null);return this.requireUsableCartMutationResponse(n,o,"remove pack",r),this.dispatchCartEvent("cartUpdated",o),this.triggerCheckoutCac
1he(),o}catch(e){throw e}finally{this.hideCartLoading()}}subtractItem(t,e=1,r=null){return this.enqueueCartMutation(()=>this._subtractItem(t,e,r))}async _subtractItem(t,e=1,r=null){if(!this.cartId)return null;try{this.showCartLoading();const n=this.getStoredPromoCode(),o=this.cartId,s=await fetch(`${this.API_BASE_URL}/subtract`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({variant_id:t,quantity:e,market:r||this.getCurrentMarket(),cart_id:o,promo_codes:n||""})}),c=await s.json().catch(()=>null);return this.requireUsableCartMutationResponse(s,c,"subtract item",o),this.dispatchCartEvent("cartUpdated",c),this.triggerCheckoutCache(),c}catch(n){throw n}finally{this.hideCartLoading()}}async getCart(t=!0){if(!this.cartId)return null;try{const e=this.cartId,r=await fetch(`${this.API_BASE_URL}/${e}`,{credentials:"include"});if(r.status===404)return!this.detachUnusableCart("cart_not_found",e)&&t&&this.cartId&&this.cartId!==e?this.getCart(!1):null;if(!r.ok)throw new Error(`Cart request failed: ${r.status}`);const n=await r.json();if(n!==null&&!this.isUsableCartQuote(n))throw new Error("Cart request returned an invalid quote");return t&&this.cartId&&this.cartId!==e?this.getCart(!1):this.cartId!==e?null:n}catch(e){throw e}}async getCartUpsellCatalog(){const t=String(this.getCurrentLanguage()||this.DEFAULT_LANGUAGE).toUpperCase(),e=String(this.getCurrentMarket()||this.DEFAULT_MARKET).toLowerCase(),r=`${t}:${e}`;if(this._cartUpsellCatalog?.key!==r){const n=fetch(`${se}/api/upsells`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lang:t,market:e})}).then(o=>{if(!o.ok)throw new Error(`Upsells request failed: ${o.status}`);return o.json()}).then(o=>o?.success?[o.product,o.product2]:[]);this._cartUpsellCatalog={key:r,promise:n}}try{return await this._cartUpsellCatalog.promise}catch(n){throw this._cartUpsellCatalog?.key===r&&(this._cartUpsellCatalog=null),n}}async getUpsellProductsForCart(t){if(!t?.uuid)return[];try{const e=await this.getCartUpsellCatalog(),r=St(e,t);if(r.length===0)return[];const[n,o]=await Promise.all([this.getActivePromoData(),this.get
1SubscriberDiscountPercentage()]);return r.map(s=>{const c=Number(s.price.amount),h=String(s.sku),u=Pe(wt(n,h),o),i=Number((c*(1-u/100)).toFixed(2));return{variant_id:Number(s.variant_id),quantity:1,handle:s.handle,image:D(ht(s),ee.cartLine)||"/images/cart/bag.svg",sku:h,title:s.title||"",subtitle:s.subtitle||s.short_description||"",price:i,currency:s.price?.currency||t.currency||this.DEFAULT_CURRENCY,original_total_price:c,total_price:i,total_discount:Number((c-i).toFixed(2))}})}catch{return[]}}async triggerCheckoutCache(){return null}clearCart(){return this.enqueueCartMutation(()=>this._clearCart())}async _clearCart(){this.cartId&&(this.deleteCookie(this.COOKIE_NAME),this.cartId=null,this.dispatchCartEvent("cartCleared"))}dispatchCartEvent(t,e={}){const r=new CustomEvent(t,{detail:{...e,cartId:this.cartId,timestamp:new Date().toISOString()},bubbles:!0});window.dispatchEvent(r)}initializeAddToCartButtons(t=document){t.querySelectorAll(".add-to-cart").forEach(e=>{const r=e.cloneNode(!0);e.parentNode.replaceChild(r,e);const n=r.querySelector(".add-to-cart-text"),o=r.querySelector(".add-to-cart-loading");r.addEventListener("click",async s=>{const c=Number(r.getAttribute("data-variant-id")),h=r.getAttribute("data-purchase-option"),u=r.getAttribute("data-sku"),i=r.getAttribute("data-list-id"),d=i?{id:i,name:r.getAttribute("data-list-name")||i}:null;let f=null,w=null;const P=r.classList.contains("main-product-atc"),E=["233","23611","23711","23811"].includes(u);P&&h&&h.toLowerCase().includes("gid://shopify/sellingplan/")&&!E?(f=h,w=r.getAttribute("data-selling-plan-name"),(!w||["club","club-plus","club-premium"].includes(w))&&ot()):E&&h&&h.toLowerCase().includes("gid://shopify/sellingplan/");let g=null;const m=r.getAttribute("data-line-attributes");if(m)try{const x=JSON.parse(m);Array.isArray(x)&&x.length>0&&(g=x)}catch{}if(c)try{r.disabled=!0,n.classList.add("hidden"),o.classList.remove("hidden"),await this.addItem(c,1,null,!1,f,d,g,w),n.classList.remove("hidden"),o.classList.add("hidden"),r.disabled=!1}catch{n.textContent="Error",n.classList.remove("hidden"),o.classList.add("hidden"),setTimeout(()=>{r.disabled=!1,n.textContent="AÃADIR"},2e3)}})})}hydrateEmptyCartImages(t){t.querySelectorAll("img[data-cart-empty-src]").forEach(e=>{const r=e.getAttribute("data-cart-empty-src");r&&!e.getAttribute("src")&&e.setAttribute("src",r)})}loadEmptyCartContent(t){if(this._emptyCartContentPromise)return this._emptyCartContentPromise;const e=String(this.getCurrentLanguage()||this.DEFAULT_LANGUAGE).toUpperCase(),r=String(this.getCurrentMarket()||this.DEFAULT_MARKET).toLowerCase(),n=new URLSearchParams({lang:e,market:r}),o=`${se}/api/generic-content/empty-cart?${n.toString()}`;return this._emptyCartContentPromise=(async()=>{const s=new AbortController,c=window.setTimeout(()=>s.abort(),3500);try{const h=await fetch(o,{method:"GET",headers:{Accept:"application/json"},signal:s.signal});if(!h.ok)return!1;const u=Number(h.headers.get("content-length"));if(Number.isFinite(u)&&u>1024*1024)return!1;let d=(await h.json())?.data;if(typeof d=="string")try{d=JSON.parse(d)}catch{return!1}const f=this.normalizeEmptyCartDocument(d);return f?this.renderEmptyCartDocument(t,f):!1}catch(h){return h?.name,!1}finally{window.clearTimeout(c)}})(),this._emptyCartContentPromise}normalizeEmptyCartDocument(t){if(!t||typeof t!="object"||Array.isArray(t)||t.version!==void 0&&Number(t.version)!==1)return null;const e=(d,f=500)=>{if(typeof d!="string")return null;const w=d.trim();return w&&w.length<=f?w:null},r=(d,f=500)=>d==null?"":typeof d!="string"||d.length>f?null:d.trim(),n=d=>{if(typeof d!="string"&&typeof d!="number")return null;const f=String(d).trim();return f&&f.length<=160?f:null},o=e(t.heading),s=e(t.cta_label,160),c=r(t.cta_link,2048);if(!o||!s||c===null)return null;const h=c?this.resolveEmptyCartLink(c):"";if(c&&!h||!Array.isArray(t.blocks)||t.blocks.length===0||t.blocks.length>40)return null;const u=new Set,i=[];for(const d of t.blocks){if(!d||typeof d!="object"||Array.isArray(d))return null;const f=n(d.id);if(!f||u.has(f))return null;if(u.add(f),d.type==="product_pair"){if(!Array.isArray(d.items)||d.items.length!==2)return null;const w=[];for(const P of d.items){if(!P||typeof P!="object"||Array.isArray(P))return null;const p=n(P.id),E=e(P.title),g=this.resolveEmptyCartImage(P.image),m=this.resolveEmptyCartLink(P.link),x=r(P.alt);if(!p||u.has(p)||!E||!g||!m||x===null)return null;u.add(p),w.push({id:p,title:E,image:g,link:m,alt:x||E})}i.push({id:f,type:"product_pair",items:w});continue}if(d.type==="full_banner"){const w=this.resolveEmptyCartImage(d.image),P=r(d.mobile_image,2048),p=P?this.resolveEmptyCartImage(P):"",E=this.resolveEmptyCartLink(d.link),g=r(d.eyebrow),m=e(d.title),x=r(d.alt);if(!w||P&&!p||!E||g===null||!m||x===null)return null;i.push({id:f,type:"full_banner",image:w,mobileImage:p,link:E,eyebrow:g,title:m,alt:x});continue}return null}return{heading:o,ctaLabel:s,ctaLink:h,blocks:i}}resolveEmptyCartImage(t){if(typeof t!="string"||!t.trim()||t.length>2048)return null;const e=t.trim();
1try{const r=new URL(e,window.location.origin);return r.protocol!=="http:"&&r.protocol!=="https:"||r.username||r.password?null:e.startsWith("/")&&!e.startsWith("//")?`${r.pathname}${r.search}${r.hash}`:!/^[a-z][a-z\d+.-]*:/i.test(e)&&!e.startsWith("//")?`/${e.replace(/^\/+/,"")}`:r.href}catch{return null}}resolveEmptyCartLink(t){if(typeof t!="string"||!t.trim()||t.length>2048)return null;const e=t.trim();if(e.startsWith("#")||e.startsWith("?"))return e;try{if(/^[a-z][a-z\d+.-]*:/i.test(e)||e.startsWith("//")){const c=new URL(e,window.location.href);return c.protocol!=="http:"&&c.protocol!=="https:"||c.username||c.password?null:c.href}let n=e.startsWith("/")?e:`/${e}`;const o=new URL(n,window.location.origin);if(n=`${o.pathname}${o.search}${o.hash}`,/^\/[a-z]{2}-[a-z]{2,3}(?:\/|$)/i.test(o.pathname)||/^\/(?:api|images|assets|_astro|cdn-cgi)(?:\/|$)/i.test(o.pathname))return n;const s=`/${String(this.getCurrentLanguage()).toLowerCase()}-${String(this.getCurrentMarket()).toLowerCase()}`;return o.pathname==="/"?`${s}/${o.search}${o.hash}`:`${s}${n}`}catch{return null}}renderEmptyCartDocument(t,e){const r=t.querySelector("[data-cart-empty-title]"),n=t.querySelector("[data-cart-empty-cta]"),o=t.querySelector("[data-cart-empty-discovery]");if(!r||!n||!o)return!1;const s=e.blocks.reduce((c,h)=>{if(!c)return null;if(h.type==="product_pair"){const u=window.document.createElement("div");return u.className="cart-v2-empty-grid",u.dataset.cartEmptyBlockId=h.id,h.items.forEach(i=>{const d=window.document.createElement("a");d.className="cart-v2-empty-card",d.href=i.link,d.dataset.cartEmptyCard="",d.dataset.cartEmptyLink="",d.dataset.cartEmptyItemId=i.id;const f=window.document.createElement("img");f.className="cart-v2-empty-card-image",f.dataset.cartEmptySrc=i.image,f.alt=i.alt,f.width=166,f.height=166,f.loading="lazy",f.decoding="async";const w=window.document.createElement("span");w.textContent=i.title,d.append(f,w),u.append(d)}),c.append(u),c}if(h.type==="full_banner"){const u=window.document.createElement("a");u.className="cart-v2-empty-banner",u.href=h.link,u.dataset.cartEmptyBanner="",u.dataset.cartEmptyLink="",u.dataset.cartEmptyBlockId=h.id;const i=window.document.createElement("img");i.className="cart-v2-empty-banner-image",i.dataset.cartEmptySrc=h.mobileImage||h.image,i.alt=h.alt,i.width=372,i.height=180,i.loading="lazy",i.decoding="async";const d=window.document.createElement("span");d.className="cart-v2-empty-banner-shade",d.setAttribute("aria-hidden","true");const f=window.document.createElement("span");f.className="cart-v2-empty-banner-copy";const w=window.document.createElement("span");if(w.className="cart-v2-empty-banner-title",w.textContent=h.title,h.eyebrow){const P=window.document.createElement("span");P.className="cart-v2-empty-banner-eyebrow",P.textContent=h.eyebrow,f.append(P)}return f.append(w),u.append(i,d,f),c.append(u),c}return null},window.document.createDocumentFragment());return s?(r.textContent=e.heading,n.textContent=e.ctaLabel,e.ctaLink?n.dataset.cartEmptyCtaHref=e.ctaLink:delete n.dataset.cartEmptyCtaHref,o.replaceChildren(s),o.dataset.cartEmptyContentSource="generic-content",this.isCartOpen&&t.dataset.cartState==="empty"&&this.hydrateEmptyCartImages(t),!0):!1}openCart(){const t=document.getElementById("cart-drawer");if(t){const r=t.classList.contains("hidden");if(r&&(this._cartReturnFocus=document.activeElement instanceof HTMLElement?document.activeElement:null,this._cartPreviousBodyOverflow=Xe()?"":document.body.style.overflow),t.classList.remove("hidden"),t.setAttribute("aria-hidden","false"),document.body.style.overflow="hidden",this.isCartOpen=!0,r){const n=t.querySelector("[data-cart-scroll-region]");n&&(n.scrollTop=0),requestAnimationFrame(()=>{const o=t.querySelector("#close-cart-drawer");o instanceof HTMLElement&&(o.toggleAttribute("data-cart-pointer-autofocus",this._cartLastInputWasPointer===!0),o.focus({preventScroll:!0}))})}t.dataset.cartState==="empty"&&(this.hydrateEmptyCartImages(t),this.loadEmptyCartContent(t))}const e=document.getElementById("floating-cart-reminder");e&&e.classList.add("translate-y-full","opacity-0")}closeCart(){const t=document.getElementById("cart-drawer"),e=this.isCartOpen;t&&(t.classList.add("hidden"),t.setAttribute("aria-hidden","true"),document.body.style.overflow=Xe()?"hidden":this._cartPreviousBodyOverflow||"",this.isCartOpen=!1),e&&this._cartReturnFocus?.isConnected&&requestAnimationFrame(()=>{this._cartReturnFocus?.focus({preventScroll:!0}),this._cartReturnFocus=null}),this.benefitsCarouselInterval&&(clearInterval(this.benefitsCarouselInterval),this.benefitsCarouselInterval=null)}updateCartV2UI(t,e){const r=e.querySelector("#empty-cart-message"),n=e.querySelector("#cart-filled-content"),o=e.querySelector("#cart-progress-container"),s=e.querySelector("#cart-drawer-footer"),c=e.querySelector("[data-cart-empty-footer]"),h=e.querySelector('[data-cart-section="subscription"]'),u=e.querySelector('[data-cart-section="one-off"]'),i=e.querySelector('[data-cart-section="gifts"]'),d=e.querySelector('[data-cart-items="subscription"]'),f=e.querySelector('[data-cart-items="one-off"]'),w=e.querySelector('[data-cart-items="gifts"]'),P=e.querySelector("#cart-upsell-section"),p=Array.isArray(t?.items)?t.items:[],E=()=>
1{[d,f,w].forEach(l=>{l&&(l.innerHTML="")}),[h,u,i,P].forEach(l=>{l?.classList.add("hidden")})};if(p.length===0){this._progressRenderVersion=(this._progressRenderVersion||0)+1,e.dataset.cartState="empty",E(),r?.classList.remove("hidden"),n?.classList.add("hidden"),o?.classList.add("hidden"),o?.classList.remove("success","partial-success"),s?.classList.add("hidden"),c?.classList.remove("hidden"),this.isCartOpen&&(this.hydrateEmptyCartImages(e),this.loadEmptyCartContent(e)),this.updateUpsellWidget(null);return}e.dataset.cartState="filled",r?.classList.add("hidden"),n?.classList.remove("hidden"),s?.classList.remove("hidden"),c?.classList.add("hidden"),this.updateGiftProgressBar(t,e);const g={subscription:e.dataset.labelSubscription||"Subscription",pack:e.dataset.labelPack||"Your Pack",gift:e.dataset.labelGift||"Gift",free:e.dataset.labelFree||ve[this.currentLocale.language]||"Free",firstPurchaseRemaining:e.dataset.labelFirstPurchaseRemaining||"Remaining units: {price} / unit",firstPurchaseLine:e.dataset.labelFirstPurchaseLine||"First purchase",subscribe:e.dataset.labelSubscribe||"Subscribe and save",planOneMonth:e.dataset.labelSubscriptionPlanOneMonth||"1 month",planMonths:e.dataset.labelSubscriptionPlanMonths||"{count} months",planMonthly:e.dataset.labelSubscriptionPlanMonthly||"Monthly",planBimonthly:e.dataset.labelSubscriptionPlanBimonthly||"",planQuarterly:e.dataset.labelSubscriptionPlanQuarterly||"",planEveryMonths:e.dataset.labelSubscriptionPlanEveryMonths||"Every {count} months",planNone:e.dataset.labelSubscriptionPlanNone||"No subscription",planAccessible:e.dataset.labelSubscriptionPlanAccessible||"Purchase option for {product}",remove:e.dataset.labelRemove||"Remove product",decrease:e.dataset.labelDecrease||"Decrease quantity",increase:e.dataset.labelIncrease||"Increase quantity"},m=l=>String(l??"").replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'"),x=l=>{const v=String(l||"").trim();return/^[1-9][0-9]*$/.test(v)?`gid://shopify/SellingPlan/${v}`:/^gid:\/\/shopify\/SellingPlan\/[1-9][0-9]*$/.test(v)?v:""},T=l=>{if(!Array.isArray(l.subscriptionPlanOptions))return[];const v=new Map;return l.subscriptionPlanOptions.forEach(B=>{const H=x(B?.sellingPlanId),W=Number(B?.selectorMonths),Z=B?.widgetType;!H||!Number.isSafeInteger(W)||W<=0||!["deterministic","orientative"].includes(Z)||v.has(H)||v.set(H,{sellingPlanId:H,selectorMonths:W,widgetType:Z})}),[...v.values()].sort((B,H)=>B.selectorMonths-H.selectorMonths||B.sellingPlanId.localeCompare(H.sellingPlanId))},M={deterministic_one_month_label:g.planOneMonth,deterministic_months_label:g.planMonths,flex_monthly:g.planMonthly,flex_bimonthly:g.planBimonthly,flex_quarterly:g.planQuarterly,flex_every_label:g.planEveryMonths},A=l=>l.widgetType==="orientative"?kt(l.selectorMonths,M):vt(l.selectorMonths,M),q=l=>{const v=Number(l);return Number.isFinite(v)?Math.max(0,Math.min(100,v)):0},Q=l=>{const v=Math.max(1,Number(l.quantity)||1),B=Number(l.total_price)||0,H=Number(l.original_total_price),W=Number.isFinite(H)?H:B+(Number(l.total_discount)||0),Z=W>B+.005,re=Z&&W>0?Math.max(0,Math.min(100,Math.round((1-B/W)*100))):0,ge=q(l.cocunat_discount),fe=q(l.cocunat_discount_new_customer),he=Z&&W>0&&fe>0,_e=W/v,K=_e*(1-ge/100),ae=Math.min(100,ge+fe);return{currentUnit:he?_e*(1-ae/100):B/v,originalUnit:_e,regularUnit:K,discounted:Z,firstPurchase:he,hasRemainingUnits:he&&v>1,basePercentage:Math.round(ge),percentage:he?Math.round(ae):re}},F=l=>Number(l.cocunat_discount)===100&&Number(l.total_price)===0?"gift":l.purchaseKind==="product_subscription"||l.purchaseKind==="club_join"?"subscription":l.purchaseKind==="one_off"?"one-off":l.sellingPlanId?"subscription":"one-off",V=(l,v)=>{const B=l.subtitle||l.product_details?.subtitle||l.variant_title||"";return B||(v==="subscription"?g.subscription:"")},k=l=>l.purchaseKind==="club_join"||["club","club-plus","club-premium"].includes(l.sellingPlanName)?String(l.sellingPlanName||"Club").replaceAll("-"," ").toUpperCase():g.subscription,N=l=>{const v=Number(l.variant_id),B=`cart-subscription-plan-feedback-${v}`,H=l.purchaseKind==="product_subscription"?`<p id="${B}" class="cart-v2-subscription-plan-feedback hidden" role="status" aria-l
1ive="polite"></p>`:"",W=K=>({control:`<span class="cart-v2-plan cart-v2-plan--static"><span>${m(K)}</span></span>`,feedback:H});if(l.purchaseKind!=="product_subscription"||t.link_id)return W(k(l));const Z=T(l),re=x(l.sellingPlanId);if(!Z.find(K=>K.sellingPlanId===re))return W(k(l));const fe=g.planAccessible.replace("{product}",String(l.title||g.subscription)),he=Z.map(K=>` 2 <option 3 value="${m(K.sellingPlanId)}" 4 ${K.sellingPlanId===re?"selected":""} 5 >${m(A(K))}</option>`).join(""),_e=` 6 <option value="${Qe}">${m(g.planNone)}</option>`;return{control:` 7 <span class="cart-v2-plan cart-v2-plan--select"> 8 <select 9 class="cart-v2-plan-select" 10 data-cart-action="subscription-plan" 11 data-cart-variant-id="${v}" 12 data-cart-current-selling-plan-id="${m(re)}" 13 aria-label="${m(fe)}" 14 aria-describedby="${B}" 15 >${he}${_e}</select> 16 <img src="/images/cart/chevron-down.svg" alt="" width="10" height="6" /> 17 </span>`,feedback:H}},z=l=>l.handle?`/${`${this.currentLocale.language}-${this.currentLocale.market}`}/products/${encodeURIComponent(l.handle)}`:"#",G=(l,v="cart-v2-line-image")=>{const B=Ue(l);return`<img src="${m(B)}" alt="${m(l.title||"")}" class="${v}" loading="lazy" />`},a=l=>` 18 <button 19 type="button" 20 class="cart-v2-remove" 21 data-cart-action="remove" 22 aria-label="${m(g.remove)}" 23 onclick="window.cart.runCartAction(window.cart.removeItem(${Number(l.variant_id)}, ${Math.max(1,Number(l.quantity)||1)}))" 24 > 25 <img src="/images/cart/trash.svg" alt="" width="14" height="15" /> 26 </button>`,_=({currency:l,discounted:v,percentage:B,firstPurchaseBadge:H,originalUnit:W,unit:Z,note:re})=>` 27 <div class="cart-v2-price-block"> 28 ${v?`<span class="cart-v2-discount" data-badge="discount"${H?" data-cart-first-purchase-badge":""}>${m(`${B}%`)}</span>`:""} 29 <div class="cart-v2-line-prices"> 30 ${v?`<s class="cart-v2-line-original">${this.formatCurrency(W.toFixed(2),l)}</s>`:""} 31 <span class="cart-v2-line-price">${this.formatCurrency(Z.toFixed(2),l)}</span> 32 </div> 33 ${re?`<span class="cart-v2-first-purchase-remaining" ${re.attr}>${m(re.text)}</span>`:""} 34 </div>`,C=l=>{const v=Q(l),B=l.currency||t.currency||this.DEFAULT_CURRENCY;return _({currency:B,discounted:v.discounted,percentage:v.percentage,firstPurchaseBadge:v.firstPurchase,originalUnit:v.originalUnit,unit:v.currentUnit,note:v.hasRemainingUnits?{attr:"data-cart-first-purchase-remaining",text:g.firstPurchaseRemaining.replace("{price}",this.formatCurrency(v.regularUnit.toFixed(2),B))}:null})},y=l=>{if(l.subscriptionEligible!==!0)return"";const v=Number(l.variant_id);if(!Number.isInteger(v)||v<=0)return"";const B=`cart-subscribe-feedback-${v}`;return` 35 <button 36 type="button" 37 class="cart-v2-subscribe-link" 38 data-cart-action="subscribe" 39 data-cart-variant-id="${v}" 40 aria-describedby="${B}" 41 > 42 <span data-cart-subscribe-label>${m(g.subscribe)}</span> 43 <img src="/images/cart/arrow-up-right.svg" alt="" width="7" height="7" /> 44 </button> 45 <p id="${B}" class="cart-v2-subscribe-feedback hidden" role="status" aria-live="polite"></p>`},b=l=>{const v=N(l);return` 46 <article 47 class="cart-v2-line cart-v2-line--subscription cart
47-item" 48 data-cart-line-kind="subscription" 49 data-cart-variant-id="${Number(l.variant_id)}" 50 tabindex="-1" 51 > 52 ${G(l)} 53 <div class="cart-v2-line-body"> 54 <div class="cart-v2-line-heading"> 55 <div class="cart-v2-line-copy"> 56 <a class="cart-v2-line-title" href="${m(z(l))}">${m(l.title||"")}</a> 57 <p class="cart-v2-line-subtitle">${m(V(l,"subscription"))}</p> 58 </div> 59 ${a(l)} 60 </div> 61 <div class="cart-v2-line-controls"> 62 ${v.control} 63 ${C(l)} 64 </div> 65 ${v.feedback} 66 </div> 67 </article>`},U=(l,v={})=>` 68 <article 69 class="cart-v2-line cart-v2-line--one-time cart-item" 70 data-cart-line-kind="one-off" 71 data-cart-variant-id="${Number(l.variant_id)}" 72 tabindex="-1" 73 aria-label="${m(l.title||g.subscription)}" 74 > 75 ${G(l)} 76 <div class="cart-v2-line-body"> 77 <div class="cart-v2-line-heading"> 78 <div class="cart-v2-line-copy"> 79 <a class="cart-v2-line-title" href="${m(z(l))}">${m(l.title||"")}</a> 80 ${V(l,"one-off")?`<p class="cart-v2-line-subtitle">${m(V(l,"one-off"))}</p>`:""} 81 </div> 82 ${a(l)} 83 </div> 84 <div class="cart-v2-line-controls"> 85 <div class="cart-v2-quantity" aria-label="${m(l.title||"")}"> 86 <button 87 type="button" 88 data-cart-action="decrement" 89 aria-label="${m(g.decrease)}" 90 onclick="window.cart.runCartAction(window.cart.subtractItem(${Number(l.variant_id)}, 1))" 91 > 92 <img src="/images/cart/minus.svg" alt="" width="11" height="1" /> 93 </button> 94 <span class="cart-v2-quantity-value quantity-display">${Math.max(1,Number(v.displayQuantity??l.quantity)||1)}</span> 95 <button 96 type="button" 97 data-cart-action="increment" 98 aria-label="${m(g.increase)}" 99 onclick="window.cart.runCartAction(window.cart.addItem(${Number(l.variant_id)}, 1))" 100 > 101 <img src="/images/cart/plus.svg" alt="" width="11" height="11" /> 102 </button> 103 </div> 104 ${v.priceHtml||C(l)} 105 </div> 106 ${y(l)} 107 </div> 108 </article>`,L=(l,v)=>{const B=l.currency||t.currency||this.DEFAULT_CURRENCY,H=V(l,"one-off");return` 109 <article 110 class="cart-v2-line cart-v2-line--one-time cart-v2-line--first-purchase cart-item" 111 data-cart-line-kind="one-off-first-purchase" 112 data-cart-variant-id="${Number(l.variant_id)}" 113 tabindex="-1" 114 aria-label="${m(`${l.title||""} · ${g.firstPurchaseLine}`)}" 115 > 116 ${G(l)} 117 <div class="cart-v2-line-body"> 118 <div class="cart-v2-line-heading"> 119 <div class="cart-v2-line-copy"> 120 <a class="cart-v2-line-title" href="${m(z(l))}">${m(l.title||"")}</a> 121 ${H?`<p class="cart-v2-line-subtitle">${m(H)}</p>`:""} 122 </div> 123 </div>
124 <div class="cart-v2-line-controls"> 125 <div class="cart-v2-quantity cart-v2-quantity--static"> 126 <span class="cart-v2-quantity-value quantity-display">1</span> 127 </div> 128 ${_({currency:B,discounted:v.discounted,percentage:v.percentage,firstPurchaseBadge:!0,originalUnit:v.originalUnit,unit:v.currentUnit,note:{attr:"data-cart-first-purchase-label",text:g.firstPurchaseLine}})} 129 </div> 130 </div> 131 </article>`},R=l=>{const v=Q(l);if(!v.hasRemainingUnits)return U(l);const B=Math.max(1,Number(l.quantity)||1),H=l.currency||t.currency||this.DEFAULT_CURRENCY;return L(l,v)+U(l,{displayQuantity:B-1,priceHtml:_({currency:H,discounted:v.basePercentage>0,percentage:v.basePercentage,firstPurchaseBadge:!1,originalUnit:v.originalUnit,unit:v.regularUnit,note:null})})},$=(l,v=!1)=>{const B=l.currency||t.currency||this.DEFAULT_CURRENCY,H=v?Number(l.price)||0:(Number(l.original_total_price)||Number(l.price)||0)/Math.max(1,Number(l.quantity)||1),W=H>0&&l.sku!=="438";return` 132 <article class="cart-v2-line cart-v2-line--gift cart-item" data-cart-line-kind="gift"> 133 ${G(l)} 134 <div class="cart-v2-gift-copy"> 135 <span class="cart-v2-line-title">${m(l.title||g.gift)}</span> 136 <div class="cart-v2-gift-prices"> 137 ${W?`<s>${this.formatCurrency(H.toFixed(2),B)}</s>`:""} 138 <strong>${m(String(g.free).toLocaleUpperCase(this.currentLocale.language))}</strong> 139 </div> 140 </div> 141 </article>`},I=new Map,S=[],O=[],Y=[];p.forEach(l=>{if(l.from_pack_id){I.has(l.from_pack_id)||I.set(l.from_pack_id,[]),I.get(l.from_pack_id).push(l);return}const v=F(l);v==="gift"?Y.push(l):v==="subscription"?S.push(l):O.push(l)});const te=(l,v)=>{const B=l[0]?.currency||t.currency||this.DEFAULT_CURRENCY,H=l.reduce((K,ae)=>K+(Number(ae.quantity)||0),0),W=l.reduce((K,ae)=>K+(Number(ae.total_price)||0),0),Z=l.reduce((K,ae)=>K+(Number(ae.original_total_price)||0),0),re=l.filter(K=>Number(K.cocunat_discount_new_customer)>0),ge=re.length===0&&Z>W+.005&&Z>0?Math.round((1-W/Z)*100):0,fe=re.length>0?re.map(K=>{const ae=Math.min(100,q(K.cocunat_discount)+q(K.cocunat_discount_new_customer)),je=`${Math.round(ae)}%`;return`${K.title||""}: ${je}`}).join(" · "):"",he=encodeURIComponent(String(v)).replaceAll("'","%27"),_e=l.map(K=>`${Math.max(1,Number(K.quantity)||1)}x ${m(K.title||"")}`).join(" · ");return` 142 <article class="cart-v2-line cart-v2-line--one-time cart-item" data-cart-line-kind="pack"> 143 <img 144 src="https://cdn-static.cocunat.com/Pack-${(this.currentLocale.language||"en").toUpperCase()}.png" 145 alt="${m(g.pack)}" 146 class="cart-v2-line-image" 147 loading="lazy" 148 /> 149 <div class="cart-v2-line-body"> 150 <div class="cart-v2-line-heading"> 151 <div class="cart-v2-line-copy"> 152 <span class="cart-v2-line-title">${m(g.pack)}</span> 153 <p class="cart-v2-line-subtitle">${_e}</p> 154 </div> 155 <button 156 type="button" 157 class="cart-v2-remove" 158 data-cart-action="remove-pack" 159 aria-label="${m(g.remove)}" 160 onclick="window.cart.runCartAction(window.cart.removePack(decodeURIComponent('${he}')))" 161 > 162 <img src="/images/cart/trash.svg" alt="" width="14" height="15" /> 163 </button> 164 </div>
165 <div class="cart-v2-line-controls"> 166 <span class="cart-v2-plan"><span>${H}x</span></span> 167 <div class="cart-v2-price-block"> 168 ${fe?`<span class="cart-v2-first-purchase-remaining" data-cart-pack-first-purchase>${m(fe)}</span>`:ge?`<span class="cart-v2-discount" data-badge="discount">${ge}%</span>`:""} 169 <div class="cart-v2-line-prices"> 170 ${Z>W+.005?`<s class="cart-v2-line-original">${this.formatCurrency(Z.toFixed(2),B)}</s>`:""} 171 <span class="cart-v2-line-price">${this.formatCurrency(W.toFixed(2),B)}</span> 172 </div> 173 </div> 174 </div> 175 </div> 176 </article>`},oe=S.map(b).join(""),ue=[...Array.from(I,([l,v])=>te(v,l)),...O.map(R)].join(""),Ne=Array.isArray(t.gifts)?t.gifts.filter(l=>l.success===!0):[],Me=[...Y.map(l=>$(l,!1)),...Ne.map(l=>$(l,!0))].join("");d&&(d.innerHTML=oe),f&&(f.innerHTML=ue),w&&(w.innerHTML=Me),h?.classList.toggle("hidden",!oe),u?.classList.toggle("hidden",!ue),i?.classList.toggle("hidden",!Me);let pe=p.reduce((l,v)=>{const B=Number(v.original_total_price)||0,H=Number(v.total_price)||0;return l+Math.max(0,B-H)},0);Ne.forEach(l=>{pe+=Number(l.price)||0}),Math.abs(pe-.01)<1e-4&&(pe=0);const Ie=t.currency||p[0]?.currency||this.DEFAULT_CURRENCY,Ae=Number(t.total_price)||0,Be=Number(t.original_total_price),Fe=Number.isFinite(Be)?Be:Ae+pe,ut=this.formatCurrency(Ae.toFixed(2),Ie),Oe=e.querySelector("#total-saved-container"),He=e.querySelector("#total-saved-amount");Oe&&He&&(Oe.classList.toggle("hidden",pe<=0),pe>0&&(He.textContent=this.formatCurrency(pe.toFixed(2),Ie))),[e.querySelector("#cart-summary-subtotal"),e.querySelector("#cart-summary-total"),e.querySelector("#subtotal-price")].forEach(l=>{l&&(l.textContent=ut)});const xe=e.querySelector("#cart-footer-original-price");if(xe){const l=Fe>Ae+.005;xe.classList.toggle("hidden",!l),l&&(xe.textContent=this.formatCurrency(Fe.toFixed(2),Ie))}this.updateUpsellWidget(t)}updateCartUI(t){const e=document.getElementById("cart-drawer");if(!e)return;const r=t?.items?.reduce((a,_)=>a+(_.quantity||0),0)||0,n=t?.total_price||0,o=t?.currency||"USD";e.setAttribute("data-total-items",r),e.setAttribute("data-total-price",n),e.setAttribute("data-currency",o);const s=document.getElementById("cart-badge-number");if(s){const a=t?.items?.reduce((_,C)=>_+(C.quantity||0),0)||0;s.textContent=a,s.classList.toggle("hidden",a===0)}const c=e.querySelector("#cart-drawer-count");c&&(c.textContent=r,c.classList.remove("hidden"));const h=document.getElementById("floating-cart-reminder"),u=document.getElementById("floating-cart-reminder-product-name"),i=document.getElementById("floating-cart-reminder-product-price"),d=document.getElementById("floating-cart-reminder-product-image"),f=document.getElementById("floating-cart-reminder-product-discount"),w=document.getElementById("floating-cart-reminder-view-cart"),P=document.getElementById("floating-cart-reminder-close");if(h){const a=sessionStorage.getItem("cartReminderClosed")==="true",_=this.isCartOpen,C=sessionStorage.getItem("arrivedWithoutCart")==="true",y=sessionStorage.getItem("arrivedWithCart")==="true",b=window.location.pathname.includes("create-your-pack");if(!(t&&t.items&&t.items.length>0&&y&&!C&&!a&&!_&&!b))h.classList.add("translate-y-full","opacity-0");else{const L=t.items[0],R=t.items.length>1,$=document.getElementById("floating-cart-reminder-product-image-wrapper");if(R?($&&$.classList.add("hidden"),u&&u.classList.add("hidden"),i&&i.classList.add("hidden")):($&&$.classList.remove("hidden"),u&&u.classList.remove("hidden"),i&&i.classList.remove("hidden"),d&&L.image&&(d.src=D(L.image,ee.cartReminder),d.alt=L.title||"Product"),u&&(u.textContent=L.title||"Product")),!R&&i){const I=i.querySelectorAll("span"),S=I[0],O=I[1];if(L.original_total_price&&L.total_price&&L.original_total_price>L.total_price){const te=L.original_total_price/L.quantity,oe=L.total_price/L.quantity;S.textContent=this.formatCurrency(te.toFixed(2),t.currency),S.classList.remove("hidden"),O.textContent=this.formatCurrency(oe.toFixed(2),t.currency)}else{const te=L.price||0;S.classList.add("hidden"),O.textContent=this.formatCurrency(te.toFixed(2),t.currency)}if(f&&L.original_total_price&&L.total_price){const te=L.original_total_price,oe=L.total_price;if(te>oe){const ue=Math.round((te-oe)/te*100);f.textContent=`-${ue}%`,f.classList.remove("hidden")}else f.classList.add("hidden")}else f&&f.classList.add("hidden")}w&&!w.hasAttribute("data-listener-added")&&(w.setAttribute("data-listener-added","true"),w.addEventListener("click",I=>{I.preventDefault(),sessionStorage.setItem("cartReminderClosed","true"),this.openCart()})),P&&!P.hasAttribute("data-listener-added")&&(P.setAttribute("data-listener-added","true"),P.addEventListener("click",I=>{I.preventDefault(),h.classList.add("translate-y-full","opacity-0"),sessionStorage.setItem("cartReminderClosed","true")})),setTimeout(()=>{h.classList.remove("translate-y-full","opacity-0");const I=R?"generic_message":"product_detail";try{document.dispatchEvent(new CustomEvent("EventForgetCartShowPopup",{detail:{popup_layout:I}}))}catch{}},100)}}const p=document.getElementById("go-to-checkout-1");if(p&&this.cartId)if(window.__FORCE_STRIPE){const a=this.currentLocale.language,_=this.currentLocale.market;p.href=`/${a}-${_}/checkout`}else{let a=`${se}/checkout/v2/${this.cartId}`;const _=this.getStoredUrlParameters(),C=new URLSearchParams(_),y=t?.last_updated||`${r}-${n}`;C.set("_cart_updated",y);const b=Ge();b&&C.set("cx_exp",b);const U=C.toString();U&&(a+=`?${U}`),p.href=a}const E=document.getElementById("purchase-options");
176if(E){const a=(t?.items||[]).some(_=>_.sellingPlanId);E.classList.toggle("hidden",a),E.classList.toggle("block",!a)}if(e.querySelector("[data-cart-items]")){this.updateCartV2UI(t,e);return}const g=e.querySelector("ul"),m=e.querySelector("#empty-cart-message"),x=e.querySelector("#cart-progress-container"),T=e.querySelector("#cart-drawer-footer");if(!t||!t.items||t.items.length===0){this._progressRenderVersion=(this._progressRenderVersion||0)+1,m.classList.remove("hidden"),g.classList.add("hidden"),x.classList.add("hidden"),T.classList.add("hidden"),this.updateUpsellWidget(null);return}this.updateGiftProgressBar(t,e),m.classList.add("hidden"),g.classList.remove("hidden"),x.classList.remove("hidden"),T.classList.remove("hidden");const M=new Map,A=[],q=this;t.items.forEach(a=>{a.from_pack_id?(M.has(a.from_pack_id)||M.set(a.from_pack_id,[]),M.get(a.from_pack_id).push(a)):A.push(a)});const Q=[{minQty:4,discount:.2},{minQty:3,discount:.1},{minQty:2,discount:.05}];let F="";M.forEach((a,_)=>{const C=a.reduce((I,S)=>I+(S.total_price||0),0),y=a.reduce((I,S)=>I+(S.original_total_price||0),0),b=a[0]?.currency||t.currency||"EUR",U=a.reduce((I,S)=>I+S.quantity,0),L=Q.find(I=>U>=I.minQty),R=a.map(I=>`<div class="text-sm text-gray-600 truncate">${I.quantity}x ${I.title}</div>`).join("");a.map(I=>I.variant_id);const $=C!==y?`<s class="text-[#969592] line-through">${q.formatCurrency(y.toFixed(2),b)}</s> 177 <span class="text-red-500">${q.formatCurrency(C.toFixed(2),b)}</span> 178 ${L?`<span class="ml-1 inline-block bg-red-100 text-red-600 text-xs font-semibold px-1.5 py-0.5 rounded">-${Math.round(L.discount*100)}%</span>`:""}`:`<span class="text-black">${q.formatCurrency(C.toFixed(2),b)}</span>`;F+=` 179 <li class="flex items-start py-6 cart-item"> 180 <div class="h-24 w-24 shrink-0 overflow-hidden rounded-md border border-gray-200"> 181 <img src="https://cdn-static.cocunat.com/Pack-${(q.currentLocale.language||"en").toUpperCase()}.png" alt="Tu Pack" class="h-full w-full object-cover" /> 182 </div> 183 <div class="ml-4 flex flex-1 flex-col min-w-0"> 184 <div class="min-w-0"> 185 <div class="flex justify-between text-base font-medium text-gray-900 min-w-0"> 186 <h3 class="flex-1" style="min-width:180px;max-width:100%;overflow:hidden"> 187 <span class="leading-tight">Tu Pack</span> 188 <div class="mt-1 mb-2">${R}</div> 189 </h3> 190 <div class="ml-4 sm:w-24 text-right"> 191 ${$} 192 </div> 193 </div> 194 </div> 195 <div class="flex flex-1 items-end justify-end text-sm"> 196 <button type="button" class="font-medium text-gray-400 hover:text-gray-500" 197 onclick="window.cart.runCartAction(window.cart.removePack('${_}'))"> 198 <svg class="h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"> 199 <path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /> 200 </svg> 201 </button> 202 </div> 203 </div> 204 </li>`});const V=A.map(a=>{const _=!!a.sellingPlanId,C=a.cocunat_discount===100,y=a.sellingPlanId===`gid://shopify/SellingPlan/${window.__CLUB_SELLING_PLAN_ID||"1363837093"}`;let b=a.total_price,U=a.original_total_price;if(y)try{b=Le[t.market].club[a.sellingPlanName].amount}catch{}let L="CLUB";return a.sellingPlanName==="single"&&(L="SUBSCRIPTION"),` 205 <li class="flex items-center py-6 cart-item"> 206 <div class="h-24 w-24 shrink-0 overflow-hidden rounded-md border border-gray-200"> 207 <img src="${Ue(a,"https://placehold.co/96x96/png?text=No+image")}" 208 alt="${a.title}" 209 class="h-full w-full object-cover" /> 210 </div> 211 <div class="ml-4 flex flex-1 flex-col"> 212 <div> 213 <div class="flex justify-between text-base font-medium text-gray-900"> 214 <h3 class="w-full"> 215 <a href="/products/${a.handle}" class="leading-tight">${a.title}</a> 216 ${_?`<span class="ml-2 px-2 py-1 text-xs bg-black text-white rounded">${L}</span>`:""} 217 ${C?"":` 218 <p class="mt-1 mb-2 text-sm">
219 <span>${y?q.formatCurrency(b.toFixed(2),a.currency):q.formatCurrency((b/a.quantity).toFixed(2),a.currency)}</span> 220 ${b!==U?`<s class="text-[#a3a3a3] line-through">${y?q.formatCurrency(U.toFixed(2),a.currency):q.formatCurrency((U/a.quantity).toFixed(2),a.currency)}</s>`:""} 221 </p> 222 `} 223 </h3> 224 <div class="ml-4 sm:w-24 text-right"> 225 ${b!==U?`<s class="text-[#969592] line-through">${q.formatCurrency(U.toFixed(2),a.currency)}</s>`:""} 226 ${C?`<span>${ve[q.currentLocale.language]||"FREE"}</span>`:`<span class="${b!==U?"text-red-500":"text-black"}">${q.formatCurrency(b.toFixed(2),a.currency)}</span>`} 227 </div> 228 </div> 229 <p class="mt-1 text-sm text-gray-500">${a.variant_title||""}</p> 230 </div> 231 <div class="flex flex-1 items-end justify-between text-sm"> 232 <div class="flex items-center gap-2"> 233 ${C?`<span class="text-xs text-gray-500">x${a.quantity}</span>`:_?`<span class="text-xs text-gray-500">${q.currentLocale.language==="es"?"Suscripción":q.currentLocale.language==="fr"||q.currentLocale.language==="de"?"Abonnement":q.currentLocale.language==="it"?"Abbonamento":"Subscription"}</span>`:` 234 <button type="button" 235 class="w-6 h-6 flex items-center justify-center border rounded hover:bg-gray-100" 236 onclick="window.cart.runCartAction(window.cart.subtractItem(${a.variant_id}, 1))"> 237 - 238 </button> 239 <span class="quantity-display w-4 text-center">${a.quantity}</span> 240 <button type="button" 241 class="w-6 h-6 flex items-center justify-center border rounded hover:bg-gray-100" 242 onclick="window.cart.runCartAction(window.cart.addItem(${a.variant_id}, 1))"> 243 + 244 </button> 245 `} 246 </div> 247 <div class="flex"> 248 ${C?"":` 249 <button type="button" 250 class="font-medium text-gray-400 hover:text-gray-500" 251 onclick="window.cart.runCartAction(window.cart.removeItem(${a.variant_id}, ${a.quantity}))"> 252 <svg class="h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"> 253 <path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /> 254 </svg> 255 </button> 256 `} 257 </div> 258 </div> 259 </div> 260 </li>`}).join("");g.innerHTML=F+V;try{if(t?.gifts&&t?.gifts?.length>0){const a=t.gifts.filter(_=>_.success===!0).map(_=>` 261 <li class="flex items-center py-6 cart-item"> 262 <div class="h-24 w-24 shrink-0 overflow-hidden rounded-md border border-gray-200"> 263 <img src="${Ue(_,"https://placehold.co/96x96/png?text=No+image")}" 264 alt="${_.title}" 265 class="h-full w-full object-cover" /> 266 </div> 267 <div class="ml-4 flex flex-1 flex-col"> 268 <div> 269 <div class="flex justify-between text-base font-medium text-gray-900"> 270 <h3 class="w-full">
271 <span class="leading-tight">${_.title}</span> 272 </h3> 273 <div class="ml-4 sm:w-24 text-right"> 274 <s class="text-gray-500 line-through" ${_.sku==="438"?'style="display: none;"':""}>${this.formatCurrency(_.price.toFixed(2),_.currency)}</s> 275 <span>${ve[this.currentLocale.language]||"FREE"}</span> 276 </div> 277 </div> 278 <p class="mt-1 text-sm text-gray-500">${_.variant_title||""}</p> 279 </div> 280 <div class="flex flex-1 items-end justify-between text-sm"> 281 <div class="flex"> 282 283 </div> 284 </div> 285 </div> 286 </li> 287 `).join("");g.innerHTML+=a}}catch{}let k=0;t&&t.items&&t.items.forEach(a=>{a.original_total_price&&a.total_price&&a.original_total_price>a.total_price&&(k+=a.original_total_price-a.total_price)}),t?.gifts&&t?.gifts?.length>0&&t.gifts.filter(a=>a.success===!0).forEach(a=>{a.price&&(k+=a.price)});const N=e.querySelector("#total-saved-container"),z=e.querySelector("#total-saved-amount");N&&z&&(k===.01&&(k=0),k>0?(z.textContent=this.formatCurrency(k.toFixed(2),t.currency),N.classList.remove("hidden")):N.classList.add("hidden"));const G=e.querySelector("#subtotal-price");G&&t.total_price&&(G.textContent=this.formatCurrency(t.total_price,t.currency)),this.updateDeliveryDate(),this.updateUpsellWidget(t)}initializeCartUI(){document.addEventListener("pointerdown",()=>{this._cartLastInputWasPointer=!0},!0),document.addEventListener("keydown",()=>{this._cartLastInputWasPointer=!1},!0);const t=document.getElementById("cart-button");t&&t.addEventListener("click",async()=>{this.runCartAction(this.refreshCart()),this.dispatchCartEvent("openCartDrawer",null),this.initializeBenefitsCarousel()});const e=document.getElementById("cart-drawer");if(e){const r=e.querySelector("#close-cart-drawer");r&&r.addEventListener("click",()=>this.closeCart());const n=e.querySelector("[data-cart-empty-cta]");n&&n.addEventListener("click",()=>{const o=n.dataset.cartEmptyCtaHref;this.closeCart(),o&&window.location.assign(o)}),e.addEventListener("click",async o=>{if(!(o.target instanceof Element))return;const s=o.target.closest('[data-cart-action="subscribe"]');if(!(s instanceof HTMLButtonElement)||s.disabled||s.dataset.cartBusy==="true")return;const c=Number(s.dataset.cartVariantId),h=s.querySelector("[data-cart-subscribe-label]"),u=s.nextElementSibling instanceof HTMLElement?s.nextElementSibling:null,i=e.querySelector("[data-cart-subscription-status]"),d=h?.textContent||e.dataset.labelSubscribe||"Subscribe and save";s.disabled=!0,s.dataset.cartBusy="true",s.setAttribute("aria-busy","true"),h&&(h.textContent=e.dataset.labelSubscribing||"Switching to subscription..."),i&&(i.textContent=e.dataset.labelSubscribing||"Switching to subscription..."),u&&(u.textContent="",u.classList.add("hidden"),u.setAttribute("role","status"),u.setAttribute("aria-live","polite"));try{await this.convertItemToSubscription(c),i&&(i.textContent=e.dataset.labelSubscribeSuccess||"This product is now a subscription.");const f=e.querySelector(`[data-cart-line-kind="subscription"][data-cart-variant-id="${c}"]`);f instanceof HTMLElement&&f.focus({preventScroll:!0})}catch{i&&(i.textContent=""),u&&(u.textContent=e.dataset.labelSubscribeError||"We could not switch this product to a subscription. Please try again.",u.classList.remove("hidden"),u.setAttribute("role","alert"),u.setAttribute("aria-live","assertive"))}finally{s.isConnected&&(s.disabled=!1,delete s.dataset.cartBusy,s.removeAttribute("aria-busy"),h&&(h.textContent=d))}}),e.addEventListener("change",async o=>{const s=o.target;if(!(s instanceof HTMLSelectElement)||s.dataset.cartAction!=="subscription-plan"||s.disabled||s.dataset.cartBusy==="true")return;const c=Number(s.dataset.cartVariantId),h=s.dataset.cartCurrentSellingPlanId||"",u=s.value;if(u===h)return;const i=u===Qe,d=s.closest('[data-cart-line-kind="subscription"]'),f=d?.querySelector(".cart-v2-subscription-plan-feedback"),w=e.querySelector("[data-cart-subscription-status]"),P=i?e.dataset.labelSubscriptionRemovalError||"We could not remove the subscription. Please try again.":e.dataset.labelSubscriptionPlanError||"We could not update the subscription plan. Please try again.",p=()=>e.querySelector(`[data-cart-line-kind="subscription"][data-cart-variant-id="${c}"]`),E=()=>e.querySelector(`[data-cart-line-kind="one-off"][data-cart-variant-id="${c}"]`),g=(T,M=P)=>{const A=T?.querySelector(".cart-v2-subscription-plan-feedback");A?(A.setAttribute("role","alert"),A.setAttribute("aria-live","assertive"),A.textContent=M,A.classList.remove("hidden")):w&&(w.textContent=M)},m=(T,M="")=>{const A=Array.from(T?.querySelectorAll('[data-cart-action="subscription-plan"]')||[]),Q=A.find(F=>F.dataset.cartCurrentSellingPlanId===M)||A[0]||T;Q instanceof HTMLElement&&Q.focus({preventScroll:!0})};s.disabled=!0,s.dataset.cartBusy="true",s.setAttribute("aria-busy","true"),w&&(w.textContent=i?e.dataset.labelSubscriptionRemoving||"Removing subscription...":e.dataset.labelSubscriptionPlanUpdating||"Updating subscription plan..."),f&&(f.textContent="",f.classList.add("hidden"),f.setAttribute("role","status"),f.setAttribute("aria-live","polite"));let x=!1;try{const T=i?await this.removeItemSubscription(c):await this.changeItemSubscriptionPlan(c,u);
287if(!(i?T.requestedOneOffApplied:T.requestedPlanApplied)){w&&(w.textContent="");const A=p();g(A),m(A);return}if(w&&(w.textContent=i?e.dataset.labelSubscriptionRemovalSuccess||"This product will now be purchased without a subscription.":e.dataset.labelSubscriptionPlanUpdated||"Subscription plan updated."),i){const A=E();A instanceof HTMLElement&&A.focus({preventScroll:!0})}else m(p(),u)}catch(T){w&&(w.textContent="");const M=T?.subscriptionPlanStateUnknown===!0;s.isConnected&&(s.value=h,x=!0);const A=i&&M?e.dataset.labelSubscriptionRemovalUnknown||"We could not confirm whether the subscription was removed. Please try again.":P;g(d?.isConnected?d:p(),A)}finally{s.isConnected&&(s.disabled=!1,delete s.dataset.cartBusy,s.removeAttribute("aria-busy"),x&&s.focus({preventScroll:!0}))}}),document.addEventListener("keydown",o=>{if(!this.isCartOpen)return;if(o.key==="Escape"){o.preventDefault(),this.closeCart();return}if(o.key!=="Tab")return;e.querySelector("#close-cart-drawer")?.removeAttribute("data-cart-pointer-autofocus");const s=Array.from(e.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(i=>i instanceof HTMLElement&&i.getClientRects().length>0&&!i.closest(".hidden"));if(s.length===0)return;const c=s[0],h=s[s.length-1],u=document.activeElement;o.shiftKey&&(u===c||!e.contains(u))?(o.preventDefault(),h.focus()):!o.shiftKey&&(u===h||!e.contains(u))&&(o.preventDefault(),c.focus())}),e.addEventListener("click",o=>{o.target instanceof Element&&(o.target.closest("[data-cart-panel]")||this.closeCart())})}window.addEventListener("openCartDrawer",async r=>{this.openCart(),this.initializeBenefitsCarousel();try{let n=r.detail||await this.getCart();n&&Object.keys(n).length<=2&&(n=await this.getCart());const o=n||{items:[],total_price:0,currency:this.DEFAULT_CURRENCY};this.updateCartUI(o);const s=new URL(window.location.href);document.dispatchEvent(new CustomEvent("EventViewCart",{detail:{market:s.pathname.split("/")[1].replace("/",""),url:window.location.href,cartData:o}}))}catch{}}),window.addEventListener("cartUpdated",async r=>{try{const n=r.detail||await this.getCart();this.updateCartUI(n||{items:[],total_price:0,currency:this.DEFAULT_CURRENCY})}catch{}}),this.getCart().then(r=>{if(r)this.updateCartUI(r);else{this.updateCartUI({items:[],total_price:0,currency:this.DEFAULT_CURRENCY});const n=document.getElementById("purchase-options");n&&(n.classList.add("block"),n.classList.remove("hidden"))}this.updateDeliveryDate()}).catch(r=>{this.updateDeliveryDate()})}updateCartMarket(t,e,r=""){return this.enqueueCartMutation(()=>this._updateCartMarket(t,e,r))}async _updateCartMarket(t,e,r=""){try{if(!t||this.cartId!==t)return await this.getCart();const n=this.getStoredPromoCode(),o=t,s=await fetch(`${this.API_BASE_URL}/${t}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({market:e,promo_codes:n||"",...r?{language:r}:{}})}),c=await s.json().catch(()=>null);return this.cartId!==o?await this.getCart():this.isImmutablePromotionLinkConflict(s,c)?await this.getCart():(this.requireUsableCartMutationResponse(s,c,"update market",o),this.updateCartUI(c),this.triggerCheckoutCache(),c)}catch(n){throw n}}async refreshCart({dispatchUpdated:t=!1}={}){try{this.showCartLoading();const e=await this.getCart();return e&&(this.updateCartUI(e),t&&this.dispatchCartEvent("cartUpdated",e)),e}catch(e){throw e}finally{this.hideCartLoading()}}calculateDeliveryDate(){const t=new Date;let e=0,r=new Date(t);for(;e<4;){r.setDate(r.getDate()+1);const u=r.getDay();u!==0&&u!==6&&e++}const n=new Date(r),o=new Date(r);o.setDate(o.getDate()+2),o.getDay()===0?o.setDate(o.getDate()+1):o.getDay()===6&&o.setDate(o.getDate()+2);const s={month:"short",day:"numeric"},c=n.toLocaleDateString(this.getCurrentLanguage()==="es"?"es-ES":this.getCurrentLanguage()==="fr"?"fr-FR":this.getCurrentLanguage()==="de"?"de-DE":this.getCurrentLanguage()==="it"?"it-IT":"en-US",s),h=o.toLocaleDateString(this.getCurrentLanguage()==="es"?"es-ES":this.getCurrentLanguage()==="fr"?"fr-FR":this.getCurrentLanguage()==="de"?"de-DE":this.getCurrentLanguage()==="it"?"it-IT":"en-US",{day:"numeric"});return`${c}â${h}`}updateDeliveryDate(){const t=document.getElementById("delivery-date");t&&(t.textContent=this.calculateDeliveryDate())}async getActivePromoData(){try{const t=this.getStoredPromoCode();if(!t)return null;if(this._promoCacheByCode=this._promoCacheByCode||{},Object.prototype.hasOwnProperty.call(this._promoCacheByCode,t))return this._promoCacheByCode[t];const e=await fetch(`${se}/api/promos/${t}`),r=e.ok?await e.json():null;return this._promoCacheByCode[t]=r,r}catch{return null}}async getSubscriberDiscountPercentage(){return At(se)}resolveStorefrontDiscount(t,e,r){return Pt({promotion:t,sku:e,subscriberPercentage:r})}setFirstPurchase(t,e){const r=String(t??"");if(!r)return;const n=e?{percent:Math.max(0,Number(e.percent)||0),basePercent:Math.max(0,Number(e.basePercent)||0),basePrice:Math.max(0,Number(e.basePrice)||0),labels:{pair:String(e.labels?.pair||"")}}:null;if(n&&!(n.percent>0))return this.setFirstPurchase(r,null);const o=this._firstPurchaseBySku[r]||null;JSON.stringify(o)!==JSON.stringify(n)&&(n?this._firstPurchaseBySku[r]=n:delete this._firstPurchaseBySku[r],this.applyToPricesUI())}getFirstPurchaseFor(t){return this._firstPurchaseBySku[String(t??"")]||null}async syncListingFirstPurchase(){if(this._firstPurchaseBatchInFlight){this._firstPurchaseBatchQueued=!0;return}this._firstPurchaseBatchInFlight=!0;const t=this._firstPurchaseIdentityGeneration||0;let e=!1;try{const r=(this.currentLocale?.market||"").toLowerCase();if(r==="mx"||!(await it(se)).authenticated)return;const o=this.getStoredPromoCode();if(!o)return;const s=this._firstPurchaseQueriedSkus=this._firstPurchaseQueriedSkus||new Set,c=new Set,h=new Set,u=[];document.querySelectorAll(".price[data-sku]").forEach(d=>{const f=d.getAttribute("data-sku");if(f){if(d.closest(we)){c.add(f);return}h.has(f)||s.has(f)||this.getFirstPurchaseFor(f)||(h.add(f),u.push(f))}});const i=u.filter(d=>!c.has(d));for(let d=0;d<i.length;d+=60){const f=i.slice(d,d+60),w=await fetch(`${se}/api/new-customer/eligibility-batch`,{method:"POST",credentials:"include",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify({skus:f,promo_code:o,...r?{market:r}:{}})});if(t!==(this._firstPurchaseIdentityGeneration||0))return;if(!w.ok)continue;const P=await w.json();if(t!==(this._firstPurchaseIdentityGeneration||0))return;f.forEach(p=>s.add(p));for(const[p,E]of Object.entries(P||{})){if(this.getFirstPurchaseFor(p))continue;const g=Number(E?.first_purchase_percentage)||0;g>0&&(this._firstPurchaseBySku[String(p)]={percent:g,basePercent:Math.max(0,Number(E?.base_percentage)||0),basePrice:0,labels:{pair:""}},e=!0)}}}catch{}finally{this._firstPurchaseBatchInFlight=!1;const r=!this._firstPurchaseListingSettled;this._firstPurchaseListingSettled=!0,e?this.applyToPricesUI():r&&window.dispatchEvent(new CustomEvent("PricesAppliedUI",{detail:{listingsSettled:!0}})),this._firstPurchaseBatchQueued&&(this._firstPurchaseBatchQueued=!1,this.syncListingFirstPurchase())}}isListingFirstPurchaseSettled(){return!!this._firstPurchaseListingSettled}resolveStorefrontListingDiscount(t,e,r){const n=this.getFirstPurchaseFor(e);return n?ke({basePrice:100,promoPercent:n.basePercent,subscriberPercent:r,firstPurchasePercent:n.percent}).effectivePercent:this.resolveStorefrontDiscount(t,e,r)}syncStickyCtaPercent(t,e){const r=document.querySelector("[data-pdp3-sticky-cta]");if(!r)return;const n=r.getAttribute("data-sticky-save-template")||"";if(!n.includes("{percent}"))return;const o=r.querySelector(".add-to-cart.main-product-atc");if((o?.getAttribute("data-purchase-option")||"one-time")!=="one-time")return;const c=r.querySelector(".sticky-cta-text");if(!c)return;const h=o?.getAttribute("data-sku")||r.querySelector(".sticky-cta-price")?.getAttribute("data-sku")||"";if(!h)return;const u=this.resolveStorefrontListingDiscount(t,h,e);c.textContent=u>0?n.replace("{percent}",String(u)):r.getAttribute("data-sticky-default-text")||c.textContent}getSubscriberBadgeLabel(){if(this._subscriberBadgeLabel!==void 0)return this._subscriberBadgeLabel;let t="";try{const e=document.querySelector("[data-price-breakdown-config]"),r=e?JSON.parse(e.dataset.texts||"{}"):{};t=String(r.subscriber_badge||"")}catch{t=""}return this._subscriberBadgeLabel=t,t}applyPairBadge(t,e,r,n){const o=t.querySelector("[data-first-purchase-pair-badge]");if(!o)return;const s=o.querySelector("[data-first-purchase-pair-label]"),c=o.querySelector("[data-first-purchase-pair-percent]"),h=e.pairLabel==="first_purchase"?String(r?.pair||""):e.pairLabel==="subscriber"?String(r?.subscriber||""):"";s&&(s.textContent=h,s.classList.toggle("hidden",!h)),c&&(c.textContent=e.pairBadge,c.style.marginLeft=h?"":"0"),o.classList.remove("hidden"),o.classList.add("flex"),n&&n.add(o),t.querySelectorAll(Je).forEach(u=>{u.style.display="none"})}async updateGiftProgressBar(t,e){const r=(this._progressRenderVersion||0)+1;this._progressRenderVersion=r;try{const n=e.querySelector("[data-cart-progress-container]"),o=e.querySelector("[data-cart-progress-bar]"),s=e.querySelector("[data-cart-progress-message]"),c=e.querySelector("[data-gift-markers]"),h=e.querySelector("[data-cart-threshold]");if(!n||!o||!s)return;const u=t?.currency||"EUR",i=Math.max(0,Number(t?.total_price)||0),d=await this.getActivePromoData();if(r!==this._progressRenderVersion)return;const f=k=>{if(typeof k=="number")return Number.isFinite(k)?k:0;const N=String(k??"").replace(/[^0-9.,-]/g,"");if(!N)return 0;const z=N.lastIndexOf(","),G=N.lastIndexOf("."),a=Math.max(z,G);if(a===-1)return Number(N)||0;const _=N[a],C=N.split(_).length-1,y=N.length-a-1;if(!(_===","?N.includes("."):N.includes(","))&&y===3&&C>=1)return Number(N.replace(/[.,]/g,""))||0;const L=`${N.slice(0,a).replace(/[.,]/g,"")}.`+N.slice(a+1).replace(/[.,]/g,"");return Number(L)||0},w=window.tiers||{},P=d&&d.gifts||[],p=Array.isArray(t?.gifts)?t.gifts:[],E=P.map((k,N)=>{const z=p.find(G=>G.variant_id!=null&&k.variant_id!=null&&String(G.variant_id)===String(k.variant_id)||G.threshold&&k.tier&&G.threshold===k.tier);return{kind:"gift",gift:k,giftIndex:N+1,threshold:f(w[k.tier]?.[u]),earned:typeof z?.success=="boolean"?z.success:null}}).filter(k=>k.threshold>0).sort((k,N)=>k.threshold-N.threshold),g=f(window.marketData?.ui?.freeShippingThreshold),m=[...g>0?[{kind:"shipping",threshold:g}]:[],...E].sort((k,N)=>k.threshold-N.threshold);if(m.length===0){n.classList.add("hidden"),n.classList.remove("success","partial-success"),c&&(c.innerHTML="");return}const x=m[m.length-1].threshold,T=k=>k.kind==="gift"&&typeof k.earned=="boolean"?k.earned:i>=k.threshold,M=100/m.length,A=m.findIndex(k=>i<k.threshold);let q=100;if(A!==-1){const k=A===0?0:m[A-1].threshold,z=m[A].threshold-k,G=z>0?Math.min(Math.max((i-k)/z,0),1):0;q=(A+G)*M}const Q=k=>Math.round(Math.min(Math.max(k,0),100)*1e4)/1e4;o.style.width=`${Q(q)}%`,c&&(c.innerHTML=m.map((k,N)=>
287{const z=Q((N+1)*M),G=T(k)?" completed":"",a=k.kind==="shipping"?"shipping.svg":"gift.svg",_=k.kind==="gift"?`gift-${k.giftIndex}`:"shipping";return` 288 <span 289 class="gift-marker${G}" 290 style="left: ${z}%" 291 data-tier="${_}" 292 data-milestone-index="${N+1}" 293 > 294 <img src="/images/cart/${a}" alt="" width="14" height="14" /> 295 <span class="gift-marker-label">${this.formatCurrency(k.threshold.toFixed(2),u)}</span> 296 </span>`}).join("")),n.classList.remove("success","partial-success");const F=m.find(k=>!T(k));if(F){let k=Math.max(0,F.threshold-i);F.kind==="gift"&&F.earned===!1&&k===0&&(k=u==="MXN"?1:.01);const N=E.filter(T).length,z=F.kind==="shipping"?s.getAttribute("data-progress-shipping")||s.getAttribute("data-progress-message")||"Add {amount} to get free shipping":N>0?s.getAttribute("data-progress-next-gift")||s.getAttribute("data-progress-message-2")||s.getAttribute("data-progress-message"):s.getAttribute("data-progress-first-gift")||s.getAttribute("data-progress-message");s.textContent=(z||"Add {amount} to unlock your next reward").replace("{amount}",this.formatCurrency(k.toFixed(2),u))}else{const k=m[m.length-1];s.textContent=k.kind==="gift"?s.getAttribute("data-gift-success")||s.getAttribute("data-success-message")||"Gift unlocked":s.getAttribute("data-shipping-success")||s.getAttribute("data-success-message")||"Free shipping unlocked",n.classList.add("success")}h&&(h.textContent=this.formatCurrency(x,u));const V=e.querySelector("#cart-shipping-price");if(V){const k=e.dataset.labelFree||ve[this.currentLocale.language]||"Free",N=g>0&&i>=g;V.dataset.shippingState=N?"free":"pending",V.textContent=N?k:V.dataset.pendingLabel||""}n.classList.remove("hidden")}catch{}}async updateUpsellWidget(t){const e=document.getElementById("cart-upsell-section"),r=e?.querySelector("[data-cart-upsell-track]"),n=document.getElementById("cart-upsell-card-template"),o=(this._upsellRenderVersion||0)+1;this._upsellRenderVersion=o;const s=()=>{r?.replaceChildren(),r?.removeAttribute("aria-busy"),e?.classList.add("hidden")};if(!t?.uuid||!r||!n?.content){s();return}r.querySelectorAll("[data-cart-upsell-add]").forEach(c=>{c.disabled=!0,c.setAttribute("aria-busy","true")}),r.setAttribute("aria-busy","true");try{const c=await this.getUpsellProductsForCart(t);if(o!==this._upsellRenderVersion)return;r.replaceChildren();const h=r.getAttribute("data-add-to-cart-text")||"Add to cart";let u=0;c.forEach(i=>{const d=n.content.cloneNode(!0),f=d.querySelector("[data-cart-upsell-card]"),w=d.querySelector("[data-cart-upsell-image]"),P=d.querySelector("[data-cart-upsell-title]"),p=d.querySelector("[data-cart-upsell-subtitle]"),E=d.querySelector("[data-cart-upsell-price]"),g=d.querySelector("[data-cart-upsell-original]"),m=d.querySelector("[data-cart-upsell-add]"),x=d.querySelector(".cart-v2-upsell-button-label");if(!f||!w||!P||!E||!m)return;f.dataset.sku=i.sku,f.dataset.variantId=String(i.variant_id),w.src=D(i.image,ee.cartUpsell),w.alt=i.title,P.textContent=i.title,p&&(p.textContent=i.subtitle,p.classList.toggle("hidden",!i.subtitle));const T=t.currency||i.currency,M=Number(i.price??i.total_price)||0,A=Number(i.original_total_price)||0;E.textContent=this.formatCurrency(M.toFixed(2),T),g&&A>M&&(g.textContent=this.formatCurrency(A.toFixed(2),T),g.classList.remove("hidden"));const q=`${h}: ${i.title}`;m.setAttribute("aria-label",q),x&&(x.textContent=q),m.addEventListener("click",async()=>{m.disabled=!0,m.classList.add("is-loading"),m.setAttribute("aria-busy","true");try{await this.addItem(i.variant_id,1)}catch{m.isConnected&&(m.disabled=!1,m.classList.remove("is-loading"),m.removeAttribute("aria-busy"))}}),r.append(d),u+=1}),e?.classList.toggle("hidden",u===0)}catch{o===this._upsellRenderVersion&&s()}finally{o===this._upsellRenderVersion&&r.removeAttribute("aria-busy")}}initializeBenefitsCarousel(){const t=document.getElementById("benefits-carousel"),e=document.querySelectorAll(".benefit-dot"),r=document.getElementById("carousel-prev"),n=document.getElementById("carousel-next");if(!t||e.length===0)return;let o=0;const s=3;this.benefitsCarouselInterval&&clearInterval(this.benefitsCarouselInterval);const c=u=>{t.style.transform=`translateX(-${u*100}%)`,e.forEach((i,d)=>{i.classList.toggle("bg-gray-400",d===u),i.classList.toggle("bg-gray-300",d!==u)})},h=()=>{this.benefitsCarouselInterval&&clearInterval(this.benefitsCarouselInterval),this.benefitsCarouselInterval=setInterval(()=>{o=(o+1)%s,c(o)},2e3)};h(),r&&r.addEventListener("click",()=>{o=(o-1+s)%s,c(o),h()}),n&&n.addEventListener("click",()=>{o=(o+1)%s,c(o),h()}),e.forEach((u,i)=>{u.addEventListener("click",()=>{o=i,c(o),h()})})}async applySkinUI(){const t=this.getStoredPromoCode();try{await window.applySkinUI?.(t,this.currentLocale.language,this.currentLocale.market)}catch{}const r=await(await fetch(`${se}/api/promos/${t}`)).json();if(r?.skin){const o=this.parseLocaleFromUrl().language,s=r.skin,c=xt[s];
296c?.ui?.[o]&&c.ui[o].forEach(u=>{if(u.type==="text"){const i=document.getElementById(u.id);i&&(i.textContent=u.content)}if(u.type==="link"){const i=document.getElementById(u.id);if(i){const d=u.url.startsWith("/")?u.url:"/"+u.url;i.href=d}}if(u.type==="image"){const i=document.getElementById(u.id);i&&(i.src=u.url)}})}}readImmutableRetailPrice(t){const e=Number.parseFloat(t.getAttribute("data-original-price")||"");if(Number.isFinite(e))return e;if(t.children.length>0){const n=t.children.length===1?t.firstElementChild:null,o=Array.from(t.childNodes).some(s=>s.nodeType===Node.TEXT_NODE&&!!s.textContent?.trim());if(!n||n.children.length>0||o)return null}const r=Number.parseFloat(t.textContent.replace(/[^0-9.,]/g,"").replace(",","."));return Number.isFinite(r)?r:null}async applyToPricesUI(){const t=++this._priceRenderGeneration;try{let e=await this.getCart();if(t!==this._priceRenderGeneration)return;const[r,n]=await Promise.all([this.getActivePromoData(),this.getSubscriberDiscountPercentage()]);if(t!==this._priceRenderGeneration||(e=await this.checkMarketSync(e),t!==this._priceRenderGeneration))return;let o=e?.currency;if(!o){const p=this.currentLocale.market.toLowerCase();o=Le[p]?.currency||this.DEFAULT_CURRENCY}const s=new Set;document.querySelectorAll(".price").forEach(p=>{if(p.hasAttribute("data-product-subscription-price"))return;const E=p.getAttribute("data-sku");if(!E)return;const g=this.getFirstPurchaseFor(E),m=this.readImmutableRetailPrice(p)??(g&&g.basePrice>0?g.basePrice:null);if(m===null)return;const x=g?p.closest(we):null;if(p.setAttribute("data-original-price",m.toFixed(2)),p.setAttribute("data-currency",o),p.setAttribute("data-subscriber-discount",String(n)),g&&!x){const A=ke({basePrice:m,promoPercent:g.basePercent,subscriberPercent:n,firstPurchasePercent:g.percent});p.setAttribute("data-final-price",A.finalPrice.toFixed(2)),A.effectivePercent>0?p.innerHTML=` 297 <span class="text-[#FF0000]">${this.formatCurrency(A.finalPrice.toFixed(2),o||this.DEFAULT_CURRENCY)}</span> 298 <s class="text-[#969592] line-through ml-2">${this.formatCurrency(m.toFixed(2),o||this.DEFAULT_CURRENCY)}</s> 299 `:p.textContent=this.formatCurrency(m.toFixed(2),o||this.DEFAULT_CURRENCY);return}if(g&&x){const A=ke({basePrice:m,promoPercent:g.basePercent,subscriberPercent:n,firstPurchasePercent:g.percent});p.setAttribute("data-final-price",A.finalPrice.toFixed(2));const q=this.formatCurrency(m.toFixed(2),o||this.DEFAULT_CURRENCY),Q=this.formatCurrency(A.finalPrice.toFixed(2),o||this.DEFAULT_CURRENCY);if(p.textContent="",p.hasAttribute("data-cbf-one-time-price")){const F=document.createElement("span");F.textContent=Q;const V=document.createElement("s");V.textContent=q,p.append(F,V)}else{const F=document.createElement("span");F.style.textDecoration="line-through",F.style.opacity="0.6",F.style.marginRight="6px",F.textContent=q,p.append(F,document.createTextNode(Q))}this.applyPairBadge(x,A,{pair:g.labels.pair,subscriber:this.getSubscriberBadgeLabel()},s);return}const T=this.resolveStorefrontDiscount(r,E,n),M=m*(1-T/100);if(p.setAttribute("data-final-price",M.toFixed(2)),T>0?p.innerHTML=` 300 <span class="text-[#FF0000]">${this.formatCurrency(M.toFixed(2),o||this.DEFAULT_CURRENCY)}</span> 301 <s class="text-[#969592] line-through ml-2">${this.formatCurrency(m.toFixed(2),o||this.DEFAULT_CURRENCY)}</s> 302 `:p.textContent=this.formatCurrency(m.toFixed(2),o||this.DEFAULT_CURRENCY),n>0&&T>0){const A=p.closest(we);if(A){const q=ke({basePrice:m,promoPercent:rt(r,E),subscriberPercent:n});this.applyPairBadge(A,q,{pair:"",subscriber:this.getSubscriberBadgeLabel()},s)}}}),document.querySelectorAll("[data-first-purchase-pair-badge]").forEach(p=>{s.has(p)||p.classList.contains("hidden")||(p.classList.add("hidden"),p.classList.remove("flex"),p.closest(we)?.querySelectorAll(Je).forEach(E=>{E.style.removeProperty("display")}))}),document.querySelectorAll(".button-js-add-to-cart").forEach(p=>{try{const E=p.getAttribute("data-sku"),g=Number.parseFloat(p.getAttribute("data-original-price")||p.getAttribute("data-total-price"));if(!E||!Number.isFinite(g))return;const m=this.resolveStorefrontDiscount(r,E,n),x=g*(1-m/100);p.setAttribute("data-original-price",g.toFixed(2)),p.setAttribute("data-total-price",x.toFixed(2))}catch{}}),document.querySelectorAll(".price-saving").forEach(p=>{try{const E=p.getAttribute("data-sku"),g=parseFloat(p.getAttribute("data-price-original")),m=this.resolveStorefrontDiscount(r,E,n),x=g*(1-m/100),T=g-x;if(isNaN(T)||T<=0){p.parentElement?.classList.add("hidden");return}p.parentElement?.classList.remove("hidden"),p.textContent=this.formatCurrency(T.toFixed(2),e?.currency||this.DEFAULT_CURRENCY)}catch{}}),document.querySelectorAll(".discount-badge").forEach(p=>{if(p.hasAttribute("data-product-subscription-discount"))return;const E=p.getAttribute("data-sku"),g=p.closest(we)?this.resolveStorefrontDiscount(r,E,n):this.resolveStorefrontListingDiscount(r,E,n);g?(p.textContent=`-${g}%`,p.classList.remove("hidden")):p.classList.add("hidden")}),this.syncStickyCtaPercent(r,n),window.dispatchEvent(new CustomEvent("PricesAppliedUI")),this.syncListingFirstPurchase();const d=await fetch(`${se}/api/skins`),f=d.ok?await d.json():null;if(t!==this._priceRenderGeneration)return;const w=document.querySelectorAll(".skin-club-price"),P=document.querySelectorAll(".skin-shipping-threshold");
302w.forEach(p=>{p&&f?.marketData?.ui?.clubPrice&&(p.textContent=f?.marketData?.ui?.clubPrice)}),P.forEach(p=>{p&&f?.marketData?.ui?.freeShippingThreshold&&(p.textContent=f?.marketData?.ui?.freeShippingThreshold)})}catch(e){if(t!==this._priceRenderGeneration)return;window.dispatchEvent(new CustomEvent("PricesAppliedUI",{detail:{error:e}}))}}async checkMarketSync(t=null){t||(t=await this.getCart());const e=window.location.pathname.split("/")[1],r=e.split("-")[0],n=e.split("-")[1],o=this.getStoredPromoCode();return t&&t.market!==n&&n.length>=2&&n.length<=4?await this.updateCartMarket(t.uuid,n):t&&t.promo_codes!==o&&o&&n.length>=2&&n.length<=4?await this.updateCartMarket(t.uuid,n,r):t&&t.language!==r&&r&&n.length>=2&&n.length<=4?await this.updateCartMarket(t.uuid,n,r):t}storeUrlParameters(){const t=this.getStoredUrlParameters(),e=Ve(new URLSearchParams(window.location.search));if(Object.keys(e).length===0)return;let r=!1;for(const[n,o]of Object.entries(e))t[n]||(t[n]=o,r=!0);r&&(this.setCookie(this.URL_PARAMS_COOKIE_NAME,JSON.stringify(t),this.URL_PARAMS_EXPIRY_DAYS),this.cartId&&this.updateCartParams())}getStoredUrlParameters(){const t=this.getCookie(this.URL_PARAMS_COOKIE_NAME);if(!t)return{};try{const e=Ve(JSON.parse(t)),r=JSON.stringify(e);return r!==t&&(Object.keys(e).length===0?this.deleteCookie(this.URL_PARAMS_COOKIE_NAME):this.setCookie(this.URL_PARAMS_COOKIE_NAME,r,this.URL_PARAMS_EXPIRY_DAYS)),e}catch{return this.deleteCookie(this.URL_PARAMS_COOKIE_NAME),{}}}updateCartParams(){return this._updateCartParams()}async _updateCartParams(){if(!this.cartId)return;const t=this.getStoredUrlParameters();if(Object.keys(t).length===0)return;const e=Object.entries(t).map(([r,n])=>{const o=Math.floor(Date.now()/1e3)+this.URL_PARAMS_EXPIRY_DAYS*24*60*60;return{key:r,value:n,expires:o}});try{const r=this.cartId,n=await fetch(`${this.API_BASE_URL}/${r}/attributes`,{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:e})}),o=await n.json().catch(()=>null);if(this.isImmutablePromotionLinkConflict(n,o))return null;if(n.status===404&&this.requireUsableCartMutationResponse(n,o,"update attributes",r),!n.ok)throw new Error(`Cart update attributes failed: ${n.status}`);if(o?.success!==!0||!Array.isArray(o.attributes))throw new Error("Cart update attributes returned an invalid response");return o}catch{}}});window.cart||(window.cart=new window.Cart,window.cart.setCurrentLocale(),window.cart.getCart().then(t=>{!t||!t.items||t.items.length===0?sessionStorage.setItem("arrivedWithoutCart","true"):sessionStorage.setItem("arrivedWithCart","true")}).catch(t=>{}),document.addEventListener("DOMContentLoaded",()=>{const e=new URLSearchParams(window.location.search).get("cart_id"),r=document.querySelectorAll('input[name="purchase-option"]'),n=document.querySelectorAll(".add-to-cart.main-product-atc");if(e&&(window.cart.setStoredCartId(e),window.cart.refreshCart().then(()=>{window.cart.openCart()}).catch(o=>{})),r.forEach(o=>{o.addEventListener("change",()=>{const s=document.querySelector('input[name="purchase-option"]:checked').value;
302n.forEach(c=>{c.setAttribute("data-purchase-option",s)})})}),r.length>0){const o=document.querySelector('input[name="purchase-option"]:checked').value;n.forEach(s=>{s.setAttribute("data-purchase-option",o)})}window.cart.initializeAddToCartButtons(),window.cart.initializeCartUI(),window.cart.applyToPricesUI(),window.cart.applySkinUI()}));function Xe(){const t=document.getElementById("confirmationModal");return t&&!t.classList.contains("hidden")}function ot(){const t=document.getElementById("confirmationModal");t&&(t.classList.remove("hidden"),document.body.style.overflow="hidden")}window.MARKETS=Le;window.openConfirmationModal=ot;const Ze={EARLYBLACKFRIDAY:"EARLY BLACK FRIDAY",EARLYBLACKFRIDAYROW:"EARLY BLACK FRIDAY",EARLYBUENFIN:"EARLY BUEN FIN",COCUNATDAYS1:"SKINEARLYACCESS"};function ne(t,e=null,r=null){const n={"[FREE]":ve[r]||"FREE","[TIER1]":be(window.tiers.TIER1[e]||0,e),"[TIER2]":be(window.tiers.TIER2[e]||0,e),"[TIER3]":be(window.tiers.TIER3[e]||0,e),"[TIER4]":be(window.tiers.TIER4[e]||0,e),"[TIER5]":be(window.tiers.TIER5[e]||0,e),"[TIER6]":be(window.tiers.TIER6[e]||0,e),"[CLUB]":window.marketData.ui.clubPrice};return t=t.replace(/\{\{(\[.*?\])\}\}/g,(o,s)=>n[s]||o),t=t.replace(/(\[TIER\d+\])/g,o=>n[o]||o),t=t.replace(/(\[FREE\])/g,o=>n[o]||o),t=t.replace(/(\[CLUB\])/g,o=>n[o]||o),t}function Re(t,e,r,n){const o=D(r,ee.homeHeroMobile),s=D(n,ee.homeHeroDesktop,{density:1});if(t&&o&&(t.tagName==="SOURCE"?(t.setAttribute("srcset",o),t.removeAttribute("sizes")):t.src=o),e&&s){e.src=s,e.removeAttribute("srcset"),e.removeAttribute("sizes");const c=e.closest&&e.closest("picture"),h=c&&c.querySelector('source[media^="(min-width"]');h&&(h.setAttribute("srcset",s),h.removeAttribute("sizes"))}}function De(t,e,r){let n=t.querySelector("picture.banner-collection-media");if(!n){n=document.createElement("picture"),n.className="banner-collection-media";const c=document.createElement("source");c.setAttribute("media","(max-width: 639.98px)");const h=document.createElement("img");h.alt="",h.loading="lazy",h.decoding="async",h.className="absolute inset-0 -z-[1] h-full w-full object-cover",n.appendChild(c),n.appendChild(h),t.prepend(n)}const o=n.querySelector("source"),s=n.querySelector("img");o&&(o.setAttribute("srcset",D(e||r,ee.collectionBanner,{density:1})),o.removeAttribute("sizes")),s&&(s.src=D(r||e,ee.collectionBanner,{density:1}),s.removeAttribute("srcset"),s.removeAttribute("sizes"))}function de(t,e){if(!e)return t;if(e.startsWith("#")||e.startsWith("//")||/^[a-z][a-z\d+.-]*:/i.test(e))return e;const r=t.split("/").filter(s=>s!=="");let n="";if(r.length>0&&/^[a-z]{2}-[a-z]{2,3}$/i.test(r[0]))n="/"+r[0];else{const s=window.location.pathname.split("/").filter(c=>c!=="");s.length>0&&/^[a-z]{2}-[a-z]{2,3}$/i.test(s[0])&&(n="/"+s[0])}const o=e.startsWith("/")?e:"/"+e;return n+o}function st(t,e){const n=new URLSearchParams(window.location.search).get("skin_preview");if(n)return sessionStorage.setItem("skin_preview",n),n;const o=sessionStorage.getItem("skin_preview");return o||(Ze[e]?Ze[e]:window?.marketDefaultsParam?.default_skin||"DEFAULT")}function Rt(t){const e=document.getElementById("skin-custom-styles");if(!t){e&&e.remove();return}const r=e||document.createElement("style");return r.id="skin-custom-styles",r.textContent=t,e||document.head.appendChild(r),r}function $t(t,e,r,n){t.classList.toggle("w-full",n),t.classList.toggle("sm:w-1/2",n),t.classList.toggle("w-1/2",!n),t.classList.toggle("sm:w-1/4",!n),e&&(e.classList.toggle("px-8",n),e.classList.toggle("py-8",n),e.classList.toggle("text-left",n),e.classList.toggle("max-sm:aspect-square",n),e.classList.toggle("px-4",!n),e.classList.toggle("py-4",!n),e.classList.toggle("text-center",!n),e.style.removeProperty("text-align"),e.style.removeProperty("padding"),e.style.removeProperty("aspect-ratio")),r&&(r.classList.toggle("inline-block",n),r.classList.toggle("w-auto",n),r.classList.toggle("block",!n),r.style.removeProperty("display"),r.style.removeProperty("width"))}async function Tt(t,e,r){t=st(r,t);let n=Le[r.toLowerCase()]?.currency||"EUR";window.skins=Array.isArray(window.skins)?window.skins:[];let o=window.skins.find(a=>a?.code===t);if(!o&&sessionStorage.getItem("skin_preview"))try{const a=await fetch(`${se}/api/skins/${t}?market=${r}&lang=${e}`,{headers:{"Content-Type":"application/json"}});a.ok&&(o=(await a.json()).skin,o&&window.skins.push(o))}catch{}if(!o)return;const c=document.body?.dataset.serverRenderedSkin===t,h=document.body?.dataset.skinSsrComplete==="true";if(c&&h)return window.__activeSkinCode=t,{skinCode:t,skipped:!0,reason:"server-rendered"};const u=document.getElementById("skin-custom-styles");if(!c||u?.dataset.skinCode!==t){const a=Rt(o.styles);a&&(a.dataset.skinCode=t)}const i=o.translation||{},d=document.getElementById("cocunat-hero-home");if(d){let a=!1;if(i.main_hero_image_desktop&&i.main_hero_image_mobile&&(document.querySelectorAll('[id="cocunat-hero-home-image-1"]').forEach(C=>{const y=C.querySelector(".cocunat-hero-home-desktop"),b=C.querySelector(".cocunat-hero-home-mobile"),U=C.querySelector(".main-hero-top_title"),L=C.querySelector(".main-hero-title"),R=C.querySelector(".main-hero-description"),$=C.querySelector(".main-hero-button"),I=C.querySelector("#cocunat-hero-home-link");if(Re(b,y,i.main_hero_image_mobile,i.main_hero_image_desktop),U&&i.main_hero_top_title?(U.textContent=i.main_hero_top_title,U.classList.remove("hidden")):U&&U.classList.add("hidden"),L&&i.main_hero_title?(L.textContent=i.main_hero_title,L.classList.remove("hidden")):L&&L.classList.add("hidden"),R&&i.main_hero_description?(R.innerHTML=i.main_hero_description,R.classList.remove("hidden")):R&&R.classList.add("hidden"),$&&i.main_hero_button_text?($.textContent=i.main_hero_button_text,$.classList.remove("hidden")):$&&$.classList.add("hidden"),I&&i.main_hero_button_link){const S=I.getAttribute("href");try{i.main_hero_button_link.startsWith("#")?I.setAttribute("href",i.main_hero_button_link):I.setAttribute("href",de(S,i.main_hero_button_link))}catch{}}if(i.main_hero_font_color){const S=i.main_hero_font_color;U&&(U.style.color=S),L&&(L.style.color=S),R&&(R.style.color=S),$&&($.style.color=S,$.style.borderColor=S)}}),a=!0),i.main_hero2_image_desktop&&i.main_hero2_image_mobile){const _=d.querySelector(".glide__slides");if(document.querySelector('[id="cocunat-hero-home-image-2"]'))document.querySelectorAll('[id="cocunat-hero-home-image-2"]').forEach(b=>{const U=b.querySelector(".cocunat-hero-home-desktop"),L=b.querySelector(".cocunat-hero-home-mobile"),R=b.querySelector(".main-hero-top_title"),$=b.querySelector(".main-hero-title"),I=b.querySelector(".main-hero-description"),S=b.querySelector(".main-hero-button"),O=b.querySelector("#cocunat-hero-home-link");if(Re(L,U,i.main_hero2_image_mobile,i.main_hero2_image_desktop),R&&i.main_hero2_top_title?(R.textContent=i.main_hero2_top_title,R.classList.remove("hidden")):R&&R.classList.add("hidden"),$&&i.main_hero2_title?($.textContent=i.main_hero2_title,$.classList.remove("hidden")):$&&$.classList.add("hidden"),I&&i.main_hero2_description?(I.innerHTML=i.main_hero2_description,I.classList.remove("hidden")):I&&I.classList.add("hidden"),S&&i.main_hero2_button_text?(S.textContent=i.main_hero2_button_text,S.classList.remove("hidden")):S&&S.classList.add("hidden"),O&&i.main_hero2_button_link){const Y=O.getAttribute("href");try{i.main_hero2_button_link.startsWith("#")?O.setAttribute("href",i.main_hero2_button_link):O.setAttribute("href",de(Y,i.main_hero2_button_link))}catch{}}if(i.main_hero2_font_color){const Y=i.main_hero2_font_color;R&&(R.style.color=Y),$&&($.style.color=Y),I&&(I.style.color=Y),S&&(S.style.color=Y,S.style.borderColor=Y)}});else{const y=document.createElement("li");y.id="cocunat-hero-home-image-2",y.className="glide__slide";const b=i.main_hero2_button_text?`<a href="${i.main_hero2_button_link||"/collections/all-products"}" class="main-hero-button bg-transparent border px-12 py-3 mt-[16px] sm:mt-[16px] text-[16px] sm:text-[20px] uppercase border-white text-white sm:text-white sm:border-white" ${i.main_hero2_font_color?`style="color: ${i.main_hero2_font_color}; border-color: ${i.main_hero2_font_color};"`:""}>${i.main_hero2_button_text}</a>`:"";y.innerHTML=` 303 <div id="cocunat-hero-home-image"> 304 <a href="${i.main_hero2_button_link||"/collections/all-products"}" id="cocunat-hero-home-link" class="block h-[80vh]"> 305 <img src="${D(i.main_hero2_image_mobile,ee.homeHeroMobile)}" class="cocunat-hero-home-mobile w-full h-full object-cover object-center" alt="" /> 306 <img src="${D(i.main_hero2_image_desktop,ee.homeHeroDesktop,{density:1})}" class="cocunat-hero-home-desktop w-full h-full object-cover object-center" alt="" /> 307 </a> 308 <div class="absolute top-0 left-0 w-full h-full bg-black opacity-30 hidden"></div> 309 <div class="absolute inset-0 flex items-end"> 310 <div class="w-full max-w-6xl mx-auto px-4 py-10"> 311 <div class="flex flex-col items-start sm:w-1/2 text-white sm:text-white"> 312 <p class="main-hero-top_title text-xl sm:text-[24px] sm:leading-[30px] mb-0 ${i.main_hero2_top_title?"":"hidden"}" ${i.main_hero2_font_color?`style="color: ${i.main_hero2_font_color};"`:""}>${i.main_hero2_top_title||""}</p> 313 <p class="main-hero-title font-brownRegular text-[32px] sm:text-[48px] font-canela-italic mb-1 leading-[40px] sm:leading-[56px] ${i.main_hero2_title?"":"hidden"}" ${i.main_hero2_font_color?`style="color: ${i.main_hero2_font_color};"`:""}>${i.main_hero2_title||""}</p> 314 <p class="main-hero-description text-[16px] leading-[20px] sm:text-[20px] sm:leading-[24px] ${i.main_hero2_description?"":"hidden"}" ${i.main_hero2_font_color?`style="color: ${i.main_hero2_font_color};"`:""}>${i.main_hero2_description||""}</p> 315 ${b} 316 </div> 317 </div> 318 </div> 319 </div> 320 `,_.appendChild(y)}a=!0}if(i.main_hero3_image_desktop&&i.main_hero3_image_mobile){const _=d.querySelector(".glide__slides");if(document.querySelector('[id="cocunat-hero-home-image-3"]'))document.querySelectorAll('[id="cocunat-hero-home-image-3"]').forEach(b=>{const U=b.querySelector(".cocunat-hero-home-desktop"),L=b.querySelector(".cocunat-hero-home-mobile"),R=b.querySelector(".main-hero-top_title"),$=b.querySelector(".main-hero-title"),I=b.querySelector(".main-hero-description"),S=b.querySelector(".main-hero-button"),O=b.querySelector("#cocunat-hero-home-link");if(Re(L,U,i.main_hero3_image_mobile,i.main_hero3_image_desktop),R&&i.main_hero3_top_title?(R.textContent=i.main_hero3_top_title,R.classList.remove("hidden")):R&&R.classList.add("hidden"),$&&i.main_hero3_title?($.textContent=i.main_hero3_title,$.classList.remove("hidden")):$&&$.classList.add("hidden"),I&&i.main_hero3_description?(I.innerHTML=i.main_hero3_description,I.classList.remove("hidden")):I&&I.classList.add("hidden"),S&&i.main_hero3_button_text?(S.textContent=i.main_hero3_button_text,S.classList.remove("hidden")):S&&S.classList.add("hidden"),O&&i.main_hero3_button_link){const Y=O.getAttribute("href");try{i.main_hero3_button_link.startsWith("#")?O.setAttribute("href",i.main_hero3_button_link):O.setAttribute("href",de(Y,i.main_hero3_button_link))}catch{}}if(i.main_hero3_font_color){const Y=i.main_hero3_font_color;R&&(R.style.color=Y),$&&($.style.color=Y),I&&(I.style.color=Y),S&&(S.style.color=Y,S.style.borderColor=Y)}});else{const y=document.createElement("li");y.id="cocunat-hero-home-image-3",y.className="glide__slide";const b=i.main_hero3_button_text?`<a href="${i.main_hero3_button_link||"/collections/all-products"}" class="main-hero-button bg-transparent border px-12 py-3 mt-[16px] sm:mt-[16px] text-[16px] sm:text-[20px] uppercase border-black text-black sm:text-black sm:border-black" ${i.main_hero3_font_color?`style="color: ${i.main_hero3_font_color}; border-color: ${i.main_hero3_font_color};"`:""}>${i.main_hero3_button_text}</a>`:"";y.innerHTML=` 321 <div id="cocunat-hero-home-image"> 322 <a href="${i.main_hero3_button_link||"/collections/all-products"}" id="cocunat-hero-home-link" class="block h-[80vh]"> 323 <img src="${D(i.main_hero3_image_mobile,ee.homeHeroMobile)}" class="cocunat-hero-home-mobile w-full h-full object-cover object-center" alt="" /> 324 <img src="${D(i.main_hero3_image_desktop,ee.homeHeroDesktop,{density:1})}" class="cocunat-hero-home-desktop w-full h-full object-cover object-center" alt="" /> 325 </a> 326 <div class="absolute top-0 left-0 w-full h-full bg-black opacity-30 hidden"></div> 327 <div class="absolute inset-0 flex items-end"> 328 <div class="w-full max-w-6xl mx-auto px-4 py-10"> 329 <div class="flex flex-col items-start sm:w-1/2 text-black sm:text-black"> 330 <p class="main-hero-top_title text-xl sm:text-[24px] sm:leading-[30px] mb-0 ${i.main_hero3_top_title?"":"hidden"}" ${i.main_hero3_font_color?`style="color: ${i.main_hero3_font_color};"`:""}>${i.main_hero3_top_title||""}</p> 331 <p class="main-hero-title font-brownRegular text-[32px] sm:text-[48px] font-canela-italic mb-1 leading-[40px] sm:leading-[56px] ${i.main_hero3_title?"":"hidden"}" ${i.main_hero3_font_color?`style="color: ${i.main_hero3_font_color};"`:""}>${i.main_hero3_title||""}</p> 332 <p class="main-hero-description text-[16px] leading-[20px] sm:text-[20px] sm:leading-[24px] ${i.main_hero3_description?"":"hidden"}" ${i.main_hero3_font_color?`style="color: ${i.main_hero3_font_color};"`:""}>${i.main_hero3_description||""}</p> 333 ${b} 334 </div> 335 </div> 336 </div> 337 </div> 338 `,_.appendChild(y)}a=!0}a&&window.dispatchEvent(new CustomEvent("heroSlidesUpdated"))}const f=document.getElementById("cocunat-home-highlight");if(f&&i.home_banner_highlight_image_desktop&&i.home_banner_highlight_image_mobile){const a=f.querySelector("a"),_=f.querySelector(".cocunat-home-highlight_image"),C=f.querySelector(".cocunat-home-highlight_top_title"),y=f.querySelector(".cocunat-home-highlight_title"),b=f.querySelector(".cocunat-home-highlight_subtitle"),U=f.querySelector(".cocunat-home-highlight_button");if(_&&i.home_banner_highlight_position){const L=i.home_banner_highlight_position;L==="top"?_.style.justifyContent="flex-start":L==="bottom"&&(_.style.justifyContent="flex-end")}if(_&&(_.style.setProperty("--bg-mobile",`url('${D(i.home_banner_highlight_image_mobile,ee.bannerMobile)}
338')`),_.style.setProperty("--bg-desktop",`url('${D(i.home_banner_highlight_image_desktop,ee.bannerDesktop)}')`)),C&&i.home_banner_highlight_top_title!==void 0?i.home_banner_highlight_top_title===""?C.classList.add("hidden"):(C.textContent=i.home_banner_highlight_top_title,C.classList.remove("hidden")):C&&C.classList.add("hidden"),y&&i.home_banner_highlight_title){const L=ne(i.home_banner_highlight_title,n,e);y.textContent=L,y.classList.remove("hidden")}else y&&y.classList.add("hidden");if(b&&i.home_banner_highlight_description){const L=ne(i.home_banner_highlight_description,n,e);b.innerHTML=L,b.classList.remove("hidden")}else b&&b.classList.add("hidden");if(U&&i.home_banner_highlight_button_text?(U.textContent=i.home_banner_highlight_button_text,U.classList.remove("hidden")):U&&U.classList.add("hidden"),a&&i.home_banner_highlight_button_link){const L=a.getAttribute("href");try{i.home_banner_highlight_button_link.startsWith("#")?a.setAttribute("href",i.home_banner_highlight_button_link):a.setAttribute("href",de(L,i.home_banner_highlight_button_link))}catch{}}if(i.home_banner_highlight_font_color){const L=i.home_banner_highlight_font_color;C&&(C.style.color=L),y&&(y.style.color=L),b&&(b.style.color=L),U&&(U.style.color=L,U.style.borderColor=L)}}const w=i.announcement_type||"default",P=document.getElementById("announcement-bar-regular-wrapper"),p=document.getElementById("announcement-bar-countdown-wrapper"),E=document.getElementById("announcement-bar-dynamic-wrapper");if(P&&P.classList.add("hidden"),p&&p.classList.add("hidden"),E&&E.classList.add("hidden"),w==="regular"||w==="default"){P&&P.classList.remove("hidden");const a=document.getElementById("anouncement-bar");if(a&&i.announcement_title){const _=ne(i.announcement_title,n,e);if(a.innerHTML=_,i.announcement_link){const C=a.getAttribute("href");try{i.announcement_link.startsWith("#")?a.setAttribute("href",i.announcement_link):a.setAttribute("href",de(C,i.announcement_link))}catch{}}}}else if(w==="countdown"){p&&p.classList.remove("hidden");const a=p.querySelector(".announcement-bar-countdown");if(a&&i.announcement_title){const _=document.getElementById("anouncement-bar-2");if(_&&i.announcement_link){const y=_.getAttribute("href");_.setAttribute("href",de(y,i.announcement_link))}const C=a.querySelector("p");if(C){const y=ne(i.announcement_title,n,e);C.innerHTML=y}if(i.announcement_deadline){let I=function(){const S=new Date().getTime(),O=y-S;if(O<0){b.days!=="00"&&(U&&(U.textContent="00"),L&&(L.textContent="00"),R&&(R.textContent="00"),$&&($.textContent="00"),b={days:"00",hours:"00",minutes:"00",seconds:"00"});return}const Y=String(Math.floor(O/(1e3*60*60*24))).padStart(2,"0"),te=String(Math.floor(O%(1e3*60*60*24)/(1e3*60*60))).padStart(2,"0"),oe=String(Math.floor(O%(1e3*60*60)/(1e3*60))).padStart(2,"0"),ue=String(Math.floor(O%(1e3*60)/1e3)).padStart(2,"0");b.days!==Y&&U&&(U.textContent=Y,b.days=Y),b.hours!==te&&L&&(L.textContent=te,b.hours=te),b.minutes!==oe&&R&&(R.textContent=oe,b.minutes=oe),b.seconds!==ue&&$&&($.textContent=ue,b.seconds=ue)};window.countdownSkinsOverride=!0;const y=new Date(i.announcement_deadline).getTime();let b={days:null,hours:null,minutes:null,seconds:null};const U=document.getElementById("countdown-days"),L=document.getElementById("countdown-hours"),R=document.getElementById("countdown-minutes"),$=document.getElementById("countdown-seconds");I(),window.countdownInterval&&clearInterval(window.countdownInterval),window.countdownInterval=setInterval(I,1e3)}}}else if(w==="dynamic"||w==="rotatory"){E&&E.classList.remove("hidden");const a=[];if(i.announcement_title&&i.announcement_link){const _=ne(i.announcement_title,n,e);a.push({title:_,url:i.announcement_link})}if(i.announcement_title2&&i.announcement_link2){const _=ne(i.announcement_title2,n,e);a.push({title:_,url:i.announcement_link2})}if(a.length>0){const _=E.querySelector(".announcement-bar-dynamic");if(_&&(_.innerHTML="",a.forEach((C,y)=>{const b=document.createElement("a");b.href=C.url,b.className=`announcement-message text-center block w-full ${y===0?"active":""}`,b.setAttribute("data-index",y),b.innerHTML=C.title,_.appendChild(b)}),a.length>1)){const C=_.querySelectorAll(".announcement-message");let y=0;window.announcementCarouselInterval&&clearInterval(window.announcementCarouselInterval),window.announcementCarouselInterval=setInterval(()=>{C[y].classList.remove("active"),y=(y+1)%a.length,C[y].classList.add("active")},3e3)}}}const g=document.getElementById("banner-collections-1"),m=g?.querySelector("a"),x=g?.querySelector(".banner-collection-title"),T=g?.querySelector(".banner-collection-description"),M=g?.querySelector(".banner-collection-button"),A=typeof i.collections_banner1_image_desktop=="string"&&i.collections_banner1_image_desktop.trim().length>0,q=typeof i.collections_banner1_image_mobile=="string"&&i.collections_banner1_image_mobile.trim().length>0;if(g&&A&&q){if(m&&De(m,i.collections_banner1_image_mobile,i.collections_banner1_image_desktop),x&&i.collections_banner1_title){const a=ne(i.collections_banner1_title,n,e);x.innerHTML=a,x.classList.remove("hidden")}else x&&x.classList.add("hidden");if(T&&i.collections_banner1_description){const a=ne(i.collections_banner1_description,n,e);T.innerHTML=a,T.classList.remove("hidden")}else T&&T.classList.add("hidden");
338if(M&&i.collections_banner1_button_text?(M.textContent=i.collections_banner1_button_text,M.classList.remove("hidden")):M&&M.classList.add("hidden"),m&&i.collections_banner1_button_link){const a=m.getAttribute("href");try{m.setAttribute("href",de(a,i.collections_banner1_button_link))}catch{}}if(i.collections_banner1_font_color){const a=i.collections_banner1_font_color;x&&(x.style.color=a),T&&(T.style.color=a),M&&(M.style.color=a,M.style.borderColor=a)}}const Q=i.collections_banner1_is_xl==="true"||i.collections_banner1_is_xl===!0||i.collections_banner1_is_xl==="false"||i.collections_banner1_is_xl===!1;if(g&&(A||q||Q)){const a=i.collections_banner1_is_xl==="true"||i.collections_banner1_is_xl===!0;$t(g,m,M,a)}const F=document.getElementById("banner-collections-2");if(F&&i.collections_banner2_image_desktop&&i.collections_banner2_image_mobile){const a=F.querySelector("a"),_=F.querySelector(".banner-collection-title"),C=F.querySelector(".banner-collection-description"),y=F.querySelector(".banner-collection-button");if(a&&De(a,i.collections_banner2_image_mobile,i.collections_banner2_image_desktop),_&&i.collections_banner2_title){const b=ne(i.collections_banner2_title,n,e);_.innerHTML=b,_.classList.remove("hidden")}else _&&_.classList.add("hidden");if(C&&i.collections_banner2_description){const b=ne(i.collections_banner2_description,n,e);C.innerHTML=b,C.classList.remove("hidden")}else C&&C.classList.add("hidden");if(y&&i.collections_banner2_button_text?(y.textContent=i.collections_banner2_button_text,y.classList.remove("hidden")):y&&y.classList.add("hidden"),a&&i.collections_banner2_button_link){const b=a.getAttribute("href");try{a.setAttribute("href",de(b,i.collections_banner2_button_link))}catch{}}if(i.collections_banner2_font_color){const b=i.collections_banner2_font_color;_&&(_.style.color=b),C&&(C.style.color=b),y&&(y.style.color=b,y.style.borderColor=b)}}const V=document.getElementById("collections-hero-mobile");if(V&&i.collections_hero_mobile){const a=V.querySelector("img"),_=V.querySelector(".main-hero-top_title"),C=V.querySelector(".main-hero-title"),y=V.querySelector(".main-hero-description");if(V.classList.remove("hidden"),V.classList.add("block","sm:hidden"),a&&(a.src=D(i.collections_hero_mobile,ee.collectionHeroMobile)),_&&i.collections_hero_top_title?(_.textContent=i.collections_hero_top_title,_.classList.remove("hidden")):_&&_.classList.add("hidden"),C&&i.collections_hero_title?(C.textContent=i.collections_hero_title,C.classList.remove("hidden")):C&&C.classList.add("hidden"),y&&i.collections_hero_description?(y.innerHTML=i.collections_hero_description,y.classList.remove("hidden")):y&&y.classList.add("hidden"),i.collections_hero_font_color){const b=i.collections_hero_font_color;_&&(_.style.color=b),C&&(C.style.color=b),y&&(y.style.color=b)}}const k=document.getElementById("collections-hero-desktop");if(k&&i.collections_hero_desktop){const a=k.querySelector("img"),_=k.querySelector(".main-hero-top_title"),C=k.querySelector(".main-hero-title"),y=k.querySelector(".main-hero-description");if(k.classList.remove("sm:hidden"),k.classList.add("hidden","sm:block"),a&&(a.src=D(i.collections_hero_desktop,ee.collectionHeroDesktop)),_&&i.collections_hero_top_title?(_.textContent=i.collections_hero_top_title,_.classList.remove("hidden")):_&&_.classList.add("hidden"),C&&i.collections_hero_title?(C.textContent=i.collections_hero_title,C.classList.remove("hidden")):C&&C.classList.add("hidden"),y&&i.collections_hero_description?(y.innerHTML=i.collections_hero_description,y.classList.remove("hidden")):y&&y.classList.add("hidden"),i.collections_hero_font_color){const b=i.collections_hero_font_color;_&&(_.style.color=b),C&&(C.style.color=b),y&&(y.style.color=b)}}const N=document.querySelectorAll("#banner-pdp, [data-banner-pdp]");N.length&&i.banner_pdp_image&&N.forEach(a=>{const _=a.querySelector(".banner_pdp_title"),C=a.querySelector(".banner_pdp_description"),y=a.querySelector(".banner_pdp_image");if(a.classList.remove("hidden"),a.classList.add("block"),y&&(y.src=D(i.banner_pdp_image,ee.pdpGiftBanner)),_&&i.banner_pdp_title){const b=ne(i.banner_pdp_title,n,e);_.innerHTML=b}if(C&&i.banner_pdp_description&&(C.innerHTML=ne(i.banner_pdp_description,n,e)),i.banner_pdp_font_color){const b=i.banner_pdp_font_color;_&&(_.style.color=b),C&&(C.style.color=b)}});const z=document.getElementById("terms-and-conditions-skin");return z&&i.terms_and_conditions&&(z.innerHTML=i.terms_and_conditions),document.querySelectorAll(`.promo-show-${t}`).forEach(a=>{a.classList.remove("hidden")}),window.__activeSkinCode=t,{skinCode:t,skipped:!1}}function at(t){return{EUR:"â¬",USD:"$",GBP:"£",JPY:"Â¥",CHF:"â£",CAD:"C$",MXN:"$"}[t]||t}function be(t,e){const r=at(e);
338if(e==="MXN")return`${r}${parseInt(t).toLocaleString("es-MX")}`;const n=parseFloat(t),o=Number.isInteger(n)?String(n):n.toFixed(2);return e==="EUR"?`${o}${r}`:`${r}${o}`}window.executeShortcodes=ne;window.applySkinUI=Tt;window.buildLocalizedUrl=de;window.getDefaultSkin=st;window.currencyCodeToSymbol=at;window.formatCurrency=be;window.cocunatImagePath=mt;const ct=window.__API_LESS_URL||"https://api-less.cocunat.com",et="100478089",lt=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1";function qt(t){const e=`${t}=`,r=document.cookie.split(";");for(let n of r)if(n=n.trim(),n.indexOf(e)===0)return n.substring(e.length,n.length);return null}function X(t,...e){}function Nt(){var t=window.cart&&window.cart.API_BASE_URL||window.Cart&&window.Cart.API_BASE_URL||"";return t.replace(/\/v\d+\/carts\/?$/,"")+"/track/menu"}function me(t){try{if(!navigator.sendBeacon)return;navigator.sendBeacon(Nt(),JSON.stringify(t))}catch{}}function ce(t){let e="";return["218","23611","233","23711","23811"].includes(t)&&(e="218"),{sku:t,treatment:e}}function dt(t){if(lt)try{t()}catch(e){X("Tracking error in development (safe to ignore):",e)}else t()}function Mt(t){X("Starting getConvertAttributes function");let e=localStorage.getItem("convert_attributes");if(X("LocalStorage result:",e),!e)if(X("convert_attributes not found in localStorage, checking cookie"),e=qt("convert_attributes"),X("Cookie result:",e),e){X("convert_attributes found in cookie");try{e=decodeURIComponent(e),JSON.parse(e),X("Successfully decoded cookie value:",e)}catch{e=null}}else t&&t.data&&t.data.checkout&&(X("Checking event data:",t.data),e=findProperty(t.data.checkout,"customAttributes"),X("Event data result:",e),e&&(X("convert_attributes found in event custom attributes"),typeof e!="string"&&(e=JSON.stringify(e))));if(e)try{const r=JSON.parse(typeof e=="string"?e:JSON.stringify(e));return X("Final validated result:",r),JSON.stringify(r)}catch{return null}return X("No valid convert_attributes found"),null}function Bt(t,e){if(X("Starting postConversion function with goal id:",e),!!t)try{t.indexOf("%")!==-1&&(t=decodeURIComponent(t));var r=JSON.parse(t);if(!r||Object.keys(r).length===0)return;X("Building POST data for goal hit.");const n={cid:r.cid,pid:r.pid,seg:r.defaultSegments,s:"shopify",vid:r.vid,ev:[{evt:"hitGoal",goals:[e],exps:r.exps,vars:r.vars}]};let o=JSON.stringify(n);const s=`https://${r.pid}.metrics.convertexperiments.com/track`;if(lt){X("Development environment detected - skipping tracking call to:",s),X("Would have sent data:",o);return}if(navigator.sendBeacon){const c=new Blob([o],{type:"application/json"}),h=navigator.sendBeacon(s,c);X("Beacon sent:",h)}else fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:o,keepalive:!0}).then(c=>{if(!c.ok)throw new Error("Network response was not ok");return c.json()}).then(c=>{X("fetch result:",c)}).catch(c=>{})}catch{}}function Ft(){return"fb_"+Date.now()+"_"+Math.random().toString(36).substr(2,9)}const Ot=(t,e)=>{window.fbq&&dt(()=>{const r=Ft();switch(t){case"AddToCart":let n={content_ids:[e.platform_variant_id.replace("gid://shopify/ProductVariant/","")],content_name:e.productName,content_type:"product",value:e.price,currency:e.currency||"USD"};fbq("track","AddToCart",n,{eventID:r});break;case"ViewContent":let o={content_ids:[e.platform_variant_id.replace("gid://shopify/ProductVariant/","")],content_name:e.productName,content_type:"product",value:e.price,currency:e.currency||"USD"};fbq("track","ViewContent",o,{eventID:r});break;default:}})};function j(t){return t.includes("/products/")?"PDP":t.includes("/collections/")?"Collection Page":t.includes("/pages/")?"Page":t.includes("/cart/")?"Cart Page":t.includes("/club/")?"Club Page":t.includes("/landings/")?"Landing Page":t.length<=9?"Home Page":"Other"}async function ie(){try{const{response:t,data:e}=await pt();if(!t.ok)return{logged:!1};if(!e||!e.authenticated||!gt(e)||!e.customer||!e.customer.email)return{logged:!1};const r=e.customer.email;return{logged:!0,user_id:await Ht(r),email:r}}catch{return{logged:!1}}}async function Ht(t){const e=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(r)).map(o=>o.toString(16).padStart(2,"0")).join("")}async function $e(t){try{const e=await fetch(ct+"/api/collections");
338if(!e.ok)throw new Error("Failed to fetch collections");const n=(await e.json()).collections,o=[];for(const s of n)s.products_ids&&String(s.products_ids).split(",").map(u=>u.trim()).includes(t.toString())&&o.push(s.handle);return o.length>0?o.join(","):"Unknown"}catch{return"Unknown"}}function le(t){return{255:"Beauty shortlist: Editor's Choice Beauty",219:"Beauty shortlist: BEST NIGHT SERUM",218:"Beauty shortlist: Editor's Choice Beauty",139:"Beauty shortlist: Best Skin Care Product with vitamin C, Beauty Shortlist: Editor's choice Awards",152:"Beauty shortlist: Best Skin Care Product with vitamin C, Beauty Shortlist: Editor's choice Awards",53123:"Beauty shortlist: Editor's Choice Winners, Beauty shortlist: Editor's Choice Awards",220:"Beauty shortlist: Editor's Choice Winners",53239:"Marie Claire: Mejor reestructurador capilar",53342:"Pure UK Awards: Best New Cleanser Bronze Winner",53176:"Beauty Shortlist: Editor's Choice Awards",52074:"Beauty Shortlist: Best Body Oil",53183:"Beauty Shortlist: Editor's Choice Awards",53182:"Beauty Shortlist: Editor's Choice Awards",53009:"Beauty Shortlist: Editor's Choice Awards",188:"Beauty Shortlist: Commended",165:"Beauty Shortlist Best Tinted Moisturiser with SPF",51973:"Beauty Shortlist: Eco Lifestyle Winner, Beauty Shortlist: Editor's Choice Awards",51954:"Beauty Shortlist: Editor's Choice Awards",15:"Beauty Shortlist: Editor's Choice Awards",16:"Beauty Shortlist: Editor's Choice Awards",17:"Beauty Shortlist: Editor's Choice Awards",18:"Beauty Shortlist: Editor's Choice Awards",19:"Beauty Shortlist: Editor's Choice Awards",22:"Beauty Shortlist: Editor's Choice Awards",23:"Beauty Shortlist: Editor's Choice Awards"}[t]||null}async function Se(t){const e=["club-premium","club-hair","club-face","club-body","club-packs","club-products"];try{const r=await fetch(ct+"/api/collections");if(!r.ok)throw new Error("Failed to fetch collections");const o=(await r.json()).collections;for(const s of o)if(e.includes(s.handle)&&s.products_ids&&String(s.products_ids).split(",").map(u=>u.trim()).includes(t.toString()))return!0;return!1}catch{return[].includes(t)}}const jt=(t,e)=>{window.gtag&&dt(async()=>{switch(t){case"ForgetCartShowPopup":let r={event:"cart_reminder_popup_impression",popup_layout:e.popup_layout||"generic_message"};window.dataLayer.push(r);break;case"PDPInteraction":const n=await ie();let o={event:"pdp_section_interaction",market:e.market,content_group:j(e.url),subcontent_group:"Unknown",user_logged:n.logged,user_id:n.user_id||"",section:e.section,section_action:e.section_action};o.is_cocunat_club_suscribed=!1,n.logged&&(o.user_logged_tier="Premium",o.is_cocunat_club_suscribed=!0),window.dataLayer.push(o);break;case"ViewItem":const s=await ie();let c=[];for(const S of e.items){const O={...S,affiliation:"",item_list_id:e.item_list_id,item_list_name:e.item_list_name,item_brand:"Cocunat",item_variant:ce(S.item_id).sku,base_treatment:ce(S.item_id).treatment,item_category:"",item_category2:"",item_category3:"",item_category4:"",item_category5:"",items_per_pack:"",unique_items_per_pack:"",has_awards:le(S.item_id)!==null,award_name:le(S.item_id),is_club_available:await Se(S.item_id)};c.push(O)}const h=e.items.length>0?await $e(e.items[0].internal_id):"Unknown";let u={event:"view_item",market:e.market,content_group:j(e.url),subcontent_group:h,user_logged:s.logged,user_id:s.user_id||"",ecommerce:{item_list_id:e.item_list_id,item_list_name:e.item_list_name,currency:e.items[0].currency,value:e.items[0].price,items:c}};u.is_cocunat_club_suscribed=!1,s.logged&&(u.user_logged_tier="Premium",u.is_cocunat_club_suscribed=!0),window.dataLayer.push(u);break;case"ViewItemList":const i=await ie();let d=[];for(const S of e.items){const O={...S,affiliation:"",item_list_id:e.item_list_id,item_list_name:e.item_list_name,item_brand:"Cocunat",base_treatment:ce(S.item_id).treatment,item_variant:ce(S.item_id).sku,item_category:"",item_category2:"",item_category3:"",item_category4:"",item_category5:"",items_per_pack:"",unique_items_per_pack:"",has_awards:le(S.item_id)!==null,award_name:le(S.item_id),is_club_available:await Se(S.item_id)};d.push(O)}const f=document.getElementById("cart-drawer");let w=!1;if(f){const S=parseFloat(f.getAttribute("data-total-price")||"0"),O=f.getAttribute("data-currency")||"USD";(O==="EUR"&&S>60||O==="USD"&&S>100)&&(w=!0)}let P={event:"view_item_list",market:e.market,content_group:j(e.url),subcontent_group:"Unknown",user_logged:i.logged,user_id:i.user_id||"",free_shipping:w,ecommerce:{item_list_id:e.item_list_id,item_list_name:e.item_list_name,items:d}};P.is_cocunat_club_suscribed=!1,i.logged&&(P.user_logged_tier="Premium",P.is_cocunat_club_suscribed=!0),window.dataLayer.push(P);break;case"NoResultsSearch":const p=await ie();let E={event:"no_search_results",market:e.market,content_group:j(e.url),subcontent_group:"Unknown",user_logged:p.logged,user_id:p.user_id||"",keyword_search:e.keyword_search,product_search_clic:e.product_search_clicked};E.is_cocunat_club_suscribed=!1,p.logged&&(E.user_logged_tier="Premium",E.is_cocunat_club_suscribed=!0),window.dataLayer.push(E);break;case"Search":const g=await ie();let m={event:"search",market:e.market,content_group:j(e.url),subcontent_group:"Unknown",user_logged:g.logged,user_id:g.user_id||"",keyword_search:e.keyword_search,product_search_clic:e.product_search_clicked};m.is_cocunat_club_suscribed=!1,g.logged&&(m.user_logged_tier="Premium",m.is_cocunat_club_suscribed=!0),window.dataLayer.push(m);break;case"SearchQuery":const x=await ie();let T={event:"search_query",market:e.market,content_group:j(e.url),subcontent_group:"Unknown",user_logged:x.logged,user_id:x.user_id||"",keyword_search:e.keyword_search,results_count:e.results_count};T.is_cocunat_club_suscribed=!1,x.logged&&(T.user_logged_tier="Premium",T.is_cocunat_club_suscribed=!0),window.dataLayer.push(T);break;case"OpenSearch":const M=await ie();let A={event:"open_search",market:e.market,content_group:j(e.url),subcontent_group:"Unknown",user_logged:M.logged,user_id:M.user_id||""};A.is_cocunat_club_suscribed=!1,M.logged&&(A.user_logged_tier="Premium",A.is_cocunat_club_suscribed=!0),window.dataLayer.push(A);break;case"PageView":const q=await ie();let Q={event:"virtual_page",market:e.market,content_group:j(e.url),subcontent_group:j(e.url)==="Home Page"?"Home Page":"Unknown",user_logged:q.logged,user_id:q.user_id||""};Q.is_cocunat_club_suscribed=!1,q.logged&&(Q.user_logged_tier="Premium",Q.is_cocunat_club_suscribed=!0),window.dataLayer.push(Q);break;case"AddToCart":const F=await ie(),V=await $e(e.rawAddedItem.variant_id),k=e.item_list_id||j(e.url),N=e.item_list_name||j(e.url);let z=[{item_id:e.productId,item_name:e.productName,price:e.price,affiliation:"",item_list_id:k,item_list_name:N,item_brand:"Cocunat",item_variant:ce(e.productId).sku,base_treatment:ce(e.productId).treatment,item_category:"",item_category2:"",item_category3:"",item_category4:"",item_category5:"",items_per_pack:"",unique_items_per_pack:"",has_awards:le(e.productId)!==null,award_name:le(e.productId),is_club_available:await Se(e.productId)}],G={event:"add_to_cart",market:e.market,content_group:j(e.url),subcontent_group:V,user_logged:F.logged,user_id:F.user_id||"",ecommerce:{item_list_id:k,item_list_name:N,currency:e.currency||"USD",value:e.price,items:z}};G.is_cocunat_club_suscribed=!1,F.logged&&(G.user_logged_tier="Premium",G.is_cocunat_club_suscribed=!0),window.dataLayer.push(G),e.item_list_id&&String(e.item_list_id).indexOf("megamenu_")===0&&me({event:"add_to_cart",market:e.market,item_list_id:e.item_list_id,item_id:e.productId,label:e.productName}),window.dataLayer.push({event:"addToCart",productId:e.productId,productName:e.productName,price:e.price,currency:e.currency||"USD"}),gtag("event","addToCart",{currency:e.currency||"USD",value:e.price,items:[{item_id:e.productId,item_name:e.productName,price:e.price,quantity:e.quantity||1}]});break;case"ViewCart":const a=await ie();let _=[],C=0;for(const S of e.cartData.items)_.push({item_id:S.sku,item_name:S.title,price:S.total_price,original_price:S.original_total_price,discount:S.total_discount,index:C,coupon:e.cartData.promo_codes,quantity:S.quantity,item_variant:ce(S.sku).sku,base_treatment:ce(S.sku).treatment,has_awards:le(S.sku)!==null,award_name:le(S.sku),is_club_available:await Se(S.sku)}),C++;let y={event:"view_cart",market:e.market,content_group:j(e.url),subcontent_group:"Unknown",user_logged:a.logged,user_id:a.user_id||"",ecommerce:{value:e.cartData.total_price,currency:e.cartData.currency,items:_}};y.is_cocunat_club_suscribed=!1,a.logged&&(y.user_logged_tier="Premium",y.is_cocunat_club_suscribed=!0),window.dataLayer.push(y);break;case"RemoveFromCart":const b=await ie(),U=await $e(e.productId);let L=[{item_id:e.productId,item_name:e.productName,price:e.price,affiliation:"",item_list_id:j(e.url),item_list_name:j(e.url),item_brand:"Cocunat",item_variant:ce(e.productId).sku,base_treatment:ce(e.productId).treatment,item_category:"",item_category2:"",item_category3:"",item_category4:"",item_category5:"",items_per_pack:"",unique_items_per_pack:"",has_awards:le(e.productId)!==null,award_name:le(e.productId),is_club_available:await Se(e.productId)}],R={event:"remove_from_cart",market:e.market,content_group:j(e.url),subcontent_group:U,user_logged:b.logged,user_id:b.user_id||"",ecommerce:{item_list_id:j(e.url),item_list_name:j(e.url),currency:e.currency||"USD",value:e.price,items:L}};
338R.is_cocunat_club_suscribed=!1,b.logged&&(R.user_logged_tier="Premium",R.is_cocunat_club_suscribed=!0),window.dataLayer.push(R);break;case"ViewContent":window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"viewContent",productId:e.productId,productName:e.productName,price:e.price,currency:e.currency||"USD"}),gtag("event","viewContent",{currency:e.currency||"USD",value:e.price,items:[{item_id:e.productId,item_name:e.productName,price:e.price}]});break;case"GenerateLead":const $=await ie();let I={event:"generate_lead",market:e.market,content_group:j(e.url),subcontent_group:"Unknown",user_logged:$.logged,user_id:$.user_id||"",email_sha:$.user_id||""};window.dataLayer.push(I);break;case"MenuOpen":window.dataLayer.push({event:"menu_open",market:e.market,content_group:j(e.url),menu_section:e.section,menu_section_label:e.sectionLabel,menu_device:e.device}),me({event:"menu_open",section:e.section,section_label:e.sectionLabel,device:e.device,market:e.market});break;case"MenuSubcategorySelect":window.dataLayer.push({event:"menu_subcategory_select",market:e.market,content_group:j(e.url),menu_section:e.section,menu_section_label:e.sectionLabel,menu_subcategory:e.subcategory,menu_subcategory_label:e.subcategoryLabel,menu_target_type:e.targetType||"subcategory",menu_device:e.device,...e.destination?{link_url:e.destination}:{}}),me({event:"menu_subcategory_select",section:e.section,subcategory:e.subcategory,subcategory_label:e.subcategoryLabel,device:e.device,market:e.market});break;case"MenuViewAll":window.dataLayer.push({event:"menu_view_all_click",market:e.market,content_group:j(e.url),menu_section:e.section,menu_section_label:e.sectionLabel,menu_subcategory:e.subcategory,menu_subcategory_label:e.subcategoryLabel,menu_device:e.device,link_url:e.destination}),me({event:"menu_view_all_click",section:e.section,subcategory:e.subcategory,label:e.subcategoryLabel,link_url:e.destination,device:e.device,market:e.market});break;case"MenuLinkClick":window.dataLayer.push({event:"menu_link_click",market:e.market,content_group:j(e.url),menu_link_label:e.label,menu_device:e.device,link_url:e.destination}),me({event:"menu_link_click",label:e.label,link_url:e.destination,device:e.device,market:e.market});break;case"MenuPromoClick":window.dataLayer.push({event:"menu_promo_click",market:e.market,content_group:j(e.url),menu_section:e.section,promo_name:e.promo,menu_device:e.device,link_url:e.destination}),me({event:"menu_promo_click",section:e.section,label:e.promo,link_url:e.destination,device:e.device,market:e.market});break;case"MenuViewItemList":window.dataLayer.push({ecommerce:null}),window.dataLayer.push({event:"view_item_list",market:e.market,content_group:j(e.url),menu_section:e.section,menu_subcategory:e.subcategory,ecommerce:{item_list_id:e.item_list_id,item_list_name:e.item_list_name,items:e.items||[]}}),me({event:"view_item_list",section:e.section,subcategory:e.subcategory,device:e.device,market:e.market,item_list_id:e.item_list_id});break;case"SelectItem":window.dataLayer.push({ecommerce:null}),window.dataLayer.push({event:"select_item",market:e.market,content_group:j(e.url),menu_section:e.section,menu_subcategory:e.subcategory,...e.currency?{currency:e.currency}:{},ecommerce:{item_list_id:e.item_list_id,item_list_name:e.item_list_name,items:[{item_id:e.item_id,item_name:e.item_name,price:e.price,item_brand:"Cocunat",item_list_id:e.item_list_id,item_list_name:e.item_list_name,index:e.index}]}}),me({event:"select_item",section:e.section,subcategory:e.subcategory,device:e.device,market:e.market,item_list_id:e.item_list_id,item_id:e.item_id});break;default:}})},Vt=(t,e)=>{switch(t){case"AddToCart":try{window._conv_q=window._conv_q||[],window._conv_q.push(["triggerConversion",et]);let r=Mt(event);if(!r)return;Bt(r,et)}catch{}break;case"ViewContent":break;default:}},Gt=(t,e)=>{switch(t){case"ViewContent":const r={Name:e.productName,ProductID:e.productId,Categories:"",ImageURL:e.image,URL:`https://cocunat.com/products/${e.handle}`,Brand:"Cocunat",Price:e.price,Currency:e.currency,Value:e.price,CompareAtPrice:e.originalPrice,PlatformVariantID:e.platform_variant_id};window._learnq=window._learnq||[],window._learnq.push(["track","Vie
338wed Product",r]);break;case"AddToCart":let n=[];e?.rawCartData?.items?.forEach(s=>{n.push({id:s.variant_id,quantity:s.quantity,variant_id:s.variant_id,title:s.title,price:s.price,original_price:parseFloat((s.original_total_price/s.quantity).toFixed(2)),sku:s.sku,gift_card:!1,final_price:s.total_price,total_price:s.total_price,final_line_price:parseFloat((s.total_price/s.quantity).toFixed(2)),discounted_price:s.total_price,line_price:s.price,total_discount:s.total_discount,original_line_price:parseFloat((s.price*s.quantity).toFixed(2)),final_line_price:parseFloat(s.total_price.toFixed(2)),url:"/products/"+s.handle,featured_image:{aspect_ratio:.8,alt:s.title,height:400,url:s.image,width:400},image:s.image,handle:s.handle,product_title:s.title,product_description:""})});const o={origin_custom:"Cocunat-v2",original_total_price:e.rawCartData.original_total_price,items:n,$value:e.rawCartData.total_price,cart_id:e?.rawCartData?.uuid,...e?.is_from_promotion_link?{is_from_promotion_link:!0}:{}};window._learnq=window._learnq||[],window._learnq.push(["track","Added to Cart",o]);break}},Kt=(t,e)=>{switch(t){case"AddToCart":TriplePixel("AddToCart",{item:e.productId,q:1});break}},zt=(t,e)=>{switch(t){case"AddToCart":_tfa.push({notify:"event",name:"add_to_cart",id:1798403,currency:e.currency,revenue:e.price});break}},Yt=(t,e)=>{switch(t){case"AddToCart":let r=[];e.rawCartData.items.forEach(o=>{r.push({item_id:o.sku,item_category_id:1,item_name:o.title,price:o.price,quantity:o.quantity,image_url:o.image,url:o.url,item_brand:"Cocunat",item_variant_id:o.variant_id})}),axon("track","add_to_cart",{price:e.price,total:e.price,currency:e.currency,items:r});break;case"ViewContent":((o,s=10,c=1e3)=>{let h=0;const u=()=>{typeof axon<"u"?o():h<s&&(h++,setTimeout(u,c))};u()})(()=>{axon("track","view_item",{items:[{item_id:e.productId,item_category_id:1,item_name:e.productName,price:e.price,quantity:1,image_url:e.image,item_brand:"Cocunat - Brand",item_variant_id:e.productId}],price:e.price,currency:e.currency})});break}},J=(t,e)=>{try{Ot(t,e)}catch{}try{Vt(t,e)}catch{}try{Gt(t,e)}catch{}try{Kt(t,e)}catch{}try{jt(t,e)}catch{}try{zt(t,e)}catch{}try{Yt(t,e)}catch{}};document.addEventListener("EventAddToCart",t=>J("AddToCart",t.detail));document.addEventListener("EventRemoveFromCart",t=>J("RemoveFromCart",t.detail));document.addEventListener("EventViewCart",t=>J("ViewCart",t.detail));document.addEventListener("EventViewContent",t=>J("ViewContent",t.detail));document.addEventListener("EventPageView",t=>J("PageView",t.detail));document.addEventListener("EventOpenSearch",t=>J("OpenSearch",t.detail));document.addEventListener("EventSearch",t=>J("Search",t.detail));document.addEventListener("EventSearchQuery",t=>J("SearchQuery",t.detail));document.addEventListener("EventNoResultsSearch",t=>J("NoResultsSearch",t.detail));document.addEventListener("EventViewItemList",t=>J("ViewItemList",t.detail));document.addEventListener("EventViewItem",t=>J("ViewItem",t.detail));document.addEventListener("EventPDPInteraction",t=>J("PDPInteraction",t.detail));document.addEventListener("EventGenerateLead",t=>J("GenerateLead",t.detail));document.addEventListener("EventForgetCartShowPopup",t=>J("ForgetCartShowPopup",t.detail));document.addEventListener("EventMenuOpen",t=>J("MenuOpen",t.detail));document.addEventListener("EventMenuSubcategorySelect",t=>J("MenuSubcategorySelect",t.detail));document.addEventListener("EventMenuViewAll",t=>J("MenuViewAll",t.detail));document.addEventListener("EventMenuLinkClick",t=>J("MenuLinkClick",t.detail));document.addEventListener("EventMenuPromoClick",t=>J("MenuPromoClick",t.detail));document.addEventListener("EventMenuViewItemList",t=>J("MenuViewItemList",t.detail));document.addEventListener("EventSelectItem",t=>J("SelectItem",t.detail));document.addEventListener("EventCanaryModalYes",t=>{window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"canary_islands_modal",action:"yes_from_canary",market:t.detail?.market||"unknown"})});document.addEventListener("EventCanaryModalNo",t=>{window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"canary_islands_modal",action:"no_continue_shopping",market:t.detail?.market||"unknown"})});try{const t=new URL(window.location.href);document.dispatchEvent(new CustomEvent("EventPageView",{detail:{market:t.pathname.split("/")[1].replace("/",""),url:window.location.href}}))}catch{}export{se as S,Pe as a,it as b,Ge as c,ke as d,At as f,rt as g};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.