import { defineComponent, defineAsyncComponent, ref, computed, onMounted, watch, nextTick, resolveComponent, openBlock, createBlock, withCtx, createVNode, unref, createElementVNode, createCommentVNode } from 'vue';
import { useRoute } from 'vue-router';
import { storeToRefs } from 'pinia';
import '../../../../stores/index.mjs';
import { useThemeConfig } from '../../../../stores/themeConfig.mjs';

const _hoisted_1 = { class: "flex-center layout-backtop" };
var _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "classic",
  setup(__props) {
    const LayoutAside = defineAsyncComponent(() => import('../component/aside.vue.mjs'));
    const LayoutHeader = defineAsyncComponent(() => import('../component/header.vue.mjs'));
    const LayoutMain = defineAsyncComponent(() => import('../component/main.vue.mjs'));
    const LayoutTagsView = defineAsyncComponent(() => import('../navBars/tagsView/tagsView.vue.mjs'));
    const layoutMainRef = ref();
    const route = useRoute();
    const storesThemeConfig = useThemeConfig();
    const { themeConfig } = storeToRefs(storesThemeConfig);
    const isTagsview = computed(() => {
      return themeConfig.value.isTagsview;
    });
    const updateScrollbar = () => {
      var _a;
      (_a = layoutMainRef.value) == null ? void 0 : _a.layoutMainScrollbarRef.update();
    };
    const initScrollBarHeight = () => {
      nextTick(() => {
        setTimeout(() => {
          updateScrollbar();
          if (layoutMainRef.value) layoutMainRef.value.layoutMainScrollbarRef.wrapRef.scrollTop = 0;
        }, 500);
      });
    };
    onMounted(() => {
      initScrollBarHeight();
    });
    watch(
      () => route.path,
      () => {
        initScrollBarHeight();
      }
    );
    watch(
      () => themeConfig.value.isTagsview,
      () => {
        nextTick(() => {
          updateScrollbar();
        });
      },
      {
        deep: true
      }
    );
    return (_ctx, _cache) => {
      const _component_el_container = resolveComponent("el-container");
      return openBlock(), createBlock(_component_el_container, { class: "layout-container flex-center" }, {
        default: withCtx(() => [
          createVNode(unref(LayoutHeader)),
          createVNode(_component_el_container, { class: "layout-mian-height-50" }, {
            default: withCtx(() => [
              createVNode(unref(LayoutAside)),
              createElementVNode("div", _hoisted_1, [
                isTagsview.value ? (openBlock(), createBlock(unref(LayoutTagsView), { key: 0 })) : createCommentVNode("v-if", true),
                createVNode(
                  unref(LayoutMain),
                  {
                    ref_key: "layoutMainRef",
                    ref: layoutMainRef
                  },
                  null,
                  512
                  /* NEED_PATCH */
                )
              ])
            ]),
            _: 1
            /* STABLE */
          })
        ]),
        _: 1
        /* STABLE */
      });
    };
  }
});

export { _sfc_main as default };
