{"product_id":"250-years-of-freedom-veteran-tribute-coin","title":"🔥Last Day 50% OFF🔥 250 Years of Freedom Veteran Tribute Coin","description":"\u003cscript\u003e\n(() =\u003e {\n  const TAG = 'AUTO_SELECT_SECOND_OPTION';\n  let tries = 0;\n  let stable = 0;\n  let stopped = false;\n  let timer;\n\n  function radioGroups(root) {\n    const groups = new Map();\n\n    root.querySelectorAll('input[type=\"radio\"]').forEach(radio =\u003e {\n      const key = radio.name || radio.closest('fieldset') || radio.parentElement;\n      if (!groups.has(key)) groups.set(key, []);\n      groups.get(key).push(radio);\n    });\n\n    return [...groups.values()].filter(group =\u003e group.length \u003e= 2);\n  }\n\n  function findSecondOption() {\n    const productRoot =\n      document.querySelector('product-info') ||\n      document.querySelector('.product__info-container') ||\n      document.querySelector('main') ||\n      document;\n\n    const heading = [...document.querySelectorAll(\n      'legend,h2,h3,h4,p,span,div'\n    )]\n      .filter(el =\u003e \/bundle\\s*\u0026\\s*save\/i.test(el.textContent || ''))\n      .sort((a, b) =\u003e a.textContent.length - b.textContent.length)[0];\n\n    if (heading) {\n      let container = heading.parentElement;\n\n      for (let i = 0; container \u0026\u0026 i \u003c 8; i++, container = container.parentElement) {\n        const groups = radioGroups(container);\n        if (groups.length) return { type: 'radio', element: groups[0][1] };\n      }\n    }\n\n    const roots = productRoot.querySelectorAll(\n      'variant-radios,variant-selects,' +\n      'fieldset.product-form__input,.product-form__input,' +\n      'form[action*=\"\/cart\/add\"],product-form'\n    );\n\n    for (const root of roots) {\n      const groups = radioGroups(root);\n      if (groups.length) return { type: 'radio', element: groups[0][1] };\n    }\n\n    const selects = productRoot.querySelectorAll(\n      'select[name^=\"options\"],select[name=\"id\"],variant-selects select'\n    );\n\n    for (const select of selects) {\n      const options = [...select.options].filter(\n        option =\u003e !option.disabled \u0026\u0026 option.value\n      );\n\n      if (options.length \u003e= 2) {\n        return { type: 'select', element: select, option: options[1] };\n      }\n    }\n\n    return null;\n  }\n\n  function applySelection() {\n    const target = findSecondOption();\n    if (!target) return;\n\n    if (target.type === 'radio') {\n      if (!target.element.checked) {\n        target.element.click();\n        target.element.dispatchEvent(new Event('change', { bubbles: true }));\n        stable = 0;\n      } else stable++;\n    } else if (target.element.value !== target.option.value) {\n      target.element.value = target.option.value;\n      target.element.dispatchEvent(new Event('input', { bubbles: true }));\n      target.element.dispatchEvent(new Event('change', { bubbles: true }));\n      stable = 0;\n    } else stable++;\n  }\n\n  function start() {\n    console.info(`[${TAG}] started`);\n\n    timer = setInterval(() =\u003e {\n      if (stopped) return clearInterval(timer);\n      applySelection();\n\n      if (++tries \u003e= 48 || stable \u003e= 6) clearInterval(timer);\n    }, 250);\n  }\n\n  document.addEventListener('pointerdown', event =\u003e {\n    if (event.target.closest('product-info,form[action*=\"\/cart\/add\"]')) {\n      stopped = true;\n    }\n  }, true);\n\n  document.readyState === 'loading'\n    ? document.addEventListener('DOMContentLoaded', start, { once: true })\n    : start();\n})();\n\u003c\/script\u003e","brand":"Hrsultshop","offers":[{"title":"Buy 1","offer_id":53891833037119,"sku":"CZ-250-years-6-29*1PC","price":17.99,"currency_code":"USD","in_stock":true},{"title":"Buy 2 Get 1 Free (3PCS)","offer_id":53891833069887,"sku":"CZ-250-years-6-29*3PC","price":29.98,"currency_code":"USD","in_stock":true},{"title":"Buy 3 Get 2 Free (5 PCS)","offer_id":53891833102655,"sku":"CZ-250-years-6-29*5PC","price":42.97,"currency_code":"USD","in_stock":true},{"title":"Buy 5 Get 5 Free (10 PCS)","offer_id":53891833135423,"sku":"CZ-250-years-6-29*10PC","price":75.95,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0799\/8301\/8303\/files\/999.png?v=1782716559","url":"https:\/\/hrsultshop.com\/products\/250-years-of-freedom-veteran-tribute-coin","provider":"Hrsultshop","version":"1.0","type":"link"}