import { g as e } from "./alasql-f59e855e.js";
import t from "react";
import { u as r, p as o } from "./index-c0cd585c.js";
function s(e2, t2) {
  for (var r2 = 0; r2 < t2.length; r2++) {
    const o2 = t2[r2];
    if ("string" != typeof o2 && !Array.isArray(o2)) {
      for (const t3 in o2)
        if ("default" !== t3 && !(t3 in e2)) {
          const r3 = Object.getOwnPropertyDescriptor(o2, t3);
          r3 && Object.defineProperty(e2, t3, r3.get ? r3 : { enumerable: true, get: () => o2[t3] });
        }
    }
  }
  return Object.freeze(Object.defineProperty(e2, Symbol.toStringTag, { value: "Module" }));
}
var n = Object.create, a = Object.defineProperty, i = Object.getOwnPropertyDescriptor, l = Object.getOwnPropertyNames, p = Object.getPrototypeOf, u = Object.prototype.hasOwnProperty, c = (e2, t2, r2, o2) => {
  if (t2 && "object" == typeof t2 || "function" == typeof t2)
    for (let s2 of l(t2))
      u.call(e2, s2) || s2 === r2 || a(e2, s2, { get: () => t2[s2], enumerable: !(o2 = i(t2, s2)) || o2.enumerable });
  return e2;
}, d = (e2, t2, r2) => (((e3, t3, r3) => {
  t3 in e3 ? a(e3, t3, { enumerable: true, configurable: true, writable: true, value: r3 }) : e3[t3] = r3;
})(e2, "symbol" != typeof t2 ? t2 + "" : t2, r2), r2), h = {};
((e2, t2) => {
  for (var r2 in t2)
    a(e2, r2, { get: t2[r2], enumerable: true });
})(h, { default: () => P });
var y, f = (y = h, c(a({}, "__esModule", { value: true }), y)), m = ((e2, t2, r2) => (r2 = null != e2 ? n(p(e2)) : {}, c(!t2 && e2 && e2.__esModule ? r2 : a(r2, "default", { value: e2, enumerable: true }), e2)))(t), g = r, b = o;
class P extends m.Component {
  constructor() {
    super(...arguments), d(this, "callPlayer", g.callPlayer), d(this, "duration", null), d(this, "currentTime", null), d(this, "secondsLoaded", null), d(this, "mute", () => {
    }), d(this, "unmute", () => {
    }), d(this, "ref", (e2) => {
      this.iframe = e2;
    });
  }
  componentDidMount() {
    this.props.onMount && this.props.onMount(this);
  }
  load(e2) {
    (0, g.getSDK)("https://widget.mixcloud.com/media/js/widgetApi.js", "Mixcloud").then((e3) => {
      this.player = e3.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((e4, t2) => {
          this.currentTime = e4, this.duration = t2;
        }), this.props.onReady();
      });
    }, this.props.onError);
  }
  play() {
    this.callPlayer("play");
  }
  pause() {
    this.callPlayer("pause");
  }
  stop() {
  }
  seekTo(e2, t2 = true) {
    this.callPlayer("seek", e2), t2 || this.pause();
  }
  setVolume(e2) {
  }
  getDuration() {
    return this.duration;
  }
  getCurrentTime() {
    return this.currentTime;
  }
  getSecondsLoaded() {
    return null;
  }
  render() {
    const { url: e2, config: t2 } = this.props, r2 = e2.match(b.MATCH_URL_MIXCLOUD)[1], o2 = (0, g.queryString)({ ...t2.options, feed: `/${r2}/` });
    return m.default.createElement("iframe", { key: r2, ref: this.ref, style: { width: "100%", height: "100%" }, src: `https://player-widget.mixcloud.com/widget/iframe/?${o2}`, frameBorder: "0", allow: "autoplay" });
  }
}
d(P, "displayName", "Mixcloud"), d(P, "canPlay", b.canPlay.mixcloud), d(P, "loopOnEnded", true);
const O = s({ __proto__: null, default: e(f) }, [f]);
export {
  O as M
};
