import Badge_default from "../../../components/Badge/Badge.vue.js";
import { createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, withCtx, withModifiers } from "vue";
//#region src/blocks/scalar-info-block/components/DownloadLink.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = ["href"];
var DownloadLink_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "DownloadLink",
	props: {
		documentDownloadType: {},
		eventBus: {},
		documentUrl: {}
	},
	setup(__props) {
		const handleDownloadClick = (format) => {
			__props.eventBus.emit("ui:download:document", { format });
		};
		return (_ctx, _cache) => {
			return [
				"yaml",
				"json",
				"both"
			].includes(__props.documentDownloadType) || __props.documentDownloadType === "direct" && __props.documentUrl ? (openBlock(), createElementBlock("div", {
				key: 0,
				class: normalizeClass(["download-container group", { "download-both": __props.documentDownloadType === "both" }])
			}, [
				__props.documentDownloadType === "direct" && __props.documentUrl ? (openBlock(), createElementBlock("a", {
					key: 0,
					class: "download-link download-button",
					href: __props.documentUrl
				}, [..._cache[2] || (_cache[2] = [createElementVNode("span", null, " Download OpenAPI Document ", -1)])], 8, _hoisted_1)) : createCommentVNode("", true),
				__props.documentDownloadType === "json" || __props.documentDownloadType === "both" ? (openBlock(), createElementBlock("button", {
					key: 1,
					class: "download-button",
					type: "button",
					onClick: _cache[0] || (_cache[0] = withModifiers(() => handleDownloadClick("json"), ["prevent"]))
				}, [_cache[4] || (_cache[4] = createElementVNode("span", null, " Download OpenAPI Document ", -1)), createVNode(Badge_default, { class: "extension hidden group-hover:flex" }, {
					default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("json", -1)])]),
					_: 1
				})])) : createCommentVNode("", true),
				__props.documentDownloadType === "yaml" || __props.documentDownloadType === "both" ? (openBlock(), createElementBlock("button", {
					key: 2,
					class: "download-button",
					type: "button",
					onClick: _cache[1] || (_cache[1] = withModifiers(() => handleDownloadClick("yaml"), ["prevent"]))
				}, [_cache[6] || (_cache[6] = createElementVNode("span", null, " Download OpenAPI Document ", -1)), createVNode(Badge_default, { class: "extension hidden group-hover:flex" }, {
					default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("yaml", -1)])]),
					_: 1
				})])) : createCommentVNode("", true)
			], 2)) : createCommentVNode("", true);
		};
	}
});
//#endregion
export { DownloadLink_vue_vue_type_script_setup_true_lang_default as default };

//# sourceMappingURL=DownloadLink.vue.script.js.map