UNPKG

@scalar/api-client

Version:

the open source API testing client

64 lines (63 loc) 1.92 kB
import { defineComponent as u, ref as d, watch as i, createElementBlock as r, createBlock as c, openBlock as l, normalizeClass as n, createElementVNode as s, withCtx as y, createTextVNode as f } from "vue"; import m from "./ResponseBodyInfo.vue.js"; const v = ["src"], k = ["src", "type"], w = ["src", "type"], x = ["data", "type"], $ = /* @__PURE__ */ u({ __name: "ResponseBodyPreview", props: { src: {}, type: {}, mode: {}, alpha: { type: Boolean, default: !1 } }, setup(e) { const o = d(!1); return i( () => e.src, () => o.value = !1 ), (B, t) => !o.value && e.src ? (l(), r("div", { key: 0, class: n(["flex justify-center overflow-auto rounded-b", { "bg-preview p-2": e.alpha }]) }, [ e.mode === "image" ? (l(), r("img", { key: 0, class: n(["h-full max-w-full", { rounded: e.alpha }]), src: e.src, onError: t[0] || (t[0] = (a) => o.value = !0) }, null, 42, v)) : e.mode === "video" ? (l(), r("video", { key: 1, autoplay: "", controls: "", width: "100%", onError: t[1] || (t[1] = (a) => o.value = !0) }, [ s("source", { src: e.src, type: e.type }, null, 8, k) ], 32)) : e.mode === "audio" ? (l(), r("audio", { key: 2, class: "my-12", controls: "", onError: t[2] || (t[2] = (a) => o.value = !0) }, [ s("source", { src: e.src, type: e.type }, null, 8, w) ], 32)) : (l(), r("object", { key: 3, class: "aspect-[4/3] w-full", data: e.src, type: e.type, onError: t[3] || (t[3] = (a) => o.value = !0) }, null, 40, x)) ], 2)) : (l(), c(m, { key: 1 }, { default: y(() => [...t[4] || (t[4] = [ f("Preview unavailable", -1) ])]), _: 1 })); } }); export { $ as default };