import { defineComponent, useId, computed, createBlock, openBlock, unref, withCtx, createVNode, createElementBlock, createCommentVNode, renderSlot } from "vue";
import _sfc_main$1 from "../../../Lazy/Lazy.vue.js";
import ShowMoreButton from "../../../ShowMoreButton.vue.js";
import _sfc_main$2 from "./TagSection.vue.js";
import SectionContainer from "../../../Section/SectionContainer.vue.js";
const _hoisted_1 = {
  key: 0,
  class: "contents"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "ModernLayout",
  props: {
    tag: {},
    moreThanOneTag: { type: Boolean },
    isLoading: { type: Boolean },
    isCollapsed: { type: Boolean },
    eventBus: {}
  },
  setup(__props) {
    const headerId = useId();
    const moreThanOneDefaultTag = computed(
      () => __props.moreThanOneTag || __props.tag?.title !== "default" || __props.tag?.description !== ""
    );
    const hasChildren = computed(() => (__props.tag?.children?.length ?? 0) > 0);
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(SectionContainer), {
        "aria-labelledby": unref(headerId),
        class: "tag-section-container",
        role: "region"
      }, {
        default: withCtx(() => [
          createVNode(_sfc_main$1, {
            id: __props.tag.id
          }, {
            default: withCtx(() => [
              moreThanOneDefaultTag.value ? (openBlock(), createBlock(_sfc_main$2, {
                key: 0,
                eventBus: __props.eventBus,
                headerId: unref(headerId),
                isCollapsed: __props.isCollapsed,
                isLoading: __props.isLoading,
                tag: __props.tag
              }, null, 8, ["eventBus", "headerId", "isCollapsed", "isLoading", "tag"])) : createCommentVNode("", true),
              __props.isCollapsed && __props.moreThanOneTag && hasChildren.value ? (openBlock(), createBlock(ShowMoreButton, {
                key: 1,
                id: __props.tag.id,
                "aria-label": `Show all ${__props.tag.title} endpoints`,
                onClick: _cache[0] || (_cache[0] = () => __props.eventBus?.emit("toggle:nav-item", { id: __props.tag.id, open: true }))
              }, null, 8, ["id", "aria-label"])) : createCommentVNode("", true)
            ]),
            _: 1
          }, 8, ["id"]),
          !(__props.isCollapsed && __props.moreThanOneTag) ? (openBlock(), createElementBlock("div", _hoisted_1, [
            renderSlot(_ctx.$slots, "default", {}, void 0, true)
          ])) : createCommentVNode("", true)
        ]),
        _: 3
      }, 8, ["aria-labelledby"]);
    };
  }
});
export {
  _sfc_main as default
};
