@sheetxl/formulas-extended 0.7.28-beta.3 → 0.7.28-beta.4

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 (34) hide show
  1. package/browser/cjs/index.cjs +1 -1
  2. package/{node/esm/C8ez6oBw4sdDzSct.mjs → browser/esm/BKnXVC21NesUzU9t.mjs} +1 -1
  3. package/browser/esm/{Lw7SD9UV2xQaHBMY.mjs → BybuwnuafVL8RdTx.mjs} +1 -1
  4. package/browser/esm/{CYm12WYrfdzPk8cm.mjs → C2TyRseZg5dWtMq1.mjs} +1 -1
  5. package/{node/esm/Cmx9jVLihcV7UU9j.mjs → browser/esm/CN-pAKHIFQkkdFFB.mjs} +1 -1
  6. package/browser/esm/{CLQ1_t-YsFFTRbw1.mjs → CShl-IMQIPnBMVpb.mjs} +1 -1
  7. package/{node/esm/C1Of99Li1xuXVvHC.mjs → browser/esm/CsrMSYiKGo3-I_Qk.mjs} +1 -1
  8. package/browser/esm/{CEzXDdvqDDZbH1WV.mjs → DnFUggiR6cNYknMt.mjs} +1 -1
  9. package/browser/esm/{DEQPjlaWWG7gXPtm.mjs → DoS1jziW_TXjkH37.mjs} +1 -1
  10. package/{node/esm/CVd2CtlxuMv1IuIq.mjs → browser/esm/DsJzZKURvUm7apNu.mjs} +1 -1
  11. package/browser/esm/{D-wUpQDKX_k0SiSj.mjs → DxiRpwBhgWoK5Erd.mjs} +1 -1
  12. package/browser/esm/{CzzpVN7fGDVLTBAQ.mjs → XATNfSb9mKkYP5Fr.mjs} +1 -1
  13. package/{node/esm/DN1_rspUH-tOwmED.mjs → browser/esm/ffkoQUSdLhFyILRL.mjs} +1 -1
  14. package/browser/esm/{BXjhl9UdRwdpTLAB.mjs → fhXUc-E6MSehd9Ep.mjs} +1 -1
  15. package/browser/esm/index.mjs +352 -302
  16. package/browser/esm/{v_larpTXJns5MbG8.mjs → y9VKeU12ARR9HmtI.mjs} +1 -1
  17. package/{browser/esm/C8ez6oBw4sdDzSct.mjs → node/esm/BKnXVC21NesUzU9t.mjs} +1 -1
  18. package/node/esm/{CVifmXw-tD8LimNW.mjs → C21UeAwlG4Qkfu1Z.mjs} +1 -1
  19. package/node/esm/{CYm12WYrfdzPk8cm.mjs → C2TyRseZg5dWtMq1.mjs} +1 -1
  20. package/{browser/esm/Cmx9jVLihcV7UU9j.mjs → node/esm/CN-pAKHIFQkkdFFB.mjs} +1 -1
  21. package/node/esm/{CLQ1_t-YsFFTRbw1.mjs → CShl-IMQIPnBMVpb.mjs} +1 -1
  22. package/{browser/esm/C1Of99Li1xuXVvHC.mjs → node/esm/CsrMSYiKGo3-I_Qk.mjs} +1 -1
  23. package/node/esm/{DEQPjlaWWG7gXPtm.mjs → DoS1jziW_TXjkH37.mjs} +1 -1
  24. package/{browser/esm/CVd2CtlxuMv1IuIq.mjs → node/esm/DsJzZKURvUm7apNu.mjs} +1 -1
  25. package/node/esm/{D-wUpQDKX_k0SiSj.mjs → DxiRpwBhgWoK5Erd.mjs} +1 -1
  26. package/node/esm/{CzzpVN7fGDVLTBAQ.mjs → XATNfSb9mKkYP5Fr.mjs} +1 -1
  27. package/{browser/esm/DN1_rspUH-tOwmED.mjs → node/esm/ffkoQUSdLhFyILRL.mjs} +1 -1
  28. package/node/esm/{BXjhl9UdRwdpTLAB.mjs → fhXUc-E6MSehd9Ep.mjs} +1 -1
  29. package/node/esm/index.mjs +849 -797
  30. package/node/esm/{BfPVZqcuHtLRxqLI.mjs → v9tvQuvQYcFQ0zOs.mjs} +1 -1
  31. package/node/esm/{v_larpTXJns5MbG8.mjs → y9VKeU12ARR9HmtI.mjs} +1 -1
  32. package/package.json +3 -3
  33. package/types/src/_utils/FinanceUtils.d.ts +17 -0
  34. package/types/src/financial/Financial.d.ts +3 -7
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/formulas-extended - Formulas Enterprise - TypeScript formulas compatible with Excel built-ins. - v0.7.28-beta.3
2
+ * @license @sheetxl/formulas-extended - Formulas Enterprise - TypeScript formulas compatible with Excel built-ins. - v0.7.28-beta.4
3
3
  *
4
4
  * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -12,22 +12,22 @@ var a = Object.defineProperty, o = (t, n) => {
12
12
  enumerable: !0
13
13
  });
14
14
  return n || a(e, Symbol.toStringTag, { value: "Module" }), e;
15
- }, s = o({
16
- CUBEKPIMEMBER: () => i,
17
- CUBEMEMBER: () => l,
18
- CUBEMEMBERPROPERTY: () => u,
15
+ }, i = o({
16
+ CUBEKPIMEMBER: () => s,
17
+ CUBEMEMBER: () => u,
18
+ CUBEMEMBERPROPERTY: () => l,
19
19
  CUBERANKEDMEMBER: () => f,
20
20
  CUBESET: () => c,
21
21
  CUBESETCOUNT: () => m,
22
22
  CUBEVALUE: () => h
23
23
  });
24
- function i(t, e, r, a) {
24
+ function s(t, e, r, a) {
25
25
  throw n.BuiltIn.NA;
26
26
  }
27
- function l(t, e, r) {
27
+ function u(t, e, r) {
28
28
  throw n.BuiltIn.NA;
29
29
  }
30
- function u(t, e, r) {
30
+ function l(t, e, r) {
31
31
  throw n.BuiltIn.NA;
32
32
  }
33
33
  function f(t, e, r, a) {
@@ -69,30 +69,30 @@ var M = [
69
69
  30,
70
70
  31
71
71
  ];
72
- function D(t) {
72
+ function N(t) {
73
73
  return t % 4 == 0 && t % 100 != 0 || t % 400 == 0;
74
74
  }
75
- function d(t, n) {
76
- return D(t) ? M[n] : p[n];
75
+ function D(t, n) {
76
+ return N(t) ? M[n] : p[n];
77
77
  }
78
- function g(t, n, e) {
79
- return d(t, n) === e;
78
+ function d(t, n, e) {
79
+ return D(t, n) === e;
80
80
  }
81
- function N(t, n) {
81
+ function g(t, n) {
82
82
  return Math.trunc(t) - Math.trunc(n);
83
83
  }
84
84
  function y(n, e) {
85
85
  const r = t.fromSerialDate(n, !0), a = t.fromSerialDate(e, !0), o = a.getFullYear() - r.getFullYear();
86
86
  if (o > 1) return !0;
87
87
  if (o < 1) return !1;
88
- const s = a.getMonth() - r.getMonth();
89
- return s > 0 || !(s < 0) && a.getDate() > r.getDate();
88
+ const i = a.getMonth() - r.getMonth();
89
+ return i > 0 || !(i < 0) && a.getDate() > r.getDate();
90
90
  }
91
91
  function b(t, n) {
92
- if (g(t.getFullYear(), t.getMonth(), t.getDate())) {
92
+ if (d(t.getFullYear(), t.getMonth(), t.getDate())) {
93
93
  t.setDate(1), t.setMonth(t.getMonth() + n);
94
94
  const e = t.getFullYear(), r = t.getMonth();
95
- t.setDate(d(e, r));
95
+ t.setDate(D(e, r));
96
96
  } else t.setMonth(t.getMonth() + n);
97
97
  return t;
98
98
  }
@@ -109,11 +109,11 @@ function I(n, e, r) {
109
109
  switch (r) {
110
110
  case 0: return function(t, n) {
111
111
  const e = v(t), r = v(n), a = e.year, o = e.month;
112
- let s = e.day, i = r.year, l = r.month, u = r.day, f = !1;
113
- 2 === o ? s === (D(a) ? 29 : 28) && (s = 30, f = !0) : 31 === s && (s = 30);
114
- 31 !== u || f || (s < 30 ? (12 === l ? (i += 1, l = 1) : l += 1, u = 1) : u = 30);
112
+ let i = e.day, s = r.year, u = r.month, l = r.day, f = !1;
113
+ 2 === o ? i === (N(a) ? 29 : 28) && (i = 30, f = !0) : 31 === i && (i = 30);
114
+ 31 !== l || f || (i < 30 ? (12 === u ? (s += 1, u = 1) : u += 1, l = 1) : l = 30);
115
115
  return {
116
- days: Math.abs(R(a, o, s, i, l, u)),
116
+ days: Math.abs(R(a, o, i, s, u, l)),
117
117
  yearDays: 360
118
118
  };
119
119
  }(n, e);
@@ -122,16 +122,16 @@ function I(n, e, r) {
122
122
  days: 0,
123
123
  yearDays: 365
124
124
  };
125
- const r = v(n), a = v(e), o = r.year, s = a.year, i = Math.abs(e - n), l = Math.abs(s - o), u = l + 1, f = s < o ? s : o, c = s < o ? o : s;
125
+ const r = v(n), a = v(e), o = r.year, i = a.year, s = Math.abs(e - n), u = Math.abs(i - o), l = u + 1, f = i < o ? i : o, c = i < o ? o : i;
126
126
  let m, h = t.getSerialDate(f, 1, 1);
127
127
  1900 === f && (h += 1);
128
- if (0 === l) m = t.getSerialDate(f, 12, 31) - h + 1;
129
- else if (1 === l) {
130
- const r = Math.min(n, e), a = Math.max(n, e), o = v(r), s = v(a), i = s.month - o.month;
131
- if (i > 0 || 0 === i && s.day > o.day) m = (t.getSerialDate(c + 1, 1, 1) - h) / u;
128
+ if (0 === u) m = t.getSerialDate(f, 12, 31) - h + 1;
129
+ else if (1 === u) {
130
+ const r = Math.min(n, e), a = Math.max(n, e), o = v(r), i = v(a), s = i.month - o.month;
131
+ if (s > 0 || 0 === s && i.day > o.day) m = (t.getSerialDate(c + 1, 1, 1) - h) / l;
132
132
  else {
133
133
  m = 365;
134
- for (const n of [f, c]) if (D(n)) {
134
+ for (const n of [f, c]) if (N(n)) {
135
135
  const e = t.getSerialDate(n, 2, 29);
136
136
  if (e >= r && e <= a) {
137
137
  m = 366;
@@ -139,9 +139,9 @@ function I(n, e, r) {
139
139
  }
140
140
  }
141
141
  }
142
- } else m = (t.getSerialDate(c + 1, 1, 1) - h) / u;
142
+ } else m = (t.getSerialDate(c + 1, 1, 1) - h) / l;
143
143
  return {
144
- days: i,
144
+ days: s,
145
145
  yearDays: m
146
146
  };
147
147
  }(n, e);
@@ -177,139 +177,139 @@ function C(t, n) {
177
177
  function T(n, e, r) {
178
178
  const a = t.fromSerialDate(n, !0);
179
179
  let o = t.fromSerialDate(e, !0);
180
- const s = 12 / r;
181
- for (o = C(o, a.getFullYear()), o > a && (o = C(o, o.getFullYear() - 1)); o <= a;) o = b(o, s);
182
- return o = b(o, -s), o;
180
+ const i = 12 / r;
181
+ for (o = C(o, a.getFullYear()), o > a && (o = C(o, o.getFullYear() - 1)); o <= a;) o = b(o, i);
182
+ return o = b(o, -i), o;
183
183
  }
184
- function A(n, e, r) {
184
+ function x(n, e, r) {
185
185
  return t.toSerialDate(T(n, e, r), !0);
186
186
  }
187
- function w(n, e, r) {
187
+ function A(n, e, r) {
188
188
  const a = b(T(n, e, r), 12 / r);
189
189
  return t.toSerialDate(a, !0);
190
190
  }
191
- function x(t, n, e, r) {
192
- return S(A(t, n, e), t, r);
191
+ function w(t, n, e, r) {
192
+ return S(x(t, n, e), t, r);
193
193
  }
194
194
  function V(n, e, r, a) {
195
195
  if (3 === a) return 365 / r;
196
196
  if (1 !== a) return 360 / r;
197
- const o = A(n, e, r), s = b(t.fromSerialDate(o, !0), 12 / r), i = t.toSerialDate(s, !0);
198
- return o < 0 && 1 === r ? 365 : i - o;
197
+ const o = x(n, e, r), i = b(t.fromSerialDate(o, !0), 12 / r), s = t.toSerialDate(i, !0);
198
+ return o < 0 && 1 === r ? 365 : s - o;
199
199
  }
200
200
  function B(n, e, r) {
201
201
  const a = t.fromSerialDate(n, !0);
202
202
  let o = t.fromSerialDate(e, !0);
203
- const s = 12 / r;
204
- let i = 0;
205
- for (; o > a;) o = b(o, -s), i++;
206
- return i;
203
+ const i = 12 / r;
204
+ let s = 0;
205
+ for (; o > a;) o = b(o, -i), s++;
206
+ return s;
207
207
  }
208
208
  function O(n, e, r) {
209
209
  let a = t.fromSerialDate(n, !0);
210
210
  if (a = b(a, e), r) {
211
211
  const t = a.getFullYear(), n = a.getMonth();
212
- a.setDate(d(t, n));
212
+ a.setDate(D(t, n));
213
213
  }
214
214
  return t.toSerialDate(a, !0);
215
215
  }
216
- function P(n, e, r, a, o, s, i, l, u) {
217
- const f = S(r, a, u), c = V(n, a, l, u);
218
- return f < c ? function(t, n, e, r, a, o, s, i, l, u, f) {
219
- const c = B(t, n, i), m = S(t, r, l), h = S(e, t, l), M = o / i, p = 100 * a / i, D = p * u / f;
220
- let d = s / (1 + M) ** (c - 1 + m / f);
221
- d += D / (1 + M) ** (m / f);
222
- for (let t = 2; t <= c; t++) d += p / (1 + M) ** (t - 1 + m / f);
223
- return d -= p * h / f, d;
224
- }(n, e, r, a, o, s, i, l, u, f, c) : function(n, e, r, a, o, s, i, l, u, f) {
225
- const c = B(a, e, l), m = function(n, e, r, a) {
226
- const o = t.fromSerialDate(n, !0), s = t.fromSerialDate(e, !0), i = o.getFullYear(), l = o.getMonth(), u = o.getDate(), f = s.getFullYear(), c = s.getMonth(), m = s.getDate(), h = g(i, l, u) || 1 !== l && u > 28 && u < d(i, l) && g(f, c, m), M = O(e, 0, h);
227
- let p = (a ? 1 : 0) + (e < M ? 1 : 0), D = O(M, r, h);
228
- for (; r > 0 ? D < e : D > e;) D = O(D, r, h), p++;
216
+ function P(n, e, r, a, o, i, s, u, l) {
217
+ const f = S(r, a, l), c = V(n, a, u, l);
218
+ return f < c ? function(t, n, e, r, a, o, i, s, u, l, f) {
219
+ const c = B(t, n, s), m = S(t, r, u), h = S(e, t, u), M = o / s, p = 100 * a / s, N = p * l / f;
220
+ let D = i / (1 + M) ** (c - 1 + m / f);
221
+ D += N / (1 + M) ** (m / f);
222
+ for (let t = 2; t <= c; t++) D += p / (1 + M) ** (t - 1 + m / f);
223
+ return D -= p * h / f, D;
224
+ }(n, e, r, a, o, i, s, u, l, f, c) : function(n, e, r, a, o, i, s, u, l, f) {
225
+ const c = B(a, e, u), m = function(n, e, r, a) {
226
+ const o = t.fromSerialDate(n, !0), i = t.fromSerialDate(e, !0), s = o.getFullYear(), u = o.getMonth(), l = o.getDate(), f = i.getFullYear(), c = i.getMonth(), m = i.getDate(), h = d(s, u, l) || 1 !== u && l > 28 && l < D(s, u) && d(f, c, m), M = O(e, 0, h);
227
+ let p = (a ? 1 : 0) + (e < M ? 1 : 0), N = O(M, r, h);
228
+ for (; r > 0 ? N < e : N > e;) N = O(N, r, h), p++;
229
229
  return p;
230
- }(a, n, 12 / l, !0);
230
+ }(a, n, 12 / u, !0);
231
231
  let h;
232
- h = 2 === u || 3 === u ? S(n, w(n, a, l), u) : f - S(A(n, a, l), n, u);
233
- const M = s / l, p = 100 * o / l;
234
- let D = i / (1 + M) ** (c + m + h / f);
235
- const N = B(r, a, l);
232
+ h = 2 === l || 3 === l ? S(n, A(n, a, u), l) : f - S(x(n, a, u), n, l);
233
+ const M = i / u, p = 100 * o / u;
234
+ let N = s / (1 + M) ** (c + m + h / f);
235
+ const g = B(r, a, u);
236
236
  let y = a, E = 0, v = 0;
237
- for (let e = N; e >= 1; e--) {
238
- const a = t.fromSerialDate(y, !0), o = t.toSerialDate(b(a, -12 / l), !0), s = 1 === u ? S(o, y, u) : f;
239
- E += (e > 1 ? s : S(r, y, u)) / s;
240
- const i = Math.max(r, o), c = Math.min(n, y);
241
- v += (i < c ? S(i, c, u) : 0) / s, y = o;
237
+ for (let e = g; e >= 1; e--) {
238
+ const a = t.fromSerialDate(y, !0), o = t.toSerialDate(b(a, -12 / u), !0), i = 1 === l ? S(o, y, l) : f;
239
+ E += (e > 1 ? i : S(r, y, l)) / i;
240
+ const s = Math.max(r, o), c = Math.min(n, y);
241
+ v += (s < c ? S(s, c, l) : 0) / i, y = o;
242
242
  }
243
- D += p * E / (1 + M) ** (m + h / f);
244
- for (let t = 1; t <= c; t++) D += p / (1 + M) ** (t + m + h / f);
245
- return D -= p * v, D;
246
- }(n, e, r, a, o, s, i, l, u, c);
247
- }
248
- function F(t, n, e, r, a, o, s) {
249
- const i = B(t, n, o), l = V(t, n, o, s), u = x(t, n, o, s), f = l - u, c = 100 * e / o, m = r / o;
250
- if (1 === i) return (c + a) / (m * f / l + 1) - c * u / l;
251
- let h = a / (1 + m) ** (i - 1 + f / l);
252
- for (let t = 1; t <= i; t++) h += c / (1 + m) ** (t - 1 + f / l);
253
- return h -= c * u / l, h;
243
+ N += p * E / (1 + M) ** (m + h / f);
244
+ for (let t = 1; t <= c; t++) N += p / (1 + M) ** (t + m + h / f);
245
+ return N -= p * v, N;
246
+ }(n, e, r, a, o, i, s, u, l, c);
247
+ }
248
+ function F(t, n, e, r, a, o, i) {
249
+ const s = B(t, n, o), u = V(t, n, o, i), l = w(t, n, o, i), f = u - l, c = 100 * e / o, m = r / o;
250
+ if (1 === s) return (c + a) / (m * f / u + 1) - c * l / u;
251
+ let h = a / (1 + m) ** (s - 1 + f / u);
252
+ for (let t = 1; t <= s; t++) h += c / (1 + m) ** (t - 1 + f / u);
253
+ return h -= c * l / u, h;
254
254
  }
255
255
  function Y(t, n, e, r, a, o) {
256
- const s = x(t, n, a, o), i = V(t, n, a, o), l = B(t, n, a), u = (i - s) / i - 1, f = 1 + r / a, c = 100 * e / a;
256
+ const i = w(t, n, a, o), s = V(t, n, a, o), u = B(t, n, a), l = (s - i) / s - 1, f = 1 + r / a, c = 100 * e / a;
257
257
  let m = 0, h = 0;
258
- for (let t = 1; t <= l; t++) {
259
- const n = t + u, e = c / f ** n;
258
+ for (let t = 1; t <= u; t++) {
259
+ const n = t + l, e = c / f ** n;
260
260
  m += n * e, h += e;
261
261
  }
262
- const M = l + u, p = 100 / f ** M;
262
+ const M = u + l, p = 100 / f ** M;
263
263
  return m += M * p, h += p, m / h / a;
264
264
  }
265
265
  function L(t, n, e, r, a) {
266
- const o = Math.min(a / e, 1), s = 1 === o && 1 !== r ? 0 : t * (1 - o) ** (r - 1), i = t * (1 - o) ** r, l = i < n ? s - n : s - i;
267
- return Math.max(l, 0);
266
+ const o = Math.min(a / e, 1), i = 1 === o && 1 !== r ? 0 : t * (1 - o) ** (r - 1), s = t * (1 - o) ** r, u = s < n ? i - n : i - s;
267
+ return Math.max(u, 0);
268
268
  }
269
269
  function U(t, n, e) {
270
- return A(t, n, e) >= 0;
270
+ return x(t, n, e) >= 0;
271
271
  }
272
272
  function k(t) {
273
273
  return !(t < 1 || t > 4 || 3 === t);
274
274
  }
275
275
  var q = o({ ACCRINT: () => X });
276
- function X(e, r, a, o, s, i, l = 0, u = !0) {
277
- if (e = Math.trunc(e), r = Math.trunc(r), a = Math.trunc(a), i = Math.trunc(i), l = Math.trunc(l), !t.isValidDate(e) || !t.isValidDate(r) || !t.isValidDate(a)) return n.BuiltIn.Value;
278
- if (!k(i) || !E(l) || o <= 0 || s <= 0 || e >= a) return NaN;
276
+ function X(e, r, a, o, i, s, u = 0, l = !0) {
277
+ if (e = Math.trunc(e), r = Math.trunc(r), a = Math.trunc(a), s = Math.trunc(s), u = Math.trunc(u), !t.isValidDate(e) || !t.isValidDate(r) || !t.isValidDate(a)) return n.BuiltIn.Value;
278
+ if (!k(s) || !E(u) || o <= 0 || i <= 0 || e >= a) return NaN;
279
279
  const f = function(t, n, e, r, a, o = !0) {
280
- const s = Math.ceil(r * (Math.abs(n - t) + Math.abs(n - e)) / 365) + 6;
281
- let i = 0;
282
- for (let e = 1; e <= s; e++) if (j(n, r, -e) <= t) {
283
- i = e;
280
+ const i = Math.ceil(r * (Math.abs(n - t) + Math.abs(n - e)) / 365) + 6;
281
+ let s = 0;
282
+ for (let e = 1; e <= i; e++) if (j(n, r, -e) <= t) {
283
+ s = e;
284
284
  break;
285
285
  }
286
- const l = [];
287
- for (let t = -i; l.length <= 600; t++) {
286
+ const u = [];
287
+ for (let t = -s; u.length <= 600; t++) {
288
288
  const a = j(n, r, t);
289
- if (l.push(a), a >= e) break;
289
+ if (u.push(a), a >= e) break;
290
290
  }
291
- let u = null;
291
+ let l = null;
292
292
  if (1 === a) {
293
- const t = l.findIndex((t) => t === n);
294
- t > 0 && (u = n - l[t - 1]);
293
+ const t = u.findIndex((t) => t === n);
294
+ t > 0 && (l = n - u[t - 1]);
295
295
  }
296
296
  let f = 0;
297
- for (let s = 0; s + 1 < l.length; s++) {
298
- const i = l[s], c = l[s + 1];
297
+ for (let i = 0; i + 1 < u.length; i++) {
298
+ const s = u[i], c = u[i + 1];
299
299
  if (c <= t) continue;
300
- if (i >= e) break;
301
- const m = Math.max(i, t), h = Math.min(c, e);
302
- if (m === i && h === c && (0 === a || 4 === a || o)) {
300
+ if (s >= e) break;
301
+ const m = Math.max(s, t), h = Math.min(c, e);
302
+ if (m === s && h === c && (0 === a || 4 === a || o)) {
303
303
  f += 1;
304
304
  continue;
305
305
  }
306
306
  let M, p;
307
307
  switch (a) {
308
308
  case 0:
309
- M = m - i === 1 && c < n ? h - m : I(m, h, 0).days, p = 360 / r;
309
+ M = m - s === 1 && c < n ? h - m : I(m, h, 0).days, p = 360 / r;
310
310
  break;
311
311
  case 1:
312
- M = h - m, p = null !== u ? u : c - i;
312
+ M = h - m, p = null !== l ? l : c - s;
313
313
  break;
314
314
  case 2:
315
315
  M = h - m, p = 360 / r;
@@ -323,36 +323,36 @@ function X(e, r, a, o, s, i, l = 0, u = !0) {
323
323
  p > 0 && (f += M / p);
324
324
  }
325
325
  return f;
326
- }(e, r, a, i, l, u);
327
- return s * (o / i) * f;
326
+ }(e, r, a, s, u, l);
327
+ return i * (o / s) * f;
328
328
  }
329
329
  function j(n, e, r) {
330
330
  const a = Math.round(r * (12 / e)), o = t.fromSerialDate(n, !0);
331
331
  return b(o, a), t.toSerialDate(o, !0);
332
332
  }
333
333
  var _ = o({ AMORDEGRC: () => G });
334
- function G(n, e, r, a, o, s, i = 0) {
335
- if (i = Math.floor(i), !t.isValidDate(e) || !t.isValidDate(r) || n <= 0 || a < 0 || n < a || o < 0 || s <= 0 || 0 !== i && 1 !== i && 3 !== i || Math.floor(e) > Math.floor(r)) return NaN;
336
- const l = 1 / s, u = s * ((f = l) < 5 ? 1.5 : f <= 6 ? 2 : 2.5);
334
+ function G(n, e, r, a, o, i, s = 0) {
335
+ if (s = Math.floor(s), !t.isValidDate(e) || !t.isValidDate(r) || n <= 0 || a < 0 || n < a || o < 0 || i <= 0 || 0 !== s && 1 !== s && 3 !== s || Math.floor(e) > Math.floor(r)) return NaN;
336
+ const u = 1 / i, l = i * ((f = u) < 5 ? 1.5 : f <= 6 ? 2 : 2.5);
337
337
  var f;
338
- const { days: c, yearDays: m } = I(e, r, i), h = c / m;
339
- return function(t, n, e, r, a, o, s) {
340
- const i = Math.ceil(r), l = Math.floor(t * e * o);
341
- if (0 === s) return l;
342
- const u = t - Math.floor(t * e * a);
338
+ const { days: c, yearDays: m } = I(e, r, s), h = c / m;
339
+ return function(t, n, e, r, a, o, i) {
340
+ const s = Math.ceil(r), u = Math.floor(t * e * o);
341
+ if (0 === i) return u;
342
+ const l = t - Math.floor(t * e * a);
343
343
  if (r < 3) {
344
- const t = i - 1;
345
- return t <= 0 ? u > n ? u : 0 : s <= t ? Math.ceil(u / t) : 0;
344
+ const t = s - 1;
345
+ return t <= 0 ? l > n ? l : 0 : i <= t ? Math.ceil(l / t) : 0;
346
346
  }
347
- let f = u;
348
- for (let t = 1; t <= s; t++) {
347
+ let f = l;
348
+ for (let t = 1; t <= i; t++) {
349
349
  if (f <= n) return 0;
350
- const r = f * e, a = i - t, o = a > 0 ? f / a : 0, l = Math.floor(Math.max(r, o));
351
- if (t === s) return l;
352
- f -= l;
350
+ const r = f * e, a = s - t, o = a > 0 ? f / a : 0, u = Math.floor(Math.max(r, o));
351
+ if (t === i) return u;
352
+ f -= u;
353
353
  }
354
354
  return 0;
355
- }(n, a, u, l, h, 1 === i && l >= 3 ? c / 365 : h, o > 1 ? Math.floor(o) : Math.ceil(o));
355
+ }(n, a, l, u, h, 1 === s && u >= 3 ? c / 365 : h, o > 1 ? Math.floor(o) : Math.ceil(o));
356
356
  }
357
357
  function z(n) {
358
358
  if (null === n) return 0;
@@ -369,82 +369,91 @@ var H = o({
369
369
  YEARFRAC: () => Q
370
370
  });
371
371
  function K(n, e, r) {
372
- const a = t.getDateParts(n), o = t.getDateParts(e), s = Math.trunc(n), i = Math.trunc(e);
372
+ const a = t.getDateParts(n), o = t.getDateParts(e), i = Math.trunc(n), s = Math.trunc(e);
373
373
  if (r = r.toLowerCase(), n > e) return NaN;
374
- const l = o.year - a.year, u = o.month - a.month, f = o.day - a.day;
374
+ const u = o.year - a.year, l = o.month - a.month, f = o.day - a.day;
375
375
  let c;
376
376
  switch (r) {
377
- case "y": return c = u < 0 || 0 === u && f < 0 ? -1 : 0, c + l;
378
- case "m": return c = f < 0 ? -1 : 0, 12 * l + u + c;
379
- case "d": return i - s;
380
- case "md": return i - t.getSerialDate(o.year, o.month + (f < 0 ? -1 : 0), a.day);
381
- case "ym": return c = f < 0 ? -1 : 0, (c + 12 * l + u) % 12;
382
- case "yd": return i - t.getSerialDate(o.year - (u < 0 || 0 === u && f < 0 ? 1 : 0), a.month, a.day);
377
+ case "y": return c = l < 0 || 0 === l && f < 0 ? -1 : 0, c + u;
378
+ case "m": return c = f < 0 ? -1 : 0, 12 * u + l + c;
379
+ case "d": return s - i;
380
+ case "md": return s - t.getSerialDate(o.year, o.month + (f < 0 ? -1 : 0), a.day);
381
+ case "ym": return c = f < 0 ? -1 : 0, (c + 12 * u + l) % 12;
382
+ case "yd": return s - t.getSerialDate(o.year - (l < 0 || 0 === l && f < 0 ? 1 : 0), a.month, a.day);
383
383
  }
384
384
  return NaN;
385
385
  }
386
386
  function Q(n, e, r = 0) {
387
387
  let a = z(n), o = z(e);
388
- const s = null === (i = r) ? 0 : t.parseAsNumber(i);
389
- var i;
390
- if (!t.isValidDate(a) || !t.isValidDate(o) || !E(s)) return NaN;
388
+ const i = null === (s = r) ? 0 : t.parseAsNumber(s);
389
+ var s;
390
+ if (!t.isValidDate(a) || !t.isValidDate(o) || !E(i)) return NaN;
391
391
  if (a > o) {
392
392
  const t = a;
393
393
  a = o, o = t;
394
394
  }
395
- const { days: l, yearDays: u } = I(a, o, s);
396
- return l / u;
395
+ const { days: u, yearDays: l } = I(a, o, i);
396
+ return u / l;
397
397
  }
398
398
  function W(t, n, e = !1) {
399
399
  return e ? (n >= t ? 1 : -1) * I(t, n, 4).days : function(t, n) {
400
400
  const e = v(t), r = v(n), a = e.year, o = e.month;
401
- let s = e.day, i = r.year, l = r.month, u = r.day;
402
- if (2 === o ? 3 === v(t + 1).month && (s = 30) : 31 === s && (s = 30), 31 === u) if (s < 30) {
401
+ let i = e.day, s = r.year, u = r.month, l = r.day;
402
+ if (2 === o ? 3 === v(t + 1).month && (i = 30) : 31 === i && (i = 30), 31 === l) if (i < 30) {
403
403
  const t = v(n + 1);
404
- i = t.year, l = t.month, u = t.day;
405
- } else u = 30;
406
- return R(a, o, s, i, l, u);
404
+ s = t.year, u = t.month, l = t.day;
405
+ } else l = 30;
406
+ return R(a, o, i, s, u, l);
407
407
  }(t, n);
408
408
  }
409
409
  var $ = (t) => {
410
410
  const n = t.getLocaleProfile().currencySymbol;
411
411
  return `${n}#,##0.00_);[Red](${n}#,##0.00)`;
412
- }, Z = o({
413
- COUPDAYS: () => J,
414
- CUMIPMT: () => tt,
415
- CUMPRINC: () => nt,
416
- DB: () => et,
417
- DDB: () => rt,
418
- DISC: () => at,
419
- DOLLARDE: () => ot,
420
- DOLLARFR: () => st,
421
- EFFECT: () => it,
422
- FV: () => lt,
423
- FVSCHEDULE: () => ut,
424
- IPMT: () => ft,
425
- IRR: () => ct,
426
- ISPMT: () => mt,
427
- MIRR: () => ht,
428
- NOMINAL: () => Mt,
429
- NPER: () => pt,
430
- NPV: () => Dt,
431
- PDURATION: () => dt,
432
- PMT: () => gt,
433
- PPMT: () => Nt,
434
- PRICEDISC: () => yt,
435
- PV: () => bt,
436
- RATE: () => Et,
437
- RRI: () => vt,
438
- SLN: () => Rt,
439
- STOCKHISTORY: () => It,
440
- SYD: () => St,
441
- TBILLEQ: () => Ct,
442
- TBILLPRICE: () => Tt,
443
- TBILLYIELD: () => At,
444
- XIRR: () => wt,
445
- XNPV: () => xt
412
+ }, Z = (t, e) => {
413
+ if (0 === t) {
414
+ if (e < 0) throw n.BuiltIn.Div0;
415
+ if (0 === e) return NaN;
416
+ }
417
+ if (!Number.isInteger(e) || Math.abs(e) > 4294967294) return Math.exp(e * Math.log(t));
418
+ let r = Math.abs(e), a = 1, o = t;
419
+ for (; r > 0;) r % 2 == 1 && (a *= o), o *= o, r = Math.floor(r / 2);
420
+ return e < 0 ? 1 / a : a;
421
+ }, J = o({
422
+ COUPDAYS: () => tt,
423
+ CUMIPMT: () => nt,
424
+ CUMPRINC: () => rt,
425
+ DB: () => at,
426
+ DDB: () => ot,
427
+ DISC: () => it,
428
+ DOLLARDE: () => st,
429
+ DOLLARFR: () => ut,
430
+ EFFECT: () => lt,
431
+ FV: () => ft,
432
+ FVSCHEDULE: () => ct,
433
+ IPMT: () => mt,
434
+ IRR: () => ht,
435
+ ISPMT: () => Mt,
436
+ MIRR: () => pt,
437
+ NOMINAL: () => Nt,
438
+ NPER: () => Dt,
439
+ NPV: () => dt,
440
+ PDURATION: () => gt,
441
+ PMT: () => yt,
442
+ PPMT: () => bt,
443
+ PRICEDISC: () => Et,
444
+ PV: () => vt,
445
+ RATE: () => Rt,
446
+ RRI: () => St,
447
+ SLN: () => Ct,
448
+ STOCKHISTORY: () => Tt,
449
+ SYD: () => xt,
450
+ TBILLEQ: () => At,
451
+ TBILLPRICE: () => wt,
452
+ TBILLYIELD: () => Vt,
453
+ XIRR: () => Bt,
454
+ XNPV: () => Ot
446
455
  });
447
- function J(n, e, r, a = 0) {
456
+ function tt(n, e, r, a = 0) {
448
457
  if (!t.isValidDate(n) || !t.isValidDate(e) || !k(r) || !E(a) || n >= e) return NaN;
449
458
  if (1 === a) {
450
459
  const a = function(t, n, e) {
@@ -472,103 +481,125 @@ function J(n, e, r, a = 0) {
472
481
  }
473
482
  return o / r;
474
483
  }
475
- function tt(n, e, r, a, o, s) {
476
- if (!t.isValidDate(a) || !t.isValidDate(o) || n <= 0 || e <= 0 || r <= 0 || a < 1 || o < 1 || a > o || 0 !== s && 1 !== s) return NaN;
477
- const i = gt(n, e, r, 0, s);
478
- let l = 0;
479
- 1 === a && (0 === s && (l = -r), a++);
480
- for (let t = a; t <= o; t++) l += 1 === s ? lt(n, t - 2, i, r, 1) - i : lt(n, t - 1, i, r, 0);
481
- return l *= n, l;
482
- }
483
- function nt(n, e, r, a, o, s) {
484
- if (!t.isValidDate(a) || !t.isValidDate(o) || a > o || n <= 0 || e <= 0 || r <= 0 || a < 1 || o < 1 || a > o || 0 !== s && 1 !== s) return NaN;
485
- const i = gt(n, e, r, 0, s);
486
- let l = 0;
487
- 1 === a && (l = 0 === s ? i + r * n : i, a++);
488
- for (let t = a; t <= o; t++) l += s > 0 ? i - (lt(n, t - 2, i, r, 1) - i) * n : i - lt(n, t - 1, i, r, 0) * n;
489
- return l;
484
+ function nt(t, n, e, r, a, o) {
485
+ const i = et(t, n, e, r, a, o);
486
+ if (!i) return NaN;
487
+ const s = i.count * i.payment - i.principal;
488
+ return Number.isFinite(s) ? s : NaN;
489
+ }
490
+ var et = (t, n, e, r, a, o) => {
491
+ if (t <= 0 || n <= 0 || e <= 0 || r < 1 || r > a || a > n || 0 !== o && 1 !== o) return null;
492
+ const i = yt(t, n, e, 0, o);
493
+ if (!Number.isFinite(i)) return null;
494
+ const s = Math.ceil(r), u = Math.floor(a), l = u - s + 1;
495
+ if (l <= 0) return {
496
+ payment: i,
497
+ principal: 0,
498
+ count: 0
499
+ };
500
+ const f = Math.log1p(t), c = -Math.expm1(-n * f), m = (t, r) => {
501
+ const a = -e * (Math.exp((t - n - 1) * f) * Math.expm1((r - t + 1) * f)) / c;
502
+ return Number.isFinite(a) ? a : -e * (Math.exp((r - n) * f) - Math.exp((t - n - 1) * f)) / c;
503
+ };
504
+ if (!o) return {
505
+ payment: i,
506
+ principal: m(s, u),
507
+ count: l
508
+ };
509
+ let h = s <= 1 ? i : 0;
510
+ const M = Math.max(s, 2);
511
+ return M <= u && (h += m(M, u) / (1 + t)), {
512
+ payment: i,
513
+ principal: h,
514
+ count: l
515
+ };
516
+ };
517
+ function rt(t, n, e, r, a, o) {
518
+ const i = et(t, n, e, r, a, o);
519
+ return i ? i.principal : NaN;
490
520
  }
491
- function et(n, e, r, a, o = 12) {
521
+ function at(n, e, r, a, o = 12) {
492
522
  if (n < 0 || e < 0 || r <= 0 || a < 0) return NaN;
493
523
  if (o < 1 || o > 12) return NaN;
494
524
  if (12 === o && a > r || a > r + 1) return NaN;
495
525
  if (0 === n) return 0;
496
526
  t.formatResults($(t.getRuntime()));
497
- const s = Math.round(1e3 * (1 - Math.pow(e / n, 1 / r))) / 1e3, i = n * s * o / 12;
498
- if (1 === a) return i;
499
- let l = n - i;
500
- for (let t = 2; t < a; t++) l -= l * s;
501
- return a === r + 1 ? l * s * (12 - o) / 12 : l * s;
527
+ const i = Math.round(1e3 * (1 - Math.pow(e / n, 1 / r))) / 1e3, s = n * i * o / 12;
528
+ if (1 === a) return s;
529
+ let u = n - s;
530
+ for (let t = 2; t < a; t++) u -= u * i;
531
+ return a === r + 1 ? u * i * (12 - o) / 12 : u * i;
502
532
  }
503
- function rt(t, n, e, r, a = 2) {
533
+ function ot(t, n, e, r, a = 2) {
504
534
  if (t < 0 || n < 0 || e < 0 || r < 0 || a <= 0) return NaN;
505
535
  if (r > e) return NaN;
506
536
  if (n >= t) return 0;
507
- let o = 0, s = 0;
508
- for (let i = 1; i <= r; i++) s = Math.min(a / e * (t - o), t - n - o), o += s;
509
- return s;
537
+ let o = 0, i = 0;
538
+ for (let s = 1; s <= r; s++) i = Math.min(a / e * (t - o), t - n - o), o += i;
539
+ return i;
510
540
  }
511
- function at(n, e, r, a, o = 0) {
541
+ function it(n, e, r, a, o = 0) {
512
542
  if (!t.isValidDate(n) || !t.isValidDate(e) || !E(o) || r <= 0 || a <= 0 || n >= e) return NaN;
513
- let s, i;
543
+ let i, s;
514
544
  switch (o) {
515
545
  case 0:
516
- s = 360, i = W(n, e, !1);
546
+ i = 360, s = W(n, e, !1);
517
547
  break;
518
548
  case 1:
519
549
  case 3:
520
- s = 365, i = K(n, e, "D");
550
+ i = 365, s = K(n, e, "D");
521
551
  break;
522
552
  case 2:
523
- s = 360, i = K(n, e, "D");
553
+ i = 360, s = K(n, e, "D");
524
554
  break;
525
555
  case 4:
526
- s = 360, i = W(n, e, !0);
556
+ i = 360, s = W(n, e, !0);
527
557
  break;
528
558
  default: return NaN;
529
559
  }
530
- return (a - r) / a * s / i;
560
+ return (a - r) / a * i / s;
531
561
  }
532
- function ot(t, e) {
562
+ function st(t, e) {
533
563
  if ((e = Math.trunc(e)) < 0) return NaN;
534
564
  if (0 === e) throw n.BuiltIn.Div0;
535
565
  if (1 === e) return t;
536
- const r = t < 0 ? -1 : 1, a = Math.abs(t), o = Math.trunc(a), s = a - o;
537
- return r * (o + Math.round(s * Math.pow(10, Math.ceil(Math.log10(e)))) / e);
566
+ const r = t < 0 ? -1 : 1, a = Math.abs(t), o = Math.trunc(a), i = a - o;
567
+ return r * (o + Math.round(i * Math.pow(10, Math.ceil(Math.log10(e)))) / e);
538
568
  }
539
- function st(t, e) {
569
+ function ut(t, e) {
540
570
  if ((e = Math.trunc(e)) < 0) return NaN;
541
571
  if (0 === e) throw n.BuiltIn.Div0;
542
572
  if (1 === e) return t;
543
- const r = t < 0 ? -1 : 1, a = Math.abs(t), o = Math.trunc(a), s = a - o, i = Math.ceil(Math.log10(e));
544
- return r * (o + s * e / Math.pow(10, i));
573
+ const r = t < 0 ? -1 : 1, a = Math.abs(t), o = Math.trunc(a), i = a - o, s = Math.ceil(Math.log10(e));
574
+ return r * (o + i * e / Math.pow(10, s));
545
575
  }
546
- function it(t, n) {
547
- return n = Math.trunc(n), t <= 0 || n < 1 ? NaN : Math.pow(1 + t / n, n) - 1;
576
+ function lt(t, n) {
577
+ if (n = Math.trunc(n), t <= 0 || n < 1) return NaN;
578
+ const e = Z(1 + t / n, n) - 1;
579
+ return Number.isFinite(e) ? e : NaN;
548
580
  }
549
- function lt(n, e, r, a = 0, o = 0) {
550
- let s;
551
- if (0 === n) s = a + r * e;
552
- else {
553
- const t = Math.pow(1 + n, e);
554
- s = 1 === o ? a * t + r * (1 + n) * (t - 1) / n : a * t + r * (t - 1) / n;
555
- }
556
- return t.formatResults($(t.getRuntime())), -s;
581
+ function ft(n, e, r, a = 0, o = 0) {
582
+ if (t.formatResults($(t.getRuntime())), 0 === n) return -(a + r * e);
583
+ const i = Z(1 + n, e);
584
+ return -(a * i + (i - 1) / n * (1 + n * (o ? 1 : 0)) * r);
557
585
  }
558
- function ut(t, e) {
586
+ function ct(t, e) {
559
587
  let r = t;
560
- for (const t of e.values()) {
588
+ for (const t of e.values()) if (null != t) {
561
589
  if ("number" != typeof t) throw n.BuiltIn.Value;
562
590
  r *= 1 + t;
563
591
  }
564
- return r;
592
+ return Number.isFinite(r) ? r : 0;
565
593
  }
566
- function ft(t, n, e, r, a = 0, o = 0) {
567
- if (e <= 0 || n < 1 || n > e) return NaN;
568
- const s = gt(t, e, r, a, o);
569
- return 1 === n ? t * (o ? 0 : -r) : t * (o ? lt(t, n - 2, s, r, o) - s : lt(t, n - 1, s, r, o));
594
+ function mt(n, e, r, a, o = 0, i = 0) {
595
+ if (e < 1 || e - 1 >= r) return NaN;
596
+ if (t.formatResults($(t.getRuntime())), 1 === e && i) return 0;
597
+ if (0 === n) return 0;
598
+ if (n <= -1) return NaN;
599
+ const s = Math.log1p(n), u = e - 1, l = -n * (a * -Math.expm1((u - r) * s) - o * (u * s < 700 ? Math.exp(-r * s) * Math.expm1(u * s) : Math.exp((u - r) * s) - Math.exp(-r * s))) / -Math.expm1(-r * s);
600
+ return i ? l / (1 + n) : l;
570
601
  }
571
- function ct(t, n = .1) {
602
+ function ht(t, n = .1) {
572
603
  const e = t.some((t) => t > 0), r = t.some((t) => t < 0);
573
604
  if (!e || !r) return NaN;
574
605
  const a = (n) => {
@@ -579,145 +610,162 @@ function ct(t, n = .1) {
579
610
  };
580
611
  let o = n;
581
612
  for (let t = 0; t < 20; t++) {
582
- const t = a(o), n = o - t / ((a(o + Vt) - t) / Vt);
583
- if (Math.abs(n - o) < Vt) return n;
613
+ const t = a(o), n = o - t / ((a(o + Pt) - t) / Pt);
614
+ if (Math.abs(n - o) < Pt) return n;
584
615
  o = n, o <= -1 && (o = -.9999999);
585
616
  }
586
617
  return NaN;
587
618
  }
588
- function mt(t, e, r, a) {
619
+ function Mt(t, e, r, a) {
589
620
  if (0 === r) throw n.BuiltIn.Div0;
590
- return a * t * (e / r - 1);
621
+ const o = a * (e - r) * t / r;
622
+ return Number.isFinite(o) ? o : NaN;
591
623
  }
592
- function ht(e, r, a) {
624
+ function pt(e, r, a) {
593
625
  const o = e.length;
594
626
  if (!e.some((t) => t < 0)) throw n.BuiltIn.Div0;
595
- let s = 0;
627
+ let i = 0;
596
628
  for (let t = 0; t < o; t++) {
597
629
  const n = e[t];
598
- n < 0 && (s += n / Math.pow(1 + r, t));
630
+ n < 0 && (i += n / Math.pow(1 + r, t));
599
631
  }
600
- let i = 0;
632
+ let s = 0;
601
633
  for (let t = 0; t < o; t++) {
602
634
  const n = e[t];
603
- n > 0 && (i += n * Math.pow(1 + a, o - 1 - t));
635
+ n > 0 && (s += n * Math.pow(1 + a, o - 1 - t));
604
636
  }
605
- return t.formatResults("0%"), Math.pow(-i / s, 1 / (o - 1)) - 1;
637
+ return t.formatResults("0%"), Math.pow(-s / i, 1 / (o - 1)) - 1;
606
638
  }
607
- function Mt(t, n) {
608
- return n = Math.trunc(n), t <= 0 || n < 1 ? NaN : (Math.pow(t + 1, 1 / n) - 1) * n;
639
+ function Nt(t, n) {
640
+ if (n = Math.trunc(n), t <= 0 || n < 1) return NaN;
641
+ const e = (Z(t + 1, 1 / n) - 1) * n;
642
+ return Number.isFinite(e) ? e : NaN;
609
643
  }
610
- function pt(t, e, r, a = 0, o = 0) {
644
+ function Dt(t, e, r, a = 0, o = 0) {
611
645
  if (0 === t) {
612
646
  if (0 === e) throw n.BuiltIn.Div0;
613
647
  return (-r - a) / e;
614
648
  }
615
- return o && (e *= 1 + t), Math.log((e - a * t) / (r * t + e)) / Math.log(1 + t);
616
- }
617
- function Dt(t, e) {
618
- if (e.length > 254) throw n.BuiltIn.Value;
619
- let r = 0;
620
- for (let a = e.length - 1; a >= 0; a--) {
621
- if (r += e[a], -1 === t) {
622
- if (0 === r) continue;
623
- throw n.BuiltIn.Div0;
624
- }
625
- r /= 1 + t;
626
- }
627
- return r;
649
+ if (t <= -1) return NaN;
650
+ const i = Math.log(1 + t);
651
+ if (0 === i) throw n.BuiltIn.Div0;
652
+ return o && (e *= 1 + t), Math.log((e - a * t) / (r * t + e)) / i;
653
+ }
654
+ function dt(t, e) {
655
+ const r = [];
656
+ for (const t of e) for (const n of t.values()) r.push(n);
657
+ const a = r.length, o = 1 + t;
658
+ if (0 === o) throw n.BuiltIn.Div0;
659
+ if (!Number.isFinite(Z(o, a - 1))) throw n.BuiltIn.Div0;
660
+ let i = 0;
661
+ for (let t = a - 1; t >= 0; t--) i += r[t], i /= o;
662
+ return i;
628
663
  }
629
- function dt(t, n, e) {
630
- return t <= 0 || n <= 0 || e <= 0 ? NaN : (Math.log(e) - Math.log(n)) / Math.log(1 + t);
664
+ function gt(t, e, r) {
665
+ if (t <= 0 || e <= 0 || r <= 0) return NaN;
666
+ const a = Math.log(1 + t);
667
+ if (0 === a) throw n.BuiltIn.Div0;
668
+ return (Math.log(r) - Math.log(e)) / a;
631
669
  }
632
- function gt(n, e, r, a = 0, o = 0) {
670
+ function yt(n, e, r, a = 0, o = 0) {
633
671
  if (0 === e) return NaN;
634
- if (0 === n) return (-r - a) / e;
635
- o = o ? 1 : 0;
636
- const s = Math.pow(1 + n, e);
637
- return t.formatResults($(t.getRuntime())), (a * n + r * n * s) * (o ? 1 / (1 + n) : 1) / (1 - s);
638
- }
639
- function Nt(t, n, e, r, a = 0, o = 0) {
640
- return e <= 0 || n < 1 || n > e ? NaN : gt(t, e, r, a, o) - ft(t, n, e, r, a, o);
641
- }
642
- function yt(n, e, r, a, o = 0) {
672
+ if (t.formatResults($(t.getRuntime())), 0 === n) return (-r - a) / e;
673
+ if (n <= -1) return NaN;
674
+ const i = e * Math.log1p(n), s = (r / -Math.expm1(-i) + a / Math.expm1(i)) * n;
675
+ return -(o ? s / (1 + n) : s);
676
+ }
677
+ function bt(n, e, r, a, o = 0, i = 0) {
678
+ if (e < 1 || e - 1 >= r) return NaN;
679
+ if (t.formatResults($(t.getRuntime())), 0 === n) return -(a + o) / r;
680
+ if (n <= -1) return NaN;
681
+ const s = Math.log1p(n), u = -Math.expm1(-r * s);
682
+ if (i && 1 === e) return -n * (a + o * Math.exp(-r * s)) / (u * (1 + n));
683
+ const l = i ? e - 2 : e - 1;
684
+ return -(a + o) * (n * Math.exp((l - r) * s)) / u;
685
+ }
686
+ function Et(n, e, r, a, o = 0) {
643
687
  if (!t.isValidDate(n) || !t.isValidDate(e) || !E(o) || r <= 0 || a <= 0 || n >= e) return NaN;
644
- let s, i;
688
+ let i, s;
645
689
  switch (o) {
646
690
  case 0:
647
- s = 360, i = W(n, e, !1);
691
+ i = 360, s = W(n, e, !1);
648
692
  break;
649
693
  case 1:
650
694
  case 3:
651
- s = 365, i = K(n, e, "D");
695
+ i = 365, s = K(n, e, "D");
652
696
  break;
653
697
  case 2:
654
- s = 360, i = K(n, e, "D");
698
+ i = 360, s = K(n, e, "D");
655
699
  break;
656
700
  case 4:
657
- s = 360, i = W(n, e, !0);
701
+ i = 360, s = W(n, e, !0);
658
702
  break;
659
703
  default: return NaN;
660
704
  }
661
- return a - r * a * i / s;
705
+ return a - r * a * s / i;
662
706
  }
663
- function bt(e, r, a, o = 0, s = 0) {
664
- if (s = s ? 1 : 0, -1 === e) {
665
- if (0 === r) return NaN;
666
- throw n.BuiltIn.Div0;
667
- }
668
- return t.formatResults($(t.getRuntime())), 0 === e ? -a * r - o : ((1 - Math.pow(1 + e, r)) * a * (1 + e * s) / e - o) / Math.pow(1 + e, r);
707
+ function vt(e, r, a, o = 0, i = 0) {
708
+ if (t.formatResults($(t.getRuntime())), 0 === e) return -(o + a * r);
709
+ const s = Z(1 + e, r);
710
+ if (0 === s) throw n.BuiltIn.Div0;
711
+ return -(o + (s - 1) / e * (1 + e * (i ? 1 : 0)) * a) / s;
669
712
  }
670
- function Et(t, e, r, a = 0, o = 0, s = .1) {
671
- if (s <= -1) throw n.BuiltIn.Value;
672
- o = o ? 1 : 0;
673
- let i = s;
674
- for (let n = 0; n < 100; n++) {
675
- if (i <= -1) return NaN;
676
- let n, s;
677
- if (Math.abs(i) < Vt) n = r * (1 + t * i) + e * (1 + i * o) * t + a, s = r * t + e * o * t;
678
- else {
679
- const l = Math.pow(1 + i, t), u = t * Math.pow(1 + i, t - 1);
680
- n = r * l + e * (1 / i + o) * (l - 1) + a, s = r * u + e * (1 / i + o) * u + e * (-1 / (i * i)) * (l - 1);
681
- }
682
- if (Math.abs(n) < Vt) return i;
683
- i -= n / s;
713
+ function Rt(t, e, r, a = 0, o = 0, i = .1) {
714
+ if (i <= -1) throw n.BuiltIn.Value;
715
+ const s = o ? 1 : 0, u = (n) => {
716
+ if (0 === n) return r + e * t + a;
717
+ const o = Z(1 + n, t);
718
+ return r * o + (o - 1) / n * (1 + n * s) * e + a;
719
+ };
720
+ let l = i, f = u(l), c = f > 0 ? i - .001 : i + .001, m = u(c);
721
+ for (let t = 0; t < It; t++) {
722
+ const t = c - m * (c - l) / (m - f);
723
+ if (!Number.isFinite(t)) return NaN;
724
+ const n = u(t);
725
+ if (!Number.isFinite(n)) return NaN;
726
+ if (Math.abs(t - c) < 1e-7 && Math.abs(n) < 1e-7) return t <= -1 ? NaN : t;
727
+ l = c, f = m, c = t, m = n;
684
728
  }
685
729
  return NaN;
686
730
  }
687
- function vt(t, n, e) {
688
- return t <= 0 || 0 === n || e < 0 && n > 0 || e > 0 && n < 0 ? NaN : Math.pow(e / n, 1 / t) - 1;
731
+ var It = 200;
732
+ function St(t, n, e) {
733
+ if (t <= 0 || e < 0 && n > 0 || e > 0 && n < 0) return NaN;
734
+ if (0 === n) return 0 === e ? 0 : NaN;
735
+ const r = Z(e / n, 1 / t) - 1;
736
+ return Number.isFinite(r) ? r : NaN;
689
737
  }
690
- function Rt(t, e, r) {
738
+ function Ct(t, e, r) {
691
739
  if (0 === r) throw n.BuiltIn.Div0;
692
740
  return (t - e) / r;
693
741
  }
694
- function It(e, r, a, o = 0, s = 1, i = [
742
+ function Tt(e, r, a, o = 0, i = 1, s = [
695
743
  0,
696
744
  1,
697
745
  2,
698
746
  3,
699
747
  4
700
748
  ]) {
701
- const l = a ?? r;
702
- if (!t.isValidDate(r) || !t.isValidDate(l)) throw n.BuiltIn.Num;
749
+ const u = a ?? r;
750
+ if (!t.isValidDate(r) || !t.isValidDate(u)) throw n.BuiltIn.Num;
703
751
  }
704
- function St(t, n, e, r) {
752
+ function xt(t, n, e, r) {
705
753
  return r > e ? NaN : (t - n) * (e - r + 1) * 2 / (e * (e + 1));
706
754
  }
707
- function Ct(n, e, r) {
755
+ function At(n, e, r) {
708
756
  if (n = Math.round(n), e = Math.round(e), !t.isValidDate(n) || !t.isValidDate(e) || n >= e || y(n, e)) return NaN;
709
757
  const a = 360 - r * (e - n);
710
758
  return 0 === a ? 0 : a < 0 ? NaN : 365 * r / a;
711
759
  }
712
- function Tt(n, e, r) {
760
+ function wt(n, e, r) {
713
761
  if (n = Math.round(n), e = Math.round(e), !t.isValidDate(n) || !t.isValidDate(e) || n >= e || y(n, e)) return NaN;
714
762
  const a = 360 - r * (e - n);
715
763
  return 0 === a ? 0 : a < 0 ? NaN : 100 * (1 - r * (e - n) / 360);
716
764
  }
717
- function At(n, e, r) {
765
+ function Vt(n, e, r) {
718
766
  return n = Math.round(n), e = Math.round(e), !t.isValidDate(n) || !t.isValidDate(e) || n >= e || y(n, e) ? NaN : 360 * (100 - r) / (r * (e - n));
719
767
  }
720
- function wt(t, e, r = .1) {
768
+ function Bt(t, e, r = .1) {
721
769
  const a = t.flatten({
722
770
  includeEmpty: !0,
723
771
  onError: "value"
@@ -726,35 +774,35 @@ function wt(t, e, r = .1) {
726
774
  onError: "value"
727
775
  });
728
776
  if (a.length !== o.length) return NaN;
729
- const s = [], i = [];
777
+ const i = [], s = [];
730
778
  for (let t = 0; t < a.length; t++) {
731
779
  const e = a[t], r = o[t];
732
780
  if (null !== e) {
733
781
  if (null === r) return NaN;
734
782
  if (n.isError(e) || n.isError(r)) return n.BuiltIn.Value;
735
783
  if ("number" != typeof r || isNaN(r)) return n.BuiltIn.Value;
736
- s.push(e), i.push(r);
784
+ i.push(e), s.push(r);
737
785
  }
738
786
  }
739
- const l = s.some((t) => t > 0), u = s.some((t) => t < 0);
740
- if (!l || !u) return NaN;
741
- const f = i[0], c = i.map((t) => N(t, f) / 365), m = (t) => {
787
+ const u = i.some((t) => t > 0), l = i.some((t) => t < 0);
788
+ if (!u || !l) return NaN;
789
+ const f = s[0], c = s.map((t) => g(t, f) / 365), m = (t) => {
742
790
  const n = 1 + t;
743
791
  let e = 0;
744
- for (let t = 0; t < s.length; t++) e += s[t] / Math.pow(n, c[t]);
792
+ for (let t = 0; t < i.length; t++) e += i[t] / Math.pow(n, c[t]);
745
793
  return e;
746
794
  };
747
795
  let h = r;
748
796
  for (let t = 0; t < 20; t++) {
749
- const t = m(h), n = (m(h + Vt) - t) / Vt;
750
- if (Math.abs(n) < Vt) break;
797
+ const t = m(h), n = (m(h + Pt) - t) / Pt;
798
+ if (Math.abs(n) < Pt) break;
751
799
  const e = h - t / n;
752
- if (Math.abs(e - h) < Vt) return e;
800
+ if (Math.abs(e - h) < Pt) return e;
753
801
  h = e, h <= -1 && (h = -.9999999);
754
802
  }
755
803
  return NaN;
756
804
  }
757
- function xt(t, e, r) {
805
+ function Ot(t, e, r) {
758
806
  if (t <= 0) return NaN;
759
807
  const a = e.flatten({
760
808
  includeEmpty: !0,
@@ -765,7 +813,7 @@ function xt(t, e, r) {
765
813
  });
766
814
  if (a.length !== o.length) return NaN;
767
815
  if (0 === a.length) return NaN;
768
- const s = [], i = [];
816
+ const i = [], s = [];
769
817
  for (let t = 0; t < a.length; t++) {
770
818
  const e = a[t], r = o[t];
771
819
  if (null !== e || null !== r) {
@@ -773,200 +821,200 @@ function xt(t, e, r) {
773
821
  if (n.isError(e) || n.isError(r)) return n.BuiltIn.Value;
774
822
  if ("number" != typeof e) return NaN;
775
823
  if ("number" != typeof r) return n.BuiltIn.Value;
776
- s.push(e), i.push(r);
824
+ i.push(e), s.push(r);
777
825
  }
778
826
  }
779
- for (let t = 1; t < i.length; t++) if (i[t] < i[t - 1]) return NaN;
780
- let l = 0;
781
- const u = i[0];
782
- for (let n = 0; n < s.length; n++) l += s[n] / Math.pow(1 + t, N(i[n], u) / 365);
783
- return l;
827
+ for (let t = 1; t < s.length; t++) if (s[t] < s[t - 1]) return NaN;
828
+ let u = 0;
829
+ const l = s[0];
830
+ for (let n = 0; n < i.length; n++) u += i[n] / Math.pow(1 + t, g(s[n], l) / 365);
831
+ return u;
784
832
  }
785
- var Vt = 1e-7;
786
- var Bt = o({
787
- ACCRINTM: () => Ot,
788
- AMORLINC: () => kt,
789
- INTRATE: () => Pt,
790
- PRICEMAT: () => Lt,
791
- RECEIVED: () => Ft,
792
- YIELDDISC: () => Yt,
793
- YIELDMAT: () => Ut
833
+ var Pt = 1e-7;
834
+ var Ft = o({
835
+ ACCRINTM: () => Yt,
836
+ AMORLINC: () => jt,
837
+ INTRATE: () => Lt,
838
+ PRICEMAT: () => qt,
839
+ RECEIVED: () => Ut,
840
+ YIELDDISC: () => kt,
841
+ YIELDMAT: () => Xt
794
842
  });
795
- function Ot(n, e, r, a, o = 0) {
843
+ function Yt(n, e, r, a, o = 0) {
796
844
  if (o = Math.floor(o), !t.isValidDate(n) || !t.isValidDate(e) || !E(o) || r <= 0 || a <= 0) return NaN;
797
845
  if (Math.floor(n) > Math.floor(e)) return NaN;
798
846
  if (Math.floor(n) === Math.floor(e)) return 0;
799
- const { days: s, yearDays: i } = I(n, e, o);
800
- return a * r * s / i;
847
+ const { days: i, yearDays: s } = I(n, e, o);
848
+ return a * r * i / s;
801
849
  }
802
- function Pt(n, e, r, a, o = 0) {
850
+ function Lt(n, e, r, a, o = 0) {
803
851
  if (o = Math.floor(o), !t.isValidDate(n) || !t.isValidDate(e) || !E(o) || r <= 0 || a <= 0 || Math.floor(n) >= Math.floor(e)) return NaN;
804
- const { days: s, yearDays: i } = I(n, e, o);
805
- return (a - r) / r * (i / s);
852
+ const { days: i, yearDays: s } = I(n, e, o);
853
+ return (a - r) / r * (s / i);
806
854
  }
807
- function Ft(n, e, r, a, o = 0) {
855
+ function Ut(n, e, r, a, o = 0) {
808
856
  if (o = Math.floor(o), !t.isValidDate(n) || !t.isValidDate(e) || r <= 0 || a <= 0 || !E(o) || Math.floor(n) >= Math.floor(e)) return NaN;
809
- const { days: s, yearDays: i } = I(n, e, o), l = r / (1 - a * s / i);
810
- return l < 0 ? NaN : l;
857
+ const { days: i, yearDays: s } = I(n, e, o), u = r / (1 - a * i / s);
858
+ return u < 0 ? NaN : u;
811
859
  }
812
- function Yt(n, e, r, a, o = 0) {
860
+ function kt(n, e, r, a, o = 0) {
813
861
  if (o = Math.floor(o), !t.isValidDate(n) || !t.isValidDate(e) || r <= 0 || a <= 0 || !E(o) || Math.floor(n) >= Math.floor(e)) return NaN;
814
- const { days: s, yearDays: i } = I(n, e, o);
815
- return (a / r - 1) / (s / i);
862
+ const { days: i, yearDays: s } = I(n, e, o);
863
+ return (a / r - 1) / (i / s);
816
864
  }
817
- function Lt(n, e, r, a, o, s = 0) {
818
- if (s = Math.floor(s), !t.isValidDate(n) || !t.isValidDate(e) || !t.isValidDate(r) || a < 0 || o < 0 || !E(s) || !qt(r, n, e)) return NaN;
819
- const { yearDays: i } = I(r, n, s), { days: l } = I(n, e, s), { days: u } = I(r, e, s), { days: f } = I(r, n, s);
820
- return (100 + u / i * a * 100) / (1 + l / i * o) - f / i * a * 100;
865
+ function qt(n, e, r, a, o, i = 0) {
866
+ if (i = Math.floor(i), !t.isValidDate(n) || !t.isValidDate(e) || !t.isValidDate(r) || a < 0 || o < 0 || !E(i) || !_t(r, n, e)) return NaN;
867
+ const { yearDays: s } = I(r, n, i), { days: u } = I(n, e, i), { days: l } = I(r, e, i), { days: f } = I(r, n, i);
868
+ return (100 + l / s * a * 100) / (1 + u / s * o) - f / s * a * 100;
821
869
  }
822
- function Ut(n, e, r, a, o, s = 0) {
823
- if (s = Math.floor(s), !t.isValidDate(n) || !t.isValidDate(e) || !t.isValidDate(r) || a < 0 || o <= 0 || !E(s) || !qt(r, n, e)) return NaN;
824
- const { yearDays: i } = I(r, n, s), { days: l } = I(n, e, s), { days: u } = I(r, e, s), { days: f } = I(r, n, s);
825
- return ((1 + u / i * a) / (o / 100 + f / i * a) - 1) / (l / i);
870
+ function Xt(n, e, r, a, o, i = 0) {
871
+ if (i = Math.floor(i), !t.isValidDate(n) || !t.isValidDate(e) || !t.isValidDate(r) || a < 0 || o <= 0 || !E(i) || !_t(r, n, e)) return NaN;
872
+ const { yearDays: s } = I(r, n, i), { days: u } = I(n, e, i), { days: l } = I(r, e, i), { days: f } = I(r, n, i);
873
+ return ((1 + l / s * a) / (o / 100 + f / s * a) - 1) / (u / s);
826
874
  }
827
- function kt(n, e, r, a, o, s, i = 0) {
828
- if (i = Math.floor(i), n <= 0 || !t.isValidDate(e) || !t.isValidDate(r) || a < 0 || n < a || o < 0 || s <= 0 || Math.floor(e) > Math.floor(r) || ![
875
+ function jt(n, e, r, a, o, i, s = 0) {
876
+ if (s = Math.floor(s), n <= 0 || !t.isValidDate(e) || !t.isValidDate(r) || a < 0 || n < a || o < 0 || i <= 0 || Math.floor(e) > Math.floor(r) || ![
829
877
  0,
830
878
  1,
831
879
  3,
832
880
  4
833
- ].includes(i)) return NaN;
881
+ ].includes(s)) return NaN;
834
882
  o = o > 1 ? Math.floor(o) : Math.ceil(o);
835
- const l = n - a, u = n * s, { days: f, yearDays: c } = I(e, r, i), m = f / c, h = Math.ceil(l / u - m);
836
- return h < 0 ? 0 : 0 === o ? u * m : o === h ? l - u * (m + o - 1) : o > h ? 0 : u;
883
+ const u = n - a, l = n * i, { days: f, yearDays: c } = I(e, r, s), m = f / c, h = Math.ceil(u / l - m);
884
+ return h < 0 ? 0 : 0 === o ? l * m : o === h ? u - l * (m + o - 1) : o > h ? 0 : l;
837
885
  }
838
- function qt(t, n, e) {
886
+ function _t(t, n, e) {
839
887
  return Math.floor(e) > Math.floor(n) && Math.floor(n) > Math.floor(t);
840
888
  }
841
- var Xt = o({
842
- COUPDAYBS: () => jt,
843
- COUPDAYS: () => _t,
844
- COUPDAYSNC: () => Gt,
845
- COUPNCD: () => zt,
846
- COUPNUM: () => Kt,
847
- COUPPCD: () => Ht
889
+ var Gt = o({
890
+ COUPDAYBS: () => zt,
891
+ COUPDAYS: () => Ht,
892
+ COUPDAYSNC: () => Kt,
893
+ COUPNCD: () => Qt,
894
+ COUPNUM: () => $t,
895
+ COUPPCD: () => Wt
848
896
  });
849
- function jt(n, e, r, a = 0) {
850
- return r = Math.floor(r), a = Math.floor(a), t.isValidDate(n) && t.isValidDate(e) && k(r) && E(a) && Qt(n, e, r, a) ? x(n, e, r, a) : NaN;
897
+ function zt(n, e, r, a = 0) {
898
+ return r = Math.floor(r), a = Math.floor(a), t.isValidDate(n) && t.isValidDate(e) && k(r) && E(a) && Zt(n, e, r, a) ? w(n, e, r, a) : NaN;
851
899
  }
852
- function _t(n, e, r, a = 0) {
853
- return r = Math.floor(r), a = Math.floor(a), t.isValidDate(n) && t.isValidDate(e) && k(r) && E(a) && Qt(n, e, r, a) ? V(n, e, r, a) : NaN;
900
+ function Ht(n, e, r, a = 0) {
901
+ return r = Math.floor(r), a = Math.floor(a), t.isValidDate(n) && t.isValidDate(e) && k(r) && E(a) && Zt(n, e, r, a) ? V(n, e, r, a) : NaN;
854
902
  }
855
- function Gt(n, e, r, a = 0) {
856
- if (r = Math.floor(r), a = Math.floor(a), !(t.isValidDate(n) && t.isValidDate(e) && k(r) && E(a) && Qt(n, e, r, a))) return NaN;
857
- const { days: o } = I(n, w(n, e, r), a);
903
+ function Kt(n, e, r, a = 0) {
904
+ if (r = Math.floor(r), a = Math.floor(a), !(t.isValidDate(n) && t.isValidDate(e) && k(r) && E(a) && Zt(n, e, r, a))) return NaN;
905
+ const { days: o } = I(n, A(n, e, r), a);
858
906
  return o;
859
907
  }
860
- function zt(n, e, r, a = 0) {
861
- return r = Math.floor(r), a = Math.floor(a), t.isValidDate(n) && t.isValidDate(e) && k(r) && E(a) && !(n >= e) && Qt(n, e, r, a) ? (t.formatResults("Short Date"), w(n, e, r)) : NaN;
908
+ function Qt(n, e, r, a = 0) {
909
+ return r = Math.floor(r), a = Math.floor(a), t.isValidDate(n) && t.isValidDate(e) && k(r) && E(a) && !(n >= e) && Zt(n, e, r, a) ? (t.formatResults("Short Date"), A(n, e, r)) : NaN;
862
910
  }
863
- function Ht(n, e, r, a = 0) {
864
- if (r = Math.floor(r), a = Math.floor(a), !(t.isValidDate(n) && t.isValidDate(e) && k(r) && E(a) && Qt(n, e, r, a))) return NaN;
911
+ function Wt(n, e, r, a = 0) {
912
+ if (r = Math.floor(r), a = Math.floor(a), !(t.isValidDate(n) && t.isValidDate(e) && k(r) && E(a) && Zt(n, e, r, a))) return NaN;
865
913
  t.formatResults("d-mmm-yy");
866
- const o = A(n, e, r);
914
+ const o = x(n, e, r);
867
915
  return o < 0 ? 0 : o;
868
916
  }
869
- function Kt(n, e, r, a = 0) {
870
- return r = Math.floor(r), a = Math.floor(a), t.isValidDate(n) && t.isValidDate(e) && k(r) && E(a) && Qt(n, e, r, a) ? A(n, e, r) < 0 ? NaN : B(n, e, r) : NaN;
917
+ function $t(n, e, r, a = 0) {
918
+ return r = Math.floor(r), a = Math.floor(a), t.isValidDate(n) && t.isValidDate(e) && k(r) && E(a) && Zt(n, e, r, a) ? x(n, e, r) < 0 ? NaN : B(n, e, r) : NaN;
871
919
  }
872
- function Qt(t, n, e, r) {
920
+ function Zt(t, n, e, r) {
873
921
  return k(e) && E(r) && Math.floor(t) < Math.floor(n);
874
922
  }
875
- function Wt(t, n) {
923
+ function Jt(t, n) {
876
924
  const e = 1e-7;
877
925
  let r = t, a = 1, o = 0;
878
926
  for (; a > e && o < 500;) {
879
- const t = (n(r + e) - n(r - e)) / 2e-7, s = r - n(r) / t;
880
- a = Math.abs(s - r), r = s, o++;
927
+ const t = (n(r + e) - n(r - e)) / 2e-7, i = r - n(r) / t;
928
+ a = Math.abs(i - r), r = i, o++;
881
929
  }
882
930
  return Number.isNaN(r) || !Number.isFinite(r) || 500 === o ? function(t, n) {
883
- const e = 1e-7, r = 60, a = 60, o = 1.6, s = -1, i = Number.MAX_VALUE;
884
- if (t <= s || t >= i) return NaN;
885
- let l, u, f = Math.max(t - .01, -.9999999), c = Math.min(t + .01, i - e), m = !1;
931
+ const e = 1e-7, r = 60, a = 60, o = 1.6, i = -1, s = Number.MAX_VALUE;
932
+ if (t <= i || t >= s) return NaN;
933
+ let u, l, f = Math.max(t - .01, -.9999999), c = Math.min(t + .01, s - e), m = !1;
886
934
  for (let t = 0; t < r; t++) {
887
- if (l = n(f), u = n(c), l * u <= 0) {
935
+ if (u = n(f), l = n(c), u * l <= 0) {
888
936
  m = !0;
889
937
  break;
890
938
  }
891
- f = Math.max(f + o * (f - c), -.9999999), c = Math.min(c + o * (c - f), i - e);
939
+ f = Math.max(f + o * (f - c), -.9999999), c = Math.min(c + o * (c - f), s - e);
892
940
  }
893
941
  if (!m) return NaN;
894
- l = n(f);
895
- let h = f, M = l, p = 0;
942
+ u = n(f);
943
+ let h = f, M = u, p = 0;
896
944
  do
897
- h = f + (c - f) / 2, M = n(h), l * M < 0 ? c = h : (f = h, l = M), p++;
945
+ h = f + (c - f) / 2, M = n(h), u * M < 0 ? c = h : (f = h, u = M), p++;
898
946
  while (Math.abs(M) > e && p < a);
899
947
  return h;
900
948
  }(t, n) : r;
901
949
  }
902
- var $t = o({
903
- DURATION: () => Jt,
904
- MDURATION: () => tn,
905
- PRICE: () => Zt,
906
- YIELD: () => nn
950
+ var tn = o({
951
+ DURATION: () => en,
952
+ MDURATION: () => rn,
953
+ PRICE: () => nn,
954
+ YIELD: () => an
907
955
  });
908
- function Zt(n, e, r, a, o, s, i = 0) {
909
- return s = Math.floor(s), i = Math.floor(i), !t.isValidDate(n) || !t.isValidDate(e) || r < 0 || a < 0 || o <= 0 || !k(s) || !E(i) || Math.floor(n) >= Math.floor(e) || !U(n, e, s) ? NaN : F(n, e, r, a, o, s, i);
956
+ function nn(n, e, r, a, o, i, s = 0) {
957
+ return i = Math.floor(i), s = Math.floor(s), !t.isValidDate(n) || !t.isValidDate(e) || r < 0 || a < 0 || o <= 0 || !k(i) || !E(s) || Math.floor(n) >= Math.floor(e) || !U(n, e, i) ? NaN : F(n, e, r, a, o, i, s);
910
958
  }
911
- function Jt(n, e, r, a, o, s = 0) {
912
- return o = Math.floor(o), s = Math.floor(s), !t.isValidDate(n) || !t.isValidDate(e) || r < 0 || a < 0 || !k(o) || !E(s) || Math.floor(n) >= Math.floor(e) || n <= 0 || e <= 366 ? NaN : Y(n, e, r, a, o, s);
959
+ function en(n, e, r, a, o, i = 0) {
960
+ return o = Math.floor(o), i = Math.floor(i), !t.isValidDate(n) || !t.isValidDate(e) || r < 0 || a < 0 || !k(o) || !E(i) || Math.floor(n) >= Math.floor(e) || n <= 0 || e <= 366 ? NaN : Y(n, e, r, a, o, i);
913
961
  }
914
- function tn(n, e, r, a, o, s = 0) {
915
- return o = Math.floor(o), s = Math.floor(s), !t.isValidDate(n) || !t.isValidDate(e) || r < 0 || a < 0 || !k(o) || !E(s) || Math.floor(n) >= Math.floor(e) || n <= 0 || e <= 366 ? NaN : Y(n, e, r, a, o, s) / (1 + a / o);
962
+ function rn(n, e, r, a, o, i = 0) {
963
+ return o = Math.floor(o), i = Math.floor(i), !t.isValidDate(n) || !t.isValidDate(e) || r < 0 || a < 0 || !k(o) || !E(i) || Math.floor(n) >= Math.floor(e) || n <= 0 || e <= 366 ? NaN : Y(n, e, r, a, o, i) / (1 + a / o);
916
964
  }
917
- function nn(n, e, r, a, o, s, i = 0) {
918
- if (s = Math.floor(s), i = Math.floor(i), !t.isValidDate(n) || !t.isValidDate(e) || r < 0 || a <= 0 || o <= 0 || !k(s) || !E(i) || Math.floor(n) >= Math.floor(e) || !U(n, e, s)) return NaN;
919
- if (B(n, e, s) > 1) {
920
- const t = Wt(r || .01, (t) => F(n, e, r, t, o, s, i) - a);
965
+ function an(n, e, r, a, o, i, s = 0) {
966
+ if (i = Math.floor(i), s = Math.floor(s), !t.isValidDate(n) || !t.isValidDate(e) || r < 0 || a <= 0 || o <= 0 || !k(i) || !E(s) || Math.floor(n) >= Math.floor(e) || !U(n, e, i)) return NaN;
967
+ if (B(n, e, i) > 1) {
968
+ const t = Jt(r || .01, (t) => F(n, e, r, t, o, i, s) - a);
921
969
  return Number.isNaN(t) ? NaN : t;
922
970
  }
923
- const l = x(n, e, s, i), u = V(n, e, s, i), { days: f } = I(n, e, i), c = a / 100 + l / u * (r / s);
924
- return (o / 100 + r / s - c) / c * s * (u / f);
971
+ const u = w(n, e, i, s), l = V(n, e, i, s), { days: f } = I(n, e, s), c = a / 100 + u / l * (r / i);
972
+ return (o / 100 + r / i - c) / c * i * (l / f);
925
973
  }
926
- var en = o({
927
- ODDFPRICE: () => rn,
928
- ODDFYIELD: () => an,
929
- ODDLPRICE: () => on,
930
- ODDLYIELD: () => sn
974
+ var on = o({
975
+ ODDFPRICE: () => sn,
976
+ ODDFYIELD: () => un,
977
+ ODDLPRICE: () => ln,
978
+ ODDLYIELD: () => fn
931
979
  });
932
- function rn(n, e, r, a, o, s, i, l, u = 0) {
933
- return l = Math.floor(l), u = Math.floor(u), !t.isValidDate(n) || !t.isValidDate(e) || !t.isValidDate(r) || !t.isValidDate(a) || o < 0 || s < 0 || i <= 0 || !k(l) || !E(u) || !fn(n, e, r, a, l) ? NaN : P(n, e, r, a, o, s, i, l, u);
980
+ function sn(n, e, r, a, o, i, s, u, l = 0) {
981
+ return u = Math.floor(u), l = Math.floor(l), !t.isValidDate(n) || !t.isValidDate(e) || !t.isValidDate(r) || !t.isValidDate(a) || o < 0 || i < 0 || s <= 0 || !k(u) || !E(l) || !hn(n, e, r, a, u) ? NaN : P(n, e, r, a, o, i, s, u, l);
934
982
  }
935
- function an(n, e, r, a, o, s, i, l, u = 0) {
936
- if (l = Math.floor(l), u = Math.floor(u), !t.isValidDate(n) || !t.isValidDate(e) || !t.isValidDate(r) || !t.isValidDate(a) || o < 0 || s <= 0 || i <= 0 || !k(l) || !E(u) || !fn(n, e, r, a, l)) return NaN;
937
- const { days: f } = I(n, e, u), c = Wt((o * f * 100 - (s - 100)) / (.25 * (s - 100) * (1 + 2 * f) + 100 * f), (t) => s - P(n, e, r, a, o, t, i, l, u));
983
+ function un(n, e, r, a, o, i, s, u, l = 0) {
984
+ if (u = Math.floor(u), l = Math.floor(l), !t.isValidDate(n) || !t.isValidDate(e) || !t.isValidDate(r) || !t.isValidDate(a) || o < 0 || i <= 0 || s <= 0 || !k(u) || !E(l) || !hn(n, e, r, a, u)) return NaN;
985
+ const { days: f } = I(n, e, l), c = Jt((o * f * 100 - (i - 100)) / (.25 * (i - 100) * (1 + 2 * f) + 100 * f), (t) => i - P(n, e, r, a, o, t, s, u, l));
938
986
  return Number.isNaN(c) ? NaN : c;
939
987
  }
940
- function on(n, e, r, a, o, s, i, l = 0) {
941
- return i = Math.floor(i), l = Math.floor(l), !t.isValidDate(n) || !t.isValidDate(e) || !t.isValidDate(r) || a < 0 || o < 0 || s <= 0 || !k(i) || !E(l) || !cn(n, e, r, i) ? NaN : function(t, n, e, r, a, o, s, i) {
942
- const { fAi: l, fDCi: u, fDSCi: f } = ln(t, n, e, s, i);
943
- return (o * s + 100 * r * (u - l * (1 + a * f / s))) / (a * f + s);
944
- }(n, e, r, a, o, s, i, l);
988
+ function ln(n, e, r, a, o, i, s, u = 0) {
989
+ return s = Math.floor(s), u = Math.floor(u), !t.isValidDate(n) || !t.isValidDate(e) || !t.isValidDate(r) || a < 0 || o < 0 || i <= 0 || !k(s) || !E(u) || !Mn(n, e, r, s) ? NaN : function(t, n, e, r, a, o, i, s) {
990
+ const { fAi: u, fDCi: l, fDSCi: f } = cn(t, n, e, i, s);
991
+ return (o * i + 100 * r * (l - u * (1 + a * f / i))) / (a * f + i);
992
+ }(n, e, r, a, o, i, s, u);
945
993
  }
946
- function sn(n, e, r, a, o, s, i, l = 0) {
947
- if (i = Math.floor(i), l = Math.floor(l), !t.isValidDate(n) || !t.isValidDate(e) || !t.isValidDate(r) || a < 0 || o <= 0 || s <= 0 || !k(i) || !E(l) || !cn(n, e, r, i)) return NaN;
948
- const { fAi: u, fDCi: f, fDSCi: c } = ln(n, e, r, i, l);
949
- return (i * (s - o) + 100 * a * (f - u)) / (c * o + 100 * a * u * c / i);
994
+ function fn(n, e, r, a, o, i, s, u = 0) {
995
+ if (s = Math.floor(s), u = Math.floor(u), !t.isValidDate(n) || !t.isValidDate(e) || !t.isValidDate(r) || a < 0 || o <= 0 || i <= 0 || !k(s) || !E(u) || !Mn(n, e, r, s)) return NaN;
996
+ const { fAi: l, fDCi: f, fDSCi: c } = cn(n, e, r, s, u);
997
+ return (s * (i - o) + 100 * a * (f - l)) / (c * o + 100 * a * l * c / s);
950
998
  }
951
- function ln(n, e, r, a, o) {
952
- const s = function(n, e, r) {
953
- const a = t.fromSerialDate(n, !0), o = t.fromSerialDate(e, !0), s = 12 / r;
999
+ function cn(n, e, r, a, o) {
1000
+ const i = function(n, e, r) {
1001
+ const a = t.fromSerialDate(n, !0), o = t.fromSerialDate(e, !0), i = 12 / r;
954
1002
  o.setFullYear(a.getFullYear()), o > a && o.setFullYear(o.getFullYear() - 1);
955
- for (; o < a;) o.setMonth(o.getMonth() + s);
1003
+ for (; o < a;) o.setMonth(o.getMonth() + i);
956
1004
  return t.toSerialDate(o, !0);
957
1005
  }(e, r, a);
958
1006
  return {
959
- fAi: un(r, n, s, a, o),
960
- fDCi: un(r, e, s, a, o),
961
- fDSCi: un(n, e, s, a, o)
1007
+ fAi: mn(r, n, i, a, o),
1008
+ fDCi: mn(r, e, i, a, o),
1009
+ fDSCi: mn(n, e, i, a, o)
962
1010
  };
963
1011
  }
964
- function un(n, e, r, a, o) {
965
- const s = t.fromSerialDate(n, !0), i = t.fromSerialDate(e, !0), l = 12 / a, u = t.fromSerialDate(r, !0);
966
- for (u.setFullYear(s.getFullYear()), u < s && u.setFullYear(u.getFullYear() + 1); u > s;) u.setMonth(u.getMonth() - l);
967
- let f = t.toSerialDate(u, !0);
968
- u.setMonth(u.getMonth() + l);
969
- let c = t.toSerialDate(u, !0);
1012
+ function mn(n, e, r, a, o) {
1013
+ const i = t.fromSerialDate(n, !0), s = t.fromSerialDate(e, !0), u = 12 / a, l = t.fromSerialDate(r, !0);
1014
+ for (l.setFullYear(i.getFullYear()), l < i && l.setFullYear(l.getFullYear() + 1); l > i;) l.setMonth(l.getMonth() - u);
1015
+ let f = t.toSerialDate(l, !0);
1016
+ l.setMonth(l.getMonth() + u);
1017
+ let c = t.toSerialDate(l, !0);
970
1018
  const m = (t, n, e) => 1 === o || 3 === o ? e - n : V(n, e, a, t);
971
1019
  if (c >= e) {
972
1020
  const { days: t } = I(n, e, o);
@@ -974,111 +1022,111 @@ function un(n, e, r, a, o) {
974
1022
  }
975
1023
  const { days: h } = I(n, c, o);
976
1024
  let M = h / m(o, f, c);
977
- const p = t.fromSerialDate(c, !0), D = t.fromSerialDate(c, !0);
978
- for (D.setMonth(D.getMonth() + l); D < i;) p.setMonth(p.getMonth() + l), D.setMonth(D.getMonth() + l), M += 1;
979
- f = t.toSerialDate(p, !0), c = t.toSerialDate(D, !0);
980
- const { days: d } = I(f, e, o);
981
- return M += d / m(o, f, c), M;
1025
+ const p = t.fromSerialDate(c, !0), N = t.fromSerialDate(c, !0);
1026
+ for (N.setMonth(N.getMonth() + u); N < s;) p.setMonth(p.getMonth() + u), N.setMonth(N.getMonth() + u), M += 1;
1027
+ f = t.toSerialDate(p, !0), c = t.toSerialDate(N, !0);
1028
+ const { days: D } = I(f, e, o);
1029
+ return M += D / m(o, f, c), M;
982
1030
  }
983
- function fn(n, e, r, a, o) {
1031
+ function hn(n, e, r, a, o) {
984
1032
  return Math.floor(e) > Math.floor(a) && Math.floor(a) > Math.floor(n) && Math.floor(n) > Math.floor(r) && function(n, e, r) {
985
- const a = t.fromSerialDate(n, !0), o = t.fromSerialDate(e, !0), s = g(a.getFullYear(), a.getMonth(), a.getDate()), i = g(o.getFullYear(), o.getMonth(), o.getDate());
986
- return !!(a.getDate() === o.getDate() || s && i) && Math.abs(12 * (o.getFullYear() - a.getFullYear()) + (o.getMonth() - a.getMonth())) % (12 / r) == 0;
1033
+ const a = t.fromSerialDate(n, !0), o = t.fromSerialDate(e, !0), i = d(a.getFullYear(), a.getMonth(), a.getDate()), s = d(o.getFullYear(), o.getMonth(), o.getDate());
1034
+ return !!(a.getDate() === o.getDate() || i && s) && Math.abs(12 * (o.getFullYear() - a.getFullYear()) + (o.getMonth() - a.getMonth())) % (12 / r) == 0;
987
1035
  }(e, a, o) && U(r, e, o);
988
1036
  }
989
- function cn(t, n, e, r) {
1037
+ function Mn(t, n, e, r) {
990
1038
  return Math.floor(n) > Math.floor(t) && Math.floor(t) > Math.floor(e) && U(e, n, r);
991
1039
  }
992
- var mn = o({ VDB: () => hn });
993
- function hn(e, r, a, o, s, i = 2, l = !1) {
994
- if (!t.isValidDate(o) || !t.isValidDate(s) || e < 0 || r < 0 || a < 0 || o < 0 || s < 0 || s > a || o > s || i < 0) return NaN;
995
- if (0 === a && 0 === o && 0 === s) throw n.BuiltIn.Div0;
1040
+ var pn = o({ VDB: () => Nn });
1041
+ function Nn(e, r, a, o, i, s = 2, u = !1) {
1042
+ if (!t.isValidDate(o) || !t.isValidDate(i) || e < 0 || r < 0 || a < 0 || o < 0 || i < 0 || i > a || o > i || s < 0) return NaN;
1043
+ if (0 === a && 0 === o && 0 === i) throw n.BuiltIn.Div0;
996
1044
  if (e < r) {
997
- if (o >= 1 || l) return 0;
998
- const t = r - e, n = s - o;
1045
+ if (o >= 1 || u) return 0;
1046
+ const t = r - e, n = i - o;
999
1047
  return -(n >= 1 ? t : t * n);
1000
1048
  }
1001
- return l ? function(t, n, e, r, a, o) {
1002
- const s = Math.floor(r) + 1, i = Math.ceil(a);
1003
- let l = 0;
1004
- for (let u = s; u <= i; u++) {
1005
- let f = L(t, n, e, u, o);
1006
- u === s ? f *= Math.min(a, s) - r : u === i && (f *= a - (i - 1)), l += f;
1049
+ return u ? function(t, n, e, r, a, o) {
1050
+ const i = Math.floor(r) + 1, s = Math.ceil(a);
1051
+ let u = 0;
1052
+ for (let l = i; l <= s; l++) {
1053
+ let f = L(t, n, e, l, o);
1054
+ l === i ? f *= Math.min(a, i) - r : l === s && (f *= a - (s - 1)), u += f;
1007
1055
  }
1008
- return l;
1009
- }(e, r, a, o, s, i) : function(t, n, e, r, a, o) {
1010
- const s = Math.ceil(a);
1011
- let i = t, l = !1, u = 0, f = 0;
1012
- for (let c = 1; c <= s && !(i <= n); c++) {
1013
- let s;
1014
- if (l) s = u;
1056
+ return u;
1057
+ }(e, r, a, o, i, s) : function(t, n, e, r, a, o) {
1058
+ const i = Math.ceil(a);
1059
+ let s = t, u = !1, l = 0, f = 0;
1060
+ for (let c = 1; c <= i && !(s <= n); c++) {
1061
+ let i;
1062
+ if (u) i = l;
1015
1063
  else {
1016
- const r = L(t, n, e, c, o), a = e - (c - 1), f = a > 0 ? (i - n) / a : 0;
1017
- f > r ? (u = f, l = !0, s = f) : s = r;
1064
+ const r = L(t, n, e, c, o), a = e - (c - 1), f = a > 0 ? (s - n) / a : 0;
1065
+ f > r ? (l = f, u = !0, i = f) : i = r;
1018
1066
  }
1019
- s = Math.min(s, i - n);
1067
+ i = Math.min(i, s - n);
1020
1068
  const m = Math.max(c - 1, r);
1021
- f += s * Math.max(0, Math.min(c, a) - m), i -= s;
1069
+ f += i * Math.max(0, Math.min(c, a) - m), s -= i;
1022
1070
  }
1023
1071
  return f;
1024
- }(e, r, a, o, s, i);
1072
+ }(e, r, a, o, i, s);
1025
1073
  }
1026
- var Mn = Object.freeze({ includeEmpty: !0 }), pn = (Object.freeze({ axis: e.Axis.Column }), Object.freeze({ axis: e.Axis.Row }), Object.freeze({
1074
+ var Dn = Object.freeze({ includeEmpty: !0 }), dn = (Object.freeze({ axis: e.Axis.Column }), Object.freeze({ axis: e.Axis.Row }), Object.freeze({
1027
1075
  type: r.Number,
1028
1076
  axis: e.Axis.Column
1029
- })), Dn = o({
1030
- FORECAST_ETS: () => dn,
1031
- FORECAST_ETS_CONFINT: () => gn,
1032
- FORECAST_ETS_SEASONALITY: () => Nn,
1033
- FORECAST_ETS_STAT: () => yn
1077
+ })), gn = o({
1078
+ FORECAST_ETS: () => yn,
1079
+ FORECAST_ETS_CONFINT: () => bn,
1080
+ FORECAST_ETS_SEASONALITY: () => En,
1081
+ FORECAST_ETS_STAT: () => vn
1034
1082
  });
1035
- function dn(t, e, r, a = 1, o = 1, s = 1) {
1036
- const i = En(e, r, o, s);
1037
- if (n.isError(i)) return i;
1038
- const { values: l, stepSize: u, lastTime: f, firstTime: c } = i, m = Math.round((t - f) / u), h = In(l, a);
1083
+ function yn(t, e, r, a = 1, o = 1, i = 1) {
1084
+ const s = In(e, r, o, i);
1085
+ if (n.isError(s)) return s;
1086
+ const { values: u, stepSize: l, lastTime: f, firstTime: c } = s, m = Math.round((t - f) / l), h = Tn(u, a);
1039
1087
  if (n.isError(h)) return h;
1040
- const { alpha: M, beta: p, gamma: D, period: d, b0: g } = h, { L: N, T: y, S: b, finalIndex: E } = Rn(l, M, p, D, d, g).finalState;
1041
- let v = N + m * y;
1042
- return d > 1 && (v += b[(E + m) % d]), v;
1088
+ const { alpha: M, beta: p, gamma: N, period: D, b0: d } = h, { L: g, T: y, S: b, finalIndex: E } = Cn(u, M, p, N, D, d).finalState;
1089
+ let v = g + m * y;
1090
+ return D > 1 && (v += b[(E + m) % D]), v;
1043
1091
  }
1044
- function gn(e, r, a, o = .95, s = 1, i = 1, l = 1) {
1092
+ function bn(e, r, a, o = .95, i = 1, s = 1, u = 1) {
1045
1093
  if (o < 0 || o >= 1) return n.BuiltIn.Num;
1046
- const u = En(r, a, i, l);
1047
- if (n.isError(u)) return u;
1048
- const { values: f, stepSize: c, lastTime: m } = u;
1094
+ const l = In(r, a, s, u);
1095
+ if (n.isError(l)) return l;
1096
+ const { values: f, stepSize: c, lastTime: m } = l;
1049
1097
  if (f.length < 4) return 0;
1050
- const h = Math.round((e - m) / c), M = In(f, s);
1098
+ const h = Math.round((e - m) / c), M = Tn(f, i);
1051
1099
  if (n.isError(M)) return M;
1052
- const { alpha: p, beta: D, gamma: d, period: g, b0: N } = M, y = function(t, n, e, r, a, o) {
1053
- const s = t.length;
1054
- let i, l;
1055
- const u = new Array(Math.max(1, a)).fill(0);
1056
- if (a > 1 && s >= 2 * a) {
1100
+ const { alpha: p, beta: N, gamma: D, period: d, b0: g } = M, y = function(t, n, e, r, a, o) {
1101
+ const i = t.length;
1102
+ let s, u;
1103
+ const l = new Array(Math.max(1, a)).fill(0);
1104
+ if (a > 1 && i >= 2 * a) {
1057
1105
  let n = 0, e = 0;
1058
1106
  for (let e = 0; e < a; e++) n += t[e];
1059
1107
  for (let n = a; n < 2 * a; n++) e += t[n];
1060
- i = n / a, l = (e - n) / (a * a);
1108
+ s = n / a, u = (e - n) / (a * a);
1061
1109
  const r = n / a;
1062
- for (let n = 0; n < a; n++) u[n] = t[n] - r;
1063
- } else i = t[0], l = void 0 !== o ? o : a > 1 && a < s ? (t[a] - t[0]) / a : 0;
1110
+ for (let n = 0; n < a; n++) l[n] = t[n] - r;
1111
+ } else s = t[0], u = void 0 !== o ? o : a > 1 && a < i ? (t[a] - t[0]) / a : 0;
1064
1112
  let f = 0;
1065
- for (let o = 0; o < s; o++) {
1066
- const s = a > 1 ? o % a : 0, c = a > 1 ? u[s] : 0, m = i + l + c, h = t[o] - m;
1113
+ for (let o = 0; o < i; o++) {
1114
+ const i = a > 1 ? o % a : 0, c = a > 1 ? l[i] : 0, m = s + u + c, h = t[o] - m;
1067
1115
  f += h * h;
1068
- const M = n * (t[o] - c) + (1 - n) * (i + l), p = e * (M - i) + (1 - e) * l;
1069
- a > 1 && (u[s] = r * (t[o] - M) + (1 - r) * c), i = M, l = p;
1116
+ const M = n * (t[o] - c) + (1 - n) * (s + u), p = e * (M - s) + (1 - e) * u;
1117
+ a > 1 && (l[i] = r * (t[o] - M) + (1 - r) * c), s = M, u = p;
1070
1118
  }
1071
- return Math.sqrt(f / s);
1072
- }(f, p, D, d, g, N), b = function(t, n, e, r) {
1119
+ return Math.sqrt(f / i);
1120
+ }(f, p, N, D, d, g), b = function(t, n, e, r) {
1073
1121
  const a = Math.abs(r);
1074
1122
  if (0 === a) return 0;
1075
- let o = 0, s = 1;
1123
+ let o = 0, i = 1;
1076
1124
  for (let r = 1; r <= a; r++) {
1077
- o += s * s;
1078
- s = s + t + (e > 1 && r % e === 0 ? n : 0);
1125
+ o += i * i;
1126
+ i = i + t + (e > 1 && r % e === 0 ? n : 0);
1079
1127
  }
1080
1128
  return o;
1081
- }(p, d, g, h);
1129
+ }(p, D, d, h);
1082
1130
  return function(n) {
1083
1131
  const e = (1 + n) / 2, r = t.getFunction("NORM.S.INV");
1084
1132
  if (r) return r.execute(e);
@@ -1086,19 +1134,19 @@ function gn(e, r, a, o = .95, s = 1, i = 1, l = 1) {
1086
1134
  return a - (2.515517 + .802853 * a + .010328 * a * a) / (1 + 1.432788 * a + .189269 * a * a + .001308 * a * a * a);
1087
1135
  }(o) * y * Math.sqrt(b);
1088
1136
  }
1089
- function Nn(t, e, r = 1, a = 1) {
1090
- const o = En(t, e, r, a);
1137
+ function En(t, e, r = 1, a = 1) {
1138
+ const o = In(t, e, r, a);
1091
1139
  if (n.isError(o)) return o === n.BuiltIn.NA ? o : 0;
1092
- const { values: s } = o;
1093
- return s.length < 4 ? 0 : vn(s);
1140
+ const { values: i } = o;
1141
+ return i.length < 4 ? 0 : Sn(i);
1094
1142
  }
1095
- function yn(t, e, r, a = 1, o = 1, s = 1) {
1143
+ function vn(t, e, r, a = 1, o = 1, i = 1) {
1096
1144
  if (r < 1 || r > 8) return n.BuiltIn.Num;
1097
- const i = En(t, e, o, s);
1098
- if (n.isError(i)) return i;
1099
- const { values: l, stepSize: u } = i;
1100
- if (8 === r) return u;
1101
- const f = In(l, a);
1145
+ const s = In(t, e, o, i);
1146
+ if (n.isError(s)) return s;
1147
+ const { values: u, stepSize: l } = s;
1148
+ if (8 === r) return l;
1149
+ const f = Tn(u, a);
1102
1150
  if (n.isError(f)) return f;
1103
1151
  const { alpha: c, beta: m, gamma: h, period: M, b0: p } = f;
1104
1152
  switch (r) {
@@ -1107,33 +1155,33 @@ function yn(t, e, r, a = 1, o = 1, s = 1) {
1107
1155
  case 3: return h;
1108
1156
  default: {
1109
1157
  const t = function(t, n, e, r, a, o) {
1110
- const s = t.length;
1111
- let i, l;
1112
- const u = new Array(Math.max(1, a)).fill(0);
1113
- if (a > 1 && s >= 2 * a) {
1158
+ const i = t.length;
1159
+ let s, u;
1160
+ const l = new Array(Math.max(1, a)).fill(0);
1161
+ if (a > 1 && i >= 2 * a) {
1114
1162
  let n = 0, e = 0;
1115
1163
  for (let e = 0; e < a; e++) n += t[e];
1116
1164
  for (let n = a; n < 2 * a; n++) e += t[n];
1117
- i = n / a, l = (e - n) / (a * a);
1165
+ s = n / a, u = (e - n) / (a * a);
1118
1166
  const r = n / a;
1119
- for (let n = 0; n < a; n++) u[n] = t[n] - r;
1120
- } else i = t[0], l = void 0 !== o ? o : a > 1 && a < s ? (t[a] - t[0]) / a : 0;
1167
+ for (let n = 0; n < a; n++) l[n] = t[n] - r;
1168
+ } else s = t[0], u = void 0 !== o ? o : a > 1 && a < i ? (t[a] - t[0]) / a : 0;
1121
1169
  let f = 0, c = 0, m = 0, h = 0;
1122
- for (let n = 1; n < s; n++) h += Math.abs(t[n] - t[n - 1]);
1123
- const M = h / (s - 1);
1124
- for (let o = 0; o < s; o++) {
1125
- const s = t[o], h = a > 1 ? o % a : 0, M = a > 1 ? u[h] : 0, p = i + l + M, D = s - p;
1126
- f += Math.abs(D), c += D * D, m += Math.abs(D) / ((Math.abs(s) + Math.abs(p)) / 2 || 1);
1127
- const d = n * (s - M) + (1 - n) * (i + l), g = e * (d - i) + (1 - e) * l;
1128
- a > 1 && (u[h] = r * (s - d) + (1 - r) * M), i = d, l = g;
1170
+ for (let n = 1; n < i; n++) h += Math.abs(t[n] - t[n - 1]);
1171
+ const M = h / (i - 1);
1172
+ for (let o = 0; o < i; o++) {
1173
+ const i = t[o], h = a > 1 ? o % a : 0, M = a > 1 ? l[h] : 0, p = s + u + M, N = i - p;
1174
+ f += Math.abs(N), c += N * N, m += Math.abs(N) / ((Math.abs(i) + Math.abs(p)) / 2 || 1);
1175
+ const D = n * (i - M) + (1 - n) * (s + u), d = e * (D - s) + (1 - e) * u;
1176
+ a > 1 && (l[h] = r * (i - D) + (1 - r) * M), s = D, u = d;
1129
1177
  }
1130
1178
  return {
1131
- mae: f / s,
1132
- rmse: Math.sqrt(c / s),
1133
- smape: m / s,
1134
- mase: 0 === M ? 0 : f / s / M
1179
+ mae: f / i,
1180
+ rmse: Math.sqrt(c / i),
1181
+ smape: m / i,
1182
+ mase: 0 === M ? 0 : f / i / M
1135
1183
  };
1136
- }(l, c, m, h, M, p);
1184
+ }(u, c, m, h, M, p);
1137
1185
  if (4 === r) return t.mase;
1138
1186
  if (5 === r) return t.smape;
1139
1187
  if (6 === r) return t.mae;
@@ -1142,7 +1190,7 @@ function yn(t, e, r, a = 1, o = 1, s = 1) {
1142
1190
  }
1143
1191
  return n.BuiltIn.Num;
1144
1192
  }
1145
- function bn(t, e) {
1193
+ function Rn(t, e) {
1146
1194
  if (1 === t.length) return t[0].value;
1147
1195
  const r = t.map((t) => t.value);
1148
1196
  switch (e) {
@@ -1159,60 +1207,60 @@ function bn(t, e) {
1159
1207
  default: return n.BuiltIn.Num;
1160
1208
  }
1161
1209
  }
1162
- function En(t, e, r, a) {
1210
+ function In(t, e, r, a) {
1163
1211
  if (r < 0 || r > 1) return n.BuiltIn.Num;
1164
- const o = t.flatten(Mn), s = e.flatten(Mn);
1165
- if (o.length !== s.length) return n.BuiltIn.NA;
1212
+ const o = t.flatten(Dn), i = e.flatten(Dn);
1213
+ if (o.length !== i.length) return n.BuiltIn.NA;
1166
1214
  if (o.length < 2) return n.BuiltIn.Num;
1167
- const i = s.map((t, n) => ({
1215
+ const s = i.map((t, n) => ({
1168
1216
  time: t,
1169
1217
  value: o[n]
1170
- })).sort((t, n) => t.time - n.time), l = [];
1171
- let u = [i[0]];
1172
- for (let t = 1; t < i.length; t++) {
1173
- const e = i[t];
1174
- if (e.time === i[t - 1].time) u.push(e);
1218
+ })).sort((t, n) => t.time - n.time), u = [];
1219
+ let l = [s[0]];
1220
+ for (let t = 1; t < s.length; t++) {
1221
+ const e = s[t];
1222
+ if (e.time === s[t - 1].time) l.push(e);
1175
1223
  else {
1176
- const t = bn(u, a);
1224
+ const t = Rn(l, a);
1177
1225
  if (n.isError(t)) return t;
1178
- l.push({
1179
- time: u[0].time,
1226
+ u.push({
1227
+ time: l[0].time,
1180
1228
  value: t
1181
- }), u = [e];
1229
+ }), l = [e];
1182
1230
  }
1183
1231
  }
1184
- const f = bn(u, a);
1232
+ const f = Rn(l, a);
1185
1233
  if (n.isError(f)) return f;
1186
- if (l.push({
1187
- time: u[0].time,
1234
+ if (u.push({
1235
+ time: l[0].time,
1188
1236
  value: f
1189
- }), l.length < 2) return n.BuiltIn.Num;
1237
+ }), u.length < 2) return n.BuiltIn.Num;
1190
1238
  const c = [];
1191
- for (let t = 1; t < l.length; t++) c.push(l[t].time - l[t - 1].time);
1239
+ for (let t = 1; t < u.length; t++) c.push(u[t].time - u[t - 1].time);
1192
1240
  c.sort((t, n) => t - n);
1193
1241
  const m = Math.floor(c.length / 2), h = c.length % 2 != 0 ? c[m] : (c[m - 1] + c[m]) / 2;
1194
1242
  if (h <= 0) return n.BuiltIn.Num;
1195
- const M = [l[0].value];
1196
- for (let t = 1; t < l.length; t++) {
1197
- const e = l[t - 1].time, a = l[t].time, o = e + h;
1243
+ const M = [u[0].value];
1244
+ for (let t = 1; t < u.length; t++) {
1245
+ const e = u[t - 1].time, a = u[t].time, o = e + h;
1198
1246
  if (a > o) {
1199
1247
  const n = Math.round((a - e) / h) - 1;
1200
1248
  for (let e = 1; e <= n; e++) if (0 === r) M.push(0);
1201
1249
  else {
1202
- const r = l[t - 1].value, a = l[t].value;
1250
+ const r = u[t - 1].value, a = u[t].value;
1203
1251
  M.push(r + e / (n + 1) * (a - r));
1204
1252
  }
1205
1253
  } else if (Math.abs(a - o) > .01 * h) return n.BuiltIn.Num;
1206
- M.push(l[t].value);
1254
+ M.push(u[t].value);
1207
1255
  }
1208
1256
  return {
1209
1257
  values: M,
1210
1258
  stepSize: h,
1211
- lastTime: l[l.length - 1].time,
1212
- firstTime: l[0].time
1259
+ lastTime: u[u.length - 1].time,
1260
+ firstTime: u[0].time
1213
1261
  };
1214
1262
  }
1215
- function vn(t) {
1263
+ function Sn(t) {
1216
1264
  const n = t.length;
1217
1265
  if (n < 4) return 0;
1218
1266
  const e = t.reduce((t, n) => t + n, 0) / n;
@@ -1220,54 +1268,54 @@ function vn(t) {
1220
1268
  for (let a = 0; a < n; a++) r += Math.pow(t[a] - e, 2);
1221
1269
  if (0 === r) return 0;
1222
1270
  let a = -Infinity, o = 0;
1223
- const s = Math.min(Math.floor(n / 2), 24);
1224
- for (let i = 2; i <= s; i++) {
1225
- let s = 0;
1226
- for (let r = 0; r < n - i; r++) s += (t[r] - e) * (t[r + i] - e);
1227
- const l = s / r;
1228
- l > a && l > .3 && (a = l, o = i);
1271
+ const i = Math.min(Math.floor(n / 2), 24);
1272
+ for (let s = 2; s <= i; s++) {
1273
+ let i = 0;
1274
+ for (let r = 0; r < n - s; r++) i += (t[r] - e) * (t[r + s] - e);
1275
+ const u = i / r;
1276
+ u > a && u > .3 && (a = u, o = s);
1229
1277
  }
1230
1278
  return o;
1231
1279
  }
1232
- function Rn(t, n, e, r, a, o) {
1233
- const s = t.length;
1234
- let i, l;
1235
- if (a > 1 && s >= 2 * a) {
1280
+ function Cn(t, n, e, r, a, o) {
1281
+ const i = t.length;
1282
+ let s, u;
1283
+ if (a > 1 && i >= 2 * a) {
1236
1284
  let n = 0, e = 0;
1237
1285
  for (let e = 0; e < a; e++) n += t[e];
1238
1286
  for (let n = a; n < 2 * a; n++) e += t[n];
1239
- i = n / a, l = (e - n) / (a * a);
1240
- } else i = t[0], l = void 0 !== o ? o : a > 1 && a < s ? (t[a] - t[0]) / a : 0;
1241
- const u = new Array(Math.max(1, a)).fill(0);
1242
- if (a > 1 && s >= a) {
1243
- const n = u.length > 0 ? (() => {
1287
+ s = n / a, u = (e - n) / (a * a);
1288
+ } else s = t[0], u = void 0 !== o ? o : a > 1 && a < i ? (t[a] - t[0]) / a : 0;
1289
+ const l = new Array(Math.max(1, a)).fill(0);
1290
+ if (a > 1 && i >= a) {
1291
+ const n = l.length > 0 ? (() => {
1244
1292
  let n = 0;
1245
1293
  for (let e = 0; e < a; e++) n += t[e];
1246
1294
  return n / a;
1247
- })() : i;
1248
- for (let e = 0; e < a; e++) u[e] = t[e] - n;
1295
+ })() : s;
1296
+ for (let e = 0; e < a; e++) l[e] = t[e] - n;
1249
1297
  }
1250
1298
  let f = 0, c = 0;
1251
- for (let o = 0; o < s; o++) {
1252
- const s = t[o], m = a > 1 ? o % a : 0, h = a > 1 ? u[m] : 0, M = s - (i + l + h);
1299
+ for (let o = 0; o < i; o++) {
1300
+ const i = t[o], m = a > 1 ? o % a : 0, h = a > 1 ? l[m] : 0, M = i - (s + u + h);
1253
1301
  f += M * M;
1254
- const p = n * (s - h) + (1 - n) * (i + l), D = e * (p - i) + (1 - e) * l;
1255
- a > 1 && (u[m] = r * (s - p) + (1 - r) * h), i = p, l = D, c = m;
1302
+ const p = n * (i - h) + (1 - n) * (s + u), N = e * (p - s) + (1 - e) * u;
1303
+ a > 1 && (l[m] = r * (i - p) + (1 - r) * h), s = p, u = N, c = m;
1256
1304
  }
1257
1305
  return {
1258
- mse: f / s,
1306
+ mse: f / i,
1259
1307
  finalState: {
1260
- L: i,
1261
- T: l,
1262
- S: u,
1308
+ L: s,
1309
+ T: u,
1310
+ S: l,
1263
1311
  finalIndex: c
1264
1312
  }
1265
1313
  };
1266
1314
  }
1267
- function In(t, e) {
1315
+ function Tn(t, e) {
1268
1316
  let r = 1;
1269
1317
  if (0 === e) r = 1;
1270
- else if (1 === e) r = vn(t), r <= 1 && (r = 1);
1318
+ else if (1 === e) r = Sn(t), r <= 1 && (r = 1);
1271
1319
  else {
1272
1320
  if (!(e > 1)) return n.BuiltIn.Num;
1273
1321
  r = Math.floor(e);
@@ -1275,9 +1323,9 @@ function In(t, e) {
1275
1323
  if (r > 1 && t.length < 2 * r) return n.BuiltIn.Num;
1276
1324
  const a = t.length;
1277
1325
  if (1 === r) {
1278
- const n = Math.max(1, Math.floor(a / 4)), e = Cn((n) => {
1326
+ const n = Math.max(1, Math.floor(a / 4)), e = An((n) => {
1279
1327
  const e = Math.max(.001, Math.min(.999, n[0])), r = Math.max(.001, Math.min(.999, n[1])), a = n[2];
1280
- return Rn(t, e, r, 0, 1, a).mse;
1328
+ return Cn(t, e, r, 0, 1, a).mse;
1281
1329
  }, [
1282
1330
  .9,
1283
1331
  .1,
@@ -1291,7 +1339,7 @@ function In(t, e) {
1291
1339
  b0: e[2]
1292
1340
  };
1293
1341
  }
1294
- const o = Cn((n) => Rn(t, Math.max(.001, Math.min(.999, n[0])), Math.max(.001, Math.min(.999, n[1])), Math.max(.001, Math.min(.999, n[2])), r).mse, [
1342
+ const o = An((n) => Cn(t, Math.max(.001, Math.min(.999, n[0])), Math.max(.001, Math.min(.999, n[1])), Math.max(.001, Math.min(.999, n[2])), r).mse, [
1295
1343
  .9,
1296
1344
  .1,
1297
1345
  .1
@@ -1304,11 +1352,11 @@ function In(t, e) {
1304
1352
  b0: 0
1305
1353
  };
1306
1354
  }
1307
- function Sn(t, n, e, r, a) {
1355
+ function xn(t, n, e, r, a) {
1308
1356
  for (let o = 0; o < t.length; ++o) t[o] = n * e[o] + r * a[o];
1309
1357
  }
1310
- function Cn(t, n, e) {
1311
- const r = (e = e || {}).maxIterations || 200 * n.length, a = e.nonZeroDelta || 1.05, o = e.zeroDelta || .001, s = e.minErrorDelta || 1e-6, i = e.minTolerance || 1e-5, l = void 0 !== e.rho ? e.rho : 1, u = void 0 !== e.chi ? e.chi : 2, f = void 0 !== e.psi ? e.psi : -.5, c = void 0 !== e.sigma ? e.sigma : .5;
1358
+ function An(t, n, e) {
1359
+ const r = (e = e || {}).maxIterations || 200 * n.length, a = e.nonZeroDelta || 1.05, o = e.zeroDelta || .001, i = e.minErrorDelta || 1e-6, s = e.minTolerance || 1e-5, u = void 0 !== e.rho ? e.rho : 1, l = void 0 !== e.chi ? e.chi : 2, f = void 0 !== e.psi ? e.psi : -.5, c = void 0 !== e.sigma ? e.sigma : .5;
1312
1360
  let m;
1313
1361
  const h = n.length, M = new Array(h + 1);
1314
1362
  M[0] = n, M[0].fx = t(n), M[0].id = 0;
@@ -1320,9 +1368,9 @@ function Cn(t, n, e) {
1320
1368
  for (let n = 0; n < t.length; n++) M[h][n] = t[n];
1321
1369
  M[h].fx = t.fx;
1322
1370
  }
1323
- const D = (t, n) => t.fx - n.fx, d = n.slice(), g = n.slice(), N = n.slice(), y = n.slice();
1371
+ const N = (t, n) => t.fx - n.fx, D = n.slice(), d = n.slice(), g = n.slice(), y = n.slice();
1324
1372
  for (let n = 0; n < r; ++n) {
1325
- if (M.sort(D), e.history) {
1373
+ if (M.sort(N), e.history) {
1326
1374
  const t = M.map((t) => {
1327
1375
  const n = t.slice();
1328
1376
  return n.fx = t.fx, n.id = t.id, n;
@@ -1335,85 +1383,85 @@ function Cn(t, n, e) {
1335
1383
  }
1336
1384
  m = 0;
1337
1385
  for (let t = 0; t < h; ++t) m = Math.max(m, Math.abs(M[0][t] - M[1][t]));
1338
- if (Math.abs(M[0].fx - M[h].fx) < s && m < i) break;
1386
+ if (Math.abs(M[0].fx - M[h].fx) < i && m < s) break;
1339
1387
  for (let t = 0; t < h; ++t) {
1340
- d[t] = 0;
1341
- for (let n = 0; n < h; ++n) d[t] += M[n][t];
1342
- d[t] /= h;
1388
+ D[t] = 0;
1389
+ for (let n = 0; n < h; ++n) D[t] += M[n][t];
1390
+ D[t] /= h;
1343
1391
  }
1344
1392
  const n = M[h];
1345
- if (Sn(g, 1 + l, d, -l, n), g.fx = t(g), g.fx < M[0].fx) Sn(y, 1 + u, d, -u, n), y.fx = t(y), p(y.fx < g.fx ? y : g);
1346
- else if (g.fx >= M[h - 1].fx) {
1393
+ if (xn(d, 1 + u, D, -u, n), d.fx = t(d), d.fx < M[0].fx) xn(y, 1 + l, D, -l, n), y.fx = t(y), p(y.fx < d.fx ? y : d);
1394
+ else if (d.fx >= M[h - 1].fx) {
1347
1395
  let e = !1;
1348
- if (g.fx > n.fx ? (Sn(N, 1 + f, d, -f, n), N.fx = t(N), N.fx < n.fx ? p(N) : e = !0) : (Sn(N, 1 - f * l, d, f * l, n), N.fx = t(N), N.fx < g.fx ? p(N) : e = !0), e) {
1396
+ if (d.fx > n.fx ? (xn(g, 1 + f, D, -f, n), g.fx = t(g), g.fx < n.fx ? p(g) : e = !0) : (xn(g, 1 - f * u, D, f * u, n), g.fx = t(g), g.fx < d.fx ? p(g) : e = !0), e) {
1349
1397
  if (c >= 1) break;
1350
- for (let n = 1; n < M.length; ++n) Sn(M[n], 1 - c, M[0], c, M[n]), M[n].fx = t(M[n]);
1398
+ for (let n = 1; n < M.length; ++n) xn(M[n], 1 - c, M[0], c, M[n]), M[n].fx = t(M[n]);
1351
1399
  }
1352
- } else p(g);
1400
+ } else p(d);
1353
1401
  }
1354
- return M.sort(D), {
1402
+ return M.sort(N), {
1355
1403
  fx: M[0].fx,
1356
1404
  x: M[0]
1357
1405
  };
1358
1406
  }
1359
- var Tn = (t, e) => {
1407
+ var wn = (t, e) => {
1360
1408
  const r = t.getRowCount(), a = t.getColumnCount(), o = r * a;
1361
1409
  if (0 === o) throw n.BuiltIn.Value;
1362
- const s = Bn(t, o), i = 1 === r && a > 1, l = r > 1 && a > 1;
1410
+ const i = Fn(t, o), s = 1 === r && a > 1, u = r > 1 && a > 1;
1363
1411
  if (!e || 0 === e.size) {
1364
1412
  const t = new Array(o);
1365
1413
  for (let n = 0; n < o; n++) t[n] = [n + 1];
1366
1414
  return {
1367
- ys: s,
1415
+ ys: i,
1368
1416
  xs: t,
1369
1417
  k: 1,
1370
- isRowOriented: i,
1371
- isRectangularY: l,
1418
+ isRowOriented: s,
1419
+ isRectangularY: u,
1372
1420
  yRows: r,
1373
1421
  yCols: a
1374
1422
  };
1375
1423
  }
1376
- const u = e.getRowCount(), f = e.getColumnCount();
1377
- if (l) {
1378
- if (u !== r || f !== a) throw n.BuiltIn.Ref;
1379
- const t = Bn(e, o), c = new Array(o);
1424
+ const l = e.getRowCount(), f = e.getColumnCount();
1425
+ if (u) {
1426
+ if (l !== r || f !== a) throw n.BuiltIn.Ref;
1427
+ const t = Fn(e, o), c = new Array(o);
1380
1428
  for (let n = 0; n < o; n++) c[n] = [t[n]];
1381
1429
  return {
1382
- ys: s,
1430
+ ys: i,
1383
1431
  xs: c,
1384
1432
  k: 1,
1385
- isRowOriented: i,
1386
- isRectangularY: l,
1433
+ isRowOriented: s,
1434
+ isRectangularY: u,
1387
1435
  yRows: r,
1388
1436
  yCols: a
1389
1437
  };
1390
1438
  }
1391
- if ((i ? f : u) !== o) throw n.BuiltIn.Ref;
1392
- const c = i ? u : f;
1439
+ if ((s ? f : l) !== o) throw n.BuiltIn.Ref;
1440
+ const c = s ? l : f;
1393
1441
  return {
1394
- ys: s,
1395
- xs: On(e, o, c, i),
1442
+ ys: i,
1443
+ xs: Yn(e, o, c, s),
1396
1444
  k: c,
1397
- isRowOriented: i,
1398
- isRectangularY: l,
1445
+ isRowOriented: s,
1446
+ isRectangularY: u,
1399
1447
  yRows: r,
1400
1448
  yCols: a
1401
1449
  };
1402
- }, An = (t) => {
1450
+ }, Vn = (t) => {
1403
1451
  const e = new Array(t.length);
1404
1452
  for (let r = 0; r < t.length; r++) {
1405
1453
  if (t[r] <= 0) throw n.BuiltIn.Num;
1406
1454
  e[r] = Math.log(t[r]);
1407
1455
  }
1408
1456
  return e;
1409
- }, wn = (t, e, r) => {
1410
- let a, o, s;
1457
+ }, Bn = (t, e, r) => {
1458
+ let a, o, i;
1411
1459
  if (e && e.size > 0) {
1412
1460
  const r = ((t, e) => {
1413
1461
  const r = t.getRowCount(), a = t.getColumnCount(), o = r * a;
1414
1462
  if (0 === o) throw n.BuiltIn.Ref;
1415
1463
  if (1 === e.k) {
1416
- const n = Bn(t, o), e = new Array(o);
1464
+ const n = Fn(t, o), e = new Array(o);
1417
1465
  for (let t = 0; t < o; t++) e[t] = [n[t]];
1418
1466
  return {
1419
1467
  xs: e,
@@ -1421,89 +1469,89 @@ var Tn = (t, e) => {
1421
1469
  cols: a
1422
1470
  };
1423
1471
  }
1424
- const s = e.isRowOriented ? a : r;
1472
+ const i = e.isRowOriented ? a : r;
1425
1473
  if ((e.isRowOriented ? r : a) !== e.k) throw n.BuiltIn.Ref;
1426
1474
  return {
1427
- xs: On(t, s, e.k, e.isRowOriented),
1428
- rows: e.isRowOriented ? 1 : s,
1429
- cols: e.isRowOriented ? s : 1
1475
+ xs: Yn(t, i, e.k, e.isRowOriented),
1476
+ rows: e.isRowOriented ? 1 : i,
1477
+ cols: e.isRowOriented ? i : 1
1430
1478
  };
1431
1479
  })(e, t);
1432
- a = r.xs, o = r.rows, s = r.cols;
1433
- } else a = t.xs, o = t.yRows, s = t.yCols;
1434
- const i = new Array(o);
1435
- let l = 0;
1480
+ a = r.xs, o = r.rows, i = r.cols;
1481
+ } else a = t.xs, o = t.yRows, i = t.yCols;
1482
+ const s = new Array(o);
1483
+ let u = 0;
1436
1484
  for (let t = 0; t < o; t++) {
1437
- const n = new Array(s);
1438
- for (let t = 0; t < s; t++) n[t] = r(a[l++]);
1439
- i[t] = n;
1485
+ const n = new Array(i);
1486
+ for (let t = 0; t < i; t++) n[t] = r(a[u++]);
1487
+ s[t] = n;
1440
1488
  }
1441
- return i;
1442
- }, xn = (t, n, e) => {
1443
- const r = t.length, a = n.length > 0 ? n[0].length : 0, o = [], s = [];
1444
- e && (o.push(new Array(r).fill(1)), s.push(a));
1489
+ return s;
1490
+ }, On = (t, n, e) => {
1491
+ const r = t.length, a = n.length > 0 ? n[0].length : 0, o = [], i = [];
1492
+ e && (o.push(new Array(r).fill(1)), i.push(a));
1445
1493
  for (let t = a - 1; t >= 0; t--) {
1446
1494
  const e = new Array(r);
1447
1495
  for (let a = 0; a < r; a++) e[a] = n[a][t];
1448
- o.push(e), s.push(a - 1 - t);
1496
+ o.push(e), i.push(a - 1 - t);
1449
1497
  }
1450
- const i = [], l = [], u = [];
1498
+ const s = [], u = [], l = [];
1451
1499
  for (let t = 0; t < o.length; t++) {
1452
- const n = o[t].slice(), e = Math.sqrt(Pn(n, n)), a = new Array(l.length).fill(0);
1453
- for (let t = 0; t < 2; t++) for (let t = 0; t < l.length; t++) {
1454
- const e = Pn(l[t], n);
1455
- for (let a = 0; a < r; a++) n[a] -= e * l[t][a];
1500
+ const n = o[t].slice(), e = Math.sqrt(Ln(n, n)), a = new Array(u.length).fill(0);
1501
+ for (let t = 0; t < 2; t++) for (let t = 0; t < u.length; t++) {
1502
+ const e = Ln(u[t], n);
1503
+ for (let a = 0; a < r; a++) n[a] -= e * u[t][a];
1456
1504
  a[t] += e;
1457
1505
  }
1458
- const s = Math.sqrt(Pn(n, n));
1459
- if (!(s <= 1e-10 * (e || 1))) {
1460
- for (let t = 0; t < r; t++) n[t] /= s;
1461
- a.push(s), l.push(n), u.push(a), i.push(t);
1506
+ const i = Math.sqrt(Ln(n, n));
1507
+ if (!(i <= 1e-10 * (e || 1))) {
1508
+ for (let t = 0; t < r; t++) n[t] /= i;
1509
+ a.push(i), u.push(n), l.push(a), s.push(t);
1462
1510
  }
1463
1511
  }
1464
- const f = i.length, c = new Array(f);
1465
- for (let n = 0; n < f; n++) c[n] = Pn(l[n], t);
1512
+ const f = s.length, c = new Array(f);
1513
+ for (let n = 0; n < f; n++) c[n] = Ln(u[n], t);
1466
1514
  const m = new Array(f).fill(0);
1467
1515
  for (let t = f - 1; t >= 0; t--) {
1468
1516
  let n = c[t];
1469
- for (let e = t + 1; e < f; e++) n -= u[e][t] * m[e];
1470
- m[t] = n / u[t][t];
1517
+ for (let e = t + 1; e < f; e++) n -= l[e][t] * m[e];
1518
+ m[t] = n / l[t][t];
1471
1519
  }
1472
1520
  const h = Array.from({ length: f }, () => new Array(f).fill(0));
1473
1521
  for (let t = f - 1; t >= 0; t--) {
1474
- h[t][t] = 1 / u[t][t];
1522
+ h[t][t] = 1 / l[t][t];
1475
1523
  for (let n = t + 1; n < f; n++) {
1476
1524
  let e = 0;
1477
- for (let r = t + 1; r <= n; r++) e += u[r][t] * h[r][n];
1525
+ for (let r = t + 1; r <= n; r++) e += l[r][t] * h[r][n];
1478
1526
  h[t][n] = -e * h[t][t];
1479
1527
  }
1480
1528
  }
1481
1529
  const M = new Array(a + 1).fill(0), p = new Array(a + 1).fill(0);
1482
1530
  for (let t = 0; t < f; t++) {
1483
- const n = s[i[t]];
1531
+ const n = i[s[t]];
1484
1532
  M[n] = m[t];
1485
1533
  let e = 0;
1486
1534
  for (let n = t; n < f; n++) e += h[t][n] * h[t][n];
1487
1535
  p[n] = e;
1488
1536
  }
1489
- const D = (t) => {
1537
+ const N = (t) => {
1490
1538
  let n = e ? M[a] : 0;
1491
1539
  for (let e = 0; e < a; e++) n += M[a - 1 - e] * t[e];
1492
1540
  return n;
1493
1541
  };
1494
- let d = 0;
1542
+ let D = 0;
1495
1543
  for (let e = 0; e < r; e++) {
1496
- const r = t[e] - D(n[e] ?? []);
1497
- d += r * r;
1544
+ const r = t[e] - N(n[e] ?? []);
1545
+ D += r * r;
1498
1546
  }
1499
- let g = 0;
1547
+ let d = 0;
1500
1548
  if (e) {
1501
1549
  let n = 0;
1502
1550
  for (let e = 0; e < r; e++) n += t[e];
1503
1551
  n /= r;
1504
- for (let e = 0; e < r; e++) g += (t[e] - n) * (t[e] - n);
1505
- } else for (let n = 0; n < r; n++) g += t[n] * t[n];
1506
- const N = g - d, y = e ? f - 1 : f, b = r - y - (e ? 1 : 0), E = b > 0 ? d / b : 0, v = b > 0 ? Math.sqrt(E) : 0, R = new Array(a + 1).fill(0);
1552
+ for (let e = 0; e < r; e++) d += (t[e] - n) * (t[e] - n);
1553
+ } else for (let n = 0; n < r; n++) d += t[n] * t[n];
1554
+ const g = d - D, y = e ? f - 1 : f, b = r - y - (e ? 1 : 0), E = b > 0 ? D / b : 0, v = b > 0 ? Math.sqrt(E) : 0, R = new Array(a + 1).fill(0);
1507
1555
  for (let t = 0; t <= a; t++) R[t] = v * Math.sqrt(Math.max(p[t], 0));
1508
1556
  return {
1509
1557
  coefficients: M,
@@ -1511,145 +1559,145 @@ var Tn = (t, e) => {
1511
1559
  kEffective: y,
1512
1560
  df: b,
1513
1561
  sey: v,
1514
- r2: 0 === g ? 1 : N / g,
1515
- f: b > 0 && y > 0 && 0 !== E ? N / y / E : null,
1516
- ssReg: N,
1517
- ssResid: d,
1518
- predict: D
1562
+ r2: 0 === d ? 1 : g / d,
1563
+ f: b > 0 && y > 0 && 0 !== E ? g / y / E : null,
1564
+ ssReg: g,
1565
+ ssResid: D,
1566
+ predict: N
1519
1567
  };
1520
- }, Vn = (t, e, r) => {
1521
- const a = e.length, o = n.BuiltIn.NA, s = (t, n) => {
1568
+ }, Pn = (t, e, r) => {
1569
+ const a = e.length, o = n.BuiltIn.NA, i = (t, n) => {
1522
1570
  const e = new Array(a).fill(o);
1523
1571
  return e[0] = t, a > 1 && (e[1] = n), e;
1524
- }, i = t.standardErrors.slice();
1525
- return r || (i[a - 1] = o), [
1572
+ }, s = t.standardErrors.slice();
1573
+ return r || (s[a - 1] = o), [
1526
1574
  e.slice(),
1527
- i,
1528
- s(t.r2, t.sey),
1529
- s(t.f ?? n.BuiltIn.Num, t.df),
1530
- s(t.ssReg, t.ssResid)
1575
+ s,
1576
+ i(t.r2, t.sey),
1577
+ i(t.f ?? n.BuiltIn.Num, t.df),
1578
+ i(t.ssReg, t.ssResid)
1531
1579
  ];
1532
- }, Bn = (t, e) => {
1580
+ }, Fn = (t, e) => {
1533
1581
  const r = new Array(e);
1534
1582
  let a = 0;
1535
- for (const e of t.values(Mn)) {
1583
+ for (const e of t.values(Dn)) {
1536
1584
  if ("number" != typeof e) throw n.BuiltIn.Value;
1537
1585
  r[a++] = e;
1538
1586
  }
1539
1587
  return r;
1540
- }, On = (t, n, e, r) => {
1541
- const a = Bn(t, n * e), o = new Array(n);
1588
+ }, Yn = (t, n, e, r) => {
1589
+ const a = Fn(t, n * e), o = new Array(n);
1542
1590
  for (let t = 0; t < n; t++) {
1543
- const s = new Array(e);
1544
- for (let o = 0; o < e; o++) s[o] = r ? a[o * n + t] : a[t * e + o];
1545
- o[t] = s;
1591
+ const i = new Array(e);
1592
+ for (let o = 0; o < e; o++) i[o] = r ? a[o * n + t] : a[t * e + o];
1593
+ o[t] = i;
1546
1594
  }
1547
1595
  return o;
1548
- }, Pn = (t, n) => {
1596
+ }, Ln = (t, n) => {
1549
1597
  let e = 0;
1550
1598
  for (let r = 0; r < t.length; r++) e += t[r] * n[r];
1551
1599
  return e;
1552
- }, Fn = o({
1553
- GROWTH: () => kn,
1554
- LINEST: () => Yn,
1555
- LOGEST: () => Ln,
1556
- TREND: () => Un
1600
+ }, Un = o({
1601
+ GROWTH: () => jn,
1602
+ LINEST: () => kn,
1603
+ LOGEST: () => qn,
1604
+ TREND: () => Xn
1557
1605
  });
1558
- function Yn(t, n, e = !0, r = !1) {
1559
- const a = Tn(t, n), o = xn(a.ys, a.xs, e), s = o.coefficients;
1560
- return r ? Vn(o, s, e) : [s.slice()];
1606
+ function kn(t, n, e = !0, r = !1) {
1607
+ const a = wn(t, n), o = On(a.ys, a.xs, e), i = o.coefficients;
1608
+ return r ? Pn(o, i, e) : [i.slice()];
1561
1609
  }
1562
- function Ln(t, n, e = !0, r = !1) {
1563
- const a = Tn(t, n), o = xn(An(a.ys), a.xs, e), s = o.coefficients.map(Math.exp);
1564
- return r ? Vn(o, s, e) : [s];
1610
+ function qn(t, n, e = !0, r = !1) {
1611
+ const a = wn(t, n), o = On(Vn(a.ys), a.xs, e), i = o.coefficients.map(Math.exp);
1612
+ return r ? Pn(o, i, e) : [i];
1565
1613
  }
1566
- function Un(t, n, e, r = !0) {
1567
- const a = Tn(t, n);
1568
- return wn(a, e, xn(a.ys, a.xs, r).predict);
1614
+ function Xn(t, n, e, r = !0) {
1615
+ const a = wn(t, n);
1616
+ return Bn(a, e, On(a.ys, a.xs, r).predict);
1569
1617
  }
1570
- function kn(t, n, e, r = !0) {
1571
- const a = Tn(t, n);
1572
- return wn(a, e, xn(An(a.ys), a.xs, r).predict).map((t) => t.map(Math.exp));
1618
+ function jn(t, n, e, r = !0) {
1619
+ const a = wn(t, n);
1620
+ return Bn(a, e, On(Vn(a.ys), a.xs, r).predict).map((t) => t.map(Math.exp));
1573
1621
  }
1574
- var qn = o({
1575
- TTEST: () => Xn,
1576
- T_TEST: () => jn
1622
+ var _n = o({
1623
+ TTEST: () => Gn,
1624
+ T_TEST: () => zn
1577
1625
  });
1578
- function Xn(t, n, e, r) {
1579
- return jn(t, n, e, r);
1626
+ function Gn(t, n, e, r) {
1627
+ return zn(t, n, e, r);
1580
1628
  }
1581
- function jn(t, e, r, a) {
1629
+ function zn(t, e, r, a) {
1582
1630
  if (r = Math.floor(r), a = Math.floor(a), ![1, 2].includes(r) || ![
1583
1631
  1,
1584
1632
  2,
1585
1633
  3
1586
1634
  ].includes(a)) return NaN;
1587
- const o = t.getShape(), s = e.getShape(), i = o.rows * o.columns, l = s.rows * s.columns;
1588
- if (1 === a && i !== l) return n.BuiltIn.NA;
1589
- const u = t.flatten(pn), f = e.flatten(pn);
1590
- if (null === u || null === f) return n.BuiltIn.Value;
1591
- if (u.length < 2 || f.length < 2) throw n.BuiltIn.Div0;
1592
- if (1 === a && u.length !== f.length) return n.BuiltIn.NA;
1635
+ const o = t.getShape(), i = e.getShape(), s = o.rows * o.columns, u = i.rows * i.columns;
1636
+ if (1 === a && s !== u) return n.BuiltIn.NA;
1637
+ const l = t.flatten(dn), f = e.flatten(dn);
1638
+ if (null === l || null === f) return n.BuiltIn.Value;
1639
+ if (l.length < 2 || f.length < 2) throw n.BuiltIn.Div0;
1640
+ if (1 === a && l.length !== f.length) return n.BuiltIn.NA;
1593
1641
  const c = 1 === a ? function(t, n) {
1594
1642
  const e = t.length;
1595
1643
  let r = 0, a = 0, o = 0;
1596
- for (let s = 0; s < e; s++) r += t[s], a += n[s], o += (t[s] - n[s]) ** 2;
1597
- const s = r - a, i = e * o - s ** 2;
1598
- return 0 === i ? { error: !0 } : {
1599
- x: Math.abs(s) * Math.sqrt((e - 1) / i),
1644
+ for (let i = 0; i < e; i++) r += t[i], a += n[i], o += (t[i] - n[i]) ** 2;
1645
+ const i = r - a, s = e * o - i ** 2;
1646
+ return 0 === s ? { error: !0 } : {
1647
+ x: Math.abs(i) * Math.sqrt((e - 1) / s),
1600
1648
  df: e - 1
1601
1649
  };
1602
- }(u, f) : 2 === a ? function(t, n) {
1650
+ }(l, f) : 2 === a ? function(t, n) {
1603
1651
  const e = t.length, r = n.length;
1604
- let a = 0, o = 0, s = 0, i = 0;
1652
+ let a = 0, o = 0, i = 0, s = 0;
1605
1653
  for (const n of t) a += n, o += n * n;
1606
- for (const t of n) s += t, i += t * t;
1607
- const l = o - a ** 2 / e, u = i - s ** 2 / r, f = Math.sqrt(l + u);
1654
+ for (const t of n) i += t, s += t * t;
1655
+ const u = o - a ** 2 / e, l = s - i ** 2 / r, f = Math.sqrt(u + l);
1608
1656
  if (0 === f) return { error: !0 };
1609
1657
  const c = e + r - 2;
1610
1658
  return {
1611
- x: Math.abs(a / e - s / r) / f * Math.sqrt(e * r * c / (e + r)),
1659
+ x: Math.abs(a / e - i / r) / f * Math.sqrt(e * r * c / (e + r)),
1612
1660
  df: c
1613
1661
  };
1614
- }(u, f) : function(t, n) {
1662
+ }(l, f) : function(t, n) {
1615
1663
  const e = t.length, r = n.length;
1616
- let a = 0, o = 0, s = 0, i = 0;
1664
+ let a = 0, o = 0, i = 0, s = 0;
1617
1665
  for (const n of t) a += n, o += n * n;
1618
- for (const t of n) s += t, i += t * t;
1619
- const l = (o - a ** 2 / e) / (e * (e - 1)), u = (i - s ** 2 / r) / (r * (r - 1));
1620
- if (l + u === 0) return { error: !0 };
1621
- const f = Math.abs(a / e - s / r) / Math.sqrt(l + u), c = l / (l + u);
1666
+ for (const t of n) i += t, s += t * t;
1667
+ const u = (o - a ** 2 / e) / (e * (e - 1)), l = (s - i ** 2 / r) / (r * (r - 1));
1668
+ if (u + l === 0) return { error: !0 };
1669
+ const f = Math.abs(a / e - i / r) / Math.sqrt(u + l), c = u / (u + l);
1622
1670
  return {
1623
1671
  x: f,
1624
1672
  df: 1 / (c ** 2 / (e - 1) + (1 - c) ** 2 / (r - 1))
1625
1673
  };
1626
- }(u, f);
1674
+ }(l, f);
1627
1675
  if ("error" in c) throw n.BuiltIn.Div0;
1628
1676
  return function(t, n) {
1629
1677
  const e = .5 * function(t, n, e) {
1630
1678
  if (e <= 0) return 0;
1631
1679
  if (e >= 1) return 1;
1632
- const r = Gn(t) + Gn(n) - Gn(t + n), a = Math.exp(Math.log(e) * t + Math.log(1 - e) * n - r);
1633
- return e < (t + 1) / (t + n + 2) ? a * _n(t, n, e) / t : 1 - a * _n(n, t, 1 - e) / n;
1680
+ const r = Kn(t) + Kn(n) - Kn(t + n), a = Math.exp(Math.log(e) * t + Math.log(1 - e) * n - r);
1681
+ return e < (t + 1) / (t + n + 2) ? a * Hn(t, n, e) / t : 1 - a * Hn(n, t, 1 - e) / n;
1634
1682
  }(n / 2, .5, n / (n + t * t));
1635
1683
  return t >= 0 ? 1 - e : e;
1636
1684
  }(-c.x, c.df) * r;
1637
1685
  }
1638
- function _n(t, n, e) {
1639
- const r = 1e-30, a = t + n, o = t + 1, s = t - 1;
1640
- let i = 1, l = 1 - a * e / o;
1641
- Math.abs(l) < r && (l = r), l = 1 / l;
1642
- let u = l;
1686
+ function Hn(t, n, e) {
1687
+ const r = 1e-30, a = t + n, o = t + 1, i = t - 1;
1688
+ let s = 1, u = 1 - a * e / o;
1689
+ Math.abs(u) < r && (u = r), u = 1 / u;
1690
+ let l = u;
1643
1691
  for (let f = 1; f <= 200; f++) {
1644
1692
  const c = 2 * f;
1645
- let m = f * (n - f) * e / ((s + c) * (t + c));
1646
- l = 1 + m * l, Math.abs(l) < r && (l = r), i = 1 + m / i, Math.abs(i) < r && (i = r), l = 1 / l, u *= l * i, m = -(t + f) * (a + f) * e / ((t + c) * (o + c)), l = 1 + m * l, Math.abs(l) < r && (l = r), i = 1 + m / i, Math.abs(i) < r && (i = r), l = 1 / l;
1647
- const h = l * i;
1648
- if (u *= h, Math.abs(h - 1) < 3e-7) break;
1693
+ let m = f * (n - f) * e / ((i + c) * (t + c));
1694
+ u = 1 + m * u, Math.abs(u) < r && (u = r), s = 1 + m / s, Math.abs(s) < r && (s = r), u = 1 / u, l *= u * s, m = -(t + f) * (a + f) * e / ((t + c) * (o + c)), u = 1 + m * u, Math.abs(u) < r && (u = r), s = 1 + m / s, Math.abs(s) < r && (s = r), u = 1 / u;
1695
+ const h = u * s;
1696
+ if (l *= h, Math.abs(h - 1) < 3e-7) break;
1649
1697
  }
1650
- return u;
1698
+ return l;
1651
1699
  }
1652
- function Gn(t) {
1700
+ function Kn(t) {
1653
1701
  const n = [
1654
1702
  .9999999999998099,
1655
1703
  676.5203681218851,
@@ -1661,34 +1709,34 @@ function Gn(t) {
1661
1709
  9984369578019572e-21,
1662
1710
  1.5056327351493116e-7
1663
1711
  ];
1664
- if (t < .5) return Math.log(Math.PI / Math.sin(Math.PI * t)) - Gn(1 - t);
1712
+ if (t < .5) return Math.log(Math.PI / Math.sin(Math.PI * t)) - Kn(1 - t);
1665
1713
  t--;
1666
1714
  let e = n[0];
1667
1715
  for (let r = 1; r < 9; r++) e += n[r] / (t + r);
1668
1716
  const r = t + 7.5;
1669
1717
  return .5 * Math.log(2 * Math.PI) + (t + .5) * Math.log(r) - r + Math.log(e);
1670
1718
  }
1671
- var zn = o({
1672
- REGEXEXTRACT: () => Hn,
1673
- REGEXMATCH: () => Kn,
1674
- REGEXREPLACE: () => Qn,
1675
- REGEXTEST: () => Wn
1719
+ var Qn = o({
1720
+ REGEXEXTRACT: () => Wn,
1721
+ REGEXMATCH: () => $n,
1722
+ REGEXREPLACE: () => Zn,
1723
+ REGEXTEST: () => Jn
1676
1724
  });
1677
- function Hn(e, r, a = 0, o = !1) {
1678
- const s = $n(r, o);
1679
- if (n.isError(s)) return s;
1725
+ function Wn(e, r, a = 0, o = !1) {
1726
+ const i = te(r, o);
1727
+ if (n.isError(i)) return i;
1680
1728
  if (0 === a) {
1681
- const r = e.match(s);
1729
+ const r = e.match(i);
1682
1730
  return r ? t.createRange().replace([[r[0]]]) : t.createRange().replace([[n.BuiltIn.NA]]);
1683
1731
  }
1684
1732
  if (1 === a) {
1685
- const r = new RegExp(s.source, s.flags + "g"), a = [...e.matchAll(r)];
1733
+ const r = new RegExp(i.source, i.flags + "g"), a = [...e.matchAll(r)];
1686
1734
  if (0 === a.length) return t.createRange().replace([[n.BuiltIn.NA]]);
1687
1735
  const o = a.map((t) => t[0]);
1688
1736
  return t.createRange().replace([o]);
1689
1737
  }
1690
1738
  if (2 === a) {
1691
- const r = e.match(s);
1739
+ const r = e.match(i);
1692
1740
  if (!r) return t.createRange().replace([[n.BuiltIn.NA]]);
1693
1741
  if (1 === r.length) return n.BuiltIn.Value;
1694
1742
  const a = r.slice(1).map((t) => t ?? n.BuiltIn.NA);
@@ -1696,44 +1744,44 @@ function Hn(e, r, a = 0, o = !1) {
1696
1744
  }
1697
1745
  return n.BuiltIn.Value;
1698
1746
  }
1699
- function Kn(t, e, r = !1) {
1700
- const a = $n(e, r);
1747
+ function $n(t, e, r = !1) {
1748
+ const a = te(e, r);
1701
1749
  return n.isError(a) ? a : a.test(t);
1702
1750
  }
1703
- function Qn(t, e, r, a = 0, o = !1) {
1704
- const s = $n(e, o);
1705
- if (n.isError(s)) return s;
1751
+ function Zn(t, e, r, a = 0, o = !1) {
1752
+ const i = te(e, o);
1753
+ if (n.isError(i)) return i;
1706
1754
  if (0 === a) {
1707
- const n = new RegExp(s.source, s.flags + "g");
1755
+ const n = new RegExp(i.source, i.flags + "g");
1708
1756
  return t.replace(n, r);
1709
1757
  }
1710
- let i = 0, l = t;
1711
- const u = new RegExp(s.source, s.flags);
1758
+ let s = 0, u = t;
1759
+ const l = new RegExp(i.source, i.flags);
1712
1760
  let f = 0;
1713
- for (; f <= l.length;) {
1714
- const t = l.slice(f).match(u);
1761
+ for (; f <= u.length;) {
1762
+ const t = u.slice(f).match(l);
1715
1763
  if (!t || void 0 === t.index) break;
1716
- if (i++, i === a) {
1764
+ if (s++, s === a) {
1717
1765
  const n = f + t.index;
1718
- l = l.slice(0, n) + t[0].replace(u, r) + l.slice(n + t[0].length);
1766
+ u = u.slice(0, n) + t[0].replace(l, r) + u.slice(n + t[0].length);
1719
1767
  break;
1720
1768
  }
1721
1769
  f += t.index + Math.max(t[0].length, 1);
1722
1770
  }
1723
- return l;
1771
+ return u;
1724
1772
  }
1725
- function Wn(t, e, r = !1) {
1726
- const a = $n(e, r);
1773
+ function Jn(t, e, r = !1) {
1774
+ const a = te(e, r);
1727
1775
  return n.isError(a) ? a : a.test(t);
1728
1776
  }
1729
- function $n(t, e) {
1777
+ function te(t, e) {
1730
1778
  try {
1731
1779
  return new RegExp(t, e ? "i" : "");
1732
1780
  } catch {
1733
1781
  return n.BuiltIn.Value;
1734
1782
  }
1735
1783
  }
1736
- var Zn = {
1784
+ var ne = {
1737
1785
  CUBEKPIMEMBER: {
1738
1786
  p: [
1739
1787
  {
@@ -1850,7 +1898,7 @@ var Zn = {
1850
1898
  }],
1851
1899
  r: { s: "string" }
1852
1900
  }
1853
- }, Jn = { ACCRINT: {
1901
+ }, ee = { ACCRINT: {
1854
1902
  p: [
1855
1903
  { n: "issue" },
1856
1904
  { n: "firstInterest" },
@@ -1871,7 +1919,7 @@ var Zn = {
1871
1919
  }
1872
1920
  ],
1873
1921
  r: { s: "number" }
1874
- } }, te = { AMORDEGRC: {
1922
+ } }, re = { AMORDEGRC: {
1875
1923
  p: [
1876
1924
  { n: "cost" },
1877
1925
  { n: "datePurchased" },
@@ -1886,7 +1934,7 @@ var Zn = {
1886
1934
  }
1887
1935
  ],
1888
1936
  r: { s: "number" }
1889
- } }, ne = {
1937
+ } }, ae = {
1890
1938
  DATEDIF: {
1891
1939
  p: [
1892
1940
  { n: "startDate" },
@@ -1930,7 +1978,7 @@ var Zn = {
1930
1978
  ],
1931
1979
  r: { s: "number" }
1932
1980
  }
1933
- }, ee = {
1981
+ }, oe = {
1934
1982
  COUPDAYS: {
1935
1983
  p: [
1936
1984
  { n: "settlement" },
@@ -2121,7 +2169,11 @@ var Zn = {
2121
2169
  NPV: {
2122
2170
  p: [{ n: "rate" }, {
2123
2171
  n: "value",
2124
- g: [{ n: "value" }]
2172
+ g: [{
2173
+ n: "value",
2174
+ s: "number",
2175
+ r: "r"
2176
+ }]
2125
2177
  }],
2126
2178
  r: { s: "number" }
2127
2179
  },
@@ -2335,7 +2387,7 @@ var Zn = {
2335
2387
  ],
2336
2388
  r: { s: "*" }
2337
2389
  }
2338
- }, re = {
2390
+ }, ie = {
2339
2391
  ACCRINTM: {
2340
2392
  p: [
2341
2393
  { n: "issue" },
@@ -2438,7 +2490,7 @@ var Zn = {
2438
2490
  ],
2439
2491
  r: { s: "number" }
2440
2492
  }
2441
- }, ae = {
2493
+ }, se = {
2442
2494
  COUPDAYBS: {
2443
2495
  p: [
2444
2496
  { n: "settlement" },
@@ -2517,7 +2569,7 @@ var Zn = {
2517
2569
  ],
2518
2570
  r: { s: "number" }
2519
2571
  }
2520
- }, oe = {
2572
+ }, ue = {
2521
2573
  PRICE: {
2522
2574
  p: [
2523
2575
  { n: "settlement" },
@@ -2580,7 +2632,7 @@ var Zn = {
2580
2632
  ],
2581
2633
  r: { s: "number" }
2582
2634
  }
2583
- }, se = {
2635
+ }, le = {
2584
2636
  ODDFPRICE: {
2585
2637
  p: [
2586
2638
  { n: "settlement" },
@@ -2651,7 +2703,7 @@ var Zn = {
2651
2703
  ],
2652
2704
  r: { s: "number" }
2653
2705
  }
2654
- }, ie = { VDB: {
2706
+ }, fe = { VDB: {
2655
2707
  p: [
2656
2708
  { n: "cost" },
2657
2709
  { n: "salvage" },
@@ -2671,7 +2723,7 @@ var Zn = {
2671
2723
  }
2672
2724
  ],
2673
2725
  r: { s: "number" }
2674
- } }, le = {
2726
+ } }, ce = {
2675
2727
  "FORECAST.ETS": {
2676
2728
  fn: "FORECAST_ETS",
2677
2729
  p: [
@@ -2791,7 +2843,7 @@ var Zn = {
2791
2843
  ],
2792
2844
  r: { s: "*" }
2793
2845
  }
2794
- }, ue = {
2846
+ }, me = {
2795
2847
  LINEST: {
2796
2848
  p: [
2797
2849
  {
@@ -2916,7 +2968,7 @@ var Zn = {
2916
2968
  r: "m"
2917
2969
  }
2918
2970
  }
2919
- }, fe = {
2971
+ }, he = {
2920
2972
  TTEST: {
2921
2973
  p: [
2922
2974
  {
@@ -2952,7 +3004,7 @@ var Zn = {
2952
3004
  ],
2953
3005
  r: { s: "number" }
2954
3006
  }
2955
- }, ce = {
3007
+ }, Me = {
2956
3008
  REGEXEXTRACT: {
2957
3009
  p: [
2958
3010
  {
@@ -3043,5 +3095,5 @@ var Zn = {
3043
3095
  ],
3044
3096
  r: { s: "*" }
3045
3097
  }
3046
- }, me = () => import("./C8ez6oBw4sdDzSct.mjs"), he = () => import("./CLQ1_t-YsFFTRbw1.mjs"), Me = () => import("./v_larpTXJns5MbG8.mjs"), pe = () => import("./Cmx9jVLihcV7UU9j.mjs"), De = () => import("./CYm12WYrfdzPk8cm.mjs"), de = () => import("./BXjhl9UdRwdpTLAB.mjs"), ge = () => import("./CzzpVN7fGDVLTBAQ.mjs"), Ne = () => import("./C1Of99Li1xuXVvHC.mjs"), ye = () => import("./CVd2CtlxuMv1IuIq.mjs"), be = () => import("./DN1_rspUH-tOwmED.mjs"), Ee = () => import("./D-wUpQDKX_k0SiSj.mjs"), ve = () => import("./BfPVZqcuHtLRxqLI.mjs"), Re = () => import("./CVifmXw-tD8LimNW.mjs"), Ie = () => import("./DEQPjlaWWG7gXPtm.mjs"), Se = (t, n, e) => (e || (e = /* @__PURE__ */ new Map()), n(e, t, s, Zn, me, "Cube"), n(e, t, q, Jn, he, "Financial"), n(e, t, _, te, Me, "Financial"), n(e, t, H, ne, pe, "Financial"), n(e, t, Z, ee, De, "Financial"), n(e, t, Bt, re, de, "Financial"), n(e, t, Xt, ae, ge, "Financial"), n(e, t, $t, oe, Ne, "Financial"), n(e, t, en, se, ye, "Financial"), n(e, t, mn, ie, be, "Financial"), n(e, t, Dn, le, Ee, "Statistical"), n(e, t, Fn, ue, ve, "Statistical"), n(e, t, qn, fe, Re, "Statistical"), n(e, t, zn, ce, Ie, "Text"), e);
3047
- export { Se as default };
3098
+ }, pe = () => import("./BKnXVC21NesUzU9t.mjs"), Ne = () => import("./CShl-IMQIPnBMVpb.mjs"), De = () => import("./y9VKeU12ARR9HmtI.mjs"), de = () => import("./CN-pAKHIFQkkdFFB.mjs"), ge = () => import("./C2TyRseZg5dWtMq1.mjs"), ye = () => import("./fhXUc-E6MSehd9Ep.mjs"), be = () => import("./XATNfSb9mKkYP5Fr.mjs"), Ee = () => import("./CsrMSYiKGo3-I_Qk.mjs"), ve = () => import("./DsJzZKURvUm7apNu.mjs"), Re = () => import("./ffkoQUSdLhFyILRL.mjs"), Ie = () => import("./DxiRpwBhgWoK5Erd.mjs"), Se = () => import("./v9tvQuvQYcFQ0zOs.mjs"), Ce = () => import("./C21UeAwlG4Qkfu1Z.mjs"), Te = () => import("./DoS1jziW_TXjkH37.mjs"), xe = (t, n, e) => (e || (e = /* @__PURE__ */ new Map()), n(e, t, i, ne, pe, "Cube"), n(e, t, q, ee, Ne, "Financial"), n(e, t, _, re, De, "Financial"), n(e, t, H, ae, de, "Financial"), n(e, t, J, oe, ge, "Financial"), n(e, t, Ft, ie, ye, "Financial"), n(e, t, Gt, se, be, "Financial"), n(e, t, tn, ue, Ee, "Financial"), n(e, t, on, le, ve, "Financial"), n(e, t, pn, fe, Re, "Financial"), n(e, t, gn, ce, Ie, "Statistical"), n(e, t, Un, me, Se, "Statistical"), n(e, t, _n, he, Ce, "Statistical"), n(e, t, Qn, Me, Te, "Text"), e);
3099
+ export { xe as default };