{"version":3,"file":"../blocks/content_overview/content-overview.min.js","mappings":"AAAAA,SAASC,iBAAiB,oBAAoB,WAE5C,IAAMC,EAAWF,SAASG,iBAAiB,4BAE3CD,EAASE,SAAQ,SAACC,GAChBA,EAAKJ,iBAAiB,SAAS,SAACK,GAC9BA,EAAMC,iBACN,IAAMC,EAAWH,EAAKI,aAAa,QAAQC,UAAU,GAC/CC,EAAgBX,SAASY,eAAeJ,GAE1CG,GACFE,OAAOC,SAAS,CACdC,IAAKJ,EAAcK,UAAY,GAC/BC,SAAU,UAGhB,GACF,IAGA,IAAMC,EAAWC,MAAMC,KAAKlB,GAAUmB,KAAI,SAAChB,GACzC,IAAMG,EAAWH,EAAKI,aAAa,QAAQC,UAAU,GACrD,OAAOV,SAASY,eAAeJ,EACjC,IAEMc,EAAe,WACnB,IAAMC,EAAiBV,OAAOW,QACxBC,EAAiBZ,OAAOa,YAG1BC,EAAiB,KACjBC,EAAkBC,IAEtBX,EAASd,SAAQ,SAAC0B,EAASC,GACzB,GAAKD,EAAL,CAEA,IAAME,EAAaF,EAAQd,UACrBiB,EAAgBD,EAAaF,EAAQI,aAGrCC,EAAwBC,KAAKC,IAAIL,EAAaT,GAGlDA,GAAkBS,EAAa,IAC/BT,EAAiBU,GAGbE,EAAwBP,IAC1BA,EAAkBO,EAClBR,EAAiBI,EAfD,CAkBtB,IAGuB,OAAnBJ,IACEJ,EAAiBL,EAAS,GAAGF,UAE/BW,EAAiB,EAEjBJ,EAAiBE,GAAkBzB,SAASsC,gBAAgBC,eAG5DZ,EAAiBT,EAASsB,OAAS,IAKvCtC,EAASE,SAAQ,SAACC,GAAI,OAAKA,EAAKoC,UAAUC,OAAO,SAAS,IAGnC,OAAnBf,GACFzB,EAASyB,GAAgBc,UAAUE,IAAI,SAE3C,EAGA9B,OAAOZ,iBAAiB,SAAUqB,GAGlCA,GACF","sources":["webpack://umbrellas/./blocks/content_overview/content-overview.js"],"sourcesContent":["document.addEventListener(\"DOMContentLoaded\", () => {\n  // Smooth scrolling for navigation links\n  const navLinks = document.querySelectorAll(\".content-overview-list a\");\n\n  navLinks.forEach((link) => {\n    link.addEventListener(\"click\", (event) => {\n      event.preventDefault();\n      const targetId = link.getAttribute(\"href\").substring(1);\n      const targetElement = document.getElementById(targetId);\n\n      if (targetElement) {\n        window.scrollTo({\n          top: targetElement.offsetTop - 50, // Adjust for sticky headers\n          behavior: \"smooth\"\n        });\n      }\n    });\n  });\n\n  // Map sections from navLinks\n  const sections = Array.from(navLinks).map((link) => {\n    const targetId = link.getAttribute(\"href\").substring(1);\n    return document.getElementById(targetId);\n  });\n\n  const handleScroll = () => {\n    const scrollPosition = window.scrollY;\n    const viewportHeight = window.innerHeight;\n\n    // Variables to track the best match\n    let bestMatchIndex = null;\n    let bestMatchOffset = Infinity;\n\n    sections.forEach((section, index) => {\n      if (!section) return;\n\n      const sectionTop = section.offsetTop;\n      const sectionBottom = sectionTop + section.offsetHeight;\n\n      // Calculate how far the section is from the current scroll position\n      const distanceToViewportTop = Math.abs(sectionTop - scrollPosition);\n\n      if (\n        scrollPosition >= sectionTop - 50 && // Section top slightly above viewport\n        scrollPosition < sectionBottom // Section bottom still visible\n      ) {\n        // Prioritize sections fully or partially in the viewport\n        if (distanceToViewportTop < bestMatchOffset) {\n          bestMatchOffset = distanceToViewportTop;\n          bestMatchIndex = index;\n        }\n      }\n    });\n\n    // Fallback for edge cases\n    if (bestMatchIndex === null) {\n      if (scrollPosition < sections[0].offsetTop) {\n        // Before the first section\n        bestMatchIndex = 0;\n      } else if (\n        scrollPosition + viewportHeight >= document.documentElement.scrollHeight\n      ) {\n        // At the bottom of the page\n        bestMatchIndex = sections.length - 1;\n      }\n    }\n\n    // Remove active class from all links\n    navLinks.forEach((link) => link.classList.remove(\"active\"));\n\n    // Add active class to the best-matched link\n    if (bestMatchIndex !== null) {\n      navLinks[bestMatchIndex].classList.add(\"active\");\n    }\n  };\n\n  // Listen for scroll events\n  window.addEventListener(\"scroll\", handleScroll);\n\n  // Run once on load to highlight the correct link\n  handleScroll();\n});\n"],"names":["document","addEventListener","navLinks","querySelectorAll","forEach","link","event","preventDefault","targetId","getAttribute","substring","targetElement","getElementById","window","scrollTo","top","offsetTop","behavior","sections","Array","from","map","handleScroll","scrollPosition","scrollY","viewportHeight","innerHeight","bestMatchIndex","bestMatchOffset","Infinity","section","index","sectionTop","sectionBottom","offsetHeight","distanceToViewportTop","Math","abs","documentElement","scrollHeight","length","classList","remove","add"],"sourceRoot":""}