diff --git a/dist/grapholscape.esm.js b/dist/grapholscape.esm.js index a4497236..0545cb6b 100644 --- a/dist/grapholscape.esm.js +++ b/dist/grapholscape.esm.js @@ -24,9 +24,11 @@ import '@webcomponents/webcomponentsjs'; import cytoscape from 'cytoscape'; +import '@material/mwc-icon-button'; import '@material/mwc-icon'; import popper from 'cytoscape-popper'; import cola from 'cytoscape-cola'; +import cy_svg from 'cytoscape-svg'; var fails = function (exec) { try { @@ -36,7 +38,7 @@ var fails = function (exec) { } }; -// Thank's IE8 for his funny defineProperty +// Detect IE8's incomplete defineProperty implementation var descriptors = !fails(function () { return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); @@ -69,7 +71,7 @@ var global_1 = check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func - Function('return this')(); + (function () { return this; })() || Function('return this')(); var isObject = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; @@ -97,7 +99,7 @@ var anObject = function (it) { }; // `ToPrimitive` abstract operation -// https://tc39.github.io/ecma262/#sec-toprimitive +// https://tc39.es/ecma262/#sec-toprimitive // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string var toPrimitive = function (input, PREFERRED_STRING) { @@ -112,7 +114,7 @@ var toPrimitive = function (input, PREFERRED_STRING) { var nativeDefineProperty = Object.defineProperty; // `Object.defineProperty` method -// https://tc39.github.io/ecma262/#sec-object.defineproperty +// https://tc39.es/ecma262/#sec-object.defineproperty var f = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); @@ -137,7 +139,7 @@ var nameRE = /^\s*function ([^ (]*)/; var NAME = 'name'; // Function instances `.name` property -// https://tc39.github.io/ecma262/#sec-function-instances-name +// https://tc39.es/ecma262/#sec-function-instances-name if (descriptors && !(NAME in FunctionPrototype)) { defineProperty(FunctionPrototype, NAME, { configurable: true, @@ -186,9 +188,9 @@ var shared = createCommonjsModule(function (module) { (module.exports = function (key, value) { return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.6.5', + version: '3.8.2', mode: 'global', - copyright: '© 2020 Denis Pushkarev (zloirock.ru)' + copyright: '© 2021 Denis Pushkarev (zloirock.ru)' }); }); @@ -275,11 +277,12 @@ var getterFor = function (TYPE) { }; if (nativeWeakMap) { - var store$1 = new WeakMap$2(); + var store$1 = sharedStore.state || (sharedStore.state = new WeakMap$2()); var wmget = store$1.get; var wmhas = store$1.has; var wmset = store$1.set; set = function (it, metadata) { + metadata.facade = it; wmset.call(store$1, it, metadata); return metadata; }; @@ -293,6 +296,7 @@ if (nativeWeakMap) { var STATE = sharedKey('state'); hiddenKeys[STATE] = true; set = function (it, metadata) { + metadata.facade = it; createNonEnumerableProperty(it, STATE, metadata); return metadata; }; @@ -321,9 +325,15 @@ var TEMPLATE = String(String).split('String'); var unsafe = options ? !!options.unsafe : false; var simple = options ? !!options.enumerable : false; var noTargetGet = options ? !!options.noTargetGet : false; + var state; if (typeof value == 'function') { - if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key); - enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : ''); + if (typeof key == 'string' && !has(value, 'name')) { + createNonEnumerableProperty(value, 'name', key); + } + state = enforceInternalState(value); + if (!state.source) { + state.source = TEMPLATE.join(typeof key == 'string' ? key : ''); + } } if (O === global_1) { if (simple) O[key] = value; @@ -372,13 +382,13 @@ var classof = toStringTagSupport ? classofRaw : function (it) { }; // `Object.prototype.toString` method implementation -// https://tc39.github.io/ecma262/#sec-object.prototype.tostring +// https://tc39.es/ecma262/#sec-object.prototype.tostring var objectToString = toStringTagSupport ? {}.toString : function toString() { return '[object ' + classof(this) + ']'; }; // `Object.prototype.toString` method -// https://tc39.github.io/ecma262/#sec-object.prototype.tostring +// https://tc39.es/ecma262/#sec-object.prototype.tostring if (!toStringTagSupport) { redefine(Object.prototype, 'toString', objectToString, { unsafe: true }); } @@ -390,7 +400,7 @@ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation -// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable +// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable var f$1 = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor(this, V); return !!descriptor && descriptor.enumerable; @@ -412,7 +422,7 @@ var indexedObject = fails(function () { } : Object; // `RequireObjectCoercible` abstract operation -// https://tc39.github.io/ecma262/#sec-requireobjectcoercible +// https://tc39.es/ecma262/#sec-requireobjectcoercible var requireObjectCoercible = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; @@ -429,7 +439,7 @@ var toIndexedObject = function (it) { var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method -// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor +// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor var f$2 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPrimitive(P, true); @@ -458,7 +468,7 @@ var ceil = Math.ceil; var floor = Math.floor; // `ToInteger` abstract operation -// https://tc39.github.io/ecma262/#sec-tointeger +// https://tc39.es/ecma262/#sec-tointeger var toInteger = function (argument) { return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); }; @@ -466,7 +476,7 @@ var toInteger = function (argument) { var min = Math.min; // `ToLength` abstract operation -// https://tc39.github.io/ecma262/#sec-tolength +// https://tc39.es/ecma262/#sec-tolength var toLength = function (argument) { return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; @@ -504,10 +514,10 @@ var createMethod = function (IS_INCLUDES) { var arrayIncludes = { // `Array.prototype.includes` method - // https://tc39.github.io/ecma262/#sec-array.prototype.includes + // https://tc39.es/ecma262/#sec-array.prototype.includes includes: createMethod(true), // `Array.prototype.indexOf` method - // https://tc39.github.io/ecma262/#sec-array.prototype.indexof + // https://tc39.es/ecma262/#sec-array.prototype.indexof indexOf: createMethod(false) }; @@ -541,7 +551,7 @@ var enumBugKeys = [ var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method -// https://tc39.github.io/ecma262/#sec-object.getownpropertynames +// https://tc39.es/ecma262/#sec-object.getownpropertynames var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return objectKeysInternal(O, hiddenKeys$1); }; @@ -733,28 +743,38 @@ var getIteratorMethod = function (it) { || iterators[classof(it)]; }; -// call something on iterator step with safe closing on error -var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) { - try { - return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); - // 7.4.6 IteratorClose(iterator, completion) - } catch (error) { - var returnMethod = iterator['return']; - if (returnMethod !== undefined) anObject(returnMethod.call(iterator)); - throw error; +var iteratorClose = function (iterator) { + var returnMethod = iterator['return']; + if (returnMethod !== undefined) { + return anObject(returnMethod.call(iterator)).value; } }; -var iterate_1 = createCommonjsModule(function (module) { var Result = function (stopped, result) { this.stopped = stopped; this.result = result; }; -var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) { - var boundFunction = functionBindContext(fn, that, AS_ENTRIES ? 2 : 1); +var iterate = function (iterable, unboundFunction, options) { + var that = options && options.that; + var AS_ENTRIES = !!(options && options.AS_ENTRIES); + var IS_ITERATOR = !!(options && options.IS_ITERATOR); + var INTERRUPTED = !!(options && options.INTERRUPTED); + var fn = functionBindContext(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED); var iterator, iterFn, index, length, result, next, step; + var stop = function (condition) { + if (iterator) iteratorClose(iterator); + return new Result(true, condition); + }; + + var callFn = function (value) { + if (AS_ENTRIES) { + anObject(value); + return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); + } return INTERRUPTED ? fn(value, stop) : fn(value); + }; + if (IS_ITERATOR) { iterator = iterable; } else { @@ -763,9 +783,7 @@ var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITER // optimisation for array iterators if (isArrayIteratorMethod(iterFn)) { for (index = 0, length = toLength(iterable.length); length > index; index++) { - result = AS_ENTRIES - ? boundFunction(anObject(step = iterable[index])[0], step[1]) - : boundFunction(iterable[index]); + result = callFn(iterable[index]); if (result && result instanceof Result) return result; } return new Result(false); } @@ -774,16 +792,16 @@ var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITER next = iterator.next; while (!(step = next.call(iterator)).done) { - result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES); + try { + result = callFn(step.value); + } catch (error) { + iteratorClose(iterator); + throw error; + } if (typeof result == 'object' && result && result instanceof Result) return result; } return new Result(false); }; -iterate.stop = function (result) { - return new Result(true, result); -}; -}); - var ITERATOR$2 = wellKnownSymbol('iterator'); var SAFE_CLOSING = false; @@ -824,7 +842,7 @@ var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) { var SPECIES$1 = wellKnownSymbol('species'); // `SpeciesConstructor` abstract operation -// https://tc39.github.io/ecma262/#sec-speciesconstructor +// https://tc39.es/ecma262/#sec-speciesconstructor var speciesConstructor = function (O, defaultConstructor) { var C = anObject(O).constructor; var S; @@ -837,6 +855,8 @@ var engineUserAgent = getBuiltIn('navigator', 'userAgent') || ''; var engineIsIos = /(iphone|ipod|ipad).*applewebkit/i.test(engineUserAgent); +var engineIsNode = classofRaw(global_1.process) == 'process'; + var location = global_1.location; var set$1 = global_1.setImmediate; var clear = global_1.clearImmediate; @@ -889,7 +909,7 @@ if (!set$1 || !clear) { delete queue[id]; }; // Node.js 0.8- - if (classofRaw(process) == 'process') { + if (engineIsNode) { defer = function (id) { process.nextTick(runner(id)); }; @@ -911,8 +931,8 @@ if (!set$1 || !clear) { global_1.addEventListener && typeof postMessage == 'function' && !global_1.importScripts && - !fails(post) && - location.protocol !== 'file:' + location && location.protocol !== 'file:' && + !fails(post) ) { defer = post; global_1.addEventListener('message', listener, false); @@ -937,15 +957,18 @@ var task = { clear: clear }; -var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; +var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(engineUserAgent); +var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; var macrotask = task.set; + + var MutationObserver = global_1.MutationObserver || global_1.WebKitMutationObserver; +var document$2 = global_1.document; var process$1 = global_1.process; var Promise$1 = global_1.Promise; -var IS_NODE = classofRaw(process$1) == 'process'; // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` var queueMicrotaskDescriptor = getOwnPropertyDescriptor$2(global_1, 'queueMicrotask'); var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; @@ -956,7 +979,7 @@ var flush, head, last, notify, toggle, node, promise, then; if (!queueMicrotask) { flush = function () { var parent, fn; - if (IS_NODE && (parent = process$1.domain)) parent.exit(); + if (engineIsNode && (parent = process$1.domain)) parent.exit(); while (head) { fn = head.fn; head = head.next; @@ -971,15 +994,11 @@ if (!queueMicrotask) { if (parent) parent.enter(); }; - // Node.js - if (IS_NODE) { - notify = function () { - process$1.nextTick(flush); - }; // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339 - } else if (MutationObserver && !engineIsIos) { + // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898 + if (!engineIsIos && !engineIsNode && !engineIsWebosWebkit && MutationObserver && document$2) { toggle = true; - node = document.createTextNode(''); + node = document$2.createTextNode(''); new MutationObserver(flush).observe(node, { characterData: true }); notify = function () { node.data = toggle = !toggle; @@ -992,6 +1011,11 @@ if (!queueMicrotask) { notify = function () { then.call(promise, flush); }; + // Node.js without promises + } else if (engineIsNode) { + notify = function () { + process$1.nextTick(flush); + }; // for other environments - macrotask based on: // - setImmediate // - MessageChannel @@ -1088,6 +1112,7 @@ var task$1 = task.set; + var SPECIES$2 = wellKnownSymbol('species'); var PROMISE = 'Promise'; var getInternalState = internalState.get; @@ -1095,13 +1120,13 @@ var setInternalState = internalState.set; var getInternalPromiseState = internalState.getterFor(PROMISE); var PromiseConstructor = nativePromiseConstructor; var TypeError$1 = global_1.TypeError; -var document$2 = global_1.document; +var document$3 = global_1.document; var process$3 = global_1.process; var $fetch = getBuiltIn('fetch'); var newPromiseCapability$1 = newPromiseCapability.f; var newGenericPromiseCapability = newPromiseCapability$1; -var IS_NODE$1 = classofRaw(process$3) == 'process'; -var DISPATCH_EVENT = !!(document$2 && document$2.createEvent && global_1.dispatchEvent); +var DISPATCH_EVENT = !!(document$3 && document$3.createEvent && global_1.dispatchEvent); +var NATIVE_REJECTION_EVENT = typeof PromiseRejectionEvent == 'function'; var UNHANDLED_REJECTION = 'unhandledrejection'; var REJECTION_HANDLED = 'rejectionhandled'; var PENDING = 0; @@ -1119,7 +1144,7 @@ var FORCED = isForced_1(PROMISE, function () { // We can't detect it synchronously, so just check versions if (engineV8Version === 66) return true; // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test - if (!IS_NODE$1 && typeof PromiseRejectionEvent != 'function') return true; + if (!engineIsNode && !NATIVE_REJECTION_EVENT) return true; } // We can't use @@species feature detection in V8 since it causes // deoptimization and performance degradation @@ -1145,7 +1170,7 @@ var isThenable = function (it) { return isObject(it) && typeof (then = it.then) == 'function' ? then : false; }; -var notify$1 = function (promise, state, isReject) { +var notify$1 = function (state, isReject) { if (state.notified) return; state.notified = true; var chain = state.reactions; @@ -1164,7 +1189,7 @@ var notify$1 = function (promise, state, isReject) { try { if (handler) { if (!ok) { - if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state); + if (state.rejection === UNHANDLED) onHandleUnhandled(state); state.rejection = HANDLED; } if (handler === true) result = value; @@ -1189,36 +1214,37 @@ var notify$1 = function (promise, state, isReject) { } state.reactions = []; state.notified = false; - if (isReject && !state.rejection) onUnhandled(promise, state); + if (isReject && !state.rejection) onUnhandled(state); }); }; var dispatchEvent = function (name, promise, reason) { var event, handler; if (DISPATCH_EVENT) { - event = document$2.createEvent('Event'); + event = document$3.createEvent('Event'); event.promise = promise; event.reason = reason; event.initEvent(name, false, true); global_1.dispatchEvent(event); } else event = { promise: promise, reason: reason }; - if (handler = global_1['on' + name]) handler(event); + if (!NATIVE_REJECTION_EVENT && (handler = global_1['on' + name])) handler(event); else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason); }; -var onUnhandled = function (promise, state) { +var onUnhandled = function (state) { task$1.call(global_1, function () { + var promise = state.facade; var value = state.value; var IS_UNHANDLED = isUnhandled(state); var result; if (IS_UNHANDLED) { result = perform(function () { - if (IS_NODE$1) { + if (engineIsNode) { process$3.emit('unhandledRejection', value, promise); } else dispatchEvent(UNHANDLED_REJECTION, promise, value); }); // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should - state.rejection = IS_NODE$1 || isUnhandled(state) ? UNHANDLED : HANDLED; + state.rejection = engineIsNode || isUnhandled(state) ? UNHANDLED : HANDLED; if (result.error) throw result.value; } }); @@ -1228,55 +1254,56 @@ var isUnhandled = function (state) { return state.rejection !== HANDLED && !state.parent; }; -var onHandleUnhandled = function (promise, state) { +var onHandleUnhandled = function (state) { task$1.call(global_1, function () { - if (IS_NODE$1) { + var promise = state.facade; + if (engineIsNode) { process$3.emit('rejectionHandled', promise); } else dispatchEvent(REJECTION_HANDLED, promise, state.value); }); }; -var bind = function (fn, promise, state, unwrap) { +var bind = function (fn, state, unwrap) { return function (value) { - fn(promise, state, value, unwrap); + fn(state, value, unwrap); }; }; -var internalReject = function (promise, state, value, unwrap) { +var internalReject = function (state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; state.value = value; state.state = REJECTED; - notify$1(promise, state, true); + notify$1(state, true); }; -var internalResolve = function (promise, state, value, unwrap) { +var internalResolve = function (state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; try { - if (promise === value) throw TypeError$1("Promise can't be resolved itself"); + if (state.facade === value) throw TypeError$1("Promise can't be resolved itself"); var then = isThenable(value); if (then) { microtask(function () { var wrapper = { done: false }; try { then.call(value, - bind(internalResolve, promise, wrapper, state), - bind(internalReject, promise, wrapper, state) + bind(internalResolve, wrapper, state), + bind(internalReject, wrapper, state) ); } catch (error) { - internalReject(promise, wrapper, error, state); + internalReject(wrapper, error, state); } }); } else { state.value = value; state.state = FULFILLED; - notify$1(promise, state, false); + notify$1(state, false); } } catch (error) { - internalReject(promise, { done: false }, error, state); + internalReject({ done: false }, error, state); } }; @@ -1289,9 +1316,9 @@ if (FORCED) { Internal.call(this); var state = getInternalState(this); try { - executor(bind(internalResolve, this, state), bind(internalReject, this, state)); + executor(bind(internalResolve, state), bind(internalReject, state)); } catch (error) { - internalReject(this, state, error); + internalReject(state, error); } }; // eslint-disable-next-line no-unused-vars @@ -1309,20 +1336,20 @@ if (FORCED) { }; Internal.prototype = redefineAll(PromiseConstructor.prototype, { // `Promise.prototype.then` method - // https://tc39.github.io/ecma262/#sec-promise.prototype.then + // https://tc39.es/ecma262/#sec-promise.prototype.then then: function then(onFulfilled, onRejected) { var state = getInternalPromiseState(this); var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor)); reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; reaction.fail = typeof onRejected == 'function' && onRejected; - reaction.domain = IS_NODE$1 ? process$3.domain : undefined; + reaction.domain = engineIsNode ? process$3.domain : undefined; state.parent = true; state.reactions.push(reaction); - if (state.state != PENDING) notify$1(this, state, false); + if (state.state != PENDING) notify$1(state, false); return reaction.promise; }, // `Promise.prototype.catch` method - // https://tc39.github.io/ecma262/#sec-promise.prototype.catch + // https://tc39.es/ecma262/#sec-promise.prototype.catch 'catch': function (onRejected) { return this.then(undefined, onRejected); } @@ -1331,8 +1358,8 @@ if (FORCED) { var promise = new Internal(); var state = getInternalState(promise); this.promise = promise; - this.resolve = bind(internalResolve, promise, state); - this.reject = bind(internalReject, promise, state); + this.resolve = bind(internalResolve, state); + this.reject = bind(internalReject, state); }; newPromiseCapability.f = newPromiseCapability$1 = function (C) { return C === PromiseConstructor || C === PromiseWrapper @@ -1374,7 +1401,7 @@ PromiseWrapper = getBuiltIn(PROMISE); // statics _export({ target: PROMISE, stat: true, forced: FORCED }, { // `Promise.reject` method - // https://tc39.github.io/ecma262/#sec-promise.reject + // https://tc39.es/ecma262/#sec-promise.reject reject: function reject(r) { var capability = newPromiseCapability$1(this); capability.reject.call(undefined, r); @@ -1384,7 +1411,7 @@ _export({ target: PROMISE, stat: true, forced: FORCED }, { _export({ target: PROMISE, stat: true, forced: FORCED }, { // `Promise.resolve` method - // https://tc39.github.io/ecma262/#sec-promise.resolve + // https://tc39.es/ecma262/#sec-promise.resolve resolve: function resolve(x) { return promiseResolve( this, x); } @@ -1392,7 +1419,7 @@ _export({ target: PROMISE, stat: true, forced: FORCED }, { _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, { // `Promise.all` method - // https://tc39.github.io/ecma262/#sec-promise.all + // https://tc39.es/ecma262/#sec-promise.all all: function all(iterable) { var C = this; var capability = newPromiseCapability$1(C); @@ -1403,7 +1430,7 @@ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, { var values = []; var counter = 0; var remaining = 1; - iterate_1(iterable, function (promise) { + iterate(iterable, function (promise) { var index = counter++; var alreadyCalled = false; values.push(undefined); @@ -1421,14 +1448,14 @@ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, { return capability.promise; }, // `Promise.race` method - // https://tc39.github.io/ecma262/#sec-promise.race + // https://tc39.es/ecma262/#sec-promise.race race: function race(iterable) { var C = this; var capability = newPromiseCapability$1(C); var reject = capability.reject; var result = perform(function () { var $promiseResolve = aFunction$1(C.resolve); - iterate_1(iterable, function (promise) { + iterate(iterable, function (promise) { $promiseResolve.call(C, promise).then(capability.resolve, reject); }); }); @@ -1443,7 +1470,7 @@ var NON_GENERIC = !!nativePromiseConstructor && fails(function () { }); // `Promise.prototype.finally` method -// https://tc39.github.io/ecma262/#sec-promise.prototype.finally +// https://tc39.es/ecma262/#sec-promise.prototype.finally _export({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, { 'finally': function (onFinally) { var C = speciesConstructor(this, getBuiltIn('Promise')); @@ -1830,25 +1857,25 @@ function _createForOfIteratorHelper(o, allowArrayLike) { } // `IsArray` abstract operation -// https://tc39.github.io/ecma262/#sec-isarray +// https://tc39.es/ecma262/#sec-isarray var isArray = Array.isArray || function isArray(arg) { return classofRaw(arg) == 'Array'; }; // `ToObject` abstract operation -// https://tc39.github.io/ecma262/#sec-toobject +// https://tc39.es/ecma262/#sec-toobject var toObject = function (argument) { return Object(requireObjectCoercible(argument)); }; // `Object.keys` method -// https://tc39.github.io/ecma262/#sec-object.keys +// https://tc39.es/ecma262/#sec-object.keys var objectKeys = Object.keys || function keys(O) { return objectKeysInternal(O, enumBugKeys); }; // `Object.defineProperties` method -// https://tc39.github.io/ecma262/#sec-object.defineproperties +// https://tc39.es/ecma262/#sec-object.defineproperties var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = objectKeys(Properties); @@ -1917,7 +1944,7 @@ var NullProtoObject = function () { hiddenKeys[IE_PROTO] = true; // `Object.create` method -// https://tc39.github.io/ecma262/#sec-object.create +// https://tc39.es/ecma262/#sec-object.create var objectCreate = Object.create || function create(O, Properties) { var result; if (O !== null) { @@ -1974,7 +2001,7 @@ var defineWellKnownSymbol = function (NAME) { var SPECIES$3 = wellKnownSymbol('species'); // `ArraySpeciesCreate` abstract operation -// https://tc39.github.io/ecma262/#sec-arrayspeciescreate +// https://tc39.es/ecma262/#sec-arrayspeciescreate var arraySpeciesCreate = function (originalArray, length) { var C; if (isArray(originalArray)) { @@ -1990,13 +2017,14 @@ var arraySpeciesCreate = function (originalArray, length) { var push = [].push; -// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation +// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation var createMethod$1 = function (TYPE) { var IS_MAP = TYPE == 1; var IS_FILTER = TYPE == 2; var IS_SOME = TYPE == 3; var IS_EVERY = TYPE == 4; var IS_FIND_INDEX = TYPE == 6; + var IS_FILTER_OUT = TYPE == 7; var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; return function ($this, callbackfn, that, specificCreate) { var O = toObject($this); @@ -2005,7 +2033,7 @@ var createMethod$1 = function (TYPE) { var length = toLength(self.length); var index = 0; var create = specificCreate || arraySpeciesCreate; - var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; + var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined; var value, result; for (;length > index; index++) if (NO_HOLES || index in self) { value = self[index]; @@ -2017,7 +2045,10 @@ var createMethod$1 = function (TYPE) { case 5: return value; // find case 6: return index; // findIndex case 2: push.call(target, value); // filter - } else if (IS_EVERY) return false; // every + } else switch (TYPE) { + case 4: return false; // every + case 7: push.call(target, value); // filterOut + } } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; @@ -2026,26 +2057,29 @@ var createMethod$1 = function (TYPE) { var arrayIteration = { // `Array.prototype.forEach` method - // https://tc39.github.io/ecma262/#sec-array.prototype.foreach + // https://tc39.es/ecma262/#sec-array.prototype.foreach forEach: createMethod$1(0), // `Array.prototype.map` method - // https://tc39.github.io/ecma262/#sec-array.prototype.map + // https://tc39.es/ecma262/#sec-array.prototype.map map: createMethod$1(1), // `Array.prototype.filter` method - // https://tc39.github.io/ecma262/#sec-array.prototype.filter + // https://tc39.es/ecma262/#sec-array.prototype.filter filter: createMethod$1(2), // `Array.prototype.some` method - // https://tc39.github.io/ecma262/#sec-array.prototype.some + // https://tc39.es/ecma262/#sec-array.prototype.some some: createMethod$1(3), // `Array.prototype.every` method - // https://tc39.github.io/ecma262/#sec-array.prototype.every + // https://tc39.es/ecma262/#sec-array.prototype.every every: createMethod$1(4), // `Array.prototype.find` method - // https://tc39.github.io/ecma262/#sec-array.prototype.find + // https://tc39.es/ecma262/#sec-array.prototype.find find: createMethod$1(5), // `Array.prototype.findIndex` method - // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex - findIndex: createMethod$1(6) + // https://tc39.es/ecma262/#sec-array.prototype.findIndex + findIndex: createMethod$1(6), + // `Array.prototype.filterOut` method + // https://github.com/tc39/proposal-array-filtering + filterOut: createMethod$1(7) }; var $forEach = arrayIteration.forEach; @@ -2173,7 +2207,7 @@ var $getOwnPropertySymbols = function getOwnPropertySymbols(O) { }; // `Symbol` constructor -// https://tc39.github.io/ecma262/#sec-symbol-constructor +// https://tc39.es/ecma262/#sec-symbol-constructor if (!nativeSymbol) { $Symbol = function Symbol() { if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor'); @@ -2230,7 +2264,7 @@ $forEach(objectKeys(WellKnownSymbolsStore$1), function (name) { _export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, { // `Symbol.for` method - // https://tc39.github.io/ecma262/#sec-symbol.for + // https://tc39.es/ecma262/#sec-symbol.for 'for': function (key) { var string = String(key); if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string]; @@ -2240,7 +2274,7 @@ _export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, { return symbol; }, // `Symbol.keyFor` method - // https://tc39.github.io/ecma262/#sec-symbol.keyfor + // https://tc39.es/ecma262/#sec-symbol.keyfor keyFor: function keyFor(sym) { if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol'); if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; @@ -2251,25 +2285,25 @@ _export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, { _export({ target: 'Object', stat: true, forced: !nativeSymbol, sham: !descriptors }, { // `Object.create` method - // https://tc39.github.io/ecma262/#sec-object.create + // https://tc39.es/ecma262/#sec-object.create create: $create, // `Object.defineProperty` method - // https://tc39.github.io/ecma262/#sec-object.defineproperty + // https://tc39.es/ecma262/#sec-object.defineproperty defineProperty: $defineProperty, // `Object.defineProperties` method - // https://tc39.github.io/ecma262/#sec-object.defineproperties + // https://tc39.es/ecma262/#sec-object.defineproperties defineProperties: $defineProperties, // `Object.getOwnPropertyDescriptor` method - // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors + // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors getOwnPropertyDescriptor: $getOwnPropertyDescriptor }); _export({ target: 'Object', stat: true, forced: !nativeSymbol }, { // `Object.getOwnPropertyNames` method - // https://tc39.github.io/ecma262/#sec-object.getownpropertynames + // https://tc39.es/ecma262/#sec-object.getownpropertynames getOwnPropertyNames: $getOwnPropertyNames, // `Object.getOwnPropertySymbols` method - // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols + // https://tc39.es/ecma262/#sec-object.getownpropertysymbols getOwnPropertySymbols: $getOwnPropertySymbols }); @@ -2282,7 +2316,7 @@ _export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwn }); // `JSON.stringify` method behavior with symbols -// https://tc39.github.io/ecma262/#sec-json.stringify +// https://tc39.es/ecma262/#sec-json.stringify if ($stringify) { var FORCED_JSON_STRINGIFY = !nativeSymbol || fails(function () { var symbol = $Symbol(); @@ -2314,18 +2348,18 @@ if ($stringify) { } // `Symbol.prototype[@@toPrimitive]` method -// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive +// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive if (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) { createNonEnumerableProperty($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf); } // `Symbol.prototype[@@toStringTag]` property -// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag +// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag setToStringTag($Symbol, SYMBOL); hiddenKeys[HIDDEN] = true; // `Symbol.asyncIterator` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.asynciterator +// https://tc39.es/ecma262/#sec-symbol.asynciterator defineWellKnownSymbol('asyncIterator'); var defineProperty$3 = objectDefineProperty.f; @@ -2372,1463 +2406,1513 @@ if (descriptors && typeof NativeSymbol == 'function' && (!('description' in Nati } // `Symbol.hasInstance` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.hasinstance +// https://tc39.es/ecma262/#sec-symbol.hasinstance defineWellKnownSymbol('hasInstance'); // `Symbol.isConcatSpreadable` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.isconcatspreadable +// https://tc39.es/ecma262/#sec-symbol.isconcatspreadable defineWellKnownSymbol('isConcatSpreadable'); // `Symbol.iterator` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.iterator +// https://tc39.es/ecma262/#sec-symbol.iterator defineWellKnownSymbol('iterator'); // `Symbol.match` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.match +// https://tc39.es/ecma262/#sec-symbol.match defineWellKnownSymbol('match'); // `Symbol.matchAll` well-known symbol +// https://tc39.es/ecma262/#sec-symbol.matchall defineWellKnownSymbol('matchAll'); // `Symbol.replace` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.replace +// https://tc39.es/ecma262/#sec-symbol.replace defineWellKnownSymbol('replace'); // `Symbol.search` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.search +// https://tc39.es/ecma262/#sec-symbol.search defineWellKnownSymbol('search'); // `Symbol.species` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.species +// https://tc39.es/ecma262/#sec-symbol.species defineWellKnownSymbol('species'); // `Symbol.split` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.split +// https://tc39.es/ecma262/#sec-symbol.split defineWellKnownSymbol('split'); // `Symbol.toPrimitive` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.toprimitive +// https://tc39.es/ecma262/#sec-symbol.toprimitive defineWellKnownSymbol('toPrimitive'); // `Symbol.toStringTag` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.tostringtag +// https://tc39.es/ecma262/#sec-symbol.tostringtag defineWellKnownSymbol('toStringTag'); // `Symbol.unscopables` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.unscopables +// https://tc39.es/ecma262/#sec-symbol.unscopables defineWellKnownSymbol('unscopables'); -var nativeAssign = Object.assign; -var defineProperty$4 = Object.defineProperty; +var correctPrototypeGetter = !fails(function () { + function F() { /* empty */ } + F.prototype.constructor = null; + return Object.getPrototypeOf(new F()) !== F.prototype; +}); -// `Object.assign` method -// https://tc39.github.io/ecma262/#sec-object.assign -var objectAssign = !nativeAssign || fails(function () { - // should have correct order of operations (Edge bug) - if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$4({}, 'a', { - enumerable: true, - get: function () { - defineProperty$4(this, 'b', { - value: 3, - enumerable: false - }); - } - }), { b: 2 })).b !== 1) return true; - // should work with symbols and should have deterministic property order (V8 bug) - var A = {}; - var B = {}; - // eslint-disable-next-line no-undef - var symbol = Symbol(); - var alphabet = 'abcdefghijklmnopqrst'; - A[symbol] = 7; - alphabet.split('').forEach(function (chr) { B[chr] = chr; }); - return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet; -}) ? function assign(target, source) { // eslint-disable-line no-unused-vars - var T = toObject(target); - var argumentsLength = arguments.length; - var index = 1; - var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; - var propertyIsEnumerable = objectPropertyIsEnumerable.f; - while (argumentsLength > index) { - var S = indexedObject(arguments[index++]); - var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S); - var length = keys.length; - var j = 0; - var key; - while (length > j) { - key = keys[j++]; - if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key]; - } - } return T; -} : nativeAssign; +var IE_PROTO$1 = sharedKey('IE_PROTO'); +var ObjectPrototype$1 = Object.prototype; -// `Object.assign` method -// https://tc39.github.io/ecma262/#sec-object.assign -_export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, { - assign: objectAssign -}); +// `Object.getPrototypeOf` method +// https://tc39.es/ecma262/#sec-object.getprototypeof +var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) { + O = toObject(O); + if (has(O, IE_PROTO$1)) return O[IE_PROTO$1]; + if (typeof O.constructor == 'function' && O instanceof O.constructor) { + return O.constructor.prototype; + } return O instanceof Object ? ObjectPrototype$1 : null; +}; -// `Object.create` method -// https://tc39.github.io/ecma262/#sec-object.create -_export({ target: 'Object', stat: true, sham: !descriptors }, { - create: objectCreate -}); +var aPossiblePrototype = function (it) { + if (!isObject(it) && it !== null) { + throw TypeError("Can't set " + String(it) + ' as a prototype'); + } return it; +}; -// `Object.defineProperty` method -// https://tc39.github.io/ecma262/#sec-object.defineproperty -_export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, { - defineProperty: objectDefineProperty.f -}); +// `Object.setPrototypeOf` method +// https://tc39.es/ecma262/#sec-object.setprototypeof +// Works with __proto__ only. Old v8 can't work with null proto objects. +/* eslint-disable no-proto */ +var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () { + var CORRECT_SETTER = false; + var test = {}; + var setter; + try { + setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; + setter.call(test, []); + CORRECT_SETTER = test instanceof Array; + } catch (error) { /* empty */ } + return function setPrototypeOf(O, proto) { + anObject(O); + aPossiblePrototype(proto); + if (CORRECT_SETTER) setter.call(O, proto); + else O.__proto__ = proto; + return O; + }; +}() : undefined); -// `Object.defineProperties` method -// https://tc39.github.io/ecma262/#sec-object.defineproperties -_export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, { - defineProperties: objectDefineProperties +var $AggregateError = function AggregateError(errors, message) { + var that = this; + if (!(that instanceof $AggregateError)) return new $AggregateError(errors, message); + if (objectSetPrototypeOf) { + // eslint-disable-next-line unicorn/error-message + that = objectSetPrototypeOf(new Error(undefined), objectGetPrototypeOf(that)); + } + if (message !== undefined) createNonEnumerableProperty(that, 'message', String(message)); + var errorsArray = []; + iterate(errors, errorsArray.push, { that: errorsArray }); + createNonEnumerableProperty(that, 'errors', errorsArray); + return that; +}; + +$AggregateError.prototype = objectCreate(Error.prototype, { + constructor: createPropertyDescriptor(5, $AggregateError), + message: createPropertyDescriptor(5, ''), + name: createPropertyDescriptor(5, 'AggregateError') }); -var propertyIsEnumerable = objectPropertyIsEnumerable.f; +// `AggregateError` constructor +// https://tc39.es/ecma262/#sec-aggregate-error-constructor +_export({ global: true }, { + AggregateError: $AggregateError +}); -// `Object.{ entries, values }` methods implementation -var createMethod$2 = function (TO_ENTRIES) { - return function (it) { - var O = toIndexedObject(it); - var keys = objectKeys(O); - var length = keys.length; - var i = 0; - var result = []; - var key; - while (length > i) { - key = keys[i++]; - if (!descriptors || propertyIsEnumerable.call(O, key)) { - result.push(TO_ENTRIES ? [key, O[key]] : O[key]); - } - } - return result; - }; +// call something on iterator step with safe closing on error +var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) { + try { + return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); + // 7.4.6 IteratorClose(iterator, completion) + } catch (error) { + iteratorClose(iterator); + throw error; + } }; -var objectToArray = { - // `Object.entries` method - // https://tc39.github.io/ecma262/#sec-object.entries - entries: createMethod$2(true), - // `Object.values` method - // https://tc39.github.io/ecma262/#sec-object.values - values: createMethod$2(false) +var createProperty = function (object, key, value) { + var propertyKey = toPrimitive(key); + if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value)); + else object[propertyKey] = value; }; -var $entries = objectToArray.entries; - -// `Object.entries` method -// https://tc39.github.io/ecma262/#sec-object.entries -_export({ target: 'Object', stat: true }, { - entries: function entries(O) { - return $entries(O); +// `Array.from` method implementation +// https://tc39.es/ecma262/#sec-array.from +var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { + var O = toObject(arrayLike); + var C = typeof this == 'function' ? this : Array; + var argumentsLength = arguments.length; + var mapfn = argumentsLength > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + var iteratorMethod = getIteratorMethod(O); + var index = 0; + var length, result, step, iterator, next, value; + if (mapping) mapfn = functionBindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); + // if the target is not iterable or it's an array with the default iterator - use a simple case + if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) { + iterator = iteratorMethod.call(O); + next = iterator.next; + result = new C(); + for (;!(step = next.call(iterator)).done; index++) { + value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; + createProperty(result, index, value); + } + } else { + length = toLength(O.length); + result = new C(length); + for (;length > index; index++) { + value = mapping ? mapfn(O[index], index) : O[index]; + createProperty(result, index, value); + } } + result.length = index; + return result; +}; + +var INCORRECT_ITERATION$1 = !checkCorrectnessOfIteration(function (iterable) { + Array.from(iterable); }); -var freezing = !fails(function () { - return Object.isExtensible(Object.preventExtensions({})); +// `Array.from` method +// https://tc39.es/ecma262/#sec-array.from +_export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION$1 }, { + from: arrayFrom }); -var internalMetadata = createCommonjsModule(function (module) { -var defineProperty = objectDefineProperty.f; +// `Array.isArray` method +// https://tc39.es/ecma262/#sec-array.isarray +_export({ target: 'Array', stat: true }, { + isArray: isArray +}); +var ISNT_GENERIC = fails(function () { + function F() { /* empty */ } + return !(Array.of.call(F) instanceof F); +}); +// `Array.of` method +// https://tc39.es/ecma262/#sec-array.of +// WebKit Array.of isn't generic +_export({ target: 'Array', stat: true, forced: ISNT_GENERIC }, { + of: function of(/* ...args */) { + var index = 0; + var argumentsLength = arguments.length; + var result = new (typeof this == 'function' ? this : Array)(argumentsLength); + while (argumentsLength > index) createProperty(result, index, arguments[index++]); + result.length = argumentsLength; + return result; + } +}); -var METADATA = uid('meta'); -var id = 0; +var SPECIES$4 = wellKnownSymbol('species'); -var isExtensible = Object.isExtensible || function () { - return true; +var arrayMethodHasSpeciesSupport = function (METHOD_NAME) { + // We can't use this feature detection in V8 since it causes + // deoptimization and serious performance degradation + // https://github.com/zloirock/core-js/issues/677 + return engineV8Version >= 51 || !fails(function () { + var array = []; + var constructor = array.constructor = {}; + constructor[SPECIES$4] = function () { + return { foo: 1 }; + }; + return array[METHOD_NAME](Boolean).foo !== 1; + }); }; -var setMetadata = function (it) { - defineProperty(it, METADATA, { value: { - objectID: 'O' + ++id, // object ID - weakData: {} // weak collections IDs - } }); -}; +var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); +var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; +var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; -var fastKey = function (it, create) { - // return a primitive with prefix - if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if (!has(it, METADATA)) { - // can't set metadata to uncaught frozen object - if (!isExtensible(it)) return 'F'; - // not necessary to add metadata - if (!create) return 'E'; - // add missing metadata - setMetadata(it); - // return object ID - } return it[METADATA].objectID; -}; +// We can't use this feature detection in V8 since it causes +// deoptimization and serious performance degradation +// https://github.com/zloirock/core-js/issues/679 +var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () { + var array = []; + array[IS_CONCAT_SPREADABLE] = false; + return array.concat()[0] !== array; +}); -var getWeakData = function (it, create) { - if (!has(it, METADATA)) { - // can't set metadata to uncaught frozen object - if (!isExtensible(it)) return true; - // not necessary to add metadata - if (!create) return false; - // add missing metadata - setMetadata(it); - // return the store of weak collections IDs - } return it[METADATA].weakData; -}; +var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat'); -// add metadata on freeze-family methods calling -var onFreeze = function (it) { - if (freezing && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it); - return it; +var isConcatSpreadable = function (O) { + if (!isObject(O)) return false; + var spreadable = O[IS_CONCAT_SPREADABLE]; + return spreadable !== undefined ? !!spreadable : isArray(O); }; -var meta = module.exports = { - REQUIRED: false, - fastKey: fastKey, - getWeakData: getWeakData, - onFreeze: onFreeze -}; +var FORCED$1 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; -hiddenKeys[METADATA] = true; +// `Array.prototype.concat` method +// https://tc39.es/ecma262/#sec-array.prototype.concat +// with adding support of @@isConcatSpreadable and @@species +_export({ target: 'Array', proto: true, forced: FORCED$1 }, { + concat: function concat(arg) { // eslint-disable-line no-unused-vars + var O = toObject(this); + var A = arraySpeciesCreate(O, 0); + var n = 0; + var i, k, length, len, E; + for (i = -1, length = arguments.length; i < length; i++) { + E = i === -1 ? O : arguments[i]; + if (isConcatSpreadable(E)) { + len = toLength(E.length); + if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]); + } else { + if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + createProperty(A, n++, E); + } + } + A.length = n; + return A; + } }); -var onFreeze = internalMetadata.onFreeze; - -var nativeFreeze = Object.freeze; -var FAILS_ON_PRIMITIVES = fails(function () { nativeFreeze(1); }); +var min$2 = Math.min; -// `Object.freeze` method -// https://tc39.github.io/ecma262/#sec-object.freeze -_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !freezing }, { - freeze: function freeze(it) { - return nativeFreeze && isObject(it) ? nativeFreeze(onFreeze(it)) : it; +// `Array.prototype.copyWithin` method implementation +// https://tc39.es/ecma262/#sec-array.prototype.copywithin +var arrayCopyWithin = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) { + var O = toObject(this); + var len = toLength(O.length); + var to = toAbsoluteIndex(target, len); + var from = toAbsoluteIndex(start, len); + var end = arguments.length > 2 ? arguments[2] : undefined; + var count = min$2((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to); + var inc = 1; + if (from < to && to < from + count) { + inc = -1; + from += count - 1; + to += count - 1; } -}); + while (count-- > 0) { + if (from in O) O[to] = O[from]; + else delete O[to]; + to += inc; + from += inc; + } return O; +}; -var createProperty = function (object, key, value) { - var propertyKey = toPrimitive(key); - if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value)); - else object[propertyKey] = value; +var UNSCOPABLES = wellKnownSymbol('unscopables'); +var ArrayPrototype$1 = Array.prototype; + +// Array.prototype[@@unscopables] +// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables +if (ArrayPrototype$1[UNSCOPABLES] == undefined) { + objectDefineProperty.f(ArrayPrototype$1, UNSCOPABLES, { + configurable: true, + value: objectCreate(null) + }); +} + +// add a key to Array.prototype[@@unscopables] +var addToUnscopables = function (key) { + ArrayPrototype$1[UNSCOPABLES][key] = true; }; -// `Object.fromEntries` method -// https://github.com/tc39/proposal-object-from-entries -_export({ target: 'Object', stat: true }, { - fromEntries: function fromEntries(iterable) { - var obj = {}; - iterate_1(iterable, function (k, v) { - createProperty(obj, k, v); - }, undefined, true); - return obj; - } +// `Array.prototype.copyWithin` method +// https://tc39.es/ecma262/#sec-array.prototype.copywithin +_export({ target: 'Array', proto: true }, { + copyWithin: arrayCopyWithin }); -var nativeGetOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; +// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables +addToUnscopables('copyWithin'); +var arrayMethodIsStrict = function (METHOD_NAME, argument) { + var method = [][METHOD_NAME]; + return !!method && fails(function () { + // eslint-disable-next-line no-useless-call,no-throw-literal + method.call(null, argument || function () { throw 1; }, 1); + }); +}; -var FAILS_ON_PRIMITIVES$1 = fails(function () { nativeGetOwnPropertyDescriptor$2(1); }); -var FORCED$1 = !descriptors || FAILS_ON_PRIMITIVES$1; +var defineProperty$4 = Object.defineProperty; +var cache = {}; -// `Object.getOwnPropertyDescriptor` method -// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor -_export({ target: 'Object', stat: true, forced: FORCED$1, sham: !descriptors }, { - getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { - return nativeGetOwnPropertyDescriptor$2(toIndexedObject(it), key); - } -}); +var thrower = function (it) { throw it; }; -// `Object.getOwnPropertyDescriptors` method -// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors -_export({ target: 'Object', stat: true, sham: !descriptors }, { - getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { - var O = toIndexedObject(object); - var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; - var keys = ownKeys(O); - var result = {}; - var index = 0; - var key, descriptor; - while (keys.length > index) { - descriptor = getOwnPropertyDescriptor(O, key = keys[index++]); - if (descriptor !== undefined) createProperty(result, key, descriptor); - } - return result; - } -}); +var arrayMethodUsesToLength = function (METHOD_NAME, options) { + if (has(cache, METHOD_NAME)) return cache[METHOD_NAME]; + if (!options) options = {}; + var method = [][METHOD_NAME]; + var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false; + var argument0 = has(options, 0) ? options[0] : thrower; + var argument1 = has(options, 1) ? options[1] : undefined; -var nativeGetOwnPropertyNames$2 = objectGetOwnPropertyNamesExternal.f; + return cache[METHOD_NAME] = !!method && !fails(function () { + if (ACCESSORS && !descriptors) return true; + var O = { length: -1 }; -var FAILS_ON_PRIMITIVES$2 = fails(function () { return !Object.getOwnPropertyNames(1); }); + if (ACCESSORS) defineProperty$4(O, 1, { enumerable: true, get: thrower }); + else O[1] = 1; -// `Object.getOwnPropertyNames` method -// https://tc39.github.io/ecma262/#sec-object.getownpropertynames -_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$2 }, { - getOwnPropertyNames: nativeGetOwnPropertyNames$2 -}); + method.call(O, argument0, argument1); + }); +}; -var correctPrototypeGetter = !fails(function () { - function F() { /* empty */ } - F.prototype.constructor = null; - return Object.getPrototypeOf(new F()) !== F.prototype; -}); +var $every = arrayIteration.every; -var IE_PROTO$1 = sharedKey('IE_PROTO'); -var ObjectPrototype$1 = Object.prototype; -// `Object.getPrototypeOf` method -// https://tc39.github.io/ecma262/#sec-object.getprototypeof -var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) { - O = toObject(O); - if (has(O, IE_PROTO$1)) return O[IE_PROTO$1]; - if (typeof O.constructor == 'function' && O instanceof O.constructor) { - return O.constructor.prototype; - } return O instanceof Object ? ObjectPrototype$1 : null; -}; -var FAILS_ON_PRIMITIVES$3 = fails(function () { objectGetPrototypeOf(1); }); +var STRICT_METHOD = arrayMethodIsStrict('every'); +var USES_TO_LENGTH = arrayMethodUsesToLength('every'); -// `Object.getPrototypeOf` method -// https://tc39.github.io/ecma262/#sec-object.getprototypeof -_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$3, sham: !correctPrototypeGetter }, { - getPrototypeOf: function getPrototypeOf(it) { - return objectGetPrototypeOf(toObject(it)); +// `Array.prototype.every` method +// https://tc39.es/ecma262/#sec-array.prototype.every +_export({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, { + every: function every(callbackfn /* , thisArg */) { + return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); -// `SameValue` abstract operation -// https://tc39.github.io/ecma262/#sec-samevalue -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; +// `Array.prototype.fill` method implementation +// https://tc39.es/ecma262/#sec-array.prototype.fill +var arrayFill = function fill(value /* , start = 0, end = @length */) { + var O = toObject(this); + var length = toLength(O.length); + var argumentsLength = arguments.length; + var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length); + var end = argumentsLength > 2 ? arguments[2] : undefined; + var endPos = end === undefined ? length : toAbsoluteIndex(end, length); + while (endPos > index) O[index++] = value; + return O; }; -// `Object.is` method -// https://tc39.github.io/ecma262/#sec-object.is -_export({ target: 'Object', stat: true }, { - is: sameValue +// `Array.prototype.fill` method +// https://tc39.es/ecma262/#sec-array.prototype.fill +_export({ target: 'Array', proto: true }, { + fill: arrayFill }); -var nativeIsExtensible = Object.isExtensible; -var FAILS_ON_PRIMITIVES$4 = fails(function () { nativeIsExtensible(1); }); +// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables +addToUnscopables('fill'); -// `Object.isExtensible` method -// https://tc39.github.io/ecma262/#sec-object.isextensible -_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$4 }, { - isExtensible: function isExtensible(it) { - return isObject(it) ? nativeIsExtensible ? nativeIsExtensible(it) : true : false; - } -}); +var $filter = arrayIteration.filter; -var nativeIsFrozen = Object.isFrozen; -var FAILS_ON_PRIMITIVES$5 = fails(function () { nativeIsFrozen(1); }); -// `Object.isFrozen` method -// https://tc39.github.io/ecma262/#sec-object.isfrozen -_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$5 }, { - isFrozen: function isFrozen(it) { - return isObject(it) ? nativeIsFrozen ? nativeIsFrozen(it) : false : true; - } -}); -var nativeIsSealed = Object.isSealed; -var FAILS_ON_PRIMITIVES$6 = fails(function () { nativeIsSealed(1); }); +var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter'); +// Edge 14- issue +var USES_TO_LENGTH$1 = arrayMethodUsesToLength('filter'); -// `Object.isSealed` method -// https://tc39.github.io/ecma262/#sec-object.issealed -_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$6 }, { - isSealed: function isSealed(it) { - return isObject(it) ? nativeIsSealed ? nativeIsSealed(it) : false : true; +// `Array.prototype.filter` method +// https://tc39.es/ecma262/#sec-array.prototype.filter +// with adding support of @@species +_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH$1 }, { + filter: function filter(callbackfn /* , thisArg */) { + return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); -var FAILS_ON_PRIMITIVES$7 = fails(function () { objectKeys(1); }); +var $find = arrayIteration.find; -// `Object.keys` method -// https://tc39.github.io/ecma262/#sec-object.keys -_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$7 }, { - keys: function keys(it) { - return objectKeys(toObject(it)); - } -}); -var onFreeze$1 = internalMetadata.onFreeze; +var FIND = 'find'; +var SKIPS_HOLES = true; +var USES_TO_LENGTH$2 = arrayMethodUsesToLength(FIND); -var nativePreventExtensions = Object.preventExtensions; -var FAILS_ON_PRIMITIVES$8 = fails(function () { nativePreventExtensions(1); }); +// Shouldn't skip holes +if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; }); -// `Object.preventExtensions` method -// https://tc39.github.io/ecma262/#sec-object.preventextensions -_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$8, sham: !freezing }, { - preventExtensions: function preventExtensions(it) { - return nativePreventExtensions && isObject(it) ? nativePreventExtensions(onFreeze$1(it)) : it; +// `Array.prototype.find` method +// https://tc39.es/ecma262/#sec-array.prototype.find +_export({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH$2 }, { + find: function find(callbackfn /* , that = undefined */) { + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); -var onFreeze$2 = internalMetadata.onFreeze; +// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables +addToUnscopables(FIND); +var $findIndex = arrayIteration.findIndex; -var nativeSeal = Object.seal; -var FAILS_ON_PRIMITIVES$9 = fails(function () { nativeSeal(1); }); -// `Object.seal` method -// https://tc39.github.io/ecma262/#sec-object.seal -_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$9, sham: !freezing }, { - seal: function seal(it) { - return nativeSeal && isObject(it) ? nativeSeal(onFreeze$2(it)) : it; +var FIND_INDEX = 'findIndex'; +var SKIPS_HOLES$1 = true; + +var USES_TO_LENGTH$3 = arrayMethodUsesToLength(FIND_INDEX); + +// Shouldn't skip holes +if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES$1 = false; }); + +// `Array.prototype.findIndex` method +// https://tc39.es/ecma262/#sec-array.prototype.findindex +_export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 || !USES_TO_LENGTH$3 }, { + findIndex: function findIndex(callbackfn /* , that = undefined */) { + return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); -var aPossiblePrototype = function (it) { - if (!isObject(it) && it !== null) { - throw TypeError("Can't set " + String(it) + ' as a prototype'); - } return it; -}; +// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables +addToUnscopables(FIND_INDEX); -// `Object.setPrototypeOf` method -// https://tc39.github.io/ecma262/#sec-object.setprototypeof -// Works with __proto__ only. Old v8 can't work with null proto objects. -/* eslint-disable no-proto */ -var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () { - var CORRECT_SETTER = false; - var test = {}; - var setter; - try { - setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; - setter.call(test, []); - CORRECT_SETTER = test instanceof Array; - } catch (error) { /* empty */ } - return function setPrototypeOf(O, proto) { - anObject(O); - aPossiblePrototype(proto); - if (CORRECT_SETTER) setter.call(O, proto); - else O.__proto__ = proto; - return O; - }; -}() : undefined); +// `FlattenIntoArray` abstract operation +// https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray +var flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) { + var targetIndex = start; + var sourceIndex = 0; + var mapFn = mapper ? functionBindContext(mapper, thisArg, 3) : false; + var element; -// `Object.setPrototypeOf` method -// https://tc39.github.io/ecma262/#sec-object.setprototypeof -_export({ target: 'Object', stat: true }, { - setPrototypeOf: objectSetPrototypeOf -}); + while (sourceIndex < sourceLen) { + if (sourceIndex in source) { + element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex]; -var $values = objectToArray.values; + if (depth > 0 && isArray(element)) { + targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1; + } else { + if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length'); + target[targetIndex] = element; + } -// `Object.values` method -// https://tc39.github.io/ecma262/#sec-object.values -_export({ target: 'Object', stat: true }, { - values: function values(O) { - return $values(O); + targetIndex++; + } + sourceIndex++; + } + return targetIndex; +}; + +var flattenIntoArray_1 = flattenIntoArray; + +// `Array.prototype.flat` method +// https://tc39.es/ecma262/#sec-array.prototype.flat +_export({ target: 'Array', proto: true }, { + flat: function flat(/* depthArg = 1 */) { + var depthArg = arguments.length ? arguments[0] : undefined; + var O = toObject(this); + var sourceLen = toLength(O.length); + var A = arraySpeciesCreate(O, 0); + A.length = flattenIntoArray_1(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg)); + return A; } }); -// Forced replacement object prototype accessors methods -var objectPrototypeAccessorsForced = !fails(function () { - var key = Math.random(); - // In FF throws only define methods - // eslint-disable-next-line no-undef, no-useless-call - __defineSetter__.call(null, key, function () { /* empty */ }); - delete global_1[key]; +// `Array.prototype.flatMap` method +// https://tc39.es/ecma262/#sec-array.prototype.flatmap +_export({ target: 'Array', proto: true }, { + flatMap: function flatMap(callbackfn /* , thisArg */) { + var O = toObject(this); + var sourceLen = toLength(O.length); + var A; + aFunction$1(callbackfn); + A = arraySpeciesCreate(O, 0); + A.length = flattenIntoArray_1(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + return A; + } }); -// `Object.prototype.__defineGetter__` method -// https://tc39.github.io/ecma262/#sec-object.prototype.__defineGetter__ -if (descriptors) { - _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { - __defineGetter__: function __defineGetter__(P, getter) { - objectDefineProperty.f(toObject(this), P, { get: aFunction$1(getter), enumerable: true, configurable: true }); - } - }); -} +var $forEach$1 = arrayIteration.forEach; -// `Object.prototype.__defineSetter__` method -// https://tc39.github.io/ecma262/#sec-object.prototype.__defineSetter__ -if (descriptors) { - _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { - __defineSetter__: function __defineSetter__(P, setter) { - objectDefineProperty.f(toObject(this), P, { set: aFunction$1(setter), enumerable: true, configurable: true }); - } - }); -} -var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f; -// `Object.prototype.__lookupGetter__` method -// https://tc39.github.io/ecma262/#sec-object.prototype.__lookupGetter__ -if (descriptors) { - _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { - __lookupGetter__: function __lookupGetter__(P) { - var O = toObject(this); - var key = toPrimitive(P, true); - var desc; - do { - if (desc = getOwnPropertyDescriptor$3(O, key)) return desc.get; - } while (O = objectGetPrototypeOf(O)); - } - }); -} +var STRICT_METHOD$1 = arrayMethodIsStrict('forEach'); +var USES_TO_LENGTH$4 = arrayMethodUsesToLength('forEach'); -var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f; +// `Array.prototype.forEach` method implementation +// https://tc39.es/ecma262/#sec-array.prototype.foreach +var arrayForEach = (!STRICT_METHOD$1 || !USES_TO_LENGTH$4) ? function forEach(callbackfn /* , thisArg */) { + return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); +} : [].forEach; -// `Object.prototype.__lookupSetter__` method -// https://tc39.github.io/ecma262/#sec-object.prototype.__lookupSetter__ -if (descriptors) { - _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { - __lookupSetter__: function __lookupSetter__(P) { - var O = toObject(this); - var key = toPrimitive(P, true); - var desc; - do { - if (desc = getOwnPropertyDescriptor$4(O, key)) return desc.set; - } while (O = objectGetPrototypeOf(O)); - } - }); -} +// `Array.prototype.forEach` method +// https://tc39.es/ecma262/#sec-array.prototype.foreach +_export({ target: 'Array', proto: true, forced: [].forEach != arrayForEach }, { + forEach: arrayForEach +}); -var slice$1 = [].slice; -var factories = {}; +var $includes = arrayIncludes.includes; -var construct = function (C, argsLength, args) { - if (!(argsLength in factories)) { - for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']'; - // eslint-disable-next-line no-new-func - factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')'); - } return factories[argsLength](C, args); -}; -// `Function.prototype.bind` method implementation -// https://tc39.github.io/ecma262/#sec-function.prototype.bind -var functionBind = Function.bind || function bind(that /* , ...args */) { - var fn = aFunction$1(this); - var partArgs = slice$1.call(arguments, 1); - var boundFunction = function bound(/* args... */) { - var args = partArgs.concat(slice$1.call(arguments)); - return this instanceof boundFunction ? construct(fn, args.length, args) : fn.apply(that, args); - }; - if (isObject(fn.prototype)) boundFunction.prototype = fn.prototype; - return boundFunction; -}; -// `Function.prototype.bind` method -// https://tc39.github.io/ecma262/#sec-function.prototype.bind -_export({ target: 'Function', proto: true }, { - bind: functionBind +var USES_TO_LENGTH$5 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); + +// `Array.prototype.includes` method +// https://tc39.es/ecma262/#sec-array.prototype.includes +_export({ target: 'Array', proto: true, forced: !USES_TO_LENGTH$5 }, { + includes: function includes(el /* , fromIndex = 0 */) { + return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); + } }); -var HAS_INSTANCE = wellKnownSymbol('hasInstance'); -var FunctionPrototype$1 = Function.prototype; +// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables +addToUnscopables('includes'); -// `Function.prototype[@@hasInstance]` method -// https://tc39.github.io/ecma262/#sec-function.prototype-@@hasinstance -if (!(HAS_INSTANCE in FunctionPrototype$1)) { - objectDefineProperty.f(FunctionPrototype$1, HAS_INSTANCE, { value: function (O) { - if (typeof this != 'function' || !isObject(O)) return false; - if (!isObject(this.prototype)) return O instanceof this; - // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: - while (O = objectGetPrototypeOf(O)) if (this.prototype === O) return true; - return false; - } }); -} +var $indexOf = arrayIncludes.indexOf; -// `globalThis` object -// https://github.com/tc39/proposal-global -_export({ global: true }, { - globalThis: global_1 -}); -// `Array.from` method implementation -// https://tc39.github.io/ecma262/#sec-array.from -var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { - var O = toObject(arrayLike); - var C = typeof this == 'function' ? this : Array; - var argumentsLength = arguments.length; - var mapfn = argumentsLength > 1 ? arguments[1] : undefined; - var mapping = mapfn !== undefined; - var iteratorMethod = getIteratorMethod(O); - var index = 0; - var length, result, step, iterator, next, value; - if (mapping) mapfn = functionBindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); - // if the target is not iterable or it's an array with the default iterator - use a simple case - if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) { - iterator = iteratorMethod.call(O); - next = iterator.next; - result = new C(); - for (;!(step = next.call(iterator)).done; index++) { - value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; - createProperty(result, index, value); - } - } else { - length = toLength(O.length); - result = new C(length); - for (;length > index; index++) { - value = mapping ? mapfn(O[index], index) : O[index]; - createProperty(result, index, value); - } - } - result.length = index; - return result; -}; -var INCORRECT_ITERATION$1 = !checkCorrectnessOfIteration(function (iterable) { - Array.from(iterable); -}); +var nativeIndexOf = [].indexOf; -// `Array.from` method -// https://tc39.github.io/ecma262/#sec-array.from -_export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION$1 }, { - from: arrayFrom -}); +var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0; +var STRICT_METHOD$2 = arrayMethodIsStrict('indexOf'); +var USES_TO_LENGTH$6 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); -// `Array.isArray` method -// https://tc39.github.io/ecma262/#sec-array.isarray -_export({ target: 'Array', stat: true }, { - isArray: isArray +// `Array.prototype.indexOf` method +// https://tc39.es/ecma262/#sec-array.prototype.indexof +_export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$2 || !USES_TO_LENGTH$6 }, { + indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { + return NEGATIVE_ZERO + // convert -0 to +0 + ? nativeIndexOf.apply(this, arguments) || 0 + : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined); + } }); -var ISNT_GENERIC = fails(function () { - function F() { /* empty */ } - return !(Array.of.call(F) instanceof F); -}); +var nativeJoin = [].join; -// `Array.of` method -// https://tc39.github.io/ecma262/#sec-array.of -// WebKit Array.of isn't generic -_export({ target: 'Array', stat: true, forced: ISNT_GENERIC }, { - of: function of(/* ...args */) { - var index = 0; - var argumentsLength = arguments.length; - var result = new (typeof this == 'function' ? this : Array)(argumentsLength); - while (argumentsLength > index) createProperty(result, index, arguments[index++]); - result.length = argumentsLength; - return result; +var ES3_STRINGS = indexedObject != Object; +var STRICT_METHOD$3 = arrayMethodIsStrict('join', ','); + +// `Array.prototype.join` method +// https://tc39.es/ecma262/#sec-array.prototype.join +_export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$3 }, { + join: function join(separator) { + return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator); } }); -var SPECIES$4 = wellKnownSymbol('species'); - -var arrayMethodHasSpeciesSupport = function (METHOD_NAME) { - // We can't use this feature detection in V8 since it causes - // deoptimization and serious performance degradation - // https://github.com/zloirock/core-js/issues/677 - return engineV8Version >= 51 || !fails(function () { - var array = []; - var constructor = array.constructor = {}; - constructor[SPECIES$4] = function () { - return { foo: 1 }; - }; - return array[METHOD_NAME](Boolean).foo !== 1; - }); -}; +var min$3 = Math.min; +var nativeLastIndexOf = [].lastIndexOf; +var NEGATIVE_ZERO$1 = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0; +var STRICT_METHOD$4 = arrayMethodIsStrict('lastIndexOf'); +// For preventing possible almost infinite loop in non-standard implementations, test the forward version of the method +var USES_TO_LENGTH$7 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); +var FORCED$2 = NEGATIVE_ZERO$1 || !STRICT_METHOD$4 || !USES_TO_LENGTH$7; -var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); -var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; -var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; +// `Array.prototype.lastIndexOf` method implementation +// https://tc39.es/ecma262/#sec-array.prototype.lastindexof +var arrayLastIndexOf = FORCED$2 ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { + // convert -0 to +0 + if (NEGATIVE_ZERO$1) return nativeLastIndexOf.apply(this, arguments) || 0; + var O = toIndexedObject(this); + var length = toLength(O.length); + var index = length - 1; + if (arguments.length > 1) index = min$3(index, toInteger(arguments[1])); + if (index < 0) index = length + index; + for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0; + return -1; +} : nativeLastIndexOf; -// We can't use this feature detection in V8 since it causes -// deoptimization and serious performance degradation -// https://github.com/zloirock/core-js/issues/679 -var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () { - var array = []; - array[IS_CONCAT_SPREADABLE] = false; - return array.concat()[0] !== array; +// `Array.prototype.lastIndexOf` method +// https://tc39.es/ecma262/#sec-array.prototype.lastindexof +_export({ target: 'Array', proto: true, forced: arrayLastIndexOf !== [].lastIndexOf }, { + lastIndexOf: arrayLastIndexOf }); -var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat'); +var $map = arrayIteration.map; -var isConcatSpreadable = function (O) { - if (!isObject(O)) return false; - var spreadable = O[IS_CONCAT_SPREADABLE]; - return spreadable !== undefined ? !!spreadable : isArray(O); -}; -var FORCED$2 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; -// `Array.prototype.concat` method -// https://tc39.github.io/ecma262/#sec-array.prototype.concat -// with adding support of @@isConcatSpreadable and @@species -_export({ target: 'Array', proto: true, forced: FORCED$2 }, { - concat: function concat(arg) { // eslint-disable-line no-unused-vars - var O = toObject(this); - var A = arraySpeciesCreate(O, 0); - var n = 0; - var i, k, length, len, E; - for (i = -1, length = arguments.length; i < length; i++) { - E = i === -1 ? O : arguments[i]; - if (isConcatSpreadable(E)) { - len = toLength(E.length); - if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); - for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]); - } else { - if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); - createProperty(A, n++, E); - } - } - A.length = n; - return A; +var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('map'); +// FF49- issue +var USES_TO_LENGTH$8 = arrayMethodUsesToLength('map'); + +// `Array.prototype.map` method +// https://tc39.es/ecma262/#sec-array.prototype.map +// with adding support of @@species +_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 || !USES_TO_LENGTH$8 }, { + map: function map(callbackfn /* , thisArg */) { + return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); -var min$2 = Math.min; +// `Array.prototype.{ reduce, reduceRight }` methods implementation +var createMethod$2 = function (IS_RIGHT) { + return function (that, callbackfn, argumentsLength, memo) { + aFunction$1(callbackfn); + var O = toObject(that); + var self = indexedObject(O); + var length = toLength(O.length); + var index = IS_RIGHT ? length - 1 : 0; + var i = IS_RIGHT ? -1 : 1; + if (argumentsLength < 2) while (true) { + if (index in self) { + memo = self[index]; + index += i; + break; + } + index += i; + if (IS_RIGHT ? index < 0 : length <= index) { + throw TypeError('Reduce of empty array with no initial value'); + } + } + for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) { + memo = callbackfn(memo, self[index], index, O); + } + return memo; + }; +}; -// `Array.prototype.copyWithin` method implementation -// https://tc39.github.io/ecma262/#sec-array.prototype.copywithin -var arrayCopyWithin = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) { - var O = toObject(this); - var len = toLength(O.length); - var to = toAbsoluteIndex(target, len); - var from = toAbsoluteIndex(start, len); - var end = arguments.length > 2 ? arguments[2] : undefined; - var count = min$2((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to); - var inc = 1; - if (from < to && to < from + count) { - inc = -1; - from += count - 1; - to += count - 1; - } - while (count-- > 0) { - if (from in O) O[to] = O[from]; - else delete O[to]; - to += inc; - from += inc; - } return O; +var arrayReduce = { + // `Array.prototype.reduce` method + // https://tc39.es/ecma262/#sec-array.prototype.reduce + left: createMethod$2(false), + // `Array.prototype.reduceRight` method + // https://tc39.es/ecma262/#sec-array.prototype.reduceright + right: createMethod$2(true) }; -var UNSCOPABLES = wellKnownSymbol('unscopables'); -var ArrayPrototype$1 = Array.prototype; +var $reduce = arrayReduce.left; -// Array.prototype[@@unscopables] -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -if (ArrayPrototype$1[UNSCOPABLES] == undefined) { - objectDefineProperty.f(ArrayPrototype$1, UNSCOPABLES, { - configurable: true, - value: objectCreate(null) - }); -} -// add a key to Array.prototype[@@unscopables] -var addToUnscopables = function (key) { - ArrayPrototype$1[UNSCOPABLES][key] = true; -}; -// `Array.prototype.copyWithin` method -// https://tc39.github.io/ecma262/#sec-array.prototype.copywithin -_export({ target: 'Array', proto: true }, { - copyWithin: arrayCopyWithin -}); -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -addToUnscopables('copyWithin'); -var arrayMethodIsStrict = function (METHOD_NAME, argument) { - var method = [][METHOD_NAME]; - return !!method && fails(function () { - // eslint-disable-next-line no-useless-call,no-throw-literal - method.call(null, argument || function () { throw 1; }, 1); - }); -}; +var STRICT_METHOD$5 = arrayMethodIsStrict('reduce'); +var USES_TO_LENGTH$9 = arrayMethodUsesToLength('reduce', { 1: 0 }); +// Chrome 80-82 has a critical bug +// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982 +var CHROME_BUG = !engineIsNode && engineV8Version > 79 && engineV8Version < 83; -var defineProperty$5 = Object.defineProperty; -var cache = {}; +// `Array.prototype.reduce` method +// https://tc39.es/ecma262/#sec-array.prototype.reduce +_export({ target: 'Array', proto: true, forced: !STRICT_METHOD$5 || !USES_TO_LENGTH$9 || CHROME_BUG }, { + reduce: function reduce(callbackfn /* , initialValue */) { + return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); + } +}); -var thrower = function (it) { throw it; }; +var $reduceRight = arrayReduce.right; -var arrayMethodUsesToLength = function (METHOD_NAME, options) { - if (has(cache, METHOD_NAME)) return cache[METHOD_NAME]; - if (!options) options = {}; - var method = [][METHOD_NAME]; - var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false; - var argument0 = has(options, 0) ? options[0] : thrower; - var argument1 = has(options, 1) ? options[1] : undefined; - return cache[METHOD_NAME] = !!method && !fails(function () { - if (ACCESSORS && !descriptors) return true; - var O = { length: -1 }; - if (ACCESSORS) defineProperty$5(O, 1, { enumerable: true, get: thrower }); - else O[1] = 1; - method.call(O, argument0, argument1); - }); -}; -var $every = arrayIteration.every; +var STRICT_METHOD$6 = arrayMethodIsStrict('reduceRight'); +// For preventing possible almost infinite loop in non-standard implementations, test the forward version of the method +var USES_TO_LENGTH$a = arrayMethodUsesToLength('reduce', { 1: 0 }); +// Chrome 80-82 has a critical bug +// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982 +var CHROME_BUG$1 = !engineIsNode && engineV8Version > 79 && engineV8Version < 83; +// `Array.prototype.reduceRight` method +// https://tc39.es/ecma262/#sec-array.prototype.reduceright +_export({ target: 'Array', proto: true, forced: !STRICT_METHOD$6 || !USES_TO_LENGTH$a || CHROME_BUG$1 }, { + reduceRight: function reduceRight(callbackfn /* , initialValue */) { + return $reduceRight(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); + } +}); +var nativeReverse = [].reverse; +var test$1 = [1, 2]; -var STRICT_METHOD = arrayMethodIsStrict('every'); -var USES_TO_LENGTH = arrayMethodUsesToLength('every'); - -// `Array.prototype.every` method -// https://tc39.github.io/ecma262/#sec-array.prototype.every -_export({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, { - every: function every(callbackfn /* , thisArg */) { - return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); +// `Array.prototype.reverse` method +// https://tc39.es/ecma262/#sec-array.prototype.reverse +// fix for Safari 12.0 bug +// https://bugs.webkit.org/show_bug.cgi?id=188794 +_export({ target: 'Array', proto: true, forced: String(test$1) === String(test$1.reverse()) }, { + reverse: function reverse() { + // eslint-disable-next-line no-self-assign + if (isArray(this)) this.length = this.length; + return nativeReverse.call(this); } }); -// `Array.prototype.fill` method implementation -// https://tc39.github.io/ecma262/#sec-array.prototype.fill -var arrayFill = function fill(value /* , start = 0, end = @length */) { - var O = toObject(this); - var length = toLength(O.length); - var argumentsLength = arguments.length; - var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length); - var end = argumentsLength > 2 ? arguments[2] : undefined; - var endPos = end === undefined ? length : toAbsoluteIndex(end, length); - while (endPos > index) O[index++] = value; - return O; -}; +var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('slice'); +var USES_TO_LENGTH$b = arrayMethodUsesToLength('slice', { ACCESSORS: true, 0: 0, 1: 2 }); -// `Array.prototype.fill` method -// https://tc39.github.io/ecma262/#sec-array.prototype.fill -_export({ target: 'Array', proto: true }, { - fill: arrayFill -}); +var SPECIES$5 = wellKnownSymbol('species'); +var nativeSlice = [].slice; +var max$1 = Math.max; -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -addToUnscopables('fill'); +// `Array.prototype.slice` method +// https://tc39.es/ecma262/#sec-array.prototype.slice +// fallback for not array-like ES3 strings and DOM objects +_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 || !USES_TO_LENGTH$b }, { + slice: function slice(start, end) { + var O = toIndexedObject(this); + var length = toLength(O.length); + var k = toAbsoluteIndex(start, length); + var fin = toAbsoluteIndex(end === undefined ? length : end, length); + // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible + var Constructor, result, n; + if (isArray(O)) { + Constructor = O.constructor; + // cross-realm fallback + if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) { + Constructor = undefined; + } else if (isObject(Constructor)) { + Constructor = Constructor[SPECIES$5]; + if (Constructor === null) Constructor = undefined; + } + if (Constructor === Array || Constructor === undefined) { + return nativeSlice.call(O, k, fin); + } + } + result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0)); + for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]); + result.length = n; + return result; + } +}); -var $filter = arrayIteration.filter; +var $some = arrayIteration.some; -var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter'); -// Edge 14- issue -var USES_TO_LENGTH$1 = arrayMethodUsesToLength('filter'); +var STRICT_METHOD$7 = arrayMethodIsStrict('some'); +var USES_TO_LENGTH$c = arrayMethodUsesToLength('some'); -// `Array.prototype.filter` method -// https://tc39.github.io/ecma262/#sec-array.prototype.filter -// with adding support of @@species -_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH$1 }, { - filter: function filter(callbackfn /* , thisArg */) { - return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); +// `Array.prototype.some` method +// https://tc39.es/ecma262/#sec-array.prototype.some +_export({ target: 'Array', proto: true, forced: !STRICT_METHOD$7 || !USES_TO_LENGTH$c }, { + some: function some(callbackfn /* , thisArg */) { + return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); -var $find = arrayIteration.find; +var test$2 = []; +var nativeSort = test$2.sort; +// IE8- +var FAILS_ON_UNDEFINED = fails(function () { + test$2.sort(undefined); +}); +// V8 bug +var FAILS_ON_NULL = fails(function () { + test$2.sort(null); +}); +// Old WebKit +var STRICT_METHOD$8 = arrayMethodIsStrict('sort'); +var FORCED$3 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$8; -var FIND = 'find'; -var SKIPS_HOLES = true; +// `Array.prototype.sort` method +// https://tc39.es/ecma262/#sec-array.prototype.sort +_export({ target: 'Array', proto: true, forced: FORCED$3 }, { + sort: function sort(comparefn) { + return comparefn === undefined + ? nativeSort.call(toObject(this)) + : nativeSort.call(toObject(this), aFunction$1(comparefn)); + } +}); -var USES_TO_LENGTH$2 = arrayMethodUsesToLength(FIND); +var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('splice'); +var USES_TO_LENGTH$d = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 }); -// Shouldn't skip holes -if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; }); +var max$2 = Math.max; +var min$4 = Math.min; +var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF; +var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; -// `Array.prototype.find` method -// https://tc39.github.io/ecma262/#sec-array.prototype.find -_export({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH$2 }, { - find: function find(callbackfn /* , that = undefined */) { - return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); +// `Array.prototype.splice` method +// https://tc39.es/ecma262/#sec-array.prototype.splice +// with adding support of @@species +_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 || !USES_TO_LENGTH$d }, { + splice: function splice(start, deleteCount /* , ...items */) { + var O = toObject(this); + var len = toLength(O.length); + var actualStart = toAbsoluteIndex(start, len); + var argumentsLength = arguments.length; + var insertCount, actualDeleteCount, A, k, from, to; + if (argumentsLength === 0) { + insertCount = actualDeleteCount = 0; + } else if (argumentsLength === 1) { + insertCount = 0; + actualDeleteCount = len - actualStart; + } else { + insertCount = argumentsLength - 2; + actualDeleteCount = min$4(max$2(toInteger(deleteCount), 0), len - actualStart); + } + if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) { + throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED); + } + A = arraySpeciesCreate(O, actualDeleteCount); + for (k = 0; k < actualDeleteCount; k++) { + from = actualStart + k; + if (from in O) createProperty(A, k, O[from]); + } + A.length = actualDeleteCount; + if (insertCount < actualDeleteCount) { + for (k = actualStart; k < len - actualDeleteCount; k++) { + from = k + actualDeleteCount; + to = k + insertCount; + if (from in O) O[to] = O[from]; + else delete O[to]; + } + for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1]; + } else if (insertCount > actualDeleteCount) { + for (k = len - actualDeleteCount; k > actualStart; k--) { + from = k + actualDeleteCount - 1; + to = k + insertCount - 1; + if (from in O) O[to] = O[from]; + else delete O[to]; + } + } + for (k = 0; k < insertCount; k++) { + O[k + actualStart] = arguments[k + 2]; + } + O.length = len - actualDeleteCount + insertCount; + return A; } }); -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -addToUnscopables(FIND); +// `Array[@@species]` getter +// https://tc39.es/ecma262/#sec-get-array-@@species +setSpecies('Array'); -var $findIndex = arrayIteration.findIndex; +// this method was added to unscopables after implementation +// in popular engines, so it's moved to a separate module +// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables +addToUnscopables('flat'); -var FIND_INDEX = 'findIndex'; -var SKIPS_HOLES$1 = true; +// this method was added to unscopables after implementation +// in popular engines, so it's moved to a separate module -var USES_TO_LENGTH$3 = arrayMethodUsesToLength(FIND_INDEX); -// Shouldn't skip holes -if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES$1 = false; }); +// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables +addToUnscopables('flatMap'); -// `Array.prototype.findIndex` method -// https://tc39.github.io/ecma262/#sec-array.prototype.findindex -_export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 || !USES_TO_LENGTH$3 }, { - findIndex: function findIndex(callbackfn /* , that = undefined */) { - return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } -}); +var ITERATOR$3 = wellKnownSymbol('iterator'); +var BUGGY_SAFARI_ITERATORS = false; -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -addToUnscopables(FIND_INDEX); +var returnThis = function () { return this; }; -// `FlattenIntoArray` abstract operation -// https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray -var flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) { - var targetIndex = start; - var sourceIndex = 0; - var mapFn = mapper ? functionBindContext(mapper, thisArg, 3) : false; - var element; +// `%IteratorPrototype%` object +// https://tc39.es/ecma262/#sec-%iteratorprototype%-object +var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; - while (sourceIndex < sourceLen) { - if (sourceIndex in source) { - element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex]; +if ([].keys) { + arrayIterator = [].keys(); + // Safari 8 has buggy iterators w/o `next` + if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; + else { + PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator)); + if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype; + } +} - if (depth > 0 && isArray(element)) { - targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1; - } else { - if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length'); - target[targetIndex] = element; - } +if (IteratorPrototype == undefined) IteratorPrototype = {}; - targetIndex++; - } - sourceIndex++; - } - return targetIndex; +// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() +if ( !has(IteratorPrototype, ITERATOR$3)) { + createNonEnumerableProperty(IteratorPrototype, ITERATOR$3, returnThis); +} + +var iteratorsCore = { + IteratorPrototype: IteratorPrototype, + BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS }; -var flattenIntoArray_1 = flattenIntoArray; +var IteratorPrototype$1 = iteratorsCore.IteratorPrototype; -// `Array.prototype.flat` method -// https://github.com/tc39/proposal-flatMap -_export({ target: 'Array', proto: true }, { - flat: function flat(/* depthArg = 1 */) { - var depthArg = arguments.length ? arguments[0] : undefined; - var O = toObject(this); - var sourceLen = toLength(O.length); - var A = arraySpeciesCreate(O, 0); - A.length = flattenIntoArray_1(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg)); - return A; - } -}); -// `Array.prototype.flatMap` method -// https://github.com/tc39/proposal-flatMap -_export({ target: 'Array', proto: true }, { - flatMap: function flatMap(callbackfn /* , thisArg */) { - var O = toObject(this); - var sourceLen = toLength(O.length); - var A; - aFunction$1(callbackfn); - A = arraySpeciesCreate(O, 0); - A.length = flattenIntoArray_1(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - return A; - } -}); -var $forEach$1 = arrayIteration.forEach; +var returnThis$1 = function () { return this; }; -var STRICT_METHOD$1 = arrayMethodIsStrict('forEach'); -var USES_TO_LENGTH$4 = arrayMethodUsesToLength('forEach'); - -// `Array.prototype.forEach` method implementation -// https://tc39.github.io/ecma262/#sec-array.prototype.foreach -var arrayForEach = (!STRICT_METHOD$1 || !USES_TO_LENGTH$4) ? function forEach(callbackfn /* , thisArg */) { - return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); -} : [].forEach; +var createIteratorConstructor = function (IteratorConstructor, NAME, next) { + var TO_STRING_TAG = NAME + ' Iterator'; + IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) }); + setToStringTag(IteratorConstructor, TO_STRING_TAG, false); + iterators[TO_STRING_TAG] = returnThis$1; + return IteratorConstructor; +}; -// `Array.prototype.forEach` method -// https://tc39.github.io/ecma262/#sec-array.prototype.foreach -_export({ target: 'Array', proto: true, forced: [].forEach != arrayForEach }, { - forEach: arrayForEach -}); +var IteratorPrototype$2 = iteratorsCore.IteratorPrototype; +var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS; +var ITERATOR$4 = wellKnownSymbol('iterator'); +var KEYS = 'keys'; +var VALUES = 'values'; +var ENTRIES = 'entries'; -var $includes = arrayIncludes.includes; +var returnThis$2 = function () { return this; }; +var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { + createIteratorConstructor(IteratorConstructor, NAME, next); + var getIterationMethod = function (KIND) { + if (KIND === DEFAULT && defaultIterator) return defaultIterator; + if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND]; + switch (KIND) { + case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; + case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; + case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; + } return function () { return new IteratorConstructor(this); }; + }; -var USES_TO_LENGTH$5 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); + var TO_STRING_TAG = NAME + ' Iterator'; + var INCORRECT_VALUES_NAME = false; + var IterablePrototype = Iterable.prototype; + var nativeIterator = IterablePrototype[ITERATOR$4] + || IterablePrototype['@@iterator'] + || DEFAULT && IterablePrototype[DEFAULT]; + var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT); + var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; + var CurrentIteratorPrototype, methods, KEY; -// `Array.prototype.includes` method -// https://tc39.github.io/ecma262/#sec-array.prototype.includes -_export({ target: 'Array', proto: true, forced: !USES_TO_LENGTH$5 }, { - includes: function includes(el /* , fromIndex = 0 */) { - return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); + // fix native + if (anyNativeIterator) { + CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable())); + if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) { + if ( objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) { + if (objectSetPrototypeOf) { + objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2); + } else if (typeof CurrentIteratorPrototype[ITERATOR$4] != 'function') { + createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$4, returnThis$2); + } + } + // Set @@toStringTag to native iterators + setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true); + } } -}); -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -addToUnscopables('includes'); - -var $indexOf = arrayIncludes.indexOf; + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { + INCORRECT_VALUES_NAME = true; + defaultIterator = function values() { return nativeIterator.call(this); }; + } + // define iterator + if ( IterablePrototype[ITERATOR$4] !== defaultIterator) { + createNonEnumerableProperty(IterablePrototype, ITERATOR$4, defaultIterator); + } + iterators[NAME] = defaultIterator; + // export additional methods + if (DEFAULT) { + methods = { + values: getIterationMethod(VALUES), + keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), + entries: getIterationMethod(ENTRIES) + }; + if (FORCED) for (KEY in methods) { + if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { + redefine(IterablePrototype, KEY, methods[KEY]); + } + } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods); + } -var nativeIndexOf = [].indexOf; + return methods; +}; -var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0; -var STRICT_METHOD$2 = arrayMethodIsStrict('indexOf'); -var USES_TO_LENGTH$6 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); +var ARRAY_ITERATOR = 'Array Iterator'; +var setInternalState$2 = internalState.set; +var getInternalState$2 = internalState.getterFor(ARRAY_ITERATOR); -// `Array.prototype.indexOf` method -// https://tc39.github.io/ecma262/#sec-array.prototype.indexof -_export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$2 || !USES_TO_LENGTH$6 }, { - indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { - return NEGATIVE_ZERO - // convert -0 to +0 - ? nativeIndexOf.apply(this, arguments) || 0 - : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined); +// `Array.prototype.entries` method +// https://tc39.es/ecma262/#sec-array.prototype.entries +// `Array.prototype.keys` method +// https://tc39.es/ecma262/#sec-array.prototype.keys +// `Array.prototype.values` method +// https://tc39.es/ecma262/#sec-array.prototype.values +// `Array.prototype[@@iterator]` method +// https://tc39.es/ecma262/#sec-array.prototype-@@iterator +// `CreateArrayIterator` internal method +// https://tc39.es/ecma262/#sec-createarrayiterator +var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) { + setInternalState$2(this, { + type: ARRAY_ITERATOR, + target: toIndexedObject(iterated), // target + index: 0, // next index + kind: kind // kind + }); +// `%ArrayIteratorPrototype%.next` method +// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next +}, function () { + var state = getInternalState$2(this); + var target = state.target; + var kind = state.kind; + var index = state.index++; + if (!target || index >= target.length) { + state.target = undefined; + return { value: undefined, done: true }; } -}); + if (kind == 'keys') return { value: index, done: false }; + if (kind == 'values') return { value: target[index], done: false }; + return { value: [index, target[index]], done: false }; +}, 'values'); -var nativeJoin = [].join; +// argumentsList[@@iterator] is %ArrayProto_values% +// https://tc39.es/ecma262/#sec-createunmappedargumentsobject +// https://tc39.es/ecma262/#sec-createmappedargumentsobject +iterators.Arguments = iterators.Array; -var ES3_STRINGS = indexedObject != Object; -var STRICT_METHOD$3 = arrayMethodIsStrict('join', ','); +// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables +addToUnscopables('keys'); +addToUnscopables('values'); +addToUnscopables('entries'); -// `Array.prototype.join` method -// https://tc39.github.io/ecma262/#sec-array.prototype.join -_export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$3 }, { - join: function join(separator) { - return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator); - } -}); +var slice$1 = [].slice; +var factories = {}; -var min$3 = Math.min; -var nativeLastIndexOf = [].lastIndexOf; -var NEGATIVE_ZERO$1 = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0; -var STRICT_METHOD$4 = arrayMethodIsStrict('lastIndexOf'); -// For preventing possible almost infinite loop in non-standard implementations, test the forward version of the method -var USES_TO_LENGTH$7 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); -var FORCED$3 = NEGATIVE_ZERO$1 || !STRICT_METHOD$4 || !USES_TO_LENGTH$7; +var construct = function (C, argsLength, args) { + if (!(argsLength in factories)) { + for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']'; + // eslint-disable-next-line no-new-func + factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')'); + } return factories[argsLength](C, args); +}; -// `Array.prototype.lastIndexOf` method implementation -// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof -var arrayLastIndexOf = FORCED$3 ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { - // convert -0 to +0 - if (NEGATIVE_ZERO$1) return nativeLastIndexOf.apply(this, arguments) || 0; - var O = toIndexedObject(this); - var length = toLength(O.length); - var index = length - 1; - if (arguments.length > 1) index = min$3(index, toInteger(arguments[1])); - if (index < 0) index = length + index; - for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0; - return -1; -} : nativeLastIndexOf; +// `Function.prototype.bind` method implementation +// https://tc39.es/ecma262/#sec-function.prototype.bind +var functionBind = Function.bind || function bind(that /* , ...args */) { + var fn = aFunction$1(this); + var partArgs = slice$1.call(arguments, 1); + var boundFunction = function bound(/* args... */) { + var args = partArgs.concat(slice$1.call(arguments)); + return this instanceof boundFunction ? construct(fn, args.length, args) : fn.apply(that, args); + }; + if (isObject(fn.prototype)) boundFunction.prototype = fn.prototype; + return boundFunction; +}; -// `Array.prototype.lastIndexOf` method -// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof -_export({ target: 'Array', proto: true, forced: arrayLastIndexOf !== [].lastIndexOf }, { - lastIndexOf: arrayLastIndexOf +// `Function.prototype.bind` method +// https://tc39.es/ecma262/#sec-function.prototype.bind +_export({ target: 'Function', proto: true }, { + bind: functionBind }); -var $map = arrayIteration.map; - - +var HAS_INSTANCE = wellKnownSymbol('hasInstance'); +var FunctionPrototype$1 = Function.prototype; -var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('map'); -// FF49- issue -var USES_TO_LENGTH$8 = arrayMethodUsesToLength('map'); +// `Function.prototype[@@hasInstance]` method +// https://tc39.es/ecma262/#sec-function.prototype-@@hasinstance +if (!(HAS_INSTANCE in FunctionPrototype$1)) { + objectDefineProperty.f(FunctionPrototype$1, HAS_INSTANCE, { value: function (O) { + if (typeof this != 'function' || !isObject(O)) return false; + if (!isObject(this.prototype)) return O instanceof this; + // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: + while (O = objectGetPrototypeOf(O)) if (this.prototype === O) return true; + return false; + } }); +} -// `Array.prototype.map` method -// https://tc39.github.io/ecma262/#sec-array.prototype.map -// with adding support of @@species -_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 || !USES_TO_LENGTH$8 }, { - map: function map(callbackfn /* , thisArg */) { - return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } +// `globalThis` object +// https://tc39.es/ecma262/#sec-globalthis +_export({ global: true }, { + globalThis: global_1 }); -// `Array.prototype.{ reduce, reduceRight }` methods implementation -var createMethod$3 = function (IS_RIGHT) { - return function (that, callbackfn, argumentsLength, memo) { - aFunction$1(callbackfn); - var O = toObject(that); - var self = indexedObject(O); - var length = toLength(O.length); - var index = IS_RIGHT ? length - 1 : 0; - var i = IS_RIGHT ? -1 : 1; - if (argumentsLength < 2) while (true) { - if (index in self) { - memo = self[index]; - index += i; - break; - } - index += i; - if (IS_RIGHT ? index < 0 : length <= index) { - throw TypeError('Reduce of empty array with no initial value'); - } - } - for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) { - memo = callbackfn(memo, self[index], index, O); - } - return memo; - }; -}; - -var arrayReduce = { - // `Array.prototype.reduce` method - // https://tc39.github.io/ecma262/#sec-array.prototype.reduce - left: createMethod$3(false), - // `Array.prototype.reduceRight` method - // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright - right: createMethod$3(true) -}; +var nativeAssign = Object.assign; +var defineProperty$5 = Object.defineProperty; -var $reduce = arrayReduce.left; +// `Object.assign` method +// https://tc39.es/ecma262/#sec-object.assign +var objectAssign = !nativeAssign || fails(function () { + // should have correct order of operations (Edge bug) + if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$5({}, 'a', { + enumerable: true, + get: function () { + defineProperty$5(this, 'b', { + value: 3, + enumerable: false + }); + } + }), { b: 2 })).b !== 1) return true; + // should work with symbols and should have deterministic property order (V8 bug) + var A = {}; + var B = {}; + // eslint-disable-next-line no-undef + var symbol = Symbol(); + var alphabet = 'abcdefghijklmnopqrst'; + A[symbol] = 7; + alphabet.split('').forEach(function (chr) { B[chr] = chr; }); + return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet; +}) ? function assign(target, source) { // eslint-disable-line no-unused-vars + var T = toObject(target); + var argumentsLength = arguments.length; + var index = 1; + var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; + var propertyIsEnumerable = objectPropertyIsEnumerable.f; + while (argumentsLength > index) { + var S = indexedObject(arguments[index++]); + var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S); + var length = keys.length; + var j = 0; + var key; + while (length > j) { + key = keys[j++]; + if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key]; + } + } return T; +} : nativeAssign; +// `Object.assign` method +// https://tc39.es/ecma262/#sec-object.assign +_export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, { + assign: objectAssign +}); +// `Object.create` method +// https://tc39.es/ecma262/#sec-object.create +_export({ target: 'Object', stat: true, sham: !descriptors }, { + create: objectCreate +}); -var STRICT_METHOD$5 = arrayMethodIsStrict('reduce'); -var USES_TO_LENGTH$9 = arrayMethodUsesToLength('reduce', { 1: 0 }); +// `Object.defineProperty` method +// https://tc39.es/ecma262/#sec-object.defineproperty +_export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, { + defineProperty: objectDefineProperty.f +}); -// `Array.prototype.reduce` method -// https://tc39.github.io/ecma262/#sec-array.prototype.reduce -_export({ target: 'Array', proto: true, forced: !STRICT_METHOD$5 || !USES_TO_LENGTH$9 }, { - reduce: function reduce(callbackfn /* , initialValue */) { - return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); - } +// `Object.defineProperties` method +// https://tc39.es/ecma262/#sec-object.defineproperties +_export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, { + defineProperties: objectDefineProperties }); -var $reduceRight = arrayReduce.right; +var propertyIsEnumerable = objectPropertyIsEnumerable.f; +// `Object.{ entries, values }` methods implementation +var createMethod$3 = function (TO_ENTRIES) { + return function (it) { + var O = toIndexedObject(it); + var keys = objectKeys(O); + var length = keys.length; + var i = 0; + var result = []; + var key; + while (length > i) { + key = keys[i++]; + if (!descriptors || propertyIsEnumerable.call(O, key)) { + result.push(TO_ENTRIES ? [key, O[key]] : O[key]); + } + } + return result; + }; +}; +var objectToArray = { + // `Object.entries` method + // https://tc39.es/ecma262/#sec-object.entries + entries: createMethod$3(true), + // `Object.values` method + // https://tc39.es/ecma262/#sec-object.values + values: createMethod$3(false) +}; -var STRICT_METHOD$6 = arrayMethodIsStrict('reduceRight'); -// For preventing possible almost infinite loop in non-standard implementations, test the forward version of the method -var USES_TO_LENGTH$a = arrayMethodUsesToLength('reduce', { 1: 0 }); +var $entries = objectToArray.entries; -// `Array.prototype.reduceRight` method -// https://tc39.github.io/ecma262/#sec-array.prototype.reduceright -_export({ target: 'Array', proto: true, forced: !STRICT_METHOD$6 || !USES_TO_LENGTH$a }, { - reduceRight: function reduceRight(callbackfn /* , initialValue */) { - return $reduceRight(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); +// `Object.entries` method +// https://tc39.es/ecma262/#sec-object.entries +_export({ target: 'Object', stat: true }, { + entries: function entries(O) { + return $entries(O); } }); -var nativeReverse = [].reverse; -var test$1 = [1, 2]; - -// `Array.prototype.reverse` method -// https://tc39.github.io/ecma262/#sec-array.prototype.reverse -// fix for Safari 12.0 bug -// https://bugs.webkit.org/show_bug.cgi?id=188794 -_export({ target: 'Array', proto: true, forced: String(test$1) === String(test$1.reverse()) }, { - reverse: function reverse() { - // eslint-disable-next-line no-self-assign - if (isArray(this)) this.length = this.length; - return nativeReverse.call(this); - } +var freezing = !fails(function () { + return Object.isExtensible(Object.preventExtensions({})); }); -var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('slice'); -var USES_TO_LENGTH$b = arrayMethodUsesToLength('slice', { ACCESSORS: true, 0: 0, 1: 2 }); +var internalMetadata = createCommonjsModule(function (module) { +var defineProperty = objectDefineProperty.f; -var SPECIES$5 = wellKnownSymbol('species'); -var nativeSlice = [].slice; -var max$1 = Math.max; -// `Array.prototype.slice` method -// https://tc39.github.io/ecma262/#sec-array.prototype.slice -// fallback for not array-like ES3 strings and DOM objects -_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 || !USES_TO_LENGTH$b }, { - slice: function slice(start, end) { - var O = toIndexedObject(this); - var length = toLength(O.length); - var k = toAbsoluteIndex(start, length); - var fin = toAbsoluteIndex(end === undefined ? length : end, length); - // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible - var Constructor, result, n; - if (isArray(O)) { - Constructor = O.constructor; - // cross-realm fallback - if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) { - Constructor = undefined; - } else if (isObject(Constructor)) { - Constructor = Constructor[SPECIES$5]; - if (Constructor === null) Constructor = undefined; - } - if (Constructor === Array || Constructor === undefined) { - return nativeSlice.call(O, k, fin); - } - } - result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0)); - for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]); - result.length = n; - return result; - } -}); -var $some = arrayIteration.some; +var METADATA = uid('meta'); +var id = 0; +var isExtensible = Object.isExtensible || function () { + return true; +}; +var setMetadata = function (it) { + defineProperty(it, METADATA, { value: { + objectID: 'O' + ++id, // object ID + weakData: {} // weak collections IDs + } }); +}; -var STRICT_METHOD$7 = arrayMethodIsStrict('some'); -var USES_TO_LENGTH$c = arrayMethodUsesToLength('some'); +var fastKey = function (it, create) { + // return a primitive with prefix + if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!has(it, METADATA)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return 'F'; + // not necessary to add metadata + if (!create) return 'E'; + // add missing metadata + setMetadata(it); + // return object ID + } return it[METADATA].objectID; +}; -// `Array.prototype.some` method -// https://tc39.github.io/ecma262/#sec-array.prototype.some -_export({ target: 'Array', proto: true, forced: !STRICT_METHOD$7 || !USES_TO_LENGTH$c }, { - some: function some(callbackfn /* , thisArg */) { - return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } -}); +var getWeakData = function (it, create) { + if (!has(it, METADATA)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return true; + // not necessary to add metadata + if (!create) return false; + // add missing metadata + setMetadata(it); + // return the store of weak collections IDs + } return it[METADATA].weakData; +}; -var test$2 = []; -var nativeSort = test$2.sort; +// add metadata on freeze-family methods calling +var onFreeze = function (it) { + if (freezing && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it); + return it; +}; -// IE8- -var FAILS_ON_UNDEFINED = fails(function () { - test$2.sort(undefined); -}); -// V8 bug -var FAILS_ON_NULL = fails(function () { - test$2.sort(null); +var meta = module.exports = { + REQUIRED: false, + fastKey: fastKey, + getWeakData: getWeakData, + onFreeze: onFreeze +}; + +hiddenKeys[METADATA] = true; }); -// Old WebKit -var STRICT_METHOD$8 = arrayMethodIsStrict('sort'); -var FORCED$4 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$8; +var onFreeze = internalMetadata.onFreeze; -// `Array.prototype.sort` method -// https://tc39.github.io/ecma262/#sec-array.prototype.sort -_export({ target: 'Array', proto: true, forced: FORCED$4 }, { - sort: function sort(comparefn) { - return comparefn === undefined - ? nativeSort.call(toObject(this)) - : nativeSort.call(toObject(this), aFunction$1(comparefn)); +var nativeFreeze = Object.freeze; +var FAILS_ON_PRIMITIVES = fails(function () { nativeFreeze(1); }); + +// `Object.freeze` method +// https://tc39.es/ecma262/#sec-object.freeze +_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !freezing }, { + freeze: function freeze(it) { + return nativeFreeze && isObject(it) ? nativeFreeze(onFreeze(it)) : it; } }); -var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('splice'); -var USES_TO_LENGTH$d = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 }); - -var max$2 = Math.max; -var min$4 = Math.min; -var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF; -var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; +// `Object.fromEntries` method +// https://github.com/tc39/proposal-object-from-entries +_export({ target: 'Object', stat: true }, { + fromEntries: function fromEntries(iterable) { + var obj = {}; + iterate(iterable, function (k, v) { + createProperty(obj, k, v); + }, { AS_ENTRIES: true }); + return obj; + } +}); -// `Array.prototype.splice` method -// https://tc39.github.io/ecma262/#sec-array.prototype.splice -// with adding support of @@species -_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 || !USES_TO_LENGTH$d }, { - splice: function splice(start, deleteCount /* , ...items */) { - var O = toObject(this); - var len = toLength(O.length); - var actualStart = toAbsoluteIndex(start, len); - var argumentsLength = arguments.length; - var insertCount, actualDeleteCount, A, k, from, to; - if (argumentsLength === 0) { - insertCount = actualDeleteCount = 0; - } else if (argumentsLength === 1) { - insertCount = 0; - actualDeleteCount = len - actualStart; - } else { - insertCount = argumentsLength - 2; - actualDeleteCount = min$4(max$2(toInteger(deleteCount), 0), len - actualStart); - } - if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) { - throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED); - } - A = arraySpeciesCreate(O, actualDeleteCount); - for (k = 0; k < actualDeleteCount; k++) { - from = actualStart + k; - if (from in O) createProperty(A, k, O[from]); - } - A.length = actualDeleteCount; - if (insertCount < actualDeleteCount) { - for (k = actualStart; k < len - actualDeleteCount; k++) { - from = k + actualDeleteCount; - to = k + insertCount; - if (from in O) O[to] = O[from]; - else delete O[to]; - } - for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1]; - } else if (insertCount > actualDeleteCount) { - for (k = len - actualDeleteCount; k > actualStart; k--) { - from = k + actualDeleteCount - 1; - to = k + insertCount - 1; - if (from in O) O[to] = O[from]; - else delete O[to]; - } - } - for (k = 0; k < insertCount; k++) { - O[k + actualStart] = arguments[k + 2]; +var nativeGetOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; + + +var FAILS_ON_PRIMITIVES$1 = fails(function () { nativeGetOwnPropertyDescriptor$2(1); }); +var FORCED$4 = !descriptors || FAILS_ON_PRIMITIVES$1; + +// `Object.getOwnPropertyDescriptor` method +// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor +_export({ target: 'Object', stat: true, forced: FORCED$4, sham: !descriptors }, { + getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { + return nativeGetOwnPropertyDescriptor$2(toIndexedObject(it), key); + } +}); + +// `Object.getOwnPropertyDescriptors` method +// https://tc39.es/ecma262/#sec-object.getownpropertydescriptors +_export({ target: 'Object', stat: true, sham: !descriptors }, { + getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { + var O = toIndexedObject(object); + var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; + var keys = ownKeys(O); + var result = {}; + var index = 0; + var key, descriptor; + while (keys.length > index) { + descriptor = getOwnPropertyDescriptor(O, key = keys[index++]); + if (descriptor !== undefined) createProperty(result, key, descriptor); } - O.length = len - actualDeleteCount + insertCount; - return A; + return result; } }); -// `Array[@@species]` getter -// https://tc39.github.io/ecma262/#sec-get-array-@@species -setSpecies('Array'); +var nativeGetOwnPropertyNames$2 = objectGetOwnPropertyNamesExternal.f; -// this method was added to unscopables after implementation -// in popular engines, so it's moved to a separate module +var FAILS_ON_PRIMITIVES$2 = fails(function () { return !Object.getOwnPropertyNames(1); }); +// `Object.getOwnPropertyNames` method +// https://tc39.es/ecma262/#sec-object.getownpropertynames +_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$2 }, { + getOwnPropertyNames: nativeGetOwnPropertyNames$2 +}); -addToUnscopables('flat'); +var FAILS_ON_PRIMITIVES$3 = fails(function () { objectGetPrototypeOf(1); }); -// this method was added to unscopables after implementation -// in popular engines, so it's moved to a separate module +// `Object.getPrototypeOf` method +// https://tc39.es/ecma262/#sec-object.getprototypeof +_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$3, sham: !correctPrototypeGetter }, { + getPrototypeOf: function getPrototypeOf(it) { + return objectGetPrototypeOf(toObject(it)); + } +}); +// `SameValue` abstract operation +// https://tc39.es/ecma262/#sec-samevalue +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; +}; -addToUnscopables('flatMap'); +// `Object.is` method +// https://tc39.es/ecma262/#sec-object.is +_export({ target: 'Object', stat: true }, { + is: sameValue +}); -var ITERATOR$3 = wellKnownSymbol('iterator'); -var BUGGY_SAFARI_ITERATORS = false; +var nativeIsExtensible = Object.isExtensible; +var FAILS_ON_PRIMITIVES$4 = fails(function () { nativeIsExtensible(1); }); -var returnThis = function () { return this; }; +// `Object.isExtensible` method +// https://tc39.es/ecma262/#sec-object.isextensible +_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$4 }, { + isExtensible: function isExtensible(it) { + return isObject(it) ? nativeIsExtensible ? nativeIsExtensible(it) : true : false; + } +}); -// `%IteratorPrototype%` object -// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object -var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; +var nativeIsFrozen = Object.isFrozen; +var FAILS_ON_PRIMITIVES$5 = fails(function () { nativeIsFrozen(1); }); -if ([].keys) { - arrayIterator = [].keys(); - // Safari 8 has buggy iterators w/o `next` - if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; - else { - PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator)); - if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype; +// `Object.isFrozen` method +// https://tc39.es/ecma262/#sec-object.isfrozen +_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$5 }, { + isFrozen: function isFrozen(it) { + return isObject(it) ? nativeIsFrozen ? nativeIsFrozen(it) : false : true; } -} +}); -if (IteratorPrototype == undefined) IteratorPrototype = {}; +var nativeIsSealed = Object.isSealed; +var FAILS_ON_PRIMITIVES$6 = fails(function () { nativeIsSealed(1); }); -// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() -if ( !has(IteratorPrototype, ITERATOR$3)) { - createNonEnumerableProperty(IteratorPrototype, ITERATOR$3, returnThis); -} +// `Object.isSealed` method +// https://tc39.es/ecma262/#sec-object.issealed +_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$6 }, { + isSealed: function isSealed(it) { + return isObject(it) ? nativeIsSealed ? nativeIsSealed(it) : false : true; + } +}); -var iteratorsCore = { - IteratorPrototype: IteratorPrototype, - BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS -}; +var FAILS_ON_PRIMITIVES$7 = fails(function () { objectKeys(1); }); -var IteratorPrototype$1 = iteratorsCore.IteratorPrototype; +// `Object.keys` method +// https://tc39.es/ecma262/#sec-object.keys +_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$7 }, { + keys: function keys(it) { + return objectKeys(toObject(it)); + } +}); +var onFreeze$1 = internalMetadata.onFreeze; +var nativePreventExtensions = Object.preventExtensions; +var FAILS_ON_PRIMITIVES$8 = fails(function () { nativePreventExtensions(1); }); -var returnThis$1 = function () { return this; }; +// `Object.preventExtensions` method +// https://tc39.es/ecma262/#sec-object.preventextensions +_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$8, sham: !freezing }, { + preventExtensions: function preventExtensions(it) { + return nativePreventExtensions && isObject(it) ? nativePreventExtensions(onFreeze$1(it)) : it; + } +}); -var createIteratorConstructor = function (IteratorConstructor, NAME, next) { - var TO_STRING_TAG = NAME + ' Iterator'; - IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) }); - setToStringTag(IteratorConstructor, TO_STRING_TAG, false); - iterators[TO_STRING_TAG] = returnThis$1; - return IteratorConstructor; -}; +var onFreeze$2 = internalMetadata.onFreeze; -var IteratorPrototype$2 = iteratorsCore.IteratorPrototype; -var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS; -var ITERATOR$4 = wellKnownSymbol('iterator'); -var KEYS = 'keys'; -var VALUES = 'values'; -var ENTRIES = 'entries'; -var returnThis$2 = function () { return this; }; -var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { - createIteratorConstructor(IteratorConstructor, NAME, next); +var nativeSeal = Object.seal; +var FAILS_ON_PRIMITIVES$9 = fails(function () { nativeSeal(1); }); - var getIterationMethod = function (KIND) { - if (KIND === DEFAULT && defaultIterator) return defaultIterator; - if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND]; - switch (KIND) { - case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; - case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; - case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; - } return function () { return new IteratorConstructor(this); }; - }; +// `Object.seal` method +// https://tc39.es/ecma262/#sec-object.seal +_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$9, sham: !freezing }, { + seal: function seal(it) { + return nativeSeal && isObject(it) ? nativeSeal(onFreeze$2(it)) : it; + } +}); - var TO_STRING_TAG = NAME + ' Iterator'; - var INCORRECT_VALUES_NAME = false; - var IterablePrototype = Iterable.prototype; - var nativeIterator = IterablePrototype[ITERATOR$4] - || IterablePrototype['@@iterator'] - || DEFAULT && IterablePrototype[DEFAULT]; - var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT); - var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; - var CurrentIteratorPrototype, methods, KEY; +// `Object.setPrototypeOf` method +// https://tc39.es/ecma262/#sec-object.setprototypeof +_export({ target: 'Object', stat: true }, { + setPrototypeOf: objectSetPrototypeOf +}); - // fix native - if (anyNativeIterator) { - CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable())); - if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) { - if ( objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) { - if (objectSetPrototypeOf) { - objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2); - } else if (typeof CurrentIteratorPrototype[ITERATOR$4] != 'function') { - createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$4, returnThis$2); - } - } - // Set @@toStringTag to native iterators - setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true); - } - } +var $values = objectToArray.values; - // fix Array#{values, @@iterator}.name in V8 / FF - if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { - INCORRECT_VALUES_NAME = true; - defaultIterator = function values() { return nativeIterator.call(this); }; +// `Object.values` method +// https://tc39.es/ecma262/#sec-object.values +_export({ target: 'Object', stat: true }, { + values: function values(O) { + return $values(O); } +}); - // define iterator - if ( IterablePrototype[ITERATOR$4] !== defaultIterator) { - createNonEnumerableProperty(IterablePrototype, ITERATOR$4, defaultIterator); - } - iterators[NAME] = defaultIterator; +// Forced replacement object prototype accessors methods +var objectPrototypeAccessorsForced = !fails(function () { + var key = Math.random(); + // In FF throws only define methods + // eslint-disable-next-line no-undef, no-useless-call + __defineSetter__.call(null, key, function () { /* empty */ }); + delete global_1[key]; +}); - // export additional methods - if (DEFAULT) { - methods = { - values: getIterationMethod(VALUES), - keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), - entries: getIterationMethod(ENTRIES) - }; - if (FORCED) for (KEY in methods) { - if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { - redefine(IterablePrototype, KEY, methods[KEY]); - } - } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods); - } +// `Object.prototype.__defineGetter__` method +// https://tc39.es/ecma262/#sec-object.prototype.__defineGetter__ +if (descriptors) { + _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { + __defineGetter__: function __defineGetter__(P, getter) { + objectDefineProperty.f(toObject(this), P, { get: aFunction$1(getter), enumerable: true, configurable: true }); + } + }); +} - return methods; -}; +// `Object.prototype.__defineSetter__` method +// https://tc39.es/ecma262/#sec-object.prototype.__defineSetter__ +if (descriptors) { + _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { + __defineSetter__: function __defineSetter__(P, setter) { + objectDefineProperty.f(toObject(this), P, { set: aFunction$1(setter), enumerable: true, configurable: true }); + } + }); +} -var ARRAY_ITERATOR = 'Array Iterator'; -var setInternalState$2 = internalState.set; -var getInternalState$2 = internalState.getterFor(ARRAY_ITERATOR); +var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f; -// `Array.prototype.entries` method -// https://tc39.github.io/ecma262/#sec-array.prototype.entries -// `Array.prototype.keys` method -// https://tc39.github.io/ecma262/#sec-array.prototype.keys -// `Array.prototype.values` method -// https://tc39.github.io/ecma262/#sec-array.prototype.values -// `Array.prototype[@@iterator]` method -// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator -// `CreateArrayIterator` internal method -// https://tc39.github.io/ecma262/#sec-createarrayiterator -var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) { - setInternalState$2(this, { - type: ARRAY_ITERATOR, - target: toIndexedObject(iterated), // target - index: 0, // next index - kind: kind // kind +// `Object.prototype.__lookupGetter__` method +// https://tc39.es/ecma262/#sec-object.prototype.__lookupGetter__ +if (descriptors) { + _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { + __lookupGetter__: function __lookupGetter__(P) { + var O = toObject(this); + var key = toPrimitive(P, true); + var desc; + do { + if (desc = getOwnPropertyDescriptor$3(O, key)) return desc.get; + } while (O = objectGetPrototypeOf(O)); + } }); -// `%ArrayIteratorPrototype%.next` method -// https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next -}, function () { - var state = getInternalState$2(this); - var target = state.target; - var kind = state.kind; - var index = state.index++; - if (!target || index >= target.length) { - state.target = undefined; - return { value: undefined, done: true }; - } - if (kind == 'keys') return { value: index, done: false }; - if (kind == 'values') return { value: target[index], done: false }; - return { value: [index, target[index]], done: false }; -}, 'values'); +} -// argumentsList[@@iterator] is %ArrayProto_values% -// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject -// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject -iterators.Arguments = iterators.Array; +var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f; -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -addToUnscopables('keys'); -addToUnscopables('values'); -addToUnscopables('entries'); +// `Object.prototype.__lookupSetter__` method +// https://tc39.es/ecma262/#sec-object.prototype.__lookupSetter__ +if (descriptors) { + _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { + __lookupSetter__: function __lookupSetter__(P) { + var O = toObject(this); + var key = toPrimitive(P, true); + var desc; + do { + if (desc = getOwnPropertyDescriptor$4(O, key)) return desc.set; + } while (O = objectGetPrototypeOf(O)); + } + }); +} var fromCharCode = String.fromCharCode; var nativeFromCodePoint = String.fromCodePoint; @@ -3837,7 +3921,7 @@ var nativeFromCodePoint = String.fromCodePoint; var INCORRECT_LENGTH = !!nativeFromCodePoint && nativeFromCodePoint.length != 1; // `String.fromCodePoint` method -// https://tc39.github.io/ecma262/#sec-string.fromcodepoint +// https://tc39.es/ecma262/#sec-string.fromcodepoint _export({ target: 'String', stat: true, forced: INCORRECT_LENGTH }, { fromCodePoint: function fromCodePoint(x) { // eslint-disable-line no-unused-vars var elements = []; @@ -3856,7 +3940,7 @@ _export({ target: 'String', stat: true, forced: INCORRECT_LENGTH }, { }); // `String.raw` method -// https://tc39.github.io/ecma262/#sec-string.raw +// https://tc39.es/ecma262/#sec-string.raw _export({ target: 'String', stat: true }, { raw: function raw(template) { var rawTemplate = toIndexedObject(template.raw); @@ -3889,7 +3973,7 @@ var createMethod$4 = function (CONVERT_TO_STRING) { var stringMultibyte = { // `String.prototype.codePointAt` method - // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat + // https://tc39.es/ecma262/#sec-string.prototype.codepointat codeAt: createMethod$4(false), // `String.prototype.at` method // https://github.com/mathiasbynens/String.prototype.at @@ -3899,7 +3983,7 @@ var stringMultibyte = { var codeAt = stringMultibyte.codeAt; // `String.prototype.codePointAt` method -// https://tc39.github.io/ecma262/#sec-string.prototype.codepointat +// https://tc39.es/ecma262/#sec-string.prototype.codepointat _export({ target: 'String', proto: true }, { codePointAt: function codePointAt(pos) { return codeAt(this, pos); @@ -3909,7 +3993,7 @@ _export({ target: 'String', proto: true }, { var MATCH = wellKnownSymbol('match'); // `IsRegExp` abstract operation -// https://tc39.github.io/ecma262/#sec-isregexp +// https://tc39.es/ecma262/#sec-isregexp var isRegexp = function (it) { var isRegExp; return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp'); @@ -3927,11 +4011,11 @@ var correctIsRegexpLogic = function (METHOD_NAME) { var regexp = /./; try { '/./'[METHOD_NAME](regexp); - } catch (e) { + } catch (error1) { try { regexp[MATCH$1] = false; return '/./'[METHOD_NAME](regexp); - } catch (f) { /* empty */ } + } catch (error2) { /* empty */ } } return false; }; @@ -3953,7 +4037,7 @@ var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () { }(); // `String.prototype.endsWith` method -// https://tc39.github.io/ecma262/#sec-string.prototype.endswith +// https://tc39.es/ecma262/#sec-string.prototype.endswith _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, { endsWith: function endsWith(searchString /* , endPosition = @length */) { var that = String(requireObjectCoercible(this)); @@ -3969,7 +4053,7 @@ _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_I }); // `String.prototype.includes` method -// https://tc39.github.io/ecma262/#sec-string.prototype.includes +// https://tc39.es/ecma262/#sec-string.prototype.includes _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, { includes: function includes(searchString /* , position = 0 */) { return !!~String(requireObjectCoercible(this)) @@ -3978,7 +4062,7 @@ _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes }); // `RegExp.prototype.flags` getter implementation -// https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags +// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags var regexpFlags = function () { var that = anObject(this); var result = ''; @@ -4100,6 +4184,8 @@ if (PATCH) { var regexpExec = patchedExec; +// `RegExp.prototype.exec` method +// https://tc39.es/ecma262/#sec-regexp.prototype.exec _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, { exec: regexpExec }); @@ -4232,13 +4318,13 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) { var charAt = stringMultibyte.charAt; // `AdvanceStringIndex` abstract operation -// https://tc39.github.io/ecma262/#sec-advancestringindex +// https://tc39.es/ecma262/#sec-advancestringindex var advanceStringIndex = function (S, index, unicode) { return index + (unicode ? charAt(S, index).length : 1); }; // `RegExpExec` abstract operation -// https://tc39.github.io/ecma262/#sec-regexpexec +// https://tc39.es/ecma262/#sec-regexpexec var regexpExecAbstract = function (R, S) { var exec = R.exec; if (typeof exec === 'function') { @@ -4260,14 +4346,14 @@ var regexpExecAbstract = function (R, S) { fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) { return [ // `String.prototype.match` method - // https://tc39.github.io/ecma262/#sec-string.prototype.match + // https://tc39.es/ecma262/#sec-string.prototype.match function match(regexp) { var O = requireObjectCoercible(this); var matcher = regexp == undefined ? undefined : regexp[MATCH]; return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); }, // `RegExp.prototype[@@match]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match + // https://tc39.es/ecma262/#sec-regexp.prototype-@@match function (regexp) { var res = maybeCallNative(nativeMatch, regexp, this); if (res.done) return res.value; @@ -4359,7 +4445,7 @@ var $matchAll = function (string) { }; // `String.prototype.matchAll` method -// https://github.com/tc39/proposal-string-matchall +// https://tc39.es/ecma262/#sec-string.prototype.matchall _export({ target: 'String', proto: true, forced: WORKS_WITH_NON_GLOBAL_REGEX }, { matchAll: function matchAll(regexp) { var O = requireObjectCoercible(this); @@ -4386,7 +4472,7 @@ _export({ target: 'String', proto: true, forced: WORKS_WITH_NON_GLOBAL_REGEX }, MATCH_ALL in RegExpPrototype || createNonEnumerableProperty(RegExpPrototype, MATCH_ALL, $matchAll); // `String.prototype.repeat` method implementation -// https://tc39.github.io/ecma262/#sec-string.prototype.repeat +// https://tc39.es/ecma262/#sec-string.prototype.repeat var stringRepeat = ''.repeat || function repeat(count) { var str = String(requireObjectCoercible(this)); var result = ''; @@ -4421,10 +4507,10 @@ var createMethod$5 = function (IS_END) { var stringPad = { // `String.prototype.padStart` method - // https://tc39.github.io/ecma262/#sec-string.prototype.padstart + // https://tc39.es/ecma262/#sec-string.prototype.padstart start: createMethod$5(false), // `String.prototype.padEnd` method - // https://tc39.github.io/ecma262/#sec-string.prototype.padend + // https://tc39.es/ecma262/#sec-string.prototype.padend end: createMethod$5(true) }; @@ -4438,7 +4524,7 @@ var $padEnd = stringPad.end; // `String.prototype.padEnd` method -// https://tc39.github.io/ecma262/#sec-string.prototype.padend +// https://tc39.es/ecma262/#sec-string.prototype.padend _export({ target: 'String', proto: true, forced: stringPadWebkitBug }, { padEnd: function padEnd(maxLength /* , fillString = ' ' */) { return $padEnd(this, maxLength, arguments.length > 1 ? arguments[1] : undefined); @@ -4449,7 +4535,7 @@ var $padStart = stringPad.start; // `String.prototype.padStart` method -// https://tc39.github.io/ecma262/#sec-string.prototype.padstart +// https://tc39.es/ecma262/#sec-string.prototype.padstart _export({ target: 'String', proto: true, forced: stringPadWebkitBug }, { padStart: function padStart(maxLength /* , fillString = ' ' */) { return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined); @@ -4457,17 +4543,53 @@ _export({ target: 'String', proto: true, forced: stringPadWebkitBug }, { }); // `String.prototype.repeat` method -// https://tc39.github.io/ecma262/#sec-string.prototype.repeat +// https://tc39.es/ecma262/#sec-string.prototype.repeat _export({ target: 'String', proto: true }, { repeat: stringRepeat }); -var max$3 = Math.max; -var min$6 = Math.min; var floor$1 = Math.floor; +var replace = ''.replace; var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g; var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g; +// https://tc39.es/ecma262/#sec-getsubstitution +var getSubstitution = function (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 max$3 = Math.max; +var min$6 = Math.min; + var maybeToString = function (it) { return it === undefined ? it : String(it); }; @@ -4480,7 +4602,7 @@ fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, ma return [ // `String.prototype.replace` method - // https://tc39.github.io/ecma262/#sec-string.prototype.replace + // https://tc39.es/ecma262/#sec-string.prototype.replace function replace(searchValue, replaceValue) { var O = requireObjectCoercible(this); var replacer = searchValue == undefined ? undefined : searchValue[REPLACE]; @@ -4489,7 +4611,7 @@ fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, ma : nativeReplace.call(String(O), searchValue, replaceValue); }, // `RegExp.prototype[@@replace]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace + // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace function (regexp, replaceValue) { if ( (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) || @@ -4552,54 +4674,20 @@ fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, ma return accumulatedResult + S.slice(nextSourcePosition); } ]; - - // https://tc39.github.io/ecma262/#sec-getsubstitution - function getSubstitution(matched, str, position, captures, namedCaptures, replacement) { - var tailPos = position + matched.length; - var m = captures.length; - var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; - if (namedCaptures !== undefined) { - namedCaptures = toObject(namedCaptures); - symbols = SUBSTITUTION_SYMBOLS; - } - return nativeReplace.call(replacement, symbols, function (match, ch) { - var capture; - switch (ch.charAt(0)) { - case '$': return '$'; - case '&': return matched; - case '`': return str.slice(0, position); - case "'": return str.slice(tailPos); - case '<': - capture = namedCaptures[ch.slice(1, -1)]; - break; - default: // \d\d? - var n = +ch; - if (n === 0) return match; - if (n > m) { - var f = floor$1(n / 10); - if (f === 0) return match; - if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1); - return match; - } - capture = captures[n - 1]; - } - return capture === undefined ? '' : capture; - }); - } }); // @@search logic fixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) { return [ // `String.prototype.search` method - // https://tc39.github.io/ecma262/#sec-string.prototype.search + // https://tc39.es/ecma262/#sec-string.prototype.search function search(regexp) { var O = requireObjectCoercible(this); var searcher = regexp == undefined ? undefined : regexp[SEARCH]; return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); }, // `RegExp.prototype[@@search]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search + // https://tc39.es/ecma262/#sec-regexp.prototype-@@search function (regexp) { var res = maybeCallNative(nativeSearch, regexp, this); if (res.done) return res.value; @@ -4678,7 +4766,7 @@ fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCal return [ // `String.prototype.split` method - // https://tc39.github.io/ecma262/#sec-string.prototype.split + // https://tc39.es/ecma262/#sec-string.prototype.split function split(separator, limit) { var O = requireObjectCoercible(this); var splitter = separator == undefined ? undefined : separator[SPLIT]; @@ -4687,7 +4775,7 @@ fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCal : internalSplit.call(String(O), separator, limit); }, // `RegExp.prototype[@@split]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split + // https://tc39.es/ecma262/#sec-regexp.prototype-@@split // // NOTE: This cannot be properly polyfilled in engines that don't support // the 'y' flag. @@ -4757,7 +4845,7 @@ var MDN_POLYFILL_BUG$1 = !CORRECT_IS_REGEXP_LOGIC$1 && !!function () { }(); // `String.prototype.startsWith` method -// https://tc39.github.io/ecma262/#sec-string.prototype.startswith +// https://tc39.es/ecma262/#sec-string.prototype.startswith _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG$1 && !CORRECT_IS_REGEXP_LOGIC$1 }, { startsWith: function startsWith(searchString /* , position = 0 */) { var that = String(requireObjectCoercible(this)); @@ -4790,13 +4878,13 @@ var createMethod$6 = function (TYPE) { var stringTrim = { // `String.prototype.{ trimLeft, trimStart }` methods - // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart + // https://tc39.es/ecma262/#sec-string.prototype.trimstart start: createMethod$6(1), // `String.prototype.{ trimRight, trimEnd }` methods - // https://tc39.github.io/ecma262/#sec-string.prototype.trimend + // https://tc39.es/ecma262/#sec-string.prototype.trimend end: createMethod$6(2), // `String.prototype.trim` method - // https://tc39.github.io/ecma262/#sec-string.prototype.trim + // https://tc39.es/ecma262/#sec-string.prototype.trim trim: createMethod$6(3) }; @@ -4814,7 +4902,7 @@ var $trim = stringTrim.trim; // `String.prototype.trim` method -// https://tc39.github.io/ecma262/#sec-string.prototype.trim +// https://tc39.es/ecma262/#sec-string.prototype.trim _export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, { trim: function trim() { return $trim(this); @@ -4831,7 +4919,8 @@ var trimStart = FORCED$5 ? function trimStart() { } : ''.trimStart; // `String.prototype.{ trimStart, trimLeft }` methods -// https://github.com/tc39/ecmascript-string-left-right-trim +// https://tc39.es/ecma262/#sec-string.prototype.trimstart +// https://tc39.es/ecma262/#String.prototype.trimleft _export({ target: 'String', proto: true, forced: FORCED$5 }, { trimStart: trimStart, trimLeft: trimStart @@ -4847,7 +4936,8 @@ var trimEnd = FORCED$6 ? function trimEnd() { } : ''.trimEnd; // `String.prototype.{ trimEnd, trimRight }` methods -// https://github.com/tc39/ecmascript-string-left-right-trim +// https://tc39.es/ecma262/#sec-string.prototype.trimend +// https://tc39.es/ecma262/#String.prototype.trimright _export({ target: 'String', proto: true, forced: FORCED$6 }, { trimEnd: trimEnd, trimRight: trimEnd @@ -4862,7 +4952,7 @@ var setInternalState$4 = internalState.set; var getInternalState$4 = internalState.getterFor(STRING_ITERATOR); // `String.prototype[@@iterator]` method -// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator +// https://tc39.es/ecma262/#sec-string.prototype-@@iterator defineIterator(String, 'String', function (iterated) { setInternalState$4(this, { type: STRING_ITERATOR, @@ -4870,7 +4960,7 @@ defineIterator(String, 'String', function (iterated) { index: 0 }); // `%StringIteratorPrototype%.next` method -// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next +// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next }, function next() { var state = getInternalState$4(this); var string = state.string; @@ -4885,7 +4975,7 @@ defineIterator(String, 'String', function (iterated) { var quot = /"/g; // B.2.3.2.1 CreateHTML(string, tag, attribute, value) -// https://tc39.github.io/ecma262/#sec-createhtml +// https://tc39.es/ecma262/#sec-createhtml var createHtml = function (string, tag, attribute, value) { var S = String(requireObjectCoercible(string)); var p1 = '<' + tag; @@ -4903,7 +4993,7 @@ var stringHtmlForced = function (METHOD_NAME) { }; // `String.prototype.anchor` method -// https://tc39.github.io/ecma262/#sec-string.prototype.anchor +// https://tc39.es/ecma262/#sec-string.prototype.anchor _export({ target: 'String', proto: true, forced: stringHtmlForced('anchor') }, { anchor: function anchor(name) { return createHtml(this, 'a', 'name', name); @@ -4911,7 +5001,7 @@ _export({ target: 'String', proto: true, forced: stringHtmlForced('anchor') }, { }); // `String.prototype.big` method -// https://tc39.github.io/ecma262/#sec-string.prototype.big +// https://tc39.es/ecma262/#sec-string.prototype.big _export({ target: 'String', proto: true, forced: stringHtmlForced('big') }, { big: function big() { return createHtml(this, 'big', '', ''); @@ -4919,7 +5009,7 @@ _export({ target: 'String', proto: true, forced: stringHtmlForced('big') }, { }); // `String.prototype.blink` method -// https://tc39.github.io/ecma262/#sec-string.prototype.blink +// https://tc39.es/ecma262/#sec-string.prototype.blink _export({ target: 'String', proto: true, forced: stringHtmlForced('blink') }, { blink: function blink() { return createHtml(this, 'blink', '', ''); @@ -4927,7 +5017,7 @@ _export({ target: 'String', proto: true, forced: stringHtmlForced('blink') }, { }); // `String.prototype.bold` method -// https://tc39.github.io/ecma262/#sec-string.prototype.bold +// https://tc39.es/ecma262/#sec-string.prototype.bold _export({ target: 'String', proto: true, forced: stringHtmlForced('bold') }, { bold: function bold() { return createHtml(this, 'b', '', ''); @@ -4935,7 +5025,7 @@ _export({ target: 'String', proto: true, forced: stringHtmlForced('bold') }, { }); // `String.prototype.fixed` method -// https://tc39.github.io/ecma262/#sec-string.prototype.fixed +// https://tc39.es/ecma262/#sec-string.prototype.fixed _export({ target: 'String', proto: true, forced: stringHtmlForced('fixed') }, { fixed: function fixed() { return createHtml(this, 'tt', '', ''); @@ -4943,7 +5033,7 @@ _export({ target: 'String', proto: true, forced: stringHtmlForced('fixed') }, { }); // `String.prototype.fontcolor` method -// https://tc39.github.io/ecma262/#sec-string.prototype.fontcolor +// https://tc39.es/ecma262/#sec-string.prototype.fontcolor _export({ target: 'String', proto: true, forced: stringHtmlForced('fontcolor') }, { fontcolor: function fontcolor(color) { return createHtml(this, 'font', 'color', color); @@ -4951,7 +5041,7 @@ _export({ target: 'String', proto: true, forced: stringHtmlForced('fontcolor') } }); // `String.prototype.fontsize` method -// https://tc39.github.io/ecma262/#sec-string.prototype.fontsize +// https://tc39.es/ecma262/#sec-string.prototype.fontsize _export({ target: 'String', proto: true, forced: stringHtmlForced('fontsize') }, { fontsize: function fontsize(size) { return createHtml(this, 'font', 'size', size); @@ -4959,7 +5049,7 @@ _export({ target: 'String', proto: true, forced: stringHtmlForced('fontsize') }, }); // `String.prototype.italics` method -// https://tc39.github.io/ecma262/#sec-string.prototype.italics +// https://tc39.es/ecma262/#sec-string.prototype.italics _export({ target: 'String', proto: true, forced: stringHtmlForced('italics') }, { italics: function italics() { return createHtml(this, 'i', '', ''); @@ -4967,7 +5057,7 @@ _export({ target: 'String', proto: true, forced: stringHtmlForced('italics') }, }); // `String.prototype.link` method -// https://tc39.github.io/ecma262/#sec-string.prototype.link +// https://tc39.es/ecma262/#sec-string.prototype.link _export({ target: 'String', proto: true, forced: stringHtmlForced('link') }, { link: function link(url) { return createHtml(this, 'a', 'href', url); @@ -4975,7 +5065,7 @@ _export({ target: 'String', proto: true, forced: stringHtmlForced('link') }, { }); // `String.prototype.small` method -// https://tc39.github.io/ecma262/#sec-string.prototype.small +// https://tc39.es/ecma262/#sec-string.prototype.small _export({ target: 'String', proto: true, forced: stringHtmlForced('small') }, { small: function small() { return createHtml(this, 'small', '', ''); @@ -4983,7 +5073,7 @@ _export({ target: 'String', proto: true, forced: stringHtmlForced('small') }, { }); // `String.prototype.strike` method -// https://tc39.github.io/ecma262/#sec-string.prototype.strike +// https://tc39.es/ecma262/#sec-string.prototype.strike _export({ target: 'String', proto: true, forced: stringHtmlForced('strike') }, { strike: function strike() { return createHtml(this, 'strike', '', ''); @@ -4991,7 +5081,7 @@ _export({ target: 'String', proto: true, forced: stringHtmlForced('strike') }, { }); // `String.prototype.sub` method -// https://tc39.github.io/ecma262/#sec-string.prototype.sub +// https://tc39.es/ecma262/#sec-string.prototype.sub _export({ target: 'String', proto: true, forced: stringHtmlForced('sub') }, { sub: function sub() { return createHtml(this, 'sub', '', ''); @@ -4999,13 +5089,70 @@ _export({ target: 'String', proto: true, forced: stringHtmlForced('sub') }, { }); // `String.prototype.sup` method -// https://tc39.github.io/ecma262/#sec-string.prototype.sup +// https://tc39.es/ecma262/#sec-string.prototype.sup _export({ target: 'String', proto: true, forced: stringHtmlForced('sup') }, { sup: function sup() { return createHtml(this, 'sup', '', ''); } }); +var REPLACE$1 = wellKnownSymbol('replace'); +var RegExpPrototype$1 = RegExp.prototype; +var max$4 = Math.max; + +var stringIndexOf = function (string, searchValue, fromIndex) { + if (fromIndex > string.length) return -1; + if (searchValue === '') return fromIndex; + return string.indexOf(searchValue, fromIndex); +}; + +// `String.prototype.replaceAll` method +// https://tc39.es/ecma262/#sec-string.prototype.replaceall +_export({ target: 'String', proto: true }, { + replaceAll: function replaceAll(searchValue, replaceValue) { + var O = requireObjectCoercible(this); + var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement; + var position = 0; + var endOfLastMatch = 0; + var result = ''; + if (searchValue != null) { + IS_REG_EXP = isRegexp(searchValue); + if (IS_REG_EXP) { + flags = String(requireObjectCoercible('flags' in RegExpPrototype$1 + ? searchValue.flags + : regexpFlags.call(searchValue) + )); + if (!~flags.indexOf('g')) throw TypeError('`.replaceAll` does not allow non-global regexes'); + } + replacer = searchValue[REPLACE$1]; + if (replacer !== undefined) { + return replacer.call(searchValue, O, replaceValue); + } + } + string = String(O); + searchString = String(searchValue); + functionalReplace = typeof replaceValue === 'function'; + if (!functionalReplace) replaceValue = String(replaceValue); + searchLength = searchString.length; + advanceBy = max$4(1, searchLength); + position = stringIndexOf(string, searchString, 0); + while (position !== -1) { + if (functionalReplace) { + replacement = String(replaceValue(searchString, position, string)); + } else { + replacement = getSubstitution(searchString, string, position, [], undefined, replaceValue); + } + result += string.slice(endOfLastMatch, position) + replacement; + endOfLastMatch = position + searchLength; + position = stringIndexOf(string, searchString, position + advanceBy); + } + if (endOfLastMatch < string.length) { + result += string.slice(endOfLastMatch); + } + return result; + } +}); + // makes subclassing work correct for wrapped built-ins var inheritIfRequired = function ($this, dummy, Wrapper) { var NewTarget, NewTargetPrototype; @@ -5034,7 +5181,7 @@ var setInternalState$5 = internalState.set; var MATCH$2 = wellKnownSymbol('match'); var NativeRegExp = global_1.RegExp; -var RegExpPrototype$1 = NativeRegExp.prototype; +var RegExpPrototype$2 = NativeRegExp.prototype; var re1 = /a/g; var re2 = /a/g; @@ -5050,7 +5197,7 @@ var FORCED$7 = descriptors && isForced_1('RegExp', (!CORRECT_NEW || UNSUPPORTED_ }))); // `RegExp` constructor -// https://tc39.github.io/ecma262/#sec-regexp-constructor +// https://tc39.es/ecma262/#sec-regexp-constructor if (FORCED$7) { var RegExpWrapper = function RegExp(pattern, flags) { var thisIsRegExp = this instanceof RegExpWrapper; @@ -5076,7 +5223,7 @@ if (FORCED$7) { var result = inheritIfRequired( CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags), - thisIsRegExp ? this : RegExpPrototype$1, + thisIsRegExp ? this : RegExpPrototype$2, RegExpWrapper ); @@ -5094,18 +5241,18 @@ if (FORCED$7) { var keys$1 = getOwnPropertyNames(NativeRegExp); var index = 0; while (keys$1.length > index) proxy(keys$1[index++]); - RegExpPrototype$1.constructor = RegExpWrapper; - RegExpWrapper.prototype = RegExpPrototype$1; + RegExpPrototype$2.constructor = RegExpWrapper; + RegExpWrapper.prototype = RegExpPrototype$2; redefine(global_1, 'RegExp', RegExpWrapper); } -// https://tc39.github.io/ecma262/#sec-get-regexp-@@species +// https://tc39.es/ecma262/#sec-get-regexp-@@species setSpecies('RegExp'); var UNSUPPORTED_Y$3 = regexpStickyHelpers.UNSUPPORTED_Y; // `RegExp.prototype.flags` getter -// https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags +// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags if (descriptors && (/./g.flags != 'g' || UNSUPPORTED_Y$3)) { objectDefineProperty.f(RegExp.prototype, 'flags', { configurable: true, @@ -5116,14 +5263,15 @@ if (descriptors && (/./g.flags != 'g' || UNSUPPORTED_Y$3)) { var UNSUPPORTED_Y$4 = regexpStickyHelpers.UNSUPPORTED_Y; var defineProperty$7 = objectDefineProperty.f; var getInternalState$5 = internalState.get; -var RegExpPrototype$2 = RegExp.prototype; +var RegExpPrototype$3 = RegExp.prototype; // `RegExp.prototype.sticky` getter +// https://tc39.es/ecma262/#sec-get-regexp.prototype.sticky if (descriptors && UNSUPPORTED_Y$4) { defineProperty$7(RegExp.prototype, 'sticky', { configurable: true, get: function () { - if (this === RegExpPrototype$2) return undefined; + if (this === RegExpPrototype$3) return undefined; // We can't use InternalStateModule.getterFor because // we don't add metadata for regexps created by a literal. if (this instanceof RegExp) { @@ -5151,6 +5299,8 @@ var DELEGATES_TO_EXEC = function () { var nativeTest = /./.test; +// `RegExp.prototype.test` method +// https://tc39.es/ecma262/#sec-regexp.prototype.test _export({ target: 'RegExp', proto: true, forced: !DELEGATES_TO_EXEC }, { test: function (str) { if (typeof this.exec !== 'function') { @@ -5165,21 +5315,21 @@ _export({ target: 'RegExp', proto: true, forced: !DELEGATES_TO_EXEC }, { }); var TO_STRING = 'toString'; -var RegExpPrototype$3 = RegExp.prototype; -var nativeToString = RegExpPrototype$3[TO_STRING]; +var RegExpPrototype$4 = RegExp.prototype; +var nativeToString = RegExpPrototype$4[TO_STRING]; var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); // FF44- RegExp#toString has a wrong name var INCORRECT_NAME = nativeToString.name != TO_STRING; // `RegExp.prototype.toString` method -// https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring +// https://tc39.es/ecma262/#sec-regexp.prototype.tostring if (NOT_GENERIC || INCORRECT_NAME) { redefine(RegExp.prototype, TO_STRING, function toString() { var R = anObject(this); var p = String(R.source); var rf = R.flags; - var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype$3) ? regexpFlags.call(R) : rf); + var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype$4) ? regexpFlags.call(R) : rf); return '/' + p + '/' + f; }, { unsafe: true }); } @@ -5192,14 +5342,14 @@ var hex = /^[+-]?0[Xx]/; var FORCED$8 = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22; // `parseInt` method -// https://tc39.github.io/ecma262/#sec-parseint-string-radix +// https://tc39.es/ecma262/#sec-parseint-string-radix var numberParseInt = FORCED$8 ? function parseInt(string, radix) { var S = trim(String(string)); return $parseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10)); } : $parseInt; // `parseInt` method -// https://tc39.github.io/ecma262/#sec-parseint-string-radix +// https://tc39.es/ecma262/#sec-parseint-string-radix _export({ global: true, forced: parseInt != numberParseInt }, { parseInt: numberParseInt }); @@ -5211,7 +5361,7 @@ var $parseFloat = global_1.parseFloat; var FORCED$9 = 1 / $parseFloat(whitespaces + '-0') !== -Infinity; // `parseFloat` method -// https://tc39.github.io/ecma262/#sec-parsefloat-string +// https://tc39.es/ecma262/#sec-parsefloat-string var numberParseFloat = FORCED$9 ? function parseFloat(string) { var trimmedString = trim$1(String(string)); var result = $parseFloat(trimmedString); @@ -5219,7 +5369,7 @@ var numberParseFloat = FORCED$9 ? function parseFloat(string) { } : $parseFloat; // `parseFloat` method -// https://tc39.github.io/ecma262/#sec-parsefloat-string +// https://tc39.es/ecma262/#sec-parsefloat-string _export({ global: true, forced: parseFloat != numberParseFloat }, { parseFloat: numberParseFloat }); @@ -5237,7 +5387,7 @@ var NumberPrototype = NativeNumber.prototype; var BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER; // `ToNumber` abstract operation -// https://tc39.github.io/ecma262/#sec-tonumber +// https://tc39.es/ecma262/#sec-tonumber var toNumber = function (argument) { var it = toPrimitive(argument, false); var first, third, radix, maxCode, digits, length, index, code; @@ -5266,7 +5416,7 @@ var toNumber = function (argument) { }; // `Number` constructor -// https://tc39.github.io/ecma262/#sec-number-constructor +// https://tc39.es/ecma262/#sec-number-constructor if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) { var NumberWrapper = function Number(value) { var it = arguments.length < 1 ? 0 : value; @@ -5281,7 +5431,9 @@ if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNu 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + // ES2015 (in case, if modules with ES2015 Number statics required before): 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + - 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,' + + // ESNext + 'fromString,range' ).split(','), j = 0, key; keys$2.length > j; j++) { if (has(NativeNumber, key = keys$2[j]) && !has(NumberWrapper, key)) { defineProperty$8(NumberWrapper, key, getOwnPropertyDescriptor$7(NativeNumber, key)); @@ -5293,7 +5445,7 @@ if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNu } // `Number.EPSILON` constant -// https://tc39.github.io/ecma262/#sec-number.epsilon +// https://tc39.es/ecma262/#sec-number.epsilon _export({ target: 'Number', stat: true }, { EPSILON: Math.pow(2, -52) }); @@ -5301,31 +5453,31 @@ _export({ target: 'Number', stat: true }, { var globalIsFinite = global_1.isFinite; // `Number.isFinite` method -// https://tc39.github.io/ecma262/#sec-number.isfinite +// https://tc39.es/ecma262/#sec-number.isfinite var numberIsFinite = Number.isFinite || function isFinite(it) { return typeof it == 'number' && globalIsFinite(it); }; // `Number.isFinite` method -// https://tc39.github.io/ecma262/#sec-number.isfinite +// https://tc39.es/ecma262/#sec-number.isfinite _export({ target: 'Number', stat: true }, { isFinite: numberIsFinite }); var floor$2 = Math.floor; // `Number.isInteger` method implementation -// https://tc39.github.io/ecma262/#sec-number.isinteger +// https://tc39.es/ecma262/#sec-number.isinteger var isInteger = function isInteger(it) { return !isObject(it) && isFinite(it) && floor$2(it) === it; }; // `Number.isInteger` method -// https://tc39.github.io/ecma262/#sec-number.isinteger +// https://tc39.es/ecma262/#sec-number.isinteger _export({ target: 'Number', stat: true }, { isInteger: isInteger }); // `Number.isNaN` method -// https://tc39.github.io/ecma262/#sec-number.isnan +// https://tc39.es/ecma262/#sec-number.isnan _export({ target: 'Number', stat: true }, { isNaN: function isNaN(number) { // eslint-disable-next-line no-self-compare @@ -5336,7 +5488,7 @@ _export({ target: 'Number', stat: true }, { var abs = Math.abs; // `Number.isSafeInteger` method -// https://tc39.github.io/ecma262/#sec-number.issafeinteger +// https://tc39.es/ecma262/#sec-number.issafeinteger _export({ target: 'Number', stat: true }, { isSafeInteger: function isSafeInteger(number) { return isInteger(number) && abs(number) <= 0x1FFFFFFFFFFFFF; @@ -5344,31 +5496,31 @@ _export({ target: 'Number', stat: true }, { }); // `Number.MAX_SAFE_INTEGER` constant -// https://tc39.github.io/ecma262/#sec-number.max_safe_integer +// https://tc39.es/ecma262/#sec-number.max_safe_integer _export({ target: 'Number', stat: true }, { MAX_SAFE_INTEGER: 0x1FFFFFFFFFFFFF }); // `Number.MIN_SAFE_INTEGER` constant -// https://tc39.github.io/ecma262/#sec-number.min_safe_integer +// https://tc39.es/ecma262/#sec-number.min_safe_integer _export({ target: 'Number', stat: true }, { MIN_SAFE_INTEGER: -0x1FFFFFFFFFFFFF }); // `Number.parseFloat` method -// https://tc39.github.io/ecma262/#sec-number.parseFloat +// https://tc39.es/ecma262/#sec-number.parseFloat _export({ target: 'Number', stat: true, forced: Number.parseFloat != numberParseFloat }, { parseFloat: numberParseFloat }); // `Number.parseInt` method -// https://tc39.github.io/ecma262/#sec-number.parseint +// https://tc39.es/ecma262/#sec-number.parseint _export({ target: 'Number', stat: true, forced: Number.parseInt != numberParseInt }, { parseInt: numberParseInt }); // `thisNumberValue` abstract operation -// https://tc39.github.io/ecma262/#sec-thisnumbervalue +// https://tc39.es/ecma262/#sec-thisnumbervalue var thisNumberValue = function (value) { if (typeof value != 'number' && classofRaw(value) != 'Number') { throw TypeError('Incorrect invocation'); @@ -5407,7 +5559,7 @@ var FORCED$a = nativeToFixed && ( }); // `Number.prototype.toFixed` method -// https://tc39.github.io/ecma262/#sec-number.prototype.tofixed +// https://tc39.es/ecma262/#sec-number.prototype.tofixed _export({ target: 'Number', proto: true, forced: FORCED$a }, { // eslint-disable-next-line max-statements toFixed: function toFixed(fractionDigits) { @@ -5507,7 +5659,7 @@ var FORCED$b = fails(function () { }); // `Number.prototype.toPrecision` method -// https://tc39.github.io/ecma262/#sec-number.prototype.toprecision +// https://tc39.es/ecma262/#sec-number.prototype.toprecision _export({ target: 'Number', proto: true, forced: FORCED$b }, { toPrecision: function toPrecision(precision) { return precision === undefined @@ -5519,7 +5671,7 @@ _export({ target: 'Number', proto: true, forced: FORCED$b }, { var log$1 = Math.log; // `Math.log1p` method implementation -// https://tc39.github.io/ecma262/#sec-math.log1p +// https://tc39.es/ecma262/#sec-math.log1p var mathLog1p = Math.log1p || function log1p(x) { return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log$1(1 + x); }; @@ -5536,7 +5688,7 @@ var FORCED$c = !nativeAcosh || nativeAcosh(Infinity) != Infinity; // `Math.acosh` method -// https://tc39.github.io/ecma262/#sec-math.acosh +// https://tc39.es/ecma262/#sec-math.acosh _export({ target: 'Math', stat: true, forced: FORCED$c }, { acosh: function acosh(x) { return (x = +x) < 1 ? NaN : x > 94906265.62425156 @@ -5554,7 +5706,7 @@ function asinh(x) { } // `Math.asinh` method -// https://tc39.github.io/ecma262/#sec-math.asinh +// https://tc39.es/ecma262/#sec-math.asinh // Tor Browser bug: Math.asinh(0) -> -0 _export({ target: 'Math', stat: true, forced: !(nativeAsinh && 1 / nativeAsinh(0) > 0) }, { asinh: asinh @@ -5564,7 +5716,7 @@ var nativeAtanh = Math.atanh; var log$4 = Math.log; // `Math.atanh` method -// https://tc39.github.io/ecma262/#sec-math.atanh +// https://tc39.es/ecma262/#sec-math.atanh // Tor Browser bug: Math.atanh(-0) -> 0 _export({ target: 'Math', stat: true, forced: !(nativeAtanh && 1 / nativeAtanh(-0) < 0) }, { atanh: function atanh(x) { @@ -5573,7 +5725,7 @@ _export({ target: 'Math', stat: true, forced: !(nativeAtanh && 1 / nativeAtanh(- }); // `Math.sign` method implementation -// https://tc39.github.io/ecma262/#sec-math.sign +// https://tc39.es/ecma262/#sec-math.sign var mathSign = Math.sign || function sign(x) { // eslint-disable-next-line no-self-compare return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; @@ -5583,7 +5735,7 @@ var abs$1 = Math.abs; var pow$1 = Math.pow; // `Math.cbrt` method -// https://tc39.github.io/ecma262/#sec-math.cbrt +// https://tc39.es/ecma262/#sec-math.cbrt _export({ target: 'Math', stat: true }, { cbrt: function cbrt(x) { return mathSign(x = +x) * pow$1(abs$1(x), 1 / 3); @@ -5595,7 +5747,7 @@ var log$5 = Math.log; var LOG2E = Math.LOG2E; // `Math.clz32` method -// https://tc39.github.io/ecma262/#sec-math.clz32 +// https://tc39.es/ecma262/#sec-math.clz32 _export({ target: 'Math', stat: true }, { clz32: function clz32(x) { return (x >>>= 0) ? 31 - floor$4(log$5(x + 0.5) * LOG2E) : 32; @@ -5606,7 +5758,7 @@ var nativeExpm1 = Math.expm1; var exp = Math.exp; // `Math.expm1` method implementation -// https://tc39.github.io/ecma262/#sec-math.expm1 +// https://tc39.es/ecma262/#sec-math.expm1 var mathExpm1 = (!nativeExpm1 // Old FF bug || nativeExpm1(10) > 22025.465794806719 || nativeExpm1(10) < 22025.4657948067165168 @@ -5621,7 +5773,7 @@ var abs$2 = Math.abs; var E = Math.E; // `Math.cosh` method -// https://tc39.github.io/ecma262/#sec-math.cosh +// https://tc39.es/ecma262/#sec-math.cosh _export({ target: 'Math', stat: true, forced: !nativeCosh || nativeCosh(710) === Infinity }, { cosh: function cosh(x) { var t = mathExpm1(abs$2(x) - 1) + 1; @@ -5630,7 +5782,7 @@ _export({ target: 'Math', stat: true, forced: !nativeCosh || nativeCosh(710) === }); // `Math.expm1` method -// https://tc39.github.io/ecma262/#sec-math.expm1 +// https://tc39.es/ecma262/#sec-math.expm1 _export({ target: 'Math', stat: true, forced: mathExpm1 != Math.expm1 }, { expm1: mathExpm1 }); var abs$3 = Math.abs; @@ -5645,7 +5797,7 @@ var roundTiesToEven = function (n) { }; // `Math.fround` method implementation -// https://tc39.github.io/ecma262/#sec-math.fround +// https://tc39.es/ecma262/#sec-math.fround var mathFround = Math.fround || function fround(x) { var $abs = abs$3(x); var $sign = mathSign(x); @@ -5659,7 +5811,7 @@ var mathFround = Math.fround || function fround(x) { }; // `Math.fround` method -// https://tc39.github.io/ecma262/#sec-math.fround +// https://tc39.es/ecma262/#sec-math.fround _export({ target: 'Math', stat: true }, { fround: mathFround }); var $hypot = Math.hypot; @@ -5671,7 +5823,7 @@ var sqrt$2 = Math.sqrt; var BUGGY = !!$hypot && $hypot(Infinity, NaN) !== Infinity; // `Math.hypot` method -// https://tc39.github.io/ecma262/#sec-math.hypot +// https://tc39.es/ecma262/#sec-math.hypot _export({ target: 'Math', stat: true, forced: BUGGY }, { hypot: function hypot(value1, value2) { // eslint-disable-line no-unused-vars var sum = 0; @@ -5701,7 +5853,7 @@ var FORCED$d = fails(function () { }); // `Math.imul` method -// https://tc39.github.io/ecma262/#sec-math.imul +// https://tc39.es/ecma262/#sec-math.imul // some WebKit versions fails with big numbers, some has wrong arity _export({ target: 'Math', stat: true, forced: FORCED$d }, { imul: function imul(x, y) { @@ -5718,7 +5870,7 @@ var log$6 = Math.log; var LOG10E = Math.LOG10E; // `Math.log10` method -// https://tc39.github.io/ecma262/#sec-math.log10 +// https://tc39.es/ecma262/#sec-math.log10 _export({ target: 'Math', stat: true }, { log10: function log10(x) { return log$6(x) * LOG10E; @@ -5726,14 +5878,14 @@ _export({ target: 'Math', stat: true }, { }); // `Math.log1p` method -// https://tc39.github.io/ecma262/#sec-math.log1p +// https://tc39.es/ecma262/#sec-math.log1p _export({ target: 'Math', stat: true }, { log1p: mathLog1p }); var log$7 = Math.log; var LN2$1 = Math.LN2; // `Math.log2` method -// https://tc39.github.io/ecma262/#sec-math.log2 +// https://tc39.es/ecma262/#sec-math.log2 _export({ target: 'Math', stat: true }, { log2: function log2(x) { return log$7(x) / LN2$1; @@ -5741,7 +5893,7 @@ _export({ target: 'Math', stat: true }, { }); // `Math.sign` method -// https://tc39.github.io/ecma262/#sec-math.sign +// https://tc39.es/ecma262/#sec-math.sign _export({ target: 'Math', stat: true }, { sign: mathSign }); @@ -5755,7 +5907,7 @@ var FORCED$e = fails(function () { }); // `Math.sinh` method -// https://tc39.github.io/ecma262/#sec-math.sinh +// https://tc39.es/ecma262/#sec-math.sinh // V8 near Chromium 38 has a problem with very small numbers _export({ target: 'Math', stat: true, forced: FORCED$e }, { sinh: function sinh(x) { @@ -5766,7 +5918,7 @@ _export({ target: 'Math', stat: true, forced: FORCED$e }, { var exp$2 = Math.exp; // `Math.tanh` method -// https://tc39.github.io/ecma262/#sec-math.tanh +// https://tc39.es/ecma262/#sec-math.tanh _export({ target: 'Math', stat: true }, { tanh: function tanh(x) { var a = mathExpm1(x = +x); @@ -5776,14 +5928,14 @@ _export({ target: 'Math', stat: true }, { }); // Math[@@toStringTag] property -// https://tc39.github.io/ecma262/#sec-math-@@tostringtag +// https://tc39.es/ecma262/#sec-math-@@tostringtag setToStringTag(Math, 'Math', true); var ceil$2 = Math.ceil; var floor$5 = Math.floor; // `Math.trunc` method -// https://tc39.github.io/ecma262/#sec-math.trunc +// https://tc39.es/ecma262/#sec-math.trunc _export({ target: 'Math', stat: true }, { trunc: function trunc(it) { return (it > 0 ? floor$5 : ceil$2)(it); @@ -5791,7 +5943,7 @@ _export({ target: 'Math', stat: true }, { }); // `Date.now` method -// https://tc39.github.io/ecma262/#sec-date.now +// https://tc39.es/ecma262/#sec-date.now _export({ target: 'Date', stat: true }, { now: function now() { return new Date().getTime(); @@ -5804,7 +5956,7 @@ var FORCED$f = fails(function () { }); // `Date.prototype.toJSON` method -// https://tc39.github.io/ecma262/#sec-date.prototype.tojson +// https://tc39.es/ecma262/#sec-date.prototype.tojson _export({ target: 'Date', proto: true, forced: FORCED$f }, { // eslint-disable-next-line no-unused-vars toJSON: function toJSON(key) { @@ -5822,7 +5974,7 @@ var getTime = DatePrototype.getTime; var nativeDateToISOString = DatePrototype.toISOString; // `Date.prototype.toISOString` method implementation -// https://tc39.github.io/ecma262/#sec-date.prototype.toisostring +// https://tc39.es/ecma262/#sec-date.prototype.toisostring // PhantomJS / old WebKit fails here: var dateToIsoString = (fails(function () { return nativeDateToISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; @@ -5845,7 +5997,7 @@ var dateToIsoString = (fails(function () { } : nativeDateToISOString; // `Date.prototype.toISOString` method -// https://tc39.github.io/ecma262/#sec-date.prototype.toisostring +// https://tc39.es/ecma262/#sec-date.prototype.toisostring // PhantomJS / old WebKit has a broken implementations _export({ target: 'Date', proto: true, forced: Date.prototype.toISOString !== dateToIsoString }, { toISOString: dateToIsoString @@ -5858,7 +6010,7 @@ var nativeDateToString = DatePrototype$1[TO_STRING$1]; var getTime$1 = DatePrototype$1.getTime; // `Date.prototype.toString` method -// https://tc39.github.io/ecma262/#sec-date.prototype.tostring +// https://tc39.es/ecma262/#sec-date.prototype.tostring if (new Date(NaN) + '' != INVALID_DATE) { redefine(DatePrototype$1, TO_STRING$1, function toString() { var value = getTime$1.call(this); @@ -5877,7 +6029,7 @@ var TO_PRIMITIVE$1 = wellKnownSymbol('toPrimitive'); var DatePrototype$2 = Date.prototype; // `Date.prototype[@@toPrimitive]` method -// https://tc39.github.io/ecma262/#sec-date.prototype-@@toprimitive +// https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive if (!(TO_PRIMITIVE$1 in DatePrototype$2)) { createNonEnumerableProperty(DatePrototype$2, TO_PRIMITIVE$1, dateToPrimitive); } @@ -5901,6 +6053,8 @@ var FORCED$g = fails(function () { }); if ($stringify$1) { + // `JSON.stringify` method + // https://tc39.es/ecma262/#sec-json.stringify // https://github.com/tc39/proposal-well-formed-stringify _export({ target: 'JSON', stat: true, forced: FORCED$g }, { // eslint-disable-next-line no-unused-vars @@ -5912,11 +6066,11 @@ if ($stringify$1) { } // JSON[@@toStringTag] property -// https://tc39.github.io/ecma262/#sec-json-@@tostringtag +// https://tc39.es/ecma262/#sec-json-@@tostringtag setToStringTag(global_1.JSON, 'JSON', true); // `Promise.allSettled` method -// https://github.com/tc39/proposal-promise-allSettled +// https://tc39.es/ecma262/#sec-promise.allsettled _export({ target: 'Promise', stat: true }, { allSettled: function allSettled(iterable) { var C = this; @@ -5928,7 +6082,7 @@ _export({ target: 'Promise', stat: true }, { var values = []; var counter = 0; var remaining = 1; - iterate_1(iterable, function (promise) { + iterate(iterable, function (promise) { var index = counter++; var alreadyCalled = false; values.push(undefined); @@ -5938,10 +6092,10 @@ _export({ target: 'Promise', stat: true }, { alreadyCalled = true; values[index] = { status: 'fulfilled', value: value }; --remaining || resolve(values); - }, function (e) { + }, function (error) { if (alreadyCalled) return; alreadyCalled = true; - values[index] = { status: 'rejected', reason: e }; + values[index] = { status: 'rejected', reason: error }; --remaining || resolve(values); }); }); @@ -5952,6 +6106,45 @@ _export({ target: 'Promise', stat: true }, { } }); +var PROMISE_ANY_ERROR = 'No one promise resolved'; + +// `Promise.any` method +// https://tc39.es/ecma262/#sec-promise.any +_export({ target: 'Promise', stat: true }, { + any: function any(iterable) { + var C = this; + var capability = newPromiseCapability.f(C); + var resolve = capability.resolve; + var reject = capability.reject; + var result = perform(function () { + var promiseResolve = aFunction$1(C.resolve); + var errors = []; + var counter = 0; + var remaining = 1; + var alreadyResolved = false; + iterate(iterable, function (promise) { + var index = counter++; + var alreadyRejected = false; + errors.push(undefined); + remaining++; + promiseResolve.call(C, promise).then(function (value) { + if (alreadyRejected || alreadyResolved) return; + alreadyResolved = true; + resolve(value); + }, function (error) { + if (alreadyRejected || alreadyResolved) return; + alreadyRejected = true; + errors[index] = error; + --remaining || reject(new (getBuiltIn('AggregateError'))(errors, PROMISE_ANY_ERROR)); + }); + }); + --remaining || reject(new (getBuiltIn('AggregateError'))(errors, PROMISE_ANY_ERROR)); + }); + if (result.error) reject(result.value); + return capability.promise; + } +}); + var collection = function (CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; @@ -6009,7 +6202,7 @@ var collection = function (CONSTRUCTOR_NAME, wrapper, common) { Constructor = wrapper(function (dummy, iterable) { anInstance(dummy, Constructor, CONSTRUCTOR_NAME); var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor); - if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP); + if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); return that; }); Constructor.prototype = NativePrototype; @@ -6065,7 +6258,7 @@ var collectionStrong = { size: 0 }); if (!descriptors) that.size = 0; - if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP); + if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); }); var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); @@ -6225,13 +6418,13 @@ var collectionStrong = { }; // `Map` constructor -// https://tc39.github.io/ecma262/#sec-map-objects +// https://tc39.es/ecma262/#sec-map-objects var es_map = collection('Map', function (init) { return function Map() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); // `Set` constructor -// https://tc39.github.io/ecma262/#sec-set-objects +// https://tc39.es/ecma262/#sec-set-objects var es_set = collection('Set', function (init) { return function Set() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); @@ -6297,7 +6490,7 @@ var collectionWeak = { id: id$1++, frozen: undefined }); - if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP); + if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); }); var getInternalState = internalStateGetterFor$1(CONSTRUCTOR_NAME); @@ -6377,7 +6570,7 @@ var wrapper = function (init) { }; // `WeakMap` constructor -// https://tc39.github.io/ecma262/#sec-weakmap-constructor +// https://tc39.es/ecma262/#sec-weakmap-constructor var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak); // IE11 WeakMap frozen keys fix @@ -6426,7 +6619,7 @@ if (nativeWeakMap && IS_IE11) { }); // `WeakSet` constructor -// https://tc39.github.io/ecma262/#sec-weakset-constructor +// https://tc39.es/ecma262/#sec-weakset-constructor collection('WeakSet', function (init) { return function WeakSet() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionWeak); @@ -6434,7 +6627,7 @@ collection('WeakSet', function (init) { var arrayBufferNative = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined'; // `ToIndex` abstract operation -// https://tc39.github.io/ecma262/#sec-toindex +// https://tc39.es/ecma262/#sec-toindex var toIndex = function (it) { if (it === undefined) return 0; var number = toInteger(it); @@ -6750,7 +6943,7 @@ var ArrayBuffer$1 = arrayBuffer[ARRAY_BUFFER$1]; var NativeArrayBuffer$1 = global_1[ARRAY_BUFFER$1]; // `ArrayBuffer` constructor -// https://tc39.github.io/ecma262/#sec-arraybuffer-constructor +// https://tc39.es/ecma262/#sec-arraybuffer-constructor _export({ global: true, forced: NativeArrayBuffer$1 !== ArrayBuffer$1 }, { ArrayBuffer: ArrayBuffer$1 }); @@ -6791,13 +6984,24 @@ var TypedArrayConstructorsList = { Float64Array: 8 }; +var BigIntArrayConstructorsList = { + BigInt64Array: 8, + BigUint64Array: 8 +}; + var isView = function isView(it) { + if (!isObject(it)) return false; var klass = classof(it); - return klass === 'DataView' || has(TypedArrayConstructorsList, klass); + return klass === 'DataView' + || has(TypedArrayConstructorsList, klass) + || has(BigIntArrayConstructorsList, klass); }; var isTypedArray = function (it) { - return isObject(it) && has(TypedArrayConstructorsList, classof(it)); + if (!isObject(it)) return false; + var klass = classof(it); + return has(TypedArrayConstructorsList, klass) + || has(BigIntArrayConstructorsList, klass); }; var aTypedArray = function (it) { @@ -6908,7 +7112,7 @@ var arrayBufferViewCore = { var NATIVE_ARRAY_BUFFER_VIEWS$1 = arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; // `ArrayBuffer.isView` method -// https://tc39.github.io/ecma262/#sec-arraybuffer.isview +// https://tc39.es/ecma262/#sec-arraybuffer.isview _export({ target: 'ArrayBuffer', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS$1 }, { isView: arrayBufferViewCore.isView }); @@ -6922,7 +7126,7 @@ var INCORRECT_SLICE = fails(function () { }); // `ArrayBuffer.prototype.slice` method -// https://tc39.github.io/ecma262/#sec-arraybuffer.prototype.slice +// https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice _export({ target: 'ArrayBuffer', proto: true, unsafe: true, forced: INCORRECT_SLICE }, { slice: function slice(start, end) { if (nativeArrayBufferSlice !== undefined && end === undefined) { @@ -6942,7 +7146,7 @@ _export({ target: 'ArrayBuffer', proto: true, unsafe: true, forced: INCORRECT_SL }); // `DataView` constructor -// https://tc39.github.io/ecma262/#sec-dataview-constructor +// https://tc39.es/ecma262/#sec-dataview-constructor _export({ global: true, forced: !arrayBufferNative }, { DataView: arrayBuffer.DataView }); @@ -7243,7 +7447,7 @@ if (descriptors) { }); // `Int8Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects +// https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Int8', function (init) { return function Int8Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7251,7 +7455,7 @@ typedArrayConstructor('Int8', function (init) { }); // `Uint8Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects +// https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Uint8', function (init) { return function Uint8Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7259,7 +7463,7 @@ typedArrayConstructor('Uint8', function (init) { }); // `Uint8ClampedArray` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects +// https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Uint8', function (init) { return function Uint8ClampedArray(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7267,7 +7471,7 @@ typedArrayConstructor('Uint8', function (init) { }, true); // `Int16Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects +// https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Int16', function (init) { return function Int16Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7275,7 +7479,7 @@ typedArrayConstructor('Int16', function (init) { }); // `Uint16Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects +// https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Uint16', function (init) { return function Uint16Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7283,7 +7487,7 @@ typedArrayConstructor('Uint16', function (init) { }); // `Int32Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects +// https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Int32', function (init) { return function Int32Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7291,7 +7495,7 @@ typedArrayConstructor('Int32', function (init) { }); // `Uint32Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects +// https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Uint32', function (init) { return function Uint32Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7299,7 +7503,7 @@ typedArrayConstructor('Uint32', function (init) { }); // `Float32Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects +// https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Float32', function (init) { return function Float32Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7307,7 +7511,7 @@ typedArrayConstructor('Float32', function (init) { }); // `Float64Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects +// https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Float64', function (init) { return function Float64Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7318,14 +7522,14 @@ var exportTypedArrayStaticMethod$1 = arrayBufferViewCore.exportTypedArrayStaticM // `%TypedArray%.from` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.from +// https://tc39.es/ecma262/#sec-%typedarray%.from exportTypedArrayStaticMethod$1('from', typedArrayFrom, typedArrayConstructorsRequireWrappers); var aTypedArrayConstructor$2 = arrayBufferViewCore.aTypedArrayConstructor; var exportTypedArrayStaticMethod$2 = arrayBufferViewCore.exportTypedArrayStaticMethod; // `%TypedArray%.of` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.of +// https://tc39.es/ecma262/#sec-%typedarray%.of exportTypedArrayStaticMethod$2('of', function of(/* ...items */) { var index = 0; var length = arguments.length; @@ -7338,7 +7542,7 @@ var aTypedArray$1 = arrayBufferViewCore.aTypedArray; var exportTypedArrayMethod$1 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.copyWithin` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.copywithin +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.copywithin exportTypedArrayMethod$1('copyWithin', function copyWithin(target, start /* , end */) { return arrayCopyWithin.call(aTypedArray$1(this), target, start, arguments.length > 2 ? arguments[2] : undefined); }); @@ -7349,7 +7553,7 @@ var aTypedArray$2 = arrayBufferViewCore.aTypedArray; var exportTypedArrayMethod$2 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.every` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.every +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.every exportTypedArrayMethod$2('every', function every(callbackfn /* , thisArg */) { return $every$1(aTypedArray$2(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7358,7 +7562,7 @@ var aTypedArray$3 = arrayBufferViewCore.aTypedArray; var exportTypedArrayMethod$3 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.fill` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.fill +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill // eslint-disable-next-line no-unused-vars exportTypedArrayMethod$3('fill', function fill(value /* , start, end */) { return arrayFill.apply(aTypedArray$3(this), arguments); @@ -7372,7 +7576,7 @@ var aTypedArrayConstructor$3 = arrayBufferViewCore.aTypedArrayConstructor; var exportTypedArrayMethod$4 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.filter` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.filter +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.filter exportTypedArrayMethod$4('filter', function filter(callbackfn /* , thisArg */) { var list = $filter$1(aTypedArray$4(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); var C = speciesConstructor(this, this.constructor); @@ -7389,7 +7593,7 @@ var aTypedArray$5 = arrayBufferViewCore.aTypedArray; var exportTypedArrayMethod$5 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.find` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.find +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.find exportTypedArrayMethod$5('find', function find(predicate /* , thisArg */) { return $find$1(aTypedArray$5(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7400,7 +7604,7 @@ var aTypedArray$6 = arrayBufferViewCore.aTypedArray; var exportTypedArrayMethod$6 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.findIndex` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.findindex +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.findindex exportTypedArrayMethod$6('findIndex', function findIndex(predicate /* , thisArg */) { return $findIndex$1(aTypedArray$6(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7411,7 +7615,7 @@ var aTypedArray$7 = arrayBufferViewCore.aTypedArray; var exportTypedArrayMethod$7 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.forEach` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.foreach +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.foreach exportTypedArrayMethod$7('forEach', function forEach(callbackfn /* , thisArg */) { $forEach$2(aTypedArray$7(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7422,7 +7626,7 @@ var aTypedArray$8 = arrayBufferViewCore.aTypedArray; var exportTypedArrayMethod$8 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.includes` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.includes +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.includes exportTypedArrayMethod$8('includes', function includes(searchElement /* , fromIndex */) { return $includes$1(aTypedArray$8(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7433,7 +7637,7 @@ var aTypedArray$9 = arrayBufferViewCore.aTypedArray; var exportTypedArrayMethod$9 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.indexOf` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.indexof +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.indexof exportTypedArrayMethod$9('indexOf', function indexOf(searchElement /* , fromIndex */) { return $indexOf$1(aTypedArray$9(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7455,20 +7659,20 @@ var typedArrayValues = function values() { }; // `%TypedArray%.prototype.entries` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.entries +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.entries exportTypedArrayMethod$a('entries', function entries() { return arrayEntries.call(aTypedArray$a(this)); }); // `%TypedArray%.prototype.keys` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.keys +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys exportTypedArrayMethod$a('keys', function keys() { return arrayKeys.call(aTypedArray$a(this)); }); // `%TypedArray%.prototype.values` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.values +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.values exportTypedArrayMethod$a('values', typedArrayValues, !CORRECT_ITER_NAME); // `%TypedArray%.prototype[@@iterator]` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype-@@iterator +// https://tc39.es/ecma262/#sec-%typedarray%.prototype-@@iterator exportTypedArrayMethod$a(ITERATOR$5, typedArrayValues, !CORRECT_ITER_NAME); var aTypedArray$b = arrayBufferViewCore.aTypedArray; @@ -7476,7 +7680,7 @@ var exportTypedArrayMethod$b = arrayBufferViewCore.exportTypedArrayMethod; var $join = [].join; // `%TypedArray%.prototype.join` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.join +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.join // eslint-disable-next-line no-unused-vars exportTypedArrayMethod$b('join', function join(separator) { return $join.apply(aTypedArray$b(this), arguments); @@ -7486,7 +7690,7 @@ var aTypedArray$c = arrayBufferViewCore.aTypedArray; var exportTypedArrayMethod$c = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.lastIndexOf` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.lastindexof +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof // eslint-disable-next-line no-unused-vars exportTypedArrayMethod$c('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) { return arrayLastIndexOf.apply(aTypedArray$c(this), arguments); @@ -7500,7 +7704,7 @@ var aTypedArrayConstructor$4 = arrayBufferViewCore.aTypedArrayConstructor; var exportTypedArrayMethod$d = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.map` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.map +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.map exportTypedArrayMethod$d('map', function map(mapfn /* , thisArg */) { return $map$1(aTypedArray$d(this), mapfn, arguments.length > 1 ? arguments[1] : undefined, function (O, length) { return new (aTypedArrayConstructor$4(speciesConstructor(O, O.constructor)))(length); @@ -7513,7 +7717,7 @@ var aTypedArray$e = arrayBufferViewCore.aTypedArray; var exportTypedArrayMethod$e = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.reduce` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reduce +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduce exportTypedArrayMethod$e('reduce', function reduce(callbackfn /* , initialValue */) { return $reduce$1(aTypedArray$e(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7524,7 +7728,7 @@ var aTypedArray$f = arrayBufferViewCore.aTypedArray; var exportTypedArrayMethod$f = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.reduceRicht` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reduceright +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduceright exportTypedArrayMethod$f('reduceRight', function reduceRight(callbackfn /* , initialValue */) { return $reduceRight$1(aTypedArray$f(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7534,7 +7738,7 @@ var exportTypedArrayMethod$g = arrayBufferViewCore.exportTypedArrayMethod; var floor$7 = Math.floor; // `%TypedArray%.prototype.reverse` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reverse +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.reverse exportTypedArrayMethod$g('reverse', function reverse() { var that = this; var length = aTypedArray$g(that).length; @@ -7557,7 +7761,7 @@ var FORCED$h = fails(function () { }); // `%TypedArray%.prototype.set` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.set +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.set exportTypedArrayMethod$h('set', function set(arrayLike /* , offset */) { aTypedArray$h(this); var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1); @@ -7580,7 +7784,7 @@ var FORCED$i = fails(function () { }); // `%TypedArray%.prototype.slice` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.slice +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice exportTypedArrayMethod$i('slice', function slice(start, end) { var list = $slice.call(aTypedArray$i(this), start, end); var C = speciesConstructor(this, this.constructor); @@ -7597,7 +7801,7 @@ var aTypedArray$j = arrayBufferViewCore.aTypedArray; var exportTypedArrayMethod$j = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.some` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.some +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.some exportTypedArrayMethod$j('some', function some(callbackfn /* , thisArg */) { return $some$1(aTypedArray$j(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7607,7 +7811,7 @@ var exportTypedArrayMethod$k = arrayBufferViewCore.exportTypedArrayMethod; var $sort = [].sort; // `%TypedArray%.prototype.sort` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.sort +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort exportTypedArrayMethod$k('sort', function sort(comparefn) { return $sort.call(aTypedArray$k(this), comparefn); }); @@ -7616,7 +7820,7 @@ var aTypedArray$l = arrayBufferViewCore.aTypedArray; var exportTypedArrayMethod$l = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.subarray` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.subarray +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.subarray exportTypedArrayMethod$l('subarray', function subarray(begin, end) { var O = aTypedArray$l(this); var length = O.length; @@ -7646,7 +7850,7 @@ var FORCED$j = fails(function () { }); // `%TypedArray%.prototype.toLocaleString` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.tolocalestring +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring exportTypedArrayMethod$m('toLocaleString', function toLocaleString() { return $toLocaleString.apply(TO_LOCALE_STRING_BUG ? $slice$1.call(aTypedArray$m(this)) : aTypedArray$m(this), arguments); }, FORCED$j); @@ -7669,7 +7873,7 @@ if (fails(function () { arrayToString.call({}); })) { var IS_NOT_ARRAY_METHOD = Uint8ArrayPrototype.toString != arrayToString; // `%TypedArray%.prototype.toString` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.tostring +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.tostring exportTypedArrayMethod$n('toString', arrayToString, IS_NOT_ARRAY_METHOD); var nativeApply = getBuiltIn('Reflect', 'apply'); @@ -7681,7 +7885,7 @@ var OPTIONAL_ARGUMENTS_LIST = !fails(function () { }); // `Reflect.apply` method -// https://tc39.github.io/ecma262/#sec-reflect.apply +// https://tc39.es/ecma262/#sec-reflect.apply _export({ target: 'Reflect', stat: true, forced: OPTIONAL_ARGUMENTS_LIST }, { apply: function apply(target, thisArgument, argumentsList) { aFunction$1(target); @@ -7695,7 +7899,7 @@ _export({ target: 'Reflect', stat: true, forced: OPTIONAL_ARGUMENTS_LIST }, { var nativeConstruct = getBuiltIn('Reflect', 'construct'); // `Reflect.construct` method -// https://tc39.github.io/ecma262/#sec-reflect.construct +// https://tc39.es/ecma262/#sec-reflect.construct // MS Edge supports only 2 arguments and argumentsList argument is optional // FF Nightly sets third argument as `new.target`, but does not create `this` from it var NEW_TARGET_BUG = fails(function () { @@ -7742,7 +7946,7 @@ var ERROR_INSTEAD_OF_FALSE = fails(function () { }); // `Reflect.defineProperty` method -// https://tc39.github.io/ecma262/#sec-reflect.defineproperty +// https://tc39.es/ecma262/#sec-reflect.defineproperty _export({ target: 'Reflect', stat: true, forced: ERROR_INSTEAD_OF_FALSE, sham: !descriptors }, { defineProperty: function defineProperty(target, propertyKey, attributes) { anObject(target); @@ -7760,7 +7964,7 @@ _export({ target: 'Reflect', stat: true, forced: ERROR_INSTEAD_OF_FALSE, sham: ! var getOwnPropertyDescriptor$8 = objectGetOwnPropertyDescriptor.f; // `Reflect.deleteProperty` method -// https://tc39.github.io/ecma262/#sec-reflect.deleteproperty +// https://tc39.es/ecma262/#sec-reflect.deleteproperty _export({ target: 'Reflect', stat: true }, { deleteProperty: function deleteProperty(target, propertyKey) { var descriptor = getOwnPropertyDescriptor$8(anObject(target), propertyKey); @@ -7769,7 +7973,7 @@ _export({ target: 'Reflect', stat: true }, { }); // `Reflect.get` method -// https://tc39.github.io/ecma262/#sec-reflect.get +// https://tc39.es/ecma262/#sec-reflect.get function get$2(target, propertyKey /* , receiver */) { var receiver = arguments.length < 3 ? target : arguments[2]; var descriptor, prototype; @@ -7787,7 +7991,7 @@ _export({ target: 'Reflect', stat: true }, { }); // `Reflect.getOwnPropertyDescriptor` method -// https://tc39.github.io/ecma262/#sec-reflect.getownpropertydescriptor +// https://tc39.es/ecma262/#sec-reflect.getownpropertydescriptor _export({ target: 'Reflect', stat: true, sham: !descriptors }, { getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) { return objectGetOwnPropertyDescriptor.f(anObject(target), propertyKey); @@ -7795,7 +7999,7 @@ _export({ target: 'Reflect', stat: true, sham: !descriptors }, { }); // `Reflect.getPrototypeOf` method -// https://tc39.github.io/ecma262/#sec-reflect.getprototypeof +// https://tc39.es/ecma262/#sec-reflect.getprototypeof _export({ target: 'Reflect', stat: true, sham: !correctPrototypeGetter }, { getPrototypeOf: function getPrototypeOf(target) { return objectGetPrototypeOf(anObject(target)); @@ -7803,7 +8007,7 @@ _export({ target: 'Reflect', stat: true, sham: !correctPrototypeGetter }, { }); // `Reflect.has` method -// https://tc39.github.io/ecma262/#sec-reflect.has +// https://tc39.es/ecma262/#sec-reflect.has _export({ target: 'Reflect', stat: true }, { has: function has(target, propertyKey) { return propertyKey in target; @@ -7813,7 +8017,7 @@ _export({ target: 'Reflect', stat: true }, { var objectIsExtensible = Object.isExtensible; // `Reflect.isExtensible` method -// https://tc39.github.io/ecma262/#sec-reflect.isextensible +// https://tc39.es/ecma262/#sec-reflect.isextensible _export({ target: 'Reflect', stat: true }, { isExtensible: function isExtensible(target) { anObject(target); @@ -7822,13 +8026,13 @@ _export({ target: 'Reflect', stat: true }, { }); // `Reflect.ownKeys` method -// https://tc39.github.io/ecma262/#sec-reflect.ownkeys +// https://tc39.es/ecma262/#sec-reflect.ownkeys _export({ target: 'Reflect', stat: true }, { ownKeys: ownKeys }); // `Reflect.preventExtensions` method -// https://tc39.github.io/ecma262/#sec-reflect.preventextensions +// https://tc39.es/ecma262/#sec-reflect.preventextensions _export({ target: 'Reflect', stat: true, sham: !freezing }, { preventExtensions: function preventExtensions(target) { anObject(target); @@ -7843,7 +8047,7 @@ _export({ target: 'Reflect', stat: true, sham: !freezing }, { }); // `Reflect.set` method -// https://tc39.github.io/ecma262/#sec-reflect.set +// https://tc39.es/ecma262/#sec-reflect.set function set$3(target, propertyKey, V /* , receiver */) { var receiver = arguments.length < 4 ? target : arguments[3]; var ownDescriptor = objectGetOwnPropertyDescriptor.f(anObject(target), propertyKey); @@ -7869,9 +8073,10 @@ function set$3(target, propertyKey, V /* , receiver */) { // MS Edge 17-18 Reflect.set allows setting the property to object // with non-writable property on the prototype var MS_EDGE_BUG = fails(function () { - var object = objectDefineProperty.f({}, 'a', { configurable: true }); + var Constructor = function () { /* empty */ }; + var object = objectDefineProperty.f(new Constructor(), 'a', { configurable: true }); // eslint-disable-next-line no-undef - return Reflect.set(objectGetPrototypeOf(object), 'a', 1, object) !== false; + return Reflect.set(Constructor.prototype, 'a', 1, object) !== false; }); _export({ target: 'Reflect', stat: true, forced: MS_EDGE_BUG }, { @@ -7879,7 +8084,7 @@ _export({ target: 'Reflect', stat: true, forced: MS_EDGE_BUG }, { }); // `Reflect.setPrototypeOf` method -// https://tc39.github.io/ecma262/#sec-reflect.setprototypeof +// https://tc39.es/ecma262/#sec-reflect.setprototypeof if (objectSetPrototypeOf) _export({ target: 'Reflect', stat: true }, { setPrototypeOf: function setPrototypeOf(target, proto) { anObject(target); @@ -7893,6 +8098,12 @@ if (objectSetPrototypeOf) _export({ target: 'Reflect', stat: true }, { } }); +_export({ global: true }, { Reflect: {} }); + +// Reflect[@@toStringTag] property +// https://tc39.es/ecma262/#sec-reflect-@@tostringtag +setToStringTag(global_1.Reflect, 'Reflect', true); + // iterable DOM collections // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods var domIterables = { @@ -7981,13 +8192,12 @@ _export({ global: true, bind: true, enumerable: true, forced: FORCED$l }, { }); var process$4 = global_1.process; -var isNode = classofRaw(process$4) == 'process'; // `queueMicrotask` method // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask _export({ global: true, enumerable: true, noTargetGet: true }, { queueMicrotask: function queueMicrotask(fn) { - var domain = isNode && process$4.domain; + var domain = engineIsNode && process$4.domain; microtask(domain ? domain.bind(fn) : fn); } }); @@ -8258,7 +8468,7 @@ var deserialize = function (it) { var find$1 = /[!'()~]|%20/g; -var replace = { +var replace$1 = { '!': '%21', "'": '%27', '(': '%28', @@ -8268,7 +8478,7 @@ var replace = { }; var replacer = function (match) { - return replace[match]; + return replace$1[match]; }; var serialize = function (it) { @@ -8360,7 +8570,7 @@ var URLSearchParamsConstructor = function URLSearchParams(/* init */) { var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype; redefineAll(URLSearchParamsPrototype, { - // `URLSearchParams.prototype.appent` method + // `URLSearchParams.prototype.append` method // https://url.spec.whatwg.org/#dom-urlsearchparams-append append: function append(name, value) { validateArgumentsLength(arguments.length, 2); @@ -11145,8 +11355,8 @@ function getPredicateInfo$1(element, xmlDocument) { for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { var property = _step3.value; - if (property.tagName != 'value' && property.tagName != 'annotations') { - result[property.tagName] = parseInt(property.textContent) || 0; + if (property.tagName != 'value' && property.tagName != 'annotations' && property.textContent != '0') { + result[property.tagName] = 1; } } } catch (err) { @@ -12493,6 +12703,20 @@ var TemplateInstance = /*#__PURE__*/function () { return TemplateInstance; }(); +/** + * Our TrustedTypePolicy for HTML which is declared using the html template + * tag function. + * + * That HTML is a developer-authored constant, and is parsed with innerHTML + * before any untrusted expressions have been mixed in. Therefor it is + * considered safe by construction. + */ + +var policy = window.trustedTypes && trustedTypes.createPolicy('lit-html', { + createHTML: function createHTML(s) { + return s; + } +}); var commentMarker = " ".concat(marker, " "); /** * The return type of `html`, which holds a Template and the values from @@ -12571,7 +12795,17 @@ var TemplateResult = /*#__PURE__*/function () { key: "getTemplateElement", value: function getTemplateElement() { var template = document.createElement('template'); - template.innerHTML = this.getHTML(); + var value = this.getHTML(); + + if (policy !== undefined) { + // this is secure because `this.strings` is a TemplateStringsArray. + // TODO: validate this when + // https://github.com/tc39/proposal-array-is-template-object is + // implemented. + value = policy.createHTML(value); + } + + template.innerHTML = value; return template; } }]); @@ -12621,19 +12855,45 @@ var AttributeCommitter = /*#__PURE__*/function () { value: function _getValue() { var strings = this.strings; var l = strings.length - 1; + var parts = this.parts; // If we're assigning an attribute via syntax like: + // attr="${foo}" or attr=${foo} + // but not + // attr="${foo} ${bar}" or attr="${foo} baz" + // then we don't want to coerce the attribute value into one long + // string. Instead we want to just return the value itself directly, + // so that sanitizeDOMValue can get the actual value rather than + // String(value) + // The exception is if v is an array, in which case we do want to smash + // it together into a string without calling String() on the array. + // + // This also allows trusted values (when using TrustedTypes) being + // assigned to DOM sinks without being stringified in the process. + + if (l === 1 && strings[0] === '' && strings[1] === '') { + var v = parts[0].value; + + if (_typeof(v) === 'symbol') { + return String(v); + } + + if (typeof v === 'string' || !isIterable(v)) { + return v; + } + } + var text = ''; for (var i = 0; i < l; i++) { text += strings[i]; - var part = this.parts[i]; + var part = parts[i]; if (part !== undefined) { - var v = part.value; + var _v = part.value; - if (isPrimitive(v) || !isIterable(v)) { - text += typeof v === 'string' ? v : String(v); + if (isPrimitive(_v) || !isIterable(_v)) { + text += typeof _v === 'string' ? _v : String(_v); } else { - var _iterator = _createForOfIteratorHelper(v), + var _iterator = _createForOfIteratorHelper(_v), _step; try { @@ -13326,7 +13586,7 @@ var defaultTemplateProcessor = new DefaultTemplateProcessor(); // TODO(justinfagnani): inject version number at build time if (typeof window !== 'undefined') { - (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.2.1'); + (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.3.0'); } /** * Interprets a template literal as an HTML template that can efficiently @@ -13397,7 +13657,6 @@ var shadyTemplateFactory = function shadyTemplateFactory(scopeName) { return template; }; }; - var TEMPLATE_TYPES = ['html', 'svg']; /** * Removes all style elements from Templates for the given scopeName. @@ -13639,6 +13898,12 @@ var render$1 = function render$1(result, container, options) { */ var _a; /** + * Use this module if you want to create your own base class extending + * [[UpdatingElement]]. + * @packageDocumentation + */ + +/* * When using Closure Compiler, JSCompiler_renameProperty(property, object) is * replaced at compile time by the munged name for object[property]. We cannot * alias this function, so we have to use a small shim that has the same @@ -13713,6 +13978,7 @@ var finalized = 'finalized'; * Base element class which manages element properties and attributes. When * properties change, the `update` method is asynchronously called. This method * should be supplied by subclassers to render updates as desired. + * @noInheritDoc */ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { @@ -13726,24 +13992,6 @@ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { _classCallCheck(this, UpdatingElement); _this = _super.call(this); - _this._updateState = 0; - _this._instanceProperties = undefined; // Initialize to an unresolved Promise so we can make sure the element has - // connected before first update. - - _this._updatePromise = new Promise(function (res) { - return _this._enableUpdatingResolver = res; - }); - /** - * Map with keys for any properties that have changed since the last - * update cycle with previous values. - */ - - _this._changedProperties = new Map(); - /** - * Map with keys of properties that should be reflected when updated. - */ - - _this._reflectingProperties = undefined; _this.initialize(); @@ -13763,11 +14011,19 @@ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { * registered properties. */ value: function initialize() { + var _this2 = this; + + this._updateState = 0; + this._updatePromise = new Promise(function (res) { + return _this2._enableUpdatingResolver = res; + }); + this._changedProperties = new Map(); + this._saveInstanceProperties(); // ensures first update will be caught by an early access of // `updateComplete` - this._requestUpdate(); + this.requestUpdateInternal(); } /** * Fixes any properties set on the instance before upgrade time. @@ -13785,20 +14041,20 @@ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { }, { key: "_saveInstanceProperties", value: function _saveInstanceProperties() { - var _this2 = this; + var _this3 = this; // Use forEach so this works even if for/of loops are compiled to for loops // expecting arrays this.constructor._classProperties.forEach(function (_v, p) { - if (_this2.hasOwnProperty(p)) { - var value = _this2[p]; - delete _this2[p]; + if (_this3.hasOwnProperty(p)) { + var value = _this3[p]; + delete _this3[p]; - if (!_this2._instanceProperties) { - _this2._instanceProperties = new Map(); + if (!_this3._instanceProperties) { + _this3._instanceProperties = new Map(); } - _this2._instanceProperties.set(p, value); + _this3._instanceProperties.set(p, value); } }); } @@ -13809,13 +14065,13 @@ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { }, { key: "_applyInstanceProperties", value: function _applyInstanceProperties() { - var _this3 = this; + var _this4 = this; // Use forEach so this works even if for/of loops are compiled to for loops // expecting arrays // tslint:disable-next-line:no-any this._instanceProperties.forEach(function (v, p) { - return _this3[p] = v; + return _this4[p] = v; }); this._instanceProperties = undefined; @@ -13918,19 +14174,19 @@ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { } } /** - * This private version of `requestUpdate` does not access or return the + * This protected version of `requestUpdate` does not access or return the * `updateComplete` promise. This promise can be overridden and is therefore * not free to access. */ }, { - key: "_requestUpdate", - value: function _requestUpdate(name, oldValue) { + key: "requestUpdateInternal", + value: function requestUpdateInternal(name, oldValue, options) { var shouldRequestUpdate = true; // If we have a property key, perform property update steps. if (name !== undefined) { var ctor = this.constructor; - var options = ctor.getPropertyOptions(name); + options = options || ctor.getPropertyOptions(name); if (ctor._valueHasChanged(this[name], oldValue, options.hasChanged)) { if (!this._changedProperties.has(name)) { @@ -13975,8 +14231,7 @@ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { }, { key: "requestUpdate", value: function requestUpdate(name, oldValue) { - this._requestUpdate(name, oldValue); - + this.requestUpdateInternal(name, oldValue); return this.updateComplete; } /** @@ -14055,7 +14310,14 @@ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { * ``` */ value: function performUpdate() { - // Mixin instance properties once, if they exist. + // Abort any update if one is not pending when this is called. + // This can happen if `performUpdate` is called early to "flush" + // the update. + if (!this._hasRequestedUpdate) { + return; + } // Mixin instance properties once, if they exist. + + if (this._instanceProperties) { this._applyInstanceProperties(); } @@ -14159,13 +14421,13 @@ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { }, { key: "update", value: function update(_changedProperties) { - var _this4 = this; + var _this5 = this; if (this._reflectingProperties !== undefined && this._reflectingProperties.size > 0) { // Use forEach so this works even if for/of loops are compiled to for // loops expecting arrays this._reflectingProperties.forEach(function (v, k) { - return _this4._propertyToAttribute(k, _this4[k], v); + return _this5._propertyToAttribute(k, _this5[k], v); }); this._reflectingProperties = undefined; @@ -14225,7 +14487,7 @@ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { /** @nocollapse */ value: function _ensureClassProperties() { - var _this5 = this; + var _this6 = this; // ensure private storage for property declarations. if (!this.hasOwnProperty(JSCompiler_renameProperty('_classProperties', this))) { @@ -14235,7 +14497,7 @@ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { if (superProperties !== undefined) { superProperties.forEach(function (v, k) { - return _this5._classProperties.set(k, v); + return _this6._classProperties.set(k, v); }); } } @@ -14318,7 +14580,7 @@ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { }, { key: "getPropertyDescriptor", - value: function getPropertyDescriptor(name, key, _options) { + value: function getPropertyDescriptor(name, key, options) { return { // tslint:disable-next-line:no-any no symbol in index get: function get() { @@ -14327,8 +14589,7 @@ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { set: function set(value) { var oldValue = this[name]; this[key] = value; - - this._requestUpdate(name, oldValue); + this.requestUpdateInternal(name, oldValue, options); }, configurable: true, enumerable: true @@ -14464,7 +14725,7 @@ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { }, { key: "observedAttributes", get: function get() { - var _this6 = this; + var _this7 = this; // note: piggy backing on this to ensure we're finalized. this.finalize(); @@ -14472,10 +14733,10 @@ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { // expecting arrays this._classProperties.forEach(function (v, p) { - var attr = _this6._attributeNameForProperty(p, v); + var attr = _this7._attributeNameForProperty(p, v); if (attr !== undefined) { - _this6._attributeToPropertyMap.set(attr, p); + _this7._attributeToPropertyMap.set(attr, p); attributes.push(attr); } @@ -14504,7 +14765,11 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ -var supportsAdoptingStyleSheets = 'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype; + +/** + * Whether the current browser supports `adoptedStyleSheets`. + */ +var supportsAdoptingStyleSheets = window.ShadowRoot && (window.ShadyCSS === undefined || window.ShadyCSS.nativeShadow) && 'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype; var constructionToken = Symbol(); var CSSResult = /*#__PURE__*/function () { function CSSResult(cssText, safeToken) { @@ -14528,8 +14793,8 @@ var CSSResult = /*#__PURE__*/function () { key: "styleSheet", get: function get() { if (this._styleSheet === undefined) { - // Note, if `adoptedStyleSheets` is supported then we assume CSSStyleSheet - // is constructable. + // Note, if `supportsAdoptingStyleSheets` is true then we assume + // CSSStyleSheet is constructable. if (supportsAdoptingStyleSheets) { this._styleSheet = new CSSStyleSheet(); @@ -14545,6 +14810,17 @@ var CSSResult = /*#__PURE__*/function () { return CSSResult; }(); +/** + * Wrap a value for interpolation in a [[`css`]] tagged template literal. + * + * This is unsafe because untrusted CSS text can be used to phone home + * or exfiltrate data to an attacker controlled site. Take care to only use + * this with trusted input. + */ + +var unsafeCSS = function unsafeCSS(value) { + return new CSSResult(String(value), constructionToken); +}; var textFromCSSResult = function textFromCSSResult(value) { if (value instanceof CSSResult) { @@ -14556,10 +14832,10 @@ var textFromCSSResult = function textFromCSSResult(value) { } }; /** - * Template tag which which can be used with LitElement's `style` property to - * set element styles. For security reasons, only literal string values may be - * used. To incorporate non-literal values `unsafeCSS` may be used inside a - * template string part. + * Template tag which which can be used with LitElement's [[LitElement.styles | + * `styles`]] property to set element styles. For security reasons, only literal + * string values may be used. To incorporate non-literal values [[`unsafeCSS`]] + * may be used inside a template string part. */ @@ -14577,13 +14853,22 @@ var css = function css(strings) { // This line will be used in regexes to search for LitElement usage. // TODO(justinfagnani): inject version number at build time -(window['litElementVersions'] || (window['litElementVersions'] = [])).push('2.3.1'); +(window['litElementVersions'] || (window['litElementVersions'] = [])).push('2.4.0'); /** * Sentinal value used to avoid calling lit-html's render function when * subclasses do not implement `render` */ var renderNotImplemented = {}; +/** + * Base element class that manages element properties and attributes, and + * renders a lit-html template. + * + * To define a component, subclass `LitElement` and implement a + * `render` method to provide the component's template. Define properties + * using the [[`properties`]] property or the [[`property`]] decorator. + */ + var LitElement = /*#__PURE__*/function (_UpdatingElement) { _inherits(LitElement, _UpdatingElement); @@ -14599,9 +14884,9 @@ var LitElement = /*#__PURE__*/function (_UpdatingElement) { key: "initialize", /** - * Performs element initialization. By default this calls `createRenderRoot` - * to create the element `renderRoot` node and captures any pre-set values for - * registered properties. + * Performs element initialization. By default this calls + * [[`createRenderRoot`]] to create the element [[`renderRoot`]] node and + * captures any pre-set values for registered properties. */ value: function initialize() { _get(_getPrototypeOf(LitElement.prototype), "initialize", this).call(this); @@ -14632,7 +14917,7 @@ var LitElement = /*#__PURE__*/function (_UpdatingElement) { }); } /** - * Applies styling to the element shadowRoot using the `static get styles` + * Applies styling to the element shadowRoot using the [[`styles`]] * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where * available and will fallback otherwise. When Shadow DOM is polyfilled, * ShadyCSS scopes styles and adds them to the document. When Shadow DOM @@ -14650,7 +14935,7 @@ var LitElement = /*#__PURE__*/function (_UpdatingElement) { return; } // There are three separate cases here based on Shadow DOM support. // (1) shadowRoot polyfilled: use ShadyCSS - // (2) shadowRoot.adoptedStyleSheets available: use it. + // (2) shadowRoot.adoptedStyleSheets available: use it // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after // rendering @@ -14661,7 +14946,7 @@ var LitElement = /*#__PURE__*/function (_UpdatingElement) { }), this.localName); } else if (supportsAdoptingStyleSheets) { this.renderRoot.adoptedStyleSheets = styles.map(function (s) { - return s.styleSheet; + return s instanceof CSSStyleSheet ? s : s.styleSheet; }); } else { // This must be done after rendering so the actual style insertion is done @@ -14723,9 +15008,9 @@ var LitElement = /*#__PURE__*/function (_UpdatingElement) { } /** * Invoked on each update to perform rendering tasks. This method may return - * any value renderable by lit-html's NodePart - typically a TemplateResult. - * Setting properties inside this method will *not* trigger the element to - * update. + * any value renderable by lit-html's `NodePart` - typically a + * `TemplateResult`. Setting properties inside this method will *not* trigger + * the element to update. */ }, { @@ -14763,9 +15048,7 @@ var LitElement = /*#__PURE__*/function (_UpdatingElement) { var userStyles = this.getStyles(); - if (userStyles === undefined) { - this._styles = []; - } else if (Array.isArray(userStyles)) { + if (Array.isArray(userStyles)) { // De-duplicate styles preserving the _last_ instance in the set. // This is a performance optimization to avoid duplicated styles that can // occur especially when composing via subclassing. @@ -14789,8 +15072,29 @@ var LitElement = /*#__PURE__*/function (_UpdatingElement) { }); this._styles = styles; } else { - this._styles = [userStyles]; - } + this._styles = userStyles === undefined ? [] : [userStyles]; + } // Ensure that there are no invalid CSSStyleSheet instances here. They are + // invalid in two conditions. + // (1) the sheet is non-constructible (`sheet` of a HTMLStyleElement), but + // this is impossible to check except via .replaceSync or use + // (2) the ShadyCSS polyfill is enabled (:. supportsAdoptingStyleSheets is + // false) + + + this._styles = this._styles.map(function (s) { + if (s instanceof CSSStyleSheet && !supportsAdoptingStyleSheets) { + // Flatten the cssText from the passed constructible stylesheet (or + // undetectable non-constructible stylesheet). The user might have + // expected to update their stylesheets over time, but the alternative + // is a crash. + var cssText = Array.prototype.slice.call(s.cssRules).reduce(function (css, rule) { + return css + rule.cssText; + }, ''); + return unsafeCSS(cssText); + } + + return s; + }); } }]); @@ -14806,10 +15110,20 @@ var LitElement = /*#__PURE__*/function (_UpdatingElement) { LitElement['finalized'] = true; /** - * Render method used to render the value to the element's DOM. - * @param result The value to render. - * @param container Node into which to render. - * @param options Element name. + * Reference to the underlying library method used to render the element's + * DOM. By default, points to the `render` method from lit-html's shady-render + * module. + * + * **Most users will never need to touch this property.** + * + * This property should not be confused with the `render` instance method, + * which should be overridden to define a template for the element. + * + * Advanced users creating a new base class based on LitElement can override + * this property to point to a custom render method with a signature that + * matches [shady-render's `render` + * method](https://lit-html.polymer-project.org/api/modules/shady_render.html#render). + * * @nocollapse */ @@ -15907,7 +16221,7 @@ function _templateObject2$1() { } function _templateObject$1() { - var data = _taggedTemplateLiteral(["\n :host, .gscape-panel{\n font-family : \"Open Sans\",\"Helvetica Neue\",Helvetica,sans-serif;\n display: block;\n position: absolute;\n color: var(--theme-gscape-on-primary, ", ");\n background-color:var(--theme-gscape-primary, ", ");\n box-shadow: 0 2px 4px 0 var(--theme-gscape-shadows, ", ");\n border-radius: 8px;\n transition: opacity 0.2s;\n scrollbar-width: thin;\n }\n\n :host(:hover){\n box-shadow: 0 4px 8px 0 var(--theme-gscape-shadows, ", ");\n }\n\n .hide {\n display:none;\n }\n\n .widget-body {\n width: 100%;\n max-height:450px;\n border-top:solid 1px var(--theme-gscape-shadows, ", ");\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n overflow:auto;\n scrollbar-width: inherit;\n }\n\n .gscape-panel {\n position: absolute;\n bottom: 40px;\n width: auto;\n padding:10px;\n overflow: unset;\n border: none;\n }\n\n .gscape-panel::after {\n content: \"\";\n position: absolute;\n top: 100%;\n left: 16px;\n margin-left: -8px;\n border-width: 8px;\n border-style: solid;\n border-color: #ddd transparent transparent transparent;\n }\n\n .gscape-panel-title{\n font-weight: bold;\n text-align: center;\n margin-bottom: 10px;\n }\n\n .widget-body .section:last-of-type {\n margin-bottom: 12px;\n }\n\n .widget-body .section-header {\n text-align: center;\n font-weight: bold;\n border-bottom: solid 1px var(--theme-gscape-shadows, ", ");\n color: var(--theme-gscape-secondary, ", ");\n width: 85%;\n margin: auto;\n margin-bottom: 10px;\n padding-bottom: 5px;\n }\n\n .description {\n margin-bottom: 20px;\n }\n\n .description:last-of-type {\n margin-bottom: 0;\n }\n\n .description .language {\n min-width: 50px;\n display: inline-block;\n font-weight: bold;\n color: var(--theme-gscape-secondary, ", ");\n margin: 5px;\n }\n\n .section { padding: 10px; }\n\n .details_table{\n border-spacing: 0;\n }\n\n .details_table th {\n color: var(--theme-gscape-secondary, ", ");\n border-right: solid 1px var(--theme-gscape-shadows, ", ");\n font-weight: bold;\n text-align:left;\n min-width: 50px;\n }\n\n .details_table th, td {\n padding:5px 8px;\n white-space: nowrap;\n }\n\n .highlight:hover {\n color: var(--theme-gscape-on-secondary, ", ");\n background-color:var(--theme-gscape-secondary, ", ");\n }\n\n /* width */\n ::-webkit-scrollbar {\n width: 5px;\n height: 5px;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: #f0f0f0;\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background: #cdcdcd;\n }\n\n /* Handle on hover */\n ::-webkit-scrollbar-thumb:hover {\n background: #888;\n }\n\n .clickable {\n font-weight:bold;\n text-decoration: underline;\n }\n\n .clickable:hover {\n cursor:pointer;\n color: var(--theme-gscape-secondary-dark, ", ");\n }\n\n "]); + var data = _taggedTemplateLiteral(["\n :host, .gscape-panel{\n font-family : \"Open Sans\",\"Helvetica Neue\",Helvetica,sans-serif;\n display: block;\n position: absolute;\n color: var(--theme-gscape-on-primary, ", ");\n background-color:var(--theme-gscape-primary, ", ");\n box-shadow: 0 2px 4px 0 var(--theme-gscape-shadows, ", ");\n border-radius: 8px;\n transition: opacity 0.2s;\n scrollbar-width: thin;\n --mdc-icon-button-size: 24px;\n }\n\n :host(:hover){\n box-shadow: 0 4px 8px 0 var(--theme-gscape-shadows, ", ");\n }\n\n .hide {\n display:none;\n }\n\n .widget-body {\n width: 100%;\n max-height:450px;\n border-top:solid 1px var(--theme-gscape-shadows, ", ");\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n overflow:auto;\n scrollbar-width: inherit;\n }\n\n .gscape-panel {\n position: absolute;\n bottom: 40px;\n width: auto;\n padding:10px;\n overflow: unset;\n border: none;\n }\n\n .gscape-panel::after {\n content: \"\";\n position: absolute;\n top: 100%;\n left: 16px;\n margin-left: -8px;\n border-width: 8px;\n border-style: solid;\n border-color: #ddd transparent transparent transparent;\n }\n\n .gscape-panel-title{\n font-weight: bold;\n text-align: center;\n margin-bottom: 10px;\n }\n\n .widget-body .section:last-of-type {\n margin-bottom: 12px;\n }\n\n .widget-body .section-header {\n text-align: center;\n font-weight: bold;\n border-bottom: solid 1px var(--theme-gscape-shadows, ", ");\n color: var(--theme-gscape-secondary, ", ");\n width: 85%;\n margin: auto;\n margin-bottom: 10px;\n padding-bottom: 5px;\n }\n\n .description {\n margin-bottom: 20px;\n }\n\n .description:last-of-type {\n margin-bottom: 0;\n }\n\n .description .language {\n min-width: 50px;\n display: inline-block;\n font-weight: bold;\n color: var(--theme-gscape-secondary, ", ");\n margin: 5px;\n }\n\n .section { padding: 10px; }\n\n .details_table{\n border-spacing: 0;\n }\n\n .details_table th {\n color: var(--theme-gscape-secondary, ", ");\n border-right: solid 1px var(--theme-gscape-shadows, ", ");\n font-weight: bold;\n text-align:left;\n min-width: 50px;\n }\n\n .details_table th, td {\n padding:5px 8px;\n white-space: nowrap;\n }\n\n .highlight:hover {\n color: var(--theme-gscape-on-secondary, ", ");\n background-color:var(--theme-gscape-secondary, ", ");\n }\n\n /* width */\n ::-webkit-scrollbar {\n width: 5px;\n height: 5px;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: #f0f0f0;\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background: #cdcdcd;\n }\n\n /* Handle on hover */\n ::-webkit-scrollbar-thumb:hover {\n background: #888;\n }\n\n .clickable {\n font-weight:bold;\n text-decoration: underline;\n }\n\n .clickable:hover {\n cursor:pointer;\n color: var(--theme-gscape-secondary-dark, ", ");\n }\n\n "]); _templateObject$1 = function _templateObject() { return data; @@ -16071,10 +16385,15 @@ var GscapeWidget = /*#__PURE__*/function (_LitElement) { value: function blur() { this.collapseBody(); } + }, { + key: "isCustomIcon", + value: function isCustomIcon(icon) { + return typeof icon !== 'string'; + } }, { key: "isVisible", get: function get() { - return this.style.display !== 'none' ? true : false; + return this.style.display !== 'none'; } }, { key: "hiddenDefault", @@ -16096,8 +16415,38 @@ var GscapeWidget = /*#__PURE__*/function (_LitElement) { return GscapeWidget; }(LitElement); //customElements.define('gscape-widget', GscapeWidget) +function _templateObject5$1() { + var data = _taggedTemplateLiteral(["\n :host {\n display:flex;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: var(--header-padding, 8px);\n }\n\n .head-btn {\n color:var(--theme-gscape-on-primary, ", ");\n right:0;\n cursor:pointer;\n }\n\n .head-btn:hover{\n color:var(--theme-gscape-secondary, ", ");\n }\n\n .head-title {\n padding: var(--title-padding, 0 10px);\n box-sizing: border-box;\n font-weight:bold;\n cursor:grab;\n width: var(--title-width, '');\n text-align: var(--title-text-align, 'left');\n justify-self: flex-start;\n }\n\n "]); + + _templateObject5$1 = function _templateObject5() { + return data; + }; + + return data; +} + +function _templateObject4$1() { + var data = _taggedTemplateLiteral(["\n \n "]); + + _templateObject4$1 = function _templateObject4() { + return data; + }; + + return data; +} + +function _templateObject3$1() { + var data = _taggedTemplateLiteral(["", ""]); + + _templateObject3$1 = function _templateObject3() { + return data; + }; + + return data; +} + function _templateObject2$2() { - var data = _taggedTemplateLiteral(["\n :host {\n display:flex;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: var(--header-padding, 8px);\n }\n\n .head-btn {\n color:var(--theme-gscape-on-primary, ", ");\n right:0;\n padding: var(--btn-padding, 0 0 0 5px);\n cursor:pointer;\n }\n\n .head-btn:hover{\n color:var(--theme-gscape-secondary, ", ");\n }\n\n .head-title {\n padding: var(--title-padding, 0 5px 0 0);\n box-sizing: border-box;\n font-weight:bold;\n cursor:grab;\n width: var(--title-width, '');\n text-align: var(--title-text-align, '')\n }\n "]); + var data = _taggedTemplateLiteral(["\n \n ", "\n \n "]); _templateObject2$2 = function _templateObject2() { return data; @@ -16107,7 +16456,7 @@ function _templateObject2$2() { } function _templateObject$2() { - var data = _taggedTemplateLiteral(["\n
", "
\n \n \n ", "\n \n "]); + var data = _taggedTemplateLiteral(["\n ", "\n\n
\n ", "\n
\n \n \n ", "\n \n "]); _templateObject$2 = function _templateObject() { return data; @@ -16136,6 +16485,9 @@ var GscapeHeader = /*#__PURE__*/function (_GscapeWidget) { }, icon: { type: String + }, + left_icon: { + type: String } }; } @@ -16151,6 +16503,7 @@ var GscapeHeader = /*#__PURE__*/function (_GscapeWidget) { _this.initial_icon = 'arrow_drop_down'; _this.secondary_icon = 'arrow_drop_up'; _this.icon = _this.initial_icon; + _this.left_icon = ''; _this.onClick = function () {}; @@ -16160,7 +16513,7 @@ var GscapeHeader = /*#__PURE__*/function (_GscapeWidget) { _createClass(GscapeHeader, [{ key: "render", value: function render() { - return html$1(_templateObject$2(), this.title, this.iconClickHandler, this.icon); + return html$1(_templateObject$2(), this.isCustomIcon(this.left_icon) ? html$1(_templateObject2$2(), this.isCustomIcon(this.left_icon) ? html$1(_templateObject3$1(), this.left_icon) : '') : html$1(_templateObject4$1(), this.left_icon), this.title, this.iconClickHandler, this.icon); } }, { key: "iconClickHandler", @@ -16196,7 +16549,7 @@ var GscapeHeader = /*#__PURE__*/function (_GscapeWidget) { // we don't need super.styles, just the colors from default imported theme var colors = _get(_getPrototypeOf(GscapeHeader), "styles", this)[1]; - return css(_templateObject2$2(), colors.on_primary, colors.secondary); + return css(_templateObject5$1(), colors.on_primary, colors.secondary); } }]); @@ -16204,10 +16557,10 @@ var GscapeHeader = /*#__PURE__*/function (_GscapeWidget) { }(GscapeWidget); customElements.define('gscape-head', GscapeHeader); -function _templateObject3$1() { +function _templateObject3$2() { var data = _taggedTemplateLiteral(["\n \n ", "\n \n "]); - _templateObject3$1 = function _templateObject3() { + _templateObject3$2 = function _templateObject3() { return data; }; @@ -16215,7 +16568,7 @@ function _templateObject3$1() { } function _templateObject2$3() { - var data = _taggedTemplateLiteral(["\n \n\n
\n ", "\n
\n "]); + var data = _taggedTemplateLiteral(["\n \n\n
\n ", "\n
\n "]); _templateObject2$3 = function _templateObject2() { return data; @@ -16277,7 +16630,7 @@ var GscapeDiagramSelector = /*#__PURE__*/function (_GscapeWidget) { var _this2 = this; return html$1(_templateObject2$3(), this.default_title, this.diagrams.map(function (diagram, id) { - return html$1(_templateObject3$1(), _this2.changeDiagram, diagram.name, id, id == _this2.actual_diagram_id ? "selected" : "", diagram.name); + return html$1(_templateObject3$2(), _this2.changeDiagram, diagram.name, id, id == _this2.actual_diagram_id ? "selected" : "", diagram.name); })); } }, { @@ -16317,30 +16670,30 @@ var GscapeDiagramSelector = /*#__PURE__*/function (_GscapeWidget) { }(GscapeWidget); customElements.define('gscape-diagram-selector', GscapeDiagramSelector); -function _templateObject5$1() { +function _templateObject5$2() { var data = _taggedTemplateLiteral(["\n
\n - ", " - ", "\n
\n "]); - _templateObject5$1 = function _templateObject5() { + _templateObject5$2 = function _templateObject5() { return data; }; return data; } -function _templateObject4$1() { +function _templateObject4$2() { var data = _taggedTemplateLiteral(["\n
\n \n keyboard_arrow_right\n ", "\n
", "
\n
\n\n
\n ", "\n
\n \n "]); - _templateObject4$1 = function _templateObject4() { + _templateObject4$2 = function _templateObject4() { return data; }; return data; } -function _templateObject3$2() { - var data = _taggedTemplateLiteral(["\n \n \n \n\n
\n ", "\n
\n "]); +function _templateObject3$3() { + var data = _taggedTemplateLiteral(["\n \n \n \n\n
\n ", "\n
\n "]); - _templateObject3$2 = function _templateObject3() { + _templateObject3$3 = function _templateObject3() { return data; }; @@ -16358,7 +16711,7 @@ function _templateObject2$4() { } function _templateObject$4() { - var data = _taggedTemplateLiteral(["\n :host {\n left:50%;\n top:10px;\n min-width:340px;\n max-width:450px;\n transform: translate(-50%, 0);\n }\n\n .widget-body {\n overflow:auto;\n }\n\n .row{\n line-height: 0;\n display: flex;\n align-items: center;\n padding:4px 0;\n }\n\n .row-label{\n padding-left:5px;\n cursor:pointer;\n width:100%;\n white-space: nowrap;\n }\n\n mwc-icon:hover{\n color: var(--theme-gscape-primary, ", ");\n cursor:pointer;\n }\n\n .type-img{\n width: 20px;\n height: 20px;\n text-align: center;\n line-height: 20px;\n }\n\n .type-img-A{\n background-color: var(--theme-graph-attribute, ", ");\n color: var(--theme-graph-attribute-dark, ", ");\n border: solid 1px var(--theme-graph-attribute-dark, ", ");\n }\n\n .type-img-R{\n background-color: var(--theme-graph-role, ", ");\n color: var(--theme-graph-role-dark, ", ");\n border: solid 1px var(--theme-graph-role-dark, ", ");\n }\n\n .type-img-C{\n background-color: var(--theme-graph-concept, ", ");\n color: var(--theme-graph-concept-dark, ", ");\n border: solid 1px var(--theme-graph-concept-dark, ", ");\n }\n\n .type-img-I{\n background-color: var(--theme-graph-individual, ", ");\n color: var(--theme-graph-individual-dark, ", ");\n border: solid 1px var(--theme-graph-individual-dark, ", ");\n }\n\n .sub-row{\n background-color: var(--theme-gscape-primary-dark, ", ");\n padding: 4px 0 4px 34px;\n cursor: pointer;\n }\n\n .sub-rows-wrapper{\n padding: 2px 0;\n }\n\n .add-shadow{\n box-shadow: 0 2px 2px 0 var(--theme-gscape-shadows, ", ");\n }\n\n gscape-head input {\n position:absolute;\n left: 30%;\n width: 50%;\n padding: 0;\n line-height:22px;\n box-sizing: border-box;\n background-color: var(--theme-gscape-primary, ", ");\n border:none;\n border-bottom: 1px solid var(--theme-gscape-shadows, ", ");\n transition: all .35s ease-in-out;\n color:inherit;\n }\n\n gscape-head input:focus {\n border-color: var(--theme-gscape-secondary, ", ");\n left:0;\n margin: 0px 8px;\n width:80%;\n }\n "]); + var data = _taggedTemplateLiteral(["\n :host {\n left:50%;\n top:10px;\n min-width:370px;\n max-width:450px;\n transform: translate(-50%, 0);\n }\n\n .widget-body {\n overflow:auto;\n }\n\n .row{\n line-height: 0;\n display: flex;\n align-items: center;\n padding:4px 0;\n }\n\n .row-label{\n padding-left:5px;\n cursor:pointer;\n width:100%;\n white-space: nowrap;\n }\n\n mwc-icon:hover{\n color: var(--theme-gscape-primary, ", ");\n cursor:pointer;\n }\n\n .type-img{\n width: 20px;\n height: 20px;\n text-align: center;\n line-height: 20px;\n }\n\n .type-img-A{\n background-color: var(--theme-graph-attribute, ", ");\n color: var(--theme-graph-attribute-dark, ", ");\n border: solid 1px var(--theme-graph-attribute-dark, ", ");\n }\n\n .type-img-R{\n background-color: var(--theme-graph-role, ", ");\n color: var(--theme-graph-role-dark, ", ");\n border: solid 1px var(--theme-graph-role-dark, ", ");\n }\n\n .type-img-C{\n background-color: var(--theme-graph-concept, ", ");\n color: var(--theme-graph-concept-dark, ", ");\n border: solid 1px var(--theme-graph-concept-dark, ", ");\n }\n\n .type-img-I{\n background-color: var(--theme-graph-individual, ", ");\n color: var(--theme-graph-individual-dark, ", ");\n border: solid 1px var(--theme-graph-individual-dark, ", ");\n }\n\n .sub-row{\n background-color: var(--theme-gscape-primary-dark, ", ");\n padding: 4px 0 4px 34px;\n cursor: pointer;\n }\n\n .sub-rows-wrapper{\n padding: 2px 0;\n }\n\n .add-shadow{\n box-shadow: 0 2px 2px 0 var(--theme-gscape-shadows, ", ");\n }\n\n gscape-head input {\n position:initial;\n left: 30%;\n width: 50%;\n padding: 0 10px;\n line-height:23px;\n box-sizing: border-box;\n background-color: var(--theme-gscape-primary, ", ");\n border:none;\n border-bottom: 1px solid var(--theme-gscape-shadows, ", ");\n transition: width .35s ease-in-out;\n color:inherit;\n flex-grow:2;\n font-size:inherit;\n }\n\n gscape-head input:focus {\n position:absolute;\n border-color: var(--theme-gscape-secondary, ", ");\n left: 34px;\n margin: 0px 8px;\n width:75%;\n }\n "]); _templateObject$4 = function _templateObject() { return data; @@ -16414,10 +16767,10 @@ var GscapeExplorer = /*#__PURE__*/function (_GscapeWidget) { return html$1(_templateObject2$4(), letter, letter); } - return html$1(_templateObject3$2(), this.search, Object.keys(this.predicates).map(function (key) { + return html$1(_templateObject3$3(), this.search, Object.keys(this.predicates).map(function (key) { var predicate = _this2.predicates[key]; - return html$1(_templateObject4$1(), predicate.subrows[0].id, predicate.type, predicate.label, _this2.toggleSubRows, getTypeImg(predicate.type), _this2.handleEntitySelection, predicate.label, predicate.subrows.map(function (predicate_instance) { - return html$1(_templateObject5$1(), predicate_instance.diagram.id, predicate_instance.id, _this2.handleNodeSelection, predicate_instance.diagram.name, predicate_instance.id_xml); + return html$1(_templateObject4$2(), predicate.subrows[0].id, predicate.type, predicate.label, _this2.toggleSubRows, getTypeImg(predicate.type), _this2.handleEntitySelection, predicate.label, predicate.subrows.map(function (predicate_instance) { + return html$1(_templateObject5$2(), predicate_instance.diagram.id, predicate_instance.id, _this2.handleNodeSelection, predicate_instance.diagram.name, predicate_instance.id_xml); })); })); } @@ -16553,30 +16906,30 @@ function _templateObject6$1() { return data; } -function _templateObject5$2() { +function _templateObject5$3() { var data = _taggedTemplateLiteral(["", ""]); - _templateObject5$2 = function _templateObject5() { + _templateObject5$3 = function _templateObject5() { return data; }; return data; } -function _templateObject4$2() { +function _templateObject4$3() { var data = _taggedTemplateLiteral(["\n \n ", "\n ", "\n ", "\n \n "]); - _templateObject4$2 = function _templateObject4() { + _templateObject4$3 = function _templateObject4() { return data; }; return data; } -function _templateObject3$3() { +function _templateObject3$4() { var data = _taggedTemplateLiteral(["\n \n ", "\n \n "]); - _templateObject3$3 = function _templateObject3() { + _templateObject3$4 = function _templateObject3() { return data; }; @@ -16605,18 +16958,18 @@ function _templateObject$5() { var annotationsTemplate = (function (entity) { return html$1(_templateObject$5(), entity.annotations && Object.keys(entity.annotations).length > 0 ? html$1(_templateObject2$5(), Object.keys(entity.annotations).map(function (kind) { var annotation = entity.annotations[kind]; - return html$1(_templateObject3$3(), Object.keys(annotation).map(function (language, count) { - return html$1(_templateObject4$2(), count == 0 ? html$1(_templateObject5$2(), kind.charAt(0).toUpperCase() + kind.slice(1)) : '', language, annotation[language]); + return html$1(_templateObject3$4(), Object.keys(annotation).map(function (language, count) { + return html$1(_templateObject4$3(), count == 0 ? html$1(_templateObject5$3(), kind.charAt(0).toUpperCase() + kind.slice(1)) : '', language, annotation[language]); })); })) : '', entity.description && Object.keys(entity.description).length > 0 ? html$1(_templateObject6$1(), Object.keys(entity.description).map(function (language) { return html$1(_templateObject7$1(), language, language != '' ? html$1(_templateObject8$1(), language) : ''); })) : html$1(_templateObject9$1())); }); -function _templateObject3$4() { +function _templateObject3$5() { var data = _taggedTemplateLiteral(["\n \n ", "\n ", "\n \n "]); - _templateObject3$4 = function _templateObject3() { + _templateObject3$5 = function _templateObject3() { return data; }; @@ -16644,7 +16997,7 @@ function _templateObject$6() { } var entityOccurrencesTemplate = (function (occurrences, onNodeNavigation) { return html$1(_templateObject$6(), occurrences && occurrences.length > 0 ? html$1(_templateObject2$6(), occurrences.map(function (occurrence) { - return html$1(_templateObject3$4(), occurrence.diagram_name, occurrence.id, onNodeNavigation, occurrence.id_xml); + return html$1(_templateObject3$5(), occurrence.diagram_name, occurrence.id, onNodeNavigation, occurrence.id_xml); })) : ''); }); @@ -16678,30 +17031,30 @@ function _templateObject6$2() { return data; } -function _templateObject5$3() { +function _templateObject5$4() { var data = _taggedTemplateLiteral([""]); - _templateObject5$3 = function _templateObject5() { + _templateObject5$4 = function _templateObject5() { return data; }; return data; } -function _templateObject4$3() { +function _templateObject4$4() { var data = _taggedTemplateLiteral(["\n \n IRI\n ", "\n \n "]); - _templateObject4$3 = function _templateObject4() { + _templateObject4$4 = function _templateObject4() { return data; }; return data; } -function _templateObject3$5() { +function _templateObject3$6() { var data = _taggedTemplateLiteral(["\n
\n \n \n \n \n \n \n \n \n \n ", "\n
Name", "
Type", "
\n
\n\n
\n ", "\n
\n\n ", "\n "]); - _templateObject3$5 = function _templateObject3() { + _templateObject3$6 = function _templateObject3() { return data; }; @@ -16709,7 +17062,7 @@ function _templateObject3$5() { } function _templateObject2$7() { - var data = _taggedTemplateLiteral(["\n \n
\n ", "\n
\n "]); + var data = _taggedTemplateLiteral(["\n \n
\n ", "\n
\n "]); _templateObject2$7 = function _templateObject2() { return data; @@ -16780,7 +17133,7 @@ var GscapeEntityDetails = /*#__PURE__*/function (_GscapeWidget) { value: function render() { var _this2 = this; - return html$1(_templateObject2$7(), this.entity ? html$1(_templateObject3$5(), this.wikiClickHandler, this.entity.iri.remaining_chars, this.entity.type, this.entity.type != 'individual' ? html$1(_templateObject4$3(), this.entity.iri.full_iri) : html$1(_templateObject5$3()), Object.keys(this.properties).map(function (property) { + return html$1(_templateObject2$7(), this.entity ? html$1(_templateObject3$6(), this.wikiClickHandler, this.entity.iri.remaining_chars, this.entity.type, this.entity.type != 'individual' ? html$1(_templateObject4$4(), this.entity.iri.full_iri) : html$1(_templateObject5$4()), Object.keys(this.properties).map(function (property) { return _this2.entity[property] ? html$1(_templateObject6$2(), _this2.properties[property]) : html$1(_templateObject7$2()); }), annotationsTemplate(this.entity)) : html$1(_templateObject8$2())); } @@ -16871,8 +17224,18 @@ var GscapeEntityDetails = /*#__PURE__*/function (_GscapeWidget) { }(GscapeWidget); customElements.define('gscape-entity-details', GscapeEntityDetails); +function _templateObject3$7() { + var data = _taggedTemplateLiteral(["", ""]); + + _templateObject3$7 = function _templateObject3() { + return data; + }; + + return data; +} + function _templateObject2$8() { - var data = _taggedTemplateLiteral(["\n \n\n ", "\n \n "]); + var data = _taggedTemplateLiteral(["\n \n\n ", "\n ", "\n \n "]); _templateObject2$8 = function _templateObject2() { return data; @@ -16882,7 +17245,7 @@ function _templateObject2$8() { } function _templateObject$8() { - var data = _taggedTemplateLiteral(["\n\n mwc-icon {\n font-size: var(--gscape-button-font-size, 24px)\n }\n\n .btn {\n padding:5px;\n line-height:0;\n cursor: pointer;\n }\n\n .btn:hover {\n color: var(--theme-gscape-secondary, ", ");\n }\n\n .btn[active] {\n color: var(--theme-gscape-secondary, ", ");\n }\n "]); + var data = _taggedTemplateLiteral(["\n\n mwc-icon {\n font-size: var(--gscape-button-font-size, 24px)\n }\n\n .btn {\n padding:5px;\n line-height:0;\n cursor: pointer;\n display: flex;\n align-items: center;\n }\n\n .btn-label {\n font-weight: var(--gscape-button-font-weight, 600);\n padding: 0 5px 0 8px;\n }\n\n .btn:hover {\n color: var(--theme-gscape-secondary, ", ");\n }\n\n .btn[active] {\n color: var(--theme-gscape-secondary, ", ");\n }\n "]); _templateObject$8 = function _templateObject() { return data; @@ -16905,6 +17268,9 @@ var GscapeButton = /*#__PURE__*/function (_GscapeWidget) { }, active: { type: Boolean + }, + label: { + type: String } }; } @@ -16929,16 +17295,19 @@ var GscapeButton = /*#__PURE__*/function (_GscapeWidget) { _this.draggable = draggable; _this.icon = icon; _this.alternate_icon = alt_icon || icon; - _this.onClick = null; + + _this.onClick = function () {}; + _this.highlight = false; _this.active = false; + _this.label = ''; return _this; } _createClass(GscapeButton, [{ key: "render", value: function render() { - return html$1(_templateObject2$8(), this.active, this.clickHandler, this.icon, this.icon); + return html$1(_templateObject2$8(), this.active, this.clickHandler, this.icon, this.icon, this.label ? html$1(_templateObject3$7(), this.label) : ""); } }, { key: "clickHandler", @@ -16992,30 +17361,30 @@ var GscapeButton = /*#__PURE__*/function (_GscapeWidget) { }(GscapeWidget); customElements.define('gscape-button', GscapeButton); -function _templateObject5$4() { +function _templateObject5$5() { var data = _taggedTemplateLiteral(["", ""]); - _templateObject5$4 = function _templateObject5() { + _templateObject5$5 = function _templateObject5() { return data; }; return data; } -function _templateObject4$4() { +function _templateObject4$5() { var data = _taggedTemplateLiteral([""]); - _templateObject4$4 = function _templateObject4() { + _templateObject4$5 = function _templateObject4() { return data; }; return data; } -function _templateObject3$6() { +function _templateObject3$8() { var data = _taggedTemplateLiteral([""]); - _templateObject3$6 = function _templateObject3() { + _templateObject3$8 = function _templateObject3() { return data; }; @@ -17100,7 +17469,7 @@ var GscapeToggle = /*#__PURE__*/function (_GscapeWidget) { _createClass(GscapeToggle, [{ key: "render", value: function render() { - return html$1(_templateObject2$9(), this.label_pos == 'left' ? this.label_span : html$1(_templateObject3$6()), this.key, this.checked, this.disabled, this.clickHandler, this.label_pos == 'right' ? this.label_span : html$1(_templateObject4$4())); + return html$1(_templateObject2$9(), this.label_pos == 'left' ? this.label_span : html$1(_templateObject3$8()), this.key, this.checked, this.disabled, this.clickHandler, this.label_pos == 'right' ? this.label_span : html$1(_templateObject4$5())); } }, { key: "clickHandler", @@ -17128,7 +17497,7 @@ var GscapeToggle = /*#__PURE__*/function (_GscapeWidget) { }, { key: "label_span", get: function get() { - return html$1(_templateObject5$4(), this.label); + return html$1(_templateObject5$5(), this.label); } }]); @@ -17136,10 +17505,10 @@ var GscapeToggle = /*#__PURE__*/function (_GscapeWidget) { }(GscapeWidget); customElements.define('gscape-toggle', GscapeToggle); -function _templateObject3$7() { +function _templateObject3$9() { var data = _taggedTemplateLiteral(["\n ", "\n "]); - _templateObject3$7 = function _templateObject3() { + _templateObject3$9 = function _templateObject3() { return data; }; @@ -17157,7 +17526,7 @@ function _templateObject2$a() { } function _templateObject$a() { - var data = _taggedTemplateLiteral(["\n :host {\n bottom:10px;\n left:10px;\n }\n\n gscape-button{\n position: static;\n }\n\n gscape-toggle {\n padding: 8px;\n }\n\n gscape-toggle[first]{\n justify-content: center;\n border-bottom: 1px solid #ccc;\n margin-bottom: 10px;\n padding: 10px;\n }\n "]); + var data = _taggedTemplateLiteral(["\n :host {\n display:inline-block;\n position: initial;\n margin-right:10px;\n }\n\n gscape-button{\n position: static;\n }\n\n gscape-toggle {\n padding: 8px;\n }\n\n gscape-toggle[first]{\n justify-content: center;\n border-bottom: 1px solid #ccc;\n margin-bottom: 10px;\n padding: 10px;\n }\n "]); _templateObject$a = function _templateObject() { return data; @@ -17241,7 +17610,7 @@ var GscapeFilters = /*#__PURE__*/function (_GscapeWidget) { } toggle.label_pos = 'right'; - return html$1(_templateObject3$7(), toggle); + return html$1(_templateObject3$9(), toggle); })); } }, { @@ -17265,16 +17634,21 @@ var GscapeFilters = /*#__PURE__*/function (_GscapeWidget) { this.btn.active = is_activated; this.btn.requestUpdate(); } + }, { + key: "show", + value: function show() { + if (this.isEnabled) this.style.display = 'inline-block'; + } }]); return GscapeFilters; }(GscapeWidget); customElements.define('gscape-filters', GscapeFilters); -function _templateObject3$8() { +function _templateObject3$a() { var data = _taggedTemplateLiteral(["\n \n ", "\n ", "\n \n "]); - _templateObject3$8 = function _templateObject3() { + _templateObject3$a = function _templateObject3() { return data; }; @@ -17292,7 +17666,7 @@ function _templateObject2$b() { } function _templateObject$b() { - var data = _taggedTemplateLiteral(["\n :host {\n bottom:10px;\n left:52px;\n }\n\n .gscape-panel {\n padding-right: 0;\n }\n\n gscape-button {\n position: static;\n }\n\n .iri-dict th.table-header{\n text-align: center;\n padding: 12px;\n font-weight: bold;\n border-right: 0;\n color: var(--theme-gscape-on-primary, ", ");\n }\n\n .iri-dict th {\n color: var(--theme-gscape-on-primary, ", ");\n border-right: solid 1px var(--theme-gscape-shadows, ", ");\n text-align: left;\n font-weight: normal;\n }\n\n .wrapper {\n overflow-y: auto;\n scrollbar-width: inherit;\n max-height: 420px;\n overflow-x: hidden;\n padding-right: 10px;\n }\n\n .section {\n padding-left: 0;\n padding-right: 0;\n }\n "]); + var data = _taggedTemplateLiteral(["\n :host {\n display:inline-block;\n position: initial;\n margin-right:10px;\n }\n\n .gscape-panel {\n padding-right: 0;\n }\n\n gscape-button {\n position: static;\n }\n\n .iri-dict th.table-header{\n text-align: center;\n padding: 12px;\n font-weight: bold;\n border-right: 0;\n color: var(--theme-gscape-on-primary, ", ");\n }\n\n .iri-dict th {\n color: var(--theme-gscape-on-primary, ", ");\n border-right: solid 1px var(--theme-gscape-shadows, ", ");\n text-align: left;\n font-weight: normal;\n }\n\n .wrapper {\n overflow-y: auto;\n scrollbar-width: inherit;\n max-height: 420px;\n overflow-x: hidden;\n padding-right: 10px;\n }\n\n .section {\n padding-left: 0;\n padding-right: 0;\n }\n "]); _templateObject$b = function _templateObject() { return data; @@ -17334,7 +17708,7 @@ var GscapeOntologyInfo = /*#__PURE__*/function (_GscapeWidget) { value: function render() { return html$1(_templateObject2$b(), this.btn, this.ontology.name, this.ontology.version, annotationsTemplate(this.ontology), _toConsumableArray(this.ontology.namespaces).map(function (iri) { if (!iri.isStandard()) { - return html$1(_templateObject3$8(), iri.prefixes[0], iri.value); + return html$1(_templateObject3$a(), iri.prefixes[0], iri.value); } })); } @@ -17358,14 +17732,30 @@ var GscapeOntologyInfo = /*#__PURE__*/function (_GscapeWidget) { }); } } + }, { + key: "show", + value: function show() { + if (this.isEnabled) this.style.display = 'inline-block'; + } }]); return GscapeOntologyInfo; }(GscapeWidget); customElements.define('gscape-ontology-info', GscapeOntologyInfo); +function _templateObject$c() { + var data = _taggedTemplateLiteral([""]); + + _templateObject$c = function _templateObject() { + return data; + }; + + return data; +} +var owl_icon = html$1(_templateObject$c()); + function _templateObject2$c() { - var data = _taggedTemplateLiteral(["\n
\n
\n
\n \n "]); + var data = _taggedTemplateLiteral(["\n
\n
\n
\n ", "\n "]); _templateObject2$c = function _templateObject2() { return data; @@ -17374,10 +17764,10 @@ function _templateObject2$c() { return data; } -function _templateObject$c() { - var data = _taggedTemplateLiteral(["\n :host {\n left:50%;\n bottom:10px;\n transform: translate(-50%, 0);\n }\n\n gscape-head {\n --title-text-align: center;\n --title-width: 100%;\n }\n\n .widget-body {\n margin:0;\n border-top: none;\n border-bottom: 1px solid var(--theme-gscape-shadows, ", ");\n border-bottom-left-radius:0;\n border-bottom-right-radius:0;\n }\n\n .owl-text {\n padding: 15px 10px;\n font-family: \"Lucida Console\", Monaco, monospace;\n overflow: auto;\n white-space: nowrap;\n line-height: 1.5;\n }\n\n .owl_concept{\n color: #b58900;\n }\n\n .owl_role{\n color: #268bd2;\n }\n\n .owl_attribute{\n color: #859900;\n }\n\n .owl_value-domain{\n color: #2aa198;\n }\n\n .owl_individual{\n color: #6c71c4;\n }\n\n .owl_value {\n color: #d33682;\n }\n\n .axiom_predicate_prefix{\n color:#cb4b16;\n }\n\n .owl_error {\n color: var(--theme-gscape-error, ", ");\n }\n\n .axiom_predefinite_obj {\n color: #00c0a0;\n }\n\n "]); +function _templateObject$d() { + var data = _taggedTemplateLiteral(["\n :host {\n left:50%;\n bottom:10px;\n transform: translate(-50%, 0);\n max-width:60%;\n }\n\n gscape-head {\n --title-text-align: center;\n --title-width: 100%;\n }\n\n .widget-body {\n margin:0;\n border-top: none;\n border-bottom: 1px solid var(--theme-gscape-shadows, ", ");\n border-bottom-left-radius:0;\n border-bottom-right-radius:0;\n }\n\n .owl-text {\n padding: 15px 10px;\n font-family: \"Lucida Console\", Monaco, monospace;\n overflow: auto;\n white-space: nowrap;\n line-height: 1.5;\n }\n\n .owl_concept{\n color: #b58900;\n }\n\n .owl_role{\n color: #268bd2;\n }\n\n .owl_attribute{\n color: #859900;\n }\n\n .owl_value-domain{\n color: #2aa198;\n }\n\n .owl_individual{\n color: #6c71c4;\n }\n\n .owl_value {\n color: #d33682;\n }\n\n .axiom_predicate_prefix{\n color:#cb4b16;\n }\n\n .owl_error {\n color: var(--theme-gscape-error, ", ");\n }\n\n .axiom_predefinite_obj {\n color: #00c0a0;\n }\n\n "]); - _templateObject$c = function _templateObject() { + _templateObject$d = function _templateObject() { return data; }; @@ -17402,7 +17792,7 @@ var GscapeOwlTranslator = /*#__PURE__*/function (_GscapeWidget) { var super_styles = _get(_getPrototypeOf(GscapeOwlTranslator), "styles", this); var colors = super_styles[1]; - return [_get(_getPrototypeOf(GscapeOwlTranslator), "styles", this)[0], css(_templateObject$c(), colors.shadows, colors.error)]; + return [_get(_getPrototypeOf(GscapeOwlTranslator), "styles", this)[0], css(_templateObject$d(), colors.shadows, colors.error)]; } }]); @@ -17415,13 +17805,16 @@ var GscapeOwlTranslator = /*#__PURE__*/function (_GscapeWidget) { _this.collapsible = true; _this.hiddenDefault = true; _this.owl_text = ''; + _this.header = new GscapeHeader(); + _this.header.title = 'Owl Translation'; + _this.header.left_icon = owl_icon; return _this; } _createClass(GscapeOwlTranslator, [{ key: "render", value: function render() { - return html$1(_templateObject2$c()); + return html$1(_templateObject2$c(), this.header); } }, { key: "updated", @@ -17450,10 +17843,10 @@ function _templateObject2$d() { return data; } -function _templateObject$d() { +function _templateObject$e() { var data = _taggedTemplateLiteral(["\n :host {\n position: absolute;\n bottom:52px;\n right:10px;\n }\n\n gscape-button{\n position: static;\n box-shadow: initial;\n }\n\n #hr {\n height:1px;\n width:90%;\n margin: 2px auto 0 auto;\n background-color: var(--theme-gscape-shadows, ", ")\n }\n\n "]); - _templateObject$d = function _templateObject() { + _templateObject$e = function _templateObject() { return data; }; @@ -17471,7 +17864,7 @@ var GscapeZoomTools = /*#__PURE__*/function (_GscapeWidget) { var super_styles = _get(_getPrototypeOf(GscapeZoomTools), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$d(), colors.shadows)]; + return [super_styles[0], css(_templateObject$e(), colors.shadows)]; } }]); @@ -17846,6 +18239,21 @@ var GrapholscapeRenderer = /*#__PURE__*/function () { _this.cy.container().style.cursor = 'inherit'; }); } + /** + * WHY NOT USING cy.mount(container)?? + * because it causes a problem with float renderer. + * In particular at the second time this.mount() will be + * called, the layout will stop working, something happens internally + * breaking the layout. + * + * WHY SWITCHING FROM display:none TO position:absolute?? + * display:none will cause the container having clientHeight(Width) = 0 + * and cytoscpae uses those values to perform the fit(). + * This will cause problems when switching renderers cause in some + * cases fit() will be automatically called on the container having + * zero asdimensions + */ + _createClass(GrapholscapeRenderer, [{ key: "mount", @@ -18098,6 +18506,8 @@ var FloatingGscapeRenderer = /*#__PURE__*/function (_GrapholscapeRenderer) { _createClass(FloatingGscapeRenderer, [{ key: "drawDiagram", value: function drawDiagram(diagram) { + var _this2 = this; + this.clearPoppers(); _get(_getPrototypeOf(FloatingGscapeRenderer.prototype), "drawDiagram", this).call(this, diagram); @@ -18106,11 +18516,20 @@ var FloatingGscapeRenderer = /*#__PURE__*/function (_GrapholscapeRenderer) { this.main_layout = this.layout(); // apply layout on those not locked this.main_layout.run(); + /** + * hack: let layout run a bit and fit to it. + * Prevent some diagrams to disappear from screen due to + * automatic layout. + */ + + setTimeout(function () { + return _this2.cy.fit(); + }, 100); } }, { key: "centerOnNode", value: function centerOnNode(node_id, zoom) { - var _this2 = this; + var _this3 = this; var node = this.cy.$id(node_id); @@ -18120,13 +18539,13 @@ var FloatingGscapeRenderer = /*#__PURE__*/function (_GrapholscapeRenderer) { if (node.data('type') == 'role') { var elems = node.connectedNodes(); setTimeout(function () { - return _this2.cy.fit(elems); + return _this3.cy.fit(elems); }, 300); node.select(); elems.select(); } else { setTimeout(function () { - return _this2.centerOnPosition(node.position('x'), node.position('y'), zoom); + return _this3.centerOnPosition(node.position('x'), node.position('y'), zoom); }, 300); node.select(); } @@ -18141,42 +18560,45 @@ var FloatingGscapeRenderer = /*#__PURE__*/function (_GrapholscapeRenderer) { }, { key: "unlockNode", value: function unlockNode(node) { - node.unlockButton.destroy(); + this.removeUnlockButton(node); node.unlock(); } }, { key: "lockNode", value: function lockNode(node) { - var _this3 = this; + var _this4 = this; node.lock(); var unlockButton = node.popper({ content: function content() { - var dimension = node.data('width') / 9 * _this3.cy.zoom(); + var dimension = node.data('width') / 9 * _this4.cy.zoom(); var div = document.createElement('div'); div.style.background = node.style('border-color'); div.style.borderRadius = '100%'; div.style.padding = '5px'; - div.style.color = _this3.theme.on_secondary; + div.style.color = _this4.theme.on_secondary; div.style.cursor = 'pointer'; div.setAttribute('title', 'Unlock Node'); div.innerHTML = "lock_open"; setStyle(dimension, div); div.onclick = function () { - return _this3.unlockNode(node); + return _this4.unlockNode(node); }; - document.body.appendChild(div); - return div; - } //popper: {} // my popper options here + _this4.cy.container().appendChild(div); + return div; + }, + popper: { + removeOnDestroy: true + } }); node.unlockButton = unlockButton; var update = function update() { - var dimension = node.data('width') / 9 * _this3.cy.zoom(); + var dimension = node.data('width') / 9 * _this4.cy.zoom(); setStyle(dimension, unlockButton.popper); unlockButton.scheduleUpdate(); @@ -18208,16 +18630,26 @@ var FloatingGscapeRenderer = /*#__PURE__*/function (_GrapholscapeRenderer) { }, { key: "clearPoppers", value: function clearPoppers() { + var _this5 = this; + this.cy.nodes().each(function (node) { - if (node.unlockButton) node.unlockButton.destroy(); + return _this5.removeUnlockButton(node); }); } }, { key: "unmount", value: function unmount() { - _get(_getPrototypeOf(FloatingGscapeRenderer.prototype), "unmount", this).call(this); - this.clearPoppers(); + + _get(_getPrototypeOf(FloatingGscapeRenderer.prototype), "unmount", this).call(this); + } + }, { + key: "removeUnlockButton", + value: function removeUnlockButton(node) { + if (node.unlockButton) { + node.unlockButton.destroy(); + node.unlockButton = null; + } } }, { key: "layout_settings", @@ -18253,11 +18685,11 @@ var FloatingGscapeRenderer = /*#__PURE__*/function (_GrapholscapeRenderer) { }, { key: "dragAndPin", set: function set(active) { - var _this4 = this; + var _this6 = this; this._dragAndPin = active; if (!active) this.cy.$(':locked').each(function (node) { - return _this4.unlockNode(node); + return _this6.unlockNode(node); }); }, get: function get() { @@ -18268,31 +18700,41 @@ var FloatingGscapeRenderer = /*#__PURE__*/function (_GrapholscapeRenderer) { return FloatingGscapeRenderer; }(GrapholscapeRenderer); -function _templateObject$e() { - var data = _taggedTemplateLiteral(["\n\n"]); +function _templateObject$f() { + var data = _taggedTemplateLiteral(["\n\n"]); - _templateObject$e = function _templateObject() { + _templateObject$f = function _templateObject() { return data; }; return data; } -var graphol = html$1(_templateObject$e()); +var graphol_logo = html$1(_templateObject$f()); -function _templateObject4$5() { - var data = _taggedTemplateLiteral(["", ""]); +function _templateObject5$6() { + var data = _taggedTemplateLiteral(["\n \n "]); - _templateObject4$5 = function _templateObject4() { + _templateObject5$6 = function _templateObject5() { return data; }; return data; } -function _templateObject3$9() { - var data = _taggedTemplateLiteral(["\n \n ", "\n ", "\n \n "]); +function _templateObject4$6() { + var data = _taggedTemplateLiteral(["\n ", ""]); - _templateObject3$9 = function _templateObject3() { + _templateObject4$6 = function _templateObject4() { + return data; + }; + + return data; +} + +function _templateObject3$b() { + var data = _taggedTemplateLiteral(["\n \n ", "\n ", "\n \n "]); + + _templateObject3$b = function _templateObject3() { return data; }; @@ -18300,7 +18742,7 @@ function _templateObject3$9() { } function _templateObject2$e() { - var data = _taggedTemplateLiteral(["\n
\n ", "\n
\n\n \n "]); + var data = _taggedTemplateLiteral(["\n
\n ", "\n
\n\n ", "\n "]); _templateObject2$e = function _templateObject2() { return data; @@ -18309,10 +18751,10 @@ function _templateObject2$e() { return data; } -function _templateObject$f() { - var data = _taggedTemplateLiteral(["\n :host {\n bottom:10px;\n left: 136px;\n }\n\n .renderer-item {\n cursor:pointer;\n padding:5px 10px;\n display: flex;\n align-items: center;\n }\n\n .renderer-item:hover {\n color: var(--theme-gscape-on-secondary, ", ");\n background-color:var(--theme-gscape-secondary, ", ");\n }\n\n .renderer-item:first-of-type {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n .selected {\n background-color: var(--theme-gscape-primary-dark, ", ");\n color: var(--theme-gscape-on-primary-dark, ", ");\n font-weight: bold;\n }\n\n .widget-body {\n margin:0;\n border-top: none;\n border-bottom: 1px solid var(--theme-gscape-shadows, ", ");\n border-radius: inherit;\n border-bottom-left-radius:0;\n border-bottom-right-radius:0;\n }\n\n gscape-head {\n --header-padding: 5px 8px;\n }\n\n mwc-icon {\n padding-right:8px;\n }\n\n svg {\n height: 20px;\n width: auto;\n padding: 2px;\n margin-right:8px;\n }\n "]); +function _templateObject$g() { + var data = _taggedTemplateLiteral(["\n :host {\n display:inline-block;\n position:initial;\n margin-right:10px;\n }\n\n .renderer-item {\n cursor:pointer;\n padding:5px 10px;\n display: flex;\n align-items: center;\n }\n\n .renderer-item:hover {\n color: var(--theme-gscape-on-secondary, ", ");\n background-color:var(--theme-gscape-secondary, ", ");\n }\n\n .renderer-item:first-of-type {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n .renderer-item > .name {\n padding:0 10px;\n }\n\n .selected {\n background-color: var(--theme-gscape-primary-dark, ", ");\n color: var(--theme-gscape-on-primary-dark, ", ");\n font-weight: bold;\n }\n\n .widget-body {\n margin:0;\n border-top: none;\n border-bottom: 1px solid var(--theme-gscape-shadows, ", ");\n border-radius: inherit;\n border-bottom-left-radius:0;\n border-bottom-right-radius:0;\n }\n\n gscape-head {\n --header-padding: 5px 8px;\n }\n\n svg {\n margin-right:8px;\n }\n "]); - _templateObject$f = function _templateObject() { + _templateObject$g = function _templateObject() { return data; }; @@ -18339,7 +18781,7 @@ var GscapeRenderSelector = /*#__PURE__*/function (_GscapeWidget) { var super_styles = _get(_getPrototypeOf(GscapeRenderSelector), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$f(), colors.on_secondary, colors.secondary, colors.primary_dark, colors.on_primary_dark, colors.shadows)]; + return [super_styles[0], css(_templateObject$g(), colors.on_secondary, colors.secondary, colors.primary_dark, colors.on_primary_dark, colors.shadows)]; } }]); @@ -18354,7 +18796,7 @@ var GscapeRenderSelector = /*#__PURE__*/function (_GscapeWidget) { _this.dict = { "default": { name: "Graphol", - icon: "" + icon: graphol_logo }, lite: { name: "Graphol-Lite", @@ -18367,6 +18809,9 @@ var GscapeRenderSelector = /*#__PURE__*/function (_GscapeWidget) { }; _this.actual_mode = 'default'; _this._onRendererChange = {}; + _this.header = new GscapeHeader(); + _this.header.title = _this.dict[_this.actual_mode].name; + _this.header.left_icon = _this.dict[_this.actual_mode].icon; return _this; } @@ -18376,8 +18821,8 @@ var GscapeRenderSelector = /*#__PURE__*/function (_GscapeWidget) { var _this2 = this; return html$1(_templateObject2$e(), Object.keys(this.renderers).map(function (mode) { - return html$1(_templateObject3$9(), _this2.changeRenderer, mode, mode == _this2.actual_mode ? "selected" : "", mode == 'default' ? graphol : html$1(_templateObject4$5(), _this2.dict[mode].icon), _this2.dict[mode].name); - }), this.dict[this.actual_mode].name); + return html$1(_templateObject3$b(), _this2.changeRenderer, mode, mode == _this2.actual_mode ? "selected" : "", _this2.isCustomIcon(_this2.dict[mode].icon) ? html$1(_templateObject4$6(), _this2.dict[mode].icon) : html$1(_templateObject5$6(), _this2.dict[mode].icon), _this2.dict[mode].name); + }), this.header); } }, { key: "changeRenderer", @@ -18387,6 +18832,7 @@ var GscapeRenderSelector = /*#__PURE__*/function (_GscapeWidget) { target.classList.add('selected'); var mode = target.getAttribute('mode'); this.header.title = this.dict[mode].name; + this.header.left_icon = this.dict[mode].icon; this.actual_mode = mode; this._onRendererChange(mode); @@ -18399,6 +18845,11 @@ var GscapeRenderSelector = /*#__PURE__*/function (_GscapeWidget) { this.header.invertIcons(); } + }, { + key: "show", + value: function show() { + if (this.isEnabled) this.style.display = 'inline-block'; + } }, { key: "onRendererChange", set: function set(f) { @@ -18420,10 +18871,10 @@ function _templateObject2$f() { return data; } -function _templateObject$g() { +function _templateObject$h() { var data = _taggedTemplateLiteral(["\n :host {\n left: 50%;\n bottom: 10px;\n transform: translate(-50%, 0);\n }\n\n gscape-head span {\n display: flex;\n }\n\n .widget-body {\n margin:0;\n border-top: none;\n border-bottom: 1px solid var(--theme-gscape-shadows, ", ");\n border-radius: inherit;\n border-bottom-left-radius:0;\n border-bottom-right-radius:0;\n }\n\n gscape-head {\n --header-padding: 5px 8px;\n --title-padding: 0 30px 0 0;\n --btn-padding: 0 0 0 10px;\n }\n\n gscape-toggle {\n margin-left: 50px;\n }\n\n .wrapper {\n display:flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px;\n }\n\n .title {\n padding: 0 5px 0 0;\n font-weight:bold;\n }\n\n .toggles-wrapper {\n display: flex;\n }\n "]); - _templateObject$g = function _templateObject() { + _templateObject$h = function _templateObject() { return data; }; @@ -18446,7 +18897,7 @@ var GscapeLayoutSettings = /*#__PURE__*/function (_GscapeWidget) { var super_styles = _get(_getPrototypeOf(GscapeLayoutSettings), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$g(), colors.shadows)]; + return [super_styles[0], css(_templateObject$h(), colors.shadows)]; } }]); @@ -18473,16 +18924,16 @@ var GscapeLayoutSettings = /*#__PURE__*/function (_GscapeWidget) { }(GscapeWidget); customElements.define('gscape-layout-settings', GscapeLayoutSettings); -function _templateObject$h() { +function _templateObject$i() { var data = _taggedTemplateLiteral(["\n\n\n\n\t\n\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\n"]); - _templateObject$h = function _templateObject() { + _templateObject$i = function _templateObject() { return data; }; return data; } -var grapholscape = html$1(_templateObject$h()); +var grapholscape = html$1(_templateObject$i()); function _templateObject10$1() { var data = _taggedTemplateLiteral([""]); @@ -18534,30 +18985,30 @@ function _templateObject6$3() { return data; } -function _templateObject5$5() { +function _templateObject5$7() { var data = _taggedTemplateLiteral(["\n
\n
\n
", "
\n
", "
\n
\n ", "\n\n ", "\n
\n "]); - _templateObject5$5 = function _templateObject5() { + _templateObject5$7 = function _templateObject5() { return data; }; return data; } -function _templateObject4$6() { +function _templateObject4$7() { var data = _taggedTemplateLiteral(["\n
\n
", "
\n\n ", "\n
\n "]); - _templateObject4$6 = function _templateObject4() { + _templateObject4$7 = function _templateObject4() { return data; }; return data; } -function _templateObject3$a() { +function _templateObject3$c() { var data = _taggedTemplateLiteral([""]); - _templateObject3$a = function _templateObject3() { + _templateObject3$c = function _templateObject3() { return data; }; @@ -18565,7 +19016,7 @@ function _templateObject3$a() { } function _templateObject2$g() { - var data = _taggedTemplateLiteral(["\n ", "\n\n
\n
Settings
\n\n
\n\n ", "\n\n
\n
About
\n
\n ", "\n
\n\n
\n Version: \n ", "\n
\n
\n
\n "]); + var data = _taggedTemplateLiteral(["\n ", "\n\n
\n
Settings
\n\n
\n\n ", "\n\n
\n
Export Ontology Image
\n
\n
\n
Image
\n
Save a PNG image of the current diagram on your disk
\n
\n\n
\n ", "\n
\n
\n\n
\n
\n
Vectorial
\n
Save an SVG of the current diagram on your disk
\n
\n\n
\n ", "\n
\n
\n
\n\n
\n
About
\n
\n ", "\n
\n\n
\n Version: \n ", "\n
\n
\n
\n "]); _templateObject2$g = function _templateObject2() { return data; @@ -18574,10 +19025,10 @@ function _templateObject2$g() { return data; } -function _templateObject$i() { - var data = _taggedTemplateLiteral(["\n :host {\n bottom:10px;\n left: 94px;\n padding-right:0;\n }\n\n gscape-button {\n position: static;\n }\n\n .gscape-panel {\n padding-right: 0;\n }\n\n .settings-wrapper {\n overflow-y: auto;\n scrollbar-width: inherit;\n max-height: 420px;\n overflow-x: hidden;\n white-space: nowrap;\n padding-right: 20px;\n }\n\n .area {\n margin-bottom: 30px;\n }\n\n .area:last-of-type {\n margin-bottom: 0;\n }\n\n .area-title {\n font-weight: bold;\n margin-bottom: 5px;\n font-size: 105%;\n }\n\n .setting {\n padding: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .title-wrap {\n margin-right: 50px;\n }\n\n .setting-label {\n font-size : 12px;\n opacity: 0.7;\n }\n\n #logo {\n text-align:center;\n }\n\n #logo svg {\n width: 40%;\n height: auto;\n margin: 20px 0;\n }\n\n #version {\n text-align: center;\n font-size: 14px;\n }\n "]); +function _templateObject$j() { + var data = _taggedTemplateLiteral(["\n :host {\n display:inline-block;\n position: initial;\n margin-right:10px;\n }\n\n gscape-button {\n position: static;\n }\n\n .gscape-panel {\n padding-right: 0;\n }\n\n .settings-wrapper {\n overflow-y: auto;\n scrollbar-width: inherit;\n max-height: 420px;\n overflow-x: hidden;\n white-space: nowrap;\n padding-right: 20px;\n }\n\n .area {\n margin-bottom: 30px;\n }\n\n .area:last-of-type {\n margin-bottom: 0;\n }\n\n .area-title {\n font-weight: bold;\n margin-bottom: 5px;\n font-size: 105%;\n }\n\n .setting {\n padding: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .title-wrap {\n margin-right: 50px;\n }\n\n .setting-label {\n font-size : 12px;\n opacity: 0.7;\n }\n\n #logo {\n text-align:center;\n }\n\n #logo svg {\n width: 40%;\n height: auto;\n margin: 20px 0;\n }\n\n #version {\n text-align: center;\n font-size: 14px;\n }\n "]); - _templateObject$i = function _templateObject() { + _templateObject$j = function _templateObject() { return data; }; @@ -18595,7 +19046,7 @@ var GscapeSettings = /*#__PURE__*/function (_GscapeWidget) { var super_styles = _get(_getPrototypeOf(GscapeSettings), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$i())]; + return [super_styles[0], css(_templateObject$j())]; } }]); @@ -18610,6 +19061,10 @@ var GscapeSettings = /*#__PURE__*/function (_GscapeWidget) { _this.btn = new GscapeButton('settings'); _this.btn.onClick = _this.toggleBody.bind(_assertThisInitialized(_this)); _this.callbacks = {}; + _this.savePNGButton = new GscapeButton('save'); + _this.savePNGButton.label = 'PNG'; + _this.saveSVGButton = new GscapeButton('save'); + _this.saveSVGButton.label = 'SVG'; return _this; } @@ -18619,22 +19074,51 @@ var GscapeSettings = /*#__PURE__*/function (_GscapeWidget) { var _this2 = this; return html$1(_templateObject2$g(), this.btn, Object.keys(this.settings).map(function (area_entry) { - if (area_entry == 'default') return html$1(_templateObject3$a()); + if (area_entry == 'default') return html$1(_templateObject3$c()); var area = _this2.settings[area_entry]; - return html$1(_templateObject4$6(), capitalizeFirstLetter(area_entry), Object.keys(area).map(function (setting_entry) { + return html$1(_templateObject4$7(), capitalizeFirstLetter(area_entry), Object.keys(area).map(function (setting_entry) { var setting = area[setting_entry]; - return html$1(_templateObject5$5(), setting.title, setting.label, setting.type == 'list' ? html$1(_templateObject6$3(), area_entry, setting_entry, _this2.onListChange, setting.list.map(function (option) { + return html$1(_templateObject5$7(), setting.title, setting.label, setting.type == 'list' ? html$1(_templateObject6$3(), area_entry, setting_entry, _this2.onListChange, setting.list.map(function (option) { if (option.value == '') return; var selected = option.value == setting.selected; return html$1(_templateObject7$3(), option.value, selected, option.label); })) : html$1(_templateObject8$3()), setting.type == 'boolean' ? html$1(_templateObject9$2(), new GscapeToggle(setting_entry, setting.enabled, false, '', _this2.onToggleChange.bind(_this2))) : html$1(_templateObject10$1())); })); - }), grapholscape, "1.1.0"); + }), this.savePNGButton, this.saveSVGButton, grapholscape, "1.2.0"); function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } } + }, { + key: "updated", + value: function updated(changedProperties) { + var _this3 = this; + + /** + * when controller change a property in this.settings, lit element doesn't see it + * (this.settings should be assigned to a completely new object (new reference) + * for lit element to notice it). + * So controller forces the update and in that case litElement will update even if + * no property has changed. + * So if it has been updated forcefully from controller, then react to each change + */ + if (changedProperties.size == 0) { + this.shadowRoot.querySelectorAll('select').forEach(function (list) { + _this3.onListChange({ + target: list + }); + }); + this.shadowRoot.querySelectorAll('gscape-toggle').forEach(function (toggle) { + // onToggleChange uses toggle.id because it gets the elem + toggle.id = toggle.key; + + _this3.onToggleChange({ + target: toggle + }); + }); + } + } }, { key: "onListChange", value: function onListChange(e) { @@ -18650,6 +19134,11 @@ var GscapeSettings = /*#__PURE__*/function (_GscapeWidget) { this.settings.widgets[toggle.id].enabled = toggle.checked; toggle.checked ? this.callbacks.widgetEnable(toggle.id) : this.callbacks.widgetDisable(toggle.id); } + }, { + key: "show", + value: function show() { + if (this.isEnabled) this.style.display = 'inline-block'; + } }, { key: "onEntityNameSelection", set: function set(foo) { @@ -18675,6 +19164,16 @@ var GscapeSettings = /*#__PURE__*/function (_GscapeWidget) { set: function set(foo) { this.callbacks.widgetDisable = foo; } + }, { + key: "onPNGSaveButtonClick", + set: function set(foo) { + this.savePNGButton.onClick = foo; + } + }, { + key: "onSVGSaveButtonClick", + set: function set(foo) { + this.saveSVGButton.onClick = foo; + } }]); return GscapeSettings; @@ -18691,10 +19190,10 @@ function _templateObject2$h() { return data; } -function _templateObject$j() { +function _templateObject$k() { var data = _taggedTemplateLiteral(["\n .loader {\n border: 3px solid ", ";\n border-radius: 50%;\n border-top: 3px solid ", ";\n width: 30px;\n height: 30px;\n -webkit-animation: spin 1s linear infinite; /* Safari */\n animation: spin 1s linear infinite;\n box-sizing: border-box;\n position:absolute;\n top:50%;\n left: 50%;\n margin-top: -15px;\n margin-left: -15px;\n }\n\n /* Safari */\n @-webkit-keyframes spin {\n 0% { -webkit-transform: rotate(0deg); }\n 100% { -webkit-transform: rotate(360deg); }\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "]); - _templateObject$j = function _templateObject() { + _templateObject$k = function _templateObject() { return data; }; @@ -18709,7 +19208,7 @@ var GscapeSpinner = /*#__PURE__*/function (_LitElement) { _createClass(GscapeSpinner, null, [{ key: "styles", get: function get() { - return css(_templateObject$j(), gscape.shadows, gscape.secondary); + return css(_templateObject$k(), gscape.shadows, gscape.secondary); } }]); @@ -18740,10 +19239,10 @@ var GscapeSpinner = /*#__PURE__*/function (_LitElement) { }(LitElement); customElements.define('gscape-spinner', GscapeSpinner); -function _templateObject3$b() { +function _templateObject3$d() { var data = _taggedTemplateLiteral(["

", "

"]); - _templateObject3$b = function _templateObject3() { + _templateObject3$d = function _templateObject3() { return data; }; @@ -18760,10 +19259,10 @@ function _templateObject2$i() { return data; } -function _templateObject$k() { +function _templateObject$l() { var data = _taggedTemplateLiteral(["\n :host {\n top: 30%;\n left: 50%;\n max-width: 500px;\n transform: translate(-50%, 0);\n }\n\n .widget-body {\n padding : 10px;\n width: initial;\n }\n\n .widget-body.error {\n background : var(--theme-gscape-error, ", ");\n color : var(--theme-gscape-on-error, ", ");\n }\n\n gscape-head {\n --title-text-align : center;\n --title-width : 100%;\n }\n\n gscape-head.error {\n color : var(--theme-gscape-error, ", ");\n }\n\n gscape-head.warning {\n color : var(--theme-gscape-warning, ", ");\n }\n "]); - _templateObject$k = function _templateObject() { + _templateObject$l = function _templateObject() { return data; }; @@ -18793,7 +19292,7 @@ var GscapeDialog = /*#__PURE__*/function (_GscapeWidget) { var super_styles = _get(_getPrototypeOf(GscapeDialog), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$k(), colors.error, colors.on_error, colors.error, colors.warning)]; + return [super_styles[0], css(_templateObject$l(), colors.error, colors.on_error, colors.error, colors.warning)]; } }]); @@ -18813,7 +19312,7 @@ var GscapeDialog = /*#__PURE__*/function (_GscapeWidget) { key: "render", value: function render() { return html$1(_templateObject2$i(), this.type, this.type.toLowerCase(), this.type.toLowerCase(), this.text.map(function (text) { - return html$1(_templateObject3$b(), text); + return html$1(_templateObject3$d(), text); })); } // override @@ -18847,7 +19346,7 @@ var GscapeDialog = /*#__PURE__*/function (_GscapeWidget) { customElements.define('gscape-dialog', GscapeDialog); function _templateObject2$j() { - var data = _taggedTemplateLiteral(["\n \n
\n ", "\n
\n "]); + var data = _taggedTemplateLiteral(["\n \n
\n ", "\n
\n "]); _templateObject2$j = function _templateObject2() { return data; @@ -18856,10 +19355,10 @@ function _templateObject2$j() { return data; } -function _templateObject$l() { +function _templateObject$m() { var data = _taggedTemplateLiteral(["\n :host {\n top:50%;\n transform: translate(0, -50%);\n left:10px;\n }\n\n .widget-body {\n max-height: 250px;\n }\n\n gscape-head {\n --title-text-align: center;\n --title-width: 100%;\n }\n\n .details_table {\n margin:5px 0;\n }\n "]); - _templateObject$l = function _templateObject() { + _templateObject$m = function _templateObject() { return data; }; @@ -18886,7 +19385,7 @@ var GscapeEntityOccurrences = /*#__PURE__*/function (_GscapeWidget) { var super_styles = _get(_getPrototypeOf(GscapeEntityOccurrences), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$l())]; + return [super_styles[0], css(_templateObject$m())]; } }]); @@ -18934,6 +19433,17 @@ var GscapeEntityOccurrences = /*#__PURE__*/function (_GscapeWidget) { }(GscapeWidget); customElements.define('gscape-entity-occurrences', GscapeEntityOccurrences); +var bottom_left_container = (function () { + var div = document.createElement('div'); + div.style.setProperty('position', 'absolute'); + div.style.setProperty('bottom', '0'); + div.style.setProperty('left', '0'); + div.style.setProperty('margin', '10px'); + div.style.setProperty('display', 'flex'); + div.style.setProperty('align-items', 'flex-end'); + return div; +}); + var GrapholscapeView = /*#__PURE__*/function () { function GrapholscapeView(container) { _classCallCheck(this, GrapholscapeView); @@ -18963,6 +19473,8 @@ var GrapholscapeView = /*#__PURE__*/function () { this.container.appendChild(this.spinner); this.dialog = new GscapeDialog(); this.container.appendChild(this.dialog); + this.themes = {}; + Object.assign(this.themes, themes); } _createClass(GrapholscapeView, [{ @@ -19009,7 +19521,7 @@ var GrapholscapeView = /*#__PURE__*/function () { zoom_widget.onZoomOut = this.zoomOut.bind(this); this.widgets.set('zoom_widget', zoom_widget); this.renderer_selector = new GscapeRenderSelector(this.renderers); - this.renderer_selector.onRendererChange = this.changeRenderingMode.bind(this); + this.renderer_selector.onRendererChange = this.onRenderingModeChange; this.widgets.set('simplifications', this.renderer_selector); this.layout_settings = new GscapeLayoutSettings(); @@ -19030,6 +19542,8 @@ var GrapholscapeView = /*#__PURE__*/function () { this.settings_widget.onThemeSelection = this.onThemeSelection.bind(this); this.settings_widget.onWidgetEnabled = this.onWidgetEnabled.bind(this); this.settings_widget.onWidgetDisabled = this.onWidgetDisabled.bind(this); + this.settings_widget.onPNGSaveButtonClick = this.onExportToPNG; + this.settings_widget.onSVGSaveButtonClick = this.onExportToSVG; this.widgets.set('settings_widget', this.settings_widget); Object.keys(this.renderers).forEach(function (renderer) { return _this.registerEvents(_this.renderers[renderer]); @@ -19039,22 +19553,29 @@ var GrapholscapeView = /*#__PURE__*/function () { if (!this.settings.widgets[widget_name].enabled) this.onWidgetDisabled(widget_name); } + var widget_container = bottom_left_container(); this.widgets.forEach(function (widget, key) { - _this.container.appendChild(widget); - switch (key) { case 'filters': case 'ontology_info': case 'settings_widget': case 'simplifications': + widget_container.appendChild(widget); + widget.onToggleBody = function () { return _this.blurAll(widget); }; + break; + + default: + _this.container.appendChild(widget); + break; } }); - if (this.settings.rendering.theme.selected != 'custom') this.setTheme(themes[this.settings.rendering.theme.selected]); + this.container.appendChild(widget_container); + if (this.settings.rendering.theme.selected != 'custom') this.setTheme(this.themes[this.settings.rendering.theme.selected]); } }, { key: "registerEvents", @@ -19222,7 +19743,7 @@ var GrapholscapeView = /*#__PURE__*/function () { }, { key: "setRenderer", value: function setRenderer(renderer) { - for (name in this.renderers) { + for (var name in this.renderers) { if (this.renderers[name]) this.renderers[name].unmount(); } @@ -19308,7 +19829,7 @@ var GrapholscapeView = /*#__PURE__*/function () { }, { key: "onThemeSelection", value: function onThemeSelection(theme_name) { - theme_name == 'custom' ? this.setTheme(this.custom_theme) : this.setTheme(themes[theme_name]); + this.setTheme(this.themes[theme_name]); } }, { key: "setTheme", @@ -19327,24 +19848,25 @@ var GrapholscapeView = /*#__PURE__*/function () { theme_aux[key] = color; }); - this.graph_container.style.background = theme.background; // Apply theme to graph + this.graph_container.style.background = typeof theme.background == 'string' ? theme.background : theme.background.cssText; // Apply theme to graph Object.keys(this.renderers).map(function (key) { _this5.renderers[key].setTheme(theme_aux); }); } }, { - key: "setCustomTheme", - value: function setCustomTheme(new_theme) { + key: "registerCustomTheme", + value: function registerCustomTheme(new_theme, key_value) { var _this6 = this; - this.custom_theme = JSON.parse(JSON.stringify(gscape)); + // new custom theme will be based on gscape default theme + this.themes[key_value] = JSON.parse(JSON.stringify(gscape)); // each new custom colour will overwrite the default one + Object.keys(new_theme).forEach(function (color) { - if (_this6.custom_theme[color]) { - _this6.custom_theme[color] = new_theme[color]; + if (_this6.themes[key_value][color]) { + _this6.themes[key_value][color] = new_theme[color]; } }); - this.setTheme(this.custom_theme); } }, { key: "showWidget", @@ -20561,6 +21083,17 @@ var default_config = /*#__PURE__*/Object.freeze({ 'default': config }); +var downloadBlob = (function (blob, fileName) { + var a = document.createElement('a'); + document.body.appendChild(a); + a.style.setProperty('style', 'none'); + var url = window.URL.createObjectURL(blob); + a.href = url; + a.download = fileName; + a.click(); + window.URL.revokeObjectURL(url); +}); + var GrapholscapeController = /*#__PURE__*/function () { function GrapholscapeController(ontology) { var _this = this; @@ -20644,9 +21177,11 @@ var GrapholscapeController = /*#__PURE__*/function () { this.view.onNodeSelection = this.onNodeSelection.bind(this); this.view.onBackgroundClick = this.onBackgroundClick.bind(this); this.view.onEdgeSelection = this.onEdgeSelection.bind(this); - this.view.onRenderingModeChange = this.onRenderingModeChange.bind(this); + this.view.onRenderingModeChange = this.changeRenderingMode.bind(this); this.view.onEntityNameTypeChange = this.onEntityNameTypeChange.bind(this); this.view.onLanguageChange = this.onLanguageChange.bind(this); + this.view.onExportToPNG = this.exportToPNG.bind(this); + this.view.onExportToSVG = this.exportToSVG.bind(this); this.view.createUi(ontologyViewData, diagramsViewData, entitiesViewData, this.config); } /** @@ -20839,24 +21374,49 @@ var GrapholscapeController = /*#__PURE__*/function () { this.view.showOwlTranslation(owl_text); } } + /** + * Change the rendering mode. + * @param {string} mode - the rendering/simplifation mode to activate: `default`, `lite`, or `float` + * @param {boolean} keep_viewport_state - if `false`, viewport will fit on diagram. + * Set it `true` if you don't want the viewport state to change. + * In case of no diagram displayed yet, it will be forced to `false`. + * Default: `true`. + * + * > Note: in case of activation or deactivation of the `float` mode, this value will be ignored. + */ + }, { - key: "onRenderingModeChange", - value: function onRenderingModeChange(mode, state) { + key: "changeRenderingMode", + value: function changeRenderingMode(mode) { var _this4 = this; + var keep_viewport_state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + this.view.blurAll(); + if (mode === this.actualMode) return; + var old_mode = this.actualMode; // if we change to lite or default mode, coming from float mode, + // and we didn't define a new viewport state, then reset viewport + // to fit the diagram because there's no equivalence in float graph + // and other graphs, unlike lite and default mode which have fixed + // positions for nodes. + + var shouldHardResetViewport = mode != 'float' && old_mode == 'float' || mode == 'float'; + var new_viewport_state = keep_viewport_state && !shouldHardResetViewport ? this.view.renderer.getActualPosition() : null; this.actualMode = mode; + this.view.widgets.get('simplifications').actual_mode = mode; + mode == 'float' ? this.view.showWidget('layout_settings') : this.view.hideWidget('layout_settings'); switch (mode) { case 'lite': case 'float': { this.SimplifiedOntologyPromise.then(function () { + // async code, actualMode may be changed if (_this4.actualMode === mode) { - _this4.ontology = _this4.ontologies[mode]; - - _this4.updateGraphView(state); - - _this4.updateEntitiesList(); + try { + performChange.bind(_this4)(); + } catch (e) { + console.log(e); + } } }); break; @@ -20864,30 +21424,50 @@ var GrapholscapeController = /*#__PURE__*/function () { case 'default': { - this.ontology = this.ontologies["default"]; - this.updateGraphView(state); - this.updateEntitiesList(); + performChange.bind(this)(); break; } } - } - /** - * Change the rendering mode. - * @param {string} mode - the rendering/simplifation mode to activate: `graphol`, `lite`, or `float` - * @param {boolean} keep_viewport_state - if `false`, viewport will fit on diagram. - * Set it `true` if you don't want the viewport state to change. - * In case of no diagram displayed yet, it will be forced to `false`. - * Default: `true`. - * - * > Note: in case of activation or deactivation of the `float` mode, this value will be ignored. - */ - }, { - key: "changeRenderingMode", - value: function changeRenderingMode(mode) { - var keep_viewport_state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - this.view.changeRenderingMode(mode, keep_viewport_state); - this.view.widgets.get('simplifications').actual_mode = mode; + function performChange() { + var _this5 = this; + + this.ontology = this.ontologies[mode]; + this.view.setRenderer(this.view.renderers[mode]); + Object.keys(this.view.filters).map(function (key) { + if (key != 'all' && key != 'attributes' && key != 'individuals') { + if (mode == 'float' || mode == 'lite') { + // disable all unnecessary filters + _this5.view.filters[key].disabled = true; + } + + if (mode == 'default') { + // enable filters that may have been disabled by lite mode + _this5.view.filters[key].disabled = false; + if (key == 'value_domain' && _this5.view.filters.attributes.active) _this5.view.filters.value_domain.disabled = true; + } + } + }); + this.updateGraphView(new_viewport_state); + this.updateEntitiesList(); + this.view.widgets.get('filters').requestUpdate(); + + if (shouldHardResetViewport) { + /* + * HACKY + * WHY TIMEOUT? + * mount() and unmount() from cytoscape create issues with labels + * in float mode. to avoid that grapholscape mount and unmount + * renderers using display:none. this somehow causes container to get + * zero as both dimensions inside cytoscape even after setting display:block + * and it fails to perform the fit() operation. + * waiting a little bit assure those dimensions to have correct values. + */ + setTimeout(function () { + return _this5.view.resetView(); + }, 250); + } + } } /** * Redraw actual diagram and set viewport state. If state is not passed, viewport is not changed. @@ -20909,10 +21489,10 @@ var GrapholscapeController = /*#__PURE__*/function () { }, { key: "updateEntitiesList", value: function updateEntitiesList() { - var _this5 = this; + var _this6 = this; var entitiesViewData = this.ontology.getEntities().map(function (entity) { - return _this5.entityModelToViewData(entity); + return _this6.entityModelToViewData(entity); }); this.view.updateEntitiesList(entitiesViewData); } @@ -20925,17 +21505,17 @@ var GrapholscapeController = /*#__PURE__*/function () { }, { key: "onEntityNameTypeChange", value: function onEntityNameTypeChange(type) { - var _this6 = this; + var _this7 = this; this.SimplifiedOntologyPromise.then(function () { - Object.keys(_this6.ontologies).forEach(function (key) { - var entities = _this6.ontologies[key].getEntities(false); // get cytoscape nodes + Object.keys(_this7.ontologies).forEach(function (key) { + var entities = _this7.ontologies[key].getEntities(false); // get cytoscape nodes switch (type) { case 'label': entities.forEach(function (entity) { - if (entity.data('label')[_this6.language]) entity.data('displayed_name', entity.data('label')[_this6.language]);else if (entity.data('label')[_this6.default_language]) entity.data('displayed_name', entity.data('label')[_this6.default_language]);else { + if (entity.data('label')[_this7.language]) entity.data('displayed_name', entity.data('label')[_this7.language]);else if (entity.data('label')[_this7.default_language]) entity.data('displayed_name', entity.data('label')[_this7.default_language]);else { var first_label_key = Object.keys(entity.data('label'))[0]; entity.data('displayed_name', entity.data('label')[first_label_key]); } @@ -20957,9 +21537,9 @@ var GrapholscapeController = /*#__PURE__*/function () { } }); - _this6.updateGraphView(_this6.view.renderer.getActualPosition()); + _this7.updateGraphView(_this7.view.renderer.getActualPosition()); - _this6.updateEntitiesList(); + _this7.updateEntitiesList(); }); } /* @@ -20975,39 +21555,95 @@ var GrapholscapeController = /*#__PURE__*/function () { this.onEntityNameTypeChange(this.config.preferences.entity_name.selected); } + /** + * Update the actual configuration and apply changes. + * @param {Object} new_config - a configuration object. Please read [wiki/settings](https://github.com/obdasystems/grapholscape/wiki/Settings) + */ + }, { key: "setConfig", value: function setConfig(new_config) { - var _this7 = this; + var _this8 = this; Object.keys(new_config).forEach(function (entry) { // if custom theme if (entry == 'theme' && _typeof(new_config[entry]) == 'object') { - _this7.view.setCustomTheme(new_config[entry]); + var custom_theme_value = "custom"; - _this7.config.rendering.theme.list.push({ - value: 'custom', - label: 'Custom' - }); + _this8.config.rendering.theme.list.push({ + value: custom_theme_value, + label: new_config[entry].name || 'Custom' + }); // if marked with selected, update the 'selected' field in config - _this7.config.rendering.theme.selected = 'custom'; - return; // continue to next entry and skip next for - } - for (var area in _this7.config) { - try { - var setting = _this7.config[area][entry]; + if (new_config[entry].selected) _this8.config.rendering.theme.selected = custom_theme_value; // remove metadata from theme in order to get only colours + + delete new_config[entry].name; + delete new_config[entry].selected; + + _this8.view.registerCustomTheme(new_config[entry], custom_theme_value); + } else { + for (var area in _this8.config) { + try { + var setting = _this8.config[area][entry]; - if (setting) { - // apply custom settings only if they match type and are defined in lists - if (setting.type == 'boolean' && typeof new_config[entry] == 'boolean') _this7.config[area][entry].enabled = new_config[entry];else if (_this7.config[area][entry].list.map(function (elm) { - return elm.value; - }).includes(new_config[entry])) _this7.config[area][entry].selected = new_config[entry]; + if (setting) { + // apply custom settings only if they match type and are defined in lists + if (setting.type == 'boolean' && typeof new_config[entry] == 'boolean') _this8.config[area][entry].enabled = new_config[entry];else if (_this8.config[area][entry].list.map(function (elm) { + return elm.value; + }).includes(new_config[entry])) _this8.config[area][entry].selected = new_config[entry]; + } + } catch (e) { + console.warn("Custom default setting [".concat(entry, "] not recognized")); } - } catch (e) {} + } } }); + /* + * setting widget observes this.config object reference, not internal properties. + * Forcing the update it will render using the new config internal properties + * reacting to each change. + */ + + this.view.settings_widget.requestUpdate(); + } + /** + * Export the current diagram in to a PNG image and save it on user's disk + * @param {String} fileName - the name to assign to the file + * (Default: [ontology name]-[diagram name]-v[ontology version]) + */ + + }, { + key: "exportToPNG", + value: function exportToPNG() { + var fileName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + fileName = fileName || this.export_file_name + '.png'; + this.view.renderer.cy.png(this.export_options).then(function (blob) { + return downloadBlob(blob, fileName); + }); + } + /** + * Export the current diagram in to a SVG file and save it on user's disk + * @param {String} fileName - the name to assign to the file + * (Default: [ontology name]-[diagram name]-v[ontology version]) + */ + + }, { + key: "exportToSVG", + value: function exportToSVG() { + var fileName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + console.log(this.export_options.bg); + fileName = fileName || this.export_file_name + '.svg'; + var svg_content = this.view.renderer.cy.svg(this.export_options); + var blob = new Blob([svg_content], { + type: "image/svg+xml;charset=utf-8" + }); + downloadBlob(blob, fileName); } + /* + * Options for exports, blob-promise + */ + }, { key: "entityModelToViewData", value: function entityModelToViewData(entityModelData) { @@ -21072,6 +21708,25 @@ var GrapholscapeController = /*#__PURE__*/function () { }; return JSON.parse(JSON.stringify(diagramViewData)); } + }, { + key: "export_options", + get: function get() { + var bg = this.view.themes[this.config.rendering.theme.selected].background.cssText || this.view.themes[this.config.rendering.theme.selected].background; + return { + output: 'blob-promise', + full: true, + bg: bg + }; + } + /* + ** Filename for exports: [ontology name]-[diagram name]-v[ontology version]) + */ + + }, { + key: "export_file_name", + get: function get() { + return "".concat(this.ontology.name, "-").concat(this.actual_diagram.name, "-v").concat(this.ontology.version); + } }, { key: "ontology", set: function set(ontology) { @@ -21135,6 +21790,7 @@ var GrapholscapeController = /*#__PURE__*/function () { cytoscape.use(popper); cytoscape.use(cola); +cytoscape.use(cy_svg); var GrapholScape = /*#__PURE__*/function () { function GrapholScape(file) { diff --git a/dist/grapholscape.js b/dist/grapholscape.js index 2517f8cb..cffba6b5 100644 --- a/dist/grapholscape.js +++ b/dist/grapholscape.js @@ -36,7 +36,7 @@ } }; - // Thank's IE8 for his funny defineProperty + // Detect IE8's incomplete defineProperty implementation var descriptors = !fails(function () { return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); @@ -69,7 +69,7 @@ check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func - Function('return this')(); + (function () { return this; })() || Function('return this')(); var isObject = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; @@ -97,7 +97,7 @@ }; // `ToPrimitive` abstract operation - // https://tc39.github.io/ecma262/#sec-toprimitive + // https://tc39.es/ecma262/#sec-toprimitive // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string var toPrimitive = function (input, PREFERRED_STRING) { @@ -112,7 +112,7 @@ var nativeDefineProperty = Object.defineProperty; // `Object.defineProperty` method - // https://tc39.github.io/ecma262/#sec-object.defineproperty + // https://tc39.es/ecma262/#sec-object.defineproperty var f = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); @@ -137,7 +137,7 @@ var NAME = 'name'; // Function instances `.name` property - // https://tc39.github.io/ecma262/#sec-function-instances-name + // https://tc39.es/ecma262/#sec-function-instances-name if (descriptors && !(NAME in FunctionPrototype)) { defineProperty(FunctionPrototype, NAME, { configurable: true, @@ -186,9 +186,9 @@ (module.exports = function (key, value) { return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.6.5', + version: '3.8.2', mode: 'global', - copyright: '© 2020 Denis Pushkarev (zloirock.ru)' + copyright: '© 2021 Denis Pushkarev (zloirock.ru)' }); }); @@ -275,11 +275,12 @@ }; if (nativeWeakMap) { - var store$1 = new WeakMap$2(); + var store$1 = sharedStore.state || (sharedStore.state = new WeakMap$2()); var wmget = store$1.get; var wmhas = store$1.has; var wmset = store$1.set; set = function (it, metadata) { + metadata.facade = it; wmset.call(store$1, it, metadata); return metadata; }; @@ -293,6 +294,7 @@ var STATE = sharedKey('state'); hiddenKeys[STATE] = true; set = function (it, metadata) { + metadata.facade = it; createNonEnumerableProperty(it, STATE, metadata); return metadata; }; @@ -321,9 +323,15 @@ var unsafe = options ? !!options.unsafe : false; var simple = options ? !!options.enumerable : false; var noTargetGet = options ? !!options.noTargetGet : false; + var state; if (typeof value == 'function') { - if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key); - enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : ''); + if (typeof key == 'string' && !has(value, 'name')) { + createNonEnumerableProperty(value, 'name', key); + } + state = enforceInternalState(value); + if (!state.source) { + state.source = TEMPLATE.join(typeof key == 'string' ? key : ''); + } } if (O === global_1) { if (simple) O[key] = value; @@ -372,13 +380,13 @@ }; // `Object.prototype.toString` method implementation - // https://tc39.github.io/ecma262/#sec-object.prototype.tostring + // https://tc39.es/ecma262/#sec-object.prototype.tostring var objectToString = toStringTagSupport ? {}.toString : function toString() { return '[object ' + classof(this) + ']'; }; // `Object.prototype.toString` method - // https://tc39.github.io/ecma262/#sec-object.prototype.tostring + // https://tc39.es/ecma262/#sec-object.prototype.tostring if (!toStringTagSupport) { redefine(Object.prototype, 'toString', objectToString, { unsafe: true }); } @@ -390,7 +398,7 @@ var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation - // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable + // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable var f$1 = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor(this, V); return !!descriptor && descriptor.enumerable; @@ -412,7 +420,7 @@ } : Object; // `RequireObjectCoercible` abstract operation - // https://tc39.github.io/ecma262/#sec-requireobjectcoercible + // https://tc39.es/ecma262/#sec-requireobjectcoercible var requireObjectCoercible = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; @@ -429,7 +437,7 @@ var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method - // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor + // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor var f$2 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPrimitive(P, true); @@ -458,7 +466,7 @@ var floor = Math.floor; // `ToInteger` abstract operation - // https://tc39.github.io/ecma262/#sec-tointeger + // https://tc39.es/ecma262/#sec-tointeger var toInteger = function (argument) { return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); }; @@ -466,7 +474,7 @@ var min = Math.min; // `ToLength` abstract operation - // https://tc39.github.io/ecma262/#sec-tolength + // https://tc39.es/ecma262/#sec-tolength var toLength = function (argument) { return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; @@ -504,10 +512,10 @@ var arrayIncludes = { // `Array.prototype.includes` method - // https://tc39.github.io/ecma262/#sec-array.prototype.includes + // https://tc39.es/ecma262/#sec-array.prototype.includes includes: createMethod(true), // `Array.prototype.indexOf` method - // https://tc39.github.io/ecma262/#sec-array.prototype.indexof + // https://tc39.es/ecma262/#sec-array.prototype.indexof indexOf: createMethod(false) }; @@ -541,7 +549,7 @@ var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method - // https://tc39.github.io/ecma262/#sec-object.getownpropertynames + // https://tc39.es/ecma262/#sec-object.getownpropertynames var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return objectKeysInternal(O, hiddenKeys$1); }; @@ -733,28 +741,38 @@ || iterators[classof(it)]; }; - // call something on iterator step with safe closing on error - var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) { - try { - return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); - // 7.4.6 IteratorClose(iterator, completion) - } catch (error) { - var returnMethod = iterator['return']; - if (returnMethod !== undefined) anObject(returnMethod.call(iterator)); - throw error; + var iteratorClose = function (iterator) { + var returnMethod = iterator['return']; + if (returnMethod !== undefined) { + return anObject(returnMethod.call(iterator)).value; } }; - var iterate_1 = createCommonjsModule(function (module) { var Result = function (stopped, result) { this.stopped = stopped; this.result = result; }; - var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) { - var boundFunction = functionBindContext(fn, that, AS_ENTRIES ? 2 : 1); + var iterate = function (iterable, unboundFunction, options) { + var that = options && options.that; + var AS_ENTRIES = !!(options && options.AS_ENTRIES); + var IS_ITERATOR = !!(options && options.IS_ITERATOR); + var INTERRUPTED = !!(options && options.INTERRUPTED); + var fn = functionBindContext(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED); var iterator, iterFn, index, length, result, next, step; + var stop = function (condition) { + if (iterator) iteratorClose(iterator); + return new Result(true, condition); + }; + + var callFn = function (value) { + if (AS_ENTRIES) { + anObject(value); + return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); + } return INTERRUPTED ? fn(value, stop) : fn(value); + }; + if (IS_ITERATOR) { iterator = iterable; } else { @@ -763,9 +781,7 @@ // optimisation for array iterators if (isArrayIteratorMethod(iterFn)) { for (index = 0, length = toLength(iterable.length); length > index; index++) { - result = AS_ENTRIES - ? boundFunction(anObject(step = iterable[index])[0], step[1]) - : boundFunction(iterable[index]); + result = callFn(iterable[index]); if (result && result instanceof Result) return result; } return new Result(false); } @@ -774,16 +790,16 @@ next = iterator.next; while (!(step = next.call(iterator)).done) { - result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES); + try { + result = callFn(step.value); + } catch (error) { + iteratorClose(iterator); + throw error; + } if (typeof result == 'object' && result && result instanceof Result) return result; } return new Result(false); }; - iterate.stop = function (result) { - return new Result(true, result); - }; - }); - var ITERATOR$2 = wellKnownSymbol('iterator'); var SAFE_CLOSING = false; @@ -824,7 +840,7 @@ var SPECIES$1 = wellKnownSymbol('species'); // `SpeciesConstructor` abstract operation - // https://tc39.github.io/ecma262/#sec-speciesconstructor + // https://tc39.es/ecma262/#sec-speciesconstructor var speciesConstructor = function (O, defaultConstructor) { var C = anObject(O).constructor; var S; @@ -837,6 +853,8 @@ var engineIsIos = /(iphone|ipod|ipad).*applewebkit/i.test(engineUserAgent); + var engineIsNode = classofRaw(global_1.process) == 'process'; + var location$1 = global_1.location; var set$1 = global_1.setImmediate; var clear = global_1.clearImmediate; @@ -889,7 +907,7 @@ delete queue[id]; }; // Node.js 0.8- - if (classofRaw(process) == 'process') { + if (engineIsNode) { defer = function (id) { process.nextTick(runner(id)); }; @@ -911,8 +929,8 @@ global_1.addEventListener && typeof postMessage == 'function' && !global_1.importScripts && - !fails(post) && - location$1.protocol !== 'file:' + location$1 && location$1.protocol !== 'file:' && + !fails(post) ) { defer = post; global_1.addEventListener('message', listener, false); @@ -937,15 +955,18 @@ clear: clear }; - var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; + var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(engineUserAgent); + var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; var macrotask = task.set; + + var MutationObserver$1 = global_1.MutationObserver || global_1.WebKitMutationObserver; + var document$2 = global_1.document; var process$1 = global_1.process; var Promise$1 = global_1.Promise; - var IS_NODE = classofRaw(process$1) == 'process'; // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` var queueMicrotaskDescriptor = getOwnPropertyDescriptor$2(global_1, 'queueMicrotask'); var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; @@ -956,7 +977,7 @@ if (!queueMicrotask) { flush = function () { var parent, fn; - if (IS_NODE && (parent = process$1.domain)) parent.exit(); + if (engineIsNode && (parent = process$1.domain)) parent.exit(); while (head) { fn = head.fn; head = head.next; @@ -971,15 +992,11 @@ if (parent) parent.enter(); }; - // Node.js - if (IS_NODE) { - notify = function () { - process$1.nextTick(flush); - }; // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339 - } else if (MutationObserver$1 && !engineIsIos) { + // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898 + if (!engineIsIos && !engineIsNode && !engineIsWebosWebkit && MutationObserver$1 && document$2) { toggle = true; - node = document.createTextNode(''); + node = document$2.createTextNode(''); new MutationObserver$1(flush).observe(node, { characterData: true }); notify = function () { node.data = toggle = !toggle; @@ -992,6 +1009,11 @@ notify = function () { then.call(promise, flush); }; + // Node.js without promises + } else if (engineIsNode) { + notify = function () { + process$1.nextTick(flush); + }; // for other environments - macrotask based on: // - setImmediate // - MessageChannel @@ -1088,6 +1110,7 @@ + var SPECIES$2 = wellKnownSymbol('species'); var PROMISE = 'Promise'; var getInternalState = internalState.get; @@ -1095,13 +1118,13 @@ var getInternalPromiseState = internalState.getterFor(PROMISE); var PromiseConstructor = nativePromiseConstructor; var TypeError$1 = global_1.TypeError; - var document$2 = global_1.document; + var document$3 = global_1.document; var process$3 = global_1.process; var $fetch = getBuiltIn('fetch'); var newPromiseCapability$1 = newPromiseCapability.f; var newGenericPromiseCapability = newPromiseCapability$1; - var IS_NODE$1 = classofRaw(process$3) == 'process'; - var DISPATCH_EVENT = !!(document$2 && document$2.createEvent && global_1.dispatchEvent); + var DISPATCH_EVENT = !!(document$3 && document$3.createEvent && global_1.dispatchEvent); + var NATIVE_REJECTION_EVENT = typeof PromiseRejectionEvent == 'function'; var UNHANDLED_REJECTION = 'unhandledrejection'; var REJECTION_HANDLED = 'rejectionhandled'; var PENDING = 0; @@ -1119,7 +1142,7 @@ // We can't detect it synchronously, so just check versions if (engineV8Version === 66) return true; // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test - if (!IS_NODE$1 && typeof PromiseRejectionEvent != 'function') return true; + if (!engineIsNode && !NATIVE_REJECTION_EVENT) return true; } // We can't use @@species feature detection in V8 since it causes // deoptimization and performance degradation @@ -1145,7 +1168,7 @@ return isObject(it) && typeof (then = it.then) == 'function' ? then : false; }; - var notify$1 = function (promise, state, isReject) { + var notify$1 = function (state, isReject) { if (state.notified) return; state.notified = true; var chain = state.reactions; @@ -1164,7 +1187,7 @@ try { if (handler) { if (!ok) { - if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state); + if (state.rejection === UNHANDLED) onHandleUnhandled(state); state.rejection = HANDLED; } if (handler === true) result = value; @@ -1189,36 +1212,37 @@ } state.reactions = []; state.notified = false; - if (isReject && !state.rejection) onUnhandled(promise, state); + if (isReject && !state.rejection) onUnhandled(state); }); }; var dispatchEvent = function (name, promise, reason) { var event, handler; if (DISPATCH_EVENT) { - event = document$2.createEvent('Event'); + event = document$3.createEvent('Event'); event.promise = promise; event.reason = reason; event.initEvent(name, false, true); global_1.dispatchEvent(event); } else event = { promise: promise, reason: reason }; - if (handler = global_1['on' + name]) handler(event); + if (!NATIVE_REJECTION_EVENT && (handler = global_1['on' + name])) handler(event); else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason); }; - var onUnhandled = function (promise, state) { + var onUnhandled = function (state) { task$1.call(global_1, function () { + var promise = state.facade; var value = state.value; var IS_UNHANDLED = isUnhandled(state); var result; if (IS_UNHANDLED) { result = perform(function () { - if (IS_NODE$1) { + if (engineIsNode) { process$3.emit('unhandledRejection', value, promise); } else dispatchEvent(UNHANDLED_REJECTION, promise, value); }); // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should - state.rejection = IS_NODE$1 || isUnhandled(state) ? UNHANDLED : HANDLED; + state.rejection = engineIsNode || isUnhandled(state) ? UNHANDLED : HANDLED; if (result.error) throw result.value; } }); @@ -1228,55 +1252,56 @@ return state.rejection !== HANDLED && !state.parent; }; - var onHandleUnhandled = function (promise, state) { + var onHandleUnhandled = function (state) { task$1.call(global_1, function () { - if (IS_NODE$1) { + var promise = state.facade; + if (engineIsNode) { process$3.emit('rejectionHandled', promise); } else dispatchEvent(REJECTION_HANDLED, promise, state.value); }); }; - var bind = function (fn, promise, state, unwrap) { + var bind = function (fn, state, unwrap) { return function (value) { - fn(promise, state, value, unwrap); + fn(state, value, unwrap); }; }; - var internalReject = function (promise, state, value, unwrap) { + var internalReject = function (state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; state.value = value; state.state = REJECTED; - notify$1(promise, state, true); + notify$1(state, true); }; - var internalResolve = function (promise, state, value, unwrap) { + var internalResolve = function (state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; try { - if (promise === value) throw TypeError$1("Promise can't be resolved itself"); + if (state.facade === value) throw TypeError$1("Promise can't be resolved itself"); var then = isThenable(value); if (then) { microtask(function () { var wrapper = { done: false }; try { then.call(value, - bind(internalResolve, promise, wrapper, state), - bind(internalReject, promise, wrapper, state) + bind(internalResolve, wrapper, state), + bind(internalReject, wrapper, state) ); } catch (error) { - internalReject(promise, wrapper, error, state); + internalReject(wrapper, error, state); } }); } else { state.value = value; state.state = FULFILLED; - notify$1(promise, state, false); + notify$1(state, false); } } catch (error) { - internalReject(promise, { done: false }, error, state); + internalReject({ done: false }, error, state); } }; @@ -1289,9 +1314,9 @@ Internal.call(this); var state = getInternalState(this); try { - executor(bind(internalResolve, this, state), bind(internalReject, this, state)); + executor(bind(internalResolve, state), bind(internalReject, state)); } catch (error) { - internalReject(this, state, error); + internalReject(state, error); } }; // eslint-disable-next-line no-unused-vars @@ -1309,20 +1334,20 @@ }; Internal.prototype = redefineAll(PromiseConstructor.prototype, { // `Promise.prototype.then` method - // https://tc39.github.io/ecma262/#sec-promise.prototype.then + // https://tc39.es/ecma262/#sec-promise.prototype.then then: function then(onFulfilled, onRejected) { var state = getInternalPromiseState(this); var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor)); reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; reaction.fail = typeof onRejected == 'function' && onRejected; - reaction.domain = IS_NODE$1 ? process$3.domain : undefined; + reaction.domain = engineIsNode ? process$3.domain : undefined; state.parent = true; state.reactions.push(reaction); - if (state.state != PENDING) notify$1(this, state, false); + if (state.state != PENDING) notify$1(state, false); return reaction.promise; }, // `Promise.prototype.catch` method - // https://tc39.github.io/ecma262/#sec-promise.prototype.catch + // https://tc39.es/ecma262/#sec-promise.prototype.catch 'catch': function (onRejected) { return this.then(undefined, onRejected); } @@ -1331,8 +1356,8 @@ var promise = new Internal(); var state = getInternalState(promise); this.promise = promise; - this.resolve = bind(internalResolve, promise, state); - this.reject = bind(internalReject, promise, state); + this.resolve = bind(internalResolve, state); + this.reject = bind(internalReject, state); }; newPromiseCapability.f = newPromiseCapability$1 = function (C) { return C === PromiseConstructor || C === PromiseWrapper @@ -1374,7 +1399,7 @@ // statics _export({ target: PROMISE, stat: true, forced: FORCED }, { // `Promise.reject` method - // https://tc39.github.io/ecma262/#sec-promise.reject + // https://tc39.es/ecma262/#sec-promise.reject reject: function reject(r) { var capability = newPromiseCapability$1(this); capability.reject.call(undefined, r); @@ -1384,7 +1409,7 @@ _export({ target: PROMISE, stat: true, forced: FORCED }, { // `Promise.resolve` method - // https://tc39.github.io/ecma262/#sec-promise.resolve + // https://tc39.es/ecma262/#sec-promise.resolve resolve: function resolve(x) { return promiseResolve( this, x); } @@ -1392,7 +1417,7 @@ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, { // `Promise.all` method - // https://tc39.github.io/ecma262/#sec-promise.all + // https://tc39.es/ecma262/#sec-promise.all all: function all(iterable) { var C = this; var capability = newPromiseCapability$1(C); @@ -1403,7 +1428,7 @@ var values = []; var counter = 0; var remaining = 1; - iterate_1(iterable, function (promise) { + iterate(iterable, function (promise) { var index = counter++; var alreadyCalled = false; values.push(undefined); @@ -1421,14 +1446,14 @@ return capability.promise; }, // `Promise.race` method - // https://tc39.github.io/ecma262/#sec-promise.race + // https://tc39.es/ecma262/#sec-promise.race race: function race(iterable) { var C = this; var capability = newPromiseCapability$1(C); var reject = capability.reject; var result = perform(function () { var $promiseResolve = aFunction$1(C.resolve); - iterate_1(iterable, function (promise) { + iterate(iterable, function (promise) { $promiseResolve.call(C, promise).then(capability.resolve, reject); }); }); @@ -1443,7 +1468,7 @@ }); // `Promise.prototype.finally` method - // https://tc39.github.io/ecma262/#sec-promise.prototype.finally + // https://tc39.es/ecma262/#sec-promise.prototype.finally _export({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, { 'finally': function (onFinally) { var C = speciesConstructor(this, getBuiltIn('Promise')); @@ -1830,25 +1855,25 @@ } // `IsArray` abstract operation - // https://tc39.github.io/ecma262/#sec-isarray + // https://tc39.es/ecma262/#sec-isarray var isArray = Array.isArray || function isArray(arg) { return classofRaw(arg) == 'Array'; }; // `ToObject` abstract operation - // https://tc39.github.io/ecma262/#sec-toobject + // https://tc39.es/ecma262/#sec-toobject var toObject = function (argument) { return Object(requireObjectCoercible(argument)); }; // `Object.keys` method - // https://tc39.github.io/ecma262/#sec-object.keys + // https://tc39.es/ecma262/#sec-object.keys var objectKeys = Object.keys || function keys(O) { return objectKeysInternal(O, enumBugKeys); }; // `Object.defineProperties` method - // https://tc39.github.io/ecma262/#sec-object.defineproperties + // https://tc39.es/ecma262/#sec-object.defineproperties var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = objectKeys(Properties); @@ -1917,7 +1942,7 @@ hiddenKeys[IE_PROTO] = true; // `Object.create` method - // https://tc39.github.io/ecma262/#sec-object.create + // https://tc39.es/ecma262/#sec-object.create var objectCreate = Object.create || function create(O, Properties) { var result; if (O !== null) { @@ -1974,7 +1999,7 @@ var SPECIES$3 = wellKnownSymbol('species'); // `ArraySpeciesCreate` abstract operation - // https://tc39.github.io/ecma262/#sec-arrayspeciescreate + // https://tc39.es/ecma262/#sec-arrayspeciescreate var arraySpeciesCreate = function (originalArray, length) { var C; if (isArray(originalArray)) { @@ -1990,13 +2015,14 @@ var push = [].push; - // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation + // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation var createMethod$1 = function (TYPE) { var IS_MAP = TYPE == 1; var IS_FILTER = TYPE == 2; var IS_SOME = TYPE == 3; var IS_EVERY = TYPE == 4; var IS_FIND_INDEX = TYPE == 6; + var IS_FILTER_OUT = TYPE == 7; var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; return function ($this, callbackfn, that, specificCreate) { var O = toObject($this); @@ -2005,7 +2031,7 @@ var length = toLength(self.length); var index = 0; var create = specificCreate || arraySpeciesCreate; - var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; + var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined; var value, result; for (;length > index; index++) if (NO_HOLES || index in self) { value = self[index]; @@ -2017,7 +2043,10 @@ case 5: return value; // find case 6: return index; // findIndex case 2: push.call(target, value); // filter - } else if (IS_EVERY) return false; // every + } else switch (TYPE) { + case 4: return false; // every + case 7: push.call(target, value); // filterOut + } } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; @@ -2026,26 +2055,29 @@ var arrayIteration = { // `Array.prototype.forEach` method - // https://tc39.github.io/ecma262/#sec-array.prototype.foreach + // https://tc39.es/ecma262/#sec-array.prototype.foreach forEach: createMethod$1(0), // `Array.prototype.map` method - // https://tc39.github.io/ecma262/#sec-array.prototype.map + // https://tc39.es/ecma262/#sec-array.prototype.map map: createMethod$1(1), // `Array.prototype.filter` method - // https://tc39.github.io/ecma262/#sec-array.prototype.filter + // https://tc39.es/ecma262/#sec-array.prototype.filter filter: createMethod$1(2), // `Array.prototype.some` method - // https://tc39.github.io/ecma262/#sec-array.prototype.some + // https://tc39.es/ecma262/#sec-array.prototype.some some: createMethod$1(3), // `Array.prototype.every` method - // https://tc39.github.io/ecma262/#sec-array.prototype.every + // https://tc39.es/ecma262/#sec-array.prototype.every every: createMethod$1(4), // `Array.prototype.find` method - // https://tc39.github.io/ecma262/#sec-array.prototype.find + // https://tc39.es/ecma262/#sec-array.prototype.find find: createMethod$1(5), // `Array.prototype.findIndex` method - // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex - findIndex: createMethod$1(6) + // https://tc39.es/ecma262/#sec-array.prototype.findIndex + findIndex: createMethod$1(6), + // `Array.prototype.filterOut` method + // https://github.com/tc39/proposal-array-filtering + filterOut: createMethod$1(7) }; var $forEach = arrayIteration.forEach; @@ -2173,7 +2205,7 @@ }; // `Symbol` constructor - // https://tc39.github.io/ecma262/#sec-symbol-constructor + // https://tc39.es/ecma262/#sec-symbol-constructor if (!nativeSymbol) { $Symbol = function Symbol() { if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor'); @@ -2230,7 +2262,7 @@ _export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, { // `Symbol.for` method - // https://tc39.github.io/ecma262/#sec-symbol.for + // https://tc39.es/ecma262/#sec-symbol.for 'for': function (key) { var string = String(key); if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string]; @@ -2240,7 +2272,7 @@ return symbol; }, // `Symbol.keyFor` method - // https://tc39.github.io/ecma262/#sec-symbol.keyfor + // https://tc39.es/ecma262/#sec-symbol.keyfor keyFor: function keyFor(sym) { if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol'); if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; @@ -2251,25 +2283,25 @@ _export({ target: 'Object', stat: true, forced: !nativeSymbol, sham: !descriptors }, { // `Object.create` method - // https://tc39.github.io/ecma262/#sec-object.create + // https://tc39.es/ecma262/#sec-object.create create: $create, // `Object.defineProperty` method - // https://tc39.github.io/ecma262/#sec-object.defineproperty + // https://tc39.es/ecma262/#sec-object.defineproperty defineProperty: $defineProperty, // `Object.defineProperties` method - // https://tc39.github.io/ecma262/#sec-object.defineproperties + // https://tc39.es/ecma262/#sec-object.defineproperties defineProperties: $defineProperties, // `Object.getOwnPropertyDescriptor` method - // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors + // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors getOwnPropertyDescriptor: $getOwnPropertyDescriptor }); _export({ target: 'Object', stat: true, forced: !nativeSymbol }, { // `Object.getOwnPropertyNames` method - // https://tc39.github.io/ecma262/#sec-object.getownpropertynames + // https://tc39.es/ecma262/#sec-object.getownpropertynames getOwnPropertyNames: $getOwnPropertyNames, // `Object.getOwnPropertySymbols` method - // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols + // https://tc39.es/ecma262/#sec-object.getownpropertysymbols getOwnPropertySymbols: $getOwnPropertySymbols }); @@ -2282,7 +2314,7 @@ }); // `JSON.stringify` method behavior with symbols - // https://tc39.github.io/ecma262/#sec-json.stringify + // https://tc39.es/ecma262/#sec-json.stringify if ($stringify) { var FORCED_JSON_STRINGIFY = !nativeSymbol || fails(function () { var symbol = $Symbol(); @@ -2314,18 +2346,18 @@ } // `Symbol.prototype[@@toPrimitive]` method - // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive + // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive if (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) { createNonEnumerableProperty($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf); } // `Symbol.prototype[@@toStringTag]` property - // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag + // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag setToStringTag($Symbol, SYMBOL); hiddenKeys[HIDDEN] = true; // `Symbol.asyncIterator` well-known symbol - // https://tc39.github.io/ecma262/#sec-symbol.asynciterator + // https://tc39.es/ecma262/#sec-symbol.asynciterator defineWellKnownSymbol('asyncIterator'); var defineProperty$3 = objectDefineProperty.f; @@ -2372,298 +2404,53 @@ } // `Symbol.hasInstance` well-known symbol - // https://tc39.github.io/ecma262/#sec-symbol.hasinstance + // https://tc39.es/ecma262/#sec-symbol.hasinstance defineWellKnownSymbol('hasInstance'); // `Symbol.isConcatSpreadable` well-known symbol - // https://tc39.github.io/ecma262/#sec-symbol.isconcatspreadable + // https://tc39.es/ecma262/#sec-symbol.isconcatspreadable defineWellKnownSymbol('isConcatSpreadable'); // `Symbol.iterator` well-known symbol - // https://tc39.github.io/ecma262/#sec-symbol.iterator + // https://tc39.es/ecma262/#sec-symbol.iterator defineWellKnownSymbol('iterator'); // `Symbol.match` well-known symbol - // https://tc39.github.io/ecma262/#sec-symbol.match + // https://tc39.es/ecma262/#sec-symbol.match defineWellKnownSymbol('match'); // `Symbol.matchAll` well-known symbol + // https://tc39.es/ecma262/#sec-symbol.matchall defineWellKnownSymbol('matchAll'); // `Symbol.replace` well-known symbol - // https://tc39.github.io/ecma262/#sec-symbol.replace + // https://tc39.es/ecma262/#sec-symbol.replace defineWellKnownSymbol('replace'); // `Symbol.search` well-known symbol - // https://tc39.github.io/ecma262/#sec-symbol.search + // https://tc39.es/ecma262/#sec-symbol.search defineWellKnownSymbol('search'); // `Symbol.species` well-known symbol - // https://tc39.github.io/ecma262/#sec-symbol.species + // https://tc39.es/ecma262/#sec-symbol.species defineWellKnownSymbol('species'); // `Symbol.split` well-known symbol - // https://tc39.github.io/ecma262/#sec-symbol.split + // https://tc39.es/ecma262/#sec-symbol.split defineWellKnownSymbol('split'); // `Symbol.toPrimitive` well-known symbol - // https://tc39.github.io/ecma262/#sec-symbol.toprimitive + // https://tc39.es/ecma262/#sec-symbol.toprimitive defineWellKnownSymbol('toPrimitive'); // `Symbol.toStringTag` well-known symbol - // https://tc39.github.io/ecma262/#sec-symbol.tostringtag + // https://tc39.es/ecma262/#sec-symbol.tostringtag defineWellKnownSymbol('toStringTag'); // `Symbol.unscopables` well-known symbol - // https://tc39.github.io/ecma262/#sec-symbol.unscopables + // https://tc39.es/ecma262/#sec-symbol.unscopables defineWellKnownSymbol('unscopables'); - var nativeAssign = Object.assign; - var defineProperty$4 = Object.defineProperty; - - // `Object.assign` method - // https://tc39.github.io/ecma262/#sec-object.assign - var objectAssign = !nativeAssign || fails(function () { - // should have correct order of operations (Edge bug) - if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$4({}, 'a', { - enumerable: true, - get: function () { - defineProperty$4(this, 'b', { - value: 3, - enumerable: false - }); - } - }), { b: 2 })).b !== 1) return true; - // should work with symbols and should have deterministic property order (V8 bug) - var A = {}; - var B = {}; - // eslint-disable-next-line no-undef - var symbol = Symbol(); - var alphabet = 'abcdefghijklmnopqrst'; - A[symbol] = 7; - alphabet.split('').forEach(function (chr) { B[chr] = chr; }); - return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet; - }) ? function assign(target, source) { // eslint-disable-line no-unused-vars - var T = toObject(target); - var argumentsLength = arguments.length; - var index = 1; - var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; - var propertyIsEnumerable = objectPropertyIsEnumerable.f; - while (argumentsLength > index) { - var S = indexedObject(arguments[index++]); - var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S); - var length = keys.length; - var j = 0; - var key; - while (length > j) { - key = keys[j++]; - if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key]; - } - } return T; - } : nativeAssign; - - // `Object.assign` method - // https://tc39.github.io/ecma262/#sec-object.assign - _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, { - assign: objectAssign - }); - - // `Object.create` method - // https://tc39.github.io/ecma262/#sec-object.create - _export({ target: 'Object', stat: true, sham: !descriptors }, { - create: objectCreate - }); - - // `Object.defineProperty` method - // https://tc39.github.io/ecma262/#sec-object.defineproperty - _export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, { - defineProperty: objectDefineProperty.f - }); - - // `Object.defineProperties` method - // https://tc39.github.io/ecma262/#sec-object.defineproperties - _export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, { - defineProperties: objectDefineProperties - }); - - var propertyIsEnumerable = objectPropertyIsEnumerable.f; - - // `Object.{ entries, values }` methods implementation - var createMethod$2 = function (TO_ENTRIES) { - return function (it) { - var O = toIndexedObject(it); - var keys = objectKeys(O); - var length = keys.length; - var i = 0; - var result = []; - var key; - while (length > i) { - key = keys[i++]; - if (!descriptors || propertyIsEnumerable.call(O, key)) { - result.push(TO_ENTRIES ? [key, O[key]] : O[key]); - } - } - return result; - }; - }; - - var objectToArray = { - // `Object.entries` method - // https://tc39.github.io/ecma262/#sec-object.entries - entries: createMethod$2(true), - // `Object.values` method - // https://tc39.github.io/ecma262/#sec-object.values - values: createMethod$2(false) - }; - - var $entries = objectToArray.entries; - - // `Object.entries` method - // https://tc39.github.io/ecma262/#sec-object.entries - _export({ target: 'Object', stat: true }, { - entries: function entries(O) { - return $entries(O); - } - }); - - var freezing = !fails(function () { - return Object.isExtensible(Object.preventExtensions({})); - }); - - var internalMetadata = createCommonjsModule(function (module) { - var defineProperty = objectDefineProperty.f; - - - - var METADATA = uid('meta'); - var id = 0; - - var isExtensible = Object.isExtensible || function () { - return true; - }; - - var setMetadata = function (it) { - defineProperty(it, METADATA, { value: { - objectID: 'O' + ++id, // object ID - weakData: {} // weak collections IDs - } }); - }; - - var fastKey = function (it, create) { - // return a primitive with prefix - if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if (!has(it, METADATA)) { - // can't set metadata to uncaught frozen object - if (!isExtensible(it)) return 'F'; - // not necessary to add metadata - if (!create) return 'E'; - // add missing metadata - setMetadata(it); - // return object ID - } return it[METADATA].objectID; - }; - - var getWeakData = function (it, create) { - if (!has(it, METADATA)) { - // can't set metadata to uncaught frozen object - if (!isExtensible(it)) return true; - // not necessary to add metadata - if (!create) return false; - // add missing metadata - setMetadata(it); - // return the store of weak collections IDs - } return it[METADATA].weakData; - }; - - // add metadata on freeze-family methods calling - var onFreeze = function (it) { - if (freezing && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it); - return it; - }; - - var meta = module.exports = { - REQUIRED: false, - fastKey: fastKey, - getWeakData: getWeakData, - onFreeze: onFreeze - }; - - hiddenKeys[METADATA] = true; - }); - - var onFreeze = internalMetadata.onFreeze; - - var nativeFreeze = Object.freeze; - var FAILS_ON_PRIMITIVES = fails(function () { nativeFreeze(1); }); - - // `Object.freeze` method - // https://tc39.github.io/ecma262/#sec-object.freeze - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !freezing }, { - freeze: function freeze(it) { - return nativeFreeze && isObject(it) ? nativeFreeze(onFreeze(it)) : it; - } - }); - - var createProperty = function (object, key, value) { - var propertyKey = toPrimitive(key); - if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value)); - else object[propertyKey] = value; - }; - - // `Object.fromEntries` method - // https://github.com/tc39/proposal-object-from-entries - _export({ target: 'Object', stat: true }, { - fromEntries: function fromEntries(iterable) { - var obj = {}; - iterate_1(iterable, function (k, v) { - createProperty(obj, k, v); - }, undefined, true); - return obj; - } - }); - - var nativeGetOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; - - - var FAILS_ON_PRIMITIVES$1 = fails(function () { nativeGetOwnPropertyDescriptor$2(1); }); - var FORCED$1 = !descriptors || FAILS_ON_PRIMITIVES$1; - - // `Object.getOwnPropertyDescriptor` method - // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor - _export({ target: 'Object', stat: true, forced: FORCED$1, sham: !descriptors }, { - getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { - return nativeGetOwnPropertyDescriptor$2(toIndexedObject(it), key); - } - }); - - // `Object.getOwnPropertyDescriptors` method - // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors - _export({ target: 'Object', stat: true, sham: !descriptors }, { - getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { - var O = toIndexedObject(object); - var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; - var keys = ownKeys(O); - var result = {}; - var index = 0; - var key, descriptor; - while (keys.length > index) { - descriptor = getOwnPropertyDescriptor(O, key = keys[index++]); - if (descriptor !== undefined) createProperty(result, key, descriptor); - } - return result; - } - }); - - var nativeGetOwnPropertyNames$2 = objectGetOwnPropertyNamesExternal.f; - - var FAILS_ON_PRIMITIVES$2 = fails(function () { return !Object.getOwnPropertyNames(1); }); - - // `Object.getOwnPropertyNames` method - // https://tc39.github.io/ecma262/#sec-object.getownpropertynames - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$2 }, { - getOwnPropertyNames: nativeGetOwnPropertyNames$2 - }); - var correctPrototypeGetter = !fails(function () { function F() { /* empty */ } F.prototype.constructor = null; @@ -2674,7 +2461,7 @@ var ObjectPrototype$1 = Object.prototype; // `Object.getPrototypeOf` method - // https://tc39.github.io/ecma262/#sec-object.getprototypeof + // https://tc39.es/ecma262/#sec-object.getprototypeof var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) { O = toObject(O); if (has(O, IE_PROTO$1)) return O[IE_PROTO$1]; @@ -2683,102 +2470,6 @@ } return O instanceof Object ? ObjectPrototype$1 : null; }; - var FAILS_ON_PRIMITIVES$3 = fails(function () { objectGetPrototypeOf(1); }); - - // `Object.getPrototypeOf` method - // https://tc39.github.io/ecma262/#sec-object.getprototypeof - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$3, sham: !correctPrototypeGetter }, { - getPrototypeOf: function getPrototypeOf(it) { - return objectGetPrototypeOf(toObject(it)); - } - }); - - // `SameValue` abstract operation - // https://tc39.github.io/ecma262/#sec-samevalue - 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; - }; - - // `Object.is` method - // https://tc39.github.io/ecma262/#sec-object.is - _export({ target: 'Object', stat: true }, { - is: sameValue - }); - - var nativeIsExtensible = Object.isExtensible; - var FAILS_ON_PRIMITIVES$4 = fails(function () { nativeIsExtensible(1); }); - - // `Object.isExtensible` method - // https://tc39.github.io/ecma262/#sec-object.isextensible - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$4 }, { - isExtensible: function isExtensible(it) { - return isObject(it) ? nativeIsExtensible ? nativeIsExtensible(it) : true : false; - } - }); - - var nativeIsFrozen = Object.isFrozen; - var FAILS_ON_PRIMITIVES$5 = fails(function () { nativeIsFrozen(1); }); - - // `Object.isFrozen` method - // https://tc39.github.io/ecma262/#sec-object.isfrozen - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$5 }, { - isFrozen: function isFrozen(it) { - return isObject(it) ? nativeIsFrozen ? nativeIsFrozen(it) : false : true; - } - }); - - var nativeIsSealed = Object.isSealed; - var FAILS_ON_PRIMITIVES$6 = fails(function () { nativeIsSealed(1); }); - - // `Object.isSealed` method - // https://tc39.github.io/ecma262/#sec-object.issealed - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$6 }, { - isSealed: function isSealed(it) { - return isObject(it) ? nativeIsSealed ? nativeIsSealed(it) : false : true; - } - }); - - var FAILS_ON_PRIMITIVES$7 = fails(function () { objectKeys(1); }); - - // `Object.keys` method - // https://tc39.github.io/ecma262/#sec-object.keys - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$7 }, { - keys: function keys(it) { - return objectKeys(toObject(it)); - } - }); - - var onFreeze$1 = internalMetadata.onFreeze; - - - - var nativePreventExtensions = Object.preventExtensions; - var FAILS_ON_PRIMITIVES$8 = fails(function () { nativePreventExtensions(1); }); - - // `Object.preventExtensions` method - // https://tc39.github.io/ecma262/#sec-object.preventextensions - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$8, sham: !freezing }, { - preventExtensions: function preventExtensions(it) { - return nativePreventExtensions && isObject(it) ? nativePreventExtensions(onFreeze$1(it)) : it; - } - }); - - var onFreeze$2 = internalMetadata.onFreeze; - - - - var nativeSeal = Object.seal; - var FAILS_ON_PRIMITIVES$9 = fails(function () { nativeSeal(1); }); - - // `Object.seal` method - // https://tc39.github.io/ecma262/#sec-object.seal - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$9, sham: !freezing }, { - seal: function seal(it) { - return nativeSeal && isObject(it) ? nativeSeal(onFreeze$2(it)) : it; - } - }); - var aPossiblePrototype = function (it) { if (!isObject(it) && it !== null) { throw TypeError("Can't set " + String(it) + ' as a prototype'); @@ -2786,7 +2477,7 @@ }; // `Object.setPrototypeOf` method - // https://tc39.github.io/ecma262/#sec-object.setprototypeof + // https://tc39.es/ecma262/#sec-object.setprototypeof // Works with __proto__ only. Old v8 can't work with null proto objects. /* eslint-disable no-proto */ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () { @@ -2807,138 +2498,51 @@ }; }() : undefined); - // `Object.setPrototypeOf` method - // https://tc39.github.io/ecma262/#sec-object.setprototypeof - _export({ target: 'Object', stat: true }, { - setPrototypeOf: objectSetPrototypeOf - }); - - var $values = objectToArray.values; - - // `Object.values` method - // https://tc39.github.io/ecma262/#sec-object.values - _export({ target: 'Object', stat: true }, { - values: function values(O) { - return $values(O); + var $AggregateError = function AggregateError(errors, message) { + var that = this; + if (!(that instanceof $AggregateError)) return new $AggregateError(errors, message); + if (objectSetPrototypeOf) { + // eslint-disable-next-line unicorn/error-message + that = objectSetPrototypeOf(new Error(undefined), objectGetPrototypeOf(that)); } - }); + if (message !== undefined) createNonEnumerableProperty(that, 'message', String(message)); + var errorsArray = []; + iterate(errors, errorsArray.push, { that: errorsArray }); + createNonEnumerableProperty(that, 'errors', errorsArray); + return that; + }; - // Forced replacement object prototype accessors methods - var objectPrototypeAccessorsForced = !fails(function () { - var key = Math.random(); - // In FF throws only define methods - // eslint-disable-next-line no-undef, no-useless-call - __defineSetter__.call(null, key, function () { /* empty */ }); - delete global_1[key]; + $AggregateError.prototype = objectCreate(Error.prototype, { + constructor: createPropertyDescriptor(5, $AggregateError), + message: createPropertyDescriptor(5, ''), + name: createPropertyDescriptor(5, 'AggregateError') }); - // `Object.prototype.__defineGetter__` method - // https://tc39.github.io/ecma262/#sec-object.prototype.__defineGetter__ - if (descriptors) { - _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { - __defineGetter__: function __defineGetter__(P, getter) { - objectDefineProperty.f(toObject(this), P, { get: aFunction$1(getter), enumerable: true, configurable: true }); - } - }); - } - - // `Object.prototype.__defineSetter__` method - // https://tc39.github.io/ecma262/#sec-object.prototype.__defineSetter__ - if (descriptors) { - _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { - __defineSetter__: function __defineSetter__(P, setter) { - objectDefineProperty.f(toObject(this), P, { set: aFunction$1(setter), enumerable: true, configurable: true }); - } - }); - } - - var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f; - - // `Object.prototype.__lookupGetter__` method - // https://tc39.github.io/ecma262/#sec-object.prototype.__lookupGetter__ - if (descriptors) { - _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { - __lookupGetter__: function __lookupGetter__(P) { - var O = toObject(this); - var key = toPrimitive(P, true); - var desc; - do { - if (desc = getOwnPropertyDescriptor$3(O, key)) return desc.get; - } while (O = objectGetPrototypeOf(O)); - } - }); - } - - var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f; - - // `Object.prototype.__lookupSetter__` method - // https://tc39.github.io/ecma262/#sec-object.prototype.__lookupSetter__ - if (descriptors) { - _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { - __lookupSetter__: function __lookupSetter__(P) { - var O = toObject(this); - var key = toPrimitive(P, true); - var desc; - do { - if (desc = getOwnPropertyDescriptor$4(O, key)) return desc.set; - } while (O = objectGetPrototypeOf(O)); - } - }); - } - - var slice$1 = [].slice; - var factories = {}; + // `AggregateError` constructor + // https://tc39.es/ecma262/#sec-aggregate-error-constructor + _export({ global: true }, { + AggregateError: $AggregateError + }); - var construct = function (C, argsLength, args) { - if (!(argsLength in factories)) { - for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']'; - // eslint-disable-next-line no-new-func - factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')'); - } return factories[argsLength](C, args); + // call something on iterator step with safe closing on error + var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) { + try { + return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); + // 7.4.6 IteratorClose(iterator, completion) + } catch (error) { + iteratorClose(iterator); + throw error; + } }; - // `Function.prototype.bind` method implementation - // https://tc39.github.io/ecma262/#sec-function.prototype.bind - var functionBind = Function.bind || function bind(that /* , ...args */) { - var fn = aFunction$1(this); - var partArgs = slice$1.call(arguments, 1); - var boundFunction = function bound(/* args... */) { - var args = partArgs.concat(slice$1.call(arguments)); - return this instanceof boundFunction ? construct(fn, args.length, args) : fn.apply(that, args); - }; - if (isObject(fn.prototype)) boundFunction.prototype = fn.prototype; - return boundFunction; + var createProperty = function (object, key, value) { + var propertyKey = toPrimitive(key); + if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value)); + else object[propertyKey] = value; }; - // `Function.prototype.bind` method - // https://tc39.github.io/ecma262/#sec-function.prototype.bind - _export({ target: 'Function', proto: true }, { - bind: functionBind - }); - - var HAS_INSTANCE = wellKnownSymbol('hasInstance'); - var FunctionPrototype$1 = Function.prototype; - - // `Function.prototype[@@hasInstance]` method - // https://tc39.github.io/ecma262/#sec-function.prototype-@@hasinstance - if (!(HAS_INSTANCE in FunctionPrototype$1)) { - objectDefineProperty.f(FunctionPrototype$1, HAS_INSTANCE, { value: function (O) { - if (typeof this != 'function' || !isObject(O)) return false; - if (!isObject(this.prototype)) return O instanceof this; - // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: - while (O = objectGetPrototypeOf(O)) if (this.prototype === O) return true; - return false; - } }); - } - - // `globalThis` object - // https://github.com/tc39/proposal-global - _export({ global: true }, { - globalThis: global_1 - }); - // `Array.from` method implementation - // https://tc39.github.io/ecma262/#sec-array.from + // https://tc39.es/ecma262/#sec-array.from var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { var O = toObject(arrayLike); var C = typeof this == 'function' ? this : Array; @@ -2975,13 +2579,13 @@ }); // `Array.from` method - // https://tc39.github.io/ecma262/#sec-array.from + // https://tc39.es/ecma262/#sec-array.from _export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION$1 }, { from: arrayFrom }); // `Array.isArray` method - // https://tc39.github.io/ecma262/#sec-array.isarray + // https://tc39.es/ecma262/#sec-array.isarray _export({ target: 'Array', stat: true }, { isArray: isArray }); @@ -2992,7 +2596,7 @@ }); // `Array.of` method - // https://tc39.github.io/ecma262/#sec-array.of + // https://tc39.es/ecma262/#sec-array.of // WebKit Array.of isn't generic _export({ target: 'Array', stat: true, forced: ISNT_GENERIC }, { of: function of(/* ...args */) { @@ -3042,12 +2646,12 @@ return spreadable !== undefined ? !!spreadable : isArray(O); }; - var FORCED$2 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; + var FORCED$1 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; // `Array.prototype.concat` method - // https://tc39.github.io/ecma262/#sec-array.prototype.concat + // https://tc39.es/ecma262/#sec-array.prototype.concat // with adding support of @@isConcatSpreadable and @@species - _export({ target: 'Array', proto: true, forced: FORCED$2 }, { + _export({ target: 'Array', proto: true, forced: FORCED$1 }, { concat: function concat(arg) { // eslint-disable-line no-unused-vars var O = toObject(this); var A = arraySpeciesCreate(O, 0); @@ -3072,7 +2676,7 @@ var min$2 = Math.min; // `Array.prototype.copyWithin` method implementation - // https://tc39.github.io/ecma262/#sec-array.prototype.copywithin + // https://tc39.es/ecma262/#sec-array.prototype.copywithin var arrayCopyWithin = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) { var O = toObject(this); var len = toLength(O.length); @@ -3098,7 +2702,7 @@ var ArrayPrototype$1 = Array.prototype; // Array.prototype[@@unscopables] - // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables if (ArrayPrototype$1[UNSCOPABLES] == undefined) { objectDefineProperty.f(ArrayPrototype$1, UNSCOPABLES, { configurable: true, @@ -3112,12 +2716,12 @@ }; // `Array.prototype.copyWithin` method - // https://tc39.github.io/ecma262/#sec-array.prototype.copywithin + // https://tc39.es/ecma262/#sec-array.prototype.copywithin _export({ target: 'Array', proto: true }, { copyWithin: arrayCopyWithin }); - // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('copyWithin'); var arrayMethodIsStrict = function (METHOD_NAME, argument) { @@ -3128,7 +2732,7 @@ }); }; - var defineProperty$5 = Object.defineProperty; + var defineProperty$4 = Object.defineProperty; var cache = {}; var thrower = function (it) { throw it; }; @@ -3145,7 +2749,7 @@ if (ACCESSORS && !descriptors) return true; var O = { length: -1 }; - if (ACCESSORS) defineProperty$5(O, 1, { enumerable: true, get: thrower }); + if (ACCESSORS) defineProperty$4(O, 1, { enumerable: true, get: thrower }); else O[1] = 1; method.call(O, argument0, argument1); @@ -3160,7 +2764,7 @@ var USES_TO_LENGTH = arrayMethodUsesToLength('every'); // `Array.prototype.every` method - // https://tc39.github.io/ecma262/#sec-array.prototype.every + // https://tc39.es/ecma262/#sec-array.prototype.every _export({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, { every: function every(callbackfn /* , thisArg */) { return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); @@ -3168,7 +2772,7 @@ }); // `Array.prototype.fill` method implementation - // https://tc39.github.io/ecma262/#sec-array.prototype.fill + // https://tc39.es/ecma262/#sec-array.prototype.fill var arrayFill = function fill(value /* , start = 0, end = @length */) { var O = toObject(this); var length = toLength(O.length); @@ -3181,12 +2785,12 @@ }; // `Array.prototype.fill` method - // https://tc39.github.io/ecma262/#sec-array.prototype.fill + // https://tc39.es/ecma262/#sec-array.prototype.fill _export({ target: 'Array', proto: true }, { fill: arrayFill }); - // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('fill'); var $filter = arrayIteration.filter; @@ -3198,7 +2802,7 @@ var USES_TO_LENGTH$1 = arrayMethodUsesToLength('filter'); // `Array.prototype.filter` method - // https://tc39.github.io/ecma262/#sec-array.prototype.filter + // https://tc39.es/ecma262/#sec-array.prototype.filter // with adding support of @@species _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH$1 }, { filter: function filter(callbackfn /* , thisArg */) { @@ -3219,14 +2823,14 @@ if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; }); // `Array.prototype.find` method - // https://tc39.github.io/ecma262/#sec-array.prototype.find + // https://tc39.es/ecma262/#sec-array.prototype.find _export({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH$2 }, { find: function find(callbackfn /* , that = undefined */) { return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); - // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables(FIND); var $findIndex = arrayIteration.findIndex; @@ -3242,14 +2846,14 @@ if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES$1 = false; }); // `Array.prototype.findIndex` method - // https://tc39.github.io/ecma262/#sec-array.prototype.findindex + // https://tc39.es/ecma262/#sec-array.prototype.findindex _export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 || !USES_TO_LENGTH$3 }, { findIndex: function findIndex(callbackfn /* , that = undefined */) { return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); - // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables(FIND_INDEX); // `FlattenIntoArray` abstract operation @@ -3281,7 +2885,7 @@ var flattenIntoArray_1 = flattenIntoArray; // `Array.prototype.flat` method - // https://github.com/tc39/proposal-flatMap + // https://tc39.es/ecma262/#sec-array.prototype.flat _export({ target: 'Array', proto: true }, { flat: function flat(/* depthArg = 1 */) { var depthArg = arguments.length ? arguments[0] : undefined; @@ -3294,7 +2898,7 @@ }); // `Array.prototype.flatMap` method - // https://github.com/tc39/proposal-flatMap + // https://tc39.es/ecma262/#sec-array.prototype.flatmap _export({ target: 'Array', proto: true }, { flatMap: function flatMap(callbackfn /* , thisArg */) { var O = toObject(this); @@ -3315,13 +2919,13 @@ var USES_TO_LENGTH$4 = arrayMethodUsesToLength('forEach'); // `Array.prototype.forEach` method implementation - // https://tc39.github.io/ecma262/#sec-array.prototype.foreach + // https://tc39.es/ecma262/#sec-array.prototype.foreach var arrayForEach = (!STRICT_METHOD$1 || !USES_TO_LENGTH$4) ? function forEach(callbackfn /* , thisArg */) { return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } : [].forEach; // `Array.prototype.forEach` method - // https://tc39.github.io/ecma262/#sec-array.prototype.foreach + // https://tc39.es/ecma262/#sec-array.prototype.foreach _export({ target: 'Array', proto: true, forced: [].forEach != arrayForEach }, { forEach: arrayForEach }); @@ -3333,14 +2937,14 @@ var USES_TO_LENGTH$5 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); // `Array.prototype.includes` method - // https://tc39.github.io/ecma262/#sec-array.prototype.includes + // https://tc39.es/ecma262/#sec-array.prototype.includes _export({ target: 'Array', proto: true, forced: !USES_TO_LENGTH$5 }, { includes: function includes(el /* , fromIndex = 0 */) { return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); } }); - // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('includes'); var $indexOf = arrayIncludes.indexOf; @@ -3354,7 +2958,7 @@ var USES_TO_LENGTH$6 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); // `Array.prototype.indexOf` method - // https://tc39.github.io/ecma262/#sec-array.prototype.indexof + // https://tc39.es/ecma262/#sec-array.prototype.indexof _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$2 || !USES_TO_LENGTH$6 }, { indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { return NEGATIVE_ZERO @@ -3370,7 +2974,7 @@ var STRICT_METHOD$3 = arrayMethodIsStrict('join', ','); // `Array.prototype.join` method - // https://tc39.github.io/ecma262/#sec-array.prototype.join + // https://tc39.es/ecma262/#sec-array.prototype.join _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$3 }, { join: function join(separator) { return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator); @@ -3383,11 +2987,11 @@ var STRICT_METHOD$4 = arrayMethodIsStrict('lastIndexOf'); // For preventing possible almost infinite loop in non-standard implementations, test the forward version of the method var USES_TO_LENGTH$7 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); - var FORCED$3 = NEGATIVE_ZERO$1 || !STRICT_METHOD$4 || !USES_TO_LENGTH$7; + var FORCED$2 = NEGATIVE_ZERO$1 || !STRICT_METHOD$4 || !USES_TO_LENGTH$7; // `Array.prototype.lastIndexOf` method implementation - // https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof - var arrayLastIndexOf = FORCED$3 ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { + // https://tc39.es/ecma262/#sec-array.prototype.lastindexof + var arrayLastIndexOf = FORCED$2 ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { // convert -0 to +0 if (NEGATIVE_ZERO$1) return nativeLastIndexOf.apply(this, arguments) || 0; var O = toIndexedObject(this); @@ -3400,7 +3004,7 @@ } : nativeLastIndexOf; // `Array.prototype.lastIndexOf` method - // https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof + // https://tc39.es/ecma262/#sec-array.prototype.lastindexof _export({ target: 'Array', proto: true, forced: arrayLastIndexOf !== [].lastIndexOf }, { lastIndexOf: arrayLastIndexOf }); @@ -3414,7 +3018,7 @@ var USES_TO_LENGTH$8 = arrayMethodUsesToLength('map'); // `Array.prototype.map` method - // https://tc39.github.io/ecma262/#sec-array.prototype.map + // https://tc39.es/ecma262/#sec-array.prototype.map // with adding support of @@species _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 || !USES_TO_LENGTH$8 }, { map: function map(callbackfn /* , thisArg */) { @@ -3423,7 +3027,7 @@ }); // `Array.prototype.{ reduce, reduceRight }` methods implementation - var createMethod$3 = function (IS_RIGHT) { + var createMethod$2 = function (IS_RIGHT) { return function (that, callbackfn, argumentsLength, memo) { aFunction$1(callbackfn); var O = toObject(that); @@ -3451,23 +3055,28 @@ var arrayReduce = { // `Array.prototype.reduce` method - // https://tc39.github.io/ecma262/#sec-array.prototype.reduce - left: createMethod$3(false), + // https://tc39.es/ecma262/#sec-array.prototype.reduce + left: createMethod$2(false), // `Array.prototype.reduceRight` method - // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright - right: createMethod$3(true) + // https://tc39.es/ecma262/#sec-array.prototype.reduceright + right: createMethod$2(true) }; var $reduce = arrayReduce.left; + + var STRICT_METHOD$5 = arrayMethodIsStrict('reduce'); var USES_TO_LENGTH$9 = arrayMethodUsesToLength('reduce', { 1: 0 }); + // Chrome 80-82 has a critical bug + // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982 + var CHROME_BUG = !engineIsNode && engineV8Version > 79 && engineV8Version < 83; // `Array.prototype.reduce` method - // https://tc39.github.io/ecma262/#sec-array.prototype.reduce - _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$5 || !USES_TO_LENGTH$9 }, { + // https://tc39.es/ecma262/#sec-array.prototype.reduce + _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$5 || !USES_TO_LENGTH$9 || CHROME_BUG }, { reduce: function reduce(callbackfn /* , initialValue */) { return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); } @@ -3477,13 +3086,18 @@ + + var STRICT_METHOD$6 = arrayMethodIsStrict('reduceRight'); // For preventing possible almost infinite loop in non-standard implementations, test the forward version of the method var USES_TO_LENGTH$a = arrayMethodUsesToLength('reduce', { 1: 0 }); + // Chrome 80-82 has a critical bug + // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982 + var CHROME_BUG$1 = !engineIsNode && engineV8Version > 79 && engineV8Version < 83; // `Array.prototype.reduceRight` method - // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright - _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$6 || !USES_TO_LENGTH$a }, { + // https://tc39.es/ecma262/#sec-array.prototype.reduceright + _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$6 || !USES_TO_LENGTH$a || CHROME_BUG$1 }, { reduceRight: function reduceRight(callbackfn /* , initialValue */) { return $reduceRight(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); } @@ -3493,7 +3107,7 @@ var test$1 = [1, 2]; // `Array.prototype.reverse` method - // https://tc39.github.io/ecma262/#sec-array.prototype.reverse + // https://tc39.es/ecma262/#sec-array.prototype.reverse // fix for Safari 12.0 bug // https://bugs.webkit.org/show_bug.cgi?id=188794 _export({ target: 'Array', proto: true, forced: String(test$1) === String(test$1.reverse()) }, { @@ -3512,7 +3126,7 @@ var max$1 = Math.max; // `Array.prototype.slice` method - // https://tc39.github.io/ecma262/#sec-array.prototype.slice + // https://tc39.es/ecma262/#sec-array.prototype.slice // fallback for not array-like ES3 strings and DOM objects _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 || !USES_TO_LENGTH$b }, { slice: function slice(start, end) { @@ -3550,7 +3164,7 @@ var USES_TO_LENGTH$c = arrayMethodUsesToLength('some'); // `Array.prototype.some` method - // https://tc39.github.io/ecma262/#sec-array.prototype.some + // https://tc39.es/ecma262/#sec-array.prototype.some _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$7 || !USES_TO_LENGTH$c }, { some: function some(callbackfn /* , thisArg */) { return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); @@ -3571,11 +3185,11 @@ // Old WebKit var STRICT_METHOD$8 = arrayMethodIsStrict('sort'); - var FORCED$4 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$8; + var FORCED$3 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$8; // `Array.prototype.sort` method - // https://tc39.github.io/ecma262/#sec-array.prototype.sort - _export({ target: 'Array', proto: true, forced: FORCED$4 }, { + // https://tc39.es/ecma262/#sec-array.prototype.sort + _export({ target: 'Array', proto: true, forced: FORCED$3 }, { sort: function sort(comparefn) { return comparefn === undefined ? nativeSort.call(toObject(this)) @@ -3592,7 +3206,7 @@ var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; // `Array.prototype.splice` method - // https://tc39.github.io/ecma262/#sec-array.prototype.splice + // https://tc39.es/ecma262/#sec-array.prototype.splice // with adding support of @@species _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 || !USES_TO_LENGTH$d }, { splice: function splice(start, deleteCount /* , ...items */) { @@ -3644,19 +3258,21 @@ }); // `Array[@@species]` getter - // https://tc39.github.io/ecma262/#sec-get-array-@@species + // https://tc39.es/ecma262/#sec-get-array-@@species setSpecies('Array'); // this method was added to unscopables after implementation // in popular engines, so it's moved to a separate module + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('flat'); // this method was added to unscopables after implementation // in popular engines, so it's moved to a separate module + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('flatMap'); var ITERATOR$3 = wellKnownSymbol('iterator'); @@ -3665,7 +3281,7 @@ var returnThis = function () { return this; }; // `%IteratorPrototype%` object - // https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object + // https://tc39.es/ecma262/#sec-%iteratorprototype%-object var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; if ([].keys) { @@ -3788,15 +3404,15 @@ var getInternalState$2 = internalState.getterFor(ARRAY_ITERATOR); // `Array.prototype.entries` method - // https://tc39.github.io/ecma262/#sec-array.prototype.entries + // https://tc39.es/ecma262/#sec-array.prototype.entries // `Array.prototype.keys` method - // https://tc39.github.io/ecma262/#sec-array.prototype.keys + // https://tc39.es/ecma262/#sec-array.prototype.keys // `Array.prototype.values` method - // https://tc39.github.io/ecma262/#sec-array.prototype.values + // https://tc39.es/ecma262/#sec-array.prototype.values // `Array.prototype[@@iterator]` method - // https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator + // https://tc39.es/ecma262/#sec-array.prototype-@@iterator // `CreateArrayIterator` internal method - // https://tc39.github.io/ecma262/#sec-createarrayiterator + // https://tc39.es/ecma262/#sec-createarrayiterator var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) { setInternalState$2(this, { type: ARRAY_ITERATOR, @@ -3805,7 +3421,7 @@ kind: kind // kind }); // `%ArrayIteratorPrototype%.next` method - // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next + // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next }, function () { var state = getInternalState$2(this); var target = state.target; @@ -3821,15 +3437,481 @@ }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% - // https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject - // https://tc39.github.io/ecma262/#sec-createmappedargumentsobject + // https://tc39.es/ecma262/#sec-createunmappedargumentsobject + // https://tc39.es/ecma262/#sec-createmappedargumentsobject iterators.Arguments = iterators.Array; - // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); + var slice$1 = [].slice; + var factories = {}; + + var construct = function (C, argsLength, args) { + if (!(argsLength in factories)) { + for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']'; + // eslint-disable-next-line no-new-func + factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')'); + } return factories[argsLength](C, args); + }; + + // `Function.prototype.bind` method implementation + // https://tc39.es/ecma262/#sec-function.prototype.bind + var functionBind = Function.bind || function bind(that /* , ...args */) { + var fn = aFunction$1(this); + var partArgs = slice$1.call(arguments, 1); + var boundFunction = function bound(/* args... */) { + var args = partArgs.concat(slice$1.call(arguments)); + return this instanceof boundFunction ? construct(fn, args.length, args) : fn.apply(that, args); + }; + if (isObject(fn.prototype)) boundFunction.prototype = fn.prototype; + return boundFunction; + }; + + // `Function.prototype.bind` method + // https://tc39.es/ecma262/#sec-function.prototype.bind + _export({ target: 'Function', proto: true }, { + bind: functionBind + }); + + var HAS_INSTANCE = wellKnownSymbol('hasInstance'); + var FunctionPrototype$1 = Function.prototype; + + // `Function.prototype[@@hasInstance]` method + // https://tc39.es/ecma262/#sec-function.prototype-@@hasinstance + if (!(HAS_INSTANCE in FunctionPrototype$1)) { + objectDefineProperty.f(FunctionPrototype$1, HAS_INSTANCE, { value: function (O) { + if (typeof this != 'function' || !isObject(O)) return false; + if (!isObject(this.prototype)) return O instanceof this; + // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: + while (O = objectGetPrototypeOf(O)) if (this.prototype === O) return true; + return false; + } }); + } + + // `globalThis` object + // https://tc39.es/ecma262/#sec-globalthis + _export({ global: true }, { + globalThis: global_1 + }); + + var nativeAssign = Object.assign; + var defineProperty$5 = Object.defineProperty; + + // `Object.assign` method + // https://tc39.es/ecma262/#sec-object.assign + var objectAssign = !nativeAssign || fails(function () { + // should have correct order of operations (Edge bug) + if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$5({}, 'a', { + enumerable: true, + get: function () { + defineProperty$5(this, 'b', { + value: 3, + enumerable: false + }); + } + }), { b: 2 })).b !== 1) return true; + // should work with symbols and should have deterministic property order (V8 bug) + var A = {}; + var B = {}; + // eslint-disable-next-line no-undef + var symbol = Symbol(); + var alphabet = 'abcdefghijklmnopqrst'; + A[symbol] = 7; + alphabet.split('').forEach(function (chr) { B[chr] = chr; }); + return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet; + }) ? function assign(target, source) { // eslint-disable-line no-unused-vars + var T = toObject(target); + var argumentsLength = arguments.length; + var index = 1; + var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; + var propertyIsEnumerable = objectPropertyIsEnumerable.f; + while (argumentsLength > index) { + var S = indexedObject(arguments[index++]); + var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S); + var length = keys.length; + var j = 0; + var key; + while (length > j) { + key = keys[j++]; + if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key]; + } + } return T; + } : nativeAssign; + + // `Object.assign` method + // https://tc39.es/ecma262/#sec-object.assign + _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, { + assign: objectAssign + }); + + // `Object.create` method + // https://tc39.es/ecma262/#sec-object.create + _export({ target: 'Object', stat: true, sham: !descriptors }, { + create: objectCreate + }); + + // `Object.defineProperty` method + // https://tc39.es/ecma262/#sec-object.defineproperty + _export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, { + defineProperty: objectDefineProperty.f + }); + + // `Object.defineProperties` method + // https://tc39.es/ecma262/#sec-object.defineproperties + _export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, { + defineProperties: objectDefineProperties + }); + + var propertyIsEnumerable = objectPropertyIsEnumerable.f; + + // `Object.{ entries, values }` methods implementation + var createMethod$3 = function (TO_ENTRIES) { + return function (it) { + var O = toIndexedObject(it); + var keys = objectKeys(O); + var length = keys.length; + var i = 0; + var result = []; + var key; + while (length > i) { + key = keys[i++]; + if (!descriptors || propertyIsEnumerable.call(O, key)) { + result.push(TO_ENTRIES ? [key, O[key]] : O[key]); + } + } + return result; + }; + }; + + var objectToArray = { + // `Object.entries` method + // https://tc39.es/ecma262/#sec-object.entries + entries: createMethod$3(true), + // `Object.values` method + // https://tc39.es/ecma262/#sec-object.values + values: createMethod$3(false) + }; + + var $entries = objectToArray.entries; + + // `Object.entries` method + // https://tc39.es/ecma262/#sec-object.entries + _export({ target: 'Object', stat: true }, { + entries: function entries(O) { + return $entries(O); + } + }); + + var freezing = !fails(function () { + return Object.isExtensible(Object.preventExtensions({})); + }); + + var internalMetadata = createCommonjsModule(function (module) { + var defineProperty = objectDefineProperty.f; + + + + var METADATA = uid('meta'); + var id = 0; + + var isExtensible = Object.isExtensible || function () { + return true; + }; + + var setMetadata = function (it) { + defineProperty(it, METADATA, { value: { + objectID: 'O' + ++id, // object ID + weakData: {} // weak collections IDs + } }); + }; + + var fastKey = function (it, create) { + // return a primitive with prefix + if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!has(it, METADATA)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return 'F'; + // not necessary to add metadata + if (!create) return 'E'; + // add missing metadata + setMetadata(it); + // return object ID + } return it[METADATA].objectID; + }; + + var getWeakData = function (it, create) { + if (!has(it, METADATA)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return true; + // not necessary to add metadata + if (!create) return false; + // add missing metadata + setMetadata(it); + // return the store of weak collections IDs + } return it[METADATA].weakData; + }; + + // add metadata on freeze-family methods calling + var onFreeze = function (it) { + if (freezing && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it); + return it; + }; + + var meta = module.exports = { + REQUIRED: false, + fastKey: fastKey, + getWeakData: getWeakData, + onFreeze: onFreeze + }; + + hiddenKeys[METADATA] = true; + }); + + var onFreeze = internalMetadata.onFreeze; + + var nativeFreeze = Object.freeze; + var FAILS_ON_PRIMITIVES = fails(function () { nativeFreeze(1); }); + + // `Object.freeze` method + // https://tc39.es/ecma262/#sec-object.freeze + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !freezing }, { + freeze: function freeze(it) { + return nativeFreeze && isObject(it) ? nativeFreeze(onFreeze(it)) : it; + } + }); + + // `Object.fromEntries` method + // https://github.com/tc39/proposal-object-from-entries + _export({ target: 'Object', stat: true }, { + fromEntries: function fromEntries(iterable) { + var obj = {}; + iterate(iterable, function (k, v) { + createProperty(obj, k, v); + }, { AS_ENTRIES: true }); + return obj; + } + }); + + var nativeGetOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; + + + var FAILS_ON_PRIMITIVES$1 = fails(function () { nativeGetOwnPropertyDescriptor$2(1); }); + var FORCED$4 = !descriptors || FAILS_ON_PRIMITIVES$1; + + // `Object.getOwnPropertyDescriptor` method + // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor + _export({ target: 'Object', stat: true, forced: FORCED$4, sham: !descriptors }, { + getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { + return nativeGetOwnPropertyDescriptor$2(toIndexedObject(it), key); + } + }); + + // `Object.getOwnPropertyDescriptors` method + // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors + _export({ target: 'Object', stat: true, sham: !descriptors }, { + getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { + var O = toIndexedObject(object); + var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; + var keys = ownKeys(O); + var result = {}; + var index = 0; + var key, descriptor; + while (keys.length > index) { + descriptor = getOwnPropertyDescriptor(O, key = keys[index++]); + if (descriptor !== undefined) createProperty(result, key, descriptor); + } + return result; + } + }); + + var nativeGetOwnPropertyNames$2 = objectGetOwnPropertyNamesExternal.f; + + var FAILS_ON_PRIMITIVES$2 = fails(function () { return !Object.getOwnPropertyNames(1); }); + + // `Object.getOwnPropertyNames` method + // https://tc39.es/ecma262/#sec-object.getownpropertynames + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$2 }, { + getOwnPropertyNames: nativeGetOwnPropertyNames$2 + }); + + var FAILS_ON_PRIMITIVES$3 = fails(function () { objectGetPrototypeOf(1); }); + + // `Object.getPrototypeOf` method + // https://tc39.es/ecma262/#sec-object.getprototypeof + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$3, sham: !correctPrototypeGetter }, { + getPrototypeOf: function getPrototypeOf(it) { + return objectGetPrototypeOf(toObject(it)); + } + }); + + // `SameValue` abstract operation + // https://tc39.es/ecma262/#sec-samevalue + 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; + }; + + // `Object.is` method + // https://tc39.es/ecma262/#sec-object.is + _export({ target: 'Object', stat: true }, { + is: sameValue + }); + + var nativeIsExtensible = Object.isExtensible; + var FAILS_ON_PRIMITIVES$4 = fails(function () { nativeIsExtensible(1); }); + + // `Object.isExtensible` method + // https://tc39.es/ecma262/#sec-object.isextensible + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$4 }, { + isExtensible: function isExtensible(it) { + return isObject(it) ? nativeIsExtensible ? nativeIsExtensible(it) : true : false; + } + }); + + var nativeIsFrozen = Object.isFrozen; + var FAILS_ON_PRIMITIVES$5 = fails(function () { nativeIsFrozen(1); }); + + // `Object.isFrozen` method + // https://tc39.es/ecma262/#sec-object.isfrozen + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$5 }, { + isFrozen: function isFrozen(it) { + return isObject(it) ? nativeIsFrozen ? nativeIsFrozen(it) : false : true; + } + }); + + var nativeIsSealed = Object.isSealed; + var FAILS_ON_PRIMITIVES$6 = fails(function () { nativeIsSealed(1); }); + + // `Object.isSealed` method + // https://tc39.es/ecma262/#sec-object.issealed + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$6 }, { + isSealed: function isSealed(it) { + return isObject(it) ? nativeIsSealed ? nativeIsSealed(it) : false : true; + } + }); + + var FAILS_ON_PRIMITIVES$7 = fails(function () { objectKeys(1); }); + + // `Object.keys` method + // https://tc39.es/ecma262/#sec-object.keys + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$7 }, { + keys: function keys(it) { + return objectKeys(toObject(it)); + } + }); + + var onFreeze$1 = internalMetadata.onFreeze; + + + + var nativePreventExtensions = Object.preventExtensions; + var FAILS_ON_PRIMITIVES$8 = fails(function () { nativePreventExtensions(1); }); + + // `Object.preventExtensions` method + // https://tc39.es/ecma262/#sec-object.preventextensions + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$8, sham: !freezing }, { + preventExtensions: function preventExtensions(it) { + return nativePreventExtensions && isObject(it) ? nativePreventExtensions(onFreeze$1(it)) : it; + } + }); + + var onFreeze$2 = internalMetadata.onFreeze; + + + + var nativeSeal = Object.seal; + var FAILS_ON_PRIMITIVES$9 = fails(function () { nativeSeal(1); }); + + // `Object.seal` method + // https://tc39.es/ecma262/#sec-object.seal + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$9, sham: !freezing }, { + seal: function seal(it) { + return nativeSeal && isObject(it) ? nativeSeal(onFreeze$2(it)) : it; + } + }); + + // `Object.setPrototypeOf` method + // https://tc39.es/ecma262/#sec-object.setprototypeof + _export({ target: 'Object', stat: true }, { + setPrototypeOf: objectSetPrototypeOf + }); + + var $values = objectToArray.values; + + // `Object.values` method + // https://tc39.es/ecma262/#sec-object.values + _export({ target: 'Object', stat: true }, { + values: function values(O) { + return $values(O); + } + }); + + // Forced replacement object prototype accessors methods + var objectPrototypeAccessorsForced = !fails(function () { + var key = Math.random(); + // In FF throws only define methods + // eslint-disable-next-line no-undef, no-useless-call + __defineSetter__.call(null, key, function () { /* empty */ }); + delete global_1[key]; + }); + + // `Object.prototype.__defineGetter__` method + // https://tc39.es/ecma262/#sec-object.prototype.__defineGetter__ + if (descriptors) { + _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { + __defineGetter__: function __defineGetter__(P, getter) { + objectDefineProperty.f(toObject(this), P, { get: aFunction$1(getter), enumerable: true, configurable: true }); + } + }); + } + + // `Object.prototype.__defineSetter__` method + // https://tc39.es/ecma262/#sec-object.prototype.__defineSetter__ + if (descriptors) { + _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { + __defineSetter__: function __defineSetter__(P, setter) { + objectDefineProperty.f(toObject(this), P, { set: aFunction$1(setter), enumerable: true, configurable: true }); + } + }); + } + + var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f; + + // `Object.prototype.__lookupGetter__` method + // https://tc39.es/ecma262/#sec-object.prototype.__lookupGetter__ + if (descriptors) { + _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { + __lookupGetter__: function __lookupGetter__(P) { + var O = toObject(this); + var key = toPrimitive(P, true); + var desc; + do { + if (desc = getOwnPropertyDescriptor$3(O, key)) return desc.get; + } while (O = objectGetPrototypeOf(O)); + } + }); + } + + var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f; + + // `Object.prototype.__lookupSetter__` method + // https://tc39.es/ecma262/#sec-object.prototype.__lookupSetter__ + if (descriptors) { + _export({ target: 'Object', proto: true, forced: objectPrototypeAccessorsForced }, { + __lookupSetter__: function __lookupSetter__(P) { + var O = toObject(this); + var key = toPrimitive(P, true); + var desc; + do { + if (desc = getOwnPropertyDescriptor$4(O, key)) return desc.set; + } while (O = objectGetPrototypeOf(O)); + } + }); + } + var fromCharCode = String.fromCharCode; var nativeFromCodePoint = String.fromCodePoint; @@ -3837,7 +3919,7 @@ var INCORRECT_LENGTH = !!nativeFromCodePoint && nativeFromCodePoint.length != 1; // `String.fromCodePoint` method - // https://tc39.github.io/ecma262/#sec-string.fromcodepoint + // https://tc39.es/ecma262/#sec-string.fromcodepoint _export({ target: 'String', stat: true, forced: INCORRECT_LENGTH }, { fromCodePoint: function fromCodePoint(x) { // eslint-disable-line no-unused-vars var elements = []; @@ -3856,7 +3938,7 @@ }); // `String.raw` method - // https://tc39.github.io/ecma262/#sec-string.raw + // https://tc39.es/ecma262/#sec-string.raw _export({ target: 'String', stat: true }, { raw: function raw(template) { var rawTemplate = toIndexedObject(template.raw); @@ -3889,7 +3971,7 @@ var stringMultibyte = { // `String.prototype.codePointAt` method - // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat + // https://tc39.es/ecma262/#sec-string.prototype.codepointat codeAt: createMethod$4(false), // `String.prototype.at` method // https://github.com/mathiasbynens/String.prototype.at @@ -3899,7 +3981,7 @@ var codeAt = stringMultibyte.codeAt; // `String.prototype.codePointAt` method - // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat + // https://tc39.es/ecma262/#sec-string.prototype.codepointat _export({ target: 'String', proto: true }, { codePointAt: function codePointAt(pos) { return codeAt(this, pos); @@ -3909,7 +3991,7 @@ var MATCH = wellKnownSymbol('match'); // `IsRegExp` abstract operation - // https://tc39.github.io/ecma262/#sec-isregexp + // https://tc39.es/ecma262/#sec-isregexp var isRegexp = function (it) { var isRegExp; return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp'); @@ -3927,11 +4009,11 @@ var regexp = /./; try { '/./'[METHOD_NAME](regexp); - } catch (e) { + } catch (error1) { try { regexp[MATCH$1] = false; return '/./'[METHOD_NAME](regexp); - } catch (f) { /* empty */ } + } catch (error2) { /* empty */ } } return false; }; @@ -3953,7 +4035,7 @@ }(); // `String.prototype.endsWith` method - // https://tc39.github.io/ecma262/#sec-string.prototype.endswith + // https://tc39.es/ecma262/#sec-string.prototype.endswith _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, { endsWith: function endsWith(searchString /* , endPosition = @length */) { var that = String(requireObjectCoercible(this)); @@ -3969,7 +4051,7 @@ }); // `String.prototype.includes` method - // https://tc39.github.io/ecma262/#sec-string.prototype.includes + // https://tc39.es/ecma262/#sec-string.prototype.includes _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, { includes: function includes(searchString /* , position = 0 */) { return !!~String(requireObjectCoercible(this)) @@ -3978,7 +4060,7 @@ }); // `RegExp.prototype.flags` getter implementation - // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags + // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags var regexpFlags = function () { var that = anObject(this); var result = ''; @@ -4100,6 +4182,8 @@ var regexpExec = patchedExec; + // `RegExp.prototype.exec` method + // https://tc39.es/ecma262/#sec-regexp.prototype.exec _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, { exec: regexpExec }); @@ -4232,13 +4316,13 @@ var charAt = stringMultibyte.charAt; // `AdvanceStringIndex` abstract operation - // https://tc39.github.io/ecma262/#sec-advancestringindex + // https://tc39.es/ecma262/#sec-advancestringindex var advanceStringIndex = function (S, index, unicode) { return index + (unicode ? charAt(S, index).length : 1); }; // `RegExpExec` abstract operation - // https://tc39.github.io/ecma262/#sec-regexpexec + // https://tc39.es/ecma262/#sec-regexpexec var regexpExecAbstract = function (R, S) { var exec = R.exec; if (typeof exec === 'function') { @@ -4260,14 +4344,14 @@ fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) { return [ // `String.prototype.match` method - // https://tc39.github.io/ecma262/#sec-string.prototype.match + // https://tc39.es/ecma262/#sec-string.prototype.match function match(regexp) { var O = requireObjectCoercible(this); var matcher = regexp == undefined ? undefined : regexp[MATCH]; return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); }, // `RegExp.prototype[@@match]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match + // https://tc39.es/ecma262/#sec-regexp.prototype-@@match function (regexp) { var res = maybeCallNative(nativeMatch, regexp, this); if (res.done) return res.value; @@ -4359,7 +4443,7 @@ }; // `String.prototype.matchAll` method - // https://github.com/tc39/proposal-string-matchall + // https://tc39.es/ecma262/#sec-string.prototype.matchall _export({ target: 'String', proto: true, forced: WORKS_WITH_NON_GLOBAL_REGEX }, { matchAll: function matchAll(regexp) { var O = requireObjectCoercible(this); @@ -4386,7 +4470,7 @@ MATCH_ALL in RegExpPrototype || createNonEnumerableProperty(RegExpPrototype, MATCH_ALL, $matchAll); // `String.prototype.repeat` method implementation - // https://tc39.github.io/ecma262/#sec-string.prototype.repeat + // https://tc39.es/ecma262/#sec-string.prototype.repeat var stringRepeat = ''.repeat || function repeat(count) { var str = String(requireObjectCoercible(this)); var result = ''; @@ -4421,10 +4505,10 @@ var stringPad = { // `String.prototype.padStart` method - // https://tc39.github.io/ecma262/#sec-string.prototype.padstart + // https://tc39.es/ecma262/#sec-string.prototype.padstart start: createMethod$5(false), // `String.prototype.padEnd` method - // https://tc39.github.io/ecma262/#sec-string.prototype.padend + // https://tc39.es/ecma262/#sec-string.prototype.padend end: createMethod$5(true) }; @@ -4438,7 +4522,7 @@ // `String.prototype.padEnd` method - // https://tc39.github.io/ecma262/#sec-string.prototype.padend + // https://tc39.es/ecma262/#sec-string.prototype.padend _export({ target: 'String', proto: true, forced: stringPadWebkitBug }, { padEnd: function padEnd(maxLength /* , fillString = ' ' */) { return $padEnd(this, maxLength, arguments.length > 1 ? arguments[1] : undefined); @@ -4449,7 +4533,7 @@ // `String.prototype.padStart` method - // https://tc39.github.io/ecma262/#sec-string.prototype.padstart + // https://tc39.es/ecma262/#sec-string.prototype.padstart _export({ target: 'String', proto: true, forced: stringPadWebkitBug }, { padStart: function padStart(maxLength /* , fillString = ' ' */) { return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined); @@ -4457,17 +4541,53 @@ }); // `String.prototype.repeat` method - // https://tc39.github.io/ecma262/#sec-string.prototype.repeat + // https://tc39.es/ecma262/#sec-string.prototype.repeat _export({ target: 'String', proto: true }, { repeat: stringRepeat }); - var max$3 = Math.max; - var min$6 = Math.min; var floor$1 = Math.floor; + var replace = ''.replace; var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g; var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g; + // https://tc39.es/ecma262/#sec-getsubstitution + var getSubstitution = function (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 max$3 = Math.max; + var min$6 = Math.min; + var maybeToString = function (it) { return it === undefined ? it : String(it); }; @@ -4480,7 +4600,7 @@ return [ // `String.prototype.replace` method - // https://tc39.github.io/ecma262/#sec-string.prototype.replace + // https://tc39.es/ecma262/#sec-string.prototype.replace function replace(searchValue, replaceValue) { var O = requireObjectCoercible(this); var replacer = searchValue == undefined ? undefined : searchValue[REPLACE]; @@ -4489,7 +4609,7 @@ : nativeReplace.call(String(O), searchValue, replaceValue); }, // `RegExp.prototype[@@replace]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace + // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace function (regexp, replaceValue) { if ( (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) || @@ -4552,54 +4672,20 @@ return accumulatedResult + S.slice(nextSourcePosition); } ]; - - // https://tc39.github.io/ecma262/#sec-getsubstitution - function getSubstitution(matched, str, position, captures, namedCaptures, replacement) { - var tailPos = position + matched.length; - var m = captures.length; - var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; - if (namedCaptures !== undefined) { - namedCaptures = toObject(namedCaptures); - symbols = SUBSTITUTION_SYMBOLS; - } - return nativeReplace.call(replacement, symbols, function (match, ch) { - var capture; - switch (ch.charAt(0)) { - case '$': return '$'; - case '&': return matched; - case '`': return str.slice(0, position); - case "'": return str.slice(tailPos); - case '<': - capture = namedCaptures[ch.slice(1, -1)]; - break; - default: // \d\d? - var n = +ch; - if (n === 0) return match; - if (n > m) { - var f = floor$1(n / 10); - if (f === 0) return match; - if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1); - return match; - } - capture = captures[n - 1]; - } - return capture === undefined ? '' : capture; - }); - } }); // @@search logic fixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) { return [ // `String.prototype.search` method - // https://tc39.github.io/ecma262/#sec-string.prototype.search + // https://tc39.es/ecma262/#sec-string.prototype.search function search(regexp) { var O = requireObjectCoercible(this); var searcher = regexp == undefined ? undefined : regexp[SEARCH]; return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); }, // `RegExp.prototype[@@search]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search + // https://tc39.es/ecma262/#sec-regexp.prototype-@@search function (regexp) { var res = maybeCallNative(nativeSearch, regexp, this); if (res.done) return res.value; @@ -4678,7 +4764,7 @@ return [ // `String.prototype.split` method - // https://tc39.github.io/ecma262/#sec-string.prototype.split + // https://tc39.es/ecma262/#sec-string.prototype.split function split(separator, limit) { var O = requireObjectCoercible(this); var splitter = separator == undefined ? undefined : separator[SPLIT]; @@ -4687,7 +4773,7 @@ : internalSplit.call(String(O), separator, limit); }, // `RegExp.prototype[@@split]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split + // https://tc39.es/ecma262/#sec-regexp.prototype-@@split // // NOTE: This cannot be properly polyfilled in engines that don't support // the 'y' flag. @@ -4757,7 +4843,7 @@ }(); // `String.prototype.startsWith` method - // https://tc39.github.io/ecma262/#sec-string.prototype.startswith + // https://tc39.es/ecma262/#sec-string.prototype.startswith _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG$1 && !CORRECT_IS_REGEXP_LOGIC$1 }, { startsWith: function startsWith(searchString /* , position = 0 */) { var that = String(requireObjectCoercible(this)); @@ -4790,13 +4876,13 @@ var stringTrim = { // `String.prototype.{ trimLeft, trimStart }` methods - // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart + // https://tc39.es/ecma262/#sec-string.prototype.trimstart start: createMethod$6(1), // `String.prototype.{ trimRight, trimEnd }` methods - // https://tc39.github.io/ecma262/#sec-string.prototype.trimend + // https://tc39.es/ecma262/#sec-string.prototype.trimend end: createMethod$6(2), // `String.prototype.trim` method - // https://tc39.github.io/ecma262/#sec-string.prototype.trim + // https://tc39.es/ecma262/#sec-string.prototype.trim trim: createMethod$6(3) }; @@ -4814,7 +4900,7 @@ // `String.prototype.trim` method - // https://tc39.github.io/ecma262/#sec-string.prototype.trim + // https://tc39.es/ecma262/#sec-string.prototype.trim _export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, { trim: function trim() { return $trim(this); @@ -4831,7 +4917,8 @@ } : ''.trimStart; // `String.prototype.{ trimStart, trimLeft }` methods - // https://github.com/tc39/ecmascript-string-left-right-trim + // https://tc39.es/ecma262/#sec-string.prototype.trimstart + // https://tc39.es/ecma262/#String.prototype.trimleft _export({ target: 'String', proto: true, forced: FORCED$5 }, { trimStart: trimStart, trimLeft: trimStart @@ -4847,7 +4934,8 @@ } : ''.trimEnd; // `String.prototype.{ trimEnd, trimRight }` methods - // https://github.com/tc39/ecmascript-string-left-right-trim + // https://tc39.es/ecma262/#sec-string.prototype.trimend + // https://tc39.es/ecma262/#String.prototype.trimright _export({ target: 'String', proto: true, forced: FORCED$6 }, { trimEnd: trimEnd, trimRight: trimEnd @@ -4862,7 +4950,7 @@ var getInternalState$4 = internalState.getterFor(STRING_ITERATOR); // `String.prototype[@@iterator]` method - // https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator + // https://tc39.es/ecma262/#sec-string.prototype-@@iterator defineIterator(String, 'String', function (iterated) { setInternalState$4(this, { type: STRING_ITERATOR, @@ -4870,7 +4958,7 @@ index: 0 }); // `%StringIteratorPrototype%.next` method - // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next + // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next }, function next() { var state = getInternalState$4(this); var string = state.string; @@ -4885,7 +4973,7 @@ var quot = /"/g; // B.2.3.2.1 CreateHTML(string, tag, attribute, value) - // https://tc39.github.io/ecma262/#sec-createhtml + // https://tc39.es/ecma262/#sec-createhtml var createHtml = function (string, tag, attribute, value) { var S = String(requireObjectCoercible(string)); var p1 = '<' + tag; @@ -4903,7 +4991,7 @@ }; // `String.prototype.anchor` method - // https://tc39.github.io/ecma262/#sec-string.prototype.anchor + // https://tc39.es/ecma262/#sec-string.prototype.anchor _export({ target: 'String', proto: true, forced: stringHtmlForced('anchor') }, { anchor: function anchor(name) { return createHtml(this, 'a', 'name', name); @@ -4911,7 +4999,7 @@ }); // `String.prototype.big` method - // https://tc39.github.io/ecma262/#sec-string.prototype.big + // https://tc39.es/ecma262/#sec-string.prototype.big _export({ target: 'String', proto: true, forced: stringHtmlForced('big') }, { big: function big() { return createHtml(this, 'big', '', ''); @@ -4919,7 +5007,7 @@ }); // `String.prototype.blink` method - // https://tc39.github.io/ecma262/#sec-string.prototype.blink + // https://tc39.es/ecma262/#sec-string.prototype.blink _export({ target: 'String', proto: true, forced: stringHtmlForced('blink') }, { blink: function blink() { return createHtml(this, 'blink', '', ''); @@ -4927,7 +5015,7 @@ }); // `String.prototype.bold` method - // https://tc39.github.io/ecma262/#sec-string.prototype.bold + // https://tc39.es/ecma262/#sec-string.prototype.bold _export({ target: 'String', proto: true, forced: stringHtmlForced('bold') }, { bold: function bold() { return createHtml(this, 'b', '', ''); @@ -4935,7 +5023,7 @@ }); // `String.prototype.fixed` method - // https://tc39.github.io/ecma262/#sec-string.prototype.fixed + // https://tc39.es/ecma262/#sec-string.prototype.fixed _export({ target: 'String', proto: true, forced: stringHtmlForced('fixed') }, { fixed: function fixed() { return createHtml(this, 'tt', '', ''); @@ -4943,7 +5031,7 @@ }); // `String.prototype.fontcolor` method - // https://tc39.github.io/ecma262/#sec-string.prototype.fontcolor + // https://tc39.es/ecma262/#sec-string.prototype.fontcolor _export({ target: 'String', proto: true, forced: stringHtmlForced('fontcolor') }, { fontcolor: function fontcolor(color) { return createHtml(this, 'font', 'color', color); @@ -4951,7 +5039,7 @@ }); // `String.prototype.fontsize` method - // https://tc39.github.io/ecma262/#sec-string.prototype.fontsize + // https://tc39.es/ecma262/#sec-string.prototype.fontsize _export({ target: 'String', proto: true, forced: stringHtmlForced('fontsize') }, { fontsize: function fontsize(size) { return createHtml(this, 'font', 'size', size); @@ -4959,7 +5047,7 @@ }); // `String.prototype.italics` method - // https://tc39.github.io/ecma262/#sec-string.prototype.italics + // https://tc39.es/ecma262/#sec-string.prototype.italics _export({ target: 'String', proto: true, forced: stringHtmlForced('italics') }, { italics: function italics() { return createHtml(this, 'i', '', ''); @@ -4967,7 +5055,7 @@ }); // `String.prototype.link` method - // https://tc39.github.io/ecma262/#sec-string.prototype.link + // https://tc39.es/ecma262/#sec-string.prototype.link _export({ target: 'String', proto: true, forced: stringHtmlForced('link') }, { link: function link(url) { return createHtml(this, 'a', 'href', url); @@ -4975,7 +5063,7 @@ }); // `String.prototype.small` method - // https://tc39.github.io/ecma262/#sec-string.prototype.small + // https://tc39.es/ecma262/#sec-string.prototype.small _export({ target: 'String', proto: true, forced: stringHtmlForced('small') }, { small: function small() { return createHtml(this, 'small', '', ''); @@ -4983,7 +5071,7 @@ }); // `String.prototype.strike` method - // https://tc39.github.io/ecma262/#sec-string.prototype.strike + // https://tc39.es/ecma262/#sec-string.prototype.strike _export({ target: 'String', proto: true, forced: stringHtmlForced('strike') }, { strike: function strike() { return createHtml(this, 'strike', '', ''); @@ -4991,7 +5079,7 @@ }); // `String.prototype.sub` method - // https://tc39.github.io/ecma262/#sec-string.prototype.sub + // https://tc39.es/ecma262/#sec-string.prototype.sub _export({ target: 'String', proto: true, forced: stringHtmlForced('sub') }, { sub: function sub() { return createHtml(this, 'sub', '', ''); @@ -4999,13 +5087,70 @@ }); // `String.prototype.sup` method - // https://tc39.github.io/ecma262/#sec-string.prototype.sup + // https://tc39.es/ecma262/#sec-string.prototype.sup _export({ target: 'String', proto: true, forced: stringHtmlForced('sup') }, { sup: function sup() { return createHtml(this, 'sup', '', ''); } }); + var REPLACE$1 = wellKnownSymbol('replace'); + var RegExpPrototype$1 = RegExp.prototype; + var max$4 = Math.max; + + var stringIndexOf = function (string, searchValue, fromIndex) { + if (fromIndex > string.length) return -1; + if (searchValue === '') return fromIndex; + return string.indexOf(searchValue, fromIndex); + }; + + // `String.prototype.replaceAll` method + // https://tc39.es/ecma262/#sec-string.prototype.replaceall + _export({ target: 'String', proto: true }, { + replaceAll: function replaceAll(searchValue, replaceValue) { + var O = requireObjectCoercible(this); + var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement; + var position = 0; + var endOfLastMatch = 0; + var result = ''; + if (searchValue != null) { + IS_REG_EXP = isRegexp(searchValue); + if (IS_REG_EXP) { + flags = String(requireObjectCoercible('flags' in RegExpPrototype$1 + ? searchValue.flags + : regexpFlags.call(searchValue) + )); + if (!~flags.indexOf('g')) throw TypeError('`.replaceAll` does not allow non-global regexes'); + } + replacer = searchValue[REPLACE$1]; + if (replacer !== undefined) { + return replacer.call(searchValue, O, replaceValue); + } + } + string = String(O); + searchString = String(searchValue); + functionalReplace = typeof replaceValue === 'function'; + if (!functionalReplace) replaceValue = String(replaceValue); + searchLength = searchString.length; + advanceBy = max$4(1, searchLength); + position = stringIndexOf(string, searchString, 0); + while (position !== -1) { + if (functionalReplace) { + replacement = String(replaceValue(searchString, position, string)); + } else { + replacement = getSubstitution(searchString, string, position, [], undefined, replaceValue); + } + result += string.slice(endOfLastMatch, position) + replacement; + endOfLastMatch = position + searchLength; + position = stringIndexOf(string, searchString, position + advanceBy); + } + if (endOfLastMatch < string.length) { + result += string.slice(endOfLastMatch); + } + return result; + } + }); + // makes subclassing work correct for wrapped built-ins var inheritIfRequired = function ($this, dummy, Wrapper) { var NewTarget, NewTargetPrototype; @@ -5034,7 +5179,7 @@ var MATCH$2 = wellKnownSymbol('match'); var NativeRegExp = global_1.RegExp; - var RegExpPrototype$1 = NativeRegExp.prototype; + var RegExpPrototype$2 = NativeRegExp.prototype; var re1 = /a/g; var re2 = /a/g; @@ -5050,7 +5195,7 @@ }))); // `RegExp` constructor - // https://tc39.github.io/ecma262/#sec-regexp-constructor + // https://tc39.es/ecma262/#sec-regexp-constructor if (FORCED$7) { var RegExpWrapper = function RegExp(pattern, flags) { var thisIsRegExp = this instanceof RegExpWrapper; @@ -5076,7 +5221,7 @@ var result = inheritIfRequired( CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags), - thisIsRegExp ? this : RegExpPrototype$1, + thisIsRegExp ? this : RegExpPrototype$2, RegExpWrapper ); @@ -5094,18 +5239,18 @@ var keys$1 = getOwnPropertyNames(NativeRegExp); var index = 0; while (keys$1.length > index) proxy(keys$1[index++]); - RegExpPrototype$1.constructor = RegExpWrapper; - RegExpWrapper.prototype = RegExpPrototype$1; + RegExpPrototype$2.constructor = RegExpWrapper; + RegExpWrapper.prototype = RegExpPrototype$2; redefine(global_1, 'RegExp', RegExpWrapper); } - // https://tc39.github.io/ecma262/#sec-get-regexp-@@species + // https://tc39.es/ecma262/#sec-get-regexp-@@species setSpecies('RegExp'); var UNSUPPORTED_Y$3 = regexpStickyHelpers.UNSUPPORTED_Y; // `RegExp.prototype.flags` getter - // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags + // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags if (descriptors && (/./g.flags != 'g' || UNSUPPORTED_Y$3)) { objectDefineProperty.f(RegExp.prototype, 'flags', { configurable: true, @@ -5116,14 +5261,15 @@ var UNSUPPORTED_Y$4 = regexpStickyHelpers.UNSUPPORTED_Y; var defineProperty$7 = objectDefineProperty.f; var getInternalState$5 = internalState.get; - var RegExpPrototype$2 = RegExp.prototype; + var RegExpPrototype$3 = RegExp.prototype; // `RegExp.prototype.sticky` getter + // https://tc39.es/ecma262/#sec-get-regexp.prototype.sticky if (descriptors && UNSUPPORTED_Y$4) { defineProperty$7(RegExp.prototype, 'sticky', { configurable: true, get: function () { - if (this === RegExpPrototype$2) return undefined; + if (this === RegExpPrototype$3) return undefined; // We can't use InternalStateModule.getterFor because // we don't add metadata for regexps created by a literal. if (this instanceof RegExp) { @@ -5151,6 +5297,8 @@ var nativeTest = /./.test; + // `RegExp.prototype.test` method + // https://tc39.es/ecma262/#sec-regexp.prototype.test _export({ target: 'RegExp', proto: true, forced: !DELEGATES_TO_EXEC }, { test: function (str) { if (typeof this.exec !== 'function') { @@ -5165,21 +5313,21 @@ }); var TO_STRING = 'toString'; - var RegExpPrototype$3 = RegExp.prototype; - var nativeToString = RegExpPrototype$3[TO_STRING]; + var RegExpPrototype$4 = RegExp.prototype; + var nativeToString = RegExpPrototype$4[TO_STRING]; var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); // FF44- RegExp#toString has a wrong name var INCORRECT_NAME = nativeToString.name != TO_STRING; // `RegExp.prototype.toString` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring + // https://tc39.es/ecma262/#sec-regexp.prototype.tostring if (NOT_GENERIC || INCORRECT_NAME) { redefine(RegExp.prototype, TO_STRING, function toString() { var R = anObject(this); var p = String(R.source); var rf = R.flags; - var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype$3) ? regexpFlags.call(R) : rf); + var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype$4) ? regexpFlags.call(R) : rf); return '/' + p + '/' + f; }, { unsafe: true }); } @@ -5192,14 +5340,14 @@ var FORCED$8 = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22; // `parseInt` method - // https://tc39.github.io/ecma262/#sec-parseint-string-radix + // https://tc39.es/ecma262/#sec-parseint-string-radix var numberParseInt = FORCED$8 ? function parseInt(string, radix) { var S = trim(String(string)); return $parseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10)); } : $parseInt; // `parseInt` method - // https://tc39.github.io/ecma262/#sec-parseint-string-radix + // https://tc39.es/ecma262/#sec-parseint-string-radix _export({ global: true, forced: parseInt != numberParseInt }, { parseInt: numberParseInt }); @@ -5211,7 +5359,7 @@ var FORCED$9 = 1 / $parseFloat(whitespaces + '-0') !== -Infinity; // `parseFloat` method - // https://tc39.github.io/ecma262/#sec-parsefloat-string + // https://tc39.es/ecma262/#sec-parsefloat-string var numberParseFloat = FORCED$9 ? function parseFloat(string) { var trimmedString = trim$1(String(string)); var result = $parseFloat(trimmedString); @@ -5219,7 +5367,7 @@ } : $parseFloat; // `parseFloat` method - // https://tc39.github.io/ecma262/#sec-parsefloat-string + // https://tc39.es/ecma262/#sec-parsefloat-string _export({ global: true, forced: parseFloat != numberParseFloat }, { parseFloat: numberParseFloat }); @@ -5237,7 +5385,7 @@ var BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER; // `ToNumber` abstract operation - // https://tc39.github.io/ecma262/#sec-tonumber + // https://tc39.es/ecma262/#sec-tonumber var toNumber = function (argument) { var it = toPrimitive(argument, false); var first, third, radix, maxCode, digits, length, index, code; @@ -5266,7 +5414,7 @@ }; // `Number` constructor - // https://tc39.github.io/ecma262/#sec-number-constructor + // https://tc39.es/ecma262/#sec-number-constructor if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) { var NumberWrapper = function Number(value) { var it = arguments.length < 1 ? 0 : value; @@ -5281,7 +5429,9 @@ 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + // ES2015 (in case, if modules with ES2015 Number statics required before): 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + - 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,' + + // ESNext + 'fromString,range' ).split(','), j = 0, key; keys$2.length > j; j++) { if (has(NativeNumber, key = keys$2[j]) && !has(NumberWrapper, key)) { defineProperty$8(NumberWrapper, key, getOwnPropertyDescriptor$7(NativeNumber, key)); @@ -5293,7 +5443,7 @@ } // `Number.EPSILON` constant - // https://tc39.github.io/ecma262/#sec-number.epsilon + // https://tc39.es/ecma262/#sec-number.epsilon _export({ target: 'Number', stat: true }, { EPSILON: Math.pow(2, -52) }); @@ -5301,31 +5451,31 @@ var globalIsFinite = global_1.isFinite; // `Number.isFinite` method - // https://tc39.github.io/ecma262/#sec-number.isfinite + // https://tc39.es/ecma262/#sec-number.isfinite var numberIsFinite = Number.isFinite || function isFinite(it) { return typeof it == 'number' && globalIsFinite(it); }; // `Number.isFinite` method - // https://tc39.github.io/ecma262/#sec-number.isfinite + // https://tc39.es/ecma262/#sec-number.isfinite _export({ target: 'Number', stat: true }, { isFinite: numberIsFinite }); var floor$2 = Math.floor; // `Number.isInteger` method implementation - // https://tc39.github.io/ecma262/#sec-number.isinteger + // https://tc39.es/ecma262/#sec-number.isinteger var isInteger = function isInteger(it) { return !isObject(it) && isFinite(it) && floor$2(it) === it; }; // `Number.isInteger` method - // https://tc39.github.io/ecma262/#sec-number.isinteger + // https://tc39.es/ecma262/#sec-number.isinteger _export({ target: 'Number', stat: true }, { isInteger: isInteger }); // `Number.isNaN` method - // https://tc39.github.io/ecma262/#sec-number.isnan + // https://tc39.es/ecma262/#sec-number.isnan _export({ target: 'Number', stat: true }, { isNaN: function isNaN(number) { // eslint-disable-next-line no-self-compare @@ -5336,7 +5486,7 @@ var abs = Math.abs; // `Number.isSafeInteger` method - // https://tc39.github.io/ecma262/#sec-number.issafeinteger + // https://tc39.es/ecma262/#sec-number.issafeinteger _export({ target: 'Number', stat: true }, { isSafeInteger: function isSafeInteger(number) { return isInteger(number) && abs(number) <= 0x1FFFFFFFFFFFFF; @@ -5344,31 +5494,31 @@ }); // `Number.MAX_SAFE_INTEGER` constant - // https://tc39.github.io/ecma262/#sec-number.max_safe_integer + // https://tc39.es/ecma262/#sec-number.max_safe_integer _export({ target: 'Number', stat: true }, { MAX_SAFE_INTEGER: 0x1FFFFFFFFFFFFF }); // `Number.MIN_SAFE_INTEGER` constant - // https://tc39.github.io/ecma262/#sec-number.min_safe_integer + // https://tc39.es/ecma262/#sec-number.min_safe_integer _export({ target: 'Number', stat: true }, { MIN_SAFE_INTEGER: -0x1FFFFFFFFFFFFF }); // `Number.parseFloat` method - // https://tc39.github.io/ecma262/#sec-number.parseFloat + // https://tc39.es/ecma262/#sec-number.parseFloat _export({ target: 'Number', stat: true, forced: Number.parseFloat != numberParseFloat }, { parseFloat: numberParseFloat }); // `Number.parseInt` method - // https://tc39.github.io/ecma262/#sec-number.parseint + // https://tc39.es/ecma262/#sec-number.parseint _export({ target: 'Number', stat: true, forced: Number.parseInt != numberParseInt }, { parseInt: numberParseInt }); // `thisNumberValue` abstract operation - // https://tc39.github.io/ecma262/#sec-thisnumbervalue + // https://tc39.es/ecma262/#sec-thisnumbervalue var thisNumberValue = function (value) { if (typeof value != 'number' && classofRaw(value) != 'Number') { throw TypeError('Incorrect invocation'); @@ -5407,7 +5557,7 @@ }); // `Number.prototype.toFixed` method - // https://tc39.github.io/ecma262/#sec-number.prototype.tofixed + // https://tc39.es/ecma262/#sec-number.prototype.tofixed _export({ target: 'Number', proto: true, forced: FORCED$a }, { // eslint-disable-next-line max-statements toFixed: function toFixed(fractionDigits) { @@ -5507,7 +5657,7 @@ }); // `Number.prototype.toPrecision` method - // https://tc39.github.io/ecma262/#sec-number.prototype.toprecision + // https://tc39.es/ecma262/#sec-number.prototype.toprecision _export({ target: 'Number', proto: true, forced: FORCED$b }, { toPrecision: function toPrecision(precision) { return precision === undefined @@ -5519,7 +5669,7 @@ var log$1 = Math.log; // `Math.log1p` method implementation - // https://tc39.github.io/ecma262/#sec-math.log1p + // https://tc39.es/ecma262/#sec-math.log1p var mathLog1p = Math.log1p || function log1p(x) { return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log$1(1 + x); }; @@ -5536,7 +5686,7 @@ || nativeAcosh(Infinity) != Infinity; // `Math.acosh` method - // https://tc39.github.io/ecma262/#sec-math.acosh + // https://tc39.es/ecma262/#sec-math.acosh _export({ target: 'Math', stat: true, forced: FORCED$c }, { acosh: function acosh(x) { return (x = +x) < 1 ? NaN : x > 94906265.62425156 @@ -5554,7 +5704,7 @@ } // `Math.asinh` method - // https://tc39.github.io/ecma262/#sec-math.asinh + // https://tc39.es/ecma262/#sec-math.asinh // Tor Browser bug: Math.asinh(0) -> -0 _export({ target: 'Math', stat: true, forced: !(nativeAsinh && 1 / nativeAsinh(0) > 0) }, { asinh: asinh @@ -5564,7 +5714,7 @@ var log$4 = Math.log; // `Math.atanh` method - // https://tc39.github.io/ecma262/#sec-math.atanh + // https://tc39.es/ecma262/#sec-math.atanh // Tor Browser bug: Math.atanh(-0) -> 0 _export({ target: 'Math', stat: true, forced: !(nativeAtanh && 1 / nativeAtanh(-0) < 0) }, { atanh: function atanh(x) { @@ -5573,7 +5723,7 @@ }); // `Math.sign` method implementation - // https://tc39.github.io/ecma262/#sec-math.sign + // https://tc39.es/ecma262/#sec-math.sign var mathSign = Math.sign || function sign(x) { // eslint-disable-next-line no-self-compare return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; @@ -5583,7 +5733,7 @@ var pow$1 = Math.pow; // `Math.cbrt` method - // https://tc39.github.io/ecma262/#sec-math.cbrt + // https://tc39.es/ecma262/#sec-math.cbrt _export({ target: 'Math', stat: true }, { cbrt: function cbrt(x) { return mathSign(x = +x) * pow$1(abs$1(x), 1 / 3); @@ -5595,7 +5745,7 @@ var LOG2E = Math.LOG2E; // `Math.clz32` method - // https://tc39.github.io/ecma262/#sec-math.clz32 + // https://tc39.es/ecma262/#sec-math.clz32 _export({ target: 'Math', stat: true }, { clz32: function clz32(x) { return (x >>>= 0) ? 31 - floor$4(log$5(x + 0.5) * LOG2E) : 32; @@ -5606,7 +5756,7 @@ var exp = Math.exp; // `Math.expm1` method implementation - // https://tc39.github.io/ecma262/#sec-math.expm1 + // https://tc39.es/ecma262/#sec-math.expm1 var mathExpm1 = (!nativeExpm1 // Old FF bug || nativeExpm1(10) > 22025.465794806719 || nativeExpm1(10) < 22025.4657948067165168 @@ -5621,7 +5771,7 @@ var E = Math.E; // `Math.cosh` method - // https://tc39.github.io/ecma262/#sec-math.cosh + // https://tc39.es/ecma262/#sec-math.cosh _export({ target: 'Math', stat: true, forced: !nativeCosh || nativeCosh(710) === Infinity }, { cosh: function cosh(x) { var t = mathExpm1(abs$2(x) - 1) + 1; @@ -5630,7 +5780,7 @@ }); // `Math.expm1` method - // https://tc39.github.io/ecma262/#sec-math.expm1 + // https://tc39.es/ecma262/#sec-math.expm1 _export({ target: 'Math', stat: true, forced: mathExpm1 != Math.expm1 }, { expm1: mathExpm1 }); var abs$3 = Math.abs; @@ -5645,7 +5795,7 @@ }; // `Math.fround` method implementation - // https://tc39.github.io/ecma262/#sec-math.fround + // https://tc39.es/ecma262/#sec-math.fround var mathFround = Math.fround || function fround(x) { var $abs = abs$3(x); var $sign = mathSign(x); @@ -5659,7 +5809,7 @@ }; // `Math.fround` method - // https://tc39.github.io/ecma262/#sec-math.fround + // https://tc39.es/ecma262/#sec-math.fround _export({ target: 'Math', stat: true }, { fround: mathFround }); var $hypot = Math.hypot; @@ -5671,7 +5821,7 @@ var BUGGY = !!$hypot && $hypot(Infinity, NaN) !== Infinity; // `Math.hypot` method - // https://tc39.github.io/ecma262/#sec-math.hypot + // https://tc39.es/ecma262/#sec-math.hypot _export({ target: 'Math', stat: true, forced: BUGGY }, { hypot: function hypot(value1, value2) { // eslint-disable-line no-unused-vars var sum = 0; @@ -5701,7 +5851,7 @@ }); // `Math.imul` method - // https://tc39.github.io/ecma262/#sec-math.imul + // https://tc39.es/ecma262/#sec-math.imul // some WebKit versions fails with big numbers, some has wrong arity _export({ target: 'Math', stat: true, forced: FORCED$d }, { imul: function imul(x, y) { @@ -5718,7 +5868,7 @@ var LOG10E = Math.LOG10E; // `Math.log10` method - // https://tc39.github.io/ecma262/#sec-math.log10 + // https://tc39.es/ecma262/#sec-math.log10 _export({ target: 'Math', stat: true }, { log10: function log10(x) { return log$6(x) * LOG10E; @@ -5726,14 +5876,14 @@ }); // `Math.log1p` method - // https://tc39.github.io/ecma262/#sec-math.log1p + // https://tc39.es/ecma262/#sec-math.log1p _export({ target: 'Math', stat: true }, { log1p: mathLog1p }); var log$7 = Math.log; var LN2$1 = Math.LN2; // `Math.log2` method - // https://tc39.github.io/ecma262/#sec-math.log2 + // https://tc39.es/ecma262/#sec-math.log2 _export({ target: 'Math', stat: true }, { log2: function log2(x) { return log$7(x) / LN2$1; @@ -5741,7 +5891,7 @@ }); // `Math.sign` method - // https://tc39.github.io/ecma262/#sec-math.sign + // https://tc39.es/ecma262/#sec-math.sign _export({ target: 'Math', stat: true }, { sign: mathSign }); @@ -5755,7 +5905,7 @@ }); // `Math.sinh` method - // https://tc39.github.io/ecma262/#sec-math.sinh + // https://tc39.es/ecma262/#sec-math.sinh // V8 near Chromium 38 has a problem with very small numbers _export({ target: 'Math', stat: true, forced: FORCED$e }, { sinh: function sinh(x) { @@ -5766,7 +5916,7 @@ var exp$2 = Math.exp; // `Math.tanh` method - // https://tc39.github.io/ecma262/#sec-math.tanh + // https://tc39.es/ecma262/#sec-math.tanh _export({ target: 'Math', stat: true }, { tanh: function tanh(x) { var a = mathExpm1(x = +x); @@ -5776,14 +5926,14 @@ }); // Math[@@toStringTag] property - // https://tc39.github.io/ecma262/#sec-math-@@tostringtag + // https://tc39.es/ecma262/#sec-math-@@tostringtag setToStringTag(Math, 'Math', true); var ceil$2 = Math.ceil; var floor$5 = Math.floor; // `Math.trunc` method - // https://tc39.github.io/ecma262/#sec-math.trunc + // https://tc39.es/ecma262/#sec-math.trunc _export({ target: 'Math', stat: true }, { trunc: function trunc(it) { return (it > 0 ? floor$5 : ceil$2)(it); @@ -5791,7 +5941,7 @@ }); // `Date.now` method - // https://tc39.github.io/ecma262/#sec-date.now + // https://tc39.es/ecma262/#sec-date.now _export({ target: 'Date', stat: true }, { now: function now() { return new Date().getTime(); @@ -5804,7 +5954,7 @@ }); // `Date.prototype.toJSON` method - // https://tc39.github.io/ecma262/#sec-date.prototype.tojson + // https://tc39.es/ecma262/#sec-date.prototype.tojson _export({ target: 'Date', proto: true, forced: FORCED$f }, { // eslint-disable-next-line no-unused-vars toJSON: function toJSON(key) { @@ -5822,7 +5972,7 @@ var nativeDateToISOString = DatePrototype.toISOString; // `Date.prototype.toISOString` method implementation - // https://tc39.github.io/ecma262/#sec-date.prototype.toisostring + // https://tc39.es/ecma262/#sec-date.prototype.toisostring // PhantomJS / old WebKit fails here: var dateToIsoString = (fails(function () { return nativeDateToISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; @@ -5845,7 +5995,7 @@ } : nativeDateToISOString; // `Date.prototype.toISOString` method - // https://tc39.github.io/ecma262/#sec-date.prototype.toisostring + // https://tc39.es/ecma262/#sec-date.prototype.toisostring // PhantomJS / old WebKit has a broken implementations _export({ target: 'Date', proto: true, forced: Date.prototype.toISOString !== dateToIsoString }, { toISOString: dateToIsoString @@ -5858,7 +6008,7 @@ var getTime$1 = DatePrototype$1.getTime; // `Date.prototype.toString` method - // https://tc39.github.io/ecma262/#sec-date.prototype.tostring + // https://tc39.es/ecma262/#sec-date.prototype.tostring if (new Date(NaN) + '' != INVALID_DATE) { redefine(DatePrototype$1, TO_STRING$1, function toString() { var value = getTime$1.call(this); @@ -5877,7 +6027,7 @@ var DatePrototype$2 = Date.prototype; // `Date.prototype[@@toPrimitive]` method - // https://tc39.github.io/ecma262/#sec-date.prototype-@@toprimitive + // https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive if (!(TO_PRIMITIVE$1 in DatePrototype$2)) { createNonEnumerableProperty(DatePrototype$2, TO_PRIMITIVE$1, dateToPrimitive); } @@ -5901,6 +6051,8 @@ }); if ($stringify$1) { + // `JSON.stringify` method + // https://tc39.es/ecma262/#sec-json.stringify // https://github.com/tc39/proposal-well-formed-stringify _export({ target: 'JSON', stat: true, forced: FORCED$g }, { // eslint-disable-next-line no-unused-vars @@ -5912,11 +6064,11 @@ } // JSON[@@toStringTag] property - // https://tc39.github.io/ecma262/#sec-json-@@tostringtag + // https://tc39.es/ecma262/#sec-json-@@tostringtag setToStringTag(global_1.JSON, 'JSON', true); // `Promise.allSettled` method - // https://github.com/tc39/proposal-promise-allSettled + // https://tc39.es/ecma262/#sec-promise.allsettled _export({ target: 'Promise', stat: true }, { allSettled: function allSettled(iterable) { var C = this; @@ -5928,7 +6080,7 @@ var values = []; var counter = 0; var remaining = 1; - iterate_1(iterable, function (promise) { + iterate(iterable, function (promise) { var index = counter++; var alreadyCalled = false; values.push(undefined); @@ -5938,10 +6090,10 @@ alreadyCalled = true; values[index] = { status: 'fulfilled', value: value }; --remaining || resolve(values); - }, function (e) { + }, function (error) { if (alreadyCalled) return; alreadyCalled = true; - values[index] = { status: 'rejected', reason: e }; + values[index] = { status: 'rejected', reason: error }; --remaining || resolve(values); }); }); @@ -5952,6 +6104,45 @@ } }); + var PROMISE_ANY_ERROR = 'No one promise resolved'; + + // `Promise.any` method + // https://tc39.es/ecma262/#sec-promise.any + _export({ target: 'Promise', stat: true }, { + any: function any(iterable) { + var C = this; + var capability = newPromiseCapability.f(C); + var resolve = capability.resolve; + var reject = capability.reject; + var result = perform(function () { + var promiseResolve = aFunction$1(C.resolve); + var errors = []; + var counter = 0; + var remaining = 1; + var alreadyResolved = false; + iterate(iterable, function (promise) { + var index = counter++; + var alreadyRejected = false; + errors.push(undefined); + remaining++; + promiseResolve.call(C, promise).then(function (value) { + if (alreadyRejected || alreadyResolved) return; + alreadyResolved = true; + resolve(value); + }, function (error) { + if (alreadyRejected || alreadyResolved) return; + alreadyRejected = true; + errors[index] = error; + --remaining || reject(new (getBuiltIn('AggregateError'))(errors, PROMISE_ANY_ERROR)); + }); + }); + --remaining || reject(new (getBuiltIn('AggregateError'))(errors, PROMISE_ANY_ERROR)); + }); + if (result.error) reject(result.value); + return capability.promise; + } + }); + var collection = function (CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; @@ -6009,7 +6200,7 @@ Constructor = wrapper(function (dummy, iterable) { anInstance(dummy, Constructor, CONSTRUCTOR_NAME); var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor); - if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP); + if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); return that; }); Constructor.prototype = NativePrototype; @@ -6065,7 +6256,7 @@ size: 0 }); if (!descriptors) that.size = 0; - if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP); + if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); }); var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); @@ -6225,13 +6416,13 @@ }; // `Map` constructor - // https://tc39.github.io/ecma262/#sec-map-objects + // https://tc39.es/ecma262/#sec-map-objects var es_map = collection('Map', function (init) { return function Map() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); // `Set` constructor - // https://tc39.github.io/ecma262/#sec-set-objects + // https://tc39.es/ecma262/#sec-set-objects var es_set = collection('Set', function (init) { return function Set() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); @@ -6297,7 +6488,7 @@ id: id$1++, frozen: undefined }); - if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP); + if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); }); var getInternalState = internalStateGetterFor$1(CONSTRUCTOR_NAME); @@ -6377,7 +6568,7 @@ }; // `WeakMap` constructor - // https://tc39.github.io/ecma262/#sec-weakmap-constructor + // https://tc39.es/ecma262/#sec-weakmap-constructor var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak); // IE11 WeakMap frozen keys fix @@ -6426,7 +6617,7 @@ }); // `WeakSet` constructor - // https://tc39.github.io/ecma262/#sec-weakset-constructor + // https://tc39.es/ecma262/#sec-weakset-constructor collection('WeakSet', function (init) { return function WeakSet() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionWeak); @@ -6434,7 +6625,7 @@ var arrayBufferNative = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined'; // `ToIndex` abstract operation - // https://tc39.github.io/ecma262/#sec-toindex + // https://tc39.es/ecma262/#sec-toindex var toIndex = function (it) { if (it === undefined) return 0; var number = toInteger(it); @@ -6750,7 +6941,7 @@ var NativeArrayBuffer$1 = global_1[ARRAY_BUFFER$1]; // `ArrayBuffer` constructor - // https://tc39.github.io/ecma262/#sec-arraybuffer-constructor + // https://tc39.es/ecma262/#sec-arraybuffer-constructor _export({ global: true, forced: NativeArrayBuffer$1 !== ArrayBuffer$1 }, { ArrayBuffer: ArrayBuffer$1 }); @@ -6791,13 +6982,24 @@ Float64Array: 8 }; + var BigIntArrayConstructorsList = { + BigInt64Array: 8, + BigUint64Array: 8 + }; + var isView = function isView(it) { + if (!isObject(it)) return false; var klass = classof(it); - return klass === 'DataView' || has(TypedArrayConstructorsList, klass); + return klass === 'DataView' + || has(TypedArrayConstructorsList, klass) + || has(BigIntArrayConstructorsList, klass); }; var isTypedArray = function (it) { - return isObject(it) && has(TypedArrayConstructorsList, classof(it)); + if (!isObject(it)) return false; + var klass = classof(it); + return has(TypedArrayConstructorsList, klass) + || has(BigIntArrayConstructorsList, klass); }; var aTypedArray = function (it) { @@ -6908,7 +7110,7 @@ var NATIVE_ARRAY_BUFFER_VIEWS$1 = arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; // `ArrayBuffer.isView` method - // https://tc39.github.io/ecma262/#sec-arraybuffer.isview + // https://tc39.es/ecma262/#sec-arraybuffer.isview _export({ target: 'ArrayBuffer', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS$1 }, { isView: arrayBufferViewCore.isView }); @@ -6922,7 +7124,7 @@ }); // `ArrayBuffer.prototype.slice` method - // https://tc39.github.io/ecma262/#sec-arraybuffer.prototype.slice + // https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice _export({ target: 'ArrayBuffer', proto: true, unsafe: true, forced: INCORRECT_SLICE }, { slice: function slice(start, end) { if (nativeArrayBufferSlice !== undefined && end === undefined) { @@ -6942,7 +7144,7 @@ }); // `DataView` constructor - // https://tc39.github.io/ecma262/#sec-dataview-constructor + // https://tc39.es/ecma262/#sec-dataview-constructor _export({ global: true, forced: !arrayBufferNative }, { DataView: arrayBuffer.DataView }); @@ -7243,7 +7445,7 @@ }); // `Int8Array` constructor - // https://tc39.github.io/ecma262/#sec-typedarray-objects + // https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Int8', function (init) { return function Int8Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7251,7 +7453,7 @@ }); // `Uint8Array` constructor - // https://tc39.github.io/ecma262/#sec-typedarray-objects + // https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Uint8', function (init) { return function Uint8Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7259,7 +7461,7 @@ }); // `Uint8ClampedArray` constructor - // https://tc39.github.io/ecma262/#sec-typedarray-objects + // https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Uint8', function (init) { return function Uint8ClampedArray(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7267,7 +7469,7 @@ }, true); // `Int16Array` constructor - // https://tc39.github.io/ecma262/#sec-typedarray-objects + // https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Int16', function (init) { return function Int16Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7275,7 +7477,7 @@ }); // `Uint16Array` constructor - // https://tc39.github.io/ecma262/#sec-typedarray-objects + // https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Uint16', function (init) { return function Uint16Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7283,7 +7485,7 @@ }); // `Int32Array` constructor - // https://tc39.github.io/ecma262/#sec-typedarray-objects + // https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Int32', function (init) { return function Int32Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7291,7 +7493,7 @@ }); // `Uint32Array` constructor - // https://tc39.github.io/ecma262/#sec-typedarray-objects + // https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Uint32', function (init) { return function Uint32Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7299,7 +7501,7 @@ }); // `Float32Array` constructor - // https://tc39.github.io/ecma262/#sec-typedarray-objects + // https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Float32', function (init) { return function Float32Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7307,7 +7509,7 @@ }); // `Float64Array` constructor - // https://tc39.github.io/ecma262/#sec-typedarray-objects + // https://tc39.es/ecma262/#sec-typedarray-objects typedArrayConstructor('Float64', function (init) { return function Float64Array(data, byteOffset, length) { return init(this, data, byteOffset, length); @@ -7318,14 +7520,14 @@ // `%TypedArray%.from` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.from + // https://tc39.es/ecma262/#sec-%typedarray%.from exportTypedArrayStaticMethod$1('from', typedArrayFrom, typedArrayConstructorsRequireWrappers); var aTypedArrayConstructor$2 = arrayBufferViewCore.aTypedArrayConstructor; var exportTypedArrayStaticMethod$2 = arrayBufferViewCore.exportTypedArrayStaticMethod; // `%TypedArray%.of` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.of + // https://tc39.es/ecma262/#sec-%typedarray%.of exportTypedArrayStaticMethod$2('of', function of(/* ...items */) { var index = 0; var length = arguments.length; @@ -7338,7 +7540,7 @@ var exportTypedArrayMethod$1 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.copyWithin` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.copywithin + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.copywithin exportTypedArrayMethod$1('copyWithin', function copyWithin(target, start /* , end */) { return arrayCopyWithin.call(aTypedArray$1(this), target, start, arguments.length > 2 ? arguments[2] : undefined); }); @@ -7349,7 +7551,7 @@ var exportTypedArrayMethod$2 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.every` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.every + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.every exportTypedArrayMethod$2('every', function every(callbackfn /* , thisArg */) { return $every$1(aTypedArray$2(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7358,7 +7560,7 @@ var exportTypedArrayMethod$3 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.fill` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.fill + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill // eslint-disable-next-line no-unused-vars exportTypedArrayMethod$3('fill', function fill(value /* , start, end */) { return arrayFill.apply(aTypedArray$3(this), arguments); @@ -7372,7 +7574,7 @@ var exportTypedArrayMethod$4 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.filter` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.filter + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.filter exportTypedArrayMethod$4('filter', function filter(callbackfn /* , thisArg */) { var list = $filter$1(aTypedArray$4(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); var C = speciesConstructor(this, this.constructor); @@ -7389,7 +7591,7 @@ var exportTypedArrayMethod$5 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.find` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.find + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.find exportTypedArrayMethod$5('find', function find(predicate /* , thisArg */) { return $find$1(aTypedArray$5(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7400,7 +7602,7 @@ var exportTypedArrayMethod$6 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.findIndex` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.findindex + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.findindex exportTypedArrayMethod$6('findIndex', function findIndex(predicate /* , thisArg */) { return $findIndex$1(aTypedArray$6(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7411,7 +7613,7 @@ var exportTypedArrayMethod$7 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.forEach` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.foreach + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.foreach exportTypedArrayMethod$7('forEach', function forEach(callbackfn /* , thisArg */) { $forEach$2(aTypedArray$7(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7422,7 +7624,7 @@ var exportTypedArrayMethod$8 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.includes` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.includes + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.includes exportTypedArrayMethod$8('includes', function includes(searchElement /* , fromIndex */) { return $includes$1(aTypedArray$8(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7433,7 +7635,7 @@ var exportTypedArrayMethod$9 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.indexOf` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.indexof + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.indexof exportTypedArrayMethod$9('indexOf', function indexOf(searchElement /* , fromIndex */) { return $indexOf$1(aTypedArray$9(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7455,20 +7657,20 @@ }; // `%TypedArray%.prototype.entries` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.entries + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.entries exportTypedArrayMethod$a('entries', function entries() { return arrayEntries.call(aTypedArray$a(this)); }); // `%TypedArray%.prototype.keys` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.keys + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys exportTypedArrayMethod$a('keys', function keys() { return arrayKeys.call(aTypedArray$a(this)); }); // `%TypedArray%.prototype.values` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.values + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.values exportTypedArrayMethod$a('values', typedArrayValues, !CORRECT_ITER_NAME); // `%TypedArray%.prototype[@@iterator]` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype-@@iterator + // https://tc39.es/ecma262/#sec-%typedarray%.prototype-@@iterator exportTypedArrayMethod$a(ITERATOR$5, typedArrayValues, !CORRECT_ITER_NAME); var aTypedArray$b = arrayBufferViewCore.aTypedArray; @@ -7476,7 +7678,7 @@ var $join = [].join; // `%TypedArray%.prototype.join` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.join + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.join // eslint-disable-next-line no-unused-vars exportTypedArrayMethod$b('join', function join(separator) { return $join.apply(aTypedArray$b(this), arguments); @@ -7486,7 +7688,7 @@ var exportTypedArrayMethod$c = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.lastIndexOf` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.lastindexof + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof // eslint-disable-next-line no-unused-vars exportTypedArrayMethod$c('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) { return arrayLastIndexOf.apply(aTypedArray$c(this), arguments); @@ -7500,7 +7702,7 @@ var exportTypedArrayMethod$d = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.map` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.map + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.map exportTypedArrayMethod$d('map', function map(mapfn /* , thisArg */) { return $map$1(aTypedArray$d(this), mapfn, arguments.length > 1 ? arguments[1] : undefined, function (O, length) { return new (aTypedArrayConstructor$4(speciesConstructor(O, O.constructor)))(length); @@ -7513,7 +7715,7 @@ var exportTypedArrayMethod$e = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.reduce` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reduce + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduce exportTypedArrayMethod$e('reduce', function reduce(callbackfn /* , initialValue */) { return $reduce$1(aTypedArray$e(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7524,7 +7726,7 @@ var exportTypedArrayMethod$f = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.reduceRicht` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reduceright + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduceright exportTypedArrayMethod$f('reduceRight', function reduceRight(callbackfn /* , initialValue */) { return $reduceRight$1(aTypedArray$f(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7534,7 +7736,7 @@ var floor$7 = Math.floor; // `%TypedArray%.prototype.reverse` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reverse + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reverse exportTypedArrayMethod$g('reverse', function reverse() { var that = this; var length = aTypedArray$g(that).length; @@ -7557,7 +7759,7 @@ }); // `%TypedArray%.prototype.set` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.set + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.set exportTypedArrayMethod$h('set', function set(arrayLike /* , offset */) { aTypedArray$h(this); var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1); @@ -7580,7 +7782,7 @@ }); // `%TypedArray%.prototype.slice` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.slice + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice exportTypedArrayMethod$i('slice', function slice(start, end) { var list = $slice.call(aTypedArray$i(this), start, end); var C = speciesConstructor(this, this.constructor); @@ -7597,7 +7799,7 @@ var exportTypedArrayMethod$j = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.some` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.some + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.some exportTypedArrayMethod$j('some', function some(callbackfn /* , thisArg */) { return $some$1(aTypedArray$j(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); @@ -7607,7 +7809,7 @@ var $sort = [].sort; // `%TypedArray%.prototype.sort` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.sort + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort exportTypedArrayMethod$k('sort', function sort(comparefn) { return $sort.call(aTypedArray$k(this), comparefn); }); @@ -7616,7 +7818,7 @@ var exportTypedArrayMethod$l = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.subarray` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.subarray + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.subarray exportTypedArrayMethod$l('subarray', function subarray(begin, end) { var O = aTypedArray$l(this); var length = O.length; @@ -7646,7 +7848,7 @@ }); // `%TypedArray%.prototype.toLocaleString` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.tolocalestring + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring exportTypedArrayMethod$m('toLocaleString', function toLocaleString() { return $toLocaleString.apply(TO_LOCALE_STRING_BUG ? $slice$1.call(aTypedArray$m(this)) : aTypedArray$m(this), arguments); }, FORCED$j); @@ -7669,7 +7871,7 @@ var IS_NOT_ARRAY_METHOD = Uint8ArrayPrototype.toString != arrayToString; // `%TypedArray%.prototype.toString` method - // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.tostring + // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tostring exportTypedArrayMethod$n('toString', arrayToString, IS_NOT_ARRAY_METHOD); var nativeApply = getBuiltIn('Reflect', 'apply'); @@ -7681,7 +7883,7 @@ }); // `Reflect.apply` method - // https://tc39.github.io/ecma262/#sec-reflect.apply + // https://tc39.es/ecma262/#sec-reflect.apply _export({ target: 'Reflect', stat: true, forced: OPTIONAL_ARGUMENTS_LIST }, { apply: function apply(target, thisArgument, argumentsList) { aFunction$1(target); @@ -7695,7 +7897,7 @@ var nativeConstruct = getBuiltIn('Reflect', 'construct'); // `Reflect.construct` method - // https://tc39.github.io/ecma262/#sec-reflect.construct + // https://tc39.es/ecma262/#sec-reflect.construct // MS Edge supports only 2 arguments and argumentsList argument is optional // FF Nightly sets third argument as `new.target`, but does not create `this` from it var NEW_TARGET_BUG = fails(function () { @@ -7742,7 +7944,7 @@ }); // `Reflect.defineProperty` method - // https://tc39.github.io/ecma262/#sec-reflect.defineproperty + // https://tc39.es/ecma262/#sec-reflect.defineproperty _export({ target: 'Reflect', stat: true, forced: ERROR_INSTEAD_OF_FALSE, sham: !descriptors }, { defineProperty: function defineProperty(target, propertyKey, attributes) { anObject(target); @@ -7760,7 +7962,7 @@ var getOwnPropertyDescriptor$8 = objectGetOwnPropertyDescriptor.f; // `Reflect.deleteProperty` method - // https://tc39.github.io/ecma262/#sec-reflect.deleteproperty + // https://tc39.es/ecma262/#sec-reflect.deleteproperty _export({ target: 'Reflect', stat: true }, { deleteProperty: function deleteProperty(target, propertyKey) { var descriptor = getOwnPropertyDescriptor$8(anObject(target), propertyKey); @@ -7769,7 +7971,7 @@ }); // `Reflect.get` method - // https://tc39.github.io/ecma262/#sec-reflect.get + // https://tc39.es/ecma262/#sec-reflect.get function get$2(target, propertyKey /* , receiver */) { var receiver = arguments.length < 3 ? target : arguments[2]; var descriptor, prototype; @@ -7787,7 +7989,7 @@ }); // `Reflect.getOwnPropertyDescriptor` method - // https://tc39.github.io/ecma262/#sec-reflect.getownpropertydescriptor + // https://tc39.es/ecma262/#sec-reflect.getownpropertydescriptor _export({ target: 'Reflect', stat: true, sham: !descriptors }, { getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) { return objectGetOwnPropertyDescriptor.f(anObject(target), propertyKey); @@ -7795,7 +7997,7 @@ }); // `Reflect.getPrototypeOf` method - // https://tc39.github.io/ecma262/#sec-reflect.getprototypeof + // https://tc39.es/ecma262/#sec-reflect.getprototypeof _export({ target: 'Reflect', stat: true, sham: !correctPrototypeGetter }, { getPrototypeOf: function getPrototypeOf(target) { return objectGetPrototypeOf(anObject(target)); @@ -7803,7 +8005,7 @@ }); // `Reflect.has` method - // https://tc39.github.io/ecma262/#sec-reflect.has + // https://tc39.es/ecma262/#sec-reflect.has _export({ target: 'Reflect', stat: true }, { has: function has(target, propertyKey) { return propertyKey in target; @@ -7813,7 +8015,7 @@ var objectIsExtensible = Object.isExtensible; // `Reflect.isExtensible` method - // https://tc39.github.io/ecma262/#sec-reflect.isextensible + // https://tc39.es/ecma262/#sec-reflect.isextensible _export({ target: 'Reflect', stat: true }, { isExtensible: function isExtensible(target) { anObject(target); @@ -7822,13 +8024,13 @@ }); // `Reflect.ownKeys` method - // https://tc39.github.io/ecma262/#sec-reflect.ownkeys + // https://tc39.es/ecma262/#sec-reflect.ownkeys _export({ target: 'Reflect', stat: true }, { ownKeys: ownKeys }); // `Reflect.preventExtensions` method - // https://tc39.github.io/ecma262/#sec-reflect.preventextensions + // https://tc39.es/ecma262/#sec-reflect.preventextensions _export({ target: 'Reflect', stat: true, sham: !freezing }, { preventExtensions: function preventExtensions(target) { anObject(target); @@ -7843,7 +8045,7 @@ }); // `Reflect.set` method - // https://tc39.github.io/ecma262/#sec-reflect.set + // https://tc39.es/ecma262/#sec-reflect.set function set$3(target, propertyKey, V /* , receiver */) { var receiver = arguments.length < 4 ? target : arguments[3]; var ownDescriptor = objectGetOwnPropertyDescriptor.f(anObject(target), propertyKey); @@ -7869,9 +8071,10 @@ // MS Edge 17-18 Reflect.set allows setting the property to object // with non-writable property on the prototype var MS_EDGE_BUG = fails(function () { - var object = objectDefineProperty.f({}, 'a', { configurable: true }); + var Constructor = function () { /* empty */ }; + var object = objectDefineProperty.f(new Constructor(), 'a', { configurable: true }); // eslint-disable-next-line no-undef - return Reflect.set(objectGetPrototypeOf(object), 'a', 1, object) !== false; + return Reflect.set(Constructor.prototype, 'a', 1, object) !== false; }); _export({ target: 'Reflect', stat: true, forced: MS_EDGE_BUG }, { @@ -7879,7 +8082,7 @@ }); // `Reflect.setPrototypeOf` method - // https://tc39.github.io/ecma262/#sec-reflect.setprototypeof + // https://tc39.es/ecma262/#sec-reflect.setprototypeof if (objectSetPrototypeOf) _export({ target: 'Reflect', stat: true }, { setPrototypeOf: function setPrototypeOf(target, proto) { anObject(target); @@ -7893,6 +8096,12 @@ } }); + _export({ global: true }, { Reflect: {} }); + + // Reflect[@@toStringTag] property + // https://tc39.es/ecma262/#sec-reflect-@@tostringtag + setToStringTag(global_1.Reflect, 'Reflect', true); + // iterable DOM collections // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods var domIterables = { @@ -7981,13 +8190,12 @@ }); var process$4 = global_1.process; - var isNode = classofRaw(process$4) == 'process'; // `queueMicrotask` method // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask _export({ global: true, enumerable: true, noTargetGet: true }, { queueMicrotask: function queueMicrotask(fn) { - var domain = isNode && process$4.domain; + var domain = engineIsNode && process$4.domain; microtask(domain ? domain.bind(fn) : fn); } }); @@ -8258,7 +8466,7 @@ var find$1 = /[!'()~]|%20/g; - var replace = { + var replace$1 = { '!': '%21', "'": '%27', '(': '%28', @@ -8268,7 +8476,7 @@ }; var replacer = function (match) { - return replace[match]; + return replace$1[match]; }; var serialize = function (it) { @@ -8360,7 +8568,7 @@ var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype; redefineAll(URLSearchParamsPrototype, { - // `URLSearchParams.prototype.appent` method + // `URLSearchParams.prototype.append` method // https://url.spec.whatwg.org/#dom-urlsearchparams-append append: function append(name, value) { validateArgumentsLength(arguments.length, 2); @@ -13609,7 +13817,7 @@ return min; }; - var max$4 = function max(arr) { + var max$5 = function max(arr) { var begin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : arr.length; var max = -Infinity; @@ -16463,7 +16671,7 @@ } else if (preference === 'min') { p = min$9(S); } else if (preference === 'max') { - p = max$4(S); + p = max$5(S); } else { // Custom preference number, as set by user p = preference; @@ -43789,8 +43997,8 @@ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { var property = _step3.value; - if (property.tagName != 'value' && property.tagName != 'annotations') { - result[property.tagName] = parseInt(property.textContent) || 0; + if (property.tagName != 'value' && property.tagName != 'annotations' && property.textContent != '0') { + result[property.tagName] = 1; } } } catch (err) { @@ -45137,6 +45345,20 @@ return TemplateInstance; }(); + /** + * Our TrustedTypePolicy for HTML which is declared using the html template + * tag function. + * + * That HTML is a developer-authored constant, and is parsed with innerHTML + * before any untrusted expressions have been mixed in. Therefor it is + * considered safe by construction. + */ + + var policy = window.trustedTypes && trustedTypes.createPolicy('lit-html', { + createHTML: function createHTML(s) { + return s; + } + }); var commentMarker = " ".concat(marker, " "); /** * The return type of `html`, which holds a Template and the values from @@ -45215,7 +45437,17 @@ key: "getTemplateElement", value: function getTemplateElement() { var template = document.createElement('template'); - template.innerHTML = this.getHTML(); + var value = this.getHTML(); + + if (policy !== undefined) { + // this is secure because `this.strings` is a TemplateStringsArray. + // TODO: validate this when + // https://github.com/tc39/proposal-array-is-template-object is + // implemented. + value = policy.createHTML(value); + } + + template.innerHTML = value; return template; } }]); @@ -45265,19 +45497,45 @@ value: function _getValue() { var strings = this.strings; var l = strings.length - 1; + var parts = this.parts; // If we're assigning an attribute via syntax like: + // attr="${foo}" or attr=${foo} + // but not + // attr="${foo} ${bar}" or attr="${foo} baz" + // then we don't want to coerce the attribute value into one long + // string. Instead we want to just return the value itself directly, + // so that sanitizeDOMValue can get the actual value rather than + // String(value) + // The exception is if v is an array, in which case we do want to smash + // it together into a string without calling String() on the array. + // + // This also allows trusted values (when using TrustedTypes) being + // assigned to DOM sinks without being stringified in the process. + + if (l === 1 && strings[0] === '' && strings[1] === '') { + var v = parts[0].value; + + if (_typeof(v) === 'symbol') { + return String(v); + } + + if (typeof v === 'string' || !isIterable(v)) { + return v; + } + } + var text = ''; for (var i = 0; i < l; i++) { text += strings[i]; - var part = this.parts[i]; + var part = parts[i]; if (part !== undefined) { - var v = part.value; + var _v = part.value; - if (isPrimitive(v) || !isIterable(v)) { - text += typeof v === 'string' ? v : String(v); + if (isPrimitive(_v) || !isIterable(_v)) { + text += typeof _v === 'string' ? _v : String(_v); } else { - var _iterator = _createForOfIteratorHelper(v), + var _iterator = _createForOfIteratorHelper(_v), _step; try { @@ -45970,7 +46228,7 @@ // TODO(justinfagnani): inject version number at build time if (typeof window !== 'undefined') { - (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.2.1'); + (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.3.0'); } /** * Interprets a template literal as an HTML template that can efficiently @@ -46041,7 +46299,6 @@ return template; }; }; - var TEMPLATE_TYPES = ['html', 'svg']; /** * Removes all style elements from Templates for the given scopeName. @@ -46283,6 +46540,12 @@ */ var _a; /** + * Use this module if you want to create your own base class extending + * [[UpdatingElement]]. + * @packageDocumentation + */ + + /* * When using Closure Compiler, JSCompiler_renameProperty(property, object) is * replaced at compile time by the munged name for object[property]. We cannot * alias this function, so we have to use a small shim that has the same @@ -46357,6 +46620,7 @@ * Base element class which manages element properties and attributes. When * properties change, the `update` method is asynchronously called. This method * should be supplied by subclassers to render updates as desired. + * @noInheritDoc */ var UpdatingElement = /*#__PURE__*/function (_HTMLElement) { @@ -46370,24 +46634,6 @@ _classCallCheck(this, UpdatingElement); _this = _super.call(this); - _this._updateState = 0; - _this._instanceProperties = undefined; // Initialize to an unresolved Promise so we can make sure the element has - // connected before first update. - - _this._updatePromise = new Promise(function (res) { - return _this._enableUpdatingResolver = res; - }); - /** - * Map with keys for any properties that have changed since the last - * update cycle with previous values. - */ - - _this._changedProperties = new Map(); - /** - * Map with keys of properties that should be reflected when updated. - */ - - _this._reflectingProperties = undefined; _this.initialize(); @@ -46407,11 +46653,19 @@ * registered properties. */ value: function initialize() { + var _this2 = this; + + this._updateState = 0; + this._updatePromise = new Promise(function (res) { + return _this2._enableUpdatingResolver = res; + }); + this._changedProperties = new Map(); + this._saveInstanceProperties(); // ensures first update will be caught by an early access of // `updateComplete` - this._requestUpdate(); + this.requestUpdateInternal(); } /** * Fixes any properties set on the instance before upgrade time. @@ -46429,20 +46683,20 @@ }, { key: "_saveInstanceProperties", value: function _saveInstanceProperties() { - var _this2 = this; + var _this3 = this; // Use forEach so this works even if for/of loops are compiled to for loops // expecting arrays this.constructor._classProperties.forEach(function (_v, p) { - if (_this2.hasOwnProperty(p)) { - var value = _this2[p]; - delete _this2[p]; + if (_this3.hasOwnProperty(p)) { + var value = _this3[p]; + delete _this3[p]; - if (!_this2._instanceProperties) { - _this2._instanceProperties = new Map(); + if (!_this3._instanceProperties) { + _this3._instanceProperties = new Map(); } - _this2._instanceProperties.set(p, value); + _this3._instanceProperties.set(p, value); } }); } @@ -46453,13 +46707,13 @@ }, { key: "_applyInstanceProperties", value: function _applyInstanceProperties() { - var _this3 = this; + var _this4 = this; // Use forEach so this works even if for/of loops are compiled to for loops // expecting arrays // tslint:disable-next-line:no-any this._instanceProperties.forEach(function (v, p) { - return _this3[p] = v; + return _this4[p] = v; }); this._instanceProperties = undefined; @@ -46562,19 +46816,19 @@ } } /** - * This private version of `requestUpdate` does not access or return the + * This protected version of `requestUpdate` does not access or return the * `updateComplete` promise. This promise can be overridden and is therefore * not free to access. */ }, { - key: "_requestUpdate", - value: function _requestUpdate(name, oldValue) { + key: "requestUpdateInternal", + value: function requestUpdateInternal(name, oldValue, options) { var shouldRequestUpdate = true; // If we have a property key, perform property update steps. if (name !== undefined) { var ctor = this.constructor; - var options = ctor.getPropertyOptions(name); + options = options || ctor.getPropertyOptions(name); if (ctor._valueHasChanged(this[name], oldValue, options.hasChanged)) { if (!this._changedProperties.has(name)) { @@ -46619,8 +46873,7 @@ }, { key: "requestUpdate", value: function requestUpdate(name, oldValue) { - this._requestUpdate(name, oldValue); - + this.requestUpdateInternal(name, oldValue); return this.updateComplete; } /** @@ -46699,7 +46952,14 @@ * ``` */ value: function performUpdate() { - // Mixin instance properties once, if they exist. + // Abort any update if one is not pending when this is called. + // This can happen if `performUpdate` is called early to "flush" + // the update. + if (!this._hasRequestedUpdate) { + return; + } // Mixin instance properties once, if they exist. + + if (this._instanceProperties) { this._applyInstanceProperties(); } @@ -46803,13 +47063,13 @@ }, { key: "update", value: function update(_changedProperties) { - var _this4 = this; + var _this5 = this; if (this._reflectingProperties !== undefined && this._reflectingProperties.size > 0) { // Use forEach so this works even if for/of loops are compiled to for // loops expecting arrays this._reflectingProperties.forEach(function (v, k) { - return _this4._propertyToAttribute(k, _this4[k], v); + return _this5._propertyToAttribute(k, _this5[k], v); }); this._reflectingProperties = undefined; @@ -46869,7 +47129,7 @@ /** @nocollapse */ value: function _ensureClassProperties() { - var _this5 = this; + var _this6 = this; // ensure private storage for property declarations. if (!this.hasOwnProperty(JSCompiler_renameProperty('_classProperties', this))) { @@ -46879,7 +47139,7 @@ if (superProperties !== undefined) { superProperties.forEach(function (v, k) { - return _this5._classProperties.set(k, v); + return _this6._classProperties.set(k, v); }); } } @@ -46962,7 +47222,7 @@ }, { key: "getPropertyDescriptor", - value: function getPropertyDescriptor(name, key, _options) { + value: function getPropertyDescriptor(name, key, options) { return { // tslint:disable-next-line:no-any no symbol in index get: function get() { @@ -46971,8 +47231,7 @@ set: function set(value) { var oldValue = this[name]; this[key] = value; - - this._requestUpdate(name, oldValue); + this.requestUpdateInternal(name, oldValue, options); }, configurable: true, enumerable: true @@ -47108,7 +47367,7 @@ }, { key: "observedAttributes", get: function get() { - var _this6 = this; + var _this7 = this; // note: piggy backing on this to ensure we're finalized. this.finalize(); @@ -47116,10 +47375,10 @@ // expecting arrays this._classProperties.forEach(function (v, p) { - var attr = _this6._attributeNameForProperty(p, v); + var attr = _this7._attributeNameForProperty(p, v); if (attr !== undefined) { - _this6._attributeToPropertyMap.set(attr, p); + _this7._attributeToPropertyMap.set(attr, p); attributes.push(attr); } @@ -47185,7 +47444,7 @@ * } * } * ``` - * + * @category Decorator * @param tagName The name of the custom element to define. */ @@ -47196,6 +47455,286 @@ }; }; + var standardProperty = function standardProperty(options, element) { + // When decorating an accessor, pass it through and add property metadata. + // Note, the `hasOwnProperty` check in `createProperty` ensures we don't + // stomp over the user's accessor. + if (element.kind === 'method' && element.descriptor && !('value' in element.descriptor)) { + return Object.assign(Object.assign({}, element), { + finisher: function finisher(clazz) { + clazz.createProperty(element.key, options); + } + }); + } else { + // createProperty() takes care of defining the property, but we still + // must return some kind of descriptor, so return a descriptor for an + // unused prototype field. The finisher calls createProperty(). + return { + kind: 'field', + key: Symbol(), + placement: 'own', + descriptor: {}, + // When @babel/plugin-proposal-decorators implements initializers, + // do this instead of the initializer below. See: + // https://github.com/babel/babel/issues/9260 extras: [ + // { + // kind: 'initializer', + // placement: 'own', + // initializer: descriptor.initializer, + // } + // ], + initializer: function initializer() { + if (typeof element.initializer === 'function') { + this[element.key] = element.initializer.call(this); + } + }, + finisher: function finisher(clazz) { + clazz.createProperty(element.key, options); + } + }; + } + }; + + var legacyProperty = function legacyProperty(options, proto, name) { + proto.constructor.createProperty(name, options); + }; + /** + * A property decorator which creates a LitElement property which reflects a + * corresponding attribute value. A [[`PropertyDeclaration`]] may optionally be + * supplied to configure property features. + * + * This decorator should only be used for public fields. Private or protected + * fields should use the [[`internalProperty`]] decorator. + * + * @example + * ```ts + * class MyElement { + * @property({ type: Boolean }) + * clicked = false; + * } + * ``` + * @category Decorator + * @ExportDecoratedItems + */ + + + function property(options) { + // tslint:disable-next-line:no-any decorator + return function (protoOrDescriptor, name) { + return name !== undefined ? legacyProperty(options, protoOrDescriptor, name) : standardProperty(options, protoOrDescriptor); + }; + } + /** + * Declares a private or protected property that still triggers updates to the + * element when it changes. + * + * Properties declared this way must not be used from HTML or HTML templating + * systems, they're solely for properties internal to the element. These + * properties may be renamed by optimization tools like closure compiler. + * @category Decorator + */ + + function internalProperty(options) { + return property({ + attribute: false, + hasChanged: options === null || options === void 0 ? void 0 : options.hasChanged + }); + } + /** + * A property decorator that converts a class property into a getter that + * executes a querySelector on the element's renderRoot. + * + * @param selector A DOMString containing one or more selectors to match. + * @param cache An optional boolean which when true performs the DOM query only + * once and caches the result. + * + * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector + * + * @example + * + * ```ts + * class MyElement { + * @query('#first') + * first; + * + * render() { + * return html` + *
+ *
+ * `; + * } + * } + * ``` + * @category Decorator + */ + + function query(selector, cache) { + return function (protoOrDescriptor, // tslint:disable-next-line:no-any decorator + name) { + var descriptor = { + get: function get() { + return this.renderRoot.querySelector(selector); + }, + enumerable: true, + configurable: true + }; + + if (cache) { + var key = _typeof(name) === 'symbol' ? Symbol() : "__".concat(name); + + descriptor.get = function () { + if (this[key] === undefined) { + this[key] = this.renderRoot.querySelector(selector); + } + + return this[key]; + }; + } + + return name !== undefined ? legacyQuery(descriptor, protoOrDescriptor, name) : standardQuery(descriptor, protoOrDescriptor); + }; + } // Note, in the future, we may extend this decorator to support the use case + // where the queried element may need to do work to become ready to interact + // with (e.g. load some implementation code). If so, we might elect to + // add a second argument defining a function that can be run to make the + // queried element loaded/updated/ready. + + /** + * A property decorator that converts a class property into a getter that + * returns a promise that resolves to the result of a querySelector on the + * element's renderRoot done after the element's `updateComplete` promise + * resolves. When the queried property may change with element state, this + * decorator can be used instead of requiring users to await the + * `updateComplete` before accessing the property. + * + * @param selector A DOMString containing one or more selectors to match. + * + * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector + * + * @example + * ```ts + * class MyElement { + * @queryAsync('#first') + * first; + * + * render() { + * return html` + *
+ *
+ * `; + * } + * } + * + * // external usage + * async doSomethingWithFirst() { + * (await aMyElement.first).doSomething(); + * } + * ``` + * @category Decorator + */ + + function queryAsync(selector) { + return function (protoOrDescriptor, // tslint:disable-next-line:no-any decorator + name) { + var descriptor = { + get: function get() { + var _this = this; + + return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return _this.updateComplete; + + case 2: + return _context.abrupt("return", _this.renderRoot.querySelector(selector)); + + case 3: + case "end": + return _context.stop(); + } + } + }, _callee); + }))(); + }, + enumerable: true, + configurable: true + }; + return name !== undefined ? legacyQuery(descriptor, protoOrDescriptor, name) : standardQuery(descriptor, protoOrDescriptor); + }; + } + + var legacyQuery = function legacyQuery(descriptor, proto, name) { + Object.defineProperty(proto, name, descriptor); + }; + + var standardQuery = function standardQuery(descriptor, element) { + return { + kind: 'method', + placement: 'prototype', + key: element.key, + descriptor: descriptor + }; + }; + + var standardEventOptions = function standardEventOptions(options, element) { + return Object.assign(Object.assign({}, element), { + finisher: function finisher(clazz) { + Object.assign(clazz.prototype[element.key], options); + } + }); + }; + + var legacyEventOptions = // tslint:disable-next-line:no-any legacy decorator + function legacyEventOptions(options, proto, name) { + Object.assign(proto[name], options); + }; + /** + * Adds event listener options to a method used as an event listener in a + * lit-html template. + * + * @param options An object that specifies event listener options as accepted by + * `EventTarget#addEventListener` and `EventTarget#removeEventListener`. + * + * Current browsers support the `capture`, `passive`, and `once` options. See: + * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters + * + * @example + * ```ts + * class MyElement { + * clicked = false; + * + * render() { + * return html` + *
+ * + *
+ * `; + * } + * + * @eventOptions({capture: true}) + * _onClick(e) { + * this.clicked = true; + * } + * } + * ``` + * @category Decorator + */ + + + function eventOptions(options) { + // Return value typed as any to prevent TypeScript from complaining that + // standard decorator function signature does not match TypeScript decorator + // signature + // TODO(kschaaf): unclear why it was only failing on this decorator and not + // the others + return function (protoOrDescriptor, name) { + return name !== undefined ? legacyEventOptions(options, protoOrDescriptor, name) : standardEventOptions(options, protoOrDescriptor); + }; + } // x-browser support for matches + /** @license Copyright (c) 2019 The Polymer Project Authors. All rights reserved. @@ -47206,7 +47745,11 @@ part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ - var supportsAdoptingStyleSheets = 'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype; + + /** + * Whether the current browser supports `adoptedStyleSheets`. + */ + var supportsAdoptingStyleSheets = window.ShadowRoot && (window.ShadyCSS === undefined || window.ShadyCSS.nativeShadow) && 'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype; var constructionToken = Symbol(); var CSSResult = /*#__PURE__*/function () { function CSSResult(cssText, safeToken) { @@ -47230,8 +47773,8 @@ key: "styleSheet", get: function get() { if (this._styleSheet === undefined) { - // Note, if `adoptedStyleSheets` is supported then we assume CSSStyleSheet - // is constructable. + // Note, if `supportsAdoptingStyleSheets` is true then we assume + // CSSStyleSheet is constructable. if (supportsAdoptingStyleSheets) { this._styleSheet = new CSSStyleSheet(); @@ -47247,6 +47790,17 @@ return CSSResult; }(); + /** + * Wrap a value for interpolation in a [[`css`]] tagged template literal. + * + * This is unsafe because untrusted CSS text can be used to phone home + * or exfiltrate data to an attacker controlled site. Take care to only use + * this with trusted input. + */ + + var unsafeCSS = function unsafeCSS(value) { + return new CSSResult(String(value), constructionToken); + }; var textFromCSSResult = function textFromCSSResult(value) { if (value instanceof CSSResult) { @@ -47258,10 +47812,10 @@ } }; /** - * Template tag which which can be used with LitElement's `style` property to - * set element styles. For security reasons, only literal string values may be - * used. To incorporate non-literal values `unsafeCSS` may be used inside a - * template string part. + * Template tag which which can be used with LitElement's [[LitElement.styles | + * `styles`]] property to set element styles. For security reasons, only literal + * string values may be used. To incorporate non-literal values [[`unsafeCSS`]] + * may be used inside a template string part. */ @@ -47279,13 +47833,22 @@ // This line will be used in regexes to search for LitElement usage. // TODO(justinfagnani): inject version number at build time - (window['litElementVersions'] || (window['litElementVersions'] = [])).push('2.3.1'); + (window['litElementVersions'] || (window['litElementVersions'] = [])).push('2.4.0'); /** * Sentinal value used to avoid calling lit-html's render function when * subclasses do not implement `render` */ var renderNotImplemented = {}; + /** + * Base element class that manages element properties and attributes, and + * renders a lit-html template. + * + * To define a component, subclass `LitElement` and implement a + * `render` method to provide the component's template. Define properties + * using the [[`properties`]] property or the [[`property`]] decorator. + */ + var LitElement = /*#__PURE__*/function (_UpdatingElement) { _inherits(LitElement, _UpdatingElement); @@ -47301,9 +47864,9 @@ key: "initialize", /** - * Performs element initialization. By default this calls `createRenderRoot` - * to create the element `renderRoot` node and captures any pre-set values for - * registered properties. + * Performs element initialization. By default this calls + * [[`createRenderRoot`]] to create the element [[`renderRoot`]] node and + * captures any pre-set values for registered properties. */ value: function initialize() { _get(_getPrototypeOf(LitElement.prototype), "initialize", this).call(this); @@ -47334,7 +47897,7 @@ }); } /** - * Applies styling to the element shadowRoot using the `static get styles` + * Applies styling to the element shadowRoot using the [[`styles`]] * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where * available and will fallback otherwise. When Shadow DOM is polyfilled, * ShadyCSS scopes styles and adds them to the document. When Shadow DOM @@ -47352,7 +47915,7 @@ return; } // There are three separate cases here based on Shadow DOM support. // (1) shadowRoot polyfilled: use ShadyCSS - // (2) shadowRoot.adoptedStyleSheets available: use it. + // (2) shadowRoot.adoptedStyleSheets available: use it // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after // rendering @@ -47363,7 +47926,7 @@ }), this.localName); } else if (supportsAdoptingStyleSheets) { this.renderRoot.adoptedStyleSheets = styles.map(function (s) { - return s.styleSheet; + return s instanceof CSSStyleSheet ? s : s.styleSheet; }); } else { // This must be done after rendering so the actual style insertion is done @@ -47425,9 +47988,9 @@ } /** * Invoked on each update to perform rendering tasks. This method may return - * any value renderable by lit-html's NodePart - typically a TemplateResult. - * Setting properties inside this method will *not* trigger the element to - * update. + * any value renderable by lit-html's `NodePart` - typically a + * `TemplateResult`. Setting properties inside this method will *not* trigger + * the element to update. */ }, { @@ -47465,9 +48028,7 @@ var userStyles = this.getStyles(); - if (userStyles === undefined) { - this._styles = []; - } else if (Array.isArray(userStyles)) { + if (Array.isArray(userStyles)) { // De-duplicate styles preserving the _last_ instance in the set. // This is a performance optimization to avoid duplicated styles that can // occur especially when composing via subclassing. @@ -47491,8 +48052,29 @@ }); this._styles = styles; } else { - this._styles = [userStyles]; - } + this._styles = userStyles === undefined ? [] : [userStyles]; + } // Ensure that there are no invalid CSSStyleSheet instances here. They are + // invalid in two conditions. + // (1) the sheet is non-constructible (`sheet` of a HTMLStyleElement), but + // this is impossible to check except via .replaceSync or use + // (2) the ShadyCSS polyfill is enabled (:. supportsAdoptingStyleSheets is + // false) + + + this._styles = this._styles.map(function (s) { + if (s instanceof CSSStyleSheet && !supportsAdoptingStyleSheets) { + // Flatten the cssText from the passed constructible stylesheet (or + // undetectable non-constructible stylesheet). The user might have + // expected to update their stylesheets over time, but the alternative + // is a crash. + var cssText = Array.prototype.slice.call(s.cssRules).reduce(function (css, rule) { + return css + rule.cssText; + }, ''); + return unsafeCSS(cssText); + } + + return s; + }); } }]); @@ -47508,15 +48090,925 @@ LitElement['finalized'] = true; /** - * Render method used to render the value to the element's DOM. - * @param result The value to render. - * @param container Node into which to render. - * @param options Element name. + * Reference to the underlying library method used to render the element's + * DOM. By default, points to the `render` method from lit-html's shady-render + * module. + * + * **Most users will never need to touch this property.** + * + * This property should not be confused with the `render` instance method, + * which should be overridden to define a template for the element. + * + * Advanced users creating a new base class based on LitElement can override + * this property to point to a custom render method with a signature that + * matches [shady-render's `render` + * method](https://lit-html.polymer-project.org/api/modules/shady_render.html#render). + * * @nocollapse */ LitElement.render = render$1; + function __decorate(decorators, target, key, desc) { + var c = arguments.length, + r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, + d; + if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) { + if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + } + return c > 3 && r && Object.defineProperty(target, key, r), r; + } + + function __decorate$1(decorators, target, key, desc) { + var c = arguments.length, + r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, + d; + if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) { + if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + } + return c > 3 && r && Object.defineProperty(target, key, r), r; + } + + var fn$7 = function fn() {}; + + var optionsBlock = { + get passive() { + return false; + } + + }; + document.addEventListener('x', fn$7, optionsBlock); + document.removeEventListener('x', fn$7); + + /** @soyCompatible */ + + var BaseElement = /*#__PURE__*/function (_LitElement) { + _inherits(BaseElement, _LitElement); + + var _super = _createSuper(BaseElement); + + function BaseElement() { + _classCallCheck(this, BaseElement); + + return _super.apply(this, arguments); + } + + _createClass(BaseElement, [{ + key: "click", + value: function click() { + if (this.mdcRoot) { + this.mdcRoot.focus(); + this.mdcRoot.click(); + return; + } + + _get(_getPrototypeOf(BaseElement.prototype), "click", this).call(this); + } + /** + * Create and attach the MDC Foundation to the instance + */ + + }, { + key: "createFoundation", + value: function createFoundation() { + if (this.mdcFoundation !== undefined) { + this.mdcFoundation.destroy(); + } + + if (this.mdcFoundationClass) { + this.mdcFoundation = new this.mdcFoundationClass(this.createAdapter()); + this.mdcFoundation.init(); + } + } + }, { + key: "firstUpdated", + value: function firstUpdated() { + this.createFoundation(); + } + }]); + + return BaseElement; + }(LitElement); + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + + function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + /** + * @license + * Copyright 2016 Google Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + var MDCFoundation = + /** @class */ + function () { + function MDCFoundation(adapter) { + if (adapter === void 0) { + adapter = {}; + } + + this.adapter = adapter; + } + + Object.defineProperty(MDCFoundation, "cssClasses", { + get: function get() { + // Classes extending MDCFoundation should implement this method to return an object which exports every + // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} + return {}; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MDCFoundation, "strings", { + get: function get() { + // Classes extending MDCFoundation should implement this method to return an object which exports all + // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} + return {}; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MDCFoundation, "numbers", { + get: function get() { + // Classes extending MDCFoundation should implement this method to return an object which exports all + // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} + return {}; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MDCFoundation, "defaultAdapter", { + get: function get() { + // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient + // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter + // validation. + return {}; + }, + enumerable: true, + configurable: true + }); + + MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) + }; + + MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) + }; + + return MDCFoundation; + }(); + + /** + * @license + * Copyright 2016 Google Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + var cssClasses = { + // Ripple is a special case where the "root" component is really a "mixin" of sorts, + // given that it's an 'upgrade' to an existing component. That being said it is the root + // CSS class that all other CSS classes derive from. + BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', + FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', + FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', + ROOT: 'mdc-ripple-upgraded', + UNBOUNDED: 'mdc-ripple-upgraded--unbounded' + }; + var strings = { + VAR_FG_SCALE: '--mdc-ripple-fg-scale', + VAR_FG_SIZE: '--mdc-ripple-fg-size', + VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', + VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', + VAR_LEFT: '--mdc-ripple-left', + VAR_TOP: '--mdc-ripple-top' + }; + var numbers = { + DEACTIVATION_TIMEOUT_MS: 225, + FG_DEACTIVATION_MS: 150, + INITIAL_ORIGIN_SCALE: 0.6, + PADDING: 10, + TAP_DELAY_MS: 300 + }; + + /** + * Stores result from supportsCssVariables to avoid redundant processing to + * detect CSS custom variable support. + */ + function getNormalizedEventCoords(evt, pageOffset, clientRect) { + if (!evt) { + return { + x: 0, + y: 0 + }; + } + + var x = pageOffset.x, + y = pageOffset.y; + var documentX = x + clientRect.left; + var documentY = y + clientRect.top; + var normalizedX; + var normalizedY; // Determine touch point relative to the ripple container. + + if (evt.type === 'touchstart') { + var touchEvent = evt; + normalizedX = touchEvent.changedTouches[0].pageX - documentX; + normalizedY = touchEvent.changedTouches[0].pageY - documentY; + } else { + var mouseEvent = evt; + normalizedX = mouseEvent.pageX - documentX; + normalizedY = mouseEvent.pageY - documentY; + } + + return { + x: normalizedX, + y: normalizedY + }; + } + + var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs + + var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; // simultaneous nested activations + + var activatedTargets = []; + + var MDCRippleFoundation = + /** @class */ + function (_super) { + __extends(MDCRippleFoundation, _super); + + function MDCRippleFoundation(adapter) { + var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this; + + _this.activationAnimationHasEnded_ = false; + _this.activationTimer_ = 0; + _this.fgDeactivationRemovalTimer_ = 0; + _this.fgScale_ = '0'; + _this.frame_ = { + width: 0, + height: 0 + }; + _this.initialSize_ = 0; + _this.layoutFrame_ = 0; + _this.maxRadius_ = 0; + _this.unboundedCoords_ = { + left: 0, + top: 0 + }; + _this.activationState_ = _this.defaultActivationState_(); + + _this.activationTimerCallback_ = function () { + _this.activationAnimationHasEnded_ = true; + + _this.runDeactivationUXLogicIfReady_(); + }; + + _this.activateHandler_ = function (e) { + return _this.activate_(e); + }; + + _this.deactivateHandler_ = function () { + return _this.deactivate_(); + }; + + _this.focusHandler_ = function () { + return _this.handleFocus(); + }; + + _this.blurHandler_ = function () { + return _this.handleBlur(); + }; + + _this.resizeHandler_ = function () { + return _this.layout(); + }; + + return _this; + } + + Object.defineProperty(MDCRippleFoundation, "cssClasses", { + get: function get() { + return cssClasses; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MDCRippleFoundation, "strings", { + get: function get() { + return strings; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MDCRippleFoundation, "numbers", { + get: function get() { + return numbers; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { + get: function get() { + return { + addClass: function addClass() { + return undefined; + }, + browserSupportsCssVars: function browserSupportsCssVars() { + return true; + }, + computeBoundingRect: function computeBoundingRect() { + return { + top: 0, + right: 0, + bottom: 0, + left: 0, + width: 0, + height: 0 + }; + }, + containsEventTarget: function containsEventTarget() { + return true; + }, + deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { + return undefined; + }, + deregisterInteractionHandler: function deregisterInteractionHandler() { + return undefined; + }, + deregisterResizeHandler: function deregisterResizeHandler() { + return undefined; + }, + getWindowPageOffset: function getWindowPageOffset() { + return { + x: 0, + y: 0 + }; + }, + isSurfaceActive: function isSurfaceActive() { + return true; + }, + isSurfaceDisabled: function isSurfaceDisabled() { + return true; + }, + isUnbounded: function isUnbounded() { + return true; + }, + registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { + return undefined; + }, + registerInteractionHandler: function registerInteractionHandler() { + return undefined; + }, + registerResizeHandler: function registerResizeHandler() { + return undefined; + }, + removeClass: function removeClass() { + return undefined; + }, + updateCssVariable: function updateCssVariable() { + return undefined; + } + }; + }, + enumerable: true, + configurable: true + }); + + MDCRippleFoundation.prototype.init = function () { + var _this = this; + + var supportsPressRipple = this.supportsPressRipple_(); + this.registerRootHandlers_(supportsPressRipple); + + if (supportsPressRipple) { + var _a = MDCRippleFoundation.cssClasses, + ROOT_1 = _a.ROOT, + UNBOUNDED_1 = _a.UNBOUNDED; + requestAnimationFrame(function () { + _this.adapter.addClass(ROOT_1); + + if (_this.adapter.isUnbounded()) { + _this.adapter.addClass(UNBOUNDED_1); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple + + + _this.layoutInternal_(); + } + }); + } + }; + + MDCRippleFoundation.prototype.destroy = function () { + var _this = this; + + if (this.supportsPressRipple_()) { + if (this.activationTimer_) { + clearTimeout(this.activationTimer_); + this.activationTimer_ = 0; + this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); + } + + if (this.fgDeactivationRemovalTimer_) { + clearTimeout(this.fgDeactivationRemovalTimer_); + this.fgDeactivationRemovalTimer_ = 0; + this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); + } + + var _a = MDCRippleFoundation.cssClasses, + ROOT_2 = _a.ROOT, + UNBOUNDED_2 = _a.UNBOUNDED; + requestAnimationFrame(function () { + _this.adapter.removeClass(ROOT_2); + + _this.adapter.removeClass(UNBOUNDED_2); + + _this.removeCssVars_(); + }); + } + + this.deregisterRootHandlers_(); + this.deregisterDeactivationHandlers_(); + }; + /** + * @param evt Optional event containing position information. + */ + + + MDCRippleFoundation.prototype.activate = function (evt) { + this.activate_(evt); + }; + + MDCRippleFoundation.prototype.deactivate = function () { + this.deactivate_(); + }; + + MDCRippleFoundation.prototype.layout = function () { + var _this = this; + + if (this.layoutFrame_) { + cancelAnimationFrame(this.layoutFrame_); + } + + this.layoutFrame_ = requestAnimationFrame(function () { + _this.layoutInternal_(); + + _this.layoutFrame_ = 0; + }); + }; + + MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { + var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; + + if (unbounded) { + this.adapter.addClass(UNBOUNDED); + } else { + this.adapter.removeClass(UNBOUNDED); + } + }; + + MDCRippleFoundation.prototype.handleFocus = function () { + var _this = this; + + requestAnimationFrame(function () { + return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); + }); + }; + + MDCRippleFoundation.prototype.handleBlur = function () { + var _this = this; + + requestAnimationFrame(function () { + return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); + }); + }; + /** + * We compute this property so that we are not querying information about the client + * until the point in time where the foundation requests it. This prevents scenarios where + * client-side feature-detection may happen too early, such as when components are rendered on the server + * and then initialized at mount time on the client. + */ + + + MDCRippleFoundation.prototype.supportsPressRipple_ = function () { + return this.adapter.browserSupportsCssVars(); + }; + + MDCRippleFoundation.prototype.defaultActivationState_ = function () { + return { + activationEvent: undefined, + hasDeactivationUXRun: false, + isActivated: false, + isProgrammatic: false, + wasActivatedByPointer: false, + wasElementMadeActive: false + }; + }; + /** + * supportsPressRipple Passed from init to save a redundant function call + */ + + + MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { + var _this = this; + + if (supportsPressRipple) { + ACTIVATION_EVENT_TYPES.forEach(function (evtType) { + _this.adapter.registerInteractionHandler(evtType, _this.activateHandler_); + }); + + if (this.adapter.isUnbounded()) { + this.adapter.registerResizeHandler(this.resizeHandler_); + } + } + + this.adapter.registerInteractionHandler('focus', this.focusHandler_); + this.adapter.registerInteractionHandler('blur', this.blurHandler_); + }; + + MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { + var _this = this; + + if (evt.type === 'keydown') { + this.adapter.registerInteractionHandler('keyup', this.deactivateHandler_); + } else { + POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { + _this.adapter.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); + }); + } + }; + + MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { + var _this = this; + + ACTIVATION_EVENT_TYPES.forEach(function (evtType) { + _this.adapter.deregisterInteractionHandler(evtType, _this.activateHandler_); + }); + this.adapter.deregisterInteractionHandler('focus', this.focusHandler_); + this.adapter.deregisterInteractionHandler('blur', this.blurHandler_); + + if (this.adapter.isUnbounded()) { + this.adapter.deregisterResizeHandler(this.resizeHandler_); + } + }; + + MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { + var _this = this; + + this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler_); + POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { + _this.adapter.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); + }); + }; + + MDCRippleFoundation.prototype.removeCssVars_ = function () { + var _this = this; + + var rippleStrings = MDCRippleFoundation.strings; + var keys = Object.keys(rippleStrings); + keys.forEach(function (key) { + if (key.indexOf('VAR_') === 0) { + _this.adapter.updateCssVariable(rippleStrings[key], null); + } + }); + }; + + MDCRippleFoundation.prototype.activate_ = function (evt) { + var _this = this; + + if (this.adapter.isSurfaceDisabled()) { + return; + } + + var activationState = this.activationState_; + + if (activationState.isActivated) { + return; + } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction + + + var previousActivationEvent = this.previousActivationEvent_; + var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; + + if (isSameInteraction) { + return; + } + + activationState.isActivated = true; + activationState.isProgrammatic = evt === undefined; + activationState.activationEvent = evt; + activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); + var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { + return _this.adapter.containsEventTarget(target); + }); + + if (hasActivatedChild) { + // Immediately reset activation state, while preserving logic that prevents touch follow-on events + this.resetActivationState_(); + return; + } + + if (evt !== undefined) { + activatedTargets.push(evt.target); + this.registerDeactivationHandlers_(evt); + } + + activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); + + if (activationState.wasElementMadeActive) { + this.animateActivation_(); + } + + requestAnimationFrame(function () { + // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples + activatedTargets = []; + + if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { + // If space was pressed, try again within an rAF call to detect :active, because different UAs report + // active states inconsistently when they're called within event handling code: + // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 + // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 + // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS + // variable is set within a rAF callback for a submit button interaction (#2241). + activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); + + if (activationState.wasElementMadeActive) { + _this.animateActivation_(); + } + } + + if (!activationState.wasElementMadeActive) { + // Reset activation state immediately if element was not made active. + _this.activationState_ = _this.defaultActivationState_(); + } + }); + }; + + MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { + return evt !== undefined && evt.type === 'keydown' ? this.adapter.isSurfaceActive() : true; + }; + + MDCRippleFoundation.prototype.animateActivation_ = function () { + var _this = this; + + var _a = MDCRippleFoundation.strings, + VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, + VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; + var _b = MDCRippleFoundation.cssClasses, + FG_DEACTIVATION = _b.FG_DEACTIVATION, + FG_ACTIVATION = _b.FG_ACTIVATION; + var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; + this.layoutInternal_(); + var translateStart = ''; + var translateEnd = ''; + + if (!this.adapter.isUnbounded()) { + var _c = this.getFgTranslationCoordinates_(), + startPoint = _c.startPoint, + endPoint = _c.endPoint; + + translateStart = startPoint.x + "px, " + startPoint.y + "px"; + translateEnd = endPoint.x + "px, " + endPoint.y + "px"; + } + + this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); + this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations + + clearTimeout(this.activationTimer_); + clearTimeout(this.fgDeactivationRemovalTimer_); + this.rmBoundedActivationClasses_(); + this.adapter.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. + + this.adapter.computeBoundingRect(); + this.adapter.addClass(FG_ACTIVATION); + this.activationTimer_ = setTimeout(function () { + return _this.activationTimerCallback_(); + }, DEACTIVATION_TIMEOUT_MS); + }; + + MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { + var _a = this.activationState_, + activationEvent = _a.activationEvent, + wasActivatedByPointer = _a.wasActivatedByPointer; + var startPoint; + + if (wasActivatedByPointer) { + startPoint = getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect()); + } else { + startPoint = { + x: this.frame_.width / 2, + y: this.frame_.height / 2 + }; + } // Center the element around the start point. + + + startPoint = { + x: startPoint.x - this.initialSize_ / 2, + y: startPoint.y - this.initialSize_ / 2 + }; + var endPoint = { + x: this.frame_.width / 2 - this.initialSize_ / 2, + y: this.frame_.height / 2 - this.initialSize_ / 2 + }; + return { + startPoint: startPoint, + endPoint: endPoint + }; + }; + + MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { + var _this = this; // This method is called both when a pointing device is released, and when the activation animation ends. + // The deactivation animation should only run after both of those occur. + + + var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; + var _a = this.activationState_, + hasDeactivationUXRun = _a.hasDeactivationUXRun, + isActivated = _a.isActivated; + var activationHasEnded = hasDeactivationUXRun || !isActivated; + + if (activationHasEnded && this.activationAnimationHasEnded_) { + this.rmBoundedActivationClasses_(); + this.adapter.addClass(FG_DEACTIVATION); + this.fgDeactivationRemovalTimer_ = setTimeout(function () { + _this.adapter.removeClass(FG_DEACTIVATION); + }, numbers.FG_DEACTIVATION_MS); + } + }; + + MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { + var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; + this.adapter.removeClass(FG_ACTIVATION); + this.activationAnimationHasEnded_ = false; + this.adapter.computeBoundingRect(); + }; + + MDCRippleFoundation.prototype.resetActivationState_ = function () { + var _this = this; + + this.previousActivationEvent_ = this.activationState_.activationEvent; + this.activationState_ = this.defaultActivationState_(); // Touch devices may fire additional events for the same interaction within a short time. + // Store the previous event until it's safe to assume that subsequent events are for new interactions. + + setTimeout(function () { + return _this.previousActivationEvent_ = undefined; + }, MDCRippleFoundation.numbers.TAP_DELAY_MS); + }; + + MDCRippleFoundation.prototype.deactivate_ = function () { + var _this = this; + + var activationState = this.activationState_; // This can happen in scenarios such as when you have a keyup event that blurs the element. + + if (!activationState.isActivated) { + return; + } + + var state = __assign({}, activationState); + + if (activationState.isProgrammatic) { + requestAnimationFrame(function () { + return _this.animateDeactivation_(state); + }); + this.resetActivationState_(); + } else { + this.deregisterDeactivationHandlers_(); + requestAnimationFrame(function () { + _this.activationState_.hasDeactivationUXRun = true; + + _this.animateDeactivation_(state); + + _this.resetActivationState_(); + }); + } + }; + + MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { + var wasActivatedByPointer = _a.wasActivatedByPointer, + wasElementMadeActive = _a.wasElementMadeActive; + + if (wasActivatedByPointer || wasElementMadeActive) { + this.runDeactivationUXLogicIfReady_(); + } + }; + + MDCRippleFoundation.prototype.layoutInternal_ = function () { + var _this = this; + + this.frame_ = this.adapter.computeBoundingRect(); + var maxDim = Math.max(this.frame_.height, this.frame_.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. + // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately + // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically + // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter + // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via + // `overflow: hidden`. + + var getBoundedRadius = function getBoundedRadius() { + var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); + return hypotenuse + MDCRippleFoundation.numbers.PADDING; + }; + + this.maxRadius_ = this.adapter.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform + + var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); // Unbounded ripple size should always be even number to equally center align. + + if (this.adapter.isUnbounded() && initialSize % 2 !== 0) { + this.initialSize_ = initialSize - 1; + } else { + this.initialSize_ = initialSize; + } + + this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; + this.updateLayoutCssVars_(); + }; + + MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { + var _a = MDCRippleFoundation.strings, + VAR_FG_SIZE = _a.VAR_FG_SIZE, + VAR_LEFT = _a.VAR_LEFT, + VAR_TOP = _a.VAR_TOP, + VAR_FG_SCALE = _a.VAR_FG_SCALE; + this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); + this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale_); + + if (this.adapter.isUnbounded()) { + this.unboundedCoords_ = { + left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), + top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) + }; + this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); + this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); + } + }; + + return MDCRippleFoundation; + }(MDCFoundation); + /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -47531,6 +49023,54 @@ * http://polymer.github.io/PATENTS.txt */ var directives$1 = new WeakMap(); + /** + * Brands a function as a directive factory function so that lit-html will call + * the function during template rendering, rather than passing as a value. + * + * A _directive_ is a function that takes a Part as an argument. It has the + * signature: `(part: Part) => void`. + * + * A directive _factory_ is a function that takes arguments for data and + * configuration and returns a directive. Users of directive usually refer to + * the directive factory as the directive. For example, "The repeat directive". + * + * Usually a template author will invoke a directive factory in their template + * with relevant arguments, which will then return a directive function. + * + * Here's an example of using the `repeat()` directive factory that takes an + * array and a function to render an item: + * + * ```js + * html`
    <${repeat(items, (item) => html`
  • ${item}
  • `)}
` + * ``` + * + * When `repeat` is invoked, it returns a directive function that closes over + * `items` and the template function. When the outer template is rendered, the + * return directive function is called with the Part for the expression. + * `repeat` then performs it's custom logic to render multiple items. + * + * @param f The directive factory function. Must be a function that returns a + * function of the signature `(part: Part) => void`. The returned function will + * be called with the part object. + * + * @example + * + * import {directive, html} from 'lit-html'; + * + * const immutable = directive((v) => (part) => { + * if (part.value !== v) { + * part.setValue(v) + * } + * }); + */ + + var directive = function directive(f) { + return function () { + var d = f.apply(void 0, arguments); + directives$1.set(d, true); + return d; + }; + }; var isDirective$1 = function isDirective(o) { return typeof o === 'function' && directives$1.has(o); }; @@ -47552,7 +49092,7 @@ /** * True if the custom elements polyfill is in use. */ - var isCEPolyfill$1 = window.customElements !== undefined && window.customElements.polyfillWrapFlushCallback !== undefined; + var isCEPolyfill$1 = typeof window !== 'undefined' && window.customElements != null && window.customElements.polyfillWrapFlushCallback !== undefined; /** * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from * `container`. @@ -47659,7 +49199,8 @@ * * (') then any non-(') */ - var lastAttributeNameRegex$1 = /([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/; + var lastAttributeNameRegex$1 = // eslint-disable-next-line no-control-regex + /([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/; /** * An instance of a `Template` that can be attached to the DOM and updated @@ -47740,7 +49281,7 @@ // Given these constraints, with full custom elements support we would // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect // - // But Safari dooes not implement CustomElementRegistry#upgrade, so we + // But Safari does not implement CustomElementRegistry#upgrade, so we // can not implement that order and still have upgrade-before-update and // upgrade disconnected fragments. So we instead sacrifice the // process-before-upgrade constraint, since in Custom Elements v1 elements @@ -47828,6 +49369,21 @@ return TemplateInstance; }(); + /** + * Our TrustedTypePolicy for HTML which is declared using the html template + * tag function. + * + * That HTML is a developer-authored constant, and is parsed with innerHTML + * before any untrusted expressions have been mixed in. Therefor it is + * considered safe by construction. + */ + + var policy$1 = window.trustedTypes && trustedTypes.createPolicy('lit-html', { + createHTML: function createHTML(s) { + return s; + } + }); + var commentMarker$1 = " ".concat(marker$1, " "); /** * The return type of `html`, which holds a Template and the values from * interpolated expressions. @@ -47858,7 +49414,7 @@ var s = this.strings[i]; // For each binding we want to determine the kind of marker to insert // into the template source before it's parsed by the browser's HTML // parser. The marker type is based on whether the expression is in an - // attribute, text, or comment poisition. + // attribute, text, or comment position. // * For node-position bindings we insert a comment with the marker // sentinel as its text content, like . // * For attribute bindings we insert just the marker sentinel for the @@ -47877,7 +49433,7 @@ // comment close. Because <-- can appear in an attribute value there can // be false positives. - isCommentBinding = (commentOpen > -1 || isCommentBinding) && s.indexOf('-->', commentOpen + 1) === -1; // Check to see if we have an attribute-like sequence preceeding the + isCommentBinding = (commentOpen > -1 || isCommentBinding) && s.indexOf('-->', commentOpen + 1) === -1; // Check to see if we have an attribute-like sequence preceding the // expression. This can match "name=value" like structures in text, // comments, and attribute values, so there can be false-positives. @@ -47885,11 +49441,11 @@ if (attributeMatch === null) { // We're only in this branch if we don't have a attribute-like - // preceeding sequence. For comments, this guards against unusual + // preceding sequence. For comments, this guards against unusual // attribute values like
. Cases like // are handled correctly in the attribute branch // below. - html += s + (isCommentBinding ? marker$1 : nodeMarker$1); + html += s + (isCommentBinding ? commentMarker$1 : nodeMarker$1); } else { // For attributes we use just a marker sentinel, and also append a // $lit$ suffix to the name to opt-out of attribute-specific parsing @@ -47905,7 +49461,17 @@ key: "getTemplateElement", value: function getTemplateElement() { var template = document.createElement('template'); - template.innerHTML = this.getHTML(); + var value = this.getHTML(); + + if (policy$1 !== undefined) { + // this is secure because `this.strings` is a TemplateStringsArray. + // TODO: validate this when + // https://github.com/tc39/proposal-array-is-template-object is + // implemented. + value = policy$1.createHTML(value); + } + + template.innerHTML = value; return template; } }]); @@ -47917,12 +49483,12 @@ return value === null || !(_typeof(value) === 'object' || typeof value === 'function'); }; var isIterable$1 = function isIterable(value) { - return Array.isArray(value) || // tslint:disable-next-line:no-any + return Array.isArray(value) || // eslint-disable-next-line @typescript-eslint/no-explicit-any !!(value && value[Symbol.iterator]); }; /** * Writes attribute values to the DOM for a group of AttributeParts bound to a - * single attibute. The value is only set once even if there are multiple parts + * single attribute. The value is only set once even if there are multiple parts * for an attribute. */ @@ -47955,19 +49521,45 @@ value: function _getValue() { var strings = this.strings; var l = strings.length - 1; + var parts = this.parts; // If we're assigning an attribute via syntax like: + // attr="${foo}" or attr=${foo} + // but not + // attr="${foo} ${bar}" or attr="${foo} baz" + // then we don't want to coerce the attribute value into one long + // string. Instead we want to just return the value itself directly, + // so that sanitizeDOMValue can get the actual value rather than + // String(value) + // The exception is if v is an array, in which case we do want to smash + // it together into a string without calling String() on the array. + // + // This also allows trusted values (when using TrustedTypes) being + // assigned to DOM sinks without being stringified in the process. + + if (l === 1 && strings[0] === '' && strings[1] === '') { + var v = parts[0].value; + + if (_typeof(v) === 'symbol') { + return String(v); + } + + if (typeof v === 'string' || !isIterable$1(v)) { + return v; + } + } + var text = ''; for (var i = 0; i < l; i++) { text += strings[i]; - var part = this.parts[i]; + var part = parts[i]; if (part !== undefined) { - var v = part.value; + var _v = part.value; - if (isPrimitive$1(v) || !isIterable$1(v)) { - text += typeof v === 'string' ? v : String(v); + if (isPrimitive$1(_v) || !isIterable$1(_v)) { + text += typeof _v === 'string' ? _v : String(_v); } else { - var _iterator = _createForOfIteratorHelper(v), + var _iterator = _createForOfIteratorHelper(_v), _step; try { @@ -48122,6 +49714,10 @@ }, { key: "commit", value: function commit() { + if (this.startNode.parentNode === null) { + return; + } + while (isDirective$1(this.__pendingValue)) { var directive = this.__pendingValue; this.__pendingValue = noChange$1; @@ -48174,7 +49770,10 @@ key: "__commitText", value: function __commitText(value) { var node = this.startNode.nextSibling; - value = value == null ? '' : value; + value = value == null ? '' : value; // If `value` isn't already a string, we explicitly convert it here in case + // it can't be implicitly converted - i.e. it's a symbol. + + var valueAsString = typeof value === 'string' ? value : String(value); if (node === this.endNode.previousSibling && node.nodeType === 3 /* Node.TEXT_NODE */ @@ -48182,9 +49781,9 @@ // If we only have a single text node between the markers, we can just // set its value, rather than replacing it. // TODO(justinfagnani): Can we just check if this.value is primitive? - node.data = value; + node.data = valueAsString; } else { - this.__commitNode(document.createTextNode(typeof value === 'string' ? value : String(value))); + this.__commitNode(document.createTextNode(valueAsString)); } this.value = value; @@ -48384,7 +49983,7 @@ key: "commit", value: function commit() { if (this.dirty) { - this.dirty = false; // tslint:disable-next-line:no-any + this.dirty = false; // eslint-disable-next-line @typescript-eslint/no-explicit-any this.element[this.name] = this._getValue(); } @@ -48406,25 +50005,29 @@ return PropertyPart; }(AttributePart$1); // Detect event listener options support. If the `capture` property is read - // from the options object, then options are supported. If not, then the thrid + // from the options object, then options are supported. If not, then the third // argument to add/removeEventListener is interpreted as the boolean capture // value so we should only pass the `capture` property. - var eventOptionsSupported$1 = false; + var eventOptionsSupported$1 = false; // Wrap into an IIFE because MS Edge <= v41 does not support having try/catch + // blocks right into the body of a module - try { - var options = { - get capture() { - eventOptionsSupported$1 = true; - return false; - } + (function () { + try { + var options = { + get capture() { + eventOptionsSupported$1 = true; + return false; + } - }; // tslint:disable-next-line:no-any + }; // eslint-disable-next-line @typescript-eslint/no-explicit-any - window.addEventListener('test', options, options); // tslint:disable-next-line:no-any + window.addEventListener('test', options, options); // eslint-disable-next-line @typescript-eslint/no-explicit-any - window.removeEventListener('test', options, options); - } catch (_e) {} + window.removeEventListener('test', options, options); + } catch (_e) {// event options not supported + } + })(); var EventPart$1 = /*#__PURE__*/function () { function EventPart(element, eventName, eventContext) { @@ -48575,10 +50178,199 @@ // This line will be used in regexes to search for lit-html usage. // TODO(justinfagnani): inject version number at build time - (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.0.0'); + if (typeof window !== 'undefined') { + (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.3.0'); + } + + var ClassList = /*#__PURE__*/function () { + function ClassList(element) { + _classCallCheck(this, ClassList); + + this.classes = new Set(); + this.changed = false; + this.element = element; + var classList = (element.getAttribute('class') || '').split(/\s+/); + + var _iterator = _createForOfIteratorHelper(classList), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var cls = _step.value; + this.classes.add(cls); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + } + + _createClass(ClassList, [{ + key: "add", + value: function add(cls) { + this.classes.add(cls); + this.changed = true; + } + }, { + key: "remove", + value: function remove(cls) { + this.classes["delete"](cls); + this.changed = true; + } + }, { + key: "commit", + value: function commit() { + if (this.changed) { + var classString = ''; + this.classes.forEach(function (cls) { + return classString += cls + ' '; + }); + this.element.setAttribute('class', classString); + } + } + }]); + + return ClassList; + }(); + /** + * Stores the ClassInfo object applied to a given AttributePart. + * Used to unset existing values when a new ClassInfo object is applied. + */ + + + var previousClassesCache = new WeakMap(); + /** + * A directive that applies CSS classes. This must be used in the `class` + * attribute and must be the only part used in the attribute. It takes each + * property in the `classInfo` argument and adds the property name to the + * element's `class` if the property value is truthy; if the property value is + * falsey, the property name is removed from the element's `class`. For example + * `{foo: bar}` applies the class `foo` if the value of `bar` is truthy. + * @param classInfo {ClassInfo} + */ + + var classMap = directive(function (classInfo) { + return function (part) { + if (!(part instanceof AttributePart$1) || part instanceof PropertyPart$1 || part.committer.name !== 'class' || part.committer.parts.length > 1) { + throw new Error('The `classMap` directive must be used in the `class` attribute ' + 'and must be the only part in the attribute.'); + } + + var committer = part.committer; + var element = committer.element; + var previousClasses = previousClassesCache.get(part); + + if (previousClasses === undefined) { + // Write static classes once + // Use setAttribute() because className isn't a string on SVG elements + element.setAttribute('class', committer.strings.join(' ')); + previousClassesCache.set(part, previousClasses = new Set()); + } + + var classList = element.classList || new ClassList(element); // Remove old classes that no longer apply + // We use forEach() instead of for-of so that re don't require down-level + // iteration. + + previousClasses.forEach(function (name) { + if (!(name in classInfo)) { + classList.remove(name); + previousClasses["delete"](name); + } + }); // Add or remove classes based on their classMap value + + for (var name in classInfo) { + var value = classInfo[name]; + + if (value != previousClasses.has(name)) { + // We explicitly want a loose truthy check of `value` because it seems + // more convenient that '' and 0 are skipped. + if (value) { + classList.add(name); + previousClasses.add(name); + } else { + classList.remove(name); + previousClasses["delete"](name); + } + } + } + + if (typeof classList.commit === 'function') { + classList.commit(); + } + }; + }); + + /** + * Stores the StyleInfo object applied to a given AttributePart. + * Used to unset existing values when a new StyleInfo object is applied. + */ + + var previousStylePropertyCache = new WeakMap(); + /** + * A directive that applies CSS properties to an element. + * + * `styleMap` can only be used in the `style` attribute and must be the only + * expression in the attribute. It takes the property names in the `styleInfo` + * object and adds the property values as CSS properties. Property names with + * dashes (`-`) are assumed to be valid CSS property names and set on the + * element's style object using `setProperty()`. Names without dashes are + * assumed to be camelCased JavaScript property names and set on the element's + * style object using property assignment, allowing the style object to + * translate JavaScript-style names to CSS property names. + * + * For example `styleMap({backgroundColor: 'red', 'border-top': '5px', '--size': + * '0'})` sets the `background-color`, `border-top` and `--size` properties. + * + * @param styleInfo {StyleInfo} + */ + + var styleMap = directive(function (styleInfo) { + return function (part) { + if (!(part instanceof AttributePart$1) || part instanceof PropertyPart$1 || part.committer.name !== 'style' || part.committer.parts.length > 1) { + throw new Error('The `styleMap` directive must be used in the style attribute ' + 'and must be the only part in the attribute.'); + } + + var committer = part.committer; + var style = committer.element.style; + var previousStyleProperties = previousStylePropertyCache.get(part); + + if (previousStyleProperties === undefined) { + // Write static styles once + style.cssText = committer.strings.join(' '); + previousStylePropertyCache.set(part, previousStyleProperties = new Set()); + } // Remove old properties that no longer exist in styleInfo + // We use forEach() instead of for-of so that re don't require down-level + // iteration. + + + previousStyleProperties.forEach(function (name) { + if (!(name in styleInfo)) { + previousStyleProperties["delete"](name); + + if (name.indexOf('-') === -1) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + style[name] = null; + } else { + style.removeProperty(name); + } + } + }); // Add or update properties + + for (var name in styleInfo) { + previousStyleProperties.add(name); + + if (name.indexOf('-') === -1) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + style[name] = styleInfo[name]; + } else { + style.setProperty(name, styleInfo[name]); + } + } + }; + }); function _templateObject() { - var data = _taggedTemplateLiteral([":host{font-family:var(--mdc-icon-font, \"Material Icons\");font-weight:normal;font-style:normal;font-size:var(--mdc-icon-size, 24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-feature-settings:\"liga\";-webkit-font-smoothing:antialiased}"]); + var data = _taggedTemplateLiteral(["\n
"]); _templateObject = function _templateObject() { return data; @@ -48586,11 +50378,327 @@ return data; } - var style = css(_templateObject()); + /** @soyCompatible */ + + var RippleBase = /*#__PURE__*/function (_BaseElement) { + _inherits(RippleBase, _BaseElement); + + var _super = _createSuper(RippleBase); + + function RippleBase() { + var _this; + + _classCallCheck(this, RippleBase); + + _this = _super.apply(this, arguments); + _this.primary = false; + _this.accent = false; + _this.unbounded = false; + _this.disabled = false; + _this.activated = false; + _this.selected = false; + _this.hovering = false; + _this.bgFocused = false; + _this.fgActivation = false; + _this.fgDeactivation = false; + _this.fgScale = ''; + _this.fgSize = ''; + _this.translateStart = ''; + _this.translateEnd = ''; + _this.leftPos = ''; + _this.topPos = ''; + _this.mdcFoundationClass = MDCRippleFoundation; + return _this; + } + + _createClass(RippleBase, [{ + key: "createAdapter", + value: function createAdapter() { + var _this2 = this; + + return { + browserSupportsCssVars: function browserSupportsCssVars() { + return true; + }, + isUnbounded: function isUnbounded() { + return _this2.unbounded; + }, + isSurfaceActive: function isSurfaceActive() { + return _this2.isActive; + }, + isSurfaceDisabled: function isSurfaceDisabled() { + return _this2.disabled; + }, + addClass: function addClass(className) { + switch (className) { + case 'mdc-ripple-upgraded--background-focused': + _this2.bgFocused = true; + break; + + case 'mdc-ripple-upgraded--foreground-activation': + _this2.fgActivation = true; + break; + + case 'mdc-ripple-upgraded--foreground-deactivation': + _this2.fgDeactivation = true; + break; + } + }, + removeClass: function removeClass(className) { + switch (className) { + case 'mdc-ripple-upgraded--background-focused': + _this2.bgFocused = false; + break; + + case 'mdc-ripple-upgraded--foreground-activation': + _this2.fgActivation = false; + break; + + case 'mdc-ripple-upgraded--foreground-deactivation': + _this2.fgDeactivation = false; + break; + } + }, + containsEventTarget: function containsEventTarget() { + return true; + }, + registerInteractionHandler: function registerInteractionHandler() { + return undefined; + }, + deregisterInteractionHandler: function deregisterInteractionHandler() { + return undefined; + }, + registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { + return undefined; + }, + deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { + return undefined; + }, + registerResizeHandler: function registerResizeHandler() { + return undefined; + }, + deregisterResizeHandler: function deregisterResizeHandler() { + return undefined; + }, + updateCssVariable: function updateCssVariable(varName, value) { + switch (varName) { + case '--mdc-ripple-fg-scale': + _this2.fgScale = value; + break; + + case '--mdc-ripple-fg-size': + _this2.fgSize = value; + break; + + case '--mdc-ripple-fg-translate-end': + _this2.translateEnd = value; + break; + + case '--mdc-ripple-fg-translate-start': + _this2.translateStart = value; + break; + + case '--mdc-ripple-left': + _this2.leftPos = value; + break; + + case '--mdc-ripple-top': + _this2.topPos = value; + break; + } + }, + computeBoundingRect: function computeBoundingRect() { + return (_this2.parentElement || _this2).getBoundingClientRect(); + }, + getWindowPageOffset: function getWindowPageOffset() { + return { + x: window.pageXOffset, + y: window.pageYOffset + }; + } + }; + } + }, { + key: "startPress", + value: function startPress(ev) { + var _this3 = this; + + this.waitForFoundation(function () { + _this3.mdcFoundation.activate(ev); + }); + } + }, { + key: "endPress", + value: function endPress() { + var _this4 = this; + + this.waitForFoundation(function () { + _this4.mdcFoundation.deactivate(); + }); + } + }, { + key: "startFocus", + value: function startFocus() { + var _this5 = this; + + this.waitForFoundation(function () { + _this5.mdcFoundation.handleFocus(); + }); + } + }, { + key: "endFocus", + value: function endFocus() { + var _this6 = this; + + this.waitForFoundation(function () { + _this6.mdcFoundation.handleBlur(); + }); + } + }, { + key: "startHover", + value: function startHover() { + this.hovering = true; + } + }, { + key: "endHover", + value: function endHover() { + this.hovering = false; + } + /** + * Wait for the MDCFoundation to be created by `firstUpdated` + */ + + }, { + key: "waitForFoundation", + value: function waitForFoundation(fn) { + if (this.mdcFoundation) { + fn(); + } else { + this.updateComplete.then(fn); + } + } + /** @soyTemplate */ + + }, { + key: "render", + value: function render() { + var shouldActivateInPrimary = this.activated && (this.primary || !this.accent); + var shouldSelectInPrimary = this.selected && (this.primary || !this.accent); + /** @classMap */ + + var classes = { + 'mdc-ripple-surface--accent': this.accent, + 'mdc-ripple-surface--primary--activated': shouldActivateInPrimary, + 'mdc-ripple-surface--accent--activated': this.accent && this.activated, + 'mdc-ripple-surface--primary--selected': shouldSelectInPrimary, + 'mdc-ripple-surface--accent--selected': this.accent && this.selected, + 'mdc-ripple-surface--disabled': this.disabled, + 'mdc-ripple-surface--hover': this.hovering, + 'mdc-ripple-surface--primary': this.primary, + 'mdc-ripple-surface--selected': this.selected, + 'mdc-ripple-upgraded--background-focused': this.bgFocused, + 'mdc-ripple-upgraded--foreground-activation': this.fgActivation, + 'mdc-ripple-upgraded--foreground-deactivation': this.fgDeactivation, + 'mdc-ripple-upgraded--unbounded': this.unbounded + }; + return html$1(_templateObject(), classMap(classes), styleMap({ + '--mdc-ripple-fg-scale': this.fgScale, + '--mdc-ripple-fg-size': this.fgSize, + '--mdc-ripple-fg-translate-end': this.translateEnd, + '--mdc-ripple-fg-translate-start': this.translateStart, + '--mdc-ripple-left': this.leftPos, + '--mdc-ripple-top': this.topPos + })); + } + }, { + key: "isActive", + get: function get() { + return (this.parentElement || this).matches(':active'); + } + }]); + + return RippleBase; + }(BaseElement); + + __decorate$1([query('.mdc-ripple-surface')], RippleBase.prototype, "mdcRoot", void 0); + + __decorate$1([property({ + type: Boolean + })], RippleBase.prototype, "primary", void 0); + + __decorate$1([property({ + type: Boolean + })], RippleBase.prototype, "accent", void 0); + + __decorate$1([property({ + type: Boolean + })], RippleBase.prototype, "unbounded", void 0); + + __decorate$1([property({ + type: Boolean + })], RippleBase.prototype, "disabled", void 0); + + __decorate$1([property({ + type: Boolean + })], RippleBase.prototype, "activated", void 0); + + __decorate$1([property({ + type: Boolean + })], RippleBase.prototype, "selected", void 0); + + __decorate$1([internalProperty()], RippleBase.prototype, "hovering", void 0); + + __decorate$1([internalProperty()], RippleBase.prototype, "bgFocused", void 0); + + __decorate$1([internalProperty()], RippleBase.prototype, "fgActivation", void 0); + + __decorate$1([internalProperty()], RippleBase.prototype, "fgDeactivation", void 0); + + __decorate$1([internalProperty()], RippleBase.prototype, "fgScale", void 0); + + __decorate$1([internalProperty()], RippleBase.prototype, "fgSize", void 0); + + __decorate$1([internalProperty()], RippleBase.prototype, "translateStart", void 0); + + __decorate$1([internalProperty()], RippleBase.prototype, "translateEnd", void 0); + + __decorate$1([internalProperty()], RippleBase.prototype, "leftPos", void 0); + + __decorate$1([internalProperty()], RippleBase.prototype, "topPos", void 0); + + function _templateObject$1() { + var data = _taggedTemplateLiteral([".mdc-ripple-surface{--mdc-ripple-fg-size: 0;--mdc-ripple-left: 0;--mdc-ripple-top: 0;--mdc-ripple-fg-scale: 1;--mdc-ripple-fg-translate-end: 0;--mdc-ripple-fg-translate-start: 0;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:transform,opacity;position:relative;outline:none;overflow:hidden}.mdc-ripple-surface::before,.mdc-ripple-surface::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:\"\"}.mdc-ripple-surface::before{transition:opacity 15ms linear,background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-ripple-surface::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-ripple-surface.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-ripple-surface.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface::before,.mdc-ripple-surface::after{background-color:#000;background-color:var(--mdc-ripple-color, #000)}.mdc-ripple-surface:hover::before,.mdc-ripple-surface.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface::before,.mdc-ripple-surface::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-ripple-surface.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded],.mdc-ripple-upgraded--unbounded{overflow:visible}.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::after,.mdc-ripple-upgraded--unbounded::before,.mdc-ripple-upgraded--unbounded::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::before,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}:host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;display:block}:host .mdc-ripple-surface{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;will-change:unset}.mdc-ripple-surface--primary::before,.mdc-ripple-surface--primary::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary:hover::before,.mdc-ripple-surface--primary.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface--primary.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--primary.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--primary--activated::before{opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12)}.mdc-ripple-surface--primary--activated::before,.mdc-ripple-surface--primary--activated::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary--activated:hover::before,.mdc-ripple-surface--primary--activated.mdc-ripple-surface--hover::before{opacity:0.16;opacity:var(--mdc-ripple-hover-opacity, 0.16)}.mdc-ripple-surface--primary--activated.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-focus-opacity, 0.24)}.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--primary--activated.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--primary--selected::before{opacity:0.08;opacity:var(--mdc-ripple-selected-opacity, 0.08)}.mdc-ripple-surface--primary--selected::before,.mdc-ripple-surface--primary--selected::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary--selected:hover::before,.mdc-ripple-surface--primary--selected.mdc-ripple-surface--hover::before{opacity:0.12;opacity:var(--mdc-ripple-hover-opacity, 0.12)}.mdc-ripple-surface--primary--selected.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--primary--selected.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--accent::before,.mdc-ripple-surface--accent::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent:hover::before,.mdc-ripple-surface--accent.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface--accent.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--accent.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--accent--activated::before{opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12)}.mdc-ripple-surface--accent--activated::before,.mdc-ripple-surface--accent--activated::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent--activated:hover::before,.mdc-ripple-surface--accent--activated.mdc-ripple-surface--hover::before{opacity:0.16;opacity:var(--mdc-ripple-hover-opacity, 0.16)}.mdc-ripple-surface--accent--activated.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-focus-opacity, 0.24)}.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--accent--activated.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--accent--selected::before{opacity:0.08;opacity:var(--mdc-ripple-selected-opacity, 0.08)}.mdc-ripple-surface--accent--selected::before,.mdc-ripple-surface--accent--selected::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent--selected:hover::before,.mdc-ripple-surface--accent--selected.mdc-ripple-surface--hover::before{opacity:0.12;opacity:var(--mdc-ripple-hover-opacity, 0.12)}.mdc-ripple-surface--accent--selected.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--accent--selected.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--disabled{opacity:0}"]); + + _templateObject$1 = function _templateObject() { + return data; + }; + + return data; + } + var style = css(_templateObject$1()); + + /** @soyCompatible */ + + var Ripple = /*#__PURE__*/function (_RippleBase) { + _inherits(Ripple, _RippleBase); + + var _super = _createSuper(Ripple); + + function Ripple() { + _classCallCheck(this, Ripple); + + return _super.apply(this, arguments); + } + + return Ripple; + }(RippleBase); + + Ripple.styles = style; + Ripple = __decorate$1([customElement('mwc-ripple')], Ripple); /** @license - Copyright 2018 Google Inc. All Rights Reserved. + Copyright 2020 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -48604,56 +50712,254 @@ See the License for the specific language governing permissions and limitations under the License. */ - // load material icons font - var fontEl = document.createElement('link'); - fontEl.rel = 'stylesheet'; - fontEl.href = 'https://fonts.googleapis.com/icon?family=Material+Icons'; - document.head.appendChild(fontEl); + /** + * Class that encapsulates the events handlers for `mwc-ripple` + * + * + * Example: + * ``` + * class XFoo extends LitElement { + * async getRipple() { + * this.renderRipple = true; + * await this.updateComplete; + * return this.renderRoot.querySelector('mwc-ripple'); + * } + * rippleHandlers = new RippleHandlers(() => this.getRipple()); + * + * render() { + * return html` + *
+ * ${this.renderRipple ? html`` : ''} + * `; + * } + * } + * ``` + */ + var RippleHandlers = function RippleHandlers( + /** Function that returns a `mwc-ripple` */ + rippleFn) { + _classCallCheck(this, RippleHandlers); + + this.startPress = function (ev) { + rippleFn().then(function (r) { + r && r.startPress(ev); + }); + }; - function _templateObject$1() { - var data = _taggedTemplateLiteral([""]); + this.endPress = function () { + rippleFn().then(function (r) { + r && r.endPress(); + }); + }; - _templateObject$1 = function _templateObject() { + this.startFocus = function () { + rippleFn().then(function (r) { + r && r.startFocus(); + }); + }; + + this.endFocus = function () { + rippleFn().then(function (r) { + r && r.endFocus(); + }); + }; + + this.startHover = function () { + rippleFn().then(function (r) { + r && r.startHover(); + }); + }; + + this.endHover = function () { + rippleFn().then(function (r) { + r && r.endHover(); + }); + }; + }; + + function _templateObject2() { + var data = _taggedTemplateLiteral(["\n ", "\n ", "\n \n \n \n "]); + + _templateObject2 = function _templateObject2() { return data; }; return data; } - var __decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) { - var c = arguments.length, - r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, - d; - if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) { - if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - } - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; + function _templateObject$2() { + var data = _taggedTemplateLiteral(["\n \n "]); - var Icon = /*#__PURE__*/function (_LitElement) { - _inherits(Icon, _LitElement); + _templateObject$2 = function _templateObject() { + return data; + }; - var _super = _createSuper(Icon); + return data; + } + /** @soyCompatible */ - function Icon() { - _classCallCheck(this, Icon); + var IconButtonBase = /*#__PURE__*/function (_LitElement) { + _inherits(IconButtonBase, _LitElement); - return _super.apply(this, arguments); + var _super = _createSuper(IconButtonBase); + + function IconButtonBase() { + var _this; + + _classCallCheck(this, IconButtonBase); + + _this = _super.apply(this, arguments); + _this.disabled = false; + _this.icon = ''; + _this.label = ''; + _this.shouldRenderRipple = false; + _this.rippleHandlers = new RippleHandlers(function () { + _this.shouldRenderRipple = true; + return _this.ripple; + }); + return _this; } + /** @soyTemplate */ - _createClass(Icon, [{ + + _createClass(IconButtonBase, [{ + key: "renderRipple", + value: function renderRipple() { + return this.shouldRenderRipple ? html$1(_templateObject$2(), this.disabled) : ''; + } + }, { + key: "focus", + value: function focus() { + var buttonElement = this.buttonElement; + + if (buttonElement) { + this.rippleHandlers.startFocus(); + buttonElement.focus(); + } + } + }, { + key: "blur", + value: function blur() { + var buttonElement = this.buttonElement; + + if (buttonElement) { + this.rippleHandlers.endFocus(); + buttonElement.blur(); + } + } + /** @soyTemplate */ + + }, { key: "render", value: function render() { - return html$1(_templateObject$1()); + return html$1(_templateObject2(), this.label || this.icon, this.disabled, this.handleRippleFocus, this.handleRippleBlur, this.handleRippleMouseDown, this.handleRippleMouseEnter, this.handleRippleMouseLeave, this.handleRippleTouchStart, this.handleRippleDeactivate, this.handleRippleDeactivate, this.renderRipple(), this.icon); + } + }, { + key: "handleRippleMouseDown", + value: function handleRippleMouseDown(event) { + var _this2 = this; + + var onUp = function onUp() { + window.removeEventListener('mouseup', onUp); + + _this2.handleRippleDeactivate(); + }; + + window.addEventListener('mouseup', onUp); + this.rippleHandlers.startPress(event); + } + }, { + key: "handleRippleTouchStart", + value: function handleRippleTouchStart(event) { + this.rippleHandlers.startPress(event); + } + }, { + key: "handleRippleDeactivate", + value: function handleRippleDeactivate() { + this.rippleHandlers.endPress(); + } + }, { + key: "handleRippleMouseEnter", + value: function handleRippleMouseEnter() { + this.rippleHandlers.startHover(); + } + }, { + key: "handleRippleMouseLeave", + value: function handleRippleMouseLeave() { + this.rippleHandlers.endHover(); + } + }, { + key: "handleRippleFocus", + value: function handleRippleFocus() { + this.rippleHandlers.startFocus(); + } + }, { + key: "handleRippleBlur", + value: function handleRippleBlur() { + this.rippleHandlers.endFocus(); } }]); - return Icon; + return IconButtonBase; }(LitElement); - Icon.styles = style; - Icon = __decorate([customElement('mwc-icon')], Icon); + __decorate([property({ + type: Boolean, + reflect: true + })], IconButtonBase.prototype, "disabled", void 0); + + __decorate([property({ + type: String + })], IconButtonBase.prototype, "icon", void 0); + + __decorate([property({ + type: String + })], IconButtonBase.prototype, "label", void 0); + + __decorate([query('button')], IconButtonBase.prototype, "buttonElement", void 0); + + __decorate([queryAsync('mwc-ripple')], IconButtonBase.prototype, "ripple", void 0); + + __decorate([internalProperty()], IconButtonBase.prototype, "shouldRenderRipple", void 0); + + __decorate([eventOptions({ + passive: true + })], IconButtonBase.prototype, "handleRippleMouseDown", null); + + __decorate([eventOptions({ + passive: true + })], IconButtonBase.prototype, "handleRippleTouchStart", null); + + function _templateObject$3() { + var data = _taggedTemplateLiteral([".material-icons{font-family:var(--mdc-icon-font, \"Material Icons\");font-weight:normal;font-style:normal;font-size:var(--mdc-icon-size, 24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}.mdc-icon-button{display:inline-block;position:relative;box-sizing:border-box;border:none;outline:none;background-color:transparent;fill:currentColor;color:inherit;font-size:24px;text-decoration:none;cursor:pointer;user-select:none;width:48px;height:48px;padding:12px}.mdc-icon-button svg,.mdc-icon-button img{width:24px;height:24px}.mdc-icon-button:disabled{color:rgba(0, 0, 0, 0.38);color:var(--mdc-theme-text-disabled-on-light, rgba(0, 0, 0, 0.38))}.mdc-icon-button:disabled{cursor:default;pointer-events:none}.mdc-icon-button__icon{display:inline-block}.mdc-icon-button__icon.mdc-icon-button__icon--on{display:none}.mdc-icon-button--on .mdc-icon-button__icon{display:none}.mdc-icon-button--on .mdc-icon-button__icon.mdc-icon-button__icon--on{display:inline-block}:host{display:inline-block;outline:none;--mdc-ripple-color: currentcolor;-webkit-tap-highlight-color:transparent}:host([disabled]){pointer-events:none}:host,.mdc-icon-button{vertical-align:top}.mdc-icon-button{width:var(--mdc-icon-button-size, 48px);height:var(--mdc-icon-button-size, 48px);padding:calc( (var(--mdc-icon-button-size, 48px) - var(--mdc-icon-size, 24px)) / 2 )}.mdc-icon-button>i{position:absolute;top:0;padding-top:inherit}.mdc-icon-button i,.mdc-icon-button svg,.mdc-icon-button img,.mdc-icon-button ::slotted(*){display:block;width:var(--mdc-icon-size, 24px);height:var(--mdc-icon-size, 24px)}"]); + + _templateObject$3 = function _templateObject() { + return data; + }; + + return data; + } + var style$1 = css(_templateObject$3()); + + /** @soyCompatible */ + + var IconButton = /*#__PURE__*/function (_IconButtonBase) { + _inherits(IconButton, _IconButtonBase); + + var _super = _createSuper(IconButton); + + function IconButton() { + _classCallCheck(this, IconButton); + + return _super.apply(this, arguments); + } + + return IconButton; + }(IconButtonBase); + + IconButton.styles = style$1; + IconButton = __decorate([customElement('mwc-icon-button')], IconButton); function _templateObject96() { var data = _taggedTemplateLiteral(["#422D53"]); @@ -49595,20 +51901,20 @@ return data; } - function _templateObject2() { + function _templateObject2$1() { var data = _taggedTemplateLiteral(["#666"]); - _templateObject2 = function _templateObject2() { + _templateObject2$1 = function _templateObject2() { return data; }; return data; } - function _templateObject$2() { + function _templateObject$4() { var data = _taggedTemplateLiteral(["#fff"]); - _templateObject$2 = function _templateObject() { + _templateObject$4 = function _templateObject() { return data; }; @@ -49616,8 +51922,8 @@ } var gscape = { // primary colors - primary: css(_templateObject$2()), - on_primary: css(_templateObject2()), + primary: css(_templateObject$4()), + on_primary: css(_templateObject2$1()), primary_dark: css(_templateObject3()), on_primary_dark: css(_templateObject4()), // secondary colors @@ -49736,20 +52042,20 @@ dark: dark }); - function _templateObject2$1() { + function _templateObject2$2() { var data = _taggedTemplateLiteral([""]); - _templateObject2$1 = function _templateObject2() { + _templateObject2$2 = function _templateObject2() { return data; }; return data; } - function _templateObject$3() { - var data = _taggedTemplateLiteral(["\n :host, .gscape-panel{\n font-family : \"Open Sans\",\"Helvetica Neue\",Helvetica,sans-serif;\n display: block;\n position: absolute;\n color: var(--theme-gscape-on-primary, ", ");\n background-color:var(--theme-gscape-primary, ", ");\n box-shadow: 0 2px 4px 0 var(--theme-gscape-shadows, ", ");\n border-radius: 8px;\n transition: opacity 0.2s;\n scrollbar-width: thin;\n }\n\n :host(:hover){\n box-shadow: 0 4px 8px 0 var(--theme-gscape-shadows, ", ");\n }\n\n .hide {\n display:none;\n }\n\n .widget-body {\n width: 100%;\n max-height:450px;\n border-top:solid 1px var(--theme-gscape-shadows, ", ");\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n overflow:auto;\n scrollbar-width: inherit;\n }\n\n .gscape-panel {\n position: absolute;\n bottom: 40px;\n width: auto;\n padding:10px;\n overflow: unset;\n border: none;\n }\n\n .gscape-panel::after {\n content: \"\";\n position: absolute;\n top: 100%;\n left: 16px;\n margin-left: -8px;\n border-width: 8px;\n border-style: solid;\n border-color: #ddd transparent transparent transparent;\n }\n\n .gscape-panel-title{\n font-weight: bold;\n text-align: center;\n margin-bottom: 10px;\n }\n\n .widget-body .section:last-of-type {\n margin-bottom: 12px;\n }\n\n .widget-body .section-header {\n text-align: center;\n font-weight: bold;\n border-bottom: solid 1px var(--theme-gscape-shadows, ", ");\n color: var(--theme-gscape-secondary, ", ");\n width: 85%;\n margin: auto;\n margin-bottom: 10px;\n padding-bottom: 5px;\n }\n\n .description {\n margin-bottom: 20px;\n }\n\n .description:last-of-type {\n margin-bottom: 0;\n }\n\n .description .language {\n min-width: 50px;\n display: inline-block;\n font-weight: bold;\n color: var(--theme-gscape-secondary, ", ");\n margin: 5px;\n }\n\n .section { padding: 10px; }\n\n .details_table{\n border-spacing: 0;\n }\n\n .details_table th {\n color: var(--theme-gscape-secondary, ", ");\n border-right: solid 1px var(--theme-gscape-shadows, ", ");\n font-weight: bold;\n text-align:left;\n min-width: 50px;\n }\n\n .details_table th, td {\n padding:5px 8px;\n white-space: nowrap;\n }\n\n .highlight:hover {\n color: var(--theme-gscape-on-secondary, ", ");\n background-color:var(--theme-gscape-secondary, ", ");\n }\n\n /* width */\n ::-webkit-scrollbar {\n width: 5px;\n height: 5px;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: #f0f0f0;\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background: #cdcdcd;\n }\n\n /* Handle on hover */\n ::-webkit-scrollbar-thumb:hover {\n background: #888;\n }\n\n .clickable {\n font-weight:bold;\n text-decoration: underline;\n }\n\n .clickable:hover {\n cursor:pointer;\n color: var(--theme-gscape-secondary-dark, ", ");\n }\n\n "]); + function _templateObject$5() { + var data = _taggedTemplateLiteral(["\n :host, .gscape-panel{\n font-family : \"Open Sans\",\"Helvetica Neue\",Helvetica,sans-serif;\n display: block;\n position: absolute;\n color: var(--theme-gscape-on-primary, ", ");\n background-color:var(--theme-gscape-primary, ", ");\n box-shadow: 0 2px 4px 0 var(--theme-gscape-shadows, ", ");\n border-radius: 8px;\n transition: opacity 0.2s;\n scrollbar-width: thin;\n --mdc-icon-button-size: 24px;\n }\n\n :host(:hover){\n box-shadow: 0 4px 8px 0 var(--theme-gscape-shadows, ", ");\n }\n\n .hide {\n display:none;\n }\n\n .widget-body {\n width: 100%;\n max-height:450px;\n border-top:solid 1px var(--theme-gscape-shadows, ", ");\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n overflow:auto;\n scrollbar-width: inherit;\n }\n\n .gscape-panel {\n position: absolute;\n bottom: 40px;\n width: auto;\n padding:10px;\n overflow: unset;\n border: none;\n }\n\n .gscape-panel::after {\n content: \"\";\n position: absolute;\n top: 100%;\n left: 16px;\n margin-left: -8px;\n border-width: 8px;\n border-style: solid;\n border-color: #ddd transparent transparent transparent;\n }\n\n .gscape-panel-title{\n font-weight: bold;\n text-align: center;\n margin-bottom: 10px;\n }\n\n .widget-body .section:last-of-type {\n margin-bottom: 12px;\n }\n\n .widget-body .section-header {\n text-align: center;\n font-weight: bold;\n border-bottom: solid 1px var(--theme-gscape-shadows, ", ");\n color: var(--theme-gscape-secondary, ", ");\n width: 85%;\n margin: auto;\n margin-bottom: 10px;\n padding-bottom: 5px;\n }\n\n .description {\n margin-bottom: 20px;\n }\n\n .description:last-of-type {\n margin-bottom: 0;\n }\n\n .description .language {\n min-width: 50px;\n display: inline-block;\n font-weight: bold;\n color: var(--theme-gscape-secondary, ", ");\n margin: 5px;\n }\n\n .section { padding: 10px; }\n\n .details_table{\n border-spacing: 0;\n }\n\n .details_table th {\n color: var(--theme-gscape-secondary, ", ");\n border-right: solid 1px var(--theme-gscape-shadows, ", ");\n font-weight: bold;\n text-align:left;\n min-width: 50px;\n }\n\n .details_table th, td {\n padding:5px 8px;\n white-space: nowrap;\n }\n\n .highlight:hover {\n color: var(--theme-gscape-on-secondary, ", ");\n background-color:var(--theme-gscape-secondary, ", ");\n }\n\n /* width */\n ::-webkit-scrollbar {\n width: 5px;\n height: 5px;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: #f0f0f0;\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background: #cdcdcd;\n }\n\n /* Handle on hover */\n ::-webkit-scrollbar-thumb:hover {\n background: #888;\n }\n\n .clickable {\n font-weight:bold;\n text-decoration: underline;\n }\n\n .clickable:hover {\n cursor:pointer;\n color: var(--theme-gscape-secondary-dark, ", ");\n }\n\n "]); - _templateObject$3 = function _templateObject() { + _templateObject$5 = function _templateObject() { return data; }; @@ -49777,7 +52083,7 @@ key: "styles", get: function get() { var colors = gscape; - return [[css(_templateObject$3(), colors.on_primary, colors.primary, colors.shadows, colors.shadows, colors.shadows, colors.shadows, colors.secondary, colors.secondary, colors.secondary, colors.shadows, colors.on_secondary, colors.secondary, colors.secondary_dark)], colors]; + return [[css(_templateObject$5(), colors.on_primary, colors.primary, colors.shadows, colors.shadows, colors.shadows, colors.shadows, colors.secondary, colors.secondary, colors.secondary, colors.shadows, colors.on_secondary, colors.secondary, colors.secondary_dark)], colors]; } }]); @@ -49803,7 +52109,7 @@ _createClass(GscapeWidget, [{ key: "render", value: function render() { - return html$1(_templateObject2$1()); + return html$1(_templateObject2$2()); } }, { key: "toggleBody", @@ -49911,10 +52217,15 @@ value: function blur() { this.collapseBody(); } + }, { + key: "isCustomIcon", + value: function isCustomIcon(icon) { + return typeof icon !== 'string'; + } }, { key: "isVisible", get: function get() { - return this.style.display !== 'none' ? true : false; + return this.style.display !== 'none'; } }, { key: "hiddenDefault", @@ -49936,20 +52247,50 @@ return GscapeWidget; }(LitElement); //customElements.define('gscape-widget', GscapeWidget) - function _templateObject2$2() { - var data = _taggedTemplateLiteral(["\n :host {\n display:flex;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: var(--header-padding, 8px);\n }\n\n .head-btn {\n color:var(--theme-gscape-on-primary, ", ");\n right:0;\n padding: var(--btn-padding, 0 0 0 5px);\n cursor:pointer;\n }\n\n .head-btn:hover{\n color:var(--theme-gscape-secondary, ", ");\n }\n\n .head-title {\n padding: var(--title-padding, 0 5px 0 0);\n box-sizing: border-box;\n font-weight:bold;\n cursor:grab;\n width: var(--title-width, '');\n text-align: var(--title-text-align, '')\n }\n "]); + function _templateObject5$1() { + var data = _taggedTemplateLiteral(["\n :host {\n display:flex;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: var(--header-padding, 8px);\n }\n\n .head-btn {\n color:var(--theme-gscape-on-primary, ", ");\n right:0;\n cursor:pointer;\n }\n\n .head-btn:hover{\n color:var(--theme-gscape-secondary, ", ");\n }\n\n .head-title {\n padding: var(--title-padding, 0 10px);\n box-sizing: border-box;\n font-weight:bold;\n cursor:grab;\n width: var(--title-width, '');\n text-align: var(--title-text-align, 'left');\n justify-self: flex-start;\n }\n\n "]); - _templateObject2$2 = function _templateObject2() { + _templateObject5$1 = function _templateObject5() { return data; }; return data; } - function _templateObject$4() { - var data = _taggedTemplateLiteral(["\n
", "
\n \n \n ", "\n \n "]); + function _templateObject4$1() { + var data = _taggedTemplateLiteral(["\n \n "]); - _templateObject$4 = function _templateObject() { + _templateObject4$1 = function _templateObject4() { + return data; + }; + + return data; + } + + function _templateObject3$1() { + var data = _taggedTemplateLiteral(["", ""]); + + _templateObject3$1 = function _templateObject3() { + return data; + }; + + return data; + } + + function _templateObject2$3() { + var data = _taggedTemplateLiteral(["\n \n ", "\n \n "]); + + _templateObject2$3 = function _templateObject2() { + return data; + }; + + return data; + } + + function _templateObject$6() { + var data = _taggedTemplateLiteral(["\n ", "\n\n
\n ", "\n
\n \n \n ", "\n \n "]); + + _templateObject$6 = function _templateObject() { return data; }; @@ -49976,6 +52317,9 @@ }, icon: { type: String + }, + left_icon: { + type: String } }; } @@ -49991,6 +52335,7 @@ _this.initial_icon = 'arrow_drop_down'; _this.secondary_icon = 'arrow_drop_up'; _this.icon = _this.initial_icon; + _this.left_icon = ''; _this.onClick = function () {}; @@ -50000,7 +52345,7 @@ _createClass(GscapeHeader, [{ key: "render", value: function render() { - return html$1(_templateObject$4(), this.title, this.iconClickHandler, this.icon); + return html$1(_templateObject$6(), this.isCustomIcon(this.left_icon) ? html$1(_templateObject2$3(), this.isCustomIcon(this.left_icon) ? html$1(_templateObject3$1(), this.left_icon) : '') : html$1(_templateObject4$1(), this.left_icon), this.title, this.iconClickHandler, this.icon); } }, { key: "iconClickHandler", @@ -50036,7 +52381,7 @@ // we don't need super.styles, just the colors from default imported theme var colors = _get(_getPrototypeOf(GscapeHeader), "styles", this)[1]; - return css(_templateObject2$2(), colors.on_primary, colors.secondary); + return css(_templateObject5$1(), colors.on_primary, colors.secondary); } }]); @@ -50044,30 +52389,30 @@ }(GscapeWidget); customElements.define('gscape-head', GscapeHeader); - function _templateObject3$1() { + function _templateObject3$2() { var data = _taggedTemplateLiteral(["\n \n ", "\n
\n "]); - _templateObject3$1 = function _templateObject3() { + _templateObject3$2 = function _templateObject3() { return data; }; return data; } - function _templateObject2$3() { - var data = _taggedTemplateLiteral(["\n \n\n
\n ", "\n
\n "]); + function _templateObject2$4() { + var data = _taggedTemplateLiteral(["\n \n\n
\n ", "\n
\n "]); - _templateObject2$3 = function _templateObject2() { + _templateObject2$4 = function _templateObject2() { return data; }; return data; } - function _templateObject$5() { + function _templateObject$7() { var data = _taggedTemplateLiteral(["\n :host {\n top: 10px;\n left: 10px;\n }\n\n .diagram-item {\n cursor:pointer;\n padding:5px 10px;\n }\n\n .diagram-item:last-of-type {\n border-radius: inherit;\n }\n\n .selected {\n background-color: var(--theme-gscape-primary-dark, ", ");\n color: var(--theme-gscape-on-primary-dark, ", ");\n font-weight: bold;\n }\n "]); - _templateObject$5 = function _templateObject() { + _templateObject$7 = function _templateObject() { return data; }; @@ -50092,7 +52437,7 @@ var super_styles = _get(_getPrototypeOf(GscapeDiagramSelector), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$5(), colors.primary_dark, colors.on_primary_dark)]; + return [super_styles[0], css(_templateObject$7(), colors.primary_dark, colors.on_primary_dark)]; } }]); @@ -50116,8 +52461,8 @@ value: function render() { var _this2 = this; - return html$1(_templateObject2$3(), this.default_title, this.diagrams.map(function (diagram, id) { - return html$1(_templateObject3$1(), _this2.changeDiagram, diagram.name, id, id == _this2.actual_diagram_id ? "selected" : "", diagram.name); + return html$1(_templateObject2$4(), this.default_title, this.diagrams.map(function (diagram, id) { + return html$1(_templateObject3$2(), _this2.changeDiagram, diagram.name, id, id == _this2.actual_diagram_id ? "selected" : "", diagram.name); })); } }, { @@ -50157,50 +52502,50 @@ }(GscapeWidget); customElements.define('gscape-diagram-selector', GscapeDiagramSelector); - function _templateObject5$1() { + function _templateObject5$2() { var data = _taggedTemplateLiteral(["\n
\n - ", " - ", "\n
\n "]); - _templateObject5$1 = function _templateObject5() { + _templateObject5$2 = function _templateObject5() { return data; }; return data; } - function _templateObject4$1() { + function _templateObject4$2() { var data = _taggedTemplateLiteral(["\n
\n \n keyboard_arrow_right\n ", "\n
", "
\n
\n\n
\n ", "\n
\n
\n "]); - _templateObject4$1 = function _templateObject4() { + _templateObject4$2 = function _templateObject4() { return data; }; return data; } - function _templateObject3$2() { - var data = _taggedTemplateLiteral(["\n \n \n \n\n
\n ", "\n
\n "]); + function _templateObject3$3() { + var data = _taggedTemplateLiteral(["\n \n \n \n\n
\n ", "\n
\n "]); - _templateObject3$2 = function _templateObject3() { + _templateObject3$3 = function _templateObject3() { return data; }; return data; } - function _templateObject2$4() { + function _templateObject2$5() { var data = _taggedTemplateLiteral(["\n
", "
\n "]); - _templateObject2$4 = function _templateObject2() { + _templateObject2$5 = function _templateObject2() { return data; }; return data; } - function _templateObject$6() { - var data = _taggedTemplateLiteral(["\n :host {\n left:50%;\n top:10px;\n min-width:340px;\n max-width:450px;\n transform: translate(-50%, 0);\n }\n\n .widget-body {\n overflow:auto;\n }\n\n .row{\n line-height: 0;\n display: flex;\n align-items: center;\n padding:4px 0;\n }\n\n .row-label{\n padding-left:5px;\n cursor:pointer;\n width:100%;\n white-space: nowrap;\n }\n\n mwc-icon:hover{\n color: var(--theme-gscape-primary, ", ");\n cursor:pointer;\n }\n\n .type-img{\n width: 20px;\n height: 20px;\n text-align: center;\n line-height: 20px;\n }\n\n .type-img-A{\n background-color: var(--theme-graph-attribute, ", ");\n color: var(--theme-graph-attribute-dark, ", ");\n border: solid 1px var(--theme-graph-attribute-dark, ", ");\n }\n\n .type-img-R{\n background-color: var(--theme-graph-role, ", ");\n color: var(--theme-graph-role-dark, ", ");\n border: solid 1px var(--theme-graph-role-dark, ", ");\n }\n\n .type-img-C{\n background-color: var(--theme-graph-concept, ", ");\n color: var(--theme-graph-concept-dark, ", ");\n border: solid 1px var(--theme-graph-concept-dark, ", ");\n }\n\n .type-img-I{\n background-color: var(--theme-graph-individual, ", ");\n color: var(--theme-graph-individual-dark, ", ");\n border: solid 1px var(--theme-graph-individual-dark, ", ");\n }\n\n .sub-row{\n background-color: var(--theme-gscape-primary-dark, ", ");\n padding: 4px 0 4px 34px;\n cursor: pointer;\n }\n\n .sub-rows-wrapper{\n padding: 2px 0;\n }\n\n .add-shadow{\n box-shadow: 0 2px 2px 0 var(--theme-gscape-shadows, ", ");\n }\n\n gscape-head input {\n position:absolute;\n left: 30%;\n width: 50%;\n padding: 0;\n line-height:22px;\n box-sizing: border-box;\n background-color: var(--theme-gscape-primary, ", ");\n border:none;\n border-bottom: 1px solid var(--theme-gscape-shadows, ", ");\n transition: all .35s ease-in-out;\n color:inherit;\n }\n\n gscape-head input:focus {\n border-color: var(--theme-gscape-secondary, ", ");\n left:0;\n margin: 0px 8px;\n width:80%;\n }\n "]); + function _templateObject$8() { + var data = _taggedTemplateLiteral(["\n :host {\n left:50%;\n top:10px;\n min-width:370px;\n max-width:450px;\n transform: translate(-50%, 0);\n }\n\n .widget-body {\n overflow:auto;\n }\n\n .row{\n line-height: 0;\n display: flex;\n align-items: center;\n padding:4px 0;\n }\n\n .row-label{\n padding-left:5px;\n cursor:pointer;\n width:100%;\n white-space: nowrap;\n }\n\n mwc-icon:hover{\n color: var(--theme-gscape-primary, ", ");\n cursor:pointer;\n }\n\n .type-img{\n width: 20px;\n height: 20px;\n text-align: center;\n line-height: 20px;\n }\n\n .type-img-A{\n background-color: var(--theme-graph-attribute, ", ");\n color: var(--theme-graph-attribute-dark, ", ");\n border: solid 1px var(--theme-graph-attribute-dark, ", ");\n }\n\n .type-img-R{\n background-color: var(--theme-graph-role, ", ");\n color: var(--theme-graph-role-dark, ", ");\n border: solid 1px var(--theme-graph-role-dark, ", ");\n }\n\n .type-img-C{\n background-color: var(--theme-graph-concept, ", ");\n color: var(--theme-graph-concept-dark, ", ");\n border: solid 1px var(--theme-graph-concept-dark, ", ");\n }\n\n .type-img-I{\n background-color: var(--theme-graph-individual, ", ");\n color: var(--theme-graph-individual-dark, ", ");\n border: solid 1px var(--theme-graph-individual-dark, ", ");\n }\n\n .sub-row{\n background-color: var(--theme-gscape-primary-dark, ", ");\n padding: 4px 0 4px 34px;\n cursor: pointer;\n }\n\n .sub-rows-wrapper{\n padding: 2px 0;\n }\n\n .add-shadow{\n box-shadow: 0 2px 2px 0 var(--theme-gscape-shadows, ", ");\n }\n\n gscape-head input {\n position:initial;\n left: 30%;\n width: 50%;\n padding: 0 10px;\n line-height:23px;\n box-sizing: border-box;\n background-color: var(--theme-gscape-primary, ", ");\n border:none;\n border-bottom: 1px solid var(--theme-gscape-shadows, ", ");\n transition: width .35s ease-in-out;\n color:inherit;\n flex-grow:2;\n font-size:inherit;\n }\n\n gscape-head input:focus {\n position:absolute;\n border-color: var(--theme-gscape-secondary, ", ");\n left: 34px;\n margin: 0px 8px;\n width:75%;\n }\n "]); - _templateObject$6 = function _templateObject() { + _templateObject$8 = function _templateObject() { return data; }; @@ -50225,7 +52570,7 @@ var super_styles = _get(_getPrototypeOf(GscapeExplorer), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$6(), colors.primary, colors.attribute, colors.attribute_dark, colors.attribute_dark, colors.role, colors.role_dark, colors.role_dark, colors.concept, colors.concept_dark, colors.concept_dark, colors.individual, colors.individual_dark, colors.individual_dark, colors.primary_dark, colors.shadows, colors.primary, colors.shadows, colors.secondary)]; + return [super_styles[0], css(_templateObject$8(), colors.primary, colors.attribute, colors.attribute_dark, colors.attribute_dark, colors.role, colors.role_dark, colors.role_dark, colors.concept, colors.concept_dark, colors.concept_dark, colors.individual, colors.individual_dark, colors.individual_dark, colors.primary_dark, colors.shadows, colors.primary, colors.shadows, colors.secondary)]; } }]); @@ -50251,13 +52596,13 @@ function getTypeImg(type) { var letter = type.charAt(0).toUpperCase(); - return html$1(_templateObject2$4(), letter, letter); + return html$1(_templateObject2$5(), letter, letter); } - return html$1(_templateObject3$2(), this.search, Object.keys(this.predicates).map(function (key) { + return html$1(_templateObject3$3(), this.search, Object.keys(this.predicates).map(function (key) { var predicate = _this2.predicates[key]; - return html$1(_templateObject4$1(), predicate.subrows[0].id, predicate.type, predicate.label, _this2.toggleSubRows, getTypeImg(predicate.type), _this2.handleEntitySelection, predicate.label, predicate.subrows.map(function (predicate_instance) { - return html$1(_templateObject5$1(), predicate_instance.diagram.id, predicate_instance.id, _this2.handleNodeSelection, predicate_instance.diagram.name, predicate_instance.id_xml); + return html$1(_templateObject4$2(), predicate.subrows[0].id, predicate.type, predicate.label, _this2.toggleSubRows, getTypeImg(predicate.type), _this2.handleEntitySelection, predicate.label, predicate.subrows.map(function (predicate_instance) { + return html$1(_templateObject5$2(), predicate_instance.diagram.id, predicate_instance.id, _this2.handleNodeSelection, predicate_instance.diagram.name, predicate_instance.id_xml); })); })); } @@ -50393,98 +52738,98 @@ return data; } - function _templateObject5$2() { + function _templateObject5$3() { var data = _taggedTemplateLiteral(["", ""]); - _templateObject5$2 = function _templateObject5() { + _templateObject5$3 = function _templateObject5() { return data; }; return data; } - function _templateObject4$2() { + function _templateObject4$3() { var data = _taggedTemplateLiteral(["\n \n ", "\n ", "\n ", "\n \n "]); - _templateObject4$2 = function _templateObject4() { + _templateObject4$3 = function _templateObject4() { return data; }; return data; } - function _templateObject3$3() { + function _templateObject3$4() { var data = _taggedTemplateLiteral(["\n \n ", "\n \n "]); - _templateObject3$3 = function _templateObject3() { + _templateObject3$4 = function _templateObject3() { return data; }; return data; } - function _templateObject2$5() { + function _templateObject2$6() { var data = _taggedTemplateLiteral(["\n
\n
Annotations
\n \n ", "\n
\n
\n "]); - _templateObject2$5 = function _templateObject2() { + _templateObject2$6 = function _templateObject2() { return data; }; return data; } - function _templateObject$7() { + function _templateObject$9() { var data = _taggedTemplateLiteral(["\n ", "\n\n ", "\n "]); - _templateObject$7 = function _templateObject() { + _templateObject$9 = function _templateObject() { return data; }; return data; } var annotationsTemplate = (function (entity) { - return html$1(_templateObject$7(), entity.annotations && Object.keys(entity.annotations).length > 0 ? html$1(_templateObject2$5(), Object.keys(entity.annotations).map(function (kind) { + return html$1(_templateObject$9(), entity.annotations && Object.keys(entity.annotations).length > 0 ? html$1(_templateObject2$6(), Object.keys(entity.annotations).map(function (kind) { var annotation = entity.annotations[kind]; - return html$1(_templateObject3$3(), Object.keys(annotation).map(function (language, count) { - return html$1(_templateObject4$2(), count == 0 ? html$1(_templateObject5$2(), kind.charAt(0).toUpperCase() + kind.slice(1)) : '', language, annotation[language]); + return html$1(_templateObject3$4(), Object.keys(annotation).map(function (language, count) { + return html$1(_templateObject4$3(), count == 0 ? html$1(_templateObject5$3(), kind.charAt(0).toUpperCase() + kind.slice(1)) : '', language, annotation[language]); })); })) : '', entity.description && Object.keys(entity.description).length > 0 ? html$1(_templateObject6$1(), Object.keys(entity.description).map(function (language) { return html$1(_templateObject7$1(), language, language != '' ? html$1(_templateObject8$1(), language) : ''); })) : html$1(_templateObject9$1())); }); - function _templateObject3$4() { + function _templateObject3$5() { var data = _taggedTemplateLiteral(["\n \n ", "\n ", "\n \n "]); - _templateObject3$4 = function _templateObject3() { + _templateObject3$5 = function _templateObject3() { return data; }; return data; } - function _templateObject2$6() { + function _templateObject2$7() { var data = _taggedTemplateLiteral(["\n \n \n ", "\n \n
\n "]); - _templateObject2$6 = function _templateObject2() { + _templateObject2$7 = function _templateObject2() { return data; }; return data; } - function _templateObject$8() { + function _templateObject$a() { var data = _taggedTemplateLiteral(["", ""]); - _templateObject$8 = function _templateObject() { + _templateObject$a = function _templateObject() { return data; }; return data; } var entityOccurrencesTemplate = (function (occurrences, onNodeNavigation) { - return html$1(_templateObject$8(), occurrences && occurrences.length > 0 ? html$1(_templateObject2$6(), occurrences.map(function (occurrence) { - return html$1(_templateObject3$4(), occurrence.diagram_name, occurrence.id, onNodeNavigation, occurrence.id_xml); + return html$1(_templateObject$a(), occurrences && occurrences.length > 0 ? html$1(_templateObject2$7(), occurrences.map(function (occurrence) { + return html$1(_templateObject3$5(), occurrence.diagram_name, occurrence.id, onNodeNavigation, occurrence.id_xml); })) : ''); }); @@ -50518,50 +52863,50 @@ return data; } - function _templateObject5$3() { + function _templateObject5$4() { var data = _taggedTemplateLiteral([""]); - _templateObject5$3 = function _templateObject5() { + _templateObject5$4 = function _templateObject5() { return data; }; return data; } - function _templateObject4$3() { + function _templateObject4$4() { var data = _taggedTemplateLiteral(["\n \n IRI\n ", "\n \n "]); - _templateObject4$3 = function _templateObject4() { + _templateObject4$4 = function _templateObject4() { return data; }; return data; } - function _templateObject3$5() { + function _templateObject3$6() { var data = _taggedTemplateLiteral(["\n
\n \n \n \n \n \n \n \n \n \n ", "\n
Name", "
Type", "
\n
\n\n
\n ", "\n
\n\n ", "\n "]); - _templateObject3$5 = function _templateObject3() { + _templateObject3$6 = function _templateObject3() { return data; }; return data; } - function _templateObject2$7() { - var data = _taggedTemplateLiteral(["\n \n
\n ", "\n
\n "]); + function _templateObject2$8() { + var data = _taggedTemplateLiteral(["\n \n
\n ", "\n
\n "]); - _templateObject2$7 = function _templateObject2() { + _templateObject2$8 = function _templateObject2() { return data; }; return data; } - function _templateObject$9() { + function _templateObject$b() { var data = _taggedTemplateLiteral(["\n :host {\n top:10px;\n right:62px;\n width:400px;\n }\n\n .chips-wrapper {\n padding: 0 10px;\n }\n\n .descr-header {\n text-align: center;\n padding: 12px;\n font-weight: bold;\n border-bottom: solid 1px var(--theme-gscape-shadows, ", ");\n color: var(--theme-gscape-secondary, ", ");\n width: 85%;\n margin: auto;\n }\n\n gscape-head {\n --title-text-align: center;\n --title-width: 100%;\n }\n\n .chip {\n display: inline-block;\n margin: 4px;\n padding: 3px 8px;\n border-radius: 32px;\n border: 1px solid var(--theme-gscape-secondary, ", ");\n color: var(--theme-gscape-secondary, ", ");\n font-size: 13px;\n }\n\n .language {\n text-align: center;\n font-size: 14px;\n }\n\n tbody:nth-child(n+2)::before {\n content: '';\n display: table-row;\n height: 20px;\n }\n "]); - _templateObject$9 = function _templateObject() { + _templateObject$b = function _templateObject() { return data; }; @@ -50588,7 +52933,7 @@ var super_styles = _get(_getPrototypeOf(GscapeEntityDetails), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$9(), colors.shadows, colors.secondary, colors.secondary, colors.secondary)]; + return [super_styles[0], css(_templateObject$b(), colors.shadows, colors.secondary, colors.secondary, colors.secondary)]; } }]); @@ -50620,7 +52965,7 @@ value: function render() { var _this2 = this; - return html$1(_templateObject2$7(), this.entity ? html$1(_templateObject3$5(), this.wikiClickHandler, this.entity.iri.remaining_chars, this.entity.type, this.entity.type != 'individual' ? html$1(_templateObject4$3(), this.entity.iri.full_iri) : html$1(_templateObject5$3()), Object.keys(this.properties).map(function (property) { + return html$1(_templateObject2$8(), this.entity ? html$1(_templateObject3$6(), this.wikiClickHandler, this.entity.iri.remaining_chars, this.entity.type, this.entity.type != 'individual' ? html$1(_templateObject4$4(), this.entity.iri.full_iri) : html$1(_templateObject5$4()), Object.keys(this.properties).map(function (property) { return _this2.entity[property] ? html$1(_templateObject6$2(), _this2.properties[property]) : html$1(_templateObject7$2()); }), annotationsTemplate(this.entity)) : html$1(_templateObject8$2())); } @@ -50711,20 +53056,108 @@ }(GscapeWidget); customElements.define('gscape-entity-details', GscapeEntityDetails); - function _templateObject2$8() { - var data = _taggedTemplateLiteral(["\n \n\n ", "\n
\n "]); + function _templateObject$c() { + var data = _taggedTemplateLiteral([":host{font-family:var(--mdc-icon-font, \"Material Icons\");font-weight:normal;font-style:normal;font-size:var(--mdc-icon-size, 24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-feature-settings:\"liga\";-webkit-font-smoothing:antialiased}"]); - _templateObject2$8 = function _templateObject2() { + _templateObject$c = function _templateObject() { return data; }; return data; } + var style$2 = css(_templateObject$c()); - function _templateObject$a() { - var data = _taggedTemplateLiteral(["\n\n mwc-icon {\n font-size: var(--gscape-button-font-size, 24px)\n }\n\n .btn {\n padding:5px;\n line-height:0;\n cursor: pointer;\n }\n\n .btn:hover {\n color: var(--theme-gscape-secondary, ", ");\n }\n\n .btn[active] {\n color: var(--theme-gscape-secondary, ", ");\n }\n "]); + /** + @license + Copyright 2018 Google Inc. All Rights Reserved. - _templateObject$a = function _templateObject() { + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + // load material icons font + + var fontEl = document.createElement('link'); + fontEl.rel = 'stylesheet'; + fontEl.href = 'https://fonts.googleapis.com/icon?family=Material+Icons'; + document.head.appendChild(fontEl); + + function _templateObject$d() { + var data = _taggedTemplateLiteral([""]); + + _templateObject$d = function _templateObject() { + return data; + }; + + return data; + } + + var __decorate$2 = undefined && undefined.__decorate || function (decorators, target, key, desc) { + var c = arguments.length, + r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, + d; + if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) { + if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + } + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + var Icon = /*#__PURE__*/function (_LitElement) { + _inherits(Icon, _LitElement); + + var _super = _createSuper(Icon); + + function Icon() { + _classCallCheck(this, Icon); + + return _super.apply(this, arguments); + } + + _createClass(Icon, [{ + key: "render", + value: function render() { + return html$1(_templateObject$d()); + } + }]); + + return Icon; + }(LitElement); + + Icon.styles = style$2; + Icon = __decorate$2([customElement('mwc-icon')], Icon); + + function _templateObject3$7() { + var data = _taggedTemplateLiteral(["", ""]); + + _templateObject3$7 = function _templateObject3() { + return data; + }; + + return data; + } + + function _templateObject2$9() { + var data = _taggedTemplateLiteral(["\n \n\n ", "\n ", "\n
\n "]); + + _templateObject2$9 = function _templateObject2() { + return data; + }; + + return data; + } + + function _templateObject$e() { + var data = _taggedTemplateLiteral(["\n\n mwc-icon {\n font-size: var(--gscape-button-font-size, 24px)\n }\n\n .btn {\n padding:5px;\n line-height:0;\n cursor: pointer;\n display: flex;\n align-items: center;\n }\n\n .btn-label {\n font-weight: var(--gscape-button-font-weight, 600);\n padding: 0 5px 0 8px;\n }\n\n .btn:hover {\n color: var(--theme-gscape-secondary, ", ");\n }\n\n .btn[active] {\n color: var(--theme-gscape-secondary, ", ");\n }\n "]); + + _templateObject$e = function _templateObject() { return data; }; @@ -50745,6 +53178,9 @@ }, active: { type: Boolean + }, + label: { + type: String } }; } @@ -50754,7 +53190,7 @@ var super_styles = _get(_getPrototypeOf(GscapeButton), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$a(), colors.secondary, colors.secondary)]; + return [super_styles[0], css(_templateObject$e(), colors.secondary, colors.secondary)]; } }]); @@ -50769,16 +53205,19 @@ _this.draggable = draggable; _this.icon = icon; _this.alternate_icon = alt_icon || icon; - _this.onClick = null; + + _this.onClick = function () {}; + _this.highlight = false; _this.active = false; + _this.label = ''; return _this; } _createClass(GscapeButton, [{ key: "render", value: function render() { - return html$1(_templateObject2$8(), this.active, this.clickHandler, this.icon, this.icon); + return html$1(_templateObject2$9(), this.active, this.clickHandler, this.icon, this.icon, this.label ? html$1(_templateObject3$7(), this.label) : ""); } }, { key: "clickHandler", @@ -50832,50 +53271,50 @@ }(GscapeWidget); customElements.define('gscape-button', GscapeButton); - function _templateObject5$4() { + function _templateObject5$5() { var data = _taggedTemplateLiteral(["", ""]); - _templateObject5$4 = function _templateObject5() { + _templateObject5$5 = function _templateObject5() { return data; }; return data; } - function _templateObject4$4() { + function _templateObject4$5() { var data = _taggedTemplateLiteral([""]); - _templateObject4$4 = function _templateObject4() { + _templateObject4$5 = function _templateObject4() { return data; }; return data; } - function _templateObject3$6() { + function _templateObject3$8() { var data = _taggedTemplateLiteral([""]); - _templateObject3$6 = function _templateObject3() { + _templateObject3$8 = function _templateObject3() { return data; }; return data; } - function _templateObject2$9() { + function _templateObject2$a() { var data = _taggedTemplateLiteral(["\n
\n ", "\n \n ", "\n
\n "]); - _templateObject2$9 = function _templateObject2() { + _templateObject2$a = function _templateObject2() { return data; }; return data; } - function _templateObject$b() { + function _templateObject$f() { var data = _taggedTemplateLiteral(["\n :host {\n display: flex;\n }\n\n .toggle-container {\n white-space: nowrap;\n display: flex;\n align-items: center;\n }\n\n .toggle-wrap {\n width: 33px;\n height: 19px;\n display: inline-block;\n position: relative;\n }\n\n .toggle {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: #ccc;\n transition: checked 0.2s;\n border-radius: 19px;\n }\n\n .toggle::before {\n position: absolute;\n content: \"\";\n height: 11px;\n width: 11px;\n left: 4px;\n bottom: 4px;\n background-color: var(--theme-gscape-primary, ", ");\n transition: .1s;\n border-radius: 20px;\n }\n\n .toggle-wrap input {\n display:none;\n }\n\n .toggle-wrap input:checked + .toggle {\n background-color: var(--theme-gscape-secondary, ", ");\n }\n\n .toggle-wrap input:checked + .toggle::before {\n -webkit-transform: translateX(14px);\n -ms-transform: translateX(14px);\n transform: translateX(14px);\n }\n\n .toggle-wrap input:disabled + .toggle {\n opacity:0.25;\n }\n\n .toggle-label {\n margin: 0 15px;\n }\n "]); - _templateObject$b = function _templateObject() { + _templateObject$f = function _templateObject() { return data; }; @@ -50914,7 +53353,7 @@ var super_styles = _get(_getPrototypeOf(GscapeToggle), "styles", this); var colors = super_styles[1]; - return css(_templateObject$b(), colors.primary, colors.secondary); + return css(_templateObject$f(), colors.primary, colors.secondary); } }]); @@ -50940,7 +53379,7 @@ _createClass(GscapeToggle, [{ key: "render", value: function render() { - return html$1(_templateObject2$9(), this.label_pos == 'left' ? this.label_span : html$1(_templateObject3$6()), this.key, this.checked, this.disabled, this.clickHandler, this.label_pos == 'right' ? this.label_span : html$1(_templateObject4$4())); + return html$1(_templateObject2$a(), this.label_pos == 'left' ? this.label_span : html$1(_templateObject3$8()), this.key, this.checked, this.disabled, this.clickHandler, this.label_pos == 'right' ? this.label_span : html$1(_templateObject4$5())); } }, { key: "clickHandler", @@ -50968,7 +53407,7 @@ }, { key: "label_span", get: function get() { - return html$1(_templateObject5$4(), this.label); + return html$1(_templateObject5$5(), this.label); } }]); @@ -50976,30 +53415,30 @@ }(GscapeWidget); customElements.define('gscape-toggle', GscapeToggle); - function _templateObject3$7() { + function _templateObject3$9() { var data = _taggedTemplateLiteral(["\n ", "\n "]); - _templateObject3$7 = function _templateObject3() { + _templateObject3$9 = function _templateObject3() { return data; }; return data; } - function _templateObject2$a() { + function _templateObject2$b() { var data = _taggedTemplateLiteral(["\n ", "\n\n
\n
Filters
\n\n
\n ", "\n
\n
\n "]); - _templateObject2$a = function _templateObject2() { + _templateObject2$b = function _templateObject2() { return data; }; return data; } - function _templateObject$c() { - var data = _taggedTemplateLiteral(["\n :host {\n bottom:10px;\n left:10px;\n }\n\n gscape-button{\n position: static;\n }\n\n gscape-toggle {\n padding: 8px;\n }\n\n gscape-toggle[first]{\n justify-content: center;\n border-bottom: 1px solid #ccc;\n margin-bottom: 10px;\n padding: 10px;\n }\n "]); + function _templateObject$g() { + var data = _taggedTemplateLiteral(["\n :host {\n display:inline-block;\n position: initial;\n margin-right:10px;\n }\n\n gscape-button{\n position: static;\n }\n\n gscape-toggle {\n padding: 8px;\n }\n\n gscape-toggle[first]{\n justify-content: center;\n border-bottom: 1px solid #ccc;\n margin-bottom: 10px;\n padding: 10px;\n }\n "]); - _templateObject$c = function _templateObject() { + _templateObject$g = function _templateObject() { return data; }; @@ -51033,7 +53472,7 @@ var super_styles = _get(_getPrototypeOf(GscapeFilters), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$c())]; + return [super_styles[0], css(_templateObject$g())]; } }]); @@ -51061,7 +53500,7 @@ value: function render() { var _this2 = this; - return html$1(_templateObject2$a(), this.btn, Object.keys(this.filters).map(function (key) { + return html$1(_templateObject2$b(), this.btn, Object.keys(this.filters).map(function (key) { var filter = _this2.filters[key]; var toggle = {}; /** @@ -51081,7 +53520,7 @@ } toggle.label_pos = 'right'; - return html$1(_templateObject3$7(), toggle); + return html$1(_templateObject3$9(), toggle); })); } }, { @@ -51105,36 +53544,41 @@ this.btn.active = is_activated; this.btn.requestUpdate(); } + }, { + key: "show", + value: function show() { + if (this.isEnabled) this.style.display = 'inline-block'; + } }]); return GscapeFilters; }(GscapeWidget); customElements.define('gscape-filters', GscapeFilters); - function _templateObject3$8() { + function _templateObject3$a() { var data = _taggedTemplateLiteral(["\n \n ", "\n ", "\n \n "]); - _templateObject3$8 = function _templateObject3() { + _templateObject3$a = function _templateObject3() { return data; }; return data; } - function _templateObject2$b() { + function _templateObject2$c() { var data = _taggedTemplateLiteral(["\n ", "\n\n
\n
Ontology Info
\n\n
\n\n
\n \n \n \n \n \n \n \n \n \n
Name", "
Version", "
\n
\n\n ", "\n\n
\n
IRI Prefixes Dictionary
\n \n ", "\n
\n
\n
\n
\n "]); - _templateObject2$b = function _templateObject2() { + _templateObject2$c = function _templateObject2() { return data; }; return data; } - function _templateObject$d() { - var data = _taggedTemplateLiteral(["\n :host {\n bottom:10px;\n left:52px;\n }\n\n .gscape-panel {\n padding-right: 0;\n }\n\n gscape-button {\n position: static;\n }\n\n .iri-dict th.table-header{\n text-align: center;\n padding: 12px;\n font-weight: bold;\n border-right: 0;\n color: var(--theme-gscape-on-primary, ", ");\n }\n\n .iri-dict th {\n color: var(--theme-gscape-on-primary, ", ");\n border-right: solid 1px var(--theme-gscape-shadows, ", ");\n text-align: left;\n font-weight: normal;\n }\n\n .wrapper {\n overflow-y: auto;\n scrollbar-width: inherit;\n max-height: 420px;\n overflow-x: hidden;\n padding-right: 10px;\n }\n\n .section {\n padding-left: 0;\n padding-right: 0;\n }\n "]); + function _templateObject$h() { + var data = _taggedTemplateLiteral(["\n :host {\n display:inline-block;\n position: initial;\n margin-right:10px;\n }\n\n .gscape-panel {\n padding-right: 0;\n }\n\n gscape-button {\n position: static;\n }\n\n .iri-dict th.table-header{\n text-align: center;\n padding: 12px;\n font-weight: bold;\n border-right: 0;\n color: var(--theme-gscape-on-primary, ", ");\n }\n\n .iri-dict th {\n color: var(--theme-gscape-on-primary, ", ");\n border-right: solid 1px var(--theme-gscape-shadows, ", ");\n text-align: left;\n font-weight: normal;\n }\n\n .wrapper {\n overflow-y: auto;\n scrollbar-width: inherit;\n max-height: 420px;\n overflow-x: hidden;\n padding-right: 10px;\n }\n\n .section {\n padding-left: 0;\n padding-right: 0;\n }\n "]); - _templateObject$d = function _templateObject() { + _templateObject$h = function _templateObject() { return data; }; @@ -51152,7 +53596,7 @@ var super_styles = _get(_getPrototypeOf(GscapeOntologyInfo), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$d(), colors.on_primary, colors.on_primary, colors.shadows)]; + return [super_styles[0], css(_templateObject$h(), colors.on_primary, colors.on_primary, colors.shadows)]; } }]); @@ -51172,9 +53616,9 @@ _createClass(GscapeOntologyInfo, [{ key: "render", value: function render() { - return html$1(_templateObject2$b(), this.btn, this.ontology.name, this.ontology.version, annotationsTemplate(this.ontology), _toConsumableArray(this.ontology.namespaces).map(function (iri) { + return html$1(_templateObject2$c(), this.btn, this.ontology.name, this.ontology.version, annotationsTemplate(this.ontology), _toConsumableArray(this.ontology.namespaces).map(function (iri) { if (!iri.isStandard()) { - return html$1(_templateObject3$8(), iri.prefixes[0], iri.value); + return html$1(_templateObject3$a(), iri.prefixes[0], iri.value); } })); } @@ -51198,26 +53642,42 @@ }); } } + }, { + key: "show", + value: function show() { + if (this.isEnabled) this.style.display = 'inline-block'; + } }]); return GscapeOntologyInfo; }(GscapeWidget); customElements.define('gscape-ontology-info', GscapeOntologyInfo); - function _templateObject2$c() { - var data = _taggedTemplateLiteral(["\n
\n
\n
\n \n "]); + function _templateObject$i() { + var data = _taggedTemplateLiteral([""]); - _templateObject2$c = function _templateObject2() { + _templateObject$i = function _templateObject() { return data; }; return data; } + var owl_icon = html$1(_templateObject$i()); - function _templateObject$e() { - var data = _taggedTemplateLiteral(["\n :host {\n left:50%;\n bottom:10px;\n transform: translate(-50%, 0);\n }\n\n gscape-head {\n --title-text-align: center;\n --title-width: 100%;\n }\n\n .widget-body {\n margin:0;\n border-top: none;\n border-bottom: 1px solid var(--theme-gscape-shadows, ", ");\n border-bottom-left-radius:0;\n border-bottom-right-radius:0;\n }\n\n .owl-text {\n padding: 15px 10px;\n font-family: \"Lucida Console\", Monaco, monospace;\n overflow: auto;\n white-space: nowrap;\n line-height: 1.5;\n }\n\n .owl_concept{\n color: #b58900;\n }\n\n .owl_role{\n color: #268bd2;\n }\n\n .owl_attribute{\n color: #859900;\n }\n\n .owl_value-domain{\n color: #2aa198;\n }\n\n .owl_individual{\n color: #6c71c4;\n }\n\n .owl_value {\n color: #d33682;\n }\n\n .axiom_predicate_prefix{\n color:#cb4b16;\n }\n\n .owl_error {\n color: var(--theme-gscape-error, ", ");\n }\n\n .axiom_predefinite_obj {\n color: #00c0a0;\n }\n\n "]); + function _templateObject2$d() { + var data = _taggedTemplateLiteral(["\n
\n
\n
\n ", "\n "]); - _templateObject$e = function _templateObject() { + _templateObject2$d = function _templateObject2() { + return data; + }; + + return data; + } + + function _templateObject$j() { + var data = _taggedTemplateLiteral(["\n :host {\n left:50%;\n bottom:10px;\n transform: translate(-50%, 0);\n max-width:60%;\n }\n\n gscape-head {\n --title-text-align: center;\n --title-width: 100%;\n }\n\n .widget-body {\n margin:0;\n border-top: none;\n border-bottom: 1px solid var(--theme-gscape-shadows, ", ");\n border-bottom-left-radius:0;\n border-bottom-right-radius:0;\n }\n\n .owl-text {\n padding: 15px 10px;\n font-family: \"Lucida Console\", Monaco, monospace;\n overflow: auto;\n white-space: nowrap;\n line-height: 1.5;\n }\n\n .owl_concept{\n color: #b58900;\n }\n\n .owl_role{\n color: #268bd2;\n }\n\n .owl_attribute{\n color: #859900;\n }\n\n .owl_value-domain{\n color: #2aa198;\n }\n\n .owl_individual{\n color: #6c71c4;\n }\n\n .owl_value {\n color: #d33682;\n }\n\n .axiom_predicate_prefix{\n color:#cb4b16;\n }\n\n .owl_error {\n color: var(--theme-gscape-error, ", ");\n }\n\n .axiom_predefinite_obj {\n color: #00c0a0;\n }\n\n "]); + + _templateObject$j = function _templateObject() { return data; }; @@ -51242,7 +53702,7 @@ var super_styles = _get(_getPrototypeOf(GscapeOwlTranslator), "styles", this); var colors = super_styles[1]; - return [_get(_getPrototypeOf(GscapeOwlTranslator), "styles", this)[0], css(_templateObject$e(), colors.shadows, colors.error)]; + return [_get(_getPrototypeOf(GscapeOwlTranslator), "styles", this)[0], css(_templateObject$j(), colors.shadows, colors.error)]; } }]); @@ -51255,13 +53715,16 @@ _this.collapsible = true; _this.hiddenDefault = true; _this.owl_text = ''; + _this.header = new GscapeHeader(); + _this.header.title = 'Owl Translation'; + _this.header.left_icon = owl_icon; return _this; } _createClass(GscapeOwlTranslator, [{ key: "render", value: function render() { - return html$1(_templateObject2$c()); + return html$1(_templateObject2$d(), this.header); } }, { key: "updated", @@ -51280,20 +53743,20 @@ }(GscapeWidget); customElements.define('gscape-owl-translator', GscapeOwlTranslator); - function _templateObject2$d() { + function _templateObject2$e() { var data = _taggedTemplateLiteral(["\n ", "\n
\n ", "\n "]); - _templateObject2$d = function _templateObject2() { + _templateObject2$e = function _templateObject2() { return data; }; return data; } - function _templateObject$f() { + function _templateObject$k() { var data = _taggedTemplateLiteral(["\n :host {\n position: absolute;\n bottom:52px;\n right:10px;\n }\n\n gscape-button{\n position: static;\n box-shadow: initial;\n }\n\n #hr {\n height:1px;\n width:90%;\n margin: 2px auto 0 auto;\n background-color: var(--theme-gscape-shadows, ", ")\n }\n\n "]); - _templateObject$f = function _templateObject() { + _templateObject$k = function _templateObject() { return data; }; @@ -51311,7 +53774,7 @@ var super_styles = _get(_getPrototypeOf(GscapeZoomTools), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$f(), colors.shadows)]; + return [super_styles[0], css(_templateObject$k(), colors.shadows)]; } }]); @@ -51331,7 +53794,7 @@ _createClass(GscapeZoomTools, [{ key: "render", value: function render() { - return html$1(_templateObject2$d(), this.btn_plus, this.btn_minus); + return html$1(_templateObject2$e(), this.btn_plus, this.btn_minus); } }, { key: "onZoomIn", @@ -51686,6 +54149,21 @@ _this.cy.container().style.cursor = 'inherit'; }); } + /** + * WHY NOT USING cy.mount(container)?? + * because it causes a problem with float renderer. + * In particular at the second time this.mount() will be + * called, the layout will stop working, something happens internally + * breaking the layout. + * + * WHY SWITCHING FROM display:none TO position:absolute?? + * display:none will cause the container having clientHeight(Width) = 0 + * and cytoscpae uses those values to perform the fit(). + * This will cause problems when switching renderers cause in some + * cases fit() will be automatically called on the container having + * zero asdimensions + */ + _createClass(GrapholscapeRenderer, [{ key: "mount", @@ -51938,6 +54416,8 @@ _createClass(FloatingGscapeRenderer, [{ key: "drawDiagram", value: function drawDiagram(diagram) { + var _this2 = this; + this.clearPoppers(); _get(_getPrototypeOf(FloatingGscapeRenderer.prototype), "drawDiagram", this).call(this, diagram); @@ -51946,11 +54426,20 @@ this.main_layout = this.layout(); // apply layout on those not locked this.main_layout.run(); + /** + * hack: let layout run a bit and fit to it. + * Prevent some diagrams to disappear from screen due to + * automatic layout. + */ + + setTimeout(function () { + return _this2.cy.fit(); + }, 100); } }, { key: "centerOnNode", value: function centerOnNode(node_id, zoom) { - var _this2 = this; + var _this3 = this; var node = this.cy.$id(node_id); @@ -51960,13 +54449,13 @@ if (node.data('type') == 'role') { var elems = node.connectedNodes(); setTimeout(function () { - return _this2.cy.fit(elems); + return _this3.cy.fit(elems); }, 300); node.select(); elems.select(); } else { setTimeout(function () { - return _this2.centerOnPosition(node.position('x'), node.position('y'), zoom); + return _this3.centerOnPosition(node.position('x'), node.position('y'), zoom); }, 300); node.select(); } @@ -51981,42 +54470,45 @@ }, { key: "unlockNode", value: function unlockNode(node) { - node.unlockButton.destroy(); + this.removeUnlockButton(node); node.unlock(); } }, { key: "lockNode", value: function lockNode(node) { - var _this3 = this; + var _this4 = this; node.lock(); var unlockButton = node.popper({ content: function content() { - var dimension = node.data('width') / 9 * _this3.cy.zoom(); + var dimension = node.data('width') / 9 * _this4.cy.zoom(); var div = document.createElement('div'); div.style.background = node.style('border-color'); div.style.borderRadius = '100%'; div.style.padding = '5px'; - div.style.color = _this3.theme.on_secondary; + div.style.color = _this4.theme.on_secondary; div.style.cursor = 'pointer'; div.setAttribute('title', 'Unlock Node'); div.innerHTML = "lock_open"; setStyle(dimension, div); div.onclick = function () { - return _this3.unlockNode(node); + return _this4.unlockNode(node); }; - document.body.appendChild(div); - return div; - } //popper: {} // my popper options here + _this4.cy.container().appendChild(div); + return div; + }, + popper: { + removeOnDestroy: true + } }); node.unlockButton = unlockButton; var update = function update() { - var dimension = node.data('width') / 9 * _this3.cy.zoom(); + var dimension = node.data('width') / 9 * _this4.cy.zoom(); setStyle(dimension, unlockButton.popper); unlockButton.scheduleUpdate(); @@ -52048,16 +54540,26 @@ }, { key: "clearPoppers", value: function clearPoppers() { + var _this5 = this; + this.cy.nodes().each(function (node) { - if (node.unlockButton) node.unlockButton.destroy(); + return _this5.removeUnlockButton(node); }); } }, { key: "unmount", value: function unmount() { - _get(_getPrototypeOf(FloatingGscapeRenderer.prototype), "unmount", this).call(this); - this.clearPoppers(); + + _get(_getPrototypeOf(FloatingGscapeRenderer.prototype), "unmount", this).call(this); + } + }, { + key: "removeUnlockButton", + value: function removeUnlockButton(node) { + if (node.unlockButton) { + node.unlockButton.destroy(); + node.unlockButton = null; + } } }, { key: "layout_settings", @@ -52093,11 +54595,11 @@ }, { key: "dragAndPin", set: function set(active) { - var _this4 = this; + var _this6 = this; this._dragAndPin = active; if (!active) this.cy.$(':locked').each(function (node) { - return _this4.unlockNode(node); + return _this6.unlockNode(node); }); }, get: function get() { @@ -52108,51 +54610,61 @@ return FloatingGscapeRenderer; }(GrapholscapeRenderer); - function _templateObject$g() { - var data = _taggedTemplateLiteral(["\n\n"]); + function _templateObject$l() { + var data = _taggedTemplateLiteral(["\n\n"]); - _templateObject$g = function _templateObject() { + _templateObject$l = function _templateObject() { return data; }; return data; } - var graphol = html$1(_templateObject$g()); + var graphol_logo = html$1(_templateObject$l()); - function _templateObject4$5() { - var data = _taggedTemplateLiteral(["", ""]); + function _templateObject5$6() { + var data = _taggedTemplateLiteral(["\n \n "]); - _templateObject4$5 = function _templateObject4() { + _templateObject5$6 = function _templateObject5() { return data; }; return data; } - function _templateObject3$9() { - var data = _taggedTemplateLiteral(["\n \n ", "\n ", "\n
\n "]); + function _templateObject4$6() { + var data = _taggedTemplateLiteral(["\n ", ""]); - _templateObject3$9 = function _templateObject3() { + _templateObject4$6 = function _templateObject4() { return data; }; return data; } - function _templateObject2$e() { - var data = _taggedTemplateLiteral(["\n
\n ", "\n
\n\n \n "]); + function _templateObject3$b() { + var data = _taggedTemplateLiteral(["\n \n ", "\n ", "\n \n "]); - _templateObject2$e = function _templateObject2() { + _templateObject3$b = function _templateObject3() { return data; }; return data; } - function _templateObject$h() { - var data = _taggedTemplateLiteral(["\n :host {\n bottom:10px;\n left: 136px;\n }\n\n .renderer-item {\n cursor:pointer;\n padding:5px 10px;\n display: flex;\n align-items: center;\n }\n\n .renderer-item:hover {\n color: var(--theme-gscape-on-secondary, ", ");\n background-color:var(--theme-gscape-secondary, ", ");\n }\n\n .renderer-item:first-of-type {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n .selected {\n background-color: var(--theme-gscape-primary-dark, ", ");\n color: var(--theme-gscape-on-primary-dark, ", ");\n font-weight: bold;\n }\n\n .widget-body {\n margin:0;\n border-top: none;\n border-bottom: 1px solid var(--theme-gscape-shadows, ", ");\n border-radius: inherit;\n border-bottom-left-radius:0;\n border-bottom-right-radius:0;\n }\n\n gscape-head {\n --header-padding: 5px 8px;\n }\n\n mwc-icon {\n padding-right:8px;\n }\n\n svg {\n height: 20px;\n width: auto;\n padding: 2px;\n margin-right:8px;\n }\n "]); + function _templateObject2$f() { + var data = _taggedTemplateLiteral(["\n
\n ", "\n
\n\n ", "\n "]); - _templateObject$h = function _templateObject() { + _templateObject2$f = function _templateObject2() { + return data; + }; + + return data; + } + + function _templateObject$m() { + var data = _taggedTemplateLiteral(["\n :host {\n display:inline-block;\n position:initial;\n margin-right:10px;\n }\n\n .renderer-item {\n cursor:pointer;\n padding:5px 10px;\n display: flex;\n align-items: center;\n }\n\n .renderer-item:hover {\n color: var(--theme-gscape-on-secondary, ", ");\n background-color:var(--theme-gscape-secondary, ", ");\n }\n\n .renderer-item:first-of-type {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n .renderer-item > .name {\n padding:0 10px;\n }\n\n .selected {\n background-color: var(--theme-gscape-primary-dark, ", ");\n color: var(--theme-gscape-on-primary-dark, ", ");\n font-weight: bold;\n }\n\n .widget-body {\n margin:0;\n border-top: none;\n border-bottom: 1px solid var(--theme-gscape-shadows, ", ");\n border-radius: inherit;\n border-bottom-left-radius:0;\n border-bottom-right-radius:0;\n }\n\n gscape-head {\n --header-padding: 5px 8px;\n }\n\n svg {\n margin-right:8px;\n }\n "]); + + _templateObject$m = function _templateObject() { return data; }; @@ -52179,7 +54691,7 @@ var super_styles = _get(_getPrototypeOf(GscapeRenderSelector), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$h(), colors.on_secondary, colors.secondary, colors.primary_dark, colors.on_primary_dark, colors.shadows)]; + return [super_styles[0], css(_templateObject$m(), colors.on_secondary, colors.secondary, colors.primary_dark, colors.on_primary_dark, colors.shadows)]; } }]); @@ -52194,7 +54706,7 @@ _this.dict = { "default": { name: "Graphol", - icon: "" + icon: graphol_logo }, lite: { name: "Graphol-Lite", @@ -52207,6 +54719,9 @@ }; _this.actual_mode = 'default'; _this._onRendererChange = {}; + _this.header = new GscapeHeader(); + _this.header.title = _this.dict[_this.actual_mode].name; + _this.header.left_icon = _this.dict[_this.actual_mode].icon; return _this; } @@ -52215,9 +54730,9 @@ value: function render() { var _this2 = this; - return html$1(_templateObject2$e(), Object.keys(this.renderers).map(function (mode) { - return html$1(_templateObject3$9(), _this2.changeRenderer, mode, mode == _this2.actual_mode ? "selected" : "", mode == 'default' ? graphol : html$1(_templateObject4$5(), _this2.dict[mode].icon), _this2.dict[mode].name); - }), this.dict[this.actual_mode].name); + return html$1(_templateObject2$f(), Object.keys(this.renderers).map(function (mode) { + return html$1(_templateObject3$b(), _this2.changeRenderer, mode, mode == _this2.actual_mode ? "selected" : "", _this2.isCustomIcon(_this2.dict[mode].icon) ? html$1(_templateObject4$6(), _this2.dict[mode].icon) : html$1(_templateObject5$6(), _this2.dict[mode].icon), _this2.dict[mode].name); + }), this.header); } }, { key: "changeRenderer", @@ -52227,6 +54742,7 @@ target.classList.add('selected'); var mode = target.getAttribute('mode'); this.header.title = this.dict[mode].name; + this.header.left_icon = this.dict[mode].icon; this.actual_mode = mode; this._onRendererChange(mode); @@ -52239,6 +54755,11 @@ this.header.invertIcons(); } + }, { + key: "show", + value: function show() { + if (this.isEnabled) this.style.display = 'inline-block'; + } }, { key: "onRendererChange", set: function set(f) { @@ -52250,20 +54771,20 @@ }(GscapeWidget); customElements.define('gscape-render-selection', GscapeRenderSelector); - function _templateObject2$f() { + function _templateObject2$g() { var data = _taggedTemplateLiteral(["\n \n\n
\n Layout Settings\n \n ", "\n ", "\n \n
\n\n "]); - _templateObject2$f = function _templateObject2() { + _templateObject2$g = function _templateObject2() { return data; }; return data; } - function _templateObject$i() { + function _templateObject$n() { var data = _taggedTemplateLiteral(["\n :host {\n left: 50%;\n bottom: 10px;\n transform: translate(-50%, 0);\n }\n\n gscape-head span {\n display: flex;\n }\n\n .widget-body {\n margin:0;\n border-top: none;\n border-bottom: 1px solid var(--theme-gscape-shadows, ", ");\n border-radius: inherit;\n border-bottom-left-radius:0;\n border-bottom-right-radius:0;\n }\n\n gscape-head {\n --header-padding: 5px 8px;\n --title-padding: 0 30px 0 0;\n --btn-padding: 0 0 0 10px;\n }\n\n gscape-toggle {\n margin-left: 50px;\n }\n\n .wrapper {\n display:flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px;\n }\n\n .title {\n padding: 0 5px 0 0;\n font-weight:bold;\n }\n\n .toggles-wrapper {\n display: flex;\n }\n "]); - _templateObject$i = function _templateObject() { + _templateObject$n = function _templateObject() { return data; }; @@ -52286,7 +54807,7 @@ var super_styles = _get(_getPrototypeOf(GscapeLayoutSettings), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$i(), colors.shadows)]; + return [super_styles[0], css(_templateObject$n(), colors.shadows)]; } }]); @@ -52305,7 +54826,7 @@ _createClass(GscapeLayoutSettings, [{ key: "render", value: function render() { - return html$1(_templateObject2$f(), new GscapeToggle('layout-run', true, false, 'Layout Running', this.onLayoutRunToggle), new GscapeToggle('layout-pin', false, false, 'Drag and Pin', this.onDragAndPinToggle), new GscapeToggle('layout-run', true, false, 'Layout Running', this.onLayoutRunToggle), new GscapeToggle('layout-pin', false, false, 'Drag and Pin', this.onDragAndPinToggle)); + return html$1(_templateObject2$g(), new GscapeToggle('layout-run', true, false, 'Layout Running', this.onLayoutRunToggle), new GscapeToggle('layout-pin', false, false, 'Drag and Pin', this.onDragAndPinToggle), new GscapeToggle('layout-run', true, false, 'Layout Running', this.onLayoutRunToggle), new GscapeToggle('layout-pin', false, false, 'Drag and Pin', this.onDragAndPinToggle)); } }]); @@ -52313,16 +54834,16 @@ }(GscapeWidget); customElements.define('gscape-layout-settings', GscapeLayoutSettings); - function _templateObject$j() { + function _templateObject$o() { var data = _taggedTemplateLiteral(["\n\n\n\n\t\n\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\n"]); - _templateObject$j = function _templateObject() { + _templateObject$o = function _templateObject() { return data; }; return data; } - var grapholscape = html$1(_templateObject$j()); + var grapholscape = html$1(_templateObject$o()); function _templateObject10$1() { var data = _taggedTemplateLiteral([""]); @@ -52374,50 +54895,50 @@ return data; } - function _templateObject5$5() { + function _templateObject5$7() { var data = _taggedTemplateLiteral(["\n
\n
\n
", "
\n
", "
\n
\n ", "\n\n ", "\n
\n "]); - _templateObject5$5 = function _templateObject5() { + _templateObject5$7 = function _templateObject5() { return data; }; return data; } - function _templateObject4$6() { + function _templateObject4$7() { var data = _taggedTemplateLiteral(["\n
\n
", "
\n\n ", "\n
\n "]); - _templateObject4$6 = function _templateObject4() { + _templateObject4$7 = function _templateObject4() { return data; }; return data; } - function _templateObject3$a() { + function _templateObject3$c() { var data = _taggedTemplateLiteral([""]); - _templateObject3$a = function _templateObject3() { + _templateObject3$c = function _templateObject3() { return data; }; return data; } - function _templateObject2$g() { - var data = _taggedTemplateLiteral(["\n ", "\n\n
\n
Settings
\n\n
\n\n ", "\n\n
\n
About
\n
\n ", "\n
\n\n
\n Version: \n ", "\n
\n
\n
\n "]); + function _templateObject2$h() { + var data = _taggedTemplateLiteral(["\n ", "\n\n
\n
Settings
\n\n
\n\n ", "\n\n
\n
Export Ontology Image
\n
\n
\n
Image
\n
Save a PNG image of the current diagram on your disk
\n
\n\n
\n ", "\n
\n
\n\n
\n
\n
Vectorial
\n
Save an SVG of the current diagram on your disk
\n
\n\n
\n ", "\n
\n
\n
\n\n
\n
About
\n
\n ", "\n
\n\n
\n Version: \n ", "\n
\n
\n
\n "]); - _templateObject2$g = function _templateObject2() { + _templateObject2$h = function _templateObject2() { return data; }; return data; } - function _templateObject$k() { - var data = _taggedTemplateLiteral(["\n :host {\n bottom:10px;\n left: 94px;\n padding-right:0;\n }\n\n gscape-button {\n position: static;\n }\n\n .gscape-panel {\n padding-right: 0;\n }\n\n .settings-wrapper {\n overflow-y: auto;\n scrollbar-width: inherit;\n max-height: 420px;\n overflow-x: hidden;\n white-space: nowrap;\n padding-right: 20px;\n }\n\n .area {\n margin-bottom: 30px;\n }\n\n .area:last-of-type {\n margin-bottom: 0;\n }\n\n .area-title {\n font-weight: bold;\n margin-bottom: 5px;\n font-size: 105%;\n }\n\n .setting {\n padding: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .title-wrap {\n margin-right: 50px;\n }\n\n .setting-label {\n font-size : 12px;\n opacity: 0.7;\n }\n\n #logo {\n text-align:center;\n }\n\n #logo svg {\n width: 40%;\n height: auto;\n margin: 20px 0;\n }\n\n #version {\n text-align: center;\n font-size: 14px;\n }\n "]); + function _templateObject$p() { + var data = _taggedTemplateLiteral(["\n :host {\n display:inline-block;\n position: initial;\n margin-right:10px;\n }\n\n gscape-button {\n position: static;\n }\n\n .gscape-panel {\n padding-right: 0;\n }\n\n .settings-wrapper {\n overflow-y: auto;\n scrollbar-width: inherit;\n max-height: 420px;\n overflow-x: hidden;\n white-space: nowrap;\n padding-right: 20px;\n }\n\n .area {\n margin-bottom: 30px;\n }\n\n .area:last-of-type {\n margin-bottom: 0;\n }\n\n .area-title {\n font-weight: bold;\n margin-bottom: 5px;\n font-size: 105%;\n }\n\n .setting {\n padding: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .title-wrap {\n margin-right: 50px;\n }\n\n .setting-label {\n font-size : 12px;\n opacity: 0.7;\n }\n\n #logo {\n text-align:center;\n }\n\n #logo svg {\n width: 40%;\n height: auto;\n margin: 20px 0;\n }\n\n #version {\n text-align: center;\n font-size: 14px;\n }\n "]); - _templateObject$k = function _templateObject() { + _templateObject$p = function _templateObject() { return data; }; @@ -52435,7 +54956,7 @@ var super_styles = _get(_getPrototypeOf(GscapeSettings), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$k())]; + return [super_styles[0], css(_templateObject$p())]; } }]); @@ -52450,6 +54971,10 @@ _this.btn = new GscapeButton('settings'); _this.btn.onClick = _this.toggleBody.bind(_assertThisInitialized(_this)); _this.callbacks = {}; + _this.savePNGButton = new GscapeButton('save'); + _this.savePNGButton.label = 'PNG'; + _this.saveSVGButton = new GscapeButton('save'); + _this.saveSVGButton.label = 'SVG'; return _this; } @@ -52458,23 +54983,52 @@ value: function render() { var _this2 = this; - return html$1(_templateObject2$g(), this.btn, Object.keys(this.settings).map(function (area_entry) { - if (area_entry == 'default') return html$1(_templateObject3$a()); + return html$1(_templateObject2$h(), this.btn, Object.keys(this.settings).map(function (area_entry) { + if (area_entry == 'default') return html$1(_templateObject3$c()); var area = _this2.settings[area_entry]; - return html$1(_templateObject4$6(), capitalizeFirstLetter(area_entry), Object.keys(area).map(function (setting_entry) { + return html$1(_templateObject4$7(), capitalizeFirstLetter(area_entry), Object.keys(area).map(function (setting_entry) { var setting = area[setting_entry]; - return html$1(_templateObject5$5(), setting.title, setting.label, setting.type == 'list' ? html$1(_templateObject6$3(), area_entry, setting_entry, _this2.onListChange, setting.list.map(function (option) { + return html$1(_templateObject5$7(), setting.title, setting.label, setting.type == 'list' ? html$1(_templateObject6$3(), area_entry, setting_entry, _this2.onListChange, setting.list.map(function (option) { if (option.value == '') return; var selected = option.value == setting.selected; return html$1(_templateObject7$3(), option.value, selected, option.label); })) : html$1(_templateObject8$3()), setting.type == 'boolean' ? html$1(_templateObject9$2(), new GscapeToggle(setting_entry, setting.enabled, false, '', _this2.onToggleChange.bind(_this2))) : html$1(_templateObject10$1())); })); - }), grapholscape, "1.1.0"); + }), this.savePNGButton, this.saveSVGButton, grapholscape, "1.2.0"); function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } } + }, { + key: "updated", + value: function updated(changedProperties) { + var _this3 = this; + + /** + * when controller change a property in this.settings, lit element doesn't see it + * (this.settings should be assigned to a completely new object (new reference) + * for lit element to notice it). + * So controller forces the update and in that case litElement will update even if + * no property has changed. + * So if it has been updated forcefully from controller, then react to each change + */ + if (changedProperties.size == 0) { + this.shadowRoot.querySelectorAll('select').forEach(function (list) { + _this3.onListChange({ + target: list + }); + }); + this.shadowRoot.querySelectorAll('gscape-toggle').forEach(function (toggle) { + // onToggleChange uses toggle.id because it gets the elem + toggle.id = toggle.key; + + _this3.onToggleChange({ + target: toggle + }); + }); + } + } }, { key: "onListChange", value: function onListChange(e) { @@ -52490,6 +55044,11 @@ this.settings.widgets[toggle.id].enabled = toggle.checked; toggle.checked ? this.callbacks.widgetEnable(toggle.id) : this.callbacks.widgetDisable(toggle.id); } + }, { + key: "show", + value: function show() { + if (this.isEnabled) this.style.display = 'inline-block'; + } }, { key: "onEntityNameSelection", set: function set(foo) { @@ -52515,26 +55074,36 @@ set: function set(foo) { this.callbacks.widgetDisable = foo; } + }, { + key: "onPNGSaveButtonClick", + set: function set(foo) { + this.savePNGButton.onClick = foo; + } + }, { + key: "onSVGSaveButtonClick", + set: function set(foo) { + this.saveSVGButton.onClick = foo; + } }]); return GscapeSettings; }(GscapeWidget); customElements.define('gscape-settings', GscapeSettings); - function _templateObject2$h() { + function _templateObject2$i() { var data = _taggedTemplateLiteral(["
"]); - _templateObject2$h = function _templateObject2() { + _templateObject2$i = function _templateObject2() { return data; }; return data; } - function _templateObject$l() { + function _templateObject$q() { var data = _taggedTemplateLiteral(["\n .loader {\n border: 3px solid ", ";\n border-radius: 50%;\n border-top: 3px solid ", ";\n width: 30px;\n height: 30px;\n -webkit-animation: spin 1s linear infinite; /* Safari */\n animation: spin 1s linear infinite;\n box-sizing: border-box;\n position:absolute;\n top:50%;\n left: 50%;\n margin-top: -15px;\n margin-left: -15px;\n }\n\n /* Safari */\n @-webkit-keyframes spin {\n 0% { -webkit-transform: rotate(0deg); }\n 100% { -webkit-transform: rotate(360deg); }\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "]); - _templateObject$l = function _templateObject() { + _templateObject$q = function _templateObject() { return data; }; @@ -52549,7 +55118,7 @@ _createClass(GscapeSpinner, null, [{ key: "styles", get: function get() { - return css(_templateObject$l(), gscape.shadows, gscape.secondary); + return css(_templateObject$q(), gscape.shadows, gscape.secondary); } }]); @@ -52562,7 +55131,7 @@ _createClass(GscapeSpinner, [{ key: "render", value: function render() { - return html$1(_templateObject2$h()); + return html$1(_templateObject2$i()); } }, { key: "hide", @@ -52580,30 +55149,30 @@ }(LitElement); customElements.define('gscape-spinner', GscapeSpinner); - function _templateObject3$b() { + function _templateObject3$d() { var data = _taggedTemplateLiteral(["

", "

"]); - _templateObject3$b = function _templateObject3() { + _templateObject3$d = function _templateObject3() { return data; }; return data; } - function _templateObject2$i() { + function _templateObject2$j() { var data = _taggedTemplateLiteral(["\n \n \n
\n ", "\n
\n "]); - _templateObject2$i = function _templateObject2() { + _templateObject2$j = function _templateObject2() { return data; }; return data; } - function _templateObject$m() { + function _templateObject$r() { var data = _taggedTemplateLiteral(["\n :host {\n top: 30%;\n left: 50%;\n max-width: 500px;\n transform: translate(-50%, 0);\n }\n\n .widget-body {\n padding : 10px;\n width: initial;\n }\n\n .widget-body.error {\n background : var(--theme-gscape-error, ", ");\n color : var(--theme-gscape-on-error, ", ");\n }\n\n gscape-head {\n --title-text-align : center;\n --title-width : 100%;\n }\n\n gscape-head.error {\n color : var(--theme-gscape-error, ", ");\n }\n\n gscape-head.warning {\n color : var(--theme-gscape-warning, ", ");\n }\n "]); - _templateObject$m = function _templateObject() { + _templateObject$r = function _templateObject() { return data; }; @@ -52633,7 +55202,7 @@ var super_styles = _get(_getPrototypeOf(GscapeDialog), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$m(), colors.error, colors.on_error, colors.error, colors.warning)]; + return [super_styles[0], css(_templateObject$r(), colors.error, colors.on_error, colors.error, colors.warning)]; } }]); @@ -52652,8 +55221,8 @@ _createClass(GscapeDialog, [{ key: "render", value: function render() { - return html$1(_templateObject2$i(), this.type, this.type.toLowerCase(), this.type.toLowerCase(), this.text.map(function (text) { - return html$1(_templateObject3$b(), text); + return html$1(_templateObject2$j(), this.type, this.type.toLowerCase(), this.type.toLowerCase(), this.text.map(function (text) { + return html$1(_templateObject3$d(), text); })); } // override @@ -52686,20 +55255,20 @@ }(GscapeWidget); customElements.define('gscape-dialog', GscapeDialog); - function _templateObject2$j() { - var data = _taggedTemplateLiteral(["\n \n
\n ", "\n
\n "]); + function _templateObject2$k() { + var data = _taggedTemplateLiteral(["\n \n
\n ", "\n
\n "]); - _templateObject2$j = function _templateObject2() { + _templateObject2$k = function _templateObject2() { return data; }; return data; } - function _templateObject$n() { + function _templateObject$s() { var data = _taggedTemplateLiteral(["\n :host {\n top:50%;\n transform: translate(0, -50%);\n left:10px;\n }\n\n .widget-body {\n max-height: 250px;\n }\n\n gscape-head {\n --title-text-align: center;\n --title-width: 100%;\n }\n\n .details_table {\n margin:5px 0;\n }\n "]); - _templateObject$n = function _templateObject() { + _templateObject$s = function _templateObject() { return data; }; @@ -52726,7 +55295,7 @@ var super_styles = _get(_getPrototypeOf(GscapeEntityOccurrences), "styles", this); var colors = super_styles[1]; - return [super_styles[0], css(_templateObject$n())]; + return [super_styles[0], css(_templateObject$s())]; } }]); @@ -52747,7 +55316,7 @@ _createClass(GscapeEntityOccurrences, [{ key: "render", value: function render() { - return html$1(_templateObject2$j(), entityOccurrencesTemplate(this.occurrences, this.handleNodeSelection)); + return html$1(_templateObject2$k(), entityOccurrencesTemplate(this.occurrences, this.handleNodeSelection)); } }, { key: "handleNodeSelection", @@ -52774,6 +55343,17 @@ }(GscapeWidget); customElements.define('gscape-entity-occurrences', GscapeEntityOccurrences); + var bottom_left_container = (function () { + var div = document.createElement('div'); + div.style.setProperty('position', 'absolute'); + div.style.setProperty('bottom', '0'); + div.style.setProperty('left', '0'); + div.style.setProperty('margin', '10px'); + div.style.setProperty('display', 'flex'); + div.style.setProperty('align-items', 'flex-end'); + return div; + }); + var GrapholscapeView = /*#__PURE__*/function () { function GrapholscapeView(container) { _classCallCheck(this, GrapholscapeView); @@ -52803,6 +55383,8 @@ this.container.appendChild(this.spinner); this.dialog = new GscapeDialog(); this.container.appendChild(this.dialog); + this.themes = {}; + Object.assign(this.themes, themes); } _createClass(GrapholscapeView, [{ @@ -52849,7 +55431,7 @@ zoom_widget.onZoomOut = this.zoomOut.bind(this); this.widgets.set('zoom_widget', zoom_widget); this.renderer_selector = new GscapeRenderSelector(this.renderers); - this.renderer_selector.onRendererChange = this.changeRenderingMode.bind(this); + this.renderer_selector.onRendererChange = this.onRenderingModeChange; this.widgets.set('simplifications', this.renderer_selector); this.layout_settings = new GscapeLayoutSettings(); @@ -52870,6 +55452,8 @@ this.settings_widget.onThemeSelection = this.onThemeSelection.bind(this); this.settings_widget.onWidgetEnabled = this.onWidgetEnabled.bind(this); this.settings_widget.onWidgetDisabled = this.onWidgetDisabled.bind(this); + this.settings_widget.onPNGSaveButtonClick = this.onExportToPNG; + this.settings_widget.onSVGSaveButtonClick = this.onExportToSVG; this.widgets.set('settings_widget', this.settings_widget); Object.keys(this.renderers).forEach(function (renderer) { return _this.registerEvents(_this.renderers[renderer]); @@ -52879,22 +55463,29 @@ if (!this.settings.widgets[widget_name].enabled) this.onWidgetDisabled(widget_name); } + var widget_container = bottom_left_container(); this.widgets.forEach(function (widget, key) { - _this.container.appendChild(widget); - switch (key) { case 'filters': case 'ontology_info': case 'settings_widget': case 'simplifications': + widget_container.appendChild(widget); + widget.onToggleBody = function () { return _this.blurAll(widget); }; + break; + + default: + _this.container.appendChild(widget); + break; } }); - if (this.settings.rendering.theme.selected != 'custom') this.setTheme(themes[this.settings.rendering.theme.selected]); + this.container.appendChild(widget_container); + if (this.settings.rendering.theme.selected != 'custom') this.setTheme(this.themes[this.settings.rendering.theme.selected]); } }, { key: "registerEvents", @@ -53062,7 +55653,7 @@ }, { key: "setRenderer", value: function setRenderer(renderer) { - for (name in this.renderers) { + for (var name in this.renderers) { if (this.renderers[name]) this.renderers[name].unmount(); } @@ -53148,7 +55739,7 @@ }, { key: "onThemeSelection", value: function onThemeSelection(theme_name) { - theme_name == 'custom' ? this.setTheme(this.custom_theme) : this.setTheme(themes[theme_name]); + this.setTheme(this.themes[theme_name]); } }, { key: "setTheme", @@ -53167,24 +55758,25 @@ theme_aux[key] = color; }); - this.graph_container.style.background = theme.background; // Apply theme to graph + this.graph_container.style.background = typeof theme.background == 'string' ? theme.background : theme.background.cssText; // Apply theme to graph Object.keys(this.renderers).map(function (key) { _this5.renderers[key].setTheme(theme_aux); }); } }, { - key: "setCustomTheme", - value: function setCustomTheme(new_theme) { + key: "registerCustomTheme", + value: function registerCustomTheme(new_theme, key_value) { var _this6 = this; - this.custom_theme = JSON.parse(JSON.stringify(gscape)); + // new custom theme will be based on gscape default theme + this.themes[key_value] = JSON.parse(JSON.stringify(gscape)); // each new custom colour will overwrite the default one + Object.keys(new_theme).forEach(function (color) { - if (_this6.custom_theme[color]) { - _this6.custom_theme[color] = new_theme[color]; + if (_this6.themes[key_value][color]) { + _this6.themes[key_value][color] = new_theme[color]; } }); - this.setTheme(this.custom_theme); } }, { key: "showWidget", @@ -54401,6 +56993,17 @@ 'default': config }); + var downloadBlob = (function (blob, fileName) { + var a = document.createElement('a'); + document.body.appendChild(a); + a.style.setProperty('style', 'none'); + var url = window.URL.createObjectURL(blob); + a.href = url; + a.download = fileName; + a.click(); + window.URL.revokeObjectURL(url); + }); + var GrapholscapeController = /*#__PURE__*/function () { function GrapholscapeController(ontology) { var _this = this; @@ -54484,9 +57087,11 @@ this.view.onNodeSelection = this.onNodeSelection.bind(this); this.view.onBackgroundClick = this.onBackgroundClick.bind(this); this.view.onEdgeSelection = this.onEdgeSelection.bind(this); - this.view.onRenderingModeChange = this.onRenderingModeChange.bind(this); + this.view.onRenderingModeChange = this.changeRenderingMode.bind(this); this.view.onEntityNameTypeChange = this.onEntityNameTypeChange.bind(this); this.view.onLanguageChange = this.onLanguageChange.bind(this); + this.view.onExportToPNG = this.exportToPNG.bind(this); + this.view.onExportToSVG = this.exportToSVG.bind(this); this.view.createUi(ontologyViewData, diagramsViewData, entitiesViewData, this.config); } /** @@ -54679,24 +57284,49 @@ this.view.showOwlTranslation(owl_text); } } + /** + * Change the rendering mode. + * @param {string} mode - the rendering/simplifation mode to activate: `default`, `lite`, or `float` + * @param {boolean} keep_viewport_state - if `false`, viewport will fit on diagram. + * Set it `true` if you don't want the viewport state to change. + * In case of no diagram displayed yet, it will be forced to `false`. + * Default: `true`. + * + * > Note: in case of activation or deactivation of the `float` mode, this value will be ignored. + */ + }, { - key: "onRenderingModeChange", - value: function onRenderingModeChange(mode, state) { + key: "changeRenderingMode", + value: function changeRenderingMode(mode) { var _this4 = this; + var keep_viewport_state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + this.view.blurAll(); + if (mode === this.actualMode) return; + var old_mode = this.actualMode; // if we change to lite or default mode, coming from float mode, + // and we didn't define a new viewport state, then reset viewport + // to fit the diagram because there's no equivalence in float graph + // and other graphs, unlike lite and default mode which have fixed + // positions for nodes. + + var shouldHardResetViewport = mode != 'float' && old_mode == 'float' || mode == 'float'; + var new_viewport_state = keep_viewport_state && !shouldHardResetViewport ? this.view.renderer.getActualPosition() : null; this.actualMode = mode; + this.view.widgets.get('simplifications').actual_mode = mode; + mode == 'float' ? this.view.showWidget('layout_settings') : this.view.hideWidget('layout_settings'); switch (mode) { case 'lite': case 'float': { this.SimplifiedOntologyPromise.then(function () { + // async code, actualMode may be changed if (_this4.actualMode === mode) { - _this4.ontology = _this4.ontologies[mode]; - - _this4.updateGraphView(state); - - _this4.updateEntitiesList(); + try { + performChange.bind(_this4)(); + } catch (e) { + console.log(e); + } } }); break; @@ -54704,30 +57334,50 @@ case 'default': { - this.ontology = this.ontologies["default"]; - this.updateGraphView(state); - this.updateEntitiesList(); + performChange.bind(this)(); break; } } - } - /** - * Change the rendering mode. - * @param {string} mode - the rendering/simplifation mode to activate: `graphol`, `lite`, or `float` - * @param {boolean} keep_viewport_state - if `false`, viewport will fit on diagram. - * Set it `true` if you don't want the viewport state to change. - * In case of no diagram displayed yet, it will be forced to `false`. - * Default: `true`. - * - * > Note: in case of activation or deactivation of the `float` mode, this value will be ignored. - */ - }, { - key: "changeRenderingMode", - value: function changeRenderingMode(mode) { - var keep_viewport_state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - this.view.changeRenderingMode(mode, keep_viewport_state); - this.view.widgets.get('simplifications').actual_mode = mode; + function performChange() { + var _this5 = this; + + this.ontology = this.ontologies[mode]; + this.view.setRenderer(this.view.renderers[mode]); + Object.keys(this.view.filters).map(function (key) { + if (key != 'all' && key != 'attributes' && key != 'individuals') { + if (mode == 'float' || mode == 'lite') { + // disable all unnecessary filters + _this5.view.filters[key].disabled = true; + } + + if (mode == 'default') { + // enable filters that may have been disabled by lite mode + _this5.view.filters[key].disabled = false; + if (key == 'value_domain' && _this5.view.filters.attributes.active) _this5.view.filters.value_domain.disabled = true; + } + } + }); + this.updateGraphView(new_viewport_state); + this.updateEntitiesList(); + this.view.widgets.get('filters').requestUpdate(); + + if (shouldHardResetViewport) { + /* + * HACKY + * WHY TIMEOUT? + * mount() and unmount() from cytoscape create issues with labels + * in float mode. to avoid that grapholscape mount and unmount + * renderers using display:none. this somehow causes container to get + * zero as both dimensions inside cytoscape even after setting display:block + * and it fails to perform the fit() operation. + * waiting a little bit assure those dimensions to have correct values. + */ + setTimeout(function () { + return _this5.view.resetView(); + }, 250); + } + } } /** * Redraw actual diagram and set viewport state. If state is not passed, viewport is not changed. @@ -54749,10 +57399,10 @@ }, { key: "updateEntitiesList", value: function updateEntitiesList() { - var _this5 = this; + var _this6 = this; var entitiesViewData = this.ontology.getEntities().map(function (entity) { - return _this5.entityModelToViewData(entity); + return _this6.entityModelToViewData(entity); }); this.view.updateEntitiesList(entitiesViewData); } @@ -54765,17 +57415,17 @@ }, { key: "onEntityNameTypeChange", value: function onEntityNameTypeChange(type) { - var _this6 = this; + var _this7 = this; this.SimplifiedOntologyPromise.then(function () { - Object.keys(_this6.ontologies).forEach(function (key) { - var entities = _this6.ontologies[key].getEntities(false); // get cytoscape nodes + Object.keys(_this7.ontologies).forEach(function (key) { + var entities = _this7.ontologies[key].getEntities(false); // get cytoscape nodes switch (type) { case 'label': entities.forEach(function (entity) { - if (entity.data('label')[_this6.language]) entity.data('displayed_name', entity.data('label')[_this6.language]);else if (entity.data('label')[_this6.default_language]) entity.data('displayed_name', entity.data('label')[_this6.default_language]);else { + if (entity.data('label')[_this7.language]) entity.data('displayed_name', entity.data('label')[_this7.language]);else if (entity.data('label')[_this7.default_language]) entity.data('displayed_name', entity.data('label')[_this7.default_language]);else { var first_label_key = Object.keys(entity.data('label'))[0]; entity.data('displayed_name', entity.data('label')[first_label_key]); } @@ -54797,9 +57447,9 @@ } }); - _this6.updateGraphView(_this6.view.renderer.getActualPosition()); + _this7.updateGraphView(_this7.view.renderer.getActualPosition()); - _this6.updateEntitiesList(); + _this7.updateEntitiesList(); }); } /* @@ -54815,39 +57465,95 @@ this.onEntityNameTypeChange(this.config.preferences.entity_name.selected); } + /** + * Update the actual configuration and apply changes. + * @param {Object} new_config - a configuration object. Please read [wiki/settings](https://github.com/obdasystems/grapholscape/wiki/Settings) + */ + }, { key: "setConfig", value: function setConfig(new_config) { - var _this7 = this; + var _this8 = this; Object.keys(new_config).forEach(function (entry) { // if custom theme if (entry == 'theme' && _typeof(new_config[entry]) == 'object') { - _this7.view.setCustomTheme(new_config[entry]); + var custom_theme_value = "custom"; - _this7.config.rendering.theme.list.push({ - value: 'custom', - label: 'Custom' - }); + _this8.config.rendering.theme.list.push({ + value: custom_theme_value, + label: new_config[entry].name || 'Custom' + }); // if marked with selected, update the 'selected' field in config - _this7.config.rendering.theme.selected = 'custom'; - return; // continue to next entry and skip next for - } - for (var area in _this7.config) { - try { - var setting = _this7.config[area][entry]; + if (new_config[entry].selected) _this8.config.rendering.theme.selected = custom_theme_value; // remove metadata from theme in order to get only colours + + delete new_config[entry].name; + delete new_config[entry].selected; + + _this8.view.registerCustomTheme(new_config[entry], custom_theme_value); + } else { + for (var area in _this8.config) { + try { + var setting = _this8.config[area][entry]; - if (setting) { - // apply custom settings only if they match type and are defined in lists - if (setting.type == 'boolean' && typeof new_config[entry] == 'boolean') _this7.config[area][entry].enabled = new_config[entry];else if (_this7.config[area][entry].list.map(function (elm) { - return elm.value; - }).includes(new_config[entry])) _this7.config[area][entry].selected = new_config[entry]; + if (setting) { + // apply custom settings only if they match type and are defined in lists + if (setting.type == 'boolean' && typeof new_config[entry] == 'boolean') _this8.config[area][entry].enabled = new_config[entry];else if (_this8.config[area][entry].list.map(function (elm) { + return elm.value; + }).includes(new_config[entry])) _this8.config[area][entry].selected = new_config[entry]; + } + } catch (e) { + console.warn("Custom default setting [".concat(entry, "] not recognized")); } - } catch (e) {} + } } }); + /* + * setting widget observes this.config object reference, not internal properties. + * Forcing the update it will render using the new config internal properties + * reacting to each change. + */ + + this.view.settings_widget.requestUpdate(); } + /** + * Export the current diagram in to a PNG image and save it on user's disk + * @param {String} fileName - the name to assign to the file + * (Default: [ontology name]-[diagram name]-v[ontology version]) + */ + + }, { + key: "exportToPNG", + value: function exportToPNG() { + var fileName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + fileName = fileName || this.export_file_name + '.png'; + this.view.renderer.cy.png(this.export_options).then(function (blob) { + return downloadBlob(blob, fileName); + }); + } + /** + * Export the current diagram in to a SVG file and save it on user's disk + * @param {String} fileName - the name to assign to the file + * (Default: [ontology name]-[diagram name]-v[ontology version]) + */ + + }, { + key: "exportToSVG", + value: function exportToSVG() { + var fileName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + console.log(this.export_options.bg); + fileName = fileName || this.export_file_name + '.svg'; + var svg_content = this.view.renderer.cy.svg(this.export_options); + var blob = new Blob([svg_content], { + type: "image/svg+xml;charset=utf-8" + }); + downloadBlob(blob, fileName); + } + /* + * Options for exports, blob-promise + */ + }, { key: "entityModelToViewData", value: function entityModelToViewData(entityModelData) { @@ -54912,6 +57618,25 @@ }; return JSON.parse(JSON.stringify(diagramViewData)); } + }, { + key: "export_options", + get: function get() { + var bg = this.view.themes[this.config.rendering.theme.selected].background.cssText || this.view.themes[this.config.rendering.theme.selected].background; + return { + output: 'blob-promise', + full: true, + bg: bg + }; + } + /* + ** Filename for exports: [ontology name]-[diagram name]-v[ontology version]) + */ + + }, { + key: "export_file_name", + get: function get() { + return "".concat(this.ontology.name, "-").concat(this.actual_diagram.name, "-v").concat(this.ontology.version); + } }, { key: "ontology", set: function set(ontology) { @@ -63158,8 +65883,13 @@ }); }); + var cytoscapeSvg = createCommonjsModule(function (module, exports) { + !function(t,e){module.exports=e();}(window,(function(){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i});},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0});},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){var i=r(1),n=function(t){t&&t("core","svg",i.svg);};"undefined"!=typeof cytoscape&&n(cytoscape),t.exports=n;},function(t,e,r){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=r(2),o={},s={};s.number=function(t){return null!=t&&(void 0===t?"undefined":i(t))===i(1)&&!isNaN(t)},o.bufferCanvasImage=function(t,e){var r=e.renderer().usePaths;e.renderer().usePaths=function(){return !1},e.elements().forEach((function(t){t._private.rscratch.pathCacheKey=null,t._private.rscratch.pathCache=null;}));var i=e.renderer(),o=e.mutableElements().boundingBox(),a=i.findContainerClientCoords(),l=t.full?Math.ceil(o.w):a[2],h=t.full?Math.ceil(o.h):a[3],c=s.number(t.maxWidth)||s.number(t.maxHeight),u=i.getPixelRatio(),p=1;if(void 0!==t.scale)l*=t.scale,h*=t.scale,p=t.scale;else if(c){var _=1/0,d=1/0;s.number(t.maxWidth)&&(_=p*t.maxWidth/l),s.number(t.maxHeight)&&(d=p*t.maxHeight/h),l*=p=Math.min(_,d),h*=p;}c||(l*=u,h*=u,p*=u);var f=null,g=f=new n(l,h);if(l>0&&h>0){f.clearRect(0,0,l,h),t.bg&&(f.globalCompositeOperation="destination-over",f.fillStyle=t.bg,f.fillRect(0,0,l,h)),f.globalCompositeOperation="source-over";var m=i.getCachedZSortedEles();if(t.full)f.translate(-o.x1*p,-o.y1*p),f.scale(p,p),i.drawElements(f,m),f.scale(1/p,1/p),f.translate(o.x1*p,o.y1*p);else {var y=e.pan(),v={x:y.x*p,y:y.y*p};p*=e.zoom(),f.translate(v.x,v.y),f.scale(p,p),i.drawElements(f,m),f.scale(1/p,1/p),f.translate(-v.x,-v.y);}}return e.renderer().usePaths=r,g},o.svg=function(t){return o.bufferCanvasImage(t||{},this).getSerializedSvg()},t.exports=o;},function(t,e,r){!function(){var e,r,i,n,o;function s(t,e){var r,i=Object.keys(e);for(r=0;r1?((e=i).width=arguments[0],e.height=arguments[1]):e=t||i,!(this instanceof r))return new r(e);this.width=e.width||i.width,this.height=e.height||i.height,this.enableMirroring=void 0!==e.enableMirroring?e.enableMirroring:i.enableMirroring,this.canvas=this,this.__document=e.document||document,e.ctx?this.__ctx=e.ctx:(this.__canvas=this.__document.createElement("canvas"),this.__ctx=this.__canvas.getContext("2d")),this.__setDefaultStyles(),this.__stack=[this.__getStyleState()],this.__groupStack=[],this.__root=this.__document.createElementNS("http://www.w3.org/2000/svg","svg"),this.__root.setAttribute("version",1.1),this.__root.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.__root.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),this.__root.setAttribute("width",this.width),this.__root.setAttribute("height",this.height),this.__ids={},this.__defs=this.__document.createElementNS("http://www.w3.org/2000/svg","defs"),this.__root.appendChild(this.__defs),this.__currentElement=this.__document.createElementNS("http://www.w3.org/2000/svg","g"),this.__root.appendChild(this.__currentElement);}).prototype.__createElement=function(t,e,r){void 0===e&&(e={});var i,n,o=this.__document.createElementNS("http://www.w3.org/2000/svg",t),s=Object.keys(e);for(r&&(o.setAttribute("fill","none"),o.setAttribute("stroke","none")),i=0;i0){"path"===this.__currentElement.nodeName&&(this.__currentElementsToStyle||(this.__currentElementsToStyle={element:e,children:[]}),this.__currentElementsToStyle.children.push(this.__currentElement),this.__applyCurrentDefaultPath());var r=this.__createElement("g");e.appendChild(r),this.__currentElement=r;}var i=this.__currentElement.getAttribute("transform");i?i+=" ":i="",i+=t,this.__currentElement.setAttribute("transform",i);},r.prototype.scale=function(t,e){void 0===e&&(e=t),this.__addTransform(s("scale({x},{y})",{x:t,y:e}));},r.prototype.rotate=function(t){var e=180*t/Math.PI;this.__addTransform(s("rotate({angle},{cx},{cy})",{angle:e,cx:0,cy:0}));},r.prototype.translate=function(t,e){this.__addTransform(s("translate({x},{y})",{x:t,y:e}));},r.prototype.transform=function(t,e,r,i,n,o){this.__addTransform(s("matrix({a},{b},{c},{d},{e},{f})",{a:t,b:e,c:r,d:i,e:n,f:o}));},r.prototype.beginPath=function(){var t;this.__currentDefaultPath="",this.__currentPosition={},t=this.__createElement("path",{},!0),this.__closestGroupOrSvg().appendChild(t),this.__currentElement=t;},r.prototype.__applyCurrentDefaultPath=function(){var t=this.__currentElement;"path"===t.nodeName?t.setAttribute("d",this.__currentDefaultPath):console.error("Attempted to apply path command to node",t.nodeName);},r.prototype.__addPathCommand=function(t){this.__currentDefaultPath+=" ",this.__currentDefaultPath+=t;},r.prototype.moveTo=function(t,e){"path"!==this.__currentElement.nodeName&&this.beginPath(),this.__currentPosition={x:t,y:e},this.__addPathCommand(s("M {x} {y}",{x:t,y:e}));},r.prototype.closePath=function(){this.__currentDefaultPath&&this.__addPathCommand("Z");},r.prototype.lineTo=function(t,e){this.__currentPosition={x:t,y:e},this.__currentDefaultPath.indexOf("M")>-1?this.__addPathCommand(s("L {x} {y}",{x:t,y:e})):this.__addPathCommand(s("M {x} {y}",{x:t,y:e}));},r.prototype.bezierCurveTo=function(t,e,r,i,n,o){this.__currentPosition={x:n,y:o},this.__addPathCommand(s("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:t,cp1y:e,cp2x:r,cp2y:i,x:n,y:o}));},r.prototype.quadraticCurveTo=function(t,e,r,i){this.__currentPosition={x:r,y:i},this.__addPathCommand(s("Q {cpx} {cpy} {x} {y}",{cpx:t,cpy:e,x:r,y:i}));};var h=function(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);return [t[0]/e,t[1]/e]};r.prototype.arcTo=function(t,e,r,i,n){var o=this.__currentPosition&&this.__currentPosition.x,s=this.__currentPosition&&this.__currentPosition.y;if(void 0!==o&&void 0!==s){if(n<0)throw new Error("IndexSizeError: The radius provided ("+n+") is negative.");if(o===t&&s===e||t===r&&e===i||0===n)this.lineTo(t,e);else {var a=h([o-t,s-e]),l=h([r-t,i-e]);if(a[0]*l[1]!=a[1]*l[0]){var c=a[0]*l[0]+a[1]*l[1],u=Math.acos(Math.abs(c)),p=h([a[0]+l[0],a[1]+l[1]]),_=n/Math.sin(u/2),d=t+_*p[0],f=e+_*p[1],g=[-a[1],a[0]],m=[l[1],-l[0]],y=function(t){var e=t[0];return t[1]>=0?Math.acos(e):-Math.acos(e)},v=y(g),b=y(m);this.lineTo(d+g[0]*n,f+g[1]*n),this.arc(d,f,n,v,b);}else this.lineTo(t,e);}}},r.prototype.stroke=function(){"path"===this.__currentElement.nodeName&&this.__currentElement.setAttribute("paint-order","fill stroke markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("stroke");},r.prototype.fill=function(){"path"===this.__currentElement.nodeName&&this.__currentElement.setAttribute("paint-order","stroke fill markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("fill");},r.prototype.rect=function(t,e,r,i){"path"!==this.__currentElement.nodeName&&this.beginPath(),this.moveTo(t,e),this.lineTo(t+r,e),this.lineTo(t+r,e+i),this.lineTo(t,e+i),this.lineTo(t,e),this.closePath();},r.prototype.fillRect=function(t,e,r,i){var n;n=this.__createElement("rect",{x:t,y:e,width:r,height:i},!0),this.__closestGroupOrSvg().appendChild(n),this.__currentElement=n,this.__applyStyleToCurrentElement("fill");},r.prototype.strokeRect=function(t,e,r,i){var n;n=this.__createElement("rect",{x:t,y:e,width:r,height:i},!0),this.__closestGroupOrSvg().appendChild(n),this.__currentElement=n,this.__applyStyleToCurrentElement("stroke");},r.prototype.__clearCanvas=function(){for(var t=this.__closestGroupOrSvg().getAttribute("transform"),e=this.__root.childNodes[1],r=e.childNodes,i=r.length-1;i>=0;i--)r[i]&&e.removeChild(r[i]);this.__currentElement=e,this.__groupStack=[],t&&this.__addTransform(t);},r.prototype.clearRect=function(t,e,r,i){if(0!==t||0!==e||r!==this.width||i!==this.height){var n,o=this.__closestGroupOrSvg();n=this.__createElement("rect",{x:t,y:e,width:r,height:i,fill:"#FFFFFF"},!0),o.appendChild(n);}else this.__clearCanvas();},r.prototype.createLinearGradient=function(t,e,r,n){var o=this.__createElement("linearGradient",{id:a(this.__ids),x1:t+"px",x2:r+"px",y1:e+"px",y2:n+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(o),new i(o,this)},r.prototype.createRadialGradient=function(t,e,r,n,o,s){var l=this.__createElement("radialGradient",{id:a(this.__ids),cx:n+"px",cy:o+"px",r:s+"px",fx:t+"px",fy:e+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(l),new i(l,this)},r.prototype.__parseFont=function(){var t=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\'\"\sa-z0-9]+?)\s*$/i.exec(this.font),e={style:t[1]||"normal",size:t[4]||"10px",family:t[6]||"sans-serif",weight:t[3]||"normal",decoration:t[2]||"normal",href:null};return "underline"===this.__fontUnderline&&(e.decoration="underline"),this.__fontHref&&(e.href=this.__fontHref),e},r.prototype.__wrapTextLink=function(t,e){if(t.href){var r=this.__createElement("a");return r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.href),r.appendChild(e),r}return e},r.prototype.__applyText=function(t,e,r,i){var n,o,s=this.__parseFont(),a=this.__closestGroupOrSvg(),h=this.__createElement("text",{"font-family":s.family,"font-size":s.size,"font-style":s.style,"font-weight":s.weight,"text-decoration":s.decoration,x:e,y:r,"text-anchor":(n=this.textAlign,o={left:"start",right:"end",center:"middle",start:"start",end:"end"},o[n]||o.start),"dominant-baseline":l(this.textBaseline)},!0);h.appendChild(this.__document.createTextNode(t)),this.__currentElement=h,this.__applyStyleToCurrentElement(i),a.appendChild(this.__wrapTextLink(s,h));},r.prototype.fillText=function(t,e,r){this.__applyText(t,e,r,"fill");},r.prototype.strokeText=function(t,e,r){this.__applyText(t,e,r,"stroke");},r.prototype.measureText=function(t){return this.__ctx.font=this.font,this.__ctx.measureText(t)},r.prototype.arc=function(t,e,r,i,n,o){if(i!==n){(i%=2*Math.PI)===(n%=2*Math.PI)&&(n=(n+2*Math.PI-.001*(o?-1:1))%(2*Math.PI));var a=t+r*Math.cos(n),l=e+r*Math.sin(n),h=t+r*Math.cos(i),c=e+r*Math.sin(i),u=o?0:1,p=0,_=n-i;_<0&&(_+=2*Math.PI),p=o?_>Math.PI?0:1:_>Math.PI?1:0,this.lineTo(h,c),this.__addPathCommand(s("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:r,ry:r,xAxisRotation:0,largeArcFlag:p,sweepFlag:u,endX:a,endY:l})),this.__currentPosition={x:a,y:l};}},r.prototype.clip=function(){var t=this.__closestGroupOrSvg(),e=this.__createElement("clipPath"),r=a(this.__ids),i=this.__createElement("g");this.__applyCurrentDefaultPath(),t.removeChild(this.__currentElement),e.setAttribute("id",r),e.appendChild(this.__currentElement),this.__defs.appendChild(e),t.setAttribute("clip-path",s("url(#{id})",{id:r})),t.appendChild(i),this.__currentElement=i;},r.prototype.drawImage=function(){var t,e,i,n,o,s,a,l,h,c,u,p,_,d=Array.prototype.slice.call(arguments),f=d[0],g=0,m=0;if(3===d.length)t=d[1],e=d[2],i=o=f.width,n=s=f.height;else if(5===d.length)t=d[1],e=d[2],i=d[3],n=d[4],o=f.width,s=f.height;else {if(9!==d.length)throw new Error("Inavlid number of arguments passed to drawImage: "+arguments.length);g=d[1],m=d[2],o=d[3],s=d[4],t=d[5],e=d[6],i=d[7],n=d[8];}a=this.__closestGroupOrSvg(),this.__currentElement;var y="translate("+t+", "+e+")";if(f instanceof r){if((l=f.getSvg().cloneNode(!0)).childNodes&&l.childNodes.length>1){for(h=l.childNodes[0];h.childNodes.length;)_=h.childNodes[0].getAttribute("id"),this.__ids[_]=_,this.__defs.appendChild(h.childNodes[0]);if(c=l.childNodes[1]){var v,b=c.getAttribute("transform");v=b?b+" "+y:y,c.setAttribute("transform",v),a.appendChild(c);}}}else "CANVAS"!==f.nodeName&&"IMG"!==f.nodeName||((u=this.__createElement("image")).setAttribute("width",i),u.setAttribute("height",n),u.setAttribute("opacity",this.globalAlpha),u.setAttribute("preserveAspectRatio","none"),(p=this.__document.createElement("canvas")).width=i,p.height=n,p.getContext("2d").drawImage(f,g,m,o,s,0,0,i,n),f=p,u.setAttribute("transform",y),u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","CANVAS"===f.nodeName?f.toDataURL():f.getAttribute("src")),a.appendChild(u));},r.prototype.createPattern=function(t,e){var i,o=this.__document.createElementNS("http://www.w3.org/2000/svg","pattern"),s=a(this.__ids);return o.setAttribute("id",s),o.setAttribute("width",t.width),o.setAttribute("height",t.height),"CANVAS"===t.nodeName||"IMG"===t.nodeName?((i=this.__document.createElementNS("http://www.w3.org/2000/svg","image")).setAttribute("width",t.width),i.setAttribute("height",t.height),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","CANVAS"===t.nodeName?t.toDataURL():t.getAttribute("src")),o.appendChild(i),this.__defs.appendChild(o)):t instanceof r&&(o.appendChild(t.__root.childNodes[1]),this.__defs.appendChild(o)),new n(o,this)},r.prototype.setLineDash=function(t){t&&t.length>0?this.lineDash=t.join(","):this.lineDash=null;},r.prototype.drawFocusRing=function(){},r.prototype.createImageData=function(){},r.prototype.getImageData=function(){},r.prototype.putImageData=function(){},r.prototype.globalCompositeOperation=function(){},r.prototype.setTransform=function(){},"object"==typeof window&&(window.C2S=r),"object"==typeof t.exports&&(t.exports=r);}();}])})); + }); + cytoscape_cjs.use(cytoscapePopper); cytoscape_cjs.use(cytoscapeCola); + cytoscape_cjs.use(cytoscapeSvg); var GrapholScape = /*#__PURE__*/function () { function GrapholScape(file) { diff --git a/dist/grapholscape.min.js b/dist/grapholscape.min.js index d07fa66f..725c3504 100644 --- a/dist/grapholscape.min.js +++ b/dist/grapholscape.min.js @@ -22,7 +22,7 @@ * SOFTWARE. */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).GrapholScape=e()}(this,(function(){"use strict";var t=function(t){try{return!!t()}catch(t){return!0}},e=!t((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},n.exports),n.exports}var i=function(t){return t&&t.Math==Math&&t},o=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof n&&n)||Function("return this")(),a=function(t){return"object"==typeof t?null!==t:"function"==typeof t},s=o.document,l=a(s)&&a(s.createElement),u=function(t){return l?s.createElement(t):{}},c=!e&&!t((function(){return 7!=Object.defineProperty(u("div"),"a",{get:function(){return 7}}).a})),h=function(t){if(!a(t))throw TypeError(String(t)+" is not an object");return t},d=function(t,e){if(!a(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!a(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!a(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!a(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},f=Object.defineProperty,p={f:e?f:function(t,e,n){if(h(t),e=d(e,!0),h(n),c)try{return f(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},g=p.f,v=Function.prototype,y=v.toString,m=/^\s*function ([^ (]*)/;e&&!("name"in v)&&g(v,"name",{configurable:!0,get:function(){try{return y.call(this).match(m)[1]}catch(t){return""}}});var b=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},w=e?function(t,e,n){return p.f(t,e,b(1,n))}:function(t,e,n){return t[e]=n,t},x=function(t,e){try{w(o,t,e)}catch(n){o[t]=e}return e},_=o["__core-js_shared__"]||x("__core-js_shared__",{}),E=r((function(t){(t.exports=function(t,e){return _[t]||(_[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),k={}.hasOwnProperty,S=function(t,e){return k.call(t,e)},C=0,T=Math.random(),N=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++C+T).toString(36)},O=!!Object.getOwnPropertySymbols&&!t((function(){return!String(Symbol())})),P=O&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,M=E("wks"),D=o.Symbol,A=P?D:D&&D.withoutSetter||N,L=function(t){return S(M,t)||(O&&S(D,t)?M[t]=D[t]:M[t]=A("Symbol."+t)),M[t]},I={};I[L("toStringTag")]="z";var R="[object z]"===String(I),B=Function.toString;"function"!=typeof _.inspectSource&&(_.inspectSource=function(t){return B.call(t)});var j,F,z,V=_.inspectSource,q=o.WeakMap,U="function"==typeof q&&/native code/.test(V(q)),H=E("keys"),W=function(t){return H[t]||(H[t]=N(t))},Y={},G=o.WeakMap;if(U){var X=new G,K=X.get,$=X.has,Z=X.set;j=function(t,e){return Z.call(X,t,e),e},F=function(t){return K.call(X,t)||{}},z=function(t){return $.call(X,t)}}else{var J=W("state");Y[J]=!0,j=function(t,e){return w(t,J,e),e},F=function(t){return S(t,J)?t[J]:{}},z=function(t){return S(t,J)}}var Q={set:j,get:F,has:z,enforce:function(t){return z(t)?F(t):j(t,{})},getterFor:function(t){return function(e){var n;if(!a(e)||(n=F(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}},tt=r((function(t){var e=Q.get,n=Q.enforce,r=String(String).split("String");(t.exports=function(t,e,i,a){var s=!!a&&!!a.unsafe,l=!!a&&!!a.enumerable,u=!!a&&!!a.noTargetGet;"function"==typeof i&&("string"!=typeof e||S(i,"name")||w(i,"name",e),n(i).source=r.join("string"==typeof e?e:"")),t!==o?(s?!u&&t[e]&&(l=!0):delete t[e],l?t[e]=i:w(t,e,i)):l?t[e]=i:x(e,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||V(this)}))})),et={}.toString,nt=function(t){return et.call(t).slice(8,-1)},rt=L("toStringTag"),it="Arguments"==nt(function(){return arguments}()),ot=R?nt:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),rt))?n:it?nt(e):"Object"==(r=nt(e))&&"function"==typeof e.callee?"Arguments":r},at=R?{}.toString:function(){return"[object "+ot(this)+"]"};R||tt(Object.prototype,"toString",at,{unsafe:!0});var st={}.propertyIsEnumerable,lt=Object.getOwnPropertyDescriptor,ut={f:lt&&!st.call({1:2},1)?function(t){var e=lt(this,t);return!!e&&e.enumerable}:st},ct="".split,ht=t((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==nt(t)?ct.call(t,""):Object(t)}:Object,dt=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},ft=function(t){return ht(dt(t))},pt=Object.getOwnPropertyDescriptor,gt={f:e?pt:function(t,e){if(t=ft(t),e=d(e,!0),c)try{return pt(t,e)}catch(t){}if(S(t,e))return b(!ut.f.call(t,e),t[e])}},vt=o,yt=function(t){return"function"==typeof t?t:void 0},mt=function(t,e){return arguments.length<2?yt(vt[t])||yt(o[t]):vt[t]&&vt[t][e]||o[t]&&o[t][e]},bt=Math.ceil,wt=Math.floor,xt=function(t){return isNaN(t=+t)?0:(t>0?wt:bt)(t)},_t=Math.min,Et=function(t){return t>0?_t(xt(t),9007199254740991):0},kt=Math.max,St=Math.min,Ct=function(t,e){var n=xt(t);return n<0?kt(n+e,0):St(n,e)},Tt=function(t){return function(e,n,r){var i,o=ft(e),a=Et(o.length),s=Ct(r,a);if(t&&n!=n){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===n)return t||s||0;return!t&&-1}},Nt={includes:Tt(!0),indexOf:Tt(!1)},Ot=Nt.indexOf,Pt=function(t,e){var n,r=ft(t),i=0,o=[];for(n in r)!S(Y,n)&&S(r,n)&&o.push(n);for(;e.length>i;)S(r,n=e[i++])&&(~Ot(o,n)||o.push(n));return o},Mt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Dt=Mt.concat("length","prototype"),At={f:Object.getOwnPropertyNames||function(t){return Pt(t,Dt)}},Lt={f:Object.getOwnPropertySymbols},It=mt("Reflect","ownKeys")||function(t){var e=At.f(h(t)),n=Lt.f;return n?e.concat(n(t)):e},Rt=function(t,e){for(var n=It(e),r=p.f,i=gt.f,o=0;ol;l++)if((c=i?p(h(f=t[l])[0],f[1]):p(t[l]))&&c instanceof e)return c;return new e(!1)}a=s.call(t)}for(d=a.next;!(f=d.call(a)).done;)if("object"==typeof(c=le(a,p,f.value,i))&&c&&c instanceof e)return c;return new e(!1)}).stop=function(t){return new e(!0,t)}})),ce=L("iterator"),he=!1;try{var de=0,fe={next:function(){return{done:!!de++}},return:function(){he=!0}};fe[ce]=function(){return this},Array.from(fe,(function(){throw 2}))}catch(My){}var pe,ge,ve,ye=function(t,e){if(!e&&!he)return!1;var n=!1;try{var r={};r[ce]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n},me=L("species"),be=function(t,e){var n,r=h(t).constructor;return void 0===r||null==(n=h(r)[me])?e:Qt(n)},we=mt("document","documentElement"),xe=mt("navigator","userAgent")||"",_e=/(iphone|ipod|ipad).*applewebkit/i.test(xe),Ee=o.location,ke=o.setImmediate,Se=o.clearImmediate,Ce=o.process,Te=o.MessageChannel,Ne=o.Dispatch,Oe=0,Pe={},Me=function(t){if(Pe.hasOwnProperty(t)){var e=Pe[t];delete Pe[t],e()}},De=function(t){return function(){Me(t)}},Ae=function(t){Me(t.data)},Le=function(t){o.postMessage(t+"",Ee.protocol+"//"+Ee.host)};ke&&Se||(ke=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return Pe[++Oe]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},pe(Oe),Oe},Se=function(t){delete Pe[t]},"process"==nt(Ce)?pe=function(t){Ce.nextTick(De(t))}:Ne&&Ne.now?pe=function(t){Ne.now(De(t))}:Te&&!_e?(ve=(ge=new Te).port2,ge.port1.onmessage=Ae,pe=oe(ve.postMessage,ve,1)):!o.addEventListener||"function"!=typeof postMessage||o.importScripts||t(Le)||"file:"===Ee.protocol?pe="onreadystatechange"in u("script")?function(t){we.appendChild(u("script")).onreadystatechange=function(){we.removeChild(this),Me(t)}}:function(t){setTimeout(De(t),0)}:(pe=Le,o.addEventListener("message",Ae,!1)));var Ie,Re,Be,je,Fe,ze,Ve,qe,Ue={set:ke,clear:Se},He=gt.f,We=Ue.set,Ye=o.MutationObserver||o.WebKitMutationObserver,Ge=o.process,Xe=o.Promise,Ke="process"==nt(Ge),$e=He(o,"queueMicrotask"),Ze=$e&&$e.value;Ze||(Ie=function(){var t,e;for(Ke&&(t=Ge.domain)&&t.exit();Re;){e=Re.fn,Re=Re.next;try{e()}catch(t){throw Re?je():Be=void 0,t}}Be=void 0,t&&t.enter()},Ke?je=function(){Ge.nextTick(Ie)}:Ye&&!_e?(Fe=!0,ze=document.createTextNode(""),new Ye(Ie).observe(ze,{characterData:!0}),je=function(){ze.data=Fe=!Fe}):Xe&&Xe.resolve?(Ve=Xe.resolve(void 0),qe=Ve.then,je=function(){qe.call(Ve,Ie)}):je=function(){We.call(o,Ie)});var Je,Qe,tn=Ze||function(t){var e={fn:t,next:void 0};Be&&(Be.next=e),Re||(Re=e,je()),Be=e},en=function(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r})),this.resolve=Qt(e),this.reject=Qt(n)},nn={f:function(t){return new en(t)}},rn=function(t,e){if(h(t),a(e)&&e.constructor===t)return e;var n=nn.f(t);return(0,n.resolve)(e),n.promise},on=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},an=o.process,sn=an&&an.versions,ln=sn&&sn.v8;ln?Qe=(Je=ln.split("."))[0]+Je[1]:xe&&(!(Je=xe.match(/Edge\/(\d+)/))||Je[1]>=74)&&(Je=xe.match(/Chrome\/(\d+)/))&&(Qe=Je[1]);var un,cn,hn,dn,fn=Qe&&+Qe,pn=Ue.set,gn=L("species"),vn="Promise",yn=Q.get,mn=Q.set,bn=Q.getterFor(vn),wn=Yt,xn=o.TypeError,_n=o.document,En=o.process,kn=mt("fetch"),Sn=nn.f,Cn=Sn,Tn="process"==nt(En),Nn=!!(_n&&_n.createEvent&&o.dispatchEvent),On=Ut(vn,(function(){if(!(V(wn)!==String(wn))){if(66===fn)return!0;if(!Tn&&"function"!=typeof PromiseRejectionEvent)return!0}if(fn>=51&&/native code/.test(wn))return!1;var t=wn.resolve(1),e=function(t){t((function(){}),(function(){}))};return(t.constructor={})[gn]=e,!(t.then((function(){}))instanceof e)})),Pn=On||!ye((function(t){wn.all(t).catch((function(){}))})),Mn=function(t){var e;return!(!a(t)||"function"!=typeof(e=t.then))&&e},Dn=function(t,e,n){if(!e.notified){e.notified=!0;var r=e.reactions;tn((function(){for(var i=e.value,o=1==e.state,a=0;r.length>a;){var s,l,u,c=r[a++],h=o?c.ok:c.fail,d=c.resolve,f=c.reject,p=c.domain;try{h?(o||(2===e.rejection&&Rn(t,e),e.rejection=1),!0===h?s=i:(p&&p.enter(),s=h(i),p&&(p.exit(),u=!0)),s===c.promise?f(xn("Promise-chain cycle")):(l=Mn(s))?l.call(s,d,f):d(s)):f(i)}catch(t){p&&!u&&p.exit(),f(t)}}e.reactions=[],e.notified=!1,n&&!e.rejection&&Ln(t,e)}))}},An=function(t,e,n){var r,i;Nn?((r=_n.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),o.dispatchEvent(r)):r={promise:e,reason:n},(i=o["on"+t])?i(r):"unhandledrejection"===t&&function(t,e){var n=o.console;n&&n.error&&(1===arguments.length?n.error(t):n.error(t,e))}("Unhandled promise rejection",n)},Ln=function(t,e){pn.call(o,(function(){var n,r=e.value;if(In(e)&&(n=on((function(){Tn?En.emit("unhandledRejection",r,t):An("unhandledrejection",t,r)})),e.rejection=Tn||In(e)?2:1,n.error))throw n.value}))},In=function(t){return 1!==t.rejection&&!t.parent},Rn=function(t,e){pn.call(o,(function(){Tn?En.emit("rejectionHandled",t):An("rejectionhandled",t,e.value)}))},Bn=function(t,e,n,r){return function(i){t(e,n,i,r)}},jn=function(t,e,n,r){e.done||(e.done=!0,r&&(e=r),e.value=n,e.state=2,Dn(t,e,!0))},Fn=function(t,e,n,r){if(!e.done){e.done=!0,r&&(e=r);try{if(t===n)throw xn("Promise can't be resolved itself");var i=Mn(n);i?tn((function(){var r={done:!1};try{i.call(n,Bn(Fn,t,r,e),Bn(jn,t,r,e))}catch(n){jn(t,r,n,e)}})):(e.value=n,e.state=1,Dn(t,e,!1))}catch(n){jn(t,{done:!1},n,e)}}};On&&(wn=function(t){te(this,wn,vn),Qt(t),un.call(this);var e=yn(this);try{t(Bn(Fn,this,e),Bn(jn,this,e))}catch(t){jn(this,e,t)}},(un=function(t){mn(this,{type:vn,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Gt(wn.prototype,{then:function(t,e){var n=bn(this),r=Sn(be(this,wn));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=Tn?En.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&Dn(this,n,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),cn=function(){var t=new un,e=yn(t);this.promise=t,this.resolve=Bn(Fn,t,e),this.reject=Bn(jn,t,e)},nn.f=Sn=function(t){return t===wn||t===hn?new cn(t):Cn(t)},"function"==typeof Yt&&(dn=Yt.prototype.then,tt(Yt.prototype,"then",(function(t,e){var n=this;return new wn((function(t,e){dn.call(n,t,e)})).then(t,e)}),{unsafe:!0}),"function"==typeof kn&&Wt({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return rn(wn,kn.apply(o,arguments))}}))),Wt({global:!0,wrap:!0,forced:On},{Promise:wn}),$t(wn,vn,!1),Jt(vn),hn=mt(vn),Wt({target:vn,stat:!0,forced:On},{reject:function(t){var e=Sn(this);return e.reject.call(void 0,t),e.promise}}),Wt({target:vn,stat:!0,forced:On},{resolve:function(t){return rn(this,t)}}),Wt({target:vn,stat:!0,forced:Pn},{all:function(t){var e=this,n=Sn(e),r=n.resolve,i=n.reject,o=on((function(){var n=Qt(e.resolve),o=[],a=0,s=1;ue(t,(function(t){var l=a++,u=!1;o.push(void 0),s++,n.call(e,t).then((function(t){u||(u=!0,o[l]=t,--s||r(o))}),i)})),--s||r(o)}));return o.error&&i(o.value),n.promise},race:function(t){var e=this,n=Sn(e),r=n.reject,i=on((function(){var i=Qt(e.resolve);ue(t,(function(t){i.call(e,t).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var zn=!!Yt&&t((function(){Yt.prototype.finally.call({then:function(){}},(function(){}))}));Wt({target:"Promise",proto:!0,real:!0,forced:zn},{finally:function(t){var e=be(this,mt("Promise")),n="function"==typeof t;return this.then(n?function(n){return rn(e,t()).then((function(){return n}))}:t,n?function(n){return rn(e,t()).then((function(){throw n}))}:t)}}),"function"!=typeof Yt||Yt.prototype.finally||tt(Yt.prototype,"finally",mt("Promise").prototype.finally);var Vn=[].slice,qn=/MSIE .\./.test(xe),Un=function(t){return function(e,n){var r=arguments.length>2,i=r?Vn.call(arguments,2):void 0;return t(r?function(){("function"==typeof e?e:Function(e)).apply(this,i)}:e,n)}};function Hn(t){return(Hn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Wn(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Yn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Gn(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}Wt({global:!0,bind:!0,forced:qn},{setTimeout:Un(o.setTimeout),setInterval:Un(o.setInterval)});var cr,hr=Array.isArray||function(t){return"Array"==nt(t)},dr=function(t){return Object(dt(t))},fr=Object.keys||function(t){return Pt(t,Mt)},pr=e?Object.defineProperties:function(t,e){h(t);for(var n,r=fr(e),i=r.length,o=0;i>o;)p.f(t,n=r[o++],e[n]);return t},gr=W("IE_PROTO"),vr=function(){},yr=function(t){return"