From a727d8fc6871fae7c311a997fce17c98046fa798 Mon Sep 17 00:00:00 2001 From: swistach Date: Mon, 11 Jun 2018 15:45:47 +0200 Subject: [PATCH] Release 3.0.0 --- dist/formula-parser.js | 2245 ++++++++---------------------------- dist/formula-parser.min.js | 9 +- package.json | 2 +- 3 files changed, 452 insertions(+), 1804 deletions(-) diff --git a/dist/formula-parser.js b/dist/formula-parser.js index b34ddf85..6436aea1 100644 --- a/dist/formula-parser.js +++ b/dist/formula-parser.js @@ -70,7 +70,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 16); +/******/ return __webpack_require__(__webpack_require__.s = 14); /******/ }) /************************************************************************/ /******/ ([ @@ -247,7 +247,7 @@ exports.parseMatrix = function(matrix) { return matrix; }; -var d1900 = new Date(1900, 0, 1); +var d1900 = new Date(Date.UTC(1900, 0, 1)); exports.parseDate = function(date) { if (!isNaN(date)) { if (date instanceof Date) { @@ -1623,10 +1623,10 @@ exports.TRUNC = function(number, digits) { var mathTrig = __webpack_require__(4); var text = __webpack_require__(6); -var jStat = __webpack_require__(11).jStat; +var jStat = __webpack_require__(9).jStat; var utils = __webpack_require__(1); var error = __webpack_require__(0); -var misc = __webpack_require__(12); +var misc = __webpack_require__(10); var SQRT2PI = 2.5066282746310002; @@ -3430,7 +3430,6 @@ exports.Z.TEST = function(range, x, sd) { var utils = __webpack_require__(1); var error = __webpack_require__(0); -var numbro = __webpack_require__(9); //TODO exports.ASC = function() { @@ -3487,22 +3486,9 @@ exports.DBCS = function() { throw new Error('DBCS is not implemented'); }; -exports.DOLLAR = function(number, decimals) { - decimals = (decimals === undefined) ? 2 : decimals; - - number = utils.parseNumber(number); - decimals = utils.parseNumber(decimals); - if (utils.anyIsError(number, decimals)) { - return error.value; - } - var format = ''; - if (decimals <= 0) { - number = Math.round(number * Math.pow(10, decimals)) / Math.pow(10, decimals); - format = '($0,0)'; - } else if (decimals > 0) { - format = '($0,0.' + new Array(decimals + 1).join('0') + ')'; - } - return numbro(number).format(format); +//TODO +exports.DOLLAR = function() { + throw new Error('DOLLAR is not implemented'); }; exports.EXACT = function(text1, text2) { @@ -3520,23 +3506,9 @@ exports.FIND = function(find_text, within_text, position) { return within_text ? within_text.indexOf(find_text, position - 1) + 1 : null; }; -exports.FIXED = function(number, decimals, no_commas) { - decimals = (decimals === undefined) ? 2 : decimals; - no_commas = (no_commas === undefined) ? false : no_commas; - - number = utils.parseNumber(number); - decimals = utils.parseNumber(decimals); - if (utils.anyIsError(number, decimals)) { - return error.value; - } - - var format = no_commas ? '0' : '0,0'; - if (decimals <= 0) { - number = Math.round(number * Math.pow(10, decimals)) / Math.pow(10, decimals); - } else if (decimals > 0) { - format += '.' + new Array(decimals + 1).join('0'); - } - return numbro(number).format(format); +//TODO +exports.FIXED = function() { + throw new Error('FIXED is not implemented'); }; exports.HTML2TEXT = function (value) { @@ -3728,13 +3700,8 @@ exports.T = function(value) { }; // TODO incomplete implementation -exports.TEXT = function(value, format) { - value = utils.parseNumber(value); - if (utils.anyIsError(value)) { - return error.na; - } - - return numbro(value).format(format); +exports.TEXT = function() { + throw new Error('TEXT is not implemented'); }; exports.TRIM = function(text) { @@ -3755,13 +3722,9 @@ exports.UPPER = function(text) { return text.toUpperCase(); }; -exports.VALUE = function(text) { - if (typeof text !== 'string') { - return error.value; - } - var result = numbro().unformat(text); - - return result === void 0 ? 0 : result; +//TODO +exports.VALUE = function() { + throw new Error('VALUE is not implemented'); }; @@ -3911,7 +3874,7 @@ exports.TYPE = function(value) { var error = __webpack_require__(0); var utils = __webpack_require__(1); -var d1900 = new Date(1900, 0, 1); +var d1900 = new Date(Date.UTC(1900, 0, 1)); var WEEK_STARTS = [ undefined, 0, @@ -3994,19 +3957,24 @@ exports.DATE = function(year, month, day) { }; exports.DATEVALUE = function(date_text) { + var modifier = 2; + var date; + if (typeof date_text !== 'string') { return error.value; } - var date = Date.parse(date_text); + + date = Date.parse(date_text); if (isNaN(date)) { return error.value; } + if (date <= -2203891200000) { - return (date - d1900) / 86400000 + 1; + modifier = 1; } - return (date - d1900) / 86400000 + 2; + return Math.ceil((date - d1900) / 86400000) + modifier; }; exports.DAY = function(serial_number) { @@ -4273,1689 +4241,198 @@ exports.TIMEVALUE = function(time_text) { return time_text; } - return (3600 * time_text.getHours() + 60 * time_text.getMinutes() + time_text.getSeconds()) / 86400; -}; - -exports.TODAY = function() { - return new Date(); -}; - -exports.WEEKDAY = function(serial_number, return_type) { - serial_number = utils.parseDate(serial_number); - if (serial_number instanceof Error) { - return serial_number; - } - if (return_type === undefined) { - return_type = 1; - } - var day = serial_number.getDay(); - - return WEEK_TYPES[return_type][day]; -}; - -exports.WEEKNUM = function(serial_number, return_type) { - serial_number = utils.parseDate(serial_number); - if (serial_number instanceof Error) { - return serial_number; - } - if (return_type === undefined) { - return_type = 1; - } - if (return_type === 21) { - return this.ISOWEEKNUM(serial_number); - } - var week_start = WEEK_STARTS[return_type]; - var jan = new Date(serial_number.getFullYear(), 0, 1); - var inc = jan.getDay() < week_start ? 1 : 0; - jan -= Math.abs(jan.getDay() - week_start) * 24 * 60 * 60 * 1000; - - return Math.floor(((serial_number - jan) / (1000 * 60 * 60 * 24)) / 7 + 1) + inc; -}; - -exports.WORKDAY = function(start_date, days, holidays) { - return this.WORKDAY.INTL(start_date, days, 1, holidays); -}; - -exports.WORKDAY.INTL = function(start_date, days, weekend, holidays) { - start_date = utils.parseDate(start_date); - if (start_date instanceof Error) { - return start_date; - } - days = utils.parseNumber(days); - if (days instanceof Error) { - return days; - } - if (days < 0) { - return error.num; - } - if (weekend === undefined) { - weekend = WEEKEND_TYPES[1]; - } else { - weekend = WEEKEND_TYPES[weekend]; - } - if (!(weekend instanceof Array)) { - return error.value; - } - if (holidays === undefined) { - holidays = []; - } else if (!(holidays instanceof Array)) { - holidays = [holidays]; - } - for (var i = 0; i < holidays.length; i++) { - var h = utils.parseDate(holidays[i]); - if (h instanceof Error) { - return h; - } - holidays[i] = h; - } - var d = 0; - while (d < days) { - start_date.setDate(start_date.getDate() + 1); - var day = start_date.getDay(); - if (day === weekend[0] || day === weekend[1]) { - continue; - } - for (var j = 0; j < holidays.length; j++) { - var holiday = holidays[j]; - if (holiday.getDate() === start_date.getDate() && - holiday.getMonth() === start_date.getMonth() && - holiday.getFullYear() === start_date.getFullYear()) { - d--; - break; - } - } - d++; - } - - return start_date; -}; - -exports.YEAR = function(serial_number) { - serial_number = utils.parseDate(serial_number); - - if (serial_number instanceof Error) { - return serial_number; - } - - return serial_number.getFullYear(); -}; - -function isLeapYear(year) { - return new Date(year, 1, 29).getMonth() === 1; -} - -// TODO : Use DAYS ? -function daysBetween(start_date, end_date) { - return Math.ceil((end_date - start_date) / 1000 / 60 / 60 / 24); -} - -exports.YEARFRAC = function(start_date, end_date, basis) { - start_date = utils.parseDate(start_date); - if (start_date instanceof Error) { - return start_date; - } - end_date = utils.parseDate(end_date); - if (end_date instanceof Error) { - return end_date; - } - - basis = basis || 0; - var sd = start_date.getDate(); - var sm = start_date.getMonth() + 1; - var sy = start_date.getFullYear(); - var ed = end_date.getDate(); - var em = end_date.getMonth() + 1; - var ey = end_date.getFullYear(); - - switch (basis) { - case 0: - // US (NASD) 30/360 - if (sd === 31 && ed === 31) { - sd = 30; - ed = 30; - } else if (sd === 31) { - sd = 30; - } else if (sd === 30 && ed === 31) { - ed = 30; - } - return ((ed + em * 30 + ey * 360) - (sd + sm * 30 + sy * 360)) / 360; - case 1: - // Actual/actual - var feb29Between = function(date1, date2) { - var year1 = date1.getFullYear(); - var mar1year1 = new Date(year1, 2, 1); - if (isLeapYear(year1) && date1 < mar1year1 && date2 >= mar1year1) { - return true; - } - var year2 = date2.getFullYear(); - var mar1year2 = new Date(year2, 2, 1); - return (isLeapYear(year2) && date2 >= mar1year2 && date1 < mar1year2); - }; - var ylength = 365; - if (sy === ey || ((sy + 1) === ey) && ((sm > em) || ((sm === em) && (sd >= ed)))) { - if ((sy === ey && isLeapYear(sy)) || - feb29Between(start_date, end_date) || - (em === 1 && ed === 29)) { - ylength = 366; - } - return daysBetween(start_date, end_date) / ylength; - } - var years = (ey - sy) + 1; - var days = (new Date(ey + 1, 0, 1) - new Date(sy, 0, 1)) / 1000 / 60 / 60 / 24; - var average = days / years; - return daysBetween(start_date, end_date) / average; - case 2: - // Actual/360 - return daysBetween(start_date, end_date) / 360; - case 3: - // Actual/365 - return daysBetween(start_date, end_date) / 365; - case 4: - // European 30/360 - return ((ed + em * 30 + ey * 360) - (sd + sm * 30 + sy * 360)) / 360; - } -}; - -function serial(date) { - var addOn = (date > -2203891200000) ? 2 : 1; - - return (date - d1900) / 86400000 + addOn; -} - - -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(process) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - * numbro.js - * version : 1.11.1 - * author : Företagsplatsen AB - * license : MIT - * http://www.foretagsplatsen.se - */ - -(function () { - 'use strict'; - - /************************************ - Constants - ************************************/ - - var numbro, - VERSION = '1.11.1', - binarySuffixes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'], - decimalSuffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], - bytes = { - general: { scale: 1024, suffixes: decimalSuffixes, marker: 'bd' }, - binary: { scale: 1024, suffixes: binarySuffixes, marker: 'b' }, - decimal: { scale: 1000, suffixes: decimalSuffixes, marker: 'd' } - }, - // general must be before the others because it reuses their characters! - byteFormatOrder = [ bytes.general, bytes.binary, bytes.decimal ], - // internal storage for culture config files - cultures = {}, - // Todo: Remove in 2.0.0 - languages = cultures, - currentCulture = 'en-US', - zeroFormat = null, - defaultFormat = '0,0', - defaultCurrencyFormat = '0$', - // check for nodeJS - hasModule = (typeof module !== 'undefined' && module.exports), - // default culture - enUS = { - delimiters: { - thousands: ',', - decimal: '.' - }, - abbreviations: { - thousand: 'k', - million: 'm', - billion: 'b', - trillion: 't' - }, - ordinal: function(number) { - var b = number % 10; - return (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - }, - currency: { - symbol: '$', - position: 'prefix' - }, - defaults: { - currencyFormat: ',0000 a' - }, - formats: { - fourDigits: '0000 a', - fullWithTwoDecimals: '$ ,0.00', - fullWithTwoDecimalsNoCurrency: ',0.00' - } - }; - - /************************************ - Constructors - ************************************/ - - - // Numbro prototype object - function Numbro(number) { - this._value = number; - } - - function numberLength(number) { - if (number === 0) { return 1; } - return Math.floor(Math.log(Math.abs(number)) / Math.LN10) + 1; - } - - function zeroes(count) { - var i, ret = ''; - - for (i = 0; i < count; i++) { - ret += '0'; - } - - return ret; - } - /** - * Implementation of toFixed() for numbers with exponents - * This function may return negative representations for zero values e.g. "-0.0" - */ - function toFixedLargeSmall(value, precision) { - var mantissa, - beforeDec, - afterDec, - exponent, - prefix, - endStr, - zerosStr, - str; - - str = value.toString(); - - mantissa = str.split('e')[0]; - exponent = str.split('e')[1]; - - beforeDec = mantissa.split('.')[0]; - afterDec = mantissa.split('.')[1] || ''; - - if (+exponent > 0) { - // exponent is positive - add zeros after the numbers - str = beforeDec + afterDec + zeroes(exponent - afterDec.length); - } else { - // exponent is negative - - if (+beforeDec < 0) { - prefix = '-0'; - } else { - prefix = '0'; - } - - // tack on the decimal point if needed - if (precision > 0) { - prefix += '.'; - } - - zerosStr = zeroes((-1 * exponent) - 1); - // substring off the end to satisfy the precision - endStr = (zerosStr + Math.abs(beforeDec) + afterDec).substr(0, precision); - str = prefix + endStr; - } - - // only add percision 0's if the exponent is positive - if (+exponent > 0 && precision > 0) { - str += '.' + zeroes(precision); - } - - return str; - } - - /** - * Implementation of toFixed() that treats floats more like decimals - * - * Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present - * problems for accounting- and finance-related software. - * - * Also removes negative signs for zero-formatted numbers. e.g. -0.01 w/ precision 1 -> 0.0 - */ - function toFixed(value, precision, roundingFunction, optionals) { - var power = Math.pow(10, precision), - optionalsRegExp, - output; - - if (value.toString().indexOf('e') > -1) { - // toFixed returns scientific notation for numbers above 1e21 and below 1e-7 - output = toFixedLargeSmall(value, precision); - // remove the leading negative sign if it exists and should not be present (e.g. -0.00) - if (output.charAt(0) === '-' && +output >= 0) { - output = output.substr(1); // chop off the '-' - } - } - else { - // Multiply up by precision, round accurately, then divide and use native toFixed(): - output = (roundingFunction(value + 'e+' + precision) / power).toFixed(precision); - } - - if (optionals) { - optionalsRegExp = new RegExp('0{1,' + optionals + '}$'); - output = output.replace(optionalsRegExp, ''); - } - - return output; - } - - /************************************ - Formatting - ************************************/ - - // determine what type of formatting we need to do - function formatNumbro(n, format, roundingFunction) { - var output, - escapedFormat = format.replace(/\{[^\{\}]*\}/g, ''); - - // figure out what kind of format we are dealing with - if (escapedFormat.indexOf('$') > -1) { // currency!!!!! - output = formatCurrency(n, cultures[currentCulture].currency.symbol, format, roundingFunction); - } else if (escapedFormat.indexOf('%') > -1) { // percentage - output = formatPercentage(n, format, roundingFunction); - } else if (escapedFormat.indexOf(':') > -1) { // time - output = formatTime(n, format); - } else { // plain ol' numbers or bytes - output = formatNumber(n._value, format, roundingFunction); - } - - // return string - return output; - } - - // revert to number - function unformatNumbro(n, string) { - var stringOriginal = string, - thousandRegExp, - millionRegExp, - billionRegExp, - trillionRegExp, - bytesMultiplier = false, - power; - - if (string.indexOf(':') > -1) { - n._value = unformatTime(string); - } else { - if (string === zeroFormat) { - n._value = 0; - } else { - if (cultures[currentCulture].delimiters.decimal !== '.') { - string = string.replace(/\./g, '').replace(cultures[currentCulture].delimiters.decimal, '.'); - } - - // see if abbreviations are there so that we can multiply to the correct number - thousandRegExp = new RegExp('[^a-zA-Z]' + cultures[currentCulture].abbreviations.thousand + - '(?:\\)|(\\' + cultures[currentCulture].currency.symbol + ')?(?:\\))?)?$'); - millionRegExp = new RegExp('[^a-zA-Z]' + cultures[currentCulture].abbreviations.million + - '(?:\\)|(\\' + cultures[currentCulture].currency.symbol + ')?(?:\\))?)?$'); - billionRegExp = new RegExp('[^a-zA-Z]' + cultures[currentCulture].abbreviations.billion + - '(?:\\)|(\\' + cultures[currentCulture].currency.symbol + ')?(?:\\))?)?$'); - trillionRegExp = new RegExp('[^a-zA-Z]' + cultures[currentCulture].abbreviations.trillion + - '(?:\\)|(\\' + cultures[currentCulture].currency.symbol + ')?(?:\\))?)?$'); - - // see if bytes are there so that we can multiply to the correct number - for (power = 1; power < binarySuffixes.length && !bytesMultiplier; ++power) { - if (string.indexOf(binarySuffixes[power]) > -1) { - bytesMultiplier = Math.pow(1024, power); - } else if (string.indexOf(decimalSuffixes[power]) > -1) { - bytesMultiplier = Math.pow(1000, power); - } - } - - var str = string.replace(/[^0-9\.]+/g, ''); - if (str === '') { - // An empty string is not a number. - n._value = NaN; - - } else { - // do some math to create our number - n._value = ((bytesMultiplier) ? bytesMultiplier : 1) * - ((stringOriginal.match(thousandRegExp)) ? Math.pow(10, 3) : 1) * - ((stringOriginal.match(millionRegExp)) ? Math.pow(10, 6) : 1) * - ((stringOriginal.match(billionRegExp)) ? Math.pow(10, 9) : 1) * - ((stringOriginal.match(trillionRegExp)) ? Math.pow(10, 12) : 1) * - ((string.indexOf('%') > -1) ? 0.01 : 1) * - (((string.split('-').length + - Math.min(string.split('(').length - 1, string.split(')').length - 1)) % 2) ? 1 : -1) * - Number(str); - - // round if we are talking about bytes - n._value = (bytesMultiplier) ? Math.ceil(n._value) : n._value; - } - } - } - return n._value; - } - - function formatCurrency(n, currencySymbol, originalFormat, roundingFunction) { - var format = originalFormat, - symbolIndex = format.indexOf('$'), - openParenIndex = format.indexOf('('), - plusSignIndex = format.indexOf('+'), - minusSignIndex = format.indexOf('-'), - space = '', - decimalSeparator = '', - spliceIndex, - output; - - if(format.indexOf('$') === -1){ - // Use defaults instead of the format provided - if (cultures[currentCulture].currency.position === 'infix') { - decimalSeparator = currencySymbol; - if (cultures[currentCulture].currency.spaceSeparated) { - decimalSeparator = ' ' + decimalSeparator + ' '; - } - } else if (cultures[currentCulture].currency.spaceSeparated) { - space = ' '; - } - } else { - // check for space before or after currency - if (format.indexOf(' $') > -1) { - space = ' '; - format = format.replace(' $', ''); - } else if (format.indexOf('$ ') > -1) { - space = ' '; - format = format.replace('$ ', ''); - } else { - format = format.replace('$', ''); - } - } - - // Format The Number - output = formatNumber(n._value, format, roundingFunction, decimalSeparator); - - if (originalFormat.indexOf('$') === -1) { - // Use defaults instead of the format provided - switch (cultures[currentCulture].currency.position) { - case 'postfix': - if (output.indexOf(')') > -1) { - output = output.split(''); - output.splice(-1, 0, space + currencySymbol); - output = output.join(''); - } else { - output = output + space + currencySymbol; - } - break; - case 'infix': - break; - case 'prefix': - if (output.indexOf('(') > -1 || output.indexOf('-') > -1) { - output = output.split(''); - spliceIndex = Math.max(openParenIndex, minusSignIndex) + 1; - - output.splice(spliceIndex, 0, currencySymbol + space); - output = output.join(''); - } else { - output = currencySymbol + space + output; - } - break; - default: - throw Error('Currency position should be among ["prefix", "infix", "postfix"]'); - } - } else { - // position the symbol - if (symbolIndex <= 1) { - if (output.indexOf('(') > -1 || output.indexOf('+') > -1 || output.indexOf('-') > -1) { - output = output.split(''); - spliceIndex = 1; - if (symbolIndex < openParenIndex || symbolIndex < plusSignIndex || symbolIndex < minusSignIndex) { - // the symbol appears before the "(", "+" or "-" - spliceIndex = 0; - } - output.splice(spliceIndex, 0, currencySymbol + space); - output = output.join(''); - } else { - output = currencySymbol + space + output; - } - } else { - if (output.indexOf(')') > -1) { - output = output.split(''); - output.splice(-1, 0, space + currencySymbol); - output = output.join(''); - } else { - output = output + space + currencySymbol; - } - } - } - - return output; - } - - function formatForeignCurrency(n, foreignCurrencySymbol, originalFormat, roundingFunction) { - return formatCurrency(n, foreignCurrencySymbol, originalFormat, roundingFunction); - } - - function formatPercentage(n, format, roundingFunction) { - var space = '', - output, - value = n._value * 100; - - // check for space before % - if (format.indexOf(' %') > -1) { - space = ' '; - format = format.replace(' %', ''); - } else { - format = format.replace('%', ''); - } - - output = formatNumber(value, format, roundingFunction); - - if (output.indexOf(')') > -1) { - output = output.split(''); - output.splice(-1, 0, space + '%'); - output = output.join(''); - } else { - output = output + space + '%'; - } - - return output; - } - - function formatTime(n) { - var hours = Math.floor(n._value / 60 / 60), - minutes = Math.floor((n._value - (hours * 60 * 60)) / 60), - seconds = Math.round(n._value - (hours * 60 * 60) - (minutes * 60)); - return hours + ':' + - ((minutes < 10) ? '0' + minutes : minutes) + ':' + - ((seconds < 10) ? '0' + seconds : seconds); - } - - function unformatTime(string) { - var timeArray = string.split(':'), - seconds = 0; - // turn hours and minutes into seconds and add them all up - if (timeArray.length === 3) { - // hours - seconds = seconds + (Number(timeArray[0]) * 60 * 60); - // minutes - seconds = seconds + (Number(timeArray[1]) * 60); - // seconds - seconds = seconds + Number(timeArray[2]); - } else if (timeArray.length === 2) { - // minutes - seconds = seconds + (Number(timeArray[0]) * 60); - // seconds - seconds = seconds + Number(timeArray[1]); - } - return Number(seconds); - } - - function formatByteUnits (value, suffixes, scale) { - var suffix = suffixes[0], - power, - min, - max, - abs = Math.abs(value); - - if (abs >= scale) { - for (power = 1; power < suffixes.length; ++power) { - min = Math.pow(scale, power); - max = Math.pow(scale, power + 1); - - if (abs >= min && abs < max) { - suffix = suffixes[power]; - value = value / min; - break; - } - } - - // values greater than or equal to [scale] YB never set the suffix - if (suffix === suffixes[0]) { - value = value / Math.pow(scale, suffixes.length - 1); - suffix = suffixes[suffixes.length - 1]; - } - } - - return { value: value, suffix: suffix }; - } - - function formatNumber (value, format, roundingFunction, sep) { - var negP = false, - signed = false, - optDec = false, - abbr = '', - abbrK = false, // force abbreviation to thousands - abbrM = false, // force abbreviation to millions - abbrB = false, // force abbreviation to billions - abbrT = false, // force abbreviation to trillions - abbrForce = false, // force abbreviation - bytes = '', - byteFormat, - units, - ord = '', - abs = Math.abs(value), - totalLength, - length, - minimumPrecision, - pow, - w, - intPrecision, - precision, - prefix, - postfix, - thousands, - d = '', - forcedNeg = false, - neg = false, - indexOpenP, - indexMinus, - paren = '', - minlen, - i; - - // check if number is zero and a custom zero format has been set - if (value === 0 && zeroFormat !== null) { - return zeroFormat; - } - - if (!isFinite(value)) { - return '' + value; - } - - if (format.indexOf('{') === 0) { - var end = format.indexOf('}'); - if (end === -1) { - throw Error('Format should also contain a "}"'); - } - prefix = format.slice(1, end); - format = format.slice(end + 1); - } else { - prefix = ''; - } - - if (format.indexOf('}') === format.length - 1 && format.length) { - var start = format.indexOf('{'); - if (start === -1) { - throw Error('Format should also contain a "{"'); - } - postfix = format.slice(start + 1, -1); - format = format.slice(0, start + 1); - } else { - postfix = ''; - } - - // check for min length - var info; - if (format.indexOf('.') === -1) { - info = format.match(/([0-9]+).*/); - } else { - info = format.match(/([0-9]+)\..*/); - } - minlen = info === null ? -1 : info[1].length; - - // see if we should use parentheses for negative number or if we should prefix with a sign - // if both are present we default to parentheses - if (format.indexOf('-') !== -1) { - forcedNeg = true; - } - if (format.indexOf('(') > -1) { - negP = true; - format = format.slice(1, -1); - } else if (format.indexOf('+') > -1) { - signed = true; - format = format.replace(/\+/g, ''); - } - - // see if abbreviation is wanted - if (format.indexOf('a') > -1) { - intPrecision = format.split('.')[0].match(/[0-9]+/g) || ['0']; - intPrecision = parseInt(intPrecision[0], 10); - - // check if abbreviation is specified - abbrK = format.indexOf('aK') >= 0; - abbrM = format.indexOf('aM') >= 0; - abbrB = format.indexOf('aB') >= 0; - abbrT = format.indexOf('aT') >= 0; - abbrForce = abbrK || abbrM || abbrB || abbrT; - - // check for space before abbreviation - if (format.indexOf(' a') > -1) { - abbr = ' '; - format = format.replace(' a', ''); - } else { - format = format.replace('a', ''); - } - - totalLength = numberLength(value); - minimumPrecision = totalLength % 3; - minimumPrecision = minimumPrecision === 0 ? 3 : minimumPrecision; - - if (intPrecision && abs !== 0) { - pow = 3 * ~~((Math.min(intPrecision, totalLength) - minimumPrecision) / 3); - abs = abs / Math.pow(10, pow); - } - - if (totalLength !== intPrecision) { - if (abs >= Math.pow(10, 12) && !abbrForce || abbrT) { - // trillion - abbr = abbr + cultures[currentCulture].abbreviations.trillion; - value = value / Math.pow(10, 12); - } else if (abs < Math.pow(10, 12) && abs >= Math.pow(10, 9) && !abbrForce || abbrB) { - // billion - abbr = abbr + cultures[currentCulture].abbreviations.billion; - value = value / Math.pow(10, 9); - } else if (abs < Math.pow(10, 9) && abs >= Math.pow(10, 6) && !abbrForce || abbrM) { - // million - abbr = abbr + cultures[currentCulture].abbreviations.million; - value = value / Math.pow(10, 6); - } else if (abs < Math.pow(10, 6) && abs >= Math.pow(10, 3) && !abbrForce || abbrK) { - // thousand - abbr = abbr + cultures[currentCulture].abbreviations.thousand; - value = value / Math.pow(10, 3); - } - } - - length = numberLength(value); - if (intPrecision && length < intPrecision && format.indexOf('.') === -1) { - format += '[.]'; - format += zeroes(intPrecision - length); - } - } - - // see if we are formatting - // binary-decimal bytes (1024 MB), binary bytes (1024 MiB), or decimal bytes (1000 MB) - for (i = 0; i < byteFormatOrder.length; ++i) { - byteFormat = byteFormatOrder[i]; - - if (format.indexOf(byteFormat.marker) > -1) { - // check for space before - if (format.indexOf(' ' + byteFormat.marker) >-1) { - bytes = ' '; - } - - // remove the marker (with the space if it had one) - format = format.replace(bytes + byteFormat.marker, ''); - - units = formatByteUnits(value, byteFormat.suffixes, byteFormat.scale); - - value = units.value; - bytes = bytes + units.suffix; - - break; - } - } - - // see if ordinal is wanted - if (format.indexOf('o') > -1) { - // check for space before - if (format.indexOf(' o') > -1) { - ord = ' '; - format = format.replace(' o', ''); - } else { - format = format.replace('o', ''); - } - - if (cultures[currentCulture].ordinal) { - ord = ord + cultures[currentCulture].ordinal(value); - } - } - - if (format.indexOf('[.]') > -1) { - optDec = true; - format = format.replace('[.]', '.'); - } - - precision = format.split('.')[1]; - thousands = format.indexOf(','); - - if (precision) { - var dSplit = []; - - if (precision.indexOf('*') !== -1) { - d = value.toString(); - dSplit = d.split('.'); - if (dSplit.length > 1) { - d = toFixed(value, dSplit[1].length, roundingFunction); - } - } else { - if (precision.indexOf('[') > -1) { - precision = precision.replace(']', ''); - precision = precision.split('['); - d = toFixed(value, (precision[0].length + precision[1].length), roundingFunction, - precision[1].length); - } else { - d = toFixed(value, precision.length, roundingFunction); - } - } - - dSplit = d.split('.'); - w = dSplit[0]; - - if (dSplit.length > 1 && dSplit[1].length) { - var p = sep ? abbr + sep : cultures[currentCulture].delimiters.decimal; - d = p + dSplit[1]; - } else { - d = ''; - } - - if (optDec && Number(d.slice(1)) === 0) { - d = ''; - } - } else { - w = toFixed(value, 0, roundingFunction); - } - - // format number - if (w.indexOf('-') > -1) { - w = w.slice(1); - neg = true; - } - - if (w.length < minlen) { - w = zeroes(minlen - w.length) + w; - } - - if (thousands > -1) { - w = w.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' + - cultures[currentCulture].delimiters.thousands); - } - - if (format.indexOf('.') === 0) { - w = ''; - } - - indexOpenP = format.indexOf('('); - indexMinus = format.indexOf('-'); - - if (indexOpenP < indexMinus) { - paren = ((negP && neg) ? '(' : '') + (((forcedNeg && neg) || (!negP && neg)) ? '-' : ''); - } else { - paren = (((forcedNeg && neg) || (!negP && neg)) ? '-' : '') + ((negP && neg) ? '(' : ''); - } - - return prefix + - paren + ((!neg && signed && value !== 0) ? '+' : '') + - w + d + - ((ord) ? ord : '') + - ((abbr && !sep) ? abbr : '') + - ((bytes) ? bytes : '') + - ((negP && neg) ? ')' : '') + - postfix; - } - - /************************************ - Top Level Functions - ************************************/ - - numbro = function(input) { - if (numbro.isNumbro(input)) { - input = input.value(); - } else if (typeof input === 'string' || typeof input === 'number') { - input = numbro.fn.unformat(input); - } else { - input = NaN; - } - - return new Numbro(Number(input)); - }; - - // version number - numbro.version = VERSION; - - // compare numbro object - numbro.isNumbro = function(obj) { - return obj instanceof Numbro; - }; - - /** - * This function allow the user to set a new language with a fallback if - * the language does not exist. If no fallback language is provided, - * it fallbacks to english. - * - * @deprecated Since in version 1.6.0. It will be deleted in version 2.0 - * `setCulture` should be used instead. - */ - numbro.setLanguage = function(newLanguage, fallbackLanguage) { - console.warn('`setLanguage` is deprecated since version 1.6.0. Use `setCulture` instead'); - var key = newLanguage, - prefix = newLanguage.split('-')[0], - matchingLanguage = null; - if (!languages[key]) { - Object.keys(languages).forEach(function(language) { - if (!matchingLanguage && language.split('-')[0] === prefix) { - matchingLanguage = language; - } - }); - key = matchingLanguage || fallbackLanguage || 'en-US'; - } - chooseCulture(key); - }; - - /** - * This function allow the user to set a new culture with a fallback if - * the culture does not exist. If no fallback culture is provided, - * it falls back to "en-US". - */ - numbro.setCulture = function(newCulture, fallbackCulture) { - var key = newCulture, - suffix = newCulture.split('-')[1], - matchingCulture = null; - if (!cultures[key]) { - if (suffix) { - Object.keys(cultures).forEach(function(language) { - if (!matchingCulture && language.split('-')[1] === suffix) { - matchingCulture = language; - } - }); - } - - key = matchingCulture || fallbackCulture || 'en-US'; - } - chooseCulture(key); - }; - - /** - * This function will load languages and then set the global language. If - * no arguments are passed in, it will simply return the current global - * language key. - * - * @deprecated Since in version 1.6.0. It will be deleted in version 2.0 - * `culture` should be used instead. - */ - numbro.language = function(key, values) { - console.warn('`language` is deprecated since version 1.6.0. Use `culture` instead'); - - if (!key) { - return currentCulture; - } - - if (key && !values) { - if (!languages[key]) { - throw new Error('Unknown language : ' + key); - } - chooseCulture(key); - } - - if (values || !languages[key]) { - setCulture(key, values); - } - - return numbro; - }; - - /** - * This function will load cultures and then set the global culture. If - * no arguments are passed in, it will simply return the current global - * culture code. - */ - numbro.culture = function(code, values) { - if (!code) { - return currentCulture; - } - - if (code && !values) { - if (!cultures[code]) { - throw new Error('Unknown culture : ' + code); - } - chooseCulture(code); - } - - if (values || !cultures[code]) { - setCulture(code, values); - } - - return numbro; - }; - - /** - * This function provides access to the loaded language data. If - * no arguments are passed in, it will simply return the current - * global language object. - * - * @deprecated Since in version 1.6.0. It will be deleted in version 2.0 - * `culture` should be used instead. - */ - numbro.languageData = function(key) { - console.warn('`languageData` is deprecated since version 1.6.0. Use `cultureData` instead'); - - if (!key) { - return languages[currentCulture]; - } - - if (!languages[key]) { - throw new Error('Unknown language : ' + key); - } - - return languages[key]; - }; - - /** - * This function provides access to the loaded culture data. If - * no arguments are passed in, it will simply return the current - * global culture object. - */ - numbro.cultureData = function(code) { - if (!code) { - return cultures[currentCulture]; - } - - if (!cultures[code]) { - throw new Error('Unknown culture : ' + code); - } - - return cultures[code]; - }; - - numbro.culture('en-US', enUS); - - /** - * @deprecated Since in version 1.6.0. It will be deleted in version 2.0 - * `cultures` should be used instead. - */ - numbro.languages = function() { - console.warn('`languages` is deprecated since version 1.6.0. Use `cultures` instead'); - - return languages; - }; - - numbro.cultures = function() { - return cultures; - }; - - numbro.zeroFormat = function(format) { - zeroFormat = typeof(format) === 'string' ? format : null; - }; - - numbro.defaultFormat = function(format) { - defaultFormat = typeof(format) === 'string' ? format : '0.0'; - }; - - numbro.defaultCurrencyFormat = function (format) { - defaultCurrencyFormat = typeof(format) === 'string' ? format : '0$'; - }; - - numbro.validate = function(val, culture) { - - var _decimalSep, - _thousandSep, - _currSymbol, - _valArray, - _abbrObj, - _thousandRegEx, - cultureData, - temp; - - //coerce val to string - if (typeof val !== 'string') { - val += ''; - if (console.warn) { - console.warn('Numbro.js: Value is not string. It has been co-erced to: ', val); - } - } - - //trim whitespaces from either sides - val = val.trim(); - - //replace the initial '+' or '-' sign if present - val = val.replace(/^[+-]?/, ''); - - //if val is just digits return true - if ( !! val.match(/^\d+$/)) { - return true; - } - - //if val is empty return false - if (val === '') { - return false; - } - - //get the decimal and thousands separator from numbro.cultureData - try { - //check if the culture is understood by numbro. if not, default it to current culture - cultureData = numbro.cultureData(culture); - } catch (e) { - cultureData = numbro.cultureData(numbro.culture()); - } - - //setup the delimiters and currency symbol based on culture - _currSymbol = cultureData.currency.symbol; - _abbrObj = cultureData.abbreviations; - _decimalSep = cultureData.delimiters.decimal; - if (cultureData.delimiters.thousands === '.') { - _thousandSep = '\\.'; - } else { - _thousandSep = cultureData.delimiters.thousands; - } - - // validating currency symbol - temp = val.match(/^[^\d\.\,]+/); - if (temp !== null) { - val = val.substr(1); - if (temp[0] !== _currSymbol) { - return false; - } - } - - //validating abbreviation symbol - temp = val.match(/[^\d]+$/); - if (temp !== null) { - val = val.slice(0, -1); - if (temp[0] !== _abbrObj.thousand && temp[0] !== _abbrObj.million && - temp[0] !== _abbrObj.billion && temp[0] !== _abbrObj.trillion) { - return false; - } - } - - _thousandRegEx = new RegExp(_thousandSep + '{2}'); - - if (!val.match(/[^\d.,]/g)) { - _valArray = val.split(_decimalSep); - if (_valArray.length > 2) { - return false; - } else { - if (_valArray.length < 2) { - return ( !! _valArray[0].match(/^\d+.*\d$/) && !_valArray[0].match(_thousandRegEx)); - } else { - if (_valArray[0] === '') { - // for values without leading zero eg. .984 - return (!_valArray[0].match(_thousandRegEx) && - !!_valArray[1].match(/^\d+$/)); - - } else if (_valArray[0].length === 1) { - return ( !! _valArray[0].match(/^\d+$/) && - !_valArray[0].match(_thousandRegEx) && - !! _valArray[1].match(/^\d+$/)); - } else { - return ( !! _valArray[0].match(/^\d+.*\d$/) && - !_valArray[0].match(_thousandRegEx) && - !! _valArray[1].match(/^\d+$/)); - } - } - } - } - - return false; - }; - - /** - * * @deprecated Since in version 1.6.0. It will be deleted in version 2.0 - * `loadCulturesInNode` should be used instead. - */ - numbro.loadLanguagesInNode = function() { - console.warn('`loadLanguagesInNode` is deprecated since version 1.6.0. Use `loadCulturesInNode` instead'); - - numbro.loadCulturesInNode(); - }; - - numbro.loadCulturesInNode = function() { - // TODO: Rename the folder in 2.0.0 - var cultures = __webpack_require__(27); - - for(var langLocaleCode in cultures) { - if(langLocaleCode) { - numbro.culture(langLocaleCode, cultures[langLocaleCode]); - } - } - }; - - /************************************ - Helpers - ************************************/ - - function setCulture(code, values) { - cultures[code] = values; - } - - function chooseCulture(code) { - currentCulture = code; - var defaults = cultures[code].defaults; - if (defaults && defaults.format) { - numbro.defaultFormat(defaults.format); - } - if (defaults && defaults.currencyFormat) { - numbro.defaultCurrencyFormat(defaults.currencyFormat); - } - } - - function inNodejsRuntime() { - return (typeof process !== 'undefined') && - (process.browser === undefined) && - process.title && - ( - process.title.indexOf('node') !== -1 || - process.title.indexOf('meteor-tool') > 0 || - process.title === 'grunt' || - process.title === 'gulp' - ) && - ("function" !== 'undefined'); - } - - /************************************ - Floating-point helpers - ************************************/ - - // The floating-point helper functions and implementation - // borrows heavily from sinful.js: http://guipn.github.io/sinful.js/ - - /** - * Array.prototype.reduce for browsers that don't support it - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce#Compatibility - */ - if ('function' !== typeof Array.prototype.reduce) { - Array.prototype.reduce = function(callback, optInitialValue) { - - if (null === this || 'undefined' === typeof this) { - // At the moment all modern browsers, that support strict mode, have - // native implementation of Array.prototype.reduce. For instance, IE8 - // does not support strict mode, so this check is actually useless. - throw new TypeError('Array.prototype.reduce called on null or undefined'); - } - - if ('function' !== typeof callback) { - throw new TypeError(callback + ' is not a function'); - } - - var index, - value, - length = this.length >>> 0, - isValueSet = false; - - if (1 < arguments.length) { - value = optInitialValue; - isValueSet = true; - } - - for (index = 0; length > index; ++index) { - if (this.hasOwnProperty(index)) { - if (isValueSet) { - value = callback(value, this[index], index, this); - } else { - value = this[index]; - isValueSet = true; - } - } - } - - if (!isValueSet) { - throw new TypeError('Reduce of empty array with no initial value'); - } - - return value; - }; - } - - - /** - * Computes the multiplier necessary to make x >= 1, - * effectively eliminating miscalculations caused by - * finite precision. - */ - function multiplier(x) { - var parts = x.toString().split('.'); - if (parts.length < 2) { - return 1; - } - return Math.pow(10, parts[1].length); - } - - /** - * Given a variable number of arguments, returns the maximum - * multiplier that must be used to normalize an operation involving - * all of them. - */ - function correctionFactor() { - var args = Array.prototype.slice.call(arguments); - return args.reduce(function(prev, next) { - var mp = multiplier(prev), - mn = multiplier(next); - return mp > mn ? mp : mn; - }, -Infinity); - } - - /************************************ - Numbro Prototype - ************************************/ - - - numbro.fn = Numbro.prototype = { - - clone: function() { - return numbro(this); - }, - - format: function(inputString, roundingFunction) { - return formatNumbro(this, - inputString ? inputString : defaultFormat, - (roundingFunction !== undefined) ? roundingFunction : Math.round - ); - }, - - formatCurrency: function(inputString, roundingFunction) { - return formatCurrency(this, - cultures[currentCulture].currency.symbol, - inputString ? inputString : defaultCurrencyFormat, - (roundingFunction !== undefined) ? roundingFunction : Math.round - ); - }, - - formatForeignCurrency: function(currencySymbol, inputString, roundingFunction) { - return formatForeignCurrency(this, - currencySymbol, - inputString ? inputString : defaultCurrencyFormat, - (roundingFunction !== undefined) ? roundingFunction : Math.round - ); - }, - - unformat: function(inputString) { - if (typeof inputString === 'number') { - return inputString; - } else if (typeof inputString === 'string') { - var result = unformatNumbro(this, inputString); - - // Any unparseable string (represented as NaN in the result) is - // converted into undefined. - return isNaN(result) ? undefined : result; - } else { - return undefined; - } - }, - - binaryByteUnits: function() { - return formatByteUnits(this._value, bytes.binary.suffixes, bytes.binary.scale).suffix; - }, - - byteUnits: function() { - return formatByteUnits(this._value, bytes.general.suffixes, bytes.general.scale).suffix; - }, - - decimalByteUnits: function() { - return formatByteUnits(this._value, bytes.decimal.suffixes, bytes.decimal.scale).suffix; - }, - - value: function() { - return this._value; - }, - - valueOf: function() { - return this._value; - }, - - set: function(value) { - this._value = Number(value); - return this; - }, - - add: function(value) { - var corrFactor = correctionFactor.call(null, this._value, value); - - function cback(accum, curr) { - return accum + corrFactor * curr; - } - this._value = [this._value, value].reduce(cback, 0) / corrFactor; - return this; - }, - - subtract: function(value) { - var corrFactor = correctionFactor.call(null, this._value, value); - - function cback(accum, curr) { - return accum - corrFactor * curr; - } - this._value = [value].reduce(cback, this._value * corrFactor) / corrFactor; - return this; - }, - - multiply: function(value) { - function cback(accum, curr) { - var corrFactor = correctionFactor(accum, curr), - result = accum * corrFactor; - result *= curr * corrFactor; - result /= corrFactor * corrFactor; - return result; - } - this._value = [this._value, value].reduce(cback, 1); - return this; - }, - - divide: function(value) { - function cback(accum, curr) { - var corrFactor = correctionFactor(accum, curr); - return (accum * corrFactor) / (curr * corrFactor); - } - this._value = [this._value, value].reduce(cback); - return this; - }, - - difference: function(value) { - return Math.abs(numbro(this._value).subtract(value).value()); - } - - }; - - /************************************ - Exposing Numbro - ************************************/ - - if (inNodejsRuntime()) { - //Todo: Rename the folder in 2.0.0 - numbro.loadCulturesInNode(); - } - - // CommonJS module is defined - if (hasModule) { - module.exports = numbro; - } else { - /*global ender:false */ - if (typeof ender === 'undefined') { - // here, `this` means `window` in the browser, or `global` on the server - // add `numbro` as a global object via a string identifier, - // for Closure Compiler 'advanced' mode - this.numbro = numbro; - } - - /*global define:false */ - if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { - return numbro; - }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } - } - -}.call(typeof window === 'undefined' ? this : window)); - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10))) - -/***/ }), -/* 10 */ -/***/ (function(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); - } - } - + return (3600 * time_text.getHours() + 60 * time_text.getMinutes() + time_text.getSeconds()) / 86400; +}; +exports.TODAY = function() { + return new Date(); +}; -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; +exports.WEEKDAY = function(serial_number, return_type) { + serial_number = utils.parseDate(serial_number); + if (serial_number instanceof Error) { + return serial_number; + } + if (return_type === undefined) { + return_type = 1; + } + var day = serial_number.getDay(); -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; + return WEEK_TYPES[return_type][day]; +}; + +exports.WEEKNUM = function(serial_number, return_type) { + serial_number = utils.parseDate(serial_number); + if (serial_number instanceof Error) { + return serial_number; + } + if (return_type === undefined) { + return_type = 1; + } + if (return_type === 21) { + return this.ISOWEEKNUM(serial_number); + } + var week_start = WEEK_STARTS[return_type]; + var jan = new Date(serial_number.getFullYear(), 0, 1); + var inc = jan.getDay() < week_start ? 1 : 0; + jan -= Math.abs(jan.getDay() - week_start) * 24 * 60 * 60 * 1000; + + return Math.floor(((serial_number - jan) / (1000 * 60 * 60 * 24)) / 7 + 1) + inc; +}; + +exports.WORKDAY = function(start_date, days, holidays) { + return this.WORKDAY.INTL(start_date, days, 1, holidays); +}; + +exports.WORKDAY.INTL = function(start_date, days, weekend, holidays) { + start_date = utils.parseDate(start_date); + if (start_date instanceof Error) { + return start_date; + } + days = utils.parseNumber(days); + if (days instanceof Error) { + return days; + } + if (days < 0) { + return error.num; + } + if (weekend === undefined) { + weekend = WEEKEND_TYPES[1]; + } else { + weekend = WEEKEND_TYPES[weekend]; + } + if (!(weekend instanceof Array)) { + return error.value; + } + if (holidays === undefined) { + holidays = []; + } else if (!(holidays instanceof Array)) { + holidays = [holidays]; + } + for (var i = 0; i < holidays.length; i++) { + var h = utils.parseDate(holidays[i]); + if (h instanceof Error) { + return h; } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; + holidays[i] = h; + } + var d = 0; + while (d < days) { + start_date.setDate(start_date.getDate() + 1); + var day = start_date.getDay(); + if (day === weekend[0] || day === weekend[1]) { + continue; } - if (queue.length) { - drainQueue(); + for (var j = 0; j < holidays.length; j++) { + var holiday = holidays[j]; + if (holiday.getDate() === start_date.getDate() && + holiday.getMonth() === start_date.getMonth() && + holiday.getFullYear() === start_date.getFullYear()) { + d--; + break; + } } -} + d++; + } -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; + return start_date; +}; - 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); -} +exports.YEAR = function(serial_number) { + serial_number = utils.parseDate(serial_number); -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); - } + if (serial_number instanceof Error) { + return serial_number; + } + + return serial_number.getFullYear(); }; -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; +function isLeapYear(year) { + return new Date(year, 1, 29).getMonth() === 1; } -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() {} +// TODO : Use DAYS ? +function daysBetween(start_date, end_date) { + return Math.ceil((end_date - start_date) / 1000 / 60 / 60 / 24); +} -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; +exports.YEARFRAC = function(start_date, end_date, basis) { + start_date = utils.parseDate(start_date); + if (start_date instanceof Error) { + return start_date; + } + end_date = utils.parseDate(end_date); + if (end_date instanceof Error) { + return end_date; + } -process.listeners = function (name) { return [] } + basis = basis || 0; + var sd = start_date.getDate(); + var sm = start_date.getMonth() + 1; + var sy = start_date.getFullYear(); + var ed = end_date.getDate(); + var em = end_date.getMonth() + 1; + var ey = end_date.getFullYear(); -process.binding = function (name) { - throw new Error('process.binding is not supported'); + switch (basis) { + case 0: + // US (NASD) 30/360 + if (sd === 31 && ed === 31) { + sd = 30; + ed = 30; + } else if (sd === 31) { + sd = 30; + } else if (sd === 30 && ed === 31) { + ed = 30; + } + return ((ed + em * 30 + ey * 360) - (sd + sm * 30 + sy * 360)) / 360; + case 1: + // Actual/actual + var feb29Between = function(date1, date2) { + var year1 = date1.getFullYear(); + var mar1year1 = new Date(year1, 2, 1); + if (isLeapYear(year1) && date1 < mar1year1 && date2 >= mar1year1) { + return true; + } + var year2 = date2.getFullYear(); + var mar1year2 = new Date(year2, 2, 1); + return (isLeapYear(year2) && date2 >= mar1year2 && date1 < mar1year2); + }; + var ylength = 365; + if (sy === ey || ((sy + 1) === ey) && ((sm > em) || ((sm === em) && (sd >= ed)))) { + if ((sy === ey && isLeapYear(sy)) || + feb29Between(start_date, end_date) || + (em === 1 && ed === 29)) { + ylength = 366; + } + return daysBetween(start_date, end_date) / ylength; + } + var years = (ey - sy) + 1; + var days = (new Date(ey + 1, 0, 1) - new Date(sy, 0, 1)) / 1000 / 60 / 60 / 24; + var average = days / years; + return daysBetween(start_date, end_date) / average; + case 2: + // Actual/360 + return daysBetween(start_date, end_date) / 360; + case 3: + // Actual/365 + return daysBetween(start_date, end_date) / 365; + case 4: + // European 30/360 + return ((ed + em * 30 + ey * 360) - (sd + sm * 30 + sy * 360)) / 360; + } }; -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; +function serial(date) { + var addOn = (date > -2203891200000) ? 2 : 1; + + return Math.ceil((date - d1900) / 86400000) + addOn; +} /***/ }), -/* 11 */ +/* 9 */ /***/ (function(module, exports, __webpack_require__) { (function (window, factory) { @@ -10658,11 +9135,10 @@ jStat.models = (function(){ /***/ }), -/* 12 */ +/* 10 */ /***/ (function(module, exports, __webpack_require__) { var utils = __webpack_require__(1); -var numbro = __webpack_require__(9); var error = __webpack_require__(0); exports.UNIQUE = function () { @@ -10723,20 +9199,15 @@ exports.NUMBERS = function () { }); }; -exports.NUMERAL = function (number, format) { - return numbro(number).format(format); -}; - - /***/ }), -/* 13 */ +/* 11 */ /***/ (function(module, exports, __webpack_require__) { var error = __webpack_require__(0); -var jStat = __webpack_require__(11).jStat; +var jStat = __webpack_require__(9).jStat; var text = __webpack_require__(6); var utils = __webpack_require__(1); -var bessel = __webpack_require__(28); +var bessel = __webpack_require__(25); function isValidBinaryNumber(number) { return (/^[01]{1,10}$/).test(number); @@ -12297,19 +10768,19 @@ exports.OCT2HEX = function(number, places) { /***/ }), -/* 14 */ +/* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; -var SUPPORTED_FORMULAS = ['ABS', 'ACCRINT', 'ACOS', 'ACOSH', 'ACOT', 'ACOTH', 'ADD', 'AGGREGATE', 'AND', 'ARABIC', 'ARGS2ARRAY', 'ASIN', 'ASINH', 'ATAN', 'ATAN2', 'ATANH', 'AVEDEV', 'AVERAGE', 'AVERAGEA', 'AVERAGEIF', 'AVERAGEIFS', 'BASE', 'BESSELI', 'BESSELJ', 'BESSELK', 'BESSELY', 'BETA.DIST', 'BETA.INV', 'BETADIST', 'BETAINV', 'BIN2DEC', 'BIN2HEX', 'BIN2OCT', 'BINOM.DIST', 'BINOM.DIST.RANGE', 'BINOM.INV', 'BINOMDIST', 'BITAND', 'BITLSHIFT', 'BITOR', 'BITRSHIFT', 'BITXOR', 'CEILING', 'CEILINGMATH', 'CEILINGPRECISE', 'CHAR', 'CHISQ.DIST', 'CHISQ.DIST.RT', 'CHISQ.INV', 'CHISQ.INV.RT', 'CHOOSE', 'CHOOSE', 'CLEAN', 'CODE', 'COLUMN', 'COLUMNS', 'COMBIN', 'COMBINA', 'COMPLEX', 'CONCATENATE', 'CONFIDENCE', 'CONFIDENCE.NORM', 'CONFIDENCE.T', 'CONVERT', 'CORREL', 'COS', 'COSH', 'COT', 'COTH', 'COUNT', 'COUNTA', 'COUNTBLANK', 'COUNTIF', 'COUNTIFS', 'COUNTIN', 'COUNTUNIQUE', 'COVARIANCE.P', 'COVARIANCE.S', 'CSC', 'CSCH', 'CUMIPMT', 'CUMPRINC', 'DATE', 'DATEVALUE', 'DAY', 'DAYS', 'DAYS360', 'DB', 'DDB', 'DEC2BIN', 'DEC2HEX', 'DEC2OCT', 'DECIMAL', 'DEGREES', 'DELTA', 'DEVSQ', 'DIVIDE', 'DOLLAR', 'DOLLARDE', 'DOLLARFR', 'E', 'EDATE', 'EFFECT', 'EOMONTH', 'EQ', 'ERF', 'ERFC', 'EVEN', 'EXACT', 'EXP', 'EXPON.DIST', 'EXPONDIST', 'F.DIST', 'F.DIST.RT', 'F.INV', 'F.INV.RT', 'FACT', 'FACTDOUBLE', 'FALSE', 'FDIST', 'FDISTRT', 'FIND', 'FINV', 'FINVRT', 'FISHER', 'FISHERINV', 'FIXED', 'FLATTEN', 'FLOOR', 'FORECAST', 'FREQUENCY', 'FV', 'FVSCHEDULE', 'GAMMA', 'GAMMA.DIST', 'GAMMA.INV', 'GAMMADIST', 'GAMMAINV', 'GAMMALN', 'GAMMALN.PRECISE', 'GAUSS', 'GCD', 'GEOMEAN', 'GESTEP', 'GROWTH', 'GTE', 'HARMEAN', 'HEX2BIN', 'HEX2DEC', 'HEX2OCT', 'HOUR', 'HTML2TEXT', 'HYPGEOM.DIST', 'HYPGEOMDIST', 'IF', 'IMABS', 'IMAGINARY', 'IMARGUMENT', 'IMCONJUGATE', 'IMCOS', 'IMCOSH', 'IMCOT', 'IMCSC', 'IMCSCH', 'IMDIV', 'IMEXP', 'IMLN', 'IMLOG10', 'IMLOG2', 'IMPOWER', 'IMPRODUCT', 'IMREAL', 'IMSEC', 'IMSECH', 'IMSIN', 'IMSINH', 'IMSQRT', 'IMSUB', 'IMSUM', 'IMTAN', 'INT', 'INTERCEPT', 'INTERVAL', 'IPMT', 'IRR', 'ISBINARY', 'ISBLANK', 'ISEVEN', 'ISLOGICAL', 'ISNONTEXT', 'ISNUMBER', 'ISODD', 'ISODD', 'ISOWEEKNUM', 'ISPMT', 'ISTEXT', 'JOIN', 'KURT', 'LARGE', 'LCM', 'LEFT', 'LEN', 'LINEST', 'LN', 'LOG', 'LOG10', 'LOGEST', 'LOGNORM.DIST', 'LOGNORM.INV', 'LOGNORMDIST', 'LOGNORMINV', 'LOWER', 'LT', 'LTE', 'MATCH', 'MAX', 'MAXA', 'MEDIAN', 'MID', 'MIN', 'MINA', 'MINUS', 'MINUTE', 'MIRR', 'MOD', 'MODE.MULT', 'MODE.SNGL', 'MODEMULT', 'MODESNGL', 'MONTH', 'MROUND', 'MULTINOMIAL', 'MULTIPLY', 'NE', 'NEGBINOM.DIST', 'NEGBINOMDIST', 'NETWORKDAYS', 'NOMINAL', 'NORM.DIST', 'NORM.INV', 'NORM.S.DIST', 'NORM.S.INV', 'NORMDIST', 'NORMINV', 'NORMSDIST', 'NORMSINV', 'NOT', 'NOW', 'NPER', 'NPV', 'NUMBERS', 'NUMERAL', 'OCT2BIN', 'OCT2DEC', 'OCT2HEX', 'ODD', 'OR', 'PDURATION', 'PEARSON', 'PERCENTILEEXC', 'PERCENTILEINC', 'PERCENTRANKEXC', 'PERCENTRANKINC', 'PERMUT', 'PERMUTATIONA', 'PHI', 'PI', 'PMT', 'POISSON.DIST', 'POISSONDIST', 'POW', 'POWER', 'PPMT', 'PROB', 'PRODUCT', 'PROPER', 'PV', 'QUARTILE.EXC', 'QUARTILE.INC', 'QUARTILEEXC', 'QUARTILEINC', 'QUOTIENT', 'RADIANS', 'RAND', 'RANDBETWEEN', 'RANK.AVG', 'RANK.EQ', 'RANKAVG', 'RANKEQ', 'RATE', 'REFERENCE', 'REGEXEXTRACT', 'REGEXMATCH', 'REGEXREPLACE', 'REPLACE', 'REPT', 'RIGHT', 'ROMAN', 'ROUND', 'ROUNDDOWN', 'ROUNDUP', 'ROW', 'ROWS', 'RRI', 'RSQ', 'SEARCH', 'SEC', 'SECH', 'SECOND', 'SERIESSUM', 'SIGN', 'SIN', 'SINH', 'SKEW', 'SKEW.P', 'SKEWP', 'SLN', 'SLOPE', 'SMALL', 'SPLIT', 'SPLIT', 'SQRT', 'SQRTPI', 'STANDARDIZE', 'STDEV.P', 'STDEV.S', 'STDEVA', 'STDEVP', 'STDEVPA', 'STDEVS', 'STEYX', 'SUBSTITUTE', 'SUBTOTAL', 'SUM', 'SUMIF', 'SUMIFS', 'SUMPRODUCT', 'SUMSQ', 'SUMX2MY2', 'SUMX2PY2', 'SUMXMY2', 'SWITCH', 'SYD', 'T', 'T.DIST', 'T.DIST.2T', 'T.DIST.RT', 'T.INV', 'T.INV.2T', 'TAN', 'TANH', 'TBILLEQ', 'TBILLPRICE', 'TBILLYIELD', 'TDIST', 'TDIST2T', 'TDISTRT', 'TEXT', 'TIME', 'TIMEVALUE', 'TINV', 'TINV2T', 'TODAY', 'TRANSPOSE', 'TREND', 'TRIM', 'TRIMMEAN', 'TRUE', 'TRUNC', 'UNICHAR', 'UNICODE', 'UNIQUE', 'UPPER', 'VALUE', 'VAR.P', 'VAR.S', 'VARA', 'VARP', 'VARPA', 'VARS', 'WEEKDAY', 'WEEKNUM', 'WEIBULL.DIST', 'WEIBULLDIST', 'WORKDAY', 'XIRR', 'XNPV', 'XOR', 'YEAR', 'YEARFRAC']; +var SUPPORTED_FORMULAS = ['ABS', 'ACCRINT', 'ACOS', 'ACOSH', 'ACOT', 'ACOTH', 'ADD', 'AGGREGATE', 'AND', 'ARABIC', 'ARGS2ARRAY', 'ASIN', 'ASINH', 'ATAN', 'ATAN2', 'ATANH', 'AVEDEV', 'AVERAGE', 'AVERAGEA', 'AVERAGEIF', 'AVERAGEIFS', 'BASE', 'BESSELI', 'BESSELJ', 'BESSELK', 'BESSELY', 'BETA.DIST', 'BETA.INV', 'BETADIST', 'BETAINV', 'BIN2DEC', 'BIN2HEX', 'BIN2OCT', 'BINOM.DIST', 'BINOM.DIST.RANGE', 'BINOM.INV', 'BINOMDIST', 'BITAND', 'BITLSHIFT', 'BITOR', 'BITRSHIFT', 'BITXOR', 'CEILING', 'CEILINGMATH', 'CEILINGPRECISE', 'CHAR', 'CHISQ.DIST', 'CHISQ.DIST.RT', 'CHISQ.INV', 'CHISQ.INV.RT', 'CHOOSE', 'CHOOSE', 'CLEAN', 'CODE', 'COLUMN', 'COLUMNS', 'COMBIN', 'COMBINA', 'COMPLEX', 'CONCATENATE', 'CONFIDENCE', 'CONFIDENCE.NORM', 'CONFIDENCE.T', 'CONVERT', 'CORREL', 'COS', 'COSH', 'COT', 'COTH', 'COUNT', 'COUNTA', 'COUNTBLANK', 'COUNTIF', 'COUNTIFS', 'COUNTIN', 'COUNTUNIQUE', 'COVARIANCE.P', 'COVARIANCE.S', 'CSC', 'CSCH', 'CUMIPMT', 'CUMPRINC', 'DATE', 'DATEVALUE', 'DAY', 'DAYS', 'DAYS360', 'DB', 'DDB', 'DEC2BIN', 'DEC2HEX', 'DEC2OCT', 'DECIMAL', 'DEGREES', 'DELTA', 'DEVSQ', 'DIVIDE', 'DOLLARDE', 'DOLLARFR', 'E', 'EDATE', 'EFFECT', 'EOMONTH', 'EQ', 'ERF', 'ERFC', 'EVEN', 'EXACT', 'EXP', 'EXPON.DIST', 'EXPONDIST', 'F.DIST', 'F.DIST.RT', 'F.INV', 'F.INV.RT', 'FACT', 'FACTDOUBLE', 'FALSE', 'FDIST', 'FDISTRT', 'FIND', 'FINV', 'FINVRT', 'FISHER', 'FISHERINV', 'FLATTEN', 'FLOOR', 'FORECAST', 'FREQUENCY', 'FV', 'FVSCHEDULE', 'GAMMA', 'GAMMA.DIST', 'GAMMA.INV', 'GAMMADIST', 'GAMMAINV', 'GAMMALN', 'GAMMALN.PRECISE', 'GAUSS', 'GCD', 'GEOMEAN', 'GESTEP', 'GROWTH', 'GTE', 'HARMEAN', 'HEX2BIN', 'HEX2DEC', 'HEX2OCT', 'HOUR', 'HTML2TEXT', 'HYPGEOM.DIST', 'HYPGEOMDIST', 'IF', 'IMABS', 'IMAGINARY', 'IMARGUMENT', 'IMCONJUGATE', 'IMCOS', 'IMCOSH', 'IMCOT', 'IMCSC', 'IMCSCH', 'IMDIV', 'IMEXP', 'IMLN', 'IMLOG10', 'IMLOG2', 'IMPOWER', 'IMPRODUCT', 'IMREAL', 'IMSEC', 'IMSECH', 'IMSIN', 'IMSINH', 'IMSQRT', 'IMSUB', 'IMSUM', 'IMTAN', 'INT', 'INTERCEPT', 'INTERVAL', 'IPMT', 'IRR', 'ISBINARY', 'ISBLANK', 'ISEVEN', 'ISLOGICAL', 'ISNONTEXT', 'ISNUMBER', 'ISODD', 'ISODD', 'ISOWEEKNUM', 'ISPMT', 'ISTEXT', 'JOIN', 'KURT', 'LARGE', 'LCM', 'LEFT', 'LEN', 'LINEST', 'LN', 'LOG', 'LOG10', 'LOGEST', 'LOGNORM.DIST', 'LOGNORM.INV', 'LOGNORMDIST', 'LOGNORMINV', 'LOWER', 'LT', 'LTE', 'MATCH', 'MAX', 'MAXA', 'MEDIAN', 'MID', 'MIN', 'MINA', 'MINUS', 'MINUTE', 'MIRR', 'MOD', 'MODE.MULT', 'MODE.SNGL', 'MODEMULT', 'MODESNGL', 'MONTH', 'MROUND', 'MULTINOMIAL', 'MULTIPLY', 'NE', 'NEGBINOM.DIST', 'NEGBINOMDIST', 'NETWORKDAYS', 'NOMINAL', 'NORM.DIST', 'NORM.INV', 'NORM.S.DIST', 'NORM.S.INV', 'NORMDIST', 'NORMINV', 'NORMSDIST', 'NORMSINV', 'NOT', 'NOW', 'NPER', 'NPV', 'NUMBERS', 'OCT2BIN', 'OCT2DEC', 'OCT2HEX', 'ODD', 'OR', 'PDURATION', 'PEARSON', 'PERCENTILEEXC', 'PERCENTILEINC', 'PERCENTRANKEXC', 'PERCENTRANKINC', 'PERMUT', 'PERMUTATIONA', 'PHI', 'PI', 'PMT', 'POISSON.DIST', 'POISSONDIST', 'POW', 'POWER', 'PPMT', 'PROB', 'PRODUCT', 'PROPER', 'PV', 'QUARTILE.EXC', 'QUARTILE.INC', 'QUARTILEEXC', 'QUARTILEINC', 'QUOTIENT', 'RADIANS', 'RAND', 'RANDBETWEEN', 'RANK.AVG', 'RANK.EQ', 'RANKAVG', 'RANKEQ', 'RATE', 'REFERENCE', 'REGEXEXTRACT', 'REGEXMATCH', 'REGEXREPLACE', 'REPLACE', 'REPT', 'RIGHT', 'ROMAN', 'ROUND', 'ROUNDDOWN', 'ROUNDUP', 'ROW', 'ROWS', 'RRI', 'RSQ', 'SEARCH', 'SEC', 'SECH', 'SECOND', 'SERIESSUM', 'SIGN', 'SIN', 'SINH', 'SKEW', 'SKEW.P', 'SKEWP', 'SLN', 'SLOPE', 'SMALL', 'SPLIT', 'SPLIT', 'SQRT', 'SQRTPI', 'STANDARDIZE', 'STDEV.P', 'STDEV.S', 'STDEVA', 'STDEVP', 'STDEVPA', 'STDEVS', 'STEYX', 'SUBSTITUTE', 'SUBTOTAL', 'SUM', 'SUMIF', 'SUMIFS', 'SUMPRODUCT', 'SUMSQ', 'SUMX2MY2', 'SUMX2PY2', 'SUMXMY2', 'SWITCH', 'SYD', 'T', 'T.DIST', 'T.DIST.2T', 'T.DIST.RT', 'T.INV', 'T.INV.2T', 'TAN', 'TANH', 'TBILLEQ', 'TBILLPRICE', 'TBILLYIELD', 'TDIST', 'TDIST2T', 'TDISTRT', 'TIME', 'TIMEVALUE', 'TINV', 'TINV2T', 'TODAY', 'TRANSPOSE', 'TREND', 'TRIM', 'TRIMMEAN', 'TRUE', 'TRUNC', 'UNICHAR', 'UNICODE', 'UNIQUE', 'UPPER', 'VAR.P', 'VAR.S', 'VARA', 'VARP', 'VARPA', 'VARS', 'WEEKDAY', 'WEEKNUM', 'WEIBULL.DIST', 'WEIBULLDIST', 'WORKDAY', 'XIRR', 'XNPV', 'XOR', 'YEAR', 'YEARFRAC']; exports['default'] = SUPPORTED_FORMULAS; /***/ }), -/* 15 */ +/* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12442,7 +10913,7 @@ function toLabel(row, column) { } /***/ }), -/* 16 */ +/* 14 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12451,11 +10922,11 @@ function toLabel(row, column) { exports.__esModule = true; exports.rowLabelToIndex = exports.rowIndexToLabel = exports.columnLabelToIndex = exports.columnIndexToLabel = exports.toLabel = exports.extractLabel = exports.error = exports.Parser = exports.ERROR_VALUE = exports.ERROR_REF = exports.ERROR_NUM = exports.ERROR_NULL = exports.ERROR_NOT_AVAILABLE = exports.ERROR_NAME = exports.ERROR_DIV_ZERO = exports.ERROR = exports.SUPPORTED_FORMULAS = undefined; -var _parser = __webpack_require__(17); +var _parser = __webpack_require__(15); var _parser2 = _interopRequireDefault(_parser); -var _supportedFormulas = __webpack_require__(14); +var _supportedFormulas = __webpack_require__(12); var _supportedFormulas2 = _interopRequireDefault(_supportedFormulas); @@ -12463,7 +10934,7 @@ var _error = __webpack_require__(2); var _error2 = _interopRequireDefault(_error); -var _cell = __webpack_require__(15); +var _cell = __webpack_require__(13); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } @@ -12486,7 +10957,7 @@ exports.rowIndexToLabel = _cell.rowIndexToLabel; exports.rowLabelToIndex = _cell.rowLabelToIndex; /***/ }), -/* 17 */ +/* 15 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12494,17 +10965,17 @@ exports.rowLabelToIndex = _cell.rowLabelToIndex; exports.__esModule = true; -var _tinyEmitter = __webpack_require__(18); +var _tinyEmitter = __webpack_require__(16); var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter); -var _evaluateByOperator = __webpack_require__(19); +var _evaluateByOperator = __webpack_require__(17); var _evaluateByOperator2 = _interopRequireDefault(_evaluateByOperator); -var _grammarParser = __webpack_require__(41); +var _grammarParser = __webpack_require__(38); -var _string = __webpack_require__(43); +var _string = __webpack_require__(41); var _number = __webpack_require__(3); @@ -12512,7 +10983,7 @@ var _error = __webpack_require__(2); var _error2 = _interopRequireDefault(_error); -var _cell = __webpack_require__(15); +var _cell = __webpack_require__(13); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } @@ -12812,7 +11283,7 @@ var Parser = function (_Emitter) { exports['default'] = Parser; /***/ }), -/* 18 */ +/* 16 */ /***/ (function(module, exports) { function E () { @@ -12884,7 +11355,7 @@ module.exports = E; /***/ }), -/* 19 */ +/* 17 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12894,55 +11365,55 @@ exports.__esModule = true; exports['default'] = evaluateByOperator; exports.registerOperation = registerOperation; -var _add = __webpack_require__(20); +var _add = __webpack_require__(18); var _add2 = _interopRequireDefault(_add); -var _ampersand = __webpack_require__(21); +var _ampersand = __webpack_require__(19); var _ampersand2 = _interopRequireDefault(_ampersand); -var _divide = __webpack_require__(22); +var _divide = __webpack_require__(20); var _divide2 = _interopRequireDefault(_divide); -var _equal = __webpack_require__(23); +var _equal = __webpack_require__(21); var _equal2 = _interopRequireDefault(_equal); -var _formulaFunction = __webpack_require__(24); +var _formulaFunction = __webpack_require__(22); var _formulaFunction2 = _interopRequireDefault(_formulaFunction); -var _greaterThan = __webpack_require__(33); +var _greaterThan = __webpack_require__(30); var _greaterThan2 = _interopRequireDefault(_greaterThan); -var _greaterThanOrEqual = __webpack_require__(34); +var _greaterThanOrEqual = __webpack_require__(31); var _greaterThanOrEqual2 = _interopRequireDefault(_greaterThanOrEqual); -var _lessThan = __webpack_require__(35); +var _lessThan = __webpack_require__(32); var _lessThan2 = _interopRequireDefault(_lessThan); -var _lessThanOrEqual = __webpack_require__(36); +var _lessThanOrEqual = __webpack_require__(33); var _lessThanOrEqual2 = _interopRequireDefault(_lessThanOrEqual); -var _minus = __webpack_require__(37); +var _minus = __webpack_require__(34); var _minus2 = _interopRequireDefault(_minus); -var _multiply = __webpack_require__(38); +var _multiply = __webpack_require__(35); var _multiply2 = _interopRequireDefault(_multiply); -var _notEqual = __webpack_require__(39); +var _notEqual = __webpack_require__(36); var _notEqual2 = _interopRequireDefault(_notEqual); -var _power = __webpack_require__(40); +var _power = __webpack_require__(37); var _power2 = _interopRequireDefault(_power); @@ -13006,7 +11477,7 @@ registerOperation(_notEqual2['default'].SYMBOL, _notEqual2['default']); registerOperation(_minus2['default'].SYMBOL, _minus2['default']); /***/ }), -/* 20 */ +/* 18 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13041,7 +11512,7 @@ function func(first) { func.SYMBOL = SYMBOL; /***/ }), -/* 21 */ +/* 19 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13064,7 +11535,7 @@ function func() { func.SYMBOL = SYMBOL; /***/ }), -/* 22 */ +/* 20 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13102,7 +11573,7 @@ function func(first) { func.SYMBOL = SYMBOL; /***/ }), -/* 23 */ +/* 21 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13119,7 +11590,7 @@ function func(exp1, exp2) { func.SYMBOL = SYMBOL; /***/ }), -/* 24 */ +/* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13129,11 +11600,11 @@ exports.__esModule = true; exports.SYMBOL = undefined; exports['default'] = func; -var _formulajs = __webpack_require__(25); +var _formulajs = __webpack_require__(23); var formulajs = _interopRequireWildcard(_formulajs); -var _supportedFormulas = __webpack_require__(14); +var _supportedFormulas = __webpack_require__(12); var _supportedFormulas2 = _interopRequireDefault(_supportedFormulas); @@ -13190,22 +11661,22 @@ func.isFactory = true; func.SYMBOL = SYMBOL; /***/ }), -/* 25 */ +/* 23 */ /***/ (function(module, exports, __webpack_require__) { var categories = [ + __webpack_require__(24), __webpack_require__(26), - __webpack_require__(29), - __webpack_require__(13), - __webpack_require__(30), + __webpack_require__(11), + __webpack_require__(27), __webpack_require__(4), __webpack_require__(6), __webpack_require__(8), - __webpack_require__(31), + __webpack_require__(28), __webpack_require__(7), - __webpack_require__(32), + __webpack_require__(29), __webpack_require__(5), - __webpack_require__(12) + __webpack_require__(10) ]; for (var c in categories) { @@ -13217,12 +11688,12 @@ for (var c in categories) { /***/ }), -/* 26 */ +/* 24 */ /***/ (function(module, exports, __webpack_require__) { var mathTrig = __webpack_require__(4); var statistical = __webpack_require__(5); -var engineering = __webpack_require__(13); +var engineering = __webpack_require__(11); var dateTime = __webpack_require__(8); function set(fn, root) { @@ -13310,13 +11781,7 @@ exports.ZTEST = statistical.Z.TEST; /***/ }), -/* 27 */ -/***/ (function(module, exports) { - - - -/***/ }), -/* 28 */ +/* 25 */ /***/ (function(module, exports, __webpack_require__) { var M = Math; @@ -13531,7 +11996,7 @@ if(true) { /***/ }), -/* 29 */ +/* 26 */ /***/ (function(module, exports, __webpack_require__) { var error = __webpack_require__(0); @@ -13924,7 +12389,7 @@ exports.DVARP = function(database, field, criteria) { /***/ }), -/* 30 */ +/* 27 */ /***/ (function(module, exports, __webpack_require__) { var error = __webpack_require__(0); @@ -14041,7 +12506,7 @@ exports.SWITCH = function () { /***/ }), -/* 31 */ +/* 28 */ /***/ (function(module, exports, __webpack_require__) { var error = __webpack_require__(0); @@ -15137,7 +13602,7 @@ exports.YIELDMAT = function() { /***/ }), -/* 32 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { var error = __webpack_require__(0); @@ -15243,7 +13708,7 @@ exports.HLOOKUP = function (needle, table, index, rangeLookup) { /***/ }), -/* 33 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15260,7 +13725,7 @@ function func(exp1, exp2) { func.SYMBOL = SYMBOL; /***/ }), -/* 34 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15277,7 +13742,7 @@ function func(exp1, exp2) { func.SYMBOL = SYMBOL; /***/ }), -/* 35 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15294,7 +13759,7 @@ function func(exp1, exp2) { func.SYMBOL = SYMBOL; /***/ }), -/* 36 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15311,7 +13776,7 @@ function func(exp1, exp2) { func.SYMBOL = SYMBOL; /***/ }), -/* 37 */ +/* 34 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15346,7 +13811,7 @@ function func(first) { func.SYMBOL = SYMBOL; /***/ }), -/* 38 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15381,7 +13846,7 @@ function func(first) { func.SYMBOL = SYMBOL; /***/ }), -/* 39 */ +/* 36 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15398,7 +13863,7 @@ function func(exp1, exp2) { func.SYMBOL = SYMBOL; /***/ }), -/* 40 */ +/* 37 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15427,7 +13892,7 @@ function func(exp1, exp2) { func.SYMBOL = SYMBOL; /***/ }), -/* 41 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module, process) {/* parser generated by jison 0.4.17 */ @@ -16377,10 +14842,10 @@ if (typeof module !== 'undefined' && __webpack_require__.c[__webpack_require__.s } } -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(42)(module), __webpack_require__(10))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(39)(module), __webpack_require__(40))) /***/ }), -/* 42 */ +/* 39 */ /***/ (function(module, exports) { module.exports = function(module) { @@ -16408,7 +14873,197 @@ module.exports = function(module) { /***/ }), -/* 43 */ +/* 40 */ +/***/ (function(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; }; + + +/***/ }), +/* 41 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; diff --git a/dist/formula-parser.min.js b/dist/formula-parser.min.js index 2a5cad78..593b63b2 100644 --- a/dist/formula-parser.min.js +++ b/dist/formula-parser.min.js @@ -1,8 +1 @@ -!function(r,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.formulaParser=e():r.formulaParser=e()}("undefined"!=typeof self?self:this,function(){return function(r){function e(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return r[n].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var t={};return e.m=r,e.c=t,e.d=function(r,t,n){e.o(r,t)||Object.defineProperty(r,t,{configurable:!1,enumerable:!0,get:n})},e.n=function(r){var t=r&&r.__esModule?function(){return r["default"]}:function(){return r};return e.d(t,"a",t),t},e.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},e.p="",e(e.s=16)}([function(r,e){e.nil=Error("#NULL!"),e.div0=Error("#DIV/0!"),e.value=Error("#VALUE!"),e.ref=Error("#REF!"),e.name=Error("#NAME?"),e.num=Error("#NUM!"),e.na=Error("#N/A"),e.error=Error("#ERROR!"),e.data=Error("#GETTING_DATA")},function(r,e,t){var n=t(0);e.flattenShallow=function(r){return r&&r.reduce?r.reduce(function(r,e){var t=Array.isArray(r),n=Array.isArray(e);return t&&n?r.concat(e):t?(r.push(e),r):n?[r].concat(e):[r,e]}):r},e.isFlat=function(r){if(!r)return!1;for(var e=0;r.length>e;++e)if(Array.isArray(r[e]))return!1;return!0},e.flatten=function(){for(var r=e.argsToArray.apply(null,arguments);!e.isFlat(r);)r=e.flattenShallow(r);return r},e.argsToArray=function(r){var t=[];return e.arrayEach(r,function(r){t.push(r)}),t},e.numbers=function(){return this.flatten.apply(null,arguments).filter(function(r){return"number"==typeof r})},e.cleanFloat=function(r){return Math.round(1e14*r)/1e14},e.parseBool=function(r){if("boolean"==typeof r)return r;if(r instanceof Error)return r;if("number"==typeof r)return 0!==r;if("string"==typeof r){var e=r.toUpperCase();if("TRUE"===e)return!0;if("FALSE"===e)return!1}return r instanceof Date&&!isNaN(r)||n.value},e.parseNumber=function(r){return r===undefined||""===r?n.value:isNaN(r)?n.value:parseFloat(r)},e.parseNumberArray=function(r){var t;if(!r||0===(t=r.length))return n.value;for(var a;t--;){if((a=e.parseNumber(r[t]))===n.value)return a;r[t]=a}return r},e.parseMatrix=function(r){if(!r||0===r.length)return n.value;for(var t,a=0;r.length>a;a++)if(t=e.parseNumberArray(r[a]),r[a]=t,t instanceof Error)return t;return r};var a=new Date(1900,0,1);e.parseDate=function(r){if(!isNaN(r)){if(r instanceof Date)return new Date(r);var e=parseInt(r,10);return 0>e?n.num:e>60?new Date(a.getTime()+864e5*(e-2)):new Date(a.getTime()+864e5*(e-1))}return"string"!=typeof r||(r=new Date(r),isNaN(r))?n.value:r},e.parseDateArray=function(r){for(var e,t=r.length;t--;){if((e=this.parseDate(r[t]))===n.value)return e;r[t]=e}return r},e.anyIsError=function(){for(var r=arguments.length;r--;)if(arguments[r]instanceof Error)return!0;return!1},e.arrayValuesToNumbers=function(r){for(var e,t=r.length;t--;)if("number"!=typeof(e=r[t]))if(!0!==e)if(!1!==e){if("string"==typeof e){var n=this.parseNumber(e);r[t]=n instanceof Error?0:n}}else r[t]=0;else r[t]=1;return r},e.rest=function(r,e){return e=e||1,r&&"function"==typeof r.slice?r.slice(e):r},e.initial=function(r,e){return e=e||1,r&&"function"==typeof r.slice?r.slice(0,r.length-e):r},e.arrayEach=function(r,e){for(var t=-1,n=r.length;++t-1?parseFloat(r):parseInt(r,10)),e}function a(r){return-1*n(r)}e.__esModule=!0,e.toNumber=n,e.invertNumber=a},function(module,exports,__webpack_require__){var utils=__webpack_require__(1),error=__webpack_require__(0),statistical=__webpack_require__(5),information=__webpack_require__(7);exports.ABS=function(r){return(r=utils.parseNumber(r))instanceof Error?r:Math.abs(r)},exports.ACOS=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.acos(r);return isNaN(e)&&(e=error.num),e},exports.ACOSH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.log(r+Math.sqrt(r*r-1));return isNaN(e)&&(e=error.num),e},exports.ACOT=function(r){return(r=utils.parseNumber(r))instanceof Error?r:Math.atan(1/r)},exports.ACOTH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=.5*Math.log((r+1)/(r-1));return isNaN(e)&&(e=error.num),e},exports.AGGREGATE=function(r,e,t,n){if(r=utils.parseNumber(r),e=utils.parseNumber(r),utils.anyIsError(r,e))return error.value;switch(r){case 1:return statistical.AVERAGE(t);case 2:return statistical.COUNT(t);case 3:return statistical.COUNTA(t);case 4:return statistical.MAX(t);case 5:return statistical.MIN(t);case 6:return exports.PRODUCT(t);case 7:return statistical.STDEV.S(t);case 8:return statistical.STDEV.P(t);case 9:return exports.SUM(t);case 10:return statistical.VAR.S(t);case 11:return statistical.VAR.P(t);case 12:return statistical.MEDIAN(t);case 13:return statistical.MODE.SNGL(t);case 14:return statistical.LARGE(t,n);case 15:return statistical.SMALL(t,n);case 16:return statistical.PERCENTILE.INC(t,n);case 17:return statistical.QUARTILE.INC(t,n);case 18:return statistical.PERCENTILE.EXC(t,n);case 19:return statistical.QUARTILE.EXC(t,n)}},exports.ARABIC=function(r){if(!/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/.test(r))return error.value;var e=0;return r.replace(/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g,function(r){e+={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1}[r]}),e},exports.ASIN=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.asin(r);return isNaN(e)&&(e=error.num),e},exports.ASINH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log(r+Math.sqrt(r*r+1))},exports.ATAN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.atan(r)},exports.ATAN2=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:Math.atan2(r,e)},exports.ATANH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.log((1+r)/(1-r))/2;return isNaN(e)&&(e=error.num),e},exports.BASE=function(r,e,t){if(t=t||0,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;t=t===undefined?0:t;var n=r.toString(e);return Array(Math.max(t+1-n.length,0)).join("0")+n},exports.CEILING=function(r,e,t){if(e=e===undefined?1:Math.abs(e),t=t||0,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;if(0===e)return 0;var n=-Math.floor(Math.log(e)/Math.log(10));return 0>r?0===t?-exports.ROUND(Math.floor(Math.abs(r)/e)*e,n):-exports.ROUND(Math.ceil(Math.abs(r)/e)*e,n):exports.ROUND(Math.ceil(r/e)*e,n)},exports.CEILING.MATH=exports.CEILING,exports.CEILING.PRECISE=exports.CEILING,exports.COMBIN=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:exports.FACT(r)/(exports.FACT(e)*exports.FACT(r-e))},exports.COMBINA=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:0===r&&0===e?1:exports.COMBIN(r+e-1,r-1)},exports.COS=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.cos(r)},exports.COSH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:(Math.exp(r)+Math.exp(-r))/2},exports.COT=function(r){return r=utils.parseNumber(r),r instanceof Error?r:1/Math.tan(r)},exports.COTH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.exp(2*r);return(e+1)/(e-1)},exports.CSC=function(r){return r=utils.parseNumber(r),r instanceof Error?r:1/Math.sin(r)},exports.CSCH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:2/(Math.exp(r)-Math.exp(-r))},exports.DECIMAL=function(r,e){return 1>arguments.length?error.value:parseInt(r,e)},exports.DEGREES=function(r){return r=utils.parseNumber(r),r instanceof Error?r:180*r/Math.PI},exports.EVEN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:exports.CEILING(r,-2,-1)},exports.EXP=function(r){return 1>arguments.length?error.na:"number"!=typeof r||arguments.length>1?error.error:r=Math.exp(r)};var MEMOIZED_FACT=[];exports.FACT=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.floor(r);return 0===e||1===e?1:MEMOIZED_FACT[e]>0?MEMOIZED_FACT[e]:MEMOIZED_FACT[e]=exports.FACT(e-1)*e},exports.FACTDOUBLE=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.floor(r);return e>0?e*exports.FACTDOUBLE(e-2):1},exports.FLOOR=function(r,e){if(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;if(0===e)return 0;if(!(r>0&&e>0||0>r&&0>e))return error.num;e=Math.abs(e);var t=-Math.floor(Math.log(e)/Math.log(10));return 0>r?-exports.ROUND(Math.ceil(Math.abs(r)/e),t):exports.ROUND(Math.floor(r/e)*e,t)},exports.FLOOR.MATH=function(r,e,t){if(e=e===undefined?1:e,t=t===undefined?0:t,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;if(0===e)return 0;e=e?Math.abs(e):1;var n=-Math.floor(Math.log(e)/Math.log(10));return 0>r?0===t||t===undefined?-exports.ROUND(Math.ceil(Math.abs(r)/e)*e,n):-exports.ROUND(Math.floor(Math.abs(r)/e)*e,n):exports.ROUND(Math.floor(r/e)*e,n)},exports.FLOOR.PRECISE=exports.FLOOR.MATH,exports.GCD=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=r.length,t=r[0],n=0>t?-t:t,a=1;e>a;a++){for(var u=r[a],i=0>u?-u:u;n&&i;)n>i?n%=i:i%=n;n+=i}return n},exports.INT=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.floor(r)},exports.ISO={CEILING:exports.CEILING},exports.LCM=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e,t,n,a,u=1;(n=r.pop())!==undefined;)for(;n>1;){if(n%2){for(e=3,t=Math.floor(Math.sqrt(n));t>=e&&n%e;e+=2);a=e>t?n:e}else a=2;for(n/=a,u*=a,e=r.length;e;r[--e]%a==0&&1==(r[e]/=a)&&r.splice(e,1));}return u},exports.LN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log(r)},exports.LN10=function(){return Math.log(10)},exports.LN2=function(){return Math.log(2)},exports.LOG10E=function(){return Math.LOG10E},exports.LOG2E=function(){return Math.LOG2E},exports.LOG=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:(e=e===undefined?10:e,Math.log(r)/Math.log(e))},exports.LOG10=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log(r)/Math.log(10)},exports.MOD=function(r,e){if(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;if(0===e)return error.div0;var t=Math.abs(r%e);return e>0?t:-t},exports.MROUND=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:0>r*e?error.num:Math.round(r/e)*e},exports.MULTINOMIAL=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=0,t=1,n=0;r.length>n;n++)e+=r[n],t*=exports.FACT(r[n]);return exports.FACT(e)/t},exports.ODD=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.ceil(Math.abs(r));return e=1&e?e:e+1,r>0?e:-e},exports.PI=function(){return Math.PI},exports.E=function(){return Math.E},exports.POWER=function(r,e){if(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;var t=Math.pow(r,e);return isNaN(t)?error.num:t},exports.PRODUCT=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=1,t=0;r.length>t;t++)e*=r[t];return e},exports.QUOTIENT=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:parseInt(r/e,10)},exports.RADIANS=function(r){return r=utils.parseNumber(r),r instanceof Error?r:r*Math.PI/180},exports.RAND=function(){return Math.random()},exports.RANDBETWEEN=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:r+Math.ceil((e-r+1)*Math.random())-1},exports.ROMAN=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;for(var e=(r+"").split(""),t=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"],n="",a=3;a--;)n=(t[+e.pop()+10*a]||"")+n;return Array(+e.join("")+1).join("M")+n},exports.ROUND=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:Math.round(r*Math.pow(10,e))/Math.pow(10,e)},exports.ROUNDDOWN=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:(r>0?1:-1)*Math.floor(Math.abs(r)*Math.pow(10,e))/Math.pow(10,e)},exports.ROUNDUP=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:(r>0?1:-1)*Math.ceil(Math.abs(r)*Math.pow(10,e))/Math.pow(10,e)},exports.SEC=function(r){return r=utils.parseNumber(r),r instanceof Error?r:1/Math.cos(r)},exports.SECH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:2/(Math.exp(r)+Math.exp(-r))},exports.SERIESSUM=function(r,e,t,n){if(r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumberArray(n),utils.anyIsError(r,e,t,n))return error.value;for(var a=n[0]*Math.pow(r,e),u=1;n.length>u;u++)a+=n[u]*Math.pow(r,e+u*t);return a},exports.SIGN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:0>r?-1:0===r?0:1},exports.SIN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.sin(r)},exports.SINH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:(Math.exp(r)-Math.exp(-r))/2},exports.SQRT=function(r){return r=utils.parseNumber(r),r instanceof Error?r:0>r?error.num:Math.sqrt(r)},exports.SQRTPI=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.sqrt(r*Math.PI)},exports.SQRT1_2=function(){return 1/Math.sqrt(2)},exports.SQRT2=function(){return Math.sqrt(2)},exports.SUBTOTAL=function(r,e){if((r=utils.parseNumber(r))instanceof Error)return r;switch(r){case 1:return statistical.AVERAGE(e);case 2:return statistical.COUNT(e);case 3:return statistical.COUNTA(e);case 4:return statistical.MAX(e);case 5:return statistical.MIN(e);case 6:return exports.PRODUCT(e);case 7:return statistical.STDEV.S(e);case 8:return statistical.STDEV.P(e);case 9:return exports.SUM(e);case 10:return statistical.VAR.S(e);case 11:return statistical.VAR.P(e);case 101:return statistical.AVERAGE(e);case 102:return statistical.COUNT(e);case 103:return statistical.COUNTA(e);case 104:return statistical.MAX(e);case 105:return statistical.MIN(e);case 106:return exports.PRODUCT(e);case 107:return statistical.STDEV.S(e);case 108:return statistical.STDEV.P(e);case 109:return exports.SUM(e);case 110:return statistical.VAR.S(e);case 111:return statistical.VAR.P(e)}},exports.ADD=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:r+e)},exports.MINUS=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:r-e)},exports.DIVIDE=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:0===e?error.div0:r/e)},exports.MULTIPLY=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:r*e)},exports.GTE=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.error:r>=e)},exports.LT=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.error:e>r)},exports.LTE=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.error:e>=r)},exports.EQ=function(r,e){return 2!==arguments.length?error.na:r===e},exports.NE=function(r,e){return 2!==arguments.length?error.na:r!==e},exports.POW=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.error:exports.POWER(r,e))},exports.SUM=function(){var r=0;return utils.arrayEach(utils.argsToArray(arguments),function(e){if("number"==typeof e)r+=e;else if("string"==typeof e){var t=parseFloat(e);!isNaN(t)&&(r+=t)}else Array.isArray(e)&&(r+=exports.SUM.apply(null,e))}),r},exports.SUMIF=function(range,criteria){if((range=utils.parseNumberArray(utils.flatten(range)))instanceof Error)return range;for(var result=0,i=0;range.length>i;i++)result+=eval(range[i]+criteria)?range[i]:0;return result},exports.SUMIFS=function(){var args=utils.argsToArray(arguments),range=utils.parseNumberArray(utils.flatten(args.shift()));if(range instanceof Error)return range;for(var criteria=args,n_range_elements=range.length,n_criterias=criteria.length,result=0,i=0;n_range_elements>i;i++){for(var el=range[i],condition="",c=0;n_criterias>c;c++)condition+=el+criteria[c],c!==n_criterias-1&&(condition+="&&");eval(condition)&&(result+=el)}return result},exports.SUMPRODUCT=function(){if(!arguments||0===arguments.length)return error.value;for(var r,e,t,n,a=arguments.length+1,u=0,i=0;arguments[0].length>i;i++)if(arguments[0][i]instanceof Array)for(var o=0;arguments[0][i].length>o;o++){for(r=1,e=1;a>e;e++){if((n=utils.parseNumber(arguments[e-1][i][o]))instanceof Error)return n;r*=n}u+=r}else{for(r=1,e=1;a>e;e++){if((t=utils.parseNumber(arguments[e-1][i]))instanceof Error)return t;r*=t}u+=r}return u},exports.SUMSQ=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=0,t=r.length,n=0;t>n;n++)e+=information.ISNUMBER(r[n])?r[n]*r[n]:0;return e},exports.SUMX2MY2=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=0,n=0;r.length>n;n++)t+=r[n]*r[n]-e[n]*e[n];return t},exports.SUMX2PY2=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;var t=0;r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e));for(var n=0;r.length>n;n++)t+=r[n]*r[n]+e[n]*e[n];return t},exports.SUMXMY2=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;var t=0;r=utils.flatten(r),e=utils.flatten(e);for(var n=0;r.length>n;n++)t+=Math.pow(r[n]-e[n],2);return t},exports.TAN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.tan(r)},exports.TANH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.exp(2*r);return(e-1)/(e+1)},exports.TRUNC=function(r,e){return e=e===undefined?0:e,r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:(r>0?1:-1)*Math.floor(Math.abs(r)*Math.pow(10,e))/Math.pow(10,e)}},function(module,exports,__webpack_require__){var mathTrig=__webpack_require__(4),text=__webpack_require__(6),jStat=__webpack_require__(11).jStat,utils=__webpack_require__(1),error=__webpack_require__(0),misc=__webpack_require__(12);exports.AVEDEV=function(){var r=utils.parseNumberArray(utils.flatten(arguments));return r instanceof Error?r:jStat.sum(jStat(r).subtract(jStat.mean(r)).abs()[0])/r.length},exports.AVERAGE=function(){for(var r,e=utils.numbers(utils.flatten(arguments)),t=e.length,n=0,a=0,u=0;t>u;u++)n+=e[u],a+=1;return r=n/a,isNaN(r)&&(r=error.num),r},exports.AVERAGEA=function(){for(var r,e=utils.flatten(arguments),t=e.length,n=0,a=0,u=0;t>u;u++){var i=e[u];"number"==typeof i&&(n+=i),!0===i&&n++,null!==i&&a++}return r=n/a,isNaN(r)&&(r=error.num),r},exports.AVERAGEIF=function(range,criteria,average_range){if(1>=arguments.length)return error.na;if(average_range=average_range||range,range=utils.flatten(range),(average_range=utils.parseNumberArray(utils.flatten(average_range)))instanceof Error)return average_range;for(var average_count=0,result=0,i=0;range.length>i;i++)eval(range[i]+criteria)&&(result+=average_range[i],average_count++);return result/average_count},exports.AVERAGEIFS=function(){for(var args=utils.argsToArray(arguments),criteria=(args.length-1)/2,range=utils.flatten(args[0]),count=0,result=0,i=0;range.length>i;i++){for(var condition="",j=0;criteria>j;j++)condition+=args[2*j+1][i]+args[2*j+2],j!==criteria-1&&(condition+="&&");eval(condition)&&(result+=range[i],count++)}var average=result/count;return isNaN(average)?0:average},exports.BETA={},exports.BETA.DIST=function(r,e,t,n,a,u){return 4>arguments.length?error.value:(a=a===undefined?0:a,u=u===undefined?1:u,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),a=utils.parseNumber(a),u=utils.parseNumber(u),utils.anyIsError(r,e,t,a,u)?error.value:(r=(r-a)/(u-a),n?jStat.beta.cdf(r,e,t):jStat.beta.pdf(r,e,t)))},exports.BETA.INV=function(r,e,t,n,a){return n=n===undefined?0:n,a=a===undefined?1:a,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumber(n),a=utils.parseNumber(a),utils.anyIsError(r,e,t,n,a)?error.value:jStat.beta.inv(r,e,t)*(a-n)+n},exports.BINOM={},exports.BINOM.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(r,e,t,n)?error.value:n?jStat.binomial.cdf(r,e,t):jStat.binomial.pdf(r,e,t)},exports.BINOM.DIST.RANGE=function(r,e,t,n){if(n=n===undefined?t:n,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(r,e,t,n))return error.value;for(var a=0,u=t;n>=u;u++)a+=mathTrig.COMBIN(r,u)*Math.pow(e,u)*Math.pow(1-e,r-u);return a},exports.BINOM.INV=function(r,e,t){if(r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;for(var n=0;r>=n;){if(jStat.binomial.cdf(n,r,e)>=t)return n;n++}},exports.CHISQ={},exports.CHISQ.DIST=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:t?jStat.chisquare.cdf(r,e):jStat.chisquare.pdf(r,e)},exports.CHISQ.DIST.RT=function(r,e){return!r|!e?error.na:1>r||e>Math.pow(10,10)?error.num:"number"!=typeof r||"number"!=typeof e?error.value:1-jStat.chisquare.cdf(r,e)},exports.CHISQ.INV=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:jStat.chisquare.inv(r,e)},exports.CHISQ.INV.RT=function(r,e){return!r|!e?error.na:0>r||r>1||1>e||e>Math.pow(10,10)?error.num:"number"!=typeof r||"number"!=typeof e?error.value:jStat.chisquare.inv(1-r,e)},exports.CHISQ.TEST=function(r,e){if(2!==arguments.length)return error.na;if(!(r instanceof Array&&e instanceof Array))return error.value;if(r.length!==e.length)return error.value;if(r[0]&&e[0]&&r[0].length!==e[0].length)return error.value;var t,n,a,u=r.length;for(n=0;u>n;n++)r[n]instanceof Array||(t=r[n],r[n]=[],r[n].push(t)),e[n]instanceof Array||(t=e[n],e[n]=[],e[n].push(t));var i=r[0].length,o=1===i?u-1:(u-1)*(i-1),s=0,l=Math.PI;for(n=0;u>n;n++)for(a=0;i>a;a++)s+=Math.pow(r[n][a]-e[n][a],2)/e[n][a];return Math.round(1e6*function(r,e){var t=Math.exp(-.5*r);e%2==1&&(t*=Math.sqrt(2*r/l));for(var n=e;n>=2;)t=t*r/n,n-=2;for(var a=t,u=e;a>1e-10*t;)u+=2,a=a*r/u,t+=a;return 1-t}(s,o))/1e6},exports.COLUMN=function(r,e){return 2!==arguments.length?error.na:0>e?error.num:r instanceof Array&&"number"==typeof e?0===r.length?undefined:jStat.col(r,e):error.value},exports.COLUMNS=function(r){return 1!==arguments.length?error.na:r instanceof Array?0===r.length?0:jStat.cols(r):error.value},exports.CONFIDENCE={},exports.CONFIDENCE.NORM=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:jStat.normalci(1,r,e,t)[1]-1},exports.CONFIDENCE.T=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:jStat.tci(1,r,e,t)[1]-1},exports.CORREL=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e)?error.value:jStat.corrcoeff(r,e)},exports.COUNT=function(){return utils.numbers(utils.flatten(arguments)).length},exports.COUNTA=function(){var r=utils.flatten(arguments);return r.length-exports.COUNTBLANK(r)},exports.COUNTIN=function(r,e){var t=0;r=utils.flatten(r);for(var n=0;r.length>n;n++)r[n]===e&&t++;return t},exports.COUNTBLANK=function(){for(var r,e=utils.flatten(arguments),t=0,n=0;e.length>n;n++)null!==(r=e[n])&&""!==r||t++;return t},exports.COUNTIF=function(range,criteria){range=utils.flatten(range),/[<>=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var matches=0,i=0;range.length>i;i++)"string"!=typeof range[i]?eval(range[i]+criteria)&&matches++:eval('"'+range[i]+'"'+criteria)&&matches++;return matches},exports.COUNTIFS=function(){for(var args=utils.argsToArray(arguments),results=Array(utils.flatten(args[0]).length),i=0;results.length>i;i++)results[i]=!0;for(i=0;args.length>i;i+=2){var range=utils.flatten(args[i]),criteria=args[i+1];/[<>=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var j=0;range.length>j;j++)results[j]="string"!=typeof range[j]?results[j]&&eval(range[j]+criteria):results[j]&&eval('"'+range[j]+'"'+criteria)}var result=0;for(i=0;results.length>i;i++)results[i]&&result++;return result},exports.COUNTUNIQUE=function(){return misc.UNIQUE.apply(null,utils.flatten(arguments)).length},exports.COVARIANCE={},exports.COVARIANCE.P=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=jStat.mean(r),n=jStat.mean(e),a=0,u=r.length,i=0;u>i;i++)a+=(r[i]-t)*(e[i]-n);return a/u},exports.COVARIANCE.S=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e)?error.value:jStat.covariance(r,e)},exports.DEVSQ=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=jStat.mean(r),t=0,n=0;r.length>n;n++)t+=Math.pow(r[n]-e,2);return t},exports.EXPON={},exports.EXPON.DIST=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:t?jStat.exponential.cdf(r,e):jStat.exponential.pdf(r,e)},exports.F={},exports.F.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:n?jStat.centralF.cdf(r,e,t):jStat.centralF.pdf(r,e,t)},exports.F.DIST.RT=function(r,e,t){return 3!==arguments.length?error.na:0>r||1>e||1>t?error.num:"number"!=typeof r||"number"!=typeof e||"number"!=typeof t?error.value:1-jStat.centralF.cdf(r,e,t)},exports.F.INV=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:0>=r||r>1?error.num:jStat.centralF.inv(r,e,t)},exports.F.INV.RT=function(r,e,t){return 3!==arguments.length?error.na:0>r||r>1||1>e||e>Math.pow(10,10)||1>t||t>Math.pow(10,10)?error.num:"number"!=typeof r||"number"!=typeof e||"number"!=typeof t?error.value:jStat.centralF.inv(1-r,e,t)},exports.F.TEST=function(r,e){if(!r||!e)return error.na;if(!(r instanceof Array&&e instanceof Array))return error.na;if(2>r.length||2>e.length)return error.div0;var t=function(r,e){for(var t=0,n=0;r.length>n;n++)t+=Math.pow(r[n]-e,2);return t},n=mathTrig.SUM(r)/r.length,a=mathTrig.SUM(e)/e.length;return t(r,n)/(r.length-1)/(t(e,a)/(e.length-1))},exports.FISHER=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log((1+r)/(1-r))/2},exports.FISHERINV=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.exp(2*r);return(e-1)/(e+1)},exports.FORECAST=function(r,e,t){if(r=utils.parseNumber(r),e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,e,t))return error.value;for(var n=jStat.mean(t),a=jStat.mean(e),u=t.length,i=0,o=0,s=0;u>s;s++)i+=(t[s]-n)*(e[s]-a),o+=Math.pow(t[s]-n,2);var l=i/o;return a-l*n+l*r},exports.FREQUENCY=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=r.length,n=e.length,a=[],u=0;n>=u;u++){a[u]=0;for(var i=0;t>i;i++)0===u?r[i]>e[0]||(a[0]+=1):n>u?r[i]>e[u-1]&&e[u]>=r[i]&&(a[u]+=1):u===n&&r[i]>e[n-1]&&(a[n]+=1)}return a},exports.GAMMA=function(r){return r=utils.parseNumber(r),r instanceof Error?r:0===r?error.num:parseInt(r,10)===r&&0>r?error.num:jStat.gammafn(r)},exports.GAMMA.DIST=function(r,e,t,n){return 4!==arguments.length?error.na:r>=0&&e>0&&t>0?"number"!=typeof r||"number"!=typeof e||"number"!=typeof t?error.value:n?jStat.gamma.cdf(r,e,t,!0):jStat.gamma.pdf(r,e,t,!1):error.value},exports.GAMMA.INV=function(r,e,t){return 3!==arguments.length?error.na:0>r||r>1||0>=e||0>=t?error.num:"number"!=typeof r||"number"!=typeof e||"number"!=typeof t?error.value:jStat.gamma.inv(r,e,t)},exports.GAMMALN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:jStat.gammaln(r)},exports.GAMMALN.PRECISE=function(r){return 1!==arguments.length?error.na:r>0?"number"!=typeof r?error.value:jStat.gammaln(r):error.num},exports.GAUSS=function(r){return r=utils.parseNumber(r),r instanceof Error?r:jStat.normal.cdf(r,0,1)-.5},exports.GEOMEAN=function(){var r=utils.parseNumberArray(utils.flatten(arguments));return r instanceof Error?r:jStat.geomean(r)},exports.GROWTH=function(r,e,t,n){if((r=utils.parseNumberArray(r))instanceof Error)return r;var a;if(e===undefined)for(e=[],a=1;r.length>=a;a++)e.push(a);if(t===undefined)for(t=[],a=1;r.length>=a;a++)t.push(a);if(e=utils.parseNumberArray(e),t=utils.parseNumberArray(t),utils.anyIsError(e,t))return error.value;n===undefined&&(n=!0);var u=r.length,i=0,o=0,s=0,l=0;for(a=0;u>a;a++){var f=e[a],c=Math.log(r[a]);i+=f,o+=c,s+=f*c,l+=f*f}i/=u,o/=u,s/=u,l/=u;var p,h;n?(p=(s-i*o)/(l-i*i),h=o-p*i):(p=s/l,h=0);var m=[];for(a=0;t.length>a;a++)m.push(Math.exp(h+p*t[a]));return m},exports.HARMEAN=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=r.length,t=0,n=0;e>n;n++)t+=1/r[n];return e/t},exports.HYPGEOM={},exports.HYPGEOM.DIST=function(r,e,t,n,a){function u(r,e,t,n){return mathTrig.COMBIN(t,r)*mathTrig.COMBIN(n-t,e-r)/mathTrig.COMBIN(n,e)}return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(r,e,t,n)?error.value:a?function(r,e,t,n){for(var a=0,i=0;r>=i;i++)a+=u(i,e,t,n);return a}(r,e,t,n):u(r,e,t,n)},exports.INTERCEPT=function(r,e){return r=utils.parseNumberArray(r),e=utils.parseNumberArray(e),utils.anyIsError(r,e)?error.value:r.length!==e.length?error.na:exports.FORECAST(0,r,e)},exports.KURT=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=jStat.mean(r),t=r.length,n=0,a=0;t>a;a++)n+=Math.pow(r[a]-e,4);return n/=Math.pow(jStat.stdev(r,!0),4),t*(t+1)/((t-1)*(t-2)*(t-3))*n-3*(t-1)*(t-1)/((t-2)*(t-3))},exports.LARGE=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e)?r:r.sort(function(r,e){return e-r})[e-1]},exports.LINEST=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=jStat.mean(r),n=jStat.mean(e),a=e.length,u=0,i=0,o=0;a>o;o++)u+=(e[o]-n)*(r[o]-t),i+=Math.pow(e[o]-n,2);var s=u/i;return[s,t-s*n]},exports.LOGEST=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=0;r.length>t;t++)r[t]=Math.log(r[t]);var n=exports.LINEST(r,e);return n[0]=Math.round(1e6*Math.exp(n[0]))/1e6,n[1]=Math.round(1e6*Math.exp(n[1]))/1e6,n},exports.LOGNORM={},exports.LOGNORM.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:n?jStat.lognormal.cdf(r,e,t):jStat.lognormal.pdf(r,e,t)},exports.LOGNORM.INV=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:jStat.lognormal.inv(r,e,t)},exports.MAX=function(){var r=utils.numbers(utils.flatten(arguments));return 0===r.length?0:Math.max.apply(Math,r)},exports.MAXA=function(){var r=utils.arrayValuesToNumbers(utils.flatten(arguments));return 0===r.length?0:Math.max.apply(Math,r)},exports.MEDIAN=function(){var r=utils.arrayValuesToNumbers(utils.flatten(arguments)),e=jStat.median(r);return isNaN(e)&&(e=error.num),e},exports.MIN=function(){var r=utils.numbers(utils.flatten(arguments));return 0===r.length?0:Math.min.apply(Math,r)},exports.MINA=function(){var r=utils.arrayValuesToNumbers(utils.flatten(arguments));return 0===r.length?0:Math.min.apply(Math,r)},exports.MODE={},exports.MODE.MULT=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e,t=r.length,n={},a=[],u=0,i=0;t>i;i++)e=r[i],n[e]=n[e]?n[e]+1:1,n[e]>u&&(u=n[e],a=[]),n[e]===u&&(a[a.length]=e);return a},exports.MODE.SNGL=function(){var r=utils.parseNumberArray(utils.flatten(arguments));return r instanceof Error?r:exports.MODE.MULT(r).sort(function(r,e){return r-e})[0]},exports.NEGBINOM={},exports.NEGBINOM.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:n?jStat.negbin.cdf(r,e,t):jStat.negbin.pdf(r,e,t)},exports.NORM={},exports.NORM.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:t>0?n?jStat.normal.cdf(r,e,t):jStat.normal.pdf(r,e,t):error.num},exports.NORM.INV=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:jStat.normal.inv(r,e,t)},exports.NORM.S={},exports.NORM.S.DIST=function(r,e){return r=utils.parseNumber(r),r instanceof Error?error.value:e?jStat.normal.cdf(r,0,1):jStat.normal.pdf(r,0,1)},exports.NORM.S.INV=function(r){return r=utils.parseNumber(r),r instanceof Error?error.value:jStat.normal.inv(r,0,1)},exports.PEARSON=function(r,e){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r))return error.value;for(var t=jStat.mean(r),n=jStat.mean(e),a=r.length,u=0,i=0,o=0,s=0;a>s;s++)u+=(r[s]-t)*(e[s]-n),i+=Math.pow(r[s]-t,2),o+=Math.pow(e[s]-n,2);return u/Math.sqrt(i*o)},exports.PERCENTILE={},exports.PERCENTILE.EXC=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;r=r.sort(function(r,e){return r-e});var t=r.length;if(1/(t+1)>e||e>1-1/(t+1))return error.num;var n=e*(t+1)-1,a=Math.floor(n);return utils.cleanFloat(n===a?r[n]:r[a]+(n-a)*(r[a+1]-r[a]))},exports.PERCENTILE.INC=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;r=r.sort(function(r,e){return r-e});var t=r.length,n=e*(t-1),a=Math.floor(n);return utils.cleanFloat(n===a?r[n]:r[a]+(n-a)*(r[a+1]-r[a]))},exports.PERCENTRANK={},exports.PERCENTRANK.EXC=function(r,e,t){if(t=t===undefined?3:t,r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;r=r.sort(function(r,e){return r-e});for(var n=misc.UNIQUE.apply(null,r),a=r.length,u=n.length,i=Math.pow(10,t),o=0,s=!1,l=0;!s&&u>l;)e===n[l]?(o=(r.indexOf(n[l])+1)/(a+1),s=!0):n[l]>e||e>=n[l+1]&&l!==u-1||(o=(r.indexOf(n[l])+1+(e-n[l])/(n[l+1]-n[l]))/(a+1),s=!0),l++;return Math.floor(o*i)/i},exports.PERCENTRANK.INC=function(r,e,t){if(t=t===undefined?3:t,r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;r=r.sort(function(r,e){return r-e});for(var n=misc.UNIQUE.apply(null,r),a=r.length,u=n.length,i=Math.pow(10,t),o=0,s=!1,l=0;!s&&u>l;)e===n[l]?(o=r.indexOf(n[l])/(a-1),s=!0):n[l]>e||e>=n[l+1]&&l!==u-1||(o=(r.indexOf(n[l])+(e-n[l])/(n[l+1]-n[l]))/(a-1),s=!0),l++;return Math.floor(o*i)/i},exports.PERMUT=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:mathTrig.FACT(r)/mathTrig.FACT(r-e)},exports.PERMUTATIONA=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:Math.pow(r,e)},exports.PHI=function(r){return r=utils.parseNumber(r),r instanceof Error?error.value:Math.exp(-.5*r*r)/2.5066282746310002},exports.POISSON={},exports.POISSON.DIST=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:t?jStat.poisson.cdf(r,e):jStat.poisson.pdf(r,e)},exports.PROB=function(r,e,t,n){if(t===undefined)return 0;if(n=n===undefined?t:n,r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(r,e,t,n))return error.value;if(t===n)return 0>r.indexOf(t)?0:e[r.indexOf(t)];for(var a=r.sort(function(r,e){return r-e}),u=a.length,i=0,o=0;u>o;o++)t>a[o]||a[o]>n||(i+=e[r.indexOf(a[o])]);return i},exports.QUARTILE={},exports.QUARTILE.EXC=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;switch(e){case 1:return exports.PERCENTILE.EXC(r,.25);case 2:return exports.PERCENTILE.EXC(r,.5);case 3:return exports.PERCENTILE.EXC(r,.75);default:return error.num}},exports.QUARTILE.INC=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;switch(e){case 1:return exports.PERCENTILE.INC(r,.25);case 2:return exports.PERCENTILE.INC(r,.5);case 3:return exports.PERCENTILE.INC(r,.75);default:return error.num}},exports.RANK={},exports.RANK.AVG=function(r,e,t){if(r=utils.parseNumber(r),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;e=utils.flatten(e),t=t||!1,e=e.sort(t?function(r,e){return r-e}:function(r,e){return e-r});for(var n=e.length,a=0,u=0;n>u;u++)e[u]===r&&a++;return a>1?(2*e.indexOf(r)+a+1)/2:e.indexOf(r)+1},exports.RANK.EQ=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e)?error.value:(t=t||!1,e=e.sort(t?function(r,e){return r-e}:function(r,e){return e-r}),e.indexOf(r)+1)},exports.ROW=function(r,e){return 2!==arguments.length?error.na:0>e?error.num:r instanceof Array&&"number"==typeof e?0===r.length?undefined:jStat.row(r,e):error.value},exports.ROWS=function(r){return 1!==arguments.length?error.na:r instanceof Array?0===r.length?0:jStat.rows(r):error.value},exports.RSQ=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e)?error.value:Math.pow(exports.PEARSON(r,e),2)},exports.SKEW=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=jStat.mean(r),t=r.length,n=0,a=0;t>a;a++)n+=Math.pow(r[a]-e,3);return t*n/((t-1)*(t-2)*Math.pow(jStat.stdev(r,!0),3))},exports.SKEW.P=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=jStat.mean(r),t=r.length,n=0,a=0,u=0;t>u;u++)a+=Math.pow(r[u]-e,3),n+=Math.pow(r[u]-e,2);return a/=t,n/=t,a/Math.pow(n,1.5)},exports.SLOPE=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=jStat.mean(e),n=jStat.mean(r),a=e.length,u=0,i=0,o=0;a>o;o++)u+=(e[o]-t)*(r[o]-n),i+=Math.pow(e[o]-t,2);return u/i},exports.SMALL=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e)?r:r.sort(function(r,e){return r-e})[e-1]},exports.STANDARDIZE=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:(r-e)/t},exports.STDEV={},exports.STDEV.P=function(){var r=exports.VAR.P.apply(this,arguments),e=Math.sqrt(r);return isNaN(e)&&(e=error.num),e},exports.STDEV.S=function(){var r=exports.VAR.S.apply(this,arguments);return Math.sqrt(r)},exports.STDEVA=function(){var r=exports.VARA.apply(this,arguments);return Math.sqrt(r)},exports.STDEVPA=function(){var r=exports.VARPA.apply(this,arguments),e=Math.sqrt(r);return isNaN(e)&&(e=error.num),e},exports.STEYX=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=jStat.mean(e),n=jStat.mean(r),a=e.length,u=0,i=0,o=0,s=0;a>s;s++)u+=Math.pow(r[s]-n,2),i+=(e[s]-t)*(r[s]-n),o+=Math.pow(e[s]-t,2);return Math.sqrt((u-i*i/o)/(a-2))},exports.TRANSPOSE=function(r){return r?jStat.transpose(r):error.na},exports.T=text.T,exports.T.DIST=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:t?jStat.studentt.cdf(r,e):jStat.studentt.pdf(r,e)},exports.T.DIST["2T"]=function(r,e){return 2!==arguments.length?error.na:0>r||1>e?error.num:"number"!=typeof r||"number"!=typeof e?error.value:2*(1-jStat.studentt.cdf(r,e))},exports.T.DIST.RT=function(r,e){return 2!==arguments.length?error.na:0>r||1>e?error.num:"number"!=typeof r||"number"!=typeof e?error.value:1-jStat.studentt.cdf(r,e)},exports.T.INV=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:jStat.studentt.inv(r,e)},exports.T.INV["2T"]=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),0>=r||r>1||1>e?error.num:utils.anyIsError(r,e)?error.value:Math.abs(jStat.studentt.inv(r/2,e))},exports.T.TEST=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;var t,n=jStat.mean(r),a=jStat.mean(e),u=0,i=0;for(t=0;r.length>t;t++)u+=Math.pow(r[t]-n,2);for(t=0;e.length>t;t++)i+=Math.pow(e[t]-a,2);u/=r.length-1,i/=e.length-1;var o=Math.abs(n-a)/Math.sqrt(u/r.length+i/e.length);return exports.T.DIST["2T"](o,r.length+e.length-2)},exports.TREND=function(r,e,t){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,e,t))return error.value;var n=exports.LINEST(r,e),a=n[0],u=n[1],i=[];return t.forEach(function(r){i.push(a*r+u)}),i},exports.TRIMMEAN=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;var t=mathTrig.FLOOR(r.length*e,2)/2;return jStat.mean(utils.initial(utils.rest(r.sort(function(r,e){return r-e}),t),t))},exports.VAR={},exports.VAR.P=function(){for(var r,e=utils.numbers(utils.flatten(arguments)),t=e.length,n=0,a=exports.AVERAGE(e),u=0;t>u;u++)n+=Math.pow(e[u]-a,2);return r=n/t,isNaN(r)&&(r=error.num),r},exports.VAR.S=function(){for(var r=utils.numbers(utils.flatten(arguments)),e=r.length,t=0,n=exports.AVERAGE(r),a=0;e>a;a++)t+=Math.pow(r[a]-n,2);return t/(e-1)},exports.VARA=function(){for(var r=utils.flatten(arguments),e=r.length,t=0,n=0,a=exports.AVERAGEA(r),u=0;e>u;u++){var i=r[u];t+="number"==typeof i?Math.pow(i-a,2):!0===i?Math.pow(1-a,2):Math.pow(0-a,2),null!==i&&n++}return t/(n-1)},exports.VARPA=function(){for(var r,e=utils.flatten(arguments),t=e.length,n=0,a=0,u=exports.AVERAGEA(e),i=0;t>i;i++){var o=e[i];n+="number"==typeof o?Math.pow(o-u,2):!0===o?Math.pow(1-u,2):Math.pow(0-u,2),null!==o&&a++}return r=n/a,isNaN(r)&&(r=error.num),r},exports.WEIBULL={},exports.WEIBULL.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:n?1-Math.exp(-Math.pow(r/t,e)):Math.pow(r,e-1)*Math.exp(-Math.pow(r/t,e))*e/Math.pow(t,e)},exports.Z={},exports.Z.TEST=function(r,e,t){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;t=t||exports.STDEV.S(r);var n=r.length;return 1-exports.NORM.S.DIST((exports.AVERAGE(r)-e)/(t/Math.sqrt(n)),!0)}},function(r,e,t){var n=t(1),a=t(0),u=t(9);e.ASC=function(){throw Error("ASC is not implemented")},e.BAHTTEXT=function(){throw Error("BAHTTEXT is not implemented")},e.CHAR=function(r){return r=n.parseNumber(r),r instanceof Error?r:String.fromCharCode(r)},e.CLEAN=function(r){return r=r||"",r.replace(/[\0-\x1F]/g,"")},e.CODE=function(r){r=r||"";var e=r.charCodeAt(0);return isNaN(e)&&(e=a.na),e},e.CONCATENATE=function(){for(var r=n.flatten(arguments),e=0;(e=r.indexOf(!0))>-1;)r[e]="TRUE";for(var t=0;(t=r.indexOf(!1))>-1;)r[t]="FALSE";return r.join("")},e.DBCS=function(){throw Error("DBCS is not implemented")},e.DOLLAR=function(r,e){if(e=e===undefined?2:e,r=n.parseNumber(r),e=n.parseNumber(e),n.anyIsError(r,e))return a.value;var t="";return e>0?e>0&&(t="($0,0."+Array(e+1).join("0")+")"):(r=Math.round(r*Math.pow(10,e))/Math.pow(10,e),t="($0,0)"),u(r).format(t)},e.EXACT=function(r,e){return 2!==arguments.length?a.na:r===e},e.FIND=function(r,e,t){return 2>arguments.length?a.na:(t=t===undefined?0:t,e?e.indexOf(r,t-1)+1:null)},e.FIXED=function(r,e,t){if(e=e===undefined?2:e,t=t!==undefined&&t,r=n.parseNumber(r),e=n.parseNumber(e),n.anyIsError(r,e))return a.value;var i=t?"0":"0,0";return e>0?e>0&&(i+="."+Array(e+1).join("0")):r=Math.round(r*Math.pow(10,e))/Math.pow(10,e),u(r).format(i)},e.HTML2TEXT=function(r){var e="";return r&&(r instanceof Array?r.forEach(function(r){""!==e&&(e+="\n"),e+=r.replace(/<(?:.|\n)*?>/gm,"")}):e=r.replace(/<(?:.|\n)*?>/gm,"")),e},e.LEFT=function(r,e){return e=e===undefined?1:e,e=n.parseNumber(e),e instanceof Error||"string"!=typeof r?a.value:r?r.substring(0,e):null},e.LEN=function(r){return 0===arguments.length?a.error:"string"==typeof r?r?r.length:0:r.length?r.length:a.value},e.LOWER=function(r){return"string"!=typeof r?a.value:r?r.toLowerCase():r},e.MID=function(r,e,t){if(e=n.parseNumber(e),t=n.parseNumber(t),n.anyIsError(e,t)||"string"!=typeof r)return t;var a=e-1;return r.substring(a,a+t)},e.NUMBERVALUE=function(r,e,t){return e=void 0===e?".":e,t=void 0===t?",":t,+r.replace(e,".").replace(t,"")},e.PRONETIC=function(){throw Error("PRONETIC is not implemented")},e.PROPER=function(r){return r===undefined||0===r.length?a.value:(!0===r&&(r="TRUE"),!1===r&&(r="FALSE"),isNaN(r)&&"number"==typeof r?a.value:("number"==typeof r&&(r=""+r),r.replace(/\w\S*/g,function(r){return r.charAt(0).toUpperCase()+r.substr(1).toLowerCase()})))},e.REGEXEXTRACT=function(r,e){if(2>arguments.length)return a.na;var t=r.match(RegExp(e));return t?t[t.length>1?t.length-1:0]:null},e.REGEXMATCH=function(r,e,t){if(2>arguments.length)return a.na;var n=r.match(RegExp(e));return t?n:!!n},e.REGEXREPLACE=function(r,e,t){return 3>arguments.length?a.na:r.replace(RegExp(e),t)},e.REPLACE=function(r,e,t,u){return e=n.parseNumber(e),t=n.parseNumber(t),n.anyIsError(e,t)||"string"!=typeof r||"string"!=typeof u?a.value:r.substr(0,e-1)+u+r.substr(e-1+t)},e.REPT=function(r,e){return e=n.parseNumber(e),e instanceof Error?e:Array(e+1).join(r)},e.RIGHT=function(r,e){return e=e===undefined?1:e,e=n.parseNumber(e),e instanceof Error?e:r?r.substring(r.length-e):a.na},e.SEARCH=function(r,e,t){var n;return"string"!=typeof r||"string"!=typeof e?a.value:(t=t===undefined?0:t,n=e.toLowerCase().indexOf(r.toLowerCase(),t-1)+1,0===n?a.value:n)},e.SPLIT=function(r,e){return r.split(e)},e.SUBSTITUTE=function(r,e,t,n){if(2>arguments.length)return a.na;if(!(r&&e&&t))return r;if(n===undefined)return r.replace(RegExp(e,"g"),t);for(var u=0,i=0;r.indexOf(e,u)>0;)if(u=r.indexOf(e,u+1),++i===n)return r.substring(0,u)+t+r.substring(u+e.length)},e.T=function(r){return"string"==typeof r?r:""},e.TEXT=function(r,e){return r=n.parseNumber(r),n.anyIsError(r)?a.na:u(r).format(e)},e.TRIM=function(r){return"string"!=typeof r?a.value:r.replace(/ +/g," ").trim()},e.UNICHAR=e.CHAR,e.UNICODE=e.CODE,e.UPPER=function(r){return"string"!=typeof r?a.value:r.toUpperCase()},e.VALUE=function(r){if("string"!=typeof r)return a.value;var e=u().unformat(r);return void 0===e?0:e}},function(r,e,t){var n=t(0);e.CELL=function(){throw Error("CELL is not implemented")},e.ERROR={},e.ERROR.TYPE=function(r){switch(r){case n.nil:return 1;case n.div0:return 2;case n.value:return 3;case n.ref:return 4;case n.name:return 5;case n.num:return 6;case n.na:return 7;case n.data:return 8}return n.na},e.INFO=function(){throw Error("INFO is not implemented")},e.ISBLANK=function(r){return null===r},e.ISBINARY=function(r){return/^[01]{1,10}$/.test(r)},e.ISERR=function(r){return[n.value,n.ref,n.div0,n.num,n.name,n.nil].indexOf(r)>=0||"number"==typeof r&&(isNaN(r)||!isFinite(r))},e.ISERROR=function(r){return e.ISERR(r)||r===n.na},e.ISEVEN=function(r){return!(1&Math.floor(Math.abs(r)))},e.ISFORMULA=function(){throw Error("ISFORMULA is not implemented")},e.ISLOGICAL=function(r){return!0===r||!1===r},e.ISNA=function(r){return r===n.na},e.ISNONTEXT=function(r){return"string"!=typeof r},e.ISNUMBER=function(r){return"number"==typeof r&&!isNaN(r)&&isFinite(r)},e.ISODD=function(r){return!!(1&Math.floor(Math.abs(r)))},e.ISREF=function(){throw Error("ISREF is not implemented")},e.ISTEXT=function(r){return"string"==typeof r},e.N=function(r){return this.ISNUMBER(r)?r:r instanceof Date?r.getTime():!0===r?1:!1===r?0:this.ISERROR(r)?r:0},e.NA=function(){return n.na},e.SHEET=function(){throw Error("SHEET is not implemented")},e.SHEETS=function(){throw Error("SHEETS is not implemented")},e.TYPE=function(r){return this.ISNUMBER(r)?1:this.ISTEXT(r)?2:this.ISLOGICAL(r)?4:this.ISERROR(r)?16:Array.isArray(r)?64:void 0}},function(r,e,t){function n(r){return 1===new Date(r,1,29).getMonth()}function a(r,e){return Math.ceil((e-r)/1e3/60/60/24)}function u(r){return(r-s)/864e5+(r>-22038912e5?2:1)}var i=t(0),o=t(1),s=new Date(1900,0,1),l=[undefined,0,1,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,1,2,3,4,5,6,0],f=[[],[1,2,3,4,5,6,7],[7,1,2,3,4,5,6],[6,0,1,2,3,4,5],[],[],[],[],[],[],[],[7,1,2,3,4,5,6],[6,7,1,2,3,4,5],[5,6,7,1,2,3,4],[4,5,6,7,1,2,3],[3,4,5,6,7,1,2],[2,3,4,5,6,7,1],[1,2,3,4,5,6,7]],c=[[],[6,0],[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],undefined,undefined,undefined,[0,0],[1,1],[2,2],[3,3],[4,4],[5,5],[6,6]];e.DATE=function(r,e,t){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?i.value:0>r||0>e||0>t?i.num:new Date(r,e-1,t)},e.DATEVALUE=function(r){if("string"!=typeof r)return i.value;var e=Date.parse(r);return isNaN(e)?i.value:e>-22038912e5?(e-s)/864e5+2:(e-s)/864e5+1},e.DAY=function(r){var e=o.parseDate(r);return e instanceof Error?e:e.getDate()},e.DAYS=function(r,e){return r=o.parseDate(r),e=o.parseDate(e),r instanceof Error?r:e instanceof Error?e:u(r)-u(e)},e.DAYS360=function(r,e,t){if(t=o.parseBool(t),r=o.parseDate(r),e=o.parseDate(e),r instanceof Error)return r;if(e instanceof Error)return e;if(t instanceof Error)return t;var n,a,u=r.getMonth(),i=e.getMonth();if(t)n=31===r.getDate()?30:r.getDate(),a=31===e.getDate()?30:e.getDate();else{var s=new Date(r.getFullYear(),u+1,0).getDate(),l=new Date(e.getFullYear(),i+1,0).getDate();n=r.getDate()===s?30:r.getDate(),e.getDate()===l?30>n?(i++,a=1):a=30:a=e.getDate()}return 360*(e.getFullYear()-r.getFullYear())+30*(i-u)+(a-n)},e.EDATE=function(r,e){return(r=o.parseDate(r))instanceof Error?r:isNaN(e)?i.value:(e=parseInt(e,10),r.setMonth(r.getMonth()+e),u(r))},e.EOMONTH=function(r,e){return(r=o.parseDate(r))instanceof Error?r:isNaN(e)?i.value:(e=parseInt(e,10),u(new Date(r.getFullYear(),r.getMonth()+e+1,0)))},e.HOUR=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getHours()},e.INTERVAL=function(r){if("number"!=typeof r&&"string"!=typeof r)return i.value;r=parseInt(r,10);var e=Math.floor(r/94608e4);r%=94608e4;var t=Math.floor(r/2592e3);r%=2592e3;var n=Math.floor(r/86400);r%=86400;var a=Math.floor(r/3600);r%=3600;var u=Math.floor(r/60);r%=60;var o=r;return e=e>0?e+"Y":"",t=t>0?t+"M":"",n=n>0?n+"D":"",a=a>0?a+"H":"",u=u>0?u+"M":"",o=o>0?o+"S":"","P"+e+t+n+"T"+a+u+o},e.ISOWEEKNUM=function(r){if((r=o.parseDate(r))instanceof Error)return r;r.setHours(0,0,0),r.setDate(r.getDate()+4-(r.getDay()||7));var e=new Date(r.getFullYear(),0,1);return Math.ceil(((r-e)/864e5+1)/7)},e.MINUTE=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getMinutes()},e.MONTH=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getMonth()+1},e.NETWORKDAYS=function(r,e,t){return this.NETWORKDAYS.INTL(r,e,1,t)},e.NETWORKDAYS.INTL=function(r,e,t,n){if((r=o.parseDate(r))instanceof Error)return r;if((e=o.parseDate(e))instanceof Error)return e;if(!((t=t===undefined?c[1]:c[t])instanceof Array))return i.value;n===undefined?n=[]:n instanceof Array||(n=[n]);for(var a=0;n.length>a;a++){var u=o.parseDate(n[a]);if(u instanceof Error)return u;n[a]=u}var s=(e-r)/864e5+1,l=s,f=r;for(a=0;s>a;a++){var p=(new Date).getTimezoneOffset()>0?f.getUTCDay():f.getDay(),h=!1;p!==t[0]&&p!==t[1]||(h=!0);for(var m=0;n.length>m;m++){var E=n[m];if(E.getDate()===f.getDate()&&E.getMonth()===f.getMonth()&&E.getFullYear()===f.getFullYear()){h=!0;break}}h&&l--,f.setDate(f.getDate()+1)}return l},e.NOW=function(){return new Date},e.SECOND=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getSeconds()},e.TIME=function(r,e,t){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?i.value:0>r||0>e||0>t?i.num:(3600*r+60*e+t)/86400},e.TIMEVALUE=function(r){return r=o.parseDate(r),r instanceof Error?r:(3600*r.getHours()+60*r.getMinutes()+r.getSeconds())/86400},e.TODAY=function(){return new Date},e.WEEKDAY=function(r,e){if((r=o.parseDate(r))instanceof Error)return r;e===undefined&&(e=1);var t=r.getDay();return f[e][t]},e.WEEKNUM=function(r,e){if((r=o.parseDate(r))instanceof Error)return r;if(e===undefined&&(e=1),21===e)return this.ISOWEEKNUM(r);var t=l[e],n=new Date(r.getFullYear(),0,1),a=n.getDay()e)return i.num;if(!((t=t===undefined?c[1]:c[t])instanceof Array))return i.value;n===undefined?n=[]:n instanceof Array||(n=[n]);for(var a=0;n.length>a;a++){var u=o.parseDate(n[a]);if(u instanceof Error)return u;n[a]=u}for(var s=0;e>s;){r.setDate(r.getDate()+1);var l=r.getDay();if(l!==t[0]&&l!==t[1]){for(var f=0;n.length>f;f++){var p=n[f];if(p.getDate()===r.getDate()&&p.getMonth()===r.getMonth()&&p.getFullYear()===r.getFullYear()){s--;break}}s++}}return r},e.YEAR=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getFullYear()},e.YEARFRAC=function(r,e,t){if((r=o.parseDate(r))instanceof Error)return r;if((e=o.parseDate(e))instanceof Error)return e;t=t||0;var u=r.getDate(),i=r.getMonth()+1,s=r.getFullYear(),l=e.getDate(),f=e.getMonth()+1,c=e.getFullYear();switch(t){case 0:return 31===u&&31===l?(u=30,l=30):31===u?u=30:30===u&&31===l&&(l=30),(l+30*f+360*c-(u+30*i+360*s))/360;case 1:var p=365;if(s===c||s+1===c&&(i>f||i===f&&u>=l))return(s===c&&n(s)||function(r,e){var t=r.getFullYear(),a=new Date(t,2,1);if(n(t)&&a>r&&e>=a)return!0;var u=e.getFullYear(),i=new Date(u,2,1);return n(u)&&e>=i&&i>r}(r,e)||1===f&&29===l)&&(p=366),a(r,e)/p;var h=c-s+1,m=(new Date(c+1,0,1)-new Date(s,0,1))/1e3/60/60/24,E=m/h;return a(r,e)/E;case 2:return a(r,e)/360;case 3:return a(r,e)/365;case 4:return(l+30*f+360*c-(u+30*i+360*s))/360}}},function(r,e,t){(function(n){var a,u;/*! - * numbro.js - * version : 1.11.1 - * author : Företagsplatsen AB - * license : MIT - * http://www.foretagsplatsen.se - */ -(function(){"use strict";function i(r){this._value=r}function o(r){return 0===r?1:Math.floor(Math.log(Math.abs(r))/Math.LN10)+1}function s(r){var e,t="";for(e=0;r>e;e++)t+="0";return t}function l(r,e){var t,n,a,u,i,o,l,f;return f=""+r,t=f.split("e")[0],u=f.split("e")[1],n=t.split(".")[0],a=t.split(".")[1]||"",+u>0?f=n+a+s(u-a.length):(i=0>+n?"-0":"0",e>0&&(i+="."),l=s(-1*u-1),o=(l+Math.abs(n)+a).substr(0,e),f=i+o),+u>0&&e>0&&(f+="."+s(e)),f}function f(r,e,t,n){var a,u,i=Math.pow(10,e);return(""+r).indexOf("e")>-1?(u=l(r,e),"-"!==u.charAt(0)||0>+u||(u=u.substr(1))):u=(t(r+"e+"+e)/i).toFixed(e),n&&(a=RegExp("0{1,"+n+"}$"),u=u.replace(a,"")),u}function c(r,e,t){var n=e.replace(/\{[^\{\}]*\}/g,"");return n.indexOf("$")>-1?h(r,x[$].currency.symbol,e,t):n.indexOf("%")>-1?E(r,e,t):n.indexOf(":")>-1?g(r):N(r._value,e,t)}function p(r,e){var t,n,a,u,i,o=e,s=!1;if(e.indexOf(":")>-1)r._value=d(e);else if(e===C)r._value=0;else{for("."!==x[$].delimiters.decimal&&(e=e.replace(/\./g,"").replace(x[$].delimiters.decimal,".")),t=RegExp("[^a-zA-Z]"+x[$].abbreviations.thousand+"(?:\\)|(\\"+x[$].currency.symbol+")?(?:\\))?)?$"),n=RegExp("[^a-zA-Z]"+x[$].abbreviations.million+"(?:\\)|(\\"+x[$].currency.symbol+")?(?:\\))?)?$"),a=RegExp("[^a-zA-Z]"+x[$].abbreviations.billion+"(?:\\)|(\\"+x[$].currency.symbol+")?(?:\\))?)?$"),u=RegExp("[^a-zA-Z]"+x[$].abbreviations.trillion+"(?:\\)|(\\"+x[$].currency.symbol+")?(?:\\))?)?$"),i=1;R.length>i&&!s;++i)e.indexOf(R[i])>-1?s=Math.pow(1024,i):e.indexOf(S[i])>-1&&(s=Math.pow(1e3,i));var l=e.replace(/[^0-9\.]+/g,"");""===l?r._value=NaN:(r._value=(s||1)*(o.match(t)?Math.pow(10,3):1)*(o.match(n)?Math.pow(10,6):1)*(o.match(a)?Math.pow(10,9):1)*(o.match(u)?Math.pow(10,12):1)*(e.indexOf("%")>-1?.01:1)*((e.split("-").length+Math.min(e.split("(").length-1,e.split(")").length-1))%2?1:-1)*+l,r._value=s?Math.ceil(r._value):r._value)}return r._value}function h(r,e,t,n){var a,u,i=t,o=i.indexOf("$"),s=i.indexOf("("),l=i.indexOf("+"),f=i.indexOf("-"),c="",p="";if(-1===i.indexOf("$")?"infix"===x[$].currency.position?(p=e,x[$].currency.spaceSeparated&&(p=" "+p+" ")):x[$].currency.spaceSeparated&&(c=" "):i.indexOf(" $")>-1?(c=" ",i=i.replace(" $","")):i.indexOf("$ ")>-1?(c=" ",i=i.replace("$ ","")):i=i.replace("$",""),u=N(r._value,i,n,p),-1===t.indexOf("$"))switch(x[$].currency.position){case"postfix":u.indexOf(")")>-1?(u=u.split(""),u.splice(-1,0,c+e),u=u.join("")):u=u+c+e;break;case"infix":break;case"prefix":u.indexOf("(")>-1||u.indexOf("-")>-1?(u=u.split(""),a=Math.max(s,f)+1,u.splice(a,0,e+c),u=u.join("")):u=e+c+u;break;default:throw Error('Currency position should be among ["prefix", "infix", "postfix"]')}else o>1?u.indexOf(")")>-1?(u=u.split(""),u.splice(-1,0,c+e),u=u.join("")):u=u+c+e:u.indexOf("(")>-1||u.indexOf("+")>-1||u.indexOf("-")>-1?(u=u.split(""),a=1,(s>o||l>o||f>o)&&(a=0),u.splice(a,0,e+c),u=u.join("")):u=e+c+u;return u}function m(r,e,t,n){return h(r,e,t,n)}function E(r,e,t){var n,a="",u=100*r._value;return e.indexOf(" %")>-1?(a=" ",e=e.replace(" %","")):e=e.replace("%",""),n=N(u,e,t),n.indexOf(")")>-1?(n=n.split(""),n.splice(-1,0,a+"%"),n=n.join("")):n=n+a+"%",n}function g(r){var e=Math.floor(r._value/60/60),t=Math.floor((r._value-60*e*60)/60),n=Math.round(r._value-60*e*60-60*t);return e+":"+(10>t?"0"+t:t)+":"+(10>n?"0"+n:n)}function d(r){var e=r.split(":"),t=0;return 3===e.length?(t+=60*+e[0]*60,t+=60*+e[1],t+=+e[2]):2===e.length&&(t+=60*+e[0],t+=+e[1]),+t}function v(r,e,t){var n,a,u,i=e[0],o=Math.abs(r);if(o>=t){for(n=1;e.length>n;++n)if(a=Math.pow(t,n),u=Math.pow(t,n+1),o>=a&&u>o){i=e[n],r/=a;break}i===e[0]&&(r/=Math.pow(t,e.length-1),i=e[e.length-1])}return{value:r,suffix:i}}function N(r,e,t,n){var a,u,i,l,c,p,h,m,E,g,d,N,I,b,y,M,A=!1,R=!1,S=!1,T="",V=!1,L=!1,D=!1,w=!1,_=!1,P="",U="",F=Math.abs(r),B="",k=!1,j=!1,G="";if(0===r&&null!==C)return C;if(!isFinite(r))return""+r;if(0===e.indexOf("{")){var Y=e.indexOf("}");if(-1===Y)throw Error('Format should also contain a "}"');g=e.slice(1,Y),e=e.slice(Y+1)}else g="";if(e.indexOf("}")===e.length-1&&e.length){var q=e.indexOf("{");if(-1===q)throw Error('Format should also contain a "{"');d=e.slice(q+1,-1),e=e.slice(0,q+1)}else d="";var H;for(H=e.match(-1===e.indexOf(".")?/([0-9]+).*/:/([0-9]+)\..*/),y=null===H?-1:H[1].length,-1!==e.indexOf("-")&&(k=!0),e.indexOf("(")>-1?(A=!0,e=e.slice(1,-1)):e.indexOf("+")>-1&&(R=!0,e=e.replace(/\+/g,"")),e.indexOf("a")>-1&&(m=e.split(".")[0].match(/[0-9]+/g)||["0"],m=parseInt(m[0],10),V=e.indexOf("aK")>=0,L=e.indexOf("aM")>=0,D=e.indexOf("aB")>=0,w=e.indexOf("aT")>=0,_=V||L||D||w,e.indexOf(" a")>-1?(T=" ",e=e.replace(" a","")):e=e.replace("a",""),i=o(r),c=i%3,c=0===c?3:c,m&&0!==F&&(p=3*~~((Math.min(m,i)-c)/3),F/=Math.pow(10,p)),i!==m&&(F>=Math.pow(10,12)&&!_||w?(T+=x[$].abbreviations.trillion,r/=Math.pow(10,12)):F=Math.pow(10,9)&&!_||D?(T+=x[$].abbreviations.billion,r/=Math.pow(10,9)):F=Math.pow(10,6)&&!_||L?(T+=x[$].abbreviations.million,r/=Math.pow(10,6)):(F=Math.pow(10,3)&&!_||V)&&(T+=x[$].abbreviations.thousand,r/=Math.pow(10,3))),l=o(r),m&&m>l&&-1===e.indexOf(".")&&(e+="[.]",e+=s(m-l))),M=0;O.length>M;++M)if(a=O[M],e.indexOf(a.marker)>-1){e.indexOf(" "+a.marker)>-1&&(P=" "),e=e.replace(P+a.marker,""),u=v(r,a.suffixes,a.scale),r=u.value,P+=u.suffix;break}if(e.indexOf("o")>-1&&(e.indexOf(" o")>-1?(U=" ",e=e.replace(" o","")):e=e.replace("o",""),x[$].ordinal&&(U+=x[$].ordinal(r))),e.indexOf("[.]")>-1&&(S=!0,e=e.replace("[.]",".")),E=e.split(".")[1],N=e.indexOf(","),E){var X=[];if(-1!==E.indexOf("*")?(B=""+r,X=B.split("."),X.length>1&&(B=f(r,X[1].length,t))):E.indexOf("[")>-1?(E=E.replace("]",""),E=E.split("["),B=f(r,E[0].length+E[1].length,t,E[1].length)):B=f(r,E.length,t),X=B.split("."),h=X[0],X.length>1&&X[1].length){B=(n?T+n:x[$].delimiters.decimal)+X[1]}else B="";S&&0==+B.slice(1)&&(B="")}else h=f(r,0,t);return h.indexOf("-")>-1&&(h=h.slice(1),j=!0),y>h.length&&(h=s(y-h.length)+h),N>-1&&(h=(""+h).replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+x[$].delimiters.thousands)),0===e.indexOf(".")&&(h=""),I=e.indexOf("("),b=e.indexOf("-"),G=b>I?(A&&j?"(":"")+(k&&j||!A&&j?"-":""):(k&&j||!A&&j?"-":"")+(A&&j?"(":""),g+G+(!j&&R&&0!==r?"+":"")+h+B+(U||"")+(T&&!n?T:"")+(P||"")+(A&&j?")":"")+d}function I(r,e){x[r]=e}function b(r){$=r;var e=x[r].defaults;e&&e.format&&A.defaultFormat(e.format),e&&e.currencyFormat&&A.defaultCurrencyFormat(e.currencyFormat)}function y(r){var e=(""+r).split(".");return 2>e.length?1:Math.pow(10,e[1].length)}function M(){return Array.prototype.slice.call(arguments).reduce(function(r,e){var t=y(r),n=y(e);return t>n?t:n},-Infinity)}var A,R=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],S=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],T={general:{scale:1024,suffixes:S,marker:"bd"},binary:{scale:1024,suffixes:R,marker:"b"},decimal:{scale:1e3,suffixes:S,marker:"d"}},O=[T.general,T.binary,T.decimal],x={},V=x,$="en-US",C=null,L="0,0",D="0$",w=void 0!==r&&r.exports,_={delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(r){var e=r%10;return 1==~~(r%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th"},currency:{symbol:"$",position:"prefix"},defaults:{currencyFormat:",0000 a"},formats:{fourDigits:"0000 a",fullWithTwoDecimals:"$ ,0.00",fullWithTwoDecimalsNoCurrency:",0.00"}};A=function(r){return r=A.isNumbro(r)?r.value():"string"==typeof r||"number"==typeof r?A.fn.unformat(r):NaN,new i(+r)},A.version="1.11.1",A.isNumbro=function(r){return r instanceof i},A.setLanguage=function(r,e){console.warn("`setLanguage` is deprecated since version 1.6.0. Use `setCulture` instead");var t=r,n=r.split("-")[0],a=null;V[t]||(Object.keys(V).forEach(function(r){a||r.split("-")[0]!==n||(a=r)}),t=a||e||"en-US"),b(t)},A.setCulture=function(r,e){var t=r,n=r.split("-")[1],a=null;x[t]||(n&&Object.keys(x).forEach(function(r){a||r.split("-")[1]!==n||(a=r)}),t=a||e||"en-US"),b(t)},A.language=function(r,e){if(console.warn("`language` is deprecated since version 1.6.0. Use `culture` instead"),!r)return $;if(r&&!e){if(!V[r])throw Error("Unknown language : "+r);b(r)}return!e&&V[r]||I(r,e),A},A.culture=function(r,e){if(!r)return $;if(r&&!e){if(!x[r])throw Error("Unknown culture : "+r);b(r)}return!e&&x[r]||I(r,e),A},A.languageData=function(r){if(console.warn("`languageData` is deprecated since version 1.6.0. Use `cultureData` instead"),!r)return V[$];if(!V[r])throw Error("Unknown language : "+r);return V[r]},A.cultureData=function(r){if(!r)return x[$];if(!x[r])throw Error("Unknown culture : "+r);return x[r]},A.culture("en-US",_),A.languages=function(){return console.warn("`languages` is deprecated since version 1.6.0. Use `cultures` instead"),V},A.cultures=function(){return x},A.zeroFormat=function(r){C="string"==typeof r?r:null},A.defaultFormat=function(r){L="string"==typeof r?r:"0.0"},A.defaultCurrencyFormat=function(r){D="string"==typeof r?r:"0$"},A.validate=function(r,e){var t,n,a,u,i,o,s,l;if("string"!=typeof r&&(r+="",console.warn&&console.warn("Numbro.js: Value is not string. It has been co-erced to: ",r)),r=r.trim(),r=r.replace(/^[+-]?/,""),r.match(/^\d+$/))return!0;if(""===r)return!1;try{s=A.cultureData(e)}catch(f){s=A.cultureData(A.culture())}return a=s.currency.symbol,i=s.abbreviations,t=s.delimiters.decimal,n="."===s.delimiters.thousands?"\\.":s.delimiters.thousands,(null===(l=r.match(/^[^\d\.\,]+/))||(r=r.substr(1),l[0]===a))&&((null===(l=r.match(/[^\d]+$/))||(r=r.slice(0,-1),l[0]===i.thousand||l[0]===i.million||l[0]===i.billion||l[0]===i.trillion))&&(o=RegExp(n+"{2}"),!r.match(/[^\d.,]/g)&&(u=r.split(t),2>=u.length&&(2>u.length?!!u[0].match(/^\d+.*\d$/)&&!u[0].match(o):""===u[0]?!u[0].match(o)&&!!u[1].match(/^\d+$/):1===u[0].length?!!u[0].match(/^\d+$/)&&!u[0].match(o)&&!!u[1].match(/^\d+$/):!!u[0].match(/^\d+.*\d$/)&&!u[0].match(o)&&!!u[1].match(/^\d+$/)))))},A.loadLanguagesInNode=function(){console.warn("`loadLanguagesInNode` is deprecated since version 1.6.0. Use `loadCulturesInNode` instead"),A.loadCulturesInNode()},A.loadCulturesInNode=function(){var r=t(27);for(var e in r)e&&A.culture(e,r[e])},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(r,e){if(null===this||void 0===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof r)throw new TypeError(r+" is not a function");var t,n,a=this.length>>>0,u=!1;for(arguments.length>1&&(n=e,u=!0),t=0;a>t;++t)this.hasOwnProperty(t)&&(u?n=r(n,this[t],t,this):(n=this[t],u=!0));if(!u)throw new TypeError("Reduce of empty array with no initial value");return n}),A.fn=i.prototype={clone:function(){return A(this)},format:function(r,e){return c(this,r||L,e!==undefined?e:Math.round)},formatCurrency:function(r,e){return h(this,x[$].currency.symbol,r||D,e!==undefined?e:Math.round)},formatForeignCurrency:function(r,e,t){return m(this,r,e||D,t!==undefined?t:Math.round)},unformat:function(r){if("number"==typeof r)return r;if("string"==typeof r){var e=p(this,r);return isNaN(e)?undefined:e}return undefined},binaryByteUnits:function(){return v(this._value,T.binary.suffixes,T.binary.scale).suffix},byteUnits:function(){return v(this._value,T.general.suffixes,T.general.scale).suffix},decimalByteUnits:function(){return v(this._value,T.decimal.suffixes,T.decimal.scale).suffix},value:function(){return this._value},valueOf:function(){return this._value},set:function(r){return this._value=+r,this},add:function(r){function e(r,e){return r+t*e}var t=M.call(null,this._value,r);return this._value=[this._value,r].reduce(e,0)/t,this},subtract:function(r){function e(r,e){return r-t*e}var t=M.call(null,this._value,r);return this._value=[r].reduce(e,this._value*t)/t,this},multiply:function(r){function e(r,e){var t=M(r,e),n=r*t;return n*=e*t,n/=t*t}return this._value=[this._value,r].reduce(e,1),this},divide:function(r){function e(r,e){var t=M(r,e);return r*t/(e*t)}return this._value=[this._value,r].reduce(e),this},difference:function(r){return Math.abs(A(this._value).subtract(r).value())}},function(){return void 0!==n&&n.browser===undefined&&n.title&&(-1!==n.title.indexOf("node")||n.title.indexOf("meteor-tool")>0||"grunt"===n.title||"gulp"===n.title)&&!0}()&&A.loadCulturesInNode(),w?r.exports=A:("undefined"==typeof ender&&(this.numbro=A),a=[],(u=function(){return A}.apply(e,a))!==undefined&&(r.exports=u))}).call("undefined"==typeof window?this:window)}).call(e,t(10))},function(r,e){function t(){throw Error("setTimeout has not been defined")}function n(){throw Error("clearTimeout has not been defined")}function a(r){if(f===setTimeout)return setTimeout(r,0);if((f===t||!f)&&setTimeout)return f=setTimeout,setTimeout(r,0);try{return f(r,0)}catch(e){try{return f.call(null,r,0)}catch(e){return f.call(this,r,0)}}}function u(r){if(c===clearTimeout)return clearTimeout(r);if((c===n||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(r);try{return c(r)}catch(e){try{return c.call(null,r)}catch(e){return c.call(this,r)}}}function i(){E&&h&&(E=!1,h.length?m=h.concat(m):g=-1,m.length&&o())}function o(){if(!E){var r=a(i);E=!0;for(var e=m.length;e;){for(h=m,m=[];++g1)for(var t=1;arguments.length>t;t++)e[t-1]=arguments[t];m.push(new s(r,e)),1!==m.length||E||a(o)},s.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=l,p.addListener=l,p.once=l,p.off=l,p.removeListener=l,p.removeAllListeners=l,p.emit=l,p.prependListener=l,p.prependOnceListener=l,p.listeners=function(r){return[]},p.binding=function(r){throw Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(r){throw Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t,n){!function(r,t){e.exports=t()}(0,function(){var e=function(r,e){function t(e,t){var n=e>t?e:t;return r.pow(10,17-~~(r.log(n>0?n:-n)*r.LOG10E))}function n(r){return"[object Function]"===h.call(r)}function a(r){return"number"==typeof r&&r===r}function u(r){return c.apply([],r)}function o(){return new o._init(arguments)}function s(){return 0}function l(){return 1}function f(r,e){return r===e?1:0}var c=Array.prototype.concat,p=Array.prototype.slice,h=Object.prototype.toString,m=Array.isArray||function(r){return"[object Array]"===h.call(r)};o.fn=o.prototype,o._init=function(r){var e;if(m(r[0]))if(m(r[0][0])){n(r[1])&&(r[0]=o.map(r[0],r[1]));for(var e=0;r[0].length>e;e++)this[e]=r[0][e];this.length=r[0].length}else this[0]=n(r[1])?o.map(r[0],r[1]):r[0],this.length=1;else if(a(r[0]))this[0]=o.seq.apply(null,r),this.length=1;else{if(r[0]instanceof o)return o(r[0].toArray());this[0]=[],this.length=1}return this},o._init.prototype=o.prototype,o._init.constructor=o,o.utils={calcRdx:t,isArray:m,isFunction:n,isNumber:a,toVector:u},o.extend=function(r){var e,t;if(1===arguments.length){for(t in r)o[t]=r[t];return this}for(var e=1;arguments.length>e;e++)for(t in arguments[e])r[t]=arguments[e][t];return r},o.rows=function(r){return r.length||1},o.cols=function(r){return r[0].length||1},o.dimensions=function(r){return{rows:o.rows(r),cols:o.cols(r)}},o.row=function(r,e){return m(e)?e.map(function(e){return o.row(r,e)}):r[e]},o.rowa=function(r,e){return o.row(r,e)},o.col=function(r,e){if(m(e)){var t=o.arange(r.length).map(function(r){return Array(e.length)});return e.forEach(function(e,n){o.arange(r.length).forEach(function(a){t[a][n]=r[a][e]})}),t}for(var n=Array(r.length),a=0;r.length>a;a++)n[a]=[r[a][e]];return n},o.cola=function(r,e){return o.col(r,e).map(function(r){return r[0]})},o.diag=function(r){for(var e=o.rows(r),t=Array(e),n=0;e>n;n++)t[n]=[r[n][n]];return t},o.antidiag=function(r){for(var e=o.rows(r)-1,t=Array(e),n=0;e>=0;e--,n++)t[n]=[r[n][e]];return t},o.transpose=function(r){var e,t,n,a,u,i=[];m(r[0])||(r=[r]),t=r.length,n=r[0].length;for(var u=0;n>u;u++){for(e=Array(t),a=0;t>a;a++)e[a]=r[a][u];i.push(e)}return 1===i.length?i[0]:i},o.map=function(r,e,t){var n,a,u,i,o;for(m(r[0])||(r=[r]),a=r.length,u=r[0].length,i=t?r:Array(a),n=0;a>n;n++)for(i[n]||(i[n]=Array(u)),o=0;u>o;o++)i[n][o]=e(r[n][o],n,o);return 1===i.length?i[0]:i},o.cumreduce=function(r,e,t){var n,a,u,i,o;for(m(r[0])||(r=[r]),a=r.length,u=r[0].length,i=t?r:Array(a),n=0;a>n;n++)for(i[n]||(i[n]=Array(u)),u>0&&(i[n][0]=r[n][0]),o=1;u>o;o++)i[n][o]=e(i[n][o-1],r[n][o]);return 1===i.length?i[0]:i},o.alter=function(r,e){return o.map(r,e,!0)},o.create=function(r,e,t){var a,u,i=Array(r);n(e)&&(t=e,e=r);for(var a=0;r>a;a++)for(i[a]=Array(e),u=0;e>u;u++)i[a][u]=t(a,u);return i},o.zeros=function(r,e){return a(e)||(e=r),o.create(r,e,s)},o.ones=function(r,e){return a(e)||(e=r),o.create(r,e,l)},o.rand=function(e,t){return a(t)||(t=e),o.create(e,t,r.random)},o.identity=function(r,e){return a(e)||(e=r),o.create(r,e,f)},o.symmetric=function(r){var e,t,n=r.length;if(r.length!==r[0].length)return!1;for(e=0;n>e;e++)for(t=0;n>t;t++)if(r[t][e]!==r[e][t])return!1;return!0},o.clear=function(r){return o.alter(r,s)},o.seq=function(r,e,a,u){n(u)||(u=!1);var i,o=[],s=t(r,e),l=(e*s-r*s)/((a-1)*s),f=r;for(i=0;e>=f&&a>i;i++,f=(r*s+l*s*i)/s)o.push(u?u(f,i):f);return o},o.arange=function(r,t,n){var a=[];if(n=n||1,t===e&&(t=r,r=0),r===t||0===n)return[];if(t>r&&0>n)return[];if(r>t&&n>0)return[];if(n>0)for(i=r;it;i+=n)a.push(i);return a},o.slice=function(){function r(r,t,n,a){var u,i=[],s=r.length;if(t===e&&n===e&&a===e)return o.copy(r);if(t=t||0,n=n||r.length,t=0>t?s+t:t,n=0>n?s+n:n,a=a||1,t===n||0===a)return[];if(n>t&&0>a)return[];if(t>n&&a>0)return[];if(a>0)for(u=t;n>u;u+=a)i.push(r[u]);else for(u=t;u>n;u+=a)i.push(r[u]);return i}function t(e,t){if(t=t||{},a(t.row)){if(a(t.col))return e[t.row][t.col];var n=o.rowa(e,t.row),u=t.col||{};return r(n,u.start,u.end,u.step)}if(a(t.col)){var i=o.cola(e,t.col),s=t.row||{};return r(i,s.start,s.end,s.step)}var s=t.row||{},u=t.col||{};return r(e,s.start,s.end,s.step).map(function(e){return r(e,u.start,u.end,u.step)})}return t}(),o.sliceAssign=function(t,n,u){if(a(n.row)){if(a(n.col))return t[n.row][n.col]=u;n.col=n.col||{},n.col.start=n.col.start||0,n.col.end=n.col.end||t[0].length,n.col.step=n.col.step||1;var i=o.arange(n.col.start,r.min(t.length,n.col.end),n.col.step),s=n.row;return i.forEach(function(r,e){t[s][r]=u[e]}),t}if(a(n.col)){n.row=n.row||{},n.row.start=n.row.start||0,n.row.end=n.row.end||t.length,n.row.step=n.row.step||1;var l=o.arange(n.row.start,r.min(t[0].length,n.row.end),n.row.step),f=n.col;return l.forEach(function(r,e){t[r][f]=u[e]}),t}u[0].length===e&&(u=[u]),n.row.start=n.row.start||0,n.row.end=n.row.end||t.length,n.row.step=n.row.step||1,n.col.start=n.col.start||0,n.col.end=n.col.end||t[0].length,n.col.step=n.col.step||1;var l=o.arange(n.row.start,r.min(t.length,n.row.end),n.row.step),i=o.arange(n.col.start,r.min(t[0].length,n.col.end),n.col.step);return l.forEach(function(r,e){i.forEach(function(n,a){t[r][n]=u[e][a]})}),t},o.diagonal=function(r){var e=o.zeros(r.length,r.length);return r.forEach(function(r,t){e[t][t]=r}),e},o.copy=function(r){return r.map(function(r){return a(r)?r:r.map(function(r){return r})})};var E=o.prototype;return E.length=0,E.push=Array.prototype.push,E.sort=Array.prototype.sort,E.splice=Array.prototype.splice,E.slice=Array.prototype.slice,E.toArray=function(){return this.length>1?p.call(this):p.call(this)[0]},E.map=function(r,e){return o(o.map(this,r,e))},E.cumreduce=function(r,e){return o(o.cumreduce(this,r,e))},E.alter=function(r){return o.alter(this,r),this},function(r){for(var e=0;r.length>e;e++)!function(r){E[r]=function(e){var t,n=this;return e?(setTimeout(function(){e.call(n,E[r].call(n))}),this):(t=o[r](this),m(t)?o(t):t)}}(r[e])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(r){for(var e=0;r.length>e;e++)!function(r){E[r]=function(e,t){var n=this;return t?(setTimeout(function(){t.call(n,E[r].call(n,e))}),this):o(o[r](this,e))}}(r[e])}("row col".split(" ")),function(r){for(var e=0;r.length>e;e++)!function(r){E[r]=Function("return jStat(jStat."+r+".apply(null, arguments));")}(r[e])}("create zeros ones rand identity".split(" ")),o}(Math);return function(r,e){function t(r,e){return r-e}function n(r,t,n){return e.max(t,e.min(r,n))}var a=r.utils.isFunction;r.sum=function(r){for(var e=0,t=r.length;--t>=0;)e+=r[t];return e},r.sumsqrd=function(r){for(var e=0,t=r.length;--t>=0;)e+=r[t]*r[t];return e},r.sumsqerr=function(e){for(var t,n=r.mean(e),a=0,u=e.length;--u>=0;)t=e[u]-n,a+=t*t;return a},r.sumrow=function(r){for(var e=0,t=r.length;--t>=0;)e+=r[t];return e},r.product=function(r){for(var e=1,t=r.length;--t>=0;)e*=r[t];return e},r.min=function(r){for(var e=r[0],t=0;++tr[t]&&(e=r[t]);return e},r.max=function(r){for(var e=r[0],t=0;++te&&(e=r[t]);return e},r.unique=function(r){for(var e={},t=[],n=0;r.length>n;n++)e[r[n]]||(e[r[n]]=!0,t.push(r[n]));return t},r.mean=function(e){return r.sum(e)/e.length},r.meansqerr=function(e){return r.sumsqerr(e)/e.length},r.geomean=function(t){return e.pow(r.product(t),1/t.length)},r.median=function(r){var e=r.length,n=r.slice().sort(t);return 1&e?n[e/2|0]:(n[e/2-1]+n[e/2])/2},r.cumsum=function(e){return r.cumreduce(e,function(r,e){return r+e})},r.cumprod=function(e){return r.cumreduce(e,function(r,e){return r*e})},r.diff=function(r){for(var e,t=[],n=r.length,e=1;n>e;e++)t.push(r[e]-r[e-1]);return t},r.rank=function(r){for(var e=r.length,n=r.slice().sort(t),a=Array(e),u=0;e>u;u++){var i=n.indexOf(r[u]),o=n.lastIndexOf(r[u]);if(i===o)var s=i;else var s=(i+o)/2;a[u]=s+1}return a},r.mode=function(r){for(var e,n=r.length,a=r.slice().sort(t),u=1,i=0,o=0,s=[],e=0;n>e;e++)a[e]===a[e+1]?u++:(u>i?(s=[a[e]],i=u,o=0):u===i&&(s.push(a[e]),o++),u=1);return 0===o?s[0]:s},r.range=function(e){return r.max(e)-r.min(e)},r.variance=function(e,t){return r.sumsqerr(e)/(e.length-(t?1:0))},r.pooledvariance=function(e){return e.reduce(function(e,t){return e+r.sumsqerr(t)},0)/(e.reduce(function(r,e){return r+e.length},0)-e.length)},r.deviation=function(e){for(var t=r.mean(e),n=e.length,a=Array(n),u=0;n>u;u++)a[u]=e[u]-t;return a},r.stdev=function(t,n){return e.sqrt(r.variance(t,n))},r.pooledstdev=function(t){return e.sqrt(r.pooledvariance(t))},r.meandev=function(t){for(var n=r.mean(t),a=[],u=t.length-1;u>=0;u--)a.push(e.abs(t[u]-n));return r.mean(a)},r.meddev=function(t){for(var n=r.median(t),a=[],u=t.length-1;u>=0;u--)a.push(e.abs(t[u]-n));return r.median(a)},r.coeffvar=function(e){return r.stdev(e)/r.mean(e)},r.quartiles=function(r){var n=r.length,a=r.slice().sort(t);return[a[e.round(n/4)-1],a[e.round(n/2)-1],a[e.round(3*n/4)-1]]},r.quantiles=function(r,a,u,i){var o,s,l,f,c,p,h=r.slice().sort(t),m=[a.length],E=r.length;void 0===u&&(u=3/8),void 0===i&&(i=3/8);for(var o=0;a.length>o;o++)s=a[o],l=u+s*(1-u-i),f=E*s+l,c=e.floor(n(f,1,E-1)),p=n(f-c,0,1),m[o]=(1-p)*h[c-1]+p*h[c];return m},r.percentile=function(r,e){var n=r.slice().sort(t),a=e*(n.length-1),u=parseInt(a),i=a-u;return n.length>u+1?n[u]*(1-i)+n[u+1]*i:n[u]},r.percentileOfScore=function(r,e,t){var n,a,u=0,i=r.length,o=!1;"strict"===t&&(o=!0);for(var a=0;i>a;a++)n=r[a],(o&&e>n||!o&&e>=n)&&u++;return u/i},r.histogram=function(t,n){for(var a,u=r.min(t),i=n||4,o=(r.max(t)-u)/i,s=t.length,n=[],a=0;i>a;a++)n[a]=0;for(var a=0;s>a;a++)n[e.min(e.floor((t[a]-u)/o),i-1)]+=1;return n},r.covariance=function(e,t){for(var n,a=r.mean(e),u=r.mean(t),i=e.length,o=Array(i),n=0;i>n;n++)o[n]=(e[n]-a)*(t[n]-u);return r.sum(o)/(i-1)},r.corrcoeff=function(e,t){return r.covariance(e,t)/r.stdev(e,1)/r.stdev(t,1)},r.spearmancoeff=function(e,t){return e=r.rank(e),t=r.rank(t),r.corrcoeff(e,t)},r.stanMoment=function(t,n){for(var a=r.mean(t),u=r.stdev(t),i=t.length,o=0,s=0;i>s;s++)o+=e.pow((t[s]-a)/u,n);return o/t.length},r.skewness=function(e){return r.stanMoment(e,3)},r.kurtosis=function(e){return r.stanMoment(e,4)-3};var u=r.prototype;!function(e){for(var t=0;e.length>t;t++)!function(e){u[e]=function(t,n){var i=[],o=0,s=this;if(a(t)&&(n=t,t=!1),n)return setTimeout(function(){n.call(s,u[e].call(s,t))}),this;if(this.length>1){for(s=!0===t?this:this.transpose();s.length>o;o++)i[o]=r[e](s[o]);return i}return r[e](this[0],t)}}(e[t])}("cumsum cumprod".split(" ")),function(e){for(var t=0;e.length>t;t++)!function(e){u[e]=function(t,n){var i=[],o=0,s=this;if(a(t)&&(n=t,t=!1),n)return setTimeout(function(){n.call(s,u[e].call(s,t))}),this;if(this.length>1){for("sumrow"!==e&&(s=!0===t?this:this.transpose());s.length>o;o++)i[o]=r[e](s[o]);return!0===t?r[e](r.utils.toVector(i)):i}return r[e](this[0],t)}}(e[t])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(e){for(var t=0;e.length>t;t++)!function(e){u[e]=function(){var t=[],n=0,i=this,o=Array.prototype.slice.call(arguments);if(a(o[o.length-1])){var s=o[o.length-1],l=o.slice(0,o.length-1);return setTimeout(function(){s.call(i,u[e].apply(i,l))}),this}var s=undefined,f=function(t){return r[e].apply(i,[t].concat(o))};if(this.length>1){for(i=i.transpose();i.length>n;n++)t[n]=f(i[n]);return t}return f(this[0])}}(e[t])}("quantiles percentileOfScore".split(" "))}(e,Math),function(r,e){r.gammaln=function(r){var t,n,a,u=0,i=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],o=1.000000000190015;for(a=(n=t=r)+5.5,a-=(t+.5)*e.log(a);6>u;u++)o+=i[u]/++n;return e.log(2.5066282746310007*o/t)-a},r.gammafn=function(r){var t,n,a,u,i=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],o=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],s=!1,l=0,f=0,c=0,p=r;if(0>=p){if(!(u=p%1+3.6e-16))return Infinity;s=(1&p?-1:1)*e.PI/e.sin(e.PI*u),p=1-p}a=p,n=1>p?p++:(p-=l=(0|p)-1)-1;for(var t=0;8>t;++t)c=(c+i[t])*n,f=f*n+o[t];if(u=c/f+1,p>a)u/=a;else if(a>p)for(var t=0;l>t;++t)u*=p,p++;return s&&(u=s/u),u},r.gammap=function(e,t){return r.lowRegGamma(e,t)*r.gammafn(e)},r.lowRegGamma=function(t,n){var a,u=r.gammaln(t),i=t,o=1/t,s=o,l=n+1-t,f=1/1e-30,c=1/l,p=c,h=1,m=-~(8.5*e.log(1>t?1/t:t)+.4*t+17);if(0>n||0>=t)return NaN;if(t+1>n){for(;m>=h;h++)o+=s*=n/++i;return o*e.exp(-n+t*e.log(n)-u)}for(;m>=h;h++)a=-h*(h-t),l+=2,c=a*c+l,f=l+a/f,c=1/c,p*=c*f;return 1-p*e.exp(-n+t*e.log(n)-u)},r.factorialln=function(e){return 0>e?NaN:r.gammaln(e+1)},r.factorial=function(e){return 0>e?NaN:r.gammafn(e+1)},r.combination=function(t,n){return t>170||n>170?e.exp(r.combinationln(t,n)):r.factorial(t)/r.factorial(n)/r.factorial(t-n)},r.combinationln=function(e,t){return r.factorialln(e)-r.factorialln(t)-r.factorialln(e-t)},r.permutation=function(e,t){return r.factorial(e)/r.factorial(e-t)},r.betafn=function(t,n){return t>0&&n>0?t+n>170?e.exp(r.betaln(t,n)):r.gammafn(t)*r.gammafn(n)/r.gammafn(t+n):undefined},r.betaln=function(e,t){return r.gammaln(e)+r.gammaln(t)-r.gammaln(e+t)},r.betacf=function(r,t,n){var a,u,i,o,s=1,l=t+n,f=t+1,c=t-1,p=1,h=1-l*r/f;for(1e-30>e.abs(h)&&(h=1e-30),h=1/h,o=h;100>=s&&(a=2*s,u=s*(n-s)*r/((c+a)*(t+a)),h=1+u*h,1e-30>e.abs(h)&&(h=1e-30),p=1+u/p,1e-30>e.abs(p)&&(p=1e-30),h=1/h,o*=h*p,u=-(t+s)*(l+s)*r/((t+a)*(f+a)),h=1+u*h,1e-30>e.abs(h)&&(h=1e-30),p=1+u/p,1e-30>e.abs(p)&&(p=1e-30),h=1/h,i=h*p,o*=i,3e-7<=e.abs(i-1));s++);return o},r.gammapinv=function(t,n){var a,u,i,o,s,l,f,c=0,p=n-1,h=r.gammaln(n);if(t>=1)return e.max(100,n+100*e.sqrt(n));if(0>=t)return 0;for(n>1?(l=e.log(p),f=e.exp(p*(l-1)-h),s=.5>t?t:1-t,i=e.sqrt(-2*e.log(s)),a=(2.30753+.27061*i)/(1+i*(.99229+.04481*i))-i,.5>t&&(a=-a),a=e.max(.001,n*e.pow(1-1/(9*n)-a/(3*e.sqrt(n)),3))):(i=1-n*(.253+.12*n),a=i>t?e.pow(t/i,1/n):1-e.log(1-(t-i)/(1-i)));12>c;c++){if(0>=a)return 0;if(u=r.lowRegGamma(n,a)-t,i=n>1?f*e.exp(-(a-p)+p*(e.log(a)-l)):e.exp(-a+p*e.log(a)-h),o=u/i,a-=i=o/(1-.5*e.min(1,o*((n-1)/a-1))),a>0||(a=.5*(a+i)),e.abs(i)<1e-8*a)break}return a},r.erf=function(r){var t,n,a,u,i=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,9.6467911e-11,2.394038e-12,-6.886027e-12,8.94487e-13,3.13092e-13,-1.12708e-13,3.81e-16,7.106e-15,-1.523e-15,-9.4e-17,1.21e-16,-2.8e-17],o=27,s=!1,l=0,f=0;for(0>r&&(r=-r,s=!0),t=2/(2+r),n=4*t-2;o>0;o--)a=l,l=n*l-f+i[o],f=a;return u=t*e.exp(-r*r+.5*(i[0]+n*l)-f),s?u-1:1-u},r.erfc=function(e){return 1-r.erf(e)},r.erfcinv=function(t){var n,a,u,i,o=0;if(t>=2)return-100;if(0>=t)return 100;for(i=1>t?t:2-t,u=e.sqrt(-2*e.log(i/2)),n=-.70711*((2.30753+.27061*u)/(1+u*(.99229+.04481*u))-u);2>o;o++)a=r.erfc(n)-i,n+=a/(1.1283791670955126*e.exp(-n*n)-n*a);return 1>t?n:-n},r.ibetainv=function(t,n,a){var u,i,o,s,l,f,c,p,h,m,E,g=n-1,d=a-1,v=0;if(0>=t)return 0;if(t>=1)return 1;for(1>n||1>a?(u=e.log(n/(n+a)),i=e.log(a/(n+a)),s=e.exp(n*u)/n,l=e.exp(a*i)/a,m=s+l,c=s/m>t?e.pow(n*m*t,1/n):1-e.pow(a*m*(1-t),1/a)):(o=.5>t?t:1-t,s=e.sqrt(-2*e.log(o)),c=(2.30753+.27061*s)/(1+s*(.99229+.04481*s))-s,.5>t&&(c=-c),p=(c*c-3)/6,h=2/(1/(2*n-1)+1/(2*a-1)),m=c*e.sqrt(p+h)/h-(1/(2*a-1)-1/(2*n-1))*(p+5/6-2/(3*h)),c=n/(n+a*e.exp(2*m))),E=-r.gammaln(n)-r.gammaln(a)+r.gammaln(n+a);10>v;v++){if(0===c||1===c)return c;if(f=r.ibeta(c,n,a)-t,s=e.exp(g*e.log(c)+d*e.log(1-c)+E),l=f/s,c-=s=l/(1-.5*e.min(1,l*(g/c-d/(1-c)))),c>0||(c=.5*(c+s)),1>c||(c=.5*(c+s+1)),e.abs(s)<1e-8*c&&v>0)break}return c},r.ibeta=function(t,n,a){var u=0===t||1===t?0:e.exp(r.gammaln(n+a)-r.gammaln(n)-r.gammaln(a)+n*e.log(t)+a*e.log(1-t));return t>=0&&1>=t&&((n+1)/(n+a+2)>t?u*r.betacf(t,n,a)/n:1-u*r.betacf(1-t,a,n)/a)},r.randn=function(t,n){var a,u,i,o,s;if(n||(n=t),t)return r.create(t,n,function(){return r.randn()});do{a=e.random(),u=1.7156*(e.random()-.5),i=a-.449871,o=e.abs(u)+.386595,s=i*i+o*(.196*o-.25472*i)}while(s>.27597&&(s>.27846||u*u>-4*e.log(a)*a*a));return u/a},r.randg=function(t,n,a){var u,i,o,s,l,f,c=t;if(a||(a=n),t||(t=1),n)return f=r.zeros(n,a),f.alter(function(){return r.randg(t)}),f;1>t&&(t+=1),u=t-1/3,i=1/e.sqrt(9*u);do{do{l=r.randn(),s=1+i*l}while(0>=s);s*=s*s,o=e.random()}while(o>1-.331*e.pow(l,4)&&e.log(o)>.5*l*l+u*(1-s+e.log(s)));if(t==c)return u*s;do{o=e.random()}while(0===o);return e.pow(o,1/c)*u*s},function(e){for(var t=0;e.length>t;t++)!function(e){r.fn[e]=function(){return r(r.map(this,function(t){return r[e](t)}))}}(e[t])}("gammaln gammafn factorial factorialln".split(" ")),function(e){for(var t=0;e.length>t;t++)!function(e){r.fn[e]=function(){return r(r[e].apply(null,arguments))}}(e[t])}("randn".split(" "))}(e,Math),function(r,e){function t(r){return r/e.abs(r)}function n(t,n,a){var u=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],i=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],o=.5*t;if(o>=8)return 1;var s=2*r.normal.cdf(o,0,1,1,0)-1;s=s3?2:3;for(var f=o,c=(8-o)/l,p=f+c,h=0,m=a-1,E=1;l>=E;E++){for(var g=0,d=.5*(p+f),v=.5*(p-f),N=1;12>=N;N++){var I,b;N>6?(I=12-N+1,b=u[I-1]):(I=N,b=-u[I-1]);var y=v*b,M=d+y,A=M*M;if(A>60)break;var R=2*r.normal.cdf(M,0,1,1,0),S=2*r.normal.cdf(M,t,1,1,0),T=.5*R-.5*S;Te.exp(-30/n)?(s=e.pow(s,n),1>s?s:1):0}function a(r,t,n){var a=.5-.5*r,u=e.sqrt(e.log(1/(a*a))),i=u+((((-453642210148e-16*u-.204231210125)*u-.342242088547)*u-1)*u+.322232421088)/((((.0038560700634*u+.10353775285)*u+.531103462366)*u+.588581570495)*u+.099348462606);120>n&&(i+=(i*i*i+i)/n/4);var o=.8832-.2368*i;return 120>n&&(o+=-1.214/n+1.208*i/n),i*(o*e.log(t-1)+1.4142)}!function(e){for(var t=0;e.length>t;t++)!function(e){r[e]=function(r,e,t){return this instanceof arguments.callee?(this._a=r,this._b=e,this._c=t,this):new arguments.callee(r,e,t)},r.fn[e]=function(t,n,a){var u=r[e](t,n,a);return u.data=this,u},r[e].prototype.sample=function(t){var n=this._a,a=this._b,u=this._c;return t?r.alter(t,function(){return r[e].sample(n,a,u)}):r[e].sample(n,a,u)},function(t){for(var n=0;t.length>n;n++)!function(t){r[e].prototype[t]=function(n){var a=this._a,u=this._b,i=this._c;return n||0===n||(n=this.data),"number"!=typeof n?r.fn.map.call(n,function(n){return r[e][t](n,a,u,i)}):r[e][t](n,a,u,i)}}(t[n])}("pdf cdf inv".split(" ")),function(t){for(var n=0;t.length>n;n++)!function(t){r[e].prototype[t]=function(){return r[e][t](this._a,this._b,this._c)}}(t[n])}("mean median mode variance".split(" "))}(e[t])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),r.extend(r.beta,{pdf:function(t,n,a){return t>1||0>t?0:1==n&&1==a?1:512>n&&512>a?e.pow(t,n-1)*e.pow(1-t,a-1)/r.betafn(n,a):e.exp((n-1)*e.log(t)+(a-1)*e.log(1-t)-r.betaln(n,a))},cdf:function(e,t,n){return e>1||0>e?1*(e>1):r.ibeta(e,t,n)},inv:function(e,t,n){return r.ibetainv(e,t,n)},mean:function(r,e){return r/(r+e)},median:function(e,t){return r.ibetainv(.5,e,t)},mode:function(r,e){return(r-1)/(r+e-2)},sample:function(e,t){var n=r.randg(e);return n/(n+r.randg(t))},variance:function(r,t){return r*t/(e.pow(r+t,2)*(r+t+1))}}),r.extend(r.centralF,{pdf:function(t,n,a){var u,i;return 0>t?0:n>2?(u=n*t/(a+t*n),i=a/(a+t*n),n*i/2*r.binomial.pdf((n-2)/2,(n+a-2)/2,u)):0===t&&2>n?Infinity:0===t&&2===n?1:1/r.betafn(n/2,a/2)*e.pow(n/a,n/2)*e.pow(t,n/2-1)*e.pow(1+n/a*t,-(n+a)/2)},cdf:function(e,t,n){return 0>e?0:r.ibeta(t*e/(t*e+n),t/2,n/2)},inv:function(e,t,n){return n/(t*(1/r.ibetainv(e,t/2,n/2)-1))},mean:function(r,e){return e>2?e/(e-2):undefined},mode:function(r,e){return r>2?e*(r-2)/(r*(e+2)):undefined},sample:function(e,t){return 2*r.randg(e/2)/e/(2*r.randg(t/2)/t)},variance:function(r,e){return e>4?2*e*e*(r+e-2)/(r*(e-2)*(e-2)*(e-4)):undefined}}),r.extend(r.cauchy,{pdf:function(r,t,n){return 0>n?0:n/(e.pow(r-t,2)+e.pow(n,2))/e.PI},cdf:function(r,t,n){return e.atan((r-t)/n)/e.PI+.5},inv:function(r,t,n){return t+n*e.tan(e.PI*(r-.5))},median:function(r,e){return r},mode:function(r,e){return r},sample:function(t,n){return r.randn()*e.sqrt(1/(2*r.randg(.5)))*n+t}}),r.extend(r.chisquare,{pdf:function(t,n){return 0>t?0:0===t&&2===n?.5:e.exp((n/2-1)*e.log(t)-t/2-n/2*e.log(2)-r.gammaln(n/2))},cdf:function(e,t){return 0>e?0:r.lowRegGamma(t/2,e/2)},inv:function(e,t){return 2*r.gammapinv(e,.5*t)},mean:function(r){return r},median:function(r){return r*e.pow(1-2/(9*r),3)},mode:function(r){return r-2>0?r-2:0},sample:function(e){return 2*r.randg(e/2)},variance:function(r){return 2*r}}),r.extend(r.exponential,{pdf:function(r,t){return 0>r?0:t*e.exp(-t*r)},cdf:function(r,t){return 0>r?0:1-e.exp(-t*r)},inv:function(r,t){return-e.log(1-r)/t},mean:function(r){return 1/r},median:function(r){return 1/r*e.log(2)},mode:function(r){return 0},sample:function(r){return-1/r*e.log(e.random())},variance:function(r){return e.pow(r,-2)}}),r.extend(r.gamma,{pdf:function(t,n,a){return 0>t?0:0===t&&1===n?1/a:e.exp((n-1)*e.log(t)-t/a-r.gammaln(n)-n*e.log(a))},cdf:function(e,t,n){return 0>e?0:r.lowRegGamma(t,e/n)},inv:function(e,t,n){return r.gammapinv(e,t)*n},mean:function(r,e){return r*e},mode:function(r,e){return r>1?(r-1)*e:undefined},sample:function(e,t){return r.randg(e)*t},variance:function(r,e){return r*e*e}}),r.extend(r.invgamma,{pdf:function(t,n,a){return t>0?e.exp(-(n+1)*e.log(t)-a/t-r.gammaln(n)+n*e.log(a)):0},cdf:function(e,t,n){return e>0?1-r.lowRegGamma(t,n/e):0},inv:function(e,t,n){return n/r.gammapinv(1-e,t)},mean:function(r,e){return r>1?e/(r-1):undefined},mode:function(r,e){return e/(r+1)},sample:function(e,t){return t/r.randg(e)},variance:function(r,e){return r>2?e*e/((r-1)*(r-1)*(r-2)):undefined}}),r.extend(r.kumaraswamy,{pdf:function(r,t,n){return 0===r&&1===t?n:1===r&&1===n?t:e.exp(e.log(t)+e.log(n)+(t-1)*e.log(r)+(n-1)*e.log(1-e.pow(r,t)))},cdf:function(r,t,n){return 0>r?0:r>1?1:1-e.pow(1-e.pow(r,t),n)},inv:function(r,t,n){return e.pow(1-e.pow(1-r,1/n),1/t)},mean:function(e,t){return t*r.gammafn(1+1/e)*r.gammafn(t)/r.gammafn(1+1/e+t)},median:function(r,t){return e.pow(1-e.pow(2,-1/t),1/r)},mode:function(r,t){return 1>r||1>t||1===r||1===t?undefined:e.pow((r-1)/(r*t-1),1/r)},variance:function(r,e){throw Error("variance not yet implemented")}}),r.extend(r.lognormal,{pdf:function(r,t,n){return r>0?e.exp(-e.log(r)-.5*e.log(2*e.PI)-e.log(n)-e.pow(e.log(r)-t,2)/(2*n*n)):0},cdf:function(t,n,a){return 0>t?0:.5+.5*r.erf((e.log(t)-n)/e.sqrt(2*a*a))},inv:function(t,n,a){return e.exp(-1.4142135623730951*a*r.erfcinv(2*t)+n)},mean:function(r,t){return e.exp(r+t*t/2)},median:function(r,t){return e.exp(r)},mode:function(r,t){return e.exp(r-t*t)},sample:function(t,n){return e.exp(r.randn()*n+t)},variance:function(r,t){return(e.exp(t*t)-1)*e.exp(2*r+t*t)}}),r.extend(r.noncentralt,{pdf:function(t,n,a){return 1e-14>e.abs(a)?r.studentt.pdf(t,n):1e-14>e.abs(t)?e.exp(r.gammaln((n+1)/2)-a*a/2-.5*e.log(e.PI*n)-r.gammaln(n/2)):n/t*(r.noncentralt.cdf(t*e.sqrt(1+2/n),n+2,a)-r.noncentralt.cdf(t,n,a))},cdf:function(t,n,a){if(1e-14>e.abs(a))return r.studentt.cdf(t,n);var u=!1;0>t&&(u=!0,a=-a);for(var i=r.normal.cdf(-a,0,1),o=1e-14+1,s=o,l=t*t/(t*t+n),f=0,c=e.exp(-a*a/2),p=e.exp(-a*a/2-.5*e.log(2)-r.gammaln(1.5))*a;200>f||s>1e-14||o>1e-14;)s=o,f>0&&(c*=a*a/(2*f),p*=a*a/(2*(f+.5))),o=c*r.beta.cdf(l,f+.5,n/2)+p*r.beta.cdf(l,f+1,n/2),i+=.5*o,f++;return u?1-i:i}}),r.extend(r.normal,{pdf:function(r,t,n){return e.exp(-.5*e.log(2*e.PI)-e.log(n)-e.pow(r-t,2)/(2*n*n))},cdf:function(t,n,a){return.5*(1+r.erf((t-n)/e.sqrt(2*a*a)))},inv:function(e,t,n){return-1.4142135623730951*n*r.erfcinv(2*e)+t},mean:function(r,e){return r},median:function(r,e){return r},mode:function(r,e){return r},sample:function(e,t){return r.randn()*t+e},variance:function(r,e){return e*e}}),r.extend(r.pareto,{pdf:function(r,t,n){return t>r?0:n*e.pow(t,n)/e.pow(r,n+1)},cdf:function(r,t,n){return t>r?0:1-e.pow(t/r,n)},inv:function(r,t,n){return t/e.pow(1-r,1/n)},mean:function(r,t){return t>1?t*e.pow(r,t)/(t-1):undefined},median:function(r,t){return r*(t*e.SQRT2)},mode:function(r,e){return r},variance:function(r,t){return t>2?r*r*t/(e.pow(t-1,2)*(t-2)):undefined}}),r.extend(r.studentt,{pdf:function(t,n){return n=n>1e100?1e100:n,1/(e.sqrt(n)*r.betafn(.5,n/2))*e.pow(1+t*t/n,-(n+1)/2)},cdf:function(t,n){var a=n/2;return r.ibeta((t+e.sqrt(t*t+n))/(2*e.sqrt(t*t+n)),a,a)},inv:function(t,n){var a=r.ibetainv(2*e.min(t,1-t),.5*n,.5);return a=e.sqrt(n*(1-a)/a),t>.5?a:-a},mean:function(r){return r>1?0:undefined},median:function(r){return 0},mode:function(r){return 0},sample:function(t){return r.randn()*e.sqrt(t/(2*r.randg(t/2)))},variance:function(r){return r>2?r/(r-2):r>1?Infinity:undefined}}),r.extend(r.weibull,{pdf:function(r,t,n){return 0>r||0>t||0>n?0:n/t*e.pow(r/t,n-1)*e.exp(-e.pow(r/t,n))},cdf:function(r,t,n){return 0>r?0:1-e.exp(-e.pow(r/t,n))},inv:function(r,t,n){return t*e.pow(-e.log(1-r),1/n)},mean:function(e,t){return e*r.gammafn(1+1/t)},median:function(r,t){return r*e.pow(e.log(2),1/t)},mode:function(r,t){return t>1?r*e.pow((t-1)/t,1/t):0},sample:function(r,t){return r*e.pow(-e.log(e.random()),1/t)},variance:function(t,n){return t*t*r.gammafn(1+2/n)-e.pow(r.weibull.mean(t,n),2)}}),r.extend(r.uniform,{pdf:function(r,e,t){return e>r||r>t?0:1/(t-e)},cdf:function(r,e,t){return e>r?0:t>r?(r-e)/(t-e):1},inv:function(r,e,t){return e+r*(t-e)},mean:function(r,e){return.5*(r+e)},median:function(e,t){return r.mean(e,t)},mode:function(r,e){throw Error("mode is not yet implemented")},sample:function(r,t){return r/2+t/2+(t/2-r/2)*(2*e.random()-1)},variance:function(r,t){return e.pow(t-r,2)/12}}),r.extend(r.binomial,{pdf:function(t,n,a){return 0===a||1===a?n*a===t?1:0:r.combination(n,t)*e.pow(a,t)*e.pow(1-a,n-t)},cdf:function(e,t,n){var a=[],u=0;if(0>e)return 0;if(t>e){for(;e>=u;u++)a[u]=r.binomial.pdf(u,t,n);return r.sum(a)}return 1}}),r.extend(r.negbin,{pdf:function(t,n,a){return t===t>>>0&&(0>t?0:r.combination(t+n-1,n-1)*e.pow(1-a,t)*e.pow(a,n))},cdf:function(e,t,n){var a=0,u=0;if(0>e)return 0;for(;e>=u;u++)a+=r.negbin.pdf(u,t,n);return a}}),r.extend(r.hypgeom,{pdf:function(t,n,a,u){if(t!==t|0)return!1;if(0>t||a-(n-u)>t)return 0;if(t>u||t>a)return 0;if(2*a>n)return 2*u>n?r.hypgeom.pdf(n-a-u+t,n,n-a,n-u):r.hypgeom.pdf(u-t,n,n-a,u);if(2*u>n)return r.hypgeom.pdf(a-t,n,a,n-u);if(u>a)return r.hypgeom.pdf(t,n,u,a);for(var i=1,o=0,s=0;t>s;s++){for(;i>1&&u>o;)i*=1-a/(n-o),o++;i*=(u-s)*(a-s)/((s+1)*(n-a-u+s+1))}for(;u>o;o++)i*=1-a/(n-o);return e.min(1,e.max(0,i))},cdf:function(t,n,a,u){if(0>t||a-(n-u)>t)return 0;if(u>t&&a>t){if(2*a>n)return 2*u>n?r.hypgeom.cdf(n-a-u+t,n,n-a,n-u):1-r.hypgeom.cdf(u-t-1,n,n-a,u);if(2*u>n)return 1-r.hypgeom.cdf(a-t-1,n,a,n-u);if(u>a)return r.hypgeom.cdf(t,n,u,a);for(var i=1,o=1,s=0,l=0;t>l;l++){for(;i>1&&u>s;){var f=1-a/(n-s);o*=f,i*=f,s++}o*=(u-l)*(a-l)/((l+1)*(n-a-u+l+1)),i+=o}for(;u>s;s++)i*=1-a/(n-s);return e.min(1,e.max(0,i))}return 1}}),r.extend(r.poisson,{pdf:function(t,n){return 0>n||t%1!=0||0>t?0:e.pow(n,t)*e.exp(-n)/r.factorial(t)},cdf:function(e,t){var n=[],a=0;if(0>e)return 0;for(;e>=a;a++)n.push(r.poisson.pdf(a,t));return r.sum(n)},mean:function(r){return r},variance:function(r){return r},sample:function(r){var t=1,n=0,a=e.exp(-r);do{n++,t*=e.random()}while(t>a);return n-1}}),r.extend(r.triangular,{pdf:function(r,e,t,n){return e>=t||e>n||n>t?NaN:e>r||r>t?0:n>r?2*(r-e)/((t-e)*(n-e)):r===n?2/(t-e):2*(t-r)/((t-e)*(t-n))},cdf:function(r,t,n,a){return t>=n||t>a||a>n?NaN:r>t?n>r?r>a?1-e.pow(n-r,2)/((n-t)*(n-a)):e.pow(r-t,2)/((n-t)*(a-t)):1:0},inv:function(r,t,n,a){return t>=n||t>a||a>n?NaN:r>(a-t)/(n-t)?t+(n-t)*(1-e.sqrt((1-r)*(1-(a-t)/(n-t)))):t+(n-t)*e.sqrt(r*((a-t)/(n-t)))},mean:function(r,e,t){return(r+e+t)/3},median:function(r,t,n){return n>(r+t)/2?n>(r+t)/2?r+e.sqrt((t-r)*(n-r))/e.sqrt(2):void 0:t-e.sqrt((t-r)*(t-n))/e.sqrt(2)},mode:function(r,e,t){return t},sample:function(r,t,n){var a=e.random();return(n-r)/(t-r)>a?r+e.sqrt(a*(t-r)*(n-r)):t-e.sqrt((1-a)*(t-r)*(t-n))},variance:function(r,e,t){return(r*r+e*e+t*t-r*e-r*t-e*t)/18}}),r.extend(r.arcsine,{pdf:function(r,t,n){return n>t?r>t&&n>r?2/e.PI*e.pow(e.pow(n-t,2)-e.pow(2*r-t-n,2),-.5):0:NaN},cdf:function(r,t,n){return t>r?0:n>r?2/e.PI*e.asin(e.sqrt((r-t)/(n-t))):1},inv:function(r,t,n){return t+(.5-.5*e.cos(e.PI*r))*(n-t)},mean:function(r,e){return e>r?(r+e)/2:NaN},median:function(r,e){return e>r?(r+e)/2:NaN},mode:function(r,e){throw Error("mode is not yet implemented")},sample:function(t,n){return(t+n)/2+(n-t)/2*e.sin(2*e.PI*r.uniform.sample(0,1))},variance:function(r,t){return t>r?e.pow(t-r,2)/8:NaN}}),r.extend(r.laplace,{pdf:function(r,t,n){return n>0?e.exp(-e.abs(r-t)/n)/(2*n):0},cdf:function(r,t,n){return n>0?t>r?.5*e.exp((r-t)/n):1-.5*e.exp(-(r-t)/n):0},mean:function(r,e){return r},median:function(r,e){return r},mode:function(r,e){return r},variance:function(r,e){return 2*e*e},sample:function(r,n){var a=e.random()-.5;return r-n*t(a)*e.log(1-2*e.abs(a))}}),r.extend(r.tukey,{cdf:function(t,a,u){var i=a,o=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],s=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(0>=t)return 0;if(2>u||2>i)return NaN;if(!Number.isFinite(t))return 1;if(u>25e3)return n(t,1,i);var l,f=.5*u,c=f*e.log(u)-u*e.log(2)-r.gammaln(f),p=f-1,h=.25*u;l=u>100?u>800?u>5e3?.125:.25:.5:1,c+=e.log(l);for(var m=0,E=1;50>=E;E++){for(var g=0,d=(2*E-1)*l,v=1;16>=v;v++){var N,I;v>8?(N=v-8-1,I=c+p*e.log(d+o[N]*l)-(o[N]*l+d)*h):(N=v-1,I=c+p*e.log(d-o[N]*l)+(o[N]*l-d)*h);var b;if(I>=-30){b=v>8?t*e.sqrt(.5*(o[N]*l+d)):t*e.sqrt(.5*(-o[N]*l+d));g+=n(b,1,i)*s[N]*e.exp(I)}}if(E*l>=1&&1e-14>=g)break;m+=g}if(g>1e-14)throw Error("tukey.cdf failed to converge");return m>1&&(m=1),m},inv:function(t,n,u){var i=n;if(2>u||2>i)return NaN;if(0>t||t>1)return NaN;if(0===t)return 0;if(1===t)return Infinity;var o,s=a(t,i,u),l=r.tukey.cdf(s,n,u)-t;o=l>0?e.max(0,s-1):s+1;for(var f,c=r.tukey.cdf(o,n,u)-t,p=1;50>p;p++){f=o-c*(o-s)/(c-l),l=c,s=o,0>f&&(f=0,c=-t),c=r.tukey.cdf(f,n,u)-t,o=f;if(1e-4>e.abs(o-s))return f}throw Error("tukey.inv failed to converge")}})}(e,Math),function(e,t){function n(r){return u(r)||r instanceof e}var a=Array.prototype.push,u=e.utils.isArray;e.extend({add:function(r,t){return n(t)?(n(t[0])||(t=[t]),e.map(r,function(r,e,n){return r+t[e][n]})):e.map(r,function(r){return r+t})},subtract:function(r,t){return n(t)?(n(t[0])||(t=[t]),e.map(r,function(r,e,n){return r-t[e][n]||0})):e.map(r,function(r){return r-t})},divide:function(r,t){return n(t)?(n(t[0])||(t=[t]),e.multiply(r,e.inv(t))):e.map(r,function(r){return r/t})},multiply:function(r,t){var a,u,i,o,s,l,f,c;if(r.length===undefined&&t.length===undefined)return r*t;if(s=r.length,l=r[0].length,f=e.zeros(s,i=n(t)?t[0].length:l),c=0,n(t)){for(;i>c;c++)for(a=0;s>a;a++){for(o=0,u=0;l>u;u++)o+=r[a][u]*t[u][c];f[a][c]=o}return 1===s&&1===c?f[0][0]:f}return e.map(r,function(r){return r*t})},outer:function(r,t){return e.multiply(r.map(function(r){return[r]}),[t])},dot:function(r,t){n(r[0])||(r=[r]),n(t[0])||(t=[t]);for(var a,u,i=1===r[0].length&&1!==r.length?e.transpose(r):r,o=1===t[0].length&&1!==t.length?e.transpose(t):t,s=[],l=0,f=i.length,c=i[0].length;f>l;l++){for(s[l]=[],a=0,u=0;c>u;u++)a+=i[l][u]*o[l][u];s[l]=a}return 1===s.length?s[0]:s},pow:function(r,n){return e.map(r,function(r){return t.pow(r,n)})},exp:function(r){return e.map(r,function(r){return t.exp(r)})},log:function(r){return e.map(r,function(r){return t.log(r)})},abs:function(r){return e.map(r,function(r){return t.abs(r)})},norm:function(r,e){var a=0,u=0;for(isNaN(e)&&(e=2),n(r[0])&&(r=r[0]);r.length>u;u++)a+=t.pow(t.abs(r[u]),e);return t.pow(a,1/e)},angle:function(r,n){return t.acos(e.dot(r,n)/(e.norm(r)*e.norm(n)))},aug:function(r,e){for(var t=[],n=0;r.length>n;n++)t.push(r[n].slice());for(var n=0;t.length>n;n++)a.apply(t[n],e[n]);return t},inv:function(r){for(var t,n=r.length,a=r[0].length,u=e.identity(n,a),i=e.gauss_jordan(r,u),o=[],s=0;n>s;s++)for(o[s]=[],t=a;i[0].length>t;t++)o[s][t-a]=i[s][t];return o},det:function(r){var e,t=r.length,n=2*t,a=Array(n),u=t-1,i=n-1,o=u-t+1,s=i,l=0,f=0;if(2===t)return r[0][0]*r[1][1]-r[0][1]*r[1][0];for(;n>l;l++)a[l]=1;for(var l=0;t>l;l++){for(e=0;t>e;e++)a[0>o?o+t:o]*=r[l][e],a[t>s?s+t:s]*=r[l][e],o++,s--;o=--u-t+1,s=--i}for(var l=0;t>l;l++)f+=a[l];for(;n>l;l++)f-=a[l];return f},gauss_elimination:function(r,n){var a,u,i,o,s=0,l=0,f=r.length,c=r[0].length,p=1,h=0,m=[];r=e.aug(r,n),a=r[0].length;for(var s=0;f>s;s++){for(u=r[s][s],l=s,o=s+1;c>o;o++)uo;o++)i=r[s][o],r[s][o]=r[l][o],r[l][o]=i;for(l=s+1;f>l;l++)for(p=r[l][s]/r[s][s],o=s;a>o;o++)r[l][o]=r[l][o]-p*r[s][o]}for(var s=f-1;s>=0;s--){for(h=0,l=s+1;f-1>=l;l++)h+=m[l]*r[s][l];m[s]=(r[s][a-1]-h)/r[s][s]}return m},gauss_jordan:function(r,n){for(var a=e.aug(r,n),u=a.length,i=a[0].length,o=0,s=0;u>s;s++){for(var l=s,f=s+1;u>f;f++)t.abs(a[f][s])>t.abs(a[l][s])&&(l=f);var c=a[s];a[s]=a[l],a[l]=c;for(var f=s+1;u>f;f++){o=a[f][s]/a[s][s];for(var p=s;i>p;p++)a[f][p]-=a[s][p]*o}}for(var s=u-1;s>=0;s--){o=a[s][s];for(var f=0;s>f;f++)for(var p=i-1;p>s-1;p--)a[f][p]-=a[s][p]*a[f][s]/o;a[s][s]/=o;for(var p=u;i>p;p++)a[s][p]/=o}return a},triaUpSolve:function(r,t){var n,a=r[0].length,u=e.zeros(1,a)[0],i=!1;return t[0].length!=undefined&&(t=t.map(function(r){return r[0]}),i=!0),e.arange(a-1,-1,-1).forEach(function(i){n=e.arange(i+1,a).map(function(e){return u[e]*r[i][e]}),u[i]=(t[i]-e.sum(n))/r[i][i]}),i?u.map(function(r){return[r]}):u},triaLowSolve:function(r,t){var n,a=r[0].length,u=e.zeros(1,a)[0],i=!1;return t[0].length!=undefined&&(t=t.map(function(r){return r[0]}),i=!0),e.arange(a).forEach(function(a){n=e.arange(a).map(function(e){return r[a][e]*u[e]}),u[a]=(t[a]-e.sum(n))/r[a][a]}),i?u.map(function(r){return[r]}):u},lu:function(r){var t,n=r.length,a=e.identity(n),u=e.zeros(r.length,r[0].length);return e.arange(n).forEach(function(e){u[0][e]=r[0][e]}),e.arange(1,n).forEach(function(o){e.arange(o).forEach(function(n){t=e.arange(n).map(function(r){return a[o][r]*u[r][n]}),a[o][n]=(r[o][n]-e.sum(t))/u[n][n]}),e.arange(o,n).forEach(function(n){t=e.arange(o).map(function(r){return a[o][r]*u[r][n]}),u[o][n]=r[i][n]-e.sum(t)})}),[a,u]},cholesky:function(r){var n,a=r.length,u=e.zeros(r.length,r[0].length);return e.arange(a).forEach(function(i){n=e.arange(i).map(function(r){return t.pow(u[i][r],2)}),u[i][i]=t.sqrt(r[i][i]-e.sum(n)),e.arange(i+1,a).forEach(function(t){n=e.arange(i).map(function(r){return u[i][r]*u[t][r]}),u[t][i]=(r[i][t]-e.sum(n))/u[i][i]})}),u},gauss_jacobi:function(r,n,a,u){for(var i,o,s,l,f=0,c=0,p=r.length,h=[],m=[],E=[];p>f;f++)for(h[f]=[],m[f]=[],E[f]=[],c=0;p>c;c++)f>c?(h[f][c]=r[f][c],m[f][c]=E[f][c]=0):c>f?(m[f][c]=r[f][c],h[f][c]=E[f][c]=0):(E[f][c]=r[f][c],h[f][c]=m[f][c]=0);for(s=e.multiply(e.multiply(e.inv(E),e.add(h,m)),-1),o=e.multiply(e.inv(E),n),i=a,l=e.add(e.multiply(s,a),o),f=2;t.abs(e.norm(e.subtract(l,i)))>u;)i=l,l=e.add(e.multiply(s,i),o),f++;return l},gauss_seidel:function(r,n,a,u){for(var i,o,s,l,f,c=0,p=r.length,h=[],m=[],E=[];p>c;c++)for(h[c]=[],m[c]=[],E[c]=[],i=0;p>i;i++)c>i?(h[c][i]=r[c][i],m[c][i]=E[c][i]=0):i>c?(m[c][i]=r[c][i],h[c][i]=E[c][i]=0):(E[c][i]=r[c][i],h[c][i]=m[c][i]=0);for(l=e.multiply(e.multiply(e.inv(e.add(E,h)),m),-1),s=e.multiply(e.inv(e.add(E,h)),n),o=a,f=e.add(e.multiply(l,a),s),c=2;t.abs(e.norm(e.subtract(f,o)))>u;)o=f,f=e.add(e.multiply(l,o),s),c+=1;return f},SOR:function(r,n,a,u,i){for(var o,s,l,f,c,p=0,h=r.length,m=[],E=[],g=[];h>p;p++)for(m[p]=[],E[p]=[],g[p]=[],o=0;h>o;o++)p>o?(m[p][o]=r[p][o],E[p][o]=g[p][o]=0):o>p?(E[p][o]=r[p][o],m[p][o]=g[p][o]=0):(g[p][o]=r[p][o],m[p][o]=E[p][o]=0);for(f=e.multiply(e.inv(e.add(g,e.multiply(m,i))),e.subtract(e.multiply(g,1-i),e.multiply(E,i))),l=e.multiply(e.multiply(e.inv(e.add(g,e.multiply(m,i))),n),i),s=a,c=e.add(e.multiply(f,a),l),p=2;t.abs(e.norm(e.subtract(c,s)))>u;)s=c,c=e.add(e.multiply(f,s),l),p++;return c},householder:function(r){for(var n,a,u,i,o,s=r.length,l=r[0].length,f=0,c=[],p=[];s-1>f;f++){for(n=0,i=f+1;l>i;i++)n+=r[i][f]*r[i][f];for(o=r[f+1][f]>0?-1:1,n=o*t.sqrt(n),a=t.sqrt((n*n-r[f+1][f]*n)/2),c=e.zeros(s,1),c[f+1][0]=(r[f+1][f]-n)/(2*a),u=f+2;s>u;u++)c[u][0]=r[u][f]/(2*a);p=e.subtract(e.identity(s,l),e.multiply(e.multiply(c,e.transpose(c)),2)),r=e.multiply(p,e.multiply(r,p))}return r},QR:function(){function n(n){var i=n.length,o=n[0].length;n=e.copy(n),r=e.zeros(o,o);var s,l,f;for(l=0;o>l;l++){for(r[l][l]=t.sqrt(a(u(i).map(function(r){return n[r][l]*n[r][l]}))),s=0;i>s;s++)n[s][l]=n[s][l]/r[l][l];for(f=l+1;o>f;f++)for(r[l][f]=a(u(i).map(function(r){return n[r][l]*n[r][f]})),s=0;i>s;s++)n[s][f]=n[s][f]-n[s][l]*r[l][f]}return[n,r]}var a=e.sum,u=e.arange;return n}(),lstsq:function(r,t){function n(r){r=e.copy(r);var t=r.length,n=e.identity(t);return e.arange(t-1,-1,-1).forEach(function(t){e.sliceAssign(n,{row:t},e.divide(e.slice(n,{row:t}),r[t][t])),e.sliceAssign(r,{row:t},e.divide(e.slice(r,{row:t}),r[t][t])),e.arange(t).forEach(function(a){var u=e.multiply(r[a][t],-1),i=e.slice(r,{row:a}),o=e.multiply(e.slice(r,{row:t}),u);e.sliceAssign(r,{row:a},e.add(i,o));var s=e.slice(n,{row:a}),l=e.multiply(e.slice(n,{row:t}),u);e.sliceAssign(n,{row:a},e.add(s,l))})}),n}function a(r,t){var a=!1;t[0].length===undefined&&(t=t.map(function(r){return[r]}),a=!0);var u=e.QR(r),i=u[0],o=u[1],s=r[0].length,l=e.slice(i,{col:{end:s}}),f=e.slice(o,{row:{end:s}}),c=n(f),p=e.transpose(l);p[0].length===undefined&&(p=[p]);var h=e.multiply(e.multiply(c,p),t);return h.length===undefined&&(h=[[h]]),a?h.map(function(r){return r[0]}):h}return a}(),jacobi:function(r){for(var n,a,u,i,o,s,l,f,c=1,p=0,h=r.length,m=e.identity(h,h),E=[];1===c;){p++,s=r[0][1],i=0,o=1;for(var a=0;h>a;a++)for(u=0;h>u;u++)a!=u&&s0?t.PI/4:-t.PI/4:t.atan(2*r[i][o]/(r[i][i]-r[o][o]))/2,f=e.identity(h,h),f[i][i]=t.cos(l),f[i][o]=-t.sin(l),f[o][i]=t.sin(l),f[o][o]=t.cos(l),m=e.multiply(m,f),n=e.multiply(e.multiply(e.inv(f),r),f),r=n,c=0;for(var a=1;h>a;a++)for(u=1;h>u;u++)a!=u&&t.abs(r[a][u])>.001&&(c=1)}for(var a=0;h>a;a++)E.push(r[a][a]);return[m,E]},rungekutta:function(r,e,t,n,a,u){var i,o,s,l,f;if(2===u)for(;t>=n;)i=e*r(n,a),o=e*r(n+e,a+i),s=a+(i+o)/2,a=s,n+=e;if(4===u)for(;t>=n;)i=e*r(n,a),o=e*r(n+e/2,a+i/2),l=e*r(n+e/2,a+o/2),f=e*r(n+e,a+l),s=a+(i+2*o+2*l+f)/6,a=s,n+=e;return a},romberg:function(r,e,n,a){for(var u,i,o,s,l,f=0,c=(n-e)/2,p=[],h=[],m=[];a/2>f;){for(l=r(e),o=e,s=0;n>=o;o+=c,s++)p[s]=o;for(u=p.length,o=1;u-1>o;o++)l+=(o%2!=0?4:2)*r(p[o]);l=c/3*(l+r(n)),m[f]=l,c/=2,f++}for(i=m.length,u=1;1!==i;){for(o=0;i-1>o;o++)h[o]=(t.pow(4,u)*m[o+1]-m[o])/(t.pow(4,u)-1);i=h.length,m=h,h=[],u++}return m},richardson:function(r,e,n,a){function u(r,e){for(var t,n=0,a=r.length;a>n;n++)r[n]===e&&(t=n);return t}for(var i,o,s,l,f,c=t.abs(n-r[u(r,n)+1]),p=0,h=[],m=[];a>=c;)i=u(r,n+a),o=u(r,n),h[p]=(e[i]-2*e[o]+e[2*o-i])/(a*a),a/=2,p++;for(l=h.length,s=1;1!=l;){for(f=0;l-1>f;f++)m[f]=(t.pow(4,s)*h[f+1]-h[f])/(t.pow(4,s)-1);l=m.length,h=m,m=[],s++}return h},simpson:function(r,e,t,n){for(var a,u=(t-e)/n,i=r(e),o=[],s=e,l=0,f=1;t>=s;s+=u,l++)o[l]=s;for(a=o.length;a-1>f;f++)i+=(f%2!=0?4:2)*r(o[f]);return u/3*(i+r(t))},hermite:function(r,e,t,n){for(var a,u=r.length,i=0,o=0,s=[],l=[],f=[],c=[];u>o;o++){for(s[o]=1,a=0;u>a;a++)o!=a&&(s[o]*=(n-r[a])/(r[o]-r[a]));for(l[o]=0,a=0;u>a;a++)o!=a&&(l[o]+=1/(r[o]-r[a]));f[o]=s[o]*s[o]*(1-2*(n-r[o])*l[o]),c[o]=s[o]*s[o]*(n-r[o]),i+=f[o]*e[o]+c[o]*t[o]}return i},lagrange:function(r,e,t){for(var n,a,u=0,i=0,o=r.length;o>i;i++){for(a=e[i],n=0;o>n;n++)i!=n&&(a*=(t-r[n])/(r[i]-r[n]));u+=a}return u},cubic_spline:function(r,t,n){for(var a,u=r.length,i=0,o=[],s=[],l=[],f=[],c=[],p=[],h=[];u-1>i;i++)c[i]=r[i+1]-r[i];l[0]=0;for(var i=1;u-1>i;i++)l[i]=3/c[i]*(t[i+1]-t[i])-3/c[i-1]*(t[i]-t[i-1]);for(var i=1;u-1>i;i++)o[i]=[],s[i]=[],o[i][i-1]=c[i-1],o[i][i]=2*(c[i-1]+c[i]),o[i][i+1]=c[i],s[i][0]=l[i];for(f=e.multiply(e.inv(o),s),a=0;u-1>a;a++)p[a]=(t[a+1]-t[a])/c[a]-c[a]*(f[a+1][0]+2*f[a][0])/3,h[a]=(f[a+1][0]-f[a][0])/(3*c[a]);for(a=0;u>a&&r[a]<=n;a++);return a-=1,t[a]+(n-r[a])*p[a]+e.sq(n-r[a])*f[a]+(n-r[a])*e.sq(n-r[a])*h[a]},gauss_quadrature:function(){throw Error("gauss_quadrature not yet implemented")},PCA:function(r){for(var t,n,a=r.length,u=r[0].length,i=0,o=[],s=[],l=[],f=[],c=[],p=[],h=[],m=[],E=[],g=[],i=0;a>i;i++)o[i]=e.sum(r[i])/u;for(var i=0;u>i;i++)for(h[i]=[],t=0;a>t;t++)h[i][t]=r[t][i]-o[t];h=e.transpose(h);for(var i=0;a>i;i++)for(m[i]=[],t=0;a>t;t++)m[i][t]=e.dot([h[i]],[h[t]])/(u-1);l=e.jacobi(m),E=l[0],s=l[1],g=e.transpose(E);for(var i=0;s.length>i;i++)for(t=i;s.length>t;t++)s[t]>s[i]&&(n=s[i],s[i]=s[t],s[t]=n,f=g[i],g[i]=g[t],g[t]=f);p=e.transpose(h);for(var i=0;a>i;i++)for(c[i]=[],t=0;p.length>t;t++)c[i][t]=e.dot([g[i]],[p[t]]);return[r,s,g,c]}}),function(r){for(var t=0;r.length>t;t++)!function(r){e.fn[r]=function(t,n){var a=this;return n?(setTimeout(function(){n.call(a,e.fn[r].call(a,t))},15),this):"number"==typeof e[r](this,t)?e[r](this,t):e(e[r](this,t))}}(r[t])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(e,Math),function(r,e){function t(r,t,n,a){if(r>1||n>1||0>=r||0>=n)throw Error("Proportions should be greater than 0 and less than 1");var u=(r*t+n*a)/(t+a);return(r-n)/e.sqrt(u*(1-u)*(1/t+1/a))}var n=[].slice,a=r.utils.isNumber,u=r.utils.isArray;r.extend({zscore:function(){var e=n.call(arguments);return a(e[1])?(e[0]-e[1])/e[2]:(e[0]-r.mean(e[1]))/r.stdev(e[1],e[2])},ztest:function(){var t,a=n.call(arguments);return u(a[1])?(t=r.zscore(a[0],a[1],a[3]),1===a[2]?r.normal.cdf(-e.abs(t),0,1):2*r.normal.cdf(-e.abs(t),0,1)):a.length>2?(t=r.zscore(a[0],a[1],a[2]),1===a[3]?r.normal.cdf(-e.abs(t),0,1):2*r.normal.cdf(-e.abs(t),0,1)):(t=a[0],1===a[1]?r.normal.cdf(-e.abs(t),0,1):2*r.normal.cdf(-e.abs(t),0,1))}}),r.extend(r.fn,{zscore:function(r,e){return(r-this.mean())/this.stdev(e)},ztest:function(t,n,a){var u=e.abs(this.zscore(t,a));return 1===n?r.normal.cdf(-u,0,1):2*r.normal.cdf(-u,0,1)}}),r.extend({tscore:function(){var t=n.call(arguments);return 4===t.length?(t[0]-t[1])/(t[2]/e.sqrt(t[3])):(t[0]-r.mean(t[1]))/(r.stdev(t[1],!0)/e.sqrt(t[1].length))},ttest:function(){var t,u=n.call(arguments);return 5===u.length?(t=e.abs(r.tscore(u[0],u[1],u[2],u[3])),1===u[4]?r.studentt.cdf(-t,u[3]-1):2*r.studentt.cdf(-t,u[3]-1)):a(u[1])?(t=e.abs(u[0]),1==u[2]?r.studentt.cdf(-t,u[1]-1):2*r.studentt.cdf(-t,u[1]-1)):(t=e.abs(r.tscore(u[0],u[1])),1==u[2]?r.studentt.cdf(-t,u[1].length-1):2*r.studentt.cdf(-t,u[1].length-1))}}),r.extend(r.fn,{tscore:function(r){return(r-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(t,n){return 1===n?1-r.studentt.cdf(e.abs(this.tscore(t)),this.cols()-1):2*r.studentt.cdf(-e.abs(this.tscore(t)),this.cols()-1)}}),r.extend({anovafscore:function(){var t,a,u,i,o,s,l,f,c=n.call(arguments);if(1===c.length){o=Array(c[0].length);for(var l=0;c[0].length>l;l++)o[l]=c[0][l];c=o}if(2===c.length)return r.variance(c[0])/r.variance(c[1]);a=[];for(var l=0;c.length>l;l++)a=a.concat(c[l]);u=r.mean(a),t=0;for(var l=0;c.length>l;l++)t+=c[l].length*e.pow(r.mean(c[l])-u,2);t/=c.length-1,s=0;for(var l=0;c.length>l;l++)for(i=r.mean(c[l]),f=0;c[l].length>f;f++)s+=e.pow(c[l][f]-i,2);return s/=a.length-c.length,t/s},anovaftest:function(){var e,t,u,i,o=n.call(arguments);if(a(o[0]))return 1-r.centralF.cdf(o[0],o[1],o[2]);anovafscore=r.anovafscore(o),e=o.length-1,u=0;for(var i=0;o.length>i;i++)u+=o[i].length;return t=u-e-1,1-r.centralF.cdf(anovafscore,e,t)},ftest:function(e,t,n){return 1-r.centralF.cdf(e,t,n)}}),r.extend(r.fn,{anovafscore:function(){return r.anovafscore(this.toArray())},anovaftes:function(){for(var e,t=0,e=0;this.length>e;e++)t+=this[e].length;return r.ftest(this.anovafscore(),this.length-1,t-this.length)}}),r.extend({qscore:function(){var t,u,i,o,s,l=n.call(arguments);return a(l[0])?(t=l[0],u=l[1],i=l[2],o=l[3],s=l[4]):(t=r.mean(l[0]),u=r.mean(l[1]),i=l[0].length,o=l[1].length,s=l[2]),e.abs(t-u)/(s*e.sqrt((1/i+1/o)/2))},qtest:function(){var e,t=n.call(arguments);3===t.length?(e=t[0],t=t.slice(1)):7===t.length?(e=r.qscore(t[0],t[1],t[2],t[3],t[4]),t=t.slice(5)):(e=r.qscore(t[0],t[1],t[2]),t=t.slice(3));var a=t[0],u=t[1];return 1-r.tukey.cdf(e,u,a-u)},tukeyhsd:function(e){for(var t=r.pooledstdev(e),n=e.map(function(e){return r.mean(e)}),a=e.reduce(function(r,e){return r+e.length},0),u=[],i=0;e.length>i;++i)for(var o=i+1;e.length>o;++o){var s=r.qtest(n[i],n[o],e[i].length,e[o].length,t,a,e.length);u.push([[i,o],s])}return u}}),r.extend({normalci:function(){var t,a=n.call(arguments),u=Array(2);return t=e.abs(4===a.length?r.normal.inv(a[1]/2,0,1)*a[2]/e.sqrt(a[3]):r.normal.inv(a[1]/2,0,1)*r.stdev(a[2])/e.sqrt(a[2].length)),u[0]=a[0]-t,u[1]=a[0]+t,u},tci:function(){var t,a=n.call(arguments),u=Array(2);return t=e.abs(4===a.length?r.studentt.inv(a[1]/2,a[3]-1)*a[2]/e.sqrt(a[3]):r.studentt.inv(a[1]/2,a[2].length-1)*r.stdev(a[2],!0)/e.sqrt(a[2].length)),u[0]=a[0]-t,u[1]=a[0]+t,u},significant:function(r,e){return e>r}}),r.extend(r.fn,{normalci:function(e,t){return r.normalci(e,t,this.toArray())},tci:function(e,t){return r.tci(e,t,this.toArray())}}),r.extend(r.fn,{oneSidedDifferenceOfProportions:function(e,n,a,u){var i=t(e,n,a,u);return r.ztest(i,1)},twoSidedDifferenceOfProportions:function(e,n,a,u){var i=t(e,n,a,u);return r.ztest(i,2)}})}(e,Math),e.models=function(){function r(r,e){return t(r,e)}function r(r){var n=r[0].length;return e.arange(n).map(function(a){var u=e.arange(n).filter(function(r){return r!==a});return t(e.col(r,a).map(function(r){return r[0]}),e.col(r,u))})}function t(r,t){var n=r.length,a=t[0].length-1,u=n-a-1,i=e.lstsq(t,r),o=e.multiply(t,i.map(function(r){return[r]})).map(function(r){return r[0]}),s=e.subtract(r,o),l=e.mean(r),f=e.sum(o.map(function(r){return Math.pow(r-l,2)})),c=e.sum(r.map(function(r,e){return Math.pow(r-o[e],2)})),p=f+c;return{exog:t,endog:r,nobs:n,df_model:a,df_resid:u,coef:i,predict:o,resid:s,ybar:l,SST:p,SSE:f,SSR:c,R2:f/p}}function n(t){var n=r(t.exog),a=Math.sqrt(t.SSR/t.df_resid),u=n.map(function(r){var e=r.SST,t=r.R2;return a/Math.sqrt(e*(1-t))}),i=t.coef.map(function(r,e){return(r-0)/u[e]}),o=i.map(function(r){var n=e.studentt.cdf(r,t.df_resid);return 2*(n>.5?1-n:n)}),s=e.studentt.inv(.975,t.df_resid),l=t.coef.map(function(r,e){var t=s*u[e];return[r-t,r+t]});return{se:u,t:i,p:o,sigmaHat:a,interval95:l}}function a(r){var t=r.R2/r.df_model/((1-r.R2)/r.df_resid);return{F_statistic:t,pvalue:1-function(r,t,n){return e.beta.cdf(r/(n/t+r),t/2,n/2)}(t,r.df_model,r.df_resid)}}function u(r,e){var u=t(r,e),i=n(u),o=a(u),s=1-(u.nobs-1)/u.df_resid*(1-u.R2);return u.t=i,u.f=o,u.adjust_R2=s,u}return{ols:u}}(),e.jStat=e,e})},function(r,e,t){var n=t(1),a=t(9),u=t(0);e.UNIQUE=function(){for(var r=[],e=0;arguments.length>e;++e){for(var t=!1,n=arguments[e],a=0;r.length>a&&!(t=r[a]===n);++a);t||r.push(n)}return r},e.FLATTEN=n.flatten,e.ARGS2ARRAY=function(){return Array.prototype.slice.call(arguments,0)},e.REFERENCE=function(r,e){if(!arguments.length)return u.error;try{for(var t=e.split("."),n=r,a=0;t.length>a;++a){var i=t[a];if("]"===i[i.length-1]){var o=i.indexOf("["),s=i.substring(o+1,i.length-1);n=n[i.substring(0,o)][s]}else n=n[i]}return n}catch(u){}},e.JOIN=function(r,e){return r.join(e)},e.NUMBERS=function(){return n.flatten(arguments).filter(function(r){return"number"==typeof r})},e.NUMERAL=function(r,e){return a(r).format(e)}},function(r,e,t){function n(r){return/^[01]{1,10}$/.test(r)}var a=t(0),u=t(11).jStat,i=t(6),o=t(1),s=t(28);e.BESSELI=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:s.besseli(r,e)},e.BESSELJ=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:s.besselj(r,e)},e.BESSELK=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:s.besselk(r,e)},e.BESSELY=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:s.bessely(r,e)},e.BIN2DEC=function(r){if(!n(r))return a.num;var e=parseInt(r,2),t=""+r;return 10===t.length&&"1"===t.substring(0,1)?parseInt(t.substring(1),2)-512:e},e.BIN2HEX=function(r,e){if(!n(r))return a.num;var t=""+r;if(10===t.length&&"1"===t.substring(0,1))return(0xfffffffe00+parseInt(t.substring(1),2)).toString(16);var u=parseInt(r,2).toString(16);return e===undefined?u:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),u.length>e?a.num:i.REPT("0",e-u.length)+u)},e.BIN2OCT=function(r,e){if(!n(r))return a.num;var t=""+r;if(10===t.length&&"1"===t.substring(0,1))return(1073741312+parseInt(t.substring(1),2)).toString(8);var u=parseInt(r,2).toString(8);return e===undefined?u:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),u.length>e?a.num:i.REPT("0",e-u.length)+u)},e.BITAND=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:0>r||0>e?a.num:Math.floor(r)!==r||Math.floor(e)!==e?a.num:r>0xffffffffffff||e>0xffffffffffff?a.num:r&e},e.BITLSHIFT=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:0>r?a.num:Math.floor(r)!==r?a.num:r>0xffffffffffff?a.num:Math.abs(e)>53?a.num:0>e?r>>-e:r<r||0>e?a.num:Math.floor(r)!==r||Math.floor(e)!==e?a.num:r>0xffffffffffff||e>0xffffffffffff?a.num:r|e},e.BITRSHIFT=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:0>r?a.num:Math.floor(r)!==r?a.num:r>0xffffffffffff?a.num:Math.abs(e)>53?a.num:0>e?r<<-e:r>>e},e.BITXOR=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:0>r||0>e?a.num:Math.floor(r)!==r||Math.floor(e)!==e?a.num:r>0xffffffffffff||e>0xffffffffffff?a.num:r^e},e.COMPLEX=function(r,e,t){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?r:"i"!==(t=t===undefined?"i":t)&&"j"!==t?a.value:0===r&&0===e?0:0===r?1===e?t:""+e+t:0===e?""+r:r+(e>0?"+":"")+(1===e?t:""+e+t)},e.CONVERT=function(r,e,t){if((r=o.parseNumber(r))instanceof Error)return r;for(var n,u=[["a.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["a.u. of charge","e",null,"electric_charge",!1,!1,1.60217653141414e-19],["a.u. of energy","Eh",null,"energy",!1,!1,4.35974417757576e-18],["a.u. of length","a?",null,"length",!1,!1,5.29177210818182e-11],["a.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["a.u. of time","?/Eh",null,"time",!1,!1,2.41888432650516e-17],["admiralty knot","admkn",null,"speed",!1,!0,.514773333],["ampere","A",null,"electric_current",!0,!1,1],["ampere per meter","A/m",null,"magnetic_field_intensity",!0,!1,1],["ångström","Å",["ang"],"length",!1,!0,1e-10],["are","ar",null,"area",!1,!0,100],["astronomical unit","ua",null,"length",!1,!1,1.49597870691667e-11],["bar","bar",null,"pressure",!1,!1,1e5],["barn","b",null,"area",!1,!1,1e-28],["becquerel","Bq",null,"radioactivity",!0,!1,1],["bit","bit",["b"],"information",!1,!0,1],["btu","BTU",["btu"],"energy",!1,!0,1055.05585262],["byte","byte",null,"information",!1,!0,8],["candela","cd",null,"luminous_intensity",!0,!1,1],["candela per square metre","cd/m?",null,"luminance",!0,!1,1],["coulomb","C",null,"electric_charge",!0,!1,1],["cubic ångström","ang3",["ang^3"],"volume",!1,!0,1e-30],["cubic foot","ft3",["ft^3"],"volume",!1,!0,.028316846592],["cubic inch","in3",["in^3"],"volume",!1,!0,16387064e-12],["cubic light-year","ly3",["ly^3"],"volume",!1,!0,8.46786664623715e-47],["cubic metre","m?",null,"volume",!0,!0,1],["cubic mile","mi3",["mi^3"],"volume",!1,!0,4168181825.44058],["cubic nautical mile","Nmi3",["Nmi^3"],"volume",!1,!0,6352182208],["cubic Pica","Pica3",["Picapt3","Pica^3","Picapt^3"],"volume",!1,!0,7.58660370370369e-8],["cubic yard","yd3",["yd^3"],"volume",!1,!0,.764554857984],["cup","cup",null,"volume",!1,!0,.0002365882365],["dalton","Da",["u"],"mass",!1,!1,1.66053886282828e-27],["day","d",["day"],"time",!1,!0,86400],["degree","°",null,"angle",!1,!1,.0174532925199433],["degrees Rankine","Rank",null,"temperature",!1,!0,.555555555555556],["dyne","dyn",["dy"],"force",!1,!0,1e-5],["electronvolt","eV",["ev"],"energy",!1,!0,1.60217656514141],["ell","ell",null,"length",!1,!0,1.143],["erg","erg",["e"],"energy",!1,!0,1e-7],["farad","F",null,"electric_capacitance",!0,!1,1],["fluid ounce","oz",null,"volume",!1,!0,295735295625e-16],["foot","ft",null,"length",!1,!0,.3048],["foot-pound","flb",null,"energy",!1,!0,1.3558179483314],["gal","Gal",null,"acceleration",!1,!1,.01],["gallon","gal",null,"volume",!1,!0,.003785411784],["gauss","G",["ga"],"magnetic_flux_density",!1,!0,1],["grain","grain",null,"mass",!1,!0,647989e-10],["gram","g",null,"mass",!1,!0,.001],["gray","Gy",null,"absorbed_dose",!0,!1,1],["gross registered ton","GRT",["regton"],"volume",!1,!0,2.8316846592],["hectare","ha",null,"area",!1,!0,1e4],["henry","H",null,"inductance",!0,!1,1],["hertz","Hz",null,"frequency",!0,!1,1],["horsepower","HP",["h"],"power",!1,!0,745.69987158227],["horsepower-hour","HPh",["hh","hph"],"energy",!1,!0,2684519.538],["hour","h",["hr"],"time",!1,!0,3600],["imperial gallon (U.K.)","uk_gal",null,"volume",!1,!0,.00454609],["imperial hundredweight","lcwt",["uk_cwt","hweight"],"mass",!1,!0,50.802345],["imperial quart (U.K)","uk_qt",null,"volume",!1,!0,.0011365225],["imperial ton","brton",["uk_ton","LTON"],"mass",!1,!0,1016.046909],["inch","in",null,"length",!1,!0,.0254],["international acre","uk_acre",null,"area",!1,!0,4046.8564224],["IT calorie","cal",null,"energy",!1,!0,4.1868],["joule","J",null,"energy",!0,!0,1],["katal","kat",null,"catalytic_activity",!0,!1,1],["kelvin","K",["kel"],"temperature",!0,!0,1],["kilogram","kg",null,"mass",!0,!0,1],["knot","kn",null,"speed",!1,!0,.514444444444444],["light-year","ly",null,"length",!1,!0,9460730472580800],["litre","L",["l","lt"],"volume",!1,!0,.001],["lumen","lm",null,"luminous_flux",!0,!1,1],["lux","lx",null,"illuminance",!0,!1,1],["maxwell","Mx",null,"magnetic_flux",!1,!1,1e-18],["measurement ton","MTON",null,"volume",!1,!0,1.13267386368],["meter per hour","m/h",["m/hr"],"speed",!1,!0,.00027777777777778],["meter per second","m/s",["m/sec"],"speed",!0,!0,1],["meter per second squared","m?s??",null,"acceleration",!0,!1,1],["parsec","pc",["parsec"],"length",!1,!0,0x6da012f958ee1c],["meter squared per second","m?/s",null,"kinematic_viscosity",!0,!1,1],["metre","m",null,"length",!0,!0,1],["miles per hour","mph",null,"speed",!1,!0,.44704],["millimetre of mercury","mmHg",null,"pressure",!1,!1,133.322],["minute","?",null,"angle",!1,!1,.000290888208665722],["minute","min",["mn"],"time",!1,!0,60],["modern teaspoon","tspm",null,"volume",!1,!0,5e-6],["mole","mol",null,"amount_of_substance",!0,!1,1],["morgen","Morgen",null,"area",!1,!0,2500],["n.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["n.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["n.u. of speed","c?",null,"speed",!1,!1,299792458],["n.u. of time","?/(me?c??)",null,"time",!1,!1,1.28808866778687e-21],["nautical mile","M",["Nmi"],"length",!1,!0,1852],["newton","N",null,"force",!0,!0,1],["œrsted","Oe ",null,"magnetic_field_intensity",!1,!1,79.5774715459477],["ohm","Ω",null,"electric_resistance",!0,!1,1],["ounce mass","ozm",null,"mass",!1,!0,.028349523125],["pascal","Pa",null,"pressure",!0,!1,1],["pascal second","Pa?s",null,"dynamic_viscosity",!0,!1,1],["pferdestärke","PS",null,"power",!1,!0,735.49875],["phot","ph",null,"illuminance",!1,!1,1e-4],["pica (1/6 inch)","pica",null,"length",!1,!0,.00035277777777778],["pica (1/72 inch)","Pica",["Picapt"],"length",!1,!0,.00423333333333333],["poise","P",null,"dynamic_viscosity",!1,!1,.1],["pond","pond",null,"force",!1,!0,.00980665],["pound force","lbf",null,"force",!1,!0,4.4482216152605],["pound mass","lbm",null,"mass",!1,!0,.45359237],["quart","qt",null,"volume",!1,!0,.000946352946],["radian","rad",null,"angle",!0,!1,1],["second","?",null,"angle",!1,!1,484813681109536e-20],["second","s",["sec"],"time",!0,!0,1],["short hundredweight","cwt",["shweight"],"mass",!1,!0,45.359237],["siemens","S",null,"electrical_conductance",!0,!1,1],["sievert","Sv",null,"equivalent_dose",!0,!1,1],["slug","sg",null,"mass",!1,!0,14.59390294],["square ångström","ang2",["ang^2"],"area",!1,!0,1e-20],["square foot","ft2",["ft^2"],"area",!1,!0,.09290304],["square inch","in2",["in^2"],"area",!1,!0,64516e-8],["square light-year","ly2",["ly^2"],"area",!1,!0,8.95054210748189e31],["square meter","m?",null,"area",!0,!0,1],["square mile","mi2",["mi^2"],"area",!1,!0,2589988.110336],["square nautical mile","Nmi2",["Nmi^2"],"area",!1,!0,3429904],["square Pica","Pica2",["Picapt2","Pica^2","Picapt^2"],"area",!1,!0,1792111111111e-17],["square yard","yd2",["yd^2"],"area",!1,!0,.83612736],["statute mile","mi",null,"length",!1,!0,1609.344],["steradian","sr",null,"solid_angle",!0,!1,1],["stilb","sb",null,"luminance",!1,!1,1e-4],["stokes","St",null,"kinematic_viscosity",!1,!1,1e-4],["stone","stone",null,"mass",!1,!0,6.35029318],["tablespoon","tbs",null,"volume",!1,!0,147868e-10],["teaspoon","tsp",null,"volume",!1,!0,492892e-11],["tesla","T",null,"magnetic_flux_density",!0,!0,1],["thermodynamic calorie","c",null,"energy",!1,!0,4.184],["ton","ton",null,"mass",!1,!0,907.18474],["tonne","t",null,"mass",!1,!1,1e3],["U.K. pint","uk_pt",null,"volume",!1,!0,.00056826125],["U.S. bushel","bushel",null,"volume",!1,!0,.03523907],["U.S. oil barrel","barrel",null,"volume",!1,!0,.158987295],["U.S. pint","pt",["us_pt"],"volume",!1,!0,.000473176473],["U.S. survey mile","survey_mi",null,"length",!1,!0,1609.347219],["U.S. survey/statute acre","us_acre",null,"area",!1,!0,4046.87261],["volt","V",null,"voltage",!0,!1,1],["watt","W",null,"power",!0,!0,1],["watt-hour","Wh",["wh"],"energy",!1,!0,3600],["weber","Wb",null,"magnetic_flux",!0,!1,1],["yard","yd",null,"length",!1,!0,.9144],["year","yr",null,"time",!1,!0,31557600]],i={Yi:["yobi",80,1.2089258196146292e24,"Yi","yotta"],Zi:["zebi",70,0x400000000000000000,"Zi","zetta"],Ei:["exbi",60,0x1000000000000000,"Ei","exa"],Pi:["pebi",50,0x4000000000000,"Pi","peta"],Ti:["tebi",40,1099511627776,"Ti","tera"],Gi:["gibi",30,1073741824,"Gi","giga"],Mi:["mebi",20,1048576,"Mi","mega"],ki:["kibi",10,1024,"ki","kilo"]},s={Y:["yotta",1e24,"Y"],Z:["zetta",1e21,"Z"],E:["exa",1e18,"E"],P:["peta",1e15,"P"],T:["tera",1e12,"T"],G:["giga",1e9,"G"],M:["mega",1e6,"M"],k:["kilo",1e3,"k"],h:["hecto",100,"h"],e:["dekao",10,"e"],d:["deci",.1,"d"],c:["centi",.01,"c"],m:["milli",.001,"m"],u:["micro",1e-6,"u"],n:["nano",1e-9,"n"],p:["pico",1e-12,"p"],f:["femto",1e-15,"f"],a:["atto",1e-18,"a"],z:["zepto",1e-21,"z"],y:["yocto",1e-24,"y"]},l=null,f=null,c=e,p=t,h=1,m=1,E=0;146>E;E++)n=null===u[E][2]?[]:u[E][2],u[E][1]!==c&&0>n.indexOf(c)||(l=u[E]),u[E][1]!==p&&0>n.indexOf(p)||(f=u[E]);if(null===l){var g=i[e.substring(0,2)],d=s[e.substring(0,1)];"da"===e.substring(0,2)&&(d=["dekao",10,"da"]),g?(h=g[2],c=e.substring(2)):d&&(h=d[1],c=e.substring(d[2].length));for(var v=0;146>v;v++)n=null===u[v][2]?[]:u[v][2],u[v][1]!==c&&0>n.indexOf(c)||(l=u[v])}if(null===f){var N=i[t.substring(0,2)],I=s[t.substring(0,1)];"da"===t.substring(0,2)&&(I=["dekao",10,"da"]),N?(m=N[2],p=t.substring(2)):I&&(m=I[1],p=t.substring(I[2].length));for(var b=0;146>b;b++)n=null===u[b][2]?[]:u[b][2],u[b][1]!==p&&0>n.indexOf(p)||(f=u[b])}return null===l||null===f?a.na:l[3]!==f[3]?a.na:r*l[6]*h/(f[6]*m)},e.DEC2BIN=function(r,e){if((r=o.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,3}$/.test(r)||-512>r||r>511)return a.num;if(0>r)return"1"+i.REPT("0",9-(512+r).toString(2).length)+(512+r).toString(2);var t=parseInt(r,10).toString(2);return void 0===e?t:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),t.length>e?a.num:i.REPT("0",e-t.length)+t)},e.DEC2HEX=function(r,e){if((r=o.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,12}$/.test(r)||-549755813888>r||r>549755813887)return a.num;if(0>r)return(1099511627776+r).toString(16);var t=parseInt(r,10).toString(16);return void 0===e?t:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),t.length>e?a.num:i.REPT("0",e-t.length)+t)},e.DEC2OCT=function(r,e){if((r=o.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,9}$/.test(r)||-536870912>r||r>536870911)return a.num;if(0>r)return(1073741824+r).toString(8);var t=parseInt(r,10).toString(8);return void 0===e?t:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),t.length>e?a.num:i.REPT("0",e-t.length)+t)},e.DELTA=function(r,e){return e=e===undefined?0:e,r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:r===e?1:0},e.ERF=function(r,e){return e=e===undefined?0:e,r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:u.erf(r)},e.ERF.PRECISE=function(){throw Error("ERF.PRECISE is not implemented")},e.ERFC=function(r){return isNaN(r)?a.value:u.erfc(r)},e.ERFC.PRECISE=function(){throw Error("ERFC.PRECISE is not implemented")},e.GESTEP=function(r,e){return e=e||0,r=o.parseNumber(r),o.anyIsError(e,r)?r:e>r?0:1},e.HEX2BIN=function(r,e){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return a.num;var t=10===r.length&&"f"===r.substring(0,1).toLowerCase(),n=t?parseInt(r,16)-1099511627776:parseInt(r,16);if(-512>n||n>511)return a.num;if(t)return"1"+i.REPT("0",9-(512+n).toString(2).length)+(512+n).toString(2);var u=n.toString(2);return e===undefined?u:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),u.length>e?a.num:i.REPT("0",e-u.length)+u)},e.HEX2DEC=function(r){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return a.num;var e=parseInt(r,16);return 549755813888>e?e:e-1099511627776},e.HEX2OCT=function(r,e){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return a.num;var t=parseInt(r,16);if(t>536870911&&0xffe0000000>t)return a.num;if(t>=0xffe0000000)return(t-0xffc0000000).toString(8);var n=t.toString(8);return e===undefined?n:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),n.length>e?a.num:i.REPT("0",e-n.length)+n)},e.IMABS=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:Math.sqrt(Math.pow(t,2)+Math.pow(n,2))},e.IMAGINARY=function(r){if(r===undefined||!0===r||!1===r)return a.value;if(0===r||"0"===r)return 0;if(["i","j"].indexOf(r)>=0)return 1;r=r.replace("+i","+1i").replace("-i","-1i").replace("+j","+1j").replace("-j","-1j");var e=r.indexOf("+"),t=r.indexOf("-");0===e&&(e=r.indexOf("+",1)),0===t&&(t=r.indexOf("-",1));var n=r.substring(r.length-1,r.length),u="i"===n||"j"===n;return 0>e&&0>t?u?isNaN(r.substring(0,r.length-1))?a.num:r.substring(0,r.length-1):isNaN(r)?a.num:0:u?0>e?isNaN(r.substring(0,t))||isNaN(r.substring(t+1,r.length-1))?a.num:-+r.substring(t+1,r.length-1):isNaN(r.substring(0,e))||isNaN(r.substring(e+1,r.length-1))?a.num:+r.substring(e+1,r.length-1):a.num},e.IMARGUMENT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:0===t&&0===n?a.div0:0===t&&n>0?Math.PI/2:0===t&&0>n?-Math.PI/2:0===n&&t>0?0:0===n&&0>t?-Math.PI:t>0?Math.atan(n/t):0>t&&n>=0?Math.atan(n/t)+Math.PI:Math.atan(n/t)-Math.PI},e.IMCONJUGATE=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",0!==n?e.COMPLEX(t,-n,u):r},e.IMCOS=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.cos(t)*(Math.exp(n)+Math.exp(-n))/2,-Math.sin(t)*(Math.exp(n)-Math.exp(-n))/2,u)},e.IMCOSH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.cos(n)*(Math.exp(t)+Math.exp(-t))/2,Math.sin(n)*(Math.exp(t)-Math.exp(-t))/2,u)},e.IMCOT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:e.IMDIV(e.IMCOS(r),e.IMSIN(r))},e.IMDIV=function(r,t){var n=e.IMREAL(r),u=e.IMAGINARY(r),i=e.IMREAL(t),s=e.IMAGINARY(t);if(o.anyIsError(n,u,i,s))return a.value;var l=r.substring(r.length-1),f=t.substring(t.length-1),c="i";if("j"===l?c="j":"j"===f&&(c="j"),0===i&&0===s)return a.num;var p=i*i+s*s;return e.COMPLEX((n*i+u*s)/p,(u*i-n*s)/p,c)},e.IMEXP=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);u="i"===u||"j"===u?u:"i";var i=Math.exp(t);return e.COMPLEX(i*Math.cos(n),i*Math.sin(n),u)},e.IMLN=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n)),Math.atan(n/t),u)},e.IMLOG10=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n))/Math.log(10),Math.atan(n/t)/Math.log(10),u)},e.IMLOG2=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n))/Math.log(2),Math.atan(n/t)/Math.log(2),u)},e.IMPOWER=function(r,t){t=o.parseNumber(t);var n=e.IMREAL(r),u=e.IMAGINARY(r);if(o.anyIsError(t,n,u))return a.value;var i=r.substring(r.length-1);i="i"===i||"j"===i?i:"i";var s=Math.pow(e.IMABS(r),t),l=e.IMARGUMENT(r);return e.COMPLEX(s*Math.cos(t*l),s*Math.sin(t*l),i)},e.IMPRODUCT=function(){var r=arguments[0];if(!arguments.length)return a.value;for(var t=1;arguments.length>t;t++){var n=e.IMREAL(r),u=e.IMAGINARY(r),i=e.IMREAL(arguments[t]),s=e.IMAGINARY(arguments[t]);if(o.anyIsError(n,u,i,s))return a.value;r=e.COMPLEX(n*i-u*s,n*s+u*i)}return r},e.IMREAL=function(r){if(r===undefined||!0===r||!1===r)return a.value;if(0===r||"0"===r)return 0;if(["i","+i","1i","+1i","-i","-1i","j","+j","1j","+1j","-j","-1j"].indexOf(r)>=0)return 0;var e=r.indexOf("+"),t=r.indexOf("-");0===e&&(e=r.indexOf("+",1)),0===t&&(t=r.indexOf("-",1));var n=r.substring(r.length-1,r.length),u="i"===n||"j"===n;return 0>e&&0>t?u?isNaN(r.substring(0,r.length-1))?a.num:0:isNaN(r)?a.num:r:u?0>e?isNaN(r.substring(0,t))||isNaN(r.substring(t+1,r.length-1))?a.num:+r.substring(0,t):isNaN(r.substring(0,e))||isNaN(r.substring(e+1,r.length-1))?a.num:+r.substring(0,e):a.num},e.IMSEC=function(r){if(!0===r||!1===r)return a.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:e.IMDIV("1",e.IMCOS(r))},e.IMSECH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:e.IMDIV("1",e.IMCOSH(r))},e.IMSIN=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.sin(t)*(Math.exp(n)+Math.exp(-n))/2,Math.cos(t)*(Math.exp(n)-Math.exp(-n))/2,u)},e.IMSINH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.cos(n)*(Math.exp(t)-Math.exp(-t))/2,Math.sin(n)*(Math.exp(t)+Math.exp(-t))/2,u)},e.IMSQRT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);u="i"===u||"j"===u?u:"i";var i=Math.sqrt(e.IMABS(r)),s=e.IMARGUMENT(r);return e.COMPLEX(i*Math.cos(s/2),i*Math.sin(s/2),u)},e.IMCSC=function(r){if(!0===r||!1===r)return a.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.num:e.IMDIV("1",e.IMSIN(r))},e.IMCSCH=function(r){if(!0===r||!1===r)return a.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.num:e.IMDIV("1",e.IMSINH(r))},e.IMSUB=function(r,e){var t=this.IMREAL(r),n=this.IMAGINARY(r),u=this.IMREAL(e),i=this.IMAGINARY(e);if(o.anyIsError(t,n,u,i))return a.value;var s=r.substring(r.length-1),l=e.substring(e.length-1),f="i";return"j"===s?f="j":"j"===l&&(f="j"),this.COMPLEX(t-u,n-i,f)},e.IMSUM=function(){if(!arguments.length)return a.value;for(var r=o.flatten(arguments),e=r[0],t=1;r.length>t;t++){var n=this.IMREAL(e),u=this.IMAGINARY(e),i=this.IMREAL(r[t]),s=this.IMAGINARY(r[t]);if(o.anyIsError(n,u,i,s))return a.value;e=this.COMPLEX(n+i,u+s)}return e},e.IMTAN=function(r){if(!0===r||!1===r)return a.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:this.IMDIV(this.IMSIN(r),this.IMCOS(r))},e.OCT2BIN=function(r,e){if(!/^[0-7]{1,10}$/.test(r))return a.num;var t=10===r.length&&"7"===r.substring(0,1),n=t?parseInt(r,8)-1073741824:parseInt(r,8);if(-512>n||n>511)return a.num;if(t)return"1"+i.REPT("0",9-(512+n).toString(2).length)+(512+n).toString(2);var u=n.toString(2);return void 0===e?u:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),u.length>e?a.num:i.REPT("0",e-u.length)+u)},e.OCT2DEC=function(r){if(!/^[0-7]{1,10}$/.test(r))return a.num;var e=parseInt(r,8);return 536870912>e?e:e-1073741824},e.OCT2HEX=function(r,e){if(!/^[0-7]{1,10}$/.test(r))return a.num;var t=parseInt(r,8);if(t>=536870912)return"ff"+(t+3221225472).toString(16);var n=t.toString(16);return e===undefined?n:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),n.length>e?a.num:i.REPT("0",e-n.length)+n)}},function(r,e,t){"use strict";e.__esModule=!0,e["default"]=["ABS","ACCRINT","ACOS","ACOSH","ACOT","ACOTH","ADD","AGGREGATE","AND","ARABIC","ARGS2ARRAY","ASIN","ASINH","ATAN","ATAN2","ATANH","AVEDEV","AVERAGE","AVERAGEA","AVERAGEIF","AVERAGEIFS","BASE","BESSELI","BESSELJ","BESSELK","BESSELY","BETA.DIST","BETA.INV","BETADIST","BETAINV","BIN2DEC","BIN2HEX","BIN2OCT","BINOM.DIST","BINOM.DIST.RANGE","BINOM.INV","BINOMDIST","BITAND","BITLSHIFT","BITOR","BITRSHIFT","BITXOR","CEILING","CEILINGMATH","CEILINGPRECISE","CHAR","CHISQ.DIST","CHISQ.DIST.RT","CHISQ.INV","CHISQ.INV.RT","CHOOSE","CHOOSE","CLEAN","CODE","COLUMN","COLUMNS","COMBIN","COMBINA","COMPLEX","CONCATENATE","CONFIDENCE","CONFIDENCE.NORM","CONFIDENCE.T","CONVERT","CORREL","COS","COSH","COT","COTH","COUNT","COUNTA","COUNTBLANK","COUNTIF","COUNTIFS","COUNTIN","COUNTUNIQUE","COVARIANCE.P","COVARIANCE.S","CSC","CSCH","CUMIPMT","CUMPRINC","DATE","DATEVALUE","DAY","DAYS","DAYS360","DB","DDB","DEC2BIN","DEC2HEX","DEC2OCT","DECIMAL","DEGREES","DELTA","DEVSQ","DIVIDE","DOLLAR","DOLLARDE","DOLLARFR","E","EDATE","EFFECT","EOMONTH","EQ","ERF","ERFC","EVEN","EXACT","EXP","EXPON.DIST","EXPONDIST","F.DIST","F.DIST.RT","F.INV","F.INV.RT","FACT","FACTDOUBLE","FALSE","FDIST","FDISTRT","FIND","FINV","FINVRT","FISHER","FISHERINV","FIXED","FLATTEN","FLOOR","FORECAST","FREQUENCY","FV","FVSCHEDULE","GAMMA","GAMMA.DIST","GAMMA.INV","GAMMADIST","GAMMAINV","GAMMALN","GAMMALN.PRECISE","GAUSS","GCD","GEOMEAN","GESTEP","GROWTH","GTE","HARMEAN","HEX2BIN","HEX2DEC","HEX2OCT","HOUR","HTML2TEXT","HYPGEOM.DIST","HYPGEOMDIST","IF","IMABS","IMAGINARY","IMARGUMENT","IMCONJUGATE","IMCOS","IMCOSH","IMCOT","IMCSC","IMCSCH","IMDIV","IMEXP","IMLN","IMLOG10","IMLOG2","IMPOWER","IMPRODUCT","IMREAL","IMSEC","IMSECH","IMSIN","IMSINH","IMSQRT","IMSUB","IMSUM","IMTAN","INT","INTERCEPT","INTERVAL","IPMT","IRR","ISBINARY","ISBLANK","ISEVEN","ISLOGICAL","ISNONTEXT","ISNUMBER","ISODD","ISODD","ISOWEEKNUM","ISPMT","ISTEXT","JOIN","KURT","LARGE","LCM","LEFT","LEN","LINEST","LN","LOG","LOG10","LOGEST","LOGNORM.DIST","LOGNORM.INV","LOGNORMDIST","LOGNORMINV","LOWER","LT","LTE","MATCH","MAX","MAXA","MEDIAN","MID","MIN","MINA","MINUS","MINUTE","MIRR","MOD","MODE.MULT","MODE.SNGL","MODEMULT","MODESNGL","MONTH","MROUND","MULTINOMIAL","MULTIPLY","NE","NEGBINOM.DIST","NEGBINOMDIST","NETWORKDAYS","NOMINAL","NORM.DIST","NORM.INV","NORM.S.DIST","NORM.S.INV","NORMDIST","NORMINV","NORMSDIST","NORMSINV","NOT","NOW","NPER","NPV","NUMBERS","NUMERAL","OCT2BIN","OCT2DEC","OCT2HEX","ODD","OR","PDURATION","PEARSON","PERCENTILEEXC","PERCENTILEINC","PERCENTRANKEXC","PERCENTRANKINC","PERMUT","PERMUTATIONA","PHI","PI","PMT","POISSON.DIST","POISSONDIST","POW","POWER","PPMT","PROB","PRODUCT","PROPER","PV","QUARTILE.EXC","QUARTILE.INC","QUARTILEEXC","QUARTILEINC","QUOTIENT","RADIANS","RAND","RANDBETWEEN","RANK.AVG","RANK.EQ","RANKAVG","RANKEQ","RATE","REFERENCE","REGEXEXTRACT","REGEXMATCH","REGEXREPLACE","REPLACE","REPT","RIGHT","ROMAN","ROUND","ROUNDDOWN","ROUNDUP","ROW","ROWS","RRI","RSQ","SEARCH","SEC","SECH","SECOND","SERIESSUM","SIGN","SIN","SINH","SKEW","SKEW.P","SKEWP","SLN","SLOPE","SMALL","SPLIT","SPLIT","SQRT","SQRTPI","STANDARDIZE","STDEV.P","STDEV.S","STDEVA","STDEVP","STDEVPA","STDEVS","STEYX","SUBSTITUTE","SUBTOTAL","SUM","SUMIF","SUMIFS","SUMPRODUCT","SUMSQ","SUMX2MY2","SUMX2PY2","SUMXMY2","SWITCH","SYD","T","T.DIST","T.DIST.2T","T.DIST.RT","T.INV","T.INV.2T","TAN","TANH","TBILLEQ","TBILLPRICE","TBILLYIELD","TDIST","TDIST2T","TDISTRT","TEXT","TIME","TIMEVALUE","TINV","TINV2T","TODAY","TRANSPOSE","TREND","TRIM","TRIMMEAN","TRUE","TRUNC","UNICHAR","UNICODE","UNIQUE","UPPER","VALUE","VAR.P","VAR.S","VARA","VARP","VARPA","VARS","WEEKDAY","WEEKNUM","WEIBULL.DIST","WEIBULLDIST","WORKDAY","XIRR","XNPV","XOR","YEAR","YEARFRAC"]},function(r,e,t){"use strict";function n(r){var e=parseInt(r,10);return e=isNaN(e)?-1:Math.max(e-1,-1)}function a(r){var e="";return 0>r||(e=""+(r+1)),e}function u(r){var e=0;if("string"==typeof r){r=r.toUpperCase();for(var t=0,n=r.length-1;r.length>t;t+=1,n-=1)e+=Math.pow(f,n)*(l.indexOf(r[t])+1)}return--e}function i(r){for(var e="";r>=0;)e=String.fromCharCode(r%f+97)+e,r=Math.floor(r/f)-1;return e.toUpperCase()}function o(r){if("string"!=typeof r||!c.test(r))return[];var e=r.toUpperCase().match(c),t=e[1],a=e[2],i=e[3],o=e[4];return[{index:n(o),label:o,isAbsolute:"$"===i},{index:u(a),label:a,isAbsolute:"$"===t}]}function s(r,e){var t=(r.isAbsolute?"$":"")+a(r.index);return(e.isAbsolute?"$":"")+i(e.index)+t}e.__esModule=!0,e.rowLabelToIndex=n,e.rowIndexToLabel=a,e.columnLabelToIndex=u,e.columnIndexToLabel=i,e.extractLabel=o,e.toLabel=s;var l="ABCDEFGHIJKLMNOPQRSTUVWXYZ",f=l.length,c=/^([$])?([A-Za-z]+)([$])?([0-9]+)$/},function(r,e,t){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}e.__esModule=!0,e.rowLabelToIndex=e.rowIndexToLabel=e.columnLabelToIndex=e.columnIndexToLabel=e.toLabel=e.extractLabel=e.error=e.Parser=e.ERROR_VALUE=e.ERROR_REF=e.ERROR_NUM=e.ERROR_NULL=e.ERROR_NOT_AVAILABLE=e.ERROR_NAME=e.ERROR_DIV_ZERO=e.ERROR=e.SUPPORTED_FORMULAS=undefined;var a=t(17),u=n(a),i=t(14),o=n(i),s=t(2),l=n(s),f=t(15);e.SUPPORTED_FORMULAS=o["default"],e.ERROR=s.ERROR,e.ERROR_DIV_ZERO=s.ERROR_DIV_ZERO,e.ERROR_NAME=s.ERROR_NAME,e.ERROR_NOT_AVAILABLE=s.ERROR_NOT_AVAILABLE,e.ERROR_NULL=s.ERROR_NULL,e.ERROR_NUM=s.ERROR_NUM,e.ERROR_REF=s.ERROR_REF,e.ERROR_VALUE=s.ERROR_VALUE,e.Parser=u["default"],e.error=l["default"],e.extractLabel=f.extractLabel,e.toLabel=f.toLabel,e.columnIndexToLabel=f.columnIndexToLabel,e.columnLabelToIndex=f.columnLabelToIndex,e.rowIndexToLabel=f.rowIndexToLabel,e.rowLabelToIndex=f.rowLabelToIndex},function(r,e,t){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}function a(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function u(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?r:e}function i(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}e.__esModule=!0;var o=t(18),s=n(o),l=t(19),f=n(l),c=t(41),p=t(43),h=t(3),m=t(2),E=n(m),g=t(15);e["default"]=function(r){function e(){a(this,e);var t=u(this,r.call(this));return t.parser=new c.Parser,t.parser.yy={toNumber:h.toNumber,trimEdges:p.trimEdges,invertNumber:h.invertNumber,throwError:function(r){return t._throwError(r)},callVariable:function(r){return t._callVariable(r)},evaluateByOperator:f["default"],callFunction:function(r,e){return t._callFunction(r,e)},cellValue:function(r){return t._callCellValue(r)},rangeValue:function(r,e){return t._callRangeValue(r,e)}},t.variables=Object.create(null),t.functions=Object.create(null),t.setVariable("TRUE",!0).setVariable("FALSE",!1).setVariable("NULL",null),t}return i(e,r),e.prototype.parse=function(r){var e=null,t=null;try{e=""===r?"":this.parser.parse(r)}catch(a){var n=(0,E["default"])(a.message);t=n||(0,E["default"])(m.ERROR)}return e instanceof Error&&(t=(0,E["default"])(e.message)||(0,E["default"])(m.ERROR),e=null),{error:t,result:e}},e.prototype.setVariable=function(r,e){return this.variables[r]=e,this},e.prototype.getVariable=function(r){return this.variables[r]},e.prototype._callVariable=function(r){var e=this.getVariable(r);if(this.emit("callVariable",r,function(r){void 0!==r&&(e=r)}),void 0===e)throw Error(m.ERROR_NAME);return e},e.prototype.setFunction=function(r,e){return this.functions[r]=e,this},e.prototype.getFunction=function(r){return this.functions[r]},e.prototype._callFunction=function(r){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[],t=this.getFunction(r),n=void 0;return t&&(n=t(e)),this.emit("callFunction",r,e,function(r){void 0!==r&&(n=r)}),void 0===n?(0,f["default"])(r,e):n},e.prototype._callCellValue=function(r){r=r.toUpperCase();var e=(0,g.extractLabel)(r),t=e[0],n=e[1],a=void 0;return this.emit("callCellValue",{label:r,row:t,column:n},function(r){a=r}),a},e.prototype._callRangeValue=function(r,e){r=r.toUpperCase(),e=e.toUpperCase();var t=(0,g.extractLabel)(r),n=t[0],a=t[1],u=(0,g.extractLabel)(e),i=u[0],o=u[1],s={},l={};n.index>i.index?(s.row=i,l.row=n):(s.row=n,l.row=i),a.index>o.index?(s.column=o,l.column=a):(s.column=a,l.column=o),s.label=(0,g.toLabel)(s.row,s.column),l.label=(0,g.toLabel)(l.row,l.column);var f=[];return this.emit("callRangeValue",s,l,function(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];f=r}),f},e.prototype._throwError=function(r){if((0,m.isValidStrict)(r))throw Error(r);throw Error(m.ERROR)},e}(s["default"])},function(r,e){function t(){}t.prototype={on:function(r,e,t){var n=this.e||(this.e={});return(n[r]||(n[r]=[])).push({fn:e,ctx:t}),this},once:function(r,e,t){function n(){a.off(r,n),e.apply(t,arguments)}var a=this;return n._=e,this.on(r,n,t)},emit:function(r){var e=[].slice.call(arguments,1),t=((this.e||(this.e={}))[r]||[]).slice(),n=0,a=t.length;for(n;a>n;n++)t[n].fn.apply(t[n].ctx,e);return this},off:function(r,e){var t=this.e||(this.e={}),n=t[r],a=[];if(n&&e)for(var u=0,i=n.length;i>u;u++)n[u].fn!==e&&n[u].fn._!==e&&a.push(n[u]);return a.length?t[r]=a:delete t[r],this}},r.exports=t},function(r,e,t){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}function a(r){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];if(r=r.toUpperCase(),!L[r])throw Error(C.ERROR_NAME);return L[r].apply(L,e)}function u(r,e){Array.isArray(r)||(r=[r.toUpperCase()]),r.forEach(function(r){L[r]=e.isFactory?e(r):e})}e.__esModule=!0,e["default"]=a,e.registerOperation=u;var i=t(20),o=n(i),s=t(21),l=n(s),f=t(22),c=n(f),p=t(23),h=n(p),m=t(24),E=n(m),g=t(33),d=n(g),v=t(34),N=n(v),I=t(35),b=n(I),y=t(36),M=n(y),A=t(37),R=n(A),S=t(38),T=n(S),O=t(39),x=n(O),V=t(40),$=n(V),C=t(2),L=Object.create(null);u(o["default"].SYMBOL,o["default"]),u(l["default"].SYMBOL,l["default"]),u(c["default"].SYMBOL,c["default"]),u(h["default"].SYMBOL,h["default"]),u($["default"].SYMBOL,$["default"]),u(E["default"].SYMBOL,E["default"]),u(d["default"].SYMBOL,d["default"]),u(N["default"].SYMBOL,N["default"]),u(b["default"].SYMBOL,b["default"]),u(M["default"].SYMBOL,M["default"]),u(T["default"].SYMBOL,T["default"]),u(x["default"].SYMBOL,x["default"]),u(R["default"].SYMBOL,R["default"])},function(r,e,t){"use strict";function n(r){for(var e=arguments.length,t=Array(e>1?e-1:0),n=1;e>n;n++)t[n-1]=arguments[n];var i=t.reduce(function(r,e){return r+(0,a.toNumber)(e)},(0,a.toNumber)(r));if(isNaN(i))throw Error(u.ERROR_VALUE);return i}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=t(2);n.SYMBOL=e.SYMBOL="+"},function(r,e,t){"use strict";function n(){for(var r=arguments.length,e=Array(r),t=0;r>t;t++)e[t]=arguments[t];return e.reduce(function(r,e){return r+""+e},"")}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="&"},function(r,e,t){"use strict";function n(r){for(var e=arguments.length,t=Array(e>1?e-1:0),n=1;e>n;n++)t[n-1]=arguments[n];var i=t.reduce(function(r,e){return r/(0,a.toNumber)(e)},(0,a.toNumber)(r));if(i===Infinity)throw Error(u.ERROR_DIV_ZERO);if(isNaN(i))throw Error(u.ERROR_VALUE);return i}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=t(2);n.SYMBOL=e.SYMBOL="/"},function(r,e,t){"use strict";function n(r,e){return r===e}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="="},function(r,e,t){"use strict";function n(r){return function(){r=r.toUpperCase();var e=r.split("."),t=!1,n=void 0;if(1===e.length)u[e[0]]&&(t=!0,n=u[e[0]].apply(u,arguments));else{for(var a=e.length,i=0,o=u;a>i;)if(o=o[e[i]],i++,!o){o=null;break}o&&(t=!0,n=o.apply(undefined,arguments))}if(!t)throw Error(s.ERROR_NAME);return n}}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(25),u=function(r){if(r&&r.__esModule)return r;var e={};if(null!=r)for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e["default"]=r,e}(a),i=t(14),o=function(r){return r&&r.__esModule?r:{"default":r}}(i),s=t(2),l=e.SYMBOL=o["default"];n.isFactory=!0,n.SYMBOL=l},function(r,e,t){var n=[t(26),t(29),t(13),t(30),t(4),t(6),t(8),t(31),t(7),t(32),t(5),t(12)];for(var a in n){var u=n[a];for(var i in u)e[i]=e[i]||u[i]}},function(r,e,t){function n(r,e){if(e)for(var t in e)r[t]=e[t];return r}var a=t(4),u=t(5),i=t(13),o=t(8);e.BETADIST=u.BETA.DIST,e.BETAINV=u.BETA.INV,e.BINOMDIST=u.BINOM.DIST,e.CEILING=e.ISOCEILING=n(a.CEILING.MATH,a.CEILING),e.CEILINGMATH=a.CEILING.MATH,e.CEILINGPRECISE=a.CEILING.PRECISE,e.CHIDIST=u.CHISQ.DIST,e.CHIDISTRT=u.CHISQ.DIST.RT,e.CHIINV=u.CHISQ.INV,e.CHIINVRT=u.CHISQ.INV.RT,e.CHITEST=u.CHISQ.TEST,e.CONFIDENCE=n(u.CONFIDENCE.NORM,u.CONFIDENCE),e.COVAR=u.COVARIANCE.P,e.COVARIANCEP=u.COVARIANCE.P,e.COVARIANCES=u.COVARIANCE.S,e.CRITBINOM=u.BINOM.INV,e.EXPONDIST=u.EXPON.DIST,e.ERFCPRECISE=i.ERFC.PRECISE,e.ERFPRECISE=i.ERF.PRECISE,e.FDIST=u.F.DIST,e.FDISTRT=u.F.DIST.RT,e.FINVRT=u.F.INV.RT,e.FINV=u.F.INV,e.FLOOR=n(a.FLOOR.MATH,a.FLOOR),e.FLOORMATH=a.FLOOR.MATH,e.FLOORPRECISE=a.FLOOR.PRECISE,e.FTEST=u.F.TEST,e.GAMMADIST=u.GAMMA.DIST,e.GAMMAINV=u.GAMMA.INV,e.GAMMALNPRECISE=u.GAMMALN.PRECISE,e.HYPGEOMDIST=u.HYPGEOM.DIST,e.LOGINV=u.LOGNORM.INV,e.LOGNORMINV=u.LOGNORM.INV,e.LOGNORMDIST=u.LOGNORM.DIST,e.MODE=n(u.MODE.SNGL,u.MODE),e.MODEMULT=u.MODE.MULT,e.MODESNGL=u.MODE.SNGL,e.NEGBINOMDIST=u.NEGBINOM.DIST,e.NETWORKDAYSINTL=o.NETWORKDAYS.INTL,e.NORMDIST=u.NORM.DIST,e.NORMINV=u.NORM.INV,e.NORMSDIST=u.NORM.S.DIST,e.NORMSINV=u.NORM.S.INV,e.PERCENTILE=n(u.PERCENTILE.EXC,u.PERCENTILE),e.PERCENTILEEXC=u.PERCENTILE.EXC,e.PERCENTILEINC=u.PERCENTILE.INC,e.PERCENTRANK=n(u.PERCENTRANK.INC,u.PERCENTRANK),e.PERCENTRANKEXC=u.PERCENTRANK.EXC,e.PERCENTRANKINC=u.PERCENTRANK.INC,e.POISSON=n(u.POISSON.DIST,u.POISSON),e.POISSONDIST=u.POISSON.DIST,e.QUARTILE=n(u.QUARTILE.INC,u.QUARTILE),e.QUARTILEEXC=u.QUARTILE.EXC,e.QUARTILEINC=u.QUARTILE.INC,e.RANK=n(u.RANK.EQ,u.RANK),e.RANKAVG=u.RANK.AVG,e.RANKEQ=u.RANK.EQ,e.SKEWP=u.SKEW.P,e.STDEV=n(u.STDEV.S,u.STDEV),e.STDEVP=u.STDEV.P,e.STDEVS=u.STDEV.S,e.TDIST=u.T.DIST,e.TDISTRT=u.T.DIST.RT,e.TINV=u.T.INV,e.TTEST=u.T.TEST,e.VAR=n(u.VAR.S,u.VAR),e.VARP=u.VAR.P,e.VARS=u.VAR.S,e.WEIBULL=n(u.WEIBULL.DIST,u.WEIBULL),e.WEIBULLDIST=u.WEIBULL.DIST,e.WORKDAYINTL=o.WORKDAY.INTL,e.ZTEST=u.Z.TEST},function(r,e){},function(r,e,t){function n(r,e){return r.reduce(function(r,t){return e*r+t},0)}function a(r,e,t,n,a){a||(a=-1);var u,i=2/r;if(0===e)return t;if(1===e)return n;for(var o=1;o!=e;++o)u=n*o*i+a*t,t=n,n=u;return n}function u(r,e,t,n,u){return function(i,o){if(0===o)return r(i);if(1===o)return e(i);if(0>o)throw t+": Order ("+o+") must be nonnegative";if(1==n&&0===i)throw t+": Undefined when x == 0";if(2==n&&0>=i)throw t+": Undefined when x <= 0";return a(i,o,r(i),e(i),u)}}var i=Math,o=function(){function r(r){var e,a,f,c=r*r,p=i.abs(r)-.785398164;return 8>i.abs(r)?(a=n(t,c),f=n(u,c),e=a/f):(c=64/c,a=n(o,c),f=n(s,c),e=i.sqrt(l/i.abs(r))*(i.cos(p)*a-i.sin(p)*f*8/i.abs(r))),e}function e(r){var e,t,a,u=r*r,o=i.abs(r)-2.356194491;return 8>Math.abs(r)?(t=r*n(f,u),a=n(c,u),e=t/a):(u=64/u,t=n(p,u),a=n(h,u),e=i.sqrt(l/i.abs(r))*(i.cos(o)*t-i.sin(o)*a*8/i.abs(r)),0>r&&(e=-e)),e}var t=[57568490574,-13362590354,651619640.7,-11214424.18,77392.33017,-184.9052456].reverse(),u=[57568490411,1029532985,9494680.718,59272.64853,267.8532712,1].reverse(),o=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),s=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34935152e-8].reverse(),l=.636619772,f=[72362614232,-7895059235,242396853.1,-2972611.439,15704.4826,-30.16036606].reverse(),c=[144725228442,2300535178,18583304.74,99447.43394,376.9991397,1].reverse(),p=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),h=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return function(t,n){if(0===(n=Math.round(n)))return r(i.abs(t));if(1===n)return e(i.abs(t));if(0>n)throw"BESSELJ: Order ("+n+") must be nonnegative";if(0===i.abs(t))return 0;var u,o,s,l,f,c,p,h,m=2/i.abs(t);if(i.abs(t)>n)u=a(t,n,r(i.abs(t)),e(i.abs(t)),-1);else{for(s=2*i.floor((n+i.floor(i.sqrt(40*n)))/2),l=0,c=u=f=0,p=1,o=s;o>0;o--)h=o*m*p-c,c=p,p=h,i.abs(p)>1e10&&(p*=1e-10,c*=1e-10,u*=1e-10,f*=1e-10),l&&(f+=p),l=!l,o==n&&(u=c);f=2*f-p,u/=f}return 0>t&&n%2?-u:u}}(),s=function(){function r(r){var e,u,c,p=r*r,h=r-.785398164;return 8>r?(u=n(t,p),c=n(a,p),e=u/c+f*o(r,0)*i.log(r)):(p=64/p,u=n(s,p),c=n(l,p),e=i.sqrt(f/r)*(i.sin(h)*u+i.cos(h)*c*8/r)),e}function e(r){var e,t,a,u=r*r,s=r-2.356194491;return 8>r?(t=r*n(c,u),a=n(p,u),e=t/a+f*(o(r,1)*i.log(r)-1/r)):(u=64/u,t=n(h,u),a=n(m,u),e=i.sqrt(f/r)*(i.sin(s)*t+i.cos(s)*a*8/r)),e}var t=[-2957821389,7062834065,-512359803.6,10879881.29,-86327.92757,228.4622733].reverse(),a=[40076544269,745249964.8,7189466.438,47447.2647,226.1030244,1].reverse(),s=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),l=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34945152e-8].reverse(),f=.636619772,c=[-4900604943e3,127527439e4,-51534381390,734926455.1,-4237922.726,8511.937935].reverse(),p=[249958057e5,424441966400,3733650367,22459040.02,102042.605,354.9632885,1].reverse(),h=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),m=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return u(r,e,"BESSELY",1,-1)}(),l=function(){function r(r){return r>3.75?i.exp(i.abs(r))/i.sqrt(i.abs(r))*n(a,3.75/i.abs(r)):n(t,r*r/14.0625)}function e(r){return 3.75>r?r*n(u,r*r/14.0625):(0>r?-1:1)*i.exp(i.abs(r))/i.sqrt(i.abs(r))*n(o,3.75/i.abs(r))}var t=[1,3.5156229,3.0899424,1.2067492,.2659732,.0360768,.0045813].reverse(),a=[.39894228,.01328592,.00225319,-.00157565,.00916281,-.02057706,.02635537,-.01647633,.00392377].reverse(),u=[.5,.87890594,.51498869,.15084934,.02658733,.00301532,32411e-8].reverse(),o=[.39894228,-.03988024,-.00362018,.00163801,-.01031555,.02282967,-.02895312,.01787654,-.00420059].reverse();return function s(t,n){if(0===(n=Math.round(n)))return r(t);if(1==n)return e(t);if(0>n)throw"BESSELI Order ("+n+") must be nonnegative";if(0===i.abs(t))return 0;var a,u,o,l,f,c,p=2/i.abs(t);for(o=2*i.round((n+i.round(i.sqrt(40*n)))/2),l=a=0,f=1,u=o;u>0;u--)c=u*p*f+l,l=f,f=c,i.abs(f)>1e10&&(f*=1e-10,l*=1e-10,a*=1e-10),u==n&&(a=l);return a*=s(t,0)/f,0>t&&n%2?-a:a}}(),f=function(){function r(r){return r>2?i.exp(-r)/i.sqrt(r)*n(a,2/r):-i.log(r/2)*l(r,0)+n(t,r*r/4)}function e(r){return r>2?i.exp(-r)/i.sqrt(r)*n(s,2/r):i.log(r/2)*l(r,1)+1/r*n(o,r*r/4)}var t=[-.57721566,.4227842,.23069756,.0348859,.00262698,1075e-7,74e-7].reverse(),a=[1.25331414,-.07832358,.02189568,-.01062446,.00587872,-.0025154,53208e-8].reverse(),o=[1,.15443144,-.67278579,-.18156897,-.01919402,-.00110404,-4686e-8].reverse(),s=[1.25331414,.23498619,-.0365562,.01504268,-.00780353,.00325614,-68245e-8].reverse();return u(r,e,"BESSELK",2,1)}();e.besselj=o,e.bessely=s,e.besseli=l,e.besselk=f},function(module,exports,__webpack_require__){function compact(r){var e=[];return utils.arrayEach(r,function(r){r&&e.push(r)}),e}function findResultIndex(database,criterias){for(var matches={},i=1;database[0].length>i;++i)matches[i]=!0;var maxCriteriaLength=criterias[0].length;for(i=1;criterias.length>i;++i)criterias[i].length>maxCriteriaLength&&(maxCriteriaLength=criterias[i].length);for(var k=1;database.length>k;++k)for(var l=1;database[k].length>l;++l){for(var currentCriteriaResult=!1,hasMatchingCriteria=!1,j=0;criterias.length>j;++j){var criteria=criterias[j];if(criteria.length>=maxCriteriaLength){var criteriaField=criteria[0];if(database[k][0]===criteriaField){hasMatchingCriteria=!0;for(var p=1;criteria.length>p;++p)currentCriteriaResult=currentCriteriaResult||eval(database[k][l]+criteria[p])}}}hasMatchingCriteria&&(matches[l]=matches[l]&¤tCriteriaResult)}for(var result=[],n=0;database[0].length>n;++n)matches[n]&&result.push(n-1);return result}var error=__webpack_require__(0),stats=__webpack_require__(5),maths=__webpack_require__(4),utils=__webpack_require__(1);exports.FINDFIELD=function(r,e){var t=null;return utils.arrayEach(r,function(r,n){if(r[0]===e)return t=n,!1}),null==t?error.value:t},exports.DAVERAGE=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=0;return utils.arrayEach(n,function(r){i+=a[r]}),0===n.length?error.div0:i/n.length},exports.DCOUNT=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.COUNT(i)},exports.DCOUNTA=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.COUNTA(i)},exports.DGET=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);return 0===n.length?error.value:n.length>1?error.num:a[n[0]]},exports.DMAX=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=a[n[0]];return utils.arrayEach(n,function(r){a[r]>i&&(i=a[r])}),i},exports.DMIN=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=a[n[0]];return utils.arrayEach(n,function(r){i>a[r]&&(i=a[r])}),i},exports.DPRODUCT=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];utils.arrayEach(n,function(r){i.push(a[r])}),i=compact(i);var o=1;return utils.arrayEach(i,function(r){o*=r}),o},exports.DSTDEV=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),i=compact(i),stats.STDEV.S(i)},exports.DSTDEVP=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),i=compact(i),stats.STDEV.P(i)},exports.DSUM=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),maths.SUM(i)},exports.DVAR=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.VAR.S(i)},exports.DVARP=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.VAR.P(i)}},function(r,e,t){var n=t(0),a=t(1),u=t(7);e.AND=function(){for(var r=a.flatten(arguments),e=!0,t=0;r.length>t;t++)r[t]||(e=!1);return e},e.CHOOSE=function(){if(2>arguments.length)return n.na;var r=arguments[0];return 1>r||r>254?n.value:r+1>arguments.length?n.value:arguments[r]},e.FALSE=function(){return!1},e.IF=function(r,e,t){return r?e:t},e.IFERROR=function(r,e){return u.ISERROR(r)?e:r},e.IFNA=function(r,e){return r===n.na?e:r},e.NOT=function(r){return!r},e.OR=function(){for(var r=a.flatten(arguments),e=!1,t=0;r.length>t;t++)r[t]&&(e=!0);return e},e.TRUE=function(){return!0},e.XOR=function(){for(var r=a.flatten(arguments),e=0,t=0;r.length>t;t++)r[t]&&e++;return!!(1&Math.floor(Math.abs(e)))},e.SWITCH=function(){var r;if(arguments.length>0){var e=arguments[0],t=arguments.length-1,a=Math.floor(t/2),u=!1,i=t%2!=0,o=t%2==0?null:arguments[arguments.length-1];if(a)for(var s=0;a>s;s++)if(e===arguments[2*s+1]){r=arguments[2*s+2],u=!0;break}u||(r=i?o:n.na)}else r=n.value;return r}},function(r,e,t){function n(r){return r&&r.getTime&&!isNaN(r.getTime())}function a(r){return r instanceof Date?r:new Date(r)}var u=t(0),i=t(8),o=t(1);e.ACCRINT=function(r,e,t,o,s,l,f){return r=a(r),e=a(e),t=a(t),n(r)&&n(e)&&n(t)?o>0&&s>0?-1===[1,2,4].indexOf(l)?u.num:-1===[0,1,2,3,4].indexOf(f)?u.num:t>r?(s=s||0,f=f||0,s*o*i.YEARFRAC(r,t,f)):u.num:u.num:u.value},e.ACCRINTM=function(){throw Error("ACCRINTM is not implemented")},e.AMORDEGRC=function(){throw Error("AMORDEGRC is not implemented")},e.AMORLINC=function(){throw Error("AMORLINC is not implemented")},e.COUPDAYBS=function(){throw Error("COUPDAYBS is not implemented")},e.COUPDAYS=function(){throw Error("COUPDAYS is not implemented")},e.COUPDAYSNC=function(){throw Error("COUPDAYSNC is not implemented")},e.COUPNCD=function(){throw Error("COUPNCD is not implemented")},e.COUPNUM=function(){throw Error("COUPNUM is not implemented")},e.COUPPCD=function(){throw Error("COUPPCD is not implemented")},e.CUMIPMT=function(r,t,n,a,i,s){if(r=o.parseNumber(r),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,t,n))return u.value;if(0>=r||0>=t||0>=n)return u.num;if(1>a||1>i||a>i)return u.num;if(0!==s&&1!==s)return u.num;var l=e.PMT(r,t,n,0,s),f=0;1===a&&0===s&&(f=-n,a++);for(var c=a;i>=c;c++)f+=1===s?e.FV(r,c-2,l,n,1)-l:e.FV(r,c-1,l,n,0);return f*=r},e.CUMPRINC=function(r,t,n,a,i,s){if(r=o.parseNumber(r),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,t,n))return u.value;if(0>=r||0>=t||0>=n)return u.num;if(1>a||1>i||a>i)return u.num;if(0!==s&&1!==s)return u.num;var l=e.PMT(r,t,n,0,s),f=0;1===a&&(f=0===s?l+n*r:l,a++);for(var c=a;i>=c;c++)f+=s>0?l-(e.FV(r,c-2,l,n,1)-l)*r:l-e.FV(r,c-1,l,n,0)*r;return f},e.DB=function(r,e,t,n,a){if(a=a===undefined?12:a,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;if(0>r||0>e||0>t||0>n)return u.num;if(-1===[1,2,3,4,5,6,7,8,9,10,11,12].indexOf(a))return u.num;if(n>t)return u.num;if(e>=r)return 0;for(var i=(1-Math.pow(e/r,1/t)).toFixed(3),s=r*i*a/12,l=s,f=0,c=n===t?t-1:n,p=2;c>=p;p++)f=(r-l)*i,l+=f;return 1===n?s:n===t?(r-l)*i:f},e.DDB=function(r,e,t,n,a){if(a=a===undefined?2:a,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;if(0>r||0>e||0>t||0>n||0>=a)return u.num;if(n>t)return u.num;if(e>=r)return 0;for(var i=0,s=0,l=1;n>=l;l++)s=Math.min(a/t*(r-i),r-e-i),i+=s;return s},e.DISC=function(){throw Error("DISC is not implemented")},e.DOLLARDE=function(r,e){if(r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e))return u.value;if(0>e)return u.num;if(e>=0&&1>e)return u.div0;e=parseInt(e,10);var t=parseInt(r,10);t+=r%1*Math.pow(10,Math.ceil(Math.log(e)/Math.LN10))/e;var n=Math.pow(10,Math.ceil(Math.log(e)/Math.LN2)+1);return t=Math.round(t*n)/n},e.DOLLARFR=function(r,e){if(r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e))return u.value;if(0>e)return u.num;if(e>=0&&1>e)return u.div0;e=parseInt(e,10);var t=parseInt(r,10);return t+=r%1*Math.pow(10,-Math.ceil(Math.log(e)/Math.LN10))*e},e.DURATION=function(){throw Error("DURATION is not implemented")},e.EFFECT=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:0>=r||1>e?u.num:(e=parseInt(e,10),Math.pow(1+r/e,e)-1)},e.FV=function(r,e,t,n,a){if(n=n||0,a=a||0,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;var i;if(0===r)i=n+t*e;else{var s=Math.pow(1+r,e);i=1===a?n*s+t*(1+r)*(s-1)/r:n*s+t*(s-1)/r}return-i},e.FVSCHEDULE=function(r,e){if(r=o.parseNumber(r),e=o.parseNumberArray(o.flatten(e)),o.anyIsError(r,e))return u.value;for(var t=e.length,n=r,a=0;t>a;a++)n*=1+e[a];return n},e.INTRATE=function(){throw Error("INTRATE is not implemented")},e.IPMT=function(r,t,n,a,i,s){if(i=i||0,s=s||0,r=o.parseNumber(r),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),i=o.parseNumber(i),s=o.parseNumber(s),o.anyIsError(r,t,n,a,i,s))return u.value;var l=e.PMT(r,n,a,i,s);return(1===t?1===s?0:-a:1===s?e.FV(r,t-2,l,a,1)-l:e.FV(r,t-1,l,a,0))*r},e.IRR=function(r,e){if(e=e||0,r=o.parseNumberArray(o.flatten(r)),e=o.parseNumber(e),o.anyIsError(r,e))return u.value;for(var t=[],n=!1,a=!1,i=0;r.length>i;i++)t[i]=0===i?0:t[i-1]+365,r[i]>0&&(n=!0),0>r[i]&&(a=!0);if(!n||!a)return u.num;e=e===undefined?.1:e;var s,l,f,c=e,p=!0;do{f=function(r,e,t){for(var n=t+1,a=r[0],u=1;r.length>u;u++)a+=r[u]/Math.pow(n,(e[u]-e[0])/365);return a}(r,t,c),s=c-f/function(r,e,t){for(var n=t+1,a=0,u=1;r.length>u;u++){var i=(e[u]-e[0])/365;a-=i*r[u]/Math.pow(n,i+1)}return a}(r,t,c),l=Math.abs(s-c),c=s,p=l>1e-10&&Math.abs(f)>1e-10}while(p);return c},e.ISPMT=function(r,e,t,n){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,e,t,n)?u.value:n*r*(e/t-1)},e.MDURATION=function(){throw Error("MDURATION is not implemented")},e.MIRR=function(r,t,n){if(r=o.parseNumberArray(o.flatten(r)),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,t,n))return u.value;for(var a=r.length,i=[],s=[],l=0;a>l;l++)0>r[l]?i.push(r[l]):s.push(r[l]);var f=-e.NPV(n,s)*Math.pow(1+n,a-1),c=e.NPV(t,i)*(1+t);return Math.pow(f/c,1/(a-1))-1},e.NOMINAL=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:0>=r||1>e?u.num:(e=parseInt(e,10),(Math.pow(r+1,1/e)-1)*e)},e.NPER=function(r,e,t,n,a){if(a=a===undefined?0:a,n=n===undefined?0:n,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;var i=e*(1+r*a)-n*r,s=t*r+e*(1+r*a);return Math.log(i/s)/Math.log(1+r)},e.NPV=function(){var r=o.parseNumberArray(o.flatten(arguments));if(r instanceof Error)return r;for(var e=r[0],t=0,n=1;r.length>n;n++)t+=r[n]/Math.pow(1+e,n);return t},e.ODDFPRICE=function(){throw Error("ODDFPRICE is not implemented")},e.ODDFYIELD=function(){throw Error("ODDFYIELD is not implemented")},e.ODDLPRICE=function(){throw Error("ODDLPRICE is not implemented")},e.ODDLYIELD=function(){throw Error("ODDLYIELD is not implemented")},e.PDURATION=function(r,e,t){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:r>0?(Math.log(t)-Math.log(e))/Math.log(1+r):u.num},e.PMT=function(r,e,t,n,a){if(n=n||0,a=a||0,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;var i;if(0===r)i=(t+n)/e;else{var s=Math.pow(1+r,e);i=1===a?(n*r/(s-1)+t*r/(1-1/s))/(1+r):n*r/(s-1)+t*r/(1-1/s)}return-i},e.PPMT=function(r,t,n,a,i,s){return i=i||0,s=s||0,r=o.parseNumber(r),n=o.parseNumber(n),a=o.parseNumber(a),i=o.parseNumber(i),s=o.parseNumber(s),o.anyIsError(r,n,a,i,s)?u.value:e.PMT(r,n,a,i,s)-e.IPMT(r,t,n,a,i,s)},e.PRICE=function(){throw Error("PRICE is not implemented")},e.PRICEDISC=function(){throw Error("PRICEDISC is not implemented")},e.PRICEMAT=function(){throw Error("PRICEMAT is not implemented")},e.PV=function(r,e,t,n,a){return n=n||0,a=a||0,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a)?u.value:0===r?-t*e-n:((1-Math.pow(1+r,e))/r*t*(1+r*a)-n)/Math.pow(1+r,e)},e.RATE=function(r,e,t,n,a,i){if(i=i===undefined?.01:i,n=n===undefined?0:n,a=a===undefined?0:a,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),i=o.parseNumber(i),o.anyIsError(r,e,t,n,a,i))return u.value;var s,l,f,c,p=0,h=0,m=0,E=i;for(1e-10>Math.abs(E)?s=t*(1+r*E)+e*(1+E*a)*r+n:(h=Math.exp(r*Math.log(1+E)),s=t*h+e*(1/E+a)*(h-1)+n),l=t+e*r+n,f=t*h+e*(1/E+a)*(h-1)+n,m=c=0,p=E;Math.abs(l-f)>1e-10&&50>m;)E=(f*c-l*p)/(f-l),c=p,p=E,1e-10>Math.abs(E)?s=t*(1+r*E)+e*(1+E*a)*r+n:(h=Math.exp(r*Math.log(1+E)),s=t*h+e*(1/E+a)*(h-1)+n),l=f,f=s,++m;return E},e.RECEIVED=function(){throw Error("RECEIVED is not implemented")},e.RRI=function(r,e,t){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:0===r||0===e?u.num:Math.pow(t/e,1/r)-1},e.SLN=function(r,e,t){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:0===t?u.num:(r-e)/t},e.SYD=function(r,e,t,n){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,e,t,n)?u.value:0===t?u.num:1>n||n>t?u.num:(n=parseInt(n,10),(r-e)*(t-n+1)*2/(t*(t+1)))},e.TBILLEQ=function(r,e,t){return r=o.parseDate(r),e=o.parseDate(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:t>0?r>e?u.num:e-r>31536e6?u.num:365*t/(360-t*i.DAYS360(r,e,!1)):u.num},e.TBILLPRICE=function(r,e,t){return r=o.parseDate(r),e=o.parseDate(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:t>0?r>e?u.num:e-r>31536e6?u.num:100*(1-t*i.DAYS360(r,e,!1)/360):u.num},e.TBILLYIELD=function(r,e,t){return r=o.parseDate(r),e=o.parseDate(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:t>0?r>e?u.num:e-r>31536e6?u.num:360*(100-t)/(t*i.DAYS360(r,e,!1)):u.num},e.VDB=function(){throw Error("VDB is not implemented")},e.XNPV=function(r,e,t){if(r=o.parseNumber(r),e=o.parseNumberArray(o.flatten(e)),t=o.parseDateArray(o.flatten(t)),o.anyIsError(r,e,t))return u.value;for(var n=0,a=0;e.length>a;a++)n+=e[a]/Math.pow(1+r,i.DAYS(t[a],t[0])/365);return n},e.YIELD=function(){throw Error("YIELD is not implemented")},e.YIELDDISC=function(){throw Error("YIELDDISC is not implemented")},e.YIELDMAT=function(){throw Error("YIELDMAT is not implemented")}},function(r,e,t){var n=t(0),a=t(1);e.MATCH=function(r,e,t){if(!r&&!e)return n.na;if(2===arguments.length&&(t=1),!(e instanceof Array))return n.na;if(-1!==t&&0!==t&&1!==t)return n.na;for(var a,u,i=0;e.length>i;i++)if(1===t){if(e[i]===r)return i+1;r>e[i]&&(u?e[i]>u&&(a=i+1,u=e[i]):(a=i+1,u=e[i]))}else if(0===t){if("string"==typeof r){if(r=r.replace(/\?/g,"."),e[i].toLowerCase().match(r.toLowerCase()))return i+1}else if(e[i]===r)return i+1}else if(-1===t){if(e[i]===r)return i+1;e[i]>r&&(u?u>e[i]&&(a=i+1,u=e[i]):(a=i+1,u=e[i]))}return a||n.na},e.VLOOKUP=function(r,e,t,a){if(!r||!e||!t)return n.na;a=a||!1;for(var u=0;e.length>u;u++){var i=e[u];if(!a&&i[0]===r||i[0]===r||a&&"string"==typeof i[0]&&-1!==i[0].toLowerCase().indexOf(r.toLowerCase()))return i.length+1>t?i[t-1]:n.ref}return n.na},e.HLOOKUP=function(r,e,t,u){if(!r||!e||!t)return n.na;u=u||!1;for(var i=a.transpose(e),o=0;i.length>o;o++){var s=i[o];if(!u&&s[0]===r||s[0]===r||u&&"string"==typeof s[0]&&-1!==s[0].toLowerCase().indexOf(r.toLowerCase()))return s.length+1>t?s[t-1]:n.ref}return n.na}},function(r,e,t){"use strict";function n(r,e){return r>e}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL=">"},function(r,e,t){"use strict";function n(r,e){return r>=e}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL=">="},function(r,e,t){"use strict";function n(r,e){return e>r}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="<"},function(r,e,t){"use strict";function n(r,e){return e>=r}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="<="},function(r,e,t){"use strict";function n(r){for(var e=arguments.length,t=Array(e>1?e-1:0),n=1;e>n;n++)t[n-1]=arguments[n];var i=t.reduce(function(r,e){return r-(0,a.toNumber)(e)},(0,a.toNumber)(r));if(isNaN(i))throw Error(u.ERROR_VALUE);return i}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=t(2);n.SYMBOL=e.SYMBOL="-"},function(r,e,t){"use strict";function n(r){for(var e=arguments.length,t=Array(e>1?e-1:0),n=1;e>n;n++)t[n-1]=arguments[n];var i=t.reduce(function(r,e){return r*(0,a.toNumber)(e)},(0,a.toNumber)(r));if(isNaN(i))throw Error(u.ERROR_VALUE);return i}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=t(2);n.SYMBOL=e.SYMBOL="*"},function(r,e,t){"use strict";function n(r,e){return r!==e}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="<>"},function(r,e,t){"use strict";function n(r,e){var t=Math.pow((0,a.toNumber)(r),(0,a.toNumber)(e));if(isNaN(t))throw Error(u.ERROR_VALUE);return t}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=t(2);n.SYMBOL=e.SYMBOL="^"},function(module,exports,__webpack_require__){(function(module,process){var grammarParser=function(){function Parser(){this.yy={}}var o=function(r,e,t,n){for(t=t||{},n=r.length;n--;t[r[n]]=e);return t},$V0=[1,5],$V1=[1,8],$V2=[1,6],$V3=[1,7],$V4=[1,9],$V5=[1,14],$V6=[1,15],$V7=[1,16],$V8=[1,12],$V9=[1,13],$Va=[1,17],$Vb=[1,19],$Vc=[1,20],$Vd=[1,21],$Ve=[1,22],$Vf=[1,23],$Vg=[1,24],$Vh=[1,25],$Vi=[1,26],$Vj=[1,27],$Vk=[1,28],$Vl=[5,9,10,11,13,14,15,16,17,18,19,20,29,30],$Vm=[5,9,10,11,13,14,15,16,17,18,19,20,29,30,32],$Vn=[5,9,10,11,13,14,15,16,17,18,19,20,29,30,34],$Vo=[5,10,11,13,14,15,16,17,29,30],$Vp=[5,10,13,14,15,16,29,30],$Vq=[5,10,11,13,14,15,16,17,18,19,29,30],$Vr=[13,29,30],parser={trace:function(){},yy:{},symbols_:{error:2,expressions:3,expression:4,EOF:5,variableSequence:6,number:7,STRING:8,"&":9,"=":10,"+":11,"(":12,")":13,"<":14,">":15,NOT:16,"-":17,"*":18,"/":19,"^":20,FUNCTION:21,expseq:22,cell:23,ABSOLUTE_CELL:24,RELATIVE_CELL:25,MIXED_CELL:26,":":27,ARRAY:28,";":29,",":30,VARIABLE:31,DECIMAL:32,NUMBER:33,"%":34,ERROR:35,$accept:0,$end:1},terminals_:{5:"EOF",8:"STRING",9:"&",10:"=",11:"+",12:"(",13:")",14:"<",15:">",16:"NOT",17:"-",18:"*",19:"/",20:"^",21:"FUNCTION",24:"ABSOLUTE_CELL",25:"RELATIVE_CELL",26:"MIXED_CELL",27:":",28:"ARRAY",29:";",30:",",31:"VARIABLE",32:"DECIMAL",33:"NUMBER",34:"%",35:"ERROR"},productions_:[0,[3,2],[4,1],[4,1],[4,1],[4,3],[4,3],[4,3],[4,3],[4,4],[4,4],[4,4],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,2],[4,2],[4,3],[4,4],[4,1],[4,1],[4,2],[23,1],[23,1],[23,1],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[22,1],[22,1],[22,3],[22,3],[6,1],[6,3],[7,1],[7,3],[7,2],[2,1]],performAction:function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:return $$[$0-1];case 2:this.$=yy.callVariable($$[$0][0]);break;case 3:this.$=yy.toNumber($$[$0]);break;case 4:this.$=yy.trimEdges($$[$0]);break;case 5:this.$=yy.evaluateByOperator("&",[$$[$0-2],$$[$0]]);break;case 6:this.$=yy.evaluateByOperator("=",[$$[$0-2],$$[$0]]);break;case 7:this.$=yy.evaluateByOperator("+",[$$[$0-2],$$[$0]]);break;case 8:this.$=$$[$0-1];break;case 9:this.$=yy.evaluateByOperator("<=",[$$[$0-3],$$[$0]]);break;case 10:this.$=yy.evaluateByOperator(">=",[$$[$0-3],$$[$0]]);break;case 11:this.$=yy.evaluateByOperator("<>",[$$[$0-3],$$[$0]]);break;case 12:this.$=yy.evaluateByOperator("NOT",[$$[$0-2],$$[$0]]);break;case 13:this.$=yy.evaluateByOperator(">",[$$[$0-2],$$[$0]]);break;case 14:this.$=yy.evaluateByOperator("<",[$$[$0-2],$$[$0]]);break;case 15:this.$=yy.evaluateByOperator("-",[$$[$0-2],$$[$0]]);break;case 16:this.$=yy.evaluateByOperator("*",[$$[$0-2],$$[$0]]);break;case 17:this.$=yy.evaluateByOperator("/",[$$[$0-2],$$[$0]]);break;case 18:this.$=yy.evaluateByOperator("^",[$$[$0-2],$$[$0]]);break;case 19:var n1=yy.invertNumber($$[$0]);this.$=n1,isNaN(this.$)&&(this.$=0);break;case 20:var n1=yy.toNumber($$[$0]);this.$=n1,isNaN(this.$)&&(this.$=0);break;case 21:this.$=yy.callFunction($$[$0-2]);break;case 22:this.$=yy.callFunction($$[$0-3],$$[$0-1]);break;case 26:case 27:case 28:this.$=yy.cellValue($$[$0]);break;case 29:case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:this.$=yy.rangeValue($$[$0-2],$$[$0]);break;case 38:case 42:this.$=[$$[$0]];break;case 39:var result=[],arr=eval("["+yytext+"]");arr.forEach(function(r){result.push(r)}),this.$=result;break;case 40:case 41:$$[$0-2].push($$[$0]),this.$=$$[$0-2];break;case 43:this.$=Array.isArray($$[$0-2])?$$[$0-2]:[$$[$0-2]],this.$.push($$[$0]);break;case 44:this.$=$$[$0];break;case 45:this.$=1*($$[$0-2]+"."+$$[$0]);break;case 46:this.$=.01*$$[$0-1];break;case 47:this.$=yy.throwError($$[$0])}},table:[{2:11,3:1,4:2,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{1:[3]},{5:[1,18],9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk},o($Vl,[2,2],{32:[1,29]}),o($Vl,[2,3],{34:[1,30]}),o($Vl,[2,4]),{2:11,4:31,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:32,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:33,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{12:[1,34]},o($Vl,[2,23]),o($Vl,[2,24],{2:35,35:$Va}),o($Vm,[2,42]),o($Vn,[2,44],{32:[1,36]}),o($Vl,[2,26],{27:[1,37]}),o($Vl,[2,27],{27:[1,38]}),o($Vl,[2,28],{27:[1,39]}),o([5,9,10,11,13,14,15,16,17,18,19,20,29,30,35],[2,47]),{1:[2,1]},{2:11,4:40,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:41,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:42,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:45,6:3,7:4,8:$V0,10:[1,43],11:$V1,12:$V2,15:[1,44],17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:47,6:3,7:4,8:$V0,10:[1,46],11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:48,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:49,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:50,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:51,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:52,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{31:[1,53]},o($Vn,[2,46]),{9:$Vb,10:$Vc,11:$Vd,13:[1,54],14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk},o($Vo,[2,19],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),o($Vo,[2,20],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),{2:11,4:57,6:3,7:4,8:$V0,11:$V1,12:$V2,13:[1,55],17:$V3,21:$V4,22:56,23:10,24:$V5,25:$V6,26:$V7,28:[1,58],31:$V8,33:$V9,35:$Va},o($Vl,[2,25]),{33:[1,59]},{24:[1,60],25:[1,61],26:[1,62]},{24:[1,63],25:[1,64],26:[1,65]},{24:[1,66],25:[1,67],26:[1,68]},o($Vl,[2,5]),o([5,10,13,29,30],[2,6],{9:$Vb,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vo,[2,7],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),{2:11,4:69,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:70,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},o($Vp,[2,14],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),{2:11,4:71,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},o($Vp,[2,13],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o([5,10,13,16,29,30],[2,12],{9:$Vb,11:$Vd,14:$Ve,15:$Vf,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vo,[2,15],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),o($Vq,[2,16],{9:$Vb,20:$Vk}),o($Vq,[2,17],{9:$Vb,20:$Vk}),o([5,10,11,13,14,15,16,17,18,19,20,29,30],[2,18],{9:$Vb}),o($Vm,[2,43]),o($Vl,[2,8]),o($Vl,[2,21]),{13:[1,72],29:[1,73],30:[1,74]},o($Vr,[2,38],{9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vr,[2,39]),o($Vn,[2,45]),o($Vl,[2,29]),o($Vl,[2,30]),o($Vl,[2,31]),o($Vl,[2,32]),o($Vl,[2,33]),o($Vl,[2,34]),o($Vl,[2,35]),o($Vl,[2,36]),o($Vl,[2,37]),o($Vp,[2,9],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vp,[2,11],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vp,[2,10],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vl,[2,22]),{2:11,4:75,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:76,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},o($Vr,[2,40],{9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vr,[2,41],{9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk})],defaultActions:{18:[2,1]},parseError:function(r,e){function t(r,e){this.message=r,this.hash=e}if(!e.recoverable)throw t.prototype=Error,new t(r,e);this.trace(r)},parse:function(r){function e(r){for(var e=n.length-1,t=0;;){if(""+c in i[r])return t;if(0===r||2>e)return!1;e-=2,r=n[e],++t}}var t=this,n=[0],a=[null],u=[],i=this.table,o="",s=0,l=0,f=0,c=2,p=u.slice.call(arguments,1),h=Object.create(this.lexer),m={yy:{}};for(var E in this.yy)Object.prototype.hasOwnProperty.call(this.yy,E)&&(m.yy[E]=this.yy[E]);h.setInput(r,m.yy),m.yy.lexer=h,m.yy.parser=this,"undefined"==typeof h.yylloc&&(h.yylloc={});var g=h.yylloc;u.push(g);var d=h.options&&h.options.ranges;this.parseError="function"==typeof m.yy.parseError?m.yy.parseError:Object.getPrototypeOf(this).parseError;for(var v,N,I,b,y,M,A,R,S,T=function(){var r;return r=h.lex()||1,"number"!=typeof r&&(r=t.symbols_[r]||r),r},O={};;){if(I=n[n.length-1],this.defaultActions[I]?b=this.defaultActions[I]:(null!==v&&void 0!==v||(v=T()),b=i[I]&&i[I][v]),void 0===b||!b.length||!b[0]){var x,V="";if(f)1!==N&&(x=e(I));else{x=e(I),S=[];for(M in i[I])this.terminals_[M]&&M>c&&S.push("'"+this.terminals_[M]+"'");V=h.showPosition?"Parse error on line "+(s+1)+":\n"+h.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[v]||v)+"'":"Parse error on line "+(s+1)+": Unexpected "+(1==v?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(V,{text:h.match,token:this.terminals_[v]||v,line:h.yylineno,loc:g,expected:S,recoverable:!1!==x})}if(3==f){if(1===v||1===N)throw Error(V||"Parsing halted while starting to recover from another error.");l=h.yyleng,o=h.yytext,s=h.yylineno,g=h.yylloc,v=T()}if(!1===x)throw Error(V||"Parsing halted. No suitable error recovery rule available.");!function(r){n.length=n.length-2*r,a.length=a.length-r,u.length=u.length-r}(x),N=v==c?null:v,v=c,I=n[n.length-1],b=i[I]&&i[I][c],f=3}if(b[0]instanceof Array&&b.length>1)throw Error("Parse Error: multiple actions possible at state: "+I+", token: "+v);switch(b[0]){case 1:n.push(v),a.push(h.yytext),u.push(h.yylloc),n.push(b[1]),v=null,N?(v=N,N=null):(l=h.yyleng,o=h.yytext,s=h.yylineno,g=h.yylloc,f>0&&f--);break;case 2:if(A=this.productions_[b[1]][1],O.$=a[a.length-A],O._$={first_line:u[u.length-(A||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(A||1)].first_column,last_column:u[u.length-1].last_column},d&&(O._$.range=[u[u.length-(A||1)].range[0],u[u.length-1].range[1]]),void 0!==(y=this.performAction.apply(O,[o,l,s,m.yy,b[1],a,u].concat(p))))return y;A&&(n=n.slice(0,-1*A*2),a=a.slice(0,-1*A),u=u.slice(0,-1*A)),n.push(this.productions_[b[1]][0]),a.push(O.$),u.push(O._$),R=i[n[n.length-2]][n[n.length-1]],n.push(R);break;case 3:return!0}}return!0}},lexer=function(){return{EOF:1,parseError:function(r,e){if(!this.yy.parser)throw Error(r);this.yy.parser.parseError(r,e)},setInput:function(r,e){return this.yy=e||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var r=this._input[0];return this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r,r.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},unput:function(r){var e=r.length,t=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),t.length-1&&(this.yylineno-=t.length-1);var a=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:t?(t.length===n.length?this.yylloc.first_column:0)+n[n.length-t.length].length-t[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[a[0],a[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(r){this.unput(this.match.slice(r))},pastInput:function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var r=this.match;return 20>r.length&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var r=this.pastInput(),e=Array(r.length+1).join("-");return r+this.upcomingInput()+"\n"+e+"^"},test_match:function(r,e){var t,n,a;if(this.options.backtrack_lexer&&(a={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(a.yylloc.range=this.yylloc.range.slice(0))),n=r[0].match(/(?:\r\n?|\n).*/g),n&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(r[0].length),this.matched+=r[0],t=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t)return t;if(this._backtrack){for(var u in a)this[u]=a[u];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var r,e,t,n;this._more||(this.yytext="",this.match="");for(var a=this._currentRules(),u=0;a.length>u;u++)if((t=this._input.match(this.rules[a[u]]))&&(!e||t[0].length>e[0].length)){if(e=t,n=u,this.options.backtrack_lexer){if(!1!==(r=this.test_match(t,a[u])))return r;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(r=this.test_match(e,a[n]))&&r:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var r=this.next();return r||this.lex()},begin:function(r){this.conditionStack.push(r)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(r){return r=this.conditionStack.length-1-Math.abs(r||0),0>r?"INITIAL":this.conditionStack[r]},pushState:function(r){this.begin(r)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(r,e,t,n){switch(t){case 0:break;case 1:case 2:return 8;case 3:return 21;case 4:return 35;case 5:return 24;case 6:case 7:return 26;case 8:return 25;case 9:return 21;case 10:case 11:return 31;case 12:return 33;case 13:return 28;case 14:return 9;case 15:return" ";case 16:return 32;case 17:return 27;case 18:return 29;case 19:return 30;case 20:return 18;case 21:return 19;case 22:return 17;case 23:return 11;case 24:return 20;case 25:return 12;case 26:return 13;case 27:return 15;case 28:return 14;case 29:return 16;case 30:return'"';case 31:return"'";case 32:return"!";case 33:return 10;case 34:return 34;case 35:return"#";case 36:return 5}},rules:[/^(?:\s+)/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9\.]+(?=[(]))/,/^(?:#[A-Z0-9\/]+(!|\?)?)/,/^(?:\$[A-Za-z]+\$[0-9]+)/,/^(?:\$[A-Za-z]+[0-9]+)/,/^(?:[A-Za-z]+\$[0-9]+)/,/^(?:[A-Za-z]+[0-9]+)/,/^(?:[A-Za-z\.]+(?=[(]))/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9]+)/,/^(?:[A-Za-z_]+)/,/^(?:[0-9]+)/,/^(?:\[(.*)?\])/,/^(?:&)/,/^(?: )/,/^(?:[.])/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\/)/,/^(?:-)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\))/,/^(?:>)/,/^(?:<)/,/^(?:NOT\b)/,/^(?:")/,/^(?:')/,/^(?:!)/,/^(?:=)/,/^(?:%)/,/^(?:[#])/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],inclusive:!0}}}}();return parser.lexer=lexer,Parser.prototype=parser,parser.Parser=Parser,new Parser}();exports.parser=grammarParser,exports.Parser=grammarParser.Parser,exports.parse=function(){return grammarParser.parse.apply(grammarParser,arguments)},void 0!==module&&__webpack_require__.c[__webpack_require__.s]===module&&exports.main(process.argv.slice(1))}).call(exports,__webpack_require__(42)(module),__webpack_require__(10))},function(r,e){r.exports=function(r){return r.webpackPolyfill||(r.deprecate=function(){},r.paths=[],r.children||(r.children=[]),Object.defineProperty(r,"loaded",{enumerable:!0,get:function(){return r.l}}),Object.defineProperty(r,"id",{enumerable:!0,get:function(){return r.i}}),r.webpackPolyfill=1),r}},function(r,e,t){"use strict";function n(r){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;return r=r.substring(e,r.length-e)}e.__esModule=!0,e.trimEdges=n}])}); \ No newline at end of file +!function(r,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.formulaParser=t():r.formulaParser=t()}("undefined"!=typeof self?self:this,function(){return function(r){function t(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return r[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var e={};return t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{configurable:!1,enumerable:!0,get:n})},t.n=function(r){var e=r&&r.__esModule?function(){return r["default"]}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},t.p="",t(t.s=14)}([function(r,t){t.nil=Error("#NULL!"),t.div0=Error("#DIV/0!"),t.value=Error("#VALUE!"),t.ref=Error("#REF!"),t.name=Error("#NAME?"),t.num=Error("#NUM!"),t.na=Error("#N/A"),t.error=Error("#ERROR!"),t.data=Error("#GETTING_DATA")},function(r,t,e){var n=e(0);t.flattenShallow=function(r){return r&&r.reduce?r.reduce(function(r,t){var e=Array.isArray(r),n=Array.isArray(t);return e&&n?r.concat(t):e?(r.push(t),r):n?[r].concat(t):[r,t]}):r},t.isFlat=function(r){if(!r)return!1;for(var t=0;r.length>t;++t)if(Array.isArray(r[t]))return!1;return!0},t.flatten=function(){for(var r=t.argsToArray.apply(null,arguments);!t.isFlat(r);)r=t.flattenShallow(r);return r},t.argsToArray=function(r){var e=[];return t.arrayEach(r,function(r){e.push(r)}),e},t.numbers=function(){return this.flatten.apply(null,arguments).filter(function(r){return"number"==typeof r})},t.cleanFloat=function(r){return Math.round(1e14*r)/1e14},t.parseBool=function(r){if("boolean"==typeof r)return r;if(r instanceof Error)return r;if("number"==typeof r)return 0!==r;if("string"==typeof r){var t=r.toUpperCase();if("TRUE"===t)return!0;if("FALSE"===t)return!1}return r instanceof Date&&!isNaN(r)||n.value},t.parseNumber=function(r){return r===undefined||""===r?n.value:isNaN(r)?n.value:parseFloat(r)},t.parseNumberArray=function(r){var e;if(!r||0===(e=r.length))return n.value;for(var a;e--;){if((a=t.parseNumber(r[e]))===n.value)return a;r[e]=a}return r},t.parseMatrix=function(r){if(!r||0===r.length)return n.value;for(var e,a=0;r.length>a;a++)if(e=t.parseNumberArray(r[a]),r[a]=e,e instanceof Error)return e;return r};var a=new Date(Date.UTC(1900,0,1));t.parseDate=function(r){if(!isNaN(r)){if(r instanceof Date)return new Date(r);var t=parseInt(r,10);return 0>t?n.num:t>60?new Date(a.getTime()+864e5*(t-2)):new Date(a.getTime()+864e5*(t-1))}return"string"!=typeof r||(r=new Date(r),isNaN(r))?n.value:r},t.parseDateArray=function(r){for(var t,e=r.length;e--;){if((t=this.parseDate(r[e]))===n.value)return t;r[e]=t}return r},t.anyIsError=function(){for(var r=arguments.length;r--;)if(arguments[r]instanceof Error)return!0;return!1},t.arrayValuesToNumbers=function(r){for(var t,e=r.length;e--;)if("number"!=typeof(t=r[e]))if(!0!==t)if(!1!==t){if("string"==typeof t){var n=this.parseNumber(t);r[e]=n instanceof Error?0:n}}else r[e]=0;else r[e]=1;return r},t.rest=function(r,t){return t=t||1,r&&"function"==typeof r.slice?r.slice(t):r},t.initial=function(r,t){return t=t||1,r&&"function"==typeof r.slice?r.slice(0,r.length-t):r},t.arrayEach=function(r,t){for(var e=-1,n=r.length;++e-1?parseFloat(r):parseInt(r,10)),t}function a(r){return-1*n(r)}t.__esModule=!0,t.toNumber=n,t.invertNumber=a},function(module,exports,__webpack_require__){var utils=__webpack_require__(1),error=__webpack_require__(0),statistical=__webpack_require__(5),information=__webpack_require__(7);exports.ABS=function(r){return(r=utils.parseNumber(r))instanceof Error?r:Math.abs(r)},exports.ACOS=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var t=Math.acos(r);return isNaN(t)&&(t=error.num),t},exports.ACOSH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var t=Math.log(r+Math.sqrt(r*r-1));return isNaN(t)&&(t=error.num),t},exports.ACOT=function(r){return(r=utils.parseNumber(r))instanceof Error?r:Math.atan(1/r)},exports.ACOTH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var t=.5*Math.log((r+1)/(r-1));return isNaN(t)&&(t=error.num),t},exports.AGGREGATE=function(r,t,e,n){if(r=utils.parseNumber(r),t=utils.parseNumber(r),utils.anyIsError(r,t))return error.value;switch(r){case 1:return statistical.AVERAGE(e);case 2:return statistical.COUNT(e);case 3:return statistical.COUNTA(e);case 4:return statistical.MAX(e);case 5:return statistical.MIN(e);case 6:return exports.PRODUCT(e);case 7:return statistical.STDEV.S(e);case 8:return statistical.STDEV.P(e);case 9:return exports.SUM(e);case 10:return statistical.VAR.S(e);case 11:return statistical.VAR.P(e);case 12:return statistical.MEDIAN(e);case 13:return statistical.MODE.SNGL(e);case 14:return statistical.LARGE(e,n);case 15:return statistical.SMALL(e,n);case 16:return statistical.PERCENTILE.INC(e,n);case 17:return statistical.QUARTILE.INC(e,n);case 18:return statistical.PERCENTILE.EXC(e,n);case 19:return statistical.QUARTILE.EXC(e,n)}},exports.ARABIC=function(r){if(!/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/.test(r))return error.value;var t=0;return r.replace(/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g,function(r){t+={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1}[r]}),t},exports.ASIN=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var t=Math.asin(r);return isNaN(t)&&(t=error.num),t},exports.ASINH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log(r+Math.sqrt(r*r+1))},exports.ATAN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.atan(r)},exports.ATAN2=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:Math.atan2(r,t)},exports.ATANH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var t=Math.log((1+r)/(1-r))/2;return isNaN(t)&&(t=error.num),t},exports.BASE=function(r,t,e){if(e=e||0,r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e))return error.value;e=e===undefined?0:e;var n=r.toString(t);return Array(Math.max(e+1-n.length,0)).join("0")+n},exports.CEILING=function(r,t,e){if(t=t===undefined?1:Math.abs(t),e=e||0,r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e))return error.value;if(0===t)return 0;var n=-Math.floor(Math.log(t)/Math.log(10));return 0>r?0===e?-exports.ROUND(Math.floor(Math.abs(r)/t)*t,n):-exports.ROUND(Math.ceil(Math.abs(r)/t)*t,n):exports.ROUND(Math.ceil(r/t)*t,n)},exports.CEILING.MATH=exports.CEILING,exports.CEILING.PRECISE=exports.CEILING,exports.COMBIN=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:exports.FACT(r)/(exports.FACT(t)*exports.FACT(r-t))},exports.COMBINA=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:0===r&&0===t?1:exports.COMBIN(r+t-1,r-1)},exports.COS=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.cos(r)},exports.COSH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:(Math.exp(r)+Math.exp(-r))/2},exports.COT=function(r){return r=utils.parseNumber(r),r instanceof Error?r:1/Math.tan(r)},exports.COTH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var t=Math.exp(2*r);return(t+1)/(t-1)},exports.CSC=function(r){return r=utils.parseNumber(r),r instanceof Error?r:1/Math.sin(r)},exports.CSCH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:2/(Math.exp(r)-Math.exp(-r))},exports.DECIMAL=function(r,t){return 1>arguments.length?error.value:parseInt(r,t)},exports.DEGREES=function(r){return r=utils.parseNumber(r),r instanceof Error?r:180*r/Math.PI},exports.EVEN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:exports.CEILING(r,-2,-1)},exports.EXP=function(r){return 1>arguments.length?error.na:"number"!=typeof r||arguments.length>1?error.error:r=Math.exp(r)};var MEMOIZED_FACT=[];exports.FACT=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var t=Math.floor(r);return 0===t||1===t?1:MEMOIZED_FACT[t]>0?MEMOIZED_FACT[t]:MEMOIZED_FACT[t]=exports.FACT(t-1)*t},exports.FACTDOUBLE=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var t=Math.floor(r);return t>0?t*exports.FACTDOUBLE(t-2):1},exports.FLOOR=function(r,t){if(r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t))return error.value;if(0===t)return 0;if(!(r>0&&t>0||0>r&&0>t))return error.num;t=Math.abs(t);var e=-Math.floor(Math.log(t)/Math.log(10));return 0>r?-exports.ROUND(Math.ceil(Math.abs(r)/t),e):exports.ROUND(Math.floor(r/t)*t,e)},exports.FLOOR.MATH=function(r,t,e){if(t=t===undefined?1:t,e=e===undefined?0:e,r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e))return error.value;if(0===t)return 0;t=t?Math.abs(t):1;var n=-Math.floor(Math.log(t)/Math.log(10));return 0>r?0===e||e===undefined?-exports.ROUND(Math.ceil(Math.abs(r)/t)*t,n):-exports.ROUND(Math.floor(Math.abs(r)/t)*t,n):exports.ROUND(Math.floor(r/t)*t,n)},exports.FLOOR.PRECISE=exports.FLOOR.MATH,exports.GCD=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var t=r.length,e=r[0],n=0>e?-e:e,a=1;t>a;a++){for(var u=r[a],i=0>u?-u:u;n&&i;)n>i?n%=i:i%=n;n+=i}return n},exports.INT=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.floor(r)},exports.ISO={CEILING:exports.CEILING},exports.LCM=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var t,e,n,a,u=1;(n=r.pop())!==undefined;)for(;n>1;){if(n%2){for(t=3,e=Math.floor(Math.sqrt(n));e>=t&&n%t;t+=2);a=t>e?n:t}else a=2;for(n/=a,u*=a,t=r.length;t;r[--t]%a==0&&1==(r[t]/=a)&&r.splice(t,1));}return u},exports.LN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log(r)},exports.LN10=function(){return Math.log(10)},exports.LN2=function(){return Math.log(2)},exports.LOG10E=function(){return Math.LOG10E},exports.LOG2E=function(){return Math.LOG2E},exports.LOG=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:(t=t===undefined?10:t,Math.log(r)/Math.log(t))},exports.LOG10=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log(r)/Math.log(10)},exports.MOD=function(r,t){if(r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t))return error.value;if(0===t)return error.div0;var e=Math.abs(r%t);return t>0?e:-e},exports.MROUND=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:0>r*t?error.num:Math.round(r/t)*t},exports.MULTINOMIAL=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var t=0,e=1,n=0;r.length>n;n++)t+=r[n],e*=exports.FACT(r[n]);return exports.FACT(t)/e},exports.ODD=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var t=Math.ceil(Math.abs(r));return t=1&t?t:t+1,r>0?t:-t},exports.PI=function(){return Math.PI},exports.E=function(){return Math.E},exports.POWER=function(r,t){if(r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t))return error.value;var e=Math.pow(r,t);return isNaN(e)?error.num:e},exports.PRODUCT=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var t=1,e=0;r.length>e;e++)t*=r[e];return t},exports.QUOTIENT=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:parseInt(r/t,10)},exports.RADIANS=function(r){return r=utils.parseNumber(r),r instanceof Error?r:r*Math.PI/180},exports.RAND=function(){return Math.random()},exports.RANDBETWEEN=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:r+Math.ceil((t-r+1)*Math.random())-1},exports.ROMAN=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;for(var t=(r+"").split(""),e=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"],n="",a=3;a--;)n=(e[+t.pop()+10*a]||"")+n;return Array(+t.join("")+1).join("M")+n},exports.ROUND=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:Math.round(r*Math.pow(10,t))/Math.pow(10,t)},exports.ROUNDDOWN=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:(r>0?1:-1)*Math.floor(Math.abs(r)*Math.pow(10,t))/Math.pow(10,t)},exports.ROUNDUP=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:(r>0?1:-1)*Math.ceil(Math.abs(r)*Math.pow(10,t))/Math.pow(10,t)},exports.SEC=function(r){return r=utils.parseNumber(r),r instanceof Error?r:1/Math.cos(r)},exports.SECH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:2/(Math.exp(r)+Math.exp(-r))},exports.SERIESSUM=function(r,t,e,n){if(r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),n=utils.parseNumberArray(n),utils.anyIsError(r,t,e,n))return error.value;for(var a=n[0]*Math.pow(r,t),u=1;n.length>u;u++)a+=n[u]*Math.pow(r,t+u*e);return a},exports.SIGN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:0>r?-1:0===r?0:1},exports.SIN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.sin(r)},exports.SINH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:(Math.exp(r)-Math.exp(-r))/2},exports.SQRT=function(r){return r=utils.parseNumber(r),r instanceof Error?r:0>r?error.num:Math.sqrt(r)},exports.SQRTPI=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.sqrt(r*Math.PI)},exports.SQRT1_2=function(){return 1/Math.sqrt(2)},exports.SQRT2=function(){return Math.sqrt(2)},exports.SUBTOTAL=function(r,t){if((r=utils.parseNumber(r))instanceof Error)return r;switch(r){case 1:return statistical.AVERAGE(t);case 2:return statistical.COUNT(t);case 3:return statistical.COUNTA(t);case 4:return statistical.MAX(t);case 5:return statistical.MIN(t);case 6:return exports.PRODUCT(t);case 7:return statistical.STDEV.S(t);case 8:return statistical.STDEV.P(t);case 9:return exports.SUM(t);case 10:return statistical.VAR.S(t);case 11:return statistical.VAR.P(t);case 101:return statistical.AVERAGE(t);case 102:return statistical.COUNT(t);case 103:return statistical.COUNTA(t);case 104:return statistical.MAX(t);case 105:return statistical.MIN(t);case 106:return exports.PRODUCT(t);case 107:return statistical.STDEV.S(t);case 108:return statistical.STDEV.P(t);case 109:return exports.SUM(t);case 110:return statistical.VAR.S(t);case 111:return statistical.VAR.P(t)}},exports.ADD=function(r,t){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:r+t)},exports.MINUS=function(r,t){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:r-t)},exports.DIVIDE=function(r,t){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:0===t?error.div0:r/t)},exports.MULTIPLY=function(r,t){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:r*t)},exports.GTE=function(r,t){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.error:r>=t)},exports.LT=function(r,t){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.error:t>r)},exports.LTE=function(r,t){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.error:t>=r)},exports.EQ=function(r,t){return 2!==arguments.length?error.na:r===t},exports.NE=function(r,t){return 2!==arguments.length?error.na:r!==t},exports.POW=function(r,t){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.error:exports.POWER(r,t))},exports.SUM=function(){var r=0;return utils.arrayEach(utils.argsToArray(arguments),function(t){if("number"==typeof t)r+=t;else if("string"==typeof t){var e=parseFloat(t);!isNaN(e)&&(r+=e)}else Array.isArray(t)&&(r+=exports.SUM.apply(null,t))}),r},exports.SUMIF=function(range,criteria){if((range=utils.parseNumberArray(utils.flatten(range)))instanceof Error)return range;for(var result=0,i=0;range.length>i;i++)result+=eval(range[i]+criteria)?range[i]:0;return result},exports.SUMIFS=function(){var args=utils.argsToArray(arguments),range=utils.parseNumberArray(utils.flatten(args.shift()));if(range instanceof Error)return range;for(var criteria=args,n_range_elements=range.length,n_criterias=criteria.length,result=0,i=0;n_range_elements>i;i++){for(var el=range[i],condition="",c=0;n_criterias>c;c++)condition+=el+criteria[c],c!==n_criterias-1&&(condition+="&&");eval(condition)&&(result+=el)}return result},exports.SUMPRODUCT=function(){if(!arguments||0===arguments.length)return error.value;for(var r,t,e,n,a=arguments.length+1,u=0,i=0;arguments[0].length>i;i++)if(arguments[0][i]instanceof Array)for(var o=0;arguments[0][i].length>o;o++){for(r=1,t=1;a>t;t++){if((n=utils.parseNumber(arguments[t-1][i][o]))instanceof Error)return n;r*=n}u+=r}else{for(r=1,t=1;a>t;t++){if((e=utils.parseNumber(arguments[t-1][i]))instanceof Error)return e;r*=e}u+=r}return u},exports.SUMSQ=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var t=0,e=r.length,n=0;e>n;n++)t+=information.ISNUMBER(r[n])?r[n]*r[n]:0;return t},exports.SUMX2MY2=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t))return error.value;for(var e=0,n=0;r.length>n;n++)e+=r[n]*r[n]-t[n]*t[n];return e},exports.SUMX2PY2=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t))return error.value;var e=0;r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t));for(var n=0;r.length>n;n++)e+=r[n]*r[n]+t[n]*t[n];return e},exports.SUMXMY2=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t))return error.value;var e=0;r=utils.flatten(r),t=utils.flatten(t);for(var n=0;r.length>n;n++)e+=Math.pow(r[n]-t[n],2);return e},exports.TAN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.tan(r)},exports.TANH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var t=Math.exp(2*r);return(t-1)/(t+1)},exports.TRUNC=function(r,t){return t=t===undefined?0:t,r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:(r>0?1:-1)*Math.floor(Math.abs(r)*Math.pow(10,t))/Math.pow(10,t)}},function(module,exports,__webpack_require__){var mathTrig=__webpack_require__(4),text=__webpack_require__(6),jStat=__webpack_require__(9).jStat,utils=__webpack_require__(1),error=__webpack_require__(0),misc=__webpack_require__(10);exports.AVEDEV=function(){var r=utils.parseNumberArray(utils.flatten(arguments));return r instanceof Error?r:jStat.sum(jStat(r).subtract(jStat.mean(r)).abs()[0])/r.length},exports.AVERAGE=function(){for(var r,t=utils.numbers(utils.flatten(arguments)),e=t.length,n=0,a=0,u=0;e>u;u++)n+=t[u],a+=1;return r=n/a,isNaN(r)&&(r=error.num),r},exports.AVERAGEA=function(){for(var r,t=utils.flatten(arguments),e=t.length,n=0,a=0,u=0;e>u;u++){var i=t[u];"number"==typeof i&&(n+=i),!0===i&&n++,null!==i&&a++}return r=n/a,isNaN(r)&&(r=error.num),r},exports.AVERAGEIF=function(range,criteria,average_range){if(1>=arguments.length)return error.na;if(average_range=average_range||range,range=utils.flatten(range),(average_range=utils.parseNumberArray(utils.flatten(average_range)))instanceof Error)return average_range;for(var average_count=0,result=0,i=0;range.length>i;i++)eval(range[i]+criteria)&&(result+=average_range[i],average_count++);return result/average_count},exports.AVERAGEIFS=function(){for(var args=utils.argsToArray(arguments),criteria=(args.length-1)/2,range=utils.flatten(args[0]),count=0,result=0,i=0;range.length>i;i++){for(var condition="",j=0;criteria>j;j++)condition+=args[2*j+1][i]+args[2*j+2],j!==criteria-1&&(condition+="&&");eval(condition)&&(result+=range[i],count++)}var average=result/count;return isNaN(average)?0:average},exports.BETA={},exports.BETA.DIST=function(r,t,e,n,a,u){return 4>arguments.length?error.value:(a=a===undefined?0:a,u=u===undefined?1:u,r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),a=utils.parseNumber(a),u=utils.parseNumber(u),utils.anyIsError(r,t,e,a,u)?error.value:(r=(r-a)/(u-a),n?jStat.beta.cdf(r,t,e):jStat.beta.pdf(r,t,e)))},exports.BETA.INV=function(r,t,e,n,a){return n=n===undefined?0:n,a=a===undefined?1:a,r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),n=utils.parseNumber(n),a=utils.parseNumber(a),utils.anyIsError(r,t,e,n,a)?error.value:jStat.beta.inv(r,t,e)*(a-n)+n},exports.BINOM={},exports.BINOM.DIST=function(r,t,e,n){return r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),n=utils.parseNumber(n),utils.anyIsError(r,t,e,n)?error.value:n?jStat.binomial.cdf(r,t,e):jStat.binomial.pdf(r,t,e)},exports.BINOM.DIST.RANGE=function(r,t,e,n){if(n=n===undefined?e:n,r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),n=utils.parseNumber(n),utils.anyIsError(r,t,e,n))return error.value;for(var a=0,u=e;n>=u;u++)a+=mathTrig.COMBIN(r,u)*Math.pow(t,u)*Math.pow(1-t,r-u);return a},exports.BINOM.INV=function(r,t,e){if(r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e))return error.value;for(var n=0;r>=n;){if(jStat.binomial.cdf(n,r,t)>=e)return n;n++}},exports.CHISQ={},exports.CHISQ.DIST=function(r,t,e){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:e?jStat.chisquare.cdf(r,t):jStat.chisquare.pdf(r,t)},exports.CHISQ.DIST.RT=function(r,t){return!r|!t?error.na:1>r||t>Math.pow(10,10)?error.num:"number"!=typeof r||"number"!=typeof t?error.value:1-jStat.chisquare.cdf(r,t)},exports.CHISQ.INV=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:jStat.chisquare.inv(r,t)},exports.CHISQ.INV.RT=function(r,t){return!r|!t?error.na:0>r||r>1||1>t||t>Math.pow(10,10)?error.num:"number"!=typeof r||"number"!=typeof t?error.value:jStat.chisquare.inv(1-r,t)},exports.CHISQ.TEST=function(r,t){if(2!==arguments.length)return error.na;if(!(r instanceof Array&&t instanceof Array))return error.value;if(r.length!==t.length)return error.value;if(r[0]&&t[0]&&r[0].length!==t[0].length)return error.value;var e,n,a,u=r.length;for(n=0;u>n;n++)r[n]instanceof Array||(e=r[n],r[n]=[],r[n].push(e)),t[n]instanceof Array||(e=t[n],t[n]=[],t[n].push(e));var i=r[0].length,o=1===i?u-1:(u-1)*(i-1),s=0,l=Math.PI;for(n=0;u>n;n++)for(a=0;i>a;a++)s+=Math.pow(r[n][a]-t[n][a],2)/t[n][a];return Math.round(1e6*function(r,t){var e=Math.exp(-.5*r);t%2==1&&(e*=Math.sqrt(2*r/l));for(var n=t;n>=2;)e=e*r/n,n-=2;for(var a=e,u=t;a>1e-10*e;)u+=2,a=a*r/u,e+=a;return 1-e}(s,o))/1e6},exports.COLUMN=function(r,t){return 2!==arguments.length?error.na:0>t?error.num:r instanceof Array&&"number"==typeof t?0===r.length?undefined:jStat.col(r,t):error.value},exports.COLUMNS=function(r){return 1!==arguments.length?error.na:r instanceof Array?0===r.length?0:jStat.cols(r):error.value},exports.CONFIDENCE={},exports.CONFIDENCE.NORM=function(r,t,e){return r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e)?error.value:jStat.normalci(1,r,t,e)[1]-1},exports.CONFIDENCE.T=function(r,t,e){return r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e)?error.value:jStat.tci(1,r,t,e)[1]-1},exports.CORREL=function(r,t){return r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t)?error.value:jStat.corrcoeff(r,t)},exports.COUNT=function(){return utils.numbers(utils.flatten(arguments)).length},exports.COUNTA=function(){var r=utils.flatten(arguments);return r.length-exports.COUNTBLANK(r)},exports.COUNTIN=function(r,t){var e=0;r=utils.flatten(r);for(var n=0;r.length>n;n++)r[n]===t&&e++;return e},exports.COUNTBLANK=function(){for(var r,t=utils.flatten(arguments),e=0,n=0;t.length>n;n++)null!==(r=t[n])&&""!==r||e++;return e},exports.COUNTIF=function(range,criteria){range=utils.flatten(range),/[<>=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var matches=0,i=0;range.length>i;i++)"string"!=typeof range[i]?eval(range[i]+criteria)&&matches++:eval('"'+range[i]+'"'+criteria)&&matches++;return matches},exports.COUNTIFS=function(){for(var args=utils.argsToArray(arguments),results=Array(utils.flatten(args[0]).length),i=0;results.length>i;i++)results[i]=!0;for(i=0;args.length>i;i+=2){var range=utils.flatten(args[i]),criteria=args[i+1];/[<>=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var j=0;range.length>j;j++)results[j]="string"!=typeof range[j]?results[j]&&eval(range[j]+criteria):results[j]&&eval('"'+range[j]+'"'+criteria)}var result=0;for(i=0;results.length>i;i++)results[i]&&result++;return result},exports.COUNTUNIQUE=function(){return misc.UNIQUE.apply(null,utils.flatten(arguments)).length},exports.COVARIANCE={},exports.COVARIANCE.P=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t))return error.value;for(var e=jStat.mean(r),n=jStat.mean(t),a=0,u=r.length,i=0;u>i;i++)a+=(r[i]-e)*(t[i]-n);return a/u},exports.COVARIANCE.S=function(r,t){return r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t)?error.value:jStat.covariance(r,t)},exports.DEVSQ=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var t=jStat.mean(r),e=0,n=0;r.length>n;n++)e+=Math.pow(r[n]-t,2);return e},exports.EXPON={},exports.EXPON.DIST=function(r,t,e){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:e?jStat.exponential.cdf(r,t):jStat.exponential.pdf(r,t)},exports.F={},exports.F.DIST=function(r,t,e,n){return r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e)?error.value:n?jStat.centralF.cdf(r,t,e):jStat.centralF.pdf(r,t,e)},exports.F.DIST.RT=function(r,t,e){return 3!==arguments.length?error.na:0>r||1>t||1>e?error.num:"number"!=typeof r||"number"!=typeof t||"number"!=typeof e?error.value:1-jStat.centralF.cdf(r,t,e)},exports.F.INV=function(r,t,e){return r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e)?error.value:0>=r||r>1?error.num:jStat.centralF.inv(r,t,e)},exports.F.INV.RT=function(r,t,e){return 3!==arguments.length?error.na:0>r||r>1||1>t||t>Math.pow(10,10)||1>e||e>Math.pow(10,10)?error.num:"number"!=typeof r||"number"!=typeof t||"number"!=typeof e?error.value:jStat.centralF.inv(1-r,t,e)},exports.F.TEST=function(r,t){if(!r||!t)return error.na;if(!(r instanceof Array&&t instanceof Array))return error.na;if(2>r.length||2>t.length)return error.div0;var e=function(r,t){for(var e=0,n=0;r.length>n;n++)e+=Math.pow(r[n]-t,2);return e},n=mathTrig.SUM(r)/r.length,a=mathTrig.SUM(t)/t.length;return e(r,n)/(r.length-1)/(e(t,a)/(t.length-1))},exports.FISHER=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log((1+r)/(1-r))/2},exports.FISHERINV=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var t=Math.exp(2*r);return(t-1)/(t+1)},exports.FORECAST=function(r,t,e){if(r=utils.parseNumber(r),t=utils.parseNumberArray(utils.flatten(t)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,t,e))return error.value;for(var n=jStat.mean(e),a=jStat.mean(t),u=e.length,i=0,o=0,s=0;u>s;s++)i+=(e[s]-n)*(t[s]-a),o+=Math.pow(e[s]-n,2);var l=i/o;return a-l*n+l*r},exports.FREQUENCY=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t))return error.value;for(var e=r.length,n=t.length,a=[],u=0;n>=u;u++){a[u]=0;for(var i=0;e>i;i++)0===u?r[i]>t[0]||(a[0]+=1):n>u?r[i]>t[u-1]&&t[u]>=r[i]&&(a[u]+=1):u===n&&r[i]>t[n-1]&&(a[n]+=1)}return a},exports.GAMMA=function(r){return r=utils.parseNumber(r),r instanceof Error?r:0===r?error.num:parseInt(r,10)===r&&0>r?error.num:jStat.gammafn(r)},exports.GAMMA.DIST=function(r,t,e,n){return 4!==arguments.length?error.na:r>=0&&t>0&&e>0?"number"!=typeof r||"number"!=typeof t||"number"!=typeof e?error.value:n?jStat.gamma.cdf(r,t,e,!0):jStat.gamma.pdf(r,t,e,!1):error.value},exports.GAMMA.INV=function(r,t,e){return 3!==arguments.length?error.na:0>r||r>1||0>=t||0>=e?error.num:"number"!=typeof r||"number"!=typeof t||"number"!=typeof e?error.value:jStat.gamma.inv(r,t,e)},exports.GAMMALN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:jStat.gammaln(r)},exports.GAMMALN.PRECISE=function(r){return 1!==arguments.length?error.na:r>0?"number"!=typeof r?error.value:jStat.gammaln(r):error.num},exports.GAUSS=function(r){return r=utils.parseNumber(r),r instanceof Error?r:jStat.normal.cdf(r,0,1)-.5},exports.GEOMEAN=function(){var r=utils.parseNumberArray(utils.flatten(arguments));return r instanceof Error?r:jStat.geomean(r)},exports.GROWTH=function(r,t,e,n){if((r=utils.parseNumberArray(r))instanceof Error)return r;var a;if(t===undefined)for(t=[],a=1;r.length>=a;a++)t.push(a);if(e===undefined)for(e=[],a=1;r.length>=a;a++)e.push(a);if(t=utils.parseNumberArray(t),e=utils.parseNumberArray(e),utils.anyIsError(t,e))return error.value;n===undefined&&(n=!0);var u=r.length,i=0,o=0,s=0,l=0;for(a=0;u>a;a++){var f=t[a],c=Math.log(r[a]);i+=f,o+=c,s+=f*c,l+=f*f}i/=u,o/=u,s/=u,l/=u;var p,h;n?(p=(s-i*o)/(l-i*i),h=o-p*i):(p=s/l,h=0);var m=[];for(a=0;e.length>a;a++)m.push(Math.exp(h+p*e[a]));return m},exports.HARMEAN=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var t=r.length,e=0,n=0;t>n;n++)e+=1/r[n];return t/e},exports.HYPGEOM={},exports.HYPGEOM.DIST=function(r,t,e,n,a){function u(r,t,e,n){return mathTrig.COMBIN(e,r)*mathTrig.COMBIN(n-e,t-r)/mathTrig.COMBIN(n,t)}return r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),n=utils.parseNumber(n),utils.anyIsError(r,t,e,n)?error.value:a?function(r,t,e,n){for(var a=0,i=0;r>=i;i++)a+=u(i,t,e,n);return a}(r,t,e,n):u(r,t,e,n)},exports.INTERCEPT=function(r,t){return r=utils.parseNumberArray(r),t=utils.parseNumberArray(t),utils.anyIsError(r,t)?error.value:r.length!==t.length?error.na:exports.FORECAST(0,r,t)},exports.KURT=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var t=jStat.mean(r),e=r.length,n=0,a=0;e>a;a++)n+=Math.pow(r[a]-t,4);return n/=Math.pow(jStat.stdev(r,!0),4),e*(e+1)/((e-1)*(e-2)*(e-3))*n-3*(e-1)*(e-1)/((e-2)*(e-3))},exports.LARGE=function(r,t){return r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumber(t),utils.anyIsError(r,t)?r:r.sort(function(r,t){return t-r})[t-1]},exports.LINEST=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t))return error.value;for(var e=jStat.mean(r),n=jStat.mean(t),a=t.length,u=0,i=0,o=0;a>o;o++)u+=(t[o]-n)*(r[o]-e),i+=Math.pow(t[o]-n,2);var s=u/i;return[s,e-s*n]},exports.LOGEST=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t))return error.value;for(var e=0;r.length>e;e++)r[e]=Math.log(r[e]);var n=exports.LINEST(r,t);return n[0]=Math.round(1e6*Math.exp(n[0]))/1e6,n[1]=Math.round(1e6*Math.exp(n[1]))/1e6,n},exports.LOGNORM={},exports.LOGNORM.DIST=function(r,t,e,n){return r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e)?error.value:n?jStat.lognormal.cdf(r,t,e):jStat.lognormal.pdf(r,t,e)},exports.LOGNORM.INV=function(r,t,e){return r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e)?error.value:jStat.lognormal.inv(r,t,e)},exports.MAX=function(){var r=utils.numbers(utils.flatten(arguments));return 0===r.length?0:Math.max.apply(Math,r)},exports.MAXA=function(){var r=utils.arrayValuesToNumbers(utils.flatten(arguments));return 0===r.length?0:Math.max.apply(Math,r)},exports.MEDIAN=function(){var r=utils.arrayValuesToNumbers(utils.flatten(arguments)),t=jStat.median(r);return isNaN(t)&&(t=error.num),t},exports.MIN=function(){var r=utils.numbers(utils.flatten(arguments));return 0===r.length?0:Math.min.apply(Math,r)},exports.MINA=function(){var r=utils.arrayValuesToNumbers(utils.flatten(arguments));return 0===r.length?0:Math.min.apply(Math,r)},exports.MODE={},exports.MODE.MULT=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var t,e=r.length,n={},a=[],u=0,i=0;e>i;i++)t=r[i],n[t]=n[t]?n[t]+1:1,n[t]>u&&(u=n[t],a=[]),n[t]===u&&(a[a.length]=t);return a},exports.MODE.SNGL=function(){var r=utils.parseNumberArray(utils.flatten(arguments));return r instanceof Error?r:exports.MODE.MULT(r).sort(function(r,t){return r-t})[0]},exports.NEGBINOM={},exports.NEGBINOM.DIST=function(r,t,e,n){return r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e)?error.value:n?jStat.negbin.cdf(r,t,e):jStat.negbin.pdf(r,t,e)},exports.NORM={},exports.NORM.DIST=function(r,t,e,n){return r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e)?error.value:e>0?n?jStat.normal.cdf(r,t,e):jStat.normal.pdf(r,t,e):error.num},exports.NORM.INV=function(r,t,e){return r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e)?error.value:jStat.normal.inv(r,t,e)},exports.NORM.S={},exports.NORM.S.DIST=function(r,t){return r=utils.parseNumber(r),r instanceof Error?error.value:t?jStat.normal.cdf(r,0,1):jStat.normal.pdf(r,0,1)},exports.NORM.S.INV=function(r){return r=utils.parseNumber(r),r instanceof Error?error.value:jStat.normal.inv(r,0,1)},exports.PEARSON=function(r,t){if(t=utils.parseNumberArray(utils.flatten(t)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(t,r))return error.value;for(var e=jStat.mean(r),n=jStat.mean(t),a=r.length,u=0,i=0,o=0,s=0;a>s;s++)u+=(r[s]-e)*(t[s]-n),i+=Math.pow(r[s]-e,2),o+=Math.pow(t[s]-n,2);return u/Math.sqrt(i*o)},exports.PERCENTILE={},exports.PERCENTILE.EXC=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumber(t),utils.anyIsError(r,t))return error.value;r=r.sort(function(r,t){return r-t});var e=r.length;if(1/(e+1)>t||t>1-1/(e+1))return error.num;var n=t*(e+1)-1,a=Math.floor(n);return utils.cleanFloat(n===a?r[n]:r[a]+(n-a)*(r[a+1]-r[a]))},exports.PERCENTILE.INC=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumber(t),utils.anyIsError(r,t))return error.value;r=r.sort(function(r,t){return r-t});var e=r.length,n=t*(e-1),a=Math.floor(n);return utils.cleanFloat(n===a?r[n]:r[a]+(n-a)*(r[a+1]-r[a]))},exports.PERCENTRANK={},exports.PERCENTRANK.EXC=function(r,t,e){if(e=e===undefined?3:e,r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e))return error.value;r=r.sort(function(r,t){return r-t});for(var n=misc.UNIQUE.apply(null,r),a=r.length,u=n.length,i=Math.pow(10,e),o=0,s=!1,l=0;!s&&u>l;)t===n[l]?(o=(r.indexOf(n[l])+1)/(a+1),s=!0):n[l]>t||t>=n[l+1]&&l!==u-1||(o=(r.indexOf(n[l])+1+(t-n[l])/(n[l+1]-n[l]))/(a+1),s=!0),l++;return Math.floor(o*i)/i},exports.PERCENTRANK.INC=function(r,t,e){if(e=e===undefined?3:e,r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e))return error.value;r=r.sort(function(r,t){return r-t});for(var n=misc.UNIQUE.apply(null,r),a=r.length,u=n.length,i=Math.pow(10,e),o=0,s=!1,l=0;!s&&u>l;)t===n[l]?(o=r.indexOf(n[l])/(a-1),s=!0):n[l]>t||t>=n[l+1]&&l!==u-1||(o=(r.indexOf(n[l])+(t-n[l])/(n[l+1]-n[l]))/(a-1),s=!0),l++;return Math.floor(o*i)/i},exports.PERMUT=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:mathTrig.FACT(r)/mathTrig.FACT(r-t)},exports.PERMUTATIONA=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:Math.pow(r,t)},exports.PHI=function(r){return r=utils.parseNumber(r),r instanceof Error?error.value:Math.exp(-.5*r*r)/2.5066282746310002},exports.POISSON={},exports.POISSON.DIST=function(r,t,e){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:e?jStat.poisson.cdf(r,t):jStat.poisson.pdf(r,t)},exports.PROB=function(r,t,e,n){if(e===undefined)return 0;if(n=n===undefined?e:n,r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),e=utils.parseNumber(e),n=utils.parseNumber(n),utils.anyIsError(r,t,e,n))return error.value;if(e===n)return 0>r.indexOf(e)?0:t[r.indexOf(e)];for(var a=r.sort(function(r,t){return r-t}),u=a.length,i=0,o=0;u>o;o++)e>a[o]||a[o]>n||(i+=t[r.indexOf(a[o])]);return i},exports.QUARTILE={},exports.QUARTILE.EXC=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumber(t),utils.anyIsError(r,t))return error.value;switch(t){case 1:return exports.PERCENTILE.EXC(r,.25);case 2:return exports.PERCENTILE.EXC(r,.5);case 3:return exports.PERCENTILE.EXC(r,.75);default:return error.num}},exports.QUARTILE.INC=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumber(t),utils.anyIsError(r,t))return error.value;switch(t){case 1:return exports.PERCENTILE.INC(r,.25);case 2:return exports.PERCENTILE.INC(r,.5);case 3:return exports.PERCENTILE.INC(r,.75);default:return error.num}},exports.RANK={},exports.RANK.AVG=function(r,t,e){if(r=utils.parseNumber(r),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t))return error.value;t=utils.flatten(t),e=e||!1,t=t.sort(e?function(r,t){return r-t}:function(r,t){return t-r});for(var n=t.length,a=0,u=0;n>u;u++)t[u]===r&&a++;return a>1?(2*t.indexOf(r)+a+1)/2:t.indexOf(r)+1},exports.RANK.EQ=function(r,t,e){return r=utils.parseNumber(r),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t)?error.value:(e=e||!1,t=t.sort(e?function(r,t){return r-t}:function(r,t){return t-r}),t.indexOf(r)+1)},exports.ROW=function(r,t){return 2!==arguments.length?error.na:0>t?error.num:r instanceof Array&&"number"==typeof t?0===r.length?undefined:jStat.row(r,t):error.value},exports.ROWS=function(r){return 1!==arguments.length?error.na:r instanceof Array?0===r.length?0:jStat.rows(r):error.value},exports.RSQ=function(r,t){return r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t)?error.value:Math.pow(exports.PEARSON(r,t),2)},exports.SKEW=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var t=jStat.mean(r),e=r.length,n=0,a=0;e>a;a++)n+=Math.pow(r[a]-t,3);return e*n/((e-1)*(e-2)*Math.pow(jStat.stdev(r,!0),3))},exports.SKEW.P=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var t=jStat.mean(r),e=r.length,n=0,a=0,u=0;e>u;u++)a+=Math.pow(r[u]-t,3),n+=Math.pow(r[u]-t,2);return a/=e,n/=e,a/Math.pow(n,1.5)},exports.SLOPE=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t))return error.value;for(var e=jStat.mean(t),n=jStat.mean(r),a=t.length,u=0,i=0,o=0;a>o;o++)u+=(t[o]-e)*(r[o]-n),i+=Math.pow(t[o]-e,2);return u/i},exports.SMALL=function(r,t){return r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumber(t),utils.anyIsError(r,t)?r:r.sort(function(r,t){return r-t})[t-1]},exports.STANDARDIZE=function(r,t,e){return r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e)?error.value:(r-t)/e},exports.STDEV={},exports.STDEV.P=function(){var r=exports.VAR.P.apply(this,arguments),t=Math.sqrt(r);return isNaN(t)&&(t=error.num),t},exports.STDEV.S=function(){var r=exports.VAR.S.apply(this,arguments);return Math.sqrt(r)},exports.STDEVA=function(){var r=exports.VARA.apply(this,arguments);return Math.sqrt(r)},exports.STDEVPA=function(){var r=exports.VARPA.apply(this,arguments),t=Math.sqrt(r);return isNaN(t)&&(t=error.num),t},exports.STEYX=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t))return error.value;for(var e=jStat.mean(t),n=jStat.mean(r),a=t.length,u=0,i=0,o=0,s=0;a>s;s++)u+=Math.pow(r[s]-n,2),i+=(t[s]-e)*(r[s]-n),o+=Math.pow(t[s]-e,2);return Math.sqrt((u-i*i/o)/(a-2))},exports.TRANSPOSE=function(r){return r?jStat.transpose(r):error.na},exports.T=text.T,exports.T.DIST=function(r,t,e){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:e?jStat.studentt.cdf(r,t):jStat.studentt.pdf(r,t)},exports.T.DIST["2T"]=function(r,t){return 2!==arguments.length?error.na:0>r||1>t?error.num:"number"!=typeof r||"number"!=typeof t?error.value:2*(1-jStat.studentt.cdf(r,t))},exports.T.DIST.RT=function(r,t){return 2!==arguments.length?error.na:0>r||1>t?error.num:"number"!=typeof r||"number"!=typeof t?error.value:1-jStat.studentt.cdf(r,t)},exports.T.INV=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(r,t)?error.value:jStat.studentt.inv(r,t)},exports.T.INV["2T"]=function(r,t){return r=utils.parseNumber(r),t=utils.parseNumber(t),0>=r||r>1||1>t?error.num:utils.anyIsError(r,t)?error.value:Math.abs(jStat.studentt.inv(r/2,t))},exports.T.TEST=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,t))return error.value;var e,n=jStat.mean(r),a=jStat.mean(t),u=0,i=0;for(e=0;r.length>e;e++)u+=Math.pow(r[e]-n,2);for(e=0;t.length>e;e++)i+=Math.pow(t[e]-a,2);u/=r.length-1,i/=t.length-1;var o=Math.abs(n-a)/Math.sqrt(u/r.length+i/t.length);return exports.T.DIST["2T"](o,r.length+t.length-2)},exports.TREND=function(r,t,e){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,t,e))return error.value;var n=exports.LINEST(r,t),a=n[0],u=n[1],i=[];return e.forEach(function(r){i.push(a*r+u)}),i},exports.TRIMMEAN=function(r,t){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumber(t),utils.anyIsError(r,t))return error.value;var e=mathTrig.FLOOR(r.length*t,2)/2;return jStat.mean(utils.initial(utils.rest(r.sort(function(r,t){return r-t}),e),e))},exports.VAR={},exports.VAR.P=function(){for(var r,t=utils.numbers(utils.flatten(arguments)),e=t.length,n=0,a=exports.AVERAGE(t),u=0;e>u;u++)n+=Math.pow(t[u]-a,2);return r=n/e,isNaN(r)&&(r=error.num),r},exports.VAR.S=function(){for(var r=utils.numbers(utils.flatten(arguments)),t=r.length,e=0,n=exports.AVERAGE(r),a=0;t>a;a++)e+=Math.pow(r[a]-n,2);return e/(t-1)},exports.VARA=function(){for(var r=utils.flatten(arguments),t=r.length,e=0,n=0,a=exports.AVERAGEA(r),u=0;t>u;u++){var i=r[u];e+="number"==typeof i?Math.pow(i-a,2):!0===i?Math.pow(1-a,2):Math.pow(0-a,2),null!==i&&n++}return e/(n-1)},exports.VARPA=function(){for(var r,t=utils.flatten(arguments),e=t.length,n=0,a=0,u=exports.AVERAGEA(t),i=0;e>i;i++){var o=t[i];n+="number"==typeof o?Math.pow(o-u,2):!0===o?Math.pow(1-u,2):Math.pow(0-u,2),null!==o&&a++}return r=n/a,isNaN(r)&&(r=error.num),r},exports.WEIBULL={},exports.WEIBULL.DIST=function(r,t,e,n){return r=utils.parseNumber(r),t=utils.parseNumber(t),e=utils.parseNumber(e),utils.anyIsError(r,t,e)?error.value:n?1-Math.exp(-Math.pow(r/e,t)):Math.pow(r,t-1)*Math.exp(-Math.pow(r/e,t))*t/Math.pow(e,t)},exports.Z={},exports.Z.TEST=function(r,t,e){if(r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumber(t),utils.anyIsError(r,t))return error.value;e=e||exports.STDEV.S(r);var n=r.length;return 1-exports.NORM.S.DIST((exports.AVERAGE(r)-t)/(e/Math.sqrt(n)),!0)}},function(r,t,e){var n=e(1),a=e(0);t.ASC=function(){throw Error("ASC is not implemented")},t.BAHTTEXT=function(){throw Error("BAHTTEXT is not implemented")},t.CHAR=function(r){return r=n.parseNumber(r),r instanceof Error?r:String.fromCharCode(r)},t.CLEAN=function(r){return r=r||"",r.replace(/[\0-\x1F]/g,"")},t.CODE=function(r){r=r||"";var t=r.charCodeAt(0);return isNaN(t)&&(t=a.na),t},t.CONCATENATE=function(){for(var r=n.flatten(arguments),t=0;(t=r.indexOf(!0))>-1;)r[t]="TRUE";for(var e=0;(e=r.indexOf(!1))>-1;)r[e]="FALSE";return r.join("")},t.DBCS=function(){throw Error("DBCS is not implemented")},t.DOLLAR=function(){throw Error("DOLLAR is not implemented")},t.EXACT=function(r,t){return 2!==arguments.length?a.na:r===t},t.FIND=function(r,t,e){return 2>arguments.length?a.na:(e=e===undefined?0:e,t?t.indexOf(r,e-1)+1:null)},t.FIXED=function(){throw Error("FIXED is not implemented")},t.HTML2TEXT=function(r){var t="";return r&&(r instanceof Array?r.forEach(function(r){""!==t&&(t+="\n"),t+=r.replace(/<(?:.|\n)*?>/gm,"")}):t=r.replace(/<(?:.|\n)*?>/gm,"")),t},t.LEFT=function(r,t){return t=t===undefined?1:t,t=n.parseNumber(t),t instanceof Error||"string"!=typeof r?a.value:r?r.substring(0,t):null},t.LEN=function(r){return 0===arguments.length?a.error:"string"==typeof r?r?r.length:0:r.length?r.length:a.value},t.LOWER=function(r){return"string"!=typeof r?a.value:r?r.toLowerCase():r},t.MID=function(r,t,e){if(t=n.parseNumber(t),e=n.parseNumber(e),n.anyIsError(t,e)||"string"!=typeof r)return e;var a=t-1;return r.substring(a,a+e)},t.NUMBERVALUE=function(r,t,e){return t=void 0===t?".":t,e=void 0===e?",":e,+r.replace(t,".").replace(e,"")},t.PRONETIC=function(){throw Error("PRONETIC is not implemented")},t.PROPER=function(r){return r===undefined||0===r.length?a.value:(!0===r&&(r="TRUE"),!1===r&&(r="FALSE"),isNaN(r)&&"number"==typeof r?a.value:("number"==typeof r&&(r=""+r),r.replace(/\w\S*/g,function(r){return r.charAt(0).toUpperCase()+r.substr(1).toLowerCase()})))},t.REGEXEXTRACT=function(r,t){if(2>arguments.length)return a.na;var e=r.match(RegExp(t));return e?e[e.length>1?e.length-1:0]:null},t.REGEXMATCH=function(r,t,e){if(2>arguments.length)return a.na;var n=r.match(RegExp(t));return e?n:!!n},t.REGEXREPLACE=function(r,t,e){return 3>arguments.length?a.na:r.replace(RegExp(t),e)},t.REPLACE=function(r,t,e,u){return t=n.parseNumber(t),e=n.parseNumber(e),n.anyIsError(t,e)||"string"!=typeof r||"string"!=typeof u?a.value:r.substr(0,t-1)+u+r.substr(t-1+e)},t.REPT=function(r,t){return t=n.parseNumber(t),t instanceof Error?t:Array(t+1).join(r)},t.RIGHT=function(r,t){return t=t===undefined?1:t,t=n.parseNumber(t),t instanceof Error?t:r?r.substring(r.length-t):a.na},t.SEARCH=function(r,t,e){var n;return"string"!=typeof r||"string"!=typeof t?a.value:(e=e===undefined?0:e,n=t.toLowerCase().indexOf(r.toLowerCase(),e-1)+1,0===n?a.value:n)},t.SPLIT=function(r,t){return r.split(t)},t.SUBSTITUTE=function(r,t,e,n){if(2>arguments.length)return a.na;if(!(r&&t&&e))return r;if(n===undefined)return r.replace(RegExp(t,"g"),e);for(var u=0,i=0;r.indexOf(t,u)>0;)if(u=r.indexOf(t,u+1),++i===n)return r.substring(0,u)+e+r.substring(u+t.length)},t.T=function(r){return"string"==typeof r?r:""},t.TEXT=function(){throw Error("TEXT is not implemented")},t.TRIM=function(r){return"string"!=typeof r?a.value:r.replace(/ +/g," ").trim()},t.UNICHAR=t.CHAR,t.UNICODE=t.CODE,t.UPPER=function(r){return"string"!=typeof r?a.value:r.toUpperCase()},t.VALUE=function(){throw Error("VALUE is not implemented")}},function(r,t,e){var n=e(0);t.CELL=function(){throw Error("CELL is not implemented")},t.ERROR={},t.ERROR.TYPE=function(r){switch(r){case n.nil:return 1;case n.div0:return 2;case n.value:return 3;case n.ref:return 4;case n.name:return 5;case n.num:return 6;case n.na:return 7;case n.data:return 8}return n.na},t.INFO=function(){throw Error("INFO is not implemented")},t.ISBLANK=function(r){return null===r},t.ISBINARY=function(r){return/^[01]{1,10}$/.test(r)},t.ISERR=function(r){return[n.value,n.ref,n.div0,n.num,n.name,n.nil].indexOf(r)>=0||"number"==typeof r&&(isNaN(r)||!isFinite(r))},t.ISERROR=function(r){return t.ISERR(r)||r===n.na},t.ISEVEN=function(r){return!(1&Math.floor(Math.abs(r)))},t.ISFORMULA=function(){throw Error("ISFORMULA is not implemented")},t.ISLOGICAL=function(r){return!0===r||!1===r},t.ISNA=function(r){return r===n.na},t.ISNONTEXT=function(r){return"string"!=typeof r},t.ISNUMBER=function(r){return"number"==typeof r&&!isNaN(r)&&isFinite(r)},t.ISODD=function(r){return!!(1&Math.floor(Math.abs(r)))},t.ISREF=function(){throw Error("ISREF is not implemented")},t.ISTEXT=function(r){return"string"==typeof r},t.N=function(r){return this.ISNUMBER(r)?r:r instanceof Date?r.getTime():!0===r?1:!1===r?0:this.ISERROR(r)?r:0},t.NA=function(){return n.na},t.SHEET=function(){throw Error("SHEET is not implemented")},t.SHEETS=function(){throw Error("SHEETS is not implemented")},t.TYPE=function(r){return this.ISNUMBER(r)?1:this.ISTEXT(r)?2:this.ISLOGICAL(r)?4:this.ISERROR(r)?16:Array.isArray(r)?64:void 0}},function(r,t,e){function n(r){return 1===new Date(r,1,29).getMonth()}function a(r,t){return Math.ceil((t-r)/1e3/60/60/24)}function u(r){var t=r>-22038912e5?2:1;return Math.ceil((r-s)/864e5)+t}var i=e(0),o=e(1),s=new Date(Date.UTC(1900,0,1)),l=[undefined,0,1,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,1,2,3,4,5,6,0],f=[[],[1,2,3,4,5,6,7],[7,1,2,3,4,5,6],[6,0,1,2,3,4,5],[],[],[],[],[],[],[],[7,1,2,3,4,5,6],[6,7,1,2,3,4,5],[5,6,7,1,2,3,4],[4,5,6,7,1,2,3],[3,4,5,6,7,1,2],[2,3,4,5,6,7,1],[1,2,3,4,5,6,7]],c=[[],[6,0],[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],undefined,undefined,undefined,[0,0],[1,1],[2,2],[3,3],[4,4],[5,5],[6,6]];t.DATE=function(r,t,e){return r=o.parseNumber(r),t=o.parseNumber(t),e=o.parseNumber(e),o.anyIsError(r,t,e)?i.value:0>r||0>t||0>e?i.num:new Date(r,t-1,e)},t.DATEVALUE=function(r){var t,e=2;return"string"!=typeof r?i.value:(t=Date.parse(r),isNaN(t)?i.value:(t>-22038912e5||(e=1),Math.ceil((t-s)/864e5)+e))},t.DAY=function(r){var t=o.parseDate(r);return t instanceof Error?t:t.getDate()},t.DAYS=function(r,t){return r=o.parseDate(r),t=o.parseDate(t),r instanceof Error?r:t instanceof Error?t:u(r)-u(t)},t.DAYS360=function(r,t,e){if(e=o.parseBool(e),r=o.parseDate(r),t=o.parseDate(t),r instanceof Error)return r;if(t instanceof Error)return t;if(e instanceof Error)return e;var n,a,u=r.getMonth(),i=t.getMonth();if(e)n=31===r.getDate()?30:r.getDate(),a=31===t.getDate()?30:t.getDate();else{var s=new Date(r.getFullYear(),u+1,0).getDate(),l=new Date(t.getFullYear(),i+1,0).getDate();n=r.getDate()===s?30:r.getDate(),t.getDate()===l?30>n?(i++,a=1):a=30:a=t.getDate()}return 360*(t.getFullYear()-r.getFullYear())+30*(i-u)+(a-n)},t.EDATE=function(r,t){return(r=o.parseDate(r))instanceof Error?r:isNaN(t)?i.value:(t=parseInt(t,10),r.setMonth(r.getMonth()+t),u(r))},t.EOMONTH=function(r,t){return(r=o.parseDate(r))instanceof Error?r:isNaN(t)?i.value:(t=parseInt(t,10),u(new Date(r.getFullYear(),r.getMonth()+t+1,0)))},t.HOUR=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getHours()},t.INTERVAL=function(r){if("number"!=typeof r&&"string"!=typeof r)return i.value;r=parseInt(r,10);var t=Math.floor(r/94608e4);r%=94608e4;var e=Math.floor(r/2592e3);r%=2592e3;var n=Math.floor(r/86400);r%=86400;var a=Math.floor(r/3600);r%=3600;var u=Math.floor(r/60);r%=60;var o=r;return t=t>0?t+"Y":"",e=e>0?e+"M":"",n=n>0?n+"D":"",a=a>0?a+"H":"",u=u>0?u+"M":"",o=o>0?o+"S":"","P"+t+e+n+"T"+a+u+o},t.ISOWEEKNUM=function(r){if((r=o.parseDate(r))instanceof Error)return r;r.setHours(0,0,0),r.setDate(r.getDate()+4-(r.getDay()||7));var t=new Date(r.getFullYear(),0,1);return Math.ceil(((r-t)/864e5+1)/7)},t.MINUTE=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getMinutes()},t.MONTH=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getMonth()+1},t.NETWORKDAYS=function(r,t,e){return this.NETWORKDAYS.INTL(r,t,1,e)},t.NETWORKDAYS.INTL=function(r,t,e,n){if((r=o.parseDate(r))instanceof Error)return r;if((t=o.parseDate(t))instanceof Error)return t;if(!((e=e===undefined?c[1]:c[e])instanceof Array))return i.value;n===undefined?n=[]:n instanceof Array||(n=[n]);for(var a=0;n.length>a;a++){var u=o.parseDate(n[a]);if(u instanceof Error)return u;n[a]=u}var s=(t-r)/864e5+1,l=s,f=r;for(a=0;s>a;a++){var p=(new Date).getTimezoneOffset()>0?f.getUTCDay():f.getDay(),h=!1;p!==e[0]&&p!==e[1]||(h=!0);for(var m=0;n.length>m;m++){var E=n[m];if(E.getDate()===f.getDate()&&E.getMonth()===f.getMonth()&&E.getFullYear()===f.getFullYear()){h=!0;break}}h&&l--,f.setDate(f.getDate()+1)}return l},t.NOW=function(){return new Date},t.SECOND=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getSeconds()},t.TIME=function(r,t,e){return r=o.parseNumber(r),t=o.parseNumber(t),e=o.parseNumber(e),o.anyIsError(r,t,e)?i.value:0>r||0>t||0>e?i.num:(3600*r+60*t+e)/86400},t.TIMEVALUE=function(r){return r=o.parseDate(r),r instanceof Error?r:(3600*r.getHours()+60*r.getMinutes()+r.getSeconds())/86400},t.TODAY=function(){return new Date},t.WEEKDAY=function(r,t){if((r=o.parseDate(r))instanceof Error)return r;t===undefined&&(t=1);var e=r.getDay();return f[t][e]},t.WEEKNUM=function(r,t){if((r=o.parseDate(r))instanceof Error)return r;if(t===undefined&&(t=1),21===t)return this.ISOWEEKNUM(r);var e=l[t],n=new Date(r.getFullYear(),0,1),a=n.getDay()t)return i.num;if(!((e=e===undefined?c[1]:c[e])instanceof Array))return i.value;n===undefined?n=[]:n instanceof Array||(n=[n]);for(var a=0;n.length>a;a++){var u=o.parseDate(n[a]);if(u instanceof Error)return u;n[a]=u}for(var s=0;t>s;){r.setDate(r.getDate()+1);var l=r.getDay();if(l!==e[0]&&l!==e[1]){for(var f=0;n.length>f;f++){var p=n[f];if(p.getDate()===r.getDate()&&p.getMonth()===r.getMonth()&&p.getFullYear()===r.getFullYear()){s--;break}}s++}}return r},t.YEAR=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getFullYear()},t.YEARFRAC=function(r,t,e){if((r=o.parseDate(r))instanceof Error)return r;if((t=o.parseDate(t))instanceof Error)return t;e=e||0;var u=r.getDate(),i=r.getMonth()+1,s=r.getFullYear(),l=t.getDate(),f=t.getMonth()+1,c=t.getFullYear();switch(e){case 0:return 31===u&&31===l?(u=30,l=30):31===u?u=30:30===u&&31===l&&(l=30),(l+30*f+360*c-(u+30*i+360*s))/360;case 1:var p=365;if(s===c||s+1===c&&(i>f||i===f&&u>=l))return(s===c&&n(s)||function(r,t){var e=r.getFullYear(),a=new Date(e,2,1);if(n(e)&&a>r&&t>=a)return!0;var u=t.getFullYear(),i=new Date(u,2,1);return n(u)&&t>=i&&i>r}(r,t)||1===f&&29===l)&&(p=366),a(r,t)/p;var h=c-s+1,m=(new Date(c+1,0,1)-new Date(s,0,1))/1e3/60/60/24,E=m/h;return a(r,t)/E;case 2:return a(r,t)/360;case 3:return a(r,t)/365;case 4:return(l+30*f+360*c-(u+30*i+360*s))/360}}},function(t,e,n){!function(r,e){t.exports=e()}(0,function(){var t=function(r,t){function e(t,e){var n=t>e?t:e;return r.pow(10,17-~~(r.log(n>0?n:-n)*r.LOG10E))}function n(r){return"[object Function]"===h.call(r)}function a(r){return"number"==typeof r&&r===r}function u(r){return c.apply([],r)}function o(){return new o._init(arguments)}function s(){return 0}function l(){return 1}function f(r,t){return r===t?1:0}var c=Array.prototype.concat,p=Array.prototype.slice,h=Object.prototype.toString,m=Array.isArray||function(r){return"[object Array]"===h.call(r)};o.fn=o.prototype,o._init=function(r){var t;if(m(r[0]))if(m(r[0][0])){n(r[1])&&(r[0]=o.map(r[0],r[1]));for(var t=0;r[0].length>t;t++)this[t]=r[0][t];this.length=r[0].length}else this[0]=n(r[1])?o.map(r[0],r[1]):r[0],this.length=1;else if(a(r[0]))this[0]=o.seq.apply(null,r),this.length=1;else{if(r[0]instanceof o)return o(r[0].toArray());this[0]=[],this.length=1}return this},o._init.prototype=o.prototype,o._init.constructor=o,o.utils={calcRdx:e,isArray:m,isFunction:n,isNumber:a,toVector:u},o.extend=function(r){var t,e;if(1===arguments.length){for(e in r)o[e]=r[e];return this}for(var t=1;arguments.length>t;t++)for(e in arguments[t])r[e]=arguments[t][e];return r},o.rows=function(r){return r.length||1},o.cols=function(r){return r[0].length||1},o.dimensions=function(r){return{rows:o.rows(r),cols:o.cols(r)}},o.row=function(r,t){return m(t)?t.map(function(t){return o.row(r,t)}):r[t]},o.rowa=function(r,t){return o.row(r,t)},o.col=function(r,t){if(m(t)){var e=o.arange(r.length).map(function(r){return Array(t.length)});return t.forEach(function(t,n){o.arange(r.length).forEach(function(a){e[a][n]=r[a][t]})}),e}for(var n=Array(r.length),a=0;r.length>a;a++)n[a]=[r[a][t]];return n},o.cola=function(r,t){return o.col(r,t).map(function(r){return r[0]})},o.diag=function(r){for(var t=o.rows(r),e=Array(t),n=0;t>n;n++)e[n]=[r[n][n]];return e},o.antidiag=function(r){for(var t=o.rows(r)-1,e=Array(t),n=0;t>=0;t--,n++)e[n]=[r[n][t]];return e},o.transpose=function(r){var t,e,n,a,u,i=[];m(r[0])||(r=[r]),e=r.length,n=r[0].length;for(var u=0;n>u;u++){for(t=Array(e),a=0;e>a;a++)t[a]=r[a][u];i.push(t)}return 1===i.length?i[0]:i},o.map=function(r,t,e){var n,a,u,i,o;for(m(r[0])||(r=[r]),a=r.length,u=r[0].length,i=e?r:Array(a),n=0;a>n;n++)for(i[n]||(i[n]=Array(u)),o=0;u>o;o++)i[n][o]=t(r[n][o],n,o);return 1===i.length?i[0]:i},o.cumreduce=function(r,t,e){var n,a,u,i,o;for(m(r[0])||(r=[r]),a=r.length,u=r[0].length,i=e?r:Array(a),n=0;a>n;n++)for(i[n]||(i[n]=Array(u)),u>0&&(i[n][0]=r[n][0]),o=1;u>o;o++)i[n][o]=t(i[n][o-1],r[n][o]);return 1===i.length?i[0]:i},o.alter=function(r,t){return o.map(r,t,!0)},o.create=function(r,t,e){var a,u,i=Array(r);n(t)&&(e=t,t=r);for(var a=0;r>a;a++)for(i[a]=Array(t),u=0;t>u;u++)i[a][u]=e(a,u);return i},o.zeros=function(r,t){return a(t)||(t=r),o.create(r,t,s)},o.ones=function(r,t){return a(t)||(t=r),o.create(r,t,l)},o.rand=function(t,e){return a(e)||(e=t),o.create(t,e,r.random)},o.identity=function(r,t){return a(t)||(t=r),o.create(r,t,f)},o.symmetric=function(r){var t,e,n=r.length;if(r.length!==r[0].length)return!1;for(t=0;n>t;t++)for(e=0;n>e;e++)if(r[e][t]!==r[t][e])return!1;return!0},o.clear=function(r){return o.alter(r,s)},o.seq=function(r,t,a,u){n(u)||(u=!1);var i,o=[],s=e(r,t),l=(t*s-r*s)/((a-1)*s),f=r;for(i=0;t>=f&&a>i;i++,f=(r*s+l*s*i)/s)o.push(u?u(f,i):f);return o},o.arange=function(r,e,n){var a=[];if(n=n||1,e===t&&(e=r,r=0),r===e||0===n)return[];if(e>r&&0>n)return[];if(r>e&&n>0)return[];if(n>0)for(i=r;ie;i+=n)a.push(i);return a},o.slice=function(){function r(r,e,n,a){var u,i=[],s=r.length;if(e===t&&n===t&&a===t)return o.copy(r);if(e=e||0,n=n||r.length,e=0>e?s+e:e,n=0>n?s+n:n,a=a||1,e===n||0===a)return[];if(n>e&&0>a)return[];if(e>n&&a>0)return[];if(a>0)for(u=e;n>u;u+=a)i.push(r[u]);else for(u=e;u>n;u+=a)i.push(r[u]);return i}function e(t,e){if(e=e||{},a(e.row)){if(a(e.col))return t[e.row][e.col];var n=o.rowa(t,e.row),u=e.col||{};return r(n,u.start,u.end,u.step)}if(a(e.col)){var i=o.cola(t,e.col),s=e.row||{};return r(i,s.start,s.end,s.step)}var s=e.row||{},u=e.col||{};return r(t,s.start,s.end,s.step).map(function(t){return r(t,u.start,u.end,u.step)})}return e}(),o.sliceAssign=function(e,n,u){if(a(n.row)){if(a(n.col))return e[n.row][n.col]=u;n.col=n.col||{},n.col.start=n.col.start||0,n.col.end=n.col.end||e[0].length,n.col.step=n.col.step||1;var i=o.arange(n.col.start,r.min(e.length,n.col.end),n.col.step),s=n.row;return i.forEach(function(r,t){e[s][r]=u[t]}),e}if(a(n.col)){n.row=n.row||{},n.row.start=n.row.start||0,n.row.end=n.row.end||e.length,n.row.step=n.row.step||1;var l=o.arange(n.row.start,r.min(e[0].length,n.row.end),n.row.step),f=n.col;return l.forEach(function(r,t){e[r][f]=u[t]}),e}u[0].length===t&&(u=[u]),n.row.start=n.row.start||0,n.row.end=n.row.end||e.length,n.row.step=n.row.step||1,n.col.start=n.col.start||0,n.col.end=n.col.end||e[0].length,n.col.step=n.col.step||1;var l=o.arange(n.row.start,r.min(e.length,n.row.end),n.row.step),i=o.arange(n.col.start,r.min(e[0].length,n.col.end),n.col.step);return l.forEach(function(r,t){i.forEach(function(n,a){e[r][n]=u[t][a]})}),e},o.diagonal=function(r){var t=o.zeros(r.length,r.length);return r.forEach(function(r,e){t[e][e]=r}),t},o.copy=function(r){return r.map(function(r){return a(r)?r:r.map(function(r){return r})})};var E=o.prototype;return E.length=0,E.push=Array.prototype.push,E.sort=Array.prototype.sort,E.splice=Array.prototype.splice,E.slice=Array.prototype.slice,E.toArray=function(){return this.length>1?p.call(this):p.call(this)[0]},E.map=function(r,t){return o(o.map(this,r,t))},E.cumreduce=function(r,t){return o(o.cumreduce(this,r,t))},E.alter=function(r){return o.alter(this,r),this},function(r){for(var t=0;r.length>t;t++)!function(r){E[r]=function(t){var e,n=this;return t?(setTimeout(function(){t.call(n,E[r].call(n))}),this):(e=o[r](this),m(e)?o(e):e)}}(r[t])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(r){for(var t=0;r.length>t;t++)!function(r){E[r]=function(t,e){var n=this;return e?(setTimeout(function(){e.call(n,E[r].call(n,t))}),this):o(o[r](this,t))}}(r[t])}("row col".split(" ")),function(r){for(var t=0;r.length>t;t++)!function(r){E[r]=Function("return jStat(jStat."+r+".apply(null, arguments));")}(r[t])}("create zeros ones rand identity".split(" ")),o}(Math);return function(r,t){function e(r,t){return r-t}function n(r,e,n){return t.max(e,t.min(r,n))}var a=r.utils.isFunction;r.sum=function(r){for(var t=0,e=r.length;--e>=0;)t+=r[e];return t},r.sumsqrd=function(r){for(var t=0,e=r.length;--e>=0;)t+=r[e]*r[e];return t},r.sumsqerr=function(t){for(var e,n=r.mean(t),a=0,u=t.length;--u>=0;)e=t[u]-n,a+=e*e;return a},r.sumrow=function(r){for(var t=0,e=r.length;--e>=0;)t+=r[e];return t},r.product=function(r){for(var t=1,e=r.length;--e>=0;)t*=r[e];return t},r.min=function(r){for(var t=r[0],e=0;++er[e]&&(t=r[e]);return t},r.max=function(r){for(var t=r[0],e=0;++et&&(t=r[e]);return t},r.unique=function(r){for(var t={},e=[],n=0;r.length>n;n++)t[r[n]]||(t[r[n]]=!0,e.push(r[n]));return e},r.mean=function(t){return r.sum(t)/t.length},r.meansqerr=function(t){return r.sumsqerr(t)/t.length},r.geomean=function(e){return t.pow(r.product(e),1/e.length)},r.median=function(r){var t=r.length,n=r.slice().sort(e);return 1&t?n[t/2|0]:(n[t/2-1]+n[t/2])/2},r.cumsum=function(t){return r.cumreduce(t,function(r,t){return r+t})},r.cumprod=function(t){return r.cumreduce(t,function(r,t){return r*t})},r.diff=function(r){for(var t,e=[],n=r.length,t=1;n>t;t++)e.push(r[t]-r[t-1]);return e},r.rank=function(r){for(var t=r.length,n=r.slice().sort(e),a=Array(t),u=0;t>u;u++){var i=n.indexOf(r[u]),o=n.lastIndexOf(r[u]);if(i===o)var s=i;else var s=(i+o)/2;a[u]=s+1}return a},r.mode=function(r){for(var t,n=r.length,a=r.slice().sort(e),u=1,i=0,o=0,s=[],t=0;n>t;t++)a[t]===a[t+1]?u++:(u>i?(s=[a[t]],i=u,o=0):u===i&&(s.push(a[t]),o++),u=1);return 0===o?s[0]:s},r.range=function(t){return r.max(t)-r.min(t)},r.variance=function(t,e){return r.sumsqerr(t)/(t.length-(e?1:0))},r.pooledvariance=function(t){return t.reduce(function(t,e){return t+r.sumsqerr(e)},0)/(t.reduce(function(r,t){return r+t.length},0)-t.length)},r.deviation=function(t){for(var e=r.mean(t),n=t.length,a=Array(n),u=0;n>u;u++)a[u]=t[u]-e;return a},r.stdev=function(e,n){return t.sqrt(r.variance(e,n))},r.pooledstdev=function(e){return t.sqrt(r.pooledvariance(e))},r.meandev=function(e){for(var n=r.mean(e),a=[],u=e.length-1;u>=0;u--)a.push(t.abs(e[u]-n));return r.mean(a)},r.meddev=function(e){for(var n=r.median(e),a=[],u=e.length-1;u>=0;u--)a.push(t.abs(e[u]-n));return r.median(a)},r.coeffvar=function(t){return r.stdev(t)/r.mean(t)},r.quartiles=function(r){var n=r.length,a=r.slice().sort(e);return[a[t.round(n/4)-1],a[t.round(n/2)-1],a[t.round(3*n/4)-1]]},r.quantiles=function(r,a,u,i){var o,s,l,f,c,p,h=r.slice().sort(e),m=[a.length],E=r.length;void 0===u&&(u=3/8),void 0===i&&(i=3/8);for(var o=0;a.length>o;o++)s=a[o],l=u+s*(1-u-i),f=E*s+l,c=t.floor(n(f,1,E-1)),p=n(f-c,0,1),m[o]=(1-p)*h[c-1]+p*h[c];return m},r.percentile=function(r,t){var n=r.slice().sort(e),a=t*(n.length-1),u=parseInt(a),i=a-u;return n.length>u+1?n[u]*(1-i)+n[u+1]*i:n[u]},r.percentileOfScore=function(r,t,e){var n,a,u=0,i=r.length,o=!1;"strict"===e&&(o=!0);for(var a=0;i>a;a++)n=r[a],(o&&t>n||!o&&t>=n)&&u++;return u/i},r.histogram=function(e,n){for(var a,u=r.min(e),i=n||4,o=(r.max(e)-u)/i,s=e.length,n=[],a=0;i>a;a++)n[a]=0;for(var a=0;s>a;a++)n[t.min(t.floor((e[a]-u)/o),i-1)]+=1;return n},r.covariance=function(t,e){for(var n,a=r.mean(t),u=r.mean(e),i=t.length,o=Array(i),n=0;i>n;n++)o[n]=(t[n]-a)*(e[n]-u);return r.sum(o)/(i-1)},r.corrcoeff=function(t,e){return r.covariance(t,e)/r.stdev(t,1)/r.stdev(e,1)},r.spearmancoeff=function(t,e){return t=r.rank(t),e=r.rank(e),r.corrcoeff(t,e)},r.stanMoment=function(e,n){for(var a=r.mean(e),u=r.stdev(e),i=e.length,o=0,s=0;i>s;s++)o+=t.pow((e[s]-a)/u,n);return o/e.length},r.skewness=function(t){return r.stanMoment(t,3)},r.kurtosis=function(t){return r.stanMoment(t,4)-3};var u=r.prototype;!function(t){for(var e=0;t.length>e;e++)!function(t){u[t]=function(e,n){var i=[],o=0,s=this;if(a(e)&&(n=e,e=!1),n)return setTimeout(function(){n.call(s,u[t].call(s,e))}),this;if(this.length>1){for(s=!0===e?this:this.transpose();s.length>o;o++)i[o]=r[t](s[o]);return i}return r[t](this[0],e)}}(t[e])}("cumsum cumprod".split(" ")),function(t){for(var e=0;t.length>e;e++)!function(t){u[t]=function(e,n){var i=[],o=0,s=this;if(a(e)&&(n=e,e=!1),n)return setTimeout(function(){n.call(s,u[t].call(s,e))}),this;if(this.length>1){for("sumrow"!==t&&(s=!0===e?this:this.transpose());s.length>o;o++)i[o]=r[t](s[o]);return!0===e?r[t](r.utils.toVector(i)):i}return r[t](this[0],e)}}(t[e])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(t){for(var e=0;t.length>e;e++)!function(t){u[t]=function(){var e=[],n=0,i=this,o=Array.prototype.slice.call(arguments);if(a(o[o.length-1])){var s=o[o.length-1],l=o.slice(0,o.length-1);return setTimeout(function(){s.call(i,u[t].apply(i,l))}),this}var s=undefined,f=function(e){return r[t].apply(i,[e].concat(o))};if(this.length>1){for(i=i.transpose();i.length>n;n++)e[n]=f(i[n]);return e}return f(this[0])}}(t[e])}("quantiles percentileOfScore".split(" "))}(t,Math),function(r,t){r.gammaln=function(r){var e,n,a,u=0,i=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],o=1.000000000190015;for(a=(n=e=r)+5.5,a-=(e+.5)*t.log(a);6>u;u++)o+=i[u]/++n;return t.log(2.5066282746310007*o/e)-a},r.gammafn=function(r){var e,n,a,u,i=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],o=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],s=!1,l=0,f=0,c=0,p=r;if(0>=p){if(!(u=p%1+3.6e-16))return Infinity;s=(1&p?-1:1)*t.PI/t.sin(t.PI*u),p=1-p}a=p,n=1>p?p++:(p-=l=(0|p)-1)-1;for(var e=0;8>e;++e)c=(c+i[e])*n,f=f*n+o[e];if(u=c/f+1,p>a)u/=a;else if(a>p)for(var e=0;l>e;++e)u*=p,p++;return s&&(u=s/u),u},r.gammap=function(t,e){return r.lowRegGamma(t,e)*r.gammafn(t)},r.lowRegGamma=function(e,n){var a,u=r.gammaln(e),i=e,o=1/e,s=o,l=n+1-e,f=1/1e-30,c=1/l,p=c,h=1,m=-~(8.5*t.log(1>e?1/e:e)+.4*e+17);if(0>n||0>=e)return NaN;if(e+1>n){for(;m>=h;h++)o+=s*=n/++i;return o*t.exp(-n+e*t.log(n)-u)}for(;m>=h;h++)a=-h*(h-e),l+=2,c=a*c+l,f=l+a/f,c=1/c,p*=c*f;return 1-p*t.exp(-n+e*t.log(n)-u)},r.factorialln=function(t){return 0>t?NaN:r.gammaln(t+1)},r.factorial=function(t){return 0>t?NaN:r.gammafn(t+1)},r.combination=function(e,n){return e>170||n>170?t.exp(r.combinationln(e,n)):r.factorial(e)/r.factorial(n)/r.factorial(e-n)},r.combinationln=function(t,e){return r.factorialln(t)-r.factorialln(e)-r.factorialln(t-e)},r.permutation=function(t,e){return r.factorial(t)/r.factorial(t-e)},r.betafn=function(e,n){return e>0&&n>0?e+n>170?t.exp(r.betaln(e,n)):r.gammafn(e)*r.gammafn(n)/r.gammafn(e+n):undefined},r.betaln=function(t,e){return r.gammaln(t)+r.gammaln(e)-r.gammaln(t+e)},r.betacf=function(r,e,n){var a,u,i,o,s=1,l=e+n,f=e+1,c=e-1,p=1,h=1-l*r/f;for(1e-30>t.abs(h)&&(h=1e-30),h=1/h,o=h;100>=s&&(a=2*s,u=s*(n-s)*r/((c+a)*(e+a)),h=1+u*h,1e-30>t.abs(h)&&(h=1e-30),p=1+u/p,1e-30>t.abs(p)&&(p=1e-30),h=1/h,o*=h*p,u=-(e+s)*(l+s)*r/((e+a)*(f+a)),h=1+u*h,1e-30>t.abs(h)&&(h=1e-30),p=1+u/p,1e-30>t.abs(p)&&(p=1e-30),h=1/h,i=h*p,o*=i,3e-7<=t.abs(i-1));s++);return o},r.gammapinv=function(e,n){var a,u,i,o,s,l,f,c=0,p=n-1,h=r.gammaln(n);if(e>=1)return t.max(100,n+100*t.sqrt(n));if(0>=e)return 0;for(n>1?(l=t.log(p),f=t.exp(p*(l-1)-h),s=.5>e?e:1-e,i=t.sqrt(-2*t.log(s)),a=(2.30753+.27061*i)/(1+i*(.99229+.04481*i))-i,.5>e&&(a=-a),a=t.max(.001,n*t.pow(1-1/(9*n)-a/(3*t.sqrt(n)),3))):(i=1-n*(.253+.12*n),a=i>e?t.pow(e/i,1/n):1-t.log(1-(e-i)/(1-i)));12>c;c++){if(0>=a)return 0;if(u=r.lowRegGamma(n,a)-e,i=n>1?f*t.exp(-(a-p)+p*(t.log(a)-l)):t.exp(-a+p*t.log(a)-h),o=u/i,a-=i=o/(1-.5*t.min(1,o*((n-1)/a-1))),a>0||(a=.5*(a+i)),t.abs(i)<1e-8*a)break}return a},r.erf=function(r){var e,n,a,u,i=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,9.6467911e-11,2.394038e-12,-6.886027e-12,8.94487e-13,3.13092e-13,-1.12708e-13,3.81e-16,7.106e-15,-1.523e-15,-9.4e-17,1.21e-16,-2.8e-17],o=27,s=!1,l=0,f=0;for(0>r&&(r=-r,s=!0),e=2/(2+r),n=4*e-2;o>0;o--)a=l,l=n*l-f+i[o],f=a;return u=e*t.exp(-r*r+.5*(i[0]+n*l)-f),s?u-1:1-u},r.erfc=function(t){return 1-r.erf(t)},r.erfcinv=function(e){var n,a,u,i,o=0;if(e>=2)return-100;if(0>=e)return 100;for(i=1>e?e:2-e,u=t.sqrt(-2*t.log(i/2)),n=-.70711*((2.30753+.27061*u)/(1+u*(.99229+.04481*u))-u);2>o;o++)a=r.erfc(n)-i,n+=a/(1.1283791670955126*t.exp(-n*n)-n*a);return 1>e?n:-n},r.ibetainv=function(e,n,a){var u,i,o,s,l,f,c,p,h,m,E,g=n-1,N=a-1,v=0;if(0>=e)return 0;if(e>=1)return 1;for(1>n||1>a?(u=t.log(n/(n+a)),i=t.log(a/(n+a)),s=t.exp(n*u)/n,l=t.exp(a*i)/a,m=s+l,c=s/m>e?t.pow(n*m*e,1/n):1-t.pow(a*m*(1-e),1/a)):(o=.5>e?e:1-e,s=t.sqrt(-2*t.log(o)),c=(2.30753+.27061*s)/(1+s*(.99229+.04481*s))-s,.5>e&&(c=-c),p=(c*c-3)/6,h=2/(1/(2*n-1)+1/(2*a-1)),m=c*t.sqrt(p+h)/h-(1/(2*a-1)-1/(2*n-1))*(p+5/6-2/(3*h)),c=n/(n+a*t.exp(2*m))),E=-r.gammaln(n)-r.gammaln(a)+r.gammaln(n+a);10>v;v++){if(0===c||1===c)return c;if(f=r.ibeta(c,n,a)-e,s=t.exp(g*t.log(c)+N*t.log(1-c)+E),l=f/s,c-=s=l/(1-.5*t.min(1,l*(g/c-N/(1-c)))),c>0||(c=.5*(c+s)),1>c||(c=.5*(c+s+1)),t.abs(s)<1e-8*c&&v>0)break}return c},r.ibeta=function(e,n,a){var u=0===e||1===e?0:t.exp(r.gammaln(n+a)-r.gammaln(n)-r.gammaln(a)+n*t.log(e)+a*t.log(1-e));return e>=0&&1>=e&&((n+1)/(n+a+2)>e?u*r.betacf(e,n,a)/n:1-u*r.betacf(1-e,a,n)/a)},r.randn=function(e,n){var a,u,i,o,s;if(n||(n=e),e)return r.create(e,n,function(){return r.randn()});do{a=t.random(),u=1.7156*(t.random()-.5),i=a-.449871,o=t.abs(u)+.386595,s=i*i+o*(.196*o-.25472*i)}while(s>.27597&&(s>.27846||u*u>-4*t.log(a)*a*a));return u/a},r.randg=function(e,n,a){var u,i,o,s,l,f,c=e;if(a||(a=n),e||(e=1),n)return f=r.zeros(n,a),f.alter(function(){return r.randg(e)}),f;1>e&&(e+=1),u=e-1/3,i=1/t.sqrt(9*u);do{do{l=r.randn(),s=1+i*l}while(0>=s);s*=s*s,o=t.random()}while(o>1-.331*t.pow(l,4)&&t.log(o)>.5*l*l+u*(1-s+t.log(s)));if(e==c)return u*s;do{o=t.random()}while(0===o);return t.pow(o,1/c)*u*s},function(t){for(var e=0;t.length>e;e++)!function(t){r.fn[t]=function(){return r(r.map(this,function(e){return r[t](e)}))}}(t[e])}("gammaln gammafn factorial factorialln".split(" ")),function(t){for(var e=0;t.length>e;e++)!function(t){r.fn[t]=function(){return r(r[t].apply(null,arguments))}}(t[e])}("randn".split(" "))}(t,Math),function(r,t){function e(r){return r/t.abs(r)}function n(e,n,a){var u=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],i=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],o=.5*e;if(o>=8)return 1;var s=2*r.normal.cdf(o,0,1,1,0)-1;s=s3?2:3;for(var f=o,c=(8-o)/l,p=f+c,h=0,m=a-1,E=1;l>=E;E++){for(var g=0,N=.5*(p+f),v=.5*(p-f),d=1;12>=d;d++){var I,b;d>6?(I=12-d+1,b=u[I-1]):(I=d,b=-u[I-1]);var y=v*b,M=N+y,A=M*M;if(A>60)break;var R=2*r.normal.cdf(M,0,1,1,0),S=2*r.normal.cdf(M,e,1,1,0),T=.5*R-.5*S;Tt.exp(-30/n)?(s=t.pow(s,n),1>s?s:1):0}function a(r,e,n){var a=.5-.5*r,u=t.sqrt(t.log(1/(a*a))),i=u+((((-453642210148e-16*u-.204231210125)*u-.342242088547)*u-1)*u+.322232421088)/((((.0038560700634*u+.10353775285)*u+.531103462366)*u+.588581570495)*u+.099348462606);120>n&&(i+=(i*i*i+i)/n/4);var o=.8832-.2368*i;return 120>n&&(o+=-1.214/n+1.208*i/n),i*(o*t.log(e-1)+1.4142)}!function(t){for(var e=0;t.length>e;e++)!function(t){r[t]=function(r,t,e){return this instanceof arguments.callee?(this._a=r,this._b=t,this._c=e,this):new arguments.callee(r,t,e)},r.fn[t]=function(e,n,a){var u=r[t](e,n,a);return u.data=this,u},r[t].prototype.sample=function(e){var n=this._a,a=this._b,u=this._c;return e?r.alter(e,function(){return r[t].sample(n,a,u)}):r[t].sample(n,a,u)},function(e){for(var n=0;e.length>n;n++)!function(e){r[t].prototype[e]=function(n){var a=this._a,u=this._b,i=this._c;return n||0===n||(n=this.data),"number"!=typeof n?r.fn.map.call(n,function(n){return r[t][e](n,a,u,i)}):r[t][e](n,a,u,i)}}(e[n])}("pdf cdf inv".split(" ")),function(e){for(var n=0;e.length>n;n++)!function(e){r[t].prototype[e]=function(){return r[t][e](this._a,this._b,this._c)}}(e[n])}("mean median mode variance".split(" "))}(t[e])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),r.extend(r.beta,{pdf:function(e,n,a){return e>1||0>e?0:1==n&&1==a?1:512>n&&512>a?t.pow(e,n-1)*t.pow(1-e,a-1)/r.betafn(n,a):t.exp((n-1)*t.log(e)+(a-1)*t.log(1-e)-r.betaln(n,a))},cdf:function(t,e,n){return t>1||0>t?1*(t>1):r.ibeta(t,e,n)},inv:function(t,e,n){return r.ibetainv(t,e,n)},mean:function(r,t){return r/(r+t)},median:function(t,e){return r.ibetainv(.5,t,e)},mode:function(r,t){return(r-1)/(r+t-2)},sample:function(t,e){var n=r.randg(t);return n/(n+r.randg(e))},variance:function(r,e){return r*e/(t.pow(r+e,2)*(r+e+1))}}),r.extend(r.centralF,{pdf:function(e,n,a){var u,i;return 0>e?0:n>2?(u=n*e/(a+e*n),i=a/(a+e*n),n*i/2*r.binomial.pdf((n-2)/2,(n+a-2)/2,u)):0===e&&2>n?Infinity:0===e&&2===n?1:1/r.betafn(n/2,a/2)*t.pow(n/a,n/2)*t.pow(e,n/2-1)*t.pow(1+n/a*e,-(n+a)/2)},cdf:function(t,e,n){return 0>t?0:r.ibeta(e*t/(e*t+n),e/2,n/2)},inv:function(t,e,n){return n/(e*(1/r.ibetainv(t,e/2,n/2)-1))},mean:function(r,t){return t>2?t/(t-2):undefined},mode:function(r,t){return r>2?t*(r-2)/(r*(t+2)):undefined},sample:function(t,e){return 2*r.randg(t/2)/t/(2*r.randg(e/2)/e)},variance:function(r,t){return t>4?2*t*t*(r+t-2)/(r*(t-2)*(t-2)*(t-4)):undefined}}),r.extend(r.cauchy,{pdf:function(r,e,n){return 0>n?0:n/(t.pow(r-e,2)+t.pow(n,2))/t.PI},cdf:function(r,e,n){return t.atan((r-e)/n)/t.PI+.5},inv:function(r,e,n){return e+n*t.tan(t.PI*(r-.5))},median:function(r,t){return r},mode:function(r,t){return r},sample:function(e,n){return r.randn()*t.sqrt(1/(2*r.randg(.5)))*n+e}}),r.extend(r.chisquare,{pdf:function(e,n){return 0>e?0:0===e&&2===n?.5:t.exp((n/2-1)*t.log(e)-e/2-n/2*t.log(2)-r.gammaln(n/2))},cdf:function(t,e){return 0>t?0:r.lowRegGamma(e/2,t/2)},inv:function(t,e){return 2*r.gammapinv(t,.5*e)},mean:function(r){return r},median:function(r){return r*t.pow(1-2/(9*r),3)},mode:function(r){return r-2>0?r-2:0},sample:function(t){return 2*r.randg(t/2)},variance:function(r){return 2*r}}),r.extend(r.exponential,{pdf:function(r,e){return 0>r?0:e*t.exp(-e*r)},cdf:function(r,e){return 0>r?0:1-t.exp(-e*r)},inv:function(r,e){return-t.log(1-r)/e},mean:function(r){return 1/r},median:function(r){return 1/r*t.log(2)},mode:function(r){return 0},sample:function(r){return-1/r*t.log(t.random())},variance:function(r){return t.pow(r,-2)}}),r.extend(r.gamma,{pdf:function(e,n,a){return 0>e?0:0===e&&1===n?1/a:t.exp((n-1)*t.log(e)-e/a-r.gammaln(n)-n*t.log(a))},cdf:function(t,e,n){return 0>t?0:r.lowRegGamma(e,t/n)},inv:function(t,e,n){return r.gammapinv(t,e)*n},mean:function(r,t){return r*t},mode:function(r,t){return r>1?(r-1)*t:undefined},sample:function(t,e){return r.randg(t)*e},variance:function(r,t){return r*t*t}}),r.extend(r.invgamma,{pdf:function(e,n,a){return e>0?t.exp(-(n+1)*t.log(e)-a/e-r.gammaln(n)+n*t.log(a)):0},cdf:function(t,e,n){return t>0?1-r.lowRegGamma(e,n/t):0},inv:function(t,e,n){return n/r.gammapinv(1-t,e)},mean:function(r,t){return r>1?t/(r-1):undefined},mode:function(r,t){return t/(r+1)},sample:function(t,e){return e/r.randg(t)},variance:function(r,t){return r>2?t*t/((r-1)*(r-1)*(r-2)):undefined}}),r.extend(r.kumaraswamy,{pdf:function(r,e,n){return 0===r&&1===e?n:1===r&&1===n?e:t.exp(t.log(e)+t.log(n)+(e-1)*t.log(r)+(n-1)*t.log(1-t.pow(r,e)))},cdf:function(r,e,n){return 0>r?0:r>1?1:1-t.pow(1-t.pow(r,e),n)},inv:function(r,e,n){return t.pow(1-t.pow(1-r,1/n),1/e)},mean:function(t,e){return e*r.gammafn(1+1/t)*r.gammafn(e)/r.gammafn(1+1/t+e)},median:function(r,e){return t.pow(1-t.pow(2,-1/e),1/r)},mode:function(r,e){return 1>r||1>e||1===r||1===e?undefined:t.pow((r-1)/(r*e-1),1/r)},variance:function(r,t){throw Error("variance not yet implemented")}}),r.extend(r.lognormal,{pdf:function(r,e,n){return r>0?t.exp(-t.log(r)-.5*t.log(2*t.PI)-t.log(n)-t.pow(t.log(r)-e,2)/(2*n*n)):0},cdf:function(e,n,a){return 0>e?0:.5+.5*r.erf((t.log(e)-n)/t.sqrt(2*a*a))},inv:function(e,n,a){return t.exp(-1.4142135623730951*a*r.erfcinv(2*e)+n)},mean:function(r,e){return t.exp(r+e*e/2)},median:function(r,e){return t.exp(r)},mode:function(r,e){return t.exp(r-e*e)},sample:function(e,n){return t.exp(r.randn()*n+e)},variance:function(r,e){return(t.exp(e*e)-1)*t.exp(2*r+e*e)}}),r.extend(r.noncentralt,{pdf:function(e,n,a){return 1e-14>t.abs(a)?r.studentt.pdf(e,n):1e-14>t.abs(e)?t.exp(r.gammaln((n+1)/2)-a*a/2-.5*t.log(t.PI*n)-r.gammaln(n/2)):n/e*(r.noncentralt.cdf(e*t.sqrt(1+2/n),n+2,a)-r.noncentralt.cdf(e,n,a))},cdf:function(e,n,a){if(1e-14>t.abs(a))return r.studentt.cdf(e,n);var u=!1;0>e&&(u=!0,a=-a);for(var i=r.normal.cdf(-a,0,1),o=1e-14+1,s=o,l=e*e/(e*e+n),f=0,c=t.exp(-a*a/2),p=t.exp(-a*a/2-.5*t.log(2)-r.gammaln(1.5))*a;200>f||s>1e-14||o>1e-14;)s=o,f>0&&(c*=a*a/(2*f),p*=a*a/(2*(f+.5))),o=c*r.beta.cdf(l,f+.5,n/2)+p*r.beta.cdf(l,f+1,n/2),i+=.5*o,f++;return u?1-i:i}}),r.extend(r.normal,{pdf:function(r,e,n){return t.exp(-.5*t.log(2*t.PI)-t.log(n)-t.pow(r-e,2)/(2*n*n))},cdf:function(e,n,a){return.5*(1+r.erf((e-n)/t.sqrt(2*a*a)))},inv:function(t,e,n){return-1.4142135623730951*n*r.erfcinv(2*t)+e},mean:function(r,t){return r},median:function(r,t){return r},mode:function(r,t){return r},sample:function(t,e){return r.randn()*e+t},variance:function(r,t){return t*t}}),r.extend(r.pareto,{pdf:function(r,e,n){return e>r?0:n*t.pow(e,n)/t.pow(r,n+1)},cdf:function(r,e,n){return e>r?0:1-t.pow(e/r,n)},inv:function(r,e,n){return e/t.pow(1-r,1/n)},mean:function(r,e){return e>1?e*t.pow(r,e)/(e-1):undefined},median:function(r,e){return r*(e*t.SQRT2)},mode:function(r,t){return r},variance:function(r,e){return e>2?r*r*e/(t.pow(e-1,2)*(e-2)):undefined}}),r.extend(r.studentt,{pdf:function(e,n){return n=n>1e100?1e100:n,1/(t.sqrt(n)*r.betafn(.5,n/2))*t.pow(1+e*e/n,-(n+1)/2)},cdf:function(e,n){var a=n/2;return r.ibeta((e+t.sqrt(e*e+n))/(2*t.sqrt(e*e+n)),a,a)},inv:function(e,n){var a=r.ibetainv(2*t.min(e,1-e),.5*n,.5);return a=t.sqrt(n*(1-a)/a),e>.5?a:-a},mean:function(r){return r>1?0:undefined},median:function(r){return 0},mode:function(r){return 0},sample:function(e){return r.randn()*t.sqrt(e/(2*r.randg(e/2)))},variance:function(r){return r>2?r/(r-2):r>1?Infinity:undefined}}),r.extend(r.weibull,{pdf:function(r,e,n){return 0>r||0>e||0>n?0:n/e*t.pow(r/e,n-1)*t.exp(-t.pow(r/e,n))},cdf:function(r,e,n){return 0>r?0:1-t.exp(-t.pow(r/e,n))},inv:function(r,e,n){return e*t.pow(-t.log(1-r),1/n)},mean:function(t,e){return t*r.gammafn(1+1/e)},median:function(r,e){return r*t.pow(t.log(2),1/e)},mode:function(r,e){return e>1?r*t.pow((e-1)/e,1/e):0},sample:function(r,e){return r*t.pow(-t.log(t.random()),1/e)},variance:function(e,n){return e*e*r.gammafn(1+2/n)-t.pow(r.weibull.mean(e,n),2)}}),r.extend(r.uniform,{pdf:function(r,t,e){return t>r||r>e?0:1/(e-t)},cdf:function(r,t,e){return t>r?0:e>r?(r-t)/(e-t):1},inv:function(r,t,e){return t+r*(e-t)},mean:function(r,t){return.5*(r+t)},median:function(t,e){return r.mean(t,e)},mode:function(r,t){throw Error("mode is not yet implemented")},sample:function(r,e){return r/2+e/2+(e/2-r/2)*(2*t.random()-1)},variance:function(r,e){return t.pow(e-r,2)/12}}),r.extend(r.binomial,{pdf:function(e,n,a){return 0===a||1===a?n*a===e?1:0:r.combination(n,e)*t.pow(a,e)*t.pow(1-a,n-e)},cdf:function(t,e,n){var a=[],u=0;if(0>t)return 0;if(e>t){for(;t>=u;u++)a[u]=r.binomial.pdf(u,e,n);return r.sum(a)}return 1}}),r.extend(r.negbin,{pdf:function(e,n,a){return e===e>>>0&&(0>e?0:r.combination(e+n-1,n-1)*t.pow(1-a,e)*t.pow(a,n))},cdf:function(t,e,n){var a=0,u=0;if(0>t)return 0;for(;t>=u;u++)a+=r.negbin.pdf(u,e,n);return a}}),r.extend(r.hypgeom,{pdf:function(e,n,a,u){if(e!==e|0)return!1;if(0>e||a-(n-u)>e)return 0;if(e>u||e>a)return 0;if(2*a>n)return 2*u>n?r.hypgeom.pdf(n-a-u+e,n,n-a,n-u):r.hypgeom.pdf(u-e,n,n-a,u);if(2*u>n)return r.hypgeom.pdf(a-e,n,a,n-u);if(u>a)return r.hypgeom.pdf(e,n,u,a);for(var i=1,o=0,s=0;e>s;s++){for(;i>1&&u>o;)i*=1-a/(n-o),o++;i*=(u-s)*(a-s)/((s+1)*(n-a-u+s+1))}for(;u>o;o++)i*=1-a/(n-o);return t.min(1,t.max(0,i))},cdf:function(e,n,a,u){if(0>e||a-(n-u)>e)return 0;if(u>e&&a>e){if(2*a>n)return 2*u>n?r.hypgeom.cdf(n-a-u+e,n,n-a,n-u):1-r.hypgeom.cdf(u-e-1,n,n-a,u);if(2*u>n)return 1-r.hypgeom.cdf(a-e-1,n,a,n-u);if(u>a)return r.hypgeom.cdf(e,n,u,a);for(var i=1,o=1,s=0,l=0;e>l;l++){for(;i>1&&u>s;){var f=1-a/(n-s);o*=f,i*=f,s++}o*=(u-l)*(a-l)/((l+1)*(n-a-u+l+1)),i+=o}for(;u>s;s++)i*=1-a/(n-s);return t.min(1,t.max(0,i))}return 1}}),r.extend(r.poisson,{pdf:function(e,n){return 0>n||e%1!=0||0>e?0:t.pow(n,e)*t.exp(-n)/r.factorial(e)},cdf:function(t,e){var n=[],a=0;if(0>t)return 0;for(;t>=a;a++)n.push(r.poisson.pdf(a,e));return r.sum(n)},mean:function(r){return r},variance:function(r){return r},sample:function(r){var e=1,n=0,a=t.exp(-r);do{n++,e*=t.random()}while(e>a);return n-1}}),r.extend(r.triangular,{pdf:function(r,t,e,n){return t>=e||t>n||n>e?NaN:t>r||r>e?0:n>r?2*(r-t)/((e-t)*(n-t)):r===n?2/(e-t):2*(e-r)/((e-t)*(e-n))},cdf:function(r,e,n,a){return e>=n||e>a||a>n?NaN:r>e?n>r?r>a?1-t.pow(n-r,2)/((n-e)*(n-a)):t.pow(r-e,2)/((n-e)*(a-e)):1:0},inv:function(r,e,n,a){return e>=n||e>a||a>n?NaN:r>(a-e)/(n-e)?e+(n-e)*(1-t.sqrt((1-r)*(1-(a-e)/(n-e)))):e+(n-e)*t.sqrt(r*((a-e)/(n-e)))},mean:function(r,t,e){return(r+t+e)/3},median:function(r,e,n){return n>(r+e)/2?n>(r+e)/2?r+t.sqrt((e-r)*(n-r))/t.sqrt(2):void 0:e-t.sqrt((e-r)*(e-n))/t.sqrt(2)},mode:function(r,t,e){return e},sample:function(r,e,n){var a=t.random();return(n-r)/(e-r)>a?r+t.sqrt(a*(e-r)*(n-r)):e-t.sqrt((1-a)*(e-r)*(e-n))},variance:function(r,t,e){return(r*r+t*t+e*e-r*t-r*e-t*e)/18}}),r.extend(r.arcsine,{pdf:function(r,e,n){return n>e?r>e&&n>r?2/t.PI*t.pow(t.pow(n-e,2)-t.pow(2*r-e-n,2),-.5):0:NaN},cdf:function(r,e,n){return e>r?0:n>r?2/t.PI*t.asin(t.sqrt((r-e)/(n-e))):1},inv:function(r,e,n){return e+(.5-.5*t.cos(t.PI*r))*(n-e)},mean:function(r,t){return t>r?(r+t)/2:NaN},median:function(r,t){return t>r?(r+t)/2:NaN},mode:function(r,t){throw Error("mode is not yet implemented")},sample:function(e,n){return(e+n)/2+(n-e)/2*t.sin(2*t.PI*r.uniform.sample(0,1))},variance:function(r,e){return e>r?t.pow(e-r,2)/8:NaN}}),r.extend(r.laplace,{pdf:function(r,e,n){return n>0?t.exp(-t.abs(r-e)/n)/(2*n):0},cdf:function(r,e,n){return n>0?e>r?.5*t.exp((r-e)/n):1-.5*t.exp(-(r-e)/n):0},mean:function(r,t){return r},median:function(r,t){return r},mode:function(r,t){return r},variance:function(r,t){return 2*t*t},sample:function(r,n){var a=t.random()-.5;return r-n*e(a)*t.log(1-2*t.abs(a))}}),r.extend(r.tukey,{cdf:function(e,a,u){var i=a,o=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],s=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(0>=e)return 0;if(2>u||2>i)return NaN;if(!Number.isFinite(e))return 1;if(u>25e3)return n(e,1,i);var l,f=.5*u,c=f*t.log(u)-u*t.log(2)-r.gammaln(f),p=f-1,h=.25*u;l=u>100?u>800?u>5e3?.125:.25:.5:1,c+=t.log(l);for(var m=0,E=1;50>=E;E++){for(var g=0,N=(2*E-1)*l,v=1;16>=v;v++){var d,I;v>8?(d=v-8-1,I=c+p*t.log(N+o[d]*l)-(o[d]*l+N)*h):(d=v-1,I=c+p*t.log(N-o[d]*l)+(o[d]*l-N)*h);var b;if(I>=-30){b=v>8?e*t.sqrt(.5*(o[d]*l+N)):e*t.sqrt(.5*(-o[d]*l+N));g+=n(b,1,i)*s[d]*t.exp(I)}}if(E*l>=1&&1e-14>=g)break;m+=g}if(g>1e-14)throw Error("tukey.cdf failed to converge");return m>1&&(m=1),m},inv:function(e,n,u){var i=n;if(2>u||2>i)return NaN;if(0>e||e>1)return NaN;if(0===e)return 0;if(1===e)return Infinity;var o,s=a(e,i,u),l=r.tukey.cdf(s,n,u)-e;o=l>0?t.max(0,s-1):s+1;for(var f,c=r.tukey.cdf(o,n,u)-e,p=1;50>p;p++){f=o-c*(o-s)/(c-l),l=c,s=o,0>f&&(f=0,c=-e),c=r.tukey.cdf(f,n,u)-e,o=f;if(1e-4>t.abs(o-s))return f}throw Error("tukey.inv failed to converge")}})}(t,Math),function(t,e){function n(r){return u(r)||r instanceof t}var a=Array.prototype.push,u=t.utils.isArray;t.extend({add:function(r,e){return n(e)?(n(e[0])||(e=[e]),t.map(r,function(r,t,n){return r+e[t][n]})):t.map(r,function(r){return r+e})},subtract:function(r,e){return n(e)?(n(e[0])||(e=[e]),t.map(r,function(r,t,n){return r-e[t][n]||0})):t.map(r,function(r){return r-e})},divide:function(r,e){return n(e)?(n(e[0])||(e=[e]),t.multiply(r,t.inv(e))):t.map(r,function(r){return r/e})},multiply:function(r,e){var a,u,i,o,s,l,f,c;if(r.length===undefined&&e.length===undefined)return r*e;if(s=r.length,l=r[0].length,f=t.zeros(s,i=n(e)?e[0].length:l),c=0,n(e)){for(;i>c;c++)for(a=0;s>a;a++){for(o=0,u=0;l>u;u++)o+=r[a][u]*e[u][c];f[a][c]=o}return 1===s&&1===c?f[0][0]:f}return t.map(r,function(r){return r*e})},outer:function(r,e){return t.multiply(r.map(function(r){return[r]}),[e])},dot:function(r,e){n(r[0])||(r=[r]),n(e[0])||(e=[e]);for(var a,u,i=1===r[0].length&&1!==r.length?t.transpose(r):r,o=1===e[0].length&&1!==e.length?t.transpose(e):e,s=[],l=0,f=i.length,c=i[0].length;f>l;l++){for(s[l]=[],a=0,u=0;c>u;u++)a+=i[l][u]*o[l][u];s[l]=a}return 1===s.length?s[0]:s},pow:function(r,n){return t.map(r,function(r){return e.pow(r,n)})},exp:function(r){return t.map(r,function(r){return e.exp(r)})},log:function(r){return t.map(r,function(r){return e.log(r)})},abs:function(r){return t.map(r,function(r){return e.abs(r)})},norm:function(r,t){var a=0,u=0;for(isNaN(t)&&(t=2),n(r[0])&&(r=r[0]);r.length>u;u++)a+=e.pow(e.abs(r[u]),t);return e.pow(a,1/t)},angle:function(r,n){return e.acos(t.dot(r,n)/(t.norm(r)*t.norm(n)))},aug:function(r,t){for(var e=[],n=0;r.length>n;n++)e.push(r[n].slice());for(var n=0;e.length>n;n++)a.apply(e[n],t[n]);return e},inv:function(r){for(var e,n=r.length,a=r[0].length,u=t.identity(n,a),i=t.gauss_jordan(r,u),o=[],s=0;n>s;s++)for(o[s]=[],e=a;i[0].length>e;e++)o[s][e-a]=i[s][e];return o},det:function(r){var t,e=r.length,n=2*e,a=Array(n),u=e-1,i=n-1,o=u-e+1,s=i,l=0,f=0;if(2===e)return r[0][0]*r[1][1]-r[0][1]*r[1][0];for(;n>l;l++)a[l]=1;for(var l=0;e>l;l++){for(t=0;e>t;t++)a[0>o?o+e:o]*=r[l][t],a[e>s?s+e:s]*=r[l][t],o++,s--;o=--u-e+1,s=--i}for(var l=0;e>l;l++)f+=a[l];for(;n>l;l++)f-=a[l];return f},gauss_elimination:function(r,n){var a,u,i,o,s=0,l=0,f=r.length,c=r[0].length,p=1,h=0,m=[];r=t.aug(r,n),a=r[0].length;for(var s=0;f>s;s++){for(u=r[s][s],l=s,o=s+1;c>o;o++)uo;o++)i=r[s][o],r[s][o]=r[l][o],r[l][o]=i;for(l=s+1;f>l;l++)for(p=r[l][s]/r[s][s],o=s;a>o;o++)r[l][o]=r[l][o]-p*r[s][o]}for(var s=f-1;s>=0;s--){for(h=0,l=s+1;f-1>=l;l++)h+=m[l]*r[s][l];m[s]=(r[s][a-1]-h)/r[s][s]}return m},gauss_jordan:function(r,n){for(var a=t.aug(r,n),u=a.length,i=a[0].length,o=0,s=0;u>s;s++){for(var l=s,f=s+1;u>f;f++)e.abs(a[f][s])>e.abs(a[l][s])&&(l=f);var c=a[s];a[s]=a[l],a[l]=c;for(var f=s+1;u>f;f++){o=a[f][s]/a[s][s];for(var p=s;i>p;p++)a[f][p]-=a[s][p]*o}}for(var s=u-1;s>=0;s--){o=a[s][s];for(var f=0;s>f;f++)for(var p=i-1;p>s-1;p--)a[f][p]-=a[s][p]*a[f][s]/o;a[s][s]/=o;for(var p=u;i>p;p++)a[s][p]/=o}return a},triaUpSolve:function(r,e){var n,a=r[0].length,u=t.zeros(1,a)[0],i=!1;return e[0].length!=undefined&&(e=e.map(function(r){return r[0]}),i=!0),t.arange(a-1,-1,-1).forEach(function(i){n=t.arange(i+1,a).map(function(t){return u[t]*r[i][t]}),u[i]=(e[i]-t.sum(n))/r[i][i]}),i?u.map(function(r){return[r]}):u},triaLowSolve:function(r,e){var n,a=r[0].length,u=t.zeros(1,a)[0],i=!1;return e[0].length!=undefined&&(e=e.map(function(r){return r[0]}),i=!0),t.arange(a).forEach(function(a){n=t.arange(a).map(function(t){return r[a][t]*u[t]}),u[a]=(e[a]-t.sum(n))/r[a][a]}),i?u.map(function(r){return[r]}):u},lu:function(r){var e,n=r.length,a=t.identity(n),u=t.zeros(r.length,r[0].length);return t.arange(n).forEach(function(t){u[0][t]=r[0][t]}),t.arange(1,n).forEach(function(o){t.arange(o).forEach(function(n){e=t.arange(n).map(function(r){return a[o][r]*u[r][n]}),a[o][n]=(r[o][n]-t.sum(e))/u[n][n]}),t.arange(o,n).forEach(function(n){e=t.arange(o).map(function(r){return a[o][r]*u[r][n]}),u[o][n]=r[i][n]-t.sum(e)})}),[a,u]},cholesky:function(r){var n,a=r.length,u=t.zeros(r.length,r[0].length);return t.arange(a).forEach(function(i){n=t.arange(i).map(function(r){return e.pow(u[i][r],2)}),u[i][i]=e.sqrt(r[i][i]-t.sum(n)),t.arange(i+1,a).forEach(function(e){n=t.arange(i).map(function(r){return u[i][r]*u[e][r]}),u[e][i]=(r[i][e]-t.sum(n))/u[i][i]})}),u},gauss_jacobi:function(r,n,a,u){for(var i,o,s,l,f=0,c=0,p=r.length,h=[],m=[],E=[];p>f;f++)for(h[f]=[],m[f]=[],E[f]=[],c=0;p>c;c++)f>c?(h[f][c]=r[f][c],m[f][c]=E[f][c]=0):c>f?(m[f][c]=r[f][c],h[f][c]=E[f][c]=0):(E[f][c]=r[f][c],h[f][c]=m[f][c]=0);for(s=t.multiply(t.multiply(t.inv(E),t.add(h,m)),-1),o=t.multiply(t.inv(E),n),i=a,l=t.add(t.multiply(s,a),o),f=2;e.abs(t.norm(t.subtract(l,i)))>u;)i=l,l=t.add(t.multiply(s,i),o),f++;return l},gauss_seidel:function(r,n,a,u){for(var i,o,s,l,f,c=0,p=r.length,h=[],m=[],E=[];p>c;c++)for(h[c]=[],m[c]=[],E[c]=[],i=0;p>i;i++)c>i?(h[c][i]=r[c][i],m[c][i]=E[c][i]=0):i>c?(m[c][i]=r[c][i],h[c][i]=E[c][i]=0):(E[c][i]=r[c][i],h[c][i]=m[c][i]=0);for(l=t.multiply(t.multiply(t.inv(t.add(E,h)),m),-1),s=t.multiply(t.inv(t.add(E,h)),n),o=a,f=t.add(t.multiply(l,a),s),c=2;e.abs(t.norm(t.subtract(f,o)))>u;)o=f,f=t.add(t.multiply(l,o),s),c+=1;return f},SOR:function(r,n,a,u,i){for(var o,s,l,f,c,p=0,h=r.length,m=[],E=[],g=[];h>p;p++)for(m[p]=[],E[p]=[],g[p]=[],o=0;h>o;o++)p>o?(m[p][o]=r[p][o],E[p][o]=g[p][o]=0):o>p?(E[p][o]=r[p][o],m[p][o]=g[p][o]=0):(g[p][o]=r[p][o],m[p][o]=E[p][o]=0);for(f=t.multiply(t.inv(t.add(g,t.multiply(m,i))),t.subtract(t.multiply(g,1-i),t.multiply(E,i))),l=t.multiply(t.multiply(t.inv(t.add(g,t.multiply(m,i))),n),i),s=a,c=t.add(t.multiply(f,a),l),p=2;e.abs(t.norm(t.subtract(c,s)))>u;)s=c,c=t.add(t.multiply(f,s),l),p++;return c},householder:function(r){for(var n,a,u,i,o,s=r.length,l=r[0].length,f=0,c=[],p=[];s-1>f;f++){for(n=0,i=f+1;l>i;i++)n+=r[i][f]*r[i][f];for(o=r[f+1][f]>0?-1:1,n=o*e.sqrt(n),a=e.sqrt((n*n-r[f+1][f]*n)/2),c=t.zeros(s,1),c[f+1][0]=(r[f+1][f]-n)/(2*a),u=f+2;s>u;u++)c[u][0]=r[u][f]/(2*a);p=t.subtract(t.identity(s,l),t.multiply(t.multiply(c,t.transpose(c)),2)),r=t.multiply(p,t.multiply(r,p))}return r},QR:function(){function n(n){var i=n.length,o=n[0].length;n=t.copy(n),r=t.zeros(o,o);var s,l,f;for(l=0;o>l;l++){for(r[l][l]=e.sqrt(a(u(i).map(function(r){return n[r][l]*n[r][l]}))),s=0;i>s;s++)n[s][l]=n[s][l]/r[l][l];for(f=l+1;o>f;f++)for(r[l][f]=a(u(i).map(function(r){return n[r][l]*n[r][f]})),s=0;i>s;s++)n[s][f]=n[s][f]-n[s][l]*r[l][f]}return[n,r]}var a=t.sum,u=t.arange;return n}(),lstsq:function(r,e){function n(r){r=t.copy(r);var e=r.length,n=t.identity(e);return t.arange(e-1,-1,-1).forEach(function(e){t.sliceAssign(n,{row:e},t.divide(t.slice(n,{row:e}),r[e][e])),t.sliceAssign(r,{row:e},t.divide(t.slice(r,{row:e}),r[e][e])),t.arange(e).forEach(function(a){var u=t.multiply(r[a][e],-1),i=t.slice(r,{row:a}),o=t.multiply(t.slice(r,{row:e}),u);t.sliceAssign(r,{row:a},t.add(i,o));var s=t.slice(n,{row:a}),l=t.multiply(t.slice(n,{row:e}),u);t.sliceAssign(n,{row:a},t.add(s,l))})}),n}function a(r,e){var a=!1;e[0].length===undefined&&(e=e.map(function(r){return[r]}),a=!0);var u=t.QR(r),i=u[0],o=u[1],s=r[0].length,l=t.slice(i,{col:{end:s}}),f=t.slice(o,{row:{end:s}}),c=n(f),p=t.transpose(l);p[0].length===undefined&&(p=[p]);var h=t.multiply(t.multiply(c,p),e);return h.length===undefined&&(h=[[h]]),a?h.map(function(r){return r[0]}):h}return a}(),jacobi:function(r){for(var n,a,u,i,o,s,l,f,c=1,p=0,h=r.length,m=t.identity(h,h),E=[];1===c;){p++,s=r[0][1],i=0,o=1;for(var a=0;h>a;a++)for(u=0;h>u;u++)a!=u&&s0?e.PI/4:-e.PI/4:e.atan(2*r[i][o]/(r[i][i]-r[o][o]))/2,f=t.identity(h,h),f[i][i]=e.cos(l),f[i][o]=-e.sin(l),f[o][i]=e.sin(l),f[o][o]=e.cos(l),m=t.multiply(m,f),n=t.multiply(t.multiply(t.inv(f),r),f),r=n,c=0;for(var a=1;h>a;a++)for(u=1;h>u;u++)a!=u&&e.abs(r[a][u])>.001&&(c=1)}for(var a=0;h>a;a++)E.push(r[a][a]);return[m,E]},rungekutta:function(r,t,e,n,a,u){var i,o,s,l,f;if(2===u)for(;e>=n;)i=t*r(n,a),o=t*r(n+t,a+i),s=a+(i+o)/2,a=s,n+=t;if(4===u)for(;e>=n;)i=t*r(n,a),o=t*r(n+t/2,a+i/2),l=t*r(n+t/2,a+o/2),f=t*r(n+t,a+l),s=a+(i+2*o+2*l+f)/6,a=s,n+=t;return a},romberg:function(r,t,n,a){for(var u,i,o,s,l,f=0,c=(n-t)/2,p=[],h=[],m=[];a/2>f;){for(l=r(t),o=t,s=0;n>=o;o+=c,s++)p[s]=o;for(u=p.length,o=1;u-1>o;o++)l+=(o%2!=0?4:2)*r(p[o]);l=c/3*(l+r(n)),m[f]=l,c/=2,f++}for(i=m.length,u=1;1!==i;){for(o=0;i-1>o;o++)h[o]=(e.pow(4,u)*m[o+1]-m[o])/(e.pow(4,u)-1);i=h.length,m=h,h=[],u++}return m},richardson:function(r,t,n,a){function u(r,t){for(var e,n=0,a=r.length;a>n;n++)r[n]===t&&(e=n);return e}for(var i,o,s,l,f,c=e.abs(n-r[u(r,n)+1]),p=0,h=[],m=[];a>=c;)i=u(r,n+a),o=u(r,n),h[p]=(t[i]-2*t[o]+t[2*o-i])/(a*a),a/=2,p++;for(l=h.length,s=1;1!=l;){for(f=0;l-1>f;f++)m[f]=(e.pow(4,s)*h[f+1]-h[f])/(e.pow(4,s)-1);l=m.length,h=m,m=[],s++}return h},simpson:function(r,t,e,n){for(var a,u=(e-t)/n,i=r(t),o=[],s=t,l=0,f=1;e>=s;s+=u,l++)o[l]=s;for(a=o.length;a-1>f;f++)i+=(f%2!=0?4:2)*r(o[f]);return u/3*(i+r(e))},hermite:function(r,t,e,n){for(var a,u=r.length,i=0,o=0,s=[],l=[],f=[],c=[];u>o;o++){for(s[o]=1,a=0;u>a;a++)o!=a&&(s[o]*=(n-r[a])/(r[o]-r[a]));for(l[o]=0,a=0;u>a;a++)o!=a&&(l[o]+=1/(r[o]-r[a]));f[o]=s[o]*s[o]*(1-2*(n-r[o])*l[o]),c[o]=s[o]*s[o]*(n-r[o]),i+=f[o]*t[o]+c[o]*e[o]}return i},lagrange:function(r,t,e){for(var n,a,u=0,i=0,o=r.length;o>i;i++){for(a=t[i],n=0;o>n;n++)i!=n&&(a*=(e-r[n])/(r[i]-r[n]));u+=a}return u},cubic_spline:function(r,e,n){for(var a,u=r.length,i=0,o=[],s=[],l=[],f=[],c=[],p=[],h=[];u-1>i;i++)c[i]=r[i+1]-r[i];l[0]=0;for(var i=1;u-1>i;i++)l[i]=3/c[i]*(e[i+1]-e[i])-3/c[i-1]*(e[i]-e[i-1]);for(var i=1;u-1>i;i++)o[i]=[],s[i]=[],o[i][i-1]=c[i-1],o[i][i]=2*(c[i-1]+c[i]),o[i][i+1]=c[i],s[i][0]=l[i];for(f=t.multiply(t.inv(o),s),a=0;u-1>a;a++)p[a]=(e[a+1]-e[a])/c[a]-c[a]*(f[a+1][0]+2*f[a][0])/3,h[a]=(f[a+1][0]-f[a][0])/(3*c[a]);for(a=0;u>a&&r[a]<=n;a++);return a-=1,e[a]+(n-r[a])*p[a]+t.sq(n-r[a])*f[a]+(n-r[a])*t.sq(n-r[a])*h[a]},gauss_quadrature:function(){throw Error("gauss_quadrature not yet implemented")},PCA:function(r){for(var e,n,a=r.length,u=r[0].length,i=0,o=[],s=[],l=[],f=[],c=[],p=[],h=[],m=[],E=[],g=[],i=0;a>i;i++)o[i]=t.sum(r[i])/u;for(var i=0;u>i;i++)for(h[i]=[],e=0;a>e;e++)h[i][e]=r[e][i]-o[e];h=t.transpose(h);for(var i=0;a>i;i++)for(m[i]=[],e=0;a>e;e++)m[i][e]=t.dot([h[i]],[h[e]])/(u-1);l=t.jacobi(m),E=l[0],s=l[1],g=t.transpose(E);for(var i=0;s.length>i;i++)for(e=i;s.length>e;e++)s[e]>s[i]&&(n=s[i],s[i]=s[e],s[e]=n,f=g[i],g[i]=g[e],g[e]=f);p=t.transpose(h);for(var i=0;a>i;i++)for(c[i]=[],e=0;p.length>e;e++)c[i][e]=t.dot([g[i]],[p[e]]);return[r,s,g,c]}}),function(r){for(var e=0;r.length>e;e++)!function(r){t.fn[r]=function(e,n){var a=this;return n?(setTimeout(function(){n.call(a,t.fn[r].call(a,e))},15),this):"number"==typeof t[r](this,e)?t[r](this,e):t(t[r](this,e))}}(r[e])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(t,Math),function(r,t){function e(r,e,n,a){if(r>1||n>1||0>=r||0>=n)throw Error("Proportions should be greater than 0 and less than 1");var u=(r*e+n*a)/(e+a);return(r-n)/t.sqrt(u*(1-u)*(1/e+1/a))}var n=[].slice,a=r.utils.isNumber,u=r.utils.isArray;r.extend({zscore:function(){var t=n.call(arguments);return a(t[1])?(t[0]-t[1])/t[2]:(t[0]-r.mean(t[1]))/r.stdev(t[1],t[2])},ztest:function(){var e,a=n.call(arguments);return u(a[1])?(e=r.zscore(a[0],a[1],a[3]),1===a[2]?r.normal.cdf(-t.abs(e),0,1):2*r.normal.cdf(-t.abs(e),0,1)):a.length>2?(e=r.zscore(a[0],a[1],a[2]),1===a[3]?r.normal.cdf(-t.abs(e),0,1):2*r.normal.cdf(-t.abs(e),0,1)):(e=a[0],1===a[1]?r.normal.cdf(-t.abs(e),0,1):2*r.normal.cdf(-t.abs(e),0,1))}}),r.extend(r.fn,{zscore:function(r,t){return(r-this.mean())/this.stdev(t)},ztest:function(e,n,a){var u=t.abs(this.zscore(e,a));return 1===n?r.normal.cdf(-u,0,1):2*r.normal.cdf(-u,0,1)}}),r.extend({tscore:function(){var e=n.call(arguments);return 4===e.length?(e[0]-e[1])/(e[2]/t.sqrt(e[3])):(e[0]-r.mean(e[1]))/(r.stdev(e[1],!0)/t.sqrt(e[1].length))},ttest:function(){var e,u=n.call(arguments);return 5===u.length?(e=t.abs(r.tscore(u[0],u[1],u[2],u[3])),1===u[4]?r.studentt.cdf(-e,u[3]-1):2*r.studentt.cdf(-e,u[3]-1)):a(u[1])?(e=t.abs(u[0]),1==u[2]?r.studentt.cdf(-e,u[1]-1):2*r.studentt.cdf(-e,u[1]-1)):(e=t.abs(r.tscore(u[0],u[1])),1==u[2]?r.studentt.cdf(-e,u[1].length-1):2*r.studentt.cdf(-e,u[1].length-1))}}),r.extend(r.fn,{tscore:function(r){return(r-this.mean())/(this.stdev(!0)/t.sqrt(this.cols()))},ttest:function(e,n){return 1===n?1-r.studentt.cdf(t.abs(this.tscore(e)),this.cols()-1):2*r.studentt.cdf(-t.abs(this.tscore(e)),this.cols()-1)}}),r.extend({anovafscore:function(){var e,a,u,i,o,s,l,f,c=n.call(arguments);if(1===c.length){o=Array(c[0].length);for(var l=0;c[0].length>l;l++)o[l]=c[0][l];c=o}if(2===c.length)return r.variance(c[0])/r.variance(c[1]);a=[];for(var l=0;c.length>l;l++)a=a.concat(c[l]);u=r.mean(a),e=0;for(var l=0;c.length>l;l++)e+=c[l].length*t.pow(r.mean(c[l])-u,2);e/=c.length-1,s=0;for(var l=0;c.length>l;l++)for(i=r.mean(c[l]),f=0;c[l].length>f;f++)s+=t.pow(c[l][f]-i,2);return s/=a.length-c.length,e/s},anovaftest:function(){var t,e,u,i,o=n.call(arguments);if(a(o[0]))return 1-r.centralF.cdf(o[0],o[1],o[2]);anovafscore=r.anovafscore(o),t=o.length-1,u=0;for(var i=0;o.length>i;i++)u+=o[i].length;return e=u-t-1,1-r.centralF.cdf(anovafscore,t,e)},ftest:function(t,e,n){return 1-r.centralF.cdf(t,e,n)}}),r.extend(r.fn,{anovafscore:function(){return r.anovafscore(this.toArray())},anovaftes:function(){for(var t,e=0,t=0;this.length>t;t++)e+=this[t].length;return r.ftest(this.anovafscore(),this.length-1,e-this.length)}}),r.extend({qscore:function(){var e,u,i,o,s,l=n.call(arguments);return a(l[0])?(e=l[0],u=l[1],i=l[2],o=l[3],s=l[4]):(e=r.mean(l[0]),u=r.mean(l[1]),i=l[0].length,o=l[1].length,s=l[2]),t.abs(e-u)/(s*t.sqrt((1/i+1/o)/2))},qtest:function(){var t,e=n.call(arguments);3===e.length?(t=e[0],e=e.slice(1)):7===e.length?(t=r.qscore(e[0],e[1],e[2],e[3],e[4]),e=e.slice(5)):(t=r.qscore(e[0],e[1],e[2]),e=e.slice(3));var a=e[0],u=e[1];return 1-r.tukey.cdf(t,u,a-u)},tukeyhsd:function(t){for(var e=r.pooledstdev(t),n=t.map(function(t){return r.mean(t)}),a=t.reduce(function(r,t){return r+t.length},0),u=[],i=0;t.length>i;++i)for(var o=i+1;t.length>o;++o){var s=r.qtest(n[i],n[o],t[i].length,t[o].length,e,a,t.length);u.push([[i,o],s])}return u}}),r.extend({normalci:function(){var e,a=n.call(arguments),u=Array(2);return e=t.abs(4===a.length?r.normal.inv(a[1]/2,0,1)*a[2]/t.sqrt(a[3]):r.normal.inv(a[1]/2,0,1)*r.stdev(a[2])/t.sqrt(a[2].length)),u[0]=a[0]-e,u[1]=a[0]+e,u},tci:function(){var e,a=n.call(arguments),u=Array(2);return e=t.abs(4===a.length?r.studentt.inv(a[1]/2,a[3]-1)*a[2]/t.sqrt(a[3]):r.studentt.inv(a[1]/2,a[2].length-1)*r.stdev(a[2],!0)/t.sqrt(a[2].length)),u[0]=a[0]-e,u[1]=a[0]+e,u},significant:function(r,t){return t>r}}),r.extend(r.fn,{normalci:function(t,e){return r.normalci(t,e,this.toArray())},tci:function(t,e){return r.tci(t,e,this.toArray())}}),r.extend(r.fn,{oneSidedDifferenceOfProportions:function(t,n,a,u){var i=e(t,n,a,u);return r.ztest(i,1)},twoSidedDifferenceOfProportions:function(t,n,a,u){var i=e(t,n,a,u);return r.ztest(i,2)}})}(t,Math),t.models=function(){function r(r,t){return e(r,t)}function r(r){var n=r[0].length;return t.arange(n).map(function(a){var u=t.arange(n).filter(function(r){return r!==a});return e(t.col(r,a).map(function(r){return r[0]}),t.col(r,u))})}function e(r,e){var n=r.length,a=e[0].length-1,u=n-a-1,i=t.lstsq(e,r),o=t.multiply(e,i.map(function(r){return[r]})).map(function(r){return r[0]}),s=t.subtract(r,o),l=t.mean(r),f=t.sum(o.map(function(r){return Math.pow(r-l,2)})),c=t.sum(r.map(function(r,t){return Math.pow(r-o[t],2)})),p=f+c;return{exog:e,endog:r,nobs:n,df_model:a,df_resid:u,coef:i,predict:o,resid:s,ybar:l,SST:p,SSE:f,SSR:c,R2:f/p}}function n(e){var n=r(e.exog),a=Math.sqrt(e.SSR/e.df_resid),u=n.map(function(r){var t=r.SST,e=r.R2;return a/Math.sqrt(t*(1-e))}),i=e.coef.map(function(r,t){return(r-0)/u[t]}),o=i.map(function(r){var n=t.studentt.cdf(r,e.df_resid);return 2*(n>.5?1-n:n)}),s=t.studentt.inv(.975,e.df_resid),l=e.coef.map(function(r,t){var e=s*u[t];return[r-e,r+e]});return{se:u,t:i,p:o,sigmaHat:a,interval95:l}}function a(r){var e=r.R2/r.df_model/((1-r.R2)/r.df_resid);return{F_statistic:e,pvalue:1-function(r,e,n){return t.beta.cdf(r/(n/e+r),e/2,n/2)}(e,r.df_model,r.df_resid)}}function u(r,t){var u=e(r,t),i=n(u),o=a(u),s=1-(u.nobs-1)/u.df_resid*(1-u.R2);return u.t=i,u.f=o,u.adjust_R2=s,u}return{ols:u}}(),t.jStat=t,t})},function(r,t,e){var n=e(1),a=e(0);t.UNIQUE=function(){for(var r=[],t=0;arguments.length>t;++t){for(var e=!1,n=arguments[t],a=0;r.length>a&&!(e=r[a]===n);++a);e||r.push(n)}return r},t.FLATTEN=n.flatten,t.ARGS2ARRAY=function(){return Array.prototype.slice.call(arguments,0)},t.REFERENCE=function(r,t){if(!arguments.length)return a.error;try{for(var e=t.split("."),n=r,u=0;e.length>u;++u){var i=e[u];if("]"===i[i.length-1]){var o=i.indexOf("["),s=i.substring(o+1,i.length-1);n=n[i.substring(0,o)][s]}else n=n[i]}return n}catch(a){}},t.JOIN=function(r,t){return r.join(t)},t.NUMBERS=function(){return n.flatten(arguments).filter(function(r){return"number"==typeof r})}},function(r,t,e){function n(r){return/^[01]{1,10}$/.test(r)}var a=e(0),u=e(9).jStat,i=e(6),o=e(1),s=e(25);t.BESSELI=function(r,t){return r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t)?a.value:s.besseli(r,t)},t.BESSELJ=function(r,t){return r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t)?a.value:s.besselj(r,t)},t.BESSELK=function(r,t){return r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t)?a.value:s.besselk(r,t)},t.BESSELY=function(r,t){return r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t)?a.value:s.bessely(r,t)},t.BIN2DEC=function(r){if(!n(r))return a.num;var t=parseInt(r,2),e=""+r;return 10===e.length&&"1"===e.substring(0,1)?parseInt(e.substring(1),2)-512:t},t.BIN2HEX=function(r,t){if(!n(r))return a.num;var e=""+r;if(10===e.length&&"1"===e.substring(0,1))return(0xfffffffe00+parseInt(e.substring(1),2)).toString(16);var u=parseInt(r,2).toString(16);return t===undefined?u:isNaN(t)?a.value:0>t?a.num:(t=Math.floor(t),u.length>t?a.num:i.REPT("0",t-u.length)+u)},t.BIN2OCT=function(r,t){if(!n(r))return a.num;var e=""+r;if(10===e.length&&"1"===e.substring(0,1))return(1073741312+parseInt(e.substring(1),2)).toString(8);var u=parseInt(r,2).toString(8);return t===undefined?u:isNaN(t)?a.value:0>t?a.num:(t=Math.floor(t),u.length>t?a.num:i.REPT("0",t-u.length)+u)},t.BITAND=function(r,t){return r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t)?a.value:0>r||0>t?a.num:Math.floor(r)!==r||Math.floor(t)!==t?a.num:r>0xffffffffffff||t>0xffffffffffff?a.num:r&t},t.BITLSHIFT=function(r,t){return r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t)?a.value:0>r?a.num:Math.floor(r)!==r?a.num:r>0xffffffffffff?a.num:Math.abs(t)>53?a.num:0>t?r>>-t:r<r||0>t?a.num:Math.floor(r)!==r||Math.floor(t)!==t?a.num:r>0xffffffffffff||t>0xffffffffffff?a.num:r|t},t.BITRSHIFT=function(r,t){return r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t)?a.value:0>r?a.num:Math.floor(r)!==r?a.num:r>0xffffffffffff?a.num:Math.abs(t)>53?a.num:0>t?r<<-t:r>>t},t.BITXOR=function(r,t){return r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t)?a.value:0>r||0>t?a.num:Math.floor(r)!==r||Math.floor(t)!==t?a.num:r>0xffffffffffff||t>0xffffffffffff?a.num:r^t},t.COMPLEX=function(r,t,e){return r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t)?r:"i"!==(e=e===undefined?"i":e)&&"j"!==e?a.value:0===r&&0===t?0:0===r?1===t?e:""+t+e:0===t?""+r:r+(t>0?"+":"")+(1===t?e:""+t+e)},t.CONVERT=function(r,t,e){if((r=o.parseNumber(r))instanceof Error)return r;for(var n,u=[["a.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["a.u. of charge","e",null,"electric_charge",!1,!1,1.60217653141414e-19],["a.u. of energy","Eh",null,"energy",!1,!1,4.35974417757576e-18],["a.u. of length","a?",null,"length",!1,!1,5.29177210818182e-11],["a.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["a.u. of time","?/Eh",null,"time",!1,!1,2.41888432650516e-17],["admiralty knot","admkn",null,"speed",!1,!0,.514773333],["ampere","A",null,"electric_current",!0,!1,1],["ampere per meter","A/m",null,"magnetic_field_intensity",!0,!1,1],["ångström","Å",["ang"],"length",!1,!0,1e-10],["are","ar",null,"area",!1,!0,100],["astronomical unit","ua",null,"length",!1,!1,1.49597870691667e-11],["bar","bar",null,"pressure",!1,!1,1e5],["barn","b",null,"area",!1,!1,1e-28],["becquerel","Bq",null,"radioactivity",!0,!1,1],["bit","bit",["b"],"information",!1,!0,1],["btu","BTU",["btu"],"energy",!1,!0,1055.05585262],["byte","byte",null,"information",!1,!0,8],["candela","cd",null,"luminous_intensity",!0,!1,1],["candela per square metre","cd/m?",null,"luminance",!0,!1,1],["coulomb","C",null,"electric_charge",!0,!1,1],["cubic ångström","ang3",["ang^3"],"volume",!1,!0,1e-30],["cubic foot","ft3",["ft^3"],"volume",!1,!0,.028316846592],["cubic inch","in3",["in^3"],"volume",!1,!0,16387064e-12],["cubic light-year","ly3",["ly^3"],"volume",!1,!0,8.46786664623715e-47],["cubic metre","m?",null,"volume",!0,!0,1],["cubic mile","mi3",["mi^3"],"volume",!1,!0,4168181825.44058],["cubic nautical mile","Nmi3",["Nmi^3"],"volume",!1,!0,6352182208],["cubic Pica","Pica3",["Picapt3","Pica^3","Picapt^3"],"volume",!1,!0,7.58660370370369e-8],["cubic yard","yd3",["yd^3"],"volume",!1,!0,.764554857984],["cup","cup",null,"volume",!1,!0,.0002365882365],["dalton","Da",["u"],"mass",!1,!1,1.66053886282828e-27],["day","d",["day"],"time",!1,!0,86400],["degree","°",null,"angle",!1,!1,.0174532925199433],["degrees Rankine","Rank",null,"temperature",!1,!0,.555555555555556],["dyne","dyn",["dy"],"force",!1,!0,1e-5],["electronvolt","eV",["ev"],"energy",!1,!0,1.60217656514141],["ell","ell",null,"length",!1,!0,1.143],["erg","erg",["e"],"energy",!1,!0,1e-7],["farad","F",null,"electric_capacitance",!0,!1,1],["fluid ounce","oz",null,"volume",!1,!0,295735295625e-16],["foot","ft",null,"length",!1,!0,.3048],["foot-pound","flb",null,"energy",!1,!0,1.3558179483314],["gal","Gal",null,"acceleration",!1,!1,.01],["gallon","gal",null,"volume",!1,!0,.003785411784],["gauss","G",["ga"],"magnetic_flux_density",!1,!0,1],["grain","grain",null,"mass",!1,!0,647989e-10],["gram","g",null,"mass",!1,!0,.001],["gray","Gy",null,"absorbed_dose",!0,!1,1],["gross registered ton","GRT",["regton"],"volume",!1,!0,2.8316846592],["hectare","ha",null,"area",!1,!0,1e4],["henry","H",null,"inductance",!0,!1,1],["hertz","Hz",null,"frequency",!0,!1,1],["horsepower","HP",["h"],"power",!1,!0,745.69987158227],["horsepower-hour","HPh",["hh","hph"],"energy",!1,!0,2684519.538],["hour","h",["hr"],"time",!1,!0,3600],["imperial gallon (U.K.)","uk_gal",null,"volume",!1,!0,.00454609],["imperial hundredweight","lcwt",["uk_cwt","hweight"],"mass",!1,!0,50.802345],["imperial quart (U.K)","uk_qt",null,"volume",!1,!0,.0011365225],["imperial ton","brton",["uk_ton","LTON"],"mass",!1,!0,1016.046909],["inch","in",null,"length",!1,!0,.0254],["international acre","uk_acre",null,"area",!1,!0,4046.8564224],["IT calorie","cal",null,"energy",!1,!0,4.1868],["joule","J",null,"energy",!0,!0,1],["katal","kat",null,"catalytic_activity",!0,!1,1],["kelvin","K",["kel"],"temperature",!0,!0,1],["kilogram","kg",null,"mass",!0,!0,1],["knot","kn",null,"speed",!1,!0,.514444444444444],["light-year","ly",null,"length",!1,!0,9460730472580800],["litre","L",["l","lt"],"volume",!1,!0,.001],["lumen","lm",null,"luminous_flux",!0,!1,1],["lux","lx",null,"illuminance",!0,!1,1],["maxwell","Mx",null,"magnetic_flux",!1,!1,1e-18],["measurement ton","MTON",null,"volume",!1,!0,1.13267386368],["meter per hour","m/h",["m/hr"],"speed",!1,!0,.00027777777777778],["meter per second","m/s",["m/sec"],"speed",!0,!0,1],["meter per second squared","m?s??",null,"acceleration",!0,!1,1],["parsec","pc",["parsec"],"length",!1,!0,0x6da012f958ee1c],["meter squared per second","m?/s",null,"kinematic_viscosity",!0,!1,1],["metre","m",null,"length",!0,!0,1],["miles per hour","mph",null,"speed",!1,!0,.44704],["millimetre of mercury","mmHg",null,"pressure",!1,!1,133.322],["minute","?",null,"angle",!1,!1,.000290888208665722],["minute","min",["mn"],"time",!1,!0,60],["modern teaspoon","tspm",null,"volume",!1,!0,5e-6],["mole","mol",null,"amount_of_substance",!0,!1,1],["morgen","Morgen",null,"area",!1,!0,2500],["n.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["n.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["n.u. of speed","c?",null,"speed",!1,!1,299792458],["n.u. of time","?/(me?c??)",null,"time",!1,!1,1.28808866778687e-21],["nautical mile","M",["Nmi"],"length",!1,!0,1852],["newton","N",null,"force",!0,!0,1],["œrsted","Oe ",null,"magnetic_field_intensity",!1,!1,79.5774715459477],["ohm","Ω",null,"electric_resistance",!0,!1,1],["ounce mass","ozm",null,"mass",!1,!0,.028349523125],["pascal","Pa",null,"pressure",!0,!1,1],["pascal second","Pa?s",null,"dynamic_viscosity",!0,!1,1],["pferdestärke","PS",null,"power",!1,!0,735.49875],["phot","ph",null,"illuminance",!1,!1,1e-4],["pica (1/6 inch)","pica",null,"length",!1,!0,.00035277777777778],["pica (1/72 inch)","Pica",["Picapt"],"length",!1,!0,.00423333333333333],["poise","P",null,"dynamic_viscosity",!1,!1,.1],["pond","pond",null,"force",!1,!0,.00980665],["pound force","lbf",null,"force",!1,!0,4.4482216152605],["pound mass","lbm",null,"mass",!1,!0,.45359237],["quart","qt",null,"volume",!1,!0,.000946352946],["radian","rad",null,"angle",!0,!1,1],["second","?",null,"angle",!1,!1,484813681109536e-20],["second","s",["sec"],"time",!0,!0,1],["short hundredweight","cwt",["shweight"],"mass",!1,!0,45.359237],["siemens","S",null,"electrical_conductance",!0,!1,1],["sievert","Sv",null,"equivalent_dose",!0,!1,1],["slug","sg",null,"mass",!1,!0,14.59390294],["square ångström","ang2",["ang^2"],"area",!1,!0,1e-20],["square foot","ft2",["ft^2"],"area",!1,!0,.09290304],["square inch","in2",["in^2"],"area",!1,!0,64516e-8],["square light-year","ly2",["ly^2"],"area",!1,!0,8.95054210748189e31],["square meter","m?",null,"area",!0,!0,1],["square mile","mi2",["mi^2"],"area",!1,!0,2589988.110336],["square nautical mile","Nmi2",["Nmi^2"],"area",!1,!0,3429904],["square Pica","Pica2",["Picapt2","Pica^2","Picapt^2"],"area",!1,!0,1792111111111e-17],["square yard","yd2",["yd^2"],"area",!1,!0,.83612736],["statute mile","mi",null,"length",!1,!0,1609.344],["steradian","sr",null,"solid_angle",!0,!1,1],["stilb","sb",null,"luminance",!1,!1,1e-4],["stokes","St",null,"kinematic_viscosity",!1,!1,1e-4],["stone","stone",null,"mass",!1,!0,6.35029318],["tablespoon","tbs",null,"volume",!1,!0,147868e-10],["teaspoon","tsp",null,"volume",!1,!0,492892e-11],["tesla","T",null,"magnetic_flux_density",!0,!0,1],["thermodynamic calorie","c",null,"energy",!1,!0,4.184],["ton","ton",null,"mass",!1,!0,907.18474],["tonne","t",null,"mass",!1,!1,1e3],["U.K. pint","uk_pt",null,"volume",!1,!0,.00056826125],["U.S. bushel","bushel",null,"volume",!1,!0,.03523907],["U.S. oil barrel","barrel",null,"volume",!1,!0,.158987295],["U.S. pint","pt",["us_pt"],"volume",!1,!0,.000473176473],["U.S. survey mile","survey_mi",null,"length",!1,!0,1609.347219],["U.S. survey/statute acre","us_acre",null,"area",!1,!0,4046.87261],["volt","V",null,"voltage",!0,!1,1],["watt","W",null,"power",!0,!0,1],["watt-hour","Wh",["wh"],"energy",!1,!0,3600],["weber","Wb",null,"magnetic_flux",!0,!1,1],["yard","yd",null,"length",!1,!0,.9144],["year","yr",null,"time",!1,!0,31557600]],i={Yi:["yobi",80,1.2089258196146292e24,"Yi","yotta"],Zi:["zebi",70,0x400000000000000000,"Zi","zetta"],Ei:["exbi",60,0x1000000000000000,"Ei","exa"],Pi:["pebi",50,0x4000000000000,"Pi","peta"],Ti:["tebi",40,1099511627776,"Ti","tera"],Gi:["gibi",30,1073741824,"Gi","giga"],Mi:["mebi",20,1048576,"Mi","mega"],ki:["kibi",10,1024,"ki","kilo"]},s={Y:["yotta",1e24,"Y"],Z:["zetta",1e21,"Z"],E:["exa",1e18,"E"],P:["peta",1e15,"P"],T:["tera",1e12,"T"],G:["giga",1e9,"G"],M:["mega",1e6,"M"],k:["kilo",1e3,"k"],h:["hecto",100,"h"],e:["dekao",10,"e"],d:["deci",.1,"d"],c:["centi",.01,"c"],m:["milli",.001,"m"],u:["micro",1e-6,"u"],n:["nano",1e-9,"n"],p:["pico",1e-12,"p"],f:["femto",1e-15,"f"],a:["atto",1e-18,"a"],z:["zepto",1e-21,"z"],y:["yocto",1e-24,"y"]},l=null,f=null,c=t,p=e,h=1,m=1,E=0;146>E;E++)n=null===u[E][2]?[]:u[E][2],u[E][1]!==c&&0>n.indexOf(c)||(l=u[E]),u[E][1]!==p&&0>n.indexOf(p)||(f=u[E]);if(null===l){var g=i[t.substring(0,2)],N=s[t.substring(0,1)];"da"===t.substring(0,2)&&(N=["dekao",10,"da"]),g?(h=g[2],c=t.substring(2)):N&&(h=N[1],c=t.substring(N[2].length));for(var v=0;146>v;v++)n=null===u[v][2]?[]:u[v][2],u[v][1]!==c&&0>n.indexOf(c)||(l=u[v])}if(null===f){var d=i[e.substring(0,2)],I=s[e.substring(0,1)];"da"===e.substring(0,2)&&(I=["dekao",10,"da"]),d?(m=d[2],p=e.substring(2)):I&&(m=I[1],p=e.substring(I[2].length));for(var b=0;146>b;b++)n=null===u[b][2]?[]:u[b][2],u[b][1]!==p&&0>n.indexOf(p)||(f=u[b])}return null===l||null===f?a.na:l[3]!==f[3]?a.na:r*l[6]*h/(f[6]*m)},t.DEC2BIN=function(r,t){if((r=o.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,3}$/.test(r)||-512>r||r>511)return a.num;if(0>r)return"1"+i.REPT("0",9-(512+r).toString(2).length)+(512+r).toString(2);var e=parseInt(r,10).toString(2);return void 0===t?e:isNaN(t)?a.value:0>t?a.num:(t=Math.floor(t),e.length>t?a.num:i.REPT("0",t-e.length)+e)},t.DEC2HEX=function(r,t){if((r=o.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,12}$/.test(r)||-549755813888>r||r>549755813887)return a.num;if(0>r)return(1099511627776+r).toString(16);var e=parseInt(r,10).toString(16);return void 0===t?e:isNaN(t)?a.value:0>t?a.num:(t=Math.floor(t),e.length>t?a.num:i.REPT("0",t-e.length)+e)},t.DEC2OCT=function(r,t){if((r=o.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,9}$/.test(r)||-536870912>r||r>536870911)return a.num;if(0>r)return(1073741824+r).toString(8);var e=parseInt(r,10).toString(8);return void 0===t?e:isNaN(t)?a.value:0>t?a.num:(t=Math.floor(t),e.length>t?a.num:i.REPT("0",t-e.length)+e)},t.DELTA=function(r,t){return t=t===undefined?0:t,r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t)?a.value:r===t?1:0},t.ERF=function(r,t){return t=t===undefined?0:t,r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t)?a.value:u.erf(r)},t.ERF.PRECISE=function(){throw Error("ERF.PRECISE is not implemented")},t.ERFC=function(r){return isNaN(r)?a.value:u.erfc(r)},t.ERFC.PRECISE=function(){throw Error("ERFC.PRECISE is not implemented")},t.GESTEP=function(r,t){return t=t||0,r=o.parseNumber(r),o.anyIsError(t,r)?r:t>r?0:1},t.HEX2BIN=function(r,t){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return a.num;var e=10===r.length&&"f"===r.substring(0,1).toLowerCase(),n=e?parseInt(r,16)-1099511627776:parseInt(r,16);if(-512>n||n>511)return a.num;if(e)return"1"+i.REPT("0",9-(512+n).toString(2).length)+(512+n).toString(2);var u=n.toString(2);return t===undefined?u:isNaN(t)?a.value:0>t?a.num:(t=Math.floor(t),u.length>t?a.num:i.REPT("0",t-u.length)+u)},t.HEX2DEC=function(r){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return a.num;var t=parseInt(r,16);return 549755813888>t?t:t-1099511627776},t.HEX2OCT=function(r,t){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return a.num;var e=parseInt(r,16);if(e>536870911&&0xffe0000000>e)return a.num;if(e>=0xffe0000000)return(e-0xffc0000000).toString(8);var n=e.toString(8);return t===undefined?n:isNaN(t)?a.value:0>t?a.num:(t=Math.floor(t),n.length>t?a.num:i.REPT("0",t-n.length)+n)},t.IMABS=function(r){var e=t.IMREAL(r),n=t.IMAGINARY(r);return o.anyIsError(e,n)?a.value:Math.sqrt(Math.pow(e,2)+Math.pow(n,2))},t.IMAGINARY=function(r){if(r===undefined||!0===r||!1===r)return a.value;if(0===r||"0"===r)return 0;if(["i","j"].indexOf(r)>=0)return 1;r=r.replace("+i","+1i").replace("-i","-1i").replace("+j","+1j").replace("-j","-1j");var t=r.indexOf("+"),e=r.indexOf("-");0===t&&(t=r.indexOf("+",1)),0===e&&(e=r.indexOf("-",1));var n=r.substring(r.length-1,r.length),u="i"===n||"j"===n;return 0>t&&0>e?u?isNaN(r.substring(0,r.length-1))?a.num:r.substring(0,r.length-1):isNaN(r)?a.num:0:u?0>t?isNaN(r.substring(0,e))||isNaN(r.substring(e+1,r.length-1))?a.num:-+r.substring(e+1,r.length-1):isNaN(r.substring(0,t))||isNaN(r.substring(t+1,r.length-1))?a.num:+r.substring(t+1,r.length-1):a.num},t.IMARGUMENT=function(r){var e=t.IMREAL(r),n=t.IMAGINARY(r);return o.anyIsError(e,n)?a.value:0===e&&0===n?a.div0:0===e&&n>0?Math.PI/2:0===e&&0>n?-Math.PI/2:0===n&&e>0?0:0===n&&0>e?-Math.PI:e>0?Math.atan(n/e):0>e&&n>=0?Math.atan(n/e)+Math.PI:Math.atan(n/e)-Math.PI},t.IMCONJUGATE=function(r){var e=t.IMREAL(r),n=t.IMAGINARY(r);if(o.anyIsError(e,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",0!==n?t.COMPLEX(e,-n,u):r},t.IMCOS=function(r){var e=t.IMREAL(r),n=t.IMAGINARY(r);if(o.anyIsError(e,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",t.COMPLEX(Math.cos(e)*(Math.exp(n)+Math.exp(-n))/2,-Math.sin(e)*(Math.exp(n)-Math.exp(-n))/2,u)},t.IMCOSH=function(r){var e=t.IMREAL(r),n=t.IMAGINARY(r);if(o.anyIsError(e,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",t.COMPLEX(Math.cos(n)*(Math.exp(e)+Math.exp(-e))/2,Math.sin(n)*(Math.exp(e)-Math.exp(-e))/2,u)},t.IMCOT=function(r){var e=t.IMREAL(r),n=t.IMAGINARY(r);return o.anyIsError(e,n)?a.value:t.IMDIV(t.IMCOS(r),t.IMSIN(r))},t.IMDIV=function(r,e){var n=t.IMREAL(r),u=t.IMAGINARY(r),i=t.IMREAL(e),s=t.IMAGINARY(e);if(o.anyIsError(n,u,i,s))return a.value;var l=r.substring(r.length-1),f=e.substring(e.length-1),c="i";if("j"===l?c="j":"j"===f&&(c="j"),0===i&&0===s)return a.num;var p=i*i+s*s;return t.COMPLEX((n*i+u*s)/p,(u*i-n*s)/p,c)},t.IMEXP=function(r){var e=t.IMREAL(r),n=t.IMAGINARY(r);if(o.anyIsError(e,n))return a.value;var u=r.substring(r.length-1);u="i"===u||"j"===u?u:"i";var i=Math.exp(e);return t.COMPLEX(i*Math.cos(n),i*Math.sin(n),u)},t.IMLN=function(r){var e=t.IMREAL(r),n=t.IMAGINARY(r);if(o.anyIsError(e,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",t.COMPLEX(Math.log(Math.sqrt(e*e+n*n)),Math.atan(n/e),u)},t.IMLOG10=function(r){var e=t.IMREAL(r),n=t.IMAGINARY(r);if(o.anyIsError(e,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",t.COMPLEX(Math.log(Math.sqrt(e*e+n*n))/Math.log(10),Math.atan(n/e)/Math.log(10),u)},t.IMLOG2=function(r){var e=t.IMREAL(r),n=t.IMAGINARY(r);if(o.anyIsError(e,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",t.COMPLEX(Math.log(Math.sqrt(e*e+n*n))/Math.log(2),Math.atan(n/e)/Math.log(2),u)},t.IMPOWER=function(r,e){e=o.parseNumber(e);var n=t.IMREAL(r),u=t.IMAGINARY(r);if(o.anyIsError(e,n,u))return a.value;var i=r.substring(r.length-1);i="i"===i||"j"===i?i:"i";var s=Math.pow(t.IMABS(r),e),l=t.IMARGUMENT(r);return t.COMPLEX(s*Math.cos(e*l),s*Math.sin(e*l),i)},t.IMPRODUCT=function(){var r=arguments[0];if(!arguments.length)return a.value;for(var e=1;arguments.length>e;e++){var n=t.IMREAL(r),u=t.IMAGINARY(r),i=t.IMREAL(arguments[e]),s=t.IMAGINARY(arguments[e]);if(o.anyIsError(n,u,i,s))return a.value;r=t.COMPLEX(n*i-u*s,n*s+u*i)}return r},t.IMREAL=function(r){if(r===undefined||!0===r||!1===r)return a.value;if(0===r||"0"===r)return 0;if(["i","+i","1i","+1i","-i","-1i","j","+j","1j","+1j","-j","-1j"].indexOf(r)>=0)return 0;var t=r.indexOf("+"),e=r.indexOf("-");0===t&&(t=r.indexOf("+",1)),0===e&&(e=r.indexOf("-",1));var n=r.substring(r.length-1,r.length),u="i"===n||"j"===n;return 0>t&&0>e?u?isNaN(r.substring(0,r.length-1))?a.num:0:isNaN(r)?a.num:r:u?0>t?isNaN(r.substring(0,e))||isNaN(r.substring(e+1,r.length-1))?a.num:+r.substring(0,e):isNaN(r.substring(0,t))||isNaN(r.substring(t+1,r.length-1))?a.num:+r.substring(0,t):a.num},t.IMSEC=function(r){if(!0===r||!1===r)return a.value;var e=t.IMREAL(r),n=t.IMAGINARY(r);return o.anyIsError(e,n)?a.value:t.IMDIV("1",t.IMCOS(r))},t.IMSECH=function(r){var e=t.IMREAL(r),n=t.IMAGINARY(r);return o.anyIsError(e,n)?a.value:t.IMDIV("1",t.IMCOSH(r))},t.IMSIN=function(r){var e=t.IMREAL(r),n=t.IMAGINARY(r);if(o.anyIsError(e,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",t.COMPLEX(Math.sin(e)*(Math.exp(n)+Math.exp(-n))/2,Math.cos(e)*(Math.exp(n)-Math.exp(-n))/2,u)},t.IMSINH=function(r){var e=t.IMREAL(r),n=t.IMAGINARY(r);if(o.anyIsError(e,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",t.COMPLEX(Math.cos(n)*(Math.exp(e)-Math.exp(-e))/2,Math.sin(n)*(Math.exp(e)+Math.exp(-e))/2,u)},t.IMSQRT=function(r){var e=t.IMREAL(r),n=t.IMAGINARY(r);if(o.anyIsError(e,n))return a.value;var u=r.substring(r.length-1);u="i"===u||"j"===u?u:"i";var i=Math.sqrt(t.IMABS(r)),s=t.IMARGUMENT(r);return t.COMPLEX(i*Math.cos(s/2),i*Math.sin(s/2),u)},t.IMCSC=function(r){if(!0===r||!1===r)return a.value;var e=t.IMREAL(r),n=t.IMAGINARY(r);return o.anyIsError(e,n)?a.num:t.IMDIV("1",t.IMSIN(r))},t.IMCSCH=function(r){if(!0===r||!1===r)return a.value;var e=t.IMREAL(r),n=t.IMAGINARY(r);return o.anyIsError(e,n)?a.num:t.IMDIV("1",t.IMSINH(r))},t.IMSUB=function(r,t){var e=this.IMREAL(r),n=this.IMAGINARY(r),u=this.IMREAL(t),i=this.IMAGINARY(t);if(o.anyIsError(e,n,u,i))return a.value;var s=r.substring(r.length-1),l=t.substring(t.length-1),f="i";return"j"===s?f="j":"j"===l&&(f="j"),this.COMPLEX(e-u,n-i,f)},t.IMSUM=function(){if(!arguments.length)return a.value;for(var r=o.flatten(arguments),t=r[0],e=1;r.length>e;e++){var n=this.IMREAL(t),u=this.IMAGINARY(t),i=this.IMREAL(r[e]),s=this.IMAGINARY(r[e]);if(o.anyIsError(n,u,i,s))return a.value;t=this.COMPLEX(n+i,u+s)}return t},t.IMTAN=function(r){if(!0===r||!1===r)return a.value;var e=t.IMREAL(r),n=t.IMAGINARY(r);return o.anyIsError(e,n)?a.value:this.IMDIV(this.IMSIN(r),this.IMCOS(r))},t.OCT2BIN=function(r,t){if(!/^[0-7]{1,10}$/.test(r))return a.num;var e=10===r.length&&"7"===r.substring(0,1),n=e?parseInt(r,8)-1073741824:parseInt(r,8);if(-512>n||n>511)return a.num;if(e)return"1"+i.REPT("0",9-(512+n).toString(2).length)+(512+n).toString(2);var u=n.toString(2);return void 0===t?u:isNaN(t)?a.value:0>t?a.num:(t=Math.floor(t),u.length>t?a.num:i.REPT("0",t-u.length)+u)},t.OCT2DEC=function(r){if(!/^[0-7]{1,10}$/.test(r))return a.num;var t=parseInt(r,8);return 536870912>t?t:t-1073741824},t.OCT2HEX=function(r,t){if(!/^[0-7]{1,10}$/.test(r))return a.num;var e=parseInt(r,8);if(e>=536870912)return"ff"+(e+3221225472).toString(16);var n=e.toString(16);return t===undefined?n:isNaN(t)?a.value:0>t?a.num:(t=Math.floor(t),n.length>t?a.num:i.REPT("0",t-n.length)+n)}},function(r,t,e){"use strict";t.__esModule=!0,t["default"]=["ABS","ACCRINT","ACOS","ACOSH","ACOT","ACOTH","ADD","AGGREGATE","AND","ARABIC","ARGS2ARRAY","ASIN","ASINH","ATAN","ATAN2","ATANH","AVEDEV","AVERAGE","AVERAGEA","AVERAGEIF","AVERAGEIFS","BASE","BESSELI","BESSELJ","BESSELK","BESSELY","BETA.DIST","BETA.INV","BETADIST","BETAINV","BIN2DEC","BIN2HEX","BIN2OCT","BINOM.DIST","BINOM.DIST.RANGE","BINOM.INV","BINOMDIST","BITAND","BITLSHIFT","BITOR","BITRSHIFT","BITXOR","CEILING","CEILINGMATH","CEILINGPRECISE","CHAR","CHISQ.DIST","CHISQ.DIST.RT","CHISQ.INV","CHISQ.INV.RT","CHOOSE","CHOOSE","CLEAN","CODE","COLUMN","COLUMNS","COMBIN","COMBINA","COMPLEX","CONCATENATE","CONFIDENCE","CONFIDENCE.NORM","CONFIDENCE.T","CONVERT","CORREL","COS","COSH","COT","COTH","COUNT","COUNTA","COUNTBLANK","COUNTIF","COUNTIFS","COUNTIN","COUNTUNIQUE","COVARIANCE.P","COVARIANCE.S","CSC","CSCH","CUMIPMT","CUMPRINC","DATE","DATEVALUE","DAY","DAYS","DAYS360","DB","DDB","DEC2BIN","DEC2HEX","DEC2OCT","DECIMAL","DEGREES","DELTA","DEVSQ","DIVIDE","DOLLARDE","DOLLARFR","E","EDATE","EFFECT","EOMONTH","EQ","ERF","ERFC","EVEN","EXACT","EXP","EXPON.DIST","EXPONDIST","F.DIST","F.DIST.RT","F.INV","F.INV.RT","FACT","FACTDOUBLE","FALSE","FDIST","FDISTRT","FIND","FINV","FINVRT","FISHER","FISHERINV","FLATTEN","FLOOR","FORECAST","FREQUENCY","FV","FVSCHEDULE","GAMMA","GAMMA.DIST","GAMMA.INV","GAMMADIST","GAMMAINV","GAMMALN","GAMMALN.PRECISE","GAUSS","GCD","GEOMEAN","GESTEP","GROWTH","GTE","HARMEAN","HEX2BIN","HEX2DEC","HEX2OCT","HOUR","HTML2TEXT","HYPGEOM.DIST","HYPGEOMDIST","IF","IMABS","IMAGINARY","IMARGUMENT","IMCONJUGATE","IMCOS","IMCOSH","IMCOT","IMCSC","IMCSCH","IMDIV","IMEXP","IMLN","IMLOG10","IMLOG2","IMPOWER","IMPRODUCT","IMREAL","IMSEC","IMSECH","IMSIN","IMSINH","IMSQRT","IMSUB","IMSUM","IMTAN","INT","INTERCEPT","INTERVAL","IPMT","IRR","ISBINARY","ISBLANK","ISEVEN","ISLOGICAL","ISNONTEXT","ISNUMBER","ISODD","ISODD","ISOWEEKNUM","ISPMT","ISTEXT","JOIN","KURT","LARGE","LCM","LEFT","LEN","LINEST","LN","LOG","LOG10","LOGEST","LOGNORM.DIST","LOGNORM.INV","LOGNORMDIST","LOGNORMINV","LOWER","LT","LTE","MATCH","MAX","MAXA","MEDIAN","MID","MIN","MINA","MINUS","MINUTE","MIRR","MOD","MODE.MULT","MODE.SNGL","MODEMULT","MODESNGL","MONTH","MROUND","MULTINOMIAL","MULTIPLY","NE","NEGBINOM.DIST","NEGBINOMDIST","NETWORKDAYS","NOMINAL","NORM.DIST","NORM.INV","NORM.S.DIST","NORM.S.INV","NORMDIST","NORMINV","NORMSDIST","NORMSINV","NOT","NOW","NPER","NPV","NUMBERS","OCT2BIN","OCT2DEC","OCT2HEX","ODD","OR","PDURATION","PEARSON","PERCENTILEEXC","PERCENTILEINC","PERCENTRANKEXC","PERCENTRANKINC","PERMUT","PERMUTATIONA","PHI","PI","PMT","POISSON.DIST","POISSONDIST","POW","POWER","PPMT","PROB","PRODUCT","PROPER","PV","QUARTILE.EXC","QUARTILE.INC","QUARTILEEXC","QUARTILEINC","QUOTIENT","RADIANS","RAND","RANDBETWEEN","RANK.AVG","RANK.EQ","RANKAVG","RANKEQ","RATE","REFERENCE","REGEXEXTRACT","REGEXMATCH","REGEXREPLACE","REPLACE","REPT","RIGHT","ROMAN","ROUND","ROUNDDOWN","ROUNDUP","ROW","ROWS","RRI","RSQ","SEARCH","SEC","SECH","SECOND","SERIESSUM","SIGN","SIN","SINH","SKEW","SKEW.P","SKEWP","SLN","SLOPE","SMALL","SPLIT","SPLIT","SQRT","SQRTPI","STANDARDIZE","STDEV.P","STDEV.S","STDEVA","STDEVP","STDEVPA","STDEVS","STEYX","SUBSTITUTE","SUBTOTAL","SUM","SUMIF","SUMIFS","SUMPRODUCT","SUMSQ","SUMX2MY2","SUMX2PY2","SUMXMY2","SWITCH","SYD","T","T.DIST","T.DIST.2T","T.DIST.RT","T.INV","T.INV.2T","TAN","TANH","TBILLEQ","TBILLPRICE","TBILLYIELD","TDIST","TDIST2T","TDISTRT","TIME","TIMEVALUE","TINV","TINV2T","TODAY","TRANSPOSE","TREND","TRIM","TRIMMEAN","TRUE","TRUNC","UNICHAR","UNICODE","UNIQUE","UPPER","VAR.P","VAR.S","VARA","VARP","VARPA","VARS","WEEKDAY","WEEKNUM","WEIBULL.DIST","WEIBULLDIST","WORKDAY","XIRR","XNPV","XOR","YEAR","YEARFRAC"]},function(r,t,e){"use strict";function n(r){var t=parseInt(r,10);return t=isNaN(t)?-1:Math.max(t-1,-1)}function a(r){var t="";return 0>r||(t=""+(r+1)),t}function u(r){var t=0;if("string"==typeof r){r=r.toUpperCase();for(var e=0,n=r.length-1;r.length>e;e+=1,n-=1)t+=Math.pow(f,n)*(l.indexOf(r[e])+1)}return--t}function i(r){for(var t="";r>=0;)t=String.fromCharCode(r%f+97)+t,r=Math.floor(r/f)-1;return t.toUpperCase()}function o(r){if("string"!=typeof r||!c.test(r))return[];var t=r.toUpperCase().match(c),e=t[1],a=t[2],i=t[3],o=t[4];return[{index:n(o),label:o,isAbsolute:"$"===i},{index:u(a),label:a,isAbsolute:"$"===e}]}function s(r,t){var e=(r.isAbsolute?"$":"")+a(r.index);return(t.isAbsolute?"$":"")+i(t.index)+e}t.__esModule=!0,t.rowLabelToIndex=n,t.rowIndexToLabel=a,t.columnLabelToIndex=u,t.columnIndexToLabel=i,t.extractLabel=o,t.toLabel=s;var l="ABCDEFGHIJKLMNOPQRSTUVWXYZ",f=l.length,c=/^([$])?([A-Za-z]+)([$])?([0-9]+)$/},function(r,t,e){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}t.__esModule=!0,t.rowLabelToIndex=t.rowIndexToLabel=t.columnLabelToIndex=t.columnIndexToLabel=t.toLabel=t.extractLabel=t.error=t.Parser=t.ERROR_VALUE=t.ERROR_REF=t.ERROR_NUM=t.ERROR_NULL=t.ERROR_NOT_AVAILABLE=t.ERROR_NAME=t.ERROR_DIV_ZERO=t.ERROR=t.SUPPORTED_FORMULAS=undefined;var a=e(15),u=n(a),i=e(12),o=n(i),s=e(2),l=n(s),f=e(13);t.SUPPORTED_FORMULAS=o["default"],t.ERROR=s.ERROR,t.ERROR_DIV_ZERO=s.ERROR_DIV_ZERO,t.ERROR_NAME=s.ERROR_NAME,t.ERROR_NOT_AVAILABLE=s.ERROR_NOT_AVAILABLE,t.ERROR_NULL=s.ERROR_NULL,t.ERROR_NUM=s.ERROR_NUM,t.ERROR_REF=s.ERROR_REF,t.ERROR_VALUE=s.ERROR_VALUE,t.Parser=u["default"],t.error=l["default"],t.extractLabel=f.extractLabel,t.toLabel=f.toLabel,t.columnIndexToLabel=f.columnIndexToLabel,t.columnLabelToIndex=f.columnLabelToIndex,t.rowIndexToLabel=f.rowIndexToLabel,t.rowLabelToIndex=f.rowLabelToIndex},function(r,t,e){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}function a(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function u(r,t){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?r:t}function i(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(r,t):r.__proto__=t)}t.__esModule=!0;var o=e(16),s=n(o),l=e(17),f=n(l),c=e(38),p=e(41),h=e(3),m=e(2),E=n(m),g=e(13);t["default"]=function(r){function t(){a(this,t);var e=u(this,r.call(this));return e.parser=new c.Parser,e.parser.yy={toNumber:h.toNumber,trimEdges:p.trimEdges,invertNumber:h.invertNumber,throwError:function(r){return e._throwError(r)},callVariable:function(r){return e._callVariable(r)},evaluateByOperator:f["default"],callFunction:function(r,t){return e._callFunction(r,t)},cellValue:function(r){return e._callCellValue(r)},rangeValue:function(r,t){return e._callRangeValue(r,t)}},e.variables=Object.create(null),e.functions=Object.create(null),e.setVariable("TRUE",!0).setVariable("FALSE",!1).setVariable("NULL",null),e}return i(t,r),t.prototype.parse=function(r){var t=null,e=null;try{t=""===r?"":this.parser.parse(r)}catch(a){var n=(0,E["default"])(a.message);e=n||(0,E["default"])(m.ERROR)}return t instanceof Error&&(e=(0,E["default"])(t.message)||(0,E["default"])(m.ERROR),t=null),{error:e,result:t}},t.prototype.setVariable=function(r,t){return this.variables[r]=t,this},t.prototype.getVariable=function(r){return this.variables[r]},t.prototype._callVariable=function(r){var t=this.getVariable(r);if(this.emit("callVariable",r,function(r){void 0!==r&&(t=r)}),void 0===t)throw Error(m.ERROR_NAME);return t},t.prototype.setFunction=function(r,t){return this.functions[r]=t,this},t.prototype.getFunction=function(r){return this.functions[r]},t.prototype._callFunction=function(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[],e=this.getFunction(r),n=void 0;return e&&(n=e(t)),this.emit("callFunction",r,t,function(r){void 0!==r&&(n=r)}),void 0===n?(0,f["default"])(r,t):n},t.prototype._callCellValue=function(r){r=r.toUpperCase();var t=(0,g.extractLabel)(r),e=t[0],n=t[1],a=void 0;return this.emit("callCellValue",{label:r,row:e,column:n},function(r){a=r}),a},t.prototype._callRangeValue=function(r,t){r=r.toUpperCase(),t=t.toUpperCase();var e=(0,g.extractLabel)(r),n=e[0],a=e[1],u=(0,g.extractLabel)(t),i=u[0],o=u[1],s={},l={};n.index>i.index?(s.row=i,l.row=n):(s.row=n,l.row=i),a.index>o.index?(s.column=o,l.column=a):(s.column=a,l.column=o),s.label=(0,g.toLabel)(s.row,s.column),l.label=(0,g.toLabel)(l.row,l.column);var f=[];return this.emit("callRangeValue",s,l,function(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];f=r}),f},t.prototype._throwError=function(r){if((0,m.isValidStrict)(r))throw Error(r);throw Error(m.ERROR)},t}(s["default"])},function(r,t){function e(){}e.prototype={on:function(r,t,e){var n=this.e||(this.e={});return(n[r]||(n[r]=[])).push({fn:t,ctx:e}),this},once:function(r,t,e){function n(){a.off(r,n),t.apply(e,arguments)}var a=this;return n._=t,this.on(r,n,e)},emit:function(r){var t=[].slice.call(arguments,1),e=((this.e||(this.e={}))[r]||[]).slice(),n=0,a=e.length;for(n;a>n;n++)e[n].fn.apply(e[n].ctx,t);return this},off:function(r,t){var e=this.e||(this.e={}),n=e[r],a=[];if(n&&t)for(var u=0,i=n.length;i>u;u++)n[u].fn!==t&&n[u].fn._!==t&&a.push(n[u]);return a.length?e[r]=a:delete e[r],this}},r.exports=e},function(r,t,e){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}function a(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];if(r=r.toUpperCase(),!L[r])throw Error(C.ERROR_NAME);return L[r].apply(L,t)}function u(r,t){Array.isArray(r)||(r=[r.toUpperCase()]),r.forEach(function(r){L[r]=t.isFactory?t(r):t})}t.__esModule=!0,t["default"]=a,t.registerOperation=u;var i=e(18),o=n(i),s=e(19),l=n(s),f=e(20),c=n(f),p=e(21),h=n(p),m=e(22),E=n(m),g=e(30),N=n(g),v=e(31),d=n(v),I=e(32),b=n(I),y=e(33),M=n(y),A=e(34),R=n(A),S=e(35),T=n(S),O=e(36),V=n(O),x=e(37),$=n(x),C=e(2),L=Object.create(null);u(o["default"].SYMBOL,o["default"]),u(l["default"].SYMBOL,l["default"]),u(c["default"].SYMBOL,c["default"]),u(h["default"].SYMBOL,h["default"]),u($["default"].SYMBOL,$["default"]),u(E["default"].SYMBOL,E["default"]),u(N["default"].SYMBOL,N["default"]),u(d["default"].SYMBOL,d["default"]),u(b["default"].SYMBOL,b["default"]),u(M["default"].SYMBOL,M["default"]),u(T["default"].SYMBOL,T["default"]),u(V["default"].SYMBOL,V["default"]),u(R["default"].SYMBOL,R["default"])},function(r,t,e){"use strict";function n(r){for(var t=arguments.length,e=Array(t>1?t-1:0),n=1;t>n;n++)e[n-1]=arguments[n];var i=e.reduce(function(r,t){return r+(0,a.toNumber)(t)},(0,a.toNumber)(r));if(isNaN(i))throw Error(u.ERROR_VALUE);return i}t.__esModule=!0,t.SYMBOL=undefined,t["default"]=n;var a=e(3),u=e(2);n.SYMBOL=t.SYMBOL="+"},function(r,t,e){"use strict";function n(){for(var r=arguments.length,t=Array(r),e=0;r>e;e++)t[e]=arguments[e];return t.reduce(function(r,t){return r+""+t},"")}t.__esModule=!0,t["default"]=n,n.SYMBOL=t.SYMBOL="&"},function(r,t,e){"use strict";function n(r){for(var t=arguments.length,e=Array(t>1?t-1:0),n=1;t>n;n++)e[n-1]=arguments[n];var i=e.reduce(function(r,t){return r/(0,a.toNumber)(t)},(0,a.toNumber)(r));if(i===Infinity)throw Error(u.ERROR_DIV_ZERO);if(isNaN(i))throw Error(u.ERROR_VALUE);return i}t.__esModule=!0,t.SYMBOL=undefined,t["default"]=n;var a=e(3),u=e(2);n.SYMBOL=t.SYMBOL="/"},function(r,t,e){"use strict";function n(r,t){return r===t}t.__esModule=!0,t["default"]=n,n.SYMBOL=t.SYMBOL="="},function(r,t,e){"use strict";function n(r){return function(){r=r.toUpperCase();var t=r.split("."),e=!1,n=void 0;if(1===t.length)u[t[0]]&&(e=!0,n=u[t[0]].apply(u,arguments));else{for(var a=t.length,i=0,o=u;a>i;)if(o=o[t[i]],i++,!o){o=null;break}o&&(e=!0,n=o.apply(undefined,arguments))}if(!e)throw Error(s.ERROR_NAME);return n}}t.__esModule=!0,t.SYMBOL=undefined,t["default"]=n;var a=e(23),u=function(r){if(r&&r.__esModule)return r;var t={};if(null!=r)for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e]);return t["default"]=r,t}(a),i=e(12),o=function(r){return r&&r.__esModule?r:{"default":r}}(i),s=e(2),l=t.SYMBOL=o["default"];n.isFactory=!0,n.SYMBOL=l},function(r,t,e){var n=[e(24),e(26),e(11),e(27),e(4),e(6),e(8),e(28),e(7),e(29),e(5),e(10)];for(var a in n){var u=n[a];for(var i in u)t[i]=t[i]||u[i]}},function(r,t,e){function n(r,t){if(t)for(var e in t)r[e]=t[e];return r}var a=e(4),u=e(5),i=e(11),o=e(8);t.BETADIST=u.BETA.DIST,t.BETAINV=u.BETA.INV,t.BINOMDIST=u.BINOM.DIST,t.CEILING=t.ISOCEILING=n(a.CEILING.MATH,a.CEILING),t.CEILINGMATH=a.CEILING.MATH,t.CEILINGPRECISE=a.CEILING.PRECISE,t.CHIDIST=u.CHISQ.DIST,t.CHIDISTRT=u.CHISQ.DIST.RT,t.CHIINV=u.CHISQ.INV,t.CHIINVRT=u.CHISQ.INV.RT,t.CHITEST=u.CHISQ.TEST,t.CONFIDENCE=n(u.CONFIDENCE.NORM,u.CONFIDENCE),t.COVAR=u.COVARIANCE.P,t.COVARIANCEP=u.COVARIANCE.P,t.COVARIANCES=u.COVARIANCE.S,t.CRITBINOM=u.BINOM.INV,t.EXPONDIST=u.EXPON.DIST,t.ERFCPRECISE=i.ERFC.PRECISE,t.ERFPRECISE=i.ERF.PRECISE,t.FDIST=u.F.DIST,t.FDISTRT=u.F.DIST.RT,t.FINVRT=u.F.INV.RT,t.FINV=u.F.INV,t.FLOOR=n(a.FLOOR.MATH,a.FLOOR),t.FLOORMATH=a.FLOOR.MATH,t.FLOORPRECISE=a.FLOOR.PRECISE,t.FTEST=u.F.TEST,t.GAMMADIST=u.GAMMA.DIST,t.GAMMAINV=u.GAMMA.INV,t.GAMMALNPRECISE=u.GAMMALN.PRECISE,t.HYPGEOMDIST=u.HYPGEOM.DIST,t.LOGINV=u.LOGNORM.INV,t.LOGNORMINV=u.LOGNORM.INV,t.LOGNORMDIST=u.LOGNORM.DIST,t.MODE=n(u.MODE.SNGL,u.MODE),t.MODEMULT=u.MODE.MULT,t.MODESNGL=u.MODE.SNGL,t.NEGBINOMDIST=u.NEGBINOM.DIST,t.NETWORKDAYSINTL=o.NETWORKDAYS.INTL,t.NORMDIST=u.NORM.DIST,t.NORMINV=u.NORM.INV,t.NORMSDIST=u.NORM.S.DIST,t.NORMSINV=u.NORM.S.INV,t.PERCENTILE=n(u.PERCENTILE.EXC,u.PERCENTILE),t.PERCENTILEEXC=u.PERCENTILE.EXC,t.PERCENTILEINC=u.PERCENTILE.INC,t.PERCENTRANK=n(u.PERCENTRANK.INC,u.PERCENTRANK),t.PERCENTRANKEXC=u.PERCENTRANK.EXC,t.PERCENTRANKINC=u.PERCENTRANK.INC,t.POISSON=n(u.POISSON.DIST,u.POISSON),t.POISSONDIST=u.POISSON.DIST,t.QUARTILE=n(u.QUARTILE.INC,u.QUARTILE),t.QUARTILEEXC=u.QUARTILE.EXC,t.QUARTILEINC=u.QUARTILE.INC,t.RANK=n(u.RANK.EQ,u.RANK),t.RANKAVG=u.RANK.AVG,t.RANKEQ=u.RANK.EQ,t.SKEWP=u.SKEW.P,t.STDEV=n(u.STDEV.S,u.STDEV),t.STDEVP=u.STDEV.P,t.STDEVS=u.STDEV.S,t.TDIST=u.T.DIST,t.TDISTRT=u.T.DIST.RT,t.TINV=u.T.INV,t.TTEST=u.T.TEST,t.VAR=n(u.VAR.S,u.VAR),t.VARP=u.VAR.P,t.VARS=u.VAR.S,t.WEIBULL=n(u.WEIBULL.DIST,u.WEIBULL),t.WEIBULLDIST=u.WEIBULL.DIST,t.WORKDAYINTL=o.WORKDAY.INTL,t.ZTEST=u.Z.TEST},function(r,t,e){function n(r,t){return r.reduce(function(r,e){return t*r+e},0)}function a(r,t,e,n,a){a||(a=-1);var u,i=2/r;if(0===t)return e;if(1===t)return n;for(var o=1;o!=t;++o)u=n*o*i+a*e,e=n,n=u;return n}function u(r,t,e,n,u){return function(i,o){if(0===o)return r(i);if(1===o)return t(i);if(0>o)throw e+": Order ("+o+") must be nonnegative";if(1==n&&0===i)throw e+": Undefined when x == 0";if(2==n&&0>=i)throw e+": Undefined when x <= 0";return a(i,o,r(i),t(i),u)}}var i=Math,o=function(){function r(r){var t,a,f,c=r*r,p=i.abs(r)-.785398164;return 8>i.abs(r)?(a=n(e,c),f=n(u,c),t=a/f):(c=64/c,a=n(o,c),f=n(s,c),t=i.sqrt(l/i.abs(r))*(i.cos(p)*a-i.sin(p)*f*8/i.abs(r))),t}function t(r){var t,e,a,u=r*r,o=i.abs(r)-2.356194491;return 8>Math.abs(r)?(e=r*n(f,u),a=n(c,u),t=e/a):(u=64/u,e=n(p,u),a=n(h,u),t=i.sqrt(l/i.abs(r))*(i.cos(o)*e-i.sin(o)*a*8/i.abs(r)),0>r&&(t=-t)),t}var e=[57568490574,-13362590354,651619640.7,-11214424.18,77392.33017,-184.9052456].reverse(),u=[57568490411,1029532985,9494680.718,59272.64853,267.8532712,1].reverse(),o=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),s=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34935152e-8].reverse(),l=.636619772,f=[72362614232,-7895059235,242396853.1,-2972611.439,15704.4826,-30.16036606].reverse(),c=[144725228442,2300535178,18583304.74,99447.43394,376.9991397,1].reverse(),p=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),h=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return function(e,n){if(0===(n=Math.round(n)))return r(i.abs(e));if(1===n)return t(i.abs(e));if(0>n)throw"BESSELJ: Order ("+n+") must be nonnegative";if(0===i.abs(e))return 0;var u,o,s,l,f,c,p,h,m=2/i.abs(e);if(i.abs(e)>n)u=a(e,n,r(i.abs(e)),t(i.abs(e)),-1);else{for(s=2*i.floor((n+i.floor(i.sqrt(40*n)))/2),l=0,c=u=f=0,p=1,o=s;o>0;o--)h=o*m*p-c,c=p,p=h,i.abs(p)>1e10&&(p*=1e-10,c*=1e-10,u*=1e-10,f*=1e-10),l&&(f+=p),l=!l,o==n&&(u=c);f=2*f-p,u/=f}return 0>e&&n%2?-u:u}}(),s=function(){function r(r){var t,u,c,p=r*r,h=r-.785398164;return 8>r?(u=n(e,p),c=n(a,p),t=u/c+f*o(r,0)*i.log(r)):(p=64/p,u=n(s,p),c=n(l,p),t=i.sqrt(f/r)*(i.sin(h)*u+i.cos(h)*c*8/r)),t}function t(r){var t,e,a,u=r*r,s=r-2.356194491;return 8>r?(e=r*n(c,u),a=n(p,u),t=e/a+f*(o(r,1)*i.log(r)-1/r)):(u=64/u,e=n(h,u),a=n(m,u),t=i.sqrt(f/r)*(i.sin(s)*e+i.cos(s)*a*8/r)),t}var e=[-2957821389,7062834065,-512359803.6,10879881.29,-86327.92757,228.4622733].reverse(),a=[40076544269,745249964.8,7189466.438,47447.2647,226.1030244,1].reverse(),s=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),l=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34945152e-8].reverse(),f=.636619772,c=[-4900604943e3,127527439e4,-51534381390,734926455.1,-4237922.726,8511.937935].reverse(),p=[249958057e5,424441966400,3733650367,22459040.02,102042.605,354.9632885,1].reverse(),h=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),m=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return u(r,t,"BESSELY",1,-1)}(),l=function(){function r(r){return r>3.75?i.exp(i.abs(r))/i.sqrt(i.abs(r))*n(a,3.75/i.abs(r)):n(e,r*r/14.0625)}function t(r){return 3.75>r?r*n(u,r*r/14.0625):(0>r?-1:1)*i.exp(i.abs(r))/i.sqrt(i.abs(r))*n(o,3.75/i.abs(r))}var e=[1,3.5156229,3.0899424,1.2067492,.2659732,.0360768,.0045813].reverse(),a=[.39894228,.01328592,.00225319,-.00157565,.00916281,-.02057706,.02635537,-.01647633,.00392377].reverse(),u=[.5,.87890594,.51498869,.15084934,.02658733,.00301532,32411e-8].reverse(),o=[.39894228,-.03988024,-.00362018,.00163801,-.01031555,.02282967,-.02895312,.01787654,-.00420059].reverse();return function s(e,n){if(0===(n=Math.round(n)))return r(e);if(1==n)return t(e);if(0>n)throw"BESSELI Order ("+n+") must be nonnegative";if(0===i.abs(e))return 0;var a,u,o,l,f,c,p=2/i.abs(e);for(o=2*i.round((n+i.round(i.sqrt(40*n)))/2),l=a=0,f=1,u=o;u>0;u--)c=u*p*f+l,l=f,f=c,i.abs(f)>1e10&&(f*=1e-10,l*=1e-10,a*=1e-10),u==n&&(a=l);return a*=s(e,0)/f,0>e&&n%2?-a:a}}(),f=function(){function r(r){return r>2?i.exp(-r)/i.sqrt(r)*n(a,2/r):-i.log(r/2)*l(r,0)+n(e,r*r/4)}function t(r){return r>2?i.exp(-r)/i.sqrt(r)*n(s,2/r):i.log(r/2)*l(r,1)+1/r*n(o,r*r/4)}var e=[-.57721566,.4227842,.23069756,.0348859,.00262698,1075e-7,74e-7].reverse(),a=[1.25331414,-.07832358,.02189568,-.01062446,.00587872,-.0025154,53208e-8].reverse(),o=[1,.15443144,-.67278579,-.18156897,-.01919402,-.00110404,-4686e-8].reverse(),s=[1.25331414,.23498619,-.0365562,.01504268,-.00780353,.00325614,-68245e-8].reverse();return u(r,t,"BESSELK",2,1)}();t.besselj=o,t.bessely=s,t.besseli=l,t.besselk=f},function(module,exports,__webpack_require__){function compact(r){var t=[];return utils.arrayEach(r,function(r){r&&t.push(r)}),t}function findResultIndex(database,criterias){for(var matches={},i=1;database[0].length>i;++i)matches[i]=!0;var maxCriteriaLength=criterias[0].length;for(i=1;criterias.length>i;++i)criterias[i].length>maxCriteriaLength&&(maxCriteriaLength=criterias[i].length);for(var k=1;database.length>k;++k)for(var l=1;database[k].length>l;++l){for(var currentCriteriaResult=!1,hasMatchingCriteria=!1,j=0;criterias.length>j;++j){var criteria=criterias[j];if(criteria.length>=maxCriteriaLength){var criteriaField=criteria[0];if(database[k][0]===criteriaField){hasMatchingCriteria=!0;for(var p=1;criteria.length>p;++p)currentCriteriaResult=currentCriteriaResult||eval(database[k][l]+criteria[p])}}}hasMatchingCriteria&&(matches[l]=matches[l]&¤tCriteriaResult)}for(var result=[],n=0;database[0].length>n;++n)matches[n]&&result.push(n-1);return result}var error=__webpack_require__(0),stats=__webpack_require__(5),maths=__webpack_require__(4),utils=__webpack_require__(1);exports.FINDFIELD=function(r,t){var e=null;return utils.arrayEach(r,function(r,n){if(r[0]===t)return e=n,!1}),null==e?error.value:e},exports.DAVERAGE=function(r,t,e){if(isNaN(t)&&"string"!=typeof t)return error.value;var n=findResultIndex(r,e),a=[];if("string"==typeof t){var u=exports.FINDFIELD(r,t);a=utils.rest(r[u])}else a=utils.rest(r[t]);var i=0;return utils.arrayEach(n,function(r){i+=a[r]}),0===n.length?error.div0:i/n.length},exports.DCOUNT=function(r,t,e){if(isNaN(t)&&"string"!=typeof t)return error.value;var n=findResultIndex(r,e),a=[];if("string"==typeof t){var u=exports.FINDFIELD(r,t);a=utils.rest(r[u])}else a=utils.rest(r[t]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.COUNT(i)},exports.DCOUNTA=function(r,t,e){if(isNaN(t)&&"string"!=typeof t)return error.value;var n=findResultIndex(r,e),a=[];if("string"==typeof t){var u=exports.FINDFIELD(r,t);a=utils.rest(r[u])}else a=utils.rest(r[t]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.COUNTA(i)},exports.DGET=function(r,t,e){if(isNaN(t)&&"string"!=typeof t)return error.value;var n=findResultIndex(r,e),a=[];if("string"==typeof t){var u=exports.FINDFIELD(r,t);a=utils.rest(r[u])}else a=utils.rest(r[t]);return 0===n.length?error.value:n.length>1?error.num:a[n[0]]},exports.DMAX=function(r,t,e){if(isNaN(t)&&"string"!=typeof t)return error.value;var n=findResultIndex(r,e),a=[];if("string"==typeof t){var u=exports.FINDFIELD(r,t);a=utils.rest(r[u])}else a=utils.rest(r[t]);var i=a[n[0]];return utils.arrayEach(n,function(r){a[r]>i&&(i=a[r])}),i},exports.DMIN=function(r,t,e){if(isNaN(t)&&"string"!=typeof t)return error.value;var n=findResultIndex(r,e),a=[];if("string"==typeof t){var u=exports.FINDFIELD(r,t);a=utils.rest(r[u])}else a=utils.rest(r[t]);var i=a[n[0]];return utils.arrayEach(n,function(r){i>a[r]&&(i=a[r])}),i},exports.DPRODUCT=function(r,t,e){if(isNaN(t)&&"string"!=typeof t)return error.value;var n=findResultIndex(r,e),a=[];if("string"==typeof t){var u=exports.FINDFIELD(r,t);a=utils.rest(r[u])}else a=utils.rest(r[t]);var i=[];utils.arrayEach(n,function(r){i.push(a[r])}),i=compact(i);var o=1;return utils.arrayEach(i,function(r){o*=r}),o},exports.DSTDEV=function(r,t,e){if(isNaN(t)&&"string"!=typeof t)return error.value;var n=findResultIndex(r,e),a=[];if("string"==typeof t){var u=exports.FINDFIELD(r,t);a=utils.rest(r[u])}else a=utils.rest(r[t]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),i=compact(i),stats.STDEV.S(i)},exports.DSTDEVP=function(r,t,e){if(isNaN(t)&&"string"!=typeof t)return error.value;var n=findResultIndex(r,e),a=[];if("string"==typeof t){var u=exports.FINDFIELD(r,t);a=utils.rest(r[u])}else a=utils.rest(r[t]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),i=compact(i),stats.STDEV.P(i)},exports.DSUM=function(r,t,e){if(isNaN(t)&&"string"!=typeof t)return error.value;var n=findResultIndex(r,e),a=[];if("string"==typeof t){var u=exports.FINDFIELD(r,t);a=utils.rest(r[u])}else a=utils.rest(r[t]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),maths.SUM(i)},exports.DVAR=function(r,t,e){if(isNaN(t)&&"string"!=typeof t)return error.value;var n=findResultIndex(r,e),a=[];if("string"==typeof t){var u=exports.FINDFIELD(r,t);a=utils.rest(r[u])}else a=utils.rest(r[t]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.VAR.S(i)},exports.DVARP=function(r,t,e){if(isNaN(t)&&"string"!=typeof t)return error.value;var n=findResultIndex(r,e),a=[];if("string"==typeof t){var u=exports.FINDFIELD(r,t);a=utils.rest(r[u])}else a=utils.rest(r[t]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.VAR.P(i)}},function(r,t,e){var n=e(0),a=e(1),u=e(7);t.AND=function(){for(var r=a.flatten(arguments),t=!0,e=0;r.length>e;e++)r[e]||(t=!1);return t},t.CHOOSE=function(){if(2>arguments.length)return n.na;var r=arguments[0];return 1>r||r>254?n.value:r+1>arguments.length?n.value:arguments[r]},t.FALSE=function(){return!1},t.IF=function(r,t,e){return r?t:e},t.IFERROR=function(r,t){return u.ISERROR(r)?t:r},t.IFNA=function(r,t){return r===n.na?t:r},t.NOT=function(r){return!r},t.OR=function(){for(var r=a.flatten(arguments),t=!1,e=0;r.length>e;e++)r[e]&&(t=!0);return t},t.TRUE=function(){return!0},t.XOR=function(){for(var r=a.flatten(arguments),t=0,e=0;r.length>e;e++)r[e]&&t++;return!!(1&Math.floor(Math.abs(t)))},t.SWITCH=function(){var r;if(arguments.length>0){var t=arguments[0],e=arguments.length-1,a=Math.floor(e/2),u=!1,i=e%2!=0,o=e%2==0?null:arguments[arguments.length-1];if(a)for(var s=0;a>s;s++)if(t===arguments[2*s+1]){r=arguments[2*s+2],u=!0;break}u||(r=i?o:n.na)}else r=n.value;return r}},function(r,t,e){function n(r){return r&&r.getTime&&!isNaN(r.getTime())}function a(r){return r instanceof Date?r:new Date(r)}var u=e(0),i=e(8),o=e(1);t.ACCRINT=function(r,t,e,o,s,l,f){return r=a(r),t=a(t),e=a(e),n(r)&&n(t)&&n(e)?o>0&&s>0?-1===[1,2,4].indexOf(l)?u.num:-1===[0,1,2,3,4].indexOf(f)?u.num:e>r?(s=s||0,f=f||0,s*o*i.YEARFRAC(r,e,f)):u.num:u.num:u.value},t.ACCRINTM=function(){throw Error("ACCRINTM is not implemented")},t.AMORDEGRC=function(){throw Error("AMORDEGRC is not implemented")},t.AMORLINC=function(){throw Error("AMORLINC is not implemented")},t.COUPDAYBS=function(){throw Error("COUPDAYBS is not implemented")},t.COUPDAYS=function(){throw Error("COUPDAYS is not implemented")},t.COUPDAYSNC=function(){throw Error("COUPDAYSNC is not implemented")},t.COUPNCD=function(){throw Error("COUPNCD is not implemented")},t.COUPNUM=function(){throw Error("COUPNUM is not implemented")},t.COUPPCD=function(){throw Error("COUPPCD is not implemented")},t.CUMIPMT=function(r,e,n,a,i,s){if(r=o.parseNumber(r),e=o.parseNumber(e),n=o.parseNumber(n),o.anyIsError(r,e,n))return u.value;if(0>=r||0>=e||0>=n)return u.num;if(1>a||1>i||a>i)return u.num;if(0!==s&&1!==s)return u.num;var l=t.PMT(r,e,n,0,s),f=0;1===a&&0===s&&(f=-n,a++);for(var c=a;i>=c;c++)f+=1===s?t.FV(r,c-2,l,n,1)-l:t.FV(r,c-1,l,n,0);return f*=r},t.CUMPRINC=function(r,e,n,a,i,s){if(r=o.parseNumber(r),e=o.parseNumber(e),n=o.parseNumber(n),o.anyIsError(r,e,n))return u.value;if(0>=r||0>=e||0>=n)return u.num;if(1>a||1>i||a>i)return u.num;if(0!==s&&1!==s)return u.num;var l=t.PMT(r,e,n,0,s),f=0;1===a&&(f=0===s?l+n*r:l,a++);for(var c=a;i>=c;c++)f+=s>0?l-(t.FV(r,c-2,l,n,1)-l)*r:l-t.FV(r,c-1,l,n,0)*r;return f},t.DB=function(r,t,e,n,a){if(a=a===undefined?12:a,r=o.parseNumber(r),t=o.parseNumber(t),e=o.parseNumber(e),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,t,e,n,a))return u.value;if(0>r||0>t||0>e||0>n)return u.num;if(-1===[1,2,3,4,5,6,7,8,9,10,11,12].indexOf(a))return u.num;if(n>e)return u.num;if(t>=r)return 0;for(var i=(1-Math.pow(t/r,1/e)).toFixed(3),s=r*i*a/12,l=s,f=0,c=n===e?e-1:n,p=2;c>=p;p++)f=(r-l)*i,l+=f;return 1===n?s:n===e?(r-l)*i:f},t.DDB=function(r,t,e,n,a){if(a=a===undefined?2:a,r=o.parseNumber(r),t=o.parseNumber(t),e=o.parseNumber(e),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,t,e,n,a))return u.value;if(0>r||0>t||0>e||0>n||0>=a)return u.num;if(n>e)return u.num;if(t>=r)return 0;for(var i=0,s=0,l=1;n>=l;l++)s=Math.min(a/e*(r-i),r-t-i),i+=s;return s},t.DISC=function(){throw Error("DISC is not implemented")},t.DOLLARDE=function(r,t){if(r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t))return u.value;if(0>t)return u.num;if(t>=0&&1>t)return u.div0;t=parseInt(t,10);var e=parseInt(r,10);e+=r%1*Math.pow(10,Math.ceil(Math.log(t)/Math.LN10))/t;var n=Math.pow(10,Math.ceil(Math.log(t)/Math.LN2)+1);return e=Math.round(e*n)/n},t.DOLLARFR=function(r,t){if(r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t))return u.value;if(0>t)return u.num;if(t>=0&&1>t)return u.div0;t=parseInt(t,10);var e=parseInt(r,10);return e+=r%1*Math.pow(10,-Math.ceil(Math.log(t)/Math.LN10))*t},t.DURATION=function(){throw Error("DURATION is not implemented")},t.EFFECT=function(r,t){return r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t)?u.value:0>=r||1>t?u.num:(t=parseInt(t,10),Math.pow(1+r/t,t)-1)},t.FV=function(r,t,e,n,a){if(n=n||0,a=a||0,r=o.parseNumber(r),t=o.parseNumber(t),e=o.parseNumber(e),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,t,e,n,a))return u.value;var i;if(0===r)i=n+e*t;else{var s=Math.pow(1+r,t);i=1===a?n*s+e*(1+r)*(s-1)/r:n*s+e*(s-1)/r}return-i},t.FVSCHEDULE=function(r,t){if(r=o.parseNumber(r),t=o.parseNumberArray(o.flatten(t)),o.anyIsError(r,t))return u.value;for(var e=t.length,n=r,a=0;e>a;a++)n*=1+t[a];return n},t.INTRATE=function(){throw Error("INTRATE is not implemented")},t.IPMT=function(r,e,n,a,i,s){if(i=i||0,s=s||0,r=o.parseNumber(r),e=o.parseNumber(e),n=o.parseNumber(n),a=o.parseNumber(a),i=o.parseNumber(i),s=o.parseNumber(s),o.anyIsError(r,e,n,a,i,s))return u.value;var l=t.PMT(r,n,a,i,s);return(1===e?1===s?0:-a:1===s?t.FV(r,e-2,l,a,1)-l:t.FV(r,e-1,l,a,0))*r},t.IRR=function(r,t){if(t=t||0,r=o.parseNumberArray(o.flatten(r)),t=o.parseNumber(t),o.anyIsError(r,t))return u.value;for(var e=[],n=!1,a=!1,i=0;r.length>i;i++)e[i]=0===i?0:e[i-1]+365,r[i]>0&&(n=!0),0>r[i]&&(a=!0);if(!n||!a)return u.num;t=t===undefined?.1:t;var s,l,f,c=t,p=!0;do{f=function(r,t,e){for(var n=e+1,a=r[0],u=1;r.length>u;u++)a+=r[u]/Math.pow(n,(t[u]-t[0])/365);return a}(r,e,c),s=c-f/function(r,t,e){for(var n=e+1,a=0,u=1;r.length>u;u++){var i=(t[u]-t[0])/365;a-=i*r[u]/Math.pow(n,i+1)}return a}(r,e,c),l=Math.abs(s-c),c=s,p=l>1e-10&&Math.abs(f)>1e-10}while(p);return c},t.ISPMT=function(r,t,e,n){return r=o.parseNumber(r),t=o.parseNumber(t),e=o.parseNumber(e),n=o.parseNumber(n),o.anyIsError(r,t,e,n)?u.value:n*r*(t/e-1)},t.MDURATION=function(){throw Error("MDURATION is not implemented")},t.MIRR=function(r,e,n){if(r=o.parseNumberArray(o.flatten(r)),e=o.parseNumber(e),n=o.parseNumber(n),o.anyIsError(r,e,n))return u.value;for(var a=r.length,i=[],s=[],l=0;a>l;l++)0>r[l]?i.push(r[l]):s.push(r[l]);var f=-t.NPV(n,s)*Math.pow(1+n,a-1),c=t.NPV(e,i)*(1+e);return Math.pow(f/c,1/(a-1))-1},t.NOMINAL=function(r,t){return r=o.parseNumber(r),t=o.parseNumber(t),o.anyIsError(r,t)?u.value:0>=r||1>t?u.num:(t=parseInt(t,10),(Math.pow(r+1,1/t)-1)*t)},t.NPER=function(r,t,e,n,a){if(a=a===undefined?0:a,n=n===undefined?0:n,r=o.parseNumber(r),t=o.parseNumber(t),e=o.parseNumber(e),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,t,e,n,a))return u.value;var i=t*(1+r*a)-n*r,s=e*r+t*(1+r*a);return Math.log(i/s)/Math.log(1+r)},t.NPV=function(){var r=o.parseNumberArray(o.flatten(arguments));if(r instanceof Error)return r;for(var t=r[0],e=0,n=1;r.length>n;n++)e+=r[n]/Math.pow(1+t,n);return e},t.ODDFPRICE=function(){throw Error("ODDFPRICE is not implemented")},t.ODDFYIELD=function(){throw Error("ODDFYIELD is not implemented")},t.ODDLPRICE=function(){throw Error("ODDLPRICE is not implemented")},t.ODDLYIELD=function(){throw Error("ODDLYIELD is not implemented")},t.PDURATION=function(r,t,e){return r=o.parseNumber(r),t=o.parseNumber(t),e=o.parseNumber(e),o.anyIsError(r,t,e)?u.value:r>0?(Math.log(e)-Math.log(t))/Math.log(1+r):u.num},t.PMT=function(r,t,e,n,a){if(n=n||0,a=a||0,r=o.parseNumber(r),t=o.parseNumber(t),e=o.parseNumber(e),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,t,e,n,a))return u.value;var i;if(0===r)i=(e+n)/t;else{var s=Math.pow(1+r,t);i=1===a?(n*r/(s-1)+e*r/(1-1/s))/(1+r):n*r/(s-1)+e*r/(1-1/s)}return-i},t.PPMT=function(r,e,n,a,i,s){return i=i||0,s=s||0,r=o.parseNumber(r),n=o.parseNumber(n),a=o.parseNumber(a),i=o.parseNumber(i),s=o.parseNumber(s),o.anyIsError(r,n,a,i,s)?u.value:t.PMT(r,n,a,i,s)-t.IPMT(r,e,n,a,i,s)},t.PRICE=function(){throw Error("PRICE is not implemented")},t.PRICEDISC=function(){throw Error("PRICEDISC is not implemented")},t.PRICEMAT=function(){throw Error("PRICEMAT is not implemented")},t.PV=function(r,t,e,n,a){return n=n||0,a=a||0,r=o.parseNumber(r),t=o.parseNumber(t),e=o.parseNumber(e),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,t,e,n,a)?u.value:0===r?-e*t-n:((1-Math.pow(1+r,t))/r*e*(1+r*a)-n)/Math.pow(1+r,t)},t.RATE=function(r,t,e,n,a,i){if(i=i===undefined?.01:i,n=n===undefined?0:n,a=a===undefined?0:a,r=o.parseNumber(r),t=o.parseNumber(t),e=o.parseNumber(e),n=o.parseNumber(n),a=o.parseNumber(a),i=o.parseNumber(i),o.anyIsError(r,t,e,n,a,i))return u.value;var s,l,f,c,p=0,h=0,m=0,E=i;for(1e-10>Math.abs(E)?s=e*(1+r*E)+t*(1+E*a)*r+n:(h=Math.exp(r*Math.log(1+E)),s=e*h+t*(1/E+a)*(h-1)+n),l=e+t*r+n,f=e*h+t*(1/E+a)*(h-1)+n,m=c=0,p=E;Math.abs(l-f)>1e-10&&50>m;)E=(f*c-l*p)/(f-l),c=p,p=E,1e-10>Math.abs(E)?s=e*(1+r*E)+t*(1+E*a)*r+n:(h=Math.exp(r*Math.log(1+E)),s=e*h+t*(1/E+a)*(h-1)+n),l=f,f=s,++m;return E},t.RECEIVED=function(){throw Error("RECEIVED is not implemented")},t.RRI=function(r,t,e){return r=o.parseNumber(r),t=o.parseNumber(t),e=o.parseNumber(e),o.anyIsError(r,t,e)?u.value:0===r||0===t?u.num:Math.pow(e/t,1/r)-1},t.SLN=function(r,t,e){return r=o.parseNumber(r),t=o.parseNumber(t),e=o.parseNumber(e),o.anyIsError(r,t,e)?u.value:0===e?u.num:(r-t)/e},t.SYD=function(r,t,e,n){return r=o.parseNumber(r),t=o.parseNumber(t),e=o.parseNumber(e),n=o.parseNumber(n),o.anyIsError(r,t,e,n)?u.value:0===e?u.num:1>n||n>e?u.num:(n=parseInt(n,10),(r-t)*(e-n+1)*2/(e*(e+1)))},t.TBILLEQ=function(r,t,e){return r=o.parseDate(r),t=o.parseDate(t),e=o.parseNumber(e),o.anyIsError(r,t,e)?u.value:e>0?r>t?u.num:t-r>31536e6?u.num:365*e/(360-e*i.DAYS360(r,t,!1)):u.num},t.TBILLPRICE=function(r,t,e){return r=o.parseDate(r),t=o.parseDate(t),e=o.parseNumber(e),o.anyIsError(r,t,e)?u.value:e>0?r>t?u.num:t-r>31536e6?u.num:100*(1-e*i.DAYS360(r,t,!1)/360):u.num},t.TBILLYIELD=function(r,t,e){return r=o.parseDate(r),t=o.parseDate(t),e=o.parseNumber(e),o.anyIsError(r,t,e)?u.value:e>0?r>t?u.num:t-r>31536e6?u.num:360*(100-e)/(e*i.DAYS360(r,t,!1)):u.num},t.VDB=function(){throw Error("VDB is not implemented")},t.XNPV=function(r,t,e){if(r=o.parseNumber(r),t=o.parseNumberArray(o.flatten(t)),e=o.parseDateArray(o.flatten(e)),o.anyIsError(r,t,e))return u.value;for(var n=0,a=0;t.length>a;a++)n+=t[a]/Math.pow(1+r,i.DAYS(e[a],e[0])/365);return n},t.YIELD=function(){throw Error("YIELD is not implemented")},t.YIELDDISC=function(){throw Error("YIELDDISC is not implemented")},t.YIELDMAT=function(){throw Error("YIELDMAT is not implemented")}},function(r,t,e){var n=e(0),a=e(1);t.MATCH=function(r,t,e){if(!r&&!t)return n.na;if(2===arguments.length&&(e=1),!(t instanceof Array))return n.na;if(-1!==e&&0!==e&&1!==e)return n.na;for(var a,u,i=0;t.length>i;i++)if(1===e){if(t[i]===r)return i+1;r>t[i]&&(u?t[i]>u&&(a=i+1,u=t[i]):(a=i+1,u=t[i]))}else if(0===e){if("string"==typeof r){if(r=r.replace(/\?/g,"."),t[i].toLowerCase().match(r.toLowerCase()))return i+1}else if(t[i]===r)return i+1}else if(-1===e){if(t[i]===r)return i+1;t[i]>r&&(u?u>t[i]&&(a=i+1,u=t[i]):(a=i+1,u=t[i]))}return a||n.na},t.VLOOKUP=function(r,t,e,a){if(!r||!t||!e)return n.na;a=a||!1;for(var u=0;t.length>u;u++){var i=t[u];if(!a&&i[0]===r||i[0]===r||a&&"string"==typeof i[0]&&-1!==i[0].toLowerCase().indexOf(r.toLowerCase()))return i.length+1>e?i[e-1]:n.ref}return n.na},t.HLOOKUP=function(r,t,e,u){if(!r||!t||!e)return n.na;u=u||!1;for(var i=a.transpose(t),o=0;i.length>o;o++){var s=i[o];if(!u&&s[0]===r||s[0]===r||u&&"string"==typeof s[0]&&-1!==s[0].toLowerCase().indexOf(r.toLowerCase()))return s.length+1>e?s[e-1]:n.ref}return n.na}},function(r,t,e){"use strict";function n(r,t){return r>t}t.__esModule=!0,t["default"]=n,n.SYMBOL=t.SYMBOL=">"},function(r,t,e){"use strict";function n(r,t){return r>=t}t.__esModule=!0,t["default"]=n,n.SYMBOL=t.SYMBOL=">="},function(r,t,e){"use strict";function n(r,t){return t>r}t.__esModule=!0,t["default"]=n,n.SYMBOL=t.SYMBOL="<"},function(r,t,e){"use strict";function n(r,t){return t>=r}t.__esModule=!0,t["default"]=n,n.SYMBOL=t.SYMBOL="<="},function(r,t,e){"use strict";function n(r){for(var t=arguments.length,e=Array(t>1?t-1:0),n=1;t>n;n++)e[n-1]=arguments[n];var i=e.reduce(function(r,t){return r-(0,a.toNumber)(t)},(0,a.toNumber)(r));if(isNaN(i))throw Error(u.ERROR_VALUE);return i}t.__esModule=!0,t.SYMBOL=undefined,t["default"]=n;var a=e(3),u=e(2);n.SYMBOL=t.SYMBOL="-"},function(r,t,e){"use strict";function n(r){for(var t=arguments.length,e=Array(t>1?t-1:0),n=1;t>n;n++)e[n-1]=arguments[n];var i=e.reduce(function(r,t){return r*(0,a.toNumber)(t)},(0,a.toNumber)(r));if(isNaN(i))throw Error(u.ERROR_VALUE);return i}t.__esModule=!0,t.SYMBOL=undefined,t["default"]=n;var a=e(3),u=e(2);n.SYMBOL=t.SYMBOL="*"},function(r,t,e){"use strict";function n(r,t){return r!==t}t.__esModule=!0,t["default"]=n,n.SYMBOL=t.SYMBOL="<>"},function(r,t,e){"use strict";function n(r,t){var e=Math.pow((0,a.toNumber)(r),(0,a.toNumber)(t));if(isNaN(e))throw Error(u.ERROR_VALUE);return e}t.__esModule=!0,t.SYMBOL=undefined,t["default"]=n;var a=e(3),u=e(2);n.SYMBOL=t.SYMBOL="^"},function(module,exports,__webpack_require__){(function(module,process){var grammarParser=function(){function Parser(){this.yy={}}var o=function(r,t,e,n){for(e=e||{},n=r.length;n--;e[r[n]]=t);return e},$V0=[1,5],$V1=[1,8],$V2=[1,6],$V3=[1,7],$V4=[1,9],$V5=[1,14],$V6=[1,15],$V7=[1,16],$V8=[1,12],$V9=[1,13],$Va=[1,17],$Vb=[1,19],$Vc=[1,20],$Vd=[1,21],$Ve=[1,22],$Vf=[1,23],$Vg=[1,24],$Vh=[1,25],$Vi=[1,26],$Vj=[1,27],$Vk=[1,28],$Vl=[5,9,10,11,13,14,15,16,17,18,19,20,29,30],$Vm=[5,9,10,11,13,14,15,16,17,18,19,20,29,30,32],$Vn=[5,9,10,11,13,14,15,16,17,18,19,20,29,30,34],$Vo=[5,10,11,13,14,15,16,17,29,30],$Vp=[5,10,13,14,15,16,29,30],$Vq=[5,10,11,13,14,15,16,17,18,19,29,30],$Vr=[13,29,30],parser={trace:function(){},yy:{},symbols_:{error:2,expressions:3,expression:4,EOF:5,variableSequence:6,number:7,STRING:8,"&":9,"=":10,"+":11,"(":12,")":13,"<":14,">":15,NOT:16,"-":17,"*":18,"/":19,"^":20,FUNCTION:21,expseq:22,cell:23,ABSOLUTE_CELL:24,RELATIVE_CELL:25,MIXED_CELL:26,":":27,ARRAY:28,";":29,",":30,VARIABLE:31,DECIMAL:32,NUMBER:33,"%":34,ERROR:35,$accept:0,$end:1},terminals_:{5:"EOF",8:"STRING",9:"&",10:"=",11:"+",12:"(",13:")",14:"<",15:">",16:"NOT",17:"-",18:"*",19:"/",20:"^",21:"FUNCTION",24:"ABSOLUTE_CELL",25:"RELATIVE_CELL",26:"MIXED_CELL",27:":",28:"ARRAY",29:";",30:",",31:"VARIABLE",32:"DECIMAL",33:"NUMBER",34:"%",35:"ERROR"},productions_:[0,[3,2],[4,1],[4,1],[4,1],[4,3],[4,3],[4,3],[4,3],[4,4],[4,4],[4,4],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,2],[4,2],[4,3],[4,4],[4,1],[4,1],[4,2],[23,1],[23,1],[23,1],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[22,1],[22,1],[22,3],[22,3],[6,1],[6,3],[7,1],[7,3],[7,2],[2,1]],performAction:function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:return $$[$0-1];case 2:this.$=yy.callVariable($$[$0][0]);break;case 3:this.$=yy.toNumber($$[$0]);break;case 4:this.$=yy.trimEdges($$[$0]);break;case 5:this.$=yy.evaluateByOperator("&",[$$[$0-2],$$[$0]]);break;case 6:this.$=yy.evaluateByOperator("=",[$$[$0-2],$$[$0]]);break;case 7:this.$=yy.evaluateByOperator("+",[$$[$0-2],$$[$0]]);break;case 8:this.$=$$[$0-1];break;case 9:this.$=yy.evaluateByOperator("<=",[$$[$0-3],$$[$0]]);break;case 10:this.$=yy.evaluateByOperator(">=",[$$[$0-3],$$[$0]]);break;case 11:this.$=yy.evaluateByOperator("<>",[$$[$0-3],$$[$0]]);break;case 12:this.$=yy.evaluateByOperator("NOT",[$$[$0-2],$$[$0]]);break;case 13:this.$=yy.evaluateByOperator(">",[$$[$0-2],$$[$0]]);break;case 14:this.$=yy.evaluateByOperator("<",[$$[$0-2],$$[$0]]);break;case 15:this.$=yy.evaluateByOperator("-",[$$[$0-2],$$[$0]]);break;case 16:this.$=yy.evaluateByOperator("*",[$$[$0-2],$$[$0]]);break;case 17:this.$=yy.evaluateByOperator("/",[$$[$0-2],$$[$0]]);break;case 18:this.$=yy.evaluateByOperator("^",[$$[$0-2],$$[$0]]);break;case 19:var n1=yy.invertNumber($$[$0]);this.$=n1,isNaN(this.$)&&(this.$=0);break;case 20:var n1=yy.toNumber($$[$0]);this.$=n1,isNaN(this.$)&&(this.$=0);break;case 21:this.$=yy.callFunction($$[$0-2]);break;case 22:this.$=yy.callFunction($$[$0-3],$$[$0-1]);break;case 26:case 27:case 28:this.$=yy.cellValue($$[$0]);break;case 29:case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:this.$=yy.rangeValue($$[$0-2],$$[$0]);break;case 38:case 42:this.$=[$$[$0]];break;case 39:var result=[],arr=eval("["+yytext+"]");arr.forEach(function(r){result.push(r)}),this.$=result;break;case 40:case 41:$$[$0-2].push($$[$0]),this.$=$$[$0-2];break;case 43:this.$=Array.isArray($$[$0-2])?$$[$0-2]:[$$[$0-2]],this.$.push($$[$0]);break;case 44:this.$=$$[$0];break;case 45:this.$=1*($$[$0-2]+"."+$$[$0]);break;case 46:this.$=.01*$$[$0-1];break;case 47:this.$=yy.throwError($$[$0])}},table:[{2:11,3:1,4:2,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{1:[3]},{5:[1,18],9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk},o($Vl,[2,2],{32:[1,29]}),o($Vl,[2,3],{34:[1,30]}),o($Vl,[2,4]),{2:11,4:31,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:32,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:33,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{12:[1,34]},o($Vl,[2,23]),o($Vl,[2,24],{2:35,35:$Va}),o($Vm,[2,42]),o($Vn,[2,44],{32:[1,36]}),o($Vl,[2,26],{27:[1,37]}),o($Vl,[2,27],{27:[1,38]}),o($Vl,[2,28],{27:[1,39]}),o([5,9,10,11,13,14,15,16,17,18,19,20,29,30,35],[2,47]),{1:[2,1]},{2:11,4:40,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:41,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:42,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:45,6:3,7:4,8:$V0,10:[1,43],11:$V1,12:$V2,15:[1,44],17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:47,6:3,7:4,8:$V0,10:[1,46],11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:48,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:49,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:50,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:51,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:52,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{31:[1,53]},o($Vn,[2,46]),{9:$Vb,10:$Vc,11:$Vd,13:[1,54],14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk},o($Vo,[2,19],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),o($Vo,[2,20],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),{2:11,4:57,6:3,7:4,8:$V0,11:$V1,12:$V2,13:[1,55],17:$V3,21:$V4,22:56,23:10,24:$V5,25:$V6,26:$V7,28:[1,58],31:$V8,33:$V9,35:$Va},o($Vl,[2,25]),{33:[1,59]},{24:[1,60],25:[1,61],26:[1,62]},{24:[1,63],25:[1,64],26:[1,65]},{24:[1,66],25:[1,67],26:[1,68]},o($Vl,[2,5]),o([5,10,13,29,30],[2,6],{9:$Vb,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vo,[2,7],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),{2:11,4:69,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:70,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},o($Vp,[2,14],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),{2:11,4:71,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},o($Vp,[2,13],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o([5,10,13,16,29,30],[2,12],{9:$Vb,11:$Vd,14:$Ve,15:$Vf,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vo,[2,15],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),o($Vq,[2,16],{9:$Vb,20:$Vk}),o($Vq,[2,17],{9:$Vb,20:$Vk}),o([5,10,11,13,14,15,16,17,18,19,20,29,30],[2,18],{9:$Vb}),o($Vm,[2,43]),o($Vl,[2,8]),o($Vl,[2,21]),{13:[1,72],29:[1,73],30:[1,74]},o($Vr,[2,38],{9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vr,[2,39]),o($Vn,[2,45]),o($Vl,[2,29]),o($Vl,[2,30]),o($Vl,[2,31]),o($Vl,[2,32]),o($Vl,[2,33]),o($Vl,[2,34]),o($Vl,[2,35]),o($Vl,[2,36]),o($Vl,[2,37]),o($Vp,[2,9],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vp,[2,11],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vp,[2,10],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vl,[2,22]),{2:11,4:75,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:76,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},o($Vr,[2,40],{9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vr,[2,41],{9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk})],defaultActions:{18:[2,1]},parseError:function(r,t){function e(r,t){this.message=r,this.hash=t}if(!t.recoverable)throw e.prototype=Error,new e(r,t);this.trace(r)},parse:function(r){function t(r){for(var t=n.length-1,e=0;;){if(""+c in i[r])return e;if(0===r||2>t)return!1;t-=2,r=n[t],++e}}var e=this,n=[0],a=[null],u=[],i=this.table,o="",s=0,l=0,f=0,c=2,p=u.slice.call(arguments,1),h=Object.create(this.lexer),m={yy:{}};for(var E in this.yy)Object.prototype.hasOwnProperty.call(this.yy,E)&&(m.yy[E]=this.yy[E]);h.setInput(r,m.yy),m.yy.lexer=h,m.yy.parser=this,"undefined"==typeof h.yylloc&&(h.yylloc={});var g=h.yylloc;u.push(g);var N=h.options&&h.options.ranges;this.parseError="function"==typeof m.yy.parseError?m.yy.parseError:Object.getPrototypeOf(this).parseError;for(var v,d,I,b,y,M,A,R,S,T=function(){var r;return r=h.lex()||1,"number"!=typeof r&&(r=e.symbols_[r]||r),r},O={};;){if(I=n[n.length-1],this.defaultActions[I]?b=this.defaultActions[I]:(null!==v&&void 0!==v||(v=T()),b=i[I]&&i[I][v]),void 0===b||!b.length||!b[0]){var V,x="";if(f)1!==d&&(V=t(I));else{V=t(I),S=[];for(M in i[I])this.terminals_[M]&&M>c&&S.push("'"+this.terminals_[M]+"'");x=h.showPosition?"Parse error on line "+(s+1)+":\n"+h.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[v]||v)+"'":"Parse error on line "+(s+1)+": Unexpected "+(1==v?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(x,{text:h.match,token:this.terminals_[v]||v,line:h.yylineno,loc:g,expected:S,recoverable:!1!==V})}if(3==f){if(1===v||1===d)throw Error(x||"Parsing halted while starting to recover from another error.");l=h.yyleng,o=h.yytext,s=h.yylineno,g=h.yylloc,v=T()}if(!1===V)throw Error(x||"Parsing halted. No suitable error recovery rule available.");!function(r){n.length=n.length-2*r,a.length=a.length-r,u.length=u.length-r}(V),d=v==c?null:v,v=c,I=n[n.length-1],b=i[I]&&i[I][c],f=3}if(b[0]instanceof Array&&b.length>1)throw Error("Parse Error: multiple actions possible at state: "+I+", token: "+v);switch(b[0]){case 1:n.push(v),a.push(h.yytext),u.push(h.yylloc),n.push(b[1]),v=null,d?(v=d,d=null):(l=h.yyleng,o=h.yytext,s=h.yylineno,g=h.yylloc,f>0&&f--);break;case 2:if(A=this.productions_[b[1]][1],O.$=a[a.length-A],O._$={first_line:u[u.length-(A||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(A||1)].first_column,last_column:u[u.length-1].last_column},N&&(O._$.range=[u[u.length-(A||1)].range[0],u[u.length-1].range[1]]),void 0!==(y=this.performAction.apply(O,[o,l,s,m.yy,b[1],a,u].concat(p))))return y;A&&(n=n.slice(0,-1*A*2),a=a.slice(0,-1*A),u=u.slice(0,-1*A)),n.push(this.productions_[b[1]][0]),a.push(O.$),u.push(O._$),R=i[n[n.length-2]][n[n.length-1]],n.push(R);break;case 3:return!0}}return!0}},lexer=function(){return{EOF:1,parseError:function(r,t){if(!this.yy.parser)throw Error(r);this.yy.parser.parseError(r,t)},setInput:function(r,t){return this.yy=t||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var r=this._input[0];return this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r,r.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},unput:function(r){var t=r.length,e=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),e.length-1&&(this.yylineno-=e.length-1);var a=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:e?(e.length===n.length?this.yylloc.first_column:0)+n[n.length-e.length].length-e[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[a[0],a[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(r){this.unput(this.match.slice(r))},pastInput:function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var r=this.match;return 20>r.length&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var r=this.pastInput(),t=Array(r.length+1).join("-");return r+this.upcomingInput()+"\n"+t+"^"},test_match:function(r,t){var e,n,a;if(this.options.backtrack_lexer&&(a={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(a.yylloc.range=this.yylloc.range.slice(0))),n=r[0].match(/(?:\r\n?|\n).*/g),n&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(r[0].length),this.matched+=r[0],e=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e)return e;if(this._backtrack){for(var u in a)this[u]=a[u];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var r,t,e,n;this._more||(this.yytext="",this.match="");for(var a=this._currentRules(),u=0;a.length>u;u++)if((e=this._input.match(this.rules[a[u]]))&&(!t||e[0].length>t[0].length)){if(t=e,n=u,this.options.backtrack_lexer){if(!1!==(r=this.test_match(e,a[u])))return r;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(r=this.test_match(t,a[n]))&&r:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var r=this.next();return r||this.lex()},begin:function(r){this.conditionStack.push(r)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(r){return r=this.conditionStack.length-1-Math.abs(r||0),0>r?"INITIAL":this.conditionStack[r]},pushState:function(r){this.begin(r)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(r,t,e,n){switch(e){case 0:break;case 1:case 2:return 8;case 3:return 21;case 4:return 35;case 5:return 24;case 6:case 7:return 26;case 8:return 25;case 9:return 21;case 10:case 11:return 31;case 12:return 33;case 13:return 28;case 14:return 9;case 15:return" ";case 16:return 32;case 17:return 27;case 18:return 29;case 19:return 30;case 20:return 18;case 21:return 19;case 22:return 17;case 23:return 11;case 24:return 20;case 25:return 12;case 26:return 13;case 27:return 15;case 28:return 14;case 29:return 16;case 30:return'"';case 31:return"'";case 32:return"!";case 33:return 10;case 34:return 34;case 35:return"#";case 36:return 5}},rules:[/^(?:\s+)/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9\.]+(?=[(]))/,/^(?:#[A-Z0-9\/]+(!|\?)?)/,/^(?:\$[A-Za-z]+\$[0-9]+)/,/^(?:\$[A-Za-z]+[0-9]+)/,/^(?:[A-Za-z]+\$[0-9]+)/,/^(?:[A-Za-z]+[0-9]+)/,/^(?:[A-Za-z\.]+(?=[(]))/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9]+)/,/^(?:[A-Za-z_]+)/,/^(?:[0-9]+)/,/^(?:\[(.*)?\])/,/^(?:&)/,/^(?: )/,/^(?:[.])/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\/)/,/^(?:-)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\))/,/^(?:>)/,/^(?:<)/,/^(?:NOT\b)/,/^(?:")/,/^(?:')/,/^(?:!)/,/^(?:=)/,/^(?:%)/,/^(?:[#])/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],inclusive:!0}}}}();return parser.lexer=lexer,Parser.prototype=parser,parser.Parser=Parser,new Parser}();exports.parser=grammarParser,exports.Parser=grammarParser.Parser,exports.parse=function(){return grammarParser.parse.apply(grammarParser,arguments)},void 0!==module&&__webpack_require__.c[__webpack_require__.s]===module&&exports.main(process.argv.slice(1))}).call(exports,__webpack_require__(39)(module),__webpack_require__(40))},function(r,t){r.exports=function(r){return r.webpackPolyfill||(r.deprecate=function(){},r.paths=[],r.children||(r.children=[]),Object.defineProperty(r,"loaded",{enumerable:!0,get:function(){return r.l}}),Object.defineProperty(r,"id",{enumerable:!0,get:function(){return r.i}}),r.webpackPolyfill=1),r}},function(r,t){function e(){throw Error("setTimeout has not been defined")}function n(){throw Error("clearTimeout has not been defined")}function a(r){if(f===setTimeout)return setTimeout(r,0);if((f===e||!f)&&setTimeout)return f=setTimeout,setTimeout(r,0);try{return f(r,0)}catch(t){try{return f.call(null,r,0)}catch(t){return f.call(this,r,0)}}}function u(r){if(c===clearTimeout)return clearTimeout(r);if((c===n||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(r);try{return c(r)}catch(t){try{return c.call(null,r)}catch(t){return c.call(this,r)}}}function i(){E&&h&&(E=!1,h.length?m=h.concat(m):g=-1,m.length&&o())}function o(){if(!E){var r=a(i);E=!0;for(var t=m.length;t;){for(h=m,m=[];++g1)for(var e=1;arguments.length>e;e++)t[e-1]=arguments[e];m.push(new s(r,t)),1!==m.length||E||a(o)},s.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=l,p.addListener=l,p.once=l,p.off=l,p.removeListener=l,p.removeAllListeners=l,p.emit=l,p.prependListener=l,p.prependOnceListener=l,p.listeners=function(r){return[]},p.binding=function(r){throw Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(r){throw Error("process.chdir is not supported")},p.umask=function(){return 0}},function(r,t,e){"use strict";function n(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;return r=r.substring(t,r.length-t)}t.__esModule=!0,t.trimEdges=n}])}); \ No newline at end of file diff --git a/package.json b/package.json index 07f06252..4bd8fdb6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hot-formula-parser", - "version": "2.3.3", + "version": "3.0.0", "description": "Formula parser", "browser": "dist/formula-parser.js", "main": "lib/index.js",