Pengguna:Ctify/vector-2022.js

Catatan: Setelah menyimpan, Anda harus memintas tembolok (cache) peramban Anda untuk melihat perubahannya. Google Chrome, Firefox, Microsoft Edge dan Safari: Tahan tombol Shift dan klik Muat ulang (Reload) di tombol bilah alat. Untuk detail dan instruksi tentang peramban lain, lihat halaman menghapus singgahan (Inggris).

mw.loader.implement("skins.vector.es6@1s6pj", {
    main: "resources/skins.vector.es6/main.js",
    files: {
        "resources/skins.vector.es6/main.js": function(require, module) {
            const searchToggle = require('./searchToggle.js'),
                stickyHeader = require('./stickyHeader.js'),
                scrollObserver = require('./scrollObserver.js'),
                AB = require('./AB.js'),
                initSectionObserver = require('./sectionObserver.js'),
                initTableOfContents = require('./tableOfContents.js'),
                deferUntilFrame = require('./deferUntilFrame.js'),
                TOC_ID = 'mw-panel-toc',
                BODY_CONTENT_ID = 'bodyContent',
                HEADLINE_SELECTOR = '.mw-headline',
                TOC_SECTION_ID_PREFIX = 'toc-';
            const main = () => {
                const searchToggleElement = document.querySelector('.mw-header .search-toggle');
                if (searchToggleElement) {
                    searchToggle(searchToggleElement);
                }
                const FEATURE_TEST_GROUP = 'stickyHeaderEnabled',
                    testConfig = AB.getEnabledExperiment(),
                    stickyConfig = testConfig && testConfig.experimentName === stickyHeader.STICKY_HEADER_EXPERIMENT_NAME ? testConfig : null,
                    testGroup = stickyConfig ? stickyConfig.group : FEATURE_TEST_GROUP,
                    targetElement = stickyHeader.header,
                    targetIntersection = stickyHeader.stickyIntersection,
                    isStickyHeaderAllowed = stickyHeader.isStickyHeaderAllowed() && testGroup !== 'unsampled' && AB.isInTestGroup(testGroup, FEATURE_TEST_GROUP);
                AB.initAB(testGroup);
                const observer = scrollObserver.initScrollObserver(() => {
                    if (targetElement && isStickyHeaderAllowed) {
                        stickyHeader.show();
                    }
                    scrollObserver.fireScrollHook('down');
                }, () => {
                    if (targetElement && isStickyHeaderAllowed) {
                        stickyHeader.hide();
                    }
                    scrollObserver.fireScrollHook('up');
                });
                if (isStickyHeaderAllowed) {
                    stickyHeader.initStickyHeader(observer);
                } else if (targetIntersection) {
                    observer.observe(targetIntersection);
                }
                const tocElement = document.getElementById(TOC_ID);
                const bodyContent = document.getElementById(BODY_CONTENT_ID);
                if (!(tocElement && bodyContent && window.IntersectionObserver && window.requestAnimationFrame)) {
                    return;
                }
                const tableOfContents = initTableOfContents({
                    container: tocElement,
                    onHeadingClick: (id) => {
                        sectionObserver.pause();
                        tableOfContents.expandSection(id);
                        tableOfContents.
                        changeActiveSection(id);
                        deferUntilFrame(() => sectionObserver.resume(), 3);
                    },
                    onToggleClick: (id) => {
                        tableOfContents.toggleExpandSection(id);
                    }
                });
                const sectionObserver = initSectionObserver({
                    elements: bodyContent.querySelectorAll('h1, h2, h3, h4, h5, h6'),
                    topMargin: targetElement ? targetElement.getBoundingClientRect().height : 0,
                    onIntersection: (section) => {
                        const headline = section.querySelector(HEADLINE_SELECTOR);
                        if (headline) {
                            tableOfContents.changeActiveSection(TOC_SECTION_ID_PREFIX + headline.id);
                        }
                    }
                });
            };
            module.exports = {
                main: main
            };
        },
        "resources/skins.vector.es6/searchToggle.js": function(require, module) {
            const HEADER_SELECTOR = 'header',
                SEARCH_BOX_SELECTOR = '.vector-search-box',
                SEARCH_VISIBLE_CLASS = 'vector-header-search-toggled';

            function bindSearchBoxHandler(searchBox, header) {
                const clickHandler = (ev) => {
                    if (ev.target instanceof HTMLElement && !ev.target.closest('.wvui-typeahead-suggestion') && !searchBox.contains(ev.target)) {
                        header.classList.remove(SEARCH_VISIBLE_CLASS);
                        document.removeEventListener('click',
                            clickHandler);
                    }
                };
                document.addEventListener('click', clickHandler);
            }

            function bindToggleClickHandler(searchBox, header, searchToggle) {
                const handler = (ev) => {
                    ev.preventDefault();
                    header.classList.add(SEARCH_VISIBLE_CLASS);
                    setTimeout(() => {
                        bindSearchBoxHandler(searchBox, header);
                        const searchInput = (searchBox.querySelector('input[type="search"]'));
                        if (searchInput) {
                            const beforeScrollX = window.scrollX;
                            const beforeScrollY = window.scrollY;
                            searchInput.focus();
                            if (beforeScrollX !== undefined && beforeScrollY !== undefined) {
                                window.scroll(beforeScrollX, beforeScrollY);
                            }
                        }
                    });
                };
                searchToggle.addEventListener('click', handler);
            }
            module.exports = function initSearchToggle(searchToggle) {
                const header = (searchToggle.closest(HEADER_SELECTOR));
                if (!header) {
                    return;
                }
                const searchBox = (header.querySelector(SEARCH_BOX_SELECTOR));
                if (!searchBox) {
                    return;
                }
                bindToggleClickHandler(searchBox, header, searchToggle);
            };
        },
        "resources/skins.vector.es6/stickyHeader.js": function(require, module) {
            const STICKY_HEADER_ID = 'vector-sticky-header',
                header = document.
            getElementById(STICKY_HEADER_ID), initSearchToggle = require('./searchToggle.js'), STICKY_HEADER_APPENDED_ID = '-sticky-header', STICKY_HEADER_VISIBLE_CLASS = 'vector-sticky-header-visible', STICKY_HEADER_USER_MENU_CONTAINER_CLASS = 'vector-sticky-header-icon-end', FIRST_HEADING_ID = 'firstHeading', USER_MENU_ID = 'p-personal', ULS_STICKY_CLASS = 'uls-dialog-sticky', ULS_HIDE_CLASS = 'uls-dialog-sticky-hide', VECTOR_USER_LINKS_SELECTOR = '.vector-user-links', SEARCH_TOGGLE_SELECTOR = '.vector-sticky-header-search-toggle', STICKY_HEADER_EXPERIMENT_NAME = 'vector.sticky_header';

            function copyAttribute(from, to, attribute) {
                const fromAttr = from.getAttribute(attribute);
                if (fromAttr) {
                    to.setAttribute(attribute, fromAttr);
                }
            }

            function show() {
                if (header) {
                    header.classList.add(STICKY_HEADER_VISIBLE_CLASS);
                }
                document.body.classList.remove(ULS_HIDE_CLASS);
            }

            function hide() {
                if (header) {
                    header.classList.remove(STICKY_HEADER_VISIBLE_CLASS);
                    document.body.classList.add(ULS_HIDE_CLASS);
                }
            }

            function copyButtonAttributes(from, to) {
                copyAttribute(from, to,
                    'href');
                copyAttribute(from, to, 'title');
            }

            function suffixStickyAttribute(node, attribute) {
                const value = node.getAttribute(attribute);
                if (value) {
                    node.setAttribute(attribute, value + STICKY_HEADER_APPENDED_ID);
                }
            }

            function makeNodeTrackable(node) {
                suffixStickyAttribute(node, 'id');
                suffixStickyAttribute(node, 'data-event-name');
            }

            function toHTMLElement(node) {
                return node;
            }

            function removeNode(node) {
                toHTMLElement(node.parentNode).removeChild(node);
            }

            function removeClassFromNodes(nodes, className) {
                Array.prototype.forEach.call(nodes, function(node) {
                    node.classList.remove(className);
                });
            }

            function removeNodes(nodes) {
                Array.prototype.forEach.call(nodes, function(node) {
                    node.parentNode.removeChild(node);
                });
            }

            function updateStickyWatchlink(watchSticky, status) {
                watchSticky.classList.toggle('mw-ui-icon-wikimedia-star', status === 'unwatched');
                watchSticky.classList.toggle('mw-ui-icon-wikimedia-unStar', status === 'watched');
                watchSticky.classList.toggle('mw-ui-icon-wikimedia-halfStar', status === 'temporary');
                watchSticky.setAttribute(
                    'data-event-name', status === 'unwatched' ? 'watch-sticky-header' : 'unwatch-sticky-header');
            }

            function watchstarCallback($link, isWatched, expiry) {
                updateStickyWatchlink($link[0], expiry !== 'infinity' ? 'temporary' : isWatched ? 'watched' : 'unwatched');
            }

            function prepareIcons(headerElement, history, talk, watch) {
                const historySticky = headerElement.querySelector('#ca-history-sticky-header'),
                    talkSticky = headerElement.querySelector('#ca-talk-sticky-header'),
                    watchSticky = headerElement.querySelector('#ca-watchstar-sticky-header');
                if (!historySticky || !talkSticky || !watchSticky) {
                    throw new Error('Sticky header has unexpected HTML');
                }
                if (history) {
                    copyButtonAttributes(history, historySticky);
                } else {
                    historySticky.parentNode.removeChild(historySticky);
                }
                if (talk) {
                    copyButtonAttributes(talk, talkSticky);
                } else {
                    talkSticky.parentNode.removeChild(talkSticky);
                }
                if (watch && watch.parentNode instanceof HTMLElement) {
                    const watchContainer = watch.parentNode;
                    copyButtonAttributes(watch, watchSticky);
                    updateStickyWatchlink(watchSticky, watchContainer.classList.contains('mw-watchlink-temp') ? 'temporary' : watchContainer.getAttribute('id') === 'ca-watch' ? 'unwatched' : 'watched');
                    const watchLib = require(('mediawiki.page.watch.ajax'));
                    watchLib.watchstar($(watchSticky), mw.config.get('wgRelevantPageName'), watchstarCallback);
                } else {
                    watchSticky.parentNode.removeChild(watchSticky);
                }
            }

            function prepareEditIcons(headerElement, primaryEdit, isProtected, secondaryEdit, disableStickyHeader) {
                const primaryEditStickyElement = headerElement.querySelector('#ca-ve-edit-sticky-header'),
                    primaryEditSticky = primaryEditStickyElement ? toHTMLElement(headerElement.querySelector('#ca-ve-edit-sticky-header')) : null,
                    protectedSticky = toHTMLElement(headerElement.querySelector('#ca-viewsource-sticky-header')),
                    wikitextSticky = toHTMLElement(headerElement.querySelector('#ca-edit-sticky-header'));
                if (!primaryEditSticky) {
                    return;
                }
                if (!primaryEdit) {
                    removeNode(protectedSticky);
                    removeNode(wikitextSticky);
                    removeNode(primaryEditSticky);
                    return;
                } else if (isProtected) {
                    removeNode(wikitextSticky);
                    removeNode(primaryEditSticky);
                    copyButtonAttributes(primaryEdit, protectedSticky);
                } else {
                    removeNode(protectedSticky);
                    copyButtonAttributes(primaryEdit, primaryEditSticky);
                    primaryEditSticky.addEventListener('click', function(ev) {
                        const target = toHTMLElement(ev.target);
                        const $ve = $(primaryEdit);
                        if (target && $ve.length) {
                            const event = $.Event('click');
                            $ve.trigger(event);
                            if (event.isDefaultPrevented()) {
                                disableStickyHeader();
                                ev.preventDefault();
                            }
                        }
                    });
                    if (secondaryEdit) {
                        copyButtonAttributes(secondaryEdit, wikitextSticky);
                        wikitextSticky.addEventListener('click', function(ev) {
                            const target = toHTMLElement(ev.target);
                            if (target) {
                                const $edit = $(secondaryEdit);
                                if ($edit.length) {
                                    const event = $.Event('click');
                                    $edit.trigger(event);
                                    if (event.isDefaultPrevented()) {
                                        disableStickyHeader();
                                        ev.preventDefault();
                                    }
                                }
                            }
                        });
                    } else {
                        removeNode(wikitextSticky);
                    }
                }
            }

            function isInViewport(element) {
                const rect = element.getBoundingClientRect();
                return (rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
                    rect.right <= (window.innerWidth || document.documentElement.clientWidth));
            }

            function addVisualEditorHooks(targetIntersection, observer) {
                mw.hook('ve.activationStart').add(() => {
                    hide();
                    observer.unobserve(targetIntersection);
                });
                mw.hook('ve.deactivationComplete').add(() => {
                    requestAnimationFrame(() => {
                        observer.observe(targetIntersection);
                    });
                });
                mw.hook('postEdit.afterRemoval').add(() => {
                    if (!isInViewport(targetIntersection)) {
                        show();
                        observer.observe(targetIntersection);
                    }
                });
            }

            function prepareUserMenu(userMenu) {
                const userMenuClone = (userMenu.cloneNode(true)),
                    userMenuStickyElementsWithIds = userMenuClone.querySelectorAll('[ id ], [ data-event-name ]');
                makeNodeTrackable(userMenuClone);
                userMenuStickyElementsWithIds.forEach(makeNodeTrackable);
                removeNodes(userMenuClone.querySelectorAll('.mw-list-item-js'));
                removeClassFromNodes(userMenuClone.querySelectorAll('.user-links-collapsible-item'), 'user-links-collapsible-item');
                const userMenuCheckbox = userMenuClone.querySelector('input');
                if (userMenuCheckbox) {
                    userMenuCheckbox.setAttribute('tabindex', '-1');
                }
                return userMenuClone;
            }

            function makeStickyHeaderFunctional(headerElement, userMenu, userMenuStickyContainer, stickyObserver, stickyIntersection) {
                const userMenuStickyContainerInner = userMenuStickyContainer.querySelector(VECTOR_USER_LINKS_SELECTOR);
                if (userMenuStickyContainerInner) {
                    userMenuStickyContainerInner.appendChild(prepareUserMenu(userMenu));
                }
                prepareIcons(headerElement, document.querySelector('#ca-history a'), document.querySelector('#ca-talk a'), document.querySelector('#ca-watch a, #ca-unwatch a'));
                const veEdit = document.querySelector('#ca-ve-edit a');
                const ceEdit = document.querySelector('#ca-edit a');
                const protectedEdit = document.querySelector('#ca-viewsource a');
                const isProtected = !!protectedEdit;
                const primaryEdit = protectedEdit || (veEdit || ceEdit);
                const secondaryEdit = veEdit ? ceEdit : null;
                const disableStickyHeader = () => {
                    headerElement.classList.remove(STICKY_HEADER_VISIBLE_CLASS);
                    stickyObserver.unobserve(stickyIntersection);
                };
                prepareEditIcons(
                    headerElement, toHTMLElement(primaryEdit), isProtected, toHTMLElement(secondaryEdit), disableStickyHeader);
                stickyObserver.observe(stickyIntersection);
            }

            function setupSearchIfNeeded(headerElement) {
                const searchToggle = headerElement.querySelector(SEARCH_TOGGLE_SELECTOR);
                if (!document.body.classList.contains('skin-vector-search-vue')) {
                    return;
                }
                if (searchToggle) {
                    initSearchToggle(searchToggle);
                }
            }

            function isAllowedNamespace(namespaceNumber) {
                const allowedNamespaceNumbers = [0, 2, 4, 10, 12, 14, 100, 828];
                return allowedNamespaceNumbers.indexOf(namespaceNumber) > -1;
            }

            function isAllowedAction(action) {
                const disallowedActions = ['history', 'edit'],
                    hasDiffId = mw.config.get('wgDiffOldId');
                return disallowedActions.indexOf(action) < 0 && !hasDiffId;
            }
            const stickyIntersection = document.getElementById(FIRST_HEADING_ID),
                userMenu = document.getElementById(USER_MENU_ID),
                userMenuStickyContainer = document.getElementsByClassName(STICKY_HEADER_USER_MENU_CONTAINER_CLASS)[0],
                allowedNamespace = isAllowedNamespace(mw.config.get('wgNamespaceNumber')),
                allowedAction = isAllowedAction(mw.config.get('wgAction'));

            function isStickyHeaderAllowed() {
                return header && stickyIntersection && userMenu && userMenuStickyContainer && allowedNamespace && allowedAction && 'IntersectionObserver' in window;
            }

            function initStickyHeader(observer) {
                if (!isStickyHeaderAllowed() || !header || !userMenu || !stickyIntersection) {
                    return;
                }
                makeStickyHeaderFunctional(header, userMenu, userMenuStickyContainer, observer, stickyIntersection);
                setupSearchIfNeeded(header);
                addVisualEditorHooks(stickyIntersection, observer);
                mw.hook('mw.uls.compact_language_links.open').add(function($trigger) {
                    if ($trigger.attr('id') !== 'p-lang-btn-sticky-header') {
                        const bodyClassList = document.body.classList;
                        bodyClassList.remove(ULS_HIDE_CLASS);
                        bodyClassList.remove(ULS_STICKY_CLASS);
                    }
                });
                const langBtn = header.querySelector('#p-lang-btn-sticky-header');
                if (langBtn) {
                    langBtn.addEventListener('click', function() {
                        const bodyClassList = document.body.classList;
                        bodyClassList.remove(ULS_HIDE_CLASS);
                        bodyClassList.add(ULS_STICKY_CLASS);
                    });
                }
            }
            module.exports = {
                show,
                hide,
                prepareUserMenu,
                initStickyHeader,
                isStickyHeaderAllowed,
                header,
                stickyIntersection,
                STICKY_HEADER_EXPERIMENT_NAME
            };
        },
        "resources/skins.vector.es6/scrollObserver.js": function(require, module) {
            const SCROLL_HOOK = 'vector.page_title_scroll',
                SCROLL_CONTEXT_ABOVE = 'scrolled-above-page-title',
                SCROLL_CONTEXT_BELOW = 'scrolled-below-page-title',
                SCROLL_ACTION = 'scroll-to-top';

            function fireScrollHook(direction) {
                if (direction === 'down') {
                    mw.hook(SCROLL_HOOK).fire({
                        context: SCROLL_CONTEXT_BELOW
                    });
                } else {
                    mw.hook(SCROLL_HOOK).fire({
                        context: SCROLL_CONTEXT_ABOVE,
                        action: SCROLL_ACTION
                    });
                }
            }

            function initScrollObserver(show, hide) {
                return new IntersectionObserver(function(entries) {
                    if (!entries[0].isIntersecting && entries[0].boundingClientRect.top < 0) {
                        show();
                    } else {
                        hide();
                    }
                });
            }
            module.exports = {
                initScrollObserver,
                fireScrollHook
            };
        },
        "resources/skins.vector.es6/AB.js": function(require, module) {
            const ABTestConfig = require(('./config.json')).wgVectorWebABTestEnrollment || {};

            function getBucketName() {
                return mw.
                experiments.getBucket({
                    name: ABTestConfig.name,
                    enabled: ABTestConfig.enabled,
                    buckets: {
                        unsampled: ABTestConfig.buckets.unsampled.samplingRate,
                        control: ABTestConfig.buckets.control.samplingRate,
                        stickyHeaderDisabled: ABTestConfig.buckets.stickyHeaderDisabled.samplingRate,
                        stickyHeaderEnabled: ABTestConfig.buckets.stickyHeaderEnabled.samplingRate
                    }
                }, mw.user.getId().toString());
            }

            function getABTestGroupExperimentName() {
                return {
                    group: getBucketName(),
                    experimentName: ABTestConfig.name
                };
            }

            function getEnabledExperiment() {
                const mergedConfig = {};
                if (ABTestConfig.enabled) {
                    Object.assign(mergedConfig, getABTestGroupExperimentName(), ABTestConfig);
                }
                return mergedConfig;
            }

            function isInTestGroup(bucket, targetGroup) {
                return bucket === targetGroup;
            }

            function initAB(bucket) {
                if (ABTestConfig.enabled && !mw.user.isAnon() && bucket !== 'unsampled') {
                    mw.hook('mediawiki.web_AB_test_enrollment').fire(getABTestGroupExperimentName());
                    if (bucket !== 'stickyHeaderEnabled') {
                        document.documentElement.classList.remove('vector-sticky-header-enabled');
                    }
                }
            }
            module.exports = {
                isInTestGroup,
                getEnabledExperiment,
                initAB,
                test: {
                    getBucketName,
                    getABTestGroupExperimentName
                }
            };
        },
        "resources/skins.vector.es6/tableOfContents.js": function(require, module) {
            const SECTION_CLASS = 'sidebar-toc-list-item';
            const ACTIVE_SECTION_CLASS = 'sidebar-toc-list-item-active';
            const EXPANDED_SECTION_CLASS = 'sidebar-toc-list-item-expanded';
            const PARENT_SECTION_CLASS = 'sidebar-toc-level-1';
            const LINK_CLASS = 'sidebar-toc-link';
            const TOGGLE_CLASS = 'sidebar-toc-toggle';
            module.exports = function tableOfContents(props) {
                let activeTopSection;
                let activeSubSection;
                let expandedSections;

                function getActiveSectionIds() {
                    return {
                        parent: (activeTopSection) ? activeTopSection.id : undefined,
                        child: (activeSubSection) ? activeSubSection.id : undefined
                    };
                }

                function activateSection(id) {
                    const selectedTocSection = document.getElementById(id);
                    const {
                        parent: previousActiveTopId,
                        child: previousActiveSubSectionId
                    } = getActiveSectionIds();
                    if (!selectedTocSection || (previousActiveTopId === id) || (previousActiveSubSectionId === id)) {
                        return;
                    }
                    const topSection = (selectedTocSection.closest(`.${PARENT_SECTION_CLASS}`));
                    if (selectedTocSection === topSection) {
                        activeTopSection = topSection;
                        activeTopSection.classList.add(ACTIVE_SECTION_CLASS);
                    } else {
                        activeTopSection = topSection;
                        activeSubSection = selectedTocSection;
                        activeTopSection.classList.add(ACTIVE_SECTION_CLASS);
                        activeSubSection.classList.add(ACTIVE_SECTION_CLASS);
                    }
                }

                function deactivateSections() {
                    if (activeSubSection) {
                        activeSubSection.classList.remove(ACTIVE_SECTION_CLASS);
                        activeSubSection = undefined;
                    }
                    if (activeTopSection) {
                        activeTopSection.classList.remove(ACTIVE_SECTION_CLASS);
                        activeTopSection = undefined;
                    }
                }

                function expandSection(id) {
                    const tocSection = document.getElementById(id);
                    if (!tocSection) {
                        return;
                    }
                    const parentSection = (tocSection.closest(`.${PARENT_SECTION_CLASS}`));
                    if (parentSection && expandedSections.indexOf(parentSection) < 0) {
                        parentSection.classList.add(EXPANDED_SECTION_CLASS);
                        expandedSections.push(parentSection);
                    }
                }

                function getExpandedSectionIds() {
                    return expandedSections.map((s) => s.id);
                }

                function changeActiveSection(id) {
                    const {
                        parent: activeParentId,
                        child: activeChildId
                    } = getActiveSectionIds();
                    if (id === activeParentId && id === activeChildId) {
                        return;
                    } else {
                        deactivateSections();
                        activateSection(id);
                    }
                }

                function isTopLevelSection(id) {
                    const section = document.getElementById(id);
                    return !!section && section.classList.contains(PARENT_SECTION_CLASS);
                }

                function collapseSections(selectedIds) {
                    const sectionIdsToCollapse = selectedIds || getExpandedSectionIds();
                    expandedSections = expandedSections.filter(function(section) {
                        if (sectionIdsToCollapse.indexOf(section.id) > -1) {
                            section.classList.remove(EXPANDED_SECTION_CLASS);
                            return false;
                        }
                        return true;
                    });
                }

                function toggleExpandSection(id) {
                    const expandedSectionIds = getExpandedSectionIds();
                    const indexOfExpandedSectionId = expandedSectionIds.indexOf(id);
                    if (isTopLevelSection(id)) {
                        if (indexOfExpandedSectionId >= 0) {
                            collapseSections([id]);
                        } else {
                            expandSection(id);
                        }
                    }
                }

                function bindClickListener() {
                    props.container.addEventListener('click', function(e) {
                        if (!(e.target instanceof HTMLElement)) {
                            return;
                        }
                        const tocSection = (e.target.closest(`.${SECTION_CLASS}`));
                        if (tocSection && tocSection.id) {
                            if (e.target.classList.contains(LINK_CLASS)) {
                                props.onHeadingClick(tocSection.id);
                            }
                            if (e.target.classList.contains(TOGGLE_CLASS)) {
                                props.onToggleClick(tocSection.id);
                            }
                        }
                    });
                }

                function initialize() {
                    expandedSections = Array.from(props.container.querySelectorAll(`.${EXPANDED_SECTION_CLASS}`));
                    bindClickListener();
                }
                initialize();
                return {
                    expandSection,
                    changeActiveSection,
                    toggleExpandSection,
                    ACTIVE_SECTION_CLASS,
                    EXPANDED_SECTION_CLASS,
                    LINK_CLASS,
                    TOGGLE_CLASS
                };
            };
        },
        "resources/skins.vector.es6/sectionObserver.js": function(require, module) {
            module.exports = function sectionObserver(props) {
                props = Object.assign({
                    topMargin: 0,
                    throttleMs: 200,
                    onIntersection: () => {}
                }, props);
                let inThrottle = false;
                let current;
                const observer = new IntersectionObserver((entries) => {
                    let closestNegativeEntry;
                    let closestPositiveEntry;
                    const topMargin = (props.topMargin);
                    entries.forEach((entry) => {
                        const top = entry.boundingClientRect.top - topMargin;
                        if (top > 0 && (closestPositiveEntry === undefined || top < closestPositiveEntry.boundingClientRect.top - topMargin)) {
                            closestPositiveEntry = entry;
                        }
                        if (top <= 0 && (closestNegativeEntry === undefined || top > closestNegativeEntry.boundingClientRect.top - topMargin)) {
                            closestNegativeEntry = entry;
                        }
                    });
                    const closestTag = (closestNegativeEntry ? closestNegativeEntry.target : (closestPositiveEntry).target);
                    if (current !== closestTag) {
                        props.onIntersection(closestTag);
                    }
                    current = closestTag;
                    observer.disconnect();
                });

                function calcIntersection() {
                    props.elements.forEach((element) => {
                        observer.observe((element));
                    });
                }

                function handleScroll() {
                    if (!inThrottle) {
                        inThrottle = true;
                        setTimeout(() => {
                            calcIntersection();
                            inThrottle = false;
                        }, props.throttleMs);
                    }
                }

                function bindScrollListener() {
                    window.addEventListener('scroll', handleScroll);
                }

                function unbindScrollListener() {
                    window.removeEventListener('scroll', handleScroll);
                }

                function pause() {
                    unbindScrollListener();
                    current = undefined;
                }

                function resume() {
                    bindScrollListener();
                }

                function unmount() {
                    unbindScrollListener();
                    observer.disconnect();
                }

                function setElements(list) {
                    props.elements = list;
                }
                bindScrollListener();
                calcIntersection();
                return {
                    pause,
                    resume,
                    unmount,
                    setElements
                };
            };
        },
        "resources/skins.vector.es6/deferUntilFrame.js": function(require, module) {
            function deferUntilFrame(callback, frameCount) {
                if (frameCount === 0) {
                    callback();
                    return;
                }
                requestAnimationFrame(() => {
                    deferUntilFrame(callback, frameCount - 1);
                });
            }
            module.exports = deferUntilFrame;
        },
        "resources/skins.vector.es6/config.json": {
            "wgVectorSearchHost": "",
            "wgVectorWebABTestEnrollment": {
                "name": "vector.sticky_header",
                "enabled": false,
                "buckets": {
                    "unsampled": {
                        "samplingRate": 0.1
                    },
                    "control": {
                        "samplingRate": 0.3
                    },
                    "stickyHeaderDisabled": {
                        "samplingRate": 0.3
                    },
                    "stickyHeaderEnabled": {
                        "samplingRate": 0.3
                    }
                }
            }
        }
    }
}, null, null, null);;