import { useResponseBody } from "../../../hooks/useResponseBody.js";
import ViewLayoutCollapse_default from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
import ResponseBodyDownload_default from "./ResponseBodyDownload.vue.js";
import { computed, createBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, openBlock, toRef, unref, withCtx } from "vue";
import { ScalarVirtualText } from "@scalar/components";
import { formatJsonOrYamlString } from "@scalar/oas-utils/helpers";
//#region src/views/Request/ResponseSection/ResponseBodyVirtual.vue?vue&type=script&setup=true&lang.ts
var ResponseBodyVirtual_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "ResponseBodyVirtual",
	props: {
		content: {},
		data: {},
		headers: {}
	},
	setup(__props) {
		const props = __props;
		const textContent = computed(() => formatJsonOrYamlString(props.content));
		const { mimeType, attachmentFilename, dataUrl } = useResponseBody({
			data: toRef(props, "data"),
			headers: toRef(props, "headers")
		});
		return (_ctx, _cache) => {
			return openBlock(), createBlock(ViewLayoutCollapse_default, { class: "!max-h-100% response-body-virtual overflow-x-auto" }, createSlots({
				title: withCtx(() => [_cache[0] || (_cache[0] = createTextVNode("Body", -1))]),
				default: withCtx(() => [_cache[1] || (_cache[1] = createElementVNode("div", { class: "font-code text-xxs rounded-t border border-b-0 px-2.5 py-1.5" }, " This response body is massive! Syntax highlighting won't work here. ", -1)), createVNode(unref(ScalarVirtualText), {
					containerClass: "custom-scroll scalar-code-block border rounded-b flex flex-1 max-h-screen",
					contentClass: "language-plaintext whitespace-pre font-code text-base",
					lineHeight: 20,
					text: textContent.value
				}, null, 8, ["text"])]),
				_: 2
			}, [unref(dataUrl) ? {
				name: "actions",
				fn: withCtx(() => [createVNode(ResponseBodyDownload_default, {
					filename: unref(attachmentFilename),
					href: unref(dataUrl),
					type: unref(mimeType).essence
				}, null, 8, [
					"filename",
					"href",
					"type"
				])]),
				key: "0"
			} : void 0]), 1024);
		};
	}
});
//#endregion
export { ResponseBodyVirtual_vue_vue_type_script_setup_true_lang_default as default };

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