/** * Collapsible Table of Contents for mkdocs-material with toc.integrate. * * Behaviour: * - ALL nested TOC items start collapsed on page load. * - Clicking a parent item toggles it and marks it as "user-pinned" so it * stays in whatever state the user chose. * - As the reader scrolls, the ancestors of the currently-active TOC link * are automatically expanded so the highlighted item is always visible. * - When the reader scrolls past a section, any items that were only * auto-expanded (not user-pinned) collapse back down. * - Works with mkdocs-material instant-loading / SPA navigation. * * Page navigation is handled by the top navbar tabs + dropdowns. * This script only manages the TOC (md-nav--secondary) in the left sidebar. */ (function () { "use strict"; /** * Set of TOC
  • elements the user has manually expanded. * These survive auto-collapse and are only cleared on page navigation. */ var userPinned = new Set(); /** * Set of TOC
  • elements that were auto-expanded by the scroll tracker. * Cleared and recalculated each time the active link changes. */ var autoExpanded = new Set(); /** Reference to the sidebar element (cached after first lookup). */ var sidebar = null; // ── Helpers ────────────────────────────────────────────────────────── /** * Return all ancestor elements between `el` * and the TOC root (the