$(document).ready(function () {
  if (typeof menu !== 'underfined' && menu !== '') {
  //ALL-2654 uezono start 20240606 ------
    var menuEscapse = '';
    try{
         menuEscapse = decodeURIComponent( menu );
    }catch(err){
         menuEscapse = decodeURIComponent( encodeURIComponent(menu) );
    }
  //ALL-2654 uezono end   20240606 ------
    var navDiv = $(document).find(".nav-menu-list");
//    var navDivScroll = $(navDiv).find(".sidebar-scroll");
    $(navDiv).html($(menuEscapse));

    var linkPage = $(document).find('.sidebar-selected-link');
    $(linkPage).removeClass('sidebar-selected-link');
    var current = $(navDiv).attr('data-html-file');
    $(document).find('a.sidebar-link[data-file-id="' + current + '"]').addClass('sidebar-selected-link');

    var selectLink = $('.sidebar-links .sidebar-selected-link');
    $(selectLink).parents('ul.sidebar-sub-headers').each(function (index, item) {
      var pageId = $(item).attr('data-parent-id');
      if ($('.sidebar-links a.icon[data-page-id="' + pageId + '"]').hasClass('close')) {
        $('.sidebar-links a.icon[data-page-id="' + pageId + '"]').removeClass('close').addClass('open');
      }

      $(item).css('display', 'block');
      $(item).find('ul.sidebar-sub-headers[data-parent-id="' + pageId + '"]').css('display', 'block');
    });

    var li = $(selectLink).parent();
    var pageId = $(li).attr('data-page-id');
    $(li).find('ul.sidebar-sub-headers[data-parent-id="' + pageId + '"]').css('display', 'block');
    if ($(li).children('a.icon').hasClass('close')) {
      $(li).children('a.icon').removeClass('close').addClass('open');
    }
  }
});