diff options
Diffstat (limited to 'dist/plyr.polyfilled.mjs')
-rw-r--r-- | dist/plyr.polyfilled.mjs | 2740 |
1 files changed, 1413 insertions, 1327 deletions
diff --git a/dist/plyr.polyfilled.mjs b/dist/plyr.polyfilled.mjs index 9778c237..5e76caf0 100644 --- a/dist/plyr.polyfilled.mjs +++ b/dist/plyr.polyfilled.mjs @@ -50,18 +50,27 @@ typeof navigator === "object" && // Polyfill for creating CustomEvents on IE9/10 } })(); -// 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(); @@ -75,16 +84,16 @@ var descriptors = !fails(function () { 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); +// `Object.prototype.propertyIsEnumerable` method implementation +// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable var f = NASHORN_BUG ? function propertyIsEnumerable(V) { - var descriptor = nativeGetOwnPropertyDescriptor(this, V); + var descriptor = getOwnPropertyDescriptor(this, V); return !!descriptor && descriptor.enumerable; } : nativePropertyIsEnumerable; @@ -107,11 +116,9 @@ var classofRaw = function (it) { return toString.call(it).slice(8, -1); }; -// fallback for non-array-like ES3 and non-enumerable old V8 strings - - var split = ''.split; +// fallback for non-array-like ES3 and non-enumerable old V8 strings var indexedObject = fails(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins @@ -139,25 +146,31 @@ var isObject = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; -// 7.1.1 ToPrimitive(input [, PreferredType]) - +// `ToPrimitive` abstract operation +// https://tc39.github.io/ecma262/#sec-toprimitive // 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) { - if (!isObject(it)) return it; +var toPrimitive = function (input, PREFERRED_STRING) { + if (!isObject(input)) return input; var fn, val; - if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; - if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; - if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; + if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; + if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; 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); +var EXISTS = isObject(document$1) && isObject(document$1.createElement); var documentCreateElement = function (it) { - return exist ? document$1.createElement(it) : {}; + return EXISTS ? document$1.createElement(it) : {}; }; // Thank's IE8 for his funny defineProperty @@ -167,13 +180,15 @@ var ie8DomDefine = !descriptors && !fails(function () { }).a != 7; }); -var nativeGetOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; +var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; -var f$1 = descriptors ? nativeGetOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) { +// `Object.getOwnPropertyDescriptor` method +// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor +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]); }; @@ -190,6 +205,8 @@ var anObject = function (it) { var nativeDefineProperty = Object.defineProperty; +// `Object.defineProperty` method +// https://tc39.github.io/ecma262/#sec-object.defineproperty var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); @@ -213,28 +230,24 @@ var hide = descriptors ? function (object, key, value) { 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)' }); @@ -242,7 +255,7 @@ var store = global$1[SHARED] || setGlobal(SHARED, {}); 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)); @@ -250,19 +263,18 @@ var id = 0; var postfix = Math.random(); var uid = function (key) { - return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + postfix).toString(36)); + return 'Symbol(' + String(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) { @@ -333,7 +345,7 @@ shared('inspectSource', function (it) { 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; @@ -350,6 +362,17 @@ shared('inspectSource', function (it) { }); }); +var path = global_1; + +var aFunction = function (variable) { + return typeof variable == 'function' ? variable : undefined; +}; + +var getBuiltIn = function (namespace, method) { + return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace]) + : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method]; +}; + var ceil = Math.ceil; var floor = Math.floor; @@ -379,11 +402,7 @@ var toAbsoluteIndex = function (index, length) { }; // `Array.prototype.{ indexOf, includes }` methods implementation -// false -> Array#indexOf -// https://tc39.github.io/ecma262/#sec-array.prototype.indexof -// true -> Array#includes -// https://tc39.github.io/ecma262/#sec-array.prototype.includes -var arrayIncludes = function (IS_INCLUDES) { +var createMethod = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIndexedObject($this); var length = toLength(O.length); @@ -396,13 +415,22 @@ var arrayIncludes = function (IS_INCLUDES) { // eslint-disable-next-line no-self-compare if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not - } else for (;length > index; index++) if (IS_INCLUDES || index in O) { - if (O[index] === el) return IS_INCLUDES || index || 0; + } else for (;length > index; index++) { + if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; -var arrayIndexOf = arrayIncludes(false); +var arrayIncludes = { + // `Array.prototype.includes` method + // https://tc39.github.io/ecma262/#sec-array.prototype.includes + includes: createMethod(true), + // `Array.prototype.indexOf` method + // https://tc39.github.io/ecma262/#sec-array.prototype.indexof + indexOf: createMethod(false) +}; + +var indexOf = arrayIncludes.indexOf; var objectKeysInternal = function (object, names) { @@ -413,7 +441,7 @@ var objectKeysInternal = function (object, names) { for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); // Don't enum bug & hidden keys while (names.length > i) if (has(O, key = names[i++])) { - ~arrayIndexOf(result, key) || result.push(key); + ~indexOf(result, key) || result.push(key); } return result; }; @@ -429,10 +457,10 @@ var enumBugKeys = [ 'valueOf' ]; -// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) - var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype'); +// `Object.getOwnPropertyNames` method +// https://tc39.github.io/ecma262/#sec-object.getownpropertynames var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return objectKeysInternal(O, hiddenKeys$1); }; @@ -447,10 +475,8 @@ var objectGetOwnPropertySymbols = { f: f$4 }; -var Reflect = global$1.Reflect; - // all object keys, includes non-enumerable and symbols -var ownKeys = Reflect && Reflect.ownKeys || function ownKeys(it) { +var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { var keys = objectGetOwnPropertyNames.f(anObject(it)); var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; @@ -486,7 +512,7 @@ var POLYFILL = isForced.POLYFILL = 'P'; var isForced_1 = isForced; -var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; +var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; @@ -513,16 +539,16 @@ var _export = function (options, source) { 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); @@ -540,97 +566,46 @@ var _export = function (options, source) { } }; -// 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 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)); -}; - -var defineProperty = objectDefineProperty.f; - -var TO_STRING_TAG = wellKnownSymbol('toStringTag'); - -var setToStringTag = function (it, TAG, STATIC) { - if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) { - defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG }); - } -}; - -var f$5 = wellKnownSymbol; - -var wrappedWellKnownSymbol = { - f: f$5 +// `IsArray` abstract operation +// https://tc39.github.io/ecma262/#sec-isarray +var isArray = Array.isArray || function isArray(arg) { + return classofRaw(arg) == 'Array'; }; -var path = global$1; - -var defineProperty$1 = objectDefineProperty.f; - -var defineWellKnownSymbol = function (NAME) { - var Symbol = path.Symbol || (path.Symbol = {}); - if (!has(Symbol, NAME)) defineProperty$1(Symbol, NAME, { - value: wrappedWellKnownSymbol.f(NAME) - }); +// `ToObject` abstract operation +// https://tc39.github.io/ecma262/#sec-toobject +var toObject = function (argument) { + return Object(requireObjectCoercible(argument)); }; -// 19.1.2.14 / 15.2.3.14 Object.keys(O) - - - +// `Object.keys` method +// https://tc39.github.io/ecma262/#sec-object.keys var objectKeys = Object.keys || function keys(O) { return objectKeysInternal(O, enumBugKeys); }; -// all enumerable object keys, includes symbols -var enumKeys = function (it) { - var result = objectKeys(it); - var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; - if (getOwnPropertySymbols) { - var symbols = getOwnPropertySymbols(it); - var propertyIsEnumerable = objectPropertyIsEnumerable.f; - var i = 0; - var key; - while (symbols.length > i) if (propertyIsEnumerable.call(it, key = symbols[i++])) result.push(key); - } return result; -}; - -// `IsArray` abstract operation -// https://tc39.github.io/ecma262/#sec-isarray -var isArray = Array.isArray || function isArray(arg) { - return classofRaw(arg) == 'Array'; -}; - +// `Object.defineProperties` method +// https://tc39.github.io/ecma262/#sec-object.defineproperties var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = objectKeys(Properties); var length = keys.length; - var i = 0; + var index = 0; var key; - while (length > i) objectDefineProperty.f(O, key = keys[i++], Properties[key]); + while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]); return O; }; -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 html = getBuiltIn('document', 'documentElement'); var IE_PROTO = sharedKey('IE_PROTO'); + var PROTOTYPE = 'prototype'; var Empty = function () { /* empty */ }; @@ -656,6 +631,8 @@ var createDict = function () { return createDict(); }; +// `Object.create` method +// https://tc39.github.io/ecma262/#sec-object.create var objectCreate = Object.create || function create(O, Properties) { var result; if (O !== null) { @@ -670,9 +647,8 @@ var objectCreate = Object.create || function create(O, Properties) { 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 @@ -686,66 +662,180 @@ var getWindowNames = function (it) { } }; -var f$6 = function getOwnPropertyNames(it) { +// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window +var f$5 = function getOwnPropertyNames(it) { return windowNames && toString$1.call(it) == '[object Window]' ? getWindowNames(it) : nativeGetOwnPropertyNames(toIndexedObject(it)); }; var objectGetOwnPropertyNamesExternal = { - f: f$6 + f: f$5 }; -// ECMAScript 6 symbols shim - - - - - - - - - - +var Symbol$1 = global_1.Symbol; +var store$1 = shared('wks'); +var wellKnownSymbol = function (name) { + return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name] + || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name)); +}; +var f$6 = wellKnownSymbol; +var wrappedWellKnownSymbol = { + f: f$6 +}; +var defineProperty = objectDefineProperty.f; +var defineWellKnownSymbol = function (NAME) { + var Symbol = path.Symbol || (path.Symbol = {}); + if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, { + value: wrappedWellKnownSymbol.f(NAME) + }); +}; +var defineProperty$1 = objectDefineProperty.f; +var TO_STRING_TAG = wellKnownSymbol('toStringTag'); +var setToStringTag = function (it, TAG, STATIC) { + if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) { + defineProperty$1(it, TO_STRING_TAG, { configurable: true, value: TAG }); + } +}; +var aFunction$1 = function (it) { + if (typeof it != 'function') { + throw TypeError(String(it) + ' is not a function'); + } return it; +}; +// optional / simple context binding +var bindContext = function (fn, that, length) { + aFunction$1(fn); + if (that === undefined) return fn; + switch (length) { + case 0: return function () { + return fn.call(that); + }; + case 1: return function (a) { + return fn.call(that, a); + }; + case 2: return function (a, b) { + return fn.call(that, a, b); + }; + case 3: return function (a, b, c) { + return fn.call(that, a, b, c); + }; + } + return function (/* ...args */) { + return fn.apply(that, arguments); + }; +}; +var SPECIES = wellKnownSymbol('species'); +// `ArraySpeciesCreate` abstract operation +// https://tc39.github.io/ecma262/#sec-arrayspeciescreate +var arraySpeciesCreate = function (originalArray, length) { + var C; + if (isArray(originalArray)) { + C = originalArray.constructor; + // cross-realm fallback + if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; + else if (isObject(C)) { + C = C[SPECIES]; + if (C === null) C = undefined; + } + } return new (C === undefined ? Array : C)(length === 0 ? 0 : length); +}; +var push = [].push; +// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation +var createMethod$1 = function (TYPE) { + var IS_MAP = TYPE == 1; + var IS_FILTER = TYPE == 2; + var IS_SOME = TYPE == 3; + var IS_EVERY = TYPE == 4; + var IS_FIND_INDEX = TYPE == 6; + var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; + return function ($this, callbackfn, that, specificCreate) { + var O = toObject($this); + var self = indexedObject(O); + var boundFunction = bindContext(callbackfn, that, 3); + var length = toLength(self.length); + var index = 0; + var create = specificCreate || arraySpeciesCreate; + var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; + var value, result; + for (;length > index; index++) if (NO_HOLES || index in self) { + value = self[index]; + result = boundFunction(value, index, O); + if (TYPE) { + if (IS_MAP) target[index] = result; // map + else if (result) switch (TYPE) { + case 3: return true; // some + case 5: return value; // find + case 6: return index; // findIndex + case 2: push.call(target, value); // filter + } else if (IS_EVERY) return false; // every + } + } + return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; + }; +}; +var arrayIteration = { + // `Array.prototype.forEach` method + // https://tc39.github.io/ecma262/#sec-array.prototype.foreach + forEach: createMethod$1(0), + // `Array.prototype.map` method + // https://tc39.github.io/ecma262/#sec-array.prototype.map + map: createMethod$1(1), + // `Array.prototype.filter` method + // https://tc39.github.io/ecma262/#sec-array.prototype.filter + filter: createMethod$1(2), + // `Array.prototype.some` method + // https://tc39.github.io/ecma262/#sec-array.prototype.some + some: createMethod$1(3), + // `Array.prototype.every` method + // https://tc39.github.io/ecma262/#sec-array.prototype.every + every: createMethod$1(4), + // `Array.prototype.find` method + // https://tc39.github.io/ecma262/#sec-array.prototype.find + find: createMethod$1(5), + // `Array.prototype.findIndex` method + // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex + findIndex: createMethod$1(6) +}; + +var $forEach = arrayIteration.forEach; var HIDDEN = sharedKey('hidden'); - var SYMBOL = 'Symbol'; +var PROTOTYPE$1 = 'prototype'; +var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); var setInternalState = internalState.set; var getInternalState = internalState.getterFor(SYMBOL); -var nativeGetOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; +var ObjectPrototype = Object[PROTOTYPE$1]; +var $Symbol = global_1.Symbol; +var JSON$1 = global_1.JSON; +var nativeJSONStringify = JSON$1 && JSON$1.stringify; +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 nativeJSONStringify = JSON$1 && JSON$1.stringify; -var PROTOTYPE$1 = 'prototype'; -var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); var nativePropertyIsEnumerable$1 = objectPropertyIsEnumerable.f; -var SymbolRegistry = shared('symbol-registry'); var AllSymbols = shared('symbols'); var ObjectPrototypeSymbols = shared('op-symbols'); +var StringToSymbolRegistry = shared('string-to-symbol-registry'); +var SymbolToStringRegistry = shared('symbol-to-string-registry'); 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; @@ -754,12 +844,12 @@ var setSymbolDescriptor = descriptors && fails(function () { return objectCreate(nativeDefineProperty$1({}, 'a', { get: function () { return nativeDefineProperty$1(this, 'a', { value: 7 }).a; } })).a != 7; -}) ? function (it, key, D) { - var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$2(ObjectPrototype, key); - if (ObjectPrototypeDescriptor) delete ObjectPrototype[key]; - nativeDefineProperty$1(it, key, D); - if (ObjectPrototypeDescriptor && it !== ObjectPrototype) { - nativeDefineProperty$1(ObjectPrototype, key, ObjectPrototypeDescriptor); +}) ? function (O, P, Attributes) { + var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype, P); + if (ObjectPrototypeDescriptor) delete ObjectPrototype[P]; + nativeDefineProperty$1(O, P, Attributes); + if (ObjectPrototypeDescriptor && O !== ObjectPrototype) { + nativeDefineProperty$1(ObjectPrototype, P, ObjectPrototypeDescriptor); } } : nativeDefineProperty$1; @@ -780,70 +870,73 @@ var isSymbol = nativeSymbol && typeof $Symbol.iterator == 'symbol' ? function (i return Object(it) instanceof $Symbol; }; -var $defineProperty = function defineProperty(it, key, D) { - if (it === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, key, D); - anObject(it); - key = toPrimitive(key, true); - anObject(D); +var $defineProperty = function defineProperty(O, P, Attributes) { + if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes); + anObject(O); + var key = toPrimitive(P, true); + anObject(Attributes); if (has(AllSymbols, key)) { - if (!D.enumerable) { - if (!has(it, HIDDEN)) nativeDefineProperty$1(it, HIDDEN, createPropertyDescriptor(1, {})); - it[HIDDEN][key] = true; + if (!Attributes.enumerable) { + if (!has(O, HIDDEN)) nativeDefineProperty$1(O, HIDDEN, createPropertyDescriptor(1, {})); + O[HIDDEN][key] = true; } else { - if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; - D = objectCreate(D, { enumerable: createPropertyDescriptor(0, false) }); - } return setSymbolDescriptor(it, key, D); - } return nativeDefineProperty$1(it, key, D); + if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false; + Attributes = objectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) }); + } return setSymbolDescriptor(O, key, Attributes); + } return nativeDefineProperty$1(O, key, Attributes); }; -var $defineProperties = function defineProperties(it, P) { - anObject(it); - var keys = enumKeys(P = toIndexedObject(P)); - var i = 0; - var l = keys.length; - var key; - while (l > i) $defineProperty(it, key = keys[i++], P[key]); - return it; +var $defineProperties = function defineProperties(O, Properties) { + anObject(O); + var properties = toIndexedObject(Properties); + var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties)); + $forEach(keys, function (key) { + if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]); + }); + return O; }; -var $create = function create(it, P) { - return P === undefined ? objectCreate(it) : $defineProperties(objectCreate(it), P); +var $create = function create(O, Properties) { + return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties); }; -var $propertyIsEnumerable = function propertyIsEnumerable(key) { - var E = nativePropertyIsEnumerable$1.call(this, key = toPrimitive(key, true)); - if (this === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return false; - return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; +var $propertyIsEnumerable = function propertyIsEnumerable(V) { + var P = toPrimitive(V, true); + var enumerable = nativePropertyIsEnumerable$1.call(this, P); + if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false; + return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true; }; -var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { - it = toIndexedObject(it); - key = toPrimitive(key, true); +var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) { + var it = toIndexedObject(O); + var key = toPrimitive(P, true); if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return; - var D = nativeGetOwnPropertyDescriptor$2(it, key); - if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; - return D; + var descriptor = nativeGetOwnPropertyDescriptor$1(it, key); + if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) { + descriptor.enumerable = true; + } + return descriptor; }; -var $getOwnPropertyNames = function getOwnPropertyNames(it) { - var names = nativeGetOwnPropertyNames$1(toIndexedObject(it)); +var $getOwnPropertyNames = function getOwnPropertyNames(O) { + var names = nativeGetOwnPropertyNames$1(toIndexedObject(O)); var result = []; - var i = 0; - var key; - while (names.length > i) { - if (!has(AllSymbols, key = names[i++]) && !has(hiddenKeys, key)) result.push(key); - } return result; + $forEach(names, function (key) { + if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key); + }); + return result; }; -var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { - var IS_OP = it === ObjectPrototype; - var names = nativeGetOwnPropertyNames$1(IS_OP ? ObjectPrototypeSymbols : toIndexedObject(it)); +var $getOwnPropertySymbols = function getOwnPropertySymbols(O) { + var IS_OBJECT_PROTOTYPE = O === ObjectPrototype; + var names = nativeGetOwnPropertyNames$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O)); var result = []; - var i = 0; - var key; - while (names.length > i) { - if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectPrototype, key) : true)) result.push(AllSymbols[key]); - } return result; + $forEach(names, function (key) { + if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) { + result.push(AllSymbols[key]); + } + }); + return result; }; // `Symbol` constructor @@ -851,7 +944,7 @@ var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { if (!nativeSymbol) { $Symbol = function Symbol() { if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor'); - var description = arguments[0] === undefined ? undefined : String(arguments[0]); + var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]); var tag = uid(description); var setter = function (value) { if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value); @@ -861,6 +954,7 @@ if (!nativeSymbol) { if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter }); return wrap(tag, description); }; + redefine($Symbol[PROTOTYPE$1], 'toString', function toString() { return getInternalState(this).tag; }); @@ -889,25 +983,30 @@ if (!nativeSymbol) { }; } -_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++]); -} +$forEach(objectKeys(WellKnownSymbolsStore), function (name) { + defineWellKnownSymbol(name); +}); _export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, { // `Symbol.for` method // https://tc39.github.io/ecma262/#sec-symbol.for 'for': function (key) { - return has(SymbolRegistry, key += '') - ? SymbolRegistry[key] - : SymbolRegistry[key] = $Symbol(key); + var string = String(key); + if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string]; + var symbol = $Symbol(string); + StringToSymbolRegistry[string] = symbol; + SymbolToStringRegistry[symbol] = string; + return symbol; }, // `Symbol.keyFor` method // https://tc39.github.io/ecma262/#sec-symbol.keyfor keyFor: function keyFor(sym) { if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol'); - for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key; + if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; }, useSetter: function () { USE_SETTER = true; }, useSimple: function () { USE_SETTER = false; } @@ -937,6 +1036,14 @@ _export({ target: 'Object', stat: true, forced: !nativeSymbol }, { 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 () { @@ -950,9 +1057,9 @@ JSON$1 && _export({ target: 'JSON', stat: true, forced: !nativeSymbol || fails(f }) }, { stringify: function stringify(it) { var args = [it]; - var i = 1; + var index = 1; var replacer, $replacer; - while (arguments.length > i) args.push(arguments[i++]); + while (arguments.length > index) args.push(arguments[index++]); $replacer = replacer = args[1]; if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined if (!isArray(replacer)) replacer = function (key, value) { @@ -975,7 +1082,8 @@ hiddenKeys[HIDDEN] = true; 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 @@ -1010,7 +1118,9 @@ if (descriptors && typeof NativeSymbol == 'function' && (!('description' in Nati } }); - _export({ global: true, forced: true }, { Symbol: SymbolWrapper }); + _export({ global: true, forced: true }, { + Symbol: SymbolWrapper + }); } // `Symbol.iterator` well-known symbol @@ -1018,8 +1128,6 @@ if (descriptors && typeof NativeSymbol == 'function' && (!('description' in Nati defineWellKnownSymbol('iterator'); var UNSCOPABLES = wellKnownSymbol('unscopables'); - - var ArrayPrototype = Array.prototype; // Array.prototype[@@unscopables] @@ -1035,25 +1143,17 @@ var addToUnscopables = function (key) { 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; +// `Object.getPrototypeOf` method +// https://tc39.github.io/ecma262/#sec-object.getprototypeof var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) { O = toObject(O); if (has(O, IE_PROTO$1)) return O[IE_PROTO$1]; @@ -1102,44 +1202,42 @@ var returnThis$1 = function () { return this; }; var createIteratorConstructor = function (IteratorConstructor, NAME, next) { var TO_STRING_TAG = NAME + ' Iterator'; IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) }); - setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true); + setToStringTag(IteratorConstructor, TO_STRING_TAG, false); iterators[TO_STRING_TAG] = returnThis$1; return IteratorConstructor; }; -var validateSetPrototypeOfArguments = function (O, proto) { - anObject(O); - if (!isObject(proto) && proto !== null) { - throw TypeError("Can't set " + String(proto) + ' as a prototype'); - } +var aPossiblePrototype = function (it) { + if (!isObject(it) && it !== null) { + throw TypeError("Can't set " + String(it) + ' as a prototype'); + } return it; }; +// `Object.setPrototypeOf` method +// https://tc39.github.io/ecma262/#sec-object.setprototypeof // 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 CORRECT_SETTER = false; var test = {}; var setter; try { setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; setter.call(test, []); - correctSetter = test instanceof Array; + CORRECT_SETTER = test instanceof Array; } catch (error) { /* empty */ } return function setPrototypeOf(O, proto) { - validateSetPrototypeOfArguments(O, proto); - if (correctSetter) setter.call(O, proto); + anObject(O); + aPossiblePrototype(proto); + if (CORRECT_SETTER) setter.call(O, proto); else O.__proto__ = proto; return O; }; }() : 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'; @@ -1181,7 +1279,7 @@ var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAUL } } // Set @@toStringTag to native iterators - setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true); + setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true); } } @@ -1288,29 +1386,27 @@ var createProperty = function (object, key, value) { else object[propertyKey] = value; }; -var SPECIES = wellKnownSymbol('species'); +var SPECIES$1 = wellKnownSymbol('species'); var arrayMethodHasSpeciesSupport = function (METHOD_NAME) { return !fails(function () { var array = []; var constructor = array.constructor = {}; - constructor[SPECIES] = function () { + constructor[SPECIES$1] = function () { return { foo: 1 }; }; return array[METHOD_NAME](Boolean).foo !== 1; }); }; -var SPECIES$1 = wellKnownSymbol('species'); +var SPECIES$2 = wellKnownSymbol('species'); var nativeSlice = [].slice; var max$1 = Math.max; -var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice'); - // `Array.prototype.slice` method // https://tc39.github.io/ecma262/#sec-array.prototype.slice // fallback for not array-like ES3 strings and DOM objects -_export({ target: 'Array', proto: true, forced: !SPECIES_SUPPORT }, { +_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, { slice: function slice(start, end) { var O = toIndexedObject(this); var length = toLength(O.length); @@ -1324,7 +1420,7 @@ _export({ target: 'Array', proto: true, forced: !SPECIES_SUPPORT }, { if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) { Constructor = undefined; } else if (isObject(Constructor)) { - Constructor = Constructor[SPECIES$1]; + Constructor = Constructor[SPECIES$2]; if (Constructor === null) Constructor = undefined; } if (Constructor === Array || Constructor === undefined) { @@ -1388,13 +1484,15 @@ var regexpFlags = function () { if (that.global) result += 'g'; if (that.ignoreCase) result += 'i'; if (that.multiline) result += 'm'; + if (that.dotAll) result += 's'; if (that.unicode) result += 'u'; if (that.sticky) result += 'y'; return result; }; var TO_STRING = 'toString'; -var nativeToString = /./[TO_STRING]; +var RegExpPrototype = RegExp.prototype; +var nativeToString = RegExpPrototype[TO_STRING]; var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); // FF44- RegExp#toString has a wrong name @@ -1405,26 +1503,42 @@ var INCORRECT_NAME = nativeToString.name != TO_STRING; 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 }); } -// CONVERT_TO_STRING: true -> String#at -// CONVERT_TO_STRING: false -> String#codePointAt -var stringAt = function (that, pos, CONVERT_TO_STRING) { - var S = String(requireObjectCoercible(that)); - var position = toInteger(pos); - var size = S.length; - var first, second; - if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; - first = S.charCodeAt(position); - return first < 0xD800 || first > 0xDBFF || position + 1 === size - || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF - ? CONVERT_TO_STRING ? S.charAt(position) : first - : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; +// `String.prototype.{ codePointAt, at }` methods implementation +var createMethod$2 = function (CONVERT_TO_STRING) { + return function ($this, pos) { + var S = String(requireObjectCoercible($this)); + var position = toInteger(pos); + var size = S.length; + var first, second; + if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; + first = S.charCodeAt(position); + return first < 0xD800 || first > 0xDBFF || position + 1 === size + || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF + ? CONVERT_TO_STRING ? S.charAt(position) : first + : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; + }; +}; + +var stringMultibyte = { + // `String.prototype.codePointAt` method + // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat + codeAt: createMethod$2(false), + // `String.prototype.at` method + // https://github.com/mathiasbynens/String.prototype.at + charAt: createMethod$2(true) }; +var charAt = stringMultibyte.charAt; + + + var STRING_ITERATOR = 'String Iterator'; var setInternalState$2 = internalState.set; var getInternalState$2 = internalState.getterFor(STRING_ITERATOR); @@ -1445,17 +1559,11 @@ defineIterator(String, 'String', function (iterated) { var index = state.index; var point; if (index >= string.length) return { value: undefined, done: true }; - point = stringAt(string, index, true); + point = charAt(string, index); state.index += point.length; 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, @@ -1508,26 +1616,7 @@ if (PATCH) { 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 SPECIES$3 = wellKnownSymbol('species'); var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { // #replace needs built-in support for named groups. @@ -1572,7 +1661,7 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) { // RegExp[@@split] doesn't call the regex's exec method, but first creates // a new one. We need to return the patched regex when creating the new one. re.constructor = {}; - re.constructor[SPECIES$2] = function () { return re; }; + re.constructor[SPECIES$3] = function () { return re; }; } re[SYMBOL](''); @@ -1614,126 +1703,149 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) { } }; +var charAt$1 = stringMultibyte.charAt; + +// `AdvanceStringIndex` abstract operation +// https://tc39.github.io/ecma262/#sec-advancestringindex +var advanceStringIndex = function (S, index, unicode) { + return index + (unicode ? charAt$1(S, index).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 @@ -1743,36 +1855,32 @@ var sameValue = Object.is || function is(x, y) { }; // @@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'); @@ -1783,20 +1891,14 @@ var isRegexp = function (it) { return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp'); }; -var aFunction = function (it) { - if (typeof it != 'function') { - throw TypeError(String(it) + ' is not a function'); - } return it; -}; - -var SPECIES$3 = wellKnownSymbol('species'); +var SPECIES$4 = wellKnownSymbol('species'); // `SpeciesConstructor` abstract operation // https://tc39.github.io/ecma262/#sec-speciesconstructor var speciesConstructor = function (O, defaultConstructor) { var C = anObject(O).constructor; var S; - return C === undefined || (S = anObject(C)[SPECIES$3]) == undefined ? defaultConstructor : aFunction(S); + return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction$1(S); }; var arrayPush = [].push; @@ -1807,125 +1909,120 @@ var MAX_UINT32 = 0xFFFFFFFF; 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 @@ -1963,107 +2060,17 @@ var domIterables = { TouchList: 0 }; -// optional / simple context binding -var bindContext = function (fn, that, length) { - aFunction(fn); - if (that === undefined) return fn; - switch (length) { - case 0: return function () { - return fn.call(that); - }; - case 1: return function (a) { - return fn.call(that, a); - }; - case 2: return function (a, b) { - return fn.call(that, a, b); - }; - case 3: return function (a, b, c) { - return fn.call(that, a, b, c); - }; - } - return function (/* ...args */) { - return fn.apply(that, arguments); - }; -}; - -var SPECIES$4 = wellKnownSymbol('species'); +var $forEach$1 = arrayIteration.forEach; -// `ArraySpeciesCreate` abstract operation -// https://tc39.github.io/ecma262/#sec-arrayspeciescreate -var arraySpeciesCreate = function (originalArray, length) { - var C; - if (isArray(originalArray)) { - C = originalArray.constructor; - // cross-realm fallback - if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; - else if (isObject(C)) { - C = C[SPECIES$4]; - if (C === null) C = undefined; - } - } return new (C === undefined ? Array : C)(length === 0 ? 0 : length); -}; - -// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation -// 0 -> Array#forEach -// https://tc39.github.io/ecma262/#sec-array.prototype.foreach -// 1 -> Array#map -// https://tc39.github.io/ecma262/#sec-array.prototype.map -// 2 -> Array#filter -// https://tc39.github.io/ecma262/#sec-array.prototype.filter -// 3 -> Array#some -// https://tc39.github.io/ecma262/#sec-array.prototype.some -// 4 -> Array#every -// https://tc39.github.io/ecma262/#sec-array.prototype.every -// 5 -> Array#find -// https://tc39.github.io/ecma262/#sec-array.prototype.find -// 6 -> Array#findIndex -// https://tc39.github.io/ecma262/#sec-array.prototype.findIndex -var arrayMethods = function (TYPE, specificCreate) { - var IS_MAP = TYPE == 1; - var IS_FILTER = TYPE == 2; - var IS_SOME = TYPE == 3; - var IS_EVERY = TYPE == 4; - var IS_FIND_INDEX = TYPE == 6; - var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; - var create = specificCreate || arraySpeciesCreate; - return function ($this, callbackfn, that) { - var O = toObject($this); - var self = indexedObject(O); - var boundFunction = bindContext(callbackfn, that, 3); - var length = toLength(self.length); - var index = 0; - var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; - var value, result; - for (;length > index; index++) if (NO_HOLES || index in self) { - value = self[index]; - result = boundFunction(value, index, O); - if (TYPE) { - if (IS_MAP) target[index] = result; // map - else if (result) switch (TYPE) { - case 3: return true; // some - case 5: return value; // find - case 6: return index; // findIndex - case 2: target.push(value); // filter - } else if (IS_EVERY) return false; // every - } - } - return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; - }; -}; - -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; +var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) { + return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); +} : [].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 { @@ -2078,7 +2085,7 @@ var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag'); 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 @@ -2105,7 +2112,8 @@ var nativeUrl = !fails(function () { var url = new URL('b?e=1', 'http://a'); var searchParams = url.searchParams; url.pathname = 'c%20d'; - return !searchParams.sort + return (isPure && !url.toJSON) + || !searchParams.sort || url.href !== 'http://a/c%20d?e=1' || searchParams.get('e') !== '1' || String(new URLSearchParams('?a=1')) !== 'a=1' @@ -2125,14 +2133,10 @@ var anInstance = function (it, Constructor, name) { } return it; }; -// 19.1.2.1 Object.assign(target, source, ...) - - - - - var nativeAssign = Object.assign; +// `Object.assign` method +// https://tc39.github.io/ecma262/#sec-object.assign // should work with symbols and should have deterministic property order (V8 bug) var objectAssign = !nativeAssign || fails(function () { var A = {}; @@ -2155,7 +2159,10 @@ var objectAssign = !nativeAssign || fails(function () { 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; @@ -2171,25 +2178,23 @@ var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) { } }; -// 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'] || iterators[classof(it)]; }; -// `Array.from` method +// `Array.from` method implementation // https://tc39.github.io/ecma262/#sec-array.from var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { var O = toObject(arrayLike); @@ -2233,7 +2238,7 @@ var initialBias = 72; 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; @@ -2287,7 +2292,7 @@ var adapt = function (delta, numPoints, firstTime) { var k = 0; delta = firstTime ? floor$2(delta / damp) : delta >> 1; delta += floor$2(delta / numPoints); - for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + for (; delta > baseMinusTMin * tMax >> 1; k += base) { delta = floor$2(delta / baseMinusTMin); } return floor$2(k + (baseMinusTMin + 1) * delta / (delta + skew)); @@ -2359,9 +2364,7 @@ var encode = function (input) { var q = delta; for (var k = base; /* no condition */; k += base) { var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) { - break; - } + if (q < t) break; var qMinusT = q - t; var baseMinusT = base - t; output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT))); @@ -2404,6 +2407,24 @@ var getIterator = function (it) { } return anObject(iteratorMethod.call(it)); }; +// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` + + + + + + + + + + + + + + + + + var ITERATOR$6 = wellKnownSymbol('iterator'); var URL_SEARCH_PARAMS = 'URLSearchParams'; var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator'; @@ -2429,10 +2450,14 @@ var percentDecode = function (sequence) { 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; @@ -2457,10 +2482,10 @@ var serialize = function (it) { var parseSearchParams = function (result, query) { if (query) { var attributes = query.split('&'); - var i = 0; + var index = 0; var attribute, entry; - while (i < attributes.length) { - attribute = attributes[i++]; + while (index < attributes.length) { + attribute = attributes[index++]; if (attribute.length) { entry = attribute.split('='); result.push({ @@ -2469,7 +2494,7 @@ var parseSearchParams = function (result, query) { }); } } - } return result; + } }; var updateSearchParams = function (query) { @@ -2509,7 +2534,7 @@ var URLSearchParamsConstructor = function URLSearchParams(/* init */) { setInternalState$3(that, { type: URL_SEARCH_PARAMS, entries: entries, - updateURL: null, + updateURL: function () { /* empty */ }, updateSearchParams: updateSearchParams }); @@ -2543,7 +2568,7 @@ redefineAll(URLSearchParamsPrototype, { validateArgumentsLength(arguments.length, 2); var state = getInternalParamsState(this); state.entries.push({ key: name + '', value: value + '' }); - if (state.updateURL) state.updateURL(); + state.updateURL(); }, // `URLSearchParams.prototype.delete` method // https://url.spec.whatwg.org/#dom-urlsearchparams-delete @@ -2552,12 +2577,12 @@ redefineAll(URLSearchParamsPrototype, { var state = getInternalParamsState(this); var entries = state.entries; var key = name + ''; - var i = 0; - while (i < entries.length) { - if (entries[i].key === key) entries.splice(i, 1); - else i++; + var index = 0; + while (index < entries.length) { + if (entries[index].key === key) entries.splice(index, 1); + else index++; } - if (state.updateURL) state.updateURL(); + state.updateURL(); }, // `URLSearchParams.prototype.get` method // https://url.spec.whatwg.org/#dom-urlsearchparams-get @@ -2565,8 +2590,10 @@ redefineAll(URLSearchParamsPrototype, { validateArgumentsLength(arguments.length, 1); var entries = getInternalParamsState(this).entries; var key = name + ''; - var i = 0; - for (; i < entries.length; i++) if (entries[i].key === key) return entries[i].value; + var index = 0; + for (; index < entries.length; index++) { + if (entries[index].key === key) return entries[index].value; + } return null; }, // `URLSearchParams.prototype.getAll` method @@ -2576,8 +2603,10 @@ redefineAll(URLSearchParamsPrototype, { var entries = getInternalParamsState(this).entries; var key = name + ''; var result = []; - var i = 0; - for (; i < entries.length; i++) if (entries[i].key === key) result.push(entries[i].value); + var index = 0; + for (; index < entries.length; index++) { + if (entries[index].key === key) result.push(entries[index].value); + } return result; }, // `URLSearchParams.prototype.has` method @@ -2586,8 +2615,10 @@ redefineAll(URLSearchParamsPrototype, { validateArgumentsLength(arguments.length, 1); var entries = getInternalParamsState(this).entries; var key = name + ''; - var i = 0; - while (i < entries.length) if (entries[i++].key === key) return true; + var index = 0; + while (index < entries.length) { + if (entries[index++].key === key) return true; + } return false; }, // `URLSearchParams.prototype.set` method @@ -2599,12 +2630,12 @@ redefineAll(URLSearchParamsPrototype, { var found = false; var key = name + ''; var val = value + ''; - var i = 0; + var index = 0; var entry; - for (; i < entries.length; i++) { - entry = entries[i]; + for (; index < entries.length; index++) { + entry = entries[index]; if (entry.key === key) { - if (found) entries.splice(i--, 1); + if (found) entries.splice(index--, 1); else { found = true; entry.value = val; @@ -2612,7 +2643,7 @@ redefineAll(URLSearchParamsPrototype, { } } if (!found) entries.push({ key: key, value: val }); - if (state.updateURL) state.updateURL(); + state.updateURL(); }, // `URLSearchParams.prototype.sort` method // https://url.spec.whatwg.org/#dom-urlsearchparams-sort @@ -2621,26 +2652,28 @@ redefineAll(URLSearchParamsPrototype, { var entries = state.entries; // Array#sort is not stable in some engines var slice = entries.slice(); - var entry, i, j; + var entry, entriesIndex, sliceIndex; entries.length = 0; - for (i = 0; i < slice.length; i++) { - entry = slice[i]; - for (j = 0; j < i; j++) if (entries[j].key > entry.key) { - entries.splice(j, 0, entry); - break; + for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) { + entry = slice[sliceIndex]; + for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) { + if (entries[entriesIndex].key > entry.key) { + entries.splice(entriesIndex, 0, entry); + break; + } } - if (j === i) entries.push(entry); + if (entriesIndex === sliceIndex) entries.push(entry); } - if (state.updateURL) state.updateURL(); + state.updateURL(); }, // `URLSearchParams.prototype.forEach` method forEach: function forEach(callback /* , thisArg */) { var entries = getInternalParamsState(this).entries; var boundFunction = bindContext(callback, arguments.length > 1 ? arguments[1] : undefined, 3); - var i = 0; + var index = 0; var entry; - while (i < entries.length) { - entry = entries[i++]; + while (index < entries.length) { + entry = entries[index++]; boundFunction(entry.value, entry.key, this); } }, @@ -2666,10 +2699,10 @@ redefine(URLSearchParamsPrototype, ITERATOR$6, URLSearchParamsPrototype.entries) redefine(URLSearchParamsPrototype, 'toString', function toString() { var entries = getInternalParamsState(this).entries; var result = []; - var i = 0; + var index = 0; var entry; - while (i < entries.length) { - entry = entries[i++]; + while (index < entries.length) { + entry = entries[index++]; result.push(serialize(entry.key) + '=' + serialize(entry.value)); } return result.join('&'); }, { enumerable: true }); @@ -2685,7 +2718,8 @@ var web_urlSearchParams = { getState: getInternalParamsState }; -var NativeURL = global$1.URL; +// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` + @@ -2695,11 +2729,19 @@ var NativeURL = global$1.URL; + +var codeAt = stringMultibyte.codeAt; + + + + + +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 floor$3 = Math.floor; var pow = Math.pow; var INVALID_AUTHORITY = 'Invalid authority'; @@ -2707,25 +2749,25 @@ var INVALID_SCHEME = 'Invalid scheme'; 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) { - var result, codePoints, i; + var result, codePoints, index; if (input.charAt(0) == '[') { if (input.charAt(input.length - 1) != ']') return INVALID_HOST; result = parseIPv6(input.slice(1, -1)); @@ -2736,7 +2778,9 @@ var parseHost = function (url, input) { if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST; result = ''; codePoints = arrayFrom(input); - for (i = 0; i < codePoints.length; i++) result += percentEncode(codePoints[i], C0ControlPercentEncodeSet); + for (index = 0; index < codePoints.length; index++) { + result += percentEncode(codePoints[index], C0ControlPercentEncodeSet); + } url.host = result; } else { input = punycodeToAscii(input); @@ -2749,38 +2793,38 @@ var parseHost = function (url, input) { var parseIPv4 = function (input) { var parts = input.split('.'); - var partsLength, numbers, i, part, R, n, ipv4; - if (parts[parts.length - 1] == '') { - if (parts.length) parts.pop(); + var partsLength, numbers, index, part, radix, number, ipv4; + if (parts.length && parts[parts.length - 1] == '') { + parts.pop(); } partsLength = parts.length; if (partsLength > 4) return input; numbers = []; - for (i = 0; i < partsLength; i++) { - part = parts[i]; + for (index = 0; index < partsLength; index++) { + part = parts[index]; if (part == '') return input; - R = 10; + radix = 10; if (part.length > 1 && part.charAt(0) == '0') { - R = HEX_START.test(part) ? 16 : 8; - part = part.slice(R == 8 ? 1 : 2); + radix = HEX_START.test(part) ? 16 : 8; + part = part.slice(radix == 8 ? 1 : 2); } if (part === '') { - n = 0; + number = 0; } else { - if (!(R == 10 ? DEC : R == 8 ? OCT : HEX).test(part)) return input; - n = parseInt(part, R); + if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) return input; + number = parseInt(part, radix); } - numbers.push(n); + numbers.push(number); } - for (i = 0; i < partsLength; i++) { - n = numbers[i]; - if (i == partsLength - 1) { - if (n >= pow(256, 5 - partsLength)) return null; - } else if (n > 255) return null; + for (index = 0; index < partsLength; index++) { + number = numbers[index]; + if (index == partsLength - 1) { + if (number >= pow(256, 5 - partsLength)) return null; + } else if (number > 255) return null; } ipv4 = numbers.pop(); - for (i = 0; i < numbers.length; i++) { - ipv4 += numbers[i] * pow(256, 3 - i); + for (index = 0; index < numbers.length; index++) { + ipv4 += numbers[index] * pow(256, 3 - index); } return ipv4; }; @@ -2867,9 +2911,9 @@ var findLongestZeroSequence = function (ipv6) { var maxLength = 1; var currStart = null; var currLength = 0; - var i = 0; - for (; i < 8; i++) { - if (ipv6[i] !== 0) { + var index = 0; + for (; index < 8; index++) { + if (ipv6[index] !== 0) { if (currLength > maxLength) { maxIndex = currStart; maxLength = currLength; @@ -2877,7 +2921,7 @@ var findLongestZeroSequence = function (ipv6) { currStart = null; currLength = 0; } else { - if (currStart === null) currStart = i; + if (currStart === null) currStart = index; ++currLength; } } @@ -2889,27 +2933,27 @@ var findLongestZeroSequence = function (ipv6) { }; var serializeHost = function (host) { - var result, i, compress, ignore0; + var result, index, compress, ignore0; // ipv4 if (typeof host == 'number') { result = []; - for (i = 0; i < 4; i++) { + for (index = 0; index < 4; index++) { result.unshift(host % 256); - host = Math.floor(host / 256); + host = floor$3(host / 256); } return result.join('.'); // ipv6 } else if (typeof host == 'object') { result = ''; compress = findLongestZeroSequence(host); - for (i = 0; i < 8; i++) { - if (ignore0 && host[i] === 0) continue; + for (index = 0; index < 8; index++) { + if (ignore0 && host[index] === 0) continue; if (ignore0) ignore0 = false; - if (compress === i) { - result += i ? ':' : '::'; + if (compress === index) { + result += index ? ':' : '::'; ignore0 = true; } else { - result += host[i].toString(16); - if (i < 7) result += ':'; + result += host[index].toString(16); + if (index < 7) result += ':'; } } return '[' + result + ']'; @@ -2928,7 +2972,7 @@ var userinfoPercentEncodeSet = objectAssign({}, pathPercentEncodeSet, { }); var percentEncode = function (char, set) { - var code = stringAt(char, 0); + var code = codeAt(char, 0); return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char); }; @@ -3052,13 +3096,11 @@ var parseURL = function (url, input, stateOverride, base) { if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) { buffer += char.toLowerCase(); } else if (char == ':') { - if (stateOverride) { - if ( - (isSpecial(url) != has(specialSchemes, buffer)) || - (buffer == 'file' && (includesCredentials(url) || url.port !== null)) || - (url.scheme == 'file' && !url.host) - ) return; - } + if (stateOverride && ( + (isSpecial(url) != has(specialSchemes, buffer)) || + (buffer == 'file' && (includesCredentials(url) || url.port !== null)) || + (url.scheme == 'file' && !url.host) + )) return; url.scheme = buffer; if (stateOverride) { if (isSpecial(url) && specialSchemes[url.scheme] == url.port) url.port = null; @@ -4272,7 +4314,7 @@ var IS_CONCAT_SPREADABLE_SUPPORT = !fails(function () { return array.concat()[0] !== array; }); -var SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('concat'); +var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat'); var isConcatSpreadable = function (O) { if (!isObject(O)) return false; @@ -4280,7 +4322,7 @@ var isConcatSpreadable = function (O) { return spreadable !== undefined ? !!spreadable : isArray(O); }; -var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT$1; +var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; // `Array.prototype.concat` method // https://tc39.github.io/ecma262/#sec-array.prototype.concat @@ -4307,20 +4349,21 @@ _export({ target: 'Array', proto: true, forced: FORCED }, { } }); -var internalFilter = arrayMethods(2); +var $filter = arrayIteration.filter; -var SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('filter'); // `Array.prototype.filter` method // https://tc39.github.io/ecma262/#sec-array.prototype.filter // with adding support of @@species -_export({ target: 'Array', proto: true, forced: !SPECIES_SUPPORT$2 }, { +_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, { filter: function filter(callbackfn /* , thisArg */) { - return internalFilter(this, callbackfn, arguments[1]); + return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); -var internalFind = arrayMethods(5); +var $find = arrayIteration.find; + + var FIND = 'find'; var SKIPS_HOLES = true; @@ -4331,7 +4374,7 @@ if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; }); // https://tc39.github.io/ecma262/#sec-array.prototype.find _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { find: function find(callbackfn /* , that = undefined */) { - return internalFind(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); @@ -4354,6 +4397,8 @@ try { iteratorWithReturn[ITERATOR$7] = function () { return this; }; + // eslint-disable-next-line no-throw-literal + Array.from(iteratorWithReturn, function () { throw 2; }); } catch (error) { /* empty */ } var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) { @@ -4374,6 +4419,7 @@ var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) { }; var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) { + Array.from(iterable); }); // `Array.from` method @@ -4382,38 +4428,45 @@ _export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, { from: arrayFrom }); -var internalIncludes = arrayIncludes(true); +var $includes = arrayIncludes.includes; + // `Array.prototype.includes` method // https://tc39.github.io/ecma262/#sec-array.prototype.includes _export({ target: 'Array', proto: true }, { includes: function includes(el /* , fromIndex = 0 */) { - return internalIncludes(this, el, arguments.length > 1 ? arguments[1] : undefined); + return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); } }); // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('includes'); -var internalMap = arrayMethods(1); +var $map = arrayIteration.map; -var SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('map'); // `Array.prototype.map` method // https://tc39.github.io/ecma262/#sec-array.prototype.map // with adding support of @@species -_export({ target: 'Array', proto: true, forced: !SPECIES_SUPPORT$3 }, { +_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('map') }, { map: function map(callbackfn /* , thisArg */) { - return internalMap(this, callbackfn, arguments[1]); + return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); -var inheritIfRequired = function (that, target, C) { - var S = target.constructor; - var P; - if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && objectSetPrototypeOf) { - objectSetPrototypeOf(that, P); - } return that; +// makes subclassing work correct for wrapped built-ins +var inheritIfRequired = function ($this, dummy, Wrapper) { + var NewTarget, NewTargetPrototype; + if ( + // it can work only with native `setPrototypeOf` + objectSetPrototypeOf && + // we haven't completely correct pre-ES6 way for getting `new.target`, so use this + typeof (NewTarget = dummy.constructor) == 'function' && + NewTarget !== Wrapper && + isObject(NewTargetPrototype = NewTarget.prototype) && + NewTargetPrototype !== Wrapper.prototype + ) objectSetPrototypeOf($this, NewTargetPrototype); + return $this; }; // a string of all valid unicode whitespaces @@ -4424,35 +4477,47 @@ var whitespace = '[' + whitespaces + ']'; var ltrim = RegExp('^' + whitespace + whitespace + '*'); var rtrim = RegExp(whitespace + whitespace + '*$'); -// 1 -> String#trimStart -// 2 -> String#trimEnd -// 3 -> String#trim -var stringTrim = function (string, TYPE) { - string = String(requireObjectCoercible(string)); - if (TYPE & 1) string = string.replace(ltrim, ''); - if (TYPE & 2) string = string.replace(rtrim, ''); - return string; +// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation +var createMethod$3 = function (TYPE) { + return function ($this) { + var string = String(requireObjectCoercible($this)); + if (TYPE & 1) string = string.replace(ltrim, ''); + if (TYPE & 2) string = string.replace(rtrim, ''); + return string; + }; +}; + +var stringTrim = { + // `String.prototype.{ trimLeft, trimStart }` methods + // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart + start: createMethod$3(1), + // `String.prototype.{ trimRight, trimEnd }` methods + // https://tc39.github.io/ecma262/#sec-string.prototype.trimend + end: createMethod$3(2), + // `String.prototype.trim` method + // https://tc39.github.io/ecma262/#sec-string.prototype.trim + trim: createMethod$3(3) }; var getOwnPropertyNames = objectGetOwnPropertyNames.f; -var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; +var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; var defineProperty$3 = objectDefineProperty.f; +var trim = stringTrim.trim; var NUMBER = 'Number'; -var NativeNumber = global$1[NUMBER]; +var NativeNumber = global_1[NUMBER]; var NumberPrototype = NativeNumber.prototype; // Opera ~12 has broken Object#toString var BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER; -var NATIVE_TRIM = 'trim' in String.prototype; // `ToNumber` abstract operation // https://tc39.github.io/ecma262/#sec-tonumber var toNumber = function (argument) { var it = toPrimitive(argument, false); - var first, third, radix, maxCode, digits, length, i, code; + var first, third, radix, maxCode, digits, length, index, code; if (typeof it == 'string' && it.length > 2) { - it = NATIVE_TRIM ? it.trim() : stringTrim(it, 3); + it = trim(it); first = it.charCodeAt(0); if (first === 43 || first === 45) { third = it.charCodeAt(2); @@ -4465,8 +4530,8 @@ var toNumber = function (argument) { } digits = it.slice(2); length = digits.length; - for (i = 0; i < length; i++) { - code = digits.charCodeAt(i); + for (index = 0; index < length; index++) { + code = digits.charCodeAt(index); // parseInt parses a string to a first unavailable symbol // but ToNumber should return NaN if a string contains unavailable symbols if (code < 48 || code > maxCode) return NaN; @@ -4480,26 +4545,26 @@ var toNumber = function (argument) { if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) { var NumberWrapper = function Number(value) { var it = arguments.length < 1 ? 0 : value; - var that = this; - return that instanceof NumberWrapper + var dummy = this; + return dummy instanceof NumberWrapper // check on 1..constructor(foo) case - && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(that); }) : classofRaw(that) != NUMBER) - ? inheritIfRequired(new NativeNumber(toNumber(it)), that, NumberWrapper) : toNumber(it); + && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classofRaw(dummy) != NUMBER) + ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, 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); }); @@ -4512,14 +4577,10 @@ _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { } }); -// helper for String#{startsWith, endsWith, includes} - - - -var validateStringMethodArguments = function (that, searchString, NAME) { - if (isRegexp(searchString)) { - throw TypeError('String.prototype.' + NAME + " doesn't accept regex"); - } return String(requireObjectCoercible(that)); +var notARegexp = function (it) { + if (isRegexp(it)) { + throw TypeError("The method doesn't accept regular expressions"); + } return it; }; var MATCH$1 = wellKnownSymbol('match'); @@ -4536,16 +4597,12 @@ var correctIsRegexpLogic = function (METHOD_NAME) { } 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) - .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); + return !!~String(requireObjectCoercible(this)) + .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined); } }); @@ -4554,11 +4611,11 @@ var freezing = !fails(function () { }); 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 () { @@ -4618,14 +4675,17 @@ var internalMetadata_2 = internalMetadata.fastKey; var internalMetadata_3 = internalMetadata.getWeakData; var internalMetadata_4 = internalMetadata.onFreeze; -var iterate = createCommonjsModule(function (module) { -var BREAK = {}; +var iterate_1 = createCommonjsModule(function (module) { +var Result = function (stopped, result) { + this.stopped = stopped; + this.result = result; +}; -var exports = module.exports = function (iterable, fn, that, ENTRIES, ITERATOR) { - var boundFunction = bindContext(fn, that, ENTRIES ? 2 : 1); +var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) { + var boundFunction = bindContext(fn, that, AS_ENTRIES ? 2 : 1); var iterator, iterFn, index, length, result, step; - if (ITERATOR) { + if (IS_ITERATOR) { iterator = iterable; } else { iterFn = getIteratorMethod(iterable); @@ -4633,21 +4693,110 @@ var exports = module.exports = function (iterable, fn, that, ENTRIES, ITERATOR) // optimisation for array iterators if (isArrayIteratorMethod(iterFn)) { for (index = 0, length = toLength(iterable.length); length > index; index++) { - result = ENTRIES ? boundFunction(anObject(step = iterable[index])[0], step[1]) : boundFunction(iterable[index]); - if (result === BREAK) return BREAK; - } return; + result = AS_ENTRIES + ? boundFunction(anObject(step = iterable[index])[0], step[1]) + : boundFunction(iterable[index]); + if (result && result instanceof Result) return result; + } return new Result(false); } iterator = iterFn.call(iterable); } while (!(step = iterator.next()).done) { - if (callWithSafeIterationClosing(iterator, boundFunction, step.value, ENTRIES) === BREAK) return BREAK; - } + result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES); + if (result && result instanceof Result) return result; + } return new Result(false); }; -exports.BREAK = BREAK; +iterate.stop = function (result) { + return new Result(true, result); +}; }); +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 (dummy, iterable) { + anInstance(dummy, Constructor, CONSTRUCTOR_NAME); + var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor); + if (iterable != undefined) iterate_1(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; @@ -4656,10 +4805,11 @@ var getWeakData = internalMetadata.getWeakData; + var setInternalState$5 = internalState.set; var internalStateGetterFor = internalState.getterFor; -var arrayFind = arrayMethods(5); -var arrayFindIndex = arrayMethods(6); +var find$1 = arrayIteration.find; +var findIndex = arrayIteration.findIndex; var id$1 = 0; // fallback for uncaught frozen keys @@ -4672,7 +4822,7 @@ var UncaughtFrozenStore = function () { }; var findUncaughtFrozen = function (store, key) { - return arrayFind(store.entries, function (it) { + return find$1(store.entries, function (it) { return it[0] === key; }); }; @@ -4691,7 +4841,7 @@ UncaughtFrozenStore.prototype = { else this.entries.push([key, value]); }, 'delete': function (key) { - var index = arrayFindIndex(this.entries, function (it) { + var index = findIndex(this.entries, function (it) { return it[0] === key; }); if (~index) this.entries.splice(index, 1); @@ -4708,7 +4858,7 @@ var collectionWeak = { id: id$1++, frozen: undefined }); - if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP); + if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP); }); var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); @@ -4767,105 +4917,23 @@ var collectionWeak = { } }; -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; var wrapper = function (get) { return function WeakMap() { - return get(this, arguments.length > 0 ? arguments[0] : undefined); + return get(this, arguments.length ? arguments[0] : undefined); }; }; @@ -4920,7 +4988,9 @@ if (nativeWeakMap && IS_IE11) { // `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'; @@ -4932,13 +5002,14 @@ var forcedStringTrimMethod = function (METHOD_NAME) { }); }; -var FORCED$1 = forcedStringTrimMethod('trim'); +var $trim = stringTrim.trim; + // `String.prototype.trim` method // https://tc39.github.io/ecma262/#sec-string.prototype.trim -_export({ target: 'String', proto: true, forced: FORCED$1 }, { +_export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, { trim: function trim() { - return stringTrim(this, 3); + return $trim(this); } }); @@ -4963,39 +5034,7 @@ var stringRepeat = ''.repeat || function repeat(count) { }; var nativeToFixed = 1.0.toFixed; -var floor$3 = Math.floor; -var data$1 = [0, 0, 0, 0, 0, 0]; - -var multiply = function (n, c) { - var i = -1; - var c2 = c; - while (++i < 6) { - c2 += n * data$1[i]; - data$1[i] = c2 % 1e7; - c2 = floor$3(c2 / 1e7); - } -}; - -var divide = function (n) { - var i = 6; - var c = 0; - while (--i >= 0) { - c += data$1[i]; - data$1[i] = floor$3(c / n); - c = (c % n) * 1e7; - } -}; - -var numToString = function () { - var i = 6; - var s = ''; - while (--i >= 0) { - if (s !== '' || i === 0 || data$1[i] !== 0) { - var t = String(data$1[i]); - s = s === '' ? t : s + stringRepeat.call('0', 7 - t.length) + t; - } - } return s; -}; +var floor$4 = Math.floor; var pow$1 = function (x, n, acc) { return n === 0 ? acc : n % 2 === 1 ? pow$1(x, n - 1, acc * x) : pow$1(x * x, n / 2, acc); @@ -5014,9 +5053,7 @@ var log = function (x) { } return n; }; -// `Number.prototype.toFixed` method -// https://tc39.github.io/ecma262/#sec-number.prototype.tofixed -_export({ target: 'Number', proto: true, forced: nativeToFixed && ( +var FORCED$1 = nativeToFixed && ( 0.00008.toFixed(3) !== '0.000' || 0.9.toFixed(0) !== '1' || 1.255.toFixed(2) !== '1.25' || @@ -5024,29 +5061,67 @@ _export({ target: 'Number', proto: true, forced: nativeToFixed && ( ) || !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$1 }, { + // eslint-disable-next-line max-statements toFixed: function toFixed(fractionDigits) { - var x = thisNumberValue(this); - var f = toInteger(fractionDigits); - var s = ''; - var m = '0'; + var number = thisNumberValue(this); + var fractDigits = toInteger(fractionDigits); + var data = [0, 0, 0, 0, 0, 0]; + var sign = ''; + var result = '0'; var e, z, j, k; - if (f < 0 || f > 20) throw RangeError('Incorrect fraction digits'); + + var multiply = function (n, c) { + var index = -1; + var c2 = c; + while (++index < 6) { + c2 += n * data[index]; + data[index] = c2 % 1e7; + c2 = floor$4(c2 / 1e7); + } + }; + + var divide = function (n) { + var index = 6; + var c = 0; + while (--index >= 0) { + c += data[index]; + data[index] = floor$4(c / n); + c = (c % n) * 1e7; + } + }; + + var dataToString = function () { + var index = 6; + var s = ''; + while (--index >= 0) { + if (s !== '' || index === 0 || data[index] !== 0) { + var t = String(data[index]); + s = s === '' ? t : s + stringRepeat.call('0', 7 - t.length) + t; + } + } return s; + }; + + if (fractDigits < 0 || fractDigits > 20) throw RangeError('Incorrect fraction digits'); // eslint-disable-next-line no-self-compare - if (x != x) return 'NaN'; - if (x <= -1e21 || x >= 1e21) return String(x); - if (x < 0) { - s = '-'; - x = -x; - } - if (x > 1e-21) { - e = log(x * pow$1(2, 69, 1)) - 69; - z = e < 0 ? x * pow$1(2, -e, 1) : x / pow$1(2, e, 1); + if (number != number) return 'NaN'; + if (number <= -1e21 || number >= 1e21) return String(number); + if (number < 0) { + sign = '-'; + number = -number; + } + if (number > 1e-21) { + e = log(number * pow$1(2, 69, 1)) - 69; + z = e < 0 ? number * pow$1(2, -e, 1) : number / pow$1(2, e, 1); z *= 0x10000000000000; e = 52 - e; if (e > 0) { multiply(0, z); - j = f; + j = fractDigits; while (j >= 7) { multiply(1e7, 0); j -= 7; @@ -5060,51 +5135,71 @@ _export({ target: 'Number', proto: true, forced: nativeToFixed && ( divide(1 << j); multiply(1, 1); divide(2); - m = numToString(); + result = dataToString(); } else { multiply(0, z); multiply(1 << -e, 0); - m = numToString() + stringRepeat.call('0', f); + result = dataToString() + stringRepeat.call('0', fractDigits); } } - if (f > 0) { - k = m.length; - m = s + (k <= f ? '0.' + stringRepeat.call('0', f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f)); + if (fractDigits > 0) { + k = result.length; + result = sign + (k <= fractDigits + ? '0.' + stringRepeat.call('0', fractDigits - k) + result + : result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits)); } else { - m = s + m; - } return m; + result = sign + result; + } return result; } }); var propertyIsEnumerable = objectPropertyIsEnumerable.f; -// TO_ENTRIES: true -> Object.entries -// TO_ENTRIES: false -> Object.values -var objectToArray = function (it, TO_ENTRIES) { - var O = toIndexedObject(it); - var keys = objectKeys(O); - var length = keys.length; - 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; +// `Object.{ entries, values }` methods implementation +var createMethod$4 = function (TO_ENTRIES) { + return function (it) { + var O = toIndexedObject(it); + var keys = objectKeys(O); + var length = keys.length; + var i = 0; + var result = []; + var key; + while (length > i) { + key = keys[i++]; + if (!descriptors || propertyIsEnumerable.call(O, key)) { + result.push(TO_ENTRIES ? [key, O[key]] : O[key]); + } + } + return result; + }; }; +var objectToArray = { + // `Object.entries` method + // https://tc39.github.io/ecma262/#sec-object.entries + entries: createMethod$4(true), + // `Object.values` method + // https://tc39.github.io/ecma262/#sec-object.values + values: createMethod$4(false) +}; + +var $entries = objectToArray.entries; + // `Object.entries` method // https://tc39.github.io/ecma262/#sec-object.entries _export({ target: 'Object', stat: true }, { entries: function entries(O) { - return objectToArray(O, true); + return $entries(O); } }); +var $values = objectToArray.values; + // `Object.values` method // https://tc39.github.io/ecma262/#sec-object.values _export({ target: 'Object', stat: true }, { values: function values(O) { - return objectToArray(O); + return $values(O); } }); @@ -5219,45 +5314,41 @@ var is = { }; // @@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) { @@ -5474,18 +5565,32 @@ function () { 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 SPECIES$5 = wellKnownSymbol('species'); + +var setSpecies = function (CONSTRUCTOR_NAME) { + var Constructor = getBuiltIn(CONSTRUCTOR_NAME); + var defineProperty = objectDefineProperty.f; + + if (descriptors && Constructor && !Constructor[SPECIES$5]) { + defineProperty(Constructor, 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]; @@ -5494,8 +5599,19 @@ var run = function () { } }; +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: @@ -5517,12 +5633,12 @@ if (!set$1 || !clear) { // 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) { @@ -5532,23 +5648,21 @@ if (!set$1 || !clear) { 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); }; } } @@ -5558,20 +5672,19 @@ var task = { clear: clear }; -var navigator$1 = global$1.navigator; - -var userAgent = navigator$1 && navigator$1.userAgent || ''; +var userAgent = getBuiltIn('navigator', '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; @@ -5601,7 +5714,7 @@ if (!queueMicrotask) { 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 @@ -5624,7 +5737,7 @@ if (!queueMicrotask) { } else { notify = function () { // strange IE + webpack dev server bug - use .call(global) - macrotask.call(global$1, flush); + macrotask.call(global_1, flush); }; } } @@ -5638,9 +5751,6 @@ var microtask = queueMicrotask || function (fn) { } last = task; }; -// 25.4.1.5 NewPromiseCapability(C) - - var PromiseCapability = function (C) { var resolve, reject; this.promise = new C(function ($$resolve, $$reject) { @@ -5648,10 +5758,11 @@ var PromiseCapability = function (C) { resolve = $$resolve; reject = $$reject; }); - this.resolve = aFunction(resolve); - this.reject = aFunction(reject); + this.resolve = aFunction$1(resolve); + this.reject = aFunction$1(reject); }; +// 25.4.1.5 NewPromiseCapability(C) var f$7 = function (C) { return new PromiseCapability(C); }; @@ -5670,7 +5781,7 @@ var promiseResolve = function (C, x) { }; 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); } @@ -5684,38 +5795,11 @@ var perform = function (exec) { } }; -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; @@ -5723,22 +5807,21 @@ var task$1 = task.set; 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$2 = 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$2 && document$2.createEvent && global_1.dispatchEvent); var UNHANDLED_REJECTION = 'unhandledrejection'; var REJECTION_HANDLED = 'rejectionhandled'; var PENDING = 0; @@ -5783,8 +5866,10 @@ var notify$1 = function (promise, state, isReject) { microtask(function () { var value = state.value; var ok = state.state == FULFILLED; - var i = 0; - var run = function (reaction) { + var index = 0; + // variable length - can't use forEach + while (chain.length > index) { + var reaction = chain[index++]; var handler = ok ? reaction.ok : reaction.fail; var resolve = reaction.resolve; var reject = reaction.reject; @@ -5799,7 +5884,7 @@ var notify$1 = function (promise, state, isReject) { if (handler === true) result = value; else { if (domain) domain.enter(); - result = handler(value); // may throw + result = handler(value); // can throw if (domain) { domain.exit(); exited = true; @@ -5815,8 +5900,7 @@ var notify$1 = function (promise, state, isReject) { if (domain && !exited) domain.exit(); reject(error); } - }; - while (chain.length > i) run(chain[i++]); // variable length - can't use forEach + } state.reactions = []; state.notified = false; if (isReject && !state.rejection) onUnhandled(promise, state); @@ -5826,18 +5910,18 @@ var notify$1 = function (promise, state, isReject) { var dispatchEvent = function (name, promise, reason) { var event, handler; if (DISPATCH_EVENT) { - event = document$3.createEvent('Event'); + event = document$2.createEvent('Event'); 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; @@ -5859,7 +5943,7 @@ var isUnhandled = function (state) { }; 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); @@ -5915,7 +5999,7 @@ if (FORCED$2) { // 25.4.3.1 Promise(executor) PromiseConstructor = function Promise(executor) { anInstance(this, PromiseConstructor, PROMISE); - aFunction(executor); + aFunction$1(executor); Internal.call(this); var state = getInternalState$3(this); try { @@ -5974,14 +6058,16 @@ if (FORCED$2) { 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$2 }, { + Promise: PromiseConstructor +}); -setToStringTag(PromiseConstructor, PROMISE, false, true); +setToStringTag(PromiseConstructor, PROMISE, false); setSpecies(PROMISE); PromiseWrapper = path[PROMISE]; @@ -6014,15 +6100,16 @@ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION$1 }, { var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { + var $promiseResolve = aFunction$1(C.resolve); var values = []; var counter = 0; var remaining = 1; - iterate(iterable, function (promise) { + iterate_1(iterable, function (promise) { var index = counter++; 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; @@ -6041,8 +6128,9 @@ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION$1 }, { var capability = newPromiseCapability$1(C); var reject = capability.reject; var result = perform(function () { - iterate(iterable, function (promise) { - C.resolve(promise).then(capability.resolve, reject); + var $promiseResolve = aFunction$1(C.resolve); + iterate_1(iterable, function (promise) { + $promiseResolve.call(C, promise).then(capability.resolve, reject); }); }); if (result.error) reject(result.value); @@ -6050,16 +6138,16 @@ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION$1 }, { } }); -var STARTS_WITH = 'startsWith'; -var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegexpLogic(STARTS_WITH); -var nativeStartsWith = ''[STARTS_WITH]; +var nativeStartsWith = ''.startsWith; +var min$4 = Math.min; // `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('startsWith') }, { 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)); + var that = String(requireObjectCoercible(this)); + notARegexp(searchString); + var index = toLength(min$4(arguments.length > 1 ? arguments[1] : undefined, that.length)); var search = String(searchString); return nativeStartsWith ? nativeStartsWith.call(that, search, index) @@ -6192,6 +6280,48 @@ var is$1 = { empty: isEmpty$1 }; +var transitionEndEvent = function () { + var element = document.createElement('span'); + var events = { + WebkitTransition: 'webkitTransitionEnd', + MozTransition: 'transitionend', + OTransition: 'oTransitionEnd otransitionend', + transition: 'transitionend' + }; + var type = Object.keys(events).find(function (event) { + return element.style[event] !== undefined; + }); + return is$1.string(type) ? events[type] : false; +}(); // Force repaint of element + +function repaint(element, delay) { + setTimeout(function () { + try { + // eslint-disable-next-line no-param-reassign + element.hidden = true; // eslint-disable-next-line no-unused-expressions + + element.offsetHeight; // eslint-disable-next-line no-param-reassign + + element.hidden = false; + } catch (e) {// Do nothing + } + }, delay); +} + +// ========================================================================== +// Browser sniffing +// Unfortunately, due to mixed support, UA sniffing is required +// ========================================================================== +var browser = { + isIE: + /* @cc_on!@ */ + !!document.documentMode, + isEdge: window.navigator.userAgent.includes('Edge'), + isWebkit: 'WebkitAppearance' in document.documentElement.style && !/Edge/.test(navigator.userAgent), + isIPhone: /(iPhone|iPod)/gi.test(navigator.platform), + isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform) +}; + // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md // https://www.youtube.com/watch?v=NPM6172J22g @@ -6554,13 +6684,10 @@ function toggleHidden(element, hidden) { if (!is$1.boolean(hide)) { hide = !element.hidden; - } + } // eslint-disable-next-line no-param-reassign - if (hide) { - element.setAttribute('hidden', ''); - } else { - element.removeAttribute('hidden'); - } + + element.hidden = hide; } // Mirror Element.classList.toggle, with IE compatibility for "force" argument function toggleClass(element, className, force) { @@ -6594,8 +6721,8 @@ function matches$1(element, selector) { 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) { @@ -6659,46 +6786,6 @@ function setFocus() { } } -var transitionEndEvent = function () { - var element = document.createElement('span'); - var events = { - WebkitTransition: 'webkitTransitionEnd', - MozTransition: 'transitionend', - OTransition: 'oTransitionEnd otransitionend', - transition: 'transitionend' - }; - var type = Object.keys(events).find(function (event) { - return element.style[event] !== undefined; - }); - return is$1.string(type) ? events[type] : false; -}(); // Force repaint of element - -function repaint(element) { - setTimeout(function () { - try { - toggleHidden(element, true); - element.offsetHeight; // eslint-disable-line - - toggleHidden(element, false); - } catch (e) {// Do nothing - } - }, 0); -} - -// ========================================================================== -// Browser sniffing -// Unfortunately, due to mixed support, UA sniffing is required -// ========================================================================== -var browser = { - isIE: - /* @cc_on!@ */ - !!document.documentMode, - isEdge: window.navigator.userAgent.includes('Edge'), - isWebkit: 'WebkitAppearance' in document.documentElement.style && !/Edge/.test(navigator.userAgent), - isIPhone: /(iPhone|iPod)/gi.test(navigator.platform), - isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform) -}; - var defaultCodecs = { 'audio/ogg': 'vorbis', 'audio/wav': '1', @@ -6822,12 +6909,8 @@ function reduceAspectRatio(ratio) { } function getAspectRatio(input) { var parse = function parse(ratio) { - if (!validateRatio(ratio)) { - return null; - } - - return ratio.split(':').map(Number); - }; // Provided ratio + return validateRatio(ratio) ? ratio.split(':').map(Number) : null; + }; // Try provided ratio var ratio = parse(input); // Get from config @@ -6913,16 +6996,19 @@ var html5 = { return; } - var player = this; // Set aspect ratio if set + var player = this; // Set aspect ratio if fixed + + if (!is$1.empty(this.config.ratio)) { + setAspectRatio.call(player); + } // Quality - setAspectRatio.call(player); // Quality Object.defineProperty(player.media, 'quality', { 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')); @@ -6931,8 +7017,8 @@ var html5 = { // 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) { @@ -7010,25 +7096,25 @@ function closest(array, value) { }); } -var MATCH$2 = wellKnownSymbol('match'); +var defineProperty$4 = objectDefineProperty.f; +var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f; -var defineProperty$4 = objectDefineProperty.f; -var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f; -var NativeRegExp = global$1.RegExp; -var RegExpPrototype = NativeRegExp.prototype; +var MATCH$2 = wellKnownSymbol('match'); +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$3 = descriptors && isForced_1('RegExp', (!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'; @@ -7047,7 +7133,7 @@ if (FORCED$3) { : 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, { @@ -7056,12 +7142,12 @@ if (FORCED$3) { set: function (it) { NativeRegExp[key] = it; } }); }; - var keys$1 = 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); + var keys$2 = getOwnPropertyNames$1(NativeRegExp); + var index = 0; + while (keys$2.length > index) proxy(keys$2[index++]); + RegExpPrototype$1.constructor = RegExpWrapper; + RegExpWrapper.prototype = RegExpPrototype$1; + redefine(global_1, 'RegExp', RegExpWrapper); } // https://tc39.github.io/ecma262/#sec-get-regexp-@@species @@ -7175,10 +7261,10 @@ var i18n = { }; 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; } @@ -7313,6 +7399,7 @@ function loadSprite(url, id) { }; 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()) { @@ -7363,13 +7450,13 @@ function loadSprite(url, id) { } var ceil$1 = Math.ceil; -var floor$4 = Math.floor; +var floor$5 = Math.floor; // `Math.trunc` method // https://tc39.github.io/ecma262/#sec-math.trunc _export({ target: 'Math', stat: true }, { trunc: function trunc(it) { - return (it > 0 ? floor$4 : ceil$1)(it); + return (it > 0 ? floor$5 : ceil$1)(it); } }); @@ -7796,9 +7883,9 @@ var controls = { 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) { @@ -7806,7 +7893,7 @@ var controls = { }); } - menuItem.setAttribute('aria-checked', checked ? 'true' : 'false'); + menuItem.setAttribute('aria-checked', check ? 'true' : 'false'); } }); this.listeners.bind(menuItem, 'click keyup', function (event) { @@ -7908,16 +7995,16 @@ var controls = { var value = 0; var setProgress = function setProgress(target, input) { - var value = is$1.number(input) ? input : 0; + 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; } } }; @@ -7986,15 +8073,12 @@ var controls = { // 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(_this5.elements.display.seekTooltip, visible, _toggle); + var toggle = function toggle(show) { + return toggleClass(_this5.elements.display.seekTooltip, visible, show); }; // Hide on touch @@ -8004,6 +8088,9 @@ var controls = { } // 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)) { @@ -8364,8 +8451,8 @@ var controls = { 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; }); } @@ -8620,17 +8707,15 @@ var controls = { if (control === 'settings' && !is$1.empty(_this10.config.settings)) { - var _control = createElement('div', extend({}, defaultAttributes, { + var wrapper = createElement('div', extend({}, defaultAttributes, { class: "".concat(defaultAttributes.class, " plyr__menu").trim(), hidden: '' })); - - _control.appendChild(createButton.call(_this10, 'settings', { + 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), @@ -8719,12 +8804,10 @@ var controls = { }); popup.appendChild(inner); - - _control.appendChild(popup); - - container.appendChild(_control); + wrapper.appendChild(popup); + container.appendChild(wrapper); _this10.elements.settings.popup = popup; - _this10.elements.settings.menu = _control; + _this10.elements.settings.menu = wrapper; } // Picture in picture button @@ -9056,7 +9139,9 @@ var captions = { 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); @@ -9236,8 +9321,8 @@ var captions = { }); 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 @@ -9416,7 +9501,8 @@ var defaults$1 = { controls: ['play-large', // 'restart', // 'rewind', 'play', // 'fast-forward', - 'progress', 'current-time', 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', // 'download', + 'progress', 'current-time', // 'duration', + 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', // 'download', 'fullscreen'], settings: ['captions', 'quality', 'speed'], // Localisation @@ -9474,8 +9560,7 @@ var defaults$1 = { }, youtube: { sdk: 'https://www.youtube.com/iframe_api', - 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', - + api: 'https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}' }, googleIMA: { sdk: 'https://imasdk.googleapis.com/js/sdkloader/ima3.js' @@ -9760,8 +9845,6 @@ function onChange() { } function toggleFallback() { - var _this = this; - var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; // Store or restore scroll position @@ -9801,12 +9884,7 @@ function toggleFallback() { viewport.content = viewport.content.split(',').filter(function (part) { return part.trim() !== property; }).join(','); - } // Force a repaint as sometimes Safari doesn't want to fill the screen - - - setTimeout(function () { - return repaint(_this.target); - }, 100); + } } // Toggle button and fire events @@ -9817,7 +9895,7 @@ var Fullscreen = /*#__PURE__*/ function () { function Fullscreen(player) { - var _this2 = this; + var _this = this; _classCallCheck(this, Fullscreen); @@ -9837,16 +9915,16 @@ function () { on.call(this.player, document, this.prefix === 'ms' ? 'MSFullscreenChange' : "".concat(this.prefix, "fullscreenchange"), function () { // TODO: Filter for target?? - onChange.call(_this2); + onChange.call(_this); }); // Fullscreen toggle on double click on.call(this.player, this.player.elements.container, 'dblclick', function (event) { // Ignore double click in controls - if (is$1.element(_this2.player.elements.controls) && _this2.player.elements.controls.contains(event.target)) { + if (is$1.element(_this.player.elements.controls) && _this.player.elements.controls.contains(event.target)) { return; } - _this2.toggle(); + _this.toggle(); }); // Update the UI this.update(); @@ -10006,7 +10084,9 @@ var mathSign = Math.sign || function sign(x) { // `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 @@ -10204,7 +10284,9 @@ var ui = { 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') { @@ -10231,13 +10313,13 @@ var ui = { }, // 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)); } } }; @@ -10387,14 +10469,14 @@ function () { 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; @@ -10505,11 +10587,11 @@ function () { 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 @@ -10528,15 +10610,7 @@ function () { timers.controls = setTimeout(function () { return ui.toggleControls.call(player, false); }, delay); - }); // Force edge to repaint on exit fullscreen - // TODO: Fix weird bug where Edge doesn't re-draw when exiting fullscreen - - /* if (browser.isEdge) { - on.call(player, elements.container, 'exitfullscreen', () => { - setTimeout(() => repaint(elements.container), 100); - }); - } */ - // Set a gutter for Vimeo + }); // Set a gutter for Vimeo var setGutter = function setGutter(ratio, padding, toggle) { if (!player.isVimeo) { @@ -10571,16 +10645,21 @@ function () { }; var resized = function resized() { - window.clearTimeout(timers.resized); - timers.resized = window.setTimeout(setPlayerSize, 50); + clearTimeout(timers.resized); + timers.resized = setTimeout(setPlayerSize, 50); }; on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) { var _player$fullscreen = player.fullscreen, target = _player$fullscreen.target, - usingNative = _player$fullscreen.usingNative; // Ignore for iOS native + usingNative = _player$fullscreen.usingNative; // Ignore events not from target + + if (target !== elements.container) { + return; + } // If it's not an embed and no ratio specified - if (!player.isEmbed || target !== elements.container) { + + if (!player.isEmbed && is$1.empty(player.config.ratio)) { return; } @@ -10974,7 +11053,6 @@ function () { 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 @@ -11024,6 +11102,7 @@ function () { }(); var defineProperty$5 = objectDefineProperty.f; + var FunctionPrototype = Function.prototype; var FunctionPrototypeToString = FunctionPrototype.toString; var nameRE = /^\s*function ([^ (]*)/; @@ -11045,16 +11124,14 @@ if (descriptors && !(NAME in FunctionPrototype)) { } var max$3 = Math.max; -var min$4 = Math.min; +var min$5 = Math.min; var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF; var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; -var SPECIES_SUPPORT$4 = arrayMethodHasSpeciesSupport('splice'); - // `Array.prototype.splice` method // https://tc39.github.io/ecma262/#sec-array.prototype.splice // with adding support of @@species -_export({ target: 'Array', proto: true, forced: !SPECIES_SUPPORT$4 }, { +_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('splice') }, { splice: function splice(start, deleteCount /* , ...items */) { var O = toObject(this); var len = toLength(O.length); @@ -11068,7 +11145,7 @@ _export({ target: 'Array', proto: true, forced: !SPECIES_SUPPORT$4 }, { actualDeleteCount = len - actualStart; } else { insertCount = argumentsLength - 2; - actualDeleteCount = min$4(max$3(toInteger(deleteCount), 0), len - actualStart); + actualDeleteCount = min$5(max$3(toInteger(deleteCount), 0), len - actualStart); } if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) { throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED); @@ -11787,23 +11864,22 @@ var youtube = { if (is$1.object(window.YT) && is$1.function(window.YT.Player)) { youtube.ready.call(this); } else { - // Load the API - loadScript(this.config.urls.youtube.sdk).catch(function (error) { - _this.debug.warn('YouTube API failed to load', error); - }); // Setup callback for the API - // YouTube has it's own system of course... + // Reference current global callback + var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue - window.onYouTubeReadyCallbacks = window.onYouTubeReadyCallbacks || []; // Add to queue + window.onYouTubeIframeAPIReady = function () { + // Call global callback if set + if (is$1.function(callback)) { + callback(); + } - window.onYouTubeReadyCallbacks.push(function () { youtube.ready.call(_this); - }); // Set callback to process queue + }; // Load the SDK - window.onYouTubeIframeAPIReady = function () { - window.onYouTubeReadyCallbacks.forEach(function (callback) { - callback(); - }); - }; + + loadScript(this.config.urls.youtube.sdk).catch(function (error) { + _this.debug.warn('YouTube API failed to load', error); + }); } }, // Get the media title @@ -11833,7 +11909,7 @@ var youtube = { ready: function ready() { var player = this; // Ignore already setup (race condition) - var currentId = player.media.getAttribute('id'); + var currentId = player.media && player.media.getAttribute('id'); if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) { return; @@ -11858,8 +11934,8 @@ var youtube = { }); 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) @@ -11872,9 +11948,9 @@ var youtube = { }) // 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 () {}); @@ -12414,8 +12490,8 @@ function () { }); // 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 @@ -12463,8 +12539,7 @@ function () { 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 @@ -12826,7 +12901,9 @@ function () { return Ads; }(); -var internalFindIndex = arrayMethods(6); +var $findIndex = arrayIteration.findIndex; + + var FIND_INDEX = 'findIndex'; var SKIPS_HOLES$1 = true; @@ -12837,7 +12914,7 @@ if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES$1 = false; // https://tc39.github.io/ecma262/#sec-array.prototype.findindex _export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 }, { findIndex: function findIndex(callbackfn /* , that = undefined */) { - return internalFindIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); @@ -12938,7 +13015,11 @@ function () { } this.getThumbnails().then(function () { - // Render DOM elements + if (!_this.enabled) { + return; + } // Render DOM elements + + _this.render(); // Check to see if thumb container size was specified manually in CSS @@ -13273,6 +13354,7 @@ function () { 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 + // eslint-disable-next-line no-param-reassign image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub var currentImageContainer = _this8.currentImageContainer; @@ -13451,10 +13533,14 @@ function () { } // 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"); } }, { @@ -14286,32 +14372,32 @@ function () { }, { 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", |