UNPKG

@byomakase/omakase-player

Version:

## Omakase Player - Open source JavaScript framework for building frame accurate video experiences

1,875 lines • 1.4 MB
import cs, { Events as Ai } from "hls.js"; var Fd = function(A, e) { return Fd = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, i) { t.__proto__ = i; } || function(t, i) { for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (t[r] = i[r]); }, Fd(A, e); }; function NA(A, e) { if (typeof e != "function" && e !== null) throw new TypeError("Class extends value " + String(e) + " is not a constructor or null"); Fd(A, e); function t() { this.constructor = A; } A.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t()); } function rC(A, e, t, i) { function r(s) { return s instanceof t ? s : new t(function(n) { n(s); }); } return new (t || (t = Promise))(function(s, n) { function a(d) { try { l(i.next(d)); } catch (h) { n(h); } } function o(d) { try { l(i.throw(d)); } catch (h) { n(h); } } function l(d) { d.done ? s(d.value) : r(d.value).then(a, o); } l((i = i.apply(A, e || [])).next()); }); } function Yg(A, e) { var t = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, i, r, s, n; return n = { next: a(0), throw: a(1), return: a(2) }, typeof Symbol == "function" && (n[Symbol.iterator] = function() { return this; }), n; function a(l) { return function(d) { return o([l, d]); }; } function o(l) { if (i) throw new TypeError("Generator is already executing."); for (; n && (n = 0, l[0] && (t = 0)), t; ) try { if (i = 1, r && (s = l[0] & 2 ? r.return : l[0] ? r.throw || ((s = r.return) && s.call(r), 0) : r.next) && !(s = s.call(r, l[1])).done) return s; switch (r = 0, s && (l = [l[0] & 2, s.value]), l[0]) { case 0: case 1: s = l; break; case 4: return t.label++, { value: l[1], done: !1 }; case 5: t.label++, r = l[1], l = [0]; continue; case 7: l = t.ops.pop(), t.trys.pop(); continue; default: if (s = t.trys, !(s = s.length > 0 && s[s.length - 1]) && (l[0] === 6 || l[0] === 2)) { t = 0; continue; } if (l[0] === 3 && (!s || l[1] > s[0] && l[1] < s[3])) { t.label = l[1]; break; } if (l[0] === 6 && t.label < s[1]) { t.label = s[1], s = l; break; } if (s && t.label < s[2]) { t.label = s[2], t.ops.push(l); break; } s[2] && t.ops.pop(), t.trys.pop(); continue; } l = e.call(A, t); } catch (d) { l = [6, d], r = 0; } finally { i = s = 0; } if (l[0] & 5) throw l[1]; return { value: l[0] ? l[1] : void 0, done: !0 }; } } function Hs(A) { var e = typeof Symbol == "function" && Symbol.iterator, t = e && A[e], i = 0; if (t) return t.call(A); if (A && typeof A.length == "number") return { next: function() { return A && i >= A.length && (A = void 0), { value: A && A[i++], done: !A }; } }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); } function Gr(A, e) { var t = typeof Symbol == "function" && A[Symbol.iterator]; if (!t) return A; var i = t.call(A), r, s = [], n; try { for (; (e === void 0 || e-- > 0) && !(r = i.next()).done; ) s.push(r.value); } catch (a) { n = { error: a }; } finally { try { r && !r.done && (t = i.return) && t.call(i); } finally { if (n) throw n.error; } } return s; } function $s(A, e, t) { if (t || arguments.length === 2) for (var i = 0, r = e.length, s; i < r; i++) (s || !(i in e)) && (s || (s = Array.prototype.slice.call(e, 0, i)), s[i] = e[i]); return A.concat(s || Array.prototype.slice.call(e)); } function Ps(A) { return this instanceof Ps ? (this.v = A, this) : new Ps(A); } function sC(A, e, t) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var i = t.apply(A, e || []), r, s = []; return r = {}, n("next"), n("throw"), n("return"), r[Symbol.asyncIterator] = function() { return this; }, r; function n(c) { i[c] && (r[c] = function(m) { return new Promise(function(g, u) { s.push([c, m, g, u]) > 1 || a(c, m); }); }); } function a(c, m) { try { o(i[c](m)); } catch (g) { h(s[0][3], g); } } function o(c) { c.value instanceof Ps ? Promise.resolve(c.value.v).then(l, d) : h(s[0][2], c); } function l(c) { a("next", c); } function d(c) { a("throw", c); } function h(c, m) { c(m), s.shift(), s.length && a(s[0][0], s[0][1]); } } function nC(A) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var e = A[Symbol.asyncIterator], t; return e ? e.call(A) : (A = typeof Hs == "function" ? Hs(A) : A[Symbol.iterator](), t = {}, i("next"), i("throw"), i("return"), t[Symbol.asyncIterator] = function() { return this; }, t); function i(s) { t[s] = A[s] && function(n) { return new Promise(function(a, o) { n = A[s](n), r(a, o, n.done, n.value); }); }; } function r(s, n, a, o) { Promise.resolve(o).then(function(l) { s({ value: l, done: a }); }, n); } } function Ke(A) { return typeof A == "function"; } function Ll(A) { var e = function(i) { Error.call(i), i.stack = new Error().stack; }, t = A(e); return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t; } var md = Ll(function(A) { return function(t) { A(this), this.message = t ? t.length + ` errors occurred during unsubscription: ` + t.map(function(i, r) { return r + 1 + ") " + i.toString(); }).join(` `) : "", this.name = "UnsubscriptionError", this.errors = t; }; }); function rl(A, e) { if (A) { var t = A.indexOf(e); 0 <= t && A.splice(t, 1); } } var _a = function() { function A(e) { this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null; } return A.prototype.unsubscribe = function() { var e, t, i, r, s; if (!this.closed) { this.closed = !0; var n = this._parentage; if (n) if (this._parentage = null, Array.isArray(n)) try { for (var a = Hs(n), o = a.next(); !o.done; o = a.next()) { var l = o.value; l.remove(this); } } catch (u) { e = { error: u }; } finally { try { o && !o.done && (t = a.return) && t.call(a); } finally { if (e) throw e.error; } } else n.remove(this); var d = this.initialTeardown; if (Ke(d)) try { d(); } catch (u) { s = u instanceof md ? u.errors : [u]; } var h = this._finalizers; if (h) { this._finalizers = null; try { for (var c = Hs(h), m = c.next(); !m.done; m = c.next()) { var g = m.value; try { Kc(g); } catch (u) { s = s ?? [], u instanceof md ? s = $s($s([], Gr(s)), Gr(u.errors)) : s.push(u); } } } catch (u) { i = { error: u }; } finally { try { m && !m.done && (r = c.return) && r.call(c); } finally { if (i) throw i.error; } } } if (s) throw new md(s); } }, A.prototype.add = function(e) { var t; if (e && e !== this) if (this.closed) Kc(e); else { if (e instanceof A) { if (e.closed || e._hasParent(this)) return; e._addParent(this); } (this._finalizers = (t = this._finalizers) !== null && t !== void 0 ? t : []).push(e); } }, A.prototype._hasParent = function(e) { var t = this._parentage; return t === e || Array.isArray(t) && t.includes(e); }, A.prototype._addParent = function(e) { var t = this._parentage; this._parentage = Array.isArray(t) ? (t.push(e), t) : t ? [t, e] : e; }, A.prototype._removeParent = function(e) { var t = this._parentage; t === e ? this._parentage = null : Array.isArray(t) && rl(t, e); }, A.prototype.remove = function(e) { var t = this._finalizers; t && rl(t, e), e instanceof A && e._removeParent(this); }, A.EMPTY = function() { var e = new A(); return e.closed = !0, e; }(), A; }(), Wg = _a.EMPTY; function zg(A) { return A instanceof _a || A && "closed" in A && Ke(A.remove) && Ke(A.add) && Ke(A.unsubscribe); } function Kc(A) { Ke(A) ? A() : A.unsubscribe(); } var Kg = { onUnhandledError: null, onStoppedNotification: null, Promise: void 0, useDeprecatedSynchronousErrorHandling: !1, useDeprecatedNextContext: !1 }, Jg = { setTimeout: function(A, e) { for (var t = [], i = 2; i < arguments.length; i++) t[i - 2] = arguments[i]; return setTimeout.apply(void 0, $s([A, e], Gr(t))); }, clearTimeout: function(A) { var e = Jg.delegate; return ((e == null ? void 0 : e.clearTimeout) || clearTimeout)(A); }, delegate: void 0 }; function qg(A) { Jg.setTimeout(function() { throw A; }); } function sl() { } function fo(A) { A(); } var Gh = function(A) { NA(e, A); function e(t) { var i = A.call(this) || this; return i.isStopped = !1, t ? (i.destination = t, zg(t) && t.add(i)) : i.destination = dC, i; } return e.create = function(t, i, r) { return new nl(t, i, r); }, e.prototype.next = function(t) { this.isStopped || this._next(t); }, e.prototype.error = function(t) { this.isStopped || (this.isStopped = !0, this._error(t)); }, e.prototype.complete = function() { this.isStopped || (this.isStopped = !0, this._complete()); }, e.prototype.unsubscribe = function() { this.closed || (this.isStopped = !0, A.prototype.unsubscribe.call(this), this.destination = null); }, e.prototype._next = function(t) { this.destination.next(t); }, e.prototype._error = function(t) { try { this.destination.error(t); } finally { this.unsubscribe(); } }, e.prototype._complete = function() { try { this.destination.complete(); } finally { this.unsubscribe(); } }, e; }(_a), aC = Function.prototype.bind; function fd(A, e) { return aC.call(A, e); } var oC = function() { function A(e) { this.partialObserver = e; } return A.prototype.next = function(e) { var t = this.partialObserver; if (t.next) try { t.next(e); } catch (i) { Oa(i); } }, A.prototype.error = function(e) { var t = this.partialObserver; if (t.error) try { t.error(e); } catch (i) { Oa(i); } else Oa(e); }, A.prototype.complete = function() { var e = this.partialObserver; if (e.complete) try { e.complete(); } catch (t) { Oa(t); } }, A; }(), nl = function(A) { NA(e, A); function e(t, i, r) { var s = A.call(this) || this, n; if (Ke(t) || !t) n = { next: t ?? void 0, error: i ?? void 0, complete: r ?? void 0 }; else { var a; s && Kg.useDeprecatedNextContext ? (a = Object.create(t), a.unsubscribe = function() { return s.unsubscribe(); }, n = { next: t.next && fd(t.next, a), error: t.error && fd(t.error, a), complete: t.complete && fd(t.complete, a) }) : n = t; } return s.destination = new oC(n), s; } return e; }(Gh); function Oa(A) { qg(A); } function lC(A) { throw A; } var dC = { closed: !0, next: sl, error: lC, complete: sl }, Oh = function() { return typeof Symbol == "function" && Symbol.observable || "@@observable"; }(); function Yr(A) { return A; } function hC(A) { return A.length === 0 ? Yr : A.length === 1 ? A[0] : function(t) { return A.reduce(function(i, r) { return r(i); }, t); }; } var de = function() { function A(e) { e && (this._subscribe = e); } return A.prototype.lift = function(e) { var t = new A(); return t.source = this, t.operator = e, t; }, A.prototype.subscribe = function(e, t, i) { var r = this, s = uC(e) ? e : new nl(e, t, i); return fo(function() { var n = r, a = n.operator, o = n.source; s.add(a ? a.call(s, o) : o ? r._subscribe(s) : r._trySubscribe(s)); }), s; }, A.prototype._trySubscribe = function(e) { try { return this._subscribe(e); } catch (t) { e.error(t); } }, A.prototype.forEach = function(e, t) { var i = this; return t = Jc(t), new t(function(r, s) { var n = new nl({ next: function(a) { try { e(a); } catch (o) { s(o), n.unsubscribe(); } }, error: s, complete: r }); i.subscribe(n); }); }, A.prototype._subscribe = function(e) { var t; return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(e); }, A.prototype[Oh] = function() { return this; }, A.prototype.pipe = function() { for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t]; return hC(e)(this); }, A.prototype.toPromise = function(e) { var t = this; return e = Jc(e), new e(function(i, r) { var s; t.subscribe(function(n) { return s = n; }, function(n) { return r(n); }, function() { return i(s); }); }); }, A.create = function(e) { return new A(e); }, A; }(); function Jc(A) { var e; return (e = A ?? Kg.Promise) !== null && e !== void 0 ? e : Promise; } function cC(A) { return A && Ke(A.next) && Ke(A.error) && Ke(A.complete); } function uC(A) { return A && A instanceof Gh || cC(A) && zg(A); } function gC(A) { return Ke(A == null ? void 0 : A.lift); } function Gt(A) { return function(e) { if (gC(e)) return e.lift(function(t) { try { return A(t, this); } catch (i) { this.error(i); } }); throw new TypeError("Unable to lift unknown Observable type"); }; } function ct(A, e, t, i, r) { return new mC(A, e, t, i, r); } var mC = function(A) { NA(e, A); function e(t, i, r, s, n, a) { var o = A.call(this, t) || this; return o.onFinalize = n, o.shouldUnsubscribe = a, o._next = i ? function(l) { try { i(l); } catch (d) { t.error(d); } } : A.prototype._next, o._error = s ? function(l) { try { s(l); } catch (d) { t.error(d); } finally { this.unsubscribe(); } } : A.prototype._error, o._complete = r ? function() { try { r(); } catch (l) { t.error(l); } finally { this.unsubscribe(); } } : A.prototype._complete, o; } return e.prototype.unsubscribe = function() { var t; if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) { var i = this.closed; A.prototype.unsubscribe.call(this), !i && ((t = this.onFinalize) === null || t === void 0 || t.call(this)); } }, e; }(Gh), fC = Ll(function(A) { return function() { A(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed"; }; }), b = function(A) { NA(e, A); function e() { var t = A.call(this) || this; return t.closed = !1, t.currentObservers = null, t.observers = [], t.isStopped = !1, t.hasError = !1, t.thrownError = null, t; } return e.prototype.lift = function(t) { var i = new qc(this, this); return i.operator = t, i; }, e.prototype._throwIfClosed = function() { if (this.closed) throw new fC(); }, e.prototype.next = function(t) { var i = this; fo(function() { var r, s; if (i._throwIfClosed(), !i.isStopped) { i.currentObservers || (i.currentObservers = Array.from(i.observers)); try { for (var n = Hs(i.currentObservers), a = n.next(); !a.done; a = n.next()) { var o = a.value; o.next(t); } } catch (l) { r = { error: l }; } finally { try { a && !a.done && (s = n.return) && s.call(n); } finally { if (r) throw r.error; } } } }); }, e.prototype.error = function(t) { var i = this; fo(function() { if (i._throwIfClosed(), !i.isStopped) { i.hasError = i.isStopped = !0, i.thrownError = t; for (var r = i.observers; r.length; ) r.shift().error(t); } }); }, e.prototype.complete = function() { var t = this; fo(function() { if (t._throwIfClosed(), !t.isStopped) { t.isStopped = !0; for (var i = t.observers; i.length; ) i.shift().complete(); } }); }, e.prototype.unsubscribe = function() { this.isStopped = this.closed = !0, this.observers = this.currentObservers = null; }, Object.defineProperty(e.prototype, "observed", { get: function() { var t; return ((t = this.observers) === null || t === void 0 ? void 0 : t.length) > 0; }, enumerable: !1, configurable: !0 }), e.prototype._trySubscribe = function(t) { return this._throwIfClosed(), A.prototype._trySubscribe.call(this, t); }, e.prototype._subscribe = function(t) { return this._throwIfClosed(), this._checkFinalizedStatuses(t), this._innerSubscribe(t); }, e.prototype._innerSubscribe = function(t) { var i = this, r = this, s = r.hasError, n = r.isStopped, a = r.observers; return s || n ? Wg : (this.currentObservers = null, a.push(t), new _a(function() { i.currentObservers = null, rl(a, t); })); }, e.prototype._checkFinalizedStatuses = function(t) { var i = this, r = i.hasError, s = i.thrownError, n = i.isStopped; r ? t.error(s) : n && t.complete(); }, e.prototype.asObservable = function() { var t = new de(); return t.source = this, t; }, e.create = function(t, i) { return new qc(t, i); }, e; }(de), qc = function(A) { NA(e, A); function e(t, i) { var r = A.call(this) || this; return r.destination = t, r.source = i, r; } return e.prototype.next = function(t) { var i, r; (r = (i = this.destination) === null || i === void 0 ? void 0 : i.next) === null || r === void 0 || r.call(i, t); }, e.prototype.error = function(t) { var i, r; (r = (i = this.destination) === null || i === void 0 ? void 0 : i.error) === null || r === void 0 || r.call(i, t); }, e.prototype.complete = function() { var t, i; (i = (t = this.destination) === null || t === void 0 ? void 0 : t.complete) === null || i === void 0 || i.call(t); }, e.prototype._subscribe = function(t) { var i, r; return (r = (i = this.source) === null || i === void 0 ? void 0 : i.subscribe(t)) !== null && r !== void 0 ? r : Wg; }, e; }(b), at = function(A) { NA(e, A); function e(t) { var i = A.call(this) || this; return i._value = t, i; } return Object.defineProperty(e.prototype, "value", { get: function() { return this.getValue(); }, enumerable: !1, configurable: !0 }), e.prototype._subscribe = function(t) { var i = A.prototype._subscribe.call(this, t); return !i.closed && t.next(this._value), i; }, e.prototype.getValue = function() { var t = this, i = t.hasError, r = t.thrownError, s = t._value; if (i) throw r; return this._throwIfClosed(), s; }, e.prototype.next = function(t) { A.prototype.next.call(this, this._value = t); }, e; }(b), pC = { now: function() { return Date.now(); }, delegate: void 0 }, EC = function(A) { NA(e, A); function e(t, i) { return A.call(this) || this; } return e.prototype.schedule = function(t, i) { return this; }, e; }(_a), Xc = { setInterval: function(A, e) { for (var t = [], i = 2; i < arguments.length; i++) t[i - 2] = arguments[i]; return setInterval.apply(void 0, $s([A, e], Gr(t))); }, clearInterval: function(A) { return clearInterval(A); }, delegate: void 0 }, CC = function(A) { NA(e, A); function e(t, i) { var r = A.call(this, t, i) || this; return r.scheduler = t, r.work = i, r.pending = !1, r; } return e.prototype.schedule = function(t, i) { var r; if (i === void 0 && (i = 0), this.closed) return this; this.state = t; var s = this.id, n = this.scheduler; return s != null && (this.id = this.recycleAsyncId(n, s, i)), this.pending = !0, this.delay = i, this.id = (r = this.id) !== null && r !== void 0 ? r : this.requestAsyncId(n, this.id, i), this; }, e.prototype.requestAsyncId = function(t, i, r) { return r === void 0 && (r = 0), Xc.setInterval(t.flush.bind(t, this), r); }, e.prototype.recycleAsyncId = function(t, i, r) { if (r === void 0 && (r = 0), r != null && this.delay === r && this.pending === !1) return i; i != null && Xc.clearInterval(i); }, e.prototype.execute = function(t, i) { if (this.closed) return new Error("executing a cancelled action"); this.pending = !1; var r = this._execute(t, i); if (r) return r; this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null)); }, e.prototype._execute = function(t, i) { var r = !1, s; try { this.work(t); } catch (n) { r = !0, s = n || new Error("Scheduled action threw falsy error"); } if (r) return this.unsubscribe(), s; }, e.prototype.unsubscribe = function() { if (!this.closed) { var t = this, i = t.id, r = t.scheduler, s = r.actions; this.work = this.state = this.scheduler = null, this.pending = !1, rl(s, this), i != null && (this.id = this.recycleAsyncId(r, i, null)), this.delay = null, A.prototype.unsubscribe.call(this); } }, e; }(EC), Zc = function() { function A(e, t) { t === void 0 && (t = A.now), this.schedulerActionCtor = e, this.now = t; } return A.prototype.schedule = function(e, t, i) { return t === void 0 && (t = 0), new this.schedulerActionCtor(this, e).schedule(i, t); }, A.now = pC.now, A; }(), vC = function(A) { NA(e, A); function e(t, i) { i === void 0 && (i = Zc.now); var r = A.call(this, t, i) || this; return r.actions = [], r._active = !1, r; } return e.prototype.flush = function(t) { var i = this.actions; if (this._active) { i.push(t); return; } var r; this._active = !0; do if (r = t.execute(t.state, t.delay)) break; while (t = i.shift()); if (this._active = !1, r) { for (; t = i.shift(); ) t.unsubscribe(); throw r; } }, e; }(Zc), Zs = new vC(CC), IC = Zs, Hh = new de(function(A) { return A.complete(); }); function Xg(A) { return A && Ke(A.schedule); } function $h(A) { return A[A.length - 1]; } function Uh(A) { return Ke($h(A)) ? A.pop() : void 0; } function Nl(A) { return Xg($h(A)) ? A.pop() : void 0; } function _C(A, e) { return typeof $h(A) == "number" ? A.pop() : e; } var Vh = function(A) { return A && typeof A.length == "number" && typeof A != "function"; }; function Zg(A) { return Ke(A == null ? void 0 : A.then); } function jg(A) { return Ke(A[Oh]); } function em(A) { return Symbol.asyncIterator && Ke(A == null ? void 0 : A[Symbol.asyncIterator]); } function tm(A) { return new TypeError("You provided " + (A !== null && typeof A == "object" ? "an invalid object" : "'" + A + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable."); } function BC() { return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator; } var im = BC(); function Am(A) { return Ke(A == null ? void 0 : A[im]); } function rm(A) { return sC(this, arguments, function() { var t, i, r, s; return Yg(this, function(n) { switch (n.label) { case 0: t = A.getReader(), n.label = 1; case 1: n.trys.push([1, , 9, 10]), n.label = 2; case 2: return [4, Ps(t.read())]; case 3: return i = n.sent(), r = i.value, s = i.done, s ? [4, Ps(void 0)] : [3, 5]; case 4: return [2, n.sent()]; case 5: return [4, Ps(r)]; case 6: return [4, n.sent()]; case 7: return n.sent(), [3, 2]; case 8: return [3, 10]; case 9: return t.releaseLock(), [7]; case 10: return [2]; } }); }); } function sm(A) { return Ke(A == null ? void 0 : A.getReader); } function Ot(A) { if (A instanceof de) return A; if (A != null) { if (jg(A)) return wC(A); if (Vh(A)) return yC(A); if (Zg(A)) return ge(A); if (em(A)) return nm(A); if (Am(A)) return bC(A); if (sm(A)) return QC(A); } throw tm(A); } function wC(A) { return new de(function(e) { var t = A[Oh](); if (Ke(t.subscribe)) return t.subscribe(e); throw new TypeError("Provided object does not correctly implement Symbol.observable"); }); } function yC(A) { return new de(function(e) { for (var t = 0; t < A.length && !e.closed; t++) e.next(A[t]); e.complete(); }); } function ge(A) { return new de(function(e) { A.then(function(t) { e.closed || (e.next(t), e.complete()); }, function(t) { return e.error(t); }).then(null, qg); }); } function bC(A) { return new de(function(e) { var t, i; try { for (var r = Hs(A), s = r.next(); !s.done; s = r.next()) { var n = s.value; if (e.next(n), e.closed) return; } } catch (a) { t = { error: a }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } e.complete(); }); } function nm(A) { return new de(function(e) { DC(A, e).catch(function(t) { return e.error(t); }); }); } function QC(A) { return nm(rm(A)); } function DC(A, e) { var t, i, r, s; return rC(this, void 0, void 0, function() { var n, a; return Yg(this, function(o) { switch (o.label) { case 0: o.trys.push([0, 5, 6, 11]), t = nC(A), o.label = 1; case 1: return [4, t.next()]; case 2: if (i = o.sent(), !!i.done) return [3, 4]; if (n = i.value, e.next(n), e.closed) return [2]; o.label = 3; case 3: return [3, 1]; case 4: return [3, 11]; case 5: return a = o.sent(), r = { error: a }, [3, 11]; case 6: return o.trys.push([6, , 9, 10]), i && !i.done && (s = t.return) ? [4, s.call(t)] : [3, 8]; case 7: o.sent(), o.label = 8; case 8: return [3, 10]; case 9: if (r) throw r.error; return [7]; case 10: return [7]; case 11: return e.complete(), [2]; } }); }); } function xA(A, e, t, i, r) { i === void 0 && (i = 0), r === void 0 && (r = !1); var s = e.schedule(function() { t(), r ? A.add(this.schedule(null, i)) : this.unsubscribe(); }, i); if (A.add(s), !r) return s; } function am(A, e) { return e === void 0 && (e = 0), Gt(function(t, i) { t.subscribe(ct(i, function(r) { return xA(i, A, function() { return i.next(r); }, e); }, function() { return xA(i, A, function() { return i.complete(); }, e); }, function(r) { return xA(i, A, function() { return i.error(r); }, e); })); }); } function om(A, e) { return e === void 0 && (e = 0), Gt(function(t, i) { i.add(A.schedule(function() { return t.subscribe(i); }, e)); }); } function SC(A, e) { return Ot(A).pipe(om(e), am(e)); } function TC(A, e) { return Ot(A).pipe(om(e), am(e)); } function kC(A, e) { return new de(function(t) { var i = 0; return e.schedule(function() { i === A.length ? t.complete() : (t.next(A[i++]), t.closed || this.schedule()); }); }); } function PC(A, e) { return new de(function(t) { var i; return xA(t, e, function() { i = A[im](), xA(t, e, function() { var r, s, n; try { r = i.next(), s = r.value, n = r.done; } catch (a) { t.error(a); return; } n ? t.complete() : t.next(s); }, 0, !0); }), function() { return Ke(i == null ? void 0 : i.return) && i.return(); }; }); } function lm(A, e) { if (!A) throw new Error("Iterable cannot be null"); return new de(function(t) { xA(t, e, function() { var i = A[Symbol.asyncIterator](); xA(t, e, function() { i.next().then(function(r) { r.done ? t.complete() : t.next(r.value); }); }, 0, !0); }); }); } function MC(A, e) { return lm(rm(A), e); } function RC(A, e) { if (A != null) { if (jg(A)) return SC(A, e); if (Vh(A)) return kC(A, e); if (Zg(A)) return TC(A, e); if (em(A)) return lm(A, e); if (Am(A)) return PC(A, e); if (sm(A)) return MC(A, e); } throw tm(A); } function Xt(A, e) { return e ? RC(A, e) : Ot(A); } function Jt() { for (var A = [], e = 0; e < arguments.length; e++) A[e] = arguments[e]; var t = Nl(A); return Xt(A, t); } var Yh = Ll(function(A) { return function() { A(this), this.name = "EmptyError", this.message = "no elements in sequence"; }; }); function me(A, e) { return new Promise(function(t, i) { var r = new nl({ next: function(s) { t(s), r.unsubscribe(); }, error: i, complete: function() { i(new Yh()); } }); A.subscribe(r); }); } function dm(A) { return A instanceof Date && !isNaN(A); } var xC = Ll(function(A) { return function(t) { t === void 0 && (t = null), A(this), this.message = "Timeout has occurred", this.name = "TimeoutError", this.info = t; }; }); function Mr(A, e) { var t = dm(A) ? { first: A } : typeof A == "number" ? { each: A } : A, i = t.first, r = t.each, s = t.with, n = s === void 0 ? LC : s, a = t.scheduler, o = a === void 0 ? Zs : a, l = t.meta, d = l === void 0 ? null : l; if (i == null && r == null) throw new TypeError("No timeout provided."); return Gt(function(h, c) { var m, g, u = null, f = 0, I = function(v) { g = xA(c, o, function() { try { m.unsubscribe(), Ot(n({ meta: d, lastValue: u, seen: f })).subscribe(c); } catch (_) { c.error(_); } }, v); }; m = h.subscribe(ct(c, function(v) { g == null || g.unsubscribe(), f++, c.next(u = v), r > 0 && I(r); }, void 0, void 0, function() { g != null && g.closed || g == null || g.unsubscribe(), u = null; })), !f && I(i != null ? typeof i == "number" ? i : +i - o.now() : r); }); } function LC(A) { throw new xC(A); } function _e(A, e) { return Gt(function(t, i) { var r = 0; t.subscribe(ct(i, function(s) { i.next(A.call(e, s, r++)); })); }); } var NC = Array.isArray; function FC(A, e) { return NC(e) ? A.apply(void 0, $s([], Gr(e))) : A(e); } function Wh(A) { return _e(function(e) { return FC(A, e); }); } var GC = Array.isArray, OC = Object.getPrototypeOf, HC = Object.prototype, $C = Object.keys; function hm(A) { if (A.length === 1) { var e = A[0]; if (GC(e)) return { args: e, keys: null }; if (UC(e)) { var t = $C(e); return { args: t.map(function(i) { return e[i]; }), keys: t }; } } return { args: A, keys: null }; } function UC(A) { return A && typeof A == "object" && OC(A) === HC; } function cm(A, e) { return A.reduce(function(t, i, r) { return t[i] = e[r], t; }, {}); } function Fl() { for (var A = [], e = 0; e < arguments.length; e++) A[e] = arguments[e]; var t = Nl(A), i = Uh(A), r = hm(A), s = r.args, n = r.keys; if (s.length === 0) return Xt([], t); var a = new de(VC(s, t, n ? function(o) { return cm(n, o); } : Yr)); return i ? a.pipe(Wh(i)) : a; } function VC(A, e, t) { return t === void 0 && (t = Yr), function(i) { jc(e, function() { for (var r = A.length, s = new Array(r), n = r, a = r, o = function(d) { jc(e, function() { var h = Xt(A[d], e), c = !1; h.subscribe(ct(i, function(m) { s[d] = m, c || (c = !0, a--), a || i.next(t(s.slice())); }, function() { --n || i.complete(); })); }, i); }, l = 0; l < r; l++) o(l); }, i); }; } function jc(A, e, t) { A ? xA(t, A, e) : e(); } function YC(A, e, t, i, r, s, n, a) { var o = [], l = 0, d = 0, h = !1, c = function() { h && !o.length && !l && e.complete(); }, m = function(u) { return l < i ? g(u) : o.push(u); }, g = function(u) { l++; var f = !1; Ot(t(u, d++)).subscribe(ct(e, function(I) { e.next(I); }, function() { f = !0; }, void 0, function() { if (f) try { l--; for (var I = function() { var v = o.shift(); n || g(v); }; o.length && l < i; ) I(); c(); } catch (v) { e.error(v); } })); }; return A.subscribe(ct(e, m, function() { h = !0, c(); })), function() { }; } function or(A, e, t) { return t === void 0 && (t = 1 / 0), Ke(e) ? or(function(i, r) { return _e(function(s, n) { return e(i, s, r, n); })(Ot(A(i, r))); }, t) : (typeof e == "number" && (t = e), Gt(function(i, r) { return YC(i, r, A, t); })); } function zh(A) { return A === void 0 && (A = 1 / 0), or(Yr, A); } function WC() { return zh(1); } function zC() { for (var A = [], e = 0; e < arguments.length; e++) A[e] = arguments[e]; return WC()(Xt(A, Nl(A))); } function KC(A) { return new de(function(e) { Ot(A()).subscribe(e); }); } function gi() { for (var A = [], e = 0; e < arguments.length; e++) A[e] = arguments[e]; var t = Uh(A), i = hm(A), r = i.args, s = i.keys, n = new de(function(a) { var o = r.length; if (!o) { a.complete(); return; } for (var l = new Array(o), d = o, h = o, c = function(g) { var u = !1; Ot(r[g]).subscribe(ct(a, function(f) { u || (u = !0, h--), l[g] = f; }, function() { return d--; }, void 0, function() { (!d || !u) && (h || a.next(s ? cm(s, l) : l), a.complete()); })); }, m = 0; m < o; m++) c(m); }); return t ? n.pipe(Wh(t)) : n; } var JC = ["addListener", "removeListener"], qC = ["addEventListener", "removeEventListener"], XC = ["on", "off"]; function xe(A, e, t, i) { if (Ke(t) && (i = t, t = void 0), i) return xe(A, e, t).pipe(Wh(i)); var r = Gr(ev(A) ? qC.map(function(a) { return function(o) { return A[a](e, o, t); }; }) : ZC(A) ? JC.map(eu(A, e)) : jC(A) ? XC.map(eu(A, e)) : [], 2), s = r[0], n = r[1]; if (!s && Vh(A)) return or(function(a) { return xe(a, e, t); })(Ot(A)); if (!s) throw new TypeError("Invalid event target"); return new de(function(a) { var o = function() { for (var l = [], d = 0; d < arguments.length; d++) l[d] = arguments[d]; return a.next(1 < l.length ? l : l[0]); }; return s(o), function() { return n(o); }; }); } function eu(A, e) { return function(t) { return function(i) { return A[t](e, i); }; }; } function ZC(A) { return Ke(A.addListener) && Ke(A.removeListener); } function jC(A) { return Ke(A.on) && Ke(A.off); } function ev(A) { return Ke(A.addEventListener) && Ke(A.removeEventListener); } function Kn(A, e, t) { A === void 0 && (A = 0), t === void 0 && (t = IC); var i = -1; return e != null && (Xg(e) ? t = e : i = e), new de(function(r) { var s = dm(A) ? +A - t.now() : A; s < 0 && (s = 0); var n = 0; return t.schedule(function() { r.closed || (r.next(n++), 0 <= i ? this.schedule(void 0, i) : r.complete()); }, s); }); } function Kh(A, e) { return A === void 0 && (A = 0), e === void 0 && (e = Zs), A < 0 && (A = 0), Kn(A, A, e); } function lA() { for (var A = [], e = 0; e < arguments.length; e++) A[e] = arguments[e]; var t = Nl(A), i = _C(A, 1 / 0), r = A; return r.length ? r.length === 1 ? Ot(r[0]) : zh(i)(Xt(r, t)) : Hh; } var tv = Array.isArray; function um(A) { return A.length === 1 && tv(A[0]) ? A[0] : A; } function ce(A, e) { return Gt(function(t, i) { var r = 0; t.subscribe(ct(i, function(s) { return A.call(e, s, r++) && i.next(s); })); }); } function iv() { for (var A = [], e = 0; e < arguments.length; e++) A[e] = arguments[e]; return A = um(A), A.length === 1 ? Ot(A[0]) : new de(Av(A)); } function Av(A) { return function(e) { for (var t = [], i = function(s) { t.push(Ot(A[s]).subscribe(ct(e, function(n) { if (t) { for (var a = 0; a < t.length; a++) a !== s && t[a].unsubscribe(); t = null; } e.next(n); }))); }, r = 0; t && !e.closed && r < A.length; r++) i(r); }; } function Wr() { for (var A = [], e = 0; e < arguments.length; e++) A[e] = arguments[e]; var t = Uh(A), i = um(A); return i.length ? new de(function(r) { var s = i.map(function() { return []; }), n = i.map(function() { return !1; }); r.add(function() { s = n = null; }); for (var a = function(l) { Ot(i[l]).subscribe(ct(r, function(d) { if (s[l].push(d), s.every(function(c) { return c.length; })) { var h = s.map(function(c) { return c.shift(); }); r.next(t ? t.apply(void 0, $s([], Gr(h))) : h), s.some(function(c, m) { return !c.length && n[m]; }) && r.complete(); } }, function() { n[l] = !0, !s[l].length && r.complete(); })); }, o = 0; !r.closed && o < i.length; o++) a(o); return function() { s = n = null; }; }) : Hh; } function Rr(A) { return Gt(function(e, t) { var i = null, r = !1, s; i = e.subscribe(ct(t, void 0, void 0, function(n) { s = Ot(A(n, Rr(A)(e))), i ? (i.unsubscribe(), i = null, s.subscribe(t)) : r = !0; })), r && (i.unsubscribe(), i = null, s.subscribe(t)); }); } function rv(A, e, t, i, r) { return function(s, n) { var a = t, o = e, l = 0; s.subscribe(ct(n, function(d) { var h = l++; o = a ? A(o, d, h) : (a = !0, d); }, function() { a && n.next(o), n.complete(); })); }; } function sv(A, e) { return Gt(rv(A, e, arguments.length >= 2, !1, !0)); } var nv = function(A, e) { return A.push(e), A; }; function Gd() { return Gt(function(A, e) { sv(nv, [])(A).subscribe(e); }); } function Od(A, e) { return Ke(e) ? or(A, e, 1) : or(A, 1); } function Ti(A, e) { return e === void 0 && (e = Zs), Gt(function(t, i) { var r = null, s = null, n = null, a = function() { if (r) { r.unsubscribe(), r = null; var l = s; s = null, i.next(l); } }; function o() { var l = n + A, d = e.now(); if (d < l) { r = this.schedule(void 0, l - d), i.add(r); return; } a(); } t.subscribe(ct(i, function(l) { s = l, n = e.now(), r || (r = e.schedule(o, A), i.add(r)); }, function() { a(), i.complete(); }, void 0, function() { s = r = null; })); }); } function av(A) { return Gt(function(e, t) { var i = !1; e.subscribe(ct(t, function(r) { i = !0, t.next(r); }, function() { i || t.next(A), t.complete(); })); }); } function it(A) { return A <= 0 ? function() { return Hh; } : Gt(function(e, t) { var i = 0; e.subscribe(ct(t, function(r) { ++i <= A && (t.next(r), A <= i && t.complete()); })); }); } function ov(A) { return _e(function() { return A; }); } function lv(A, e) { return or(function(t, i) { return Ot(A(t, i)).pipe(it(1), ov(t)); }); } function dv(A, e) { e === void 0 && (e = Zs); var t = Kn(A, e); return lv(function() { return t; }); } function Jh(A, e) { return e === void 0 && (e = Yr), A = A ?? hv, Gt(function(t, i) { var r, s = !0; t.subscribe(ct(i, function(n) { var a = e(n); (s || !A(r, a)) && (s = !1, r = a, i.next(n)); })); }); } function hv(A, e) { return A === e; } function cv(A) { return A === void 0 && (A = uv), Gt(function(e, t) { var i = !1; e.subscribe(ct(t, function(r) { i = !0, t.next(r); }, function() { return i ? t.complete() : t.error(A()); })); }); } function uv() { return new Yh(); } function Ms(A, e) { var t = arguments.length >= 2; return function(i) { return i.pipe(Yr, it(1), t ? av(e) : cv(function() { return new Yh(); })); }; } function gv(A) { return Gt(function(e, t) { var i = !1, r = null; e.subscribe(ct(t, function(s) { i = !0, r = s; })), Ot(A).subscribe(ct(t, function() { if (i) { i = !1; var s = r; r = null, t.next(s); } }, sl)); }); } function gm(A, e) { return e === void 0 && (e = Zs), gv(Kh(A, e)); } function tu(A) { return ce(function(e, t) { return A <= t; }); } function al(A, e) { return Gt(function(t, i) { var r = null, s = 0, n = !1, a = function() { return n && !r && i.complete(); }; t.subscribe(ct(i, function(o) { r == null || r.unsubscribe(); var l = 0, d = s++; Ot(A(o, d)).subscribe(r = ct(i, function(h) { return i.next(e ? e(o, h, d, l++) : h); }, function() { r = null, a(); })); }, function() { n = !0, a(); })); }); } function E(A) { return Gt(function(e, t) { Ot(A).subscribe(ct(t, function() { return t.complete(); }, sl)), !t.closed && e.subscribe(t); }); } function mm(A, e, t) { var i = Ke(A) || e || t ? { next: A, error: e, complete: t } : A; return i ? Gt(function(r, s) { var n; (n = i.subscribe) === null || n === void 0 || n.call(i); var a = !0; r.subscribe(ct(s, function(o) { var l; (l = i.next) === null || l === void 0 || l.call(i, o), s.next(o); }, function() { var o; a = !1, (o = i.complete) === null || o === void 0 || o.call(i), s.complete(); }, function(o) { var l; a = !1, (l = i.error) === null || l === void 0 || l.call(i, o), s.error(o); }, function() { var o, l; a && ((o = i.unsubscribe) === null || o === void 0 || o.call(i)), (l = i.finalize) === null || l === void 0 || l.call(i); })); }) : Yr; } class qh { constructor(e) { this.onChange$ = new b(), this.style = { ...e }; } get style() { return this._style; } set style(e) { let t = JSON.stringify(this._style); this._style = { ...this._style, ...e }, t !== JSON.stringify(this._style) && this.onChange$.next(this._style); } } class Vt { static isNullUndefinedOrWhitespace(e) { return typeof e === void 0 || e == null ? !0 : `${e}`.replace(/\s/g, "").length < 1; } static isNonEmpty(e) { return !this.isNullUndefinedOrWhitespace(e); } static isEmpty(e) { return !this.isNonEmpty(e); } static toArrayBuffer(e) { return new TextEncoder().encode(e).buffer; } } class Di extends Error { constructor(e, t) { super(e), this.name = Vt.isNullUndefinedOrWhitespace(t) ? "OmpError" : t; } } class mv extends Di { constructor(e) { super(e, "OmpBroadcastChannelError"); } } class fv extends Di { constructor(e) { super(e, "OmpBroadcastChannelTimeoutError"); } } class si extends Di { constructor(e) { super(e, "OmpVideoWindowPlaybackError"); } } var Ge; (function(A) { A.assertEqual = (r) => r; function e(r) { } A.assertIs = e; function t(r) { throw new Error(); } A.assertNever = t, A.arrayToEnum = (r) => { const s = {}; for (const n of r) s[n] = n; return s; }, A.getValidEnumValues = (r) => { const s = A.objectKeys(r).filter((a) => typeof r[r[a]] != "number"), n = {}; for (const a of s) n[a] = r[a]; return A.objectValues(n); }, A.objectValues = (r) => A.objectKeys(r).map(function(s) { return r[s]; }), A.objectKeys = typeof Object.keys == "function" ? (r) => Object.keys(r) : (r) => { const s = []; for (const n in r) Object.prototype.hasOwnProperty.call(r, n) && s.push(n); return s; }, A.find = (r, s) => { for (const n of r) if (s(n)) return n; }, A.isInteger = typeof Number.isInteger == "function" ? (r) => Number.isInteger(r) : (r) => typeof r == "number" && isFinite(r) && Math.floor(r) === r; function i(r, s = " | ") { return r.map((n) => typeof n == "string" ? `'${n}'` : n).join(s); } A.joinValues = i, A.jsonStringifyReplacer = (r, s) => typeof s == "bigint" ? s.toString() : s; })(Ge || (Ge = {})); var Hd; (function(A) { A.mergeShapes = (e, t) => ({ ...e, ...t // second overwrites first }); })(Hd || (Hd = {})); const Ae = Ge.arrayToEnum([ "string", "nan", "number", "integer", "float", "boolean", "date", "bigint", "symbol", "function", "undefined", "null", "array", "object", "unknown", "promise", "void", "never", "map", "set" ]), ir = (A) => { switch (typeof A) { case "undefined": return Ae.undefined; case "string": return Ae.string; case "number": return isNaN(A) ? Ae.nan : Ae.number; case "boolean": return Ae.boolean; case "function": return Ae.function; case "bigint": return Ae.bigint; case "symbol": return Ae.symbol; case "object": return Array.isArray(A) ? Ae.array : A === null ? Ae.null : A.then && typeof A.then == "function" && A.catch && typeof A.catch == "function" ? Ae.promise : typeof Map < "u" && A instanceof Map ? Ae.map : typeof Set < "u" && A instanceof Set ? Ae.set : typeof Date < "u" && A instanceof Date ? Ae.date : Ae.object; default: return Ae.unknown; } }, U = Ge.arrayToEnum([ "invalid_type", "invalid_literal", "custom", "invalid_union", "invalid_union_discriminator", "invalid_enum_value", "unrecognized_keys", "invalid_arguments", "invalid_return_type", "invalid_date", "invalid_string", "too_small", "too_big", "invalid_intersection_types", "not_multiple_of", "not_finite" ]), pv = (A) => JSON.stringify(A, null, 2).replace(/"([^"]+)":/g, "$1:"); class mi extends Error { constructor(e) { super(), this.issues = [], this.addIssue = (i) => { this.issues = [...this.issues, i]; }, this.addIssues = (i = []) => { this.issues = [...this.issues, ...i]; }; const t = new.target.prototype; Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e; } get errors() { return this.issues; } format(e) { const t = e || function(s) { return s.message; }, i = { _errors: [] }, r = (s) => { for (const n of s.issues) if (n.code === "invalid_union") n.unionErrors.map(r); else if (n.code === "invalid_return_type") r(n.returnTypeError); else if (n.code === "invalid_arguments") r(n.argumentsError); else if (n.path.length === 0) i._errors.push(t(n)); else { let a = i, o = 0; for (; o < n.path.length; ) { const l = n.path[o]; o === n.path.length - 1 ? (a[l] = a[l] || { _errors: [] }, a[l]._errors.push(t(n))) : a[l] = a[l] || { _errors: [] }, a = a[l], o++; } } }; return r(this), i; } static assert(e) { if (!(e instanceof mi)) throw new Error(`Not a ZodError: ${e}`); } toString() { return this.message; } get message() { return JSON.stringify(this.issues, Ge.jsonStringifyReplacer, 2); } get isEmpty() { return this.issues.length === 0; } flatten(e = (t) => t.message) { const t = {}, i = []; for (const r of this.issues) r.path.length > 0 ? (t[r.path[0]] = t[r.path[0]] || [], t[r.path[0]].push(e(r))) : i.push(e(r)); return { formErrors: i, fieldErrors: t }; } get formErrors() { return this.flatten(); } } mi.create = (A) => new mi(A); const Us = (A, e) => { let t; switch (A.code) { case U.invalid_type: A.received === Ae.undefined ? t = "Required" : t = `Expected ${A.expected}, received ${A.received}`; break; case U.invalid_literal: t = `Invalid literal value, expected ${JSON.stringify(A.expected, Ge.jsonStringifyReplacer)}`; break; case U.unrecognized_keys: t = `Unrecognized key(s) in object: ${Ge.joinValues(A.keys, ", ")}`; break; case U.invalid_union: t = "Invalid input"; break; case U.invalid_union_discriminator: t = `Invalid discriminator value. Expected ${Ge.joinValues(A.options)}`; break; case U.invalid_enum_value: t = `Invalid enum value. Expected ${Ge.joinValues(A.options)}, received '${A.received}'`; break; case U.invalid_arguments: t = "Invalid function arguments"; break; case U.invalid_return_type: t = "Invalid function return type"; break; case U.invalid_date: t = "Invalid date"; break; case U.invalid_string: typeof A.validation