(function () {
  var root = document.documentElement;
  root.classList.remove('no-js');
  root.classList.add('js');
  root.classList.add('aside-pending');

  var assetBase = root.dataset.assetBase || '';
  if (assetBase) {
    window.APP_ASSET_BASE = assetBase;
  }

  try {
    if (window.localStorage.getItem('app-sidebar-collapsed') === '1') {
      root.classList.add('sidebar-collapsed');
    }
    if (window.localStorage.getItem('app-sidebar-hidden') === '1') {
      root.classList.add('sidebar-hidden');
    }
    var contrastValue = window.localStorage.getItem('app-contrast');
    if (contrastValue === 'high') {
      root.dataset.contrast = 'high';
    } else {
      root.dataset.contrast = 'normal';
    }
  } catch (e) {
    // ignore storage errors
  }

  if (typeof window.requestFsLightboxRefresh !== 'function') {
    window.requestFsLightboxRefresh = function () {
      if (typeof window.refreshFsLightbox === 'function') {
        window.refreshFsLightbox();
        window.__fsLightboxRefreshPending = false;
        return true;
      }
      window.__fsLightboxRefreshPending = true;
      return false;
    };
  }
})();
