@jspm/core
Version:
This package contains the core libraries used in jspm 2.
827 lines (791 loc) • 29 kB
JavaScript
var exports$k = {},
_dewExec$k = false;
function dew$k() {
if (_dewExec$k) return exports$k;
_dewExec$k = true;
/* eslint complexity: [2, 18], max-statements: [2, 33] */
exports$k = function hasSymbols() {
if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
return false;
}
if (typeof Symbol.iterator === "symbol") {
return true;
}
var obj = {};
var sym = Symbol("test");
var symObj = Object(sym);
if (typeof sym === "string") {
return false;
}
if (Object.prototype.toString.call(sym) !== "[object Symbol]") {
return false;
}
if (Object.prototype.toString.call(symObj) !== "[object Symbol]") {
return false;
}
// temp disabled per https://github.com/ljharb/object.assign/issues/17
// if (sym instanceof Symbol) { return false; }
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
// if (!(symObj instanceof Symbol)) { return false; }
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
var symVal = 42;
obj[sym] = symVal;
for (sym in obj) {
return false;
} // eslint-disable-line no-restricted-syntax, no-unreachable-loop
if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) {
return false;
}
if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) {
return false;
}
var syms = Object.getOwnPropertySymbols(obj);
if (syms.length !== 1 || syms[0] !== sym) {
return false;
}
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
return false;
}
if (typeof Object.getOwnPropertyDescriptor === "function") {
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
if (descriptor.value !== symVal || descriptor.enumerable !== true) {
return false;
}
}
return true;
};
return exports$k;
}
var exports$j = {},
_dewExec$j = false;
function dew$j() {
if (_dewExec$j) return exports$j;
_dewExec$j = true;
/** @type {import('.')} */
exports$j = Error;
return exports$j;
}
var exports$i = {},
_dewExec$i = false;
function dew$i() {
if (_dewExec$i) return exports$i;
_dewExec$i = true;
/** @type {import('./eval')} */
exports$i = EvalError;
return exports$i;
}
var exports$h = {},
_dewExec$h = false;
function dew$h() {
if (_dewExec$h) return exports$h;
_dewExec$h = true;
/** @type {import('./range')} */
exports$h = RangeError;
return exports$h;
}
var exports$g = {},
_dewExec$g = false;
function dew$g() {
if (_dewExec$g) return exports$g;
_dewExec$g = true;
/** @type {import('./ref')} */
exports$g = ReferenceError;
return exports$g;
}
var exports$f = {},
_dewExec$f = false;
function dew$f() {
if (_dewExec$f) return exports$f;
_dewExec$f = true;
/** @type {import('./syntax')} */
exports$f = SyntaxError;
return exports$f;
}
var exports$e = {},
_dewExec$e = false;
function dew$e() {
if (_dewExec$e) return exports$e;
_dewExec$e = true;
/** @type {import('./type')} */
exports$e = TypeError;
return exports$e;
}
var exports$d = {},
_dewExec$d = false;
function dew$d() {
if (_dewExec$d) return exports$d;
_dewExec$d = true;
/** @type {import('./uri')} */
exports$d = URIError;
return exports$d;
}
var exports$c = {},
_dewExec$c = false;
function dew$c() {
if (_dewExec$c) return exports$c;
_dewExec$c = true;
var origSymbol = typeof Symbol !== "undefined" && Symbol;
var hasSymbolSham = dew$k();
exports$c = function hasNativeSymbols() {
if (typeof origSymbol !== "function") {
return false;
}
if (typeof Symbol !== "function") {
return false;
}
if (typeof origSymbol("foo") !== "symbol") {
return false;
}
if (typeof Symbol("bar") !== "symbol") {
return false;
}
return hasSymbolSham();
};
return exports$c;
}
var exports$b = {},
_dewExec$b = false;
function dew$b() {
if (_dewExec$b) return exports$b;
_dewExec$b = true;
var test = {
__proto__: null,
foo: {}
};
var $Object = Object;
/** @type {import('.')} */
exports$b = function hasProto() {
// @ts-expect-error: TS errors on an inherited property for some reason
return {
__proto__: test
}.foo === test.foo && !(test instanceof $Object);
};
return exports$b;
}
var exports$a = {},
_dewExec$a = false;
function dew$a() {
if (_dewExec$a) return exports$a;
_dewExec$a = true;
/* eslint no-invalid-this: 1 */
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
var toStr = Object.prototype.toString;
var max = Math.max;
var funcType = "[object Function]";
var concatty = function concatty(a, b) {
var arr = [];
for (var i = 0; i < a.length; i += 1) {
arr[i] = a[i];
}
for (var j = 0; j < b.length; j += 1) {
arr[j + a.length] = b[j];
}
return arr;
};
var slicy = function slicy(arrLike, offset) {
var arr = [];
for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) {
arr[j] = arrLike[i];
}
return arr;
};
var joiny = function (arr, joiner) {
var str = "";
for (var i = 0; i < arr.length; i += 1) {
str += arr[i];
if (i + 1 < arr.length) {
str += joiner;
}
}
return str;
};
exports$a = function bind(that) {
var target = this;
if (typeof target !== "function" || toStr.apply(target) !== funcType) {
throw new TypeError(ERROR_MESSAGE + target);
}
var args = slicy(arguments, 1);
var bound;
var binder = function () {
if (this instanceof bound) {
var result = target.apply(this, concatty(args, arguments));
if (Object(result) === result) {
return result;
}
return this;
}
return target.apply(that, concatty(args, arguments));
};
var boundLength = max(0, target.length - args.length);
var boundArgs = [];
for (var i = 0; i < boundLength; i++) {
boundArgs[i] = "$" + i;
}
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
if (target.prototype) {
var Empty = function Empty() {};
Empty.prototype = target.prototype;
bound.prototype = new Empty();
Empty.prototype = null;
}
return bound;
};
return exports$a;
}
var exports$9 = {},
_dewExec$9 = false;
function dew$9() {
if (_dewExec$9) return exports$9;
_dewExec$9 = true;
var implementation = dew$a();
exports$9 = Function.prototype.bind || implementation;
return exports$9;
}
var exports$8 = {},
_dewExec$8 = false;
function dew$8() {
if (_dewExec$8) return exports$8;
_dewExec$8 = true;
var call = Function.prototype.call;
var $hasOwn = Object.prototype.hasOwnProperty;
var bind = dew$9();
/** @type {import('.')} */
exports$8 = bind.call(call, $hasOwn);
return exports$8;
}
var exports$7 = {},
_dewExec$7 = false;
function dew$7() {
if (_dewExec$7) return exports$7;
_dewExec$7 = true;
var undefined$1;
var $Error = dew$j();
var $EvalError = dew$i();
var $RangeError = dew$h();
var $ReferenceError = dew$g();
var $SyntaxError = dew$f();
var $TypeError = dew$e();
var $URIError = dew$d();
var $Function = Function;
// eslint-disable-next-line consistent-return
var getEvalledConstructor = function (expressionSyntax) {
try {
return $Function("\"use strict\"; return (" + expressionSyntax + ").constructor;")();
} catch (e) {}
};
var $gOPD = Object.getOwnPropertyDescriptor;
if ($gOPD) {
try {
$gOPD({}, "");
} catch (e) {
$gOPD = null; // this is IE 8, which has a broken gOPD
}
}
var throwTypeError = function () {
throw new $TypeError();
};
var ThrowTypeError = $gOPD ? function () {
try {
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
arguments.callee; // IE 8 does not throw here
return throwTypeError;
} catch (calleeThrows) {
try {
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
return $gOPD(arguments, "callee").get;
} catch (gOPDthrows) {
return throwTypeError;
}
}
}() : throwTypeError;
var hasSymbols = dew$c()();
var hasProto = dew$b()();
var getProto = Object.getPrototypeOf || (hasProto ? function (x) {
return x.__proto__;
} // eslint-disable-line no-proto
: null);
var needsEval = {};
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
var INTRINSICS = {
__proto__: null,
"%AggregateError%": typeof AggregateError === "undefined" ? undefined$1 : AggregateError,
"%Array%": Array,
"%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined$1 : ArrayBuffer,
"%ArrayIteratorPrototype%": hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1,
"%AsyncFromSyncIteratorPrototype%": undefined$1,
"%AsyncFunction%": needsEval,
"%AsyncGenerator%": needsEval,
"%AsyncGeneratorFunction%": needsEval,
"%AsyncIteratorPrototype%": needsEval,
"%Atomics%": typeof Atomics === "undefined" ? undefined$1 : Atomics,
"%BigInt%": typeof BigInt === "undefined" ? undefined$1 : BigInt,
"%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined$1 : BigInt64Array,
"%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined$1 : BigUint64Array,
"%Boolean%": Boolean,
"%DataView%": typeof DataView === "undefined" ? undefined$1 : DataView,
"%Date%": Date,
"%decodeURI%": decodeURI,
"%decodeURIComponent%": decodeURIComponent,
"%encodeURI%": encodeURI,
"%encodeURIComponent%": encodeURIComponent,
"%Error%": $Error,
"%eval%": eval,
// eslint-disable-line no-eval
"%EvalError%": $EvalError,
"%Float32Array%": typeof Float32Array === "undefined" ? undefined$1 : Float32Array,
"%Float64Array%": typeof Float64Array === "undefined" ? undefined$1 : Float64Array,
"%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined$1 : FinalizationRegistry,
"%Function%": $Function,
"%GeneratorFunction%": needsEval,
"%Int8Array%": typeof Int8Array === "undefined" ? undefined$1 : Int8Array,
"%Int16Array%": typeof Int16Array === "undefined" ? undefined$1 : Int16Array,
"%Int32Array%": typeof Int32Array === "undefined" ? undefined$1 : Int32Array,
"%isFinite%": isFinite,
"%isNaN%": isNaN,
"%IteratorPrototype%": hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
"%JSON%": typeof JSON === "object" ? JSON : undefined$1,
"%Map%": typeof Map === "undefined" ? undefined$1 : Map,
"%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols || !getProto ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
"%Math%": Math,
"%Number%": Number,
"%Object%": Object,
"%parseFloat%": parseFloat,
"%parseInt%": parseInt,
"%Promise%": typeof Promise === "undefined" ? undefined$1 : Promise,
"%Proxy%": typeof Proxy === "undefined" ? undefined$1 : Proxy,
"%RangeError%": $RangeError,
"%ReferenceError%": $ReferenceError,
"%Reflect%": typeof Reflect === "undefined" ? undefined$1 : Reflect,
"%RegExp%": RegExp,
"%Set%": typeof Set === "undefined" ? undefined$1 : Set,
"%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols || !getProto ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
"%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined$1 : SharedArrayBuffer,
"%String%": String,
"%StringIteratorPrototype%": hasSymbols && getProto ? getProto(""[Symbol.iterator]()) : undefined$1,
"%Symbol%": hasSymbols ? Symbol : undefined$1,
"%SyntaxError%": $SyntaxError,
"%ThrowTypeError%": ThrowTypeError,
"%TypedArray%": TypedArray,
"%TypeError%": $TypeError,
"%Uint8Array%": typeof Uint8Array === "undefined" ? undefined$1 : Uint8Array,
"%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined$1 : Uint8ClampedArray,
"%Uint16Array%": typeof Uint16Array === "undefined" ? undefined$1 : Uint16Array,
"%Uint32Array%": typeof Uint32Array === "undefined" ? undefined$1 : Uint32Array,
"%URIError%": $URIError,
"%WeakMap%": typeof WeakMap === "undefined" ? undefined$1 : WeakMap,
"%WeakRef%": typeof WeakRef === "undefined" ? undefined$1 : WeakRef,
"%WeakSet%": typeof WeakSet === "undefined" ? undefined$1 : WeakSet
};
if (getProto) {
try {
null.error; // eslint-disable-line no-unused-expressions
} catch (e) {
// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
var errorProto = getProto(getProto(e));
INTRINSICS["%Error.prototype%"] = errorProto;
}
}
var doEval = function doEval(name) {
var value;
if (name === "%AsyncFunction%") {
value = getEvalledConstructor("async function () {}");
} else if (name === "%GeneratorFunction%") {
value = getEvalledConstructor("function* () {}");
} else if (name === "%AsyncGeneratorFunction%") {
value = getEvalledConstructor("async function* () {}");
} else if (name === "%AsyncGenerator%") {
var fn = doEval("%AsyncGeneratorFunction%");
if (fn) {
value = fn.prototype;
}
} else if (name === "%AsyncIteratorPrototype%") {
var gen = doEval("%AsyncGenerator%");
if (gen && getProto) {
value = getProto(gen.prototype);
}
}
INTRINSICS[name] = value;
return value;
};
var LEGACY_ALIASES = {
__proto__: null,
"%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
"%ArrayPrototype%": ["Array", "prototype"],
"%ArrayProto_entries%": ["Array", "prototype", "entries"],
"%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
"%ArrayProto_keys%": ["Array", "prototype", "keys"],
"%ArrayProto_values%": ["Array", "prototype", "values"],
"%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
"%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
"%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
"%BooleanPrototype%": ["Boolean", "prototype"],
"%DataViewPrototype%": ["DataView", "prototype"],
"%DatePrototype%": ["Date", "prototype"],
"%ErrorPrototype%": ["Error", "prototype"],
"%EvalErrorPrototype%": ["EvalError", "prototype"],
"%Float32ArrayPrototype%": ["Float32Array", "prototype"],
"%Float64ArrayPrototype%": ["Float64Array", "prototype"],
"%FunctionPrototype%": ["Function", "prototype"],
"%Generator%": ["GeneratorFunction", "prototype"],
"%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
"%Int8ArrayPrototype%": ["Int8Array", "prototype"],
"%Int16ArrayPrototype%": ["Int16Array", "prototype"],
"%Int32ArrayPrototype%": ["Int32Array", "prototype"],
"%JSONParse%": ["JSON", "parse"],
"%JSONStringify%": ["JSON", "stringify"],
"%MapPrototype%": ["Map", "prototype"],
"%NumberPrototype%": ["Number", "prototype"],
"%ObjectPrototype%": ["Object", "prototype"],
"%ObjProto_toString%": ["Object", "prototype", "toString"],
"%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
"%PromisePrototype%": ["Promise", "prototype"],
"%PromiseProto_then%": ["Promise", "prototype", "then"],
"%Promise_all%": ["Promise", "all"],
"%Promise_reject%": ["Promise", "reject"],
"%Promise_resolve%": ["Promise", "resolve"],
"%RangeErrorPrototype%": ["RangeError", "prototype"],
"%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
"%RegExpPrototype%": ["RegExp", "prototype"],
"%SetPrototype%": ["Set", "prototype"],
"%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
"%StringPrototype%": ["String", "prototype"],
"%SymbolPrototype%": ["Symbol", "prototype"],
"%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
"%TypedArrayPrototype%": ["TypedArray", "prototype"],
"%TypeErrorPrototype%": ["TypeError", "prototype"],
"%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
"%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
"%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
"%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
"%URIErrorPrototype%": ["URIError", "prototype"],
"%WeakMapPrototype%": ["WeakMap", "prototype"],
"%WeakSetPrototype%": ["WeakSet", "prototype"]
};
var bind = dew$9();
var hasOwn = dew$8();
var $concat = bind.call(Function.call, Array.prototype.concat);
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
var $replace = bind.call(Function.call, String.prototype.replace);
var $strSlice = bind.call(Function.call, String.prototype.slice);
var $exec = bind.call(Function.call, RegExp.prototype.exec);
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
var stringToPath = function stringToPath(string) {
var first = $strSlice(string, 0, 1);
var last = $strSlice(string, -1);
if (first === "%" && last !== "%") {
throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");
} else if (last === "%" && first !== "%") {
throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
}
var result = [];
$replace(string, rePropName, function (match, number, quote, subString) {
result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match;
});
return result;
};
/* end adaptation */
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
var intrinsicName = name;
var alias;
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
alias = LEGACY_ALIASES[intrinsicName];
intrinsicName = "%" + alias[0] + "%";
}
if (hasOwn(INTRINSICS, intrinsicName)) {
var value = INTRINSICS[intrinsicName];
if (value === needsEval) {
value = doEval(intrinsicName);
}
if (typeof value === "undefined" && !allowMissing) {
throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!");
}
return {
alias: alias,
name: intrinsicName,
value: value
};
}
throw new $SyntaxError("intrinsic " + name + " does not exist!");
};
exports$7 = function GetIntrinsic(name, allowMissing) {
if (typeof name !== "string" || name.length === 0) {
throw new $TypeError("intrinsic name must be a non-empty string");
}
if (arguments.length > 1 && typeof allowMissing !== "boolean") {
throw new $TypeError("\"allowMissing\" argument must be a boolean");
}
if ($exec(/^%?[^%]*%?$/, name) === null) {
throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
}
var parts = stringToPath(name);
var intrinsicBaseName = parts.length > 0 ? parts[0] : "";
var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing);
var intrinsicRealName = intrinsic.name;
var value = intrinsic.value;
var skipFurtherCaching = false;
var alias = intrinsic.alias;
if (alias) {
intrinsicBaseName = alias[0];
$spliceApply(parts, $concat([0, 1], alias));
}
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
var part = parts[i];
var first = $strSlice(part, 0, 1);
var last = $strSlice(part, -1);
if ((first === "\"" || first === "'" || first === "`" || last === "\"" || last === "'" || last === "`") && first !== last) {
throw new $SyntaxError("property names with quotes must have matching quotes");
}
if (part === "constructor" || !isOwn) {
skipFurtherCaching = true;
}
intrinsicBaseName += "." + part;
intrinsicRealName = "%" + intrinsicBaseName + "%";
if (hasOwn(INTRINSICS, intrinsicRealName)) {
value = INTRINSICS[intrinsicRealName];
} else if (value != null) {
if (!(part in value)) {
if (!allowMissing) {
throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available.");
}
return void undefined$1;
}
if ($gOPD && i + 1 >= parts.length) {
var desc = $gOPD(value, part);
isOwn = !!desc;
// By convention, when a data property is converted to an accessor
// property to emulate a data property that does not suffer from
// the override mistake, that accessor's getter is marked with
// an `originalValue` property. Here, when we detect this, we
// uphold the illusion by pretending to see that original data
// property, i.e., returning the value rather than the getter
// itself.
if (isOwn && "get" in desc && !("originalValue" in desc.get)) {
value = desc.get;
} else {
value = value[part];
}
} else {
isOwn = hasOwn(value, part);
value = value[part];
}
if (isOwn && !skipFurtherCaching) {
INTRINSICS[intrinsicRealName] = value;
}
}
}
return value;
};
return exports$7;
}
var exports$6 = {},
_dewExec$6 = false;
function dew$6() {
if (_dewExec$6) return exports$6;
_dewExec$6 = true;
var GetIntrinsic = dew$7();
/** @type {import('.')} */
var $defineProperty = GetIntrinsic("%Object.defineProperty%", true) || false;
if ($defineProperty) {
try {
$defineProperty({}, "a", {
value: 1
});
} catch (e) {
// IE 8 has a broken defineProperty
$defineProperty = false;
}
}
exports$6 = $defineProperty;
return exports$6;
}
var exports$5 = {},
_dewExec$5 = false;
function dew$5() {
if (_dewExec$5) return exports$5;
_dewExec$5 = true;
var GetIntrinsic = dew$7();
var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true);
if ($gOPD) {
try {
$gOPD([], "length");
} catch (e) {
// IE 8 has a broken gOPD
$gOPD = null;
}
}
exports$5 = $gOPD;
return exports$5;
}
var exports$4 = {},
_dewExec$4 = false;
function dew$4() {
if (_dewExec$4) return exports$4;
_dewExec$4 = true;
var $defineProperty = dew$6();
var $SyntaxError = dew$f();
var $TypeError = dew$e();
var gopd = dew$5();
/** @type {import('.')} */
exports$4 = function defineDataProperty(obj, property, value) {
if (!obj || typeof obj !== "object" && typeof obj !== "function") {
throw new $TypeError("`obj` must be an object or a function`");
}
if (typeof property !== "string" && typeof property !== "symbol") {
throw new $TypeError("`property` must be a string or a symbol`");
}
if (arguments.length > 3 && typeof arguments[3] !== "boolean" && arguments[3] !== null) {
throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null");
}
if (arguments.length > 4 && typeof arguments[4] !== "boolean" && arguments[4] !== null) {
throw new $TypeError("`nonWritable`, if provided, must be a boolean or null");
}
if (arguments.length > 5 && typeof arguments[5] !== "boolean" && arguments[5] !== null) {
throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null");
}
if (arguments.length > 6 && typeof arguments[6] !== "boolean") {
throw new $TypeError("`loose`, if provided, must be a boolean");
}
var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
var nonWritable = arguments.length > 4 ? arguments[4] : null;
var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
var loose = arguments.length > 6 ? arguments[6] : false;
/* @type {false | TypedPropertyDescriptor<unknown>} */
var desc = !!gopd && gopd(obj, property);
if ($defineProperty) {
$defineProperty(obj, property, {
configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
value: value,
writable: nonWritable === null && desc ? desc.writable : !nonWritable
});
} else if (loose || !nonEnumerable && !nonWritable && !nonConfigurable) {
// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
obj[property] = value; // eslint-disable-line no-param-reassign
} else {
throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
}
};
return exports$4;
}
var exports$3 = {},
_dewExec$3 = false;
function dew$3() {
if (_dewExec$3) return exports$3;
_dewExec$3 = true;
var $defineProperty = dew$6();
var hasPropertyDescriptors = function hasPropertyDescriptors() {
return !!$defineProperty;
};
hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
// node v0.6 has a bug where array lengths can be Set but not Defined
if (!$defineProperty) {
return null;
}
try {
return $defineProperty([], "length", {
value: 1
}).length !== 1;
} catch (e) {
// In Firefox 4-22, defining length on an array throws an exception.
return true;
}
};
exports$3 = hasPropertyDescriptors;
return exports$3;
}
var exports$2 = {},
_dewExec$2 = false;
function dew$2() {
if (_dewExec$2) return exports$2;
_dewExec$2 = true;
var GetIntrinsic = dew$7();
var define = dew$4();
var hasDescriptors = dew$3()();
var gOPD = dew$5();
var $TypeError = dew$e();
var $floor = GetIntrinsic("%Math.floor%");
/** @type {import('.')} */
exports$2 = function setFunctionLength(fn, length) {
if (typeof fn !== "function") {
throw new $TypeError("`fn` is not a function");
}
if (typeof length !== "number" || length < 0 || length > 4294967295 || $floor(length) !== length) {
throw new $TypeError("`length` must be a positive 32-bit integer");
}
var loose = arguments.length > 2 && !!arguments[2];
var functionLengthIsConfigurable = true;
var functionLengthIsWritable = true;
if ("length" in fn && gOPD) {
var desc = gOPD(fn, "length");
if (desc && !desc.configurable) {
functionLengthIsConfigurable = false;
}
if (desc && !desc.writable) {
functionLengthIsWritable = false;
}
}
if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
if (hasDescriptors) {
define(/** @type {Parameters<define>[0]} */fn, "length", length, true, true);
} else {
define(/** @type {Parameters<define>[0]} */fn, "length", length);
}
}
return fn;
};
return exports$2;
}
var exports$1 = {},
_dewExec$1 = false;
function dew$1() {
if (_dewExec$1) return exports$1;
_dewExec$1 = true;
var bind = dew$9();
var GetIntrinsic = dew$7();
var setFunctionLength = dew$2();
var $TypeError = dew$e();
var $apply = GetIntrinsic("%Function.prototype.apply%");
var $call = GetIntrinsic("%Function.prototype.call%");
var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply);
var $defineProperty = dew$6();
var $max = GetIntrinsic("%Math.max%");
exports$1 = function callBind(originalFunction) {
if (typeof originalFunction !== "function") {
throw new $TypeError("a function is required");
}
var func = $reflectApply(bind, $call, arguments);
return setFunctionLength(func, 1 + $max(0, originalFunction.length - (arguments.length - 1)), true);
};
var applyBind = function applyBind() {
return $reflectApply(bind, $apply, arguments);
};
if ($defineProperty) {
$defineProperty(exports$1, "apply", {
value: applyBind
});
} else {
exports$1.apply = applyBind;
}
return exports$1;
}
var exports = {},
_dewExec = false;
function dew() {
if (_dewExec) return exports;
_dewExec = true;
var GetIntrinsic = dew$7();
var callBind = dew$1();
var $indexOf = callBind(GetIntrinsic("String.prototype.indexOf"));
exports = function callBoundIntrinsic(name, allowMissing) {
var intrinsic = GetIntrinsic(name, !!allowMissing);
if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) {
return callBind(intrinsic);
}
return intrinsic;
};
return exports;
}
export { dew as a, dew$4 as b, dew$3 as c, dew$k as d, dew$1 as e, dew$5 as f, dew$7 as g, dew$e as h };