{
  "version": 3,
  "sources": ["/cdn/shop/t/1/assets/sg-header-nav.js?b=31102"],
  "sourcesContent": ["/* Two jobs, both small, both about behaviour the platform does not give us.\n *\n * 1. Dismissing the header's mobile nav disclosure. The menu itself is a native\n *    <details>, so it opens, closes, takes focus and announces its state with no\n *    JavaScript at all. What <details> has no opinion about is when it should\n *    close again:\n *\n *      - Several nav links are same-page anchors. Tapping one scrolls the page\n *        but never unloads it, so without this the panel stays open on top of\n *        the section it just scrolled to.\n *      - Tapping outside is what everyone expects to dismiss an overlay, and a\n *        native disclosure ignores it.\n *      - Escape closes dialogs and popovers; it does nothing to a <details>.\n *\n * 2. Scrolling to same-page anchor targets, for the header, footer and hero\n *    alike. See samePageTarget/goToTarget below for why the browser's own\n *    handling is not good enough once the links are root-relative.\n *\n * Everything degrades safely. With the script blocked the menu still opens and\n * closes from its button, and the anchors still navigate - just with a reload.\n */\n(function () {\n  var MOBILE = '(max-width: 989px)';\n\n  function panels() {\n    return Array.prototype.slice.call(\n      document.querySelectorAll('[data-sg-dc-header] .sg-dc-header__disclosure')\n    );\n  }\n\n  function close(details, refocus) {\n    if (!details || !details.open) return;\n    details.open = false;\n    if (refocus) {\n      var summary = details.querySelector('summary');\n      if (summary) summary.focus();\n    }\n  }\n\n  function closeAll(refocus) {\n    panels().forEach(function (details) {\n      close(details, refocus);\n    });\n  }\n\n  // pointerdown, not click: it fires before the anchor's own navigation and\n  // before focus moves, so the panel is already shut by the time the browser\n  // starts scrolling to the anchor.\n  document.addEventListener('pointerdown', function (event) {\n    panels().forEach(function (details) {\n      if (!details.open) return;\n      if (!details.contains(event.target)) close(details, false);\n    });\n  });\n\n  // Scroll to a same-page fragment ourselves, rather than letting the browser\n  // navigate. Two reasons, both real on this store:\n  //\n  //   - The nav links are root-relative (/#compare) so they also work from\n  //     product and guide pages. The browser only treats a fragment as\n  //     same-document when the rest of the URL matches exactly, so on\n  //     /?utm_source=newsletter - or Google's ?srsltid= on organic clicks -\n  //     /#compare is a different URL and triggers a full reload that lands on\n  //     bare / with the query gone, losing the campaign attribution.\n  //   - Moving focus to the target is what makes the jump work for a keyboard\n  //     or screen-reader user; a plain scroll leaves focus where it was.\n  // Matched on the TARGET, not the link, so this covers the footer columns and\n  // the hero CTAs as well as the header - without touching any other anchor in\n  // the theme. `.sg-dc[id]` is exactly the set of sections that opted into an\n  // anchor id, so nothing else can be intercepted by accident.\n  function samePageTarget(link) {\n    if (!link.hash || link.hash === '#') return null;\n    if (link.pathname !== window.location.pathname) return null;\n    if (link.host !== window.location.host) return null;\n    var target;\n    try {\n      target = document.querySelector(link.hash);\n    } catch (e) {\n      return null; // hash is not a valid selector\n    }\n    return target && target.classList.contains('sg-dc') ? target : null;\n  }\n\n  function goToTarget(target, hash) {\n    target.scrollIntoView({ behavior: 'smooth', block: 'start' });\n    // Section roots are not focusable, so make this one programmatically\n    // focusable without adding it to the tab sequence.\n    if (!target.hasAttribute('tabindex')) target.setAttribute('tabindex', '-1');\n    target.focus({ preventScroll: true });\n    // Keep the query string; history.pushState does not touch it, whereas\n    // assigning location.hash on a mismatched URL is what reloads.\n    if (window.history && window.history.pushState) {\n      window.history.pushState(null, '', window.location.search + hash);\n    }\n  }\n\n  // A tap on a link inside the panel is inside the disclosure, so the outside\n  // handler deliberately leaves it alone. Close on the link itself instead -\n  // and because closing removes the activated anchor from the rendered tree,\n  // focus has to be placed deliberately or it falls back to <body>.\n  document.addEventListener('click', function (event) {\n    var el = event.target;\n    if (!el || !el.closest) return;\n\n    var link = el.closest('a[href]');\n    if (!link) return;\n\n    var target = samePageTarget(link);\n    if (el.closest('.sg-dc-header__panel')) close(link.closest('details'), false);\n\n    if (target) {\n      event.preventDefault();\n      goToTarget(target, link.hash);\n    }\n  });\n\n  document.addEventListener('keydown', function (event) {\n    if (event.key === 'Escape' || event.key === 'Esc') closeAll(true);\n  });\n\n  // Left open on a phone, then rotated or resized to desktop: the disclosure is\n  // display:none there, so the panel vanishes while still being open, and comes\n  // back open the next time the viewport narrows.\n  if (window.matchMedia) {\n    var mq = window.matchMedia(MOBILE);\n    var onChange = function (event) {\n      if (!event.matches) closeAll(false);\n    };\n    if (mq.addEventListener) mq.addEventListener('change', onChange);\n    else if (mq.addListener) mq.addListener(onChange);\n  }\n})();\n"],
  "mappings": "CAqBC,UAAY,CACX,IAAI,OAAS,qBAEb,SAAS,QAAS,CAChB,OAAO,MAAM,UAAU,MAAM,KAC3B,SAAS,iBAAiB,+CAA+C,CAC3E,CACF,CAEA,SAAS,MAAM,QAAS,QAAS,CAC/B,GAAI,GAAC,SAAW,CAAC,QAAQ,QACzB,QAAQ,KAAO,GACX,SAAS,CACX,IAAI,QAAU,QAAQ,cAAc,SAAS,EACzC,SAAS,QAAQ,MAAM,CAC7B,CACF,CAEA,SAAS,SAAS,QAAS,CACzB,OAAO,EAAE,QAAQ,SAAU,QAAS,CAClC,MAAM,QAAS,OAAO,CACxB,CAAC,CACH,CAKA,SAAS,iBAAiB,cAAe,SAAU,MAAO,CACxD,OAAO,EAAE,QAAQ,SAAU,QAAS,CAC7B,QAAQ,OACR,QAAQ,SAAS,MAAM,MAAM,GAAG,MAAM,QAAS,EAAK,EAC3D,CAAC,CACH,CAAC,EAiBD,SAAS,eAAe,KAAM,CAG5B,GAFI,CAAC,KAAK,MAAQ,KAAK,OAAS,KAC5B,KAAK,WAAa,OAAO,SAAS,UAClC,KAAK,OAAS,OAAO,SAAS,KAAM,OAAO,KAC/C,IAAI,OACJ,GAAI,CACF,OAAS,SAAS,cAAc,KAAK,IAAI,CAC3C,OAAS,EAAG,CACV,OAAO,IACT,CACA,OAAO,QAAU,OAAO,UAAU,SAAS,OAAO,EAAI,OAAS,IACjE,CAEA,SAAS,WAAW,OAAQ,KAAM,CAChC,OAAO,eAAe,CAAE,SAAU,SAAU,MAAO,OAAQ,CAAC,EAGvD,OAAO,aAAa,UAAU,GAAG,OAAO,aAAa,WAAY,IAAI,EAC1E,OAAO,MAAM,CAAE,cAAe,EAAK,CAAC,EAGhC,OAAO,SAAW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