import { defineComponent, createElementBlock, createCommentVNode, openBlock, normalizeClass, withModifiers, createElementVNode, createVNode, withCtx, createTextVNode } from "vue";
import Badge from "../../../components/Badge/Badge.vue.js";
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "DownloadLink",
  props: {
    documentDownloadType: {},
    eventBus: {}
  },
  setup(__props) {
    const handleDownloadClick = (format) => {
      __props.eventBus.emit("ui:download:document", { format });
    };
    return (_ctx, _cache) => {
      return ["yaml", "json", "both", "direct"].includes(_ctx.documentDownloadType) ? (openBlock(), createElementBlock("div", {
        key: 0,
        class: normalizeClass(["download-container group", {
          "download-both": _ctx.documentDownloadType === "both"
        }])
      }, [
        _ctx.documentDownloadType === "json" || _ctx.documentDownloadType === "both" || _ctx.documentDownloadType === "direct" ? (openBlock(), createElementBlock("button", {
          key: 0,
          class: "download-button",
          type: "button",
          onClick: _cache[0] || (_cache[0] = withModifiers(
            () => handleDownloadClick(
              _ctx.documentDownloadType === "direct" ? "direct" : "json"
            ),
            ["prevent"]
          ))
        }, [
          _cache[3] || (_cache[3] = createElementVNode("span", null, " Download OpenAPI Document ", -1)),
          createVNode(Badge, { class: "extension hidden group-hover:flex" }, {
            default: withCtx(() => [..._cache[2] || (_cache[2] = [
              createTextVNode("json", -1)
            ])]),
            _: 1
          })
        ])) : createCommentVNode("", true),
        _ctx.documentDownloadType === "yaml" || _ctx.documentDownloadType === "both" ? (openBlock(), createElementBlock("button", {
          key: 1,
          class: "download-button",
          type: "button",
          onClick: _cache[1] || (_cache[1] = withModifiers(() => handleDownloadClick("yaml"), ["prevent"]))
        }, [
          _cache[5] || (_cache[5] = createElementVNode("span", null, " Download OpenAPI Document ", -1)),
          createVNode(Badge, { class: "extension hidden group-hover:flex" }, {
            default: withCtx(() => [..._cache[4] || (_cache[4] = [
              createTextVNode("yaml", -1)
            ])]),
            _: 1
          })
        ])) : createCommentVNode("", true)
      ], 2)) : createCommentVNode("", true);
    };
  }
});
export {
  _sfc_main as default
};
