5441 lines
188 KiB
JavaScript
5441 lines
188 KiB
JavaScript
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Equation = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
|
/*
|
|
* Constats
|
|
* Keys must be UPPERCASE
|
|
* Values Can be a constant value or a function returning a value
|
|
* this function doesn't take any arguments (use case: random constats)
|
|
*/
|
|
'use strict';
|
|
|
|
Object.defineProperty(exports, '__esModule', {
|
|
value: true
|
|
});
|
|
exports['default'] = {
|
|
'PI': Math.PI,
|
|
'E': Math.E,
|
|
'RAND': Math.random
|
|
};
|
|
module.exports = exports['default'];
|
|
|
|
},{}],2:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
Object.defineProperty(exports, '__esModule', {
|
|
value: true
|
|
});
|
|
var parseFormat = function parseFormat(a) {
|
|
var split = a.split('1');
|
|
return {
|
|
left: split[0].length,
|
|
right: split[1].length
|
|
};
|
|
};
|
|
|
|
exports.parseFormat = parseFormat;
|
|
var isNumber = function isNumber(a) {
|
|
return !isNaN(+a);
|
|
};
|
|
|
|
exports.isNumber = isNumber;
|
|
var parseNumbers = function parseNumbers(a) {
|
|
return a.map(function (b) {
|
|
if (isNumber(b)) {
|
|
return parseFloat(b);
|
|
}
|
|
if (Array.isArray(b)) {
|
|
return parseNumbers(b);
|
|
}
|
|
return b;
|
|
});
|
|
};
|
|
|
|
exports.parseNumbers = parseNumbers;
|
|
var dive = function dive(arr, n) {
|
|
var result = arr;
|
|
for (var i = 0; i < n; ++i) {
|
|
result = result[result.length - 1];
|
|
}
|
|
return result;
|
|
};
|
|
|
|
exports.dive = dive;
|
|
var deep = function deep(arr, n) {
|
|
var index = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2];
|
|
|
|
if (n < 2) {
|
|
return { arr: arr, index: index };
|
|
}
|
|
|
|
var d = arr.reduce(function (a, b, i) {
|
|
if (Array.isArray(b)) {
|
|
var _deep = deep(b, n - 1, i);
|
|
|
|
var _arr = _deep.arr;
|
|
var x = _deep.index;
|
|
var merged = a.concat(_arr);
|
|
|
|
index = x;
|
|
return merged;
|
|
}
|
|
return a;
|
|
}, []);
|
|
|
|
return { arr: d, index: index };
|
|
};
|
|
|
|
exports.deep = deep;
|
|
var diveTo = function diveTo(arr, indexes, replace) {
|
|
var answer = [];
|
|
if (indexes.some(Array.isArray)) {
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = indexes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var index = _step.value;
|
|
|
|
answer.push(diveTo(arr, index, replace));
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator['return']) {
|
|
_iterator['return']();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
arr[indexes[0]] = replace;
|
|
return replace;
|
|
}
|
|
|
|
return answer;
|
|
};
|
|
|
|
exports.diveTo = diveTo;
|
|
var flatten = function flatten(arr) {
|
|
if (!Array.isArray(arr) || !arr.some(Array.isArray)) {
|
|
return arr;
|
|
}
|
|
|
|
return arr.reduce(function (a, b) {
|
|
return a.concat(flatten(b));
|
|
}, []);
|
|
};
|
|
|
|
exports.flatten = flatten;
|
|
var removeSymbols = function removeSymbols(string) {
|
|
return string.toString().replace(/\W/g, '');
|
|
};
|
|
exports.removeSymbols = removeSymbols;
|
|
|
|
},{}],3:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
Object.defineProperty(exports, '__esModule', {
|
|
value: true
|
|
});
|
|
|
|
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
|
|
|
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
|
|
|
|
require('babel/polyfill');
|
|
|
|
var _readstream = require('./readstream');
|
|
|
|
var _readstream2 = _interopRequireDefault(_readstream);
|
|
|
|
var _operators = require('./operators');
|
|
|
|
var _operators2 = _interopRequireDefault(_operators);
|
|
|
|
var _constants = require('./constants');
|
|
|
|
var _constants2 = _interopRequireDefault(_constants);
|
|
|
|
var _helpers = require('./helpers');
|
|
|
|
var _ = _interopRequireWildcard(_helpers);
|
|
|
|
var Equation = {
|
|
/**
|
|
* Solves the given math expression, following these steps:
|
|
* 1. Replace constants in the expression
|
|
* 2. parse the expression, separating numbers and operators into
|
|
* an array
|
|
* 3. Sort the stack by operators' precedence, it actually groups the
|
|
* operator with it's arguments n-level deep
|
|
* 4. Apply parseFloat to numbers of the array
|
|
* 5. Solve groups recursively
|
|
*
|
|
* @param {String} expression
|
|
* The math expression to solve
|
|
* @return {Number}
|
|
* Result of the expression
|
|
*/
|
|
solve: function solve(expression) {
|
|
// replace constants with their values
|
|
expression = replaceConstants(expression);
|
|
|
|
var stack = parseExpression(expression);
|
|
stack = sortStack(stack);
|
|
stack = _.parseNumbers(stack);
|
|
stack = solveStack(stack);
|
|
|
|
return stack;
|
|
},
|
|
|
|
/**
|
|
* Creates an equation function which replaces variables
|
|
* in the given expression with the values specified in order,
|
|
* and solves the new expression
|
|
*
|
|
* Example:
|
|
* equation('x+y+z')(2, 5, 6) => solve('2+5+6')
|
|
*
|
|
* @param {String} expression
|
|
* The expression to create an equation for (containing variables)
|
|
* @return {Function}
|
|
* The function which replaces variables with values in order
|
|
* and solves the expression
|
|
*/
|
|
equation: function equation(expression) {
|
|
var stack = parseExpression(expression);
|
|
var variables = [];
|
|
|
|
stack.forEach(function varCheck(a) {
|
|
if (Array.isArray(a)) {
|
|
return a.forEach(varCheck);
|
|
}
|
|
if (isVariable(a)) {
|
|
// grouped variables like (y) need to have their parantheses removed
|
|
variables.push(_.removeSymbols(a));
|
|
}
|
|
});
|
|
|
|
return function () {
|
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
stack.forEach(function varCheck(a, i, arr) {
|
|
if (Array.isArray(a)) {
|
|
return a.forEach(varCheck);
|
|
}
|
|
|
|
var index = variables.indexOf(a);
|
|
if (index > -1) {
|
|
// grouped variables like (y) need to have their parantheses removed
|
|
arr[i] = args[index];
|
|
}
|
|
});
|
|
|
|
stack = sortStack(stack);
|
|
stack = _.parseNumbers(stack);
|
|
stack = solveStack(stack);
|
|
|
|
return stack;
|
|
};
|
|
},
|
|
|
|
registerOperator: function registerOperator(key, options) {
|
|
_operators2['default'][key] = options;
|
|
},
|
|
|
|
registerConstant: function registerConstant(key, options) {
|
|
_constants2['default'][key] = options;
|
|
}
|
|
};
|
|
|
|
var solveStack = function solveStack(_x) {
|
|
var _again = true;
|
|
|
|
_function: while (_again) {
|
|
var stack = _x;
|
|
_again = false;
|
|
|
|
// if an operator takes an expression argument, we should not dive into it
|
|
// and solve the expression inside
|
|
var hasExpressionArgument = stack.some(function (a) {
|
|
return _operators2['default'][a] && _operators2['default'][a].hasExpression;
|
|
});
|
|
|
|
if (!hasExpressionArgument && stack.some(Array.isArray)) {
|
|
stack = stack.map(function (group) {
|
|
if (!Array.isArray(group)) {
|
|
return group;
|
|
}
|
|
return solveStack(group);
|
|
});
|
|
|
|
_x = stack;
|
|
_again = true;
|
|
hasExpressionArgument = undefined;
|
|
continue _function;
|
|
} else {
|
|
return evaluate(stack);
|
|
}
|
|
}
|
|
};
|
|
|
|
var PRECEDENCES = Object.keys(_operators2['default']).map(function (key) {
|
|
return _operators2['default'][key].precedence;
|
|
});
|
|
|
|
var MAX_PRECEDENCE = Math.max.apply(Math, _toConsumableArray(PRECEDENCES));
|
|
var MIN_PRECEDENCE = Math.min.apply(Math, _toConsumableArray(PRECEDENCES));
|
|
|
|
/**
|
|
* Parses the given expression into an array of separated
|
|
* numbers and operators/functions.
|
|
* The result is passed to parseGroups
|
|
*
|
|
* @param {String} expression
|
|
* The expression to parse
|
|
* @return {Array}
|
|
* The parsed array
|
|
*/
|
|
var parseExpression = function parseExpression(expression) {
|
|
// function arguments can be separated using comma,
|
|
// but we parse as groups, so this is the solution to getting comma to work
|
|
// sigma(0, 4, 2@) becomes sigma(0)(4)(2@) so every argument is parsed
|
|
// separately
|
|
expression = expression.replace(/,/g, ')(');
|
|
|
|
var stream = new _readstream2['default'](expression),
|
|
stack = [],
|
|
record = '',
|
|
cur = undefined,
|
|
past = undefined;
|
|
|
|
// Create an array of separated numbers & operators
|
|
while (stream.next()) {
|
|
cur = stream.current();
|
|
past = stack.length - 1;
|
|
|
|
if (cur === ' ') {
|
|
continue;
|
|
}
|
|
|
|
// it's probably a function with a length more than one
|
|
if (!_.isNumber(cur) && !_operators2['default'][cur] && cur !== '.' && cur !== '(' && cur !== ')') {
|
|
|
|
record += cur;
|
|
} else if (record.length) {
|
|
var beforeRecord = past - (record.length - 1);
|
|
if (isVariable(record) && _.isNumber(stack[beforeRecord])) {
|
|
stack.push('*');
|
|
}
|
|
stack.push(record, cur);
|
|
record = '';
|
|
|
|
// numbers and decimals
|
|
} else if (_.isNumber(stack[past]) && (_.isNumber(cur) || cur === '.')) {
|
|
|
|
stack[past] += cur;
|
|
|
|
// negation sign
|
|
} else if (stack[past] === '-') {
|
|
var beforeSign = stack[past - 1];
|
|
|
|
// 2 / -5 is OK, pass
|
|
if (_operators2['default'][beforeSign]) {
|
|
stack[past] += cur;
|
|
|
|
// (2+1) - 5 becomes (2+1) + -5
|
|
} else if (beforeSign === ')') {
|
|
stack[past] = '+';
|
|
stack.push('-' + cur);
|
|
|
|
// 2 - 5 is also OK, pass
|
|
} else if (_.isNumber(beforeSign) || isVariable(beforeSign)) {
|
|
stack.push(cur);
|
|
} else {
|
|
stack[past] += cur;
|
|
}
|
|
} else {
|
|
stack.push(cur);
|
|
}
|
|
}
|
|
if (record.length) {
|
|
var beforeRecord = past - (record.length - 1);
|
|
if (isVariable(record) && _.isNumber(stack[beforeRecord])) {
|
|
stack.push('*');
|
|
}
|
|
stack.push(record);
|
|
}
|
|
|
|
return parseGroups(stack);
|
|
};
|
|
|
|
/**
|
|
* Takes the parsed array from parseExpression and
|
|
* groups up expressions in parantheses in deep arrays
|
|
*
|
|
* Example: 2+(5+4) becomes [2, [5, '+', 4]]
|
|
*
|
|
* @param {Array} stack
|
|
* The parsed expression
|
|
* @return {Array}
|
|
* Grouped up expression
|
|
*/
|
|
var parseGroups = function parseGroups(stack) {
|
|
// Parantheses become inner arrays which will then be processed first
|
|
var depth = 0;
|
|
return stack.reduce(function (a, b) {
|
|
if (b.indexOf('(') > -1) {
|
|
if (b.length > 1) {
|
|
_.dive(a, depth).push(b.replace('(', ''), []);
|
|
} else {
|
|
_.dive(a, depth).push([]);
|
|
}
|
|
depth++;
|
|
} else if (b === ')') {
|
|
depth--;
|
|
} else {
|
|
_.dive(a, depth).push(b);
|
|
}
|
|
return a;
|
|
}, []);
|
|
};
|
|
|
|
/**
|
|
* Gives information about an operator's format
|
|
* including number of left and right arguments
|
|
*
|
|
* @param {String/Object} operator
|
|
* The operator object or operator name (e.g. +, -)
|
|
* @return {Object}
|
|
* An object including the count of left and right arguments
|
|
*/
|
|
var formatInfo = function formatInfo(operator) {
|
|
var op = typeof operator === 'string' ? _operators2['default'][operator] : operator;
|
|
|
|
if (!op) {
|
|
return null;
|
|
}
|
|
|
|
var format = op.format.split('1'),
|
|
left = format[0].length,
|
|
right = format[1].length;
|
|
|
|
return { left: left, right: right };
|
|
};
|
|
|
|
/**
|
|
* Groups up operators and their arguments based on their precedence
|
|
* in deep arrays, the higher the priority, the deeper the group.
|
|
* This simplifies the evaluating process, the only thing to do is to
|
|
* evaluate from bottom up, evaluating deep groups first
|
|
*
|
|
* @param {Array} stack
|
|
* The parsed and grouped expression
|
|
* @return {Array}
|
|
* Grouped expression based on precedences
|
|
*/
|
|
var sortStack = function sortStack(stack) {
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = stack.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var _step$value = _slicedToArray(_step.value, 2);
|
|
|
|
var index = _step$value[0];
|
|
var item = _step$value[1];
|
|
|
|
if (Array.isArray(item)) {
|
|
stack.splice(index, 1, sortStack(item));
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator['return']) {
|
|
_iterator['return']();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
for (var i = MIN_PRECEDENCE; i <= MAX_PRECEDENCE; i++) {
|
|
for (var index = 0; index < stack.length; ++index) {
|
|
var item = stack[index];
|
|
var op = _operators2['default'][item];
|
|
|
|
if (!op || op.precedence !== i) {
|
|
continue;
|
|
}
|
|
|
|
var _formatInfo = formatInfo(op);
|
|
|
|
var left = _formatInfo.left;
|
|
var right = _formatInfo.right;
|
|
|
|
var group = stack.splice(index - left, left + right + 1, []);
|
|
stack[index - left] = group;
|
|
|
|
for (var y = 0; y < i; y++) {
|
|
group = [group];
|
|
}
|
|
|
|
index -= right;
|
|
}
|
|
}
|
|
|
|
return stack;
|
|
};
|
|
|
|
/**
|
|
* Evaluates the given math expression.
|
|
* The expression is an array with an operator and arguments
|
|
*
|
|
* Example: evaluate([2, '+', 4]) == 6
|
|
*
|
|
* @param {Array} stack
|
|
* A single math expression
|
|
* @return {Number}
|
|
* Result of the expression
|
|
*/
|
|
var evaluate = function evaluate(stack) {
|
|
var _operators$op;
|
|
|
|
var op = findOperator(stack);
|
|
if (!op) {
|
|
return stack[0];
|
|
}
|
|
|
|
var _formatInfo2 = formatInfo(op);
|
|
|
|
var left = _formatInfo2.left;
|
|
|
|
var leftArguments = stack.slice(0, left),
|
|
rightArguments = stack.slice(left + 1);
|
|
|
|
return fixFloat((_operators$op = _operators2['default'][op]).fn.apply(_operators$op, _toConsumableArray(leftArguments).concat(_toConsumableArray(rightArguments))));
|
|
};
|
|
|
|
/**
|
|
* Finds the first operator in an array and returns it
|
|
*
|
|
* @param {Array} arr
|
|
* The array to look for an operator in
|
|
* @return {Object}
|
|
* The operator object or null if no operator is found
|
|
*/
|
|
var findOperator = function findOperator(arr) {
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = arr[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var o = _step2.value;
|
|
|
|
if (typeof o === 'string') {
|
|
return o;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2['return']) {
|
|
_iterator2['return']();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
|
|
return null;
|
|
};
|
|
|
|
/**
|
|
* Replaces constants in a string with their values
|
|
*
|
|
* @param {String} expression
|
|
* The expression to replace constants in
|
|
* @return {String}
|
|
* The expression with constants replaced
|
|
*/
|
|
var replaceConstants = function replaceConstants(expression) {
|
|
return expression.replace(/[A-Z]*/g, function (a) {
|
|
var c = _constants2['default'][a];
|
|
if (!c) {
|
|
return a;
|
|
}
|
|
return typeof c === 'function' ? c() : c;
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Fixes JavaScript's floating point precisions - Issue #5
|
|
*
|
|
* @param {Number} number
|
|
* The number to fix
|
|
* @return {Number}
|
|
* Fixed number
|
|
*/
|
|
var fixFloat = function fixFloat(number) {
|
|
return +number.toFixed(15);
|
|
};
|
|
|
|
/**
|
|
* Recognizes variables such as x, y, z
|
|
* @param {String} a
|
|
* The string to check for
|
|
* @return {Boolean}
|
|
* true if variable, else false
|
|
*/
|
|
|
|
var SPECIALS = '()[]{}'.split('');
|
|
var isVariable = function isVariable(a) {
|
|
return typeof a === 'string' && !_.isNumber(a) && !_operators2['default'][a] && a === a.toLowerCase() && SPECIALS.indexOf(a) === -1;
|
|
};
|
|
|
|
exports.isVariable = isVariable;
|
|
exports['default'] = Equation;
|
|
|
|
},{"./constants":1,"./helpers":2,"./operators":4,"./readstream":5,"babel/polyfill":8}],4:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
Object.defineProperty(exports, '__esModule', {
|
|
value: true
|
|
});
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
var _index = require('./index');
|
|
|
|
var _index2 = _interopRequireDefault(_index);
|
|
|
|
/*
|
|
* Operators and Functions
|
|
* fn: function used to evaluate value
|
|
* format: the format using which arguments are parsed:
|
|
* 0 indicates an argument and 1 indicates the operator
|
|
* e.g: factorial is 01, add is 010, like 2!, 2+2
|
|
* precedence: determines which operators should be evaluated first
|
|
* the lower the value, the higher the precedence
|
|
* hasExpression: determines if any of the operator arguments are an expression
|
|
* This way, arguments will not be solved by equation and instead
|
|
* you have to call solve on each argument yourself.
|
|
* You get the arguments as parsed arrays sigma(0, 5, 2@) becomes
|
|
* sigma(0, 5, [2, '*', '@']). See sigma operator for reference
|
|
*/
|
|
exports['default'] = {
|
|
'^': {
|
|
fn: function fn(a, b) {
|
|
return Math.pow(a, b);
|
|
},
|
|
format: '010',
|
|
precedence: 0
|
|
},
|
|
'*': {
|
|
fn: function fn(a, b) {
|
|
return a * b;
|
|
},
|
|
format: '010',
|
|
precedence: 1
|
|
},
|
|
'/': {
|
|
fn: function fn(a, b) {
|
|
return a / b;
|
|
},
|
|
format: '010',
|
|
precedence: 1
|
|
},
|
|
'%': {
|
|
fn: function fn(a, b) {
|
|
return a % b;
|
|
},
|
|
format: '010',
|
|
precedence: 1
|
|
},
|
|
'\\': {
|
|
fn: function fn(a, b) {
|
|
return Math.floor(a / b);
|
|
},
|
|
format: '010',
|
|
precedence: 1
|
|
},
|
|
'+': {
|
|
fn: function fn(a, b) {
|
|
return a + b;
|
|
},
|
|
format: '010',
|
|
precedence: 2
|
|
},
|
|
'-': {
|
|
fn: function fn(a, b) {
|
|
return a - b;
|
|
},
|
|
format: '010',
|
|
precedence: 2
|
|
},
|
|
'!': {
|
|
fn: function fn(a) {
|
|
var sum = 1;
|
|
for (var i = 1; i <= a; ++i) {
|
|
sum *= i;
|
|
}
|
|
return sum;
|
|
},
|
|
format: '01',
|
|
precedence: 2
|
|
},
|
|
'log': {
|
|
fn: Math.log,
|
|
format: '10',
|
|
precedence: -1
|
|
},
|
|
'ln': {
|
|
fn: Math.log,
|
|
format: '10',
|
|
precedence: -1
|
|
},
|
|
'lg': {
|
|
fn: function fn(a) {
|
|
return Math.log(a) / Math.log(2);
|
|
},
|
|
format: '10',
|
|
precedence: -1
|
|
},
|
|
'sin': {
|
|
fn: Math.sin,
|
|
format: '10',
|
|
precedence: -1
|
|
},
|
|
'cos': {
|
|
fn: Math.cos,
|
|
format: '10',
|
|
precedence: -1
|
|
},
|
|
'tan': {
|
|
fn: Math.tan,
|
|
format: '10',
|
|
precedence: -1
|
|
},
|
|
'cot': {
|
|
fn: Math.cot,
|
|
format: '10',
|
|
precedence: -1
|
|
},
|
|
'round': {
|
|
fn: Math.round,
|
|
format: '10',
|
|
precedence: -1
|
|
},
|
|
'floor': {
|
|
fn: Math.floor,
|
|
format: '10',
|
|
precedence: -1
|
|
},
|
|
'sigma': {
|
|
fn: function fn(from, to, expression) {
|
|
var expr = expression.join('').replace(/,/g, '');
|
|
var regex = new RegExp(ITERATOR_SIGN, 'g');
|
|
|
|
var sum = 0;
|
|
for (var i = from; i <= to; i++) {
|
|
sum += _index2['default'].solve(expr.replace(regex, i));
|
|
}
|
|
return sum;
|
|
},
|
|
format: '1000',
|
|
hasExpression: true,
|
|
precedence: -1
|
|
}
|
|
};
|
|
|
|
var ITERATOR_SIGN = '@';
|
|
module.exports = exports['default'];
|
|
|
|
},{"./index":3}],5:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
Object.defineProperty(exports, '__esModule', {
|
|
value: true
|
|
});
|
|
|
|
exports['default'] = function (string) {
|
|
var i = 0,
|
|
buffer = [];
|
|
return {
|
|
next: function next() {
|
|
buffer.push(string[i]);
|
|
|
|
if (i >= string.length) {
|
|
return null;
|
|
}
|
|
return string[i++];
|
|
},
|
|
current: function current() {
|
|
return string[i - 1];
|
|
},
|
|
index: function index() {
|
|
return i - 1;
|
|
},
|
|
to: function to(n) {
|
|
var temp = '';
|
|
var dest = i + n;
|
|
for (i = i; i < dest; ++i) {
|
|
temp += [string[i]];
|
|
}
|
|
return temp;
|
|
},
|
|
drain: function drain() {
|
|
return buffer.splice(0, buffer.length);
|
|
},
|
|
replace: function replace(start, end, _replace) {
|
|
var temp = string.split('');
|
|
temp.splice(start, end, _replace);
|
|
string = temp.join('');
|
|
|
|
i = i - (end - start);
|
|
},
|
|
go: function go(n) {
|
|
i += n;
|
|
},
|
|
all: function all() {
|
|
return string;
|
|
}
|
|
};
|
|
};
|
|
|
|
module.exports = exports['default'];
|
|
|
|
},{}],6:[function(require,module,exports){
|
|
(function (global){
|
|
"use strict";
|
|
|
|
require("core-js/shim");
|
|
|
|
require("regenerator/runtime");
|
|
|
|
if (global._babelPolyfill) {
|
|
throw new Error("only one instance of babel/polyfill is allowed");
|
|
}
|
|
global._babelPolyfill = true;
|
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
},{"core-js/shim":195,"regenerator/runtime":197}],7:[function(require,module,exports){
|
|
module.exports = require("./lib/polyfill");
|
|
|
|
},{"./lib/polyfill":6}],8:[function(require,module,exports){
|
|
module.exports = require("babel-core/polyfill");
|
|
|
|
},{"babel-core/polyfill":7}],9:[function(require,module,exports){
|
|
module.exports = function(it){
|
|
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
|
|
return it;
|
|
};
|
|
},{}],10:[function(require,module,exports){
|
|
// 22.1.3.31 Array.prototype[@@unscopables]
|
|
var UNSCOPABLES = require('./$.wks')('unscopables')
|
|
, ArrayProto = Array.prototype;
|
|
if(ArrayProto[UNSCOPABLES] == undefined)require('./$.hide')(ArrayProto, UNSCOPABLES, {});
|
|
module.exports = function(key){
|
|
ArrayProto[UNSCOPABLES][key] = true;
|
|
};
|
|
},{"./$.hide":38,"./$.wks":90}],11:[function(require,module,exports){
|
|
var isObject = require('./$.is-object');
|
|
module.exports = function(it){
|
|
if(!isObject(it))throw TypeError(it + ' is not an object!');
|
|
return it;
|
|
};
|
|
},{"./$.is-object":45}],12:[function(require,module,exports){
|
|
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
|
|
'use strict';
|
|
var toObject = require('./$.to-object')
|
|
, toIndex = require('./$.to-index')
|
|
, toLength = require('./$.to-length');
|
|
|
|
module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){
|
|
var O = toObject(this)
|
|
, len = toLength(O.length)
|
|
, to = toIndex(target, len)
|
|
, from = toIndex(start, len)
|
|
, $$ = arguments
|
|
, end = $$.length > 2 ? $$[2] : undefined
|
|
, count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to)
|
|
, inc = 1;
|
|
if(from < to && to < from + count){
|
|
inc = -1;
|
|
from += count - 1;
|
|
to += count - 1;
|
|
}
|
|
while(count-- > 0){
|
|
if(from in O)O[to] = O[from];
|
|
else delete O[to];
|
|
to += inc;
|
|
from += inc;
|
|
} return O;
|
|
};
|
|
},{"./$.to-index":83,"./$.to-length":86,"./$.to-object":87}],13:[function(require,module,exports){
|
|
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
|
|
'use strict';
|
|
var toObject = require('./$.to-object')
|
|
, toIndex = require('./$.to-index')
|
|
, toLength = require('./$.to-length');
|
|
module.exports = [].fill || function fill(value /*, start = 0, end = @length */){
|
|
var O = toObject(this)
|
|
, length = toLength(O.length)
|
|
, $$ = arguments
|
|
, $$len = $$.length
|
|
, index = toIndex($$len > 1 ? $$[1] : undefined, length)
|
|
, end = $$len > 2 ? $$[2] : undefined
|
|
, endPos = end === undefined ? length : toIndex(end, length);
|
|
while(endPos > index)O[index++] = value;
|
|
return O;
|
|
};
|
|
},{"./$.to-index":83,"./$.to-length":86,"./$.to-object":87}],14:[function(require,module,exports){
|
|
// false -> Array#indexOf
|
|
// true -> Array#includes
|
|
var toIObject = require('./$.to-iobject')
|
|
, toLength = require('./$.to-length')
|
|
, toIndex = require('./$.to-index');
|
|
module.exports = function(IS_INCLUDES){
|
|
return function($this, el, fromIndex){
|
|
var O = toIObject($this)
|
|
, length = toLength(O.length)
|
|
, index = toIndex(fromIndex, length)
|
|
, value;
|
|
// Array#includes uses SameValueZero equality algorithm
|
|
if(IS_INCLUDES && el != el)while(length > index){
|
|
value = O[index++];
|
|
if(value != value)return true;
|
|
// Array#toIndex ignores holes, Array#includes - not
|
|
} else for(;length > index; index++)if(IS_INCLUDES || index in O){
|
|
if(O[index] === el)return IS_INCLUDES || index;
|
|
} return !IS_INCLUDES && -1;
|
|
};
|
|
};
|
|
},{"./$.to-index":83,"./$.to-iobject":85,"./$.to-length":86}],15:[function(require,module,exports){
|
|
// 0 -> Array#forEach
|
|
// 1 -> Array#map
|
|
// 2 -> Array#filter
|
|
// 3 -> Array#some
|
|
// 4 -> Array#every
|
|
// 5 -> Array#find
|
|
// 6 -> Array#findIndex
|
|
var ctx = require('./$.ctx')
|
|
, IObject = require('./$.iobject')
|
|
, toObject = require('./$.to-object')
|
|
, toLength = require('./$.to-length')
|
|
, asc = require('./$.array-species-create');
|
|
module.exports = function(TYPE){
|
|
var IS_MAP = TYPE == 1
|
|
, IS_FILTER = TYPE == 2
|
|
, IS_SOME = TYPE == 3
|
|
, IS_EVERY = TYPE == 4
|
|
, IS_FIND_INDEX = TYPE == 6
|
|
, NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
|
|
return function($this, callbackfn, that){
|
|
var O = toObject($this)
|
|
, self = IObject(O)
|
|
, f = ctx(callbackfn, that, 3)
|
|
, length = toLength(self.length)
|
|
, index = 0
|
|
, result = IS_MAP ? asc($this, length) : IS_FILTER ? asc($this, 0) : undefined
|
|
, val, res;
|
|
for(;length > index; index++)if(NO_HOLES || index in self){
|
|
val = self[index];
|
|
res = f(val, index, O);
|
|
if(TYPE){
|
|
if(IS_MAP)result[index] = res; // map
|
|
else if(res)switch(TYPE){
|
|
case 3: return true; // some
|
|
case 5: return val; // find
|
|
case 6: return index; // findIndex
|
|
case 2: result.push(val); // filter
|
|
} else if(IS_EVERY)return false; // every
|
|
}
|
|
}
|
|
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
|
|
};
|
|
};
|
|
},{"./$.array-species-create":16,"./$.ctx":24,"./$.iobject":41,"./$.to-length":86,"./$.to-object":87}],16:[function(require,module,exports){
|
|
// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
|
|
var isObject = require('./$.is-object')
|
|
, isArray = require('./$.is-array')
|
|
, SPECIES = require('./$.wks')('species');
|
|
module.exports = function(original, length){
|
|
var C;
|
|
if(isArray(original)){
|
|
C = original.constructor;
|
|
// cross-realm fallback
|
|
if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined;
|
|
if(isObject(C)){
|
|
C = C[SPECIES];
|
|
if(C === null)C = undefined;
|
|
}
|
|
} return new (C === undefined ? Array : C)(length);
|
|
};
|
|
},{"./$.is-array":43,"./$.is-object":45,"./$.wks":90}],17:[function(require,module,exports){
|
|
// getting tag from 19.1.3.6 Object.prototype.toString()
|
|
var cof = require('./$.cof')
|
|
, TAG = require('./$.wks')('toStringTag')
|
|
// ES3 wrong here
|
|
, ARG = cof(function(){ return arguments; }()) == 'Arguments';
|
|
|
|
module.exports = function(it){
|
|
var O, T, B;
|
|
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
// @@toStringTag case
|
|
: typeof (T = (O = Object(it))[TAG]) == 'string' ? T
|
|
// builtinTag case
|
|
: ARG ? cof(O)
|
|
// ES3 arguments fallback
|
|
: (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
|
|
};
|
|
},{"./$.cof":18,"./$.wks":90}],18:[function(require,module,exports){
|
|
var toString = {}.toString;
|
|
|
|
module.exports = function(it){
|
|
return toString.call(it).slice(8, -1);
|
|
};
|
|
},{}],19:[function(require,module,exports){
|
|
'use strict';
|
|
var $ = require('./$')
|
|
, hide = require('./$.hide')
|
|
, redefineAll = require('./$.redefine-all')
|
|
, ctx = require('./$.ctx')
|
|
, strictNew = require('./$.strict-new')
|
|
, defined = require('./$.defined')
|
|
, forOf = require('./$.for-of')
|
|
, $iterDefine = require('./$.iter-define')
|
|
, step = require('./$.iter-step')
|
|
, ID = require('./$.uid')('id')
|
|
, $has = require('./$.has')
|
|
, isObject = require('./$.is-object')
|
|
, setSpecies = require('./$.set-species')
|
|
, DESCRIPTORS = require('./$.descriptors')
|
|
, isExtensible = Object.isExtensible || isObject
|
|
, SIZE = DESCRIPTORS ? '_s' : 'size'
|
|
, id = 0;
|
|
|
|
var fastKey = function(it, create){
|
|
// return primitive with prefix
|
|
if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
|
|
if(!$has(it, ID)){
|
|
// can't set id to frozen object
|
|
if(!isExtensible(it))return 'F';
|
|
// not necessary to add id
|
|
if(!create)return 'E';
|
|
// add missing object id
|
|
hide(it, ID, ++id);
|
|
// return object id with prefix
|
|
} return 'O' + it[ID];
|
|
};
|
|
|
|
var getEntry = function(that, key){
|
|
// fast case
|
|
var index = fastKey(key), entry;
|
|
if(index !== 'F')return that._i[index];
|
|
// frozen object case
|
|
for(entry = that._f; entry; entry = entry.n){
|
|
if(entry.k == key)return entry;
|
|
}
|
|
};
|
|
|
|
module.exports = {
|
|
getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
|
|
var C = wrapper(function(that, iterable){
|
|
strictNew(that, C, NAME);
|
|
that._i = $.create(null); // index
|
|
that._f = undefined; // first entry
|
|
that._l = undefined; // last entry
|
|
that[SIZE] = 0; // size
|
|
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
|
|
});
|
|
redefineAll(C.prototype, {
|
|
// 23.1.3.1 Map.prototype.clear()
|
|
// 23.2.3.2 Set.prototype.clear()
|
|
clear: function clear(){
|
|
for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){
|
|
entry.r = true;
|
|
if(entry.p)entry.p = entry.p.n = undefined;
|
|
delete data[entry.i];
|
|
}
|
|
that._f = that._l = undefined;
|
|
that[SIZE] = 0;
|
|
},
|
|
// 23.1.3.3 Map.prototype.delete(key)
|
|
// 23.2.3.4 Set.prototype.delete(value)
|
|
'delete': function(key){
|
|
var that = this
|
|
, entry = getEntry(that, key);
|
|
if(entry){
|
|
var next = entry.n
|
|
, prev = entry.p;
|
|
delete that._i[entry.i];
|
|
entry.r = true;
|
|
if(prev)prev.n = next;
|
|
if(next)next.p = prev;
|
|
if(that._f == entry)that._f = next;
|
|
if(that._l == entry)that._l = prev;
|
|
that[SIZE]--;
|
|
} return !!entry;
|
|
},
|
|
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
|
|
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
|
|
forEach: function forEach(callbackfn /*, that = undefined */){
|
|
var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3)
|
|
, entry;
|
|
while(entry = entry ? entry.n : this._f){
|
|
f(entry.v, entry.k, this);
|
|
// revert to the last existing entry
|
|
while(entry && entry.r)entry = entry.p;
|
|
}
|
|
},
|
|
// 23.1.3.7 Map.prototype.has(key)
|
|
// 23.2.3.7 Set.prototype.has(value)
|
|
has: function has(key){
|
|
return !!getEntry(this, key);
|
|
}
|
|
});
|
|
if(DESCRIPTORS)$.setDesc(C.prototype, 'size', {
|
|
get: function(){
|
|
return defined(this[SIZE]);
|
|
}
|
|
});
|
|
return C;
|
|
},
|
|
def: function(that, key, value){
|
|
var entry = getEntry(that, key)
|
|
, prev, index;
|
|
// change existing entry
|
|
if(entry){
|
|
entry.v = value;
|
|
// create new entry
|
|
} else {
|
|
that._l = entry = {
|
|
i: index = fastKey(key, true), // <- index
|
|
k: key, // <- key
|
|
v: value, // <- value
|
|
p: prev = that._l, // <- previous entry
|
|
n: undefined, // <- next entry
|
|
r: false // <- removed
|
|
};
|
|
if(!that._f)that._f = entry;
|
|
if(prev)prev.n = entry;
|
|
that[SIZE]++;
|
|
// add to index
|
|
if(index !== 'F')that._i[index] = entry;
|
|
} return that;
|
|
},
|
|
getEntry: getEntry,
|
|
setStrong: function(C, NAME, IS_MAP){
|
|
// add .keys, .values, .entries, [@@iterator]
|
|
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
|
|
$iterDefine(C, NAME, function(iterated, kind){
|
|
this._t = iterated; // target
|
|
this._k = kind; // kind
|
|
this._l = undefined; // previous
|
|
}, function(){
|
|
var that = this
|
|
, kind = that._k
|
|
, entry = that._l;
|
|
// revert to the last existing entry
|
|
while(entry && entry.r)entry = entry.p;
|
|
// get next entry
|
|
if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){
|
|
// or finish the iteration
|
|
that._t = undefined;
|
|
return step(1);
|
|
}
|
|
// return step by kind
|
|
if(kind == 'keys' )return step(0, entry.k);
|
|
if(kind == 'values')return step(0, entry.v);
|
|
return step(0, [entry.k, entry.v]);
|
|
}, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);
|
|
|
|
// add [@@species], 23.1.2.2, 23.2.2.2
|
|
setSpecies(NAME);
|
|
}
|
|
};
|
|
},{"./$":53,"./$.ctx":24,"./$.defined":25,"./$.descriptors":26,"./$.for-of":34,"./$.has":37,"./$.hide":38,"./$.is-object":45,"./$.iter-define":49,"./$.iter-step":51,"./$.redefine-all":67,"./$.set-species":72,"./$.strict-new":76,"./$.uid":89}],20:[function(require,module,exports){
|
|
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
|
|
var forOf = require('./$.for-of')
|
|
, classof = require('./$.classof');
|
|
module.exports = function(NAME){
|
|
return function toJSON(){
|
|
if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic");
|
|
var arr = [];
|
|
forOf(this, false, arr.push, arr);
|
|
return arr;
|
|
};
|
|
};
|
|
},{"./$.classof":17,"./$.for-of":34}],21:[function(require,module,exports){
|
|
'use strict';
|
|
var hide = require('./$.hide')
|
|
, redefineAll = require('./$.redefine-all')
|
|
, anObject = require('./$.an-object')
|
|
, isObject = require('./$.is-object')
|
|
, strictNew = require('./$.strict-new')
|
|
, forOf = require('./$.for-of')
|
|
, createArrayMethod = require('./$.array-methods')
|
|
, $has = require('./$.has')
|
|
, WEAK = require('./$.uid')('weak')
|
|
, isExtensible = Object.isExtensible || isObject
|
|
, arrayFind = createArrayMethod(5)
|
|
, arrayFindIndex = createArrayMethod(6)
|
|
, id = 0;
|
|
|
|
// fallback for frozen keys
|
|
var frozenStore = function(that){
|
|
return that._l || (that._l = new FrozenStore);
|
|
};
|
|
var FrozenStore = function(){
|
|
this.a = [];
|
|
};
|
|
var findFrozen = function(store, key){
|
|
return arrayFind(store.a, function(it){
|
|
return it[0] === key;
|
|
});
|
|
};
|
|
FrozenStore.prototype = {
|
|
get: function(key){
|
|
var entry = findFrozen(this, key);
|
|
if(entry)return entry[1];
|
|
},
|
|
has: function(key){
|
|
return !!findFrozen(this, key);
|
|
},
|
|
set: function(key, value){
|
|
var entry = findFrozen(this, key);
|
|
if(entry)entry[1] = value;
|
|
else this.a.push([key, value]);
|
|
},
|
|
'delete': function(key){
|
|
var index = arrayFindIndex(this.a, function(it){
|
|
return it[0] === key;
|
|
});
|
|
if(~index)this.a.splice(index, 1);
|
|
return !!~index;
|
|
}
|
|
};
|
|
|
|
module.exports = {
|
|
getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
|
|
var C = wrapper(function(that, iterable){
|
|
strictNew(that, C, NAME);
|
|
that._i = id++; // collection id
|
|
that._l = undefined; // leak store for frozen objects
|
|
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
|
|
});
|
|
redefineAll(C.prototype, {
|
|
// 23.3.3.2 WeakMap.prototype.delete(key)
|
|
// 23.4.3.3 WeakSet.prototype.delete(value)
|
|
'delete': function(key){
|
|
if(!isObject(key))return false;
|
|
if(!isExtensible(key))return frozenStore(this)['delete'](key);
|
|
return $has(key, WEAK) && $has(key[WEAK], this._i) && delete key[WEAK][this._i];
|
|
},
|
|
// 23.3.3.4 WeakMap.prototype.has(key)
|
|
// 23.4.3.4 WeakSet.prototype.has(value)
|
|
has: function has(key){
|
|
if(!isObject(key))return false;
|
|
if(!isExtensible(key))return frozenStore(this).has(key);
|
|
return $has(key, WEAK) && $has(key[WEAK], this._i);
|
|
}
|
|
});
|
|
return C;
|
|
},
|
|
def: function(that, key, value){
|
|
if(!isExtensible(anObject(key))){
|
|
frozenStore(that).set(key, value);
|
|
} else {
|
|
$has(key, WEAK) || hide(key, WEAK, {});
|
|
key[WEAK][that._i] = value;
|
|
} return that;
|
|
},
|
|
frozenStore: frozenStore,
|
|
WEAK: WEAK
|
|
};
|
|
},{"./$.an-object":11,"./$.array-methods":15,"./$.for-of":34,"./$.has":37,"./$.hide":38,"./$.is-object":45,"./$.redefine-all":67,"./$.strict-new":76,"./$.uid":89}],22:[function(require,module,exports){
|
|
'use strict';
|
|
var global = require('./$.global')
|
|
, $export = require('./$.export')
|
|
, redefine = require('./$.redefine')
|
|
, redefineAll = require('./$.redefine-all')
|
|
, forOf = require('./$.for-of')
|
|
, strictNew = require('./$.strict-new')
|
|
, isObject = require('./$.is-object')
|
|
, fails = require('./$.fails')
|
|
, $iterDetect = require('./$.iter-detect')
|
|
, setToStringTag = require('./$.set-to-string-tag');
|
|
|
|
module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
|
|
var Base = global[NAME]
|
|
, C = Base
|
|
, ADDER = IS_MAP ? 'set' : 'add'
|
|
, proto = C && C.prototype
|
|
, O = {};
|
|
var fixMethod = function(KEY){
|
|
var fn = proto[KEY];
|
|
redefine(proto, KEY,
|
|
KEY == 'delete' ? function(a){
|
|
return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
|
|
} : KEY == 'has' ? function has(a){
|
|
return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
|
|
} : KEY == 'get' ? function get(a){
|
|
return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
|
|
} : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; }
|
|
: function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; }
|
|
);
|
|
};
|
|
if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){
|
|
new C().entries().next();
|
|
}))){
|
|
// create collection constructor
|
|
C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
|
|
redefineAll(C.prototype, methods);
|
|
} else {
|
|
var instance = new C
|
|
// early implementations not supports chaining
|
|
, HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance
|
|
// V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
|
|
, THROWS_ON_PRIMITIVES = fails(function(){ instance.has(1); })
|
|
// most early implementations doesn't supports iterables, most modern - not close it correctly
|
|
, ACCEPT_ITERABLES = $iterDetect(function(iter){ new C(iter); }) // eslint-disable-line no-new
|
|
// for early implementations -0 and +0 not the same
|
|
, BUGGY_ZERO;
|
|
if(!ACCEPT_ITERABLES){
|
|
C = wrapper(function(target, iterable){
|
|
strictNew(target, C, NAME);
|
|
var that = new Base;
|
|
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
|
|
return that;
|
|
});
|
|
C.prototype = proto;
|
|
proto.constructor = C;
|
|
}
|
|
IS_WEAK || instance.forEach(function(val, key){
|
|
BUGGY_ZERO = 1 / key === -Infinity;
|
|
});
|
|
if(THROWS_ON_PRIMITIVES || BUGGY_ZERO){
|
|
fixMethod('delete');
|
|
fixMethod('has');
|
|
IS_MAP && fixMethod('get');
|
|
}
|
|
if(BUGGY_ZERO || HASNT_CHAINING)fixMethod(ADDER);
|
|
// weak collections should not contains .clear method
|
|
if(IS_WEAK && proto.clear)delete proto.clear;
|
|
}
|
|
|
|
setToStringTag(C, NAME);
|
|
|
|
O[NAME] = C;
|
|
$export($export.G + $export.W + $export.F * (C != Base), O);
|
|
|
|
if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP);
|
|
|
|
return C;
|
|
};
|
|
},{"./$.export":29,"./$.fails":31,"./$.for-of":34,"./$.global":36,"./$.is-object":45,"./$.iter-detect":50,"./$.redefine":68,"./$.redefine-all":67,"./$.set-to-string-tag":73,"./$.strict-new":76}],23:[function(require,module,exports){
|
|
var core = module.exports = {version: '1.2.6'};
|
|
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
|
|
},{}],24:[function(require,module,exports){
|
|
// optional / simple context binding
|
|
var aFunction = require('./$.a-function');
|
|
module.exports = function(fn, that, length){
|
|
aFunction(fn);
|
|
if(that === undefined)return fn;
|
|
switch(length){
|
|
case 1: return function(a){
|
|
return fn.call(that, a);
|
|
};
|
|
case 2: return function(a, b){
|
|
return fn.call(that, a, b);
|
|
};
|
|
case 3: return function(a, b, c){
|
|
return fn.call(that, a, b, c);
|
|
};
|
|
}
|
|
return function(/* ...args */){
|
|
return fn.apply(that, arguments);
|
|
};
|
|
};
|
|
},{"./$.a-function":9}],25:[function(require,module,exports){
|
|
// 7.2.1 RequireObjectCoercible(argument)
|
|
module.exports = function(it){
|
|
if(it == undefined)throw TypeError("Can't call method on " + it);
|
|
return it;
|
|
};
|
|
},{}],26:[function(require,module,exports){
|
|
// Thank's IE8 for his funny defineProperty
|
|
module.exports = !require('./$.fails')(function(){
|
|
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
|
|
});
|
|
},{"./$.fails":31}],27:[function(require,module,exports){
|
|
var isObject = require('./$.is-object')
|
|
, document = require('./$.global').document
|
|
// in old IE typeof document.createElement is 'object'
|
|
, is = isObject(document) && isObject(document.createElement);
|
|
module.exports = function(it){
|
|
return is ? document.createElement(it) : {};
|
|
};
|
|
},{"./$.global":36,"./$.is-object":45}],28:[function(require,module,exports){
|
|
// all enumerable object keys, includes symbols
|
|
var $ = require('./$');
|
|
module.exports = function(it){
|
|
var keys = $.getKeys(it)
|
|
, getSymbols = $.getSymbols;
|
|
if(getSymbols){
|
|
var symbols = getSymbols(it)
|
|
, isEnum = $.isEnum
|
|
, i = 0
|
|
, key;
|
|
while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))keys.push(key);
|
|
}
|
|
return keys;
|
|
};
|
|
},{"./$":53}],29:[function(require,module,exports){
|
|
var global = require('./$.global')
|
|
, core = require('./$.core')
|
|
, hide = require('./$.hide')
|
|
, redefine = require('./$.redefine')
|
|
, ctx = require('./$.ctx')
|
|
, PROTOTYPE = 'prototype';
|
|
|
|
var $export = function(type, name, source){
|
|
var IS_FORCED = type & $export.F
|
|
, IS_GLOBAL = type & $export.G
|
|
, IS_STATIC = type & $export.S
|
|
, IS_PROTO = type & $export.P
|
|
, IS_BIND = type & $export.B
|
|
, target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]
|
|
, exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
|
|
, expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {})
|
|
, key, own, out, exp;
|
|
if(IS_GLOBAL)source = name;
|
|
for(key in source){
|
|
// contains in native
|
|
own = !IS_FORCED && target && key in target;
|
|
// export native or passed
|
|
out = (own ? target : source)[key];
|
|
// bind timers to global for call from export context
|
|
exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
|
|
// extend global
|
|
if(target && !own)redefine(target, key, out);
|
|
// export
|
|
if(exports[key] != out)hide(exports, key, exp);
|
|
if(IS_PROTO && expProto[key] != out)expProto[key] = out;
|
|
}
|
|
};
|
|
global.core = core;
|
|
// type bitmap
|
|
$export.F = 1; // forced
|
|
$export.G = 2; // global
|
|
$export.S = 4; // static
|
|
$export.P = 8; // proto
|
|
$export.B = 16; // bind
|
|
$export.W = 32; // wrap
|
|
module.exports = $export;
|
|
},{"./$.core":23,"./$.ctx":24,"./$.global":36,"./$.hide":38,"./$.redefine":68}],30:[function(require,module,exports){
|
|
var MATCH = require('./$.wks')('match');
|
|
module.exports = function(KEY){
|
|
var re = /./;
|
|
try {
|
|
'/./'[KEY](re);
|
|
} catch(e){
|
|
try {
|
|
re[MATCH] = false;
|
|
return !'/./'[KEY](re);
|
|
} catch(f){ /* empty */ }
|
|
} return true;
|
|
};
|
|
},{"./$.wks":90}],31:[function(require,module,exports){
|
|
module.exports = function(exec){
|
|
try {
|
|
return !!exec();
|
|
} catch(e){
|
|
return true;
|
|
}
|
|
};
|
|
},{}],32:[function(require,module,exports){
|
|
'use strict';
|
|
var hide = require('./$.hide')
|
|
, redefine = require('./$.redefine')
|
|
, fails = require('./$.fails')
|
|
, defined = require('./$.defined')
|
|
, wks = require('./$.wks');
|
|
|
|
module.exports = function(KEY, length, exec){
|
|
var SYMBOL = wks(KEY)
|
|
, original = ''[KEY];
|
|
if(fails(function(){
|
|
var O = {};
|
|
O[SYMBOL] = function(){ return 7; };
|
|
return ''[KEY](O) != 7;
|
|
})){
|
|
redefine(String.prototype, KEY, exec(defined, SYMBOL, original));
|
|
hide(RegExp.prototype, SYMBOL, length == 2
|
|
// 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
|
|
// 21.2.5.11 RegExp.prototype[@@split](string, limit)
|
|
? function(string, arg){ return original.call(string, this, arg); }
|
|
// 21.2.5.6 RegExp.prototype[@@match](string)
|
|
// 21.2.5.9 RegExp.prototype[@@search](string)
|
|
: function(string){ return original.call(string, this); }
|
|
);
|
|
}
|
|
};
|
|
},{"./$.defined":25,"./$.fails":31,"./$.hide":38,"./$.redefine":68,"./$.wks":90}],33:[function(require,module,exports){
|
|
'use strict';
|
|
// 21.2.5.3 get RegExp.prototype.flags
|
|
var anObject = require('./$.an-object');
|
|
module.exports = function(){
|
|
var that = anObject(this)
|
|
, result = '';
|
|
if(that.global) result += 'g';
|
|
if(that.ignoreCase) result += 'i';
|
|
if(that.multiline) result += 'm';
|
|
if(that.unicode) result += 'u';
|
|
if(that.sticky) result += 'y';
|
|
return result;
|
|
};
|
|
},{"./$.an-object":11}],34:[function(require,module,exports){
|
|
var ctx = require('./$.ctx')
|
|
, call = require('./$.iter-call')
|
|
, isArrayIter = require('./$.is-array-iter')
|
|
, anObject = require('./$.an-object')
|
|
, toLength = require('./$.to-length')
|
|
, getIterFn = require('./core.get-iterator-method');
|
|
module.exports = function(iterable, entries, fn, that){
|
|
var iterFn = getIterFn(iterable)
|
|
, f = ctx(fn, that, entries ? 2 : 1)
|
|
, index = 0
|
|
, length, step, iterator;
|
|
if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
|
|
// fast case for arrays with default iterator
|
|
if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
|
|
entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
|
|
} else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
|
|
call(iterator, f, step.value, entries);
|
|
}
|
|
};
|
|
},{"./$.an-object":11,"./$.ctx":24,"./$.is-array-iter":42,"./$.iter-call":47,"./$.to-length":86,"./core.get-iterator-method":91}],35:[function(require,module,exports){
|
|
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
|
|
var toIObject = require('./$.to-iobject')
|
|
, getNames = require('./$').getNames
|
|
, toString = {}.toString;
|
|
|
|
var windowNames = typeof window == 'object' && Object.getOwnPropertyNames
|
|
? Object.getOwnPropertyNames(window) : [];
|
|
|
|
var getWindowNames = function(it){
|
|
try {
|
|
return getNames(it);
|
|
} catch(e){
|
|
return windowNames.slice();
|
|
}
|
|
};
|
|
|
|
module.exports.get = function getOwnPropertyNames(it){
|
|
if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it);
|
|
return getNames(toIObject(it));
|
|
};
|
|
},{"./$":53,"./$.to-iobject":85}],36:[function(require,module,exports){
|
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
var global = module.exports = typeof window != 'undefined' && window.Math == Math
|
|
? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
|
|
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
|
|
},{}],37:[function(require,module,exports){
|
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
module.exports = function(it, key){
|
|
return hasOwnProperty.call(it, key);
|
|
};
|
|
},{}],38:[function(require,module,exports){
|
|
var $ = require('./$')
|
|
, createDesc = require('./$.property-desc');
|
|
module.exports = require('./$.descriptors') ? function(object, key, value){
|
|
return $.setDesc(object, key, createDesc(1, value));
|
|
} : function(object, key, value){
|
|
object[key] = value;
|
|
return object;
|
|
};
|
|
},{"./$":53,"./$.descriptors":26,"./$.property-desc":66}],39:[function(require,module,exports){
|
|
module.exports = require('./$.global').document && document.documentElement;
|
|
},{"./$.global":36}],40:[function(require,module,exports){
|
|
// fast apply, http://jsperf.lnkit.com/fast-apply/5
|
|
module.exports = function(fn, args, that){
|
|
var un = that === undefined;
|
|
switch(args.length){
|
|
case 0: return un ? fn()
|
|
: fn.call(that);
|
|
case 1: return un ? fn(args[0])
|
|
: fn.call(that, args[0]);
|
|
case 2: return un ? fn(args[0], args[1])
|
|
: fn.call(that, args[0], args[1]);
|
|
case 3: return un ? fn(args[0], args[1], args[2])
|
|
: fn.call(that, args[0], args[1], args[2]);
|
|
case 4: return un ? fn(args[0], args[1], args[2], args[3])
|
|
: fn.call(that, args[0], args[1], args[2], args[3]);
|
|
} return fn.apply(that, args);
|
|
};
|
|
},{}],41:[function(require,module,exports){
|
|
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
var cof = require('./$.cof');
|
|
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
|
|
return cof(it) == 'String' ? it.split('') : Object(it);
|
|
};
|
|
},{"./$.cof":18}],42:[function(require,module,exports){
|
|
// check on default Array iterator
|
|
var Iterators = require('./$.iterators')
|
|
, ITERATOR = require('./$.wks')('iterator')
|
|
, ArrayProto = Array.prototype;
|
|
|
|
module.exports = function(it){
|
|
return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
|
|
};
|
|
},{"./$.iterators":52,"./$.wks":90}],43:[function(require,module,exports){
|
|
// 7.2.2 IsArray(argument)
|
|
var cof = require('./$.cof');
|
|
module.exports = Array.isArray || function(arg){
|
|
return cof(arg) == 'Array';
|
|
};
|
|
},{"./$.cof":18}],44:[function(require,module,exports){
|
|
// 20.1.2.3 Number.isInteger(number)
|
|
var isObject = require('./$.is-object')
|
|
, floor = Math.floor;
|
|
module.exports = function isInteger(it){
|
|
return !isObject(it) && isFinite(it) && floor(it) === it;
|
|
};
|
|
},{"./$.is-object":45}],45:[function(require,module,exports){
|
|
module.exports = function(it){
|
|
return typeof it === 'object' ? it !== null : typeof it === 'function';
|
|
};
|
|
},{}],46:[function(require,module,exports){
|
|
// 7.2.8 IsRegExp(argument)
|
|
var isObject = require('./$.is-object')
|
|
, cof = require('./$.cof')
|
|
, MATCH = require('./$.wks')('match');
|
|
module.exports = function(it){
|
|
var isRegExp;
|
|
return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
|
|
};
|
|
},{"./$.cof":18,"./$.is-object":45,"./$.wks":90}],47:[function(require,module,exports){
|
|
// call something on iterator step with safe closing on error
|
|
var anObject = require('./$.an-object');
|
|
module.exports = function(iterator, fn, value, entries){
|
|
try {
|
|
return entries ? fn(anObject(value)[0], value[1]) : fn(value);
|
|
// 7.4.6 IteratorClose(iterator, completion)
|
|
} catch(e){
|
|
var ret = iterator['return'];
|
|
if(ret !== undefined)anObject(ret.call(iterator));
|
|
throw e;
|
|
}
|
|
};
|
|
},{"./$.an-object":11}],48:[function(require,module,exports){
|
|
'use strict';
|
|
var $ = require('./$')
|
|
, descriptor = require('./$.property-desc')
|
|
, setToStringTag = require('./$.set-to-string-tag')
|
|
, IteratorPrototype = {};
|
|
|
|
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
|
|
require('./$.hide')(IteratorPrototype, require('./$.wks')('iterator'), function(){ return this; });
|
|
|
|
module.exports = function(Constructor, NAME, next){
|
|
Constructor.prototype = $.create(IteratorPrototype, {next: descriptor(1, next)});
|
|
setToStringTag(Constructor, NAME + ' Iterator');
|
|
};
|
|
},{"./$":53,"./$.hide":38,"./$.property-desc":66,"./$.set-to-string-tag":73,"./$.wks":90}],49:[function(require,module,exports){
|
|
'use strict';
|
|
var LIBRARY = require('./$.library')
|
|
, $export = require('./$.export')
|
|
, redefine = require('./$.redefine')
|
|
, hide = require('./$.hide')
|
|
, has = require('./$.has')
|
|
, Iterators = require('./$.iterators')
|
|
, $iterCreate = require('./$.iter-create')
|
|
, setToStringTag = require('./$.set-to-string-tag')
|
|
, getProto = require('./$').getProto
|
|
, ITERATOR = require('./$.wks')('iterator')
|
|
, BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
|
|
, FF_ITERATOR = '@@iterator'
|
|
, KEYS = 'keys'
|
|
, VALUES = 'values';
|
|
|
|
var returnThis = function(){ return this; };
|
|
|
|
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
|
|
$iterCreate(Constructor, NAME, next);
|
|
var getMethod = function(kind){
|
|
if(!BUGGY && kind in proto)return proto[kind];
|
|
switch(kind){
|
|
case KEYS: return function keys(){ return new Constructor(this, kind); };
|
|
case VALUES: return function values(){ return new Constructor(this, kind); };
|
|
} return function entries(){ return new Constructor(this, kind); };
|
|
};
|
|
var TAG = NAME + ' Iterator'
|
|
, DEF_VALUES = DEFAULT == VALUES
|
|
, VALUES_BUG = false
|
|
, proto = Base.prototype
|
|
, $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
|
|
, $default = $native || getMethod(DEFAULT)
|
|
, methods, key;
|
|
// Fix native
|
|
if($native){
|
|
var IteratorPrototype = getProto($default.call(new Base));
|
|
// Set @@toStringTag to native iterators
|
|
setToStringTag(IteratorPrototype, TAG, true);
|
|
// FF fix
|
|
if(!LIBRARY && has(proto, FF_ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
|
|
// fix Array#{values, @@iterator}.name in V8 / FF
|
|
if(DEF_VALUES && $native.name !== VALUES){
|
|
VALUES_BUG = true;
|
|
$default = function values(){ return $native.call(this); };
|
|
}
|
|
}
|
|
// Define iterator
|
|
if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
|
|
hide(proto, ITERATOR, $default);
|
|
}
|
|
// Plug for library
|
|
Iterators[NAME] = $default;
|
|
Iterators[TAG] = returnThis;
|
|
if(DEFAULT){
|
|
methods = {
|
|
values: DEF_VALUES ? $default : getMethod(VALUES),
|
|
keys: IS_SET ? $default : getMethod(KEYS),
|
|
entries: !DEF_VALUES ? $default : getMethod('entries')
|
|
};
|
|
if(FORCED)for(key in methods){
|
|
if(!(key in proto))redefine(proto, key, methods[key]);
|
|
} else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
|
|
}
|
|
return methods;
|
|
};
|
|
},{"./$":53,"./$.export":29,"./$.has":37,"./$.hide":38,"./$.iter-create":48,"./$.iterators":52,"./$.library":55,"./$.redefine":68,"./$.set-to-string-tag":73,"./$.wks":90}],50:[function(require,module,exports){
|
|
var ITERATOR = require('./$.wks')('iterator')
|
|
, SAFE_CLOSING = false;
|
|
|
|
try {
|
|
var riter = [7][ITERATOR]();
|
|
riter['return'] = function(){ SAFE_CLOSING = true; };
|
|
Array.from(riter, function(){ throw 2; });
|
|
} catch(e){ /* empty */ }
|
|
|
|
module.exports = function(exec, skipClosing){
|
|
if(!skipClosing && !SAFE_CLOSING)return false;
|
|
var safe = false;
|
|
try {
|
|
var arr = [7]
|
|
, iter = arr[ITERATOR]();
|
|
iter.next = function(){ return {done: safe = true}; };
|
|
arr[ITERATOR] = function(){ return iter; };
|
|
exec(arr);
|
|
} catch(e){ /* empty */ }
|
|
return safe;
|
|
};
|
|
},{"./$.wks":90}],51:[function(require,module,exports){
|
|
module.exports = function(done, value){
|
|
return {value: value, done: !!done};
|
|
};
|
|
},{}],52:[function(require,module,exports){
|
|
module.exports = {};
|
|
},{}],53:[function(require,module,exports){
|
|
var $Object = Object;
|
|
module.exports = {
|
|
create: $Object.create,
|
|
getProto: $Object.getPrototypeOf,
|
|
isEnum: {}.propertyIsEnumerable,
|
|
getDesc: $Object.getOwnPropertyDescriptor,
|
|
setDesc: $Object.defineProperty,
|
|
setDescs: $Object.defineProperties,
|
|
getKeys: $Object.keys,
|
|
getNames: $Object.getOwnPropertyNames,
|
|
getSymbols: $Object.getOwnPropertySymbols,
|
|
each: [].forEach
|
|
};
|
|
},{}],54:[function(require,module,exports){
|
|
var $ = require('./$')
|
|
, toIObject = require('./$.to-iobject');
|
|
module.exports = function(object, el){
|
|
var O = toIObject(object)
|
|
, keys = $.getKeys(O)
|
|
, length = keys.length
|
|
, index = 0
|
|
, key;
|
|
while(length > index)if(O[key = keys[index++]] === el)return key;
|
|
};
|
|
},{"./$":53,"./$.to-iobject":85}],55:[function(require,module,exports){
|
|
module.exports = false;
|
|
},{}],56:[function(require,module,exports){
|
|
// 20.2.2.14 Math.expm1(x)
|
|
module.exports = Math.expm1 || function expm1(x){
|
|
return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1;
|
|
};
|
|
},{}],57:[function(require,module,exports){
|
|
// 20.2.2.20 Math.log1p(x)
|
|
module.exports = Math.log1p || function log1p(x){
|
|
return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x);
|
|
};
|
|
},{}],58:[function(require,module,exports){
|
|
// 20.2.2.28 Math.sign(x)
|
|
module.exports = Math.sign || function sign(x){
|
|
return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
|
|
};
|
|
},{}],59:[function(require,module,exports){
|
|
var global = require('./$.global')
|
|
, macrotask = require('./$.task').set
|
|
, Observer = global.MutationObserver || global.WebKitMutationObserver
|
|
, process = global.process
|
|
, Promise = global.Promise
|
|
, isNode = require('./$.cof')(process) == 'process'
|
|
, head, last, notify;
|
|
|
|
var flush = function(){
|
|
var parent, domain, fn;
|
|
if(isNode && (parent = process.domain)){
|
|
process.domain = null;
|
|
parent.exit();
|
|
}
|
|
while(head){
|
|
domain = head.domain;
|
|
fn = head.fn;
|
|
if(domain)domain.enter();
|
|
fn(); // <- currently we use it only for Promise - try / catch not required
|
|
if(domain)domain.exit();
|
|
head = head.next;
|
|
} last = undefined;
|
|
if(parent)parent.enter();
|
|
};
|
|
|
|
// Node.js
|
|
if(isNode){
|
|
notify = function(){
|
|
process.nextTick(flush);
|
|
};
|
|
// browsers with MutationObserver
|
|
} else if(Observer){
|
|
var toggle = 1
|
|
, node = document.createTextNode('');
|
|
new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new
|
|
notify = function(){
|
|
node.data = toggle = -toggle;
|
|
};
|
|
// environments with maybe non-completely correct, but existent Promise
|
|
} else if(Promise && Promise.resolve){
|
|
notify = function(){
|
|
Promise.resolve().then(flush);
|
|
};
|
|
// for other environments - macrotask based on:
|
|
// - setImmediate
|
|
// - MessageChannel
|
|
// - window.postMessag
|
|
// - onreadystatechange
|
|
// - setTimeout
|
|
} else {
|
|
notify = function(){
|
|
// strange IE + webpack dev server bug - use .call(global)
|
|
macrotask.call(global, flush);
|
|
};
|
|
}
|
|
|
|
module.exports = function asap(fn){
|
|
var task = {fn: fn, next: undefined, domain: isNode && process.domain};
|
|
if(last)last.next = task;
|
|
if(!head){
|
|
head = task;
|
|
notify();
|
|
} last = task;
|
|
};
|
|
},{"./$.cof":18,"./$.global":36,"./$.task":82}],60:[function(require,module,exports){
|
|
// 19.1.2.1 Object.assign(target, source, ...)
|
|
var $ = require('./$')
|
|
, toObject = require('./$.to-object')
|
|
, IObject = require('./$.iobject');
|
|
|
|
// should work with symbols and should have deterministic property order (V8 bug)
|
|
module.exports = require('./$.fails')(function(){
|
|
var a = Object.assign
|
|
, A = {}
|
|
, B = {}
|
|
, S = Symbol()
|
|
, K = 'abcdefghijklmnopqrst';
|
|
A[S] = 7;
|
|
K.split('').forEach(function(k){ B[k] = k; });
|
|
return a({}, A)[S] != 7 || Object.keys(a({}, B)).join('') != K;
|
|
}) ? function assign(target, source){ // eslint-disable-line no-unused-vars
|
|
var T = toObject(target)
|
|
, $$ = arguments
|
|
, $$len = $$.length
|
|
, index = 1
|
|
, getKeys = $.getKeys
|
|
, getSymbols = $.getSymbols
|
|
, isEnum = $.isEnum;
|
|
while($$len > index){
|
|
var S = IObject($$[index++])
|
|
, keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
|
|
, length = keys.length
|
|
, j = 0
|
|
, key;
|
|
while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
|
|
}
|
|
return T;
|
|
} : Object.assign;
|
|
},{"./$":53,"./$.fails":31,"./$.iobject":41,"./$.to-object":87}],61:[function(require,module,exports){
|
|
// most Object methods by ES6 should accept primitives
|
|
var $export = require('./$.export')
|
|
, core = require('./$.core')
|
|
, fails = require('./$.fails');
|
|
module.exports = function(KEY, exec){
|
|
var fn = (core.Object || {})[KEY] || Object[KEY]
|
|
, exp = {};
|
|
exp[KEY] = exec(fn);
|
|
$export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
|
|
};
|
|
},{"./$.core":23,"./$.export":29,"./$.fails":31}],62:[function(require,module,exports){
|
|
var $ = require('./$')
|
|
, toIObject = require('./$.to-iobject')
|
|
, isEnum = $.isEnum;
|
|
module.exports = function(isEntries){
|
|
return function(it){
|
|
var O = toIObject(it)
|
|
, keys = $.getKeys(O)
|
|
, length = keys.length
|
|
, i = 0
|
|
, result = []
|
|
, key;
|
|
while(length > i)if(isEnum.call(O, key = keys[i++])){
|
|
result.push(isEntries ? [key, O[key]] : O[key]);
|
|
} return result;
|
|
};
|
|
};
|
|
},{"./$":53,"./$.to-iobject":85}],63:[function(require,module,exports){
|
|
// all object keys, includes non-enumerable and symbols
|
|
var $ = require('./$')
|
|
, anObject = require('./$.an-object')
|
|
, Reflect = require('./$.global').Reflect;
|
|
module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){
|
|
var keys = $.getNames(anObject(it))
|
|
, getSymbols = $.getSymbols;
|
|
return getSymbols ? keys.concat(getSymbols(it)) : keys;
|
|
};
|
|
},{"./$":53,"./$.an-object":11,"./$.global":36}],64:[function(require,module,exports){
|
|
'use strict';
|
|
var path = require('./$.path')
|
|
, invoke = require('./$.invoke')
|
|
, aFunction = require('./$.a-function');
|
|
module.exports = function(/* ...pargs */){
|
|
var fn = aFunction(this)
|
|
, length = arguments.length
|
|
, pargs = Array(length)
|
|
, i = 0
|
|
, _ = path._
|
|
, holder = false;
|
|
while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true;
|
|
return function(/* ...args */){
|
|
var that = this
|
|
, $$ = arguments
|
|
, $$len = $$.length
|
|
, j = 0, k = 0, args;
|
|
if(!holder && !$$len)return invoke(fn, pargs, that);
|
|
args = pargs.slice();
|
|
if(holder)for(;length > j; j++)if(args[j] === _)args[j] = $$[k++];
|
|
while($$len > k)args.push($$[k++]);
|
|
return invoke(fn, args, that);
|
|
};
|
|
};
|
|
},{"./$.a-function":9,"./$.invoke":40,"./$.path":65}],65:[function(require,module,exports){
|
|
module.exports = require('./$.global');
|
|
},{"./$.global":36}],66:[function(require,module,exports){
|
|
module.exports = function(bitmap, value){
|
|
return {
|
|
enumerable : !(bitmap & 1),
|
|
configurable: !(bitmap & 2),
|
|
writable : !(bitmap & 4),
|
|
value : value
|
|
};
|
|
};
|
|
},{}],67:[function(require,module,exports){
|
|
var redefine = require('./$.redefine');
|
|
module.exports = function(target, src){
|
|
for(var key in src)redefine(target, key, src[key]);
|
|
return target;
|
|
};
|
|
},{"./$.redefine":68}],68:[function(require,module,exports){
|
|
// add fake Function#toString
|
|
// for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
var global = require('./$.global')
|
|
, hide = require('./$.hide')
|
|
, SRC = require('./$.uid')('src')
|
|
, TO_STRING = 'toString'
|
|
, $toString = Function[TO_STRING]
|
|
, TPL = ('' + $toString).split(TO_STRING);
|
|
|
|
require('./$.core').inspectSource = function(it){
|
|
return $toString.call(it);
|
|
};
|
|
|
|
(module.exports = function(O, key, val, safe){
|
|
if(typeof val == 'function'){
|
|
val.hasOwnProperty(SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
|
|
val.hasOwnProperty('name') || hide(val, 'name', key);
|
|
}
|
|
if(O === global){
|
|
O[key] = val;
|
|
} else {
|
|
if(!safe)delete O[key];
|
|
hide(O, key, val);
|
|
}
|
|
})(Function.prototype, TO_STRING, function toString(){
|
|
return typeof this == 'function' && this[SRC] || $toString.call(this);
|
|
});
|
|
},{"./$.core":23,"./$.global":36,"./$.hide":38,"./$.uid":89}],69:[function(require,module,exports){
|
|
module.exports = function(regExp, replace){
|
|
var replacer = replace === Object(replace) ? function(part){
|
|
return replace[part];
|
|
} : replace;
|
|
return function(it){
|
|
return String(it).replace(regExp, replacer);
|
|
};
|
|
};
|
|
},{}],70:[function(require,module,exports){
|
|
// 7.2.9 SameValue(x, y)
|
|
module.exports = Object.is || function is(x, y){
|
|
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
|
|
};
|
|
},{}],71:[function(require,module,exports){
|
|
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
/* eslint-disable no-proto */
|
|
var getDesc = require('./$').getDesc
|
|
, isObject = require('./$.is-object')
|
|
, anObject = require('./$.an-object');
|
|
var check = function(O, proto){
|
|
anObject(O);
|
|
if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
|
|
};
|
|
module.exports = {
|
|
set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
|
|
function(test, buggy, set){
|
|
try {
|
|
set = require('./$.ctx')(Function.call, getDesc(Object.prototype, '__proto__').set, 2);
|
|
set(test, []);
|
|
buggy = !(test instanceof Array);
|
|
} catch(e){ buggy = true; }
|
|
return function setPrototypeOf(O, proto){
|
|
check(O, proto);
|
|
if(buggy)O.__proto__ = proto;
|
|
else set(O, proto);
|
|
return O;
|
|
};
|
|
}({}, false) : undefined),
|
|
check: check
|
|
};
|
|
},{"./$":53,"./$.an-object":11,"./$.ctx":24,"./$.is-object":45}],72:[function(require,module,exports){
|
|
'use strict';
|
|
var global = require('./$.global')
|
|
, $ = require('./$')
|
|
, DESCRIPTORS = require('./$.descriptors')
|
|
, SPECIES = require('./$.wks')('species');
|
|
|
|
module.exports = function(KEY){
|
|
var C = global[KEY];
|
|
if(DESCRIPTORS && C && !C[SPECIES])$.setDesc(C, SPECIES, {
|
|
configurable: true,
|
|
get: function(){ return this; }
|
|
});
|
|
};
|
|
},{"./$":53,"./$.descriptors":26,"./$.global":36,"./$.wks":90}],73:[function(require,module,exports){
|
|
var def = require('./$').setDesc
|
|
, has = require('./$.has')
|
|
, TAG = require('./$.wks')('toStringTag');
|
|
|
|
module.exports = function(it, tag, stat){
|
|
if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
|
|
};
|
|
},{"./$":53,"./$.has":37,"./$.wks":90}],74:[function(require,module,exports){
|
|
var global = require('./$.global')
|
|
, SHARED = '__core-js_shared__'
|
|
, store = global[SHARED] || (global[SHARED] = {});
|
|
module.exports = function(key){
|
|
return store[key] || (store[key] = {});
|
|
};
|
|
},{"./$.global":36}],75:[function(require,module,exports){
|
|
// 7.3.20 SpeciesConstructor(O, defaultConstructor)
|
|
var anObject = require('./$.an-object')
|
|
, aFunction = require('./$.a-function')
|
|
, SPECIES = require('./$.wks')('species');
|
|
module.exports = function(O, D){
|
|
var C = anObject(O).constructor, S;
|
|
return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
|
|
};
|
|
},{"./$.a-function":9,"./$.an-object":11,"./$.wks":90}],76:[function(require,module,exports){
|
|
module.exports = function(it, Constructor, name){
|
|
if(!(it instanceof Constructor))throw TypeError(name + ": use the 'new' operator!");
|
|
return it;
|
|
};
|
|
},{}],77:[function(require,module,exports){
|
|
var toInteger = require('./$.to-integer')
|
|
, defined = require('./$.defined');
|
|
// true -> String#at
|
|
// false -> String#codePointAt
|
|
module.exports = function(TO_STRING){
|
|
return function(that, pos){
|
|
var s = String(defined(that))
|
|
, i = toInteger(pos)
|
|
, l = s.length
|
|
, a, b;
|
|
if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
|
|
a = s.charCodeAt(i);
|
|
return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
|
|
? TO_STRING ? s.charAt(i) : a
|
|
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
|
|
};
|
|
};
|
|
},{"./$.defined":25,"./$.to-integer":84}],78:[function(require,module,exports){
|
|
// helper for String#{startsWith, endsWith, includes}
|
|
var isRegExp = require('./$.is-regexp')
|
|
, defined = require('./$.defined');
|
|
|
|
module.exports = function(that, searchString, NAME){
|
|
if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!");
|
|
return String(defined(that));
|
|
};
|
|
},{"./$.defined":25,"./$.is-regexp":46}],79:[function(require,module,exports){
|
|
// https://github.com/ljharb/proposal-string-pad-left-right
|
|
var toLength = require('./$.to-length')
|
|
, repeat = require('./$.string-repeat')
|
|
, defined = require('./$.defined');
|
|
|
|
module.exports = function(that, maxLength, fillString, left){
|
|
var S = String(defined(that))
|
|
, stringLength = S.length
|
|
, fillStr = fillString === undefined ? ' ' : String(fillString)
|
|
, intMaxLength = toLength(maxLength);
|
|
if(intMaxLength <= stringLength)return S;
|
|
if(fillStr == '')fillStr = ' ';
|
|
var fillLen = intMaxLength - stringLength
|
|
, stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
|
|
if(stringFiller.length > fillLen)stringFiller = stringFiller.slice(0, fillLen);
|
|
return left ? stringFiller + S : S + stringFiller;
|
|
};
|
|
},{"./$.defined":25,"./$.string-repeat":80,"./$.to-length":86}],80:[function(require,module,exports){
|
|
'use strict';
|
|
var toInteger = require('./$.to-integer')
|
|
, defined = require('./$.defined');
|
|
|
|
module.exports = function repeat(count){
|
|
var str = String(defined(this))
|
|
, res = ''
|
|
, n = toInteger(count);
|
|
if(n < 0 || n == Infinity)throw RangeError("Count can't be negative");
|
|
for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str;
|
|
return res;
|
|
};
|
|
},{"./$.defined":25,"./$.to-integer":84}],81:[function(require,module,exports){
|
|
var $export = require('./$.export')
|
|
, defined = require('./$.defined')
|
|
, fails = require('./$.fails')
|
|
, spaces = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +
|
|
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'
|
|
, space = '[' + spaces + ']'
|
|
, non = '\u200b\u0085'
|
|
, ltrim = RegExp('^' + space + space + '*')
|
|
, rtrim = RegExp(space + space + '*$');
|
|
|
|
var exporter = function(KEY, exec){
|
|
var exp = {};
|
|
exp[KEY] = exec(trim);
|
|
$export($export.P + $export.F * fails(function(){
|
|
return !!spaces[KEY]() || non[KEY]() != non;
|
|
}), 'String', exp);
|
|
};
|
|
|
|
// 1 -> String#trimLeft
|
|
// 2 -> String#trimRight
|
|
// 3 -> String#trim
|
|
var trim = exporter.trim = function(string, TYPE){
|
|
string = String(defined(string));
|
|
if(TYPE & 1)string = string.replace(ltrim, '');
|
|
if(TYPE & 2)string = string.replace(rtrim, '');
|
|
return string;
|
|
};
|
|
|
|
module.exports = exporter;
|
|
},{"./$.defined":25,"./$.export":29,"./$.fails":31}],82:[function(require,module,exports){
|
|
var ctx = require('./$.ctx')
|
|
, invoke = require('./$.invoke')
|
|
, html = require('./$.html')
|
|
, cel = require('./$.dom-create')
|
|
, global = require('./$.global')
|
|
, process = global.process
|
|
, setTask = global.setImmediate
|
|
, clearTask = global.clearImmediate
|
|
, MessageChannel = global.MessageChannel
|
|
, counter = 0
|
|
, queue = {}
|
|
, ONREADYSTATECHANGE = 'onreadystatechange'
|
|
, defer, channel, port;
|
|
var run = function(){
|
|
var id = +this;
|
|
if(queue.hasOwnProperty(id)){
|
|
var fn = queue[id];
|
|
delete queue[id];
|
|
fn();
|
|
}
|
|
};
|
|
var listner = function(event){
|
|
run.call(event.data);
|
|
};
|
|
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
|
|
if(!setTask || !clearTask){
|
|
setTask = function setImmediate(fn){
|
|
var args = [], i = 1;
|
|
while(arguments.length > i)args.push(arguments[i++]);
|
|
queue[++counter] = function(){
|
|
invoke(typeof fn == 'function' ? fn : Function(fn), args);
|
|
};
|
|
defer(counter);
|
|
return counter;
|
|
};
|
|
clearTask = function clearImmediate(id){
|
|
delete queue[id];
|
|
};
|
|
// Node.js 0.8-
|
|
if(require('./$.cof')(process) == 'process'){
|
|
defer = function(id){
|
|
process.nextTick(ctx(run, id, 1));
|
|
};
|
|
// Browsers with MessageChannel, includes WebWorkers
|
|
} else if(MessageChannel){
|
|
channel = new MessageChannel;
|
|
port = channel.port2;
|
|
channel.port1.onmessage = listner;
|
|
defer = ctx(port.postMessage, port, 1);
|
|
// Browsers with postMessage, skip WebWorkers
|
|
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
|
|
} else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){
|
|
defer = function(id){
|
|
global.postMessage(id + '', '*');
|
|
};
|
|
global.addEventListener('message', listner, false);
|
|
// IE8-
|
|
} else if(ONREADYSTATECHANGE in cel('script')){
|
|
defer = function(id){
|
|
html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){
|
|
html.removeChild(this);
|
|
run.call(id);
|
|
};
|
|
};
|
|
// Rest old browsers
|
|
} else {
|
|
defer = function(id){
|
|
setTimeout(ctx(run, id, 1), 0);
|
|
};
|
|
}
|
|
}
|
|
module.exports = {
|
|
set: setTask,
|
|
clear: clearTask
|
|
};
|
|
},{"./$.cof":18,"./$.ctx":24,"./$.dom-create":27,"./$.global":36,"./$.html":39,"./$.invoke":40}],83:[function(require,module,exports){
|
|
var toInteger = require('./$.to-integer')
|
|
, max = Math.max
|
|
, min = Math.min;
|
|
module.exports = function(index, length){
|
|
index = toInteger(index);
|
|
return index < 0 ? max(index + length, 0) : min(index, length);
|
|
};
|
|
},{"./$.to-integer":84}],84:[function(require,module,exports){
|
|
// 7.1.4 ToInteger
|
|
var ceil = Math.ceil
|
|
, floor = Math.floor;
|
|
module.exports = function(it){
|
|
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
|
|
};
|
|
},{}],85:[function(require,module,exports){
|
|
// to indexed object, toObject with fallback for non-array-like ES3 strings
|
|
var IObject = require('./$.iobject')
|
|
, defined = require('./$.defined');
|
|
module.exports = function(it){
|
|
return IObject(defined(it));
|
|
};
|
|
},{"./$.defined":25,"./$.iobject":41}],86:[function(require,module,exports){
|
|
// 7.1.15 ToLength
|
|
var toInteger = require('./$.to-integer')
|
|
, min = Math.min;
|
|
module.exports = function(it){
|
|
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
|
|
};
|
|
},{"./$.to-integer":84}],87:[function(require,module,exports){
|
|
// 7.1.13 ToObject(argument)
|
|
var defined = require('./$.defined');
|
|
module.exports = function(it){
|
|
return Object(defined(it));
|
|
};
|
|
},{"./$.defined":25}],88:[function(require,module,exports){
|
|
// 7.1.1 ToPrimitive(input [, PreferredType])
|
|
var isObject = require('./$.is-object');
|
|
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
|
|
// and the second argument - flag - preferred type is a string
|
|
module.exports = function(it, S){
|
|
if(!isObject(it))return it;
|
|
var fn, val;
|
|
if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
|
|
if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
|
|
if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
|
|
throw TypeError("Can't convert object to primitive value");
|
|
};
|
|
},{"./$.is-object":45}],89:[function(require,module,exports){
|
|
var id = 0
|
|
, px = Math.random();
|
|
module.exports = function(key){
|
|
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
|
|
};
|
|
},{}],90:[function(require,module,exports){
|
|
var store = require('./$.shared')('wks')
|
|
, uid = require('./$.uid')
|
|
, Symbol = require('./$.global').Symbol;
|
|
module.exports = function(name){
|
|
return store[name] || (store[name] =
|
|
Symbol && Symbol[name] || (Symbol || uid)('Symbol.' + name));
|
|
};
|
|
},{"./$.global":36,"./$.shared":74,"./$.uid":89}],91:[function(require,module,exports){
|
|
var classof = require('./$.classof')
|
|
, ITERATOR = require('./$.wks')('iterator')
|
|
, Iterators = require('./$.iterators');
|
|
module.exports = require('./$.core').getIteratorMethod = function(it){
|
|
if(it != undefined)return it[ITERATOR]
|
|
|| it['@@iterator']
|
|
|| Iterators[classof(it)];
|
|
};
|
|
},{"./$.classof":17,"./$.core":23,"./$.iterators":52,"./$.wks":90}],92:[function(require,module,exports){
|
|
'use strict';
|
|
var $ = require('./$')
|
|
, $export = require('./$.export')
|
|
, DESCRIPTORS = require('./$.descriptors')
|
|
, createDesc = require('./$.property-desc')
|
|
, html = require('./$.html')
|
|
, cel = require('./$.dom-create')
|
|
, has = require('./$.has')
|
|
, cof = require('./$.cof')
|
|
, invoke = require('./$.invoke')
|
|
, fails = require('./$.fails')
|
|
, anObject = require('./$.an-object')
|
|
, aFunction = require('./$.a-function')
|
|
, isObject = require('./$.is-object')
|
|
, toObject = require('./$.to-object')
|
|
, toIObject = require('./$.to-iobject')
|
|
, toInteger = require('./$.to-integer')
|
|
, toIndex = require('./$.to-index')
|
|
, toLength = require('./$.to-length')
|
|
, IObject = require('./$.iobject')
|
|
, IE_PROTO = require('./$.uid')('__proto__')
|
|
, createArrayMethod = require('./$.array-methods')
|
|
, arrayIndexOf = require('./$.array-includes')(false)
|
|
, ObjectProto = Object.prototype
|
|
, ArrayProto = Array.prototype
|
|
, arraySlice = ArrayProto.slice
|
|
, arrayJoin = ArrayProto.join
|
|
, defineProperty = $.setDesc
|
|
, getOwnDescriptor = $.getDesc
|
|
, defineProperties = $.setDescs
|
|
, factories = {}
|
|
, IE8_DOM_DEFINE;
|
|
|
|
if(!DESCRIPTORS){
|
|
IE8_DOM_DEFINE = !fails(function(){
|
|
return defineProperty(cel('div'), 'a', {get: function(){ return 7; }}).a != 7;
|
|
});
|
|
$.setDesc = function(O, P, Attributes){
|
|
if(IE8_DOM_DEFINE)try {
|
|
return defineProperty(O, P, Attributes);
|
|
} catch(e){ /* empty */ }
|
|
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
|
|
if('value' in Attributes)anObject(O)[P] = Attributes.value;
|
|
return O;
|
|
};
|
|
$.getDesc = function(O, P){
|
|
if(IE8_DOM_DEFINE)try {
|
|
return getOwnDescriptor(O, P);
|
|
} catch(e){ /* empty */ }
|
|
if(has(O, P))return createDesc(!ObjectProto.propertyIsEnumerable.call(O, P), O[P]);
|
|
};
|
|
$.setDescs = defineProperties = function(O, Properties){
|
|
anObject(O);
|
|
var keys = $.getKeys(Properties)
|
|
, length = keys.length
|
|
, i = 0
|
|
, P;
|
|
while(length > i)$.setDesc(O, P = keys[i++], Properties[P]);
|
|
return O;
|
|
};
|
|
}
|
|
$export($export.S + $export.F * !DESCRIPTORS, 'Object', {
|
|
// 19.1.2.6 / 15.2.3.3 Object.getOwnPropertyDescriptor(O, P)
|
|
getOwnPropertyDescriptor: $.getDesc,
|
|
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
|
|
defineProperty: $.setDesc,
|
|
// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
|
|
defineProperties: defineProperties
|
|
});
|
|
|
|
// IE 8- don't enum bug keys
|
|
var keys1 = ('constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,' +
|
|
'toLocaleString,toString,valueOf').split(',')
|
|
// Additional keys for getOwnPropertyNames
|
|
, keys2 = keys1.concat('length', 'prototype')
|
|
, keysLen1 = keys1.length;
|
|
|
|
// Create object with `null` prototype: use iframe Object with cleared prototype
|
|
var createDict = function(){
|
|
// Thrash, waste and sodomy: IE GC bug
|
|
var iframe = cel('iframe')
|
|
, i = keysLen1
|
|
, gt = '>'
|
|
, iframeDocument;
|
|
iframe.style.display = 'none';
|
|
html.appendChild(iframe);
|
|
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
|
|
// createDict = iframe.contentWindow.Object;
|
|
// html.removeChild(iframe);
|
|
iframeDocument = iframe.contentWindow.document;
|
|
iframeDocument.open();
|
|
iframeDocument.write('<script>document.F=Object</script' + gt);
|
|
iframeDocument.close();
|
|
createDict = iframeDocument.F;
|
|
while(i--)delete createDict.prototype[keys1[i]];
|
|
return createDict();
|
|
};
|
|
var createGetKeys = function(names, length){
|
|
return function(object){
|
|
var O = toIObject(object)
|
|
, i = 0
|
|
, result = []
|
|
, key;
|
|
for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
|
|
// Don't enum bug & hidden keys
|
|
while(length > i)if(has(O, key = names[i++])){
|
|
~arrayIndexOf(result, key) || result.push(key);
|
|
}
|
|
return result;
|
|
};
|
|
};
|
|
var Empty = function(){};
|
|
$export($export.S, 'Object', {
|
|
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
|
|
getPrototypeOf: $.getProto = $.getProto || function(O){
|
|
O = toObject(O);
|
|
if(has(O, IE_PROTO))return O[IE_PROTO];
|
|
if(typeof O.constructor == 'function' && O instanceof O.constructor){
|
|
return O.constructor.prototype;
|
|
} return O instanceof Object ? ObjectProto : null;
|
|
},
|
|
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
|
|
getOwnPropertyNames: $.getNames = $.getNames || createGetKeys(keys2, keys2.length, true),
|
|
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
|
|
create: $.create = $.create || function(O, /*?*/Properties){
|
|
var result;
|
|
if(O !== null){
|
|
Empty.prototype = anObject(O);
|
|
result = new Empty();
|
|
Empty.prototype = null;
|
|
// add "__proto__" for Object.getPrototypeOf shim
|
|
result[IE_PROTO] = O;
|
|
} else result = createDict();
|
|
return Properties === undefined ? result : defineProperties(result, Properties);
|
|
},
|
|
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
|
|
keys: $.getKeys = $.getKeys || createGetKeys(keys1, keysLen1, false)
|
|
});
|
|
|
|
var construct = function(F, len, args){
|
|
if(!(len in factories)){
|
|
for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']';
|
|
factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')');
|
|
}
|
|
return factories[len](F, args);
|
|
};
|
|
|
|
// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
|
|
$export($export.P, 'Function', {
|
|
bind: function bind(that /*, args... */){
|
|
var fn = aFunction(this)
|
|
, partArgs = arraySlice.call(arguments, 1);
|
|
var bound = function(/* args... */){
|
|
var args = partArgs.concat(arraySlice.call(arguments));
|
|
return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that);
|
|
};
|
|
if(isObject(fn.prototype))bound.prototype = fn.prototype;
|
|
return bound;
|
|
}
|
|
});
|
|
|
|
// fallback for not array-like ES3 strings and DOM objects
|
|
$export($export.P + $export.F * fails(function(){
|
|
if(html)arraySlice.call(html);
|
|
}), 'Array', {
|
|
slice: function(begin, end){
|
|
var len = toLength(this.length)
|
|
, klass = cof(this);
|
|
end = end === undefined ? len : end;
|
|
if(klass == 'Array')return arraySlice.call(this, begin, end);
|
|
var start = toIndex(begin, len)
|
|
, upTo = toIndex(end, len)
|
|
, size = toLength(upTo - start)
|
|
, cloned = Array(size)
|
|
, i = 0;
|
|
for(; i < size; i++)cloned[i] = klass == 'String'
|
|
? this.charAt(start + i)
|
|
: this[start + i];
|
|
return cloned;
|
|
}
|
|
});
|
|
$export($export.P + $export.F * (IObject != Object), 'Array', {
|
|
join: function join(separator){
|
|
return arrayJoin.call(IObject(this), separator === undefined ? ',' : separator);
|
|
}
|
|
});
|
|
|
|
// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
|
|
$export($export.S, 'Array', {isArray: require('./$.is-array')});
|
|
|
|
var createArrayReduce = function(isRight){
|
|
return function(callbackfn, memo){
|
|
aFunction(callbackfn);
|
|
var O = IObject(this)
|
|
, length = toLength(O.length)
|
|
, index = isRight ? length - 1 : 0
|
|
, i = isRight ? -1 : 1;
|
|
if(arguments.length < 2)for(;;){
|
|
if(index in O){
|
|
memo = O[index];
|
|
index += i;
|
|
break;
|
|
}
|
|
index += i;
|
|
if(isRight ? index < 0 : length <= index){
|
|
throw TypeError('Reduce of empty array with no initial value');
|
|
}
|
|
}
|
|
for(;isRight ? index >= 0 : length > index; index += i)if(index in O){
|
|
memo = callbackfn(memo, O[index], index, this);
|
|
}
|
|
return memo;
|
|
};
|
|
};
|
|
|
|
var methodize = function($fn){
|
|
return function(arg1/*, arg2 = undefined */){
|
|
return $fn(this, arg1, arguments[1]);
|
|
};
|
|
};
|
|
|
|
$export($export.P, 'Array', {
|
|
// 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
|
|
forEach: $.each = $.each || methodize(createArrayMethod(0)),
|
|
// 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
|
|
map: methodize(createArrayMethod(1)),
|
|
// 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
|
|
filter: methodize(createArrayMethod(2)),
|
|
// 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
|
|
some: methodize(createArrayMethod(3)),
|
|
// 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
|
|
every: methodize(createArrayMethod(4)),
|
|
// 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
|
|
reduce: createArrayReduce(false),
|
|
// 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
|
|
reduceRight: createArrayReduce(true),
|
|
// 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
|
|
indexOf: methodize(arrayIndexOf),
|
|
// 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
|
|
lastIndexOf: function(el, fromIndex /* = @[*-1] */){
|
|
var O = toIObject(this)
|
|
, length = toLength(O.length)
|
|
, index = length - 1;
|
|
if(arguments.length > 1)index = Math.min(index, toInteger(fromIndex));
|
|
if(index < 0)index = toLength(length + index);
|
|
for(;index >= 0; index--)if(index in O)if(O[index] === el)return index;
|
|
return -1;
|
|
}
|
|
});
|
|
|
|
// 20.3.3.1 / 15.9.4.4 Date.now()
|
|
$export($export.S, 'Date', {now: function(){ return +new Date; }});
|
|
|
|
var lz = function(num){
|
|
return num > 9 ? num : '0' + num;
|
|
};
|
|
|
|
// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
|
|
// PhantomJS / old WebKit has a broken implementations
|
|
$export($export.P + $export.F * (fails(function(){
|
|
return new Date(-5e13 - 1).toISOString() != '0385-07-25T07:06:39.999Z';
|
|
}) || !fails(function(){
|
|
new Date(NaN).toISOString();
|
|
})), 'Date', {
|
|
toISOString: function toISOString(){
|
|
if(!isFinite(this))throw RangeError('Invalid time value');
|
|
var d = this
|
|
, y = d.getUTCFullYear()
|
|
, m = d.getUTCMilliseconds()
|
|
, s = y < 0 ? '-' : y > 9999 ? '+' : '';
|
|
return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) +
|
|
'-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) +
|
|
'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) +
|
|
':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
|
|
}
|
|
});
|
|
},{"./$":53,"./$.a-function":9,"./$.an-object":11,"./$.array-includes":14,"./$.array-methods":15,"./$.cof":18,"./$.descriptors":26,"./$.dom-create":27,"./$.export":29,"./$.fails":31,"./$.has":37,"./$.html":39,"./$.invoke":40,"./$.iobject":41,"./$.is-array":43,"./$.is-object":45,"./$.property-desc":66,"./$.to-index":83,"./$.to-integer":84,"./$.to-iobject":85,"./$.to-length":86,"./$.to-object":87,"./$.uid":89}],93:[function(require,module,exports){
|
|
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.P, 'Array', {copyWithin: require('./$.array-copy-within')});
|
|
|
|
require('./$.add-to-unscopables')('copyWithin');
|
|
},{"./$.add-to-unscopables":10,"./$.array-copy-within":12,"./$.export":29}],94:[function(require,module,exports){
|
|
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.P, 'Array', {fill: require('./$.array-fill')});
|
|
|
|
require('./$.add-to-unscopables')('fill');
|
|
},{"./$.add-to-unscopables":10,"./$.array-fill":13,"./$.export":29}],95:[function(require,module,exports){
|
|
'use strict';
|
|
// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
|
|
var $export = require('./$.export')
|
|
, $find = require('./$.array-methods')(6)
|
|
, KEY = 'findIndex'
|
|
, forced = true;
|
|
// Shouldn't skip holes
|
|
if(KEY in [])Array(1)[KEY](function(){ forced = false; });
|
|
$export($export.P + $export.F * forced, 'Array', {
|
|
findIndex: function findIndex(callbackfn/*, that = undefined */){
|
|
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
}
|
|
});
|
|
require('./$.add-to-unscopables')(KEY);
|
|
},{"./$.add-to-unscopables":10,"./$.array-methods":15,"./$.export":29}],96:[function(require,module,exports){
|
|
'use strict';
|
|
// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
|
|
var $export = require('./$.export')
|
|
, $find = require('./$.array-methods')(5)
|
|
, KEY = 'find'
|
|
, forced = true;
|
|
// Shouldn't skip holes
|
|
if(KEY in [])Array(1)[KEY](function(){ forced = false; });
|
|
$export($export.P + $export.F * forced, 'Array', {
|
|
find: function find(callbackfn/*, that = undefined */){
|
|
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
}
|
|
});
|
|
require('./$.add-to-unscopables')(KEY);
|
|
},{"./$.add-to-unscopables":10,"./$.array-methods":15,"./$.export":29}],97:[function(require,module,exports){
|
|
'use strict';
|
|
var ctx = require('./$.ctx')
|
|
, $export = require('./$.export')
|
|
, toObject = require('./$.to-object')
|
|
, call = require('./$.iter-call')
|
|
, isArrayIter = require('./$.is-array-iter')
|
|
, toLength = require('./$.to-length')
|
|
, getIterFn = require('./core.get-iterator-method');
|
|
$export($export.S + $export.F * !require('./$.iter-detect')(function(iter){ Array.from(iter); }), 'Array', {
|
|
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
|
|
from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
|
|
var O = toObject(arrayLike)
|
|
, C = typeof this == 'function' ? this : Array
|
|
, $$ = arguments
|
|
, $$len = $$.length
|
|
, mapfn = $$len > 1 ? $$[1] : undefined
|
|
, mapping = mapfn !== undefined
|
|
, index = 0
|
|
, iterFn = getIterFn(O)
|
|
, length, result, step, iterator;
|
|
if(mapping)mapfn = ctx(mapfn, $$len > 2 ? $$[2] : undefined, 2);
|
|
// if object isn't iterable or it's array with default iterator - use simple case
|
|
if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){
|
|
for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){
|
|
result[index] = mapping ? call(iterator, mapfn, [step.value, index], true) : step.value;
|
|
}
|
|
} else {
|
|
length = toLength(O.length);
|
|
for(result = new C(length); length > index; index++){
|
|
result[index] = mapping ? mapfn(O[index], index) : O[index];
|
|
}
|
|
}
|
|
result.length = index;
|
|
return result;
|
|
}
|
|
});
|
|
|
|
},{"./$.ctx":24,"./$.export":29,"./$.is-array-iter":42,"./$.iter-call":47,"./$.iter-detect":50,"./$.to-length":86,"./$.to-object":87,"./core.get-iterator-method":91}],98:[function(require,module,exports){
|
|
'use strict';
|
|
var addToUnscopables = require('./$.add-to-unscopables')
|
|
, step = require('./$.iter-step')
|
|
, Iterators = require('./$.iterators')
|
|
, toIObject = require('./$.to-iobject');
|
|
|
|
// 22.1.3.4 Array.prototype.entries()
|
|
// 22.1.3.13 Array.prototype.keys()
|
|
// 22.1.3.29 Array.prototype.values()
|
|
// 22.1.3.30 Array.prototype[@@iterator]()
|
|
module.exports = require('./$.iter-define')(Array, 'Array', function(iterated, kind){
|
|
this._t = toIObject(iterated); // target
|
|
this._i = 0; // next index
|
|
this._k = kind; // kind
|
|
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
|
|
}, function(){
|
|
var O = this._t
|
|
, kind = this._k
|
|
, index = this._i++;
|
|
if(!O || index >= O.length){
|
|
this._t = undefined;
|
|
return step(1);
|
|
}
|
|
if(kind == 'keys' )return step(0, index);
|
|
if(kind == 'values')return step(0, O[index]);
|
|
return step(0, [index, O[index]]);
|
|
}, 'values');
|
|
|
|
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
|
|
Iterators.Arguments = Iterators.Array;
|
|
|
|
addToUnscopables('keys');
|
|
addToUnscopables('values');
|
|
addToUnscopables('entries');
|
|
},{"./$.add-to-unscopables":10,"./$.iter-define":49,"./$.iter-step":51,"./$.iterators":52,"./$.to-iobject":85}],99:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./$.export');
|
|
|
|
// WebKit Array.of isn't generic
|
|
$export($export.S + $export.F * require('./$.fails')(function(){
|
|
function F(){}
|
|
return !(Array.of.call(F) instanceof F);
|
|
}), 'Array', {
|
|
// 22.1.2.3 Array.of( ...items)
|
|
of: function of(/* ...args */){
|
|
var index = 0
|
|
, $$ = arguments
|
|
, $$len = $$.length
|
|
, result = new (typeof this == 'function' ? this : Array)($$len);
|
|
while($$len > index)result[index] = $$[index++];
|
|
result.length = $$len;
|
|
return result;
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.fails":31}],100:[function(require,module,exports){
|
|
require('./$.set-species')('Array');
|
|
},{"./$.set-species":72}],101:[function(require,module,exports){
|
|
'use strict';
|
|
var $ = require('./$')
|
|
, isObject = require('./$.is-object')
|
|
, HAS_INSTANCE = require('./$.wks')('hasInstance')
|
|
, FunctionProto = Function.prototype;
|
|
// 19.2.3.6 Function.prototype[@@hasInstance](V)
|
|
if(!(HAS_INSTANCE in FunctionProto))$.setDesc(FunctionProto, HAS_INSTANCE, {value: function(O){
|
|
if(typeof this != 'function' || !isObject(O))return false;
|
|
if(!isObject(this.prototype))return O instanceof this;
|
|
// for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
|
|
while(O = $.getProto(O))if(this.prototype === O)return true;
|
|
return false;
|
|
}});
|
|
},{"./$":53,"./$.is-object":45,"./$.wks":90}],102:[function(require,module,exports){
|
|
var setDesc = require('./$').setDesc
|
|
, createDesc = require('./$.property-desc')
|
|
, has = require('./$.has')
|
|
, FProto = Function.prototype
|
|
, nameRE = /^\s*function ([^ (]*)/
|
|
, NAME = 'name';
|
|
// 19.2.4.2 name
|
|
NAME in FProto || require('./$.descriptors') && setDesc(FProto, NAME, {
|
|
configurable: true,
|
|
get: function(){
|
|
var match = ('' + this).match(nameRE)
|
|
, name = match ? match[1] : '';
|
|
has(this, NAME) || setDesc(this, NAME, createDesc(5, name));
|
|
return name;
|
|
}
|
|
});
|
|
},{"./$":53,"./$.descriptors":26,"./$.has":37,"./$.property-desc":66}],103:[function(require,module,exports){
|
|
'use strict';
|
|
var strong = require('./$.collection-strong');
|
|
|
|
// 23.1 Map Objects
|
|
require('./$.collection')('Map', function(get){
|
|
return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
|
|
}, {
|
|
// 23.1.3.6 Map.prototype.get(key)
|
|
get: function get(key){
|
|
var entry = strong.getEntry(this, key);
|
|
return entry && entry.v;
|
|
},
|
|
// 23.1.3.9 Map.prototype.set(key, value)
|
|
set: function set(key, value){
|
|
return strong.def(this, key === 0 ? 0 : key, value);
|
|
}
|
|
}, strong, true);
|
|
},{"./$.collection":22,"./$.collection-strong":19}],104:[function(require,module,exports){
|
|
// 20.2.2.3 Math.acosh(x)
|
|
var $export = require('./$.export')
|
|
, log1p = require('./$.math-log1p')
|
|
, sqrt = Math.sqrt
|
|
, $acosh = Math.acosh;
|
|
|
|
// V8 bug https://code.google.com/p/v8/issues/detail?id=3509
|
|
$export($export.S + $export.F * !($acosh && Math.floor($acosh(Number.MAX_VALUE)) == 710), 'Math', {
|
|
acosh: function acosh(x){
|
|
return (x = +x) < 1 ? NaN : x > 94906265.62425156
|
|
? Math.log(x) + Math.LN2
|
|
: log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.math-log1p":57}],105:[function(require,module,exports){
|
|
// 20.2.2.5 Math.asinh(x)
|
|
var $export = require('./$.export');
|
|
|
|
function asinh(x){
|
|
return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1));
|
|
}
|
|
|
|
$export($export.S, 'Math', {asinh: asinh});
|
|
},{"./$.export":29}],106:[function(require,module,exports){
|
|
// 20.2.2.7 Math.atanh(x)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Math', {
|
|
atanh: function atanh(x){
|
|
return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2;
|
|
}
|
|
});
|
|
},{"./$.export":29}],107:[function(require,module,exports){
|
|
// 20.2.2.9 Math.cbrt(x)
|
|
var $export = require('./$.export')
|
|
, sign = require('./$.math-sign');
|
|
|
|
$export($export.S, 'Math', {
|
|
cbrt: function cbrt(x){
|
|
return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3);
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.math-sign":58}],108:[function(require,module,exports){
|
|
// 20.2.2.11 Math.clz32(x)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Math', {
|
|
clz32: function clz32(x){
|
|
return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32;
|
|
}
|
|
});
|
|
},{"./$.export":29}],109:[function(require,module,exports){
|
|
// 20.2.2.12 Math.cosh(x)
|
|
var $export = require('./$.export')
|
|
, exp = Math.exp;
|
|
|
|
$export($export.S, 'Math', {
|
|
cosh: function cosh(x){
|
|
return (exp(x = +x) + exp(-x)) / 2;
|
|
}
|
|
});
|
|
},{"./$.export":29}],110:[function(require,module,exports){
|
|
// 20.2.2.14 Math.expm1(x)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Math', {expm1: require('./$.math-expm1')});
|
|
},{"./$.export":29,"./$.math-expm1":56}],111:[function(require,module,exports){
|
|
// 20.2.2.16 Math.fround(x)
|
|
var $export = require('./$.export')
|
|
, sign = require('./$.math-sign')
|
|
, pow = Math.pow
|
|
, EPSILON = pow(2, -52)
|
|
, EPSILON32 = pow(2, -23)
|
|
, MAX32 = pow(2, 127) * (2 - EPSILON32)
|
|
, MIN32 = pow(2, -126);
|
|
|
|
var roundTiesToEven = function(n){
|
|
return n + 1 / EPSILON - 1 / EPSILON;
|
|
};
|
|
|
|
|
|
$export($export.S, 'Math', {
|
|
fround: function fround(x){
|
|
var $abs = Math.abs(x)
|
|
, $sign = sign(x)
|
|
, a, result;
|
|
if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
|
|
a = (1 + EPSILON32 / EPSILON) * $abs;
|
|
result = a - (a - $abs);
|
|
if(result > MAX32 || result != result)return $sign * Infinity;
|
|
return $sign * result;
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.math-sign":58}],112:[function(require,module,exports){
|
|
// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
|
|
var $export = require('./$.export')
|
|
, abs = Math.abs;
|
|
|
|
$export($export.S, 'Math', {
|
|
hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars
|
|
var sum = 0
|
|
, i = 0
|
|
, $$ = arguments
|
|
, $$len = $$.length
|
|
, larg = 0
|
|
, arg, div;
|
|
while(i < $$len){
|
|
arg = abs($$[i++]);
|
|
if(larg < arg){
|
|
div = larg / arg;
|
|
sum = sum * div * div + 1;
|
|
larg = arg;
|
|
} else if(arg > 0){
|
|
div = arg / larg;
|
|
sum += div * div;
|
|
} else sum += arg;
|
|
}
|
|
return larg === Infinity ? Infinity : larg * Math.sqrt(sum);
|
|
}
|
|
});
|
|
},{"./$.export":29}],113:[function(require,module,exports){
|
|
// 20.2.2.18 Math.imul(x, y)
|
|
var $export = require('./$.export')
|
|
, $imul = Math.imul;
|
|
|
|
// some WebKit versions fails with big numbers, some has wrong arity
|
|
$export($export.S + $export.F * require('./$.fails')(function(){
|
|
return $imul(0xffffffff, 5) != -5 || $imul.length != 2;
|
|
}), 'Math', {
|
|
imul: function imul(x, y){
|
|
var UINT16 = 0xffff
|
|
, xn = +x
|
|
, yn = +y
|
|
, xl = UINT16 & xn
|
|
, yl = UINT16 & yn;
|
|
return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0);
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.fails":31}],114:[function(require,module,exports){
|
|
// 20.2.2.21 Math.log10(x)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Math', {
|
|
log10: function log10(x){
|
|
return Math.log(x) / Math.LN10;
|
|
}
|
|
});
|
|
},{"./$.export":29}],115:[function(require,module,exports){
|
|
// 20.2.2.20 Math.log1p(x)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Math', {log1p: require('./$.math-log1p')});
|
|
},{"./$.export":29,"./$.math-log1p":57}],116:[function(require,module,exports){
|
|
// 20.2.2.22 Math.log2(x)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Math', {
|
|
log2: function log2(x){
|
|
return Math.log(x) / Math.LN2;
|
|
}
|
|
});
|
|
},{"./$.export":29}],117:[function(require,module,exports){
|
|
// 20.2.2.28 Math.sign(x)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Math', {sign: require('./$.math-sign')});
|
|
},{"./$.export":29,"./$.math-sign":58}],118:[function(require,module,exports){
|
|
// 20.2.2.30 Math.sinh(x)
|
|
var $export = require('./$.export')
|
|
, expm1 = require('./$.math-expm1')
|
|
, exp = Math.exp;
|
|
|
|
// V8 near Chromium 38 has a problem with very small numbers
|
|
$export($export.S + $export.F * require('./$.fails')(function(){
|
|
return !Math.sinh(-2e-17) != -2e-17;
|
|
}), 'Math', {
|
|
sinh: function sinh(x){
|
|
return Math.abs(x = +x) < 1
|
|
? (expm1(x) - expm1(-x)) / 2
|
|
: (exp(x - 1) - exp(-x - 1)) * (Math.E / 2);
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.fails":31,"./$.math-expm1":56}],119:[function(require,module,exports){
|
|
// 20.2.2.33 Math.tanh(x)
|
|
var $export = require('./$.export')
|
|
, expm1 = require('./$.math-expm1')
|
|
, exp = Math.exp;
|
|
|
|
$export($export.S, 'Math', {
|
|
tanh: function tanh(x){
|
|
var a = expm1(x = +x)
|
|
, b = expm1(-x);
|
|
return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.math-expm1":56}],120:[function(require,module,exports){
|
|
// 20.2.2.34 Math.trunc(x)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Math', {
|
|
trunc: function trunc(it){
|
|
return (it > 0 ? Math.floor : Math.ceil)(it);
|
|
}
|
|
});
|
|
},{"./$.export":29}],121:[function(require,module,exports){
|
|
'use strict';
|
|
var $ = require('./$')
|
|
, global = require('./$.global')
|
|
, has = require('./$.has')
|
|
, cof = require('./$.cof')
|
|
, toPrimitive = require('./$.to-primitive')
|
|
, fails = require('./$.fails')
|
|
, $trim = require('./$.string-trim').trim
|
|
, NUMBER = 'Number'
|
|
, $Number = global[NUMBER]
|
|
, Base = $Number
|
|
, proto = $Number.prototype
|
|
// Opera ~12 has broken Object#toString
|
|
, BROKEN_COF = cof($.create(proto)) == NUMBER
|
|
, TRIM = 'trim' in String.prototype;
|
|
|
|
// 7.1.3 ToNumber(argument)
|
|
var toNumber = function(argument){
|
|
var it = toPrimitive(argument, false);
|
|
if(typeof it == 'string' && it.length > 2){
|
|
it = TRIM ? it.trim() : $trim(it, 3);
|
|
var first = it.charCodeAt(0)
|
|
, third, radix, maxCode;
|
|
if(first === 43 || first === 45){
|
|
third = it.charCodeAt(2);
|
|
if(third === 88 || third === 120)return NaN; // Number('+0x1') should be NaN, old V8 fix
|
|
} else if(first === 48){
|
|
switch(it.charCodeAt(1)){
|
|
case 66 : case 98 : radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i
|
|
case 79 : case 111 : radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i
|
|
default : return +it;
|
|
}
|
|
for(var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++){
|
|
code = digits.charCodeAt(i);
|
|
// parseInt parses a string to a first unavailable symbol
|
|
// but ToNumber should return NaN if a string contains unavailable symbols
|
|
if(code < 48 || code > maxCode)return NaN;
|
|
} return parseInt(digits, radix);
|
|
}
|
|
} return +it;
|
|
};
|
|
|
|
if(!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')){
|
|
$Number = function Number(value){
|
|
var it = arguments.length < 1 ? 0 : value
|
|
, that = this;
|
|
return that instanceof $Number
|
|
// check on 1..constructor(foo) case
|
|
&& (BROKEN_COF ? fails(function(){ proto.valueOf.call(that); }) : cof(that) != NUMBER)
|
|
? new Base(toNumber(it)) : toNumber(it);
|
|
};
|
|
$.each.call(require('./$.descriptors') ? $.getNames(Base) : (
|
|
// ES3:
|
|
'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
|
|
// ES6 (in case, if modules with ES6 Number statics required before):
|
|
'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
|
|
'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
|
|
).split(','), function(key){
|
|
if(has(Base, key) && !has($Number, key)){
|
|
$.setDesc($Number, key, $.getDesc(Base, key));
|
|
}
|
|
});
|
|
$Number.prototype = proto;
|
|
proto.constructor = $Number;
|
|
require('./$.redefine')(global, NUMBER, $Number);
|
|
}
|
|
},{"./$":53,"./$.cof":18,"./$.descriptors":26,"./$.fails":31,"./$.global":36,"./$.has":37,"./$.redefine":68,"./$.string-trim":81,"./$.to-primitive":88}],122:[function(require,module,exports){
|
|
// 20.1.2.1 Number.EPSILON
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Number', {EPSILON: Math.pow(2, -52)});
|
|
},{"./$.export":29}],123:[function(require,module,exports){
|
|
// 20.1.2.2 Number.isFinite(number)
|
|
var $export = require('./$.export')
|
|
, _isFinite = require('./$.global').isFinite;
|
|
|
|
$export($export.S, 'Number', {
|
|
isFinite: function isFinite(it){
|
|
return typeof it == 'number' && _isFinite(it);
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.global":36}],124:[function(require,module,exports){
|
|
// 20.1.2.3 Number.isInteger(number)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Number', {isInteger: require('./$.is-integer')});
|
|
},{"./$.export":29,"./$.is-integer":44}],125:[function(require,module,exports){
|
|
// 20.1.2.4 Number.isNaN(number)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Number', {
|
|
isNaN: function isNaN(number){
|
|
return number != number;
|
|
}
|
|
});
|
|
},{"./$.export":29}],126:[function(require,module,exports){
|
|
// 20.1.2.5 Number.isSafeInteger(number)
|
|
var $export = require('./$.export')
|
|
, isInteger = require('./$.is-integer')
|
|
, abs = Math.abs;
|
|
|
|
$export($export.S, 'Number', {
|
|
isSafeInteger: function isSafeInteger(number){
|
|
return isInteger(number) && abs(number) <= 0x1fffffffffffff;
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.is-integer":44}],127:[function(require,module,exports){
|
|
// 20.1.2.6 Number.MAX_SAFE_INTEGER
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff});
|
|
},{"./$.export":29}],128:[function(require,module,exports){
|
|
// 20.1.2.10 Number.MIN_SAFE_INTEGER
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff});
|
|
},{"./$.export":29}],129:[function(require,module,exports){
|
|
// 20.1.2.12 Number.parseFloat(string)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Number', {parseFloat: parseFloat});
|
|
},{"./$.export":29}],130:[function(require,module,exports){
|
|
// 20.1.2.13 Number.parseInt(string, radix)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Number', {parseInt: parseInt});
|
|
},{"./$.export":29}],131:[function(require,module,exports){
|
|
// 19.1.3.1 Object.assign(target, source)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S + $export.F, 'Object', {assign: require('./$.object-assign')});
|
|
},{"./$.export":29,"./$.object-assign":60}],132:[function(require,module,exports){
|
|
// 19.1.2.5 Object.freeze(O)
|
|
var isObject = require('./$.is-object');
|
|
|
|
require('./$.object-sap')('freeze', function($freeze){
|
|
return function freeze(it){
|
|
return $freeze && isObject(it) ? $freeze(it) : it;
|
|
};
|
|
});
|
|
},{"./$.is-object":45,"./$.object-sap":61}],133:[function(require,module,exports){
|
|
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
|
|
var toIObject = require('./$.to-iobject');
|
|
|
|
require('./$.object-sap')('getOwnPropertyDescriptor', function($getOwnPropertyDescriptor){
|
|
return function getOwnPropertyDescriptor(it, key){
|
|
return $getOwnPropertyDescriptor(toIObject(it), key);
|
|
};
|
|
});
|
|
},{"./$.object-sap":61,"./$.to-iobject":85}],134:[function(require,module,exports){
|
|
// 19.1.2.7 Object.getOwnPropertyNames(O)
|
|
require('./$.object-sap')('getOwnPropertyNames', function(){
|
|
return require('./$.get-names').get;
|
|
});
|
|
},{"./$.get-names":35,"./$.object-sap":61}],135:[function(require,module,exports){
|
|
// 19.1.2.9 Object.getPrototypeOf(O)
|
|
var toObject = require('./$.to-object');
|
|
|
|
require('./$.object-sap')('getPrototypeOf', function($getPrototypeOf){
|
|
return function getPrototypeOf(it){
|
|
return $getPrototypeOf(toObject(it));
|
|
};
|
|
});
|
|
},{"./$.object-sap":61,"./$.to-object":87}],136:[function(require,module,exports){
|
|
// 19.1.2.11 Object.isExtensible(O)
|
|
var isObject = require('./$.is-object');
|
|
|
|
require('./$.object-sap')('isExtensible', function($isExtensible){
|
|
return function isExtensible(it){
|
|
return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;
|
|
};
|
|
});
|
|
},{"./$.is-object":45,"./$.object-sap":61}],137:[function(require,module,exports){
|
|
// 19.1.2.12 Object.isFrozen(O)
|
|
var isObject = require('./$.is-object');
|
|
|
|
require('./$.object-sap')('isFrozen', function($isFrozen){
|
|
return function isFrozen(it){
|
|
return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true;
|
|
};
|
|
});
|
|
},{"./$.is-object":45,"./$.object-sap":61}],138:[function(require,module,exports){
|
|
// 19.1.2.13 Object.isSealed(O)
|
|
var isObject = require('./$.is-object');
|
|
|
|
require('./$.object-sap')('isSealed', function($isSealed){
|
|
return function isSealed(it){
|
|
return isObject(it) ? $isSealed ? $isSealed(it) : false : true;
|
|
};
|
|
});
|
|
},{"./$.is-object":45,"./$.object-sap":61}],139:[function(require,module,exports){
|
|
// 19.1.3.10 Object.is(value1, value2)
|
|
var $export = require('./$.export');
|
|
$export($export.S, 'Object', {is: require('./$.same-value')});
|
|
},{"./$.export":29,"./$.same-value":70}],140:[function(require,module,exports){
|
|
// 19.1.2.14 Object.keys(O)
|
|
var toObject = require('./$.to-object');
|
|
|
|
require('./$.object-sap')('keys', function($keys){
|
|
return function keys(it){
|
|
return $keys(toObject(it));
|
|
};
|
|
});
|
|
},{"./$.object-sap":61,"./$.to-object":87}],141:[function(require,module,exports){
|
|
// 19.1.2.15 Object.preventExtensions(O)
|
|
var isObject = require('./$.is-object');
|
|
|
|
require('./$.object-sap')('preventExtensions', function($preventExtensions){
|
|
return function preventExtensions(it){
|
|
return $preventExtensions && isObject(it) ? $preventExtensions(it) : it;
|
|
};
|
|
});
|
|
},{"./$.is-object":45,"./$.object-sap":61}],142:[function(require,module,exports){
|
|
// 19.1.2.17 Object.seal(O)
|
|
var isObject = require('./$.is-object');
|
|
|
|
require('./$.object-sap')('seal', function($seal){
|
|
return function seal(it){
|
|
return $seal && isObject(it) ? $seal(it) : it;
|
|
};
|
|
});
|
|
},{"./$.is-object":45,"./$.object-sap":61}],143:[function(require,module,exports){
|
|
// 19.1.3.19 Object.setPrototypeOf(O, proto)
|
|
var $export = require('./$.export');
|
|
$export($export.S, 'Object', {setPrototypeOf: require('./$.set-proto').set});
|
|
},{"./$.export":29,"./$.set-proto":71}],144:[function(require,module,exports){
|
|
'use strict';
|
|
// 19.1.3.6 Object.prototype.toString()
|
|
var classof = require('./$.classof')
|
|
, test = {};
|
|
test[require('./$.wks')('toStringTag')] = 'z';
|
|
if(test + '' != '[object z]'){
|
|
require('./$.redefine')(Object.prototype, 'toString', function toString(){
|
|
return '[object ' + classof(this) + ']';
|
|
}, true);
|
|
}
|
|
},{"./$.classof":17,"./$.redefine":68,"./$.wks":90}],145:[function(require,module,exports){
|
|
'use strict';
|
|
var $ = require('./$')
|
|
, LIBRARY = require('./$.library')
|
|
, global = require('./$.global')
|
|
, ctx = require('./$.ctx')
|
|
, classof = require('./$.classof')
|
|
, $export = require('./$.export')
|
|
, isObject = require('./$.is-object')
|
|
, anObject = require('./$.an-object')
|
|
, aFunction = require('./$.a-function')
|
|
, strictNew = require('./$.strict-new')
|
|
, forOf = require('./$.for-of')
|
|
, setProto = require('./$.set-proto').set
|
|
, same = require('./$.same-value')
|
|
, SPECIES = require('./$.wks')('species')
|
|
, speciesConstructor = require('./$.species-constructor')
|
|
, asap = require('./$.microtask')
|
|
, PROMISE = 'Promise'
|
|
, process = global.process
|
|
, isNode = classof(process) == 'process'
|
|
, P = global[PROMISE]
|
|
, empty = function(){ /* empty */ }
|
|
, Wrapper;
|
|
|
|
var testResolve = function(sub){
|
|
var test = new P(empty), promise;
|
|
if(sub)test.constructor = function(exec){
|
|
exec(empty, empty);
|
|
};
|
|
(promise = P.resolve(test))['catch'](empty);
|
|
return promise === test;
|
|
};
|
|
|
|
var USE_NATIVE = function(){
|
|
var works = false;
|
|
function P2(x){
|
|
var self = new P(x);
|
|
setProto(self, P2.prototype);
|
|
return self;
|
|
}
|
|
try {
|
|
works = P && P.resolve && testResolve();
|
|
setProto(P2, P);
|
|
P2.prototype = $.create(P.prototype, {constructor: {value: P2}});
|
|
// actual Firefox has broken subclass support, test that
|
|
if(!(P2.resolve(5).then(function(){}) instanceof P2)){
|
|
works = false;
|
|
}
|
|
// actual V8 bug, https://code.google.com/p/v8/issues/detail?id=4162
|
|
if(works && require('./$.descriptors')){
|
|
var thenableThenGotten = false;
|
|
P.resolve($.setDesc({}, 'then', {
|
|
get: function(){ thenableThenGotten = true; }
|
|
}));
|
|
works = thenableThenGotten;
|
|
}
|
|
} catch(e){ works = false; }
|
|
return works;
|
|
}();
|
|
|
|
// helpers
|
|
var sameConstructor = function(a, b){
|
|
// library wrapper special case
|
|
if(LIBRARY && a === P && b === Wrapper)return true;
|
|
return same(a, b);
|
|
};
|
|
var getConstructor = function(C){
|
|
var S = anObject(C)[SPECIES];
|
|
return S != undefined ? S : C;
|
|
};
|
|
var isThenable = function(it){
|
|
var then;
|
|
return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
|
|
};
|
|
var PromiseCapability = function(C){
|
|
var resolve, reject;
|
|
this.promise = new C(function($$resolve, $$reject){
|
|
if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor');
|
|
resolve = $$resolve;
|
|
reject = $$reject;
|
|
});
|
|
this.resolve = aFunction(resolve),
|
|
this.reject = aFunction(reject)
|
|
};
|
|
var perform = function(exec){
|
|
try {
|
|
exec();
|
|
} catch(e){
|
|
return {error: e};
|
|
}
|
|
};
|
|
var notify = function(record, isReject){
|
|
if(record.n)return;
|
|
record.n = true;
|
|
var chain = record.c;
|
|
asap(function(){
|
|
var value = record.v
|
|
, ok = record.s == 1
|
|
, i = 0;
|
|
var run = function(reaction){
|
|
var handler = ok ? reaction.ok : reaction.fail
|
|
, resolve = reaction.resolve
|
|
, reject = reaction.reject
|
|
, result, then;
|
|
try {
|
|
if(handler){
|
|
if(!ok)record.h = true;
|
|
result = handler === true ? value : handler(value);
|
|
if(result === reaction.promise){
|
|
reject(TypeError('Promise-chain cycle'));
|
|
} else if(then = isThenable(result)){
|
|
then.call(result, resolve, reject);
|
|
} else resolve(result);
|
|
} else reject(value);
|
|
} catch(e){
|
|
reject(e);
|
|
}
|
|
};
|
|
while(chain.length > i)run(chain[i++]); // variable length - can't use forEach
|
|
chain.length = 0;
|
|
record.n = false;
|
|
if(isReject)setTimeout(function(){
|
|
var promise = record.p
|
|
, handler, console;
|
|
if(isUnhandled(promise)){
|
|
if(isNode){
|
|
process.emit('unhandledRejection', value, promise);
|
|
} else if(handler = global.onunhandledrejection){
|
|
handler({promise: promise, reason: value});
|
|
} else if((console = global.console) && console.error){
|
|
console.error('Unhandled promise rejection', value);
|
|
}
|
|
} record.a = undefined;
|
|
}, 1);
|
|
});
|
|
};
|
|
var isUnhandled = function(promise){
|
|
var record = promise._d
|
|
, chain = record.a || record.c
|
|
, i = 0
|
|
, reaction;
|
|
if(record.h)return false;
|
|
while(chain.length > i){
|
|
reaction = chain[i++];
|
|
if(reaction.fail || !isUnhandled(reaction.promise))return false;
|
|
} return true;
|
|
};
|
|
var $reject = function(value){
|
|
var record = this;
|
|
if(record.d)return;
|
|
record.d = true;
|
|
record = record.r || record; // unwrap
|
|
record.v = value;
|
|
record.s = 2;
|
|
record.a = record.c.slice();
|
|
notify(record, true);
|
|
};
|
|
var $resolve = function(value){
|
|
var record = this
|
|
, then;
|
|
if(record.d)return;
|
|
record.d = true;
|
|
record = record.r || record; // unwrap
|
|
try {
|
|
if(record.p === value)throw TypeError("Promise can't be resolved itself");
|
|
if(then = isThenable(value)){
|
|
asap(function(){
|
|
var wrapper = {r: record, d: false}; // wrap
|
|
try {
|
|
then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
|
|
} catch(e){
|
|
$reject.call(wrapper, e);
|
|
}
|
|
});
|
|
} else {
|
|
record.v = value;
|
|
record.s = 1;
|
|
notify(record, false);
|
|
}
|
|
} catch(e){
|
|
$reject.call({r: record, d: false}, e); // wrap
|
|
}
|
|
};
|
|
|
|
// constructor polyfill
|
|
if(!USE_NATIVE){
|
|
// 25.4.3.1 Promise(executor)
|
|
P = function Promise(executor){
|
|
aFunction(executor);
|
|
var record = this._d = {
|
|
p: strictNew(this, P, PROMISE), // <- promise
|
|
c: [], // <- awaiting reactions
|
|
a: undefined, // <- checked in isUnhandled reactions
|
|
s: 0, // <- state
|
|
d: false, // <- done
|
|
v: undefined, // <- value
|
|
h: false, // <- handled rejection
|
|
n: false // <- notify
|
|
};
|
|
try {
|
|
executor(ctx($resolve, record, 1), ctx($reject, record, 1));
|
|
} catch(err){
|
|
$reject.call(record, err);
|
|
}
|
|
};
|
|
require('./$.redefine-all')(P.prototype, {
|
|
// 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
|
|
then: function then(onFulfilled, onRejected){
|
|
var reaction = new PromiseCapability(speciesConstructor(this, P))
|
|
, promise = reaction.promise
|
|
, record = this._d;
|
|
reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
|
|
reaction.fail = typeof onRejected == 'function' && onRejected;
|
|
record.c.push(reaction);
|
|
if(record.a)record.a.push(reaction);
|
|
if(record.s)notify(record, false);
|
|
return promise;
|
|
},
|
|
// 25.4.5.1 Promise.prototype.catch(onRejected)
|
|
'catch': function(onRejected){
|
|
return this.then(undefined, onRejected);
|
|
}
|
|
});
|
|
}
|
|
|
|
$export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: P});
|
|
require('./$.set-to-string-tag')(P, PROMISE);
|
|
require('./$.set-species')(PROMISE);
|
|
Wrapper = require('./$.core')[PROMISE];
|
|
|
|
// statics
|
|
$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
|
|
// 25.4.4.5 Promise.reject(r)
|
|
reject: function reject(r){
|
|
var capability = new PromiseCapability(this)
|
|
, $$reject = capability.reject;
|
|
$$reject(r);
|
|
return capability.promise;
|
|
}
|
|
});
|
|
$export($export.S + $export.F * (!USE_NATIVE || testResolve(true)), PROMISE, {
|
|
// 25.4.4.6 Promise.resolve(x)
|
|
resolve: function resolve(x){
|
|
// instanceof instead of internal slot check because we should fix it without replacement native Promise core
|
|
if(x instanceof P && sameConstructor(x.constructor, this))return x;
|
|
var capability = new PromiseCapability(this)
|
|
, $$resolve = capability.resolve;
|
|
$$resolve(x);
|
|
return capability.promise;
|
|
}
|
|
});
|
|
$export($export.S + $export.F * !(USE_NATIVE && require('./$.iter-detect')(function(iter){
|
|
P.all(iter)['catch'](function(){});
|
|
})), PROMISE, {
|
|
// 25.4.4.1 Promise.all(iterable)
|
|
all: function all(iterable){
|
|
var C = getConstructor(this)
|
|
, capability = new PromiseCapability(C)
|
|
, resolve = capability.resolve
|
|
, reject = capability.reject
|
|
, values = [];
|
|
var abrupt = perform(function(){
|
|
forOf(iterable, false, values.push, values);
|
|
var remaining = values.length
|
|
, results = Array(remaining);
|
|
if(remaining)$.each.call(values, function(promise, index){
|
|
var alreadyCalled = false;
|
|
C.resolve(promise).then(function(value){
|
|
if(alreadyCalled)return;
|
|
alreadyCalled = true;
|
|
results[index] = value;
|
|
--remaining || resolve(results);
|
|
}, reject);
|
|
});
|
|
else resolve(results);
|
|
});
|
|
if(abrupt)reject(abrupt.error);
|
|
return capability.promise;
|
|
},
|
|
// 25.4.4.4 Promise.race(iterable)
|
|
race: function race(iterable){
|
|
var C = getConstructor(this)
|
|
, capability = new PromiseCapability(C)
|
|
, reject = capability.reject;
|
|
var abrupt = perform(function(){
|
|
forOf(iterable, false, function(promise){
|
|
C.resolve(promise).then(capability.resolve, reject);
|
|
});
|
|
});
|
|
if(abrupt)reject(abrupt.error);
|
|
return capability.promise;
|
|
}
|
|
});
|
|
},{"./$":53,"./$.a-function":9,"./$.an-object":11,"./$.classof":17,"./$.core":23,"./$.ctx":24,"./$.descriptors":26,"./$.export":29,"./$.for-of":34,"./$.global":36,"./$.is-object":45,"./$.iter-detect":50,"./$.library":55,"./$.microtask":59,"./$.redefine-all":67,"./$.same-value":70,"./$.set-proto":71,"./$.set-species":72,"./$.set-to-string-tag":73,"./$.species-constructor":75,"./$.strict-new":76,"./$.wks":90}],146:[function(require,module,exports){
|
|
// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
|
|
var $export = require('./$.export')
|
|
, _apply = Function.apply
|
|
, anObject = require('./$.an-object');
|
|
|
|
$export($export.S, 'Reflect', {
|
|
apply: function apply(target, thisArgument, argumentsList){
|
|
return _apply.call(target, thisArgument, anObject(argumentsList));
|
|
}
|
|
});
|
|
},{"./$.an-object":11,"./$.export":29}],147:[function(require,module,exports){
|
|
// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
|
|
var $ = require('./$')
|
|
, $export = require('./$.export')
|
|
, aFunction = require('./$.a-function')
|
|
, anObject = require('./$.an-object')
|
|
, isObject = require('./$.is-object')
|
|
, bind = Function.bind || require('./$.core').Function.prototype.bind;
|
|
|
|
// MS Edge supports only 2 arguments
|
|
// FF Nightly sets third argument as `new.target`, but does not create `this` from it
|
|
$export($export.S + $export.F * require('./$.fails')(function(){
|
|
function F(){}
|
|
return !(Reflect.construct(function(){}, [], F) instanceof F);
|
|
}), 'Reflect', {
|
|
construct: function construct(Target, args /*, newTarget*/){
|
|
aFunction(Target);
|
|
anObject(args);
|
|
var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
|
|
if(Target == newTarget){
|
|
// w/o altered newTarget, optimization for 0-4 arguments
|
|
switch(args.length){
|
|
case 0: return new Target;
|
|
case 1: return new Target(args[0]);
|
|
case 2: return new Target(args[0], args[1]);
|
|
case 3: return new Target(args[0], args[1], args[2]);
|
|
case 4: return new Target(args[0], args[1], args[2], args[3]);
|
|
}
|
|
// w/o altered newTarget, lot of arguments case
|
|
var $args = [null];
|
|
$args.push.apply($args, args);
|
|
return new (bind.apply(Target, $args));
|
|
}
|
|
// with altered newTarget, not support built-in constructors
|
|
var proto = newTarget.prototype
|
|
, instance = $.create(isObject(proto) ? proto : Object.prototype)
|
|
, result = Function.apply.call(Target, instance, args);
|
|
return isObject(result) ? result : instance;
|
|
}
|
|
});
|
|
},{"./$":53,"./$.a-function":9,"./$.an-object":11,"./$.core":23,"./$.export":29,"./$.fails":31,"./$.is-object":45}],148:[function(require,module,exports){
|
|
// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
|
|
var $ = require('./$')
|
|
, $export = require('./$.export')
|
|
, anObject = require('./$.an-object');
|
|
|
|
// MS Edge has broken Reflect.defineProperty - throwing instead of returning false
|
|
$export($export.S + $export.F * require('./$.fails')(function(){
|
|
Reflect.defineProperty($.setDesc({}, 1, {value: 1}), 1, {value: 2});
|
|
}), 'Reflect', {
|
|
defineProperty: function defineProperty(target, propertyKey, attributes){
|
|
anObject(target);
|
|
try {
|
|
$.setDesc(target, propertyKey, attributes);
|
|
return true;
|
|
} catch(e){
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
},{"./$":53,"./$.an-object":11,"./$.export":29,"./$.fails":31}],149:[function(require,module,exports){
|
|
// 26.1.4 Reflect.deleteProperty(target, propertyKey)
|
|
var $export = require('./$.export')
|
|
, getDesc = require('./$').getDesc
|
|
, anObject = require('./$.an-object');
|
|
|
|
$export($export.S, 'Reflect', {
|
|
deleteProperty: function deleteProperty(target, propertyKey){
|
|
var desc = getDesc(anObject(target), propertyKey);
|
|
return desc && !desc.configurable ? false : delete target[propertyKey];
|
|
}
|
|
});
|
|
},{"./$":53,"./$.an-object":11,"./$.export":29}],150:[function(require,module,exports){
|
|
'use strict';
|
|
// 26.1.5 Reflect.enumerate(target)
|
|
var $export = require('./$.export')
|
|
, anObject = require('./$.an-object');
|
|
var Enumerate = function(iterated){
|
|
this._t = anObject(iterated); // target
|
|
this._i = 0; // next index
|
|
var keys = this._k = [] // keys
|
|
, key;
|
|
for(key in iterated)keys.push(key);
|
|
};
|
|
require('./$.iter-create')(Enumerate, 'Object', function(){
|
|
var that = this
|
|
, keys = that._k
|
|
, key;
|
|
do {
|
|
if(that._i >= keys.length)return {value: undefined, done: true};
|
|
} while(!((key = keys[that._i++]) in that._t));
|
|
return {value: key, done: false};
|
|
});
|
|
|
|
$export($export.S, 'Reflect', {
|
|
enumerate: function enumerate(target){
|
|
return new Enumerate(target);
|
|
}
|
|
});
|
|
},{"./$.an-object":11,"./$.export":29,"./$.iter-create":48}],151:[function(require,module,exports){
|
|
// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
|
|
var $ = require('./$')
|
|
, $export = require('./$.export')
|
|
, anObject = require('./$.an-object');
|
|
|
|
$export($export.S, 'Reflect', {
|
|
getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){
|
|
return $.getDesc(anObject(target), propertyKey);
|
|
}
|
|
});
|
|
},{"./$":53,"./$.an-object":11,"./$.export":29}],152:[function(require,module,exports){
|
|
// 26.1.8 Reflect.getPrototypeOf(target)
|
|
var $export = require('./$.export')
|
|
, getProto = require('./$').getProto
|
|
, anObject = require('./$.an-object');
|
|
|
|
$export($export.S, 'Reflect', {
|
|
getPrototypeOf: function getPrototypeOf(target){
|
|
return getProto(anObject(target));
|
|
}
|
|
});
|
|
},{"./$":53,"./$.an-object":11,"./$.export":29}],153:[function(require,module,exports){
|
|
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
|
|
var $ = require('./$')
|
|
, has = require('./$.has')
|
|
, $export = require('./$.export')
|
|
, isObject = require('./$.is-object')
|
|
, anObject = require('./$.an-object');
|
|
|
|
function get(target, propertyKey/*, receiver*/){
|
|
var receiver = arguments.length < 3 ? target : arguments[2]
|
|
, desc, proto;
|
|
if(anObject(target) === receiver)return target[propertyKey];
|
|
if(desc = $.getDesc(target, propertyKey))return has(desc, 'value')
|
|
? desc.value
|
|
: desc.get !== undefined
|
|
? desc.get.call(receiver)
|
|
: undefined;
|
|
if(isObject(proto = $.getProto(target)))return get(proto, propertyKey, receiver);
|
|
}
|
|
|
|
$export($export.S, 'Reflect', {get: get});
|
|
},{"./$":53,"./$.an-object":11,"./$.export":29,"./$.has":37,"./$.is-object":45}],154:[function(require,module,exports){
|
|
// 26.1.9 Reflect.has(target, propertyKey)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Reflect', {
|
|
has: function has(target, propertyKey){
|
|
return propertyKey in target;
|
|
}
|
|
});
|
|
},{"./$.export":29}],155:[function(require,module,exports){
|
|
// 26.1.10 Reflect.isExtensible(target)
|
|
var $export = require('./$.export')
|
|
, anObject = require('./$.an-object')
|
|
, $isExtensible = Object.isExtensible;
|
|
|
|
$export($export.S, 'Reflect', {
|
|
isExtensible: function isExtensible(target){
|
|
anObject(target);
|
|
return $isExtensible ? $isExtensible(target) : true;
|
|
}
|
|
});
|
|
},{"./$.an-object":11,"./$.export":29}],156:[function(require,module,exports){
|
|
// 26.1.11 Reflect.ownKeys(target)
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.S, 'Reflect', {ownKeys: require('./$.own-keys')});
|
|
},{"./$.export":29,"./$.own-keys":63}],157:[function(require,module,exports){
|
|
// 26.1.12 Reflect.preventExtensions(target)
|
|
var $export = require('./$.export')
|
|
, anObject = require('./$.an-object')
|
|
, $preventExtensions = Object.preventExtensions;
|
|
|
|
$export($export.S, 'Reflect', {
|
|
preventExtensions: function preventExtensions(target){
|
|
anObject(target);
|
|
try {
|
|
if($preventExtensions)$preventExtensions(target);
|
|
return true;
|
|
} catch(e){
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
},{"./$.an-object":11,"./$.export":29}],158:[function(require,module,exports){
|
|
// 26.1.14 Reflect.setPrototypeOf(target, proto)
|
|
var $export = require('./$.export')
|
|
, setProto = require('./$.set-proto');
|
|
|
|
if(setProto)$export($export.S, 'Reflect', {
|
|
setPrototypeOf: function setPrototypeOf(target, proto){
|
|
setProto.check(target, proto);
|
|
try {
|
|
setProto.set(target, proto);
|
|
return true;
|
|
} catch(e){
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.set-proto":71}],159:[function(require,module,exports){
|
|
// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
|
|
var $ = require('./$')
|
|
, has = require('./$.has')
|
|
, $export = require('./$.export')
|
|
, createDesc = require('./$.property-desc')
|
|
, anObject = require('./$.an-object')
|
|
, isObject = require('./$.is-object');
|
|
|
|
function set(target, propertyKey, V/*, receiver*/){
|
|
var receiver = arguments.length < 4 ? target : arguments[3]
|
|
, ownDesc = $.getDesc(anObject(target), propertyKey)
|
|
, existingDescriptor, proto;
|
|
if(!ownDesc){
|
|
if(isObject(proto = $.getProto(target))){
|
|
return set(proto, propertyKey, V, receiver);
|
|
}
|
|
ownDesc = createDesc(0);
|
|
}
|
|
if(has(ownDesc, 'value')){
|
|
if(ownDesc.writable === false || !isObject(receiver))return false;
|
|
existingDescriptor = $.getDesc(receiver, propertyKey) || createDesc(0);
|
|
existingDescriptor.value = V;
|
|
$.setDesc(receiver, propertyKey, existingDescriptor);
|
|
return true;
|
|
}
|
|
return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
|
|
}
|
|
|
|
$export($export.S, 'Reflect', {set: set});
|
|
},{"./$":53,"./$.an-object":11,"./$.export":29,"./$.has":37,"./$.is-object":45,"./$.property-desc":66}],160:[function(require,module,exports){
|
|
var $ = require('./$')
|
|
, global = require('./$.global')
|
|
, isRegExp = require('./$.is-regexp')
|
|
, $flags = require('./$.flags')
|
|
, $RegExp = global.RegExp
|
|
, Base = $RegExp
|
|
, proto = $RegExp.prototype
|
|
, re1 = /a/g
|
|
, re2 = /a/g
|
|
// "new" creates a new object, old webkit buggy here
|
|
, CORRECT_NEW = new $RegExp(re1) !== re1;
|
|
|
|
if(require('./$.descriptors') && (!CORRECT_NEW || require('./$.fails')(function(){
|
|
re2[require('./$.wks')('match')] = false;
|
|
// RegExp constructor can alter flags and IsRegExp works correct with @@match
|
|
return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
|
|
}))){
|
|
$RegExp = function RegExp(p, f){
|
|
var piRE = isRegExp(p)
|
|
, fiU = f === undefined;
|
|
return !(this instanceof $RegExp) && piRE && p.constructor === $RegExp && fiU ? p
|
|
: CORRECT_NEW
|
|
? new Base(piRE && !fiU ? p.source : p, f)
|
|
: Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f);
|
|
};
|
|
$.each.call($.getNames(Base), function(key){
|
|
key in $RegExp || $.setDesc($RegExp, key, {
|
|
configurable: true,
|
|
get: function(){ return Base[key]; },
|
|
set: function(it){ Base[key] = it; }
|
|
});
|
|
});
|
|
proto.constructor = $RegExp;
|
|
$RegExp.prototype = proto;
|
|
require('./$.redefine')(global, 'RegExp', $RegExp);
|
|
}
|
|
|
|
require('./$.set-species')('RegExp');
|
|
},{"./$":53,"./$.descriptors":26,"./$.fails":31,"./$.flags":33,"./$.global":36,"./$.is-regexp":46,"./$.redefine":68,"./$.set-species":72,"./$.wks":90}],161:[function(require,module,exports){
|
|
// 21.2.5.3 get RegExp.prototype.flags()
|
|
var $ = require('./$');
|
|
if(require('./$.descriptors') && /./g.flags != 'g')$.setDesc(RegExp.prototype, 'flags', {
|
|
configurable: true,
|
|
get: require('./$.flags')
|
|
});
|
|
},{"./$":53,"./$.descriptors":26,"./$.flags":33}],162:[function(require,module,exports){
|
|
// @@match logic
|
|
require('./$.fix-re-wks')('match', 1, function(defined, MATCH){
|
|
// 21.1.3.11 String.prototype.match(regexp)
|
|
return function match(regexp){
|
|
'use strict';
|
|
var O = defined(this)
|
|
, fn = regexp == undefined ? undefined : regexp[MATCH];
|
|
return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
|
|
};
|
|
});
|
|
},{"./$.fix-re-wks":32}],163:[function(require,module,exports){
|
|
// @@replace logic
|
|
require('./$.fix-re-wks')('replace', 2, function(defined, REPLACE, $replace){
|
|
// 21.1.3.14 String.prototype.replace(searchValue, replaceValue)
|
|
return function replace(searchValue, replaceValue){
|
|
'use strict';
|
|
var O = defined(this)
|
|
, fn = searchValue == undefined ? undefined : searchValue[REPLACE];
|
|
return fn !== undefined
|
|
? fn.call(searchValue, O, replaceValue)
|
|
: $replace.call(String(O), searchValue, replaceValue);
|
|
};
|
|
});
|
|
},{"./$.fix-re-wks":32}],164:[function(require,module,exports){
|
|
// @@search logic
|
|
require('./$.fix-re-wks')('search', 1, function(defined, SEARCH){
|
|
// 21.1.3.15 String.prototype.search(regexp)
|
|
return function search(regexp){
|
|
'use strict';
|
|
var O = defined(this)
|
|
, fn = regexp == undefined ? undefined : regexp[SEARCH];
|
|
return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
|
|
};
|
|
});
|
|
},{"./$.fix-re-wks":32}],165:[function(require,module,exports){
|
|
// @@split logic
|
|
require('./$.fix-re-wks')('split', 2, function(defined, SPLIT, $split){
|
|
// 21.1.3.17 String.prototype.split(separator, limit)
|
|
return function split(separator, limit){
|
|
'use strict';
|
|
var O = defined(this)
|
|
, fn = separator == undefined ? undefined : separator[SPLIT];
|
|
return fn !== undefined
|
|
? fn.call(separator, O, limit)
|
|
: $split.call(String(O), separator, limit);
|
|
};
|
|
});
|
|
},{"./$.fix-re-wks":32}],166:[function(require,module,exports){
|
|
'use strict';
|
|
var strong = require('./$.collection-strong');
|
|
|
|
// 23.2 Set Objects
|
|
require('./$.collection')('Set', function(get){
|
|
return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
|
|
}, {
|
|
// 23.2.3.1 Set.prototype.add(value)
|
|
add: function add(value){
|
|
return strong.def(this, value = value === 0 ? 0 : value, value);
|
|
}
|
|
}, strong);
|
|
},{"./$.collection":22,"./$.collection-strong":19}],167:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./$.export')
|
|
, $at = require('./$.string-at')(false);
|
|
$export($export.P, 'String', {
|
|
// 21.1.3.3 String.prototype.codePointAt(pos)
|
|
codePointAt: function codePointAt(pos){
|
|
return $at(this, pos);
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.string-at":77}],168:[function(require,module,exports){
|
|
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
|
|
'use strict';
|
|
var $export = require('./$.export')
|
|
, toLength = require('./$.to-length')
|
|
, context = require('./$.string-context')
|
|
, ENDS_WITH = 'endsWith'
|
|
, $endsWith = ''[ENDS_WITH];
|
|
|
|
$export($export.P + $export.F * require('./$.fails-is-regexp')(ENDS_WITH), 'String', {
|
|
endsWith: function endsWith(searchString /*, endPosition = @length */){
|
|
var that = context(this, searchString, ENDS_WITH)
|
|
, $$ = arguments
|
|
, endPosition = $$.length > 1 ? $$[1] : undefined
|
|
, len = toLength(that.length)
|
|
, end = endPosition === undefined ? len : Math.min(toLength(endPosition), len)
|
|
, search = String(searchString);
|
|
return $endsWith
|
|
? $endsWith.call(that, search, end)
|
|
: that.slice(end - search.length, end) === search;
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.fails-is-regexp":30,"./$.string-context":78,"./$.to-length":86}],169:[function(require,module,exports){
|
|
var $export = require('./$.export')
|
|
, toIndex = require('./$.to-index')
|
|
, fromCharCode = String.fromCharCode
|
|
, $fromCodePoint = String.fromCodePoint;
|
|
|
|
// length should be 1, old FF problem
|
|
$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
|
|
// 21.1.2.2 String.fromCodePoint(...codePoints)
|
|
fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars
|
|
var res = []
|
|
, $$ = arguments
|
|
, $$len = $$.length
|
|
, i = 0
|
|
, code;
|
|
while($$len > i){
|
|
code = +$$[i++];
|
|
if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
|
|
res.push(code < 0x10000
|
|
? fromCharCode(code)
|
|
: fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
|
|
);
|
|
} return res.join('');
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.to-index":83}],170:[function(require,module,exports){
|
|
// 21.1.3.7 String.prototype.includes(searchString, position = 0)
|
|
'use strict';
|
|
var $export = require('./$.export')
|
|
, context = require('./$.string-context')
|
|
, INCLUDES = 'includes';
|
|
|
|
$export($export.P + $export.F * require('./$.fails-is-regexp')(INCLUDES), 'String', {
|
|
includes: function includes(searchString /*, position = 0 */){
|
|
return !!~context(this, searchString, INCLUDES)
|
|
.indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.fails-is-regexp":30,"./$.string-context":78}],171:[function(require,module,exports){
|
|
'use strict';
|
|
var $at = require('./$.string-at')(true);
|
|
|
|
// 21.1.3.27 String.prototype[@@iterator]()
|
|
require('./$.iter-define')(String, 'String', function(iterated){
|
|
this._t = String(iterated); // target
|
|
this._i = 0; // next index
|
|
// 21.1.5.2.1 %StringIteratorPrototype%.next()
|
|
}, function(){
|
|
var O = this._t
|
|
, index = this._i
|
|
, point;
|
|
if(index >= O.length)return {value: undefined, done: true};
|
|
point = $at(O, index);
|
|
this._i += point.length;
|
|
return {value: point, done: false};
|
|
});
|
|
},{"./$.iter-define":49,"./$.string-at":77}],172:[function(require,module,exports){
|
|
var $export = require('./$.export')
|
|
, toIObject = require('./$.to-iobject')
|
|
, toLength = require('./$.to-length');
|
|
|
|
$export($export.S, 'String', {
|
|
// 21.1.2.4 String.raw(callSite, ...substitutions)
|
|
raw: function raw(callSite){
|
|
var tpl = toIObject(callSite.raw)
|
|
, len = toLength(tpl.length)
|
|
, $$ = arguments
|
|
, $$len = $$.length
|
|
, res = []
|
|
, i = 0;
|
|
while(len > i){
|
|
res.push(String(tpl[i++]));
|
|
if(i < $$len)res.push(String($$[i]));
|
|
} return res.join('');
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.to-iobject":85,"./$.to-length":86}],173:[function(require,module,exports){
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.P, 'String', {
|
|
// 21.1.3.13 String.prototype.repeat(count)
|
|
repeat: require('./$.string-repeat')
|
|
});
|
|
},{"./$.export":29,"./$.string-repeat":80}],174:[function(require,module,exports){
|
|
// 21.1.3.18 String.prototype.startsWith(searchString [, position ])
|
|
'use strict';
|
|
var $export = require('./$.export')
|
|
, toLength = require('./$.to-length')
|
|
, context = require('./$.string-context')
|
|
, STARTS_WITH = 'startsWith'
|
|
, $startsWith = ''[STARTS_WITH];
|
|
|
|
$export($export.P + $export.F * require('./$.fails-is-regexp')(STARTS_WITH), 'String', {
|
|
startsWith: function startsWith(searchString /*, position = 0 */){
|
|
var that = context(this, searchString, STARTS_WITH)
|
|
, $$ = arguments
|
|
, index = toLength(Math.min($$.length > 1 ? $$[1] : undefined, that.length))
|
|
, search = String(searchString);
|
|
return $startsWith
|
|
? $startsWith.call(that, search, index)
|
|
: that.slice(index, index + search.length) === search;
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.fails-is-regexp":30,"./$.string-context":78,"./$.to-length":86}],175:[function(require,module,exports){
|
|
'use strict';
|
|
// 21.1.3.25 String.prototype.trim()
|
|
require('./$.string-trim')('trim', function($trim){
|
|
return function trim(){
|
|
return $trim(this, 3);
|
|
};
|
|
});
|
|
},{"./$.string-trim":81}],176:[function(require,module,exports){
|
|
'use strict';
|
|
// ECMAScript 6 symbols shim
|
|
var $ = require('./$')
|
|
, global = require('./$.global')
|
|
, has = require('./$.has')
|
|
, DESCRIPTORS = require('./$.descriptors')
|
|
, $export = require('./$.export')
|
|
, redefine = require('./$.redefine')
|
|
, $fails = require('./$.fails')
|
|
, shared = require('./$.shared')
|
|
, setToStringTag = require('./$.set-to-string-tag')
|
|
, uid = require('./$.uid')
|
|
, wks = require('./$.wks')
|
|
, keyOf = require('./$.keyof')
|
|
, $names = require('./$.get-names')
|
|
, enumKeys = require('./$.enum-keys')
|
|
, isArray = require('./$.is-array')
|
|
, anObject = require('./$.an-object')
|
|
, toIObject = require('./$.to-iobject')
|
|
, createDesc = require('./$.property-desc')
|
|
, getDesc = $.getDesc
|
|
, setDesc = $.setDesc
|
|
, _create = $.create
|
|
, getNames = $names.get
|
|
, $Symbol = global.Symbol
|
|
, $JSON = global.JSON
|
|
, _stringify = $JSON && $JSON.stringify
|
|
, setter = false
|
|
, HIDDEN = wks('_hidden')
|
|
, isEnum = $.isEnum
|
|
, SymbolRegistry = shared('symbol-registry')
|
|
, AllSymbols = shared('symbols')
|
|
, useNative = typeof $Symbol == 'function'
|
|
, ObjectProto = Object.prototype;
|
|
|
|
// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
|
|
var setSymbolDesc = DESCRIPTORS && $fails(function(){
|
|
return _create(setDesc({}, 'a', {
|
|
get: function(){ return setDesc(this, 'a', {value: 7}).a; }
|
|
})).a != 7;
|
|
}) ? function(it, key, D){
|
|
var protoDesc = getDesc(ObjectProto, key);
|
|
if(protoDesc)delete ObjectProto[key];
|
|
setDesc(it, key, D);
|
|
if(protoDesc && it !== ObjectProto)setDesc(ObjectProto, key, protoDesc);
|
|
} : setDesc;
|
|
|
|
var wrap = function(tag){
|
|
var sym = AllSymbols[tag] = _create($Symbol.prototype);
|
|
sym._k = tag;
|
|
DESCRIPTORS && setter && setSymbolDesc(ObjectProto, tag, {
|
|
configurable: true,
|
|
set: function(value){
|
|
if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
|
|
setSymbolDesc(this, tag, createDesc(1, value));
|
|
}
|
|
});
|
|
return sym;
|
|
};
|
|
|
|
var isSymbol = function(it){
|
|
return typeof it == 'symbol';
|
|
};
|
|
|
|
var $defineProperty = function defineProperty(it, key, D){
|
|
if(D && has(AllSymbols, key)){
|
|
if(!D.enumerable){
|
|
if(!has(it, HIDDEN))setDesc(it, HIDDEN, createDesc(1, {}));
|
|
it[HIDDEN][key] = true;
|
|
} else {
|
|
if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
|
|
D = _create(D, {enumerable: createDesc(0, false)});
|
|
} return setSymbolDesc(it, key, D);
|
|
} return setDesc(it, key, D);
|
|
};
|
|
var $defineProperties = function defineProperties(it, P){
|
|
anObject(it);
|
|
var keys = enumKeys(P = toIObject(P))
|
|
, i = 0
|
|
, l = keys.length
|
|
, key;
|
|
while(l > i)$defineProperty(it, key = keys[i++], P[key]);
|
|
return it;
|
|
};
|
|
var $create = function create(it, P){
|
|
return P === undefined ? _create(it) : $defineProperties(_create(it), P);
|
|
};
|
|
var $propertyIsEnumerable = function propertyIsEnumerable(key){
|
|
var E = isEnum.call(this, key);
|
|
return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key]
|
|
? E : true;
|
|
};
|
|
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){
|
|
var D = getDesc(it = toIObject(it), key);
|
|
if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
|
|
return D;
|
|
};
|
|
var $getOwnPropertyNames = function getOwnPropertyNames(it){
|
|
var names = getNames(toIObject(it))
|
|
, result = []
|
|
, i = 0
|
|
, key;
|
|
while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key);
|
|
return result;
|
|
};
|
|
var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
|
|
var names = getNames(toIObject(it))
|
|
, result = []
|
|
, i = 0
|
|
, key;
|
|
while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]);
|
|
return result;
|
|
};
|
|
var $stringify = function stringify(it){
|
|
if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
|
|
var args = [it]
|
|
, i = 1
|
|
, $$ = arguments
|
|
, replacer, $replacer;
|
|
while($$.length > i)args.push($$[i++]);
|
|
replacer = args[1];
|
|
if(typeof replacer == 'function')$replacer = replacer;
|
|
if($replacer || !isArray(replacer))replacer = function(key, value){
|
|
if($replacer)value = $replacer.call(this, key, value);
|
|
if(!isSymbol(value))return value;
|
|
};
|
|
args[1] = replacer;
|
|
return _stringify.apply($JSON, args);
|
|
};
|
|
var buggyJSON = $fails(function(){
|
|
var S = $Symbol();
|
|
// MS Edge converts symbol values to JSON as {}
|
|
// WebKit converts symbol values to JSON as null
|
|
// V8 throws on boxed symbols
|
|
return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
|
|
});
|
|
|
|
// 19.4.1.1 Symbol([description])
|
|
if(!useNative){
|
|
$Symbol = function Symbol(){
|
|
if(isSymbol(this))throw TypeError('Symbol is not a constructor');
|
|
return wrap(uid(arguments.length > 0 ? arguments[0] : undefined));
|
|
};
|
|
redefine($Symbol.prototype, 'toString', function toString(){
|
|
return this._k;
|
|
});
|
|
|
|
isSymbol = function(it){
|
|
return it instanceof $Symbol;
|
|
};
|
|
|
|
$.create = $create;
|
|
$.isEnum = $propertyIsEnumerable;
|
|
$.getDesc = $getOwnPropertyDescriptor;
|
|
$.setDesc = $defineProperty;
|
|
$.setDescs = $defineProperties;
|
|
$.getNames = $names.get = $getOwnPropertyNames;
|
|
$.getSymbols = $getOwnPropertySymbols;
|
|
|
|
if(DESCRIPTORS && !require('./$.library')){
|
|
redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
|
|
}
|
|
}
|
|
|
|
var symbolStatics = {
|
|
// 19.4.2.1 Symbol.for(key)
|
|
'for': function(key){
|
|
return has(SymbolRegistry, key += '')
|
|
? SymbolRegistry[key]
|
|
: SymbolRegistry[key] = $Symbol(key);
|
|
},
|
|
// 19.4.2.5 Symbol.keyFor(sym)
|
|
keyFor: function keyFor(key){
|
|
return keyOf(SymbolRegistry, key);
|
|
},
|
|
useSetter: function(){ setter = true; },
|
|
useSimple: function(){ setter = false; }
|
|
};
|
|
// 19.4.2.2 Symbol.hasInstance
|
|
// 19.4.2.3 Symbol.isConcatSpreadable
|
|
// 19.4.2.4 Symbol.iterator
|
|
// 19.4.2.6 Symbol.match
|
|
// 19.4.2.8 Symbol.replace
|
|
// 19.4.2.9 Symbol.search
|
|
// 19.4.2.10 Symbol.species
|
|
// 19.4.2.11 Symbol.split
|
|
// 19.4.2.12 Symbol.toPrimitive
|
|
// 19.4.2.13 Symbol.toStringTag
|
|
// 19.4.2.14 Symbol.unscopables
|
|
$.each.call((
|
|
'hasInstance,isConcatSpreadable,iterator,match,replace,search,' +
|
|
'species,split,toPrimitive,toStringTag,unscopables'
|
|
).split(','), function(it){
|
|
var sym = wks(it);
|
|
symbolStatics[it] = useNative ? sym : wrap(sym);
|
|
});
|
|
|
|
setter = true;
|
|
|
|
$export($export.G + $export.W, {Symbol: $Symbol});
|
|
|
|
$export($export.S, 'Symbol', symbolStatics);
|
|
|
|
$export($export.S + $export.F * !useNative, 'Object', {
|
|
// 19.1.2.2 Object.create(O [, Properties])
|
|
create: $create,
|
|
// 19.1.2.4 Object.defineProperty(O, P, Attributes)
|
|
defineProperty: $defineProperty,
|
|
// 19.1.2.3 Object.defineProperties(O, Properties)
|
|
defineProperties: $defineProperties,
|
|
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
|
|
getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
|
|
// 19.1.2.7 Object.getOwnPropertyNames(O)
|
|
getOwnPropertyNames: $getOwnPropertyNames,
|
|
// 19.1.2.8 Object.getOwnPropertySymbols(O)
|
|
getOwnPropertySymbols: $getOwnPropertySymbols
|
|
});
|
|
|
|
// 24.3.2 JSON.stringify(value [, replacer [, space]])
|
|
$JSON && $export($export.S + $export.F * (!useNative || buggyJSON), 'JSON', {stringify: $stringify});
|
|
|
|
// 19.4.3.5 Symbol.prototype[@@toStringTag]
|
|
setToStringTag($Symbol, 'Symbol');
|
|
// 20.2.1.9 Math[@@toStringTag]
|
|
setToStringTag(Math, 'Math', true);
|
|
// 24.3.3 JSON[@@toStringTag]
|
|
setToStringTag(global.JSON, 'JSON', true);
|
|
},{"./$":53,"./$.an-object":11,"./$.descriptors":26,"./$.enum-keys":28,"./$.export":29,"./$.fails":31,"./$.get-names":35,"./$.global":36,"./$.has":37,"./$.is-array":43,"./$.keyof":54,"./$.library":55,"./$.property-desc":66,"./$.redefine":68,"./$.set-to-string-tag":73,"./$.shared":74,"./$.to-iobject":85,"./$.uid":89,"./$.wks":90}],177:[function(require,module,exports){
|
|
'use strict';
|
|
var $ = require('./$')
|
|
, redefine = require('./$.redefine')
|
|
, weak = require('./$.collection-weak')
|
|
, isObject = require('./$.is-object')
|
|
, has = require('./$.has')
|
|
, frozenStore = weak.frozenStore
|
|
, WEAK = weak.WEAK
|
|
, isExtensible = Object.isExtensible || isObject
|
|
, tmp = {};
|
|
|
|
// 23.3 WeakMap Objects
|
|
var $WeakMap = require('./$.collection')('WeakMap', function(get){
|
|
return function WeakMap(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
|
|
}, {
|
|
// 23.3.3.3 WeakMap.prototype.get(key)
|
|
get: function get(key){
|
|
if(isObject(key)){
|
|
if(!isExtensible(key))return frozenStore(this).get(key);
|
|
if(has(key, WEAK))return key[WEAK][this._i];
|
|
}
|
|
},
|
|
// 23.3.3.5 WeakMap.prototype.set(key, value)
|
|
set: function set(key, value){
|
|
return weak.def(this, key, value);
|
|
}
|
|
}, weak, true, true);
|
|
|
|
// IE11 WeakMap frozen keys fix
|
|
if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
|
|
$.each.call(['delete', 'has', 'get', 'set'], function(key){
|
|
var proto = $WeakMap.prototype
|
|
, method = proto[key];
|
|
redefine(proto, key, function(a, b){
|
|
// store frozen objects on leaky map
|
|
if(isObject(a) && !isExtensible(a)){
|
|
var result = frozenStore(this)[key](a, b);
|
|
return key == 'set' ? this : result;
|
|
// store all the rest on native weakmap
|
|
} return method.call(this, a, b);
|
|
});
|
|
});
|
|
}
|
|
},{"./$":53,"./$.collection":22,"./$.collection-weak":21,"./$.has":37,"./$.is-object":45,"./$.redefine":68}],178:[function(require,module,exports){
|
|
'use strict';
|
|
var weak = require('./$.collection-weak');
|
|
|
|
// 23.4 WeakSet Objects
|
|
require('./$.collection')('WeakSet', function(get){
|
|
return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
|
|
}, {
|
|
// 23.4.3.1 WeakSet.prototype.add(value)
|
|
add: function add(value){
|
|
return weak.def(this, value, true);
|
|
}
|
|
}, weak, false, true);
|
|
},{"./$.collection":22,"./$.collection-weak":21}],179:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./$.export')
|
|
, $includes = require('./$.array-includes')(true);
|
|
|
|
$export($export.P, 'Array', {
|
|
// https://github.com/domenic/Array.prototype.includes
|
|
includes: function includes(el /*, fromIndex = 0 */){
|
|
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
}
|
|
});
|
|
|
|
require('./$.add-to-unscopables')('includes');
|
|
},{"./$.add-to-unscopables":10,"./$.array-includes":14,"./$.export":29}],180:[function(require,module,exports){
|
|
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.P, 'Map', {toJSON: require('./$.collection-to-json')('Map')});
|
|
},{"./$.collection-to-json":20,"./$.export":29}],181:[function(require,module,exports){
|
|
// http://goo.gl/XkBrjD
|
|
var $export = require('./$.export')
|
|
, $entries = require('./$.object-to-array')(true);
|
|
|
|
$export($export.S, 'Object', {
|
|
entries: function entries(it){
|
|
return $entries(it);
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.object-to-array":62}],182:[function(require,module,exports){
|
|
// https://gist.github.com/WebReflection/9353781
|
|
var $ = require('./$')
|
|
, $export = require('./$.export')
|
|
, ownKeys = require('./$.own-keys')
|
|
, toIObject = require('./$.to-iobject')
|
|
, createDesc = require('./$.property-desc');
|
|
|
|
$export($export.S, 'Object', {
|
|
getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){
|
|
var O = toIObject(object)
|
|
, setDesc = $.setDesc
|
|
, getDesc = $.getDesc
|
|
, keys = ownKeys(O)
|
|
, result = {}
|
|
, i = 0
|
|
, key, D;
|
|
while(keys.length > i){
|
|
D = getDesc(O, key = keys[i++]);
|
|
if(key in result)setDesc(result, key, createDesc(0, D));
|
|
else result[key] = D;
|
|
} return result;
|
|
}
|
|
});
|
|
},{"./$":53,"./$.export":29,"./$.own-keys":63,"./$.property-desc":66,"./$.to-iobject":85}],183:[function(require,module,exports){
|
|
// http://goo.gl/XkBrjD
|
|
var $export = require('./$.export')
|
|
, $values = require('./$.object-to-array')(false);
|
|
|
|
$export($export.S, 'Object', {
|
|
values: function values(it){
|
|
return $values(it);
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.object-to-array":62}],184:[function(require,module,exports){
|
|
// https://github.com/benjamingr/RexExp.escape
|
|
var $export = require('./$.export')
|
|
, $re = require('./$.replacer')(/[\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
|
|
$export($export.S, 'RegExp', {escape: function escape(it){ return $re(it); }});
|
|
|
|
},{"./$.export":29,"./$.replacer":69}],185:[function(require,module,exports){
|
|
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
|
|
var $export = require('./$.export');
|
|
|
|
$export($export.P, 'Set', {toJSON: require('./$.collection-to-json')('Set')});
|
|
},{"./$.collection-to-json":20,"./$.export":29}],186:[function(require,module,exports){
|
|
'use strict';
|
|
// https://github.com/mathiasbynens/String.prototype.at
|
|
var $export = require('./$.export')
|
|
, $at = require('./$.string-at')(true);
|
|
|
|
$export($export.P, 'String', {
|
|
at: function at(pos){
|
|
return $at(this, pos);
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.string-at":77}],187:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./$.export')
|
|
, $pad = require('./$.string-pad');
|
|
|
|
$export($export.P, 'String', {
|
|
padLeft: function padLeft(maxLength /*, fillString = ' ' */){
|
|
return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.string-pad":79}],188:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./$.export')
|
|
, $pad = require('./$.string-pad');
|
|
|
|
$export($export.P, 'String', {
|
|
padRight: function padRight(maxLength /*, fillString = ' ' */){
|
|
return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
|
|
}
|
|
});
|
|
},{"./$.export":29,"./$.string-pad":79}],189:[function(require,module,exports){
|
|
'use strict';
|
|
// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
|
|
require('./$.string-trim')('trimLeft', function($trim){
|
|
return function trimLeft(){
|
|
return $trim(this, 1);
|
|
};
|
|
});
|
|
},{"./$.string-trim":81}],190:[function(require,module,exports){
|
|
'use strict';
|
|
// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
|
|
require('./$.string-trim')('trimRight', function($trim){
|
|
return function trimRight(){
|
|
return $trim(this, 2);
|
|
};
|
|
});
|
|
},{"./$.string-trim":81}],191:[function(require,module,exports){
|
|
// JavaScript 1.6 / Strawman array statics shim
|
|
var $ = require('./$')
|
|
, $export = require('./$.export')
|
|
, $ctx = require('./$.ctx')
|
|
, $Array = require('./$.core').Array || Array
|
|
, statics = {};
|
|
var setStatics = function(keys, length){
|
|
$.each.call(keys.split(','), function(key){
|
|
if(length == undefined && key in $Array)statics[key] = $Array[key];
|
|
else if(key in [])statics[key] = $ctx(Function.call, [][key], length);
|
|
});
|
|
};
|
|
setStatics('pop,reverse,shift,keys,values,entries', 1);
|
|
setStatics('indexOf,every,some,forEach,map,filter,find,findIndex,includes', 3);
|
|
setStatics('join,slice,concat,push,splice,unshift,sort,lastIndexOf,' +
|
|
'reduce,reduceRight,copyWithin,fill');
|
|
$export($export.S, 'Array', statics);
|
|
},{"./$":53,"./$.core":23,"./$.ctx":24,"./$.export":29}],192:[function(require,module,exports){
|
|
require('./es6.array.iterator');
|
|
var global = require('./$.global')
|
|
, hide = require('./$.hide')
|
|
, Iterators = require('./$.iterators')
|
|
, ITERATOR = require('./$.wks')('iterator')
|
|
, NL = global.NodeList
|
|
, HTC = global.HTMLCollection
|
|
, NLProto = NL && NL.prototype
|
|
, HTCProto = HTC && HTC.prototype
|
|
, ArrayValues = Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array;
|
|
if(NLProto && !NLProto[ITERATOR])hide(NLProto, ITERATOR, ArrayValues);
|
|
if(HTCProto && !HTCProto[ITERATOR])hide(HTCProto, ITERATOR, ArrayValues);
|
|
},{"./$.global":36,"./$.hide":38,"./$.iterators":52,"./$.wks":90,"./es6.array.iterator":98}],193:[function(require,module,exports){
|
|
var $export = require('./$.export')
|
|
, $task = require('./$.task');
|
|
$export($export.G + $export.B, {
|
|
setImmediate: $task.set,
|
|
clearImmediate: $task.clear
|
|
});
|
|
},{"./$.export":29,"./$.task":82}],194:[function(require,module,exports){
|
|
// ie9- setTimeout & setInterval additional parameters fix
|
|
var global = require('./$.global')
|
|
, $export = require('./$.export')
|
|
, invoke = require('./$.invoke')
|
|
, partial = require('./$.partial')
|
|
, navigator = global.navigator
|
|
, MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check
|
|
var wrap = function(set){
|
|
return MSIE ? function(fn, time /*, ...args */){
|
|
return set(invoke(
|
|
partial,
|
|
[].slice.call(arguments, 2),
|
|
typeof fn == 'function' ? fn : Function(fn)
|
|
), time);
|
|
} : set;
|
|
};
|
|
$export($export.G + $export.B + $export.F * MSIE, {
|
|
setTimeout: wrap(global.setTimeout),
|
|
setInterval: wrap(global.setInterval)
|
|
});
|
|
},{"./$.export":29,"./$.global":36,"./$.invoke":40,"./$.partial":64}],195:[function(require,module,exports){
|
|
require('./modules/es5');
|
|
require('./modules/es6.symbol');
|
|
require('./modules/es6.object.assign');
|
|
require('./modules/es6.object.is');
|
|
require('./modules/es6.object.set-prototype-of');
|
|
require('./modules/es6.object.to-string');
|
|
require('./modules/es6.object.freeze');
|
|
require('./modules/es6.object.seal');
|
|
require('./modules/es6.object.prevent-extensions');
|
|
require('./modules/es6.object.is-frozen');
|
|
require('./modules/es6.object.is-sealed');
|
|
require('./modules/es6.object.is-extensible');
|
|
require('./modules/es6.object.get-own-property-descriptor');
|
|
require('./modules/es6.object.get-prototype-of');
|
|
require('./modules/es6.object.keys');
|
|
require('./modules/es6.object.get-own-property-names');
|
|
require('./modules/es6.function.name');
|
|
require('./modules/es6.function.has-instance');
|
|
require('./modules/es6.number.constructor');
|
|
require('./modules/es6.number.epsilon');
|
|
require('./modules/es6.number.is-finite');
|
|
require('./modules/es6.number.is-integer');
|
|
require('./modules/es6.number.is-nan');
|
|
require('./modules/es6.number.is-safe-integer');
|
|
require('./modules/es6.number.max-safe-integer');
|
|
require('./modules/es6.number.min-safe-integer');
|
|
require('./modules/es6.number.parse-float');
|
|
require('./modules/es6.number.parse-int');
|
|
require('./modules/es6.math.acosh');
|
|
require('./modules/es6.math.asinh');
|
|
require('./modules/es6.math.atanh');
|
|
require('./modules/es6.math.cbrt');
|
|
require('./modules/es6.math.clz32');
|
|
require('./modules/es6.math.cosh');
|
|
require('./modules/es6.math.expm1');
|
|
require('./modules/es6.math.fround');
|
|
require('./modules/es6.math.hypot');
|
|
require('./modules/es6.math.imul');
|
|
require('./modules/es6.math.log10');
|
|
require('./modules/es6.math.log1p');
|
|
require('./modules/es6.math.log2');
|
|
require('./modules/es6.math.sign');
|
|
require('./modules/es6.math.sinh');
|
|
require('./modules/es6.math.tanh');
|
|
require('./modules/es6.math.trunc');
|
|
require('./modules/es6.string.from-code-point');
|
|
require('./modules/es6.string.raw');
|
|
require('./modules/es6.string.trim');
|
|
require('./modules/es6.string.iterator');
|
|
require('./modules/es6.string.code-point-at');
|
|
require('./modules/es6.string.ends-with');
|
|
require('./modules/es6.string.includes');
|
|
require('./modules/es6.string.repeat');
|
|
require('./modules/es6.string.starts-with');
|
|
require('./modules/es6.array.from');
|
|
require('./modules/es6.array.of');
|
|
require('./modules/es6.array.iterator');
|
|
require('./modules/es6.array.species');
|
|
require('./modules/es6.array.copy-within');
|
|
require('./modules/es6.array.fill');
|
|
require('./modules/es6.array.find');
|
|
require('./modules/es6.array.find-index');
|
|
require('./modules/es6.regexp.constructor');
|
|
require('./modules/es6.regexp.flags');
|
|
require('./modules/es6.regexp.match');
|
|
require('./modules/es6.regexp.replace');
|
|
require('./modules/es6.regexp.search');
|
|
require('./modules/es6.regexp.split');
|
|
require('./modules/es6.promise');
|
|
require('./modules/es6.map');
|
|
require('./modules/es6.set');
|
|
require('./modules/es6.weak-map');
|
|
require('./modules/es6.weak-set');
|
|
require('./modules/es6.reflect.apply');
|
|
require('./modules/es6.reflect.construct');
|
|
require('./modules/es6.reflect.define-property');
|
|
require('./modules/es6.reflect.delete-property');
|
|
require('./modules/es6.reflect.enumerate');
|
|
require('./modules/es6.reflect.get');
|
|
require('./modules/es6.reflect.get-own-property-descriptor');
|
|
require('./modules/es6.reflect.get-prototype-of');
|
|
require('./modules/es6.reflect.has');
|
|
require('./modules/es6.reflect.is-extensible');
|
|
require('./modules/es6.reflect.own-keys');
|
|
require('./modules/es6.reflect.prevent-extensions');
|
|
require('./modules/es6.reflect.set');
|
|
require('./modules/es6.reflect.set-prototype-of');
|
|
require('./modules/es7.array.includes');
|
|
require('./modules/es7.string.at');
|
|
require('./modules/es7.string.pad-left');
|
|
require('./modules/es7.string.pad-right');
|
|
require('./modules/es7.string.trim-left');
|
|
require('./modules/es7.string.trim-right');
|
|
require('./modules/es7.regexp.escape');
|
|
require('./modules/es7.object.get-own-property-descriptors');
|
|
require('./modules/es7.object.values');
|
|
require('./modules/es7.object.entries');
|
|
require('./modules/es7.map.to-json');
|
|
require('./modules/es7.set.to-json');
|
|
require('./modules/js.array.statics');
|
|
require('./modules/web.timers');
|
|
require('./modules/web.immediate');
|
|
require('./modules/web.dom.iterable');
|
|
module.exports = require('./modules/$.core');
|
|
},{"./modules/$.core":23,"./modules/es5":92,"./modules/es6.array.copy-within":93,"./modules/es6.array.fill":94,"./modules/es6.array.find":96,"./modules/es6.array.find-index":95,"./modules/es6.array.from":97,"./modules/es6.array.iterator":98,"./modules/es6.array.of":99,"./modules/es6.array.species":100,"./modules/es6.function.has-instance":101,"./modules/es6.function.name":102,"./modules/es6.map":103,"./modules/es6.math.acosh":104,"./modules/es6.math.asinh":105,"./modules/es6.math.atanh":106,"./modules/es6.math.cbrt":107,"./modules/es6.math.clz32":108,"./modules/es6.math.cosh":109,"./modules/es6.math.expm1":110,"./modules/es6.math.fround":111,"./modules/es6.math.hypot":112,"./modules/es6.math.imul":113,"./modules/es6.math.log10":114,"./modules/es6.math.log1p":115,"./modules/es6.math.log2":116,"./modules/es6.math.sign":117,"./modules/es6.math.sinh":118,"./modules/es6.math.tanh":119,"./modules/es6.math.trunc":120,"./modules/es6.number.constructor":121,"./modules/es6.number.epsilon":122,"./modules/es6.number.is-finite":123,"./modules/es6.number.is-integer":124,"./modules/es6.number.is-nan":125,"./modules/es6.number.is-safe-integer":126,"./modules/es6.number.max-safe-integer":127,"./modules/es6.number.min-safe-integer":128,"./modules/es6.number.parse-float":129,"./modules/es6.number.parse-int":130,"./modules/es6.object.assign":131,"./modules/es6.object.freeze":132,"./modules/es6.object.get-own-property-descriptor":133,"./modules/es6.object.get-own-property-names":134,"./modules/es6.object.get-prototype-of":135,"./modules/es6.object.is":139,"./modules/es6.object.is-extensible":136,"./modules/es6.object.is-frozen":137,"./modules/es6.object.is-sealed":138,"./modules/es6.object.keys":140,"./modules/es6.object.prevent-extensions":141,"./modules/es6.object.seal":142,"./modules/es6.object.set-prototype-of":143,"./modules/es6.object.to-string":144,"./modules/es6.promise":145,"./modules/es6.reflect.apply":146,"./modules/es6.reflect.construct":147,"./modules/es6.reflect.define-property":148,"./modules/es6.reflect.delete-property":149,"./modules/es6.reflect.enumerate":150,"./modules/es6.reflect.get":153,"./modules/es6.reflect.get-own-property-descriptor":151,"./modules/es6.reflect.get-prototype-of":152,"./modules/es6.reflect.has":154,"./modules/es6.reflect.is-extensible":155,"./modules/es6.reflect.own-keys":156,"./modules/es6.reflect.prevent-extensions":157,"./modules/es6.reflect.set":159,"./modules/es6.reflect.set-prototype-of":158,"./modules/es6.regexp.constructor":160,"./modules/es6.regexp.flags":161,"./modules/es6.regexp.match":162,"./modules/es6.regexp.replace":163,"./modules/es6.regexp.search":164,"./modules/es6.regexp.split":165,"./modules/es6.set":166,"./modules/es6.string.code-point-at":167,"./modules/es6.string.ends-with":168,"./modules/es6.string.from-code-point":169,"./modules/es6.string.includes":170,"./modules/es6.string.iterator":171,"./modules/es6.string.raw":172,"./modules/es6.string.repeat":173,"./modules/es6.string.starts-with":174,"./modules/es6.string.trim":175,"./modules/es6.symbol":176,"./modules/es6.weak-map":177,"./modules/es6.weak-set":178,"./modules/es7.array.includes":179,"./modules/es7.map.to-json":180,"./modules/es7.object.entries":181,"./modules/es7.object.get-own-property-descriptors":182,"./modules/es7.object.values":183,"./modules/es7.regexp.escape":184,"./modules/es7.set.to-json":185,"./modules/es7.string.at":186,"./modules/es7.string.pad-left":187,"./modules/es7.string.pad-right":188,"./modules/es7.string.trim-left":189,"./modules/es7.string.trim-right":190,"./modules/js.array.statics":191,"./modules/web.dom.iterable":192,"./modules/web.immediate":193,"./modules/web.timers":194}],196:[function(require,module,exports){
|
|
// shim for using process in browser
|
|
var process = module.exports = {};
|
|
|
|
// cached from whatever global is present so that test runners that stub it
|
|
// don't break things. But we need to wrap it in a try catch in case it is
|
|
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
|
// function because try/catches deoptimize in certain engines.
|
|
|
|
var cachedSetTimeout;
|
|
var cachedClearTimeout;
|
|
|
|
function defaultSetTimout() {
|
|
throw new Error('setTimeout has not been defined');
|
|
}
|
|
function defaultClearTimeout () {
|
|
throw new Error('clearTimeout has not been defined');
|
|
}
|
|
(function () {
|
|
try {
|
|
if (typeof setTimeout === 'function') {
|
|
cachedSetTimeout = setTimeout;
|
|
} else {
|
|
cachedSetTimeout = defaultSetTimout;
|
|
}
|
|
} catch (e) {
|
|
cachedSetTimeout = defaultSetTimout;
|
|
}
|
|
try {
|
|
if (typeof clearTimeout === 'function') {
|
|
cachedClearTimeout = clearTimeout;
|
|
} else {
|
|
cachedClearTimeout = defaultClearTimeout;
|
|
}
|
|
} catch (e) {
|
|
cachedClearTimeout = defaultClearTimeout;
|
|
}
|
|
} ())
|
|
function runTimeout(fun) {
|
|
if (cachedSetTimeout === setTimeout) {
|
|
//normal enviroments in sane situations
|
|
return setTimeout(fun, 0);
|
|
}
|
|
// if setTimeout wasn't available but was latter defined
|
|
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
cachedSetTimeout = setTimeout;
|
|
return setTimeout(fun, 0);
|
|
}
|
|
try {
|
|
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
return cachedSetTimeout(fun, 0);
|
|
} catch(e){
|
|
try {
|
|
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
return cachedSetTimeout.call(null, fun, 0);
|
|
} catch(e){
|
|
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
return cachedSetTimeout.call(this, fun, 0);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
function runClearTimeout(marker) {
|
|
if (cachedClearTimeout === clearTimeout) {
|
|
//normal enviroments in sane situations
|
|
return clearTimeout(marker);
|
|
}
|
|
// if clearTimeout wasn't available but was latter defined
|
|
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
cachedClearTimeout = clearTimeout;
|
|
return clearTimeout(marker);
|
|
}
|
|
try {
|
|
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
return cachedClearTimeout(marker);
|
|
} catch (e){
|
|
try {
|
|
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
return cachedClearTimeout.call(null, marker);
|
|
} catch (e){
|
|
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
return cachedClearTimeout.call(this, marker);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
var queue = [];
|
|
var draining = false;
|
|
var currentQueue;
|
|
var queueIndex = -1;
|
|
|
|
function cleanUpNextTick() {
|
|
if (!draining || !currentQueue) {
|
|
return;
|
|
}
|
|
draining = false;
|
|
if (currentQueue.length) {
|
|
queue = currentQueue.concat(queue);
|
|
} else {
|
|
queueIndex = -1;
|
|
}
|
|
if (queue.length) {
|
|
drainQueue();
|
|
}
|
|
}
|
|
|
|
function drainQueue() {
|
|
if (draining) {
|
|
return;
|
|
}
|
|
var timeout = runTimeout(cleanUpNextTick);
|
|
draining = true;
|
|
|
|
var len = queue.length;
|
|
while(len) {
|
|
currentQueue = queue;
|
|
queue = [];
|
|
while (++queueIndex < len) {
|
|
if (currentQueue) {
|
|
currentQueue[queueIndex].run();
|
|
}
|
|
}
|
|
queueIndex = -1;
|
|
len = queue.length;
|
|
}
|
|
currentQueue = null;
|
|
draining = false;
|
|
runClearTimeout(timeout);
|
|
}
|
|
|
|
process.nextTick = function (fun) {
|
|
var args = new Array(arguments.length - 1);
|
|
if (arguments.length > 1) {
|
|
for (var i = 1; i < arguments.length; i++) {
|
|
args[i - 1] = arguments[i];
|
|
}
|
|
}
|
|
queue.push(new Item(fun, args));
|
|
if (queue.length === 1 && !draining) {
|
|
runTimeout(drainQueue);
|
|
}
|
|
};
|
|
|
|
// v8 likes predictible objects
|
|
function Item(fun, array) {
|
|
this.fun = fun;
|
|
this.array = array;
|
|
}
|
|
Item.prototype.run = function () {
|
|
this.fun.apply(null, this.array);
|
|
};
|
|
process.title = 'browser';
|
|
process.browser = true;
|
|
process.env = {};
|
|
process.argv = [];
|
|
process.version = ''; // empty string to avoid regexp issues
|
|
process.versions = {};
|
|
|
|
function noop() {}
|
|
|
|
process.on = noop;
|
|
process.addListener = noop;
|
|
process.once = noop;
|
|
process.off = noop;
|
|
process.removeListener = noop;
|
|
process.removeAllListeners = noop;
|
|
process.emit = noop;
|
|
process.prependListener = noop;
|
|
process.prependOnceListener = noop;
|
|
|
|
process.listeners = function (name) { return [] }
|
|
|
|
process.binding = function (name) {
|
|
throw new Error('process.binding is not supported');
|
|
};
|
|
|
|
process.cwd = function () { return '/' };
|
|
process.chdir = function (dir) {
|
|
throw new Error('process.chdir is not supported');
|
|
};
|
|
process.umask = function() { return 0; };
|
|
|
|
},{}],197:[function(require,module,exports){
|
|
(function (process,global){
|
|
/**
|
|
* Copyright (c) 2014, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* https://raw.github.com/facebook/regenerator/master/LICENSE file. An
|
|
* additional grant of patent rights can be found in the PATENTS file in
|
|
* the same directory.
|
|
*/
|
|
|
|
!(function(global) {
|
|
"use strict";
|
|
|
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
var undefined; // More compressible than void 0.
|
|
var iteratorSymbol =
|
|
typeof Symbol === "function" && Symbol.iterator || "@@iterator";
|
|
|
|
var inModule = typeof module === "object";
|
|
var runtime = global.regeneratorRuntime;
|
|
if (runtime) {
|
|
if (inModule) {
|
|
// If regeneratorRuntime is defined globally and we're in a module,
|
|
// make the exports object identical to regeneratorRuntime.
|
|
module.exports = runtime;
|
|
}
|
|
// Don't bother evaluating the rest of this file if the runtime was
|
|
// already defined globally.
|
|
return;
|
|
}
|
|
|
|
// Define the runtime globally (as expected by generated code) as either
|
|
// module.exports (if we're in a module) or a new, empty object.
|
|
runtime = global.regeneratorRuntime = inModule ? module.exports : {};
|
|
|
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
// If outerFn provided, then outerFn.prototype instanceof Generator.
|
|
var generator = Object.create((outerFn || Generator).prototype);
|
|
var context = new Context(tryLocsList || []);
|
|
|
|
// The ._invoke method unifies the implementations of the .next,
|
|
// .throw, and .return methods.
|
|
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
|
|
return generator;
|
|
}
|
|
runtime.wrap = wrap;
|
|
|
|
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
// record like context.tryEntries[i].completion. This interface could
|
|
// have been (and was previously) designed to take a closure to be
|
|
// invoked without arguments, but in all the cases we care about we
|
|
// already have an existing method we want to call, so there's no need
|
|
// to create a new function object. We can even get away with assuming
|
|
// the method takes exactly one argument, since that happens to be true
|
|
// in every case, so we don't have to touch the arguments object. The
|
|
// only additional allocation required is the completion record, which
|
|
// has a stable shape and so hopefully should be cheap to allocate.
|
|
function tryCatch(fn, obj, arg) {
|
|
try {
|
|
return { type: "normal", arg: fn.call(obj, arg) };
|
|
} catch (err) {
|
|
return { type: "throw", arg: err };
|
|
}
|
|
}
|
|
|
|
var GenStateSuspendedStart = "suspendedStart";
|
|
var GenStateSuspendedYield = "suspendedYield";
|
|
var GenStateExecuting = "executing";
|
|
var GenStateCompleted = "completed";
|
|
|
|
// Returning this object from the innerFn has the same effect as
|
|
// breaking out of the dispatch switch statement.
|
|
var ContinueSentinel = {};
|
|
|
|
// Dummy constructor functions that we use as the .constructor and
|
|
// .constructor.prototype properties for functions that return Generator
|
|
// objects. For full spec compliance, you may wish to configure your
|
|
// minifier not to mangle the names of these two functions.
|
|
function Generator() {}
|
|
function GeneratorFunction() {}
|
|
function GeneratorFunctionPrototype() {}
|
|
|
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype;
|
|
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
|
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
|
GeneratorFunction.displayName = "GeneratorFunction";
|
|
|
|
// Helper for defining the .next, .throw, and .return methods of the
|
|
// Iterator interface in terms of a single ._invoke method.
|
|
function defineIteratorMethods(prototype) {
|
|
["next", "throw", "return"].forEach(function(method) {
|
|
prototype[method] = function(arg) {
|
|
return this._invoke(method, arg);
|
|
};
|
|
});
|
|
}
|
|
|
|
runtime.isGeneratorFunction = function(genFun) {
|
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
return ctor
|
|
? ctor === GeneratorFunction ||
|
|
// For the native GeneratorFunction constructor, the best we can
|
|
// do is to check its .name property.
|
|
(ctor.displayName || ctor.name) === "GeneratorFunction"
|
|
: false;
|
|
};
|
|
|
|
runtime.mark = function(genFun) {
|
|
if (Object.setPrototypeOf) {
|
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
} else {
|
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
}
|
|
genFun.prototype = Object.create(Gp);
|
|
return genFun;
|
|
};
|
|
|
|
// Within the body of any async function, `await x` is transformed to
|
|
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
// `value instanceof AwaitArgument` to determine if the yielded value is
|
|
// meant to be awaited. Some may consider the name of this method too
|
|
// cutesy, but they are curmudgeons.
|
|
runtime.awrap = function(arg) {
|
|
return new AwaitArgument(arg);
|
|
};
|
|
|
|
function AwaitArgument(arg) {
|
|
this.arg = arg;
|
|
}
|
|
|
|
function AsyncIterator(generator) {
|
|
// This invoke function is written in a style that assumes some
|
|
// calling function (or Promise) will handle exceptions.
|
|
function invoke(method, arg) {
|
|
var result = generator[method](arg);
|
|
var value = result.value;
|
|
return value instanceof AwaitArgument
|
|
? Promise.resolve(value.arg).then(invokeNext, invokeThrow)
|
|
: Promise.resolve(value).then(function(unwrapped) {
|
|
// When a yielded Promise is resolved, its final value becomes
|
|
// the .value of the Promise<{value,done}> result for the
|
|
// current iteration. If the Promise is rejected, however, the
|
|
// result for this iteration will be rejected with the same
|
|
// reason. Note that rejections of yielded Promises are not
|
|
// thrown back into the generator function, as is the case
|
|
// when an awaited Promise is rejected. This difference in
|
|
// behavior between yield and await is important, because it
|
|
// allows the consumer to decide what to do with the yielded
|
|
// rejection (swallow it and continue, manually .throw it back
|
|
// into the generator, abandon iteration, whatever). With
|
|
// await, by contrast, there is no opportunity to examine the
|
|
// rejection reason outside the generator function, so the
|
|
// only option is to throw it from the await expression, and
|
|
// let the generator function handle the exception.
|
|
result.value = unwrapped;
|
|
return result;
|
|
});
|
|
}
|
|
|
|
if (typeof process === "object" && process.domain) {
|
|
invoke = process.domain.bind(invoke);
|
|
}
|
|
|
|
var invokeNext = invoke.bind(generator, "next");
|
|
var invokeThrow = invoke.bind(generator, "throw");
|
|
var invokeReturn = invoke.bind(generator, "return");
|
|
var previousPromise;
|
|
|
|
function enqueue(method, arg) {
|
|
function callInvokeWithMethodAndArg() {
|
|
return invoke(method, arg);
|
|
}
|
|
|
|
return previousPromise =
|
|
// If enqueue has been called before, then we want to wait until
|
|
// all previous Promises have been resolved before calling invoke,
|
|
// so that results are always delivered in the correct order. If
|
|
// enqueue has not been called before, then it is important to
|
|
// call invoke immediately, without waiting on a callback to fire,
|
|
// so that the async generator function has the opportunity to do
|
|
// any necessary setup in a predictable way. This predictability
|
|
// is why the Promise constructor synchronously invokes its
|
|
// executor callback, and why async functions synchronously
|
|
// execute code before the first await. Since we implement simple
|
|
// async functions in terms of async generators, it is especially
|
|
// important to get this right, even though it requires care.
|
|
previousPromise ? previousPromise.then(
|
|
callInvokeWithMethodAndArg,
|
|
// Avoid propagating failures to Promises returned by later
|
|
// invocations of the iterator.
|
|
callInvokeWithMethodAndArg
|
|
) : new Promise(function (resolve) {
|
|
resolve(callInvokeWithMethodAndArg());
|
|
});
|
|
}
|
|
|
|
// Define the unified helper method that is used to implement .next,
|
|
// .throw, and .return (see defineIteratorMethods).
|
|
this._invoke = enqueue;
|
|
}
|
|
|
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
|
|
// Note that simple async functions are implemented on top of
|
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
// the final result produced by the iterator.
|
|
runtime.async = function(innerFn, outerFn, self, tryLocsList) {
|
|
var iter = new AsyncIterator(
|
|
wrap(innerFn, outerFn, self, tryLocsList)
|
|
);
|
|
|
|
return runtime.isGeneratorFunction(outerFn)
|
|
? iter // If outerFn is a generator, return the full iterator.
|
|
: iter.next().then(function(result) {
|
|
return result.done ? result.value : iter.next();
|
|
});
|
|
};
|
|
|
|
function makeInvokeMethod(innerFn, self, context) {
|
|
var state = GenStateSuspendedStart;
|
|
|
|
return function invoke(method, arg) {
|
|
if (state === GenStateExecuting) {
|
|
throw new Error("Generator is already running");
|
|
}
|
|
|
|
if (state === GenStateCompleted) {
|
|
if (method === "throw") {
|
|
throw arg;
|
|
}
|
|
|
|
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
return doneResult();
|
|
}
|
|
|
|
while (true) {
|
|
var delegate = context.delegate;
|
|
if (delegate) {
|
|
if (method === "return" ||
|
|
(method === "throw" && delegate.iterator[method] === undefined)) {
|
|
// A return or throw (when the delegate iterator has no throw
|
|
// method) always terminates the yield* loop.
|
|
context.delegate = null;
|
|
|
|
// If the delegate iterator has a return method, give it a
|
|
// chance to clean up.
|
|
var returnMethod = delegate.iterator["return"];
|
|
if (returnMethod) {
|
|
var record = tryCatch(returnMethod, delegate.iterator, arg);
|
|
if (record.type === "throw") {
|
|
// If the return method threw an exception, let that
|
|
// exception prevail over the original return or throw.
|
|
method = "throw";
|
|
arg = record.arg;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
if (method === "return") {
|
|
// Continue with the outer return, now that the delegate
|
|
// iterator has been terminated.
|
|
continue;
|
|
}
|
|
}
|
|
|
|
var record = tryCatch(
|
|
delegate.iterator[method],
|
|
delegate.iterator,
|
|
arg
|
|
);
|
|
|
|
if (record.type === "throw") {
|
|
context.delegate = null;
|
|
|
|
// Like returning generator.throw(uncaught), but without the
|
|
// overhead of an extra function call.
|
|
method = "throw";
|
|
arg = record.arg;
|
|
continue;
|
|
}
|
|
|
|
// Delegate generator ran and handled its own exceptions so
|
|
// regardless of what the method was, we continue as if it is
|
|
// "next" with an undefined arg.
|
|
method = "next";
|
|
arg = undefined;
|
|
|
|
var info = record.arg;
|
|
if (info.done) {
|
|
context[delegate.resultName] = info.value;
|
|
context.next = delegate.nextLoc;
|
|
} else {
|
|
state = GenStateSuspendedYield;
|
|
return info;
|
|
}
|
|
|
|
context.delegate = null;
|
|
}
|
|
|
|
if (method === "next") {
|
|
if (state === GenStateSuspendedYield) {
|
|
context.sent = arg;
|
|
} else {
|
|
context.sent = undefined;
|
|
}
|
|
|
|
} else if (method === "throw") {
|
|
if (state === GenStateSuspendedStart) {
|
|
state = GenStateCompleted;
|
|
throw arg;
|
|
}
|
|
|
|
if (context.dispatchException(arg)) {
|
|
// If the dispatched exception was caught by a catch block,
|
|
// then let that catch block handle the exception normally.
|
|
method = "next";
|
|
arg = undefined;
|
|
}
|
|
|
|
} else if (method === "return") {
|
|
context.abrupt("return", arg);
|
|
}
|
|
|
|
state = GenStateExecuting;
|
|
|
|
var record = tryCatch(innerFn, self, context);
|
|
if (record.type === "normal") {
|
|
// If an exception is thrown from innerFn, we leave state ===
|
|
// GenStateExecuting and loop back for another invocation.
|
|
state = context.done
|
|
? GenStateCompleted
|
|
: GenStateSuspendedYield;
|
|
|
|
var info = {
|
|
value: record.arg,
|
|
done: context.done
|
|
};
|
|
|
|
if (record.arg === ContinueSentinel) {
|
|
if (context.delegate && method === "next") {
|
|
// Deliberately forget the last sent value so that we don't
|
|
// accidentally pass it on to the delegate.
|
|
arg = undefined;
|
|
}
|
|
} else {
|
|
return info;
|
|
}
|
|
|
|
} else if (record.type === "throw") {
|
|
state = GenStateCompleted;
|
|
// Dispatch the exception by looping back around to the
|
|
// context.dispatchException(arg) call above.
|
|
method = "throw";
|
|
arg = record.arg;
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
// unified ._invoke helper method.
|
|
defineIteratorMethods(Gp);
|
|
|
|
Gp[iteratorSymbol] = function() {
|
|
return this;
|
|
};
|
|
|
|
Gp.toString = function() {
|
|
return "[object Generator]";
|
|
};
|
|
|
|
function pushTryEntry(locs) {
|
|
var entry = { tryLoc: locs[0] };
|
|
|
|
if (1 in locs) {
|
|
entry.catchLoc = locs[1];
|
|
}
|
|
|
|
if (2 in locs) {
|
|
entry.finallyLoc = locs[2];
|
|
entry.afterLoc = locs[3];
|
|
}
|
|
|
|
this.tryEntries.push(entry);
|
|
}
|
|
|
|
function resetTryEntry(entry) {
|
|
var record = entry.completion || {};
|
|
record.type = "normal";
|
|
delete record.arg;
|
|
entry.completion = record;
|
|
}
|
|
|
|
function Context(tryLocsList) {
|
|
// The root entry object (effectively a try statement without a catch
|
|
// or a finally block) gives us a place to store values thrown from
|
|
// locations where there is no enclosing try statement.
|
|
this.tryEntries = [{ tryLoc: "root" }];
|
|
tryLocsList.forEach(pushTryEntry, this);
|
|
this.reset(true);
|
|
}
|
|
|
|
runtime.keys = function(object) {
|
|
var keys = [];
|
|
for (var key in object) {
|
|
keys.push(key);
|
|
}
|
|
keys.reverse();
|
|
|
|
// Rather than returning an object with a next method, we keep
|
|
// things simple and return the next function itself.
|
|
return function next() {
|
|
while (keys.length) {
|
|
var key = keys.pop();
|
|
if (key in object) {
|
|
next.value = key;
|
|
next.done = false;
|
|
return next;
|
|
}
|
|
}
|
|
|
|
// To avoid creating an additional object, we just hang the .value
|
|
// and .done properties off the next function object itself. This
|
|
// also ensures that the minifier will not anonymize the function.
|
|
next.done = true;
|
|
return next;
|
|
};
|
|
};
|
|
|
|
function values(iterable) {
|
|
if (iterable) {
|
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
if (iteratorMethod) {
|
|
return iteratorMethod.call(iterable);
|
|
}
|
|
|
|
if (typeof iterable.next === "function") {
|
|
return iterable;
|
|
}
|
|
|
|
if (!isNaN(iterable.length)) {
|
|
var i = -1, next = function next() {
|
|
while (++i < iterable.length) {
|
|
if (hasOwn.call(iterable, i)) {
|
|
next.value = iterable[i];
|
|
next.done = false;
|
|
return next;
|
|
}
|
|
}
|
|
|
|
next.value = undefined;
|
|
next.done = true;
|
|
|
|
return next;
|
|
};
|
|
|
|
return next.next = next;
|
|
}
|
|
}
|
|
|
|
// Return an iterator with no values.
|
|
return { next: doneResult };
|
|
}
|
|
runtime.values = values;
|
|
|
|
function doneResult() {
|
|
return { value: undefined, done: true };
|
|
}
|
|
|
|
Context.prototype = {
|
|
constructor: Context,
|
|
|
|
reset: function(skipTempReset) {
|
|
this.prev = 0;
|
|
this.next = 0;
|
|
this.sent = undefined;
|
|
this.done = false;
|
|
this.delegate = null;
|
|
|
|
this.tryEntries.forEach(resetTryEntry);
|
|
|
|
if (!skipTempReset) {
|
|
for (var name in this) {
|
|
// Not sure about the optimal order of these conditions:
|
|
if (name.charAt(0) === "t" &&
|
|
hasOwn.call(this, name) &&
|
|
!isNaN(+name.slice(1))) {
|
|
this[name] = undefined;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
|
|
stop: function() {
|
|
this.done = true;
|
|
|
|
var rootEntry = this.tryEntries[0];
|
|
var rootRecord = rootEntry.completion;
|
|
if (rootRecord.type === "throw") {
|
|
throw rootRecord.arg;
|
|
}
|
|
|
|
return this.rval;
|
|
},
|
|
|
|
dispatchException: function(exception) {
|
|
if (this.done) {
|
|
throw exception;
|
|
}
|
|
|
|
var context = this;
|
|
function handle(loc, caught) {
|
|
record.type = "throw";
|
|
record.arg = exception;
|
|
context.next = loc;
|
|
return !!caught;
|
|
}
|
|
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
var entry = this.tryEntries[i];
|
|
var record = entry.completion;
|
|
|
|
if (entry.tryLoc === "root") {
|
|
// Exception thrown outside of any try block that could handle
|
|
// it, so set the completion value of the entire function to
|
|
// throw the exception.
|
|
return handle("end");
|
|
}
|
|
|
|
if (entry.tryLoc <= this.prev) {
|
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
|
|
if (hasCatch && hasFinally) {
|
|
if (this.prev < entry.catchLoc) {
|
|
return handle(entry.catchLoc, true);
|
|
} else if (this.prev < entry.finallyLoc) {
|
|
return handle(entry.finallyLoc);
|
|
}
|
|
|
|
} else if (hasCatch) {
|
|
if (this.prev < entry.catchLoc) {
|
|
return handle(entry.catchLoc, true);
|
|
}
|
|
|
|
} else if (hasFinally) {
|
|
if (this.prev < entry.finallyLoc) {
|
|
return handle(entry.finallyLoc);
|
|
}
|
|
|
|
} else {
|
|
throw new Error("try statement without catch or finally");
|
|
}
|
|
}
|
|
}
|
|
},
|
|
|
|
abrupt: function(type, arg) {
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
var entry = this.tryEntries[i];
|
|
if (entry.tryLoc <= this.prev &&
|
|
hasOwn.call(entry, "finallyLoc") &&
|
|
this.prev < entry.finallyLoc) {
|
|
var finallyEntry = entry;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (finallyEntry &&
|
|
(type === "break" ||
|
|
type === "continue") &&
|
|
finallyEntry.tryLoc <= arg &&
|
|
arg <= finallyEntry.finallyLoc) {
|
|
// Ignore the finally entry if control is not jumping to a
|
|
// location outside the try/catch block.
|
|
finallyEntry = null;
|
|
}
|
|
|
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
record.type = type;
|
|
record.arg = arg;
|
|
|
|
if (finallyEntry) {
|
|
this.next = finallyEntry.finallyLoc;
|
|
} else {
|
|
this.complete(record);
|
|
}
|
|
|
|
return ContinueSentinel;
|
|
},
|
|
|
|
complete: function(record, afterLoc) {
|
|
if (record.type === "throw") {
|
|
throw record.arg;
|
|
}
|
|
|
|
if (record.type === "break" ||
|
|
record.type === "continue") {
|
|
this.next = record.arg;
|
|
} else if (record.type === "return") {
|
|
this.rval = record.arg;
|
|
this.next = "end";
|
|
} else if (record.type === "normal" && afterLoc) {
|
|
this.next = afterLoc;
|
|
}
|
|
},
|
|
|
|
finish: function(finallyLoc) {
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
var entry = this.tryEntries[i];
|
|
if (entry.finallyLoc === finallyLoc) {
|
|
this.complete(entry.completion, entry.afterLoc);
|
|
resetTryEntry(entry);
|
|
return ContinueSentinel;
|
|
}
|
|
}
|
|
},
|
|
|
|
"catch": function(tryLoc) {
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
var entry = this.tryEntries[i];
|
|
if (entry.tryLoc === tryLoc) {
|
|
var record = entry.completion;
|
|
if (record.type === "throw") {
|
|
var thrown = record.arg;
|
|
resetTryEntry(entry);
|
|
}
|
|
return thrown;
|
|
}
|
|
}
|
|
|
|
// The context.catch method must only be called with a location
|
|
// argument that corresponds to a known catch block.
|
|
throw new Error("illegal catch attempt");
|
|
},
|
|
|
|
delegateYield: function(iterable, resultName, nextLoc) {
|
|
this.delegate = {
|
|
iterator: values(iterable),
|
|
resultName: resultName,
|
|
nextLoc: nextLoc
|
|
};
|
|
|
|
return ContinueSentinel;
|
|
}
|
|
};
|
|
})(
|
|
// Among the various tricks for obtaining a reference to the global
|
|
// object, this seems to be the most reliable technique that does not
|
|
// use indirect eval (which violates Content Security Policy).
|
|
typeof global === "object" ? global :
|
|
typeof window === "object" ? window :
|
|
typeof self === "object" ? self : this
|
|
);
|
|
|
|
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
},{"_process":196}]},{},[3])(3)
|
|
});
|