@syncfusion/ej2-calculate 35.1.40 → 35.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ej2-calculate.umd.min.js +2 -2
- package/dist/ej2-calculate.umd.min.js.map +1 -1
- package/dist/es6/ej2-calculate.es2015.js +7 -6
- package/dist/es6/ej2-calculate.es2015.js.map +1 -1
- package/dist/es6/ej2-calculate.es5.js +7 -6
- package/dist/es6/ej2-calculate.es5.js.map +1 -1
- package/dist/global/ej2-calculate.min.js +2 -2
- package/dist/global/ej2-calculate.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/base/calculate.js +2 -1
- package/src/base/parser.js +3 -3
- package/src/formulas/logical.js +2 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: ej2-calculate.umd.min.js
|
|
3
|
-
* version : 35.1.
|
|
3
|
+
* version : 35.1.42
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
|
7
7
|
* licensing@syncfusion.com. Any infringement will be prosecuted under
|
|
8
8
|
* applicable laws.
|
|
9
9
|
*/
|
|
10
|
-
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base"],t):t((r=r||self).ej={},r.ej2Base)}(this,function($,z){"use strict";(r=$.CommonErrors||($.CommonErrors={}))[r.NA=0]="NA",r[r.Value=1]="Value",r[r.Ref=2]="Ref",r[r.DivZero=3]="DivZero",r[r.Num=4]="Num",r[r.Name=5]="Name",r[r.Null=6]="Null",r[r.Calc=7]="Calc",(r=$.FormulasErrorsStrings||($.FormulasErrorsStrings={}))[r.OperatorsCannotStartWithExpression=0]="OperatorsCannotStartWithExpression",r[r.ReservedWordAND=1]="ReservedWordAND",r[r.ReservedWordXOR=2]="ReservedWordXOR",r[r.ReservedWordIf=3]="ReservedWordIf",r[r.NumberContains2DecimalPoints=4]="NumberContains2DecimalPoints",r[r.ReservedWordElse=5]="ReservedWordElse",r[r.ReservedWordNOT=6]="ReservedWordNOT",r[r.InvalidCharInNumber=7]="InvalidCharInNumber",r[r.InvalidCharactersFollowingWithOperator=6]="InvalidCharactersFollowingWithOperator",r[r.MismatchedParentheses=8]="MismatchedParentheses",r[r.UnknownFormulaName=9]="UnknownFormulaName",r[r.RequiresASingleArgument=10]="RequiresASingleArgument",r[r.Requires3Args=11]="Requires3Args",r[r.InvalidMathArgument=12]="InvalidMathArgument",r[r.Requires2Args=13]="Requires2Args",r[r.BadIndex=14]="BadIndex",r[r.TooComplex=15]="TooComplex",r[r.CircularReference=16]="CircularReference",r[r.MissingFormula=17]="MissingFormula",r[r.ImproperFormula=18]="ImproperFormula",r[r.InvalidExpression=19]="InvalidExpression",r[r.CellEmpty=20]="CellEmpty",r[r.BadFormula=21]="BadFormula",r[r.EmptyExpression=22]="EmptyExpression",r[r.VirtualModeRequired=23]="VirtualModeRequired",r[r.MismatchedTics=24]="MismatchedTics",r[r.WrongNumberArguments=25]="WrongNumberArguments",r[r.InvalidArguments=26]="InvalidArguments",r[r.IterationsDoNotConverge=27]="IterationsDoNotConverge",r[r.CalculationOverflow=29]="CalculationOverflow",r[r.AlreadyRegistered=28]="AlreadyRegistered",r[r.MissingSheet=30]="MissingSheet",r[r.CannotParse=31]="CannotParse",r[r.ExpressionCannotEndWithAnOperator=32]="ExpressionCannotEndWithAnOperator",r[r.Spill=33]="Spill",r[r.Div=34]="Div",(r=$.ExcelFileFormats||($.ExcelFileFormats={})).xlsx="xlsx",r.xlsm="xlsm",r.xlsb="xlsb",r.xltx="xltx",r.xltm="xltm",r.xls="xls",r.xml="xml",r.xlam="xlam",r.xla="xla",r.xlw="xlw",r.xlr="xlr",r.prn="prn",r.txt="txt",r.csv="csv",r.dif="dif",r.slk="slk",T.prototype.getModuleName=function(){return"calc-common"};var r=T;function T(r){this.parent=r}function I(r){switch(r){case"dd-MMM-yyyy":case"dd MMM yyyy":r="medium";break;case"MMM yyyy":r="yMMM";break;case"MM/dd/yyyy":case"dd/MM/yyyy":case"dd/MM/yy":r="short";break;case"dddd MMMM dd yyyy":case"dd MMMM yyyy":r="long";break;case"d MMMM yyyy":r="yMMMd";break;case"yyyy":r="y";break;case"h:mm":r="Hm";break;case"h:mm tt":r="hm";break;case"h":r="H";break;case"h tt":r="h";break;case"h:mm:ss tt":r="hms";break;case"h:mm:ss":r="Hms";break;case"d":r="d";break;case"d dddd":r="Ed";break;case"M":r="M";break;case"Md":r="Md";break;case"MMM":r="MMM";break;case"ddd MMM d":r="MMMEd";break;case"MMM d":r="MMMd";break;case"M/yyyy":r="yM";break;case"ddd":r="E";break;default:r=""}return r}function D(r){var t,e=!1;for(t in $.ExcelFileFormats)if(-1<r.indexOf("."+t+"]")){e=!0;break}return e}var w={OperatorsCannotStartWithExpression:"binary operators cannot start an expression",CannotParse:"cannot parse",BadLibrary:"bad library",InvalidCharInFrontOf:"invalid char in front of",NumberContains2DecimalPoints:"number contains 2 decimal points",ExpressionCannotEndWithAnOperator:"expression cannot end with an operator",InvalidCharactersFollowingWithOperator:"invalid characters following an operator",InvalidCharInNumber:"invalid character in number",MismatchedParentheses:"mismatched parentheses",UnknownFormulaName:"unknown formula name",RequiresASingleArgument:"requires a single argument",Requires3Args:"requires 3 arguments",InvalidMathArgument:"invalid Math argument",Requires2Args:"requires 2 arguments",TooComplex:"too complex",MissingFormula:"missing formula",ImproperFormula:"improper formula",InvalidExpression:"invalid expression",CellEmpty:"cell empty",BadFormula:"bad formula",EmptyExpression:"empty expression",MismatchedTics:"mismatched string quotes",WrongNumberArguments:"wrong number of arguments",InvalidArguments:"invalid arguments",IterationsDoNotConverge:"iterations do not converge",AlreadyRegistered:"Control is already registered",CalculationOverflow:"Calculation overflow",MissingSheet:"Missing sheet",CannotParseUnderscore:"cannot_parse",ExpressionCannotEndWithAnOperatorUnderscore:"expression_cannot_end_with_an_operator",CategoryAll:"All"};function j(r){return"[object Date]"===Object.prototype.toString.call(r)&&!isNaN(r.valueOf())}function Q(r){return 0<=r-parseFloat(r)}function L(r,t,e){var n=new Date("01/01/1900"),r=j(r)?r:new Date(r),n=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),r=(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds())-n)/864e5;return(t?r:parseInt(r.toString(),10))+(e?0:60<r?2:1)}k.prototype.parseDouble=function(r){r=this.parent.parseFloat(r.toString());return isNaN(r)?NaN:r},k.prototype.getSheetReference=function(r){return 0===r.indexOf(this.parent.sheetToken)&&r.lastIndexOf(this.parent.sheetToken)>r.indexOf(this.parent.sheetToken)?r.substring(0,r.lastIndexOf(this.parent.sheetToken)+1):""},k.prototype.calculateIFS=function(t,e){var n,i,o,s=this;if(z.isNullOrUndefined(t)||""===t[0]||t.length<2||127<t.length||t.length%2==0)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(3===t.length&&'""'!==t[2]&&t[2].includes(this.parent.tic+this.parent.tic))return n="",o=this.parent.getParseArgumentSeparator(),t[2].split(this.parent.tic+this.parent.tic).forEach(function(r){(r=r.trim().split(s.parent.tic).join(""))&&(i=s.parent.computeIfsFormulas([t[0],t[1],r],s.parent.falseValue,e).toString(),n+=(n?o:"")+i)}),n;return this.parent.computeIfsFormulas(t,this.parent.falseValue,e)},k.prototype.resolveTextArg=function(r){var t;return z.isNullOrUndefined(r)?"":(t=this.parent.getValueFromArg(r),-1<this.parent.getErrorStrings().indexOf(t)||this.parent.isCellReference(r)?t:this.parent.removeTics(t))},k.prototype.resolveNumberArg=function(r){var t=this.parent.getErrorStrings(),e=this.parent.getValueFromArg(r);if(-1<t.indexOf(e))return e;if(""===e)return 0;var n=e.toUpperCase();if(n===this.parent.trueValue)return 1;if(n===this.parent.falseValue)return 0;if(-1<(e=this.parent.isCellReference(r)?e:this.parent.removeTics(e)).indexOf("%")){n=e.replace("%","");if(this.parent.isNumber(n))return this.parent.parseFloat(n)/100}r=this.parent.parseFloat(e);return isNaN(r)?t[$.CommonErrors.Value]:r};var t=k;function k(r){this.owner=r,this.parent=r.parent}P=function(r,t){return(P=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}P(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(q,_=t),q.prototype.ComputeSUM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(e=!0,r.pop()),z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n,i=0,o=0;if(!z.isNullOrUndefined(r))for(var s=r,a=function(r){-1<r.toString().indexOf(".")&&(o=Math.max(o,r.split(".")[1].length))},l=0;l<s.length;l++){var u=s[l].toString();if(-1<u.indexOf(":")&&this.parent.isCellReference(u)){for(var h=this.parent.getCellCollection(u.split(this.parent.tic).join("")),p=0;p<h.length;p++)if(n=e?this.parent.getValueFromArg(h[p],null,null,!0):this.parent.getValueFromArg(h[p]),!e||!n.includes("SUBTOTAL(")){if(-1<this.parent.getErrorStrings().indexOf(n))return n;z.isNullOrUndefined(n[0])||isNaN(this.parent.parseFloat(n))||(a(n),i+=this.parent.parseFloat(n))}}else{if(-1<s[l].indexOf(this.parent.tic)&&(isNaN(this.parent.parseFloat(s[l].split(this.parent.tic).join("")))||""===s[l].split(this.parent.tic).join("").trim()))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(s[l].split(this.parent.tic).join("")===this.parent.trueValue&&(s[l]="1"),s[l].split(this.parent.tic).join("")===this.parent.falseValue&&(s[l]="0"),u=e?this.parent.getValueFromArg(s[l].split(this.parent.tic).join(""),null,null,!0):this.parent.getValueFromArg(s[l].split(this.parent.tic).join("")),!e||!u.includes("SUBTOTAL(")){if(-1<this.parent.getErrorStrings().indexOf(u))return u;z.isNullOrUndefined(u)||isNaN(this.parent.parseFloat(u))||0<u.length&&(a(u),i+=this.parent.parseFloat(u+""))}}}return-1<i.toString().indexOf(".")?i.toFixed(o):i},q.prototype.ComputeSUMIF=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;return e[0].indexOf(":")<0&&!this.parent.isCellReference(e[0])||e[2]&&e[2].indexOf(":")<0&&!this.parent.isCellReference(e[2])?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.ImproperFormula]:3<e.length||e.length<2?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.parent.computeSumIfAndAvgIf(r,!1))&&(this.parent.formulaErrorStrings.indexOf(e)||this.parent.getErrorStrings().indexOf(e))?e:e[0]},q.prototype.ComputeSUMIFS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.calculateIFS(r)},q.prototype.ComputeSUMPRODUCT=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(z.isNullOrUndefined(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];for(var n=0,i=0,o=null,s=t,a=[],l=0;l<s.length;l++){var u=this.parent.getCellCollection(s[l]);if("#REF!"===u[0])return this.parent.getErrorStrings()[$.CommonErrors.Name];a.push(u.length)}for(var h=0;h<a.length;h++)if(a[h]&&a[h+1]&&a[h]!==a[h+1])return this.parent.getErrorStrings()[$.CommonErrors.Value];for(var p=0;p<s.length;++p){var g,f=s[p];if(f.startsWith(this.parent.tic)||!this.parent.isCellReference(f))return g=(m=this.parent.getValueFromArg(f)).indexOf('"'),-1<this.parent.getErrorStrings().indexOf(m)?m:-1<g?0:this.parent.getErrorStrings()[$.CommonErrors.Value];var l=f.indexOf(":"),m=this.parent.rowIndex(f.substr(0,l)),c=this.parent.rowIndex(f.substr(l+1));if(!(-1!==m||-1===c)==(-1===m||-1!==c))return this.parent.getErrorStrings()[$.CommonErrors.Name];c<m&&(m=(g=[c,m])[0],c=g[1]);var d=this.parent.colIndex(f.substr(0,l)),N=this.parent.colIndex(f.substr(l+1));if(N<d&&(d=(r=[N,d])[0],N=r[1]),null===o)for(i=(c-m+1)*(N-d+1),o=[],l=0;l<i;++l)o[l]=1;l=0;for(var v=m;v<=c;++v)for(var E=d;E<=N;++E){var S=this.getSheetReference(f)+this.parent.convertAlpha(E)+v,S=this.parent.getValueFromArg(S);if(-1<this.parent.getErrorStrings().indexOf(S))return S;if(isNaN(this.parent.parseFloat(S)))o[l]=0;else{if(isNaN(o[l]))return this.parent.getErrorStrings()[$.CommonErrors.Name];o[l]=o[l]*this.parent.parseFloat(S)}l++}}for(l=0;l<i;++l)n+=o[l];return n},q.prototype.ComputePRODUCT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(e=!0,r.pop()),z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n,i,o=1,s=!0;if(!z.isNullOrUndefined(r))for(var a=r,l=0;l<a.length;l++){var u,h=a[l];if(-1<h.indexOf(":")&&this.parent.isCellReference(h)){for(var p=this.parent.getCellCollection(h),g=0;g<p.length;g++)if(n=e?this.parent.getValueFromArg(p[g],null,null,!0):this.parent.getValueFromArg(p[g]),(!e||!n.includes("SUBTOTAL("))&&Q(n)){if(-1<this.parent.getErrorStrings().indexOf(n))return n;i=this.parent.parseFloat(n),isNaN(i)||0<n.length&&(o*=i,s=!1)}}else if(-1===h.indexOf(":")&&this.parent.isCellReference(h)){if(u=e?this.parent.getValueFromArg(a[l],null,null,!0):this.parent.getValueFromArg(a[l]),e&&u.includes("SUBTOTAL("))continue;if(!Q(u))continue;if(-1<this.parent.getErrorStrings().indexOf(u))return u}else{if(-1<(u=a[l]).indexOf(this.parent.tic)&&""===u.split(this.parent.tic).join("").trim()||-1<a[l].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(u.split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(u=(u=this.parent.getValueFromArg(a[l].split(this.parent.tic).join("")))===this.parent.trueValue?"1":u===this.parent.falseValue?"0":u.split(this.parent.tic).join(""),-1<this.parent.getErrorStrings().indexOf(u))return u}i=this.parent.parseFloat(u),isNaN(i)||0<u.length&&(o*=i,s=!1)}return s?"0":o.toString()};var P,_,W=q;function q(r){r=_.call(this,r)||this;return r.formulas=[{formulaName:"SUM",category:"Math & Trig",description:"Sums individual values, cell references or ranges."},{formulaName:"SUMIF",category:"Math & Trig",description:"It will sum up cells that meet the given criteria."},{formulaName:"SUMIFS",category:"Math & Trig",description:"Sums the cells specified by a given set of conditionsor criteria."},{formulaName:"SUMPRODUCT",category:"Math & Trig",description:"Returns sum of the product of given ranges of arrays."},{formulaName:"PRODUCT",category:"Math & Trig",description:"Multiplies all the numbers given as arguments and returns the product."}],r}function B(r){return 65<=r.charCodeAt(0)&&r.charCodeAt(0)<=90||97<=r.charCodeAt(0)&&r.charCodeAt(0)<=122}function X(r){for(var t=r,e=0,n=t.length,i=0;i<n;i++)B(t[i])&&e++;var r=t.substring(0,e),o=r.length;if(o!==n&&o<4&&1!==n&&isNaN(parseInt(t,10))){o=function(r){var t=0,e=0;if(t<(r=r.toUpperCase()).length&&"!"===r[t]){for(t++;t<r.length&&"!"!==r[t];)t++;t++}for(;t<r.length&&B(r[t]);){e=26*e+r[t].charCodeAt(0)-64;t++}return 0===e?-1:e}(r);if(o<1||16384<o)return;var s=t.substring(e,n);if(0<s.length){for(var a=!0,l=0;l<s.length;l++){var u=s.charCodeAt(l);if(u<48||57<u){a=!1;break}}if(a){r=parseFloat(s);if(0<r&&r<1048577)return 1}}}}function Y(r){if(-1<(r=r.split("$").join("")).indexOf(":")){var t=r.split(":");if(X(t[0])&&X(t[1]))return 1}else if(r.indexOf(":")<0&&X(r))return 1}H=function(r,t){return(H=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}H(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(e,G=t),e.prototype.ComputeROUND=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(!r.length||1===r.length||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=r;if(1===r.length)return n="TRUE"===e[0].split(this.parent.tic).join("")?"1":"FALSE"===e[0].split(this.parent.tic).join("")?"0":e[0],isNaN(this.parent.parseFloat(n))?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:Math.round(this.parent.parseFloat(n)).toString();var n=this.parent.getValueFromArg(e[0]);if(-1<this.parent.getErrorStrings().indexOf(n))return n;var i=this.parent.getValueFromArg(e[1]);if(-1<this.parent.getErrorStrings().indexOf(i))return i;i="TRUE"===i?"1":"FALSE"===i?"0":i;var n=(n="TRUE"===n?"1":"FALSE"===n?"0":n).split(this.parent.tic).join(""),i=i.split(this.parent.tic).join(""),o=isNaN(Number(n))||""===n.trim(),s=isNaN(Number(i))||""===i.trim();return(-1<e[0].indexOf('"')||this.parent.isCellReference(e[0]))&&o||(-1<e[1].indexOf('"')||this.parent.isCellReference(e[1]))&&s?this.parent.getErrorStrings()[$.CommonErrors.Value]:""===n&&""===i||""===n?0:(o=this.parent.parseFloat(n),e=this.parent.parseFloat(i),(!isNaN(e)&&!isNaN(o)&&0<e?this.parent.parseFloat(this.preciseRound(o,e,"ROUND")):(s=Math.pow(10,-e),Math.round(o/s)*s)).toString())},e.prototype.preciseRound=function(r,t,e){var n=Math.pow(10,t),i=Math.abs(r)*n,r=0<=r?1:-1;return(("ROUND"===e?Math.round(i):"ROUNDDOWN"===e?Math.floor(i):Math.ceil(i))/n*r).toFixed(t)},e.prototype.ComputeROUNDUP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=r.length;if(1===o&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2!==o)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(this.parent.isCellReference(r[0]))e=this.parent.getValueFromArg(r[0])||"0";else{if(-1<r[0].indexOf(this.parent.tic)&&(r[0].split(this.parent.tic).join("")===this.parent.trueValue||r[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];e=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(e))return e;if(this.parent.isCellReference(r[1]))i=this.parent.getValueFromArg(r[1])||"0";else{if(-1<r[1].indexOf(this.parent.tic)&&(r[1].split(this.parent.tic).join("")===this.parent.trueValue||r[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];i=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("")}return-1<this.parent.getErrorStrings().indexOf(i)?i:(e="TRUE"===e.toUpperCase()?"1":"FALSE"===e?"0":e,i="TRUE"===i.toUpperCase()?"1":"FALSE"===i?"0":i,o=isNaN(Number(e))||""===e.trim(),n=isNaN(Number(i))||""===i.trim(),(-1<r[0].indexOf('"')||this.parent.isCellReference(r[0]))&&o||(-1<r[1].indexOf('"')||this.parent.isCellReference(r[1]))&&n?this.parent.getErrorStrings()[$.CommonErrors.Value]:(o=Math.ceil(this.parent.parseFloat(i)),n=this.parent.parseFloat(e),i=(n=0<o?(e=2===(i=e.split(".")).length?i[1].length>=o?o:i[1].length:0,this.parent.parseFloat(this.preciseRound(n,e,"ROUNDUP"))):(0<n?n=n/Math.pow(10,-o)+.49999:n<0&&(n=n/Math.pow(10,-o)-.49999),0<n&&o<-9?+Math.pow(10,-o):this.parent.parseFloat(n.toFixed(0))*Math.pow(10,-o))).toString(),isNaN(n)?-1<o.toString().indexOf('"')?this.parent.getErrorStrings()[$.CommonErrors.Value]:this.parent.getErrorStrings()[$.CommonErrors.Name]:i))},e.prototype.ComputeROUNDDOWN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=r.length;if(1===s&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2!==s)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(this.parent.isCellReference(r[0]))o=this.parent.getValueFromArg(r[0])||"0";else{if(-1<r[0].indexOf(this.parent.tic)&&(r[0].split(this.parent.tic).join("")===this.parent.trueValue||r[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];o=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(o))return o;if(this.parent.isCellReference(r[1]))n=this.parent.getValueFromArg(r[1])||"0";else{if(-1<r[1].indexOf(this.parent.tic)&&(r[1].split(this.parent.tic).join("")===this.parent.trueValue||r[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];n=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("")}return-1<this.parent.getErrorStrings().indexOf(n)?n:(o="TRUE"===o.toUpperCase()?"1":"FALSE"===o?"0":o,n="TRUE"===n.toUpperCase()?"1":"FALSE"===n?"0":n,s=isNaN(Number(o))||""===o.trim(),i=isNaN(Number(n))||""===n.trim(),(-1<r[0].indexOf('"')||this.parent.isCellReference(r[0]))&&s||(-1<r[1].indexOf('"')||this.parent.isCellReference(r[1]))&&i?this.parent.getErrorStrings()[$.CommonErrors.Value]:(s=Math.ceil(this.parent.parseFloat(n)),i=this.parent.parseFloat(o),o=(i=0<s?(n=0,-1!==(e=o.indexOf("."))&&(n=s<=(n=o.length-e-1)?s:n),this.parent.parseFloat(this.preciseRound(i,n,"ROUNDDOWN"))):(0<i?i=i/Math.pow(10,-s)-.49999:i<0&&(i=i/Math.pow(10,-s)+.49999),0<i&&s<-9?+Math.pow(10,-s):this.parent.parseFloat(i.toFixed(0))*Math.pow(10,-s))).toString(),isNaN(i)?-1<s.toString().indexOf('"')?this.parent.getErrorStrings()[$.CommonErrors.Value]:this.parent.getErrorStrings()[$.CommonErrors.Name]:o))},e.prototype.ComputeFLOOR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var e,n=r;if(2!==n.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===n[0]&&""===n[1]||""===n[0]&&!n[1].includes('"'))return 0;""!==n[1]||n[0].includes('"')||(n[1]="0");for(var i=0;i<n.length;i++){var o=n[i].split(this.parent.tic).join("").trim();if(""===o||-1<n[i].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(o)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(Y(n[i])){if((e=(e=this.parent.getValueFromArg(n[i])||"0")===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e).toUpperCase().match(/[A-Z]/)||e.includes('"')||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else if((e=(e=this.parent.getValueFromArg(n[i].split(this.parent.tic).join("")))===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e).toUpperCase().match(/[A-Z]/)||e.includes('"')||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value];n[i]=e}var s=this.parent.parseFloat(n[0]),a=this.parent.parseFloat(n[1]);return 0<s&&a<0?this.parent.getErrorStrings()[$.CommonErrors.Num]:(0<s||s<0)&&0===a?this.parent.getErrorStrings()[$.CommonErrors.DivZero]:isNaN(s)?this.parent.getErrorStrings()[$.CommonErrors.Name]:0===s&&0===a?0:Math.floor(s/a)*a},e.prototype.ComputeCEILING=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var e,n=r;if(2!==n.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===n[0]&&""===n[1]||""===n[0]&&!n[1].includes('"'))return 0;""!==n[1]||n[0].includes('"')||(n[1]="0");for(var i=0;i<n.length;i++){var o=n[i].split(this.parent.tic).join("").trim();if(""===o||-1<n[i].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(o)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(Y(n[i])){if((e=(e=this.parent.getValueFromArg(n[i])||"0")===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e).toUpperCase().match(/[A-Z]/)||e.includes('"')||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else if((e=(e=this.parent.getValueFromArg(n[i].split(this.parent.tic).join("")))===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e).toUpperCase().match(/[A-Z]/)||e.includes('"')||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value];n[i]=e}var s=this.parent.parseFloat(n[0]),a=this.parent.parseFloat(n[1]);return 0<s&&a<0?this.parent.getErrorStrings()[$.CommonErrors.Num]:isNaN(s)?this.parent.getErrorStrings()[$.CommonErrors.Name]:(0<s||0===s)&&0===a?0:Math.ceil(s/a)*a},e.prototype.ComputeINT=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this.parent.getErrorStrings();if(""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(r=this.parent.getValueFromArg(t[0]),!(-1<n.indexOf(r))){if(r.toUpperCase()===this.parent.trueValue?r="1":r.toUpperCase()===this.parent.falseValue&&(r="0"),!this.parent.isCellReference(t[0])&&""===(r=-1===t[0].indexOf(this.parent.tic+this.parent.tic)?r.split(this.parent.tic).join(""):r).trim())return n[$.CommonErrors.Value];if(-1<r.indexOf("%")&&(r=(.01*Number(r.split("%")[0])).toString()),isNaN(this.parent.parseFloat(r)))return n[$.CommonErrors.Value];r=this.parent.parseFloat(r),r=Math.floor(r)}return r},e.prototype.ComputeTRUNC=function(){for(var r,n=this,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=0,o=this.parent.getErrorStrings();if(z.isNullOrUndefined(t)||""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(0===t.length||2<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];function s(r){var t=n.parent.getValueFromArg(r);if(!(-1<o.indexOf(t)))if(t===n.parent.trueValue)t="1";else if(t===n.parent.falseValue)t="0";else if(!n.parent.isCellReference(r)){if(-1<r.indexOf(n.parent.tic)&&n.parent.removeTics(r).match(/^(\d*\.\d+|\d+)\s*[*]\s*(\d*\.\d+|\d+)$/))t=n.parent.getValueFromArg(n.parent.removeTics(r));else if(-1<t.indexOf(n.parent.tic)){if(""===(t=n.parent.removeTics(t)).trim())return o[$.CommonErrors.Value];if(-1<t.indexOf(":")){r=t.split(":");if(!(r.length<=3))return o[$.CommonErrors.Value];if(!n.parent.isNumber(r[0])||!n.parent.isNumber(r[1]))return o[$.CommonErrors.Value];var e=Number(r[0])+Number(Number(r[1])/60);if(3===r.length){if(!n.parent.isNumber(r[2]))return o[$.CommonErrors.Value];e+=Number(Number(r[2])/3600)}t=(e/24).toString()}}2===t.split("%").length&&n.parent.isNumber(t.split("%")[0])&&(t=(.01*Number(t.split("%")[0])).toString())}return t}if(!z.isNullOrUndefined(t[0])){if(r=s(t[0]),-1<o.indexOf(r))return r;if(r=this.parent.parseFloat(r),isNaN(r))return o[$.CommonErrors.Value]}if(!z.isNullOrUndefined(t[1])){if(i=s(t[1]),-1<o.indexOf(i))return i;if(i=this.parent.parseFloat(i),isNaN(i))return o[$.CommonErrors.Value]}return i=Math.pow(10,Math.floor(i)),(((r=Number(r))<0?-1:1)*Math.floor(i*Math.abs(r))/i).toString()},e.prototype.ComputeODD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1!==r.length||""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var e,n=r[0].split(this.parent.tic).join("").trim();if(""===n||-1<r[0].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(Y(r[0])){if(e=this.parent.getValueFromArg(r[0]),-1<this.parent.getErrorStrings().indexOf(e))return e;if(e===this.parent.trueValue)e="1";else if(""===e||e===this.parent.falseValue)e="0";else if(e.toUpperCase().match(/[A-Z]/)||e.includes('"')||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if("#NAME?"===(e=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[$.CommonErrors.Name];if(e===this.parent.trueValue)e="1";else if(""===e||e===this.parent.falseValue)e="0";else if(e.toUpperCase().match(/[A-Z]/)||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value]}var i=0===(n=Math.ceil(parseInt(e,10))),n=n%2==0?0<n?n+1:n-1:n;return Math.ceil(parseInt(e,10))%2!=0&&(0<parseInt(e,10)&&parseFloat(e)>parseInt(e,10)?n+=2:parseInt(e,10)<0&&parseFloat(e)<parseInt(e,10)&&(n-=2)),isNaN(n)?this.parent.getErrorStrings()[$.CommonErrors.Name]:i?1:n},e.prototype.ComputeEVEN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1!==r.length||""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var e,n=r[0].split(this.parent.tic).join("").trim();if(""===n||-1<r[0].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(Y(r[0])){if(e=this.parent.getValueFromArg(r[0]),-1<this.parent.getErrorStrings().indexOf(e))return e;if(e===this.parent.trueValue)e="1";else if(""===e||e===this.parent.falseValue)e="0";else if(e.toUpperCase().match(/[A-Z]/)||e.includes('"')||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if("#NAME?"===(e=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[$.CommonErrors.Name];if(e===this.parent.trueValue)e="1";else if(""===e||e===this.parent.falseValue)e="0";else if(e.toUpperCase().match(/[A-Z]/)||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value]}n=(n=Math.ceil(parseInt(e,10)))%2==0?n:0<n?n+1:n-1;return Math.ceil(parseInt(e,10))%2==0&&(0<parseInt(e,10)&&parseFloat(e)>parseInt(e,10)?n+=2:parseInt(e,10)<0&&parseFloat(e)<parseInt(e,10)&&(n-=2)),isNaN(n)?this.parent.getErrorStrings()[$.CommonErrors.Name]:n};var H,G,Z=e;function e(r){r=G.call(this,r)||this;return r.formulas=[{formulaName:"ROUND",category:"Math & Trig",description:"Rounds a number to a specified number of digits."},{formulaName:"ROUNDUP",category:"Math & Trig",description:"Rounds a number away from zero."},{formulaName:"ROUNDDOWN",category:"Math & Trig",description:"Rounds a number down, toward zero."},{formulaName:"FLOOR",category:"Math & Trig",description:"Returns the round a number down to the nearest integer."},{formulaName:"CEILING",category:"Math & Trig",description:"Returns a number rounded up to a multiple of another number."},{formulaName:"INT",category:"Math & Trig",description:"Returns a number to the nearest integer."},{formulaName:"TRUNC",category:"Math & Trig",description:"Returns the truncated value of a number to a specified number of decimal places."},{formulaName:"ODD",category:"Math & Trig",description:"Rounds a positive number up and negative number down to the nearest odd integer."},{formulaName:"EVEN",category:"Math & Trig",description:"Rounds a positive number up and negative number down to the nearest even integer."}],r}K=function(r,t){return(K=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}K(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(n,rr=t),n.prototype.ComputeABS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=r,i="";if(0===r.length||1<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===n[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var o=n[0].split(this.parent.tic).join("").trim();if(""===o||-1<n[0].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(o)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(n[0])){if(i=this.parent.getValueFromArg(n[0]),-1<this.parent.getErrorStrings().indexOf(i))return i;if(""!==(i=i===this.parent.trueValue?"1":i)&&i!==this.parent.falseValue||(i="0"),e=this.parent.parseFloat(i),isNaN(e)&&!this.parent.isNumber(i))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if((i=(i=this.parent.getValueFromArg(n[0]).split(this.parent.tic).join())===this.parent.trueValue?"1":i)===this.parent.falseValue&&(i="0"),-1<this.parent.getErrorStrings().indexOf(i))return i;if(e=this.parent.parseFloat(i),isNaN(e)&&!this.parent.isNumber(i))return this.parent.getErrorStrings()[$.CommonErrors.Value]}return Math.abs(e)},n.prototype.ComputeRAND=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return 1===r.length&&""===r[0]&&(r.length=0),0<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:Math.random().toString()},n.prototype.ComputeRANDBETWEEN=function(){for(var n,r,t,i=this,e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];return 1===e.length&&""===e[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:2!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(n=this.parent.getErrorStrings(),t=(r=function(r){var t=i.parent.getValueFromArg(r);if(-1<n.indexOf(t))return t;if(i.parent.isCellReference(r)){if(""===t)t="0";else if(-1<r.indexOf(":")||t.match(/^(\d*\.\d+|\d+)\s*[+\-*/]\s*(\d*\.\d+|\d+)$/))return n[$.CommonErrors.Value]}else{if(""===t)return n[$.CommonErrors.NA];if(-1<r.indexOf(i.parent.tic)&&i.parent.removeTics(r).match(/^(\d*\.\d+|\d+)\s*[+*]\s*(\d*\.\d+|\d+)$/))return n[$.CommonErrors.Value];if(-1<t.indexOf(i.parent.tic)&&-1<(t=i.parent.removeTics(t)).indexOf(":")){r=t.split(":");if(!(r.length<=3))return n[$.CommonErrors.Value];if(!i.parent.isNumber(r[0])||!i.parent.isNumber(r[1]))return n[$.CommonErrors.Value];var e=Number(r[0])+Number(Number(r[1])/60);if(3===r.length){if(!i.parent.isNumber(r[2]))return n[$.CommonErrors.Value];e+=Number(Number(r[2])/3600)}t=(e/24).toString()}2===t.split("%").length&&i.parent.isNumber(t.split("%")[0])&&(t=(.01*Number(t.split("%")[0])).toString())}return t=parseFloat(t),isNaN(t)?n[$.CommonErrors.Value]:t})(e[1]),-1<n.indexOf(t)?t:(r=r(e[0]),-1<n.indexOf(r)?r:0===r&&0===t?"0":t<r?n[$.CommonErrors.Num]:(r=Math.ceil(r),t=Math.floor(t),Math.floor(Math.random()*(t-r+1)+r))))},n.prototype.ComputeRADIANS=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this.parent.getErrorStrings();if(z.isNullOrUndefined(t)||""===t[0]&&1===t.length||2===t[0].split("!").length&&-1===t[0].indexOf(this.parent.tic))return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(-1<t[0].indexOf(":")||""===t[0].split(this.parent.tic).join("").trim()||"!"===t[0].split(this.parent.tic).join("").trim()||2===t[0].split("!").length)return n[$.CommonErrors.Value];if(r=this.parent.getValueFromArg(t[0]).trim(),!(-1<n.indexOf(r))){if(-1<r.indexOf(this.parent.tic)&&-1===t[0].indexOf(this.parent.tic)||3<r.split(this.parent.tic).length)return n[$.CommonErrors.Value];if(r.toUpperCase()===this.parent.trueValue?r="1":r.toUpperCase()===this.parent.falseValue?r="0":2===r.split("%").length&&this.parent.isNumber(r.split("%")[0])&&(r=(Number(r.split("%")[0])/100).toString()),r=this.parent.parseFloat(r.split(this.parent.tic).join("")),isNaN(r))return this.parent.isCellReference(t[0])||-1<t[0].indexOf(this.parent.tic)?n[$.CommonErrors.Value]:n[$.CommonErrors.Name];r=Math.PI*r/180}return r},n.prototype.ComputeDEGREES=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||""===r[0]&&1===r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.parent.getValueFromArg(r[0]).trim();if(-1<e.indexOf(n))return n;if(this.parent.isCellReference(r[0])){if(""===n||-1<n.indexOf(":"))return 0;if(-1<n.indexOf(this.parent.tic)||isNaN(Number(n))&&!isNaN(parseInt(n,10)))return e[$.CommonErrors.Value]}else if(-1<n.indexOf('"TRUE"'))return e[$.CommonErrors.Value];if((n=n.split(this.parent.tic).join("")).toUpperCase()===this.parent.trueValue)n="1";else if(n.toUpperCase()===this.parent.falseValue)n="0";else if(-1<n.indexOf("%"))n=(Number(n.split("%")[0])/100).toString();else if(n.toUpperCase().match(/[A-Z]/)||isNaN(parseInt(n,10)))return e[$.CommonErrors.Value];return parseFloat(n)*(180/Math.PI)},n.prototype.ComputePI=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return r&&""!==r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:Math.PI},n.prototype.ComputeMOD=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(z.isNullOrUndefined(t)||2!==t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===t[1]&&!t[0].includes('"'))return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Div];if(""===t[0]&&!t[1].includes('"'))return 0;for(var n=0;n<t.length;n++){var i=t[n].split(this.parent.tic).join("").trim();if(""===i||-1<t[n].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(i)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(Y(t[n])){if((r=(r=this.parent.getValueFromArg(t[n])||"0")===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r).toUpperCase().match(/[A-Z]/)||r.includes('"')||!this.parent.isNumber(r))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else if(r=(r=this.parent.getValueFromArg(t[n].split(this.parent.tic).join("")))===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r,-1<this.parent.getErrorStrings().indexOf(r))return r;t[n]=r}var o=t[0],s=t[1];return"0"===s||""===s?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Div]:"0"===o||""===o?0:(o=(parseFloat(o)%(s=parseFloat(s))+s)%s,isNaN(o)?this.parent.getErrorStrings()[$.CommonErrors.Name]:o)},n.prototype.ComputeFACT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=1,n=this.parent.getErrorStrings();if(""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var i=r[0];if(this.parent.isCellReference(r[0])||isNaN(Number(i.split(this.parent.tic).join("")))){if(i=this.parent.getValueFromArg(r[0]),-1<n.indexOf(i))return i;if(i.startsWith(this.parent.tic)||i.match(/^(\d*\.\d+|\d+)\s*[+\-*/]\s*(\d*\.\d+|\d+)$/))return n[$.CommonErrors.Value];if(""===i)return 1}if(i=i.split(this.parent.tic).join("").trim(),-1<n.indexOf(i))return i;if(i.toUpperCase()===this.parent.trueValue||i.toUpperCase()===this.parent.falseValue)return 1;-1<i.indexOf("%")&&(i=(Number(i.split("%")[0])/100).toString());var o=parseInt(i,10);if(o<0||170<o)return n[$.CommonErrors.Num];if(i.toUpperCase().match(/[A-Z]/)||""===i)return n[$.CommonErrors.Value];if(-1<i.indexOf(":"))return 0;for(var s=1;s<=o;s++)e*=s;return e},n.prototype.ComputeDECIMAL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o;return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:r[0].match(/[@#$%^&*()?:{}|<>+-]/g)?this.parent.getErrorStrings()[$.CommonErrors.Num]:-1<r[1].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(r[1].split(this.parent.tic).join("")))?this.parent.getErrorStrings()[$.CommonErrors.Value]:(n=e=void 0,e=this.parent.isCellReference(r[0].toString())?this.parent.getValueFromArg(r[0]):this.parent.getValueFromArg(r[0]).split(this.parent.tic).join(""),n=this.parent.isCellReference(r[1].toString())?this.parent.getValueFromArg(r[1]):this.parent.getValueFromArg(r[1]).split(this.parent.tic).join(""),i=parseInt(e,10),o=parseInt(n,10),-1<this.parent.getErrorStrings().indexOf(e)?e:-1<this.parent.getErrorStrings().indexOf(n)?n:""===e&&""!==n?0:""===e||i<0||!isNaN(i)&&!Number.isInteger(parseFloat(e))||""===n||o<2||36<o||isNaN(o)||isNaN(this.parent.parseFloat(e))&&this.parent.parseFloat(n)<=10||(i=parseInt(e,parseInt(n,10)),isNaN(i))?this.parent.getErrorStrings()[$.CommonErrors.Num]:i)},n.prototype.ComputeLN=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this.parent.getErrorStrings();return z.isNullOrUndefined(t)||""===t[0]&&1===t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:0===t.length||1<t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.parent.getValueFromArg(t[0]),-1<n.indexOf(r)?r:(r.toUpperCase()===this.parent.trueValue?r="1":r.toUpperCase()===this.parent.falseValue&&(r="0"),this.parent.isCellReference(t[0])||""!==(r=this.parent.removeTics(r)).trim()?(2===r.split("%").length&&this.parent.isNumber(r.split("%")[0])&&(r=(.01*Number(r.split("%")[0])).toString()),(r=this.parent.parseFloat(r))<=0?n[$.CommonErrors.Num]:isNaN(r)?n[$.CommonErrors.Value]:Math.log(r)):n[$.CommonErrors.Value]))},n.prototype.ComputeLOG=function(){for(var r,t,n=this,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o=this.parent.getErrorStrings();if(z.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2<e.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];function s(r){var t=n.parent.getValueFromArg(r);if(t===n.parent.trueValue?t="1":t===n.parent.falseValue&&(t="0"),!n.parent.isCellReference(r)&&""!==t){if(-1<t.indexOf(n.parent.tic)&&-1===o.indexOf(t.split(n.parent.tic).join(""))){if(""===(t=n.parent.removeTics(t)).trim())return o[$.CommonErrors.Value];if(-1<t.indexOf(":")){r=t.split(":");if(!(r.length<=3))return o[$.CommonErrors.Value];if(!n.parent.isNumber(r[0])||!n.parent.isNumber(r[1]))return o[$.CommonErrors.Value];var e=Number(r[0])+Number(Number(r[1])/60);if(3===r.length){if(!n.parent.isNumber(r[2]))return o[$.CommonErrors.Value];e+=Number(Number(r[2])/3600)}t=(e/24).toString()}}2===t.split("%").length&&n.parent.isNumber(t.split("%")[0])&&(t=(.01*Number(t.split("%")[0])).toString())}return t}if(!z.isNullOrUndefined(e[0])){if(r=s(e[0]),-1<o.indexOf(r))return r;r=this.parent.parseFloat(r)}if(t=10,!z.isNullOrUndefined(e[1])){if(t=s(e[1]),-1<o.indexOf(t))return t;t=this.parent.parseFloat(t)}return r=Number(r),isNaN(r)||isNaN(t)?o[$.CommonErrors.Value]:r<=0||t<=0?o[$.CommonErrors.Num]:1===t?o[$.CommonErrors.DivZero]:(Math.log(r)/Math.LN10/(Math.log(t)/Math.LN10)).toString()},n.prototype.ComputePOWER=function(){for(var e=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1===r.length&&""===r[0].trim()?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:2<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:""===r[0].trim()&&""===r[1].trim()?o[$.CommonErrors.Num]:(n=(i=function(r){var t=e.parent.getValueFromArg(r);if(-1<o.indexOf(t))return t;if(t.toUpperCase()===e.parent.trueValue?t="1":t.toUpperCase()===e.parent.falseValue&&(t="0"),-1<t.indexOf(e.parent.tic)&&(t=e.parent.removeTics(t),-1===r.indexOf(e.parent.tic)||""===t.trim()))return o[$.CommonErrors.Value];if(2===t.split("%").length&&e.parent.isNumber(t.split("%")[0]))t=(Number(t.split("%")[0])/100).toString();else if(-1<t.indexOf("/")&&e.parent.isNumber(t.split("/").join("")))return o[$.CommonErrors.Num];return t=e.parent.parseFloat(t),isNaN(t)?o[$.CommonErrors.Value]:t})(r[0]),-1<o.indexOf(n)?n:(i=i(r[1]),-1<o.indexOf(i)?i:isNaN(n)||isNaN(i)?o[$.CommonErrors.Value]:0===n&&i<0?o[$.CommonErrors.DivZero]:0===n&&0===i||(n=Math.pow(n,i),isNaN(n))||n===1/0?o[$.CommonErrors.Num]:n.toString()))},n.prototype.ComputeSQRT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r[0];if(0===r.length||1<r.length||""===e)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===e.split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(e)){if(-1<(n=this.parent.getValueFromArg(e)||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if(-1<e.indexOf(this.parent.tic)&&(e.split(this.parent.tic).join("")===this.parent.trueValue||e.split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];n=this.parent.getValueFromArg(e).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(n))return n;var n=n===this.parent.trueValue?"1":n===this.parent.falseValue?"0":n,i=this.parent.parseFloat(n);if(i<0)return this.parent.getErrorStrings()[$.CommonErrors.Num];if(isNaN(i)||-1<e.indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(e))){i=this.parent.hostParseDate(isNaN(i)?n:e.split(this.parent.tic).join(""));if(!i.isDate&&!i.isTime)return this.parent.getErrorStrings()[$.CommonErrors.Value];n=i.value}return Math.sqrt(this.parent.parseFloat(n))},n.prototype.ComputeEXP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(""===r[0]&&1===r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===r[0].split(this.parent.tic).join("").trim())return e[$.CommonErrors.Value];if(n=this.parent.getValueFromArg(r[0]),-1<e.indexOf(n))return n;if(-1<n.indexOf(this.parent.tic)&&(this.parent.isCellReference(r[0])||isNaN(Number(n.split(this.parent.tic).join("")))))return e[$.CommonErrors.Value];if((n=n.split(this.parent.tic).join(""))===this.parent.trueValue)n="1";else if(n===this.parent.falseValue||""===n)n="0";else if(-1<n.indexOf("%"))n=(Number(n.split("%")[0])/100).toString();else if(-1<n.indexOf(":"))return"0";var n=this.parent.parseFloat(n);return isNaN(n)?e[$.CommonErrors.Value]:709<n?e[$.CommonErrors.Num]:Math.exp(n).toString()};var K,rr,tr=n;function n(r){r=rr.call(this,r)||this;return r.formulas=[{formulaName:"ABS",category:"Math & Trig",description:"Returns the absolute value of a number."},{formulaName:"RAND",category:"Math & Trig",description:"Return a random number between 0 and 1."},{formulaName:"RANDBETWEEN",category:"Math & Trig",description:"Returns an integer random number in a specified range."},{formulaName:"RADIANS",category:"Math & Trig",description:"Converts degrees to radians."},{formulaName:"DEGREES",category:"Math & Trig",description:"Converts radians to degrees."},{formulaName:"PI",category:"Math & Trig",description:"Returns the value of pi."},{formulaName:"MOD",category:"Math & Trig",description:"Returns a remainder after a number is divided by divisor."},{formulaName:"FACT",category:"Math & Trig",description:"Returns the factorial of a number."},{formulaName:"DECIMAL",category:"Math & Trig",description:"Converts a text representation of a number in a given base into a decimal number."},{formulaName:"LN",category:"Math & Trig",description:"Returns the natural logarithm of a number."},{formulaName:"LOG",category:"Math & Trig",description:"Returns the logarithm of a number to the base that you specify."},{formulaName:"POWER",category:"Math & Trig",description:"Returns the result of a number raised to power."},{formulaName:"SQRT",category:"Math & Trig",description:"Returns the square root of a positive number."},{formulaName:"EXP",category:"Math & Trig",description:"Returns e raised to the power of the given number."}],r}er=function(r,t){return(er=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}er(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(i,nr=t),i.prototype.unaryMath=function(r,t,e){var n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length||""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveNumberArg(r[0]))?r:e&&!e(r)?n[$.CommonErrors.Num]:t(r).toString()},i.prototype.ComputeSIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.sin)},i.prototype.ComputeCOS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.cos)},i.prototype.ComputeTAN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.tan)},i.prototype.ComputeASIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.asin,function(r){return-1<=r&&r<=1})},i.prototype.ComputeACOS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.acos,function(r){return-1<=r&&r<=1})},i.prototype.ComputeATAN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.atan)},i.prototype.ComputeSINH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.sinh)},i.prototype.ComputeCOSH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.cosh)},i.prototype.ComputeTANH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.tanh)},i.prototype.ComputeLOG10=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.log10,function(r){return 0<r})},i.prototype.ComputeSQRTPI=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,function(r){return Math.sqrt(r*Math.PI)},function(r){return 0<=r})},i.prototype.ComputeATAN2=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:0===e&&0===n?i[$.CommonErrors.DivZero]:Math.atan2(n,e).toString())},i.prototype.ComputeSIGN=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveNumberArg(t[0]))?r:(0<r?1:r<0?-1:0).toString()},i.prototype.ComputeQUOTIENT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:0===n?i[$.CommonErrors.DivZero]:Math.trunc(e/n).toString())};var er,nr,ir=i;function i(r){r=nr.call(this,r)||this;return r.formulas=[{formulaName:"SIN",category:"Math & Trig",description:"Returns the sine of an angle."},{formulaName:"COS",category:"Math & Trig",description:"Returns the cosine of an angle."},{formulaName:"TAN",category:"Math & Trig",description:"Returns the tangent of an angle."},{formulaName:"ASIN",category:"Math & Trig",description:"Returns the arcsine of a number."},{formulaName:"ACOS",category:"Math & Trig",description:"Returns the arccosine of a number."},{formulaName:"ATAN",category:"Math & Trig",description:"Returns the arctangent of a number."},{formulaName:"ATAN2",category:"Math & Trig",description:"Returns the arctangent from x- and y-coordinates."},{formulaName:"SINH",category:"Math & Trig",description:"Returns the hyperbolic sine of a number."},{formulaName:"COSH",category:"Math & Trig",description:"Returns the hyperbolic cosine of a number."},{formulaName:"TANH",category:"Math & Trig",description:"Returns the hyperbolic tangent of a number."},{formulaName:"SIGN",category:"Math & Trig",description:"Returns the sign of a number."},{formulaName:"LOG10",category:"Math & Trig",description:"Returns the base-10 logarithm of a number."},{formulaName:"QUOTIENT",category:"Math & Trig",description:"Returns the integer portion of a division."},{formulaName:"SQRTPI",category:"Math & Trig",description:"Returns the square root of a number multiplied by pi."}],r}or=function(r,t){return(or=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}or(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(lr,sr=t),lr.prototype.unaryMath=function(r,t,e){var n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length||""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveNumberArg(r[0]))?r:(!e||e(r))&&(e=t(r),isFinite(e))?e.toString():n[$.CommonErrors.Num]},lr.prototype.ComputeACOSH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.acosh,function(r){return 1<=r})},lr.prototype.ComputeASINH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.asinh)},lr.prototype.ComputeATANH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.atanh,function(r){return-1<r&&r<1})};var or,sr,ar=lr;function lr(r){r=sr.call(this,r)||this;return r.formulas=[{formulaName:"ACOSH",category:"Math & Trig",description:"Returns the inverse hyperbolic cosine of a number."},{formulaName:"ASINH",category:"Math & Trig",description:"Returns the inverse hyperbolic sine of a number."},{formulaName:"ATANH",category:"Math & Trig",description:"Returns the inverse hyperbolic tangent of a number."}],r}function ur(r){var t=r<0?-1:1,r=Math.abs(r),e=1/(1+.3275911*r);return t*(1-((((1.061405429*e-1.453152027)*e+1.421413741)*e-.284496736)*e+.254829592)*e*Math.exp(-r*r))}function hr(r){return 1-ur(r)}function pr(r,t,e){return void 0===t&&(t=0),(e=void 0===e?1:e)<=0?NaN:.5*(1+ur((r-t)/(e*Math.SQRT2)))}function gr(r,t,e){var n,i,o,s,a,l;return void 0===t&&(t=0),void 0===e&&(e=1),r<=0||1<=r||e<=0?NaN:(n=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],i=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],o=[-.007784894002430293,-.3223964580411018,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],s=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],t+e*(l=r<.02425?(a=Math.sqrt(-2*Math.log(r)),(((((o[0]*a+o[1])*a+o[2])*a+o[3])*a+o[4])*a+o[5])/((((s[0]*a+s[1])*a+s[2])*a+s[3])*a+1)):r<=.97575?(((((n[0]*(l=(a=r-.5)*a)+n[1])*l+n[2])*l+n[3])*l+n[4])*l+n[5])*a/(((((i[0]*l+i[1])*l+i[2])*l+i[3])*l+i[4])*l+1):(a=Math.sqrt(-2*Math.log(1-r)),-(((((o[0]*a+o[1])*a+o[2])*a+o[3])*a+o[4])*a+o[5])/((((s[0]*a+s[1])*a+s[2])*a+s[3])*a+1))))}function fr(r){var t,r=r.trim();return""===r?null:(t=r.match(/^(-?\d+(?:\.\d+)?)([+-]\d+(?:\.\d+)?)[ij]$/i))?{re:parseFloat(t[1]),im:parseFloat(t[2])}:(t=r.match(/^([+-]?\d+(?:\.\d+)?)[ij]$/i))?{re:0,im:parseFloat(t[1])}:(t=r.match(/^(-?\d+(?:\.\d+)?)$/))?{re:parseFloat(t[1]),im:0}:null}function s(r,t,e){var n;return void 0===e&&(e="i"),0===t?r.toString():0===r?t.toString()+e:(n=0<=t?"+":"-",r.toString()+n+Math.abs(t).toString()+e)}function l(r){if(r<0||170<r)return NaN;for(var t=1,e=2;e<=r;e++)t*=e;return t}function f(r,t){if(t<0||r<t)return 0;t=Math.min(t,r-t);for(var e=1,n=1;n<=t;n++)e=e*(r-t+n)/n;return e}function mr(r){if(r<=0)return NaN;var t=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,Number("9.984369578019571e-6"),1.5056327351493116e-7];if(r<.5)return Math.log(Math.PI/Math.sin(Math.PI*r))-mr(1-r);--r;for(var e=t[0],n=1;n<9;n++)e+=t[n]/(r+n);var i=r+7+.5;return.5*Math.log(2*Math.PI)+(r+.5)*Math.log(i)-i+Math.log(e)}function cr(r){r=mr(r);return isFinite(r)?Math.exp(r):NaN}function dr(r,t){if(t<0||r<=0)return NaN;if(0===t)return 0;if(1e6<t)return 1;for(var e=1/r,n=e,i=1;i<200&&(e+=n*=t/(r+i),!(Math.abs(n)<1e-12*Math.abs(e)));i++);return e*Math.exp(-t+r*Math.log(t)-mr(r))}function Nr(r,t){return r<0||t<=0?NaN:dr(t/2,r/2)}function vr(r,t){if(r<=0||1<=r||t<=0)return NaN;for(var e=0,n=Math.max(100,t+10*Math.sqrt(2*t)),i=0;i<100;i++){var o=(e+n)/2;Nr(o,t)<r?e=o:n=o}return(e+n)/2}function Er(r,t,e){return r<0||t<=0||e<=0?NaN:Sr(t/2,e/2,t*r/(t*r+e))}function Sr(r,t,e){if(e<=0)return 0;if(1<=e)return 1;for(var n=mr(r)+mr(t)-mr(r+t),n=Math.exp(r*Math.log(e)+t*Math.log(1-e)-n)/r,i=1,o=1,s=0,a=0;a<=200;a++){var l=2*a,u=a*(t-a)*e/((r+l-1)*(r+l)),s=1+u*s,o=1+u/o,l=(i*=(s=1/(s=Math.abs(s)<1e-30?1e-30:s))*(o=Math.abs(o)<1e-30?1e-30:o),s=1+(u=-(r+a)*(r+t+a)*e/((r+l)*(r+l+1)))*s,o=1+u/o,(s=1/(s=Math.abs(s)<1e-30?1e-30:s))*(o=Math.abs(o)<1e-30?1e-30:o));if(i*=l,Math.abs(l-1)<1e-10)break}return n*(i-1)}function yr(r,t,e){if(r<=0||1<=r||t<=0||e<=0)return NaN;for(var n=0,i=1e3;Er(i,t,e)<r&&!(1e12<(i*=2)););for(var o=0;o<100;o++){var s=(n+i)/2;Er(s,t,e)<r?n=s:i=s}return(n+i)/2}function Cr(r,t){if(t<0)return Cr(r,-t);for(var e=Math.abs(Math.floor(r)),n=0,i=0;i<100;i++){var o=Math.pow(t/2,2*i+e)/(l(i)*l(i+e));if(n+=o,10<i&&o<1e-15*n)break}return n}function br(r,t){for(var e=Math.abs(Math.floor(r)),n=0,i=0;i<100;i++){var o=(i%2==0?1:-1)*Math.pow(t/2,2*i+e)/(l(i)*l(i+e));if(n+=o,10<i&&Math.abs(o)<1e-15*Math.abs(n))break}return n}function Ar(r,t){return t<=0?NaN:0===(r=Math.abs(Math.floor(r)))?Math.PI/2*(Cr(0,t)-br(0,t)):Math.PI/2*(Cr(r,t)-br(r,t))}function Or(r){for(var t=br(0,r),e=0,n=1;n<100;n++){for(var i=0,o=1;o<=n;o++)i+=1/o;e+=Math.pow(r/2,2*n)/(l(n)*l(n))*i}return 2/Math.PI*(t*(Math.log(r/2)+.5772156649)-e)}function Fr(r,t){if(t<=0)return NaN;var e=Math.abs(Math.floor(r));if(0===e)return Or(t);var n=Or(t),i=function(r){for(var t=br(1,r),e=0,n=0;n<100;n++)e+=(n%2==0?1:-1)*Math.pow(r/2,2*n+1)/(l(n)*l(n+1)*(2*n+1));return 2/Math.PI*(t*Math.log(r/2)-1/(r/2)+e)}(t);if(1!==e)for(var o=1;o<e;o++)var s=2*o/t*i-n,n=i,i=s;return i}function xr(r,t,e){return r<=0||e<=0?NaN:pr(Math.log(r),t,e)}function Vr(r,t,e){return Math.exp(gr(r,t,e))}function Rr(r,t){return t<=0?NaN:(t=Sr(t/2,.5,t/(t+r*r)),0<=r?1-.5*t:.5*t)}function Tr(r,t){if(r<=0||1<=r||t<=0)return NaN;for(var e=-100,n=100,i=0;i<100;i++){var o=(e+n)/2;Rr(o,t)<r?e=o:n=o}return(e+n)/2}function Ir(r,t,e){return r<0||1<r||t<=0||e<=0?NaN:Sr(t,e,r)}function Mr(r,t,e){if(r<=0||1<=r||t<=0||e<=0)return NaN;for(var n=0,i=1,o=0;o<100;o++){var s=(n+i)/2;Sr(t,e,s)<r?n=s:i=s}return(n+i)/2}Dr=function(r,t){return(Dr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Dr(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(jr,Ur=t),jr.prototype.ComputeFACTDOUBLE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]);if("string"==typeof n)return n;n=Math.floor(n);if(n<0||300<n)return e[$.CommonErrors.Num];for(var i=1,o=n;0<o;o-=2)i*=o;return i.toString()},jr.prototype.ComputeMULTINOMIAL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];for(var n=[],i=0;i<r.length;i++){var o=this.resolveNumberArg(r[i]);if("string"==typeof o)return o;o=Math.floor(o);if(o<0)return e[$.CommonErrors.Num];n.push(o)}for(var s=n.reduce(function(r,t){return r+t},0),a=1,i=0;i<n.length;i++)a*=l(n[i]);return(l(s)/a).toString()},jr.prototype.ComputePERMUT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;var o=Math.floor(n),s=Math.floor(i);if(o<0||s<0||o<s)return e[$.CommonErrors.Num];for(var a=1,l=0;l<s;l++)a*=o-l;return a.toString()},jr.prototype.ComputeSERIESSUM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<4)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;for(var o=[],s=3;s<r.length;s++){var a=this.resolveNumberArg(r[s]);if("string"==typeof a)return a;o.push(a)}for(var l=0,s=0;s<o.length;s++)l+=o[s]*Math.pow(e,n+s*i);return l.toString()},jr.prototype.ComputeROMAN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]);if("string"==typeof n)return n;var i=0;if(2===r.length){var o=this.resolveNumberArg(r[1]);if("string"==typeof o)return o;if((i=Math.floor(o))<0||4<i)return e[$.CommonErrors.Value]}o=Math.floor(n);return o<0||3999<o?e[$.CommonErrors.Value]:0===o?"":this.toRoman(o,i)},jr.prototype.toRoman=function(r,t){var e=Math.min(t,4),n=["","M","MM","MMM"][Math.floor(r/1e3)],n=(n=(n+=[["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"],["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"],["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"],["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"],["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"]][e][Math.floor(r%1e3/100)])+[["","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"],["","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"],["","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"],["","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"],["","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"]][e][Math.floor(r%100/10)])+[["","I","II","III","IV","V","VI","VII","VIII","IX"],["","I","II","III","IV","V","VI","VII","VIII","IX"],["","I","II","III","IV","V","VI","VII","VIII","IX"],["","I","II","III","IV","V","VI","VII","VIII","IX"],["","I","II","III","IV","V","VI","VII","VIII","IX"]][e][r%10];return 1===t?n=n.replace(/XLV/g,"VL").replace(/XCV/g,"VC").replace(/CDL/g,"LD").replace(/CML/g,"LM").replace(/CMVC/g,"LMVL"):2===t||3===t?n=n.replace(/IV/g,"IIII").replace(/IX/g,"VIIII").replace(/XL/g,"XXXX").replace(/XC/g,"LXXXX").replace(/CD/g,"CCCC").replace(/CM/g,"DCCCC"):4===t&&(n=n.replace(/V/g,"IV").replace(/L/g,"XL").replace(/D/g,"CD")),n};var Dr,Ur,wr=jr;function jr(r){r=Ur.call(this,r)||this;return r.formulas=[{formulaName:"FACTDOUBLE",category:"Math & Trig",description:"Returns the double factorial of a number."},{formulaName:"MULTINOMIAL",category:"Math & Trig",description:"Returns the multinomial of a set of numbers."},{formulaName:"PERMUT",category:"Math & Trig",description:"Returns the number of permutations for a given number of objects."},{formulaName:"SERIESSUM",category:"Math & Trig",description:"Returns the sum of a power series."},{formulaName:"ROMAN",category:"Math & Trig",description:"Converts an Arabic numeral to Roman, as text."}],r}Lr=function(r,t){return(Lr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Lr(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(_r,kr=t),_r.prototype.collectNumbers=function(r){for(var t=this.parent.getErrorStrings(),e=[],n=0;n<r.length;n++){var i=r[n];if(""!==i)if(this.parent.isCellReference(i)&&-1<i.indexOf(":"))for(var o=this.parent.getCellCollection(i),s=Array.isArray(o)?o:[o],a=0;a<s.length;a++){var l=this.parent.getValueFromArg(s[a]);if(-1<t.indexOf(l))return l;""!==l&&this.parent.isNumber(l)&&e.push(this.parent.parseFloat(l))}else{o=this.resolveNumberArg(i);if("string"==typeof o)return o;e.push(o)}}return e},_r.prototype.gcd2=function(r,t){for(var e=Math.abs(Math.floor(r)),n=Math.abs(Math.floor(t));n;)var i=n,n=e%n,e=i;return e},_r.prototype.ComputeGCD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectNumbers(r);if("string"==typeof n)return n;if(0===n.length)return e[$.CommonErrors.Value];for(var i=0;i<n.length;i++)if(n[i]<0)return e[$.CommonErrors.Num];for(var o=Math.floor(n[0]),i=1;i<n.length;i++)o=this.gcd2(o,n[i]);return o.toString()},_r.prototype.ComputeLCM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectNumbers(r);if("string"==typeof n)return n;if(0===n.length)return e[$.CommonErrors.Value];for(var i=0;i<n.length;i++)if(n[i]<0)return e[$.CommonErrors.Num];for(var o=Math.floor(n[0]),i=1;i<n.length;i++)var s=Math.floor(n[i]),o=0===o||0===s?0:Math.abs(o*s)/this.gcd2(o,s);return o.toString()},_r.prototype.ComputeMROUND=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:0===n?"0":0<e&&n<0||e<0&&0<n?i[$.CommonErrors.Num]:(Math.round(e/n)*n).toString())},_r.prototype.ComputeCOMBIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;var o=Math.floor(n),s=Math.floor(i);if(o<0||s<0||o<s)return e[$.CommonErrors.Num];for(var a=1,l=1;l<=s;l++)a=a*(o-s+l)/l;return Math.round(a).toString()},_r.prototype.ComputeSUMSQ=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var e=this.collectNumbers(r);if("string"==typeof e)return e;for(var n=0,i=0;i<e.length;i++)n+=e[i]*e[i];return n.toString()};var Lr,kr,Pr=_r;function _r(r){r=kr.call(this,r)||this;return r.formulas=[{formulaName:"GCD",category:"Math & Trig",description:"Returns the greatest common divisor."},{formulaName:"LCM",category:"Math & Trig",description:"Returns the least common multiple."},{formulaName:"MROUND",category:"Math & Trig",description:"Returns a number rounded to the desired multiple."},{formulaName:"COMBIN",category:"Math & Trig",description:"Returns the number of combinations for a given number of objects."},{formulaName:"SUMSQ",category:"Math & Trig",description:"Returns the sum of the squares of the arguments."}],r}function Wr(r){return 1<r/26?Wr(r%26==0?r/26-1:Math.floor(r/26))+String.fromCharCode(r%26==0?"Z".charCodeAt(0):64+r%26):String.fromCharCode(64+r)}function qr(r){return[parseInt(r.match(/\d+/)[0],10)-1,function(r){for(var t=0,e=(r=r.split("").reverse().join("")).length-1;0<=e;e--)t+=(r[e].charCodeAt(0)-64)*Math.pow(26,e);return t-1}(r.match(/[A-Z]+/i)[0].toUpperCase())]}function Br(r,t){return Wr(t+1)+(r+1)}function Xr(r){return Br(r[0],r[1])+":"+(z.isNullOrUndefined(r[2])?Br(r[0],r[1]):Br(r[2],r[3]))}function M(r,t){var e,n,i,o=[];return r&&(r=-1===(r=-1<r.lastIndexOf("!")?r.substring(r.lastIndexOf("!")+1):r).indexOf(":")?r+":"+r:r,new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)/g).test(r)||(n=r.split(":"),i=t&&t.rowCount?t.rowCount-1:1,t=t&&t.colCount?Wr(t.colCount):"A",r=z.isNullOrUndefined(r.match(/[0-9]/))?n[0]+"1:"+n[1]+i:"A"+n[0]+":"+t+n[1]),r.split(":").forEach(function(r){e=qr(r),o.push(e[0]),o.push(e[1])})),o}Yr=function(r,t){return(Yr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Yr(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Zr,Hr=t),Zr.prototype.readMatrix=function(r){var t=this.parent.getErrorStrings(),r=r.split("$").join("");if(!this.parent.isCellReference(r.split(":")[0]))return t[$.CommonErrors.Value];var e=M(r),n=e[2]-e[0]+1,i=e[3]-e[1]+1,e=this.parent.getCellCollection(r),o=Array.isArray(e)?e:[e];if(o.length!==n*i)return t[$.CommonErrors.Value];for(var s=[],a=0;a<n;a++){for(var l=[],u=0;u<i;u++){var h=this.parent.getValueFromArg(o[a*i+u]);if(-1<t.indexOf(h))return h;if(""===h||!this.parent.isNumber(h))return t[$.CommonErrors.Value];l.push(this.parent.parseFloat(h))}s.push(l)}return s},Zr.prototype.flattenMatrix=function(r,t){void 0===t&&(t=!1);var e=this.parent.getParseArgumentSeparator(),n=r.length,i=r[0].length,o=[];if(t)for(var s=0;s<i;s++)for(var a=0;a<n;a++)o.push(r[a][s].toString());else for(a=0;a<n;a++)for(s=0;s<i;s++)o.push(r[a][s].toString());return o.join(e)},Zr.prototype.determinant=function(r){var t=r.length;if(1===t)return r[0][0];if(2===t)return r[0][0]*r[1][1]-r[0][1]*r[1][0];for(var e=0,n=0;n<t;n++){for(var i=[],o=1;o<t;o++){for(var s=[],a=0;a<t;a++)a!==n&&s.push(r[o][a]);i.push(s)}e+=(n%2==0?1:-1)*r[0][n]*this.determinant(i)}return e},Zr.prototype.inverse=function(r){for(var t=r.length,e=[],n=0;n<t;n++){e.push(r[n].slice());for(var i=0;i<t;i++)e[n].push(n===i?1:0)}for(n=0;n<t;n++){for(var o=n,s=n+1;s<t;s++)Math.abs(e[s][n])>Math.abs(e[o][n])&&(o=s);var a=e[n],l=(e[n]=e[o],e[o]=a,e[n][n]);if(Math.abs(l)<1e-12)return null;for(i=0;i<2*t;i++)e[n][i]/=l;for(s=0;s<t;s++)if(s!==n)for(var u=e[s][n],i=0;i<2*t;i++)e[s][i]-=u*e[n][i]}for(var h=[],n=0;n<t;n++)h.push(e[n].slice(t));return h},Zr.prototype.multiply=function(r,t){if(r[0].length!==t.length)return null;for(var e=r.length,n=t[0].length,i=t.length,o=[],s=0;s<e;s++){for(var a=[],l=0;l<n;l++){for(var u=0,h=0;h<i;h++)u+=r[s][h]*t[h][l];a.push(u)}o.push(a)}return o};var Yr,Hr,Gr=Zr;function Zr(){return null!==Hr&&Hr.apply(this,arguments)||this}Kr=function(r,t){return(Kr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Kr(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Qr,$r=Gr),Qr.prototype.ComputeMDETERM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.readMatrix(r[0]))?e:e.length!==e[0].length?n[$.CommonErrors.Value]:this.determinant(e).toString()},Qr.prototype.ComputeMINVERSE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.readMatrix(r[0]))?e:e.length!==e[0].length?n[$.CommonErrors.Value]:(e=this.inverse(e))?this.flattenMatrix(e):n[$.CommonErrors.Num]},Qr.prototype.ComputeMMULT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(n=this.readMatrix(r[0]),e=this.readMatrix(r[1]),"string"==typeof n?n:"string"==typeof e?e:(n=this.multiply(n,e))?this.flattenMatrix(n):i[$.CommonErrors.Value])},Qr.prototype.ComputeTRANSPOSE=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.readMatrix(t[0]))?r:this.flattenMatrix(r,!0)};var Kr,$r,zr=Qr;function Qr(r){r=$r.call(this,r)||this;return r.formulas=[{formulaName:"MDETERM",category:"Math & Trig",description:"Returns the matrix determinant of an array."},{formulaName:"MINVERSE",category:"Math & Trig",description:"Returns the matrix inverse of an array."},{formulaName:"MMULT",category:"Math & Trig",description:"Returns the matrix product of two arrays."},{formulaName:"TRANSPOSE",category:"Math & Trig",description:"Returns the transpose of an array."}],r}Jr=function(r,t){return(Jr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Jr(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(o,rt=t),o.prototype.parseBaseNumber=function(r,t){var e=this.parent.getErrorStrings(),r=r.trim().toUpperCase();return""===r||!(16===t?/^[0-9A-F]+$/:2===t?/^[01]+$/:/^[0-7]+$/).test(r)||(r=parseInt(r,t),isNaN(r))?e[$.CommonErrors.Num]:r},o.prototype.resolveBaseArg=function(r,t){var e=this.parent.getErrorStrings(),r=this.resolveTextArg(r);return-1<e.indexOf(r)?r:this.parseBaseNumber(r,t)},o.prototype.formatToBase=function(r,t,e){var n=this.parent.getErrorStrings(),r=Math.trunc(r),i={2:{min:-512,max:511,maxPlaces:10},8:{min:-536870912,max:536870911,maxPlaces:10},10:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,maxPlaces:0},16:{min:-549755813888,max:549755813887,maxPlaces:10}}[t];if(r<i.min||r>i.max)return n[$.CommonErrors.Num];r<0&&(r=(1<<(e&&0<e?e:10))+r);var o=r.toString(t).toUpperCase();if(void 0!==e&&0<e){if(e>i.maxPlaces)return n[$.CommonErrors.Num];for(;o.length<e;)o="0"+o}return o},o.prototype.ComputeBIN2DEC=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(t=this.resolveBaseArg(e[0],2))?t:10<(r=this.resolveTextArg(e[0]).trim()).length?this.parent.getErrorStrings()[$.CommonErrors.Num]:(t=t,(t=10===r.length&&"1"===r.charAt(0)?parseInt(r,2)-1024:t).toString())},o.prototype.ComputeBIN2HEX=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.binTo(r,16)},o.prototype.ComputeBIN2OCT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.binTo(r,8)},o.prototype.binTo=function(r,t){var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n,i=this.ComputeBIN2DEC(r[0]);if("string"==typeof i&&-1<e.indexOf(i))return i;if(2===r.length){e=this.resolveNumberArg(r[1]);if("string"==typeof e)return e;n=Math.floor(e)}return this.formatToBase(parseInt(i.toString(),10),t,n)},o.prototype.ComputeDEC2BIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.decTo(r,2)},o.prototype.ComputeDEC2HEX=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.decTo(r,16)},o.prototype.ComputeDEC2OCT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.decTo(r,8)},o.prototype.decTo=function(r,t){if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e,n=this.resolveNumberArg(r[0]);if("string"==typeof n)return n;if(2===r.length){r=this.resolveNumberArg(r[1]);if("string"==typeof r)return r;e=Math.floor(r)}return this.formatToBase(Math.trunc(n),t,e)},o.prototype.ComputeHEX2DEC=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveTextArg(e[0]).trim().toUpperCase(),"string"==typeof(t=this.parseBaseNumber(r,16))?t:10<r.length?this.parent.getErrorStrings()[$.CommonErrors.Num]:(t=t,(t=10===r.length&&8<=parseInt(r.charAt(0),16)?parseInt(r,16)-256:t).toString()))},o.prototype.ComputeHEX2BIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.hexOctTo(r,2,this.ComputeHEX2DEC.bind(this))},o.prototype.ComputeHEX2OCT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.hexOctTo(r,8,this.ComputeHEX2DEC.bind(this))},o.prototype.ComputeOCT2DEC=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveTextArg(e[0]).trim(),"string"==typeof(t=this.parseBaseNumber(r,8))?t:10<r.length?this.parent.getErrorStrings()[$.CommonErrors.Num]:(t=t,(t=10===r.length&&"4"<=r.charAt(0)?parseInt(r,8)-(1<<30):t).toString()))},o.prototype.ComputeOCT2BIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.hexOctTo(r,2,this.ComputeOCT2DEC.bind(this))},o.prototype.ComputeOCT2HEX=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.hexOctTo(r,16,this.ComputeOCT2DEC.bind(this))},o.prototype.hexOctTo=function(r,t,e){var n=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var i,e=e(r[0]);if("string"==typeof e&&-1<n.indexOf(e))return e;if(2===r.length){n=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;i=Math.floor(n)}return this.formatToBase(parseInt(e.toString(),10),t,i)};var Jr,rt,tt=o;function o(r){r=rt.call(this,r)||this;return r.formulas=[{formulaName:"BIN2DEC",category:"Engineering",description:"Converts a binary number to decimal."},{formulaName:"BIN2HEX",category:"Engineering",description:"Converts a binary number to hexadecimal."},{formulaName:"BIN2OCT",category:"Engineering",description:"Converts a binary number to octal."},{formulaName:"DEC2BIN",category:"Engineering",description:"Converts a decimal number to binary."},{formulaName:"DEC2HEX",category:"Engineering",description:"Converts a decimal number to hexadecimal."},{formulaName:"DEC2OCT",category:"Engineering",description:"Converts a decimal number to octal."},{formulaName:"HEX2BIN",category:"Engineering",description:"Converts a hexadecimal number to binary."},{formulaName:"HEX2DEC",category:"Engineering",description:"Converts a hexadecimal number to decimal."},{formulaName:"HEX2OCT",category:"Engineering",description:"Converts a hexadecimal number to octal."},{formulaName:"OCT2BIN",category:"Engineering",description:"Converts an octal number to binary."},{formulaName:"OCT2DEC",category:"Engineering",description:"Converts an octal number to decimal."},{formulaName:"OCT2HEX",category:"Engineering",description:"Converts an octal number to hexadecimal."}],r}et=function(r,t){return(et=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}et(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(ot,nt=t),ot.prototype.ComputeDELTA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]);if("string"==typeof e)return e;var n=0;if(2===r.length){var i=this.resolveNumberArg(r[1]);if("string"==typeof i)return i;n=i}return(e===n?1:0).toString()},ot.prototype.ComputeGESTEP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]);if("string"==typeof e)return e;var n=0;if(2===r.length){var i=this.resolveNumberArg(r[1]);if("string"==typeof i)return i;n=i}return(n<=e?1:0).toString()},ot.prototype.ComputeERF=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||e.length<1||2<e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:1===e.length?"string"==typeof(r=this.resolveNumberArg(e[0]))?r:ur(r).toString():(r=this.resolveNumberArg(e[0]),t=this.resolveNumberArg(e[1]),"string"==typeof r?r:"string"==typeof t?t:(ur(t)-ur(r)).toString())},ot.prototype.ComputeERFC=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveNumberArg(t[0]))?r:hr(r).toString()};var et,nt,it=ot;function ot(r){r=nt.call(this,r)||this;return r.formulas=[{formulaName:"DELTA",category:"Engineering",description:"Tests whether two values are equal."},{formulaName:"GESTEP",category:"Engineering",description:"Tests whether a number is greater than a threshold."},{formulaName:"ERF",category:"Engineering",description:"Returns the error function."},{formulaName:"ERFC",category:"Engineering",description:"Returns the complementary error function."}],r}st=function(r,t){return(st=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}st(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(ut,at=t),ut.prototype.ComputeCONVERT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||3!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]);if("string"==typeof n)return n;var i=this.resolveTextArg(r[1]).toLowerCase(),o=this.resolveTextArg(r[2]).toLowerCase();if(-1<e.indexOf(i))return i;if(-1<e.indexOf(o))return o;if(i===o)return n.toString();if("c"===i&&"f"===o)return(9*n/5+32).toString();if("f"===i&&"c"===o)return(5*(n-32)/9).toString();for(var s=0,a=ut.UNITS;s<a.length;s++){var l=a[s];if(l.from===i&&l.to===o&&!isNaN(l.factor))return(n*l.factor).toString()}var u=ut.UNITS.find(function(r){return r.from===i&&!isNaN(r.factor)}),h=u?u.to:void 0,p=ut.UNITS.find(function(r){return r.to===o&&r.from===h&&!isNaN(r.factor)});return u&&p?(n*u.factor*p.factor).toString():e[$.CommonErrors.NA]},ut.UNITS=[{from:"g",to:"kg",factor:.001},{from:"kg",to:"g",factor:1e3},{from:"lbm",to:"kg",factor:.45359237},{from:"kg",to:"lbm",factor:2.2046226218},{from:"m",to:"ft",factor:3.280839895},{from:"ft",to:"m",factor:.3048},{from:"in",to:"m",factor:.0254},{from:"m",to:"in",factor:39.37007874},{from:"mi",to:"m",factor:1609.344},{from:"m",to:"mi",factor:1/1609.344},{from:"yr",to:"day",factor:365.25},{from:"day",to:"yr",factor:1/365.25},{from:"hr",to:"sec",factor:3600},{from:"sec",to:"hr",factor:1/3600},{from:"C",to:"F",factor:NaN},{from:"F",to:"C",factor:NaN},{from:"l",to:"m3",factor:.001},{from:"m3",to:"l",factor:1e3},{from:"N",to:"lbf",factor:.224808943},{from:"lbf",to:"N",factor:4.4482216153}];var st,at,lt=ut;function ut(r){r=at.call(this,r)||this;return r.formulas=[{formulaName:"CONVERT",category:"Engineering",description:"Converts a number from one measurement system to another."}],r}ht=function(r,t){return(ht=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}ht(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(ft,pt=t),ft.prototype.besselArgs=function(r){var t,e=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(t=this.resolveNumberArg(r[0]),r=this.resolveNumberArg(r[1]),"string"==typeof t?t:"string"==typeof r?r:r<0?e[$.CommonErrors.Num]:{x:t,n:Math.floor(r)})},ft.prototype.ComputeBESSELI=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.besselArgs(r);return"string"==typeof e?e:(e=Cr(e.n,e.x),isFinite(e)?e.toString():this.parent.getErrorStrings()[$.CommonErrors.Num])},ft.prototype.ComputeBESSELJ=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.besselArgs(r);return"string"==typeof e?e:br(e.n,e.x).toString()},ft.prototype.ComputeBESSELK=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings(),n=this.besselArgs(r);return"string"==typeof n?n:!(n.x<=0)&&(n=Ar(n.n,n.x),isFinite(n))?n.toString():e[$.CommonErrors.Num]},ft.prototype.ComputeBESSELY=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings(),n=this.besselArgs(r);return"string"==typeof n?n:!(n.x<=0)&&(n=Fr(n.n,n.x),isFinite(n))?n.toString():e[$.CommonErrors.Num]};var ht,pt,gt=ft;function ft(r){r=pt.call(this,r)||this;return r.formulas=[{formulaName:"BESSELI",category:"Engineering",description:"Returns the modified Bessel function In(x)."},{formulaName:"BESSELJ",category:"Engineering",description:"Returns the Bessel function Jn(x)."},{formulaName:"BESSELK",category:"Engineering",description:"Returns the modified Bessel function Kn(x)."},{formulaName:"BESSELY",category:"Engineering",description:"Returns the Bessel function Yn(x)."}],r}mt=function(r,t){return(mt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}mt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(a,ct=t),a.prototype.resolveOptional=function(r,t,e){return r.length<=t||""===r[t]?e:this.resolveNumberArg(r[t])},a.prototype.ComputeFV=function(){for(var r,t,e,n,i,o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return z.isNullOrUndefined(o)||o.length<3||5<o.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(o[0]),t=this.resolveNumberArg(o[1]),e=this.resolveNumberArg(o[2]),"string"==typeof r?r:"string"==typeof t?t:"string"==typeof e?e:(i=this.resolveOptional(o,3,0),n=this.resolveOptional(o,4,0),"string"==typeof i?i:"string"==typeof n?n:(0===r?-i-e*t:-i*(i=Math.pow(1+r,t))-e*(1+r*(n?1:0))*(i-1)/r).toString()))},a.prototype.ComputePV=function(){for(var r,t,e,n,i,o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return z.isNullOrUndefined(o)||o.length<3||5<o.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(o[0]),t=this.resolveNumberArg(o[1]),e=this.resolveNumberArg(o[2]),"string"==typeof r?r:"string"==typeof t?t:"string"==typeof e?e:(i=this.resolveOptional(o,3,0),n=this.resolveOptional(o,4,0),"string"==typeof i?i:"string"==typeof n?n:(0===r?-i-e*t:(-i-e*(1+r*(n?1:0))*((i=Math.pow(1+r,t))-1)/r)/i).toString()))},a.prototype.ComputePMT=function(){for(var r,t,e,n,i,o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return z.isNullOrUndefined(o)||o.length<3||5<o.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(o[0]),t=this.resolveNumberArg(o[1]),e=this.resolveNumberArg(o[2]),"string"==typeof r?r:"string"==typeof t?t:"string"==typeof e?e:(i=this.resolveOptional(o,3,0),n=this.resolveOptional(o,4,0),"string"==typeof i?i:"string"==typeof n?n:0===r?(-e-i)/t:(r*(i+e*(i=Math.pow(1+r,t)))/((1+r*(n?1:0))*(1-i))).toString()))},a.prototype.ComputeNPER=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s,a=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<3||5<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),s=this.resolveNumberArg(r[2]),"string"==typeof e?e:"string"==typeof n?n:"string"==typeof s?s:(o=this.resolveOptional(r,3,0),i=this.resolveOptional(r,4,0),"string"==typeof o?o:"string"==typeof i?i:0===e?0===n?a[$.CommonErrors.Num]:(-(s+o)/n).toString():(o=n*(1+e*(i=i?1:0))/e-o,0===(s=s+n*(1+e*i)/e)||o/s<=0?a[$.CommonErrors.Num]:(Math.log(o/s)/Math.log(1+e)).toString())))},a.prototype.ComputeIPMT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<4||6<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=this.resolveOptional(r,4,0),a=this.resolveOptional(r,5,0);if("string"==typeof s)return s;if("string"==typeof a)return a;i=this.ComputePMT(e.toString(),i.toString(),o.toString(),s.toString(),a.toString());if("string"==typeof i&&-1<this.parent.getErrorStrings().indexOf(i))return i;for(var l=parseFloat(i.toString()),u=o,h=1;h<n;h++)u=u*(1+e)+l;return(u*e).toString()},a.prototype.ComputePPMT=function(){for(var r,t,e,n,i,o,s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];return z.isNullOrUndefined(s)||s.length<4||6<s.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.ComputeIPMT.apply(this,s))&&-1<this.parent.getErrorStrings().indexOf(r)?r:(o=this.resolveNumberArg(s[0]),t=this.resolveNumberArg(s[2]),e=this.resolveNumberArg(s[3]),n=this.resolveOptional(s,4,0),i=this.resolveOptional(s,5,0),o=this.ComputePMT(o.toString(),t.toString(),e.toString(),("number"==typeof n?n:0).toString(),("number"==typeof i?i:0).toString()),(parseFloat(o.toString())-parseFloat(r.toString())).toString())},a.prototype.ComputeNPV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]);if("string"==typeof e)return e;for(var n=0,i=1;i<r.length;i++){var o=this.resolveNumberArg(r[i]);if("string"==typeof o)return o;n+=o/Math.pow(1+e,i)}return n.toString()},a.prototype.ComputeRATE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||6<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=this.resolveOptional(r,3,0),a=this.resolveOptional(r,4,0),l=this.resolveOptional(r,5,.1);if("string"==typeof s)return s;if("string"==typeof a)return a;if("string"==typeof l)return l;for(var u=l,h=0;h<100;h++){var p=a?1:0,g=Math.pow(1+u,n),f=o*g+i*(1+u*p)*(g-1)/u+s,p=n*o*Math.pow(1+u,n-1)+i*(1+u*p)*(n*Math.pow(1+u,n-1)*u-(g-1))/(u*u)+i*p*(g-1)/u;if(Math.abs(p)<1e-12)break;g=u-f/p;if(Math.abs(g-u)<1e-10)return g.toString();u=g}return e[$.CommonErrors.Num]};var mt,ct,dt=a;function a(r){r=ct.call(this,r)||this;return r.formulas=[{formulaName:"FV",category:"Financial",description:"Returns the future value of an investment."},{formulaName:"PV",category:"Financial",description:"Returns the present value of an investment."},{formulaName:"PMT",category:"Financial",description:"Returns the periodic payment for an annuity."},{formulaName:"NPER",category:"Financial",description:"Returns the number of periods for an investment."},{formulaName:"IPMT",category:"Financial",description:"Returns the interest payment for an investment for a given period."},{formulaName:"PPMT",category:"Financial",description:"Returns the payment on the principal for an investment for a given period."},{formulaName:"NPV",category:"Financial",description:"Returns the net present value of an investment based on periodic cash flows."},{formulaName:"RATE",category:"Financial",description:"Returns the interest rate per period of an annuity."}],r}Nt=function(r,t){return(Nt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Nt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(St,vt=t),St.prototype.ComputeSLN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),"string"==typeof e?e:"string"==typeof n?n:"string"==typeof i?i:0===i?o[$.CommonErrors.DivZero]:((e-n)/i).toString())},St.prototype.ComputeSYD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||4!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]),"string"==typeof e?e:"string"==typeof n?n:"string"==typeof i?i:"string"==typeof o?o:i<=0||o<=0||i<o?s[$.CommonErrors.Num]:((e-n)*(i-o+1)/(i*(i+1)/2)).toString())},St.prototype.ComputeDB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<4||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]),s=this.resolveNumberArg(r[3]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;var a=12;if(5===r.length){var l=this.resolveNumberArg(r[4]);if("string"==typeof l)return l;a=Math.floor(l)}if(o<=0||s<=0)return e[$.CommonErrors.Num];for(var u=1-Math.pow(i/n,1/o),h=0,p=1;p<=Math.floor(s);p++)h+=(n-h)*u*(1===p?a/12:1);l=s-Math.floor(s);if(0<l&&(h+=(n-h)*u*l),1===Math.floor(s))return h.toString();for(var g=0,p=1;p<Math.floor(s);p++)g+=(n-g)*u*(1===p?a/12:1);return(h-g).toString()},St.prototype.ComputeDDB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<4||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]),s=this.resolveNumberArg(r[3]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;var a=2;if(5===r.length){var l=this.resolveNumberArg(r[4]);if("string"==typeof l)return l;a=l}if(o<=0||s<=0)return e[$.CommonErrors.Num];for(var u=a/o,h=n,p=0,g=1;g<=Math.floor(s);g++)h-=p=Math.min(h*u,h-i);l=s-Math.floor(s);return(p=0<l?Math.min(h*u*l,(h-i)*l):p).toString()};var Nt,vt,Et=St;function St(r){r=vt.call(this,r)||this;return r.formulas=[{formulaName:"SLN",category:"Financial",description:"Returns the straight-line depreciation of an asset for one period."},{formulaName:"SYD",category:"Financial",description:"Returns the sum-of-years digits depreciation for a specified period."},{formulaName:"DB",category:"Financial",description:"Returns the depreciation of an asset for a period using fixed-declining balance."},{formulaName:"DDB",category:"Financial",description:"Returns the depreciation of an asset for a period using double-declining balance."}],r}yt=function(r,t){return(yt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}yt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(At,Ct=t),At.prototype.ComputeEFFECT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:n<1?i[$.CommonErrors.Num]:(Math.pow(1+e/n,n)-1).toString())},At.prototype.ComputeNOMINAL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:n<1?i[$.CommonErrors.Num]:(n*(Math.pow(1+e,1/n)-1)).toString())},At.prototype.ComputeFVSCHEDULE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]);if("string"==typeof e)return e;for(var n=e,i=1;i<r.length;i++){var o=this.resolveNumberArg(r[i]);if("string"==typeof o)return o;n*=1+o}return n.toString()};var yt,Ct,bt=At;function At(r){r=Ct.call(this,r)||this;return r.formulas=[{formulaName:"EFFECT",category:"Financial",description:"Returns the effective annual interest rate."},{formulaName:"NOMINAL",category:"Financial",description:"Returns the nominal annual interest rate."},{formulaName:"FVSCHEDULE",category:"Financial",description:"Returns the future value of an initial principal after applying compound interest rates."}],r}Ot=function(r,t){return(Ot=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Ot(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Vt,Ft=t),Vt.prototype.collectCashflows=function(r){for(var t=this.parent.getErrorStrings(),e=[],n=0;n<r.length;n++){var i=r[n];if(""!==i)if(this.parent.isCellReference(i)&&-1<i.indexOf(":"))for(var o=this.parent.getCellCollection(i),s=Array.isArray(o)?o:[o],a=0;a<s.length;a++){var l=this.parent.getValueFromArg(s[a]);if(-1<t.indexOf(l))return l;""!==l&&this.parent.isNumber(l)&&e.push(this.parent.parseFloat(l))}else{o=this.resolveNumberArg(i);if("string"==typeof o)return o;e.push(o)}}return e},Vt.prototype.npvAtRate=function(r,t){for(var e=0,n=0;n<r.length;n++)e+=r[n]/Math.pow(1+t,n);return e},Vt.prototype.npvDerivative=function(r,t){for(var e=0,n=1;n<r.length;n++)e-=n*r[n]/Math.pow(1+t,n+1);return e},Vt.prototype.ComputeIRR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n,i=.1,o=r,s=(2===r.length&&this.parent.isCellReference(r[0])&&"number"==typeof(n=this.resolveNumberArg(r[1]))&&(i=n,o=[r[0]]),this.collectCashflows(o));if("string"==typeof s)return s;if(!(s.length<2)){for(var a=!1,l=!1,u=0;u<s.length;u++)0<s[u]&&(a=!0),s[u]<0&&(l=!0);if(a&&l)for(var h=i,p=0;p<100;p++){var g=this.npvAtRate(s,h),f=this.npvDerivative(s,h);if(Math.abs(f)<1e-12)break;g=h-g/f;if(Math.abs(g-h)<1e-10)return g.toString();h=g}}return e[$.CommonErrors.Num]},Vt.prototype.ComputeMIRR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||3!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;var o=this.collectCashflows([r[0]]);if("string"==typeof o)return o;if(o.length<2)return e[$.CommonErrors.Num];for(var s=o.length-1,a=0,l=0,u=0;u<o.length;u++){var h=o[u];0<=h?l+=h*Math.pow(1+i,s-u):a+=h/Math.pow(1+n,u)}return 0===a||0===l?e[$.CommonErrors.DivZero]:(Math.pow(-l/a,1/s)-1).toString()};var Ot,Ft,xt=Vt;function Vt(r){r=Ft.call(this,r)||this;return r.formulas=[{formulaName:"IRR",category:"Financial",description:"Returns the internal rate of return for a series of cash flows."},{formulaName:"MIRR",category:"Financial",description:"Returns the modified internal rate of return for cash flows."}],r}Rt=function(r,t){return(Rt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Rt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(u,Tt=t),u.prototype.ComputeDOLLARDE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:(n=Math.floor(n))<=0?i[$.CommonErrors.Num]:((i=Math.trunc(e))+(e-i)*Math.pow(10,Math.ceil(Math.log10(n)))/n).toString())},u.prototype.ComputeDOLLARFR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:(n=Math.floor(n))<=0?i[$.CommonErrors.Num]:((i=Math.trunc(e))+(e-i)*n/Math.pow(10,Math.ceil(Math.log10(n)))).toString())},u.prototype.ComputeDISC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<3||5<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(i=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),e=this.resolveNumberArg(r[2]),"string"==typeof i?i:"string"==typeof n?n:"string"==typeof e?e:(n=Math.max(n-i,1),i=5<=r.length?this.resolveNumberArg(r[4]):0,e<=0?o[$.CommonErrors.Num]:((1-e/100)*(3===i?365:360)/n).toString()))},u.prototype.ComputeDURATION=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||e.length<5||6<e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(e[3]),t=this.resolveNumberArg(e[4]),"string"==typeof r?r:"string"==typeof t?t:(1/(6<=e.length?this.resolveNumberArg(e[5]):2)).toString())},u.prototype.ComputeINTRATE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<4||5<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(o=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),e=this.resolveNumberArg(r[2]),n=this.resolveNumberArg(r[3]),"string"==typeof o?o:"string"==typeof i?i:"string"==typeof e?e:"string"==typeof n?n:(i=Math.max(i-o,1),o=5<=r.length?this.resolveNumberArg(r[4]):0,e<=0?s[$.CommonErrors.Num]:((n-e)/e*(3===o?365:360)/i).toString()))},u.prototype.ComputeRECEIVED=function(){for(var r,t,e,n,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return z.isNullOrUndefined(i)||i.length<4||5<i.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(i[0]),t=this.resolveNumberArg(i[1]),e=this.resolveNumberArg(i[2]),n=this.resolveNumberArg(i[3]),"string"==typeof r?r:"string"==typeof t?t:"string"==typeof e?e:"string"==typeof n?n:(e*(1+n*Math.max(t-r,1)/(3===(5<=i.length?this.resolveNumberArg(i[4]):0)?365:360))).toString())},u.prototype.ComputeCUMIPMT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.cumIpmtPrinc(r,!0)},u.prototype.ComputeCUMPRINC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.cumIpmtPrinc(r,!1)},u.prototype.cumIpmtPrinc=function(r,t){if(z.isNullOrUndefined(r)||6!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]),s=this.resolveNumberArg(r[4]),r=this.resolveNumberArg(r[5]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;if("string"==typeof r)return r;for(var a=parseFloat(this.computePmt(e,n,i,r)),l=i,u=0,h=1;h<=s;h++){var p=l*e;o<=h&&(u+=t?p:a-p),l+=a}return u.toString()},u.prototype.computePmt=function(r,t,e,n){return(0===r?-e/t:r*e*(e=Math.pow(1+r,t))/((1+r*(n?1:0))*(1-e))).toString()},u.prototype.ComputeVDB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<5||7<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]),s=this.resolveNumberArg(r[4]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;var a=2;if(6<=r.length&&""!==r[5]){var l=this.resolveNumberArg(r[5]);if("string"==typeof l)return l;a=l}for(var u=a/i,h=e,p=0,g=1;g<=Math.floor(s);g++)h-=p=Math.min(h*u,h-n);for(var f=0,h=e,g=1;g<=s;g++)p=Math.min(h*u,h-n),o<g&&(f+=p),h-=p;return f.toString()},u.prototype.ComputeXIRR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=[],i=[],o=.1,s=r[r.length-1],s=(3<=r.length&&!this.parent.isCellReference(s)&&"number"==typeof(s=this.resolveNumberArg(s))&&(o=s),r[0]),a=r[1],s=this.parent.getCellCollection(s),a=this.parent.getCellCollection(a),l=Array.isArray(s)?s:[s],u=Array.isArray(a)?a:[a];if(!(l.length!==u.length||l.length<2)){for(var h=0;h<l.length;h++){var p=this.parent.getValueFromArg(l[h]),g=this.parent.getValueFromArg(u[h]);if(-1<e.indexOf(p))return p;if(-1<e.indexOf(g))return g;n.push(this.parent.parseFloat(p)),i.push(this.parent.parseFloat(g))}for(var f=i[0],m=function(r){for(var t=0,e=0;e<n.length;e++)t+=n[e]/Math.pow(1+r,(i[e]-f)/365);return t},c=o,d=0;d<100;d++){var N=m(c),v=(m(c+1e-7)-N)/1e-7;if(Math.abs(v)<1e-12)break;N=c-N/v;if(Math.abs(N-c)<1e-10)return N.toString();c=N}}return e[$.CommonErrors.Num]};var Rt,Tt,It=u;function u(r){r=Tt.call(this,r)||this;return r.formulas=[{formulaName:"DOLLARDE",category:"Financial",description:"Converts a dollar price expressed as a fraction into a decimal number."},{formulaName:"DOLLARFR",category:"Financial",description:"Converts a dollar price expressed as a decimal number into a fraction."},{formulaName:"DISC",category:"Financial",description:"Returns the discount rate for a security."},{formulaName:"DURATION",category:"Financial",description:"Returns the annual duration of a security with periodic interest payments."},{formulaName:"INTRATE",category:"Financial",description:"Returns the interest rate for a fully invested security."},{formulaName:"RECEIVED",category:"Financial",description:"Returns the amount received at maturity for a fully invested security."},{formulaName:"CUMIPMT",category:"Financial",description:"Returns the cumulative interest paid between two periods."},{formulaName:"CUMPRINC",category:"Financial",description:"Returns the cumulative principal paid on a loan between two periods."},{formulaName:"VDB",category:"Financial",description:"Returns the depreciation of an asset for a period using the declining balance method."},{formulaName:"XIRR",category:"Financial",description:"Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic."}],r}Mt=function(r,t){return(Mt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Mt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(h,Dt=t),h.prototype.ComputeAVERAGE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(e=!0,r.pop()),z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];for(var n=r,i=0;i<n.length;i++)if(-1<n[i].indexOf(":")&&-1<n[i].indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value];return this.parent.calculateAvg(n,e)},h.prototype.ComputeAVERAGEIF=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;return e[0].indexOf(":")<0&&!this.parent.isCellReference(e[0])?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.ImproperFormula]:0===(e=this.parent.computeSumIfAndAvgIf(r,!0))[1]||"NaN"===e[0].toString()?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Div]:"string"==typeof e&&(this.parent.formulaErrorStrings.indexOf(e)||this.parent.getErrorStrings().indexOf(e))?e:this.parent.parseFloat(e[0])/this.parent.parseFloat(e[1])},h.prototype.ComputeAVERAGEA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var e,n,i,o=r,s=0,a=0,l=0;l<o.length;l++)if(this.parent.isCellReference(o[l]))if(-1<o[l].indexOf(":"))for(var u=this.parent.getCellCollection(o[l].split(this.parent.tic).join("")),h=0;h<u.length;h++){if(e=this.parent.getValueFromArg(u[h]),e=this.processLogicalCellValue(e),-1<this.parent.getErrorStrings().indexOf(e))return e;z.isNullOrUndefined(e)||""===e||(i=this.parent.parseFloat(e),s+=e=isNaN(i)?0:i,a+=1)}else{if(e=this.parent.getValueFromArg(o[l]),e=this.processLogicalCellValue(e),-1<this.parent.getErrorStrings().indexOf(e))return e;z.isNullOrUndefined(e)||""===e||(i=this.parent.parseFloat(e),s+=e=isNaN(i)?0:i,a+=1)}else{if(-1<o[l].indexOf(this.parent.tic)&&(isNaN(this.parent.parseFloat(o[l].split(this.parent.tic).join("")))||""===o[l].split(this.parent.tic).join("").trim()))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(o[l]=this.processLogicalCellValue(o[l]),n=this.parent.getValueFromArg(o[l].split(this.parent.tic).join("")),-1<this.parent.getErrorStrings().indexOf(n))return n;s+=this.parent.parseFloat(n),a+=1}return 0===a?this.parent.getErrorStrings()[$.CommonErrors.DivZero]:s/a},h.prototype.processLogicalCellValue=function(r){return r.toUpperCase()===this.parent.trueValue?r="1":r.toUpperCase()===this.parent.falseValue&&(r="0"),r},h.prototype.ComputeAVERAGEIFS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.calculateIFS(r,this.parent.trueValue)},h.prototype.ComputeCOUNT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(e=!0,r.pop()),z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var n,i,o,s=r,a=0,l=0;l<s.length;l++)if(this.parent.isCellReference(n=s[l]))if(-1<n.indexOf(":"))for(var u=this.parent.getCellCollection(n.split(this.parent.tic).join("")),h=0;h<u.length;h++)i=e?this.parent.getValueFromArg(u[h],null,null,!0):this.parent.getValueFromArg(u[h]),e&&i.includes("SUBTOTAL(")||isNaN(this.parent.parseFloat(i))||0<n.length&&""!==i.trim()&&a++;else i=e?this.parent.getValueFromArg(n,null,null,!0):this.parent.getValueFromArg(n),e&&i.includes("SUBTOTAL(")||isNaN(this.parent.parseFloat(i))||0<n.length&&""!==i.trim()&&a++;else o=this.parent.getValueFromArg(n).split(this.parent.tic).join(""),0===n.length&&""===o.trim()?a++:isNaN(this.parent.parseFloat(o))&&n!==this.parent.trueValue&&n!==this.parent.falseValue||0<n.length&&""!==n.trim()&&""!==o.trim()&&a++;return a},h.prototype.ComputeCOUNTA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(e=!0,r.pop()),z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var n,i,o=r,s=0,a=0;a<o.length;a++)if(this.parent.isCellReference(o[a]))if(-1<o[a].indexOf(":"))for(var l=this.parent.getCellCollection(o[a].split(this.parent.tic).join("")),u=0;u<l.length;u++)n=e?this.parent.getValueFromArg(l[u],null,null,!0):this.parent.getValueFromArg(l[u]),e&&n.includes("SUBTOTAL(")||0<n.length&&s++;else n=e?this.parent.getValueFromArg(o[a],null,null,!0):this.parent.getValueFromArg(o[a]),e&&n.includes("SUBTOTAL(")||0<n.length&&s++;else(0<(i=this.parent.getValueFromArg(o[a]).split(this.parent.tic).join("")).length||0===i.length&&""===i.trim())&&s++;return s},h.prototype.ComputeCOUNTIF=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;if(z.isNullOrUndefined(r)||""===r[0]||2!==e.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(e[0].indexOf(":")<0&&!this.parent.isCellReference(e[0]))return this.parent.getErrorStrings()[$.CommonErrors.Name];var n,i=0,o=[],s="equal";if(""===e[1])return 0;var a=e[1].startsWith(this.parent.tic)&&e[1].endsWith(this.parent.tic),l=this.parent.getANDComputedValue(e[1]),u=l.includes("*"),h="*"===l||"<>*"===l,p=u&&!h?l.replace(/\*/g,"").trim():l,g=!1,f=(!a&&this.parent.isCellReference(p)&&(p=this.parent.getValueFromArg(p),g=!0),(l=p=u&&!h&&(u=l.indexOf("*"),"*"===l[0]&&(p="*"+p),"*"===l[l.length-1]&&(p+="*"),0<u)&&u<l.length-1?l.substring(0,u)+"*"+l.substring(u+1):p).startsWith("<=")?(s="lessEq",l=l.substring(2)):l.startsWith(">=")?(s="greaterEq",l=l.substring(2)):l.startsWith("<>")?(s="notEq",l=l.substring(2)):l.startsWith("<")?(s="less",l=l.substring(1)):l.startsWith(">")?(s="greater",l=l.substring(1)):l.startsWith("=")&&(s="equal",l=l.substring(1)),-1<l.indexOf("*")||-1<l.indexOf("?"));if((!a&&this.parent.isCellReference(l)&&!g||l.includes(this.parent.arithMarker)||l.includes(this.parent.getParseDecimalSeparator())&&!f)&&(l=this.parent.getValueFromArg(l)),this.parent.isCellReference(e[0]))for(var m=this.parent.getCellCollection(e[0].split(this.parent.tic).join("")),c=0;c<m.length;c++)n=this.parent.getValueFromArg(m[c]),f&&(n=this.parent.findWildCardValue(l.toLowerCase(),n.toLowerCase())),o.push(n),o.push(l),this.parent.processLogical(o,s)===this.parent.trueValue&&i++;return i},h.prototype.ComputeCOUNTIFS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.parent.computeCountIfsFormulas(r)},h.prototype.ComputeCOUNTBLANK=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=0;if(1!==r.length||z.isNullOrUndefined(r)||!this.parent.isCellReference(r[0]))return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===r[0])return this.parent.getErrorStrings()[$.CommonErrors.Value];for(var n=this.parent.getCellCollection(r[0]),i=0;i<n.length;i++)""===this.parent.getValueFromArg(n[i])&&e++;return e},h.prototype.ComputeMIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.parent.computeMinMax(r,"min")},h.prototype.ComputeMAX=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.parent.computeMinMax(r,"max")};var Mt,Dt,Ut=h;function h(r){r=Dt.call(this,r)||this;return r.formulas=[{formulaName:"AVERAGE",category:"Statistical",description:"The sum of the numbers divided by how many numbers are being averaged."},{formulaName:"AVERAGEIF",category:"Statistical",description:"Computes the average of the numbers in a range that meet the supplied criteria."},{formulaName:"AVERAGEA",category:"Statistical",description:"Calculates the average of values in the list of arguments.Arguments can be numbers, names, arrays or references."},{formulaName:"AVERAGEIFS",category:"Statistical",description:"Conditionally returns the average of the contents of cells for the set of ranges."},{formulaName:"COUNT",category:"Statistical",description:"Counts the numbers in the list of arguments, exclude text entries."},{formulaName:"COUNTA",category:"Statistical",description:"Counts the non-empty values in the list of arguments."},{formulaName:"COUNTIF",category:"Statistical",description:"Counts the number of cells in a range that meet a specified condition."},{formulaName:"COUNTIFS",category:"Statistical",description:"Counts the number of times each cells in all the ranges that meet the specific conditions."},{formulaName:"COUNTBLANK",category:"Statistical",description:"Returns the number of empty cells in a specified range of cells."},{formulaName:"MIN",category:"Statistical",description:"Returns the smaller number in set of arguments."},{formulaName:"MAX",category:"Statistical",description:"Returns the largest number in set of arguments."}],r}wt=function(r,t){return(wt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}wt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(p,jt=t),p.prototype.ComputeMEDIAN=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=[];if(z.isNullOrUndefined(t)||""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];for(var i=0;i<t.length;i++)if(this.parent.isCellReference(t[i]))if(-1<t[i].indexOf(":"))for(var o=this.parent.getCellCollection(t[i]),s=0;s<o.length;s++){var a=this.parent.getValueFromArg(o[s]);if(-1<this.parent.getErrorStrings().indexOf(a))return a;""!==a.trim()&&n.push(this.parent.parseFloat(a))}else{var l=this.parent.getValueFromArg(t[i]);if(-1<this.parent.getErrorStrings().indexOf(l))return l;""!==l.trim()&&n.push(this.parent.parseFloat(l))}else if(""===t[i]||t[i]===this.parent.falseValue&&!this.parent.isCellReference(t[i]))n.push(0);else if(t[i]!==this.parent.trueValue||this.parent.isCellReference(t[i])){if(-1<t[i].indexOf(this.parent.tic)&&isNaN(parseFloat(t[i].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[$.CommonErrors.Value];l=this.parent.getValueFromArg(t[i]).split(this.parent.tic).join("");if(-1<this.parent.getErrorStrings().indexOf(l))return l;n.push(this.parent.parseFloat(l))}else n.push(1);for(var u=(n=n.sort(function(r,t){return r-t})).length,h=0;h<u&&(!isNaN(n[h])||(n.splice(h,1),u=n.length,h--,0!==n.length));h++);if(n.length%2==0||isNaN(n[parseInt((n.length/2).toString(),10)])){if(isNaN(n[n.length/2])||isNaN(n[n.length/2-1]))return this.parent.getErrorStrings()[$.CommonErrors.Num];r=(n[n.length/2]+n[n.length/2-1])/2}else r=n[parseInt((n.length/2).toString(),10)];return r},p.prototype.ComputeSMALL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length||""===r[0])return""===r[0]&&""===r[1]?e[$.CommonErrors.Num]:this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=[],i=[];if(!z.isNullOrUndefined(r[0])){var o=void 0;if(this.parent.isCellReference(r[0]))for(var s=this.parent.getCellCollection(r[0]),a=0;a<s.length;a++){if(o=this.parent.getValueFromArg(s[a]),-1<e.indexOf(o))return o;n.push(o)}else{if(o=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join(""),-1<e.indexOf(o))return o;n.push(o)}for(a=0;a<n.length;a++)""===n[a]||isNaN(this.parent.parseFloat(n[a]))||i.push(this.parent.parseFloat(n[a]));if(0===i.length&&(z.isNullOrUndefined(n[0])||-1<r[0].indexOf(this.parent.tic)))return e[$.CommonErrors.Value]}if(i=i.sort(function(r,t){return r-t}),!z.isNullOrUndefined(r[1])){if(this.parent.isCellReference(r[1])){if(""===(l=this.parent.getValueFromArg(r[1])))return e[$.CommonErrors.Num];if(""===l.trim())return e[$.CommonErrors.Value];l.toUpperCase()===this.parent.trueValue?l="1":l.toUpperCase()===this.parent.falseValue&&(l="0")}else l=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("");if(-1<e.indexOf(l))return l;if(""===l.trim())return 0<r[1].length?e[$.CommonErrors.Value]:e[$.CommonErrors.Num];if(isNaN(this.parent.parseFloat(l)))if(r[1].toUpperCase()===this.parent.trueValue)l="1";else{if(r[1].toUpperCase()!==this.parent.falseValue)return e[$.CommonErrors.Value];l="0"}}var l=Number(l)<1?0:Math.floor(Number(l));return z.isNullOrUndefined(i[l-1])&&!isNaN(Number(l))?e[$.CommonErrors.Num]:i[l-1]},p.prototype.ComputeLARGE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length||""===r[0])return""===r[0]&&""===r[1]?e[$.CommonErrors.Num]:this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=[],i=[];if(!z.isNullOrUndefined(r[0])){var o=void 0;if(this.parent.isCellReference(r[0]))for(var s=this.parent.getCellCollection(r[0]),a=0;a<s.length;a++){if(o=this.parent.getValueFromArg(s[a]),-1<e.indexOf(o))return o;n.push(o)}else{if(o=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join(""),-1<e.indexOf(o))return o;n.push(o)}for(a=0;a<n.length;a++)""===n[a]||isNaN(this.parent.parseFloat(n[a]))||i.push(this.parent.parseFloat(n[a]));if(0===i.length&&(z.isNullOrUndefined(n[0])||-1<r[0].indexOf(this.parent.tic)))return e[$.CommonErrors.Value]}if(i=i.sort(function(r,t){return t-r}),!z.isNullOrUndefined(r[1])){if(this.parent.isCellReference(r[1])){if(""===(l=this.parent.getValueFromArg(r[1])))return e[$.CommonErrors.Num];if(""===l.trim())return e[$.CommonErrors.Value];l.toUpperCase()===this.parent.trueValue?l="1":l.toUpperCase()===this.parent.falseValue&&(l="0")}else l=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("");if(-1<e.indexOf(l))return l;if(""===l.trim())return 0<r[1].length?e[$.CommonErrors.Value]:e[$.CommonErrors.Num];if(isNaN(this.parent.parseFloat(l)))if(r[1].toUpperCase()===this.parent.trueValue)l="1";else{if(r[1].toUpperCase()!==this.parent.falseValue)return e[$.CommonErrors.Value];l="0"}}var l=Number(l)<1?0:Math.ceil(Number(l));return z.isNullOrUndefined(i[l-1])&&!isNaN(Number(l))?e[$.CommonErrors.Num]:i[l-1]},p.prototype.ComputeSLOPE=function(){for(var e=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0].trim())return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===r[0]||""===r[1])return n[$.CommonErrors.Value];function i(r){return r=-1===r.indexOf(e.parent.tic)?e.parent.getCellCollection(r.split(e.parent.tic).join("")):void 0}var o=i(r[0].trim()),s=i(r[1].trim());if(z.isNullOrUndefined(o)||z.isNullOrUndefined(s)||o.length<2&&s.length<2)return n[$.CommonErrors.DivZero];if(o.length!==s.length)return n[$.CommonErrors.NA];function a(r){r=e.getDataCollection(r);for(var t=0;t<r.length;t++)if(-1<n.indexOf(r[t]))return r[t].toString();return r}o=a(o);if(-1<n.indexOf(o.toString()))return o.toString();if(s=a(s),-1<n.indexOf(s.toString()))return s.toString();for(var l=0,u=0,h=0,p=0,g=0,f=0,m=s.length;f<m;++f)""!==s[f]&&"NaN"!==Number(s[f]).toString()&&""!==o[f]&&"NaN"!==Number(o[f]).toString()&&(l+=Number(s[f])*Number(o[f]),h+=Number(s[f]),p+=Number(o[f]),u+=Number(s[f])*Number(s[f]),g++);var c=((l-h*p/g)/(u-h*h/g)).toString();return"NaN"===c?n[$.CommonErrors.DivZero]:c},p.prototype.ComputeINTERCEPT=function(){for(var e=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n,i,o,s,a,l,u,h,p,g=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1===r.length&&""===r[0].trim()?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:""===r[0]||""===r[1]?g[$.CommonErrors.Value]:(i=(p=function(r){return r=-1===r.indexOf(e.parent.tic)?e.parent.getCellCollection(r.split(e.parent.tic).join("")):void 0})(r[0].trim()),n=p(r[1].trim()),z.isNullOrUndefined(i)||z.isNullOrUndefined(n)||i.length<2&&n.length<2?g[$.CommonErrors.DivZero]:i.length!==n.length?g[$.CommonErrors.NA]:(i=(p=function(r){r=e.getDataCollection(r);for(var t=0;t<r.length;t++)if(-1<g.indexOf(r[t]))return r[t];return r})(i),-1<g.indexOf(i.toString())?i.toString():(n=p(n),-1<g.indexOf(n.toString())?n.toString():((p=function(r){for(var t=0,e=n.length;t<e;++t)""!==i[t]&&"NaN"!==Number(i[t]).toString()&&""!==n[t]&&"NaN"!==Number(n[t]).toString()&&(r?(o+=Number(i[t]),s+=Number(n[t]),a++):(h=Number(n[t])-s,l+=h*(Number(i[t])-o),u+=h*h))})(!(u=l=a=s=o=0)),o/=a,s/=a,p(!1),"NaN"===(p=(o-l/u*s).toString())?g[$.CommonErrors.DivZero]:p))))},p.prototype.ComputeGEOMEAN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=r,s=1,a=0,l=0;if(0===r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(1!==o.length||""!==o[0]){for(var u,h=0;h<o.length;h++)if(-1<o[h].indexOf(":")){if(o[0]===this.parent.tic)return this.parent.getErrorStrings()[$.CommonErrors.Value];for(i=this.parent.getCellCollection(o[h].split(this.parent.tic).join("")),n=0;n<i.length;n++){if(u=(u=(l=this.parent.getValueFromArg(i[n])).split(this.parent.tic).join(""))===this.parent.trueValue||u===this.parent.falseValue,(e=this.parent.parseFloat(l))<=0)return this.parent.getErrorStrings()[$.CommonErrors.Num];u||-1<this.parent.getErrorStrings().indexOf(l)||isNaN(e)||(a++,s*=e)}}else{if(l=this.parent.getValueFromArg(o[h]),-1<this.parent.getErrorStrings().indexOf(l))return l;var p=l.split(this.parent.tic).join("");if(-1<l.indexOf('"')&&isNaN(this.parent.parseFloat(p)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(o[h]=o[h].startsWith("n")?o[h].slice(1):o[h],""===l&&""===o[h])return this.parent.getErrorStrings()[$.CommonErrors.Num];if(("TRUE"!==p&&"FALSE"!==p||!this.parent.isCellReference(o[h]))&&0<l.length){if(l="TRUE"===(l=-1<l.indexOf('"')?p:l).split(this.parent.tic).join("")?"1":"FALSE"===l.split(this.parent.tic).join("")?"0":l,!this.parent.isCellReference(o[h])&&isNaN(this.parent.parseFloat(l)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if((e=this.parent.parseFloat(l))<=0)return this.parent.getErrorStrings()[$.CommonErrors.Num];isNaN(e)||(a++,s*=e)}}0<a&&(s=Math.pow(s,1/a))}return s.toString()},p.prototype.ComputeRSQ=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=0,n=r;if(2!==n.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===n[0]||""===n[1])return this.parent.getErrorStrings()[$.CommonErrors.Value];if(n[0].includes('"')||n[1].includes('"'))return this.parent.getErrorStrings()[$.CommonErrors.NA];if(-1===n[0].indexOf(":")&&Y(n[0])&&-1===n[1].indexOf(":")&&Y(n[1]))return this.parent.getErrorStrings()[$.CommonErrors.DivZero];var i=this.parent.getCellCollection(n[0]),n=this.parent.getCellCollection(n[1]);if(i.length!==n.length)return this.parent.getErrorStrings()[$.CommonErrors.NA];for(var o=this.getDataCollection(n),s=0;s<o.length;s++)if(-1<this.parent.getErrorStrings().indexOf(o[s]))return o[s];for(var a,l,u=this.getDataCollection(i),h=0;h<u.length;h++)if(-1<this.parent.getErrorStrings().indexOf(u[h]))return u[h];for(var p=0;p<o.length;p++)a=Number(o[p]),l=Number(u[p]),Q(a)&&Q(l)&&e++;return e<=1?this.parent.getErrorStrings()[$.CommonErrors.DivZero]:2===e?1:(i=(n=this.getMeanArray(o,u))[0],n=n[1],i=this.getCorrelation(o,u,i,n),Math.pow(i,2))},p.prototype.getCorrelation=function(r,t,e,n){for(var i,o,s=0,a=0,l=0,u=0;u<r.length;u++)Q(r[u])&&Q(t[u])&&(s+=(o=Number(r[u])-e)*(i=Number(t[u])-n),a+=Math.pow(o,2),l+=Math.pow(i,2));return s/Math.sqrt(a*l)},p.prototype.getMeanArray=function(r,t){for(var e=0,n=0,i=0,o=0;o<r.length;o++)Q(r[o])&&Q(t[o])&&(n+=Number(r[o]),i+=Number(t[o]),e++);return[n/e,i/e]},p.prototype.getDataCollection=function(r){for(var t=[],e=0,n=r.length;e<n;e++)t.push(this.parent.getValueFromArg(r[e]));return t};var wt,jt,Lt=p;function p(r){r=jt.call(this,r)||this;return r.formulas=[{formulaName:"SMALL",category:"Statistical",description:"Returns the k-th smallest value in a given array."},{formulaName:"LARGE",category:"Statistical",description:"Returns the k-th largest value in a given array."},{formulaName:"MEDIAN",category:"Statistical",description:"Returns the median of the given set of numbers."},{formulaName:"SLOPE",category:"Statistical",description:"Returns the slope of the line from linear regression of the data points."},{formulaName:"INTERCEPT",category:"Statistical",description:"Calculates the point of the Y-intercept line via linear regression."},{formulaName:"RSQ",category:"Statistical",description:"Returns the square of the Pearson product moment correlation coefficient based on data points in known_ys and known_xs."},{formulaName:"GEOMEAN",category:"Statistical",description:"Returns the geometric mean of an array or range of positive data."}],r}kt=function(r,t){return(kt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}kt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(g,Pt=t),g.prototype.collectSample=function(r,t){for(var e=this.parent.getErrorStrings(),n=[],i=0;i<r.length;i++){var o=r[i];if(""!==o)if(this.parent.isCellReference(o)&&-1<o.indexOf(":"))for(var s=this.parent.getCellCollection(o),a=Array.isArray(s)?s:[s],l=0;l<a.length;l++){var u=this.parent.getValueFromArg(a[l]);if(-1<e.indexOf(u))return u;""!==u&&((h=u.toUpperCase())===this.parent.trueValue?n.push(1):h===this.parent.falseValue?n.push(0):this.parent.isNumber(u)?n.push(this.parent.parseFloat(u)):t&&n.push(0))}else{var h,u=this.parent.getValueFromArg(o);if(-1<e.indexOf(u))return u;if((h=u.toUpperCase())===this.parent.trueValue)n.push(1);else if(h===this.parent.falseValue)n.push(0);else if(""!==u)if(this.parent.isNumber(this.parent.removeTics(u)))n.push(this.parent.parseFloat(this.parent.removeTics(u)));else{if(!t)return e[$.CommonErrors.Value];n.push(0)}}}return n},g.prototype.variance=function(r,t){for(var e=r.reduce(function(r,t){return r+t},0)/r.length,n=0,i=0;i<r.length;i++){var o=r[i]-e;n+=o*o}return n/(t?r.length:r.length-1)},g.prototype.ComputeSTDEV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVar(r,!1,!1)},g.prototype.ComputeSTDEVP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVar(r,!0,!1)},g.prototype.ComputeVAR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVar(r,!1,!0)},g.prototype.ComputeVARP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVar(r,!0,!0)},g.prototype.stdevVar=function(r,t,e){var n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1===r.length&&""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:"string"==typeof(r=this.collectSample(r,!1))?r:r.length<(t?1:2)?n[$.CommonErrors.DivZero]:(n=this.variance(r,t),(e?n:Math.sqrt(n)).toString())},g.prototype.ComputeMODE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectSample(r,!1);if("string"==typeof n)return n;if(0===n.length)return e[$.CommonErrors.Value];for(var i=new Map,o=n[0],s=0,a=0;a<n.length;a++){var l=n[a],u=(i.get(l)||0)+1;i.set(l,u),s<u&&(s=u,o=l)}return s<2?e[$.CommonErrors.NA]:o.toString()},g.prototype.ComputeRANK=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]);if("string"==typeof n)return n;var i=this.collectSample([r[1]],!1);if("string"==typeof i)return i;var o=0;if(3===r.length&&""!==r[2]){var s=this.resolveNumberArg(r[2]);if("string"==typeof s)return s;o=s}s=i.slice().sort(function(r,t){return o?r-t:t-r}).indexOf(n);return s<0?e[$.CommonErrors.NA]:(s+1).toString()},g.prototype.ComputeMAXA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.minMaxA(r,!0)},g.prototype.ComputeMINA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.minMaxA(r,!1)},g.prototype.minMaxA=function(r,t){if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var e=this.collectSample(r,!0);if("string"==typeof e)return e;if(0===e.length)return"0";for(var n=e[0],i=1;i<e.length;i++)(t?e[i]>n:e[i]<n)&&(n=e[i]);return n.toString()};var kt,Pt,_t=g;function g(r){r=Pt.call(this,r)||this;return r.formulas=[{formulaName:"STDEV",category:"Statistical",description:"Estimates standard deviation based on a sample."},{formulaName:"STDEVP",category:"Statistical",description:"Calculates standard deviation based on the entire population."},{formulaName:"VAR",category:"Statistical",description:"Estimates variance based on a sample."},{formulaName:"VARP",category:"Statistical",description:"Calculates variance based on the entire population."},{formulaName:"MODE",category:"Statistical",description:"Returns the most common value in a data set."},{formulaName:"RANK",category:"Statistical",description:"Returns the rank of a number in a list of numbers."},{formulaName:"MAXA",category:"Statistical",description:"Returns the maximum value in a list of arguments, including text and logicals."},{formulaName:"MINA",category:"Statistical",description:"Returns the minimum value in a list of arguments, including text and logicals."}],r}Wt=function(r,t){return(Wt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Wt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Xt,qt=t),Xt.prototype.collectSample=function(r,t){void 0===t&&(t=!1);for(var e=this.parent.getErrorStrings(),n=[],i=0;i<r.length;i++){var o=r[i];if(""!==o)if(this.parent.isCellReference(o)&&-1<o.indexOf(":"))for(var s=this.parent.getCellCollection(o),a=Array.isArray(s)?s:[s],l=0;l<a.length;l++){var u=this.parent.getValueFromArg(a[l]);if(-1<e.indexOf(u))return u;""!==u&&((h=u.toUpperCase())===this.parent.trueValue?n.push(1):h===this.parent.falseValue?n.push(0):this.parent.isNumber(u)?n.push(this.parent.parseFloat(u)):t&&n.push(0))}else{var h,u=this.parent.getValueFromArg(o);if(-1<e.indexOf(u))return u;if((h=u.toUpperCase())===this.parent.trueValue)n.push(1);else if(h===this.parent.falseValue)n.push(0);else if(""!==u)if(this.parent.isNumber(this.parent.removeTics(u)))n.push(this.parent.parseFloat(this.parent.removeTics(u)));else{if(!t)return e[$.CommonErrors.Value];n.push(0)}}}return n},Xt.prototype.collectPair=function(r){var t=this.parent.getErrorStrings();if(2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.parent.getCellCollection(r[0]),r=this.parent.getCellCollection(r[1]),n=Array.isArray(e)?e:[e],i=Array.isArray(r)?r:[r];if(n.length!==i.length)return t[$.CommonErrors.NA];for(var o=[],s=[],a=0;a<n.length;a++){var l=this.parent.getValueFromArg(n[a]),u=this.parent.getValueFromArg(i[a]);if(-1<t.indexOf(l))return l;if(-1<t.indexOf(u))return u;""!==l&&""!==u&&this.parent.isNumber(l)&&this.parent.isNumber(u)&&(o.push(this.parent.parseFloat(l)),s.push(this.parent.parseFloat(u)))}return{x:o,y:s}},Xt.prototype.mean=function(r){return r.reduce(function(r,t){return r+t},0)/r.length};var Wt,qt,Bt=Xt;function Xt(){return null!==qt&&qt.apply(this,arguments)||this}Yt=function(r,t){return(Yt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Yt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Zt,Ht=Bt),Zt.prototype.ComputeAVEDEV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectSample(r);if("string"==typeof n)return n;if(0===n.length)return e[$.CommonErrors.DivZero];for(var i=this.mean(n),o=0,s=0;s<n.length;s++)o+=Math.abs(n[s]-i);return(o/n.length).toString()},Zt.prototype.ComputeDEVSQ=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectSample(r);if("string"==typeof n)return n;if(0===n.length)return e[$.CommonErrors.DivZero];for(var i=this.mean(n),o=0,s=0;s<n.length;s++){var a=n[s]-i;o+=a*a}return o.toString()},Zt.prototype.ComputeHARMEAN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectSample(r);if("string"==typeof n)return n;if(0===n.length)return e[$.CommonErrors.DivZero];for(var i=0,o=0;o<n.length;o++){if(n[o]<=0)return e[$.CommonErrors.Num];i+=1/n[o]}return(n.length/i).toString()},Zt.prototype.ComputeSKEW=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectSample(r);if("string"==typeof n)return n;var i=n.length;if(i<3)return e[$.CommonErrors.DivZero];for(var o=this.mean(n),s=0,a=0,l=0;l<i;l++){var u=n[l]-o;s+=u*u,a+=u*u*u}return a/=i,0===(s/=i)?e[$.CommonErrors.DivZero]:(a/Math.pow(s,1.5)*Math.sqrt(i*(i-1))/(i-2)).toString()},Zt.prototype.ComputeKURT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectSample(r);if("string"==typeof n)return n;var i=n.length;if(i<4)return e[$.CommonErrors.DivZero];for(var o=this.mean(n),s=0,a=0,l=0;l<i;l++){var u=n[l]-o;s+=u*u,a+=u*u*u*u}return a/=i,0===(s/=i)?e[$.CommonErrors.DivZero]:(i*(i+1)/((i-1)*(i-2)*(i-3))*(a/(s*s))-3*(i-1)*(i-1)/((i-2)*(i-3))).toString()},Zt.prototype.ComputeSTANDARDIZE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),"string"==typeof e?e:"string"==typeof n?n:"string"==typeof i?i:i<=0?o[$.CommonErrors.Num]:((e-n)/i).toString())};var Yt,Ht,Gt=Zt;function Zt(r){r=Ht.call(this,r)||this;return r.formulas=[{formulaName:"AVEDEV",category:"Statistical",description:"Returns the average of the absolute deviations of data points from their mean."},{formulaName:"DEVSQ",category:"Statistical",description:"Returns the sum of squares of deviations."},{formulaName:"HARMEAN",category:"Statistical",description:"Returns the harmonic mean."},{formulaName:"SKEW",category:"Statistical",description:"Returns the skewness of a distribution."},{formulaName:"KURT",category:"Statistical",description:"Returns the kurtosis of a data set."},{formulaName:"STANDARDIZE",category:"Statistical",description:"Returns a normalized value from a distribution."}],r}Kt=function(r,t){return(Kt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Kt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Qt,$t=Bt),Qt.prototype.regressionStats=function(r){var t=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];r=this.collectPair(r);if("string"==typeof r)return r;var e=r.x,n=r.y;if(e.length<2)return t[$.CommonErrors.DivZero];for(var i=this.mean(e),o=this.mean(n),s=0,a=0,l=0,u=0;u<e.length;u++){var h=e[u]-i,p=n[u]-o;s+=h*h,a+=p*p,l+=h*p}return{n:e.length,meanX:i,meanY:o,sxx:s,syy:a,sxy:l}},Qt.prototype.ComputeCORREL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings(),n=this.regressionStats(r);return"string"==typeof n?n:0===n.sxx||0===n.syy?e[$.CommonErrors.DivZero]:(n.sxy/Math.sqrt(n.sxx*n.syy)).toString()},Qt.prototype.ComputePEARSON=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.ComputeCORREL.apply(this,r)},Qt.prototype.ComputeCOVAR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings(),n=this.regressionStats(r);return"string"==typeof n?n:n.n<2?e[$.CommonErrors.DivZero]:(n.sxy/(n.n-1)).toString()},Qt.prototype.ComputeFORECAST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.resolveNumberArg(r[0]))?e:"string"==typeof(n=this.regressionStats([r[2],r[1]]))?n:0===n.sxx?i[$.CommonErrors.DivZero]:(i=n.sxy/n.sxx,(n.meanY-i*n.meanX+i*e).toString())},Qt.prototype.ComputeSTEYX=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings(),n=this.regressionStats([r[1],r[0]]);return"string"==typeof n?n:n.n<=2||0===n.sxx?e[$.CommonErrors.DivZero]:(e=n.syy-n.sxy*n.sxy/n.sxx,Math.sqrt(e/(n.n-2)).toString())};var Kt,$t,zt=Qt;function Qt(r){r=$t.call(this,r)||this;return r.formulas=[{formulaName:"CORREL",category:"Statistical",description:"Returns the correlation coefficient between two data sets."},{formulaName:"COVAR",category:"Statistical",description:"Returns covariance, the average of the products of paired deviations."},{formulaName:"PEARSON",category:"Statistical",description:"Returns the Pearson product moment correlation coefficient."},{formulaName:"FORECAST",category:"Statistical",description:"Returns a value along a linear trend."},{formulaName:"STEYX",category:"Statistical",description:"Returns the standard error of the predicted y-value for each x in the regression."}],r}Jt=function(r,t){return(Jt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Jt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(ee,re=Bt),ee.prototype.sortedSample=function(r){return z.isNullOrUndefined(r)||1===r.length&&""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:"string"==typeof(r=this.collectSample(r))?r:r.slice().sort(function(r,t){return r-t})},ee.prototype.percentile=function(r,t){var e,n=this.parent.getErrorStrings();return t<0||1<t||0===r.length?n[$.CommonErrors.Num]:(t=t*((n=r.length)-1),n-1<=(e=Math.floor(t))?r[n-1]:r[e]+(t-e)*(r[e+1]-r[e]))},ee.prototype.ComputePERCENTILE=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||2!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveNumberArg(e[1]))?r:"string"==typeof(t=this.sortedSample([e[0]]))?t:"string"==typeof(t=this.percentile(t,r))?t:t.toString()},ee.prototype.ComputePERCENTRANK=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]);if("string"==typeof n)return n;var i=this.sortedSample([r[1]]);if("string"==typeof i)return i;if(0===i.length)return e[$.CommonErrors.Num];var e=0,o=1;if(3===r.length){var s=this.resolveNumberArg(r[2]);if("string"==typeof s)return s;o=1-(e=s)}if(n<i[0])return e.toString();if(n>i[i.length-1])return o.toString();for(var a=0,l=0;l<i.length;l++){if(i[l]===n){a=l/(i.length-1||1);break}if(i[l]>n){a=(l-1+(n-i[l-1])/(i[l]-i[l-1]))/(i.length-1);break}}return a.toString()},ee.prototype.ComputeQUARTILE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.resolveNumberArg(r[1]))?e:(e=Math.floor(e))<0||4<e?n[$.CommonErrors.Num]:"string"==typeof(n=this.sortedSample([r[0]]))?n:"string"==typeof(n=this.percentile(n,{0:0,1:.25,2:.5,3:.75,4:1}[e]))?n:n.toString()};var Jt,re,te=ee;function ee(r){r=re.call(this,r)||this;return r.formulas=[{formulaName:"PERCENTILE",category:"Statistical",description:"Returns the k-th percentile of values in a range."},{formulaName:"PERCENTRANK",category:"Statistical",description:"Returns the percentage rank of a value in a data set."},{formulaName:"QUARTILE",category:"Statistical",description:"Returns the quartile of a data set."}],r}ne=function(r,t){return(ne=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}ne(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(m,ie=Bt),m.prototype.ComputeNORMDIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if(o<=0)return e[$.CommonErrors.Num];e=!0;if(4===r.length){var s=this.resolveNumberArg(r[3]);if("string"==typeof s)return s;e=0!==s}return(e?pr(n,i,o):(s=(n-i)/o,Math.exp(-.5*s*s)/(o*Math.sqrt(2*Math.PI)))).toString()},m.prototype.ComputeNORMSDIST=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveNumberArg(t[0]))?r:pr(r).toString()},m.prototype.ComputeNORMINV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(i=this.resolveNumberArg(r[0]),e=this.resolveNumberArg(r[1]),n=this.resolveNumberArg(r[2]),"string"==typeof i?i:"string"==typeof e?e:"string"==typeof n?n:(i=gr(i,e,n),isNaN(i)?o[$.CommonErrors.Num]:i.toString()))},m.prototype.ComputeNORMSINV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.resolveNumberArg(r[0]))?e:(e=gr(e),isNaN(e)?n[$.CommonErrors.Num]:e.toString())},m.prototype.ComputePOISSON=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;var o=Math.floor(n);if(o<0||i<0)return e[$.CommonErrors.Num];n=!0;if(3===r.length){e=this.resolveNumberArg(r[2]);if("string"==typeof e)return e;n=0!==e}if(!n)return(Math.exp(-i)*Math.pow(i,o)/l(o)).toString();for(var s=0,a=0;a<=o;a++)s+=Math.exp(-i)*Math.pow(i,a)/l(a);return s.toString()},m.prototype.ComputeBINOMDIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=Math.floor(n),a=Math.floor(i);if(s<0||a<0||a<s||o<0||1<o)return e[$.CommonErrors.Num];n=!0;if(4===r.length){i=this.resolveNumberArg(r[3]);if("string"==typeof i)return i;n=0!==i}e=f(a,s)*Math.pow(o,s)*Math.pow(1-o,a-s);if(!n)return e.toString();for(var l=0,u=0;u<=s;u++)l+=f(a,u)*Math.pow(o,u)*Math.pow(1-o,a-u);return l.toString()},m.prototype.ComputeEXPONDIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;if(n<0||i<=0)return e[$.CommonErrors.Num];e=!0;if(3===r.length){var o=this.resolveNumberArg(r[2]);if("string"==typeof o)return o;e=0!==o}return(e?1-Math.exp(-i*n):i*Math.exp(-i*n)).toString()},m.prototype.ComputeCONFIDENCE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(i=this.resolveNumberArg(r[0]),e=this.resolveNumberArg(r[1]),n=this.resolveNumberArg(r[2]),"string"==typeof i?i:"string"==typeof e?e:"string"==typeof n?n:i<=0||1<=i||e<=0||n<1||(i=gr(1-i/2),isNaN(i))?o[$.CommonErrors.Num]:(i*e/Math.sqrt(n)).toString())};var ne,ie,oe=m;function m(r){r=ie.call(this,r)||this;return r.formulas=[{formulaName:"NORMDIST",category:"Statistical",description:"Returns the normal cumulative distribution."},{formulaName:"NORMSDIST",category:"Statistical",description:"Returns the standard normal cumulative distribution."},{formulaName:"NORMINV",category:"Statistical",description:"Returns the inverse of the normal cumulative distribution."},{formulaName:"NORMSINV",category:"Statistical",description:"Returns the inverse of the standard normal cumulative distribution."},{formulaName:"POISSON",category:"Statistical",description:"Returns the Poisson distribution."},{formulaName:"BINOMDIST",category:"Statistical",description:"Returns the individual term binomial distribution probability."},{formulaName:"EXPONDIST",category:"Statistical",description:"Returns the exponential distribution."},{formulaName:"CONFIDENCE",category:"Statistical",description:"Returns the confidence interval for a population mean."}],r}se=function(r,t){return(se=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}se(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(ue,ae=t),ue.prototype.ComputeMAXIFS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.aggregateIfs(r,!0)},ue.prototype.ComputeMINIFS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.aggregateIfs(r,!1)},ue.prototype.aggregateIfs=function(r,t){var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||r.length%2==0)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var n=r[0],n=this.parent.getCellCollection(n),i=Array.isArray(n)?n:[n],o=[],s=1;s<r.length;s+=2)o.push([r[s],r[s+1]]);for(var a=[],l=0;l<o.length;l++){var u=this.parent.getCellCollection(o[l][0]),u=Array.isArray(u)?u:[u];if(u.length!==i.length)return e[$.CommonErrors.Value];a.push(u)}for(var h=null,p=!1,s=0;s<i.length;s++){for(var g=!0,l=0;l<o.length;l++){var f=this.parent.getValueFromArg(a[l][s]);if(!this.matchesCriteria(f,o[l][1])){g=!1;break}}if(g){var m=this.parent.getValueFromArg(i[s]);if(-1<e.indexOf(m))return m;""!==m&&this.parent.isNumber(m)&&(m=this.parent.parseFloat(m),p=!0,null===h||(t?h<m:m<h))&&(h=m)}}return p&&null!==h?h.toString():"0"},ue.prototype.matchesCriteria=function(r,t){var e=t.trim(),t=(e.startsWith(this.parent.tic)&&e.endsWith(this.parent.tic)?e=this.parent.removeTics(e):this.parent.isCellReference(e)?e=this.parent.getValueFromArg(e):(e=this.parent.getValueFromArg(e),this.parent.isCellReference(t)||(e=this.parent.removeTics(e))),"equal");return e.startsWith("<=")?(t="lessEq",e=e.substring(2)):e.startsWith(">=")?(t="greaterEq",e=e.substring(2)):e.startsWith("<>")?(t="notEq",e=e.substring(2)):e.startsWith("<")?(t="less",e=e.substring(1)):e.startsWith(">")?(t="greater",e=e.substring(1)):e.startsWith("=")&&(t="equal",e=e.substring(1)),(e=e.trim()).startsWith(this.parent.tic)&&(e=this.parent.removeTics(e)),this.parent.processLogical([r.toLowerCase(),e.toLowerCase()],t)===this.parent.trueValue};var se,ae,le=ue;function ue(r){r=ae.call(this,r)||this;return r.formulas=[{formulaName:"MAXIFS",category:"Statistical",description:"Returns the maximum value among cells specified by criteria."},{formulaName:"MINIFS",category:"Statistical",description:"Returns the minimum value among cells specified by criteria."}],r}he=function(r,t){return(he=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}he(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(c,pe=Bt),c.prototype.stdevVarA=function(r,t,e){var n=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var i=this.collectSample(r,!0);if("string"==typeof i)return i;if(i.length<(t?1:2))return n[$.CommonErrors.DivZero];for(var o=this.mean(i),s=0,a=0;a<i.length;a++){var l=i[a]-o;s+=l*l}r=s/(t?i.length:i.length-1);return(e?r:Math.sqrt(r)).toString()},c.prototype.ComputeSTDEVA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVarA(r,!1,!1)},c.prototype.ComputeSTDEVPA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVarA(r,!0,!1)},c.prototype.ComputeVARA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVarA(r,!1,!0)},c.prototype.ComputeVARPA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVarA(r,!0,!0)},c.prototype.ComputeTRIMMEAN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.resolveNumberArg(r[1]))?e:e<0||1<=e?i[$.CommonErrors.Num]:"string"==typeof(n=this.collectSample([r[0]],!1))?n:0===n.length||(n=n.slice().sort(function(r,t){return r-t}),e=Math.floor(n.length*e/2),0===(n=n.slice(e,n.length-e)).length)?i[$.CommonErrors.DivZero]:this.mean(n).toString()},c.prototype.ComputeFISHER=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.resolveNumberArg(r[0]))?e:e<=-1||1<=e?n[$.CommonErrors.Num]:(.5*Math.log((1+e)/(1-e))).toString()},c.prototype.ComputeFISHERINV=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveNumberArg(t[0]))?r:(((r=Math.exp(2*r))-1)/(r+1)).toString()},c.prototype.ComputeGAMMALN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.resolveNumberArg(r[0]))?e:!(e<=0)&&(e=mr(e),isFinite(e))?e.toString():n[$.CommonErrors.Num]},c.prototype.sumSquaresPair=function(r,t){var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];r=this.collectPair(r);if("string"==typeof r)return r;var n=r.x,i=r.y;if(0===n.length)return e[$.CommonErrors.DivZero];for(var o,s=0,a=0;a<n.length;a++)s+="x2my2"===t?n[a]*n[a]-i[a]*i[a]:"x2py2"===t?n[a]*n[a]+i[a]*i[a]:(o=n[a]-i[a])*o;return s.toString()},c.prototype.ComputeSUMX2MY2=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.sumSquaresPair(r,"x2my2")},c.prototype.ComputeSUMX2PY2=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.sumSquaresPair(r,"x2py2")},c.prototype.ComputeSUMXMY2=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.sumSquaresPair(r,"xmy2")};var he,pe,ge=c;function c(r){r=pe.call(this,r)||this;return r.formulas=[{formulaName:"STDEVA",category:"Statistical",description:"Estimates standard deviation based on a sample, including text and logicals."},{formulaName:"STDEVPA",category:"Statistical",description:"Calculates standard deviation based on the entire population, including text and logicals."},{formulaName:"VARA",category:"Statistical",description:"Estimates variance based on a sample, including text and logicals."},{formulaName:"VARPA",category:"Statistical",description:"Calculates variance based on the entire population, including text and logicals."},{formulaName:"TRIMMEAN",category:"Statistical",description:"Returns the mean of the interior of a data set."},{formulaName:"FISHER",category:"Statistical",description:"Returns the Fisher transformation."},{formulaName:"FISHERINV",category:"Statistical",description:"Returns the inverse of the Fisher transformation."},{formulaName:"GAMMALN",category:"Statistical",description:"Returns the natural logarithm of the gamma function."},{formulaName:"SUMX2MY2",category:"Statistical",description:"Returns the sum of the difference of squares of corresponding values in two arrays."},{formulaName:"SUMX2PY2",category:"Statistical",description:"Returns the sum of the sum of squares of corresponding values in two arrays."},{formulaName:"SUMXMY2",category:"Statistical",description:"Returns the sum of squares of differences of corresponding values in two arrays."}],r}fe=function(r,t){return(fe=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}fe(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(d,me=Bt),d.prototype.parseCumulative=function(r,t){return r.length<=t||("string"==typeof(r=this.resolveNumberArg(r[t]))?r:0!==r)},d.prototype.ComputeCRITBINOM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||3!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=Math.floor(n),a=i;if(s<0||a<0||1<a||o<0||1<o)return e[$.CommonErrors.Num];for(var l=0,u=0;u<=s;u++)if(o<=(l+=f(s,u)*Math.pow(a,u)*Math.pow(1-a,s-u)))return u.toString();return s.toString()},d.prototype.ComputeNEGBINOMDIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),e=this.resolveNumberArg(r[2]),"string"==typeof n?n:"string"==typeof i?i:"string"==typeof e?e:(n=Math.floor(n),i=Math.floor(i),n<0||i<1||e<=0||1<e?o[$.CommonErrors.Num]:(f(n+i-1,i-1)*Math.pow(e,i)*Math.pow(1-e,n)).toString()))},d.prototype.ComputeHYPGEOMDIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<4||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]),s=this.resolveNumberArg(r[3]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;var a=Math.floor(n),l=Math.floor(i),u=Math.floor(o),h=Math.floor(s);if(a<0||l<a||h<l||h<u)return e[$.CommonErrors.Num];n=this.parseCumulative(r,4);if("string"==typeof n)return n;i=f(u,a)*f(h-u,l-a)/f(h,l);if(!n)return i.toString();for(var p=0,g=0;g<=a;g++)p+=f(u,g)*f(h-u,l-g)/f(h,l);return p.toString()},d.prototype.ComputeWEIBULL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<3||4<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),"string"==typeof e?e:"string"==typeof n?n:"string"==typeof i?i:e<0||n<=0||i<=0?o[$.CommonErrors.Num]:"string"==typeof(o=this.parseCumulative(r,3))?o:(o?1-Math.exp(-Math.pow(e/i,n)):n/Math.pow(i,n)*Math.pow(e,n-1)*Math.exp(-Math.pow(e/i,n))).toString())},d.prototype.ComputeLOGNORMDIST=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z.isNullOrUndefined(n)||3!==n.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(n[0]),r=this.resolveNumberArg(n[1]),t=this.resolveNumberArg(n[2]),"string"==typeof e?e:"string"==typeof r?r:"string"==typeof t?t:(e=xr(e,r,t),isNaN(e)?this.parent.getErrorStrings()[$.CommonErrors.Num]:e.toString()))},d.prototype.ComputeLOGINV=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z.isNullOrUndefined(n)||3!==n.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(n[0]),r=this.resolveNumberArg(n[1]),t=this.resolveNumberArg(n[2]),"string"==typeof e?e:"string"==typeof r?r:"string"==typeof t?t:(e=Vr(e,r,t),isNaN(e)?this.parent.getErrorStrings()[$.CommonErrors.Num]:e.toString()))},d.prototype.ComputeGAMMADIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<3||4<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(i=this.resolveNumberArg(r[0]),e=this.resolveNumberArg(r[1]),n=this.resolveNumberArg(r[2]),"string"==typeof i?i:"string"==typeof e?e:"string"==typeof n?n:i<0||e<=0||n<=0?o[$.CommonErrors.Num]:"string"==typeof(o=this.parseCumulative(r,3))?o:(i=i/n,(o?dr(e,i):Math.pow(i,e-1)*Math.exp(-i)/(n*cr(e))).toString()))},d.prototype.ComputeGAMMAINV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||3!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if(n<=0||1<=n||i<=0||o<=0)return e[$.CommonErrors.Num];for(var s=0,a=i*o*20+1,l=0;l<100;l++){var u=(s+a)/2;dr(i,u/o)<n?s=u:a=u}return((s+a)/2).toString()},d.prototype.ComputeCHIDIST=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||2!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(e[0]),t=this.resolveNumberArg(e[1]),"string"==typeof r?r:"string"==typeof t?t:(1-Nr(r,t)).toString())},d.prototype.ComputeCHIINV=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||2!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(t=this.resolveNumberArg(e[0]),r=this.resolveNumberArg(e[1]),"string"==typeof t?t:"string"==typeof r?r:(t=vr(1-t,r),isNaN(t)?this.parent.getErrorStrings()[$.CommonErrors.Num]:t.toString()))},d.prototype.ComputeCHITEST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.chiSquareTest(r)},d.prototype.chiSquareTest=function(r){var t=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.collectSample([r[0]],!1),n=this.collectSample([r[1]],!1);if("string"==typeof e)return e;if("string"==typeof n)return n;if(e.length!==n.length||0===e.length)return t[$.CommonErrors.NA];for(var i=0,o=0;o<e.length;o++){if(0===n[o])return t[$.CommonErrors.DivZero];var s=e[o]-n[o];i+=s*s/n[o]}return(1-Nr(i,e.length-1)).toString()},d.prototype.ComputeFDIST=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z.isNullOrUndefined(n)||3!==n.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(n[0]),t=this.resolveNumberArg(n[1]),e=this.resolveNumberArg(n[2]),"string"==typeof r?r:"string"==typeof t?t:"string"==typeof e?e:(1-Er(r,t,e)).toString())},d.prototype.ComputeFINV=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z.isNullOrUndefined(n)||3!==n.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(n[0]),r=this.resolveNumberArg(n[1]),t=this.resolveNumberArg(n[2]),"string"==typeof e?e:"string"==typeof r?r:"string"==typeof t?t:(e=yr(1-e,r,t),isNaN(e)?this.parent.getErrorStrings()[$.CommonErrors.Num]:e.toString()))},d.prototype.ComputeZTEST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.collectSample([r[0]],!1);if("string"==typeof n)return n;if(n.length<2)return e[$.CommonErrors.DivZero];var i=this.resolveNumberArg(r[1]);if("string"==typeof i)return i;for(var o=this.mean(n),s=0,a=0;a<n.length;a++){var l=n[a]-o;s+=l*l}var u=Math.sqrt(s/(n.length-1));if(0===u)return e[$.CommonErrors.DivZero];e=u/Math.sqrt(n.length);if(3===r.length){u=this.resolveNumberArg(r[2]);if("string"==typeof u)return u;e=u/Math.sqrt(n.length)}return(1-pr((o-i)/e)).toString()},d.prototype.ComputePROB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.collectSample([r[0]],!1);if("string"==typeof n)return n;var i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof i)return i;if("string"==typeof o)return o;if(0===n.length)return e[$.CommonErrors.Num];for(var s=0,a=0,l=0;l<n.length;l++)s+=1,n[l]>=i&&n[l]<=o&&(a+=1);return(a/s).toString()};var fe,me,ce=d;function d(r){r=me.call(this,r)||this;return r.formulas=[{formulaName:"CRITBINOM",category:"Statistical",description:"Returns the smallest value for which the cumulative binomial distribution is less than or equal to a criterion value."},{formulaName:"NEGBINOMDIST",category:"Statistical",description:"Returns the negative binomial distribution."},{formulaName:"HYPGEOMDIST",category:"Statistical",description:"Returns the hypergeometric distribution."},{formulaName:"WEIBULL",category:"Statistical",description:"Returns the Weibull distribution."},{formulaName:"LOGNORMDIST",category:"Statistical",description:"Returns the cumulative log-normal distribution."},{formulaName:"LOGINV",category:"Statistical",description:"Returns the inverse of the log-normal cumulative distribution."},{formulaName:"GAMMADIST",category:"Statistical",description:"Returns the gamma distribution."},{formulaName:"GAMMAINV",category:"Statistical",description:"Returns the inverse of the gamma cumulative distribution."},{formulaName:"CHIDIST",category:"Statistical",description:"Returns the one-tailed probability of the chi-squared distribution."},{formulaName:"CHIINV",category:"Statistical",description:"Returns the inverse of the one-tailed probability of the chi-squared distribution."},{formulaName:"CHITEST",category:"Statistical",description:"Returns the test for independence."},{formulaName:"FDIST",category:"Statistical",description:"Returns the F probability distribution."},{formulaName:"FINV",category:"Statistical",description:"Returns the inverse of the F probability distribution."},{formulaName:"ZTEST",category:"Statistical",description:"Returns the one-tailed probability-value of a z-test."},{formulaName:"PROB",category:"Statistical",description:"Returns the probability that values in a range are between two limits."}],r}de=function(r,t){return(de=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}de(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(N,Ne=t),N.prototype.resolveComplex=function(r){var t=this.parent.getErrorStrings(),r=this.resolveTextArg(r);return-1<t.indexOf(r)?r:fr(r)||t[$.CommonErrors.Num]},N.prototype.ComputeCOMPLEX=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z.isNullOrUndefined(n)||n.length<2||3<n.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(n[0]),t=this.resolveNumberArg(n[1]),"string"==typeof r?r:"string"==typeof t?t:(e="i",3===n.length&&"i"!==(e=this.resolveTextArg(n[2]))&&"j"!==e?this.parent.getErrorStrings()[$.CommonErrors.Value]:s(r,t,e)))},N.prototype.ComputeIMABS=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(t[0]))?r:Math.sqrt(r.re*r.re+r.im*r.im).toString()},N.prototype.ComputeIMAGINARY=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(t[0]))?r:r.im.toString()},N.prototype.ComputeIMREAL=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(t[0]))?r:r.re.toString()},N.prototype.ComputeIMCONJUGATE=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(t[0]))?r:s(r.re,-r.im)},N.prototype.ComputeIMSUM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.complexReduce(r,function(r,t){return{re:r.re+t.re,im:r.im+t.im}})},N.prototype.ComputeIMSUB=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||2!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveComplex(e[0]),t=this.resolveComplex(e[1]),"string"==typeof r?r:"string"==typeof t?t:s(r.re-t.re,r.im-t.im))},N.prototype.ComputeIMPRODUCT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.complexReduce(r,function(r,t){return{re:r.re*t.re-r.im*t.im,im:r.re*t.im+r.im*t.re}},{re:1,im:0})},N.prototype.ComputeIMDIV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveComplex(r[0]),n=this.resolveComplex(r[1]),"string"==typeof e?e:"string"==typeof n?n:0==(i=n.re*n.re+n.im*n.im)?o[$.CommonErrors.DivZero]:s((e.re*n.re+e.im*n.im)/i,(e.im*n.re-e.re*n.im)/i))},N.prototype.complexReduce=function(r,t,e){if(z.isNullOrUndefined(r)||r.length<1)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=void 0!==e?e:this.resolveComplex(r[0]);if("string"==typeof n)return n;for(var i=e?0:1;i<r.length;i++){var o=this.resolveComplex(r[i]);if("string"==typeof o)return o;n=t(n,o)}return s(n.re,n.im)},N.prototype.ComputeIMEXP=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(e[0]))?r:s((t=Math.exp(r.re))*Math.cos(r.im),t*Math.sin(r.im))},N.prototype.ComputeIMLN=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(e[0]))?r:0===(t=Math.sqrt(r.re*r.re+r.im*r.im))?this.parent.getErrorStrings()[$.CommonErrors.Num]:s(Math.log(t),Math.atan2(r.im,r.re))},N.prototype.ComputeIMLOG10=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.ComputeIMLN.apply(this,r);return!("string"==typeof i&&-1<this.parent.getErrorStrings().indexOf(i))&&(e=fr(i.toString()))?(n=1/Math.LN10,s(e.re*n,e.im*n)):i},N.prototype.ComputeIMLOG2=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.ComputeIMLN.apply(this,r);return!("string"==typeof i&&-1<this.parent.getErrorStrings().indexOf(i))&&(e=fr(i.toString()))?(n=1/Math.LN2,s(e.re*n,e.im*n)):i},N.prototype.ComputeIMSQRT=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(e[0]))?r:(t=Math.sqrt(r.re*r.re+r.im*r.im),r=Math.atan2(r.im,r.re),s((t=Math.sqrt(t))*Math.cos(r/2),t*Math.sin(r/2)))},N.prototype.ComputeIMPOWER=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(i=this.resolveComplex(r[0]),e=this.resolveNumberArg(r[1]),"string"==typeof i?i:"string"==typeof e?e:(e=Math.floor(e),0===(n=Math.sqrt(i.re*i.re+i.im*i.im))&&e<=0?o[$.CommonErrors.Num]:(o=e*Math.atan2(i.im,i.re),s((i=Math.pow(n,e))*Math.cos(o),i*Math.sin(o)))))},N.prototype.ComputeIMARGUMENT=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(t[0]))?r:0===r.re&&0===r.im?this.parent.getErrorStrings()[$.CommonErrors.DivZero]:Math.atan2(r.im,r.re).toString()},N.prototype.ComputeIMSIN=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(t[0]))?r:s(Math.sin(r.re)*Math.cosh(r.im),Math.cos(r.re)*Math.sinh(r.im))},N.prototype.ComputeIMCOS=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(t[0]))?r:s(Math.cos(r.re)*Math.cosh(r.im),-Math.sin(r.re)*Math.sinh(r.im))};var de,Ne,ve=N;function N(r){r=Ne.call(this,r)||this;return r.formulas=[{formulaName:"COMPLEX",category:"Engineering",description:"Converts real and imaginary coefficients into a complex number."},{formulaName:"IMABS",category:"Engineering",description:"Returns the absolute value (modulus) of a complex number."},{formulaName:"IMAGINARY",category:"Engineering",description:"Returns the imaginary coefficient of a complex number."},{formulaName:"IMREAL",category:"Engineering",description:"Returns the real coefficient of a complex number."},{formulaName:"IMCONJUGATE",category:"Engineering",description:"Returns the complex conjugate of a complex number."},{formulaName:"IMSUM",category:"Engineering",description:"Returns the sum of complex numbers."},{formulaName:"IMSUB",category:"Engineering",description:"Returns the difference between two complex numbers."},{formulaName:"IMPRODUCT",category:"Engineering",description:"Returns the product of complex numbers."},{formulaName:"IMDIV",category:"Engineering",description:"Returns the quotient of two complex numbers."},{formulaName:"IMSIN",category:"Engineering",description:"Returns the sine of a complex number."},{formulaName:"IMCOS",category:"Engineering",description:"Returns the cosine of a complex number."},{formulaName:"IMEXP",category:"Engineering",description:"Returns the exponential of a complex number."},{formulaName:"IMLN",category:"Engineering",description:"Returns the natural logarithm of a complex number."},{formulaName:"IMSQRT",category:"Engineering",description:"Returns the square root of a complex number."},{formulaName:"IMPOWER",category:"Engineering",description:"Returns a complex number raised to an integer power."},{formulaName:"IMARGUMENT",category:"Engineering",description:"Returns the argument theta of a complex number in radians."},{formulaName:"IMLOG10",category:"Engineering",description:"Returns the base-10 logarithm of a complex number."},{formulaName:"IMLOG2",category:"Engineering",description:"Returns the base-2 logarithm of a complex number."}],r}Ee=function(r,t){return(Ee=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Ee(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(v,Se=t),v.prototype.ComputeDATE=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(t.length&&"nestedFormulaTrue"===t[t.length-1]&&(r=!0,t.pop()),z.isNullOrUndefined(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(3!==t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var n=[],i=0;i<t.length;++i)n[i]=this.parent.getValueFromArg(t[i]);n[0]=n[0]===this.parent.trueValue?"1":n[0]===this.parent.falseValue?"0":n[0],n[1]=n[1]===this.parent.trueValue?"1":n[1]===this.parent.falseValue?"0":n[1],n[2]=n[2]===this.parent.trueValue?"1":n[2]===this.parent.falseValue?"0":n[2];for(var o=0;o<n.length;o++){var s=n[o];if(-1<this.parent.getErrorStrings().indexOf(s))return s;if('""'===s||'"0"'===s&&'"0"'!==t[o]||'"TRUE"'===s||'"FALSE"'===s)return this.parent.getErrorStrings()[$.CommonErrors.Value].toString()}var a=Math.floor(this.parent.parseFloat(n[0].split(this.parent.tic).join(""))),l=Math.floor(this.parent.parseFloat(n[1].split(this.parent.tic).join(""))),u=Math.floor(this.parent.parseFloat(n[2].split(this.parent.tic).join(""))),h=0;if(isNaN(a)||isNaN(l)||isNaN(u))return this.parent.getErrorStrings()[$.CommonErrors.Value].toString();if(a<0&&l<=12||1e4<=a&&0<l)return this.parent.getErrorStrings()[$.CommonErrors.Num].toString();for(;12<l;)l-=12,a++;if(0===(h=this.parent.getSerialDateFromDate(a,l,u)))return this.parent.getErrorStrings()[$.CommonErrors.Num].toString();u=this.parent.fromOADate(h);if("Invalid Date"!==u.toString()){if(u.getFullYear()<1900||1e4<=u.getFullYear())return this.parent.getErrorStrings()[$.CommonErrors.Num].toString();if(!r)return new z.Internationalization(this.parent.parentObject.locale||"en-US").formatDate(u,{type:"date",skeleton:"yMd"})}return h.toString()},v.prototype.ComputeDAY=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=this.parent.getErrorStrings();if(z.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1<e.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(e[0].startsWith(this.parent.tic)){if(""===(t=e[0].split(this.parent.tic).join(""))||t===this.parent.trueValue||t===this.parent.falseValue)return i[$.CommonErrors.Value]}else if(t=this.parent.getValueFromArg(e[0].split(this.parent.tic).join("")),this.parent.isCellReference(e[0])&&-1<t.indexOf(this.parent.tic))return i[$.CommonErrors.Value];return-1<i.indexOf(t)?t:Number(t)<0?i[$.CommonErrors.Num]:0===Math.floor(Number(t))||t===this.parent.falseValue?0:t===this.parent.trueValue?1:(r=this.parent.isNaN(Number(t))?this.parent.parseDate(t):this.parent.intToDate(t),"NaN"===(r="[object Date]"===Object.prototype.toString.call(r)?new Date(r).getFullYear()<1900||9999<new Date(r).getFullYear()?this.parent.isNumber(t)?"Num":"NaN":r.getDate():r).toString()?i[$.CommonErrors.Value]:"Num"===r.toString()?i[$.CommonErrors.Num]:r)},v.prototype.ComputeTODAY=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1!==e.length||""!==e[0]?r=this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:(t=new Date(Date.now()),"spreadsheet"===this.parent.parentObject.getModuleName()?(r=L(t).toString(),0===this.parent.parser.storedStringText.toUpperCase().indexOf("TODAY")&&""!==this.parent.cell&&this.parent.parentObject.setDateFormat(this.parent.getSheetId(this.parent.grid),this.parent.rowIndex(this.parent.cell)-1,this.parent.colIndex(this.parent.cell)-1)):r=t.getFullYear()+"/"+this.parent.calculateDate((t.getMonth()+1).toString())+"/"+this.parent.calculateDate(t.getDate().toString())),r},v.prototype.ComputeDAYS=function(){for(var e=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)&&1===r.length&&""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(i=(n=function(r){var t=e.parent.getValueFromArg(r).trim();if(-1<t.indexOf(e.parent.tic)&&(""===(t=t.split(e.parent.tic).join("").trim())||e.parent.isCellReference(r)||t.toUpperCase()===e.parent.trueValue||t.toUpperCase()===e.parent.falseValue))return o[$.CommonErrors.Value];if((t=t.split(e.parent.tic).join("")).toUpperCase()===e.parent.trueValue)t="1";else if(""===t||t.toUpperCase()===e.parent.falseValue)t="0";else if(Number(t)<0)return o[$.CommonErrors.Num];r=e.parent.hostParseDate(t.toString());return t=r.isDate||r.isTime?(e.parent.parseDate(t).getTime()/864e5).toString():t})(r[0]),-1<o.indexOf(i)?i:(n=n(r[1]),-1<o.indexOf(n)?n:(i=Math.floor(Number(i))-Math.floor(Number(n)),isNaN(i)?o[$.CommonErrors.Value]:i)))},v.prototype.ComputeWEEKDAY=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(""===n[0]&&z.isNullOrUndefined(n[1])||2<n.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===n[0]&&""===n[1]||""===n[1])return this.parent.getErrorStrings()[$.CommonErrors.Num].toString();if(1===n.length&&n.push("1"),-1<n[0].indexOf(this.parent.tic)&&""===n[0].split(this.parent.tic).join("").trim()||""===n[1].split(this.parent.tic).join("").trim()||-1<n[1].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(n[0])){if(-1<(r=this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else r=-1<n[0].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n[0].split(this.parent.tic).join("")))?this.parent.getValueFromArg(n[0]):this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))||"0";if(t=this.parent.isCellReference(n[1])?this.parent.getValueFromArg(n[1].split(this.parent.tic).join(""))||"0":this.parent.getValueFromArg(n[1].split(this.parent.tic).join("")),-1<this.parent.getErrorStrings().indexOf(r))return r;if(-1<this.parent.getErrorStrings().indexOf(t))return t;if(r=r===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r,t=t===this.parent.trueValue?"1":t===this.parent.falseValue?"0":t,e=this.parent.parseFloat(r),t=this.parent.parseFloat(t),isNaN(t)||isNaN(e))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(e<0||2958465<e)return this.parent.getErrorStrings()[$.CommonErrors.Num].toString();switch(t=parseInt(t.toString(),10),e=e<1?0:Math.floor(e)%7,t){case 1:case 17:e=e<=0?e+7:e;break;case 2:case 11:e=(e-=1)<=0?e+7:e;break;case 3:e=(e-=2)<0?e+7:e;break;case 12:e=7<(e+=5)?e-7:e;break;case 13:e=7<(e+=4)?e-7:e;break;case 14:e=7<(e+=3)?e-7:e;break;case 15:e=7<(e+=2)?e-7:e;break;case 16:e=7<(e+=1)?e-7:e;break;default:e=this.parent.getErrorStrings()[$.CommonErrors.Num].toString()}return e},v.prototype.ComputeTIME=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(z.isNullOrUndefined(n)||3!==n.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(-1<n[0].indexOf(this.parent.tic)&&""===n[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[$.CommonErrors.Value];if(-1<n[1].indexOf(this.parent.tic)&&""===n[1].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[$.CommonErrors.Value];if(-1<n[2].indexOf(this.parent.tic)&&""===n[2].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(n[0])){if(-1<(e=this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if(-1<n[0].indexOf(this.parent.tic)&&(n[0].split(this.parent.tic).join("")===this.parent.trueValue||n[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];e=this.parent.getValueFromArg(n[0]).split(this.parent.tic).join("")||"0"}if(-1<this.parent.getErrorStrings().indexOf(e))return e;if(isNaN(this.parent.parseFloat(e))&&e!==this.parent.trueValue&&e!==this.parent.falseValue)return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(n[1])){if(-1<(r=this.parent.getValueFromArg(n[1].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if(-1<n[1].indexOf(this.parent.tic)&&(n[1].split(this.parent.tic).join("")===this.parent.trueValue||n[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];r=this.parent.getValueFromArg(n[1]).split(this.parent.tic).join("")||"0"}if(-1<this.parent.getErrorStrings().indexOf(r))return r;if(isNaN(this.parent.parseFloat(r))&&r!==this.parent.trueValue&&r!==this.parent.falseValue)return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(n[2])){if(-1<(t=this.parent.getValueFromArg(n[2].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if(-1<n[2].indexOf(this.parent.tic)&&(n[2].split(this.parent.tic).join("")===this.parent.trueValue||n[2].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];t=this.parent.getValueFromArg(n[2]).split(this.parent.tic).join("")||"0"}return-1<this.parent.getErrorStrings().indexOf(t)?t:isNaN(this.parent.parseFloat(t))&&t!==this.parent.trueValue&&t!==this.parent.falseValue||(e=e===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e,r=r===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r,t=t===this.parent.trueValue?"1":t===this.parent.falseValue?"0":t,e=parseInt(this.parent.parseFloat(e).toString(),10),r=parseInt(this.parent.parseFloat(r).toString(),10),t=parseInt(this.parent.parseFloat(t).toString(),10),isNaN(e))||isNaN(r)||isNaN(t)?this.parent.getErrorStrings()[$.CommonErrors.Value]:32767<e||32767<r||32767<t||(e=new Date(1900,0,1,e,r,t)).getFullYear()<1900?this.parent.getErrorStrings()[$.CommonErrors.Num]:(t=(r=(r=e.getHours())<10?"0"+r:r)+":"+(t=(t=e.getMinutes())<10?"0"+t:t)+":"+(r=(r=e.getSeconds())<10?"0"+r:r),(e=this.parent.hostParseDate(t.toString())).isTime?e.value:t)},v.prototype.ComputeEDATE=function(){for(var r,t,e,n,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(2!==i.length||z.isNullOrUndefined(i))return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===i[0]||""===i[1])return this.parent.getErrorStrings()[$.CommonErrors.NA];if(""===i[0].split(this.parent.tic).join("")||""===i[1].split(this.parent.tic).join("")||-1<i[1].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(i[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(i[0])){if(-1<i[0].indexOf(":"))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(-1<(r=this.parent.getValueFromArg(i[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(-1<this.parent.getErrorStrings().indexOf(r.toString()))return r.toString()}else r=this.parent.getValueFromArg(i[0].split(this.parent.tic).join(""));if(this.parent.isCellReference(i[1])){if(-1<i[1].indexOf(":"))return this.parent.getErrorStrings()[$.CommonErrors.Value];n=this.parent.getValueFromArg(i[1].split(this.parent.tic).join(""))||"0"}else n=this.parent.getValueFromArg(i[1].split(this.parent.tic).join(""));if(-1<this.parent.getErrorStrings().indexOf(n))return n;if(n=parseInt(n,10),this.parent.isNumber(r)){if((r=parseInt(r,10))<0||2958465<r)return this.parent.getErrorStrings()[$.CommonErrors.Num];t=this.parent.fromOADate(r)}else t=this.parent.checkDateFormat(r);return isNaN(n)||z.isNullOrUndefined(this.parent.isDate(t))||9999<t.getFullYear()?this.parent.getErrorStrings()[$.CommonErrors.Value]:(e=t.getDate(),t.setMonth(t.getMonth()+n),e!==t.getDate()&&t.setDate(0),n=L(t),"0"===r.toString()&&--n,n<0||2958465<n?this.parent.getErrorStrings()[$.CommonErrors.Num]:n.toString())},v.prototype.ComputeEOMONTH=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(2!==n.length||z.isNullOrUndefined(n))return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===n[0]||""===n[1])return this.parent.getErrorStrings()[$.CommonErrors.NA];if(""===n[0].split(this.parent.tic).join("")||""===n[1].split(this.parent.tic).join("")||-1<n[1].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(n[0])){if(-1<n[0].indexOf(":"))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(-1<(e=this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else e=this.parent.getValueFromArg(n[0]).split(this.parent.tic).join("");if(-1<this.parent.getErrorStrings().indexOf(e))return e;if(this.parent.isCellReference(n[1])){if(-1<n[1].indexOf(":"))return this.parent.getErrorStrings()[$.CommonErrors.Value];r=this.parent.getValueFromArg(n[1].split(this.parent.tic).join(""))||"0"}else r=this.parent.getValueFromArg(n[1].split(this.parent.tic).join(""));if(-1<this.parent.getErrorStrings().indexOf(r))return r;if(r=parseInt(r,10),this.parent.isNumber(e)){if((e=parseInt(e,10))<0||2958465<e)return this.parent.getErrorStrings()[$.CommonErrors.Num];t=this.parent.fromOADate(e)}else t=this.parent.checkDateFormat(e);return isNaN(r)||z.isNullOrUndefined(this.parent.isDate(t))||9999<t.getFullYear()?this.parent.getErrorStrings()[$.CommonErrors.Value]:(e=L(t=new Date(t.getFullYear(),t.getMonth()+(r+1),0)))<0||2958465<e||t.getFullYear()<1900?this.parent.getErrorStrings()[$.CommonErrors.Num]:e.toString()},v.prototype.ComputeDATEVALUE=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this.parent.getErrorStrings();if(""===t[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(r=i=this.parent.getValueFromArg(t[0])||"0",-1<n.indexOf(r))return r;if(this.parent.isCellReference(t[0])){if(-1<t[0].indexOf(":")||r.startsWith(this.parent.tic))return n[$.CommonErrors.Value]}else r=t[0].split(this.parent.tic).join("")||"0";if(this.parent.isNumber(r)||z.isNullOrUndefined(this.parent.isDate(r))){if(this.parent.isNumber(i)||!this.parent.isDate(i))return n[$.CommonErrors.Value];r=i}var i=this.parent.parseDate(r);return-1<n.indexOf(r)?r:z.isNullOrUndefined(i)||"Invalid Date"===i.toString()||i.getFullYear()<1900||9999<i.getFullYear()?this.parent.getErrorStrings()[$.CommonErrors.Value]:(r=this.parent.toOADate(i).toString(),parseFloat(r).toFixed(0).toString())},v.prototype.ComputeHOUR=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(1!==e.length||z.isNullOrUndefined(e)||""===e[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===e[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(e[0])){if(-1<(r=this.parent.getValueFromArg(e[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if(-1<e[0].indexOf(this.parent.tic)&&(e[0].split(this.parent.tic).join("")===this.parent.trueValue||e[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];r=this.parent.getValueFromArg(e[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(r))return r;if(r=r===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r,this.parent.isNumber(r)){if(this.parent.parseFloat(r)<0||2958465<this.parent.parseFloat(r))return this.parent.getErrorStrings()[$.CommonErrors.Num];t=this.parent.intToTime(r)}else{var i=this.parent.hostParseDate(r.toString());if(!i.isDate&&!i.isTime)return this.parent.getErrorStrings()[$.CommonErrors.Value];t=i.dateObj}return"Invalid Date"===(t="Invalid Date"===t.toString()?new Date(Date.parse(r)):t).toString()&&(i=new Date(Date.now()).toLocaleDateString()+" "+r,t=new Date(Date.parse(i))),"Invalid Date"===(t="Invalid Date"===t.toString()?this.parent.fromOADate(this.parent.parseFloat(r)):t).toString()||t.getFullYear()<1900||9999<t.getFullYear()?this.parent.getErrorStrings()[$.CommonErrors.Value]:t.getHours()},v.prototype.ComputeMINUTE=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(1!==e.length||z.isNullOrUndefined(e)||""===e[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===e[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(e[0])){if(-1<(r=this.parent.getValueFromArg(e[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if(-1<e[0].indexOf(this.parent.tic)&&(e[0].split(this.parent.tic).join("")===this.parent.trueValue||e[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];r=this.parent.getValueFromArg(e[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(r))return r;if(r=r===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r,this.parent.isNumber(r)){if(this.parent.parseFloat(r)<0||2958465<this.parent.parseFloat(r))return this.parent.getErrorStrings()[$.CommonErrors.Num];t=this.parent.intToTime(r)}else{var i=this.parent.hostParseDate(r.toString());if(!i.isDate&&!i.isTime)return this.parent.getErrorStrings()[$.CommonErrors.Value];t=i.dateObj}return"Invalid Date"===(t="Invalid Date"===t.toString()?new Date(Date.parse(r)):t).toString()&&(i=new Date(Date.now()).toLocaleDateString()+" "+r,t=new Date(Date.parse(i))),"Invalid Date"===(t="Invalid Date"===t.toString()?this.parent.fromOADate(this.parent.parseFloat(r)):t).toString()||t.getFullYear()<1900||9999<t.getFullYear()?this.parent.getErrorStrings()[$.CommonErrors.Value]:t.getMinutes()},v.prototype.ComputeSECOND=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(1!==e.length||z.isNullOrUndefined(e)||""===e[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===e[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(e[0])){if(-1<(r=this.parent.getValueFromArg(e[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if(-1<e[0].indexOf(this.parent.tic)&&(e[0].split(this.parent.tic).join("")===this.parent.trueValue||e[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];r=this.parent.getValueFromArg(e[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(r))return r;if(r=r===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r,this.parent.isNumber(r)){if(this.parent.parseFloat(r)<0||2958465<this.parent.parseFloat(r))return this.parent.getErrorStrings()[$.CommonErrors.Num];t=this.parent.intToTime(r)}else{var i=this.parent.hostParseDate(r.toString());if(!i.isDate&&!i.isTime)return this.parent.getErrorStrings()[$.CommonErrors.Value];t=i.dateObj}return"Invalid Date"===(t="Invalid Date"===t.toString()?new Date(Date.parse(r)):t).toString()&&(i=new Date(Date.now()).toLocaleDateString()+" "+r,t=new Date(Date.parse(i))),"Invalid Date"===(t="Invalid Date"===t.toString()?this.parent.fromOADate(this.parent.parseFloat(r)):t).toString()||t.getFullYear()<1900||9999<t.getFullYear()?this.parent.getErrorStrings()[$.CommonErrors.Value]:t.getSeconds()},v.prototype.ComputeNOW=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return 1!==r.length||""!==r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:L(new Date(Date.now()),!0).toString()},v.prototype.ComputeMONTH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.parent.getValueFromArg(r[0]).trim();if(-1<e.indexOf(n))return n;if(this.parent.isCellReference(r[0])){if(-1<n.indexOf(this.parent.tic))return e[$.CommonErrors.Value];if(""===n)return 1}else{if('"TRUE"'===n.toUpperCase()||'"FALSE"'===n.toUpperCase())return e[$.CommonErrors.Value];n=n.split(this.parent.tic).join("")}if(""===n)return e[$.CommonErrors.Value];if(n===this.parent.trueValue||n===this.parent.falseValue||-1<Number(n)&&Number(n)<32)return 1;if(Number(n)<0)return e[$.CommonErrors.Num];-1<n.indexOf("%")&&(n=(.01*Number(n.split("%")[0])).toString()),this.parent.isNumber(n)&&(n=parseInt(Math.floor(Number(n)).toString(),10));var i=this.parent.parseDate(n);return"Invalid Date"===i.toString()?this.parent.isNumber(n)?e[$.CommonErrors.Num]:e[$.CommonErrors.Value]:i.getFullYear()<1900||1e4<=i.getFullYear()?e[$.CommonErrors.Num]:(i.getMonth()+1).toString()};var Ee,Se,ye=v;function v(r){r=Se.call(this,r)||this;return r.formulas=[{formulaName:"DATE",category:"Date",description:"Returns the date, given the year, month and day of the month."},{formulaName:"DAY",category:"Date",description:"Returns the day of a given date."},{formulaName:"TODAY",category:"Date",description:"Returns the current date as date value."},{formulaName:"DAYS",category:"Date",description:"Returns the number of days between two dates."},{formulaName:"WEEKDAY",category:"Date",description:"Returns the day of the week corresponding to a date."},{formulaName:"TIME",category:"Date & Time",description:"Converts hours, minutes, seconds to the time formatted text."},{formulaName:"EDATE",category:"Date & Time",description:"Returns a date with given number of months before or after the specified date."},{formulaName:"EOMONTH",category:"Date & Time",description:"Returns the last day of the month that is a specified number of months before or after an initially supplied start date."},{formulaName:"DATEVALUE",category:"Date & Time",description:"Converts a date string into date value."},{formulaName:"HOUR",category:"Date & Time",description:"Returns the number of hours in a specified time string."},{formulaName:"MINUTE",category:"Date & Time",description:"Returns the number of minutes in a specified time string."},{formulaName:"SECOND",category:"Date & Time",description:"Returns the number of seconds in a specified time string."},{formulaName:"NOW",category:"Date & Time",description:"Returns the current date and time."},{formulaName:"MONTH",category:"Date & Time",description:"Returns the number of months in a specified date string."}],r}Ce=function(r,t){return(Ce=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Ce(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(E,be=t),E.prototype.toSerial=function(r){var t=this.parent.getErrorStrings(),e=this.parent.getValueFromArg(r);return-1<t.indexOf(e)?e:""===(e=this.parent.isCellReference(r)?e:this.parent.removeTics(e))?t[$.CommonErrors.Value]:this.parent.isNumber(e)?this.parent.parseFloat(e):(r=this.parent.isDate(new Date(e)))?this.parent.toOADate(r):t[$.CommonErrors.Value]},E.prototype.ComputeYEAR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.toSerial(r[0]))?e:e<0?n[$.CommonErrors.Num]:this.parent.fromOADate(e).getFullYear().toString()},E.prototype.ComputeWEEKNUM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.toSerial(r[0]);if("string"==typeof n)return n;var i=1;if(2===r.length&&""!==r[1]){var o=this.resolveNumberArg(r[1]);if("string"==typeof o)return o;i=Math.floor(o)}var o=this.parent.fromOADate(n),n=new Date(o.getFullYear(),0,1),s=0,i=(2!==i&&11!==i||(s=1),(n.getDay()+7-s)%7),s=Math.floor((o.getTime()-n.getTime())/864e5),o=Math.floor((s+i)/7)+1;return o<1?e[$.CommonErrors.Num]:o.toString()},E.prototype.ComputeTIMEVALUE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s,a=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveTextArg(r[0]),-1<a.indexOf(e)?e:(s=e.trim().match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?\s*(AM|PM)?$/i))?(n=parseInt(s[1],10),i=parseInt(s[2],10),o=s[3]?parseInt(s[3],10):0,"PM"===(s=s[4]?s[4].toUpperCase():"")&&n<12&&(n+=12),23<(n="AM"===s&&12===n?0:n)||59<i||59<o?a[$.CommonErrors.Value]:((3600*n+60*i+o)/86400).toString()):(s=this.parent.isDate(new Date(e)))?((n=this.parent.toOADate(s,!0))-Math.floor(n)).toString():a[$.CommonErrors.Value])},E.prototype.ComputeDAYS360=function(){for(var r,t,e,n,i,o,s,a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];return z.isNullOrUndefined(a)||a.length<2||3<a.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(s=this.toSerial(a[0]),t=this.toSerial(a[1]),"string"==typeof s?s:"string"==typeof t?t:(r=!1,3===a.length&&""!==a[2]&&(r=(n=this.parent.getValueFromArg(a[2]).toUpperCase())===this.parent.trueValue||0!==this.parent.parseFloat(n)),n=this.parent.fromOADate(s),s=this.parent.fromOADate(t),t=n.getFullYear(),e=n.getMonth()+1,n=n.getDate(),i=s.getFullYear(),o=s.getMonth()+1,s=s.getDate(),r?(31===n&&(n=30),31===s&&(s=30)):(31===n&&(n=30),31===s&&30===n&&(s=30)),(360*(i-t)+30*(o-e)+(s-n)).toString()))},E.prototype.ComputeYEARFRAC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.toSerial(r[0]),n=this.toSerial(r[1]);if("string"==typeof e)return e;if("string"==typeof n)return n;var i=0;if(3===r.length&&""!==r[2]){var o=this.resolveNumberArg(r[2]);if("string"==typeof o)return o;i=Math.floor(o)}var s=Math.abs(n-e);switch(i){case 0:return(Math.abs(this.parent.parseFloat(this.ComputeDAYS360(r[0],r[1],"FALSE")))/360).toString();case 1:return(s/365.25).toString();case 2:return(s/360).toString();case 3:return(s/365).toString();case 4:return(Math.abs(this.parent.parseFloat(this.ComputeDAYS360(r[0],r[1],"TRUE")))/360).toString();default:return this.parent.getErrorStrings()[$.CommonErrors.Num]}},E.prototype.isWeekend=function(r){r=r.getDay();return 0===r||6===r},E.prototype.holidaySet=function(r){var t=new Set;if(r&&""!==r){var e=this.parent.getErrorStrings();if(this.parent.isCellReference(r)&&-1<r.indexOf(":"))for(var n,i=this.parent.getCellCollection(r),o=Array.isArray(i)?i:[i],s=0;s<o.length;s++)if("string"==typeof(n=this.toSerial(o[s]))){if(-1<e.indexOf(n))return n}else t.add(Math.floor(n));else{if("string"==typeof(n=this.toSerial(r)))return n;t.add(Math.floor(n))}}return t},E.prototype.ComputeNETWORKDAYS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.toSerial(r[0]),n=this.toSerial(r[1]);if("string"==typeof e)return e;if("string"==typeof n)return n;var i=this.holidaySet(r[2]);if(!(i instanceof Set))return i;for(var o=e<=n?1:-1,s=0,a=Math.floor(e);0<o?a<=Math.floor(n):a>=Math.floor(n);a+=o){var l=this.parent.fromOADate(a);this.isWeekend(l)||i.has(a)||(s+=o)}return s.toString()},E.prototype.ComputeWORKDAY=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.toSerial(r[0]),i=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;var i=Math.trunc(i),o=this.holidaySet(r[2]);if(!(o instanceof Set))return o;for(var s=Math.floor(n),a=0<=i?1:-1,l=Math.abs(i);0<l;){s+=a;var u=this.parent.fromOADate(s);if(this.isWeekend(u)||o.has(s)||l--,s<0)return e[$.CommonErrors.Num]}return s.toString()};var Ce,be,Ae=E;function E(r){r=be.call(this,r)||this;return r.formulas=[{formulaName:"YEAR",category:"Date & Time",description:"Converts a serial number to a year."},{formulaName:"WEEKNUM",category:"Date & Time",description:"Converts a serial number to a number representing where the week falls numerically within a year."},{formulaName:"TIMEVALUE",category:"Date & Time",description:"Converts a time in the form of text to a serial number."},{formulaName:"DAYS360",category:"Date & Time",description:"Calculates the number of days between two dates based on a 360-day year."},{formulaName:"YEARFRAC",category:"Date & Time",description:"Returns the year fraction representing the number of whole days between start_date and end_date."},{formulaName:"NETWORKDAYS",category:"Date & Time",description:"Returns the number of whole workdays between two dates."},{formulaName:"WORKDAY",category:"Date & Time",description:"Returns the serial number of the date before or after a specified number of workdays."}],r}Oe=function(r,t){return(Oe=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Oe(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Ve,Fe=t),Ve.prototype.ComputeIF=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(t.length&&"nestedFormulaTrue"===t[t.length-1]&&(r=!0,t.pop()),z.isNullOrUndefined(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(-1<this.parent.getErrorStrings().indexOf(t[0]))return t[0];var n,i,o=t;if(4===o.length&&"nestedFormulaTrue"===o[3]&&(n=!0,o.pop()),3<o.length||1===o.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(o.length<=3){var s=void 0,a=void 0,l="",u=this.parent.getValueFromArg(o[0]);if(-1<this.parent.getErrorStrings().indexOf(u))return u;var h=u.toUpperCase(),u=this.parent.parseFloat(u);if(h===this.parent.trueValue||u<0||0<u){if(r&&o[1].includes(":")){for(var s=this.parent.getCellCollection(o[1]),p=0;p<s.length;p++)a=this.parent.getValueFromArg(s[p]),isNaN(this.parent.parseFloat(a))||(l+=a+",");return l.slice(0,l.length-1)}i=""===o[1]?"0":this.parent.getValueFromArg(o[1],void 0,void 0,void 0,!0)}else{if(h!==this.parent.falseValue&&0!==u)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Requires3Args];if(z.isNullOrUndefined(o[2]))return this.parent.falseValue;if(r&&o[2].includes(":")){s=this.parent.getCellCollection(o[2]);for(p=0;p<s.length;p++)a=this.parent.getValueFromArg(s[p]),isNaN(this.parent.parseFloat(a))||(l+=a+",");return l.slice(0,l.length-1)}i=""===o[2]?"0":this.parent.getValueFromArg(o[2],void 0,void 0,void 0,!0)}}h=i.indexOf(this.parent.tic);return!n&&-1<h?i.split(this.parent.tic).join(""):!n||Q(i)||-1!==h||i===this.parent.trueValue||i===this.parent.falseValue||this.parent.isCellReference(i)?""===i?"0":i:'"'+i+'"'},Ve.prototype.ComputeAND=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;return z.isNullOrUndefined(r)||1===e.length&&""===e[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:this.parent.computeAndOrNot(e,"and")},Ve.prototype.ComputeOR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;return z.isNullOrUndefined(r)||1===e.length&&""===e[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:this.parent.computeAndOrNot(e,"or")},Ve.prototype.ComputeNOT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;return z.isNullOrUndefined(r)||1<r.length||""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:this.parent.computeAndOrNot(e,"not")},Ve.prototype.ComputeIFS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;if(z.isNullOrUndefined(r)||1===e.length&&""===e[0]||e.length%2!=0)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var n,i="",o=0;o<e.length;o++){if(n=this.parent.getValueFromArg(e[o]),""===e[o])return this.parent.getErrorStrings()[$.CommonErrors.NA];if(-1<this.parent.getErrorStrings().indexOf(n))return n;if(n!==this.parent.trueValue&&n!==this.parent.falseValue)return this.parent.getErrorStrings()[$.CommonErrors.Value];if(n===this.parent.trueValue)return this.parent.isCellReference(e[o+1].split(this.parent.tic).join(""))||e[o+1].includes(this.parent.arithMarker)?i=""===(i=this.parent.getValueFromArg(e[o+1]))?"0":i:-1<(i=""===e[o+1]?"0":this.parent.getValueFromArg(e[o+1])).indexOf(this.parent.tic)&&(i=i.split(this.parent.tic).join("")),o+=1,i;n===this.parent.falseValue&&(o+=1)}return this.parent.getErrorStrings()[$.CommonErrors.NA]},Ve.prototype.ComputeIFERROR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var e,n=r;if(2!==n.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(this.parent.isCellReference(n[0])){if(e=this.parent.getValueFromArg(n[0])||"0",-1===this.parent.getErrorStrings().indexOf(e)&&"NaN"!==e)return e}else if(e=this.parent.getValueFromArg(n[0],null,!0)||"0",-1===this.parent.getErrorStrings().indexOf(e)&&"NaN"!==e)return e=e.split(this.parent.tic).join("").trim();return e=this.parent.isCellReference(n[1])?this.parent.getValueFromArg(n[1])||"0":(e=this.parent.getValueFromArg(n[1])||"0").split(this.parent.tic).join("").trim()};var Oe,Fe,xe=Ve;function Ve(r){r=Fe.call(this,r)||this;return r.formulas=[{formulaName:"IF",category:"Logical",description:"Returns one value if a logical expression is TRUE and another if it is FALSE"},{formulaName:"AND",category:"Logical",description:"Returns TRUE if all the arguments are considered TRUE, and FALSE otherwise."},{formulaName:"OR",category:"Logical",description:"Returns TRUE if any arguments considered TRUE, and all the arguments are FALSE it will return FALSE."},{formulaName:"NOT",category:"Logical",description:"Returns the inverse of a given logical expression."},{formulaName:"IFS",category:"Logical",description:"Checks multiple conditions and returns a value corresponding to the first TRUE result."},{formulaName:"IFERROR",category:"Logical",description:"Returns a value you specify if a formula evaluates to an error; otherwise, it returns the result of the formula."}],r}Re=function(r,t){return(Re=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Re(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Me,Te=t),Me.prototype.ComputeTRUE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return(!r||1!==r.length||""!==r[0])&&r&&0<r.length&&(1!==r.length||""!==r[0])?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:this.parent.trueValue},Me.prototype.ComputeFALSE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return(!r||1!==r.length||""!==r[0])&&r&&0<r.length&&(1!==r.length||""!==r[0])?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:this.parent.falseValue},Me.prototype.isTruthy=function(r){var t=r.toUpperCase();return t===this.parent.trueValue||t!==this.parent.falseValue&&""!==r&&(t=this.parent.parseFloat(r),!isNaN(t))&&0!==t},Me.prototype.ComputeXOR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];for(var n=0,i=0;i<r.length;i++){var o=r[i];if(this.parent.isCellReference(o)&&-1<o.indexOf(":"))for(var s=this.parent.getCellCollection(o),a=Array.isArray(s)?s:[s],l=0;l<a.length;l++){var u=this.parent.getValueFromArg(a[l]);if(-1<e.indexOf(u))return u;this.isTruthy(u)&&n++}else{u=this.parent.getValueFromArg(o);if(-1<e.indexOf(u))return u;this.isTruthy(u)&&n++}}return n%2==1?this.parent.trueValue:this.parent.falseValue},Me.prototype.ComputeIFNA=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||2!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.parent.getValueFromArg(t[0]))===this.parent.getErrorStrings()[$.CommonErrors.NA]||"#N/A"===r?this.parent.getValueFromArg(t[1]):""===r?"0":r},Me.prototype.ComputeSWITCH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.parent.getValueFromArg(r[0]);if(-1<e.indexOf(n))return n;var i=Math.floor((r.length-1)/2),o=e[$.CommonErrors.NA];(r.length-1)%2==1&&(o=this.parent.getValueFromArg(r[r.length-1]));for(var s=0;s<i;s++){var a=1+2*s,l=1+a,a=this.parent.getValueFromArg(r[a]);if(-1<e.indexOf(a))return a;if(a===n||!isNaN(this.parent.parseFloat(a))&&this.parent.parseFloat(a)===this.parent.parseFloat(n))return""===(a=this.parent.getValueFromArg(r[l]))?"0":this.parent.removeTics(a)}return""===o?"0":this.parent.removeTics(o)};var Re,Te,Ie=Me;function Me(r){r=Te.call(this,r)||this;return r.formulas=[{formulaName:"TRUE",category:"Logical",description:"Returns the logical value TRUE."},{formulaName:"FALSE",category:"Logical",description:"Returns the logical value FALSE."},{formulaName:"XOR",category:"Logical",description:"Returns a logical exclusive OR of all arguments."},{formulaName:"IFNA",category:"Logical",description:"Returns the value you specify if the expression resolves to #N/A; otherwise returns the result of the expression."},{formulaName:"SWITCH",category:"Logical",description:"Evaluates an expression against a list of values and returns the result corresponding to the first matching value."}],r}De=function(r,t){return(De=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}De(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(S,Ue=t),S.prototype.ComputeCHOOSE=function(){for(var r=this,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(z.isNullOrUndefined(t)||""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(t.length<2)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n,i=this.parent.getErrorStrings();if(n=t[0],(n=r.parent.getValueFromArg(n)).toUpperCase()===r.parent.trueValue?n="1":n.toUpperCase()===r.parent.falseValue&&(n="0"),r=n,-1<i.indexOf(r))return r;if(this.parent.isCellReference(t[0])){if(-1<t[0].indexOf(":"))return i[$.CommonErrors.Value]}else 2===(r=this.parent.removeTics(r)).split("%").length&&this.parent.isNumber(r.split("%")[0])&&(r=(.01*Number(r.split("%")[0])).toString());return(r=Math.floor(this.parent.parseFloat(r)))<1||isNaN(r)||z.isNullOrUndefined(t[r])?i[$.CommonErrors.Value]:this.parent.isCellReference(r=""===(r=t[r])?"0":r)?-1<r.indexOf(":")?i[$.CommonErrors.Value]:this.parent.getValueFromArg(r):(-1<r.indexOf(this.parent.tic)&&(-1<i.indexOf(r.split(this.parent.tic).join(""))||this.parent.removeTics(r).match(/^(\d*\.\d+|\d+)\s*[-*/]\s*(\d*\.\d+|\d+)$/))&&(r=this.parent.removeTics(r)),-1<(r=this.parent.removeTics(this.parent.getValueFromArg(r))).indexOf(this.parent.tic+this.parent.tic)?r.replace(/""/g,this.parent.tic):2===r.split("%").length&&this.parent.isNumber(r.split("%")[0])?(.01*Number(r.split("%")[0])).toString():r)},S.prototype.ComputeINDEX=function(){for(var r,e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i,o,s=this.parent.getErrorStrings();if(t.length&&"nestedFormulaTrue"===t[t.length-1]&&(r=!0,t.pop()),z.isNullOrUndefined(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(t.length<2||4<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===t[0]||""===t[3]||t[3]&&("0"===t[3]||"FALSE"===t[3]))return s[$.CommonErrors.Value];function a(r){if(z.isNullOrUndefined(r)||""===r)return 1;var t=e.parent.getValueFromArg(r);if(!(-1<s.indexOf(t))){if(t.toUpperCase()===e.parent.trueValue?t="1":t.toUpperCase()===e.parent.falseValue&&(t="0"),-1<t.indexOf(e.parent.tic)&&(t=e.parent.removeTics(t),-1===r.indexOf(e.parent.tic)||""===t.trim()))return s[$.CommonErrors.Value];if(2===t.split("%").length&&e.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString()),t=parseInt(Number(t).toString(),10),isNaN(t)||t<0)return s[$.CommonErrors.Value];0===t&&(t=1)}return t}if(t[3]&&(o=a(t[3]),-1<s.indexOf(o.toString())))return o.toString();t[0].startsWith(this.parent.tic)&&t[0].endsWith(this.parent.tic)&&(t[0]=t[0].substring(1,t[0].length-1));var l=t[0].split(this.parent.getParseArgumentSeparator());if(t[0]=l[o?o-1:0],!t[0])return s[$.CommonErrors.Ref];if(l=t[0],o=a(t[1]),-1<s.indexOf(o.toString()))return o.toString();if(i=a(t[2]),-1<s.indexOf(i.toString()))return i.toString();var u=l.indexOf(":");if(-1===u){if(1<o||1<i)return s[$.CommonErrors.Ref];l=this.parent.isCellReference(l)?this.parent.getValueFromArg(l):l}else{var h=this.parent.rowIndex(l.substring(0,u)),p=this.parent.rowIndex(l.substring(u+1)),g=this.parent.colIndex(l.substring(0,u)),u=this.parent.colIndex(l.substring(u+1));if(p-h+1<o||u-g+1<i)return s[$.CommonErrors.Ref];o=h+o-1,i=g+i-1,l=this.parent.getValueFromArg(this.getSheetReference(l)+this.parent.convertAlpha(i)+o)}return""===l?0:r&&-1===s.indexOf(l)&&!this.parent.isNumber(l)&&l!==this.parent.trueValue&&l!==this.parent.falseValue?this.parent.tic+l+this.parent.tic:l},S.prototype.ComputeMATCH=function(){for(var t=this,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var n=r.slice(),i=this.parent.getErrorStrings();if(z.isNullOrUndefined(n)||1===n.length&&""===n[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(n.length<2||3<n.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];n[0]=this.parent.getValueFromArg(r[0]);var o,s=-1<n[0].indexOf(this.parent.tic);if(n[0]=n[0].split(this.parent.tic).join(""),-1<i.indexOf(n[0]))return n[0];if(""===n[0])return i[$.CommonErrors.NA];if(isNaN(Number(n[0]))&&(s=!0),z.isNullOrUndefined(r[2]))n[2]="1";else{if(n[2]=this.parent.getValueFromArg(n[2]),-1<n[2].indexOf(this.parent.tic)&&isNaN(Number(n[2].split(this.parent.tic).join(""))))return i[$.CommonErrors.Value];n[2].toUpperCase()===this.parent.trueValue?n[2]="1":n[2].toUpperCase()===this.parent.falseValue&&(n[2]="0")}o=parseFloat(n[2]),-1===[-1,0,1].indexOf(o)&&(o=0);var a,l=[],u=!1,h=this.parent.grid,p=this.parent.grid;if(-1<n[1].indexOf(":")||this.parent.isCellReference(n[1])){var g=M(n[1]),f=g[0],m=g[1],c=g[2],d=g[3];if(1048576<=f||1048576<=c||16384<=m||16384<=d)return i[$.CommonErrors.Name];if(f!==c&&m!==d)return i[$.CommonErrors.NA];for(var N,v,g="",E=this.parent.getSheetFamilyItem(h),E=(n[1].startsWith("!")?(g=n[1].substring(0,n[1].replace("!","").indexOf("!")+2),null!==E.tokenToParentObject&&(h=E.tokenToParentObject.get(g))):null!==E.parentObjectToToken&&(g=E.parentObjectToToken.get(h)),this.parent.getSheetId(h)),S=this.parent.getCellValueFn(h,this.parent.cell,E,!0),y=0,C=void 0,C=0===o?(a=-1<n[0].indexOf("*")||-1<n[0].indexOf("?"),function(){a&&(N=t.parent.findWildCardValue(n[0],N)),n[0]===N?(c=d=-2,v=y+1):y++}):function(){l[y]=N,y++},b=f;b<=c;b++)for(var A=m;A<=d;A++)N=S(b+1,A+1,Br(b,A)),!u&&isNaN(Number(N))&&(u=!0),C();if(v)return this.parent.grid=p,v;if(s!==u)return this.parent.grid=p,i[$.CommonErrors.NA]}else!z.isNullOrUndefined(n[1])&&n[1].includes(this.parent.tic+this.parent.tic)&&n[1].split(this.parent.tic+this.parent.tic).forEach(function(r){(r=r.trim().split(t.parent.tic).join(""))&&l.push(r)});for(var O=0,F="",x=!1,V=isNaN(Number(n[0]))?n[0]:Number(n[0]),R=0;R<l.length;R++)if(""===l[R])R===l.length-1&&l.pop();else{if(-1===o&&(s||u))break;var T=isNaN(Number(l[R]))?l[R]:Number(l[R]);if(1===o)V===T?(O=R+1,x=!0,isNaN(Number(n[0]))&&(s=!1)):T<V&&!s&&!x&&(!F||T>(isNaN(Number(F))?F:Number(F)))&&(O=R+1,F=l[R]);else if(0===o){if(a&&(l[R]=this.parent.findWildCardValue(n[0],l[R])),n[0]===l[R])return R+1}else if(-1===o){if(!(Number(l[R])>Number(l[R+1])||R===l.length-1))return this.parent.grid=p,i[$.CommonErrors.NA];V===T?(O=R+1,V=void 0):V<T&&(!F||T<(isNaN(Number(F))?F:Number(F)))&&(O=R+1,F=l[R])}}return s&&u&&1===o&&(O=l.length),this.parent.grid=p,O||i[$.CommonErrors.NA]},S.prototype.ComputeLOOKUP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;return z.isNullOrUndefined(e)||1===e.length&&""===e[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:this.parent.computeLookup(e)},S.prototype.ComputeVLOOKUP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.parent.computeVHLookup(r,!0)},S.prototype.ComputeHLOOKUP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.parent.computeVHLookup(r)},S.prototype.ComputeADDRESS=function(){for(var r,e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this.parent.getErrorStrings();if(z.isNullOrUndefined(t)||1===t.length&&""===t[0].trim())return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(t.length<2||5<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===t[0].split(this.parent.tic).join("").trim()||""===t[1].split(this.parent.tic).join("").trim())return i[$.CommonErrors.Value];function o(r){var t=e.parent.getValueFromArg(r).trim();if(!(-1<i.indexOf(t))){if(t.toUpperCase()===e.parent.trueValue?t="1":t.toUpperCase()===e.parent.falseValue&&(t="0"),e.parent.isCellReference(r)&&-1<t.indexOf(e.parent.tic))return i[$.CommonErrors.Value];2===(t=e.parent.removeTics(t)).split("%").length&&e.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString())}return t}var s=o(t[0]);if(-1<i.indexOf(s))return s;if(s=Number(s),isNaN(s)||s<1)return i[$.CommonErrors.Value];var a,l,u,s=s.toString(),h=o(t[1]);if(-1<i.indexOf(h))return h;if(h=Number(h),isNaN(h)||h<1)return i[$.CommonErrors.Value];if(h=h.toString(),z.isNullOrUndefined(t[2])||""===t[2].trim())a="1";else{if(a=o(t[2]),-1<i.indexOf(a))return a;if(a=Number(a),isNaN(a)||a<1||4<a)return i[$.CommonErrors.Value];a=a.toString()}if(z.isNullOrUndefined(t[3])||""===t[3].trim())l="1";else{if(l=o(t[3]),-1<i.indexOf(l))return l;l.toUpperCase()===this.parent.trueValue||1<Number(l)?l="1":""!==l&&l.toUpperCase()!==this.parent.falseValue||(l="0")}if("1"===l)"1"===a?r="$"+J(parseInt(h,10))+"$"+parseInt(s,10):"2"===a?r=J(parseInt(h,10))+"$"+parseInt(s,10):"3"===a?r="$"+J(parseInt(h,10))+parseInt(s,10):"4"===a&&(r=J(parseInt(h,10))+parseInt(s,10));else{if("0"!==l)return i[$.CommonErrors.Name];"1"===a?r="R"+parseInt(s,10)+"C"+parseInt(h,10):"2"===a?r="R"+parseInt(s,10)+"C["+parseInt(h,10)+"]":"3"===a?r="R["+parseInt(s,10)+"]C"+parseInt(h,10):"4"===a&&(r="R["+parseInt(s,10)+"]C["+parseInt(h,10)+"]")}return!z.isNullOrUndefined(t[4])&&""!==t[4]&&(u=this.parent.getValueFromArg(t[4]).split(this.parent.tic).join(""),-1<i.indexOf(u))?u:z.isNullOrUndefined(u)?r:u+"!"+r},S.prototype.ComputeSUBTOTAL=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=this.parent.getErrorStrings();if(z.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(e.length<2)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(t=this.parent.getValueFromArg(e[0]).trim(),!(-1<i.indexOf(t))){if(""===t.split(this.parent.tic).join("").trim())return i[$.CommonErrors.Value];if((t=this.parent.isCellReference(e[0])?t:this.parent.removeTics(t)).toUpperCase()===this.parent.trueValue?t="1":t.toUpperCase()===this.parent.falseValue?t="0":2===t.split("%").length&&this.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString()),t=this.parent.parseFloat(t),isNaN(t)||(t<1||11<t)&&(t<101||111<t))return i[$.CommonErrors.Value];var o=e.slice(1,e.length);switch(t){case 1:case 101:t=(r=this.owner).ComputeAVERAGE.apply(r,o.concat(["isSubtotal"]));break;case 2:case 102:t=(r=this.owner).ComputeCOUNT.apply(r,o.concat(["isSubtotal"]));break;case 3:case 103:t=(r=this.owner).ComputeCOUNTA.apply(r,o.concat(["isSubtotal"]));break;case 4:case 104:t=(r=this.owner).ComputeMAX.apply(r,o.concat(["isSubtotal"]));break;case 5:case 105:t=(r=this.owner).ComputeMIN.apply(r,o.concat(["isSubtotal"]));break;case 6:case 106:t=(r=this.owner).ComputePRODUCT.apply(r,o.concat(["isSubtotal"]));break;case 7:case 107:t=(r=this.owner).ComputeDAY.apply(r,o);break;case 8:case 108:t=(r=this.owner).ComputeCONCAT.apply(r,o);break;case 9:case 109:t=(r=this.owner).ComputeSUM.apply(r,o.concat(["isSubtotal"]));break;case 10:case 110:t=(r=this.owner).ComputeAVERAGEA.apply(r,o);break;case 11:case 111:t=(r=this.owner).ComputeABS.apply(r,o);break;default:t=i[$.CommonErrors.Value]}}return t},S.prototype.ComputeTEXT=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t.length&&"nestedFormulaTrue"===t[t.length-1]&&(r=!0,t.pop());var n=t[1];if(2!==t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var i=t[0],o=n;if(""===n)return this.parent.getValueFromArg(i);var s=new Date(1900,0,1,0,0,0),a=i+","+o,l=new z.Internationalization;if(-1<this.parent.getErrorStrings().indexOf(a))return a;if(Q((i=this.parent.getValueFromArg(i)).split(this.parent.tic).join(""))&&(i=i.split(this.parent.tic).join("")),""===(o=n.startsWith('"')&&n.endsWith('"')?o.split(this.parent.tic).join(""):this.parent.getValueFromArg(o)))return"";""===i&&(0<o.length&&(-1<o.toUpperCase().indexOf("M")||-1<o.toUpperCase().indexOf("D")||-1<o.toUpperCase().indexOf("Y")||-1<o.toUpperCase().indexOf("S")||-1<o.toUpperCase().indexOf("T"))||-1<o.toUpperCase().indexOf("H"))&&(i=s.toString());a=this.parseDouble(i);if(isNaN(a)&&null!==this.parent.isDate(new Date(i))&&(a=this.parent.toOADate(new Date(i))),s=Date.parse(i.split(this.parent.tic).join("")),!isNaN(a)||!isNaN(s))if(0<o.length&&-1===o.indexOf("#")&&(-1<o.toUpperCase().indexOf("M")||-1<o.toUpperCase().indexOf("D")||-1<o.toUpperCase().indexOf("Y")||-1<o.toUpperCase().indexOf("S")||-1<o.toUpperCase().indexOf("T"))||-1<o.toUpperCase().indexOf("H")){for(var u=(o=(o=o.split("Y").join("y").split("D").join("d").split("H").join("h")).split("S").join("s").split("m").join("M").split("AM/PM").join("tt")).split(""),h=!1,p=!1,g=0,f=0,g=0;g<u.length;){var m=u[g];"s"===m&&"M"===u[f]&&(u[f]="m","M"===u[f-1])&&(u[f-1]="m"),this.parent.isChar(m)&&(f=g),"M"===m&&h&&(u[g]="m",p=!0),"h"===m?h=!0:this.parent.isChar(m)&&"M"!==m&&"h"!==m&&!p&&(p=h=!1),g++}o=(o=String(u)).split(",").join("").split("\n").join(" ");var c,n=this.parent.fromOADate(a),s=(0===a&&(n=s),I(o));if(""===s)return c=L(n),this.parent.parentObject.getDisplayText({format:o,value:c});i=l.getDateFormat({skeleton:s,type:"date"})(n)}else i=this.parent.parentObject.getDisplayText({format:o,value:a});return r?this.parent.tic+i+this.parent.tic:i};var De,Ue,we=S;function S(r){r=Ue.call(this,r)||this;return r.formulas=[{formulaName:"CHOOSE",category:"Lookup & Reference",description:"Returns a value from a list, given an index number."},{formulaName:"INDEX",category:"Lookup & Reference",description:"Returns a value from a table, given a row and column number."},{formulaName:"MATCH",category:"Lookup & Reference",description:"Returns the relative position of an checked item in range that matches a specified value in a specified order"},{formulaName:"LOOKUP",category:"Lookup & Reference",description:"Looks for a value in a one-row or one-column range, then returns a value from the same position in a second one-row or one-column range."},{formulaName:"VLOOKUP",category:"Lookup & Reference",description:"Looks for a specific value in the first column of a lookup range and returns a corresponding value from a different column within the same row."},{formulaName:"HLOOKUP",category:"Lookup & Reference",description:"Looks for a value in the top row of the array of values and then returns a value in the same column from a row in the array that you specify."},{formulaName:"ADDRESS",category:"Lookup & Reference",description:"Returns a cell reference as text, given specified row and column numbers."},{formulaName:"SUBTOTAL",category:"Lookup & Reference",description:"Returns a subtotal in a list or database."},{formulaName:"TEXT",category:"Lookup & Reference",description:"Converts a value to text in specified number format."}],r}je=function(r,t){return(je=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}je(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Pe,Le=t),Pe.prototype.ComputeROW=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1===t.length&&""===t[0]?(r=-1<(r=this.parent.actCell||this.parent.cell||"A1").indexOf("!")?r.substring(r.lastIndexOf("!")+1):r,this.parent.rowIndex(r).toString()):1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=t[0].split("$").join(""),this.parent.isCellReference(r.split(":")[0])?(r=-1<(r=-1<r.indexOf(":")?r.split(":")[0]:r).indexOf("!")?r.substring(r.lastIndexOf("!")+1):r,this.parent.rowIndex(r).toString()):this.parent.getErrorStrings()[$.CommonErrors.Value])},Pe.prototype.ComputeCOLUMN=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1===t.length&&""===t[0]?(r=-1<(r=this.parent.actCell||this.parent.cell||"A1").indexOf("!")?r.substring(r.lastIndexOf("!")+1):r,this.parent.colIndex(r).toString()):1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=t[0].split("$").join(""),this.parent.isCellReference(r.split(":")[0])?(r=-1<(r=-1<r.indexOf(":")?r.split(":")[0]:r).indexOf("!")?r.substring(r.lastIndexOf("!")+1):r,this.parent.colIndex(r).toString()):this.parent.getErrorStrings()[$.CommonErrors.Value])},Pe.prototype.ComputeROWS=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length||""===e[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:-1===(t=e[0].split("$").join("")).indexOf(":")?this.parent.isCellReference(t)?"1":this.parent.getErrorStrings()[$.CommonErrors.Value]:(r=-1<(t=t.split(":"))[0].indexOf("!")?t[0].substring(t[0].lastIndexOf("!")+1):t[0],t=-1<t[1].indexOf("!")?t[1].substring(t[1].lastIndexOf("!")+1):t[1],(Math.abs(this.parent.rowIndex(t)-this.parent.rowIndex(r))+1).toString())},Pe.prototype.ComputeCOLUMNS=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length||""===e[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:-1===(t=e[0].split("$").join("")).indexOf(":")?this.parent.isCellReference(t)?"1":this.parent.getErrorStrings()[$.CommonErrors.Value]:(r=-1<(t=t.split(":"))[0].indexOf("!")?t[0].substring(t[0].lastIndexOf("!")+1):t[0],t=-1<t[1].indexOf("!")?t[1].substring(t[1].lastIndexOf("!")+1):t[1],(Math.abs(this.parent.colIndex(t)-this.parent.colIndex(r))+1).toString())},Pe.prototype.ComputeHYPERLINK=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<1||2<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveTextArg(r[0]),!(-1<i.indexOf(e))&&2===r.length?(n=this.resolveTextArg(r[1]),i.indexOf(n),n):e)},Pe.prototype.ComputeOFFSET=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=r[0].split("$").join("");if(!this.parent.isCellReference(n.split(":")[0]))return e[$.CommonErrors.Value];var i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof i)return i;if("string"==typeof o)return o;var s=1,a=1;if(4<=r.length&&""!==r[3]){var l=this.resolveNumberArg(r[3]);if("string"==typeof l)return l;s=Math.floor(l)}if(5===r.length&&""!==r[4]){var l=this.resolveNumberArg(r[4]);if("string"==typeof l)return l;a=Math.floor(l)}return s<1||a<1||(n=-1<(l=-1<n.indexOf(":")?n.split(":")[0]:n).indexOf("!")?l.substring(0,l.lastIndexOf("!")+1):"",l=-1<l.indexOf("!")?l.substring(l.lastIndexOf("!")+1):l,i=this.parent.rowIndex(l)+Math.floor(i),l=this.parent.colIndex(l)+Math.floor(o),i<1)||l<1?e[$.CommonErrors.Ref]:(o=n+J(l)+i,1===s&&1===a?this.parent.getValueFromArg(o):this.parent.getValueFromArg(o)||o)};var je,Le,ke=Pe;function Pe(r){r=Le.call(this,r)||this;return r.formulas=[{formulaName:"ROW",category:"Lookup & Reference",description:"Returns the row number of a reference."},{formulaName:"ROWS",category:"Lookup & Reference",description:"Returns the number of rows in a reference."},{formulaName:"COLUMN",category:"Lookup & Reference",description:"Returns the column number of a reference."},{formulaName:"COLUMNS",category:"Lookup & Reference",description:"Returns the number of columns in a reference."},{formulaName:"HYPERLINK",category:"Lookup & Reference",description:"Creates a shortcut that opens a document on a network server, intranet, or Internet."},{formulaName:"OFFSET",category:"Lookup & Reference",description:"Returns a reference offset from a given reference."}],r}_e=function(r,t){return(_e=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}_e(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Be,We=t),Be.prototype.ComputeINDIRECT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]);if(-1<e.indexOf(n))return n;var n=n.split("$").join(""),i=!0;if(2===r.length){var o=this.resolveNumberArg(r[1]);if("string"==typeof o)return o;i=0!==o}if(!i)return e[$.CommonErrors.Value];if(!this.parent.isCellReference(n.split(":")[0]))return e[$.CommonErrors.Ref];if(-1<n.indexOf(":")){for(var o=this.parent.getCellCollection(n),s=Array.isArray(o)?o:[o],a=[],l=0;l<s.length;l++){var u=this.parent.getValueFromArg(s[l]);if(-1<e.indexOf(u))return u;a.push(u)}return a.join(this.parent.getParseArgumentSeparator())}return this.parent.getValueFromArg(n)},Be.prototype.ComputeAREAS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=r[0].split("$").join(""),this.parent.isCellReference(e.split(":")[0])||-1!==e.indexOf("(")?-1<e.indexOf(",")?e.split(",").length.toString():"1":n[$.CommonErrors.Value])},Be.prototype.ComputeFORMULATEXT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(n=r[0].split("$").join(""),this.parent.isCellReference(n)?(o=-1<n.indexOf("!")?n.substring(0,n.lastIndexOf("!")+1):"",e=-1<n.indexOf("!")?n.substring(n.lastIndexOf("!")+1):n,e="!"+this.parent.getSheetID(this.parent.grid)+"!"+e,n=o?n:e,(i=this.parent.getFormulaInfoTable()).has(o=o?n:e)?i.get(o).getFormulaText():s[$.CommonErrors.NA]):s[$.CommonErrors.Value])},Be.prototype.ComputeISREF=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=t[0].split("$").join(""),this.parent.isCellReference(r.split(":")[0]))};var _e,We,qe=Be;function Be(r){r=We.call(this,r)||this;return r.formulas=[{formulaName:"INDIRECT",category:"Lookup & Reference",description:"Returns a reference indicated by a text value."},{formulaName:"AREAS",category:"Lookup & Reference",description:"Returns the number of areas in a reference."},{formulaName:"FORMULATEXT",category:"Lookup & Reference",description:"Returns the formula in a cell as text."},{formulaName:"ISREF",category:"Information",description:"Returns TRUE if the value is a reference."}],r}Xe=function(r,t){return(Xe=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Xe(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(y,Ye=t),y.prototype.flattenValues=function(r){var t=this.parent.getErrorStrings();if(this.parent.isCellReference(r)&&-1<r.indexOf(":")){for(var e=this.parent.getCellCollection(r),n=Array.isArray(e)?e:[e],i=[],o=0;o<n.length;o++){var s=this.parent.getValueFromArg(n[o]);if(-1<t.indexOf(s))return s;i.push(s)}return i}e=this.parent.isCellReference(r)?this.parent.getValueFromArg(r):this.resolveTextArg(r);return-1<t.indexOf(e)?e:[e]},y.prototype.valuesEqual=function(r,t){return r===t||(r=this.parent.parseFloat(r),t=this.parent.parseFloat(t),!isNaN(r)&&!isNaN(t)&&r===t)},y.prototype.ComputeXLOOKUP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||6<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.parent.getValueFromArg(r[0]);if(-1<e.indexOf(n))return n;var i=this.parent.removeTics(n),o=this.flattenValues(r[1]);if("string"==typeof o)return o;n=this.flattenValues(r[2]);if("string"==typeof n)return n;if(o.length!==n.length)return e[$.CommonErrors.Value];var s=null;if(4<=r.length&&""!==r[3]&&(s=this.parent.getValueFromArg(r[3]),-1<e.indexOf(s)))return s;var a=0;if(5<=r.length&&""!==r[4]){var l=this.resolveNumberArg(r[4]);if("string"==typeof l)return l;a=Math.floor(l)}for(var u=-1,h=0;h<o.length;h++){var p=o[h];if(this.valuesEqual(p,i)||p.toLowerCase()===i.toLowerCase()){u=h;break}if(0!==a&&-1<p.toLowerCase().indexOf(i.toLowerCase())){u=h;break}}return u<0?null!==s?this.parent.removeTics(s):e[$.CommonErrors.NA]:""===(l=n[u])?"0":l},y.prototype.ComputeXMATCH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.parent.getValueFromArg(r[0]);if(-1<e.indexOf(n))return n;var i=this.flattenValues(r[1]);if("string"==typeof i)return i;for(var o=0;o<i.length;o++)if(this.valuesEqual(i[o],n)||i[o].toLowerCase()===this.parent.removeTics(n).toLowerCase())return(o+1).toString();return e[$.CommonErrors.NA]},y.prototype.ComputeTEXTSPLIT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<2||6<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveTextArg(r[0]),n=this.resolveTextArg(r[1]),-1<i.indexOf(e)?e:-1<i.indexOf(n)?n:""===n?e:void 0!==(i=e.split(n))[0]?i[0]:"")},y.prototype.ComputeTOCOL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.flattenJoin(r,!0)},y.prototype.ComputeTOROW=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.flattenJoin(r,!1)},y.prototype.flattenJoin=function(r,t){var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.flattenValues(r[0]);if("string"==typeof n)return n;var i=0;if(2<=r.length&&""!==r[1]){r=this.resolveNumberArg(r[1]);if("string"==typeof r)return r;i=Math.floor(r)}for(var o=[],s=0;s<n.length;s++){var a=n[s];(1===i||3===i)&&""===a||(2===i||3===i)&&-1<e.indexOf(a)||o.push(a)}return 0===o.length?e[$.CommonErrors.Calc]||"#CALC!":o[0]},y.prototype.ComputeCHOOSECOLS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.chooseAxis(r,!1)},y.prototype.ComputeCHOOSEROWS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.chooseAxis(r,!0)},y.prototype.chooseAxis=function(r,t){var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=r[0].split("$").join("");if(!this.parent.isCellReference(n.split(":")[0]))return e[$.CommonErrors.Value];for(var i=[],o=1;o<r.length;o++){var s=this.resolveNumberArg(r[o]);if("string"==typeof s)return s;i.push(Math.floor(s))}var a=-1<n.indexOf(":")?n.split(":")[0]:n,n=-1<n.indexOf(":")?n.split(":")[1]:n,l=-1<a.indexOf("!")?a.substring(0,a.lastIndexOf("!")+1):"",a=-1<a.indexOf("!")?a.substring(a.lastIndexOf("!")+1):a,n=-1<n.indexOf("!")?n.substring(n.lastIndexOf("!")+1):n,u=this.parent.rowIndex(a),a=this.parent.colIndex(a),h=this.parent.rowIndex(n),n=this.parent.colIndex(n),p=Math.abs(h-u)+1,g=Math.abs(n-a)+1,f=i[0];return 0===f?e[$.CommonErrors.Value]:t?(t=0<f?f:p+f+1)<1||p<t?e[$.CommonErrors.Value]:(p=Math.min(u,h)+t-1,this.parent.getValueFromArg(l+J(Math.min(a,n))+p)):(t=0<f?f:g+f+1)<1||g<t?e[$.CommonErrors.Value]:(p=Math.min(a,n)+t-1,this.parent.getValueFromArg(l+J(p)+Math.min(u,h)))};var Xe,Ye,He=y;function y(r){r=Ye.call(this,r)||this;return r.formulas=[{formulaName:"XLOOKUP",category:"Lookup & Reference",description:"Searches a range for a match and returns the corresponding item."},{formulaName:"XMATCH",category:"Lookup & Reference",description:"Returns the relative position of an item in an array."},{formulaName:"TEXTSPLIT",category:"Text",description:"Splits text strings by using column and row delimiters."},{formulaName:"TOCOL",category:"Lookup & Reference",description:"Returns the array in a single column."},{formulaName:"TOROW",category:"Lookup & Reference",description:"Returns the array in a single row."},{formulaName:"CHOOSECOLS",category:"Lookup & Reference",description:"Returns the specified columns from an array."},{formulaName:"CHOOSEROWS",category:"Lookup & Reference",description:"Returns the specified rows from an array."}],r}function Ge(r){var n="Descending"===r;return function(r,t){var e;return r===t?0:null==r?1:null==t?-1:(e=0,"string"==typeof r?e=r.localeCompare(t):t<r?e=1:r<t&&(e=-1),n?-e:e)}}function Ze(r,t){t=Ge(t);return r.slice().sort(t)}Ke=function(r,t){return(Ke=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Ke(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Qe,$e=t),Qe.prototype.ComputeUNIQUE=function(){for(var r,e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this.parent.getErrorStrings();if("isComputeExp"===t[t.length-1]&&(r=!0,t.pop()),z.isNullOrUndefined(t)||""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(3<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];function w(r){var t;return z.isNullOrUndefined(r)?e.parent.falseValue:(t=e.parent.getValueFromArg(r),-1<i.indexOf(t)?t:0===Number(t)?e.parent.falseValue:Number(t)<0||0<Number(t)?e.parent.trueValue:(t=e.parent.isCellReference(r)?t:e.parent.removeTics(t)).toUpperCase()===e.parent.trueValue||t.toUpperCase()===e.parent.falseValue?t.toUpperCase():-1<t.indexOf(e.parent.tic)||-1<r.indexOf(e.parent.tic)?i[$.CommonErrors.Value]:i[$.CommonErrors.Name])}var o=w(t[1]);if(-1<i.indexOf(o))return o;var s=w(t[2]);if(-1<i.indexOf(s))return s;var a=[];if(-1<t[0].indexOf(":")){z.isNullOrUndefined(t[0].match(/[0-9]/))?(l=t[0].split(":"),t[0]=l[0]+"1:"+l[1]+(this.parent.spreadSheetUsedRange[0]+1)):z.isNullOrUndefined(t[0].toUpperCase().match(/[A-Z]/))&&(l=t[0].split(":"),t[0]="A"+l[0]+":"+J(this.parent.spreadSheetUsedRange[1]+1)+l[1]);var l=t[0].split(":");if(this.parent.isCellReference(l[0])&&this.parent.isCellReference(l[1])){for(var u=this.parent.dependencyCollection,h=0;h<u.length&&!r;h++)u[h].split(":")[0]===t[0].split(":")[0]&&this.clearDependency(u[h]);-1===this.parent.dependencyCollection.indexOf(t[0])?r||this.parent.dependencyCollection.push(t[0]):this.clearDependency(t[0]);var p,l=t[0].indexOf(":"),g=void 0,f=this.parent.rowIndex(this.parent.substring(t[0],0,l)),m=this.parent.colIndex(this.parent.substring(t[0],0,l)),c=this.parent.rowIndex(this.parent.substring(t[0],l+1,l+t[0].length-l-1)),l=this.parent.colIndex(this.parent.substring(t[0],l+1,l+t[0].length-l-1)),g=(c<f&&(g=c,c=f,f=g),l<m&&(g=l,l=m,m=g),""),d=(0===t[0].indexOf("!")&&(g=t[0].substring(0,t[0].replace("!","").indexOf("!")+2)),t[0]=g+J(m)+f+":"+J(l)+c,l-m),N=this.parent.getCellCollection(t[0]),v=void 0,v=p=this.parent.actCell;if(o===this.parent.falseValue)if(0==d)for(h=0;h<N.length;h++){var E=this.parent.getValueFromArg(N[h]);a.push(E=""===E?"0":E)}else for(var S="",y=d,h=0;h<N.length;h++)h===N.length-1&&(E=this.parent.getValueFromArg(N[h]),a.push((S=S+(E=""===E?"0":E)+"++").substring(0,S.length-2))),S=h<=y?S+(E=""===(E=this.parent.getValueFromArg(N[h]))?"0":E)+"++":(a.push(S.substring(0,S.length-2)),y=d+h,(E=""===(E=this.parent.getValueFromArg(N[h]))?"0":E)+"++");else for(var S="",y=1+d,j=c-f,h=0;h<y;h++){for(var C=0;C<=j;C++)S=S+(E=""===(E=this.parent.getValueFromArg(N[C*y+h]))?"0":E)+"++";a.push(S.substring(0,S.length-2)),S=""}for(var b,L=[],A=[],O=[],k=[],h=0;h<a.length;h++)(-1===L.indexOf(a[h].toLowerCase())?(L.push(a[h].toLowerCase()),O):(-1===A.indexOf(a[h].toLowerCase())&&A.push(a[h].toLowerCase()),k)).push(a[h]);if(s===this.parent.trueValue){for(var P=[],h=0;h<O.length;h++)-1===A.indexOf(O[h].toLowerCase())&&P.push(O[h]);if(0===(O=P).length)return i[$.CommonErrors.Calc]}if(r)return 0!=d?(b=[],O.forEach(function(r){b=b.concat(r.split("++"))})):b=o===this.parent.falseValue?O:O[0].split("++"),b;-1<v.indexOf("!")&&(v=v.substring(v.lastIndexOf("!")+1));var F=this.parent.rowIndex(v),x=this.parent.colIndex(v);if(0===this.parent.dependencyLevel){var V=!1;if(o===this.parent.falseValue)for(h=F,y=O.length+F;h<y;h++)for(var R=x,T=(M=O[0].split("++")).length+x;R<T;R++)h===y-1&&R===T-1&&-1===this.parent.uniqueRange.indexOf(p+":"+J(R)+h)&&this.parent.uniqueRange.push(p+":"+J(R)+h),this.checkSpill(R,h)&&(V=!0);else for(h=x,y=O.length+x;h<y;h++)for(var I=F,T=(M=O[0].split("++")).length+F;I<T;I++)h===y-1&&I===T-1&&-1===this.parent.uniqueRange.indexOf(this.parent.actCell+":"+J(h)+I)&&this.parent.uniqueRange.push(this.parent.actCell+":"+J(h)+I),this.checkSpill(h,I)&&(V=!0);if(V)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Spill]}else if(0<this.parent.dependencyLevel&&-1<this.parent.getValueFromArg(J(x)+F,!0).indexOf("#SPILL!"))return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Spill];if(o===this.parent.falseValue){var g=this.parent.getSheetFamilyItem(this.parent.grid),_="",W=void 0;null!==g.sheetNameToParentObject&&0<g.sheetNameToParentObject.size&&(W=(_=g.parentObjectToToken.get(this.parent.grid))+v);for(h=0;h<O.length;h++){var M=O[h].split("++");0<h&&(F++,x=this.parent.colIndex(v));for(var D=0;D<M.length;D++)this.setValueRefresh(M[D],F,x),(0<h||0<D)&&this.parent.refreshDependentCells(_+J(x)+F.toString(),W),M[D+1]&&x++}}else for(h=0;h<O.length;h++)for(var M=O[h].split("++"),U=0;U<M.length;U++)this.setValueRefresh(M[U],F,x),M[U+1]?F++:(x++,F=this.parent.rowIndex(v));m=O[0].split("++")[0]}}else if(this.parent.isCellReference(t[0]))-1===this.parent.dependencyCollection.indexOf(t[0])?r||this.parent.dependencyCollection.push(t[0]):this.clearDependency(t[0]),m=this.parent.getValueFromArg(t[0]);else{if(m=this.parent.getValueFromArg(t[0].trim()),-1<i.indexOf(m))return m;m=this.parent.removeTics(m)}return m},Qe.prototype.setValueRefresh=function(r,t,e){this.parent.parentObject.setValueRowCol(this.parent.getSheetId(this.parent.grid),r,t,e)},Qe.prototype.checkSpill=function(r,t){var e,n=!1,i=this.parent.getValueFromArg(J(r)+t,!0),r="!"+this.parent.getSheetID(this.parent.grid)+"!"+J(r)+t;return this.parent.getFormulaInfoTable().get(r)&&(e=this.parent.getFormulaInfoTable().get(r).formulaText),n=i&&(i.toUpperCase().indexOf("UNIQUE")<0||e&&!e.toUpperCase().includes("UNIQUE"))&&(i.toUpperCase().indexOf("SORT")<0||e&&!e.toUpperCase().includes("SORT"))&&i!==this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]?!0:n},Qe.prototype.clearDependency=function(r){for(var t=this.parent.actCell,e="",n=(-1<t.lastIndexOf("!")&&(t=(o=t).substring(o.lastIndexOf("!")+1),e=o.substring(0,o.lastIndexOf("!"))+"!"),this.parent.rowIndex(t)),i=this.parent.colIndex(t),o=r.indexOf(":"),s=this.parent.rowIndex(this.parent.substring(r,0,o)),a=this.parent.colIndex(this.parent.substring(r,0,o)),l=this.parent.rowIndex(this.parent.substring(r,o+1,o+r.length-o-1))-s+n,u=this.parent.colIndex(this.parent.substring(r,o+1,o+r.length-o-1))-a+i,h=this.parent.getFormulaInfoTable().get("!"+this.parent.getSheetID(this.parent.grid)+"!"+t)?this.parent.getFormulaInfoTable().get("!"+this.parent.getSheetID(this.parent.grid)+"!"+t).getFormulaText():"",p=n;p<=l;p++)for(var g=i;g<=u;g++)if(0<this.parent.dependencyLevel||-1<h.indexOf("UNIQUE")||-1<h.indexOf("SORT")){if(-1<this.parent.getValueFromArg("!"+this.parent.getSheetID(this.parent.grid)+"!"+J(i)+n,!0).indexOf("#SPILL!"))return;this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,"",p,g),this.parent.refreshDependentCells("!"+this.parent.getSheetID(this.parent.grid)+"!"+J(g)+p,t),this.parent.actCell=e+t}},Qe.prototype.ComputeSORT=function(){for(var r,t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];e.length&&"nestedFormulaTrue"===e[e.length-1]&&(r=!0,e.pop());var i,o=e,s=[];if(z.isNullOrUndefined(e)||""===e[0]||4<o.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];o[1]=o[1]||"1",o[2]=o[2]||"1",o[3]=o[3]||"FALSE",o[0]=o[0].split("$").join("");var a=[];if(-1<o[0].indexOf(":")){z.isNullOrUndefined(o[0].match(/[0-9]/))?(l=o[0].split(":"),o[0]=l[0]+"1:"+l[1]+(this.parent.spreadSheetUsedRange[0]+1)):z.isNullOrUndefined(o[0].toUpperCase().match(/[A-Z]/))&&(l=o[0].split(":"),o[0]="A"+l[0]+":"+J(this.parent.spreadSheetUsedRange[1]+1)+l[1]);var l=o[0].split(":");if(this.parent.isCellReference(l[0])&&this.parent.isCellReference(l[1])){for(var u=this.parent.dependencyCollection,h=0;h<u.length&&!r;h++)u[h].split(":")[0]===o[0].split(":")[0]&&this.clearDependency(u[h]);-1===this.parent.dependencyCollection.indexOf(o[0])?r||this.parent.dependencyCollection.push(o[0]):this.clearDependency(o[0]);var l=o[0].indexOf(":"),p=void 0,g=this.parent.rowIndex(this.parent.substring(o[0],0,l)),f=this.parent.colIndex(this.parent.substring(o[0],0,l)),m=this.parent.rowIndex(this.parent.substring(o[0],l+1,l+o[0].length-l-1)),c=this.parent.colIndex(this.parent.substring(o[0],l+1,l+o[0].length-l-1));if(m<g&&(p=m,m=g,g=p),c<f&&(p=c,c=f,f=p),this.parent.isCellReference(o[3])){if(o[3]=this.parent.getValueFromArg(o[3]).toUpperCase(),o[3]!==this.parent.trueValue&&o[3]!==this.parent.falseValue)if(Q(o[3]))o[3]=0===Number(o[3])?this.parent.falseValue:this.parent.trueValue;else{if(""!==o[3])return this.parent.getErrorStrings()[$.CommonErrors.Value];o[3]=this.parent.falseValue}}else if(b=o[3].startsWith(this.parent.tic)&&o[3].endsWith(this.parent.tic),o[3]=this.parent.getValueFromArg(o[3]),o[3]=Q(o[3])?0===Number(o[3])?this.parent.falseValue:this.parent.trueValue:o[3].split(this.parent.tic).join("").toUpperCase(),o[3]!==this.parent.trueValue&&o[3]!==this.parent.falseValue)return this.parent.getErrorStrings()[b?$.CommonErrors.Value:$.CommonErrors.Name];if(this.parent.isCellReference(o[2])?(o[2]=this.parent.getValueFromArg(o[2]),o[2]=o[2]===this.parent.trueValue?"1":o[2]):(o[2]=this.parent.getValueFromArg(o[2]),o[2]=o[2]===this.parent.trueValue?"1":o[2].split(this.parent.tic).join("")),o[2]=Q(o[2])?Math.floor(Number(o[2])).toString():o[2],"1"!==o[2]&&"-1"!==o[2])return-1<this.parent.getErrorStrings().indexOf(o[2])?this.parent.getErrorStrings()[$.CommonErrors.Name]:this.parent.getErrorStrings()[$.CommonErrors.Value];l="1"===o[2]?"Ascending":"Descending";if(this.parent.isCellReference(o[1])){if(o[1]=this.parent.getValueFromArg(o[1]),o[1]=Q(o[1])?Math.floor(Number(o[1])).toString():o[1]===this.parent.trueValue?"1":o[1]===this.parent.falseValue?"0":o[1],isNaN(this.parseDouble(o[1]))||this.parseDouble(o[1])<1||(o[3]===this.parent.trueValue?m-g+1<this.parseDouble(o[1]):c-f+1<this.parseDouble(o[1])))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else if(b=o[1].startsWith(this.parent.tic)&&o[1].endsWith(this.parent.tic),o[1]=this.parent.getValueFromArg(o[1]),o[1]=Q(o[1])?Math.floor(Number(o[1])).toString():o[1]===this.parent.trueValue?"1":o[1]===this.parent.falseValue?"0":o[1].split(this.parent.tic).join(""),isNaN(this.parseDouble(o[1]))?b:this.parseDouble(o[1])<1||(o[3]===this.parent.trueValue?m-g+1<this.parseDouble(o[1]):c-f+1<this.parseDouble(o[1])))return this.parent.getErrorStrings()[$.CommonErrors.Value];var d="";0===o[0].indexOf("!")&&(d=(d=(d=o[0]).replace("!","")).indexOf("!"),d=o[0].substring(0,d+2)),o[0]=d+J(f)+g+":"+J(c)+m;for(var j=this.parent.getCellCollection(o[0]),h=0;h<j.length;h++)a.push(this.parent.getValueFromArg(j[h]));var N=[],v=[],E=[],S=[],y=[],C=c-f+1,L=function(r){r?"TRUE"===r.toUpperCase()||"FALSE"===r.toUpperCase()?(S.push(r),N.push(r)):isNaN(t.parseDouble(r))?(E.push(r),N.push(r)):(v.push(t.parseDouble(r)),N.push(t.parseDouble(r))):""===r&&(y.push(t.parseDouble(r).toString()),N.push(t.parseDouble(r).toString()))};if("TRUE"===o[3])for(h=0;h<C;h++)L(a[h+(this.parseDouble(o[1])-1)*C]);if("FALSE"===o[3])for(h=0;h<a.length;h++)L(a[h*C+this.parseDouble(o[1])-1]);for(var p=0<v.length?Ze(v,l):[],b=0<E.length?Ze(E,l):[],k=0<S.length?Ze(S,l):[],P="Ascending"==l?p.concat(b,k,y):k.concat(b,p,y),A=[],O=0;O<P.length;O++)for(var F=0;F<N.length;F++)JSON.stringify(P[O])===JSON.stringify(N[F])&&-1===A.indexOf(F)&&A.push(F);var x,l=void 0,_=(l=(l=x=this.parent.actCell)?-1<l.indexOf("!")?l.substring(l.lastIndexOf("!")+1):l:this.parent.actCell,this.parent.rowIndex(l)),W=this.parent.colIndex(l);if(0===this.parent.dependencyLevel){for(var q=!1,B="TRUE"===o[3]?m-g+1:A.length,X="TRUE"===o[3]?A.length:c-f+1,V=0;V<B;V++)for(var Y,R=0;R<X;R++)this.checkSpill(W+R,_+V)&&(q=!0),V===B-1&&R===X-1&&(Y=J(W+R)+(_+V),-1===this.parent.sortRange.indexOf(x+":"+Y))&&this.parent.sortRange.push(x+":"+Y);if(q)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Spill]}else if(0<this.parent.dependencyLevel&&-1<this.parent.getValueFromArg(J(W)+_,!0).indexOf("#SPILL!"))return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Spill];if("TRUE"===o[3]){for(var H=g,T=0;H<=m;H++,T++)for(var O=0,I=0;O<A.length;O++,I++){var G,M,D=this.parent.getValueFromArg(d+J(A[O]+f)+H);r&&""!==D?s.push(D):(D=""===D?"0":D,(M=this.parent.cell)&&(M=-1<M.indexOf("!")?M.substring(M.lastIndexOf("!")+1):M,G=this.parent.rowIndex(M),M=this.parent.colIndex(M),this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,D,G+T,M+I)))}i=this.parent.getValueFromArg(d+J(A[0]+f)+g)}if("FALSE"===o[3]){for(O=0,T=0;O<A.length;O++,T++)for(var Z=f,I=0;Z<=c;Z++,I++){var K,U,w=this.parent.getValueFromArg(d+J(Z)+(A[O]+g));r&&""!==w?s.push(w):(w=""===w?"0":w,(U=this.parent.cell)&&(U=-1<U.indexOf("!")?U.substring(U.lastIndexOf("!")+1):U,K=this.parent.colIndex(U),U=this.parent.rowIndex(U),this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,w,U+T,K+I)))}i=this.parent.getValueFromArg(d+J(f)+(A[0]+g))}}}else if(this.parent.isCellReference(o[0]))-1===this.parent.dependencyCollection.indexOf(o[0])?r||this.parent.dependencyCollection.push(o[0]):this.clearDependency(o[0]),i=this.parent.getValueFromArg(o[0]);else{if(i=o[0].trim(),-1<this.parent.getErrorStrings().indexOf(i))return i;i=this.parent.removeTics(i)}return r?s.join(","):""===i?"0":i};var Ke,$e,ze=Qe;function Qe(r){r=$e.call(this,r)||this;return r.formulas=[{formulaName:"UNIQUE",category:"Lookup & Reference",description:"Returns a unique values from a range or array."},{formulaName:"SORT",category:"Lookup & Reference",description:"Sorts a range of an array."}],r}Je=function(r,t){return(Je=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Je(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(C,rn=t),C.prototype.ComputeFIND=function(){for(var e=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];function i(r){var t=e.parent.getValueFromArg(r),t=z.isNullOrUndefined(t)?"":t.toString();return-1<n.indexOf(t)||e.parent.isCellReference(r)||(2===t.split("%").length&&e.parent.isNumber(t.split("%")[0])?t=(.01*Number(t.split("%")[0])).toString():-1<r.indexOf(e.parent.tic)&&(e.parent.removeTics(r).match(/^(\d*\.\d+|\d+)\s*[-*/]\s*(\d*\.\d+|\d+)$/)?(t=e.parent.getValueFromArg(e.parent.removeTics(r)),t=z.isNullOrUndefined(t)?"":t.toString()):-1<t.indexOf(e.parent.tic+e.parent.tic)&&(t=t.replace(/""/g,e.parent.tic)))),t}var o="";if(!z.isNullOrUndefined(r[0])){if(o=i(r[0]),-1<n.indexOf(o))return o;this.parent.isCellReference(r[0])||(o=this.parent.removeTics(o))}var s="";if(!z.isNullOrUndefined(r[1])){if(s=i(r[1]),-1<n.indexOf(s))return s;this.parent.isCellReference(r[1])||(s=this.parent.removeTics(s))}var a=1;if(!z.isNullOrUndefined(r[2])){if(a=i(r[2]),-1<n.indexOf(a))return a;if(a.toUpperCase()===this.parent.trueValue?a="1":a.toUpperCase()===this.parent.falseValue&&(a="0"),this.parent.isCellReference(r[2])||(a=this.parent.removeTics(a)),a=this.parent.parseFloat(a),isNaN(a)||a<=0)return n[$.CommonErrors.Value]}return(a=s.indexOf(o,a-1))<0?n[$.CommonErrors.Value]:(Number(a)+Number(1)).toString()},C.prototype.ComputeCONCATENATE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];for(var n=r,i="",o="",s=0;s<n.length;s++){var a=n[s];if(this.parent.isCellReference(a)){if(-1<a.indexOf(":")){if(!this.isConcat)return e[$.CommonErrors.Value];for(var l=this.parent.getCellCollection(a),u=0;u<l.length;u++)i+=this.parent.getValueFromArg(l[u])}else{if(1===n.length&&n[0].indexOf(this.parent.tic)<0&&!X(n[0]))return e[$.CommonErrors.Name];o=this.parent.getValueFromArg(a)}if(-1<e.indexOf(o))return o}else if(a.startsWith(this.parent.tic)&&a.endsWith(this.parent.tic)&&-1<a.indexOf('""')?o=(o=a.substring(1,a.length-1)).replace(/""/g,'"'):(o=a.split(this.parent.tic).join(""),(this.parent.isNumber(o)||z.isNullOrUndefined(this.parent.isDate(o))||a.startsWith(" n"))&&(o=this.parent.getValueFromArg(a).split(this.parent.tic).join(""))),-1<e.indexOf(o))return o;i+=o}return this.isConcat=!1,i},C.prototype.ComputeCONCAT=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this.isConcat=!0,(r=this.owner).ComputeCONCATENATE.apply(r,t)},C.prototype.ComputeT=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=this.parent.getErrorStrings();if(e.length&&"nestedFormulaTrue"===e[e.length-1]&&(t=!0,e.pop()),z.isNullOrUndefined(e)||1===e.length&&""===e[0].trim())return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1<e.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(r=this.parent.getValueFromArg(e[0]).trim(),!(-1<i.indexOf(r))){if(-1<e[0].indexOf(this.parent.tic))-1<(r=this.parent.removeTics(e[0].trim())).indexOf(this.parent.tic+this.parent.tic)&&(r=r.replace(/""/g,this.parent.tic));else if(2===r.split("%").length&&this.parent.isNumber(r.split("%")[0])&&(r=(Number(r.split("%")[0])/100).toString()),this.parent.isNumber(r)||r.toUpperCase()===this.parent.trueValue||r.toUpperCase()===this.parent.falseValue)return"";t&&(r=this.parent.tic+r+this.parent.tic)}return r},C.prototype.ComputeEXACT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=!1,s=r.length&&"nestedFormulaTrue"===r[r.length-1],a=this.parent.getErrorStrings();if(s&&r.pop(),!r||!r[0]&&1===r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(r[0]){if(e=this.parent.getValueFromArg(r[0]),-1<a.indexOf(e))return e;-1===e.indexOf(this.parent.tic)&&e.includes("%")&&(e=(Number(e.split("%")[0])/100).toString()),this.parent.isCellReference(r[0])?i=!0:e=e.split(this.parent.tic).join("")}if(r[1]){if(n=this.parent.getValueFromArg(r[1]),-1<a.indexOf(n))return n;-1===n.indexOf(this.parent.tic)&&n.includes("%")&&(n=(Number(n.split("%")[0])/100).toString()),this.parent.isCellReference(r[1])?i||0!==e.trim().length||0!==n.trim().length||(o=!1):(n=n.split(this.parent.tic).join(""),i&&0===e.trim().length&&0===n.trim().length&&(o=!1))}return e===n&&(o=!0),s?o?"1":"0":o},C.prototype.ComputeLEN=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this.parent.getErrorStrings();return z.isNullOrUndefined(t)||""===t[0].trim()&&1===t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:1<t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.parent.getValueFromArg(t[0]),-1<n.indexOf(r)?r:(-1<t[0].indexOf(this.parent.tic)?t[0]!==r&&t[0].startsWith("n")?r=this.parent.removeTics(r.trim()):-1<(r=this.parent.removeTics(t[0].trim())).indexOf(this.parent.tic+this.parent.tic)&&(r=r.replace(/""/g,this.parent.tic)):!t[0].startsWith("n")&&2===r.split("%").length&&this.parent.isNumber(r.split("%")[0])?r=(Number(r.split("%")[0])/100).toString():this.parent.isNumber(r)&&(r=r.trim()),r.length))},C.prototype.ComputeCHAR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.parent.getValueFromArg(r[0]).trim(),-1<n.indexOf(e)?e:-1<e.indexOf('"TRUE"')||this.parent.isCellReference(r[0])&&e.startsWith(this.parent.tic)||(e=e.split(this.parent.tic).join(""),this.parent.isNumber(e)?e=Math.floor(Number(e)).toString():-1<e.indexOf("%")?e=Math.floor(Number(e.split("%")[0])/100).toString():e===this.parent.trueValue&&(e="1"),!e.toUpperCase().match(/^[0-9]+$/))||255<(e=parseInt(e,10))||e<=0?n[$.CommonErrors.Value]:String.fromCharCode(e))},C.prototype.ComputeCODE=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this.parent.getErrorStrings();if(z.isNullOrUndefined(t)||1===t.length&&""===t[0].trim())return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(r=this.parent.getValueFromArg(t[0]).trim(),!(-1<n.indexOf(r))){if(-1<t[0].indexOf(this.parent.tic)?r=t[0]!==r&&t[0].startsWith("n")?this.parent.removeTics(r.trim()):this.parent.removeTics(t[0].trim()):!t[0].startsWith("n")&&2===r.split("%").length&&this.parent.isNumber(r.split("%")[0])&&(r=(Number(r.split("%")[0])/100).toString()),""===r)return n[$.CommonErrors.Value];r=r.charCodeAt(0)}return r},C.prototype.ComputeDOLLAR=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(t.length&&"nestedFormulaTrue"===t[t.length-1]&&(r=!0,t.pop()),1===t.length&&(""===t[0]&&(i=!0),t.push("2")),z.isNullOrUndefined(t)||2!==t.length||i)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];for(var n=0;n<t.length;n++)if(-1<t[n].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(t[n])))return this.parent.getErrorStrings()[$.CommonErrors.Value];var i=this.parent.getValueFromArg(t[0]).split(this.parent.tic).join(""),o=this.parent.getValueFromArg(t[1]).split(this.parent.tic).join(""),i=""===i||i===this.parent.falseValue?"0":i===this.parent.trueValue?"1":i,o=""===o||o===this.parent.falseValue?"0":o===this.parent.trueValue?"1":o;if("#NAME?"===i||"#NAME?"===o)return this.parent.getErrorStrings()[$.CommonErrors.Name];if(!i.toUpperCase().match(/^[-]?[0-9.]+$/)||!o.toUpperCase().match(/^[-]?[0-9.]+$/))return this.parent.getErrorStrings()[$.CommonErrors.Value];for(var s=new z.Internationalization,a=parseInt(o,10),o=Math.pow(10,-1*a),l="",u=1;u<=a;u++)l+="0";i=Math.round(this.parent.parseFloat(i)/o)*o,o=isNaN(i)?this.parent.getErrorStrings()[$.CommonErrors.Value]:s.formatNumber(i,{format:"$#,##0."+l+";($#,##0."+l+");$0."+l});return o=r?this.parent.tic+o+this.parent.tic:o},C.prototype.ComputePROPER=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=this.parent.getErrorStrings();return e.length&&"nestedFormulaTrue"===e[e.length-1]&&(t=!0,e.pop()),z.isNullOrUndefined(e)||""===e[0].trim()&&1===e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:1<e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.parent.getValueFromArg(e[0]).trim(),-1<i.indexOf(r)||(-1<e[0].indexOf(this.parent.tic)?e[0]!==r&&e[0].startsWith("n")?r=this.parent.removeTics(r.trim()):-1<(r=this.parent.removeTics(e[0].trim())).indexOf(this.parent.tic+this.parent.tic)&&(r=r.replace(/""/g,this.parent.tic)):!e[0].startsWith("n")&&2===r.split("%").length&&this.parent.isNumber(r.split("%")[0])&&(r=(Number(r.split("%")[0])/100).toString()),r=r.toLowerCase().replace(/\b\w/g,function(r){return r.toUpperCase()}).replace(/(\d)([a-z])/g,function(r,t,e){return t+e.toUpperCase()}),t&&(r=this.parent.tic+r+this.parent.tic)),r)};var Je,rn,tn=C;function C(r){r=rn.call(this,r)||this;return r.isConcat=!1,r.formulas=[{formulaName:"FIND",category:"Text",description:"Returns the position of a string of text within another string."},{formulaName:"CONCATENATE",category:"Text",description:" Used to join two or more strings together."},{formulaName:"CONCAT",category:"Text",description:"Concatenates a list or range of text strings."},{formulaName:"T",category:"Text",description:"Checks whether a value is text or not and returns the text."},{formulaName:"EXACT",category:"Text",description:"Checks whether a two text strings are exactly same and returns TRUE or FALSE."},{formulaName:"LEN",category:"Text",description:"Returns a number of characters in a given string."},{formulaName:"CHAR",category:"Text",description:"Returns the character from the specified number."},{formulaName:"CODE",category:"Text",description:"Returns the numeric code for the first character in a given string."},{formulaName:"DOLLAR",category:"Text",description:"Converts the number to currency formatted text."},{formulaName:"PROPER",category:"Text",description:"Converts a text to proper case; first letter to uppercase and other letters to lowercase."}],r}en=function(r,t){return(en=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}en(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(b,nn=t),b.prototype.ComputeLEFT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.substringSide(r,!0)},b.prototype.ComputeRIGHT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.substringSide(r,!1)},b.prototype.substringSide=function(r,t){r&&0<r.length&&"nestedFormulaTrue"===r[r.length-1]&&(e=!0,r.pop());var e,n=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var i=this.resolveTextArg(r[0]);if(-1<n.indexOf(i))return i;var o=1;if(2===r.length){r=this.resolveNumberArg(r[1]);if("string"==typeof r)return r;if((o=Math.floor(r))<0)return n[$.CommonErrors.Value]}r=t?i.substring(0,o):o>=i.length?i:i.substring(i.length-o);return e?this.parent.tic+r+this.parent.tic:r},b.prototype.ComputeMID=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveTextArg(r[0]),-1<o.indexOf(e)?e:(n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),"string"==typeof n?n:"string"==typeof i?i:(n=Math.floor(n),i=Math.floor(i),n<1||i<0?o[$.CommonErrors.Value]:e.substring(n-1,n-1+i))))},b.prototype.ComputeUPPER=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.caseTransform(r,!0)},b.prototype.ComputeLOWER=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.caseTransform(r,!1)},b.prototype.caseTransform=function(r,t){var e=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveTextArg(r[0]),-1<e.indexOf(r)?r:t?r.toUpperCase():r.toLowerCase())},b.prototype.ComputeTRIM=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t&&0<t.length&&"nestedFormulaTrue"===t[t.length-1]&&(r=!0,t.pop());var n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(n=this.resolveTextArg(t[0]),-1<i.indexOf(n)?n:(i=n.trim().replace(/\s+/g," "),r?this.parent.tic+i+this.parent.tic:i))},b.prototype.ComputeREPLACE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||4!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveTextArg(r[0]),-1<s.indexOf(e)?e:(i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]),n=this.resolveTextArg(r[3]),"string"==typeof i?i:"string"==typeof o?o:-1<s.indexOf(n)?n:(i=Math.floor(i),o=Math.floor(o),i<1||o<0?s[$.CommonErrors.Value]:e.substring(0,i-1)+n+e.substring(i-1+o))))},b.prototype.ComputeSUBSTITUTE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]),i=this.resolveTextArg(r[1]),o=this.resolveTextArg(r[2]);if(!(-1<e.indexOf(n))){if(-1<e.indexOf(i))return i;if(-1<e.indexOf(o))return o;if(""!==i){if(3===r.length)return n.split(i).join(o);var s=this.resolveNumberArg(r[3]);if("string"==typeof s)return s;var a=Math.floor(s);if(a<1)return e[$.CommonErrors.Value];for(var l=0,u=n.indexOf(i);-1<u;){if(++l===a)return n.substring(0,u)+o+n.substring(u+i.length);u=n.indexOf(i,u+i.length)}}}return n},b.prototype.ComputeREPT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveTextArg(r[0]),-1<i.indexOf(e)?e:"string"==typeof(n=this.resolveNumberArg(r[1]))?n:(n=Math.floor(n))<0?i[$.CommonErrors.Value]:0===n||""===e?"":new Array(n+1).join(e))},b.prototype.ComputeSEARCH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]).toLowerCase(),i=this.resolveTextArg(r[1]).toLowerCase();if(-1<e.indexOf(n))return n;if(-1<e.indexOf(i))return i;var o=1;if(3===r.length){var s=this.resolveNumberArg(r[2]);if("string"==typeof s)return s;if((o=Math.floor(s))<1)return e[$.CommonErrors.Value]}s=i.indexOf(n,o-1);return s<0?e[$.CommonErrors.Value]:(s+1).toString()},b.prototype.ComputeVALUE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveTextArg(r[0]),-1<n.indexOf(e)?e:""===e?"0":(e=e.replace(/,/g,"").replace(/\$/g,"").trim(),e=this.parent.parseFloat(e),isNaN(e)?n[$.CommonErrors.Value]:e.toString()))},b.prototype.ComputeCLEAN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]);if(-1<e.indexOf(n))return n;for(var i="",o=0;o<n.length;o++)32<=n.charCodeAt(o)&&(i+=n.charAt(o));return i},b.prototype.ComputeFIXED=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<1||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]);if("string"==typeof e)return e;var n=2;if(2<=r.length&&""!==r[1]){var i=this.resolveNumberArg(r[1]);if("string"==typeof i)return i;n=Math.floor(i)}i=!1;if(3===r.length&&""!==r[2]&&(i=(o=this.parent.getValueFromArg(r[2]).toUpperCase())===this.parent.trueValue||0!==this.parent.parseFloat(o)),n<0)return o=Math.pow(10,-n),o=Math.round(e/o)*o,i?o.toString():o.toLocaleString("en-US");var o=e.toFixed(n);if(i)return o;for(var e=o.split("."),s=e[0],n="-"===s.charAt(0)?"-":"",a=(n&&(s=s.substring(1)),""),l=0;l<s.length;l++){var u=s.length-l;0<l&&u%3==0&&(a+=","),a+=s.charAt(l)}return e[0]=n+a,e.join(".")},b.prototype.ComputeTEXTJOIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]);if(-1<e.indexOf(n))return n;for(var i=this.parent.getValueFromArg(r[1]).toUpperCase(),o=i===this.parent.trueValue||!isNaN(this.parent.parseFloat(i))&&0!==this.parent.parseFloat(i),s=[],a=2;a<r.length;a++){var l=r[a];if(this.parent.isCellReference(l)&&-1<l.indexOf(":"))for(var u=this.parent.getCellCollection(l),h=Array.isArray(u)?u:[u],p=0;p<h.length;p++){var g=this.parent.getValueFromArg(h[p]);if(-1<e.indexOf(g))return g;o&&""===g||s.push(g)}else{g=this.resolveTextArg(l);if(-1<e.indexOf(g))return g;o&&""===g||s.push(g)}}return s.join(n)},b.prototype.ComputeLEFTB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.ComputeLEFT.apply(this,r)},b.prototype.ComputeRIGHTB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.ComputeRIGHT.apply(this,r)},b.prototype.ComputeMIDB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.ComputeMID.apply(this,r)},b.prototype.ComputeREPLACEB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.ComputeREPLACE.apply(this,r)},b.prototype.ComputeSEARCHB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.ComputeSEARCH.apply(this,r)};var en,nn,on=b;function b(r){r=nn.call(this,r)||this;return r.formulas=[{formulaName:"LEFT",category:"Text",description:"Returns the leftmost characters from a text value."},{formulaName:"RIGHT",category:"Text",description:"Returns the rightmost characters from a text value."},{formulaName:"MID",category:"Text",description:"Returns a specific number of characters from a text string starting at the position you specify."},{formulaName:"UPPER",category:"Text",description:"Converts text to uppercase."},{formulaName:"LOWER",category:"Text",description:"Converts text to lowercase."},{formulaName:"TRIM",category:"Text",description:"Removes spaces from text except for single spaces between words."},{formulaName:"REPLACE",category:"Text",description:"Replaces characters within text."},{formulaName:"SUBSTITUTE",category:"Text",description:"Substitutes new text for old text in a text string."},{formulaName:"REPT",category:"Text",description:"Repeats text a given number of times."},{formulaName:"SEARCH",category:"Text",description:"Finds one text value within another (not case-sensitive)."},{formulaName:"VALUE",category:"Text",description:"Converts a text argument to a number."},{formulaName:"CLEAN",category:"Text",description:"Removes all nonprintable characters from text."},{formulaName:"FIXED",category:"Text",description:"Formats a number as text with a fixed number of decimals."},{formulaName:"TEXTJOIN",category:"Text",description:"Combines text from multiple ranges/strings with a delimiter."},{formulaName:"LEFTB",category:"Text",description:"Returns the leftmost characters from a text value (byte count alias)."},{formulaName:"RIGHTB",category:"Text",description:"Returns the rightmost characters from a text value (byte count alias)."},{formulaName:"MIDB",category:"Text",description:"Returns characters from a text string (byte count alias)."},{formulaName:"REPLACEB",category:"Text",description:"Replaces characters within text (byte count alias)."},{formulaName:"SEARCHB",category:"Text",description:"Finds one text value within another (byte count alias)."}],r}sn=function(r,t){return(sn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}sn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(un,an=t),un.prototype.ComputeASC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveTextArg(r[0]);if(-1<this.parent.getErrorStrings().indexOf(e))return e;for(var n="",i=0;i<e.length;i++){var o=e.charCodeAt(i);n+=65281<=o&&o<=65374?String.fromCharCode(o-65248):12288===o?" ":e.charAt(i)}return n},un.prototype.ComputeTEXTBEFORE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||6<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]);if(!(-1<e.indexOf(n))){var i=this.resolveTextArg(r[1]);if(-1<e.indexOf(i))return i;var o=1;if(3<=r.length&&""!==r[2]){var s=this.resolveNumberArg(r[2]);if("string"==typeof s)return s;if((o=Math.floor(s))<1)return e[$.CommonErrors.Value]}for(var a=0,l=0;l<o;l++){var u=n.indexOf(i,a);if(u<0)return 6<=r.length&&""!==r[5]?this.resolveTextArg(r[5]):e[$.CommonErrors.NA];if(l===o-1)return n.substring(0,u);a=u+i.length}}return n},un.prototype.ComputeVALUETOTEXT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.parent.getErrorStrings(),n=this.parent.getValueFromArg(r[0]);if(-1<e.indexOf(n))return n;if(""===n)return"";e=!0;if(2===r.length){var i=this.resolveNumberArg(r[1]);if("string"==typeof i)return i;e=0===i}return!e&&!this.parent.isCellReference(r[0])&&-1<r[0].indexOf(this.parent.tic)?this.parent.removeTics(n):n},un.prototype.ComputeARRAYTOTEXT=function(){for(var o,s,a=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return z.isNullOrUndefined(r)||r.length<1||2<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(o=this.parent.getErrorStrings(),s=[],function(r){if(a.parent.isCellReference(r)&&-1<r.indexOf(":"))for(var t=a.parent.getCellCollection(r),e=Array.isArray(t)?t:[t],n=0;n<e.length;n++){var i=a.parent.getValueFromArg(e[n]);if(-1<o.indexOf(i))return i;s.push(i)}else{i=a.resolveTextArg(r);if(-1<o.indexOf(i))return i;s.push(i)}return null}(r[0])||s.join(this.parent.getParseArgumentSeparator()))};var sn,an,ln=un;function un(r){r=an.call(this,r)||this;return r.formulas=[{formulaName:"ASC",category:"Text",description:"Changes full-width characters to half-width."},{formulaName:"TEXTBEFORE",category:"Text",description:"Returns text before a given character or string."},{formulaName:"VALUETOTEXT",category:"Text",description:"Returns text from any specified value."},{formulaName:"ARRAYTOTEXT",category:"Text",description:"Returns the text representation of an array."}],r}hn=function(r,t){return(hn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}hn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(fn,pn=t),fn.prototype.ComputeISNUMBER=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=r;return n&&"nestedFormulaTrue"===n[n.length-1]&&(e=!0,n.pop()),1===r.length&&""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:""===(n=this.parent.isCellReference(n[0])?this.parent.getValueFromArg(n[0]):this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))).toString()||r.toString().startsWith(this.parent.tic)?!!e&&"0":(n=!isNaN(this.parent.parseFloat(n)),e?n?"1":"0":n)};var hn,pn,gn=fn;function fn(r){r=pn.call(this,r)||this;return r.formulas=[{formulaName:"ISNUMBER",category:"Information",description:"Returns TRUE, if the argument is number and FALSE otherwise."}],r}mn=function(r,t){return(mn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}mn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(A,cn=t),A.prototype.requireOne=function(r){return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:null},A.prototype.ComputeISBLANK=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireOne(r);return e||(this.parent.isCellReference(r[0]),""===this.parent.getValueFromArg(r[0]))},A.prototype.ComputeISTEXT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireOne(r);return e||(e=this.parent.getValueFromArg(r[0]),!(-1<this.parent.getErrorStrings().indexOf(e))&&""!==e&&e.toUpperCase()!==this.parent.trueValue&&e.toUpperCase()!==this.parent.falseValue&&(isNaN(this.parent.parseFloat(e))||!this.parent.isCellReference(r[0])&&-1<r[0].indexOf(this.parent.tic)))},A.prototype.ComputeISNONTEXT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.ComputeISTEXT.apply(this,r);return"string"==typeof e?e:!e},A.prototype.ComputeISLOGICAL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireOne(r);return e||(e=this.parent.getValueFromArg(r[0]).toUpperCase())===this.parent.trueValue||e===this.parent.falseValue},A.prototype.ComputeISERROR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireOne(r);return e||(e=this.parent.getValueFromArg(r[0]),-1<this.parent.getErrorStrings().indexOf(e))||/^#[A-Z/?!]+$/.test(e)},A.prototype.ComputeISERR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireOne(r);return e||(e=this.parent.getValueFromArg(r[0]))!==this.parent.getErrorStrings()[$.CommonErrors.NA]&&"#N/A"!==e&&(-1<this.parent.getErrorStrings().indexOf(e)||/^#[A-Z/?!]+$/.test(e))},A.prototype.ComputeISNA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireOne(r);return e||(e=this.parent.getValueFromArg(r[0]))===this.parent.getErrorStrings()[$.CommonErrors.NA]||"#N/A"===e},A.prototype.ComputeISEVEN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.parity(r,!0)},A.prototype.ComputeISODD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.parity(r,!1)},A.prototype.parity=function(r,t){var e=this.parent.getErrorStrings(),n=this.requireOne(r);return n||("string"==typeof(n=this.resolveNumberArg(r[0]))?e[$.CommonErrors.Value]:(r=(n<0?Math.ceil(n):Math.floor(n))%2==0,t?r:!r))},A.prototype.ComputeN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings(),n=this.requireOne(r);return n||(n=this.parent.getValueFromArg(r[0]),-1<e.indexOf(n)?n:n.toUpperCase()===this.parent.trueValue?"1":n.toUpperCase()===this.parent.falseValue||""===n||(e=this.parent.parseFloat(n),isNaN(e))?"0":e.toString())},A.prototype.ComputeNA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return(!r||1!==r.length||""!==r[0])&&r&&0<r.length&&(1!==r.length||""!==r[0])?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:this.parent.getErrorStrings()[$.CommonErrors.NA]},A.prototype.ComputeTYPE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireOne(r);return e||(e=this.parent.getValueFromArg(r[0]),-1<this.parent.getErrorStrings().indexOf(e)||/^#[A-Z/?!]+$/.test(e)?"16":e.toUpperCase()===this.parent.trueValue||e.toUpperCase()===this.parent.falseValue?"4":""===e||isNaN(this.parent.parseFloat(e))||!this.parent.isCellReference(r[0])&&-1!==r[0].indexOf(this.parent.tic)?"2":"1")};var mn,cn,dn=A;function A(r){r=cn.call(this,r)||this;return r.formulas=[{formulaName:"ISBLANK",category:"Information",description:"Returns TRUE if the value is blank."},{formulaName:"ISTEXT",category:"Information",description:"Returns TRUE if the value is text."},{formulaName:"ISNONTEXT",category:"Information",description:"Returns TRUE if the value is not text."},{formulaName:"ISLOGICAL",category:"Information",description:"Returns TRUE if the value is a logical value."},{formulaName:"ISERROR",category:"Information",description:"Returns TRUE if the value is any error value."},{formulaName:"ISERR",category:"Information",description:"Returns TRUE if the value is any error value except #N/A."},{formulaName:"ISNA",category:"Information",description:"Returns TRUE if the value is the #N/A error value."},{formulaName:"ISEVEN",category:"Information",description:"Returns TRUE if the number is even."},{formulaName:"ISODD",category:"Information",description:"Returns TRUE if the number is odd."},{formulaName:"N",category:"Information",description:"Returns a value converted to a number."},{formulaName:"NA",category:"Information",description:"Returns the error value #N/A."},{formulaName:"TYPE",category:"Information",description:"Returns a number indicating the data type of a value."}],r}Nn=function(r,t){return(Nn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Nn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Sn,vn=t),Sn.prototype.ComputeINFO=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]).toLowerCase();if(-1<e.indexOf(n))return n;if(-1===["system","release","numfile","directory","origin","recalc","memavail","memused"].indexOf(n))return e[$.CommonErrors.NA];var i=n;switch(i){case"system":return"pcdos";case"release":return"16.0";case"numfile":return"1";case"directory":return"/";case"origin":return"A1";case"recalc":return"Manual"===this.parent.parentObject.calculationMode?"Manual":"Automatic";case"memavail":return"1048576";case"memused":return"0";default:return i}},Sn.prototype.ComputeCELL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]).toLowerCase();if(-1<e.indexOf(n))return n;var i=(i=2===r.length?r[1]:this.parent.actCell||this.parent.cell||"A1").split("$").join("");if(!this.parent.isCellReference(i.split(":")[0]))return e[$.CommonErrors.Value];var i=-1<i.indexOf(":")?i.split(":")[0]:i,o=-1<i.indexOf("!")?i.substring(i.lastIndexOf("!")+1):i,s=this.parent.getValueFromArg(i);switch(n){case"address":return"$"+o.replace(/([A-Z]+)(\d+)/,"$1$$$2");case"col":return this.parent.colIndex(o).toString();case"row":return this.parent.rowIndex(o).toString();case"contents":return s;case"format":return"G";case"prefix":return"";case"protect":return"0";case"type":return""===s?"b":this.parent.isNumber(s)?"v":"l";case"width":return"8";case"parentheses":return"0";default:return e[$.CommonErrors.NA]}};var Nn,vn,En=Sn;function Sn(r){r=vn.call(this,r)||this;return r.formulas=[{formulaName:"INFO",category:"Information",description:"Returns information about the current operating environment."},{formulaName:"CELL",category:"Information",description:"Returns information about the formatting, location, or contents of a cell."}],r}yn=function(r,t){return(yn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}yn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(An,Cn=t),An.prototype.toSerial=function(r){var t=this.parent.getErrorStrings(),e=this.parent.getValueFromArg(r);return-1<t.indexOf(e)?e:""===(e=this.parent.isCellReference(r)?e:this.parent.removeTics(e))?t[$.CommonErrors.Value]:this.parent.isNumber(e)?Math.floor(this.parent.parseFloat(e)):(r=this.parent.isDate(new Date(e)))?Math.floor(this.parent.toOADate(r)):t[$.CommonErrors.Value]},An.prototype.holidaySet=function(r){var t=new Set;if(r&&""!==r){var e=this.parent.getErrorStrings();if(this.parent.isCellReference(r)&&-1<r.indexOf(":"))for(var n,i=this.parent.getCellCollection(r),o=Array.isArray(i)?i:[i],s=0;s<o.length;s++)if("string"==typeof(n=this.toSerial(o[s]))){if(-1<e.indexOf(n))return n}else t.add(n);else{if("string"==typeof(n=this.toSerial(r)))return n;t.add(n)}}return t},An.prototype.weekendMask=function(r){if(!r||""===r)return[!1,!1,!1,!1,!1,!0,!0];var t=this.parent.getErrorStrings(),e=this.resolveTextArg(r);if(-1<t.indexOf(e))return e;if(7===e.length&&/^[01]+$/.test(e)){for(var n=[],i=0;i<7;i++)n.push("1"===e.charAt(i));return n}r=this.resolveNumberArg(r);return"string"==typeof r?r:{1:[!1,!1,!1,!1,!1,!0,!0],2:[!0,!1,!1,!1,!1,!1,!0],3:[!0,!0,!1,!1,!1,!1,!1],4:[!1,!0,!0,!1,!1,!1,!1],5:[!1,!1,!0,!0,!1,!1,!1],6:[!1,!1,!1,!0,!0,!1,!1],7:[!1,!1,!1,!1,!0,!0,!1],11:[!0,!1,!1,!1,!1,!1,!1],12:[!1,!0,!1,!1,!1,!1,!1],13:[!1,!1,!0,!1,!1,!1,!1],14:[!1,!1,!1,!0,!1,!1,!1],15:[!1,!1,!1,!1,!0,!1,!1],16:[!1,!1,!1,!1,!1,!0,!1],17:[!1,!1,!1,!1,!1,!1,!0]}[Math.floor(r)]||t[$.CommonErrors.Num]},An.prototype.isWeekendMask=function(r,t){return t[(r.getDay()+6)%7]},An.prototype.ComputeDATEDIF=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||3!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.toSerial(r[0]),i=this.toSerial(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;var o=this.resolveTextArg(r[2]).toUpperCase();if(i<n)return e[$.CommonErrors.Num];var s=this.parent.fromOADate(n),a=this.parent.fromOADate(i);switch(o){case"Y":return(a.getFullYear()-s.getFullYear()-(a.getMonth()<s.getMonth()||a.getMonth()===s.getMonth()&&a.getDate()<s.getDate()?1:0)).toString();case"M":var l=12*(a.getFullYear()-s.getFullYear())+(a.getMonth()-s.getMonth());return a.getDate()<s.getDate()&&l--,l.toString();case"D":return(i-n).toString();case"MD":l=a.getDate()-s.getDate();return l<0&&(l+=new Date(a.getFullYear(),a.getMonth(),0).getDate()),l.toString();case"YM":l=a.getMonth()-s.getMonth();return a.getDate()<s.getDate()&&l--,l<0&&(l+=12),l.toString();case"YD":l=new Date(a.getFullYear(),s.getMonth(),s.getDate()),l=Math.round((a.getTime()-l.getTime())/864e5);return l<0&&(l+=this.isLeapYear(a.getFullYear())?366:365),l.toString();default:return e[$.CommonErrors.Num]}},An.prototype.isLeapYear=function(r){return r%4==0&&r%100!=0||r%400==0},An.prototype["ComputeNETWORKDAYS.INTL"]=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.toSerial(r[0]),n=this.toSerial(r[1]);if("string"==typeof e)return e;if("string"==typeof n)return n;var i=this.weekendMask(r[2]);if(!(i instanceof Array))return i;var o=this.holidaySet(r[3]);if(!(o instanceof Set))return o;for(var s=e<=n?1:-1,a=0,l=e;0<s?l<=n:n<=l;l+=s){var u=this.parent.fromOADate(l);this.isWeekendMask(u,i)||o.has(l)||(a+=s)}return a.toString()},An.prototype["ComputeWORKDAY.INTL"]=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.toSerial(r[0]),i=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;var o=this.weekendMask(r[2]);if(!(o instanceof Array))return o;var s=this.holidaySet(r[3]);if(!(s instanceof Set))return s;for(var a=n,l=0<=i?1:-1,u=Math.abs(Math.trunc(i));0<u;){a+=l;var h=this.parent.fromOADate(a);if(this.isWeekendMask(h,o)||s.has(a)||u--,a<0)return e[$.CommonErrors.Num]}return a.toString()};var yn,Cn,bn=An;function An(r){r=Cn.call(this,r)||this;return r.formulas=[{formulaName:"DATEDIF",category:"Date & Time",description:"Calculates the number of days, months, or years between two dates."},{formulaName:"NETWORKDAYS.INTL",category:"Date & Time",description:"Returns workdays between dates for a custom weekend."},{formulaName:"WORKDAY.INTL",category:"Date & Time",description:"Returns the date before or after a number of workdays with a custom weekend."}],r}On=function(r,t){return(On=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}On(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Vn,Fn=t),Vn.prototype["ComputeISO.CEILING"]=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]);if("string"==typeof e)return e;var n=1;if(2===r.length&&""!==r[1]){var i=this.resolveNumberArg(r[1]);if("string"==typeof i)return i;n=Math.abs(i)}return 0===e||0===n?"0":(Math.ceil(e/n)*n).toString()},Vn.prototype["ComputeECMA.CEILING"]=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:0===e||0===n?"0":0<e&&n<0?i[$.CommonErrors.Num]:(0<e||0<n?Math.ceil(e/n)*n:Math.floor(e/n)*n).toString())};var On,Fn,xn=Vn;function Vn(r){r=Fn.call(this,r)||this;return r.formulas=[{formulaName:"ISO.CEILING",category:"Math & Trig",description:"Rounds a number up to the nearest integer or multiple of significance."},{formulaName:"ECMA.CEILING",category:"Math & Trig",description:"Rounds a number up, away from zero, to the nearest multiple of significance."}],r}Rn=function(r,t){return(Rn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Rn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Mn,Tn=t),Mn.prototype["ComputeERROR.TYPE"]=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.parent.getValueFromArg(r[0]),i={"#NULL!":1,"#DIV/0!":2,"#VALUE!":3,"#REF!":4,"#NAME?":5,"#NUM!":6,"#N/A":7,"#GETTING_DATA":8};if(void 0!==i[n])return i[n].toString();for(var o=0;o<e.length;o++)if(n===e[o]){var s=o+1;if(1<=s&&s<=8)return s.toString()}return e[$.CommonErrors.NA]};var Rn,Tn,In=Mn;function Mn(r){r=Tn.call(this,r)||this;return r.formulas=[{formulaName:"ERROR.TYPE",category:"Information",description:"Returns a number corresponding to an error type."}],r}Dn=function(r,t){return(Dn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Dn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(jn,Un=t),jn.prototype.ComputeUSDOLLAR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.owner.ComputeDOLLAR;return e?e.apply(void 0,r):this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]},jn.prototype.ComputeFINDB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.owner.ComputeFIND;return e?e.apply(void 0,r):this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]},jn.prototype.ComputeLENB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.owner.ComputeLEN;return e?e.apply(void 0,r):this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]};var Dn,Un,wn=jn;function jn(r){r=Un.call(this,r)||this;return r.formulas=[{formulaName:"USDOLLAR",category:"Text",description:"Converts a number to text using currency format (US dollar)."},{formulaName:"FINDB",category:"Text",description:"Finds text within another string (byte-count alias of FIND)."},{formulaName:"LENB",category:"Text",description:"Returns the length of a text string (byte-count alias of LEN)."}],r}O.prototype.yearDays=function(r){switch(r){case 1:case 3:return 365;default:return 360}},O.prototype.toDate=function(r){return this.parent.fromOADate(r)},O.prototype.toSerial=function(r){return this.parent.toOADate(r)},O.prototype.coupPCD=function(r,t,e){for(var t=this.toDate(t),n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),i=12/e;this.toSerial(n)>r;)n=this.addMonths(n,-i);return this.toSerial(n)>r?r:this.toSerial(n)},O.prototype.coupNCD=function(r,t,e){t=this.coupPCD(r,t,e);return t<=r&&(r=12/e,t=this.toSerial(this.addMonths(this.toDate(t),r))),t},O.prototype.coupDays=function(r,t,e,n){void 0===n&&(n=0);var i=this.coupPCD(r,t,e),r=this.coupNCD(r,t,e);return this.daysBetween(i,r,n)},O.prototype.coupDayBS=function(r,t,e,n){void 0===n&&(n=0);t=this.coupPCD(r,t,e);return this.daysBetween(t,r,n)},O.prototype.coupDaysNC=function(r,t,e,n){void 0===n&&(n=0);t=this.coupNCD(r,t,e);return this.daysBetween(r,t,n)},O.prototype.coupNum=function(r,t,e,n){for(var i=12/e,e=this.toDate(t),o=new Date(e.getFullYear(),e.getMonth(),e.getDate()),s=0;this.toSerial(o)>r;)s++,o=this.addMonths(o,-i);return s},O.prototype.daysBetween=function(r,t,e){var n;return 1===e?Math.round(t-r):(r=this.toDate(r),t=this.toDate(t),3===e?Math.abs(Math.round((t.getTime()-r.getTime())/864e5)):(e=r.getFullYear(),n=r.getMonth()+1,r=r.getDate(),360*(t.getFullYear()-e)+30*(t.getMonth()+1-n)+((e=31===(e=t.getDate())?30:e)-(r=31===r?30:r))))},O.prototype.addMonths=function(r,t){r=new Date(r.getTime());return r.setMonth(r.getMonth()+t),r};var Ln=O;function O(r){this.parent=r}kn=function(r,t){return(kn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}kn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(F,Pn=t),F.prototype.parseBondArgs=function(r,t,e){if(z.isNullOrUndefined(r)||r.length<t||r.length>e)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];t=this.resolveNumberArg(r[0]),e=this.resolveNumberArg(r[1]);if("string"==typeof t)return t;if("string"==typeof e)return e;t={settlement:t,maturity:e};if(3<=r.length){e=this.resolveNumberArg(r[2]);if("string"==typeof e)return e;t.rate=e}if(4<=r.length){e=this.resolveNumberArg(r[3]);if("string"==typeof e)return e;t.yld=e}if(5<=r.length){e=this.resolveNumberArg(r[4]);if("string"==typeof e)return e;t.redemption=e}return t.frequency=6<=r.length&&""!==r[5]?this.resolveNumberArg(r[5]):2,"string"==typeof t.frequency?t.frequency:(t.basis=7<=r.length&&""!==r[6]?this.resolveNumberArg(r[6]):0,"string"==typeof t.basis?t.basis:t)},F.prototype.coupArgs=function(r){if(z.isNullOrUndefined(r)||r.length<3||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var t=this.resolveNumberArg(r[0]),e=this.resolveNumberArg(r[1]),n=this.resolveNumberArg(r[2]);if("string"==typeof t)return t;if("string"==typeof e)return e;if("string"==typeof n)return n;var i=0;if(4===r.length&&""!==r[3]){r=this.resolveNumberArg(r[3]);if("string"==typeof r)return r;i=Math.floor(r)}return{settlement:t,maturity:e,frequency:Math.floor(n),basis:i}},F.prototype.ComputeCOUPDAYBS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.coupArgs(r);return"string"==typeof e?e:this.bond.coupDayBS(e.settlement,e.maturity,e.frequency,e.basis).toString()},F.prototype.ComputeCOUPDAYS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.coupArgs(r);return"string"==typeof e?e:this.bond.coupDays(e.settlement,e.maturity,e.frequency,e.basis).toString()},F.prototype.ComputeCOUPDAYSNC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.coupArgs(r);return"string"==typeof e?e:this.bond.coupDaysNC(e.settlement,e.maturity,e.frequency,e.basis).toString()},F.prototype.ComputeCOUPNCD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.coupArgs(r);return"string"==typeof e?e:this.bond.coupNCD(e.settlement,e.maturity,e.frequency).toString()},F.prototype.ComputeCOUPNUM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.coupArgs(r);return"string"==typeof e?e:this.bond.coupNum(e.settlement,e.maturity,e.frequency,e.basis).toString()},F.prototype.ComputeCOUPPCD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.coupArgs(r);return"string"==typeof e?e:this.bond.coupPCD(e.settlement,e.maturity,e.frequency).toString()},F.prototype.ComputeACCRINT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=this.parent.getErrorStrings(),a=this.parseBondArgs(r,6,8);return"string"==typeof a?a:"string"==typeof(e=8<=r.length?this.resolveNumberArg(r[7]):a.settlement)?e:(e=a.rate,n=a.frequency,i=a.basis,o=this.bond.coupDayBS(a.settlement,a.maturity,n,i),0===(a=this.bond.coupDays(a.settlement,a.maturity,n,i))?s[$.CommonErrors.Num]:((7<=r.length&&""!==r[6]?this.resolveNumberArg(r[6]):1e3)*e/n*o/a).toString())},F.prototype.ComputeACCRINTM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<4||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=0;if(5===r.length&&""!==r[4]){var a=this.resolveNumberArg(r[4]);if("string"==typeof a)return a;s=Math.floor(a)}return(o*i*this.bond.daysBetween(e,n,s)/this.bond.yearDays(s)).toString()},F.prototype.ComputeISPMT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||4!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),o=this.resolveNumberArg(r[1]),n=this.resolveNumberArg(r[2]),i=this.resolveNumberArg(r[3]),"string"==typeof e?e:"string"==typeof o?o:"string"==typeof n?n:"string"==typeof i?i:(o=Math.floor(o))<1||n<o?s[$.CommonErrors.Num]:(-i*e*(1-(o-1)/n)).toString())},F.prototype.ComputeMDURATION=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parseBondArgs(r,5,7);return"string"==typeof n?n:(1/(e=n.frequency)/(1+n.yld/e)).toString()},F.prototype.ComputePRICE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parseBondArgs(r,6,7);if("string"==typeof e)return e;for(var n=e.rate,i=e.yld,o=e.redemption,s=e.frequency,a=e.basis,l=this.bond.coupNum(e.settlement,e.maturity,s,a),u=this.bond.coupDaysNC(e.settlement,e.maturity,s,a),h=this.bond.coupDays(e.settlement,e.maturity,s,a),e=this.bond.coupDayBS(e.settlement,e.maturity,s,a),p=100*n/s,g=o/Math.pow(1+i/s,l-1+u/h),f=1;f<=l;f++)g+=p/Math.pow(1+i/s,f-1+u/h);return(g-=p*e/h).toString()},F.prototype.ComputePRICEDISC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<4||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=0;if(5===r.length&&""!==r[4]){var a=this.resolveNumberArg(r[4]);if("string"==typeof a)return a;s=Math.floor(a)}return(o*(1-i*this.bond.daysBetween(e,n,s)/this.bond.yearDays(s))).toString()},F.prototype.ComputePRICEMAT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<5||6<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]),s=this.resolveNumberArg(r[4]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;var a=0;if(6===r.length&&""!==r[5]){var l=this.resolveNumberArg(r[5]);if("string"==typeof l)return l;a=Math.floor(l)}l=this.bond.yearDays(a),e=this.bond.daysBetween(i,e,a);return((100+o*this.bond.daysBetween(i,n,a)/l)/(1+s*e/l)).toString()},F.prototype.ComputeTBILLPRICE=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z.isNullOrUndefined(n)||3!==n.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(n[0]),e=this.resolveNumberArg(n[1]),t=this.resolveNumberArg(n[2]),"string"==typeof r?r:"string"==typeof e?e:"string"==typeof t?t:(e=e-r)<=0?this.parent.getErrorStrings()[$.CommonErrors.Num]:(100*(1-t*e/360)).toString())},F.prototype.ComputeTBILLYIELD=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z.isNullOrUndefined(n)||3!==n.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(n[0]),e=this.resolveNumberArg(n[1]),t=this.resolveNumberArg(n[2]),"string"==typeof r?r:"string"==typeof e?e:"string"==typeof t?t:(e=e-r)<=0||t<=0?this.parent.getErrorStrings()[$.CommonErrors.Num]:((100-t)/t*360/e).toString())},F.prototype.ComputeTBILLEQ=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.ComputeTBILLYIELD.apply(this,r),n=this.parent.getErrorStrings();return"string"==typeof e&&-1<n.indexOf(e)?e:(365*(n=this.parent.parseFloat(e))/(360-n*(this.resolveNumberArg(r[1])-this.resolveNumberArg(r[0])))).toString()},F.prototype.ComputeXNPV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]);if("string"==typeof n)return n;var i=[],o=[],s=this.parent.getCellCollection(r[1]),a=this.parent.getCellCollection(r[2]),l=Array.isArray(s)?s:[s],u=Array.isArray(a)?a:[a];if(l.length!==u.length||l.length<1)return e[$.CommonErrors.Num];for(var h=0;h<l.length;h++){var p=this.parent.getValueFromArg(l[h]),g=this.parent.getValueFromArg(u[h]);if(-1<e.indexOf(p))return p;if(-1<e.indexOf(g))return g;i.push(this.parent.parseFloat(p)),o.push(this.parent.parseFloat(g))}for(var f=o[0],m=0,h=0;h<i.length;h++)m+=i[h]/Math.pow(1+n,(o[h]-f)/365);return m.toString()},F.prototype.ComputeYIELD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.ComputePRICE.apply(this,r),n=this.parent.getErrorStrings();if("string"==typeof e&&(-1<n.indexOf(e)||e.match(/arguments/i)))return e;var i=this.parseBondArgs(r,6,7);if("string"==typeof i)return i;for(var o=this.parent.parseFloat(e),s=i.yld||.05,a=0;a<50;a++){i.yld=s;var l=this.parent.parseFloat(this.ComputePRICE(r[0],r[1],r[2],s.toString(),r[4],r[5],r[6]))-o;if(Math.abs(l)<1e-8)return s.toString();s+=1e-4*l}return s.toString()},F.prototype.ComputeYIELDDISC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<4||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=0;if(5===r.length&&""!==r[4]){var a=this.resolveNumberArg(r[4]);if("string"==typeof a)return a;s=Math.floor(a)}a=this.bond.daysBetween(e,n,s),e=this.bond.yearDays(s);return a<=0?this.parent.getErrorStrings()[$.CommonErrors.Num]:((o-i)/i*e/a).toString()},F.prototype.ComputeYIELDMAT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<5||6<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]),s=this.resolveNumberArg(r[3]),a=this.resolveNumberArg(r[4]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;if("string"==typeof a)return a;var l=0;if(6===r.length&&""!==r[5]){var u=this.resolveNumberArg(r[5]);if("string"==typeof u)return u;l=Math.floor(u)}u=this.bond.yearDays(l),n=this.bond.daysBetween(o,n,l),o=this.bond.daysBetween(o,i,l),i=a*n/u;return 0==i?e[$.CommonErrors.Num]:((100+s*o/u-a)/i).toString()};var kn,Pn,_n=F;function F(r){r=Pn.call(this,r)||this;return r.formulas=[{formulaName:"COUPDAYBS",category:"Financial",description:"Returns the number of days from the beginning of the coupon period to the settlement date."},{formulaName:"COUPDAYS",category:"Financial",description:"Returns the number of days in the coupon period that contains the settlement date."},{formulaName:"COUPDAYSNC",category:"Financial",description:"Returns the number of days from the settlement date to the next coupon date."},{formulaName:"COUPNCD",category:"Financial",description:"Returns the next coupon date after the settlement date."},{formulaName:"COUPNUM",category:"Financial",description:"Returns the number of coupons payable between settlement and maturity."},{formulaName:"COUPPCD",category:"Financial",description:"Returns the previous coupon date before the settlement date."},{formulaName:"ACCRINT",category:"Financial",description:"Returns the accrued interest for a security that pays periodic interest."},{formulaName:"ACCRINTM",category:"Financial",description:"Returns the accrued interest for a security that pays interest at maturity."},{formulaName:"ISPMT",category:"Financial",description:"Returns the interest paid during a specific period of an investment."},{formulaName:"MDURATION",category:"Financial",description:"Returns the modified Macauley duration for a security with an assumed par value of $100."},{formulaName:"PRICE",category:"Financial",description:"Returns the price per $100 face value of a security that pays periodic interest."},{formulaName:"PRICEDISC",category:"Financial",description:"Returns the price per $100 face value of a discounted security."},{formulaName:"PRICEMAT",category:"Financial",description:"Returns the price per $100 face value of a security that pays interest at maturity."},{formulaName:"TBILLEQ",category:"Financial",description:"Returns the bond-equivalent yield for a Treasury bill."},{formulaName:"TBILLPRICE",category:"Financial",description:"Returns the price per $100 face value for a Treasury bill."},{formulaName:"TBILLYIELD",category:"Financial",description:"Returns the yield for a Treasury bill."},{formulaName:"XNPV",category:"Financial",description:"Returns the net present value for a schedule of cash flows that is not necessarily periodic."},{formulaName:"YIELD",category:"Financial",description:"Returns the yield on a security that pays periodic interest."},{formulaName:"YIELDDISC",category:"Financial",description:"Returns the annual yield for a discounted security."},{formulaName:"YIELDMAT",category:"Financial",description:"Returns the annual yield of a security that pays interest at maturity."}],r.bond=new Ln(r.parent),r}Wn=function(r,t){return(Wn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Wn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Xn,qn=t),Xn.prototype.ComputeAMORLINC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s,a,l=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<6||7<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),a=this.resolveNumberArg(r[1]),n=this.resolveNumberArg(r[2]),i=this.resolveNumberArg(r[3]),o=this.resolveNumberArg(r[4]),s=this.resolveNumberArg(r[5]),"string"==typeof e?e:"string"==typeof a?a:"string"==typeof n?n:"string"==typeof i?i:"string"==typeof o?o:"string"==typeof s?s:(a=Math.floor(o))<0?l[$.CommonErrors.Num]:Math.min((e-i)*s*(a+1),e-i).toString())},Xn.prototype.ComputeAMORDEGRC=function(){for(var r,t,e,n,i,o,s,a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];return z.isNullOrUndefined(a)||a.length<7||8<a.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(a[0]),t=this.resolveNumberArg(a[1]),e=this.resolveNumberArg(a[2]),n=this.resolveNumberArg(a[3]),i=this.resolveNumberArg(a[4]),o=this.resolveNumberArg(a[5]),s=8<=a.length?this.resolveNumberArg(a[7]):0,"string"==typeof r?r:"string"==typeof t?t:"string"==typeof e?e:"string"==typeof n?n:"string"==typeof i?i:"string"==typeof o?o:"string"==typeof s?s:this.ComputeAMORLINC(a[0],a[1],a[2],a[3],a[4],(o*(o<.03?1:o<.05?1.5:o<.1?2:2.5)).toString()))},Xn.prototype.oddBondPrice=function(r,t){if(z.isNullOrUndefined(r)||r.length<7||9<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]),s=this.resolveNumberArg(r[4]),a=this.resolveNumberArg(r[5]),l=this.resolveNumberArg(r[6]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;if("string"==typeof a)return a;if("string"==typeof l)return l;var u=8<=r.length&&""!==r[7]?this.resolveNumberArg(r[7]):2,i=9<=r.length&&""!==r[8]?this.resolveNumberArg(r[8]):0;if("string"==typeof u)return u;if("string"==typeof i)return i;var h=this.bond.coupNum(e,n,u,i),p=100*s/u,g=this.bond.daysBetween(e,t?o:n,i),f=this.bond.coupDays(e,n,u,i)||180,m=l/Math.pow(1+a/u,h+g/f);m+=p*g/f;for(var c=1;c<=h;c++)m+=p/Math.pow(1+a/u,c-1+g/f);return m.toString()},Xn.prototype.ComputeODDFPRICE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.oddBondPrice(r,!0)},Xn.prototype.ComputeODDLPRICE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.oddBondPrice(r,!1)},Xn.prototype.oddBondYield=function(r,t){for(var e=t[6],n=.05,i=this.parent.parseFloat(this.resolveNumberArg(e)),o=0;o<50;o++){var s=t.slice(0,6).concat([n.toString()],t.slice(7)),s=this.parent.parseFloat(r.apply(void 0,s))-i;if(Math.abs(s)<1e-6)return n.toString();n-=1e-4*s}return n.toString()},Xn.prototype.ComputeODDFYIELD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return z.isNullOrUndefined(r)||r.length<8||9<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:this.oddBondYield(this.ComputeODDFPRICE.bind(this),r)},Xn.prototype.ComputeODDLYIELD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return z.isNullOrUndefined(r)||r.length<8||9<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:this.oddBondYield(this.ComputeODDLPRICE.bind(this),r)};var Wn,qn,Bn=Xn;function Xn(r){r=qn.call(this,r)||this;return r.formulas=[{formulaName:"AMORDEGRC",category:"Financial",description:"Returns the depreciation for each accounting period using a depreciation coefficient."},{formulaName:"AMORLINC",category:"Financial",description:"Returns the depreciation for each accounting period."},{formulaName:"ODDFPRICE",category:"Financial",description:"Returns the price per $100 face value of a security with an odd first period."},{formulaName:"ODDFYIELD",category:"Financial",description:"Returns the yield of a security with an odd first period."},{formulaName:"ODDLPRICE",category:"Financial",description:"Returns the price per $100 face value of a security with an odd last period."},{formulaName:"ODDLYIELD",category:"Financial",description:"Returns the yield of a security with an odd last period."}],r.bond=new Ln(r.parent),r}Yn=function(r,t){return(Yn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Yn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Zn,Hn=Bt),Zn.prototype.ComputeBETADIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=0,a=1;if(4<=r.length&&""!==r[3]){var l=this.resolveNumberArg(r[3]);if("string"==typeof l)return l;s=l}if(5<=r.length&&""!==r[4]){var l=this.resolveNumberArg(r[4]);if("string"==typeof l)return l;a=l}return n<s||a<n||i<=0||o<=0||a<=s||(l=Ir((n-s)/(a-s),i,o),isNaN(l))?e[$.CommonErrors.Num]:l.toString()},Zn.prototype.ComputeBETAINV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=0,a=1;if(4<=r.length&&""!==r[3]){var l=this.resolveNumberArg(r[3]);if("string"==typeof l)return l;s=l}if(5<=r.length&&""!==r[4]){l=this.resolveNumberArg(r[4]);if("string"==typeof l)return l;a=l}l=Mr(n,i,o);return isNaN(l)?e[$.CommonErrors.Num]:(s+l*(a-s)).toString()},Zn.prototype.ComputeTDIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]);if("string"==typeof e)return e;if("string"==typeof n)return n;var i=1;if(3===r.length&&""!==r[2]){var o=this.resolveNumberArg(r[2]);if("string"==typeof o)return o;i=Math.floor(o)}o=Rr(Math.abs(e),n);return(1===i?1-o:2*(1-o)).toString()},Zn.prototype.ComputeTINV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;var o=2;if(3===r.length&&""!==r[2]){var s=this.resolveNumberArg(r[2]);if("string"==typeof s)return s;o=Math.floor(s)}s=Tr(1===o?1-n:1-n/2,i);return isNaN(s)?e[$.CommonErrors.Num]:s.toString()},Zn.prototype.ComputeTTEST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.collectSample([r[0]],!1),i=this.collectSample([r[1]],!1);if("string"==typeof n)return n;if("string"==typeof i)return i;if(n.length<2||i.length<2)return e[$.CommonErrors.DivZero];for(var o=this.mean(n),s=this.mean(i),a=0,l=0,u=0;u<n.length;u++)a+=Math.pow(n[u]-o,2);for(u=0;u<i.length;u++)l+=Math.pow(i[u]-s,2);a/=n.length-1,l/=i.length-1;var h=Math.sqrt(a/n.length+l/i.length);if(0===h)return e[$.CommonErrors.DivZero];var e=Math.abs(o-s)/h,h=n.length+i.length-2,p=2;if(4===r.length&&""!==r[3]){var g=this.resolveNumberArg(r[3]);if("string"==typeof g)return g;p=Math.floor(g)}g=Rr(e,h);return(1===p?1-g:2*(1-g)).toString()},Zn.prototype.ComputeFTEST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.collectSample([r[0]],!1),n=this.collectSample([r[1]],!1),"string"==typeof e?e:"string"==typeof n?n:e.length<2||n.length<2||(i=this.sampleVar(e),0===(o=this.sampleVar(n)))?s[$.CommonErrors.DivZero]:(s=i/o,i=e.length-1,o=n.length-1,(2*Math.min(Er(s,i,o),Er(1/s,o,i))).toString()))},Zn.prototype.sampleVar=function(r){for(var t=this.mean(r),e=0,n=0;n<r.length;n++)e+=Math.pow(r[n]-t,2);return e/(r.length-1)},Zn.prototype.ComputeFREQUENCY=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.collectSample([r[0]],!1),i=this.collectSample([r[1]],!1);if("string"==typeof n)return n;if("string"==typeof i)return i;if(0===i.length)return e[$.CommonErrors.Num];for(var o=i.slice().sort(function(r,t){return r-t}),s=new Array(o.length+1).fill(0),a=0;a<n.length;a++){for(var l=n[a],u=!1,h=0;h<o.length;h++)if(l<=o[h]){s[h]++,u=!0;break}u||s[s.length-1]++}e=this.parent.getParseArgumentSeparator();return s.join(e)};var Yn,Hn,Gn=Zn;function Zn(r){r=Hn.call(this,r)||this;return r.formulas=[{formulaName:"BETADIST",category:"Statistical",description:"Returns the beta cumulative distribution function."},{formulaName:"BETAINV",category:"Statistical",description:"Returns the inverse of the beta cumulative distribution function."},{formulaName:"TDIST",category:"Statistical",description:"Returns the Student t-distribution."},{formulaName:"TINV",category:"Statistical",description:"Returns the inverse of the Student t-distribution."},{formulaName:"TTEST",category:"Statistical",description:"Returns the probability associated with a Student t-test."},{formulaName:"FTEST",category:"Statistical",description:"Returns the result of an F-test."},{formulaName:"FREQUENCY",category:"Statistical",description:"Returns the frequency distribution of a range of values."}],r}Kn=function(r,t){return(Kn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Kn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(x,$n=t),x.prototype.readRange=function(r){var t=this.parent.getErrorStrings();if(!this.parent.isCellReference(r))return t[$.CommonErrors.Value];for(var t=-1<r.indexOf(":")?r.split(":"):[r,r],r=this.parent.rowIndex(t[0]),e=this.parent.colIndex(t[0]),n=this.parent.rowIndex(t[1]),t=this.parent.colIndex(t[1]),i=Math.min(r,n),o=Math.max(r,n),s=Math.min(e,t),a=Math.max(e,t),l=[],u=i;u<=o;u++){for(var h=[],p=s;p<=a;p++){var g=J(p)+u;h.push(this.parent.getValueFromArg(g))}l.push(h)}return l},x.prototype.fieldIndex=function(r,t){var e=this.parent.getErrorStrings(),r=this.resolveTextArg(r);if(-1<e.indexOf(r))return r;var n=this.parent.parseFloat(r);if(!isNaN(n)&&1<=n&&n<=t.length)return Math.floor(n)-1;for(var i=r.toUpperCase(),o=0;o<t.length;o++)if(t[o].toUpperCase()===i)return o;return e[$.CommonErrors.Value]},x.prototype.matchCriteria=function(r,t,e){for(var n=0;n<t.length;n++){for(var i=t[n],o=!0,s=0;s<e.length;s++){var a=i[s];if(void 0!==a&&""!==a){var l=r[s];if(!this.matchesCriterion(l,a)){o=!1;break}}}if(o)return!0}return!1},x.prototype.matchesCriterion=function(r,t){var e=t.trim();if(""===e)return!0;for(var n=[">=","<=","<>",">","<","="],i=0;i<n.length;i++){var o=n[i];if(e.startsWith(o)){var s=e.substring(o.length).trim(),a=this.parent.parseFloat(r),l=this.parent.parseFloat(s);if(!isNaN(a)&&!isNaN(l))switch(o){case">=":return l<=a;case"<=":return a<=l;case"<>":return a!==l;case">":return l<a;case"<":return a<l;case"=":return a===l;default:return o}return"="===o||""===o?r.toUpperCase()===s.toUpperCase():"<>"===o&&r.toUpperCase()!==s.toUpperCase()}}return e.includes("*")||e.includes("?")?new RegExp("^"+e.replace(/\*/g,".*").replace(/\?/g,".")+"$","i").test(r):r.toUpperCase()===e.toUpperCase()},x.prototype.collectMatching=function(r,t,e,n){var i=this.readRange(r);if("string"==typeof i)return i;if(i.length<2)return this.parent.getErrorStrings()[$.CommonErrors.Value];var o=i[0],s=this.fieldIndex(t,o);if("string"==typeof s)return s;r=this.readRange(e);if("string"==typeof r)return r;if(r.length<2)return this.parent.getErrorStrings()[$.CommonErrors.Value];for(var a=r[0],l=r.slice(1),u=[],h=this,p=1;p<i.length;p++)!function(r){var e=i[r],r=o.map(function(r,t){return e[t]||""}),t=l.map(function(e){return a.map(function(r,t){return e[t]||""})});if(!h.matchCriteria(r,t,o))return;r=e[s]||"";""!==r&&h.parent.isNumber(r)&&u.push(h.parent.parseFloat(r))}(p);return u},x.prototype.requireThree=function(r){return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:null},x.prototype.mean=function(r){return r.reduce(function(r,t){return r+t},0)/r.length},x.prototype.variance=function(r,t){for(var e=this.mean(r),n=0,i=0;i<r.length;i++)n+=Math.pow(r[i]-e,2);return n/(t?r.length:r.length-1)},x.prototype.ComputeDAVERAGE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireThree(r);return e||("string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:0===e.length?this.parent.getErrorStrings()[$.CommonErrors.DivZero]:this.mean(e).toString())},x.prototype.ComputeDCOUNT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireThree(r);return e||("string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:e.length.toString())},x.prototype.ComputeDCOUNTA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireThree(r);if(e)return e;var n=this.readRange(r[0]);if("string"==typeof n)return n;var i=n[0],o=this.fieldIndex(r[1],i);if("string"==typeof o)return o;var s=this.readRange(r[2]);if("string"==typeof s)return s;for(var a=s.slice(1),l=0,u=1;u<n.length;u++){var h=n[u],p=a.map(function(e){return s[0].map(function(r,t){return e[t]||""})});this.matchCriteria(h,p,i)&&""!==(h[o]||"")&&l++}return l.toString()},x.prototype.ComputeDGET=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.requireThree(r);return n||(n=this.parent.getErrorStrings(),"string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!1))?e:0===e.length?n[$.CommonErrors.NA]:1<e.length?n[$.CommonErrors.Num]:e[0].toString())},x.prototype.ComputeDMAX=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireThree(r);return e||("string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:0===e.length?this.parent.getErrorStrings()[$.CommonErrors.NA]:Math.max.apply(Math,e).toString())},x.prototype.ComputeDMIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireThree(r);return e||("string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:0===e.length?this.parent.getErrorStrings()[$.CommonErrors.NA]:Math.min.apply(Math,e).toString())},x.prototype.ComputeDPRODUCT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireThree(r);return e||("string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:0===e.length?"0":e.reduce(function(r,t){return r*t},1).toString())},x.prototype.ComputeDSUM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireThree(r);return e||("string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:e.reduce(function(r,t){return r+t},0).toString())},x.prototype.ComputeDSTDEV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.requireThree(r);return n||(n=this.parent.getErrorStrings(),"string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:e.length<2?n[$.CommonErrors.DivZero]:Math.sqrt(this.variance(e,!1)).toString())},x.prototype.ComputeDSTDEVP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.requireThree(r);return n||(n=this.parent.getErrorStrings(),"string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:e.length<1?n[$.CommonErrors.DivZero]:Math.sqrt(this.variance(e,!0)).toString())},x.prototype.ComputeDVAR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.requireThree(r);return n||(n=this.parent.getErrorStrings(),"string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:e.length<2?n[$.CommonErrors.DivZero]:this.variance(e,!1).toString())},x.prototype.ComputeDVARP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.requireThree(r);return n||(n=this.parent.getErrorStrings(),"string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:e.length<1?n[$.CommonErrors.DivZero]:this.variance(e,!0).toString())};var Kn,$n,zn=x;function x(r){r=$n.call(this,r)||this;return r.formulas=[{formulaName:"DAVERAGE",category:"Database",description:"Averages the values in a column of a list or database that match criteria."},{formulaName:"DCOUNT",category:"Database",description:"Counts the cells that contain numbers in a column of a list or database that match criteria."},{formulaName:"DCOUNTA",category:"Database",description:"Counts nonblank cells in a column of a list or database that match criteria."},{formulaName:"DGET",category:"Database",description:"Extracts a single value from a column of a list or database that matches criteria."},{formulaName:"DMAX",category:"Database",description:"Returns the maximum value from a column of a list or database that matches criteria."},{formulaName:"DMIN",category:"Database",description:"Returns the minimum value from a column of a list or database that matches criteria."},{formulaName:"DPRODUCT",category:"Database",description:"Multiplies values in a column of a list or database that match criteria."},{formulaName:"DSTDEV",category:"Database",description:"Estimates the standard deviation of a population based on a sample of entries that match criteria."},{formulaName:"DSTDEVP",category:"Database",description:"Calculates the standard deviation of a population based on entries that match criteria."},{formulaName:"DSUM",category:"Database",description:"Adds the numbers in the field column of records in the database that match the criteria."},{formulaName:"DVAR",category:"Database",description:"Estimates variance based on a sample of entries that match criteria."},{formulaName:"DVARP",category:"Database",description:"Calculates variance based on the entire population of entries that match criteria."}],r}Qn=function(r,t){return(Qn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Qn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(ti,Jn=Bt),ti.prototype.linearRegression=function(r,t){t=this.collectPair([t,r]);if("string"==typeof t)return t;var e=t.x,n=t.y;if(e.length<2)return this.parent.getErrorStrings()[$.CommonErrors.NA];for(var i=this.mean(e),o=this.mean(n),s=0,a=0,l=0;l<e.length;l++){var u=e[l]-i;s+=u*u,a+=u*(n[l]-o)}return 0===s?this.parent.getErrorStrings()[$.CommonErrors.DivZero]:{slope:r=a/s,intercept:o-r*i}},ti.prototype.expRegression=function(r,t){t=this.collectPair([t,r]);if("string"==typeof t)return t;var e=t.x,n=t.y,i=this.parent.getErrorStrings();if(e.length<2)return i[$.CommonErrors.NA];for(var o=[],s=0;s<n.length;s++){if(n[s]<=0)return i[$.CommonErrors.Num];o.push(Math.log(n[s]))}for(var a=this.mean(e),l=this.mean(o),u=0,h=0,s=0;s<e.length;s++){var p=e[s]-a;u+=p*p,h+=p*(o[s]-l)}return 0===u?i[$.CommonErrors.DivZero]:(r=h/u,{b:Math.exp(l-r*a),m:r})},ti.prototype.ComputeLINEST=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||t.length<2||4<t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.linearRegression(t[0],t[1]))?r:r.slope.toString()},ti.prototype.ComputeLOGEST=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||t.length<2||4<t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.expRegression(t[0],t[1]))?r:r.b.toString()},ti.prototype.ComputeTREND=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.linearRegression(r[0],r[1]);if("string"==typeof e)return e;if(3===r.length&&""!==r[2]){var n=this.collectSample([r[2]],!1);if("string"==typeof n)return n;if(0===n.length)return this.parent.getErrorStrings()[$.CommonErrors.NA];n=n[0]}else{var i=this.collectSample([r[1]],!1);if("string"==typeof i)return i;n=i[i.length-1]+1}return(e.intercept+e.slope*n).toString()},ti.prototype.ComputeGROWTH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.expRegression(r[0],r[1]);if("string"==typeof e)return e;if(3===r.length&&""!==r[2]){var n=this.collectSample([r[2]],!1);if("string"==typeof n)return n;if(0===n.length)return this.parent.getErrorStrings()[$.CommonErrors.NA];n=n[0]}else{var i=this.collectSample([r[1]],!1);if("string"==typeof i)return i;n=i[i.length-1]+1}return(e.b*Math.pow(Math.E,e.m*n)).toString()};var Qn,Jn,ri=ti;function ti(r){r=Jn.call(this,r)||this;return r.formulas=[{formulaName:"LINEST",category:"Statistical",description:"Returns statistics that describe a linear trend."},{formulaName:"LOGEST",category:"Statistical",description:"Returns statistics that describe an exponential curve."},{formulaName:"GROWTH",category:"Statistical",description:"Returns numbers in an exponential growth trend."},{formulaName:"TREND",category:"Statistical",description:"Returns numbers in a linear trend."}],r}ni.prototype.init=function(){for(var r=0;r<this.formulas.length;r++){var t=this.formulas[r],e=this["Compute"+t.formulaName];this.addFormulaCollection(t.formulaName.toUpperCase(),e,t.category,t.description)}},ni.prototype.addFormulaCollection=function(r,t,e,n){this.parent.libraryFormulas={fName:r,handler:t,category:e,description:n}};var ei=ni;function ni(r){this.formulas=[],this.isConcat=!1,this.parent=r;for(var t=[new W(this),new Z(this),new tr(this),new ir(this),new ar(this),new wr(this),new Pr(this),new zr(this),new tt(this),new it(this),new lt(this),new gt(this),new dt(this),new Et(this),new bt(this),new xt(this),new It(this),new Ut(this),new Lt(this),new _t(this),new Gt(this),new zt(this),new te(this),new oe(this),new le(this),new ge(this),new ce(this),new ve(this),new ye(this),new Ae(this),new xe(this),new Ie(this),new we(this),new ke(this),new qe(this),new He(this),new ze(this),new tn(this),new on(this),new ln(this),new gn(this),new dn(this),new En(this),new bn(this),new xn(this),new In(this),new wn(this),new _n(this),new Bn(this),new Gn(this),new zn(this),new ri(this)],e=0;e<t.length;e++)for(var n=t[e],i=0;i<n.formulas.length;i++){var o=n.formulas[i],s=(this.formulas.push(o),"Compute"+o.formulaName),o=-1<o.formulaName.indexOf(".")?n[s]:z.getValue(s,n);o&&(this[s]=o.bind(n))}this.init()}function ii(r,t){for(var e=t.length,n=0;n<e;n++)if(t[n].sheet.toUpperCase()===r.toUpperCase())return t[n].index;return-1}V.prototype.parse=function(t,e){var n=this;if(!this.parent.isTextEmpty(t)){if(D(t))return this.parent.getErrorStrings()[$.CommonErrors.Ref];this.parent.getFormulaCharacter()!==String.fromCharCode(0)&&this.parent.getFormulaCharacter()===t[0]&&(t=t.substring(1)),(0<this.parent.namedRanges.size||0<this.parent.storedData.size)&&(t=this.checkForNamedRangeAndKeyValue(t),this.findNamedRange=!1);var r,i,o=this.storeStrings(t),s=(t=(t=(t=this.storedStringText).replace(/[-+*/&^]+/g,function(r){for(var t="";1<r.length;)switch(r.substring(0,2)){case"++":case"--":r="+"+r.substring(2);break;case"+-":case"-+":r="-"+r.substring(2);break;case"*+":r="*"+r.substring(2);break;case"/+":r="/"+r.substring(2);break;case"^+":r="^"+r.substring(2);break;case"&+":r="&"+r.substring(2);break;case"*-":case"/-":case"^-":case"&-":t=r.substring(0,1),r=r.substring(1);break;default:throw new U(n.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidExpression],!0)}return t+r})).split("-(-").join("("),0);-1<(t=(t=(t=(t=z.isNullOrUndefined(o)?t.split(" ").join(""):t).split("=>").join(">=")).split("=<").join("<="))[t.length-1]===this.parent.arithMarker&&this.indexOfAny(t,this.tokens)===t.length-2?t:t.toUpperCase()).indexOf(this.sheetToken)&&null!=(r=this.parent.getSheetFamilyItem(this.parent.grid)).sheetNameToParentObject&&0<r.sheetNameToParentObject.size&&(t[0]!==this.sheetToken.toString()&&(t=this.parent.setTokensForSheets(t)),r=this.parent.getSheetToken(t.split(this.parent.tic).join(this.emptyStr)),i=this.checkScopedRange(t.split('"').join(this.emptyStr).split(this.sheetToken).join("")),z.isNullOrUndefined(r))&&""!==r&&0<this.parent.namedRanges.size&&""!==i&&(t=i),t=this.processIndexArg(t),t=this.markLibraryFormulas(t);try{t=this.formulaAutoCorrection(t)}catch(r){if(!(u={message:r.message,exception:r,isForceCalculable:r.formulaCorrection,computeForceCalculate:!1}).isForceCalculable)throw this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidExpression];if(this.isFailureTriggered||(this.parent.trigger("onFailure",u),this.isFailureTriggered=!0),!u.isForceCalculable||!u.computeForceCalculate)throw this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidExpression];t=this.formulaAutoCorrection(t,u),this.parent.storedData.get(e).formulaText="="+t}if(!this.ignoreBracet)for(s=t.indexOf(")");-1<s;){var a=t.substring(0,s).lastIndexOf("(");if(-1===a)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.MismatchedParentheses]);if(a===s-1)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.EmptyExpression]);var l=this.emptyStr,l=this.ignoreBracet?this.parent.substring(t,a,s-a+1):this.parent.substring(t,a+1,s-a-1);try{t=t.substring(0,a)+this.parseSimple(l)+t.substring(s+1)}catch(r){if(r===this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CircularReference])throw r;var u=this.exceptionArgs(r),a=(this.isFailureTriggered||(this.parent.trigger("onFailure",u),this.isFailureTriggered=!0),"string"==typeof u.exception?u.exception:u.message);return(this.parent.getErrorLine(r)?"":"#"+this.parent.getErrorLine(r)+": ")+a}s=t.indexOf(")")}if(!this.ignoreBracet&&-1<t.indexOf("("))throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.MismatchedParentheses]);t=this.parseSimple(t),null!==o&&0<o.size&&(t=this.setStrings(t,o))}return t},V.prototype.exceptionArgs=function(r){return{message:r.message,exception:r,isForceCalculable:r.formulaCorrection,computeForceCalculate:!1}},V.prototype.formulaAutoCorrection=function(r,t,e){var n,i,o=["*","+","-","/","^","&"],s=[">","=","<"],a=0,l="",u="",h="",p=0;if(-1<this.parent.formulaErrorStrings.indexOf(r))return r;if(-1<this.indexOfAny(r,this.specialSym))throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidExpression],!1);for(r=r.split("-*").join("-").split("/*").join("/").split("*/").join("*").split("-/").join("-").split("*+").join("*").split("+*").join("+");a<r.length;)if(this.parent.isDigit(r[a])&&r.length>a+1&&-1<this.indexOfAny(r[a+1],o)&&r.length>a+2&&!z.isNullOrUndefined(r[a+2])&&-1<this.indexOfAny(r[a+2],o)&&("-"!==r[a+2]||"*"!==r[a+1]&&"/"!==r[a+1]&&"^"!==r[a+1]&&"&"!==r[a+1])){if(!t||!t.computeForceCalculate)throw this.parent.formulaErrorStrings[$.FormulasErrorsStrings.ImproperFormula];this.parent.isDigit(r[a])?(p<1?(i=r[a],u=r[a+1],p+=1,l=l+i+(u="&"===(u=z.isNullOrUndefined(u)?this.emptyStr:u)?"":u)):p<2&&(i=r[a],n=r[a-1],h=r[a+1],p=0,l="-"===n?l+n+i+(h="&"===(h=z.isNullOrUndefined(h)?this.emptyStr:h)?"":h):l+i+(h=z.isNullOrUndefined(h)?this.emptyStr:h)),a+=2):(l="-"===r[a]?l+r[a]:l,a+=1)}else if((this.parent.isDigit(r[a])||r[a]===this.parent.rightBracket||this.parent.storedData.has(r[a].toUpperCase()))&&(z.isNullOrUndefined(r[a+1])||-1<this.indexOfAny(r[a+1],o)&&"&"!==r[a+1]))n="&"===(n=z.isNullOrUndefined(r[a+1])?this.emptyStr:r[a+1])&&"-"!==r[a+2]?"":n,l="-"===r[a-1]?l+r[a-1]+r[a]+n:l+r[a]+n,a+=2;else if(-1<this.indexOfAny(r[a],s)&&!z.isNullOrUndefined(r[a-1])&&!z.isNullOrUndefined(r[a+1]))l+=r[a],a+=1;else if("q"===r[a])for(;r[a]!==this.parent.leftBracket;)l+=r[a],a+=1;else(r[a]===this.parent.leftBracket||r[a]===this.parent.rightBracket||"{"===r[a]||"}"===r[a]||"("===r[a]||")"===r[a]||this.parent.isUpperChar(r[a])||-1<r[a].indexOf(":")||r[a]===this.parent.getParseArgumentSeparator()||"%"===r[a]&&this.parent.isDigit(r[a-1])||this.isOtherLangChar(r[a])||r[a]===this.parent.tic||" "===r[a]||r[a]===this.parent.getParseDecimalSeparator()||r[a]===this.sheetToken||"$"===r[a]||"_"===r[a]||(this.parent.isDigit(r[a])&&(l="-"===r[a-1]?l+r[a-1]+r[a]:l+r[a]),"-"!==r[a]&&"+"!==r[a]||(l=(l+=r[a]).split("++").join("+").split("+-").join("-").split("-+").join("-")),"/"!==r[a]&&"*"!==r[a]&&"^"!==r[a]||(l+=r[a]),"&"===r[a]&&(e||"q"!==r.substring(a+1).trim()[0])))&&(l+=r[a]),a+=1;return l=l===this.emptyStr?r:l,l=(l=-1<this.indexOfAny(l[l.length-1],o)?l.substring(0,l.length-1):l).split("--").join("-").split("-+").join("-").split("+-").join("-")},V.prototype.checkScopedRange=function(n){var i,r,t,o=this,s=(this.emptyStr,"NaN"),e=this.parent.getSheetID(this.parent.grid),a=this.parent.getSheetFamilyItem(this.parent.grid),l=(n[0]===this.sheetToken.toString()&&(r=n.indexOf(this.sheetToken,1),t=parseInt(n.substr(1,r-1),10),1<r)&&!this.parent.isNaN(t)&&(n=n.substring(r+1),e=t),"!"+e.toString());return null!==a&&null!=a.sheetNameToToken&&a.sheetNameToToken.forEach(function(r,t){var e;a.sheetNameToToken.get(t).toString()===l+"!"&&(e=o.emptyStr,o.parent.namedRanges.forEach(function(r,t){e=z.isNullOrUndefined(o.parent.parentObject)?a.sheetNameToToken.get(t).toUpperCase():o.parent.parentObject.getActiveSheet().name+o.sheetToken+n.toUpperCase(),o.parent.getNamedRanges().has(e)&&(i=o.parent.getNamedRanges().get(e).toUpperCase(),s=i)}))}),s},V.prototype.storeStrings=function(r){var t,e,n,i=0,o=0,s=null;if(-1<r.indexOf(this.parent.tic))for(i=r.indexOf(this.parent.tic);-1<i&&0<r.length;){if(null===s&&(s=this.stringsColl),-1===(t=i+1<r.length?r.indexOf(this.parent.tic,i+1):-1))throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.MismatchedTics]);n=this.parent.substring(r,i,t-i+1),e=this.parent.tic+this.spaceString+o.toString()+this.parent.tic,s=s.set(e,n),r=r.substring(0,i)+e+r.substring(t+1),(i+=e.length)<=r.length&&(i=r.indexOf(this.parent.tic,i)),o++}return this.storedStringText=r,s},V.prototype.setStrings=function(e,r){return r.forEach(function(r,t){e=e.split(t).join(r)}),e},V.prototype.parseSimple=function(r){var t,e,n,i,o,s,a,l,u,h,p,g;return"#DIV/0!"===(r=0<r.length&&"+"===r[0]?r.substring(1):r)?"#DIV/0!":"#NAME?"===r?"#NAME?":(""===r||-1<this.parent.formulaErrorStrings.indexOf(r)||(r=(r=(r=(r=(r=(r=r.split(this.stringLessEq).join(this.charLessEq)).split(this.stringGreaterEq).join(this.charGreaterEq)).split(this.stringNoEqual).join(this.charNoEqual)).split(this.stringAnd).join(this.charAnd)).split(this.stringOr).join(this.charOr)).split(this.fixedReference).join(this.emptyStr),t=[this.tokenEp,this.tokenEm],e=[this.tokenMultiply,this.tokenDivide],n=[this.tokenAdd,this.tokenSubtract],i=[this.charMultiply,this.charDivide],o=[this.charAdd,this.charSubtract],s=[this.tokenLess,this.tokenGreater,this.tokenEqual,this.tokenLessEq,this.tokenGreaterEq,this.tokenNotEqual],a=[this.charLess,this.charGreater,this.charEqual,this.charLessEq,this.charGreaterEq,this.charNoEqual],l=[this.charEp,this.charEm],u=[this.tokenAnd],h=[this.charAnd],p=[this.charOr],g=[this.tokenOr],r=this.parseSimpleOperators(r,t,l),r=this.parseSimpleOperators(r,g,p),r=this.parseSimpleOperators(r,e,i),r=this.parseSimpleOperators(r,n,o),r=this.parseSimpleOperators(r,s,a),r=this.parseSimpleOperators(r,u,h)),r)},V.prototype.parseSimpleOperators=function(r,t,e){if(-1<this.parent.getErrorStrings().indexOf(r))return r;for(var n=r,i=0,o="",s=0;s<e.length;s++)o+=e[s];0<(n=(n=(n=n.split("---").join("-").split("--").join("+").split(this.parent.getParseArgumentSeparator()+"-").join(this.parent.getParseArgumentSeparator()+"u").split(this.parent.leftBracket+"-").join(this.parent.leftBracket+"u").split("=-").join("=u")).split(",+").join(",").split(this.parent.leftBracket+"+").join(this.parent.leftBracket).split("=+").join("=").split(">+").join(">").split("<+").join("<").split("/+").join("/").split("*+").join("*").split("++").join("+").split("*-").join("*u").split("/-").join("/u").split("w-").join("wu").split("i-").join("iu").toString()).split(">-").join(">u").split("<-").join("<u").split("h-").join("hu").split("f-").join("fu").split("z-").join("zu")).length&&"-"===n[0]?(r=String.fromCharCode(132),n=n.substring(1).split("-").join(r),n=(n=this.parseSimpleOperators(n="0-"+n,[this.tokenSubtract],[this.charSubtract])).split(r).join("-")):0<n.length&&"+"===n[0]?n=n.substring(1):0<n.length&&"+"===n[n.length-1]&&(n=n.substring(0,n.length-1));try{if(-1<this.indexOfAny(n,e)){if(n.includes(" ")){for(var a="",l=0;l<n.length;l++){var u=n[l];0<=e.indexOf(u)?a=a.trim()+u:" "===u&&0<=e.indexOf(a[a.length-1])||(a+=u)}n=a}for(var i=this.indexOfAny(n,e),h=this.parent.getParseDecimalSeparator();-1<i;){var p="",g="",f=0,m=0,c=!1,d=["*","+","-","/","w","=","<",">"],N=n[i]===this.charNOTop,v=0;if(N)f=i;else if(n[v=i-1]===this.parent.arithMarker){if((S=this.findLeftMarker(n.substring(0,v-1)))<0)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CannotParse]);p=this.parent.substring(n,S+1,v-S-1),f=S+1}else if(n[v]===this.parent.rightBracket){for(var E=0,S=v-1;0<S&&("q"!==n[S]||0!==E);)"q"===n[S]?E--:n[S]===this.parent.rightBracket&&E++,S--;if(S<0)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CannotParse]);p=this.parent.substring(n,S,v-S+1),f=S}else if(n[v]===this.parent.tic[0]){var y=n.substring(0,v-1).lastIndexOf(this.parent.tic);if(y<0)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CannotParse]);p=this.parent.substring(n,y,v-y+1),f=y}else{for(var C=!1;-1<v&&(this.parent.isDigit(n[v])||!C&&(n[v]===h||"%"===n[v]));)this.parent.isDigit(n[v])||"%"===n[v]||(C=!0),v-=1;if(-1<v&&C&&n[v]===h)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.NumberContains2DecimalPoints]);if(0===(v+=1)||0<v&&!this.parent.isUpperChar(n[v-1]))p="n"+this.parent.substring(n,v,i-v),f=v;else if(0<v&&"E"===n[v-1]&&("TRUE"===n.substring(v-4,v)&&(z.isNullOrUndefined(n[v-5])||-1<d.indexOf(n[v-5]))||"FALSE"===n.substring(v-5,v)&&(z.isNullOrUndefined(n[v-6])||-1<d.indexOf(n[v-6])))&&("TRUE"===n.substring(v+1,v+5)||"FALSE"===n.substring(v+1,v+6)))v="TRUE"===n.substring(v-4,v)?v-4:v-5,p="TRUE"===n.substring(v,i)?"n1":"FALSE"===n.substring(v,i)?"n0":p,f=v,c=!0;else{for(v-=1;-1<v&&(this.parent.isUpperChar(n[v])||this.parent.isDigit(n[v])||"_"===n[v]);)v-=1;if(-1<v&&n[v]===this.sheetToken){for(v-=1;-1<v&&n[v]!==this.sheetToken;)v-=1;-1<v&&n[v]===this.sheetToken&&(v-=1)}if(-1<v&&":"===n[v]){for(v-=1;-1<v&&this.parent.isDigit(n[v]);)v-=1;for(;-1<v&&this.parent.isUpperChar(n[v]);)v-=1;if(-1<v&&n[v]===this.sheetToken){for(v--;-1<v&&n[v]!==this.sheetToken;)v--;-1<v&&n[v]===this.sheetToken&&v--}v+=1,p=this.parent.substring(n,v,i-v),p=this.parent.getCellFrom(p)}else{var b=!1;(b=0<v&&!this.parent.isUpperChar(n[v])?"u"===n[v]&&n[v-1]===this.parent.getParseArgumentSeparator():b)||(v+=1),p=this.parent.substring(n,v,i-v)}this.parent.updateDependentCell(p),f=v}(0<this.parent.namedRanges.size&&this.parent.namedRanges.has(p.toUpperCase())||this.parent.storedData.has(p.toUpperCase()))&&(p="n"+this.checkForNamedRangeAndKeyValue(p))}if(i===n.length-1)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.ExpressionCannotEndWithAnOperator]);if((b="u"===n[v=i+1])&&(v+=1),n[v]===this.parent.tic[0]){if((S=n.substring(v+1).indexOf(this.parent.tic))<0)throw this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CannotParse];g=this.parent.substring(n,v,S+2),m=S+v+2}else if(n[v]===this.parent.arithMarker){if((S=this.findRightMarker(n.substring(v+1)))<0)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CannotParse]);g=this.parent.substring(n,v+1,S),m=S+v+2}else if("q"===n[v]){for(E=0,S=v+1;S<n.length&&(n[S]!==this.parent.rightBracket||0!==E);)n[S]===this.parent.rightBracket?E++:"q"===n[S]&&E--,S++;if(S===n.length)throw this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CannotParse];g=this.parent.substring(n,v,S-v+1),b&&(g="u"+g),m=S+1}else if(this.parent.isDigit(n[v])||n[v]===h){C=n[v]===h;for(v+=1;v<n.length&&(this.parent.isDigit(n[v])||!C&&n[v]===h);)n[v]===h&&(C=!0),v+=1;if(v<n.length&&"%"===n[v]&&(v+=1),C&&v<n.length&&n[v]===h)throw this.parent.formulaErrorStrings[$.FormulasErrorsStrings.NumberContains2DecimalPoints];g="n"+this.parent.substring(n,i+1,v-i-1),m=v}else if(this.parent.isUpperChar(n[v])||n[v]===this.sheetToken||"u"===n[v]){if(n[v]===this.sheetToken)for(v+=1;v<n.length&&n[v]!==this.sheetToken;)v+=1;v+=1;for(var A=0,O=!1;v<n.length&&(this.parent.isUpperChar(n[v])||"_"===n[v]||n[v]===h||"["===n[v]||"]"===n[v]||"#"===n[v]||" "===n[v]||"%"===n[v]||n[v]===h&&O);)v!==n.length-1&&"["===n[v]&&"["===n[v+1]&&(O=!0),v!==n.length-1&&"]"===n[v]&&"]"===n[v+1]&&(O=!1),v++,A++;var F=v===n.length||!this.parent.isDigit(n[v]);if(1<A){for(;v<n.length&&(this.parent.isUpperChar(n[v])||this.parent.isDigit(n[v])||" "===n[v]||"_"===n[v]);)v++;F=!0}for(;v<n.length&&this.parent.isDigit(n[v]);)v+=1;if(v<n.length&&":"===n[v]){if((v+=1)<n.length&&n[v]===this.sheetToken){for(v++;v<n.length&&n[v]!==this.sheetToken;)v+=1;v<n.length&&n[v]===this.sheetToken&&v++}for(;v<n.length&&this.parent.isUpperChar(n[v]);)v+=1;for(;v<n.length&&this.parent.isDigit(n[v]);)v+=1;v-=1,g=this.parent.substring(n,i+1,v-i),g=this.parent.getCellFrom(g)}else v-=1,g=this.parent.substring(n,i+1,v-i),(b="u"===n[v])&&(g="u"+g);(F=F&&g.startsWith(this.sheetToken)?!this.parent.isCellReference(g):F)||this.parent.updateDependentCell(g),(0<this.parent.namedRanges.size&&this.parent.namedRanges.has(g.toUpperCase())||this.parent.storedData.has(g.toUpperCase()))&&(g="n"+this.checkForNamedRangeAndKeyValue(g));var x=-1<["*","+","-","/","w"].indexOf(n[v-g.length]),g="TRUE"===g&&(c||x)?"n1":"FALSE"===g&&(c||x)?"n0":g,m=v+1}var V=o.indexOf(n[i]),R=this.parent.arithMarker+p+g+t[V]+this.parent.arithMarker;0<f&&(R=n.substring(0,f)+R),m<n.length&&(R+=n.substring(m)),n=R=R.split(this.parent.arithMarker2).join(this.parent.arithMarker.toString()),i=this.indexOfAny(n,e)}}else if(0<n.length&&(this.parent.isUpperChar(n[0])||n[0]===this.sheetToken)){for(var T=!0,I=!0,M=!1,D=n.length,S=0;S<D;++S)if(n[S]===this.sheetToken){if(0<S&&!M)throw this.parent.getErrorStrings()[$.CommonErrors.Ref];for(M=!0,S++;S<D&&this.parent.isDigit(n[S]);)S++;if(S===D||n[S]!==this.sheetToken){T=!1;break}}else{if(!I&&this.parent.isChar(n[S])){T=!1;break}if(!this.parent.isChar(n[S])&&!this.parent.isDigit(n[S])&&n[S]!==this.sheetToken){T=!1;break}I=this.parent.isUpperChar(n[S])}T&&this.parent.updateDependentCell(n)}return n}catch(r){throw this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CircularReference],r}},V.prototype.indexOfAny=function(r,t){for(var e=0;e<r.length;e++)if(-1<t.indexOf(r[e]))return e;return-1},V.prototype.findLeftMarker=function(r){var t=-1;if(-1<r.indexOf(this.parent.arithMarker))for(var e=0,n=r.length-1;0<=n;--n)if(r[n]===this.parent.rightBracket)e--;else if(r[n]===this.parent.leftBracket)e++;else if(r[n]===this.parent.arithMarker&&0===e){t=n;break}return t},V.prototype.findRightMarker=function(r){var t=-1;if(-1<r.indexOf(this.parent.arithMarker))for(var e=0,n=0;n<r.length;++n)if(r[n]===this.parent.rightBracket)e--;else if(r[n]===this.parent.leftBracket)e++;else if(r[n]===this.parent.arithMarker&&0===e){t=n;break}return t},V.prototype.parseFormula=function(t,e){if(-1<(t=0<t.length&&t[0]===this.parent.getFormulaCharacter()?t.substring(1):t).indexOf("#REF!"))return this.parent.getErrorStrings()[$.CommonErrors.Ref];0<t.length&&"+"===t[0]&&(t=t.substring(1));try{this.isFailureTriggered=!1,this.isError=!1,t=this.parse(t.trim(),e),this.isFormulaParsed=!0}catch(r){e=this.exceptionArgs(r),e=(this.isFailureTriggered||(this.parent.trigger("onFailure",e),this.isFailureTriggered=!0),"string"==typeof e.exception?e.exception:e.message);t=(z.isNullOrUndefined(this.parent.getErrorLine(r))?"":"#"+this.parent.getErrorLine(r)+": ")+e,this.isError=!0}return t},V.prototype.markLibraryFormulas=function(g){var f=0,m=g.indexOf(")");if(-1===m)g=this.markNamedRanges(g);else for(var c=this;-1<m;){var r=function(){for(var r=0,t=m-1;-1<t&&("("!==g[t]||0!==r);)")"===g[t]&&r++,t--;if(-1===t)throw new U(c.parent.formulaErrorStrings[$.FormulasErrorsStrings.MismatchedParentheses]);for(var e=t-1;-1<e&&(c.parent.isChar(g[e])||c.parent.isDigit(g[e])||"."===g[e]);)e--;var n=t-e-1,i=c.parent.substring(g,e+1,n);if(0<n&&!z.isNullOrUndefined(c.parent.getFunction(i))&&(!i.includes(".")||c.isValidDotFormulaName(i))){var o=c.parent.substring(g,t,m-t+1),s=c.parent.getParseArgumentSeparator();if("AREAS"===i)c.ignoreBracet=!0;else if(c.ignoreBracet=!1,(i.includes("IFS")&&"COUNTIFS"!==i||"MATCH"===i)&&o.includes("{")&&(a=o.indexOf("{"),u=c.parent.substring(o,a,o.indexOf("}")-a+1),o=o.split(u).join(u.split(s).join(c.parent.tic+c.parent.tic))),("VLOOKUP"===i||"HLOOKUP"===i)&&o.includes("{"))for(var a=o.indexOf("{",0);-1<a;){var l=o.indexOf("}",a);if(!(a<l))break;var u,l=(u=c.parent.substring(o,a,l-a+1)).split(";").join(c.parent.tic+"RSEP"+c.parent.tic).split(s).join(c.parent.tic+"CSEP"+c.parent.tic);o=o.split(u).join(l),l=a+l.length,a=o.indexOf("{",l)}try{var h=void 0;o=o.split("(").join("").split(")").join(""),o="("+c.formulaAutoCorrection(o,h,!0)+")"}catch(r){if(!(h={message:r.message,exception:r,isForceCalculable:r.formulaCorrection,computeForceCalculate:!1}).isForceCalculable)throw c.parent.formulaErrorStrings[$.FormulasErrorsStrings.ImproperFormula];if(c.isFailureTriggered||(c.parent.trigger("onFailure",h),c.isFailureTriggered=!0,f+=1),h.computeForceCalculate=0<f||h.computeForceCalculate,!h.isForceCalculable)throw c.parent.formulaErrorStrings[$.FormulasErrorsStrings.ImproperFormula];if(!h.computeForceCalculate)throw c.parent.formulaErrorStrings[$.FormulasErrorsStrings.ImproperFormula];o=o.split("(").join("").split(")").join(""),o="("+c.formulaAutoCorrection(o,h)+")"}o=c.markNamedRanges(o),o=c.swapInnerParens(o),-1===(o=c.addParensToArgs(o)).lastIndexOf(s)&&2<o.length&&"("===o[0]&&")"===o[o.length-1]&&"{"!==o[1]&&"("!==o[1]&&(o=(o=o.substring(0,o.length-1)+"}"+o.substring(o.length-1))[0]+"{"+o.substring(1)),g=g.substring(0,e+1)+"q"+c.parent.substring(g,e+1,n)+o.split("(").join(c.parent.leftBracket).split(")").join(c.parent.rightBracket)+g.substring(m+1)}else{var p=function(r){var t;return!!r.includes("IFERROR(")&&(t=r.lastIndexOf("("),"IFERROR"===r.substring(t-7,t)||p(r.substring(0,t)))};if(0<n&&!p(g.substring(0,e+1)))return{value:c.parent.getErrorStrings()[$.CommonErrors.Name]};i=c.emptyStr,i=(i=0<t?g.substring(0,t):i)+"{"+c.parent.substring(g,t+1,m-t-1)+"}";m<g.length&&(i+=g.substring(m+1)),i=c.markNamedRanges(i),g=i}m=g.indexOf(")")}();if("object"==typeof r)return r.value}return g=g.split("{").join("(").split("}").join(")")},V.prototype.swapInnerParens=function(r){return r=2<r.length?r[0]+r.substr(1,r.length-2).split("(").join("{").split(")").join("}")+r[r.length-1]:r},V.prototype.addParensToArgs=function(r){if(0===r.length)return this.emptyStr;var t=[],e=(t.push(this.parent.getParseArgumentSeparator()),t.push(this.parent.rightBracket),r.lastIndexOf(this.parent.getParseArgumentSeparator())),n=0;if(-1===e)2<r.length&&"("===r[0]&&")"===r[r.length-1]&&("{"!==r[1]&&"("!==r[1]?r=(r=r.substring(0,r.length-1)+"}"+r.substring(r.length-1))[0]+"{"+r.substring(1):(e=this.lastIndexOfAny(r,["+","-","*","/"]),0<(n=0===n&&")"===r[r.length-1]?r.length-1:n)&&"{"!==r[e+1]&&"}"===r[e-1]&&(r=(r=r.substr(0,n)+"}"+r.substr(n)).substr(0,e+1)+"{"+r.substr(e+1))));else for(var i=!0;-1<e;){var o=this.indexOfAny(r.substring(e+1,r.length),t);0<=o?o=e+o+1:-1===o&&")"===r[r.length-1]&&(o=r.length-1),e=(r=0<o&&"{"!==r[e+1]&&"}"!==r[o-1]&&"¢"!==r[o-1]?(r=r.substr(0,o).trim()+"}"+r.substr(o)).substr(0,e+1)+"{"+r.substr(e+1).trim():r).substr(0,e).lastIndexOf(this.parent.getParseArgumentSeparator()),i&&-1===e&&"("===r[0]&&(e=0,i=!1)}return r=r.split("{}").join(this.emptyStr)},V.prototype.lastIndexOfAny=function(r,t){for(var e=r.length-1;-1<e;e--)if(-1<t.indexOf(r[e]))return e;return-1},V.prototype.markNamedRanges=function(r){for(var t=[")",this.parent.getParseArgumentSeparator(),"}","+","-","*","/","<",">","=","&",":"],e=0<r.length&&("("===r[0]||"{"===r[0])?1:0,n=(-1<(r=-1<r.indexOf("#N/A")?r.split("#N/A").join("#N~A"):r).indexOf("#DIV/0!")&&(r=r.split("#DIV/0!").join("#DIV~0!")),this.indexOfAny(r.substring(e),t));-1<n&&n+e<r.length;){var i=this.emptyStr,o=null;if(-1<this.parent.substring(r,e,n).indexOf("[")?o=this.getTableRange(this.parent.substring(r,e,n)):(this.parent.storedData.has(this.parent.substring(r,e,n))||this.parent.namedRanges.has(this.parent.substring(r,e,n)))&&(o=this.checkForNamedRangeAndKeyValue(this.parent.substring(r,e,n))),z.isNullOrUndefined(o)&&("NaN"!==(i=this.checkScopedRange(this.parent.substring(r,e,n)))?(this.findNamedRange=!0,o=i):this.parent.substring(r,e,n).startsWith(this.sheetToken.toString()),!z.isNullOrUndefined(o))&&this.findNamedRange&&-1<o.indexOf(this.fixedReference)&&(o=o.split(this.fixedReference).join(this.emptyStr)),z.isNullOrUndefined(o)||(o=o.toUpperCase(),o=this.parent.setTokensForSheets(o),o=this.markLibraryFormulas(o)),z.isNullOrUndefined(o)||o===this.emptyStr)for(e+=n+1;e<r.length&&!this.parent.isUpperChar(r[e])&&r[e]!==this.sheetToken;)e++;else r=r.substring(0,e)+o+r.substring(e+n),e+=o.length+1;for((n=e)<r.length-1&&"{"===r[e]&&(e+=1),n=this.indexOfAny(r.substring(e),t);0===n&&e<r.length-1;)e++,n=this.indexOfAny(r.substring(e),t);(-1===n||-1<r.substring(e).indexOf("["))&&e<r.length&&(o=-1<r.substring(e).indexOf("[")?this.getTableRange(r.substring(e)):this.parent.storedData.has(r.substring(e))?0<this.parent.storedData.size?this.checkForNamedRangeAndKeyValue(r.substring(e)):o:0<this.parent.namedRanges.size?this.checkForNamedRangeAndKeyValue(r.substring(e)):o,z.isNullOrUndefined(o)&&"NaN"!==(i=this.checkScopedRange(r.substring(e)))&&(o=i),z.isNullOrUndefined(o)||o===this.emptyStr||(o=o.toUpperCase(),o=this.parent.setTokensForSheets(o),null!=(o=this.markLibraryFormulas(o))&&(r=")"===(i=r.substring(e))[i.length-1]?r.substring(0,e)+o+")":r.substring(0,e)+o,e+=o.toString().length+1)),n=e<r.length?this.indexOfAny(r.substring(e),t):-1)}return r=-1<(r=-1<r.indexOf("#N~A")?r.split("#N~A").join("#N/A"):r).indexOf("#DIV~0!")?r.split("#DIV~0!").join("#DIV/0!"):r},V.prototype.checkForNamedRangeAndKeyValue=function(r){var t,e;this.emptyStr;return-1<r.indexOf("[")&&(t=this.getTableRange(r),z.isNullOrUndefined(t)||(this.findNamedRange=!0,r=t)),"NaN"!==(t=this.checkScopedRange(r))?(this.findNamedRange=!0,r=t):(-1<r.indexOf(this.sheetToken)&&(t=this.parent.getSheetFamilyItem(this.parent.grid),e=(e=r.split('"').join(this.emptyStr)).substr(0,e.indexOf(this.sheetToken)),t.sheetNameToToken.has(e.toUpperCase()))&&parseInt(t.sheetNameToToken.get(e.toUpperCase()).split(this.sheetToken).join(this.emptyStr)),0<this.parent.storedData.size&&this.parent.storedData.has(r)&&(r="A"+this.parent.colIndex(r)),0<this.parent.namedRanges.size&&this.parent.namedRanges.has(r.toUpperCase())&&(z.isNullOrUndefined(this.parent.parentObject)?(r=this.parse(this.parent.namedRanges.get(r.toUpperCase())),-1<(r=this.parent.setTokensForSheets(r)).indexOf(this.fixedReference)&&r.split(this.fixedReference).join(this.emptyStr),this.findNamedRange=!0):r=this.parse(this.parent.namedRanges.get(r.toUpperCase()))),this.findNamedRange&&"!"!==r[0]&&"q"!==r[0]&&"bq"!==r[0]&&-1<(r=this.parent.setTokensForSheets(r)).indexOf(this.fixedReference)&&(r=r.split(this.fixedReference).join(this.emptyStr))),r},V.prototype.getTableRange=function(r){r=(r=r.replace(" ",this.emptyStr).toUpperCase()).replace("]",this.emptyStr).replace("#DATA",this.emptyStr);-1<r.indexOf(this.parent.getParseArgumentSeparator())&&(r.substring(0,r.indexOf(this.parent.getParseArgumentSeparator())).replace("[",this.emptyStr),r=r.replace("[",this.emptyStr).replace(this.parent.getParseArgumentSeparator(),"_")),this.emptyStr;return r.toUpperCase()},V.prototype.findNextEndIndex=function(r,t){for(var e=0,n=t,i=!1;!i&&t<r.length;)"["===r[n]?e++:"]"===r[n]&&0===--e&&(i=!0),t++;return t-=n},V.prototype.processIndexArg=function(r){var t=r.indexOf("INDEX((");if(-1!==t){t=t+("INDEX((".length-1);if(-1!==t){for(var e=0,n=-1,i=t;i<r.length;i++)if("("===r[i]?e++:")"===r[i]&&e--,0===e){n=i;break}t<n&&(r=r.slice(0,t)+this.parent.tic+r.slice(t+1,n)+this.parent.tic+r.slice(n+1))}}return r},V.prototype.isValidDotFormulaName=function(t){t=t.toUpperCase();return["STDEV.P","STDEV.S","VAR.S","VAR.P","T.TEST","F.TEST","Z.TEST","CHISQ.TEST","COVARIANCE.S","COVARIANCE.P","CHISQ.DIST","F.DIST","T.DIST","NETWORKDAYS.INTL","WORKDAY.INTL","ERROR.TYPE","ECMA.CEILING","ISO.CEILING"].some(function(r){return t===r})},V.prototype.isOtherLangChar=function(r){r=r.charCodeAt(0);return 192<=r&&r<=214||216<=r&&r<=246||248<=r&&r<=255},V.prototype.destroy=function(){this.stringsColl.clear(),this.storedStringText=this.emptyStr,this.isError=!1,this.isFormulaParsed=!1,this.parent=null};var oi=V;function V(r){this.emptyStr="",this.storedStringText=this.emptyStr,this.sheetToken="!",this.tokenAdd="a",this.tokenSubtract="s",this.tokenMultiply="m",this.tokenDivide="d",this.tokenLess="l",this.charEm="r",this.charEp="x",this.tokenGreater="g",this.tokenEqual="e",this.tokenLessEq="k",this.tokenGreaterEq="j",this.tokenNotEqual="o",this.tokenAnd="c",this.tokenEm="v",this.tokenEp="t",this.tokenOr=String.fromCharCode(126),this.charAnd="i",this.charLess="<",this.charGreater=">",this.charEqual="=",this.charLessEq="f",this.charGreaterEq="h",this.charNoEqual="z",this.stringGreaterEq=">=",this.stringLessEq="<=",this.stringNoEqual="<>",this.stringAnd="&",this.stringOr="^",this.charOr="w",this.charAdd="+",this.charSubtract="-",this.charMultiply="*",this.charDivide="/",this.fixedReference="$",this.spaceString=" ",this.ignoreBracet=!1,this.isError=!1,this.isFormulaParsed=!1,this.findNamedRange=!1,this.stringsColl=new Map,this.tokens=[this.tokenAdd,this.tokenSubtract,this.tokenMultiply,this.tokenDivide,this.tokenLess,this.tokenGreater,this.tokenEqual,this.tokenLessEq,this.tokenGreaterEq,this.tokenNotEqual,this.tokenAnd,this.tokenOr],this.charNOTop=String.fromCharCode(167),this.specialSym=["~","@","#","?"],this.isFailureTriggered=!1,this.parent=r}si=function(r,t){return(si=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};var si,ai,li=function(r,t){function e(){this.constructor=r}si(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)},ui=function(r,t,e,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,e):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(r,t,e,n);else for(var a=r.length-1;0<=a;a--)(i=r[a])&&(s=(o<3?i(s):3<o?i(t,e,s):i(t,e))||s);return 3<o&&s&&Object.defineProperty(t,e,s),s},hi=1048576,pi=16384,li=(ai=z.Base,li(R,ai),Object.defineProperty(R.prototype,"libraryFormulas",{get:function(){return this.lFormulas},set:function(r){this.lFormulas.set(r.fName,{handler:r.handler,category:r.category,description:r.description})},enumerable:!0,configurable:!0}),R.prototype.setLocale=function(r){var t=this.parentObject,r=r||t&&t.locale||"en-US";this.l10n.setLocale(r),this.refreshLocalizedStrings()},R.prototype.refreshLocalizedStrings=function(){function r(r){return t.l10n.getConstant(r)}var t=this;this.formulaErrorStrings=[r("OperatorsCannotStartWithExpression"),r("CannotParse"),r("BadLibrary"),r("InvalidCharInFrontOf"),r("NumberContains2DecimalPoints"),r("ExpressionCannotEndWithAnOperator"),r("InvalidCharactersFollowingWithOperator"),r("InvalidCharInNumber"),r("MismatchedParentheses"),r("UnknownFormulaName"),r("RequiresASingleArgument"),r("Requires3Args"),r("InvalidMathArgument"),r("Requires2Args"),"#NAME?",r("TooComplex"),"#CIRCULARREF!",r("MissingFormula"),r("ImproperFormula"),r("InvalidExpression"),r("CellEmpty"),r("BadFormula"),r("EmptyExpression"),"",r("MismatchedTics"),r("WrongNumberArguments"),r("InvalidArguments"),r("IterationsDoNotConverge"),r("AlreadyRegistered"),r("CalculationOverflow"),r("MissingSheet"),r("CannotParseUnderscore"),r("ExpressionCannotEndWithAnOperatorUnderscore"),"#SPILL!","#DIV/0!"],this.categoryCollection=[r("CategoryAll")]},R.prototype.getHostSheetInfo=function(){var r=this.parentObject;return r&&"function"==typeof r.getSheetInfo&&r.getSheetInfo()||[]},R.prototype.hostParseDate=function(r){var t=this.parentObject;return t&&"function"==typeof t.parseDate&&t.parseDate(r)||{}},R.prototype.getParseArgumentSeparator=function(){return this.isArgumentSeparatorChanged||","===this.parseArgumentSeparator||(this.parseArgumentSeparator=","),this.parseArgumentSeparator},R.prototype.setParseArgumentSeparator=function(r){this.parseArgumentSeparator=r,this.isArgumentSeparatorChanged=!0},R.prototype.getParseDateTimeSeparator=function(){return this.parseDateTimeSeparator},R.prototype.setTreatEmptyStringAsZero=function(r){this.treatEmptyStringAsZero=r},R.prototype.getTreatEmptyStringAsZero=function(){return this.treatEmptyStringAsZero},R.prototype.setParseDateTimeSeparator=function(r){this.parseDateTimeSeparator=r},R.prototype.onPropertyChanged=function(r,t){},R.prototype.getModuleName=function(){return"calculate"},R.prototype.getFormulaCharacter=function(){return"="},R.prototype.isUpperChar=function(r){r=r.charCodeAt(0);return 64<r&&r<91},R.prototype.resetKeys=function(){this.storedData.clear(),this.keyToRowsMap.clear(),this.rowsToKeyMap.clear()},R.prototype.updateDependentCell=function(r){var t,e,n,i,o=this,s=this.cell;""!==s&&((t=this.getSheetFamilyItem(this.grid)).sheetNameToParentObject&&(s.includes(this.sheetToken)||(s=t.parentObjectToToken.get(this.grid)+s),r.includes(this.sheetToken)||(r=t.parentObjectToToken.get(this.grid)+r)),s!==r)&&((t=this.getDependentCells()).has(r)||t.set(r,[]),-1===(t=t.get(r)).indexOf(s))&&(e=this.getDependentFormulaCells(),n={},(i=function(r){if(e.has(r)){var t=e.get(r);if(t.has(s))throw o.formulaErrorStrings[$.FormulasErrorsStrings.CircularReference];n[r]||(n[r]=!0,t.forEach(function(r){i(r)}))}})(r),t.push(s),e.has(s)?e.get(s).has(r)||e.get(s).set(r,r):(e.set(s,new Map),e.get(s).set(r,r)))},R.prototype.getDependentCells=function(){return null==this.dependentCells&&(this.dependentCells=new Map),this.dependentCells},R.prototype.getDependentFormulaCells=function(){var r;return this.isSheetMember()?(null==(r=this.getSheetFamilyItem(this.grid)).sheetDependentFormulaCells&&(r.sheetDependentFormulaCells=new Map),r.sheetDependentFormulaCells):(null==this.dependentFormulaCells&&(this.dependentFormulaCells=new Map),this.dependentFormulaCells)},R.prototype.getLibraryFormulas=function(){return this.lFormulas},R.prototype.getFunction=function(r){return this.getLibraryFormulas().has(r.toUpperCase())?this.getLibraryFormulas().get(r.toUpperCase()).handler:null},R.prototype.intToDate=function(r){var r=Number(r),t=(60<(r=0<r&&r<1?1+r:0===r?1:r)&&--r,new Date("01/01/1900")),t=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return new Date(new Date(864e5*(r-1)+t).toUTCString().replace(" GMT",""))},R.prototype.getFormulaInfoTable=function(){var r;return this.isSheetMember()?(null===(r=this.getSheetFamilyItem(this.grid)).sheetFormulaInfotable&&(r.sheetFormulaInfotable=new Map),r.sheetFormulaInfotable):(null===this.formulaInfoTable&&(this.formulaInfoTable=new Map),this.formulaInfoTable)},R.prototype.getParseDecimalSeparator=function(){return this.isParseDecimalSeparatorChanged||"."===this.parseDecimalSeparator||(this.parseDecimalSeparator="."),this.parseDecimalSeparator},R.prototype.setParseDecimalSeparator=function(r){this.parseDecimalSeparator=r,this.isParseDecimalSeparatorChanged=!0},R.prototype.getSheetToken=function(r){var t=0,e="";if(t<r.length&&r[t]===this.sheetToken){for(t++;t<r.length&&r[t]!==this.sheetToken;)t++;e=r.substring(0,t+1)}if(t<r.length)return e;throw this.formulaErrorStrings[$.FormulasErrorsStrings.BadIndex]},R.prototype.getSheetID=function(r){var t=this.getSheetFamilyItem(r);if(null!=t.sheetNameToParentObject&&0<t.sheetNameToParentObject.size&&(t=t.parentObjectToToken.get(r))){t=t.split(this.sheetToken).join(""),r=this.parseFloat(t);if(!this.isNaN(r))return r}return-1},R.prototype.parseFloat=function(r){var t=Number(r);return t=isNaN(t)&&"string"==typeof r&&r.includes(",")?Number(r.split(",").join("")):t},R.prototype.rowIndex=function(r){var t=0,e=!1;if(t<r.length&&r[t]===this.sheetToken){for(t++;t<r.length&&r[t]!==this.sheetToken;)t++;t++}for(;t<r.length&&this.isChar(r[t]);)e=!0,t++;var n=parseInt(r.substring(t),10);if(t<r.length&&!this.isNaN(n))return n;if(e)return-1;throw this.formulaErrorStrings[$.FormulasErrorsStrings.BadIndex]},R.prototype.colIndex=function(r){var t=0,e=0;if(t<(r=r.toUpperCase()).length&&r[t]===this.sheetToken){for(t++;t<r.length&&r[t]!==this.sheetToken;)t++;t++}for(;t<r.length&&this.isChar(r[t]);){e=26*e+r[t].charCodeAt(0)-64;t++}return 0===e?-1:e},R.prototype.getErrorStrings=function(){return null===this.errorStrings&&(this.errorStrings=["#N/A","#VALUE!","#REF!","#DIV/0!","#NUM!","#NAME?","#NULL!","#CALC!"]),this.errorStrings},R.prototype.substring=function(r,t,e){return r.substring(t,e+t)},R.prototype.isChar=function(r){return 65<=r.charCodeAt(0)&&r.charCodeAt(0)<=90||97<=r.charCodeAt(0)&&r.charCodeAt(0)<=122},R.prototype.getSheetFamilyItem=function(r,t){return 0===this.sheetFamilyID?(null==this.defaultFamilyItem&&(this.defaultFamilyItem=new mi),this.defaultFamilyItem):(null==this.sheetFamiliesList&&(this.sheetFamiliesList=new Map),void 0===t&&(t=this.modelToSheetID.get(r)),this.sheetFamiliesList.has(t)||this.sheetFamiliesList.set(t,new mi),this.sheetFamiliesList.get(t))},R.prototype.setKeyValue=function(r,t){r=r.toUpperCase();var t=t.toString().trim(),e=(this.storedData.get(r)&&0!==t.indexOf("{")||(this.storedData.set(r,new gi),this.keyToRowsMap.set(r,this.keyToRowsMap.size+1),this.rowsToKeyMap.set(this.rowsToKeyMap.size+1,r)),this.storedData.get(r));null!=e.getFormulaText()&&0<e.getFormulaText().length&&e.getFormulaText()!==t&&(r=this.cellPrefix+this.keyToRowsMap.get(r).toString(),null!=this.getDependentFormulaCells().get(r))&&this.clearFormulaDependentCells(r),0<t.length&&t[0]===this.getFormulaCharacter()?e.setFormulaText(t):e.getFormulaValue()!==t&&(e.setFormulaText(""),e.setParsedFormula(""),e.setFormulaValue(t))},R.prototype.clearFormulaDependentCells=function(n){var i=this,r=this.getDependentFormulaCells().get(n);r&&(r.forEach(function(r,t){var e=i.getDependentCells().get(t);i.arrayRemove(e,n),0===e.length&&i.getDependentCells().delete(t)}),this.getDependentFormulaCells().delete(n))},R.prototype.clearKeys=function(){this.resetKeys()},R.prototype.arrayRemove=function(r,t){t=r.indexOf(t);return-1!==t&&r.splice(t,1),r},R.prototype.getKeyValue=function(t){if(t=t.toUpperCase(),!this.storedData.has(t))return"";var e=this.storedData.get(t),r=e.getFormulaText();if(0<r.length&&r[0]===this.getFormulaCharacter()){if(this.evaluatingKeys.has(t))return this.getErrorStrings()[$.CommonErrors.Ref];this.evaluatingKeys.add(t),this.cell=this.cellPrefix+this.keyToRowsMap.get(t).toString(),r=r.substring(1);try{try{e.setParsedFormula(this.parser.parseFormula(r,t))}catch(r){var n={message:r.message,exception:r,isForceCalculable:!1,computeForceCalculate:!1};return this.trigger("onFailure",n),e.setFormulaValue(n.message),this.storedData.get(t).getFormulaValue()}try{e.setFormulaValue(this.computeFormula(e.getParsedFormula()))}catch(r){var n={message:r.message,exception:r,isForceCalculable:!1,computeForceCalculate:!1},i=(this.trigger("onFailure",n),"string"==typeof n.exception?n.exception:n.message);return(z.isNullOrUndefined(this.getErrorLine(r))?"":"#"+this.getErrorLine(r)+": ")+i}}finally{this.evaluatingKeys.delete(t)}}return this.storedData.get(t).getFormulaValue()},R.prototype.getNamedRanges=function(){return this.namedRanges},R.prototype.addNamedRange=function(r,t){var e=r.split(this.sheetToken);if(1<e.length){var n=this.getSheetId(this.grid).toString();if(!this.getSheetFamilyItem(n).parentObjectToToken.get(n))return!1;r=e[0]+this.sheetToken+e[1].toUpperCase()}else r=r.toUpperCase();return this.namedRanges.set(r,t),!0},R.prototype.updateNamedRange=function(n,i){var o=new Map;this.namedRanges.forEach(function(r,t){var e=t;t.includes(n)&&((t=t.split("!"))[0]=i,e=t.join("!")),o.set(e,r)}),this.namedRanges=o},R.prototype.removeNamedRange=function(r){return r=r.toUpperCase(),null!=this.namedRanges.get(r)&&(this.namedRanges.delete(r),!0)},R.prototype.convertAlpha=function(r){for(var t=[],e=0;0<r;){r--;var n="A".charCodeAt(0);t[e]=String.fromCharCode(r%26+n),r=parseInt((r/26).toString(),10),e++}for(var i=[],o=0;o<e;o++)i[e-o-1]=t[o];return i.join("")},R.prototype.getCellCollection=function(r){if(r.indexOf(":")<0){if(!this.isCellReference(r))return r.split(this.getParseArgumentSeparator());r=r+":"+r}var t,e,n,i="",o=r.indexOf(this.sheetToken);if(-1<o)for(var s=o+1;s<r.length;){if(r[s]===this.sheetToken){i=r.substr(0,s+1);break}s++}if(0<(p=r.indexOf(":"))&&this.isChar(r[p-1]))for(var a=p-2;0<=a&&this.isDigit(r[a]);)a--;if(o=this.rowIndex(this.substring(r,0,p)),t=this.rowIndex(this.substring(r,p+1,p+r.length-p-1)),e=this.colIndex(this.substring(r,0,p)),n=this.colIndex(this.substring(r,p+1,p+r.length-p-1)),hi<=o||hi<=t||pi<=e||pi<=n)return[this.getErrorStrings()[$.CommonErrors.Ref]];t<o&&(p=t,t=o,o=p),n<e&&(p=n,n=e,e=p);for(var l,u=[],h=0,p=o;p<=t;p++)for(l=e;l<=n;l++)u[h]=i+""+this.convertAlpha(l)+p.toString(),h++;return u},R.prototype.computeFormula=function(r,t){return this.calculateFormula(r,!1,t)},R.prototype.calculateFormula=function(t,m,c){var d,N,v,E=this,S=!1;if(this.parser.isError)return t;d=this.parser.isFormulaParsed?t:this.parser.parseFormula(t),this.parser.isFormulaParsed=!1;try{if(0<(N=this.findLastIndexOfq(d))&&(S=!0),""!==d&&-1<N){for(var y=N+1,C=this;-1<y;)if("break"===function(){if(d[y]!==C.rightBracket)return y++,"continue";var r=d.substring(N,y+1),t=r.split(C.leftBracket)[0].split("q").join(""),e=void 0;if(C.getLibraryFormulas().get(t.toUpperCase()).isCustom){for(var e=r.substring(r.indexOf(C.leftBracket)+1,r.indexOf(C.rightBracket)).split(C.getParseArgumentSeparator()),n=0,i=[],o=void 0,n=0;n<e.length;n++)e[n].includes(":")&&C.isCellReference(e[n])&&1<(o=C.getCellCollection(e[n])).length?(i.push(e[n]),o.forEach(function(r){E.updateDependentCell(r)})):i.push(C.getValueFromArg(e[n]));e=i}else{for(var s,a,l=r.substring(r.indexOf(C.leftBracket)+1,r.indexOf(C.rightBracket)),u=(e=[],C.getParseArgumentSeparator()),h="",p=void 0,g=0,f=l.length-1;g<=f;g++)'"'===l[g]&&(p=!p),l[g]!==u||p?h+=l[g]:(e.push(h),h=""),g===f&&e.push(h);e.length||(e=[""]),S&&t&&(["IF","INDEX","SORT","T","EXACT","PROPER","DOLLAR","DATE","TEXT","ISNUMBER","TRIM","LEFT"].some(function(r){return r===t})&&e.push("nestedFormulaTrue"),"IF"===t&&e.push("nestedFormulaTrue"),"VLOOKUP"!==t&&"HLOOKUP"!==t||-1!==(s=d.lastIndexOf("q",N-1))&&(a=d.substring(s+1,d.lastIndexOf(C.leftBracket,N-1)),["IF","IFS","AND","OR","NOT"].some(function(r){return r===a}))&&e.push("conditionalFormulaTrue")),c&&"UNIQUE"===t&&e.push("isComputeExp")}return b=z.isNullOrUndefined(C.getFunction(t))?C.getErrorStrings()[$.CommonErrors.Name]:C.getFunction(t).apply(void 0,e),S?(v=C.processNestedFormula(d,r,b),0===(s=C.findLastIndexOfq(v))&&(S=!1),-1===s&&(b=C.computeValue(v,m)),N=y=s,d=v,"continue"):"break"}())break}else-1<this.formulaErrorStrings.indexOf(d)?b=d:""!==d&&-1===N&&(b=this.computeValue(d,m))}catch(r){var t={message:r.message,exception:r,isForceCalculable:!1,computeForceCalculate:!1},t=(this.trigger("onFailure",t),"string"==typeof t.exception?t.exception:t.message),b=(z.isNullOrUndefined(this.getErrorLine(r))?"":"#"+this.getErrorLine(r)+": ")+t}return b},R.prototype.computeSumIfAndAvgIf=function(r,t){if(z.isNullOrUndefined(r)||""===r[0]||0===r.length)return this.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var e,n=r,i=0;i<n.length;i++)this.isCellReference(n[i])&&z.isNullOrUndefined(n[i].match(/[0-9]/))&&n[i].indexOf("!")<0&&(e=n[i].split(":"),n[i]=e[0]+"1:"+e[1]+this.spreadSheetUsedRange[0]);r=n.length;if(2!==r&&3!==r&&0===r)return this.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===n[1])return t?this.getErrorStrings()[$.CommonErrors.DivZero]:"0";var t=n[0],o=n[1].startsWith(this.tic)&&n[1].endsWith(this.tic),s=this.getANDComputedValue(n[1]);if(255<s.length)return this.getErrorStrings()[$.CommonErrors.Value];var a=s.includes("*"),l=s.includes("?"),u=a?s.replace(/\*/g,"").trim():s,h=!1,p=(!o&&this.isCellReference(u)&&(u=this.getValueFromArg(u),h=!0),s=u=a&&(p=s.indexOf("*"),"*"===s[0]&&(u="*"+u),"*"===s[s.length-1]&&(u+="*"),0<p)&&p<s.length-1?s.substring(0,p)+"*"+s.substring(p+1):u,this.parser.tokenEqual),u=(s.startsWith("<=")?(p=this.parser.tokenLessEq,s=s.substring(2)):s.startsWith(">=")?(p=this.parser.tokenGreaterEq,s=s.substring(2)):s.startsWith("<>")?(p=this.parser.tokenNotEqual,s=s.substring(2)):s.startsWith("<")?(p=this.parser.tokenLess,s=s.substring(1)):s.startsWith(">")?(p=this.parser.tokenGreater,s=s.substring(1)):s.startsWith("=")&&(p=this.parser.tokenEqual,s=s.substring(1)),(!o&&this.isCellReference(s)&&!h||s.includes(this.arithMarker)||s.includes(this.getParseDecimalSeparator())&&!a&&!l)&&(s=this.getValueFromArg(s)),this.parseFloat(s)),o=n[0],h=this.getCellCollection(2<r?n[2]:t),r=this.getCellCollection(o);if("#REF!"===h[0]||"#REF!"===r[0])return this.getErrorStrings()[$.CommonErrors.Name];if(r.length>h.length){t=this.colIndex(h[h.length-1])+this.colIndex(r[r.length-1])-this.colIndex(r[0]),o=n[2].split(":");if(o[1]=(this.convertAlpha(t)+this.rowIndex(r[r.length-1])).toString(),"#REF!"===(h=this.getCellCollection(o.join(":")))[0])return this.getErrorStrings()[$.CommonErrors.Name]}t=this.getComputeSumIfValue(r,h,s.toLowerCase(),u,p,a,l);return[t[0],t[1]]},R.prototype.computeLookup=function(r){var t,e,n,i=[],o=[],s=[],a=[],l=[],u=r.length;if(1===u||3<u)return this.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===r[1]||""===r[2])return this.getErrorStrings()[$.CommonErrors.Value];if(n=this.getValueFromArg(r[0]),-1<r[0].indexOf(this.tic)&&r[0].toUpperCase().split(this.tic).join("")!==this.trueValue&&r[0].toUpperCase().split(this.tic).join("")!==this.falseValue&&this.isNaN(this.parseFloat(r[0].split(this.tic).join("")))&&(n=n.split(this.tic).join("")),-1<this.getErrorStrings().indexOf(n))return n;var h=r[1].split(":");if(2===h.length&&this.isCellReference(h[0])&&this.isCellReference(h[1])&&2===u&&(O=r[1].indexOf(":"),h=this.rowIndex(this.substring(r[1],0,O)),N=this.colIndex(this.substring(r[1],0,O)),m=this.rowIndex(this.substring(r[1],O+1,O+r[1].length-O-1)),v=this.colIndex(this.substring(r[1],O+1,O+r[1].length-O-1)),m<h&&(h=(f=[m,h])[0],m=f[1]),v<N&&(N=(f=[v,N])[0],v=f[1]),f="",0===r[1].indexOf("!")&&(f=(f=(f=r[1]).replace("!","")).indexOf("!"),f=r[1].substring(0,f+2)),(g=v-N+1)<(p=m-h+1)||p==g?(t=f+J(N)+h+":"+J(N)+m,e=f+J(v)+h+":"+J(v)+m):p<g&&(t=f+J(N)+h+":"+J(v)+h,e=f+J(N)+m+":"+J(v)+m),h===m&&N===v||(A=!0)),A){if(i=this.getCellCollection(t),o=this.getCellCollection(e),"#REF!"===i[0]||"#REF!"===o[0])return this.getErrorStrings()[$.CommonErrors.Name]}else{var i=this.getCellCollection(r[1]),p=2===u?r[1]:r[2],o=this.getCellCollection(p);if("#REF!"===i[0]||"#REF!"===o[0])return this.getErrorStrings()[$.CommonErrors.Name];var g=M(r[1]),f=M(p),h=g[1]===g[3]||g[0]===g[2],m=f[1]===f[3]||f[0]===f[2];if(!h||!m)return this.getErrorStrings()[$.CommonErrors.NA]}for(var c=0;c<i.length;c++)a.push(this.getValueFromArg(i[c]).split(this.tic).join(""));var d=a.map(function(r){return""===r?NaN:Number(r)}).sort(function(r,t){return r-t}),N=d[d.length-1],v=d[0],E=this.parseFloat(n);if(this.isNaN(E))for(var S,y,C=0;C<i.length;C++)s[C]=this.getValueFromArg(i[C]).split(this.tic).join(""),z.isNullOrUndefined(o[C])||""===n||""===s[C]||(n.toUpperCase()===s[C].toUpperCase()||(-1<n.indexOf("*")||-1<n.indexOf("?"))&&(-1<(y=n).indexOf("*")&&(y=y.replace(/\*/g,"").trim(),this.isCellReference(y)&&(y=this.getValueFromArg(y)),S=n.indexOf("*"),"*"===n[0]&&(y="*"+y),"*"===n[n.length-1]&&(y+="*"),0<S)&&S<n.length-1&&(y=n.substring(0,S)+"*"+n.substring(S+1)),S=[],y=this.findWildCardValue(y.toLowerCase(),s[C].toLowerCase()),S.push(y),S.push(n),this.processLogical(S,"equal")===this.trueValue))&&l.push(this.getValueFromArg(o[C]).split(this.tic).join("")||"0");else for(var b=0;b<d.length;b++)s[b]=d[b].toString().split(this.tic).join(""),z.isNullOrUndefined(o[b])||""===s[b]||E!==this.parseFloat(s[b])||l.push(this.getValueFromArg(o[b]).split(this.tic).join("")||"0");if(0<l.length)return l[l.length-1];if(N<E&&!z.isNullOrUndefined(o[i.length-1]))return this.getValueFromArg(o[i.length-1]).split(this.tic).join("")||"0";if(!(E<v)&&a.indexOf(n.split(this.tic).join(""))<0&&n!==this.trueValue&&n!==this.falseValue)if(this.isNaN(E)||this.isNaN(N)||this.isNaN(v)){if(this.isNaN(E)&&""!==n&&/^[a-zA-Z!@#$%^&*()_+{}[\]:;<>,.?~\\/-]/.test(n)){var A=a.sort(),O=this.findClosestMatch(n.split(this.tic).join(""),A);if(!z.isNullOrUndefined(o[O])&&0<=O)return this.getValueFromArg(o[O]).split(this.tic).join("")||"0"}}else{for(var F=[],x=0;x<d.length;x++)E>d[x]&&F.push(d[x]);var O=F.length-1;if(!z.isNullOrUndefined(o[O])&&0<=O)return this.getValueFromArg(o[O]).split(this.tic).join("")||"0"}return this.getErrorStrings()[$.CommonErrors.NA]},R.prototype.computeVHLookup=function(r,t){var e,n=this;if(r&&"conditionalFormulaTrue"===r[r.length-1]&&(e=!0,r.pop()),z.isNullOrUndefined(r)||r.length<3||4<r.length)return this.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===r[1])return this.getErrorStrings()[$.CommonErrors.NA];var i=this.getValueFromArg(r[0]),o=(i?i.includes(this.tic)&&(o=i.split(this.tic).join(""))&&!this.isNumber(o)&&(f=o.toUpperCase())!==this.trueValue&&f!==this.falseValue&&(i=o):i="0",this.getErrorStrings());if(-1<o.indexOf(i))return i;var s,a=(this.getValueFromArg(r[2])||"0").split(this.tic).join("").toUpperCase(),a=this.parseFloat(a===this.trueValue?"1":a);if(a<1)return o[$.CommonErrors.Value];if(r[3]){if(r[3]=this.getValueFromArg(r[3]).split(this.tic).join(""),-1<o.indexOf(r[3]))return r[3];var l=r[3].toUpperCase();if(l===this.falseValue||"0"===r[3])s=!0;else if(l!==this.trueValue&&"1"!==r[3])return o[$.CommonErrors.Value]}var l=r[1],u=this.tic+"RSEP"+this.tic;if(l.includes(u)||l.startsWith("(")&&l.endsWith(")")&&l.includes(u)){var u=l.startsWith("(")&&l.endsWith(")")?l.substring(1,l.length-1):l,h=this.tic+"RSEP"+this.tic,j=this.tic+"CSEP"+this.tic,p=u.split(h).map(function(r){return r.split(j).map(function(r){return r.startsWith(n.tic)&&r.endsWith(n.tic)?r.substring(1,r.length-1):n.isCellReference(r.trim())?n.getValueFromArg(r.trim()):r.trim()})}),u=p.length,h=p[0]?p[0].length:0,g=a-1;if(t&&h<=g)return o[$.CommonErrors.Ref];if(!t&&u<=g)return o[$.CommonErrors.Ref];for(var f=i.toUpperCase(),L=t?u:h,m=0;m<L;m++){var c=(t?p[m][0]:p[0][m])||"";if(this.isNumber(i)&&this.isNumber(c)?this.parseFloat(i)===this.parseFloat(c):c.toUpperCase()===f)return""!==(c=t?void 0!==p[m][g]?p[m][g]:"":void 0!==p[g]&&void 0!==p[g][m]?p[g][m]:"")?c:""}return o[$.CommonErrors.NA]}u=l.split(":");if(!this.isCellReference(u[0])||!this.isCellReference(u[1]))return o[$.CommonErrors.Value];var d=this.rowIndex(u[0]),N=this.colIndex(u[0]),h=this.rowIndex(u[1]),l=this.colIndex(u[1]);if(h<d&&(d=(u=[h,d])[0],h=u[1]),l<N&&(N=(u=[l,N])[0],l=u[1]),!(0<d&&h<=hi&&0<N&&l<=pi))return this.getErrorStrings()[$.CommonErrors.Name];var u=this.grid,v="",E=this.getSheetFamilyItem(u),r=(r[1].startsWith("!")?(v=r[1].substring(0,r[1].replace("!","").indexOf("!")+2),null!==E.tokenToParentObject&&(this.grid=E.tokenToParentObject.get(v))):null!==E.parentObjectToToken&&(v=E.parentObjectToToken.get(u)),this.getSheetId(this.grid));if(-1===ii("Sheet"+r,this.getHostSheetInfo()))return this.grid=u,o[$.CommonErrors.Ref];var S,y,C=this.getCellValueFn(u,this.cell,r,!0);if(t){var b=N+a-1;if(l<b)return o[$.CommonErrors.Ref];var A=d,O=h,k=v+J(N),F=function(r){return C(r,N,k+r)},P=v+J(b),x=function(){return C(w,b,P+w)||(e?'""':"0")}}else{var V,R=d+a-1;if(h<R)return o[$.CommonErrors.Ref];A=N,O=l,F=function(r){return V=v+J(r),C(d,r,V+d)},x=function(){return C(R,w,V+R)||(e?'""':"0")}}var T=[];if(s){var I,M,D,_=void 0;for(_=this.isNumber(i)?(I=this.parseFloat(i),function(){return I===n.parseFloat(y)}):i.includes("*")||i.includes("?")?(-1<(E=(M=i).indexOf("*"))&&(M=M.replace(/\*/g,"").trim(),this.isCellReference(M)&&(M=this.getValueFromArg(M)),0===E?M="*"+M:E===i.length-1?M+="*":M=i.substring(0,E)+"*"+i.substring(E+1)),M=M.toLowerCase(),function(){return n.processLogical([n.findWildCardValue(M,y.toLowerCase()),i],"equal")===n.trueValue}):(D=i.toUpperCase(),function(){return D===y.toUpperCase()}),w=A;w<=O;w++)(y=F(w))&&_()&&T.push(x());S=T.length?T[0]:o[$.CommonErrors.NA]}else if(-1<i.indexOf("*")||-1<i.indexOf("?"))S=o[$.CommonErrors.NA];else{for(var U,W,q,B,X=void 0,Y=(X=this.isNumber(i)?(W=this.parseFloat(i),q=Ge(""),function(){U=q(n.isNumber(y)?n.parseFloat(y):y||null,W)}):(B=new Intl.Collator(this.parentObject.locale||"en-US",{sensitivity:"base"}),function(){U=!y||n.isNumber(y)?null:B.compare(y,i)}),void 0),w=A;w<=O;w++)y=F(w),Y||(X(),0===U||U<0?T.push(x()):0<U&&T.length&&(Y=!0));S=T.length?T[T.length-1]:o[$.CommonErrors.NA]}return this.grid=u,e&&"string"==typeof S&&-1!==S.indexOf(this.getParseArgumentSeparator())?this.tic+S+this.tic:S},R.prototype.findClosestMatch=function(r,t){for(var e=0,n=t.length-1;e<=n;){var i=Math.floor((e+n)/2),o=t[i],o=this.compareStrings(r.toLowerCase(),o.toLowerCase());if(0===o)return i;1===o?e=i+1:n=i-1}for(var s=e-1;0<=s;s--)if(-1!==this.compareStrings(r.toLowerCase(),t[s].toLowerCase()))return s;return-1},R.prototype.compareStrings=function(r,t){for(var e=Math.min(r.length,t.length),n=0;n<e;n++){var i=r.charCodeAt(n),o=t.charCodeAt(n);if(i<o)return-1;if(o<i)return 1}return r.length<t.length?-1:r.length>t.length?1:0},R.prototype.findWildCardValue=function(r,t){var e="";if(-1<r.indexOf("?"))var n=RegExp(r.replace(/\?/g,"[\\s\\S]")),e=t.length===r.length&&this.isNaN(this.parseFloat(t))&&t.match(n)?r:t;else if(-1<r.indexOf("*")){for(var n=r.indexOf("*"),i="",o="",s=this.falseValue,a=this.falseValue,l=n-1;0<=l;l--)i+=r[l],a=this.trueValue;for(l=n+1;l<r.length;l++)o+=r[l],s=this.trueValue;var n=""===i?-1:t.indexOf(i.split("").reverse().join("")),u=""===o?-1:t.indexOf(o);-1<n||-1<u?(n=i.split("").reverse().join("")===t.substr(0,i.length),u=o===t.substring(t.length-o.length,t.length),a===this.trueValue&&s===this.trueValue&&this.isNaN(this.parseFloat(i))&&this.isNaN(this.parseFloat(o))?e=n&&u?r:t:a===this.trueValue&&this.isNaN(this.parseFloat(i))?e=n?r:t:s===this.trueValue&&this.isNaN(this.parseFloat(o))&&(e=u?r:t)):e=t=r.startsWith("*")&&r.endsWith("*")&&""!==(n=r.slice(1,-1))&&t.includes(n)&&this.isNaN(this.parseFloat(n))?r:t}return e},R.prototype.getComputeSumIfValue=function(r,t,e,n,i,o,s){var a=0,l=0;switch(i){case this.parser.tokenEqual:for(var u=o?e.replace(/\*/g,""):e,h=0;h<r.length;h++){var p=this.getValueFromRange(t,h),g=this.getValueFromArg(r[h].split(this.tic).join("")).toLowerCase(),f=this.parseFloat(g);g===e&&f===n?(d=this.getValueFromArg(t[h].split(this.tic).join("")),N=this.parseFloat(d),this.isNaN(N)||(a+=N,l+=1)):g===e?this.isNaN(p)||(a+=p,l+=1):o&&u&&g&&this.isNaN(this.parseFloat(g))?(m=e.indexOf("*"),"*"===e[0]&&u.length<=g.length&&u===g.slice(g.length-u.length,g.length)?this.isNaN(p)||(a+=p,l+=1):("*"===e[e.length-1]&&u.length<=g.length&&u===g.slice(0,u.length)||-1<m&&g.startsWith(e.substr(0,m))&&g.endsWith(e.substr(m+1)))&&!this.isNaN(p)&&(a+=p,l+=1)):o&&!u&&g&&this.isNaN(this.parseFloat(g))?this.isNaN(p)||(a+=p,l+=1):s&&u&&g&&this.isNaN(this.parseFloat(g))&&(c=RegExp(u.replace(/\?/g,"[\\s\\S]")),g.length===e.length)&&g.match(c)&&!this.isNaN(p)&&(a+=p,l+=1)}break;case this.parser.tokenLess:for(h=0;h<r.length;h++){g=this.getValueFromArg(r[h].split(this.tic).join(""));(f=this.parseFloat(g))<n&&(d=this.getValueFromArg(t[h].split(this.tic).join("")),N=this.parseFloat(d),this.isNaN(N)||(a+=N,l+=1))}break;case this.parser.tokenGreater:for(h=0;h<r.length;h++){g=this.getValueFromArg(r[h].split(this.tic).join(""));n<(f=this.parseFloat(g))&&(d=this.getValueFromArg(t[h].split(this.tic).join("")),N=this.parseFloat(d),this.isNaN(N)||(a+=N,l+=1))}break;case this.parser.tokenLessEq:for(h=0;h<r.length;h++){g=this.getValueFromArg(r[h].split(this.tic).join(""));(f=this.parseFloat(g))<=n&&(d=this.getValueFromArg(t[h].split(this.tic).join("")),N=this.parseFloat(d),this.isNaN(N)||(a+=N,l+=1))}break;case this.parser.tokenGreaterEq:for(h=0;h<r.length;h++){g=this.getValueFromArg(r[h].split(this.tic).join(""));n<=(f=this.parseFloat(g))&&(d=this.getValueFromArg(t[h].split(this.tic).join("")),N=this.parseFloat(d),this.isNaN(N)||(a+=N,l+=1))}break;case this.parser.tokenNotEqual:for(u=o?e.replace(/\*/g,""):e,h=0;h<r.length;h++){var m,c,d,N,p=this.getValueFromRange(t,h),g=this.getValueFromArg(r[h].split(this.tic).join("")).toLowerCase(),f=this.parseFloat(g);g===e||f===n||o||s?o&&u&&g&&this.isNaN(this.parseFloat(g))?(m=e.indexOf("*"),"*"===e[0]&&u.length<=g.length&&u!==g.slice(g.length-u.length,g.length)||"*"===e[e.length-1]&&u.length<=g.length&&u!==g.slice(0,u.length)?this.isNaN(p)||(a+=p,l+=1):(-1<m&&!g.startsWith(e.substr(0,m))||!g.endsWith(e.substr(m+1)))&&!this.isNaN(p)&&(a+=p,l+=1)):!o||u||this.isNaN(this.parseFloat(g))?s&&u&&g&&this.isNaN(this.parseFloat(g))&&(c=RegExp(u.replace(/\?/g,"[\\s\\S]")),g.length===e.length&&g.match(c)||this.isNaN(p)||(a+=p,l+=1)):this.isNaN(p)||(a+=p,l+=1):(d=this.getValueFromArg(t[h].split(this.tic).join("")),N=this.parseFloat(d),this.isNaN(N)||(a+=N,l+=1))}}return[a,l]},R.prototype.getValueFromRange=function(r,t){r=r[t],r=this.getValueFromArg(r);return this.parseFloat(r.toString())},R.prototype.computeAndOrNot=function(r,t){for(var e,n,i=this,o="and"===t,s="or"===t,a="not"===t,l=o||a,u=[],h=r,p=0;p<h.length;p++){if(h[p]===this.tic)return this.getErrorStrings()[$.CommonErrors.Value];if(h[p]=h[p].startsWith("n")?h[p].slice(1):h[p],this.isCellReference(h[p]))for(var g=this.getCellCollection(h[p]),f=0;f<g.length;f++){if(-1<this.getErrorStrings().indexOf(g[f]))return g[f];if(g[f][0]===this.tic)return this.getErrorStrings()[$.CommonErrors.Name];if(e=this.getValueFromArg(g[f]),-1<this.getErrorStrings().indexOf(e))return e;n=this.parseFloat(e),e===this.falseValue||""!==e&&0===n||a&&""===e?u.push(this.falseValue):e===this.trueValue||!isNaN(n)&&""!==e?u.push(this.trueValue):""!==e&&!isNaN(n)||u.push(this.getErrorStrings()[$.CommonErrors.Value])}else{if(e=this.getValueFromArg(h[p]).toUpperCase(),-1<this.getErrorStrings().indexOf(e))return e;n=this.parseFloat(e),(e=e.split(this.tic).join(""))===this.falseValue||""===h[p]||""!==e&&0===n?u.push(this.falseValue):e===this.trueValue||!isNaN(n)&&""!==e?u.push(this.trueValue):""!==e&&!isNaN(n)||u.push(this.getErrorStrings()[$.CommonErrors.Value])}}if(u.every(function(r){return r===i.getErrorStrings()[$.CommonErrors.Value]}))return this.getErrorStrings()[$.CommonErrors.Value];for(f=0;f<u.length;f++){if((o||a)&&u[f]===this.falseValue){l=!1;break}if(s&&u[f]===this.trueValue){l=!0;break}}return(l=a?!l:l)?this.trueValue:this.falseValue},R.prototype.removeTics=function(r){return r=1<r.length&&r[0]===this.tic[0]&&r[r.length-1]===this.tic[0]?this.substring(r,1,r.length-2):r},R.prototype.getCellFrom=function(r){var t,e,n="",r=-1<r.indexOf(":")?r.split(":"):[r],i=r.length-1,o=this.rowIndex(r[0]);return o===this.rowIndex(r[i])?(e=this.colIndex(r[0]),t=this.colIndex(r[i]),e<=(e=this.colIndex(this.cell))&&e<=t&&(n=J(e).toString()+o.toString())):this.colIndex(r[0])===this.colIndex(r[i])&&(t=this.colIndex(r[0]),e=this.rowIndex(r[i]),o<=(r=this.rowIndex(this.cell)))&&r<=e&&(n=J(t).toString()+r.toString()),n},R.prototype.computeValue=function(r,t,e){try{for(var n=[],i=0,o="",s=(n.length=0,[]),a=this.getParseDecimalSeparator();i<r.length;){var l="u"===r[i];if(l&&(i+=1),r[i]===this.arithMarker)i+=1;else{if(this.isDigit(r[i])){for(var u="";i<r.length&&(this.isDigit(r[i])||r[i]===a);)u+=r[i]===a?".":r[i],i+=1;if(n.push(u),!r[i])return n.toString()}if(r[i]===this.sheetToken){for(o=r[i],i+=1;i<r.length&&r[i]!==this.sheetToken;)o+=r[i],i+=1;i<r.length&&(o+=r[i],i+=1)}else if(this.isUpperChar(r[i])){for(var u="",h="";i<r.length&&this.isUpperChar(r[i]);)u+=r[i],i+=1;for(;i<r.length&&this.isDigit(r[i]);)u+=r[i],i+=1;if(i<r.length&&":"===r[i]){if(u+=r[i],(i+=1)<r.length&&r[i]===this.sheetToken)for(u+=r[i],i+=1;i<r.length&&r[i]!==this.sheetToken;)u+=r[i],i+=1;for(;i<r.length&&this.isUpperChar(r[i]);)u+=r[i],i+=1;for(;i<r.length&&this.isDigit(r[i]);)u+=r[i],i+=1;u=o+this.getCellFrom(u)}else u=o+u;var p=this.getParentObjectCellValue(u,t);if(h=z.isNullOrUndefined(p)?"":p.toString(),o="","string"==typeof h&&-1<this.getErrorStrings().indexOf(h))return h;l&&(h=this.isNaN(this.parseFloat(h))?"-"+h:(-this.parseFloat(h)).toString()),n.push(h),""===h&&(s[n.length-1]="0")}else if("q"===r[i]){var g=r.substring(i+1).indexOf(this.leftBracket),f=r.substring(i+g+1).indexOf(this.rightBracket);r=this.substring(r,i+g+2,f-1)}else if(r[i]===this.tic[0]){for(var u=r[i].toString(),m="n"===r[(i+=1)-2]&&r[i]===this.tic[0];i<r.length&&r[i]!==this.tic[0];)u+=r[i],i+=1;(h=u.split(this.tic).join(""))===this.trueValue||h===this.falseValue||!this.isNaN(this.parseFloat(h))&&""!==h?n.push(this.tic+h+this.tic):(n.push(h),""===h&&m&&(s[n.length-1]="0")),i+=1}else if("%"===r[i]&&0<n.length){var c=n[0],d=this.parseFloat(c);this.isNaN(d)||(n.pop(),n.push((d/100).toString())),i+=1}else if(0===r.substring(i).indexOf(this.trueValue))n.push(this.trueValue),i+=this.trueValue.length;else if(0===r.substring(i).indexOf(this.falseValue))n.push(this.falseValue),i+=this.falseValue.length;else if(r[i]===this.tic[0]||"|"===r[i]){u=r[i].toString();for(i++;i<r.length&&r[i]!==this.tic[0];)u+=r[i],i+=1;n.push(u+this.tic),i+=1}else if(" "===r[i]&&i<r.length-1)i+=1;else switch(r[i]){case"#":var N=0,N=-1<this.getErrorStrings().indexOf(r.substring(i))?-1===r.indexOf("!")||-1===r.substring(i).indexOf("!")?-1<r.indexOf("#N/A")?r.indexOf("#N/A")+4+i:r.indexOf("?")+1+i:r.indexOf("!")+1+i:i+1;n.push(this.substring(r,i,N-i)),i=N;break;case"n":u="";if("n"!==r[i+=1]){if(0===r.substring(i).indexOf("Infinity"))i+=(u="Infinity").length;else{for("u"!==r[i]&&!l&&"-"!==r[i]||(u="-",l)||(i+=1);i<r.length&&(this.isDigit(r[i])||r[i]===a||"."===r[i]);)u+=r[i]===a?".":r[i],i+=1;i<r.length&&"%"===r[i]&&(i+=1,""===u?0<n.length&&(c=n[0],d=this.parseFloat(c),this.isNaN(d)||(n.pop(),n.push((d/100).toString()))):u=(this.parseFloat(u)/100).toString())}u&&n.push(u)}break;case this.parser.tokenAdd:this.getValArithmetic(n,"add",e),i+=1;break;case this.parser.tokenSubtract:this.getValArithmetic(n,"sub",e),i+=1;break;case this.parser.tokenMultiply:this.getValArithmetic(n,"mul",e),i+=1;break;case this.parser.tokenDivide:this.getValArithmetic(n,"div",e),i+=1;break;case this.parser.tokenLess:this.processLogical(n,"less"),i+=1;break;case this.parser.tokenGreater:this.processLogical(n,"greater"),i+=1;break;case this.parser.tokenGreaterEq:this.processLogical(n,"greaterEq"),i+=1;break;case this.parser.tokenLessEq:this.processLogical(n,"lessEq"),i+=1;break;case this.parser.tokenNotEqual:this.processLogical(n,"notEq",s),s.length=0,i+=1;break;case this.parser.tokenOr:this.processLogical(n,"or"),i+=1;break;case this.parser.tokenAnd:this.processLogical(n,"and"),i+=1;break;case this.parser.tokenEqual:this.processLogical(n,"equal",s),s.length=0,i+=1;break;default:return this.getErrorStrings()[$.CommonErrors.Value]}}}if(0===n.length)return"";for(var u="",v=n.length;0<v;){var E=n.pop();if(-1<this.getErrorStrings().indexOf(E))return E;if(""===(u=E+u)&&this.isCellReference(r)&&this.getTreatEmptyStringAsZero())return"0";v--}return u}catch(r){if(-1<this.getErrorStrings().indexOf(r)||-1<this.formulaErrorStrings.indexOf(r))throw r;throw new U(this.formulaErrorStrings[$.FormulasErrorsStrings.InvalidExpression])}},R.prototype.getValArithmetic=function(r,t,e){var n=!1,i=r.pop(),o=-1!==i.indexOf(".")?i.split(".")[1].length:0,o=Math.pow(10,o),s=r.pop(),a=-1!==s.indexOf(".")?s.split(".")[1].length:0,a=Math.pow(10,a),l=a<=o?o:a,u=o*a,h=(i=""===(i=i===this.trueValue?"1":i===this.falseValue?"0":i)?"0":this.getErrorStrings().indexOf(i.toString())<0?this.parseFloat(i+"").toString():i,Number(i));isNaN(h)&&!e&&(n=!0,i===this.getErrorStrings()[$.CommonErrors.DivZero]?r.push(this.getErrorStrings()[$.CommonErrors.DivZero]):r.push(this.getErrorStrings()[$.CommonErrors.Value])),s=""===(s=s===this.trueValue?"1":s===this.falseValue?"0":s)?"0":this.getErrorStrings().indexOf(s.toString())<0?this.parseFloat(s+"").toString():s,h=Number(s),isNaN(h)&&!e&&(n=!0,s===this.getErrorStrings()[$.CommonErrors.DivZero]?r.push(this.getErrorStrings()[$.CommonErrors.DivZero]):r.push(this.getErrorStrings()[$.CommonErrors.Value])),"add"!==t||n||r.push(((Number(s)*l+Number(i)*l)/l).toString()),"sub"!==t||n||r.push(((Number(s)*l-Number(i)*l)/l).toString()),"mul"!==t||n||r.push((Number(s)*a*(Number(i)*o)/u).toString()),"div"!==t||n||(this.isNaN(this.parseFloat(i))||this.isNaN(this.parseFloat(s))?r.push(this.getErrorStrings()[$.CommonErrors.Value]):0===this.parseFloat(i)?r.push(this.getErrorStrings()[$.CommonErrors.DivZero]):r.push((Number(s)*u/(Number(i)*u)).toString()))},R.prototype.processLogical=function(r,t,e){var n,i,o,s,a,l,u,h,p=!1;return"and"!==t&&"equal"!==t&&"notEq"!==t&&(n=r.pop(),u=r.pop(),-1<this.getErrorStrings().indexOf(n)?(h=n,p=!0):-1<this.getErrorStrings().indexOf(u)&&(h=u,p=!0),this.isNaN(this.parseFloat(n))&&this.isNaN(this.parseFloat(u))&&(n=n.toString().toLowerCase(),u=u.toString().toLowerCase()),z.isNullOrUndefined(n)||(i=-1<n.indexOf(this.tic)?n:this.parseFloat(n)),z.isNullOrUndefined(u)||(o=-1<u.indexOf(this.tic)?u:this.parseFloat(u)),"*"===n)&&this.isNaN(this.parseFloat(u))&&""!==u&&(s=!0),"less"!==t||p||(h=this.isNaN(i)||this.isNaN(o)?u.toUpperCase().split(this.tic).join("").localeCompare(n.toUpperCase().split(this.tic).join(""))<0?this.trueValue:this.falseValue:o<i?this.trueValue:this.falseValue),"greater"!==t||p||(h=this.isNaN(i)||this.isNaN(o)?0<u.toUpperCase().split(this.tic).join("").localeCompare(n.toUpperCase().split(this.tic).join(""))?this.trueValue:this.falseValue:i<o?this.trueValue:this.falseValue),"lessEq"!==t||p||(h=this.isNaN(i)||this.isNaN(o)?u.toUpperCase().split(this.tic).join("").localeCompare(n.toUpperCase().split(this.tic).join(""))<=0?this.trueValue:this.falseValue:o<=i?this.trueValue:this.falseValue),"greaterEq"!==t||p||(h=this.isNaN(i)||this.isNaN(o)?0<=u.toUpperCase().split(this.tic).join("").localeCompare(n.toUpperCase().split(this.tic).join(""))?this.trueValue:this.falseValue:i<=o?this.trueValue:this.falseValue),"and"!==t||p||(n=r.pop().toString(),u="",0<r.length&&(u=r.pop().toString()),h=-1<this.getErrorStrings().indexOf(n)?n:-1<this.getErrorStrings().indexOf(u)?u:(h=""+u+n).split(this.tic).join("")),"equal"!==t&&"notEq"!==t||p||(l=a=void 0,e?(a=e[r.length-1],n=r.pop(),l=e[r.length-1]):n=r.pop(),u=r.pop(),h=-1<this.getErrorStrings().indexOf(n)?n:-1<this.getErrorStrings().indexOf(u)?u:(u="TRUE"===u?"1":"FALSE"===u?"0":u,this.isNaN(this.parseFloat(n="TRUE"===n?"1":"FALSE"===n?"0":n))&&this.isNaN(this.parseFloat(u))&&(n=n.toString().toLowerCase(),u=u.toString().toLowerCase()),"*"===n&&this.isNaN(this.parseFloat(u))&&""!==u&&(s=!0),"equal"===t?n===u||void 0!==a&&a===u||void 0!==l&&l===n||s?this.trueValue:this.falseValue:s||u===n||a&&a===u||l&&l===n?this.falseValue:this.trueValue)),"or"!==t||p||(h=Math.pow(this.parseFloat(o),this.parseFloat(i)).toString(),h=this.isNaN(this.parseFloat(h))?this.getErrorStrings()[$.CommonErrors.Value]:h),r.push(h),h},R.prototype.computeStoreCells=function(r){for(var t=r.cellValue,e=r.cellRange,n=r.criteria,i=r.argArray,o=r.isCriteria,s=r.storedCells,a=r.isCountIfS===this.trueValue,l=r.countVal||0,u=o===this.trueValue?s:t,h=[],p=0;p<u.length;p++){var g=[],f=this.getValueFromArg(t[p]),m=i[a?1+2*l:2+l],c=m.startsWith(this.tic)&&m.endsWith(this.tic),d=(m=this.getANDComputedValue(m.trim())).includes("*"),N="*"===m||"<>*"===m,v=d&&!N?m.replace(/\*/g,"").trim():m,E=!1,S=(!c&&this.isCellReference(v)&&(v=this.getValueFromArg(v),E=!0),m=v=d&&!N&&(d=m.indexOf("*"),"*"===m[0]&&(v="*"+v),"*"===m[m.length-1]&&(v+="*"),0<d)&&d<m.length-1?m.substring(0,d)+"*"+m.substring(d+1):v,"");if((o=a?this.trueValue:o)===this.trueValue){var y="",C=0,b=0,N=void 0,d=void 0,v=void 0,A=void 0,N=(s[p]=(a&&!l?t:s)[p],y=s[p],l&&(d=-1<(N=e[l-1]).indexOf("!")?M(N.substring(N.lastIndexOf("!")+1)):M(N),v=-1<y.indexOf("!")?qr(y.substring(y.lastIndexOf("!")+1)):qr(y),A=-1<e[l].indexOf("!")?M(e[l].substring(e[l].lastIndexOf("!")+1)):M(e[l])),-1<y.indexOf("!")),O=void 0,F="",x="";for(N&&(x=y.substring(0,y.lastIndexOf("!")+1),y=y.substring(y.lastIndexOf("!")+1));!this.isDigit(y[C]);)C+=1;if(this.isCellReference(e[l])&&-1<e[l].indexOf(":"))for(S=a&&!l?-1<u[p].indexOf("!")?u[p].substring(u[p].lastIndexOf("!")+1):u[p]:Br(A[0]+(v[0]-d[0]),A[1]+(v[1]-d[1])),(O=-1<e[l].indexOf("!"))&&(F=e[l].substring(0,e[l].lastIndexOf("!")+1));!this.isDigit(S[b]);)b+=1;var A=this.substring(y,C),v=this.substring(S,b),d=this.substring(y,C,y.length-C),V=this.substring(S,b,S.length-C);N&&(A=x+A,v=x+v),d!==V&&(s[p]=this.substring(s[p],N?x.length+C:C)+V),S=s[p].split(A).join(v),S=O?F+(S=-1<S.indexOf("!")?S.substring(S.lastIndexOf("!")+1):S):S.substring(S.lastIndexOf("!")+1),f=this.getValueFromArg(S),m=a?m:this.getANDComputedValue(n[l-1])}d=this.getOperatorAndCriteria(m,"equal"),N=d.op;m=d.criteria,(-1<(m=(c||!this.isCellReference(m)||E&&(""===S||a))&&!m.includes(this.arithMarker)?m:this.getValueFromArg(m)).indexOf("*")||-1<m.indexOf("?"))&&(f=this.findWildCardValue(m.toLowerCase(),f.toLowerCase())),g.push(f.toLowerCase()),g.push(m.toLowerCase()),this.processLogical(g,N)===this.trueValue&&(o===this.falseValue?h.push(t[p]):h.push(S))}return s=h,h=[],s},R.prototype.computeIfsFormulas=function(r,t,e){if(t===this.trueValue&&(z.isNullOrUndefined(r)||""===r[0]||r.length<2||127<r.length||r.length%2!=0))return this.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var n=r,i=[],o=[],s=[],a=0,l=0;l<n.length;l++)0!==l&&l%2!=1||!this.isCellReference(n[l])?o.push(n[l].trim()):i.push(-1<n[l].indexOf(":")?n[l].trim():Xr(M(n[l])));for(var u=[],l=0;l<i.length;l++)u.push(this.getCellCollection(i[l]).length);for(var h=0;h<u.length;h++)if(u[h]&&u[h+1]&&u[h]!==u[h+1])return this.getErrorStrings()[$.CommonErrors.Value];for(var p=0;p<o.length;p++)if(""===o[p]||this.isCellReference(o[p])&&""===this.getValueFromArg(o[p]))return e===this.trueValue?this.getErrorStrings()[$.CommonErrors.DivZero]:0;if(t===this.falseValue){var g,f=this.falseValue,m={cellValue:g=this.getCellCollection(i[1]),cellRange:i,criteria:o,argArray:n,isCriteria:f,storedCells:s,isCountIfS:t};if(0===(s=this.computeStoreCells(m)).length)return e===this.trueValue?this.getErrorStrings()[$.CommonErrors.DivZero]:0}for(l=t===this.trueValue?0:2;l<i.length;l++){f=this.trueValue,f=t===this.trueValue&&0===l?this.falseValue:this.trueValue;m={cellValue:g=this.getCellCollection(i[l]),cellRange:i,criteria:o,argArray:n,isCriteria:f,storedCells:s,isCountIfS:t,countVal:l};if(0===(s=this.computeStoreCells(m)).length)return e===this.trueValue?this.getErrorStrings()[$.CommonErrors.DivZero]:0}for(var c=0,d=-1<i[0].indexOf("!")?M(i[0].substring(i[0].lastIndexOf("!")+1)):M(i[0]),r=i[i.length-1],N=-1<r.indexOf("!")?M(r.substring(r.lastIndexOf("!")+1)):M(r),h=0;h<s.length;h++){var v="",E="",S=0,y=0,C=-1<(v=s[h]).indexOf("!"),b=void 0,A="",O="";for(C&&(O=v.substring(0,v.lastIndexOf("!")+1),v=v.substring(v.lastIndexOf("!")+1));!this.isDigit(v[S]);)S+=1;if(this.isCellReference(i[0])&&-1<i[0].indexOf(":"))for(E=Br(d[0]+(qr(v)[0]-N[0]),d[1]+(qr(v)[1]-N[1])),(b=-1<i[0].indexOf("!"))&&(A=i[0].substring(0,i[0].lastIndexOf("!")+1));!this.isDigit(E[y]);)y+=1;var F=this.substring(v,S),x=this.substring(E,y),V=this.substring(v,S,v.length-S),R=this.substring(E,y,E.length-S);C&&(F=O+F,x=O+x),V!==R&&(s[h]=this.substring(s[h],C?O.length+S:S)+R),g=s[h].split(F).join(x),g=b?A+(g=-1<g.indexOf("!")?g.substring(g.lastIndexOf("!")+1):g):g.substring(g.lastIndexOf("!")+1),t===this.trueValue?a+=1:(V=this.getValueFromArg(g),C=parseFloat(""===V&&e!==this.trueValue?"0":V),this.isNumber(C)&&(c++,a+=C))}return e===this.trueValue&&(a/=c),a},R.prototype.computeCountIfsFormulas=function(r){var t=this.grid;if(z.isNullOrUndefined(r)||""===r[0]||r.length<2||127<r.length||r.length%2!=0)return this.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var e=r,n=[],i=[],o=0;o<e.length;o++)o%2==0&&this.isCellReference(e[o])?n.push(-1<e[o].indexOf(":")?e[o].trim():Xr(M(e[o]))):i.push(e[o].trim());if(n.length!==i.length)return this.getErrorStrings()[$.CommonErrors.Value];for(var s=[],a=this.grid,o=0;o<n.length;o++){var l=M(n[o]),u=l[0],h=l[1],p=l[2],g=l[3],l="",f=this.getSheetFamilyItem(a),f=(n[o].startsWith("!")?(l=n[o].substring(0,n[o].replace("!","").indexOf("!")+2),null!==f.tokenToParentObject&&(a=f.tokenToParentObject.get(l))):null!==f.parentObjectToToken&&(l=f.parentObjectToToken.get(a)),this.grid=a,this.getSheetId(a));if(-1===ii("Sheet"+f,this.getHostSheetInfo()))return this.grid=t,this.getErrorStrings()[$.CommonErrors.Ref];var m=this.getCellValueFn(a,this.cell,f,!0);if(0<s.length){l=s[s.length-1],f=l.endRow-l.startRow+1,l=l.endCol-l.startCol+1;if(p-u+1!=f||g-h+1!=l)return this.getErrorStrings()[$.CommonErrors.Value]}s.push({startRow:u,startCol:h,endRow:p,endCol:g,getCellValue:m,grid:a})}for(var c=0;c<i.length;c++)if(""===i[c])return this.grid=t,0;for(var d=[],o=0;o<s.length;o++){this.grid=t;var N=i[o],v=N.startsWith(this.tic)&&N.endsWith(this.tic),E=(N=this.getANDComputedValue(N.trim())).includes("*"),S="*"===N||"<>*"===N,y=E&&!S?N.replace(/\*/g,"").trim():N,C=!1,S=(!v&&this.isCellReference(y)&&(y=this.getValueFromArg(y),C=!0),N=y=E&&!S&&(E=N.indexOf("*"),"*"===N[0]&&(y="*"+y),"*"===N[N.length-1]&&(y+="*"),0<E)&&E<N.length-1?N.substring(0,E)+"*"+N.substring(E+1):y,this.getOperatorAndCriteria(N,"equal")),b=S.op,A=(N=S.criteria,-1<(N=!v&&this.isCellReference(N)&&!C||N.includes(this.arithMarker)?this.getValueFromArg(N):N).indexOf("*")||-1<N.indexOf("?")),E=s[o],u=E.startRow,h=E.startCol,p=E.endRow,g=E.endCol,m=E.getCellValue,y=s[o].grid,O=(this.grid=y,void 0);if(0===o)for(var F=u;F<=p;F++)for(var x=h;x<=g;x++)O=m(F+1,x+1,Br(F,x)),A&&(O=this.findWildCardValue(N.toLowerCase(),O.toLowerCase())),this.processLogical([O.toLowerCase(),N.toLowerCase()],b)===this.trueValue&&d.push({rowIdx:F,colIdx:x});else for(var V=d,R=s[o-1],d=[],T=0;T<V.length;T++){var I=V[T];I.rowIdx=u+(I.rowIdx-R.startRow),I.colIdx=h+(I.colIdx-R.startCol),O=m(I.rowIdx+1,I.colIdx+1,Br(I.rowIdx,I.colIdx)),A&&(O=this.findWildCardValue(N.toLowerCase(),O.toLowerCase())),this.processLogical([O.toLowerCase(),N.toLowerCase()],b)===this.trueValue&&d.push({rowIdx:I.rowIdx,colIdx:I.colIdx})}if(0===d.length)return this.grid=t,0}return this.grid=t,d.length},R.prototype.getOperatorAndCriteria=function(r,t){return r.startsWith("<=")?(t="lessEq",r=r.substring(2)):r.startsWith(">=")?(t="greaterEq",r=r.substring(2)):r.startsWith("<>")?(t="notEq",r=r.substring(2)):r.startsWith("<")?(t="less",r=r.substring(1)):r.startsWith(">")?(t="greater",r=r.substring(1)):r.startsWith("=")&&(t="equal",r=r.substring(1)),{op:t,criteria:r}},R.prototype.processNestedFormula=function(r,t,e){if(e&&!e.toString().includes('"')){var n=r.indexOf(t)+t.length;if('"'===r[n]&&this.getErrorStrings().indexOf(e.toString())<0&&!this.isNumber(e)&&e!==this.trueValue&&e!==this.falseValue)return r.split(t).join('"'+e+'"')}return r.split(t).join("n"+e)},R.prototype.isNaN=function(r){return"NaN"===r.toString()||"string"==typeof r},R.prototype.isNumber=function(r){return 0<=r-parseFloat(r)},R.prototype.fromOADate=function(r){60<(r=0<r&&r<1?1+r:0===r?1:r)&&--r;var t=new Date("01/01/1900"),t=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return new Date(new Date((r-1)*this.millisecondsOfaDay+t).toUTCString().replace(" GMT",""))},R.prototype.getSerialDateFromDate=function(r,t,e){for(var n=0,i=(r<1900&&(r+=1900),!1);!i;){for(;12<t;)r++,t-=12;for(;t<1;)t+=12,r--;for(var i=!0,o=new Date(r,t,1,-1).getDate();o<e;)o=new Date(r,t,1,-1).getDate(),t++,e-=o,i=!1;e<1&&(--t<1&&(t=12,r--),e=(o=new Date(r,t,1,-1).getDate())+e,i=!1)}var s=Date.parse(r+"/"+t+"/"+e);return n=this.isNaN(s)?n:this.toOADate(new Date(s))},R.prototype.intToTime=function(r){var t=r.toString().split(".");return z.isNullOrUndefined(t[1])||(r=parseFloat(t[0]+1+"."+t[1])||r),this.intToDate(r.toString())},R.prototype.toOADate=function(r,t,e){var n=new Date("01/01/1900"),r=j(r)?r:new Date(r),n=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),r=(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds())-n)/864e5;return(t?r:parseInt(r.toString(),10))+(e?0:60<r?2:1)},R.prototype.calculateDate=function(r){return this.parseFloat(r)<10?"0"+r:r},R.prototype.isTextEmpty=function(r){return null===r||""===r},R.prototype.isDigit=function(r){r=r.charCodeAt(0);return 47<r&&r<58},R.prototype.getANDComputedValue=function(r){return(r=r.startsWith(this.arithMarker)&&r.includes("c")?this.getValueFromArg(r):r).split(this.tic).join("")},R.prototype.findLastIndexOfq=function(r){for(var t=r.lastIndexOf("q"),e=r.lastIndexOf(this.leftBracket);e<t;)t=r.substring(0,t).lastIndexOf("q");return t},R.prototype.getValueFromArg=function(t,r,e,n,i){if(!(t=t.trim())||-1<this.getErrorStrings().indexOf(t))return t;var o=t[0];if(o===this.tic||o===this.singleTic){var s=t.split(this.tic).join("");if(this.isNaN(this.parseFloat(s))&&(!i||o!==this.tic||!t.endsWith(this.tic))){i=this.isDate(s);if(i&&!this.isNaN(i.getDate()))return this.toOADate(i,!0).toString()}return t=t.endsWith(this.tic)&&"."!==(a=this.getParseDecimalSeparator())&&s.includes(a)&&(s=s.replace(a,"."),this.isNumber(s))?s:t}if("u"===o&&t.includes(this.arithMarker))t=this.parser.parseSimpleOperators(t.split("u").join("0-"),[this.parser.tokenSubtract],["-"]);else if(!this.isUpperChar(o)){var a=this.getParseDecimalSeparator();if(this.isDigit(o)||o===a||"-"===o||"n"===o)return"n"===o&&-1<(t=t.substring(1)).indexOf('"n')&&(t=t.replace('"n','"')),t="."!==a&&t.includes(a)&&(s=t.replace(a,"."),this.isNumber(s))?s:t}i=o===this.sheetToken;if(i||this.isUpperChar(o)&&!["+","-","/","*",")",")","{"].some(function(r){return t.includes(r)})){a=this.isCellReference(t);if((t=a&&!i&&null!==(s=this.getSheetFamilyItem(this.grid)).sheetNameToParentObject&&s.parentObjectToToken.has(this.grid)?s.parentObjectToToken.get(this.grid)+t:t)===this.cell){o=this.getDependentCells().get(t);if(null!=o&&-1<o.indexOf(t)&&this.arrayRemove(o,t),this.getDependentFormulaCells().has(this.cell)||this.clearFormulaDependentCells(this.cell),!r)throw new U(this.formulaErrorStrings[$.FormulasErrorsStrings.CircularReference])}i=this.getParentObjectCellValue(t,!1,r,n),s=z.isNullOrUndefined(i)?"":i.toString();return a&&this.updateDependentCell(t),s}return this.computeValue(t,!1,e)},R.prototype.isDate=function(r){var t;return("object"==typeof r||null!==Date.parse(r))&&(t=void 0,(t="string"==typeof r?this.checkDateFormat(r,!1,!0):new Date(Date.parse(r)))>=this.dateTime1900)?t:null},R.prototype.parseDate=function(r){return this.isNaN(r)?"string"!=typeof r||(r=this.checkDateFormat(r,!0),this.isNaN(r))?this.getErrorStrings()[$.CommonErrors.Value]:r:r instanceof Date?new Date(r):(r=parseInt(r,10))<0?this.getErrorStrings()[$.CommonErrors.Num]:r<=60?new Date(this.dateTime1900.getTime()+864e5*(r-1)):new Date(this.dateTime1900.getTime()+864e5*(r-2))},R.prototype.checkDateFormat=function(r,t,e){var n=this.parentObject;if(n&&"function"==typeof n.getModuleName&&"spreadsheet"===n.getModuleName()){n=this.hostParseDate(r);if(n.isDate)return n.dateObj;if(e&&!n.isTime)return new Date(NaN)}return-1<this.getErrorStrings().indexOf(r)?new Date(NaN):t?new Date(r):new Date(Date.parse(r))},R.prototype.isCellReference=function(r){if(""===(r=r.trim()))return!1;r=this.setTokensForSheets(r);var t=this.getSheetToken(r),e=!1,n=!1,i=!1;if((r=""!==t?r.split(t).join(""):r).indexOf(":")!==r.lastIndexOf(":"))return!1;for(var o=r.split("").join(this.getParseArgumentSeparator()).split(this.getParseArgumentSeparator()),s=0;s<o.length;s++)if(this.isChar(o[s]))n=!0;else if(this.isDigit(o[s]))i=!0;else{if(":"!==o[s])return!1;n&&i&&(e=!0),i=n=!1}return-1<r.indexOf(":")&&-1===r.indexOf(this.tic)?!!(e&&n&&i||(n&&!i||!n&&i)&&!e):!!(n&&i&&-1===r.indexOf(this.tic)&&this.isValidCell(r))},R.prototype.setTokensForSheets=function(r){var t,e=this.getSheetFamilyItem(this.grid),n=this.getSortedSheetNames();if(null!=n)for(var i=0;i<n.length;i++){var o=(o=e.sheetNameToToken.get(n[i])).split(this.sheetToken).join(this.tempSheetPlaceHolder),s=this.singleTic+"SHEET"+n[i]+this.singleTic+this.sheetToken;-1===r.indexOf(s)&&(s="SHEET"+n[i]+this.sheetToken),r=r.split(s).join(o),s=n[i]+this.sheetToken,r=r.split(s).join(o)}return-1<(r=r.split(this.tempSheetPlaceHolder).join(this.sheetToken)).indexOf("!!")&&((t=(r=r.replace("!!","!")).split("!"))[1]=(parseInt(t[1],10)+1).toString(),r=t.join("!")),r},R.prototype.getParentObjectCellValue=function(r,t,e,n){if(r===this.trueValue||r===this.falseValue)return r;var i=r.lastIndexOf(this.sheetToken),o=this.grid;if(-1<i){if(null===(l=this.getSheetFamilyItem(o)).tokenToParentObject)return this.getErrorStrings()[$.CommonErrors.Value];this.grid=l.tokenToParentObject.get(r.substring(0,i+1)),a=r.substring(i+1)}else{for(var s=0;s<r.length&&this.isChar(r[s]);)s++;if(s===r.length)return""===r?this.getErrorStrings()[$.CommonErrors.Value]:this.getErrorStrings()[$.CommonErrors.Name];var a=r;(l=this.getSheetFamilyItem(o)).isSheetMember&&null!=l.parentObjectToToken&&(r=l.parentObjectToToken.get(this.grid)+r)}this.isDigit(a[0])&&0<(i=a.search(/[a-zA-Z]/))&&(a=a.substring(i,a.length)+a.substring(0,i));var l=this.rowIndex(a),i=this.colIndex(a);if(0<l&&l<=hi&&0<i&&i<=pi){var a=this.getSheetId(this.grid),u=this.getHostSheetInfo();if(u.length&&-1===ii("Sheet"+a,u))return this.grid=o,this.getErrorStrings()[$.CommonErrors.Ref];u=this.getCellValueFn(o,this.cell,a,!1,t,e,n)(l,i,r)}else u=this.getErrorStrings()[$.CommonErrors.Name];return this.grid=o,z.isNullOrUndefined(u)?"":u},R.prototype.getCellValueFn=function(r,n,i,o,s,a,l){var u=this,h=(h=n)&&(r===this.grid?"":h+","+("string"==typeof r&&-1<Number(r)?r:this.getSheetID(r))),p=this.parentObject.getValueRowCol.bind(this.parentObject)||this.getValueRowCol.bind(this);return function(r,t,e){if(n===e&&!a)throw u.formulaErrorStrings[$.FormulasErrorsStrings.CircularReference];u.cell=e;r=p(i,r,t,h,s,a,l);return z.isNullOrUndefined(r)?r="":(r=r.toString(),"."!==(t=u.getParseDecimalSeparator())&&r.includes(t)&&(t=r.replace(t,"."),u.isNumber(t))&&(r=t)),u.cell=n,o&&u.updateDependentCell(e),r}},R.prototype.isValidCell=function(r){0===r.search(/\d/)&&(t=r.search(/[a-zA-Z]/),r=r.substring(t,r.length)+r.substring(0,t));var t=this.rowIndex(r),r=this.colIndex(r);return 0<t&&t<=hi&&0<r&&r<=pi},R.prototype.getSheetId=function(r){return r&&"string"==typeof r&&-1<Number(r)?Number(r):this.getSheetID(r)+1},R.prototype.getValueRowCol=function(r,t,e){var n,e=(this.convertAlpha(e)+t.toString()).toUpperCase();return this.storedData.has(e)?(n=this.getKeyValue(e),z.isNullOrUndefined(n)?"":n.toString()):(n=this.rowsToKeyMap.get(t),z.isNullOrUndefined(n)||(n=(t=n.toString()).toUpperCase(),this.isCellReference(n)&&n!==e)||this.evaluatingKeys.has(n)||(e=this.getKeyValue(t),z.isNullOrUndefined(e))?"":""!==(e=e.toString())&&"%"===e[e.length-1]&&1<e.length&&(n=this.parseFloat(e.substring(0,e.length-1)),this.isNaN(n))?(Number(n)/100).toString():e)},R.prototype.defineFunction=function(r,t,e,n){"string"==typeof t&&(t=z.getValue(t,window)),r=r.toUpperCase(),this.libraryFormulas.set(r,{handler:t,isCustom:!0,description:e,category:n})},R.prototype.valueChanged=function(t,r,e,n,i,o,s,a,l,u,h,p){var g=t,n=(this.spreadSheetUsedRange=n,this.grid=t,!0),t=!0,f=this.getSheetFamilyItem(g),m=J(r.getColIndex())+r.getRowIndex().toString(),o=(this.actCell=o+"!"+m,null!==f.sheetNameToParentObject&&0<f.sheetNameToParentObject.size&&(m=f.parentObjectToToken.get(g)+m),r.getFormulaValue().toUpperCase());if((-1<o.indexOf("=RAND()")||-1<o.indexOf("=NOW()")||-1<o.indexOf("NOW()")||-1<o.indexOf("RAND()")||-1<o.indexOf("=RANDBETWEEN(")||-1<o.indexOf("RANDBETWEEN(")||this.randomValues.has(m))&&(f=this.randCollection.toString(),this.randomValues.has(m)?this.randomValues.has(m)&&(-1<o.indexOf("=RAND()")||-1<o.indexOf("=NOW()")||-1<o.indexOf("NOW()")||-1<o.indexOf("RAND()")||-1<o.indexOf("=RANDBETWEEN(")||-1<o.indexOf("RANDBETWEEN(")?this.randomValues.set(m,r.getFormulaValue()):r.getFormulaValue().toUpperCase()!==this.randomValues.get(m.toUpperCase())&&(this.randomValues.delete(m),f=f.split(m+this.parseArgumentSeparator).join("").split(this.parseArgumentSeparator+m).join("").split(m).join(""),this.randCollection=f.split(this.parseArgumentSeparator)),0===this.randomValues.size)&&this.randCollection.length&&(this.isRandomVal=!1,this.randomValues.clear(),this.randCollection=[]):(this.randomValues.set(m,r.getFormulaValue()),this.randCollection.push(m),this.isRandomVal=!0)),r.getFormulaValue()&&r.getFormulaValue()[0]===this.getFormulaCharacter()){this.cell=m;var c,o=void 0;if(z.isNullOrUndefined(t)||(t=e),this.getFormulaInfoTable().has(m)){if(o=this.getFormulaInfoTable().get(m),r.getFormulaValue()!==o.getFormulaText()||null==o.getParsedFormula()){o.setFormulaText(r.getFormulaValue()),this.getDependentFormulaCells().has(this.cell)&&this.clearFormulaDependentCells(this.cell);try{o.setParsedFormula(this.parser.parseFormula(r.getFormulaValue()))}catch(r){o.setFormulaValue(r),t=!1}}else this.parser.isError=!1;t&&(this.parser.isFormulaParsed=!0,n=(c=this.calculateFormula(o.getParsedFormula(),i))!==o.getFormulaValue()&&(!this.parentObject.isEdit||c!==this.formulaErrorStrings[$.FormulasErrorsStrings.CircularReference]),o.setFormulaValue(c))}else{(o=new gi).setFormulaText(r.getFormulaValue()),this.getDependentFormulaCells().has(m)||this.getDependentFormulaCells().set(m,new Map),this.getFormulaInfoTable().set(m,o);try{o.setParsedFormula(this.parser.parseFormula(r.getFormulaValue()))}catch(r){o.setFormulaValue(r),t=!1}t&&(n=(c=this.calculateFormula(o.getParsedFormula(),i))!==this.formulaErrorStrings[$.FormulasErrorsStrings.CircularReference],o.setFormulaValue(c))}t&&(void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(g)+1,o.getFormulaValue(),r.getRowIndex(),r.getColIndex()):this.parentObject.setValueRowCol(this.getSheetId(g),o.getFormulaValue(),r.getRowIndex(),r.getColIndex(),o.getFormulaText(),s))}else this.getFormulaInfoTable().has(m)&&(this.getFormulaInfoTable().delete(m),this.getDependentFormulaCells().has(m))&&this.clearFormulaDependentCells(m);t&&n&&this.getDependentCells().has(m)&&("Automatic"===this.parentObject.calculationMode||!this.parentObject.isEdit||h)&&this.getDependentCells().get(m).toString()!==m&&this.refreshDependentCells(m,void 0,void 0,a,l,u,h,p)},R.prototype.setValueRowCol=function(r,t,e,n){},R.prototype.getSortedSheetNames=function(){var r=this.getSheetFamilyItem(this.grid);if(null!=r&&null!=r.sheetNameToToken){if(null!=this.sortedSheetNames)return this.sortedSheetNames;var e=[];r.sheetNameToToken.forEach(function(r,t){e.push(t)}),e.sort(function(r,t){return t.length-r.length}),this.sortedSheetNames=e}return this.sortedSheetNames},R.prototype.getErrorLine=function(r){r=r.stack?r.stack.split("\n")[1].split(":"):null;return r?r[r.length-2]:null},R.prototype.createSheetFamilyID=function(){return this.sheetFamilyID===Number.MAX_SAFE_INTEGER&&(this.sheetFamilyID=Number.MIN_SAFE_INTEGER),this.sheetFamilyID++},R.prototype.computeMinMax=function(r,t){var e=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(e=!0,r.pop()),z.isNullOrUndefined(r)||0===r.length)return this.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var n="max"===t?this.minValue:this.maxValue,i=0,o=r.length;i<o;i++)""===r[i].split(this.tic).join("").trim()&&(n=0);var s=r;if(255<s.length)return this.getErrorStrings()[$.CommonErrors.Value];for(var a=0;a<s.length;a++)if(-1<s[a].indexOf(":")&&this.isCellReference(s[a]))for(var l=this.getCellCollection(s[a]),u=0;u<l.length;u++){var h=e?this.getValueFromArg(l[u],null,null,!0):this.getValueFromArg(l[u]);e&&h.includes("SUBTOTAL(")||(g=this.parseFloat(h),""===h)||this.isNaN(this.parseFloat(g))||-1<this.getErrorStrings().indexOf(h)||(n="max"===t?Math.max(n,g):Math.min(n,g))}else{var p=e?this.getValueFromArg(s[a],null,null,!0):this.getValueFromArg(s[a]);if(!e||!p.includes("SUBTOTAL(")){var g=0,f=this.isCellReference(s[a]),m=""===p&&f,c=this.isNaN(this.parseFloat(p))&&f,f=p===(this.trueValue||this.falseValue)&&f;if(s[a]=s[a].startsWith("n")?s[a].slice(1):s[a],-1<this.getErrorStrings().indexOf(p))return p;if(p===this.trueValue&&s[a]===this.trueValue)p="1";else if(p===this.falseValue&&s[a]===this.falseValue)p="0";else if(m||c||f)continue;if(-1<p.indexOf('"')&&(p=p.split(this.tic).join("")),this.isNaN(this.parseFloat(p)))return this.getErrorStrings()[$.CommonErrors.Value];g=this.parseFloat(p),n="max"===t?Math.max(n,g):Math.min(n,g)}}return(n=n!==this.minValue&&n!==this.maxValue?n:0).toString()},R.prototype.calculateAvg=function(r,t){for(var e,n,i=r,o=0,s=0,a=0;a<i.length;a++)if(this.isCellReference(i[a])){if(-1<i[a].indexOf(":")){for(var l=this.getCellCollection(i[a]),u=0;u<l.length;u++)if(e=t?this.getValueFromArg(l[u],null,null,!0):this.getValueFromArg(l[u]),!t||!e.includes("SUBTOTAL(")){if(-1<this.getErrorStrings().indexOf(e))return e;z.isNullOrUndefined(e)||isNaN(this.parseFloat(e))||""===e||(o+=this.parseFloat(e),s+=1)}}else if(e=t?this.getValueFromArg(i[a],null,null,!0):this.getValueFromArg(i[a]),!t||!e.includes("SUBTOTAL(")){if(-1<this.getErrorStrings().indexOf(e))return e;z.isNullOrUndefined(e)||isNaN(this.parseFloat(e))||""===e||(o+=this.parseFloat(e),s+=1)}}else{if(-1<i[a].indexOf(this.tic)&&(isNaN(this.parseFloat(i[a].split(this.tic).join("")))||""===i[a].split(this.tic).join("").trim()))return this.getErrorStrings()[$.CommonErrors.Value];if(0!==i[a].length&&r[a]!==this.falseValue||(i[a]="0"),r[a]===this.trueValue&&(i[a]="1"),n=this.getValueFromArg(i[a].split(this.tic).join("")),-1<this.getErrorStrings().indexOf(n))return n;o+=this.parseFloat(n),s+=1}return 0===s?this.getErrorStrings()[$.CommonErrors.DivZero]:(o/s).toString()},R.prototype.registerGridAsSheet=function(r,t,e){z.isNullOrUndefined(this.modelToSheetID)&&(this.modelToSheetID=new Map),z.isNullOrUndefined(this.modelToSheetID.get(t))&&this.modelToSheetID.set(t,e);var n,e=this.getSheetFamilyItem(t),i=(e.isSheetMember=!0,r.toUpperCase());return 0===e.parentObjectToToken.size&&(e.parentObjectToToken=new Map),0===e.sheetNameToParentObject.size&&(e.sheetNameToParentObject=new Map),0===e.sheetNameToToken.size&&(e.sheetNameToToken=new Map),0===e.tokenToParentObject.size&&(e.tokenToParentObject=new Map),z.isUndefined(e.sheetNameToParentObject.get(i))?(n=this.sheetToken+this.tokenCount.toString()+this.sheetToken,this.tokenCount++,e.tokenToParentObject.set(n,t),e.parentObjectToToken.set(t,n),e.sheetNameToToken.set(i,n),e.sheetNameToParentObject.set(i,t)):(n=e.sheetNameToToken.get(i),e.tokenToParentObject.set(n,t),e.parentObjectToToken.set(t,n)),this.sortedSheetNames=null,r},R.prototype.unregisterGridAsSheet=function(i,r,o){var s=this,e=[r];o&&(e=[],z.isNullOrUndefined(this.modelToSheetID)||this.modelToSheetID.forEach(function(r,t){e.push(t)})),e.forEach(function(r){var t,e=s.getSheetFamilyItem(r),n=(o?r:i).toUpperCase();null!=e.sheetNameToParentObject&&e.sheetNameToParentObject.has(n)&&(e.sheetNameToParentObject.delete(n),t=e.sheetNameToToken.get(n),e.sheetNameToToken.delete(n),e.tokenToParentObject.delete(t),e.parentObjectToToken.delete(r)),s.modelToSheetID&&s.modelToSheetID.has(r)&&s.modelToSheetID.delete(r)}),this.sortedSheetNames=null},R.prototype.computeExpression=function(r,t){r=this.parser.parseFormula(r);return this.computeFormula(r,t)},R.prototype.isSheetMember=function(){var r=this.getSheetFamilyItem(this.grid);return!z.isNullOrUndefined(r)&&r.isSheetMember},R.prototype.destroy=function(){if(this.resetKeys(),this.dependentCells&&(this.dependentCells.clear(),this.dependentCells=null),this.dependentFormulaCells&&(this.dependentFormulaCells.clear(),this.dependentFormulaCells=null),this.formulaInfoTable&&(this.formulaInfoTable.clear(),this.formulaInfoTable=null),this.namedRanges.clear(),this.randomValues.clear(),this.randCollection=[],this.dependencyCollection=[],this.uniqueRange=[],this.sortRange=[],this.sortedSheetNames=null,this.evaluatingKeys.clear(),this.sheetFamiliesList&&(this.sheetFamiliesList.forEach(function(r){r.sheetDependentFormulaCells&&r.sheetDependentFormulaCells.clear(),r.sheetFormulaInfotable&&r.sheetFormulaInfotable.clear(),r.tokenToParentObject&&r.tokenToParentObject.clear(),r.parentObjectToToken&&r.parentObjectToToken.clear(),r.sheetNameToParentObject&&r.sheetNameToParentObject.clear(),r.sheetNameToToken&&r.sheetNameToToken.clear()}),this.sheetFamiliesList.clear(),this.sheetFamiliesList=null),this.modelToSheetID&&(this.modelToSheetID.clear(),this.modelToSheetID=null),this.defaultFamilyItem=null,this.lFormulas.clear(),this.parser&&this.parser.destroy(),this.parentObject=null,this.grid=null,"function"==typeof this.destroy)try{this.destroy()}catch(r){}},R.prototype.refreshRandValues=function(r){var t,e,n,i;this.randomValues.has(r)&&(this.randomValues.delete(r),-1<(r=this.randCollection.indexOf(r))&&this.randCollection.splice(r,1),0!==this.randomValues.size||this.randCollection.length||(this.randomValues.clear(),this.randCollection=[]));for(var o=0;o<this.randomValues.size;o++)t=this.rowIndex(this.randCollection[o]),e=this.colIndex(this.randCollection[o]),n=(parseFloat(this.getSheetToken(this.randCollection[o]).split(this.sheetToken).join(""))+1).toString(),i=this.getSheetFamilyItem(n),this.grid=i.sheetNameToParentObject.get(n),i=this.randomValues.get(this.randCollection[o]),i=this.computeFormula(i),void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(this.grid)+1,i,t,e):this.parentObject.setValueRowCol(this.getSheetId(this.grid),i,t,e)},R.prototype.refreshDependentCells=function(r,t,e,s,n,i,o,a){var l,u=this,h=(e||(l=!0,e=[]),this.getSheetFamilyItem(this.grid));try{var p=this.getDependentCells().get(r);if(p&&0!==p.length&&("Automatic"===this.parentObject.calculationMode||o||"calculate"===a))for(var g=void 0,g=0;g<p.length;g++){var f=p[g];if(!(t&&-1<f.indexOf(t)||f===r||-1<e.indexOf(f))){var m=this.getSheetToken(f),c=this.parentObject.sheets,d=this.parentObject.activeSheetIndex;if(m.length){this.grid=h.tokenToParentObject.get(m);var N=Number(this.grid),v="";if(!this.isNaN(N)&&c)for(var E=0;E<c.length;E++)c[E].id===N&&(v=c[E].name,d=E);this.actCell=v+"!"+f.split(m)[1]}else this.actCell=f.split(m)[1];try{var S=function(r,t){t&&(u.cell=r,u.parser.isFormulaParsed=!0,t.setFormulaValue(u.calculateFormula(t.getParsedFormula(),!0)))},y=this.rowIndex(f),C=this.colIndex(f),b=this.getFormulaInfoTable().get(f);if(void 0===this.parentObject.setValueRowCol)S(f,b),this.setValueRowCol(this.getSheetID(this.grid)+1,b.getFormulaValue(),y,C);else{var A=c&&c[d].rows&&c[d].rows[y-1]&&c[d].rows[y-1].cells&&c[d].rows[y-1].cells[C-1],O=void 0;if(A&&A.formula&&A.formula.toLowerCase().includes("unique")){if(this.uniqueCells&&-1!==this.uniqueCells.indexOf(f))continue;this.uniqueCells||(this.uniqueCells=[]),this.uniqueCells.push(f),S(f,b),O=b.getFormulaValue(),this.uniqueCells.splice(this.uniqueCells.indexOf(f),1),this.uniqueCells.length||(this.uniqueCells=null)}else if(A&&A.formula&&A.formula.toLowerCase().includes("sort")){if(this.sortCells&&-1!==this.sortCells.indexOf(f))continue;this.sortCells||(this.sortCells=[]),this.sortCells.push(f),S(f,b),O=b.getFormulaValue(),this.sortCells.splice(this.sortCells.indexOf(f),1),this.sortCells.length||(this.sortCells=null)}else-1===e.indexOf(f)&&e.push(f),O=null;this.parentObject.setValueRowCol(this.getSheetId(this.grid),O,y,C,b.getFormulaText())}this.refreshDependentCells(f,null,e,null,n)}catch(r){continue}}}if(l){if(!n&&i&&4===i.length){for(var m=this.getSheetToken(r),F=[],x=i[0],V=i[2];x<=V;x++)for(var R=i[1],T=i[3];R<=T&&(x!==V||R!==T);R++){A=m+Br(x,R);this.refreshDependentCells(A,null,e,null,n),F.push(A)}var I=new Set(F);e=e&&e.filter(function(r){return!I.has(r)})}var M=this.parentObject.sheets;(e=M?e:[]).forEach(function(r){for(var t,e=u.getSheetId(h.tokenToParentObject.get(u.getSheetToken(r))),n=0;n<M.length;n++)if(M[n].id===e){t=n;break}var i=u.rowIndex(r)-1,r=u.colIndex(r)-1,o=M[t].rows[i]&&M[t].rows[i].cells[r];o&&u.parentObject.notify("calculateFormula",{cell:o,rowIdx:i,colIdx:r,sheetIndex:t,isDependentRefresh:!0,isRandomFormula:s,action:a})})}}finally{this.getDependentCells().has(r)&&(this.grid=h.tokenToParentObject.get(this.getSheetToken(r)))}},ui([z.Event()],R.prototype,"onFailure",void 0),ui([z.NotifyPropertyChanges],R));function R(r){var t=ai.call(this,null,null)||this;t.lFormulas=new Map,t.storedData=new Map,t.keyToRowsMap=new Map,t.rowsToKeyMap=new Map,t.rightBracket=String.fromCharCode(161),t.leftBracket=String.fromCharCode(162),t.sheetToken="!",t.cell="",t.cellPrefix="!0!A",t.treatEmptyStringAsZero=!1,t.tic='"',t.singleTic="'",t.trueValue="TRUE",t.falseValue="FALSE",t.parseDecimalSeparator=".",t.arithMarker=String.fromCharCode(180),t.arithMarker2=t.arithMarker+t.arithMarker,t.dependentCells=null,t.dependentFormulaCells=null,t.minValue=Number.MIN_SAFE_INTEGER,t.maxValue=Number.MAX_SAFE_INTEGER,t.categoryCollection=["All"],t.dependencyLevel=0,t.randomValues=new Map,t.isRandomVal=!1,t.randCollection=[],t.dependencyCollection=[],t.uniqueRange=[],t.sortRange=[],t.formulaErrorStrings=[],t.errorStrings=null,t.parseArgumentSeparator=",",t.dateTime1900=new Date(1900,0,1,0,0,0),t.isParseDecimalSeparatorChanged=!1,t.isArgumentSeparatorChanged=!1,t.sheetFamilyID=0,t.defaultFamilyItem=null,t.sheetFamiliesList=null,t.modelToSheetID=null,t.tokenCount=0,t.sortedSheetNames=null,t.tempSheetPlaceHolder=String.fromCharCode(133),t.namedRanges=new Map,t.formulaInfoTable=null,t.millisecondsOfaDay=864e5,t.parseDateTimeSeparator="/",t.evaluatingKeys=new Set;var e=r&&r.locale?r.locale:"en-US";return t.l10n=new z.L10n("calculate",w,e),t.refreshLocalizedStrings(),new ei(t),t.parentObject=z.isNullOrUndefined(r)?t:r,t.grid=t.parentObject,t.parser=new oi(t),t}var U=function(r,t){this.formulaCorrection=!1,this.message=r,this.formulaCorrection=t},gi=(fi.prototype.getFormulaText=function(){return this.formulaText},fi.prototype.setFormulaText=function(r){this.formulaText=r},fi.prototype.getFormulaValue=function(){return this.formulaValue},fi.prototype.setFormulaValue=function(r){this.formulaValue=r},fi.prototype.getParsedFormula=function(){return this.parsedFormula},fi.prototype.setParsedFormula=function(r){this.parsedFormula=r},fi);function fi(){this.calcID=Number.MIN_VALUE+1,this.calcID1=Number.MIN_VALUE+1}var mi=function(){this.isSheetMember=!1,this.parentObjectToToken=new Map,this.sheetDependentFormulaCells=new Map,this.sheetNameToParentObject=new Map,this.sheetNameToToken=new Map,this.tokenToParentObject=new Map,this.sheetFormulaInfotable=new Map};function J(r){for(var t=[],e=0;0<r&&e<9;){r--;var n="A".charCodeAt(0);t[e]=String.fromCharCode(r%26+n),r=parseInt((r/26).toString(),10),e++}for(var i=[],o=0;o<e;o++)i[e-o-1]=t[o];return i.join("")}function ci(t,e,r){return this.row=t,this.col=e,this.value=r,this.getRowIndex=function(){return t},this.setRowIndex=function(r){t=r},this.getColIndex=function(){return e},this.setColIndex=function(r){e=r},this.getFormulaValue=function(){return r},this}$.ArrayFormulas=ze,$.BasicFormulas=ei,$.CalcSheetFamilyItem=mi,$.Calculate=li,$.CalculateCommon=r,$.ComplexNumbersFormulas=ve,$.DatabaseFormulas=zn,$.DateTimeExtraFormulas=Ae,$.DateTimeFormulas=ye,$.DateTimeIntlFormulas=bn,$.EngineeringBaseFormulas=tt,$.EngineeringBesselFormulas=gt,$.EngineeringConvertFormulas=lt,$.EngineeringMiscFormulas=it,$.FinancialAmortizationEcmaFormulas=Bn,$.FinancialAnnuityFormulas=dt,$.FinancialBondHelpers=Ln,$.FinancialCashflowFormulas=xt,$.FinancialCouponsFormulas=_n,$.FinancialDepreciationFormulas=Et,$.FinancialRatesFormulas=bt,$.FinancialSecuritiesFormulas=It,$.FormulaError=U,$.FormulaInfo=gi,$.FormulaModuleBase=t,$.InformationAdvancedFormulas=En,$.InformationEcmaFormulas=In,$.InformationExtraFormulas=dn,$.InformationFormulas=gn,$.LogicalExtraFormulas=Ie,$.LogicalFormulas=xe,$.LookupArrayFormulas=He,$.LookupFormulas=we,$.LookupRefExtraFormulas=qe,$.LookupRefFormulas=ke,$.MathAggregateFormulas=W,$.MathCeilingEcmaFormulas=xn,$.MathCombinatoricsFormulas=wr,$.MathMiscFormulas=tr,$.MathNumberFormulas=Pr,$.MathRoundingFormulas=Z,$.MathTrigFormulas=ir,$.MathTrigHyperbolicFormulas=ar,$.MatrixFormulaBase=Gr,$.MatrixFormulas=zr,$.Parser=oi,$.RegressionEcmaFormulas=ri,$.StatisticalAdvancedFormulas=Lt,$.StatisticalCorrelationFormulas=zt,$.StatisticalDispersionFormulas=_t,$.StatisticalDistributionExtendedFormulas=ce,$.StatisticalDistributionFormulas=oe,$.StatisticalEcmaFormulas=Gn,$.StatisticalExtendedFormulas=ge,$.StatisticalFormulas=Ut,$.StatisticalIfsFormulas=le,$.StatisticalMomentsFormulas=Gt,$.StatisticalPercentileFormulas=te,$.StatisticalSampleBase=Bt,$.TextAdvancedFormulas=ln,$.TextEcmaFormulas=wn,$.TextExtraFormulas=on,$.TextFormulas=tn,$.ValueChangedArgs=ci,$.besselI=Cr,$.besselJ=br,$.besselK=Ar,$.besselY=Fr,$.betaDist=Ir,$.betaInv=Mr,$.binomialCoeff=f,$.calculateDefaultLocale=w,$.chiSquareCDF=Nr,$.chiSquareInv=vr,$.erf=ur,$.erfc=hr,$.fCDF=Er,$.fInv=yr,$.factorial=l,$.formatComplex=s,$.gamma=cr,$.getAlphalabel=J,$.getSkeletonVal=I,$.isExternalFileLink=D,$.isUndefined=function(r){return void 0===r},$.logGamma=mr,$.logNormCDF=xr,$.logNormInv=Vr,$.lowerRegularizedGamma=dr,$.normCDF=pr,$.normInv=gr,$.parseComplexText=fr,$.tCDF=Rr,$.tInv=Tr,Object.defineProperty($,"__esModule",{value:!0})});
|
|
10
|
+
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base"],t):t((r=r||self).ej={},r.ej2Base)}(this,function($,z){"use strict";(r=$.CommonErrors||($.CommonErrors={}))[r.NA=0]="NA",r[r.Value=1]="Value",r[r.Ref=2]="Ref",r[r.DivZero=3]="DivZero",r[r.Num=4]="Num",r[r.Name=5]="Name",r[r.Null=6]="Null",r[r.Calc=7]="Calc",(r=$.FormulasErrorsStrings||($.FormulasErrorsStrings={}))[r.OperatorsCannotStartWithExpression=0]="OperatorsCannotStartWithExpression",r[r.ReservedWordAND=1]="ReservedWordAND",r[r.ReservedWordXOR=2]="ReservedWordXOR",r[r.ReservedWordIf=3]="ReservedWordIf",r[r.NumberContains2DecimalPoints=4]="NumberContains2DecimalPoints",r[r.ReservedWordElse=5]="ReservedWordElse",r[r.ReservedWordNOT=6]="ReservedWordNOT",r[r.InvalidCharInNumber=7]="InvalidCharInNumber",r[r.InvalidCharactersFollowingWithOperator=6]="InvalidCharactersFollowingWithOperator",r[r.MismatchedParentheses=8]="MismatchedParentheses",r[r.UnknownFormulaName=9]="UnknownFormulaName",r[r.RequiresASingleArgument=10]="RequiresASingleArgument",r[r.Requires3Args=11]="Requires3Args",r[r.InvalidMathArgument=12]="InvalidMathArgument",r[r.Requires2Args=13]="Requires2Args",r[r.BadIndex=14]="BadIndex",r[r.TooComplex=15]="TooComplex",r[r.CircularReference=16]="CircularReference",r[r.MissingFormula=17]="MissingFormula",r[r.ImproperFormula=18]="ImproperFormula",r[r.InvalidExpression=19]="InvalidExpression",r[r.CellEmpty=20]="CellEmpty",r[r.BadFormula=21]="BadFormula",r[r.EmptyExpression=22]="EmptyExpression",r[r.VirtualModeRequired=23]="VirtualModeRequired",r[r.MismatchedTics=24]="MismatchedTics",r[r.WrongNumberArguments=25]="WrongNumberArguments",r[r.InvalidArguments=26]="InvalidArguments",r[r.IterationsDoNotConverge=27]="IterationsDoNotConverge",r[r.CalculationOverflow=29]="CalculationOverflow",r[r.AlreadyRegistered=28]="AlreadyRegistered",r[r.MissingSheet=30]="MissingSheet",r[r.CannotParse=31]="CannotParse",r[r.ExpressionCannotEndWithAnOperator=32]="ExpressionCannotEndWithAnOperator",r[r.Spill=33]="Spill",r[r.Div=34]="Div",(r=$.ExcelFileFormats||($.ExcelFileFormats={})).xlsx="xlsx",r.xlsm="xlsm",r.xlsb="xlsb",r.xltx="xltx",r.xltm="xltm",r.xls="xls",r.xml="xml",r.xlam="xlam",r.xla="xla",r.xlw="xlw",r.xlr="xlr",r.prn="prn",r.txt="txt",r.csv="csv",r.dif="dif",r.slk="slk",T.prototype.getModuleName=function(){return"calc-common"};var r=T;function T(r){this.parent=r}function I(r){switch(r){case"dd-MMM-yyyy":case"dd MMM yyyy":r="medium";break;case"MMM yyyy":r="yMMM";break;case"MM/dd/yyyy":case"dd/MM/yyyy":case"dd/MM/yy":r="short";break;case"dddd MMMM dd yyyy":case"dd MMMM yyyy":r="long";break;case"d MMMM yyyy":r="yMMMd";break;case"yyyy":r="y";break;case"h:mm":r="Hm";break;case"h:mm tt":r="hm";break;case"h":r="H";break;case"h tt":r="h";break;case"h:mm:ss tt":r="hms";break;case"h:mm:ss":r="Hms";break;case"d":r="d";break;case"d dddd":r="Ed";break;case"M":r="M";break;case"Md":r="Md";break;case"MMM":r="MMM";break;case"ddd MMM d":r="MMMEd";break;case"MMM d":r="MMMd";break;case"M/yyyy":r="yM";break;case"ddd":r="E";break;default:r=""}return r}function D(r){var t,e=!1;for(t in $.ExcelFileFormats)if(-1<r.indexOf("."+t+"]")){e=!0;break}return e}var w={OperatorsCannotStartWithExpression:"binary operators cannot start an expression",CannotParse:"cannot parse",BadLibrary:"bad library",InvalidCharInFrontOf:"invalid char in front of",NumberContains2DecimalPoints:"number contains 2 decimal points",ExpressionCannotEndWithAnOperator:"expression cannot end with an operator",InvalidCharactersFollowingWithOperator:"invalid characters following an operator",InvalidCharInNumber:"invalid character in number",MismatchedParentheses:"mismatched parentheses",UnknownFormulaName:"unknown formula name",RequiresASingleArgument:"requires a single argument",Requires3Args:"requires 3 arguments",InvalidMathArgument:"invalid Math argument",Requires2Args:"requires 2 arguments",TooComplex:"too complex",MissingFormula:"missing formula",ImproperFormula:"improper formula",InvalidExpression:"invalid expression",CellEmpty:"cell empty",BadFormula:"bad formula",EmptyExpression:"empty expression",MismatchedTics:"mismatched string quotes",WrongNumberArguments:"wrong number of arguments",InvalidArguments:"invalid arguments",IterationsDoNotConverge:"iterations do not converge",AlreadyRegistered:"Control is already registered",CalculationOverflow:"Calculation overflow",MissingSheet:"Missing sheet",CannotParseUnderscore:"cannot_parse",ExpressionCannotEndWithAnOperatorUnderscore:"expression_cannot_end_with_an_operator",CategoryAll:"All"};function j(r){return"[object Date]"===Object.prototype.toString.call(r)&&!isNaN(r.valueOf())}function Q(r){return 0<=r-parseFloat(r)}function L(r,t,e){var n=new Date("01/01/1900"),r=j(r)?r:new Date(r),n=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),r=(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds())-n)/864e5;return(t?r:parseInt(r.toString(),10))+(e?0:60<r?2:1)}k.prototype.parseDouble=function(r){r=this.parent.parseFloat(r.toString());return isNaN(r)?NaN:r},k.prototype.getSheetReference=function(r){return 0===r.indexOf(this.parent.sheetToken)&&r.lastIndexOf(this.parent.sheetToken)>r.indexOf(this.parent.sheetToken)?r.substring(0,r.lastIndexOf(this.parent.sheetToken)+1):""},k.prototype.calculateIFS=function(t,e){var n,i,o,s=this;if(z.isNullOrUndefined(t)||""===t[0]||t.length<2||127<t.length||t.length%2==0)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(3===t.length&&'""'!==t[2]&&t[2].includes(this.parent.tic+this.parent.tic))return n="",o=this.parent.getParseArgumentSeparator(),t[2].split(this.parent.tic+this.parent.tic).forEach(function(r){(r=r.trim().split(s.parent.tic).join(""))&&(i=s.parent.computeIfsFormulas([t[0],t[1],r],s.parent.falseValue,e).toString(),n+=(n?o:"")+i)}),n;return this.parent.computeIfsFormulas(t,this.parent.falseValue,e)},k.prototype.resolveTextArg=function(r){var t;return z.isNullOrUndefined(r)?"":(t=this.parent.getValueFromArg(r),-1<this.parent.getErrorStrings().indexOf(t)||this.parent.isCellReference(r)?t:this.parent.removeTics(t))},k.prototype.resolveNumberArg=function(r){var t=this.parent.getErrorStrings(),e=this.parent.getValueFromArg(r);if(-1<t.indexOf(e))return e;if(""===e)return 0;var n=e.toUpperCase();if(n===this.parent.trueValue)return 1;if(n===this.parent.falseValue)return 0;if(-1<(e=this.parent.isCellReference(r)?e:this.parent.removeTics(e)).indexOf("%")){n=e.replace("%","");if(this.parent.isNumber(n))return this.parent.parseFloat(n)/100}r=this.parent.parseFloat(e);return isNaN(r)?t[$.CommonErrors.Value]:r};var t=k;function k(r){this.owner=r,this.parent=r.parent}P=function(r,t){return(P=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}P(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(q,_=t),q.prototype.ComputeSUM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(e=!0,r.pop()),z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n,i=0,o=0;if(!z.isNullOrUndefined(r))for(var s=r,a=function(r){-1<r.toString().indexOf(".")&&(o=Math.max(o,r.split(".")[1].length))},l=0;l<s.length;l++){var u=s[l].toString();if(-1<u.indexOf(":")&&this.parent.isCellReference(u)){for(var h=this.parent.getCellCollection(u.split(this.parent.tic).join("")),p=0;p<h.length;p++)if(n=e?this.parent.getValueFromArg(h[p],null,null,!0):this.parent.getValueFromArg(h[p]),!e||!n.includes("SUBTOTAL(")){if(-1<this.parent.getErrorStrings().indexOf(n))return n;z.isNullOrUndefined(n[0])||isNaN(this.parent.parseFloat(n))||(a(n),i+=this.parent.parseFloat(n))}}else{if(-1<s[l].indexOf(this.parent.tic)&&(isNaN(this.parent.parseFloat(s[l].split(this.parent.tic).join("")))||""===s[l].split(this.parent.tic).join("").trim()))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(s[l].split(this.parent.tic).join("")===this.parent.trueValue&&(s[l]="1"),s[l].split(this.parent.tic).join("")===this.parent.falseValue&&(s[l]="0"),u=e?this.parent.getValueFromArg(s[l].split(this.parent.tic).join(""),null,null,!0):this.parent.getValueFromArg(s[l].split(this.parent.tic).join("")),!e||!u.includes("SUBTOTAL(")){if(-1<this.parent.getErrorStrings().indexOf(u))return u;z.isNullOrUndefined(u)||isNaN(this.parent.parseFloat(u))||0<u.length&&(a(u),i+=this.parent.parseFloat(u+""))}}}return-1<i.toString().indexOf(".")?i.toFixed(o):i},q.prototype.ComputeSUMIF=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;return e[0].indexOf(":")<0&&!this.parent.isCellReference(e[0])||e[2]&&e[2].indexOf(":")<0&&!this.parent.isCellReference(e[2])?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.ImproperFormula]:3<e.length||e.length<2?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.parent.computeSumIfAndAvgIf(r,!1))&&(this.parent.formulaErrorStrings.indexOf(e)||this.parent.getErrorStrings().indexOf(e))?e:e[0]},q.prototype.ComputeSUMIFS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.calculateIFS(r)},q.prototype.ComputeSUMPRODUCT=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(z.isNullOrUndefined(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];for(var n=0,i=0,o=null,s=t,a=[],l=0;l<s.length;l++){var u=this.parent.getCellCollection(s[l]);if("#REF!"===u[0])return this.parent.getErrorStrings()[$.CommonErrors.Name];a.push(u.length)}for(var h=0;h<a.length;h++)if(a[h]&&a[h+1]&&a[h]!==a[h+1])return this.parent.getErrorStrings()[$.CommonErrors.Value];for(var p=0;p<s.length;++p){var g,f=s[p];if(f.startsWith(this.parent.tic)||!this.parent.isCellReference(f))return g=(m=this.parent.getValueFromArg(f)).indexOf('"'),-1<this.parent.getErrorStrings().indexOf(m)?m:-1<g?0:this.parent.getErrorStrings()[$.CommonErrors.Value];var l=f.indexOf(":"),m=this.parent.rowIndex(f.substr(0,l)),c=this.parent.rowIndex(f.substr(l+1));if(!(-1!==m||-1===c)==(-1===m||-1!==c))return this.parent.getErrorStrings()[$.CommonErrors.Name];c<m&&(m=(g=[c,m])[0],c=g[1]);var d=this.parent.colIndex(f.substr(0,l)),N=this.parent.colIndex(f.substr(l+1));if(N<d&&(d=(r=[N,d])[0],N=r[1]),null===o)for(i=(c-m+1)*(N-d+1),o=[],l=0;l<i;++l)o[l]=1;l=0;for(var v=m;v<=c;++v)for(var E=d;E<=N;++E){var S=this.getSheetReference(f)+this.parent.convertAlpha(E)+v,S=this.parent.getValueFromArg(S);if(-1<this.parent.getErrorStrings().indexOf(S))return S;if(isNaN(this.parent.parseFloat(S)))o[l]=0;else{if(isNaN(o[l]))return this.parent.getErrorStrings()[$.CommonErrors.Name];o[l]=o[l]*this.parent.parseFloat(S)}l++}}for(l=0;l<i;++l)n+=o[l];return n},q.prototype.ComputePRODUCT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(e=!0,r.pop()),z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n,i,o=1,s=!0;if(!z.isNullOrUndefined(r))for(var a=r,l=0;l<a.length;l++){var u,h=a[l];if(-1<h.indexOf(":")&&this.parent.isCellReference(h)){for(var p=this.parent.getCellCollection(h),g=0;g<p.length;g++)if(n=e?this.parent.getValueFromArg(p[g],null,null,!0):this.parent.getValueFromArg(p[g]),(!e||!n.includes("SUBTOTAL("))&&Q(n)){if(-1<this.parent.getErrorStrings().indexOf(n))return n;i=this.parent.parseFloat(n),isNaN(i)||0<n.length&&(o*=i,s=!1)}}else if(-1===h.indexOf(":")&&this.parent.isCellReference(h)){if(u=e?this.parent.getValueFromArg(a[l],null,null,!0):this.parent.getValueFromArg(a[l]),e&&u.includes("SUBTOTAL("))continue;if(!Q(u))continue;if(-1<this.parent.getErrorStrings().indexOf(u))return u}else{if(-1<(u=a[l]).indexOf(this.parent.tic)&&""===u.split(this.parent.tic).join("").trim()||-1<a[l].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(u.split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(u=(u=this.parent.getValueFromArg(a[l].split(this.parent.tic).join("")))===this.parent.trueValue?"1":u===this.parent.falseValue?"0":u.split(this.parent.tic).join(""),-1<this.parent.getErrorStrings().indexOf(u))return u}i=this.parent.parseFloat(u),isNaN(i)||0<u.length&&(o*=i,s=!1)}return s?"0":o.toString()};var P,_,W=q;function q(r){r=_.call(this,r)||this;return r.formulas=[{formulaName:"SUM",category:"Math & Trig",description:"Sums individual values, cell references or ranges."},{formulaName:"SUMIF",category:"Math & Trig",description:"It will sum up cells that meet the given criteria."},{formulaName:"SUMIFS",category:"Math & Trig",description:"Sums the cells specified by a given set of conditionsor criteria."},{formulaName:"SUMPRODUCT",category:"Math & Trig",description:"Returns sum of the product of given ranges of arrays."},{formulaName:"PRODUCT",category:"Math & Trig",description:"Multiplies all the numbers given as arguments and returns the product."}],r}function B(r){return 65<=r.charCodeAt(0)&&r.charCodeAt(0)<=90||97<=r.charCodeAt(0)&&r.charCodeAt(0)<=122}function X(r){for(var t=r,e=0,n=t.length,i=0;i<n;i++)B(t[i])&&e++;var r=t.substring(0,e),o=r.length;if(o!==n&&o<4&&1!==n&&isNaN(parseInt(t,10))){o=function(r){var t=0,e=0;if(t<(r=r.toUpperCase()).length&&"!"===r[t]){for(t++;t<r.length&&"!"!==r[t];)t++;t++}for(;t<r.length&&B(r[t]);){e=26*e+r[t].charCodeAt(0)-64;t++}return 0===e?-1:e}(r);if(o<1||16384<o)return;var s=t.substring(e,n);if(0<s.length){for(var a=!0,l=0;l<s.length;l++){var u=s.charCodeAt(l);if(u<48||57<u){a=!1;break}}if(a){r=parseFloat(s);if(0<r&&r<1048577)return 1}}}}function Y(r){if(-1<(r=r.split("$").join("")).indexOf(":")){var t=r.split(":");if(X(t[0])&&X(t[1]))return 1}else if(r.indexOf(":")<0&&X(r))return 1}H=function(r,t){return(H=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}H(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(e,G=t),e.prototype.ComputeROUND=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(!r.length||1===r.length||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=r;if(1===r.length)return n="TRUE"===e[0].split(this.parent.tic).join("")?"1":"FALSE"===e[0].split(this.parent.tic).join("")?"0":e[0],isNaN(this.parent.parseFloat(n))?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:Math.round(this.parent.parseFloat(n)).toString();var n=this.parent.getValueFromArg(e[0]);if(-1<this.parent.getErrorStrings().indexOf(n))return n;var i=this.parent.getValueFromArg(e[1]);if(-1<this.parent.getErrorStrings().indexOf(i))return i;i="TRUE"===i?"1":"FALSE"===i?"0":i;var n=(n="TRUE"===n?"1":"FALSE"===n?"0":n).split(this.parent.tic).join(""),i=i.split(this.parent.tic).join(""),o=isNaN(Number(n))||""===n.trim(),s=isNaN(Number(i))||""===i.trim();return(-1<e[0].indexOf('"')||this.parent.isCellReference(e[0]))&&o||(-1<e[1].indexOf('"')||this.parent.isCellReference(e[1]))&&s?this.parent.getErrorStrings()[$.CommonErrors.Value]:""===n&&""===i||""===n?0:(o=this.parent.parseFloat(n),e=this.parent.parseFloat(i),(!isNaN(e)&&!isNaN(o)&&0<e?this.parent.parseFloat(this.preciseRound(o,e,"ROUND")):(s=Math.pow(10,-e),Math.round(o/s)*s)).toString())},e.prototype.preciseRound=function(r,t,e){var n=Math.pow(10,t),i=Math.abs(r)*n,r=0<=r?1:-1;return(("ROUND"===e?Math.round(i):"ROUNDDOWN"===e?Math.floor(i):Math.ceil(i))/n*r).toFixed(t)},e.prototype.ComputeROUNDUP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=r.length;if(1===o&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2!==o)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(this.parent.isCellReference(r[0]))e=this.parent.getValueFromArg(r[0])||"0";else{if(-1<r[0].indexOf(this.parent.tic)&&(r[0].split(this.parent.tic).join("")===this.parent.trueValue||r[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];e=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(e))return e;if(this.parent.isCellReference(r[1]))i=this.parent.getValueFromArg(r[1])||"0";else{if(-1<r[1].indexOf(this.parent.tic)&&(r[1].split(this.parent.tic).join("")===this.parent.trueValue||r[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];i=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("")}return-1<this.parent.getErrorStrings().indexOf(i)?i:(e="TRUE"===e.toUpperCase()?"1":"FALSE"===e?"0":e,i="TRUE"===i.toUpperCase()?"1":"FALSE"===i?"0":i,o=isNaN(Number(e))||""===e.trim(),n=isNaN(Number(i))||""===i.trim(),(-1<r[0].indexOf('"')||this.parent.isCellReference(r[0]))&&o||(-1<r[1].indexOf('"')||this.parent.isCellReference(r[1]))&&n?this.parent.getErrorStrings()[$.CommonErrors.Value]:(o=Math.ceil(this.parent.parseFloat(i)),n=this.parent.parseFloat(e),i=(n=0<o?(e=2===(i=e.split(".")).length?i[1].length>=o?o:i[1].length:0,this.parent.parseFloat(this.preciseRound(n,e,"ROUNDUP"))):(0<n?n=n/Math.pow(10,-o)+.49999:n<0&&(n=n/Math.pow(10,-o)-.49999),0<n&&o<-9?+Math.pow(10,-o):this.parent.parseFloat(n.toFixed(0))*Math.pow(10,-o))).toString(),isNaN(n)?-1<o.toString().indexOf('"')?this.parent.getErrorStrings()[$.CommonErrors.Value]:this.parent.getErrorStrings()[$.CommonErrors.Name]:i))},e.prototype.ComputeROUNDDOWN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=r.length;if(1===s&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2!==s)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(this.parent.isCellReference(r[0]))o=this.parent.getValueFromArg(r[0])||"0";else{if(-1<r[0].indexOf(this.parent.tic)&&(r[0].split(this.parent.tic).join("")===this.parent.trueValue||r[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];o=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(o))return o;if(this.parent.isCellReference(r[1]))n=this.parent.getValueFromArg(r[1])||"0";else{if(-1<r[1].indexOf(this.parent.tic)&&(r[1].split(this.parent.tic).join("")===this.parent.trueValue||r[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];n=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("")}return-1<this.parent.getErrorStrings().indexOf(n)?n:(o="TRUE"===o.toUpperCase()?"1":"FALSE"===o?"0":o,n="TRUE"===n.toUpperCase()?"1":"FALSE"===n?"0":n,s=isNaN(Number(o))||""===o.trim(),i=isNaN(Number(n))||""===n.trim(),(-1<r[0].indexOf('"')||this.parent.isCellReference(r[0]))&&s||(-1<r[1].indexOf('"')||this.parent.isCellReference(r[1]))&&i?this.parent.getErrorStrings()[$.CommonErrors.Value]:(s=Math.ceil(this.parent.parseFloat(n)),i=this.parent.parseFloat(o),o=(i=0<s?(n=0,-1!==(e=o.indexOf("."))&&(n=s<=(n=o.length-e-1)?s:n),this.parent.parseFloat(this.preciseRound(i,n,"ROUNDDOWN"))):(0<i?i=i/Math.pow(10,-s)-.49999:i<0&&(i=i/Math.pow(10,-s)+.49999),0<i&&s<-9?+Math.pow(10,-s):this.parent.parseFloat(i.toFixed(0))*Math.pow(10,-s))).toString(),isNaN(i)?-1<s.toString().indexOf('"')?this.parent.getErrorStrings()[$.CommonErrors.Value]:this.parent.getErrorStrings()[$.CommonErrors.Name]:o))},e.prototype.ComputeFLOOR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var e,n=r;if(2!==n.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===n[0]&&""===n[1]||""===n[0]&&!n[1].includes('"'))return 0;""!==n[1]||n[0].includes('"')||(n[1]="0");for(var i=0;i<n.length;i++){var o=n[i].split(this.parent.tic).join("").trim();if(""===o||-1<n[i].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(o)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(Y(n[i])){if((e=(e=this.parent.getValueFromArg(n[i])||"0")===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e).toUpperCase().match(/[A-Z]/)||e.includes('"')||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else if((e=(e=this.parent.getValueFromArg(n[i].split(this.parent.tic).join("")))===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e).toUpperCase().match(/[A-Z]/)||e.includes('"')||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value];n[i]=e}var s=this.parent.parseFloat(n[0]),a=this.parent.parseFloat(n[1]);return 0<s&&a<0?this.parent.getErrorStrings()[$.CommonErrors.Num]:(0<s||s<0)&&0===a?this.parent.getErrorStrings()[$.CommonErrors.DivZero]:isNaN(s)?this.parent.getErrorStrings()[$.CommonErrors.Name]:0===s&&0===a?0:Math.floor(s/a)*a},e.prototype.ComputeCEILING=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var e,n=r;if(2!==n.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===n[0]&&""===n[1]||""===n[0]&&!n[1].includes('"'))return 0;""!==n[1]||n[0].includes('"')||(n[1]="0");for(var i=0;i<n.length;i++){var o=n[i].split(this.parent.tic).join("").trim();if(""===o||-1<n[i].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(o)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(Y(n[i])){if((e=(e=this.parent.getValueFromArg(n[i])||"0")===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e).toUpperCase().match(/[A-Z]/)||e.includes('"')||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else if((e=(e=this.parent.getValueFromArg(n[i].split(this.parent.tic).join("")))===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e).toUpperCase().match(/[A-Z]/)||e.includes('"')||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value];n[i]=e}var s=this.parent.parseFloat(n[0]),a=this.parent.parseFloat(n[1]);return 0<s&&a<0?this.parent.getErrorStrings()[$.CommonErrors.Num]:isNaN(s)?this.parent.getErrorStrings()[$.CommonErrors.Name]:(0<s||0===s)&&0===a?0:Math.ceil(s/a)*a},e.prototype.ComputeINT=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this.parent.getErrorStrings();if(""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(r=this.parent.getValueFromArg(t[0]),!(-1<n.indexOf(r))){if(r.toUpperCase()===this.parent.trueValue?r="1":r.toUpperCase()===this.parent.falseValue&&(r="0"),!this.parent.isCellReference(t[0])&&""===(r=-1===t[0].indexOf(this.parent.tic+this.parent.tic)?r.split(this.parent.tic).join(""):r).trim())return n[$.CommonErrors.Value];if(-1<r.indexOf("%")&&(r=(.01*Number(r.split("%")[0])).toString()),isNaN(this.parent.parseFloat(r)))return n[$.CommonErrors.Value];r=this.parent.parseFloat(r),r=Math.floor(r)}return r},e.prototype.ComputeTRUNC=function(){for(var r,n=this,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=0,o=this.parent.getErrorStrings();if(z.isNullOrUndefined(t)||""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(0===t.length||2<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];function s(r){var t=n.parent.getValueFromArg(r);if(!(-1<o.indexOf(t)))if(t===n.parent.trueValue)t="1";else if(t===n.parent.falseValue)t="0";else if(!n.parent.isCellReference(r)){if(-1<r.indexOf(n.parent.tic)&&n.parent.removeTics(r).match(/^(\d*\.\d+|\d+)\s*[*]\s*(\d*\.\d+|\d+)$/))t=n.parent.getValueFromArg(n.parent.removeTics(r));else if(-1<t.indexOf(n.parent.tic)){if(""===(t=n.parent.removeTics(t)).trim())return o[$.CommonErrors.Value];if(-1<t.indexOf(":")){r=t.split(":");if(!(r.length<=3))return o[$.CommonErrors.Value];if(!n.parent.isNumber(r[0])||!n.parent.isNumber(r[1]))return o[$.CommonErrors.Value];var e=Number(r[0])+Number(Number(r[1])/60);if(3===r.length){if(!n.parent.isNumber(r[2]))return o[$.CommonErrors.Value];e+=Number(Number(r[2])/3600)}t=(e/24).toString()}}2===t.split("%").length&&n.parent.isNumber(t.split("%")[0])&&(t=(.01*Number(t.split("%")[0])).toString())}return t}if(!z.isNullOrUndefined(t[0])){if(r=s(t[0]),-1<o.indexOf(r))return r;if(r=this.parent.parseFloat(r),isNaN(r))return o[$.CommonErrors.Value]}if(!z.isNullOrUndefined(t[1])){if(i=s(t[1]),-1<o.indexOf(i))return i;if(i=this.parent.parseFloat(i),isNaN(i))return o[$.CommonErrors.Value]}return i=Math.pow(10,Math.floor(i)),(((r=Number(r))<0?-1:1)*Math.floor(i*Math.abs(r))/i).toString()},e.prototype.ComputeODD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1!==r.length||""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var e,n=r[0].split(this.parent.tic).join("").trim();if(""===n||-1<r[0].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(Y(r[0])){if(e=this.parent.getValueFromArg(r[0]),-1<this.parent.getErrorStrings().indexOf(e))return e;if(e===this.parent.trueValue)e="1";else if(""===e||e===this.parent.falseValue)e="0";else if(e.toUpperCase().match(/[A-Z]/)||e.includes('"')||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if("#NAME?"===(e=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[$.CommonErrors.Name];if(e===this.parent.trueValue)e="1";else if(""===e||e===this.parent.falseValue)e="0";else if(e.toUpperCase().match(/[A-Z]/)||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value]}var i=0===(n=Math.ceil(parseInt(e,10))),n=n%2==0?0<n?n+1:n-1:n;return Math.ceil(parseInt(e,10))%2!=0&&(0<parseInt(e,10)&&parseFloat(e)>parseInt(e,10)?n+=2:parseInt(e,10)<0&&parseFloat(e)<parseInt(e,10)&&(n-=2)),isNaN(n)?this.parent.getErrorStrings()[$.CommonErrors.Name]:i?1:n},e.prototype.ComputeEVEN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1!==r.length||""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var e,n=r[0].split(this.parent.tic).join("").trim();if(""===n||-1<r[0].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(Y(r[0])){if(e=this.parent.getValueFromArg(r[0]),-1<this.parent.getErrorStrings().indexOf(e))return e;if(e===this.parent.trueValue)e="1";else if(""===e||e===this.parent.falseValue)e="0";else if(e.toUpperCase().match(/[A-Z]/)||e.includes('"')||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if("#NAME?"===(e=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[$.CommonErrors.Name];if(e===this.parent.trueValue)e="1";else if(""===e||e===this.parent.falseValue)e="0";else if(e.toUpperCase().match(/[A-Z]/)||!this.parent.isNumber(e))return this.parent.getErrorStrings()[$.CommonErrors.Value]}n=(n=Math.ceil(parseInt(e,10)))%2==0?n:0<n?n+1:n-1;return Math.ceil(parseInt(e,10))%2==0&&(0<parseInt(e,10)&&parseFloat(e)>parseInt(e,10)?n+=2:parseInt(e,10)<0&&parseFloat(e)<parseInt(e,10)&&(n-=2)),isNaN(n)?this.parent.getErrorStrings()[$.CommonErrors.Name]:n};var H,G,Z=e;function e(r){r=G.call(this,r)||this;return r.formulas=[{formulaName:"ROUND",category:"Math & Trig",description:"Rounds a number to a specified number of digits."},{formulaName:"ROUNDUP",category:"Math & Trig",description:"Rounds a number away from zero."},{formulaName:"ROUNDDOWN",category:"Math & Trig",description:"Rounds a number down, toward zero."},{formulaName:"FLOOR",category:"Math & Trig",description:"Returns the round a number down to the nearest integer."},{formulaName:"CEILING",category:"Math & Trig",description:"Returns a number rounded up to a multiple of another number."},{formulaName:"INT",category:"Math & Trig",description:"Returns a number to the nearest integer."},{formulaName:"TRUNC",category:"Math & Trig",description:"Returns the truncated value of a number to a specified number of decimal places."},{formulaName:"ODD",category:"Math & Trig",description:"Rounds a positive number up and negative number down to the nearest odd integer."},{formulaName:"EVEN",category:"Math & Trig",description:"Rounds a positive number up and negative number down to the nearest even integer."}],r}K=function(r,t){return(K=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}K(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(n,rr=t),n.prototype.ComputeABS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=r,i="";if(0===r.length||1<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===n[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var o=n[0].split(this.parent.tic).join("").trim();if(""===o||-1<n[0].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(o)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(n[0])){if(i=this.parent.getValueFromArg(n[0]),-1<this.parent.getErrorStrings().indexOf(i))return i;if(""!==(i=i===this.parent.trueValue?"1":i)&&i!==this.parent.falseValue||(i="0"),e=this.parent.parseFloat(i),isNaN(e)&&!this.parent.isNumber(i))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if((i=(i=this.parent.getValueFromArg(n[0]).split(this.parent.tic).join())===this.parent.trueValue?"1":i)===this.parent.falseValue&&(i="0"),-1<this.parent.getErrorStrings().indexOf(i))return i;if(e=this.parent.parseFloat(i),isNaN(e)&&!this.parent.isNumber(i))return this.parent.getErrorStrings()[$.CommonErrors.Value]}return Math.abs(e)},n.prototype.ComputeRAND=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return 1===r.length&&""===r[0]&&(r.length=0),0<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:Math.random().toString()},n.prototype.ComputeRANDBETWEEN=function(){for(var n,r,t,i=this,e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];return 1===e.length&&""===e[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:2!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(n=this.parent.getErrorStrings(),t=(r=function(r){var t=i.parent.getValueFromArg(r);if(-1<n.indexOf(t))return t;if(i.parent.isCellReference(r)){if(""===t)t="0";else if(-1<r.indexOf(":")||t.match(/^(\d*\.\d+|\d+)\s*[+\-*/]\s*(\d*\.\d+|\d+)$/))return n[$.CommonErrors.Value]}else{if(""===t)return n[$.CommonErrors.NA];if(-1<r.indexOf(i.parent.tic)&&i.parent.removeTics(r).match(/^(\d*\.\d+|\d+)\s*[+*]\s*(\d*\.\d+|\d+)$/))return n[$.CommonErrors.Value];if(-1<t.indexOf(i.parent.tic)&&-1<(t=i.parent.removeTics(t)).indexOf(":")){r=t.split(":");if(!(r.length<=3))return n[$.CommonErrors.Value];if(!i.parent.isNumber(r[0])||!i.parent.isNumber(r[1]))return n[$.CommonErrors.Value];var e=Number(r[0])+Number(Number(r[1])/60);if(3===r.length){if(!i.parent.isNumber(r[2]))return n[$.CommonErrors.Value];e+=Number(Number(r[2])/3600)}t=(e/24).toString()}2===t.split("%").length&&i.parent.isNumber(t.split("%")[0])&&(t=(.01*Number(t.split("%")[0])).toString())}return t=parseFloat(t),isNaN(t)?n[$.CommonErrors.Value]:t})(e[1]),-1<n.indexOf(t)?t:(r=r(e[0]),-1<n.indexOf(r)?r:0===r&&0===t?"0":t<r?n[$.CommonErrors.Num]:(r=Math.ceil(r),t=Math.floor(t),Math.floor(Math.random()*(t-r+1)+r))))},n.prototype.ComputeRADIANS=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this.parent.getErrorStrings();if(z.isNullOrUndefined(t)||""===t[0]&&1===t.length||2===t[0].split("!").length&&-1===t[0].indexOf(this.parent.tic))return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(-1<t[0].indexOf(":")||""===t[0].split(this.parent.tic).join("").trim()||"!"===t[0].split(this.parent.tic).join("").trim()||2===t[0].split("!").length)return n[$.CommonErrors.Value];if(r=this.parent.getValueFromArg(t[0]).trim(),!(-1<n.indexOf(r))){if(-1<r.indexOf(this.parent.tic)&&-1===t[0].indexOf(this.parent.tic)||3<r.split(this.parent.tic).length)return n[$.CommonErrors.Value];if(r.toUpperCase()===this.parent.trueValue?r="1":r.toUpperCase()===this.parent.falseValue?r="0":2===r.split("%").length&&this.parent.isNumber(r.split("%")[0])&&(r=(Number(r.split("%")[0])/100).toString()),r=this.parent.parseFloat(r.split(this.parent.tic).join("")),isNaN(r))return this.parent.isCellReference(t[0])||-1<t[0].indexOf(this.parent.tic)?n[$.CommonErrors.Value]:n[$.CommonErrors.Name];r=Math.PI*r/180}return r},n.prototype.ComputeDEGREES=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||""===r[0]&&1===r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.parent.getValueFromArg(r[0]).trim();if(-1<e.indexOf(n))return n;if(this.parent.isCellReference(r[0])){if(""===n||-1<n.indexOf(":"))return 0;if(-1<n.indexOf(this.parent.tic)||isNaN(Number(n))&&!isNaN(parseInt(n,10)))return e[$.CommonErrors.Value]}else if(-1<n.indexOf('"TRUE"'))return e[$.CommonErrors.Value];if((n=n.split(this.parent.tic).join("")).toUpperCase()===this.parent.trueValue)n="1";else if(n.toUpperCase()===this.parent.falseValue)n="0";else if(-1<n.indexOf("%"))n=(Number(n.split("%")[0])/100).toString();else if(n.toUpperCase().match(/[A-Z]/)||isNaN(parseInt(n,10)))return e[$.CommonErrors.Value];return parseFloat(n)*(180/Math.PI)},n.prototype.ComputePI=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return r&&""!==r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:Math.PI},n.prototype.ComputeMOD=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(z.isNullOrUndefined(t)||2!==t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===t[1]&&!t[0].includes('"'))return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Div];if(""===t[0]&&!t[1].includes('"'))return 0;for(var n=0;n<t.length;n++){var i=t[n].split(this.parent.tic).join("").trim();if(""===i||-1<t[n].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(i)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(Y(t[n])){if((r=(r=this.parent.getValueFromArg(t[n])||"0")===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r).toUpperCase().match(/[A-Z]/)||r.includes('"')||!this.parent.isNumber(r))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else if(r=(r=this.parent.getValueFromArg(t[n].split(this.parent.tic).join("")))===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r,-1<this.parent.getErrorStrings().indexOf(r))return r;t[n]=r}var o=t[0],s=t[1];return"0"===s||""===s?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Div]:"0"===o||""===o?0:(o=(parseFloat(o)%(s=parseFloat(s))+s)%s,isNaN(o)?this.parent.getErrorStrings()[$.CommonErrors.Name]:o)},n.prototype.ComputeFACT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=1,n=this.parent.getErrorStrings();if(""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var i=r[0];if(this.parent.isCellReference(r[0])||isNaN(Number(i.split(this.parent.tic).join("")))){if(i=this.parent.getValueFromArg(r[0]),-1<n.indexOf(i))return i;if(i.startsWith(this.parent.tic)||i.match(/^(\d*\.\d+|\d+)\s*[+\-*/]\s*(\d*\.\d+|\d+)$/))return n[$.CommonErrors.Value];if(""===i)return 1}if(i=i.split(this.parent.tic).join("").trim(),-1<n.indexOf(i))return i;if(i.toUpperCase()===this.parent.trueValue||i.toUpperCase()===this.parent.falseValue)return 1;-1<i.indexOf("%")&&(i=(Number(i.split("%")[0])/100).toString());var o=parseInt(i,10);if(o<0||170<o)return n[$.CommonErrors.Num];if(i.toUpperCase().match(/[A-Z]/)||""===i)return n[$.CommonErrors.Value];if(-1<i.indexOf(":"))return 0;for(var s=1;s<=o;s++)e*=s;return e},n.prototype.ComputeDECIMAL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o;return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:r[0].match(/[@#$%^&*()?:{}|<>+-]/g)?this.parent.getErrorStrings()[$.CommonErrors.Num]:-1<r[1].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(r[1].split(this.parent.tic).join("")))?this.parent.getErrorStrings()[$.CommonErrors.Value]:(n=e=void 0,e=this.parent.isCellReference(r[0].toString())?this.parent.getValueFromArg(r[0]):this.parent.getValueFromArg(r[0]).split(this.parent.tic).join(""),n=this.parent.isCellReference(r[1].toString())?this.parent.getValueFromArg(r[1]):this.parent.getValueFromArg(r[1]).split(this.parent.tic).join(""),i=parseInt(e,10),o=parseInt(n,10),-1<this.parent.getErrorStrings().indexOf(e)?e:-1<this.parent.getErrorStrings().indexOf(n)?n:""===e&&""!==n?0:""===e||i<0||!isNaN(i)&&!Number.isInteger(parseFloat(e))||""===n||o<2||36<o||isNaN(o)||isNaN(this.parent.parseFloat(e))&&this.parent.parseFloat(n)<=10||(i=parseInt(e,parseInt(n,10)),isNaN(i))?this.parent.getErrorStrings()[$.CommonErrors.Num]:i)},n.prototype.ComputeLN=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this.parent.getErrorStrings();return z.isNullOrUndefined(t)||""===t[0]&&1===t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:0===t.length||1<t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.parent.getValueFromArg(t[0]),-1<n.indexOf(r)?r:(r.toUpperCase()===this.parent.trueValue?r="1":r.toUpperCase()===this.parent.falseValue&&(r="0"),this.parent.isCellReference(t[0])||""!==(r=this.parent.removeTics(r)).trim()?(2===r.split("%").length&&this.parent.isNumber(r.split("%")[0])&&(r=(.01*Number(r.split("%")[0])).toString()),(r=this.parent.parseFloat(r))<=0?n[$.CommonErrors.Num]:isNaN(r)?n[$.CommonErrors.Value]:Math.log(r)):n[$.CommonErrors.Value]))},n.prototype.ComputeLOG=function(){for(var r,t,n=this,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o=this.parent.getErrorStrings();if(z.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2<e.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];function s(r){var t=n.parent.getValueFromArg(r);if(t===n.parent.trueValue?t="1":t===n.parent.falseValue&&(t="0"),!n.parent.isCellReference(r)&&""!==t){if(-1<t.indexOf(n.parent.tic)&&-1===o.indexOf(t.split(n.parent.tic).join(""))){if(""===(t=n.parent.removeTics(t)).trim())return o[$.CommonErrors.Value];if(-1<t.indexOf(":")){r=t.split(":");if(!(r.length<=3))return o[$.CommonErrors.Value];if(!n.parent.isNumber(r[0])||!n.parent.isNumber(r[1]))return o[$.CommonErrors.Value];var e=Number(r[0])+Number(Number(r[1])/60);if(3===r.length){if(!n.parent.isNumber(r[2]))return o[$.CommonErrors.Value];e+=Number(Number(r[2])/3600)}t=(e/24).toString()}}2===t.split("%").length&&n.parent.isNumber(t.split("%")[0])&&(t=(.01*Number(t.split("%")[0])).toString())}return t}if(!z.isNullOrUndefined(e[0])){if(r=s(e[0]),-1<o.indexOf(r))return r;r=this.parent.parseFloat(r)}if(t=10,!z.isNullOrUndefined(e[1])){if(t=s(e[1]),-1<o.indexOf(t))return t;t=this.parent.parseFloat(t)}return r=Number(r),isNaN(r)||isNaN(t)?o[$.CommonErrors.Value]:r<=0||t<=0?o[$.CommonErrors.Num]:1===t?o[$.CommonErrors.DivZero]:(Math.log(r)/Math.LN10/(Math.log(t)/Math.LN10)).toString()},n.prototype.ComputePOWER=function(){for(var e=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1===r.length&&""===r[0].trim()?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:2<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:""===r[0].trim()&&""===r[1].trim()?o[$.CommonErrors.Num]:(n=(i=function(r){var t=e.parent.getValueFromArg(r);if(-1<o.indexOf(t))return t;if(t.toUpperCase()===e.parent.trueValue?t="1":t.toUpperCase()===e.parent.falseValue&&(t="0"),-1<t.indexOf(e.parent.tic)&&(t=e.parent.removeTics(t),-1===r.indexOf(e.parent.tic)||""===t.trim()))return o[$.CommonErrors.Value];if(2===t.split("%").length&&e.parent.isNumber(t.split("%")[0]))t=(Number(t.split("%")[0])/100).toString();else if(-1<t.indexOf("/")&&e.parent.isNumber(t.split("/").join("")))return o[$.CommonErrors.Num];return t=e.parent.parseFloat(t),isNaN(t)?o[$.CommonErrors.Value]:t})(r[0]),-1<o.indexOf(n)?n:(i=i(r[1]),-1<o.indexOf(i)?i:isNaN(n)||isNaN(i)?o[$.CommonErrors.Value]:0===n&&i<0?o[$.CommonErrors.DivZero]:0===n&&0===i||(n=Math.pow(n,i),isNaN(n))||n===1/0?o[$.CommonErrors.Num]:n.toString()))},n.prototype.ComputeSQRT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r[0];if(0===r.length||1<r.length||""===e)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===e.split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(e)){if(-1<(n=this.parent.getValueFromArg(e)||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if(-1<e.indexOf(this.parent.tic)&&(e.split(this.parent.tic).join("")===this.parent.trueValue||e.split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];n=this.parent.getValueFromArg(e).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(n))return n;var n=n===this.parent.trueValue?"1":n===this.parent.falseValue?"0":n,i=this.parent.parseFloat(n);if(i<0)return this.parent.getErrorStrings()[$.CommonErrors.Num];if(isNaN(i)||-1<e.indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(e))){i=this.parent.hostParseDate(isNaN(i)?n:e.split(this.parent.tic).join(""));if(!i.isDate&&!i.isTime)return this.parent.getErrorStrings()[$.CommonErrors.Value];n=i.value}return Math.sqrt(this.parent.parseFloat(n))},n.prototype.ComputeEXP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(""===r[0]&&1===r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===r[0].split(this.parent.tic).join("").trim())return e[$.CommonErrors.Value];if(n=this.parent.getValueFromArg(r[0]),-1<e.indexOf(n))return n;if(-1<n.indexOf(this.parent.tic)&&(this.parent.isCellReference(r[0])||isNaN(Number(n.split(this.parent.tic).join("")))))return e[$.CommonErrors.Value];if((n=n.split(this.parent.tic).join(""))===this.parent.trueValue)n="1";else if(n===this.parent.falseValue||""===n)n="0";else if(-1<n.indexOf("%"))n=(Number(n.split("%")[0])/100).toString();else if(-1<n.indexOf(":"))return"0";var n=this.parent.parseFloat(n);return isNaN(n)?e[$.CommonErrors.Value]:709<n?e[$.CommonErrors.Num]:Math.exp(n).toString()};var K,rr,tr=n;function n(r){r=rr.call(this,r)||this;return r.formulas=[{formulaName:"ABS",category:"Math & Trig",description:"Returns the absolute value of a number."},{formulaName:"RAND",category:"Math & Trig",description:"Return a random number between 0 and 1."},{formulaName:"RANDBETWEEN",category:"Math & Trig",description:"Returns an integer random number in a specified range."},{formulaName:"RADIANS",category:"Math & Trig",description:"Converts degrees to radians."},{formulaName:"DEGREES",category:"Math & Trig",description:"Converts radians to degrees."},{formulaName:"PI",category:"Math & Trig",description:"Returns the value of pi."},{formulaName:"MOD",category:"Math & Trig",description:"Returns a remainder after a number is divided by divisor."},{formulaName:"FACT",category:"Math & Trig",description:"Returns the factorial of a number."},{formulaName:"DECIMAL",category:"Math & Trig",description:"Converts a text representation of a number in a given base into a decimal number."},{formulaName:"LN",category:"Math & Trig",description:"Returns the natural logarithm of a number."},{formulaName:"LOG",category:"Math & Trig",description:"Returns the logarithm of a number to the base that you specify."},{formulaName:"POWER",category:"Math & Trig",description:"Returns the result of a number raised to power."},{formulaName:"SQRT",category:"Math & Trig",description:"Returns the square root of a positive number."},{formulaName:"EXP",category:"Math & Trig",description:"Returns e raised to the power of the given number."}],r}er=function(r,t){return(er=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}er(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(i,nr=t),i.prototype.unaryMath=function(r,t,e){var n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length||""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveNumberArg(r[0]))?r:e&&!e(r)?n[$.CommonErrors.Num]:t(r).toString()},i.prototype.ComputeSIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.sin)},i.prototype.ComputeCOS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.cos)},i.prototype.ComputeTAN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.tan)},i.prototype.ComputeASIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.asin,function(r){return-1<=r&&r<=1})},i.prototype.ComputeACOS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.acos,function(r){return-1<=r&&r<=1})},i.prototype.ComputeATAN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.atan)},i.prototype.ComputeSINH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.sinh)},i.prototype.ComputeCOSH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.cosh)},i.prototype.ComputeTANH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.tanh)},i.prototype.ComputeLOG10=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.log10,function(r){return 0<r})},i.prototype.ComputeSQRTPI=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,function(r){return Math.sqrt(r*Math.PI)},function(r){return 0<=r})},i.prototype.ComputeATAN2=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:0===e&&0===n?i[$.CommonErrors.DivZero]:Math.atan2(n,e).toString())},i.prototype.ComputeSIGN=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveNumberArg(t[0]))?r:(0<r?1:r<0?-1:0).toString()},i.prototype.ComputeQUOTIENT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:0===n?i[$.CommonErrors.DivZero]:Math.trunc(e/n).toString())};var er,nr,ir=i;function i(r){r=nr.call(this,r)||this;return r.formulas=[{formulaName:"SIN",category:"Math & Trig",description:"Returns the sine of an angle."},{formulaName:"COS",category:"Math & Trig",description:"Returns the cosine of an angle."},{formulaName:"TAN",category:"Math & Trig",description:"Returns the tangent of an angle."},{formulaName:"ASIN",category:"Math & Trig",description:"Returns the arcsine of a number."},{formulaName:"ACOS",category:"Math & Trig",description:"Returns the arccosine of a number."},{formulaName:"ATAN",category:"Math & Trig",description:"Returns the arctangent of a number."},{formulaName:"ATAN2",category:"Math & Trig",description:"Returns the arctangent from x- and y-coordinates."},{formulaName:"SINH",category:"Math & Trig",description:"Returns the hyperbolic sine of a number."},{formulaName:"COSH",category:"Math & Trig",description:"Returns the hyperbolic cosine of a number."},{formulaName:"TANH",category:"Math & Trig",description:"Returns the hyperbolic tangent of a number."},{formulaName:"SIGN",category:"Math & Trig",description:"Returns the sign of a number."},{formulaName:"LOG10",category:"Math & Trig",description:"Returns the base-10 logarithm of a number."},{formulaName:"QUOTIENT",category:"Math & Trig",description:"Returns the integer portion of a division."},{formulaName:"SQRTPI",category:"Math & Trig",description:"Returns the square root of a number multiplied by pi."}],r}or=function(r,t){return(or=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}or(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(lr,sr=t),lr.prototype.unaryMath=function(r,t,e){var n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length||""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveNumberArg(r[0]))?r:(!e||e(r))&&(e=t(r),isFinite(e))?e.toString():n[$.CommonErrors.Num]},lr.prototype.ComputeACOSH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.acosh,function(r){return 1<=r})},lr.prototype.ComputeASINH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.asinh)},lr.prototype.ComputeATANH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.unaryMath(r,Math.atanh,function(r){return-1<r&&r<1})};var or,sr,ar=lr;function lr(r){r=sr.call(this,r)||this;return r.formulas=[{formulaName:"ACOSH",category:"Math & Trig",description:"Returns the inverse hyperbolic cosine of a number."},{formulaName:"ASINH",category:"Math & Trig",description:"Returns the inverse hyperbolic sine of a number."},{formulaName:"ATANH",category:"Math & Trig",description:"Returns the inverse hyperbolic tangent of a number."}],r}function ur(r){var t=r<0?-1:1,r=Math.abs(r),e=1/(1+.3275911*r);return t*(1-((((1.061405429*e-1.453152027)*e+1.421413741)*e-.284496736)*e+.254829592)*e*Math.exp(-r*r))}function hr(r){return 1-ur(r)}function pr(r,t,e){return void 0===t&&(t=0),(e=void 0===e?1:e)<=0?NaN:.5*(1+ur((r-t)/(e*Math.SQRT2)))}function gr(r,t,e){var n,i,o,s,a,l;return void 0===t&&(t=0),void 0===e&&(e=1),r<=0||1<=r||e<=0?NaN:(n=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],i=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],o=[-.007784894002430293,-.3223964580411018,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],s=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],t+e*(l=r<.02425?(a=Math.sqrt(-2*Math.log(r)),(((((o[0]*a+o[1])*a+o[2])*a+o[3])*a+o[4])*a+o[5])/((((s[0]*a+s[1])*a+s[2])*a+s[3])*a+1)):r<=.97575?(((((n[0]*(l=(a=r-.5)*a)+n[1])*l+n[2])*l+n[3])*l+n[4])*l+n[5])*a/(((((i[0]*l+i[1])*l+i[2])*l+i[3])*l+i[4])*l+1):(a=Math.sqrt(-2*Math.log(1-r)),-(((((o[0]*a+o[1])*a+o[2])*a+o[3])*a+o[4])*a+o[5])/((((s[0]*a+s[1])*a+s[2])*a+s[3])*a+1))))}function fr(r){var t,r=r.trim();return""===r?null:(t=r.match(/^(-?\d+(?:\.\d+)?)([+-]\d+(?:\.\d+)?)[ij]$/i))?{re:parseFloat(t[1]),im:parseFloat(t[2])}:(t=r.match(/^([+-]?\d+(?:\.\d+)?)[ij]$/i))?{re:0,im:parseFloat(t[1])}:(t=r.match(/^(-?\d+(?:\.\d+)?)$/))?{re:parseFloat(t[1]),im:0}:null}function s(r,t,e){var n;return void 0===e&&(e="i"),0===t?r.toString():0===r?t.toString()+e:(n=0<=t?"+":"-",r.toString()+n+Math.abs(t).toString()+e)}function l(r){if(r<0||170<r)return NaN;for(var t=1,e=2;e<=r;e++)t*=e;return t}function f(r,t){if(t<0||r<t)return 0;t=Math.min(t,r-t);for(var e=1,n=1;n<=t;n++)e=e*(r-t+n)/n;return e}function mr(r){if(r<=0)return NaN;var t=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,Number("9.984369578019571e-6"),1.5056327351493116e-7];if(r<.5)return Math.log(Math.PI/Math.sin(Math.PI*r))-mr(1-r);--r;for(var e=t[0],n=1;n<9;n++)e+=t[n]/(r+n);var i=r+7+.5;return.5*Math.log(2*Math.PI)+(r+.5)*Math.log(i)-i+Math.log(e)}function cr(r){r=mr(r);return isFinite(r)?Math.exp(r):NaN}function dr(r,t){if(t<0||r<=0)return NaN;if(0===t)return 0;if(1e6<t)return 1;for(var e=1/r,n=e,i=1;i<200&&(e+=n*=t/(r+i),!(Math.abs(n)<1e-12*Math.abs(e)));i++);return e*Math.exp(-t+r*Math.log(t)-mr(r))}function Nr(r,t){return r<0||t<=0?NaN:dr(t/2,r/2)}function vr(r,t){if(r<=0||1<=r||t<=0)return NaN;for(var e=0,n=Math.max(100,t+10*Math.sqrt(2*t)),i=0;i<100;i++){var o=(e+n)/2;Nr(o,t)<r?e=o:n=o}return(e+n)/2}function Er(r,t,e){return r<0||t<=0||e<=0?NaN:Sr(t/2,e/2,t*r/(t*r+e))}function Sr(r,t,e){if(e<=0)return 0;if(1<=e)return 1;for(var n=mr(r)+mr(t)-mr(r+t),n=Math.exp(r*Math.log(e)+t*Math.log(1-e)-n)/r,i=1,o=1,s=0,a=0;a<=200;a++){var l=2*a,u=a*(t-a)*e/((r+l-1)*(r+l)),s=1+u*s,o=1+u/o,l=(i*=(s=1/(s=Math.abs(s)<1e-30?1e-30:s))*(o=Math.abs(o)<1e-30?1e-30:o),s=1+(u=-(r+a)*(r+t+a)*e/((r+l)*(r+l+1)))*s,o=1+u/o,(s=1/(s=Math.abs(s)<1e-30?1e-30:s))*(o=Math.abs(o)<1e-30?1e-30:o));if(i*=l,Math.abs(l-1)<1e-10)break}return n*(i-1)}function yr(r,t,e){if(r<=0||1<=r||t<=0||e<=0)return NaN;for(var n=0,i=1e3;Er(i,t,e)<r&&!(1e12<(i*=2)););for(var o=0;o<100;o++){var s=(n+i)/2;Er(s,t,e)<r?n=s:i=s}return(n+i)/2}function Cr(r,t){if(t<0)return Cr(r,-t);for(var e=Math.abs(Math.floor(r)),n=0,i=0;i<100;i++){var o=Math.pow(t/2,2*i+e)/(l(i)*l(i+e));if(n+=o,10<i&&o<1e-15*n)break}return n}function br(r,t){for(var e=Math.abs(Math.floor(r)),n=0,i=0;i<100;i++){var o=(i%2==0?1:-1)*Math.pow(t/2,2*i+e)/(l(i)*l(i+e));if(n+=o,10<i&&Math.abs(o)<1e-15*Math.abs(n))break}return n}function Ar(r,t){return t<=0?NaN:0===(r=Math.abs(Math.floor(r)))?Math.PI/2*(Cr(0,t)-br(0,t)):Math.PI/2*(Cr(r,t)-br(r,t))}function Or(r){for(var t=br(0,r),e=0,n=1;n<100;n++){for(var i=0,o=1;o<=n;o++)i+=1/o;e+=Math.pow(r/2,2*n)/(l(n)*l(n))*i}return 2/Math.PI*(t*(Math.log(r/2)+.5772156649)-e)}function Fr(r,t){if(t<=0)return NaN;var e=Math.abs(Math.floor(r));if(0===e)return Or(t);var n=Or(t),i=function(r){for(var t=br(1,r),e=0,n=0;n<100;n++)e+=(n%2==0?1:-1)*Math.pow(r/2,2*n+1)/(l(n)*l(n+1)*(2*n+1));return 2/Math.PI*(t*Math.log(r/2)-1/(r/2)+e)}(t);if(1!==e)for(var o=1;o<e;o++)var s=2*o/t*i-n,n=i,i=s;return i}function xr(r,t,e){return r<=0||e<=0?NaN:pr(Math.log(r),t,e)}function Vr(r,t,e){return Math.exp(gr(r,t,e))}function Rr(r,t){return t<=0?NaN:(t=Sr(t/2,.5,t/(t+r*r)),0<=r?1-.5*t:.5*t)}function Tr(r,t){if(r<=0||1<=r||t<=0)return NaN;for(var e=-100,n=100,i=0;i<100;i++){var o=(e+n)/2;Rr(o,t)<r?e=o:n=o}return(e+n)/2}function Ir(r,t,e){return r<0||1<r||t<=0||e<=0?NaN:Sr(t,e,r)}function Mr(r,t,e){if(r<=0||1<=r||t<=0||e<=0)return NaN;for(var n=0,i=1,o=0;o<100;o++){var s=(n+i)/2;Sr(t,e,s)<r?n=s:i=s}return(n+i)/2}Dr=function(r,t){return(Dr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Dr(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(jr,Ur=t),jr.prototype.ComputeFACTDOUBLE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]);if("string"==typeof n)return n;n=Math.floor(n);if(n<0||300<n)return e[$.CommonErrors.Num];for(var i=1,o=n;0<o;o-=2)i*=o;return i.toString()},jr.prototype.ComputeMULTINOMIAL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];for(var n=[],i=0;i<r.length;i++){var o=this.resolveNumberArg(r[i]);if("string"==typeof o)return o;o=Math.floor(o);if(o<0)return e[$.CommonErrors.Num];n.push(o)}for(var s=n.reduce(function(r,t){return r+t},0),a=1,i=0;i<n.length;i++)a*=l(n[i]);return(l(s)/a).toString()},jr.prototype.ComputePERMUT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;var o=Math.floor(n),s=Math.floor(i);if(o<0||s<0||o<s)return e[$.CommonErrors.Num];for(var a=1,l=0;l<s;l++)a*=o-l;return a.toString()},jr.prototype.ComputeSERIESSUM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<4)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;for(var o=[],s=3;s<r.length;s++){var a=this.resolveNumberArg(r[s]);if("string"==typeof a)return a;o.push(a)}for(var l=0,s=0;s<o.length;s++)l+=o[s]*Math.pow(e,n+s*i);return l.toString()},jr.prototype.ComputeROMAN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]);if("string"==typeof n)return n;var i=0;if(2===r.length){var o=this.resolveNumberArg(r[1]);if("string"==typeof o)return o;if((i=Math.floor(o))<0||4<i)return e[$.CommonErrors.Value]}o=Math.floor(n);return o<0||3999<o?e[$.CommonErrors.Value]:0===o?"":this.toRoman(o,i)},jr.prototype.toRoman=function(r,t){var e=Math.min(t,4),n=["","M","MM","MMM"][Math.floor(r/1e3)],n=(n=(n+=[["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"],["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"],["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"],["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"],["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"]][e][Math.floor(r%1e3/100)])+[["","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"],["","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"],["","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"],["","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"],["","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"]][e][Math.floor(r%100/10)])+[["","I","II","III","IV","V","VI","VII","VIII","IX"],["","I","II","III","IV","V","VI","VII","VIII","IX"],["","I","II","III","IV","V","VI","VII","VIII","IX"],["","I","II","III","IV","V","VI","VII","VIII","IX"],["","I","II","III","IV","V","VI","VII","VIII","IX"]][e][r%10];return 1===t?n=n.replace(/XLV/g,"VL").replace(/XCV/g,"VC").replace(/CDL/g,"LD").replace(/CML/g,"LM").replace(/CMVC/g,"LMVL"):2===t||3===t?n=n.replace(/IV/g,"IIII").replace(/IX/g,"VIIII").replace(/XL/g,"XXXX").replace(/XC/g,"LXXXX").replace(/CD/g,"CCCC").replace(/CM/g,"DCCCC"):4===t&&(n=n.replace(/V/g,"IV").replace(/L/g,"XL").replace(/D/g,"CD")),n};var Dr,Ur,wr=jr;function jr(r){r=Ur.call(this,r)||this;return r.formulas=[{formulaName:"FACTDOUBLE",category:"Math & Trig",description:"Returns the double factorial of a number."},{formulaName:"MULTINOMIAL",category:"Math & Trig",description:"Returns the multinomial of a set of numbers."},{formulaName:"PERMUT",category:"Math & Trig",description:"Returns the number of permutations for a given number of objects."},{formulaName:"SERIESSUM",category:"Math & Trig",description:"Returns the sum of a power series."},{formulaName:"ROMAN",category:"Math & Trig",description:"Converts an Arabic numeral to Roman, as text."}],r}Lr=function(r,t){return(Lr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Lr(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(_r,kr=t),_r.prototype.collectNumbers=function(r){for(var t=this.parent.getErrorStrings(),e=[],n=0;n<r.length;n++){var i=r[n];if(""!==i)if(this.parent.isCellReference(i)&&-1<i.indexOf(":"))for(var o=this.parent.getCellCollection(i),s=Array.isArray(o)?o:[o],a=0;a<s.length;a++){var l=this.parent.getValueFromArg(s[a]);if(-1<t.indexOf(l))return l;""!==l&&this.parent.isNumber(l)&&e.push(this.parent.parseFloat(l))}else{o=this.resolveNumberArg(i);if("string"==typeof o)return o;e.push(o)}}return e},_r.prototype.gcd2=function(r,t){for(var e=Math.abs(Math.floor(r)),n=Math.abs(Math.floor(t));n;)var i=n,n=e%n,e=i;return e},_r.prototype.ComputeGCD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectNumbers(r);if("string"==typeof n)return n;if(0===n.length)return e[$.CommonErrors.Value];for(var i=0;i<n.length;i++)if(n[i]<0)return e[$.CommonErrors.Num];for(var o=Math.floor(n[0]),i=1;i<n.length;i++)o=this.gcd2(o,n[i]);return o.toString()},_r.prototype.ComputeLCM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectNumbers(r);if("string"==typeof n)return n;if(0===n.length)return e[$.CommonErrors.Value];for(var i=0;i<n.length;i++)if(n[i]<0)return e[$.CommonErrors.Num];for(var o=Math.floor(n[0]),i=1;i<n.length;i++)var s=Math.floor(n[i]),o=0===o||0===s?0:Math.abs(o*s)/this.gcd2(o,s);return o.toString()},_r.prototype.ComputeMROUND=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:0===n?"0":0<e&&n<0||e<0&&0<n?i[$.CommonErrors.Num]:(Math.round(e/n)*n).toString())},_r.prototype.ComputeCOMBIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;var o=Math.floor(n),s=Math.floor(i);if(o<0||s<0||o<s)return e[$.CommonErrors.Num];for(var a=1,l=1;l<=s;l++)a=a*(o-s+l)/l;return Math.round(a).toString()},_r.prototype.ComputeSUMSQ=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var e=this.collectNumbers(r);if("string"==typeof e)return e;for(var n=0,i=0;i<e.length;i++)n+=e[i]*e[i];return n.toString()};var Lr,kr,Pr=_r;function _r(r){r=kr.call(this,r)||this;return r.formulas=[{formulaName:"GCD",category:"Math & Trig",description:"Returns the greatest common divisor."},{formulaName:"LCM",category:"Math & Trig",description:"Returns the least common multiple."},{formulaName:"MROUND",category:"Math & Trig",description:"Returns a number rounded to the desired multiple."},{formulaName:"COMBIN",category:"Math & Trig",description:"Returns the number of combinations for a given number of objects."},{formulaName:"SUMSQ",category:"Math & Trig",description:"Returns the sum of the squares of the arguments."}],r}function Wr(r){return 1<r/26?Wr(r%26==0?r/26-1:Math.floor(r/26))+String.fromCharCode(r%26==0?"Z".charCodeAt(0):64+r%26):String.fromCharCode(64+r)}function qr(r){return[parseInt(r.match(/\d+/)[0],10)-1,function(r){for(var t=0,e=(r=r.split("").reverse().join("")).length-1;0<=e;e--)t+=(r[e].charCodeAt(0)-64)*Math.pow(26,e);return t-1}(r.match(/[A-Z]+/i)[0].toUpperCase())]}function Br(r,t){return Wr(t+1)+(r+1)}function Xr(r){return Br(r[0],r[1])+":"+(z.isNullOrUndefined(r[2])?Br(r[0],r[1]):Br(r[2],r[3]))}function M(r,t){var e,n,i,o=[];return r&&(r=-1===(r=-1<r.lastIndexOf("!")?r.substring(r.lastIndexOf("!")+1):r).indexOf(":")?r+":"+r:r,new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)/g).test(r)||(n=r.split(":"),i=t&&t.rowCount?t.rowCount-1:1,t=t&&t.colCount?Wr(t.colCount):"A",r=z.isNullOrUndefined(r.match(/[0-9]/))?n[0]+"1:"+n[1]+i:"A"+n[0]+":"+t+n[1]),r.split(":").forEach(function(r){e=qr(r),o.push(e[0]),o.push(e[1])})),o}Yr=function(r,t){return(Yr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Yr(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Zr,Hr=t),Zr.prototype.readMatrix=function(r){var t=this.parent.getErrorStrings(),r=r.split("$").join("");if(!this.parent.isCellReference(r.split(":")[0]))return t[$.CommonErrors.Value];var e=M(r),n=e[2]-e[0]+1,i=e[3]-e[1]+1,e=this.parent.getCellCollection(r),o=Array.isArray(e)?e:[e];if(o.length!==n*i)return t[$.CommonErrors.Value];for(var s=[],a=0;a<n;a++){for(var l=[],u=0;u<i;u++){var h=this.parent.getValueFromArg(o[a*i+u]);if(-1<t.indexOf(h))return h;if(""===h||!this.parent.isNumber(h))return t[$.CommonErrors.Value];l.push(this.parent.parseFloat(h))}s.push(l)}return s},Zr.prototype.flattenMatrix=function(r,t){void 0===t&&(t=!1);var e=this.parent.getParseArgumentSeparator(),n=r.length,i=r[0].length,o=[];if(t)for(var s=0;s<i;s++)for(var a=0;a<n;a++)o.push(r[a][s].toString());else for(a=0;a<n;a++)for(s=0;s<i;s++)o.push(r[a][s].toString());return o.join(e)},Zr.prototype.determinant=function(r){var t=r.length;if(1===t)return r[0][0];if(2===t)return r[0][0]*r[1][1]-r[0][1]*r[1][0];for(var e=0,n=0;n<t;n++){for(var i=[],o=1;o<t;o++){for(var s=[],a=0;a<t;a++)a!==n&&s.push(r[o][a]);i.push(s)}e+=(n%2==0?1:-1)*r[0][n]*this.determinant(i)}return e},Zr.prototype.inverse=function(r){for(var t=r.length,e=[],n=0;n<t;n++){e.push(r[n].slice());for(var i=0;i<t;i++)e[n].push(n===i?1:0)}for(n=0;n<t;n++){for(var o=n,s=n+1;s<t;s++)Math.abs(e[s][n])>Math.abs(e[o][n])&&(o=s);var a=e[n],l=(e[n]=e[o],e[o]=a,e[n][n]);if(Math.abs(l)<1e-12)return null;for(i=0;i<2*t;i++)e[n][i]/=l;for(s=0;s<t;s++)if(s!==n)for(var u=e[s][n],i=0;i<2*t;i++)e[s][i]-=u*e[n][i]}for(var h=[],n=0;n<t;n++)h.push(e[n].slice(t));return h},Zr.prototype.multiply=function(r,t){if(r[0].length!==t.length)return null;for(var e=r.length,n=t[0].length,i=t.length,o=[],s=0;s<e;s++){for(var a=[],l=0;l<n;l++){for(var u=0,h=0;h<i;h++)u+=r[s][h]*t[h][l];a.push(u)}o.push(a)}return o};var Yr,Hr,Gr=Zr;function Zr(){return null!==Hr&&Hr.apply(this,arguments)||this}Kr=function(r,t){return(Kr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Kr(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Qr,$r=Gr),Qr.prototype.ComputeMDETERM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.readMatrix(r[0]))?e:e.length!==e[0].length?n[$.CommonErrors.Value]:this.determinant(e).toString()},Qr.prototype.ComputeMINVERSE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.readMatrix(r[0]))?e:e.length!==e[0].length?n[$.CommonErrors.Value]:(e=this.inverse(e))?this.flattenMatrix(e):n[$.CommonErrors.Num]},Qr.prototype.ComputeMMULT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(n=this.readMatrix(r[0]),e=this.readMatrix(r[1]),"string"==typeof n?n:"string"==typeof e?e:(n=this.multiply(n,e))?this.flattenMatrix(n):i[$.CommonErrors.Value])},Qr.prototype.ComputeTRANSPOSE=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.readMatrix(t[0]))?r:this.flattenMatrix(r,!0)};var Kr,$r,zr=Qr;function Qr(r){r=$r.call(this,r)||this;return r.formulas=[{formulaName:"MDETERM",category:"Math & Trig",description:"Returns the matrix determinant of an array."},{formulaName:"MINVERSE",category:"Math & Trig",description:"Returns the matrix inverse of an array."},{formulaName:"MMULT",category:"Math & Trig",description:"Returns the matrix product of two arrays."},{formulaName:"TRANSPOSE",category:"Math & Trig",description:"Returns the transpose of an array."}],r}Jr=function(r,t){return(Jr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Jr(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(o,rt=t),o.prototype.parseBaseNumber=function(r,t){var e=this.parent.getErrorStrings(),r=r.trim().toUpperCase();return""===r||!(16===t?/^[0-9A-F]+$/:2===t?/^[01]+$/:/^[0-7]+$/).test(r)||(r=parseInt(r,t),isNaN(r))?e[$.CommonErrors.Num]:r},o.prototype.resolveBaseArg=function(r,t){var e=this.parent.getErrorStrings(),r=this.resolveTextArg(r);return-1<e.indexOf(r)?r:this.parseBaseNumber(r,t)},o.prototype.formatToBase=function(r,t,e){var n=this.parent.getErrorStrings(),r=Math.trunc(r),i={2:{min:-512,max:511,maxPlaces:10},8:{min:-536870912,max:536870911,maxPlaces:10},10:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,maxPlaces:0},16:{min:-549755813888,max:549755813887,maxPlaces:10}}[t];if(r<i.min||r>i.max)return n[$.CommonErrors.Num];r<0&&(r=(1<<(e&&0<e?e:10))+r);var o=r.toString(t).toUpperCase();if(void 0!==e&&0<e){if(e>i.maxPlaces)return n[$.CommonErrors.Num];for(;o.length<e;)o="0"+o}return o},o.prototype.ComputeBIN2DEC=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(t=this.resolveBaseArg(e[0],2))?t:10<(r=this.resolveTextArg(e[0]).trim()).length?this.parent.getErrorStrings()[$.CommonErrors.Num]:(t=t,(t=10===r.length&&"1"===r.charAt(0)?parseInt(r,2)-1024:t).toString())},o.prototype.ComputeBIN2HEX=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.binTo(r,16)},o.prototype.ComputeBIN2OCT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.binTo(r,8)},o.prototype.binTo=function(r,t){var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n,i=this.ComputeBIN2DEC(r[0]);if("string"==typeof i&&-1<e.indexOf(i))return i;if(2===r.length){e=this.resolveNumberArg(r[1]);if("string"==typeof e)return e;n=Math.floor(e)}return this.formatToBase(parseInt(i.toString(),10),t,n)},o.prototype.ComputeDEC2BIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.decTo(r,2)},o.prototype.ComputeDEC2HEX=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.decTo(r,16)},o.prototype.ComputeDEC2OCT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.decTo(r,8)},o.prototype.decTo=function(r,t){if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e,n=this.resolveNumberArg(r[0]);if("string"==typeof n)return n;if(2===r.length){r=this.resolveNumberArg(r[1]);if("string"==typeof r)return r;e=Math.floor(r)}return this.formatToBase(Math.trunc(n),t,e)},o.prototype.ComputeHEX2DEC=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveTextArg(e[0]).trim().toUpperCase(),"string"==typeof(t=this.parseBaseNumber(r,16))?t:10<r.length?this.parent.getErrorStrings()[$.CommonErrors.Num]:(t=t,(t=10===r.length&&8<=parseInt(r.charAt(0),16)?parseInt(r,16)-256:t).toString()))},o.prototype.ComputeHEX2BIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.hexOctTo(r,2,this.ComputeHEX2DEC.bind(this))},o.prototype.ComputeHEX2OCT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.hexOctTo(r,8,this.ComputeHEX2DEC.bind(this))},o.prototype.ComputeOCT2DEC=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveTextArg(e[0]).trim(),"string"==typeof(t=this.parseBaseNumber(r,8))?t:10<r.length?this.parent.getErrorStrings()[$.CommonErrors.Num]:(t=t,(t=10===r.length&&"4"<=r.charAt(0)?parseInt(r,8)-(1<<30):t).toString()))},o.prototype.ComputeOCT2BIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.hexOctTo(r,2,this.ComputeOCT2DEC.bind(this))},o.prototype.ComputeOCT2HEX=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.hexOctTo(r,16,this.ComputeOCT2DEC.bind(this))},o.prototype.hexOctTo=function(r,t,e){var n=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var i,e=e(r[0]);if("string"==typeof e&&-1<n.indexOf(e))return e;if(2===r.length){n=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;i=Math.floor(n)}return this.formatToBase(parseInt(e.toString(),10),t,i)};var Jr,rt,tt=o;function o(r){r=rt.call(this,r)||this;return r.formulas=[{formulaName:"BIN2DEC",category:"Engineering",description:"Converts a binary number to decimal."},{formulaName:"BIN2HEX",category:"Engineering",description:"Converts a binary number to hexadecimal."},{formulaName:"BIN2OCT",category:"Engineering",description:"Converts a binary number to octal."},{formulaName:"DEC2BIN",category:"Engineering",description:"Converts a decimal number to binary."},{formulaName:"DEC2HEX",category:"Engineering",description:"Converts a decimal number to hexadecimal."},{formulaName:"DEC2OCT",category:"Engineering",description:"Converts a decimal number to octal."},{formulaName:"HEX2BIN",category:"Engineering",description:"Converts a hexadecimal number to binary."},{formulaName:"HEX2DEC",category:"Engineering",description:"Converts a hexadecimal number to decimal."},{formulaName:"HEX2OCT",category:"Engineering",description:"Converts a hexadecimal number to octal."},{formulaName:"OCT2BIN",category:"Engineering",description:"Converts an octal number to binary."},{formulaName:"OCT2DEC",category:"Engineering",description:"Converts an octal number to decimal."},{formulaName:"OCT2HEX",category:"Engineering",description:"Converts an octal number to hexadecimal."}],r}et=function(r,t){return(et=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}et(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(ot,nt=t),ot.prototype.ComputeDELTA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]);if("string"==typeof e)return e;var n=0;if(2===r.length){var i=this.resolveNumberArg(r[1]);if("string"==typeof i)return i;n=i}return(e===n?1:0).toString()},ot.prototype.ComputeGESTEP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]);if("string"==typeof e)return e;var n=0;if(2===r.length){var i=this.resolveNumberArg(r[1]);if("string"==typeof i)return i;n=i}return(n<=e?1:0).toString()},ot.prototype.ComputeERF=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||e.length<1||2<e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:1===e.length?"string"==typeof(r=this.resolveNumberArg(e[0]))?r:ur(r).toString():(r=this.resolveNumberArg(e[0]),t=this.resolveNumberArg(e[1]),"string"==typeof r?r:"string"==typeof t?t:(ur(t)-ur(r)).toString())},ot.prototype.ComputeERFC=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveNumberArg(t[0]))?r:hr(r).toString()};var et,nt,it=ot;function ot(r){r=nt.call(this,r)||this;return r.formulas=[{formulaName:"DELTA",category:"Engineering",description:"Tests whether two values are equal."},{formulaName:"GESTEP",category:"Engineering",description:"Tests whether a number is greater than a threshold."},{formulaName:"ERF",category:"Engineering",description:"Returns the error function."},{formulaName:"ERFC",category:"Engineering",description:"Returns the complementary error function."}],r}st=function(r,t){return(st=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}st(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(ut,at=t),ut.prototype.ComputeCONVERT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||3!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]);if("string"==typeof n)return n;var i=this.resolveTextArg(r[1]).toLowerCase(),o=this.resolveTextArg(r[2]).toLowerCase();if(-1<e.indexOf(i))return i;if(-1<e.indexOf(o))return o;if(i===o)return n.toString();if("c"===i&&"f"===o)return(9*n/5+32).toString();if("f"===i&&"c"===o)return(5*(n-32)/9).toString();for(var s=0,a=ut.UNITS;s<a.length;s++){var l=a[s];if(l.from===i&&l.to===o&&!isNaN(l.factor))return(n*l.factor).toString()}var u=ut.UNITS.find(function(r){return r.from===i&&!isNaN(r.factor)}),h=u?u.to:void 0,p=ut.UNITS.find(function(r){return r.to===o&&r.from===h&&!isNaN(r.factor)});return u&&p?(n*u.factor*p.factor).toString():e[$.CommonErrors.NA]},ut.UNITS=[{from:"g",to:"kg",factor:.001},{from:"kg",to:"g",factor:1e3},{from:"lbm",to:"kg",factor:.45359237},{from:"kg",to:"lbm",factor:2.2046226218},{from:"m",to:"ft",factor:3.280839895},{from:"ft",to:"m",factor:.3048},{from:"in",to:"m",factor:.0254},{from:"m",to:"in",factor:39.37007874},{from:"mi",to:"m",factor:1609.344},{from:"m",to:"mi",factor:1/1609.344},{from:"yr",to:"day",factor:365.25},{from:"day",to:"yr",factor:1/365.25},{from:"hr",to:"sec",factor:3600},{from:"sec",to:"hr",factor:1/3600},{from:"C",to:"F",factor:NaN},{from:"F",to:"C",factor:NaN},{from:"l",to:"m3",factor:.001},{from:"m3",to:"l",factor:1e3},{from:"N",to:"lbf",factor:.224808943},{from:"lbf",to:"N",factor:4.4482216153}];var st,at,lt=ut;function ut(r){r=at.call(this,r)||this;return r.formulas=[{formulaName:"CONVERT",category:"Engineering",description:"Converts a number from one measurement system to another."}],r}ht=function(r,t){return(ht=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}ht(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(ft,pt=t),ft.prototype.besselArgs=function(r){var t,e=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(t=this.resolveNumberArg(r[0]),r=this.resolveNumberArg(r[1]),"string"==typeof t?t:"string"==typeof r?r:r<0?e[$.CommonErrors.Num]:{x:t,n:Math.floor(r)})},ft.prototype.ComputeBESSELI=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.besselArgs(r);return"string"==typeof e?e:(e=Cr(e.n,e.x),isFinite(e)?e.toString():this.parent.getErrorStrings()[$.CommonErrors.Num])},ft.prototype.ComputeBESSELJ=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.besselArgs(r);return"string"==typeof e?e:br(e.n,e.x).toString()},ft.prototype.ComputeBESSELK=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings(),n=this.besselArgs(r);return"string"==typeof n?n:!(n.x<=0)&&(n=Ar(n.n,n.x),isFinite(n))?n.toString():e[$.CommonErrors.Num]},ft.prototype.ComputeBESSELY=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings(),n=this.besselArgs(r);return"string"==typeof n?n:!(n.x<=0)&&(n=Fr(n.n,n.x),isFinite(n))?n.toString():e[$.CommonErrors.Num]};var ht,pt,gt=ft;function ft(r){r=pt.call(this,r)||this;return r.formulas=[{formulaName:"BESSELI",category:"Engineering",description:"Returns the modified Bessel function In(x)."},{formulaName:"BESSELJ",category:"Engineering",description:"Returns the Bessel function Jn(x)."},{formulaName:"BESSELK",category:"Engineering",description:"Returns the modified Bessel function Kn(x)."},{formulaName:"BESSELY",category:"Engineering",description:"Returns the Bessel function Yn(x)."}],r}mt=function(r,t){return(mt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}mt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(a,ct=t),a.prototype.resolveOptional=function(r,t,e){return r.length<=t||""===r[t]?e:this.resolveNumberArg(r[t])},a.prototype.ComputeFV=function(){for(var r,t,e,n,i,o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return z.isNullOrUndefined(o)||o.length<3||5<o.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(o[0]),t=this.resolveNumberArg(o[1]),e=this.resolveNumberArg(o[2]),"string"==typeof r?r:"string"==typeof t?t:"string"==typeof e?e:(i=this.resolveOptional(o,3,0),n=this.resolveOptional(o,4,0),"string"==typeof i?i:"string"==typeof n?n:(0===r?-i-e*t:-i*(i=Math.pow(1+r,t))-e*(1+r*(n?1:0))*(i-1)/r).toString()))},a.prototype.ComputePV=function(){for(var r,t,e,n,i,o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return z.isNullOrUndefined(o)||o.length<3||5<o.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(o[0]),t=this.resolveNumberArg(o[1]),e=this.resolveNumberArg(o[2]),"string"==typeof r?r:"string"==typeof t?t:"string"==typeof e?e:(i=this.resolveOptional(o,3,0),n=this.resolveOptional(o,4,0),"string"==typeof i?i:"string"==typeof n?n:(0===r?-i-e*t:(-i-e*(1+r*(n?1:0))*((i=Math.pow(1+r,t))-1)/r)/i).toString()))},a.prototype.ComputePMT=function(){for(var r,t,e,n,i,o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return z.isNullOrUndefined(o)||o.length<3||5<o.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(o[0]),t=this.resolveNumberArg(o[1]),e=this.resolveNumberArg(o[2]),"string"==typeof r?r:"string"==typeof t?t:"string"==typeof e?e:(i=this.resolveOptional(o,3,0),n=this.resolveOptional(o,4,0),"string"==typeof i?i:"string"==typeof n?n:0===r?(-e-i)/t:(r*(i+e*(i=Math.pow(1+r,t)))/((1+r*(n?1:0))*(1-i))).toString()))},a.prototype.ComputeNPER=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s,a=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<3||5<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),s=this.resolveNumberArg(r[2]),"string"==typeof e?e:"string"==typeof n?n:"string"==typeof s?s:(o=this.resolveOptional(r,3,0),i=this.resolveOptional(r,4,0),"string"==typeof o?o:"string"==typeof i?i:0===e?0===n?a[$.CommonErrors.Num]:(-(s+o)/n).toString():(o=n*(1+e*(i=i?1:0))/e-o,0===(s=s+n*(1+e*i)/e)||o/s<=0?a[$.CommonErrors.Num]:(Math.log(o/s)/Math.log(1+e)).toString())))},a.prototype.ComputeIPMT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<4||6<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=this.resolveOptional(r,4,0),a=this.resolveOptional(r,5,0);if("string"==typeof s)return s;if("string"==typeof a)return a;i=this.ComputePMT(e.toString(),i.toString(),o.toString(),s.toString(),a.toString());if("string"==typeof i&&-1<this.parent.getErrorStrings().indexOf(i))return i;for(var l=parseFloat(i.toString()),u=o,h=1;h<n;h++)u=u*(1+e)+l;return(u*e).toString()},a.prototype.ComputePPMT=function(){for(var r,t,e,n,i,o,s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];return z.isNullOrUndefined(s)||s.length<4||6<s.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.ComputeIPMT.apply(this,s))&&-1<this.parent.getErrorStrings().indexOf(r)?r:(o=this.resolveNumberArg(s[0]),t=this.resolveNumberArg(s[2]),e=this.resolveNumberArg(s[3]),n=this.resolveOptional(s,4,0),i=this.resolveOptional(s,5,0),o=this.ComputePMT(o.toString(),t.toString(),e.toString(),("number"==typeof n?n:0).toString(),("number"==typeof i?i:0).toString()),(parseFloat(o.toString())-parseFloat(r.toString())).toString())},a.prototype.ComputeNPV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]);if("string"==typeof e)return e;for(var n=0,i=1;i<r.length;i++){var o=this.resolveNumberArg(r[i]);if("string"==typeof o)return o;n+=o/Math.pow(1+e,i)}return n.toString()},a.prototype.ComputeRATE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||6<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=this.resolveOptional(r,3,0),a=this.resolveOptional(r,4,0),l=this.resolveOptional(r,5,.1);if("string"==typeof s)return s;if("string"==typeof a)return a;if("string"==typeof l)return l;for(var u=l,h=0;h<100;h++){var p=a?1:0,g=Math.pow(1+u,n),f=o*g+i*(1+u*p)*(g-1)/u+s,p=n*o*Math.pow(1+u,n-1)+i*(1+u*p)*(n*Math.pow(1+u,n-1)*u-(g-1))/(u*u)+i*p*(g-1)/u;if(Math.abs(p)<1e-12)break;g=u-f/p;if(Math.abs(g-u)<1e-10)return g.toString();u=g}return e[$.CommonErrors.Num]};var mt,ct,dt=a;function a(r){r=ct.call(this,r)||this;return r.formulas=[{formulaName:"FV",category:"Financial",description:"Returns the future value of an investment."},{formulaName:"PV",category:"Financial",description:"Returns the present value of an investment."},{formulaName:"PMT",category:"Financial",description:"Returns the periodic payment for an annuity."},{formulaName:"NPER",category:"Financial",description:"Returns the number of periods for an investment."},{formulaName:"IPMT",category:"Financial",description:"Returns the interest payment for an investment for a given period."},{formulaName:"PPMT",category:"Financial",description:"Returns the payment on the principal for an investment for a given period."},{formulaName:"NPV",category:"Financial",description:"Returns the net present value of an investment based on periodic cash flows."},{formulaName:"RATE",category:"Financial",description:"Returns the interest rate per period of an annuity."}],r}Nt=function(r,t){return(Nt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Nt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(St,vt=t),St.prototype.ComputeSLN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),"string"==typeof e?e:"string"==typeof n?n:"string"==typeof i?i:0===i?o[$.CommonErrors.DivZero]:((e-n)/i).toString())},St.prototype.ComputeSYD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||4!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]),"string"==typeof e?e:"string"==typeof n?n:"string"==typeof i?i:"string"==typeof o?o:i<=0||o<=0||i<o?s[$.CommonErrors.Num]:((e-n)*(i-o+1)/(i*(i+1)/2)).toString())},St.prototype.ComputeDB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<4||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]),s=this.resolveNumberArg(r[3]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;var a=12;if(5===r.length){var l=this.resolveNumberArg(r[4]);if("string"==typeof l)return l;a=Math.floor(l)}if(o<=0||s<=0)return e[$.CommonErrors.Num];for(var u=1-Math.pow(i/n,1/o),h=0,p=1;p<=Math.floor(s);p++)h+=(n-h)*u*(1===p?a/12:1);l=s-Math.floor(s);if(0<l&&(h+=(n-h)*u*l),1===Math.floor(s))return h.toString();for(var g=0,p=1;p<Math.floor(s);p++)g+=(n-g)*u*(1===p?a/12:1);return(h-g).toString()},St.prototype.ComputeDDB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<4||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]),s=this.resolveNumberArg(r[3]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;var a=2;if(5===r.length){var l=this.resolveNumberArg(r[4]);if("string"==typeof l)return l;a=l}if(o<=0||s<=0)return e[$.CommonErrors.Num];for(var u=a/o,h=n,p=0,g=1;g<=Math.floor(s);g++)h-=p=Math.min(h*u,h-i);l=s-Math.floor(s);return(p=0<l?Math.min(h*u*l,(h-i)*l):p).toString()};var Nt,vt,Et=St;function St(r){r=vt.call(this,r)||this;return r.formulas=[{formulaName:"SLN",category:"Financial",description:"Returns the straight-line depreciation of an asset for one period."},{formulaName:"SYD",category:"Financial",description:"Returns the sum-of-years digits depreciation for a specified period."},{formulaName:"DB",category:"Financial",description:"Returns the depreciation of an asset for a period using fixed-declining balance."},{formulaName:"DDB",category:"Financial",description:"Returns the depreciation of an asset for a period using double-declining balance."}],r}yt=function(r,t){return(yt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}yt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(At,Ct=t),At.prototype.ComputeEFFECT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:n<1?i[$.CommonErrors.Num]:(Math.pow(1+e/n,n)-1).toString())},At.prototype.ComputeNOMINAL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:n<1?i[$.CommonErrors.Num]:(n*(Math.pow(1+e,1/n)-1)).toString())},At.prototype.ComputeFVSCHEDULE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]);if("string"==typeof e)return e;for(var n=e,i=1;i<r.length;i++){var o=this.resolveNumberArg(r[i]);if("string"==typeof o)return o;n*=1+o}return n.toString()};var yt,Ct,bt=At;function At(r){r=Ct.call(this,r)||this;return r.formulas=[{formulaName:"EFFECT",category:"Financial",description:"Returns the effective annual interest rate."},{formulaName:"NOMINAL",category:"Financial",description:"Returns the nominal annual interest rate."},{formulaName:"FVSCHEDULE",category:"Financial",description:"Returns the future value of an initial principal after applying compound interest rates."}],r}Ot=function(r,t){return(Ot=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Ot(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Vt,Ft=t),Vt.prototype.collectCashflows=function(r){for(var t=this.parent.getErrorStrings(),e=[],n=0;n<r.length;n++){var i=r[n];if(""!==i)if(this.parent.isCellReference(i)&&-1<i.indexOf(":"))for(var o=this.parent.getCellCollection(i),s=Array.isArray(o)?o:[o],a=0;a<s.length;a++){var l=this.parent.getValueFromArg(s[a]);if(-1<t.indexOf(l))return l;""!==l&&this.parent.isNumber(l)&&e.push(this.parent.parseFloat(l))}else{o=this.resolveNumberArg(i);if("string"==typeof o)return o;e.push(o)}}return e},Vt.prototype.npvAtRate=function(r,t){for(var e=0,n=0;n<r.length;n++)e+=r[n]/Math.pow(1+t,n);return e},Vt.prototype.npvDerivative=function(r,t){for(var e=0,n=1;n<r.length;n++)e-=n*r[n]/Math.pow(1+t,n+1);return e},Vt.prototype.ComputeIRR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n,i=.1,o=r,s=(2===r.length&&this.parent.isCellReference(r[0])&&"number"==typeof(n=this.resolveNumberArg(r[1]))&&(i=n,o=[r[0]]),this.collectCashflows(o));if("string"==typeof s)return s;if(!(s.length<2)){for(var a=!1,l=!1,u=0;u<s.length;u++)0<s[u]&&(a=!0),s[u]<0&&(l=!0);if(a&&l)for(var h=i,p=0;p<100;p++){var g=this.npvAtRate(s,h),f=this.npvDerivative(s,h);if(Math.abs(f)<1e-12)break;g=h-g/f;if(Math.abs(g-h)<1e-10)return g.toString();h=g}}return e[$.CommonErrors.Num]},Vt.prototype.ComputeMIRR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||3!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;var o=this.collectCashflows([r[0]]);if("string"==typeof o)return o;if(o.length<2)return e[$.CommonErrors.Num];for(var s=o.length-1,a=0,l=0,u=0;u<o.length;u++){var h=o[u];0<=h?l+=h*Math.pow(1+i,s-u):a+=h/Math.pow(1+n,u)}return 0===a||0===l?e[$.CommonErrors.DivZero]:(Math.pow(-l/a,1/s)-1).toString()};var Ot,Ft,xt=Vt;function Vt(r){r=Ft.call(this,r)||this;return r.formulas=[{formulaName:"IRR",category:"Financial",description:"Returns the internal rate of return for a series of cash flows."},{formulaName:"MIRR",category:"Financial",description:"Returns the modified internal rate of return for cash flows."}],r}Rt=function(r,t){return(Rt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Rt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(u,Tt=t),u.prototype.ComputeDOLLARDE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:(n=Math.floor(n))<=0?i[$.CommonErrors.Num]:((i=Math.trunc(e))+(e-i)*Math.pow(10,Math.ceil(Math.log10(n)))/n).toString())},u.prototype.ComputeDOLLARFR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:(n=Math.floor(n))<=0?i[$.CommonErrors.Num]:((i=Math.trunc(e))+(e-i)*n/Math.pow(10,Math.ceil(Math.log10(n)))).toString())},u.prototype.ComputeDISC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<3||5<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(i=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),e=this.resolveNumberArg(r[2]),"string"==typeof i?i:"string"==typeof n?n:"string"==typeof e?e:(n=Math.max(n-i,1),i=5<=r.length?this.resolveNumberArg(r[4]):0,e<=0?o[$.CommonErrors.Num]:((1-e/100)*(3===i?365:360)/n).toString()))},u.prototype.ComputeDURATION=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||e.length<5||6<e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(e[3]),t=this.resolveNumberArg(e[4]),"string"==typeof r?r:"string"==typeof t?t:(1/(6<=e.length?this.resolveNumberArg(e[5]):2)).toString())},u.prototype.ComputeINTRATE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<4||5<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(o=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),e=this.resolveNumberArg(r[2]),n=this.resolveNumberArg(r[3]),"string"==typeof o?o:"string"==typeof i?i:"string"==typeof e?e:"string"==typeof n?n:(i=Math.max(i-o,1),o=5<=r.length?this.resolveNumberArg(r[4]):0,e<=0?s[$.CommonErrors.Num]:((n-e)/e*(3===o?365:360)/i).toString()))},u.prototype.ComputeRECEIVED=function(){for(var r,t,e,n,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return z.isNullOrUndefined(i)||i.length<4||5<i.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(i[0]),t=this.resolveNumberArg(i[1]),e=this.resolveNumberArg(i[2]),n=this.resolveNumberArg(i[3]),"string"==typeof r?r:"string"==typeof t?t:"string"==typeof e?e:"string"==typeof n?n:(e*(1+n*Math.max(t-r,1)/(3===(5<=i.length?this.resolveNumberArg(i[4]):0)?365:360))).toString())},u.prototype.ComputeCUMIPMT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.cumIpmtPrinc(r,!0)},u.prototype.ComputeCUMPRINC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.cumIpmtPrinc(r,!1)},u.prototype.cumIpmtPrinc=function(r,t){if(z.isNullOrUndefined(r)||6!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]),s=this.resolveNumberArg(r[4]),r=this.resolveNumberArg(r[5]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;if("string"==typeof r)return r;for(var a=parseFloat(this.computePmt(e,n,i,r)),l=i,u=0,h=1;h<=s;h++){var p=l*e;o<=h&&(u+=t?p:a-p),l+=a}return u.toString()},u.prototype.computePmt=function(r,t,e,n){return(0===r?-e/t:r*e*(e=Math.pow(1+r,t))/((1+r*(n?1:0))*(1-e))).toString()},u.prototype.ComputeVDB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<5||7<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]),s=this.resolveNumberArg(r[4]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;var a=2;if(6<=r.length&&""!==r[5]){var l=this.resolveNumberArg(r[5]);if("string"==typeof l)return l;a=l}for(var u=a/i,h=e,p=0,g=1;g<=Math.floor(s);g++)h-=p=Math.min(h*u,h-n);for(var f=0,h=e,g=1;g<=s;g++)p=Math.min(h*u,h-n),o<g&&(f+=p),h-=p;return f.toString()},u.prototype.ComputeXIRR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=[],i=[],o=.1,s=r[r.length-1],s=(3<=r.length&&!this.parent.isCellReference(s)&&"number"==typeof(s=this.resolveNumberArg(s))&&(o=s),r[0]),a=r[1],s=this.parent.getCellCollection(s),a=this.parent.getCellCollection(a),l=Array.isArray(s)?s:[s],u=Array.isArray(a)?a:[a];if(!(l.length!==u.length||l.length<2)){for(var h=0;h<l.length;h++){var p=this.parent.getValueFromArg(l[h]),g=this.parent.getValueFromArg(u[h]);if(-1<e.indexOf(p))return p;if(-1<e.indexOf(g))return g;n.push(this.parent.parseFloat(p)),i.push(this.parent.parseFloat(g))}for(var f=i[0],m=function(r){for(var t=0,e=0;e<n.length;e++)t+=n[e]/Math.pow(1+r,(i[e]-f)/365);return t},c=o,d=0;d<100;d++){var N=m(c),v=(m(c+1e-7)-N)/1e-7;if(Math.abs(v)<1e-12)break;N=c-N/v;if(Math.abs(N-c)<1e-10)return N.toString();c=N}}return e[$.CommonErrors.Num]};var Rt,Tt,It=u;function u(r){r=Tt.call(this,r)||this;return r.formulas=[{formulaName:"DOLLARDE",category:"Financial",description:"Converts a dollar price expressed as a fraction into a decimal number."},{formulaName:"DOLLARFR",category:"Financial",description:"Converts a dollar price expressed as a decimal number into a fraction."},{formulaName:"DISC",category:"Financial",description:"Returns the discount rate for a security."},{formulaName:"DURATION",category:"Financial",description:"Returns the annual duration of a security with periodic interest payments."},{formulaName:"INTRATE",category:"Financial",description:"Returns the interest rate for a fully invested security."},{formulaName:"RECEIVED",category:"Financial",description:"Returns the amount received at maturity for a fully invested security."},{formulaName:"CUMIPMT",category:"Financial",description:"Returns the cumulative interest paid between two periods."},{formulaName:"CUMPRINC",category:"Financial",description:"Returns the cumulative principal paid on a loan between two periods."},{formulaName:"VDB",category:"Financial",description:"Returns the depreciation of an asset for a period using the declining balance method."},{formulaName:"XIRR",category:"Financial",description:"Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic."}],r}Mt=function(r,t){return(Mt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Mt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(h,Dt=t),h.prototype.ComputeAVERAGE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(e=!0,r.pop()),z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];for(var n=r,i=0;i<n.length;i++)if(-1<n[i].indexOf(":")&&-1<n[i].indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value];return this.parent.calculateAvg(n,e)},h.prototype.ComputeAVERAGEIF=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;return e[0].indexOf(":")<0&&!this.parent.isCellReference(e[0])?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.ImproperFormula]:0===(e=this.parent.computeSumIfAndAvgIf(r,!0))[1]||"NaN"===e[0].toString()?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Div]:"string"==typeof e&&(this.parent.formulaErrorStrings.indexOf(e)||this.parent.getErrorStrings().indexOf(e))?e:this.parent.parseFloat(e[0])/this.parent.parseFloat(e[1])},h.prototype.ComputeAVERAGEA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var e,n,i,o=r,s=0,a=0,l=0;l<o.length;l++)if(this.parent.isCellReference(o[l]))if(-1<o[l].indexOf(":"))for(var u=this.parent.getCellCollection(o[l].split(this.parent.tic).join("")),h=0;h<u.length;h++){if(e=this.parent.getValueFromArg(u[h]),e=this.processLogicalCellValue(e),-1<this.parent.getErrorStrings().indexOf(e))return e;z.isNullOrUndefined(e)||""===e||(i=this.parent.parseFloat(e),s+=e=isNaN(i)?0:i,a+=1)}else{if(e=this.parent.getValueFromArg(o[l]),e=this.processLogicalCellValue(e),-1<this.parent.getErrorStrings().indexOf(e))return e;z.isNullOrUndefined(e)||""===e||(i=this.parent.parseFloat(e),s+=e=isNaN(i)?0:i,a+=1)}else{if(-1<o[l].indexOf(this.parent.tic)&&(isNaN(this.parent.parseFloat(o[l].split(this.parent.tic).join("")))||""===o[l].split(this.parent.tic).join("").trim()))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(o[l]=this.processLogicalCellValue(o[l]),n=this.parent.getValueFromArg(o[l].split(this.parent.tic).join("")),-1<this.parent.getErrorStrings().indexOf(n))return n;s+=this.parent.parseFloat(n),a+=1}return 0===a?this.parent.getErrorStrings()[$.CommonErrors.DivZero]:s/a},h.prototype.processLogicalCellValue=function(r){return r.toUpperCase()===this.parent.trueValue?r="1":r.toUpperCase()===this.parent.falseValue&&(r="0"),r},h.prototype.ComputeAVERAGEIFS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.calculateIFS(r,this.parent.trueValue)},h.prototype.ComputeCOUNT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(e=!0,r.pop()),z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var n,i,o,s=r,a=0,l=0;l<s.length;l++)if(this.parent.isCellReference(n=s[l]))if(-1<n.indexOf(":"))for(var u=this.parent.getCellCollection(n.split(this.parent.tic).join("")),h=0;h<u.length;h++)i=e?this.parent.getValueFromArg(u[h],null,null,!0):this.parent.getValueFromArg(u[h]),e&&i.includes("SUBTOTAL(")||isNaN(this.parent.parseFloat(i))||0<n.length&&""!==i.trim()&&a++;else i=e?this.parent.getValueFromArg(n,null,null,!0):this.parent.getValueFromArg(n),e&&i.includes("SUBTOTAL(")||isNaN(this.parent.parseFloat(i))||0<n.length&&""!==i.trim()&&a++;else o=this.parent.getValueFromArg(n).split(this.parent.tic).join(""),0===n.length&&""===o.trim()?a++:isNaN(this.parent.parseFloat(o))&&n!==this.parent.trueValue&&n!==this.parent.falseValue||0<n.length&&""!==n.trim()&&""!==o.trim()&&a++;return a},h.prototype.ComputeCOUNTA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(e=!0,r.pop()),z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var n,i,o=r,s=0,a=0;a<o.length;a++)if(this.parent.isCellReference(o[a]))if(-1<o[a].indexOf(":"))for(var l=this.parent.getCellCollection(o[a].split(this.parent.tic).join("")),u=0;u<l.length;u++)n=e?this.parent.getValueFromArg(l[u],null,null,!0):this.parent.getValueFromArg(l[u]),e&&n.includes("SUBTOTAL(")||0<n.length&&s++;else n=e?this.parent.getValueFromArg(o[a],null,null,!0):this.parent.getValueFromArg(o[a]),e&&n.includes("SUBTOTAL(")||0<n.length&&s++;else(0<(i=this.parent.getValueFromArg(o[a]).split(this.parent.tic).join("")).length||0===i.length&&""===i.trim())&&s++;return s},h.prototype.ComputeCOUNTIF=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;if(z.isNullOrUndefined(r)||""===r[0]||2!==e.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(e[0].indexOf(":")<0&&!this.parent.isCellReference(e[0]))return this.parent.getErrorStrings()[$.CommonErrors.Name];var n,i=0,o=[],s="equal";if(""===e[1])return 0;var a=e[1].startsWith(this.parent.tic)&&e[1].endsWith(this.parent.tic),l=this.parent.getANDComputedValue(e[1]),u=l.includes("*"),h="*"===l||"<>*"===l,p=u&&!h?l.replace(/\*/g,"").trim():l,g=!1,f=(!a&&this.parent.isCellReference(p)&&(p=this.parent.getValueFromArg(p),g=!0),(l=p=u&&!h&&(u=l.indexOf("*"),"*"===l[0]&&(p="*"+p),"*"===l[l.length-1]&&(p+="*"),0<u)&&u<l.length-1?l.substring(0,u)+"*"+l.substring(u+1):p).startsWith("<=")?(s="lessEq",l=l.substring(2)):l.startsWith(">=")?(s="greaterEq",l=l.substring(2)):l.startsWith("<>")?(s="notEq",l=l.substring(2)):l.startsWith("<")?(s="less",l=l.substring(1)):l.startsWith(">")?(s="greater",l=l.substring(1)):l.startsWith("=")&&(s="equal",l=l.substring(1)),-1<l.indexOf("*")||-1<l.indexOf("?"));if((!a&&this.parent.isCellReference(l)&&!g||l.includes(this.parent.arithMarker)||l.includes(this.parent.getParseDecimalSeparator())&&!f)&&(l=this.parent.getValueFromArg(l)),this.parent.isCellReference(e[0]))for(var m=this.parent.getCellCollection(e[0].split(this.parent.tic).join("")),c=0;c<m.length;c++)n=this.parent.getValueFromArg(m[c]),f&&(n=this.parent.findWildCardValue(l.toLowerCase(),n.toLowerCase())),o.push(n),o.push(l),this.parent.processLogical(o,s)===this.parent.trueValue&&i++;return i},h.prototype.ComputeCOUNTIFS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.parent.computeCountIfsFormulas(r)},h.prototype.ComputeCOUNTBLANK=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=0;if(1!==r.length||z.isNullOrUndefined(r)||!this.parent.isCellReference(r[0]))return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===r[0])return this.parent.getErrorStrings()[$.CommonErrors.Value];for(var n=this.parent.getCellCollection(r[0]),i=0;i<n.length;i++)""===this.parent.getValueFromArg(n[i])&&e++;return e},h.prototype.ComputeMIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.parent.computeMinMax(r,"min")},h.prototype.ComputeMAX=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.parent.computeMinMax(r,"max")};var Mt,Dt,Ut=h;function h(r){r=Dt.call(this,r)||this;return r.formulas=[{formulaName:"AVERAGE",category:"Statistical",description:"The sum of the numbers divided by how many numbers are being averaged."},{formulaName:"AVERAGEIF",category:"Statistical",description:"Computes the average of the numbers in a range that meet the supplied criteria."},{formulaName:"AVERAGEA",category:"Statistical",description:"Calculates the average of values in the list of arguments.Arguments can be numbers, names, arrays or references."},{formulaName:"AVERAGEIFS",category:"Statistical",description:"Conditionally returns the average of the contents of cells for the set of ranges."},{formulaName:"COUNT",category:"Statistical",description:"Counts the numbers in the list of arguments, exclude text entries."},{formulaName:"COUNTA",category:"Statistical",description:"Counts the non-empty values in the list of arguments."},{formulaName:"COUNTIF",category:"Statistical",description:"Counts the number of cells in a range that meet a specified condition."},{formulaName:"COUNTIFS",category:"Statistical",description:"Counts the number of times each cells in all the ranges that meet the specific conditions."},{formulaName:"COUNTBLANK",category:"Statistical",description:"Returns the number of empty cells in a specified range of cells."},{formulaName:"MIN",category:"Statistical",description:"Returns the smaller number in set of arguments."},{formulaName:"MAX",category:"Statistical",description:"Returns the largest number in set of arguments."}],r}wt=function(r,t){return(wt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}wt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(p,jt=t),p.prototype.ComputeMEDIAN=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=[];if(z.isNullOrUndefined(t)||""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];for(var i=0;i<t.length;i++)if(this.parent.isCellReference(t[i]))if(-1<t[i].indexOf(":"))for(var o=this.parent.getCellCollection(t[i]),s=0;s<o.length;s++){var a=this.parent.getValueFromArg(o[s]);if(-1<this.parent.getErrorStrings().indexOf(a))return a;""!==a.trim()&&n.push(this.parent.parseFloat(a))}else{var l=this.parent.getValueFromArg(t[i]);if(-1<this.parent.getErrorStrings().indexOf(l))return l;""!==l.trim()&&n.push(this.parent.parseFloat(l))}else if(""===t[i]||t[i]===this.parent.falseValue&&!this.parent.isCellReference(t[i]))n.push(0);else if(t[i]!==this.parent.trueValue||this.parent.isCellReference(t[i])){if(-1<t[i].indexOf(this.parent.tic)&&isNaN(parseFloat(t[i].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[$.CommonErrors.Value];l=this.parent.getValueFromArg(t[i]).split(this.parent.tic).join("");if(-1<this.parent.getErrorStrings().indexOf(l))return l;n.push(this.parent.parseFloat(l))}else n.push(1);for(var u=(n=n.sort(function(r,t){return r-t})).length,h=0;h<u&&(!isNaN(n[h])||(n.splice(h,1),u=n.length,h--,0!==n.length));h++);if(n.length%2==0||isNaN(n[parseInt((n.length/2).toString(),10)])){if(isNaN(n[n.length/2])||isNaN(n[n.length/2-1]))return this.parent.getErrorStrings()[$.CommonErrors.Num];r=(n[n.length/2]+n[n.length/2-1])/2}else r=n[parseInt((n.length/2).toString(),10)];return r},p.prototype.ComputeSMALL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length||""===r[0])return""===r[0]&&""===r[1]?e[$.CommonErrors.Num]:this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=[],i=[];if(!z.isNullOrUndefined(r[0])){var o=void 0;if(this.parent.isCellReference(r[0]))for(var s=this.parent.getCellCollection(r[0]),a=0;a<s.length;a++){if(o=this.parent.getValueFromArg(s[a]),-1<e.indexOf(o))return o;n.push(o)}else{if(o=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join(""),-1<e.indexOf(o))return o;n.push(o)}for(a=0;a<n.length;a++)""===n[a]||isNaN(this.parent.parseFloat(n[a]))||i.push(this.parent.parseFloat(n[a]));if(0===i.length&&(z.isNullOrUndefined(n[0])||-1<r[0].indexOf(this.parent.tic)))return e[$.CommonErrors.Value]}if(i=i.sort(function(r,t){return r-t}),!z.isNullOrUndefined(r[1])){if(this.parent.isCellReference(r[1])){if(""===(l=this.parent.getValueFromArg(r[1])))return e[$.CommonErrors.Num];if(""===l.trim())return e[$.CommonErrors.Value];l.toUpperCase()===this.parent.trueValue?l="1":l.toUpperCase()===this.parent.falseValue&&(l="0")}else l=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("");if(-1<e.indexOf(l))return l;if(""===l.trim())return 0<r[1].length?e[$.CommonErrors.Value]:e[$.CommonErrors.Num];if(isNaN(this.parent.parseFloat(l)))if(r[1].toUpperCase()===this.parent.trueValue)l="1";else{if(r[1].toUpperCase()!==this.parent.falseValue)return e[$.CommonErrors.Value];l="0"}}var l=Number(l)<1?0:Math.floor(Number(l));return z.isNullOrUndefined(i[l-1])&&!isNaN(Number(l))?e[$.CommonErrors.Num]:i[l-1]},p.prototype.ComputeLARGE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length||""===r[0])return""===r[0]&&""===r[1]?e[$.CommonErrors.Num]:this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=[],i=[];if(!z.isNullOrUndefined(r[0])){var o=void 0;if(this.parent.isCellReference(r[0]))for(var s=this.parent.getCellCollection(r[0]),a=0;a<s.length;a++){if(o=this.parent.getValueFromArg(s[a]),-1<e.indexOf(o))return o;n.push(o)}else{if(o=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join(""),-1<e.indexOf(o))return o;n.push(o)}for(a=0;a<n.length;a++)""===n[a]||isNaN(this.parent.parseFloat(n[a]))||i.push(this.parent.parseFloat(n[a]));if(0===i.length&&(z.isNullOrUndefined(n[0])||-1<r[0].indexOf(this.parent.tic)))return e[$.CommonErrors.Value]}if(i=i.sort(function(r,t){return t-r}),!z.isNullOrUndefined(r[1])){if(this.parent.isCellReference(r[1])){if(""===(l=this.parent.getValueFromArg(r[1])))return e[$.CommonErrors.Num];if(""===l.trim())return e[$.CommonErrors.Value];l.toUpperCase()===this.parent.trueValue?l="1":l.toUpperCase()===this.parent.falseValue&&(l="0")}else l=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("");if(-1<e.indexOf(l))return l;if(""===l.trim())return 0<r[1].length?e[$.CommonErrors.Value]:e[$.CommonErrors.Num];if(isNaN(this.parent.parseFloat(l)))if(r[1].toUpperCase()===this.parent.trueValue)l="1";else{if(r[1].toUpperCase()!==this.parent.falseValue)return e[$.CommonErrors.Value];l="0"}}var l=Number(l)<1?0:Math.ceil(Number(l));return z.isNullOrUndefined(i[l-1])&&!isNaN(Number(l))?e[$.CommonErrors.Num]:i[l-1]},p.prototype.ComputeSLOPE=function(){for(var e=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0].trim())return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===r[0]||""===r[1])return n[$.CommonErrors.Value];function i(r){return r=-1===r.indexOf(e.parent.tic)?e.parent.getCellCollection(r.split(e.parent.tic).join("")):void 0}var o=i(r[0].trim()),s=i(r[1].trim());if(z.isNullOrUndefined(o)||z.isNullOrUndefined(s)||o.length<2&&s.length<2)return n[$.CommonErrors.DivZero];if(o.length!==s.length)return n[$.CommonErrors.NA];function a(r){r=e.getDataCollection(r);for(var t=0;t<r.length;t++)if(-1<n.indexOf(r[t]))return r[t].toString();return r}o=a(o);if(-1<n.indexOf(o.toString()))return o.toString();if(s=a(s),-1<n.indexOf(s.toString()))return s.toString();for(var l=0,u=0,h=0,p=0,g=0,f=0,m=s.length;f<m;++f)""!==s[f]&&"NaN"!==Number(s[f]).toString()&&""!==o[f]&&"NaN"!==Number(o[f]).toString()&&(l+=Number(s[f])*Number(o[f]),h+=Number(s[f]),p+=Number(o[f]),u+=Number(s[f])*Number(s[f]),g++);var c=((l-h*p/g)/(u-h*h/g)).toString();return"NaN"===c?n[$.CommonErrors.DivZero]:c},p.prototype.ComputeINTERCEPT=function(){for(var e=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n,i,o,s,a,l,u,h,p,g=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1===r.length&&""===r[0].trim()?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:""===r[0]||""===r[1]?g[$.CommonErrors.Value]:(i=(p=function(r){return r=-1===r.indexOf(e.parent.tic)?e.parent.getCellCollection(r.split(e.parent.tic).join("")):void 0})(r[0].trim()),n=p(r[1].trim()),z.isNullOrUndefined(i)||z.isNullOrUndefined(n)||i.length<2&&n.length<2?g[$.CommonErrors.DivZero]:i.length!==n.length?g[$.CommonErrors.NA]:(i=(p=function(r){r=e.getDataCollection(r);for(var t=0;t<r.length;t++)if(-1<g.indexOf(r[t]))return r[t];return r})(i),-1<g.indexOf(i.toString())?i.toString():(n=p(n),-1<g.indexOf(n.toString())?n.toString():((p=function(r){for(var t=0,e=n.length;t<e;++t)""!==i[t]&&"NaN"!==Number(i[t]).toString()&&""!==n[t]&&"NaN"!==Number(n[t]).toString()&&(r?(o+=Number(i[t]),s+=Number(n[t]),a++):(h=Number(n[t])-s,l+=h*(Number(i[t])-o),u+=h*h))})(!(u=l=a=s=o=0)),o/=a,s/=a,p(!1),"NaN"===(p=(o-l/u*s).toString())?g[$.CommonErrors.DivZero]:p))))},p.prototype.ComputeGEOMEAN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=r,s=1,a=0,l=0;if(0===r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(1!==o.length||""!==o[0]){for(var u,h=0;h<o.length;h++)if(-1<o[h].indexOf(":")){if(o[0]===this.parent.tic)return this.parent.getErrorStrings()[$.CommonErrors.Value];for(i=this.parent.getCellCollection(o[h].split(this.parent.tic).join("")),n=0;n<i.length;n++){if(u=(u=(l=this.parent.getValueFromArg(i[n])).split(this.parent.tic).join(""))===this.parent.trueValue||u===this.parent.falseValue,(e=this.parent.parseFloat(l))<=0)return this.parent.getErrorStrings()[$.CommonErrors.Num];u||-1<this.parent.getErrorStrings().indexOf(l)||isNaN(e)||(a++,s*=e)}}else{if(l=this.parent.getValueFromArg(o[h]),-1<this.parent.getErrorStrings().indexOf(l))return l;var p=l.split(this.parent.tic).join("");if(-1<l.indexOf('"')&&isNaN(this.parent.parseFloat(p)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(o[h]=o[h].startsWith("n")?o[h].slice(1):o[h],""===l&&""===o[h])return this.parent.getErrorStrings()[$.CommonErrors.Num];if(("TRUE"!==p&&"FALSE"!==p||!this.parent.isCellReference(o[h]))&&0<l.length){if(l="TRUE"===(l=-1<l.indexOf('"')?p:l).split(this.parent.tic).join("")?"1":"FALSE"===l.split(this.parent.tic).join("")?"0":l,!this.parent.isCellReference(o[h])&&isNaN(this.parent.parseFloat(l)))return this.parent.getErrorStrings()[$.CommonErrors.Value];if((e=this.parent.parseFloat(l))<=0)return this.parent.getErrorStrings()[$.CommonErrors.Num];isNaN(e)||(a++,s*=e)}}0<a&&(s=Math.pow(s,1/a))}return s.toString()},p.prototype.ComputeRSQ=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=0,n=r;if(2!==n.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===n[0]||""===n[1])return this.parent.getErrorStrings()[$.CommonErrors.Value];if(n[0].includes('"')||n[1].includes('"'))return this.parent.getErrorStrings()[$.CommonErrors.NA];if(-1===n[0].indexOf(":")&&Y(n[0])&&-1===n[1].indexOf(":")&&Y(n[1]))return this.parent.getErrorStrings()[$.CommonErrors.DivZero];var i=this.parent.getCellCollection(n[0]),n=this.parent.getCellCollection(n[1]);if(i.length!==n.length)return this.parent.getErrorStrings()[$.CommonErrors.NA];for(var o=this.getDataCollection(n),s=0;s<o.length;s++)if(-1<this.parent.getErrorStrings().indexOf(o[s]))return o[s];for(var a,l,u=this.getDataCollection(i),h=0;h<u.length;h++)if(-1<this.parent.getErrorStrings().indexOf(u[h]))return u[h];for(var p=0;p<o.length;p++)a=Number(o[p]),l=Number(u[p]),Q(a)&&Q(l)&&e++;return e<=1?this.parent.getErrorStrings()[$.CommonErrors.DivZero]:2===e?1:(i=(n=this.getMeanArray(o,u))[0],n=n[1],i=this.getCorrelation(o,u,i,n),Math.pow(i,2))},p.prototype.getCorrelation=function(r,t,e,n){for(var i,o,s=0,a=0,l=0,u=0;u<r.length;u++)Q(r[u])&&Q(t[u])&&(s+=(o=Number(r[u])-e)*(i=Number(t[u])-n),a+=Math.pow(o,2),l+=Math.pow(i,2));return s/Math.sqrt(a*l)},p.prototype.getMeanArray=function(r,t){for(var e=0,n=0,i=0,o=0;o<r.length;o++)Q(r[o])&&Q(t[o])&&(n+=Number(r[o]),i+=Number(t[o]),e++);return[n/e,i/e]},p.prototype.getDataCollection=function(r){for(var t=[],e=0,n=r.length;e<n;e++)t.push(this.parent.getValueFromArg(r[e]));return t};var wt,jt,Lt=p;function p(r){r=jt.call(this,r)||this;return r.formulas=[{formulaName:"SMALL",category:"Statistical",description:"Returns the k-th smallest value in a given array."},{formulaName:"LARGE",category:"Statistical",description:"Returns the k-th largest value in a given array."},{formulaName:"MEDIAN",category:"Statistical",description:"Returns the median of the given set of numbers."},{formulaName:"SLOPE",category:"Statistical",description:"Returns the slope of the line from linear regression of the data points."},{formulaName:"INTERCEPT",category:"Statistical",description:"Calculates the point of the Y-intercept line via linear regression."},{formulaName:"RSQ",category:"Statistical",description:"Returns the square of the Pearson product moment correlation coefficient based on data points in known_ys and known_xs."},{formulaName:"GEOMEAN",category:"Statistical",description:"Returns the geometric mean of an array or range of positive data."}],r}kt=function(r,t){return(kt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}kt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(g,Pt=t),g.prototype.collectSample=function(r,t){for(var e=this.parent.getErrorStrings(),n=[],i=0;i<r.length;i++){var o=r[i];if(""!==o)if(this.parent.isCellReference(o)&&-1<o.indexOf(":"))for(var s=this.parent.getCellCollection(o),a=Array.isArray(s)?s:[s],l=0;l<a.length;l++){var u=this.parent.getValueFromArg(a[l]);if(-1<e.indexOf(u))return u;""!==u&&((h=u.toUpperCase())===this.parent.trueValue?n.push(1):h===this.parent.falseValue?n.push(0):this.parent.isNumber(u)?n.push(this.parent.parseFloat(u)):t&&n.push(0))}else{var h,u=this.parent.getValueFromArg(o);if(-1<e.indexOf(u))return u;if((h=u.toUpperCase())===this.parent.trueValue)n.push(1);else if(h===this.parent.falseValue)n.push(0);else if(""!==u)if(this.parent.isNumber(this.parent.removeTics(u)))n.push(this.parent.parseFloat(this.parent.removeTics(u)));else{if(!t)return e[$.CommonErrors.Value];n.push(0)}}}return n},g.prototype.variance=function(r,t){for(var e=r.reduce(function(r,t){return r+t},0)/r.length,n=0,i=0;i<r.length;i++){var o=r[i]-e;n+=o*o}return n/(t?r.length:r.length-1)},g.prototype.ComputeSTDEV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVar(r,!1,!1)},g.prototype.ComputeSTDEVP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVar(r,!0,!1)},g.prototype.ComputeVAR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVar(r,!1,!0)},g.prototype.ComputeVARP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVar(r,!0,!0)},g.prototype.stdevVar=function(r,t,e){var n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1===r.length&&""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:"string"==typeof(r=this.collectSample(r,!1))?r:r.length<(t?1:2)?n[$.CommonErrors.DivZero]:(n=this.variance(r,t),(e?n:Math.sqrt(n)).toString())},g.prototype.ComputeMODE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectSample(r,!1);if("string"==typeof n)return n;if(0===n.length)return e[$.CommonErrors.Value];for(var i=new Map,o=n[0],s=0,a=0;a<n.length;a++){var l=n[a],u=(i.get(l)||0)+1;i.set(l,u),s<u&&(s=u,o=l)}return s<2?e[$.CommonErrors.NA]:o.toString()},g.prototype.ComputeRANK=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]);if("string"==typeof n)return n;var i=this.collectSample([r[1]],!1);if("string"==typeof i)return i;var o=0;if(3===r.length&&""!==r[2]){var s=this.resolveNumberArg(r[2]);if("string"==typeof s)return s;o=s}s=i.slice().sort(function(r,t){return o?r-t:t-r}).indexOf(n);return s<0?e[$.CommonErrors.NA]:(s+1).toString()},g.prototype.ComputeMAXA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.minMaxA(r,!0)},g.prototype.ComputeMINA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.minMaxA(r,!1)},g.prototype.minMaxA=function(r,t){if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var e=this.collectSample(r,!0);if("string"==typeof e)return e;if(0===e.length)return"0";for(var n=e[0],i=1;i<e.length;i++)(t?e[i]>n:e[i]<n)&&(n=e[i]);return n.toString()};var kt,Pt,_t=g;function g(r){r=Pt.call(this,r)||this;return r.formulas=[{formulaName:"STDEV",category:"Statistical",description:"Estimates standard deviation based on a sample."},{formulaName:"STDEVP",category:"Statistical",description:"Calculates standard deviation based on the entire population."},{formulaName:"VAR",category:"Statistical",description:"Estimates variance based on a sample."},{formulaName:"VARP",category:"Statistical",description:"Calculates variance based on the entire population."},{formulaName:"MODE",category:"Statistical",description:"Returns the most common value in a data set."},{formulaName:"RANK",category:"Statistical",description:"Returns the rank of a number in a list of numbers."},{formulaName:"MAXA",category:"Statistical",description:"Returns the maximum value in a list of arguments, including text and logicals."},{formulaName:"MINA",category:"Statistical",description:"Returns the minimum value in a list of arguments, including text and logicals."}],r}Wt=function(r,t){return(Wt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Wt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Xt,qt=t),Xt.prototype.collectSample=function(r,t){void 0===t&&(t=!1);for(var e=this.parent.getErrorStrings(),n=[],i=0;i<r.length;i++){var o=r[i];if(""!==o)if(this.parent.isCellReference(o)&&-1<o.indexOf(":"))for(var s=this.parent.getCellCollection(o),a=Array.isArray(s)?s:[s],l=0;l<a.length;l++){var u=this.parent.getValueFromArg(a[l]);if(-1<e.indexOf(u))return u;""!==u&&((h=u.toUpperCase())===this.parent.trueValue?n.push(1):h===this.parent.falseValue?n.push(0):this.parent.isNumber(u)?n.push(this.parent.parseFloat(u)):t&&n.push(0))}else{var h,u=this.parent.getValueFromArg(o);if(-1<e.indexOf(u))return u;if((h=u.toUpperCase())===this.parent.trueValue)n.push(1);else if(h===this.parent.falseValue)n.push(0);else if(""!==u)if(this.parent.isNumber(this.parent.removeTics(u)))n.push(this.parent.parseFloat(this.parent.removeTics(u)));else{if(!t)return e[$.CommonErrors.Value];n.push(0)}}}return n},Xt.prototype.collectPair=function(r){var t=this.parent.getErrorStrings();if(2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.parent.getCellCollection(r[0]),r=this.parent.getCellCollection(r[1]),n=Array.isArray(e)?e:[e],i=Array.isArray(r)?r:[r];if(n.length!==i.length)return t[$.CommonErrors.NA];for(var o=[],s=[],a=0;a<n.length;a++){var l=this.parent.getValueFromArg(n[a]),u=this.parent.getValueFromArg(i[a]);if(-1<t.indexOf(l))return l;if(-1<t.indexOf(u))return u;""!==l&&""!==u&&this.parent.isNumber(l)&&this.parent.isNumber(u)&&(o.push(this.parent.parseFloat(l)),s.push(this.parent.parseFloat(u)))}return{x:o,y:s}},Xt.prototype.mean=function(r){return r.reduce(function(r,t){return r+t},0)/r.length};var Wt,qt,Bt=Xt;function Xt(){return null!==qt&&qt.apply(this,arguments)||this}Yt=function(r,t){return(Yt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Yt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Zt,Ht=Bt),Zt.prototype.ComputeAVEDEV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectSample(r);if("string"==typeof n)return n;if(0===n.length)return e[$.CommonErrors.DivZero];for(var i=this.mean(n),o=0,s=0;s<n.length;s++)o+=Math.abs(n[s]-i);return(o/n.length).toString()},Zt.prototype.ComputeDEVSQ=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectSample(r);if("string"==typeof n)return n;if(0===n.length)return e[$.CommonErrors.DivZero];for(var i=this.mean(n),o=0,s=0;s<n.length;s++){var a=n[s]-i;o+=a*a}return o.toString()},Zt.prototype.ComputeHARMEAN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectSample(r);if("string"==typeof n)return n;if(0===n.length)return e[$.CommonErrors.DivZero];for(var i=0,o=0;o<n.length;o++){if(n[o]<=0)return e[$.CommonErrors.Num];i+=1/n[o]}return(n.length/i).toString()},Zt.prototype.ComputeSKEW=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectSample(r);if("string"==typeof n)return n;var i=n.length;if(i<3)return e[$.CommonErrors.DivZero];for(var o=this.mean(n),s=0,a=0,l=0;l<i;l++){var u=n[l]-o;s+=u*u,a+=u*u*u}return a/=i,0===(s/=i)?e[$.CommonErrors.DivZero]:(a/Math.pow(s,1.5)*Math.sqrt(i*(i-1))/(i-2)).toString()},Zt.prototype.ComputeKURT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var n=this.collectSample(r);if("string"==typeof n)return n;var i=n.length;if(i<4)return e[$.CommonErrors.DivZero];for(var o=this.mean(n),s=0,a=0,l=0;l<i;l++){var u=n[l]-o;s+=u*u,a+=u*u*u*u}return a/=i,0===(s/=i)?e[$.CommonErrors.DivZero]:(i*(i+1)/((i-1)*(i-2)*(i-3))*(a/(s*s))-3*(i-1)*(i-1)/((i-2)*(i-3))).toString()},Zt.prototype.ComputeSTANDARDIZE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),"string"==typeof e?e:"string"==typeof n?n:"string"==typeof i?i:i<=0?o[$.CommonErrors.Num]:((e-n)/i).toString())};var Yt,Ht,Gt=Zt;function Zt(r){r=Ht.call(this,r)||this;return r.formulas=[{formulaName:"AVEDEV",category:"Statistical",description:"Returns the average of the absolute deviations of data points from their mean."},{formulaName:"DEVSQ",category:"Statistical",description:"Returns the sum of squares of deviations."},{formulaName:"HARMEAN",category:"Statistical",description:"Returns the harmonic mean."},{formulaName:"SKEW",category:"Statistical",description:"Returns the skewness of a distribution."},{formulaName:"KURT",category:"Statistical",description:"Returns the kurtosis of a data set."},{formulaName:"STANDARDIZE",category:"Statistical",description:"Returns a normalized value from a distribution."}],r}Kt=function(r,t){return(Kt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Kt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Qt,$t=Bt),Qt.prototype.regressionStats=function(r){var t=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];r=this.collectPair(r);if("string"==typeof r)return r;var e=r.x,n=r.y;if(e.length<2)return t[$.CommonErrors.DivZero];for(var i=this.mean(e),o=this.mean(n),s=0,a=0,l=0,u=0;u<e.length;u++){var h=e[u]-i,p=n[u]-o;s+=h*h,a+=p*p,l+=h*p}return{n:e.length,meanX:i,meanY:o,sxx:s,syy:a,sxy:l}},Qt.prototype.ComputeCORREL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings(),n=this.regressionStats(r);return"string"==typeof n?n:0===n.sxx||0===n.syy?e[$.CommonErrors.DivZero]:(n.sxy/Math.sqrt(n.sxx*n.syy)).toString()},Qt.prototype.ComputePEARSON=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.ComputeCORREL.apply(this,r)},Qt.prototype.ComputeCOVAR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings(),n=this.regressionStats(r);return"string"==typeof n?n:n.n<2?e[$.CommonErrors.DivZero]:(n.sxy/(n.n-1)).toString()},Qt.prototype.ComputeFORECAST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.resolveNumberArg(r[0]))?e:"string"==typeof(n=this.regressionStats([r[2],r[1]]))?n:0===n.sxx?i[$.CommonErrors.DivZero]:(i=n.sxy/n.sxx,(n.meanY-i*n.meanX+i*e).toString())},Qt.prototype.ComputeSTEYX=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings(),n=this.regressionStats([r[1],r[0]]);return"string"==typeof n?n:n.n<=2||0===n.sxx?e[$.CommonErrors.DivZero]:(e=n.syy-n.sxy*n.sxy/n.sxx,Math.sqrt(e/(n.n-2)).toString())};var Kt,$t,zt=Qt;function Qt(r){r=$t.call(this,r)||this;return r.formulas=[{formulaName:"CORREL",category:"Statistical",description:"Returns the correlation coefficient between two data sets."},{formulaName:"COVAR",category:"Statistical",description:"Returns covariance, the average of the products of paired deviations."},{formulaName:"PEARSON",category:"Statistical",description:"Returns the Pearson product moment correlation coefficient."},{formulaName:"FORECAST",category:"Statistical",description:"Returns a value along a linear trend."},{formulaName:"STEYX",category:"Statistical",description:"Returns the standard error of the predicted y-value for each x in the regression."}],r}Jt=function(r,t){return(Jt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Jt(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(ee,re=Bt),ee.prototype.sortedSample=function(r){return z.isNullOrUndefined(r)||1===r.length&&""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:"string"==typeof(r=this.collectSample(r))?r:r.slice().sort(function(r,t){return r-t})},ee.prototype.percentile=function(r,t){var e,n=this.parent.getErrorStrings();return t<0||1<t||0===r.length?n[$.CommonErrors.Num]:(t=t*((n=r.length)-1),n-1<=(e=Math.floor(t))?r[n-1]:r[e]+(t-e)*(r[e+1]-r[e]))},ee.prototype.ComputePERCENTILE=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||2!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveNumberArg(e[1]))?r:"string"==typeof(t=this.sortedSample([e[0]]))?t:"string"==typeof(t=this.percentile(t,r))?t:t.toString()},ee.prototype.ComputePERCENTRANK=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]);if("string"==typeof n)return n;var i=this.sortedSample([r[1]]);if("string"==typeof i)return i;if(0===i.length)return e[$.CommonErrors.Num];var e=0,o=1;if(3===r.length){var s=this.resolveNumberArg(r[2]);if("string"==typeof s)return s;o=1-(e=s)}if(n<i[0])return e.toString();if(n>i[i.length-1])return o.toString();for(var a=0,l=0;l<i.length;l++){if(i[l]===n){a=l/(i.length-1||1);break}if(i[l]>n){a=(l-1+(n-i[l-1])/(i[l]-i[l-1]))/(i.length-1);break}}return a.toString()},ee.prototype.ComputeQUARTILE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.resolveNumberArg(r[1]))?e:(e=Math.floor(e))<0||4<e?n[$.CommonErrors.Num]:"string"==typeof(n=this.sortedSample([r[0]]))?n:"string"==typeof(n=this.percentile(n,{0:0,1:.25,2:.5,3:.75,4:1}[e]))?n:n.toString()};var Jt,re,te=ee;function ee(r){r=re.call(this,r)||this;return r.formulas=[{formulaName:"PERCENTILE",category:"Statistical",description:"Returns the k-th percentile of values in a range."},{formulaName:"PERCENTRANK",category:"Statistical",description:"Returns the percentage rank of a value in a data set."},{formulaName:"QUARTILE",category:"Statistical",description:"Returns the quartile of a data set."}],r}ne=function(r,t){return(ne=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}ne(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(m,ie=Bt),m.prototype.ComputeNORMDIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if(o<=0)return e[$.CommonErrors.Num];e=!0;if(4===r.length){var s=this.resolveNumberArg(r[3]);if("string"==typeof s)return s;e=0!==s}return(e?pr(n,i,o):(s=(n-i)/o,Math.exp(-.5*s*s)/(o*Math.sqrt(2*Math.PI)))).toString()},m.prototype.ComputeNORMSDIST=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveNumberArg(t[0]))?r:pr(r).toString()},m.prototype.ComputeNORMINV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(i=this.resolveNumberArg(r[0]),e=this.resolveNumberArg(r[1]),n=this.resolveNumberArg(r[2]),"string"==typeof i?i:"string"==typeof e?e:"string"==typeof n?n:(i=gr(i,e,n),isNaN(i)?o[$.CommonErrors.Num]:i.toString()))},m.prototype.ComputeNORMSINV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.resolveNumberArg(r[0]))?e:(e=gr(e),isNaN(e)?n[$.CommonErrors.Num]:e.toString())},m.prototype.ComputePOISSON=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;var o=Math.floor(n);if(o<0||i<0)return e[$.CommonErrors.Num];n=!0;if(3===r.length){e=this.resolveNumberArg(r[2]);if("string"==typeof e)return e;n=0!==e}if(!n)return(Math.exp(-i)*Math.pow(i,o)/l(o)).toString();for(var s=0,a=0;a<=o;a++)s+=Math.exp(-i)*Math.pow(i,a)/l(a);return s.toString()},m.prototype.ComputeBINOMDIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=Math.floor(n),a=Math.floor(i);if(s<0||a<0||a<s||o<0||1<o)return e[$.CommonErrors.Num];n=!0;if(4===r.length){i=this.resolveNumberArg(r[3]);if("string"==typeof i)return i;n=0!==i}e=f(a,s)*Math.pow(o,s)*Math.pow(1-o,a-s);if(!n)return e.toString();for(var l=0,u=0;u<=s;u++)l+=f(a,u)*Math.pow(o,u)*Math.pow(1-o,a-u);return l.toString()},m.prototype.ComputeEXPONDIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;if(n<0||i<=0)return e[$.CommonErrors.Num];e=!0;if(3===r.length){var o=this.resolveNumberArg(r[2]);if("string"==typeof o)return o;e=0!==o}return(e?1-Math.exp(-i*n):i*Math.exp(-i*n)).toString()},m.prototype.ComputeCONFIDENCE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(i=this.resolveNumberArg(r[0]),e=this.resolveNumberArg(r[1]),n=this.resolveNumberArg(r[2]),"string"==typeof i?i:"string"==typeof e?e:"string"==typeof n?n:i<=0||1<=i||e<=0||n<1||(i=gr(1-i/2),isNaN(i))?o[$.CommonErrors.Num]:(i*e/Math.sqrt(n)).toString())};var ne,ie,oe=m;function m(r){r=ie.call(this,r)||this;return r.formulas=[{formulaName:"NORMDIST",category:"Statistical",description:"Returns the normal cumulative distribution."},{formulaName:"NORMSDIST",category:"Statistical",description:"Returns the standard normal cumulative distribution."},{formulaName:"NORMINV",category:"Statistical",description:"Returns the inverse of the normal cumulative distribution."},{formulaName:"NORMSINV",category:"Statistical",description:"Returns the inverse of the standard normal cumulative distribution."},{formulaName:"POISSON",category:"Statistical",description:"Returns the Poisson distribution."},{formulaName:"BINOMDIST",category:"Statistical",description:"Returns the individual term binomial distribution probability."},{formulaName:"EXPONDIST",category:"Statistical",description:"Returns the exponential distribution."},{formulaName:"CONFIDENCE",category:"Statistical",description:"Returns the confidence interval for a population mean."}],r}se=function(r,t){return(se=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}se(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(ue,ae=t),ue.prototype.ComputeMAXIFS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.aggregateIfs(r,!0)},ue.prototype.ComputeMINIFS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.aggregateIfs(r,!1)},ue.prototype.aggregateIfs=function(r,t){var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||r.length%2==0)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var n=r[0],n=this.parent.getCellCollection(n),i=Array.isArray(n)?n:[n],o=[],s=1;s<r.length;s+=2)o.push([r[s],r[s+1]]);for(var a=[],l=0;l<o.length;l++){var u=this.parent.getCellCollection(o[l][0]),u=Array.isArray(u)?u:[u];if(u.length!==i.length)return e[$.CommonErrors.Value];a.push(u)}for(var h=null,p=!1,s=0;s<i.length;s++){for(var g=!0,l=0;l<o.length;l++){var f=this.parent.getValueFromArg(a[l][s]);if(!this.matchesCriteria(f,o[l][1])){g=!1;break}}if(g){var m=this.parent.getValueFromArg(i[s]);if(-1<e.indexOf(m))return m;""!==m&&this.parent.isNumber(m)&&(m=this.parent.parseFloat(m),p=!0,null===h||(t?h<m:m<h))&&(h=m)}}return p&&null!==h?h.toString():"0"},ue.prototype.matchesCriteria=function(r,t){var e=t.trim(),t=(e.startsWith(this.parent.tic)&&e.endsWith(this.parent.tic)?e=this.parent.removeTics(e):this.parent.isCellReference(e)?e=this.parent.getValueFromArg(e):(e=this.parent.getValueFromArg(e),this.parent.isCellReference(t)||(e=this.parent.removeTics(e))),"equal");return e.startsWith("<=")?(t="lessEq",e=e.substring(2)):e.startsWith(">=")?(t="greaterEq",e=e.substring(2)):e.startsWith("<>")?(t="notEq",e=e.substring(2)):e.startsWith("<")?(t="less",e=e.substring(1)):e.startsWith(">")?(t="greater",e=e.substring(1)):e.startsWith("=")&&(t="equal",e=e.substring(1)),(e=e.trim()).startsWith(this.parent.tic)&&(e=this.parent.removeTics(e)),this.parent.processLogical([r.toLowerCase(),e.toLowerCase()],t)===this.parent.trueValue};var se,ae,le=ue;function ue(r){r=ae.call(this,r)||this;return r.formulas=[{formulaName:"MAXIFS",category:"Statistical",description:"Returns the maximum value among cells specified by criteria."},{formulaName:"MINIFS",category:"Statistical",description:"Returns the minimum value among cells specified by criteria."}],r}he=function(r,t){return(he=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}he(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(c,pe=Bt),c.prototype.stdevVarA=function(r,t,e){var n=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var i=this.collectSample(r,!0);if("string"==typeof i)return i;if(i.length<(t?1:2))return n[$.CommonErrors.DivZero];for(var o=this.mean(i),s=0,a=0;a<i.length;a++){var l=i[a]-o;s+=l*l}r=s/(t?i.length:i.length-1);return(e?r:Math.sqrt(r)).toString()},c.prototype.ComputeSTDEVA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVarA(r,!1,!1)},c.prototype.ComputeSTDEVPA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVarA(r,!0,!1)},c.prototype.ComputeVARA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVarA(r,!1,!0)},c.prototype.ComputeVARPA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.stdevVarA(r,!0,!0)},c.prototype.ComputeTRIMMEAN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.resolveNumberArg(r[1]))?e:e<0||1<=e?i[$.CommonErrors.Num]:"string"==typeof(n=this.collectSample([r[0]],!1))?n:0===n.length||(n=n.slice().sort(function(r,t){return r-t}),e=Math.floor(n.length*e/2),0===(n=n.slice(e,n.length-e)).length)?i[$.CommonErrors.DivZero]:this.mean(n).toString()},c.prototype.ComputeFISHER=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.resolveNumberArg(r[0]))?e:e<=-1||1<=e?n[$.CommonErrors.Num]:(.5*Math.log((1+e)/(1-e))).toString()},c.prototype.ComputeFISHERINV=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveNumberArg(t[0]))?r:(((r=Math.exp(2*r))-1)/(r+1)).toString()},c.prototype.ComputeGAMMALN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.resolveNumberArg(r[0]))?e:!(e<=0)&&(e=mr(e),isFinite(e))?e.toString():n[$.CommonErrors.Num]},c.prototype.sumSquaresPair=function(r,t){var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];r=this.collectPair(r);if("string"==typeof r)return r;var n=r.x,i=r.y;if(0===n.length)return e[$.CommonErrors.DivZero];for(var o,s=0,a=0;a<n.length;a++)s+="x2my2"===t?n[a]*n[a]-i[a]*i[a]:"x2py2"===t?n[a]*n[a]+i[a]*i[a]:(o=n[a]-i[a])*o;return s.toString()},c.prototype.ComputeSUMX2MY2=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.sumSquaresPair(r,"x2my2")},c.prototype.ComputeSUMX2PY2=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.sumSquaresPair(r,"x2py2")},c.prototype.ComputeSUMXMY2=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.sumSquaresPair(r,"xmy2")};var he,pe,ge=c;function c(r){r=pe.call(this,r)||this;return r.formulas=[{formulaName:"STDEVA",category:"Statistical",description:"Estimates standard deviation based on a sample, including text and logicals."},{formulaName:"STDEVPA",category:"Statistical",description:"Calculates standard deviation based on the entire population, including text and logicals."},{formulaName:"VARA",category:"Statistical",description:"Estimates variance based on a sample, including text and logicals."},{formulaName:"VARPA",category:"Statistical",description:"Calculates variance based on the entire population, including text and logicals."},{formulaName:"TRIMMEAN",category:"Statistical",description:"Returns the mean of the interior of a data set."},{formulaName:"FISHER",category:"Statistical",description:"Returns the Fisher transformation."},{formulaName:"FISHERINV",category:"Statistical",description:"Returns the inverse of the Fisher transformation."},{formulaName:"GAMMALN",category:"Statistical",description:"Returns the natural logarithm of the gamma function."},{formulaName:"SUMX2MY2",category:"Statistical",description:"Returns the sum of the difference of squares of corresponding values in two arrays."},{formulaName:"SUMX2PY2",category:"Statistical",description:"Returns the sum of the sum of squares of corresponding values in two arrays."},{formulaName:"SUMXMY2",category:"Statistical",description:"Returns the sum of squares of differences of corresponding values in two arrays."}],r}fe=function(r,t){return(fe=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}fe(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(d,me=Bt),d.prototype.parseCumulative=function(r,t){return r.length<=t||("string"==typeof(r=this.resolveNumberArg(r[t]))?r:0!==r)},d.prototype.ComputeCRITBINOM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||3!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=Math.floor(n),a=i;if(s<0||a<0||1<a||o<0||1<o)return e[$.CommonErrors.Num];for(var l=0,u=0;u<=s;u++)if(o<=(l+=f(s,u)*Math.pow(a,u)*Math.pow(1-a,s-u)))return u.toString();return s.toString()},d.prototype.ComputeNEGBINOMDIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),e=this.resolveNumberArg(r[2]),"string"==typeof n?n:"string"==typeof i?i:"string"==typeof e?e:(n=Math.floor(n),i=Math.floor(i),n<0||i<1||e<=0||1<e?o[$.CommonErrors.Num]:(f(n+i-1,i-1)*Math.pow(e,i)*Math.pow(1-e,n)).toString()))},d.prototype.ComputeHYPGEOMDIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<4||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]),s=this.resolveNumberArg(r[3]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;var a=Math.floor(n),l=Math.floor(i),u=Math.floor(o),h=Math.floor(s);if(a<0||l<a||h<l||h<u)return e[$.CommonErrors.Num];n=this.parseCumulative(r,4);if("string"==typeof n)return n;i=f(u,a)*f(h-u,l-a)/f(h,l);if(!n)return i.toString();for(var p=0,g=0;g<=a;g++)p+=f(u,g)*f(h-u,l-g)/f(h,l);return p.toString()},d.prototype.ComputeWEIBULL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<3||4<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),"string"==typeof e?e:"string"==typeof n?n:"string"==typeof i?i:e<0||n<=0||i<=0?o[$.CommonErrors.Num]:"string"==typeof(o=this.parseCumulative(r,3))?o:(o?1-Math.exp(-Math.pow(e/i,n)):n/Math.pow(i,n)*Math.pow(e,n-1)*Math.exp(-Math.pow(e/i,n))).toString())},d.prototype.ComputeLOGNORMDIST=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z.isNullOrUndefined(n)||3!==n.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(n[0]),r=this.resolveNumberArg(n[1]),t=this.resolveNumberArg(n[2]),"string"==typeof e?e:"string"==typeof r?r:"string"==typeof t?t:(e=xr(e,r,t),isNaN(e)?this.parent.getErrorStrings()[$.CommonErrors.Num]:e.toString()))},d.prototype.ComputeLOGINV=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z.isNullOrUndefined(n)||3!==n.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(n[0]),r=this.resolveNumberArg(n[1]),t=this.resolveNumberArg(n[2]),"string"==typeof e?e:"string"==typeof r?r:"string"==typeof t?t:(e=Vr(e,r,t),isNaN(e)?this.parent.getErrorStrings()[$.CommonErrors.Num]:e.toString()))},d.prototype.ComputeGAMMADIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<3||4<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(i=this.resolveNumberArg(r[0]),e=this.resolveNumberArg(r[1]),n=this.resolveNumberArg(r[2]),"string"==typeof i?i:"string"==typeof e?e:"string"==typeof n?n:i<0||e<=0||n<=0?o[$.CommonErrors.Num]:"string"==typeof(o=this.parseCumulative(r,3))?o:(i=i/n,(o?dr(e,i):Math.pow(i,e-1)*Math.exp(-i)/(n*cr(e))).toString()))},d.prototype.ComputeGAMMAINV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||3!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if(n<=0||1<=n||i<=0||o<=0)return e[$.CommonErrors.Num];for(var s=0,a=i*o*20+1,l=0;l<100;l++){var u=(s+a)/2;dr(i,u/o)<n?s=u:a=u}return((s+a)/2).toString()},d.prototype.ComputeCHIDIST=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||2!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(e[0]),t=this.resolveNumberArg(e[1]),"string"==typeof r?r:"string"==typeof t?t:(1-Nr(r,t)).toString())},d.prototype.ComputeCHIINV=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||2!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(t=this.resolveNumberArg(e[0]),r=this.resolveNumberArg(e[1]),"string"==typeof t?t:"string"==typeof r?r:(t=vr(1-t,r),isNaN(t)?this.parent.getErrorStrings()[$.CommonErrors.Num]:t.toString()))},d.prototype.ComputeCHITEST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.chiSquareTest(r)},d.prototype.chiSquareTest=function(r){var t=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.collectSample([r[0]],!1),n=this.collectSample([r[1]],!1);if("string"==typeof e)return e;if("string"==typeof n)return n;if(e.length!==n.length||0===e.length)return t[$.CommonErrors.NA];for(var i=0,o=0;o<e.length;o++){if(0===n[o])return t[$.CommonErrors.DivZero];var s=e[o]-n[o];i+=s*s/n[o]}return(1-Nr(i,e.length-1)).toString()},d.prototype.ComputeFDIST=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z.isNullOrUndefined(n)||3!==n.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(n[0]),t=this.resolveNumberArg(n[1]),e=this.resolveNumberArg(n[2]),"string"==typeof r?r:"string"==typeof t?t:"string"==typeof e?e:(1-Er(r,t,e)).toString())},d.prototype.ComputeFINV=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z.isNullOrUndefined(n)||3!==n.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(n[0]),r=this.resolveNumberArg(n[1]),t=this.resolveNumberArg(n[2]),"string"==typeof e?e:"string"==typeof r?r:"string"==typeof t?t:(e=yr(1-e,r,t),isNaN(e)?this.parent.getErrorStrings()[$.CommonErrors.Num]:e.toString()))},d.prototype.ComputeZTEST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.collectSample([r[0]],!1);if("string"==typeof n)return n;if(n.length<2)return e[$.CommonErrors.DivZero];var i=this.resolveNumberArg(r[1]);if("string"==typeof i)return i;for(var o=this.mean(n),s=0,a=0;a<n.length;a++){var l=n[a]-o;s+=l*l}var u=Math.sqrt(s/(n.length-1));if(0===u)return e[$.CommonErrors.DivZero];e=u/Math.sqrt(n.length);if(3===r.length){u=this.resolveNumberArg(r[2]);if("string"==typeof u)return u;e=u/Math.sqrt(n.length)}return(1-pr((o-i)/e)).toString()},d.prototype.ComputePROB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.collectSample([r[0]],!1);if("string"==typeof n)return n;var i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof i)return i;if("string"==typeof o)return o;if(0===n.length)return e[$.CommonErrors.Num];for(var s=0,a=0,l=0;l<n.length;l++)s+=1,n[l]>=i&&n[l]<=o&&(a+=1);return(a/s).toString()};var fe,me,ce=d;function d(r){r=me.call(this,r)||this;return r.formulas=[{formulaName:"CRITBINOM",category:"Statistical",description:"Returns the smallest value for which the cumulative binomial distribution is less than or equal to a criterion value."},{formulaName:"NEGBINOMDIST",category:"Statistical",description:"Returns the negative binomial distribution."},{formulaName:"HYPGEOMDIST",category:"Statistical",description:"Returns the hypergeometric distribution."},{formulaName:"WEIBULL",category:"Statistical",description:"Returns the Weibull distribution."},{formulaName:"LOGNORMDIST",category:"Statistical",description:"Returns the cumulative log-normal distribution."},{formulaName:"LOGINV",category:"Statistical",description:"Returns the inverse of the log-normal cumulative distribution."},{formulaName:"GAMMADIST",category:"Statistical",description:"Returns the gamma distribution."},{formulaName:"GAMMAINV",category:"Statistical",description:"Returns the inverse of the gamma cumulative distribution."},{formulaName:"CHIDIST",category:"Statistical",description:"Returns the one-tailed probability of the chi-squared distribution."},{formulaName:"CHIINV",category:"Statistical",description:"Returns the inverse of the one-tailed probability of the chi-squared distribution."},{formulaName:"CHITEST",category:"Statistical",description:"Returns the test for independence."},{formulaName:"FDIST",category:"Statistical",description:"Returns the F probability distribution."},{formulaName:"FINV",category:"Statistical",description:"Returns the inverse of the F probability distribution."},{formulaName:"ZTEST",category:"Statistical",description:"Returns the one-tailed probability-value of a z-test."},{formulaName:"PROB",category:"Statistical",description:"Returns the probability that values in a range are between two limits."}],r}de=function(r,t){return(de=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}de(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(N,Ne=t),N.prototype.resolveComplex=function(r){var t=this.parent.getErrorStrings(),r=this.resolveTextArg(r);return-1<t.indexOf(r)?r:fr(r)||t[$.CommonErrors.Num]},N.prototype.ComputeCOMPLEX=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z.isNullOrUndefined(n)||n.length<2||3<n.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(n[0]),t=this.resolveNumberArg(n[1]),"string"==typeof r?r:"string"==typeof t?t:(e="i",3===n.length&&"i"!==(e=this.resolveTextArg(n[2]))&&"j"!==e?this.parent.getErrorStrings()[$.CommonErrors.Value]:s(r,t,e)))},N.prototype.ComputeIMABS=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(t[0]))?r:Math.sqrt(r.re*r.re+r.im*r.im).toString()},N.prototype.ComputeIMAGINARY=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(t[0]))?r:r.im.toString()},N.prototype.ComputeIMREAL=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(t[0]))?r:r.re.toString()},N.prototype.ComputeIMCONJUGATE=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(t[0]))?r:s(r.re,-r.im)},N.prototype.ComputeIMSUM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.complexReduce(r,function(r,t){return{re:r.re+t.re,im:r.im+t.im}})},N.prototype.ComputeIMSUB=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||2!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveComplex(e[0]),t=this.resolveComplex(e[1]),"string"==typeof r?r:"string"==typeof t?t:s(r.re-t.re,r.im-t.im))},N.prototype.ComputeIMPRODUCT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.complexReduce(r,function(r,t){return{re:r.re*t.re-r.im*t.im,im:r.re*t.im+r.im*t.re}},{re:1,im:0})},N.prototype.ComputeIMDIV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveComplex(r[0]),n=this.resolveComplex(r[1]),"string"==typeof e?e:"string"==typeof n?n:0==(i=n.re*n.re+n.im*n.im)?o[$.CommonErrors.DivZero]:s((e.re*n.re+e.im*n.im)/i,(e.im*n.re-e.re*n.im)/i))},N.prototype.complexReduce=function(r,t,e){if(z.isNullOrUndefined(r)||r.length<1)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=void 0!==e?e:this.resolveComplex(r[0]);if("string"==typeof n)return n;for(var i=e?0:1;i<r.length;i++){var o=this.resolveComplex(r[i]);if("string"==typeof o)return o;n=t(n,o)}return s(n.re,n.im)},N.prototype.ComputeIMEXP=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(e[0]))?r:s((t=Math.exp(r.re))*Math.cos(r.im),t*Math.sin(r.im))},N.prototype.ComputeIMLN=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(e[0]))?r:0===(t=Math.sqrt(r.re*r.re+r.im*r.im))?this.parent.getErrorStrings()[$.CommonErrors.Num]:s(Math.log(t),Math.atan2(r.im,r.re))},N.prototype.ComputeIMLOG10=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.ComputeIMLN.apply(this,r);return!("string"==typeof i&&-1<this.parent.getErrorStrings().indexOf(i))&&(e=fr(i.toString()))?(n=1/Math.LN10,s(e.re*n,e.im*n)):i},N.prototype.ComputeIMLOG2=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.ComputeIMLN.apply(this,r);return!("string"==typeof i&&-1<this.parent.getErrorStrings().indexOf(i))&&(e=fr(i.toString()))?(n=1/Math.LN2,s(e.re*n,e.im*n)):i},N.prototype.ComputeIMSQRT=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(e[0]))?r:(t=Math.sqrt(r.re*r.re+r.im*r.im),r=Math.atan2(r.im,r.re),s((t=Math.sqrt(t))*Math.cos(r/2),t*Math.sin(r/2)))},N.prototype.ComputeIMPOWER=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(i=this.resolveComplex(r[0]),e=this.resolveNumberArg(r[1]),"string"==typeof i?i:"string"==typeof e?e:(e=Math.floor(e),0===(n=Math.sqrt(i.re*i.re+i.im*i.im))&&e<=0?o[$.CommonErrors.Num]:(o=e*Math.atan2(i.im,i.re),s((i=Math.pow(n,e))*Math.cos(o),i*Math.sin(o)))))},N.prototype.ComputeIMARGUMENT=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(t[0]))?r:0===r.re&&0===r.im?this.parent.getErrorStrings()[$.CommonErrors.DivZero]:Math.atan2(r.im,r.re).toString()},N.prototype.ComputeIMSIN=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(t[0]))?r:s(Math.sin(r.re)*Math.cosh(r.im),Math.cos(r.re)*Math.sinh(r.im))},N.prototype.ComputeIMCOS=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.resolveComplex(t[0]))?r:s(Math.cos(r.re)*Math.cosh(r.im),-Math.sin(r.re)*Math.sinh(r.im))};var de,Ne,ve=N;function N(r){r=Ne.call(this,r)||this;return r.formulas=[{formulaName:"COMPLEX",category:"Engineering",description:"Converts real and imaginary coefficients into a complex number."},{formulaName:"IMABS",category:"Engineering",description:"Returns the absolute value (modulus) of a complex number."},{formulaName:"IMAGINARY",category:"Engineering",description:"Returns the imaginary coefficient of a complex number."},{formulaName:"IMREAL",category:"Engineering",description:"Returns the real coefficient of a complex number."},{formulaName:"IMCONJUGATE",category:"Engineering",description:"Returns the complex conjugate of a complex number."},{formulaName:"IMSUM",category:"Engineering",description:"Returns the sum of complex numbers."},{formulaName:"IMSUB",category:"Engineering",description:"Returns the difference between two complex numbers."},{formulaName:"IMPRODUCT",category:"Engineering",description:"Returns the product of complex numbers."},{formulaName:"IMDIV",category:"Engineering",description:"Returns the quotient of two complex numbers."},{formulaName:"IMSIN",category:"Engineering",description:"Returns the sine of a complex number."},{formulaName:"IMCOS",category:"Engineering",description:"Returns the cosine of a complex number."},{formulaName:"IMEXP",category:"Engineering",description:"Returns the exponential of a complex number."},{formulaName:"IMLN",category:"Engineering",description:"Returns the natural logarithm of a complex number."},{formulaName:"IMSQRT",category:"Engineering",description:"Returns the square root of a complex number."},{formulaName:"IMPOWER",category:"Engineering",description:"Returns a complex number raised to an integer power."},{formulaName:"IMARGUMENT",category:"Engineering",description:"Returns the argument theta of a complex number in radians."},{formulaName:"IMLOG10",category:"Engineering",description:"Returns the base-10 logarithm of a complex number."},{formulaName:"IMLOG2",category:"Engineering",description:"Returns the base-2 logarithm of a complex number."}],r}Ee=function(r,t){return(Ee=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Ee(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(v,Se=t),v.prototype.ComputeDATE=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(t.length&&"nestedFormulaTrue"===t[t.length-1]&&(r=!0,t.pop()),z.isNullOrUndefined(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(3!==t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var n=[],i=0;i<t.length;++i)n[i]=this.parent.getValueFromArg(t[i]);n[0]=n[0]===this.parent.trueValue?"1":n[0]===this.parent.falseValue?"0":n[0],n[1]=n[1]===this.parent.trueValue?"1":n[1]===this.parent.falseValue?"0":n[1],n[2]=n[2]===this.parent.trueValue?"1":n[2]===this.parent.falseValue?"0":n[2];for(var o=0;o<n.length;o++){var s=n[o];if(-1<this.parent.getErrorStrings().indexOf(s))return s;if('""'===s||'"0"'===s&&'"0"'!==t[o]||'"TRUE"'===s||'"FALSE"'===s)return this.parent.getErrorStrings()[$.CommonErrors.Value].toString()}var a=Math.floor(this.parent.parseFloat(n[0].split(this.parent.tic).join(""))),l=Math.floor(this.parent.parseFloat(n[1].split(this.parent.tic).join(""))),u=Math.floor(this.parent.parseFloat(n[2].split(this.parent.tic).join(""))),h=0;if(isNaN(a)||isNaN(l)||isNaN(u))return this.parent.getErrorStrings()[$.CommonErrors.Value].toString();if(a<0&&l<=12||1e4<=a&&0<l)return this.parent.getErrorStrings()[$.CommonErrors.Num].toString();for(;12<l;)l-=12,a++;if(0===(h=this.parent.getSerialDateFromDate(a,l,u)))return this.parent.getErrorStrings()[$.CommonErrors.Num].toString();u=this.parent.fromOADate(h);if("Invalid Date"!==u.toString()){if(u.getFullYear()<1900||1e4<=u.getFullYear())return this.parent.getErrorStrings()[$.CommonErrors.Num].toString();if(!r)return new z.Internationalization(this.parent.parentObject.locale||"en-US").formatDate(u,{type:"date",skeleton:"yMd"})}return h.toString()},v.prototype.ComputeDAY=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=this.parent.getErrorStrings();if(z.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1<e.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(e[0].startsWith(this.parent.tic)){if(""===(t=e[0].split(this.parent.tic).join(""))||t===this.parent.trueValue||t===this.parent.falseValue)return i[$.CommonErrors.Value]}else if(t=this.parent.getValueFromArg(e[0].split(this.parent.tic).join("")),this.parent.isCellReference(e[0])&&-1<t.indexOf(this.parent.tic))return i[$.CommonErrors.Value];return-1<i.indexOf(t)?t:Number(t)<0?i[$.CommonErrors.Num]:0===Math.floor(Number(t))||t===this.parent.falseValue?0:t===this.parent.trueValue?1:(r=this.parent.isNaN(Number(t))?this.parent.parseDate(t):this.parent.intToDate(t),"NaN"===(r="[object Date]"===Object.prototype.toString.call(r)?new Date(r).getFullYear()<1900||9999<new Date(r).getFullYear()?this.parent.isNumber(t)?"Num":"NaN":r.getDate():r).toString()?i[$.CommonErrors.Value]:"Num"===r.toString()?i[$.CommonErrors.Num]:r)},v.prototype.ComputeTODAY=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1!==e.length||""!==e[0]?r=this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:(t=new Date(Date.now()),"spreadsheet"===this.parent.parentObject.getModuleName()?(r=L(t).toString(),0===this.parent.parser.storedStringText.toUpperCase().indexOf("TODAY")&&""!==this.parent.cell&&this.parent.parentObject.setDateFormat(this.parent.getSheetId(this.parent.grid),this.parent.rowIndex(this.parent.cell)-1,this.parent.colIndex(this.parent.cell)-1)):r=t.getFullYear()+"/"+this.parent.calculateDate((t.getMonth()+1).toString())+"/"+this.parent.calculateDate(t.getDate().toString())),r},v.prototype.ComputeDAYS=function(){for(var e=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)&&1===r.length&&""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(i=(n=function(r){var t=e.parent.getValueFromArg(r).trim();if(-1<t.indexOf(e.parent.tic)&&(""===(t=t.split(e.parent.tic).join("").trim())||e.parent.isCellReference(r)||t.toUpperCase()===e.parent.trueValue||t.toUpperCase()===e.parent.falseValue))return o[$.CommonErrors.Value];if((t=t.split(e.parent.tic).join("")).toUpperCase()===e.parent.trueValue)t="1";else if(""===t||t.toUpperCase()===e.parent.falseValue)t="0";else if(Number(t)<0)return o[$.CommonErrors.Num];r=e.parent.hostParseDate(t.toString());return t=r.isDate||r.isTime?(e.parent.parseDate(t).getTime()/864e5).toString():t})(r[0]),-1<o.indexOf(i)?i:(n=n(r[1]),-1<o.indexOf(n)?n:(i=Math.floor(Number(i))-Math.floor(Number(n)),isNaN(i)?o[$.CommonErrors.Value]:i)))},v.prototype.ComputeWEEKDAY=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(""===n[0]&&z.isNullOrUndefined(n[1])||2<n.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===n[0]&&""===n[1]||""===n[1])return this.parent.getErrorStrings()[$.CommonErrors.Num].toString();if(1===n.length&&n.push("1"),-1<n[0].indexOf(this.parent.tic)&&""===n[0].split(this.parent.tic).join("").trim()||""===n[1].split(this.parent.tic).join("").trim()||-1<n[1].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(n[0])){if(-1<(r=this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else r=-1<n[0].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n[0].split(this.parent.tic).join("")))?this.parent.getValueFromArg(n[0]):this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))||"0";if(t=this.parent.isCellReference(n[1])?this.parent.getValueFromArg(n[1].split(this.parent.tic).join(""))||"0":this.parent.getValueFromArg(n[1].split(this.parent.tic).join("")),-1<this.parent.getErrorStrings().indexOf(r))return r;if(-1<this.parent.getErrorStrings().indexOf(t))return t;if(r=r===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r,t=t===this.parent.trueValue?"1":t===this.parent.falseValue?"0":t,e=this.parent.parseFloat(r),t=this.parent.parseFloat(t),isNaN(t)||isNaN(e))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(e<0||2958465<e)return this.parent.getErrorStrings()[$.CommonErrors.Num].toString();switch(t=parseInt(t.toString(),10),e=e<1?0:Math.floor(e)%7,t){case 1:case 17:e=e<=0?e+7:e;break;case 2:case 11:e=(e-=1)<=0?e+7:e;break;case 3:e=(e-=2)<0?e+7:e;break;case 12:e=7<(e+=5)?e-7:e;break;case 13:e=7<(e+=4)?e-7:e;break;case 14:e=7<(e+=3)?e-7:e;break;case 15:e=7<(e+=2)?e-7:e;break;case 16:e=7<(e+=1)?e-7:e;break;default:e=this.parent.getErrorStrings()[$.CommonErrors.Num].toString()}return e},v.prototype.ComputeTIME=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(z.isNullOrUndefined(n)||3!==n.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(-1<n[0].indexOf(this.parent.tic)&&""===n[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[$.CommonErrors.Value];if(-1<n[1].indexOf(this.parent.tic)&&""===n[1].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[$.CommonErrors.Value];if(-1<n[2].indexOf(this.parent.tic)&&""===n[2].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(n[0])){if(-1<(e=this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if(-1<n[0].indexOf(this.parent.tic)&&(n[0].split(this.parent.tic).join("")===this.parent.trueValue||n[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];e=this.parent.getValueFromArg(n[0]).split(this.parent.tic).join("")||"0"}if(-1<this.parent.getErrorStrings().indexOf(e))return e;if(isNaN(this.parent.parseFloat(e))&&e!==this.parent.trueValue&&e!==this.parent.falseValue)return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(n[1])){if(-1<(r=this.parent.getValueFromArg(n[1].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if(-1<n[1].indexOf(this.parent.tic)&&(n[1].split(this.parent.tic).join("")===this.parent.trueValue||n[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];r=this.parent.getValueFromArg(n[1]).split(this.parent.tic).join("")||"0"}if(-1<this.parent.getErrorStrings().indexOf(r))return r;if(isNaN(this.parent.parseFloat(r))&&r!==this.parent.trueValue&&r!==this.parent.falseValue)return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(n[2])){if(-1<(t=this.parent.getValueFromArg(n[2].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if(-1<n[2].indexOf(this.parent.tic)&&(n[2].split(this.parent.tic).join("")===this.parent.trueValue||n[2].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];t=this.parent.getValueFromArg(n[2]).split(this.parent.tic).join("")||"0"}return-1<this.parent.getErrorStrings().indexOf(t)?t:isNaN(this.parent.parseFloat(t))&&t!==this.parent.trueValue&&t!==this.parent.falseValue||(e=e===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e,r=r===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r,t=t===this.parent.trueValue?"1":t===this.parent.falseValue?"0":t,e=parseInt(this.parent.parseFloat(e).toString(),10),r=parseInt(this.parent.parseFloat(r).toString(),10),t=parseInt(this.parent.parseFloat(t).toString(),10),isNaN(e))||isNaN(r)||isNaN(t)?this.parent.getErrorStrings()[$.CommonErrors.Value]:32767<e||32767<r||32767<t||(e=new Date(1900,0,1,e,r,t)).getFullYear()<1900?this.parent.getErrorStrings()[$.CommonErrors.Num]:(t=(r=(r=e.getHours())<10?"0"+r:r)+":"+(t=(t=e.getMinutes())<10?"0"+t:t)+":"+(r=(r=e.getSeconds())<10?"0"+r:r),(e=this.parent.hostParseDate(t.toString())).isTime?e.value:t)},v.prototype.ComputeEDATE=function(){for(var r,t,e,n,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(2!==i.length||z.isNullOrUndefined(i))return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===i[0]||""===i[1])return this.parent.getErrorStrings()[$.CommonErrors.NA];if(""===i[0].split(this.parent.tic).join("")||""===i[1].split(this.parent.tic).join("")||-1<i[1].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(i[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(i[0])){if(-1<i[0].indexOf(":"))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(-1<(r=this.parent.getValueFromArg(i[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(-1<this.parent.getErrorStrings().indexOf(r.toString()))return r.toString()}else r=this.parent.getValueFromArg(i[0].split(this.parent.tic).join(""));if(this.parent.isCellReference(i[1])){if(-1<i[1].indexOf(":"))return this.parent.getErrorStrings()[$.CommonErrors.Value];n=this.parent.getValueFromArg(i[1].split(this.parent.tic).join(""))||"0"}else n=this.parent.getValueFromArg(i[1].split(this.parent.tic).join(""));if(-1<this.parent.getErrorStrings().indexOf(n))return n;if(n=parseInt(n,10),this.parent.isNumber(r)){if((r=parseInt(r,10))<0||2958465<r)return this.parent.getErrorStrings()[$.CommonErrors.Num];t=this.parent.fromOADate(r)}else t=this.parent.checkDateFormat(r);return isNaN(n)||z.isNullOrUndefined(this.parent.isDate(t))||9999<t.getFullYear()?this.parent.getErrorStrings()[$.CommonErrors.Value]:(e=t.getDate(),t.setMonth(t.getMonth()+n),e!==t.getDate()&&t.setDate(0),n=L(t),"0"===r.toString()&&--n,n<0||2958465<n?this.parent.getErrorStrings()[$.CommonErrors.Num]:n.toString())},v.prototype.ComputeEOMONTH=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(2!==n.length||z.isNullOrUndefined(n))return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===n[0]||""===n[1])return this.parent.getErrorStrings()[$.CommonErrors.NA];if(""===n[0].split(this.parent.tic).join("")||""===n[1].split(this.parent.tic).join("")||-1<n[1].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(n[0])){if(-1<n[0].indexOf(":"))return this.parent.getErrorStrings()[$.CommonErrors.Value];if(-1<(e=this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else e=this.parent.getValueFromArg(n[0]).split(this.parent.tic).join("");if(-1<this.parent.getErrorStrings().indexOf(e))return e;if(this.parent.isCellReference(n[1])){if(-1<n[1].indexOf(":"))return this.parent.getErrorStrings()[$.CommonErrors.Value];r=this.parent.getValueFromArg(n[1].split(this.parent.tic).join(""))||"0"}else r=this.parent.getValueFromArg(n[1].split(this.parent.tic).join(""));if(-1<this.parent.getErrorStrings().indexOf(r))return r;if(r=parseInt(r,10),this.parent.isNumber(e)){if((e=parseInt(e,10))<0||2958465<e)return this.parent.getErrorStrings()[$.CommonErrors.Num];t=this.parent.fromOADate(e)}else t=this.parent.checkDateFormat(e);return isNaN(r)||z.isNullOrUndefined(this.parent.isDate(t))||9999<t.getFullYear()?this.parent.getErrorStrings()[$.CommonErrors.Value]:(e=L(t=new Date(t.getFullYear(),t.getMonth()+(r+1),0)))<0||2958465<e||t.getFullYear()<1900?this.parent.getErrorStrings()[$.CommonErrors.Num]:e.toString()},v.prototype.ComputeDATEVALUE=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this.parent.getErrorStrings();if(""===t[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(r=i=this.parent.getValueFromArg(t[0])||"0",-1<n.indexOf(r))return r;if(this.parent.isCellReference(t[0])){if(-1<t[0].indexOf(":")||r.startsWith(this.parent.tic))return n[$.CommonErrors.Value]}else r=t[0].split(this.parent.tic).join("")||"0";if(this.parent.isNumber(r)||z.isNullOrUndefined(this.parent.isDate(r))){if(this.parent.isNumber(i)||!this.parent.isDate(i))return n[$.CommonErrors.Value];r=i}var i=this.parent.parseDate(r);return-1<n.indexOf(r)?r:z.isNullOrUndefined(i)||"Invalid Date"===i.toString()||i.getFullYear()<1900||9999<i.getFullYear()?this.parent.getErrorStrings()[$.CommonErrors.Value]:(r=this.parent.toOADate(i).toString(),parseFloat(r).toFixed(0).toString())},v.prototype.ComputeHOUR=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(1!==e.length||z.isNullOrUndefined(e)||""===e[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===e[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(e[0])){if(-1<(r=this.parent.getValueFromArg(e[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if(-1<e[0].indexOf(this.parent.tic)&&(e[0].split(this.parent.tic).join("")===this.parent.trueValue||e[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];r=this.parent.getValueFromArg(e[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(r))return r;if(r=r===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r,this.parent.isNumber(r)){if(this.parent.parseFloat(r)<0||2958465<this.parent.parseFloat(r))return this.parent.getErrorStrings()[$.CommonErrors.Num];t=this.parent.intToTime(r)}else{var i=this.parent.hostParseDate(r.toString());if(!i.isDate&&!i.isTime)return this.parent.getErrorStrings()[$.CommonErrors.Value];t=i.dateObj}return"Invalid Date"===(t="Invalid Date"===t.toString()?new Date(Date.parse(r)):t).toString()&&(i=new Date(Date.now()).toLocaleDateString()+" "+r,t=new Date(Date.parse(i))),"Invalid Date"===(t="Invalid Date"===t.toString()?this.parent.fromOADate(this.parent.parseFloat(r)):t).toString()||t.getFullYear()<1900||9999<t.getFullYear()?this.parent.getErrorStrings()[$.CommonErrors.Value]:t.getHours()},v.prototype.ComputeMINUTE=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(1!==e.length||z.isNullOrUndefined(e)||""===e[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===e[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(e[0])){if(-1<(r=this.parent.getValueFromArg(e[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if(-1<e[0].indexOf(this.parent.tic)&&(e[0].split(this.parent.tic).join("")===this.parent.trueValue||e[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];r=this.parent.getValueFromArg(e[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(r))return r;if(r=r===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r,this.parent.isNumber(r)){if(this.parent.parseFloat(r)<0||2958465<this.parent.parseFloat(r))return this.parent.getErrorStrings()[$.CommonErrors.Num];t=this.parent.intToTime(r)}else{var i=this.parent.hostParseDate(r.toString());if(!i.isDate&&!i.isTime)return this.parent.getErrorStrings()[$.CommonErrors.Value];t=i.dateObj}return"Invalid Date"===(t="Invalid Date"===t.toString()?new Date(Date.parse(r)):t).toString()&&(i=new Date(Date.now()).toLocaleDateString()+" "+r,t=new Date(Date.parse(i))),"Invalid Date"===(t="Invalid Date"===t.toString()?this.parent.fromOADate(this.parent.parseFloat(r)):t).toString()||t.getFullYear()<1900||9999<t.getFullYear()?this.parent.getErrorStrings()[$.CommonErrors.Value]:t.getMinutes()},v.prototype.ComputeSECOND=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(1!==e.length||z.isNullOrUndefined(e)||""===e[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(""===e[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[$.CommonErrors.Value];if(this.parent.isCellReference(e[0])){if(-1<(r=this.parent.getValueFromArg(e[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else{if(-1<e[0].indexOf(this.parent.tic)&&(e[0].split(this.parent.tic).join("")===this.parent.trueValue||e[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[$.CommonErrors.Value];r=this.parent.getValueFromArg(e[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(r))return r;if(r=r===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r,this.parent.isNumber(r)){if(this.parent.parseFloat(r)<0||2958465<this.parent.parseFloat(r))return this.parent.getErrorStrings()[$.CommonErrors.Num];t=this.parent.intToTime(r)}else{var i=this.parent.hostParseDate(r.toString());if(!i.isDate&&!i.isTime)return this.parent.getErrorStrings()[$.CommonErrors.Value];t=i.dateObj}return"Invalid Date"===(t="Invalid Date"===t.toString()?new Date(Date.parse(r)):t).toString()&&(i=new Date(Date.now()).toLocaleDateString()+" "+r,t=new Date(Date.parse(i))),"Invalid Date"===(t="Invalid Date"===t.toString()?this.parent.fromOADate(this.parent.parseFloat(r)):t).toString()||t.getFullYear()<1900||9999<t.getFullYear()?this.parent.getErrorStrings()[$.CommonErrors.Value]:t.getSeconds()},v.prototype.ComputeNOW=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return 1!==r.length||""!==r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:L(new Date(Date.now()),!0).toString()},v.prototype.ComputeMONTH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.parent.getValueFromArg(r[0]).trim();if(-1<e.indexOf(n))return n;if(this.parent.isCellReference(r[0])){if(-1<n.indexOf(this.parent.tic))return e[$.CommonErrors.Value];if(""===n)return 1}else{if('"TRUE"'===n.toUpperCase()||'"FALSE"'===n.toUpperCase())return e[$.CommonErrors.Value];n=n.split(this.parent.tic).join("")}if(""===n)return e[$.CommonErrors.Value];if(n===this.parent.trueValue||n===this.parent.falseValue||-1<Number(n)&&Number(n)<32)return 1;if(Number(n)<0)return e[$.CommonErrors.Num];-1<n.indexOf("%")&&(n=(.01*Number(n.split("%")[0])).toString()),this.parent.isNumber(n)&&(n=parseInt(Math.floor(Number(n)).toString(),10));var i=this.parent.parseDate(n);return"Invalid Date"===i.toString()?this.parent.isNumber(n)?e[$.CommonErrors.Num]:e[$.CommonErrors.Value]:i.getFullYear()<1900||1e4<=i.getFullYear()?e[$.CommonErrors.Num]:(i.getMonth()+1).toString()};var Ee,Se,ye=v;function v(r){r=Se.call(this,r)||this;return r.formulas=[{formulaName:"DATE",category:"Date",description:"Returns the date, given the year, month and day of the month."},{formulaName:"DAY",category:"Date",description:"Returns the day of a given date."},{formulaName:"TODAY",category:"Date",description:"Returns the current date as date value."},{formulaName:"DAYS",category:"Date",description:"Returns the number of days between two dates."},{formulaName:"WEEKDAY",category:"Date",description:"Returns the day of the week corresponding to a date."},{formulaName:"TIME",category:"Date & Time",description:"Converts hours, minutes, seconds to the time formatted text."},{formulaName:"EDATE",category:"Date & Time",description:"Returns a date with given number of months before or after the specified date."},{formulaName:"EOMONTH",category:"Date & Time",description:"Returns the last day of the month that is a specified number of months before or after an initially supplied start date."},{formulaName:"DATEVALUE",category:"Date & Time",description:"Converts a date string into date value."},{formulaName:"HOUR",category:"Date & Time",description:"Returns the number of hours in a specified time string."},{formulaName:"MINUTE",category:"Date & Time",description:"Returns the number of minutes in a specified time string."},{formulaName:"SECOND",category:"Date & Time",description:"Returns the number of seconds in a specified time string."},{formulaName:"NOW",category:"Date & Time",description:"Returns the current date and time."},{formulaName:"MONTH",category:"Date & Time",description:"Returns the number of months in a specified date string."}],r}Ce=function(r,t){return(Ce=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Ce(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(E,be=t),E.prototype.toSerial=function(r){var t=this.parent.getErrorStrings(),e=this.parent.getValueFromArg(r);return-1<t.indexOf(e)?e:""===(e=this.parent.isCellReference(r)?e:this.parent.removeTics(e))?t[$.CommonErrors.Value]:this.parent.isNumber(e)?this.parent.parseFloat(e):(r=this.parent.isDate(new Date(e)))?this.parent.toOADate(r):t[$.CommonErrors.Value]},E.prototype.ComputeYEAR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(e=this.toSerial(r[0]))?e:e<0?n[$.CommonErrors.Num]:this.parent.fromOADate(e).getFullYear().toString()},E.prototype.ComputeWEEKNUM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.toSerial(r[0]);if("string"==typeof n)return n;var i=1;if(2===r.length&&""!==r[1]){var o=this.resolveNumberArg(r[1]);if("string"==typeof o)return o;i=Math.floor(o)}var o=this.parent.fromOADate(n),n=new Date(o.getFullYear(),0,1),s=0,i=(2!==i&&11!==i||(s=1),(n.getDay()+7-s)%7),s=Math.floor((o.getTime()-n.getTime())/864e5),o=Math.floor((s+i)/7)+1;return o<1?e[$.CommonErrors.Num]:o.toString()},E.prototype.ComputeTIMEVALUE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s,a=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveTextArg(r[0]),-1<a.indexOf(e)?e:(s=e.trim().match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?\s*(AM|PM)?$/i))?(n=parseInt(s[1],10),i=parseInt(s[2],10),o=s[3]?parseInt(s[3],10):0,"PM"===(s=s[4]?s[4].toUpperCase():"")&&n<12&&(n+=12),23<(n="AM"===s&&12===n?0:n)||59<i||59<o?a[$.CommonErrors.Value]:((3600*n+60*i+o)/86400).toString()):(s=this.parent.isDate(new Date(e)))?((n=this.parent.toOADate(s,!0))-Math.floor(n)).toString():a[$.CommonErrors.Value])},E.prototype.ComputeDAYS360=function(){for(var r,t,e,n,i,o,s,a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];return z.isNullOrUndefined(a)||a.length<2||3<a.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(s=this.toSerial(a[0]),t=this.toSerial(a[1]),"string"==typeof s?s:"string"==typeof t?t:(r=!1,3===a.length&&""!==a[2]&&(r=(n=this.parent.getValueFromArg(a[2]).toUpperCase())===this.parent.trueValue||0!==this.parent.parseFloat(n)),n=this.parent.fromOADate(s),s=this.parent.fromOADate(t),t=n.getFullYear(),e=n.getMonth()+1,n=n.getDate(),i=s.getFullYear(),o=s.getMonth()+1,s=s.getDate(),r?(31===n&&(n=30),31===s&&(s=30)):(31===n&&(n=30),31===s&&30===n&&(s=30)),(360*(i-t)+30*(o-e)+(s-n)).toString()))},E.prototype.ComputeYEARFRAC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.toSerial(r[0]),n=this.toSerial(r[1]);if("string"==typeof e)return e;if("string"==typeof n)return n;var i=0;if(3===r.length&&""!==r[2]){var o=this.resolveNumberArg(r[2]);if("string"==typeof o)return o;i=Math.floor(o)}var s=Math.abs(n-e);switch(i){case 0:return(Math.abs(this.parent.parseFloat(this.ComputeDAYS360(r[0],r[1],"FALSE")))/360).toString();case 1:return(s/365.25).toString();case 2:return(s/360).toString();case 3:return(s/365).toString();case 4:return(Math.abs(this.parent.parseFloat(this.ComputeDAYS360(r[0],r[1],"TRUE")))/360).toString();default:return this.parent.getErrorStrings()[$.CommonErrors.Num]}},E.prototype.isWeekend=function(r){r=r.getDay();return 0===r||6===r},E.prototype.holidaySet=function(r){var t=new Set;if(r&&""!==r){var e=this.parent.getErrorStrings();if(this.parent.isCellReference(r)&&-1<r.indexOf(":"))for(var n,i=this.parent.getCellCollection(r),o=Array.isArray(i)?i:[i],s=0;s<o.length;s++)if("string"==typeof(n=this.toSerial(o[s]))){if(-1<e.indexOf(n))return n}else t.add(Math.floor(n));else{if("string"==typeof(n=this.toSerial(r)))return n;t.add(Math.floor(n))}}return t},E.prototype.ComputeNETWORKDAYS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.toSerial(r[0]),n=this.toSerial(r[1]);if("string"==typeof e)return e;if("string"==typeof n)return n;var i=this.holidaySet(r[2]);if(!(i instanceof Set))return i;for(var o=e<=n?1:-1,s=0,a=Math.floor(e);0<o?a<=Math.floor(n):a>=Math.floor(n);a+=o){var l=this.parent.fromOADate(a);this.isWeekend(l)||i.has(a)||(s+=o)}return s.toString()},E.prototype.ComputeWORKDAY=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.toSerial(r[0]),i=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;var i=Math.trunc(i),o=this.holidaySet(r[2]);if(!(o instanceof Set))return o;for(var s=Math.floor(n),a=0<=i?1:-1,l=Math.abs(i);0<l;){s+=a;var u=this.parent.fromOADate(s);if(this.isWeekend(u)||o.has(s)||l--,s<0)return e[$.CommonErrors.Num]}return s.toString()};var Ce,be,Ae=E;function E(r){r=be.call(this,r)||this;return r.formulas=[{formulaName:"YEAR",category:"Date & Time",description:"Converts a serial number to a year."},{formulaName:"WEEKNUM",category:"Date & Time",description:"Converts a serial number to a number representing where the week falls numerically within a year."},{formulaName:"TIMEVALUE",category:"Date & Time",description:"Converts a time in the form of text to a serial number."},{formulaName:"DAYS360",category:"Date & Time",description:"Calculates the number of days between two dates based on a 360-day year."},{formulaName:"YEARFRAC",category:"Date & Time",description:"Returns the year fraction representing the number of whole days between start_date and end_date."},{formulaName:"NETWORKDAYS",category:"Date & Time",description:"Returns the number of whole workdays between two dates."},{formulaName:"WORKDAY",category:"Date & Time",description:"Returns the serial number of the date before or after a specified number of workdays."}],r}Oe=function(r,t){return(Oe=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Oe(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Ve,Fe=t),Ve.prototype.ComputeIF=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(t.length&&"nestedFormulaTrue"===t[t.length-1]&&(r=!0,t.pop()),z.isNullOrUndefined(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(-1<this.parent.getErrorStrings().indexOf(t[0]))return t[0];var n,i,o=t;if(4===o.length&&"nestedFormulaTrue"===o[3]&&(n=!0,o.pop()),3<o.length||1===o.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(o.length<=3){var s=void 0,a=void 0,l="",u=this.parent.getValueFromArg(o[0]);if(-1<this.parent.getErrorStrings().indexOf(u))return u;var h=u.toUpperCase(),u=this.parent.parseFloat(u);if(h===this.parent.trueValue||u<0||0<u){if(r&&o[1].includes(":")&&this.parent.isCellReference(o[1])){for(var s=this.parent.getCellCollection(o[1]),p=0;p<s.length;p++)a=this.parent.getValueFromArg(s[p]),isNaN(this.parent.parseFloat(a))||(l+=a+",");return l.slice(0,l.length-1)}i=""===o[1]?"0":this.parent.getValueFromArg(o[1],void 0,void 0,void 0,!0)}else{if(h!==this.parent.falseValue&&0!==u)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Requires3Args];if(z.isNullOrUndefined(o[2]))return this.parent.falseValue;if(r&&o[2].includes(":")&&this.parent.isCellReference(o[2])){s=this.parent.getCellCollection(o[2]);for(p=0;p<s.length;p++)a=this.parent.getValueFromArg(s[p]),isNaN(this.parent.parseFloat(a))||(l+=a+",");return l.slice(0,l.length-1)}i=""===o[2]?"0":this.parent.getValueFromArg(o[2],void 0,void 0,void 0,!0)}}h=i.indexOf(this.parent.tic);return!n&&-1<h?i.split(this.parent.tic).join(""):!n||Q(i)||-1!==h||i===this.parent.trueValue||i===this.parent.falseValue||this.parent.isCellReference(i)?""===i?"0":i:'"'+i+'"'},Ve.prototype.ComputeAND=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;return z.isNullOrUndefined(r)||1===e.length&&""===e[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:this.parent.computeAndOrNot(e,"and")},Ve.prototype.ComputeOR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;return z.isNullOrUndefined(r)||1===e.length&&""===e[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:this.parent.computeAndOrNot(e,"or")},Ve.prototype.ComputeNOT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;return z.isNullOrUndefined(r)||1<r.length||""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:this.parent.computeAndOrNot(e,"not")},Ve.prototype.ComputeIFS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;if(z.isNullOrUndefined(r)||1===e.length&&""===e[0]||e.length%2!=0)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var n,i="",o=0;o<e.length;o++){if(n=this.parent.getValueFromArg(e[o]),""===e[o])return this.parent.getErrorStrings()[$.CommonErrors.NA];if(-1<this.parent.getErrorStrings().indexOf(n))return n;if(n!==this.parent.trueValue&&n!==this.parent.falseValue)return this.parent.getErrorStrings()[$.CommonErrors.Value];if(n===this.parent.trueValue)return this.parent.isCellReference(e[o+1].split(this.parent.tic).join(""))||e[o+1].includes(this.parent.arithMarker)?i=""===(i=this.parent.getValueFromArg(e[o+1]))?"0":i:-1<(i=""===e[o+1]?"0":this.parent.getValueFromArg(e[o+1])).indexOf(this.parent.tic)&&(i=i.split(this.parent.tic).join("")),o+=1,i;n===this.parent.falseValue&&(o+=1)}return this.parent.getErrorStrings()[$.CommonErrors.NA]},Ve.prototype.ComputeIFERROR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];var e,n=r;if(2!==n.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(this.parent.isCellReference(n[0])){if(e=this.parent.getValueFromArg(n[0])||"0",-1===this.parent.getErrorStrings().indexOf(e)&&"NaN"!==e)return e}else if(e=this.parent.getValueFromArg(n[0],null,!0)||"0",-1===this.parent.getErrorStrings().indexOf(e)&&"NaN"!==e)return e=e.split(this.parent.tic).join("").trim();return e=this.parent.isCellReference(n[1])?this.parent.getValueFromArg(n[1])||"0":(e=this.parent.getValueFromArg(n[1])||"0").split(this.parent.tic).join("").trim()};var Oe,Fe,xe=Ve;function Ve(r){r=Fe.call(this,r)||this;return r.formulas=[{formulaName:"IF",category:"Logical",description:"Returns one value if a logical expression is TRUE and another if it is FALSE"},{formulaName:"AND",category:"Logical",description:"Returns TRUE if all the arguments are considered TRUE, and FALSE otherwise."},{formulaName:"OR",category:"Logical",description:"Returns TRUE if any arguments considered TRUE, and all the arguments are FALSE it will return FALSE."},{formulaName:"NOT",category:"Logical",description:"Returns the inverse of a given logical expression."},{formulaName:"IFS",category:"Logical",description:"Checks multiple conditions and returns a value corresponding to the first TRUE result."},{formulaName:"IFERROR",category:"Logical",description:"Returns a value you specify if a formula evaluates to an error; otherwise, it returns the result of the formula."}],r}Re=function(r,t){return(Re=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Re(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Me,Te=t),Me.prototype.ComputeTRUE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return(!r||1!==r.length||""!==r[0])&&r&&0<r.length&&(1!==r.length||""!==r[0])?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:this.parent.trueValue},Me.prototype.ComputeFALSE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return(!r||1!==r.length||""!==r[0])&&r&&0<r.length&&(1!==r.length||""!==r[0])?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:this.parent.falseValue},Me.prototype.isTruthy=function(r){var t=r.toUpperCase();return t===this.parent.trueValue||t!==this.parent.falseValue&&""!==r&&(t=this.parent.parseFloat(r),!isNaN(t))&&0!==t},Me.prototype.ComputeXOR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];for(var n=0,i=0;i<r.length;i++){var o=r[i];if(this.parent.isCellReference(o)&&-1<o.indexOf(":"))for(var s=this.parent.getCellCollection(o),a=Array.isArray(s)?s:[s],l=0;l<a.length;l++){var u=this.parent.getValueFromArg(a[l]);if(-1<e.indexOf(u))return u;this.isTruthy(u)&&n++}else{u=this.parent.getValueFromArg(o);if(-1<e.indexOf(u))return u;this.isTruthy(u)&&n++}}return n%2==1?this.parent.trueValue:this.parent.falseValue},Me.prototype.ComputeIFNA=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||2!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.parent.getValueFromArg(t[0]))===this.parent.getErrorStrings()[$.CommonErrors.NA]||"#N/A"===r?this.parent.getValueFromArg(t[1]):""===r?"0":r},Me.prototype.ComputeSWITCH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.parent.getValueFromArg(r[0]);if(-1<e.indexOf(n))return n;var i=Math.floor((r.length-1)/2),o=e[$.CommonErrors.NA];(r.length-1)%2==1&&(o=this.parent.getValueFromArg(r[r.length-1]));for(var s=0;s<i;s++){var a=1+2*s,l=1+a,a=this.parent.getValueFromArg(r[a]);if(-1<e.indexOf(a))return a;if(a===n||!isNaN(this.parent.parseFloat(a))&&this.parent.parseFloat(a)===this.parent.parseFloat(n))return""===(a=this.parent.getValueFromArg(r[l]))?"0":this.parent.removeTics(a)}return""===o?"0":this.parent.removeTics(o)};var Re,Te,Ie=Me;function Me(r){r=Te.call(this,r)||this;return r.formulas=[{formulaName:"TRUE",category:"Logical",description:"Returns the logical value TRUE."},{formulaName:"FALSE",category:"Logical",description:"Returns the logical value FALSE."},{formulaName:"XOR",category:"Logical",description:"Returns a logical exclusive OR of all arguments."},{formulaName:"IFNA",category:"Logical",description:"Returns the value you specify if the expression resolves to #N/A; otherwise returns the result of the expression."},{formulaName:"SWITCH",category:"Logical",description:"Evaluates an expression against a list of values and returns the result corresponding to the first matching value."}],r}De=function(r,t){return(De=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}De(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(S,Ue=t),S.prototype.ComputeCHOOSE=function(){for(var r=this,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(z.isNullOrUndefined(t)||""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(t.length<2)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n,i=this.parent.getErrorStrings();if(n=t[0],(n=r.parent.getValueFromArg(n)).toUpperCase()===r.parent.trueValue?n="1":n.toUpperCase()===r.parent.falseValue&&(n="0"),r=n,-1<i.indexOf(r))return r;if(this.parent.isCellReference(t[0])){if(-1<t[0].indexOf(":"))return i[$.CommonErrors.Value]}else 2===(r=this.parent.removeTics(r)).split("%").length&&this.parent.isNumber(r.split("%")[0])&&(r=(.01*Number(r.split("%")[0])).toString());return(r=Math.floor(this.parent.parseFloat(r)))<1||isNaN(r)||z.isNullOrUndefined(t[r])?i[$.CommonErrors.Value]:this.parent.isCellReference(r=""===(r=t[r])?"0":r)?-1<r.indexOf(":")?i[$.CommonErrors.Value]:this.parent.getValueFromArg(r):(-1<r.indexOf(this.parent.tic)&&(-1<i.indexOf(r.split(this.parent.tic).join(""))||this.parent.removeTics(r).match(/^(\d*\.\d+|\d+)\s*[-*/]\s*(\d*\.\d+|\d+)$/))&&(r=this.parent.removeTics(r)),-1<(r=this.parent.removeTics(this.parent.getValueFromArg(r))).indexOf(this.parent.tic+this.parent.tic)?r.replace(/""/g,this.parent.tic):2===r.split("%").length&&this.parent.isNumber(r.split("%")[0])?(.01*Number(r.split("%")[0])).toString():r)},S.prototype.ComputeINDEX=function(){for(var r,e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i,o,s=this.parent.getErrorStrings();if(t.length&&"nestedFormulaTrue"===t[t.length-1]&&(r=!0,t.pop()),z.isNullOrUndefined(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(t.length<2||4<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===t[0]||""===t[3]||t[3]&&("0"===t[3]||"FALSE"===t[3]))return s[$.CommonErrors.Value];function a(r){if(z.isNullOrUndefined(r)||""===r)return 1;var t=e.parent.getValueFromArg(r);if(!(-1<s.indexOf(t))){if(t.toUpperCase()===e.parent.trueValue?t="1":t.toUpperCase()===e.parent.falseValue&&(t="0"),-1<t.indexOf(e.parent.tic)&&(t=e.parent.removeTics(t),-1===r.indexOf(e.parent.tic)||""===t.trim()))return s[$.CommonErrors.Value];if(2===t.split("%").length&&e.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString()),t=parseInt(Number(t).toString(),10),isNaN(t)||t<0)return s[$.CommonErrors.Value];0===t&&(t=1)}return t}if(t[3]&&(o=a(t[3]),-1<s.indexOf(o.toString())))return o.toString();t[0].startsWith(this.parent.tic)&&t[0].endsWith(this.parent.tic)&&(t[0]=t[0].substring(1,t[0].length-1));var l=t[0].split(this.parent.getParseArgumentSeparator());if(t[0]=l[o?o-1:0],!t[0])return s[$.CommonErrors.Ref];if(l=t[0],o=a(t[1]),-1<s.indexOf(o.toString()))return o.toString();if(i=a(t[2]),-1<s.indexOf(i.toString()))return i.toString();var u=l.indexOf(":");if(-1===u){if(1<o||1<i)return s[$.CommonErrors.Ref];l=this.parent.isCellReference(l)?this.parent.getValueFromArg(l):l}else{var h=this.parent.rowIndex(l.substring(0,u)),p=this.parent.rowIndex(l.substring(u+1)),g=this.parent.colIndex(l.substring(0,u)),u=this.parent.colIndex(l.substring(u+1));if(p-h+1<o||u-g+1<i)return s[$.CommonErrors.Ref];o=h+o-1,i=g+i-1,l=this.parent.getValueFromArg(this.getSheetReference(l)+this.parent.convertAlpha(i)+o)}return""===l?0:r&&-1===s.indexOf(l)&&!this.parent.isNumber(l)&&l!==this.parent.trueValue&&l!==this.parent.falseValue?this.parent.tic+l+this.parent.tic:l},S.prototype.ComputeMATCH=function(){for(var t=this,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var n=r.slice(),i=this.parent.getErrorStrings();if(z.isNullOrUndefined(n)||1===n.length&&""===n[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(n.length<2||3<n.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];n[0]=this.parent.getValueFromArg(r[0]);var o,s=-1<n[0].indexOf(this.parent.tic);if(n[0]=n[0].split(this.parent.tic).join(""),-1<i.indexOf(n[0]))return n[0];if(""===n[0])return i[$.CommonErrors.NA];if(isNaN(Number(n[0]))&&(s=!0),z.isNullOrUndefined(r[2]))n[2]="1";else{if(n[2]=this.parent.getValueFromArg(n[2]),-1<n[2].indexOf(this.parent.tic)&&isNaN(Number(n[2].split(this.parent.tic).join(""))))return i[$.CommonErrors.Value];n[2].toUpperCase()===this.parent.trueValue?n[2]="1":n[2].toUpperCase()===this.parent.falseValue&&(n[2]="0")}o=parseFloat(n[2]),-1===[-1,0,1].indexOf(o)&&(o=0);var a,l=[],u=!1,h=this.parent.grid,p=this.parent.grid;if(-1<n[1].indexOf(":")||this.parent.isCellReference(n[1])){var g=M(n[1]),f=g[0],m=g[1],c=g[2],d=g[3];if(1048576<=f||1048576<=c||16384<=m||16384<=d)return i[$.CommonErrors.Name];if(f!==c&&m!==d)return i[$.CommonErrors.NA];for(var N,v,g="",E=this.parent.getSheetFamilyItem(h),E=(n[1].startsWith("!")?(g=n[1].substring(0,n[1].replace("!","").indexOf("!")+2),null!==E.tokenToParentObject&&(h=E.tokenToParentObject.get(g))):null!==E.parentObjectToToken&&(g=E.parentObjectToToken.get(h)),this.parent.getSheetId(h)),S=this.parent.getCellValueFn(h,this.parent.cell,E,!0),y=0,C=void 0,C=0===o?(a=-1<n[0].indexOf("*")||-1<n[0].indexOf("?"),function(){a&&(N=t.parent.findWildCardValue(n[0],N)),n[0]===N?(c=d=-2,v=y+1):y++}):function(){l[y]=N,y++},b=f;b<=c;b++)for(var A=m;A<=d;A++)N=S(b+1,A+1,Br(b,A)),!u&&isNaN(Number(N))&&(u=!0),C();if(v)return this.parent.grid=p,v;if(s!==u)return this.parent.grid=p,i[$.CommonErrors.NA]}else!z.isNullOrUndefined(n[1])&&n[1].includes(this.parent.tic+this.parent.tic)&&n[1].split(this.parent.tic+this.parent.tic).forEach(function(r){(r=r.trim().split(t.parent.tic).join(""))&&l.push(r)});for(var O=0,F="",x=!1,V=isNaN(Number(n[0]))?n[0]:Number(n[0]),R=0;R<l.length;R++)if(""===l[R])R===l.length-1&&l.pop();else{if(-1===o&&(s||u))break;var T=isNaN(Number(l[R]))?l[R]:Number(l[R]);if(1===o)V===T?(O=R+1,x=!0,isNaN(Number(n[0]))&&(s=!1)):T<V&&!s&&!x&&(!F||T>(isNaN(Number(F))?F:Number(F)))&&(O=R+1,F=l[R]);else if(0===o){if(a&&(l[R]=this.parent.findWildCardValue(n[0],l[R])),n[0]===l[R])return R+1}else if(-1===o){if(!(Number(l[R])>Number(l[R+1])||R===l.length-1))return this.parent.grid=p,i[$.CommonErrors.NA];V===T?(O=R+1,V=void 0):V<T&&(!F||T<(isNaN(Number(F))?F:Number(F)))&&(O=R+1,F=l[R])}}return s&&u&&1===o&&(O=l.length),this.parent.grid=p,O||i[$.CommonErrors.NA]},S.prototype.ComputeLOOKUP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=r;return z.isNullOrUndefined(e)||1===e.length&&""===e[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:this.parent.computeLookup(e)},S.prototype.ComputeVLOOKUP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.parent.computeVHLookup(r,!0)},S.prototype.ComputeHLOOKUP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.parent.computeVHLookup(r)},S.prototype.ComputeADDRESS=function(){for(var r,e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this.parent.getErrorStrings();if(z.isNullOrUndefined(t)||1===t.length&&""===t[0].trim())return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(t.length<2||5<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===t[0].split(this.parent.tic).join("").trim()||""===t[1].split(this.parent.tic).join("").trim())return i[$.CommonErrors.Value];function o(r){var t=e.parent.getValueFromArg(r).trim();if(!(-1<i.indexOf(t))){if(t.toUpperCase()===e.parent.trueValue?t="1":t.toUpperCase()===e.parent.falseValue&&(t="0"),e.parent.isCellReference(r)&&-1<t.indexOf(e.parent.tic))return i[$.CommonErrors.Value];2===(t=e.parent.removeTics(t)).split("%").length&&e.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString())}return t}var s=o(t[0]);if(-1<i.indexOf(s))return s;if(s=Number(s),isNaN(s)||s<1)return i[$.CommonErrors.Value];var a,l,u,s=s.toString(),h=o(t[1]);if(-1<i.indexOf(h))return h;if(h=Number(h),isNaN(h)||h<1)return i[$.CommonErrors.Value];if(h=h.toString(),z.isNullOrUndefined(t[2])||""===t[2].trim())a="1";else{if(a=o(t[2]),-1<i.indexOf(a))return a;if(a=Number(a),isNaN(a)||a<1||4<a)return i[$.CommonErrors.Value];a=a.toString()}if(z.isNullOrUndefined(t[3])||""===t[3].trim())l="1";else{if(l=o(t[3]),-1<i.indexOf(l))return l;l.toUpperCase()===this.parent.trueValue||1<Number(l)?l="1":""!==l&&l.toUpperCase()!==this.parent.falseValue||(l="0")}if("1"===l)"1"===a?r="$"+J(parseInt(h,10))+"$"+parseInt(s,10):"2"===a?r=J(parseInt(h,10))+"$"+parseInt(s,10):"3"===a?r="$"+J(parseInt(h,10))+parseInt(s,10):"4"===a&&(r=J(parseInt(h,10))+parseInt(s,10));else{if("0"!==l)return i[$.CommonErrors.Name];"1"===a?r="R"+parseInt(s,10)+"C"+parseInt(h,10):"2"===a?r="R"+parseInt(s,10)+"C["+parseInt(h,10)+"]":"3"===a?r="R["+parseInt(s,10)+"]C"+parseInt(h,10):"4"===a&&(r="R["+parseInt(s,10)+"]C["+parseInt(h,10)+"]")}return!z.isNullOrUndefined(t[4])&&""!==t[4]&&(u=this.parent.getValueFromArg(t[4]).split(this.parent.tic).join(""),-1<i.indexOf(u))?u:z.isNullOrUndefined(u)?r:u+"!"+r},S.prototype.ComputeSUBTOTAL=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=this.parent.getErrorStrings();if(z.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(e.length<2)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(t=this.parent.getValueFromArg(e[0]).trim(),!(-1<i.indexOf(t))){if(""===t.split(this.parent.tic).join("").trim())return i[$.CommonErrors.Value];if((t=this.parent.isCellReference(e[0])?t:this.parent.removeTics(t)).toUpperCase()===this.parent.trueValue?t="1":t.toUpperCase()===this.parent.falseValue?t="0":2===t.split("%").length&&this.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString()),t=this.parent.parseFloat(t),isNaN(t)||(t<1||11<t)&&(t<101||111<t))return i[$.CommonErrors.Value];var o=e.slice(1,e.length);switch(t){case 1:case 101:t=(r=this.owner).ComputeAVERAGE.apply(r,o.concat(["isSubtotal"]));break;case 2:case 102:t=(r=this.owner).ComputeCOUNT.apply(r,o.concat(["isSubtotal"]));break;case 3:case 103:t=(r=this.owner).ComputeCOUNTA.apply(r,o.concat(["isSubtotal"]));break;case 4:case 104:t=(r=this.owner).ComputeMAX.apply(r,o.concat(["isSubtotal"]));break;case 5:case 105:t=(r=this.owner).ComputeMIN.apply(r,o.concat(["isSubtotal"]));break;case 6:case 106:t=(r=this.owner).ComputePRODUCT.apply(r,o.concat(["isSubtotal"]));break;case 7:case 107:t=(r=this.owner).ComputeDAY.apply(r,o);break;case 8:case 108:t=(r=this.owner).ComputeCONCAT.apply(r,o);break;case 9:case 109:t=(r=this.owner).ComputeSUM.apply(r,o.concat(["isSubtotal"]));break;case 10:case 110:t=(r=this.owner).ComputeAVERAGEA.apply(r,o);break;case 11:case 111:t=(r=this.owner).ComputeABS.apply(r,o);break;default:t=i[$.CommonErrors.Value]}}return t},S.prototype.ComputeTEXT=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t.length&&"nestedFormulaTrue"===t[t.length-1]&&(r=!0,t.pop());var n=t[1];if(2!==t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var i=t[0],o=n;if(""===n)return this.parent.getValueFromArg(i);var s=new Date(1900,0,1,0,0,0),a=i+","+o,l=new z.Internationalization;if(-1<this.parent.getErrorStrings().indexOf(a))return a;if(Q((i=this.parent.getValueFromArg(i)).split(this.parent.tic).join(""))&&(i=i.split(this.parent.tic).join("")),""===(o=n.startsWith('"')&&n.endsWith('"')?o.split(this.parent.tic).join(""):this.parent.getValueFromArg(o)))return"";""===i&&(0<o.length&&(-1<o.toUpperCase().indexOf("M")||-1<o.toUpperCase().indexOf("D")||-1<o.toUpperCase().indexOf("Y")||-1<o.toUpperCase().indexOf("S")||-1<o.toUpperCase().indexOf("T"))||-1<o.toUpperCase().indexOf("H"))&&(i=s.toString());a=this.parseDouble(i);if(isNaN(a)&&null!==this.parent.isDate(new Date(i))&&(a=this.parent.toOADate(new Date(i))),s=Date.parse(i.split(this.parent.tic).join("")),!isNaN(a)||!isNaN(s))if(0<o.length&&-1===o.indexOf("#")&&(-1<o.toUpperCase().indexOf("M")||-1<o.toUpperCase().indexOf("D")||-1<o.toUpperCase().indexOf("Y")||-1<o.toUpperCase().indexOf("S")||-1<o.toUpperCase().indexOf("T"))||-1<o.toUpperCase().indexOf("H")){for(var u=(o=(o=o.split("Y").join("y").split("D").join("d").split("H").join("h")).split("S").join("s").split("m").join("M").split("AM/PM").join("tt")).split(""),h=!1,p=!1,g=0,f=0,g=0;g<u.length;){var m=u[g];"s"===m&&"M"===u[f]&&(u[f]="m","M"===u[f-1])&&(u[f-1]="m"),this.parent.isChar(m)&&(f=g),"M"===m&&h&&(u[g]="m",p=!0),"h"===m?h=!0:this.parent.isChar(m)&&"M"!==m&&"h"!==m&&!p&&(p=h=!1),g++}o=(o=String(u)).split(",").join("").split("\n").join(" ");var c,n=this.parent.fromOADate(a),s=(0===a&&(n=s),I(o));if(""===s)return c=L(n),this.parent.parentObject.getDisplayText({format:o,value:c});i=l.getDateFormat({skeleton:s,type:"date"})(n)}else i=this.parent.parentObject.getDisplayText({format:o,value:a});return r?this.parent.tic+i+this.parent.tic:i};var De,Ue,we=S;function S(r){r=Ue.call(this,r)||this;return r.formulas=[{formulaName:"CHOOSE",category:"Lookup & Reference",description:"Returns a value from a list, given an index number."},{formulaName:"INDEX",category:"Lookup & Reference",description:"Returns a value from a table, given a row and column number."},{formulaName:"MATCH",category:"Lookup & Reference",description:"Returns the relative position of an checked item in range that matches a specified value in a specified order"},{formulaName:"LOOKUP",category:"Lookup & Reference",description:"Looks for a value in a one-row or one-column range, then returns a value from the same position in a second one-row or one-column range."},{formulaName:"VLOOKUP",category:"Lookup & Reference",description:"Looks for a specific value in the first column of a lookup range and returns a corresponding value from a different column within the same row."},{formulaName:"HLOOKUP",category:"Lookup & Reference",description:"Looks for a value in the top row of the array of values and then returns a value in the same column from a row in the array that you specify."},{formulaName:"ADDRESS",category:"Lookup & Reference",description:"Returns a cell reference as text, given specified row and column numbers."},{formulaName:"SUBTOTAL",category:"Lookup & Reference",description:"Returns a subtotal in a list or database."},{formulaName:"TEXT",category:"Lookup & Reference",description:"Converts a value to text in specified number format."}],r}je=function(r,t){return(je=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}je(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Pe,Le=t),Pe.prototype.ComputeROW=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1===t.length&&""===t[0]?(r=-1<(r=this.parent.actCell||this.parent.cell||"A1").indexOf("!")?r.substring(r.lastIndexOf("!")+1):r,this.parent.rowIndex(r).toString()):1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=t[0].split("$").join(""),this.parent.isCellReference(r.split(":")[0])?(r=-1<(r=-1<r.indexOf(":")?r.split(":")[0]:r).indexOf("!")?r.substring(r.lastIndexOf("!")+1):r,this.parent.rowIndex(r).toString()):this.parent.getErrorStrings()[$.CommonErrors.Value])},Pe.prototype.ComputeCOLUMN=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1===t.length&&""===t[0]?(r=-1<(r=this.parent.actCell||this.parent.cell||"A1").indexOf("!")?r.substring(r.lastIndexOf("!")+1):r,this.parent.colIndex(r).toString()):1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=t[0].split("$").join(""),this.parent.isCellReference(r.split(":")[0])?(r=-1<(r=-1<r.indexOf(":")?r.split(":")[0]:r).indexOf("!")?r.substring(r.lastIndexOf("!")+1):r,this.parent.colIndex(r).toString()):this.parent.getErrorStrings()[$.CommonErrors.Value])},Pe.prototype.ComputeROWS=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length||""===e[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:-1===(t=e[0].split("$").join("")).indexOf(":")?this.parent.isCellReference(t)?"1":this.parent.getErrorStrings()[$.CommonErrors.Value]:(r=-1<(t=t.split(":"))[0].indexOf("!")?t[0].substring(t[0].lastIndexOf("!")+1):t[0],t=-1<t[1].indexOf("!")?t[1].substring(t[1].lastIndexOf("!")+1):t[1],(Math.abs(this.parent.rowIndex(t)-this.parent.rowIndex(r))+1).toString())},Pe.prototype.ComputeCOLUMNS=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z.isNullOrUndefined(e)||1!==e.length||""===e[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:-1===(t=e[0].split("$").join("")).indexOf(":")?this.parent.isCellReference(t)?"1":this.parent.getErrorStrings()[$.CommonErrors.Value]:(r=-1<(t=t.split(":"))[0].indexOf("!")?t[0].substring(t[0].lastIndexOf("!")+1):t[0],t=-1<t[1].indexOf("!")?t[1].substring(t[1].lastIndexOf("!")+1):t[1],(Math.abs(this.parent.colIndex(t)-this.parent.colIndex(r))+1).toString())},Pe.prototype.ComputeHYPERLINK=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<1||2<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveTextArg(r[0]),!(-1<i.indexOf(e))&&2===r.length?(n=this.resolveTextArg(r[1]),i.indexOf(n),n):e)},Pe.prototype.ComputeOFFSET=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=r[0].split("$").join("");if(!this.parent.isCellReference(n.split(":")[0]))return e[$.CommonErrors.Value];var i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof i)return i;if("string"==typeof o)return o;var s=1,a=1;if(4<=r.length&&""!==r[3]){var l=this.resolveNumberArg(r[3]);if("string"==typeof l)return l;s=Math.floor(l)}if(5===r.length&&""!==r[4]){var l=this.resolveNumberArg(r[4]);if("string"==typeof l)return l;a=Math.floor(l)}return s<1||a<1||(n=-1<(l=-1<n.indexOf(":")?n.split(":")[0]:n).indexOf("!")?l.substring(0,l.lastIndexOf("!")+1):"",l=-1<l.indexOf("!")?l.substring(l.lastIndexOf("!")+1):l,i=this.parent.rowIndex(l)+Math.floor(i),l=this.parent.colIndex(l)+Math.floor(o),i<1)||l<1?e[$.CommonErrors.Ref]:(o=n+J(l)+i,1===s&&1===a?this.parent.getValueFromArg(o):this.parent.getValueFromArg(o)||o)};var je,Le,ke=Pe;function Pe(r){r=Le.call(this,r)||this;return r.formulas=[{formulaName:"ROW",category:"Lookup & Reference",description:"Returns the row number of a reference."},{formulaName:"ROWS",category:"Lookup & Reference",description:"Returns the number of rows in a reference."},{formulaName:"COLUMN",category:"Lookup & Reference",description:"Returns the column number of a reference."},{formulaName:"COLUMNS",category:"Lookup & Reference",description:"Returns the number of columns in a reference."},{formulaName:"HYPERLINK",category:"Lookup & Reference",description:"Creates a shortcut that opens a document on a network server, intranet, or Internet."},{formulaName:"OFFSET",category:"Lookup & Reference",description:"Returns a reference offset from a given reference."}],r}_e=function(r,t){return(_e=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}_e(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Be,We=t),Be.prototype.ComputeINDIRECT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]);if(-1<e.indexOf(n))return n;var n=n.split("$").join(""),i=!0;if(2===r.length){var o=this.resolveNumberArg(r[1]);if("string"==typeof o)return o;i=0!==o}if(!i)return e[$.CommonErrors.Value];if(!this.parent.isCellReference(n.split(":")[0]))return e[$.CommonErrors.Ref];if(-1<n.indexOf(":")){for(var o=this.parent.getCellCollection(n),s=Array.isArray(o)?o:[o],a=[],l=0;l<s.length;l++){var u=this.parent.getValueFromArg(s[l]);if(-1<e.indexOf(u))return u;a.push(u)}return a.join(this.parent.getParseArgumentSeparator())}return this.parent.getValueFromArg(n)},Be.prototype.ComputeAREAS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=r[0].split("$").join(""),this.parent.isCellReference(e.split(":")[0])||-1!==e.indexOf("(")?-1<e.indexOf(",")?e.split(",").length.toString():"1":n[$.CommonErrors.Value])},Be.prototype.ComputeFORMULATEXT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(n=r[0].split("$").join(""),this.parent.isCellReference(n)?(o=-1<n.indexOf("!")?n.substring(0,n.lastIndexOf("!")+1):"",e=-1<n.indexOf("!")?n.substring(n.lastIndexOf("!")+1):n,e="!"+this.parent.getSheetID(this.parent.grid)+"!"+e,n=o?n:e,(i=this.parent.getFormulaInfoTable()).has(o=o?n:e)?i.get(o).getFormulaText():s[$.CommonErrors.NA]):s[$.CommonErrors.Value])},Be.prototype.ComputeISREF=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=t[0].split("$").join(""),this.parent.isCellReference(r.split(":")[0]))};var _e,We,qe=Be;function Be(r){r=We.call(this,r)||this;return r.formulas=[{formulaName:"INDIRECT",category:"Lookup & Reference",description:"Returns a reference indicated by a text value."},{formulaName:"AREAS",category:"Lookup & Reference",description:"Returns the number of areas in a reference."},{formulaName:"FORMULATEXT",category:"Lookup & Reference",description:"Returns the formula in a cell as text."},{formulaName:"ISREF",category:"Information",description:"Returns TRUE if the value is a reference."}],r}Xe=function(r,t){return(Xe=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Xe(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(y,Ye=t),y.prototype.flattenValues=function(r){var t=this.parent.getErrorStrings();if(this.parent.isCellReference(r)&&-1<r.indexOf(":")){for(var e=this.parent.getCellCollection(r),n=Array.isArray(e)?e:[e],i=[],o=0;o<n.length;o++){var s=this.parent.getValueFromArg(n[o]);if(-1<t.indexOf(s))return s;i.push(s)}return i}e=this.parent.isCellReference(r)?this.parent.getValueFromArg(r):this.resolveTextArg(r);return-1<t.indexOf(e)?e:[e]},y.prototype.valuesEqual=function(r,t){return r===t||(r=this.parent.parseFloat(r),t=this.parent.parseFloat(t),!isNaN(r)&&!isNaN(t)&&r===t)},y.prototype.ComputeXLOOKUP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||6<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.parent.getValueFromArg(r[0]);if(-1<e.indexOf(n))return n;var i=this.parent.removeTics(n),o=this.flattenValues(r[1]);if("string"==typeof o)return o;n=this.flattenValues(r[2]);if("string"==typeof n)return n;if(o.length!==n.length)return e[$.CommonErrors.Value];var s=null;if(4<=r.length&&""!==r[3]&&(s=this.parent.getValueFromArg(r[3]),-1<e.indexOf(s)))return s;var a=0;if(5<=r.length&&""!==r[4]){var l=this.resolveNumberArg(r[4]);if("string"==typeof l)return l;a=Math.floor(l)}for(var u=-1,h=0;h<o.length;h++){var p=o[h];if(this.valuesEqual(p,i)||p.toLowerCase()===i.toLowerCase()){u=h;break}if(0!==a&&-1<p.toLowerCase().indexOf(i.toLowerCase())){u=h;break}}return u<0?null!==s?this.parent.removeTics(s):e[$.CommonErrors.NA]:""===(l=n[u])?"0":l},y.prototype.ComputeXMATCH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.parent.getValueFromArg(r[0]);if(-1<e.indexOf(n))return n;var i=this.flattenValues(r[1]);if("string"==typeof i)return i;for(var o=0;o<i.length;o++)if(this.valuesEqual(i[o],n)||i[o].toLowerCase()===this.parent.removeTics(n).toLowerCase())return(o+1).toString();return e[$.CommonErrors.NA]},y.prototype.ComputeTEXTSPLIT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<2||6<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveTextArg(r[0]),n=this.resolveTextArg(r[1]),-1<i.indexOf(e)?e:-1<i.indexOf(n)?n:""===n?e:void 0!==(i=e.split(n))[0]?i[0]:"")},y.prototype.ComputeTOCOL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.flattenJoin(r,!0)},y.prototype.ComputeTOROW=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.flattenJoin(r,!1)},y.prototype.flattenJoin=function(r,t){var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.flattenValues(r[0]);if("string"==typeof n)return n;var i=0;if(2<=r.length&&""!==r[1]){r=this.resolveNumberArg(r[1]);if("string"==typeof r)return r;i=Math.floor(r)}for(var o=[],s=0;s<n.length;s++){var a=n[s];(1===i||3===i)&&""===a||(2===i||3===i)&&-1<e.indexOf(a)||o.push(a)}return 0===o.length?e[$.CommonErrors.Calc]||"#CALC!":o[0]},y.prototype.ComputeCHOOSECOLS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.chooseAxis(r,!1)},y.prototype.ComputeCHOOSEROWS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.chooseAxis(r,!0)},y.prototype.chooseAxis=function(r,t){var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=r[0].split("$").join("");if(!this.parent.isCellReference(n.split(":")[0]))return e[$.CommonErrors.Value];for(var i=[],o=1;o<r.length;o++){var s=this.resolveNumberArg(r[o]);if("string"==typeof s)return s;i.push(Math.floor(s))}var a=-1<n.indexOf(":")?n.split(":")[0]:n,n=-1<n.indexOf(":")?n.split(":")[1]:n,l=-1<a.indexOf("!")?a.substring(0,a.lastIndexOf("!")+1):"",a=-1<a.indexOf("!")?a.substring(a.lastIndexOf("!")+1):a,n=-1<n.indexOf("!")?n.substring(n.lastIndexOf("!")+1):n,u=this.parent.rowIndex(a),a=this.parent.colIndex(a),h=this.parent.rowIndex(n),n=this.parent.colIndex(n),p=Math.abs(h-u)+1,g=Math.abs(n-a)+1,f=i[0];return 0===f?e[$.CommonErrors.Value]:t?(t=0<f?f:p+f+1)<1||p<t?e[$.CommonErrors.Value]:(p=Math.min(u,h)+t-1,this.parent.getValueFromArg(l+J(Math.min(a,n))+p)):(t=0<f?f:g+f+1)<1||g<t?e[$.CommonErrors.Value]:(p=Math.min(a,n)+t-1,this.parent.getValueFromArg(l+J(p)+Math.min(u,h)))};var Xe,Ye,He=y;function y(r){r=Ye.call(this,r)||this;return r.formulas=[{formulaName:"XLOOKUP",category:"Lookup & Reference",description:"Searches a range for a match and returns the corresponding item."},{formulaName:"XMATCH",category:"Lookup & Reference",description:"Returns the relative position of an item in an array."},{formulaName:"TEXTSPLIT",category:"Text",description:"Splits text strings by using column and row delimiters."},{formulaName:"TOCOL",category:"Lookup & Reference",description:"Returns the array in a single column."},{formulaName:"TOROW",category:"Lookup & Reference",description:"Returns the array in a single row."},{formulaName:"CHOOSECOLS",category:"Lookup & Reference",description:"Returns the specified columns from an array."},{formulaName:"CHOOSEROWS",category:"Lookup & Reference",description:"Returns the specified rows from an array."}],r}function Ge(r){var n="Descending"===r;return function(r,t){var e;return r===t?0:null==r?1:null==t?-1:(e=0,"string"==typeof r?e=r.localeCompare(t):t<r?e=1:r<t&&(e=-1),n?-e:e)}}function Ze(r,t){t=Ge(t);return r.slice().sort(t)}Ke=function(r,t){return(Ke=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Ke(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Qe,$e=t),Qe.prototype.ComputeUNIQUE=function(){for(var r,e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this.parent.getErrorStrings();if("isComputeExp"===t[t.length-1]&&(r=!0,t.pop()),z.isNullOrUndefined(t)||""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(3<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];function w(r){var t;return z.isNullOrUndefined(r)?e.parent.falseValue:(t=e.parent.getValueFromArg(r),-1<i.indexOf(t)?t:0===Number(t)?e.parent.falseValue:Number(t)<0||0<Number(t)?e.parent.trueValue:(t=e.parent.isCellReference(r)?t:e.parent.removeTics(t)).toUpperCase()===e.parent.trueValue||t.toUpperCase()===e.parent.falseValue?t.toUpperCase():-1<t.indexOf(e.parent.tic)||-1<r.indexOf(e.parent.tic)?i[$.CommonErrors.Value]:i[$.CommonErrors.Name])}var o=w(t[1]);if(-1<i.indexOf(o))return o;var s=w(t[2]);if(-1<i.indexOf(s))return s;var a=[];if(-1<t[0].indexOf(":")){z.isNullOrUndefined(t[0].match(/[0-9]/))?(l=t[0].split(":"),t[0]=l[0]+"1:"+l[1]+(this.parent.spreadSheetUsedRange[0]+1)):z.isNullOrUndefined(t[0].toUpperCase().match(/[A-Z]/))&&(l=t[0].split(":"),t[0]="A"+l[0]+":"+J(this.parent.spreadSheetUsedRange[1]+1)+l[1]);var l=t[0].split(":");if(this.parent.isCellReference(l[0])&&this.parent.isCellReference(l[1])){for(var u=this.parent.dependencyCollection,h=0;h<u.length&&!r;h++)u[h].split(":")[0]===t[0].split(":")[0]&&this.clearDependency(u[h]);-1===this.parent.dependencyCollection.indexOf(t[0])?r||this.parent.dependencyCollection.push(t[0]):this.clearDependency(t[0]);var p,l=t[0].indexOf(":"),g=void 0,f=this.parent.rowIndex(this.parent.substring(t[0],0,l)),m=this.parent.colIndex(this.parent.substring(t[0],0,l)),c=this.parent.rowIndex(this.parent.substring(t[0],l+1,l+t[0].length-l-1)),l=this.parent.colIndex(this.parent.substring(t[0],l+1,l+t[0].length-l-1)),g=(c<f&&(g=c,c=f,f=g),l<m&&(g=l,l=m,m=g),""),d=(0===t[0].indexOf("!")&&(g=t[0].substring(0,t[0].replace("!","").indexOf("!")+2)),t[0]=g+J(m)+f+":"+J(l)+c,l-m),N=this.parent.getCellCollection(t[0]),v=void 0,v=p=this.parent.actCell;if(o===this.parent.falseValue)if(0==d)for(h=0;h<N.length;h++){var E=this.parent.getValueFromArg(N[h]);a.push(E=""===E?"0":E)}else for(var S="",y=d,h=0;h<N.length;h++)h===N.length-1&&(E=this.parent.getValueFromArg(N[h]),a.push((S=S+(E=""===E?"0":E)+"++").substring(0,S.length-2))),S=h<=y?S+(E=""===(E=this.parent.getValueFromArg(N[h]))?"0":E)+"++":(a.push(S.substring(0,S.length-2)),y=d+h,(E=""===(E=this.parent.getValueFromArg(N[h]))?"0":E)+"++");else for(var S="",y=1+d,j=c-f,h=0;h<y;h++){for(var C=0;C<=j;C++)S=S+(E=""===(E=this.parent.getValueFromArg(N[C*y+h]))?"0":E)+"++";a.push(S.substring(0,S.length-2)),S=""}for(var b,L=[],A=[],O=[],k=[],h=0;h<a.length;h++)(-1===L.indexOf(a[h].toLowerCase())?(L.push(a[h].toLowerCase()),O):(-1===A.indexOf(a[h].toLowerCase())&&A.push(a[h].toLowerCase()),k)).push(a[h]);if(s===this.parent.trueValue){for(var P=[],h=0;h<O.length;h++)-1===A.indexOf(O[h].toLowerCase())&&P.push(O[h]);if(0===(O=P).length)return i[$.CommonErrors.Calc]}if(r)return 0!=d?(b=[],O.forEach(function(r){b=b.concat(r.split("++"))})):b=o===this.parent.falseValue?O:O[0].split("++"),b;-1<v.indexOf("!")&&(v=v.substring(v.lastIndexOf("!")+1));var F=this.parent.rowIndex(v),x=this.parent.colIndex(v);if(0===this.parent.dependencyLevel){var V=!1;if(o===this.parent.falseValue)for(h=F,y=O.length+F;h<y;h++)for(var R=x,T=(M=O[0].split("++")).length+x;R<T;R++)h===y-1&&R===T-1&&-1===this.parent.uniqueRange.indexOf(p+":"+J(R)+h)&&this.parent.uniqueRange.push(p+":"+J(R)+h),this.checkSpill(R,h)&&(V=!0);else for(h=x,y=O.length+x;h<y;h++)for(var I=F,T=(M=O[0].split("++")).length+F;I<T;I++)h===y-1&&I===T-1&&-1===this.parent.uniqueRange.indexOf(this.parent.actCell+":"+J(h)+I)&&this.parent.uniqueRange.push(this.parent.actCell+":"+J(h)+I),this.checkSpill(h,I)&&(V=!0);if(V)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Spill]}else if(0<this.parent.dependencyLevel&&-1<this.parent.getValueFromArg(J(x)+F,!0).indexOf("#SPILL!"))return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Spill];if(o===this.parent.falseValue){var g=this.parent.getSheetFamilyItem(this.parent.grid),_="",W=void 0;null!==g.sheetNameToParentObject&&0<g.sheetNameToParentObject.size&&(W=(_=g.parentObjectToToken.get(this.parent.grid))+v);for(h=0;h<O.length;h++){var M=O[h].split("++");0<h&&(F++,x=this.parent.colIndex(v));for(var D=0;D<M.length;D++)this.setValueRefresh(M[D],F,x),(0<h||0<D)&&this.parent.refreshDependentCells(_+J(x)+F.toString(),W),M[D+1]&&x++}}else for(h=0;h<O.length;h++)for(var M=O[h].split("++"),U=0;U<M.length;U++)this.setValueRefresh(M[U],F,x),M[U+1]?F++:(x++,F=this.parent.rowIndex(v));m=O[0].split("++")[0]}}else if(this.parent.isCellReference(t[0]))-1===this.parent.dependencyCollection.indexOf(t[0])?r||this.parent.dependencyCollection.push(t[0]):this.clearDependency(t[0]),m=this.parent.getValueFromArg(t[0]);else{if(m=this.parent.getValueFromArg(t[0].trim()),-1<i.indexOf(m))return m;m=this.parent.removeTics(m)}return m},Qe.prototype.setValueRefresh=function(r,t,e){this.parent.parentObject.setValueRowCol(this.parent.getSheetId(this.parent.grid),r,t,e)},Qe.prototype.checkSpill=function(r,t){var e,n=!1,i=this.parent.getValueFromArg(J(r)+t,!0),r="!"+this.parent.getSheetID(this.parent.grid)+"!"+J(r)+t;return this.parent.getFormulaInfoTable().get(r)&&(e=this.parent.getFormulaInfoTable().get(r).formulaText),n=i&&(i.toUpperCase().indexOf("UNIQUE")<0||e&&!e.toUpperCase().includes("UNIQUE"))&&(i.toUpperCase().indexOf("SORT")<0||e&&!e.toUpperCase().includes("SORT"))&&i!==this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]?!0:n},Qe.prototype.clearDependency=function(r){for(var t=this.parent.actCell,e="",n=(-1<t.lastIndexOf("!")&&(t=(o=t).substring(o.lastIndexOf("!")+1),e=o.substring(0,o.lastIndexOf("!"))+"!"),this.parent.rowIndex(t)),i=this.parent.colIndex(t),o=r.indexOf(":"),s=this.parent.rowIndex(this.parent.substring(r,0,o)),a=this.parent.colIndex(this.parent.substring(r,0,o)),l=this.parent.rowIndex(this.parent.substring(r,o+1,o+r.length-o-1))-s+n,u=this.parent.colIndex(this.parent.substring(r,o+1,o+r.length-o-1))-a+i,h=this.parent.getFormulaInfoTable().get("!"+this.parent.getSheetID(this.parent.grid)+"!"+t)?this.parent.getFormulaInfoTable().get("!"+this.parent.getSheetID(this.parent.grid)+"!"+t).getFormulaText():"",p=n;p<=l;p++)for(var g=i;g<=u;g++)if(0<this.parent.dependencyLevel||-1<h.indexOf("UNIQUE")||-1<h.indexOf("SORT")){if(-1<this.parent.getValueFromArg("!"+this.parent.getSheetID(this.parent.grid)+"!"+J(i)+n,!0).indexOf("#SPILL!"))return;this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,"",p,g),this.parent.refreshDependentCells("!"+this.parent.getSheetID(this.parent.grid)+"!"+J(g)+p,t),this.parent.actCell=e+t}},Qe.prototype.ComputeSORT=function(){for(var r,t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];e.length&&"nestedFormulaTrue"===e[e.length-1]&&(r=!0,e.pop());var i,o=e,s=[];if(z.isNullOrUndefined(e)||""===e[0]||4<o.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];o[1]=o[1]||"1",o[2]=o[2]||"1",o[3]=o[3]||"FALSE",o[0]=o[0].split("$").join("");var a=[];if(-1<o[0].indexOf(":")){z.isNullOrUndefined(o[0].match(/[0-9]/))?(l=o[0].split(":"),o[0]=l[0]+"1:"+l[1]+(this.parent.spreadSheetUsedRange[0]+1)):z.isNullOrUndefined(o[0].toUpperCase().match(/[A-Z]/))&&(l=o[0].split(":"),o[0]="A"+l[0]+":"+J(this.parent.spreadSheetUsedRange[1]+1)+l[1]);var l=o[0].split(":");if(this.parent.isCellReference(l[0])&&this.parent.isCellReference(l[1])){for(var u=this.parent.dependencyCollection,h=0;h<u.length&&!r;h++)u[h].split(":")[0]===o[0].split(":")[0]&&this.clearDependency(u[h]);-1===this.parent.dependencyCollection.indexOf(o[0])?r||this.parent.dependencyCollection.push(o[0]):this.clearDependency(o[0]);var l=o[0].indexOf(":"),p=void 0,g=this.parent.rowIndex(this.parent.substring(o[0],0,l)),f=this.parent.colIndex(this.parent.substring(o[0],0,l)),m=this.parent.rowIndex(this.parent.substring(o[0],l+1,l+o[0].length-l-1)),c=this.parent.colIndex(this.parent.substring(o[0],l+1,l+o[0].length-l-1));if(m<g&&(p=m,m=g,g=p),c<f&&(p=c,c=f,f=p),this.parent.isCellReference(o[3])){if(o[3]=this.parent.getValueFromArg(o[3]).toUpperCase(),o[3]!==this.parent.trueValue&&o[3]!==this.parent.falseValue)if(Q(o[3]))o[3]=0===Number(o[3])?this.parent.falseValue:this.parent.trueValue;else{if(""!==o[3])return this.parent.getErrorStrings()[$.CommonErrors.Value];o[3]=this.parent.falseValue}}else if(b=o[3].startsWith(this.parent.tic)&&o[3].endsWith(this.parent.tic),o[3]=this.parent.getValueFromArg(o[3]),o[3]=Q(o[3])?0===Number(o[3])?this.parent.falseValue:this.parent.trueValue:o[3].split(this.parent.tic).join("").toUpperCase(),o[3]!==this.parent.trueValue&&o[3]!==this.parent.falseValue)return this.parent.getErrorStrings()[b?$.CommonErrors.Value:$.CommonErrors.Name];if(this.parent.isCellReference(o[2])?(o[2]=this.parent.getValueFromArg(o[2]),o[2]=o[2]===this.parent.trueValue?"1":o[2]):(o[2]=this.parent.getValueFromArg(o[2]),o[2]=o[2]===this.parent.trueValue?"1":o[2].split(this.parent.tic).join("")),o[2]=Q(o[2])?Math.floor(Number(o[2])).toString():o[2],"1"!==o[2]&&"-1"!==o[2])return-1<this.parent.getErrorStrings().indexOf(o[2])?this.parent.getErrorStrings()[$.CommonErrors.Name]:this.parent.getErrorStrings()[$.CommonErrors.Value];l="1"===o[2]?"Ascending":"Descending";if(this.parent.isCellReference(o[1])){if(o[1]=this.parent.getValueFromArg(o[1]),o[1]=Q(o[1])?Math.floor(Number(o[1])).toString():o[1]===this.parent.trueValue?"1":o[1]===this.parent.falseValue?"0":o[1],isNaN(this.parseDouble(o[1]))||this.parseDouble(o[1])<1||(o[3]===this.parent.trueValue?m-g+1<this.parseDouble(o[1]):c-f+1<this.parseDouble(o[1])))return this.parent.getErrorStrings()[$.CommonErrors.Value]}else if(b=o[1].startsWith(this.parent.tic)&&o[1].endsWith(this.parent.tic),o[1]=this.parent.getValueFromArg(o[1]),o[1]=Q(o[1])?Math.floor(Number(o[1])).toString():o[1]===this.parent.trueValue?"1":o[1]===this.parent.falseValue?"0":o[1].split(this.parent.tic).join(""),isNaN(this.parseDouble(o[1]))?b:this.parseDouble(o[1])<1||(o[3]===this.parent.trueValue?m-g+1<this.parseDouble(o[1]):c-f+1<this.parseDouble(o[1])))return this.parent.getErrorStrings()[$.CommonErrors.Value];var d="";0===o[0].indexOf("!")&&(d=(d=(d=o[0]).replace("!","")).indexOf("!"),d=o[0].substring(0,d+2)),o[0]=d+J(f)+g+":"+J(c)+m;for(var j=this.parent.getCellCollection(o[0]),h=0;h<j.length;h++)a.push(this.parent.getValueFromArg(j[h]));var N=[],v=[],E=[],S=[],y=[],C=c-f+1,L=function(r){r?"TRUE"===r.toUpperCase()||"FALSE"===r.toUpperCase()?(S.push(r),N.push(r)):isNaN(t.parseDouble(r))?(E.push(r),N.push(r)):(v.push(t.parseDouble(r)),N.push(t.parseDouble(r))):""===r&&(y.push(t.parseDouble(r).toString()),N.push(t.parseDouble(r).toString()))};if("TRUE"===o[3])for(h=0;h<C;h++)L(a[h+(this.parseDouble(o[1])-1)*C]);if("FALSE"===o[3])for(h=0;h<a.length;h++)L(a[h*C+this.parseDouble(o[1])-1]);for(var p=0<v.length?Ze(v,l):[],b=0<E.length?Ze(E,l):[],k=0<S.length?Ze(S,l):[],P="Ascending"==l?p.concat(b,k,y):k.concat(b,p,y),A=[],O=0;O<P.length;O++)for(var F=0;F<N.length;F++)JSON.stringify(P[O])===JSON.stringify(N[F])&&-1===A.indexOf(F)&&A.push(F);var x,l=void 0,_=(l=(l=x=this.parent.actCell)?-1<l.indexOf("!")?l.substring(l.lastIndexOf("!")+1):l:this.parent.actCell,this.parent.rowIndex(l)),W=this.parent.colIndex(l);if(0===this.parent.dependencyLevel){for(var q=!1,B="TRUE"===o[3]?m-g+1:A.length,X="TRUE"===o[3]?A.length:c-f+1,V=0;V<B;V++)for(var Y,R=0;R<X;R++)this.checkSpill(W+R,_+V)&&(q=!0),V===B-1&&R===X-1&&(Y=J(W+R)+(_+V),-1===this.parent.sortRange.indexOf(x+":"+Y))&&this.parent.sortRange.push(x+":"+Y);if(q)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Spill]}else if(0<this.parent.dependencyLevel&&-1<this.parent.getValueFromArg(J(W)+_,!0).indexOf("#SPILL!"))return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.Spill];if("TRUE"===o[3]){for(var H=g,T=0;H<=m;H++,T++)for(var O=0,I=0;O<A.length;O++,I++){var G,M,D=this.parent.getValueFromArg(d+J(A[O]+f)+H);r&&""!==D?s.push(D):(D=""===D?"0":D,(M=this.parent.cell)&&(M=-1<M.indexOf("!")?M.substring(M.lastIndexOf("!")+1):M,G=this.parent.rowIndex(M),M=this.parent.colIndex(M),this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,D,G+T,M+I)))}i=this.parent.getValueFromArg(d+J(A[0]+f)+g)}if("FALSE"===o[3]){for(O=0,T=0;O<A.length;O++,T++)for(var Z=f,I=0;Z<=c;Z++,I++){var K,U,w=this.parent.getValueFromArg(d+J(Z)+(A[O]+g));r&&""!==w?s.push(w):(w=""===w?"0":w,(U=this.parent.cell)&&(U=-1<U.indexOf("!")?U.substring(U.lastIndexOf("!")+1):U,K=this.parent.colIndex(U),U=this.parent.rowIndex(U),this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,w,U+T,K+I)))}i=this.parent.getValueFromArg(d+J(f)+(A[0]+g))}}}else if(this.parent.isCellReference(o[0]))-1===this.parent.dependencyCollection.indexOf(o[0])?r||this.parent.dependencyCollection.push(o[0]):this.clearDependency(o[0]),i=this.parent.getValueFromArg(o[0]);else{if(i=o[0].trim(),-1<this.parent.getErrorStrings().indexOf(i))return i;i=this.parent.removeTics(i)}return r?s.join(","):""===i?"0":i};var Ke,$e,ze=Qe;function Qe(r){r=$e.call(this,r)||this;return r.formulas=[{formulaName:"UNIQUE",category:"Lookup & Reference",description:"Returns a unique values from a range or array."},{formulaName:"SORT",category:"Lookup & Reference",description:"Sorts a range of an array."}],r}Je=function(r,t){return(Je=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Je(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(C,rn=t),C.prototype.ComputeFIND=function(){for(var e=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];function i(r){var t=e.parent.getValueFromArg(r),t=z.isNullOrUndefined(t)?"":t.toString();return-1<n.indexOf(t)||e.parent.isCellReference(r)||(2===t.split("%").length&&e.parent.isNumber(t.split("%")[0])?t=(.01*Number(t.split("%")[0])).toString():-1<r.indexOf(e.parent.tic)&&(e.parent.removeTics(r).match(/^(\d*\.\d+|\d+)\s*[-*/]\s*(\d*\.\d+|\d+)$/)?(t=e.parent.getValueFromArg(e.parent.removeTics(r)),t=z.isNullOrUndefined(t)?"":t.toString()):-1<t.indexOf(e.parent.tic+e.parent.tic)&&(t=t.replace(/""/g,e.parent.tic)))),t}var o="";if(!z.isNullOrUndefined(r[0])){if(o=i(r[0]),-1<n.indexOf(o))return o;this.parent.isCellReference(r[0])||(o=this.parent.removeTics(o))}var s="";if(!z.isNullOrUndefined(r[1])){if(s=i(r[1]),-1<n.indexOf(s))return s;this.parent.isCellReference(r[1])||(s=this.parent.removeTics(s))}var a=1;if(!z.isNullOrUndefined(r[2])){if(a=i(r[2]),-1<n.indexOf(a))return a;if(a.toUpperCase()===this.parent.trueValue?a="1":a.toUpperCase()===this.parent.falseValue&&(a="0"),this.parent.isCellReference(r[2])||(a=this.parent.removeTics(a)),a=this.parent.parseFloat(a),isNaN(a)||a<=0)return n[$.CommonErrors.Value]}return(a=s.indexOf(o,a-1))<0?n[$.CommonErrors.Value]:(Number(a)+Number(1)).toString()},C.prototype.ComputeCONCATENATE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];for(var n=r,i="",o="",s=0;s<n.length;s++){var a=n[s];if(this.parent.isCellReference(a)){if(-1<a.indexOf(":")){if(!this.isConcat)return e[$.CommonErrors.Value];for(var l=this.parent.getCellCollection(a),u=0;u<l.length;u++)i+=this.parent.getValueFromArg(l[u])}else{if(1===n.length&&n[0].indexOf(this.parent.tic)<0&&!X(n[0]))return e[$.CommonErrors.Name];o=this.parent.getValueFromArg(a)}if(-1<e.indexOf(o))return o}else if(a.startsWith(this.parent.tic)&&a.endsWith(this.parent.tic)&&-1<a.indexOf('""')?o=(o=a.substring(1,a.length-1)).replace(/""/g,'"'):(o=a.split(this.parent.tic).join(""),(this.parent.isNumber(o)||z.isNullOrUndefined(this.parent.isDate(o))||a.startsWith(" n"))&&(o=this.parent.getValueFromArg(a).split(this.parent.tic).join(""))),-1<e.indexOf(o))return o;i+=o}return this.isConcat=!1,i},C.prototype.ComputeCONCAT=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this.isConcat=!0,(r=this.owner).ComputeCONCATENATE.apply(r,t)},C.prototype.ComputeT=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=this.parent.getErrorStrings();if(e.length&&"nestedFormulaTrue"===e[e.length-1]&&(t=!0,e.pop()),z.isNullOrUndefined(e)||1===e.length&&""===e[0].trim())return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1<e.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(r=this.parent.getValueFromArg(e[0]).trim(),!(-1<i.indexOf(r))){if(-1<e[0].indexOf(this.parent.tic))-1<(r=this.parent.removeTics(e[0].trim())).indexOf(this.parent.tic+this.parent.tic)&&(r=r.replace(/""/g,this.parent.tic));else if(2===r.split("%").length&&this.parent.isNumber(r.split("%")[0])&&(r=(Number(r.split("%")[0])/100).toString()),this.parent.isNumber(r)||r.toUpperCase()===this.parent.trueValue||r.toUpperCase()===this.parent.falseValue)return"";t&&(r=this.parent.tic+r+this.parent.tic)}return r},C.prototype.ComputeEXACT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=!1,s=r.length&&"nestedFormulaTrue"===r[r.length-1],a=this.parent.getErrorStrings();if(s&&r.pop(),!r||!r[0]&&1===r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(r[0]){if(e=this.parent.getValueFromArg(r[0]),-1<a.indexOf(e))return e;-1===e.indexOf(this.parent.tic)&&e.includes("%")&&(e=(Number(e.split("%")[0])/100).toString()),this.parent.isCellReference(r[0])?i=!0:e=e.split(this.parent.tic).join("")}if(r[1]){if(n=this.parent.getValueFromArg(r[1]),-1<a.indexOf(n))return n;-1===n.indexOf(this.parent.tic)&&n.includes("%")&&(n=(Number(n.split("%")[0])/100).toString()),this.parent.isCellReference(r[1])?i||0!==e.trim().length||0!==n.trim().length||(o=!1):(n=n.split(this.parent.tic).join(""),i&&0===e.trim().length&&0===n.trim().length&&(o=!1))}return e===n&&(o=!0),s?o?"1":"0":o},C.prototype.ComputeLEN=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this.parent.getErrorStrings();return z.isNullOrUndefined(t)||""===t[0].trim()&&1===t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:1<t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.parent.getValueFromArg(t[0]),-1<n.indexOf(r)?r:(-1<t[0].indexOf(this.parent.tic)?t[0]!==r&&t[0].startsWith("n")?r=this.parent.removeTics(r.trim()):-1<(r=this.parent.removeTics(t[0].trim())).indexOf(this.parent.tic+this.parent.tic)&&(r=r.replace(/""/g,this.parent.tic)):!t[0].startsWith("n")&&2===r.split("%").length&&this.parent.isNumber(r.split("%")[0])?r=(Number(r.split("%")[0])/100).toString():this.parent.isNumber(r)&&(r=r.trim()),r.length))},C.prototype.ComputeCHAR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.parent.getValueFromArg(r[0]).trim(),-1<n.indexOf(e)?e:-1<e.indexOf('"TRUE"')||this.parent.isCellReference(r[0])&&e.startsWith(this.parent.tic)||(e=e.split(this.parent.tic).join(""),this.parent.isNumber(e)?e=Math.floor(Number(e)).toString():-1<e.indexOf("%")?e=Math.floor(Number(e.split("%")[0])/100).toString():e===this.parent.trueValue&&(e="1"),!e.toUpperCase().match(/^[0-9]+$/))||255<(e=parseInt(e,10))||e<=0?n[$.CommonErrors.Value]:String.fromCharCode(e))},C.prototype.ComputeCODE=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this.parent.getErrorStrings();if(z.isNullOrUndefined(t)||1===t.length&&""===t[0].trim())return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(1<t.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(r=this.parent.getValueFromArg(t[0]).trim(),!(-1<n.indexOf(r))){if(-1<t[0].indexOf(this.parent.tic)?r=t[0]!==r&&t[0].startsWith("n")?this.parent.removeTics(r.trim()):this.parent.removeTics(t[0].trim()):!t[0].startsWith("n")&&2===r.split("%").length&&this.parent.isNumber(r.split("%")[0])&&(r=(Number(r.split("%")[0])/100).toString()),""===r)return n[$.CommonErrors.Value];r=r.charCodeAt(0)}return r},C.prototype.ComputeDOLLAR=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(t.length&&"nestedFormulaTrue"===t[t.length-1]&&(r=!0,t.pop()),1===t.length&&(""===t[0]&&(i=!0),t.push("2")),z.isNullOrUndefined(t)||2!==t.length||i)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];for(var n=0;n<t.length;n++)if(-1<t[n].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(t[n])))return this.parent.getErrorStrings()[$.CommonErrors.Value];var i=this.parent.getValueFromArg(t[0]).split(this.parent.tic).join(""),o=this.parent.getValueFromArg(t[1]).split(this.parent.tic).join(""),i=""===i||i===this.parent.falseValue?"0":i===this.parent.trueValue?"1":i,o=""===o||o===this.parent.falseValue?"0":o===this.parent.trueValue?"1":o;if("#NAME?"===i||"#NAME?"===o)return this.parent.getErrorStrings()[$.CommonErrors.Name];if(!i.toUpperCase().match(/^[-]?[0-9.]+$/)||!o.toUpperCase().match(/^[-]?[0-9.]+$/))return this.parent.getErrorStrings()[$.CommonErrors.Value];for(var s=new z.Internationalization,a=parseInt(o,10),o=Math.pow(10,-1*a),l="",u=1;u<=a;u++)l+="0";i=Math.round(this.parent.parseFloat(i)/o)*o,o=isNaN(i)?this.parent.getErrorStrings()[$.CommonErrors.Value]:s.formatNumber(i,{format:"$#,##0."+l+";($#,##0."+l+");$0."+l});return o=r?this.parent.tic+o+this.parent.tic:o},C.prototype.ComputePROPER=function(){for(var r,t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=this.parent.getErrorStrings();return e.length&&"nestedFormulaTrue"===e[e.length-1]&&(t=!0,e.pop()),z.isNullOrUndefined(e)||""===e[0].trim()&&1===e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:1<e.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.parent.getValueFromArg(e[0]).trim(),-1<i.indexOf(r)||(-1<e[0].indexOf(this.parent.tic)?e[0]!==r&&e[0].startsWith("n")?r=this.parent.removeTics(r.trim()):-1<(r=this.parent.removeTics(e[0].trim())).indexOf(this.parent.tic+this.parent.tic)&&(r=r.replace(/""/g,this.parent.tic)):!e[0].startsWith("n")&&2===r.split("%").length&&this.parent.isNumber(r.split("%")[0])&&(r=(Number(r.split("%")[0])/100).toString()),r=r.toLowerCase().replace(/\b\w/g,function(r){return r.toUpperCase()}).replace(/(\d)([a-z])/g,function(r,t,e){return t+e.toUpperCase()}),t&&(r=this.parent.tic+r+this.parent.tic)),r)};var Je,rn,tn=C;function C(r){r=rn.call(this,r)||this;return r.isConcat=!1,r.formulas=[{formulaName:"FIND",category:"Text",description:"Returns the position of a string of text within another string."},{formulaName:"CONCATENATE",category:"Text",description:" Used to join two or more strings together."},{formulaName:"CONCAT",category:"Text",description:"Concatenates a list or range of text strings."},{formulaName:"T",category:"Text",description:"Checks whether a value is text or not and returns the text."},{formulaName:"EXACT",category:"Text",description:"Checks whether a two text strings are exactly same and returns TRUE or FALSE."},{formulaName:"LEN",category:"Text",description:"Returns a number of characters in a given string."},{formulaName:"CHAR",category:"Text",description:"Returns the character from the specified number."},{formulaName:"CODE",category:"Text",description:"Returns the numeric code for the first character in a given string."},{formulaName:"DOLLAR",category:"Text",description:"Converts the number to currency formatted text."},{formulaName:"PROPER",category:"Text",description:"Converts a text to proper case; first letter to uppercase and other letters to lowercase."}],r}en=function(r,t){return(en=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}en(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(b,nn=t),b.prototype.ComputeLEFT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.substringSide(r,!0)},b.prototype.ComputeRIGHT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.substringSide(r,!1)},b.prototype.substringSide=function(r,t){r&&0<r.length&&"nestedFormulaTrue"===r[r.length-1]&&(e=!0,r.pop());var e,n=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments];if(2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var i=this.resolveTextArg(r[0]);if(-1<n.indexOf(i))return i;var o=1;if(2===r.length){r=this.resolveNumberArg(r[1]);if("string"==typeof r)return r;if((o=Math.floor(r))<0)return n[$.CommonErrors.Value]}r=t?i.substring(0,o):o>=i.length?i:i.substring(i.length-o);return e?this.parent.tic+r+this.parent.tic:r},b.prototype.ComputeMID=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveTextArg(r[0]),-1<o.indexOf(e)?e:(n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),"string"==typeof n?n:"string"==typeof i?i:(n=Math.floor(n),i=Math.floor(i),n<1||i<0?o[$.CommonErrors.Value]:e.substring(n-1,n-1+i))))},b.prototype.ComputeUPPER=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.caseTransform(r,!0)},b.prototype.ComputeLOWER=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.caseTransform(r,!1)},b.prototype.caseTransform=function(r,t){var e=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveTextArg(r[0]),-1<e.indexOf(r)?r:t?r.toUpperCase():r.toLowerCase())},b.prototype.ComputeTRIM=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t&&0<t.length&&"nestedFormulaTrue"===t[t.length-1]&&(r=!0,t.pop());var n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(t)||1!==t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(n=this.resolveTextArg(t[0]),-1<i.indexOf(n)?n:(i=n.trim().replace(/\s+/g," "),r?this.parent.tic+i+this.parent.tic:i))},b.prototype.ComputeREPLACE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||4!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveTextArg(r[0]),-1<s.indexOf(e)?e:(i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]),n=this.resolveTextArg(r[3]),"string"==typeof i?i:"string"==typeof o?o:-1<s.indexOf(n)?n:(i=Math.floor(i),o=Math.floor(o),i<1||o<0?s[$.CommonErrors.Value]:e.substring(0,i-1)+n+e.substring(i-1+o))))},b.prototype.ComputeSUBSTITUTE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]),i=this.resolveTextArg(r[1]),o=this.resolveTextArg(r[2]);if(!(-1<e.indexOf(n))){if(-1<e.indexOf(i))return i;if(-1<e.indexOf(o))return o;if(""!==i){if(3===r.length)return n.split(i).join(o);var s=this.resolveNumberArg(r[3]);if("string"==typeof s)return s;var a=Math.floor(s);if(a<1)return e[$.CommonErrors.Value];for(var l=0,u=n.indexOf(i);-1<u;){if(++l===a)return n.substring(0,u)+o+n.substring(u+i.length);u=n.indexOf(i,u+i.length)}}}return n},b.prototype.ComputeREPT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveTextArg(r[0]),-1<i.indexOf(e)?e:"string"==typeof(n=this.resolveNumberArg(r[1]))?n:(n=Math.floor(n))<0?i[$.CommonErrors.Value]:0===n||""===e?"":new Array(n+1).join(e))},b.prototype.ComputeSEARCH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]).toLowerCase(),i=this.resolveTextArg(r[1]).toLowerCase();if(-1<e.indexOf(n))return n;if(-1<e.indexOf(i))return i;var o=1;if(3===r.length){var s=this.resolveNumberArg(r[2]);if("string"==typeof s)return s;if((o=Math.floor(s))<1)return e[$.CommonErrors.Value]}s=i.indexOf(n,o-1);return s<0?e[$.CommonErrors.Value]:(s+1).toString()},b.prototype.ComputeVALUE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveTextArg(r[0]),-1<n.indexOf(e)?e:""===e?"0":(e=e.replace(/,/g,"").replace(/\$/g,"").trim(),e=this.parent.parseFloat(e),isNaN(e)?n[$.CommonErrors.Value]:e.toString()))},b.prototype.ComputeCLEAN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]);if(-1<e.indexOf(n))return n;for(var i="",o=0;o<n.length;o++)32<=n.charCodeAt(o)&&(i+=n.charAt(o));return i},b.prototype.ComputeFIXED=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<1||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]);if("string"==typeof e)return e;var n=2;if(2<=r.length&&""!==r[1]){var i=this.resolveNumberArg(r[1]);if("string"==typeof i)return i;n=Math.floor(i)}i=!1;if(3===r.length&&""!==r[2]&&(i=(o=this.parent.getValueFromArg(r[2]).toUpperCase())===this.parent.trueValue||0!==this.parent.parseFloat(o)),n<0)return o=Math.pow(10,-n),o=Math.round(e/o)*o,i?o.toString():o.toLocaleString("en-US");var o=e.toFixed(n);if(i)return o;for(var e=o.split("."),s=e[0],n="-"===s.charAt(0)?"-":"",a=(n&&(s=s.substring(1)),""),l=0;l<s.length;l++){var u=s.length-l;0<l&&u%3==0&&(a+=","),a+=s.charAt(l)}return e[0]=n+a,e.join(".")},b.prototype.ComputeTEXTJOIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]);if(-1<e.indexOf(n))return n;for(var i=this.parent.getValueFromArg(r[1]).toUpperCase(),o=i===this.parent.trueValue||!isNaN(this.parent.parseFloat(i))&&0!==this.parent.parseFloat(i),s=[],a=2;a<r.length;a++){var l=r[a];if(this.parent.isCellReference(l)&&-1<l.indexOf(":"))for(var u=this.parent.getCellCollection(l),h=Array.isArray(u)?u:[u],p=0;p<h.length;p++){var g=this.parent.getValueFromArg(h[p]);if(-1<e.indexOf(g))return g;o&&""===g||s.push(g)}else{g=this.resolveTextArg(l);if(-1<e.indexOf(g))return g;o&&""===g||s.push(g)}}return s.join(n)},b.prototype.ComputeLEFTB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.ComputeLEFT.apply(this,r)},b.prototype.ComputeRIGHTB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.ComputeRIGHT.apply(this,r)},b.prototype.ComputeMIDB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.ComputeMID.apply(this,r)},b.prototype.ComputeREPLACEB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.ComputeREPLACE.apply(this,r)},b.prototype.ComputeSEARCHB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.ComputeSEARCH.apply(this,r)};var en,nn,on=b;function b(r){r=nn.call(this,r)||this;return r.formulas=[{formulaName:"LEFT",category:"Text",description:"Returns the leftmost characters from a text value."},{formulaName:"RIGHT",category:"Text",description:"Returns the rightmost characters from a text value."},{formulaName:"MID",category:"Text",description:"Returns a specific number of characters from a text string starting at the position you specify."},{formulaName:"UPPER",category:"Text",description:"Converts text to uppercase."},{formulaName:"LOWER",category:"Text",description:"Converts text to lowercase."},{formulaName:"TRIM",category:"Text",description:"Removes spaces from text except for single spaces between words."},{formulaName:"REPLACE",category:"Text",description:"Replaces characters within text."},{formulaName:"SUBSTITUTE",category:"Text",description:"Substitutes new text for old text in a text string."},{formulaName:"REPT",category:"Text",description:"Repeats text a given number of times."},{formulaName:"SEARCH",category:"Text",description:"Finds one text value within another (not case-sensitive)."},{formulaName:"VALUE",category:"Text",description:"Converts a text argument to a number."},{formulaName:"CLEAN",category:"Text",description:"Removes all nonprintable characters from text."},{formulaName:"FIXED",category:"Text",description:"Formats a number as text with a fixed number of decimals."},{formulaName:"TEXTJOIN",category:"Text",description:"Combines text from multiple ranges/strings with a delimiter."},{formulaName:"LEFTB",category:"Text",description:"Returns the leftmost characters from a text value (byte count alias)."},{formulaName:"RIGHTB",category:"Text",description:"Returns the rightmost characters from a text value (byte count alias)."},{formulaName:"MIDB",category:"Text",description:"Returns characters from a text string (byte count alias)."},{formulaName:"REPLACEB",category:"Text",description:"Replaces characters within text (byte count alias)."},{formulaName:"SEARCHB",category:"Text",description:"Finds one text value within another (byte count alias)."}],r}sn=function(r,t){return(sn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}sn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(un,an=t),un.prototype.ComputeASC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveTextArg(r[0]);if(-1<this.parent.getErrorStrings().indexOf(e))return e;for(var n="",i=0;i<e.length;i++){var o=e.charCodeAt(i);n+=65281<=o&&o<=65374?String.fromCharCode(o-65248):12288===o?" ":e.charAt(i)}return n},un.prototype.ComputeTEXTBEFORE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||6<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]);if(!(-1<e.indexOf(n))){var i=this.resolveTextArg(r[1]);if(-1<e.indexOf(i))return i;var o=1;if(3<=r.length&&""!==r[2]){var s=this.resolveNumberArg(r[2]);if("string"==typeof s)return s;if((o=Math.floor(s))<1)return e[$.CommonErrors.Value]}for(var a=0,l=0;l<o;l++){var u=n.indexOf(i,a);if(u<0)return 6<=r.length&&""!==r[5]?this.resolveTextArg(r[5]):e[$.CommonErrors.NA];if(l===o-1)return n.substring(0,u);a=u+i.length}}return n},un.prototype.ComputeVALUETOTEXT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.parent.getErrorStrings(),n=this.parent.getValueFromArg(r[0]);if(-1<e.indexOf(n))return n;if(""===n)return"";e=!0;if(2===r.length){var i=this.resolveNumberArg(r[1]);if("string"==typeof i)return i;e=0===i}return!e&&!this.parent.isCellReference(r[0])&&-1<r[0].indexOf(this.parent.tic)?this.parent.removeTics(n):n},un.prototype.ComputeARRAYTOTEXT=function(){for(var o,s,a=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return z.isNullOrUndefined(r)||r.length<1||2<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(o=this.parent.getErrorStrings(),s=[],function(r){if(a.parent.isCellReference(r)&&-1<r.indexOf(":"))for(var t=a.parent.getCellCollection(r),e=Array.isArray(t)?t:[t],n=0;n<e.length;n++){var i=a.parent.getValueFromArg(e[n]);if(-1<o.indexOf(i))return i;s.push(i)}else{i=a.resolveTextArg(r);if(-1<o.indexOf(i))return i;s.push(i)}return null}(r[0])||s.join(this.parent.getParseArgumentSeparator()))};var sn,an,ln=un;function un(r){r=an.call(this,r)||this;return r.formulas=[{formulaName:"ASC",category:"Text",description:"Changes full-width characters to half-width."},{formulaName:"TEXTBEFORE",category:"Text",description:"Returns text before a given character or string."},{formulaName:"VALUETOTEXT",category:"Text",description:"Returns text from any specified value."},{formulaName:"ARRAYTOTEXT",category:"Text",description:"Returns the text representation of an array."}],r}hn=function(r,t){return(hn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}hn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(fn,pn=t),fn.prototype.ComputeISNUMBER=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=r;return n&&"nestedFormulaTrue"===n[n.length-1]&&(e=!0,n.pop()),1===r.length&&""===r[0]?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]:1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:""===(n=this.parent.isCellReference(n[0])?this.parent.getValueFromArg(n[0]):this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))).toString()||r.toString().startsWith(this.parent.tic)?!!e&&"0":(n=!isNaN(this.parent.parseFloat(n)),e?n?"1":"0":n)};var hn,pn,gn=fn;function fn(r){r=pn.call(this,r)||this;return r.formulas=[{formulaName:"ISNUMBER",category:"Information",description:"Returns TRUE, if the argument is number and FALSE otherwise."}],r}mn=function(r,t){return(mn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}mn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(A,cn=t),A.prototype.requireOne=function(r){return z.isNullOrUndefined(r)||1!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:null},A.prototype.ComputeISBLANK=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireOne(r);return e||(this.parent.isCellReference(r[0]),""===this.parent.getValueFromArg(r[0]))},A.prototype.ComputeISTEXT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireOne(r);return e||(e=this.parent.getValueFromArg(r[0]),!(-1<this.parent.getErrorStrings().indexOf(e))&&""!==e&&e.toUpperCase()!==this.parent.trueValue&&e.toUpperCase()!==this.parent.falseValue&&(isNaN(this.parent.parseFloat(e))||!this.parent.isCellReference(r[0])&&-1<r[0].indexOf(this.parent.tic)))},A.prototype.ComputeISNONTEXT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.ComputeISTEXT.apply(this,r);return"string"==typeof e?e:!e},A.prototype.ComputeISLOGICAL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireOne(r);return e||(e=this.parent.getValueFromArg(r[0]).toUpperCase())===this.parent.trueValue||e===this.parent.falseValue},A.prototype.ComputeISERROR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireOne(r);return e||(e=this.parent.getValueFromArg(r[0]),-1<this.parent.getErrorStrings().indexOf(e))||/^#[A-Z/?!]+$/.test(e)},A.prototype.ComputeISERR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireOne(r);return e||(e=this.parent.getValueFromArg(r[0]))!==this.parent.getErrorStrings()[$.CommonErrors.NA]&&"#N/A"!==e&&(-1<this.parent.getErrorStrings().indexOf(e)||/^#[A-Z/?!]+$/.test(e))},A.prototype.ComputeISNA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireOne(r);return e||(e=this.parent.getValueFromArg(r[0]))===this.parent.getErrorStrings()[$.CommonErrors.NA]||"#N/A"===e},A.prototype.ComputeISEVEN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.parity(r,!0)},A.prototype.ComputeISODD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.parity(r,!1)},A.prototype.parity=function(r,t){var e=this.parent.getErrorStrings(),n=this.requireOne(r);return n||("string"==typeof(n=this.resolveNumberArg(r[0]))?e[$.CommonErrors.Value]:(r=(n<0?Math.ceil(n):Math.floor(n))%2==0,t?r:!r))},A.prototype.ComputeN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings(),n=this.requireOne(r);return n||(n=this.parent.getValueFromArg(r[0]),-1<e.indexOf(n)?n:n.toUpperCase()===this.parent.trueValue?"1":n.toUpperCase()===this.parent.falseValue||""===n||(e=this.parent.parseFloat(n),isNaN(e))?"0":e.toString())},A.prototype.ComputeNA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return(!r||1!==r.length||""!==r[0])&&r&&0<r.length&&(1!==r.length||""!==r[0])?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:this.parent.getErrorStrings()[$.CommonErrors.NA]},A.prototype.ComputeTYPE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireOne(r);return e||(e=this.parent.getValueFromArg(r[0]),-1<this.parent.getErrorStrings().indexOf(e)||/^#[A-Z/?!]+$/.test(e)?"16":e.toUpperCase()===this.parent.trueValue||e.toUpperCase()===this.parent.falseValue?"4":""===e||isNaN(this.parent.parseFloat(e))||!this.parent.isCellReference(r[0])&&-1!==r[0].indexOf(this.parent.tic)?"2":"1")};var mn,cn,dn=A;function A(r){r=cn.call(this,r)||this;return r.formulas=[{formulaName:"ISBLANK",category:"Information",description:"Returns TRUE if the value is blank."},{formulaName:"ISTEXT",category:"Information",description:"Returns TRUE if the value is text."},{formulaName:"ISNONTEXT",category:"Information",description:"Returns TRUE if the value is not text."},{formulaName:"ISLOGICAL",category:"Information",description:"Returns TRUE if the value is a logical value."},{formulaName:"ISERROR",category:"Information",description:"Returns TRUE if the value is any error value."},{formulaName:"ISERR",category:"Information",description:"Returns TRUE if the value is any error value except #N/A."},{formulaName:"ISNA",category:"Information",description:"Returns TRUE if the value is the #N/A error value."},{formulaName:"ISEVEN",category:"Information",description:"Returns TRUE if the number is even."},{formulaName:"ISODD",category:"Information",description:"Returns TRUE if the number is odd."},{formulaName:"N",category:"Information",description:"Returns a value converted to a number."},{formulaName:"NA",category:"Information",description:"Returns the error value #N/A."},{formulaName:"TYPE",category:"Information",description:"Returns a number indicating the data type of a value."}],r}Nn=function(r,t){return(Nn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Nn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Sn,vn=t),Sn.prototype.ComputeINFO=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]).toLowerCase();if(-1<e.indexOf(n))return n;if(-1===["system","release","numfile","directory","origin","recalc","memavail","memused"].indexOf(n))return e[$.CommonErrors.NA];var i=n;switch(i){case"system":return"pcdos";case"release":return"16.0";case"numfile":return"1";case"directory":return"/";case"origin":return"A1";case"recalc":return"Manual"===this.parent.parentObject.calculationMode?"Manual":"Automatic";case"memavail":return"1048576";case"memused":return"0";default:return i}},Sn.prototype.ComputeCELL=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveTextArg(r[0]).toLowerCase();if(-1<e.indexOf(n))return n;var i=(i=2===r.length?r[1]:this.parent.actCell||this.parent.cell||"A1").split("$").join("");if(!this.parent.isCellReference(i.split(":")[0]))return e[$.CommonErrors.Value];var i=-1<i.indexOf(":")?i.split(":")[0]:i,o=-1<i.indexOf("!")?i.substring(i.lastIndexOf("!")+1):i,s=this.parent.getValueFromArg(i);switch(n){case"address":return"$"+o.replace(/([A-Z]+)(\d+)/,"$1$$$2");case"col":return this.parent.colIndex(o).toString();case"row":return this.parent.rowIndex(o).toString();case"contents":return s;case"format":return"G";case"prefix":return"";case"protect":return"0";case"type":return""===s?"b":this.parent.isNumber(s)?"v":"l";case"width":return"8";case"parentheses":return"0";default:return e[$.CommonErrors.NA]}};var Nn,vn,En=Sn;function Sn(r){r=vn.call(this,r)||this;return r.formulas=[{formulaName:"INFO",category:"Information",description:"Returns information about the current operating environment."},{formulaName:"CELL",category:"Information",description:"Returns information about the formatting, location, or contents of a cell."}],r}yn=function(r,t){return(yn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}yn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(An,Cn=t),An.prototype.toSerial=function(r){var t=this.parent.getErrorStrings(),e=this.parent.getValueFromArg(r);return-1<t.indexOf(e)?e:""===(e=this.parent.isCellReference(r)?e:this.parent.removeTics(e))?t[$.CommonErrors.Value]:this.parent.isNumber(e)?Math.floor(this.parent.parseFloat(e)):(r=this.parent.isDate(new Date(e)))?Math.floor(this.parent.toOADate(r)):t[$.CommonErrors.Value]},An.prototype.holidaySet=function(r){var t=new Set;if(r&&""!==r){var e=this.parent.getErrorStrings();if(this.parent.isCellReference(r)&&-1<r.indexOf(":"))for(var n,i=this.parent.getCellCollection(r),o=Array.isArray(i)?i:[i],s=0;s<o.length;s++)if("string"==typeof(n=this.toSerial(o[s]))){if(-1<e.indexOf(n))return n}else t.add(n);else{if("string"==typeof(n=this.toSerial(r)))return n;t.add(n)}}return t},An.prototype.weekendMask=function(r){if(!r||""===r)return[!1,!1,!1,!1,!1,!0,!0];var t=this.parent.getErrorStrings(),e=this.resolveTextArg(r);if(-1<t.indexOf(e))return e;if(7===e.length&&/^[01]+$/.test(e)){for(var n=[],i=0;i<7;i++)n.push("1"===e.charAt(i));return n}r=this.resolveNumberArg(r);return"string"==typeof r?r:{1:[!1,!1,!1,!1,!1,!0,!0],2:[!0,!1,!1,!1,!1,!1,!0],3:[!0,!0,!1,!1,!1,!1,!1],4:[!1,!0,!0,!1,!1,!1,!1],5:[!1,!1,!0,!0,!1,!1,!1],6:[!1,!1,!1,!0,!0,!1,!1],7:[!1,!1,!1,!1,!0,!0,!1],11:[!0,!1,!1,!1,!1,!1,!1],12:[!1,!0,!1,!1,!1,!1,!1],13:[!1,!1,!0,!1,!1,!1,!1],14:[!1,!1,!1,!0,!1,!1,!1],15:[!1,!1,!1,!1,!0,!1,!1],16:[!1,!1,!1,!1,!1,!0,!1],17:[!1,!1,!1,!1,!1,!1,!0]}[Math.floor(r)]||t[$.CommonErrors.Num]},An.prototype.isWeekendMask=function(r,t){return t[(r.getDay()+6)%7]},An.prototype.ComputeDATEDIF=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||3!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.toSerial(r[0]),i=this.toSerial(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;var o=this.resolveTextArg(r[2]).toUpperCase();if(i<n)return e[$.CommonErrors.Num];var s=this.parent.fromOADate(n),a=this.parent.fromOADate(i);switch(o){case"Y":return(a.getFullYear()-s.getFullYear()-(a.getMonth()<s.getMonth()||a.getMonth()===s.getMonth()&&a.getDate()<s.getDate()?1:0)).toString();case"M":var l=12*(a.getFullYear()-s.getFullYear())+(a.getMonth()-s.getMonth());return a.getDate()<s.getDate()&&l--,l.toString();case"D":return(i-n).toString();case"MD":l=a.getDate()-s.getDate();return l<0&&(l+=new Date(a.getFullYear(),a.getMonth(),0).getDate()),l.toString();case"YM":l=a.getMonth()-s.getMonth();return a.getDate()<s.getDate()&&l--,l<0&&(l+=12),l.toString();case"YD":l=new Date(a.getFullYear(),s.getMonth(),s.getDate()),l=Math.round((a.getTime()-l.getTime())/864e5);return l<0&&(l+=this.isLeapYear(a.getFullYear())?366:365),l.toString();default:return e[$.CommonErrors.Num]}},An.prototype.isLeapYear=function(r){return r%4==0&&r%100!=0||r%400==0},An.prototype["ComputeNETWORKDAYS.INTL"]=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.toSerial(r[0]),n=this.toSerial(r[1]);if("string"==typeof e)return e;if("string"==typeof n)return n;var i=this.weekendMask(r[2]);if(!(i instanceof Array))return i;var o=this.holidaySet(r[3]);if(!(o instanceof Set))return o;for(var s=e<=n?1:-1,a=0,l=e;0<s?l<=n:n<=l;l+=s){var u=this.parent.fromOADate(l);this.isWeekendMask(u,i)||o.has(l)||(a+=s)}return a.toString()},An.prototype["ComputeWORKDAY.INTL"]=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.toSerial(r[0]),i=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;var o=this.weekendMask(r[2]);if(!(o instanceof Array))return o;var s=this.holidaySet(r[3]);if(!(s instanceof Set))return s;for(var a=n,l=0<=i?1:-1,u=Math.abs(Math.trunc(i));0<u;){a+=l;var h=this.parent.fromOADate(a);if(this.isWeekendMask(h,o)||s.has(a)||u--,a<0)return e[$.CommonErrors.Num]}return a.toString()};var yn,Cn,bn=An;function An(r){r=Cn.call(this,r)||this;return r.formulas=[{formulaName:"DATEDIF",category:"Date & Time",description:"Calculates the number of days, months, or years between two dates."},{formulaName:"NETWORKDAYS.INTL",category:"Date & Time",description:"Returns workdays between dates for a custom weekend."},{formulaName:"WORKDAY.INTL",category:"Date & Time",description:"Returns the date before or after a number of workdays with a custom weekend."}],r}On=function(r,t){return(On=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}On(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Vn,Fn=t),Vn.prototype["ComputeISO.CEILING"]=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<1||2<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]);if("string"==typeof e)return e;var n=1;if(2===r.length&&""!==r[1]){var i=this.resolveNumberArg(r[1]);if("string"==typeof i)return i;n=Math.abs(i)}return 0===e||0===n?"0":(Math.ceil(e/n)*n).toString()},Vn.prototype["ComputeECMA.CEILING"]=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),"string"==typeof e?e:"string"==typeof n?n:0===e||0===n?"0":0<e&&n<0?i[$.CommonErrors.Num]:(0<e||0<n?Math.ceil(e/n)*n:Math.floor(e/n)*n).toString())};var On,Fn,xn=Vn;function Vn(r){r=Fn.call(this,r)||this;return r.formulas=[{formulaName:"ISO.CEILING",category:"Math & Trig",description:"Rounds a number up to the nearest integer or multiple of significance."},{formulaName:"ECMA.CEILING",category:"Math & Trig",description:"Rounds a number up, away from zero, to the nearest multiple of significance."}],r}Rn=function(r,t){return(Rn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Rn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Mn,Tn=t),Mn.prototype["ComputeERROR.TYPE"]=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||1!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.parent.getValueFromArg(r[0]),i={"#NULL!":1,"#DIV/0!":2,"#VALUE!":3,"#REF!":4,"#NAME?":5,"#NUM!":6,"#N/A":7,"#GETTING_DATA":8};if(void 0!==i[n])return i[n].toString();for(var o=0;o<e.length;o++)if(n===e[o]){var s=o+1;if(1<=s&&s<=8)return s.toString()}return e[$.CommonErrors.NA]};var Rn,Tn,In=Mn;function Mn(r){r=Tn.call(this,r)||this;return r.formulas=[{formulaName:"ERROR.TYPE",category:"Information",description:"Returns a number corresponding to an error type."}],r}Dn=function(r,t){return(Dn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Dn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(jn,Un=t),jn.prototype.ComputeUSDOLLAR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.owner.ComputeDOLLAR;return e?e.apply(void 0,r):this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]},jn.prototype.ComputeFINDB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.owner.ComputeFIND;return e?e.apply(void 0,r):this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]},jn.prototype.ComputeLENB=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.owner.ComputeLEN;return e?e.apply(void 0,r):this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidArguments]};var Dn,Un,wn=jn;function jn(r){r=Un.call(this,r)||this;return r.formulas=[{formulaName:"USDOLLAR",category:"Text",description:"Converts a number to text using currency format (US dollar)."},{formulaName:"FINDB",category:"Text",description:"Finds text within another string (byte-count alias of FIND)."},{formulaName:"LENB",category:"Text",description:"Returns the length of a text string (byte-count alias of LEN)."}],r}O.prototype.yearDays=function(r){switch(r){case 1:case 3:return 365;default:return 360}},O.prototype.toDate=function(r){return this.parent.fromOADate(r)},O.prototype.toSerial=function(r){return this.parent.toOADate(r)},O.prototype.coupPCD=function(r,t,e){for(var t=this.toDate(t),n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),i=12/e;this.toSerial(n)>r;)n=this.addMonths(n,-i);return this.toSerial(n)>r?r:this.toSerial(n)},O.prototype.coupNCD=function(r,t,e){t=this.coupPCD(r,t,e);return t<=r&&(r=12/e,t=this.toSerial(this.addMonths(this.toDate(t),r))),t},O.prototype.coupDays=function(r,t,e,n){void 0===n&&(n=0);var i=this.coupPCD(r,t,e),r=this.coupNCD(r,t,e);return this.daysBetween(i,r,n)},O.prototype.coupDayBS=function(r,t,e,n){void 0===n&&(n=0);t=this.coupPCD(r,t,e);return this.daysBetween(t,r,n)},O.prototype.coupDaysNC=function(r,t,e,n){void 0===n&&(n=0);t=this.coupNCD(r,t,e);return this.daysBetween(r,t,n)},O.prototype.coupNum=function(r,t,e,n){for(var i=12/e,e=this.toDate(t),o=new Date(e.getFullYear(),e.getMonth(),e.getDate()),s=0;this.toSerial(o)>r;)s++,o=this.addMonths(o,-i);return s},O.prototype.daysBetween=function(r,t,e){var n;return 1===e?Math.round(t-r):(r=this.toDate(r),t=this.toDate(t),3===e?Math.abs(Math.round((t.getTime()-r.getTime())/864e5)):(e=r.getFullYear(),n=r.getMonth()+1,r=r.getDate(),360*(t.getFullYear()-e)+30*(t.getMonth()+1-n)+((e=31===(e=t.getDate())?30:e)-(r=31===r?30:r))))},O.prototype.addMonths=function(r,t){r=new Date(r.getTime());return r.setMonth(r.getMonth()+t),r};var Ln=O;function O(r){this.parent=r}kn=function(r,t){return(kn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}kn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(F,Pn=t),F.prototype.parseBondArgs=function(r,t,e){if(z.isNullOrUndefined(r)||r.length<t||r.length>e)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];t=this.resolveNumberArg(r[0]),e=this.resolveNumberArg(r[1]);if("string"==typeof t)return t;if("string"==typeof e)return e;t={settlement:t,maturity:e};if(3<=r.length){e=this.resolveNumberArg(r[2]);if("string"==typeof e)return e;t.rate=e}if(4<=r.length){e=this.resolveNumberArg(r[3]);if("string"==typeof e)return e;t.yld=e}if(5<=r.length){e=this.resolveNumberArg(r[4]);if("string"==typeof e)return e;t.redemption=e}return t.frequency=6<=r.length&&""!==r[5]?this.resolveNumberArg(r[5]):2,"string"==typeof t.frequency?t.frequency:(t.basis=7<=r.length&&""!==r[6]?this.resolveNumberArg(r[6]):0,"string"==typeof t.basis?t.basis:t)},F.prototype.coupArgs=function(r){if(z.isNullOrUndefined(r)||r.length<3||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var t=this.resolveNumberArg(r[0]),e=this.resolveNumberArg(r[1]),n=this.resolveNumberArg(r[2]);if("string"==typeof t)return t;if("string"==typeof e)return e;if("string"==typeof n)return n;var i=0;if(4===r.length&&""!==r[3]){r=this.resolveNumberArg(r[3]);if("string"==typeof r)return r;i=Math.floor(r)}return{settlement:t,maturity:e,frequency:Math.floor(n),basis:i}},F.prototype.ComputeCOUPDAYBS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.coupArgs(r);return"string"==typeof e?e:this.bond.coupDayBS(e.settlement,e.maturity,e.frequency,e.basis).toString()},F.prototype.ComputeCOUPDAYS=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.coupArgs(r);return"string"==typeof e?e:this.bond.coupDays(e.settlement,e.maturity,e.frequency,e.basis).toString()},F.prototype.ComputeCOUPDAYSNC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.coupArgs(r);return"string"==typeof e?e:this.bond.coupDaysNC(e.settlement,e.maturity,e.frequency,e.basis).toString()},F.prototype.ComputeCOUPNCD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.coupArgs(r);return"string"==typeof e?e:this.bond.coupNCD(e.settlement,e.maturity,e.frequency).toString()},F.prototype.ComputeCOUPNUM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.coupArgs(r);return"string"==typeof e?e:this.bond.coupNum(e.settlement,e.maturity,e.frequency,e.basis).toString()},F.prototype.ComputeCOUPPCD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.coupArgs(r);return"string"==typeof e?e:this.bond.coupPCD(e.settlement,e.maturity,e.frequency).toString()},F.prototype.ComputeACCRINT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=this.parent.getErrorStrings(),a=this.parseBondArgs(r,6,8);return"string"==typeof a?a:"string"==typeof(e=8<=r.length?this.resolveNumberArg(r[7]):a.settlement)?e:(e=a.rate,n=a.frequency,i=a.basis,o=this.bond.coupDayBS(a.settlement,a.maturity,n,i),0===(a=this.bond.coupDays(a.settlement,a.maturity,n,i))?s[$.CommonErrors.Num]:((7<=r.length&&""!==r[6]?this.resolveNumberArg(r[6]):1e3)*e/n*o/a).toString())},F.prototype.ComputeACCRINTM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<4||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=0;if(5===r.length&&""!==r[4]){var a=this.resolveNumberArg(r[4]);if("string"==typeof a)return a;s=Math.floor(a)}return(o*i*this.bond.daysBetween(e,n,s)/this.bond.yearDays(s)).toString()},F.prototype.ComputeISPMT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||4!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),o=this.resolveNumberArg(r[1]),n=this.resolveNumberArg(r[2]),i=this.resolveNumberArg(r[3]),"string"==typeof e?e:"string"==typeof o?o:"string"==typeof n?n:"string"==typeof i?i:(o=Math.floor(o))<1||n<o?s[$.CommonErrors.Num]:(-i*e*(1-(o-1)/n)).toString())},F.prototype.ComputeMDURATION=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.parseBondArgs(r,5,7);return"string"==typeof n?n:(1/(e=n.frequency)/(1+n.yld/e)).toString()},F.prototype.ComputePRICE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parseBondArgs(r,6,7);if("string"==typeof e)return e;for(var n=e.rate,i=e.yld,o=e.redemption,s=e.frequency,a=e.basis,l=this.bond.coupNum(e.settlement,e.maturity,s,a),u=this.bond.coupDaysNC(e.settlement,e.maturity,s,a),h=this.bond.coupDays(e.settlement,e.maturity,s,a),e=this.bond.coupDayBS(e.settlement,e.maturity,s,a),p=100*n/s,g=o/Math.pow(1+i/s,l-1+u/h),f=1;f<=l;f++)g+=p/Math.pow(1+i/s,f-1+u/h);return(g-=p*e/h).toString()},F.prototype.ComputePRICEDISC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<4||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=0;if(5===r.length&&""!==r[4]){var a=this.resolveNumberArg(r[4]);if("string"==typeof a)return a;s=Math.floor(a)}return(o*(1-i*this.bond.daysBetween(e,n,s)/this.bond.yearDays(s))).toString()},F.prototype.ComputePRICEMAT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<5||6<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]),s=this.resolveNumberArg(r[4]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;var a=0;if(6===r.length&&""!==r[5]){var l=this.resolveNumberArg(r[5]);if("string"==typeof l)return l;a=Math.floor(l)}l=this.bond.yearDays(a),e=this.bond.daysBetween(i,e,a);return((100+o*this.bond.daysBetween(i,n,a)/l)/(1+s*e/l)).toString()},F.prototype.ComputeTBILLPRICE=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z.isNullOrUndefined(n)||3!==n.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(n[0]),e=this.resolveNumberArg(n[1]),t=this.resolveNumberArg(n[2]),"string"==typeof r?r:"string"==typeof e?e:"string"==typeof t?t:(e=e-r)<=0?this.parent.getErrorStrings()[$.CommonErrors.Num]:(100*(1-t*e/360)).toString())},F.prototype.ComputeTBILLYIELD=function(){for(var r,t,e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z.isNullOrUndefined(n)||3!==n.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(n[0]),e=this.resolveNumberArg(n[1]),t=this.resolveNumberArg(n[2]),"string"==typeof r?r:"string"==typeof e?e:"string"==typeof t?t:(e=e-r)<=0||t<=0?this.parent.getErrorStrings()[$.CommonErrors.Num]:((100-t)/t*360/e).toString())},F.prototype.ComputeTBILLEQ=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.ComputeTBILLYIELD.apply(this,r),n=this.parent.getErrorStrings();return"string"==typeof e&&-1<n.indexOf(e)?e:(365*(n=this.parent.parseFloat(e))/(360-n*(this.resolveNumberArg(r[1])-this.resolveNumberArg(r[0])))).toString()},F.prototype.ComputeXNPV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]);if("string"==typeof n)return n;var i=[],o=[],s=this.parent.getCellCollection(r[1]),a=this.parent.getCellCollection(r[2]),l=Array.isArray(s)?s:[s],u=Array.isArray(a)?a:[a];if(l.length!==u.length||l.length<1)return e[$.CommonErrors.Num];for(var h=0;h<l.length;h++){var p=this.parent.getValueFromArg(l[h]),g=this.parent.getValueFromArg(u[h]);if(-1<e.indexOf(p))return p;if(-1<e.indexOf(g))return g;i.push(this.parent.parseFloat(p)),o.push(this.parent.parseFloat(g))}for(var f=o[0],m=0,h=0;h<i.length;h++)m+=i[h]/Math.pow(1+n,(o[h]-f)/365);return m.toString()},F.prototype.ComputeYIELD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.ComputePRICE.apply(this,r),n=this.parent.getErrorStrings();if("string"==typeof e&&(-1<n.indexOf(e)||e.match(/arguments/i)))return e;var i=this.parseBondArgs(r,6,7);if("string"==typeof i)return i;for(var o=this.parent.parseFloat(e),s=i.yld||.05,a=0;a<50;a++){i.yld=s;var l=this.parent.parseFloat(this.ComputePRICE(r[0],r[1],r[2],s.toString(),r[4],r[5],r[6]))-o;if(Math.abs(l)<1e-8)return s.toString();s+=1e-4*l}return s.toString()},F.prototype.ComputeYIELDDISC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<4||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=0;if(5===r.length&&""!==r[4]){var a=this.resolveNumberArg(r[4]);if("string"==typeof a)return a;s=Math.floor(a)}a=this.bond.daysBetween(e,n,s),e=this.bond.yearDays(s);return a<=0?this.parent.getErrorStrings()[$.CommonErrors.Num]:((o-i)/i*e/a).toString()},F.prototype.ComputeYIELDMAT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<5||6<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]),s=this.resolveNumberArg(r[3]),a=this.resolveNumberArg(r[4]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;if("string"==typeof a)return a;var l=0;if(6===r.length&&""!==r[5]){var u=this.resolveNumberArg(r[5]);if("string"==typeof u)return u;l=Math.floor(u)}u=this.bond.yearDays(l),n=this.bond.daysBetween(o,n,l),o=this.bond.daysBetween(o,i,l),i=a*n/u;return 0==i?e[$.CommonErrors.Num]:((100+s*o/u-a)/i).toString()};var kn,Pn,_n=F;function F(r){r=Pn.call(this,r)||this;return r.formulas=[{formulaName:"COUPDAYBS",category:"Financial",description:"Returns the number of days from the beginning of the coupon period to the settlement date."},{formulaName:"COUPDAYS",category:"Financial",description:"Returns the number of days in the coupon period that contains the settlement date."},{formulaName:"COUPDAYSNC",category:"Financial",description:"Returns the number of days from the settlement date to the next coupon date."},{formulaName:"COUPNCD",category:"Financial",description:"Returns the next coupon date after the settlement date."},{formulaName:"COUPNUM",category:"Financial",description:"Returns the number of coupons payable between settlement and maturity."},{formulaName:"COUPPCD",category:"Financial",description:"Returns the previous coupon date before the settlement date."},{formulaName:"ACCRINT",category:"Financial",description:"Returns the accrued interest for a security that pays periodic interest."},{formulaName:"ACCRINTM",category:"Financial",description:"Returns the accrued interest for a security that pays interest at maturity."},{formulaName:"ISPMT",category:"Financial",description:"Returns the interest paid during a specific period of an investment."},{formulaName:"MDURATION",category:"Financial",description:"Returns the modified Macauley duration for a security with an assumed par value of $100."},{formulaName:"PRICE",category:"Financial",description:"Returns the price per $100 face value of a security that pays periodic interest."},{formulaName:"PRICEDISC",category:"Financial",description:"Returns the price per $100 face value of a discounted security."},{formulaName:"PRICEMAT",category:"Financial",description:"Returns the price per $100 face value of a security that pays interest at maturity."},{formulaName:"TBILLEQ",category:"Financial",description:"Returns the bond-equivalent yield for a Treasury bill."},{formulaName:"TBILLPRICE",category:"Financial",description:"Returns the price per $100 face value for a Treasury bill."},{formulaName:"TBILLYIELD",category:"Financial",description:"Returns the yield for a Treasury bill."},{formulaName:"XNPV",category:"Financial",description:"Returns the net present value for a schedule of cash flows that is not necessarily periodic."},{formulaName:"YIELD",category:"Financial",description:"Returns the yield on a security that pays periodic interest."},{formulaName:"YIELDDISC",category:"Financial",description:"Returns the annual yield for a discounted security."},{formulaName:"YIELDMAT",category:"Financial",description:"Returns the annual yield of a security that pays interest at maturity."}],r.bond=new Ln(r.parent),r}Wn=function(r,t){return(Wn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Wn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Xn,qn=t),Xn.prototype.ComputeAMORLINC=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s,a,l=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||r.length<6||7<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.resolveNumberArg(r[0]),a=this.resolveNumberArg(r[1]),n=this.resolveNumberArg(r[2]),i=this.resolveNumberArg(r[3]),o=this.resolveNumberArg(r[4]),s=this.resolveNumberArg(r[5]),"string"==typeof e?e:"string"==typeof a?a:"string"==typeof n?n:"string"==typeof i?i:"string"==typeof o?o:"string"==typeof s?s:(a=Math.floor(o))<0?l[$.CommonErrors.Num]:Math.min((e-i)*s*(a+1),e-i).toString())},Xn.prototype.ComputeAMORDEGRC=function(){for(var r,t,e,n,i,o,s,a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];return z.isNullOrUndefined(a)||a.length<7||8<a.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(r=this.resolveNumberArg(a[0]),t=this.resolveNumberArg(a[1]),e=this.resolveNumberArg(a[2]),n=this.resolveNumberArg(a[3]),i=this.resolveNumberArg(a[4]),o=this.resolveNumberArg(a[5]),s=8<=a.length?this.resolveNumberArg(a[7]):0,"string"==typeof r?r:"string"==typeof t?t:"string"==typeof e?e:"string"==typeof n?n:"string"==typeof i?i:"string"==typeof o?o:"string"==typeof s?s:this.ComputeAMORLINC(a[0],a[1],a[2],a[3],a[4],(o*(o<.03?1:o<.05?1.5:o<.1?2:2.5)).toString()))},Xn.prototype.oddBondPrice=function(r,t){if(z.isNullOrUndefined(r)||r.length<7||9<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]),i=this.resolveNumberArg(r[2]),o=this.resolveNumberArg(r[3]),s=this.resolveNumberArg(r[4]),a=this.resolveNumberArg(r[5]),l=this.resolveNumberArg(r[6]);if("string"==typeof e)return e;if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;if("string"==typeof s)return s;if("string"==typeof a)return a;if("string"==typeof l)return l;var u=8<=r.length&&""!==r[7]?this.resolveNumberArg(r[7]):2,i=9<=r.length&&""!==r[8]?this.resolveNumberArg(r[8]):0;if("string"==typeof u)return u;if("string"==typeof i)return i;var h=this.bond.coupNum(e,n,u,i),p=100*s/u,g=this.bond.daysBetween(e,t?o:n,i),f=this.bond.coupDays(e,n,u,i)||180,m=l/Math.pow(1+a/u,h+g/f);m+=p*g/f;for(var c=1;c<=h;c++)m+=p/Math.pow(1+a/u,c-1+g/f);return m.toString()},Xn.prototype.ComputeODDFPRICE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.oddBondPrice(r,!0)},Xn.prototype.ComputeODDLPRICE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this.oddBondPrice(r,!1)},Xn.prototype.oddBondYield=function(r,t){for(var e=t[6],n=.05,i=this.parent.parseFloat(this.resolveNumberArg(e)),o=0;o<50;o++){var s=t.slice(0,6).concat([n.toString()],t.slice(7)),s=this.parent.parseFloat(r.apply(void 0,s))-i;if(Math.abs(s)<1e-6)return n.toString();n-=1e-4*s}return n.toString()},Xn.prototype.ComputeODDFYIELD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return z.isNullOrUndefined(r)||r.length<8||9<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:this.oddBondYield(this.ComputeODDFPRICE.bind(this),r)},Xn.prototype.ComputeODDLYIELD=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return z.isNullOrUndefined(r)||r.length<8||9<r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:this.oddBondYield(this.ComputeODDLPRICE.bind(this),r)};var Wn,qn,Bn=Xn;function Xn(r){r=qn.call(this,r)||this;return r.formulas=[{formulaName:"AMORDEGRC",category:"Financial",description:"Returns the depreciation for each accounting period using a depreciation coefficient."},{formulaName:"AMORLINC",category:"Financial",description:"Returns the depreciation for each accounting period."},{formulaName:"ODDFPRICE",category:"Financial",description:"Returns the price per $100 face value of a security with an odd first period."},{formulaName:"ODDFYIELD",category:"Financial",description:"Returns the yield of a security with an odd first period."},{formulaName:"ODDLPRICE",category:"Financial",description:"Returns the price per $100 face value of a security with an odd last period."},{formulaName:"ODDLYIELD",category:"Financial",description:"Returns the yield of a security with an odd last period."}],r.bond=new Ln(r.parent),r}Yn=function(r,t){return(Yn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Yn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(Zn,Hn=Bt),Zn.prototype.ComputeBETADIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=0,a=1;if(4<=r.length&&""!==r[3]){var l=this.resolveNumberArg(r[3]);if("string"==typeof l)return l;s=l}if(5<=r.length&&""!==r[4]){var l=this.resolveNumberArg(r[4]);if("string"==typeof l)return l;a=l}return n<s||a<n||i<=0||o<=0||a<=s||(l=Ir((n-s)/(a-s),i,o),isNaN(l))?e[$.CommonErrors.Num]:l.toString()},Zn.prototype.ComputeBETAINV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||5<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]),o=this.resolveNumberArg(r[2]);if("string"==typeof n)return n;if("string"==typeof i)return i;if("string"==typeof o)return o;var s=0,a=1;if(4<=r.length&&""!==r[3]){var l=this.resolveNumberArg(r[3]);if("string"==typeof l)return l;s=l}if(5<=r.length&&""!==r[4]){l=this.resolveNumberArg(r[4]);if("string"==typeof l)return l;a=l}l=Mr(n,i,o);return isNaN(l)?e[$.CommonErrors.Num]:(s+l*(a-s)).toString()},Zn.prototype.ComputeTDIST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.resolveNumberArg(r[0]),n=this.resolveNumberArg(r[1]);if("string"==typeof e)return e;if("string"==typeof n)return n;var i=1;if(3===r.length&&""!==r[2]){var o=this.resolveNumberArg(r[2]);if("string"==typeof o)return o;i=Math.floor(o)}o=Rr(Math.abs(e),n);return(1===i?1-o:2*(1-o)).toString()},Zn.prototype.ComputeTINV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.resolveNumberArg(r[0]),i=this.resolveNumberArg(r[1]);if("string"==typeof n)return n;if("string"==typeof i)return i;var o=2;if(3===r.length&&""!==r[2]){var s=this.resolveNumberArg(r[2]);if("string"==typeof s)return s;o=Math.floor(s)}s=Tr(1===o?1-n:1-n/2,i);return isNaN(s)?e[$.CommonErrors.Num]:s.toString()},Zn.prototype.ComputeTTEST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||r.length<3||4<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.collectSample([r[0]],!1),i=this.collectSample([r[1]],!1);if("string"==typeof n)return n;if("string"==typeof i)return i;if(n.length<2||i.length<2)return e[$.CommonErrors.DivZero];for(var o=this.mean(n),s=this.mean(i),a=0,l=0,u=0;u<n.length;u++)a+=Math.pow(n[u]-o,2);for(u=0;u<i.length;u++)l+=Math.pow(i[u]-s,2);a/=n.length-1,l/=i.length-1;var h=Math.sqrt(a/n.length+l/i.length);if(0===h)return e[$.CommonErrors.DivZero];var e=Math.abs(o-s)/h,h=n.length+i.length-2,p=2;if(4===r.length&&""!==r[3]){var g=this.resolveNumberArg(r[3]);if("string"==typeof g)return g;p=Math.floor(g)}g=Rr(e,h);return(1===p?1-g:2*(1-g)).toString()},Zn.prototype.ComputeFTEST=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n,i,o,s=this.parent.getErrorStrings();return z.isNullOrUndefined(r)||2!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:(e=this.collectSample([r[0]],!1),n=this.collectSample([r[1]],!1),"string"==typeof e?e:"string"==typeof n?n:e.length<2||n.length<2||(i=this.sampleVar(e),0===(o=this.sampleVar(n)))?s[$.CommonErrors.DivZero]:(s=i/o,i=e.length-1,o=n.length-1,(2*Math.min(Er(s,i,o),Er(1/s,o,i))).toString()))},Zn.prototype.sampleVar=function(r){for(var t=this.mean(r),e=0,n=0;n<r.length;n++)e+=Math.pow(r[n]-t,2);return e/(r.length-1)},Zn.prototype.ComputeFREQUENCY=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.parent.getErrorStrings();if(z.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var n=this.collectSample([r[0]],!1),i=this.collectSample([r[1]],!1);if("string"==typeof n)return n;if("string"==typeof i)return i;if(0===i.length)return e[$.CommonErrors.Num];for(var o=i.slice().sort(function(r,t){return r-t}),s=new Array(o.length+1).fill(0),a=0;a<n.length;a++){for(var l=n[a],u=!1,h=0;h<o.length;h++)if(l<=o[h]){s[h]++,u=!0;break}u||s[s.length-1]++}e=this.parent.getParseArgumentSeparator();return s.join(e)};var Yn,Hn,Gn=Zn;function Zn(r){r=Hn.call(this,r)||this;return r.formulas=[{formulaName:"BETADIST",category:"Statistical",description:"Returns the beta cumulative distribution function."},{formulaName:"BETAINV",category:"Statistical",description:"Returns the inverse of the beta cumulative distribution function."},{formulaName:"TDIST",category:"Statistical",description:"Returns the Student t-distribution."},{formulaName:"TINV",category:"Statistical",description:"Returns the inverse of the Student t-distribution."},{formulaName:"TTEST",category:"Statistical",description:"Returns the probability associated with a Student t-test."},{formulaName:"FTEST",category:"Statistical",description:"Returns the result of an F-test."},{formulaName:"FREQUENCY",category:"Statistical",description:"Returns the frequency distribution of a range of values."}],r}Kn=function(r,t){return(Kn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Kn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(x,$n=t),x.prototype.readRange=function(r){var t=this.parent.getErrorStrings();if(!this.parent.isCellReference(r))return t[$.CommonErrors.Value];for(var t=-1<r.indexOf(":")?r.split(":"):[r,r],r=this.parent.rowIndex(t[0]),e=this.parent.colIndex(t[0]),n=this.parent.rowIndex(t[1]),t=this.parent.colIndex(t[1]),i=Math.min(r,n),o=Math.max(r,n),s=Math.min(e,t),a=Math.max(e,t),l=[],u=i;u<=o;u++){for(var h=[],p=s;p<=a;p++){var g=J(p)+u;h.push(this.parent.getValueFromArg(g))}l.push(h)}return l},x.prototype.fieldIndex=function(r,t){var e=this.parent.getErrorStrings(),r=this.resolveTextArg(r);if(-1<e.indexOf(r))return r;var n=this.parent.parseFloat(r);if(!isNaN(n)&&1<=n&&n<=t.length)return Math.floor(n)-1;for(var i=r.toUpperCase(),o=0;o<t.length;o++)if(t[o].toUpperCase()===i)return o;return e[$.CommonErrors.Value]},x.prototype.matchCriteria=function(r,t,e){for(var n=0;n<t.length;n++){for(var i=t[n],o=!0,s=0;s<e.length;s++){var a=i[s];if(void 0!==a&&""!==a){var l=r[s];if(!this.matchesCriterion(l,a)){o=!1;break}}}if(o)return!0}return!1},x.prototype.matchesCriterion=function(r,t){var e=t.trim();if(""===e)return!0;for(var n=[">=","<=","<>",">","<","="],i=0;i<n.length;i++){var o=n[i];if(e.startsWith(o)){var s=e.substring(o.length).trim(),a=this.parent.parseFloat(r),l=this.parent.parseFloat(s);if(!isNaN(a)&&!isNaN(l))switch(o){case">=":return l<=a;case"<=":return a<=l;case"<>":return a!==l;case">":return l<a;case"<":return a<l;case"=":return a===l;default:return o}return"="===o||""===o?r.toUpperCase()===s.toUpperCase():"<>"===o&&r.toUpperCase()!==s.toUpperCase()}}return e.includes("*")||e.includes("?")?new RegExp("^"+e.replace(/\*/g,".*").replace(/\?/g,".")+"$","i").test(r):r.toUpperCase()===e.toUpperCase()},x.prototype.collectMatching=function(r,t,e,n){var i=this.readRange(r);if("string"==typeof i)return i;if(i.length<2)return this.parent.getErrorStrings()[$.CommonErrors.Value];var o=i[0],s=this.fieldIndex(t,o);if("string"==typeof s)return s;r=this.readRange(e);if("string"==typeof r)return r;if(r.length<2)return this.parent.getErrorStrings()[$.CommonErrors.Value];for(var a=r[0],l=r.slice(1),u=[],h=this,p=1;p<i.length;p++)!function(r){var e=i[r],r=o.map(function(r,t){return e[t]||""}),t=l.map(function(e){return a.map(function(r,t){return e[t]||""})});if(!h.matchCriteria(r,t,o))return;r=e[s]||"";""!==r&&h.parent.isNumber(r)&&u.push(h.parent.parseFloat(r))}(p);return u},x.prototype.requireThree=function(r){return z.isNullOrUndefined(r)||3!==r.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:null},x.prototype.mean=function(r){return r.reduce(function(r,t){return r+t},0)/r.length},x.prototype.variance=function(r,t){for(var e=this.mean(r),n=0,i=0;i<r.length;i++)n+=Math.pow(r[i]-e,2);return n/(t?r.length:r.length-1)},x.prototype.ComputeDAVERAGE=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireThree(r);return e||("string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:0===e.length?this.parent.getErrorStrings()[$.CommonErrors.DivZero]:this.mean(e).toString())},x.prototype.ComputeDCOUNT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireThree(r);return e||("string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:e.length.toString())},x.prototype.ComputeDCOUNTA=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireThree(r);if(e)return e;var n=this.readRange(r[0]);if("string"==typeof n)return n;var i=n[0],o=this.fieldIndex(r[1],i);if("string"==typeof o)return o;var s=this.readRange(r[2]);if("string"==typeof s)return s;for(var a=s.slice(1),l=0,u=1;u<n.length;u++){var h=n[u],p=a.map(function(e){return s[0].map(function(r,t){return e[t]||""})});this.matchCriteria(h,p,i)&&""!==(h[o]||"")&&l++}return l.toString()},x.prototype.ComputeDGET=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.requireThree(r);return n||(n=this.parent.getErrorStrings(),"string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!1))?e:0===e.length?n[$.CommonErrors.NA]:1<e.length?n[$.CommonErrors.Num]:e[0].toString())},x.prototype.ComputeDMAX=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireThree(r);return e||("string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:0===e.length?this.parent.getErrorStrings()[$.CommonErrors.NA]:Math.max.apply(Math,e).toString())},x.prototype.ComputeDMIN=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireThree(r);return e||("string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:0===e.length?this.parent.getErrorStrings()[$.CommonErrors.NA]:Math.min.apply(Math,e).toString())},x.prototype.ComputeDPRODUCT=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireThree(r);return e||("string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:0===e.length?"0":e.reduce(function(r,t){return r*t},1).toString())},x.prototype.ComputeDSUM=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=this.requireThree(r);return e||("string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:e.reduce(function(r,t){return r+t},0).toString())},x.prototype.ComputeDSTDEV=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.requireThree(r);return n||(n=this.parent.getErrorStrings(),"string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:e.length<2?n[$.CommonErrors.DivZero]:Math.sqrt(this.variance(e,!1)).toString())},x.prototype.ComputeDSTDEVP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.requireThree(r);return n||(n=this.parent.getErrorStrings(),"string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:e.length<1?n[$.CommonErrors.DivZero]:Math.sqrt(this.variance(e,!0)).toString())},x.prototype.ComputeDVAR=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.requireThree(r);return n||(n=this.parent.getErrorStrings(),"string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:e.length<2?n[$.CommonErrors.DivZero]:this.variance(e,!1).toString())},x.prototype.ComputeDVARP=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e,n=this.requireThree(r);return n||(n=this.parent.getErrorStrings(),"string"==typeof(e=this.collectMatching(r[0],r[1],r[2],!0))?e:e.length<1?n[$.CommonErrors.DivZero]:this.variance(e,!0).toString())};var Kn,$n,zn=x;function x(r){r=$n.call(this,r)||this;return r.formulas=[{formulaName:"DAVERAGE",category:"Database",description:"Averages the values in a column of a list or database that match criteria."},{formulaName:"DCOUNT",category:"Database",description:"Counts the cells that contain numbers in a column of a list or database that match criteria."},{formulaName:"DCOUNTA",category:"Database",description:"Counts nonblank cells in a column of a list or database that match criteria."},{formulaName:"DGET",category:"Database",description:"Extracts a single value from a column of a list or database that matches criteria."},{formulaName:"DMAX",category:"Database",description:"Returns the maximum value from a column of a list or database that matches criteria."},{formulaName:"DMIN",category:"Database",description:"Returns the minimum value from a column of a list or database that matches criteria."},{formulaName:"DPRODUCT",category:"Database",description:"Multiplies values in a column of a list or database that match criteria."},{formulaName:"DSTDEV",category:"Database",description:"Estimates the standard deviation of a population based on a sample of entries that match criteria."},{formulaName:"DSTDEVP",category:"Database",description:"Calculates the standard deviation of a population based on entries that match criteria."},{formulaName:"DSUM",category:"Database",description:"Adds the numbers in the field column of records in the database that match the criteria."},{formulaName:"DVAR",category:"Database",description:"Estimates variance based on a sample of entries that match criteria."},{formulaName:"DVARP",category:"Database",description:"Calculates variance based on the entire population of entries that match criteria."}],r}Qn=function(r,t){return(Qn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};(function(r,t){function e(){this.constructor=r}Qn(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(ti,Jn=Bt),ti.prototype.linearRegression=function(r,t){t=this.collectPair([t,r]);if("string"==typeof t)return t;var e=t.x,n=t.y;if(e.length<2)return this.parent.getErrorStrings()[$.CommonErrors.NA];for(var i=this.mean(e),o=this.mean(n),s=0,a=0,l=0;l<e.length;l++){var u=e[l]-i;s+=u*u,a+=u*(n[l]-o)}return 0===s?this.parent.getErrorStrings()[$.CommonErrors.DivZero]:{slope:r=a/s,intercept:o-r*i}},ti.prototype.expRegression=function(r,t){t=this.collectPair([t,r]);if("string"==typeof t)return t;var e=t.x,n=t.y,i=this.parent.getErrorStrings();if(e.length<2)return i[$.CommonErrors.NA];for(var o=[],s=0;s<n.length;s++){if(n[s]<=0)return i[$.CommonErrors.Num];o.push(Math.log(n[s]))}for(var a=this.mean(e),l=this.mean(o),u=0,h=0,s=0;s<e.length;s++){var p=e[s]-a;u+=p*p,h+=p*(o[s]-l)}return 0===u?i[$.CommonErrors.DivZero]:(r=h/u,{b:Math.exp(l-r*a),m:r})},ti.prototype.ComputeLINEST=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||t.length<2||4<t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.linearRegression(t[0],t[1]))?r:r.slope.toString()},ti.prototype.ComputeLOGEST=function(){for(var r,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return z.isNullOrUndefined(t)||t.length<2||4<t.length?this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.expRegression(t[0],t[1]))?r:r.b.toString()},ti.prototype.ComputeTREND=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.linearRegression(r[0],r[1]);if("string"==typeof e)return e;if(3===r.length&&""!==r[2]){var n=this.collectSample([r[2]],!1);if("string"==typeof n)return n;if(0===n.length)return this.parent.getErrorStrings()[$.CommonErrors.NA];n=n[0]}else{var i=this.collectSample([r[1]],!1);if("string"==typeof i)return i;n=i[i.length-1]+1}return(e.intercept+e.slope*n).toString()},ti.prototype.ComputeGROWTH=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(z.isNullOrUndefined(r)||r.length<2||3<r.length)return this.parent.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];var e=this.expRegression(r[0],r[1]);if("string"==typeof e)return e;if(3===r.length&&""!==r[2]){var n=this.collectSample([r[2]],!1);if("string"==typeof n)return n;if(0===n.length)return this.parent.getErrorStrings()[$.CommonErrors.NA];n=n[0]}else{var i=this.collectSample([r[1]],!1);if("string"==typeof i)return i;n=i[i.length-1]+1}return(e.b*Math.pow(Math.E,e.m*n)).toString()};var Qn,Jn,ri=ti;function ti(r){r=Jn.call(this,r)||this;return r.formulas=[{formulaName:"LINEST",category:"Statistical",description:"Returns statistics that describe a linear trend."},{formulaName:"LOGEST",category:"Statistical",description:"Returns statistics that describe an exponential curve."},{formulaName:"GROWTH",category:"Statistical",description:"Returns numbers in an exponential growth trend."},{formulaName:"TREND",category:"Statistical",description:"Returns numbers in a linear trend."}],r}ni.prototype.init=function(){for(var r=0;r<this.formulas.length;r++){var t=this.formulas[r],e=this["Compute"+t.formulaName];this.addFormulaCollection(t.formulaName.toUpperCase(),e,t.category,t.description)}},ni.prototype.addFormulaCollection=function(r,t,e,n){this.parent.libraryFormulas={fName:r,handler:t,category:e,description:n}};var ei=ni;function ni(r){this.formulas=[],this.isConcat=!1,this.parent=r;for(var t=[new W(this),new Z(this),new tr(this),new ir(this),new ar(this),new wr(this),new Pr(this),new zr(this),new tt(this),new it(this),new lt(this),new gt(this),new dt(this),new Et(this),new bt(this),new xt(this),new It(this),new Ut(this),new Lt(this),new _t(this),new Gt(this),new zt(this),new te(this),new oe(this),new le(this),new ge(this),new ce(this),new ve(this),new ye(this),new Ae(this),new xe(this),new Ie(this),new we(this),new ke(this),new qe(this),new He(this),new ze(this),new tn(this),new on(this),new ln(this),new gn(this),new dn(this),new En(this),new bn(this),new xn(this),new In(this),new wn(this),new _n(this),new Bn(this),new Gn(this),new zn(this),new ri(this)],e=0;e<t.length;e++)for(var n=t[e],i=0;i<n.formulas.length;i++){var o=n.formulas[i],s=(this.formulas.push(o),"Compute"+o.formulaName),o=-1<o.formulaName.indexOf(".")?n[s]:z.getValue(s,n);o&&(this[s]=o.bind(n))}this.init()}function ii(r,t){for(var e=t.length,n=0;n<e;n++)if(t[n].sheet.toUpperCase()===r.toUpperCase())return t[n].index;return-1}V.prototype.parse=function(t,e){var n=this;if(!this.parent.isTextEmpty(t)){if(D(t))return this.parent.getErrorStrings()[$.CommonErrors.Ref];this.parent.getFormulaCharacter()!==String.fromCharCode(0)&&this.parent.getFormulaCharacter()===t[0]&&(t=t.substring(1)),(0<this.parent.namedRanges.size||0<this.parent.storedData.size)&&(t=this.checkForNamedRangeAndKeyValue(t),this.findNamedRange=!1);var r,i,o=this.storeStrings(t),s=(t=(t=(t=this.storedStringText).replace(/[-+*/&^]+/g,function(r){for(var t="";1<r.length;)switch(r.substring(0,2)){case"++":case"--":r="+"+r.substring(2);break;case"+-":case"-+":r="-"+r.substring(2);break;case"*+":r="*"+r.substring(2);break;case"/+":r="/"+r.substring(2);break;case"^+":r="^"+r.substring(2);break;case"&+":r="&"+r.substring(2);break;case"*-":case"/-":case"^-":case"&-":t=r.substring(0,1),r=r.substring(1);break;default:throw new U(n.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidExpression],!0)}return t+r})).split("-(-").join("("),0);-1<(t=(t=(t=(t=z.isNullOrUndefined(o)?t.split(" ").join(""):t).split("=>").join(">=")).split("=<").join("<="))[t.length-1]===this.parent.arithMarker&&this.indexOfAny(t,this.tokens)===t.length-2?t:t.toUpperCase()).indexOf(this.sheetToken)&&null!=(r=this.parent.getSheetFamilyItem(this.parent.grid)).sheetNameToParentObject&&0<r.sheetNameToParentObject.size&&(t[0]!==this.sheetToken.toString()&&(t=this.parent.setTokensForSheets(t)),r=this.parent.getSheetToken(t.split(this.parent.tic).join(this.emptyStr)),i=this.checkScopedRange(t.split('"').join(this.emptyStr).split(this.sheetToken).join("")),z.isNullOrUndefined(r))&&""!==r&&0<this.parent.namedRanges.size&&""!==i&&(t=i),t=this.processIndexArg(t),t=this.markLibraryFormulas(t);try{t=this.formulaAutoCorrection(t)}catch(r){if(!(u={message:r.message,exception:r,isForceCalculable:r.formulaCorrection,computeForceCalculate:!1}).isForceCalculable)throw this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidExpression];if(this.isFailureTriggered||(this.parent.trigger("onFailure",u),this.isFailureTriggered=!0),!u.isForceCalculable||!u.computeForceCalculate)throw this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidExpression];t=this.formulaAutoCorrection(t,u),this.parent.storedData.get(e).formulaText="="+t}if(!this.ignoreBracet)for(s=t.indexOf(")");-1<s;){var a=t.substring(0,s).lastIndexOf("(");if(-1===a)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.MismatchedParentheses]);if(a===s-1)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.EmptyExpression]);var l=this.emptyStr,l=this.ignoreBracet?this.parent.substring(t,a,s-a+1):this.parent.substring(t,a+1,s-a-1);try{t=t.substring(0,a)+this.parseSimple(l)+t.substring(s+1)}catch(r){if(r===this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CircularReference])throw r;var u=this.exceptionArgs(r),a=(this.isFailureTriggered||(this.parent.trigger("onFailure",u),this.isFailureTriggered=!0),"string"==typeof u.exception?u.exception:u.message);return(this.parent.getErrorLine(r)?"":"#"+this.parent.getErrorLine(r)+": ")+a}s=t.indexOf(")")}if(!this.ignoreBracet&&-1<t.indexOf("("))throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.MismatchedParentheses]);t=this.parseSimple(t),null!==o&&0<o.size&&(t=this.setStrings(t,o))}return t},V.prototype.exceptionArgs=function(r){return{message:r.message,exception:r,isForceCalculable:r.formulaCorrection,computeForceCalculate:!1}},V.prototype.formulaAutoCorrection=function(r,t){var e,n,i=["*","+","-","/","^","&"],o=[">","=","<"],s=0,a="",l="",u="",h=0;if(-1<this.parent.formulaErrorStrings.indexOf(r))return r;if(-1<this.indexOfAny(r,this.specialSym))throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.InvalidExpression],!1);for(r=r.split("-*").join("-").split("/*").join("/").split("*/").join("*").split("-/").join("-").split("*+").join("*").split("+*").join("+");s<r.length;)if(this.parent.isDigit(r[s])&&r.length>s+1&&-1<this.indexOfAny(r[s+1],i)&&r.length>s+2&&!z.isNullOrUndefined(r[s+2])&&-1<this.indexOfAny(r[s+2],i)&&("-"!==r[s+2]||"*"!==r[s+1]&&"/"!==r[s+1]&&"^"!==r[s+1]&&"&"!==r[s+1])){if(!t||!t.computeForceCalculate)throw this.parent.formulaErrorStrings[$.FormulasErrorsStrings.ImproperFormula];this.parent.isDigit(r[s])?(h<1?(n=r[s],l=r[s+1],h+=1,a=a+n+(l="&"===(l=z.isNullOrUndefined(l)?this.emptyStr:l)?"":l)):h<2&&(n=r[s],e=r[s-1],u=r[s+1],h=0,a="-"===e?a+e+n+(u="&"===(u=z.isNullOrUndefined(u)?this.emptyStr:u)?"":u):a+n+(u=z.isNullOrUndefined(u)?this.emptyStr:u)),s+=2):(a="-"===r[s]?a+r[s]:a,s+=1)}else if((this.parent.isDigit(r[s])||r[s]===this.parent.rightBracket||this.parent.storedData.has(r[s].toUpperCase()))&&(z.isNullOrUndefined(r[s+1])||-1<this.indexOfAny(r[s+1],i)&&"&"!==r[s+1]))e="&"===(e=z.isNullOrUndefined(r[s+1])?this.emptyStr:r[s+1])&&"-"!==r[s+2]?"":e,a="-"===r[s-1]?a+r[s-1]+r[s]+e:a+r[s]+e,s+=2;else if(-1<this.indexOfAny(r[s],o)&&!z.isNullOrUndefined(r[s-1])&&!z.isNullOrUndefined(r[s+1]))a+=r[s],s+=1;else if("q"===r[s])for(;r[s]!==this.parent.leftBracket;)a+=r[s],s+=1;else(r[s]===this.parent.leftBracket||r[s]===this.parent.rightBracket||"{"===r[s]||"}"===r[s]||"("===r[s]||")"===r[s]||this.parent.isUpperChar(r[s])||-1<r[s].indexOf(":")||r[s]===this.parent.getParseArgumentSeparator()||"%"===r[s]&&this.parent.isDigit(r[s-1])||this.isOtherLangChar(r[s])||r[s]===this.parent.tic||" "===r[s]||r[s]===this.parent.getParseDecimalSeparator()||r[s]===this.sheetToken||"$"===r[s]||"_"===r[s]||(this.parent.isDigit(r[s])&&(a="-"===r[s-1]?a+r[s-1]+r[s]:a+r[s]),"-"!==r[s]&&"+"!==r[s]||(a=(a+=r[s]).split("++").join("+").split("+-").join("-").split("-+").join("-")),"/"!==r[s]&&"*"!==r[s]&&"^"!==r[s]||(a+=r[s]),"&"===r[s]))&&(a+=r[s]),s+=1;return a=a===this.emptyStr?r:a,a=(a=-1<this.indexOfAny(a[a.length-1],i)?a.substring(0,a.length-1):a).split("--").join("-").split("-+").join("-").split("+-").join("-")},V.prototype.checkScopedRange=function(n){var i,r,t,o=this,s=(this.emptyStr,"NaN"),e=this.parent.getSheetID(this.parent.grid),a=this.parent.getSheetFamilyItem(this.parent.grid),l=(n[0]===this.sheetToken.toString()&&(r=n.indexOf(this.sheetToken,1),t=parseInt(n.substr(1,r-1),10),1<r)&&!this.parent.isNaN(t)&&(n=n.substring(r+1),e=t),"!"+e.toString());return null!==a&&null!=a.sheetNameToToken&&a.sheetNameToToken.forEach(function(r,t){var e;a.sheetNameToToken.get(t).toString()===l+"!"&&(e=o.emptyStr,o.parent.namedRanges.forEach(function(r,t){e=z.isNullOrUndefined(o.parent.parentObject)?a.sheetNameToToken.get(t).toUpperCase():o.parent.parentObject.getActiveSheet().name+o.sheetToken+n.toUpperCase(),o.parent.getNamedRanges().has(e)&&(i=o.parent.getNamedRanges().get(e).toUpperCase(),s=i)}))}),s},V.prototype.storeStrings=function(r){var t,e,n,i=0,o=0,s=null;if(-1<r.indexOf(this.parent.tic))for(i=r.indexOf(this.parent.tic);-1<i&&0<r.length;){if(null===s&&(s=this.stringsColl),-1===(t=i+1<r.length?r.indexOf(this.parent.tic,i+1):-1))throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.MismatchedTics]);n=this.parent.substring(r,i,t-i+1),e=this.parent.tic+this.spaceString+o.toString()+this.parent.tic,s=s.set(e,n),r=r.substring(0,i)+e+r.substring(t+1),(i+=e.length)<=r.length&&(i=r.indexOf(this.parent.tic,i)),o++}return this.storedStringText=r,s},V.prototype.setStrings=function(e,r){return r.forEach(function(r,t){e=e.split(t).join(r)}),e},V.prototype.parseSimple=function(r){var t,e,n,i,o,s,a,l,u,h,p,g;return"#DIV/0!"===(r=0<r.length&&"+"===r[0]?r.substring(1):r)?"#DIV/0!":"#NAME?"===r?"#NAME?":(""===r||-1<this.parent.formulaErrorStrings.indexOf(r)||(r=(r=(r=(r=(r=(r=r.split(this.stringLessEq).join(this.charLessEq)).split(this.stringGreaterEq).join(this.charGreaterEq)).split(this.stringNoEqual).join(this.charNoEqual)).split(this.stringAnd).join(this.charAnd)).split(this.stringOr).join(this.charOr)).split(this.fixedReference).join(this.emptyStr),t=[this.tokenEp,this.tokenEm],e=[this.tokenMultiply,this.tokenDivide],n=[this.tokenAdd,this.tokenSubtract],i=[this.charMultiply,this.charDivide],o=[this.charAdd,this.charSubtract],s=[this.tokenLess,this.tokenGreater,this.tokenEqual,this.tokenLessEq,this.tokenGreaterEq,this.tokenNotEqual],a=[this.charLess,this.charGreater,this.charEqual,this.charLessEq,this.charGreaterEq,this.charNoEqual],l=[this.charEp,this.charEm],u=[this.tokenAnd],h=[this.charAnd],p=[this.charOr],g=[this.tokenOr],r=this.parseSimpleOperators(r,t,l),r=this.parseSimpleOperators(r,g,p),r=this.parseSimpleOperators(r,e,i),r=this.parseSimpleOperators(r,n,o),r=this.parseSimpleOperators(r,s,a),r=this.parseSimpleOperators(r,u,h)),r)},V.prototype.parseSimpleOperators=function(r,t,e){if(-1<this.parent.getErrorStrings().indexOf(r))return r;for(var n=r,i=0,o="",s=0;s<e.length;s++)o+=e[s];0<(n=(n=(n=n.split("---").join("-").split("--").join("+").split(this.parent.getParseArgumentSeparator()+"-").join(this.parent.getParseArgumentSeparator()+"u").split(this.parent.leftBracket+"-").join(this.parent.leftBracket+"u").split("=-").join("=u")).split(",+").join(",").split(this.parent.leftBracket+"+").join(this.parent.leftBracket).split("=+").join("=").split(">+").join(">").split("<+").join("<").split("/+").join("/").split("*+").join("*").split("++").join("+").split("*-").join("*u").split("/-").join("/u").split("w-").join("wu").split("i-").join("iu").toString()).split(">-").join(">u").split("<-").join("<u").split("h-").join("hu").split("f-").join("fu").split("z-").join("zu")).length&&"-"===n[0]?(r=String.fromCharCode(132),n=n.substring(1).split("-").join(r),n=(n=this.parseSimpleOperators(n="0-"+n,[this.tokenSubtract],[this.charSubtract])).split(r).join("-")):0<n.length&&"+"===n[0]?n=n.substring(1):0<n.length&&"+"===n[n.length-1]&&(n=n.substring(0,n.length-1));try{if(-1<this.indexOfAny(n,e)){if(n.includes(" ")){for(var a="",l=0;l<n.length;l++){var u=n[l];0<=e.indexOf(u)?a=a.trim()+u:" "===u&&0<=e.indexOf(a[a.length-1])||(a+=u)}n=a}for(var i=this.indexOfAny(n,e),h=this.parent.getParseDecimalSeparator();-1<i;){var p="",g="",f=0,m=0,c=!1,d=["*","+","-","/","w","=","<",">"],N=n[i]===this.charNOTop,v=0;if(N)f=i;else if(n[v=i-1]===this.parent.arithMarker){if((S=this.findLeftMarker(n.substring(0,v-1)))<0)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CannotParse]);p=this.parent.substring(n,S+1,v-S-1),f=S+1}else if(n[v]===this.parent.rightBracket){for(var E=0,S=v-1;0<S&&("q"!==n[S]||0!==E);)"q"===n[S]?E--:n[S]===this.parent.rightBracket&&E++,S--;if(S<0)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CannotParse]);p=this.parent.substring(n,S,v-S+1),f=S}else if(n[v]===this.parent.tic[0]){var y=n.substring(0,v-1).lastIndexOf(this.parent.tic);if(y<0)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CannotParse]);p=this.parent.substring(n,y,v-y+1),f=y}else{for(var C=!1;-1<v&&(this.parent.isDigit(n[v])||!C&&(n[v]===h||"%"===n[v]));)this.parent.isDigit(n[v])||"%"===n[v]||(C=!0),v-=1;if(-1<v&&C&&n[v]===h)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.NumberContains2DecimalPoints]);if(0===(v+=1)||0<v&&!this.parent.isUpperChar(n[v-1]))p="n"+this.parent.substring(n,v,i-v),f=v;else if(0<v&&"E"===n[v-1]&&("TRUE"===n.substring(v-4,v)&&(z.isNullOrUndefined(n[v-5])||-1<d.indexOf(n[v-5]))||"FALSE"===n.substring(v-5,v)&&(z.isNullOrUndefined(n[v-6])||-1<d.indexOf(n[v-6])))&&("TRUE"===n.substring(v+1,v+5)||"FALSE"===n.substring(v+1,v+6)))v="TRUE"===n.substring(v-4,v)?v-4:v-5,p="TRUE"===n.substring(v,i)?"n1":"FALSE"===n.substring(v,i)?"n0":p,f=v,c=!0;else{for(v-=1;-1<v&&(this.parent.isUpperChar(n[v])||this.parent.isDigit(n[v])||"_"===n[v]);)v-=1;if(-1<v&&n[v]===this.sheetToken){for(v-=1;-1<v&&n[v]!==this.sheetToken;)v-=1;-1<v&&n[v]===this.sheetToken&&(v-=1)}if(-1<v&&":"===n[v]){for(v-=1;-1<v&&this.parent.isDigit(n[v]);)v-=1;for(;-1<v&&this.parent.isUpperChar(n[v]);)v-=1;if(-1<v&&n[v]===this.sheetToken){for(v--;-1<v&&n[v]!==this.sheetToken;)v--;-1<v&&n[v]===this.sheetToken&&v--}v+=1,p=this.parent.substring(n,v,i-v),p=this.parent.getCellFrom(p)}else{var b=!1;(b=0<v&&!this.parent.isUpperChar(n[v])?"u"===n[v]&&n[v-1]===this.parent.getParseArgumentSeparator():b)||(v+=1),p=this.parent.substring(n,v,i-v)}this.parent.updateDependentCell(p),f=v}(0<this.parent.namedRanges.size&&this.parent.namedRanges.has(p.toUpperCase())||this.parent.storedData.has(p.toUpperCase()))&&(p="n"+this.checkForNamedRangeAndKeyValue(p))}if(i===n.length-1)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.ExpressionCannotEndWithAnOperator]);if((b="u"===n[v=i+1])&&(v+=1),n[v]===this.parent.tic[0]){if((S=n.substring(v+1).indexOf(this.parent.tic))<0)throw this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CannotParse];g=this.parent.substring(n,v,S+2),m=S+v+2}else if(n[v]===this.parent.arithMarker){if((S=this.findRightMarker(n.substring(v+1)))<0)throw new U(this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CannotParse]);g=this.parent.substring(n,v+1,S),m=S+v+2}else if("q"===n[v]){for(E=0,S=v+1;S<n.length&&(n[S]!==this.parent.rightBracket||0!==E);)n[S]===this.parent.rightBracket?E++:"q"===n[S]&&E--,S++;if(S===n.length)throw this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CannotParse];g=this.parent.substring(n,v,S-v+1),b&&(g="u"+g),m=S+1}else if(this.parent.isDigit(n[v])||n[v]===h){C=n[v]===h;for(v+=1;v<n.length&&(this.parent.isDigit(n[v])||!C&&n[v]===h);)n[v]===h&&(C=!0),v+=1;if(v<n.length&&"%"===n[v]&&(v+=1),C&&v<n.length&&n[v]===h)throw this.parent.formulaErrorStrings[$.FormulasErrorsStrings.NumberContains2DecimalPoints];g="n"+this.parent.substring(n,i+1,v-i-1),m=v}else if(this.parent.isUpperChar(n[v])||n[v]===this.sheetToken||"u"===n[v]){if(n[v]===this.sheetToken)for(v+=1;v<n.length&&n[v]!==this.sheetToken;)v+=1;v+=1;for(var A=0,O=!1;v<n.length&&(this.parent.isUpperChar(n[v])||"_"===n[v]||n[v]===h||"["===n[v]||"]"===n[v]||"#"===n[v]||" "===n[v]||"%"===n[v]||n[v]===h&&O);)v!==n.length-1&&"["===n[v]&&"["===n[v+1]&&(O=!0),v!==n.length-1&&"]"===n[v]&&"]"===n[v+1]&&(O=!1),v++,A++;var F=v===n.length||!this.parent.isDigit(n[v]);if(1<A){for(;v<n.length&&(this.parent.isUpperChar(n[v])||this.parent.isDigit(n[v])||" "===n[v]||"_"===n[v]);)v++;F=!0}for(;v<n.length&&this.parent.isDigit(n[v]);)v+=1;if(v<n.length&&":"===n[v]){if((v+=1)<n.length&&n[v]===this.sheetToken){for(v++;v<n.length&&n[v]!==this.sheetToken;)v+=1;v<n.length&&n[v]===this.sheetToken&&v++}for(;v<n.length&&this.parent.isUpperChar(n[v]);)v+=1;for(;v<n.length&&this.parent.isDigit(n[v]);)v+=1;v-=1,g=this.parent.substring(n,i+1,v-i),g=this.parent.getCellFrom(g)}else v-=1,g=this.parent.substring(n,i+1,v-i),(b="u"===n[v])&&(g="u"+g);(F=F&&g.startsWith(this.sheetToken)?!this.parent.isCellReference(g):F)||this.parent.updateDependentCell(g),(0<this.parent.namedRanges.size&&this.parent.namedRanges.has(g.toUpperCase())||this.parent.storedData.has(g.toUpperCase()))&&(g="n"+this.checkForNamedRangeAndKeyValue(g));var x=-1<["*","+","-","/","w"].indexOf(n[v-g.length]),g="TRUE"===g&&(c||x)?"n1":"FALSE"===g&&(c||x)?"n0":g,m=v+1}var V=o.indexOf(n[i]),R=this.parent.arithMarker+p+g+t[V]+this.parent.arithMarker;0<f&&(R=n.substring(0,f)+R),m<n.length&&(R+=n.substring(m)),n=R=R.split(this.parent.arithMarker2).join(this.parent.arithMarker.toString()),i=this.indexOfAny(n,e)}}else if(0<n.length&&(this.parent.isUpperChar(n[0])||n[0]===this.sheetToken)){for(var T=!0,I=!0,M=!1,D=n.length,S=0;S<D;++S)if(n[S]===this.sheetToken){if(0<S&&!M)throw this.parent.getErrorStrings()[$.CommonErrors.Ref];for(M=!0,S++;S<D&&this.parent.isDigit(n[S]);)S++;if(S===D||n[S]!==this.sheetToken){T=!1;break}}else{if(!I&&this.parent.isChar(n[S])){T=!1;break}if(!this.parent.isChar(n[S])&&!this.parent.isDigit(n[S])&&n[S]!==this.sheetToken){T=!1;break}I=this.parent.isUpperChar(n[S])}T&&this.parent.updateDependentCell(n)}return n}catch(r){throw this.parent.formulaErrorStrings[$.FormulasErrorsStrings.CircularReference],r}},V.prototype.indexOfAny=function(r,t){for(var e=0;e<r.length;e++)if(-1<t.indexOf(r[e]))return e;return-1},V.prototype.findLeftMarker=function(r){var t=-1;if(-1<r.indexOf(this.parent.arithMarker))for(var e=0,n=r.length-1;0<=n;--n)if(r[n]===this.parent.rightBracket)e--;else if(r[n]===this.parent.leftBracket)e++;else if(r[n]===this.parent.arithMarker&&0===e){t=n;break}return t},V.prototype.findRightMarker=function(r){var t=-1;if(-1<r.indexOf(this.parent.arithMarker))for(var e=0,n=0;n<r.length;++n)if(r[n]===this.parent.rightBracket)e--;else if(r[n]===this.parent.leftBracket)e++;else if(r[n]===this.parent.arithMarker&&0===e){t=n;break}return t},V.prototype.parseFormula=function(t,e){if(-1<(t=0<t.length&&t[0]===this.parent.getFormulaCharacter()?t.substring(1):t).indexOf("#REF!"))return this.parent.getErrorStrings()[$.CommonErrors.Ref];0<t.length&&"+"===t[0]&&(t=t.substring(1));try{this.isFailureTriggered=!1,this.isError=!1,t=this.parse(t.trim(),e),this.isFormulaParsed=!0}catch(r){e=this.exceptionArgs(r),e=(this.isFailureTriggered||(this.parent.trigger("onFailure",e),this.isFailureTriggered=!0),"string"==typeof e.exception?e.exception:e.message);t=(z.isNullOrUndefined(this.parent.getErrorLine(r))?"":"#"+this.parent.getErrorLine(r)+": ")+e,this.isError=!0}return t},V.prototype.markLibraryFormulas=function(g){var f=0,m=g.indexOf(")");if(-1===m)g=this.markNamedRanges(g);else for(var c=this;-1<m;){var r=function(){for(var r=0,t=m-1;-1<t&&("("!==g[t]||0!==r);)")"===g[t]&&r++,t--;if(-1===t)throw new U(c.parent.formulaErrorStrings[$.FormulasErrorsStrings.MismatchedParentheses]);for(var e=t-1;-1<e&&(c.parent.isChar(g[e])||c.parent.isDigit(g[e])||"."===g[e]);)e--;var n=t-e-1,i=c.parent.substring(g,e+1,n);if(0<n&&!z.isNullOrUndefined(c.parent.getFunction(i))&&(!i.includes(".")||c.isValidDotFormulaName(i))){var o=c.parent.substring(g,t,m-t+1),s=c.parent.getParseArgumentSeparator();if("AREAS"===i)c.ignoreBracet=!0;else if(c.ignoreBracet=!1,(i.includes("IFS")&&"COUNTIFS"!==i||"MATCH"===i)&&o.includes("{")&&(a=o.indexOf("{"),u=c.parent.substring(o,a,o.indexOf("}")-a+1),o=o.split(u).join(u.split(s).join(c.parent.tic+c.parent.tic))),("VLOOKUP"===i||"HLOOKUP"===i)&&o.includes("{"))for(var a=o.indexOf("{",0);-1<a;){var l=o.indexOf("}",a);if(!(a<l))break;var u,l=(u=c.parent.substring(o,a,l-a+1)).split(";").join(c.parent.tic+"RSEP"+c.parent.tic).split(s).join(c.parent.tic+"CSEP"+c.parent.tic);o=o.split(u).join(l),l=a+l.length,a=o.indexOf("{",l)}try{var h=void 0;o=o.split("(").join("").split(")").join(""),o="("+c.formulaAutoCorrection(o,h)+")"}catch(r){if(!(h={message:r.message,exception:r,isForceCalculable:r.formulaCorrection,computeForceCalculate:!1}).isForceCalculable)throw c.parent.formulaErrorStrings[$.FormulasErrorsStrings.ImproperFormula];if(c.isFailureTriggered||(c.parent.trigger("onFailure",h),c.isFailureTriggered=!0,f+=1),h.computeForceCalculate=0<f||h.computeForceCalculate,!h.isForceCalculable)throw c.parent.formulaErrorStrings[$.FormulasErrorsStrings.ImproperFormula];if(!h.computeForceCalculate)throw c.parent.formulaErrorStrings[$.FormulasErrorsStrings.ImproperFormula];o=o.split("(").join("").split(")").join(""),o="("+c.formulaAutoCorrection(o,h)+")"}o=c.markNamedRanges(o),o=c.swapInnerParens(o),-1===(o=c.addParensToArgs(o)).lastIndexOf(s)&&2<o.length&&"("===o[0]&&")"===o[o.length-1]&&"{"!==o[1]&&"("!==o[1]&&(o=(o=o.substring(0,o.length-1)+"}"+o.substring(o.length-1))[0]+"{"+o.substring(1)),g=g.substring(0,e+1)+"q"+c.parent.substring(g,e+1,n)+o.split("(").join(c.parent.leftBracket).split(")").join(c.parent.rightBracket)+g.substring(m+1)}else{var p=function(r){var t;return!!r.includes("IFERROR(")&&(t=r.lastIndexOf("("),"IFERROR"===r.substring(t-7,t)||p(r.substring(0,t)))};if(0<n&&!p(g.substring(0,e+1)))return{value:c.parent.getErrorStrings()[$.CommonErrors.Name]};i=c.emptyStr,i=(i=0<t?g.substring(0,t):i)+"{"+c.parent.substring(g,t+1,m-t-1)+"}";m<g.length&&(i+=g.substring(m+1)),i=c.markNamedRanges(i),g=i}m=g.indexOf(")")}();if("object"==typeof r)return r.value}return g=g.split("{").join("(").split("}").join(")")},V.prototype.swapInnerParens=function(r){return r=2<r.length?r[0]+r.substr(1,r.length-2).split("(").join("{").split(")").join("}")+r[r.length-1]:r},V.prototype.addParensToArgs=function(r){if(0===r.length)return this.emptyStr;var t=[],e=(t.push(this.parent.getParseArgumentSeparator()),t.push(this.parent.rightBracket),r.lastIndexOf(this.parent.getParseArgumentSeparator())),n=0;if(-1===e)2<r.length&&"("===r[0]&&")"===r[r.length-1]&&("{"!==r[1]&&"("!==r[1]?r=(r=r.substring(0,r.length-1)+"}"+r.substring(r.length-1))[0]+"{"+r.substring(1):(e=this.lastIndexOfAny(r,["+","-","*","/"]),0<(n=0===n&&")"===r[r.length-1]?r.length-1:n)&&"{"!==r[e+1]&&"}"===r[e-1]&&(r=(r=r.substr(0,n)+"}"+r.substr(n)).substr(0,e+1)+"{"+r.substr(e+1))));else for(var i=!0;-1<e;){var o=this.indexOfAny(r.substring(e+1,r.length),t);0<=o?o=e+o+1:-1===o&&")"===r[r.length-1]&&(o=r.length-1),e=(r=0<o&&"{"!==r[e+1]&&"}"!==r[o-1]&&"¢"!==r[o-1]?(r=r.substr(0,o).trim()+"}"+r.substr(o)).substr(0,e+1)+"{"+r.substr(e+1).trim():r).substr(0,e).lastIndexOf(this.parent.getParseArgumentSeparator()),i&&-1===e&&"("===r[0]&&(e=0,i=!1)}return r=r.split("{}").join(this.emptyStr)},V.prototype.lastIndexOfAny=function(r,t){for(var e=r.length-1;-1<e;e--)if(-1<t.indexOf(r[e]))return e;return-1},V.prototype.markNamedRanges=function(r){for(var t=[")",this.parent.getParseArgumentSeparator(),"}","+","-","*","/","<",">","=","&",":"],e=0<r.length&&("("===r[0]||"{"===r[0])?1:0,n=(-1<(r=-1<r.indexOf("#N/A")?r.split("#N/A").join("#N~A"):r).indexOf("#DIV/0!")&&(r=r.split("#DIV/0!").join("#DIV~0!")),this.indexOfAny(r.substring(e),t));-1<n&&n+e<r.length;){var i=this.emptyStr,o=null;if(-1<this.parent.substring(r,e,n).indexOf("[")?o=this.getTableRange(this.parent.substring(r,e,n)):(this.parent.storedData.has(this.parent.substring(r,e,n))||this.parent.namedRanges.has(this.parent.substring(r,e,n)))&&(o=this.checkForNamedRangeAndKeyValue(this.parent.substring(r,e,n))),z.isNullOrUndefined(o)&&("NaN"!==(i=this.checkScopedRange(this.parent.substring(r,e,n)))?(this.findNamedRange=!0,o=i):this.parent.substring(r,e,n).startsWith(this.sheetToken.toString()),!z.isNullOrUndefined(o))&&this.findNamedRange&&-1<o.indexOf(this.fixedReference)&&(o=o.split(this.fixedReference).join(this.emptyStr)),z.isNullOrUndefined(o)||(o=o.toUpperCase(),o=this.parent.setTokensForSheets(o),o=this.markLibraryFormulas(o)),z.isNullOrUndefined(o)||o===this.emptyStr)for(e+=n+1;e<r.length&&!this.parent.isUpperChar(r[e])&&r[e]!==this.sheetToken;)e++;else r=r.substring(0,e)+o+r.substring(e+n),e+=o.length+1;for((n=e)<r.length-1&&"{"===r[e]&&(e+=1),n=this.indexOfAny(r.substring(e),t);0===n&&e<r.length-1;)e++,n=this.indexOfAny(r.substring(e),t);(-1===n||-1<r.substring(e).indexOf("["))&&e<r.length&&(o=-1<r.substring(e).indexOf("[")?this.getTableRange(r.substring(e)):this.parent.storedData.has(r.substring(e))?0<this.parent.storedData.size?this.checkForNamedRangeAndKeyValue(r.substring(e)):o:0<this.parent.namedRanges.size?this.checkForNamedRangeAndKeyValue(r.substring(e)):o,z.isNullOrUndefined(o)&&"NaN"!==(i=this.checkScopedRange(r.substring(e)))&&(o=i),z.isNullOrUndefined(o)||o===this.emptyStr||(o=o.toUpperCase(),o=this.parent.setTokensForSheets(o),null!=(o=this.markLibraryFormulas(o))&&(r=")"===(i=r.substring(e))[i.length-1]?r.substring(0,e)+o+")":r.substring(0,e)+o,e+=o.toString().length+1)),n=e<r.length?this.indexOfAny(r.substring(e),t):-1)}return r=-1<(r=-1<r.indexOf("#N~A")?r.split("#N~A").join("#N/A"):r).indexOf("#DIV~0!")?r.split("#DIV~0!").join("#DIV/0!"):r},V.prototype.checkForNamedRangeAndKeyValue=function(r){var t,e;this.emptyStr;return-1<r.indexOf("[")&&(t=this.getTableRange(r),z.isNullOrUndefined(t)||(this.findNamedRange=!0,r=t)),"NaN"!==(t=this.checkScopedRange(r))?(this.findNamedRange=!0,r=t):(-1<r.indexOf(this.sheetToken)&&(t=this.parent.getSheetFamilyItem(this.parent.grid),e=(e=r.split('"').join(this.emptyStr)).substr(0,e.indexOf(this.sheetToken)),t.sheetNameToToken.has(e.toUpperCase()))&&parseInt(t.sheetNameToToken.get(e.toUpperCase()).split(this.sheetToken).join(this.emptyStr)),0<this.parent.storedData.size&&this.parent.storedData.has(r)&&(r="A"+this.parent.colIndex(r)),0<this.parent.namedRanges.size&&this.parent.namedRanges.has(r.toUpperCase())&&(z.isNullOrUndefined(this.parent.parentObject)?(r=this.parse(this.parent.namedRanges.get(r.toUpperCase())),-1<(r=this.parent.setTokensForSheets(r)).indexOf(this.fixedReference)&&r.split(this.fixedReference).join(this.emptyStr),this.findNamedRange=!0):r=this.parse(this.parent.namedRanges.get(r.toUpperCase()))),this.findNamedRange&&"!"!==r[0]&&"q"!==r[0]&&"bq"!==r[0]&&-1<(r=this.parent.setTokensForSheets(r)).indexOf(this.fixedReference)&&(r=r.split(this.fixedReference).join(this.emptyStr))),r},V.prototype.getTableRange=function(r){r=(r=r.replace(" ",this.emptyStr).toUpperCase()).replace("]",this.emptyStr).replace("#DATA",this.emptyStr);-1<r.indexOf(this.parent.getParseArgumentSeparator())&&(r.substring(0,r.indexOf(this.parent.getParseArgumentSeparator())).replace("[",this.emptyStr),r=r.replace("[",this.emptyStr).replace(this.parent.getParseArgumentSeparator(),"_")),this.emptyStr;return r.toUpperCase()},V.prototype.findNextEndIndex=function(r,t){for(var e=0,n=t,i=!1;!i&&t<r.length;)"["===r[n]?e++:"]"===r[n]&&0===--e&&(i=!0),t++;return t-=n},V.prototype.processIndexArg=function(r){var t=r.indexOf("INDEX((");if(-1!==t){t=t+("INDEX((".length-1);if(-1!==t){for(var e=0,n=-1,i=t;i<r.length;i++)if("("===r[i]?e++:")"===r[i]&&e--,0===e){n=i;break}t<n&&(r=r.slice(0,t)+this.parent.tic+r.slice(t+1,n)+this.parent.tic+r.slice(n+1))}}return r},V.prototype.isValidDotFormulaName=function(t){t=t.toUpperCase();return["STDEV.P","STDEV.S","VAR.S","VAR.P","T.TEST","F.TEST","Z.TEST","CHISQ.TEST","COVARIANCE.S","COVARIANCE.P","CHISQ.DIST","F.DIST","T.DIST","NETWORKDAYS.INTL","WORKDAY.INTL","ERROR.TYPE","ECMA.CEILING","ISO.CEILING"].some(function(r){return t===r})},V.prototype.isOtherLangChar=function(r){r=r.charCodeAt(0);return 192<=r&&r<=214||216<=r&&r<=246||248<=r&&r<=255},V.prototype.destroy=function(){this.stringsColl.clear(),this.storedStringText=this.emptyStr,this.isError=!1,this.isFormulaParsed=!1,this.parent=null};var oi=V;function V(r){this.emptyStr="",this.storedStringText=this.emptyStr,this.sheetToken="!",this.tokenAdd="a",this.tokenSubtract="s",this.tokenMultiply="m",this.tokenDivide="d",this.tokenLess="l",this.charEm="r",this.charEp="x",this.tokenGreater="g",this.tokenEqual="e",this.tokenLessEq="k",this.tokenGreaterEq="j",this.tokenNotEqual="o",this.tokenAnd="c",this.tokenEm="v",this.tokenEp="t",this.tokenOr=String.fromCharCode(126),this.charAnd="i",this.charLess="<",this.charGreater=">",this.charEqual="=",this.charLessEq="f",this.charGreaterEq="h",this.charNoEqual="z",this.stringGreaterEq=">=",this.stringLessEq="<=",this.stringNoEqual="<>",this.stringAnd="&",this.stringOr="^",this.charOr="w",this.charAdd="+",this.charSubtract="-",this.charMultiply="*",this.charDivide="/",this.fixedReference="$",this.spaceString=" ",this.ignoreBracet=!1,this.isError=!1,this.isFormulaParsed=!1,this.findNamedRange=!1,this.stringsColl=new Map,this.tokens=[this.tokenAdd,this.tokenSubtract,this.tokenMultiply,this.tokenDivide,this.tokenLess,this.tokenGreater,this.tokenEqual,this.tokenLessEq,this.tokenGreaterEq,this.tokenNotEqual,this.tokenAnd,this.tokenOr],this.charNOTop=String.fromCharCode(167),this.specialSym=["~","@","#","?"],this.isFailureTriggered=!1,this.parent=r}si=function(r,t){return(si=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(r,t){r.__proto__=t}:function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}))(r,t)};var si,ai,li=function(r,t){function e(){this.constructor=r}si(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)},ui=function(r,t,e,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,e):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(r,t,e,n);else for(var a=r.length-1;0<=a;a--)(i=r[a])&&(s=(o<3?i(s):3<o?i(t,e,s):i(t,e))||s);return 3<o&&s&&Object.defineProperty(t,e,s),s},hi=1048576,pi=16384,li=(ai=z.Base,li(R,ai),Object.defineProperty(R.prototype,"libraryFormulas",{get:function(){return this.lFormulas},set:function(r){this.lFormulas.set(r.fName,{handler:r.handler,category:r.category,description:r.description})},enumerable:!0,configurable:!0}),R.prototype.setLocale=function(r){var t=this.parentObject,r=r||t&&t.locale||"en-US";this.l10n.setLocale(r),this.refreshLocalizedStrings()},R.prototype.refreshLocalizedStrings=function(){function r(r){return t.l10n.getConstant(r)}var t=this;this.formulaErrorStrings=[r("OperatorsCannotStartWithExpression"),r("CannotParse"),r("BadLibrary"),r("InvalidCharInFrontOf"),r("NumberContains2DecimalPoints"),r("ExpressionCannotEndWithAnOperator"),r("InvalidCharactersFollowingWithOperator"),r("InvalidCharInNumber"),r("MismatchedParentheses"),r("UnknownFormulaName"),r("RequiresASingleArgument"),r("Requires3Args"),r("InvalidMathArgument"),r("Requires2Args"),"#NAME?",r("TooComplex"),"#CIRCULARREF!",r("MissingFormula"),r("ImproperFormula"),r("InvalidExpression"),r("CellEmpty"),r("BadFormula"),r("EmptyExpression"),"",r("MismatchedTics"),r("WrongNumberArguments"),r("InvalidArguments"),r("IterationsDoNotConverge"),r("AlreadyRegistered"),r("CalculationOverflow"),r("MissingSheet"),r("CannotParseUnderscore"),r("ExpressionCannotEndWithAnOperatorUnderscore"),"#SPILL!","#DIV/0!"],this.categoryCollection=[r("CategoryAll")]},R.prototype.getHostSheetInfo=function(){var r=this.parentObject;return r&&"function"==typeof r.getSheetInfo&&r.getSheetInfo()||[]},R.prototype.hostParseDate=function(r){var t=this.parentObject;return t&&"function"==typeof t.parseDate&&t.parseDate(r)||{}},R.prototype.getParseArgumentSeparator=function(){return this.isArgumentSeparatorChanged||","===this.parseArgumentSeparator||(this.parseArgumentSeparator=","),this.parseArgumentSeparator},R.prototype.setParseArgumentSeparator=function(r){this.parseArgumentSeparator=r,this.isArgumentSeparatorChanged=!0},R.prototype.getParseDateTimeSeparator=function(){return this.parseDateTimeSeparator},R.prototype.setTreatEmptyStringAsZero=function(r){this.treatEmptyStringAsZero=r},R.prototype.getTreatEmptyStringAsZero=function(){return this.treatEmptyStringAsZero},R.prototype.setParseDateTimeSeparator=function(r){this.parseDateTimeSeparator=r},R.prototype.onPropertyChanged=function(r,t){},R.prototype.getModuleName=function(){return"calculate"},R.prototype.getFormulaCharacter=function(){return"="},R.prototype.isUpperChar=function(r){r=r.charCodeAt(0);return 64<r&&r<91},R.prototype.resetKeys=function(){this.storedData.clear(),this.keyToRowsMap.clear(),this.rowsToKeyMap.clear()},R.prototype.updateDependentCell=function(r){var t,e,n,i,o=this,s=this.cell;""!==s&&((t=this.getSheetFamilyItem(this.grid)).sheetNameToParentObject&&(s.includes(this.sheetToken)||(s=t.parentObjectToToken.get(this.grid)+s),r.includes(this.sheetToken)||(r=t.parentObjectToToken.get(this.grid)+r)),s!==r)&&((t=this.getDependentCells()).has(r)||t.set(r,[]),-1===(t=t.get(r)).indexOf(s))&&(e=this.getDependentFormulaCells(),n={},(i=function(r){if(e.has(r)){var t=e.get(r);if(t.has(s))throw o.formulaErrorStrings[$.FormulasErrorsStrings.CircularReference];n[r]||(n[r]=!0,t.forEach(function(r){i(r)}))}})(r),t.push(s),e.has(s)?e.get(s).has(r)||e.get(s).set(r,r):(e.set(s,new Map),e.get(s).set(r,r)))},R.prototype.getDependentCells=function(){return null==this.dependentCells&&(this.dependentCells=new Map),this.dependentCells},R.prototype.getDependentFormulaCells=function(){var r;return this.isSheetMember()?(null==(r=this.getSheetFamilyItem(this.grid)).sheetDependentFormulaCells&&(r.sheetDependentFormulaCells=new Map),r.sheetDependentFormulaCells):(null==this.dependentFormulaCells&&(this.dependentFormulaCells=new Map),this.dependentFormulaCells)},R.prototype.getLibraryFormulas=function(){return this.lFormulas},R.prototype.getFunction=function(r){return this.getLibraryFormulas().has(r.toUpperCase())?this.getLibraryFormulas().get(r.toUpperCase()).handler:null},R.prototype.intToDate=function(r){var r=Number(r),t=(60<(r=0<r&&r<1?1+r:0===r?1:r)&&--r,new Date("01/01/1900")),t=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return new Date(new Date(864e5*(r-1)+t).toUTCString().replace(" GMT",""))},R.prototype.getFormulaInfoTable=function(){var r;return this.isSheetMember()?(null===(r=this.getSheetFamilyItem(this.grid)).sheetFormulaInfotable&&(r.sheetFormulaInfotable=new Map),r.sheetFormulaInfotable):(null===this.formulaInfoTable&&(this.formulaInfoTable=new Map),this.formulaInfoTable)},R.prototype.getParseDecimalSeparator=function(){return this.isParseDecimalSeparatorChanged||"."===this.parseDecimalSeparator||(this.parseDecimalSeparator="."),this.parseDecimalSeparator},R.prototype.setParseDecimalSeparator=function(r){this.parseDecimalSeparator=r,this.isParseDecimalSeparatorChanged=!0},R.prototype.getSheetToken=function(r){var t=0,e="";if(t<r.length&&r[t]===this.sheetToken){for(t++;t<r.length&&r[t]!==this.sheetToken;)t++;e=r.substring(0,t+1)}if(t<r.length)return e;throw this.formulaErrorStrings[$.FormulasErrorsStrings.BadIndex]},R.prototype.getSheetID=function(r){var t=this.getSheetFamilyItem(r);if(null!=t.sheetNameToParentObject&&0<t.sheetNameToParentObject.size&&(t=t.parentObjectToToken.get(r))){t=t.split(this.sheetToken).join(""),r=this.parseFloat(t);if(!this.isNaN(r))return r}return-1},R.prototype.parseFloat=function(r){var t=Number(r);return t=isNaN(t)&&"string"==typeof r&&r.includes(",")?Number(r.split(",").join("")):t},R.prototype.rowIndex=function(r){var t=0,e=!1;if(t<r.length&&r[t]===this.sheetToken){for(t++;t<r.length&&r[t]!==this.sheetToken;)t++;t++}for(;t<r.length&&this.isChar(r[t]);)e=!0,t++;var n=parseInt(r.substring(t),10);if(t<r.length&&!this.isNaN(n))return n;if(e)return-1;throw this.formulaErrorStrings[$.FormulasErrorsStrings.BadIndex]},R.prototype.colIndex=function(r){var t=0,e=0;if(t<(r=r.toUpperCase()).length&&r[t]===this.sheetToken){for(t++;t<r.length&&r[t]!==this.sheetToken;)t++;t++}for(;t<r.length&&this.isChar(r[t]);){e=26*e+r[t].charCodeAt(0)-64;t++}return 0===e?-1:e},R.prototype.getErrorStrings=function(){return null===this.errorStrings&&(this.errorStrings=["#N/A","#VALUE!","#REF!","#DIV/0!","#NUM!","#NAME?","#NULL!","#CALC!"]),this.errorStrings},R.prototype.substring=function(r,t,e){return r.substring(t,e+t)},R.prototype.isChar=function(r){return 65<=r.charCodeAt(0)&&r.charCodeAt(0)<=90||97<=r.charCodeAt(0)&&r.charCodeAt(0)<=122},R.prototype.getSheetFamilyItem=function(r,t){return 0===this.sheetFamilyID?(null==this.defaultFamilyItem&&(this.defaultFamilyItem=new mi),this.defaultFamilyItem):(null==this.sheetFamiliesList&&(this.sheetFamiliesList=new Map),void 0===t&&(t=this.modelToSheetID.get(r)),this.sheetFamiliesList.has(t)||this.sheetFamiliesList.set(t,new mi),this.sheetFamiliesList.get(t))},R.prototype.setKeyValue=function(r,t){r=r.toUpperCase();var t=t.toString().trim(),e=(this.storedData.get(r)&&0!==t.indexOf("{")||(this.storedData.set(r,new gi),this.keyToRowsMap.set(r,this.keyToRowsMap.size+1),this.rowsToKeyMap.set(this.rowsToKeyMap.size+1,r)),this.storedData.get(r));null!=e.getFormulaText()&&0<e.getFormulaText().length&&e.getFormulaText()!==t&&(r=this.cellPrefix+this.keyToRowsMap.get(r).toString(),null!=this.getDependentFormulaCells().get(r))&&this.clearFormulaDependentCells(r),0<t.length&&t[0]===this.getFormulaCharacter()?e.setFormulaText(t):e.getFormulaValue()!==t&&(e.setFormulaText(""),e.setParsedFormula(""),e.setFormulaValue(t))},R.prototype.clearFormulaDependentCells=function(n){var i=this,r=this.getDependentFormulaCells().get(n);r&&(r.forEach(function(r,t){var e=i.getDependentCells().get(t);i.arrayRemove(e,n),0===e.length&&i.getDependentCells().delete(t)}),this.getDependentFormulaCells().delete(n))},R.prototype.clearKeys=function(){this.resetKeys()},R.prototype.arrayRemove=function(r,t){t=r.indexOf(t);return-1!==t&&r.splice(t,1),r},R.prototype.getKeyValue=function(t){if(t=t.toUpperCase(),!this.storedData.has(t))return"";var e=this.storedData.get(t),r=e.getFormulaText();if(0<r.length&&r[0]===this.getFormulaCharacter()){if(this.evaluatingKeys.has(t))return this.getErrorStrings()[$.CommonErrors.Ref];this.evaluatingKeys.add(t),this.cell=this.cellPrefix+this.keyToRowsMap.get(t).toString(),r=r.substring(1);try{try{e.setParsedFormula(this.parser.parseFormula(r,t))}catch(r){var n={message:r.message,exception:r,isForceCalculable:!1,computeForceCalculate:!1};return this.trigger("onFailure",n),e.setFormulaValue(n.message),this.storedData.get(t).getFormulaValue()}try{e.setFormulaValue(this.computeFormula(e.getParsedFormula()))}catch(r){var n={message:r.message,exception:r,isForceCalculable:!1,computeForceCalculate:!1},i=(this.trigger("onFailure",n),"string"==typeof n.exception?n.exception:n.message);return(z.isNullOrUndefined(this.getErrorLine(r))?"":"#"+this.getErrorLine(r)+": ")+i}}finally{this.evaluatingKeys.delete(t)}}return this.storedData.get(t).getFormulaValue()},R.prototype.getNamedRanges=function(){return this.namedRanges},R.prototype.addNamedRange=function(r,t){var e=r.split(this.sheetToken);if(1<e.length){var n=this.getSheetId(this.grid).toString();if(!this.getSheetFamilyItem(n).parentObjectToToken.get(n))return!1;r=e[0]+this.sheetToken+e[1].toUpperCase()}else r=r.toUpperCase();return this.namedRanges.set(r,t),!0},R.prototype.updateNamedRange=function(n,i){var o=new Map;this.namedRanges.forEach(function(r,t){var e=t;t.includes(n)&&((t=t.split("!"))[0]=i,e=t.join("!")),o.set(e,r)}),this.namedRanges=o},R.prototype.removeNamedRange=function(r){return r=r.toUpperCase(),null!=this.namedRanges.get(r)&&(this.namedRanges.delete(r),!0)},R.prototype.convertAlpha=function(r){for(var t=[],e=0;0<r;){r--;var n="A".charCodeAt(0);t[e]=String.fromCharCode(r%26+n),r=parseInt((r/26).toString(),10),e++}for(var i=[],o=0;o<e;o++)i[e-o-1]=t[o];return i.join("")},R.prototype.getCellCollection=function(r){if(r.indexOf(":")<0){if(!this.isCellReference(r))return r.split(this.getParseArgumentSeparator());r=r+":"+r}var t,e,n,i="",o=r.indexOf(this.sheetToken);if(-1<o)for(var s=o+1;s<r.length;){if(r[s]===this.sheetToken){i=r.substr(0,s+1);break}s++}if(0<(p=r.indexOf(":"))&&this.isChar(r[p-1]))for(var a=p-2;0<=a&&this.isDigit(r[a]);)a--;if(o=this.rowIndex(this.substring(r,0,p)),t=this.rowIndex(this.substring(r,p+1,p+r.length-p-1)),e=this.colIndex(this.substring(r,0,p)),n=this.colIndex(this.substring(r,p+1,p+r.length-p-1)),hi<=o||hi<=t||pi<=e||pi<=n)return[this.getErrorStrings()[$.CommonErrors.Ref]];t<o&&(p=t,t=o,o=p),n<e&&(p=n,n=e,e=p);for(var l,u=[],h=0,p=o;p<=t;p++)for(l=e;l<=n;l++)u[h]=i+""+this.convertAlpha(l)+p.toString(),h++;return u},R.prototype.computeFormula=function(r,t){return this.calculateFormula(r,!1,t)},R.prototype.calculateFormula=function(t,m,c){var d,N,v,E=this,S=!1;if(this.parser.isError)return t;d=this.parser.isFormulaParsed?t:this.parser.parseFormula(t),this.parser.isFormulaParsed=!1;try{if(0<(N=this.findLastIndexOfq(d))&&(S=!0),""!==d&&-1<N){for(var y=N+1,C=this;-1<y;)if("break"===function(){if(d[y]!==C.rightBracket)return y++,"continue";var r=d.substring(N,y+1),t=r.split(C.leftBracket)[0].split("q").join(""),e=void 0;if(C.getLibraryFormulas().get(t.toUpperCase()).isCustom){for(var e=r.substring(r.indexOf(C.leftBracket)+1,r.indexOf(C.rightBracket)).split(C.getParseArgumentSeparator()),n=0,i=[],o=void 0,n=0;n<e.length;n++)e[n].includes(":")&&C.isCellReference(e[n])&&1<(o=C.getCellCollection(e[n])).length?(i.push(e[n]),o.forEach(function(r){E.updateDependentCell(r)})):i.push(C.getValueFromArg(e[n]));e=i}else{for(var s,a,l=r.substring(r.indexOf(C.leftBracket)+1,r.indexOf(C.rightBracket)),u=(e=[],C.getParseArgumentSeparator()),h="",p=void 0,g=0,f=l.length-1;g<=f;g++)'"'===l[g]&&(p=!p),l[g]!==u||p?h+=l[g]:(e.push(h),h=""),g===f&&e.push(h);e.length||(e=[""]),S&&t&&(["IF","INDEX","SORT","T","EXACT","PROPER","DOLLAR","DATE","TEXT","ISNUMBER","TRIM","LEFT"].some(function(r){return r===t})&&e.push("nestedFormulaTrue"),"IF"===t&&e.push("nestedFormulaTrue"),"VLOOKUP"!==t&&"HLOOKUP"!==t||-1!==(s=d.lastIndexOf("q",N-1))&&(a=d.substring(s+1,d.lastIndexOf(C.leftBracket,N-1)),["IF","IFS","AND","OR","NOT"].some(function(r){return r===a}))&&e.push("conditionalFormulaTrue")),c&&"UNIQUE"===t&&e.push("isComputeExp")}return b=z.isNullOrUndefined(C.getFunction(t))?C.getErrorStrings()[$.CommonErrors.Name]:C.getFunction(t).apply(void 0,e),S?(v=C.processNestedFormula(d,r,b),0===(s=C.findLastIndexOfq(v))&&(S=!1),-1===s&&(b=C.computeValue(v,m)),N=y=s,d=v,"continue"):"break"}())break}else-1<this.formulaErrorStrings.indexOf(d)?b=d:""!==d&&-1===N&&(b=this.computeValue(d,m))}catch(r){var t={message:r.message,exception:r,isForceCalculable:!1,computeForceCalculate:!1},t=(this.trigger("onFailure",t),"string"==typeof t.exception?t.exception:t.message),b=(z.isNullOrUndefined(this.getErrorLine(r))?"":"#"+this.getErrorLine(r)+": ")+t}return b},R.prototype.computeSumIfAndAvgIf=function(r,t){if(z.isNullOrUndefined(r)||""===r[0]||0===r.length)return this.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var e,n=r,i=0;i<n.length;i++)this.isCellReference(n[i])&&z.isNullOrUndefined(n[i].match(/[0-9]/))&&n[i].indexOf("!")<0&&(e=n[i].split(":"),n[i]=e[0]+"1:"+e[1]+this.spreadSheetUsedRange[0]);r=n.length;if(2!==r&&3!==r&&0===r)return this.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===n[1])return t?this.getErrorStrings()[$.CommonErrors.DivZero]:"0";var t=n[0],o=n[1].startsWith(this.tic)&&n[1].endsWith(this.tic),s=this.getANDComputedValue(n[1]);if(255<s.length)return this.getErrorStrings()[$.CommonErrors.Value];var a=s.includes("*"),l=s.includes("?"),u=a?s.replace(/\*/g,"").trim():s,h=!1,p=(!o&&this.isCellReference(u)&&(u=this.getValueFromArg(u),h=!0),s=u=a&&(p=s.indexOf("*"),"*"===s[0]&&(u="*"+u),"*"===s[s.length-1]&&(u+="*"),0<p)&&p<s.length-1?s.substring(0,p)+"*"+s.substring(p+1):u,this.parser.tokenEqual),u=(s.startsWith("<=")?(p=this.parser.tokenLessEq,s=s.substring(2)):s.startsWith(">=")?(p=this.parser.tokenGreaterEq,s=s.substring(2)):s.startsWith("<>")?(p=this.parser.tokenNotEqual,s=s.substring(2)):s.startsWith("<")?(p=this.parser.tokenLess,s=s.substring(1)):s.startsWith(">")?(p=this.parser.tokenGreater,s=s.substring(1)):s.startsWith("=")&&(p=this.parser.tokenEqual,s=s.substring(1)),(!o&&this.isCellReference(s)&&!h||s.includes(this.arithMarker)||s.includes(this.getParseDecimalSeparator())&&!a&&!l)&&(s=this.getValueFromArg(s)),this.parseFloat(s)),o=n[0],h=this.getCellCollection(2<r?n[2]:t),r=this.getCellCollection(o);if("#REF!"===h[0]||"#REF!"===r[0])return this.getErrorStrings()[$.CommonErrors.Name];if(r.length>h.length){t=this.colIndex(h[h.length-1])+this.colIndex(r[r.length-1])-this.colIndex(r[0]),o=n[2].split(":");if(o[1]=(this.convertAlpha(t)+this.rowIndex(r[r.length-1])).toString(),"#REF!"===(h=this.getCellCollection(o.join(":")))[0])return this.getErrorStrings()[$.CommonErrors.Name]}t=this.getComputeSumIfValue(r,h,s.toLowerCase(),u,p,a,l);return[t[0],t[1]]},R.prototype.computeLookup=function(r){var t,e,n,i=[],o=[],s=[],a=[],l=[],u=r.length;if(1===u||3<u)return this.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===r[1]||""===r[2])return this.getErrorStrings()[$.CommonErrors.Value];if(n=this.getValueFromArg(r[0]),-1<r[0].indexOf(this.tic)&&r[0].toUpperCase().split(this.tic).join("")!==this.trueValue&&r[0].toUpperCase().split(this.tic).join("")!==this.falseValue&&this.isNaN(this.parseFloat(r[0].split(this.tic).join("")))&&(n=n.split(this.tic).join("")),-1<this.getErrorStrings().indexOf(n))return n;var h=r[1].split(":");if(2===h.length&&this.isCellReference(h[0])&&this.isCellReference(h[1])&&2===u&&(O=r[1].indexOf(":"),h=this.rowIndex(this.substring(r[1],0,O)),N=this.colIndex(this.substring(r[1],0,O)),m=this.rowIndex(this.substring(r[1],O+1,O+r[1].length-O-1)),v=this.colIndex(this.substring(r[1],O+1,O+r[1].length-O-1)),m<h&&(h=(f=[m,h])[0],m=f[1]),v<N&&(N=(f=[v,N])[0],v=f[1]),f="",0===r[1].indexOf("!")&&(f=(f=(f=r[1]).replace("!","")).indexOf("!"),f=r[1].substring(0,f+2)),(g=v-N+1)<(p=m-h+1)||p==g?(t=f+J(N)+h+":"+J(N)+m,e=f+J(v)+h+":"+J(v)+m):p<g&&(t=f+J(N)+h+":"+J(v)+h,e=f+J(N)+m+":"+J(v)+m),h===m&&N===v||(A=!0)),A){if(i=this.getCellCollection(t),o=this.getCellCollection(e),"#REF!"===i[0]||"#REF!"===o[0])return this.getErrorStrings()[$.CommonErrors.Name]}else{var i=this.getCellCollection(r[1]),p=2===u?r[1]:r[2],o=this.getCellCollection(p);if("#REF!"===i[0]||"#REF!"===o[0])return this.getErrorStrings()[$.CommonErrors.Name];var g=M(r[1]),f=M(p),h=g[1]===g[3]||g[0]===g[2],m=f[1]===f[3]||f[0]===f[2];if(!h||!m)return this.getErrorStrings()[$.CommonErrors.NA]}for(var c=0;c<i.length;c++)a.push(this.getValueFromArg(i[c]).split(this.tic).join(""));var d=a.map(function(r){return""===r?NaN:Number(r)}).sort(function(r,t){return r-t}),N=d[d.length-1],v=d[0],E=this.parseFloat(n);if(this.isNaN(E))for(var S,y,C=0;C<i.length;C++)s[C]=this.getValueFromArg(i[C]).split(this.tic).join(""),z.isNullOrUndefined(o[C])||""===n||""===s[C]||(n.toUpperCase()===s[C].toUpperCase()||(-1<n.indexOf("*")||-1<n.indexOf("?"))&&(-1<(y=n).indexOf("*")&&(y=y.replace(/\*/g,"").trim(),this.isCellReference(y)&&(y=this.getValueFromArg(y)),S=n.indexOf("*"),"*"===n[0]&&(y="*"+y),"*"===n[n.length-1]&&(y+="*"),0<S)&&S<n.length-1&&(y=n.substring(0,S)+"*"+n.substring(S+1)),S=[],y=this.findWildCardValue(y.toLowerCase(),s[C].toLowerCase()),S.push(y),S.push(n),this.processLogical(S,"equal")===this.trueValue))&&l.push(this.getValueFromArg(o[C]).split(this.tic).join("")||"0");else for(var b=0;b<d.length;b++)s[b]=d[b].toString().split(this.tic).join(""),z.isNullOrUndefined(o[b])||""===s[b]||E!==this.parseFloat(s[b])||l.push(this.getValueFromArg(o[b]).split(this.tic).join("")||"0");if(0<l.length)return l[l.length-1];if(N<E&&!z.isNullOrUndefined(o[i.length-1]))return this.getValueFromArg(o[i.length-1]).split(this.tic).join("")||"0";if(!(E<v)&&a.indexOf(n.split(this.tic).join(""))<0&&n!==this.trueValue&&n!==this.falseValue)if(this.isNaN(E)||this.isNaN(N)||this.isNaN(v)){if(this.isNaN(E)&&""!==n&&/^[a-zA-Z!@#$%^&*()_+{}[\]:;<>,.?~\\/-]/.test(n)){var A=a.sort(),O=this.findClosestMatch(n.split(this.tic).join(""),A);if(!z.isNullOrUndefined(o[O])&&0<=O)return this.getValueFromArg(o[O]).split(this.tic).join("")||"0"}}else{for(var F=[],x=0;x<d.length;x++)E>d[x]&&F.push(d[x]);var O=F.length-1;if(!z.isNullOrUndefined(o[O])&&0<=O)return this.getValueFromArg(o[O]).split(this.tic).join("")||"0"}return this.getErrorStrings()[$.CommonErrors.NA]},R.prototype.computeVHLookup=function(r,t){var e,n=this;if(r&&"conditionalFormulaTrue"===r[r.length-1]&&(e=!0,r.pop()),z.isNullOrUndefined(r)||r.length<3||4<r.length)return this.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];if(""===r[1])return this.getErrorStrings()[$.CommonErrors.NA];var i=this.getValueFromArg(r[0]),o=(i?i.includes(this.tic)&&(o=i.split(this.tic).join(""))&&!this.isNumber(o)&&(f=o.toUpperCase())!==this.trueValue&&f!==this.falseValue&&(i=o):i="0",this.getErrorStrings());if(-1<o.indexOf(i))return i;var s,a=(this.getValueFromArg(r[2])||"0").split(this.tic).join("").toUpperCase(),a=this.parseFloat(a===this.trueValue?"1":a);if(a<1)return o[$.CommonErrors.Value];if(r[3]){if(r[3]=this.getValueFromArg(r[3]).split(this.tic).join(""),-1<o.indexOf(r[3]))return r[3];var l=r[3].toUpperCase();if(l===this.falseValue||"0"===r[3])s=!0;else if(l!==this.trueValue&&"1"!==r[3])return o[$.CommonErrors.Value]}var l=r[1],u=this.tic+"RSEP"+this.tic;if(l.includes(u)||l.startsWith("(")&&l.endsWith(")")&&l.includes(u)){var u=l.startsWith("(")&&l.endsWith(")")?l.substring(1,l.length-1):l,h=this.tic+"RSEP"+this.tic,j=this.tic+"CSEP"+this.tic,p=u.split(h).map(function(r){return r.split(j).map(function(r){return r.startsWith(n.tic)&&r.endsWith(n.tic)?r.substring(1,r.length-1):n.isCellReference(r.trim())?n.getValueFromArg(r.trim()):r.trim()})}),u=p.length,h=p[0]?p[0].length:0,g=a-1;if(t&&h<=g)return o[$.CommonErrors.Ref];if(!t&&u<=g)return o[$.CommonErrors.Ref];for(var f=i.toUpperCase(),L=t?u:h,m=0;m<L;m++){var c=(t?p[m][0]:p[0][m])||"";if(this.isNumber(i)&&this.isNumber(c)?this.parseFloat(i)===this.parseFloat(c):c.toUpperCase()===f)return""!==(c=t?void 0!==p[m][g]?p[m][g]:"":void 0!==p[g]&&void 0!==p[g][m]?p[g][m]:"")?c:""}return o[$.CommonErrors.NA]}u=l.split(":");if(!this.isCellReference(u[0])||!this.isCellReference(u[1]))return o[$.CommonErrors.Value];var d=this.rowIndex(u[0]),N=this.colIndex(u[0]),h=this.rowIndex(u[1]),l=this.colIndex(u[1]);if(h<d&&(d=(u=[h,d])[0],h=u[1]),l<N&&(N=(u=[l,N])[0],l=u[1]),!(0<d&&h<=hi&&0<N&&l<=pi))return this.getErrorStrings()[$.CommonErrors.Name];var u=this.grid,v="",E=this.getSheetFamilyItem(u),r=(r[1].startsWith("!")?(v=r[1].substring(0,r[1].replace("!","").indexOf("!")+2),null!==E.tokenToParentObject&&(this.grid=E.tokenToParentObject.get(v))):null!==E.parentObjectToToken&&(v=E.parentObjectToToken.get(u)),this.getSheetId(this.grid));if(-1===ii("Sheet"+r,this.getHostSheetInfo()))return this.grid=u,o[$.CommonErrors.Ref];var S,y,C=this.getCellValueFn(u,this.cell,r,!0);if(t){var b=N+a-1;if(l<b)return o[$.CommonErrors.Ref];var A=d,O=h,k=v+J(N),F=function(r){return C(r,N,k+r)},P=v+J(b),x=function(){return C(w,b,P+w)||(e?'""':"0")}}else{var V,R=d+a-1;if(h<R)return o[$.CommonErrors.Ref];A=N,O=l,F=function(r){return V=v+J(r),C(d,r,V+d)},x=function(){return C(R,w,V+R)||(e?'""':"0")}}var T=[];if(s){var I,M,D,_=void 0;for(_=this.isNumber(i)?(I=this.parseFloat(i),function(){return I===n.parseFloat(y)}):i.includes("*")||i.includes("?")?(-1<(E=(M=i).indexOf("*"))&&(M=M.replace(/\*/g,"").trim(),this.isCellReference(M)&&(M=this.getValueFromArg(M)),0===E?M="*"+M:E===i.length-1?M+="*":M=i.substring(0,E)+"*"+i.substring(E+1)),M=M.toLowerCase(),function(){return n.processLogical([n.findWildCardValue(M,y.toLowerCase()),i],"equal")===n.trueValue}):(D=i.toUpperCase(),function(){return D===y.toUpperCase()}),w=A;w<=O;w++)(y=F(w))&&_()&&T.push(x());S=T.length?T[0]:o[$.CommonErrors.NA]}else if(-1<i.indexOf("*")||-1<i.indexOf("?"))S=o[$.CommonErrors.NA];else{for(var U,W,q,B,X=void 0,Y=(X=this.isNumber(i)?(W=this.parseFloat(i),q=Ge(""),function(){U=q(n.isNumber(y)?n.parseFloat(y):y||null,W)}):(B=new Intl.Collator(this.parentObject.locale||"en-US",{sensitivity:"base"}),function(){U=!y||n.isNumber(y)?null:B.compare(y,i)}),void 0),w=A;w<=O;w++)y=F(w),Y||(X(),0===U||U<0?T.push(x()):0<U&&T.length&&(Y=!0));S=T.length?T[T.length-1]:o[$.CommonErrors.NA]}return this.grid=u,e&&"string"==typeof S&&-1!==S.indexOf(this.getParseArgumentSeparator())?this.tic+S+this.tic:S},R.prototype.findClosestMatch=function(r,t){for(var e=0,n=t.length-1;e<=n;){var i=Math.floor((e+n)/2),o=t[i],o=this.compareStrings(r.toLowerCase(),o.toLowerCase());if(0===o)return i;1===o?e=i+1:n=i-1}for(var s=e-1;0<=s;s--)if(-1!==this.compareStrings(r.toLowerCase(),t[s].toLowerCase()))return s;return-1},R.prototype.compareStrings=function(r,t){for(var e=Math.min(r.length,t.length),n=0;n<e;n++){var i=r.charCodeAt(n),o=t.charCodeAt(n);if(i<o)return-1;if(o<i)return 1}return r.length<t.length?-1:r.length>t.length?1:0},R.prototype.findWildCardValue=function(r,t){var e="";if(-1<r.indexOf("?"))var n=RegExp(r.replace(/\?/g,"[\\s\\S]")),e=t.length===r.length&&this.isNaN(this.parseFloat(t))&&t.match(n)?r:t;else if(-1<r.indexOf("*")){for(var n=r.indexOf("*"),i="",o="",s=this.falseValue,a=this.falseValue,l=n-1;0<=l;l--)i+=r[l],a=this.trueValue;for(l=n+1;l<r.length;l++)o+=r[l],s=this.trueValue;var n=""===i?-1:t.indexOf(i.split("").reverse().join("")),u=""===o?-1:t.indexOf(o);-1<n||-1<u?(n=i.split("").reverse().join("")===t.substr(0,i.length),u=o===t.substring(t.length-o.length,t.length),a===this.trueValue&&s===this.trueValue&&this.isNaN(this.parseFloat(i))&&this.isNaN(this.parseFloat(o))?e=n&&u?r:t:a===this.trueValue&&this.isNaN(this.parseFloat(i))?e=n?r:t:s===this.trueValue&&this.isNaN(this.parseFloat(o))&&(e=u?r:t)):e=t=r.startsWith("*")&&r.endsWith("*")&&""!==(n=r.slice(1,-1))&&t.includes(n)&&this.isNaN(this.parseFloat(n))?r:t}return e},R.prototype.getComputeSumIfValue=function(r,t,e,n,i,o,s){var a=0,l=0;switch(i){case this.parser.tokenEqual:for(var u=o?e.replace(/\*/g,""):e,h=0;h<r.length;h++){var p=this.getValueFromRange(t,h),g=this.getValueFromArg(r[h].split(this.tic).join("")).toLowerCase(),f=this.parseFloat(g);g===e&&f===n?(d=this.getValueFromArg(t[h].split(this.tic).join("")),N=this.parseFloat(d),this.isNaN(N)||(a+=N,l+=1)):g===e?this.isNaN(p)||(a+=p,l+=1):o&&u&&g&&this.isNaN(this.parseFloat(g))?(m=e.indexOf("*"),"*"===e[0]&&u.length<=g.length&&u===g.slice(g.length-u.length,g.length)?this.isNaN(p)||(a+=p,l+=1):("*"===e[e.length-1]&&u.length<=g.length&&u===g.slice(0,u.length)||-1<m&&g.startsWith(e.substr(0,m))&&g.endsWith(e.substr(m+1)))&&!this.isNaN(p)&&(a+=p,l+=1)):o&&!u&&g&&this.isNaN(this.parseFloat(g))?this.isNaN(p)||(a+=p,l+=1):s&&u&&g&&this.isNaN(this.parseFloat(g))&&(c=RegExp(u.replace(/\?/g,"[\\s\\S]")),g.length===e.length)&&g.match(c)&&!this.isNaN(p)&&(a+=p,l+=1)}break;case this.parser.tokenLess:for(h=0;h<r.length;h++){g=this.getValueFromArg(r[h].split(this.tic).join(""));(f=this.parseFloat(g))<n&&(d=this.getValueFromArg(t[h].split(this.tic).join("")),N=this.parseFloat(d),this.isNaN(N)||(a+=N,l+=1))}break;case this.parser.tokenGreater:for(h=0;h<r.length;h++){g=this.getValueFromArg(r[h].split(this.tic).join(""));n<(f=this.parseFloat(g))&&(d=this.getValueFromArg(t[h].split(this.tic).join("")),N=this.parseFloat(d),this.isNaN(N)||(a+=N,l+=1))}break;case this.parser.tokenLessEq:for(h=0;h<r.length;h++){g=this.getValueFromArg(r[h].split(this.tic).join(""));(f=this.parseFloat(g))<=n&&(d=this.getValueFromArg(t[h].split(this.tic).join("")),N=this.parseFloat(d),this.isNaN(N)||(a+=N,l+=1))}break;case this.parser.tokenGreaterEq:for(h=0;h<r.length;h++){g=this.getValueFromArg(r[h].split(this.tic).join(""));n<=(f=this.parseFloat(g))&&(d=this.getValueFromArg(t[h].split(this.tic).join("")),N=this.parseFloat(d),this.isNaN(N)||(a+=N,l+=1))}break;case this.parser.tokenNotEqual:for(u=o?e.replace(/\*/g,""):e,h=0;h<r.length;h++){var m,c,d,N,p=this.getValueFromRange(t,h),g=this.getValueFromArg(r[h].split(this.tic).join("")).toLowerCase(),f=this.parseFloat(g);g===e||f===n||o||s?o&&u&&g&&this.isNaN(this.parseFloat(g))?(m=e.indexOf("*"),"*"===e[0]&&u.length<=g.length&&u!==g.slice(g.length-u.length,g.length)||"*"===e[e.length-1]&&u.length<=g.length&&u!==g.slice(0,u.length)?this.isNaN(p)||(a+=p,l+=1):(-1<m&&!g.startsWith(e.substr(0,m))||!g.endsWith(e.substr(m+1)))&&!this.isNaN(p)&&(a+=p,l+=1)):!o||u||this.isNaN(this.parseFloat(g))?s&&u&&g&&this.isNaN(this.parseFloat(g))&&(c=RegExp(u.replace(/\?/g,"[\\s\\S]")),g.length===e.length&&g.match(c)||this.isNaN(p)||(a+=p,l+=1)):this.isNaN(p)||(a+=p,l+=1):(d=this.getValueFromArg(t[h].split(this.tic).join("")),N=this.parseFloat(d),this.isNaN(N)||(a+=N,l+=1))}}return[a,l]},R.prototype.getValueFromRange=function(r,t){r=r[t],r=this.getValueFromArg(r);return this.parseFloat(r.toString())},R.prototype.computeAndOrNot=function(r,t){for(var e,n,i=this,o="and"===t,s="or"===t,a="not"===t,l=o||a,u=[],h=r,p=0;p<h.length;p++){if(h[p]===this.tic)return this.getErrorStrings()[$.CommonErrors.Value];if(h[p]=h[p].startsWith("n")?h[p].slice(1):h[p],this.isCellReference(h[p]))for(var g=this.getCellCollection(h[p]),f=0;f<g.length;f++){if(-1<this.getErrorStrings().indexOf(g[f]))return g[f];if(g[f][0]===this.tic)return this.getErrorStrings()[$.CommonErrors.Name];if(e=this.getValueFromArg(g[f]),-1<this.getErrorStrings().indexOf(e))return e;n=this.parseFloat(e),e===this.falseValue||""!==e&&0===n||a&&""===e?u.push(this.falseValue):e===this.trueValue||!isNaN(n)&&""!==e?u.push(this.trueValue):""!==e&&!isNaN(n)||u.push(this.getErrorStrings()[$.CommonErrors.Value])}else{if(e=this.getValueFromArg(h[p]).toUpperCase(),-1<this.getErrorStrings().indexOf(e))return e;n=this.parseFloat(e),(e=e.split(this.tic).join(""))===this.falseValue||""===h[p]||""!==e&&0===n?u.push(this.falseValue):e===this.trueValue||!isNaN(n)&&""!==e?u.push(this.trueValue):""!==e&&!isNaN(n)||u.push(this.getErrorStrings()[$.CommonErrors.Value])}}if(u.every(function(r){return r===i.getErrorStrings()[$.CommonErrors.Value]}))return this.getErrorStrings()[$.CommonErrors.Value];for(f=0;f<u.length;f++){if((o||a)&&u[f]===this.falseValue){l=!1;break}if(s&&u[f]===this.trueValue){l=!0;break}}return(l=a?!l:l)?this.trueValue:this.falseValue},R.prototype.removeTics=function(r){return r=1<r.length&&r[0]===this.tic[0]&&r[r.length-1]===this.tic[0]?this.substring(r,1,r.length-2):r},R.prototype.getCellFrom=function(r){var t,e,n="",r=-1<r.indexOf(":")?r.split(":"):[r],i=r.length-1,o=this.rowIndex(r[0]);return o===this.rowIndex(r[i])?(e=this.colIndex(r[0]),t=this.colIndex(r[i]),e<=(e=this.colIndex(this.cell))&&e<=t&&(n=J(e).toString()+o.toString())):this.colIndex(r[0])===this.colIndex(r[i])&&(t=this.colIndex(r[0]),e=this.rowIndex(r[i]),o<=(r=this.rowIndex(this.cell)))&&r<=e&&(n=J(t).toString()+r.toString()),n},R.prototype.computeValue=function(r,t,e){try{for(var n=[],i=0,o="",s=(n.length=0,[]),a=this.getParseDecimalSeparator();i<r.length;){var l="u"===r[i];if(l&&(i+=1),r[i]===this.arithMarker)i+=1;else{if(this.isDigit(r[i])){for(var u="";i<r.length&&(this.isDigit(r[i])||r[i]===a);)u+=r[i]===a?".":r[i],i+=1;if(n.push(u),!r[i])return n.toString()}if(r[i]===this.sheetToken){for(o=r[i],i+=1;i<r.length&&r[i]!==this.sheetToken;)o+=r[i],i+=1;i<r.length&&(o+=r[i],i+=1)}else if(this.isUpperChar(r[i])){for(var u="",h="";i<r.length&&this.isUpperChar(r[i]);)u+=r[i],i+=1;for(;i<r.length&&this.isDigit(r[i]);)u+=r[i],i+=1;if(i<r.length&&":"===r[i]){if(u+=r[i],(i+=1)<r.length&&r[i]===this.sheetToken)for(u+=r[i],i+=1;i<r.length&&r[i]!==this.sheetToken;)u+=r[i],i+=1;for(;i<r.length&&this.isUpperChar(r[i]);)u+=r[i],i+=1;for(;i<r.length&&this.isDigit(r[i]);)u+=r[i],i+=1;u=o+this.getCellFrom(u)}else u=o+u;var p=this.getParentObjectCellValue(u,t);if(h=z.isNullOrUndefined(p)?"":p.toString(),o="","string"==typeof h&&-1<this.getErrorStrings().indexOf(h))return h;l&&(h=this.isNaN(this.parseFloat(h))?"-"+h:(-this.parseFloat(h)).toString()),n.push(h),""===h&&(s[n.length-1]="0")}else if("q"===r[i]){var g=r.substring(i+1).indexOf(this.leftBracket),f=r.substring(i+g+1).indexOf(this.rightBracket);r=this.substring(r,i+g+2,f-1)}else if(r[i]===this.tic[0]){for(var u=r[i].toString(),m="n"===r[(i+=1)-2]&&r[i]===this.tic[0];i<r.length&&r[i]!==this.tic[0];)u+=r[i],i+=1;(h=u.split(this.tic).join(""))===this.trueValue||h===this.falseValue||!this.isNaN(this.parseFloat(h))&&""!==h?n.push(this.tic+h+this.tic):(n.push(h),""===h&&m&&(s[n.length-1]="0")),i+=1}else if("%"===r[i]&&0<n.length){var c=n[0],d=this.parseFloat(c);this.isNaN(d)||(n.pop(),n.push((d/100).toString())),i+=1}else if(0===r.substring(i).indexOf(this.trueValue))n.push(this.trueValue),i+=this.trueValue.length;else if(0===r.substring(i).indexOf(this.falseValue))n.push(this.falseValue),i+=this.falseValue.length;else if(r[i]===this.tic[0]||"|"===r[i]){u=r[i].toString();for(i++;i<r.length&&r[i]!==this.tic[0];)u+=r[i],i+=1;n.push(u+this.tic),i+=1}else if(" "===r[i]&&i<r.length-1)i+=1;else switch(r[i]){case"#":var N=0,N=-1<this.getErrorStrings().indexOf(r.substring(i))?-1===r.indexOf("!")||-1===r.substring(i).indexOf("!")?-1<r.indexOf("#N/A")?r.indexOf("#N/A")+4+i:r.indexOf("?")+1+i:r.indexOf("!")+1+i:i+1;n.push(this.substring(r,i,N-i)),i=N;break;case"n":u="";if("n"!==r[i+=1]){if(0===r.substring(i).indexOf("Infinity"))i+=(u="Infinity").length;else{for("u"!==r[i]&&!l&&"-"!==r[i]||(u="-",l)||(i+=1);i<r.length&&(this.isDigit(r[i])||r[i]===a||"."===r[i]||"\n"===r[i]);)u+=r[i]===a?".":r[i],i+=1;i<r.length&&"%"===r[i]&&(i+=1,""===u?0<n.length&&(c=n[0],d=this.parseFloat(c),this.isNaN(d)||(n.pop(),n.push((d/100).toString()))):u=(this.parseFloat(u)/100).toString())}u&&n.push(u)}break;case this.parser.tokenAdd:this.getValArithmetic(n,"add",e),i+=1;break;case this.parser.tokenSubtract:this.getValArithmetic(n,"sub",e),i+=1;break;case this.parser.tokenMultiply:this.getValArithmetic(n,"mul",e),i+=1;break;case this.parser.tokenDivide:this.getValArithmetic(n,"div",e),i+=1;break;case this.parser.tokenLess:this.processLogical(n,"less"),i+=1;break;case this.parser.tokenGreater:this.processLogical(n,"greater"),i+=1;break;case this.parser.tokenGreaterEq:this.processLogical(n,"greaterEq"),i+=1;break;case this.parser.tokenLessEq:this.processLogical(n,"lessEq"),i+=1;break;case this.parser.tokenNotEqual:this.processLogical(n,"notEq",s),s.length=0,i+=1;break;case this.parser.tokenOr:this.processLogical(n,"or"),i+=1;break;case this.parser.tokenAnd:this.processLogical(n,"and"),i+=1;break;case this.parser.tokenEqual:this.processLogical(n,"equal",s),s.length=0,i+=1;break;default:return this.getErrorStrings()[$.CommonErrors.Value]}}}if(0===n.length)return"";for(var u="",v=n.length;0<v;){var E=n.pop();if(-1<this.getErrorStrings().indexOf(E))return E;if(""===(u=E+u)&&this.isCellReference(r)&&this.getTreatEmptyStringAsZero())return"0";v--}return u}catch(r){if(-1<this.getErrorStrings().indexOf(r)||-1<this.formulaErrorStrings.indexOf(r))throw r;throw new U(this.formulaErrorStrings[$.FormulasErrorsStrings.InvalidExpression])}},R.prototype.getValArithmetic=function(r,t,e){var n=!1,i=r.pop(),o=-1!==i.indexOf(".")?i.split(".")[1].length:0,o=Math.pow(10,o),s=r.pop(),a=-1!==s.indexOf(".")?s.split(".")[1].length:0,a=Math.pow(10,a),l=a<=o?o:a,u=o*a,h=(i=""===(i=i===this.trueValue?"1":i===this.falseValue?"0":i)?"0":this.getErrorStrings().indexOf(i.toString())<0?this.parseFloat(i+"").toString():i,Number(i));isNaN(h)&&!e&&(n=!0,i===this.getErrorStrings()[$.CommonErrors.DivZero]?r.push(this.getErrorStrings()[$.CommonErrors.DivZero]):r.push(this.getErrorStrings()[$.CommonErrors.Value])),s=""===(s=s===this.trueValue?"1":s===this.falseValue?"0":s)?"0":this.getErrorStrings().indexOf(s.toString())<0?this.parseFloat(s+"").toString():s,h=Number(s),isNaN(h)&&!e&&(n=!0,s===this.getErrorStrings()[$.CommonErrors.DivZero]?r.push(this.getErrorStrings()[$.CommonErrors.DivZero]):r.push(this.getErrorStrings()[$.CommonErrors.Value])),"add"!==t||n||r.push(((Number(s)*l+Number(i)*l)/l).toString()),"sub"!==t||n||r.push(((Number(s)*l-Number(i)*l)/l).toString()),"mul"!==t||n||r.push((Number(s)*a*(Number(i)*o)/u).toString()),"div"!==t||n||(this.isNaN(this.parseFloat(i))||this.isNaN(this.parseFloat(s))?r.push(this.getErrorStrings()[$.CommonErrors.Value]):0===this.parseFloat(i)?r.push(this.getErrorStrings()[$.CommonErrors.DivZero]):r.push((Number(s)*u/(Number(i)*u)).toString()))},R.prototype.processLogical=function(r,t,e){var n,i,o,s,a,l,u,h,p=!1;return"and"!==t&&"equal"!==t&&"notEq"!==t&&(n=r.pop(),u=r.pop(),-1<this.getErrorStrings().indexOf(n)?(h=n,p=!0):-1<this.getErrorStrings().indexOf(u)&&(h=u,p=!0),this.isNaN(this.parseFloat(n))&&this.isNaN(this.parseFloat(u))&&(n=n.toString().toLowerCase(),u=u.toString().toLowerCase()),z.isNullOrUndefined(n)||(i=-1<n.indexOf(this.tic)?n:this.parseFloat(n)),z.isNullOrUndefined(u)||(o=-1<u.indexOf(this.tic)?u:this.parseFloat(u)),"*"===n)&&this.isNaN(this.parseFloat(u))&&""!==u&&(s=!0),"less"!==t||p||(h=this.isNaN(i)||this.isNaN(o)?u.toUpperCase().split(this.tic).join("").localeCompare(n.toUpperCase().split(this.tic).join(""))<0?this.trueValue:this.falseValue:o<i?this.trueValue:this.falseValue),"greater"!==t||p||(h=this.isNaN(i)||this.isNaN(o)?0<u.toUpperCase().split(this.tic).join("").localeCompare(n.toUpperCase().split(this.tic).join(""))?this.trueValue:this.falseValue:i<o?this.trueValue:this.falseValue),"lessEq"!==t||p||(h=this.isNaN(i)||this.isNaN(o)?u.toUpperCase().split(this.tic).join("").localeCompare(n.toUpperCase().split(this.tic).join(""))<=0?this.trueValue:this.falseValue:o<=i?this.trueValue:this.falseValue),"greaterEq"!==t||p||(h=this.isNaN(i)||this.isNaN(o)?0<=u.toUpperCase().split(this.tic).join("").localeCompare(n.toUpperCase().split(this.tic).join(""))?this.trueValue:this.falseValue:i<=o?this.trueValue:this.falseValue),"and"!==t||p||(n=r.pop().toString(),u="",0<r.length&&(u=r.pop().toString()),h=-1<this.getErrorStrings().indexOf(n)?n:-1<this.getErrorStrings().indexOf(u)?u:(h=""+u+n).split(this.tic).join("")),"equal"!==t&&"notEq"!==t||p||(l=a=void 0,e?(a=e[r.length-1],n=r.pop(),l=e[r.length-1]):n=r.pop(),u=r.pop(),h=-1<this.getErrorStrings().indexOf(n)?n:-1<this.getErrorStrings().indexOf(u)?u:(u="TRUE"===u?"1":"FALSE"===u?"0":u,this.isNaN(this.parseFloat(n="TRUE"===n?"1":"FALSE"===n?"0":n))&&this.isNaN(this.parseFloat(u))&&(n=n.toString().toLowerCase(),u=u.toString().toLowerCase()),"*"===n&&this.isNaN(this.parseFloat(u))&&""!==u&&(s=!0),"equal"===t?n===u||void 0!==a&&a===u||void 0!==l&&l===n||s?this.trueValue:this.falseValue:s||u===n||a&&a===u||l&&l===n?this.falseValue:this.trueValue)),"or"!==t||p||(h=Math.pow(this.parseFloat(o),this.parseFloat(i)).toString(),h=this.isNaN(this.parseFloat(h))?this.getErrorStrings()[$.CommonErrors.Value]:h),r.push(h),h},R.prototype.computeStoreCells=function(r){for(var t=r.cellValue,e=r.cellRange,n=r.criteria,i=r.argArray,o=r.isCriteria,s=r.storedCells,a=r.isCountIfS===this.trueValue,l=r.countVal||0,u=o===this.trueValue?s:t,h=[],p=0;p<u.length;p++){var g=[],f=this.getValueFromArg(t[p]),m=i[a?1+2*l:2+l],c=m.startsWith(this.tic)&&m.endsWith(this.tic),d=(m=this.getANDComputedValue(m.trim())).includes("*"),N="*"===m||"<>*"===m,v=d&&!N?m.replace(/\*/g,"").trim():m,E=!1,S=(!c&&this.isCellReference(v)&&(v=this.getValueFromArg(v),E=!0),m=v=d&&!N&&(d=m.indexOf("*"),"*"===m[0]&&(v="*"+v),"*"===m[m.length-1]&&(v+="*"),0<d)&&d<m.length-1?m.substring(0,d)+"*"+m.substring(d+1):v,"");if((o=a?this.trueValue:o)===this.trueValue){var y="",C=0,b=0,N=void 0,d=void 0,v=void 0,A=void 0,N=(s[p]=(a&&!l?t:s)[p],y=s[p],l&&(d=-1<(N=e[l-1]).indexOf("!")?M(N.substring(N.lastIndexOf("!")+1)):M(N),v=-1<y.indexOf("!")?qr(y.substring(y.lastIndexOf("!")+1)):qr(y),A=-1<e[l].indexOf("!")?M(e[l].substring(e[l].lastIndexOf("!")+1)):M(e[l])),-1<y.indexOf("!")),O=void 0,F="",x="";for(N&&(x=y.substring(0,y.lastIndexOf("!")+1),y=y.substring(y.lastIndexOf("!")+1));!this.isDigit(y[C]);)C+=1;if(this.isCellReference(e[l])&&-1<e[l].indexOf(":"))for(S=a&&!l?-1<u[p].indexOf("!")?u[p].substring(u[p].lastIndexOf("!")+1):u[p]:Br(A[0]+(v[0]-d[0]),A[1]+(v[1]-d[1])),(O=-1<e[l].indexOf("!"))&&(F=e[l].substring(0,e[l].lastIndexOf("!")+1));!this.isDigit(S[b]);)b+=1;var A=this.substring(y,C),v=this.substring(S,b),d=this.substring(y,C,y.length-C),V=this.substring(S,b,S.length-C);N&&(A=x+A,v=x+v),d!==V&&(s[p]=this.substring(s[p],N?x.length+C:C)+V),S=s[p].split(A).join(v),S=O?F+(S=-1<S.indexOf("!")?S.substring(S.lastIndexOf("!")+1):S):S.substring(S.lastIndexOf("!")+1),f=this.getValueFromArg(S),m=a?m:this.getANDComputedValue(n[l-1])}d=this.getOperatorAndCriteria(m,"equal"),N=d.op;m=d.criteria,(-1<(m=(c||!this.isCellReference(m)||E&&(""===S||a))&&!m.includes(this.arithMarker)?m:this.getValueFromArg(m)).indexOf("*")||-1<m.indexOf("?"))&&(f=this.findWildCardValue(m.toLowerCase(),f.toLowerCase())),g.push(f.toLowerCase()),g.push(m.toLowerCase()),this.processLogical(g,N)===this.trueValue&&(o===this.falseValue?h.push(t[p]):h.push(S))}return s=h,h=[],s},R.prototype.computeIfsFormulas=function(r,t,e){if(t===this.trueValue&&(z.isNullOrUndefined(r)||""===r[0]||r.length<2||127<r.length||r.length%2!=0))return this.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var n=r,i=[],o=[],s=[],a=0,l=0;l<n.length;l++)0!==l&&l%2!=1||!this.isCellReference(n[l])?o.push(n[l].trim()):i.push(-1<n[l].indexOf(":")?n[l].trim():Xr(M(n[l])));for(var u=[],l=0;l<i.length;l++)u.push(this.getCellCollection(i[l]).length);for(var h=0;h<u.length;h++)if(u[h]&&u[h+1]&&u[h]!==u[h+1])return this.getErrorStrings()[$.CommonErrors.Value];for(var p=0;p<o.length;p++)if(""===o[p]||this.isCellReference(o[p])&&""===this.getValueFromArg(o[p]))return e===this.trueValue?this.getErrorStrings()[$.CommonErrors.DivZero]:0;if(t===this.falseValue){var g,f=this.falseValue,m={cellValue:g=this.getCellCollection(i[1]),cellRange:i,criteria:o,argArray:n,isCriteria:f,storedCells:s,isCountIfS:t};if(0===(s=this.computeStoreCells(m)).length)return e===this.trueValue?this.getErrorStrings()[$.CommonErrors.DivZero]:0}for(l=t===this.trueValue?0:2;l<i.length;l++){f=this.trueValue,f=t===this.trueValue&&0===l?this.falseValue:this.trueValue;m={cellValue:g=this.getCellCollection(i[l]),cellRange:i,criteria:o,argArray:n,isCriteria:f,storedCells:s,isCountIfS:t,countVal:l};if(0===(s=this.computeStoreCells(m)).length)return e===this.trueValue?this.getErrorStrings()[$.CommonErrors.DivZero]:0}for(var c=0,d=-1<i[0].indexOf("!")?M(i[0].substring(i[0].lastIndexOf("!")+1)):M(i[0]),r=i[i.length-1],N=-1<r.indexOf("!")?M(r.substring(r.lastIndexOf("!")+1)):M(r),h=0;h<s.length;h++){var v="",E="",S=0,y=0,C=-1<(v=s[h]).indexOf("!"),b=void 0,A="",O="";for(C&&(O=v.substring(0,v.lastIndexOf("!")+1),v=v.substring(v.lastIndexOf("!")+1));!this.isDigit(v[S]);)S+=1;if(this.isCellReference(i[0])&&-1<i[0].indexOf(":"))for(E=Br(d[0]+(qr(v)[0]-N[0]),d[1]+(qr(v)[1]-N[1])),(b=-1<i[0].indexOf("!"))&&(A=i[0].substring(0,i[0].lastIndexOf("!")+1));!this.isDigit(E[y]);)y+=1;var F=this.substring(v,S),x=this.substring(E,y),V=this.substring(v,S,v.length-S),R=this.substring(E,y,E.length-S);C&&(F=O+F,x=O+x),V!==R&&(s[h]=this.substring(s[h],C?O.length+S:S)+R),g=s[h].split(F).join(x),g=b?A+(g=-1<g.indexOf("!")?g.substring(g.lastIndexOf("!")+1):g):g.substring(g.lastIndexOf("!")+1),t===this.trueValue?a+=1:(V=this.getValueFromArg(g),C=parseFloat(""===V&&e!==this.trueValue?"0":V),this.isNumber(C)&&(c++,a+=C))}return e===this.trueValue&&(a/=c),a},R.prototype.computeCountIfsFormulas=function(r){var t=this.grid;if(z.isNullOrUndefined(r)||""===r[0]||r.length<2||127<r.length||r.length%2!=0)return this.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var e=r,n=[],i=[],o=0;o<e.length;o++)o%2==0&&this.isCellReference(e[o])?n.push(-1<e[o].indexOf(":")?e[o].trim():Xr(M(e[o]))):i.push(e[o].trim());if(n.length!==i.length)return this.getErrorStrings()[$.CommonErrors.Value];for(var s=[],a=this.grid,o=0;o<n.length;o++){var l=M(n[o]),u=l[0],h=l[1],p=l[2],g=l[3],l="",f=this.getSheetFamilyItem(a),f=(n[o].startsWith("!")?(l=n[o].substring(0,n[o].replace("!","").indexOf("!")+2),null!==f.tokenToParentObject&&(a=f.tokenToParentObject.get(l))):null!==f.parentObjectToToken&&(l=f.parentObjectToToken.get(a)),this.grid=a,this.getSheetId(a));if(-1===ii("Sheet"+f,this.getHostSheetInfo()))return this.grid=t,this.getErrorStrings()[$.CommonErrors.Ref];var m=this.getCellValueFn(a,this.cell,f,!0);if(0<s.length){l=s[s.length-1],f=l.endRow-l.startRow+1,l=l.endCol-l.startCol+1;if(p-u+1!=f||g-h+1!=l)return this.getErrorStrings()[$.CommonErrors.Value]}s.push({startRow:u,startCol:h,endRow:p,endCol:g,getCellValue:m,grid:a})}for(var c=0;c<i.length;c++)if(""===i[c])return this.grid=t,0;for(var d=[],o=0;o<s.length;o++){this.grid=t;var N=i[o],v=N.startsWith(this.tic)&&N.endsWith(this.tic),E=(N=this.getANDComputedValue(N.trim())).includes("*"),S="*"===N||"<>*"===N,y=E&&!S?N.replace(/\*/g,"").trim():N,C=!1,S=(!v&&this.isCellReference(y)&&(y=this.getValueFromArg(y),C=!0),N=y=E&&!S&&(E=N.indexOf("*"),"*"===N[0]&&(y="*"+y),"*"===N[N.length-1]&&(y+="*"),0<E)&&E<N.length-1?N.substring(0,E)+"*"+N.substring(E+1):y,this.getOperatorAndCriteria(N,"equal")),b=S.op,A=(N=S.criteria,-1<(N=!v&&this.isCellReference(N)&&!C||N.includes(this.arithMarker)?this.getValueFromArg(N):N).indexOf("*")||-1<N.indexOf("?")),E=s[o],u=E.startRow,h=E.startCol,p=E.endRow,g=E.endCol,m=E.getCellValue,y=s[o].grid,O=(this.grid=y,void 0);if(0===o)for(var F=u;F<=p;F++)for(var x=h;x<=g;x++)O=m(F+1,x+1,Br(F,x)),A&&(O=this.findWildCardValue(N.toLowerCase(),O.toLowerCase())),this.processLogical([O.toLowerCase(),N.toLowerCase()],b)===this.trueValue&&d.push({rowIdx:F,colIdx:x});else for(var V=d,R=s[o-1],d=[],T=0;T<V.length;T++){var I=V[T];I.rowIdx=u+(I.rowIdx-R.startRow),I.colIdx=h+(I.colIdx-R.startCol),O=m(I.rowIdx+1,I.colIdx+1,Br(I.rowIdx,I.colIdx)),A&&(O=this.findWildCardValue(N.toLowerCase(),O.toLowerCase())),this.processLogical([O.toLowerCase(),N.toLowerCase()],b)===this.trueValue&&d.push({rowIdx:I.rowIdx,colIdx:I.colIdx})}if(0===d.length)return this.grid=t,0}return this.grid=t,d.length},R.prototype.getOperatorAndCriteria=function(r,t){return r.startsWith("<=")?(t="lessEq",r=r.substring(2)):r.startsWith(">=")?(t="greaterEq",r=r.substring(2)):r.startsWith("<>")?(t="notEq",r=r.substring(2)):r.startsWith("<")?(t="less",r=r.substring(1)):r.startsWith(">")?(t="greater",r=r.substring(1)):r.startsWith("=")&&(t="equal",r=r.substring(1)),{op:t,criteria:r}},R.prototype.processNestedFormula=function(r,t,e){if(e&&!e.toString().includes('"')){var n=r.indexOf(t)+t.length;if('"'===r[n]&&this.getErrorStrings().indexOf(e.toString())<0&&!this.isNumber(e)&&e!==this.trueValue&&e!==this.falseValue)return r.split(t).join('"'+e+'"')}return r.split(t).join("n"+e)},R.prototype.isNaN=function(r){return"NaN"===r.toString()||"string"==typeof r},R.prototype.isNumber=function(r){return 0<=r-parseFloat(r)},R.prototype.fromOADate=function(r){60<(r=0<r&&r<1?1+r:0===r?1:r)&&--r;var t=new Date("01/01/1900"),t=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return new Date(new Date((r-1)*this.millisecondsOfaDay+t).toUTCString().replace(" GMT",""))},R.prototype.getSerialDateFromDate=function(r,t,e){for(var n=0,i=(r<1900&&(r+=1900),!1);!i;){for(;12<t;)r++,t-=12;for(;t<1;)t+=12,r--;for(var i=!0,o=new Date(r,t,1,-1).getDate();o<e;)o=new Date(r,t,1,-1).getDate(),t++,e-=o,i=!1;e<1&&(--t<1&&(t=12,r--),e=(o=new Date(r,t,1,-1).getDate())+e,i=!1)}var s=Date.parse(r+"/"+t+"/"+e);return n=this.isNaN(s)?n:this.toOADate(new Date(s))},R.prototype.intToTime=function(r){var t=r.toString().split(".");return z.isNullOrUndefined(t[1])||(r=parseFloat(t[0]+1+"."+t[1])||r),this.intToDate(r.toString())},R.prototype.toOADate=function(r,t,e){var n=new Date("01/01/1900"),r=j(r)?r:new Date(r),n=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),r=(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds())-n)/864e5;return(t?r:parseInt(r.toString(),10))+(e?0:60<r?2:1)},R.prototype.calculateDate=function(r){return this.parseFloat(r)<10?"0"+r:r},R.prototype.isTextEmpty=function(r){return null===r||""===r},R.prototype.isDigit=function(r){r=r.charCodeAt(0);return 47<r&&r<58},R.prototype.getANDComputedValue=function(r){return(r=r.startsWith(this.arithMarker)&&r.includes("c")?this.getValueFromArg(r):r).split(this.tic).join("")},R.prototype.findLastIndexOfq=function(r){for(var t=r.lastIndexOf("q"),e=r.lastIndexOf(this.leftBracket);e<t;)t=r.substring(0,t).lastIndexOf("q");return t},R.prototype.getValueFromArg=function(t,r,e,n,i){if(!(t=t.trim())||-1<this.getErrorStrings().indexOf(t))return t;var o=t[0];if(o===this.tic||o===this.singleTic){var s=t.split(this.tic).join("");if(this.isNaN(this.parseFloat(s))&&(!i||o!==this.tic||!t.endsWith(this.tic))){i=this.isDate(s);if(i&&!this.isNaN(i.getDate()))return this.toOADate(i,!0).toString()}return t=t.endsWith(this.tic)&&"."!==(a=this.getParseDecimalSeparator())&&s.includes(a)&&(s=s.replace(a,"."),this.isNumber(s))?s:t}if("u"===o&&t.includes(this.arithMarker))t=this.parser.parseSimpleOperators(t.split("u").join("0-"),[this.parser.tokenSubtract],["-"]);else if(!this.isUpperChar(o)){var a=this.getParseDecimalSeparator();if(this.isDigit(o)||o===a||"-"===o||"n"===o)return"n"===o&&-1<(t=t.substring(1)).indexOf('"n')&&(t=t.replace('"n','"')),t="."!==a&&t.includes(a)&&(s=t.replace(a,"."),this.isNumber(s))?s:t}i=o===this.sheetToken;if(i||this.isUpperChar(o)&&!["+","-","/","*",")",")","{"].some(function(r){return t.includes(r)})){a=this.isCellReference(t);if((t=a&&!i&&null!==(s=this.getSheetFamilyItem(this.grid)).sheetNameToParentObject&&s.parentObjectToToken.has(this.grid)?s.parentObjectToToken.get(this.grid)+t:t)===this.cell){o=this.getDependentCells().get(t);if(null!=o&&-1<o.indexOf(t)&&this.arrayRemove(o,t),this.getDependentFormulaCells().has(this.cell)||this.clearFormulaDependentCells(this.cell),!r)throw new U(this.formulaErrorStrings[$.FormulasErrorsStrings.CircularReference])}i=this.getParentObjectCellValue(t,!1,r,n),s=z.isNullOrUndefined(i)?"":i.toString();return a&&this.updateDependentCell(t),s}return this.computeValue(t,!1,e)},R.prototype.isDate=function(r){var t;return("object"==typeof r||null!==Date.parse(r))&&(t=void 0,(t="string"==typeof r?this.checkDateFormat(r,!1,!0):new Date(Date.parse(r)))>=this.dateTime1900)?t:null},R.prototype.parseDate=function(r){return this.isNaN(r)?"string"!=typeof r||(r=this.checkDateFormat(r,!0),this.isNaN(r))?this.getErrorStrings()[$.CommonErrors.Value]:r:r instanceof Date?new Date(r):(r=parseInt(r,10))<0?this.getErrorStrings()[$.CommonErrors.Num]:r<=60?new Date(this.dateTime1900.getTime()+864e5*(r-1)):new Date(this.dateTime1900.getTime()+864e5*(r-2))},R.prototype.checkDateFormat=function(r,t,e){var n=this.parentObject;if(n&&"function"==typeof n.getModuleName&&"spreadsheet"===n.getModuleName()){n=this.hostParseDate(r);if(n.isDate)return n.dateObj;if(e&&!n.isTime)return new Date(NaN)}return-1<this.getErrorStrings().indexOf(r)?new Date(NaN):t?new Date(r):new Date(Date.parse(r))},R.prototype.isCellReference=function(r){if(""===(r=r.trim()))return!1;r=this.setTokensForSheets(r);var t=this.getSheetToken(r),e=!1,n=!1,i=!1;if((r=""!==t?r.split(t).join(""):r).indexOf(":")!==r.lastIndexOf(":"))return!1;for(var o=r.split("").join(this.getParseArgumentSeparator()).split(this.getParseArgumentSeparator()),s=0;s<o.length;s++)if(this.isChar(o[s]))n=!0;else if(this.isDigit(o[s]))i=!0;else{if(":"!==o[s])return!1;n&&i&&(e=!0),i=n=!1}return-1<r.indexOf(":")&&-1===r.indexOf(this.tic)?!!(e&&n&&i||(n&&!i||!n&&i)&&!e):!!(n&&i&&-1===r.indexOf(this.tic)&&this.isValidCell(r))},R.prototype.setTokensForSheets=function(r){var t,e=this.getSheetFamilyItem(this.grid),n=this.getSortedSheetNames();if(null!=n)for(var i=0;i<n.length;i++){var o=(o=e.sheetNameToToken.get(n[i])).split(this.sheetToken).join(this.tempSheetPlaceHolder),s=this.singleTic+"SHEET"+n[i]+this.singleTic+this.sheetToken;-1===r.indexOf(s)&&(s="SHEET"+n[i]+this.sheetToken),r=r.split(s).join(o),s=n[i]+this.sheetToken,r=r.split(s).join(o)}return-1<(r=r.split(this.tempSheetPlaceHolder).join(this.sheetToken)).indexOf("!!")&&((t=(r=r.replace("!!","!")).split("!"))[1]=(parseInt(t[1],10)+1).toString(),r=t.join("!")),r},R.prototype.getParentObjectCellValue=function(r,t,e,n){if(r===this.trueValue||r===this.falseValue)return r;var i=r.lastIndexOf(this.sheetToken),o=this.grid;if(-1<i){if(null===(l=this.getSheetFamilyItem(o)).tokenToParentObject)return this.getErrorStrings()[$.CommonErrors.Value];this.grid=l.tokenToParentObject.get(r.substring(0,i+1)),a=r.substring(i+1)}else{for(var s=0;s<r.length&&this.isChar(r[s]);)s++;if(s===r.length)return""===r?this.getErrorStrings()[$.CommonErrors.Value]:this.getErrorStrings()[$.CommonErrors.Name];var a=r;(l=this.getSheetFamilyItem(o)).isSheetMember&&null!=l.parentObjectToToken&&(r=l.parentObjectToToken.get(this.grid)+r)}this.isDigit(a[0])&&0<(i=a.search(/[a-zA-Z]/))&&(a=a.substring(i,a.length)+a.substring(0,i));var l=this.rowIndex(a),i=this.colIndex(a);if(0<l&&l<=hi&&0<i&&i<=pi){var a=this.getSheetId(this.grid),u=this.getHostSheetInfo();if(u.length&&-1===ii("Sheet"+a,u))return this.grid=o,this.getErrorStrings()[$.CommonErrors.Ref];u=this.getCellValueFn(o,this.cell,a,!1,t,e,n)(l,i,r)}else u=this.getErrorStrings()[$.CommonErrors.Name];return this.grid=o,z.isNullOrUndefined(u)?"":u},R.prototype.getCellValueFn=function(r,n,i,o,s,a,l){var u=this,h=(h=n)&&(r===this.grid?"":h+","+("string"==typeof r&&-1<Number(r)?r:this.getSheetID(r))),p=this.parentObject.getValueRowCol.bind(this.parentObject)||this.getValueRowCol.bind(this);return function(r,t,e){if(n===e&&!a)throw u.formulaErrorStrings[$.FormulasErrorsStrings.CircularReference];u.cell=e;r=p(i,r,t,h,s,a,l);return z.isNullOrUndefined(r)?r="":(r=r.toString(),"."!==(t=u.getParseDecimalSeparator())&&r.includes(t)&&(t=r.replace(t,"."),u.isNumber(t))&&(r=t)),u.cell=n,o&&u.updateDependentCell(e),r}},R.prototype.isValidCell=function(r){0===r.search(/\d/)&&(t=r.search(/[a-zA-Z]/),r=r.substring(t,r.length)+r.substring(0,t));var t=this.rowIndex(r),r=this.colIndex(r);return 0<t&&t<=hi&&0<r&&r<=pi},R.prototype.getSheetId=function(r){return r&&"string"==typeof r&&-1<Number(r)?Number(r):this.getSheetID(r)+1},R.prototype.getValueRowCol=function(r,t,e){var n,e=(this.convertAlpha(e)+t.toString()).toUpperCase();return this.storedData.has(e)?(n=this.getKeyValue(e),z.isNullOrUndefined(n)?"":n.toString()):(n=this.rowsToKeyMap.get(t),z.isNullOrUndefined(n)||(n=(t=n.toString()).toUpperCase(),this.isCellReference(n)&&n!==e)||this.evaluatingKeys.has(n)||(e=this.getKeyValue(t),z.isNullOrUndefined(e))?"":""!==(e=e.toString())&&"%"===e[e.length-1]&&1<e.length&&(n=this.parseFloat(e.substring(0,e.length-1)),this.isNaN(n))?(Number(n)/100).toString():e)},R.prototype.defineFunction=function(r,t,e,n){"string"==typeof t&&(t=z.getValue(t,window)),r=r.toUpperCase(),this.libraryFormulas.set(r,{handler:t,isCustom:!0,description:e,category:n})},R.prototype.valueChanged=function(t,r,e,n,i,o,s,a,l,u,h,p){var g=t,n=(this.spreadSheetUsedRange=n,this.grid=t,!0),t=!0,f=this.getSheetFamilyItem(g),m=J(r.getColIndex())+r.getRowIndex().toString(),o=(this.actCell=o+"!"+m,null!==f.sheetNameToParentObject&&0<f.sheetNameToParentObject.size&&(m=f.parentObjectToToken.get(g)+m),r.getFormulaValue().toUpperCase());if((-1<o.indexOf("=RAND()")||-1<o.indexOf("=NOW()")||-1<o.indexOf("NOW()")||-1<o.indexOf("RAND()")||-1<o.indexOf("=RANDBETWEEN(")||-1<o.indexOf("RANDBETWEEN(")||this.randomValues.has(m))&&(f=this.randCollection.toString(),this.randomValues.has(m)?this.randomValues.has(m)&&(-1<o.indexOf("=RAND()")||-1<o.indexOf("=NOW()")||-1<o.indexOf("NOW()")||-1<o.indexOf("RAND()")||-1<o.indexOf("=RANDBETWEEN(")||-1<o.indexOf("RANDBETWEEN(")?this.randomValues.set(m,r.getFormulaValue()):r.getFormulaValue().toUpperCase()!==this.randomValues.get(m.toUpperCase())&&(this.randomValues.delete(m),f=f.split(m+this.parseArgumentSeparator).join("").split(this.parseArgumentSeparator+m).join("").split(m).join(""),this.randCollection=f.split(this.parseArgumentSeparator)),0===this.randomValues.size)&&this.randCollection.length&&(this.isRandomVal=!1,this.randomValues.clear(),this.randCollection=[]):(this.randomValues.set(m,r.getFormulaValue()),this.randCollection.push(m),this.isRandomVal=!0)),r.getFormulaValue()&&r.getFormulaValue()[0]===this.getFormulaCharacter()){this.cell=m;var c,o=void 0;if(z.isNullOrUndefined(t)||(t=e),this.getFormulaInfoTable().has(m)){if(o=this.getFormulaInfoTable().get(m),r.getFormulaValue()!==o.getFormulaText()||null==o.getParsedFormula()){o.setFormulaText(r.getFormulaValue()),this.getDependentFormulaCells().has(this.cell)&&this.clearFormulaDependentCells(this.cell);try{o.setParsedFormula(this.parser.parseFormula(r.getFormulaValue()))}catch(r){o.setFormulaValue(r),t=!1}}else this.parser.isError=!1;t&&(this.parser.isFormulaParsed=!0,n=(c=this.calculateFormula(o.getParsedFormula(),i))!==o.getFormulaValue()&&(!this.parentObject.isEdit||c!==this.formulaErrorStrings[$.FormulasErrorsStrings.CircularReference]),o.setFormulaValue(c))}else{(o=new gi).setFormulaText(r.getFormulaValue()),this.getDependentFormulaCells().has(m)||this.getDependentFormulaCells().set(m,new Map),this.getFormulaInfoTable().set(m,o);try{o.setParsedFormula(this.parser.parseFormula(r.getFormulaValue()))}catch(r){o.setFormulaValue(r),t=!1}t&&(n=(c=this.calculateFormula(o.getParsedFormula(),i))!==this.formulaErrorStrings[$.FormulasErrorsStrings.CircularReference],o.setFormulaValue(c))}t&&(void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(g)+1,o.getFormulaValue(),r.getRowIndex(),r.getColIndex()):this.parentObject.setValueRowCol(this.getSheetId(g),o.getFormulaValue(),r.getRowIndex(),r.getColIndex(),o.getFormulaText(),s))}else this.getFormulaInfoTable().has(m)&&(this.getFormulaInfoTable().delete(m),this.getDependentFormulaCells().has(m))&&this.clearFormulaDependentCells(m);t&&n&&this.getDependentCells().has(m)&&("Automatic"===this.parentObject.calculationMode||!this.parentObject.isEdit||h)&&this.getDependentCells().get(m).toString()!==m&&this.refreshDependentCells(m,void 0,void 0,a,l,u,h,p)},R.prototype.setValueRowCol=function(r,t,e,n){},R.prototype.getSortedSheetNames=function(){var r=this.getSheetFamilyItem(this.grid);if(null!=r&&null!=r.sheetNameToToken){if(null!=this.sortedSheetNames)return this.sortedSheetNames;var e=[];r.sheetNameToToken.forEach(function(r,t){e.push(t)}),e.sort(function(r,t){return t.length-r.length}),this.sortedSheetNames=e}return this.sortedSheetNames},R.prototype.getErrorLine=function(r){r=r.stack?r.stack.split("\n")[1].split(":"):null;return r?r[r.length-2]:null},R.prototype.createSheetFamilyID=function(){return this.sheetFamilyID===Number.MAX_SAFE_INTEGER&&(this.sheetFamilyID=Number.MIN_SAFE_INTEGER),this.sheetFamilyID++},R.prototype.computeMinMax=function(r,t){var e=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(e=!0,r.pop()),z.isNullOrUndefined(r)||0===r.length)return this.formulaErrorStrings[$.FormulasErrorsStrings.WrongNumberArguments];for(var n="max"===t?this.minValue:this.maxValue,i=0,o=r.length;i<o;i++)""===r[i].split(this.tic).join("").trim()&&(n=0);var s=r;if(255<s.length)return this.getErrorStrings()[$.CommonErrors.Value];for(var a=0;a<s.length;a++)if(-1<s[a].indexOf(":")&&this.isCellReference(s[a]))for(var l=this.getCellCollection(s[a]),u=0;u<l.length;u++){var h=e?this.getValueFromArg(l[u],null,null,!0):this.getValueFromArg(l[u]);e&&h.includes("SUBTOTAL(")||(g=this.parseFloat(h),""===h)||this.isNaN(this.parseFloat(g))||-1<this.getErrorStrings().indexOf(h)||(n="max"===t?Math.max(n,g):Math.min(n,g))}else{var p=e?this.getValueFromArg(s[a],null,null,!0):this.getValueFromArg(s[a]);if(!e||!p.includes("SUBTOTAL(")){var g=0,f=this.isCellReference(s[a]),m=""===p&&f,c=this.isNaN(this.parseFloat(p))&&f,f=p===(this.trueValue||this.falseValue)&&f;if(s[a]=s[a].startsWith("n")?s[a].slice(1):s[a],-1<this.getErrorStrings().indexOf(p))return p;if(p===this.trueValue&&s[a]===this.trueValue)p="1";else if(p===this.falseValue&&s[a]===this.falseValue)p="0";else if(m||c||f)continue;if(-1<p.indexOf('"')&&(p=p.split(this.tic).join("")),this.isNaN(this.parseFloat(p)))return this.getErrorStrings()[$.CommonErrors.Value];g=this.parseFloat(p),n="max"===t?Math.max(n,g):Math.min(n,g)}}return(n=n!==this.minValue&&n!==this.maxValue?n:0).toString()},R.prototype.calculateAvg=function(r,t){for(var e,n,i=r,o=0,s=0,a=0;a<i.length;a++)if(this.isCellReference(i[a])){if(-1<i[a].indexOf(":")){for(var l=this.getCellCollection(i[a]),u=0;u<l.length;u++)if(e=t?this.getValueFromArg(l[u],null,null,!0):this.getValueFromArg(l[u]),!t||!e.includes("SUBTOTAL(")){if(-1<this.getErrorStrings().indexOf(e))return e;z.isNullOrUndefined(e)||isNaN(this.parseFloat(e))||""===e||(o+=this.parseFloat(e),s+=1)}}else if(e=t?this.getValueFromArg(i[a],null,null,!0):this.getValueFromArg(i[a]),!t||!e.includes("SUBTOTAL(")){if(-1<this.getErrorStrings().indexOf(e))return e;z.isNullOrUndefined(e)||isNaN(this.parseFloat(e))||""===e||(o+=this.parseFloat(e),s+=1)}}else{if(-1<i[a].indexOf(this.tic)&&(isNaN(this.parseFloat(i[a].split(this.tic).join("")))||""===i[a].split(this.tic).join("").trim()))return this.getErrorStrings()[$.CommonErrors.Value];if(0!==i[a].length&&r[a]!==this.falseValue||(i[a]="0"),r[a]===this.trueValue&&(i[a]="1"),n=this.getValueFromArg(i[a].split(this.tic).join("")),-1<this.getErrorStrings().indexOf(n))return n;o+=this.parseFloat(n),s+=1}return 0===s?this.getErrorStrings()[$.CommonErrors.DivZero]:(o/s).toString()},R.prototype.registerGridAsSheet=function(r,t,e){z.isNullOrUndefined(this.modelToSheetID)&&(this.modelToSheetID=new Map),z.isNullOrUndefined(this.modelToSheetID.get(t))&&this.modelToSheetID.set(t,e);var n,e=this.getSheetFamilyItem(t),i=(e.isSheetMember=!0,r.toUpperCase());return 0===e.parentObjectToToken.size&&(e.parentObjectToToken=new Map),0===e.sheetNameToParentObject.size&&(e.sheetNameToParentObject=new Map),0===e.sheetNameToToken.size&&(e.sheetNameToToken=new Map),0===e.tokenToParentObject.size&&(e.tokenToParentObject=new Map),z.isUndefined(e.sheetNameToParentObject.get(i))?(n=this.sheetToken+this.tokenCount.toString()+this.sheetToken,this.tokenCount++,e.tokenToParentObject.set(n,t),e.parentObjectToToken.set(t,n),e.sheetNameToToken.set(i,n),e.sheetNameToParentObject.set(i,t)):(n=e.sheetNameToToken.get(i),e.tokenToParentObject.set(n,t),e.parentObjectToToken.set(t,n)),this.sortedSheetNames=null,r},R.prototype.unregisterGridAsSheet=function(i,r,o){var s=this,e=[r];o&&(e=[],z.isNullOrUndefined(this.modelToSheetID)||this.modelToSheetID.forEach(function(r,t){e.push(t)})),e.forEach(function(r){var t,e=s.getSheetFamilyItem(r),n=(o?r:i).toUpperCase();null!=e.sheetNameToParentObject&&e.sheetNameToParentObject.has(n)&&(e.sheetNameToParentObject.delete(n),t=e.sheetNameToToken.get(n),e.sheetNameToToken.delete(n),e.tokenToParentObject.delete(t),e.parentObjectToToken.delete(r)),s.modelToSheetID&&s.modelToSheetID.has(r)&&s.modelToSheetID.delete(r)}),this.sortedSheetNames=null},R.prototype.computeExpression=function(r,t){r=this.parser.parseFormula(r);return this.computeFormula(r,t)},R.prototype.isSheetMember=function(){var r=this.getSheetFamilyItem(this.grid);return!z.isNullOrUndefined(r)&&r.isSheetMember},R.prototype.destroy=function(){if(this.resetKeys(),this.dependentCells&&(this.dependentCells.clear(),this.dependentCells=null),this.dependentFormulaCells&&(this.dependentFormulaCells.clear(),this.dependentFormulaCells=null),this.formulaInfoTable&&(this.formulaInfoTable.clear(),this.formulaInfoTable=null),this.namedRanges.clear(),this.randomValues.clear(),this.randCollection=[],this.dependencyCollection=[],this.uniqueRange=[],this.sortRange=[],this.sortedSheetNames=null,this.evaluatingKeys.clear(),this.sheetFamiliesList&&(this.sheetFamiliesList.forEach(function(r){r.sheetDependentFormulaCells&&r.sheetDependentFormulaCells.clear(),r.sheetFormulaInfotable&&r.sheetFormulaInfotable.clear(),r.tokenToParentObject&&r.tokenToParentObject.clear(),r.parentObjectToToken&&r.parentObjectToToken.clear(),r.sheetNameToParentObject&&r.sheetNameToParentObject.clear(),r.sheetNameToToken&&r.sheetNameToToken.clear()}),this.sheetFamiliesList.clear(),this.sheetFamiliesList=null),this.modelToSheetID&&(this.modelToSheetID.clear(),this.modelToSheetID=null),this.defaultFamilyItem=null,this.lFormulas.clear(),this.parser&&this.parser.destroy(),this.parentObject=null,this.grid=null,"function"==typeof this.destroy)try{this.destroy()}catch(r){}},R.prototype.refreshRandValues=function(r){var t,e,n,i;this.randomValues.has(r)&&(this.randomValues.delete(r),-1<(r=this.randCollection.indexOf(r))&&this.randCollection.splice(r,1),0!==this.randomValues.size||this.randCollection.length||(this.randomValues.clear(),this.randCollection=[]));for(var o=0;o<this.randomValues.size;o++)t=this.rowIndex(this.randCollection[o]),e=this.colIndex(this.randCollection[o]),n=(parseFloat(this.getSheetToken(this.randCollection[o]).split(this.sheetToken).join(""))+1).toString(),i=this.getSheetFamilyItem(n),this.grid=i.sheetNameToParentObject.get(n),i=this.randomValues.get(this.randCollection[o]),i=this.computeFormula(i),void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(this.grid)+1,i,t,e):this.parentObject.setValueRowCol(this.getSheetId(this.grid),i,t,e)},R.prototype.refreshDependentCells=function(r,t,e,s,n,i,o,a){var l,u=this,h=(e||(l=!0,e=[]),this.getSheetFamilyItem(this.grid));try{var p=this.getDependentCells().get(r);if(p&&0!==p.length&&("Automatic"===this.parentObject.calculationMode||o||"calculate"===a))for(var g=void 0,g=0;g<p.length;g++){var f=p[g];if(!(t&&-1<f.indexOf(t)||f===r||-1<e.indexOf(f))){var m=this.getSheetToken(f),c=this.parentObject.sheets,d=this.parentObject.activeSheetIndex;if(m.length){this.grid=h.tokenToParentObject.get(m);var N=Number(this.grid),v="";if(!this.isNaN(N)&&c)for(var E=0;E<c.length;E++)c[E].id===N&&(v=c[E].name,d=E);this.actCell=v+"!"+f.split(m)[1]}else this.actCell=f.split(m)[1];try{var S=function(r,t){t&&(u.cell=r,u.parser.isFormulaParsed=!0,t.setFormulaValue(u.calculateFormula(t.getParsedFormula(),!0)))},y=this.rowIndex(f),C=this.colIndex(f),b=this.getFormulaInfoTable().get(f);if(void 0===this.parentObject.setValueRowCol)S(f,b),this.setValueRowCol(this.getSheetID(this.grid)+1,b.getFormulaValue(),y,C);else{var A=c&&c[d].rows&&c[d].rows[y-1]&&c[d].rows[y-1].cells&&c[d].rows[y-1].cells[C-1],O=void 0;if(A&&A.formula&&A.formula.toLowerCase().includes("unique")){if(this.uniqueCells&&-1!==this.uniqueCells.indexOf(f))continue;this.uniqueCells||(this.uniqueCells=[]),this.uniqueCells.push(f),S(f,b),O=b.getFormulaValue(),this.uniqueCells.splice(this.uniqueCells.indexOf(f),1),this.uniqueCells.length||(this.uniqueCells=null)}else if(A&&A.formula&&A.formula.toLowerCase().includes("sort")){if(this.sortCells&&-1!==this.sortCells.indexOf(f))continue;this.sortCells||(this.sortCells=[]),this.sortCells.push(f),S(f,b),O=b.getFormulaValue(),this.sortCells.splice(this.sortCells.indexOf(f),1),this.sortCells.length||(this.sortCells=null)}else-1===e.indexOf(f)&&e.push(f),O=null;this.parentObject.setValueRowCol(this.getSheetId(this.grid),O,y,C,b.getFormulaText())}this.refreshDependentCells(f,null,e,null,n)}catch(r){continue}}}if(l){if(!n&&i&&4===i.length){for(var m=this.getSheetToken(r),F=[],x=i[0],V=i[2];x<=V;x++)for(var R=i[1],T=i[3];R<=T&&(x!==V||R!==T);R++){A=m+Br(x,R);this.refreshDependentCells(A,null,e,null,n),F.push(A)}var I=new Set(F);e=e&&e.filter(function(r){return!I.has(r)})}var M=this.parentObject.sheets;(e=M?e:[]).forEach(function(r){for(var t,e=u.getSheetId(h.tokenToParentObject.get(u.getSheetToken(r))),n=0;n<M.length;n++)if(M[n].id===e){t=n;break}var i=u.rowIndex(r)-1,r=u.colIndex(r)-1,o=M[t].rows[i]&&M[t].rows[i].cells[r];o&&u.parentObject.notify("calculateFormula",{cell:o,rowIdx:i,colIdx:r,sheetIndex:t,isDependentRefresh:!0,isRandomFormula:s,action:a})})}}finally{this.getDependentCells().has(r)&&(this.grid=h.tokenToParentObject.get(this.getSheetToken(r)))}},ui([z.Event()],R.prototype,"onFailure",void 0),ui([z.NotifyPropertyChanges],R));function R(r){var t=ai.call(this,null,null)||this;t.lFormulas=new Map,t.storedData=new Map,t.keyToRowsMap=new Map,t.rowsToKeyMap=new Map,t.rightBracket=String.fromCharCode(161),t.leftBracket=String.fromCharCode(162),t.sheetToken="!",t.cell="",t.cellPrefix="!0!A",t.treatEmptyStringAsZero=!1,t.tic='"',t.singleTic="'",t.trueValue="TRUE",t.falseValue="FALSE",t.parseDecimalSeparator=".",t.arithMarker=String.fromCharCode(180),t.arithMarker2=t.arithMarker+t.arithMarker,t.dependentCells=null,t.dependentFormulaCells=null,t.minValue=Number.MIN_SAFE_INTEGER,t.maxValue=Number.MAX_SAFE_INTEGER,t.categoryCollection=["All"],t.dependencyLevel=0,t.randomValues=new Map,t.isRandomVal=!1,t.randCollection=[],t.dependencyCollection=[],t.uniqueRange=[],t.sortRange=[],t.formulaErrorStrings=[],t.errorStrings=null,t.parseArgumentSeparator=",",t.dateTime1900=new Date(1900,0,1,0,0,0),t.isParseDecimalSeparatorChanged=!1,t.isArgumentSeparatorChanged=!1,t.sheetFamilyID=0,t.defaultFamilyItem=null,t.sheetFamiliesList=null,t.modelToSheetID=null,t.tokenCount=0,t.sortedSheetNames=null,t.tempSheetPlaceHolder=String.fromCharCode(133),t.namedRanges=new Map,t.formulaInfoTable=null,t.millisecondsOfaDay=864e5,t.parseDateTimeSeparator="/",t.evaluatingKeys=new Set;var e=r&&r.locale?r.locale:"en-US";return t.l10n=new z.L10n("calculate",w,e),t.refreshLocalizedStrings(),new ei(t),t.parentObject=z.isNullOrUndefined(r)?t:r,t.grid=t.parentObject,t.parser=new oi(t),t}var U=function(r,t){this.formulaCorrection=!1,this.message=r,this.formulaCorrection=t},gi=(fi.prototype.getFormulaText=function(){return this.formulaText},fi.prototype.setFormulaText=function(r){this.formulaText=r},fi.prototype.getFormulaValue=function(){return this.formulaValue},fi.prototype.setFormulaValue=function(r){this.formulaValue=r},fi.prototype.getParsedFormula=function(){return this.parsedFormula},fi.prototype.setParsedFormula=function(r){this.parsedFormula=r},fi);function fi(){this.calcID=Number.MIN_VALUE+1,this.calcID1=Number.MIN_VALUE+1}var mi=function(){this.isSheetMember=!1,this.parentObjectToToken=new Map,this.sheetDependentFormulaCells=new Map,this.sheetNameToParentObject=new Map,this.sheetNameToToken=new Map,this.tokenToParentObject=new Map,this.sheetFormulaInfotable=new Map};function J(r){for(var t=[],e=0;0<r&&e<9;){r--;var n="A".charCodeAt(0);t[e]=String.fromCharCode(r%26+n),r=parseInt((r/26).toString(),10),e++}for(var i=[],o=0;o<e;o++)i[e-o-1]=t[o];return i.join("")}function ci(t,e,r){return this.row=t,this.col=e,this.value=r,this.getRowIndex=function(){return t},this.setRowIndex=function(r){t=r},this.getColIndex=function(){return e},this.setColIndex=function(r){e=r},this.getFormulaValue=function(){return r},this}$.ArrayFormulas=ze,$.BasicFormulas=ei,$.CalcSheetFamilyItem=mi,$.Calculate=li,$.CalculateCommon=r,$.ComplexNumbersFormulas=ve,$.DatabaseFormulas=zn,$.DateTimeExtraFormulas=Ae,$.DateTimeFormulas=ye,$.DateTimeIntlFormulas=bn,$.EngineeringBaseFormulas=tt,$.EngineeringBesselFormulas=gt,$.EngineeringConvertFormulas=lt,$.EngineeringMiscFormulas=it,$.FinancialAmortizationEcmaFormulas=Bn,$.FinancialAnnuityFormulas=dt,$.FinancialBondHelpers=Ln,$.FinancialCashflowFormulas=xt,$.FinancialCouponsFormulas=_n,$.FinancialDepreciationFormulas=Et,$.FinancialRatesFormulas=bt,$.FinancialSecuritiesFormulas=It,$.FormulaError=U,$.FormulaInfo=gi,$.FormulaModuleBase=t,$.InformationAdvancedFormulas=En,$.InformationEcmaFormulas=In,$.InformationExtraFormulas=dn,$.InformationFormulas=gn,$.LogicalExtraFormulas=Ie,$.LogicalFormulas=xe,$.LookupArrayFormulas=He,$.LookupFormulas=we,$.LookupRefExtraFormulas=qe,$.LookupRefFormulas=ke,$.MathAggregateFormulas=W,$.MathCeilingEcmaFormulas=xn,$.MathCombinatoricsFormulas=wr,$.MathMiscFormulas=tr,$.MathNumberFormulas=Pr,$.MathRoundingFormulas=Z,$.MathTrigFormulas=ir,$.MathTrigHyperbolicFormulas=ar,$.MatrixFormulaBase=Gr,$.MatrixFormulas=zr,$.Parser=oi,$.RegressionEcmaFormulas=ri,$.StatisticalAdvancedFormulas=Lt,$.StatisticalCorrelationFormulas=zt,$.StatisticalDispersionFormulas=_t,$.StatisticalDistributionExtendedFormulas=ce,$.StatisticalDistributionFormulas=oe,$.StatisticalEcmaFormulas=Gn,$.StatisticalExtendedFormulas=ge,$.StatisticalFormulas=Ut,$.StatisticalIfsFormulas=le,$.StatisticalMomentsFormulas=Gt,$.StatisticalPercentileFormulas=te,$.StatisticalSampleBase=Bt,$.TextAdvancedFormulas=ln,$.TextEcmaFormulas=wn,$.TextExtraFormulas=on,$.TextFormulas=tn,$.ValueChangedArgs=ci,$.besselI=Cr,$.besselJ=br,$.besselK=Ar,$.besselY=Fr,$.betaDist=Ir,$.betaInv=Mr,$.binomialCoeff=f,$.calculateDefaultLocale=w,$.chiSquareCDF=Nr,$.chiSquareInv=vr,$.erf=ur,$.erfc=hr,$.fCDF=Er,$.fInv=yr,$.factorial=l,$.formatComplex=s,$.gamma=cr,$.getAlphalabel=J,$.getSkeletonVal=I,$.isExternalFileLink=D,$.isUndefined=function(r){return void 0===r},$.logGamma=mr,$.logNormCDF=xr,$.logNormInv=Vr,$.lowerRegularizedGamma=dr,$.normCDF=pr,$.normInv=gr,$.parseComplexText=fr,$.tCDF=Rr,$.tInv=Tr,Object.defineProperty($,"__esModule",{value:!0})});
|
|
11
11
|
//# sourceMappingURL=ej2-calculate.umd.min.js.map
|