(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))c(o);new MutationObserver(o=>{for(const t of o)if(t.type==="childList")for(const s of t.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&c(s)}).observe(document,{childList:!0,subtree:!0});function e(o){const t={};return o.integrity&&(t.integrity=o.integrity),o.referrerPolicy&&(t.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?t.credentials="include":o.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function c(o){if(o.ep)return;o.ep=!0;const t=e(o);fetch(o.href,t)}})();const u={async fetchProduct(n){var o;const e=await(await fetch(`${window.Shopify.routes.root}products/${n}.js`)).json();return{id_json:e.id,id:e.id,handle:e.handle,title:e.title,selected_variant:(o=e.variants[0])==null?void 0:o.id.toString(),image_src:e.featured_image?e.featured_image+"?width=100&height=100":null,options:e.options.map(t=>({name:t.name,values:t.values.map(s=>s)})),variants:e.variants.map(t=>{var s,r;return{available:t.available,id:t.id,title:t.title,compare_at_price:t.compare_at_price,compare_at_price_raw:t.compare_at_price,price:t.price,price_raw:t.price,image_src:(s=t.featured_image)!=null&&s.src?((r=t.featured_image)==null?void 0:r.src)+"?width=100&height=100":null,options:t.options.map(a=>a)}})}},async handleHomePage(){var c;const n=window.zoorix_sticky_atc_template==="index",i=window.zoorix_sticky_atc_config,e=(c=i==null?void 0:i.display_settings)==null?void 0:c.homeProduct;if(n&&!window.zoorix_sticky_atc_product&&e){const o=await this.fetchProduct(e.handle);window.zoorix_sticky_atc_product=o}},async handleCollectionPage(){var o;const n=window.zoorix_sticky_atc_template==="collection",i=window.zoorix_sticky_atc_config,e=((o=i==null?void 0:i.display_settings)==null?void 0:o.collectionGroups)??[],c=window.zoorix_sticky_collection_handle;if(n&&e&&c){const t=e.find(s=>s.collection.handle===c);if(t){const s=await this.fetchProduct(t.product.handle);window.zoorix_sticky_atc_product=s}}},async handleCustomPage(){var o;const n=((window==null?void 0:window.zoorix_sticky_atc_template)??"").includes("page"),i=window.zoorix_sticky_atc_config,e=((o=i==null?void 0:i.display_settings)==null?void 0:o.pageGroups)??[],c=window.zoorix_sticky_page_handle;if(n&&e&&c){const t=e.find(s=>s.page.handle===c);if(t){const s=await this.fetchProduct(t.product.handle);window.zoorix_sticky_atc_product=s}}},checkDisableProducts(){var o,t;const n=window.zoorix_sticky_atc_template.includes("product"),i=window.zoorix_sticky_atc_config,e=(o=i==null?void 0:i.display_settings)==null?void 0:o.notShowProducts,c=(t=window.zoorix_sticky_atc_product)==null?void 0:t.id;e&&c&&n&&e.some(r=>r.id.includes(c))&&(window.zoorix_sticky_atc_product=null)},checkDisableCollections(){var o,t,s;const n=(o=window.zoorix_sticky_atc_product)==null?void 0:o.id,i=(s=(t=window.zoorix_sticky_atc_config)==null?void 0:t.display_settings)==null?void 0:s.notShowCollections,e=window.zoorix_sticky_collections_data;let c=!1;if(!n||!i||!e)return!1;for(const r of i){const a=r.id.split("/").pop();for(const d in e)if(e[d].id==a&&e[d].products.map(l=>l.id).includes(n)){c=!0;break}if(c)break}c&&(window.zoorix_sticky_atc_product=null)},async handleDisplay(){this.checkDisableCollections(),this.checkDisableProducts(),await this.handleHomePage(),await this.handleCollectionPage(),await this.handleCustomPage()}};u.handleDisplay().then(()=>{if(!window.zoorix_sticky_atc_product)return;window.zoorix_sticky_atc_product_display_handled=!0;const n=window.zoorix_sticky_atc_config.widget_dev,i=`https://public.zoorix.com/satc-widget-dev/${n}`,e=window.zoorix_sticky_atc_config.css_theme||"default",c=document.createElement("link");c.rel="stylesheet",c.href=n?`${i}/css_themes/${e}.css`:`https://satc-display-cloudflare.zoorix.com/css_themes/${e}.css`,document.head.appendChild(c);var o=document.createElement("script");o.src=n?`${i}/core-utils.js`:"https://frontend-utils-cloudflare.zoorix.com/core-utils.js",o.async=!0,o.setAttribute("type","module"),document.head.appendChild(o);const t=document.createElement("script");t.src=n?`${i}/js/sticky-atc.js`:"https://satc-widget-cloudflare.zoorix.com/js/sticky-atc.js",t.async=!0,document.head.appendChild(t)});