UNPKG

js-utils-lc

Version:

JavaScript工具函数库文档及npm管理

1,468 lines (1,221 loc) 237 kB
define(['exports'], function (exports) { 'use strict'; var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } var check$1 = function (it) { return it && it.Math == Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global_1$1 = // eslint-disable-next-line es/no-global-this -- safe check$1(typeof globalThis == 'object' && globalThis) || check$1(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe check$1(typeof self == 'object' && self) || check$1(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func -- fallback (function () { return this; })() || Function('return this')(); var fails$1 = function (exec) { try { return !!exec(); } catch (error) { return true; } }; // Detect IE8's incomplete defineProperty implementation var descriptors$1 = !fails$1(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); var isObject$1 = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; var document$4 = global_1$1.document; // typeof document.createElement is 'object' in old IE var EXISTS$1 = isObject$1(document$4) && isObject$1(document$4.createElement); var documentCreateElement$1 = function (it) { return EXISTS$1 ? document$4.createElement(it) : {}; }; // Thank's IE8 for his funny defineProperty var ie8DomDefine$1 = !descriptors$1 && !fails$1(function () { // eslint-disable-next-line es/no-object-defineproperty -- requied for testing return Object.defineProperty(documentCreateElement$1('div'), 'a', { get: function () { return 7; } }).a != 7; }); var anObject$1 = function (it) { if (!isObject$1(it)) { throw TypeError(String(it) + ' is not an object'); } return it; }; // `ToPrimitive` abstract operation // 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$1 = function (input, PREFERRED_STRING) { if (!isObject$1(input)) return input; var fn, val; if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$1(val = fn.call(input))) return val; if (typeof (fn = input.valueOf) == 'function' && !isObject$1(val = fn.call(input))) return val; if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$1(val = fn.call(input))) return val; throw TypeError("Can't convert object to primitive value"); }; // eslint-disable-next-line es/no-object-defineproperty -- safe var $defineProperty$2 = Object.defineProperty; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty var f$c = descriptors$1 ? $defineProperty$2 : function defineProperty(O, P, Attributes) { anObject$1(O); P = toPrimitive$1(P, true); anObject$1(Attributes); if (ie8DomDefine$1) try { return $defineProperty$2(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; var objectDefineProperty$1 = { f: f$c }; var createPropertyDescriptor$1 = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; var createNonEnumerableProperty$1 = descriptors$1 ? function (object, key, value) { return objectDefineProperty$1.f(object, key, createPropertyDescriptor$1(1, value)); } : function (object, key, value) { object[key] = value; return object; }; // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible var requireObjectCoercible$1 = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject var toObject$1 = function (argument) { return Object(requireObjectCoercible$1(argument)); }; var hasOwnProperty$1 = {}.hasOwnProperty; var has$3 = Object.hasOwn || function hasOwn(it, key) { return hasOwnProperty$1.call(toObject$1(it), key); }; var setGlobal$1 = function (key, value) { try { createNonEnumerableProperty$1(global_1$1, key, value); } catch (error) { global_1$1[key] = value; } return value; }; var SHARED$1 = '__core-js_shared__'; var store$3 = global_1$1[SHARED$1] || setGlobal$1(SHARED$1, {}); var sharedStore$1 = store$3; var functionToString$1 = Function.toString; // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper if (typeof sharedStore$1.inspectSource != 'function') { sharedStore$1.inspectSource = function (it) { return functionToString$1.call(it); }; } var inspectSource$1 = sharedStore$1.inspectSource; var WeakMap$3 = global_1$1.WeakMap; var nativeWeakMap$1 = typeof WeakMap$3 === 'function' && /native code/.test(inspectSource$1(WeakMap$3)); var shared$1 = createCommonjsModule(function (module) { (module.exports = function (key, value) { return sharedStore$1[key] || (sharedStore$1[key] = value !== undefined ? value : {}); })('versions', []).push({ version: '3.15.2', mode: 'global', copyright: '© 2021 Denis Pushkarev (zloirock.ru)' }); }); var id$1 = 0; var postfix$1 = Math.random(); var uid$1 = function (key) { return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id$1 + postfix$1).toString(36); }; var keys$3 = shared$1('keys'); var sharedKey$1 = function (key) { return keys$3[key] || (keys$3[key] = uid$1(key)); }; var hiddenKeys$3 = {}; var OBJECT_ALREADY_INITIALIZED$1 = 'Object already initialized'; var WeakMap$2 = global_1$1.WeakMap; var set$5, get$1, has$2; var enforce$1 = function (it) { return has$2(it) ? get$1(it) : set$5(it, {}); }; var getterFor$1 = function (TYPE) { return function (it) { var state; if (!isObject$1(it) || (state = get$1(it)).type !== TYPE) { throw TypeError('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; if (nativeWeakMap$1 || sharedStore$1.state) { var store$2 = sharedStore$1.state || (sharedStore$1.state = new WeakMap$2()); var wmget$1 = store$2.get; var wmhas$1 = store$2.has; var wmset$1 = store$2.set; set$5 = function (it, metadata) { if (wmhas$1.call(store$2, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED$1); metadata.facade = it; wmset$1.call(store$2, it, metadata); return metadata; }; get$1 = function (it) { return wmget$1.call(store$2, it) || {}; }; has$2 = function (it) { return wmhas$1.call(store$2, it); }; } else { var STATE$1 = sharedKey$1('state'); hiddenKeys$3[STATE$1] = true; set$5 = function (it, metadata) { if (has$3(it, STATE$1)) throw new TypeError(OBJECT_ALREADY_INITIALIZED$1); metadata.facade = it; createNonEnumerableProperty$1(it, STATE$1, metadata); return metadata; }; get$1 = function (it) { return has$3(it, STATE$1) ? it[STATE$1] : {}; }; has$2 = function (it) { return has$3(it, STATE$1); }; } var internalState$1 = { set: set$5, get: get$1, has: has$2, enforce: enforce$1, getterFor: getterFor$1 }; var redefine$1 = createCommonjsModule(function (module) { var getInternalState = internalState$1.get; var enforceInternalState = internalState$1.enforce; var TEMPLATE = String(String).split('String'); (module.exports = function (O, key, value, options) { 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$3(value, 'name')) { createNonEnumerableProperty$1(value, 'name', key); } state = enforceInternalState(value); if (!state.source) { state.source = TEMPLATE.join(typeof key == 'string' ? key : ''); } } if (O === global_1$1) { if (simple) O[key] = value; else setGlobal$1(key, value); return; } else if (!unsafe) { delete O[key]; } else if (!noTargetGet && O[key]) { simple = true; } if (simple) O[key] = value; else createNonEnumerableProperty$1(O, key, value); // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, 'toString', function toString() { return typeof this == 'function' && getInternalState(this).source || inspectSource$1(this); }); }); var DatePrototype = Date.prototype; var INVALID_DATE = 'Invalid Date'; var TO_STRING$1 = 'toString'; var nativeDateToString = DatePrototype[TO_STRING$1]; var getTime = DatePrototype.getTime; // `Date.prototype.toString` method // https://tc39.es/ecma262/#sec-date.prototype.tostring if (new Date(NaN) + '' != INVALID_DATE) { redefine$1(DatePrototype, TO_STRING$1, function toString() { var value = getTime.call(this); // eslint-disable-next-line no-self-compare -- NaN check return value === value ? nativeDateToString.call(this) : INVALID_DATE; }); } /** * @description 获取当前日期 * @param {String} seperator 连接字符 默认 - * @returns {String} 当前日期 * @example * getNowDate() => "2020-05-18" */ function getNowDate() { var seperator = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "-"; var showDate = new Date(); var year = showDate.getFullYear(); var month = showDate.getMonth() + 1; var strDate = showDate.getDate(); if (month >= 1 && month <= 9) { month = '0' + month; } if (strDate >= 0 && strDate <= 9) { strDate = '0' + strDate; } var currentdate = year + seperator + month + seperator + strDate; return currentdate; } var $propertyIsEnumerable$2 = {}.propertyIsEnumerable; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor$5 = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug var NASHORN_BUG$1 = getOwnPropertyDescriptor$5 && !$propertyIsEnumerable$2.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable var f$b = NASHORN_BUG$1 ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor$5(this, V); return !!descriptor && descriptor.enumerable; } : $propertyIsEnumerable$2; var objectPropertyIsEnumerable$1 = { f: f$b }; var toString$2 = {}.toString; var classofRaw$1 = function (it) { return toString$2.call(it).slice(8, -1); }; var split$1 = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings var indexedObject$1 = fails$1(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe return !Object('z').propertyIsEnumerable(0); }) ? function (it) { return classofRaw$1(it) == 'String' ? split$1.call(it, '') : Object(it); } : Object; // toObject with fallback for non-array-like ES3 strings var toIndexedObject$1 = function (it) { return indexedObject$1(requireObjectCoercible$1(it)); }; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor var f$a = descriptors$1 ? $getOwnPropertyDescriptor$2 : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject$1(O); P = toPrimitive$1(P, true); if (ie8DomDefine$1) try { return $getOwnPropertyDescriptor$2(O, P); } catch (error) { /* empty */ } if (has$3(O, P)) return createPropertyDescriptor$1(!objectPropertyIsEnumerable$1.f.call(O, P), O[P]); }; var objectGetOwnPropertyDescriptor$1 = { f: f$a }; var path$1 = global_1$1; var aFunction$3 = function (variable) { return typeof variable == 'function' ? variable : undefined; }; var getBuiltIn$1 = function (namespace, method) { return arguments.length < 2 ? aFunction$3(path$1[namespace]) || aFunction$3(global_1$1[namespace]) : path$1[namespace] && path$1[namespace][method] || global_1$1[namespace] && global_1$1[namespace][method]; }; var ceil$2 = Math.ceil; var floor$3 = Math.floor; // `ToInteger` abstract operation // https://tc39.es/ecma262/#sec-tointeger var toInteger$1 = function (argument) { return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$3 : ceil$2)(argument); }; var min$5 = Math.min; // `ToLength` abstract operation // https://tc39.es/ecma262/#sec-tolength var toLength$1 = function (argument) { return argument > 0 ? min$5(toInteger$1(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; var max$3 = Math.max; var min$4 = Math.min; // Helper for a popular repeating case of the spec: // Let integer be ? ToInteger(index). // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). var toAbsoluteIndex$1 = function (index, length) { var integer = toInteger$1(index); return integer < 0 ? max$3(integer + length, 0) : min$4(integer, length); }; // `Array.prototype.{ indexOf, includes }` methods implementation var createMethod$7 = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIndexedObject$1($this); var length = toLength$1(O.length); var index = toAbsoluteIndex$1(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare -- NaN check if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare -- NaN check if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) { if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; var arrayIncludes$1 = { // `Array.prototype.includes` method // https://tc39.es/ecma262/#sec-array.prototype.includes includes: createMethod$7(true), // `Array.prototype.indexOf` method // https://tc39.es/ecma262/#sec-array.prototype.indexof indexOf: createMethod$7(false) }; var indexOf$4 = arrayIncludes$1.indexOf; var objectKeysInternal$1 = function (object, names) { var O = toIndexedObject$1(object); var i = 0; var result = []; var key; for (key in O) !has$3(hiddenKeys$3, key) && has$3(O, key) && result.push(key); // Don't enum bug & hidden keys while (names.length > i) if (has$3(O, key = names[i++])) { ~indexOf$4(result, key) || result.push(key); } return result; }; // IE8- don't enum bug keys var enumBugKeys$1 = [ 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf' ]; var hiddenKeys$2 = enumBugKeys$1.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames // eslint-disable-next-line es/no-object-getownpropertynames -- safe var f$9 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return objectKeysInternal$1(O, hiddenKeys$2); }; var objectGetOwnPropertyNames$1 = { f: f$9 }; // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe var f$8 = Object.getOwnPropertySymbols; var objectGetOwnPropertySymbols$1 = { f: f$8 }; // all object keys, includes non-enumerable and symbols var ownKeys = getBuiltIn$1('Reflect', 'ownKeys') || function ownKeys(it) { var keys = objectGetOwnPropertyNames$1.f(anObject$1(it)); var getOwnPropertySymbols = objectGetOwnPropertySymbols$1.f; return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; }; var copyConstructorProperties = function (target, source) { var keys = ownKeys(source); var defineProperty = objectDefineProperty$1.f; var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor$1.f; for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (!has$3(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } }; var replacement$1 = /#|\.prototype\./; var isForced$1 = function (feature, detection) { var value = data$1[normalize$1(feature)]; return value == POLYFILL$1 ? true : value == NATIVE$1 ? false : typeof detection == 'function' ? fails$1(detection) : !!detection; }; var normalize$1 = isForced$1.normalize = function (string) { return String(string).replace(replacement$1, '.').toLowerCase(); }; var data$1 = isForced$1.data = {}; var NATIVE$1 = isForced$1.NATIVE = 'N'; var POLYFILL$1 = isForced$1.POLYFILL = 'P'; var isForced_1$1 = isForced$1; var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor$1.f; /* options.target - name of the target object options.global - target is the global object options.stat - export as static methods of target options.proto - export as prototype methods of target options.real - real prototype method for the `pure` version options.forced - export even if the native feature is available options.bind - bind methods to the target, required for the `pure` version options.wrap - wrap constructors to preventing global pollution, required for the `pure` version options.unsafe - use the simple assignment of property instead of delete + defineProperty options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.noTargetGet - prevent calling a getter on target */ var _export$1 = function (options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var FORCED, target, key, targetProperty, sourceProperty, descriptor; if (GLOBAL) { target = global_1$1; } else if (STATIC) { target = global_1$1[TARGET] || setGlobal$1(TARGET, {}); } else { target = (global_1$1[TARGET] || {}).prototype; } if (target) for (key in source) { sourceProperty = source[key]; if (options.noTargetGet) { descriptor = getOwnPropertyDescriptor$4(target, key); targetProperty = descriptor && descriptor.value; } else targetProperty = target[key]; FORCED = isForced_1$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contained in target if (!FORCED && targetProperty !== undefined) { if (typeof sourceProperty === typeof targetProperty) continue; copyConstructorProperties(sourceProperty, targetProperty); } // add a flag to not completely full polyfills if (options.sham || (targetProperty && targetProperty.sham)) { createNonEnumerableProperty$1(sourceProperty, 'sham', true); } // extend global redefine$1(target, key, sourceProperty, options); } }; // `RegExp.prototype.flags` getter implementation // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags var regexpFlags = function () { var that = anObject$1(this); var result = ''; if (that.global) result += 'g'; if (that.ignoreCase) result += 'i'; if (that.multiline) result += 'm'; if (that.dotAll) result += 's'; if (that.unicode) result += 'u'; if (that.sticky) result += 'y'; return result; }; // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError, var RE = function (s, f) { return RegExp(s, f); }; var UNSUPPORTED_Y$3 = fails$1(function () { var re = RE('a', 'y'); re.lastIndex = 2; return re.exec('abcd') != null; }); var BROKEN_CARET = fails$1(function () { // https://bugzilla.mozilla.org/show_bug.cgi?id=773687 var re = RE('^r', 'gy'); re.lastIndex = 2; return re.exec('str') != null; }); var regexpStickyHelpers = { UNSUPPORTED_Y: UNSUPPORTED_Y$3, BROKEN_CARET: BROKEN_CARET }; // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys // eslint-disable-next-line es/no-object-keys -- safe var objectKeys$1 = Object.keys || function keys(O) { return objectKeysInternal$1(O, enumBugKeys$1); }; // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties // eslint-disable-next-line es/no-object-defineproperties -- safe var objectDefineProperties$1 = descriptors$1 ? Object.defineProperties : function defineProperties(O, Properties) { anObject$1(O); var keys = objectKeys$1(Properties); var length = keys.length; var index = 0; var key; while (length > index) objectDefineProperty$1.f(O, key = keys[index++], Properties[key]); return O; }; var html$1 = getBuiltIn$1('document', 'documentElement'); var GT$1 = '>'; var LT$1 = '<'; var PROTOTYPE$2 = 'prototype'; var SCRIPT$1 = 'script'; var IE_PROTO$2 = sharedKey$1('IE_PROTO'); var EmptyConstructor$1 = function () { /* empty */ }; var scriptTag$1 = function (content) { return LT$1 + SCRIPT$1 + GT$1 + content + LT$1 + '/' + SCRIPT$1 + GT$1; }; // Create object with fake `null` prototype: use ActiveX Object with cleared prototype var NullProtoObjectViaActiveX$1 = function (activeXDocument) { activeXDocument.write(scriptTag$1('')); activeXDocument.close(); var temp = activeXDocument.parentWindow.Object; activeXDocument = null; // avoid memory leak return temp; }; // Create object with fake `null` prototype: use iframe Object with cleared prototype var NullProtoObjectViaIFrame$1 = function () { // Thrash, waste and sodomy: IE GC bug var iframe = documentCreateElement$1('iframe'); var JS = 'java' + SCRIPT$1 + ':'; var iframeDocument; iframe.style.display = 'none'; html$1.appendChild(iframe); // https://github.com/zloirock/core-js/issues/475 iframe.src = String(JS); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(scriptTag$1('document.F=Object')); iframeDocument.close(); return iframeDocument.F; }; // Check for document.domain and active x support // No need to use active x approach when document.domain is not set // see https://github.com/es-shims/es5-shim/issues/150 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 // avoid IE GC bug var activeXDocument$1; var NullProtoObject$1 = function () { try { /* global ActiveXObject -- old IE */ activeXDocument$1 = document.domain && new ActiveXObject('htmlfile'); } catch (error) { /* ignore */ } NullProtoObject$1 = activeXDocument$1 ? NullProtoObjectViaActiveX$1(activeXDocument$1) : NullProtoObjectViaIFrame$1(); var length = enumBugKeys$1.length; while (length--) delete NullProtoObject$1[PROTOTYPE$2][enumBugKeys$1[length]]; return NullProtoObject$1(); }; hiddenKeys$3[IE_PROTO$2] = true; // `Object.create` method // https://tc39.es/ecma262/#sec-object.create var objectCreate$1 = Object.create || function create(O, Properties) { var result; if (O !== null) { EmptyConstructor$1[PROTOTYPE$2] = anObject$1(O); result = new EmptyConstructor$1(); EmptyConstructor$1[PROTOTYPE$2] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO$2] = O; } else result = NullProtoObject$1(); return Properties === undefined ? result : objectDefineProperties$1(result, Properties); }; var regexpUnsupportedDotAll = fails$1(function () { // babel-minify transpiles RegExp('.', 's') -> /./s and it causes SyntaxError var re = RegExp('.', (typeof '').charAt(0)); return !(re.dotAll && re.exec('\n') && re.flags === 's'); }); var regexpUnsupportedNcg = fails$1(function () { // babel-minify transpiles RegExp('.', 'g') -> /./g and it causes SyntaxError var re = RegExp('(?<a>b)', (typeof '').charAt(5)); return re.exec('b').groups.a !== 'b' || 'b'.replace(re, '$<a>c') !== 'bc'; }); /* eslint-disable regexp/no-assertion-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */ /* eslint-disable regexp/no-useless-quantifier -- testing */ var getInternalState$4 = internalState$1.get; var nativeExec = RegExp.prototype.exec; var nativeReplace = shared$1('native-string-replace', String.prototype.replace); var patchedExec = nativeExec; var UPDATES_LAST_INDEX_WRONG = (function () { var re1 = /a/; var re2 = /b*/g; nativeExec.call(re1, 'a'); nativeExec.call(re2, 'a'); return re1.lastIndex !== 0 || re2.lastIndex !== 0; })(); var UNSUPPORTED_Y$2 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET; // nonparticipating capturing group, copied from es5-shim's String#split patch. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$2 || regexpUnsupportedDotAll || regexpUnsupportedNcg; if (PATCH) { // eslint-disable-next-line max-statements -- TODO patchedExec = function exec(str) { var re = this; var state = getInternalState$4(re); var raw = state.raw; var result, reCopy, lastIndex, match, i, object, group; if (raw) { raw.lastIndex = re.lastIndex; result = patchedExec.call(raw, str); re.lastIndex = raw.lastIndex; return result; } var groups = state.groups; var sticky = UNSUPPORTED_Y$2 && re.sticky; var flags = regexpFlags.call(re); var source = re.source; var charsAdded = 0; var strCopy = str; if (sticky) { flags = flags.replace('y', ''); if (flags.indexOf('g') === -1) { flags += 'g'; } strCopy = String(str).slice(re.lastIndex); // Support anchored sticky behavior. if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) { source = '(?: ' + source + ')'; strCopy = ' ' + strCopy; charsAdded++; } // ^(? + rx + ) is needed, in combination with some str slicing, to // simulate the 'y' flag. reCopy = new RegExp('^(?:' + source + ')', flags); } if (NPCG_INCLUDED) { reCopy = new RegExp('^' + source + '$(?!\\s)', flags); } if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex; match = nativeExec.call(sticky ? reCopy : re, strCopy); if (sticky) { if (match) { match.input = match.input.slice(charsAdded); match[0] = match[0].slice(charsAdded); match.index = re.lastIndex; re.lastIndex += match[0].length; } else re.lastIndex = 0; } else if (UPDATES_LAST_INDEX_WRONG && match) { re.lastIndex = re.global ? match.index + match[0].length : lastIndex; } if (NPCG_INCLUDED && match && match.length > 1) { // Fix browsers whose `exec` methods don't consistently return `undefined` // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ nativeReplace.call(match[0], reCopy, function () { for (i = 1; i < arguments.length - 2; i++) { if (arguments[i] === undefined) match[i] = undefined; } }); } if (match && groups) { match.groups = object = objectCreate$1(null); for (i = 0; i < groups.length; i++) { group = groups[i]; object[group[0]] = match[group[1]]; } } return match; }; } var regexpExec = patchedExec; // `RegExp.prototype.exec` method // https://tc39.es/ecma262/#sec-regexp.prototype.exec _export$1({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, { exec: regexpExec }); var engineUserAgent$1 = getBuiltIn$1('navigator', 'userAgent') || ''; var process$4 = global_1$1.process; var versions$1 = process$4 && process$4.versions; var v8$1 = versions$1 && versions$1.v8; var match$1, version$1; if (v8$1) { match$1 = v8$1.split('.'); version$1 = match$1[0] < 4 ? 1 : match$1[0] + match$1[1]; } else if (engineUserAgent$1) { match$1 = engineUserAgent$1.match(/Edge\/(\d+)/); if (!match$1 || match$1[1] >= 74) { match$1 = engineUserAgent$1.match(/Chrome\/(\d+)/); if (match$1) version$1 = match$1[1]; } } var engineV8Version$1 = version$1 && +version$1; /* eslint-disable es/no-symbol -- required for testing */ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing var nativeSymbol$1 = !!Object.getOwnPropertySymbols && !fails$1(function () { var symbol = Symbol(); // Chrome 38 Symbol has incorrect toString conversion // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances return !String(symbol) || !(Object(symbol) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances !Symbol.sham && engineV8Version$1 && engineV8Version$1 < 41; }); /* eslint-disable es/no-symbol -- required for testing */ var useSymbolAsUid$1 = nativeSymbol$1 && !Symbol.sham && typeof Symbol.iterator == 'symbol'; var WellKnownSymbolsStore$2 = shared$1('wks'); var Symbol$2 = global_1$1.Symbol; var createWellKnownSymbol$1 = useSymbolAsUid$1 ? Symbol$2 : Symbol$2 && Symbol$2.withoutSetter || uid$1; var wellKnownSymbol$1 = function (name) { if (!has$3(WellKnownSymbolsStore$2, name) || !(nativeSymbol$1 || typeof WellKnownSymbolsStore$2[name] == 'string')) { if (nativeSymbol$1 && has$3(Symbol$2, name)) { WellKnownSymbolsStore$2[name] = Symbol$2[name]; } else { WellKnownSymbolsStore$2[name] = createWellKnownSymbol$1('Symbol.' + name); } } return WellKnownSymbolsStore$2[name]; }; // TODO: Remove from `core-js@4` since it's moved to entry points var SPECIES$8 = wellKnownSymbol$1('species'); var RegExpPrototype$2 = RegExp.prototype; var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) { var SYMBOL = wellKnownSymbol$1(KEY); var DELEGATES_TO_SYMBOL = !fails$1(function () { // String methods call symbol-named RegEp methods var O = {}; O[SYMBOL] = function () { return 7; }; return ''[KEY](O) != 7; }); var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$1(function () { // Symbol-named RegExp methods call .exec var execCalled = false; var re = /a/; if (KEY === 'split') { // We can't use real regex here since it causes deoptimization // and serious performance degradation in V8 // https://github.com/zloirock/core-js/issues/306 re = {}; // RegExp[@@split] doesn't call the regex's exec method, but first creates // a new one. We need to return the patched regex when creating the new one. re.constructor = {}; re.constructor[SPECIES$8] = function () { return re; }; re.flags = ''; re[SYMBOL] = /./[SYMBOL]; } re.exec = function () { execCalled = true; return null; }; re[SYMBOL](''); return !execCalled; }); if ( !DELEGATES_TO_SYMBOL || !DELEGATES_TO_EXEC || FORCED ) { var nativeRegExpMethod = /./[SYMBOL]; var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { var $exec = regexp.exec; if ($exec === regexpExec || $exec === RegExpPrototype$2.exec) { if (DELEGATES_TO_SYMBOL && !forceStringMethod) { // The native String method already delegates to @@method (this // polyfilled function), leasing to infinite recursion. // We avoid it by directly calling the native @@method method. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; } return { done: true, value: nativeMethod.call(str, regexp, arg2) }; } return { done: false }; }); redefine$1(String.prototype, KEY, methods[0]); redefine$1(RegExpPrototype$2, SYMBOL, methods[1]); } if (SHAM) createNonEnumerableProperty$1(RegExpPrototype$2[SYMBOL], 'sham', true); }; // `String.prototype.{ codePointAt, at }` methods implementation var createMethod$6 = function (CONVERT_TO_STRING) { return function ($this, pos) { var S = String(requireObjectCoercible$1($this)); var position = toInteger$1(pos); var size = S.length; var first, second; if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; first = S.charCodeAt(position); return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? S.charAt(position) : first : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; }; }; var stringMultibyte$1 = { // `String.prototype.codePointAt` method // https://tc39.es/ecma262/#sec-string.prototype.codepointat codeAt: createMethod$6(false), // `String.prototype.at` method // https://github.com/mathiasbynens/String.prototype.at charAt: createMethod$6(true) }; var charAt$1 = stringMultibyte$1.charAt; // `AdvanceStringIndex` abstract operation // https://tc39.es/ecma262/#sec-advancestringindex var advanceStringIndex = function (S, index, unicode) { return index + (unicode ? charAt$1(S, index).length : 1); }; var floor$2 = Math.floor; var replace = ''.replace; var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g; var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g; // `GetSubstitution` abstract operation // 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$1(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$2(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; }); }; // `RegExpExec` abstract operation // https://tc39.es/ecma262/#sec-regexpexec var regexpExecAbstract = function (R, S) { var exec = R.exec; if (typeof exec === 'function') { var result = exec.call(R, S); if (typeof result !== 'object') { throw TypeError('RegExp exec method returned something other than an Object or null'); } return result; } if (classofRaw$1(R) !== 'RegExp') { throw TypeError('RegExp#exec called on incompatible receiver'); } return regexpExec.call(R, S); }; var REPLACE = wellKnownSymbol$1('replace'); var max$2 = Math.max; var min$3 = Math.min; var maybeToString = function (it) { return it === undefined ? it : String(it); }; // IE <= 11 replaces $0 with the whole match, as if it was $& // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0 var REPLACE_KEEPS_$0 = (function () { // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing return 'a'.replace(/./, '$0') === '$0'; })(); // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () { if (/./[REPLACE]) { return /./[REPLACE]('a', '$0') === ''; } return false; })(); var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$1(function () { var re = /./; re.exec = function () { var result = []; result.groups = { a: '7' }; return result; }; return ''.replace(re, '$<a>') !== '7'; }); // @@replace logic fixRegexpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) { var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0'; return [ // `String.prototype.replace` method // https://tc39.es/ecma262/#sec-string.prototype.replace function replace(searchValue, replaceValue) { var O = requireObjectCoercible$1(this); var replacer = searchValue == undefined ? undefined : searchValue[REPLACE]; return replacer !== undefined ? replacer.call(searchValue, O, replaceValue) : nativeReplace.call(String(O), searchValue, replaceValue); }, // `RegExp.prototype[@@replace]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace function (string, replaceValue) { if ( typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1 && replaceValue.indexOf('$<') === -1 ) { var res = maybeCallNative(nativeReplace, this, string, replaceValue); if (res.done) return res.value; } var rx = anObject$1(this); var S = String(string); var functionalReplace = typeof replaceValue === 'function'; if (!functionalReplace) replaceValue = String(replaceValue); var global = rx.global; if (global) { var fullUnicode = rx.unicode; rx.lastIndex = 0; } var results = []; while (true) { var result = regexpExecAbstract(rx, S); if (result === null) break; results.push(result); if (!global) break; var matchStr = String(result[0]); if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength$1(rx.lastIndex), fullUnicode); } var accumulatedResult = ''; var nextSourcePosition = 0; for (var i = 0; i < results.length; i++) { result = results[i]; var matched = String(result[0]); var position = max$2(min$3(toInteger$1(result.index), S.length), 0); var captures = []; // NOTE: This is equivalent to // captures = result.slice(1).map(maybeToString) // but for some reason `nativeSlice.call(result, 1, result.length)` (called in // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j])); var namedCaptures = result.groups; if (functionalReplace) { var replacerArgs = [matched].concat(captures, position, S); if (namedCaptures !== undefined) replacerArgs.push(namedCaptures); var replacement = String(replaceValue.apply(undefined, replacerArgs)); } else { replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); } if (position >= nextSourcePosition) { accumulatedResult += S.slice(nextSourcePosition, position) + replacement; nextSourcePosition = position + matched.length; } } return accumulatedResult + S.slice(nextSourcePosition); } ]; }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE); var check = function (it) { return it && it.Math == Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global_1 = // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func -- fallback (function () { return this; })() || Function('return this')(); var fails = function (exec) { try { return !!exec(); } catch (error) { return true; } }; // Detect IE8's incomplete defineProperty implementation var descriptors = !fails(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); var $propertyIsEnumerable$1 = {}.propertyIsEnumerable; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor$3 = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug var NASHORN_BUG = getOwnPropertyDescriptor$3 && !$propertyIsEnumerable$1.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable var f$7 = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor$3(this, V); return !!descriptor && descriptor.enumerable; } : $propertyIsEnumerable$1; var objectPropertyIsEnumerable = { f: f$7 }; var createPropertyDescriptor = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; var toString$1 = {}.toString; var classofRaw = function (it) { return toString$1.call(it).slice(8, -1); }; var split = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings var indexedObject = fails(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe return !Object('z').propertyIsEnumerable(0); }) ? function (it) { return classofRaw(it) == 'String' ? split.call(it, '') : Object(it); } : Object; // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible var requireObjectCoercible = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; // toObject with fallback for non-array-like ES3 strings var toIndexedObject = function (it) { return indexedObject(requireObjectCoercible(it)); }; var isObject = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; // `ToPrimitive` abstract operation // 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) { if (!isObject(input)) return input; var fn, val; if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; throw TypeError("Can't convert object to primitive value"); }; // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject var toObject = function (argument) { return Object(requireObjectCoercible(argument)); }; var hasOwnProperty = {}.hasOwnProperty; var has$1 = Object.hasOwn || function hasOwn(it, key) { return hasOwnProperty.call(toObject(it), key); }; var document$3 = global_1.document; // typeof document.createElement is 'object' in old IE var EXISTS = isObject(document$3) && isObject(document$3.createElement); var documentCreateElement = function (it) { return EXISTS ? document$3.createElement(it) : {}; }; // Thank's IE8 for his funny defineProperty var ie8DomDefine = !descriptors && !fails(function () { // eslint-disable-next-line es/no-object-defineproperty -- requied for testing return Object.defineProperty(documentCreateElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor var f$6 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPrimitive(P, true); if (ie8DomDefine) try { return $getOwnPropertyDescriptor$1(O, P); } catch (error) { /* empty */ } if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); }; var objectGetOwnPropertyDescriptor = { f: f$6 }; var replacement = /#|\.prototype\./; var isForced = function (feature, detection) { var value = data[normalize(feature)]; return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection; }; var normalize = isForced.normalize = function (string) { return String(string).replace(replacement, '.').toLowerCase(); }; var data = isForced.data = {}; var NATIVE = isForced.NATIVE = 'N'; var POLYFILL = isForced.POLYFILL = 'P'; var isForced_1 = isForced; var path = {}; var aFunction$2 = function (it) { if (typeof it != 'function') { throw TypeError(String(it) + ' is not a function'); } return it; }; // optional / simple context binding var functionBindContext = function (fn, that, length) { aFunction$2(fn); if (that === undefined) return fn; switch (length) { case 0: return function () { return fn.call(that); }; case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; var anObject = function (it) { if (!isObject(it)) { throw TypeError(String(it) + ' is not an object'); } return it; }; // eslint-disable-next-line es/no-object-defineproperty -- safe var $defineProperty$1 = Object.defineProperty; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty var f$5 = descriptors ? $defineProperty$1 : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (ie8DomDefine) try { return $defineProperty$1(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; var objectDefineProperty = { f: f$5 }; var createNonEnumerableProperty = descriptors ? function (object, key, value) { return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value)); } : function (object, key, value) { object[key] = value; return object; }; var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; var wrapConstructor = function (NativeConstructor) { var Wrapper = function (a, b, c) { if (this instanceof NativeConstructor) { switch (arguments.length) { case 0: return new NativeConstructor(); case 1: return new NativeConstructor(a); case 2: return new NativeConstructor(a, b); } return new NativeConstructor(a, b, c); } return NativeConstructor.apply(this, arguments); }; Wrapper.prototype = NativeConstructor.prototype; return Wrapper; }; /* options.target - name of the target object options.global - target is the global object options.stat - export as static methods of target options.proto - export as prototype methods of target options.real - real prototype method for the `pure` version options.forced - export even if the native feature is available options.bind - bind methods to the target, required for the `pure` version options.wrap - wrap constructors to preventing global pollution, required for the `pure` version options.unsafe - use the simple assignment of property instead of delete + defineProperty options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.noTargetGet - prevent calling a getter on target */ var _export = function (options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var PROTO = options.proto; var nativeSource = GLOBAL ? global_1 : STATIC ? global_1[TARGET] : (global_1[TARGET] || {}).prototype; var target = GLOBAL ? path : path[TARGET] || (path[TARGET] = {}); var targetPrototype = target.prototype; var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE; var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor; for (key in sour