import { b as e, e as t } from "./chunk.BlbRoQQ3.js";
import { b as n, c as r } from "./patterns.CVV2epWU.js";
import "./cjs.S1Glohke.js";
var i = /* @__PURE__ */ e(((exports, i) => {
	var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescriptor, c = Object.getOwnPropertyNames, l = Object.getPrototypeOf, u = Object.prototype.hasOwnProperty, d = (e, t, n) => t in e ? o(e, t, {
		enumerable: !0,
		configurable: !0,
		writable: !0,
		value: n
	}) : e[t] = n, f = (e, t) => {
		for (var n in t) o(e, n, {
			get: t[n],
			enumerable: !0
		});
	}, p = (e, t, n, r) => {
		if (t && typeof t == "object" || typeof t == "function") for (let i of c(t)) !u.call(e, i) && i !== n && o(e, i, {
			get: () => t[i],
			enumerable: !(r = s(t, i)) || r.enumerable
		});
		return e;
	}, m = (e, t, n) => (n = e == null ? {} : a(l(e)), p(t || !e || !e.__esModule ? o(n, "default", {
		value: e,
		enumerable: !0
	}) : n, e)), h = (e) => p(o({}, "__esModule", { value: !0 }), e), g = (e, t, n) => (d(e, typeof t == "symbol" ? t : t + "", n), n), _ = {};
	f(_, { default: () => x }), i.exports = h(_);
	var v = m(t("react")), y = r(), b = n(), x = class extends v.Component {
		constructor() {
			super(...arguments), g(this, "callPlayer", y.callPlayer), g(this, "duration", null), g(this, "currentTime", null), g(this, "secondsLoaded", null), g(this, "mute", () => {
				this.callPlayer("mute");
			}), g(this, "unmute", () => {
				this.callPlayer("unmute");
			}), g(this, "ref", (e) => {
				this.iframe = e;
			});
		}
		componentDidMount() {
			this.props.onMount && this.props.onMount(this);
		}
		load(e) {
			(0, y.getSDK)("https://cdn.embed.ly/player-0.1.0.min.js", "playerjs").then((e) => {
				this.iframe && (this.player = new e.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: e, seconds: t }) => {
					this.duration = e, this.currentTime = t;
				}), this.player.on("buffered", ({ percent: e }) => {
					this.duration && (this.secondsLoaded = this.duration * e);
				}), this.props.muted && this.player.mute());
			}, this.props.onError);
		}
		play() {
			this.callPlayer("play");
		}
		pause() {
			this.callPlayer("pause");
		}
		stop() {}
		seekTo(e, t = !0) {
			this.callPlayer("setCurrentTime", e), t || this.pause();
		}
		setVolume(e) {
			this.callPlayer("setVolume", e * 100);
		}
		setLoop(e) {
			this.callPlayer("setLoop", e);
		}
		getDuration() {
			return this.duration;
		}
		getCurrentTime() {
			return this.currentTime;
		}
		getSecondsLoaded() {
			return this.secondsLoaded;
		}
		render() {
			let e = this.props.url.match(b.MATCH_URL_STREAMABLE)[1], t = {
				width: "100%",
				height: "100%"
			};
			return /* @__PURE__ */ v.default.createElement("iframe", {
				ref: this.ref,
				src: `https://streamable.com/o/${e}`,
				frameBorder: "0",
				scrolling: "no",
				style: t,
				allow: "encrypted-media; autoplay; fullscreen;"
			});
		}
	};
	g(x, "displayName", "Streamable"), g(x, "canPlay", b.canPlay.streamable);
}));
export default i();

//# sourceMappingURL=Streamable.DJ2ofh-c.js.map