{
  "version": 3,
  "sources": ["/cdn/shop/t/9/assets/pdp-add-to-cart.js?cv=4"],
  "sourcesContent": ["// pdp-add-to-cart.js\r\n// Lightweight UUIDv4 generator to avoid external imports in the browser\r\nfunction uuidv4() {\r\n  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\r\n    const r = Math.random() * 16 | 0;\r\n    const v = c === 'x' ? r : (r & 0x3) | 0x8;\r\n    return v.toString(16);\r\n  });\r\n}\r\n\r\n(function() {\r\n  if (typeof window === 'undefined') return;\r\n\r\n  document.addEventListener('DOMContentLoaded', () => {\r\n    try {\r\n      setupProductForms(document);\r\n    } catch (e) {\r\n      console.warn('pdp-add-to-cart: init error', e);\r\n    }\r\n  });\r\n\r\n  async function setupProductForms(root) {\r\n    const forms = Array.from(root.querySelectorAll('form[action*=\"/cart/add\"]'));\r\n    if (!forms.length) return;\r\n  \r\n    for (const form of forms) {\r\n      // Only attach variant sync - don't attach AJAX submit handlers at all.\r\n      // The product-form custom element or native form submission will handle the actual submit.\r\n      // Our job is just to ensure the hidden variant id is correct when options change.\r\n      attachVariantSync(form);\r\n    }\r\n  }\r\n\r\n  function getProductSectionForForm(form) {\r\n    return form.closest('product-info') || document.querySelector('product-info[data-url]');\r\n  }\r\n\r\n  function getProductUrlForForm(form) {\r\n    const section = getProductSectionForForm(form);\r\n    let url = section ? section.getAttribute('data-url') : null;\r\n    if (!url) {\r\n      const m = window.location.pathname.match(/\\/products\\/[^/?#]+/i);\r\n      url = m ? m[0] : null;\r\n    }\r\n    return url;\r\n  }\r\n\r\n  const productJsonCache = new Map();\r\n  // Per-form guard to avoid re-entrancy when we programmatically update the hidden variant input.\r\n  // Use a WeakMap so entries are GC'd when the form is removed.\r\n  const _pdpUpdatingHiddenVariant = new WeakMap();\r\n\r\n  async function getProductJsonForForm(form) {\r\n    const url = getProductUrlForForm(form);\r\n    if (!url) return null;\r\n    const abs = url.endsWith('.js') ? url : `${url}.js`;\r\n    if (productJsonCache.has(abs)) return productJsonCache.get(abs);\r\n    try {\r\n      const res = await fetch(abs, { credentials: 'same-origin' });\r\n      if (!res.ok) throw new Error(`fetch ${abs} failed`);\r\n      const data = await res.json();\r\n      productJsonCache.set(abs, data);\r\n      return data;\r\n    } catch (e) {\r\n      console.warn('pdp-add-to-cart: product json fetch failed', e);\r\n      return null;\r\n    }\r\n  }\r\n\r\nfunction readSelectedOptionsFromForm(form, product) {\r\n  const names = Array.isArray(product?.options) && product.options.length ? product.options : ['Option1', 'Option2', 'Option3'];\r\n  const values = [];\r\n\r\n  // Debug: log the raw product options\r\n  try { console.info('pdp-add-to-cart:raw-options', { options: product?.options, names }); } catch (_) {}\r\n\r\n  // Helper: query within the form element or fallback to inputs that are associated via the form=\"\" attribute\r\n  function querySelectorWithinForm(selector) {\r\n    // Prefer descendant\r\n    const found = form.querySelector(selector);\r\n    if (found) return found;\r\n    // Fallback to global element associated to this form via form=id attribute\r\n    if (form.id) {\r\n      try {\r\n        return document.querySelector(`${selector}[form=\"${CSS.escape(form.id)}\"]`);\r\n      } catch (_) {\r\n        return null;\r\n      }\r\n    }\r\n    return null;\r\n  }\r\n\r\n  function querySelectorAllWithinForm(selector) {\r\n    const list = Array.from(form.querySelectorAll(selector));\r\n    if (form.id) {\r\n      try {\r\n        const extras = Array.from(document.querySelectorAll(`${selector}[form=\"${CSS.escape(form.id)}\"]`));\r\n        extras.forEach(e => { if (!list.includes(e)) list.push(e); });\r\n      } catch (_) {}\r\n    }\r\n    return list;\r\n  }\r\n\r\n  for (let i = 0; i < names.length; i++) {\r\n    // Fix option name parsing - ensure it's a string\r\n    let name = names[i];\r\n    if (typeof name === 'object' && name !== null) {\r\n      name = name.name || name.toString();\r\n    }\r\n    name = String(name || '').trim();\r\n    let value = '';\r\n\r\n    // Debug: log what we're looking for\r\n    try { console.info('pdp-add-to-cart:option-search', { optionIndex: i, optionName: name, rawOption: names[i] }); } catch (_) {}\r\n\r\n    // 1) Standard options[Name] - try both exact name and with various whitespace/newline variations\r\n    if (name) {\r\n      // Try exact match first\r\n      let sel = querySelectorWithinForm(`select[name=\"options[${CSS.escape(name)}]\"]`);\r\n      if (sel) {\r\n        value = sel.value;\r\n        try { console.info('pdp-add-to-cart:found-select', { name, value, selector: `select[name=\"options[${name}]\"]` }); } catch (_) {}\r\n      }\r\n      \r\n      if (!value) {\r\n        const checked = querySelectorWithinForm(`input[name=\"options[${CSS.escape(name)}]\"]:checked`);\r\n        if (checked) {\r\n          value = checked.value;\r\n          try { console.info('pdp-add-to-cart:found-input', { name, value, selector: `input[name=\"options[${name}]\"]:checked` }); } catch (_) {}\r\n        }\r\n      }\r\n      \r\n      // Handle names with whitespace/newlines (like \"Color-2\\n\")\r\n      if (!value) {\r\n        try {\r\n          // First try form-associated radios\r\n          const inputs = querySelectorAllWithinForm('input[type=\"radio\"]:checked');\r\n          \r\n          // Also try global search for checked radios (fallback)\r\n          let globalInputs = [];\r\n          try {\r\n            globalInputs = Array.from(document.querySelectorAll('input[type=\"radio\"]:checked'));\r\n          } catch (_) {}\r\n          \r\n          // Combine both searches, avoiding duplicates\r\n          const allInputs = [...inputs];\r\n          globalInputs.forEach(inp => {\r\n            if (!allInputs.includes(inp)) allInputs.push(inp);\r\n          });\r\n          \r\n          try { console.info('pdp-add-to-cart:checked-radios', {\r\n            formInputs: inputs.length,\r\n            globalInputs: globalInputs.length,\r\n            total: allInputs.length,\r\n            names: allInputs.map(i => i.name),\r\n            values: allInputs.map(i => i.value)\r\n          }); } catch (_) {}\r\n          \r\n          const match = allInputs.find(inp => {\r\n            const inputName = String(inp.name || '').trim();\r\n            const cleanInputName = inputName.replace(/[\\r\\n\\t\\s\\-\\d]+/g, '').toLowerCase();\r\n            const cleanTargetName = name.replace(/[\\r\\n\\t\\s\\-\\d]+/g, '').toLowerCase();\r\n            \r\n            // Try multiple matching strategies\r\n            const matches = (\r\n              inputName === name ||\r\n              cleanInputName === cleanTargetName ||\r\n              inputName.includes(name) ||\r\n              name.includes(inputName.replace(/[\\r\\n\\-\\d]+/g, '')) ||\r\n              // Handle cases like \"Color-2\\n\" matching \"Color\"\r\n              cleanInputName.includes(cleanTargetName) ||\r\n              cleanTargetName.includes(cleanInputName) ||\r\n              // Handle partial matches after removing suffixes/prefixes\r\n              inputName.replace(/[\\r\\n\\-\\d]+.*$/g, '').toLowerCase() === name.toLowerCase() ||\r\n              name.replace(/[\\r\\n\\-\\d]+.*$/g, '').toLowerCase() === inputName.toLowerCase()\r\n            );\r\n            \r\n            try { console.info('pdp-add-to-cart:radio-match-attempt', {\r\n              optionName: name,\r\n              inputName,\r\n              inputValue: inp.value,\r\n              cleanInputName,\r\n              cleanTargetName,\r\n              matches\r\n            }); } catch (_) {}\r\n            \r\n            return matches;\r\n          });\r\n          if (match) {\r\n            value = match.value || '';\r\n            try { console.info('pdp-add-to-cart:found-radio-match', { name, value, inputName: match.name }); } catch (_) {}\r\n          }\r\n        } catch (_) {}\r\n      }\r\n    }\r\n\r\n    // 2) option1/2/3 style\r\n    if (!value) {\r\n      const sel2 = querySelectorWithinForm(`select[name=\"option${i + 1}\"]`);\r\n      if (sel2) value = sel2.value;\r\n    }\r\n    if (!value) {\r\n      const checked2 = querySelectorWithinForm(`input[name=\"option${i + 1}\"]:checked`);\r\n      if (checked2) value = checked2.value;\r\n    }\r\n\r\n    // 3) Fieldset with legend/label containing option name (prefer form-associated groups first)\r\n    if (!value && name) {\r\n      const groups = querySelectorAllWithinForm('fieldset, .product-form__input');\r\n      const fieldset = groups.find(fs => {\r\n        const labelTxt =\r\n          (fs.getAttribute('aria-label') ||\r\n            fs.querySelector('legend, label')?.textContent ||\r\n            '').toLowerCase();\r\n        const cleanLabel = labelTxt.replace(/[\\r\\n\\t\\s\\-\\d]+/g, '');\r\n        const cleanName = name.replace(/[\\r\\n\\t\\s\\-\\d]+/g, '').toLowerCase();\r\n        \r\n        return (\r\n          labelTxt.includes(name.toLowerCase()) ||\r\n          cleanLabel.includes(cleanName) ||\r\n          cleanName.includes(cleanLabel) ||\r\n          labelTxt.includes(name.replace(/[\\r\\n\\-\\d]+.*$/g, '').toLowerCase())\r\n        );\r\n      });\r\n      if (fieldset) {\r\n        // Try checked radio inside the fieldset first (descendant or associated by form)\r\n        let radio = fieldset.querySelector('input[type=\"radio\"]:checked');\r\n        if (!radio && form.id) {\r\n          radio = document.querySelector(`input[type=\"radio\"][form=\"${CSS.escape(form.id)}\"]:checked`) || null;\r\n        }\r\n        if (radio) value = radio.value || '';\r\n      }\r\n    }\r\n    \r\n    // 4) Global fallback: some themes render swatches outside the target form and associate them\r\n    // with a different form id. If we've not resolved a value yet, search the entire document for\r\n    // a fieldset / swatch group whose label contains the option name and use its checked value.\r\n    if (!value && name) {\r\n      try {\r\n        const globalGroups = Array.from(document.querySelectorAll('fieldset, .product-form__input'));\r\n        const globalFieldset = globalGroups.find(fs => {\r\n          const labelTxt =\r\n            (fs.getAttribute('aria-label') ||\r\n              fs.querySelector('legend, label')?.textContent ||\r\n              '').toLowerCase();\r\n          const cleanLabel = labelTxt.replace(/[\\r\\n\\t\\s\\-\\d]+/g, '');\r\n          const cleanName = name.replace(/[\\r\\n\\t\\s\\-\\d]+/g, '').toLowerCase();\r\n          \r\n          return (\r\n            labelTxt.includes(name.toLowerCase()) ||\r\n            cleanLabel.includes(cleanName) ||\r\n            cleanName.includes(cleanLabel) ||\r\n            labelTxt.includes(name.replace(/[\\r\\n\\-\\d]+.*$/g, '').toLowerCase())\r\n          );\r\n        });\r\n        if (globalFieldset) {\r\n          // Prefer a checked radio inside the group, else first radio/select value\r\n          const checkedRadio = globalFieldset.querySelector('input[type=\"radio\"]:checked');\r\n          if (checkedRadio) {\r\n            value = checkedRadio.value || '';\r\n          } else {\r\n            const anyRadio = globalFieldset.querySelector('input[type=\"radio\"]');\r\n            if (anyRadio) value = anyRadio.value || '';\r\n            const sel = globalFieldset.querySelector('select');\r\n            if (!value && sel) value = sel.value || '';\r\n          }\r\n        }\r\n      } catch (_) {}\r\n    }\r\n\r\n    values[i] = value || '';\r\n  }\r\n\r\n  return values;\r\n}\r\n\r\n  function findVariantByOptions(product, options) {\r\n    if (!product || !Array.isArray(product.variants)) return null;\r\n    const normalized = options.map(v => String(v || '').trim().toLowerCase());\r\n\r\n    return product.variants.find(v => {\r\n      const ops = [v.option1, v.option2, v.option3].map(x => String(x || '').trim().toLowerCase());\r\n      for (let i = 0; i < normalized.length; i++) {\r\n        if (!normalized[i]) continue;\r\n        if (ops[i] !== normalized[i]) return false;\r\n      }\r\n      return true;\r\n    }) || null;\r\n  }\r\n\r\n  function setHiddenVariantId(form, variantId) {\r\n    try {\r\n      let idInput = form.querySelector('input[name=\"id\"]');\r\n      if (!idInput) {\r\n        idInput = document.createElement('input');\r\n        idInput.type = 'hidden';\r\n        idInput.name = 'id';\r\n        form.appendChild(idInput);\r\n      }\r\n      const newVal = String(variantId || '');\r\n      const currentVal = String(idInput.value || '');\r\n      // Skip if nothing changed to avoid causing mutation/change events\r\n      if (currentVal === newVal) {\r\n        return;\r\n      }\r\n  \r\n      // Mark as updating to prevent re-entrant handlers (MutationObserver / change listeners)\r\n      _pdpUpdatingHiddenVariant.set(form, true);\r\n  \r\n      idInput.value = newVal;\r\n  \r\n      // Also update any known helper class\r\n      const helper = form.querySelector('.product-variant-id');\r\n      if (helper) helper.value = newVal;\r\n  \r\n      // Debug: surface variant syncing to console so automated tests can capture logs (only when value actually changes)\r\n      try { console.info('pdp-add-to-cart:setHiddenVariantId', { formId: form.id || null, variantId: idInput.value }); } catch (_) {}\r\n  \r\n      // Clear the updating flag after a short delay so async mutation observers have time to fire\r\n      // and the handler can ignore the resulting callbacks.\r\n      setTimeout(() => {\r\n        try { _pdpUpdatingHiddenVariant.set(form, false); } catch (_) {}\r\n      }, 100);\r\n    } catch (e) {\r\n      console.warn('pdp-add-to-cart:setHiddenVariantId error', e);\r\n    }\r\n  }\r\n\r\n  function attachVariantSync(form) {\r\n    const handler = async () => {\r\n      try {\r\n        // If we're currently programmatically updating the hidden variant input for this form,\r\n        // skip re-sync to avoid an infinite loop / rapid re-entry.\r\n        if (_pdpUpdatingHiddenVariant.get(form)) return;\r\n  \r\n        const product = await getProductJsonForForm(form);\r\n        if (!product) return;\r\n        const selected = readSelectedOptionsFromForm(form, product);\r\n        const variant = findVariantByOptions(product, selected);\r\n        // Debug: log selection & resolved variant for traceability in tests\r\n        try { console.info('pdp-add-to-cart:variant-sync', { formId: form.id || null, selected, resolvedVariantId: variant?.id || null }); } catch (_) {}\r\n        if (variant?.id) {\r\n          // Update the submitting/visible form\r\n          setHiddenVariantId(form, variant.id);\r\n          // Propagate to other add-to-cart forms within the same product-info section (scoped)\r\n          try {\r\n            const section = getProductSectionForForm(form);\r\n            if (section) {\r\n              const sectionForms = Array.from(section.querySelectorAll('form[action*=\"/cart/add\"]'));\r\n              sectionForms.forEach(f => {\r\n                if (f === form) return;\r\n                try { setHiddenVariantId(f, variant.id); } catch (_) {}\r\n              });\r\n            }\r\n          } catch (_) {}\r\n        }\r\n      } catch (e) {\r\n        console.warn('pdp-add-to-cart:variant-sync error', e);\r\n      }\r\n    };\r\n  \r\n    // Initial sync\r\n    setTimeout(handler, 0);\r\n  \r\n    // Use MutationObserver for robust variant ID change detection\r\n    const variantIdInput = form.querySelector('input[name=\"id\"]');\r\n    if (variantIdInput) {\r\n      const observer = new MutationObserver((mutations) => {\r\n        mutations.forEach((mutation) => {\r\n          if (mutation.type === 'attributes' && mutation.attributeName === 'value') {\r\n            handler(); // Re-sync when the variant ID input's value changes\r\n          }\r\n        });\r\n      });\r\n      observer.observe(variantIdInput, { attributes: true });\r\n    } else {\r\n      console.warn('pdp-add-to-cart: Could not find variant ID input for MutationObserver.');\r\n      // Fallback to generic change listener if variant ID input not found for observer\r\n      form.addEventListener('change', evt => {\r\n        const t = evt.target;\r\n        if (!t) return;\r\n        handler();\r\n      });\r\n    }\r\n  }\r\n\r\n  function shouldUseDrawer() {\r\n    const body = document.body;\r\n    return !!(document.querySelector('cart-drawer') || (body && (body.dataset.cartType || '').toLowerCase() === 'drawer'));\r\n  }\r\n\r\n  async function refreshDrawerAndOpen(addedId) {\r\n    const drawer = document.querySelector('cart-drawer');\r\n    if (!drawer || typeof drawer.renderContents !== 'function') return false;\r\n\r\n    try {\r\n      const url = new URL(window.location.href);\r\n      // Preserve preview_theme_id and add sections param\r\n      url.searchParams.set('sections', 'cart-drawer,cart-icon-bubble');\r\n\r\n      const resp = await fetch(url.toString(), { credentials: 'same-origin' });\r\n      if (!resp.ok) throw new Error('sections fetch failed');\r\n      const sections = await resp.json();\r\n\r\n      drawer.renderContents({ id: addedId, sections });\r\n      drawer.open();\r\n      document.dispatchEvent(new CustomEvent('cart-drawer:refreshed'));\r\n      return true;\r\n    } catch (e) {\r\n      console.warn('pdp-add-to-cart: drawer refresh failed', e);\r\n      return false;\r\n    }\r\n  }\r\n\r\n  // Removed attachAjaxSubmit - let product-form.js handle all form submissions\r\n  // to avoid duplicate add-to-cart requests\r\n})();"],
  "mappings": "AAEA,SAAS,QAAS,CAChB,MAAO,uCAAuC,QAAQ,QAAS,SAAS,EAAG,CACzE,MAAM,EAAI,KAAK,OAAO,EAAI,GAAK,EAE/B,OADU,IAAM,IAAM,EAAK,EAAI,EAAO,GAC7B,SAAS,EAAE,CACtB,CAAC,CACH,EAEC,UAAW,CACV,GAAI,OAAO,OAAW,IAAa,OAEnC,SAAS,iBAAiB,mBAAoB,IAAM,CAClD,GAAI,CACF,kBAAkB,QAAQ,CAC5B,OAAS,EAAG,CACV,QAAQ,KAAK,8BAA+B,CAAC,CAC/C,CACF,CAAC,EAED,eAAe,kBAAkB,KAAM,CACrC,MAAM,MAAQ,MAAM,KAAK,KAAK,iBAAiB,2BAA2B,CAAC,EAC3E,GAAK,MAAM,OAEX,UAAW,QAAQ,MAIjB,kBAAkB,IAAI,CAE1B,CAEA,SAAS,yBAAyB,KAAM,CACtC,OAAO,KAAK,QAAQ,cAAc,GAAK,SAAS,cAAc,wBAAwB,CACxF,CAEA,SAAS,qBAAqB,KAAM,CAClC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