const CURRENT_PRODUCT=window.essentialOrderValueBoosterMeta?JSON.parse(window.essentialOrderValueBoosterMeta.productData):null,CART_PRODUCTS=window.essentialOrderValueBoosterMeta&&window.essentialOrderValueBoosterMeta.cartProducts?window.essentialOrderValueBoosterMeta.cartProducts.map(e=>{let t;try{t=JSON.parse(e)}catch(r){console.log(r)}return t}):[],SELECTED_PRODUCTS=window.essentialOrderValueBoosterProductsData?window.essentialOrderValueBoosterProductsData.map(e=>{let t;try{t=JSON.parse(e)}catch(r){console.log(r)}return t}):[];function moneyFormatEssentialApps(e,t){let r,i=Number.parseFloat(t).toFixed(2),a=window.Shopify?.shop;return a&&("jelt-2828.myshopify.com"===a||"maleia-studio.myshopify.com"===a||"capconstructoraandrespinzon.myshopify.com"===a)?e.replace("{{amount_with_comma_separator}}",new Intl.NumberFormat("de-DE").format(Number.parseFloat(t).toFixed())):(r=e.replace("{{amount}}",Number.parseFloat(t).toFixed(2)),a&&"vaperaliamexico.myshopify.com"===a&&(r=e.replace("{{amount}}",new Intl.NumberFormat("es-MX",{minimumFractionDigits:2,maximumFractionDigits:2}).format(Number.parseFloat(t)))),r=(r=(r=(r=(r=(r=r.replace("{{amount_with_comma_separator}}",i.replace(".",","))).replace("{{amount_with_dot_separator}}",i)).replace("{{amount_no_decimals}}",new Intl.NumberFormat("de-DE").format(Number.parseFloat(t).toFixed()))).replace("{{amount_no_decimals_with_comma_separator}}",new Intl.NumberFormat("de-DE").format(Number.parseFloat(t).toFixed()))).replace("{{amount_no_decimals_with_space_separator}}",new Intl.NumberFormat("hu-HU").format(Number.parseFloat(t).toFixed()))).replace("{{amount_with_space_separator}}",new Intl.NumberFormat("hu-HU").format(t)),a&&("paulandmike-co.myshopify.com"===a||"cardinal-trading-retail.myshopify.com"===a||"grino-store.myshopify.com"===a||"sootang.myshopify.com"===a||"https-huxley-jp.myshopify.com"===a)&&(r=r.replace(".",",")),a&&"dsg-jp.myshopify.com"===a&&(r=r.replace(".","")),a&&"elemood.myshopify.com"===a&&(r=t.toLocaleString("de-DE",{minimumFractionDigits:2})),a&&"mja-shoes.myshopify.com"===a&&(r=`$${r=parseInt(t).toLocaleString("de-DE")}`),r)}function cardTitleEssentialApps(e,t=0){let r=moneyFormatEssentialApps(e.moneyFormat,e.goal-t);return t?t>0&&t=e.goal?e.reachedTitle:void 0:e.title.replace("{order-value}",r)}function updateTotalOnClick(e,t){let r=document.querySelectorAll('form a, form button, form input[type="submit"]');if(r){let i=()=>{setTimeout(()=>{pollCartTotalEssentialApps()},500),setTimeout(()=>{pollCartTotalEssentialApps()},1e3)};"cart-page"===e.type&&!t||window.freeShippingBarConfigs.clickEvents||window.freeShippingBarConfigs.observer||(r.forEach(e=>{e.addEventListener("click",i,{passive:!0})}),document.addEventListener("booster:cart:update",()=>{i()}),window.freeShippingBarConfigs.clickEvents=!0)}}async function getProductEssentialApps(e){let t=await fetch(`/products/${e}.js`,{headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>e).catch(e=>{console.error("Error:",e)});return t}function pollCartTotalEssentialApps(){if(window.freeShippingBarConfigs.threshold)return;window.freeShippingBarConfigs.threshold=!0,setTimeout(()=>{window.freeShippingBarConfigs.threshold=!1},300);let e=window.Shopify.routes.root||"/";fetch(e+"cart.js").then(e=>e.json()).then(e=>{let t="8c20e7-2.myshopify.com"!==window.Shopify.shop&&"healingshilajit-com.myshopify.com"!==window.Shopify.shop&&"5a3970-4.myshopify.com"!==window.Shopify.shop&&"el-buho-nocturno.myshopify.com"!==window.Shopify.shop?e.total_price:e.original_total_price;window.freeShippingBarConfigs.prevCartTotalPrice=t/100,e.items&&e.items.length>0?window.essentialOrderValueBoosterMeta.cartItems=e.items:window.essentialOrderValueBoosterMeta.cartItems=[],window.freeShippingBarConfigs&&window.freeShippingBarConfigs.forEach(r=>{if("turtletags.myshopify.com"===window.Shopify.shop&&e?.currency!==r.currency)return;let i=t;if(r.excludeProducts&&r.excludeProducts.length>0&&e.items.forEach(e=>{r.excludeProducts.find(t=>t.handle===e.handle)&&(i-=e.final_line_price)}),r.excludeProductTags&&r.excludeProductTags.length>0&&e.items.forEach(e=>{let t=CART_PRODUCTS;if(CURRENT_PRODUCT){let a=t.find(e=>e.id===CURRENT_PRODUCT.id);a||t.push(CURRENT_PRODUCT)}let o=t.find(t=>t.id===e.product_id);o||getProductEssentialApps(e.handle).then(e=>{t.push(e)});let n=t.find(t=>t.id===e.product_id),s=n?.tags||[],p=s.map(e=>e.toLowerCase()),l=r.excludeProductTags.some(e=>p.includes(e.toLowerCase()));l&&(i-=e.final_line_price)}),"barista-store.myshopify.com"===Shopify.shop&&(i+=.2*i),document.querySelector(`.free_shipping_card_wrapper_${r.id}`)){let a=document.querySelectorAll(`.free_shipping_card_title_${r.id}`),o=document.querySelectorAll(`.free_shipping_card_progress_bar_${r.id}`),n=document.querySelectorAll(`.free_shipping_card_wrapper_${r.id}`);0!=a.length&&a.forEach(e=>{e.textContent=cardTitleEssentialApps(r,i/100)});let s=i/r.goal;s>100?s=100:0===s&&(s=2.5),o.forEach(e=>{e.style.width=`${s}%`}),n.forEach(e=>{e.style.display="flex"})}if(document.querySelector(`.free_shipping_bar_wrapper_${r.id}`)){let p=document.querySelector(`.free_shipping_bar_title_${r.id}`),l=document.querySelector(`.free_shipping_bar_wrapper_${r.id}`);p.textContent=cardTitleEssentialApps(r,i/100),l.style.display="flex"}});let r=window.location&&window.location.pathname.endsWith("/cart");r&&("pinkblackpalermo.myshopify.com"===Shopify.shop||"essential-freshness.myshopify.com"===Shopify.shop)&&setTimeout(()=>{window.freeShippingBarConfigs.clickEvents=!1,updateTotalOnClick({type:"not-cart-page"},!0)},300),setTimeout(()=>{countViews()},700)})}function triggerSideCart(e){if("baybella1.myshopify.com"===Shopify.shop||"dow-shelly.myshopify.com"===Shopify.shop){window.location.reload();return}if(document.dispatchEvent(new CustomEvent("cart:build")),"blingmyride.myshopify.com"===Shopify.shop){let t=new theme.CartDrawer;t.init();return}let r=window.Shopify.routes.root||"/",i=document.querySelectorAll(`form[action="${r}cart/add"]`),a=window.location&&window.location.pathname.includes("/products/"),o=i[i.length-1];if("55c4f2-6.myshopify.com"===Shopify.shop&&(o=document.querySelector('form[data-type="add-to-cart-form"]')),!o){let n=window.freeShippingBarConfigs.find(t=>t.id===e);n&&n.createdAt&&new Date(n.createdAt).getTime()>1724239746e3&&window.location.reload();return}let s;(s=o.querySelector('button[type="submit"]'))||i.forEach(e=>{e.querySelector('button[type="submit"]')&&(o=e,s=e.querySelector('button[type="submit"]'))});let p=o.querySelector('input[name="quantity"]'),l=o.querySelector('button[name="minus"]'),d=o.querySelector('button[name="plus"]');if(!s)return;let c=document.createElement("input");if(c.setAttribute("type","hidden"),c.setAttribute("value","0"),c.setAttribute("name","quantity"),!p&&a&&"kingsmaycompany.myshopify.com"===Shopify.shop){let u=document.querySelector('input[name="quantity"]'),h=u.value;u.value=0,s.click(),u.value=h;return}if(!p){o.appendChild(c),s.click(),c.remove();return}let f=p.getAttribute("value");p.setAttribute("min",0),p.setAttribute("value",0),("18684b-47.myshopify.com"===Shopify.shop||"dedbdx-mh.myshopify.com"===Shopify.shop)&&(l.disabled=!1,l.click()),s.click(),("18684b-47.myshopify.com"===Shopify.shop||"dedbdx-mh.myshopify.com"===Shopify.shop)&&d.click(),p.setAttribute("min",1),p.setAttribute("value",f||1)}function addToCartEssentialApps(e,t){fetch(window.Shopify.routes.root+"cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:e,quantity:1},]})}).then(e=>{if(window.freeShippingBarConfigs&&200===e.status){let r=window.location&&window.location.pathname.endsWith("/cart");r?r&&window.location.reload():(window.Shopify?.shop!=="atrangi-studio.myshopify.com"&&window.Shopify?.shop!=="bouqie.myshopify.com"&&triggerSideCart(t),pollCartTotalEssentialApps())}else console.log(e);return e.json()}).then(e=>{if(e.items){let r=0;window.Shopify.currency&&window.Shopify.currency.rate&&e.items[0]?.price&&(r=Math.round(e.items[0]?.price/window.Shopify.currency.rate));let i=window.Shopify.currency.active||"";fetch("https://essential-apps-analytics.herokuapp.com/add_to_cart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shop:window.Shopify.shop,booster:t,currency:i,price:e.items[0]?.price,mainCurrency:window.essentialOrderValueBoosterMeta?.mainCurrency,total:r})})}}).catch(e=>{console.error("Error:",e)})}function countViews(){if(window.essentialBoosterViewCounted)return;window.essentialBoosterViewCounted=!0;let e=window.Shopify?window.Shopify.shop:window.location.origin,t=document.querySelectorAll(".essential_free_shipping_bar_wrapper"),r=document.querySelectorAll(".free_shipping_card"),i=t&&1===t.length,a=r&&r.length>0?r.length:0;i&&(a+=1),e&&0!==a&&"lime-blue-coffee.myshopify.com"!==e&&fetch("https://essential-apps-analytics.herokuapp.com/event",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shop:e,views:a})})}function essentialCloseFreeShippingBar(e,t){let r=document.querySelector(`.free_shipping_bar_wrapper_${e}`);if(r){r.parentNode.removeChild(r);try{window.localStorage.setItem("freeShippingBarClosed",JSON.stringify({value:!0,id:e,updatedAt:t}))}catch(i){console.log(i)}}}function essentialFreeShippingInitSlider(e,t){let r=document.getElementById(`essential_product_slider_${e.id}`),i=window.location&&window.location.pathname.includes("/cart");if(r&&window.Glide){let a=r.offsetWidth,o;o=a>768||0===a?3:a<=768&&a>=480?2:1;let n=new Glide(`#essential_product_slider_${e.id}`,{type:"carousel",focusAt:0,gap:"callistowatches.myshopify.com"===Shopify.shop?"10":"30",peek:"callistowatches.myshopify.com"===Shopify.shop?{before:0,after:50}:0,perView:"cart-page"===e.type&&i?o:1,breakpoints:{768:{perView:"cart-page"===e.type&&i?o:1},480:{perView:1}}}),s=document.querySelectorAll(".essential_product_slider_glide__arrow");s.forEach(e=>{e.addEventListener("click",()=>{n.go(e.dataset.glideDir)})});let p=new ResizeObserver(()=>{n.update()});p.observe(document.getElementById(`essential_product_slider_${e.id}`)),n.mount(),"complete"!==document.readyState?document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&(r.classList.add("initialized"),n.update())}):t?setTimeout(()=>{n.update(),r.classList.add("initialized")},300):r.classList.add("initialized")}}function essentialFreeShippingGetVariant(e,t){let r=null;t.variants.find(i=>{let a=e.selectedProducts.find(e=>{let r=e.id.split("/"),i=parseInt(r[r.length-1]);return t.id===i}),o=a.variants[0].id.split("/"),n=parseInt(o[o.length-1]);i.id===n&&(r=i.id)});let i=t.variants.find(e=>e.id===r);return i}async function essentialFreeShippingFetchProductRecommendations(e){if(e){let t=await fetch(window.Shopify.routes.root+`recommendations/products.json?product_id=${e}&limit=4&intent=related`).then(e=>e.json()).then(e=>e);return t}}!function(){let e=null;async function t(){let t=window.Shopify?window.Shopify.shop:window.location.origin,r=window.essentialOrderValueBoosterConfigs,i=`https://freeshipping-essential-apps.uk/config/${t}`;if(r){let a=r.find(e=>e.locationType&&"on-countries"===e.locationType);return a&&await fetch("https://freeshipping-essential-apps.uk/config/geolocation").then(t=>{t.headers.has("country")&&(e=t.headers.get("country"))}),new Promise(e=>{e(r)})}return fetch(i).then(t=>(t.headers.has("country")&&(e=t.headers.get("country")),t.json()))}function r(e,t){let r=document.getElementsByTagName("head")[0],i=document.createElement("style");i.setAttribute("type","text/css"),i.setAttribute("data-id",t),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e)),r.appendChild(i)}function i(e){return""!==e.font&&e.font?`font-family: ${e.font}; `:""}function a(e,t,r=!1,i){let a,o,n;if(i){let s=t.variants[0].id.split("/"),p=s[s.length-1];a={id:p},o=t.image,n=100*t.price}else o=(a=r?t.variants.find(e=>e.available):essentialFreeShippingGetVariant(e,t))?.featured_image?.src||t.featured_image,n=a&&a.price?a.price:t.price;let l=window.Shopify.routes.root||"/",d=document.createElement("div");d.className=`free_shipping_card_product_${e.id}`,"cart-page"===e.type&&(d.className+=" cart_page");let c=document.createElement("img");if(o){let u=o.split(".png").length>2,h=o.split(".jpg").length>2,f=o.split(".webp").length>1;c.className=`free_shipping_card_product_image_${e.id}`,"moki-store-27.myshopify.com"===Shopify.shop||"callistowatches.myshopify.com"===Shopify.shop||"bluefire-fitness-6890.myshopify.com"===Shopify.shop||"mimmo-489.myshopify.com"===Shopify.shop||"0aeed7.myshopify.com"===Shopify.shop||"94ddf0.myshopify.com"===Shopify.shop||f||u||h?c.setAttribute("src",o):c.setAttribute("src",o.replace(".jpg","_120x.jpg").replace(".png","_120x.png")),c.setAttribute("alt",t.title),c.setAttribute("onclick",`location.href = "${l}products/${t.handle}"`)}d.append(c);let g=document.createElement("div");g.className=`free_shipping_card_product_meta_${e.id}`;let m=document.createElement("div");m.className=`free_shipping_card_product_title_${e.id}`,m.textContent+=t.title,m.setAttribute("onclick",`location.href = "${l}products/${t.handle}"`);let y=document.createElement("div");y.className=`free_shipping_card_product_price_${e.id}`;let $=moneyFormatEssentialApps(e.moneyFormat,n/100);y.textContent+=$;let b=document.createElement("a");return b.className=`free_shipping_card_product_cta_${e.id}`,b.textContent+=e.buttonText,"view-product"===e.CTAType?b.setAttribute("href",`${l}products/${t.handle}`):a&&b.setAttribute("onclick",`addToCartEssentialApps("${a.id}", "${e.id}")`),g.append(m),g.append(y),d.append(g),d.append(b),d}let o=(e,t,r,i)=>{let o=`
    `,n=document.createElement("div");n.innerHTML=o;let s=n.getElementsByClassName("essential_product_slider_glide__slides")[0],p=n.getElementsByClassName("essential_product_slider_glide__arrow--left")[0],l=n.getElementsByClassName("essential_product_slider_glide__arrow--right")[0];return p.append(prevArrowButtonIconSVG(e.style.arrowIconColor)),l.append(prevArrowButtonIconSVG(e.style.arrowIconColor)),t.forEach(t=>{let o=document.createElement("li");o.className="essential_product_slider_glide__slide",o.append(a(e,t,r,i)),s.append(o)}),n};async function n(){window.freeShippingBarConfigs.threshold=!0;let e=window.Shopify.routes.root||"/";return fetch(e+"cart.js").then(e=>e.json()).then(e=>(setTimeout(()=>{window.freeShippingBarConfigs.threshold=!1},300),e.items&&e.items.length>0)?(window.essentialOrderValueBoosterMeta.cartItems=e.items,e):(window.essentialOrderValueBoosterMeta.cartItems=[],e))}async function s(e,t,s,p){let l=window.Shopify.currency.active||"",d=e.currency||"",c;c=e?.updatedAt&&new Date(e.updatedAt).getTime()>1706182359e3?1:"product-page"===e.type||s?1:3;let u=e.upsellType||"",h=[],f,g=[],m=!1,y=null;if("frequently-bought"===u){let $;if("cart-page"===e.type&&window.essentialOrderValueBoosterMeta.cartItems&&window.essentialOrderValueBoosterMeta.cartItems[0]?$=window.essentialOrderValueBoosterMeta.cartItems[0].product_id:CURRENT_PRODUCT&&"undefined"!==CURRENT_PRODUCT&&"null"!==CURRENT_PRODUCT&&($=CURRENT_PRODUCT.id),!$&&s&&("testrial-6310-3.myshopify.com"===Shopify.shop||"essential-freshness.myshopify.com"===Shopify.shop)){let b=await n();b.items&&b.items[0]&&($=b.items[0].product_id),y=b.total_price}window.freeShippingBarRecommendedProducts?window.freeShippingBarRecommendedProducts[$]&&(g=window.freeShippingBarRecommendedProducts[$]):window.freeShippingBarRecommendedProducts=[],0===g.length&&(f=await essentialFreeShippingFetchProductRecommendations($))&&(g=f.products,e.excludeProducts&&e.excludeProducts.length>0&&(g=g.filter(t=>{let r=e.excludeProducts.find(e=>{if("vecchio-borgo-tartufi-funghi.myshopify.com"===Shopify.shop){let r=e.id.split("/").pop();return r==t.id}return e.handle===t.handle});return!r})),e.excludeProductTags&&e.excludeProductTags.length>0&&(g=g.filter(t=>{let r=e.excludeProductTags.find(e=>t.tags.includes(e));return!r})),window.freeShippingBarRecommendedProducts[$]=f.products)}let w=SELECTED_PRODUCTS.filter(t=>{let r=e.selectedProducts.find(e=>{if("glapru-amsterdam.myshopify.com"!==Shopify.shop&&"vecchio-borgo-tartufi-funghi.myshopify.com"!==Shopify.shop)return e.handle===t.handle;{let r=e.id.split("/").pop();return r==t.id}});return r});if(("products"===u||""===u&&w&&w.length>0)&&(h=w.filter(e=>{let t=window.essentialOrderValueBoosterMeta.cartItems.find(t=>"glapru-amsterdam.myshopify.com"===Shopify.shop||"vecchio-borgo-tartufi-funghi.myshopify.com"===Shopify.shop?t.product_id==e.id:t.handle===e.handle);return!t}).filter(t=>{let r=essentialFreeShippingGetVariant(e,t);return!r||r.available}).filter(e=>!CURRENT_PRODUCT||("glapru-amsterdam.myshopify.com"===Shopify.shop||"vecchio-borgo-tartufi-funghi.myshopify.com"===Shopify.shop?e.id!==CURRENT_PRODUCT.id:e.handle!==CURRENT_PRODUCT.handle))),d&&d!==l)return;let C=window.location&&window.location.pathname.includes("/cart");if(e.placement&&("cart-page"===e.type&&!C||"product-page"===e.type&&"all-products"===e.placement&&!window.location.pathname.includes("/products/")))return;let S=document.createElement("div");s?S.className=`free_shipping_card_wrapper_${e.id} placement_side_cart`:S.className=`free_shipping_card free_shipping_card_wrapper_${e.id}`,"cart-page"===e.type&&(S.className+=" cart_page"),s&&(S.style.display="flex");let x=document.createElement("div");x.className=`free_shipping_card_title_${e.id} h2`,null!==y?x.textContent+=cardTitleEssentialApps(e,y):x.textContent+=cardTitleEssentialApps(e,p),S.append(x);let _=document.createElement("div");_.className=`free_shipping_card_progress_${e.id}`;let T=document.createElement("div");T.className=`free_shipping_card_progress_bar_${e.id}`,T.style.width="0",_.append(T),S.append(_);let E=document.createElement("div");if(E.className=`free_shipping_products_wrapper_${e.id}`,"product-page"===e.type&&(E.className+=" product_page"),"cart-page"===e.type&&(E.className+=" cart_page"),s&&(E.className+=" side_cart"),w&&w.length>0&&"thumbprint-soap.myshopify.com"!==Shopify.shop){let v=h;if(v.length>c){E.className+=" upsell_products";let N=o(e,v);m=!0,E.append(N)}else v.length>0&&(s&&v[0]&&(v=Array(v[0])),v.forEach(t=>{let r=a(e,t);E.append(r)}));S.append(E)}else if(g&&g.length>0){if(E.className+=" upsell_products",g.length>1){let A=o(e,g,!0);m=!0,E.append(A)}else{let B=a(e,g[0],!0);E.append(B)}S.append(E)}else if(e.selectedProducts&&e.selectedProducts.length>0){let P=e.selectedProducts;if(s&&e.selectedProducts&&"kravitz2.myshopify.com"!==Shopify.shop&&(P=Array(e.selectedProducts[0])),P.length>c){E.className+=" upsell_products";let k=o(e,P,!1,!0);m=!0,E.append(k)}else P.forEach(t=>{let r=a(e,t,!1,!0);E.append(r)});S.append(E)}else S.className+=" no_products";if(!function e(t){let a=t.style,o=document.querySelector(`[data-id="${t.id}"]`);if(o)return;let n="gradientBackground"===a.backgroundType?`linear-gradient(${a.gradientTurn}deg, ${a.gradientStart}, ${a.gradientEnd})`:a.singleColor,s=` .free_shipping_card_wrapper_${t.id} { display: none; flex-flow: column; ${i(a)}background: ${n}; margin-top: ${a.outsideTopSpacing}px; margin-bottom: ${a.outsideBottomSpacing}px; padding: 0 16px; padding-top: ${a.insideTopSpacing}px; padding-bottom: ${a.insideBottomSpacing}px; border-radius: ${a.borderRadius}px; border: ${a.borderColor} solid ${a.borderSize}px; text-align: center; flex: auto; align-items: center; } .free_shipping_card_wrapper_${t.id}.placement_side_cart { flex: none; } .free_shipping_card_wrapper_${t.id}.placement_side_cart + .free_shipping_card_wrapper_${t.id}.placement_side_cart { display: none !important; } .free_shipping_card_wrapper_${t.id}.cart_page { width: 100%; } .free_shipping_card_title_${t.id}.h2 { ${i(a)}font-weight: bold; font-size: ${a.titleSize}px; color: ${a.titleColor}; margin: 0; padding: 0; line-height: 1.5; letter-spacing: normal; text-transform: none; text-align: center; } .free_shipping_card_progress_${t.id} { position: relative; max-width: 620px; margin-left: auto; margin-right: auto; margin-top: 15px; width: 100%; height: 8px; background: ${a.progressBackgroundColor}; border-radius: ${a.progressBorderRadius}px; } .no_products .free_shipping_card_progress_${t.id} { margin-bottom: 6px; } .free_shipping_card_progress_bar_${t.id} { position: absolute; left: 0px; display: block !important; height: 8px; background: ${a.progressBarBackgroundColor}; transition: width 2s; border-radius: ${a.progressBorderRadius}px; } .free_shipping_products_wrapper_${t.id}.product_page { width:100%; position: relative; } .free_shipping_products_wrapper_${t.id}.cart_page { display: flex; width: 100%; padding: 0px; margin-top: 18px; justify-content: center; flex-wrap: nowrap; position: relative; } .free_shipping_products_wrapper_${t.id}.upsell_products { margin-top: 18px; max-width: 1040px; display: block; position: relative; } @media(max-width: 1260px) { .free_shipping_products_wrapper_${t.id}.cart_page > div:nth-child(3) { display: none; } } @media(max-width: 750px) { .free_shipping_products_wrapper_${t.id}.cart_page > div:nth-child(2) { display: none; } } .free_shipping_card_product_${t.id} { display: flex; padding-top: 18px; width: 100%; max-width: 620px; margin: 0 auto; min-width: 0; justify-content: center; align-items: center; } .free_shipping_card_product_${t.id}.cart_page { padding: 4px 20px; border-radius: 8px; max-width: 420px; } .free_shipping_card_product_image_${t.id} { width: 44px; height: 44px; flex-shrink: 0; object-fit: cover; cursor: pointer; border-radius: 4px; overflow: hidden; } .free_shipping_card_product_meta_${t.id} { display: block; text-align: left; height: 100%; padding: 0 8px; width: 100%; min-width: 0; } .free_shipping_card_product_title_${t.id} { font-size: ${a.productTitleSize}px; color: ${a.productTitleColor}; white-space: nowrap; overflow: hidden; cursor: pointer; text-overflow: ellipsis; line-height: 1.5; } .free_shipping_card_product_price_${t.id} { font-size: ${a.productPriceSize}px; color: ${a.productPriceColor}; text-overflow: ellipsis; overflow: hidden; line-height: 1.5; } .free_shipping_card_product_cta_${t.id} { display: block; background-color: transparent; cursor: pointer !important; font-size: ${a.buttonTextSize}px; color: ${a.buttonTextColor}; border: 1px solid ${a.buttonBorderColor}; border-radius: ${a.buttonRadius}px; padding: 8px 12px; line-height: 1.2; cursor: pointer; white-space: nowrap; text-decoration: none; } .cart_page .free_shipping_card_product_${t.id} { padding: 4px 22px; } .side_cart .free_shipping_card_product_${t.id} { padding: 4px 0 !important; } .essential_product_slider_glide .free_shipping_card_product_${t.id} { padding: 0; width: 100%; margin: 0; max-width: 100%; justify-content: center; align-items: center; } @media(max-width: 420px) { .cart_page .free_shipping_card_product_${t.id} { padding: 0px; } } `;r(s,t.id)}(e),t&&("cart-page"===e.type?(document.querySelector(`.free_shipping_card_wrapper_${e.id}`)||t.prepend(S),window.freeShippingCardInitiated=!1):t.append(S),m&&(C?setTimeout(()=>{essentialFreeShippingInitSlider(e)},300):essentialFreeShippingInitSlider(e,s))),(p||g)&&null===y&&(window.freeShippingBarConfigs.threshold=!1),pollCartTotalEssentialApps(),updateTotalOnClick(e),"cart-page"===e.type){if("pinkblackpalermo.myshopify.com"!==Shopify.shop&&"essential-freshness.myshopify.com"!==Shopify.shop){let R=()=>{pollCartTotalEssentialApps()};window.freeShippingBarConfigs.polling||!C||s||(setInterval(R,2e3),window.freeShippingBarConfigs.polling=!0)}else setTimeout(()=>{updateTotalOnClick(e,!0)},500)}}let p=(e,t,r)=>{if(e.type!==t||r&&"custom"===e.timerPlacement)return!1;if(e.showOnCollections&&0!==e.showOnCollections.length){let i=decodeURI(window.location.pathname),a=e.showOnCollections.find(e=>i.includes(`collections/${e.handle}`));if(!a)return!1}return!0};function l(e,t){if(e.type!==t||window.location&&window.location.pathname.includes("/cart")&&"top-bar"!==e.type)return!1;if(e.showOnProducts&&0!==e.showOnProducts.length){let r=decodeURI(window.location.pathname),i=e.showOnProducts.find(e=>r.includes(`products/${e.handle}`));if(!i)return!1}if(e.showOnProductsInCollections&&0!==e.showOnProductsInCollections.length){let a=window.essentialOrderValueBoosterMeta.productCollections||[],o=e.showOnProductsInCollections.find(e=>{let t=Number(e.id.split("/").pop());return a.some(e=>e.id===t)});if(!o)return!1}if(e.excludeProducts&&0!==e.excludeProducts.length){let n=decodeURI(window.location.pathname),s=e.excludeProducts.find(e=>n.includes(`products/${e.handle}`));if(s)return!1}let p=CURRENT_PRODUCT?CURRENT_PRODUCT.tags:[],l=p.map(e=>e.toLowerCase());if(e.excludeProductTags&&e.excludeProductTags.length>0){let d=e.excludeProductTags.some(e=>l.includes(e.toLowerCase()));if(d)return!1}if(e.productTags&&e.productTags.length>0){let c=e.productTags.some(e=>l.includes(e.toLowerCase()));if(!c)return!1}return!0}function d(){let e,t=window.Shopify.routes.root||"/",r=document.querySelector(`form[action="${t}cart"]`),i=document.querySelectorAll("cart-notification .cart-notification__links");Shopify?.theme?.name&&Shopify?.theme?.name.toLowerCase().includes("prestige")&&(i=document.querySelectorAll("cart-drawer.cart-drawer.drawer"));let a=document.querySelectorAll(".side-cart"),o=document.querySelector(".order-value-booster-side-cart");return o?e=o:i.length>0?e=i[i.length-1]:r?e=r:a.length>0&&(e=a[a.length-1]),e}!function a(){let o=window.Shopify.routes.root||"/",n=[],c,u=document.querySelectorAll("div.order-value-booster-block"),h=document.querySelectorAll(`form[action="${o}cart/add"]`),f=document.querySelector(".essential-order-value-booster-placement"),g=document.querySelector(`form[action="${o}cart"]`),m=window.location&&window.location.pathname.includes("/cart");if(m&&g){let y=document.querySelectorAll(`form[action="${o}cart"]`);c=y[y.length-1]}let $=window.location&&window.location.pathname.includes("/products/");u&&u.length>0&&(n=Array.from(u).filter(e=>e&&""!==e.getAttribute("id"))),t().then(t=>{if(t&&!Array.isArray(t)||0===t.length)return null;let a=t.reduce((e,t)=>t.showInCountries&&t.showInCountries.length?[...e,...t.showInCountries]:e,[]),o=t.find(e=>e.locationType&&"on-countries"===e.locationType),u=t.filter(t=>{if(!o||!(a.length>0))return t;if("on-countries"===t.locationType){if(!e)return;return t.showInCountries.includes(e)}if(!a.includes(e))return t});u.forEach(e=>{if(e.translations&&e.translations.length>0){let t=e.translations.find(e=>e.locale===Shopify?.locale);t&&Object.assign(e,t)}}),window.freeShippingBarConfigs=u;let g=u.filter(e=>"top-bar"===e.type);g.forEach(e=>{e&&l(e,"top-bar")&&p(e,"top-bar")&&function e(t,a){let o=window.Shopify.currency.active||"",n=t.currency||"";if(n&&n!==o)return;let s=document.querySelector(".essential_free_shipping_bar_wrapper");if(s)return;if(t.placement){let p=window.location.pathname;if("home-page"===t.placement&&"/"!==p||"all-products"===t.placement&&!window.location.pathname.includes("/products/")||"all-collections"===t.placement&&!window.location.pathname.includes("/collections/"))return}let l=document.createElement("div");l.className=`essential_free_shipping_bar_wrapper free_shipping_bar_wrapper_${t.id}`;try{let d=window.localStorage.getItem("freeShippingBarClosed");if((d=JSON.parse(d))&&d.id===t.id&&d.updatedAt===t.updatedAt&&d.value)return}catch(c){console.log(c)}"top-page"===t.style.position&&t.style.stickyBar&&(l.className+=" top_page"),"bottom-page"===t.style.position&&(l.className+=" bottom_page");let u=document.createElement("div");u.className+=`free_shipping_bar_title_${t.id} h2`,u.textContent+=cardTitleEssentialApps(t);let h=document.createElement("div");h.append(u);let f=document.createElement("button");f.className=`free_shipping_bar_close_button_${t.id}`,f.setAttribute("onclick",`essentialCloseFreeShippingBar("${t.id}", "${t.updatedAt}")`),f.append(function e(t){let r=document.createElementNS("http://www.w3.org/2000/svg","svg"),i=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("width",12),r.setAttribute("height",12),r.setAttribute("fill","none"),i.setAttribute("d","m7.414 6 4.293-4.293A.999.999 0 1 0 10.293.293L6 4.586 1.707.293A.999.999 0 1 0 .293 1.707L4.586 6 .293 10.293a.999.999 0 1 0 1.414 1.414L6 7.414l4.293 4.293a.997.997 0 0 0 1.414 0 .999.999 0 0 0 0-1.414L7.414 6Z"),i.setAttribute("fill",t),r.append(i),r}(t.style.closeIconColor)),l.append(h),t.closeButton&&l.append(f),function e(t){let a=t.style,o="gradientBackground"===a.backgroundType?`linear-gradient(${a.gradientTurn}deg, ${a.gradientStart}, ${a.gradientEnd})`:a.singleColor,n=` .free_shipping_bar_wrapper_${t.id} { position: relative; ${i(a)}background: ${o}; z-index: 100; display: none; width: 100%; flex-wrap: wrap; ${"seperate-centered"===a.announcementBarStyle?`flex-flow: column; justify-items: center;`:""} align-items: center; justify-content: center; padding: 10px; column-gap: 26px; row-gap: 10px; border-bottom: ${a.borderColor} solid ${a.borderSize}px; } .free_shipping_bar_wrapper_${t.id}.top_page { position: sticky; top: 0; } .free_shipping_bar_wrapper_${t.id}.bottom_page { bottom: 0; left: 0; position: fixed; width: 100%; border-bottom: none; border-top: ${a.borderColor} solid ${a.borderSize}px; } .free_shipping_bar_title_${t.id}.h2 { ${i(a)}font-weight: bold; font-size: ${a.titleSize}px; color: ${a.titleColor}; margin: 0; padding: 0; line-height: 1.2; letter-spacing: normal; text-transform: none; text-align: center; } .free_shipping_bar_close_button_${t.id} { position: absolute; display: block; border: none; background: none; padding: 6px; cursor: pointer; top: 50%; right: 10px; transform: translate(0, -50%); } .free_shipping_bar_close_button_${t.id} svg { width: 12px; height: 12px; display: block; } @media (max-width: 430px) { .free_shipping_bar_wrapper_${t.id} { justify-items: center; text-align: center; padding: 10px 15px; } .free_shipping_bar_close_button_${t.id} { position: absolute; padding: 0; transform: none; top: 5px; right: 5px; } .free_shipping_bar_title_${t.id} { text-align: center; } } `;r(n,t.id)}(t);let g=document.querySelector(".essential-free-shipping-bar");g?g.append(l):document.querySelector("body").prepend(l),pollCartTotalEssentialApps(),updateTotalOnClick(t);let m=window.location&&window.location.pathname.includes("/cart");if(m){let y=()=>{pollCartTotalEssentialApps()};!window.freeShippingBarConfigs.polling&&m&&(setInterval(y,2e3),window.freeShippingBarConfigs.polling=!0)}}(e)});let y;y=f||h[h.length-1],u.forEach(e=>{l(e,"product-page")&&$&&y&&"custom"!==e.placement&&0===n.length&&s(e,y)}),n.forEach(e=>{let t=e.getAttribute("id"),r=u.find(e=>e.id===t);r&&l(r,"product-page")&&e&&s(r,e)});let b=window.Shopify.currency.active||"";if(d()&&!m){let w=d(),C=u.find(e=>{let t=e.currency||"";return"cart-page"===e.type&&(""===t||t===b)});if(C){"frequently-bought"===C.upsellType?window.freeShippingCardInitiated=!0:window.freeShippingCardInitiated=!1,s(C,w,!0),Shopify?.theme?.name&&Shopify?.theme?.name.toLowerCase().includes("prestige")&&w.classList&&w.classList.contains("cart-drawer")&&w.classList.contains("drawer")&&document.addEventListener("cart-drawer:refreshed",()=>{let e=d();s(C,e,!0,window.freeShippingBarConfigs.prevCartTotalPrice)});let S=new MutationObserver(e=>{if(e&&e[0]&&e[0].removedNodes&&e[0].removedNodes.length&&"cart-page-inline-timer h2"===e[0].removedNodes[0].className)return;let t=document.querySelector(`.free_shipping_card_wrapper_${C.id}`),r=d();window.freeShippingCardInitiated||(t?pollCartTotalEssentialApps():(window.freeShippingBarConfigs.prevCartTotalPrice||(window.freeShippingBarConfigs.prevCartTotalPrice=1),s(C,r,!0,window.freeShippingBarConfigs.prevCartTotalPrice)))});if(!window.freeShippingBarConfigs.observer&&w){let x;x=w.parentNode.parentNode.parentNode&&"BODY"!==w.parentNode.parentNode.parentNode.tagName&&"HTML"!==w.parentNode.parentNode.parentNode.tagName?w.parentNode.parentNode.parentNode:w.parentNode.parentNode&&"BODY"!==w.parentNode.parentNode.tagName&&"HTML"!==w.parentNode.parentNode.tagName?w.parentNode.parentNode:w.parentNode,S.observe(x,{childList:!0,subtree:!0}),window.freeShippingBarConfigs.observer=!0}}}if(m){if(0===n.length){let _=u.find(e=>{let t=e.currency||"";return"cart-page"===e.type&&(""===t||t===b)});_&&c&&s(_,c.parentNode)}else n.forEach(e=>{let t=e.getAttribute("id"),r=u.find(e=>e.id===t);r&&e&&s(r,e)})}})}()}();