@near-wallet-selector/core
Version:
This is the core package for NEAR Wallet Selector.
1,487 lines (1,230 loc) • 267 kB
JavaScript
import * as nearAPI from 'near-api-js';
import { utils, providers } from 'near-api-js';
import { JsonRpcProvider } from 'near-api-js/lib/providers/index.js';
import { EventEmitter as EventEmitter$1 } from 'events';
import { BehaviorSubject, Subject, scan } from 'rxjs';
import { serialize } from 'borsh';
import { sha256 } from 'js-sha256';
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
class Provider {
constructor(urls) {
this.provider = new nearAPI.providers.FailoverRpcProvider(this.urlsToProviders(urls));
}
query(paramsOrPath, data) {
if (typeof paramsOrPath === "string" && data !== undefined) {
return this.provider.query(paramsOrPath, data);
} else {
return this.provider.query(paramsOrPath);
}
}
viewAccessKey({
accountId,
publicKey
}) {
return this.query({
request_type: "view_access_key",
finality: "final",
account_id: accountId,
public_key: publicKey
});
}
block(reference) {
return this.provider.block(reference);
}
sendTransaction(signedTransaction) {
return this.provider.sendTransaction(signedTransaction);
}
urlsToProviders(urls) {
return urls && urls.length > 0 ? urls.map(url => new JsonRpcProvider({
url
})) : [];
}
}
const KEY_DELIMITER = ":";
class JsonStorage {
constructor(storage, namespace) {
this.storage = storage;
this.namespace = Array.isArray(namespace) ? namespace.join(KEY_DELIMITER) : namespace;
}
resolveKey(key) {
return [this.namespace, key].join(KEY_DELIMITER);
}
getItem(key) {
return this.storage.getItem(this.resolveKey(key)).then(item => {
return typeof item === "string" ? JSON.parse(item) : null;
});
}
setItem(key, value) {
return this.storage.setItem(this.resolveKey(key), JSON.stringify(value));
}
removeItem(key) {
return this.storage.removeItem(this.resolveKey(key));
}
}
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var check = function (it) {
return it && it.Math === Math && it;
};
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var globalThis_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) ||
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
// eslint-disable-next-line no-new-func -- fallback
(function () { return this; })() || Function('return this')();
var objectGetOwnPropertyDescriptor = {};
var fails$r = function (exec) {
try {
return !!exec();
} catch (error) {
return true;
}
};
var fails$q = fails$r;
// Detect IE8's incomplete defineProperty implementation
var descriptors = !fails$q(function () {
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
});
var fails$p = fails$r;
var functionBindNative = !fails$p(function () {
// eslint-disable-next-line es/no-function-prototype-bind -- safe
var test = (function () { /* empty */ }).bind();
// eslint-disable-next-line no-prototype-builtins -- safe
return typeof test != 'function' || test.hasOwnProperty('prototype');
});
var NATIVE_BIND$3 = functionBindNative;
var call$i = Function.prototype.call;
// eslint-disable-next-line es/no-function-prototype-bind -- safe
var functionCall = NATIVE_BIND$3 ? call$i.bind(call$i) : function () {
return call$i.apply(call$i, arguments);
};
var objectPropertyIsEnumerable = {};
var $propertyIsEnumerable = {}.propertyIsEnumerable;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
// Nashorn ~ JDK8 bug
var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
// `Object.prototype.propertyIsEnumerable` method implementation
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
var descriptor = getOwnPropertyDescriptor$2(this, V);
return !!descriptor && descriptor.enumerable;
} : $propertyIsEnumerable;
var createPropertyDescriptor$4 = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
var NATIVE_BIND$2 = functionBindNative;
var FunctionPrototype$2 = Function.prototype;
var call$h = FunctionPrototype$2.call;
// eslint-disable-next-line es/no-function-prototype-bind -- safe
var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$h, call$h);
var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
return function () {
return call$h.apply(fn, arguments);
};
};
var uncurryThis$n = functionUncurryThis;
var toString$6 = uncurryThis$n({}.toString);
var stringSlice$2 = uncurryThis$n(''.slice);
var classofRaw$2 = function (it) {
return stringSlice$2(toString$6(it), 8, -1);
};
var uncurryThis$m = functionUncurryThis;
var fails$o = fails$r;
var classof$b = classofRaw$2;
var $Object$4 = Object;
var split = uncurryThis$m(''.split);
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var indexedObject = fails$o(function () {
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
// eslint-disable-next-line no-prototype-builtins -- safe
return !$Object$4('z').propertyIsEnumerable(0);
}) ? function (it) {
return classof$b(it) === 'String' ? split(it, '') : $Object$4(it);
} : $Object$4;
// we can't use just `it == null` since of `document.all` special case
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
var isNullOrUndefined$4 = function (it) {
return it === null || it === undefined;
};
var isNullOrUndefined$3 = isNullOrUndefined$4;
var $TypeError$g = TypeError;
// `RequireObjectCoercible` abstract operation
// https://tc39.es/ecma262/#sec-requireobjectcoercible
var requireObjectCoercible$5 = function (it) {
if (isNullOrUndefined$3(it)) throw new $TypeError$g("Can't call method on " + it);
return it;
};
// toObject with fallback for non-array-like ES3 strings
var IndexedObject$3 = indexedObject;
var requireObjectCoercible$4 = requireObjectCoercible$5;
var toIndexedObject$6 = function (it) {
return IndexedObject$3(requireObjectCoercible$4(it));
};
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
var documentAll = typeof document == 'object' && document.all;
// `IsCallable` abstract operation
// https://tc39.es/ecma262/#sec-iscallable
// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
var isCallable$l = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
return typeof argument == 'function' || argument === documentAll;
} : function (argument) {
return typeof argument == 'function';
};
var isCallable$k = isCallable$l;
var isObject$g = function (it) {
return typeof it == 'object' ? it !== null : isCallable$k(it);
};
var globalThis$t = globalThis_1;
var isCallable$j = isCallable$l;
var aFunction = function (argument) {
return isCallable$j(argument) ? argument : undefined;
};
var getBuiltIn$7 = function (namespace, method) {
return arguments.length < 2 ? aFunction(globalThis$t[namespace]) : globalThis$t[namespace] && globalThis$t[namespace][method];
};
var uncurryThis$l = functionUncurryThis;
var objectIsPrototypeOf = uncurryThis$l({}.isPrototypeOf);
var globalThis$s = globalThis_1;
var navigator$1 = globalThis$s.navigator;
var userAgent$7 = navigator$1 && navigator$1.userAgent;
var environmentUserAgent = userAgent$7 ? String(userAgent$7) : '';
var globalThis$r = globalThis_1;
var userAgent$6 = environmentUserAgent;
var process$3 = globalThis$r.process;
var Deno$1 = globalThis$r.Deno;
var versions = process$3 && process$3.versions || Deno$1 && Deno$1.version;
var v8 = versions && versions.v8;
var match, version;
if (v8) {
match = v8.split('.');
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
// but their correct versions are not interesting for us
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
}
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
// so check `userAgent` even if `.v8` exists, but 0
if (!version && userAgent$6) {
match = userAgent$6.match(/Edge\/(\d+)/);
if (!match || match[1] >= 74) {
match = userAgent$6.match(/Chrome\/(\d+)/);
if (match) version = +match[1];
}
}
var environmentV8Version = version;
/* eslint-disable es/no-symbol -- required for testing */
var V8_VERSION$1 = environmentV8Version;
var fails$n = fails$r;
var globalThis$q = globalThis_1;
var $String$5 = globalThis$q.String;
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$n(function () {
var symbol = Symbol('symbol detection');
// Chrome 38 Symbol has incorrect toString conversion
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
// of course, fail.
return !$String$5(symbol) || !(Object(symbol) instanceof Symbol) ||
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
!Symbol.sham && V8_VERSION$1 && V8_VERSION$1 < 41;
});
/* eslint-disable es/no-symbol -- required for testing */
var NATIVE_SYMBOL$1 = symbolConstructorDetection;
var useSymbolAsUid = NATIVE_SYMBOL$1 &&
!Symbol.sham &&
typeof Symbol.iterator == 'symbol';
var getBuiltIn$6 = getBuiltIn$7;
var isCallable$i = isCallable$l;
var isPrototypeOf$4 = objectIsPrototypeOf;
var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
var $Object$3 = Object;
var isSymbol$3 = USE_SYMBOL_AS_UID$1 ? function (it) {
return typeof it == 'symbol';
} : function (it) {
var $Symbol = getBuiltIn$6('Symbol');
return isCallable$i($Symbol) && isPrototypeOf$4($Symbol.prototype, $Object$3(it));
};
var $String$4 = String;
var tryToString$6 = function (argument) {
try {
return $String$4(argument);
} catch (error) {
return 'Object';
}
};
var isCallable$h = isCallable$l;
var tryToString$5 = tryToString$6;
var $TypeError$f = TypeError;
// `Assert: IsCallable(argument) is true`
var aCallable$b = function (argument) {
if (isCallable$h(argument)) return argument;
throw new $TypeError$f(tryToString$5(argument) + ' is not a function');
};
var aCallable$a = aCallable$b;
var isNullOrUndefined$2 = isNullOrUndefined$4;
// `GetMethod` abstract operation
// https://tc39.es/ecma262/#sec-getmethod
var getMethod$3 = function (V, P) {
var func = V[P];
return isNullOrUndefined$2(func) ? undefined : aCallable$a(func);
};
var call$g = functionCall;
var isCallable$g = isCallable$l;
var isObject$f = isObject$g;
var $TypeError$e = TypeError;
// `OrdinaryToPrimitive` abstract operation
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
var ordinaryToPrimitive$1 = function (input, pref) {
var fn, val;
if (pref === 'string' && isCallable$g(fn = input.toString) && !isObject$f(val = call$g(fn, input))) return val;
if (isCallable$g(fn = input.valueOf) && !isObject$f(val = call$g(fn, input))) return val;
if (pref !== 'string' && isCallable$g(fn = input.toString) && !isObject$f(val = call$g(fn, input))) return val;
throw new $TypeError$e("Can't convert object to primitive value");
};
var sharedStore = {exports: {}};
var globalThis$p = globalThis_1;
// eslint-disable-next-line es/no-object-defineproperty -- safe
var defineProperty$6 = Object.defineProperty;
var defineGlobalProperty$3 = function (key, value) {
try {
defineProperty$6(globalThis$p, key, { value: value, configurable: true, writable: true });
} catch (error) {
globalThis$p[key] = value;
} return value;
};
var globalThis$o = globalThis_1;
var defineGlobalProperty$2 = defineGlobalProperty$3;
var SHARED = '__core-js_shared__';
var store$3 = sharedStore.exports = globalThis$o[SHARED] || defineGlobalProperty$2(SHARED, {});
(store$3.versions || (store$3.versions = [])).push({
version: '3.41.0',
mode: 'global',
copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
license: 'https://github.com/zloirock/core-js/blob/v3.41.0/LICENSE',
source: 'https://github.com/zloirock/core-js'
});
var store$2 = sharedStore.exports;
var shared$4 = function (key, value) {
return store$2[key] || (store$2[key] = value || {});
};
var requireObjectCoercible$3 = requireObjectCoercible$5;
var $Object$2 = Object;
// `ToObject` abstract operation
// https://tc39.es/ecma262/#sec-toobject
var toObject$8 = function (argument) {
return $Object$2(requireObjectCoercible$3(argument));
};
var uncurryThis$k = functionUncurryThis;
var toObject$7 = toObject$8;
var hasOwnProperty = uncurryThis$k({}.hasOwnProperty);
// `HasOwnProperty` abstract operation
// https://tc39.es/ecma262/#sec-hasownproperty
// eslint-disable-next-line es/no-object-hasown -- safe
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
return hasOwnProperty(toObject$7(it), key);
};
var uncurryThis$j = functionUncurryThis;
var id = 0;
var postfix = Math.random();
var toString$5 = uncurryThis$j(1.0.toString);
var uid$3 = function (key) {
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$5(++id + postfix, 36);
};
var globalThis$n = globalThis_1;
var shared$3 = shared$4;
var hasOwn$b = hasOwnProperty_1;
var uid$2 = uid$3;
var NATIVE_SYMBOL = symbolConstructorDetection;
var USE_SYMBOL_AS_UID = useSymbolAsUid;
var Symbol$1 = globalThis$n.Symbol;
var WellKnownSymbolsStore = shared$3('wks');
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$2;
var wellKnownSymbol$i = function (name) {
if (!hasOwn$b(WellKnownSymbolsStore, name)) {
WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$b(Symbol$1, name)
? Symbol$1[name]
: createWellKnownSymbol('Symbol.' + name);
} return WellKnownSymbolsStore[name];
};
var call$f = functionCall;
var isObject$e = isObject$g;
var isSymbol$2 = isSymbol$3;
var getMethod$2 = getMethod$3;
var ordinaryToPrimitive = ordinaryToPrimitive$1;
var wellKnownSymbol$h = wellKnownSymbol$i;
var $TypeError$d = TypeError;
var TO_PRIMITIVE = wellKnownSymbol$h('toPrimitive');
// `ToPrimitive` abstract operation
// https://tc39.es/ecma262/#sec-toprimitive
var toPrimitive$2 = function (input, pref) {
if (!isObject$e(input) || isSymbol$2(input)) return input;
var exoticToPrim = getMethod$2(input, TO_PRIMITIVE);
var result;
if (exoticToPrim) {
if (pref === undefined) pref = 'default';
result = call$f(exoticToPrim, input, pref);
if (!isObject$e(result) || isSymbol$2(result)) return result;
throw new $TypeError$d("Can't convert object to primitive value");
}
if (pref === undefined) pref = 'number';
return ordinaryToPrimitive(input, pref);
};
var toPrimitive$1 = toPrimitive$2;
var isSymbol$1 = isSymbol$3;
// `ToPropertyKey` abstract operation
// https://tc39.es/ecma262/#sec-topropertykey
var toPropertyKey$3 = function (argument) {
var key = toPrimitive$1(argument, 'string');
return isSymbol$1(key) ? key : key + '';
};
var globalThis$m = globalThis_1;
var isObject$d = isObject$g;
var document$3 = globalThis$m.document;
// typeof document.createElement is 'object' in old IE
var EXISTS$1 = isObject$d(document$3) && isObject$d(document$3.createElement);
var documentCreateElement$2 = function (it) {
return EXISTS$1 ? document$3.createElement(it) : {};
};
var DESCRIPTORS$e = descriptors;
var fails$m = fails$r;
var createElement$1 = documentCreateElement$2;
// Thanks to IE8 for its funny defineProperty
var ie8DomDefine = !DESCRIPTORS$e && !fails$m(function () {
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
return Object.defineProperty(createElement$1('div'), 'a', {
get: function () { return 7; }
}).a !== 7;
});
var DESCRIPTORS$d = descriptors;
var call$e = functionCall;
var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
var createPropertyDescriptor$3 = createPropertyDescriptor$4;
var toIndexedObject$5 = toIndexedObject$6;
var toPropertyKey$2 = toPropertyKey$3;
var hasOwn$a = hasOwnProperty_1;
var IE8_DOM_DEFINE$1 = ie8DomDefine;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
// `Object.getOwnPropertyDescriptor` method
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$d ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
O = toIndexedObject$5(O);
P = toPropertyKey$2(P);
if (IE8_DOM_DEFINE$1) try {
return $getOwnPropertyDescriptor$1(O, P);
} catch (error) { /* empty */ }
if (hasOwn$a(O, P)) return createPropertyDescriptor$3(!call$e(propertyIsEnumerableModule$1.f, O, P), O[P]);
};
var objectDefineProperty = {};
var DESCRIPTORS$c = descriptors;
var fails$l = fails$r;
// V8 ~ Chrome 36-
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
var v8PrototypeDefineBug = DESCRIPTORS$c && fails$l(function () {
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
value: 42,
writable: false
}).prototype !== 42;
});
var isObject$c = isObject$g;
var $String$3 = String;
var $TypeError$c = TypeError;
// `Assert: Type(argument) is Object`
var anObject$b = function (argument) {
if (isObject$c(argument)) return argument;
throw new $TypeError$c($String$3(argument) + ' is not an object');
};
var DESCRIPTORS$b = descriptors;
var IE8_DOM_DEFINE = ie8DomDefine;
var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
var anObject$a = anObject$b;
var toPropertyKey$1 = toPropertyKey$3;
var $TypeError$b = TypeError;
// eslint-disable-next-line es/no-object-defineproperty -- safe
var $defineProperty = Object.defineProperty;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var ENUMERABLE = 'enumerable';
var CONFIGURABLE$1 = 'configurable';
var WRITABLE = 'writable';
// `Object.defineProperty` method
// https://tc39.es/ecma262/#sec-object.defineproperty
objectDefineProperty.f = DESCRIPTORS$b ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
anObject$a(O);
P = toPropertyKey$1(P);
anObject$a(Attributes);
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
var current = $getOwnPropertyDescriptor(O, P);
if (current && current[WRITABLE]) {
O[P] = Attributes.value;
Attributes = {
configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
writable: false
};
}
} return $defineProperty(O, P, Attributes);
} : $defineProperty : function defineProperty(O, P, Attributes) {
anObject$a(O);
P = toPropertyKey$1(P);
anObject$a(Attributes);
if (IE8_DOM_DEFINE) try {
return $defineProperty(O, P, Attributes);
} catch (error) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$b('Accessors not supported');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
var DESCRIPTORS$a = descriptors;
var definePropertyModule$4 = objectDefineProperty;
var createPropertyDescriptor$2 = createPropertyDescriptor$4;
var createNonEnumerableProperty$7 = DESCRIPTORS$a ? function (object, key, value) {
return definePropertyModule$4.f(object, key, createPropertyDescriptor$2(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
var makeBuiltIn$3 = {exports: {}};
var DESCRIPTORS$9 = descriptors;
var hasOwn$9 = hasOwnProperty_1;
var FunctionPrototype$1 = Function.prototype;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getDescriptor = DESCRIPTORS$9 && Object.getOwnPropertyDescriptor;
var EXISTS = hasOwn$9(FunctionPrototype$1, 'name');
// additional protection from minified / mangled / dropped function names
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
var CONFIGURABLE = EXISTS && (!DESCRIPTORS$9 || (DESCRIPTORS$9 && getDescriptor(FunctionPrototype$1, 'name').configurable));
var functionName = {
EXISTS: EXISTS,
PROPER: PROPER,
CONFIGURABLE: CONFIGURABLE
};
var uncurryThis$i = functionUncurryThis;
var isCallable$f = isCallable$l;
var store$1 = sharedStore.exports;
var functionToString = uncurryThis$i(Function.toString);
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
if (!isCallable$f(store$1.inspectSource)) {
store$1.inspectSource = function (it) {
return functionToString(it);
};
}
var inspectSource$3 = store$1.inspectSource;
var globalThis$l = globalThis_1;
var isCallable$e = isCallable$l;
var WeakMap$1 = globalThis$l.WeakMap;
var weakMapBasicDetection = isCallable$e(WeakMap$1) && /native code/.test(String(WeakMap$1));
var shared$2 = shared$4;
var uid$1 = uid$3;
var keys = shared$2('keys');
var sharedKey$3 = function (key) {
return keys[key] || (keys[key] = uid$1(key));
};
var hiddenKeys$4 = {};
var NATIVE_WEAK_MAP = weakMapBasicDetection;
var globalThis$k = globalThis_1;
var isObject$b = isObject$g;
var createNonEnumerableProperty$6 = createNonEnumerableProperty$7;
var hasOwn$8 = hasOwnProperty_1;
var shared$1 = sharedStore.exports;
var sharedKey$2 = sharedKey$3;
var hiddenKeys$3 = hiddenKeys$4;
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
var TypeError$3 = globalThis$k.TypeError;
var WeakMap = globalThis$k.WeakMap;
var set$2, get$1, has;
var enforce = function (it) {
return has(it) ? get$1(it) : set$2(it, {});
};
var getterFor = function (TYPE) {
return function (it) {
var state;
if (!isObject$b(it) || (state = get$1(it)).type !== TYPE) {
throw new TypeError$3('Incompatible receiver, ' + TYPE + ' required');
} return state;
};
};
if (NATIVE_WEAK_MAP || shared$1.state) {
var store = shared$1.state || (shared$1.state = new WeakMap());
/* eslint-disable no-self-assign -- prototype methods protection */
store.get = store.get;
store.has = store.has;
store.set = store.set;
/* eslint-enable no-self-assign -- prototype methods protection */
set$2 = function (it, metadata) {
if (store.has(it)) throw new TypeError$3(OBJECT_ALREADY_INITIALIZED);
metadata.facade = it;
store.set(it, metadata);
return metadata;
};
get$1 = function (it) {
return store.get(it) || {};
};
has = function (it) {
return store.has(it);
};
} else {
var STATE = sharedKey$2('state');
hiddenKeys$3[STATE] = true;
set$2 = function (it, metadata) {
if (hasOwn$8(it, STATE)) throw new TypeError$3(OBJECT_ALREADY_INITIALIZED);
metadata.facade = it;
createNonEnumerableProperty$6(it, STATE, metadata);
return metadata;
};
get$1 = function (it) {
return hasOwn$8(it, STATE) ? it[STATE] : {};
};
has = function (it) {
return hasOwn$8(it, STATE);
};
}
var internalState = {
set: set$2,
get: get$1,
has: has,
enforce: enforce,
getterFor: getterFor
};
var uncurryThis$h = functionUncurryThis;
var fails$k = fails$r;
var isCallable$d = isCallable$l;
var hasOwn$7 = hasOwnProperty_1;
var DESCRIPTORS$8 = descriptors;
var CONFIGURABLE_FUNCTION_NAME$2 = functionName.CONFIGURABLE;
var inspectSource$2 = inspectSource$3;
var InternalStateModule$5 = internalState;
var enforceInternalState$2 = InternalStateModule$5.enforce;
var getInternalState$4 = InternalStateModule$5.get;
var $String$2 = String;
// eslint-disable-next-line es/no-object-defineproperty -- safe
var defineProperty$5 = Object.defineProperty;
var stringSlice$1 = uncurryThis$h(''.slice);
var replace$2 = uncurryThis$h(''.replace);
var join = uncurryThis$h([].join);
var CONFIGURABLE_LENGTH = DESCRIPTORS$8 && !fails$k(function () {
return defineProperty$5(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
});
var TEMPLATE = String(String).split('String');
var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) {
if (stringSlice$1($String$2(name), 0, 7) === 'Symbol(') {
name = '[' + replace$2($String$2(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
}
if (options && options.getter) name = 'get ' + name;
if (options && options.setter) name = 'set ' + name;
if (!hasOwn$7(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$2 && value.name !== name)) {
if (DESCRIPTORS$8) defineProperty$5(value, 'name', { value: name, configurable: true });
else value.name = name;
}
if (CONFIGURABLE_LENGTH && options && hasOwn$7(options, 'arity') && value.length !== options.arity) {
defineProperty$5(value, 'length', { value: options.arity });
}
try {
if (options && hasOwn$7(options, 'constructor') && options.constructor) {
if (DESCRIPTORS$8) defineProperty$5(value, 'prototype', { writable: false });
// in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
} else if (value.prototype) value.prototype = undefined;
} catch (error) { /* empty */ }
var state = enforceInternalState$2(value);
if (!hasOwn$7(state, 'source')) {
state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
} return value;
};
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
// eslint-disable-next-line no-extend-native -- required
Function.prototype.toString = makeBuiltIn$2(function toString() {
return isCallable$d(this) && getInternalState$4(this).source || inspectSource$2(this);
}, 'toString');
var isCallable$c = isCallable$l;
var definePropertyModule$3 = objectDefineProperty;
var makeBuiltIn$1 = makeBuiltIn$3.exports;
var defineGlobalProperty$1 = defineGlobalProperty$3;
var defineBuiltIn$7 = function (O, key, value, options) {
if (!options) options = {};
var simple = options.enumerable;
var name = options.name !== undefined ? options.name : key;
if (isCallable$c(value)) makeBuiltIn$1(value, name, options);
if (options.global) {
if (simple) O[key] = value;
else defineGlobalProperty$1(key, value);
} else {
try {
if (!options.unsafe) delete O[key];
else if (O[key]) simple = true;
} catch (error) { /* empty */ }
if (simple) O[key] = value;
else definePropertyModule$3.f(O, key, {
value: value,
enumerable: false,
configurable: !options.nonConfigurable,
writable: !options.nonWritable
});
} return O;
};
var objectGetOwnPropertyNames = {};
var ceil = Math.ceil;
var floor$3 = Math.floor;
// `Math.trunc` method
// https://tc39.es/ecma262/#sec-math.trunc
// eslint-disable-next-line es/no-math-trunc -- safe
var mathTrunc = Math.trunc || function trunc(x) {
var n = +x;
return (n > 0 ? floor$3 : ceil)(n);
};
var trunc = mathTrunc;
// `ToIntegerOrInfinity` abstract operation
// https://tc39.es/ecma262/#sec-tointegerorinfinity
var toIntegerOrInfinity$5 = function (argument) {
var number = +argument;
// eslint-disable-next-line no-self-compare -- NaN check
return number !== number || number === 0 ? 0 : trunc(number);
};
var toIntegerOrInfinity$4 = toIntegerOrInfinity$5;
var max = Math.max;
var min$1 = 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$3 = function (index, length) {
var integer = toIntegerOrInfinity$4(index);
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
};
var toIntegerOrInfinity$3 = toIntegerOrInfinity$5;
var min = Math.min;
// `ToLength` abstract operation
// https://tc39.es/ecma262/#sec-tolength
var toLength$5 = function (argument) {
var len = toIntegerOrInfinity$3(argument);
return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
};
var toLength$4 = toLength$5;
// `LengthOfArrayLike` abstract operation
// https://tc39.es/ecma262/#sec-lengthofarraylike
var lengthOfArrayLike$9 = function (obj) {
return toLength$4(obj.length);
};
var toIndexedObject$4 = toIndexedObject$6;
var toAbsoluteIndex$2 = toAbsoluteIndex$3;
var lengthOfArrayLike$8 = lengthOfArrayLike$9;
// `Array.prototype.{ indexOf, includes }` methods implementation
var createMethod$3 = function (IS_INCLUDES) {
return function ($this, el, fromIndex) {
var O = toIndexedObject$4($this);
var length = lengthOfArrayLike$8(O);
if (length === 0) return !IS_INCLUDES && -1;
var index = toAbsoluteIndex$2(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 = {
// `Array.prototype.includes` method
// https://tc39.es/ecma262/#sec-array.prototype.includes
includes: createMethod$3(true),
// `Array.prototype.indexOf` method
// https://tc39.es/ecma262/#sec-array.prototype.indexof
indexOf: createMethod$3(false)
};
var uncurryThis$g = functionUncurryThis;
var hasOwn$6 = hasOwnProperty_1;
var toIndexedObject$3 = toIndexedObject$6;
var indexOf$1 = arrayIncludes.indexOf;
var hiddenKeys$2 = hiddenKeys$4;
var push$2 = uncurryThis$g([].push);
var objectKeysInternal = function (object, names) {
var O = toIndexedObject$3(object);
var i = 0;
var result = [];
var key;
for (key in O) !hasOwn$6(hiddenKeys$2, key) && hasOwn$6(O, key) && push$2(result, key);
// Don't enum bug & hidden keys
while (names.length > i) if (hasOwn$6(O, key = names[i++])) {
~indexOf$1(result, key) || push$2(result, key);
}
return result;
};
// IE8- don't enum bug keys
var enumBugKeys$3 = [
'constructor',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'toLocaleString',
'toString',
'valueOf'
];
var internalObjectKeys$1 = objectKeysInternal;
var enumBugKeys$2 = enumBugKeys$3;
var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
// `Object.getOwnPropertyNames` method
// https://tc39.es/ecma262/#sec-object.getownpropertynames
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
return internalObjectKeys$1(O, hiddenKeys$1);
};
var objectGetOwnPropertySymbols = {};
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
var getBuiltIn$5 = getBuiltIn$7;
var uncurryThis$f = functionUncurryThis;
var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
var anObject$9 = anObject$b;
var concat$1 = uncurryThis$f([].concat);
// all object keys, includes non-enumerable and symbols
var ownKeys$1 = getBuiltIn$5('Reflect', 'ownKeys') || function ownKeys(it) {
var keys = getOwnPropertyNamesModule.f(anObject$9(it));
var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
};
var hasOwn$5 = hasOwnProperty_1;
var ownKeys = ownKeys$1;
var getOwnPropertyDescriptorModule$1 = objectGetOwnPropertyDescriptor;
var definePropertyModule$2 = objectDefineProperty;
var copyConstructorProperties$2 = function (target, source, exceptions) {
var keys = ownKeys(source);
var defineProperty = definePropertyModule$2.f;
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule$1.f;
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (!hasOwn$5(target, key) && !(exceptions && hasOwn$5(exceptions, key))) {
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
}
}
};
var fails$j = fails$r;
var isCallable$b = isCallable$l;
var replacement = /#|\.prototype\./;
var isForced$2 = function (feature, detection) {
var value = data[normalize(feature)];
return value === POLYFILL ? true
: value === NATIVE ? false
: isCallable$b(detection) ? fails$j(detection)
: !!detection;
};
var normalize = isForced$2.normalize = function (string) {
return String(string).replace(replacement, '.').toLowerCase();
};
var data = isForced$2.data = {};
var NATIVE = isForced$2.NATIVE = 'N';
var POLYFILL = isForced$2.POLYFILL = 'P';
var isForced_1 = isForced$2;
var globalThis$j = globalThis_1;
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
var createNonEnumerableProperty$5 = createNonEnumerableProperty$7;
var defineBuiltIn$6 = defineBuiltIn$7;
var defineGlobalProperty = defineGlobalProperty$3;
var copyConstructorProperties$1 = copyConstructorProperties$2;
var isForced$1 = isForced_1;
/*
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.dontCallGetSet - prevent calling a getter on target
options.name - the .name of the function if it does not match the key
*/
var _export = 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 = globalThis$j;
} else if (STATIC) {
target = globalThis$j[TARGET] || defineGlobalProperty(TARGET, {});
} else {
target = globalThis$j[TARGET] && globalThis$j[TARGET].prototype;
}
if (target) for (key in source) {
sourceProperty = source[key];
if (options.dontCallGetSet) {
descriptor = getOwnPropertyDescriptor$1(target, key);
targetProperty = descriptor && descriptor.value;
} else targetProperty = target[key];
FORCED = isForced$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
// contained in target
if (!FORCED && targetProperty !== undefined) {
if (typeof sourceProperty == typeof targetProperty) continue;
copyConstructorProperties$1(sourceProperty, targetProperty);
}
// add a flag to not completely full polyfills
if (options.sham || (targetProperty && targetProperty.sham)) {
createNonEnumerableProperty$5(sourceProperty, 'sham', true);
}
defineBuiltIn$6(target, key, sourceProperty, options);
}
};
/* global Bun, Deno -- detection */
var globalThis$i = globalThis_1;
var userAgent$5 = environmentUserAgent;
var classof$a = classofRaw$2;
var userAgentStartsWith = function (string) {
return userAgent$5.slice(0, string.length) === string;
};
var environment = (function () {
if (userAgentStartsWith('Bun/')) return 'BUN';
if (userAgentStartsWith('Cloudflare-Workers')) return 'CLOUDFLARE';
if (userAgentStartsWith('Deno/')) return 'DENO';
if (userAgentStartsWith('Node.js/')) return 'NODE';
if (globalThis$i.Bun && typeof Bun.version == 'string') return 'BUN';
if (globalThis$i.Deno && typeof Deno.version == 'object') return 'DENO';
if (classof$a(globalThis$i.process) === 'process') return 'NODE';
if (globalThis$i.window && globalThis$i.document) return 'BROWSER';
return 'REST';
})();
var ENVIRONMENT$1 = environment;
var environmentIsNode = ENVIRONMENT$1 === 'NODE';
var uncurryThis$e = functionUncurryThis;
var aCallable$9 = aCallable$b;
var functionUncurryThisAccessor = function (object, key, method) {
try {
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
return uncurryThis$e(aCallable$9(Object.getOwnPropertyDescriptor(object, key)[method]));
} catch (error) { /* empty */ }
};
var isObject$a = isObject$g;
var isPossiblePrototype$1 = function (argument) {
return isObject$a(argument) || argument === null;
};
var isPossiblePrototype = isPossiblePrototype$1;
var $String$1 = String;
var $TypeError$a = TypeError;
var aPossiblePrototype$1 = function (argument) {
if (isPossiblePrototype(argument)) return argument;
throw new $TypeError$a("Can't set " + $String$1(argument) + ' as a prototype');
};
/* eslint-disable no-proto -- safe */
var uncurryThisAccessor = functionUncurryThisAccessor;
var isObject$9 = isObject$g;
var requireObjectCoercible$2 = requireObjectCoercible$5;
var aPossiblePrototype = aPossiblePrototype$1;
// `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-next-line es/no-object-setprototypeof -- safe
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
var CORRECT_SETTER = false;
var test = {};
var setter;
try {
setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
setter(test, []);
CORRECT_SETTER = test instanceof Array;
} catch (error) { /* empty */ }
return function setPrototypeOf(O, proto) {
requireObjectCoercible$2(O);
aPossiblePrototype(proto);
if (!isObject$9(O)) return O;
if (CORRECT_SETTER) setter(O, proto);
else O.__proto__ = proto;
return O;
};
}() : undefined);
var defineProperty$4 = objectDefineProperty.f;
var hasOwn$4 = hasOwnProperty_1;
var wellKnownSymbol$g = wellKnownSymbol$i;
var TO_STRING_TAG$3 = wellKnownSymbol$g('toStringTag');
var setToStringTag$5 = function (target, TAG, STATIC) {
if (target && !STATIC) target = target.prototype;
if (target && !hasOwn$4(target, TO_STRING_TAG$3)) {
defineProperty$4(target, TO_STRING_TAG$3, { configurable: true, value: TAG });
}
};
var makeBuiltIn = makeBuiltIn$3.exports;
var defineProperty$3 = objectDefineProperty;
var defineBuiltInAccessor$4 = function (target, name, descriptor) {
if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
return defineProperty$3.f(target, name, descriptor);
};
var getBuiltIn$4 = getBuiltIn$7;
var defineBuiltInAccessor$3 = defineBuiltInAccessor$4;
var wellKnownSymbol$f = wellKnownSymbol$i;
var DESCRIPTORS$7 = descriptors;
var SPECIES$3 = wellKnownSymbol$f('species');
var setSpecies$2 = function (CONSTRUCTOR_NAME) {
var Constructor = getBuiltIn$4(CONSTRUCTOR_NAME);
if (DESCRIPTORS$7 && Constructor && !Constructor[SPECIES$3]) {
defineBuiltInAccessor$3(Constructor, SPECIES$3, {
configurable: true,
get: function () { return this; }
});
}
};
var isPrototypeOf$3 = objectIsPrototypeOf;
var $TypeError$9 = TypeError;
var anInstance$3 = function (it, Prototype) {
if (isPrototypeOf$3(Prototype, it)) return it;
throw new $TypeError$9('Incorrect invocation');
};
var wellKnownSymbol$e = wellKnownSymbol$i;
var TO_STRING_TAG$2 = wellKnownSymbol$e('toStringTag');
var test$1 = {};
test$1[TO_STRING_TAG$2] = 'z';
var toStringTagSupport = String(test$1) === '[object z]';
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
var isCallable$a = isCallable$l;
var classofRaw$1 = classofRaw$2;
var wellKnownSymbol$d = wellKnownSymbol$i;
var TO_STRING_TAG$1 = wellKnownSymbol$d('toStringTag');
var $Object$1 = Object;
// ES3 wrong here
var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) === 'Arguments';
// fallback for IE11 Script Access Denied error
var tryGet = function (it, key) {
try {
return it[key];
} catch (error) { /* empty */ }
};
// getting tag from ES6+ `Object.prototype.toString`
var classof$9 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
var O, tag, result;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (tag = tryGet(O = $Object$1(it), TO_STRING_TAG$1)) == 'string' ? tag
// builtinTag case
: CORRECT_ARGUMENTS ? classofRaw$1(O)
// ES3 arguments fallback
: (result = classofRaw$1(O)) === 'Object' && isCallable$a(O.callee) ? 'Arguments' : result;
};
var uncurryThis$d = functionUncurryThis;
var fails$i = fails$r;
var isCallable$9 = isCallable$l;
var classof$8 = classof$9;
var getBuiltIn$3 = getBuiltIn$7;
var inspectSource$1 = inspectSource$3;
var noop = function () { /* empty */ };
var construct = getBuiltIn$3('Reflect', 'construct');
var constructorRegExp = /^\s*(?:class|function)\b/;
var exec$1 = uncurryThis$d(constructorRegExp.exec);
var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
var isConstructorModern = function isConstructor(argument) {
if (!isCallable$9(argument)) return false;
try {
construct(noop, [], argument);
return true;
} catch (error) {
return false;
}
};
var isConstructorLegacy = function isConstructor(argument) {
if (!isCallable$9(argument)) return false;
switch (classof$8(argument)) {
case 'AsyncFunction':
case 'GeneratorFunction':
case 'AsyncGeneratorFunction': return false;
}
try {
// we can't check .prototype since constructors produced by .bind haven't it
// `Function#toString` throws on some built-it function in some legacy engines
// (for example, `DOMQuad` and similar in FF41-)
return INCORRECT_TO_STRING || !!exec$1(constructorRegExp, inspectSource$1(argument));
} catch (error) {
return true;
}
};
isConstructorLegacy.sham = true;
// `IsConstructor` abstract operation
// https://tc39.es/ecma262/#sec-isconstructor
var isConstructor$2 = !construct || fails$i(function () {
var called;
return isConstructorModern(isConstructorModern.call)
|| !isConstructorModern(Object)
|| !isConstructorModern(function () { called = true; })
|| called;
}) ? isConstructorLegacy : isConstructorModern;
var isConstructor$1 = isConstructor$2;
var tryToString$4 = tryToString$6;
var $TypeError$8 = TypeError;
// `Assert: IsConstructor(argument) is true`
var aConstructor$2 = function (argument) {
if (isConstructor$1(argument)) return argument;
throw new $TypeError$8(tryToString$4(argument) + ' is not a constructor');
};
var anObject$8 = anObject$b;
var aConstructor$1 = aConstructor$2;
var isNullOrUndefined$1 = isNullOrUndefined$4;
var wellKnownSymbol$c = wellKnownSymbol$i;
var SPECIES$2 = wellKnownSymbol$c('species');
// `SpeciesConstructor` abstract operation
// https://tc39.es/ecma262/#sec-speciesconstructor
var speciesConstructor$1 = function (O, defaultConstructor) {
var C = anObject$8(O).constructor;
var S;
return C === undefined || isNullOrUndefined$1(S = anObject$8(C)[SPECIES$2]) ? defaultConstructor : aConstructor$1(S);
};
var NATIVE_BIND$1 = functionBindNative;
var FunctionPrototype = Function.prototype;
var apply$2 = FunctionPrototype.apply;
var call$d = FunctionPrototype.call;
// eslint-disable-next-line es/no-function-prototype-bind, es/no-reflect -- safe
var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$d.bind(apply$2) : function () {
return call$d.apply(apply$2, arguments);
});
var classofRaw = classofRaw$2;
var uncurryThis$c = functionUncurryThis;
var functionUncurryThisClause = function (fn) {
// Nashorn bug:
// https://github.com/zloirock/core-js/issues/1128
// https://github.com/zloirock/core-js/issues/1130
if (classofRaw(fn) === 'Function') return uncurryThis$c(fn);
};
var uncurryThis$b = functionUncurryThisClause;
var aCallable$8 = aCallable$b;
var NATIVE_BIND = functionBindNative;
var bind$6 = uncurryThis$b(uncurryThis$b.bind);
// optional / simple context binding
var functionBindContext = function (fn, that) {
aCallable$8(fn);
return that === undefined ? fn : NATIVE_BIND ? bind$6(fn, that) : function (/* ...args */) {
return fn.apply(that, arguments);
};
};
var getBuiltIn$2 = getBuiltIn$7;
var html$2 = getBuiltIn$2('document', 'documentElement');
var uncurryThis$a = functionUncurryThis;
var arraySlice$4 = uncurryThis$a([].slice);
var $TypeError$7 = TypeError;
var validateArgumentsLength$1 = function (passed, required) {
if (passed < required) throw new $TypeError$7('Not enough arguments');
return passed;
};
var userAgent$4 = environmentUserAgent;
// eslint-disable-next-line redos/no-vulnerable -- safe
var environmentIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$4);
var globalThis$h = globalThis_1;
var apply$1 = functionApply;
var bind$5 = functionBindContext;
var isCallable$8 = isCallable$l;
var hasOwn$3 = hasOwnProperty_1;
var fails$h = fails$r;
var html$1 = html$2;
var arraySlice$3 = arraySlice$4;
var createElement = documentCreateElement$2;
var validateArgumentsLength = validateArgumentsLength$1;
var IS_IOS$1 = environmentIsIos;
var IS_NODE$3 = environmentIsNode;
var set$1 = globalThis$h.setImmediate;
var clear = globalThis$h.clearImmediate;
var process$2 = globalThis$h.process;
var Dispatch = globalThis$h.Dispatch;
var Function$1 = globalThis$h.Function;
var MessageChannel = globalThis$h.MessageChannel;
var String$1 = globalThis$h.String;
var counter = 0;
var queue$2 = {};
var ONREADYSTATECHANGE = 'onreadystatechange';
var $location, defer, channel, port;
fails$h(function () {
// Deno throws a ReferenceError on `location` access without `--location` flag
$location = globalThis$h.location;
});
var run = function (id) {
if (hasOwn$3(queue$2, id)) {
var fn = queue$2[id];
delete queue$2[id];
fn();
}
};
var runner = function (id) {
return function () {
run(id);
};
};
var eventListener = function (event) {
run(event.data);
};
var globalPostMessageDefer = function (id) {
// old engines have not location.origin
globalThis$h.postMessage(String$1(id), $location.protocol + '//' + $location.host);
};
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if (!set$1 || !clear) {
set$1 = function setImmediate(handler) {
validateArgumentsLength(arguments.length, 1);
var fn = isCallable$8(handler) ? handler : Function$1(handler);
var args = arraySlice$3(arguments, 1);
queue$2[++counter] = function () {
apply$1(fn, undefined, args);
};
defer(counter);
return counter;
};
clear = function clearImmediate(id) {
delete queue$2[id];
};
// Node.js 0.8-
if (IS_NODE$3) {
defer = function (id) {
process$2.nextTick(runner(id));
};
// Sphere (JS game engine) Dispatch API
} else if (Dispatch && Dispatch.now) {
defer = function (id) {
Dispatch.now(runner(id));
};
// Browsers with MessageChannel, includes WebWorkers
// except iOS - https://github.com/zloirock/core-js/issues/624
} else if (MessageChannel && !IS_IOS$1) {
channel = new MessageChannel();
port = channel.port2;
channel.port1.onmessage = eventListener;
defer = bind$5(port.postMessage, port);
// Browsers with postMessage, skip WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
} else if (
globalThis$h.addEventListener &&
isCallable$8(globalThis$h.postMessage) &&
!globalThis$h.