@univerjs/engine-formula 0.2.15 → 0.3.0-alpha.0

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.
Files changed (80) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/es/index.js +2231 -561
  3. package/lib/types/basics/engineering.d.ts +2 -0
  4. package/lib/types/basics/statistical.d.ts +32 -0
  5. package/lib/types/engine/reference-object/base-reference-object.d.ts +1 -1
  6. package/lib/types/engine/value-object/lambda-value-object.d.ts +2 -2
  7. package/lib/types/functions/compatibility/betadist/__tests__/index.spec.d.ts +16 -0
  8. package/lib/types/functions/compatibility/betadist/index.d.ts +8 -0
  9. package/lib/types/functions/compatibility/normsdist/__tests__/index.spec.d.ts +16 -0
  10. package/lib/types/functions/compatibility/normsdist/index.d.ts +8 -0
  11. package/lib/types/functions/logical/bycol/index.d.ts +3 -1
  12. package/lib/types/functions/logical/byrow/index.d.ts +3 -1
  13. package/lib/types/functions/logical/map/index.d.ts +3 -1
  14. package/lib/types/functions/logical/reduce/index.d.ts +3 -1
  15. package/lib/types/functions/logical/scan/index.d.ts +3 -1
  16. package/lib/types/functions/lookup/offset/index.d.ts +1 -1
  17. package/lib/types/functions/statistical/beta-dist/__tests__/index.spec.d.ts +16 -0
  18. package/lib/types/functions/statistical/beta-dist/index.d.ts +8 -0
  19. package/lib/types/functions/statistical/beta-inv/__tests__/index.spec.d.ts +16 -0
  20. package/lib/types/functions/statistical/beta-inv/index.d.ts +8 -0
  21. package/lib/types/functions/statistical/binom-dist/__tests__/index.spec.d.ts +16 -0
  22. package/lib/types/functions/statistical/binom-dist/index.d.ts +8 -0
  23. package/lib/types/functions/statistical/binom-dist-range/__tests__/index.spec.d.ts +16 -0
  24. package/lib/types/functions/statistical/binom-dist-range/index.d.ts +8 -0
  25. package/lib/types/functions/statistical/binom-inv/__tests__/index.spec.d.ts +16 -0
  26. package/lib/types/functions/statistical/binom-inv/index.d.ts +8 -0
  27. package/lib/types/functions/statistical/chisq-dist/__tests__/index.spec.d.ts +16 -0
  28. package/lib/types/functions/statistical/chisq-dist/index.d.ts +8 -0
  29. package/lib/types/functions/statistical/chisq-dist-rt/__tests__/index.spec.d.ts +16 -0
  30. package/lib/types/functions/statistical/chisq-dist-rt/index.d.ts +8 -0
  31. package/lib/types/functions/statistical/chisq-inv/__tests__/index.spec.d.ts +16 -0
  32. package/lib/types/functions/statistical/chisq-inv/index.d.ts +8 -0
  33. package/lib/types/functions/statistical/chisq-inv-rt/__tests__/index.spec.d.ts +16 -0
  34. package/lib/types/functions/statistical/chisq-inv-rt/index.d.ts +8 -0
  35. package/lib/types/functions/statistical/chisq-test/__tests__/index.spec.d.ts +16 -0
  36. package/lib/types/functions/statistical/chisq-test/index.d.ts +8 -0
  37. package/lib/types/functions/statistical/confidence-norm/__tests__/index.spec.d.ts +16 -0
  38. package/lib/types/functions/statistical/confidence-norm/index.d.ts +7 -0
  39. package/lib/types/functions/statistical/confidence-t/__tests__/index.spec.d.ts +16 -0
  40. package/lib/types/functions/statistical/confidence-t/index.d.ts +7 -0
  41. package/lib/types/functions/statistical/correl/__tests__/index.spec.d.ts +16 -0
  42. package/lib/types/functions/statistical/correl/index.d.ts +8 -0
  43. package/lib/types/functions/statistical/covariance-p/__tests__/index.spec.d.ts +16 -0
  44. package/lib/types/functions/statistical/covariance-p/index.d.ts +8 -0
  45. package/lib/types/functions/statistical/covariance-s/__tests__/index.spec.d.ts +16 -0
  46. package/lib/types/functions/statistical/covariance-s/index.d.ts +8 -0
  47. package/lib/types/functions/statistical/devsq/__tests__/index.spec.d.ts +16 -0
  48. package/lib/types/functions/statistical/devsq/index.d.ts +8 -0
  49. package/lib/types/functions/statistical/expon-dist/__tests__/index.spec.d.ts +16 -0
  50. package/lib/types/functions/statistical/expon-dist/index.d.ts +8 -0
  51. package/lib/types/functions/statistical/f-dist/__tests__/index.spec.d.ts +16 -0
  52. package/lib/types/functions/statistical/f-dist/index.d.ts +8 -0
  53. package/lib/types/functions/statistical/f-dist-rt/__tests__/index.spec.d.ts +16 -0
  54. package/lib/types/functions/statistical/f-dist-rt/index.d.ts +8 -0
  55. package/lib/types/functions/statistical/f-inv/__tests__/index.spec.d.ts +16 -0
  56. package/lib/types/functions/statistical/f-inv/index.d.ts +8 -0
  57. package/lib/types/functions/statistical/f-inv-rt/__tests__/index.spec.d.ts +16 -0
  58. package/lib/types/functions/statistical/f-inv-rt/index.d.ts +8 -0
  59. package/lib/types/functions/statistical/f-test/__tests__/index.spec.d.ts +16 -0
  60. package/lib/types/functions/statistical/f-test/index.d.ts +8 -0
  61. package/lib/types/functions/statistical/fisher/__tests__/index.spec.d.ts +16 -0
  62. package/lib/types/functions/statistical/fisher/index.d.ts +8 -0
  63. package/lib/types/functions/statistical/fisherinv/__tests__/index.spec.d.ts +16 -0
  64. package/lib/types/functions/statistical/fisherinv/index.d.ts +8 -0
  65. package/lib/types/functions/statistical/forecast/__tests__/index.spec.d.ts +16 -0
  66. package/lib/types/functions/statistical/forecast/index.d.ts +8 -0
  67. package/lib/types/functions/statistical/function-map.d.ts +1 -1
  68. package/lib/types/functions/statistical/intercept/__tests__/index.spec.d.ts +16 -0
  69. package/lib/types/functions/statistical/intercept/index.d.ts +8 -0
  70. package/lib/types/functions/statistical/norm-dist/__tests__/index.spec.d.ts +16 -0
  71. package/lib/types/functions/statistical/norm-dist/index.d.ts +8 -0
  72. package/lib/types/functions/statistical/norm-inv/__tests__/index.spec.d.ts +16 -0
  73. package/lib/types/functions/statistical/norm-inv/index.d.ts +8 -0
  74. package/lib/types/functions/statistical/norm-s-dist/__tests__/index.spec.d.ts +16 -0
  75. package/lib/types/functions/statistical/norm-s-dist/index.d.ts +8 -0
  76. package/lib/types/functions/statistical/norm-s-inv/__tests__/index.spec.d.ts +16 -0
  77. package/lib/types/functions/statistical/norm-s-inv/index.d.ts +8 -0
  78. package/lib/types/index.d.ts +13 -13
  79. package/lib/umd/index.js +1 -1
  80. package/package.json +8 -8
package/lib/es/index.js CHANGED
@@ -5775,6 +5775,1255 @@ const _CustomFunction = class _CustomFunction extends BaseFunction {
5775
5775
  };
5776
5776
  __name(_CustomFunction, "CustomFunction");
5777
5777
  let CustomFunction = _CustomFunction;
5778
+ var BESSEL;
5779
+ ((BESSEL2) => {
5780
+ const W = 0.636619772;
5781
+ function _horner(arr, v) {
5782
+ let z = 0;
5783
+ for (let i = 0; i < arr.length; ++i)
5784
+ z = v * z + arr[i];
5785
+ return z;
5786
+ }
5787
+ __name(_horner, "_horner");
5788
+ function _bessel_iter(x, n, f0, f1, sign2) {
5789
+ if (n === 0)
5790
+ return f0;
5791
+ if (n === 1)
5792
+ return f1;
5793
+ const tdx = 2 / x;
5794
+ let _f0 = f0, _f1 = f1, f2 = f1;
5795
+ for (let o = 1; o < n; ++o)
5796
+ f2 = _f1 * o * tdx + sign2 * _f0, _f0 = _f1, _f1 = f2;
5797
+ return f2;
5798
+ }
5799
+ __name(_bessel_iter, "_bessel_iter");
5800
+ function _bessel_wrap(bessel0, bessel1, nonzero, sign2) {
5801
+ return /* @__PURE__ */ __name(function(x, n) {
5802
+ if (nonzero) {
5803
+ if (x === 0)
5804
+ return nonzero === 1 ? -1 / 0 : 1 / 0;
5805
+ if (x < 0)
5806
+ return Number.NaN;
5807
+ }
5808
+ if (n === 0)
5809
+ return bessel0(x);
5810
+ if (n === 1)
5811
+ return bessel1(x);
5812
+ if (n < 0)
5813
+ return Number.NaN;
5814
+ const _n = n | 0, b0 = bessel0(x), b1 = bessel1(x);
5815
+ return _bessel_iter(x, _n, b0, b1, sign2);
5816
+ }, "bessel");
5817
+ }
5818
+ __name(_bessel_wrap, "_bessel_wrap"), BESSEL2.besselj = /* @__PURE__ */ (() => {
5819
+ const b0_a1a = [-184.9052456, 77392.33017, -1121442418e-2, 6516196407e-1, -13362590354, 57568490574], b0_a2a = [1, 267.8532712, 59272.64853, 9494680718e-3, 1029532985, 57568490411], b0_a1b = [2093887211e-16, -2073370639e-15, 2734510407e-14, -0.001098628627, 1], b0_a2b = [-934935152e-16, 7621095161e-16, -6911147651e-15, 1430488765e-13, -0.01562499995];
5820
+ function bessel0(x) {
5821
+ let a = 0, a1 = 0, a2 = 0, y = x * x;
5822
+ if (x < 8)
5823
+ a1 = _horner(b0_a1a, y), a2 = _horner(b0_a2a, y), a = a1 / a2;
5824
+ else {
5825
+ const xx = x - 0.785398164;
5826
+ y = 64 / y, a1 = _horner(b0_a1b, y), a2 = _horner(b0_a2b, y), a = Math.sqrt(W / x) * (Math.cos(xx) * a1 - Math.sin(xx) * a2 * 8 / x);
5827
+ }
5828
+ return a;
5829
+ }
5830
+ __name(bessel0, "bessel0");
5831
+ const b1_a1a = [-30.16036606, 15704.4826, -2972611439e-3, 2423968531e-1, -7895059235, 72362614232], b1_a2a = [1, 376.9991397, 99447.43394, 1858330474e-2, 2300535178, 144725228442], b1_a1b = [-240337019e-15, 2457520174e-15, -3516396496e-14, 183105e-8, 1], b1_a2b = [105787412e-15, -88228987e-14, 8449199096e-15, -2002690873e-13, 0.04687499995];
5832
+ function bessel1(x) {
5833
+ let a = 0, a1 = 0, a2 = 0, y = x * x;
5834
+ const xx = Math.abs(x) - 2.356194491;
5835
+ return Math.abs(x) < 8 ? (a1 = x * _horner(b1_a1a, y), a2 = _horner(b1_a2a, y), a = a1 / a2) : (y = 64 / y, a1 = _horner(b1_a1b, y), a2 = _horner(b1_a2b, y), a = Math.sqrt(W / Math.abs(x)) * (Math.cos(xx) * a1 - Math.sin(xx) * a2 * 8 / Math.abs(x)), x < 0 && (a = -a)), a;
5836
+ }
5837
+ return __name(bessel1, "bessel1"), /* @__PURE__ */ __name(function besselj2(x, n) {
5838
+ const _n = Math.round(n);
5839
+ if (!Number.isFinite(x))
5840
+ return Number.isNaN(x) ? x : 0;
5841
+ if (_n < 0)
5842
+ return (_n % 2 ? -1 : 1) * besselj2(x, -_n);
5843
+ if (x < 0)
5844
+ return (_n % 2 ? -1 : 1) * besselj2(-x, _n);
5845
+ if (_n === 0)
5846
+ return bessel0(x);
5847
+ if (_n === 1)
5848
+ return bessel1(x);
5849
+ if (x === 0)
5850
+ return 0;
5851
+ let ret = 0;
5852
+ if (x > _n)
5853
+ ret = _bessel_iter(x, _n, bessel0(x), bessel1(x), -1);
5854
+ else {
5855
+ const m = 2 * Math.floor((_n + Math.floor(Math.sqrt(40 * _n))) / 2);
5856
+ let jsum = !1, bjp = 0, sum2 = 0, bj = 1, bjm = 0;
5857
+ const tox = 2 / x;
5858
+ for (let j = m; j > 0; j--)
5859
+ if (bjm = j * tox * bj - bjp, bjp = bj, bj = bjm, Math.abs(bj) > 1e10 && (bj *= 1e-10, bjp *= 1e-10, ret *= 1e-10, sum2 *= 1e-10), jsum && (sum2 += bj), jsum = !jsum, j === _n && (ret = bjp), m - j > 100 && ret === 0)
5860
+ return Number.NaN;
5861
+ sum2 = 2 * sum2 - bj, ret /= sum2;
5862
+ }
5863
+ return ret;
5864
+ }, "besselj2");
5865
+ })(), BESSEL2.bessely = (() => {
5866
+ const b0_a1a = [228.4622733, -86327.92757, 1087988129e-2, -5123598036e-1, 7062834065, -2957821389], b0_a2a = [1, 226.1030244, 47447.2647, 7189466438e-3, 7452499648e-1, 40076544269], b0_a1b = [2093887211e-16, -2073370639e-15, 2734510407e-14, -0.001098628627, 1], b0_a2b = [-934945152e-16, 7621095161e-16, -6911147651e-15, 1430488765e-13, -0.01562499995];
5867
+ function bessel0(x) {
5868
+ let a = 0, a1 = 0, a2 = 0, y = x * x;
5869
+ const xx = x - 0.785398164;
5870
+ return x < 8 ? (a1 = _horner(b0_a1a, y), a2 = _horner(b0_a2a, y), a = a1 / a2 + W * (0, BESSEL2.besselj)(x, 0) * Math.log(x)) : (y = 64 / y, a1 = _horner(b0_a1b, y), a2 = _horner(b0_a2b, y), a = Math.sqrt(W / x) * (Math.sin(xx) * a1 + Math.cos(xx) * a2 * 8 / x)), a;
5871
+ }
5872
+ __name(bessel0, "bessel0");
5873
+ const b1_a1a = [8511.937935, -4237922726e-3, 7349264551e-1, -51534381390, 127527439e4, -4900604943e3], b1_a2a = [1, 354.9632885, 102042.605, 2245904002e-2, 3733650367, 424441966400, 249958057e5], b1_a1b = [-240337019e-15, 2457520174e-15, -3516396496e-14, 183105e-8, 1], b1_a2b = [105787412e-15, -88228987e-14, 8449199096e-15, -2002690873e-13, 0.04687499995];
5874
+ function bessel1(x) {
5875
+ let a = 0, a1 = 0, a2 = 0, y = x * x;
5876
+ const xx = x - 2.356194491;
5877
+ return x < 8 ? (a1 = x * _horner(b1_a1a, y), a2 = _horner(b1_a2a, y), a = a1 / a2 + W * ((0, BESSEL2.besselj)(x, 1) * Math.log(x) - 1 / x)) : (y = 64 / y, a1 = _horner(b1_a1b, y), a2 = _horner(b1_a2b, y), a = Math.sqrt(W / x) * (Math.sin(xx) * a1 + Math.cos(xx) * a2 * 8 / x)), a;
5878
+ }
5879
+ return __name(bessel1, "bessel1"), _bessel_wrap(bessel0, bessel1, 1, -1);
5880
+ })(), BESSEL2.besseli = /* @__PURE__ */ (() => {
5881
+ const b0_a = [45813e-7, 0.0360768, 0.2659732, 1.2067492, 3.0899424, 3.5156229, 1], b0_b = [392377e-8, -0.01647633, 0.02635537, -0.02057706, 916281e-8, -157565e-8, 225319e-8, 0.01328592, 0.39894228];
5882
+ function bessel0(x) {
5883
+ return x <= 3.75 ? _horner(b0_a, x * x / (3.75 * 3.75)) : Math.exp(Math.abs(x)) / Math.sqrt(Math.abs(x)) * _horner(b0_b, 3.75 / Math.abs(x));
5884
+ }
5885
+ __name(bessel0, "bessel0");
5886
+ const b1_a = [32411e-8, 301532e-8, 0.02658733, 0.15084934, 0.51498869, 0.87890594, 0.5], b1_b = [-420059e-8, 0.01787654, -0.02895312, 0.02282967, -0.01031555, 163801e-8, -362018e-8, -0.03988024, 0.39894228];
5887
+ function bessel1(x) {
5888
+ return x < 3.75 ? x * _horner(b1_a, x * x / (3.75 * 3.75)) : (x < 0 ? -1 : 1) * Math.exp(Math.abs(x)) / Math.sqrt(Math.abs(x)) * _horner(b1_b, 3.75 / Math.abs(x));
5889
+ }
5890
+ return __name(bessel1, "bessel1"), /* @__PURE__ */ __name(function besseli2(x, n) {
5891
+ const _n = Math.round(n);
5892
+ if (_n === 0)
5893
+ return bessel0(x);
5894
+ if (_n === 1)
5895
+ return bessel1(x);
5896
+ if (_n < 0)
5897
+ return Number.NaN;
5898
+ if (Math.abs(x) === 0)
5899
+ return 0;
5900
+ if (x === 1 / 0)
5901
+ return 1 / 0;
5902
+ let ret = 0, j;
5903
+ const tox = 2 / Math.abs(x);
5904
+ let bip = 0, bi = 1, bim = 0;
5905
+ const m = 2 * Math.round((_n + Math.round(Math.sqrt(40 * _n))) / 2);
5906
+ for (j = m; j > 0; j--)
5907
+ if (bim = j * tox * bi + bip, bip = bi, bi = bim, Math.abs(bi) > 1e10 && (bi *= 1e-10, bip *= 1e-10, ret *= 1e-10), j === _n && (ret = bip), m - j > 100 && ret === 0)
5908
+ return Number.NaN;
5909
+ return ret *= besseli2(x, 0) / bi, x < 0 && _n % 2 ? -ret : ret;
5910
+ }, "besseli2");
5911
+ })(), BESSEL2.besselk = (() => {
5912
+ const b0_a = [74e-7, 1075e-7, 262698e-8, 0.0348859, 0.23069756, 0.4227842, -0.57721566], b0_b = [53208e-8, -25154e-7, 587872e-8, -0.01062446, 0.02189568, -0.07832358, 1.25331414];
5913
+ function bessel0(x) {
5914
+ return x <= 2 ? -Math.log(x / 2) * (0, BESSEL2.besseli)(x, 0) + _horner(b0_a, x * x / 4) : Math.exp(-x) / Math.sqrt(x) * _horner(b0_b, 2 / x);
5915
+ }
5916
+ __name(bessel0, "bessel0");
5917
+ const b1_a = [-4686e-8, -110404e-8, -0.01919402, -0.18156897, -0.67278579, 0.15443144, 1], b1_b = [-68245e-8, 325614e-8, -780353e-8, 0.01504268, -0.0365562, 0.23498619, 1.25331414];
5918
+ function bessel1(x) {
5919
+ return x <= 2 ? Math.log(x / 2) * (0, BESSEL2.besseli)(x, 1) + 1 / x * _horner(b1_a, x * x / 4) : Math.exp(-x) / Math.sqrt(x) * _horner(b1_b, 2 / x);
5920
+ }
5921
+ return __name(bessel1, "bessel1"), _bessel_wrap(bessel0, bessel1, 2, 1);
5922
+ })();
5923
+ })(BESSEL || (BESSEL = {}));
5924
+ function isValidBinaryNumber(number) {
5925
+ return /^[01]{1,10}$/.test(number);
5926
+ }
5927
+ __name(isValidBinaryNumber, "isValidBinaryNumber");
5928
+ function isValidOctalNumber(number) {
5929
+ return /^[0-7]{1,10}$/.test(number);
5930
+ }
5931
+ __name(isValidOctalNumber, "isValidOctalNumber");
5932
+ function isValidHexadecimalNumber(number) {
5933
+ return /^[0-9A-Fa-f]{1,10}$/.test(number);
5934
+ }
5935
+ __name(isValidHexadecimalNumber, "isValidHexadecimalNumber");
5936
+ function erf(x) {
5937
+ if (x === 0)
5938
+ return 0;
5939
+ const cof = [
5940
+ -1.3026537197817094,
5941
+ 0.6419697923564902,
5942
+ 0.019476473204185836,
5943
+ -0.00956151478680863,
5944
+ -946595344482036e-18,
5945
+ 366839497852761e-18,
5946
+ 42523324806907e-18,
5947
+ -20278578112534e-18,
5948
+ -1624290004647e-18,
5949
+ 130365583558e-17,
5950
+ 15626441722e-18,
5951
+ -85238095915e-18,
5952
+ 6529054439e-18,
5953
+ 5059343495e-18,
5954
+ -991364156e-18,
5955
+ -227365122e-18,
5956
+ 96467911e-18,
5957
+ 2394038e-18,
5958
+ -6886027e-18,
5959
+ 894487e-18,
5960
+ 313092e-18,
5961
+ -112708e-18,
5962
+ 381e-18,
5963
+ 7106e-18,
5964
+ -1523e-18,
5965
+ -94e-18,
5966
+ 121e-18,
5967
+ -28e-18
5968
+ ];
5969
+ let _x = x, isNeg = !1;
5970
+ _x < 0 && (_x = -_x, isNeg = !0);
5971
+ const t = 2 / (2 + _x), ty = 4 * t - 2;
5972
+ let d = 0, dd = 0, tmp;
5973
+ for (let j = cof.length - 1; j > 0; j--)
5974
+ tmp = d, d = ty * d - dd + cof[j], dd = tmp;
5975
+ const res = t * Math.exp(-_x * _x + 0.5 * (cof[0] + ty * d) - dd);
5976
+ return isNeg ? res - 1 : 1 - res;
5977
+ }
5978
+ __name(erf, "erf");
5979
+ function erfc(x) {
5980
+ return 1 - erf(x);
5981
+ }
5982
+ __name(erfc, "erfc");
5983
+ function erfcINV(p) {
5984
+ if (p >= 2)
5985
+ return -100;
5986
+ if (p <= 0)
5987
+ return 100;
5988
+ const _p = p < 1 ? p : 2 - p, temp = Math.sqrt(-2 * Math.log(_p / 2));
5989
+ let x = -0.70711 * ((2.30753 + temp * 0.27061) / (1 + temp * (0.99229 + temp * 0.04481)) - temp);
5990
+ for (let j = 0; j < 2; j++) {
5991
+ const err = erfc(x) - _p;
5992
+ x += err / (1.1283791670955126 * Math.exp(-x * x) - x * err);
5993
+ }
5994
+ return p < 1 ? x : -x;
5995
+ }
5996
+ __name(erfcINV, "erfcINV");
5997
+ function calculateFactorial(n, step = 1) {
5998
+ let _n = Math.floor(n);
5999
+ if (n < 0)
6000
+ return Number.NaN;
6001
+ let result = 1;
6002
+ for (; _n > 1 && Number.isFinite(result); )
6003
+ result *= _n, _n -= step;
6004
+ return result;
6005
+ }
6006
+ __name(calculateFactorial, "calculateFactorial");
6007
+ function calculateCombin(n, k) {
6008
+ const t = Math.min(n - k, k);
6009
+ let result = 1;
6010
+ for (let i = 1; i <= t && Number.isFinite(result); i++)
6011
+ result *= n - i + 1, result /= i;
6012
+ return result;
6013
+ }
6014
+ __name(calculateCombin, "calculateCombin");
6015
+ function calculateGcd(a, b) {
6016
+ let _a26 = Math.floor(a), _b = Math.floor(b);
6017
+ for (; _b !== 0; ) {
6018
+ const t = _b;
6019
+ _b = _a26 % _b, _a26 = t;
6020
+ }
6021
+ return _a26;
6022
+ }
6023
+ __name(calculateGcd, "calculateGcd");
6024
+ function calculateLcm(a, b) {
6025
+ const den = calculateGcd(a, b);
6026
+ return den === 0 ? 0 : Math.abs(a * b) / den;
6027
+ }
6028
+ __name(calculateLcm, "calculateLcm");
6029
+ function calculateMdeterm(matrix) {
6030
+ const n = matrix.length;
6031
+ if (n === 1)
6032
+ return matrix[0][0];
6033
+ if (n === 2)
6034
+ return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0];
6035
+ let det = 0;
6036
+ for (let col = 0; col < n; col++)
6037
+ det += (col % 2 === 0 ? 1 : -1) * matrix[0][col] * calculateMdeterm(minor(matrix, 0, col));
6038
+ return det;
6039
+ }
6040
+ __name(calculateMdeterm, "calculateMdeterm");
6041
+ function calculateMinverse(matrix) {
6042
+ const det = calculateMdeterm(matrix);
6043
+ return det === 0 ? null : matrix.length === 1 ? [[1 / det]] : adjoint(matrix).map((row) => row.map((value) => value / det));
6044
+ }
6045
+ __name(calculateMinverse, "calculateMinverse");
6046
+ function minor(matrix, row, col) {
6047
+ return matrix.filter((_, r) => r !== row).map((row2) => row2.filter((_, c) => c !== col));
6048
+ }
6049
+ __name(minor, "minor");
6050
+ function adjoint(matrix) {
6051
+ const n = matrix.length, adj = Array.from({ length: n }, () => new Array(n).fill(0));
6052
+ for (let i = 0; i < n; i++)
6053
+ for (let j = 0; j < n; j++) {
6054
+ const sign2 = (i + j) % 2 === 0 ? 1 : -1;
6055
+ adj[j][i] = sign2 * calculateMdeterm(minor(matrix, i, j));
6056
+ }
6057
+ return adj;
6058
+ }
6059
+ __name(adjoint, "adjoint");
6060
+ function betaCDF(x, alpha, beta) {
6061
+ return x <= 0 ? 0 : x >= 1 ? 1 : incompleteBetaFunction(x, alpha, beta);
6062
+ }
6063
+ __name(betaCDF, "betaCDF");
6064
+ function betaPDF(x, alpha, beta) {
6065
+ return x <= 0 || x >= 1 ? 0 : alpha === 1 && beta === 1 ? 1 : alpha < 512 && beta < 512 ? x ** (alpha - 1) * (1 - x) ** (beta - 1) / betaFunction(alpha, beta) : Math.exp((alpha - 1) * Math.log(x) + (beta - 1) * Math.log(1 - x) - betaFunctionNaturalLogarithm(alpha, beta));
6066
+ }
6067
+ __name(betaPDF, "betaPDF");
6068
+ function betaINV(probability, alpha, beta) {
6069
+ if (probability <= 0)
6070
+ return 0;
6071
+ if (probability >= 1)
6072
+ return 1;
6073
+ const EPSILON = 1e-8;
6074
+ let x;
6075
+ if (alpha >= 1 && beta >= 1) {
6076
+ const p = probability < 0.5 ? probability : 1 - probability, temp = Math.sqrt(-2 * Math.log(p));
6077
+ x = (2.30753 + temp * 0.27061) / (1 + temp * (0.99229 + temp * 0.04481)) - temp, probability < 0.5 && (x = -x);
6078
+ const temp1 = (x * x - 3) / 6, temp2 = 2 / (1 / (2 * alpha - 1) + 1 / (2 * beta - 1)), temp3 = x * Math.sqrt(temp1 + temp2) / temp2 - (1 / (2 * beta - 1) - 1 / (2 * alpha - 1)) * (temp1 + 5 / 6 - 2 / (3 * temp2));
6079
+ x = alpha / (alpha + beta * Math.exp(2 * temp3));
6080
+ } else {
6081
+ const temp1 = Math.exp(alpha * Math.log(alpha / (alpha + beta))) / alpha, temp2 = Math.exp(beta * Math.log(beta / (alpha + beta))) / beta, temp3 = temp1 + temp2;
6082
+ probability < temp1 / temp3 ? x = (alpha * temp3 * probability) ** (1 / alpha) : x = 1 - (beta * temp3 * (1 - probability)) ** (1 / beta);
6083
+ }
6084
+ const betalnNeg = -betaFunctionNaturalLogarithm(alpha, beta);
6085
+ let ibeta, t, u;
6086
+ for (let j = 0; j < 10; j++) {
6087
+ if (x === 0 || x === 1)
6088
+ return x;
6089
+ if (ibeta = incompleteBetaFunction(x, alpha, beta) - probability, t = Math.exp((alpha - 1) * Math.log(x) + (beta - 1) * Math.log(1 - x) + betalnNeg), u = ibeta / t, x -= t = u / (1 - 0.5 * Math.min(1, u * ((alpha - 1) / x - (beta - 1) / (1 - x)))), x <= 0 && (x = 0.5 * (x + t)), x >= 1 && (x = 0.5 * (x + t + 1)), Math.abs(t) < EPSILON * x && j > 0)
6090
+ break;
6091
+ }
6092
+ return x;
6093
+ }
6094
+ __name(betaINV, "betaINV");
6095
+ function incompleteBetaFunction(x, alpha, beta) {
6096
+ const bt = x === 0 || x === 1 ? 0 : Math.exp(logGamma(alpha + beta) - logGamma(alpha) - logGamma(beta) + alpha * Math.log(x) + beta * Math.log(1 - x));
6097
+ return x < (alpha + 1) / (alpha + beta + 2) ? bt * betaContinuedFraction(x, alpha, beta) / alpha : 1 - bt * betaContinuedFraction(1 - x, beta, alpha) / beta;
6098
+ }
6099
+ __name(incompleteBetaFunction, "incompleteBetaFunction");
6100
+ function betaContinuedFraction(x, alpha, beta) {
6101
+ let d = 1 - (alpha + beta) * x / (alpha + 1);
6102
+ Math.abs(d) < 1e-8 && (d = 1e-8), d = 1 / d;
6103
+ let c = 1, h = d;
6104
+ for (let m = 1; m <= 100; m++) {
6105
+ let temp = m * (beta - m) * x / ((alpha - 1 + m * 2) * (alpha + m * 2));
6106
+ if (d = 1 + temp * d, Math.abs(d) < 1e-8 && (d = 1e-8), c = 1 + temp / c, Math.abs(c) < 1e-8 && (c = 1e-8), d = 1 / d, h *= d * c, temp = -(alpha + m) * (alpha + beta + m) * x / ((alpha + m * 2) * (alpha + 1 + m * 2)), d = 1 + temp * d, Math.abs(d) < 1e-8 && (d = 1e-8), c = 1 + temp / c, Math.abs(c) < 1e-8 && (c = 1e-8), d = 1 / d, h *= d * c, Math.abs(d * c - 1) < 1e-8)
6107
+ break;
6108
+ }
6109
+ return h;
6110
+ }
6111
+ __name(betaContinuedFraction, "betaContinuedFraction");
6112
+ function betaFunction(alpha, beta) {
6113
+ return alpha + beta > 170 ? Math.exp(betaFunctionNaturalLogarithm(alpha, beta)) : gammaFunction(alpha) * gammaFunction(beta) / gammaFunction(alpha + beta);
6114
+ }
6115
+ __name(betaFunction, "betaFunction");
6116
+ function betaFunctionNaturalLogarithm(alpha, beta) {
6117
+ return logGamma(alpha) + logGamma(beta) - logGamma(alpha + beta);
6118
+ }
6119
+ __name(betaFunctionNaturalLogarithm, "betaFunctionNaturalLogarithm");
6120
+ function logGamma(x) {
6121
+ const coefficients = [
6122
+ 76.18009172947146,
6123
+ -86.50532032941678,
6124
+ 24.01409824083091,
6125
+ // eslint-disable-line
6126
+ -1.231739572450155,
6127
+ 0.001208650973866179,
6128
+ -5395239384953e-18
6129
+ ];
6130
+ let y = x, tmp = x + 5.5;
6131
+ tmp -= (x + 0.5) * Math.log(tmp);
6132
+ let ser = 1.000000000190015;
6133
+ for (let j = 0; j < 6; j++)
6134
+ y += 1, ser += coefficients[j] / y;
6135
+ return -tmp + Math.log(2.5066282746310007 * ser / x);
6136
+ }
6137
+ __name(logGamma, "logGamma");
6138
+ function gammaFunction(x) {
6139
+ const p = [
6140
+ -1.716185138865495,
6141
+ 24.76565080557592,
6142
+ -379.80425647094563,
6143
+ 629.3311553128184,
6144
+ 866.9662027904133,
6145
+ -31451.272968848367,
6146
+ -36144.413418691176,
6147
+ 66456.14382024054
6148
+ ], q = [
6149
+ -30.8402300119739,
6150
+ 315.35062697960416,
6151
+ -1015.1563674902192,
6152
+ -3107.771671572311,
6153
+ 22538.11842098015,
6154
+ 4755.846277527881,
6155
+ // eslint-disable-line
6156
+ -134659.9598649693,
6157
+ -115132.2596755535
6158
+ ];
6159
+ let fact = 0, y = x;
6160
+ if (x > 171.6243769536076)
6161
+ return 1 / 0;
6162
+ if (y <= 0) {
6163
+ const resMod = y % 1 + 36e-17;
6164
+ if (resMod)
6165
+ fact = (y & 1 ? -1 : 1) * Math.PI / Math.sin(Math.PI * resMod), y = 1 - y;
6166
+ else
6167
+ return 1 / 0;
6168
+ }
6169
+ const yi = y;
6170
+ let n = 0, z;
6171
+ y < 1 ? z = y++ : z = (y -= n = (y | 0) - 1) - 1;
6172
+ let xnum = 0, xden = 0;
6173
+ for (let i = 0; i < 8; ++i)
6174
+ xnum = (xnum + p[i]) * z, xden = xden * z + q[i];
6175
+ let res = xnum / xden + 1;
6176
+ if (yi < y)
6177
+ res /= yi;
6178
+ else if (yi > y)
6179
+ for (let i = 0; i < n; ++i)
6180
+ res *= y, y++;
6181
+ return fact && (res = fact / res), res;
6182
+ }
6183
+ __name(gammaFunction, "gammaFunction");
6184
+ function binomialCDF(x, trials, probability) {
6185
+ if (x < 0)
6186
+ return 0;
6187
+ if (x >= trials)
6188
+ return 1;
6189
+ if (probability < 0 || probability > 1 || trials <= 0)
6190
+ return Number.NaN;
6191
+ let result = 0;
6192
+ for (let i = 0; i <= x; i++)
6193
+ result += binomialPDF(i, trials, probability);
6194
+ return result;
6195
+ }
6196
+ __name(binomialCDF, "binomialCDF");
6197
+ function binomialPDF(x, trials, probability) {
6198
+ return probability === 0 || probability === 1 ? trials * probability === x ? 1 : 0 : calculateCombin(trials, x) * probability ** x * (1 - probability) ** (trials - x);
6199
+ }
6200
+ __name(binomialPDF, "binomialPDF");
6201
+ function chisquareCDF(x, degFreedom) {
6202
+ return x <= 0 ? 0 : lowRegGamma(degFreedom / 2, x / 2);
6203
+ }
6204
+ __name(chisquareCDF, "chisquareCDF");
6205
+ function chisquarePDF(x, degFreedom) {
6206
+ return x < 0 ? 0 : x === 0 && degFreedom === 2 ? 0.5 : Math.exp((degFreedom / 2 - 1) * Math.log(x) - x / 2 - degFreedom / 2 * Math.log(2) - logGamma(degFreedom / 2));
6207
+ }
6208
+ __name(chisquarePDF, "chisquarePDF");
6209
+ function chisquareINV(probability, degFreedom) {
6210
+ return probability <= 0 ? 0 : probability >= 1 ? 1 / 0 : 2 * lowRegGammaInverse(probability, degFreedom / 2);
6211
+ }
6212
+ __name(chisquareINV, "chisquareINV");
6213
+ function lowRegGamma(a, x) {
6214
+ if (x < 0 || a <= 0)
6215
+ return Number.NaN;
6216
+ const MAX_ITER = Math.min(-~(Math.log(a >= 1 ? a : 1 / a) * 8.5 + a * 0.4 + 17), 1e4), aln = logGamma(a), exp2 = Math.exp(-x + a * Math.log(x) - aln);
6217
+ let _a26 = a, sum2 = 1 / a, del = sum2;
6218
+ if (x < a + 1) {
6219
+ if (exp2 === 0)
6220
+ return 0;
6221
+ for (let i = 1; i <= MAX_ITER; i++)
6222
+ sum2 += del *= x / ++_a26;
6223
+ return sum2 * exp2;
6224
+ }
6225
+ if (exp2 === 0)
6226
+ return 1;
6227
+ let b = x + 1 - a, c = 1 / 1e-30, d = 1 / b, h = d;
6228
+ for (let i = 1; i <= MAX_ITER; i++) {
6229
+ const temp = -i * (i - a);
6230
+ b += 2, d = temp * d + b, c = b + temp / c, d = 1 / d, h *= d * c;
6231
+ }
6232
+ return 1 - h * exp2;
6233
+ }
6234
+ __name(lowRegGamma, "lowRegGamma");
6235
+ function lowRegGammaInverse(p, a) {
6236
+ if (p <= 0)
6237
+ return 0;
6238
+ if (p >= 1)
6239
+ return Math.max(100, a + 100 * Math.sqrt(a));
6240
+ let x;
6241
+ if (a > 1) {
6242
+ const _p = p < 0.5 ? p : 1 - p, temp = Math.sqrt(-2 * Math.log(_p));
6243
+ x = (2.30753 + temp * 0.27061) / (1 + temp * (0.99229 + temp * 0.04481)) - temp, p < 0.5 && (x = -x), x = Math.max(1e-3, a * (1 - 1 / (9 * a) - x / (3 * Math.sqrt(a))) ** 3);
6244
+ } else {
6245
+ const temp = 1 - a * (0.253 + a * 0.12);
6246
+ p < temp ? x = (p / temp) ** (1 / a) : x = 1 - Math.log(1 - (p - temp) / (1 - temp));
6247
+ }
6248
+ const EPSILON = 1e-8, aln = logGamma(a);
6249
+ let err, t;
6250
+ for (let j = 0; j < 12; j++) {
6251
+ if (x <= 0)
6252
+ return 0;
6253
+ if (err = lowRegGamma(a, x) - p, a > 1 ? t = Math.exp((a - 1) * (Math.log(a - 1) - 1) - aln) * Math.exp(-(x - (a - 1)) + (a - 1) * (Math.log(x) - Math.log(a - 1))) : t = Math.exp(-x + (a - 1) * Math.log(x) - aln), t !== 0 && (t = err / t / (1 - 0.5 * Math.min(1, err / t * ((a - 1) / x - 1)))), x -= t, x <= 0 && (x = 0.5 * (x + t)), Math.abs(t) < EPSILON * x)
6254
+ break;
6255
+ }
6256
+ return x;
6257
+ }
6258
+ __name(lowRegGammaInverse, "lowRegGammaInverse");
6259
+ function studentTINV(probability, degFreedom) {
6260
+ let x = betaINV(2 * Math.min(probability, 1 - probability), 0.5 * degFreedom, 0.5);
6261
+ return x = Math.sqrt(degFreedom * (1 - x) / x), probability > 0.5 ? x : -x;
6262
+ }
6263
+ __name(studentTINV, "studentTINV");
6264
+ function exponentialCDF(x, lambda) {
6265
+ return x < 0 ? 0 : 1 - Math.exp(-lambda * x);
6266
+ }
6267
+ __name(exponentialCDF, "exponentialCDF");
6268
+ function exponentialPDF(x, lambda) {
6269
+ return x < 0 ? 0 : lambda * Math.exp(-lambda * x);
6270
+ }
6271
+ __name(exponentialPDF, "exponentialPDF");
6272
+ function centralFCDF(x, degFreedom1, degFreedom2) {
6273
+ return x < 0 ? 0 : incompleteBetaFunction(degFreedom1 * x / (degFreedom1 * x + degFreedom2), degFreedom1 / 2, degFreedom2 / 2);
6274
+ }
6275
+ __name(centralFCDF, "centralFCDF");
6276
+ function centralFPDF(x, degFreedom1, degFreedom2) {
6277
+ if (x < 0)
6278
+ return 0;
6279
+ if (x === 0 && degFreedom1 < 2)
6280
+ return 1 / 0;
6281
+ if (x === 0 && degFreedom1 === 2)
6282
+ return 1;
6283
+ let result = 1 / betaFunction(degFreedom1 / 2, degFreedom2 / 2);
6284
+ return result *= (degFreedom1 / degFreedom2) ** (degFreedom1 / 2), result *= x ** (degFreedom1 / 2 - 1), result *= (1 + degFreedom1 / degFreedom2 * x) ** (-(degFreedom1 + degFreedom2) / 2), result;
6285
+ }
6286
+ __name(centralFPDF, "centralFPDF");
6287
+ function centralFINV(probability, degFreedom1, degFreedom2) {
6288
+ return probability <= 0 ? 0 : probability >= 1 ? 1 / 0 : degFreedom2 / (degFreedom1 * (1 / betaINV(probability, degFreedom1 / 2, degFreedom2 / 2) - 1));
6289
+ }
6290
+ __name(centralFINV, "centralFINV");
6291
+ function forecastLinear(x, knownYs, knownXs) {
6292
+ const n = knownYs.length;
6293
+ let knownYsSum = 0, knownXsSum = 0;
6294
+ for (let i = 0; i < n; i++)
6295
+ knownYsSum += knownYs[i], knownXsSum += knownXs[i];
6296
+ const knownYsMean = knownYsSum / n, knownXsMean = knownXsSum / n;
6297
+ let num = 0, den = 0;
6298
+ for (let i = 0; i < n; i++)
6299
+ num += (knownYs[i] - knownYsMean) * (knownXs[i] - knownXsMean), den += (knownXs[i] - knownXsMean) ** 2;
6300
+ if (den === 0)
6301
+ return 1 / 0;
6302
+ const b = num / den;
6303
+ return knownYsMean - b * knownXsMean + b * x;
6304
+ }
6305
+ __name(forecastLinear, "forecastLinear");
6306
+ function normalCDF(x, mean, standardDev) {
6307
+ return 0.5 * (1 + erf((x - mean) / Math.sqrt(2 * standardDev * standardDev)));
6308
+ }
6309
+ __name(normalCDF, "normalCDF");
6310
+ function normalPDF(x, mean, standardDev) {
6311
+ return Math.exp(-0.5 * Math.log(2 * Math.PI) - Math.log(standardDev) - (x - mean) ** 2 / (2 * standardDev * standardDev));
6312
+ }
6313
+ __name(normalPDF, "normalPDF");
6314
+ function normalINV(probability, mean, standardDev) {
6315
+ return -1.4142135623730951 * standardDev * erfcINV(2 * probability) + mean;
6316
+ }
6317
+ __name(normalINV, "normalINV");
6318
+ function getTwoArrayNumberValues(array1, array2, count, array1ColumnCount, array2ColumnCount) {
6319
+ const array1Values = [], array2Values = [];
6320
+ let noCalculate = !0;
6321
+ for (let i = 0; i < count; i++) {
6322
+ const array1RowIndex = Math.floor(i / array1ColumnCount), array1ColumnIndex = i % array1ColumnCount, array2RowIndex = Math.floor(i / array2ColumnCount), array2ColumnIndex = i % array2ColumnCount, array1Object = array1.isArray() ? array1.get(array1RowIndex, array1ColumnIndex) : array1, array2Object = array2.isArray() ? array2.get(array2RowIndex, array2ColumnIndex) : array2;
6323
+ if (array1Object.isError())
6324
+ return {
6325
+ isError: !0,
6326
+ errorObject: array1Object,
6327
+ array1Values,
6328
+ array2Values,
6329
+ noCalculate
6330
+ };
6331
+ if (array2Object.isError())
6332
+ return {
6333
+ isError: !0,
6334
+ errorObject: array2Object,
6335
+ array1Values,
6336
+ array2Values,
6337
+ noCalculate
6338
+ };
6339
+ if (array1Object.isNull() || array2Object.isNull() || array1Object.isBoolean() || array2Object.isBoolean())
6340
+ continue;
6341
+ const array1Value = array1Object.getValue(), array2Value = array2Object.getValue();
6342
+ !isRealNum(array1Value) || !isRealNum(array2Value) || (array1Values.push(+array1Value), array2Values.push(+array2Value), noCalculate = !1);
6343
+ }
6344
+ return {
6345
+ isError: !1,
6346
+ errorObject: null,
6347
+ array1Values,
6348
+ array2Values,
6349
+ noCalculate
6350
+ };
6351
+ }
6352
+ __name(getTwoArrayNumberValues, "getTwoArrayNumberValues");
6353
+ function checkVariantErrorIsArray(variant) {
6354
+ let _variant = variant;
6355
+ if (variant.isArray()) {
6356
+ const rowCount = variant.getRowCount(), columnCount = variant.getColumnCount();
6357
+ if (rowCount > 1 || columnCount > 1)
6358
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6359
+ _variant = variant.get(0, 0);
6360
+ }
6361
+ return _variant.isError(), _variant;
6362
+ }
6363
+ __name(checkVariantErrorIsArray, "checkVariantErrorIsArray");
6364
+ function checkVariantsErrorIsArrayOrBoolean(...variants) {
6365
+ for (let i = 0; i < variants.length; i++) {
6366
+ const variant = checkVariantErrorIsArray(variants[i]);
6367
+ if (variant.isError())
6368
+ return {
6369
+ isError: !0,
6370
+ errorObject: variant
6371
+ };
6372
+ if (variant.isBoolean())
6373
+ return {
6374
+ isError: !0,
6375
+ errorObject: ErrorValueObject.create(ErrorType$1.VALUE)
6376
+ };
6377
+ variants[i] = variant;
6378
+ }
6379
+ return {
6380
+ isError: !1,
6381
+ variants
6382
+ };
6383
+ }
6384
+ __name(checkVariantsErrorIsArrayOrBoolean, "checkVariantsErrorIsArrayOrBoolean");
6385
+ function checkVariantsErrorIsNullorArrayOrBoolean(...variants) {
6386
+ for (let i = 0; i < variants.length; i++) {
6387
+ let variant = variants[i];
6388
+ if (variant.isError())
6389
+ return {
6390
+ isError: !0,
6391
+ errorObject: variant
6392
+ };
6393
+ if (variant.isNull())
6394
+ return {
6395
+ isError: !0,
6396
+ errorObject: ErrorValueObject.create(ErrorType$1.NA)
6397
+ };
6398
+ if (variant = checkVariantErrorIsArray(variants[i]), variant.isError())
6399
+ return {
6400
+ isError: !0,
6401
+ errorObject: variant
6402
+ };
6403
+ if (variant.isBoolean())
6404
+ return {
6405
+ isError: !0,
6406
+ errorObject: ErrorValueObject.create(ErrorType$1.VALUE)
6407
+ };
6408
+ variants[i] = variant;
6409
+ }
6410
+ return {
6411
+ isError: !1,
6412
+ variants
6413
+ };
6414
+ }
6415
+ __name(checkVariantsErrorIsNullorArrayOrBoolean, "checkVariantsErrorIsNullorArrayOrBoolean");
6416
+ function checkVariantsErrorIsStringToNumber(...variants) {
6417
+ for (let i = 0; i < variants.length; i++) {
6418
+ let variant = variants[i];
6419
+ if (variant.isString() && (variant = variant.convertToNumberObjectValue()), variant.isError())
6420
+ return {
6421
+ isError: !0,
6422
+ errorObject: variant
6423
+ };
6424
+ variants[i] = variant;
6425
+ }
6426
+ return {
6427
+ isError: !1,
6428
+ variants
6429
+ };
6430
+ }
6431
+ __name(checkVariantsErrorIsStringToNumber, "checkVariantsErrorIsStringToNumber");
6432
+ const _BetaInv = class _BetaInv extends BaseFunction {
6433
+ constructor() {
6434
+ super(...arguments);
6435
+ __publicField(this, "minParams", 3);
6436
+ __publicField(this, "maxParams", 5);
6437
+ }
6438
+ calculate(probability, alpha, beta, A, B) {
6439
+ let _A = A != null ? A : NumberValueObject.create(0), _B = B != null ? B : NumberValueObject.create(1);
6440
+ _A.isNull() && (_A = NumberValueObject.create(0)), _B.isNull() && (_B = NumberValueObject.create(1));
6441
+ const maxRowLength = Math.max(
6442
+ probability.isArray() ? probability.getRowCount() : 1,
6443
+ alpha.isArray() ? alpha.getRowCount() : 1,
6444
+ beta.isArray() ? beta.getRowCount() : 1,
6445
+ _A.isArray() ? _A.getRowCount() : 1,
6446
+ _B.isArray() ? _B.getRowCount() : 1
6447
+ ), maxColumnLength = Math.max(
6448
+ probability.isArray() ? probability.getColumnCount() : 1,
6449
+ alpha.isArray() ? alpha.getColumnCount() : 1,
6450
+ beta.isArray() ? beta.getColumnCount() : 1,
6451
+ _A.isArray() ? _A.getColumnCount() : 1,
6452
+ _B.isArray() ? _B.getColumnCount() : 1
6453
+ ), probabilityArray = expandArrayValueObject(maxRowLength, maxColumnLength, probability, ErrorValueObject.create(ErrorType$1.NA)), alphaArray = expandArrayValueObject(maxRowLength, maxColumnLength, alpha, ErrorValueObject.create(ErrorType$1.NA)), betaArray = expandArrayValueObject(maxRowLength, maxColumnLength, beta, ErrorValueObject.create(ErrorType$1.NA)), AArray = expandArrayValueObject(maxRowLength, maxColumnLength, _A, ErrorValueObject.create(ErrorType$1.NA)), BArray = expandArrayValueObject(maxRowLength, maxColumnLength, _B, ErrorValueObject.create(ErrorType$1.NA)), resultArray = probabilityArray.mapValue((probabilityObject, rowIndex, columnIndex) => {
6454
+ const alphaObject = alphaArray.get(rowIndex, columnIndex), betaObject = betaArray.get(rowIndex, columnIndex), AObject = AArray.get(rowIndex, columnIndex), BObject = BArray.get(rowIndex, columnIndex);
6455
+ return this._handleSignleObject(probabilityObject, alphaObject, betaObject, AObject, BObject);
6456
+ });
6457
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6458
+ }
6459
+ _handleSignleObject(probabilityObject, alphaObject, betaObject, AObject, BObject) {
6460
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(probabilityObject, alphaObject, betaObject, AObject, BObject);
6461
+ if (isError)
6462
+ return errorObject;
6463
+ const [_probabilityObject, _alphaObject, _betaObject, _AObject, _BObject] = variants, probabilityValue = +_probabilityObject.getValue(), alphaValue = +_alphaObject.getValue(), betaValue = +_betaObject.getValue(), AValue = +_AObject.getValue(), BValue = +_BObject.getValue();
6464
+ if (alphaValue <= 0 || betaValue <= 0 || probabilityValue <= 0 || probabilityValue >= 1 || AValue >= BValue)
6465
+ return ErrorValueObject.create(ErrorType$1.NUM);
6466
+ const result = betaINV(probabilityValue, alphaValue, betaValue) * (BValue - AValue) + AValue;
6467
+ return NumberValueObject.create(result);
6468
+ }
6469
+ };
6470
+ __name(_BetaInv, "BetaInv");
6471
+ let BetaInv = _BetaInv;
6472
+ const _BinomDist = class _BinomDist extends BaseFunction {
6473
+ constructor() {
6474
+ super(...arguments);
6475
+ __publicField(this, "minParams", 4);
6476
+ __publicField(this, "maxParams", 4);
6477
+ }
6478
+ calculate(numberS, trials, probabilityS, cumulative) {
6479
+ const maxRowLength = Math.max(
6480
+ numberS.isArray() ? numberS.getRowCount() : 1,
6481
+ trials.isArray() ? trials.getRowCount() : 1,
6482
+ probabilityS.isArray() ? probabilityS.getRowCount() : 1,
6483
+ cumulative.isArray() ? cumulative.getRowCount() : 1
6484
+ ), maxColumnLength = Math.max(
6485
+ numberS.isArray() ? numberS.getColumnCount() : 1,
6486
+ trials.isArray() ? trials.getColumnCount() : 1,
6487
+ probabilityS.isArray() ? probabilityS.getColumnCount() : 1,
6488
+ cumulative.isArray() ? cumulative.getColumnCount() : 1
6489
+ ), numberSArray = expandArrayValueObject(maxRowLength, maxColumnLength, numberS, ErrorValueObject.create(ErrorType$1.NA)), trialsArray = expandArrayValueObject(maxRowLength, maxColumnLength, trials, ErrorValueObject.create(ErrorType$1.NA)), probabilitySArray = expandArrayValueObject(maxRowLength, maxColumnLength, probabilityS, ErrorValueObject.create(ErrorType$1.NA)), cumulativeArray = expandArrayValueObject(maxRowLength, maxColumnLength, cumulative, ErrorValueObject.create(ErrorType$1.NA)), resultArray = numberSArray.mapValue((numberSObject, rowIndex, columnIndex) => {
6490
+ const trialsObject = trialsArray.get(rowIndex, columnIndex), probabilitySObject = probabilitySArray.get(rowIndex, columnIndex), cumulativeObject = cumulativeArray.get(rowIndex, columnIndex);
6491
+ return this._handleSignleObject(numberSObject, trialsObject, probabilitySObject, cumulativeObject);
6492
+ });
6493
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6494
+ }
6495
+ _handleSignleObject(numberSObject, trialsObject, probabilitySObject, cumulativeObject) {
6496
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(numberSObject, trialsObject, probabilitySObject, cumulativeObject);
6497
+ if (isError)
6498
+ return errorObject;
6499
+ const [_numberSObject, _trialsObject, _probabilitySObject, _cumulativeObject] = variants, numberSValue = Math.floor(+_numberSObject.getValue()), trialsValue = Math.floor(+_trialsObject.getValue()), probabilitySValue = +_probabilitySObject.getValue(), cumulativeValue = +_cumulativeObject.getValue();
6500
+ if (numberSValue < 0 || numberSValue > trialsValue || probabilitySValue < 0 || probabilitySValue > 1)
6501
+ return ErrorValueObject.create(ErrorType$1.NUM);
6502
+ let result;
6503
+ return cumulativeValue ? result = binomialCDF(numberSValue, trialsValue, probabilitySValue) : result = binomialPDF(numberSValue, trialsValue, probabilitySValue), NumberValueObject.create(result);
6504
+ }
6505
+ };
6506
+ __name(_BinomDist, "BinomDist");
6507
+ let BinomDist = _BinomDist;
6508
+ const _BinomInv = class _BinomInv extends BaseFunction {
6509
+ constructor() {
6510
+ super(...arguments);
6511
+ __publicField(this, "minParams", 3);
6512
+ __publicField(this, "maxParams", 3);
6513
+ }
6514
+ calculate(trials, probabilityS, alpha) {
6515
+ const maxRowLength = Math.max(
6516
+ trials.isArray() ? trials.getRowCount() : 1,
6517
+ probabilityS.isArray() ? probabilityS.getRowCount() : 1,
6518
+ alpha.isArray() ? alpha.getRowCount() : 1
6519
+ ), maxColumnLength = Math.max(
6520
+ trials.isArray() ? trials.getColumnCount() : 1,
6521
+ probabilityS.isArray() ? probabilityS.getColumnCount() : 1,
6522
+ alpha.isArray() ? alpha.getColumnCount() : 1
6523
+ ), trialsArray = expandArrayValueObject(maxRowLength, maxColumnLength, trials, ErrorValueObject.create(ErrorType$1.NA)), probabilitySArray = expandArrayValueObject(maxRowLength, maxColumnLength, probabilityS, ErrorValueObject.create(ErrorType$1.NA)), alphaArray = expandArrayValueObject(maxRowLength, maxColumnLength, alpha, ErrorValueObject.create(ErrorType$1.NA)), resultArray = trialsArray.mapValue((trialsObject, rowIndex, columnIndex) => {
6524
+ const probabilitySObject = probabilitySArray.get(rowIndex, columnIndex), alphaObject = alphaArray.get(rowIndex, columnIndex);
6525
+ return this._handleSignleObject(trialsObject, probabilitySObject, alphaObject);
6526
+ });
6527
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6528
+ }
6529
+ _handleSignleObject(trialsObject, probabilitySObject, alphaObject) {
6530
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(trialsObject, probabilitySObject, alphaObject);
6531
+ if (isError)
6532
+ return errorObject;
6533
+ const [_trialsObject, _probabilitySObject, _alphaObject] = variants, trialsValue = Math.floor(+_trialsObject.getValue()), probabilitySValue = +_probabilitySObject.getValue(), alphaValue = +_alphaObject.getValue();
6534
+ if (trialsValue < 0 || probabilitySValue <= 0 || probabilitySValue >= 1 || alphaValue <= 0 || alphaValue >= 1)
6535
+ return ErrorValueObject.create(ErrorType$1.NUM);
6536
+ let result = 0;
6537
+ for (; result <= trialsValue && !(binomialCDF(result, trialsValue, probabilitySValue) >= alphaValue); )
6538
+ result++;
6539
+ return NumberValueObject.create(result);
6540
+ }
6541
+ };
6542
+ __name(_BinomInv, "BinomInv");
6543
+ let BinomInv = _BinomInv;
6544
+ const _ChisqDistRt = class _ChisqDistRt extends BaseFunction {
6545
+ constructor() {
6546
+ super(...arguments);
6547
+ __publicField(this, "minParams", 2);
6548
+ __publicField(this, "maxParams", 2);
6549
+ }
6550
+ calculate(x, degFreedom) {
6551
+ const maxRowLength = Math.max(
6552
+ x.isArray() ? x.getRowCount() : 1,
6553
+ degFreedom.isArray() ? degFreedom.getRowCount() : 1
6554
+ ), maxColumnLength = Math.max(
6555
+ x.isArray() ? x.getColumnCount() : 1,
6556
+ degFreedom.isArray() ? degFreedom.getColumnCount() : 1
6557
+ ), xArray = expandArrayValueObject(maxRowLength, maxColumnLength, x, ErrorValueObject.create(ErrorType$1.NA)), degFreedomArray = expandArrayValueObject(maxRowLength, maxColumnLength, degFreedom, ErrorValueObject.create(ErrorType$1.NA)), resultArray = xArray.mapValue((xObject, rowIndex, columnIndex) => {
6558
+ const degFreedomObject = degFreedomArray.get(rowIndex, columnIndex);
6559
+ return this._handleSignleObject(xObject, degFreedomObject);
6560
+ });
6561
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6562
+ }
6563
+ _handleSignleObject(xObject, degFreedomObject) {
6564
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(xObject, degFreedomObject);
6565
+ if (isError)
6566
+ return errorObject;
6567
+ const [_xObject, _degFreedomObject] = variants, xValue = +_xObject.getValue(), degFreedomValue = Math.floor(+_degFreedomObject.getValue());
6568
+ if (xValue < 0 || degFreedomValue < 1 || degFreedomValue > 10 ** 10)
6569
+ return ErrorValueObject.create(ErrorType$1.NUM);
6570
+ const result = 1 - chisquareCDF(xValue, degFreedomValue);
6571
+ return NumberValueObject.create(result);
6572
+ }
6573
+ };
6574
+ __name(_ChisqDistRt, "ChisqDistRt");
6575
+ let ChisqDistRt = _ChisqDistRt;
6576
+ const _ChisqInvRt = class _ChisqInvRt extends BaseFunction {
6577
+ constructor() {
6578
+ super(...arguments);
6579
+ __publicField(this, "minParams", 2);
6580
+ __publicField(this, "maxParams", 2);
6581
+ }
6582
+ calculate(probability, degFreedom) {
6583
+ const maxRowLength = Math.max(
6584
+ probability.isArray() ? probability.getRowCount() : 1,
6585
+ degFreedom.isArray() ? degFreedom.getRowCount() : 1
6586
+ ), maxColumnLength = Math.max(
6587
+ probability.isArray() ? probability.getColumnCount() : 1,
6588
+ degFreedom.isArray() ? degFreedom.getColumnCount() : 1
6589
+ ), probabilityArray = expandArrayValueObject(maxRowLength, maxColumnLength, probability, ErrorValueObject.create(ErrorType$1.NA)), degFreedomArray = expandArrayValueObject(maxRowLength, maxColumnLength, degFreedom, ErrorValueObject.create(ErrorType$1.NA)), resultArray = probabilityArray.mapValue((probabilityObject, rowIndex, columnIndex) => {
6590
+ const degFreedomObject = degFreedomArray.get(rowIndex, columnIndex);
6591
+ return this._handleSignleObject(probabilityObject, degFreedomObject);
6592
+ });
6593
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6594
+ }
6595
+ _handleSignleObject(probabilityObject, degFreedomObject) {
6596
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(probabilityObject, degFreedomObject);
6597
+ if (isError)
6598
+ return errorObject;
6599
+ const [_probabilityObject, _degFreedomObject] = variants, probabilityValue = +_probabilityObject.getValue(), degFreedomValue = Math.floor(+_degFreedomObject.getValue());
6600
+ if (probabilityValue < 0 || probabilityValue > 1 || degFreedomValue < 1)
6601
+ return ErrorValueObject.create(ErrorType$1.NUM);
6602
+ const result = chisquareINV(1 - probabilityValue, degFreedomValue);
6603
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
6604
+ }
6605
+ };
6606
+ __name(_ChisqInvRt, "ChisqInvRt");
6607
+ let ChisqInvRt = _ChisqInvRt;
6608
+ const _ChisqTest = class _ChisqTest extends BaseFunction {
6609
+ constructor() {
6610
+ super(...arguments);
6611
+ __publicField(this, "minParams", 2);
6612
+ __publicField(this, "maxParams", 2);
6613
+ }
6614
+ calculate(actualRange, expectedRange) {
6615
+ const actualRangeRowCount = actualRange.isArray() ? actualRange.getRowCount() : 1, actualRangeColumnCount = actualRange.isArray() ? actualRange.getColumnCount() : 1, expectedRangeRowCount = expectedRange.isArray() ? expectedRange.getRowCount() : 1, expectedRangeColumnCount = expectedRange.isArray() ? expectedRange.getColumnCount() : 1;
6616
+ let _actualRange = actualRange;
6617
+ if (actualRange.isArray() && actualRangeRowCount === 1 && actualRangeColumnCount === 1 && (_actualRange = actualRange.get(0, 0)), _actualRange.isError())
6618
+ return _actualRange;
6619
+ let _expectedRange = expectedRange;
6620
+ if (expectedRange.isArray() && expectedRangeRowCount === 1 && expectedRangeColumnCount === 1 && (_expectedRange = expectedRange.get(0, 0)), _expectedRange.isError())
6621
+ return _expectedRange;
6622
+ if (actualRangeRowCount * actualRangeColumnCount === 1 || expectedRangeRowCount * expectedRangeColumnCount === 1)
6623
+ return _actualRange.isNull() || _expectedRange.isNull() ? ErrorValueObject.create(ErrorType$1.VALUE) : ErrorValueObject.create(ErrorType$1.NA);
6624
+ if (actualRangeRowCount * actualRangeColumnCount !== expectedRangeRowCount * expectedRangeColumnCount)
6625
+ return ErrorValueObject.create(ErrorType$1.NA);
6626
+ const {
6627
+ isError,
6628
+ errorObject,
6629
+ array1Values,
6630
+ array2Values,
6631
+ noCalculate
6632
+ } = getTwoArrayNumberValues(
6633
+ actualRange,
6634
+ expectedRange,
6635
+ actualRangeRowCount * actualRangeColumnCount,
6636
+ actualRangeColumnCount,
6637
+ expectedRangeColumnCount
6638
+ );
6639
+ return isError ? errorObject : noCalculate ? ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO) : this._getResult(array1Values, array2Values, actualRangeRowCount, actualRangeColumnCount);
6640
+ }
6641
+ _getResult(actualRangeValues, expectedRangeValues, actualRangeRowCount, actualRangeColumnCount) {
6642
+ let sumxmy2 = 0;
6643
+ for (let i = 0; i < actualRangeValues.length; i++) {
6644
+ if (expectedRangeValues[i] === 0)
6645
+ return ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
6646
+ sumxmy2 += (actualRangeValues[i] - expectedRangeValues[i]) ** 2 / expectedRangeValues[i];
6647
+ }
6648
+ let df = (actualRangeRowCount - 1) * (actualRangeColumnCount - 1);
6649
+ actualRangeRowCount === 1 ? df = actualRangeColumnCount - 1 : actualRangeColumnCount === 1 && (df = actualRangeRowCount - 1);
6650
+ const result = 1 - chisquareCDF(sumxmy2, df);
6651
+ return NumberValueObject.create(result);
6652
+ }
6653
+ };
6654
+ __name(_ChisqTest, "ChisqTest");
6655
+ let ChisqTest = _ChisqTest;
6656
+ const _ConfidenceNorm = class _ConfidenceNorm extends BaseFunction {
6657
+ constructor() {
6658
+ super(...arguments);
6659
+ __publicField(this, "minParams", 3);
6660
+ __publicField(this, "maxParams", 3);
6661
+ }
6662
+ calculate(alpha, standardDev, size) {
6663
+ const maxRowLength = Math.max(
6664
+ alpha.isArray() ? alpha.getRowCount() : 1,
6665
+ standardDev.isArray() ? standardDev.getRowCount() : 1,
6666
+ size.isArray() ? size.getRowCount() : 1
6667
+ ), maxColumnLength = Math.max(
6668
+ alpha.isArray() ? alpha.getColumnCount() : 1,
6669
+ standardDev.isArray() ? standardDev.getColumnCount() : 1,
6670
+ size.isArray() ? size.getColumnCount() : 1
6671
+ ), alphaArray = expandArrayValueObject(maxRowLength, maxColumnLength, alpha, ErrorValueObject.create(ErrorType$1.NA)), standardDevArray = expandArrayValueObject(maxRowLength, maxColumnLength, standardDev, ErrorValueObject.create(ErrorType$1.NA)), sizeArray = expandArrayValueObject(maxRowLength, maxColumnLength, size, ErrorValueObject.create(ErrorType$1.NA)), resultArray = alphaArray.mapValue((alphaObject, rowIndex, columnIndex) => {
6672
+ const standardDevObject = standardDevArray.get(rowIndex, columnIndex), sizeObject = sizeArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(alphaObject, standardDevObject, sizeObject);
6673
+ if (isError)
6674
+ return errorObject;
6675
+ const [_alphaObject, _standardDevObject, _sizeObject] = variants, alphaValue = +_alphaObject.getValue(), standardDevValue = +_standardDevObject.getValue(), sizeValue = Math.floor(+_sizeObject.getValue());
6676
+ if (alphaValue <= 0 || alphaValue >= 1 || standardDevValue <= 0 || sizeValue < 1)
6677
+ return ErrorValueObject.create(ErrorType$1.NUM);
6678
+ const result = Math.abs(normalINV(alphaValue / 2, 0, 1) * standardDevValue / Math.sqrt(sizeValue));
6679
+ return NumberValueObject.create(result);
6680
+ });
6681
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6682
+ }
6683
+ };
6684
+ __name(_ConfidenceNorm, "ConfidenceNorm");
6685
+ let ConfidenceNorm = _ConfidenceNorm;
6686
+ const _CovarianceP = class _CovarianceP extends BaseFunction {
6687
+ constructor() {
6688
+ super(...arguments);
6689
+ __publicField(this, "minParams", 2);
6690
+ __publicField(this, "maxParams", 2);
6691
+ }
6692
+ calculate(array1, array2) {
6693
+ const array1RowCount = array1.isArray() ? array1.getRowCount() : 1, array1ColumnCount = array1.isArray() ? array1.getColumnCount() : 1, array2RowCount = array2.isArray() ? array2.getRowCount() : 1, array2ColumnCount = array2.isArray() ? array2.getColumnCount() : 1;
6694
+ let _array1 = array1;
6695
+ if (array1.isArray() && array1RowCount === 1 && array1ColumnCount === 1 && (_array1 = array1.get(0, 0)), _array1.isError())
6696
+ return _array1;
6697
+ let _array2 = array2;
6698
+ if (array2.isArray() && array2RowCount === 1 && array2ColumnCount === 1 && (_array2 = array2.get(0, 0)), _array2.isError())
6699
+ return _array2;
6700
+ if ((array1RowCount * array1ColumnCount === 1 || array2RowCount * array2ColumnCount === 1) && (_array1.isNull() || _array2.isNull()))
6701
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6702
+ if (array1RowCount * array1ColumnCount !== array2RowCount * array2ColumnCount)
6703
+ return ErrorValueObject.create(ErrorType$1.NA);
6704
+ const {
6705
+ isError,
6706
+ errorObject,
6707
+ array1Values,
6708
+ array2Values,
6709
+ noCalculate
6710
+ } = getTwoArrayNumberValues(
6711
+ array1,
6712
+ array2,
6713
+ array1RowCount * array1ColumnCount,
6714
+ array1ColumnCount,
6715
+ array2ColumnCount
6716
+ );
6717
+ return isError ? errorObject : noCalculate ? ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO) : this._getResult(array1Values, array2Values);
6718
+ }
6719
+ _getResult(array1Values, array2Values) {
6720
+ if (array1Values.length === 0)
6721
+ return ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
6722
+ const n = array1Values.length;
6723
+ let array1Sum = 0, array2Sum = 0;
6724
+ for (let i = 0; i < n; i++)
6725
+ array1Sum += array1Values[i], array2Sum += array2Values[i];
6726
+ const array1Mean = array1Sum / n, array2Mean = array2Sum / n;
6727
+ let numerator = 0;
6728
+ for (let i = 0; i < n; i++) {
6729
+ const array1Diff = array1Values[i] - array1Mean, array2Diff = array2Values[i] - array2Mean;
6730
+ numerator += array1Diff * array2Diff;
6731
+ }
6732
+ return NumberValueObject.create(numerator / n);
6733
+ }
6734
+ };
6735
+ __name(_CovarianceP, "CovarianceP");
6736
+ let CovarianceP = _CovarianceP;
6737
+ const _ExponDist = class _ExponDist extends BaseFunction {
6738
+ constructor() {
6739
+ super(...arguments);
6740
+ __publicField(this, "minParams", 3);
6741
+ __publicField(this, "maxParams", 3);
6742
+ }
6743
+ calculate(x, lambda, cumulative) {
6744
+ const maxRowLength = Math.max(
6745
+ x.isArray() ? x.getRowCount() : 1,
6746
+ lambda.isArray() ? lambda.getRowCount() : 1,
6747
+ cumulative.isArray() ? cumulative.getRowCount() : 1
6748
+ ), maxColumnLength = Math.max(
6749
+ x.isArray() ? x.getColumnCount() : 1,
6750
+ lambda.isArray() ? lambda.getColumnCount() : 1,
6751
+ cumulative.isArray() ? cumulative.getColumnCount() : 1
6752
+ ), xArray = expandArrayValueObject(maxRowLength, maxColumnLength, x, ErrorValueObject.create(ErrorType$1.NA)), lambdaArray = expandArrayValueObject(maxRowLength, maxColumnLength, lambda, ErrorValueObject.create(ErrorType$1.NA)), cumulativeArray = expandArrayValueObject(maxRowLength, maxColumnLength, cumulative, ErrorValueObject.create(ErrorType$1.NA)), resultArray = xArray.mapValue((xObject, rowIndex, columnIndex) => {
6753
+ const lambdaObject = lambdaArray.get(rowIndex, columnIndex), cumulativeObject = cumulativeArray.get(rowIndex, columnIndex);
6754
+ return this._handleSignleObject(xObject, lambdaObject, cumulativeObject);
6755
+ });
6756
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6757
+ }
6758
+ _handleSignleObject(xObject, lambdaObject, cumulativeObject) {
6759
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(xObject, lambdaObject, cumulativeObject);
6760
+ if (isError)
6761
+ return errorObject;
6762
+ const [_xObject, _lambdaObject, _cumulativeObject] = variants, xValue = +_xObject.getValue(), lambdaValue = +_lambdaObject.getValue(), cumulativeValue = +_cumulativeObject.getValue();
6763
+ if (xValue < 0 || lambdaValue <= 0)
6764
+ return ErrorValueObject.create(ErrorType$1.NUM);
6765
+ let result;
6766
+ return cumulativeValue ? result = exponentialCDF(xValue, lambdaValue) : result = exponentialPDF(xValue, lambdaValue), NumberValueObject.create(result);
6767
+ }
6768
+ };
6769
+ __name(_ExponDist, "ExponDist");
6770
+ let ExponDist = _ExponDist;
6771
+ const _FDistRt = class _FDistRt extends BaseFunction {
6772
+ constructor() {
6773
+ super(...arguments);
6774
+ __publicField(this, "minParams", 3);
6775
+ __publicField(this, "maxParams", 3);
6776
+ }
6777
+ calculate(x, degFreedom1, degFreedom2) {
6778
+ const maxRowLength = Math.max(
6779
+ x.isArray() ? x.getRowCount() : 1,
6780
+ degFreedom1.isArray() ? degFreedom1.getRowCount() : 1,
6781
+ degFreedom2.isArray() ? degFreedom2.getRowCount() : 1
6782
+ ), maxColumnLength = Math.max(
6783
+ x.isArray() ? x.getColumnCount() : 1,
6784
+ degFreedom1.isArray() ? degFreedom1.getColumnCount() : 1,
6785
+ degFreedom2.isArray() ? degFreedom2.getColumnCount() : 1
6786
+ ), xArray = expandArrayValueObject(maxRowLength, maxColumnLength, x, ErrorValueObject.create(ErrorType$1.NA)), degFreedom1Array = expandArrayValueObject(maxRowLength, maxColumnLength, degFreedom1, ErrorValueObject.create(ErrorType$1.NA)), degFreedom2Array = expandArrayValueObject(maxRowLength, maxColumnLength, degFreedom2, ErrorValueObject.create(ErrorType$1.NA)), resultArray = xArray.mapValue((xObject, rowIndex, columnIndex) => {
6787
+ const degFreedom1Object = degFreedom1Array.get(rowIndex, columnIndex), degFreedom2Object = degFreedom2Array.get(rowIndex, columnIndex);
6788
+ return this._handleSignleObject(xObject, degFreedom1Object, degFreedom2Object);
6789
+ });
6790
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6791
+ }
6792
+ _handleSignleObject(xObject, degFreedom1Object, degFreedom2Object) {
6793
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(xObject, degFreedom1Object, degFreedom2Object);
6794
+ if (isError)
6795
+ return errorObject;
6796
+ const [_xObject, _degFreedom1Object, _degFreedom2Object] = variants, xValue = +_xObject.getValue(), degFreedom1Value = Math.floor(+_degFreedom1Object.getValue()), degFreedom2Value = Math.floor(+_degFreedom2Object.getValue());
6797
+ if (xValue < 0 || degFreedom1Value < 1 || degFreedom1Value > 10 ** 10 || degFreedom2Value < 1 || degFreedom2Value > 10 ** 10)
6798
+ return ErrorValueObject.create(ErrorType$1.NUM);
6799
+ const result = 1 - centralFCDF(xValue, degFreedom1Value, degFreedom2Value);
6800
+ return NumberValueObject.create(result);
6801
+ }
6802
+ };
6803
+ __name(_FDistRt, "FDistRt");
6804
+ let FDistRt = _FDistRt;
6805
+ const _FInvRt = class _FInvRt extends BaseFunction {
6806
+ constructor() {
6807
+ super(...arguments);
6808
+ __publicField(this, "minParams", 3);
6809
+ __publicField(this, "maxParams", 3);
6810
+ }
6811
+ calculate(probability, degFreedom1, degFreedom2) {
6812
+ const maxRowLength = Math.max(
6813
+ probability.isArray() ? probability.getRowCount() : 1,
6814
+ degFreedom1.isArray() ? degFreedom1.getRowCount() : 1,
6815
+ degFreedom2.isArray() ? degFreedom2.getRowCount() : 1
6816
+ ), maxColumnLength = Math.max(
6817
+ probability.isArray() ? probability.getColumnCount() : 1,
6818
+ degFreedom1.isArray() ? degFreedom1.getColumnCount() : 1,
6819
+ degFreedom2.isArray() ? degFreedom2.getColumnCount() : 1
6820
+ ), probabilityArray = expandArrayValueObject(maxRowLength, maxColumnLength, probability, ErrorValueObject.create(ErrorType$1.NA)), degFreedom1Array = expandArrayValueObject(maxRowLength, maxColumnLength, degFreedom1, ErrorValueObject.create(ErrorType$1.NA)), degFreedom2Array = expandArrayValueObject(maxRowLength, maxColumnLength, degFreedom2, ErrorValueObject.create(ErrorType$1.NA)), resultArray = probabilityArray.mapValue((probabilityObject, rowIndex, columnIndex) => {
6821
+ const degFreedom1Object = degFreedom1Array.get(rowIndex, columnIndex), degFreedom2Object = degFreedom2Array.get(rowIndex, columnIndex);
6822
+ return this._handleSignleObject(probabilityObject, degFreedom1Object, degFreedom2Object);
6823
+ });
6824
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6825
+ }
6826
+ _handleSignleObject(probabilityObject, degFreedom1Object, degFreedom2Object) {
6827
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(probabilityObject, degFreedom1Object, degFreedom2Object);
6828
+ if (isError)
6829
+ return errorObject;
6830
+ const [_probabilityObject, _degFreedom1Object, _degFreedom2Object] = variants, probabilityValue = +_probabilityObject.getValue(), degFreedom1Value = Math.floor(+_degFreedom1Object.getValue()), degFreedom2Value = Math.floor(+_degFreedom2Object.getValue());
6831
+ if (probabilityValue < 0 || probabilityValue > 1 || degFreedom1Value < 1 || degFreedom1Value > 10 ** 10 || degFreedom2Value < 1 || degFreedom2Value > 10 ** 10)
6832
+ return ErrorValueObject.create(ErrorType$1.NUM);
6833
+ const result = centralFINV(1 - probabilityValue, degFreedom1Value, degFreedom2Value);
6834
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
6835
+ }
6836
+ };
6837
+ __name(_FInvRt, "FInvRt");
6838
+ let FInvRt = _FInvRt;
6839
+ const _FTest = class _FTest extends BaseFunction {
6840
+ constructor() {
6841
+ super(...arguments);
6842
+ __publicField(this, "minParams", 2);
6843
+ __publicField(this, "maxParams", 2);
6844
+ }
6845
+ calculate(array1, array2) {
6846
+ const {
6847
+ isError: isError_array1,
6848
+ errorObject: errorObject_array1,
6849
+ variance: variance_array1,
6850
+ ns1: ns1_array1
6851
+ } = this._getValues(array1);
6852
+ if (isError_array1)
6853
+ return errorObject_array1;
6854
+ const {
6855
+ isError: isError_array2,
6856
+ errorObject: errorObject_array2,
6857
+ variance: variance_array2,
6858
+ ns1: ns1_array2
6859
+ } = this._getValues(array2);
6860
+ if (isError_array2)
6861
+ return errorObject_array2;
6862
+ let result = 2 * (1 - centralFCDF(variance_array1 / variance_array2, ns1_array1, ns1_array2));
6863
+ return result > 1 && (result = 2 - result), NumberValueObject.create(result);
6864
+ }
6865
+ // eslint-disable-next-line
6866
+ _getValues(array) {
6867
+ let variance = 0, ns1 = 0;
6868
+ const arrayRowCount = array.isArray() ? array.getRowCount() : 1, arrayColumnCount = array.isArray() ? array.getColumnCount() : 1;
6869
+ if (arrayRowCount === 1 && arrayColumnCount === 1) {
6870
+ const _array = array.isArray() ? array.get(0, 0) : array;
6871
+ return _array.isError() ? {
6872
+ isError: !0,
6873
+ errorObject: _array,
6874
+ variance,
6875
+ ns1
6876
+ } : _array.isNull() ? {
6877
+ isError: !0,
6878
+ errorObject: ErrorValueObject.create(ErrorType$1.VALUE),
6879
+ variance,
6880
+ ns1
6881
+ } : {
6882
+ isError: !0,
6883
+ errorObject: ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO),
6884
+ variance,
6885
+ ns1
6886
+ };
6887
+ }
6888
+ const values = [];
6889
+ let sum2 = 0;
6890
+ for (let r = 0; r < arrayRowCount; r++)
6891
+ for (let c = 0; c < arrayColumnCount; c++) {
6892
+ const valueObject = array.isArray() ? array.get(r, c) : array;
6893
+ if (valueObject.isError())
6894
+ return {
6895
+ isError: !0,
6896
+ errorObject: valueObject,
6897
+ variance,
6898
+ ns1
6899
+ };
6900
+ if (valueObject.isNull() || valueObject.isBoolean())
6901
+ continue;
6902
+ const value = valueObject.getValue();
6903
+ isRealNum(value) && (values.push(+value), sum2 += +value);
6904
+ }
6905
+ if (values.length <= 1)
6906
+ return {
6907
+ isError: !0,
6908
+ errorObject: ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO),
6909
+ variance,
6910
+ ns1
6911
+ };
6912
+ const mean = sum2 / values.length;
6913
+ let sumSquares = 0;
6914
+ for (let i = 0; i < values.length; i++)
6915
+ sumSquares += (values[i] - mean) ** 2;
6916
+ return ns1 = values.length - 1, variance = sumSquares / ns1, variance === 0 ? {
6917
+ isError: !0,
6918
+ errorObject: ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO),
6919
+ variance,
6920
+ ns1
6921
+ } : {
6922
+ isError: !1,
6923
+ errorObject: null,
6924
+ variance,
6925
+ ns1
6926
+ };
6927
+ }
6928
+ };
6929
+ __name(_FTest, "FTest");
6930
+ let FTest = _FTest;
6931
+ const _NormDist = class _NormDist extends BaseFunction {
6932
+ constructor() {
6933
+ super(...arguments);
6934
+ __publicField(this, "minParams", 4);
6935
+ __publicField(this, "maxParams", 4);
6936
+ }
6937
+ calculate(x, mean, standardDev, cumulative) {
6938
+ const maxRowLength = Math.max(
6939
+ x.isArray() ? x.getRowCount() : 1,
6940
+ mean.isArray() ? mean.getRowCount() : 1,
6941
+ standardDev.isArray() ? standardDev.getRowCount() : 1,
6942
+ cumulative.isArray() ? cumulative.getRowCount() : 1
6943
+ ), maxColumnLength = Math.max(
6944
+ x.isArray() ? x.getColumnCount() : 1,
6945
+ mean.isArray() ? mean.getColumnCount() : 1,
6946
+ standardDev.isArray() ? standardDev.getColumnCount() : 1,
6947
+ cumulative.isArray() ? cumulative.getColumnCount() : 1
6948
+ ), xArray = expandArrayValueObject(maxRowLength, maxColumnLength, x, ErrorValueObject.create(ErrorType$1.NA)), meanArray = expandArrayValueObject(maxRowLength, maxColumnLength, mean, ErrorValueObject.create(ErrorType$1.NA)), standardDevArray = expandArrayValueObject(maxRowLength, maxColumnLength, standardDev, ErrorValueObject.create(ErrorType$1.NA)), cumulativeArray = expandArrayValueObject(maxRowLength, maxColumnLength, cumulative, ErrorValueObject.create(ErrorType$1.NA)), resultArray = xArray.mapValue((xObject, rowIndex, columnIndex) => {
6949
+ const meanObject = meanArray.get(rowIndex, columnIndex), standardDevObject = standardDevArray.get(rowIndex, columnIndex), cumulativeObject = cumulativeArray.get(rowIndex, columnIndex);
6950
+ return this._handleSignleObject(xObject, meanObject, standardDevObject, cumulativeObject);
6951
+ });
6952
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6953
+ }
6954
+ _handleSignleObject(xObject, meanObject, standardDevObject, cumulativeObject) {
6955
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(xObject, meanObject, standardDevObject, cumulativeObject);
6956
+ if (isError)
6957
+ return errorObject;
6958
+ const [_xObject, _meanObject, _standardDevObject, _cumulativeObject] = variants, xValue = +_xObject.getValue(), meanValue = +_meanObject.getValue(), standardDevValue = +_standardDevObject.getValue(), cumulativeValue = +_cumulativeObject.getValue();
6959
+ if (standardDevValue <= 0)
6960
+ return ErrorValueObject.create(ErrorType$1.NUM);
6961
+ let result;
6962
+ return cumulativeValue ? result = normalCDF(xValue, meanValue, standardDevValue) : result = normalPDF(xValue, meanValue, standardDevValue), NumberValueObject.create(result);
6963
+ }
6964
+ };
6965
+ __name(_NormDist, "NormDist");
6966
+ let NormDist = _NormDist;
6967
+ const _NormInv = class _NormInv extends BaseFunction {
6968
+ constructor() {
6969
+ super(...arguments);
6970
+ __publicField(this, "minParams", 3);
6971
+ __publicField(this, "maxParams", 3);
6972
+ }
6973
+ calculate(probability, mean, standardDev) {
6974
+ const maxRowLength = Math.max(
6975
+ probability.isArray() ? probability.getRowCount() : 1,
6976
+ mean.isArray() ? mean.getRowCount() : 1,
6977
+ standardDev.isArray() ? standardDev.getRowCount() : 1
6978
+ ), maxColumnLength = Math.max(
6979
+ probability.isArray() ? probability.getColumnCount() : 1,
6980
+ mean.isArray() ? mean.getColumnCount() : 1,
6981
+ standardDev.isArray() ? standardDev.getColumnCount() : 1
6982
+ ), probabilityArray = expandArrayValueObject(maxRowLength, maxColumnLength, probability, ErrorValueObject.create(ErrorType$1.NA)), meanArray = expandArrayValueObject(maxRowLength, maxColumnLength, mean, ErrorValueObject.create(ErrorType$1.NA)), standardDevArray = expandArrayValueObject(maxRowLength, maxColumnLength, standardDev, ErrorValueObject.create(ErrorType$1.NA)), resultArray = probabilityArray.mapValue((probabilityObject, rowIndex, columnIndex) => {
6983
+ const meanObject = meanArray.get(rowIndex, columnIndex), standardDevObject = standardDevArray.get(rowIndex, columnIndex);
6984
+ return this._handleSignleObject(probabilityObject, meanObject, standardDevObject);
6985
+ });
6986
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6987
+ }
6988
+ _handleSignleObject(probabilityObject, meanObject, standardDevObject) {
6989
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(probabilityObject, meanObject, standardDevObject);
6990
+ if (isError)
6991
+ return errorObject;
6992
+ const [_probabilityObject, _meanObject, _standardDevObject] = variants, probabilityValue = +_probabilityObject.getValue(), meanValue = +_meanObject.getValue(), standardDevValue = +_standardDevObject.getValue();
6993
+ if (probabilityValue <= 0 || probabilityValue >= 1 || standardDevValue <= 0)
6994
+ return ErrorValueObject.create(ErrorType$1.NUM);
6995
+ const result = normalINV(probabilityValue, meanValue, standardDevValue);
6996
+ return NumberValueObject.create(result);
6997
+ }
6998
+ };
6999
+ __name(_NormInv, "NormInv");
7000
+ let NormInv = _NormInv;
7001
+ const _NormSInv = class _NormSInv extends BaseFunction {
7002
+ constructor() {
7003
+ super(...arguments);
7004
+ __publicField(this, "minParams", 1);
7005
+ __publicField(this, "maxParams", 1);
7006
+ }
7007
+ calculate(probability) {
7008
+ if (probability.isArray()) {
7009
+ const resultArray = probability.mapValue((probabilityObject) => this._handleSignleObject(probabilityObject));
7010
+ return probability.getRowCount() === 1 && probability.getColumnCount() === 1 ? resultArray.get(0, 0) : resultArray;
7011
+ }
7012
+ return this._handleSignleObject(probability);
7013
+ }
7014
+ _handleSignleObject(probabilityObject) {
7015
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(probabilityObject);
7016
+ if (isError)
7017
+ return errorObject;
7018
+ const [_probabilityObject] = variants, probabilityValue = +_probabilityObject.getValue();
7019
+ if (probabilityValue <= 0 || probabilityValue >= 1)
7020
+ return ErrorValueObject.create(ErrorType$1.NUM);
7021
+ const result = normalINV(probabilityValue, 0, 1);
7022
+ return NumberValueObject.create(result);
7023
+ }
7024
+ };
7025
+ __name(_NormSInv, "NormSInv");
7026
+ let NormSInv = _NormSInv;
5778
7027
  const _StdevP = class _StdevP extends BaseFunction {
5779
7028
  constructor() {
5780
7029
  super(...arguments);
@@ -5827,6 +7076,70 @@ const _VarS = class _VarS extends BaseFunction {
5827
7076
  };
5828
7077
  __name(_VarS, "VarS");
5829
7078
  let VarS = _VarS;
7079
+ const _Betadist = class _Betadist extends BaseFunction {
7080
+ constructor() {
7081
+ super(...arguments);
7082
+ __publicField(this, "minParams", 3);
7083
+ __publicField(this, "maxParams", 5);
7084
+ }
7085
+ calculate(x, alpha, beta, A, B) {
7086
+ let _A = A != null ? A : NumberValueObject.create(0), _B = B != null ? B : NumberValueObject.create(1);
7087
+ _A.isNull() && (_A = NumberValueObject.create(0)), _B.isNull() && (_B = NumberValueObject.create(1));
7088
+ const maxRowLength = Math.max(
7089
+ x.isArray() ? x.getRowCount() : 1,
7090
+ alpha.isArray() ? alpha.getRowCount() : 1,
7091
+ beta.isArray() ? beta.getRowCount() : 1,
7092
+ _A.isArray() ? _A.getRowCount() : 1,
7093
+ _B.isArray() ? _B.getRowCount() : 1
7094
+ ), maxColumnLength = Math.max(
7095
+ x.isArray() ? x.getColumnCount() : 1,
7096
+ alpha.isArray() ? alpha.getColumnCount() : 1,
7097
+ beta.isArray() ? beta.getColumnCount() : 1,
7098
+ _A.isArray() ? _A.getColumnCount() : 1,
7099
+ _B.isArray() ? _B.getColumnCount() : 1
7100
+ ), xArray = expandArrayValueObject(maxRowLength, maxColumnLength, x, ErrorValueObject.create(ErrorType$1.NA)), alphaArray = expandArrayValueObject(maxRowLength, maxColumnLength, alpha, ErrorValueObject.create(ErrorType$1.NA)), betaArray = expandArrayValueObject(maxRowLength, maxColumnLength, beta, ErrorValueObject.create(ErrorType$1.NA)), AArray = expandArrayValueObject(maxRowLength, maxColumnLength, _A, ErrorValueObject.create(ErrorType$1.NA)), BArray = expandArrayValueObject(maxRowLength, maxColumnLength, _B, ErrorValueObject.create(ErrorType$1.NA)), resultArray = xArray.mapValue((xObject, rowIndex, columnIndex) => {
7101
+ const alphaObject = alphaArray.get(rowIndex, columnIndex), betaObject = betaArray.get(rowIndex, columnIndex), AObject = AArray.get(rowIndex, columnIndex), BObject = BArray.get(rowIndex, columnIndex);
7102
+ return this._handleSignleObject(xObject, alphaObject, betaObject, AObject, BObject);
7103
+ });
7104
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
7105
+ }
7106
+ _handleSignleObject(xObject, alphaObject, betaObject, AObject, BObject) {
7107
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(xObject, alphaObject, betaObject, AObject, BObject);
7108
+ if (isError)
7109
+ return errorObject;
7110
+ const [_xObject, _alphaObject, _betaObject, _AObject, _BObject] = variants, xValue = +_xObject.getValue(), alphaValue = +_alphaObject.getValue(), betaValue = +_betaObject.getValue(), AValue = +_AObject.getValue(), BValue = +_BObject.getValue();
7111
+ if (alphaValue <= 0 || betaValue <= 0 || xValue < AValue || xValue > BValue || AValue === BValue)
7112
+ return ErrorValueObject.create(ErrorType$1.NUM);
7113
+ const result = betaCDF((xValue - AValue) / (BValue - AValue), alphaValue, betaValue);
7114
+ return NumberValueObject.create(result);
7115
+ }
7116
+ };
7117
+ __name(_Betadist, "Betadist");
7118
+ let Betadist = _Betadist;
7119
+ var FUNCTION_NAMES_COMPATIBILITY = /* @__PURE__ */ ((FUNCTION_NAMES_COMPATIBILITY2) => (FUNCTION_NAMES_COMPATIBILITY2.BETADIST = "BETADIST", FUNCTION_NAMES_COMPATIBILITY2.BETAINV = "BETAINV", FUNCTION_NAMES_COMPATIBILITY2.BINOMDIST = "BINOMDIST", FUNCTION_NAMES_COMPATIBILITY2.CHIDIST = "CHIDIST", FUNCTION_NAMES_COMPATIBILITY2.CHIINV = "CHIINV", FUNCTION_NAMES_COMPATIBILITY2.CHITEST = "CHITEST", FUNCTION_NAMES_COMPATIBILITY2.CONFIDENCE = "CONFIDENCE", FUNCTION_NAMES_COMPATIBILITY2.COVAR = "COVAR", FUNCTION_NAMES_COMPATIBILITY2.CRITBINOM = "CRITBINOM", FUNCTION_NAMES_COMPATIBILITY2.EXPONDIST = "EXPONDIST", FUNCTION_NAMES_COMPATIBILITY2.FDIST = "FDIST", FUNCTION_NAMES_COMPATIBILITY2.FINV = "FINV", FUNCTION_NAMES_COMPATIBILITY2.FTEST = "FTEST", FUNCTION_NAMES_COMPATIBILITY2.GAMMADIST = "GAMMADIST", FUNCTION_NAMES_COMPATIBILITY2.GAMMAINV = "GAMMAINV", FUNCTION_NAMES_COMPATIBILITY2.HYPGEOMDIST = "HYPGEOMDIST", FUNCTION_NAMES_COMPATIBILITY2.LOGINV = "LOGINV", FUNCTION_NAMES_COMPATIBILITY2.LOGNORMDIST = "LOGNORMDIST", FUNCTION_NAMES_COMPATIBILITY2.MODE = "MODE", FUNCTION_NAMES_COMPATIBILITY2.NEGBINOMDIST = "NEGBINOMDIST", FUNCTION_NAMES_COMPATIBILITY2.NORMDIST = "NORMDIST", FUNCTION_NAMES_COMPATIBILITY2.NORMINV = "NORMINV", FUNCTION_NAMES_COMPATIBILITY2.NORMSDIST = "NORMSDIST", FUNCTION_NAMES_COMPATIBILITY2.NORMSINV = "NORMSINV", FUNCTION_NAMES_COMPATIBILITY2.PERCENTILE = "PERCENTILE", FUNCTION_NAMES_COMPATIBILITY2.PERCENTRANK = "PERCENTRANK", FUNCTION_NAMES_COMPATIBILITY2.POISSON = "POISSON", FUNCTION_NAMES_COMPATIBILITY2.QUARTILE = "QUARTILE", FUNCTION_NAMES_COMPATIBILITY2.RANK = "RANK", FUNCTION_NAMES_COMPATIBILITY2.STDEV = "STDEV", FUNCTION_NAMES_COMPATIBILITY2.STDEVP = "STDEVP", FUNCTION_NAMES_COMPATIBILITY2.TDIST = "TDIST", FUNCTION_NAMES_COMPATIBILITY2.TINV = "TINV", FUNCTION_NAMES_COMPATIBILITY2.TTEST = "TTEST", FUNCTION_NAMES_COMPATIBILITY2.VAR = "VAR", FUNCTION_NAMES_COMPATIBILITY2.VARP = "VARP", FUNCTION_NAMES_COMPATIBILITY2.WEIBULL = "WEIBULL", FUNCTION_NAMES_COMPATIBILITY2.ZTEST = "ZTEST", FUNCTION_NAMES_COMPATIBILITY2))(FUNCTION_NAMES_COMPATIBILITY || {});
7120
+ const _Normsdist = class _Normsdist extends BaseFunction {
7121
+ constructor() {
7122
+ super(...arguments);
7123
+ __publicField(this, "minParams", 1);
7124
+ __publicField(this, "maxParams", 1);
7125
+ }
7126
+ calculate(z) {
7127
+ if (z.isArray()) {
7128
+ const resultArray = z.mapValue((zObject) => this._handleSignleObject(zObject));
7129
+ return z.getRowCount() === 1 && z.getColumnCount() === 1 ? resultArray.get(0, 0) : resultArray;
7130
+ }
7131
+ return this._handleSignleObject(z);
7132
+ }
7133
+ _handleSignleObject(zObject) {
7134
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(zObject);
7135
+ if (isError)
7136
+ return errorObject;
7137
+ const [_zObject] = variants, zValue = +_zObject.getValue(), result = normalCDF(zValue, 0, 1);
7138
+ return NumberValueObject.create(result);
7139
+ }
7140
+ };
7141
+ __name(_Normsdist, "Normsdist");
7142
+ let Normsdist = _Normsdist;
5830
7143
  const _Rank = class _Rank extends BaseFunction {
5831
7144
  constructor() {
5832
7145
  super(...arguments);
@@ -5888,8 +7201,24 @@ const _Rank = class _Rank extends BaseFunction {
5888
7201
  };
5889
7202
  __name(_Rank, "Rank");
5890
7203
  let Rank = _Rank;
5891
- var FUNCTION_NAMES_COMPATIBILITY = /* @__PURE__ */ ((FUNCTION_NAMES_COMPATIBILITY2) => (FUNCTION_NAMES_COMPATIBILITY2.BETADIST = "BETADIST", FUNCTION_NAMES_COMPATIBILITY2.BETAINV = "BETAINV", FUNCTION_NAMES_COMPATIBILITY2.BINOMDIST = "BINOMDIST", FUNCTION_NAMES_COMPATIBILITY2.CHIDIST = "CHIDIST", FUNCTION_NAMES_COMPATIBILITY2.CHIINV = "CHIINV", FUNCTION_NAMES_COMPATIBILITY2.CHITEST = "CHITEST", FUNCTION_NAMES_COMPATIBILITY2.CONFIDENCE = "CONFIDENCE", FUNCTION_NAMES_COMPATIBILITY2.COVAR = "COVAR", FUNCTION_NAMES_COMPATIBILITY2.CRITBINOM = "CRITBINOM", FUNCTION_NAMES_COMPATIBILITY2.EXPONDIST = "EXPONDIST", FUNCTION_NAMES_COMPATIBILITY2.FDIST = "FDIST", FUNCTION_NAMES_COMPATIBILITY2.FINV = "FINV", FUNCTION_NAMES_COMPATIBILITY2.FTEST = "FTEST", FUNCTION_NAMES_COMPATIBILITY2.GAMMADIST = "GAMMADIST", FUNCTION_NAMES_COMPATIBILITY2.GAMMAINV = "GAMMAINV", FUNCTION_NAMES_COMPATIBILITY2.HYPGEOMDIST = "HYPGEOMDIST", FUNCTION_NAMES_COMPATIBILITY2.LOGINV = "LOGINV", FUNCTION_NAMES_COMPATIBILITY2.LOGNORMDIST = "LOGNORMDIST", FUNCTION_NAMES_COMPATIBILITY2.MODE = "MODE", FUNCTION_NAMES_COMPATIBILITY2.NEGBINOMDIST = "NEGBINOMDIST", FUNCTION_NAMES_COMPATIBILITY2.NORMDIST = "NORMDIST", FUNCTION_NAMES_COMPATIBILITY2.NORMINV = "NORMINV", FUNCTION_NAMES_COMPATIBILITY2.NORMSDIST = "NORMSDIST", FUNCTION_NAMES_COMPATIBILITY2.NORMSINV = "NORMSINV", FUNCTION_NAMES_COMPATIBILITY2.PERCENTILE = "PERCENTILE", FUNCTION_NAMES_COMPATIBILITY2.PERCENTRANK = "PERCENTRANK", FUNCTION_NAMES_COMPATIBILITY2.POISSON = "POISSON", FUNCTION_NAMES_COMPATIBILITY2.QUARTILE = "QUARTILE", FUNCTION_NAMES_COMPATIBILITY2.RANK = "RANK", FUNCTION_NAMES_COMPATIBILITY2.STDEV = "STDEV", FUNCTION_NAMES_COMPATIBILITY2.STDEVP = "STDEVP", FUNCTION_NAMES_COMPATIBILITY2.TDIST = "TDIST", FUNCTION_NAMES_COMPATIBILITY2.TINV = "TINV", FUNCTION_NAMES_COMPATIBILITY2.TTEST = "TTEST", FUNCTION_NAMES_COMPATIBILITY2.VAR = "VAR", FUNCTION_NAMES_COMPATIBILITY2.VARP = "VARP", FUNCTION_NAMES_COMPATIBILITY2.WEIBULL = "WEIBULL", FUNCTION_NAMES_COMPATIBILITY2.ZTEST = "ZTEST", FUNCTION_NAMES_COMPATIBILITY2))(FUNCTION_NAMES_COMPATIBILITY || {});
5892
7204
  const functionCompatibility = [
7205
+ [Betadist, FUNCTION_NAMES_COMPATIBILITY.BETADIST],
7206
+ [BetaInv, FUNCTION_NAMES_COMPATIBILITY.BETAINV],
7207
+ [BinomDist, FUNCTION_NAMES_COMPATIBILITY.BINOMDIST],
7208
+ [ChisqDistRt, FUNCTION_NAMES_COMPATIBILITY.CHIDIST],
7209
+ [ChisqInvRt, FUNCTION_NAMES_COMPATIBILITY.CHIINV],
7210
+ [ChisqTest, FUNCTION_NAMES_COMPATIBILITY.CHITEST],
7211
+ [ConfidenceNorm, FUNCTION_NAMES_COMPATIBILITY.CONFIDENCE],
7212
+ [CovarianceP, FUNCTION_NAMES_COMPATIBILITY.COVAR],
7213
+ [BinomInv, FUNCTION_NAMES_COMPATIBILITY.CRITBINOM],
7214
+ [ExponDist, FUNCTION_NAMES_COMPATIBILITY.EXPONDIST],
7215
+ [FDistRt, FUNCTION_NAMES_COMPATIBILITY.FDIST],
7216
+ [FInvRt, FUNCTION_NAMES_COMPATIBILITY.FINV],
7217
+ [FTest, FUNCTION_NAMES_COMPATIBILITY.FTEST],
7218
+ [NormDist, FUNCTION_NAMES_COMPATIBILITY.NORMDIST],
7219
+ [NormInv, FUNCTION_NAMES_COMPATIBILITY.NORMINV],
7220
+ [Normsdist, FUNCTION_NAMES_COMPATIBILITY.NORMSDIST],
7221
+ [NormSInv, FUNCTION_NAMES_COMPATIBILITY.NORMSINV],
5893
7222
  [Rank, FUNCTION_NAMES_COMPATIBILITY.RANK],
5894
7223
  [StdevS, FUNCTION_NAMES_COMPATIBILITY.STDEV],
5895
7224
  [StdevP, FUNCTION_NAMES_COMPATIBILITY.STDEVP],
@@ -6999,460 +8328,181 @@ const _Workday = class _Workday extends BaseFunction {
6999
8328
  const holidaySerialNumber = getDateSerialNumberByObject(holidays);
7000
8329
  if (typeof holidaySerialNumber != "number")
7001
8330
  return holidaySerialNumber;
7002
- holidaysValueArray.push(holidaySerialNumber);
7003
- }
7004
- const result = getDateSerialNumberByWorkingDays(startDateSerialNumber, workingDays, 1, holidaysValueArray);
7005
- return typeof result != "number" ? result : NumberValueObject.create(result);
7006
- }
7007
- };
7008
- __name(_Workday, "Workday");
7009
- let Workday = _Workday;
7010
- const _WorkdayIntl = class _WorkdayIntl extends BaseFunction {
7011
- constructor() {
7012
- super(...arguments);
7013
- __publicField(this, "minParams", 2);
7014
- __publicField(this, "maxParams", 4);
7015
- }
7016
- calculate(startDate, days, weekend, holidays) {
7017
- return startDate.isError() ? startDate : days.isError() ? days : weekend != null && weekend.isError() ? weekend : holidays != null && holidays.isError() ? holidays : weekend != null && weekend.isArray() ? weekend.map((weekendItem) => this._handleSingleObject(startDate, days, weekendItem, holidays)) : this._handleSingleObject(startDate, days, weekend, holidays);
7018
- }
7019
- _handleSingleObject(startDate, days, weekend, holidays) {
7020
- const _weekend = weekend != null ? weekend : NumberValueObject.create(1), _startDate = this._checkArrayError(startDate);
7021
- if (_startDate.isError())
7022
- return _startDate;
7023
- const _days = this._checkArrayError(days);
7024
- if (_days.isError())
7025
- return _days;
7026
- if (_startDate.isBoolean() || _days.isBoolean())
7027
- return ErrorValueObject.create(ErrorType$1.VALUE);
7028
- const startDateSerialNumber = getDateSerialNumberByObject(startDate);
7029
- if (typeof startDateSerialNumber != "number")
7030
- return startDateSerialNumber;
7031
- const workingDays = +days.getValue();
7032
- if (Number.isNaN(workingDays))
7033
- return ErrorValueObject.create(ErrorType$1.VALUE);
7034
- let weekendValue = _weekend.getValue();
7035
- if (_weekend.isBoolean() && (weekendValue = +weekendValue), _weekend.isString() && (!isValidWeekend(weekendValue) || weekendValue === "1111111"))
7036
- return ErrorValueObject.create(ErrorType$1.VALUE);
7037
- if (!isValidWeekend(weekendValue))
7038
- return ErrorValueObject.create(ErrorType$1.NUM);
7039
- if (holidays)
7040
- return this._getResultByHolidays(startDateSerialNumber, workingDays, weekendValue, holidays);
7041
- const result = getDateSerialNumberByWorkingDays(startDateSerialNumber, workingDays, weekendValue);
7042
- return typeof result != "number" ? result : NumberValueObject.create(result);
7043
- }
7044
- _checkArrayError(variant) {
7045
- let _variant = variant;
7046
- if (_variant.isArray()) {
7047
- const rowCount = _variant.getRowCount(), columnCount = _variant.getColumnCount();
7048
- if (rowCount > 1 || columnCount > 1)
7049
- return ErrorValueObject.create(ErrorType$1.VALUE);
7050
- _variant = _variant.get(0, 0);
7051
- }
7052
- return _variant.isError(), _variant;
7053
- }
7054
- _getResultByHolidays(startDateSerialNumber, workingDays, weekendValue, holidays) {
7055
- const holidaysValueArray = [];
7056
- if (holidays != null && holidays.isArray()) {
7057
- const rowCount = holidays.getRowCount(), columnCount = holidays.getColumnCount();
7058
- for (let r = 0; r < rowCount; r++)
7059
- for (let c = 0; c < columnCount; c++) {
7060
- const cell = holidays.get(r, c);
7061
- if (cell.isBoolean())
7062
- return ErrorValueObject.create(ErrorType$1.VALUE);
7063
- const holidaySerialNumber = getDateSerialNumberByObject(cell);
7064
- if (typeof holidaySerialNumber != "number")
7065
- return holidaySerialNumber;
7066
- holidaysValueArray.push(holidaySerialNumber);
7067
- }
7068
- } else {
7069
- if (holidays.isBoolean())
7070
- return ErrorValueObject.create(ErrorType$1.VALUE);
7071
- const holidaySerialNumber = getDateSerialNumberByObject(holidays);
7072
- if (typeof holidaySerialNumber != "number")
7073
- return holidaySerialNumber;
7074
- holidaysValueArray.push(holidaySerialNumber);
7075
- }
7076
- const result = getDateSerialNumberByWorkingDays(startDateSerialNumber, workingDays, weekendValue, holidaysValueArray);
7077
- return typeof result != "number" ? result : NumberValueObject.create(result);
7078
- }
7079
- };
7080
- __name(_WorkdayIntl, "WorkdayIntl");
7081
- let WorkdayIntl = _WorkdayIntl;
7082
- const _Year = class _Year extends BaseFunction {
7083
- constructor() {
7084
- super(...arguments);
7085
- __publicField(this, "minParams", 1);
7086
- __publicField(this, "maxParams", 1);
7087
- }
7088
- calculate(serialNumber) {
7089
- return serialNumber.isArray() ? serialNumber.map((serialNumberObject) => this._handleSingleObject(serialNumberObject)) : this._handleSingleObject(serialNumber);
7090
- }
7091
- _handleSingleObject(serialNumberObject) {
7092
- if (serialNumberObject.isError())
7093
- return serialNumberObject;
7094
- let date;
7095
- const dateValue = serialNumberObject.getValue();
7096
- if (serialNumberObject.isString()) {
7097
- if (!isValidDateStr(`${dateValue}`))
7098
- return ErrorValueObject.create(ErrorType$1.VALUE);
7099
- date = /* @__PURE__ */ new Date(`${dateValue}`);
7100
- } else {
7101
- const dateSerial = +dateValue;
7102
- if (dateSerial < 0)
7103
- return ErrorValueObject.create(ErrorType$1.NUM);
7104
- if (dateSerial === 0)
7105
- return NumberValueObject.create(1900);
7106
- date = excelSerialToDate(dateSerial);
7107
- }
7108
- const year = date.getUTCFullYear();
7109
- return NumberValueObject.create(year);
7110
- }
7111
- };
7112
- __name(_Year, "Year");
7113
- let Year = _Year;
7114
- function checkVariantErrorIsArray(variant) {
7115
- let _variant = variant;
7116
- if (variant.isArray()) {
7117
- const rowCount = variant.getRowCount(), columnCount = variant.getColumnCount();
7118
- if (rowCount > 1 || columnCount > 1)
7119
- return ErrorValueObject.create(ErrorType$1.VALUE);
7120
- _variant = variant.get(0, 0);
7121
- }
7122
- return _variant.isError(), _variant;
7123
- }
7124
- __name(checkVariantErrorIsArray, "checkVariantErrorIsArray");
7125
- function checkVariantsErrorIsArrayOrBoolean(...variants) {
7126
- for (let i = 0; i < variants.length; i++) {
7127
- const variant = checkVariantErrorIsArray(variants[i]);
7128
- if (variant.isError())
7129
- return {
7130
- isError: !0,
7131
- errorObject: variant
7132
- };
7133
- if (variant.isBoolean())
7134
- return {
7135
- isError: !0,
7136
- errorObject: ErrorValueObject.create(ErrorType$1.VALUE)
7137
- };
7138
- variants[i] = variant;
7139
- }
7140
- return {
7141
- isError: !1,
7142
- variants
7143
- };
7144
- }
7145
- __name(checkVariantsErrorIsArrayOrBoolean, "checkVariantsErrorIsArrayOrBoolean");
7146
- function checkVariantsErrorIsNullorArrayOrBoolean(...variants) {
7147
- for (let i = 0; i < variants.length; i++) {
7148
- let variant = variants[i];
7149
- if (variant.isError())
7150
- return {
7151
- isError: !0,
7152
- errorObject: variant
7153
- };
7154
- if (variant.isNull())
7155
- return {
7156
- isError: !0,
7157
- errorObject: ErrorValueObject.create(ErrorType$1.NA)
7158
- };
7159
- if (variant = checkVariantErrorIsArray(variants[i]), variant.isError())
7160
- return {
7161
- isError: !0,
7162
- errorObject: variant
7163
- };
7164
- if (variant.isBoolean())
7165
- return {
7166
- isError: !0,
7167
- errorObject: ErrorValueObject.create(ErrorType$1.VALUE)
7168
- };
7169
- variants[i] = variant;
7170
- }
7171
- return {
7172
- isError: !1,
7173
- variants
7174
- };
7175
- }
7176
- __name(checkVariantsErrorIsNullorArrayOrBoolean, "checkVariantsErrorIsNullorArrayOrBoolean");
7177
- function checkVariantsErrorIsStringToNumber(...variants) {
7178
- for (let i = 0; i < variants.length; i++) {
7179
- let variant = variants[i];
7180
- if (variant.isString() && (variant = variant.convertToNumberObjectValue()), variant.isError())
7181
- return {
7182
- isError: !0,
7183
- errorObject: variant
7184
- };
7185
- variants[i] = variant;
7186
- }
7187
- return {
7188
- isError: !1,
7189
- variants
7190
- };
7191
- }
7192
- __name(checkVariantsErrorIsStringToNumber, "checkVariantsErrorIsStringToNumber");
7193
- const _Yearfrac = class _Yearfrac extends BaseFunction {
8331
+ holidaysValueArray.push(holidaySerialNumber);
8332
+ }
8333
+ const result = getDateSerialNumberByWorkingDays(startDateSerialNumber, workingDays, 1, holidaysValueArray);
8334
+ return typeof result != "number" ? result : NumberValueObject.create(result);
8335
+ }
8336
+ };
8337
+ __name(_Workday, "Workday");
8338
+ let Workday = _Workday;
8339
+ const _WorkdayIntl = class _WorkdayIntl extends BaseFunction {
7194
8340
  constructor() {
7195
8341
  super(...arguments);
7196
8342
  __publicField(this, "minParams", 2);
7197
- __publicField(this, "maxParams", 3);
8343
+ __publicField(this, "maxParams", 4);
7198
8344
  }
7199
- calculate(startDate, endDate, basis) {
7200
- let _basis = basis != null ? basis : NumberValueObject.create(0);
7201
- const _startDate = checkVariantErrorIsArray(startDate);
8345
+ calculate(startDate, days, weekend, holidays) {
8346
+ return startDate.isError() ? startDate : days.isError() ? days : weekend != null && weekend.isError() ? weekend : holidays != null && holidays.isError() ? holidays : weekend != null && weekend.isArray() ? weekend.map((weekendItem) => this._handleSingleObject(startDate, days, weekendItem, holidays)) : this._handleSingleObject(startDate, days, weekend, holidays);
8347
+ }
8348
+ _handleSingleObject(startDate, days, weekend, holidays) {
8349
+ const _weekend = weekend != null ? weekend : NumberValueObject.create(1), _startDate = this._checkArrayError(startDate);
7202
8350
  if (_startDate.isError())
7203
8351
  return _startDate;
7204
- const _endDate = checkVariantErrorIsArray(endDate);
7205
- if (_endDate.isError())
7206
- return _endDate;
7207
- if (_basis = checkVariantErrorIsArray(_basis), _basis.isError())
7208
- return _basis;
7209
- if (_startDate.isBoolean() || _endDate.isBoolean() || _basis.isBoolean())
8352
+ const _days = this._checkArrayError(days);
8353
+ if (_days.isError())
8354
+ return _days;
8355
+ if (_startDate.isBoolean() || _days.isBoolean())
7210
8356
  return ErrorValueObject.create(ErrorType$1.VALUE);
7211
- const startDateSerialNumber = getDateSerialNumberByObject(_startDate);
8357
+ const startDateSerialNumber = getDateSerialNumberByObject(startDate);
7212
8358
  if (typeof startDateSerialNumber != "number")
7213
8359
  return startDateSerialNumber;
7214
- const endDateSerialNumber = getDateSerialNumberByObject(_endDate);
7215
- if (typeof endDateSerialNumber != "number")
7216
- return endDateSerialNumber;
7217
- const basisValue = Math.floor(+_basis.getValue());
7218
- if (Number.isNaN(basisValue))
8360
+ const workingDays = +days.getValue();
8361
+ if (Number.isNaN(workingDays))
7219
8362
  return ErrorValueObject.create(ErrorType$1.VALUE);
7220
- if (basisValue < 0 || basisValue > 4)
8363
+ let weekendValue = _weekend.getValue();
8364
+ if (_weekend.isBoolean() && (weekendValue = +weekendValue), _weekend.isString() && (!isValidWeekend(weekendValue) || weekendValue === "1111111"))
8365
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8366
+ if (!isValidWeekend(weekendValue))
7221
8367
  return ErrorValueObject.create(ErrorType$1.NUM);
7222
- const { days, yearDays } = getTwoDateDaysByBasis(startDateSerialNumber, endDateSerialNumber, basisValue), result = days / yearDays;
7223
- return NumberValueObject.create(result);
7224
- }
7225
- };
7226
- __name(_Yearfrac, "Yearfrac");
7227
- let Yearfrac = _Yearfrac;
7228
- const functionDate = [
7229
- [DateFunction, FUNCTION_NAMES_DATE.DATE],
7230
- [Datedif, FUNCTION_NAMES_DATE.DATEDIF],
7231
- [Datevalue, FUNCTION_NAMES_DATE.DATEVALUE],
7232
- [Day, FUNCTION_NAMES_DATE.DAY],
7233
- [Days, FUNCTION_NAMES_DATE.DAYS],
7234
- [Days360, FUNCTION_NAMES_DATE.DAYS360],
7235
- [Edate, FUNCTION_NAMES_DATE.EDATE],
7236
- [Eomonth, FUNCTION_NAMES_DATE.EOMONTH],
7237
- [Hour, FUNCTION_NAMES_DATE.HOUR],
7238
- [Isoweeknum, FUNCTION_NAMES_DATE.ISOWEEKNUM],
7239
- [Minute, FUNCTION_NAMES_DATE.MINUTE],
7240
- [Month, FUNCTION_NAMES_DATE.MONTH],
7241
- [Networkdays, FUNCTION_NAMES_DATE.NETWORKDAYS],
7242
- [NetworkdaysIntl, FUNCTION_NAMES_DATE.NETWORKDAYS_INTL],
7243
- [Now, FUNCTION_NAMES_DATE.NOW],
7244
- [Second, FUNCTION_NAMES_DATE.SECOND],
7245
- [Time, FUNCTION_NAMES_DATE.TIME],
7246
- [Timevalue, FUNCTION_NAMES_DATE.TIMEVALUE],
7247
- [Today, FUNCTION_NAMES_DATE.TODAY],
7248
- [Weekday, FUNCTION_NAMES_DATE.WEEKDAY],
7249
- [Weeknum, FUNCTION_NAMES_DATE.WEEKNUM],
7250
- [Workday, FUNCTION_NAMES_DATE.WORKDAY],
7251
- [WorkdayIntl, FUNCTION_NAMES_DATE.WORKDAY_INTL],
7252
- [Year, FUNCTION_NAMES_DATE.YEAR],
7253
- [Yearfrac, FUNCTION_NAMES_DATE.YEARFRAC]
7254
- ];
7255
- var FUNCTION_NAMES_ENGINEERING = /* @__PURE__ */ ((FUNCTION_NAMES_ENGINEERING2) => (FUNCTION_NAMES_ENGINEERING2.BESSELI = "BESSELI", FUNCTION_NAMES_ENGINEERING2.BESSELJ = "BESSELJ", FUNCTION_NAMES_ENGINEERING2.BESSELK = "BESSELK", FUNCTION_NAMES_ENGINEERING2.BESSELY = "BESSELY", FUNCTION_NAMES_ENGINEERING2.BIN2DEC = "BIN2DEC", FUNCTION_NAMES_ENGINEERING2.BIN2HEX = "BIN2HEX", FUNCTION_NAMES_ENGINEERING2.BIN2OCT = "BIN2OCT", FUNCTION_NAMES_ENGINEERING2.BITAND = "BITAND", FUNCTION_NAMES_ENGINEERING2.BITLSHIFT = "BITLSHIFT", FUNCTION_NAMES_ENGINEERING2.BITOR = "BITOR", FUNCTION_NAMES_ENGINEERING2.BITRSHIFT = "BITRSHIFT", FUNCTION_NAMES_ENGINEERING2.BITXOR = "BITXOR", FUNCTION_NAMES_ENGINEERING2.COMPLEX = "COMPLEX", FUNCTION_NAMES_ENGINEERING2.CONVERT = "CONVERT", FUNCTION_NAMES_ENGINEERING2.DEC2BIN = "DEC2BIN", FUNCTION_NAMES_ENGINEERING2.DEC2HEX = "DEC2HEX", FUNCTION_NAMES_ENGINEERING2.DEC2OCT = "DEC2OCT", FUNCTION_NAMES_ENGINEERING2.DELTA = "DELTA", FUNCTION_NAMES_ENGINEERING2.ERF = "ERF", FUNCTION_NAMES_ENGINEERING2.ERF_PRECISE = "ERF.PRECISE", FUNCTION_NAMES_ENGINEERING2.ERFC = "ERFC", FUNCTION_NAMES_ENGINEERING2.ERFC_PRECISE = "ERFC.PRECISE", FUNCTION_NAMES_ENGINEERING2.GESTEP = "GESTEP", FUNCTION_NAMES_ENGINEERING2.HEX2BIN = "HEX2BIN", FUNCTION_NAMES_ENGINEERING2.HEX2DEC = "HEX2DEC", FUNCTION_NAMES_ENGINEERING2.HEX2OCT = "HEX2OCT", FUNCTION_NAMES_ENGINEERING2.IMABS = "IMABS", FUNCTION_NAMES_ENGINEERING2.IMAGINARY = "IMAGINARY", FUNCTION_NAMES_ENGINEERING2.IMARGUMENT = "IMARGUMENT", FUNCTION_NAMES_ENGINEERING2.IMCONJUGATE = "IMCONJUGATE", FUNCTION_NAMES_ENGINEERING2.IMCOS = "IMCOS", FUNCTION_NAMES_ENGINEERING2.IMCOSH = "IMCOSH", FUNCTION_NAMES_ENGINEERING2.IMCOT = "IMCOT", FUNCTION_NAMES_ENGINEERING2.IMCSC = "IMCSC", FUNCTION_NAMES_ENGINEERING2.IMCSCH = "IMCSCH", FUNCTION_NAMES_ENGINEERING2.IMDIV = "IMDIV", FUNCTION_NAMES_ENGINEERING2.IMEXP = "IMEXP", FUNCTION_NAMES_ENGINEERING2.IMLN = "IMLN", FUNCTION_NAMES_ENGINEERING2.IMLOG10 = "IMLOG10", FUNCTION_NAMES_ENGINEERING2.IMLOG2 = "IMLOG2", FUNCTION_NAMES_ENGINEERING2.IMPOWER = "IMPOWER", FUNCTION_NAMES_ENGINEERING2.IMPRODUCT = "IMPRODUCT", FUNCTION_NAMES_ENGINEERING2.IMREAL = "IMREAL", FUNCTION_NAMES_ENGINEERING2.IMSEC = "IMSEC", FUNCTION_NAMES_ENGINEERING2.IMSECH = "IMSECH", FUNCTION_NAMES_ENGINEERING2.IMSIN = "IMSIN", FUNCTION_NAMES_ENGINEERING2.IMSINH = "IMSINH", FUNCTION_NAMES_ENGINEERING2.IMSQRT = "IMSQRT", FUNCTION_NAMES_ENGINEERING2.IMSUB = "IMSUB", FUNCTION_NAMES_ENGINEERING2.IMSUM = "IMSUM", FUNCTION_NAMES_ENGINEERING2.IMTAN = "IMTAN", FUNCTION_NAMES_ENGINEERING2.OCT2BIN = "OCT2BIN", FUNCTION_NAMES_ENGINEERING2.OCT2DEC = "OCT2DEC", FUNCTION_NAMES_ENGINEERING2.OCT2HEX = "OCT2HEX", FUNCTION_NAMES_ENGINEERING2))(FUNCTION_NAMES_ENGINEERING || {}), BESSEL;
7256
- ((BESSEL2) => {
7257
- const W = 0.636619772;
7258
- function _horner(arr, v) {
7259
- let z = 0;
7260
- for (let i = 0; i < arr.length; ++i)
7261
- z = v * z + arr[i];
7262
- return z;
7263
- }
7264
- __name(_horner, "_horner");
7265
- function _bessel_iter(x, n, f0, f1, sign2) {
7266
- if (n === 0)
7267
- return f0;
7268
- if (n === 1)
7269
- return f1;
7270
- const tdx = 2 / x;
7271
- let _f0 = f0, _f1 = f1, f2 = f1;
7272
- for (let o = 1; o < n; ++o)
7273
- f2 = _f1 * o * tdx + sign2 * _f0, _f0 = _f1, _f1 = f2;
7274
- return f2;
7275
- }
7276
- __name(_bessel_iter, "_bessel_iter");
7277
- function _bessel_wrap(bessel0, bessel1, nonzero, sign2) {
7278
- return /* @__PURE__ */ __name(function(x, n) {
7279
- if (nonzero) {
7280
- if (x === 0)
7281
- return nonzero === 1 ? -1 / 0 : 1 / 0;
7282
- if (x < 0)
7283
- return Number.NaN;
7284
- }
7285
- if (n === 0)
7286
- return bessel0(x);
7287
- if (n === 1)
7288
- return bessel1(x);
7289
- if (n < 0)
7290
- return Number.NaN;
7291
- const _n = n | 0, b0 = bessel0(x), b1 = bessel1(x);
7292
- return _bessel_iter(x, _n, b0, b1, sign2);
7293
- }, "bessel");
8368
+ if (holidays)
8369
+ return this._getResultByHolidays(startDateSerialNumber, workingDays, weekendValue, holidays);
8370
+ const result = getDateSerialNumberByWorkingDays(startDateSerialNumber, workingDays, weekendValue);
8371
+ return typeof result != "number" ? result : NumberValueObject.create(result);
7294
8372
  }
7295
- __name(_bessel_wrap, "_bessel_wrap"), BESSEL2.besselj = /* @__PURE__ */ (() => {
7296
- const b0_a1a = [-184.9052456, 77392.33017, -1121442418e-2, 6516196407e-1, -13362590354, 57568490574], b0_a2a = [1, 267.8532712, 59272.64853, 9494680718e-3, 1029532985, 57568490411], b0_a1b = [2093887211e-16, -2073370639e-15, 2734510407e-14, -0.001098628627, 1], b0_a2b = [-934935152e-16, 7621095161e-16, -6911147651e-15, 1430488765e-13, -0.01562499995];
7297
- function bessel0(x) {
7298
- let a = 0, a1 = 0, a2 = 0, y = x * x;
7299
- if (x < 8)
7300
- a1 = _horner(b0_a1a, y), a2 = _horner(b0_a2a, y), a = a1 / a2;
7301
- else {
7302
- const xx = x - 0.785398164;
7303
- y = 64 / y, a1 = _horner(b0_a1b, y), a2 = _horner(b0_a2b, y), a = Math.sqrt(W / x) * (Math.cos(xx) * a1 - Math.sin(xx) * a2 * 8 / x);
7304
- }
7305
- return a;
7306
- }
7307
- __name(bessel0, "bessel0");
7308
- const b1_a1a = [-30.16036606, 15704.4826, -2972611439e-3, 2423968531e-1, -7895059235, 72362614232], b1_a2a = [1, 376.9991397, 99447.43394, 1858330474e-2, 2300535178, 144725228442], b1_a1b = [-240337019e-15, 2457520174e-15, -3516396496e-14, 183105e-8, 1], b1_a2b = [105787412e-15, -88228987e-14, 8449199096e-15, -2002690873e-13, 0.04687499995];
7309
- function bessel1(x) {
7310
- let a = 0, a1 = 0, a2 = 0, y = x * x;
7311
- const xx = Math.abs(x) - 2.356194491;
7312
- return Math.abs(x) < 8 ? (a1 = x * _horner(b1_a1a, y), a2 = _horner(b1_a2a, y), a = a1 / a2) : (y = 64 / y, a1 = _horner(b1_a1b, y), a2 = _horner(b1_a2b, y), a = Math.sqrt(W / Math.abs(x)) * (Math.cos(xx) * a1 - Math.sin(xx) * a2 * 8 / Math.abs(x)), x < 0 && (a = -a)), a;
7313
- }
7314
- return __name(bessel1, "bessel1"), /* @__PURE__ */ __name(function besselj2(x, n) {
7315
- const _n = Math.round(n);
7316
- if (!Number.isFinite(x))
7317
- return Number.isNaN(x) ? x : 0;
7318
- if (_n < 0)
7319
- return (_n % 2 ? -1 : 1) * besselj2(x, -_n);
7320
- if (x < 0)
7321
- return (_n % 2 ? -1 : 1) * besselj2(-x, _n);
7322
- if (_n === 0)
7323
- return bessel0(x);
7324
- if (_n === 1)
7325
- return bessel1(x);
7326
- if (x === 0)
7327
- return 0;
7328
- let ret = 0;
7329
- if (x > _n)
7330
- ret = _bessel_iter(x, _n, bessel0(x), bessel1(x), -1);
7331
- else {
7332
- const m = 2 * Math.floor((_n + Math.floor(Math.sqrt(40 * _n))) / 2);
7333
- let jsum = !1, bjp = 0, sum2 = 0, bj = 1, bjm = 0;
7334
- const tox = 2 / x;
7335
- for (let j = m; j > 0; j--)
7336
- if (bjm = j * tox * bj - bjp, bjp = bj, bj = bjm, Math.abs(bj) > 1e10 && (bj *= 1e-10, bjp *= 1e-10, ret *= 1e-10, sum2 *= 1e-10), jsum && (sum2 += bj), jsum = !jsum, j === _n && (ret = bjp), m - j > 100 && ret === 0)
7337
- return Number.NaN;
7338
- sum2 = 2 * sum2 - bj, ret /= sum2;
7339
- }
7340
- return ret;
7341
- }, "besselj2");
7342
- })(), BESSEL2.bessely = (() => {
7343
- const b0_a1a = [228.4622733, -86327.92757, 1087988129e-2, -5123598036e-1, 7062834065, -2957821389], b0_a2a = [1, 226.1030244, 47447.2647, 7189466438e-3, 7452499648e-1, 40076544269], b0_a1b = [2093887211e-16, -2073370639e-15, 2734510407e-14, -0.001098628627, 1], b0_a2b = [-934945152e-16, 7621095161e-16, -6911147651e-15, 1430488765e-13, -0.01562499995];
7344
- function bessel0(x) {
7345
- let a = 0, a1 = 0, a2 = 0, y = x * x;
7346
- const xx = x - 0.785398164;
7347
- return x < 8 ? (a1 = _horner(b0_a1a, y), a2 = _horner(b0_a2a, y), a = a1 / a2 + W * (0, BESSEL2.besselj)(x, 0) * Math.log(x)) : (y = 64 / y, a1 = _horner(b0_a1b, y), a2 = _horner(b0_a2b, y), a = Math.sqrt(W / x) * (Math.sin(xx) * a1 + Math.cos(xx) * a2 * 8 / x)), a;
7348
- }
7349
- __name(bessel0, "bessel0");
7350
- const b1_a1a = [8511.937935, -4237922726e-3, 7349264551e-1, -51534381390, 127527439e4, -4900604943e3], b1_a2a = [1, 354.9632885, 102042.605, 2245904002e-2, 3733650367, 424441966400, 249958057e5], b1_a1b = [-240337019e-15, 2457520174e-15, -3516396496e-14, 183105e-8, 1], b1_a2b = [105787412e-15, -88228987e-14, 8449199096e-15, -2002690873e-13, 0.04687499995];
7351
- function bessel1(x) {
7352
- let a = 0, a1 = 0, a2 = 0, y = x * x;
7353
- const xx = x - 2.356194491;
7354
- return x < 8 ? (a1 = x * _horner(b1_a1a, y), a2 = _horner(b1_a2a, y), a = a1 / a2 + W * ((0, BESSEL2.besselj)(x, 1) * Math.log(x) - 1 / x)) : (y = 64 / y, a1 = _horner(b1_a1b, y), a2 = _horner(b1_a2b, y), a = Math.sqrt(W / x) * (Math.sin(xx) * a1 + Math.cos(xx) * a2 * 8 / x)), a;
7355
- }
7356
- return __name(bessel1, "bessel1"), _bessel_wrap(bessel0, bessel1, 1, -1);
7357
- })(), BESSEL2.besseli = /* @__PURE__ */ (() => {
7358
- const b0_a = [45813e-7, 0.0360768, 0.2659732, 1.2067492, 3.0899424, 3.5156229, 1], b0_b = [392377e-8, -0.01647633, 0.02635537, -0.02057706, 916281e-8, -157565e-8, 225319e-8, 0.01328592, 0.39894228];
7359
- function bessel0(x) {
7360
- return x <= 3.75 ? _horner(b0_a, x * x / (3.75 * 3.75)) : Math.exp(Math.abs(x)) / Math.sqrt(Math.abs(x)) * _horner(b0_b, 3.75 / Math.abs(x));
7361
- }
7362
- __name(bessel0, "bessel0");
7363
- const b1_a = [32411e-8, 301532e-8, 0.02658733, 0.15084934, 0.51498869, 0.87890594, 0.5], b1_b = [-420059e-8, 0.01787654, -0.02895312, 0.02282967, -0.01031555, 163801e-8, -362018e-8, -0.03988024, 0.39894228];
7364
- function bessel1(x) {
7365
- return x < 3.75 ? x * _horner(b1_a, x * x / (3.75 * 3.75)) : (x < 0 ? -1 : 1) * Math.exp(Math.abs(x)) / Math.sqrt(Math.abs(x)) * _horner(b1_b, 3.75 / Math.abs(x));
8373
+ _checkArrayError(variant) {
8374
+ let _variant = variant;
8375
+ if (_variant.isArray()) {
8376
+ const rowCount = _variant.getRowCount(), columnCount = _variant.getColumnCount();
8377
+ if (rowCount > 1 || columnCount > 1)
8378
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8379
+ _variant = _variant.get(0, 0);
7366
8380
  }
7367
- return __name(bessel1, "bessel1"), /* @__PURE__ */ __name(function besseli2(x, n) {
7368
- const _n = Math.round(n);
7369
- if (_n === 0)
7370
- return bessel0(x);
7371
- if (_n === 1)
7372
- return bessel1(x);
7373
- if (_n < 0)
7374
- return Number.NaN;
7375
- if (Math.abs(x) === 0)
7376
- return 0;
7377
- if (x === 1 / 0)
7378
- return 1 / 0;
7379
- let ret = 0, j;
7380
- const tox = 2 / Math.abs(x);
7381
- let bip = 0, bi = 1, bim = 0;
7382
- const m = 2 * Math.round((_n + Math.round(Math.sqrt(40 * _n))) / 2);
7383
- for (j = m; j > 0; j--)
7384
- if (bim = j * tox * bi + bip, bip = bi, bi = bim, Math.abs(bi) > 1e10 && (bi *= 1e-10, bip *= 1e-10, ret *= 1e-10), j === _n && (ret = bip), m - j > 100 && ret === 0)
7385
- return Number.NaN;
7386
- return ret *= besseli2(x, 0) / bi, x < 0 && _n % 2 ? -ret : ret;
7387
- }, "besseli2");
7388
- })(), BESSEL2.besselk = (() => {
7389
- const b0_a = [74e-7, 1075e-7, 262698e-8, 0.0348859, 0.23069756, 0.4227842, -0.57721566], b0_b = [53208e-8, -25154e-7, 587872e-8, -0.01062446, 0.02189568, -0.07832358, 1.25331414];
7390
- function bessel0(x) {
7391
- return x <= 2 ? -Math.log(x / 2) * (0, BESSEL2.besseli)(x, 0) + _horner(b0_a, x * x / 4) : Math.exp(-x) / Math.sqrt(x) * _horner(b0_b, 2 / x);
8381
+ return _variant.isError(), _variant;
8382
+ }
8383
+ _getResultByHolidays(startDateSerialNumber, workingDays, weekendValue, holidays) {
8384
+ const holidaysValueArray = [];
8385
+ if (holidays != null && holidays.isArray()) {
8386
+ const rowCount = holidays.getRowCount(), columnCount = holidays.getColumnCount();
8387
+ for (let r = 0; r < rowCount; r++)
8388
+ for (let c = 0; c < columnCount; c++) {
8389
+ const cell = holidays.get(r, c);
8390
+ if (cell.isBoolean())
8391
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8392
+ const holidaySerialNumber = getDateSerialNumberByObject(cell);
8393
+ if (typeof holidaySerialNumber != "number")
8394
+ return holidaySerialNumber;
8395
+ holidaysValueArray.push(holidaySerialNumber);
8396
+ }
8397
+ } else {
8398
+ if (holidays.isBoolean())
8399
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8400
+ const holidaySerialNumber = getDateSerialNumberByObject(holidays);
8401
+ if (typeof holidaySerialNumber != "number")
8402
+ return holidaySerialNumber;
8403
+ holidaysValueArray.push(holidaySerialNumber);
7392
8404
  }
7393
- __name(bessel0, "bessel0");
7394
- const b1_a = [-4686e-8, -110404e-8, -0.01919402, -0.18156897, -0.67278579, 0.15443144, 1], b1_b = [-68245e-8, 325614e-8, -780353e-8, 0.01504268, -0.0365562, 0.23498619, 1.25331414];
7395
- function bessel1(x) {
7396
- return x <= 2 ? Math.log(x / 2) * (0, BESSEL2.besseli)(x, 1) + 1 / x * _horner(b1_a, x * x / 4) : Math.exp(-x) / Math.sqrt(x) * _horner(b1_b, 2 / x);
8405
+ const result = getDateSerialNumberByWorkingDays(startDateSerialNumber, workingDays, weekendValue, holidaysValueArray);
8406
+ return typeof result != "number" ? result : NumberValueObject.create(result);
8407
+ }
8408
+ };
8409
+ __name(_WorkdayIntl, "WorkdayIntl");
8410
+ let WorkdayIntl = _WorkdayIntl;
8411
+ const _Year = class _Year extends BaseFunction {
8412
+ constructor() {
8413
+ super(...arguments);
8414
+ __publicField(this, "minParams", 1);
8415
+ __publicField(this, "maxParams", 1);
8416
+ }
8417
+ calculate(serialNumber) {
8418
+ return serialNumber.isArray() ? serialNumber.map((serialNumberObject) => this._handleSingleObject(serialNumberObject)) : this._handleSingleObject(serialNumber);
8419
+ }
8420
+ _handleSingleObject(serialNumberObject) {
8421
+ if (serialNumberObject.isError())
8422
+ return serialNumberObject;
8423
+ let date;
8424
+ const dateValue = serialNumberObject.getValue();
8425
+ if (serialNumberObject.isString()) {
8426
+ if (!isValidDateStr(`${dateValue}`))
8427
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8428
+ date = /* @__PURE__ */ new Date(`${dateValue}`);
8429
+ } else {
8430
+ const dateSerial = +dateValue;
8431
+ if (dateSerial < 0)
8432
+ return ErrorValueObject.create(ErrorType$1.NUM);
8433
+ if (dateSerial === 0)
8434
+ return NumberValueObject.create(1900);
8435
+ date = excelSerialToDate(dateSerial);
7397
8436
  }
7398
- return __name(bessel1, "bessel1"), _bessel_wrap(bessel0, bessel1, 2, 1);
7399
- })();
7400
- })(BESSEL || (BESSEL = {}));
7401
- function isValidBinaryNumber(number) {
7402
- return /^[01]{1,10}$/.test(number);
7403
- }
7404
- __name(isValidBinaryNumber, "isValidBinaryNumber");
7405
- function isValidOctalNumber(number) {
7406
- return /^[0-7]{1,10}$/.test(number);
7407
- }
7408
- __name(isValidOctalNumber, "isValidOctalNumber");
7409
- function isValidHexadecimalNumber(number) {
7410
- return /^[0-9A-Fa-f]{1,10}$/.test(number);
7411
- }
7412
- __name(isValidHexadecimalNumber, "isValidHexadecimalNumber");
7413
- function erf(x) {
7414
- if (x === 0)
7415
- return 0;
7416
- const cof = [
7417
- -1.3026537197817094,
7418
- 0.6419697923564902,
7419
- 0.019476473204185836,
7420
- -0.00956151478680863,
7421
- -946595344482036e-18,
7422
- 366839497852761e-18,
7423
- 42523324806907e-18,
7424
- -20278578112534e-18,
7425
- -1624290004647e-18,
7426
- 130365583558e-17,
7427
- 15626441722e-18,
7428
- -85238095915e-18,
7429
- 6529054439e-18,
7430
- 5059343495e-18,
7431
- -991364156e-18,
7432
- -227365122e-18,
7433
- 96467911e-18,
7434
- 2394038e-18,
7435
- -6886027e-18,
7436
- 894487e-18,
7437
- 313092e-18,
7438
- -112708e-18,
7439
- 381e-18,
7440
- 7106e-18,
7441
- -1523e-18,
7442
- -94e-18,
7443
- 121e-18,
7444
- -28e-18
7445
- ];
7446
- let _x = x, isNeg = !1;
7447
- _x < 0 && (_x = -_x, isNeg = !0);
7448
- const t = 2 / (2 + _x), ty = 4 * t - 2;
7449
- let d = 0, dd = 0, tmp;
7450
- for (let j = cof.length - 1; j > 0; j--)
7451
- tmp = d, d = ty * d - dd + cof[j], dd = tmp;
7452
- const res = t * Math.exp(-_x * _x + 0.5 * (cof[0] + ty * d) - dd);
7453
- return isNeg ? res - 1 : 1 - res;
7454
- }
7455
- __name(erf, "erf");
8437
+ const year = date.getUTCFullYear();
8438
+ return NumberValueObject.create(year);
8439
+ }
8440
+ };
8441
+ __name(_Year, "Year");
8442
+ let Year = _Year;
8443
+ const _Yearfrac = class _Yearfrac extends BaseFunction {
8444
+ constructor() {
8445
+ super(...arguments);
8446
+ __publicField(this, "minParams", 2);
8447
+ __publicField(this, "maxParams", 3);
8448
+ }
8449
+ calculate(startDate, endDate, basis) {
8450
+ let _basis = basis != null ? basis : NumberValueObject.create(0);
8451
+ const _startDate = checkVariantErrorIsArray(startDate);
8452
+ if (_startDate.isError())
8453
+ return _startDate;
8454
+ const _endDate = checkVariantErrorIsArray(endDate);
8455
+ if (_endDate.isError())
8456
+ return _endDate;
8457
+ if (_basis = checkVariantErrorIsArray(_basis), _basis.isError())
8458
+ return _basis;
8459
+ if (_startDate.isBoolean() || _endDate.isBoolean() || _basis.isBoolean())
8460
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8461
+ const startDateSerialNumber = getDateSerialNumberByObject(_startDate);
8462
+ if (typeof startDateSerialNumber != "number")
8463
+ return startDateSerialNumber;
8464
+ const endDateSerialNumber = getDateSerialNumberByObject(_endDate);
8465
+ if (typeof endDateSerialNumber != "number")
8466
+ return endDateSerialNumber;
8467
+ const basisValue = Math.floor(+_basis.getValue());
8468
+ if (Number.isNaN(basisValue))
8469
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8470
+ if (basisValue < 0 || basisValue > 4)
8471
+ return ErrorValueObject.create(ErrorType$1.NUM);
8472
+ const { days, yearDays } = getTwoDateDaysByBasis(startDateSerialNumber, endDateSerialNumber, basisValue), result = days / yearDays;
8473
+ return NumberValueObject.create(result);
8474
+ }
8475
+ };
8476
+ __name(_Yearfrac, "Yearfrac");
8477
+ let Yearfrac = _Yearfrac;
8478
+ const functionDate = [
8479
+ [DateFunction, FUNCTION_NAMES_DATE.DATE],
8480
+ [Datedif, FUNCTION_NAMES_DATE.DATEDIF],
8481
+ [Datevalue, FUNCTION_NAMES_DATE.DATEVALUE],
8482
+ [Day, FUNCTION_NAMES_DATE.DAY],
8483
+ [Days, FUNCTION_NAMES_DATE.DAYS],
8484
+ [Days360, FUNCTION_NAMES_DATE.DAYS360],
8485
+ [Edate, FUNCTION_NAMES_DATE.EDATE],
8486
+ [Eomonth, FUNCTION_NAMES_DATE.EOMONTH],
8487
+ [Hour, FUNCTION_NAMES_DATE.HOUR],
8488
+ [Isoweeknum, FUNCTION_NAMES_DATE.ISOWEEKNUM],
8489
+ [Minute, FUNCTION_NAMES_DATE.MINUTE],
8490
+ [Month, FUNCTION_NAMES_DATE.MONTH],
8491
+ [Networkdays, FUNCTION_NAMES_DATE.NETWORKDAYS],
8492
+ [NetworkdaysIntl, FUNCTION_NAMES_DATE.NETWORKDAYS_INTL],
8493
+ [Now, FUNCTION_NAMES_DATE.NOW],
8494
+ [Second, FUNCTION_NAMES_DATE.SECOND],
8495
+ [Time, FUNCTION_NAMES_DATE.TIME],
8496
+ [Timevalue, FUNCTION_NAMES_DATE.TIMEVALUE],
8497
+ [Today, FUNCTION_NAMES_DATE.TODAY],
8498
+ [Weekday, FUNCTION_NAMES_DATE.WEEKDAY],
8499
+ [Weeknum, FUNCTION_NAMES_DATE.WEEKNUM],
8500
+ [Workday, FUNCTION_NAMES_DATE.WORKDAY],
8501
+ [WorkdayIntl, FUNCTION_NAMES_DATE.WORKDAY_INTL],
8502
+ [Year, FUNCTION_NAMES_DATE.YEAR],
8503
+ [Yearfrac, FUNCTION_NAMES_DATE.YEARFRAC]
8504
+ ];
8505
+ var FUNCTION_NAMES_ENGINEERING = /* @__PURE__ */ ((FUNCTION_NAMES_ENGINEERING2) => (FUNCTION_NAMES_ENGINEERING2.BESSELI = "BESSELI", FUNCTION_NAMES_ENGINEERING2.BESSELJ = "BESSELJ", FUNCTION_NAMES_ENGINEERING2.BESSELK = "BESSELK", FUNCTION_NAMES_ENGINEERING2.BESSELY = "BESSELY", FUNCTION_NAMES_ENGINEERING2.BIN2DEC = "BIN2DEC", FUNCTION_NAMES_ENGINEERING2.BIN2HEX = "BIN2HEX", FUNCTION_NAMES_ENGINEERING2.BIN2OCT = "BIN2OCT", FUNCTION_NAMES_ENGINEERING2.BITAND = "BITAND", FUNCTION_NAMES_ENGINEERING2.BITLSHIFT = "BITLSHIFT", FUNCTION_NAMES_ENGINEERING2.BITOR = "BITOR", FUNCTION_NAMES_ENGINEERING2.BITRSHIFT = "BITRSHIFT", FUNCTION_NAMES_ENGINEERING2.BITXOR = "BITXOR", FUNCTION_NAMES_ENGINEERING2.COMPLEX = "COMPLEX", FUNCTION_NAMES_ENGINEERING2.CONVERT = "CONVERT", FUNCTION_NAMES_ENGINEERING2.DEC2BIN = "DEC2BIN", FUNCTION_NAMES_ENGINEERING2.DEC2HEX = "DEC2HEX", FUNCTION_NAMES_ENGINEERING2.DEC2OCT = "DEC2OCT", FUNCTION_NAMES_ENGINEERING2.DELTA = "DELTA", FUNCTION_NAMES_ENGINEERING2.ERF = "ERF", FUNCTION_NAMES_ENGINEERING2.ERF_PRECISE = "ERF.PRECISE", FUNCTION_NAMES_ENGINEERING2.ERFC = "ERFC", FUNCTION_NAMES_ENGINEERING2.ERFC_PRECISE = "ERFC.PRECISE", FUNCTION_NAMES_ENGINEERING2.GESTEP = "GESTEP", FUNCTION_NAMES_ENGINEERING2.HEX2BIN = "HEX2BIN", FUNCTION_NAMES_ENGINEERING2.HEX2DEC = "HEX2DEC", FUNCTION_NAMES_ENGINEERING2.HEX2OCT = "HEX2OCT", FUNCTION_NAMES_ENGINEERING2.IMABS = "IMABS", FUNCTION_NAMES_ENGINEERING2.IMAGINARY = "IMAGINARY", FUNCTION_NAMES_ENGINEERING2.IMARGUMENT = "IMARGUMENT", FUNCTION_NAMES_ENGINEERING2.IMCONJUGATE = "IMCONJUGATE", FUNCTION_NAMES_ENGINEERING2.IMCOS = "IMCOS", FUNCTION_NAMES_ENGINEERING2.IMCOSH = "IMCOSH", FUNCTION_NAMES_ENGINEERING2.IMCOT = "IMCOT", FUNCTION_NAMES_ENGINEERING2.IMCSC = "IMCSC", FUNCTION_NAMES_ENGINEERING2.IMCSCH = "IMCSCH", FUNCTION_NAMES_ENGINEERING2.IMDIV = "IMDIV", FUNCTION_NAMES_ENGINEERING2.IMEXP = "IMEXP", FUNCTION_NAMES_ENGINEERING2.IMLN = "IMLN", FUNCTION_NAMES_ENGINEERING2.IMLOG10 = "IMLOG10", FUNCTION_NAMES_ENGINEERING2.IMLOG2 = "IMLOG2", FUNCTION_NAMES_ENGINEERING2.IMPOWER = "IMPOWER", FUNCTION_NAMES_ENGINEERING2.IMPRODUCT = "IMPRODUCT", FUNCTION_NAMES_ENGINEERING2.IMREAL = "IMREAL", FUNCTION_NAMES_ENGINEERING2.IMSEC = "IMSEC", FUNCTION_NAMES_ENGINEERING2.IMSECH = "IMSECH", FUNCTION_NAMES_ENGINEERING2.IMSIN = "IMSIN", FUNCTION_NAMES_ENGINEERING2.IMSINH = "IMSINH", FUNCTION_NAMES_ENGINEERING2.IMSQRT = "IMSQRT", FUNCTION_NAMES_ENGINEERING2.IMSUB = "IMSUB", FUNCTION_NAMES_ENGINEERING2.IMSUM = "IMSUM", FUNCTION_NAMES_ENGINEERING2.IMTAN = "IMTAN", FUNCTION_NAMES_ENGINEERING2.OCT2BIN = "OCT2BIN", FUNCTION_NAMES_ENGINEERING2.OCT2DEC = "OCT2DEC", FUNCTION_NAMES_ENGINEERING2.OCT2HEX = "OCT2HEX", FUNCTION_NAMES_ENGINEERING2))(FUNCTION_NAMES_ENGINEERING || {});
7456
8506
  const _Besseli = class _Besseli extends BaseFunction {
7457
8507
  constructor() {
7458
8508
  super(...arguments);
@@ -8654,7 +9704,7 @@ const _Erfc = class _Erfc extends BaseFunction {
8654
9704
  const [xObject] = variants, xValue = +xObject.getValue();
8655
9705
  if (Number.isNaN(xValue))
8656
9706
  return ErrorValueObject.create(ErrorType$1.VALUE);
8657
- const result = 1 - erf(xValue);
9707
+ const result = erfc(xValue);
8658
9708
  return NumberValueObject.create(result);
8659
9709
  }
8660
9710
  };
@@ -8673,7 +9723,7 @@ const _ErfcPrecise = class _ErfcPrecise extends BaseFunction {
8673
9723
  const [xObject] = variants, xValue = +xObject.getValue();
8674
9724
  if (Number.isNaN(xValue))
8675
9725
  return ErrorValueObject.create(ErrorType$1.VALUE);
8676
- const result = 1 - erf(xValue);
9726
+ const result = erfc(xValue);
8677
9727
  return NumberValueObject.create(result);
8678
9728
  }
8679
9729
  };
@@ -12435,22 +13485,27 @@ const _Bycol = class _Bycol extends BaseFunction {
12435
13485
  super(...arguments);
12436
13486
  __publicField(this, "minParams", 2);
12437
13487
  __publicField(this, "maxParams", 2);
13488
+ __publicField(this, "needsReferenceObject", !0);
12438
13489
  }
13490
+ // eslint-disable-next-line
12439
13491
  calculate(array, lambda) {
12440
- if (array.isError())
12441
- return array;
13492
+ let _array = array, _array_reference = null;
13493
+ if (array.isReferenceObject() && (_array = array.toArrayValueObject(), _array_reference = array), _array.isError())
13494
+ return _array;
12442
13495
  if (lambda.isError())
12443
13496
  return lambda;
12444
13497
  if (!(lambda.isValueObject() && lambda.isLambda() && lambda.getLambdaPrivacyVarKeys().length === 1))
12445
13498
  return ErrorValueObject.create(ErrorType$1.VALUE);
12446
- const _lambda = lambda, rowCount = array.isArray() ? array.getRowCount() : 1, columnCount = array.isArray() ? array.getColumnCount() : 1, _array = expandArrayValueObject(rowCount, columnCount, array), result = [[]];
13499
+ const _lambda = lambda, rowCount = _array.isArray() ? _array.getRowCount() : 1, columnCount = _array.isArray() ? _array.getColumnCount() : 1;
13500
+ _array = expandArrayValueObject(rowCount, columnCount, _array);
13501
+ const result = [[]];
12447
13502
  for (let c = 0; c < columnCount; c++) {
12448
13503
  const rows = [];
12449
13504
  for (let r = 0; r < rowCount; r++) {
12450
13505
  const col = _array.get(r, c);
12451
13506
  rows.push([col]);
12452
13507
  }
12453
- const lambdaVariant = ArrayValueObject.create({
13508
+ let lambdaVariant = ArrayValueObject.create({
12454
13509
  calculateValueList: rows,
12455
13510
  rowCount,
12456
13511
  columnCount: 1,
@@ -12459,6 +13514,15 @@ const _Bycol = class _Bycol extends BaseFunction {
12459
13514
  row: 0,
12460
13515
  column: 0
12461
13516
  });
13517
+ if (_array_reference) {
13518
+ const { startRow, startColumn } = _array_reference.getRangePosition(), range = {
13519
+ startRow,
13520
+ startColumn: startColumn + c,
13521
+ endRow: startRow + rowCount - 1,
13522
+ endColumn: startColumn + c
13523
+ };
13524
+ lambdaVariant = this.createReferenceObject(_array_reference, range);
13525
+ }
12462
13526
  let value = _lambda.execute(lambdaVariant);
12463
13527
  if (value.isArray()) {
12464
13528
  const valueRowCount = value.getRowCount(), valueColumnCount = value.getColumnCount();
@@ -12486,22 +13550,27 @@ const _Byrow = class _Byrow extends BaseFunction {
12486
13550
  super(...arguments);
12487
13551
  __publicField(this, "minParams", 2);
12488
13552
  __publicField(this, "maxParams", 2);
13553
+ __publicField(this, "needsReferenceObject", !0);
12489
13554
  }
13555
+ // eslint-disable-next-line
12490
13556
  calculate(array, lambda) {
12491
- if (array.isError())
12492
- return array;
13557
+ let _array = array, _array_reference = null;
13558
+ if (array.isReferenceObject() && (_array = array.toArrayValueObject(), _array_reference = array), _array.isError())
13559
+ return _array;
12493
13560
  if (lambda.isError())
12494
13561
  return lambda;
12495
13562
  if (!(lambda.isValueObject() && lambda.isLambda() && lambda.getLambdaPrivacyVarKeys().length === 1))
12496
13563
  return ErrorValueObject.create(ErrorType$1.VALUE);
12497
- const _lambda = lambda, rowCount = array.isArray() ? array.getRowCount() : 1, columnCount = array.isArray() ? array.getColumnCount() : 1, _array = expandArrayValueObject(rowCount, columnCount, array), result = [];
13564
+ const _lambda = lambda, rowCount = _array.isArray() ? _array.getRowCount() : 1, columnCount = _array.isArray() ? _array.getColumnCount() : 1;
13565
+ _array = expandArrayValueObject(rowCount, columnCount, _array);
13566
+ const result = [];
12498
13567
  for (let r = 0; r < rowCount; r++) {
12499
13568
  const rows = [[]];
12500
13569
  for (let c = 0; c < columnCount; c++) {
12501
13570
  const col = _array.get(r, c);
12502
13571
  rows[0].push(col);
12503
13572
  }
12504
- const lambdaVariant = ArrayValueObject.create({
13573
+ let lambdaVariant = ArrayValueObject.create({
12505
13574
  calculateValueList: rows,
12506
13575
  rowCount: 1,
12507
13576
  columnCount,
@@ -12510,6 +13579,15 @@ const _Byrow = class _Byrow extends BaseFunction {
12510
13579
  row: 0,
12511
13580
  column: 0
12512
13581
  });
13582
+ if (_array_reference) {
13583
+ const { startRow, startColumn } = _array_reference.getRangePosition(), range = {
13584
+ startRow: startRow + r,
13585
+ startColumn,
13586
+ endRow: startRow + r,
13587
+ endColumn: startColumn + columnCount - 1
13588
+ };
13589
+ lambdaVariant = this.createReferenceObject(_array_reference, range);
13590
+ }
12513
13591
  let value = _lambda.execute(lambdaVariant);
12514
13592
  if (value.isArray()) {
12515
13593
  const valueRowCount = value.getRowCount(), valueColumnCount = value.getColumnCount();
@@ -12744,23 +13822,25 @@ let Map$1 = (_a2 = class extends BaseFunction {
12744
13822
  super(...arguments);
12745
13823
  __publicField(this, "minParams", 2);
12746
13824
  __publicField(this, "maxParams", 255);
13825
+ __publicField(this, "needsReferenceObject", !0);
12747
13826
  }
12748
13827
  calculate(...variants) {
12749
13828
  const _variants = [];
12750
13829
  let lambda = null, maxRowLength = 0, maxColumnLength = 0;
12751
13830
  for (let i = 0; i < variants.length; i++) {
12752
13831
  const variant = variants[i];
12753
- if (variant.isError())
12754
- return variant;
13832
+ let _variant = variant;
13833
+ if (_variant.isReferenceObject() && (_variant = variant.toArrayValueObject()), _variant.isError())
13834
+ return _variant;
12755
13835
  if (i === variants.length - 1) {
12756
13836
  if (!(variant.isValueObject() && variant.isLambda()))
12757
13837
  return ErrorValueObject.create(ErrorType$1.VALUE);
12758
13838
  lambda = variant;
12759
13839
  } else
12760
- _variants.push(variant), maxRowLength = Math.max(maxRowLength, variant.isArray() ? variant.getRowCount() : 1), maxColumnLength = Math.max(maxColumnLength, variant.isArray() ? variant.getColumnCount() : 1);
13840
+ _variants.push(variant), maxRowLength = Math.max(maxRowLength, _variant.isArray() ? _variant.getRowCount() : 1), maxColumnLength = Math.max(maxColumnLength, _variant.isArray() ? _variant.getColumnCount() : 1);
12761
13841
  }
12762
13842
  const resultArray = this._getResultArray(_variants, lambda, maxRowLength, maxColumnLength);
12763
- return maxRowLength === 1 && maxColumnLength === 1 ? resultArray[0][0] : ArrayValueObject.create({
13843
+ return resultArray instanceof ErrorValueObject ? resultArray : maxRowLength === 1 && maxColumnLength === 1 ? resultArray[0][0] : ArrayValueObject.create({
12764
13844
  calculateValueList: resultArray,
12765
13845
  rowCount: maxRowLength,
12766
13846
  columnCount: maxColumnLength,
@@ -12770,6 +13850,7 @@ let Map$1 = (_a2 = class extends BaseFunction {
12770
13850
  column: this.column
12771
13851
  });
12772
13852
  }
13853
+ // eslint-disable-next-line
12773
13854
  _getResultArray(variants, lambda, maxRowLength, maxColumnLength) {
12774
13855
  const resultArray = [];
12775
13856
  for (let r = 0; r < maxRowLength; r++) {
@@ -12778,26 +13859,41 @@ let Map$1 = (_a2 = class extends BaseFunction {
12778
13859
  const lambdaVariant = [];
12779
13860
  let isRowPushed = !1;
12780
13861
  for (let i = 0; i < variants.length; i++) {
12781
- const variant = variants[i];
12782
- if (!variant.isArray())
13862
+ let variant = variants[i], _variant_reference = null;
13863
+ if (variant.isReferenceObject() && (_variant_reference = variant, variant = variant.toArrayValueObject()), !variant.isArray())
12783
13864
  if (r === 0 && c === 0) {
12784
- lambdaVariant.push(variant);
13865
+ lambdaVariant.push(_variant_reference || variant);
12785
13866
  continue;
12786
13867
  } else {
12787
13868
  row.push(ErrorValueObject.create(ErrorType$1.NA)), isRowPushed = !0;
12788
13869
  break;
12789
13870
  }
12790
- const valueObject = variant.get(r, c);
13871
+ let valueObject = variant.get(r, c);
12791
13872
  if (!valueObject) {
12792
13873
  row.push(ErrorValueObject.create(ErrorType$1.NA)), isRowPushed = !0;
12793
13874
  break;
12794
13875
  }
13876
+ if (_variant_reference) {
13877
+ const { startRow, startColumn } = _variant_reference.getRangePosition(), range = {
13878
+ startRow: startRow + r,
13879
+ startColumn: startColumn + c,
13880
+ endRow: startRow + r,
13881
+ endColumn: startColumn + c
13882
+ };
13883
+ valueObject = this.createReferenceObject(_variant_reference, range);
13884
+ }
12795
13885
  lambdaVariant.push(valueObject);
12796
13886
  }
12797
13887
  if (isRowPushed || lambdaVariant.length === 0)
12798
13888
  continue;
12799
13889
  let value = lambda.execute(...lambdaVariant);
12800
- value.isArray() && (value = value.get(0, 0)), value.isNull() && (value = NumberValueObject.create(0)), row.push(value);
13890
+ if (value.isArray()) {
13891
+ const rowCount = value.getRowCount(), columnCount = value.getColumnCount();
13892
+ if (rowCount > 1 || columnCount > 1)
13893
+ return ErrorValueObject.create(ErrorType$1.CALC);
13894
+ value = value.get(0, 0);
13895
+ }
13896
+ value.isNull() && (value = NumberValueObject.create(0)), row.push(value);
12801
13897
  }
12802
13898
  resultArray.push(row);
12803
13899
  }
@@ -12852,11 +13948,15 @@ const _Reduce = class _Reduce extends BaseFunction {
12852
13948
  super(...arguments);
12853
13949
  __publicField(this, "minParams", 3);
12854
13950
  __publicField(this, "maxParams", 3);
13951
+ __publicField(this, "needsReferenceObject", !0);
12855
13952
  }
12856
13953
  calculate(initialValue, array, lambda) {
12857
- return initialValue.isArray() ? initialValue.mapValue((initialValueObject) => this._handleSingleValueObject(initialValueObject, array, lambda)) : this._handleSingleValueObject(initialValue, array, lambda);
13954
+ let _initialValue, _initialValueReference;
13955
+ initialValue.isReferenceObject() ? (_initialValue = initialValue.toArrayValueObject(), _initialValueReference = initialValue) : (_initialValue = initialValue, _initialValueReference = null);
13956
+ let _array, _arrayReference;
13957
+ return array.isReferenceObject() ? (_array = array.toArrayValueObject(), _arrayReference = array) : (_array = array, _arrayReference = null), _initialValue.isArray() ? _initialValue.mapValue((initialValueObject) => this._handleSingleValueObject(initialValueObject, _array, lambda, _initialValueReference, _arrayReference)) : this._handleSingleValueObject(_initialValue, _array, lambda, _initialValueReference, _arrayReference);
12858
13958
  }
12859
- _handleSingleValueObject(initialValue, array, lambda) {
13959
+ _handleSingleValueObject(initialValue, array, lambda, _initialValue_reference, _array_reference) {
12860
13960
  if (initialValue.isError())
12861
13961
  return initialValue;
12862
13962
  if (array.isError())
@@ -12867,18 +13967,27 @@ const _Reduce = class _Reduce extends BaseFunction {
12867
13967
  return ErrorValueObject.create(ErrorType$1.VALUE);
12868
13968
  const _lambda = lambda, rowCount = array.isArray() ? array.getRowCount() : 1, columnCount = array.isArray() ? array.getColumnCount() : 1;
12869
13969
  let accumulator = initialValue;
13970
+ _initialValue_reference && (accumulator = _initialValue_reference);
12870
13971
  for (let r = 0; r < rowCount; r++)
12871
13972
  for (let c = 0; c < columnCount; c++) {
12872
- const valueObject = array.isArray() ? array.get(r, c) : array;
13973
+ let valueObject = array.isArray() ? array.get(r, c) : array;
12873
13974
  if (valueObject.isError())
12874
13975
  return valueObject;
13976
+ if (_array_reference) {
13977
+ const { startRow, startColumn } = _array_reference.getRangePosition(), range = {
13978
+ startRow: startRow + r,
13979
+ startColumn: startColumn + c,
13980
+ endRow: startRow + r,
13981
+ endColumn: startColumn + c
13982
+ };
13983
+ valueObject = this.createReferenceObject(_array_reference, range);
13984
+ }
12875
13985
  let value = _lambda.execute(accumulator, valueObject);
12876
- if (value.isArray() && (value = value.get(0, 0)), value.isError())
13986
+ if (value.isError())
12877
13987
  return value;
12878
13988
  value.isNull() && (value = NumberValueObject.create(0)), accumulator = value;
12879
13989
  }
12880
- const result = +accumulator.getValue();
12881
- return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.VALUE) : NumberValueObject.create(result);
13990
+ return accumulator.isReferenceObject() ? accumulator.toArrayValueObject() : accumulator;
12882
13991
  }
12883
13992
  };
12884
13993
  __name(_Reduce, "Reduce");
@@ -12888,29 +13997,33 @@ const _Scan = class _Scan extends BaseFunction {
12888
13997
  super(...arguments);
12889
13998
  __publicField(this, "minParams", 3);
12890
13999
  __publicField(this, "maxParams", 3);
14000
+ __publicField(this, "needsReferenceObject", !0);
12891
14001
  }
12892
14002
  calculate(initialValue, array, lambda) {
12893
- if (initialValue.isError())
12894
- return initialValue;
12895
- if (array.isError())
12896
- return array;
14003
+ let _initialValue = initialValue, _initialValue_reference = null;
14004
+ initialValue.isReferenceObject() && (_initialValue = initialValue.toArrayValueObject(), _initialValue_reference = initialValue), _initialValue = _initialValue;
14005
+ let _array = array, _array_reference = null;
14006
+ if (array.isReferenceObject() && (_array = array.toArrayValueObject(), _array_reference = array), _array = _array, _initialValue.isError())
14007
+ return _initialValue;
14008
+ if (_array.isError())
14009
+ return _array;
12897
14010
  if (lambda.isError())
12898
14011
  return lambda;
12899
14012
  if (!(lambda.isValueObject() && lambda.isLambda() && lambda.getLambdaPrivacyVarKeys().length === 2))
12900
14013
  return ErrorValueObject.create(ErrorType$1.VALUE);
12901
- let _initialValue = initialValue;
12902
- if (initialValue.isArray()) {
12903
- const rowCount = initialValue.getRowCount(), columnCount = initialValue.getColumnCount();
14014
+ if (_initialValue.isArray()) {
14015
+ const rowCount = _initialValue.getRowCount(), columnCount = _initialValue.getColumnCount();
12904
14016
  if (rowCount > 1 || columnCount > 1)
12905
14017
  return ErrorValueObject.create(ErrorType$1.CALC);
12906
- _initialValue = initialValue.get(0, 0);
14018
+ _initialValue = _initialValue.get(0, 0);
12907
14019
  }
12908
- return this._getResult(_initialValue, array, lambda);
14020
+ return this._getResult(_initialValue, _array, lambda, _initialValue_reference, _array_reference);
12909
14021
  }
12910
- _getResult(initialValue, array, lambda) {
12911
- const rowCount = array.isArray() ? array.getRowCount() : 1, columnCount = array.isArray() ? array.getColumnCount() : 1;
14022
+ // eslint-disable-next-line
14023
+ _getResult(initialValue, array, lambda, _initialValue_reference, _array_reference) {
14024
+ const resultArray = [], rowCount = array.isArray() ? array.getRowCount() : 1, columnCount = array.isArray() ? array.getColumnCount() : 1;
12912
14025
  let accumulator = initialValue;
12913
- const resultArray = [];
14026
+ _initialValue_reference && (accumulator = _initialValue_reference);
12914
14027
  for (let r = 0; r < rowCount; r++) {
12915
14028
  const row = [];
12916
14029
  for (let c = 0; c < columnCount; c++) {
@@ -12918,13 +14031,28 @@ const _Scan = class _Scan extends BaseFunction {
12918
14031
  row.push(accumulator);
12919
14032
  continue;
12920
14033
  }
12921
- const valueObject = array.isArray() ? array.get(r, c) : array;
14034
+ let valueObject = array.isArray() ? array.get(r, c) : array;
12922
14035
  if (valueObject.isError()) {
12923
14036
  accumulator = valueObject, row.push(valueObject);
12924
14037
  continue;
12925
14038
  }
14039
+ if (_array_reference) {
14040
+ const { startRow, startColumn } = _array_reference.getRangePosition(), range = {
14041
+ startRow: startRow + r,
14042
+ startColumn: startColumn + c,
14043
+ endRow: startRow + r,
14044
+ endColumn: startColumn + c
14045
+ };
14046
+ valueObject = this.createReferenceObject(_array_reference, range);
14047
+ }
12926
14048
  let value = lambda.execute(accumulator, valueObject);
12927
- value.isArray() && (value = value.get(0, 0)), value.isNull() && (value = NumberValueObject.create(0)), accumulator = value, row.push(value);
14049
+ if (value.isArray()) {
14050
+ const rowCount2 = value.getRowCount(), columnCount2 = value.getColumnCount();
14051
+ if (rowCount2 > 1 || columnCount2 > 1)
14052
+ return ErrorValueObject.create(ErrorType$1.CALC);
14053
+ value = value.get(0, 0);
14054
+ }
14055
+ value.isNull() && (value = NumberValueObject.create(0)), accumulator = value, row.push(value);
12928
14056
  }
12929
14057
  resultArray.push(row);
12930
14058
  }
@@ -13874,10 +15002,10 @@ const _Offset = class _Offset extends BaseFunction {
13874
15002
  _rows.isReferenceObject() && (_rows = _rows.toArrayValueObject());
13875
15003
  let _columns = columns;
13876
15004
  _columns.isReferenceObject() && (_columns = _columns.toArrayValueObject());
13877
- let _height = height;
13878
- _height ? _height.isReferenceObject() && (_height = _height.toArrayValueObject()) : _height = NumberValueObject.create(rowCount);
13879
- let _width = width;
13880
- _width ? _width.isReferenceObject() && (_width = _width.toArrayValueObject()) : _width = NumberValueObject.create(columnCount);
15005
+ let _height = height != null ? height : NumberValueObject.create(rowCount);
15006
+ _height.isReferenceObject() && (_height = _height.toArrayValueObject()), _height.isNull() && (_height = NumberValueObject.create(rowCount));
15007
+ let _width = width != null ? width : NumberValueObject.create(columnCount);
15008
+ _width.isReferenceObject() && (_width = _width.toArrayValueObject()), _width.isNull() && (_width = NumberValueObject.create(columnCount));
13881
15009
  const maxRowLength = Math.max(
13882
15010
  _rows.isArray() ? _rows.getRowCount() : 1,
13883
15011
  _columns.isArray() ? _columns.getRowCount() : 1,
@@ -13890,15 +15018,23 @@ const _Offset = class _Offset extends BaseFunction {
13890
15018
  _width.isArray() ? _width.getColumnCount() : 1
13891
15019
  );
13892
15020
  if (_rows = _rows, _columns = _columns, _height = _height, _width = _width, maxRowLength === 1 && maxColumnLength === 1)
13893
- return this._handleSingleObject(reference, _rows, _columns, _height, _width);
15021
+ return _rows = _rows.isArray() ? _rows.get(0, 0) : _rows, _columns = _columns.isArray() ? _columns.get(0, 0) : _columns, _height = _height.isArray() ? _height.get(0, 0) : _height, _width = _width.isArray() ? _width.get(0, 0) : _width, this._handleSingleObject(reference, _rows, _columns, _height, _width);
13894
15022
  const rowsArray = expandArrayValueObject(maxRowLength, maxColumnLength, _rows, ErrorValueObject.create(ErrorType$1.NA)), columnsArray = expandArrayValueObject(maxRowLength, maxColumnLength, _columns, ErrorValueObject.create(ErrorType$1.NA)), heightArray = expandArrayValueObject(maxRowLength, maxColumnLength, _height, ErrorValueObject.create(ErrorType$1.NA)), widthArray = expandArrayValueObject(maxRowLength, maxColumnLength, _width, ErrorValueObject.create(ErrorType$1.NA));
13895
15023
  return rowsArray.mapValue((rowsValue, rowIndex, columnIndex) => {
13896
15024
  const columnsValue = columnsArray.get(rowIndex, columnIndex), heightValue = heightArray.get(rowIndex, columnIndex), widthValue = widthArray.get(rowIndex, columnIndex);
13897
15025
  return rowsValue.isError() ? rowsValue : columnsValue.isError() ? columnsValue : heightValue.isError() ? heightValue : widthValue.isError() ? widthValue : this._handleSingleObject(reference, rowsValue, columnsValue, heightValue, widthValue, !0);
13898
15026
  });
13899
15027
  }
15028
+ // eslint-disable-next-line
13900
15029
  _handleSingleObject(reference, rowsValue, columnsValue, heightValue, widthValue, isReportError = !1) {
13901
- const { startRow: referenceStartRow, startColumn: referenceStartColumn } = reference.getRangePosition(), rowOffset = this.getIndexNumValue(rowsValue), columnOffset = this.getIndexNumValue(columnsValue);
15030
+ const { startRow: referenceStartRow, startColumn: referenceStartColumn } = reference.getRangePosition();
15031
+ let _rowsValue = rowsValue;
15032
+ if (_rowsValue.isString() && (_rowsValue = _rowsValue.convertToNumberObjectValue()), _rowsValue.isError())
15033
+ return _rowsValue;
15034
+ let _columnsValue = columnsValue;
15035
+ if (_columnsValue.isString() && (_columnsValue = _columnsValue.convertToNumberObjectValue()), _columnsValue.isError())
15036
+ return _columnsValue;
15037
+ const rowOffset = +_rowsValue.getValue(), columnOffset = +_columnsValue.getValue();
13902
15038
  if (typeof rowOffset != "number" || typeof columnOffset != "number")
13903
15039
  return ErrorValueObject.create(ErrorType$1.VALUE);
13904
15040
  const targetRow = referenceStartRow + rowOffset, targetColumn = referenceStartColumn + columnOffset;
@@ -15328,79 +16464,16 @@ const _CeilingPrecise = class _CeilingPrecise extends BaseFunction {
15328
16464
  if (significanceObject.isString() && (significanceObject = significanceObject.convertToNumberObjectValue()), significanceObject.isError())
15329
16465
  return significanceObject;
15330
16466
  const numberValue = +_numberObject.getValue(), significanceValue = +significanceObject.getValue();
15331
- if (numberValue === 0 || significanceValue === 0)
15332
- return NumberValueObject.create(0);
15333
- const result = (significanceValue < 0 ? -ceil(numberValue / Math.abs(significanceValue), 0) : ceil(numberValue / significanceValue, 0)) * significanceValue;
15334
- return NumberValueObject.create(result);
15335
- });
15336
- return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
15337
- }
15338
- };
15339
- __name(_CeilingPrecise, "CeilingPrecise");
15340
- let CeilingPrecise = _CeilingPrecise;
15341
- function calculateFactorial(n, step = 1) {
15342
- let _n = Math.floor(n);
15343
- if (n < 0)
15344
- return Number.NaN;
15345
- let result = 1;
15346
- for (; _n > 1 && Number.isFinite(result); )
15347
- result *= _n, _n -= step;
15348
- return result;
15349
- }
15350
- __name(calculateFactorial, "calculateFactorial");
15351
- function calculateCombin(n, k) {
15352
- const t = Math.min(n - k, k);
15353
- let result = 1;
15354
- for (let i = 1; i <= t && Number.isFinite(result); i++)
15355
- result *= n - i + 1, result /= i;
15356
- return result;
15357
- }
15358
- __name(calculateCombin, "calculateCombin");
15359
- function calculateGcd(a, b) {
15360
- let _a26 = Math.floor(a), _b = Math.floor(b);
15361
- for (; _b !== 0; ) {
15362
- const t = _b;
15363
- _b = _a26 % _b, _a26 = t;
15364
- }
15365
- return _a26;
15366
- }
15367
- __name(calculateGcd, "calculateGcd");
15368
- function calculateLcm(a, b) {
15369
- const den = calculateGcd(a, b);
15370
- return den === 0 ? 0 : Math.abs(a * b) / den;
15371
- }
15372
- __name(calculateLcm, "calculateLcm");
15373
- function calculateMdeterm(matrix) {
15374
- const n = matrix.length;
15375
- if (n === 1)
15376
- return matrix[0][0];
15377
- if (n === 2)
15378
- return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0];
15379
- let det = 0;
15380
- for (let col = 0; col < n; col++)
15381
- det += (col % 2 === 0 ? 1 : -1) * matrix[0][col] * calculateMdeterm(minor(matrix, 0, col));
15382
- return det;
15383
- }
15384
- __name(calculateMdeterm, "calculateMdeterm");
15385
- function calculateMinverse(matrix) {
15386
- const det = calculateMdeterm(matrix);
15387
- return det === 0 ? null : matrix.length === 1 ? [[1 / det]] : adjoint(matrix).map((row) => row.map((value) => value / det));
15388
- }
15389
- __name(calculateMinverse, "calculateMinverse");
15390
- function minor(matrix, row, col) {
15391
- return matrix.filter((_, r) => r !== row).map((row2) => row2.filter((_, c) => c !== col));
15392
- }
15393
- __name(minor, "minor");
15394
- function adjoint(matrix) {
15395
- const n = matrix.length, adj = Array.from({ length: n }, () => new Array(n).fill(0));
15396
- for (let i = 0; i < n; i++)
15397
- for (let j = 0; j < n; j++) {
15398
- const sign2 = (i + j) % 2 === 0 ? 1 : -1;
15399
- adj[j][i] = sign2 * calculateMdeterm(minor(matrix, i, j));
15400
- }
15401
- return adj;
15402
- }
15403
- __name(adjoint, "adjoint");
16467
+ if (numberValue === 0 || significanceValue === 0)
16468
+ return NumberValueObject.create(0);
16469
+ const result = (significanceValue < 0 ? -ceil(numberValue / Math.abs(significanceValue), 0) : ceil(numberValue / significanceValue, 0)) * significanceValue;
16470
+ return NumberValueObject.create(result);
16471
+ });
16472
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
16473
+ }
16474
+ };
16475
+ __name(_CeilingPrecise, "CeilingPrecise");
16476
+ let CeilingPrecise = _CeilingPrecise;
15404
16477
  const _Combin = class _Combin extends BaseFunction {
15405
16478
  constructor() {
15406
16479
  super(...arguments);
@@ -17694,9 +18767,7 @@ const functionMeta = [
17694
18767
  [Multiply, FUNCTION_NAMES_META.MULTIPLY],
17695
18768
  [Plus, FUNCTION_NAMES_META.PLUS],
17696
18769
  [Cube, FUNCTION_NAMES_META.CUBE]
17697
- ];
17698
- var FUNCTION_NAMES_STATISTICAL = /* @__PURE__ */ ((FUNCTION_NAMES_STATISTICAL2) => (FUNCTION_NAMES_STATISTICAL2.AVEDEV = "AVEDEV", FUNCTION_NAMES_STATISTICAL2.AVERAGE = "AVERAGE", FUNCTION_NAMES_STATISTICAL2.AVERAGEA = "AVERAGEA", FUNCTION_NAMES_STATISTICAL2.AVERAGEIF = "AVERAGEIF", FUNCTION_NAMES_STATISTICAL2.AVERAGEIFS = "AVERAGEIFS", FUNCTION_NAMES_STATISTICAL2.BETA_DIST = "BETA.DIST", FUNCTION_NAMES_STATISTICAL2.BETA_INV = "BETA.INV", FUNCTION_NAMES_STATISTICAL2.BINOM_DIST = "BINOM.DIST", FUNCTION_NAMES_STATISTICAL2.BINOM_DIST_RANGE = "BINOM.DIST.RANGE", FUNCTION_NAMES_STATISTICAL2.BINOM_INV = "BINOM.INV", FUNCTION_NAMES_STATISTICAL2.CHISQ_DIST = "CHISQ.DIST", FUNCTION_NAMES_STATISTICAL2.CHISQ_DIST_RT = "CHISQ.DIST.RT", FUNCTION_NAMES_STATISTICAL2.CHISQ_INV = "CHISQ.INV", FUNCTION_NAMES_STATISTICAL2.CHISQ_INV_RT = "CHISQ.INV.RT", FUNCTION_NAMES_STATISTICAL2.CHISQ_TEST = "CHISQ.TEST", FUNCTION_NAMES_STATISTICAL2.CONFIDENCE_NORM = "CONFIDENCE.NORM", FUNCTION_NAMES_STATISTICAL2.CONFIDENCE_T = "CONFIDENCE.T", FUNCTION_NAMES_STATISTICAL2.CORREL = "CORREL", FUNCTION_NAMES_STATISTICAL2.COUNT = "COUNT", FUNCTION_NAMES_STATISTICAL2.COUNTA = "COUNTA", FUNCTION_NAMES_STATISTICAL2.COUNTBLANK = "COUNTBLANK", FUNCTION_NAMES_STATISTICAL2.COUNTIF = "COUNTIF", FUNCTION_NAMES_STATISTICAL2.COUNTIFS = "COUNTIFS", FUNCTION_NAMES_STATISTICAL2.COVARIANCE_P = "COVARIANCE.P", FUNCTION_NAMES_STATISTICAL2.COVARIANCE_S = "COVARIANCE.S", FUNCTION_NAMES_STATISTICAL2.DEVSQ = "DEVSQ", FUNCTION_NAMES_STATISTICAL2.EXPON_DIST = "EXPON.DIST", FUNCTION_NAMES_STATISTICAL2.F_DIST = "F.DIST", FUNCTION_NAMES_STATISTICAL2.F_DIST_RT = "F.DIST.RT", FUNCTION_NAMES_STATISTICAL2.F_INV = "F.INV", FUNCTION_NAMES_STATISTICAL2.F_INV_RT = "F.INV.RT", FUNCTION_NAMES_STATISTICAL2.F_TEST = "F.TEST", FUNCTION_NAMES_STATISTICAL2.FISHER = "FISHER", FUNCTION_NAMES_STATISTICAL2.FISHERINV = "FISHERINV", FUNCTION_NAMES_STATISTICAL2.FORECAST = "FORECAST", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS = "FORECAST.ETS", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS_CONFINT = "FORECAST.ETS.CONFINT", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS_SEASONALITY = "FORECAST.ETS.SEASONALITY", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS_STAT = "FORECAST.ETS.STAT", FUNCTION_NAMES_STATISTICAL2.FORECAST_LINEAR = "FORECAST.LINEAR", FUNCTION_NAMES_STATISTICAL2.FREQUENCY = "FREQUENCY", FUNCTION_NAMES_STATISTICAL2.GAMMA = "GAMMA", FUNCTION_NAMES_STATISTICAL2.GAMMA_DIST = "GAMMA.DIST", FUNCTION_NAMES_STATISTICAL2.GAMMA_INV = "GAMMA.INV", FUNCTION_NAMES_STATISTICAL2.GAMMALN = "GAMMALN", FUNCTION_NAMES_STATISTICAL2.GAMMALN_PRECISE = "GAMMALN.PRECISE", FUNCTION_NAMES_STATISTICAL2.GAUSS = "GAUSS", FUNCTION_NAMES_STATISTICAL2.GEOMEAN = "GEOMEAN", FUNCTION_NAMES_STATISTICAL2.GROWTH = "GROWTH", FUNCTION_NAMES_STATISTICAL2.HARMEAN = "HARMEAN", FUNCTION_NAMES_STATISTICAL2.HYPGEOM_DIST = "HYPGEOM.DIST", FUNCTION_NAMES_STATISTICAL2.INTERCEPT = "INTERCEPT", FUNCTION_NAMES_STATISTICAL2.KURT = "KURT", FUNCTION_NAMES_STATISTICAL2.LARGE = "LARGE", FUNCTION_NAMES_STATISTICAL2.LINEST = "LINEST", FUNCTION_NAMES_STATISTICAL2.LOGEST = "LOGEST", FUNCTION_NAMES_STATISTICAL2.LOGNORM_DIST = "LOGNORM.DIST", FUNCTION_NAMES_STATISTICAL2.LOGNORM_INV = "LOGNORM.INV", FUNCTION_NAMES_STATISTICAL2.MAX = "MAX", FUNCTION_NAMES_STATISTICAL2.MAXA = "MAXA", FUNCTION_NAMES_STATISTICAL2.MAXIFS = "MAXIFS", FUNCTION_NAMES_STATISTICAL2.MEDIAN = "MEDIAN", FUNCTION_NAMES_STATISTICAL2.MIN = "MIN", FUNCTION_NAMES_STATISTICAL2.MINA = "MINA", FUNCTION_NAMES_STATISTICAL2.MINIFS = "MINIFS", FUNCTION_NAMES_STATISTICAL2.MODE_MULT = "MODE.MULT", FUNCTION_NAMES_STATISTICAL2.MODE_SNGL = "MODE.SNGL", FUNCTION_NAMES_STATISTICAL2.NEGBINOM_DIST = "NEGBINOM.DIST", FUNCTION_NAMES_STATISTICAL2.NORM_DIST = "NORM.DIST", FUNCTION_NAMES_STATISTICAL2.NORM_INV = "NORM.INV", FUNCTION_NAMES_STATISTICAL2.NORM_S_DIST = "NORM.S.DIST", FUNCTION_NAMES_STATISTICAL2.NORM_S_INV = "NORM.S.INV", FUNCTION_NAMES_STATISTICAL2.PEARSON = "PEARSON", FUNCTION_NAMES_STATISTICAL2.PERCENTILE_EXC = "PERCENTILE.EXC", FUNCTION_NAMES_STATISTICAL2.PERCENTILE_INC = "PERCENTILE.INC", FUNCTION_NAMES_STATISTICAL2.PERCENTRANK_EXC = "PERCENTRANK.EXC", FUNCTION_NAMES_STATISTICAL2.PERCENTRANK_INC = "PERCENTRANK.INC", FUNCTION_NAMES_STATISTICAL2.PERMUT = "PERMUT", FUNCTION_NAMES_STATISTICAL2.PERMUTATIONA = "PERMUTATIONA", FUNCTION_NAMES_STATISTICAL2.PHI = "PHI", FUNCTION_NAMES_STATISTICAL2.POISSON_DIST = "POISSON.DIST", FUNCTION_NAMES_STATISTICAL2.PROB = "PROB", FUNCTION_NAMES_STATISTICAL2.QUARTILE_EXC = "QUARTILE.EXC", FUNCTION_NAMES_STATISTICAL2.QUARTILE_INC = "QUARTILE.INC", FUNCTION_NAMES_STATISTICAL2.RANK_AVG = "RANK.AVG", FUNCTION_NAMES_STATISTICAL2.RANK_EQ = "RANK.EQ", FUNCTION_NAMES_STATISTICAL2.RSQ = "RSQ", FUNCTION_NAMES_STATISTICAL2.SKEW = "SKEW", FUNCTION_NAMES_STATISTICAL2.SKEW_P = "SKEW.P", FUNCTION_NAMES_STATISTICAL2.SLOPE = "SLOPE", FUNCTION_NAMES_STATISTICAL2.SMALL = "SMALL", FUNCTION_NAMES_STATISTICAL2.STANDARDIZE = "STANDARDIZE", FUNCTION_NAMES_STATISTICAL2.STDEV_P = "STDEV.P", FUNCTION_NAMES_STATISTICAL2.STDEV_S = "STDEV.S", FUNCTION_NAMES_STATISTICAL2.STDEVA = "STDEVA", FUNCTION_NAMES_STATISTICAL2.STDEVPA = "STDEVPA", FUNCTION_NAMES_STATISTICAL2.STEYX = "STEYX", FUNCTION_NAMES_STATISTICAL2.T_DIST = "T.DIST", FUNCTION_NAMES_STATISTICAL2.T_DIST_2T = "T.DIST.2T", FUNCTION_NAMES_STATISTICAL2.T_DIST_RT = "T.DIST.RT", FUNCTION_NAMES_STATISTICAL2.T_INV = "T.INV", FUNCTION_NAMES_STATISTICAL2.T_INV_2T = "T.INV.2T", FUNCTION_NAMES_STATISTICAL2.T_TEST = "T.TEST", FUNCTION_NAMES_STATISTICAL2.TREND = "TREND", FUNCTION_NAMES_STATISTICAL2.TRIMMEAN = "TRIMMEAN", FUNCTION_NAMES_STATISTICAL2.VAR_P = "VAR.P", FUNCTION_NAMES_STATISTICAL2.VAR_S = "VAR.S", FUNCTION_NAMES_STATISTICAL2.VARA = "VARA", FUNCTION_NAMES_STATISTICAL2.VARPA = "VARPA", FUNCTION_NAMES_STATISTICAL2.WEIBULL_DIST = "WEIBULL.DIST", FUNCTION_NAMES_STATISTICAL2.Z_TEST = "Z.TEST", FUNCTION_NAMES_STATISTICAL2))(FUNCTION_NAMES_STATISTICAL || {});
17699
- const _Avedev = class _Avedev extends BaseFunction {
18770
+ ], _Avedev = class _Avedev extends BaseFunction {
17700
18771
  constructor() {
17701
18772
  super(...arguments);
17702
18773
  __publicField(this, "minParams", 1);
@@ -17888,6 +18959,236 @@ const _Averageifs = class _Averageifs extends BaseFunction {
17888
18959
  };
17889
18960
  __name(_Averageifs, "Averageifs");
17890
18961
  let Averageifs = _Averageifs;
18962
+ const _BetaDist = class _BetaDist extends BaseFunction {
18963
+ constructor() {
18964
+ super(...arguments);
18965
+ __publicField(this, "minParams", 4);
18966
+ __publicField(this, "maxParams", 6);
18967
+ }
18968
+ calculate(x, alpha, beta, cumulative, A, B) {
18969
+ let _A = A != null ? A : NumberValueObject.create(0), _B = B != null ? B : NumberValueObject.create(1);
18970
+ _A.isNull() && (_A = NumberValueObject.create(0)), _B.isNull() && (_B = NumberValueObject.create(1));
18971
+ const maxRowLength = Math.max(
18972
+ x.isArray() ? x.getRowCount() : 1,
18973
+ alpha.isArray() ? alpha.getRowCount() : 1,
18974
+ beta.isArray() ? beta.getRowCount() : 1,
18975
+ cumulative.isArray() ? cumulative.getRowCount() : 1,
18976
+ _A.isArray() ? _A.getRowCount() : 1,
18977
+ _B.isArray() ? _B.getRowCount() : 1
18978
+ ), maxColumnLength = Math.max(
18979
+ x.isArray() ? x.getColumnCount() : 1,
18980
+ alpha.isArray() ? alpha.getColumnCount() : 1,
18981
+ beta.isArray() ? beta.getColumnCount() : 1,
18982
+ cumulative.isArray() ? cumulative.getColumnCount() : 1,
18983
+ _A.isArray() ? _A.getColumnCount() : 1,
18984
+ _B.isArray() ? _B.getColumnCount() : 1
18985
+ ), xArray = expandArrayValueObject(maxRowLength, maxColumnLength, x, ErrorValueObject.create(ErrorType$1.NA)), alphaArray = expandArrayValueObject(maxRowLength, maxColumnLength, alpha, ErrorValueObject.create(ErrorType$1.NA)), betaArray = expandArrayValueObject(maxRowLength, maxColumnLength, beta, ErrorValueObject.create(ErrorType$1.NA)), cumulativeArray = expandArrayValueObject(maxRowLength, maxColumnLength, cumulative, ErrorValueObject.create(ErrorType$1.NA)), AArray = expandArrayValueObject(maxRowLength, maxColumnLength, _A, ErrorValueObject.create(ErrorType$1.NA)), BArray = expandArrayValueObject(maxRowLength, maxColumnLength, _B, ErrorValueObject.create(ErrorType$1.NA)), resultArray = xArray.mapValue((xObject, rowIndex, columnIndex) => {
18986
+ const alphaObject = alphaArray.get(rowIndex, columnIndex), betaObject = betaArray.get(rowIndex, columnIndex), cumulativeObject = cumulativeArray.get(rowIndex, columnIndex), AObject = AArray.get(rowIndex, columnIndex), BObject = BArray.get(rowIndex, columnIndex);
18987
+ return this._handleSignleObject(xObject, alphaObject, betaObject, cumulativeObject, AObject, BObject);
18988
+ });
18989
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
18990
+ }
18991
+ _handleSignleObject(xObject, alphaObject, betaObject, cumulativeObject, AObject, BObject) {
18992
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(xObject, alphaObject, betaObject, cumulativeObject, AObject, BObject);
18993
+ if (isError)
18994
+ return errorObject;
18995
+ const [_xObject, _alphaObject, _betaObject, _cumulativeObject, _AObject, _BObject] = variants, xValue = +_xObject.getValue(), alphaValue = +_alphaObject.getValue(), betaValue = +_betaObject.getValue(), cumulativeValue = +_cumulativeObject.getValue(), AValue = +_AObject.getValue(), BValue = +_BObject.getValue();
18996
+ if (alphaValue <= 0 || betaValue <= 0 || xValue < AValue || xValue > BValue || AValue === BValue)
18997
+ return ErrorValueObject.create(ErrorType$1.NUM);
18998
+ let result;
18999
+ return cumulativeValue ? result = betaCDF((xValue - AValue) / (BValue - AValue), alphaValue, betaValue) : result = betaPDF((xValue - AValue) / (BValue - AValue), alphaValue, betaValue) / (BValue - AValue), NumberValueObject.create(result);
19000
+ }
19001
+ };
19002
+ __name(_BetaDist, "BetaDist");
19003
+ let BetaDist = _BetaDist;
19004
+ const _BinomDistRange = class _BinomDistRange extends BaseFunction {
19005
+ constructor() {
19006
+ super(...arguments);
19007
+ __publicField(this, "minParams", 3);
19008
+ __publicField(this, "maxParams", 4);
19009
+ }
19010
+ calculate(trials, probabilityS, numberS, numberS2) {
19011
+ let _numberS2 = numberS2 != null ? numberS2 : numberS;
19012
+ _numberS2.isNull() && (_numberS2 = numberS);
19013
+ const maxRowLength = Math.max(
19014
+ trials.isArray() ? trials.getRowCount() : 1,
19015
+ probabilityS.isArray() ? probabilityS.getRowCount() : 1,
19016
+ numberS.isArray() ? numberS.getRowCount() : 1,
19017
+ _numberS2.isArray() ? _numberS2.getRowCount() : 1
19018
+ ), maxColumnLength = Math.max(
19019
+ trials.isArray() ? trials.getColumnCount() : 1,
19020
+ probabilityS.isArray() ? probabilityS.getColumnCount() : 1,
19021
+ numberS.isArray() ? numberS.getColumnCount() : 1,
19022
+ _numberS2.isArray() ? _numberS2.getColumnCount() : 1
19023
+ ), trialsArray = expandArrayValueObject(maxRowLength, maxColumnLength, trials, ErrorValueObject.create(ErrorType$1.NA)), probabilitySArray = expandArrayValueObject(maxRowLength, maxColumnLength, probabilityS, ErrorValueObject.create(ErrorType$1.NA)), numberSArray = expandArrayValueObject(maxRowLength, maxColumnLength, numberS, ErrorValueObject.create(ErrorType$1.NA)), numberS2Array = expandArrayValueObject(maxRowLength, maxColumnLength, _numberS2, ErrorValueObject.create(ErrorType$1.NA)), resultArray = trialsArray.mapValue((trialsObject, rowIndex, columnIndex) => {
19024
+ const probabilitySObject = probabilitySArray.get(rowIndex, columnIndex), numberSObject = numberSArray.get(rowIndex, columnIndex), numberS2Object = numberS2Array.get(rowIndex, columnIndex);
19025
+ return this._handleSignleObject(trialsObject, probabilitySObject, numberSObject, numberS2Object);
19026
+ });
19027
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
19028
+ }
19029
+ _handleSignleObject(trialsObject, probabilitySObject, numberSObject, numberS2Object) {
19030
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(trialsObject, probabilitySObject, numberSObject, numberS2Object);
19031
+ if (isError)
19032
+ return errorObject;
19033
+ const [_trialsObject, _probabilitySObject, _numberSObject, _numberS2Object] = variants, trialsValue = Math.floor(+_trialsObject.getValue()), probabilitySValue = +_probabilitySObject.getValue(), numberSValue = Math.floor(+_numberSObject.getValue()), numberS2Value = Math.floor(+_numberS2Object.getValue());
19034
+ if (trialsValue < 0 || probabilitySValue < 0 || probabilitySValue > 1 || numberSValue < 0 || numberSValue > trialsValue || numberS2Value < 0 || numberS2Value < numberSValue || numberS2Value > trialsValue)
19035
+ return ErrorValueObject.create(ErrorType$1.NUM);
19036
+ let result = 0;
19037
+ for (let i = numberSValue; i <= numberS2Value; i++)
19038
+ result += binomialPDF(i, trialsValue, probabilitySValue);
19039
+ return NumberValueObject.create(result);
19040
+ }
19041
+ };
19042
+ __name(_BinomDistRange, "BinomDistRange");
19043
+ let BinomDistRange = _BinomDistRange;
19044
+ const _ChisqDist = class _ChisqDist extends BaseFunction {
19045
+ constructor() {
19046
+ super(...arguments);
19047
+ __publicField(this, "minParams", 3);
19048
+ __publicField(this, "maxParams", 3);
19049
+ }
19050
+ calculate(x, degFreedom, cumulative) {
19051
+ const maxRowLength = Math.max(
19052
+ x.isArray() ? x.getRowCount() : 1,
19053
+ degFreedom.isArray() ? degFreedom.getRowCount() : 1,
19054
+ cumulative.isArray() ? cumulative.getRowCount() : 1
19055
+ ), maxColumnLength = Math.max(
19056
+ x.isArray() ? x.getColumnCount() : 1,
19057
+ degFreedom.isArray() ? degFreedom.getColumnCount() : 1,
19058
+ cumulative.isArray() ? cumulative.getColumnCount() : 1
19059
+ ), xArray = expandArrayValueObject(maxRowLength, maxColumnLength, x, ErrorValueObject.create(ErrorType$1.NA)), degFreedomArray = expandArrayValueObject(maxRowLength, maxColumnLength, degFreedom, ErrorValueObject.create(ErrorType$1.NA)), cumulativeArray = expandArrayValueObject(maxRowLength, maxColumnLength, cumulative, ErrorValueObject.create(ErrorType$1.NA)), resultArray = xArray.mapValue((xObject, rowIndex, columnIndex) => {
19060
+ const degFreedomObject = degFreedomArray.get(rowIndex, columnIndex), cumulativeObject = cumulativeArray.get(rowIndex, columnIndex);
19061
+ return this._handleSignleObject(xObject, degFreedomObject, cumulativeObject);
19062
+ });
19063
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
19064
+ }
19065
+ _handleSignleObject(xObject, degFreedomObject, cumulativeObject) {
19066
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(xObject, degFreedomObject, cumulativeObject);
19067
+ if (isError)
19068
+ return errorObject;
19069
+ const [_xObject, _degFreedomObject, _cumulativeObject] = variants, xValue = +_xObject.getValue(), degFreedomValue = Math.floor(+_degFreedomObject.getValue()), cumulativeValue = +_cumulativeObject.getValue();
19070
+ if (xValue < 0 || degFreedomValue < 1 || degFreedomValue > 10 ** 10)
19071
+ return ErrorValueObject.create(ErrorType$1.NUM);
19072
+ let result;
19073
+ return cumulativeValue ? result = chisquareCDF(xValue, degFreedomValue) : result = chisquarePDF(xValue, degFreedomValue), NumberValueObject.create(result);
19074
+ }
19075
+ };
19076
+ __name(_ChisqDist, "ChisqDist");
19077
+ let ChisqDist = _ChisqDist;
19078
+ const _ChisqInv = class _ChisqInv extends BaseFunction {
19079
+ constructor() {
19080
+ super(...arguments);
19081
+ __publicField(this, "minParams", 2);
19082
+ __publicField(this, "maxParams", 2);
19083
+ }
19084
+ calculate(probability, degFreedom) {
19085
+ const maxRowLength = Math.max(
19086
+ probability.isArray() ? probability.getRowCount() : 1,
19087
+ degFreedom.isArray() ? degFreedom.getRowCount() : 1
19088
+ ), maxColumnLength = Math.max(
19089
+ probability.isArray() ? probability.getColumnCount() : 1,
19090
+ degFreedom.isArray() ? degFreedom.getColumnCount() : 1
19091
+ ), probabilityArray = expandArrayValueObject(maxRowLength, maxColumnLength, probability, ErrorValueObject.create(ErrorType$1.NA)), degFreedomArray = expandArrayValueObject(maxRowLength, maxColumnLength, degFreedom, ErrorValueObject.create(ErrorType$1.NA)), resultArray = probabilityArray.mapValue((probabilityObject, rowIndex, columnIndex) => {
19092
+ const degFreedomObject = degFreedomArray.get(rowIndex, columnIndex);
19093
+ return this._handleSignleObject(probabilityObject, degFreedomObject);
19094
+ });
19095
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
19096
+ }
19097
+ _handleSignleObject(probabilityObject, degFreedomObject) {
19098
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(probabilityObject, degFreedomObject);
19099
+ if (isError)
19100
+ return errorObject;
19101
+ const [_probabilityObject, _degFreedomObject] = variants, probabilityValue = +_probabilityObject.getValue(), degFreedomValue = Math.floor(+_degFreedomObject.getValue());
19102
+ if (probabilityValue < 0 || probabilityValue > 1 || degFreedomValue < 1 || degFreedomValue > 10 ** 10)
19103
+ return ErrorValueObject.create(ErrorType$1.NUM);
19104
+ const result = chisquareINV(probabilityValue, degFreedomValue);
19105
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
19106
+ }
19107
+ };
19108
+ __name(_ChisqInv, "ChisqInv");
19109
+ let ChisqInv = _ChisqInv;
19110
+ const _ConfidenceT = class _ConfidenceT extends BaseFunction {
19111
+ constructor() {
19112
+ super(...arguments);
19113
+ __publicField(this, "minParams", 3);
19114
+ __publicField(this, "maxParams", 3);
19115
+ }
19116
+ calculate(alpha, standardDev, size) {
19117
+ const maxRowLength = Math.max(
19118
+ alpha.isArray() ? alpha.getRowCount() : 1,
19119
+ standardDev.isArray() ? standardDev.getRowCount() : 1,
19120
+ size.isArray() ? size.getRowCount() : 1
19121
+ ), maxColumnLength = Math.max(
19122
+ alpha.isArray() ? alpha.getColumnCount() : 1,
19123
+ standardDev.isArray() ? standardDev.getColumnCount() : 1,
19124
+ size.isArray() ? size.getColumnCount() : 1
19125
+ ), alphaArray = expandArrayValueObject(maxRowLength, maxColumnLength, alpha, ErrorValueObject.create(ErrorType$1.NA)), standardDevArray = expandArrayValueObject(maxRowLength, maxColumnLength, standardDev, ErrorValueObject.create(ErrorType$1.NA)), sizeArray = expandArrayValueObject(maxRowLength, maxColumnLength, size, ErrorValueObject.create(ErrorType$1.NA)), resultArray = alphaArray.mapValue((alphaObject, rowIndex, columnIndex) => {
19126
+ const standardDevObject = standardDevArray.get(rowIndex, columnIndex), sizeObject = sizeArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(alphaObject, standardDevObject, sizeObject);
19127
+ if (isError)
19128
+ return errorObject;
19129
+ const [_alphaObject, _standardDevObject, _sizeObject] = variants, alphaValue = +_alphaObject.getValue(), standardDevValue = +_standardDevObject.getValue(), sizeValue = Math.floor(+_sizeObject.getValue());
19130
+ if (alphaValue <= 0 || alphaValue >= 1 || standardDevValue <= 0 || sizeValue < 1)
19131
+ return ErrorValueObject.create(ErrorType$1.NUM);
19132
+ if (sizeValue === 1)
19133
+ return ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
19134
+ const result = Math.abs(studentTINV(alphaValue / 2, sizeValue - 1) * standardDevValue / Math.sqrt(sizeValue));
19135
+ return NumberValueObject.create(result);
19136
+ });
19137
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
19138
+ }
19139
+ };
19140
+ __name(_ConfidenceT, "ConfidenceT");
19141
+ let ConfidenceT = _ConfidenceT;
19142
+ const _Correl = class _Correl extends BaseFunction {
19143
+ constructor() {
19144
+ super(...arguments);
19145
+ __publicField(this, "minParams", 2);
19146
+ __publicField(this, "maxParams", 2);
19147
+ }
19148
+ calculate(array1, array2) {
19149
+ const array1RowCount = array1.isArray() ? array1.getRowCount() : 1, array1ColumnCount = array1.isArray() ? array1.getColumnCount() : 1, array2RowCount = array2.isArray() ? array2.getRowCount() : 1, array2ColumnCount = array2.isArray() ? array2.getColumnCount() : 1;
19150
+ let _array1 = array1;
19151
+ if (array1.isArray() && array1RowCount === 1 && array1ColumnCount === 1 && (_array1 = array1.get(0, 0)), _array1.isError())
19152
+ return _array1;
19153
+ let _array2 = array2;
19154
+ if (array2.isArray() && array2RowCount === 1 && array2ColumnCount === 1 && (_array2 = array2.get(0, 0)), _array2.isError())
19155
+ return _array2;
19156
+ if (array1RowCount * array1ColumnCount === 1 || array2RowCount * array2ColumnCount === 1)
19157
+ return _array1.isNull() || _array2.isNull() ? ErrorValueObject.create(ErrorType$1.VALUE) : ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
19158
+ if (array1RowCount * array1ColumnCount !== array2RowCount * array2ColumnCount)
19159
+ return ErrorValueObject.create(ErrorType$1.NA);
19160
+ const {
19161
+ isError,
19162
+ errorObject,
19163
+ array1Values,
19164
+ array2Values,
19165
+ noCalculate
19166
+ } = getTwoArrayNumberValues(
19167
+ array1,
19168
+ array2,
19169
+ array1RowCount * array1ColumnCount,
19170
+ array1ColumnCount,
19171
+ array2ColumnCount
19172
+ );
19173
+ return isError ? errorObject : noCalculate ? ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO) : this._getResult(array1Values, array2Values);
19174
+ }
19175
+ _getResult(array1Values, array2Values) {
19176
+ const n = array1Values.length;
19177
+ let array1Sum = 0, array2Sum = 0;
19178
+ for (let i = 0; i < n; i++)
19179
+ array1Sum += array1Values[i], array2Sum += array2Values[i];
19180
+ const array1Mean = array1Sum / n, array2Mean = array2Sum / n;
19181
+ let numerator = 0, array1DiffSum = 0, array2DiffSum = 0;
19182
+ for (let i = 0; i < n; i++) {
19183
+ const array1Diff = array1Values[i] - array1Mean, array2Diff = array2Values[i] - array2Mean;
19184
+ numerator += array1Diff * array2Diff, array1DiffSum += array1Diff ** 2, array2DiffSum += array2Diff ** 2;
19185
+ }
19186
+ const denominator = Math.sqrt(array1DiffSum * array2DiffSum);
19187
+ return denominator === 0 ? ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO) : NumberValueObject.create(numerator / denominator);
19188
+ }
19189
+ };
19190
+ __name(_Correl, "Correl");
19191
+ let Correl = _Correl;
17891
19192
  const _Count = class _Count extends BaseFunction {
17892
19193
  constructor() {
17893
19194
  super(...arguments);
@@ -18002,6 +19303,314 @@ function countTrueValue(array) {
18002
19303
  }), NumberValueObject.create(count);
18003
19304
  }
18004
19305
  __name(countTrueValue, "countTrueValue");
19306
+ const _CovarianceS = class _CovarianceS extends BaseFunction {
19307
+ constructor() {
19308
+ super(...arguments);
19309
+ __publicField(this, "minParams", 2);
19310
+ __publicField(this, "maxParams", 2);
19311
+ }
19312
+ calculate(array1, array2) {
19313
+ const array1RowCount = array1.isArray() ? array1.getRowCount() : 1, array1ColumnCount = array1.isArray() ? array1.getColumnCount() : 1, array2RowCount = array2.isArray() ? array2.getRowCount() : 1, array2ColumnCount = array2.isArray() ? array2.getColumnCount() : 1;
19314
+ let _array1 = array1;
19315
+ if (array1.isArray() && array1RowCount === 1 && array1ColumnCount === 1 && (_array1 = array1.get(0, 0)), _array1.isError())
19316
+ return _array1;
19317
+ let _array2 = array2;
19318
+ if (array2.isArray() && array2RowCount === 1 && array2ColumnCount === 1 && (_array2 = array2.get(0, 0)), _array2.isError())
19319
+ return _array2;
19320
+ if ((array1RowCount * array1ColumnCount === 1 || array2RowCount * array2ColumnCount === 1) && (_array1.isNull() || _array2.isNull()))
19321
+ return ErrorValueObject.create(ErrorType$1.VALUE);
19322
+ if (array1RowCount * array1ColumnCount !== array2RowCount * array2ColumnCount)
19323
+ return ErrorValueObject.create(ErrorType$1.NA);
19324
+ const {
19325
+ isError,
19326
+ errorObject,
19327
+ array1Values,
19328
+ array2Values,
19329
+ noCalculate
19330
+ } = getTwoArrayNumberValues(
19331
+ array1,
19332
+ array2,
19333
+ array1RowCount * array1ColumnCount,
19334
+ array1ColumnCount,
19335
+ array2ColumnCount
19336
+ );
19337
+ return isError ? errorObject : noCalculate ? ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO) : this._getResult(array1Values, array2Values);
19338
+ }
19339
+ _getResult(array1Values, array2Values) {
19340
+ if (array1Values.length <= 1)
19341
+ return ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
19342
+ const n = array1Values.length;
19343
+ let array1Sum = 0, array2Sum = 0;
19344
+ for (let i = 0; i < n; i++)
19345
+ array1Sum += array1Values[i], array2Sum += array2Values[i];
19346
+ const array1Mean = array1Sum / n, array2Mean = array2Sum / n;
19347
+ let numerator = 0;
19348
+ for (let i = 0; i < n; i++) {
19349
+ const array1Diff = array1Values[i] - array1Mean, array2Diff = array2Values[i] - array2Mean;
19350
+ numerator += array1Diff * array2Diff;
19351
+ }
19352
+ return NumberValueObject.create(numerator / (n - 1));
19353
+ }
19354
+ };
19355
+ __name(_CovarianceS, "CovarianceS");
19356
+ let CovarianceS = _CovarianceS;
19357
+ const _Devsq = class _Devsq extends BaseFunction {
19358
+ constructor() {
19359
+ super(...arguments);
19360
+ __publicField(this, "minParams", 1);
19361
+ __publicField(this, "maxParams", 255);
19362
+ }
19363
+ calculate(...variants) {
19364
+ const values = [];
19365
+ let sum2 = 0, noCalculate = !0;
19366
+ for (let i = 0; i < variants.length; i++) {
19367
+ const variant = variants[i];
19368
+ if (variant.isArray()) {
19369
+ let isError = !1, errorObject = ErrorValueObject.create(ErrorType$1.VALUE);
19370
+ if (variant.iterator((valueObject) => {
19371
+ const _valueObject = this._handleSingleObject(valueObject);
19372
+ if (_valueObject.isError())
19373
+ return isError = !0, errorObject = _valueObject, !1;
19374
+ if (_valueObject.isNull())
19375
+ return !0;
19376
+ const value = _valueObject.getValue();
19377
+ values.push(value), sum2 += value, noCalculate = !1;
19378
+ }), isError)
19379
+ return errorObject;
19380
+ } else {
19381
+ const _variant = this._handleSingleObject(variant);
19382
+ if (_variant.isError())
19383
+ return _variant;
19384
+ if (_variant.isNull())
19385
+ continue;
19386
+ const value = _variant.getValue();
19387
+ values.push(value), sum2 += value, noCalculate = !1;
19388
+ }
19389
+ }
19390
+ if (noCalculate)
19391
+ return ErrorValueObject.create(ErrorType$1.NUM);
19392
+ const mean = sum2 / values.length;
19393
+ let result = 0;
19394
+ for (let i = 0; i < values.length; i++)
19395
+ result += (values[i] - mean) ** 2;
19396
+ return NumberValueObject.create(result);
19397
+ }
19398
+ _handleSingleObject(variant) {
19399
+ if (variant.isError())
19400
+ return variant;
19401
+ if (variant.isNull() || variant.isBoolean())
19402
+ return NullValueObject.create();
19403
+ const value = variant.getValue();
19404
+ return isRealNum(value) ? NumberValueObject.create(+value) : NullValueObject.create();
19405
+ }
19406
+ };
19407
+ __name(_Devsq, "Devsq");
19408
+ let Devsq = _Devsq;
19409
+ const _FDist = class _FDist extends BaseFunction {
19410
+ constructor() {
19411
+ super(...arguments);
19412
+ __publicField(this, "minParams", 4);
19413
+ __publicField(this, "maxParams", 4);
19414
+ }
19415
+ calculate(x, degFreedom1, degFreedom2, cumulative) {
19416
+ const maxRowLength = Math.max(
19417
+ x.isArray() ? x.getRowCount() : 1,
19418
+ degFreedom1.isArray() ? degFreedom1.getRowCount() : 1,
19419
+ degFreedom2.isArray() ? degFreedom2.getRowCount() : 1,
19420
+ cumulative.isArray() ? cumulative.getRowCount() : 1
19421
+ ), maxColumnLength = Math.max(
19422
+ x.isArray() ? x.getColumnCount() : 1,
19423
+ degFreedom1.isArray() ? degFreedom1.getColumnCount() : 1,
19424
+ degFreedom2.isArray() ? degFreedom2.getColumnCount() : 1,
19425
+ cumulative.isArray() ? cumulative.getColumnCount() : 1
19426
+ ), xArray = expandArrayValueObject(maxRowLength, maxColumnLength, x, ErrorValueObject.create(ErrorType$1.NA)), degFreedom1Array = expandArrayValueObject(maxRowLength, maxColumnLength, degFreedom1, ErrorValueObject.create(ErrorType$1.NA)), degFreedom2Array = expandArrayValueObject(maxRowLength, maxColumnLength, degFreedom2, ErrorValueObject.create(ErrorType$1.NA)), cumulativeArray = expandArrayValueObject(maxRowLength, maxColumnLength, cumulative, ErrorValueObject.create(ErrorType$1.NA)), resultArray = xArray.mapValue((xObject, rowIndex, columnIndex) => {
19427
+ const degFreedom1Object = degFreedom1Array.get(rowIndex, columnIndex), degFreedom2Object = degFreedom2Array.get(rowIndex, columnIndex), cumulativeObject = cumulativeArray.get(rowIndex, columnIndex);
19428
+ return this._handleSignleObject(xObject, degFreedom1Object, degFreedom2Object, cumulativeObject);
19429
+ });
19430
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
19431
+ }
19432
+ _handleSignleObject(xObject, degFreedom1Object, degFreedom2Object, cumulativeObject) {
19433
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(xObject, degFreedom1Object, degFreedom2Object, cumulativeObject);
19434
+ if (isError)
19435
+ return errorObject;
19436
+ const [_xObject, _degFreedom1Object, _degFreedom2Object, _cumulativeObject] = variants, xValue = +_xObject.getValue(), degFreedom1Value = Math.floor(+_degFreedom1Object.getValue()), degFreedom2Value = Math.floor(+_degFreedom2Object.getValue()), cumulativeValue = +_cumulativeObject.getValue();
19437
+ if (xValue < 0 || degFreedom1Value < 1 || degFreedom1Value > 10 ** 10 || degFreedom2Value < 1 || degFreedom2Value > 10 ** 10)
19438
+ return ErrorValueObject.create(ErrorType$1.NUM);
19439
+ let result;
19440
+ return cumulativeValue ? result = centralFCDF(xValue, degFreedom1Value, degFreedom2Value) : result = centralFPDF(xValue, degFreedom1Value, degFreedom2Value), Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
19441
+ }
19442
+ };
19443
+ __name(_FDist, "FDist");
19444
+ let FDist = _FDist;
19445
+ const _FInv = class _FInv extends BaseFunction {
19446
+ constructor() {
19447
+ super(...arguments);
19448
+ __publicField(this, "minParams", 3);
19449
+ __publicField(this, "maxParams", 3);
19450
+ }
19451
+ calculate(probability, degFreedom1, degFreedom2) {
19452
+ const maxRowLength = Math.max(
19453
+ probability.isArray() ? probability.getRowCount() : 1,
19454
+ degFreedom1.isArray() ? degFreedom1.getRowCount() : 1,
19455
+ degFreedom2.isArray() ? degFreedom2.getRowCount() : 1
19456
+ ), maxColumnLength = Math.max(
19457
+ probability.isArray() ? probability.getColumnCount() : 1,
19458
+ degFreedom1.isArray() ? degFreedom1.getColumnCount() : 1,
19459
+ degFreedom2.isArray() ? degFreedom2.getColumnCount() : 1
19460
+ ), probabilityArray = expandArrayValueObject(maxRowLength, maxColumnLength, probability, ErrorValueObject.create(ErrorType$1.NA)), degFreedom1Array = expandArrayValueObject(maxRowLength, maxColumnLength, degFreedom1, ErrorValueObject.create(ErrorType$1.NA)), degFreedom2Array = expandArrayValueObject(maxRowLength, maxColumnLength, degFreedom2, ErrorValueObject.create(ErrorType$1.NA)), resultArray = probabilityArray.mapValue((probabilityObject, rowIndex, columnIndex) => {
19461
+ const degFreedom1Object = degFreedom1Array.get(rowIndex, columnIndex), degFreedom2Object = degFreedom2Array.get(rowIndex, columnIndex);
19462
+ return this._handleSignleObject(probabilityObject, degFreedom1Object, degFreedom2Object);
19463
+ });
19464
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
19465
+ }
19466
+ _handleSignleObject(probabilityObject, degFreedom1Object, degFreedom2Object) {
19467
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(probabilityObject, degFreedom1Object, degFreedom2Object);
19468
+ if (isError)
19469
+ return errorObject;
19470
+ const [_probabilityObject, _degFreedom1Object, _degFreedom2Object] = variants, probabilityValue = +_probabilityObject.getValue(), degFreedom1Value = Math.floor(+_degFreedom1Object.getValue()), degFreedom2Value = Math.floor(+_degFreedom2Object.getValue());
19471
+ if (probabilityValue < 0 || probabilityValue > 1 || degFreedom1Value < 1 || degFreedom1Value > 10 ** 10 || degFreedom2Value < 1 || degFreedom2Value > 10 ** 10)
19472
+ return ErrorValueObject.create(ErrorType$1.NUM);
19473
+ const result = centralFINV(probabilityValue, degFreedom1Value, degFreedom2Value);
19474
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
19475
+ }
19476
+ };
19477
+ __name(_FInv, "FInv");
19478
+ let FInv = _FInv;
19479
+ const _Fisher = class _Fisher extends BaseFunction {
19480
+ constructor() {
19481
+ super(...arguments);
19482
+ __publicField(this, "minParams", 1);
19483
+ __publicField(this, "maxParams", 1);
19484
+ }
19485
+ calculate(x) {
19486
+ return x.isArray() ? x.mapValue((xObject) => this._handleSingleObject(xObject)) : this._handleSingleObject(x);
19487
+ }
19488
+ _handleSingleObject(x) {
19489
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(x);
19490
+ if (isError)
19491
+ return errorObject;
19492
+ const [xObject] = variants, xValue = xObject.getValue();
19493
+ if (xValue <= -1 || xValue >= 1)
19494
+ return ErrorValueObject.create(ErrorType$1.NUM);
19495
+ const result = Math.log((1 + xValue) / (1 - xValue)) / 2;
19496
+ return NumberValueObject.create(result);
19497
+ }
19498
+ };
19499
+ __name(_Fisher, "Fisher");
19500
+ let Fisher = _Fisher;
19501
+ const _Fisherinv = class _Fisherinv extends BaseFunction {
19502
+ constructor() {
19503
+ super(...arguments);
19504
+ __publicField(this, "minParams", 1);
19505
+ __publicField(this, "maxParams", 1);
19506
+ }
19507
+ calculate(y) {
19508
+ return y.isArray() ? y.mapValue((yObject) => this._handleSingleObject(yObject)) : this._handleSingleObject(y);
19509
+ }
19510
+ _handleSingleObject(y) {
19511
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(y);
19512
+ if (isError)
19513
+ return errorObject;
19514
+ const [yObject] = variants, yValue = +yObject.getValue(), num = Math.exp(2 * yValue) - 1, den = Math.exp(2 * yValue) + 1;
19515
+ return !Number.isFinite(num) && num > 0 && !Number.isFinite(den) && den > 0 ? NumberValueObject.create(1) : NumberValueObject.create(num / den);
19516
+ }
19517
+ };
19518
+ __name(_Fisherinv, "Fisherinv");
19519
+ let Fisherinv = _Fisherinv;
19520
+ const _Forecast = class _Forecast extends BaseFunction {
19521
+ constructor() {
19522
+ super(...arguments);
19523
+ __publicField(this, "minParams", 3);
19524
+ __publicField(this, "maxParams", 3);
19525
+ }
19526
+ calculate(x, knownYs, knownXs) {
19527
+ const knownYsRowCount = knownYs.isArray() ? knownYs.getRowCount() : 1, knownYsColumnCount = knownYs.isArray() ? knownYs.getColumnCount() : 1, knownXsRowCount = knownXs.isArray() ? knownXs.getRowCount() : 1, knownXsColumnCount = knownXs.isArray() ? knownXs.getColumnCount() : 1;
19528
+ let _knownYs = knownYs;
19529
+ knownYs.isArray() && knownYsRowCount === 1 && knownYsColumnCount === 1 && (_knownYs = knownYs.get(0, 0));
19530
+ let _knownXs = knownXs;
19531
+ return knownXs.isArray() && knownXsRowCount === 1 && knownXsColumnCount === 1 && (_knownXs = knownXs.get(0, 0)), x.isArray() ? x.mapValue(
19532
+ (xObject) => this._handleSignleObject(xObject, _knownYs, _knownXs, knownYsRowCount, knownYsColumnCount, knownXsRowCount, knownXsColumnCount)
19533
+ ) : this._handleSignleObject(x, _knownYs, _knownXs, knownYsRowCount, knownYsColumnCount, knownXsRowCount, knownXsColumnCount);
19534
+ }
19535
+ _handleSignleObject(x, knownYs, knownXs, knownYsRowCount, knownYsColumnCount, knownXsRowCount, knownXsColumnCount) {
19536
+ if (x.isError())
19537
+ return x;
19538
+ if (knownYs.isError())
19539
+ return knownYs;
19540
+ if (knownXs.isError())
19541
+ return knownXs;
19542
+ let _x = x;
19543
+ if (x.isString() && (_x = x.convertToNumberObjectValue()), _x.isError())
19544
+ return _x;
19545
+ const xValue = +_x.getValue();
19546
+ if ((knownYsRowCount * knownYsColumnCount === 1 || knownXsRowCount * knownXsColumnCount === 1) && (knownYs.isNull() || knownXs.isNull()))
19547
+ return ErrorValueObject.create(ErrorType$1.VALUE);
19548
+ if (knownYsRowCount * knownYsColumnCount !== knownXsRowCount * knownXsColumnCount)
19549
+ return ErrorValueObject.create(ErrorType$1.NA);
19550
+ const {
19551
+ isError,
19552
+ errorObject,
19553
+ array1Values,
19554
+ array2Values,
19555
+ noCalculate
19556
+ } = getTwoArrayNumberValues(
19557
+ knownYs,
19558
+ knownXs,
19559
+ knownYsRowCount * knownYsColumnCount,
19560
+ knownYsColumnCount,
19561
+ knownXsColumnCount
19562
+ );
19563
+ if (isError)
19564
+ return errorObject;
19565
+ if (noCalculate)
19566
+ return ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
19567
+ const result = forecastLinear(xValue, array1Values, array2Values);
19568
+ return Number.isFinite(result) ? NumberValueObject.create(result) : ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
19569
+ }
19570
+ };
19571
+ __name(_Forecast, "Forecast");
19572
+ let Forecast = _Forecast;
19573
+ var FUNCTION_NAMES_STATISTICAL = /* @__PURE__ */ ((FUNCTION_NAMES_STATISTICAL2) => (FUNCTION_NAMES_STATISTICAL2.AVEDEV = "AVEDEV", FUNCTION_NAMES_STATISTICAL2.AVERAGE = "AVERAGE", FUNCTION_NAMES_STATISTICAL2.AVERAGEA = "AVERAGEA", FUNCTION_NAMES_STATISTICAL2.AVERAGEIF = "AVERAGEIF", FUNCTION_NAMES_STATISTICAL2.AVERAGEIFS = "AVERAGEIFS", FUNCTION_NAMES_STATISTICAL2.BETA_DIST = "BETA.DIST", FUNCTION_NAMES_STATISTICAL2.BETA_INV = "BETA.INV", FUNCTION_NAMES_STATISTICAL2.BINOM_DIST = "BINOM.DIST", FUNCTION_NAMES_STATISTICAL2.BINOM_DIST_RANGE = "BINOM.DIST.RANGE", FUNCTION_NAMES_STATISTICAL2.BINOM_INV = "BINOM.INV", FUNCTION_NAMES_STATISTICAL2.CHISQ_DIST = "CHISQ.DIST", FUNCTION_NAMES_STATISTICAL2.CHISQ_DIST_RT = "CHISQ.DIST.RT", FUNCTION_NAMES_STATISTICAL2.CHISQ_INV = "CHISQ.INV", FUNCTION_NAMES_STATISTICAL2.CHISQ_INV_RT = "CHISQ.INV.RT", FUNCTION_NAMES_STATISTICAL2.CHISQ_TEST = "CHISQ.TEST", FUNCTION_NAMES_STATISTICAL2.CONFIDENCE_NORM = "CONFIDENCE.NORM", FUNCTION_NAMES_STATISTICAL2.CONFIDENCE_T = "CONFIDENCE.T", FUNCTION_NAMES_STATISTICAL2.CORREL = "CORREL", FUNCTION_NAMES_STATISTICAL2.COUNT = "COUNT", FUNCTION_NAMES_STATISTICAL2.COUNTA = "COUNTA", FUNCTION_NAMES_STATISTICAL2.COUNTBLANK = "COUNTBLANK", FUNCTION_NAMES_STATISTICAL2.COUNTIF = "COUNTIF", FUNCTION_NAMES_STATISTICAL2.COUNTIFS = "COUNTIFS", FUNCTION_NAMES_STATISTICAL2.COVARIANCE_P = "COVARIANCE.P", FUNCTION_NAMES_STATISTICAL2.COVARIANCE_S = "COVARIANCE.S", FUNCTION_NAMES_STATISTICAL2.DEVSQ = "DEVSQ", FUNCTION_NAMES_STATISTICAL2.EXPON_DIST = "EXPON.DIST", FUNCTION_NAMES_STATISTICAL2.F_DIST = "F.DIST", FUNCTION_NAMES_STATISTICAL2.F_DIST_RT = "F.DIST.RT", FUNCTION_NAMES_STATISTICAL2.F_INV = "F.INV", FUNCTION_NAMES_STATISTICAL2.F_INV_RT = "F.INV.RT", FUNCTION_NAMES_STATISTICAL2.F_TEST = "F.TEST", FUNCTION_NAMES_STATISTICAL2.FISHER = "FISHER", FUNCTION_NAMES_STATISTICAL2.FISHERINV = "FISHERINV", FUNCTION_NAMES_STATISTICAL2.FORECAST = "FORECAST", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS = "FORECAST.ETS", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS_CONFINT = "FORECAST.ETS.CONFINT", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS_SEASONALITY = "FORECAST.ETS.SEASONALITY", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS_STAT = "FORECAST.ETS.STAT", FUNCTION_NAMES_STATISTICAL2.FORECAST_LINEAR = "FORECAST.LINEAR", FUNCTION_NAMES_STATISTICAL2.FREQUENCY = "FREQUENCY", FUNCTION_NAMES_STATISTICAL2.GAMMA = "GAMMA", FUNCTION_NAMES_STATISTICAL2.GAMMA_DIST = "GAMMA.DIST", FUNCTION_NAMES_STATISTICAL2.GAMMA_INV = "GAMMA.INV", FUNCTION_NAMES_STATISTICAL2.GAMMALN = "GAMMALN", FUNCTION_NAMES_STATISTICAL2.GAMMALN_PRECISE = "GAMMALN.PRECISE", FUNCTION_NAMES_STATISTICAL2.GAUSS = "GAUSS", FUNCTION_NAMES_STATISTICAL2.GEOMEAN = "GEOMEAN", FUNCTION_NAMES_STATISTICAL2.GROWTH = "GROWTH", FUNCTION_NAMES_STATISTICAL2.HARMEAN = "HARMEAN", FUNCTION_NAMES_STATISTICAL2.HYPGEOM_DIST = "HYPGEOM.DIST", FUNCTION_NAMES_STATISTICAL2.INTERCEPT = "INTERCEPT", FUNCTION_NAMES_STATISTICAL2.KURT = "KURT", FUNCTION_NAMES_STATISTICAL2.LARGE = "LARGE", FUNCTION_NAMES_STATISTICAL2.LINEST = "LINEST", FUNCTION_NAMES_STATISTICAL2.LOGEST = "LOGEST", FUNCTION_NAMES_STATISTICAL2.LOGNORM_DIST = "LOGNORM.DIST", FUNCTION_NAMES_STATISTICAL2.LOGNORM_INV = "LOGNORM.INV", FUNCTION_NAMES_STATISTICAL2.MAX = "MAX", FUNCTION_NAMES_STATISTICAL2.MAXA = "MAXA", FUNCTION_NAMES_STATISTICAL2.MAXIFS = "MAXIFS", FUNCTION_NAMES_STATISTICAL2.MEDIAN = "MEDIAN", FUNCTION_NAMES_STATISTICAL2.MIN = "MIN", FUNCTION_NAMES_STATISTICAL2.MINA = "MINA", FUNCTION_NAMES_STATISTICAL2.MINIFS = "MINIFS", FUNCTION_NAMES_STATISTICAL2.MODE_MULT = "MODE.MULT", FUNCTION_NAMES_STATISTICAL2.MODE_SNGL = "MODE.SNGL", FUNCTION_NAMES_STATISTICAL2.NEGBINOM_DIST = "NEGBINOM.DIST", FUNCTION_NAMES_STATISTICAL2.NORM_DIST = "NORM.DIST", FUNCTION_NAMES_STATISTICAL2.NORM_INV = "NORM.INV", FUNCTION_NAMES_STATISTICAL2.NORM_S_DIST = "NORM.S.DIST", FUNCTION_NAMES_STATISTICAL2.NORM_S_INV = "NORM.S.INV", FUNCTION_NAMES_STATISTICAL2.PEARSON = "PEARSON", FUNCTION_NAMES_STATISTICAL2.PERCENTILE_EXC = "PERCENTILE.EXC", FUNCTION_NAMES_STATISTICAL2.PERCENTILE_INC = "PERCENTILE.INC", FUNCTION_NAMES_STATISTICAL2.PERCENTRANK_EXC = "PERCENTRANK.EXC", FUNCTION_NAMES_STATISTICAL2.PERCENTRANK_INC = "PERCENTRANK.INC", FUNCTION_NAMES_STATISTICAL2.PERMUT = "PERMUT", FUNCTION_NAMES_STATISTICAL2.PERMUTATIONA = "PERMUTATIONA", FUNCTION_NAMES_STATISTICAL2.PHI = "PHI", FUNCTION_NAMES_STATISTICAL2.POISSON_DIST = "POISSON.DIST", FUNCTION_NAMES_STATISTICAL2.PROB = "PROB", FUNCTION_NAMES_STATISTICAL2.QUARTILE_EXC = "QUARTILE.EXC", FUNCTION_NAMES_STATISTICAL2.QUARTILE_INC = "QUARTILE.INC", FUNCTION_NAMES_STATISTICAL2.RANK_AVG = "RANK.AVG", FUNCTION_NAMES_STATISTICAL2.RANK_EQ = "RANK.EQ", FUNCTION_NAMES_STATISTICAL2.RSQ = "RSQ", FUNCTION_NAMES_STATISTICAL2.SKEW = "SKEW", FUNCTION_NAMES_STATISTICAL2.SKEW_P = "SKEW.P", FUNCTION_NAMES_STATISTICAL2.SLOPE = "SLOPE", FUNCTION_NAMES_STATISTICAL2.SMALL = "SMALL", FUNCTION_NAMES_STATISTICAL2.STANDARDIZE = "STANDARDIZE", FUNCTION_NAMES_STATISTICAL2.STDEV_P = "STDEV.P", FUNCTION_NAMES_STATISTICAL2.STDEV_S = "STDEV.S", FUNCTION_NAMES_STATISTICAL2.STDEVA = "STDEVA", FUNCTION_NAMES_STATISTICAL2.STDEVPA = "STDEVPA", FUNCTION_NAMES_STATISTICAL2.STEYX = "STEYX", FUNCTION_NAMES_STATISTICAL2.T_DIST = "T.DIST", FUNCTION_NAMES_STATISTICAL2.T_DIST_2T = "T.DIST.2T", FUNCTION_NAMES_STATISTICAL2.T_DIST_RT = "T.DIST.RT", FUNCTION_NAMES_STATISTICAL2.T_INV = "T.INV", FUNCTION_NAMES_STATISTICAL2.T_INV_2T = "T.INV.2T", FUNCTION_NAMES_STATISTICAL2.T_TEST = "T.TEST", FUNCTION_NAMES_STATISTICAL2.TREND = "TREND", FUNCTION_NAMES_STATISTICAL2.TRIMMEAN = "TRIMMEAN", FUNCTION_NAMES_STATISTICAL2.VAR_P = "VAR.P", FUNCTION_NAMES_STATISTICAL2.VAR_S = "VAR.S", FUNCTION_NAMES_STATISTICAL2.VARA = "VARA", FUNCTION_NAMES_STATISTICAL2.VARPA = "VARPA", FUNCTION_NAMES_STATISTICAL2.WEIBULL_DIST = "WEIBULL.DIST", FUNCTION_NAMES_STATISTICAL2.Z_TEST = "Z.TEST", FUNCTION_NAMES_STATISTICAL2))(FUNCTION_NAMES_STATISTICAL || {});
19574
+ const _Intercept = class _Intercept extends BaseFunction {
19575
+ constructor() {
19576
+ super(...arguments);
19577
+ __publicField(this, "minParams", 2);
19578
+ __publicField(this, "maxParams", 2);
19579
+ }
19580
+ calculate(knownYs, knownXs) {
19581
+ const knownYsRowCount = knownYs.isArray() ? knownYs.getRowCount() : 1, knownYsColumnCount = knownYs.isArray() ? knownYs.getColumnCount() : 1, knownXsRowCount = knownXs.isArray() ? knownXs.getRowCount() : 1, knownXsColumnCount = knownXs.isArray() ? knownXs.getColumnCount() : 1;
19582
+ let _knownYs = knownYs;
19583
+ if (knownYs.isArray() && knownYsRowCount === 1 && knownYsColumnCount === 1 && (_knownYs = knownYs.get(0, 0)), _knownYs.isError())
19584
+ return _knownYs;
19585
+ let _knownXs = knownXs;
19586
+ if (knownXs.isArray() && knownXsRowCount === 1 && knownXsColumnCount === 1 && (_knownXs = knownXs.get(0, 0)), _knownXs.isError())
19587
+ return _knownXs;
19588
+ if (knownYsRowCount * knownYsColumnCount === 1 || knownXsRowCount * knownXsColumnCount === 1)
19589
+ return knownYs.isNull() || knownXs.isNull() ? ErrorValueObject.create(ErrorType$1.VALUE) : ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
19590
+ if (knownYsRowCount * knownYsColumnCount !== knownXsRowCount * knownXsColumnCount)
19591
+ return ErrorValueObject.create(ErrorType$1.NA);
19592
+ const {
19593
+ isError,
19594
+ errorObject,
19595
+ array1Values,
19596
+ array2Values,
19597
+ noCalculate
19598
+ } = getTwoArrayNumberValues(
19599
+ knownYs,
19600
+ knownXs,
19601
+ knownYsRowCount * knownYsColumnCount,
19602
+ knownYsColumnCount,
19603
+ knownXsColumnCount
19604
+ );
19605
+ return isError ? errorObject : noCalculate ? ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO) : this._getResult(array1Values, array2Values);
19606
+ }
19607
+ _getResult(knownYs, knownXs) {
19608
+ const result = forecastLinear(0, knownYs, knownXs);
19609
+ return Number.isFinite(result) ? NumberValueObject.create(result) : ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
19610
+ }
19611
+ };
19612
+ __name(_Intercept, "Intercept");
19613
+ let Intercept = _Intercept;
18005
19614
  const _Max = class _Max extends BaseFunction {
18006
19615
  constructor() {
18007
19616
  super(...arguments);
@@ -18190,6 +19799,36 @@ const _Minifs = class _Minifs extends BaseFunction {
18190
19799
  };
18191
19800
  __name(_Minifs, "Minifs");
18192
19801
  let Minifs = _Minifs;
19802
+ const _NormSDist = class _NormSDist extends BaseFunction {
19803
+ constructor() {
19804
+ super(...arguments);
19805
+ __publicField(this, "minParams", 2);
19806
+ __publicField(this, "maxParams", 2);
19807
+ }
19808
+ calculate(z, cumulative) {
19809
+ const maxRowLength = Math.max(
19810
+ z.isArray() ? z.getRowCount() : 1,
19811
+ cumulative.isArray() ? cumulative.getRowCount() : 1
19812
+ ), maxColumnLength = Math.max(
19813
+ z.isArray() ? z.getColumnCount() : 1,
19814
+ cumulative.isArray() ? cumulative.getColumnCount() : 1
19815
+ ), zArray = expandArrayValueObject(maxRowLength, maxColumnLength, z, ErrorValueObject.create(ErrorType$1.NA)), cumulativeArray = expandArrayValueObject(maxRowLength, maxColumnLength, cumulative, ErrorValueObject.create(ErrorType$1.NA)), resultArray = zArray.mapValue((zObject, rowIndex, columnIndex) => {
19816
+ const cumulativeObject = cumulativeArray.get(rowIndex, columnIndex);
19817
+ return this._handleSignleObject(zObject, cumulativeObject);
19818
+ });
19819
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
19820
+ }
19821
+ _handleSignleObject(zObject, cumulativeObject) {
19822
+ const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(zObject, cumulativeObject);
19823
+ if (isError)
19824
+ return errorObject;
19825
+ const [_zObject, _cumulativeObject] = variants, zValue = +_zObject.getValue(), cumulativeValue = +_cumulativeObject.getValue();
19826
+ let result;
19827
+ return cumulativeValue ? result = normalCDF(zValue, 0, 1) : result = normalPDF(zValue, 0, 1), NumberValueObject.create(result);
19828
+ }
19829
+ };
19830
+ __name(_NormSDist, "NormSDist");
19831
+ let NormSDist = _NormSDist;
18193
19832
  const _RankAvg = class _RankAvg extends BaseFunction {
18194
19833
  constructor() {
18195
19834
  super(...arguments);
@@ -18380,17 +20019,48 @@ const functionStatistical = [
18380
20019
  [Averagea, FUNCTION_NAMES_STATISTICAL.AVERAGEA],
18381
20020
  [Averageif, FUNCTION_NAMES_STATISTICAL.AVERAGEIF],
18382
20021
  [Averageifs, FUNCTION_NAMES_STATISTICAL.AVERAGEIFS],
20022
+ [BetaDist, FUNCTION_NAMES_STATISTICAL.BETA_DIST],
20023
+ [BetaInv, FUNCTION_NAMES_STATISTICAL.BETA_INV],
20024
+ [BinomDist, FUNCTION_NAMES_STATISTICAL.BINOM_DIST],
20025
+ [BinomDistRange, FUNCTION_NAMES_STATISTICAL.BINOM_DIST_RANGE],
20026
+ [BinomInv, FUNCTION_NAMES_STATISTICAL.BINOM_INV],
20027
+ [ChisqDist, FUNCTION_NAMES_STATISTICAL.CHISQ_DIST],
20028
+ [ChisqDistRt, FUNCTION_NAMES_STATISTICAL.CHISQ_DIST_RT],
20029
+ [ChisqInv, FUNCTION_NAMES_STATISTICAL.CHISQ_INV],
20030
+ [ChisqInvRt, FUNCTION_NAMES_STATISTICAL.CHISQ_INV_RT],
20031
+ [ChisqTest, FUNCTION_NAMES_STATISTICAL.CHISQ_TEST],
20032
+ [ConfidenceNorm, FUNCTION_NAMES_STATISTICAL.CONFIDENCE_NORM],
20033
+ [ConfidenceT, FUNCTION_NAMES_STATISTICAL.CONFIDENCE_T],
20034
+ [Correl, FUNCTION_NAMES_STATISTICAL.CORREL],
18383
20035
  [Count, FUNCTION_NAMES_STATISTICAL.COUNT],
18384
20036
  [Counta, FUNCTION_NAMES_STATISTICAL.COUNTA],
18385
20037
  [Countblank, FUNCTION_NAMES_STATISTICAL.COUNTBLANK],
18386
20038
  [Countif, FUNCTION_NAMES_STATISTICAL.COUNTIF],
18387
20039
  [Countifs, FUNCTION_NAMES_STATISTICAL.COUNTIFS],
20040
+ [CovarianceP, FUNCTION_NAMES_STATISTICAL.COVARIANCE_P],
20041
+ [CovarianceS, FUNCTION_NAMES_STATISTICAL.COVARIANCE_S],
20042
+ [Devsq, FUNCTION_NAMES_STATISTICAL.DEVSQ],
20043
+ [ExponDist, FUNCTION_NAMES_STATISTICAL.EXPON_DIST],
20044
+ [FDist, FUNCTION_NAMES_STATISTICAL.F_DIST],
20045
+ [FDistRt, FUNCTION_NAMES_STATISTICAL.F_DIST_RT],
20046
+ [FInv, FUNCTION_NAMES_STATISTICAL.F_INV],
20047
+ [FInvRt, FUNCTION_NAMES_STATISTICAL.F_INV_RT],
20048
+ [FTest, FUNCTION_NAMES_STATISTICAL.F_TEST],
20049
+ [Fisher, FUNCTION_NAMES_STATISTICAL.FISHER],
20050
+ [Fisherinv, FUNCTION_NAMES_STATISTICAL.FISHERINV],
20051
+ [Forecast, FUNCTION_NAMES_STATISTICAL.FORECAST],
20052
+ [Forecast, FUNCTION_NAMES_STATISTICAL.FORECAST_LINEAR],
20053
+ [Intercept, FUNCTION_NAMES_STATISTICAL.INTERCEPT],
18388
20054
  [Max, FUNCTION_NAMES_STATISTICAL.MAX],
18389
20055
  [Maxa, FUNCTION_NAMES_STATISTICAL.MAXA],
18390
20056
  [Maxifs, FUNCTION_NAMES_STATISTICAL.MAXIFS],
18391
20057
  [Min, FUNCTION_NAMES_STATISTICAL.MIN],
18392
20058
  [Mina, FUNCTION_NAMES_STATISTICAL.MINA],
18393
20059
  [Minifs, FUNCTION_NAMES_STATISTICAL.MINIFS],
20060
+ [NormDist, FUNCTION_NAMES_STATISTICAL.NORM_DIST],
20061
+ [NormInv, FUNCTION_NAMES_STATISTICAL.NORM_INV],
20062
+ [NormSDist, FUNCTION_NAMES_STATISTICAL.NORM_S_DIST],
20063
+ [NormSInv, FUNCTION_NAMES_STATISTICAL.NORM_S_INV],
18394
20064
  [RankAvg, FUNCTION_NAMES_STATISTICAL.RANK_AVG],
18395
20065
  [RankEq, FUNCTION_NAMES_STATISTICAL.RANK_EQ],
18396
20066
  [StdevP, FUNCTION_NAMES_STATISTICAL.STDEV_P],