import { g as e } from "./alasql-f59e855e.js";
import t from "react";
import { u as r, p as a } from "./index-c0cd585c.js";
function o(e2, t2) {
  for (var r2 = 0; r2 < t2.length; r2++) {
    const a2 = t2[r2];
    if ("string" != typeof a2 && !Array.isArray(a2)) {
      for (const t3 in a2)
        if ("default" !== t3 && !(t3 in e2)) {
          const r3 = Object.getOwnPropertyDescriptor(a2, t3);
          r3 && Object.defineProperty(e2, t3, r3.get ? r3 : { enumerable: true, get: () => a2[t3] });
        }
    }
  }
  return Object.freeze(Object.defineProperty(e2, Symbol.toStringTag, { value: "Module" }));
}
var n = Object.create, s = Object.defineProperty, i = Object.getOwnPropertyDescriptor, l = Object.getOwnPropertyNames, p = Object.getPrototypeOf, u = Object.prototype.hasOwnProperty, c = (e2, t2, r2, a2) => {
  if (t2 && "object" == typeof t2 || "function" == typeof t2)
    for (let o2 of l(t2))
      u.call(e2, o2) || o2 === r2 || s(e2, o2, { get: () => t2[o2], enumerable: !(a2 = i(t2, o2)) || a2.enumerable });
  return e2;
}, h = (e2, t2, r2) => (((e3, t3, r3) => {
  t3 in e3 ? s(e3, t3, { enumerable: true, configurable: true, writable: true, value: r3 }) : e3[t3] = r3;
})(e2, "symbol" != typeof t2 ? t2 + "" : t2, r2), r2), y = {};
((e2, t2) => {
  for (var r2 in t2)
    s(e2, r2, { get: t2[r2], enumerable: true });
})(y, { default: () => P });
var d, f = (d = y, c(s({}, "__esModule", { value: true }), d)), m = ((e2, t2, r2) => (r2 = null != e2 ? n(p(e2)) : {}, c(!t2 && e2 && e2.__esModule ? r2 : s(r2, "default", { value: e2, enumerable: true }), e2)))(t), g = r, b = a;
class P extends m.Component {
  constructor() {
    super(...arguments), h(this, "callPlayer", g.callPlayer), h(this, "onDurationChange", () => {
      const e2 = this.getDuration();
      this.props.onDuration(e2);
    }), h(this, "mute", () => {
      this.callPlayer("setMuted", true);
    }), h(this, "unmute", () => {
      this.callPlayer("setMuted", false);
    }), h(this, "ref", (e2) => {
      this.container = e2;
    });
  }
  componentDidMount() {
    this.props.onMount && this.props.onMount(this);
  }
  load(e2) {
    const { controls: t2, config: r2, onError: a2, playing: o2 } = this.props, [, n2] = e2.match(b.MATCH_URL_DAILYMOTION);
    this.player ? this.player.load(n2, { start: (0, g.parseStartTime)(e2), autoplay: o2 }) : (0, g.getSDK)("https://api.dmcdn.net/all.js", "DM", "dmAsyncInit", (e3) => e3.player).then((o3) => {
      if (!this.container)
        return;
      const s2 = o3.player;
      this.player = new s2(this.container, { width: "100%", height: "100%", video: n2, params: { controls: t2, autoplay: this.props.playing, mute: this.props.muted, start: (0, g.parseStartTime)(e2), origin: window.location.origin, ...r2.params }, events: { apiready: this.props.onReady, seeked: () => this.props.onSeek(this.player.currentTime), video_end: this.props.onEnded, durationchange: this.onDurationChange, pause: this.props.onPause, playing: this.props.onPlay, waiting: this.props.onBuffer, error: (e3) => a2(e3) } });
    }, a2);
  }
  play() {
    this.callPlayer("play");
  }
  pause() {
    this.callPlayer("pause");
  }
  stop() {
  }
  seekTo(e2, t2 = true) {
    this.callPlayer("seek", e2), t2 || this.pause();
  }
  setVolume(e2) {
    this.callPlayer("setVolume", e2);
  }
  getDuration() {
    return this.player.duration || null;
  }
  getCurrentTime() {
    return this.player.currentTime;
  }
  getSecondsLoaded() {
    return this.player.bufferedTime;
  }
  render() {
    const { display: e2 } = this.props, t2 = { width: "100%", height: "100%", display: e2 };
    return m.default.createElement("div", { style: t2 }, m.default.createElement("div", { ref: this.ref }));
  }
}
h(P, "displayName", "DailyMotion"), h(P, "canPlay", b.canPlay.dailymotion), h(P, "loopOnEnded", true);
const O = o({ __proto__: null, default: e(f) }, [f]);
export {
  O as D
};
