{
  "version": 3,
  "sources": ["/cdn/shop/t/23/assets/custom.js?enable_js_minification=1"],
  "sourcesContent": ["/*\n* Pipeline Theme\n*\n* Use this file to add custom Javascript to Pipeline.  Keeping your custom\n* Javascript in this fill will make it easier to update Pipeline. In order\n* to use this file you will need to open layout/theme.liquid and uncomment\n* the custom.js script import line near the bottom of the file.\n*\n*/\n\n\n(function() {\n\n    // Below are example event listeners.  They listen for theme events that Pipeline\n    // fires in order to make it easier for you to add customizations.\n  \n    // Keep your scripts inside this IIFE function call to avoid leaking your\n    // variables into the global scope.\n  \n    /*\n    document.addEventListener('theme:variant:change', function(event) {\n      // You might use something like this to write a pre-order feature or a\n      // custom swatch feature.\n      var variant = event.detail.variant;\n      var container = event.target;\n      if (variant) {\n        console.log('Container \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014 \u2193');\n        console.log(container);\n        console.log('Variant \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014 \u2193');\n        console.log(variant);\n        // ... update some element on the page\n      }\n    });\n  \n    document.addEventListener('theme:cart:change', function(event) {\n      var cart = event.detail.cart;\n      if (cart) {\n        console.log('Cart \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014 \u2193');\n        console.log(cart);\n        // ... update an app or a custom shipping caluclator\n      }\n    });\n    // Fired when page loads to update header values\n    document.addEventListener('theme:cart:init', (e) => {\n      console.log('theme:cart:init');\n      console.log(e);\n    });\n  \n    // Debounced scroll listeners.  Up and down only fire on direction changes\n    // These events are useful for creating sticky elements and popups.\n    document.addEventListener('theme:scroll', e => { console.log(e); });\n    document.addEventListener('theme:scroll:up', e => { console.log(e); });\n    document.addEventListener('theme:scroll:down', e => { console.log(e); });\n  \n    // Debounced resize listener to bundle changes that trigger document reflow\n    document.addEventListener('theme:resize', e => { console.log(e); });\n  \n    // Locks and unlocks page scroll for modals and drawers\n    // These are commented out because firing them will lock the page scroll\n    // the lock event must set `detail` to the modal or drawer body so the \n    // scroll locking code knows what element should maintain scoll. \n    // document.dispatchEvent(new CustomEvent('theme:scroll:lock', {bubbles: true, detail: scrollableInnerElement}));\n    // document.dispatchEvent(new CustomEvent('theme:scroll:unlock', {bubbles: true}));\n  \n  \n    // ^^ Keep your scripts inside this IIFE function call to avoid leaking your\n    // variables into the global scope.\n  \n    */\n  \n  \n  \n    if(document.querySelector(\".product-section.buy-it-now\")){\n  \n      // create an object to hold the items \"added\" to the cart\n      var productObj = {};\n  \n      function addItemToCart(data) {\n  \n        const cartCountHandleDesktop = document.querySelector('.header__desktop .count');\n        var cartCountDesktop = cartCountHandleDesktop.innerText;\n  \n        const cartCountHandleMobile = document.querySelector('.header__mobile .count');\n        var cartCountMobile = cartCountHandleMobile.innerText;\n  \n        const addingItems = document.querySelector('.cart-status .adding');\n        const itemsAdded = document.querySelector('.cart-status .added');\n        addingItems.classList.add(\"show\");\n        itemsAdded.innerHTML = `Cart updated.  <a href=\"/cart\">View cart</a>`;\n  \n        fetch('/cart/add.js', {\n          method: 'POST',\n          headers: {\n            'Content-Type': 'application/json'\n          },\n          body: JSON.stringify(data)\n        }).then((response) => {\n          if (response.ok) {\n            console.log(\"Items added! Server response: \" + response.status)\n            addingItems.classList.remove(\"show\");\n            itemsAdded.classList.add(\"show\");\n            document.querySelector(\".add-option-to-cart\").disabled = true;\n            cartCountHandleDesktop.innerHTML = +cartCountDesktop + 1;\n            cartCountHandleMobile.innerHTML = +cartCountMobile + 1;\n          } else {\n            response.json().then(function (content) { \n              addingItems.classList.remove(\"show\");\n              itemsAdded.innerHTML = \"Error: \"+content.description+\" (no item added to cart)\";\n              itemsAdded.classList.add(\"show\",\"error\");\n            });\n          }\n        }).catch((error) => {\n          console.log('Error:', error);\n        });\n          \n      }\n  \n  \n      const addOptionsToCart = document.querySelector('.add-option-to-cart');\n      addOptionsToCart.addEventListener('click', function(e) {\n      \n        e.preventDefault();\n        console.clear();\n  \n        // declare the payload array; convert to JSON later\n        var cartDataPayload = [];\n  \n        for(product in productObj){\n  \n            thisVariant = product;\n            thisSellingPlan = productObj[product].sellingPlan;\n  \n            if(thisSellingPlan == \"\"){\n              cartDataPayload.push({quantity: 1, id: thisVariant});\n            }else{\n              cartDataPayload.push({quantity: 1, id: thisVariant, selling_plan: thisSellingPlan});\n            }\n  \n        }\n  \n        const cartData = { items: cartDataPayload};\n      \n        addItemToCart(cartData);\n      \n      \n      });\n  \n  \n      // Visual stuff - update the clicked options div, update the price and the button\n      document.querySelectorAll(\".soundbites-product-options .option\").forEach(item => {\n        item.addEventListener('click', function() {\n  \n            // item was just selected so empty the object (we're using radio buttons so only one item selectable at a time)\n            for (var product in productObj) delete productObj[product];\n  \n            // deselect everything\n            document.querySelectorAll(\".soundbites-product-options .option\").forEach(el => { el.classList.remove(\"active\") });\n            document.querySelector(\".cart-status .added\").classList.remove(\"show\");\n            \n            // check the state of what was just clicked\n            var nearestRadioButton = item.querySelector(\"input[name='product_type[]']\");\n  \n            nearestRadioButton.checked = true;\n            item.classList.add(\"active\");\n  \n            // update the productObj with the handle\n            thisTitle = nearestRadioButton.dataset.title;\n            thisPrice = nearestRadioButton.dataset.price;\n            thisVariant = nearestRadioButton.dataset.variantId;\n            thisSellingPlan = nearestRadioButton.dataset.sellingPlan;\n            productObj[thisVariant] = { price: thisPrice, title: thisTitle, sellingPlan: thisSellingPlan};\n  \n          \n  \n          console.clear();\n          console.table(productObj);\n  \n          var totalPrice = 0;\n  \n          for (product in productObj) {\n            totalPrice += productObj[product].price / 100;\n          }\n  \n          document.querySelector(\".add-option-to-cart span.btn-price\").innerHTML = \"$\"+totalPrice;\n          document.querySelector(\".product__price span\").innerHTML = \"$\"+totalPrice;\n  \n          \n  \n          if(totalPrice == 0){\n            document.querySelector(\".add-option-to-cart\").disabled = true;\n          }else{\n            document.querySelector(\".add-option-to-cart\").disabled = false;\n          }\n  \n        });\n      });\n  \n    };\n  \n  \n  \n  })();\n  \n  \n  window.addEventListener('DOMContentLoaded', (event) => {\n  \n  \n    // Countries where Soundbites can ship and accept orders.\n    // Add a country code here whenever you create a new Shopify market.\n    const ALLOWED_COUNTRIES = [\"US\", \"CA\", \"HK\", \"GB\", \"NL\", \"CN\"];\n\n    // Per-country variant restrictions for the Soundbites Product section.\n    // Use this when a country only ships certain quantities (mirrors the\n    // shipping profile rules so customers don't add invalid options to cart).\n    //\n    // - allowedOnetimeQuantities: array of strings matching data-onetime-qty\n    // - allowedSubscribeKeyword:  substring matched against the visible card\n    //                             title text (case-insensitive). Use null to\n    //                             skip the subscribe-mode filter.\n    // Per-country variant restrictions. `allowStarterKit: true` opts a country\n    // into the separate \"Starter Kit\" Shopify product block on the page; absence\n    // (or false) hides it for that country. Countries with NO entry here see\n    // every option (no restriction runs).\n    const COUNTRY_VARIANT_RESTRICTIONS = {\n      \"HK\": {\n        allowedOnetimeQuantities: [\"3\"],\n        allowedSubscribeKeyword: \"3 bottles\"\n        // no allowStarterKit \u2192 Starter Kit hidden for HK\n      },\n      \"GB\": {\n        allowedOnetimeQuantities: [\"3\"],\n        allowedSubscribeKeyword: \"3 bottles\",\n        allowStarterKit: true\n      },\n      \"NL\": {\n        allowedOnetimeQuantities: [\"3\"],\n        allowedSubscribeKeyword: \"3 bottles\",\n        allowStarterKit: true\n      },\n      \"CN\": {\n        allowedOnetimeQuantities: [\"3\"],\n        allowedSubscribeKeyword: \"3 bottles\",\n        allowStarterKit: true\n      }\n    };\n\n    function applyVariantRestrictions(country) {\n      const restriction = COUNTRY_VARIANT_RESTRICTIONS[country];\n      if (!restriction) return;\n\n      console.log(\"Applying variant restriction for \" + country + \":\", restriction);\n\n      // 1. Hide one-time quantity cards that aren't on the allowed list\n      document.querySelectorAll('[data-onetime-qty]').forEach(card => {\n        if (!restriction.allowedOnetimeQuantities.includes(card.dataset.onetimeQty)) {\n          card.style.display = \"none\";\n        }\n      });\n\n      // 2. Always hide the custom quantity input for restricted countries\n      document.querySelectorAll('[data-onetime-custom]').forEach(el => {\n        el.style.display = \"none\";\n      });\n\n      // 2b. Hide the Starter Kit block unless this country opts in.\n      if (!restriction.allowStarterKit) {\n        document.querySelectorAll('[data-starter-kit-block]').forEach(el => {\n          el.style.display = \"none\";\n        });\n      }\n\n      // 3. Auto-select the first allowed one-time card so the price + qty\n      //    update immediately (the section's own click handler does the work)\n      const firstAllowedOnetime = document.querySelector(\n        '[data-onetime-qty=\"' + restriction.allowedOnetimeQuantities[0] + '\"]'\n      );\n      if (firstAllowedOnetime) firstAllowedOnetime.click();\n\n      // 4. Hide subscribe-mode variant cards that don't match the keyword\n      if (restriction.allowedSubscribeKeyword) {\n        const keyword = restriction.allowedSubscribeKeyword.toLowerCase();\n        let allowedSubCard = null;\n\n        document.querySelectorAll('[data-variant-card]').forEach(card => {\n          const qtyEl = card.querySelector('.sb-product__card-qty');\n          const qtyText = (qtyEl ? qtyEl.textContent : '').trim().toLowerCase();\n          if (qtyText.includes(keyword)) {\n            allowedSubCard = card;\n          } else {\n            card.style.display = \"none\";\n          }\n        });\n\n        // Auto-select the matching subscribe card if found\n        if (allowedSubCard) allowedSubCard.click();\n      }\n    }\n\n    async function getLocation() {\n      const response = await fetch('/browsing_context_suggestions.json');\n      const location = await response.json();\n      const country = location.detected_values.country.handle;\n\n      if(ALLOWED_COUNTRIES.includes(country)){\n        console.log(\"Customer is in a supported country: \" + country);\n\n        document.querySelectorAll(\".us-item\").forEach(el => { el.classList.add(\"show\") });\n        document.querySelectorAll(\".international-item\").forEach(el => { el.classList.add(\"hide\") });\n\n        // Apply any per-country variant restrictions\n        applyVariantRestrictions(country);\n      }else{\n        console.log(\"Customer is outside supported countries: \" + country);\n\n        document.querySelectorAll(\".us-item\").forEach(el => { el.classList.add(\"hide\") });\n        document.querySelectorAll(\".international-item\").forEach(el => { el.classList.add(\"show\") });\n      }\n\n    }\n    \n    getLocation();\n    \n  });"],
  "mappings": "CAWC,UAAW,CA6DR,GAAG,SAAS,cAAc,6BAA6B,EAAE,CAKvD,IAASA,eAAT,SAAuB,KAAM,CAE3B,MAAM,uBAAyB,SAAS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