import { H as S } from "./use-page-data.BYLN5MSa.js";
import E from "react";
import { r as L, a as T } from "./video.Ctm1aA2_.js";
function q(u, a) {
  for (var p = 0; p < a.length; p++) {
    const i = a[p];
    if (typeof i != "string" && !Array.isArray(i)) {
      for (const n in i)
        if (n !== "default" && !(n in u)) {
          const c = Object.getOwnPropertyDescriptor(i, n);
          c && Object.defineProperty(u, n, c.get ? c : {
            enumerable: !0,
            get: () => i[n]
          });
        }
    }
  }
  return Object.freeze(Object.defineProperty(u, Symbol.toStringTag, { value: "Module" }));
}
var f, v;
function C() {
  if (v) return f;
  v = 1;
  var u = Object.create, a = Object.defineProperty, p = Object.getOwnPropertyDescriptor, i = Object.getOwnPropertyNames, n = Object.getPrototypeOf, c = Object.prototype.hasOwnProperty, O = (t, e, r) => e in t ? a(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, M = (t, e) => {
    for (var r in e)
      a(t, r, { get: e[r], enumerable: !0 });
  }, _ = (t, e, r, l) => {
    if (e && typeof e == "object" || typeof e == "function")
      for (let s of i(e))
        !c.call(t, s) && s !== r && a(t, s, { get: () => e[s], enumerable: !(l = p(e, s)) || l.enumerable });
    return t;
  }, b = (t, e, r) => (r = t != null ? u(n(t)) : {}, _(
    // If the importer is in node compatibility mode or this is not an ESM
    // file that has been converted to a CommonJS file using a Babel-
    // compatible transform (i.e. "__esModule" has not been set), then set
    // "default" to the CommonJS "module.exports" for node compatibility.
    !t || !t.__esModule ? a(r, "default", { value: t, enumerable: !0 }) : r,
    t
  )), x = (t) => _(a({}, "__esModule", { value: !0 }), t), o = (t, e, r) => (O(t, typeof e != "symbol" ? e + "" : e, r), r), y = {};
  M(y, {
    default: () => d
  }), f = x(y);
  var m = b(E), h = /* @__PURE__ */ L(), g = /* @__PURE__ */ T();
  const w = "https://widget.mixcloud.com/media/js/widgetApi.js", j = "Mixcloud";
  class d extends m.Component {
    constructor() {
      super(...arguments), o(this, "callPlayer", h.callPlayer), o(this, "duration", null), o(this, "currentTime", null), o(this, "secondsLoaded", null), o(this, "mute", () => {
      }), o(this, "unmute", () => {
      }), o(this, "ref", (e) => {
        this.iframe = e;
      });
    }
    componentDidMount() {
      this.props.onMount && this.props.onMount(this);
    }
    load(e) {
      (0, h.getSDK)(w, j).then((r) => {
        this.player = r.PlayerWidget(this.iframe), this.player.ready.then(() => {
          this.player.events.play.on(this.props.onPlay), this.player.events.pause.on(this.props.onPause), this.player.events.ended.on(this.props.onEnded), this.player.events.error.on(this.props.error), this.player.events.progress.on((l, s) => {
            this.currentTime = l, this.duration = s;
          }), this.props.onReady();
        });
      }, this.props.onError);
    }
    play() {
      this.callPlayer("play");
    }
    pause() {
      this.callPlayer("pause");
    }
    stop() {
    }
    seekTo(e, r = !0) {
      this.callPlayer("seek", e), r || this.pause();
    }
    setVolume(e) {
    }
    getDuration() {
      return this.duration;
    }
    getCurrentTime() {
      return this.currentTime;
    }
    getSecondsLoaded() {
      return null;
    }
    render() {
      const { url: e, config: r } = this.props, l = e.match(g.MATCH_URL_MIXCLOUD)[1], s = {
        width: "100%",
        height: "100%"
      }, D = (0, h.queryString)({
        ...r.options,
        feed: `/${l}/`
      });
      return /* @__PURE__ */ m.default.createElement(
        "iframe",
        {
          key: l,
          ref: this.ref,
          style: s,
          src: `https://www.mixcloud.com/widget/iframe/?${D}`,
          frameBorder: "0",
          allow: "autoplay"
        }
      );
    }
  }
  return o(d, "displayName", "Mixcloud"), o(d, "canPlay", g.canPlay.mixcloud), o(d, "loopOnEnded", !0), f;
}
var P = /* @__PURE__ */ C();
const N = /* @__PURE__ */ S(P), K = /* @__PURE__ */ q({
  __proto__: null,
  default: N
}, [P]);
export {
  K as M
};
