diff options
Diffstat (limited to 'dist/plyr.polyfilled.mjs')
-rw-r--r-- | dist/plyr.polyfilled.mjs | 4715 |
1 files changed, 2503 insertions, 2212 deletions
diff --git a/dist/plyr.polyfilled.mjs b/dist/plyr.polyfilled.mjs index 151a9a01..482c304b 100644 --- a/dist/plyr.polyfilled.mjs +++ b/dist/plyr.polyfilled.mjs @@ -1,44 +1,41 @@ typeof navigator === "object" && // Polyfill for creating CustomEvents on IE9/10/11 - // code pulled from: // https://github.com/d4tocchini/customevent-polyfill // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill - -(function() { +(function () { if (typeof window === 'undefined') { return; } try { - var ce = new window.CustomEvent('test', { cancelable: true }); + var ce = new window.CustomEvent('test', { + cancelable: true + }); ce.preventDefault(); + if (ce.defaultPrevented !== true) { // IE has problems with .preventDefault() on custom events // http://stackoverflow.com/questions/23349191 throw new Error('Could not prevent default'); } } catch (e) { - var CustomEvent = function(event, params) { + var CustomEvent = function CustomEvent(event, params) { var evt, origPrevent; params = params || { bubbles: false, cancelable: false, detail: undefined }; - evt = document.createEvent('CustomEvent'); - evt.initCustomEvent( - event, - params.bubbles, - params.cancelable, - params.detail - ); + evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); origPrevent = evt.preventDefault; - evt.preventDefault = function() { + + evt.preventDefault = function () { origPrevent.call(this); + try { Object.defineProperty(this, 'defaultPrevented', { - get: function() { + get: function get() { return true; } }); @@ -46,6 +43,7 @@ typeof navigator === "object" && // Polyfill for creating CustomEvents on IE9/10 this.defaultPrevented = true; } }; + return evt; }; @@ -54,510 +52,39 @@ typeof navigator === "object" && // Polyfill for creating CustomEvents on IE9/10 } })(); -var commonjsGlobal = 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; -} - -(function(global) {
- /**
- * Polyfill URLSearchParams
- *
- * Inspired from : https://github.com/WebReflection/url-search-params/blob/master/src/url-search-params.js
- */
-
- var checkIfIteratorIsSupported = function() {
- try {
- return !!Symbol.iterator;
- } catch (error) {
- return false;
- }
- };
-
-
- var iteratorSupported = checkIfIteratorIsSupported();
-
- var createIterator = function(items) {
- var iterator = {
- next: function() {
- var value = items.shift();
- return { done: value === void 0, value: value };
- }
- };
-
- if (iteratorSupported) {
- iterator[Symbol.iterator] = function() {
- return iterator;
- };
- }
-
- return iterator;
- };
-
- /**
- * Search param name and values should be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing
- * encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.
- */
- var serializeParam = function(value) {
- return encodeURIComponent(value).replace(/%20/g, '+');
- };
-
- var deserializeParam = function(value) {
- return decodeURIComponent(value).replace(/\+/g, ' ');
- };
-
- var polyfillURLSearchParams = function() {
-
- var URLSearchParams = function(searchString) {
- Object.defineProperty(this, '_entries', { writable: true, value: {} });
- var typeofSearchString = typeof searchString;
-
- if (typeofSearchString === 'undefined') ; else if (typeofSearchString === 'string') {
- if (searchString !== '') {
- this._fromString(searchString);
- }
- } else if (searchString instanceof URLSearchParams) {
- var _this = this;
- searchString.forEach(function(value, name) {
- _this.append(name, value);
- });
- } else if ((searchString !== null) && (typeofSearchString === 'object')) {
- if (Object.prototype.toString.call(searchString) === '[object Array]') {
- for (var i = 0; i < searchString.length; i++) {
- var entry = searchString[i];
- if ((Object.prototype.toString.call(entry) === '[object Array]') || (entry.length !== 2)) {
- this.append(entry[0], entry[1]);
- } else {
- throw new TypeError('Expected [string, any] as entry at index ' + i + ' of URLSearchParams\'s input');
- }
- }
- } else {
- for (var key in searchString) {
- if (searchString.hasOwnProperty(key)) {
- this.append(key, searchString[key]);
- }
- }
- }
- } else {
- throw new TypeError('Unsupported input\'s type for URLSearchParams');
- }
- };
-
- var proto = URLSearchParams.prototype;
-
- proto.append = function(name, value) {
- if (name in this._entries) {
- this._entries[name].push(String(value));
- } else {
- this._entries[name] = [String(value)];
- }
- };
-
- proto.delete = function(name) {
- delete this._entries[name];
- };
-
- proto.get = function(name) {
- return (name in this._entries) ? this._entries[name][0] : null;
- };
-
- proto.getAll = function(name) {
- return (name in this._entries) ? this._entries[name].slice(0) : [];
- };
-
- proto.has = function(name) {
- return (name in this._entries);
- };
-
- proto.set = function(name, value) {
- this._entries[name] = [String(value)];
- };
-
- proto.forEach = function(callback, thisArg) {
- var entries;
- for (var name in this._entries) {
- if (this._entries.hasOwnProperty(name)) {
- entries = this._entries[name];
- for (var i = 0; i < entries.length; i++) {
- callback.call(thisArg, entries[i], name, this);
- }
- }
- }
- };
-
- proto.keys = function() {
- var items = [];
- this.forEach(function(value, name) {
- items.push(name);
- });
- return createIterator(items);
- };
-
- proto.values = function() {
- var items = [];
- this.forEach(function(value) {
- items.push(value);
- });
- return createIterator(items);
- };
-
- proto.entries = function() {
- var items = [];
- this.forEach(function(value, name) {
- items.push([name, value]);
- });
- return createIterator(items);
- };
-
- if (iteratorSupported) {
- proto[Symbol.iterator] = proto.entries;
- }
-
- proto.toString = function() {
- var searchArray = [];
- this.forEach(function(value, name) {
- searchArray.push(serializeParam(name) + '=' + serializeParam(value));
- });
- return searchArray.join('&');
- };
-
-
- global.URLSearchParams = URLSearchParams;
- };
-
- if (!('URLSearchParams' in global) || (new URLSearchParams('?a=1').toString() !== 'a=1')) {
- polyfillURLSearchParams();
- }
-
- var proto = URLSearchParams.prototype;
-
- if (typeof proto.sort !== 'function') {
- proto.sort = function() {
- var _this = this;
- var items = [];
- this.forEach(function(value, name) {
- items.push([name, value]);
- if (!_this._entries) {
- _this.delete(name);
- }
- });
- items.sort(function(a, b) {
- if (a[0] < b[0]) {
- return -1;
- } else if (a[0] > b[0]) {
- return +1;
- } else {
- return 0;
- }
- });
- if (_this._entries) { // force reset because IE keeps keys index
- _this._entries = {};
- }
- for (var i = 0; i < items.length; i++) {
- this.append(items[i][0], items[i][1]);
- }
- };
- }
-
- if (typeof proto._fromString !== 'function') {
- Object.defineProperty(proto, '_fromString', {
- enumerable: false,
- configurable: false,
- writable: false,
- value: function(searchString) {
- if (this._entries) {
- this._entries = {};
- } else {
- var keys = [];
- this.forEach(function(value, name) {
- keys.push(name);
- });
- for (var i = 0; i < keys.length; i++) {
- this.delete(keys[i]);
- }
- }
-
- searchString = searchString.replace(/^\?/, '');
- var attributes = searchString.split('&');
- var attribute;
- for (var i = 0; i < attributes.length; i++) {
- attribute = attributes[i].split('=');
- this.append(
- deserializeParam(attribute[0]),
- (attribute.length > 1) ? deserializeParam(attribute[1]) : ''
- );
- }
- }
- });
- }
-
- // HTMLAnchorElement
-
-})(
- (typeof commonjsGlobal !== 'undefined') ? commonjsGlobal
- : ((typeof window !== 'undefined') ? window
- : ((typeof self !== 'undefined') ? self : commonjsGlobal))
-);
-
-(function(global) {
- /**
- * Polyfill URL
- *
- * Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
- */
-
- var checkIfURLIsSupported = function() {
- try {
- var u = new URL('b', 'http://a');
- u.pathname = 'c%20d';
- return (u.href === 'http://a/c%20d') && u.searchParams;
- } catch (e) {
- return false;
- }
- };
-
-
- var polyfillURL = function() {
- var _URL = global.URL;
-
- var URL = function(url, base) {
- if (typeof url !== 'string') url = String(url);
-
- // Only create another document if the base is different from current location.
- var doc = document, baseElement;
- if (base && (global.location === void 0 || base !== global.location.href)) {
- doc = document.implementation.createHTMLDocument('');
- baseElement = doc.createElement('base');
- baseElement.href = base;
- doc.head.appendChild(baseElement);
- try {
- if (baseElement.href.indexOf(base) !== 0) throw new Error(baseElement.href);
- } catch (err) {
- throw new Error('URL unable to set base ' + base + ' due to ' + err);
- }
- }
-
- var anchorElement = doc.createElement('a');
- anchorElement.href = url;
- if (baseElement) {
- doc.body.appendChild(anchorElement);
- anchorElement.href = anchorElement.href; // force href to refresh
- }
-
- if (anchorElement.protocol === ':' || !/:/.test(anchorElement.href)) {
- throw new TypeError('Invalid URL');
- }
-
- Object.defineProperty(this, '_anchorElement', {
- value: anchorElement
- });
-
-
- // create a linked searchParams which reflect its changes on URL
- var searchParams = new URLSearchParams(this.search);
- var enableSearchUpdate = true;
- var enableSearchParamsUpdate = true;
- var _this = this;
- ['append', 'delete', 'set'].forEach(function(methodName) {
- var method = searchParams[methodName];
- searchParams[methodName] = function() {
- method.apply(searchParams, arguments);
- if (enableSearchUpdate) {
- enableSearchParamsUpdate = false;
- _this.search = searchParams.toString();
- enableSearchParamsUpdate = true;
- }
- };
- });
-
- Object.defineProperty(this, 'searchParams', {
- value: searchParams,
- enumerable: true
- });
-
- var search = void 0;
- Object.defineProperty(this, '_updateSearchParams', {
- enumerable: false,
- configurable: false,
- writable: false,
- value: function() {
- if (this.search !== search) {
- search = this.search;
- if (enableSearchParamsUpdate) {
- enableSearchUpdate = false;
- this.searchParams._fromString(this.search);
- enableSearchUpdate = true;
- }
- }
- }
- });
- };
-
- var proto = URL.prototype;
-
- var linkURLWithAnchorAttribute = function(attributeName) {
- Object.defineProperty(proto, attributeName, {
- get: function() {
- return this._anchorElement[attributeName];
- },
- set: function(value) {
- this._anchorElement[attributeName] = value;
- },
- enumerable: true
- });
- };
-
- ['hash', 'host', 'hostname', 'port', 'protocol']
- .forEach(function(attributeName) {
- linkURLWithAnchorAttribute(attributeName);
- });
-
- Object.defineProperty(proto, 'search', {
- get: function() {
- return this._anchorElement['search'];
- },
- set: function(value) {
- this._anchorElement['search'] = value;
- this._updateSearchParams();
- },
- enumerable: true
- });
-
- Object.defineProperties(proto, {
-
- 'toString': {
- get: function() {
- var _this = this;
- return function() {
- return _this.href;
- };
- }
- },
-
- 'href': {
- get: function() {
- return this._anchorElement.href.replace(/\?$/, '');
- },
- set: function(value) {
- this._anchorElement.href = value;
- this._updateSearchParams();
- },
- enumerable: true
- },
-
- 'pathname': {
- get: function() {
- return this._anchorElement.pathname.replace(/(^\/?)/, '/');
- },
- set: function(value) {
- this._anchorElement.pathname = value;
- },
- enumerable: true
- },
-
- 'origin': {
- get: function() {
- // get expected port from protocol
- var expectedPort = { 'http:': 80, 'https:': 443, 'ftp:': 21 }[this._anchorElement.protocol];
- // add port to origin if, expected port is different than actual port
- // and it is not empty f.e http://foo:8080
- // 8080 != 80 && 8080 != ''
- var addPortToOrigin = this._anchorElement.port != expectedPort &&
- this._anchorElement.port !== '';
-
- return this._anchorElement.protocol +
- '//' +
- this._anchorElement.hostname +
- (addPortToOrigin ? (':' + this._anchorElement.port) : '');
- },
- enumerable: true
- },
-
- 'password': { // TODO
- get: function() {
- return '';
- },
- set: function(value) {
- },
- enumerable: true
- },
-
- 'username': { // TODO
- get: function() {
- return '';
- },
- set: function(value) {
- },
- enumerable: true
- },
- });
-
- URL.createObjectURL = function(blob) {
- return _URL.createObjectURL.apply(_URL, arguments);
- };
-
- URL.revokeObjectURL = function(url) {
- return _URL.revokeObjectURL.apply(_URL, arguments);
- };
-
- global.URL = URL;
-
- };
-
- if (!checkIfURLIsSupported()) {
- polyfillURL();
- }
-
- if ((global.location !== void 0) && !('origin' in global.location)) {
- var getOrigin = function() {
- return global.location.protocol + '//' + global.location.hostname + (global.location.port ? (':' + global.location.port) : '');
- };
-
- try {
- Object.defineProperty(global.location, 'origin', {
- get: getOrigin,
- enumerable: true
- });
- } catch (e) {
- setInterval(function() {
- global.location.origin = getOrigin();
- }, 100);
- }
- }
-
-})(
- (typeof commonjsGlobal !== 'undefined') ? commonjsGlobal
- : ((typeof window !== 'undefined') ? window
- : ((typeof self !== 'undefined') ? self : commonjsGlobal))
-); +var _isObject = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; -var _aFunction = function (it) { - if (typeof it != 'function') throw TypeError(it + ' is not a function!'); +var _anObject = function (it) { + if (!_isObject(it)) throw TypeError(it + ' is not an object!'); return it; }; -// optional / simple context binding +// 7.2.9 SameValue(x, y) +var _sameValue = Object.is || function is(x, y) { + // eslint-disable-next-line no-self-compare + return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; +}; -var _ctx = function (fn, that, length) { - _aFunction(fn); - if (that === undefined) return fn; - switch (length) { - 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 toString = {}.toString; + +var _cof = function (it) { + return toString.call(it).slice(8, -1); }; +var commonjsGlobal = 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 _core = createCommonjsModule(function (module) { +var core = module.exports = { version: '2.6.5' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef +}); +var _core_1 = _core.version; + var _global = createCommonjsModule(function (module) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math @@ -567,21 +94,152 @@ var global = module.exports = typeof window != 'undefined' && window.Math == Mat if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef }); -var _core = createCommonjsModule(function (module) { -var core = module.exports = { version: '2.6.5' }; -if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef +var _library = false; + +var _shared = createCommonjsModule(function (module) { +var SHARED = '__core-js_shared__'; +var store = _global[SHARED] || (_global[SHARED] = {}); + +(module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); +})('versions', []).push({ + version: _core.version, + mode: 'global', + copyright: '© 2019 Denis Pushkarev (zloirock.ru)' +}); }); -var _core_1 = _core.version; -var _isObject = function (it) { - return typeof it === 'object' ? it !== null : typeof it === 'function'; +var id = 0; +var px = Math.random(); +var _uid = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; -var _anObject = function (it) { - if (!_isObject(it)) throw TypeError(it + ' is not an object!'); - return it; +var _wks = createCommonjsModule(function (module) { +var store = _shared('wks'); + +var Symbol = _global.Symbol; +var USE_SYMBOL = typeof Symbol == 'function'; + +var $exports = module.exports = function (name) { + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name)); +}; + +$exports.store = store; +}); + +// getting tag from 19.1.3.6 Object.prototype.toString() + +var TAG = _wks('toStringTag'); +// ES3 wrong here +var ARG = _cof(function () { return arguments; }()) == 'Arguments'; + +// fallback for IE11 Script Access Denied error +var tryGet = function (it, key) { + try { + return it[key]; + } catch (e) { /* empty */ } +}; + +var _classof = function (it) { + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? _cof(O) + // ES3 arguments fallback + : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; +}; + +var builtinExec = RegExp.prototype.exec; + + // `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 new TypeError('RegExp exec method returned something other than an Object or null'); + } + return result; + } + if (_classof(R) !== 'RegExp') { + throw new TypeError('RegExp#exec called on incompatible receiver'); + } + return builtinExec.call(R, S); }; +// 21.2.5.3 get RegExp.prototype.flags + +var _flags = function () { + var that = _anObject(this); + var result = ''; + if (that.global) result += 'g'; + if (that.ignoreCase) result += 'i'; + if (that.multiline) result += 'm'; + if (that.unicode) result += 'u'; + if (that.sticky) result += 'y'; + return result; +}; + +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, +// which loads this file before patching the method. +var nativeReplace = String.prototype.replace; + +var patchedExec = nativeExec; + +var LAST_INDEX = 'lastIndex'; + +var UPDATES_LAST_INDEX_WRONG = (function () { + var re1 = /a/, + re2 = /b*/g; + nativeExec.call(re1, 'a'); + nativeExec.call(re2, 'a'); + return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0; +})(); + +// nonparticipating capturing group, copied from es5-shim's String#split patch. +var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; + +var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED; + +if (PATCH) { + patchedExec = function exec(str) { + var re = this; + var lastIndex, reCopy, match, i; + + if (NPCG_INCLUDED) { + reCopy = new RegExp('^' + re.source + '$(?!\\s)', _flags.call(re)); + } + if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX]; + + match = nativeExec.call(re, str); + + if (UPDATES_LAST_INDEX_WRONG && match) { + re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex; + } + if (NPCG_INCLUDED && match && match.length > 1) { + // Fix browsers whose `exec` methods don't consistently return `undefined` + // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ + // eslint-disable-next-line no-loop-func + nativeReplace.call(match[0], reCopy, function () { + for (i = 1; i < arguments.length - 2; i++) { + if (arguments[i] === undefined) match[i] = undefined; + } + }); + } + + return match; + }; +} + +var _regexpExec = patchedExec; + var _fails = function (exec) { try { return !!exec(); @@ -658,27 +316,6 @@ var _has = function (it, key) { return hasOwnProperty.call(it, key); }; -var id = 0; -var px = Math.random(); -var _uid = function (key) { - return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); -}; - -var _library = false; - -var _shared = createCommonjsModule(function (module) { -var SHARED = '__core-js_shared__'; -var store = _global[SHARED] || (_global[SHARED] = {}); - -(module.exports = function (key, value) { - return store[key] || (store[key] = value !== undefined ? value : {}); -})('versions', []).push({ - version: _core.version, - mode: 'global', - copyright: '© 2019 Denis Pushkarev (zloirock.ru)' -}); -}); - var _functionToString = _shared('native-function-to-string', Function.toString); var _redefine = createCommonjsModule(function (module) { @@ -712,6 +349,32 @@ _core.inspectSource = function (it) { }); }); +var _aFunction = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; +}; + +// optional / simple context binding + +var _ctx = function (fn, that, length) { + _aFunction(fn); + if (that === undefined) return fn; + switch (length) { + 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 PROTOTYPE = 'prototype'; var $export = function (type, name, source) { @@ -751,54 +414,151 @@ $export.U = 64; // safe $export.R = 128; // real proto method for `library` var _export = $export; +_export({ + target: 'RegExp', + proto: true, + forced: _regexpExec !== /./.exec +}, { + exec: _regexpExec +}); + // 7.2.1 RequireObjectCoercible(argument) var _defined = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; -// 7.1.13 ToObject(argument) +var SPECIES = _wks('species'); -var _toObject = function (it) { - return Object(_defined(it)); -}; +var REPLACE_SUPPORTS_NAMED_GROUPS = !_fails(function () { + // #replace needs built-in support for named groups. + // #match works fine because it just return the exec results, even if it has + // a "grops" property. + var re = /./; + re.exec = function () { + var result = []; + result.groups = { a: '7' }; + return result; + }; + return ''.replace(re, '$<a>') !== '7'; +}); -// call something on iterator step with safe closing on error +var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = (function () { + // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec + var re = /(?:)/; + var originalExec = re.exec; + re.exec = function () { return originalExec.apply(this, arguments); }; + var result = 'ab'.split(re); + return result.length === 2 && result[0] === 'a' && result[1] === 'b'; +})(); -var _iterCall = function (iterator, fn, value, entries) { - try { - return entries ? fn(_anObject(value)[0], value[1]) : fn(value); - // 7.4.6 IteratorClose(iterator, completion) - } catch (e) { - var ret = iterator['return']; - if (ret !== undefined) _anObject(ret.call(iterator)); - throw e; - } -}; +var _fixReWks = function (KEY, length, exec) { + var SYMBOL = _wks(KEY); -var _iterators = {}; + var DELEGATES_TO_SYMBOL = !_fails(function () { + // String methods call symbol-named RegEp methods + var O = {}; + O[SYMBOL] = function () { return 7; }; + return ''[KEY](O) != 7; + }); -var _wks = createCommonjsModule(function (module) { -var store = _shared('wks'); + var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !_fails(function () { + // Symbol-named RegExp methods call .exec + var execCalled = false; + var re = /a/; + re.exec = function () { execCalled = true; return null; }; + if (KEY === 'split') { + // 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] = function () { return re; }; + } + re[SYMBOL](''); + return !execCalled; + }) : undefined; -var Symbol = _global.Symbol; -var USE_SYMBOL = typeof Symbol == 'function'; + if ( + !DELEGATES_TO_SYMBOL || + !DELEGATES_TO_EXEC || + (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) || + (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) + ) { + var nativeRegExpMethod = /./[SYMBOL]; + var fns = exec( + _defined, + SYMBOL, + ''[KEY], + function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) { + if (regexp.exec === _regexpExec) { + if (DELEGATES_TO_SYMBOL && !forceStringMethod) { + // The native String method already delegates to @@method (this + // polyfilled function), leasing to infinite recursion. + // We avoid it by directly calling the native @@method method. + return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; + } + return { done: true, value: nativeMethod.call(str, regexp, arg2) }; + } + return { done: false }; + } + ); + var strfn = fns[0]; + var rxfn = fns[1]; -var $exports = module.exports = function (name) { - return store[name] || (store[name] = - USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name)); + _redefine(String.prototype, KEY, strfn); + _hide(RegExp.prototype, SYMBOL, length == 2 + // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) + // 21.2.5.11 RegExp.prototype[@@split](string, limit) + ? function (string, arg) { return rxfn.call(string, this, arg); } + // 21.2.5.6 RegExp.prototype[@@match](string) + // 21.2.5.9 RegExp.prototype[@@search](string) + : function (string) { return rxfn.call(string, this); } + ); + } }; -$exports.store = store; +// @@search logic +_fixReWks('search', 1, function (defined, SEARCH, $search, maybeCallNative) { + return [ + // `String.prototype.search` method + // https://tc39.github.io/ecma262/#sec-string.prototype.search + function search(regexp) { + var O = defined(this); + var fn = regexp == undefined ? undefined : regexp[SEARCH]; + return fn !== undefined ? fn.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($search, 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; + } + ]; }); -// check on default Array iterator +// 7.2.8 IsRegExp(argument) -var ITERATOR = _wks('iterator'); -var ArrayProto = Array.prototype; -var _isArrayIter = function (it) { - return it !== undefined && (_iterators.Array === it || ArrayProto[ITERATOR] === it); +var MATCH = _wks('match'); +var _isRegexp = function (it) { + var isRegExp; + return _isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : _cof(it) == 'RegExp'); +}; + +// 7.3.20 SpeciesConstructor(O, defaultConstructor) + + +var SPECIES$1 = _wks('species'); +var _speciesConstructor = function (O, D) { + var C = _anObject(O).constructor; + var S; + return C === undefined || (S = _anObject(C)[SPECIES$1]) == undefined ? D : _aFunction(S); }; // 7.1.4 ToInteger @@ -808,211 +568,181 @@ var _toInteger = function (it) { return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; -// 7.1.15 ToLength - -var min = Math.min; -var _toLength = function (it) { - return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 -}; - -var _createProperty = function (object, index, value) { - if (index in object) _objectDp.f(object, index, _propertyDesc(0, value)); - else object[index] = value; -}; - -var toString = {}.toString; - -var _cof = function (it) { - return toString.call(it).slice(8, -1); +// true -> String#at +// false -> String#codePointAt +var _stringAt = function (TO_STRING) { + return function (that, pos) { + var s = String(_defined(that)); + var i = _toInteger(pos); + var l = s.length; + var a, b; + if (i < 0 || i >= l) return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff + ? TO_STRING ? s.charAt(i) : a + : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; }; -// getting tag from 19.1.3.6 Object.prototype.toString() - -var TAG = _wks('toStringTag'); -// ES3 wrong here -var ARG = _cof(function () { return arguments; }()) == 'Arguments'; - -// fallback for IE11 Script Access Denied error -var tryGet = function (it, key) { - try { - return it[key]; - } catch (e) { /* empty */ } -}; +var at = _stringAt(true); -var _classof = function (it) { - var O, T, B; - return it === undefined ? 'Undefined' : it === null ? 'Null' - // @@toStringTag case - : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T - // builtinTag case - : ARG ? _cof(O) - // ES3 arguments fallback - : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; + // `AdvanceStringIndex` abstract operation +// https://tc39.github.io/ecma262/#sec-advancestringindex +var _advanceStringIndex = function (S, index, unicode) { + return index + (unicode ? at(S, index).length : 1); }; -var ITERATOR$1 = _wks('iterator'); +// 7.1.15 ToLength -var core_getIteratorMethod = _core.getIteratorMethod = function (it) { - if (it != undefined) return it[ITERATOR$1] - || it['@@iterator'] - || _iterators[_classof(it)]; +var min = Math.min; +var _toLength = function (it) { + return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; -var ITERATOR$2 = _wks('iterator'); -var SAFE_CLOSING = false; - -try { - var riter = [7][ITERATOR$2](); - riter['return'] = function () { SAFE_CLOSING = true; }; -} catch (e) { /* empty */ } +var $min = Math.min; +var $push = [].push; +var $SPLIT = 'split'; +var LENGTH = 'length'; +var LAST_INDEX$1 = 'lastIndex'; +var MAX_UINT32 = 0xffffffff; -var _iterDetect = function (exec, skipClosing) { - if (!skipClosing && !SAFE_CLOSING) return false; - var safe = false; - try { - var arr = [7]; - var iter = arr[ITERATOR$2](); - iter.next = function () { return { done: safe = true }; }; - arr[ITERATOR$2] = function () { return iter; }; - exec(arr); - } catch (e) { /* empty */ } - return safe; -}; +// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError +var SUPPORTS_Y = !_fails(function () { }); -_export(_export.S + _export.F * !_iterDetect(function (iter) { }), 'Array', { - // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) - from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { - var O = _toObject(arrayLike); - var C = typeof this == 'function' ? this : Array; - var aLen = arguments.length; - var mapfn = aLen > 1 ? arguments[1] : undefined; - var mapping = mapfn !== undefined; - var index = 0; - var iterFn = core_getIteratorMethod(O); - var length, result, step, iterator; - if (mapping) mapfn = _ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); - // if object isn't iterable or it's array with default iterator - use simple case - if (iterFn != undefined && !(C == Array && _isArrayIter(iterFn))) { - for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { - _createProperty(result, index, mapping ? _iterCall(iterator, mapfn, [step.value, index], true) : step.value); - } - } else { - length = _toLength(O.length); - for (result = new C(length); length > index; index++) { - _createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); +// @@split logic +_fixReWks('split', 2, function (defined, SPLIT, $split, 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(this); + if (separator === undefined && limit === 0) return []; + // If `separator` is not a regex, use native split + if (!_isRegexp(separator)) return $split.call(string, separator, limit); + var output = []; + var flags = (separator.ignoreCase ? 'i' : '') + + (separator.multiline ? 'm' : '') + + (separator.unicode ? 'u' : '') + + (separator.sticky ? 'y' : ''); + var lastLastIndex = 0; + var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 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[LAST_INDEX$1]; + if (lastIndex > lastLastIndex) { + output.push(string.slice(lastLastIndex, match.index)); + if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1)); + lastLength = match[0][LENGTH]; + lastLastIndex = lastIndex; + if (output[LENGTH] >= splitLimit) break; + } + if (separatorCopy[LAST_INDEX$1] === match.index) separatorCopy[LAST_INDEX$1]++; // Avoid an infinite loop } - } - result.length = index; - return result; + if (lastLastIndex === string[LENGTH]) { + if (lastLength || !separatorCopy.test('')) output.push(''); + } else output.push(string.slice(lastLastIndex)); + return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; + }; + // Chakra, V8 + } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) { + internalSplit = function (separator, limit) { + return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit); + }; + } else { + internalSplit = $split; } -}); - -// fallback for non-array-like ES3 and non-enumerable old V8 strings - -// eslint-disable-next-line no-prototype-builtins -var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) { - return _cof(it) == 'String' ? it.split('') : Object(it); -}; - -// 7.2.2 IsArray(argument) - -var _isArray = Array.isArray || function isArray(arg) { - return _cof(arg) == 'Array'; -}; - -var SPECIES = _wks('species'); - -var _arraySpeciesConstructor = function (original) { - var C; - if (_isArray(original)) { - C = original.constructor; - // cross-realm fallback - if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined; - if (_isObject(C)) { - C = C[SPECIES]; - if (C === null) C = undefined; - } - } return C === undefined ? Array : C; -}; - -// 9.4.2.3 ArraySpeciesCreate(originalArray, length) - - -var _arraySpeciesCreate = function (original, length) { - return new (_arraySpeciesConstructor(original))(length); -}; - -// 0 -> Array#forEach -// 1 -> Array#map -// 2 -> Array#filter -// 3 -> Array#some -// 4 -> Array#every -// 5 -> Array#find -// 6 -> Array#findIndex - + return [ + // `String.prototype.split` method + // https://tc39.github.io/ecma262/#sec-string.prototype.split + function split(separator, limit) { + var O = defined(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 !== $split); + 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'); -var _arrayMethods = function (TYPE, $create) { - 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 = $create || _arraySpeciesCreate; - return function ($this, callbackfn, that) { - var O = _toObject($this); - var self = _iobject(O); - var f = _ctx(callbackfn, that, 3); - var length = _toLength(self.length); - var index = 0; - var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; - var val, res; - for (;length > index; index++) if (NO_HOLES || index in self) { - val = self[index]; - res = f(val, index, O); - if (TYPE) { - if (IS_MAP) result[index] = res; // map - else if (res) switch (TYPE) { - case 3: return true; // some - case 5: return val; // find - case 6: return index; // findIndex - case 2: result.push(val); // filter - } else if (IS_EVERY) return false; // every + // ^(? + 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(_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; + } + q = p = e; + } } + A.push(S.slice(p)); + return A; } - return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; - }; -}; + ]; +}); // 22.1.3.31 Array.prototype[@@unscopables] var UNSCOPABLES = _wks('unscopables'); -var ArrayProto$1 = Array.prototype; -if (ArrayProto$1[UNSCOPABLES] == undefined) _hide(ArrayProto$1, UNSCOPABLES, {}); +var ArrayProto = Array.prototype; +if (ArrayProto[UNSCOPABLES] == undefined) _hide(ArrayProto, UNSCOPABLES, {}); var _addToUnscopables = function (key) { - ArrayProto$1[UNSCOPABLES][key] = true; + ArrayProto[UNSCOPABLES][key] = true; }; -// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) +var _iterStep = function (done, value) { + return { value: value, done: !!done }; +}; -var $find = _arrayMethods(5); -var KEY = 'find'; -var forced = true; -// Shouldn't skip holes -if (KEY in []) Array(1)[KEY](function () { forced = false; }); -_export(_export.P + _export.F * forced, 'Array', { - find: function find(callbackfn /* , that = undefined */) { - return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } -}); -_addToUnscopables(KEY); +var _iterators = {}; -var f$1 = {}.propertyIsEnumerable; +// fallback for non-array-like ES3 and non-enumerable old V8 strings -var _objectPie = { - f: f$1 +// eslint-disable-next-line no-prototype-builtins +var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) { + return _cof(it) == 'String' ? it.split('') : Object(it); }; // to indexed object, toObject with fallback for non-array-like ES3 strings @@ -1022,56 +752,6 @@ var _toIobject = function (it) { return _iobject(_defined(it)); }; -var gOPD = Object.getOwnPropertyDescriptor; - -var f$2 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P) { - O = _toIobject(O); - P = _toPrimitive(P, true); - if (_ie8DomDefine) try { - return gOPD(O, P); - } catch (e) { /* empty */ } - if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]); -}; - -var _objectGopd = { - f: f$2 -}; - -// Works with __proto__ only. Old v8 can't work with null proto objects. -/* eslint-disable no-proto */ - - -var check = function (O, proto) { - _anObject(O); - if (!_isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); -}; -var _setProto = { - set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line - function (test, buggy, set) { - try { - set = _ctx(Function.call, _objectGopd.f(Object.prototype, '__proto__').set, 2); - set(test, []); - buggy = !(test instanceof Array); - } catch (e) { buggy = true; } - return function setPrototypeOf(O, proto) { - check(O, proto); - if (buggy) O.__proto__ = proto; - else set(O, proto); - return O; - }; - }({}, false) : undefined), - check: check -}; - -var setPrototypeOf = _setProto.set; -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) && setPrototypeOf) { - setPrototypeOf(that, P); - } return that; -}; - var max = Math.max; var min$1 = Math.min; var _toAbsoluteIndex = function (index, length) { @@ -1130,48 +810,6 @@ var _enumBugKeys = ( 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' ).split(','); -// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) - -var hiddenKeys = _enumBugKeys.concat('length', 'prototype'); - -var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { - return _objectKeysInternal(O, hiddenKeys); -}; - -var _objectGopn = { - f: f$3 -}; - -var _stringWs = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + - '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; - -var space = '[' + _stringWs + ']'; -var non = '\u200b\u0085'; -var ltrim = RegExp('^' + space + space + '*'); -var rtrim = RegExp(space + space + '*$'); - -var exporter = function (KEY, exec, ALIAS) { - var exp = {}; - var FORCE = _fails(function () { - return !!_stringWs[KEY]() || non[KEY]() != non; - }); - var fn = exp[KEY] = FORCE ? exec(trim) : _stringWs[KEY]; - if (ALIAS) exp[ALIAS] = fn; - _export(_export.P + _export.F * FORCE, 'String', exp); -}; - -// 1 -> String#trimLeft -// 2 -> String#trimRight -// 3 -> String#trim -var trim = exporter.trim = function (string, TYPE) { - string = String(_defined(string)); - if (TYPE & 1) string = string.replace(ltrim, ''); - if (TYPE & 2) string = string.replace(rtrim, ''); - return string; -}; - -var _stringTrim = exporter; - // 19.1.2.14 / 15.2.3.14 Object.keys(O) @@ -1235,388 +873,6 @@ var _objectCreate = Object.create || function create(O, Properties) { return Properties === undefined ? result : _objectDps(result, Properties); }; -var gOPN = _objectGopn.f; -var gOPD$1 = _objectGopd.f; -var dP$1 = _objectDp.f; -var $trim = _stringTrim.trim; -var NUMBER = 'Number'; -var $Number = _global[NUMBER]; -var Base = $Number; -var proto = $Number.prototype; -// Opera ~12 has broken Object#toString -var BROKEN_COF = _cof(_objectCreate(proto)) == NUMBER; -var TRIM = 'trim' in String.prototype; - -// 7.1.3 ToNumber(argument) -var toNumber = function (argument) { - var it = _toPrimitive(argument, false); - if (typeof it == 'string' && it.length > 2) { - it = TRIM ? it.trim() : $trim(it, 3); - var first = it.charCodeAt(0); - var third, radix, maxCode; - if (first === 43 || first === 45) { - third = it.charCodeAt(2); - if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix - } else if (first === 48) { - switch (it.charCodeAt(1)) { - case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i - case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i - default: return +it; - } - for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) { - code = digits.charCodeAt(i); - // 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; - } return parseInt(digits, radix); - } - } return +it; -}; - -if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) { - $Number = function Number(value) { - var it = arguments.length < 1 ? 0 : value; - var that = this; - return that instanceof $Number - // check on 1..constructor(foo) case - && (BROKEN_COF ? _fails(function () { proto.valueOf.call(that); }) : _cof(that) != NUMBER) - ? _inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it); - }; - for (var keys = _descriptors ? gOPN(Base) : ( - // ES3: - 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + - // ES6 (in case, if modules with ES6 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(Base, key = keys[j]) && !_has($Number, key)) { - dP$1($Number, key, gOPD$1(Base, key)); - } - } - $Number.prototype = proto; - proto.constructor = $Number; - _redefine(_global, NUMBER, $Number); -} - -// most Object methods by ES6 should accept primitives - - - -var _objectSap = function (KEY, exec) { - var fn = (_core.Object || {})[KEY] || Object[KEY]; - var exp = {}; - exp[KEY] = exec(fn); - _export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp); -}; - -// 19.1.2.14 Object.keys(O) - - - -_objectSap('keys', function () { - return function keys(it) { - return _objectKeys(_toObject(it)); - }; -}); - -// 7.2.8 IsRegExp(argument) - - -var MATCH = _wks('match'); -var _isRegexp = function (it) { - var isRegExp; - return _isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : _cof(it) == 'RegExp'); -}; - -// helper for String#{startsWith, endsWith, includes} - - - -var _stringContext = function (that, searchString, NAME) { - if (_isRegexp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); - return String(_defined(that)); -}; - -var MATCH$1 = _wks('match'); -var _failsIsRegexp = function (KEY) { - var re = /./; - try { - '/./'[KEY](re); - } catch (e) { - try { - re[MATCH$1] = false; - return !'/./'[KEY](re); - } catch (f) { /* empty */ } - } return true; -}; - -var INCLUDES = 'includes'; - -_export(_export.P + _export.F * _failsIsRegexp(INCLUDES), 'String', { - includes: function includes(searchString /* , position = 0 */) { - return !!~_stringContext(this, searchString, INCLUDES) - .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -// https://github.com/tc39/Array.prototype.includes - -var $includes = _arrayIncludes(true); - -_export(_export.P, 'Array', { - includes: function includes(el /* , fromIndex = 0 */) { - return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -_addToUnscopables('includes'); - -// 7.2.9 SameValue(x, y) -var _sameValue = Object.is || function is(x, y) { - // eslint-disable-next-line no-self-compare - return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; -}; - -var builtinExec = RegExp.prototype.exec; - - // `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 new TypeError('RegExp exec method returned something other than an Object or null'); - } - return result; - } - if (_classof(R) !== 'RegExp') { - throw new TypeError('RegExp#exec called on incompatible receiver'); - } - return builtinExec.call(R, S); -}; - -// 21.2.5.3 get RegExp.prototype.flags - -var _flags = function () { - var that = _anObject(this); - var result = ''; - if (that.global) result += 'g'; - if (that.ignoreCase) result += 'i'; - if (that.multiline) result += 'm'; - if (that.unicode) result += 'u'; - if (that.sticky) result += 'y'; - return result; -}; - -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, -// which loads this file before patching the method. -var nativeReplace = String.prototype.replace; - -var patchedExec = nativeExec; - -var LAST_INDEX = 'lastIndex'; - -var UPDATES_LAST_INDEX_WRONG = (function () { - var re1 = /a/, - re2 = /b*/g; - nativeExec.call(re1, 'a'); - nativeExec.call(re2, 'a'); - return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0; -})(); - -// nonparticipating capturing group, copied from es5-shim's String#split patch. -var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; - -var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED; - -if (PATCH) { - patchedExec = function exec(str) { - var re = this; - var lastIndex, reCopy, match, i; - - if (NPCG_INCLUDED) { - reCopy = new RegExp('^' + re.source + '$(?!\\s)', _flags.call(re)); - } - if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX]; - - match = nativeExec.call(re, str); - - if (UPDATES_LAST_INDEX_WRONG && match) { - re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex; - } - if (NPCG_INCLUDED && match && match.length > 1) { - // Fix browsers whose `exec` methods don't consistently return `undefined` - // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ - // eslint-disable-next-line no-loop-func - nativeReplace.call(match[0], reCopy, function () { - for (i = 1; i < arguments.length - 2; i++) { - if (arguments[i] === undefined) match[i] = undefined; - } - }); - } - - return match; - }; -} - -var _regexpExec = patchedExec; - -_export({ - target: 'RegExp', - proto: true, - forced: _regexpExec !== /./.exec -}, { - exec: _regexpExec -}); - -var SPECIES$1 = _wks('species'); - -var REPLACE_SUPPORTS_NAMED_GROUPS = !_fails(function () { - // #replace needs built-in support for named groups. - // #match works fine because it just return the exec results, even if it has - // a "grops" property. - var re = /./; - re.exec = function () { - var result = []; - result.groups = { a: '7' }; - return result; - }; - return ''.replace(re, '$<a>') !== '7'; -}); - -var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = (function () { - // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec - var re = /(?:)/; - var originalExec = re.exec; - re.exec = function () { return originalExec.apply(this, arguments); }; - var result = 'ab'.split(re); - return result.length === 2 && result[0] === 'a' && result[1] === 'b'; -})(); - -var _fixReWks = function (KEY, length, exec) { - var SYMBOL = _wks(KEY); - - var DELEGATES_TO_SYMBOL = !_fails(function () { - // String methods call symbol-named RegEp methods - var O = {}; - O[SYMBOL] = function () { return 7; }; - return ''[KEY](O) != 7; - }); - - var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !_fails(function () { - // Symbol-named RegExp methods call .exec - var execCalled = false; - var re = /a/; - re.exec = function () { execCalled = true; return null; }; - if (KEY === 'split') { - // 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$1] = function () { return re; }; - } - re[SYMBOL](''); - return !execCalled; - }) : undefined; - - if ( - !DELEGATES_TO_SYMBOL || - !DELEGATES_TO_EXEC || - (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) || - (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) - ) { - var nativeRegExpMethod = /./[SYMBOL]; - var fns = exec( - _defined, - SYMBOL, - ''[KEY], - function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) { - if (regexp.exec === _regexpExec) { - if (DELEGATES_TO_SYMBOL && !forceStringMethod) { - // The native String method already delegates to @@method (this - // polyfilled function), leasing to infinite recursion. - // We avoid it by directly calling the native @@method method. - return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; - } - return { done: true, value: nativeMethod.call(str, regexp, arg2) }; - } - return { done: false }; - } - ); - var strfn = fns[0]; - var rxfn = fns[1]; - - _redefine(String.prototype, KEY, strfn); - _hide(RegExp.prototype, SYMBOL, length == 2 - // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) - // 21.2.5.11 RegExp.prototype[@@split](string, limit) - ? function (string, arg) { return rxfn.call(string, this, arg); } - // 21.2.5.6 RegExp.prototype[@@match](string) - // 21.2.5.9 RegExp.prototype[@@search](string) - : function (string) { return rxfn.call(string, this); } - ); - } -}; - -// @@search logic -_fixReWks('search', 1, function (defined, SEARCH, $search, maybeCallNative) { - return [ - // `String.prototype.search` method - // https://tc39.github.io/ecma262/#sec-string.prototype.search - function search(regexp) { - var O = defined(this); - var fn = regexp == undefined ? undefined : regexp[SEARCH]; - return fn !== undefined ? fn.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($search, 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; - } - ]; -}); - -// 21.2.5.3 get RegExp.prototype.flags() -if (_descriptors && /./g.flags != 'g') _objectDp.f(RegExp.prototype, 'flags', { - configurable: true, - get: _flags -}); - -var TO_STRING = 'toString'; -var $toString = /./[TO_STRING]; - -var define = function (fn) { - _redefine(RegExp.prototype, TO_STRING, fn, true); -}; - -// 21.2.5.14 RegExp.prototype.toString() -if (_fails(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) { - define(function toString() { - var R = _anObject(this); - return '/'.concat(R.source, '/', - 'flags' in R ? R.flags : !_descriptors && R instanceof RegExp ? _flags.call(R) : undefined); - }); -// FF44- RegExp#toString has a wrong name -} else if ($toString.name != TO_STRING) { - define(function toString() { - return $toString.call(this); - }); -} - -var _iterStep = function (done, value) { - return { value: value, done: !!done }; -}; - var def = _objectDp.f; var TAG$1 = _wks('toStringTag'); @@ -1635,6 +891,12 @@ var _iterCreate = function (Constructor, NAME, next) { _setToStringTag(Constructor, NAME + ' Iterator'); }; +// 7.1.13 ToObject(argument) + +var _toObject = function (it) { + return Object(_defined(it)); +}; + // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) @@ -1649,7 +911,7 @@ var _objectGpo = Object.getPrototypeOf || function (O) { } return O instanceof Object ? ObjectProto : null; }; -var ITERATOR$3 = _wks('iterator'); +var ITERATOR = _wks('iterator'); var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` var FF_ITERATOR = '@@iterator'; var KEYS = 'keys'; @@ -1670,7 +932,7 @@ var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORC var DEF_VALUES = DEFAULT == VALUES; var VALUES_BUG = false; var proto = Base.prototype; - var $native = proto[ITERATOR$3] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; + var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; var $default = $native || getMethod(DEFAULT); var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; @@ -1682,7 +944,7 @@ var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORC // Set @@toStringTag to native iterators _setToStringTag(IteratorPrototype, TAG, true); // fix for some old engines - if (!_library && typeof IteratorPrototype[ITERATOR$3] != 'function') _hide(IteratorPrototype, ITERATOR$3, returnThis); + if (!_library && typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis); } } // fix Array#{values, @@iterator}.name in V8 / FF @@ -1691,8 +953,8 @@ var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORC $default = function values() { return $native.call(this); }; } // Define iterator - if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR$3])) { - _hide(proto, ITERATOR$3, $default); + if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { + _hide(proto, ITERATOR, $default); } // Plug for library _iterators[NAME] = $default; @@ -1739,7 +1001,51 @@ _addToUnscopables('keys'); _addToUnscopables('values'); _addToUnscopables('entries'); -var ITERATOR$4 = _wks('iterator'); +var dP$1 = _objectDp.f; +var FProto = Function.prototype; +var nameRE = /^\s*function ([^ (]*)/; +var NAME = 'name'; + +// 19.2.4.2 name +NAME in FProto || _descriptors && dP$1(FProto, NAME, { + configurable: true, + get: function () { + try { + return ('' + this).match(nameRE)[1]; + } catch (e) { + return ''; + } + } +}); + +// 21.2.5.3 get RegExp.prototype.flags() +if (_descriptors && /./g.flags != 'g') _objectDp.f(RegExp.prototype, 'flags', { + configurable: true, + get: _flags +}); + +var TO_STRING = 'toString'; +var $toString = /./[TO_STRING]; + +var define = function (fn) { + _redefine(RegExp.prototype, TO_STRING, fn, true); +}; + +// 21.2.5.14 RegExp.prototype.toString() +if (_fails(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) { + define(function toString() { + var R = _anObject(this); + return '/'.concat(R.source, '/', + 'flags' in R ? R.flags : !_descriptors && R instanceof RegExp ? _flags.call(R) : undefined); + }); +// FF44- RegExp#toString has a wrong name +} else if ($toString.name != TO_STRING) { + define(function toString() { + return $toString.call(this); + }); +} + +var ITERATOR$1 = _wks('iterator'); var TO_STRING_TAG = _wks('toStringTag'); var ArrayValues = _iterators.Array; @@ -1778,52 +1084,253 @@ var DOMIterables = { }; for (var collections = _objectKeys(DOMIterables), i = 0; i < collections.length; i++) { - var NAME = collections[i]; - var explicit = DOMIterables[NAME]; - var Collection = _global[NAME]; - var proto$1 = Collection && Collection.prototype; - var key$1; - if (proto$1) { - if (!proto$1[ITERATOR$4]) _hide(proto$1, ITERATOR$4, ArrayValues); - if (!proto$1[TO_STRING_TAG]) _hide(proto$1, TO_STRING_TAG, NAME); - _iterators[NAME] = ArrayValues; - if (explicit) for (key$1 in es6_array_iterator) if (!proto$1[key$1]) _redefine(proto$1, key$1, es6_array_iterator[key$1], true); + var NAME$1 = collections[i]; + var explicit = DOMIterables[NAME$1]; + var Collection = _global[NAME$1]; + var proto = Collection && Collection.prototype; + var key; + if (proto) { + if (!proto[ITERATOR$1]) _hide(proto, ITERATOR$1, ArrayValues); + if (!proto[TO_STRING_TAG]) _hide(proto, TO_STRING_TAG, NAME$1); + _iterators[NAME$1] = ArrayValues; + if (explicit) for (key in es6_array_iterator) if (!proto[key]) _redefine(proto, key, es6_array_iterator[key], true); } } -// true -> String#at -// false -> String#codePointAt -var _stringAt = function (TO_STRING) { - return function (that, pos) { - var s = String(_defined(that)); - var i = _toInteger(pos); - var l = s.length; - var a, b; - if (i < 0 || i >= l) return TO_STRING ? '' : undefined; - a = s.charCodeAt(i); - return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff - ? TO_STRING ? s.charAt(i) : a - : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; - }; +function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); +} + +function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); +} + +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + + return arr2; + } +} + +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} + +function _iterableToArray(iter) { + if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); +} + +function _iterableToArrayLimit(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; +} + +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance"); +} + +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); +} + +var max$1 = 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 maybeToString = function (it) { + return it === undefined ? it : String(it); }; -var $at = _stringAt(true); +// @@replace logic +_fixReWks('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) { + return [ + // `String.prototype.replace` method + // https://tc39.github.io/ecma262/#sec-string.prototype.replace + function replace(searchValue, replaceValue) { + var O = defined(this); + var fn = searchValue == undefined ? undefined : searchValue[REPLACE]; + return fn !== undefined + ? fn.call(searchValue, O, replaceValue) + : $replace.call(String(O), searchValue, replaceValue); + }, + // `RegExp.prototype[@@replace]` method + // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace + function (regexp, replaceValue) { + var res = maybeCallNative($replace, regexp, this, replaceValue); + if (res.done) return res.value; -// 21.1.3.27 String.prototype[@@iterator]() -_iterDefine(String, 'String', function (iterated) { - this._t = String(iterated); // target - this._i = 0; // next index -// 21.1.5.2.1 %StringIteratorPrototype%.next() -}, function () { - var O = this._t; - var index = this._i; - var point; - if (index >= O.length) return { value: undefined, done: true }; - point = $at(O, index); - this._i += point.length; - return { value: point, done: false }; + 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; + 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$1(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; + } + } + 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 $replace.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; + }); + } }); +var f$1 = _wks; + +var _wksExt = { + f: f$1 +}; + +var defineProperty = _objectDp.f; +var _wksDefine = function (name) { + var $Symbol = _core.Symbol || (_core.Symbol = _global.Symbol || {}); + if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: _wksExt.f(name) }); +}; + +_wksDefine('asyncIterator'); + var _meta = createCommonjsModule(function (module) { var META = _uid('meta'); @@ -1885,12 +1392,1168 @@ var _meta_3 = _meta.fastKey; var _meta_4 = _meta.getWeak; var _meta_5 = _meta.onFreeze; -var f$4 = Object.getOwnPropertySymbols; +var f$2 = Object.getOwnPropertySymbols; var _objectGops = { + f: f$2 +}; + +var f$3 = {}.propertyIsEnumerable; + +var _objectPie = { + f: f$3 +}; + +// all enumerable object keys, includes symbols + + + +var _enumKeys = function (it) { + var result = _objectKeys(it); + var getSymbols = _objectGops.f; + if (getSymbols) { + var symbols = getSymbols(it); + var isEnum = _objectPie.f; + var i = 0; + var key; + while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); + } return result; +}; + +// 7.2.2 IsArray(argument) + +var _isArray = Array.isArray || function isArray(arg) { + return _cof(arg) == 'Array'; +}; + +// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) + +var hiddenKeys = _enumBugKeys.concat('length', 'prototype'); + +var f$4 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return _objectKeysInternal(O, hiddenKeys); +}; + +var _objectGopn = { f: f$4 }; +// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window + +var gOPN = _objectGopn.f; +var toString$1 = {}.toString; + +var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames + ? Object.getOwnPropertyNames(window) : []; + +var getWindowNames = function (it) { + try { + return gOPN(it); + } catch (e) { + return windowNames.slice(); + } +}; + +var f$5 = function getOwnPropertyNames(it) { + return windowNames && toString$1.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(_toIobject(it)); +}; + +var _objectGopnExt = { + f: f$5 +}; + +var gOPD = Object.getOwnPropertyDescriptor; + +var f$6 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P) { + O = _toIobject(O); + P = _toPrimitive(P, true); + if (_ie8DomDefine) try { + return gOPD(O, P); + } catch (e) { /* empty */ } + if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]); +}; + +var _objectGopd = { + f: f$6 +}; + +// ECMAScript 6 symbols shim + + + + + +var META = _meta.KEY; + + + + + + + + + + + + + + + + + + + +var gOPD$1 = _objectGopd.f; +var dP$2 = _objectDp.f; +var gOPN$1 = _objectGopnExt.f; +var $Symbol = _global.Symbol; +var $JSON = _global.JSON; +var _stringify = $JSON && $JSON.stringify; +var PROTOTYPE$2 = 'prototype'; +var HIDDEN = _wks('_hidden'); +var TO_PRIMITIVE = _wks('toPrimitive'); +var isEnum = {}.propertyIsEnumerable; +var SymbolRegistry = _shared('symbol-registry'); +var AllSymbols = _shared('symbols'); +var OPSymbols = _shared('op-symbols'); +var ObjectProto$1 = Object[PROTOTYPE$2]; +var USE_NATIVE = typeof $Symbol == 'function'; +var QObject = _global.QObject; +// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 +var setter = !QObject || !QObject[PROTOTYPE$2] || !QObject[PROTOTYPE$2].findChild; + +// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 +var setSymbolDesc = _descriptors && _fails(function () { + return _objectCreate(dP$2({}, 'a', { + get: function () { return dP$2(this, 'a', { value: 7 }).a; } + })).a != 7; +}) ? function (it, key, D) { + var protoDesc = gOPD$1(ObjectProto$1, key); + if (protoDesc) delete ObjectProto$1[key]; + dP$2(it, key, D); + if (protoDesc && it !== ObjectProto$1) dP$2(ObjectProto$1, key, protoDesc); +} : dP$2; + +var wrap = function (tag) { + var sym = AllSymbols[tag] = _objectCreate($Symbol[PROTOTYPE$2]); + sym._k = tag; + return sym; +}; + +var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) { + return typeof it == 'symbol'; +} : function (it) { + return it instanceof $Symbol; +}; + +var $defineProperty = function defineProperty(it, key, D) { + if (it === ObjectProto$1) $defineProperty(OPSymbols, key, D); + _anObject(it); + key = _toPrimitive(key, true); + _anObject(D); + if (_has(AllSymbols, key)) { + if (!D.enumerable) { + if (!_has(it, HIDDEN)) dP$2(it, HIDDEN, _propertyDesc(1, {})); + it[HIDDEN][key] = true; + } else { + if (_has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; + D = _objectCreate(D, { enumerable: _propertyDesc(0, false) }); + } return setSymbolDesc(it, key, D); + } return dP$2(it, key, D); +}; +var $defineProperties = function defineProperties(it, P) { + _anObject(it); + var keys = _enumKeys(P = _toIobject(P)); + var i = 0; + var l = keys.length; + var key; + while (l > i) $defineProperty(it, key = keys[i++], P[key]); + return it; +}; +var $create = function create(it, P) { + return P === undefined ? _objectCreate(it) : $defineProperties(_objectCreate(it), P); +}; +var $propertyIsEnumerable = function propertyIsEnumerable(key) { + var E = isEnum.call(this, key = _toPrimitive(key, true)); + if (this === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return false; + return E || !_has(this, key) || !_has(AllSymbols, key) || _has(this, HIDDEN) && this[HIDDEN][key] ? E : true; +}; +var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { + it = _toIobject(it); + key = _toPrimitive(key, true); + if (it === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return; + var D = gOPD$1(it, key); + if (D && _has(AllSymbols, key) && !(_has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; + return D; +}; +var $getOwnPropertyNames = function getOwnPropertyNames(it) { + var names = gOPN$1(_toIobject(it)); + var result = []; + var i = 0; + var key; + while (names.length > i) { + if (!_has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); + } return result; +}; +var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { + var IS_OP = it === ObjectProto$1; + var names = gOPN$1(IS_OP ? OPSymbols : _toIobject(it)); + var result = []; + var i = 0; + var key; + while (names.length > i) { + if (_has(AllSymbols, key = names[i++]) && (IS_OP ? _has(ObjectProto$1, key) : true)) result.push(AllSymbols[key]); + } return result; +}; + +// 19.4.1.1 Symbol([description]) +if (!USE_NATIVE) { + $Symbol = function Symbol() { + if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); + var tag = _uid(arguments.length > 0 ? arguments[0] : undefined); + var $set = function (value) { + if (this === ObjectProto$1) $set.call(OPSymbols, value); + if (_has(this, HIDDEN) && _has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; + setSymbolDesc(this, tag, _propertyDesc(1, value)); + }; + if (_descriptors && setter) setSymbolDesc(ObjectProto$1, tag, { configurable: true, set: $set }); + return wrap(tag); + }; + _redefine($Symbol[PROTOTYPE$2], 'toString', function toString() { + return this._k; + }); + + _objectGopd.f = $getOwnPropertyDescriptor; + _objectDp.f = $defineProperty; + _objectGopn.f = _objectGopnExt.f = $getOwnPropertyNames; + _objectPie.f = $propertyIsEnumerable; + _objectGops.f = $getOwnPropertySymbols; + + if (_descriptors && !_library) { + _redefine(ObjectProto$1, 'propertyIsEnumerable', $propertyIsEnumerable, true); + } + + _wksExt.f = function (name) { + return wrap(_wks(name)); + }; +} + +_export(_export.G + _export.W + _export.F * !USE_NATIVE, { Symbol: $Symbol }); + +for (var es6Symbols = ( + // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 + 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' +).split(','), j = 0; es6Symbols.length > j;)_wks(es6Symbols[j++]); + +for (var wellKnownSymbols = _objectKeys(_wks.store), k = 0; wellKnownSymbols.length > k;) _wksDefine(wellKnownSymbols[k++]); + +_export(_export.S + _export.F * !USE_NATIVE, 'Symbol', { + // 19.4.2.1 Symbol.for(key) + 'for': function (key) { + return _has(SymbolRegistry, key += '') + ? SymbolRegistry[key] + : SymbolRegistry[key] = $Symbol(key); + }, + // 19.4.2.5 Symbol.keyFor(sym) + 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; + }, + useSetter: function () { setter = true; }, + useSimple: function () { setter = false; } +}); + +_export(_export.S + _export.F * !USE_NATIVE, 'Object', { + // 19.1.2.2 Object.create(O [, Properties]) + create: $create, + // 19.1.2.4 Object.defineProperty(O, P, Attributes) + defineProperty: $defineProperty, + // 19.1.2.3 Object.defineProperties(O, Properties) + defineProperties: $defineProperties, + // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) + getOwnPropertyDescriptor: $getOwnPropertyDescriptor, + // 19.1.2.7 Object.getOwnPropertyNames(O) + getOwnPropertyNames: $getOwnPropertyNames, + // 19.1.2.8 Object.getOwnPropertySymbols(O) + getOwnPropertySymbols: $getOwnPropertySymbols +}); + +// 24.3.2 JSON.stringify(value [, replacer [, space]]) +$JSON && _export(_export.S + _export.F * (!USE_NATIVE || _fails(function () { + var S = $Symbol(); + // MS Edge converts symbol values to JSON as {} + // WebKit converts symbol values to JSON as null + // V8 throws on boxed symbols + return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; +})), 'JSON', { + stringify: function stringify(it) { + var args = [it]; + var i = 1; + var replacer, $replacer; + while (arguments.length > i) args.push(arguments[i++]); + $replacer = replacer = args[1]; + if (!_isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined + if (!_isArray(replacer)) replacer = function (key, value) { + if (typeof $replacer == 'function') value = $replacer.call(this, key, value); + if (!isSymbol(value)) return value; + }; + args[1] = replacer; + return _stringify.apply($JSON, args); + } +}); + +// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) +$Symbol[PROTOTYPE$2][TO_PRIMITIVE] || _hide($Symbol[PROTOTYPE$2], TO_PRIMITIVE, $Symbol[PROTOTYPE$2].valueOf); +// 19.4.3.5 Symbol.prototype[@@toStringTag] +_setToStringTag($Symbol, 'Symbol'); +// 20.2.1.9 Math[@@toStringTag] +_setToStringTag(Math, 'Math', true); +// 24.3.3 JSON[@@toStringTag] +_setToStringTag(_global.JSON, 'JSON', true); + +(function (global) { + /**
+ * Polyfill URLSearchParams
+ *
+ * Inspired from : https://github.com/WebReflection/url-search-params/blob/master/src/url-search-params.js
+ */ + var checkIfIteratorIsSupported = function checkIfIteratorIsSupported() { + try { + return !!Symbol.iterator; + } catch (error) { + return false; + } + }; + + var iteratorSupported = checkIfIteratorIsSupported(); + + var createIterator = function createIterator(items) { + var iterator = { + next: function next() { + var value = items.shift(); + return { + done: value === void 0, + value: value + }; + } + }; + + if (iteratorSupported) { + iterator[Symbol.iterator] = function () { + return iterator; + }; + } + + return iterator; + }; + /**
+ * Search param name and values should be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing
+ * encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.
+ */ + + + var serializeParam = function serializeParam(value) { + return encodeURIComponent(value).replace(/%20/g, '+'); + }; + + var deserializeParam = function deserializeParam(value) { + return decodeURIComponent(value).replace(/\+/g, ' '); + }; + + var polyfillURLSearchParams = function polyfillURLSearchParams() { + var URLSearchParams = function URLSearchParams(searchString) { + Object.defineProperty(this, '_entries', { + writable: true, + value: {} + }); + + var typeofSearchString = _typeof(searchString); + + if (typeofSearchString === 'undefined') ; else if (typeofSearchString === 'string') { + if (searchString !== '') { + this._fromString(searchString); + } + } else if (searchString instanceof URLSearchParams) { + var _this = this; + + searchString.forEach(function (value, name) { + _this.append(name, value); + }); + } else if (searchString !== null && typeofSearchString === 'object') { + if (Object.prototype.toString.call(searchString) === '[object Array]') { + for (var i = 0; i < searchString.length; i++) { + var entry = searchString[i]; + + if (Object.prototype.toString.call(entry) === '[object Array]' || entry.length !== 2) { + this.append(entry[0], entry[1]); + } else { + throw new TypeError('Expected [string, any] as entry at index ' + i + ' of URLSearchParams\'s input'); + } + } + } else { + for (var key in searchString) { + if (searchString.hasOwnProperty(key)) { + this.append(key, searchString[key]); + } + } + } + } else { + throw new TypeError('Unsupported input\'s type for URLSearchParams'); + } + }; + + var proto = URLSearchParams.prototype; + + proto.append = function (name, value) { + if (name in this._entries) { + this._entries[name].push(String(value)); + } else { + this._entries[name] = [String(value)]; + } + }; + + proto.delete = function (name) { + delete this._entries[name]; + }; + + proto.get = function (name) { + return name in this._entries ? this._entries[name][0] : null; + }; + + proto.getAll = function (name) { + return name in this._entries ? this._entries[name].slice(0) : []; + }; + + proto.has = function (name) { + return name in this._entries; + }; + + proto.set = function (name, value) { + this._entries[name] = [String(value)]; + }; + + proto.forEach = function (callback, thisArg) { + var entries; + + for (var name in this._entries) { + if (this._entries.hasOwnProperty(name)) { + entries = this._entries[name]; + + for (var i = 0; i < entries.length; i++) { + callback.call(thisArg, entries[i], name, this); + } + } + } + }; + + proto.keys = function () { + var items = []; + this.forEach(function (value, name) { + items.push(name); + }); + return createIterator(items); + }; + + proto.values = function () { + var items = []; + this.forEach(function (value) { + items.push(value); + }); + return createIterator(items); + }; + + proto.entries = function () { + var items = []; + this.forEach(function (value, name) { + items.push([name, value]); + }); + return createIterator(items); + }; + + if (iteratorSupported) { + proto[Symbol.iterator] = proto.entries; + } + + proto.toString = function () { + var searchArray = []; + this.forEach(function (value, name) { + searchArray.push(serializeParam(name) + '=' + serializeParam(value)); + }); + return searchArray.join('&'); + }; + + global.URLSearchParams = URLSearchParams; + }; + + if (!('URLSearchParams' in global) || new URLSearchParams('?a=1').toString() !== 'a=1') { + polyfillURLSearchParams(); + } + + var proto = URLSearchParams.prototype; + + if (typeof proto.sort !== 'function') { + proto.sort = function () { + var _this = this; + + var items = []; + this.forEach(function (value, name) { + items.push([name, value]); + + if (!_this._entries) { + _this.delete(name); + } + }); + items.sort(function (a, b) { + if (a[0] < b[0]) { + return -1; + } else if (a[0] > b[0]) { + return +1; + } else { + return 0; + } + }); + + if (_this._entries) { + // force reset because IE keeps keys index + _this._entries = {}; + } + + for (var i = 0; i < items.length; i++) { + this.append(items[i][0], items[i][1]); + } + }; + } + + if (typeof proto._fromString !== 'function') { + Object.defineProperty(proto, '_fromString', { + enumerable: false, + configurable: false, + writable: false, + value: function value(searchString) { + if (this._entries) { + this._entries = {}; + } else { + var keys = []; + this.forEach(function (value, name) { + keys.push(name); + }); + + for (var i = 0; i < keys.length; i++) { + this.delete(keys[i]); + } + } + + searchString = searchString.replace(/^\?/, ''); + var attributes = searchString.split('&'); + var attribute; + + for (var i = 0; i < attributes.length; i++) { + attribute = attributes[i].split('='); + this.append(deserializeParam(attribute[0]), attribute.length > 1 ? deserializeParam(attribute[1]) : ''); + } + } + }); + } // HTMLAnchorElement + +})(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : commonjsGlobal); + +(function (global) { + /**
+ * Polyfill URL
+ *
+ * Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
+ */ + var checkIfURLIsSupported = function checkIfURLIsSupported() { + try { + var u = new URL('b', 'http://a'); + u.pathname = 'c%20d'; + return u.href === 'http://a/c%20d' && u.searchParams; + } catch (e) { + return false; + } + }; + + var polyfillURL = function polyfillURL() { + var _URL = global.URL; + + var URL = function URL(url, base) { + if (typeof url !== 'string') url = String(url); // Only create another document if the base is different from current location. + + var doc = document, + baseElement; + + if (base && (global.location === void 0 || base !== global.location.href)) { + doc = document.implementation.createHTMLDocument(''); + baseElement = doc.createElement('base'); + baseElement.href = base; + doc.head.appendChild(baseElement); + + try { + if (baseElement.href.indexOf(base) !== 0) throw new Error(baseElement.href); + } catch (err) { + throw new Error('URL unable to set base ' + base + ' due to ' + err); + } + } + + var anchorElement = doc.createElement('a'); + anchorElement.href = url; + + if (baseElement) { + doc.body.appendChild(anchorElement); + anchorElement.href = anchorElement.href; // force href to refresh + } + + if (anchorElement.protocol === ':' || !/:/.test(anchorElement.href)) { + throw new TypeError('Invalid URL'); + } + + Object.defineProperty(this, '_anchorElement', { + value: anchorElement + }); // create a linked searchParams which reflect its changes on URL + + var searchParams = new URLSearchParams(this.search); + var enableSearchUpdate = true; + var enableSearchParamsUpdate = true; + + var _this = this; + + ['append', 'delete', 'set'].forEach(function (methodName) { + var method = searchParams[methodName]; + + searchParams[methodName] = function () { + method.apply(searchParams, arguments); + + if (enableSearchUpdate) { + enableSearchParamsUpdate = false; + _this.search = searchParams.toString(); + enableSearchParamsUpdate = true; + } + }; + }); + Object.defineProperty(this, 'searchParams', { + value: searchParams, + enumerable: true + }); + var search = void 0; + Object.defineProperty(this, '_updateSearchParams', { + enumerable: false, + configurable: false, + writable: false, + value: function value() { + if (this.search !== search) { + search = this.search; + + if (enableSearchParamsUpdate) { + enableSearchUpdate = false; + + this.searchParams._fromString(this.search); + + enableSearchUpdate = true; + } + } + } + }); + }; + + var proto = URL.prototype; + + var linkURLWithAnchorAttribute = function linkURLWithAnchorAttribute(attributeName) { + Object.defineProperty(proto, attributeName, { + get: function get() { + return this._anchorElement[attributeName]; + }, + set: function set(value) { + this._anchorElement[attributeName] = value; + }, + enumerable: true + }); + }; + + ['hash', 'host', 'hostname', 'port', 'protocol'].forEach(function (attributeName) { + linkURLWithAnchorAttribute(attributeName); + }); + Object.defineProperty(proto, 'search', { + get: function get() { + return this._anchorElement['search']; + }, + set: function set(value) { + this._anchorElement['search'] = value; + + this._updateSearchParams(); + }, + enumerable: true + }); + Object.defineProperties(proto, { + 'toString': { + get: function get() { + var _this = this; + + return function () { + return _this.href; + }; + } + }, + 'href': { + get: function get() { + return this._anchorElement.href.replace(/\?$/, ''); + }, + set: function set(value) { + this._anchorElement.href = value; + + this._updateSearchParams(); + }, + enumerable: true + }, + 'pathname': { + get: function get() { + return this._anchorElement.pathname.replace(/(^\/?)/, '/'); + }, + set: function set(value) { + this._anchorElement.pathname = value; + }, + enumerable: true + }, + 'origin': { + get: function get() { + // get expected port from protocol + var expectedPort = { + 'http:': 80, + 'https:': 443, + 'ftp:': 21 + }[this._anchorElement.protocol]; // add port to origin if, expected port is different than actual port + // and it is not empty f.e http://foo:8080 + // 8080 != 80 && 8080 != '' + + var addPortToOrigin = this._anchorElement.port != expectedPort && this._anchorElement.port !== ''; + return this._anchorElement.protocol + '//' + this._anchorElement.hostname + (addPortToOrigin ? ':' + this._anchorElement.port : ''); + }, + enumerable: true + }, + 'password': { + // TODO + get: function get() { + return ''; + }, + set: function set(value) {}, + enumerable: true + }, + 'username': { + // TODO + get: function get() { + return ''; + }, + set: function set(value) {}, + enumerable: true + } + }); + + URL.createObjectURL = function (blob) { + return _URL.createObjectURL.apply(_URL, arguments); + }; + + URL.revokeObjectURL = function (url) { + return _URL.revokeObjectURL.apply(_URL, arguments); + }; + + global.URL = URL; + }; + + if (!checkIfURLIsSupported()) { + polyfillURL(); + } + + if (global.location !== void 0 && !('origin' in global.location)) { + var getOrigin = function getOrigin() { + return global.location.protocol + '//' + global.location.hostname + (global.location.port ? ':' + global.location.port : ''); + }; + + try { + Object.defineProperty(global.location, 'origin', { + get: getOrigin, + enumerable: true + }); + } catch (e) { + setInterval(function () { + global.location.origin = getOrigin(); + }, 100); + } + } +})(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : commonjsGlobal); + +// call something on iterator step with safe closing on error + +var _iterCall = function (iterator, fn, value, entries) { + try { + return entries ? fn(_anObject(value)[0], value[1]) : fn(value); + // 7.4.6 IteratorClose(iterator, completion) + } catch (e) { + var ret = iterator['return']; + if (ret !== undefined) _anObject(ret.call(iterator)); + throw e; + } +}; + +// check on default Array iterator + +var ITERATOR$2 = _wks('iterator'); +var ArrayProto$1 = Array.prototype; + +var _isArrayIter = function (it) { + return it !== undefined && (_iterators.Array === it || ArrayProto$1[ITERATOR$2] === it); +}; + +var _createProperty = function (object, index, value) { + if (index in object) _objectDp.f(object, index, _propertyDesc(0, value)); + else object[index] = value; +}; + +var ITERATOR$3 = _wks('iterator'); + +var core_getIteratorMethod = _core.getIteratorMethod = function (it) { + if (it != undefined) return it[ITERATOR$3] + || it['@@iterator'] + || _iterators[_classof(it)]; +}; + +var ITERATOR$4 = _wks('iterator'); +var SAFE_CLOSING = false; + +try { + var riter = [7][ITERATOR$4](); + riter['return'] = function () { SAFE_CLOSING = true; }; +} catch (e) { /* empty */ } + +var _iterDetect = function (exec, skipClosing) { + if (!skipClosing && !SAFE_CLOSING) return false; + var safe = false; + try { + var arr = [7]; + var iter = arr[ITERATOR$4](); + iter.next = function () { return { done: safe = true }; }; + arr[ITERATOR$4] = function () { return iter; }; + exec(arr); + } catch (e) { /* empty */ } + return safe; +}; + +_export(_export.S + _export.F * !_iterDetect(function (iter) { }), 'Array', { + // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) + from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { + var O = _toObject(arrayLike); + var C = typeof this == 'function' ? this : Array; + var aLen = arguments.length; + var mapfn = aLen > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + var index = 0; + var iterFn = core_getIteratorMethod(O); + var length, result, step, iterator; + if (mapping) mapfn = _ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); + // if object isn't iterable or it's array with default iterator - use simple case + if (iterFn != undefined && !(C == Array && _isArrayIter(iterFn))) { + for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { + _createProperty(result, index, mapping ? _iterCall(iterator, mapfn, [step.value, index], true) : step.value); + } + } else { + length = _toLength(O.length); + for (result = new C(length); length > index; index++) { + _createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); + } + } + result.length = index; + return result; + } +}); + +var SPECIES$2 = _wks('species'); + +var _arraySpeciesConstructor = function (original) { + var C; + if (_isArray(original)) { + C = original.constructor; + // cross-realm fallback + if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined; + if (_isObject(C)) { + C = C[SPECIES$2]; + if (C === null) C = undefined; + } + } return C === undefined ? Array : C; +}; + +// 9.4.2.3 ArraySpeciesCreate(originalArray, length) + + +var _arraySpeciesCreate = function (original, length) { + return new (_arraySpeciesConstructor(original))(length); +}; + +// 0 -> Array#forEach +// 1 -> Array#map +// 2 -> Array#filter +// 3 -> Array#some +// 4 -> Array#every +// 5 -> Array#find +// 6 -> Array#findIndex + + + + + +var _arrayMethods = function (TYPE, $create) { + 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 = $create || _arraySpeciesCreate; + return function ($this, callbackfn, that) { + var O = _toObject($this); + var self = _iobject(O); + var f = _ctx(callbackfn, that, 3); + var length = _toLength(self.length); + var index = 0; + var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; + var val, res; + for (;length > index; index++) if (NO_HOLES || index in self) { + val = self[index]; + res = f(val, index, O); + if (TYPE) { + if (IS_MAP) result[index] = res; // map + else if (res) switch (TYPE) { + case 3: return true; // some + case 5: return val; // find + case 6: return index; // findIndex + case 2: result.push(val); // filter + } else if (IS_EVERY) return false; // every + } + } + return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; + }; +}; + +// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) + +var $find = _arrayMethods(5); +var KEY = 'find'; +var forced = true; +// Shouldn't skip holes +if (KEY in []) Array(1)[KEY](function () { forced = false; }); +_export(_export.P + _export.F * forced, 'Array', { + find: function find(callbackfn /* , that = undefined */) { + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } +}); +_addToUnscopables(KEY); + +// Works with __proto__ only. Old v8 can't work with null proto objects. +/* eslint-disable no-proto */ + + +var check = function (O, proto) { + _anObject(O); + if (!_isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); +}; +var _setProto = { + set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line + function (test, buggy, set) { + try { + set = _ctx(Function.call, _objectGopd.f(Object.prototype, '__proto__').set, 2); + set(test, []); + buggy = !(test instanceof Array); + } catch (e) { buggy = true; } + return function setPrototypeOf(O, proto) { + check(O, proto); + if (buggy) O.__proto__ = proto; + else set(O, proto); + return O; + }; + }({}, false) : undefined), + check: check +}; + +var setPrototypeOf = _setProto.set; +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) && setPrototypeOf) { + setPrototypeOf(that, P); + } return that; +}; + +var _stringWs = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; + +var space = '[' + _stringWs + ']'; +var non = '\u200b\u0085'; +var ltrim = RegExp('^' + space + space + '*'); +var rtrim = RegExp(space + space + '*$'); + +var exporter = function (KEY, exec, ALIAS) { + var exp = {}; + var FORCE = _fails(function () { + return !!_stringWs[KEY]() || non[KEY]() != non; + }); + var fn = exp[KEY] = FORCE ? exec(trim) : _stringWs[KEY]; + if (ALIAS) exp[ALIAS] = fn; + _export(_export.P + _export.F * FORCE, 'String', exp); +}; + +// 1 -> String#trimLeft +// 2 -> String#trimRight +// 3 -> String#trim +var trim = exporter.trim = function (string, TYPE) { + string = String(_defined(string)); + if (TYPE & 1) string = string.replace(ltrim, ''); + if (TYPE & 2) string = string.replace(rtrim, ''); + return string; +}; + +var _stringTrim = exporter; + +var gOPN$2 = _objectGopn.f; +var gOPD$2 = _objectGopd.f; +var dP$3 = _objectDp.f; +var $trim = _stringTrim.trim; +var NUMBER = 'Number'; +var $Number = _global[NUMBER]; +var Base = $Number; +var proto$1 = $Number.prototype; +// Opera ~12 has broken Object#toString +var BROKEN_COF = _cof(_objectCreate(proto$1)) == NUMBER; +var TRIM = 'trim' in String.prototype; + +// 7.1.3 ToNumber(argument) +var toNumber = function (argument) { + var it = _toPrimitive(argument, false); + if (typeof it == 'string' && it.length > 2) { + it = TRIM ? it.trim() : $trim(it, 3); + var first = it.charCodeAt(0); + var third, radix, maxCode; + if (first === 43 || first === 45) { + third = it.charCodeAt(2); + if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix + } else if (first === 48) { + switch (it.charCodeAt(1)) { + case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i + case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i + default: return +it; + } + for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) { + code = digits.charCodeAt(i); + // 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; + } return parseInt(digits, radix); + } + } return +it; +}; + +if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) { + $Number = function Number(value) { + var it = arguments.length < 1 ? 0 : value; + var that = this; + return that instanceof $Number + // check on 1..constructor(foo) case + && (BROKEN_COF ? _fails(function () { proto$1.valueOf.call(that); }) : _cof(that) != NUMBER) + ? _inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it); + }; + for (var keys = _descriptors ? gOPN$2(Base) : ( + // ES3: + 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + + // ES6 (in case, if modules with ES6 Number statics required before): + 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' + ).split(','), j$1 = 0, key$1; keys.length > j$1; j$1++) { + if (_has(Base, key$1 = keys[j$1]) && !_has($Number, key$1)) { + dP$3($Number, key$1, gOPD$2(Base, key$1)); + } + } + $Number.prototype = proto$1; + proto$1.constructor = $Number; + _redefine(_global, NUMBER, $Number); +} + +// most Object methods by ES6 should accept primitives + + + +var _objectSap = function (KEY, exec) { + var fn = (_core.Object || {})[KEY] || Object[KEY]; + var exp = {}; + exp[KEY] = exec(fn); + _export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp); +}; + +// 19.1.2.14 Object.keys(O) + + + +_objectSap('keys', function () { + return function keys(it) { + return _objectKeys(_toObject(it)); + }; +}); + +// helper for String#{startsWith, endsWith, includes} + + + +var _stringContext = function (that, searchString, NAME) { + if (_isRegexp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); + return String(_defined(that)); +}; + +var MATCH$1 = _wks('match'); +var _failsIsRegexp = function (KEY) { + var re = /./; + try { + '/./'[KEY](re); + } catch (e) { + try { + re[MATCH$1] = false; + return !'/./'[KEY](re); + } catch (f) { /* empty */ } + } return true; +}; + +var INCLUDES = 'includes'; + +_export(_export.P + _export.F * _failsIsRegexp(INCLUDES), 'String', { + includes: function includes(searchString /* , position = 0 */) { + return !!~_stringContext(this, searchString, INCLUDES) + .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); + } +}); + +// https://github.com/tc39/Array.prototype.includes + +var $includes = _arrayIncludes(true); + +_export(_export.P, 'Array', { + includes: function includes(el /* , fromIndex = 0 */) { + return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); + } +}); + +_addToUnscopables('includes'); + +var $at = _stringAt(true); + +// 21.1.3.27 String.prototype[@@iterator]() +_iterDefine(String, 'String', function (iterated) { + this._t = String(iterated); // target + this._i = 0; // next index +// 21.1.5.2.1 %StringIteratorPrototype%.next() +}, function () { + var O = this._t; + var index = this._i; + var point; + if (index >= O.length) return { value: undefined, done: true }; + point = $at(O, index); + this._i += point.length; + return { value: point, done: false }; +}); + // 19.1.2.1 Object.assign(target, source, ...) @@ -1973,7 +2636,7 @@ var getWeak = _meta.getWeak; var arrayFind = _arrayMethods(5); var arrayFindIndex = _arrayMethods(6); -var id$1 = 0; +var id$2 = 0; // fallback for uncaught frozen keys var uncaughtFrozenStore = function (that) { @@ -2014,7 +2677,7 @@ var _collectionWeak = { var C = wrapper(function (that, iterable) { _anInstance(that, C, NAME, '_i'); that._t = NAME; // collection type - that._i = id$1++; // collection id + that._i = id$2++; // collection id that._l = undefined; // leak store for uncaught frozen objects if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that); }); @@ -2181,276 +2844,12 @@ if (NATIVE_WEAK_MAP && IS_IE11) { } }); -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} - -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } -} - -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; -} - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; -} - -function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); -} - -function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); -} - -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } -} - -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} - -function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); -} - -function _iterableToArrayLimit(arr, i) { - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; -} - -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); -} - -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); -} - -var _strictMethod = function (method, arg) { - return !!method && _fails(function () { - // eslint-disable-next-line no-useless-call - arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null); - }); -}; - -var $sort = [].sort; -var test = [1, 2, 3]; - -_export(_export.P + _export.F * (_fails(function () { - // IE8- - test.sort(undefined); -}) || !_fails(function () { - // V8 bug - test.sort(null); - // Old WebKit -}) || !_strictMethod($sort)), 'Array', { - // 22.1.3.25 Array.prototype.sort(comparefn) - sort: function sort(comparefn) { - return comparefn === undefined - ? $sort.call(_toObject(this)) - : $sort.call(_toObject(this), _aFunction(comparefn)); - } -}); - // 19.1.3.1 Object.assign(target, source) _export(_export.S + _export.F, 'Object', { assign: _objectAssign }); -// 7.3.20 SpeciesConstructor(O, defaultConstructor) - - -var SPECIES$2 = _wks('species'); -var _speciesConstructor = function (O, D) { - var C = _anObject(O).constructor; - var S; - return C === undefined || (S = _anObject(C)[SPECIES$2]) == undefined ? D : _aFunction(S); -}; - -var at = _stringAt(true); - - // `AdvanceStringIndex` abstract operation -// https://tc39.github.io/ecma262/#sec-advancestringindex -var _advanceStringIndex = function (S, index, unicode) { - return index + (unicode ? at(S, index).length : 1); -}; - -var $min = Math.min; -var $push = [].push; -var $SPLIT = 'split'; -var LENGTH = 'length'; -var LAST_INDEX$1 = 'lastIndex'; -var MAX_UINT32 = 0xffffffff; - -// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError -var SUPPORTS_Y = !_fails(function () { }); - -// @@split logic -_fixReWks('split', 2, function (defined, SPLIT, $split, 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(this); - if (separator === undefined && limit === 0) return []; - // If `separator` is not a regex, use native split - if (!_isRegexp(separator)) return $split.call(string, separator, limit); - var output = []; - var flags = (separator.ignoreCase ? 'i' : '') + - (separator.multiline ? 'm' : '') + - (separator.unicode ? 'u' : '') + - (separator.sticky ? 'y' : ''); - var lastLastIndex = 0; - var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 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[LAST_INDEX$1]; - if (lastIndex > lastLastIndex) { - output.push(string.slice(lastLastIndex, match.index)); - if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1)); - lastLength = match[0][LENGTH]; - lastLastIndex = lastIndex; - if (output[LENGTH] >= splitLimit) break; - } - if (separatorCopy[LAST_INDEX$1] === match.index) separatorCopy[LAST_INDEX$1]++; // Avoid an infinite loop - } - if (lastLastIndex === string[LENGTH]) { - if (lastLength || !separatorCopy.test('')) output.push(''); - } else output.push(string.slice(lastLastIndex)); - return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; - }; - // Chakra, V8 - } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) { - internalSplit = function (separator, limit) { - return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit); - }; - } else { - internalSplit = $split; - } - - return [ - // `String.prototype.split` method - // https://tc39.github.io/ecma262/#sec-string.prototype.split - function split(separator, limit) { - var O = defined(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 !== $split); - 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(_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; - } - q = p = e; - } - } - A.push(S.slice(p)); - return A; - } - ]; -}); - -var isEnum = _objectPie.f; +var isEnum$1 = _objectPie.f; var _objectToArray = function (isEntries) { return function (it) { var O = _toIobject(it); @@ -2459,7 +2858,7 @@ var _objectToArray = function (isEntries) { var i = 0; var result = []; var key; - while (length > i) if (isEnum.call(O, key = keys[i++])) { + while (length > i) if (isEnum$1.call(O, key = keys[i++])) { result.push(isEntries ? [key, O[key]] : O[key]); } return result; }; @@ -2485,390 +2884,365 @@ _export(_export.S, 'Object', { } }); -var max$1 = 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 maybeToString = function (it) { - return it === undefined ? it : String(it); -}; - -// @@replace logic -_fixReWks('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) { - return [ - // `String.prototype.replace` method - // https://tc39.github.io/ecma262/#sec-string.prototype.replace - function replace(searchValue, replaceValue) { - var O = defined(this); - var fn = searchValue == undefined ? undefined : searchValue[REPLACE]; - return fn !== undefined - ? fn.call(searchValue, O, replaceValue) - : $replace.call(String(O), searchValue, replaceValue); - }, - // `RegExp.prototype[@@replace]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace - function (regexp, replaceValue) { - var res = maybeCallNative($replace, 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; - 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$1(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; - } - } - 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 $replace.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; - }); - } -}); +var defaults = { + addCSS: true, + // Add CSS to the element to improve usability (required here or in your CSS!) + thumbWidth: 15, + // The width of the thumb handle + watch: true // Watch for new elements that match a string target -const defaults = { - addCSS: true, // Add CSS to the element to improve usability (required here or in your CSS!) - thumbWidth: 15, // The width of the thumb handle - watch: true, // Watch for new elements that match a string target }; // Element matches a selector function matches(element, selector) { - function match() { - return Array.from(document.querySelectorAll(selector)).includes(this); - } - - const matches = - match; + function match() { + return Array.from(document.querySelectorAll(selector)).includes(this); + } - return matches.call(element, selector); + var matches = match; + return matches.call(element, selector); } // Trigger event function trigger(element, type) { - if (!element || !type) { - return; - } + if (!element || !type) { + return; + } // Create and dispatch the event - // Create and dispatch the event - const event = new Event(type); - // Dispatch the event - element.dispatchEvent(event); + var event = new Event(type); // Dispatch the event + + element.dispatchEvent(event); } +// 20.1.2.4 Number.isNaN(number) + + +_export(_export.S, 'Number', { + isNaN: function isNaN(number) { + // eslint-disable-next-line no-self-compare + return number != number; + } +}); + // ========================================================================== // Type checking utils // ========================================================================== +var getConstructor = function getConstructor(input) { + return input !== null && typeof input !== 'undefined' ? input.constructor : null; +}; + +var instanceOf = function instanceOf(input, constructor) { + return Boolean(input && constructor && input instanceof constructor); +}; -const getConstructor = input => (input !== null && typeof input !== 'undefined' ? input.constructor : null); -const instanceOf = (input, constructor) => Boolean(input && constructor && input instanceof constructor); - -const isNullOrUndefined = input => input === null || typeof input === 'undefined'; -const isObject = input => getConstructor(input) === Object; -const isNumber = input => getConstructor(input) === Number && !Number.isNaN(input); -const isString = input => getConstructor(input) === String; -const isBoolean = input => getConstructor(input) === Boolean; -const isFunction = input => getConstructor(input) === Function; -const isArray = input => Array.isArray(input); -const isNodeList = input => instanceOf(input, NodeList); -const isElement = input => instanceOf(input, Element); -const isEvent = input => instanceOf(input, Event); -const isEmpty = input => - isNullOrUndefined(input) || - ((isString(input) || isArray(input) || isNodeList(input)) && !input.length) || - (isObject(input) && !Object.keys(input).length); +var isNullOrUndefined = function isNullOrUndefined(input) { + return input === null || typeof input === 'undefined'; +}; + +var isObject = function isObject(input) { + return getConstructor(input) === Object; +}; + +var isNumber = function isNumber(input) { + return getConstructor(input) === Number && !Number.isNaN(input); +}; + +var isString = function isString(input) { + return getConstructor(input) === String; +}; + +var isBoolean = function isBoolean(input) { + return getConstructor(input) === Boolean; +}; + +var isFunction = function isFunction(input) { + return getConstructor(input) === Function; +}; + +var isArray = function isArray(input) { + return Array.isArray(input); +}; + +var isNodeList = function isNodeList(input) { + return instanceOf(input, NodeList); +}; + +var isElement = function isElement(input) { + return instanceOf(input, Element); +}; + +var isEvent = function isEvent(input) { + return instanceOf(input, Event); +}; + +var isEmpty = function isEmpty(input) { + return isNullOrUndefined(input) || (isString(input) || isArray(input) || isNodeList(input)) && !input.length || isObject(input) && !Object.keys(input).length; +}; var is$1 = { - nullOrUndefined: isNullOrUndefined, - object: isObject, - number: isNumber, - string: isString, - boolean: isBoolean, - function: isFunction, - array: isArray, - nodeList: isNodeList, - element: isElement, - event: isEvent, - empty: isEmpty, + nullOrUndefined: isNullOrUndefined, + object: isObject, + number: isNumber, + string: isString, + boolean: isBoolean, + function: isFunction, + array: isArray, + nodeList: isNodeList, + element: isElement, + event: isEvent, + empty: isEmpty }; +// @@match logic +_fixReWks('match', 1, function (defined, MATCH, $match, maybeCallNative) { + return [ + // `String.prototype.match` method + // https://tc39.github.io/ecma262/#sec-string.prototype.match + function match(regexp) { + var O = defined(this); + var fn = regexp == undefined ? undefined : regexp[MATCH]; + return fn !== undefined ? fn.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($match, 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) { - const match = `${value}`.match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); + var match = "".concat(value).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); - if (!match) { - return 0; - } + if (!match) { + return 0; + } - return Math.max( - 0, - // Number of digits right of decimal point. - (match[1] ? match[1].length : 0) - - // Adjust for scientific notation. - (match[2] ? +match[2] : 0), - ); -} + return Math.max(0, // Number of digits right of decimal point. + (match[1] ? match[1].length : 0) - ( // Adjust for scientific notation. + match[2] ? +match[2] : 0)); +} // Round to the nearest step -// Round to the nearest step function round(number, step) { - if (step < 1) { - const places = getDecimalPlaces(step); - return parseFloat(number.toFixed(places)); - } - return Math.round(number / step) * step; + if (step < 1) { + var places = getDecimalPlaces(step); + return parseFloat(number.toFixed(places)); + } + + return Math.round(number / step) * step; } -// ========================================================================== +var RangeTouch = +/*#__PURE__*/ +function () { + /** + * Setup a new instance + * @param {String|Element} target + * @param {Object} options + */ + function RangeTouch(target, options) { + _classCallCheck(this, RangeTouch); -class RangeTouch { - /** - * Setup a new instance - * @param {String|Element} target - * @param {Object} options - */ - constructor(target, options) { - if (is$1.element(target)) { - // An Element is passed, use it directly - this.element = target; - } else if (is$1.string(target)) { - // A CSS Selector is passed, fetch it from the DOM - this.element = document.querySelector(target); - } + if (is$1.element(target)) { + // An Element is passed, use it directly + this.element = target; + } else if (is$1.string(target)) { + // A CSS Selector is passed, fetch it from the DOM + this.element = document.querySelector(target); + } - if (!is$1.element(this.element) || !is$1.empty(this.element.rangeTouch)) { - return; - } + if (!is$1.element(this.element) || !is$1.empty(this.element.rangeTouch)) { + return; + } - this.config = Object.assign({}, defaults, options); + this.config = Object.assign({}, defaults, options); + this.init(); + } + + _createClass(RangeTouch, [{ + key: "init", + value: function init() { + // Bail if not a touch enabled device + if (!RangeTouch.enabled) { + return; + } // Add useful CSS + + + if (this.config.addCSS) { + // TODO: Restore original values on destroy + this.element.style.userSelect = 'none'; + this.element.style.webKitUserSelect = 'none'; + this.element.style.touchAction = 'manipulation'; + } - this.init(); + this.listeners(true); + this.element.rangeTouch = this; } + }, { + key: "destroy", + value: function destroy() { + // Bail if not a touch enabled device + if (!RangeTouch.enabled) { + return; + } - static get enabled() { - return 'ontouchstart' in document.documentElement; + this.listeners(false); + this.element.rangeTouch = null; } + }, { + key: "listeners", + value: function listeners(toggle) { + var _this = this; + + var method = toggle ? 'addEventListener' : 'removeEventListener'; // Listen for events + ['touchstart', 'touchmove', 'touchend'].forEach(function (type) { + _this.element[method](type, function (event) { + return _this.set(event); + }, false); + }); + } /** - * Setup multiple instances - * @param {String|Element|NodeList|Array} target - * @param {Object} options + * Get the value based on touch position + * @param {Event} event */ - static setup(target, options = {}) { - let targets = null; - - if (is$1.empty(target) || is$1.string(target)) { - targets = Array.from(document.querySelectorAll(is$1.string(target) ? target : 'input[type="range"]')); - } else if (is$1.element(target)) { - targets = [target]; - } else if (is$1.nodeList(target)) { - targets = Array.from(target); - } else if (is$1.array(target)) { - targets = target.filter(is$1.element); - } - if (is$1.empty(targets)) { - return null; - } + }, { + key: "get", + value: function get(event) { + if (!RangeTouch.enabled || !is$1.event(event)) { + return null; + } - const config = Object.assign({}, defaults, options); - - if (is$1.string(target) && config.watch) { - // Create an observer instance - const observer = new MutationObserver(mutations => { - Array.from(mutations).forEach(mutation => { - Array.from(mutation.addedNodes).forEach(node => { - if (!is$1.element(node) || !matches(node, target)) { - return; - } - - // eslint-disable-next-line no-unused-vars - const range = new RangeTouch(node, config); - }); - }); - }); + var input = event.target; + var touch = event.changedTouches[0]; + var min = parseFloat(input.getAttribute('min')) || 0; + var max = parseFloat(input.getAttribute('max')) || 100; + var step = parseFloat(input.getAttribute('step')) || 1; + var delta = max - min; // Calculate percentage - // Pass in the target node, as well as the observer options - observer.observe(document.body, { - childList: true, - subtree: true, - }); - } + var percent; + var clientRect = input.getBoundingClientRect(); + var thumbWidth = 100 / clientRect.width * (this.config.thumbWidth / 2) / 100; // Determine left percentage - return targets.map(t => new RangeTouch(t, options)); - } + percent = 100 / clientRect.width * (touch.clientX - clientRect.left); // Don't allow outside bounds - init() { - // Bail if not a touch enabled device - if (!RangeTouch.enabled) { - return; - } + if (percent < 0) { + percent = 0; + } else if (percent > 100) { + percent = 100; + } // Factor in the thumb offset - // Add useful CSS - if (this.config.addCSS) { - // TODO: Restore original values on destroy - this.element.style.userSelect = 'none'; - this.element.style.webKitUserSelect = 'none'; - this.element.style.touchAction = 'manipulation'; - } - this.listeners(true); + if (percent < 50) { + percent -= (100 - percent * 2) * thumbWidth; + } else if (percent > 50) { + percent += (percent - 50) * 2 * thumbWidth; + } // Find the closest step to the mouse position - this.element.rangeTouch = this; + + return min + round(delta * (percent / 100), step); } + /** + * Update range value based on position + * @param {Event} event + */ - destroy() { - // Bail if not a touch enabled device - if (!RangeTouch.enabled) { - return; - } + }, { + key: "set", + value: function set(event) { + if (!RangeTouch.enabled || !is$1.event(event) || event.target.disabled) { + return; + } // Prevent text highlight on iOS - this.listeners(false); - this.element.rangeTouch = null; - } + event.preventDefault(); // Set value - listeners(toggle) { - const method = toggle ? 'addEventListener' : 'removeEventListener'; + event.target.value = this.get(event); // Trigger event - // Listen for events - ['touchstart', 'touchmove', 'touchend'].forEach(type => { - this.element[method](type, event => this.set(event), false); - }); + trigger(event.target, event.type === 'touchend' ? 'change' : 'input'); } + }], [{ + key: "setup", /** - * Get the value based on touch position - * @param {Event} event + * Setup multiple instances + * @param {String|Element|NodeList|Array} target + * @param {Object} options */ - get(event) { - if (!RangeTouch.enabled || !is$1.event(event)) { - return null; - } + value: function setup(target) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var targets = null; - const input = event.target; - const touch = event.changedTouches[0]; - const min = parseFloat(input.getAttribute('min')) || 0; - const max = parseFloat(input.getAttribute('max')) || 100; - const step = parseFloat(input.getAttribute('step')) || 1; - const delta = max - min; - - // Calculate percentage - let percent; - const clientRect = input.getBoundingClientRect(); - const thumbWidth = ((100 / clientRect.width) * (this.config.thumbWidth / 2)) / 100; - - // Determine left percentage - percent = (100 / clientRect.width) * (touch.clientX - clientRect.left); - - // Don't allow outside bounds - if (percent < 0) { - percent = 0; - } else if (percent > 100) { - percent = 100; - } + if (is$1.empty(target) || is$1.string(target)) { + targets = Array.from(document.querySelectorAll(is$1.string(target) ? target : 'input[type="range"]')); + } else if (is$1.element(target)) { + targets = [target]; + } else if (is$1.nodeList(target)) { + targets = Array.from(target); + } else if (is$1.array(target)) { + targets = target.filter(is$1.element); + } - // Factor in the thumb offset - if (percent < 50) { - percent -= (100 - percent * 2) * thumbWidth; - } else if (percent > 50) { - percent += (percent - 50) * 2 * thumbWidth; - } + if (is$1.empty(targets)) { + return null; + } - // Find the closest step to the mouse position - return min + round(delta * (percent / 100), step); - } + var config = Object.assign({}, defaults, options); + + if (is$1.string(target) && config.watch) { + // Create an observer instance + var observer = new MutationObserver(function (mutations) { + Array.from(mutations).forEach(function (mutation) { + Array.from(mutation.addedNodes).forEach(function (node) { + if (!is$1.element(node) || !matches(node, target)) { + return; + } // eslint-disable-next-line no-unused-vars - /** - * Update range value based on position - * @param {Event} event - */ - set(event) { - if (!RangeTouch.enabled || !is$1.event(event) || event.target.disabled) { - return; - } - // Prevent text highlight on iOS - event.preventDefault(); + var range = new RangeTouch(node, config); + }); + }); + }); // Pass in the target node, as well as the observer options - // Set value - event.target.value = this.get(event); + observer.observe(document.body, { + childList: true, + subtree: true + }); + } - // Trigger event - trigger(event.target, event.type === 'touchend' ? 'change' : 'input'); + return targets.map(function (t) { + return new RangeTouch(t, options); + }); } -} + }, { + key: "enabled", + get: function get() { + return 'ontouchstart' in document.documentElement; + } + }]); + + return RangeTouch; +}(); // fast apply, http://jsperf.lnkit.com/fast-apply/5 var _invoke = function (fn, args, that) { @@ -3050,12 +3424,12 @@ function PromiseCapability(C) { this.reject = _aFunction(reject); } -var f$5 = function (C) { +var f$7 = function (C) { return new PromiseCapability(C); }; var _newPromiseCapability = { - f: f$5 + f: f$7 }; var _perform = function (exec) { @@ -3106,7 +3480,7 @@ var empty = function () { /* empty */ }; var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper; var newPromiseCapability = newGenericPromiseCapability = _newPromiseCapability.f; -var USE_NATIVE = !!function () { +var USE_NATIVE$1 = !!function () { try { // correct subclassing with @@species support var promise = $Promise.resolve(1); @@ -3247,7 +3621,7 @@ var $resolve = function (value) { }; // constructor polyfill -if (!USE_NATIVE) { +if (!USE_NATIVE$1) { // 25.4.3.1 Promise(executor) $Promise = function Promise(executor) { _anInstance(this, $Promise, PROMISE, '_h'); @@ -3299,13 +3673,13 @@ if (!USE_NATIVE) { }; } -_export(_export.G + _export.W + _export.F * !USE_NATIVE, { Promise: $Promise }); +_export(_export.G + _export.W + _export.F * !USE_NATIVE$1, { Promise: $Promise }); _setToStringTag($Promise, PROMISE); _setSpecies(PROMISE); Wrapper = _core[PROMISE]; // statics -_export(_export.S + _export.F * !USE_NATIVE, PROMISE, { +_export(_export.S + _export.F * !USE_NATIVE$1, PROMISE, { // 25.4.4.5 Promise.reject(r) reject: function reject(r) { var capability = newPromiseCapability(this); @@ -3314,13 +3688,13 @@ _export(_export.S + _export.F * !USE_NATIVE, PROMISE, { return capability.promise; } }); -_export(_export.S + _export.F * (_library || !USE_NATIVE), PROMISE, { +_export(_export.S + _export.F * (_library || !USE_NATIVE$1), PROMISE, { // 25.4.4.6 Promise.resolve(x) resolve: function resolve(x) { return _promiseResolve(_library && this === Wrapper ? $Promise : this, x); } }); -_export(_export.S + _export.F * !(USE_NATIVE && _iterDetect(function (iter) { +_export(_export.S + _export.F * !(USE_NATIVE$1 && _iterDetect(function (iter) { $Promise.all(iter)['catch'](empty); })), PROMISE, { // 25.4.4.1 Promise.all(iterable) @@ -3379,16 +3753,6 @@ _export(_export.P + _export.F * _failsIsRegexp(STARTS_WITH), 'String', { } }); -// 20.1.2.4 Number.isNaN(number) - - -_export(_export.S, 'Number', { - isNaN: function isNaN(number) { - // eslint-disable-next-line no-self-compare - return number != number; - } -}); - // ========================================================================== // Type checking utils // ========================================================================== @@ -3659,7 +4023,7 @@ function ready() { }).then(function () {}); } -function wrap(elements, wrapper) { +function wrap$1(elements, wrapper) { // Convert `elements` to an array, if necessary. var targets = elements.length ? elements : [elements]; // Loops backwards to prevent having to clone the wrapper on the // first element (see `child` below). @@ -4243,8 +4607,8 @@ function extend() { return extend.apply(void 0, [target].concat(sources)); } -var dP$2 = _objectDp.f; -var gOPN$1 = _objectGopn.f; +var dP$4 = _objectDp.f; +var gOPN$3 = _objectGopn.f; var $RegExp = _global.RegExp; @@ -4271,13 +4635,13 @@ if (_descriptors && (!CORRECT_NEW || _fails(function () { , tiRE ? this : proto$2, $RegExp); }; var proxy = function (key) { - key in $RegExp || dP$2($RegExp, key, { + key in $RegExp || dP$4($RegExp, key, { configurable: true, get: function () { return Base$1[key]; }, set: function (it) { Base$1[key] = it; } }); }; - for (var keys$1 = gOPN$1(Base$1), i$1 = 0; keys$1.length > i$1;) proxy(keys$1[i$1++]); + for (var keys$1 = gOPN$3(Base$1), i$1 = 0; keys$1.length > i$1;) proxy(keys$1[i$1++]); proto$2.constructor = $RegExp; $RegExp.prototype = proto$2; _redefine(_global, 'RegExp', $RegExp); @@ -6091,8 +6455,8 @@ var controls = { /** * Parse a string to a URL object - * @param {string} input - the URL to be parsed - * @param {boolean} safe - failsafe parsing + * @param {String} input - the URL to be parsed + * @param {Boolean} safe - failsafe parsing */ function parseUrl(input) { @@ -6539,7 +6903,7 @@ var defaults$1 = { // Sprite (for icons) loadSprite: true, iconPrefix: 'plyr', - iconUrl: 'https://cdn.plyr.io/3.5.0/plyr.svg', + iconUrl: 'https://cdn.plyr.io/3.5.1/plyr.svg', // Blank video (used to prevent errors on source change) blankVideo: 'https://cdn.plyr.io/static/blank.mp4', // Quality default @@ -8245,347 +8609,274 @@ function () { return Listeners; }(); -var dP$3 = _objectDp.f; -var FProto = Function.prototype; -var nameRE = /^\s*function ([^ (]*)/; -var NAME$1 = 'name'; - -// 19.2.4.2 name -NAME$1 in FProto || _descriptors && dP$3(FProto, NAME$1, { - configurable: true, - get: function () { - try { - return ('' + this).match(nameRE)[1]; - } catch (e) { - return ''; +var loadjs_umd = createCommonjsModule(function (module, exports) { + (function (root, factory) { + { + module.exports = factory(); } - } -}); + })(commonjsGlobal, function () { + /** + * Global dependencies. + * @global {Object} document - DOM + */ + var devnull = function devnull() {}, + bundleIdCache = {}, + bundleResultCache = {}, + bundleCallbackQueue = {}; + /** + * Subscribe to bundle load event. + * @param {string[]} bundleIds - Bundle ids + * @param {Function} callbackFn - The callback function + */ -// @@match logic -_fixReWks('match', 1, function (defined, MATCH, $match, maybeCallNative) { - return [ - // `String.prototype.match` method - // https://tc39.github.io/ecma262/#sec-string.prototype.match - function match(regexp) { - var O = defined(this); - var fn = regexp == undefined ? undefined : regexp[MATCH]; - return fn !== undefined ? fn.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($match, 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; - } - ]; -}); -var loadjs_umd = createCommonjsModule(function (module, exports) { -(function(root, factory) { - { - module.exports = factory(); - } -}(commonjsGlobal, function() { -/** - * Global dependencies. - * @global {Object} document - DOM - */ + function subscribe(bundleIds, callbackFn) { + // listify + bundleIds = bundleIds.push ? bundleIds : [bundleIds]; + var depsNotFound = [], + i = bundleIds.length, + numWaiting = i, + fn, + bundleId, + r, + q; // define callback function -var devnull = function() {}, - bundleIdCache = {}, - bundleResultCache = {}, - bundleCallbackQueue = {}; + fn = function fn(bundleId, pathsNotFound) { + if (pathsNotFound.length) depsNotFound.push(bundleId); + numWaiting--; + if (!numWaiting) callbackFn(depsNotFound); + }; // register callback -/** - * Subscribe to bundle load event. - * @param {string[]} bundleIds - Bundle ids - * @param {Function} callbackFn - The callback function - */ -function subscribe(bundleIds, callbackFn) { - // listify - bundleIds = bundleIds.push ? bundleIds : [bundleIds]; - - var depsNotFound = [], - i = bundleIds.length, - numWaiting = i, - fn, - bundleId, - r, - q; - - // define callback function - fn = function (bundleId, pathsNotFound) { - if (pathsNotFound.length) depsNotFound.push(bundleId); - - numWaiting--; - if (!numWaiting) callbackFn(depsNotFound); - }; + while (i--) { + bundleId = bundleIds[i]; // execute callback if in result cache - // register callback - while (i--) { - bundleId = bundleIds[i]; + r = bundleResultCache[bundleId]; - // execute callback if in result cache - r = bundleResultCache[bundleId]; - if (r) { - fn(bundleId, r); - continue; + if (r) { + fn(bundleId, r); + continue; + } // add to callback queue + + + q = bundleCallbackQueue[bundleId] = bundleCallbackQueue[bundleId] || []; + q.push(fn); + } } + /** + * Publish bundle load event. + * @param {string} bundleId - Bundle id + * @param {string[]} pathsNotFound - List of files not found + */ - // add to callback queue - q = bundleCallbackQueue[bundleId] = bundleCallbackQueue[bundleId] || []; - q.push(fn); - } -} + function publish(bundleId, pathsNotFound) { + // exit if id isn't defined + if (!bundleId) return; + var q = bundleCallbackQueue[bundleId]; // cache result -/** - * Publish bundle load event. - * @param {string} bundleId - Bundle id - * @param {string[]} pathsNotFound - List of files not found - */ -function publish(bundleId, pathsNotFound) { - // exit if id isn't defined - if (!bundleId) return; + bundleResultCache[bundleId] = pathsNotFound; // exit if queue is empty - var q = bundleCallbackQueue[bundleId]; + if (!q) return; // empty callback queue - // cache result - bundleResultCache[bundleId] = pathsNotFound; + while (q.length) { + q[0](bundleId, pathsNotFound); + q.splice(0, 1); + } + } + /** + * Execute callbacks. + * @param {Object or Function} args - The callback args + * @param {string[]} depsNotFound - List of dependencies not found + */ - // exit if queue is empty - if (!q) return; - // empty callback queue - while (q.length) { - q[0](bundleId, pathsNotFound); - q.splice(0, 1); - } -} + function executeCallbacks(args, depsNotFound) { + // accept function as argument + if (args.call) args = { + success: args + }; // success and error callbacks + if (depsNotFound.length) (args.error || devnull)(depsNotFound);else (args.success || devnull)(args); + } + /** + * Load individual file. + * @param {string} path - The file path + * @param {Function} callbackFn - The callback function + */ -/** - * Execute callbacks. - * @param {Object or Function} args - The callback args - * @param {string[]} depsNotFound - List of dependencies not found - */ -function executeCallbacks(args, depsNotFound) { - // accept function as argument - if (args.call) args = {success: args}; - // success and error callbacks - if (depsNotFound.length) (args.error || devnull)(depsNotFound); - else (args.success || devnull)(args); -} + function loadFile(path, callbackFn, args, numTries) { + var doc = document, + async = args.async, + maxTries = (args.numRetries || 0) + 1, + beforeCallbackFn = args.before || devnull, + pathStripped = path.replace(/^(css|img)!/, ''), + isCss, + e; + numTries = numTries || 0; + + if (/(^css!|\.css$)/.test(path)) { + isCss = true; // css + + e = doc.createElement('link'); + e.rel = 'stylesheet'; + e.href = pathStripped; //.replace(/^css!/, ''); // remove "css!" prefix + } else if (/(^img!|\.(png|gif|jpg|svg)$)/.test(path)) { + // image + e = doc.createElement('img'); + e.src = pathStripped; + } else { + // javascript + e = doc.createElement('script'); + e.src = path; + e.async = async === undefined ? true : async; + } + e.onload = e.onerror = e.onbeforeload = function (ev) { + var result = ev.type[0]; // Note: The following code isolates IE using `hideFocus` and treats empty + // stylesheets as failures to get around lack of onerror support -/** - * Load individual file. - * @param {string} path - The file path - * @param {Function} callbackFn - The callback function - */ -function loadFile(path, callbackFn, args, numTries) { - var doc = document, - async = args.async, - maxTries = (args.numRetries || 0) + 1, - beforeCallbackFn = args.before || devnull, - pathStripped = path.replace(/^(css|img)!/, ''), - isCss, - e; - - numTries = numTries || 0; - - if (/(^css!|\.css$)/.test(path)) { - isCss = true; - - // css - e = doc.createElement('link'); - e.rel = 'stylesheet'; - e.href = pathStripped; //.replace(/^css!/, ''); // remove "css!" prefix - } else if (/(^img!|\.(png|gif|jpg|svg)$)/.test(path)) { - // image - e = doc.createElement('img'); - e.src = pathStripped; - } else { - // javascript - e = doc.createElement('script'); - e.src = path; - e.async = async === undefined ? true : async; - } + if (isCss && 'hideFocus' in e) { + try { + if (!e.sheet.cssText.length) result = 'e'; + } catch (x) { + // sheets objects created from load errors don't allow access to + // `cssText` (unless error is Code:18 SecurityError) + if (x.code != 18) result = 'e'; + } + } // handle retries in case of load failure - e.onload = e.onerror = e.onbeforeload = function (ev) { - var result = ev.type[0]; - // Note: The following code isolates IE using `hideFocus` and treats empty - // stylesheets as failures to get around lack of onerror support - if (isCss && 'hideFocus' in e) { - try { - if (!e.sheet.cssText.length) result = 'e'; - } catch (x) { - // sheets objects created from load errors don't allow access to - // `cssText` (unless error is Code:18 SecurityError) - if (x.code != 18) result = 'e'; - } - } + if (result == 'e') { + // increment counter + numTries += 1; // exit function and try again - // handle retries in case of load failure - if (result == 'e') { - // increment counter - numTries += 1; + if (numTries < maxTries) { + return loadFile(path, callbackFn, args, numTries); + } + } // execute callback - // exit function and try again - if (numTries < maxTries) { - return loadFile(path, callbackFn, args, numTries); - } - } - // execute callback - callbackFn(path, result, ev.defaultPrevented); - }; + callbackFn(path, result, ev.defaultPrevented); + }; // add to document (unless callback returns `false`) - // add to document (unless callback returns `false`) - if (beforeCallbackFn(path, e) !== false) doc.head.appendChild(e); -} + if (beforeCallbackFn(path, e) !== false) doc.head.appendChild(e); + } + /** + * Load multiple files. + * @param {string[]} paths - The file paths + * @param {Function} callbackFn - The callback function + */ -/** - * Load multiple files. - * @param {string[]} paths - The file paths - * @param {Function} callbackFn - The callback function - */ -function loadFiles(paths, callbackFn, args) { - // listify paths - paths = paths.push ? paths : [paths]; - - var numWaiting = paths.length, - x = numWaiting, - pathsNotFound = [], - fn, - i; - - // define callback function - fn = function(path, result, defaultPrevented) { - // handle error - if (result == 'e') pathsNotFound.push(path); - - // handle beforeload event. If defaultPrevented then that means the load - // will be blocked (ex. Ghostery/ABP on Safari) - if (result == 'b') { - if (defaultPrevented) pathsNotFound.push(path); - else return; - } - - numWaiting--; - if (!numWaiting) callbackFn(pathsNotFound); - }; - // load scripts - for (i=0; i < x; i++) loadFile(paths[i], fn, args); -} + function loadFiles(paths, callbackFn, args) { + // listify paths + paths = paths.push ? paths : [paths]; + var numWaiting = paths.length, + x = numWaiting, + pathsNotFound = [], + fn, + i; // define callback function + fn = function fn(path, result, defaultPrevented) { + // handle error + if (result == 'e') pathsNotFound.push(path); // handle beforeload event. If defaultPrevented then that means the load + // will be blocked (ex. Ghostery/ABP on Safari) -/** - * Initiate script load and register bundle. - * @param {(string|string[])} paths - The file paths - * @param {(string|Function)} [arg1] - The bundleId or success callback - * @param {Function} [arg2] - The success or error callback - * @param {Function} [arg3] - The error callback - */ -function loadjs(paths, arg1, arg2) { - var bundleId, - args; + if (result == 'b') { + if (defaultPrevented) pathsNotFound.push(path);else return; + } - // bundleId (if string) - if (arg1 && arg1.trim) bundleId = arg1; + numWaiting--; + if (!numWaiting) callbackFn(pathsNotFound); + }; // load scripts - // args (default is {}) - args = (bundleId ? arg2 : arg1) || {}; - // throw error if bundle is already defined - if (bundleId) { - if (bundleId in bundleIdCache) { - throw "LoadJS"; - } else { - bundleIdCache[bundleId] = true; + for (i = 0; i < x; i++) { + loadFile(paths[i], fn, args); + } } - } + /** + * Initiate script load and register bundle. + * @param {(string|string[])} paths - The file paths + * @param {(string|Function)} [arg1] - The bundleId or success callback + * @param {Function} [arg2] - The success or error callback + * @param {Function} [arg3] - The error callback + */ - // load scripts - loadFiles(paths, function (pathsNotFound) { - // execute callbacks - executeCallbacks(args, pathsNotFound); - // publish bundle load event - publish(bundleId, pathsNotFound); - }, args); -} + function loadjs(paths, arg1, arg2) { + var bundleId, args; // bundleId (if string) + if (arg1 && arg1.trim) bundleId = arg1; // args (default is {}) -/** - * Execute callbacks when dependencies have been satisfied. - * @param {(string|string[])} deps - List of bundle ids - * @param {Object} args - success/error arguments - */ -loadjs.ready = function ready(deps, args) { - // subscribe to bundle load event - subscribe(deps, function (depsNotFound) { - // execute callbacks - executeCallbacks(args, depsNotFound); - }); + args = (bundleId ? arg2 : arg1) || {}; // throw error if bundle is already defined - return loadjs; -}; + if (bundleId) { + if (bundleId in bundleIdCache) { + throw "LoadJS"; + } else { + bundleIdCache[bundleId] = true; + } + } // load scripts -/** - * Manually satisfy bundle dependencies. - * @param {string} bundleId - The bundle id - */ -loadjs.done = function done(bundleId) { - publish(bundleId, []); -}; + loadFiles(paths, function (pathsNotFound) { + // execute callbacks + executeCallbacks(args, pathsNotFound); // publish bundle load event + publish(bundleId, pathsNotFound); + }, args); + } + /** + * Execute callbacks when dependencies have been satisfied. + * @param {(string|string[])} deps - List of bundle ids + * @param {Object} args - success/error arguments + */ -/** - * Reset loadjs dependencies statuses - */ -loadjs.reset = function reset() { - bundleIdCache = {}; - bundleResultCache = {}; - bundleCallbackQueue = {}; -}; + loadjs.ready = function ready(deps, args) { + // subscribe to bundle load event + subscribe(deps, function (depsNotFound) { + // execute callbacks + executeCallbacks(args, depsNotFound); + }); + return loadjs; + }; + /** + * Manually satisfy bundle dependencies. + * @param {string} bundleId - The bundle id + */ -/** - * Determine if bundle has already been defined - * @param String} bundleId - The bundle id - */ -loadjs.isDefined = function isDefined(bundleId) { - return bundleId in bundleIdCache; -}; + + loadjs.done = function done(bundleId) { + publish(bundleId, []); + }; + /** + * Reset loadjs dependencies statuses + */ -// export -return loadjs; + loadjs.reset = function reset() { + bundleIdCache = {}; + bundleResultCache = {}; + bundleCallbackQueue = {}; + }; + /** + * Determine if bundle has already been defined + * @param String} bundleId - The bundle id + */ -})); + + loadjs.isDefined = function isDefined(bundleId) { + return bundleId in bundleIdCache; + }; // export + + + return loadjs; + }); }); function loadScript(url) { @@ -9355,7 +9646,7 @@ var media = { class: this.config.classNames.video }); // Wrap the video in a container - wrap(this.media, this.elements.wrapper); // Faux poster container + wrap$1(this.media, this.elements.wrapper); // Faux poster container this.elements.poster = createElement('div', { class: this.config.classNames.poster @@ -9378,7 +9669,7 @@ var Ads = function () { /** * Ads constructor. - * @param {object} player + * @param {Object} player * @return {Ads} */ function Ads(player) { @@ -9525,7 +9816,7 @@ function () { } /** * Update the ad countdown - * @param {boolean} start + * @param {Boolean} start */ }, { @@ -9893,7 +10184,7 @@ function () { } /** * Handles callbacks after an ad event was invoked - * @param {string} event - Event type + * @param {String} event - Event type */ }, { @@ -9917,8 +10208,8 @@ function () { } /** * Add event listeners - * @param {string} event - Event type - * @param {function} callback - Callback for when event occurs + * @param {String} event - Event type + * @param {Function} callback - Callback for when event occurs * @return {Ads} */ @@ -9937,8 +10228,8 @@ function () { * The advertisement has 12 seconds to get its things together. We stop this timer when the * advertisement is playing, or when a user action is required to start, then we clear the * timer on ad ready - * @param {number} time - * @param {string} from + * @param {Number} time + * @param {String} from */ }, { @@ -9955,7 +10246,7 @@ function () { } /** * Clear our safety timer(s) - * @param {string} from + * @param {String} from */ }, { @@ -11031,7 +11322,7 @@ function () { this.elements.container = createElement('div', { tabindex: 0 }); - wrap(this.media, this.elements.container); + wrap$1(this.media, this.elements.container); } // Add style hook @@ -11129,7 +11420,7 @@ function () { /** * Toggle playback based on current status - * @param {boolean} input + * @param {Boolean} input */ value: function togglePlay(input) { // Toggle based on current state if nothing passed @@ -11166,7 +11457,7 @@ function () { } /** * Rewind - * @param {number} seekTime - how far to rewind in seconds. Defaults to the config.seekTime + * @param {Number} seekTime - how far to rewind in seconds. Defaults to the config.seekTime */ }, { @@ -11176,7 +11467,7 @@ function () { } /** * Fast forward - * @param {number} seekTime - how far to fast forward in seconds. Defaults to the config.seekTime + * @param {Number} seekTime - how far to fast forward in seconds. Defaults to the config.seekTime */ }, { @@ -11186,7 +11477,7 @@ function () { } /** * Seek to a time - * @param {number} input - where to seek to in seconds. Defaults to 0 (the start) + * @param {Number} input - where to seek to in seconds. Defaults to 0 (the start) */ }, { @@ -11194,7 +11485,7 @@ function () { /** * Increase volume - * @param {boolean} step - How much to decrease by (between 0 and 1) + * @param {Boolean} step - How much to decrease by (between 0 and 1) */ value: function increaseVolume(step) { var volume = this.media.muted ? 0 : this.volume; @@ -11202,7 +11493,7 @@ function () { } /** * Decrease volume - * @param {boolean} step - How much to decrease by (between 0 and 1) + * @param {Boolean} step - How much to decrease by (between 0 and 1) */ }, { @@ -11212,7 +11503,7 @@ function () { } /** * Set muted state - * @param {boolean} mute + * @param {Boolean} mute */ }, { @@ -11220,14 +11511,14 @@ function () { /** * Toggle captions - * @param {boolean} input - Whether to enable captions + * @param {Boolean} input - Whether to enable captions */ value: function toggleCaptions(input) { captions.toggle.call(this, input, false); } /** * Set the caption track by index - * @param {number} - Caption index + * @param {Number} - Caption index */ }, { @@ -11245,7 +11536,7 @@ function () { } /** * Toggle the player controls - * @param {boolean} [toggle] - Whether to show the controls + * @param {Boolean} [toggle] - Whether to show the controls */ }, { @@ -11277,8 +11568,8 @@ function () { } /** * Add event listeners - * @param {string} event - Event type - * @param {function} callback - Callback for when event occurs + * @param {String} event - Event type + * @param {Function} callback - Callback for when event occurs */ }, { @@ -11288,8 +11579,8 @@ function () { } /** * Add event listeners once - * @param {string} event - Event type - * @param {function} callback - Callback for when event occurs + * @param {String} event - Event type + * @param {Function} callback - Callback for when event occurs */ }, { @@ -11299,8 +11590,8 @@ function () { } /** * Remove event listeners - * @param {string} event - Event type - * @param {function} callback - Callback for when event occurs + * @param {String} event - Event type + * @param {Function} callback - Callback for when event occurs */ }, { @@ -11312,8 +11603,8 @@ function () { * Destroy an instance * Event listeners are removed when elements are removed * http://stackoverflow.com/questions/12528049/if-a-dom-element-is-removed-are-its-listeners-also-removed-from-memory - * @param {function} callback - Callback for when destroy is complete - * @param {boolean} soft - Whether it's a soft destroy (for source changes etc) + * @param {Function} callback - Callback for when destroy is complete + * @param {Boolean} soft - Whether it's a soft destroy (for source changes etc) */ }, { @@ -11407,7 +11698,7 @@ function () { } /** * Check for support for a mime type (HTML5 only) - * @param {string} type - Mime type + * @param {String} type - Mime type */ }, { @@ -11417,9 +11708,9 @@ function () { } /** * Check for support - * @param {string} type - Player type (audio/video) - * @param {string} provider - Provider (html5/youtube/vimeo) - * @param {bool} inline - Where player has `playsinline` sttribute + * @param {String} type - Player type (audio/video) + * @param {String} provider - Provider (html5/youtube/vimeo) + * @param {Boolean} inline - Where player has `playsinline` sttribute */ }, { @@ -11554,7 +11845,7 @@ function () { } /** * Set the player volume - * @param {number} value - must be between 0 and 1. Defaults to the value from local storage and config.volume if not set in storage + * @param {Number} value - must be between 0 and 1. Defaults to the value from local storage and config.volume if not set in storage */ }, { @@ -11651,7 +11942,7 @@ function () { } /** * Set playback speed - * @param {number} speed - the speed of playback (0.5-2.0) + * @param {Number} speed - the speed of playback (0.5-2.0) */ }, { @@ -11700,7 +11991,7 @@ function () { /** * Set playback quality * Currently HTML5 & YouTube only - * @param {number} input - Quality level + * @param {Number} input - Quality level */ }, { @@ -11745,7 +12036,7 @@ function () { /** * Toggle loop * TODO: Finish fancy new logic. Set the indicator on load as user may pass loop as config - * @param {boolean} input - Whether to loop or not + * @param {Boolean} input - Whether to loop or not */ }, { @@ -11801,7 +12092,7 @@ function () { } /** * Set new media source - * @param {object} input - The new source object (see docs) + * @param {Object} input - The new source object (see docs) */ }, { @@ -11828,7 +12119,7 @@ function () { } /** * Set the poster image for a video - * @param {input} - the URL for the new poster image + * @param {String} input - the URL for the new poster image */ }, { @@ -11854,7 +12145,7 @@ function () { } /** * Set the autoplay state - * @param {boolean} input - Whether to autoplay or not + * @param {Boolean} input - Whether to autoplay or not */ }, { @@ -11888,7 +12179,7 @@ function () { /** * Set the wanted language for captions * Since tracks can be added later it won't update the actual caption track until there is a matching track - * @param {string} - Two character ISO language code (e.g. EN, FR, PT, etc) + * @param {String} - Two character ISO language code (e.g. EN, FR, PT, etc) */ }, { @@ -11958,8 +12249,8 @@ function () { } /** * Load an SVG sprite into the page - * @param {string} url - URL for the SVG sprite - * @param {string} [id] - Unique ID + * @param {String} url - URL for the SVG sprite + * @param {String} [id] - Unique ID */ }, { @@ -11970,7 +12261,7 @@ function () { /** * Setup multiple instances * @param {*} selector - * @param {object} options + * @param {Object} options */ }, { |