'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var vueRouter = require('vue-router');
var pinia = require('pinia');
require('../../../../stores/index.js');
require('../../../../utils/index.js');
var tagsViewRoutes = require('../../../../stores/tagsViewRoutes.js');
var themeConfig = require('../../../../stores/themeConfig.js');
var loading = require('../../../../utils/loading.js');

var _sfc_main = /* @__PURE__ */ vue.defineComponent({
  __name: "main",
  setup(__props, { expose: __expose }) {
    const LayoutParentView = vue.defineAsyncComponent(() => Promise.resolve().then(function () { return require('../routerView/parent.vue.js'); }));
    const LayoutFooter = vue.defineAsyncComponent(() => Promise.resolve().then(function () { return require('../footer/index.vue.js'); }));
    const layoutMainScrollbarRef = vue.ref();
    const route = vueRouter.useRoute();
    const storesTagsViewRoutes = tagsViewRoutes.useTagsViewRoutes();
    const storesThemeConfig = themeConfig.useThemeConfig();
    const { themeConfig: themeConfig$1 } = pinia.storeToRefs(storesThemeConfig);
    const { isTagsViewCurrenFull } = pinia.storeToRefs(storesTagsViewRoutes);
    const isFooter = vue.computed(() => {
      return themeConfig$1.value.isFooter && !route.meta.isIframe;
    });
    const isFixedHeader = vue.computed(() => {
      return themeConfig$1.value.isFixedHeader;
    });
    const setBacktopClass = vue.computed(() => {
      if (themeConfig$1.value.isFixedHeader) return `.layout-backtop-header-fixed .el-scrollbar__wrap`;
      else return `.layout-backtop .el-scrollbar__wrap`;
    });
    const setMainHeight = vue.computed(() => {
      if (isTagsViewCurrenFull.value) return "0px";
      const { isTagsview, layout } = themeConfig$1.value;
      if (isTagsview && layout !== "classic") return "85px";
      else return "51px";
    });
    vue.onMounted(() => {
      loading.NextLoading.done(600);
    });
    __expose({
      layoutMainScrollbarRef
    });
    return (_ctx, _cache) => {
      const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
      const _component_el_backtop = vue.resolveComponent("el-backtop");
      const _component_el_main = vue.resolveComponent("el-main");
      return vue.openBlock(), vue.createBlock(_component_el_main, {
        class: "layout-main",
        style: vue.normalizeStyle(isFixedHeader.value ? `height: calc(100% - ${setMainHeight.value})` : `minHeight: calc(100% - ${setMainHeight.value})`)
      }, {
        default: vue.withCtx(() => [
          vue.createVNode(
            _component_el_scrollbar,
            {
              ref_key: "layoutMainScrollbarRef",
              ref: layoutMainScrollbarRef,
              class: "layout-main-scroll layout-backtop-header-fixed",
              "wrap-class": "layout-main-scroll",
              "view-class": "layout-main-scroll"
            },
            {
              default: vue.withCtx(() => [
                vue.createVNode(vue.unref(LayoutParentView)),
                isFooter.value ? (vue.openBlock(), vue.createBlock(vue.unref(LayoutFooter), { key: 0 })) : vue.createCommentVNode("v-if", true)
              ]),
              _: 1
              /* STABLE */
            },
            512
            /* NEED_PATCH */
          ),
          vue.createVNode(_component_el_backtop, { target: setBacktopClass.value }, null, 8, ["target"])
        ]),
        _: 1
        /* STABLE */
      }, 8, ["style"]);
    };
  }
});

exports.default = _sfc_main;
