UNPKG

@wethegit/react-autoplay-video

Version:

Viewport-aware auto-playing video component for use in React projects.

1,388 lines (1,384 loc) 47.2 kB
import cr, { createContext as $r, useState as $e, useRef as lr, useCallback as Dr, useEffect as De, forwardRef as Mr } from "react"; function Fr(n) { return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n; } var Me = { exports: {} }, me = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Qe; function Yr() { if (Qe) return me; Qe = 1; var n = cr, g = Symbol.for("react.element"), p = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, P = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; function C(f, v, y) { var c, b = {}, A = null, M = null; y !== void 0 && (A = "" + y), v.key !== void 0 && (A = "" + v.key), v.ref !== void 0 && (M = v.ref); for (c in v) l.call(v, c) && !s.hasOwnProperty(c) && (b[c] = v[c]); if (f && f.defaultProps) for (c in v = f.defaultProps, v) b[c] === void 0 && (b[c] = v[c]); return { $$typeof: g, type: f, key: A, ref: M, props: b, _owner: P.current }; } return me.Fragment = p, me.jsx = C, me.jsxs = C, me; } var Ee = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var er; function Wr() { return er || (er = 1, process.env.NODE_ENV !== "production" && function() { var n = cr, g = Symbol.for("react.element"), p = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), P = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), C = Symbol.for("react.provider"), f = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), c = Symbol.for("react.suspense_list"), b = Symbol.for("react.memo"), A = Symbol.for("react.lazy"), M = Symbol.for("react.offscreen"), z = Symbol.iterator, k = "@@iterator"; function Y(e) { if (e === null || typeof e != "object") return null; var r = z && e[z] || e[k]; return typeof r == "function" ? r : null; } var W = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function q(e) { { for (var r = arguments.length, a = new Array(r > 1 ? r - 1 : 0), d = 1; d < r; d++) a[d - 1] = arguments[d]; U("error", e, a); } } function U(e, r, a) { { var d = W.ReactDebugCurrentFrame, I = d.getStackAddendum(); I !== "" && (r += "%s", a = a.concat([I])); var F = a.map(function(x) { return String(x); }); F.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, F); } } var V = !1, i = !1, ee = !1, pe = !1, ye = !1, ie; ie = Symbol.for("react.module.reference"); function be(e) { return !!(typeof e == "string" || typeof e == "function" || e === l || e === s || ye || e === P || e === y || e === c || pe || e === M || V || i || ee || typeof e == "object" && e !== null && (e.$$typeof === A || e.$$typeof === b || e.$$typeof === C || e.$$typeof === f || e.$$typeof === v || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. e.$$typeof === ie || e.getModuleId !== void 0)); } function ue(e, r, a) { var d = e.displayName; if (d) return d; var I = r.displayName || r.name || ""; return I !== "" ? a + "(" + I + ")" : a; } function se(e) { return e.displayName || "Context"; } function H(e) { if (e == null) return null; if (typeof e.tag == "number" && q("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function") return e.displayName || e.name || null; if (typeof e == "string") return e; switch (e) { case l: return "Fragment"; case p: return "Portal"; case s: return "Profiler"; case P: return "StrictMode"; case y: return "Suspense"; case c: return "SuspenseList"; } if (typeof e == "object") switch (e.$$typeof) { case f: var r = e; return se(r) + ".Consumer"; case C: var a = e; return se(a._context) + ".Provider"; case v: return ue(e, e.render, "ForwardRef"); case b: var d = e.displayName || null; return d !== null ? d : H(e.type) || "Memo"; case A: { var I = e, F = I._payload, x = I._init; try { return H(x(F)); } catch { return null; } } } return null; } var G = Object.assign, re = 0, K, Q, ae, fe, t, u, _; function T() { } T.__reactDisabledLog = !0; function h() { { if (re === 0) { K = console.log, Q = console.info, ae = console.warn, fe = console.error, t = console.group, u = console.groupCollapsed, _ = console.groupEnd; var e = { configurable: !0, enumerable: !0, value: T, writable: !0 }; Object.defineProperties(console, { info: e, log: e, warn: e, error: e, group: e, groupCollapsed: e, groupEnd: e }); } re++; } } function w() { { if (re--, re === 0) { var e = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: G({}, e, { value: K }), info: G({}, e, { value: Q }), warn: G({}, e, { value: ae }), error: G({}, e, { value: fe }), group: G({}, e, { value: t }), groupCollapsed: G({}, e, { value: u }), groupEnd: G({}, e, { value: _ }) }); } re < 0 && q("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var m = W.ReactCurrentDispatcher, E; function R(e, r, a) { { if (E === void 0) try { throw Error(); } catch (I) { var d = I.stack.trim().match(/\n( *(at )?)/); E = d && d[1] || ""; } return ` ` + E + e; } } var j = !1, O; { var B = typeof WeakMap == "function" ? WeakMap : Map; O = new B(); } function o(e, r) { if (!e || j) return ""; { var a = O.get(e); if (a !== void 0) return a; } var d; j = !0; var I = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var F; F = m.current, m.current = null, h(); try { if (r) { var x = function() { throw Error(); }; if (Object.defineProperty(x.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(x, []); } catch (te) { d = te; } Reflect.construct(e, [], x); } else { try { x.call(); } catch (te) { d = te; } e.call(x.prototype); } } else { try { throw Error(); } catch (te) { d = te; } e(); } } catch (te) { if (te && d && typeof te.stack == "string") { for (var S = te.stack.split(` `), J = d.stack.split(` `), L = S.length - 1, N = J.length - 1; L >= 1 && N >= 0 && S[L] !== J[N]; ) N--; for (; L >= 1 && N >= 0; L--, N--) if (S[L] !== J[N]) { if (L !== 1 || N !== 1) do if (L--, N--, N < 0 || S[L] !== J[N]) { var Z = ` ` + S[L].replace(" at new ", " at "); return e.displayName && Z.includes("<anonymous>") && (Z = Z.replace("<anonymous>", e.displayName)), typeof e == "function" && O.set(e, Z), Z; } while (L >= 1 && N >= 0); break; } } } finally { j = !1, m.current = F, w(), Error.prepareStackTrace = I; } var de = e ? e.displayName || e.name : "", Ze = de ? R(de) : ""; return typeof e == "function" && O.set(e, Ze), Ze; } function X(e, r, a) { return o(e, !1); } function ce(e) { var r = e.prototype; return !!(r && r.isReactComponent); } function oe(e, r, a) { if (e == null) return ""; if (typeof e == "function") return o(e, ce(e)); if (typeof e == "string") return R(e); switch (e) { case y: return R("Suspense"); case c: return R("SuspenseList"); } if (typeof e == "object") switch (e.$$typeof) { case v: return X(e.render); case b: return oe(e.type, r, a); case A: { var d = e, I = d._payload, F = d._init; try { return oe(F(I), r, a); } catch { } } } return ""; } var ge = Object.prototype.hasOwnProperty, qe = {}, Le = W.ReactDebugCurrentFrame; function Te(e) { if (e) { var r = e._owner, a = oe(e.type, e._source, r ? r.type : null); Le.setExtraStackFrame(a); } else Le.setExtraStackFrame(null); } function pr(e, r, a, d, I) { { var F = Function.call.bind(ge); for (var x in e) if (F(e, x)) { var S = void 0; try { if (typeof e[x] != "function") { var J = Error((d || "React class") + ": " + a + " type `" + x + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[x] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw J.name = "Invariant Violation", J; } S = e[x](r, x, d, a, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (L) { S = L; } S && !(S instanceof Error) && (Te(I), q("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", d || "React class", a, x, typeof S), Te(null)), S instanceof Error && !(S.message in qe) && (qe[S.message] = !0, Te(I), q("Failed %s type: %s", a, S.message), Te(null)); } } } var yr = Array.isArray; function Re(e) { return yr(e); } function br(e) { { var r = typeof Symbol == "function" && Symbol.toStringTag, a = r && e[Symbol.toStringTag] || e.constructor.name || "Object"; return a; } } function hr(e) { try { return Ve(e), !1; } catch { return !0; } } function Ve(e) { return "" + e; } function Ne(e) { if (hr(e)) return q("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", br(e)), Ve(e); } var he = W.ReactCurrentOwner, mr = { key: !0, ref: !0, __self: !0, __source: !0 }, Ue, ze, Oe; Oe = {}; function Er(e) { if (ge.call(e, "ref")) { var r = Object.getOwnPropertyDescriptor(e, "ref").get; if (r && r.isReactWarning) return !1; } return e.ref !== void 0; } function gr(e) { if (ge.call(e, "key")) { var r = Object.getOwnPropertyDescriptor(e, "key").get; if (r && r.isReactWarning) return !1; } return e.key !== void 0; } function Tr(e, r) { if (typeof e.ref == "string" && he.current && r && he.current.stateNode !== r) { var a = H(he.current.type); Oe[a] || (q('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', H(he.current.type), e.ref), Oe[a] = !0); } } function _r(e, r) { { var a = function() { Ue || (Ue = !0, q("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r)); }; a.isReactWarning = !0, Object.defineProperty(e, "key", { get: a, configurable: !0 }); } } function Rr(e, r) { { var a = function() { ze || (ze = !0, q("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r)); }; a.isReactWarning = !0, Object.defineProperty(e, "ref", { get: a, configurable: !0 }); } } var Or = function(e, r, a, d, I, F, x) { var S = { // This tag allows us to uniquely identify this as a React Element $$typeof: g, // Built-in properties that belong on the element type: e, key: r, ref: a, props: x, // Record the component responsible for creating this element. _owner: F }; return S._store = {}, Object.defineProperty(S._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(S, "_self", { configurable: !1, enumerable: !1, writable: !1, value: d }), Object.defineProperty(S, "_source", { configurable: !1, enumerable: !1, writable: !1, value: I }), Object.freeze && (Object.freeze(S.props), Object.freeze(S)), S; }; function Sr(e, r, a, d, I) { { var F, x = {}, S = null, J = null; a !== void 0 && (Ne(a), S = "" + a), gr(r) && (Ne(r.key), S = "" + r.key), Er(r) && (J = r.ref, Tr(r, I)); for (F in r) ge.call(r, F) && !mr.hasOwnProperty(F) && (x[F] = r[F]); if (e && e.defaultProps) { var L = e.defaultProps; for (F in L) x[F] === void 0 && (x[F] = L[F]); } if (S || J) { var N = typeof e == "function" ? e.displayName || e.name || "Unknown" : e; S && _r(x, N), J && Rr(x, N); } return Or(e, S, J, I, d, he.current, x); } } var Se = W.ReactCurrentOwner, Be = W.ReactDebugCurrentFrame; function le(e) { if (e) { var r = e._owner, a = oe(e.type, e._source, r ? r.type : null); Be.setExtraStackFrame(a); } else Be.setExtraStackFrame(null); } var Pe; Pe = !1; function Ce(e) { return typeof e == "object" && e !== null && e.$$typeof === g; } function Je() { { if (Se.current) { var e = H(Se.current.type); if (e) return ` Check the render method of \`` + e + "`."; } return ""; } } function Pr(e) { { if (e !== void 0) { var r = e.fileName.replace(/^.*[\\\/]/, ""), a = e.lineNumber; return ` Check your code at ` + r + ":" + a + "."; } return ""; } } var Ge = {}; function Cr(e) { { var r = Je(); if (!r) { var a = typeof e == "string" ? e : e.displayName || e.name; a && (r = ` Check the top-level render call using <` + a + ">."); } return r; } } function He(e, r) { { if (!e._store || e._store.validated || e.key != null) return; e._store.validated = !0; var a = Cr(r); if (Ge[a]) return; Ge[a] = !0; var d = ""; e && e._owner && e._owner !== Se.current && (d = " It was passed a child from " + H(e._owner.type) + "."), le(e), q('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', a, d), le(null); } } function Ke(e, r) { { if (typeof e != "object") return; if (Re(e)) for (var a = 0; a < e.length; a++) { var d = e[a]; Ce(d) && He(d, r); } else if (Ce(e)) e._store && (e._store.validated = !0); else if (e) { var I = Y(e); if (typeof I == "function" && I !== e.entries) for (var F = I.call(e), x; !(x = F.next()).done; ) Ce(x.value) && He(x.value, r); } } } function wr(e) { { var r = e.type; if (r == null || typeof r == "string") return; var a; if (typeof r == "function") a = r.propTypes; else if (typeof r == "object" && (r.$$typeof === v || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. r.$$typeof === b)) a = r.propTypes; else return; if (a) { var d = H(r); pr(a, e.props, "prop", d, e); } else if (r.PropTypes !== void 0 && !Pe) { Pe = !0; var I = H(r); q("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", I || "Unknown"); } typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && q("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function xr(e) { { for (var r = Object.keys(e.props), a = 0; a < r.length; a++) { var d = r[a]; if (d !== "children" && d !== "key") { le(e), q("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", d), le(null); break; } } e.ref !== null && (le(e), q("Invalid attribute `ref` supplied to `React.Fragment`."), le(null)); } } function Xe(e, r, a, d, I, F) { { var x = be(e); if (!x) { var S = ""; (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (S += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var J = Pr(I); J ? S += J : S += Je(); var L; e === null ? L = "null" : Re(e) ? L = "array" : e !== void 0 && e.$$typeof === g ? (L = "<" + (H(e.type) || "Unknown") + " />", S = " Did you accidentally export a JSX literal instead of a component?") : L = typeof e, q("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", L, S); } var N = Sr(e, r, a, I, F); if (N == null) return N; if (x) { var Z = r.children; if (Z !== void 0) if (d) if (Re(Z)) { for (var de = 0; de < Z.length; de++) Ke(Z[de], e); Object.freeze && Object.freeze(Z); } else q("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else Ke(Z, e); } return e === l ? xr(N) : wr(N), N; } } function jr(e, r, a) { return Xe(e, r, a, !0); } function Ar(e, r, a) { return Xe(e, r, a, !1); } var Ir = Ar, kr = jr; Ee.Fragment = l, Ee.jsx = Ir, Ee.jsxs = kr; }()), Ee; } process.env.NODE_ENV === "production" ? Me.exports = Yr() : Me.exports = Wr(); var ve = Me.exports, Fe = { exports: {} }, _e = { exports: {} }, $ = {}; /** @license React v16.13.1 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var rr; function qr() { if (rr) return $; rr = 1; var n = typeof Symbol == "function" && Symbol.for, g = n ? Symbol.for("react.element") : 60103, p = n ? Symbol.for("react.portal") : 60106, l = n ? Symbol.for("react.fragment") : 60107, P = n ? Symbol.for("react.strict_mode") : 60108, s = n ? Symbol.for("react.profiler") : 60114, C = n ? Symbol.for("react.provider") : 60109, f = n ? Symbol.for("react.context") : 60110, v = n ? Symbol.for("react.async_mode") : 60111, y = n ? Symbol.for("react.concurrent_mode") : 60111, c = n ? Symbol.for("react.forward_ref") : 60112, b = n ? Symbol.for("react.suspense") : 60113, A = n ? Symbol.for("react.suspense_list") : 60120, M = n ? Symbol.for("react.memo") : 60115, z = n ? Symbol.for("react.lazy") : 60116, k = n ? Symbol.for("react.block") : 60121, Y = n ? Symbol.for("react.fundamental") : 60117, W = n ? Symbol.for("react.responder") : 60118, q = n ? Symbol.for("react.scope") : 60119; function U(i) { if (typeof i == "object" && i !== null) { var ee = i.$$typeof; switch (ee) { case g: switch (i = i.type, i) { case v: case y: case l: case s: case P: case b: return i; default: switch (i = i && i.$$typeof, i) { case f: case c: case z: case M: case C: return i; default: return ee; } } case p: return ee; } } } function V(i) { return U(i) === y; } return $.AsyncMode = v, $.ConcurrentMode = y, $.ContextConsumer = f, $.ContextProvider = C, $.Element = g, $.ForwardRef = c, $.Fragment = l, $.Lazy = z, $.Memo = M, $.Portal = p, $.Profiler = s, $.StrictMode = P, $.Suspense = b, $.isAsyncMode = function(i) { return V(i) || U(i) === v; }, $.isConcurrentMode = V, $.isContextConsumer = function(i) { return U(i) === f; }, $.isContextProvider = function(i) { return U(i) === C; }, $.isElement = function(i) { return typeof i == "object" && i !== null && i.$$typeof === g; }, $.isForwardRef = function(i) { return U(i) === c; }, $.isFragment = function(i) { return U(i) === l; }, $.isLazy = function(i) { return U(i) === z; }, $.isMemo = function(i) { return U(i) === M; }, $.isPortal = function(i) { return U(i) === p; }, $.isProfiler = function(i) { return U(i) === s; }, $.isStrictMode = function(i) { return U(i) === P; }, $.isSuspense = function(i) { return U(i) === b; }, $.isValidElementType = function(i) { return typeof i == "string" || typeof i == "function" || i === l || i === y || i === s || i === P || i === b || i === A || typeof i == "object" && i !== null && (i.$$typeof === z || i.$$typeof === M || i.$$typeof === C || i.$$typeof === f || i.$$typeof === c || i.$$typeof === Y || i.$$typeof === W || i.$$typeof === q || i.$$typeof === k); }, $.typeOf = U, $; } var D = {}; /** @license React v16.13.1 * react-is.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var tr; function Lr() { return tr || (tr = 1, process.env.NODE_ENV !== "production" && function() { var n = typeof Symbol == "function" && Symbol.for, g = n ? Symbol.for("react.element") : 60103, p = n ? Symbol.for("react.portal") : 60106, l = n ? Symbol.for("react.fragment") : 60107, P = n ? Symbol.for("react.strict_mode") : 60108, s = n ? Symbol.for("react.profiler") : 60114, C = n ? Symbol.for("react.provider") : 60109, f = n ? Symbol.for("react.context") : 60110, v = n ? Symbol.for("react.async_mode") : 60111, y = n ? Symbol.for("react.concurrent_mode") : 60111, c = n ? Symbol.for("react.forward_ref") : 60112, b = n ? Symbol.for("react.suspense") : 60113, A = n ? Symbol.for("react.suspense_list") : 60120, M = n ? Symbol.for("react.memo") : 60115, z = n ? Symbol.for("react.lazy") : 60116, k = n ? Symbol.for("react.block") : 60121, Y = n ? Symbol.for("react.fundamental") : 60117, W = n ? Symbol.for("react.responder") : 60118, q = n ? Symbol.for("react.scope") : 60119; function U(o) { return typeof o == "string" || typeof o == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. o === l || o === y || o === s || o === P || o === b || o === A || typeof o == "object" && o !== null && (o.$$typeof === z || o.$$typeof === M || o.$$typeof === C || o.$$typeof === f || o.$$typeof === c || o.$$typeof === Y || o.$$typeof === W || o.$$typeof === q || o.$$typeof === k); } function V(o) { if (typeof o == "object" && o !== null) { var X = o.$$typeof; switch (X) { case g: var ce = o.type; switch (ce) { case v: case y: case l: case s: case P: case b: return ce; default: var oe = ce && ce.$$typeof; switch (oe) { case f: case c: case z: case M: case C: return oe; default: return X; } } case p: return X; } } } var i = v, ee = y, pe = f, ye = C, ie = g, be = c, ue = l, se = z, H = M, G = p, re = s, K = P, Q = b, ae = !1; function fe(o) { return ae || (ae = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), t(o) || V(o) === v; } function t(o) { return V(o) === y; } function u(o) { return V(o) === f; } function _(o) { return V(o) === C; } function T(o) { return typeof o == "object" && o !== null && o.$$typeof === g; } function h(o) { return V(o) === c; } function w(o) { return V(o) === l; } function m(o) { return V(o) === z; } function E(o) { return V(o) === M; } function R(o) { return V(o) === p; } function j(o) { return V(o) === s; } function O(o) { return V(o) === P; } function B(o) { return V(o) === b; } D.AsyncMode = i, D.ConcurrentMode = ee, D.ContextConsumer = pe, D.ContextProvider = ye, D.Element = ie, D.ForwardRef = be, D.Fragment = ue, D.Lazy = se, D.Memo = H, D.Portal = G, D.Profiler = re, D.StrictMode = K, D.Suspense = Q, D.isAsyncMode = fe, D.isConcurrentMode = t, D.isContextConsumer = u, D.isContextProvider = _, D.isElement = T, D.isForwardRef = h, D.isFragment = w, D.isLazy = m, D.isMemo = E, D.isPortal = R, D.isProfiler = j, D.isStrictMode = O, D.isSuspense = B, D.isValidElementType = U, D.typeOf = V; }()), D; } var nr; function dr() { return nr || (nr = 1, process.env.NODE_ENV === "production" ? _e.exports = qr() : _e.exports = Lr()), _e.exports; } /* object-assign (c) Sindre Sorhus @license MIT */ var we, ar; function Vr() { if (ar) return we; ar = 1; var n = Object.getOwnPropertySymbols, g = Object.prototype.hasOwnProperty, p = Object.prototype.propertyIsEnumerable; function l(s) { if (s == null) throw new TypeError("Object.assign cannot be called with null or undefined"); return Object(s); } function P() { try { if (!Object.assign) return !1; var s = new String("abc"); if (s[5] = "de", Object.getOwnPropertyNames(s)[0] === "5") return !1; for (var C = {}, f = 0; f < 10; f++) C["_" + String.fromCharCode(f)] = f; var v = Object.getOwnPropertyNames(C).map(function(c) { return C[c]; }); if (v.join("") !== "0123456789") return !1; var y = {}; return "abcdefghijklmnopqrst".split("").forEach(function(c) { y[c] = c; }), Object.keys(Object.assign({}, y)).join("") === "abcdefghijklmnopqrst"; } catch { return !1; } } return we = P() ? Object.assign : function(s, C) { for (var f, v = l(s), y, c = 1; c < arguments.length; c++) { f = Object(arguments[c]); for (var b in f) g.call(f, b) && (v[b] = f[b]); if (n) { y = n(f); for (var A = 0; A < y.length; A++) p.call(f, y[A]) && (v[y[A]] = f[y[A]]); } } return v; }, we; } var xe, or; function Ye() { if (or) return xe; or = 1; var n = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"; return xe = n, xe; } var je, ir; function vr() { return ir || (ir = 1, je = Function.call.bind(Object.prototype.hasOwnProperty)), je; } var Ae, ur; function Nr() { if (ur) return Ae; ur = 1; var n = function() { }; if (process.env.NODE_ENV !== "production") { var g = Ye(), p = {}, l = vr(); n = function(s) { var C = "Warning: " + s; typeof console < "u" && console.error(C); try { throw new Error(C); } catch { } }; } function P(s, C, f, v, y) { if (process.env.NODE_ENV !== "production") { for (var c in s) if (l(s, c)) { var b; try { if (typeof s[c] != "function") { var A = Error( (v || "React class") + ": " + f + " type `" + c + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof s[c] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`." ); throw A.name = "Invariant Violation", A; } b = s[c](C, c, v, f, null, g); } catch (z) { b = z; } if (b && !(b instanceof Error) && n( (v || "React class") + ": type specification of " + f + " `" + c + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof b + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)." ), b instanceof Error && !(b.message in p)) { p[b.message] = !0; var M = y ? y() : ""; n( "Failed " + f + " type: " + b.message + (M ?? "") ); } } } } return P.resetWarningCache = function() { process.env.NODE_ENV !== "production" && (p = {}); }, Ae = P, Ae; } var Ie, sr; function Ur() { if (sr) return Ie; sr = 1; var n = dr(), g = Vr(), p = Ye(), l = vr(), P = Nr(), s = function() { }; process.env.NODE_ENV !== "production" && (s = function(f) { var v = "Warning: " + f; typeof console < "u" && console.error(v); try { throw new Error(v); } catch { } }); function C() { return null; } return Ie = function(f, v) { var y = typeof Symbol == "function" && Symbol.iterator, c = "@@iterator"; function b(t) { var u = t && (y && t[y] || t[c]); if (typeof u == "function") return u; } var A = "<<anonymous>>", M = { array: W("array"), bigint: W("bigint"), bool: W("boolean"), func: W("function"), number: W("number"), object: W("object"), string: W("string"), symbol: W("symbol"), any: q(), arrayOf: U, element: V(), elementType: i(), instanceOf: ee, node: be(), objectOf: ye, oneOf: pe, oneOfType: ie, shape: se, exact: H }; function z(t, u) { return t === u ? t !== 0 || 1 / t === 1 / u : t !== t && u !== u; } function k(t, u) { this.message = t, this.data = u && typeof u == "object" ? u : {}, this.stack = ""; } k.prototype = Error.prototype; function Y(t) { if (process.env.NODE_ENV !== "production") var u = {}, _ = 0; function T(w, m, E, R, j, O, B) { if (R = R || A, O = O || E, B !== p) { if (v) { var o = new Error( "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types" ); throw o.name = "Invariant Violation", o; } else if (process.env.NODE_ENV !== "production" && typeof console < "u") { var X = R + ":" + E; !u[X] && // Avoid spamming the console because they are often not actionable except for lib authors _ < 3 && (s( "You are manually calling a React.PropTypes validation function for the `" + O + "` prop on `" + R + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details." ), u[X] = !0, _++); } } return m[E] == null ? w ? m[E] === null ? new k("The " + j + " `" + O + "` is marked as required " + ("in `" + R + "`, but its value is `null`.")) : new k("The " + j + " `" + O + "` is marked as required in " + ("`" + R + "`, but its value is `undefined`.")) : null : t(m, E, R, j, O); } var h = T.bind(null, !1); return h.isRequired = T.bind(null, !0), h; } function W(t) { function u(_, T, h, w, m, E) { var R = _[T], j = K(R); if (j !== t) { var O = Q(R); return new k( "Invalid " + w + " `" + m + "` of type " + ("`" + O + "` supplied to `" + h + "`, expected ") + ("`" + t + "`."), { expectedType: t } ); } return null; } return Y(u); } function q() { return Y(C); } function U(t) { function u(_, T, h, w, m) { if (typeof t != "function") return new k("Property `" + m + "` of component `" + h + "` has invalid PropType notation inside arrayOf."); var E = _[T]; if (!Array.isArray(E)) { var R = K(E); return new k("Invalid " + w + " `" + m + "` of type " + ("`" + R + "` supplied to `" + h + "`, expected an array.")); } for (var j = 0; j < E.length; j++) { var O = t(E, j, h, w, m + "[" + j + "]", p); if (O instanceof Error) return O; } return null; } return Y(u); } function V() { function t(u, _, T, h, w) { var m = u[_]; if (!f(m)) { var E = K(m); return new k("Invalid " + h + " `" + w + "` of type " + ("`" + E + "` supplied to `" + T + "`, expected a single ReactElement.")); } return null; } return Y(t); } function i() { function t(u, _, T, h, w) { var m = u[_]; if (!n.isValidElementType(m)) { var E = K(m); return new k("Invalid " + h + " `" + w + "` of type " + ("`" + E + "` supplied to `" + T + "`, expected a single ReactElement type.")); } return null; } return Y(t); } function ee(t) { function u(_, T, h, w, m) { if (!(_[T] instanceof t)) { var E = t.name || A, R = fe(_[T]); return new k("Invalid " + w + " `" + m + "` of type " + ("`" + R + "` supplied to `" + h + "`, expected ") + ("instance of `" + E + "`.")); } return null; } return Y(u); } function pe(t) { if (!Array.isArray(t)) return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? s( "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])." ) : s("Invalid argument supplied to oneOf, expected an array.")), C; function u(_, T, h, w, m) { for (var E = _[T], R = 0; R < t.length; R++) if (z(E, t[R])) return null; var j = JSON.stringify(t, function(B, o) { var X = Q(o); return X === "symbol" ? String(o) : o; }); return new k("Invalid " + w + " `" + m + "` of value `" + String(E) + "` " + ("supplied to `" + h + "`, expected one of " + j + ".")); } return Y(u); } function ye(t) { function u(_, T, h, w, m) { if (typeof t != "function") return new k("Property `" + m + "` of component `" + h + "` has invalid PropType notation inside objectOf."); var E = _[T], R = K(E); if (R !== "object") return new k("Invalid " + w + " `" + m + "` of type " + ("`" + R + "` supplied to `" + h + "`, expected an object.")); for (var j in E) if (l(E, j)) { var O = t(E, j, h, w, m + "." + j, p); if (O instanceof Error) return O; } return null; } return Y(u); } function ie(t) { if (!Array.isArray(t)) return process.env.NODE_ENV !== "production" && s("Invalid argument supplied to oneOfType, expected an instance of array."), C; for (var u = 0; u < t.length; u++) { var _ = t[u]; if (typeof _ != "function") return s( "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + ae(_) + " at index " + u + "." ), C; } function T(h, w, m, E, R) { for (var j = [], O = 0; O < t.length; O++) { var B = t[O], o = B(h, w, m, E, R, p); if (o == null) return null; o.data && l(o.data, "expectedType") && j.push(o.data.expectedType); } var X = j.length > 0 ? ", expected one of type [" + j.join(", ") + "]" : ""; return new k("Invalid " + E + " `" + R + "` supplied to " + ("`" + m + "`" + X + ".")); } return Y(T); } function be() { function t(u, _, T, h, w) { return G(u[_]) ? null : new k("Invalid " + h + " `" + w + "` supplied to " + ("`" + T + "`, expected a ReactNode.")); } return Y(t); } function ue(t, u, _, T, h) { return new k( (t || "React class") + ": " + u + " type `" + _ + "." + T + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + h + "`." ); } function se(t) { function u(_, T, h, w, m) { var E = _[T], R = K(E); if (R !== "object") return new k("Invalid " + w + " `" + m + "` of type `" + R + "` " + ("supplied to `" + h + "`, expected `object`.")); for (var j in t) { var O = t[j]; if (typeof O != "function") return ue(h, w, m, j, Q(O)); var B = O(E, j, h, w, m + "." + j, p); if (B) return B; } return null; } return Y(u); } function H(t) { function u(_, T, h, w, m) { var E = _[T], R = K(E); if (R !== "object") return new k("Invalid " + w + " `" + m + "` of type `" + R + "` " + ("supplied to `" + h + "`, expected `object`.")); var j = g({}, _[T], t); for (var O in j) { var B = t[O]; if (l(t, O) && typeof B != "function") return ue(h, w, m, O, Q(B)); if (!B) return new k( "Invalid " + w + " `" + m + "` key `" + O + "` supplied to `" + h + "`.\nBad object: " + JSON.stringify(_[T], null, " ") + ` Valid keys: ` + JSON.stringify(Object.keys(t), null, " ") ); var o = B(E, O, h, w, m + "." + O, p); if (o) return o; } return null; } return Y(u); } function G(t) { switch (typeof t) { case "number": case "string": case "undefined": return !0; case "boolean": return !t; case "object": if (Array.isArray(t)) return t.every(G); if (t === null || f(t)) return !0; var u = b(t); if (u) { var _ = u.call(t), T; if (u !== t.entries) { for (; !(T = _.next()).done; ) if (!G(T.value)) return !1; } else for (; !(T = _.next()).done; ) { var h = T.value; if (h && !G(h[1])) return !1; } } else return !1; return !0; default: return !1; } } function re(t, u) { return t === "symbol" ? !0 : u ? u["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && u instanceof Symbol : !1; } function K(t) { var u = typeof t; return Array.isArray(t) ? "array" : t instanceof RegExp ? "object" : re(u, t) ? "symbol" : u; } function Q(t) { if (typeof t > "u" || t === null) return "" + t; var u = K(t); if (u === "object") { if (t instanceof Date) return "date"; if (t instanceof RegExp) return "regexp"; } return u; } function ae(t) { var u = Q(t); switch (u) { case "array": case "object": return "an " + u; case "boolean": case "date": case "regexp": return "a " + u; default: return u; } } function fe(t) { return !t.constructor || !t.constructor.name ? A : t.constructor.name; } return M.checkPropTypes = P, M.resetWarningCache = P.resetWarningCache, M.PropTypes = M, M; }, Ie; } var ke, fr; function zr() { if (fr) return ke; fr = 1; var n = Ye(); function g() { } function p() { } return p.resetWarningCache = g, ke = function() { function l(C, f, v, y, c, b) { if (b !== n) { var A = new Error( "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types" ); throw A.name = "Invariant Violation", A; } } l.isRequired = l; function P() { return l; } var s = { array: l, bigint: l, bool: l, func: l, number: l, object: l, string: l, symbol: l, any: l, arrayOf: P, element: l, elementType: l, instanceOf: P, node: l, objectOf: P, oneOf: P, oneOfType: P, shape: P, exact: P, checkPropTypes: p, resetWarningCache: g }; return s.PropTypes = s, s; }, ke; } if (process.env.NODE_ENV !== "production") { var Br = dr(), Jr = !0; Fe.exports = Ur()(Br.isElement, Jr); } else Fe.exports = zr()(); var Gr = Fe.exports; const ne = /* @__PURE__ */ Fr(Gr); function Hr(n = 0.3, g = !0, p = !1) { const [l, P] = $e(!1), [s, C] = $e(), f = lr(), v = Dr( ([y], c) => { const b = y.isIntersecting || p && y.boundingClientRect.top < 0; P(b), g && b && c.unobserve(y.target); }, [g, p] ); return De(() => { if (f.current || !s) return; const y = typeof n == "number" ? { threshold: n } : n; return f.current = new IntersectionObserver(v, y), f.current.observe(s), () => { f.current && f.current.unobserve(s); }; }, [v, s, n]), [C, l, s]; } $r({}); const Kr = (n = []) => { if (!n || !Array.isArray(n) || !n.length) return null; let g = []; return n.forEach((p) => { typeof p == "string" && g.push(p); }), g.join(" "); }, Xr = (n) => { let g = 0, p, l; if (n.length === 0) return g; for (p = 0; p < n.length; p++) l = n.charCodeAt(p), g = (g << 5) - g + l, g |= 0; return g; }; const We = Mr( ({ className: n, description: g, paused: p, posterImg: l, prefersReducedMotion: P, renderReducedMotionFallback: s, src: C, loop: f = !0 }, v) => { const [y, c] = $e(!1), [b, A] = Hr(0), M = g ? `autoplay-video-desc-${Xr(g)}` : null, z = lr(), k = v || z, Y = () => { k.current && k.current.pause(); }, W = () => { !k.current || p || k.current.play(); }; return De(() => { A && c(!0); }, [A]), De(() => { y && (p ? Y() : A && !p ? W() : Y()); }, [A, y, p, P]), /* @__PURE__ */ ve.jsx("div", { ref: b, className: Kr(["autoplay-video", n]), children: P && s ? /* @__PURE__ */ ve.jsx("div", { className: "autoplay-video__media", children: s() }) : /* @__PURE__ */ ve.jsxs(ve.Fragment, { children: [ M && /* @__PURE__ */ ve.jsx("p", { id: M, className: "autoplay-video-util-visually-hidden", children: g }), /* @__PURE__ */ ve.jsx( "video", { "aria-describedby": M, autoPlay: !0, className: "autoplay-video__media", loop: f, muted: !0, playsInline: !0, poster: l, ref: k, src: y ? C : null } ) ] }) }); } ); We.defaultProps = { description: "", inViewRootMargin: "0px 0px 400px 0px", paused: !1, prefersReducedMotion: !1, loop: !0 }; We.propTypes = { className: ne.string, description: ne.string, paused: ne.bool, posterImg: ne.string, prefersReducedMotion: ne.bool.isRequired, renderReducedMotionFallback: ne.func, src: ne.string, loop: ne.bool }; We.displayName = "AutoplayVideo"; export { We as AutoplayVideo };