import { resolveComponent as w, createElementBlock as l, openBlock as t, createVNode as o, defineComponent as p, toRefs as k, unref as z, normalizeClass as C, createElementVNode as _, createBlock as y, createCommentVNode as u } from "vue";
import { u as E, T as x } from "./useVidstackSrc-CNo2sIR4.js";
import { _ as i, E as f } from "./install-BuMO14Rb.js";
import { _ as b } from "./wt-slider.vue_vue_type_script_setup_true_lang-DlaRDHxo.js";
const S = {}, V = { class: "mute-button" };
function M(n, d) {
  const e = w("wt-icon");
  return t(), l("media-mute-button", V, [
    o(e, {
      type: "mute",
      icon: "plyr-muted",
      class: "mute-icon",
      size: "sm"
    }),
    o(e, {
      type: "volume",
      icon: "plyr-volume",
      class: "volume-icon",
      size: "sm"
    })
  ]);
}
const T = /* @__PURE__ */ i(S, [["render", M], ["__scopeId", "data-v-45e5719d"]]), g = { class: "play-button" }, I = /* @__PURE__ */ p({
  __name: "play-button",
  setup(n) {
    return (d, e) => (t(), l("media-play-button", g, [
      o(f, {
        icon: "plyr-play",
        type: "play",
        class: "play-icon",
        size: "sm"
      }),
      o(f, {
        icon: "plyr-pause",
        type: "pause",
        class: "pause-icon",
        size: "sm"
      })
    ]));
  }
}), N = /* @__PURE__ */ i(I, [["__scopeId", "data-v-e79e3bf5"]]), O = { class: "time-slider media-slider" }, P = /* @__PURE__ */ p({
  __name: "time-slider",
  setup(n) {
    return (d, e) => (t(), l("media-time-slider", O, [
      o(b, { class: "time-slider__slider" })
    ]));
  }
}), R = /* @__PURE__ */ i(P, [["__scopeId", "data-v-e57a9871"]]), j = { class: "volume-slider media-slider" }, F = /* @__PURE__ */ p({
  __name: "volume-slider",
  setup(n) {
    return (d, e) => (t(), l("media-volume-slider", j, [
      o(b, { class: "volume-slider__slider" })
    ]));
  }
}), G = /* @__PURE__ */ i(F, [["__scopeId", "data-v-b92a4daf"]]), q = ["src", "loop", "autoplay"], A = { class: "controls-group" }, D = /* @__PURE__ */ p({
  __name: "wt-player",
  props: {
    src: {},
    id: {},
    fileName: {},
    autoplay: { type: Boolean, default: !0 },
    loop: { type: Boolean, default: !1 },
    download: { type: [String, Function, Boolean], default: () => (n) => n.replace("/stream", "/download") },
    resetOnEnd: { type: Boolean, default: !1 },
    countdownTimeMode: { type: Boolean },
    hideVolumeSlider: { type: Boolean, default: !1 },
    hideMuteButton: { type: Boolean, default: !1 },
    closable: { type: Boolean, default: !0 },
    position: { default: "sticky" }
  },
  emits: ["initialized", "close"],
  setup(n, { emit: d }) {
    const e = n, { src: v } = k(e), { normalizedSrcObject: h } = E({
      src: v
    });
    function B() {
      const c = typeof e.src == "string" ? e.src : e.src?.src, s = typeof e.download == "function" ? e.download(c) : e.download, r = e.src?.type.split("/").pop(), m = e.fileName || e.id || "unknown", a = document.createElement("a");
      a.style.display = "none", a.href = s, a.download = `${m}.${r}`, document.body.appendChild(a), a.click(), document.body.removeChild(a);
    }
    function $(c) {
      if (!e.resetOnEnd) return;
      const s = c.target;
      s.currentTime = 0;
    }
    return (c, s) => {
      const r = w("wt-icon-btn");
      return t(), l("media-player", {
        class: C(["wt-player", `wt-player--position-${e.position}`]),
        src: z(h),
        loop: e.loop,
        autoplay: n.autoplay,
        onEnded: $
      }, [
        s[1] || (s[1] = _("media-provider", null, null, -1)),
        _("media-controls-group", A, [
          o(N),
          o(R),
          o(x, {
            countdown: e.countdownTimeMode
          }, null, 8, ["countdown"]),
          e.hideMuteButton ? u("", !0) : (t(), y(T, { key: 0 })),
          e.hideVolumeSlider ? u("", !0) : (t(), y(G, { key: 1 })),
          e.download ? (t(), l("media-button", {
            key: 2,
            class: "download-button",
            onClick: B
          }, [
            o(r, {
              icon: "plyr-download",
              size: "sm"
            })
          ])) : u("", !0),
          e.closable ? (t(), l("media-button", {
            key: 3,
            class: "close-button",
            onClick: s[0] || (s[0] = (m) => c.$emit("close"))
          }, [
            o(r, {
              icon: "close",
              size: "sm"
            })
          ])) : u("", !0)
        ])
      ], 42, q);
    };
  }
}), Q = /* @__PURE__ */ i(D, [["__scopeId", "data-v-e341f56b"]]);
export {
  Q as default
};
