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: () => C }), i.exports = h(_);
	var v = m(t("react")), y = r(), b = n();
	let x = "https://connect.facebook.net/en_US/sdk.js", S = "fbAsyncInit";
	var C = class extends v.Component {
		constructor() {
			super(...arguments), g(this, "callPlayer", y.callPlayer), g(this, "playerID", this.props.config.playerId || `facebook-player-${(0, y.randomString)()}`), g(this, "mute", () => {
				this.callPlayer("mute");
			}), g(this, "unmute", () => {
				this.callPlayer("unmute");
			});
		}
		componentDidMount() {
			this.props.onMount && this.props.onMount(this);
		}
		load(e, t) {
			if (t) {
				(0, y.getSDK)(x, "FB", S).then((e) => e.XFBML.parse());
				return;
			}
			(0, y.getSDK)(x, "FB", S).then((e) => {
				e.init({
					appId: this.props.config.appId,
					xfbml: !0,
					version: this.props.config.version
				}), e.Event.subscribe("xfbml.render", (e) => {
					this.props.onLoaded();
				}), e.Event.subscribe("xfbml.ready", (e) => {
					e.type === "video" && e.id === this.playerID && (this.player = e.instance, this.player.subscribe("startedPlaying", this.props.onPlay), this.player.subscribe("paused", this.props.onPause), this.player.subscribe("finishedPlaying", this.props.onEnded), this.player.subscribe("startedBuffering", this.props.onBuffer), this.player.subscribe("finishedBuffering", this.props.onBufferEnd), this.player.subscribe("error", this.props.onError), this.props.muted ? this.callPlayer("mute") : this.callPlayer("unmute"), this.props.onReady(), document.getElementById(this.playerID).querySelector("iframe").style.visibility = "visible");
				});
			});
		}
		play() {
			this.callPlayer("play");
		}
		pause() {
			this.callPlayer("pause");
		}
		stop() {}
		seekTo(e, t = !0) {
			this.callPlayer("seek", e), t || this.pause();
		}
		setVolume(e) {
			this.callPlayer("setVolume", e);
		}
		getDuration() {
			return this.callPlayer("getDuration");
		}
		getCurrentTime() {
			return this.callPlayer("getCurrentPosition");
		}
		getSecondsLoaded() {
			return null;
		}
		render() {
			let { attributes: e } = this.props.config, t = {
				width: "100%",
				height: "100%"
			};
			return /* @__PURE__ */ v.default.createElement("div", {
				style: t,
				id: this.playerID,
				className: "fb-video",
				"data-href": this.props.url,
				"data-autoplay": this.props.playing ? "true" : "false",
				"data-allowfullscreen": "true",
				"data-controls": this.props.controls ? "true" : "false",
				...e
			});
		}
	};
	g(C, "displayName", "Facebook"), g(C, "canPlay", b.canPlay.facebook), g(C, "loopOnEnded", !0);
}));
export default i();

//# sourceMappingURL=Facebook.UTifWtkl.js.map