aboutsummaryrefslogtreecommitdiffstats
path: root/dist/plyr.polyfilled.js
diff options
context:
space:
mode:
Diffstat (limited to 'dist/plyr.polyfilled.js')
-rw-r--r--dist/plyr.polyfilled.js2333
1 files changed, 1210 insertions, 1123 deletions
diff --git a/dist/plyr.polyfilled.js b/dist/plyr.polyfilled.js
index edc31b1c..680f1ede 100644
--- a/dist/plyr.polyfilled.js
+++ b/dist/plyr.polyfilled.js
@@ -56,18 +56,27 @@ typeof navigator === "object" && (function (global, factory) {
}
})();
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
- var global$1 = typeof window == 'object' && window && window.Math == Math ? window
- : typeof self == 'object' && self && self.Math == Math ? self
- // eslint-disable-next-line no-new-func
- : Function('return this')();
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
- var hasOwnProperty = {}.hasOwnProperty;
+ function createCommonjsModule(fn, module) {
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
+ }
- var has = function (it, key) {
- return hasOwnProperty.call(it, key);
+ var O = 'object';
+ var check = function (it) {
+ return it && it.Math == Math && it;
};
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
+ var global_1 =
+ // eslint-disable-next-line no-undef
+ check(typeof globalThis == O && globalThis) ||
+ check(typeof window == O && window) ||
+ check(typeof self == O && self) ||
+ check(typeof commonjsGlobal == O && commonjsGlobal) ||
+ // eslint-disable-next-line no-new-func
+ Function('return this')();
+
var fails = function (exec) {
try {
return !!exec();
@@ -81,16 +90,14 @@ typeof navigator === "object" && (function (global, factory) {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
- var isPure = false;
-
var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
- var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// Nashorn ~ JDK8 bug
- var NASHORN_BUG = nativeGetOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
+ var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
- var descriptor = nativeGetOwnPropertyDescriptor(this, V);
+ var descriptor = getOwnPropertyDescriptor(this, V);
return !!descriptor && descriptor.enumerable;
} : nativePropertyIsEnumerable;
@@ -116,6 +123,7 @@ typeof navigator === "object" && (function (global, factory) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
+
var split = ''.split;
var indexedObject = fails(function () {
@@ -146,7 +154,6 @@ typeof navigator === "object" && (function (global, factory) {
};
// 7.1.1 ToPrimitive(input [, PreferredType])
-
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
var toPrimitive = function (it, S) {
@@ -158,7 +165,13 @@ typeof navigator === "object" && (function (global, factory) {
throw TypeError("Can't convert object to primitive value");
};
- var document$1 = global$1.document;
+ var hasOwnProperty = {}.hasOwnProperty;
+
+ var has = function (it, key) {
+ return hasOwnProperty.call(it, key);
+ };
+
+ var document$1 = global_1.document;
// typeof document.createElement is 'object' in old IE
var exist = isObject(document$1) && isObject(document$1.createElement);
@@ -173,13 +186,13 @@ typeof navigator === "object" && (function (global, factory) {
}).a != 7;
});
- var nativeGetOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
+ var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- var f$1 = descriptors ? nativeGetOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
+ var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
O = toIndexedObject(O);
P = toPrimitive(P, true);
if (ie8DomDefine) try {
- return nativeGetOwnPropertyDescriptor$1(O, P);
+ return nativeGetOwnPropertyDescriptor(O, P);
} catch (error) { /* empty */ }
if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
};
@@ -219,28 +232,24 @@ typeof navigator === "object" && (function (global, factory) {
return object;
};
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
-
- function createCommonjsModule(fn, module) {
- return module = { exports: {} }, fn(module, module.exports), module.exports;
- }
-
var setGlobal = function (key, value) {
try {
- hide(global$1, key, value);
+ hide(global_1, key, value);
} catch (error) {
- global$1[key] = value;
+ global_1[key] = value;
} return value;
};
+ var isPure = false;
+
var shared = createCommonjsModule(function (module) {
var SHARED = '__core-js_shared__';
- var store = global$1[SHARED] || setGlobal(SHARED, {});
+ var store = global_1[SHARED] || setGlobal(SHARED, {});
(module.exports = function (key, value) {
return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
- version: '3.0.1',
+ version: '3.1.3',
mode: 'global',
copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
});
@@ -248,7 +257,7 @@ typeof navigator === "object" && (function (global, factory) {
var functionToString = shared('native-function-to-string', Function.toString);
- var WeakMap$1 = global$1.WeakMap;
+ var WeakMap$1 = global_1.WeakMap;
var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(functionToString.call(WeakMap$1));
@@ -259,16 +268,15 @@ typeof navigator === "object" && (function (global, factory) {
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + postfix).toString(36));
};
- var shared$1 = shared('keys');
-
+ var keys = shared('keys');
var sharedKey = function (key) {
- return shared$1[key] || (shared$1[key] = uid(key));
+ return keys[key] || (keys[key] = uid(key));
};
var hiddenKeys = {};
- var WeakMap$2 = global$1.WeakMap;
+ var WeakMap$2 = global_1.WeakMap;
var set, get, has$1;
var enforce = function (it) {
@@ -339,7 +347,7 @@ typeof navigator === "object" && (function (global, factory) {
if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
}
- if (O === global$1) {
+ if (O === global_1) {
if (simple) O[key] = value;
else setGlobal(key, value);
return;
@@ -410,7 +418,6 @@ typeof navigator === "object" && (function (global, factory) {
var arrayIndexOf = arrayIncludes(false);
-
var objectKeysInternal = function (object, names) {
var O = toIndexedObject(object);
var i = 0;
@@ -437,6 +444,8 @@ typeof navigator === "object" && (function (global, factory) {
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
+
+
var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
@@ -453,7 +462,7 @@ typeof navigator === "object" && (function (global, factory) {
f: f$4
};
- var Reflect = global$1.Reflect;
+ var Reflect = global_1.Reflect;
// all object keys, includes non-enumerable and symbols
var ownKeys = Reflect && Reflect.ownKeys || function ownKeys(it) {
@@ -492,7 +501,7 @@ typeof navigator === "object" && (function (global, factory) {
var isForced_1 = isForced;
- var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
+ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
@@ -519,16 +528,16 @@ typeof navigator === "object" && (function (global, factory) {
var STATIC = options.stat;
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
if (GLOBAL) {
- target = global$1;
+ target = global_1;
} else if (STATIC) {
- target = global$1[TARGET] || setGlobal(TARGET, {});
+ target = global_1[TARGET] || setGlobal(TARGET, {});
} else {
- target = (global$1[TARGET] || {}).prototype;
+ target = (global_1[TARGET] || {}).prototype;
}
if (target) for (key in source) {
sourceProperty = source[key];
if (options.noTargetGet) {
- descriptor = getOwnPropertyDescriptor(target, key);
+ descriptor = getOwnPropertyDescriptor$1(target, key);
targetProperty = descriptor && descriptor.value;
} else targetProperty = target[key];
FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
@@ -546,17 +555,15 @@ typeof navigator === "object" && (function (global, factory) {
}
};
- // Chrome 38 Symbol has incorrect toString conversion
- var nativeSymbol = !fails(function () {
+ var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
+ // Chrome 38 Symbol has incorrect toString conversion
// eslint-disable-next-line no-undef
return !String(Symbol());
});
+ var Symbol$1 = global_1.Symbol;
var store$1 = shared('wks');
- var Symbol$1 = global$1.Symbol;
-
-
var wellKnownSymbol = function (name) {
return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
|| (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
@@ -564,6 +571,8 @@ typeof navigator === "object" && (function (global, factory) {
var defineProperty = objectDefineProperty.f;
+
+
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
var setToStringTag = function (it, TAG, STATIC) {
@@ -578,7 +587,7 @@ typeof navigator === "object" && (function (global, factory) {
f: f$5
};
- var path = global$1;
+ var path = global_1;
var defineProperty$1 = objectDefineProperty.f;
@@ -590,9 +599,6 @@ typeof navigator === "object" && (function (global, factory) {
};
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
-
-
-
var objectKeys = Object.keys || function keys(O) {
return objectKeysInternal(O, enumBugKeys);
};
@@ -616,6 +622,12 @@ typeof navigator === "object" && (function (global, factory) {
return classofRaw(arg) == 'Array';
};
+ // `ToObject` abstract operation
+ // https://tc39.github.io/ecma262/#sec-toobject
+ var toObject = function (argument) {
+ return Object(requireObjectCoercible(argument));
+ };
+
var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
anObject(O);
var keys = objectKeys(Properties);
@@ -626,17 +638,12 @@ typeof navigator === "object" && (function (global, factory) {
return O;
};
- var document$2 = global$1.document;
+ var document$2 = global_1.document;
var html = document$2 && document$2.documentElement;
- // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
-
-
-
-
-
var IE_PROTO = sharedKey('IE_PROTO');
+
var PROTOTYPE = 'prototype';
var Empty = function () { /* empty */ };
@@ -662,6 +669,7 @@ typeof navigator === "object" && (function (global, factory) {
return createDict();
};
+ // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var objectCreate = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
@@ -676,9 +684,8 @@ typeof navigator === "object" && (function (global, factory) {
hiddenKeys[IE_PROTO] = true;
- // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
-
var nativeGetOwnPropertyNames = objectGetOwnPropertyNames.f;
+
var toString$1 = {}.toString;
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
@@ -692,6 +699,7 @@ typeof navigator === "object" && (function (global, factory) {
}
};
+ // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var f$6 = function getOwnPropertyNames(it) {
return windowNames && toString$1.call(it) == '[object Window]'
? getWindowNames(it)
@@ -702,45 +710,15 @@ typeof navigator === "object" && (function (global, factory) {
f: f$6
};
- // ECMAScript 6 symbols shim
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
var HIDDEN = sharedKey('hidden');
-
var SYMBOL = 'Symbol';
var setInternalState = internalState.set;
var getInternalState = internalState.getterFor(SYMBOL);
- var nativeGetOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
+ var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
var nativeDefineProperty$1 = objectDefineProperty.f;
var nativeGetOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f;
- var $Symbol = global$1.Symbol;
- var JSON$1 = global$1.JSON;
+ var $Symbol = global_1.Symbol;
+ var JSON$1 = global_1.JSON;
var nativeJSONStringify = JSON$1 && JSON$1.stringify;
var PROTOTYPE$1 = 'prototype';
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
@@ -750,8 +728,7 @@ typeof navigator === "object" && (function (global, factory) {
var ObjectPrototypeSymbols = shared('op-symbols');
var WellKnownSymbolsStore = shared('wks');
var ObjectPrototype = Object[PROTOTYPE$1];
- var QObject = global$1.QObject;
-
+ var QObject = global_1.QObject;
// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
var USE_SETTER = !QObject || !QObject[PROTOTYPE$1] || !QObject[PROTOTYPE$1].findChild;
@@ -761,7 +738,7 @@ typeof navigator === "object" && (function (global, factory) {
get: function () { return nativeDefineProperty$1(this, 'a', { value: 7 }).a; }
})).a != 7;
}) ? function (it, key, D) {
- var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$2(ObjectPrototype, key);
+ var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype, key);
if (ObjectPrototypeDescriptor) delete ObjectPrototype[key];
nativeDefineProperty$1(it, key, D);
if (ObjectPrototypeDescriptor && it !== ObjectPrototype) {
@@ -826,7 +803,7 @@ typeof navigator === "object" && (function (global, factory) {
it = toIndexedObject(it);
key = toPrimitive(key, true);
if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
- var D = nativeGetOwnPropertyDescriptor$2(it, key);
+ var D = nativeGetOwnPropertyDescriptor$1(it, key);
if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
return D;
};
@@ -895,7 +872,9 @@ typeof navigator === "object" && (function (global, factory) {
};
}
- _export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, { Symbol: $Symbol });
+ _export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, {
+ Symbol: $Symbol
+ });
for (var wellKnownSymbols = objectKeys(WellKnownSymbolsStore), k = 0; wellKnownSymbols.length > k;) {
defineWellKnownSymbol(wellKnownSymbols[k++]);
@@ -943,6 +922,14 @@ typeof navigator === "object" && (function (global, factory) {
getOwnPropertySymbols: $getOwnPropertySymbols
});
+ // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3443
+ _export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwnPropertySymbols.f(1); }) }, {
+ getOwnPropertySymbols: function getOwnPropertySymbols(it) {
+ return objectGetOwnPropertySymbols.f(toObject(it));
+ }
+ });
+
// `JSON.stringify` method behavior with symbols
// https://tc39.github.io/ecma262/#sec-json.stringify
JSON$1 && _export({ target: 'JSON', stat: true, forced: !nativeSymbol || fails(function () {
@@ -981,7 +968,8 @@ typeof navigator === "object" && (function (global, factory) {
var defineProperty$2 = objectDefineProperty.f;
- var NativeSymbol = global$1.Symbol;
+
+ var NativeSymbol = global_1.Symbol;
if (descriptors && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
// Safari 12 bug
@@ -1016,7 +1004,9 @@ typeof navigator === "object" && (function (global, factory) {
}
});
- _export({ global: true, forced: true }, { Symbol: SymbolWrapper });
+ _export({ global: true, forced: true }, {
+ Symbol: SymbolWrapper
+ });
}
// `Symbol.iterator` well-known symbol
@@ -1024,8 +1014,6 @@ typeof navigator === "object" && (function (global, factory) {
defineWellKnownSymbol('iterator');
var UNSCOPABLES = wellKnownSymbol('unscopables');
-
-
var ArrayPrototype = Array.prototype;
// Array.prototype[@@unscopables]
@@ -1041,25 +1029,16 @@ typeof navigator === "object" && (function (global, factory) {
var iterators = {};
- // `ToObject` abstract operation
- // https://tc39.github.io/ecma262/#sec-toobject
- var toObject = function (argument) {
- return Object(requireObjectCoercible(argument));
- };
-
var correctPrototypeGetter = !fails(function () {
function F() { /* empty */ }
F.prototype.constructor = null;
return Object.getPrototypeOf(new F()) !== F.prototype;
});
- // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
-
-
var IE_PROTO$1 = sharedKey('IE_PROTO');
-
var ObjectPrototype$1 = Object.prototype;
+ // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
O = toObject(O);
if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];
@@ -1122,8 +1101,6 @@ typeof navigator === "object" && (function (global, factory) {
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
-
-
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
var correctSetter = false;
var test = {};
@@ -1141,11 +1118,9 @@ typeof navigator === "object" && (function (global, factory) {
};
}() : undefined);
- var ITERATOR$1 = wellKnownSymbol('iterator');
-
-
var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
+ var ITERATOR$1 = wellKnownSymbol('iterator');
var KEYS = 'keys';
var VALUES = 'values';
var ENTRIES = 'entries';
@@ -1401,6 +1376,7 @@ typeof navigator === "object" && (function (global, factory) {
var TO_STRING = 'toString';
var nativeToString = /./[TO_STRING];
+ var RegExpPrototype = RegExp.prototype;
var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
// FF44- RegExp#toString has a wrong name
@@ -1411,8 +1387,10 @@ typeof navigator === "object" && (function (global, factory) {
if (NOT_GENERIC || INCORRECT_NAME) {
redefine(RegExp.prototype, TO_STRING, function toString() {
var R = anObject(this);
- return '/'.concat(R.source, '/',
- 'flags' in R ? R.flags : !descriptors && R instanceof RegExp ? regexpFlags.call(R) : undefined);
+ var p = String(R.source);
+ var rf = R.flags;
+ var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
+ return '/' + p + '/' + f;
}, { unsafe: true });
}
@@ -1456,12 +1434,6 @@ typeof navigator === "object" && (function (global, factory) {
return { value: point, done: false };
});
- // `AdvanceStringIndex` abstract operation
- // https://tc39.github.io/ecma262/#sec-advancestringindex
- var advanceStringIndex = function (S, index, unicode) {
- return index + (unicode ? stringAt(S, index, true).length : 1);
- };
-
var nativeExec = RegExp.prototype.exec;
// This always refers to the native implementation, because the
// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
@@ -1514,25 +1486,6 @@ typeof navigator === "object" && (function (global, factory) {
var regexpExec = patchedExec;
- // `RegExpExec` abstract operation
- // https://tc39.github.io/ecma262/#sec-regexpexec
- var regexpExecAbstract = function (R, S) {
- var exec = R.exec;
- if (typeof exec === 'function') {
- var result = exec.call(R, S);
- if (typeof result !== 'object') {
- throw TypeError('RegExp exec method returned something other than an Object or null');
- }
- return result;
- }
-
- if (classofRaw(R) !== 'RegExp') {
- throw TypeError('RegExp#exec called on incompatible receiver');
- }
-
- return regexpExec.call(R, S);
- };
-
var SPECIES$2 = wellKnownSymbol('species');
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
@@ -1620,126 +1573,147 @@ typeof navigator === "object" && (function (global, factory) {
}
};
+ // `AdvanceStringIndex` abstract operation
+ // https://tc39.github.io/ecma262/#sec-advancestringindex
+ var advanceStringIndex = function (S, index, unicode) {
+ return index + (unicode ? stringAt(S, index, true).length : 1);
+ };
+
+ // `RegExpExec` abstract operation
+ // https://tc39.github.io/ecma262/#sec-regexpexec
+ var regexpExecAbstract = function (R, S) {
+ var exec = R.exec;
+ if (typeof exec === 'function') {
+ var result = exec.call(R, S);
+ if (typeof result !== 'object') {
+ throw TypeError('RegExp exec method returned something other than an Object or null');
+ }
+ return result;
+ }
+
+ if (classofRaw(R) !== 'RegExp') {
+ throw TypeError('RegExp#exec called on incompatible receiver');
+ }
+
+ return regexpExec.call(R, S);
+ };
+
var max$2 = Math.max;
var min$2 = Math.min;
var floor$1 = Math.floor;
- var SUBSTITUTION_SYMBOLS = /\$([$&`']|\d\d?|<[^>]*>)/g;
- var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&`']|\d\d?)/g;
+ var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
+ var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
var maybeToString = function (it) {
return it === undefined ? it : String(it);
};
// @@replace logic
- fixRegexpWellKnownSymbolLogic(
- 'replace',
- 2,
- function (REPLACE, nativeReplace, maybeCallNative) {
- return [
- // `String.prototype.replace` method
- // https://tc39.github.io/ecma262/#sec-string.prototype.replace
- function replace(searchValue, replaceValue) {
- var O = requireObjectCoercible(this);
- var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
- return replacer !== undefined
- ? replacer.call(searchValue, O, replaceValue)
- : nativeReplace.call(String(O), searchValue, replaceValue);
- },
- // `RegExp.prototype[@@replace]` method
- // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
- function (regexp, replaceValue) {
- var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
- if (res.done) return res.value;
-
- var rx = anObject(regexp);
- var S = String(this);
-
- var functionalReplace = typeof replaceValue === 'function';
- if (!functionalReplace) replaceValue = String(replaceValue);
-
- var global = rx.global;
- if (global) {
- var fullUnicode = rx.unicode;
- rx.lastIndex = 0;
- }
- var results = [];
- while (true) {
- var result = regexpExecAbstract(rx, S);
- if (result === null) break;
+ fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative) {
+ return [
+ // `String.prototype.replace` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.replace
+ function replace(searchValue, replaceValue) {
+ var O = requireObjectCoercible(this);
+ var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
+ return replacer !== undefined
+ ? replacer.call(searchValue, O, replaceValue)
+ : nativeReplace.call(String(O), searchValue, replaceValue);
+ },
+ // `RegExp.prototype[@@replace]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
+ function (regexp, replaceValue) {
+ var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
+ if (res.done) return res.value;
- results.push(result);
- if (!global) break;
+ var rx = anObject(regexp);
+ var S = String(this);
- var matchStr = String(result[0]);
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
- }
+ var functionalReplace = typeof replaceValue === 'function';
+ if (!functionalReplace) replaceValue = String(replaceValue);
- var accumulatedResult = '';
- var nextSourcePosition = 0;
- for (var i = 0; i < results.length; i++) {
- result = results[i];
-
- var matched = String(result[0]);
- var position = max$2(min$2(toInteger(result.index), S.length), 0);
- var captures = [];
- // NOTE: This is equivalent to
- // captures = result.slice(1).map(maybeToString)
- // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
- // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
- // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
- for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
- var namedCaptures = result.groups;
- if (functionalReplace) {
- var replacerArgs = [matched].concat(captures, position, S);
- if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
- var replacement = String(replaceValue.apply(undefined, replacerArgs));
- } else {
- replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
- }
- if (position >= nextSourcePosition) {
- accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
- nextSourcePosition = position + matched.length;
- }
+ var global = rx.global;
+ if (global) {
+ var fullUnicode = rx.unicode;
+ rx.lastIndex = 0;
+ }
+ var results = [];
+ while (true) {
+ var result = regexpExecAbstract(rx, S);
+ if (result === null) break;
+
+ results.push(result);
+ if (!global) break;
+
+ var matchStr = String(result[0]);
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
+ }
+
+ var accumulatedResult = '';
+ var nextSourcePosition = 0;
+ for (var i = 0; i < results.length; i++) {
+ result = results[i];
+
+ var matched = String(result[0]);
+ var position = max$2(min$2(toInteger(result.index), S.length), 0);
+ var captures = [];
+ // NOTE: This is equivalent to
+ // captures = result.slice(1).map(maybeToString)
+ // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
+ // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
+ // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
+ for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
+ var namedCaptures = result.groups;
+ if (functionalReplace) {
+ var replacerArgs = [matched].concat(captures, position, S);
+ if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
+ var replacement = String(replaceValue.apply(undefined, replacerArgs));
+ } else {
+ replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
}
- return accumulatedResult + S.slice(nextSourcePosition);
- }
- ];
-
- // https://tc39.github.io/ecma262/#sec-getsubstitution
- function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
- var tailPos = position + matched.length;
- var m = captures.length;
- var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
- if (namedCaptures !== undefined) {
- namedCaptures = toObject(namedCaptures);
- symbols = SUBSTITUTION_SYMBOLS;
- }
- return nativeReplace.call(replacement, symbols, function (match, ch) {
- var capture;
- switch (ch.charAt(0)) {
- case '$': return '$';
- case '&': return matched;
- case '`': return str.slice(0, position);
- case "'": return str.slice(tailPos);
- case '<':
- capture = namedCaptures[ch.slice(1, -1)];
- break;
- default: // \d\d?
- var n = +ch;
- if (n === 0) return match;
- if (n > m) {
- var f = floor$1(n / 10);
- if (f === 0) return match;
- if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
- return match;
- }
- capture = captures[n - 1];
+ if (position >= nextSourcePosition) {
+ accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
+ nextSourcePosition = position + matched.length;
}
- return capture === undefined ? '' : capture;
- });
- }
+ }
+ return accumulatedResult + S.slice(nextSourcePosition);
+ }
+ ];
+
+ // https://tc39.github.io/ecma262/#sec-getsubstitution
+ function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
+ var tailPos = position + matched.length;
+ var m = captures.length;
+ var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
+ if (namedCaptures !== undefined) {
+ namedCaptures = toObject(namedCaptures);
+ symbols = SUBSTITUTION_SYMBOLS;
+ }
+ return nativeReplace.call(replacement, symbols, function (match, ch) {
+ var capture;
+ switch (ch.charAt(0)) {
+ case '$': return '$';
+ case '&': return matched;
+ case '`': return str.slice(0, position);
+ case "'": return str.slice(tailPos);
+ case '<':
+ capture = namedCaptures[ch.slice(1, -1)];
+ break;
+ default: // \d\d?
+ var n = +ch;
+ if (n === 0) return match;
+ if (n > m) {
+ var f = floor$1(n / 10);
+ if (f === 0) return match;
+ if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
+ return match;
+ }
+ capture = captures[n - 1];
+ }
+ return capture === undefined ? '' : capture;
+ });
}
- );
+ });
// `SameValue` abstract operation
// https://tc39.github.io/ecma262/#sec-samevalue
@@ -1749,36 +1723,32 @@ typeof navigator === "object" && (function (global, factory) {
};
// @@search logic
- fixRegexpWellKnownSymbolLogic(
- 'search',
- 1,
- function (SEARCH, nativeSearch, maybeCallNative) {
- return [
- // `String.prototype.search` method
- // https://tc39.github.io/ecma262/#sec-string.prototype.search
- function search(regexp) {
- var O = requireObjectCoercible(this);
- var searcher = regexp == undefined ? undefined : regexp[SEARCH];
- return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
- },
- // `RegExp.prototype[@@search]` method
- // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
- function (regexp) {
- var res = maybeCallNative(nativeSearch, regexp, this);
- if (res.done) return res.value;
-
- var rx = anObject(regexp);
- var S = String(this);
-
- var previousLastIndex = rx.lastIndex;
- if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
- var result = regexpExecAbstract(rx, S);
- if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
- return result === null ? -1 : result.index;
- }
- ];
- }
- );
+ fixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {
+ return [
+ // `String.prototype.search` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.search
+ function search(regexp) {
+ var O = requireObjectCoercible(this);
+ var searcher = regexp == undefined ? undefined : regexp[SEARCH];
+ return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
+ },
+ // `RegExp.prototype[@@search]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
+ function (regexp) {
+ var res = maybeCallNative(nativeSearch, regexp, this);
+ if (res.done) return res.value;
+
+ var rx = anObject(regexp);
+ var S = String(this);
+
+ var previousLastIndex = rx.lastIndex;
+ if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
+ var result = regexpExecAbstract(rx, S);
+ if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
+ return result === null ? -1 : result.index;
+ }
+ ];
+ });
var MATCH = wellKnownSymbol('match');
@@ -1813,125 +1783,120 @@ typeof navigator === "object" && (function (global, factory) {
var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
// @@split logic
- fixRegexpWellKnownSymbolLogic(
- 'split',
- 2,
- function (SPLIT, nativeSplit, maybeCallNative) {
- var internalSplit;
- if (
- 'abbc'.split(/(b)*/)[1] == 'c' ||
- 'test'.split(/(?:)/, -1).length != 4 ||
- 'ab'.split(/(?:ab)*/).length != 2 ||
- '.'.split(/(.?)(.?)/).length != 4 ||
- '.'.split(/()()/).length > 1 ||
- ''.split(/.?/).length
- ) {
- // based on es5-shim implementation, need to rework it
- internalSplit = function (separator, limit) {
- var string = String(requireObjectCoercible(this));
- var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
- if (lim === 0) return [];
- if (separator === undefined) return [string];
- // If `separator` is not a regex, use native split
- if (!isRegexp(separator)) {
- return nativeSplit.call(string, separator, lim);
- }
- var output = [];
- var flags = (separator.ignoreCase ? 'i' : '') +
- (separator.multiline ? 'm' : '') +
- (separator.unicode ? 'u' : '') +
- (separator.sticky ? 'y' : '');
- var lastLastIndex = 0;
- // Make `global` and avoid `lastIndex` issues by working with a copy
- var separatorCopy = new RegExp(separator.source, flags + 'g');
- var match, lastIndex, lastLength;
- while (match = regexpExec.call(separatorCopy, string)) {
- lastIndex = separatorCopy.lastIndex;
- if (lastIndex > lastLastIndex) {
- output.push(string.slice(lastLastIndex, match.index));
- if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
- lastLength = match[0].length;
- lastLastIndex = lastIndex;
- if (output.length >= lim) break;
- }
- if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
+ fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
+ var internalSplit;
+ if (
+ 'abbc'.split(/(b)*/)[1] == 'c' ||
+ 'test'.split(/(?:)/, -1).length != 4 ||
+ 'ab'.split(/(?:ab)*/).length != 2 ||
+ '.'.split(/(.?)(.?)/).length != 4 ||
+ '.'.split(/()()/).length > 1 ||
+ ''.split(/.?/).length
+ ) {
+ // based on es5-shim implementation, need to rework it
+ internalSplit = function (separator, limit) {
+ var string = String(requireObjectCoercible(this));
+ var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
+ if (lim === 0) return [];
+ if (separator === undefined) return [string];
+ // If `separator` is not a regex, use native split
+ if (!isRegexp(separator)) {
+ return nativeSplit.call(string, separator, lim);
+ }
+ var output = [];
+ var flags = (separator.ignoreCase ? 'i' : '') +
+ (separator.multiline ? 'm' : '') +
+ (separator.unicode ? 'u' : '') +
+ (separator.sticky ? 'y' : '');
+ var lastLastIndex = 0;
+ // Make `global` and avoid `lastIndex` issues by working with a copy
+ var separatorCopy = new RegExp(separator.source, flags + 'g');
+ var match, lastIndex, lastLength;
+ while (match = regexpExec.call(separatorCopy, string)) {
+ lastIndex = separatorCopy.lastIndex;
+ if (lastIndex > lastLastIndex) {
+ output.push(string.slice(lastLastIndex, match.index));
+ if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
+ lastLength = match[0].length;
+ lastLastIndex = lastIndex;
+ if (output.length >= lim) break;
}
- if (lastLastIndex === string.length) {
- if (lastLength || !separatorCopy.test('')) output.push('');
- } else output.push(string.slice(lastLastIndex));
- return output.length > lim ? output.slice(0, lim) : output;
- };
- // Chakra, V8
- } else if ('0'.split(undefined, 0).length) {
- internalSplit = function (separator, limit) {
- return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
- };
- } else internalSplit = nativeSplit;
-
- return [
- // `String.prototype.split` method
- // https://tc39.github.io/ecma262/#sec-string.prototype.split
- function split(separator, limit) {
- var O = requireObjectCoercible(this);
- var splitter = separator == undefined ? undefined : separator[SPLIT];
- return splitter !== undefined
- ? splitter.call(separator, O, limit)
- : internalSplit.call(String(O), separator, limit);
- },
- // `RegExp.prototype[@@split]` method
- // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
- //
- // NOTE: This cannot be properly polyfilled in engines that don't support
- // the 'y' flag.
- function (regexp, limit) {
- var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
- if (res.done) return res.value;
-
- var rx = anObject(regexp);
- var S = String(this);
- var C = speciesConstructor(rx, RegExp);
-
- var unicodeMatching = rx.unicode;
- var flags = (rx.ignoreCase ? 'i' : '') +
- (rx.multiline ? 'm' : '') +
- (rx.unicode ? 'u' : '') +
- (SUPPORTS_Y ? 'y' : 'g');
-
- // ^(? + rx + ) is needed, in combination with some S slicing, to
- // simulate the 'y' flag.
- var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
- var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
- if (lim === 0) return [];
- if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
- var p = 0;
- var q = 0;
- var A = [];
- while (q < S.length) {
- splitter.lastIndex = SUPPORTS_Y ? q : 0;
- var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
- var e;
- if (
- z === null ||
- (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
- ) {
- q = advanceStringIndex(S, q, unicodeMatching);
- } else {
- A.push(S.slice(p, q));
+ if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
+ }
+ if (lastLastIndex === string.length) {
+ if (lastLength || !separatorCopy.test('')) output.push('');
+ } else output.push(string.slice(lastLastIndex));
+ return output.length > lim ? output.slice(0, lim) : output;
+ };
+ // Chakra, V8
+ } else if ('0'.split(undefined, 0).length) {
+ internalSplit = function (separator, limit) {
+ return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
+ };
+ } else internalSplit = nativeSplit;
+
+ return [
+ // `String.prototype.split` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.split
+ function split(separator, limit) {
+ var O = requireObjectCoercible(this);
+ var splitter = separator == undefined ? undefined : separator[SPLIT];
+ return splitter !== undefined
+ ? splitter.call(separator, O, limit)
+ : internalSplit.call(String(O), separator, limit);
+ },
+ // `RegExp.prototype[@@split]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
+ //
+ // NOTE: This cannot be properly polyfilled in engines that don't support
+ // the 'y' flag.
+ function (regexp, limit) {
+ var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
+ if (res.done) return res.value;
+
+ var rx = anObject(regexp);
+ var S = String(this);
+ var C = speciesConstructor(rx, RegExp);
+
+ var unicodeMatching = rx.unicode;
+ var flags = (rx.ignoreCase ? 'i' : '') +
+ (rx.multiline ? 'm' : '') +
+ (rx.unicode ? 'u' : '') +
+ (SUPPORTS_Y ? 'y' : 'g');
+
+ // ^(? + rx + ) is needed, in combination with some S slicing, to
+ // simulate the 'y' flag.
+ var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
+ var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
+ if (lim === 0) return [];
+ if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
+ var p = 0;
+ var q = 0;
+ var A = [];
+ while (q < S.length) {
+ splitter.lastIndex = SUPPORTS_Y ? q : 0;
+ var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
+ var e;
+ if (
+ z === null ||
+ (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
+ ) {
+ q = advanceStringIndex(S, q, unicodeMatching);
+ } else {
+ A.push(S.slice(p, q));
+ if (A.length === lim) return A;
+ for (var i = 1; i <= z.length - 1; i++) {
+ A.push(z[i]);
if (A.length === lim) return A;
- for (var i = 1; i <= z.length - 1; i++) {
- A.push(z[i]);
- if (A.length === lim) return A;
- }
- q = p = e;
}
+ q = p = e;
}
- A.push(S.slice(p));
- return A;
}
- ];
- },
- !SUPPORTS_Y
- );
+ A.push(S.slice(p));
+ return A;
+ }
+ ];
+ }, !SUPPORTS_Y);
// iterable DOM collections
// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
@@ -2057,19 +2022,17 @@ typeof navigator === "object" && (function (global, factory) {
};
};
- var nativeForEach = [].forEach;
var internalForEach = arrayMethods(0);
-
var SLOPPY_METHOD$1 = sloppyArrayMethod('forEach');
// `Array.prototype.forEach` method implementation
// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
var arrayForEach = SLOPPY_METHOD$1 ? function forEach(callbackfn /* , thisArg */) {
return internalForEach(this, callbackfn, arguments[1]);
- } : nativeForEach;
+ } : [].forEach;
for (var COLLECTION_NAME in domIterables) {
- var Collection = global$1[COLLECTION_NAME];
+ var Collection = global_1[COLLECTION_NAME];
var CollectionPrototype = Collection && Collection.prototype;
// some Chrome versions have non-configurable methods on DOMTokenList
if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
@@ -2084,7 +2047,7 @@ typeof navigator === "object" && (function (global, factory) {
var ArrayValues = es_array_iterator.values;
for (var COLLECTION_NAME$1 in domIterables) {
- var Collection$1 = global$1[COLLECTION_NAME$1];
+ var Collection$1 = global_1[COLLECTION_NAME$1];
var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;
if (CollectionPrototype$1) {
// some Chrome versions have non-configurable methods on DOMTokenList
@@ -2131,14 +2094,9 @@ typeof navigator === "object" && (function (global, factory) {
} return it;
};
- // 19.1.2.1 Object.assign(target, source, ...)
-
-
-
-
-
var nativeAssign = Object.assign;
+ // 19.1.2.1 Object.assign(target, source, ...)
// should work with symbols and should have deterministic property order (V8 bug)
var objectAssign = !nativeAssign || fails(function () {
var A = {};
@@ -2161,7 +2119,10 @@ typeof navigator === "object" && (function (global, factory) {
var length = keys.length;
var j = 0;
var key;
- while (length > j) if (propertyIsEnumerable.call(S, key = keys[j++])) T[key] = S[key];
+ while (length > j) {
+ key = keys[j++];
+ if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
+ }
} return T;
} : nativeAssign;
@@ -2177,18 +2138,16 @@ typeof navigator === "object" && (function (global, factory) {
}
};
- // check on default Array iterator
-
var ITERATOR$4 = wellKnownSymbol('iterator');
var ArrayPrototype$1 = Array.prototype;
+ // check on default Array iterator
var isArrayIteratorMethod = function (it) {
return it !== undefined && (iterators.Array === it || ArrayPrototype$1[ITERATOR$4] === it);
};
var ITERATOR$5 = wellKnownSymbol('iterator');
-
var getIteratorMethod = function (it) {
if (it != undefined) return it[ITERATOR$5]
|| it['@@iterator']
@@ -2239,7 +2198,7 @@ typeof navigator === "object" && (function (global, factory) {
var initialN = 128; // 0x80
var delimiter = '-'; // '\x2D'
var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars
- var regexSeparators = /[\u002E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
+ var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';
var baseMinusTMin = base - tMin;
var floor$2 = Math.floor;
@@ -2435,10 +2394,14 @@ typeof navigator === "object" && (function (global, factory) {
var deserialize = function (it) {
var result = it.replace(plus, ' ');
var bytes = 4;
- while (bytes) {
- result = result.replace(percentSequence(bytes--), percentDecode);
+ try {
+ return decodeURIComponent(result);
+ } catch (error) {
+ while (bytes) {
+ result = result.replace(percentSequence(bytes--), percentDecode);
+ }
+ return result;
}
- return result;
};
var find = /[!'()~]|%20/g;
@@ -2691,19 +2654,9 @@ typeof navigator === "object" && (function (global, factory) {
getState: getInternalParamsState
};
- var NativeURL = global$1.URL;
-
-
-
-
-
-
-
-
-
+ var NativeURL = global_1.URL;
var URLSearchParams$1 = web_urlSearchParams.URLSearchParams;
var getInternalSearchParamsState = web_urlSearchParams.getState;
-
var setInternalState$4 = internalState.set;
var getInternalURLState = internalState.getterFor('URL');
var pow = Math.pow;
@@ -2713,21 +2666,21 @@ typeof navigator === "object" && (function (global, factory) {
var INVALID_HOST = 'Invalid host';
var INVALID_PORT = 'Invalid port';
- var ALPHA = /[a-zA-Z]/;
- var ALPHANUMERIC = /[a-zA-Z0-9+\-.]/;
+ var ALPHA = /[A-Za-z]/;
+ var ALPHANUMERIC = /[\d+\-.A-Za-z]/;
var DIGIT = /\d/;
var HEX_START = /^(0x|0X)/;
var OCT = /^[0-7]+$/;
var DEC = /^\d+$/;
- var HEX = /^[0-9A-Fa-f]+$/;
+ var HEX = /^[\dA-Fa-f]+$/;
// eslint-disable-next-line no-control-regex
- var FORBIDDEN_HOST_CODE_POINT = /\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/;
+ var FORBIDDEN_HOST_CODE_POINT = /[\u0000\u0009\u000A\u000D #%/:?@[\\]]/;
// eslint-disable-next-line no-control-regex
- var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/;
+ var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\u0000\u0009\u000A\u000D #/:?@[\\]]/;
// eslint-disable-next-line no-control-regex
- var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g;
+ var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g;
// eslint-disable-next-line no-control-regex
- var TAB_AND_NEW_LINE = /\u0009|\u000A|\u000D/g;
+ var TAB_AND_NEW_LINE = /[\u0009\u000A\u000D]/g;
var EOF;
var parseHost = function (url, input) {
@@ -4314,7 +4267,6 @@ typeof navigator === "object" && (function (global, factory) {
});
var internalFilter = arrayMethods(2);
-
var SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('filter');
// `Array.prototype.filter` method
@@ -4402,7 +4354,6 @@ typeof navigator === "object" && (function (global, factory) {
addToUnscopables('includes');
var internalMap = arrayMethods(1);
-
var SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('map');
// `Array.prototype.map` method
@@ -4441,11 +4392,12 @@ typeof navigator === "object" && (function (global, factory) {
};
var getOwnPropertyNames = objectGetOwnPropertyNames.f;
- var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
+ var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
var defineProperty$3 = objectDefineProperty.f;
+
var NUMBER = 'Number';
- var NativeNumber = global$1[NUMBER];
+ var NativeNumber = global_1[NUMBER];
var NumberPrototype = NativeNumber.prototype;
// Opera ~12 has broken Object#toString
@@ -4492,20 +4444,20 @@ typeof navigator === "object" && (function (global, factory) {
&& (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(that); }) : classofRaw(that) != NUMBER)
? inheritIfRequired(new NativeNumber(toNumber(it)), that, NumberWrapper) : toNumber(it);
};
- for (var keys = descriptors ? getOwnPropertyNames(NativeNumber) : (
+ for (var keys$1 = descriptors ? getOwnPropertyNames(NativeNumber) : (
// ES3:
'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
// ES2015 (in case, if modules with ES2015 Number statics required before):
'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
- ).split(','), j = 0, key; keys.length > j; j++) {
- if (has(NativeNumber, key = keys[j]) && !has(NumberWrapper, key)) {
- defineProperty$3(NumberWrapper, key, getOwnPropertyDescriptor$1(NativeNumber, key));
+ ).split(','), j = 0, key; keys$1.length > j; j++) {
+ if (has(NativeNumber, key = keys$1[j]) && !has(NumberWrapper, key)) {
+ defineProperty$3(NumberWrapper, key, getOwnPropertyDescriptor$2(NativeNumber, key));
}
}
NumberWrapper.prototype = NumberPrototype;
NumberPrototype.constructor = NumberWrapper;
- redefine(global$1, NUMBER, NumberWrapper);
+ redefine(global_1, NUMBER, NumberWrapper);
}
var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
@@ -4542,15 +4494,11 @@ typeof navigator === "object" && (function (global, factory) {
} return false;
};
- var INCLUDES = 'includes';
-
- var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic(INCLUDES);
-
// `String.prototype.includes` method
// https://tc39.github.io/ecma262/#sec-string.prototype.includes
- _export({ target: 'String', proto: true, forced: !CORRECT_IS_REGEXP_LOGIC }, {
+ _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
includes: function includes(searchString /* , position = 0 */) {
- return !!~validateStringMethodArguments(this, searchString, INCLUDES)
+ return !!~validateStringMethodArguments(this, searchString, 'includes')
.indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
}
});
@@ -4560,11 +4508,11 @@ typeof navigator === "object" && (function (global, factory) {
});
var internalMetadata = createCommonjsModule(function (module) {
- var METADATA = uid('meta');
+ var defineProperty = objectDefineProperty.f;
- var defineProperty = objectDefineProperty.f;
+ var METADATA = uid('meta');
var id = 0;
var isExtensible = Object.isExtensible || function () {
@@ -4654,6 +4602,90 @@ typeof navigator === "object" && (function (global, factory) {
exports.BREAK = BREAK;
});
+ var collection = function (CONSTRUCTOR_NAME, wrapper, common, IS_MAP, IS_WEAK) {
+ var NativeConstructor = global_1[CONSTRUCTOR_NAME];
+ var NativePrototype = NativeConstructor && NativeConstructor.prototype;
+ var Constructor = NativeConstructor;
+ var ADDER = IS_MAP ? 'set' : 'add';
+ var exported = {};
+
+ var fixMethod = function (KEY) {
+ var nativeMethod = NativePrototype[KEY];
+ redefine(NativePrototype, KEY,
+ KEY == 'add' ? function add(a) {
+ nativeMethod.call(this, a === 0 ? 0 : a);
+ return this;
+ } : KEY == 'delete' ? function (a) {
+ return IS_WEAK && !isObject(a) ? false : nativeMethod.call(this, a === 0 ? 0 : a);
+ } : KEY == 'get' ? function get(a) {
+ return IS_WEAK && !isObject(a) ? undefined : nativeMethod.call(this, a === 0 ? 0 : a);
+ } : KEY == 'has' ? function has(a) {
+ return IS_WEAK && !isObject(a) ? false : nativeMethod.call(this, a === 0 ? 0 : a);
+ } : function set(a, b) {
+ nativeMethod.call(this, a === 0 ? 0 : a, b);
+ return this;
+ }
+ );
+ };
+
+ // eslint-disable-next-line max-len
+ if (isForced_1(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
+ new NativeConstructor().entries().next();
+ })))) {
+ // create collection constructor
+ Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
+ internalMetadata.REQUIRED = true;
+ } else if (isForced_1(CONSTRUCTOR_NAME, true)) {
+ var instance = new Constructor();
+ // early implementations not supports chaining
+ var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
+ // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
+ var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });
+ // most early implementations doesn't supports iterables, most modern - not close it correctly
+ // eslint-disable-next-line no-new
+ var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); });
+ // for early implementations -0 and +0 not the same
+ var BUGGY_ZERO = !IS_WEAK && fails(function () {
+ // V8 ~ Chromium 42- fails only with 5+ elements
+ var $instance = new NativeConstructor();
+ var index = 5;
+ while (index--) $instance[ADDER](index, index);
+ return !$instance.has(-0);
+ });
+
+ if (!ACCEPT_ITERABLES) {
+ Constructor = wrapper(function (target, iterable) {
+ anInstance(target, Constructor, CONSTRUCTOR_NAME);
+ var that = inheritIfRequired(new NativeConstructor(), target, Constructor);
+ if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP);
+ return that;
+ });
+ Constructor.prototype = NativePrototype;
+ NativePrototype.constructor = Constructor;
+ }
+
+ if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
+ fixMethod('delete');
+ fixMethod('has');
+ IS_MAP && fixMethod('get');
+ }
+
+ if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
+
+ // weak collections should not contains .clear method
+ if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear;
+ }
+
+ exported[CONSTRUCTOR_NAME] = Constructor;
+ _export({ global: true, forced: Constructor != NativeConstructor }, exported);
+
+ setToStringTag(Constructor, CONSTRUCTOR_NAME);
+
+ if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
+
+ return Constructor;
+ };
+
var getWeakData = internalMetadata.getWeakData;
@@ -4662,6 +4694,7 @@ typeof navigator === "object" && (function (global, factory) {
+
var setInternalState$5 = internalState.set;
var internalStateGetterFor = internalState.getterFor;
var arrayFind = arrayMethods(5);
@@ -4773,99 +4806,17 @@ typeof navigator === "object" && (function (global, factory) {
}
};
- var collection = function (CONSTRUCTOR_NAME, wrapper, common, IS_MAP, IS_WEAK) {
- var NativeConstructor = global$1[CONSTRUCTOR_NAME];
- var NativePrototype = NativeConstructor && NativeConstructor.prototype;
- var Constructor = NativeConstructor;
- var ADDER = IS_MAP ? 'set' : 'add';
- var exported = {};
-
- var fixMethod = function (KEY) {
- var nativeMethod = NativePrototype[KEY];
- redefine(NativePrototype, KEY,
- KEY == 'add' ? function add(a) {
- nativeMethod.call(this, a === 0 ? 0 : a);
- return this;
- } : KEY == 'delete' ? function (a) {
- return IS_WEAK && !isObject(a) ? false : nativeMethod.call(this, a === 0 ? 0 : a);
- } : KEY == 'get' ? function get(a) {
- return IS_WEAK && !isObject(a) ? undefined : nativeMethod.call(this, a === 0 ? 0 : a);
- } : KEY == 'has' ? function has(a) {
- return IS_WEAK && !isObject(a) ? false : nativeMethod.call(this, a === 0 ? 0 : a);
- } : function set(a, b) {
- nativeMethod.call(this, a === 0 ? 0 : a, b);
- return this;
- }
- );
- };
-
- // eslint-disable-next-line max-len
- if (isForced_1(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
- new NativeConstructor().entries().next();
- })))) {
- // create collection constructor
- Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
- internalMetadata.REQUIRED = true;
- } else if (isForced_1(CONSTRUCTOR_NAME, true)) {
- var instance = new Constructor();
- // early implementations not supports chaining
- var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
- // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
- var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });
- // most early implementations doesn't supports iterables, most modern - not close it correctly
- // eslint-disable-next-line no-new
- var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); });
- // for early implementations -0 and +0 not the same
- var BUGGY_ZERO = !IS_WEAK && fails(function () {
- // V8 ~ Chromium 42- fails only with 5+ elements
- var $instance = new NativeConstructor();
- var index = 5;
- while (index--) $instance[ADDER](index, index);
- return !$instance.has(-0);
- });
-
- if (!ACCEPT_ITERABLES) {
- Constructor = wrapper(function (target, iterable) {
- anInstance(target, Constructor, CONSTRUCTOR_NAME);
- var that = inheritIfRequired(new NativeConstructor(), target, Constructor);
- if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP);
- return that;
- });
- Constructor.prototype = NativePrototype;
- NativePrototype.constructor = Constructor;
- }
-
- if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
- fixMethod('delete');
- fixMethod('has');
- IS_MAP && fixMethod('get');
- }
-
- if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
-
- // weak collections should not contains .clear method
- if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear;
- }
-
- exported[CONSTRUCTOR_NAME] = Constructor;
- _export({ global: true, forced: Constructor != NativeConstructor }, exported);
-
- setToStringTag(Constructor, CONSTRUCTOR_NAME);
-
- if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
-
- return Constructor;
- };
-
var es_weakMap = createCommonjsModule(function (module) {
+
var enforceIternalState = internalState.enforce;
- var IS_IE11 = !global$1.ActiveXObject && 'ActiveXObject' in global$1;
+
+ var IS_IE11 = !global_1.ActiveXObject && 'ActiveXObject' in global_1;
var isExtensible = Object.isExtensible;
var InternalWeakMap;
@@ -4926,7 +4877,9 @@ typeof navigator === "object" && (function (global, factory) {
// `Object.assign` method
// https://tc39.github.io/ecma262/#sec-object.assign
- _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, { assign: objectAssign });
+ _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
+ assign: objectAssign
+ });
var non = '\u200B\u0085\u180E';
@@ -5020,9 +4973,7 @@ typeof navigator === "object" && (function (global, factory) {
} return n;
};
- // `Number.prototype.toFixed` method
- // https://tc39.github.io/ecma262/#sec-number.prototype.tofixed
- _export({ target: 'Number', proto: true, forced: nativeToFixed && (
+ var FORCED$2 = nativeToFixed && (
0.00008.toFixed(3) !== '0.000' ||
0.9.toFixed(0) !== '1' ||
1.255.toFixed(2) !== '1.25' ||
@@ -5030,7 +4981,11 @@ typeof navigator === "object" && (function (global, factory) {
) || !fails(function () {
// V8 ~ Android 4.3-
nativeToFixed.call({});
- }) }, {
+ });
+
+ // `Number.prototype.toFixed` method
+ // https://tc39.github.io/ecma262/#sec-number.prototype.tofixed
+ _export({ target: 'Number', proto: true, forced: FORCED$2 }, {
toFixed: function toFixed(fractionDigits) {
var x = thisNumberValue(this);
var f = toInteger(fractionDigits);
@@ -5093,9 +5048,13 @@ typeof navigator === "object" && (function (global, factory) {
var i = 0;
var result = [];
var key;
- while (length > i) if (propertyIsEnumerable.call(O, key = keys[i++])) {
- result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
- } return result;
+ while (length > i) {
+ key = keys[i++];
+ if (!descriptors || propertyIsEnumerable.call(O, key)) {
+ result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
+ }
+ }
+ return result;
};
// `Object.entries` method
@@ -5225,45 +5184,41 @@ typeof navigator === "object" && (function (global, factory) {
};
// @@match logic
- fixRegexpWellKnownSymbolLogic(
- 'match',
- 1,
- function (MATCH, nativeMatch, maybeCallNative) {
- return [
- // `String.prototype.match` method
- // https://tc39.github.io/ecma262/#sec-string.prototype.match
- function match(regexp) {
- var O = requireObjectCoercible(this);
- var matcher = regexp == undefined ? undefined : regexp[MATCH];
- return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
- },
- // `RegExp.prototype[@@match]` method
- // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match
- function (regexp) {
- var res = maybeCallNative(nativeMatch, regexp, this);
- if (res.done) return res.value;
-
- var rx = anObject(regexp);
- var S = String(this);
-
- if (!rx.global) return regexpExecAbstract(rx, S);
-
- var fullUnicode = rx.unicode;
- rx.lastIndex = 0;
- var A = [];
- var n = 0;
- var result;
- while ((result = regexpExecAbstract(rx, S)) !== null) {
- var matchStr = String(result[0]);
- A[n] = matchStr;
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
- n++;
- }
- return n === 0 ? null : A;
- }
- ];
- }
- );
+ fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
+ return [
+ // `String.prototype.match` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.match
+ function match(regexp) {
+ var O = requireObjectCoercible(this);
+ var matcher = regexp == undefined ? undefined : regexp[MATCH];
+ return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
+ },
+ // `RegExp.prototype[@@match]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match
+ function (regexp) {
+ var res = maybeCallNative(nativeMatch, regexp, this);
+ if (res.done) return res.value;
+
+ var rx = anObject(regexp);
+ var S = String(this);
+
+ if (!rx.global) return regexpExecAbstract(rx, S);
+
+ var fullUnicode = rx.unicode;
+ rx.lastIndex = 0;
+ var A = [];
+ var n = 0;
+ var result;
+ while ((result = regexpExecAbstract(rx, S)) !== null) {
+ var matchStr = String(result[0]);
+ A[n] = matchStr;
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
+ n++;
+ }
+ return n === 0 ? null : A;
+ }
+ ];
+ });
// Get the number of decimal places
function getDecimalPlaces(value) {
@@ -5480,18 +5435,38 @@ typeof navigator === "object" && (function (global, factory) {
return RangeTouch;
}();
- var set$1 = global$1.setImmediate;
- var clear = global$1.clearImmediate;
- var process = global$1.process;
- var MessageChannel = global$1.MessageChannel;
- var Dispatch = global$1.Dispatch;
+ var aFunction$1 = function (variable) {
+ return typeof variable == 'function' ? variable : undefined;
+ };
+
+ var getBuiltIn = function (namespace, method) {
+ return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global_1[namespace])
+ : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
+ };
+
+ var SPECIES$5 = wellKnownSymbol('species');
+
+ var setSpecies = function (CONSTRUCTOR_NAME) {
+ var C = getBuiltIn(CONSTRUCTOR_NAME);
+ var defineProperty = objectDefineProperty.f;
+ if (descriptors && C && !C[SPECIES$5]) defineProperty(C, SPECIES$5, {
+ configurable: true,
+ get: function () { return this; }
+ });
+ };
+
+ var location = global_1.location;
+ var set$1 = global_1.setImmediate;
+ var clear = global_1.clearImmediate;
+ var process = global_1.process;
+ var MessageChannel = global_1.MessageChannel;
+ var Dispatch = global_1.Dispatch;
var counter = 0;
var queue = {};
var ONREADYSTATECHANGE = 'onreadystatechange';
var defer, channel, port;
- var run = function () {
- var id = +this;
+ var run = function (id) {
// eslint-disable-next-line no-prototype-builtins
if (queue.hasOwnProperty(id)) {
var fn = queue[id];
@@ -5500,8 +5475,19 @@ typeof navigator === "object" && (function (global, factory) {
}
};
+ var runner = function (id) {
+ return function () {
+ run(id);
+ };
+ };
+
var listener = function (event) {
- run.call(event.data);
+ run(event.data);
+ };
+
+ var post = function (id) {
+ // old engines have not location.origin
+ global_1.postMessage(id + '', location.protocol + '//' + location.host);
};
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
@@ -5523,12 +5509,12 @@ typeof navigator === "object" && (function (global, factory) {
// Node.js 0.8-
if (classofRaw(process) == 'process') {
defer = function (id) {
- process.nextTick(bindContext(run, id, 1));
+ process.nextTick(runner(id));
};
// Sphere (JS game engine) Dispatch API
} else if (Dispatch && Dispatch.now) {
defer = function (id) {
- Dispatch.now(bindContext(run, id, 1));
+ Dispatch.now(runner(id));
};
// Browsers with MessageChannel, includes WebWorkers
} else if (MessageChannel) {
@@ -5538,23 +5524,21 @@ typeof navigator === "object" && (function (global, factory) {
defer = bindContext(port.postMessage, port, 1);
// Browsers with postMessage, skip WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
- } else if (global$1.addEventListener && typeof postMessage == 'function' && !global$1.importScripts) {
- defer = function (id) {
- global$1.postMessage(id + '', '*');
- };
- global$1.addEventListener('message', listener, false);
+ } else if (global_1.addEventListener && typeof postMessage == 'function' && !global_1.importScripts && !fails(post)) {
+ defer = post;
+ global_1.addEventListener('message', listener, false);
// IE8-
} else if (ONREADYSTATECHANGE in documentCreateElement('script')) {
defer = function (id) {
html.appendChild(documentCreateElement('script'))[ONREADYSTATECHANGE] = function () {
html.removeChild(this);
- run.call(id);
+ run(id);
};
};
// Rest old browsers
} else {
defer = function (id) {
- setTimeout(bindContext(run, id, 1), 0);
+ setTimeout(runner(id), 0);
};
}
}
@@ -5564,20 +5548,21 @@ typeof navigator === "object" && (function (global, factory) {
clear: clear
};
- var navigator$1 = global$1.navigator;
+ var navigator$1 = global_1.navigator;
var userAgent = navigator$1 && navigator$1.userAgent || '';
- var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
+ var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f;
var macrotask = task.set;
- var MutationObserver$1 = global$1.MutationObserver || global$1.WebKitMutationObserver;
- var process$1 = global$1.process;
- var Promise$1 = global$1.Promise;
+
+ var MutationObserver$1 = global_1.MutationObserver || global_1.WebKitMutationObserver;
+ var process$1 = global_1.process;
+ var Promise$1 = global_1.Promise;
var IS_NODE = classofRaw(process$1) == 'process';
// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
- var queueMicrotaskDescriptor = getOwnPropertyDescriptor$2(global$1, 'queueMicrotask');
+ var queueMicrotaskDescriptor = getOwnPropertyDescriptor$3(global_1, 'queueMicrotask');
var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
var flush, head, last, notify, toggle, node, promise;
@@ -5607,7 +5592,7 @@ typeof navigator === "object" && (function (global, factory) {
process$1.nextTick(flush);
};
// browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
- } else if (MutationObserver$1 && !/(iPhone|iPod|iPad).*AppleWebKit/i.test(userAgent)) {
+ } else if (MutationObserver$1 && !/(iphone|ipod|ipad).*applewebkit/i.test(userAgent)) {
toggle = true;
node = document.createTextNode('');
new MutationObserver$1(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
@@ -5630,7 +5615,7 @@ typeof navigator === "object" && (function (global, factory) {
} else {
notify = function () {
// strange IE + webpack dev server bug - use .call(global)
- macrotask.call(global$1, flush);
+ macrotask.call(global_1, flush);
};
}
}
@@ -5644,9 +5629,6 @@ typeof navigator === "object" && (function (global, factory) {
} last = task;
};
- // 25.4.1.5 NewPromiseCapability(C)
-
-
var PromiseCapability = function (C) {
var resolve, reject;
this.promise = new C(function ($$resolve, $$reject) {
@@ -5658,6 +5640,7 @@ typeof navigator === "object" && (function (global, factory) {
this.reject = aFunction(reject);
};
+ // 25.4.1.5 NewPromiseCapability(C)
var f$7 = function (C) {
return new PromiseCapability(C);
};
@@ -5676,7 +5659,7 @@ typeof navigator === "object" && (function (global, factory) {
};
var hostReportErrors = function (a, b) {
- var console = global$1.console;
+ var console = global_1.console;
if (console && console.error) {
arguments.length === 1 ? console.error(a) : console.error(a, b);
}
@@ -5690,38 +5673,11 @@ typeof navigator === "object" && (function (global, factory) {
}
};
- var aFunction$1 = function (variable) {
- return typeof variable == 'function' ? variable : undefined;
- };
-
- var getBuiltIn = function (namespace, method) {
- return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global$1[namespace])
- : path[namespace] && path[namespace][method] || global$1[namespace] && global$1[namespace][method];
- };
-
- var SPECIES$5 = wellKnownSymbol('species');
-
- var setSpecies = function (CONSTRUCTOR_NAME) {
- var C = getBuiltIn(CONSTRUCTOR_NAME);
- var defineProperty = objectDefineProperty.f;
- if (descriptors && C && !C[SPECIES$5]) defineProperty(C, SPECIES$5, {
- configurable: true,
- get: function () { return this; }
- });
- };
-
- var PROMISE = 'Promise';
-
-
-
-
-
-
+ var task$1 = task.set;
- var task$1 = task.set;
@@ -5729,22 +5685,21 @@ typeof navigator === "object" && (function (global, factory) {
var SPECIES$6 = wellKnownSymbol('species');
-
-
+ var PROMISE = 'Promise';
var getInternalState$3 = internalState.get;
var setInternalState$6 = internalState.set;
var getInternalPromiseState = internalState.getterFor(PROMISE);
- var PromiseConstructor = global$1[PROMISE];
- var TypeError$1 = global$1.TypeError;
- var document$3 = global$1.document;
- var process$2 = global$1.process;
- var $fetch = global$1.fetch;
+ var PromiseConstructor = global_1[PROMISE];
+ var TypeError$1 = global_1.TypeError;
+ var document$3 = global_1.document;
+ var process$2 = global_1.process;
+ var $fetch = global_1.fetch;
var versions = process$2 && process$2.versions;
var v8 = versions && versions.v8 || '';
var newPromiseCapability$1 = newPromiseCapability.f;
var newGenericPromiseCapability = newPromiseCapability$1;
var IS_NODE$1 = classofRaw(process$2) == 'process';
- var DISPATCH_EVENT = !!(document$3 && document$3.createEvent && global$1.dispatchEvent);
+ var DISPATCH_EVENT = !!(document$3 && document$3.createEvent && global_1.dispatchEvent);
var UNHANDLED_REJECTION = 'unhandledrejection';
var REJECTION_HANDLED = 'rejectionhandled';
var PENDING = 0;
@@ -5754,7 +5709,7 @@ typeof navigator === "object" && (function (global, factory) {
var UNHANDLED = 2;
var Internal, OwnPromiseCapability, PromiseWrapper;
- var FORCED$2 = isForced_1(PROMISE, function () {
+ var FORCED$3 = isForced_1(PROMISE, function () {
// correct subclassing with @@species support
var promise = PromiseConstructor.resolve(1);
var empty = function () { /* empty */ };
@@ -5772,7 +5727,7 @@ typeof navigator === "object" && (function (global, factory) {
&& userAgent.indexOf('Chrome/66') === -1);
});
- var INCORRECT_ITERATION$1 = FORCED$2 || !checkCorrectnessOfIteration(function (iterable) {
+ var INCORRECT_ITERATION$1 = FORCED$3 || !checkCorrectnessOfIteration(function (iterable) {
PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
});
@@ -5836,14 +5791,14 @@ typeof navigator === "object" && (function (global, factory) {
event.promise = promise;
event.reason = reason;
event.initEvent(name, false, true);
- global$1.dispatchEvent(event);
+ global_1.dispatchEvent(event);
} else event = { promise: promise, reason: reason };
- if (handler = global$1['on' + name]) handler(event);
+ if (handler = global_1['on' + name]) handler(event);
else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
};
var onUnhandled = function (promise, state) {
- task$1.call(global$1, function () {
+ task$1.call(global_1, function () {
var value = state.value;
var IS_UNHANDLED = isUnhandled(state);
var result;
@@ -5865,7 +5820,7 @@ typeof navigator === "object" && (function (global, factory) {
};
var onHandleUnhandled = function (promise, state) {
- task$1.call(global$1, function () {
+ task$1.call(global_1, function () {
if (IS_NODE$1) {
process$2.emit('rejectionHandled', promise);
} else dispatchEvent(REJECTION_HANDLED, promise, state.value);
@@ -5917,7 +5872,7 @@ typeof navigator === "object" && (function (global, factory) {
};
// constructor polyfill
- if (FORCED$2) {
+ if (FORCED$3) {
// 25.4.3.1 Promise(executor)
PromiseConstructor = function Promise(executor) {
anInstance(this, PromiseConstructor, PROMISE);
@@ -5980,12 +5935,14 @@ typeof navigator === "object" && (function (global, factory) {
if (typeof $fetch == 'function') _export({ global: true, enumerable: true, forced: true }, {
// eslint-disable-next-line no-unused-vars
fetch: function fetch(input) {
- return promiseResolve(PromiseConstructor, $fetch.apply(global$1, arguments));
+ return promiseResolve(PromiseConstructor, $fetch.apply(global_1, arguments));
}
});
}
- _export({ global: true, wrap: true, forced: FORCED$2 }, { Promise: PromiseConstructor });
+ _export({ global: true, wrap: true, forced: FORCED$3 }, {
+ Promise: PromiseConstructor
+ });
setToStringTag(PromiseConstructor, PROMISE, false, true);
setSpecies(PROMISE);
@@ -5993,7 +5950,7 @@ typeof navigator === "object" && (function (global, factory) {
PromiseWrapper = path[PROMISE];
// statics
- _export({ target: PROMISE, stat: true, forced: FORCED$2 }, {
+ _export({ target: PROMISE, stat: true, forced: FORCED$3 }, {
// `Promise.reject` method
// https://tc39.github.io/ecma262/#sec-promise.reject
reject: function reject(r) {
@@ -6003,7 +5960,7 @@ typeof navigator === "object" && (function (global, factory) {
}
});
- _export({ target: PROMISE, stat: true, forced: FORCED$2 }, {
+ _export({ target: PROMISE, stat: true, forced: FORCED$3 }, {
// `Promise.resolve` method
// https://tc39.github.io/ecma262/#sec-promise.resolve
resolve: function resolve(x) {
@@ -6020,6 +5977,7 @@ typeof navigator === "object" && (function (global, factory) {
var resolve = capability.resolve;
var reject = capability.reject;
var result = perform(function () {
+ var $promiseResolve = aFunction(C.resolve);
var values = [];
var counter = 0;
var remaining = 1;
@@ -6028,7 +5986,7 @@ typeof navigator === "object" && (function (global, factory) {
var alreadyCalled = false;
values.push(undefined);
remaining++;
- C.resolve(promise).then(function (value) {
+ $promiseResolve.call(C, promise).then(function (value) {
if (alreadyCalled) return;
alreadyCalled = true;
values[index] = value;
@@ -6047,8 +6005,9 @@ typeof navigator === "object" && (function (global, factory) {
var capability = newPromiseCapability$1(C);
var reject = capability.reject;
var result = perform(function () {
+ var $promiseResolve = aFunction(C.resolve);
iterate(iterable, function (promise) {
- C.resolve(promise).then(capability.resolve, reject);
+ $promiseResolve.call(C, promise).then(capability.resolve, reject);
});
});
if (result.error) reject(result.value);
@@ -6057,12 +6016,11 @@ typeof navigator === "object" && (function (global, factory) {
});
var STARTS_WITH = 'startsWith';
- var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegexpLogic(STARTS_WITH);
var nativeStartsWith = ''[STARTS_WITH];
// `String.prototype.startsWith` method
// https://tc39.github.io/ecma262/#sec-string.prototype.startswith
- _export({ target: 'String', proto: true, forced: !CORRECT_IS_REGEXP_LOGIC$1 }, {
+ _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic(STARTS_WITH) }, {
startsWith: function startsWith(searchString /* , position = 0 */) {
var that = validateStringMethodArguments(this, searchString, STARTS_WITH);
var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length));
@@ -6343,6 +6301,47 @@ typeof navigator === "object" && (function (global, factory) {
}).then(function () {});
}
+ function cloneDeep(object) {
+ return JSON.parse(JSON.stringify(object));
+ } // Get a nested value in an object
+
+ function getDeep(object, path) {
+ return path.split('.').reduce(function (obj, key) {
+ return obj && obj[key];
+ }, object);
+ } // Deep extend destination object with N more objects
+
+ function extend() {
+ var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ sources[_key - 1] = arguments[_key];
+ }
+
+ if (!sources.length) {
+ return target;
+ }
+
+ var source = sources.shift();
+
+ if (!is$1.object(source)) {
+ return target;
+ }
+
+ Object.keys(source).forEach(function (key) {
+ if (is$1.object(source[key])) {
+ if (!Object.keys(target).includes(key)) {
+ Object.assign(target, _defineProperty({}, key, {}));
+ }
+
+ extend(target[key], source[key]);
+ } else {
+ Object.assign(target, _defineProperty({}, key, source[key]));
+ }
+ });
+ return extend.apply(void 0, [target].concat(sources));
+ }
+
function wrap$1(elements, wrapper) {
// Convert `elements` to an array, if necessary.
var targets = elements.length ? elements : [elements]; // Loops backwards to prevent having to clone the wrapper on the
@@ -6466,7 +6465,7 @@ typeof navigator === "object" && (function (global, factory) {
}
var attributes = {};
- var existing = existingAttributes;
+ var existing = extend({}, existingAttributes);
sel.split(',').forEach(function (s) {
// Remove whitespace
var selector = s.trim();
@@ -6474,7 +6473,10 @@ typeof navigator === "object" && (function (global, factory) {
var stripped = selector.replace(/[[\]]/g, ''); // Get the parts and value
var parts = stripped.split('=');
- var key = parts[0];
+
+ var _parts = _slicedToArray(parts, 1),
+ key = _parts[0];
+
var value = parts.length > 1 ? parts[1].replace(/["']/g, '') : ''; // Get the first character
var start = selector.charAt(0);
@@ -6482,11 +6484,12 @@ typeof navigator === "object" && (function (global, factory) {
switch (start) {
case '.':
// Add to existing classname
- if (is$1.object(existing) && is$1.string(existing.class)) {
- existing.class += " ".concat(className);
+ if (is$1.string(existing.class)) {
+ attributes.class = "".concat(existing.class, " ").concat(className);
+ } else {
+ attributes.class = className;
}
- attributes.class = className;
break;
case '#':
@@ -6503,7 +6506,7 @@ typeof navigator === "object" && (function (global, factory) {
break;
}
});
- return attributes;
+ return extend(existing, attributes);
} // Toggle hidden
function toggleHidden(element, hidden) {
@@ -6555,8 +6558,8 @@ typeof navigator === "object" && (function (global, factory) {
return Array.from(document.querySelectorAll(selector)).includes(this);
}
- var matches = match;
- return matches.call(element, selector);
+ var method = match;
+ return method.call(element, selector);
} // Find all elements
function getElements(selector) {
@@ -6798,8 +6801,16 @@ typeof navigator === "object" && (function (global, factory) {
} // Get from embed
- if (ratio === null && !is$1.empty(this.embed) && is$1.string(this.embed.ratio)) {
- ratio = parse(this.embed.ratio);
+ if (ratio === null && !is$1.empty(this.embed) && is$1.array(this.embed.ratio)) {
+ ratio = this.embed.ratio;
+ } // Get from HTML5 video
+
+
+ if (ratio === null && this.isHTML5) {
+ var _this$media = this.media,
+ videoWidth = _this$media.videoWidth,
+ videoHeight = _this$media.videoHeight;
+ ratio = reduceAspectRatio([videoWidth, videoHeight]);
}
return ratio;
@@ -6874,8 +6885,8 @@ typeof navigator === "object" && (function (global, factory) {
get: function get() {
// Get sources
var sources = html5.getSources.call(player);
- var source = sources.find(function (source) {
- return source.getAttribute('src') === player.source;
+ var source = sources.find(function (s) {
+ return s.getAttribute('src') === player.source;
}); // Return size, if match is found
return source && Number(source.getAttribute('size'));
@@ -6884,8 +6895,8 @@ typeof navigator === "object" && (function (global, factory) {
// Get sources
var sources = html5.getSources.call(player); // Get first match for requested size
- var source = sources.find(function (source) {
- return Number(source.getAttribute('size')) === input;
+ var source = sources.find(function (s) {
+ return Number(s.getAttribute('size')) === input;
}); // No matching source found
if (!source) {
@@ -6963,66 +6974,25 @@ typeof navigator === "object" && (function (global, factory) {
});
}
- function cloneDeep(object) {
- return JSON.parse(JSON.stringify(object));
- } // Get a nested value in an object
-
- function getDeep(object, path) {
- return path.split('.').reduce(function (obj, key) {
- return obj && obj[key];
- }, object);
- } // Deep extend destination object with N more objects
-
- function extend() {
- var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+ var defineProperty$4 = objectDefineProperty.f;
+ var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
- for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- sources[_key - 1] = arguments[_key];
- }
- if (!sources.length) {
- return target;
- }
- var source = sources.shift();
- if (!is$1.object(source)) {
- return target;
- }
- Object.keys(source).forEach(function (key) {
- if (is$1.object(source[key])) {
- if (!Object.keys(target).includes(key)) {
- Object.assign(target, _defineProperty({}, key, {}));
- }
- extend(target[key], source[key]);
- } else {
- Object.assign(target, _defineProperty({}, key, source[key]));
- }
- });
- return extend.apply(void 0, [target].concat(sources));
- }
var MATCH$2 = wellKnownSymbol('match');
-
-
-
- var defineProperty$4 = objectDefineProperty.f;
- var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
-
-
-
-
- var NativeRegExp = global$1.RegExp;
- var RegExpPrototype = NativeRegExp.prototype;
+ var NativeRegExp = global_1.RegExp;
+ var RegExpPrototype$1 = NativeRegExp.prototype;
var re1 = /a/g;
var re2 = /a/g;
// "new" should create a new object, old webkit bug
var CORRECT_NEW = new NativeRegExp(re1) !== re1;
- var FORCED$3 = isForced_1('RegExp', descriptors && (!CORRECT_NEW || fails(function () {
+ var FORCED$4 = isForced_1('RegExp', descriptors && (!CORRECT_NEW || fails(function () {
re2[MATCH$2] = false;
// RegExp constructor can alter flags and IsRegExp works correct with @@match
return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
@@ -7030,7 +7000,7 @@ typeof navigator === "object" && (function (global, factory) {
// `RegExp` constructor
// https://tc39.github.io/ecma262/#sec-regexp-constructor
- if (FORCED$3) {
+ if (FORCED$4) {
var RegExpWrapper = function RegExp(pattern, flags) {
var thisIsRegExp = this instanceof RegExpWrapper;
var patternIsRegExp = isRegexp(pattern);
@@ -7041,7 +7011,7 @@ typeof navigator === "object" && (function (global, factory) {
: NativeRegExp((patternIsRegExp = pattern instanceof RegExpWrapper)
? pattern.source
: pattern, patternIsRegExp && flagsAreUndefined ? regexpFlags.call(pattern) : flags)
- , thisIsRegExp ? this : RegExpPrototype, RegExpWrapper);
+ , thisIsRegExp ? this : RegExpPrototype$1, RegExpWrapper);
};
var proxy = function (key) {
key in RegExpWrapper || defineProperty$4(RegExpWrapper, key, {
@@ -7050,12 +7020,12 @@ typeof navigator === "object" && (function (global, factory) {
set: function (it) { NativeRegExp[key] = it; }
});
};
- var keys$1 = getOwnPropertyNames$1(NativeRegExp);
+ var keys$2 = getOwnPropertyNames$1(NativeRegExp);
var i = 0;
- while (i < keys$1.length) proxy(keys$1[i++]);
- RegExpPrototype.constructor = RegExpWrapper;
- RegExpWrapper.prototype = RegExpPrototype;
- redefine(global$1, 'RegExp', RegExpWrapper);
+ while (i < keys$2.length) proxy(keys$2[i++]);
+ RegExpPrototype$1.constructor = RegExpWrapper;
+ RegExpWrapper.prototype = RegExpPrototype$1;
+ redefine(global_1, 'RegExp', RegExpWrapper);
}
// https://tc39.github.io/ecma262/#sec-get-regexp-@@species
@@ -7169,10 +7139,10 @@ typeof navigator === "object" && (function (global, factory) {
};
Object.entries(replace).forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
- key = _ref2[0],
- value = _ref2[1];
+ k = _ref2[0],
+ v = _ref2[1];
- string = replaceAll(string, key, value);
+ string = replaceAll(string, k, v);
});
return string;
}
@@ -7307,6 +7277,7 @@ typeof navigator === "object" && (function (global, factory) {
};
var update = function update(container, data) {
+ // eslint-disable-next-line no-param-reassign
container.innerHTML = data; // Check again incase of race condition
if (hasId && exists()) {
@@ -7514,7 +7485,9 @@ typeof navigator === "object" && (function (global, factory) {
},
// Create a <button>
createButton: function createButton(buttonType, attr) {
- var attributes = Object.assign({}, attr);
+ var _this = this;
+
+ var attributes = extend({}, attr);
var type = toCamelCase(buttonType);
var props = {
element: 'button',
@@ -7537,8 +7510,12 @@ typeof navigator === "object" && (function (global, factory) {
if (Object.keys(attributes).includes('class')) {
- if (!attributes.class.includes(this.config.classNames.control)) {
- attributes.class += " ".concat(this.config.classNames.control);
+ if (!attributes.class.split(' ').some(function (c) {
+ return c === _this.config.classNames.control;
+ })) {
+ extend(attributes, {
+ class: "".concat(attributes.class, " ").concat(this.config.classNames.control)
+ });
}
} else {
attributes.class = this.config.classNames.control;
@@ -7682,10 +7659,10 @@ typeof navigator === "object" && (function (global, factory) {
return progress;
},
// Create time display
- createTime: function createTime(type) {
- var attributes = getAttributesFromSelector(this.config.selectors.display[type]);
+ createTime: function createTime(type, attrs) {
+ var attributes = getAttributesFromSelector(this.config.selectors.display[type], attrs);
var container = createElement('div', extend(attributes, {
- class: "".concat(this.config.classNames.display.time, " ").concat(attributes.class ? attributes.class : '').trim(),
+ class: "".concat(attributes.class ? attributes.class : '', " ").concat(this.config.classNames.display.time, " ").trim(),
'aria-label': i18n.get(type, this.config)
}), '00:00'); // Reference for updates
@@ -7696,7 +7673,7 @@ typeof navigator === "object" && (function (global, factory) {
// We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
// https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
bindMenuItemShortcuts: function bindMenuItemShortcuts(menuItem, type) {
- var _this = this;
+ var _this2 = this;
// Navigate through menus via arrow keys and space
on(menuItem, 'keydown keyup', function (event) {
@@ -7716,7 +7693,7 @@ typeof navigator === "object" && (function (global, factory) {
var isRadioButton = matches$1(menuItem, '[role="menuitemradio"]'); // Show the respective menu
if (!isRadioButton && [32, 39].includes(event.which)) {
- controls.showMenuPanel.call(_this, type, true);
+ controls.showMenuPanel.call(_this2, type, true);
} else {
var target;
@@ -7735,7 +7712,7 @@ typeof navigator === "object" && (function (global, factory) {
}
}
- setFocus.call(_this, target, true);
+ setFocus.call(_this2, target, true);
}
}
}, false); // Enter will fire a `click` event but we still need to manage focus
@@ -7746,12 +7723,12 @@ typeof navigator === "object" && (function (global, factory) {
return;
}
- controls.focusFirstMenuItem.call(_this, null, true);
+ controls.focusFirstMenuItem.call(_this2, null, true);
});
},
// Create a settings menu item
createMenuItem: function createMenuItem(_ref) {
- var _this2 = this;
+ var _this3 = this;
var value = _ref.value,
list = _ref.list,
@@ -7784,9 +7761,9 @@ typeof navigator === "object" && (function (global, factory) {
get: function get() {
return menuItem.getAttribute('aria-checked') === 'true';
},
- set: function set(checked) {
+ set: function set(check) {
// Ensure exclusivity
- if (checked) {
+ if (check) {
Array.from(menuItem.parentNode.children).filter(function (node) {
return matches$1(node, '[role="menuitemradio"]');
}).forEach(function (node) {
@@ -7794,7 +7771,7 @@ typeof navigator === "object" && (function (global, factory) {
});
}
- menuItem.setAttribute('aria-checked', checked ? 'true' : 'false');
+ menuItem.setAttribute('aria-checked', check ? 'true' : 'false');
}
});
this.listeners.bind(menuItem, 'click keyup', function (event) {
@@ -7808,22 +7785,22 @@ typeof navigator === "object" && (function (global, factory) {
switch (type) {
case 'language':
- _this2.currentTrack = Number(value);
+ _this3.currentTrack = Number(value);
break;
case 'quality':
- _this2.quality = value;
+ _this3.quality = value;
break;
case 'speed':
- _this2.speed = parseFloat(value);
+ _this3.speed = parseFloat(value);
break;
default:
break;
}
- controls.showMenuPanel.call(_this2, 'home', is$1.keyboardEvent(event));
+ controls.showMenuPanel.call(_this3, 'home', is$1.keyboardEvent(event));
}, type, false);
controls.bindMenuItemShortcuts.call(this, menuItem, type);
list.appendChild(menuItem);
@@ -7887,7 +7864,7 @@ typeof navigator === "object" && (function (global, factory) {
},
// Update <progress> elements
updateProgress: function updateProgress(event) {
- var _this3 = this;
+ var _this4 = this;
if (!this.supported.ui || !is$1.event(event)) {
return;
@@ -7896,16 +7873,16 @@ typeof navigator === "object" && (function (global, factory) {
var value = 0;
var setProgress = function setProgress(target, input) {
- var value = is$1.number(input) ? input : 0;
- var progress = is$1.element(target) ? target : _this3.elements.display.buffer; // Update value and label
+ var val = is$1.number(input) ? input : 0;
+ var progress = is$1.element(target) ? target : _this4.elements.display.buffer; // Update value and label
if (is$1.element(progress)) {
- progress.value = value; // Update text label inside
+ progress.value = val; // Update text label inside
var label = progress.getElementsByTagName('span')[0];
if (is$1.element(label)) {
- label.childNodes[0].nodeValue = value;
+ label.childNodes[0].nodeValue = val;
}
}
};
@@ -7969,20 +7946,17 @@ typeof navigator === "object" && (function (global, factory) {
},
// Update hover tooltip for seeking
updateSeekTooltip: function updateSeekTooltip(event) {
- var _this4 = this;
+ var _this5 = this;
// Bail if setting not true
if (!this.config.tooltips.seek || !is$1.element(this.elements.inputs.seek) || !is$1.element(this.elements.display.seekTooltip) || this.duration === 0) {
return;
- } // Calculate percentage
-
+ }
- var percent = 0;
- var clientRect = this.elements.progress.getBoundingClientRect();
var visible = "".concat(this.config.classNames.tooltip, "--visible");
- var toggle = function toggle(_toggle) {
- toggleClass(_this4.elements.display.seekTooltip, visible, _toggle);
+ var toggle = function toggle(show) {
+ return toggleClass(_this5.elements.display.seekTooltip, visible, show);
}; // Hide on touch
@@ -7992,6 +7966,9 @@ typeof navigator === "object" && (function (global, factory) {
} // Determine percentage, if already visible
+ var percent = 0;
+ var clientRect = this.elements.progress.getBoundingClientRect();
+
if (is$1.event(event)) {
percent = 100 / clientRect.width * (event.pageX - clientRect.left);
} else if (hasClass(this.elements.display.seekTooltip, visible)) {
@@ -8148,7 +8125,7 @@ typeof navigator === "object" && (function (global, factory) {
},
// Set the quality menu
setQualityMenu: function setQualityMenu(options) {
- var _this5 = this;
+ var _this6 = this;
// Menu required
if (!is$1.element(this.elements.settings.panels.quality)) {
@@ -8160,7 +8137,7 @@ typeof navigator === "object" && (function (global, factory) {
if (is$1.array(options)) {
this.options.quality = dedupe(options).filter(function (quality) {
- return _this5.config.quality.options.includes(quality);
+ return _this6.config.quality.options.includes(quality);
});
} // Toggle the pane and tab
@@ -8178,25 +8155,25 @@ typeof navigator === "object" && (function (global, factory) {
var getBadge = function getBadge(quality) {
- var label = i18n.get("qualityBadge.".concat(quality), _this5.config);
+ var label = i18n.get("qualityBadge.".concat(quality), _this6.config);
if (!label.length) {
return null;
}
- return controls.createBadge.call(_this5, label);
+ return controls.createBadge.call(_this6, label);
}; // Sort options by the config and then render options
this.options.quality.sort(function (a, b) {
- var sorting = _this5.config.quality.options;
+ var sorting = _this6.config.quality.options;
return sorting.indexOf(a) > sorting.indexOf(b) ? 1 : -1;
}).forEach(function (quality) {
- controls.createMenuItem.call(_this5, {
+ controls.createMenuItem.call(_this6, {
value: quality,
list: list,
type: type,
- title: controls.getLabel.call(_this5, 'quality', quality),
+ title: controls.getLabel.call(_this6, 'quality', quality),
badge: getBadge(quality)
});
});
@@ -8242,7 +8219,7 @@ typeof navigator === "object" && (function (global, factory) {
// TODO: rework this to user the getter in the API?
// Set a list of available captions languages
setCaptionsMenu: function setCaptionsMenu() {
- var _this6 = this;
+ var _this7 = this;
// Menu required
if (!is$1.element(this.elements.settings.panels.captions)) {
@@ -8269,9 +8246,9 @@ typeof navigator === "object" && (function (global, factory) {
var options = tracks.map(function (track, value) {
return {
value: value,
- checked: _this6.captions.toggled && _this6.currentTrack === value,
- title: captions.getLabel.call(_this6, track),
- badge: track.language && controls.createBadge.call(_this6, track.language.toUpperCase()),
+ checked: _this7.captions.toggled && _this7.currentTrack === value,
+ title: captions.getLabel.call(_this7, track),
+ badge: track.language && controls.createBadge.call(_this7, track.language.toUpperCase()),
list: list,
type: 'language'
};
@@ -8290,7 +8267,7 @@ typeof navigator === "object" && (function (global, factory) {
},
// Set a list of available captions languages
setSpeedMenu: function setSpeedMenu(options) {
- var _this7 = this;
+ var _this8 = this;
// Menu required
if (!is$1.element(this.elements.settings.panels.speed)) {
@@ -8308,7 +8285,7 @@ typeof navigator === "object" && (function (global, factory) {
this.options.speed = this.options.speed.filter(function (speed) {
- return _this7.config.speed.options.includes(speed);
+ return _this8.config.speed.options.includes(speed);
}); // Toggle the pane and tab
var toggle = !is$1.empty(this.options.speed) && this.options.speed.length > 1;
@@ -8324,11 +8301,11 @@ typeof navigator === "object" && (function (global, factory) {
this.options.speed.forEach(function (speed) {
- controls.createMenuItem.call(_this7, {
+ controls.createMenuItem.call(_this8, {
value: speed,
list: list,
type: type,
- title: controls.getLabel.call(_this7, 'speed', speed)
+ title: controls.getLabel.call(_this8, 'speed', speed)
});
});
controls.updateSetting.call(this, type, list);
@@ -8352,8 +8329,8 @@ typeof navigator === "object" && (function (global, factory) {
var target = pane;
if (!is$1.element(target)) {
- target = Object.values(this.elements.settings.panels).find(function (pane) {
- return !pane.hidden;
+ target = Object.values(this.elements.settings.panels).find(function (p) {
+ return !p.hidden;
});
}
@@ -8378,7 +8355,10 @@ typeof navigator === "object" && (function (global, factory) {
} else if (is$1.keyboardEvent(input) && input.which === 27) {
show = false;
} else if (is$1.event(input)) {
- var isMenuItem = popup.contains(input.target); // If the click was inside the menu or if the click
+ // If Plyr is in a shadowDOM, the event target is set to the component, instead of the
+ // Element in the shadowDOM. The path, if available, is complete.
+ var target = is$1.function(input.composedPath) ? input.composedPath()[0] : input.target;
+ var isMenuItem = popup.contains(target); // If the click was inside the menu or if the click
// wasn't the button or menu item and we're trying to
// show the menu (a doc click shouldn't show the menu)
@@ -8421,11 +8401,11 @@ typeof navigator === "object" && (function (global, factory) {
},
// Show a panel in the menu
showMenuPanel: function showMenuPanel() {
- var _this8 = this;
+ var _this9 = this;
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var target = document.getElementById("plyr-settings-".concat(this.id, "-").concat(type)); // Nothing to show, bail
+ var target = this.elements.container.querySelector("#plyr-settings-".concat(this.id, "-").concat(type)); // Nothing to show, bail
if (!is$1.element(target)) {
return;
@@ -8454,7 +8434,7 @@ typeof navigator === "object" && (function (global, factory) {
container.style.width = '';
container.style.height = ''; // Only listen once
- off.call(_this8, container, transitionEndEvent, restore);
+ off.call(_this9, container, transitionEndEvent, restore);
}; // Listen for the transition finishing and restore auto height/width
@@ -8471,265 +8451,289 @@ typeof navigator === "object" && (function (global, factory) {
controls.focusFirstMenuItem.call(this, target, tabFocus);
},
- // Set the download link
- setDownloadLink: function setDownloadLink() {
+ // Set the download URL
+ setDownloadUrl: function setDownloadUrl() {
var button = this.elements.buttons.download; // Bail if no button
if (!is$1.element(button)) {
return;
- } // Set download link
+ } // Set attribute
button.setAttribute('href', this.download);
},
// Build the default HTML
- // TODO: Set order based on order in the config.controls array?
create: function create(data) {
- var _this9 = this;
-
- // Create the container
- var container = createElement('div', getAttributesFromSelector(this.config.selectors.controls.wrapper)); // Restart button
-
- if (this.config.controls.includes('restart')) {
- container.appendChild(controls.createButton.call(this, 'restart'));
- } // Rewind button
-
-
- if (this.config.controls.includes('rewind')) {
- container.appendChild(controls.createButton.call(this, 'rewind'));
- } // Play/Pause button
-
+ var _this10 = this;
- if (this.config.controls.includes('play')) {
- container.appendChild(controls.createButton.call(this, 'play'));
- } // Fast forward button
+ var bindMenuItemShortcuts = controls.bindMenuItemShortcuts,
+ createButton = controls.createButton,
+ createProgress = controls.createProgress,
+ createRange = controls.createRange,
+ createTime = controls.createTime,
+ setQualityMenu = controls.setQualityMenu,
+ setSpeedMenu = controls.setSpeedMenu,
+ showMenuPanel = controls.showMenuPanel;
+ this.elements.controls = null; // Larger overlaid play button
+ if (this.config.controls.includes('play-large')) {
+ this.elements.container.appendChild(createButton.call(this, 'play-large'));
+ } // Create the container
- if (this.config.controls.includes('fast-forward')) {
- container.appendChild(controls.createButton.call(this, 'fast-forward'));
- } // Progress
+ var container = createElement('div', getAttributesFromSelector(this.config.selectors.controls.wrapper));
+ this.elements.controls = container; // Default item attributes
- if (this.config.controls.includes('progress')) {
- var progress = createElement('div', getAttributesFromSelector(this.config.selectors.progress)); // Seek range slider
+ var defaultAttributes = {
+ class: 'plyr__controls__item'
+ }; // Loop through controls in order
- progress.appendChild(controls.createRange.call(this, 'seek', {
- id: "plyr-seek-".concat(data.id)
- })); // Buffer progress
+ dedupe(this.config.controls).forEach(function (control) {
+ // Restart button
+ if (control === 'restart') {
+ container.appendChild(createButton.call(_this10, 'restart', defaultAttributes));
+ } // Rewind button
- progress.appendChild(controls.createProgress.call(this, 'buffer')); // TODO: Add loop display indicator
- // Seek tooltip
- if (this.config.tooltips.seek) {
- var tooltip = createElement('span', {
- class: this.config.classNames.tooltip
- }, '00:00');
- progress.appendChild(tooltip);
- this.elements.display.seekTooltip = tooltip;
- }
+ if (control === 'rewind') {
+ container.appendChild(createButton.call(_this10, 'rewind', defaultAttributes));
+ } // Play/Pause button
- this.elements.progress = progress;
- container.appendChild(this.elements.progress);
- } // Media current time display
+ if (control === 'play') {
+ container.appendChild(createButton.call(_this10, 'play', defaultAttributes));
+ } // Fast forward button
- if (this.config.controls.includes('current-time')) {
- container.appendChild(controls.createTime.call(this, 'currentTime'));
- } // Media duration display
+ if (control === 'fast-forward') {
+ container.appendChild(createButton.call(_this10, 'fast-forward', defaultAttributes));
+ } // Progress
- if (this.config.controls.includes('duration')) {
- container.appendChild(controls.createTime.call(this, 'duration'));
- } // Volume controls
+ if (control === 'progress') {
+ var progressContainer = createElement('div', {
+ class: "".concat(defaultAttributes.class, " plyr__progress__container")
+ });
+ var progress = createElement('div', getAttributesFromSelector(_this10.config.selectors.progress)); // Seek range slider
- if (this.config.controls.includes('mute') || this.config.controls.includes('volume')) {
- var volume = createElement('div', {
- class: 'plyr__volume'
- }); // Toggle mute button
-
- if (this.config.controls.includes('mute')) {
- volume.appendChild(controls.createButton.call(this, 'mute'));
- } // Volume range control
+ progress.appendChild(createRange.call(_this10, 'seek', {
+ id: "plyr-seek-".concat(data.id)
+ })); // Buffer progress
+ progress.appendChild(createProgress.call(_this10, 'buffer')); // TODO: Add loop display indicator
+ // Seek tooltip
- if (this.config.controls.includes('volume')) {
- // Set the attributes
- var attributes = {
- max: 1,
- step: 0.05,
- value: this.config.volume
- }; // Create the volume range slider
+ if (_this10.config.tooltips.seek) {
+ var tooltip = createElement('span', {
+ class: _this10.config.classNames.tooltip
+ }, '00:00');
+ progress.appendChild(tooltip);
+ _this10.elements.display.seekTooltip = tooltip;
+ }
- volume.appendChild(controls.createRange.call(this, 'volume', extend(attributes, {
- id: "plyr-volume-".concat(data.id)
- })));
- this.elements.volume = volume;
- }
+ _this10.elements.progress = progress;
+ progressContainer.appendChild(_this10.elements.progress);
+ container.appendChild(progressContainer);
+ } // Media current time display
- container.appendChild(volume);
- } // Toggle captions button
+ if (control === 'current-time') {
+ container.appendChild(createTime.call(_this10, 'currentTime', defaultAttributes));
+ } // Media duration display
- if (this.config.controls.includes('captions')) {
- container.appendChild(controls.createButton.call(this, 'captions'));
- } // Settings button / menu
+ if (control === 'duration') {
+ container.appendChild(createTime.call(_this10, 'duration', defaultAttributes));
+ } // Volume controls
- if (this.config.controls.includes('settings') && !is$1.empty(this.config.settings)) {
- var control = createElement('div', {
- class: 'plyr__menu',
- hidden: ''
- });
- control.appendChild(controls.createButton.call(this, 'settings', {
- 'aria-haspopup': true,
- 'aria-controls': "plyr-settings-".concat(data.id),
- 'aria-expanded': false
- }));
- var popup = createElement('div', {
- class: 'plyr__menu__container',
- id: "plyr-settings-".concat(data.id),
- hidden: ''
- });
- var inner = createElement('div');
- var home = createElement('div', {
- id: "plyr-settings-".concat(data.id, "-home")
- }); // Create the menu
- var menu = createElement('div', {
- role: 'menu'
- });
- home.appendChild(menu);
- inner.appendChild(home);
- this.elements.settings.panels.home = home; // Build the menu items
-
- this.config.settings.forEach(function (type) {
- // TODO: bundle this with the createMenuItem helper and bindings
- var menuItem = createElement('button', extend(getAttributesFromSelector(_this9.config.selectors.buttons.settings), {
- type: 'button',
- class: "".concat(_this9.config.classNames.control, " ").concat(_this9.config.classNames.control, "--forward"),
- role: 'menuitem',
- 'aria-haspopup': true,
- hidden: ''
- })); // Bind menu shortcuts for keyboard users
+ if (control === 'mute' || control === 'volume') {
+ var volume = _this10.elements.volume; // Create the volume container if needed
- controls.bindMenuItemShortcuts.call(_this9, menuItem, type); // Show menu on click
+ if (!is$1.element(volume) || !container.contains(volume)) {
+ volume = createElement('div', extend({}, defaultAttributes, {
+ class: "".concat(defaultAttributes.class, " plyr__volume").trim()
+ }));
+ _this10.elements.volume = volume;
+ container.appendChild(volume);
+ } // Toggle mute button
- on(menuItem, 'click', function () {
- controls.showMenuPanel.call(_this9, type, false);
- });
- var flex = createElement('span', null, i18n.get(type, _this9.config));
- var value = createElement('span', {
- class: _this9.config.classNames.menu.value
- }); // Speed contains HTML entities
-
- value.innerHTML = data[type];
- flex.appendChild(value);
- menuItem.appendChild(flex);
- menu.appendChild(menuItem); // Build the panes
-
- var pane = createElement('div', {
- id: "plyr-settings-".concat(data.id, "-").concat(type),
- hidden: ''
- }); // Back button
- var backButton = createElement('button', {
- type: 'button',
- class: "".concat(_this9.config.classNames.control, " ").concat(_this9.config.classNames.control, "--back")
- }); // Visible label
+ if (control === 'mute') {
+ volume.appendChild(createButton.call(_this10, 'mute'));
+ } // Volume range control
- backButton.appendChild(createElement('span', {
- 'aria-hidden': true
- }, i18n.get(type, _this9.config))); // Screen reader label
- backButton.appendChild(createElement('span', {
- class: _this9.config.classNames.hidden
- }, i18n.get('menuBack', _this9.config))); // Go back via keyboard
-
- on(pane, 'keydown', function (event) {
- // We only care about <-
- if (event.which !== 37) {
- return;
- } // Prevent seek
+ if (control === 'volume') {
+ // Set the attributes
+ var attributes = {
+ max: 1,
+ step: 0.05,
+ value: _this10.config.volume
+ }; // Create the volume range slider
+ volume.appendChild(createRange.call(_this10, 'volume', extend(attributes, {
+ id: "plyr-volume-".concat(data.id)
+ })));
+ }
+ } // Toggle captions button
- event.preventDefault();
- event.stopPropagation(); // Show the respective menu
- controls.showMenuPanel.call(_this9, 'home', true);
- }, false); // Go back via button click
+ if (control === 'captions') {
+ container.appendChild(createButton.call(_this10, 'captions', defaultAttributes));
+ } // Settings button / menu
- on(backButton, 'click', function () {
- controls.showMenuPanel.call(_this9, 'home', false);
- }); // Add to pane
- pane.appendChild(backButton); // Menu
+ if (control === 'settings' && !is$1.empty(_this10.config.settings)) {
+ var wrapper = createElement('div', extend({}, defaultAttributes, {
+ class: "".concat(defaultAttributes.class, " plyr__menu").trim(),
+ hidden: ''
+ }));
+ wrapper.appendChild(createButton.call(_this10, 'settings', {
+ 'aria-haspopup': true,
+ 'aria-controls': "plyr-settings-".concat(data.id),
+ 'aria-expanded': false
+ }));
+ var popup = createElement('div', {
+ class: 'plyr__menu__container',
+ id: "plyr-settings-".concat(data.id),
+ hidden: ''
+ });
+ var inner = createElement('div');
+ var home = createElement('div', {
+ id: "plyr-settings-".concat(data.id, "-home")
+ }); // Create the menu
- pane.appendChild(createElement('div', {
+ var menu = createElement('div', {
role: 'menu'
- }));
- inner.appendChild(pane);
- _this9.elements.settings.buttons[type] = menuItem;
- _this9.elements.settings.panels[type] = pane;
- });
- popup.appendChild(inner);
- control.appendChild(popup);
- container.appendChild(control);
- this.elements.settings.popup = popup;
- this.elements.settings.menu = control;
- } // Picture in picture button
+ });
+ home.appendChild(menu);
+ inner.appendChild(home);
+ _this10.elements.settings.panels.home = home; // Build the menu items
+
+ _this10.config.settings.forEach(function (type) {
+ // TODO: bundle this with the createMenuItem helper and bindings
+ var menuItem = createElement('button', extend(getAttributesFromSelector(_this10.config.selectors.buttons.settings), {
+ type: 'button',
+ class: "".concat(_this10.config.classNames.control, " ").concat(_this10.config.classNames.control, "--forward"),
+ role: 'menuitem',
+ 'aria-haspopup': true,
+ hidden: ''
+ })); // Bind menu shortcuts for keyboard users
+
+ bindMenuItemShortcuts.call(_this10, menuItem, type); // Show menu on click
+
+ on(menuItem, 'click', function () {
+ showMenuPanel.call(_this10, type, false);
+ });
+ var flex = createElement('span', null, i18n.get(type, _this10.config));
+ var value = createElement('span', {
+ class: _this10.config.classNames.menu.value
+ }); // Speed contains HTML entities
+
+ value.innerHTML = data[type];
+ flex.appendChild(value);
+ menuItem.appendChild(flex);
+ menu.appendChild(menuItem); // Build the panes
+
+ var pane = createElement('div', {
+ id: "plyr-settings-".concat(data.id, "-").concat(type),
+ hidden: ''
+ }); // Back button
+
+ var backButton = createElement('button', {
+ type: 'button',
+ class: "".concat(_this10.config.classNames.control, " ").concat(_this10.config.classNames.control, "--back")
+ }); // Visible label
+
+ backButton.appendChild(createElement('span', {
+ 'aria-hidden': true
+ }, i18n.get(type, _this10.config))); // Screen reader label
+
+ backButton.appendChild(createElement('span', {
+ class: _this10.config.classNames.hidden
+ }, i18n.get('menuBack', _this10.config))); // Go back via keyboard
+
+ on(pane, 'keydown', function (event) {
+ // We only care about <-
+ if (event.which !== 37) {
+ return;
+ } // Prevent seek
+
+
+ event.preventDefault();
+ event.stopPropagation(); // Show the respective menu
+
+ showMenuPanel.call(_this10, 'home', true);
+ }, false); // Go back via button click
+
+ on(backButton, 'click', function () {
+ showMenuPanel.call(_this10, 'home', false);
+ }); // Add to pane
+
+ pane.appendChild(backButton); // Menu
+
+ pane.appendChild(createElement('div', {
+ role: 'menu'
+ }));
+ inner.appendChild(pane);
+ _this10.elements.settings.buttons[type] = menuItem;
+ _this10.elements.settings.panels[type] = pane;
+ });
+ popup.appendChild(inner);
+ wrapper.appendChild(popup);
+ container.appendChild(wrapper);
+ _this10.elements.settings.popup = popup;
+ _this10.elements.settings.menu = wrapper;
+ } // Picture in picture button
- if (this.config.controls.includes('pip') && support.pip) {
- container.appendChild(controls.createButton.call(this, 'pip'));
- } // Airplay button
+ if (control === 'pip' && support.pip) {
+ container.appendChild(createButton.call(_this10, 'pip', defaultAttributes));
+ } // Airplay button
- if (this.config.controls.includes('airplay') && support.airplay) {
- container.appendChild(controls.createButton.call(this, 'airplay'));
- } // Download button
+ if (control === 'airplay' && support.airplay) {
+ container.appendChild(createButton.call(_this10, 'airplay', defaultAttributes));
+ } // Download button
- if (this.config.controls.includes('download')) {
- var _attributes = {
- element: 'a',
- href: this.download,
- target: '_blank'
- };
- var download = this.config.urls.download;
- if (!is$1.url(download) && this.isEmbed) {
- extend(_attributes, {
- icon: "logo-".concat(this.provider),
- label: this.provider
+ if (control === 'download') {
+ var _attributes = extend({}, defaultAttributes, {
+ element: 'a',
+ href: _this10.download,
+ target: '_blank'
});
- }
-
- container.appendChild(controls.createButton.call(this, 'download', _attributes));
- } // Toggle fullscreen button
+ var download = _this10.config.urls.download;
- if (this.config.controls.includes('fullscreen')) {
- container.appendChild(controls.createButton.call(this, 'fullscreen'));
- } // Larger overlaid play button
+ if (!is$1.url(download) && _this10.isEmbed) {
+ extend(_attributes, {
+ icon: "logo-".concat(_this10.provider),
+ label: _this10.provider
+ });
+ }
+ container.appendChild(createButton.call(_this10, 'download', _attributes));
+ } // Toggle fullscreen button
- if (this.config.controls.includes('play-large')) {
- this.elements.container.appendChild(controls.createButton.call(this, 'play-large'));
- }
- this.elements.controls = container; // Set available quality levels
+ if (control === 'fullscreen') {
+ container.appendChild(createButton.call(_this10, 'fullscreen', defaultAttributes));
+ }
+ }); // Set available quality levels
if (this.isHTML5) {
- controls.setQualityMenu.call(this, html5.getQualityOptions.call(this));
+ setQualityMenu.call(this, html5.getQualityOptions.call(this));
}
- controls.setSpeedMenu.call(this);
+ setSpeedMenu.call(this);
return container;
},
// Insert controls
inject: function inject() {
- var _this10 = this;
+ var _this11 = this;
// Sprite
if (this.config.loadSprite) {
@@ -8824,7 +8828,7 @@ typeof navigator === "object" && (function (global, factory) {
if (!is$1.empty(this.elements.buttons)) {
var addProperty = function addProperty(button) {
- var className = _this10.config.classNames.controlPressed;
+ var className = _this11.config.classNames.controlPressed;
Object.defineProperty(button, 'pressed', {
enumerable: true,
get: function get() {
@@ -8860,8 +8864,8 @@ typeof navigator === "object" && (function (global, factory) {
var selector = "".concat(selectors.controls.wrapper, " ").concat(selectors.labels, " .").concat(classNames.hidden);
var labels = getElements.call(this, selector);
Array.from(labels).forEach(function (label) {
- toggleClass(label, _this10.config.classNames.hidden, false);
- toggleClass(label, _this10.config.classNames.tooltip, true);
+ toggleClass(label, _this11.config.classNames.hidden, false);
+ toggleClass(label, _this11.config.classNames.tooltip, true);
});
}
}
@@ -9013,7 +9017,9 @@ typeof navigator === "object" && (function (global, factory) {
default: track.mode === 'showing'
}); // Turn off native caption rendering to avoid double captions
- track.mode = 'hidden'; // Add event listener for cue changes
+ Object.assign(track, {
+ mode: 'hidden'
+ }); // Add event listener for cue changes
on.call(_this, track, 'cuechange', function () {
return captions.updateCues.call(_this);
@@ -9193,8 +9199,8 @@ typeof navigator === "object" && (function (global, factory) {
});
var track;
languages.every(function (language) {
- track = sorted.find(function (track) {
- return track.language === language;
+ track = sorted.find(function (t) {
+ return t.language === language;
});
return !track; // Break iteration if there is a match
}); // If no match is found but is required, get first
@@ -9318,7 +9324,7 @@ typeof navigator === "object" && (function (global, factory) {
// Sprite (for icons)
loadSprite: true,
iconPrefix: 'plyr',
- iconUrl: 'https://cdn.plyr.io/3.5.3/plyr.svg',
+ iconUrl: 'https://cdn.plyr.io/3.5.2/plyr.svg',
// Blank video (used to prevent errors on source change)
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
// Quality default
@@ -9431,7 +9437,8 @@ typeof navigator === "object" && (function (global, factory) {
},
youtube: {
sdk: 'https://www.youtube.com/iframe_api',
- api: 'https://www.googleapis.com/youtube/v3/videos?id={0}&key={1}&fields=items(snippet(title))&part=snippet'
+ api: 'https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}' // 'https://www.googleapis.com/youtube/v3/videos?id={0}&key={1}&fields=items(snippet(title),fileDetails)&part=snippet',
+
},
googleIMA: {
sdk: 'https://imasdk.googleapis.com/js/sdkloader/ima3.js'
@@ -9507,10 +9514,7 @@ typeof navigator === "object" && (function (global, factory) {
},
progress: '.plyr__progress',
captions: '.plyr__captions',
- caption: '.plyr__caption',
- menu: {
- quality: '.js-plyr__menu__list--quality'
- }
+ caption: '.plyr__caption'
},
// Class hooks added to the player in different states
classNames: {
@@ -9581,10 +9585,6 @@ typeof navigator === "object" && (function (global, factory) {
id: 'data-plyr-embed-id'
}
},
- // API keys
- keys: {
- google: null
- },
// Advertisements plugin
// Register for an account here: http://vi.ai/publisher-video-monetization/?aid=plyrio
ads: {
@@ -9969,7 +9969,9 @@ typeof navigator === "object" && (function (global, factory) {
// `Math.sign` method
// https://tc39.github.io/ecma262/#sec-math.sign
- _export({ target: 'Math', stat: true }, { sign: mathSign });
+ _export({ target: 'Math', stat: true }, {
+ sign: mathSign
+ });
// ==========================================================================
// Load image avoiding xhr/fetch CORS issues
@@ -10044,13 +10046,13 @@ typeof navigator === "object" && (function (global, factory) {
this.volume = null; // Reset mute state
- this.muted = null; // Reset speed
-
- this.speed = null; // Reset loop state
+ this.muted = null; // Reset loop state
this.loop = null; // Reset quality setting
- this.quality = null; // Reset volume display
+ this.quality = null; // Reset speed
+
+ this.speed = null; // Reset volume display
controls.updateVolume.call(this); // Reset time display
@@ -10167,7 +10169,9 @@ typeof navigator === "object" && (function (global, factory) {
toggleClass(this.elements.container, this.config.classNames.stopped, this.stopped); // Set state
Array.from(this.elements.buttons.play || []).forEach(function (target) {
- target.pressed = _this3.playing;
+ Object.assign(target, {
+ pressed: _this3.playing
+ });
}); // Only update controls on non timeupdate events
if (is$1.event(event) && event.type === 'timeupdate') {
@@ -10194,13 +10198,13 @@ typeof navigator === "object" && (function (global, factory) {
},
// Toggle controls based on state and `force` argument
toggleControls: function toggleControls(force) {
- var controls = this.elements.controls;
+ var controlsElement = this.elements.controls;
- if (controls && this.config.hideControls) {
+ if (controlsElement && this.config.hideControls) {
// Don't hide controls if a touch-device user recently seeked. (Must be limited to touch devices, or it occasionally prevents desktop controls from hiding.)
var recentTouchSeek = this.touch && this.lastSeekTime + 2000 > Date.now(); // Show controls if force, loading, paused, button interaction, or recent seek, otherwise hide
- this.toggleControls(Boolean(force || this.loading || this.paused || controls.pressed || controls.hover || recentTouchSeek));
+ this.toggleControls(Boolean(force || this.loading || this.paused || controlsElement.pressed || controlsElement.hover || recentTouchSeek));
}
}
};
@@ -10350,14 +10354,14 @@ typeof navigator === "object" && (function (global, factory) {
break;
/* case 73:
- this.setLoop('start');
- break;
- case 76:
- this.setLoop();
- break;
- case 79:
- this.setLoop('end');
- break; */
+ this.setLoop('start');
+ break;
+ case 76:
+ this.setLoop();
+ break;
+ case 79:
+ this.setLoop('end');
+ break; */
default:
break;
@@ -10457,8 +10461,6 @@ typeof navigator === "object" && (function (global, factory) {
}, {
key: "container",
value: function container() {
- var _this = this;
-
var player = this.player;
var config = player.config,
elements = player.elements,
@@ -10470,11 +10472,11 @@ typeof navigator === "object" && (function (global, factory) {
on.call(player, elements.container, 'mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen', function (event) {
- var controls = elements.controls; // Remove button states for fullscreen
+ var controlsElement = elements.controls; // Remove button states for fullscreen
- if (controls && event.type === 'enterfullscreen') {
- controls.pressed = false;
- controls.hover = false;
+ if (controlsElement && event.type === 'enterfullscreen') {
+ controlsElement.pressed = false;
+ controlsElement.hover = false;
} // Show, then hide after a timeout unless another control event occurs
@@ -10513,7 +10515,7 @@ typeof navigator === "object" && (function (global, factory) {
var _ratio = _slicedToArray(ratio, 2),
y = _ratio[1];
- var _getAspectRatio$call = getAspectRatio.call(_this),
+ var _getAspectRatio$call = getAspectRatio.call(player),
_getAspectRatio$call2 = _slicedToArray(_getAspectRatio$call, 2),
videoX = _getAspectRatio$call2[0],
videoY = _getAspectRatio$call2[1];
@@ -10571,7 +10573,7 @@ typeof navigator === "object" && (function (global, factory) {
}, {
key: "media",
value: function media() {
- var _this2 = this;
+ var _this = this;
var player = this.player;
var elements = player.elements; // Time change on media
@@ -10636,11 +10638,11 @@ typeof navigator === "object" && (function (global, factory) {
}
if (player.ended) {
- _this2.proxy(event, player.restart, 'restart');
+ _this.proxy(event, player.restart, 'restart');
- _this2.proxy(event, player.play, 'play');
+ _this.proxy(event, player.play, 'play');
} else {
- _this2.proxy(event, player.togglePlay, 'play');
+ _this.proxy(event, player.togglePlay, 'play');
}
});
} // Disable right click
@@ -10677,7 +10679,7 @@ typeof navigator === "object" && (function (global, factory) {
}); // Update download link when ready and if quality changes
on.call(player, player.media, 'ready qualitychange', function () {
- controls.setDownloadLink.call(player);
+ controls.setDownloadUrl.call(player);
}); // Proxy events to container
// Bubble up key events for Edge
@@ -10715,21 +10717,21 @@ typeof navigator === "object" && (function (global, factory) {
}, {
key: "bind",
value: function bind(element, type, defaultHandler, customHandlerKey) {
- var _this3 = this;
+ var _this2 = this;
var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
var player = this.player;
var customHandler = player.config.listeners[customHandlerKey];
var hasCustomHandler = is$1.function(customHandler);
on.call(player, element, type, function (event) {
- return _this3.proxy(event, defaultHandler, customHandlerKey);
+ return _this2.proxy(event, defaultHandler, customHandlerKey);
}, passive && !hasCustomHandler);
} // Listen for control events
}, {
key: "controls",
value: function controls$1() {
- var _this4 = this;
+ var _this3 = this;
var player = this.player;
var elements = player.elements; // IE doesn't support input event, so we fallback to change
@@ -10738,7 +10740,7 @@ typeof navigator === "object" && (function (global, factory) {
if (elements.buttons.play) {
Array.from(elements.buttons.play).forEach(function (button) {
- _this4.bind(button, 'click', player.togglePlay, 'play');
+ _this3.bind(button, 'click', player.togglePlay, 'play');
});
} // Pause
@@ -10845,7 +10847,7 @@ typeof navigator === "object" && (function (global, factory) {
if (browser.isIos) {
var inputs = getElements.call(player, 'input[type="range"]');
Array.from(inputs).forEach(function (input) {
- return _this4.bind(input, inputEvent, function (event) {
+ return _this3.bind(input, inputEvent, function (event) {
return repaint(event.target);
});
});
@@ -10903,7 +10905,7 @@ typeof navigator === "object" && (function (global, factory) {
if (browser.isWebkit) {
Array.from(getElements.call(player, 'input[type="range"]')).forEach(function (element) {
- _this4.bind(element, 'input', function (event) {
+ _this3.bind(element, 'input', function (event) {
return controls.updateRangeFill.call(player, event.target);
});
});
@@ -10939,7 +10941,6 @@ typeof navigator === "object" && (function (global, factory) {
this.bind(elements.controls, 'focusin', function () {
var config = player.config,
- elements = player.elements,
timers = player.timers; // Skip transition to prevent focus from scrolling the parent element
toggleClass(elements.controls, config.classNames.noTransition, true); // Toggle
@@ -10950,7 +10951,7 @@ typeof navigator === "object" && (function (global, factory) {
toggleClass(elements.controls, config.classNames.noTransition, false);
}, 0); // Delay a little more for mouse users
- var delay = _this4.touch ? 3000 : 4000; // Clear timer
+ var delay = _this3.touch ? 3000 : 4000; // Clear timer
clearTimeout(timers.controls); // Hide again after delay
@@ -10989,6 +10990,7 @@ typeof navigator === "object" && (function (global, factory) {
}();
var defineProperty$5 = objectDefineProperty.f;
+
var FunctionPrototype = Function.prototype;
var FunctionPrototypeToString = FunctionPrototype.toString;
var nameRE = /^\s*function ([^ (]*)/;
@@ -11402,13 +11404,13 @@ typeof navigator === "object" && (function (global, factory) {
// Add embed class for responsive
toggleClass(this.elements.wrapper, this.config.classNames.embed, true); // Set intial ratio
- setAspectRatio.call(this); // Load the API if not already
+ setAspectRatio.call(this); // Load the SDK if not already
if (!is$1.object(window.Vimeo)) {
loadScript(this.config.urls.vimeo.sdk).then(function () {
vimeo.ready.call(_this);
}).catch(function (error) {
- _this.debug.warn('Vimeo API failed to load', error);
+ _this.debug.warn('Vimeo SDK (player.js) failed to load', error);
});
} else {
vimeo.ready.call(this);
@@ -11587,7 +11589,7 @@ typeof navigator === "object" && (function (global, factory) {
var currentSrc;
player.embed.getVideoUrl().then(function (value) {
currentSrc = value;
- controls.setDownloadLink.call(player);
+ controls.setDownloadUrl.call(player);
}).catch(function (error) {
_this2.debug.warn(error);
});
@@ -11608,7 +11610,7 @@ typeof navigator === "object" && (function (global, factory) {
width = _dimensions[0],
height = _dimensions[1];
- player.embed.ratio = "".concat(width, ":").concat(height);
+ player.embed.ratio = [width, height];
setAspectRatio.call(_this2);
}); // Set autopause
@@ -11747,9 +11749,7 @@ typeof navigator === "object" && (function (global, factory) {
var _this = this;
// Add embed class for responsive
- toggleClass(this.elements.wrapper, this.config.classNames.embed, true); // Set aspect ratio
-
- setAspectRatio.call(this); // Setup API
+ toggleClass(this.elements.wrapper, this.config.classNames.embed, true); // Setup API
if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
youtube.ready.call(this);
@@ -11777,32 +11777,24 @@ typeof navigator === "object" && (function (global, factory) {
getTitle: function getTitle(videoId) {
var _this2 = this;
- // Try via undocumented API method first
- // This method disappears now and then though...
- // https://github.com/sampotts/plyr/issues/709
- if (is$1.function(this.embed.getVideoData)) {
- var _this$embed$getVideoD = this.embed.getVideoData(),
- title = _this$embed$getVideoD.title;
-
- if (is$1.empty(title)) {
- this.config.title = title;
- ui.setTitle.call(this);
- return;
- }
- } // Or via Google API
+ var url = format(this.config.urls.youtube.api, videoId);
+ fetch(url).then(function (data) {
+ if (is$1.object(data)) {
+ var title = data.title,
+ height = data.height,
+ width = data.width; // Set title
+ _this2.config.title = title;
+ ui.setTitle.call(_this2); // Set aspect ratio
- var key = this.config.keys.google;
+ _this2.embed.ratio = [width, height];
+ }
- if (is$1.string(key) && !is$1.empty(key)) {
- var url = format(this.config.urls.youtube.api, videoId, key);
- fetch(url).then(function (result) {
- if (is$1.object(result)) {
- _this2.config.title = result.items[0].snippet.title;
- ui.setTitle.call(_this2);
- }
- }).catch(function () {});
- }
+ setAspectRatio.call(_this2);
+ }).catch(function () {
+ // Set aspect ratio
+ setAspectRatio.call(_this2);
+ });
},
// API ready
ready: function ready() {
@@ -11833,8 +11825,8 @@ typeof navigator === "object" && (function (global, factory) {
});
player.media = replaceElement(container, player.media); // Id to poster wrapper
- var posterSrc = function posterSrc(format) {
- return "https://i.ytimg.com/vi/".concat(videoId, "/").concat(format, "default.jpg");
+ var posterSrc = function posterSrc(s) {
+ return "https://i.ytimg.com/vi/".concat(videoId, "/").concat(s, "default.jpg");
}; // Check thumbnail images in order of quality, but reject fallback thumbnails (120px wide)
@@ -11847,9 +11839,9 @@ typeof navigator === "object" && (function (global, factory) {
}) // 360p padded 4:3. Always exists
.then(function (image) {
return ui.setPoster.call(player, image.src);
- }).then(function (posterSrc) {
+ }).then(function (src) {
// If the image is padded, use background-size "cover" instead (like youtube does too with their posters)
- if (!posterSrc.includes('maxres')) {
+ if (!src.includes('maxres')) {
player.elements.poster.style.backgroundSize = 'cover';
}
}).catch(function () {});
@@ -12159,6 +12151,20 @@ typeof navigator === "object" && (function (global, factory) {
}
};
+ var destroy = function destroy(instance) {
+ // Destroy our adsManager
+ if (instance.manager) {
+ instance.manager.destroy();
+ } // Destroy our adsManager
+
+
+ if (instance.elements.displayContainer) {
+ instance.elements.displayContainer.destroy();
+ }
+
+ instance.elements.container.remove();
+ };
+
var Ads =
/*#__PURE__*/
function () {
@@ -12206,18 +12212,20 @@ typeof navigator === "object" && (function (global, factory) {
value: function load() {
var _this2 = this;
- if (this.enabled) {
- // Check if the Google IMA3 SDK is loaded or load it ourselves
- if (!is$1.object(window.google) || !is$1.object(window.google.ima)) {
- loadScript(this.player.config.urls.googleIMA.sdk).then(function () {
- _this2.ready();
- }).catch(function () {
- // Script failed to load or is blocked
- _this2.trigger('error', new Error('Google IMA SDK failed to load'));
- });
- } else {
- this.ready();
- }
+ if (!this.enabled) {
+ return;
+ } // Check if the Google IMA3 SDK is loaded or load it ourselves
+
+
+ if (!is$1.object(window.google) || !is$1.object(window.google.ima)) {
+ loadScript(this.player.config.urls.googleIMA.sdk).then(function () {
+ _this2.ready();
+ }).catch(function () {
+ // Script failed to load or is blocked
+ _this2.trigger('error', new Error('Google IMA SDK failed to load'));
+ });
+ } else {
+ this.ready();
}
}
/**
@@ -12229,8 +12237,13 @@ typeof navigator === "object" && (function (global, factory) {
value: function ready() {
var _this3 = this;
- // Start ticking our safety timer. If the whole advertisement
+ // Double check we're enabled
+ if (!this.enabled) {
+ destroy(this);
+ } // Start ticking our safety timer. If the whole advertisement
// thing doesn't resolve within our set time; we bail
+
+
this.startSafetyTimer(12000, 'ready()'); // Clear the safety timer
this.managerPromise.then(function () {
@@ -12360,9 +12373,7 @@ typeof navigator === "object" && (function (global, factory) {
this.manager = event.getAdsManager(this.player, settings); // Get the cue points for any mid-rolls by filtering out the pre- and post-roll
- this.cuePoints = this.manager.getCuePoints(); // Set volume to match player
-
- this.manager.setVolume(this.player.volume); // Add listeners to the required events
+ this.cuePoints = this.manager.getCuePoints(); // Add listeners to the required events
// Advertisement error events
this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function (error) {
@@ -12370,8 +12381,8 @@ typeof navigator === "object" && (function (global, factory) {
}); // Advertisement regular events
Object.keys(google.ima.AdEvent.Type).forEach(function (type) {
- _this6.manager.addEventListener(google.ima.AdEvent.Type[type], function (event) {
- return _this6.onAdEvent(event);
+ _this6.manager.addEventListener(google.ima.AdEvent.Type[type], function (e) {
+ return _this6.onAdEvent(e);
});
}); // Resolve our adsManager
@@ -12419,17 +12430,17 @@ typeof navigator === "object" && (function (global, factory) {
var adData = event.getAdData(); // Proxy event
var dispatchEvent = function dispatchEvent(type) {
- var event = "ads".concat(type.replace(/_/g, '').toLowerCase());
- triggerEvent.call(_this8.player, _this8.player.media, event);
- };
+ triggerEvent.call(_this8.player, _this8.player.media, "ads".concat(type.replace(/_/g, '').toLowerCase()));
+ }; // Bubble the event
+
+
+ dispatchEvent(event.type);
switch (event.type) {
case google.ima.AdEvent.Type.LOADED:
// This is the first event sent for an ad - it is possible to determine whether the
// ad is a video ad or an overlay
- this.trigger('loaded'); // Bubble event
-
- dispatchEvent(event.type); // Start countdown
+ this.trigger('loaded'); // Start countdown
this.pollCountdown(true);
@@ -12443,11 +12454,15 @@ typeof navigator === "object" && (function (global, factory) {
break;
+ case google.ima.AdEvent.Type.STARTED:
+ // Set volume to match player
+ this.manager.setVolume(this.player.volume);
+ break;
+
case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:
// All ads for the current videos are done. We can now request new advertisements
// in case the video is re-played
- // Fire event
- dispatchEvent(event.type); // TODO: Example for what happens when a next video in a playlist would be loaded.
+ // TODO: Example for what happens when a next video in a playlist would be loaded.
// So here we load a new video when all ads are done.
// Then we load new ads within a new adsManager. When the video
// Is started - after - the ads are loaded, then we get ads.
@@ -12468,7 +12483,6 @@ typeof navigator === "object" && (function (global, factory) {
// };
// TODO: So there is still this thing where a video should only be allowed to start
// playing when the IMA SDK is ready or has failed
-
this.loadAds();
break;
@@ -12476,7 +12490,6 @@ typeof navigator === "object" && (function (global, factory) {
// This event indicates the ad has started - the video player can adjust the UI,
// for example display a pause button and remaining time. Fired when content should
// be paused. This usually happens right before an ad is about to cover the content
- dispatchEvent(event.type);
this.pauseContent();
break;
@@ -12485,19 +12498,10 @@ typeof navigator === "object" && (function (global, factory) {
// appropriate UI actions, such as removing the timer for remaining time detection.
// Fired when content should be resumed. This usually happens when an ad finishes
// or collapses
- dispatchEvent(event.type);
this.pollCountdown();
this.resumeContent();
break;
- case google.ima.AdEvent.Type.STARTED:
- case google.ima.AdEvent.Type.MIDPOINT:
- case google.ima.AdEvent.Type.COMPLETE:
- case google.ima.AdEvent.Type.IMPRESSION:
- case google.ima.AdEvent.Type.CLICK:
- dispatchEvent(event.type);
- break;
-
case google.ima.AdEvent.Type.LOG:
if (adData.adError) {
this.player.debug.warn("Non-fatal ad error: ".concat(adData.adError.getMessage()));
@@ -12582,7 +12586,10 @@ typeof navigator === "object" && (function (global, factory) {
this.managerPromise.then(function () {
- // Initialize the container. Must be done via a user action on mobile devices
+ // Set volume to match player
+ _this10.manager.setVolume(_this10.player.volume); // Initialize the container. Must be done via a user action on mobile devices
+
+
_this10.elements.displayContainer.initialize();
try {
@@ -13100,7 +13107,10 @@ typeof navigator === "object" && (function (global, factory) {
timeContainer.appendChild(this.elements.thumb.time);
this.elements.thumb.container.appendChild(timeContainer); // Inject the whole thumb
- this.player.elements.progress.appendChild(this.elements.thumb.container); // Create HTML element: plyr__preview-scrubbing-container
+ if (is$1.element(this.player.elements.progress)) {
+ this.player.elements.progress.appendChild(this.elements.thumb.container);
+ } // Create HTML element: plyr__preview-scrubbing-container
+
this.elements.scrubbing.container = createElement('div', {
class: this.player.config.classNames.previewThumbnails.scrubbingContainer
@@ -13229,7 +13239,11 @@ typeof navigator === "object" && (function (global, factory) {
if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) {
// Wait 200ms, as the new image can take some time to show on certain browsers (even though it was downloaded before showing). This will prevent flicker, and show some generosity towards slower clients
// First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
- image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
+ extend(image, {
+ dataset: {
+ deleting: true
+ }
+ }); // This has to be set before the timeout - to prevent issues switching between hover and scrub
var currentImageContainer = _this8.currentImageContainer;
setTimeout(function () {
@@ -13407,10 +13421,14 @@ typeof navigator === "object" && (function (global, factory) {
} // Find difference between height and preview container height
- var multiplier = this.thumbContainerHeight / frame.h;
- previewImage.style.height = "".concat(Math.floor(previewImage.naturalHeight * multiplier), "px");
- previewImage.style.width = "".concat(Math.floor(previewImage.naturalWidth * multiplier), "px");
- previewImage.style.left = "-".concat(frame.x * multiplier, "px");
+ var multiplier = this.thumbContainerHeight / frame.h; // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.height = "".concat(Math.floor(previewImage.naturalHeight * multiplier), "px"); // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.width = "".concat(Math.floor(previewImage.naturalWidth * multiplier), "px"); // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.left = "-".concat(frame.x * multiplier, "px"); // eslint-disable-next-line no-param-reassign
+
previewImage.style.top = "-".concat(frame.y * multiplier, "px");
}
}, {
@@ -13609,6 +13627,25 @@ typeof navigator === "object" && (function (global, factory) {
}
};
+ /**
+ * Returns a number whose value is limited to the given range.
+ *
+ * Example: limit the output of this computation to between 0 and 255
+ * (x * 255).clamp(0, 255)
+ *
+ * @param {Number} input
+ * @param {Number} min The lower boundary of the output range
+ * @param {Number} max The upper boundary of the output range
+ * @returns A number in the range [min, max]
+ * @type Number
+ */
+ function clamp() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+ var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 255;
+ return Math.min(Math.max(input, min), max);
+ }
+
// TODO: Use a WeakMap for private globals
// const globals = new WeakMap();
// Plyr instance
@@ -14223,32 +14260,32 @@ typeof navigator === "object" && (function (global, factory) {
}, {
key: "isHTML5",
get: function get() {
- return Boolean(this.provider === providers.html5);
+ return this.provider === providers.html5;
}
}, {
key: "isEmbed",
get: function get() {
- return Boolean(this.isYouTube || this.isVimeo);
+ return this.isYouTube || this.isVimeo;
}
}, {
key: "isYouTube",
get: function get() {
- return Boolean(this.provider === providers.youtube);
+ return this.provider === providers.youtube;
}
}, {
key: "isVimeo",
get: function get() {
- return Boolean(this.provider === providers.vimeo);
+ return this.provider === providers.vimeo;
}
}, {
key: "isVideo",
get: function get() {
- return Boolean(this.type === types.video);
+ return this.type === types.video;
}
}, {
key: "isAudio",
get: function get() {
- return Boolean(this.type === types.audio);
+ return this.type === types.audio;
}
}, {
key: "playing",
@@ -14455,6 +14492,8 @@ typeof navigator === "object" && (function (global, factory) {
}, {
key: "speed",
set: function set(input) {
+ var _this4 = this;
+
var speed = null;
if (is$1.number(input)) {
@@ -14467,26 +14506,18 @@ typeof navigator === "object" && (function (global, factory) {
if (!is$1.number(speed)) {
speed = this.config.speed.selected;
- } // Set min/max
-
+ } // Clamp to min/max
- if (speed < 0.1) {
- speed = 0.1;
- }
-
- if (speed > 2.0) {
- speed = 2.0;
- }
-
- if (!this.config.speed.options.includes(speed)) {
- this.debug.warn("Unsupported speed (".concat(speed, ")"));
- return;
- } // Update config
+ var min = this.minimumSpeed,
+ max = this.maximumSpeed;
+ speed = clamp(speed, min, max); // Update config
this.config.speed.selected = speed; // Set media speed
- this.media.playbackRate = speed;
+ setTimeout(function () {
+ _this4.media.playbackRate = speed;
+ }, 0);
}
/**
* Get current playback speed
@@ -14496,6 +14527,46 @@ typeof navigator === "object" && (function (global, factory) {
return Number(this.media.playbackRate);
}
/**
+ * Get the minimum allowed speed
+ */
+
+ }, {
+ key: "minimumSpeed",
+ get: function get() {
+ if (this.isYouTube) {
+ // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate
+ return Math.min.apply(Math, _toConsumableArray(this.options.speed));
+ }
+
+ if (this.isVimeo) {
+ // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror
+ return 0.5;
+ } // https://stackoverflow.com/a/32320020/1191319
+
+
+ return 0.0625;
+ }
+ /**
+ * Get the maximum allowed speed
+ */
+
+ }, {
+ key: "maximumSpeed",
+ get: function get() {
+ if (this.isYouTube) {
+ // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate
+ return Math.max.apply(Math, _toConsumableArray(this.options.speed));
+ }
+
+ if (this.isVimeo) {
+ // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror
+ return 2;
+ } // https://stackoverflow.com/a/32320020/1191319
+
+
+ return 16;
+ }
+ /**
* Set playback quality
* Currently HTML5 & YouTube only
* @param {Number} input - Quality level
@@ -14625,6 +14696,18 @@ typeof navigator === "object" && (function (global, factory) {
return is$1.url(download) ? download : this.source;
}
/**
+ * Set the download URL
+ */
+ ,
+ set: function set(input) {
+ if (!is$1.url(input)) {
+ return;
+ }
+
+ this.config.urls.download = input;
+ controls.setDownloadUrl.call(this);
+ }
+ /**
* Set the poster image for a video
* @param {String} input - the URL for the new poster image
*/
@@ -14657,6 +14740,10 @@ typeof navigator === "object" && (function (global, factory) {
}, {
key: "ratio",
get: function get() {
+ if (!this.isVideo) {
+ return null;
+ }
+
var ratio = reduceAspectRatio(getAspectRatio.call(this));
return is$1.array(ratio) ? ratio.join(':') : ratio;
}