import v from "react";
import { l as P } from "../../../../load-script@1.0.0/node_modules/load-script/index.mjs";
import { c as S } from "../../../../deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.mjs";
var h = Object.create, u = Object.defineProperty, M = Object.getOwnPropertyDescriptor, O = Object.getOwnPropertyNames, T = Object.getPrototypeOf, x = Object.prototype.hasOwnProperty, j = (e, t) => {
  for (var n in t)
    u(e, n, { get: t[n], enumerable: !0 });
}, y = (e, t, n, r) => {
  if (t && typeof t == "object" || typeof t == "function")
    for (let o of O(t))
      !x.call(e, o) && o !== n && u(e, o, { get: () => t[o], enumerable: !(r = M(t, o)) || r.enumerable });
  return e;
}, d = (e, t, n) => (n = e != null ? h(T(e)) : {}, y(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  t || !e || !e.__esModule ? u(n, "default", { value: e, enumerable: !0 }) : n,
  e
)), E = (e) => y(u({}, "__esModule", { value: !0 }), e), g = {};
j(g, {
  callPlayer: () => Y,
  getConfig: () => Q,
  getSDK: () => B,
  isBlobUrl: () => L,
  isMediaStream: () => J,
  lazy: () => K,
  omit: () => W,
  parseEndTime: () => H,
  parseStartTime: () => $,
  queryString: () => z,
  randomString: () => q,
  supportsWebKitPresentationMode: () => F
});
var Z = E(g), A = d(v), C = d(P), D = d(S);
const K = (e) => A.default.lazy(async () => {
  const t = await e();
  return typeof t.default == "function" ? t : t.default;
}), I = /[?&#](?:start|t)=([0-9hms]+)/, N = /[?&#]end=([0-9hms]+)/, p = /(\d+)(h|m|s)/g, R = /^\d+$/;
function b(e, t) {
  if (e instanceof Array)
    return;
  const n = e.match(t);
  if (n) {
    const r = n[1];
    if (r.match(p))
      return U(r);
    if (R.test(r))
      return parseInt(r);
  }
}
function U(e) {
  let t = 0, n = p.exec(e);
  for (; n !== null; ) {
    const [, r, o] = n;
    o === "h" && (t += parseInt(r, 10) * 60 * 60), o === "m" && (t += parseInt(r, 10) * 60), o === "s" && (t += parseInt(r, 10)), n = p.exec(e);
  }
  return t;
}
function $(e) {
  return b(e, I);
}
function H(e) {
  return b(e, N);
}
function q() {
  return Math.random().toString(36).substr(2, 5);
}
function z(e) {
  return Object.keys(e).map((t) => `${t}=${e[t]}`).join("&");
}
function l(e) {
  return window[e] ? window[e] : window.exports && window.exports[e] ? window.exports[e] : window.module && window.module.exports && window.module.exports[e] ? window.module.exports[e] : null;
}
const a = {}, B = function(t, n, r = null, o = () => !0, s = C.default) {
  const c = l(n);
  return c && o(c) ? Promise.resolve(c) : new Promise((w, m) => {
    if (a[t]) {
      a[t].push({ resolve: w, reject: m });
      return;
    }
    a[t] = [{ resolve: w, reject: m }];
    const _ = (i) => {
      a[t].forEach((f) => f.resolve(i));
    };
    if (r) {
      const i = window[r];
      window[r] = function() {
        i && i(), _(l(n));
      };
    }
    s(t, (i) => {
      i ? (a[t].forEach((f) => f.reject(i)), a[t] = null) : r || _(l(n));
    });
  });
};
function Q(e, t) {
  return (0, D.default)(t.config, e.config);
}
function W(e, ...t) {
  const n = [].concat(...t), r = {}, o = Object.keys(e);
  for (const s of o)
    n.indexOf(s) === -1 && (r[s] = e[s]);
  return r;
}
function Y(e, ...t) {
  if (!this.player || !this.player[e]) {
    let n = `ReactPlayer: ${this.constructor.displayName} player could not call %c${e}%c – `;
    return this.player ? this.player[e] || (n += "The method was not available") : n += "The player was not available", console.warn(n, "font-weight: bold", ""), null;
  }
  return this.player[e](...t);
}
function J(e) {
  return typeof window < "u" && typeof window.MediaStream < "u" && e instanceof window.MediaStream;
}
function L(e) {
  return /^blob:/.test(e);
}
function F(e = document.createElement("video")) {
  const t = /iPhone|iPod/.test(navigator.userAgent) === !1;
  return e.webkitSupportsPresentationMode && typeof e.webkitSetPresentationMode == "function" && t;
}
export {
  Z as u
};
//# sourceMappingURL=utils.mjs.map
