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 a = Object.create, l = Object.defineProperty, n = Object.getOwnPropertyDescriptor, i = Object.getOwnPropertyNames, p = Object.getPrototypeOf, u = Object.prototype.hasOwnProperty, h = (e2, t2, r2, o2) => {
  if (t2 && "object" == typeof t2 || "function" == typeof t2)
    for (let s2 of i(t2))
      u.call(e2, s2) || s2 === r2 || l(e2, s2, { get: () => t2[s2], enumerable: !(o2 = n(t2, s2)) || o2.enumerable });
  return e2;
}, c = (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 d, m = (d = y, h(l({}, "__esModule", { value: true }), d)), f = ((e2, t2, r2) => (r2 = null != e2 ? a(p(e2)) : {}, h(!t2 && e2 && e2.__esModule ? r2 : l(r2, "default", { value: e2, enumerable: true }), e2)))(t), b = r, P = o;
class g extends f.Component {
  constructor() {
    super(...arguments), c(this, "callPlayer", b.callPlayer), c(this, "duration", null), c(this, "currentTime", null), c(this, "secondsLoaded", null), c(this, "mute", () => {
      this.callPlayer("mute");
    }), c(this, "unmute", () => {
      this.callPlayer("unmute");
    }), c(this, "ref", (e2) => {
      this.iframe = e2;
    });
  }
  componentDidMount() {
    this.props.onMount && this.props.onMount(this);
  }
  load(e2) {
    (0, b.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.setLoop(this.props.loop), this.player.on("ready", this.props.onReady), this.player.on("play", this.props.onPlay), this.player.on("pause", this.props.onPause), this.player.on("seeked", this.props.onSeek), this.player.on("ended", this.props.onEnded), this.player.on("error", this.props.onError), this.player.on("timeupdate", ({ duration: e4, seconds: t2 }) => {
        this.duration = e4, this.currentTime = t2;
      }), this.player.on("buffered", ({ percent: e4 }) => {
        this.duration && (this.secondsLoaded = this.duration * e4);
      }), this.props.muted && this.player.mute());
    }, this.props.onError);
  }
  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", 100 * e2);
  }
  setLoop(e2) {
    this.callPlayer("setLoop", e2);
  }
  getDuration() {
    return this.duration;
  }
  getCurrentTime() {
    return this.currentTime;
  }
  getSecondsLoaded() {
    return this.secondsLoaded;
  }
  render() {
    const e2 = this.props.url.match(P.MATCH_URL_STREAMABLE)[1];
    return f.default.createElement("iframe", { ref: this.ref, src: `https://streamable.com/o/${e2}`, frameBorder: "0", scrolling: "no", style: { width: "100%", height: "100%" }, allow: "encrypted-media; autoplay; fullscreen;" });
  }
}
c(g, "displayName", "Streamable"), c(g, "canPlay", P.canPlay.streamable);
const j = s({ __proto__: null, default: e(m) }, [m]);
export {
  j as S
};
