import { g as e } from "./alasql-f59e855e.js";
import t from "react";
import { u as r, p as o } from "./index-037d59a7.js";
function a(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 s = Object.create, l = Object.defineProperty, n = Object.getOwnPropertyDescriptor, i = Object.getOwnPropertyNames, u = Object.getPrototypeOf, p = Object.prototype.hasOwnProperty, c = (e2, t2, r2, o2) => {
  if (t2 && "object" == typeof t2 || "function" == typeof t2)
    for (let a2 of i(t2))
      p.call(e2, a2) || a2 === r2 || l(e2, a2, { get: () => t2[a2], enumerable: !(o2 = n(t2, a2)) || o2.enumerable });
  return e2;
}, d = (e2, t2, r2) => (((e3, t3, r3) => {
  t3 in e3 ? l(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)
    l(e2, r2, { get: t2[r2], enumerable: true });
})(y, { default: () => g });
var h, m = (h = y, c(l({}, "__esModule", { value: true }), h)), f = ((e2, t2, r2) => (r2 = null != e2 ? s(u(e2)) : {}, c(!t2 && e2 && e2.__esModule ? r2 : l(r2, "default", { value: e2, enumerable: true }), e2)))(t), P = r, b = o;
class g extends f.Component {
  constructor() {
    super(...arguments), d(this, "callPlayer", P.callPlayer), d(this, "duration", null), d(this, "currentTime", null), d(this, "secondsLoaded", null), d(this, "mute", () => {
      this.callPlayer("mute");
    }), d(this, "unmute", () => {
      this.callPlayer("unmute");
    }), d(this, "ref", (e2) => {
      this.iframe = e2;
    });
  }
  componentDidMount() {
    this.props.onMount && this.props.onMount(this);
  }
  load(e2) {
    (0, P.getSDK)("https://cdn.embed.ly/player-0.1.0.min.js", "playerjs").then((e3) => {
      this.iframe && (this.player = new e3.Player(this.iframe), this.player.on("ready", () => {
        setTimeout(() => {
          this.player.isReady = true, this.player.setLoop(this.props.loop), this.props.muted && this.player.mute(), this.addListeners(this.player, this.props), this.props.onReady();
        }, 500);
      }));
    }, this.props.onError);
  }
  addListeners(e2, t2) {
    e2.on("play", t2.onPlay), e2.on("pause", t2.onPause), e2.on("ended", t2.onEnded), e2.on("error", t2.onError), e2.on("timeupdate", ({ duration: e3, seconds: t3 }) => {
      this.duration = e3, this.currentTime = t3;
    });
  }
  play() {
    this.callPlayer("play");
  }
  pause() {
    this.callPlayer("pause");
  }
  stop() {
  }
  seekTo(e2, t2 = true) {
    this.callPlayer("setCurrentTime", e2), t2 || this.pause();
  }
  setVolume(e2) {
    this.callPlayer("setVolume", e2);
  }
  setLoop(e2) {
    this.callPlayer("setLoop", e2);
  }
  getDuration() {
    return this.duration;
  }
  getCurrentTime() {
    return this.currentTime;
  }
  getSecondsLoaded() {
    return this.secondsLoaded;
  }
  render() {
    return f.default.createElement("iframe", { ref: this.ref, src: this.props.url, frameBorder: "0", scrolling: "no", style: { width: "100%", height: "100%" }, allow: "encrypted-media; autoplay; fullscreen;", referrerPolicy: "no-referrer-when-downgrade" });
  }
}
d(g, "displayName", "Kaltura"), d(g, "canPlay", b.canPlay.kaltura);
const j = a({ __proto__: null, default: e(m) }, [m]);
export {
  j as K
};
