import { p as pageHeader, a as pageFooter } from './footer-c9f536dd.mjs';
import { computed, useSSRContext, resolveComponent, withCtx, createVNode, createTextVNode, toDisplayString, mergeProps } from 'vue';
import { u as useAPI } from './api-115b4897.mjs';
import { Countdown, NavigationComponents } from '@vue-layout/basic';
import { d as defineNuxtComponent, u as useAuthStore, b as storeToRefs } from './auth-2d06b6ac.mjs';
import { ssrRenderAttrs, ssrInterpolate, ssrRenderComponent, ssrRenderAttr, ssrRenderSlot } from 'vue/server-renderer';
import { _ as _export_sfc } from './_plugin-vue_export-helper-cc2b3d55.mjs';
import './nuxt-link-5ac46069.mjs';
import 'ufo';
import 'hookable';
import 'unctx';
import 'h3';
import './composables-31566dd1.mjs';
import '@ucast/mongo2js';
import 'change-case';
import '@ebec/http';
import 'hapic';
import '@hapic/oauth2';

const _sfc_main$1 = defineNuxtComponent({
  components: { Countdown, NavigationComponents },
  setup() {
    const store = useAuthStore();
    const { loggedIn, accessTokenExpireDate: tokenExpireDate, realmManagement } = storeToRefs(store);
    const tokenExpiresIn = computed(() => {
      if (!tokenExpireDate.value) {
        return 0;
      }
      return tokenExpireDate.value.getTime() - Date.now();
    });
    const docsUrl = computed(() => {
      const api = useAPI();
      return new URL("docs/", api.config.baseURL).href;
    });
    return {
      loggedIn,
      tokenExpiresIn,
      docsUrl,
      realmManagement
    };
  }
});
function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  const _component_navigation_components = resolveComponent("navigation-components");
  const _component_countdown = resolveComponent("countdown");
  _push(`<div${ssrRenderAttrs(_attrs)}><div class="page-sidebar">`);
  if (_ctx.realmManagement) {
    _push(`<div class="sidebar-header"><div class="text-center">${ssrInterpolate(_ctx.realmManagement.name)}</div></div>`);
  } else {
    _push(`<!---->`);
  }
  _push(ssrRenderComponent(_component_navigation_components, {
    class: "sidebar-menu navbar-nav",
    tier: 1
  }, null, _parent));
  _push(`<div class="mt-auto">`);
  if (_ctx.loggedIn) {
    _push(`<div class="font-weight-light d-flex flex-column ms-3 me-3 mb-1 mt-auto"><small class="text-muted">`);
    _push(ssrRenderComponent(_component_countdown, { time: _ctx.tokenExpiresIn }, {
      default: withCtx((props, _push2, _parent2, _scopeId) => {
        if (_push2) {
          _push2(`<i class="fa fa-clock pr-1"${_scopeId}></i> The session expires in <span class="text-success"${_scopeId}>${ssrInterpolate(props.minutes)} minute(s), ${ssrInterpolate(props.seconds)} second(s)</span>. `);
        } else {
          return [
            createVNode("i", { class: "fa fa-clock pr-1" }),
            createTextVNode(" The session expires in "),
            createVNode("span", { class: "text-success" }, toDisplayString(props.minutes) + " minute(s), " + toDisplayString(props.seconds) + " second(s)", 1),
            createTextVNode(". ")
          ];
        }
      }),
      _: 1
    }, _parent));
    _push(`</small></div>`);
  } else {
    _push(`<!---->`);
  }
  _push(`<ul class="sidebar-menu nav-items navbar-nav"><li class="nav-item"><a class="nav-link"${ssrRenderAttr("href", _ctx.docsUrl)} target="_blank"><i class="fa fa-file"></i> <span class="nav-link-text">API Docs</span></a></li></ul></div></div></div>`);
}
const _sfc_setup$1 = _sfc_main$1.setup;
_sfc_main$1.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/sidebar.vue");
  return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const pageSidebar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["ssrRender", _sfc_ssrRender$1]]);

const _sfc_main = {
  components: {
    pageHeader,
    pageFooter,
    pageSidebar
  }
};
function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  const _component_page_header = resolveComponent("page-header");
  const _component_page_sidebar = resolveComponent("page-sidebar");
  const _component_page_footer = resolveComponent("page-footer");
  _push(`<div${ssrRenderAttrs(mergeProps({ id: "app" }, _attrs))}>`);
  _push(ssrRenderComponent(_component_page_header, null, null, _parent));
  _push(`<div class="page-wrapper">`);
  _push(ssrRenderComponent(_component_page_sidebar, null, null, _parent));
  _push(`<div class="page-content">`);
  ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
  _push(`</div></div>`);
  _push(ssrRenderComponent(_component_page_footer, null, null, _parent));
  _push(`</div>`);
}
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("layouts/default.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const _default = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);

export { _default as default };
//# sourceMappingURL=default-ae09bd18.mjs.map
