import { ref as x, onMounted as p, computed as h, createElementBlock as o, openBlock as l, createCommentVNode as c, createElementVNode as e, unref as n, toDisplayString as d } from "vue";
import { useObjectUrl as _, prettyBytes as b } from "./composables-BAZQlC3e.js";
const y = { class: "border-1 flex flex-col rounded border-dark dark-border-light" }, k = ["src"], w = ["src"], B = { class: "flex flex-wrap gap-2 p-2 items-center" }, V = { class: "flex-1 font-bold" }, j = { class: "text-sm" }, C = { class: "font-mono" }, D = {
  key: 0,
  class: "text-green-400 flex items-center gap-2"
}, E = ["href", "download"], S = {
  __name: "FileCard",
  props: {
    file: {
      type: Object,
      default: null
    }
  },
  setup(t) {
    const a = t, r = x();
    p(async () => {
      r.value = await a.file.blob();
    });
    const v = h(() => {
      var s;
      return (s = a.file.type) == null ? void 0 : s.startsWith("image/");
    }), g = h(() => {
      var s;
      return (s = a.file.type) == null ? void 0 : s.startsWith("video/");
    }), i = _(r);
    return (s, f) => {
      var m, u;
      return l(), o("div", y, [
        v.value ? (l(), o("img", {
          key: 0,
          class: "max-h-80vh m-auto",
          src: n(i)
        }, null, 8, k)) : c("", !0),
        g.value ? (l(), o("video", {
          key: 1,
          class: "w-full max-h-90vh",
          src: n(i),
          controls: ""
        }, null, 8, w)) : c("", !0),
        e("div", B, [
          e("div", V, d(t.file.name), 1),
          e("div", j, d(t.file.type), 1),
          e("div", C, d(n(b)(t.file.length)), 1),
          (m = t.file) != null && m.done ? (l(), o("div", D, f[0] || (f[0] = [
            e("div", { class: "i-la-check" }, null, -1),
            e("div", { class: "p-0" }, "Downloaded", -1)
          ]))) : c("", !0),
          e("a", {
            class: "flex-1a p-1 bg-green-400 rounded-lg shadow-lg",
            href: n(i),
            download: (u = t.file) == null ? void 0 : u.name
          }, "Save ", 8, E)
        ])
      ]);
    };
  }
};
export {
  S as default
};
//# sourceMappingURL=FileCard-Dz_41n3G.js.map
