import { defineComponent as k, ref as _, watchEffect as g, createBlock as h, createCommentVNode as D, openBlock as y, unref as e, withCtx as i, createVNode as a, withDirectives as C, createElementVNode as I, toDisplayString as L } from "vue";
import { n as r, f as U, h as w, b as f, L as B, I as c, i as F, F as S, u as $, H as E, j as H, k as N, O as m, l as z, o as A, _ as O } from "./index-CVEvAPNs.js";
import { u as j } from "./index-BFe8XjpO.js";
const T = /* @__PURE__ */ k({
  __name: "files",
  props: {
    content: {},
    disabled: { type: Boolean }
  },
  setup(p) {
    const u = p;
    j(u.content, "files", []);
    const n = _((u.content.files || [{ filename: "", uri: "" }]).map((l) => ({ key: r(), file: l })));
    g(() => {
      u.content.files = n.value.map(({ file: l }) => l);
    });
    function b(l) {
      n.value.splice(l, 1);
    }
    function v(l = n.value.length) {
      n.value.splice(l, 0, { key: r(), file: { filename: "", uri: "" } });
    }
    return (l, o) => l.content.files ? (y(), h(e(U), {
      key: 0,
      modelValue: n.value,
      "onUpdate:modelValue": o[1] || (o[1] = (d) => n.value = d),
      disabled: l.disabled
    }, {
      default: i(({ index: d, item: t, isLast: V }) => [
        a(e(f), null, {
          media: i(() => [
            a(e(A), { disabled: l.disabled }, null, 8, ["disabled"])
          ]),
          default: i(() => [
            a(e(B), { background: "var(--lab-input-field)" }, {
              header: i(() => [
                a(e(E), null, {
                  default: i(() => [
                    I("span", null, "Datei #" + L(d + 1), 1),
                    a(e(H)),
                    a(e(N), {
                      destructive: "",
                      flat: "",
                      disabled: l.disabled,
                      icon: e(m),
                      tooltip: "Datei entfernen",
                      arrow: ""
                    }, {
                      default: i(() => [
                        a(e(z), {
                          "trailing-icon": e(m),
                          label: "Entfernen bestätigen",
                          onClick: (s) => b(d)
                        }, null, 8, ["trailing-icon", "onClick"])
                      ]),
                      _: 2
                    }, 1032, ["disabled", "icon"])
                  ]),
                  _: 2
                }, 1024)
              ]),
              default: i(() => [
                a(e(f), null, {
                  default: i(() => [
                    C(a(e(c), {
                      icon: e(F),
                      disabled: l.disabled,
                      placeholder: "Dateiname",
                      modelValue: t.file.filename,
                      "onUpdate:modelValue": (s) => t.file.filename = s
                    }, null, 8, ["icon", "disabled", "modelValue", "onUpdate:modelValue"]), [
                      [e(S), V && t.file.filename.length === 0]
                    ])
                  ]),
                  _: 2
                }, 1024),
                a(e(f), null, {
                  default: i(() => [
                    a(e(c), {
                      icon: e($),
                      disabled: l.disabled,
                      placeholder: "Link zur Datei",
                      modelValue: t.file.uri,
                      "onUpdate:modelValue": (s) => t.file.uri = s
                    }, null, 8, ["icon", "disabled", "modelValue", "onUpdate:modelValue"])
                  ]),
                  _: 2
                }, 1024)
              ]),
              _: 2
            }, 1024)
          ]),
          _: 2
        }, 1024)
      ]),
      end: i(() => [
        a(e(w), {
          primary: "",
          disabled: l.disabled,
          label: "Datei hinzufügen",
          onClick: o[0] || (o[0] = (d) => v())
        }, null, 8, ["disabled"])
      ]),
      _: 1
    }, 8, ["modelValue", "disabled"])) : D("", !0);
  }
}), K = /* @__PURE__ */ O(T, [["__scopeId", "data-v-0da1d2e2"]]);
export {
  K as default
};
