import { defineComponent, defineAsyncComponent, ref, computed, onMounted, resolveComponent, openBlock, createBlock, normalizeStyle, withCtx, createVNode, unref, createCommentVNode } from 'vue';
import { useRoute } from 'vue-router';
import { storeToRefs } from 'pinia';
import '../../../../stores/index.mjs';
import '../../../../utils/index.mjs';
import { useTagsViewRoutes } from '../../../../stores/tagsViewRoutes.mjs';
import { useThemeConfig } from '../../../../stores/themeConfig.mjs';
import { NextLoading } from '../../../../utils/loading.mjs';

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

export { _sfc_main as default };
