"use strict";
import {util} from "../../util/util.js";
import {menuSettingsConfig} from "./menuSettingsConfig.js";
import {config} from "../../config.js";

class menuConfig{

    static getMenuConfigJson(){
        if(!util.isNull(this.menuConfigJson)){
            return this.menuConfigJson;
        }
        this.menuConfigJson={}
        this.menuConfigJson.defaultTemplate = '';
        this.menuConfigJson.bigModelTemplate = '';
        this.menuConfigJson.navbarTheme=menuSettingsConfig.getMenuSettingsConfigJson().navbarTheme
        this.menuConfigJson.sidenavTheme=menuSettingsConfig.getMenuSettingsConfigJson().sidenavTheme




        this.menuConfigJson.defaultTemplate = `<!-- Layout wrapper -->
<div class="layout-wrapper layout-2">
    <div class="layout-inner">
        <!-- Layout sidenav -->
         <div id="showMenuLayout" class="layout-sidenav sidenav sidenav-vertical bg-${this.menuConfigJson.sidenavTheme}">
            <!-- Brand demo (see assets/css/demo/demo.css) -->
            <!--自定义logo-->
            <div class="demo-brand">
                <div class="demo-brand-logo" style="width: 40px">
                    <img style="padding: 2px;width: 44px;filter: sepia(100%) hue-rotate(0deg) saturate(5000%);" src="" id="systemLogoImgPC">
                </div>
                <a href="${config.getIndexUrl()+'#'+config.getHomePageCode()}" class="demo-brand-name sidenav-text font-weight-normal ml-2" id="systemNameA"></a>
                <a href="javascript:void(0)" id="menuIcon" class="layout-sidenav-toggle sidenav-link text-large ml-auto">
                    <i class="ion ion-md-menu align-middle"></i>
                </a>
            </div>
            <!--默认logo-->
            <!--<div class="demo-brand">
                <span class="demo-brand-logo bg-primary">
                    <svg viewBox="0 0 148 80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                        <defs>
                            <linearGradient id="a" x1="46.49" x2="62.46" y1="53.39" y2="48.2" gradientUnits="userSpaceOnUse">
                                <stop stop-opacity=".25" offset="0"></stop>
                                <stop stop-opacity=".1" offset=".3"></stop>
                                <stop stop-opacity="0" offset=".9"></stop>
                            </linearGradient>
                            <linearGradient id="e" x1="76.9" x2="92.64" y1="26.38" y2="31.49" xlink:href="#a"></linearGradient>
                            <linearGradient id="d" x1="107.12" x2="122.74" y1="53.41" y2="48.33" xlink:href="#a"></linearGradient>
                        </defs>
                        <path style="fill: #fff;" transform="translate(-.1)" d="M121.36,0,104.42,45.08,88.71,3.28A5.09,5.09,0,0,0,83.93,0H64.27A5.09,5.09,0,0,0,59.5,3.28L43.79,45.08,26.85,0H.1L29.43,76.74A5.09,5.09,0,0,0,34.19,80H53.39a5.09,5.09,0,0,0,4.77-3.26L74.1,35l16,41.74A5.09,5.09,0,0,0,94.82,80h18.95a5.09,5.09,0,0,0,4.76-3.24L148.1,0Z"></path>
                        <path transform="translate(-.1)" d="M52.19,22.73l-8.4,22.35L56.51,78.94a5,5,0,0,0,1.64-2.19l7.34-19.2Z" fill="url(#a)"></path>
                        <path transform="translate(-.1)" d="M95.73,22l-7-18.69a5,5,0,0,0-1.64-2.21L74.1,35l8.33,21.79Z" fill="url(#e)"></path>
                        <path transform="translate(-.1)" d="M112.73,23l-8.31,22.12,12.66,33.7a5,5,0,0,0,1.45-2l7.3-18.93Z" fill="url(#d)"></path>
                    </svg>
                </span>
                <a href="" class="demo-brand-name sidenav-text font-weight-normal ml-2" id="systemNameA"></a>
                <a href="javascript:void(0)" id="menuIcon" class="layout-sidenav-toggle sidenav-link text-large ml-auto">
                    <i class="ion ion-md-menu align-middle"></i>
                </a>
            </div>-->
            <div class="sidenav-divider mt-0"></div>
            <!-- Links -->
            <ul id="showMenu" class="sidenav-inner"></ul>
        </div>
        <!-- / Layout sidenav -->
        <!-- Layout container -->
        <span class="layout-container" style="padding-top: 66px">
            <!-- Layout navbar -->
            <nav class="layout-navbar navbar navbar-expand-lg align-items-lg-center container-p-x bg-${this.menuConfigJson.navbarTheme}" id="layout-navbar" style="z-index: 1001;">
                <!-- Brand demo (see assets/css/demo/demo.css) -->
                <!--自定义logo-->
                <a href="${config.getIndexUrl()+'#'+config.getHomePageCode()}" class="navbar-brand demo-brand d-lg-none py-0">
                    <div class="">
                        <img style="padding: 2px;width: 44px;filter: sepia(100%) hue-rotate(0deg) saturate(5000%);" src="" id="systemLogoImgAPP">
                    </div>
                    <span class="demo-brand-name font-weight-normal ml-2" id="systemNameSpan"></span>
                </a>
                <!--默认logo-->
                <!--<a href="" class="navbar-brand demo-brand d-lg-none py-0">
                    <span class="demo-brand-logo bg-primary">
                        <svg viewBox="0 0 148 80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                            <defs>
                                <linearGradient id="a" x1="46.49" x2="62.46" y1="53.39" y2="48.2" gradientUnits="userSpaceOnUse">
                                    <stop stop-opacity=".25" offset="0"></stop>
                                    <stop stop-opacity=".1" offset=".3"></stop>
                                    <stop stop-opacity="0" offset=".9"></stop>
                                </linearGradient>
                                <linearGradient id="e" x1="76.9" x2="92.64" y1="26.38" y2="31.49" xlink:href="#a"></linearGradient>
                                <linearGradient id="d" x1="107.12" x2="122.74" y1="53.41" y2="48.33" xlink:href="#a"></linearGradient>
                            </defs>
                            <path style="fill: #fff;" transform="translate(-.1)" d="M121.36,0,104.42,45.08,88.71,3.28A5.09,5.09,0,0,0,83.93,0H64.27A5.09,5.09,0,0,0,59.5,3.28L43.79,45.08,26.85,0H.1L29.43,76.74A5.09,5.09,0,0,0,34.19,80H53.39a5.09,5.09,0,0,0,4.77-3.26L74.1,35l16,41.74A5.09,5.09,0,0,0,94.82,80h18.95a5.09,5.09,0,0,0,4.76-3.24L148.1,0Z"></path>
                            <path transform="translate(-.1)" d="M52.19,22.73l-8.4,22.35L56.51,78.94a5,5,0,0,0,1.64-2.19l7.34-19.2Z" fill="url(#a)"></path>
                            <path transform="translate(-.1)" d="M95.73,22l-7-18.69a5,5,0,0,0-1.64-2.21L74.1,35l8.33,21.79Z" fill="url(#e)"></path>
                            <path transform="translate(-.1)" d="M112.73,23l-8.31,22.12,12.66,33.7a5,5,0,0,0,1.45-2l7.3-18.93Z" fill="url(#d)"></path>
                        </svg>
                    </span>
                    <span class="demo-brand-name font-weight-normal ml-2" id="systemNameSpan"></span>
                </a>-->
                 <!--Sidenav toggle (see assets/css/demo/demo.css)-->
                <div class="layout-sidenav-toggle navbar-nav d-lg-none align-items-lg-center mr-auto">
                    <a id="headerIcon"  class="nav-item nav-link px-0 ml-2 ml-lg-0" href="javascript:void(0)">
                        <i class="ion ion-md-menu text-large align-middle"></i>
                    </a>
                </div>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#layout-navbar-collapse">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="navbar-collapse collapse" id="layout-navbar-collapse">
                    <!-- Divider -->
                    <hr class="d-lg-none w-100 my-2">
                    <div class="navbar-nav align-items-lg-center ml-auto">
                        <div id="showHeaderIcon" class="navbar-nav align-items-lg-center"></div>
                        <!-- Divider -->
                        <div class="nav-item d-none d-lg-block text-big font-weight-light line-height-1 opacity-25 mr-3 ml-1">| </div>
                        <div id="showUserDropdownDiv" class="demo-navbar-user nav-item dropdown"></div>
                    </div>
                </div>
            </nav>
            <!-- / Layout navbar -->
            <!-- Layout content -->
            <div class="layout-content">
                <div class="container-fluid flex-grow-1 container-p-y pt-3 pb-0" id="">
                    <div id="showInputDiv" style="padding-bottom: 40px;"></div>
                </div>
            </div>
            <nav class="layout-footer footer bg-footer-theme fixed-bottom d-none" style="${config.getPageCode()=='page_component'?'display: none;':''}">
            <div class="container-fluid d-flex flex-wrap justify-content-between text-center container-p-x pb-3">
              <div class="pt-3">
                <span class="footer-text font-weight-bolder" style="margin-left: 250px">CCUI 2.0</span></div>
              <div>
                <a class="footer-link pt-3">演示环境用于功能体验，数据将不定期重置，请勿存储重要信息，感谢理解！</a>
              </div>
            </div>
          </nav>
        </span>
    </div>
</div>
<div id="formDetailModalArea"></div>
`;
        this.menuConfigJson.bigModelTemplate = `<div class="app-wrapper">
        <!-- 顶部菜单 -->
        <div class="top-navbar">
          <div class="navbar sidebar-border-bg" style="z-index: 1001">
            <div class="navbar-container">
              <!-- logo -->
              <div class="sidebar-logo-container" id="sidebar-logo">
                <span class="svg-icon">
                  <svg viewBox="0 0 148 80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                    <defs>
                      <linearGradient id="a" x1="46.49" x2="62.46" y1="53.39" y2="48.2" gradientUnits="userSpaceOnUse">
                        <stop stop-opacity=".25" offset="0"></stop>
                        <stop stop-opacity=".1" offset=".3"></stop>
                        <stop stop-opacity="0" offset=".9"></stop>
                      </linearGradient>
                      <linearGradient id="e" x1="76.9" x2="92.64" y1="26.38" y2="31.49" xlink:href="#a"></linearGradient>
                      <linearGradient id="d" x1="107.12" x2="122.74" y1="53.41" y2="48.33" xlink:href="#a"></linearGradient>
                    </defs>
                    <path style="fill: #fff" transform="translate(-.1)"
                      d="M121.36,0,104.42,45.08,88.71,3.28A5.09,5.09,0,0,0,83.93,0H64.27A5.09,5.09,0,0,0,59.5,3.28L43.79,45.08,26.85,0H.1L29.43,76.74A5.09,5.09,0,0,0,34.19,80H53.39a5.09,5.09,0,0,0,4.77-3.26L74.1,35l16,41.74A5.09,5.09,0,0,0,94.82,80h18.95a5.09,5.09,0,0,0,4.76-3.24L148.1,0Z">
                    </path>
                    <path transform="translate(-.1)" d="M52.19,22.73l-8.4,22.35L56.51,78.94a5,5,0,0,0,1.64-2.19l7.34-19.2Z"
                      fill="url(#a)"></path>
                    <path transform="translate(-.1)" d="M95.73,22l-7-18.69a5,5,0,0,0-1.64-2.21L74.1,35l8.33,21.79Z"
                      fill="url(#e)"></path>
                    <path transform="translate(-.1)" d="M112.73,23l-8.31,22.12,12.66,33.7a5,5,0,0,0,1.45-2l7.3-18.93Z"
                      fill="url(#d)"></path>
                  </svg>
                </span>
                <span id="systemNameA" class="navbar-system-name">大模型测试集系统</span>
                <!-- TODO -->
                <i id="systemNameSpan" style="display: none;"></i>
              </div>
              <!-- 1 -->
              <div style="flex: 1;"></div>
              <div id="showHeaderIcon" class="align-items-lg-center"></div>
              <!-- Divider -->
              <!-- <div class="nav-item d-none d-lg-block text-big font-weight-light line-height-1 opacity-25 mr-3 ml-1">| </div> -->
              <div id="showUserDropdownDiv" class="demo-navbar-user nav-item dropdown"></div>
            </div>
            
          </div>
        </div>
    <!-- 左侧菜单-一级菜单 left-sidebar-->
    <div class="sidebar-container left-sidebar-container sidebar-border-bg">
      <div class="left-sidebar">
        <!-- icon -->
        <div id="menuIcon" class="left-sidebar-collapse">
          <i class="ion ion-md-menu" style="font-size: 1.6em"></i>
        </div>
        <div class="sidenav-menu_container">
          <ul id="showMenu">
            <!-- 一级菜单项 -->
          </ul>
        </div>
      </div>
    </div>
    <!-- 左侧菜单-二级菜单card sidebar-->
    <div class="sidebar-container second-sidebar sidebar-border-bg">
      <ul id="showSecondMenu">
      </ul>
    </div>

    <!-- main -->
    <div class="main-container">
      <div id="showInputDiv" style="padding-bottom: 40px;"></div>
    </div>
  </div>
<div id="formDetailModalArea"></div>
`;
        let isEditComponent=util.getSessionStorageItem('isEditComponent');
        if(!(config.getPageCode()=='page_component')&&(isEditComponent=='S'||config.getConfigJson().defaultMenuSettings=='true')){
            this.menuConfigJson.defaultTemplate+=menuSettingsConfig.getMenuSettingsConfigJson().settingsTemplate;
        }
        return this.menuConfigJson;
    }

}
export {menuConfig};