forked from fabiooshiro/xlsx-calc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xlsx-calc.js.map
1 lines (1 loc) · 90.4 KB
/
xlsx-calc.js.map
1
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/RawValue.js","webpack:///./src/int_2_col_str.js","webpack:///./src/col_str_2_int.js","webpack:///./src/Range.js","webpack:///./src/getSanitizedSheetName.js","webpack:///./src/str_2_val.js","webpack:///./src/RefValue.js","webpack:///./src/find_all_cells_with_formulas.js","webpack:///./src/index.js","webpack:///./src/exec_formula.js","webpack:///./src/expression_builder.js","webpack:///./src/Exp.js","webpack:///./src/LazyValue.js","webpack:///./src/UserFnExecutor.js","webpack:///./src/UserRawFnExecutor.js","webpack:///./src/formulas.js","webpack:///./src/formulas-raw.js","webpack:///./src/Calculator.js"],"names":["root","factory","exports","module","define","amd","a","i","this","installedModules","__webpack_require__","moduleId","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","setValue","v","calc","modulo","dividend","columnName","guard","String","fromCharCode","col_str","colstr","replace","length","Math","pow","charCodeAt","col_str_2_int","int_2_col_str","getSanitizedSheetName","str_expression","formula","range_expression","sheet_name","sheet","indexOf","aux","split","wb","Sheets","max_row","arr","min_row","parseInt","str_max_row","min_col","max_col","matrix","row","push","j","cell_name","cell_full_name","formula_ref","status","exec_formula","Error","quotedMatch","match","RawValue","RefValue","LazyValue","Range","str_2_val","buffer","isNaN","trim","inner","substr","self","parseRef","resolved_ref","ref_cell","console","log","w","cells","f","cell","find_all_cells_with_formulas","Calculator","mymodule","workbook","formulas","calculator","set_fx","exec_fx","import_functions","import_raw_functions","xlsx_Fx","localizeFunctions","XLSX_CALC","expression_builder","xlsx_raw_Fx","functions","opts","formulajs","prefix","obj","override","my_assign","dest","source","JSON","parse","stringify","k","build_expression","update_cell_value","fn","args","apply","dic","newName","oldName","Exp","UserFnExecutor","UserRawFnExecutor","common_operations","root_exp","str_formula","exp_obj","was_string","fn_stack","exp","string","char","state","start","single_quote","stack","trim_buffer","special","special_raw","ini_parentheses","pop","add_operation","exp_id","last_arg","isEmpty","checkVariable","exec","op","splice","e","id","Array","isArray","errorValues","undefined","message","concat","b","Date","exec_minus","getTime","toLowerCase","user_function","result","map","floor","abs","sqrt","return_index","max","arguments","arg","col","sum","min","rate_per_period","number_of_payments","present_value","future_value","type","q","counta","range","guess","guest","NPV","normsInv","array","getArrayOfNumbers","_mean","reduce","mean","dev","itm","avg","E","var_p","covariance_p","is_blank","needle","table","index","exactmatch","searchingFor","row_num","column_num","lookupValue","matchType","match_exactly_string","match_exactly_non_string","match_less_than_or_equal","match_greater_than_or_equal","parseNumber","parseFloat","consistentSizeRanges","matrixArray","getRowCount","getColCount","rowCount","colCount","product","_i","_ij","arrays","x","today","setHours","hours","minutes","seconds","date","getDate","day","getMonth","month","getFullYear","year","text","number","substring","cond","val","decimalPlaces","round","roundMeasure","inv_n","avg_a","avg_b","sa","sb","elementToSum","sumResult","slice","forEach","elt","option","old_text","new_text","occurrence","RegExp","indexValue","idx","average","mu","sigma","Infinity","cell_ref","rows","columns","height","width","ref_value","parsed_ref","end_range","onerrorvalue","condition","_then","_else","expressionWithRange","colRow","colNumber","rowNumber","matrixRow","destinationColumn","destinationRow","expressions","variables","calcNames","var_name","variable","setVarOfExpression","vars","Workbook","Names","item","getRef","Ref","Name","ref_name"],"mappings":"CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,SACb,GAAqB,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,OACP,CACJ,IAAIK,EAAIL,IACR,IAAI,IAAIM,KAAKD,GAAuB,iBAAZJ,QAAuBA,QAAUF,GAAMO,GAAKD,EAAEC,IAPxE,CASGC,MAAM,WACT,O,YCTE,IAAIC,EAAmB,GAGvB,SA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AAYhC,QAAQ5H,IACrBpJ,KAAKqT,mBAAmBjK,EAAK+J,EAAU/R,KAKnD,UACI,IAAIkS,EAAO,GACX,IAAK,IAAIpL,KAAKlI,KAAKiT,UACfK,EAAKpL,GAAKlI,KAAKiT,UAAU/K,GAAG7F,OAEhC,OAAOiR,EAGX,YACStT,KAAK0G,UAAa1G,KAAK0G,SAAS6M,UAAavT,KAAK0G,SAAS6M,SAASC,OAGzExT,KAAK0G,SAAS6M,SAASC,MAAMxC,QAAQyC,IACjC,IAAIrD,EAAMpQ,KAAK0T,OAAOD,EAAKE,KAC3B3T,KAAKiT,UAAUQ,EAAKG,MAAQxD,EAC5BpQ,KAAKgT,YAAYhC,QAAQ5H,IACrBpJ,KAAKqT,mBAAmBjK,EAAKqK,EAAKG,UAK9C,OAAOC,GACH,IAAK7T,KAAK2G,SAAS5D,OACf,MAAM,IAAIiC,MAAM,qBAEpB,IAEIzB,EAAU,CACVsB,YAHgB7E,KAAK2G,SAAS,GACF9B,YAG5Bf,GAAI9D,KAAK0G,SACT3B,aAAc/E,KAAK+E,cAEvB,OAAOQ,EAAUsO,EAAUtQ,GAG/B,mBAAmB6F,EAAK+J,EAAU/R,GAC9B,IAAK,IAAIrB,EAAI,EAAGA,EAAIqJ,EAAId,KAAKvF,OAAQhD,IAAK,CACtC,IAAI+L,EAAM1C,EAAId,KAAKvI,GACf+L,IAAQqH,EACR/J,EAAId,KAAKvI,GAAKC,KAAKiT,UAAUE,KAAcnT,KAAKiT,UAAUE,GAAY,IAAIhO,EAAS/D,IAC7D,iBAAR0K,GAAkC,eAAbA,EAAIpL,MAAsC,WAAboL,EAAIpL,MACpEV,KAAKqT,mBAAmBvH,EAAKqH,EAAU/R,IAKnD,UACIpB,KAAKgT,YAAYhC,QAAQ5H,IACrBA,EAAIhB","file":"xlsx-calc.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n","\"use strict\";\n\nmodule.exports = function RawValue(value) {\n this.setValue = function(v) {\n value = v;\n };\n this.calc = function() {\n return value;\n };\n};\n","\"use strict\";\n\nmodule.exports = function int_2_col_str(n) {\n var dividend = n + 1;\n var columnName = '';\n var modulo;\n var guard = 10;\n while (dividend > 0 && guard--) {\n modulo = (dividend - 1) % 26;\n columnName = String.fromCharCode(modulo + 65) + columnName;\n dividend = (dividend - modulo - 1) / 26;\n }\n return columnName;\n};","\"use strict\";\n\nmodule.exports = function col_str_2_int(col_str) {\n var r = 0;\n var colstr = col_str.replace(/[0-9]+$/, '');\n for (var i = colstr.length; i--;) {\n r += Math.pow(26, colstr.length - i - 1) * (colstr.charCodeAt(i) - 64);\n }\n return r - 1;\n};","\"use strict\";\n\nconst col_str_2_int = require('./col_str_2_int.js');\nconst int_2_col_str = require('./int_2_col_str.js');\nconst getSanitizedSheetName = require('./getSanitizedSheetName.js');\n\nmodule.exports = function Range(str_expression, formula) {\n this.calc = function() {\n var range_expression, sheet_name, sheet;\n if (str_expression.indexOf('!') != -1) {\n var aux = str_expression.split('!');\n sheet_name = getSanitizedSheetName(aux[0]);\n range_expression = aux[1];\n }\n else {\n sheet_name = formula.sheet_name;\n range_expression = str_expression;\n }\n sheet = formula.wb.Sheets[sheet_name];\n var arr = range_expression.split(':');\n var min_row = parseInt(arr[0].replace(/^[A-Z]+/, ''), 10) || 0;\n var str_max_row = arr[1].replace(/^[A-Z]+/, '');\n var max_row;\n if (str_max_row === '' && sheet['!ref']) {\n str_max_row = sheet['!ref'].split(':')[1].replace(/^[A-Z]+/, '');\n }\n // the max is 1048576, but TLE\n max_row = parseInt(str_max_row == '' ? '500000' : str_max_row, 10);\n var min_col = col_str_2_int(arr[0]);\n var max_col = col_str_2_int(arr[1]);\n var matrix = [];\n for (var i = min_row; i <= max_row; i++) {\n var row = [];\n matrix.push(row);\n for (var j = min_col; j <= max_col; j++) {\n var cell_name = int_2_col_str(j) + i;\n var cell_full_name = sheet_name + '!' + cell_name;\n if (formula.formula_ref[cell_full_name]) {\n if (formula.formula_ref[cell_full_name].status === 'new') {\n formula.exec_formula(formula.formula_ref[cell_full_name]);\n }\n else if (formula.formula_ref[cell_full_name].status === 'working') {\n throw new Error('Circular ref');\n }\n if (sheet[cell_name].t === 'e') {\n row.push(sheet[cell_name]);\n }\n else {\n row.push(sheet[cell_name].v);\n }\n }\n else if (sheet[cell_name]) {\n if (sheet[cell_name].t === 'e') {\n row.push(sheet[cell_name]);\n }\n else {\n row.push(sheet[cell_name].v);\n }\n }\n else {\n row.push(null);\n }\n }\n }\n return matrix;\n };\n};\n","\"use strict\";\n\nmodule.exports = function getSanitizedSheetName(sheet_name) {\n var quotedMatch = sheet_name.match(/^'(.*)'$/);\n if (quotedMatch) {\n return quotedMatch[1];\n }\n else {\n return sheet_name;\n }\n};\n","const RawValue = require('./RawValue.js');\nconst RefValue = require('./RefValue.js');\nconst LazyValue = require('./LazyValue.js');\nconst Range = require('./Range.js');\n\nmodule.exports = function str_2_val(buffer, formula) {\n if (!isNaN(buffer)) {\n return new RawValue(+buffer);\n }\n if (buffer === 'TRUE') {\n return new RawValue(1);\n }\n if (typeof buffer !== 'string') {\n return buffer;\n }\n\n buffer = buffer.trim().replace(/\\$/g, '')\n\n if (buffer.match(/^[A-Z]+[0-9]+:[A-Z]+[0-9]+$/)) {\n return new Range(buffer, formula);\n }\n if (buffer.match(/^[^!]+![A-Z]+[0-9]+:[A-Z]+[0-9]+$/)) {\n return new Range(buffer, formula);\n }\n if (buffer.match(/^[A-Z]+:[A-Z]+$/)) {\n return new Range(buffer, formula);\n }\n if (buffer.match(/^[^!]+![A-Z]+:[A-Z]+$/)) {\n return new Range(buffer, formula);\n }\n if (buffer.match(/^[A-Z]+[0-9]+$/)) {\n return new RefValue(buffer, formula);\n }\n if (buffer.match(/^[^!]+![A-Z]+[0-9]+$/)) {\n return new RefValue(buffer, formula);\n }\n if (buffer.match(/%$/)) {\n var inner = str_2_val(buffer.substr(0, buffer.length-1), formula)\n return new LazyValue(() => inner.calc() / 100)\n }\n return buffer;\n};\n","\"use strict\";\n\nconst getSanitizedSheetName = require('./getSanitizedSheetName.js');\n\nmodule.exports = function RefValue(str_expression, formula) {\n var self = this;\n this.name = 'RefValue';\n this.str_expression = str_expression;\n this.formula = formula;\n\n self.parseRef = function() {\n var sheet, sheet_name, cell_name, cell_full_name;\n if (str_expression.indexOf('!') != -1) {\n var aux = str_expression.split('!');\n sheet_name = getSanitizedSheetName(aux[0]);\n sheet = formula.wb.Sheets[sheet_name];\n cell_name = aux[1];\n }\n else {\n sheet = formula.sheet;\n sheet_name = formula.sheet_name;\n cell_name = str_expression;\n }\n if (!sheet) {\n throw Error(\"Sheet \" + sheet_name + \" not found.\");\n }\n cell_full_name = sheet_name + '!' + cell_name;\n return {\n sheet: sheet,\n sheet_name: sheet_name,\n cell_name: cell_name,\n cell_full_name: cell_full_name\n };\n };\n\n this.calc = function() {\n var resolved_ref = self.parseRef();\n var sheet = resolved_ref.sheet;\n var cell_name = resolved_ref.cell_name;\n var cell_full_name = resolved_ref.cell_full_name;\n var ref_cell = sheet[cell_name];\n if (!ref_cell) {\n return null;\n }\n var formula_ref = formula.formula_ref[cell_full_name];\n if (formula_ref) {\n if (formula_ref.status === 'new') {\n formula.exec_formula(formula_ref);\n if (ref_cell.t === 'e') {\n console.log('ref is an error with new formula', cell_full_name, ref_cell.w);\n throw new Error(ref_cell.w);\n }\n return ref_cell.v;\n }\n else if (formula_ref.status === 'working') {\n throw new Error('Circular ref');\n }\n else if (formula_ref.status === 'done') {\n if (ref_cell.t === 'e') {\n console.log('ref is an error after formula eval', cell_full_name, ref_cell.w);\n throw new Error(ref_cell.w);\n }\n return ref_cell.v;\n }\n }\n else {\n if (ref_cell.t === 'e') {\n console.log('ref is an error with no formula', cell_name);\n throw new Error(ref_cell.w);\n }\n return ref_cell.v;\n }\n };\n};\n","\"use strict\";\n\nmodule.exports = function find_all_cells_with_formulas(wb, exec_formula) {\n let formula_ref = {};\n let cells = [];\n for (let sheet_name in wb.Sheets) {\n let sheet = wb.Sheets[sheet_name];\n for (let cell_name in sheet) {\n if (sheet[cell_name] && sheet[cell_name].f) {\n let formula = formula_ref[sheet_name + '!' + cell_name] = {\n formula_ref: formula_ref,\n wb: wb,\n sheet: sheet,\n sheet_name: sheet_name,\n cell: sheet[cell_name],\n name: cell_name,\n status: 'new',\n exec_formula: exec_formula\n };\n cells.push(formula);\n }\n }\n }\n return cells;\n};\n","\"use strict\";\n\nconst int_2_col_str = require('./int_2_col_str.js');\nconst col_str_2_int = require('./col_str_2_int.js');\nconst exec_formula = require('./exec_formula.js');\nconst find_all_cells_with_formulas = require('./find_all_cells_with_formulas.js');\nconst Calculator = require('./Calculator.js');\n\nvar mymodule = function(workbook) {\n var formulas = find_all_cells_with_formulas(workbook, exec_formula);\n for (var i = formulas.length - 1; i >= 0; i--) {\n exec_formula(formulas[i]);\n }\n};\n\nmymodule.calculator = function calculator(workbook) {\n return new Calculator(workbook, exec_formula);\n};\n\nmymodule.set_fx = exec_formula.set_fx;\nmymodule.exec_fx = exec_formula.exec_fx;\nmymodule.col_str_2_int = col_str_2_int;\nmymodule.int_2_col_str = int_2_col_str;\nmymodule.import_functions = exec_formula.import_functions;\nmymodule.import_raw_functions = exec_formula.import_raw_functions;\nmymodule.xlsx_Fx = exec_formula.xlsx_Fx;\nmymodule.localizeFunctions = exec_formula.localizeFunctions;\n\nmymodule.XLSX_CALC = mymodule\n\nmodule.exports = mymodule;\n","\"use strict\";\n\nconst expression_builder = require('./expression_builder.js');\n\nlet xlsx_Fx = {};\nlet xlsx_raw_Fx = {};\n\nimport_functions(require('./formulas.js'));\nimport_raw_functions(require('./formulas-raw.js'));\n\nfunction import_raw_functions(functions, opts) {\n for (var key in functions) {\n xlsx_raw_Fx[key] = functions[key];\n }\n}\n\nfunction import_functions(formulajs, opts) {\n opts = opts || {};\n var prefix = opts.prefix || '';\n for (var key in formulajs) {\n var obj = formulajs[key];\n if (typeof(obj) === 'function') {\n if (opts.override || !xlsx_Fx[prefix + key]) {\n xlsx_Fx[prefix + key] = obj;\n }\n // else {\n // console.log(prefix + key, 'already exists.');\n // console.log(' to override:');\n // console.log(' XLSX_CALC.import_functions(yourlib, {override: true})');\n // }\n }\n else if (typeof(obj) === 'object') {\n import_functions(obj, my_assign(opts, { prefix: key + '.' }));\n }\n }\n}\n\nfunction my_assign(dest, source) {\n var obj = JSON.parse(JSON.stringify(dest));\n for (var k in source) {\n obj[k] = source[k];\n }\n return obj;\n}\n\nfunction build_expression(formula) {\n return expression_builder(formula, {xlsx_Fx: xlsx_Fx, xlsx_raw_Fx: xlsx_raw_Fx});\n}\n\nfunction exec_formula(formula) {\n let root_exp = build_expression(formula);\n root_exp.update_cell_value();\n}\n\nexec_formula.set_fx = function set_fx(name, fn) {\n xlsx_Fx[name] = fn;\n};\n\nexec_formula.exec_fx = function exec_fx(name, args) {\n return xlsx_Fx[name].apply(this, args);\n};\n\nexec_formula.localizeFunctions = function(dic) {\n for (let newName in dic) {\n let oldName = dic[newName];\n if (xlsx_Fx[oldName]) {\n xlsx_Fx[newName] = xlsx_Fx[oldName];\n }\n if (xlsx_raw_Fx[oldName]) {\n xlsx_raw_Fx[newName] = xlsx_raw_Fx[oldName];\n }\n }\n};\n\nexec_formula.import_functions = import_functions;\nexec_formula.import_raw_functions = import_raw_functions;\nexec_formula.build_expression = build_expression;\nexec_formula.xlsx_Fx = xlsx_Fx;\nmodule.exports = exec_formula;\n","const Exp = require('./Exp.js');\nconst RawValue = require('./RawValue.js');\nconst UserFnExecutor = require('./UserFnExecutor.js');\nconst UserRawFnExecutor = require('./UserRawFnExecutor.js');\nconst common_operations = {\n '*': 'multiply',\n '+': 'plus',\n '-': 'minus',\n '/': 'divide',\n '^': 'power',\n '&': 'concat',\n '<': 'lt',\n '>': 'gt',\n '=': 'eq'\n};\n\nmodule.exports = function expression_builder(formula, opts) {\n formula.status = 'working';\n\n var xlsx_Fx = opts.xlsx_Fx || {};\n var xlsx_raw_Fx = opts.xlsx_raw_Fx || {};\n\n var root_exp;\n var str_formula = formula.cell.f;\n if (str_formula[0] == '=') {\n str_formula = str_formula.substr(1);\n }\n var exp_obj = root_exp = new Exp(formula);\n var buffer = '',\n was_string = false;\n var fn_stack = [{\n exp: exp_obj\n }];\n\n /**\n * state pattern in functional way\n */\n function string(char) {\n if (char === '\"') {\n exp_obj.push(new RawValue(buffer));\n was_string = true;\n buffer = '';\n state = start;\n } else {\n buffer += char;\n }\n }\n\n function single_quote(char) {\n if (char === \"'\") {\n state = start;\n }\n buffer += char;\n }\n\n function ini_parentheses() {\n var o, trim_buffer = buffer.trim(),\n special = xlsx_Fx[trim_buffer];\n var special_raw = xlsx_raw_Fx[trim_buffer];\n if (special_raw) {\n special = new UserRawFnExecutor(special_raw, formula);\n }\n else if (special) {\n special = new UserFnExecutor(special, formula);\n }\n else if (trim_buffer) {\n //Error: \"Worksheet 1\"!D145: Function INDEX not found\n throw new Error('\"' + formula.sheet_name + '\"!' + formula.name + ': Function ' + buffer + ' not found');\n }\n o = new Exp(formula);\n fn_stack.push({\n exp: o,\n special: special\n });\n exp_obj = o;\n buffer = '';\n }\n\n function end_parentheses() {\n var v, stack = fn_stack.pop();\n exp_obj = stack.exp;\n exp_obj.push(buffer);\n v = exp_obj;\n buffer = '';\n exp_obj = fn_stack[fn_stack.length - 1].exp;\n if (stack.special) {\n stack.special.push(v);\n exp_obj.push(stack.special);\n }\n else {\n exp_obj.push(v);\n }\n }\n\n function add_operation(char) {\n if (!was_string) {\n exp_obj.push(buffer);\n }\n was_string = false;\n exp_obj.push(char);\n buffer = '';\n }\n\n function start(char) {\n if (char === '\"') {\n state = string;\n buffer = '';\n } else if (char === \"'\") {\n state = single_quote;\n buffer = \"'\";\n } else if (char === '(') {\n ini_parentheses();\n } else if (char === ')') {\n end_parentheses();\n } else if (common_operations[char]) {\n add_operation(char);\n } else if (char === ',' && fn_stack[fn_stack.length - 1].special) {\n was_string = false;\n fn_stack[fn_stack.length - 1].exp.push(buffer);\n fn_stack[fn_stack.length - 1].special.push(fn_stack[fn_stack.length - 1].exp);\n fn_stack[fn_stack.length - 1].exp = exp_obj = new Exp(formula);\n buffer = '';\n } else {\n buffer += char;\n }\n }\n \n var state = start;\n\n for (var i = 0; i < str_formula.length; i++) {\n state(str_formula[i]);\n }\n root_exp.push(buffer);\n return root_exp;\n\n}","\"use strict\";\n\nconst RawValue = require('./RawValue.js');\nconst Range = require('./Range.js');\nconst str_2_val = require('./str_2_val.js');\n\nconst MS_PER_DAY = 24 * 60 * 60 * 1000;\n\nvar exp_id = 0;\n\nmodule.exports = function Exp(formula) {\n var self = this;\n self.id = ++exp_id;\n self.args = [];\n self.name = 'Expression';\n self.update_cell_value = update_cell_value;\n self.formula = formula;\n \n function update_cell_value() {\n try {\n if (Array.isArray(self.args) \n && self.args.length === 1\n && self.args[0] instanceof Range) {\n throw Error('#VALUE!');\n }\n formula.cell.v = self.calc();\n if (typeof(formula.cell.v) === 'string') {\n formula.cell.t = 's';\n }\n else if (typeof(formula.cell.v) === 'number') {\n formula.cell.t = 'n';\n }\n }\n catch (e) {\n var errorValues = {\n '#NULL!': 0x00,\n '#DIV/0!': 0x07,\n '#VALUE!': 0x0F,\n '#REF!': 0x17,\n '#NAME?': 0x1D,\n '#NUM!': 0x24,\n '#N/A': 0x2A,\n '#GETTING_DATA': 0x2B\n };\n if (errorValues[e.message] !== undefined) {\n formula.cell.t = 'e';\n formula.cell.w = e.message;\n formula.cell.v = errorValues[e.message];\n }\n else {\n throw e;\n }\n }\n finally {\n formula.status = 'done';\n }\n }\n function isEmpty(value) {\n return value === undefined || value === null || value === \"\";\n }\n \n function checkVariable(obj) {\n if (typeof obj.calc !== 'function') {\n throw new Error('Undefined ' + obj);\n }\n }\n \n function exec(op, args, fn) {\n for (var i = 0; i < args.length; i++) {\n if (args[i] === op) {\n try {\n if (i===0 && op==='+') {\n checkVariable(args[i + 1]);\n let r = args[i + 1].calc();\n args.splice(i, 2, new RawValue(r));\n } else {\n checkVariable(args[i - 1]);\n checkVariable(args[i + 1]);\n let r = fn(args[i - 1].calc(), args[i + 1].calc());\n args.splice(i - 1, 3, new RawValue(r));\n i--;\n }\n }\n catch (e) {\n // console.log('[Exp.js] - ' + formula.name + ': evaluating ' + formula.cell.f + '\\n' + e.message);\n throw e;\n }\n }\n }\n }\n\n function exec_minus(args) {\n for (var i = args.length; i--;) {\n if (args[i] === '-') {\n checkVariable(args[i + 1]);\n var b = args[i + 1].calc();\n if (i > 0 && typeof args[i - 1] !== 'string') {\n args.splice(i, 1, '+');\n if (b instanceof Date) {\n b = Date.parse(b);\n checkVariable(args[i - 1]);\n var a = args[i - 1].calc();\n if (a instanceof Date) {\n a = Date.parse(a) / MS_PER_DAY;\n b = b / MS_PER_DAY;\n args.splice(i - 1, 1, new RawValue(a));\n }\n }\n args.splice(i + 1, 1, new RawValue(-b));\n }\n else {\n if (typeof b === 'string') {\n throw new Error('#VALUE!');\n }\n args.splice(i, 2, new RawValue(-b));\n }\n }\n }\n }\n\n self.calc = function() {\n let args = self.args.concat();\n exec_minus(args);\n exec('^', args, function(a, b) {\n return Math.pow(+a, +b);\n });\n exec('/', args, function(a, b) {\n if (b == 0) {\n throw Error('#DIV/0!');\n }\n return (+a) / (+b);\n });\n exec('*', args, function(a, b) {\n return (+a) * (+b);\n });\n exec('+', args, function(a, b) {\n if (a instanceof Date && typeof b === 'number') {\n b = b * MS_PER_DAY;\n }\n return (+a) + (+b);\n });\n exec('&', args, function(a, b) {\n return '' + a + b;\n });\n exec('<', args, function(a, b) {\n return a < b;\n });\n exec('>', args, function(a, b) {\n return a > b;\n });\n exec('>=', args, function(a, b) {\n return a >= b;\n });\n exec('<=', args, function(a, b) {\n return a <= b;\n });\n exec('<>', args, function(a, b) {\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() !== b.getTime();\n }\n if (isEmpty(a) && isEmpty(b)) {\n return false;\n }\n return a != b;\n });\n exec('=', args, function(a, b) {\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n }\n if (isEmpty(a) && isEmpty(b)) {\n return true;\n }\n if ((a == null && b === 0) || (a === 0 && b == null)) {\n return true;\n }\n if (typeof a === 'string' && typeof b === 'string' && a.toLowerCase() === b.toLowerCase()) {\n return true;\n }\n return a == b;\n });\n if (args.length == 1) {\n if (typeof(args[0].calc) !== 'function') {\n return args[0];\n }\n else {\n return args[0].calc();\n }\n }\n };\n\n var last_arg;\n self.push = function(buffer) {\n if (buffer) {\n var v = str_2_val(buffer, formula);\n if (((v === '=') && (last_arg == '>' || last_arg == '<')) || (last_arg == '<' && v === '>')) {\n self.args[self.args.length - 1] += v;\n }\n else {\n self.args.push(v);\n }\n last_arg = v;\n //console.log(self.id, '-->', v);\n }\n };\n};","\"use strict\";\n\nmodule.exports = function LazyValue(fn) {\n this.calc = function() {\n return fn();\n };\n};\n","\"use strict\";\n\nmodule.exports = function UserFnExecutor(user_function) {\n var self = this;\n self.name = 'UserFn';\n self.args = [];\n self.calc = function() {\n var errorValues = {\n '#NULL!': 0x00,\n '#DIV/0!': 0x07,\n '#VALUE!': 0x0F,\n '#REF!': 0x17,\n '#NAME?': 0x1D,\n '#NUM!': 0x24,\n '#N/A': 0x2A,\n '#GETTING_DATA': 0x2B\n }, result;\n try {\n result = user_function.apply(self, self.args.map(f=>f.calc()));\n } catch (e) {\n if (user_function.name === 'is_blank'\n && errorValues[e.message] !== undefined) {\n // is_blank applied to an error cell doesn't propagate the error\n result = 0;\n }\n else if (user_function.name === 'iserror'\n && errorValues[e.message] !== undefined) {\n // iserror applied to an error doesn't propagate the error and returns true\n result = true;\n }\n else {\n throw e;\n }\n }\n return result;\n };\n self.push = function(buffer) {\n self.args.push(buffer);\n };\n};","\"use strict\";\n\nmodule.exports = function UserRawFnExecutor(user_function, formula) {\n var self = this;\n self.name = 'UserRawFn';\n self.args = [];\n self.calc = function() {\n try {\n return user_function.apply(self, self.args);\n } catch(e) {\n // debug\n // console.log('----------------', user_function);\n // console.log(formula.name);\n // console.log(self);\n throw e;\n }\n };\n self.push = function(buffer) {\n self.args.push(buffer);\n };\n};\n","\"use strict\";\n\n// +---------------------+\n// | FORMULAS REGISTERED |\n// +---------------------+\nlet formulas = {\n 'FLOOR': Math.floor,\n '_xlfn.FLOOR.MATH': Math.floor,\n 'FLOOR.MATH': Math.floor,\n 'ABS': Math.abs,\n 'SQRT': Math.sqrt,\n 'VLOOKUP': vlookup,\n 'MAX': max,\n 'SUM': sum,\n 'MIN': min,\n 'CONCATENATE': concatenate,\n 'PMT': pmt,\n 'COUNTA': counta,\n 'IRR': irr,\n 'NORM.INV': normsInv,\n '_xlfn.NORM.INV': normsInv,\n 'STDEV': stDeviation,\n 'AVERAGE': avg,\n 'EXP': EXP,\n 'LN': Math.log,\n '_xlfn.VAR.P': var_p,\n 'VAR.P': var_p,\n '_xlfn.COVARIANCE.P': covariance_p,\n 'COVARIANCE.P': covariance_p,\n 'TRIM': trim,\n 'LEN': len,\n 'ISBLANK': is_blank,\n 'HLOOKUP': hlookup,\n 'INDEX': index,\n 'MATCH': match,\n 'SUMPRODUCT': sumproduct,\n 'ISNUMBER': isnumber,\n 'TODAY': today,\n 'ISERROR': iserror,\n 'TIME': time,\n 'DAY': day,\n 'MONTH': month,\n 'YEAR': year,\n 'RIGHT': right,\n 'LEFT': left,\n 'IFS': ifs,\n 'ROUND': round,\n 'CORREL': correl, // missing test\n 'SUMIF': sumif, // missing test,\n 'CHOOSE': choose,\n 'SUBSTITUTE': substitute,\n};\n\nfunction choose(option) {\n return arguments[option];\n}\n\nfunction sumif(){\n\n let elementToSum = arguments[1];\n let sumResult = 0;\n\n [].slice.call(arguments)[0][0].forEach((elt,key) =>{\n\n if (elt!==null){\n if( elt.replace(/\\'/g, \"\") === elementToSum){\n if (!isNaN([].slice.call(arguments)[2][0][key])){\n sumResult += [].slice.call(arguments)[2][0][key]\n }\n }\n }\n });\n return sumResult\n}\n\nfunction correl(a,b){\n\n a = getArrayOfNumbers(a);\n b = getArrayOfNumbers(b);\n\n if (a.length !== b.length) {\n return 'N/D';\n }\n var inv_n = 1.0 / (a.length-1);\n var avg_a = sum.apply(this, a) / a.length;\n var avg_b = sum.apply(this, b) / b.length;\n var s = 0.0;\n var sa = 0;\n var sb=0;\n for (var i = 0; i < a.length; i++) {\n s += (a[i] - avg_a) * (b[i] - avg_b);\n\n sa+=Math.pow(a[i],2);\n sb+=Math.pow(b[i],2);\n }\n\n sa=Math.sqrt(sa/inv_n);\n sb=Math.sqrt(sb/inv_n);\n\n return s / (inv_n*sa*sb);\n}\n\nfunction round(value, decimalPlaces) {\n if (arguments.length === 0) throw new Error(\"Err:511\");\n if (arguments.length === 1) return Math.round(value);\n let roundMeasure = Math.pow(10, decimalPlaces);\n return Math.round(roundMeasure*value)/roundMeasure\n}\n\nfunction today() {\n var today = new Date();\n today.setHours(0, 0, 0, 0);\n return today;\n}\n\nfunction isnumber(x) {\n return !isNaN(x);\n}\n\nfunction sumproduct() {\n var parseNumber = function (string) {\n if (string === undefined || string === '' || string === null) {\n return 0;\n }\n if (!isNaN(string)) {\n return parseFloat(string);\n }\n return 0;\n },\n consistentSizeRanges = function (matrixArray) {\n var getRowCount = function(matrix) {\n return matrix.length;\n },\n getColCount = function(matrix) {\n return matrix[0].length;\n },\n rowCount = getRowCount(matrixArray[0]),\n colCount = getColCount(matrixArray[0]);\n\n for (var i = 1; i < matrixArray.length; i++) {\n if (getRowCount(matrixArray[i]) !== rowCount\n || getColCount(matrixArray[i]) !== colCount) {\n return false;\n }\n }\n return true;\n };\n\n if (!arguments || arguments.length === 0) {\n throw Error('#VALUE!');\n }\n if (!consistentSizeRanges(arguments)) {\n throw Error('#VALUE!');\n }\n // throw error if any of the cells passed in arguments is in error\n for (var i = 0; i < arguments.length; i++) {\n var row = arguments[i];\n if (Array.isArray(row)) {\n for (var j = 0; j < row.length; j++) {\n var col = row[j];\n if (Array.isArray(col)) {\n for (var k = 0; k < col.length; k++) {\n var cell = col[k];\n if (cell && typeof cell === 'object' && cell.t === 'e') {\n throw Error(cell.w);\n }\n }\n }\n else {\n var cell = col;\n if (cell && typeof cell === 'object' && cell.t === 'e') {\n throw Error(cell.w);\n }\n }\n }\n }\n else {\n var cell = row;\n if (cell && typeof cell === 'object' && cell.t === 'e') {\n throw Error(cell.w);\n }\n }\n }\n\n var arrays = arguments.length + 1;\n var result = 0;\n var product;\n var k;\n var _i;\n var _ij;\n for (var i = 0; i < arguments[0].length; i++) {\n if (!(arguments[0][i] instanceof Array)) {\n product = 1;\n for (k = 1; k < arrays; k++) {\n _i = parseNumber(arguments[k - 1][i]);\n\n product *= _i;\n }\n result += product;\n } else {\n for (var j = 0; j < arguments[0][i].length; j++) {\n product = 1;\n for (k = 1; k < arrays; k++) {\n _ij = parseNumber(arguments[k - 1][i][j]);\n\n product *= _ij;\n }\n result += product;\n }\n }\n }\n return result;\n}\n\nfunction match_less_than_or_equal(matrix, lookupValue) {\n var index;\n var indexValue;\n for (var idx = 0; idx < matrix.length; idx++) {\n if (matrix[idx] === lookupValue) {\n return idx + 1;\n } else if (matrix[idx] < lookupValue) {\n if (!indexValue) {\n index = idx + 1;\n indexValue = matrix[idx];\n } else if (matrix[idx] > indexValue) {\n index = idx + 1;\n indexValue = matrix[idx];\n }\n }\n }\n if (!index) {\n throw Error('#N/A');\n }\n return index;\n}\n\nfunction match_exactly_string(matrix, lookupValue) {\n for (var idx = 0; idx < matrix.length; idx++) {\n lookupValue = lookupValue.replace(/\\?/g, '.');\n if (Array.isArray(matrix[idx])) {\n if (matrix[idx].length === 1\n && typeof matrix[idx][0] === 'string') {\n if (matrix[idx][0].toLowerCase() === lookupValue.toLowerCase()) {\n return idx + 1;\n }\n }\n } else if (typeof matrix[idx] === 'string') {\n if (matrix[idx].toLowerCase() === lookupValue.toLowerCase()) {\n return idx + 1;\n }\n }\n\n }\n throw Error('#N/A');\n}\n\nfunction match_exactly_non_string(matrix, lookupValue) {\n for (var idx = 0; idx < matrix.length; idx++) {\n if (Array.isArray(matrix[idx])) {\n if (matrix[idx].length === 1) {\n if (matrix[idx][0] === lookupValue) {\n return idx + 1;\n }\n }\n } else if (matrix[idx] === lookupValue) {\n return idx + 1;\n }\n }\n throw Error('#N/A');\n}\n\n// +---------------------+\n// | THE IMPLEMENTATIONS |\n// +---------------------+\n\n\nfunction match_greater_than_or_equal(matrix, lookupValue) {\n var index;\n var indexValue;\n for (var idx = 0; idx < matrix.length; idx++) {\n if (Array.isArray(matrix[idx]) && matrix[idx].length > 0) {\n // For array in column\n if (matrix[idx][0] === lookupValue) {\n return idx + 1;\n } else if (matrix[idx][0] > lookupValue) {\n if (!indexValue) {\n index = idx + 1;\n indexValue = matrix[idx][0];\n } else if (matrix[idx][0] < indexValue) {\n index = idx + 1;\n indexValue = matrix[idx][0];\n }\n }\n } else {\n // For array in row\n if (matrix[idx] === lookupValue) {\n return idx + 1;\n } else if (matrix[idx] > lookupValue) {\n if (!indexValue) {\n index = idx + 1;\n indexValue = matrix[idx];\n } else if (matrix[idx] < indexValue) {\n index = idx + 1;\n indexValue = matrix[idx];\n }\n }\n }\n }\n if (!index) {\n throw Error('#N/A');\n }\n return index;\n}\n\nfunction match(lookupValue, matrix, matchType) {\n if (Array.isArray(matrix)\n && matrix.length === 1\n && Array.isArray(matrix[0])) {\n matrix = matrix[0];\n }\n if (!lookupValue && !matrix) {\n throw Error('#N/A');\n }\n if (arguments.length === 2) {\n matchType = 1;\n }\n if (!(matrix instanceof Array)) {\n throw Error('#N/A');\n }\n if (matchType === 0) {\n if (typeof lookupValue === 'string') {\n return match_exactly_string(matrix, lookupValue);\n } else {\n return match_exactly_non_string(matrix, lookupValue);\n }\n } else if (matchType === 1) {\n return match_less_than_or_equal(matrix, lookupValue);\n } else if (matchType === -1) {\n return match_greater_than_or_equal(matrix, lookupValue);\n } else {\n throw Error('#N/A');\n }\n}\n\nfunction index(matrix, row_num, column_num) {\n if (row_num <= matrix.length) {\n var row = matrix[row_num - 1];\n if (Array.isArray(row)) {\n if (!column_num) {\n return row;\n } else if (column_num <= row.length) {\n return row[column_num - 1];\n }\n } else {\n return matrix[row_num];\n }\n }\n throw Error('#REF!');\n}\n\n// impl ported from https://github.com/FormulaPages/hlookup\nfunction hlookup(needle, table, index, exactmatch) {\n if (typeof needle === \"undefined\" || (0, is_blank)(needle)) {\n throw Error('#N/A');\n }\n\n index = index || 0;\n let row = table[0], i, searchingFor;\n\n if (typeof needle === 'string') {\n searchingFor = needle.toLowerCase();\n for (i = 0; i < row.length; i++) {\n if (exactmatch && row[i] === searchingFor || row[i].toLowerCase().indexOf(searchingFor) !== -1) {\n return index < table.length + 1 ? table[index - 1][i] : table[0][i];\n }\n }\n } else {\n searchingFor = needle;\n for (i = 0; i < row.length; i++) {\n if (exactmatch && row[i] === searchingFor || row[i] === searchingFor) {\n return index < table.length + 1 ? table[index - 1][i] : table[0][i];\n }\n }\n }\n throw Error('#N/A');\n}\n\nfunction len(a) {\n return ('' + a).length;\n}\n\nfunction trim(a) {\n return ('' + a).trim();\n}\n\nfunction is_blank(a) {\n // console.log(a)\n return !a;\n}\n\nfunction covariance_p(a, b) {\n a = getArrayOfNumbers(a);\n b = getArrayOfNumbers(b);\n if (a.length != b.length) {\n return 'N/D';\n }\n var inv_n = 1.0 / a.length;\n var avg_a = sum.apply(this, a) / a.length;\n var avg_b = sum.apply(this, b) / b.length;\n var s = 0.0;\n for (var i = 0; i < a.length; i++) {\n s += (a[i] - avg_a) * (b[i] - avg_b);\n }\n return s * inv_n;\n}\n\nfunction getArrayOfNumbers(range) {\n var arr = [];\n for (var i = 0; i < range.length; i++) {\n var arg = range[i];\n if (Array.isArray(arg)) {\n var matrix = arg;\n for (var j = matrix.length; j--;) {\n if (typeof(matrix[j]) == 'number') {\n arr.push(matrix[j]);\n }\n else if (Array.isArray(matrix[j])) {\n for (var k = matrix[j].length; k--;) {\n if (typeof(matrix[j][k]) == 'number') {\n arr.push(matrix[j][k]);\n }\n }\n }\n // else {\n // wtf is that?\n // }\n }\n }\n else {\n if (typeof(arg) == 'number') {\n arr.push(arg);\n }\n }\n }\n return arr;\n}\n\nfunction var_p() {\n var average = avg.apply(this, arguments);\n var s = 0.0;\n var c = 0;\n for (var i = 0; i < arguments.length; i++) {\n var arg = arguments[i];\n if (Array.isArray(arg)) {\n var matrix = arg;\n for (var j = matrix.length; j--;) {\n for (var k = matrix[j].length; k--;) {\n if (matrix[j][k] !== null && matrix[j][k] !== undefined) {\n s += Math.pow(matrix[j][k] - average, 2);\n c++;\n }\n }\n }\n }\n else {\n s += Math.pow(arg - average, 2);\n c++;\n }\n }\n return s / c;\n}\n\nfunction EXP(n) {\n return Math.pow(Math.E, n);\n}\n\nfunction avg() {\n return sum.apply(this, arguments) / counta.apply(this, arguments);\n}\n\nfunction stDeviation() {\n var array = getArrayOfNumbers(arguments);\n\n function _mean(array) {\n return array.reduce(function(a, b) {\n return a + b;\n }) / array.length;\n }\n var mean = _mean(array),\n dev = array.map(function(itm) {\n return (itm - mean) * (itm - mean);\n });\n return Math.sqrt(dev.reduce(function(a, b) {\n return a + b;\n }) / (array.length - 1));\n}\n\n/// Original C++ implementation found at http://www.wilmott.com/messageview.cfm?catid=10&threadid=38771\n/// C# implementation found at http://weblogs.asp.net/esanchez/archive/2010/07/29/a-quick-and-dirty-implementation-of-excel-norminv-function-in-c.aspx\n/*\n * Compute the quantile function for the normal distribution.\n *\n * For small to moderate probabilities, algorithm referenced\n * below is used to obtain an initial approximation which is\n * polished with a final Newton step.\n *\n * For very large arguments, an algorithm of Wichura is used.\n *\n * REFERENCE\n *\n * Beasley, J. D. and S. G. Springer (1977).\n * Algorithm AS 111: The percentage points of the normal distribution,\n * Applied Statistics, 26, 118-121.\n *\n * Wichura, M.J. (1988).\n * Algorithm AS 241: The Percentage Points of the Normal Distribution.\n * Applied Statistics, 37, 477-484.\n */\nfunction normsInv(p, mu, sigma) {\n if (p < 0 || p > 1) {\n throw \"The probality p must be bigger than 0 and smaller than 1\";\n }\n if (sigma < 0) {\n throw \"The standard deviation sigma must be positive\";\n }\n\n if (p == 0) {\n return -Infinity;\n }\n if (p == 1) {\n return Infinity;\n }\n if (sigma == 0) {\n return mu;\n }\n\n var q, r, val;\n\n q = p - 0.5;\n\n /*-- use AS 241 --- */\n /* double ppnd16_(double *p, long *ifault)*/\n /* ALGORITHM AS241 APPL. STATIST. (1988) VOL. 37, NO. 3\n Produces the normal deviate Z corresponding to a given lower\n tail area of P; Z is accurate to about 1 part in 10**16.\n */\n if (Math.abs(q) <= .425) { /* 0.075 <= p <= 0.925 */\n r = .180625 - q * q;\n val =\n q * (((((((r * 2509.0809287301226727 +\n 33430.575583588128105) * r + 67265.770927008700853) * r +\n 45921.953931549871457) * r + 13731.693765509461125) * r +\n 1971.5909503065514427) * r + 133.14166789178437745) * r +\n 3.387132872796366608) / (((((((r * 5226.495278852854561 +\n 28729.085735721942674) * r + 39307.89580009271061) * r +\n 21213.794301586595867) * r + 5394.1960214247511077) * r +\n 687.1870074920579083) * r + 42.313330701600911252) * r + 1);\n }\n else { /* closer than 0.075 from {0,1} boundary */\n\n /* r = min(p, 1-p) < 0.075 */\n if (q > 0)\n r = 1 - p;\n else\n r = p;\n\n r = Math.sqrt(-Math.log(r));\n /* r = sqrt(-log(r)) <==> min(p, 1-p) = exp( - r^2 ) */\n\n if (r <= 5) { /* <==> min(p,1-p) >= exp(-25) ~= 1.3888e-11 */\n r += -1.6;\n val = (((((((r * 7.7454501427834140764e-4 +\n .0227238449892691845833) * r + .24178072517745061177) *\n r + 1.27045825245236838258) * r +\n 3.64784832476320460504) * r + 5.7694972214606914055) *\n r + 4.6303378461565452959) * r +\n 1.42343711074968357734) / (((((((r *\n 1.05075007164441684324e-9 + 5.475938084995344946e-4) *\n r + .0151986665636164571966) * r +\n .14810397642748007459) * r + .68976733498510000455) *\n r + 1.6763848301838038494) * r +\n 2.05319162663775882187) * r + 1);\n }\n else { /* very close to 0 or 1 */\n r += -5;\n val = (((((((r * 2.01033439929228813265e-7 +\n 2.71155556874348757815e-5) * r +\n .0012426609473880784386) * r + .026532189526576123093) *\n r + .29656057182850489123) * r +\n 1.7848265399172913358) * r + 5.4637849111641143699) *\n r + 6.6579046435011037772) / (((((((r *\n 2.04426310338993978564e-15 + 1.4215117583164458887e-7) *\n r + 1.8463183175100546818e-5) * r +\n 7.868691311456132591e-4) * r + .0148753612908506148525) * r + .13692988092273580531) * r +\n .59983220655588793769) * r + 1);\n }\n\n if (q < 0.0) {\n val = -val;\n }\n }\n\n return mu + sigma * val;\n}\n\nfunction irr(range, guess) {\n var min = -2.0;\n var max = 1.0;\n var n = 0;\n do {\n var guest = (min + max) / 2;\n var NPV = 0;\n for (var i = 0; i < range.length; i++) {\n var arg = range[i];\n NPV += arg[0] / Math.pow((1 + guest), i);\n }\n if (NPV > 0) {\n if (min === max) {\n max += Math.abs(guest);\n }\n min = guest;\n }\n else {\n max = guest;\n }\n n++;\n } while (Math.abs(NPV) > 0.000001 && n < 100000);\n //console.log(n);\n return guest;\n}\n\nfunction counta() {\n var r = 0;\n for (var i = arguments.length; i--;) {\n var arg = arguments[i];\n if (Array.isArray(arg)) {\n var matrix = arg;\n for (var j = matrix.length; j--;) {\n for (var k = matrix[j].length; k--;) {\n if (matrix[j][k] !== null && matrix[j][k] !== undefined) {\n r++;\n }\n }\n }\n }\n else {\n if (arg !== null && arg !== undefined) {\n r++;\n }\n }\n }\n return r;\n}\n\nfunction pmt(rate_per_period, number_of_payments, present_value, future_value, type) {\n type = type || 0;\n future_value = future_value || 0;\n if (rate_per_period != 0.0) {\n // Interest rate exists\n var q = Math.pow(1 + rate_per_period, number_of_payments);\n return -(rate_per_period * (future_value + (q * present_value))) / ((-1 + q) * (1 + rate_per_period * (type)));\n\n }\n else if (number_of_payments != 0.0) {\n // No interest rate, but number of payments exists\n return -(future_value + present_value) / number_of_payments;\n }\n return 0;\n}\n\nfunction concatenate() {\n var r = '';\n for (var i = 0; i < arguments.length; i++) {\n var arg = arguments[i];\n if (arg === null || arg === undefined) continue;\n r += arg;\n }\n return r;\n}\n\nfunction sum() {\n var r = 0;\n for (var i = arguments.length; i--;) {\n var arg = arguments[i];\n if (Array.isArray(arg)) {\n var matrix = arg;\n for (var j = matrix.length; j--;) {\n for (var k = matrix[j].length; k--;) {\n if (!isNaN(matrix[j][k])) {\n r += +matrix[j][k];\n }\n }\n }\n }\n else {\n r += +arg;\n }\n }\n return r;\n}\n\nfunction max() {\n var max = null;\n for (var i = arguments.length; i--;) {\n var arg = arguments[i];\n if (Array.isArray(arg)) {\n var arr = arg;\n for (var j = arr.length; j--;) {\n var col = arr[j];\n if (Array.isArray(col)) {\n for (var k = col.length; k--;) {\n if (max == null || (col[k] != null && max < col[k])) {\n max = col[k];\n }\n }\n }\n else if (max == null || (col != null && max < col)) {\n max = col;\n }\n }\n }\n else if (!isNaN(arg) && (max == null || (arg != null && max < arg))) {\n max = arg;\n }\n }\n return max;\n}\n\nfunction min() {\n var min = null;\n for (var i = arguments.length; i--;) {\n var arg = arguments[i];\n if (Array.isArray(arg)) {\n var arr = arg;\n for (var j = arr.length; j--;) {\n var col = arr[j];\n if (Array.isArray(col)) {\n for (var k = col.length; k--;) {\n if (min == null || (col[k] != null && min > col[k])) {\n min = col[k];\n }\n }\n }\n else if (min == null || (col != null && min > col)) {\n min = col;\n }\n }\n }\n else if (!isNaN(arg) && (min == null || (arg != null && min > arg))) {\n min = arg;\n }\n }\n return min;\n}\n\nfunction vlookup(key, matrix, return_index) {\n for (var i = 0; i < matrix.length; i++) {\n if (matrix[i][0] == key) {\n return matrix[i][return_index - 1];\n }\n }\n throw Error('#N/A');\n}\n\nfunction iserror() {\n // if an error is catched before getting there, true will be returned from the catch block\n // if we get here then it's not an error\n return false;\n}\n\nfunction time(hours, minutes, seconds) {\n const MS_PER_DAY = 24 * 60 * 60 * 1000;\n return ((hours * 60 + minutes) * 60 + seconds) * 1000 / MS_PER_DAY;\n}\n\nfunction day(date) {\n if (!date.getDate) {\n throw Error('#VALUE!');\n }\n var day = date.getDate();\n if (isNaN(day)) {\n throw Error('#VALUE!');\n }\n return day;\n}\n\nfunction month(date) {\n if (!date.getMonth) {\n throw Error('#VALUE!');\n }\n var month = date.getMonth();\n if (isNaN(month)) {\n throw Error('#VALUE!');\n }\n return month + 1;\n}\n\nfunction year(date) {\n if (!date.getFullYear) {\n throw Error('#VALUE!');\n }\n var year = date.getFullYear();\n if (isNaN(year)) {\n throw Error('#VALUE!');\n }\n return year;\n}\n\nfunction right(text, number) {\n number = (number === undefined) ? 1 : parseFloat(number);\n\n if (isNaN(number)) {\n throw Error('#VALUE!');\n }\n if (text === undefined || text === null) {\n text = '';\n } else {\n text = '' + text;\n }\n return text.substring(text.length - number);\n}\n\nfunction left(text, number) {\n number = (number === undefined) ? 1 : parseFloat(number);\n\n if (isNaN(number)) {\n throw Error('#VALUE!');\n }\n if (text === undefined || text === null) {\n text = '';\n } else {\n text = '' + text;\n }\n return text.substring(0, number);\n}\n\nfunction ifs(/*_cond1, _val1, _cond2, _val2, _cond3, _val3, ... */) {\n for (var i = 0; i + 1 < arguments.length; i+=2) {\n var cond = arguments[i];\n var val = arguments[i+1];\n if (cond) {\n return val;\n }\n }\n throw Error('#N/A');\n}\n\nfunction escapeRegExp(str) {\n return str.replace(/([.*+?^=!:${}()|\\[\\]\\/\\\\])/g, \"\\\\$1\");\n}\n\nfunction substitute(text, old_text, new_text, occurrence) {\n if(occurrence <= 0) {\n throw Error('#VALUE!');\n } \n if (!text || !old_text || (!new_text && new_text !== '')) {\n return text;\n } else if (occurrence === undefined) {\n return text.replace(new RegExp(escapeRegExp(old_text), 'g'), new_text);\n } else {\n var index = 0;\n var i = 0;\n while (text.indexOf(old_text, index) > 0) {\n index = text.indexOf(old_text, index + 1);\n i++;\n if (i === occurrence) {\n return text.substring(0, index) + new_text + text.substring(index + old_text.length);\n }\n }\n }\n };\n\nmodule.exports = formulas;\n","\"use strict\";\n\nconst int_2_col_str = require('./int_2_col_str.js');\nconst col_str_2_int = require('./col_str_2_int.js');\nconst RawValue = require('./RawValue.js');\nconst Range = require('./Range.js');\nconst RefValue = require('./RefValue.js');\n\nfunction raw_offset(cell_ref, rows, columns, height, width) {\n height = (height || new RawValue(1)).calc();\n width = (width || new RawValue(1)).calc();\n if (cell_ref.args.length === 1 && cell_ref.args[0].name === 'RefValue') {\n var ref_value = cell_ref.args[0];\n var parsed_ref = ref_value.parseRef();\n var col = col_str_2_int(parsed_ref.cell_name) + columns.calc();\n var col_str = int_2_col_str(col);\n var row = +parsed_ref.cell_name.replace(/^[A-Z]+/g, '') + rows.calc();\n var cell_name = col_str + row;\n if (height === 1 && width === 1) {\n return new RefValue(cell_name, ref_value.formula).calc();\n }\n else {\n var end_range_col = int_2_col_str(col + width - 1);\n var end_range_row = row + height - 1;\n var end_range = end_range_col + end_range_row;\n var str_expression = parsed_ref.sheet_name + '!' + cell_name + ':' + end_range;\n return new Range(str_expression, ref_value.formula).calc();\n }\n }\n}\n\nfunction iferror(cell_ref, onerrorvalue) {\n try {\n var value = cell_ref.calc();\n if (typeof value === 'number' && (isNaN(value) || value === Infinity || value === -Infinity)) {\n return onerrorvalue.calc();\n }\n return value;\n } catch(e) {\n return onerrorvalue.calc();\n }\n}\n\nfunction _if(condition, _then, _else) {\n if (condition.calc()) {\n // console.log(condition.formula.name)\n // if (condition.formula.name === 'P40') {\n // console.log('P40 =', _then.calc());\n // console.log(' -->', _then.args[1].calc());\n // }\n return _then.calc();\n }\n else {\n if (typeof _else === 'undefined') {\n return false;\n } else {\n return _else.calc();\n }\n }\n}\n\nfunction and() {\n for (var i = 0; i < arguments.length; i++) {\n if(!arguments[i].calc()) return false;\n }\n return true;\n}\n\nfunction _or() {\n for (var i = 0; i < arguments.length; i++) {\n if(arguments[i].calc()) return true;\n }\n return false;\n}\n\nfunction transpose(expressionWithRange) {\n let range = expressionWithRange.args[0];\n // console.log(expressionWithRange.args[0])\n // console.log(expressionWithRange.formula.wb.Sheets.Sheet1)\n // console.log(range.calc())\n let matrix = range.calc();\n let cellName = expressionWithRange.formula.name;\n let colRow = cellName.match(/([A-Z]+)([0-9]+)/);\n let sheet = expressionWithRange.formula.sheet;\n // console.log(colRow[1], colRow[2]);\n // console.log(col_str_2_int(colRow[1]));\n let colNumber = col_str_2_int(colRow[1]);\n let rowNumber = +colRow[2];\n for (let i = 0; i < matrix.length; i++) {\n let matrixRow = matrix[i];\n for (let j = 0; j < matrixRow.length; j++) {\n let destinationColumn = colNumber + i;\n let destinationRow = rowNumber + j;\n let value = matrixRow[j];\n // console.log(int_2_col_str(destinationColumn), destinationRow, value);\n sheet[int_2_col_str(destinationColumn) + destinationRow].v = value;\n }\n }\n // console.log(expressionWithRange.formula.name)\n return matrix[0][0];\n}\n\nmodule.exports = {\n 'OFFSET': raw_offset,\n 'IFERROR': iferror,\n 'IF': _if,\n 'AND': and,\n 'OR': _or,\n 'TRANSPOSE': transpose\n};\n","\"use strict\";\n\nconst RawValue = require('./RawValue.js');\nconst str_2_val = require('./str_2_val.js');\nconst find_all_cells_with_formulas = require('./find_all_cells_with_formulas.js');\n\nclass Calculator {\n \n constructor(workbook, exec_formula) {\n this.workbook = workbook;\n this.expressions = [];\n this.exec_formula = exec_formula;\n this.variables = {};\n this.formulas = find_all_cells_with_formulas(workbook, exec_formula);\n for (let i = this.formulas.length - 1; i >= 0; i--) {\n let exp = exec_formula.build_expression(this.formulas[i]);\n this.expressions.push(exp);\n }\n this.calcNames();\n }\n \n setVar(var_name, value) {\n let variable = this.variables[var_name];\n if (variable) {\n variable.setValue(value);\n } else {\n this.expressions.forEach(exp => {\n this.setVarOfExpression(exp, var_name, value);\n });\n }\n }\n \n getVars() {\n let vars = {};\n for (let k in this.variables) {\n vars[k] = this.variables[k].calc();\n }\n return vars;\n }\n \n calcNames() {\n if (!this.workbook || !this.workbook.Workbook || !this.workbook.Workbook.Names) {\n return;\n }\n this.workbook.Workbook.Names.forEach(item => {\n let val = this.getRef(item.Ref);\n this.variables[item.Name] = val;\n this.expressions.forEach(exp => {\n this.setVarOfExpression(exp, item.Name);\n });\n });\n }\n \n getRef(ref_name) {\n if (!this.formulas.length) {\n throw new Error(\"No formula found.\");\n }\n let first_formula = this.formulas[0];\n let formula_ref = first_formula.formula_ref;\n let formula = {\n formula_ref: formula_ref,\n wb: this.workbook,\n exec_formula: this.exec_formula\n };\n return str_2_val(ref_name, formula);\n }\n \n setVarOfExpression(exp, var_name, value) {\n for (let i = 0; i < exp.args.length; i++) {\n let arg = exp.args[i];\n if (arg === var_name) {\n exp.args[i] = this.variables[var_name] || (this.variables[var_name] = new RawValue(value));\n } else if (typeof arg === 'object' && (arg.name === 'Expression' || arg.name === 'UserFn')) {\n this.setVarOfExpression(arg, var_name, value);\n }\n }\n }\n \n execute() {\n this.expressions.forEach(exp => {\n exp.update_cell_value();\n });\n }\n}\n\nmodule.exports = Calculator;"],"sourceRoot":""}