/* 
This should work on class sidebar-wrapper
*/

const SELECTOR_SIDEBAR_WRAPPER = '.sidebar-wrapper';

const Default = {
    scrollbarTheme: 'os-theme-light',
    scrollbarAutoHide: 'leave',
    scrollbarClickScroll: true,
};

document.addEventListener('DOMContentLoaded', function () {
    const sidebarWrapper = document.querySelector(SELECTOR_SIDEBAR_WRAPPER);
    if (sidebarWrapper && typeof OverlayScrollbarsGlobal?.OverlayScrollbars !== 'undefined') {
        OverlayScrollbarsGlobal.OverlayScrollbars(sidebarWrapper, {
            scrollbars: {
                theme: Default.scrollbarTheme,
                autoHide: Default.scrollbarAutoHide,
                clickScroll: Default.scrollbarClickScroll,
            },
            overflow: {
                x: 'hidden',
                y: 'scroll',
              },
        });
    }
});


/* This should work with class=data-overlayscrollbars-initialize and id=scrolltarget */

/* https://kingsora.github.io/OverlayScrollbars/ */

/* const { OverlayScrollbars, ClickScrollPlugin } = OverlayScrollbarsGlobal;

// optional: use the ClickScrollPlugin to make the option "scrollbars.clickScroll: true" available
OverlayScrollbars.plugin(ClickScrollPlugin);

OverlayScrollbars(document.body, {
  scrollbars: {
    clickScroll: true,
  },
  overflow: {
    x: 'hidden',
    y: 'scroll',
  },
});
OverlayScrollbars(document.getElementById('scrollTarget'), {});

 */