UNPKG

js-pkg

Version:
10 lines 420 kB
/*! * filename: ej.calculate.min.js * version : 15.3.0.33 * Copyright Syncfusion Inc. 2001 - 2017. All rights reserved. * Use of this code is subject to the terms of our license. * A copy of the current license can be obtained at any time by e-mailing * licensing@syncfusion.com. Any infringement will be prosecuted under * applicable laws. */ (function(n){typeof define=="function"&&define.amd?define(["./../common/ej.core.min"],n):n()})(function(){var LookupCachingMode,CalcQuickBase,FormulaInfoSetAction,FormulaInfoHashtable,HashTable;(function($,ej,undefined){return window.__calcQuickextends=function(n,t){function r(){this.constructor=n}for(var i=0;i<t.length;i++)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},window.CalcEngine=function(parentObject){var _weekEndType,FormulaArgumentType;this.parentObject=parentObject;this._useFormulaValues=!1;this._multiTick=!1;this._isErrorString=!1;this._ignoreBracet=!1;this._libraryFunctions=new HashTable;this._customlibraryFunctions=new HashTable;this._refreshedCells=new HashTable;this._treatStringsAsZero=!0;this._supportLogicalOperators=!1;this._isRangeOperand=!1;this._uniqueStringMarker=String.fromCharCode(127);this._isParseArgumentSeparator=!1;this._isParseDecimalSeparatorChanged=!1;this._enableFormulaErrorValidation=!1;this._validPrecedingChars=" (+-*/^&<>=";this._validFunctionNameChars="_";this.bMARKER=String.fromCharCode(146);this.bMARKER2=this.bMARKER+this.bMARKER;this.tic='"';this._parseDecimalSeparator=".";this.parseDateTimeSeparator="/";this._parseArgumentSeparator=",";this._rightBracket=String.fromCharCode(131);this._leftBracket=String.fromCharCode(130);this.iFMarker="qIF"+String.fromCharCode(130);this.braceLeft="{";this.braceRight="}";this._braceRightNLeft=")(";this.computedValueLevel=0;this._circCheckList=[];this._maximumRecursiveCalls=100;this._sortedSheetNames=null;this.trueValueStr="TRUE";this.falseValueStr="FALSE";this.useDatesInCalcs=!1;this.sheetToken="!";this.namedRanges=null;this.undefinednamedRange=null;this.undefinedsheetNamedRnages=null;this.namerangecellcollection=null;this.sheetNamedRangesOriginalNames=null;this.sheetNamedRangeCellCollection=null;this.sheetDependentNamedRangeCells=null;this.namedRangesOriginalNames=null;this.namedRangeValues=null;this.rangeValues=null;this.dependentNamedRangeCells=null;this.namedRangesSized=null;this._namedRangesNonScoped=null;this.char_add="+";this.char_and="i";this.char_ANDop=String.fromCharCode(140);this.char_divide="/";this.char_ELSEop=String.fromCharCode(144);this.char_EM="r";this.char_EP="x";this.char_equal="=";this.char_greater=">";this.char_greatereq="h";this.char_IFop=String.fromCharCode(142);this.char_less="<";this.char_lesseq="f";this.char_multiply="*";this.char_noequal="p";this.char_NOTop=String.fromCharCode(145);this.char_or="w";this.char_ORop=String.fromCharCode(139);this.char_subtract="-";this.char_THENop=String.fromCharCode(143);this.char_XORop=String.fromCharCode(141);this.chartic="'"[0];this._string_and="&";this._string_E="E";this._string_EM="E-";this._string_empty="";this._string_EP="E+";this._string_fixedreference="$";this._string_greatereq=">=";this._string_lesseq="<=";this._string_noequal="<>";this._string_or="^";this.token_add="a";this.token_and="c";this.token_ANDop=String.fromCharCode(133);this.token_divide="d";this.token_ELSEop=String.fromCharCode(137);this.token_EM="v";this.token_EP="t";this.token_equal="e";this.token_greater="g";this.token_greatereq="j";this.token_IFop=String.fromCharCode(135);this.token_less="l";this.token_lesseq="k";this.token_multiply="m";this.token_noequal="o";this.token_NOTop=String.fromCharCode(138);this.token_or=String.fromCharCode(126);this.token_ORop=String.fromCharCode(132);this.token_subtract="s";this.token_THENop=String.fromCharCode(136);this.token_XORop=String.fromCharCode(134);this.tokens=[this.token_add,this.token_subtract,this.token_multiply,this.token_divide,this.token_less,this.token_greater,this.token_equal,this.token_lesseq,this.token_greatereq,this.token_noequal,this.token_and,this.token_or];this._dateTime1900=new Date(1900,0,1,0,0,0);this._preserveLeadingZeros=!1;this._ignoreCellValue=!1;this._errorStrings=null;this._cell="";this._iterationMaxCount=0;this._supportRangeOperands=!1;this._allowShortCircuitIFs=!1;this._processUpperCaseFormula="";this._processUpperCaseIvalue=0;this._processUpperCaseSheet="";this._markerChar="`";this._rowMaxCount=-1;this._columnMaxCount=-1;this._isInteriorFunction=!1;this._tempSheetPlaceHolder=String.fromCharCode(133);this.sheetFamilyID=0;this._supportsSheetRanges=!0;this._markers="()+-*/=><.,!";this._formulaInfoTable=null;this._dependentFormulaCells=null;this._dependentCells=new HashTable;this._calculatingSuspended=!1;this._inAPull=!1;this._useDatesInCalcs=!1;this._excelLikeComputations=!1;this._rethrowLibraryComputationExceptions=!1;this.formulaErrorStrings=["binary operators cannot start an expression","cannot parse","bad library","invalid char in front of","number contains 2 decimal points","expression cannot end with an operator","invalid characters following an operator","invalid character in number","mismatched parentheses","unknown formula name","requires a single argument","requires 3 arguments","invalid Math argument","requires 2 arguments","#NAME?","too complex","circular reference: ","missing formula","improper formula","invalid expression","cell empty","bad formula","empty expression","","mismatched string quotes","wrong number of arguments","invalid arguments","iterations do not converge","Control named '{0}' is already registered","Calculation overflow","Missing sheet"];this._parseDateTimeSeparator="/";this._millisecondsOfaDay=864e5;this.treat1900AsLeapYear=!1;this._oaDate=new Date(1899,11,30);this._saveStringsText="";this._processedCells=[];this.ignoreValueChanged=!1;this._breakedFormulaCells=[];this._tempBreakedFormulaCells=[];this._lockDependencies=!1;this._useDependencies=!1;this._inHandleIterations=!1;this._inRecalculateRange=!1;this._useNoAmpersandQuotes=!1;this._calcID=0;this._operators_cannot_start_an_expression=0;this._reservedWord_AND=1;this._reservedWord_XOR=2;this._reservedWord_IF=3;this._number_contains_2_decimal_points=4;this._reservedWord_ELSE=5;this._reservedWord_NOT=6;this._invalid_char_in_number=7;this._invalid_characters_following_an_operator=6;this._mismatched_parentheses=8;this._unknown_formula_name=9;this._requires_a_single_argument=10;this._requires_3_args=11;this._invalid_Math_argument=12;this._requires_2_args=13;this._bad_index=14;this._too_complex=15;this._circular_reference_=16;this._missing_formula=17;this._improper_formula=18;this._invalid_expression=19;this._cell_empty=20;this._bad_formula=21;this._empty_expression=22;this._virtual_mode_required=23;this._mismatched_tics=24;this._wrong_number_arguments=25;this._invalid_arguments=26;this._iterations_dont_converge=27;this._calculation_overflow=29;this._already_registered=28;this._missing_sheet=30;this._alwaysComputeDuringRefresh=!0;this._libraryComputationException=null;this._dependencyLevel=0;this._isDisposed=undefined;this._forceRefreshCall=!1;this.grid=this.parentObject;this._enableLookupTableCaching=0;this._lookupTables=new HashTable;this._isIE8=ej.browserInfo().name=="msie"&&ej.browserInfo().version=="8.0"?!0:!1;this.nativeFormats=[];this.nativeFormats.push("[DBNUM1]");this.nativeFormats.push("[DBNUM2]");this.nativeFormats.push("[DBNUM3]");this.nativeFormats.push("[DBNUM4]");this._addFunction=function(n,t){return(n=n.toUpperCase(),this._libraryFunctions.getItem(n)==undefined)?(this._libraryFunctions.add(n,t),!0):!1};this._addToFormulaDependentCells=function(n){var t=this.cell,i=CalcEngine.getSheetFamilyItem(this.grid),r;i.sheetNameToParentObject!=null&&t.indexOf(this.sheetToken)==-1&&(r=i.parentObjectToToken.getItem(this.grid),t=r+t);this.getDependentFormulaCells().containsKey(t)?this.getDependentFormulaCells().getItem(t).containsKey(n)||this.getDependentFormulaCells().getItem(t).add(n,n):(this.getDependentFormulaCells().add(t,new HashTable),this.getDependentFormulaCells().getItem(t).add(n,n))};this._arrayRemove=function(n,t){for(var i=null;(i=n.indexOf(t))!==-1;)n.splice(i,1);return n};this._canGetRowIndex=function(n){var t=0;if(t<n.length&&n[t]==this.sheetToken){for(t++;t<n.length&&n[t]!=this.sheetToken;)t++;t++}while(t<n.length&&this._isLetter(n[t]))t++;return t<n.length?this._isDigit(n[t])?!0:!1:!1};this._checkAddNonScopedNamedRange=function(n){var i=-1,t;(i=n.indexOf("!"))>-1&&(t=n.substring(i+1),this._namedRangesNonScoped.containsKey(t)||this._namedRangesNonScoped.add(t,this.namedRanges.getItem(n)))};this._checkHasCharBeforeNumber=function(n){for(var i=!1,t=n.length-1;t>0;t--)if(this._isLetter(n[t])){i=!0;break}return i};this._checkIfScopedRange=function(n,t){var r,s,u,i,o;t="";var f="NaN",h=this.getSheetID(this.grid),e=CalcEngine.getSheetFamilyItem(this.grid);if(n[0]==this.sheetToken.toString()&&(r=n.indexOf(this.sheetToken,1),r>1&&!isNaN(parseInt(n.substring(1,r-1)))&&(n=n.substring(r+1))),s="!"+h.toString()+"!",e.sheetNameToToken==null)return f;for(u=e.sheetNameToToken.keys(),i=0;i<u.length;i++)e.sheetNameToToken.getItem(u[i]).toString()==s&&(o=(u[i]+"!"+n).toUpperCase(),this.getNamedRanges().containsKey(o)&&(t=this.getNamedRanges().getItem(o).toUpperCase(),f=t));return f};this._checkUnderTolerance=function(n,t){return Math.abs(t)>this._absoluteZero?Math.abs((n-t)/t)<this._iterationMaxTolerance:Math.abs(n-t)<this._iterationMaxTolerance};this._combineStack=function(n,t,i){var r="",f,u,e;if(i.length==2){for(f=3,u=n.substring(t);f>1;)e=i.pop().toString(),r=e==this.tic+this.tic?r+this.tic:e+r,u=f==3?e:u,f--;i[0]==this.tic+this.tic&&i.pop();r=n.length==t&&this._isTextEmpty(u.split(this.tic).join(""))?r+u:r;i.push(r)}return i};this._computeMath=function(n,t){var u=0,r,l=!1,a,i,f,e,s,y,h,c,o;if(n.length>0&&(n=this.splitArgsPreservingQuotedCommas(n)[0]),a=[this.getParseArgumentSeparator(),":"],n.length>0&&(!this._isLetter(n[0])&&n[0]!=this.sheetToken&&n[0]!=this.bMARKER||n[0]=="u"&&this._isDigit(n[1]))&&this._indexOfAny(n,a)==-1){if(n=n.split("u").join("-").split("n").join(""),i=this._parseDouble(n),isNaN(i))return this.getErrorStrings()[1].toString();u=t(i)}else if(n.length>0&&(n[0]==this.bMARKER||n[0]=="u"||n[0]=="n"||this._indexOfAny(n,this.tokens)>-1)){n=n.split("{").join("(");n=n.split("}").join(")");f="";e=Math.PI.toString();try{n.indexOf(e)>-1?(r=this._substring(n,1,n.indexOf(e)-2),r=this._isTextEmpty(r)?"1":r,f=this._indexOfAny(n,this.tokens)>-1?n.split(e.toString())[1]:"1",l=!0):r=this.computedValue(n)}catch(v){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return v}if(l)if(s=this.computedValue(r.toString()),f.indexOf("180")>-1)if(i=this._parseDouble(s),i)u=t(i*(Math.PI/180));else return this.getErrorStrings()[1].toString();else{if(y=this.computedValue(s+f),h=this._parseDouble(y),isNaN(h))return this.getErrorStrings()[1].toString();u=t(h*Math.PI)}else{if(i=this._parseDouble(r),isNaN(i))return this.getErrorStrings()[1].toString();u=t(i)}}else for(n=n.split("u").join("-"),c=this.getCellsFromArgs(n),o=0;o<c.length;o++){try{r=this.getValueFromArg(c[o])}catch(v){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return v}if(r.length>0){if(i=this._parseDouble(r),isNaN(i))return this.getErrorStrings()[1].toString();u=t(i)}break}return this.computeIsErr(u.toString())==this.trueValueStr?this.getErrorStrings()[4].toString():u.toString()};this._computeInteriorFunctions=function(n){var i,r,t,u;try{if(this._isTextEmpty(n))return n;for(this.computeFunctionLevel++,i=this._findLastqNotInBrackets(n);i>0;){if(r=n.substring(i).indexOf(this._rightBracket),r==-1)throw this.formulaErrorStrings[this._bad_formula];this._isInteriorFunction=!0;t=this._substring(n,i,r+1);t=this.computedValue(t);t==""||t[0]!=this.tic[0]||t[t.length-1]!=this.tic[0]||(u=this._substring(t,1,t.length-2),u.indexOf(this.tic)!=-1&&(this._multiTick=!0,u=u.split(this.tic).join("|")),t=this.tic+u+this.tic);t=this._markupResultToIncludeInFormula(t);n=this._isInteriorFunction?n.substring(0,i)+t+n.substring(i+r+1):n.substring(0,i)+t.split(this.tic).join("")+n.substring(i+r+1);this._isInteriorFunction=!1;i=this._findLastqNotInBrackets(n)}}catch(f){return f}finally{this.computeFunctionLevel--}return n};this._findAndCheckPrecedingChar=function(n,t,i){var r=n.indexOf(t,i);if(r>0)while(r>-1&&this.getValidPrecedingChars().indexOf(n[r-1])==-1)r=n.indexOf(t,r+1);return this._findAndCheckPrecedingCharCopy=n,r};this._findLastNonQB=function(n){var r=-1,i,t;if(n.indexOf(this.bMARKER)>-1)for(i=0,t=n.length-1;t>=0;--t)if(n[t]==this._rightBracket)i--;else if(n[t]==this._leftBracket)i++;else if(n[t]==this.bMARKER&&i==0){r=t;break}return r};this._findLastqNotInBrackets=function(n){for(var r=-1,i=!1,t=n.length-1;t>-1;){if(n[t]=="q"&&i){r=t;break}n[t]==this._leftBracket?i=!0:n[t]==this._rightBracket&&(i=!1);t--}return r};this._findNextSeparator=function(n,t){for(var i=0,r=!1;!r&&t<n.length;)n[t]=="q"?i++:n[t]==this._rightBracket?i--:i==0&&n[t]==this.getParseArgumentSeparator()&&(r=!0,t--),t++;return t.toString()};this._findNextEndIndex=function(n,t){for(var i=0,u=t,r=!1;!r&&t<n.Length;)n[t]=="["?i++:n[t]=="]"&&(i--,i==0&&(r=!0)),t++;return t-u};this._findNonQB=function(n){var r=-1,i,t;if(n.indexOf(this.bMARKER)>-1)for(i=0,t=0;t<n.length;++t)if(n[t]==this._rightBracket)i--;else if(n[t]==this._leftBracket)i++;else if(n[t]==this.bMARKER&&i==0){r=t;break}return r};this._findRightBracket=function(n,t){for(var i=0,r=!1;!r&&t<n.length;)n[t]=="q"?i++:i==0&&n[t]==this._rightBracket?(r=!0,t--):n[t]==this._rightBracket&&i--,t++;return r?t.toString():"NaN"};this._fromOADate=function(n){var t=new Date;return t.setTime(n*this._millisecondsOfaDay+Date.parse(this._oaDate)),t};this._getDateFromSerialDate=function(n){return this.treat1900AsLeapYear&&n>59&&(n-=1),new Date(this._oaDate.setDate(this._oaDate.getDate()+n))};_weekEndType=["","6,0","0,1","1,2","2,3","3,4","4,5","5,6","","","","0","1","2","3","4","5","6"];this._getDoubleArray=function(n){var i,t="",u=[],f,r,o,e;for(n=this.adjustRangeArg(n),f=this.splitArgsPreservingQuotedCommas(n),r=0;r<f.length;r++)if(f[r].indexOf(":")>-1)for(o=this.getCellsFromArgs(f[r]),e=0;e<o.length;e++)t=this.getValueFromArg(o[e]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t.length>0&&(i=this._parseDouble(t),isNaN(i)?u.push(0):u.push(Number(i)));else t=this.getValueFromArg(f[r]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(Number(i))?u.push(0):u.push(i);return u};this._getDoubleArrayA=function(n){var t,i="",e=[],u,r,o,f;for(n=this.adjustRangeArg(n),u=this.splitArgsPreservingQuotedCommas(n),r=0;r<u.length;r++)if(u[r].indexOf(":")>-1)for(o=this.getCellsFromArgs(u[r]),f=0;f<o.length;f++)i=this.getValueFromArg(o[f]),i.length>0&&(i==this.trueValueStr?t=1:(t=this._parseDouble(i),isNaN(Number(t))&&t==0),e.push(t));else i=this.getValueFromArg(u[r]),i==this.trueValueStr?t=1:(t=this._parseDouble(i.toString()),isNaN(t)&&(t=0)),e.push(t);return e};this._getFormulaArrayBounds=function(n,t,i){var o=this.colIndex(this.cell),r=this.rowIndex(this.cell),s="",v=this.getFormulaInfoTable().containsKey(this.cell)?this.getFormulaInfoTable().getItem(this.cell):null,h,u,f,e;for(s=v!=null?v.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,r,o):this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,r,o),h=1,u=1,f=1;f<=t;f++)if(o-f>0){var c=this._getSheetTokenFromReference(this.cell)+RangeInfo.getAlphaLabel(o-f)+r.toString(),l="",a=this.getFormulaInfoTable().containsKey(c)?this.getFormulaInfoTable().getItem(c):null;if(l=a!=null?a.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,r,o-f):this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,r,o-f),u=o-f,s!=null&&l!=s){u++;break}}for(e=1;e<=i;e++)if(r-e>0){var c=this._getSheetTokenFromReference(this.cell)+RangeInfo.getAlphaLabel(u)+(r-e).toString(),l="",a=this.getFormulaInfoTable().containsKey(c)?this.getFormulaInfoTable().getItem(c):null;if(l=a!=null?a.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,r-e,u):this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,r-e,u),h=r-e,s!=null&&l!=s){h++;break}}return this._getFormulaArrayBoundsfirstRowIndex=h,this._getFormulaArrayBoundsfirstColIndex=u,this._getFormulaArrayBoundslastRowIndex=h+t,this._getFormulaArrayBoundslastColIndex=u+i,!0};FormulaArgumentType={None:{},Range:{},CellReference:{},TwoTextWithNumber:{},TextWithNumber:{},Numbers:{},Text:{},Date:{}};this.formulaErrorStringCheck=function(n,t){var r=this.splitArgsPreservingQuotedCommas(n),o,k,l,s,f,y,p,w,b,c,a,h,u,g,e,i;switch(t){case FormulaArgumentType.None:if(n!=""){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._invalid_arguments]}break;case FormulaArgumentType.Range:if(o="",s=r,s!=null)for(i=0;i<s.length;i++)if(f=s[i],f.indexOf(":")>-1){if(f[0]==this.tic){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()}for(k=this.getCellsFromArgs(f),l=0;l<k.length;l++){try{o=this.getValueFromArg(l)}catch(tt){}if(o.length>0&&this.getErrorStrings().indexOf(o)>-1){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return o}}}else{try{o=this.getValueFromArg(f)}catch(tt){}if(o.length>0&&(c=this.formulaErrorStringCheck(o,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(c)>-1))return c}break;case FormulaArgumentType.CellReference:if(s=r,s!=null)for(i=0;i<s.length;i++)if(f=s[i],this._isCellReference(f)||f[0]!=this.tic){if(!this._isCellReference(f))return this.getErrorStrings()[5].toString()}else return this.getErrorStrings()[1].toString();break;case FormulaArgumentType.TwoTextWithNumber:if(y=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(y)>-1)return y;if(p=this.formulaErrorStringCheck(r[1],FormulaArgumentType.Text),this.getErrorStrings().indexOf(p)>-1)return p;if(r.length==3&&(w=this.formulaErrorStringCheck(r[2],FormulaArgumentType.Text),this.getErrorStrings().indexOf(w)>-1))return w;break;case FormulaArgumentType.TextWithNumber:a=0;b=0;var v=this.getValueFromArg(r[0].split(this.tic).join("")),d=Boolean(v),it=r.length==2&&isNaN(typeof this.getValueFromArg(r[1])=="boolean"),a=isNaN(this._parseDouble(r[0].split(this.tic).join("")));if(a&&(u=this.getValueFromArg(r[0]),this.getErrorStrings().indexOf(u)>-1)){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return u}if(r.length==2&&(b=this._parseDouble(r[1].split(this.tic).join("")),isNaN(b)&&(c=this.formulaErrorStringCheck(r[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(c)>-1)))return c;break;case FormulaArgumentType.Text:for(e=r,i=0;i<e.length;i++){var v=this.getValueFromArg(e[i]),d=Boolean(v),a=isNaN(this._parseDouble(e[i].split(this.tic).join("")));if(a&&(u=this.getValueFromArg(e[i]),this.getErrorStrings().indexOf(u)>-1)){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return u}}break;case FormulaArgumentType.Numbers:for(h=r,i=0;i<h.length;i++){var v=this.getValueFromArg(h[i].split(this.tic).join("")),d=Boolean(v),a=this._parseDouble(h[i].split(this.tic).join(""));if(isNaN(a)){if(u=this.getValueFromArg(h[i]),this.getErrorStrings().indexOf(u)>-1){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return u}if(!d&&isNaN(this._parseDouble(u))&&u!=""||h[i].includes(":")&&this._isCellReference(h[i])||u.startsWith(this.tic)){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()}}}break;case FormulaArgumentType.Date:for(g=0,e=r,i=0;i<e.length;i++){var v=this.getValueFromArg(e[i].split(this.tic).join("")),nt=Boolean(v),u=this.getValueFromArg(e[i]);if(this.getErrorStrings().indexOf(u)>-1){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return u}if(!nt&&isNaN(Date.parse(this._stripTics0(u)))&&isNaN(this._parseDouble(this._stripTics0(u)))&&u!=""){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()}}}return n};this._getSerialDateFromDate=function(n,t,i){var u=0,f,r,e;for(n<1900&&(n+=1900),f=!1;!f;){while(t>12)n++,t-=12;for(f=!0,r=new Date(n,t,1,-1).getDate();i>r;)r=new Date(n,t,1,-1).getDate(),t++,i-=r,f=!1;i<1&&(t--,r=new Date(n,t,1,-1).getDate(),i=r-i)}return e=Date.parse(n.toString()+this.getParseDateTimeSeparator()+t.toString()+this.getParseDateTimeSeparator()+i.toString()),isNaN(e)||(u=this._toOADate(new Date(e))),this.treat1900AsLeapYear&&u>59&&(u+=1),u};this._getSerialDateTimeFromDate=function(n){var t=this._toOADate(n);return this.treat1900AsLeapYear&&t>59&&(t+=1),t};this._getSheetTokenFromReference=function(n){var i="",t;if(n.length>2&&n[0]==this.sheetToken){for(t=1,i=this.sheetToken;t<n.length&&n[t]!=this.sheetToken;)i+=n[t],t++;i+=this.sheetToken}return i};this._getValueComputeFormulaIfNecessary=function(n,t,i){var e=!1,u=this.getFormulaInfoTable().getItem(this.cell),f,r,o,s;if(f=this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(i)+1,n,t):this.parentObject.getValueRowCol(this.getSheetID(i)+1,n,t),r=f!=null&&!(f.Length===0)?f:"",r[r.length-1]=="}"&&r[0]=="{"&&(r=this._substring(r,1,r.length-2)),r==""&&(u==null||u==undefined)||r!=""&&r[0]!=this.getFormulaCharacter()&&r[r.length-1]!="%")return u!=null&&r==u.getFormulaValue()?u.getFormulaValue():r;if(r.length>0&&r[0]==this.getFormulaCharacter()&&u==null){u=new FormulaInfo;u.setFormulaText(f.toString());this.getDependentFormulaCells().containsKey(this.cell)||this.getDependentFormulaCells().add(this.cell,new HashTable);o=!0;try{u.setParsedFormula(this.parseFormula(r))}catch(h){this._inAPull?(r=h,u=null):u.setFormulaValue(h);o=!1}o&&(u.setFormulaValue(this.computeFormula(u.getParsedFormula())),e=!0);u!=null&&(u.calcID=this._calcID,this.getFormulaInfoTable().containsKey(this.cell)||this.getFormulaInfoTable().add(this.cell,u),r=u.getFormulaValue()!=null?u.getFormulaValue():"")}return u!=null&&(this.getUseFormulaValues()||this.getCalculatingSuspended()&&(!this._inAPull||e)?r=u.getFormulaValue()!=null?u.getFormulaValue():"":e||(this._calcID==u.calcID?r=u.getFormulaValue():(r=this.computeFormula(u.getParsedFormula()),u.setFormulaValue(r),u.calcID=this._calcID))),(r==""||r==undefined)&&(r=""),s=this._parseDouble(r.substring(0,r.length-1)),r[r.length-1]!="%"||isNaN(s)||(r=(Number(s)/100).toString()),r};this._handleEmbeddedEs=function(n){for(var t=0,i,r;t>-1&&(t=n.indexOf(this._string_EP,t))>-1;){if(this._notInBlock(n,t)){for(i=t;i>0&&(this._isDigit(n[i-1])||n[i-1]==this.getParseDecimalSeparator());)i--;if(i!=t&&(i==0||!this._isUpperChar(n[i-1]))){for(r=t+this._string_EP.length;r<n.length&&this._isDigit(n[r]);)r++;r!=t+this._string_EP.length&&(n=n.substring(0,t)+this.char_EP+this._substring(n,t+this._string_EP.length))}}t+=1}for(t=0;t>-1&&(t=n.indexOf(this._string_EM,t))>-1;){if(this._notInBlock(n,t)){for(i=t;i>0&&(this._isDigit(n[i-1])||n[i-1]==this.getParseDecimalSeparator());)i--;if(i!=t&&(i==0||!this._isUpperChar(n[i-1]))){for(r=t+this._string_EM.length;r<n.length&&this._isDigit(n[r]);)r++;r!=t+this._string_EM.length&&(n=n.substring(0,t)+this.char_EM+this._substring(n,t+this._string_EM.length))}}t+=1}for(t=0;t>-1&&(t=n.indexOf(this._string_E,t))>-1&&n[0]!=this.bMARKER;){if(this._notInBlock(n,t)){for(i=t;i>0&&(this._isDigit(n[i-1])||n[i-1]==this.getParseDecimalSeparator());)i--;if(i!=t&&(i==0||!this._isUpperChar(n[i-1]))){for(r=t+this._string_E.length;r<n.length&&this._isDigit(n[r]);)r++;r==t+this._string_E.length||i!=-1&&this._isUpperChar(n[i])||(n=n.substring(0,t)+this.char_EP+this._substring(n,t+this._string_E.length))}}t+=1}return n};this._handleIterations=function(n){this._inHandleIterations=!0;for(var i=0,t=0,r=1,u=!0;r<this._iterationMaxCount-1&&(u||!this._checkUnderTolerance(t,i));)u=!1,this.getIterationValues().containsKey(this.cell)||this.getIterationValues().add(this.cell,"0"),this.getIterationValues().add(this.cell,n.getFormulaValue()==""?"0":n.getFormulaValue()),n.setFormulaValue(this.computeFormula(n.getParsedFormula())),i=t,t=this._parseDouble(n.getFormulaValue()),isNaN(t)&&(t=0),r++;this.getIterationValues.getItem(this.cell,n.getFormulaValue()==""?"0":n.getFormulaValue());this._inHandleIterations=!1};this._indexOfAny=function(n,t){for(var i=0;i<n.length;i++)if(t.indexOf(n[i])>-1)return i;return-1};this._initLibraryFunctions=function(){this._libraryFunctions=new HashTable;this._addFunction("SUM","computeSum");this._addFunction("EncodeURL","computeEncodeURL");this._addFunction("CHAR","computeChar");this._addFunction("CODE","computeCode");this._addFunction("UNICODE","computeUniCode");this._addFunction("UNICHAR","computeUniChar");this._addFunction("UPPER","computeUpper");this._addFunction("LOWER","computeLower");this._addFunction("LEN","computeLen");this._addFunction("MID","computeMid");this._addFunction("LEFT","computeLeft");this._addFunction("CLEAN","computeClean");this._addFunction("REPT","computeRept");this._addFunction("RIGHT","computeRight");this._addFunction("REPLACE","computeReplace");this._addFunction("EXACT","computeExact");this._addFunction("FIND","computeFind");this._addFunction("TRIM","computeTrim");this._addFunction("SEARCH","computeSearch");this._addFunction("SUBSTITUTE","computeSubstitute");this._addFunction("PROPER","computeProper");this._addFunction("T","computeT");this._addFunction("NUMBERVALUE","computeNumberValue");this._addFunction("CONCATENATE","computeConcatenate");this._addFunction("VALUE","computeValue");this._addFunction("DOLLAR","computeDollar");this._addFunction("FIXED","computeFixed");this._addFunction("BIN2DEC","computeBin2Dec");this._addFunction("BIN2OCT","computeBin2Oct");this._addFunction("BIN2HEX","computeBin2Hex");this._addFunction("DEC2BIN","computeDec2Bin");this._addFunction("DEC2OCT","computeDec2Oct");this._addFunction("HEX2BIN","computeHex2Bin");this._addFunction("HEX2OCT","computeHex2Oct");this._addFunction("BITAND","computeBitAnd");this._addFunction("BITOR","computeBitOr");this._addFunction("BITLSHIFT","computeBitLShift");this._addFunction("BITRSHIFT","computeBitRShift");this._addFunction("BITXOR","computeBitXor");this._addFunction("DATE","computeDate");this._addFunction("DATEVALUE","computeDatevalue");this._addFunction("DAY","computeDay");this._addFunction("DAYS","computeDays");this._addFunction("DAYS360","computeDays360");this._addFunction("EDATE","computeEDate");this._addFunction("EOMONTH","computeEOMonth");this._addFunction("HOUR","computeHour");this._addFunction("ISOWEEKNUM","computeISOWeeknum");this._addFunction("MINUTE","computeMinute");this._addFunction("MONTH","computeMonth");this._addFunction("NETWORKDAYS","computeNetworkDays");this._addFunction("NETWORKDAYS.INTL","computeNetworkDaysOintl");this._addFunction("NOW","computeNow");this._addFunction("SECOND","computeSecond");this._addFunction("TIME","computeTime");this._addFunction("TIMEVALUE","computeTimevalue");this._addFunction("TODAY","computeToday");this._addFunction("WEEKDAY","computeWeekday");this._addFunction("WEEKNUM","computeWeeknum");this._addFunction("WORKDAY","computeWorkDay");this._addFunction("WORKDAY.INTL","computeWorkDayOintl");this._addFunction("YEAR","computeYear");this._addFunction("ADDRESS","computeAddress");this._addFunction("AREAS","computeAreas");this._addFunction("CHOOSE","computeChoose");this._addFunction("COLUMN","computeColumn");this._addFunction("COLUMNS","computeColumns");this._addFunction("FORMULATEXT","computeFormulaText");this._addFunction("HYPERLINK","computeHyperlink");this._addFunction("HLOOKUP","computeHLookUp");this._addFunction("INDEX","computeIndex");this._addFunction("INDIRECT","computeIndirect");this._addFunction("LOOKUP","computeLookUp");this._addFunction("OFFSET","computeOffSet");this._addFunction("TRANSPOSE","computeTranspose");this._addFunction("LOGNORM.INV","computeLognormOinv");this._addFunction("NORM.INV","computeNormOinv");this._addFunction("NORM.DIST","computeNormOdist");this._addFunction("NORM.S.DIST","computeNormOsODist");this._addFunction("NORM.S.INV","computeNormOsOInv");this._addFunction("PERMUT","computePermut");this._addFunction("PERMUTATIONA","computePermutationA");this._addFunction("STANDARDIZE","computeStandardize");this._addFunction("BINOM.DIST","computeBinomOdist");this._addFunction("BINOM.INV","computeBinomOInv");this._addFunction("CHISQ.INV.RT","computeChisqOinvOrt");this._addFunction("CHISQ.INV","computeChisqOinv");this._addFunction("CHISQ.DIST.RT","computeChisqOdistOrt");this._addFunction("F.DIST","computeFOdist");this._addFunction("GAMMALN","computeGammaln");this._addFunction("CONFIDENCE.NORM","computeConfidenceOnorm");this._addFunction("EXPON.DIST","computeExponOdist");this._addFunction("FISHER","computeFisher");this._addFunction("FISHERINV","computeFisherInv");this._addFunction("GAMMALN.PRECISE","computeGammalnOPrecise");this._addFunction("AVERAGE","computeAverage");this._addFunction("AVERAGEA","computeAverageA");this._addFunction("POISSON.DIST","computePoissonODist");this._addFunction("WEIBULL.DIST","computeWeiBullODist");this._addFunction("F.INV.RT","computeFOinvOrt");this._addFunction("T.DIST","computeTOdist");this._addFunction("MAX","computeMax");this._addFunction("MAXA","computeMaxa");this._addFunction("MEDIAN","computeMedian");this._addFunction("MIN","computeMin");this._addFunction("MINA","computeMina");this._addFunction("PERCENTRANK.INC","computePercentrankInc");this._addFunction("PERCENTILE","computePercentile");this._addFunction("RANK.EQ","computeRankOEq");this._addFunction("COUNT","computeCount");this._addFunction("COUNTA","computeCounta");this._addFunction("DEVSQ","computeDevsq");this._addFunction("F.DIST.RT","computeFOdistORt");this._addFunction("FORECAST","computeForecast");this._addFunction("GEOMEAN","computeGeomean");this._addFunction("HARMEAN","computeHarmean");this._addFunction("INTERCEPT","computeIntercept");this._addFunction("LARGE","computeLarge");this._addFunction("SMALL","computeSmall");this._addFunction("LOGNORM.DIST","computeLognormOdist");this._addFunction("AVEDEV","computeAvedev");this._addFunction("COUNTBLANK","computeCountblank");this._addFunction("STDEV.P","computeStdevOp");this._addFunction("STDEV.S","computeStdevOS");this._addFunction("STDEVA","computeStdeva");this._addFunction("STDEVPA","computeStdevpa");this._addFunction("T.INV","computeTOinv");this._addFunction("VAR.P","computeVarp");this._addFunction("VARA","computeVara");this._addFunction("VARPA","computeVarpa");this._addFunction("CORREL","computeCorrel");this._addFunction("PERCENTILE.EXC","computePercentileExc");this._addFunction("PERCENTILE.INC","computePercentileOInc");this._addFunction("TRIMMEAN","computeTrimmean");this._addFunction("RSQ","computeRsq");this._addFunction("PEARSON","computePearson");this._addFunction("CHIDIST","computeChidist");this._addFunction("ABS","computeAbs");this._addFunction("ACOS","computeAcos");this._addFunction("ACOSH","computeAcosh");this._addFunction("ACOT","computeAcot");this._addFunction("ACOTH","computeAcoth");this._addFunction("ARABIC","computeArabic");this._addFunction("ASIN","computeAsin");this._addFunction("ATAN","computeAtan");this._addFunction("ATAN2","computeAtan2");this._addFunction("CEILING.MATH","computeCeilingMath");this._addFunction("CEILING","computeCeiling");this._addFunction("COMBIN","computeCombin");this._addFunction("COMBINA","computeCombinA");this._addFunction("COS","computeCos");this._addFunction("COSH","computeCosh");this._addFunction("COT","computeCot");this._addFunction("CSC","computeCsc");this._addFunction("CSCH","computeCsch");this._addFunction("DECIMAL","computeDecimal");this._addFunction("DEGREES","computeDegrees");this._addFunction("ISTEXT","computeIsText");this._addFunction("EXP","computeExp");this._addFunction("EVEN","computeEven");this._addFunction("FACT","computeFact");this._addFunction("FACTDOUBLE","computeFactdouble");this._addFunction("FLOOR","computeFloor");this._addFunction("INT","computeInt");this._addFunction("LN","computeLn");this._addFunction("LOG","computeLog");this._addFunction("PI","computePI");this._addFunction("PRODUCT","computeProduct");this._addFunction("SEC","computeSecant");this._addFunction("SERIESSUM","computeSeriessum");this._addFunction("SIN","computeSin");this._addFunction("SINH","computeSinh");this._addFunction("SQRT","computeSqrt");this._addFunction("SUBTOTAL","computeSubTotal");this._addFunction("SUMIF","computeSumif");this._addFunction("TRUNC","computeTrunc");this._addFunction("TAN","computeTan");this._addFunction("LOG10","computeLogTen");this._addFunction("COTH","computeCoth");this._addFunction("AND","computeAnd");this._addFunction("FALSE","computeFalse");this._addFunction("IF","computeIf");this._addFunction("IFERROR","computeIfError");this._addFunction("NOT","computeNot");this._addFunction("OR","computeOr");this._addFunction("TRUE","computeTrue");this._addFunction("XOR","computeXor");this._addFunction("CELL","computeCell");this._addFunction("ERROR.TYPE","computeErrorType");this._addFunction("INFO","computeInfo");this._addFunction("ISBLANK","computeIsBlank");this._addFunction("ISERR","computeIsErr");this._addFunction("ISERROR","computeIsError");this._addFunction("ISEVEN","computeIsEven");this._addFunction("ISFORMULA","computeIsFormula");this._addFunction("ISLOGICAL","computeIsLogical");this._addFunction("ISNA","computeIsNA");this._addFunction("ISNONTEXT","computeIsNonText");this._addFunction("ISNUMBER","computeIsNumber");this._addFunction("ISODD","computeIsOdd");this._addFunction("ISREF","computeIsRef");this._addFunction("ISTEXT","computeIsText");this._addFunction("N","computeN");this._addFunction("NA","computeNA");this._addFunction("SHEET","computeSheet");this._addFunction("SHEETS","computeSheets");this._addFunction("TYPE","computeType");this._addFunction("ROW","computeRow");this._addFunction("ROWS","computeRows");this._addFunction("MATCH","computeMatch");this._addFunction("PMT","computePmt");this._addFunction("COUNTIF","computeCountif");this._addFunction("ROUND","computeRound");this._addFunction("ROUNDDOWN","computeRoundDown");this._addFunction("ROUNDUP","computeRoundUp");this._addFunction("MMULT","computeMmult");this._addFunction("PV","computePv");this._addFunction("NORMSDIST","computeNormsDist");this._addFunction("NORMDIST","computeNormDist");this._addFunction("SUMPRODUCT","computeSumProduct");this._addFunction("STDEV","computeStdev");this._addFunction("VLOOKUP","computeVLookUp");this._addFunction("TEXT","computeText")};this._comb=function(n,t){for(var r,u=1,i=n+1;i<=t;++i)u=u*i;for(r=1,i=2;i<=t-n;++i)r=r*i;return u/r};this._finv=function(n,t,i){for(var o=Math.exp(this._gammaln((t+i)/2)-this._gammaln(t/2)-this._gammaln(i/2)+t/2*Math.log(t/i)),r=o,u=r/2,e=0,f=100,s=3,h=0;f==100&&s>0;)for(s--,r=r/2,u=r/2,f=0;f<100;++f){if(h++,e=1-o*this._fdist(r,t,i),Math.abs((e-n)/n)<1e-7)break;e>n?r=r+u:(u=u/2,r-u<0&&(u=r/2),r=r-u)}return f==100&&(r=-1),r};this._tProbabilityDensity=function(n,t){var i=this._gammaFunction(.5*t+.5),r=Math.pow(1+n*n/t,-.5*t-.5),u=Math.sqrt(t*Math.PI)*this._gammaFunction(.5*t);return i*r/u};this._tCumulativeDensity=function(n,t){if(isNaN(n))return NaN;if(n==0)return.5;if(n>0){var i=t/(n*n+t);return 1-.5*this._rIBetaFunction(i,.5*t,.5)}return 1-this._tCumulativeDensity(-n,t)};this._sign=function(n){return n===0||isNaN(n)?n:n>0?1:-1};this._var=function(n){for(var u,f,i=0,r=n.length,t=0;t<r;++t)i+=n[t];for(i=i/r,u=0,t=0;t<r;++t)f=n[t]-i,u+=f*f;return u/(r-1)};this._tCumulativeDistributionInverse=function(n,t){var r,i,u,f,o,s;if(n<0||n>1)throw"Probability must be between 0 and 1";if(n==0)return Number.NEGATIVE_INFINITY;if(n==1)return Number.POSITIVE_INFINITY;if(n==.5)return 0;switch(t){case 1:return Math.tan(Math.PI*(n-.5));case 2:return r=4*n*(1-n),2*(n-.5)*Math.sqrt(2/r);case 4:var r=4*n*(1-n),e=Math.sqrt(r),h=Math.cos(1/3*Math.acos(e))/e;return this._sign(n-.5)*2*Math.sqrt(h-1);default:for(i=t>6?this._standardNormalCumulativeDistributionFunctionInverse(n):this._tCumulativeDistributionInverse(n,4),u=0;u<50;u++){if(f=this._tCumulativeDensity(i,t),o=Math.abs(n-f),o<.0001)return i;s=this._tProbabilityDensity(i,t);i=i+(n-f)/s}throw"Solution did not converge";}};this._fdist=function(n,t,i){for(var s,p,f=32,e=0,c=n,o=(c-e)/f,l=o/3,y=this._fdensity(e,t,i)+this._fdensity(c,t,i),u=0,r=1;r<f;r+=2)u=u+4*this._fdensity(e+r*o,t,i);for(s=0,r=2;r<f;r+=2)s=s+2*this._fdensity(e+r*o,t,i);for(var h=l*(y+s+u),a=h,v=0,v=0;v<10;++v){for(f=f*2,s+=u/2,u=0,o=(c-e)/f,r=0;r<f;++r)r%2==1&&(p=this._fdensity(e+o*r,t,i),u=u+p);if(u=4*u,l=o/3,h=l*(y+s+u),Math.abs((h-a)/a)<1e-7)break;a=h}return h};this._fdensity=function(n,t,i){return Math.pow(n,(t-2)/2)/Math.pow(1+t*n/i,(t+i)/2)};this._normaldist=function(n,t,i){var h=32,f,c,o,r,p;n>t?(f=t-(n-t),c=n):(f=n,c=t+(t-n));var e=(c-f)/h,l=e/3,y=this._normaldensity(f,t,i)+this._normaldensity(c,t,i),u=0;for(r=1;r<h;r+=2)u=u+4*this._normaldensity(f+r*e,t,i);for(o=0,r=2;r<h;r+=2)o=o+2*this._normaldensity(f+r*e,t,i);for(var s=l*(y+o+u),a=s,v=0,v=0;v<10;++v){for(h*=2,o=o+u/2,u=0,e=e=(c-f)/h,r=0;r<h;++r)r%2==1&&(p=this._normaldensity(f+e*r,t,i),u+=p);if(u=4*u,l=e/3,s=l*(y+o+u),Math.abs((s-a)/a)<1e-7)break;a=s}return n>t?s+(1-s)/2:(1-s)/2};this._normaldensity=function(n,t,i){return 1/(Math.sqrt(2*Math.PI)*i)*Math.exp(-(n-t)*(n-t)/(2*i*i))};this._standardNormalCumulativeDistribution=function(n){if(n<0)return 1-this._standardNormalCumulativeDistribution(-n);var i=this._standardNormalProbabilityDensityFunction(n),t=1/(1+.2316419*n);return 1-i*(.31938153*t+-.356563782*Math.pow(t,2)+1.781477937*Math.pow(t,3)+-1.821255978*Math.pow(t,4)+1.330274429*Math.pow(t,5))};this._normalinv=function(n,t,i){var r=t;r=n<.05?t-2*i:n<.5?t:n<.95?t+2*i:t+5*i;for(var u=r/2,e=0,f=100,o=3,s=0;f==100&&o>0;)for(o--,r=r/2,u=r/2,f=0;f<100;++f){if(s++,e=this._normaldist(r,t,i),Math.abs((e-n)/n)<1e-7)break;e<n?r=r+u:(u=u/2,r-u<0&&(u=r/2),r=r-u)}return f==100&&(r=-1),r};this._normalCumulativeDistributionFunctionInverse=function(n,t,i){var r=this._standardNormalCumulativeDistributionInverse(n);return i*r+t};this._standardNormalCumulativeDistributionInverse=function(n){var i;if(n<0||n>1)throw"Probability must be between 0 and 1";if(n==0)return Number.NEGATIVE_INFINITY;if(n==1)return Number.POSITIVE_INFINITY;if(n==.5)return 0;var u=-.0077848940024302926,f=-.32239645804113648,e=-2.4007582771618381,o=-2.5497325393437338,s=4.3746641414649678,h=2.9381639826987831,c=.0077846957090414622,l=.32246712907003983,a=2.445134137142996,v=3.7544086619074162,r=.02425,y=1-r,t;return 0<n&&n<r?(t=Math.sqrt(-2*Math.log(n)),(((((u*t+f)*t+e)*t+o)*t+s)*t+h)/((((c*t+l)*t+a)*t+v)*t+1)):r<=n&&n<=y?(t=n-.5,i=t*t,(((((-39.696830286653757*i+220.9460984245205)*i+-275.92851044696869)*i+138.357751867269)*i+-30.66479806614716)*i+2.5066282774592392)*t/(((((-54.476098798224058*i+161.58583685804089)*i+-155.69897985988661)*i+66.80131188771972)*i+-13.280681552885721)*i+1)):(t=Math.sqrt(-2*Math.log(1-n)),-(((((u*t+f)*t+e)*t+o)*t+s)*t+h)/((((c*t+l)*t+a)*t+v)*t+1))};this._normalProbabilityDensity=function(n,t,i){var r=(n-t)/i;return.398942280401433*Math.exp(-.5*r*r)/i};this._standardNormalProbabilityDensityFunction=function(n){return.398942280401433*Math.exp(-.5*n*n)};this._standardNormalCumulativeDistributionFunction=function(n){if(n<0)return 1-this._standardNormalCumulativeDistributionFunction(-n);var i=this._standardNormalProbabilityDensityFunction(n),t=1/(1+.2316419*n);return 1-i*(.31938153*t+-.356563782*Math.pow(t,2)+1.781477937*Math.pow(t,3)+-1.821255978*Math.pow(t,4)+1.330274429*Math.pow(t,5))};this._standardNormalCumulativeDistributionFunctionInverse=function(n){var i;if(n<0||n>1)throw"Probability must be between 0 and 1";if(n==0)return Number.NEGATIVE_INFINITY;if(n==1)return Number.POSITIVE_INFINITY;if(n==.5)return 0;var u=-.0077848940024302926,f=-.32239645804113648,e=-2.4007582771618381,o=-2.5497325393437338,s=4.3746641414649678,h=2.9381639826987831,c=.0077846957090414622,l=.32246712907003983,a=2.445134137142996,v=3.7544086619074162,r=.02425,y=1-r,t;return 0<n&&n<r?(t=Math.sqrt(-2*Math.log(n)),(((((u*t+f)*t+e)*t+o)*t+s)*t+h)/((((c*t+l)*t+a)*t+v)*t+1)):r<=n&&n<=y?(t=n-.5,i=t*t,(((((-39.696830286653757*i+220.9460984245205)*i+-275.92851044696869)*i+138.357751867269)*i+-30.66479806614716)*i+2.5066282774592392)*t/(((((-54.476098798224058*i+161.58583685804089)*i+-155.69897985988661)*i+66.80131188771972)*i+-13.280681552885721)*i+1)):(t=Math.sqrt(-2*Math.log(1-n)),-(((((u*t+f)*t+e)*t+o)*t+s)*t+h)/((((c*t+l)*t+a)*t+v)*t+1))};this._chiSquaredProbabilityDensityFunction=function(n,t){var i=this._gammaFunction(.5*t),r=1/(Math.pow(2,.5*t)*i);return r*Math.pow(n,.5*t-1)*Math.exp(-.5*n)};this._binomdist=function(n,t,i){var f=1-i,o=Math.pow(f,n),e=0,r=1*Math.pow(f,n),u;if(r==0)return NaN;for(u=0;u<=t;++u)if(e+=r,r=r*i/f*(n-u)/(u+1),!isFinite(r)||isNaN(r)){e=NaN;break}return e};this._gammadensity=function(n,t,i){return Math.pow(i/t,n-1)*Math.exp(-i/t)/(t*Math.exp(this._gammaln(n)))};this.minValue=-179769e303;this.maxValue=2147483647;this._charTable=[this._string_empty,"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];this._stdevdotP=function(n){for(var r=n.length,i=0,u=0,f=0,t=0;t<r;++t)i=i+n[t];for(i=i/r,t=0;t<r;t++)u=u+Math.pow(n[t]-i,2),f++;return Math.sqrt(u/f)};this._determinant=function(n,t){var o=1,e=0,c=parseInt(t.toString()),s=[c,c],i,r,h,u,f;if(t==1)return n[0];for(e=0,f=0;f<t;f++){for(h=0,u=0,i=0;i<t;i++)for(r=0;r<t;r++)s[(i,r)]=0,i!=0&&r!=f&&(s[(h,u)]=n[(i,r)],u<t-2?u++:(u=0,h++));e=e+o*n[f]*this._determinant(s,t-1);o=-1*o}return e};this._factorialTable=[1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600];this._mean=function(n){return this._mean(n,1)};this._negbinomdensity=function(n,t,i){return this._comb(t-1,n+t-1)*Math.pow(i,t)*Math.pow(1-i,n)};this._sd=function(n,t){var r=n.length,f,u,i;for(t=0,i=0;i<r;++i)t+=n[i];for(t=t/r,f=0,u=0,i=0;i<r;++i)u=n[i]-t,f+=u*u;return r==1?0:Math.sqrt(f/(r-1))};this._betaCumulativeDist=function(n,t,i){if(n<0||n>1)throw"x must be between 0 and 1";return this._rIBetaFunction(n,t,i)};this._betaProbabilityDens=function(n,t,i){if(n<0||n>1)throw"x must be between 0 and 1";var r=this._betaFunction(t,i);return Math.pow(n,t-1)*Math.pow(1-n,i-1)/r};this._critbinom=function(n,t,i){var r=n,f=n,e=1,u=1;do{if(f=Math.floor(f/2)+1,e>=i){if(u=this._binomdist(n,r-1,t),isNaN(u))return this.maxValue;if(u<i&&u>0)break;r=r-f}else{if(u=this._binomdist(n,r+1,t),u>=i){r=r+1;break}r=r+f}e=this._binomdist(n,r,t)}while(r<n&&r>0);return r};this._newnormalinv=function(n){var f=[-39.696830286653757,220.9460984245205,-275.92851044696869,138.357751867269,-30.66479806614716,2.5066282774592392],e=[-54.476098798224058,161.58583685804089,-155.69897985988661,66.80131188771972,-13.280681552885721],i=[-.0077848940024302926,-.32239645804113648,-2.4007582771618381,-2.5497325393437338,4.3746641414649678,2.9381639826987831],u=[.0077846957090414622,.32246712907003983,2.445134137142996,3.7544086619074162],o=.02425,s=1-o,t=0,r=0;return n<o?(t=Math.sqrt(-2*Math.log(n)),(((((i[0]*t+i[1])*t+i[2])*t+i[3])*t+i[4])*t+i[5])/((((u[0]*t+u[1])*t+u[2])*t+u[3])*t+1)):s<n?(t=Math.sqrt(-2*Math.log(1-n)),-(((((i[0]*t+i[1])*t+i[2])*t+i[3])*t+i[4])*t+i[5])/((((u[0]*t+u[1])*t+u[2])*t+u[3])*t+1)):(t=n-.5,r=t*t,(((((f[0]*r+f[1])*r+f[2])*r+f[3])*r+f[4])*r+f[5])*t/(((((e[0]*r+e[1])*r+e[2])*r+e[3])*r+e[4])*r+1))};this._chiinv=function(n,t){for(var i=n,r=Number(i/2),f=0,u=100,e=3;u==100&&e>0;)for(e--,i=i/2,r=i/2,u=0;u<100;++u){if(f=1-this._chidist(i,t),Math.abs((f-n)/n)<1e-7)break;f>n?i=i+r:(r=r/2,i-r<0&&(r=i/2),i=i-r)}return u==100&&(i=-1),i};this._chidist=function(n,t){var c=[.09654008851,.09563872008,.09384439908,.0911738787,.087652093,.08331192423,.07819389579,.07234579411,.06582222278,.05868409348,.05099805926,.04283589802,.03427386291,.02539206531,.01627439473,.00701861001],l=[.04830766569,.14447196158,.23928736225,.33186860228,.42135127613,.50689990893,.58771575724,.66304426693,.73218211874,.79448379597,.84936761373,.89632115577,.93490607594,.96476225559,.98561151155,.99726386185],i=t/2,a=1/(Math.pow(2,i)*Math.exp(this._gammaln(i))),u;i=i-1;var o=0,s=n,f=(o+s)/2,h=(s-o)/2,e=0,r;for(u=0;u<16;++u)r=l[u]*h,e=Number(e)+Number(c[u]*(Math.pow(f+r,i)*Math.exp(-(f+r)/2)+Math.pow(f-r,i)*Math.exp(-(f-r)/2)));return Number(a)*Number(e)*Number(h)};this._gammaln=function(n){var r=[.918938533204673,.000595238095238,.000793650793651,.002777777777778,.083333333333333],t=n,i=0,u;if(t<7){for(i=t,t++;t<7;)i=i*t,t<7&&t++;i=-Math.log(i)}return u=this._parseDouble((1/(t*t)).toString()),i+(t-this._parseDouble("0.5"))*Math.log(t)-t+r[0]+(((-r[1]*u+r[2])*u-r[3])*u+r[4])/t};this._pearson=function(n,t,i){for(var u=0,f=0,r=0;r<i;++r)u+=n[r],f+=t[r];u=u/i;f=f/i;var s=0,h=0,c=0,e,o;for(r=0;r<i;++r)o=n[r]-u,e=t[r]-f,s+=o*e,h+=o*o,c+=e*e;return s/Math.sqrt(h*c)};this._fProbabilityDensity=function(n,t,i){if(t<=0||i<=0)throw"k1 and k2 must be greater than 0.";if(n==0)return 0;var r=Math.pow(t*n,.5*t),u=Math.pow(i,.5*i),f=Math.pow(t*n+i,.5*(t+i)),e=r*u/f,o=this._betaFunction(.5*t,.5*i),s=n*o;return e/s};this._fCumulativeDensity=function(n,t,i){if(t<=0||i<=0)throw"k1 and k2 must be greater than 0.";if(n<0)throw"x must be greater than 0.";if(n==0)return 0;var r=t*n/(t*n+i),u=this._rIBetaFunction(r,.5*t,.5*i);return Math.min(1,u)};this._rIBetaFunction=function(n,t,i){var s,r,h,c;if(n<=0)return 0;if(n>=1)return 1;if(t%1==0&&i%1==0&&t+i>0)return this._rIBetaFunction1(n,t,i);if(i%1==0&&t+i<172)return this._rIBetaFunction2(n,t,i);if(t%1==0&&t+i<172)return 1-this._rIBetaFunction2(1-n,i,t);if(t==.5&&i==.5)return 2/Math.PI*Math.atan(Math.sqrt(n/(1-n)));if(t==.5&&i%.5==0)return 1-this._rIBetaFunction(1-n,i,.5);if(t%.5==0&&i==.5){if(t<45){var u=0,e=Math.round(t-.5),l=this._parseDouble(this.computeGammaln("0.5".toString()));for(r=0;r<e;r++)u=u+Math.exp(this._gammaln(r+1)-this._gammaln(r+1.5)-l)*Math.pow(n,r);return this._rIBetaFunction(n,.5,.5)-Math.sqrt(n*(1-n))*u}var a=this._betaFunction(t,.5),o=Math.sqrt(1-Math.pow(a*Math.sqrt((t-1)/Math.PI)*this._epsilon,1/(t-1))),v=[.066671344308688,.14945134915058,.21908636251598,.26926671931,.29552422471475,.29552422471475,.26926671931,.21908636251598,.14945134915058,.066671344308688],y=[.013046735791414,.067468316655507,.16029521585049,.28330230293538,.42556283050918,.57443716949081,.71669769706462,.83970478414951,.93253168334449,.98695326420859],f=Math.sqrt(1-n),u=0;for(r=0;r<10;r++)u=u+v[r]*Math.pow(1-Math.pow((o-f)*y[r]+f,2),t-1);return s=Math.exp(this._gammaln(t+.5)-this._gammaln(t)-this._gammaln(.5)),(o-f)*s*u}if(t%.5==0&&i%.5==0){var u=0,e=Math.round(i-.5),p=this._gammaln(t),w=Math.pow(n,t);for(r=0;r<e;r++)u=u+Math.exp(this._gammaln(t+r+.5)-p-this._gammaln(r+1.5))*Math.pow(1-n,r)*w;return h=this._rIBetaFunction(n,t,.5)+Math.sqrt(1-n)*u,Math.max(0,Math.min(1,h))}return n>.5?1-this._rIBetaFunction(1-n,i,t):(c=this._iBetaFunction(n,t,i)/this._betaFunction(t,i),Math.max(0,Math.min(1,c)))};this._rIBetaFunction1=function(n,t,i){var u=0,f=t+i-1,r;if(f<21){for(r=t;r<t+i;r++)u=u+Math.pow(n,r)*Math.pow(1-n,f-r)/(this._factorial(r)*this._factorial(f-r));u=u*this._factorial(f)}else for(r=t;r<t+i;r++)u=u+Math.pow(n,r)*Math.pow(1-n,f-r)*this._combinations(f,r);return Math.max(0,Math.min(1,u))};this._rIBetaFunction2=function(n,t,i){var u,r;if(t+i>172)throw"Cannot currently compute RegularizedIncompleteBetaFunction for a + b > 172";for(u=0,r=1;r<i+1;r++)u=u+Math.pow(1-n,r-1)*Math.exp(this._gammaln(t+r-1)-this._gammaln(r));return u*Math.pow(n,t)*Math.exp(-this._gammaln(t))};this._iBetaFunction=function(n,t,i){var r,u;if(n==0)return 0;if(n==1)return this._betaFunction(t,i);if(n<=.9)return this._pIBetaFunction(0,n,t,i);if(n<=.99)return r=this._pIBetaFunction(0,.9,t,i),u=this._pIBetaFunction(.9,n,t,i),r+u;var r=this._pIBetaFunction(0,.9,t,i),u=this._pIBetaFunction(.9,.99,t,i),f=this._pIBetaFunction(.99,n,t,i);return r+u+f};this._pIBetaFunction=function(n,t,i,r){var u,s;if(t==n)return 0;if(t<n)return NaN;u=1e3;i<1&&(u=8e4);var e=(t-n)/u,f=n+.5*e,o=0;for(s=0;s<u;s++)o=o+Math.pow(f,i-1)*Math.pow(1-f,r-1)*e,f=f+e;return o};this._betaFunction=function(n,t){return n+t>143?t>20?2.5066282746310002*Math.pow(n,n-.5)*Math.pow(t,t-.5)/Math.pow(n+t,n+t-.5):this._gammaFunction(t)*Math.pow(n,-t):this._gammaFunction(n)*this._gammaFunction(t)/this._gammaFunction(n+t)};this._gammaFunction=function(n){var t,i;if(n>143)throw"Cannot currently compute gamma function for z > 143";if(n>0&&n<21&&n%1==0)return this._factorial(Math.round(n-1));if(n>0&&n<11&&n%.5==0)return t=parseInt(n),i=1.77245385090552,i*this._factorial(2*t)/(Math.pow(4,t)*this._factorial(t));var r=1+1/(12*n)+1/(288*n*n)-139/(51840*Math.pow(n,3))-571/(2488320*Math.pow(n,4))+163879/(209018880*Math.pow(n,5))+5246819/(75246796800*Math.pow(n,6));return Math.pow(n,n-.5)*Math.exp(-n)*2.5066282746310002*r};this._epsilon=494065645841247e-338;this._factorial=function(n){var t,i;if(n<0)throw"Factorial not defined for negative n";if(n>20)throw"Answer will exceed max long";for(t=1,i=n;i>0;i--)t=t*i;return t};this._combinations=function(n,t){var i=this._logCombin(n,t),r=Math.exp(i);return Math.round(r)};this._logCombin=function(n,t){return this._logFactorial(n)-this._logFactorial(t)-this._logFactorial(n-t)};this._logFactorial=function(n){for(var t=0,i=2;i<=n;i++)t=t+Math.log(i);return t};this._isCellReference=function(n){var e,f,t,i,u,r;if(n==""||(n=this.setTokensForSheets(n),e=this._sheetToken(n),f=!1,e!=""&&(n=n.split(this.sheetToken).join("")),t=!1,i=!1,n.indexOf(":")!=n.lastIndexOf(":")))return!1;for(u=n.split("").join(this.getParseArgumentSeparator()).split(this.getParseArgumentSeparator()),r=0;r<u.leng