1142 lines
36 KiB
JavaScript
1142 lines
36 KiB
JavaScript
|
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var keys = require('object-keys').shim();
|
||
|
delete keys.shim;
|
||
|
|
||
|
var assign = require('./');
|
||
|
|
||
|
module.exports = assign.shim();
|
||
|
|
||
|
delete assign.shim;
|
||
|
|
||
|
},{"./":3,"object-keys":18}],2:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
// modified from https://github.com/es-shims/es6-shim
|
||
|
var objectKeys = require('object-keys');
|
||
|
var hasSymbols = require('has-symbols/shams')();
|
||
|
var callBound = require('call-bind/callBound');
|
||
|
var toObject = Object;
|
||
|
var $push = callBound('Array.prototype.push');
|
||
|
var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable');
|
||
|
var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
|
||
|
|
||
|
// eslint-disable-next-line no-unused-vars
|
||
|
module.exports = function assign(target, source1) {
|
||
|
if (target == null) { throw new TypeError('target must be an object'); }
|
||
|
var to = toObject(target); // step 1
|
||
|
if (arguments.length === 1) {
|
||
|
return to; // step 2
|
||
|
}
|
||
|
for (var s = 1; s < arguments.length; ++s) {
|
||
|
var from = toObject(arguments[s]); // step 3.a.i
|
||
|
|
||
|
// step 3.a.ii:
|
||
|
var keys = objectKeys(from);
|
||
|
var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
|
||
|
if (getSymbols) {
|
||
|
var syms = getSymbols(from);
|
||
|
for (var j = 0; j < syms.length; ++j) {
|
||
|
var key = syms[j];
|
||
|
if ($propIsEnumerable(from, key)) {
|
||
|
$push(keys, key);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// step 3.a.iii:
|
||
|
for (var i = 0; i < keys.length; ++i) {
|
||
|
var nextKey = keys[i];
|
||
|
if ($propIsEnumerable(from, nextKey)) { // step 3.a.iii.2
|
||
|
var propValue = from[nextKey]; // step 3.a.iii.2.a
|
||
|
to[nextKey] = propValue; // step 3.a.iii.2.b
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return to; // step 4
|
||
|
};
|
||
|
|
||
|
},{"call-bind/callBound":4,"has-symbols/shams":15,"object-keys":18}],3:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var defineProperties = require('define-properties');
|
||
|
var callBind = require('call-bind');
|
||
|
|
||
|
var implementation = require('./implementation');
|
||
|
var getPolyfill = require('./polyfill');
|
||
|
var shim = require('./shim');
|
||
|
|
||
|
var polyfill = callBind.apply(getPolyfill());
|
||
|
// eslint-disable-next-line no-unused-vars
|
||
|
var bound = function assign(target, source1) {
|
||
|
return polyfill(Object, arguments);
|
||
|
};
|
||
|
|
||
|
defineProperties(bound, {
|
||
|
getPolyfill: getPolyfill,
|
||
|
implementation: implementation,
|
||
|
shim: shim
|
||
|
});
|
||
|
|
||
|
module.exports = bound;
|
||
|
|
||
|
},{"./implementation":2,"./polyfill":21,"./shim":22,"call-bind":5,"define-properties":7}],4:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var GetIntrinsic = require('get-intrinsic');
|
||
|
|
||
|
var callBind = require('./');
|
||
|
|
||
|
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
|
||
|
|
||
|
module.exports = function callBoundIntrinsic(name, allowMissing) {
|
||
|
var intrinsic = GetIntrinsic(name, !!allowMissing);
|
||
|
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
||
|
return callBind(intrinsic);
|
||
|
}
|
||
|
return intrinsic;
|
||
|
};
|
||
|
|
||
|
},{"./":5,"get-intrinsic":10}],5:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var bind = require('function-bind');
|
||
|
var GetIntrinsic = require('get-intrinsic');
|
||
|
var setFunctionLength = require('set-function-length');
|
||
|
|
||
|
var $TypeError = GetIntrinsic('%TypeError%');
|
||
|
var $apply = GetIntrinsic('%Function.prototype.apply%');
|
||
|
var $call = GetIntrinsic('%Function.prototype.call%');
|
||
|
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
||
|
|
||
|
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
||
|
var $max = GetIntrinsic('%Math.max%');
|
||
|
|
||
|
if ($defineProperty) {
|
||
|
try {
|
||
|
$defineProperty({}, 'a', { value: 1 });
|
||
|
} catch (e) {
|
||
|
// IE 8 has a broken defineProperty
|
||
|
$defineProperty = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = 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(module.exports, 'apply', { value: applyBind });
|
||
|
} else {
|
||
|
module.exports.apply = applyBind;
|
||
|
}
|
||
|
|
||
|
},{"function-bind":9,"get-intrinsic":10,"set-function-length":20}],6:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var hasPropertyDescriptors = require('has-property-descriptors')();
|
||
|
|
||
|
var GetIntrinsic = require('get-intrinsic');
|
||
|
|
||
|
var $defineProperty = hasPropertyDescriptors && GetIntrinsic('%Object.defineProperty%', true);
|
||
|
if ($defineProperty) {
|
||
|
try {
|
||
|
$defineProperty({}, 'a', { value: 1 });
|
||
|
} catch (e) {
|
||
|
// IE 8 has a broken defineProperty
|
||
|
$defineProperty = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var $SyntaxError = GetIntrinsic('%SyntaxError%');
|
||
|
var $TypeError = GetIntrinsic('%TypeError%');
|
||
|
|
||
|
var gopd = require('gopd');
|
||
|
|
||
|
/** @type {(obj: Record<PropertyKey, unknown>, property: PropertyKey, value: unknown, nonEnumerable?: boolean | null, nonWritable?: boolean | null, nonConfigurable?: boolean | null, loose?: boolean) => void} */
|
||
|
module.exports = 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.');
|
||
|
}
|
||
|
};
|
||
|
|
||
|
},{"get-intrinsic":10,"gopd":11,"has-property-descriptors":12}],7:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var keys = require('object-keys');
|
||
|
var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
|
||
|
|
||
|
var toStr = Object.prototype.toString;
|
||
|
var concat = Array.prototype.concat;
|
||
|
var defineDataProperty = require('define-data-property');
|
||
|
|
||
|
var isFunction = function (fn) {
|
||
|
return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
|
||
|
};
|
||
|
|
||
|
var supportsDescriptors = require('has-property-descriptors')();
|
||
|
|
||
|
var defineProperty = function (object, name, value, predicate) {
|
||
|
if (name in object) {
|
||
|
if (predicate === true) {
|
||
|
if (object[name] === value) {
|
||
|
return;
|
||
|
}
|
||
|
} else if (!isFunction(predicate) || !predicate()) {
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (supportsDescriptors) {
|
||
|
defineDataProperty(object, name, value, true);
|
||
|
} else {
|
||
|
defineDataProperty(object, name, value);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
var defineProperties = function (object, map) {
|
||
|
var predicates = arguments.length > 2 ? arguments[2] : {};
|
||
|
var props = keys(map);
|
||
|
if (hasSymbols) {
|
||
|
props = concat.call(props, Object.getOwnPropertySymbols(map));
|
||
|
}
|
||
|
for (var i = 0; i < props.length; i += 1) {
|
||
|
defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
defineProperties.supportsDescriptors = !!supportsDescriptors;
|
||
|
|
||
|
module.exports = defineProperties;
|
||
|
|
||
|
},{"define-data-property":6,"has-property-descriptors":12,"object-keys":18}],8:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
/* 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 || 0, 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;
|
||
|
};
|
||
|
|
||
|
module.exports = 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;
|
||
|
};
|
||
|
|
||
|
},{}],9:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var implementation = require('./implementation');
|
||
|
|
||
|
module.exports = Function.prototype.bind || implementation;
|
||
|
|
||
|
},{"./implementation":8}],10:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var undefined;
|
||
|
|
||
|
var $SyntaxError = SyntaxError;
|
||
|
var $Function = Function;
|
||
|
var $TypeError = TypeError;
|
||
|
|
||
|
// 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 = require('has-symbols')();
|
||
|
var hasProto = require('has-proto')();
|
||
|
|
||
|
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 : getProto(Uint8Array);
|
||
|
|
||
|
var INTRINSICS = {
|
||
|
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
|
||
|
'%Array%': Array,
|
||
|
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
|
||
|
'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,
|
||
|
'%AsyncFromSyncIteratorPrototype%': undefined,
|
||
|
'%AsyncFunction%': needsEval,
|
||
|
'%AsyncGenerator%': needsEval,
|
||
|
'%AsyncGeneratorFunction%': needsEval,
|
||
|
'%AsyncIteratorPrototype%': needsEval,
|
||
|
'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
|
||
|
'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
|
||
|
'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,
|
||
|
'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,
|
||
|
'%Boolean%': Boolean,
|
||
|
'%DataView%': typeof DataView === 'undefined' ? undefined : 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 : Float32Array,
|
||
|
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
|
||
|
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
|
||
|
'%Function%': $Function,
|
||
|
'%GeneratorFunction%': needsEval,
|
||
|
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
|
||
|
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
|
||
|
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
|
||
|
'%isFinite%': isFinite,
|
||
|
'%isNaN%': isNaN,
|
||
|
'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
||
|
'%JSON%': typeof JSON === 'object' ? JSON : undefined,
|
||
|
'%Map%': typeof Map === 'undefined' ? undefined : Map,
|
||
|
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),
|
||
|
'%Math%': Math,
|
||
|
'%Number%': Number,
|
||
|
'%Object%': Object,
|
||
|
'%parseFloat%': parseFloat,
|
||
|
'%parseInt%': parseInt,
|
||
|
'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
|
||
|
'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
|
||
|
'%RangeError%': RangeError,
|
||
|
'%ReferenceError%': ReferenceError,
|
||
|
'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
|
||
|
'%RegExp%': RegExp,
|
||
|
'%Set%': typeof Set === 'undefined' ? undefined : Set,
|
||
|
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()),
|
||
|
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
|
||
|
'%String%': String,
|
||
|
'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,
|
||
|
'%Symbol%': hasSymbols ? Symbol : undefined,
|
||
|
'%SyntaxError%': $SyntaxError,
|
||
|
'%ThrowTypeError%': ThrowTypeError,
|
||
|
'%TypedArray%': TypedArray,
|
||
|
'%TypeError%': $TypeError,
|
||
|
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
|
||
|
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
|
||
|
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
|
||
|
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
|
||
|
'%URIError%': URIError,
|
||
|
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
|
||
|
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
|
||
|
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : 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 = {
|
||
|
'%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 = require('function-bind');
|
||
|
var hasOwn = require('hasown');
|
||
|
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!');
|
||
|
};
|
||
|
|
||
|
module.exports = 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;
|
||
|
}
|
||
|
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;
|
||
|
};
|
||
|
|
||
|
},{"function-bind":9,"has-proto":13,"has-symbols":14,"hasown":16}],11:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var GetIntrinsic = require('get-intrinsic');
|
||
|
|
||
|
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
||
|
|
||
|
if ($gOPD) {
|
||
|
try {
|
||
|
$gOPD([], 'length');
|
||
|
} catch (e) {
|
||
|
// IE 8 has a broken gOPD
|
||
|
$gOPD = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = $gOPD;
|
||
|
|
||
|
},{"get-intrinsic":10}],12:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var GetIntrinsic = require('get-intrinsic');
|
||
|
|
||
|
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
||
|
|
||
|
var hasPropertyDescriptors = function hasPropertyDescriptors() {
|
||
|
if ($defineProperty) {
|
||
|
try {
|
||
|
$defineProperty({}, 'a', { value: 1 });
|
||
|
return true;
|
||
|
} catch (e) {
|
||
|
// IE 8 has a broken defineProperty
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
};
|
||
|
|
||
|
hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
|
||
|
// node v0.6 has a bug where array lengths can be Set but not Defined
|
||
|
if (!hasPropertyDescriptors()) {
|
||
|
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;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
module.exports = hasPropertyDescriptors;
|
||
|
|
||
|
},{"get-intrinsic":10}],13:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var test = {
|
||
|
foo: {}
|
||
|
};
|
||
|
|
||
|
var $Object = Object;
|
||
|
|
||
|
module.exports = function hasProto() {
|
||
|
return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);
|
||
|
};
|
||
|
|
||
|
},{}],14:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
||
|
var hasSymbolSham = require('./shams');
|
||
|
|
||
|
module.exports = 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();
|
||
|
};
|
||
|
|
||
|
},{"./shams":15}],15:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
||
|
module.exports = 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;
|
||
|
};
|
||
|
|
||
|
},{}],16:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var call = Function.prototype.call;
|
||
|
var $hasOwn = Object.prototype.hasOwnProperty;
|
||
|
var bind = require('function-bind');
|
||
|
|
||
|
/** @type {(o: {}, p: PropertyKey) => p is keyof o} */
|
||
|
module.exports = bind.call(call, $hasOwn);
|
||
|
|
||
|
},{"function-bind":9}],17:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var keysShim;
|
||
|
if (!Object.keys) {
|
||
|
// modified from https://github.com/es-shims/es5-shim
|
||
|
var has = Object.prototype.hasOwnProperty;
|
||
|
var toStr = Object.prototype.toString;
|
||
|
var isArgs = require('./isArguments'); // eslint-disable-line global-require
|
||
|
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||
|
var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
|
||
|
var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
|
||
|
var dontEnums = [
|
||
|
'toString',
|
||
|
'toLocaleString',
|
||
|
'valueOf',
|
||
|
'hasOwnProperty',
|
||
|
'isPrototypeOf',
|
||
|
'propertyIsEnumerable',
|
||
|
'constructor'
|
||
|
];
|
||
|
var equalsConstructorPrototype = function (o) {
|
||
|
var ctor = o.constructor;
|
||
|
return ctor && ctor.prototype === o;
|
||
|
};
|
||
|
var excludedKeys = {
|
||
|
$applicationCache: true,
|
||
|
$console: true,
|
||
|
$external: true,
|
||
|
$frame: true,
|
||
|
$frameElement: true,
|
||
|
$frames: true,
|
||
|
$innerHeight: true,
|
||
|
$innerWidth: true,
|
||
|
$onmozfullscreenchange: true,
|
||
|
$onmozfullscreenerror: true,
|
||
|
$outerHeight: true,
|
||
|
$outerWidth: true,
|
||
|
$pageXOffset: true,
|
||
|
$pageYOffset: true,
|
||
|
$parent: true,
|
||
|
$scrollLeft: true,
|
||
|
$scrollTop: true,
|
||
|
$scrollX: true,
|
||
|
$scrollY: true,
|
||
|
$self: true,
|
||
|
$webkitIndexedDB: true,
|
||
|
$webkitStorageInfo: true,
|
||
|
$window: true
|
||
|
};
|
||
|
var hasAutomationEqualityBug = (function () {
|
||
|
/* global window */
|
||
|
if (typeof window === 'undefined') { return false; }
|
||
|
for (var k in window) {
|
||
|
try {
|
||
|
if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
|
||
|
try {
|
||
|
equalsConstructorPrototype(window[k]);
|
||
|
} catch (e) {
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
} catch (e) {
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}());
|
||
|
var equalsConstructorPrototypeIfNotBuggy = function (o) {
|
||
|
/* global window */
|
||
|
if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
|
||
|
return equalsConstructorPrototype(o);
|
||
|
}
|
||
|
try {
|
||
|
return equalsConstructorPrototype(o);
|
||
|
} catch (e) {
|
||
|
return false;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
keysShim = function keys(object) {
|
||
|
var isObject = object !== null && typeof object === 'object';
|
||
|
var isFunction = toStr.call(object) === '[object Function]';
|
||
|
var isArguments = isArgs(object);
|
||
|
var isString = isObject && toStr.call(object) === '[object String]';
|
||
|
var theKeys = [];
|
||
|
|
||
|
if (!isObject && !isFunction && !isArguments) {
|
||
|
throw new TypeError('Object.keys called on a non-object');
|
||
|
}
|
||
|
|
||
|
var skipProto = hasProtoEnumBug && isFunction;
|
||
|
if (isString && object.length > 0 && !has.call(object, 0)) {
|
||
|
for (var i = 0; i < object.length; ++i) {
|
||
|
theKeys.push(String(i));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (isArguments && object.length > 0) {
|
||
|
for (var j = 0; j < object.length; ++j) {
|
||
|
theKeys.push(String(j));
|
||
|
}
|
||
|
} else {
|
||
|
for (var name in object) {
|
||
|
if (!(skipProto && name === 'prototype') && has.call(object, name)) {
|
||
|
theKeys.push(String(name));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (hasDontEnumBug) {
|
||
|
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
|
||
|
|
||
|
for (var k = 0; k < dontEnums.length; ++k) {
|
||
|
if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
|
||
|
theKeys.push(dontEnums[k]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return theKeys;
|
||
|
};
|
||
|
}
|
||
|
module.exports = keysShim;
|
||
|
|
||
|
},{"./isArguments":19}],18:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var slice = Array.prototype.slice;
|
||
|
var isArgs = require('./isArguments');
|
||
|
|
||
|
var origKeys = Object.keys;
|
||
|
var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');
|
||
|
|
||
|
var originalKeys = Object.keys;
|
||
|
|
||
|
keysShim.shim = function shimObjectKeys() {
|
||
|
if (Object.keys) {
|
||
|
var keysWorksWithArguments = (function () {
|
||
|
// Safari 5.0 bug
|
||
|
var args = Object.keys(arguments);
|
||
|
return args && args.length === arguments.length;
|
||
|
}(1, 2));
|
||
|
if (!keysWorksWithArguments) {
|
||
|
Object.keys = function keys(object) { // eslint-disable-line func-name-matching
|
||
|
if (isArgs(object)) {
|
||
|
return originalKeys(slice.call(object));
|
||
|
}
|
||
|
return originalKeys(object);
|
||
|
};
|
||
|
}
|
||
|
} else {
|
||
|
Object.keys = keysShim;
|
||
|
}
|
||
|
return Object.keys || keysShim;
|
||
|
};
|
||
|
|
||
|
module.exports = keysShim;
|
||
|
|
||
|
},{"./implementation":17,"./isArguments":19}],19:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var toStr = Object.prototype.toString;
|
||
|
|
||
|
module.exports = function isArguments(value) {
|
||
|
var str = toStr.call(value);
|
||
|
var isArgs = str === '[object Arguments]';
|
||
|
if (!isArgs) {
|
||
|
isArgs = str !== '[object Array]' &&
|
||
|
value !== null &&
|
||
|
typeof value === 'object' &&
|
||
|
typeof value.length === 'number' &&
|
||
|
value.length >= 0 &&
|
||
|
toStr.call(value.callee) === '[object Function]';
|
||
|
}
|
||
|
return isArgs;
|
||
|
};
|
||
|
|
||
|
},{}],20:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var GetIntrinsic = require('get-intrinsic');
|
||
|
var define = require('define-data-property');
|
||
|
var hasDescriptors = require('has-property-descriptors')();
|
||
|
var gOPD = require('gopd');
|
||
|
|
||
|
var $TypeError = GetIntrinsic('%TypeError%');
|
||
|
var $floor = GetIntrinsic('%Math.floor%');
|
||
|
|
||
|
module.exports = function setFunctionLength(fn, length) {
|
||
|
if (typeof fn !== 'function') {
|
||
|
throw new $TypeError('`fn` is not a function');
|
||
|
}
|
||
|
if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $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(fn, 'length', length, true, true);
|
||
|
} else {
|
||
|
define(fn, 'length', length);
|
||
|
}
|
||
|
}
|
||
|
return fn;
|
||
|
};
|
||
|
|
||
|
},{"define-data-property":6,"get-intrinsic":10,"gopd":11,"has-property-descriptors":12}],21:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var implementation = require('./implementation');
|
||
|
|
||
|
var lacksProperEnumerationOrder = function () {
|
||
|
if (!Object.assign) {
|
||
|
return false;
|
||
|
}
|
||
|
/*
|
||
|
* v8, specifically in node 4.x, has a bug with incorrect property enumeration order
|
||
|
* note: this does not detect the bug unless there's 20 characters
|
||
|
*/
|
||
|
var str = 'abcdefghijklmnopqrst';
|
||
|
var letters = str.split('');
|
||
|
var map = {};
|
||
|
for (var i = 0; i < letters.length; ++i) {
|
||
|
map[letters[i]] = letters[i];
|
||
|
}
|
||
|
var obj = Object.assign({}, map);
|
||
|
var actual = '';
|
||
|
for (var k in obj) {
|
||
|
actual += k;
|
||
|
}
|
||
|
return str !== actual;
|
||
|
};
|
||
|
|
||
|
var assignHasPendingExceptions = function () {
|
||
|
if (!Object.assign || !Object.preventExtensions) {
|
||
|
return false;
|
||
|
}
|
||
|
/*
|
||
|
* Firefox 37 still has "pending exception" logic in its Object.assign implementation,
|
||
|
* which is 72% slower than our shim, and Firefox 40's native implementation.
|
||
|
*/
|
||
|
var thrower = Object.preventExtensions({ 1: 2 });
|
||
|
try {
|
||
|
Object.assign(thrower, 'xy');
|
||
|
} catch (e) {
|
||
|
return thrower[1] === 'y';
|
||
|
}
|
||
|
return false;
|
||
|
};
|
||
|
|
||
|
module.exports = function getPolyfill() {
|
||
|
if (!Object.assign) {
|
||
|
return implementation;
|
||
|
}
|
||
|
if (lacksProperEnumerationOrder()) {
|
||
|
return implementation;
|
||
|
}
|
||
|
if (assignHasPendingExceptions()) {
|
||
|
return implementation;
|
||
|
}
|
||
|
return Object.assign;
|
||
|
};
|
||
|
|
||
|
},{"./implementation":2}],22:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var define = require('define-properties');
|
||
|
var getPolyfill = require('./polyfill');
|
||
|
|
||
|
module.exports = function shimAssign() {
|
||
|
var polyfill = getPolyfill();
|
||
|
define(
|
||
|
Object,
|
||
|
{ assign: polyfill },
|
||
|
{ assign: function () { return Object.assign !== polyfill; } }
|
||
|
);
|
||
|
return polyfill;
|
||
|
};
|
||
|
|
||
|
},{"./polyfill":21,"define-properties":7}]},{},[1]);
|