'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 themeConfig = require('../../../../stores/themeConfig.js');
var loading = require('../../../../utils/loading.js');

var _sfc_main = /* @__PURE__ */ vue.defineComponent({
  __name: "defaults",
  setup(__props) {
    const LayoutAside = vue.defineAsyncComponent(() => Promise.resolve().then(function () { return require('../component/aside.vue.js'); }));
    const LayoutHeader = vue.defineAsyncComponent(() => Promise.resolve().then(function () { return require('../component/header.vue.js'); }));
    const LayoutMain = vue.defineAsyncComponent(() => Promise.resolve().then(function () { return require('../component/main.vue.js'); }));
    const layoutScrollbarRef = vue.ref("");
    const layoutMainRef = vue.ref();
    const route = vueRouter.useRoute();
    const storesThemeConfig = themeConfig.useThemeConfig();
    const { themeConfig: themeConfig$1 } = pinia.storeToRefs(storesThemeConfig);
    const updateScrollbar = () => {
      layoutScrollbarRef.value.update();
      layoutMainRef.value.layoutMainScrollbarRef.update();
    };
    const initScrollBarHeight = () => {
      vue.nextTick(() => {
        setTimeout(() => {
          updateScrollbar();
          layoutScrollbarRef.value.wrapRef.scrollTop = 0;
          if (layoutMainRef.value != void 0) layoutMainRef.value.layoutMainScrollbarRef.wrapRef.scrollTop = 0;
        }, 500);
      });
    };
    vue.onMounted(() => {
      initScrollBarHeight();
      loading.NextLoading.done(600);
    });
    vue.watch(
      () => route.path,
      () => {
        initScrollBarHeight();
      }
    );
    vue.watch(
      () => [themeConfig$1.value.isTagsview, themeConfig$1.value.isFixedHeader],
      () => {
        vue.nextTick(() => {
          updateScrollbar();
        });
      },
      {
        deep: true
      }
    );
    return (_ctx, _cache) => {
      const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
      const _component_el_container = vue.resolveComponent("el-container");
      return vue.openBlock(), vue.createBlock(_component_el_container, { class: "layout-container" }, {
        default: vue.withCtx(() => [
          !_ctx.$slots.aside ? (vue.openBlock(), vue.createBlock(vue.unref(LayoutAside), { key: 0 }, {
            default: vue.withCtx(() => [
              (vue.openBlock(true), vue.createElementBlock(
                vue.Fragment,
                null,
                vue.renderList(_ctx.$slots, (_, name) => {
                  return vue.renderSlot(_ctx.$slots, name, vue.mergeProps({
                    key: name,
                    ref_for: true
                  }, _ctx.$slots[name].props || {}));
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ]),
            _: 3
            /* FORWARDED */
          })) : vue.renderSlot(_ctx.$slots, "aside", { key: 1 }),
          vue.createVNode(_component_el_container, { class: "layout-container-view h100" }, {
            default: vue.withCtx(() => [
              vue.createVNode(
                _component_el_scrollbar,
                {
                  ref_key: "layoutScrollbarRef",
                  ref: layoutScrollbarRef,
                  class: "layout-backtop"
                },
                {
                  default: vue.withCtx(() => [
                    !_ctx.$slots.header ? (vue.openBlock(), vue.createBlock(vue.unref(LayoutHeader), { key: 0 }, {
                      default: vue.withCtx(() => [
                        (vue.openBlock(true), vue.createElementBlock(
                          vue.Fragment,
                          null,
                          vue.renderList(_ctx.$slots, (_, name) => {
                            return vue.renderSlot(_ctx.$slots, name, vue.mergeProps({
                              key: name,
                              ref_for: true
                            }, _ctx.$slots[name].props || {}));
                          }),
                          128
                          /* KEYED_FRAGMENT */
                        ))
                      ]),
                      _: 3
                      /* FORWARDED */
                    })) : vue.renderSlot(_ctx.$slots, "header", { key: 1 }),
                    !_ctx.$slots.main ? (vue.openBlock(), vue.createBlock(
                      vue.unref(LayoutMain),
                      {
                        key: 2,
                        ref_key: "layoutMainRef",
                        ref: layoutMainRef
                      },
                      {
                        default: vue.withCtx(() => [
                          (vue.openBlock(true), vue.createElementBlock(
                            vue.Fragment,
                            null,
                            vue.renderList(_ctx.$slots, (_, name) => {
                              return vue.renderSlot(_ctx.$slots, name, vue.mergeProps({
                                key: name,
                                ref_for: true
                              }, _ctx.$slots[name].props || {}));
                            }),
                            128
                            /* KEYED_FRAGMENT */
                          ))
                        ]),
                        _: 3
                        /* FORWARDED */
                      },
                      512
                      /* NEED_PATCH */
                    )) : vue.renderSlot(_ctx.$slots, "main", { key: 3 })
                  ]),
                  _: 3
                  /* FORWARDED */
                },
                512
                /* NEED_PATCH */
              )
            ]),
            _: 3
            /* FORWARDED */
          })
        ]),
        _: 3
        /* FORWARDED */
      });
    };
  }
});

exports.default = _sfc_main;
