@sheetxl/formulas-extended 0.8.0-beta.15 → 0.8.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +8 -7
- package/browser/esm/{CHCYcEKjePbdBT6S.mjs → 0T4CVS-eRgxCYtfc.mjs} +2 -2
- package/browser/esm/{Cg8sxKWlH9hl9cmJ.mjs → B6SWueGjJbR9GvFt.mjs} +2 -2
- package/browser/esm/{DzHBzc5ygBHUJz7Z.mjs → BCYJKZ1F4xTomy55.mjs} +2 -2
- package/{node/esm/D4qsZVifvY4HXGV4.mjs → browser/esm/Bl_XKy6jAuDPfR9q.mjs} +2 -2
- package/{node/esm/B81c3QWvxdHun2T7.mjs → browser/esm/C4RRHqox3t77s061.mjs} +2 -2
- package/browser/esm/{C1A2QXvN2v2G6tUy.mjs → CBuhj3PrSGO4BQTA.mjs} +2 -2
- package/browser/esm/{WnWno64b5Kwzt5bq.mjs → COe-XUcPznzLainQ.mjs} +2 -2
- package/{node/esm/DIJcwREawbt_MeZK.mjs → browser/esm/CeirmCdzQsLSw3D7.mjs} +2 -2
- package/browser/esm/{Bj-GG15t0G1x9-FU.mjs → Cvnn-NZsNEe7z_gs.mjs} +2 -2
- package/{node/esm/BPITz297xS7JQJip.mjs → browser/esm/D-0RdQDA-k9FyfJp.mjs} +2 -2
- package/{node/esm/BAOKFei-3NUnKf2b.mjs → browser/esm/DIHbCSX3oHxaFWRN.mjs} +2 -2
- package/{node/esm/DWsUELCL7M8CJRse.mjs → browser/esm/DKZop8VVKKOl-zxC.mjs} +2 -2
- package/browser/esm/{DQUpOqHLBRcR3jRL.mjs → DXL2nRPu379ZLJW4.mjs} +2 -2
- package/{node/esm/Dq5qeAevZvlIBl1n.mjs → browser/esm/DYh11b5QiPmrgbxg.mjs} +2 -2
- package/{node/esm/DcxpVQJ0VRPd3zNH.mjs → browser/esm/Dlcgl-1wfKMGrJTS.mjs} +2 -2
- package/browser/esm/{5e6JdlNsgYe10haf.mjs → DoI7-GUWqVDLmhja.mjs} +2 -2
- package/browser/esm/{vioImwvyYDFqRDUi.mjs → Dzjc2PG0ZpDM5JTu.mjs} +2 -2
- package/browser/esm/{DTTckRRsdT5hn6tw.mjs → EWxMSgdCKFRMCIGV.mjs} +2 -2
- package/browser/esm/{va7h1_p7n3e5jFud.mjs → WqqCRFF2pHDYrHIR.mjs} +2 -2
- package/{node/esm/Bxs5g9POZ28N8txg.mjs → browser/esm/XKjpEaAe7snu5CA2.mjs} +2 -2
- package/{node/esm/Cz08Pg4FLQyPOKHH.mjs → browser/esm/b-DmHhG0rwDpMJ6g.mjs} +2 -2
- package/browser/esm/declarations.mjs +3 -3
- package/browser/esm/index.mjs +290 -329
- package/{node/esm/fuSCbGKaf-8luGWM.mjs → browser/esm/wDK0UoVDut_yHFnN.mjs} +2 -2
- package/node/esm/{CHCYcEKjePbdBT6S.mjs → 0T4CVS-eRgxCYtfc.mjs} +2 -2
- package/node/esm/{Cg8sxKWlH9hl9cmJ.mjs → B6SWueGjJbR9GvFt.mjs} +2 -2
- package/node/esm/{DzHBzc5ygBHUJz7Z.mjs → BCYJKZ1F4xTomy55.mjs} +2 -2
- package/{browser/esm/D4qsZVifvY4HXGV4.mjs → node/esm/Bl_XKy6jAuDPfR9q.mjs} +2 -2
- package/{browser/esm/B81c3QWvxdHun2T7.mjs → node/esm/C4RRHqox3t77s061.mjs} +2 -2
- package/node/esm/{Dz8qQyUhCxQuVw4P.mjs → CDTu8Mmk15EYCQGg.mjs} +2 -2
- package/node/esm/{WnWno64b5Kwzt5bq.mjs → COe-XUcPznzLainQ.mjs} +2 -2
- package/{browser/esm/DIJcwREawbt_MeZK.mjs → node/esm/CeirmCdzQsLSw3D7.mjs} +2 -2
- package/node/esm/{C4MIOejuBpyFfiBE.mjs → CqHFkqrXgFacCByh.mjs} +2 -2
- package/node/esm/{Bj-GG15t0G1x9-FU.mjs → Cvnn-NZsNEe7z_gs.mjs} +2 -2
- package/node/esm/{BOyLreRKoE7rK6-B.mjs → CyCBF7V0ic-i24qF.mjs} +2 -2
- package/{browser/esm/BPITz297xS7JQJip.mjs → node/esm/D-0RdQDA-k9FyfJp.mjs} +2 -2
- package/{browser/esm/BAOKFei-3NUnKf2b.mjs → node/esm/DIHbCSX3oHxaFWRN.mjs} +2 -2
- package/{browser/esm/DWsUELCL7M8CJRse.mjs → node/esm/DKZop8VVKKOl-zxC.mjs} +2 -2
- package/node/esm/{DQUpOqHLBRcR3jRL.mjs → DXL2nRPu379ZLJW4.mjs} +2 -2
- package/{browser/esm/Dq5qeAevZvlIBl1n.mjs → node/esm/DYh11b5QiPmrgbxg.mjs} +2 -2
- package/{browser/esm/DcxpVQJ0VRPd3zNH.mjs → node/esm/Dlcgl-1wfKMGrJTS.mjs} +2 -2
- package/node/esm/{5e6JdlNsgYe10haf.mjs → DoI7-GUWqVDLmhja.mjs} +2 -2
- package/node/esm/{va7h1_p7n3e5jFud.mjs → WqqCRFF2pHDYrHIR.mjs} +2 -2
- package/{browser/esm/Bxs5g9POZ28N8txg.mjs → node/esm/XKjpEaAe7snu5CA2.mjs} +2 -2
- package/{browser/esm/Cz08Pg4FLQyPOKHH.mjs → node/esm/b-DmHhG0rwDpMJ6g.mjs} +2 -2
- package/node/esm/declarations.mjs +3 -3
- package/node/esm/index.mjs +594 -635
- package/{browser/esm/fuSCbGKaf-8luGWM.mjs → node/esm/wDK0UoVDut_yHFnN.mjs} +2 -2
- package/package.json +4 -4
- package/types/src/_utils/Pivot.d.ts +35 -37
package/node/esm/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/formulas-extended - Formulas Enterprise - TypeScript formulas compatible with Excel built-ins. - v0.8.0-beta.
|
|
2
|
+
* @license @sheetxl/formulas-extended - Formulas Enterprise - TypeScript formulas compatible with Excel built-ins. - v0.8.0-beta.17
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
-
* License:
|
|
5
|
+
* License: SheetXL EULA — https://www.sheetxl.com/eula
|
|
6
6
|
*/
|
|
7
|
-
import { S as t, _ as n, a as e, b as r, c as o, d as i, f as u, g as s, h as a, i as l, l as f, m as c, n as h, o as m, p as N, r as g, s as
|
|
8
|
-
import { FormulaContext as b, FormulaError as B, IRange as x, ScalarType as
|
|
9
|
-
var E = Object.defineProperty,
|
|
7
|
+
import { S as t, _ as n, a as e, b as r, c as o, d as i, f as u, g as s, h as a, i as l, l as f, m as c, n as h, o as m, p as N, r as g, s as d, t as y, u as M, v as p, x as I, y as w } from "./CyCBF7V0ic-i24qF.mjs";
|
|
8
|
+
import { FormulaContext as b, FormulaError as B, IRange as x, ScalarType as R, ValueKind as C } from "@sheetxl/primitives";
|
|
9
|
+
var E = Object.defineProperty, v = (t, n) => {
|
|
10
10
|
let e = {};
|
|
11
11
|
for (var r in t) E(e, r, {
|
|
12
12
|
get: t[r],
|
|
13
13
|
enumerable: !0
|
|
14
14
|
});
|
|
15
15
|
return n || E(e, Symbol.toStringTag, { value: "Module" }), e;
|
|
16
|
-
},
|
|
16
|
+
}, A = v({
|
|
17
17
|
CUBEKPIMEMBER: () => D,
|
|
18
18
|
CUBEMEMBER: () => F,
|
|
19
19
|
CUBEMEMBERPROPERTY: () => S,
|
|
@@ -43,7 +43,7 @@ function P(t) {
|
|
|
43
43
|
function O(t, ...n) {
|
|
44
44
|
throw B.BuiltIn.NA;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function L(t) {
|
|
47
47
|
if (null === t) return 0;
|
|
48
48
|
if ("string" == typeof t) try {
|
|
49
49
|
return b.parseAsNumber(t);
|
|
@@ -52,18 +52,18 @@ function $(t) {
|
|
|
52
52
|
}
|
|
53
53
|
return b.parseAsSerialDate(t);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function $(t) {
|
|
56
56
|
if (void 0 === t) throw B.BuiltIn.NA;
|
|
57
|
-
return
|
|
57
|
+
return L(t);
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function k(t) {
|
|
60
60
|
return null === t ? 0 : b.parseAsNumber(t);
|
|
61
61
|
}
|
|
62
62
|
function q(t) {
|
|
63
63
|
if (void 0 === t) throw B.BuiltIn.NA;
|
|
64
|
-
return
|
|
64
|
+
return k(t);
|
|
65
65
|
}
|
|
66
|
-
var
|
|
66
|
+
var j = [
|
|
67
67
|
31,
|
|
68
68
|
29,
|
|
69
69
|
31,
|
|
@@ -76,7 +76,7 @@ var _ = [
|
|
|
76
76
|
31,
|
|
77
77
|
30,
|
|
78
78
|
31
|
|
79
|
-
],
|
|
79
|
+
], U = [
|
|
80
80
|
31,
|
|
81
81
|
28,
|
|
82
82
|
31,
|
|
@@ -90,14 +90,14 @@ var _ = [
|
|
|
90
90
|
30,
|
|
91
91
|
31
|
|
92
92
|
];
|
|
93
|
-
function
|
|
93
|
+
function Y(t) {
|
|
94
94
|
return t % 4 == 0 && t % 100 != 0 || t % 400 == 0;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
return
|
|
96
|
+
function z(t, n) {
|
|
97
|
+
return Y(t) ? j[n] : U[n];
|
|
98
98
|
}
|
|
99
|
-
var
|
|
100
|
-
function
|
|
99
|
+
var _ = (t, n) => z(t, n - 1), G = (t) => t.d === _(t.y, t.m);
|
|
100
|
+
function K(t) {
|
|
101
101
|
const n = b.getDateParts(t);
|
|
102
102
|
return {
|
|
103
103
|
y: n.year,
|
|
@@ -105,20 +105,20 @@ function X(t) {
|
|
|
105
105
|
d: n.day
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function X(t, n, e) {
|
|
109
109
|
const r = n <= 2 ? t - 1 : t, o = Math.floor(r / 400), i = r - 400 * o, u = Math.floor((153 * (n + (n > 2 ? -3 : 9)) + 2) / 5) + e - 1, s = 146097 * o + (365 * i + Math.floor(i / 4) - Math.floor(i / 100) + u) - 693900;
|
|
110
110
|
return s >= 60 ? s + 1 : s;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function H(t, n) {
|
|
113
113
|
let e = t.m - 1 + n;
|
|
114
114
|
const r = t.y + Math.floor(e / 12);
|
|
115
115
|
return e = (e % 12 + 12) % 12 + 1, {
|
|
116
116
|
y: r,
|
|
117
117
|
m: e,
|
|
118
|
-
d: Math.min(t.d,
|
|
118
|
+
d: Math.min(t.d, _(r, e))
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function W(t) {
|
|
122
122
|
return b.getDateParts(Math.max(0, Math.floor(t)));
|
|
123
123
|
}
|
|
124
124
|
function Z(t, n, e, r, o, i) {
|
|
@@ -137,16 +137,16 @@ function Q(t, n, e) {
|
|
|
137
137
|
days: 0,
|
|
138
138
|
yearDays: 365
|
|
139
139
|
};
|
|
140
|
-
const e =
|
|
140
|
+
const e = W(t), r = W(n), o = e.year, i = r.year, u = Math.abs(n - t), s = Math.abs(i - o), a = s + 1, l = i < o ? i : o, f = i < o ? o : i;
|
|
141
141
|
let c, h = b.getSerialDate(l, 1, 1);
|
|
142
142
|
1900 === l && (h += 1);
|
|
143
143
|
if (0 === s) c = b.getSerialDate(l, 12, 31) - h + 1;
|
|
144
144
|
else if (1 === s) {
|
|
145
|
-
const e = Math.min(t, n), r = Math.max(t, n), o =
|
|
145
|
+
const e = Math.min(t, n), r = Math.max(t, n), o = W(e), i = W(r), u = i.month - o.month;
|
|
146
146
|
if (u > 0 || 0 === u && i.day > o.day) c = (b.getSerialDate(f + 1, 1, 1) - h) / a;
|
|
147
147
|
else {
|
|
148
148
|
c = 365;
|
|
149
|
-
for (const t of [l, f]) if (
|
|
149
|
+
for (const t of [l, f]) if (Y(t)) {
|
|
150
150
|
const n = b.getSerialDate(t, 2, 29);
|
|
151
151
|
if (n >= e && n <= r) {
|
|
152
152
|
c = 366;
|
|
@@ -170,7 +170,7 @@ function Q(t, n, e) {
|
|
|
170
170
|
yearDays: 365
|
|
171
171
|
};
|
|
172
172
|
case 4: return function(t, n) {
|
|
173
|
-
const e =
|
|
173
|
+
const e = W(t), r = W(n);
|
|
174
174
|
let o = e.day, i = r.day;
|
|
175
175
|
31 === o && (o = 30);
|
|
176
176
|
31 === i && (i = 30);
|
|
@@ -195,41 +195,41 @@ function tt(t, n, e) {
|
|
|
195
195
|
return i / u;
|
|
196
196
|
}
|
|
197
197
|
function nt(t, n, e) {
|
|
198
|
-
const r =
|
|
199
|
-
let o =
|
|
198
|
+
const r = K(t);
|
|
199
|
+
let o = K(n).y - r.y, i = t;
|
|
200
200
|
for (; o > 0; o -= 1) {
|
|
201
|
-
const t =
|
|
202
|
-
if (i =
|
|
201
|
+
const t = H(r, 12 * o);
|
|
202
|
+
if (i = X(t.y, t.m, t.d), i <= n) break;
|
|
203
203
|
}
|
|
204
204
|
if (o <= 0 && (o = 0, i = t), 0 === e || 4 === e) return o + function(t, n, e) {
|
|
205
|
-
const r =
|
|
205
|
+
const r = W(t), o = W(n);
|
|
206
206
|
let i = r.day, u = o.day;
|
|
207
207
|
(2 === r.month && 29 === i || 31 === i) && (i = 30);
|
|
208
208
|
31 === u && (e || i >= 30) && (u = 30);
|
|
209
209
|
return Z(r.year, r.month, i, o.year, o.month, u);
|
|
210
210
|
}(i, n, 4 === e) / 360;
|
|
211
211
|
const u = n - i;
|
|
212
|
-
return 2 === e ? o + u / 360 : 3 === e ? o + u / 365 : o + u / (
|
|
212
|
+
return 2 === e ? o + u / 360 : 3 === e ? o + u / 365 : o + u / (Y(K(n).y) ? 366 : 365);
|
|
213
213
|
}
|
|
214
214
|
function et(t, n) {
|
|
215
|
-
const e =
|
|
215
|
+
const e = W(t), r = W(n), o = e.year, i = e.month;
|
|
216
216
|
let u = e.day, s = r.year, a = r.month, l = r.day, f = !1;
|
|
217
|
-
return 2 === i ? u === (
|
|
217
|
+
return 2 === i ? u === (Y(o) ? 29 : 28) && (u = 30, f = !0) : 31 === u && (u = 30), f && 2 === a && l === (Y(s) ? 29 : 28) && (l = 30), 31 !== l || f || (u < 30 ? (12 === a ? (s += 1, a = 1) : a += 1, l = 1) : l = 30), Z(o, i, u, s, a, l);
|
|
218
218
|
}
|
|
219
219
|
function rt(t, n, e) {
|
|
220
220
|
const r = Math.floor(t), o = Math.floor(n);
|
|
221
221
|
let i, u;
|
|
222
|
-
return 0 === e || 4 === e ? (i = Q(r, o, e).days, u = 360) : (i = ot(o) - ot(r), u = 3 !== e &&
|
|
222
|
+
return 0 === e || 4 === e ? (i = Q(r, o, e).days, u = 360) : (i = ot(o) - ot(r), u = 3 !== e && Y(W(r).year) ? 366 : 365), {
|
|
223
223
|
days: 0 === i ? u : i,
|
|
224
224
|
yearDays: u
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
227
|
function ot(t) {
|
|
228
|
-
const n =
|
|
229
|
-
return 2 === n.month && 29 === n.day &&
|
|
228
|
+
const n = W(t);
|
|
229
|
+
return 2 === n.month && 29 === n.day && Y(n.year) ? t - 1 : t;
|
|
230
230
|
}
|
|
231
231
|
function it(t) {
|
|
232
|
-
const n = void 0 === t ? 0 :
|
|
232
|
+
const n = void 0 === t ? 0 : k(t), e = Math.trunc(n);
|
|
233
233
|
if (n < 0 || e > 4) throw B.BuiltIn.Num;
|
|
234
234
|
return e;
|
|
235
235
|
}
|
|
@@ -242,7 +242,7 @@ function ut(t, n) {
|
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
244
|
function st(t, n, e, r, o) {
|
|
245
|
-
const i = it(o), u =
|
|
245
|
+
const i = it(o), u = $(t), s = $(n), a = q(e), l = q(r), f = ut(u, s);
|
|
246
246
|
if (a <= 0 || l <= 0) throw B.BuiltIn.Num;
|
|
247
247
|
return {
|
|
248
248
|
...f,
|
|
@@ -252,12 +252,12 @@ function st(t, n, e, r, o) {
|
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
254
|
function at(t, n, e) {
|
|
255
|
-
const r =
|
|
255
|
+
const r = $(t), o = $(n), i = q(e), u = ut(r, o);
|
|
256
256
|
if (u.maturity > function(t) {
|
|
257
257
|
const n = b.getDateParts(t);
|
|
258
258
|
if (n.year >= 9999) throw B.BuiltIn.Num;
|
|
259
259
|
if (0 === n.day) return b.getSerialDate(n.year + 1, n.month, 1) - 1;
|
|
260
|
-
const e =
|
|
260
|
+
const e = z(n.year + 1, n.month - 1);
|
|
261
261
|
return n.day > e ? b.getSerialDate(n.year + 1, n.month + 1, 1) : b.getSerialDate(n.year + 1, n.month, n.day);
|
|
262
262
|
}(u.settlement) || i <= 0) throw B.BuiltIn.Num;
|
|
263
263
|
return {
|
|
@@ -267,25 +267,25 @@ function at(t, n, e) {
|
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
269
|
function lt(t, n, e, r, o, i) {
|
|
270
|
-
const u = it(i), s =
|
|
270
|
+
const u = it(i), s = $(t), a = $(n), l = $(e), f = q(r), c = q(o);
|
|
271
271
|
if (!J(s) || !J(a) || !J(l)) throw B.BuiltIn.Num;
|
|
272
272
|
const h = Math.floor(s), m = Math.floor(a), N = Math.floor(l);
|
|
273
273
|
if (!(N < h && h < m)) throw B.BuiltIn.Num;
|
|
274
|
-
const { days: g, yearDays:
|
|
274
|
+
const { days: g, yearDays: d } = Q(N, h, u), y = Q(N, m, u).days;
|
|
275
275
|
return {
|
|
276
276
|
rate: f,
|
|
277
277
|
x: c,
|
|
278
|
-
DIM:
|
|
279
|
-
DSM:
|
|
278
|
+
DIM: y,
|
|
279
|
+
DSM: y - g,
|
|
280
280
|
A: g,
|
|
281
|
-
B:
|
|
281
|
+
B: d
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
function ft(t, n, e, r, o, i = !1) {
|
|
285
285
|
let u = i ? 0 : it(o);
|
|
286
|
-
const s =
|
|
286
|
+
const s = $(t);
|
|
287
287
|
if (!J(s)) throw B.BuiltIn.Num;
|
|
288
|
-
const a =
|
|
288
|
+
const a = $(n);
|
|
289
289
|
if (!J(a)) throw B.BuiltIn.Num;
|
|
290
290
|
const l = e.map(q), f = Math.trunc(q(r));
|
|
291
291
|
if (1 !== f && 2 !== f && 4 !== f) throw B.BuiltIn.Num;
|
|
@@ -296,7 +296,7 @@ function ft(t, n, e, r, o, i = !1) {
|
|
|
296
296
|
basis: u
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
|
-
var ct = (t) => Number.isFinite(t) ? t : 0, ht =
|
|
299
|
+
var ct = (t) => Number.isFinite(t) ? t : 0, ht = v({
|
|
300
300
|
ACCRINT: () => mt,
|
|
301
301
|
ACCRINTM: () => Nt
|
|
302
302
|
});
|
|
@@ -308,63 +308,63 @@ function mt(t, n, e, r, o, i, u = 0, s = !0) {
|
|
|
308
308
|
if ("number" == typeof t) return 0 !== t;
|
|
309
309
|
if (B.isError(t)) throw t;
|
|
310
310
|
throw B.BuiltIn.Value;
|
|
311
|
-
}(s), l =
|
|
311
|
+
}(s), l = $(t);
|
|
312
312
|
if (!J(l)) throw B.BuiltIn.Num;
|
|
313
|
-
const f =
|
|
313
|
+
const f = $(n);
|
|
314
314
|
if (!J(f)) throw B.BuiltIn.Num;
|
|
315
|
-
const c =
|
|
315
|
+
const c = $(e);
|
|
316
316
|
if (!J(c)) throw B.BuiltIn.Num;
|
|
317
|
-
const h = q(r), m = void 0 === o ? 1e3 :
|
|
317
|
+
const h = q(r), m = void 0 === o ? 1e3 : k(o), N = Math.trunc(q(i));
|
|
318
318
|
if (1 !== N && 2 !== N && 4 !== N) throw B.BuiltIn.Num;
|
|
319
|
-
const g = it(u),
|
|
320
|
-
if (
|
|
321
|
-
const
|
|
322
|
-
const u = 12 / r, s = G(
|
|
319
|
+
const g = it(u), d = Math.floor(l), y = Math.floor(c);
|
|
320
|
+
if (d >= y || h <= 0 || m <= 0) throw B.BuiltIn.Num;
|
|
321
|
+
const M = function(t, n, e, r, o, i) {
|
|
322
|
+
const u = 12 / r, s = G(K(n));
|
|
323
323
|
let a;
|
|
324
324
|
if (e > n && i) {
|
|
325
325
|
a = n;
|
|
326
326
|
for (let t = n; t < e;) a = t, t = wt(t, u, s);
|
|
327
327
|
} else a = wt(n, -u, s);
|
|
328
328
|
const l = 3 === o ? 365 / r : 1 === o ? n - wt(n, -u, s) : 360 / r;
|
|
329
|
-
let f =
|
|
329
|
+
let f = pt(Math.max(t, a), e, o) / l;
|
|
330
330
|
for (let n = a; n > t;) {
|
|
331
331
|
const e = wt(n, -u, s);
|
|
332
|
-
t <= e ? i && (f += 1) : f +=
|
|
332
|
+
t <= e ? i && (f += 1) : f += pt(t, n, o) / It(e, n, r, o), n = e;
|
|
333
333
|
}
|
|
334
334
|
return f;
|
|
335
|
-
}(
|
|
336
|
-
return ct(m * (h / N) *
|
|
335
|
+
}(d, Math.floor(f), y, N, g, a);
|
|
336
|
+
return ct(m * (h / N) * M);
|
|
337
337
|
}
|
|
338
338
|
function Nt(t, n, e, r, o = 0) {
|
|
339
|
-
const i =
|
|
339
|
+
const i = $(t);
|
|
340
340
|
if (!J(i)) throw B.BuiltIn.Num;
|
|
341
|
-
const u =
|
|
341
|
+
const u = $(n);
|
|
342
342
|
if (!J(u)) throw B.BuiltIn.Num;
|
|
343
|
-
const s = q(e), a = void 0 === r ? 1e3 :
|
|
343
|
+
const s = q(e), a = void 0 === r ? 1e3 : k(r), l = it(o);
|
|
344
344
|
if (Math.floor(i) > Math.floor(u) || s <= 0 || a <= 0) throw B.BuiltIn.Num;
|
|
345
345
|
const f = a * s * tt(i, u, l);
|
|
346
346
|
return Number.isFinite(f) ? f : 0;
|
|
347
347
|
}
|
|
348
|
-
var gt = (t, n) => 360 * (n.y - t.y) + 30 * (n.m - t.m) + (n.d - t.d),
|
|
349
|
-
function
|
|
350
|
-
const r =
|
|
351
|
-
return
|
|
348
|
+
var gt = (t, n) => 360 * (n.y - t.y) + 30 * (n.m - t.m) + (n.d - t.d), dt = (t) => 2 === t.m && t.d === _(t.y, 2);
|
|
349
|
+
function yt(t, n, e) {
|
|
350
|
+
const r = K(t), o = K(n);
|
|
351
|
+
return dt(o) && (e || dt(r)) && (o.d = 30), 31 === o.d && (e || r.d >= 30) && (o.d = 30), (31 === r.d || dt(r)) && (r.d = 30), gt(r, o);
|
|
352
352
|
}
|
|
353
|
-
function
|
|
354
|
-
const e =
|
|
353
|
+
function Mt(t, n) {
|
|
354
|
+
const e = K(t), r = K(n);
|
|
355
355
|
return 31 === e.d && (e.d = 30), 31 === r.d && (r.d = 30), gt(e, r);
|
|
356
356
|
}
|
|
357
|
-
var
|
|
357
|
+
var pt = (t, n, e) => 0 === e ? yt(t, n, !1) : 4 === e ? Mt(t, n) : n - t, It = (t, n, e, r) => 1 === r ? n - t : 3 === r ? 365 / e : 4 === r ? Mt(t, n) : yt(t, n, !0);
|
|
358
358
|
function wt(t, n, e) {
|
|
359
359
|
if (t < 1) throw B.BuiltIn.Num;
|
|
360
|
-
const r =
|
|
360
|
+
const r = H(K(t), n), o = X(r.y, r.m, e ? _(r.y, r.m) : r.d);
|
|
361
361
|
if (o < 1 || o > 2958465) throw B.BuiltIn.Num;
|
|
362
362
|
return o;
|
|
363
363
|
}
|
|
364
364
|
function bt(t, n, e, r, o, i, u) {
|
|
365
365
|
const s = q(t), a = Math.floor(q(n)), l = Math.floor(q(e)), f = q(r), c = q(o), h = q(i);
|
|
366
366
|
if (s <= 0 || f < 0 || f > s || c < 0 || h <= 0 || !b.isValidDate(a) || !b.isValidDate(l) || a > l) return null;
|
|
367
|
-
const m = Math.floor(
|
|
367
|
+
const m = Math.floor(k(u ?? 0));
|
|
368
368
|
return m < 0 || 2 === m || m > 4 ? null : {
|
|
369
369
|
cost: s,
|
|
370
370
|
salvage: f,
|
|
@@ -391,51 +391,51 @@ var Bt = (t) => {
|
|
|
391
391
|
let e = Math.abs(n), r = 1, o = t;
|
|
392
392
|
for (; e > 0;) e % 2 == 1 && (r *= o), o *= o, e = Math.floor(e / 2);
|
|
393
393
|
return n < 0 ? 1 / r : r;
|
|
394
|
-
},
|
|
394
|
+
}, Rt = (t) => t >= 2147483648 || t <= -2147483649 || Number.isNaN(t) ? -2147483648 : Math.trunc(t), Ct = (t, n = 0) => {
|
|
395
395
|
const e = 10 ** n, r = Number(Math.abs(t).toPrecision(15));
|
|
396
396
|
return Math.sign(t) * Math.round(r * e) / e;
|
|
397
|
-
}, Et =
|
|
398
|
-
function
|
|
397
|
+
}, Et = v({ AMORDEGRC: () => At }), vt = 1e6;
|
|
398
|
+
function At(t, n, e, r, o, i, u = 0) {
|
|
399
399
|
const s = bt(t, n, e, r, o, i, u);
|
|
400
400
|
if (!s) return NaN;
|
|
401
401
|
const { cost: a, salvage: l, periodIndex: f, rate: c, days: h, yearDays: m } = s, N = h / m, g = 1 / c;
|
|
402
402
|
if (g <= 2) return NaN;
|
|
403
|
-
const
|
|
403
|
+
const d = c * (g <= 4 ? 1.5 : g <= 6 ? 2 : 2.5), y = Math.ceil(g);
|
|
404
404
|
if (a - l === 0) return 0;
|
|
405
|
-
const
|
|
406
|
-
if (0 === f) return
|
|
407
|
-
let
|
|
408
|
-
const I = Math.min(f,
|
|
405
|
+
const M = Ct(Math.min(a * d * N, a - l));
|
|
406
|
+
if (0 === f) return M;
|
|
407
|
+
let p = a - M;
|
|
408
|
+
const I = Math.min(f, y - 3);
|
|
409
409
|
let w = 1;
|
|
410
410
|
if (I >= 1) {
|
|
411
|
-
if (I - 1 <=
|
|
412
|
-
if (
|
|
413
|
-
|
|
411
|
+
if (I - 1 <= vt) for (; w < I; w++) {
|
|
412
|
+
if (p < l) return 0;
|
|
413
|
+
p -= p * d;
|
|
414
414
|
}
|
|
415
|
-
else
|
|
416
|
-
if (
|
|
417
|
-
if (f === I) return
|
|
418
|
-
|
|
415
|
+
else p *= xt(1 - d, I - 1), w = I;
|
|
416
|
+
if (p < l) return 0;
|
|
417
|
+
if (f === I) return Ct(p * d);
|
|
418
|
+
p -= p * d, w++;
|
|
419
419
|
}
|
|
420
420
|
for (; w <= f; w++) {
|
|
421
|
-
if (
|
|
422
|
-
const t =
|
|
421
|
+
if (p < l) return 0;
|
|
422
|
+
const t = y - w;
|
|
423
423
|
if (t < 1) return 0;
|
|
424
|
-
const n = t <= 2 ?
|
|
425
|
-
if (w === f) return
|
|
426
|
-
|
|
424
|
+
const n = t <= 2 ? p / t : p * d;
|
|
425
|
+
if (w === f) return Ct(n);
|
|
426
|
+
p -= n;
|
|
427
427
|
}
|
|
428
428
|
return 0;
|
|
429
429
|
}
|
|
430
|
-
var Dt =
|
|
431
|
-
CUMIPMT: () =>
|
|
432
|
-
CUMPRINC: () =>
|
|
430
|
+
var Dt = v({
|
|
431
|
+
CUMIPMT: () => $t,
|
|
432
|
+
CUMPRINC: () => kt,
|
|
433
433
|
FV: () => Ft,
|
|
434
434
|
IPMT: () => Ot,
|
|
435
435
|
ISPMT: () => qt,
|
|
436
436
|
NPER: () => Tt,
|
|
437
437
|
PMT: () => Vt,
|
|
438
|
-
PPMT: () =>
|
|
438
|
+
PPMT: () => Lt,
|
|
439
439
|
PV: () => St,
|
|
440
440
|
RATE: () => Pt
|
|
441
441
|
});
|
|
@@ -493,7 +493,7 @@ function Ot(t, n, e, r, o = 0, i = 0) {
|
|
|
493
493
|
const u = Math.log1p(t), s = n - 1, a = -t * (r * -Math.expm1((s - e) * u) - o * (s * u < 700 ? Math.exp(-e * u) * Math.expm1(s * u) : Math.exp((s - e) * u) - Math.exp(-e * u))) / -Math.expm1(-e * u);
|
|
494
494
|
return i ? a / (1 + t) : a;
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function Lt(t, n, e, r, o = 0, i = 0) {
|
|
497
497
|
if (b.formatResults(Bt(b.getRuntime())), n < 1 || n - 1 >= e) return NaN;
|
|
498
498
|
if (0 === t) return -(r + o) / e;
|
|
499
499
|
if (t <= -1) return NaN;
|
|
@@ -502,14 +502,14 @@ function $t(t, n, e, r, o = 0, i = 0) {
|
|
|
502
502
|
const a = i ? n - 2 : n - 1;
|
|
503
503
|
return -(r + o) * (t * Math.exp((a - e) * u)) / s;
|
|
504
504
|
}
|
|
505
|
-
function
|
|
506
|
-
const u =
|
|
505
|
+
function $t(t, n, e, r, o, i) {
|
|
506
|
+
const u = Ut(...jt(t, n, e, r, o, i));
|
|
507
507
|
if (!u) return NaN;
|
|
508
508
|
const s = u.count * u.payment - u.principal;
|
|
509
509
|
return Number.isFinite(s) ? s : NaN;
|
|
510
510
|
}
|
|
511
|
-
function
|
|
512
|
-
const u =
|
|
511
|
+
function kt(t, n, e, r, o, i) {
|
|
512
|
+
const u = Ut(...jt(t, n, e, r, o, i));
|
|
513
513
|
return u ? u.principal : NaN;
|
|
514
514
|
}
|
|
515
515
|
function qt(t, n, e, r) {
|
|
@@ -517,14 +517,14 @@ function qt(t, n, e, r) {
|
|
|
517
517
|
const o = r * (n - e) * t / e;
|
|
518
518
|
return Number.isFinite(o) ? o : NaN;
|
|
519
519
|
}
|
|
520
|
-
var
|
|
520
|
+
var jt = (t, n, e, r, o, i) => [
|
|
521
521
|
q(t),
|
|
522
522
|
q(n),
|
|
523
523
|
q(e),
|
|
524
524
|
q(r),
|
|
525
525
|
q(o),
|
|
526
526
|
q(i)
|
|
527
|
-
],
|
|
527
|
+
], Ut = (t, n, e, r, o, i) => {
|
|
528
528
|
if (t <= 0 || n <= 0 || e <= 0 || r < 1 || r > o || o > n || 0 !== i && 1 !== i) return null;
|
|
529
529
|
const u = Vt(t, n, e, 0, i);
|
|
530
530
|
if (!Number.isFinite(u)) return null;
|
|
@@ -550,20 +550,20 @@ var _t = (t, n, e, r, o, i) => [
|
|
|
550
550
|
principal: m,
|
|
551
551
|
count: l
|
|
552
552
|
};
|
|
553
|
-
},
|
|
553
|
+
}, Yt = (t) => {
|
|
554
554
|
const n = b.getArgs().getRawAt(t), e = n;
|
|
555
555
|
return !0 !== e?.isIRange || 1 === e.size && !0 === n.isIReferenceRange;
|
|
556
556
|
};
|
|
557
|
-
function
|
|
557
|
+
function zt(t, n, e, r = "xnpv") {
|
|
558
558
|
const o = "xirr" === r, i = t.flatten({ onError: "value" }), u = n.flatten({ onError: "value" }), s = i.getRowCount();
|
|
559
559
|
if (s !== u.getRowCount()) throw B.BuiltIn.Num;
|
|
560
|
-
const a = !
|
|
560
|
+
const a = !Yt(e + 1), l = Yt(e) || o, f = !a || o, c = o ? 0 : 1, h = [], m = [];
|
|
561
561
|
let N;
|
|
562
562
|
for (let t = 0; t < s; t++) {
|
|
563
563
|
const n = i.getValueAt(t, 0) ?? null, e = u.getValueAt(t, 0) ?? null;
|
|
564
564
|
if (0 === t) {
|
|
565
565
|
if (B.isError(e)) throw e;
|
|
566
|
-
if (!o && (N =
|
|
566
|
+
if (!o && (N = _t(e, f, o, 0), N < c || N > 2958465)) throw B.BuiltIn.Num;
|
|
567
567
|
if (B.isError(n)) throw n;
|
|
568
568
|
} else {
|
|
569
569
|
if (B.isError(n)) throw n;
|
|
@@ -571,7 +571,7 @@ function Yt(t, n, e, r = "xnpv") {
|
|
|
571
571
|
}
|
|
572
572
|
if (o && null === n) continue;
|
|
573
573
|
if (o && null === e && a) throw B.BuiltIn.Num;
|
|
574
|
-
const r =
|
|
574
|
+
const r = _t(e, f, o, t), s = Gt(n, l, o, t);
|
|
575
575
|
if (r > 2958465 || r < c) throw B.BuiltIn.Num;
|
|
576
576
|
if (!o && r < N) throw B.BuiltIn.Num;
|
|
577
577
|
void 0 === N && (N = r), h.push(s), m.push(r);
|
|
@@ -582,24 +582,24 @@ function Yt(t, n, e, r = "xnpv") {
|
|
|
582
582
|
days: m.map((t) => t - g)
|
|
583
583
|
};
|
|
584
584
|
}
|
|
585
|
-
function
|
|
586
|
-
const o = n ?
|
|
585
|
+
function _t(t, n, e, r) {
|
|
586
|
+
const o = n ? L(t) : t;
|
|
587
587
|
if ("number" != typeof o || Number.isNaN(o)) throw e || 0 === r ? B.BuiltIn.Value : B.BuiltIn.Num;
|
|
588
588
|
return Math.trunc(o);
|
|
589
589
|
}
|
|
590
590
|
function Gt(t, n, e, r) {
|
|
591
|
-
const o = n ?
|
|
591
|
+
const o = n ? k(t) : t;
|
|
592
592
|
if ("number" != typeof o || Number.isNaN(o)) throw e || 0 === r ? B.BuiltIn.Value : B.BuiltIn.Num;
|
|
593
593
|
return o;
|
|
594
594
|
}
|
|
595
|
-
var
|
|
596
|
-
IRR: () =>
|
|
597
|
-
MIRR: () =>
|
|
598
|
-
NPV: () =>
|
|
595
|
+
var Kt = v({
|
|
596
|
+
IRR: () => Ht,
|
|
597
|
+
MIRR: () => Wt,
|
|
598
|
+
NPV: () => Xt,
|
|
599
599
|
XIRR: () => Qt,
|
|
600
600
|
XNPV: () => Zt
|
|
601
601
|
});
|
|
602
|
-
function
|
|
602
|
+
function Xt(t, n) {
|
|
603
603
|
b.formatResults(Bt(b.getRuntime()));
|
|
604
604
|
const e = [];
|
|
605
605
|
for (const t of n) for (const n of t.values()) e.push(n);
|
|
@@ -610,8 +610,8 @@ function Ht(t, n) {
|
|
|
610
610
|
for (let t = r - 1; t >= 0; t--) i += e[t], i /= o;
|
|
611
611
|
return i;
|
|
612
612
|
}
|
|
613
|
-
function
|
|
614
|
-
if (b.formatResults("0%"), b.getArgs().getKindAt(0) ===
|
|
613
|
+
function Ht(t, n = .1) {
|
|
614
|
+
if (b.formatResults("0%"), b.getArgs().getKindAt(0) === C.Error) throw t[0];
|
|
615
615
|
if (n <= -1 || 1 + n === n) throw B.BuiltIn.Value;
|
|
616
616
|
if (void 0 === t) throw B.BuiltIn.Value;
|
|
617
617
|
const e = [];
|
|
@@ -644,7 +644,7 @@ function Wt(t, n = .1) {
|
|
|
644
644
|
}
|
|
645
645
|
return NaN;
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function Wt(t, n, e) {
|
|
648
648
|
if (b.formatResults("0%"), void 0 === t) throw B.BuiltIn.Value;
|
|
649
649
|
const r = [];
|
|
650
650
|
for (const n of t) {
|
|
@@ -676,7 +676,7 @@ function Zt(t, n, e) {
|
|
|
676
676
|
const r = q(t);
|
|
677
677
|
if (void 0 === n || void 0 === e) throw B.BuiltIn.NA;
|
|
678
678
|
if (r <= 0) return NaN;
|
|
679
|
-
const o =
|
|
679
|
+
const o = zt(n, e, 1);
|
|
680
680
|
let i = 0;
|
|
681
681
|
for (let t = 0; t < o.values.length; t++) {
|
|
682
682
|
const n = xt(1 + r, o.days[t] / 365);
|
|
@@ -686,9 +686,9 @@ function Zt(t, n, e) {
|
|
|
686
686
|
return Number.isFinite(i) ? i : NaN;
|
|
687
687
|
}
|
|
688
688
|
function Qt(t, n, e = .1) {
|
|
689
|
-
const r =
|
|
689
|
+
const r = k(e);
|
|
690
690
|
if (void 0 === t || void 0 === n) throw B.BuiltIn.NA;
|
|
691
|
-
const o =
|
|
691
|
+
const o = zt(t, n, 0, "xirr"), i = o.values, u = i.length;
|
|
692
692
|
if (1 === u) throw B.BuiltIn.NA;
|
|
693
693
|
let s = !1, a = !1;
|
|
694
694
|
for (const t of i) t > 0 ? s = !0 : t < 0 && (a = !0);
|
|
@@ -741,30 +741,30 @@ function Qt(t, n, e = .1) {
|
|
|
741
741
|
1e300
|
|
742
742
|
].filter((t) => t < c);
|
|
743
743
|
r > -1 && r < c && !h.includes(r) && h.push(r), h.sort((t, n) => t - n);
|
|
744
|
-
let m = NaN, N = NaN, g = Number.POSITIVE_INFINITY,
|
|
745
|
-
if (0 ===
|
|
744
|
+
let m = NaN, N = NaN, g = Number.POSITIVE_INFINITY, d = h[0], y = f(d);
|
|
745
|
+
if (0 === y) return d;
|
|
746
746
|
for (let t = 1; t < h.length; t++) {
|
|
747
747
|
const n = h[t], e = f(n);
|
|
748
748
|
if (0 === e) return n;
|
|
749
|
-
if (Number.isFinite(e) && Number.isFinite(
|
|
750
|
-
const t = Math.min(Math.abs(
|
|
751
|
-
t < g && (g = t, m =
|
|
749
|
+
if (Number.isFinite(e) && Number.isFinite(y) && e > 0 != y > 0) {
|
|
750
|
+
const t = Math.min(Math.abs(d - r), Math.abs(n - r));
|
|
751
|
+
t < g && (g = t, m = d, N = n);
|
|
752
752
|
}
|
|
753
|
-
|
|
753
|
+
d = n, y = e;
|
|
754
754
|
}
|
|
755
755
|
if (!Number.isFinite(m)) return NaN;
|
|
756
|
-
let
|
|
756
|
+
let M = f(m);
|
|
757
757
|
for (let t = 0; t < 200; t++) {
|
|
758
758
|
const t = (m + N) / 2;
|
|
759
759
|
if (t === m || t === N) break;
|
|
760
760
|
const n = f(t);
|
|
761
761
|
if (0 === n) return t;
|
|
762
|
-
n > 0 ==
|
|
762
|
+
n > 0 == M > 0 ? (m = t, M = n) : N = t;
|
|
763
763
|
}
|
|
764
|
-
const
|
|
765
|
-
return Number.isFinite(
|
|
764
|
+
const p = Math.abs(f(m)) <= Math.abs(f(N)) ? m : N;
|
|
765
|
+
return Number.isFinite(p) ? p : NaN;
|
|
766
766
|
}
|
|
767
|
-
var Jt =
|
|
767
|
+
var Jt = v({
|
|
768
768
|
DOLLARDE: () => en,
|
|
769
769
|
DOLLARFR: () => rn,
|
|
770
770
|
EFFECT: () => tn,
|
|
@@ -806,7 +806,7 @@ var on = (t) => {
|
|
|
806
806
|
scale: 10 ** Math.ceil(Math.log10(n))
|
|
807
807
|
};
|
|
808
808
|
};
|
|
809
|
-
var un = (t, n) =>
|
|
809
|
+
var un = (t, n) => z(t, n - 1), sn = (t) => t.d === un(t.y, t.m);
|
|
810
810
|
function an(t, n = !1) {
|
|
811
811
|
const e = Math.min(t.d, un(t.y, t.m)), r = t.m <= 2 ? t.y - 1 : t.y, o = Math.floor(r / 400), i = r - 400 * o, u = Math.floor((153 * (t.m + (t.m > 2 ? -3 : 9)) + 2) / 5) + e - 1, s = 146097 * o + (365 * i + Math.floor(i / 4) - Math.floor(i / 100) + u) - 693900;
|
|
812
812
|
return !n && s >= 60 ? s + 1 : s;
|
|
@@ -856,24 +856,24 @@ function Nn(t, n, e) {
|
|
|
856
856
|
function gn(t, n, e) {
|
|
857
857
|
return an(mn(t, n, e).ncd);
|
|
858
858
|
}
|
|
859
|
-
function
|
|
859
|
+
function dn(t, n, e) {
|
|
860
860
|
const r = mn(t, n, e);
|
|
861
861
|
return an(r.pcd) <= 0 ? NaN : r.count;
|
|
862
862
|
}
|
|
863
|
-
function
|
|
863
|
+
function yn(t, n, e, r) {
|
|
864
864
|
return function(t, n, e) {
|
|
865
865
|
const { days: r } = Q(t, n, e);
|
|
866
866
|
return t < n ? r : 0;
|
|
867
867
|
}(Nn(t, n, e), t, r);
|
|
868
868
|
}
|
|
869
|
-
function
|
|
869
|
+
function Mn(t, n, e, r) {
|
|
870
870
|
const o = mn(t, n, e);
|
|
871
871
|
if (0 !== r && 4 !== r) return an(o.ncd) - t;
|
|
872
872
|
const i = fn(t), u = hn(o.maturity, o.count - 1, o.step, !0), s = o.pcd.y === i.y && o.pcd.m === i.m && o.pcd.d === i.d;
|
|
873
873
|
let a = s ? hn(o.maturity, o.count, o.step, !0).d : i.d, l = u.d;
|
|
874
874
|
return 4 === r ? (a = Math.min(a, 30), l = Math.min(l, 30)) : ((31 === a || s && 2 === i.m && a >= un(i.y, 2)) && (a = 30), (31 === l || 2 === u.m && l >= un(u.y, 2)) && (l = 30)), 360 * (u.y - i.y) + 30 * (u.m - i.m) + (l - a);
|
|
875
875
|
}
|
|
876
|
-
function
|
|
876
|
+
function pn(t, n, e, r) {
|
|
877
877
|
if (3 === r) return 365 / e;
|
|
878
878
|
if (1 !== r) return 360 / e;
|
|
879
879
|
const o = 12 / e, i = fn(n), u = [i], s = [i];
|
|
@@ -891,11 +891,11 @@ function Mn(t, n, e, r) {
|
|
|
891
891
|
return ln(u[h], u[h - 1]);
|
|
892
892
|
}
|
|
893
893
|
function In(t, n, e, r) {
|
|
894
|
-
const o =
|
|
894
|
+
const o = $(t), i = $(n), u = Math.floor(o), s = Math.floor(i);
|
|
895
895
|
if (!J(o) || !J(i) || u >= s) throw B.BuiltIn.Num;
|
|
896
896
|
const a = Math.trunc(q(e));
|
|
897
897
|
if (1 !== a && 2 !== a && 4 !== a) throw B.BuiltIn.Num;
|
|
898
|
-
const l = void 0 === r ? 0 :
|
|
898
|
+
const l = void 0 === r ? 0 : k(r), f = Math.trunc(l);
|
|
899
899
|
if (l < 0 || f > 4) throw B.BuiltIn.Num;
|
|
900
900
|
return {
|
|
901
901
|
settlement: u,
|
|
@@ -905,7 +905,7 @@ function In(t, n, e, r) {
|
|
|
905
905
|
};
|
|
906
906
|
}
|
|
907
907
|
function wn(t, n, e, r) {
|
|
908
|
-
const o =
|
|
908
|
+
const o = dn(t, n, e), i = yn(t, n, e, r), u = 1 === r ? i + Mn(t, n, e, r) : pn(t, n, e, r);
|
|
909
909
|
return {
|
|
910
910
|
N: o,
|
|
911
911
|
A: i,
|
|
@@ -933,44 +933,44 @@ function Bn(t, n, e, r, o, i) {
|
|
|
933
933
|
const n = t + f, e = h / c ** n;
|
|
934
934
|
m += n * e, N += e;
|
|
935
935
|
}
|
|
936
|
-
const g = u + f,
|
|
937
|
-
if (!Number.isFinite(
|
|
938
|
-
const
|
|
939
|
-
return m += g *
|
|
936
|
+
const g = u + f, d = c ** g;
|
|
937
|
+
if (!Number.isFinite(d)) return NaN;
|
|
938
|
+
const y = 100 / d;
|
|
939
|
+
return m += g * y, N += y, m / N / o;
|
|
940
940
|
}
|
|
941
|
-
var xn =
|
|
942
|
-
COUPDAYBS: () =>
|
|
943
|
-
COUPDAYS: () =>
|
|
941
|
+
var xn = v({
|
|
942
|
+
COUPDAYBS: () => Rn,
|
|
943
|
+
COUPDAYS: () => Cn,
|
|
944
944
|
COUPDAYSNC: () => En,
|
|
945
|
-
COUPNCD: () =>
|
|
945
|
+
COUPNCD: () => vn,
|
|
946
946
|
COUPNUM: () => Dn,
|
|
947
|
-
COUPPCD: () =>
|
|
947
|
+
COUPPCD: () => An
|
|
948
948
|
});
|
|
949
|
-
function
|
|
949
|
+
function Rn(t, n, e, r = 0) {
|
|
950
950
|
const o = In(t, n, e, r);
|
|
951
|
-
return
|
|
951
|
+
return yn(o.settlement, o.maturity, o.frequency, o.basis);
|
|
952
952
|
}
|
|
953
|
-
function
|
|
953
|
+
function Cn(t, n, e, r = 0) {
|
|
954
954
|
const o = In(t, n, e, r);
|
|
955
|
-
return
|
|
955
|
+
return pn(o.settlement, o.maturity, o.frequency, o.basis);
|
|
956
956
|
}
|
|
957
957
|
function En(t, n, e, r = 0) {
|
|
958
958
|
const o = In(t, n, e, r);
|
|
959
|
-
return
|
|
959
|
+
return Mn(o.settlement, o.maturity, o.frequency, o.basis);
|
|
960
960
|
}
|
|
961
|
-
function
|
|
961
|
+
function vn(t, n, e, r = 0) {
|
|
962
962
|
const o = In(t, n, e, r);
|
|
963
963
|
return gn(o.settlement, o.maturity, o.frequency);
|
|
964
964
|
}
|
|
965
|
-
function
|
|
965
|
+
function An(t, n, e, r = 0) {
|
|
966
966
|
const o = In(t, n, e, r);
|
|
967
967
|
return Nn(o.settlement, o.maturity, o.frequency);
|
|
968
968
|
}
|
|
969
969
|
function Dn(t, n, e, r = 0) {
|
|
970
970
|
const o = In(t, n, e, r);
|
|
971
|
-
return
|
|
971
|
+
return dn(o.settlement, o.maturity, o.frequency);
|
|
972
972
|
}
|
|
973
|
-
var Fn =
|
|
973
|
+
var Fn = v({
|
|
974
974
|
DATEDIF: () => Sn,
|
|
975
975
|
DAYS360: () => Tn,
|
|
976
976
|
YEARFRAC: () => Vn
|
|
@@ -992,47 +992,47 @@ function Sn(t, n, e) {
|
|
|
992
992
|
return NaN;
|
|
993
993
|
}
|
|
994
994
|
function Vn(t, n, e = 0) {
|
|
995
|
-
const r = void 0 === e ? 0 :
|
|
995
|
+
const r = void 0 === e ? 0 : k(e), o = Math.trunc(r);
|
|
996
996
|
if (r < 0 || o > 4) return NaN;
|
|
997
|
-
const i =
|
|
997
|
+
const i = $(t);
|
|
998
998
|
if (!J(i)) return NaN;
|
|
999
|
-
const u =
|
|
999
|
+
const u = $(n);
|
|
1000
1000
|
return J(u) ? tt(i, u, o) : NaN;
|
|
1001
1001
|
}
|
|
1002
1002
|
function Tn(t, n, e = !1) {
|
|
1003
1003
|
if (!J(t) || !J(n)) return NaN;
|
|
1004
1004
|
const r = .5 / 86400, o = Math.floor(t + r), i = Math.floor(n + r);
|
|
1005
1005
|
return e ? (i >= o ? 1 : -1) * Q(o, i, 4).days : function(t, n) {
|
|
1006
|
-
const e =
|
|
1006
|
+
const e = W(t), r = W(n), o = e.year, i = e.month;
|
|
1007
1007
|
let u = e.day, s = r.year, a = r.month, l = r.day;
|
|
1008
|
-
return 2 === i ? 3 ===
|
|
1008
|
+
return 2 === i ? 3 === W(t + 1).month && (u = 30) : 31 === u && (u = 30), 31 === l && (u < 30 ? (12 === a ? (s += 1, a = 1) : a += 1, l = 1) : l = 30), Z(o, i, u, s, a, l);
|
|
1009
1009
|
}(o, i);
|
|
1010
1010
|
}
|
|
1011
|
-
var Pn =
|
|
1011
|
+
var Pn = v({
|
|
1012
1012
|
AMORLINC: () => qn,
|
|
1013
|
-
DB: () =>
|
|
1014
|
-
DDB: () =>
|
|
1013
|
+
DB: () => $n,
|
|
1014
|
+
DDB: () => kn,
|
|
1015
1015
|
SLN: () => On,
|
|
1016
|
-
SYD: () =>
|
|
1016
|
+
SYD: () => Ln
|
|
1017
1017
|
});
|
|
1018
1018
|
function On(t, n, e) {
|
|
1019
1019
|
if (b.formatResults(Bt(b.getRuntime())), 0 === e) throw B.BuiltIn.Div0;
|
|
1020
1020
|
return (t - n) / e;
|
|
1021
1021
|
}
|
|
1022
|
-
function
|
|
1022
|
+
function Ln(t, n, e, r) {
|
|
1023
1023
|
if (b.formatResults(Bt(b.getRuntime())), n < 0 || e <= 0 || r <= 0 || r > e) return NaN;
|
|
1024
1024
|
const o = e * (e + 1) / 2;
|
|
1025
1025
|
if (!Number.isFinite(o)) throw B.BuiltIn.Div0;
|
|
1026
1026
|
return (t - n) * (e + 1 - r) / o;
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1028
|
+
function $n(t, n, e, r, o = 12) {
|
|
1029
1029
|
if (b.formatResults(Bt(b.getRuntime())), t < 0 || n < 0 || e <= 0 || r <= 0) return NaN;
|
|
1030
|
-
const i =
|
|
1030
|
+
const i = Rt(o);
|
|
1031
1031
|
if (i < 1 || i > 12) return NaN;
|
|
1032
|
-
const u =
|
|
1032
|
+
const u = Rt(e), s = Rt(r);
|
|
1033
1033
|
if (s > u + (i < 12 ? 1 : 0)) return NaN;
|
|
1034
1034
|
if (0 === t) return 0;
|
|
1035
|
-
const a =
|
|
1035
|
+
const a = Ct(1 - xt(n / t, 1 / e), 3);
|
|
1036
1036
|
if (0 === a) return 0;
|
|
1037
1037
|
const l = t * a * (i / 12), f = Math.max(s, 1);
|
|
1038
1038
|
if (1 === f) return l;
|
|
@@ -1040,7 +1040,7 @@ function kn(t, n, e, r, o = 12) {
|
|
|
1040
1040
|
for (let t = 2; t < f; t++) c -= c * a;
|
|
1041
1041
|
return f === u + 1 ? c / 12 * a * (12 - i) : c * a;
|
|
1042
1042
|
}
|
|
1043
|
-
function
|
|
1043
|
+
function kn(t, n, e, r, o = 2) {
|
|
1044
1044
|
if (b.formatResults(Bt(b.getRuntime())), t < 0 || n < 0 || e <= 0 || r <= 0 || r > e || o <= 0) return NaN;
|
|
1045
1045
|
const i = o / e, u = Math.max(r, 1) - 1, s = 0 === u ? t : t * xt(1 - i, u);
|
|
1046
1046
|
let a = s * i;
|
|
@@ -1051,17 +1051,17 @@ function qn(t, n, e, r, o, i, u = 0) {
|
|
|
1051
1051
|
if (!s) return NaN;
|
|
1052
1052
|
const { cost: a, salvage: l, periodIndex: f, rate: c, days: h, yearDays: m } = s, N = a * c;
|
|
1053
1053
|
if (!Number.isFinite(N)) return 0;
|
|
1054
|
-
const g = a - l,
|
|
1055
|
-
if (0 === f) return
|
|
1056
|
-
const
|
|
1057
|
-
return f <=
|
|
1058
|
-
}
|
|
1059
|
-
var
|
|
1060
|
-
FVSCHEDULE: () =>
|
|
1061
|
-
PDURATION: () =>
|
|
1062
|
-
RRI: () =>
|
|
1054
|
+
const g = a - l, d = Math.min(a * (c * (h / m)), g);
|
|
1055
|
+
if (0 === f) return d;
|
|
1056
|
+
const y = Math.floor((g - d) / N);
|
|
1057
|
+
return f <= y ? N : f === y + 1 ? (g - d) % N : 0;
|
|
1058
|
+
}
|
|
1059
|
+
var jn = v({
|
|
1060
|
+
FVSCHEDULE: () => Un,
|
|
1061
|
+
PDURATION: () => zn,
|
|
1062
|
+
RRI: () => Yn
|
|
1063
1063
|
});
|
|
1064
|
-
function
|
|
1064
|
+
function Un(t, n) {
|
|
1065
1065
|
if (void 0 === t || void 0 === n) throw B.BuiltIn.NA;
|
|
1066
1066
|
let e = q(t);
|
|
1067
1067
|
const r = b.getArgs().getRawAt(1), o = r, i = !0 === o?.isIRange, u = i && 1 === o.size && !0 === o.isIReferenceRange;
|
|
@@ -1073,21 +1073,21 @@ function jn(t, n) {
|
|
|
1073
1073
|
}
|
|
1074
1074
|
return Number.isFinite(e) ? e : 0;
|
|
1075
1075
|
}
|
|
1076
|
-
function
|
|
1076
|
+
function Yn(t, n, e) {
|
|
1077
1077
|
if (t <= 0 || e < 0 && n > 0 || e > 0 && n < 0) return NaN;
|
|
1078
1078
|
if (0 === n) return 0 === e ? 0 : NaN;
|
|
1079
1079
|
const r = xt(e / n, 1 / t) - 1;
|
|
1080
1080
|
return Number.isFinite(r) ? r : NaN;
|
|
1081
1081
|
}
|
|
1082
|
-
function
|
|
1082
|
+
function zn(t, n, e) {
|
|
1083
1083
|
if (t <= 0 || n <= 0 || e <= 0) return NaN;
|
|
1084
1084
|
const r = Math.log(1 + t);
|
|
1085
1085
|
if (0 === r) throw B.BuiltIn.Div0;
|
|
1086
1086
|
return (Math.log(e) - Math.log(n)) / r;
|
|
1087
1087
|
}
|
|
1088
|
-
function
|
|
1088
|
+
function _n(t, n, e, r) {
|
|
1089
1089
|
const o = t.map((t) => {
|
|
1090
|
-
const n =
|
|
1090
|
+
const n = $(t);
|
|
1091
1091
|
if (!J(n)) throw B.BuiltIn.Num;
|
|
1092
1092
|
return Math.floor(n);
|
|
1093
1093
|
}), i = n.map(q), u = Math.trunc(q(e));
|
|
@@ -1099,31 +1099,31 @@ function zn(t, n, e, r) {
|
|
|
1099
1099
|
basis: it(r)
|
|
1100
1100
|
};
|
|
1101
1101
|
}
|
|
1102
|
-
var Gn = (t) =>
|
|
1103
|
-
function
|
|
1102
|
+
var Gn = (t) => X(t.y, t.m, t.d);
|
|
1103
|
+
function Kn(t, n, e) {
|
|
1104
1104
|
const r = G(t);
|
|
1105
1105
|
let o = t.m - 1 + n * e;
|
|
1106
1106
|
const i = t.y + Math.floor(o / 12);
|
|
1107
|
-
return o = (o % 12 + 12) % 12 + 1,
|
|
1107
|
+
return o = (o % 12 + 12) % 12 + 1, X(i, o, r ? _(i, o) : Math.min(t.d, _(i, o)));
|
|
1108
1108
|
}
|
|
1109
|
-
var
|
|
1110
|
-
function
|
|
1109
|
+
var Xn = (t, n) => 360 * (n.y - t.y) + 30 * (n.m - t.m) + (n.d - t.d);
|
|
1110
|
+
function Hn(t, n) {
|
|
1111
1111
|
return 0 !== t && 4 !== t ? (t, n) => n - t : (e, r) => {
|
|
1112
|
-
const o =
|
|
1113
|
-
return 4 === t ? (31 === o.d && (o.d = 30), 31 === i.d && (i.d = 30),
|
|
1112
|
+
const o = K(e), i = K(r);
|
|
1113
|
+
return 4 === t ? (31 === o.d && (o.d = 30), 31 === i.d && (i.d = 30), Xn(o, i)) : (G(o) && (o.d = 30), n && G(i) && (i.d = 30), Xn(o, i));
|
|
1114
1114
|
};
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1117
|
-
const i = 12 / r, u =
|
|
1118
|
-
let l =
|
|
1119
|
-
for (; Gn(l) > e;) l =
|
|
1116
|
+
function Wn(t, n, e, r, o) {
|
|
1117
|
+
const i = 12 / r, u = K(e), s = Hn(o, !1), a = Hn(o, !0);
|
|
1118
|
+
let l = K(n);
|
|
1119
|
+
for (; Gn(l) > e;) l = H(l, -i);
|
|
1120
1120
|
if (Gn(l) < 1) throw B.BuiltIn.Num;
|
|
1121
1121
|
let f = 1;
|
|
1122
|
-
for (;
|
|
1123
|
-
if (
|
|
1122
|
+
for (; Kn(u, f, i) < n;) f++;
|
|
1123
|
+
if (Kn(u, f, i) > 2958465) throw B.BuiltIn.Num;
|
|
1124
1124
|
let c = 0, h = 0, m = 0, N = e, g = u;
|
|
1125
1125
|
for (let e = 0; e < f; e++) {
|
|
1126
|
-
g =
|
|
1126
|
+
g = H(g, i);
|
|
1127
1127
|
const r = Gn(g), o = a(N, r);
|
|
1128
1128
|
t > N && (c += Math.min(s(N, Math.min(r, t)), o) / o), t < r && (m += Math.min(s(Math.max(N, t), Math.min(r, n)), o) / o), h += e + 1 === f ? (o - a(n, r)) / o : 1, N = r;
|
|
1129
1129
|
}
|
|
@@ -1135,18 +1135,18 @@ function Kn(t, n, e, r, o) {
|
|
|
1135
1135
|
}
|
|
1136
1136
|
function Zn(t, n, e, r, o, i) {
|
|
1137
1137
|
if (Nn(r, n, o) !== r) throw B.BuiltIn.Num;
|
|
1138
|
-
const u = 12 / o, s =
|
|
1138
|
+
const u = 12 / o, s = dn(e, r, o);
|
|
1139
1139
|
if (Number.isNaN(s)) throw B.BuiltIn.Num;
|
|
1140
1140
|
const a = [r];
|
|
1141
|
-
let l =
|
|
1142
|
-
for (let t = 0; t < s; t++) l =
|
|
1141
|
+
let l = K(r);
|
|
1142
|
+
for (let t = 0; t < s; t++) l = H(l, -u), a.push(Gn(l));
|
|
1143
1143
|
if (a[a.length - 1] < 1) throw B.BuiltIn.Num;
|
|
1144
1144
|
const f = (t, n) => Q(t, n, i).days, c = wn(t, r, o, i);
|
|
1145
1145
|
if (Number.isNaN(c.N)) throw B.BuiltIn.Num;
|
|
1146
1146
|
const h = c.E, m = f(e, r);
|
|
1147
1147
|
if (m === h) throw B.BuiltIn.Num;
|
|
1148
1148
|
if (m < h) {
|
|
1149
|
-
const i =
|
|
1149
|
+
const i = dn(t, n, o) - 1;
|
|
1150
1150
|
if (Number.isNaN(i)) throw B.BuiltIn.Num;
|
|
1151
1151
|
return {
|
|
1152
1152
|
N: i,
|
|
@@ -1155,17 +1155,17 @@ function Zn(t, n, e, r, o, i) {
|
|
|
1155
1155
|
u: f(t, r) / h
|
|
1156
1156
|
};
|
|
1157
1157
|
}
|
|
1158
|
-
const N =
|
|
1159
|
-
let g = 0,
|
|
1158
|
+
const N = dn(r, n, o);
|
|
1159
|
+
let g = 0, d = 0;
|
|
1160
1160
|
for (let n = 0; n < s; n++) {
|
|
1161
1161
|
const r = a[s - n], u = a[s - n - 1], l = 1 === i ? u - r : 3 === i ? 365 / o : 360 / o, c = Math.max(r, e);
|
|
1162
|
-
t > c && u > c && (g += f(c, Math.min(u, t)) / l),
|
|
1162
|
+
t > c && u > c && (g += f(c, Math.min(u, t)) / l), d += 0 === n ? u > e ? f(e, u) / l : 0 : 1;
|
|
1163
1163
|
}
|
|
1164
|
-
const
|
|
1164
|
+
const y = K(t), M = X(y.y, y.m, _(y.y, y.m)), p = M < r && gn(M - 1, r, o) === M, I = G(K(r)) && t !== M && !p ? 1 : 0;
|
|
1165
1165
|
return {
|
|
1166
1166
|
N,
|
|
1167
1167
|
A: g,
|
|
1168
|
-
DC:
|
|
1168
|
+
DC: d,
|
|
1169
1169
|
u: c.N - 1 + I + (2 === i || 3 === i ? gn(t, r, o) - t : c.DSC) / h
|
|
1170
1170
|
};
|
|
1171
1171
|
}
|
|
@@ -1185,7 +1185,7 @@ function te(t, n, e) {
|
|
|
1185
1185
|
}
|
|
1186
1186
|
return r;
|
|
1187
1187
|
}
|
|
1188
|
-
var ne =
|
|
1188
|
+
var ne = v({
|
|
1189
1189
|
ODDFPRICE: () => re,
|
|
1190
1190
|
ODDFYIELD: () => oe,
|
|
1191
1191
|
ODDLPRICE: () => ie,
|
|
@@ -1194,14 +1194,14 @@ var ne = A({
|
|
|
1194
1194
|
function ee(t, n, e, r, o, i, u, s, a) {
|
|
1195
1195
|
const { N: l, A: f, DC: c, u: h } = Zn(t, n, e, r, s, a), m = i / s, N = 100 * o / s, g = xt(1 + m, l + h);
|
|
1196
1196
|
if (!Number.isFinite(g)) throw B.BuiltIn.Num;
|
|
1197
|
-
let
|
|
1198
|
-
for (let t = 1; t <= l; t++)
|
|
1199
|
-
const
|
|
1200
|
-
if (!Number.isFinite(
|
|
1201
|
-
return
|
|
1197
|
+
let d = 0;
|
|
1198
|
+
for (let t = 1; t <= l; t++) d += N / xt(1 + m, t + h);
|
|
1199
|
+
const y = u / g + N * c / xt(1 + m, h) + d - N * f;
|
|
1200
|
+
if (!Number.isFinite(y)) throw B.BuiltIn.Num;
|
|
1201
|
+
return y;
|
|
1202
1202
|
}
|
|
1203
1203
|
function re(t, n, e, r, o, i, u, s, a = 0) {
|
|
1204
|
-
const l =
|
|
1204
|
+
const l = _n([
|
|
1205
1205
|
t,
|
|
1206
1206
|
n,
|
|
1207
1207
|
e,
|
|
@@ -1210,12 +1210,12 @@ function re(t, n, e, r, o, i, u, s, a = 0) {
|
|
|
1210
1210
|
o,
|
|
1211
1211
|
i,
|
|
1212
1212
|
u
|
|
1213
|
-
], s, a), [f, c, h, m] = l.dates, [N, g,
|
|
1214
|
-
if (!(h < f && f < m && m < c) || N < 0 || g < 0 ||
|
|
1215
|
-
return ee(f, c, h, m, N, g,
|
|
1213
|
+
], s, a), [f, c, h, m] = l.dates, [N, g, d] = l.numbers;
|
|
1214
|
+
if (!(h < f && f < m && m < c) || N < 0 || g < 0 || d <= 0) throw B.BuiltIn.Num;
|
|
1215
|
+
return ee(f, c, h, m, N, g, d, l.frequency, l.basis);
|
|
1216
1216
|
}
|
|
1217
1217
|
function oe(t, n, e, r, o, i, u, s, a = 0) {
|
|
1218
|
-
const l =
|
|
1218
|
+
const l = _n([
|
|
1219
1219
|
t,
|
|
1220
1220
|
n,
|
|
1221
1221
|
e,
|
|
@@ -1224,12 +1224,12 @@ function oe(t, n, e, r, o, i, u, s, a = 0) {
|
|
|
1224
1224
|
o,
|
|
1225
1225
|
i,
|
|
1226
1226
|
u
|
|
1227
|
-
], s, a), [f, c, h, m] = l.dates, [N, g,
|
|
1228
|
-
if (!(h < f && f < m && m < c) || N < 0 || g <= 0 ||
|
|
1227
|
+
], s, a), [f, c, h, m] = l.dates, [N, g, d] = l.numbers;
|
|
1228
|
+
if (!(h < f && f < m && m < c) || N < 0 || g <= 0 || d <= 0) throw B.BuiltIn.Num;
|
|
1229
1229
|
Zn(f, c, h, m, l.frequency, l.basis);
|
|
1230
|
-
const
|
|
1230
|
+
const y = te(Jn(N, g, nt(f, c, l.basis)), (t) => {
|
|
1231
1231
|
try {
|
|
1232
|
-
return ee(f, c, h, m, N, t,
|
|
1232
|
+
return ee(f, c, h, m, N, t, d, l.frequency, l.basis) - g;
|
|
1233
1233
|
} catch {
|
|
1234
1234
|
return NaN;
|
|
1235
1235
|
}
|
|
@@ -1239,12 +1239,12 @@ function oe(t, n, e, r, o, i, u, s, a = 0) {
|
|
|
1239
1239
|
N += -m * f * c / s / xt(h, c + 1);
|
|
1240
1240
|
for (let t = 1; t <= l; t++) N += -m * (t + c) / s / xt(h, t + c + 1);
|
|
1241
1241
|
return N;
|
|
1242
|
-
}(f, c, h, m, N, t,
|
|
1243
|
-
if (!Number.isFinite(
|
|
1244
|
-
return
|
|
1242
|
+
}(f, c, h, m, N, t, d, l.frequency, l.basis));
|
|
1243
|
+
if (!Number.isFinite(y)) throw B.BuiltIn.Num;
|
|
1244
|
+
return y;
|
|
1245
1245
|
}
|
|
1246
1246
|
function ie(t, n, e, r, o, i, u, s = 0) {
|
|
1247
|
-
const a =
|
|
1247
|
+
const a = _n([
|
|
1248
1248
|
t,
|
|
1249
1249
|
n,
|
|
1250
1250
|
e
|
|
@@ -1254,11 +1254,11 @@ function ie(t, n, e, r, o, i, u, s = 0) {
|
|
|
1254
1254
|
i
|
|
1255
1255
|
], u, s), [l, f, c] = a.dates, [h, m, N] = a.numbers;
|
|
1256
1256
|
if (!(c < l && l < f) || h < 0 || m < 0 || N <= 0) throw B.BuiltIn.Num;
|
|
1257
|
-
const { A: g, DC:
|
|
1258
|
-
return (N + Qn(
|
|
1257
|
+
const { A: g, DC: d, DSC: y } = Wn(l, f, c, a.frequency, a.basis), M = 100 * h / a.frequency;
|
|
1258
|
+
return (N + Qn(M * d)) / (1 + m / a.frequency * y) - Qn(M * g);
|
|
1259
1259
|
}
|
|
1260
1260
|
function ue(t, n, e, r, o, i, u, s = 0) {
|
|
1261
|
-
const a =
|
|
1261
|
+
const a = _n([
|
|
1262
1262
|
t,
|
|
1263
1263
|
n,
|
|
1264
1264
|
e
|
|
@@ -1268,10 +1268,10 @@ function ue(t, n, e, r, o, i, u, s = 0) {
|
|
|
1268
1268
|
i
|
|
1269
1269
|
], u, s), [l, f, c] = a.dates, [h, m, N] = a.numbers;
|
|
1270
1270
|
if (!(c < l && l < f) || h < 0 || m <= 0 || N <= 0) throw B.BuiltIn.Num;
|
|
1271
|
-
const { A: g, DC:
|
|
1272
|
-
return (
|
|
1271
|
+
const { A: g, DC: d, DSC: y } = Wn(l, f, c, a.frequency, a.basis), M = 100 * h / a.frequency, p = N + Qn(M * d), I = m + Qn(M * g);
|
|
1272
|
+
return (p - I) / I * (a.frequency / y);
|
|
1273
1273
|
}
|
|
1274
|
-
var se =
|
|
1274
|
+
var se = v({
|
|
1275
1275
|
DURATION: () => le,
|
|
1276
1276
|
MDURATION: () => fe,
|
|
1277
1277
|
PRICE: () => ae,
|
|
@@ -1317,17 +1317,17 @@ function ce(t, n, e, r, o, i, u = 0) {
|
|
|
1317
1317
|
if (Number.isNaN(t)) throw B.BuiltIn.Num;
|
|
1318
1318
|
return t;
|
|
1319
1319
|
}
|
|
1320
|
-
const
|
|
1321
|
-
return ct((f / 100 + a / m -
|
|
1320
|
+
const d = g.A, y = Q(c, h, N).days, M = 1 === N || 2 === N || 3 === N ? d + y : g.E, p = l / 100 + d / M * (a / m);
|
|
1321
|
+
return ct((f / 100 + a / m - p) / p * m * (M / y));
|
|
1322
1322
|
}
|
|
1323
|
-
var he =
|
|
1323
|
+
var he = v({
|
|
1324
1324
|
DISC: () => me,
|
|
1325
|
-
INTRATE: () =>
|
|
1325
|
+
INTRATE: () => de,
|
|
1326
1326
|
PRICEDISC: () => Ne,
|
|
1327
|
-
PRICEMAT: () =>
|
|
1328
|
-
RECEIVED: () =>
|
|
1327
|
+
PRICEMAT: () => Me,
|
|
1328
|
+
RECEIVED: () => ye,
|
|
1329
1329
|
YIELDDISC: () => ge,
|
|
1330
|
-
YIELDMAT: () =>
|
|
1330
|
+
YIELDMAT: () => pe
|
|
1331
1331
|
});
|
|
1332
1332
|
function me(t, n, e, r, o = 0) {
|
|
1333
1333
|
const i = st(t, n, e, r, o), u = (1 - i.x / i.y) / tt(i.settlement, i.maturity, i.basis);
|
|
@@ -1341,26 +1341,26 @@ function ge(t, n, e, r, o = 0) {
|
|
|
1341
1341
|
const i = st(t, n, e, r, o), u = (i.y - i.x) / i.x / tt(i.settlement, i.maturity, i.basis);
|
|
1342
1342
|
return Number.isFinite(u) ? u : NaN;
|
|
1343
1343
|
}
|
|
1344
|
-
function
|
|
1344
|
+
function de(t, n, e, r, o = 0) {
|
|
1345
1345
|
const i = st(t, n, e, r, o), u = (i.y - i.x) / i.x / tt(i.settlement, i.maturity, i.basis);
|
|
1346
1346
|
return Number.isFinite(u) ? u : NaN;
|
|
1347
1347
|
}
|
|
1348
|
-
function
|
|
1348
|
+
function ye(t, n, e, r, o = 0) {
|
|
1349
1349
|
const i = st(t, n, e, r, o), u = 1 - i.y * tt(i.settlement, i.maturity, i.basis);
|
|
1350
1350
|
if (!(u > 0)) throw B.BuiltIn.Num;
|
|
1351
1351
|
return i.x / u;
|
|
1352
1352
|
}
|
|
1353
|
-
function
|
|
1353
|
+
function Me(t, n, e, r, o, i = 0) {
|
|
1354
1354
|
const u = lt(t, n, e, r, o, i);
|
|
1355
1355
|
if (u.rate < 0 || u.x < 0) throw B.BuiltIn.Num;
|
|
1356
1356
|
return (100 + ct(u.DIM / u.B * u.rate * 100)) / (1 + u.DSM / u.B * u.x) - ct(u.A / u.B * u.rate * 100);
|
|
1357
1357
|
}
|
|
1358
|
-
function
|
|
1358
|
+
function pe(t, n, e, r, o, i = 0) {
|
|
1359
1359
|
const u = lt(t, n, e, r, o, i);
|
|
1360
1360
|
if (u.rate < 0 || u.x <= 0) throw B.BuiltIn.Num;
|
|
1361
1361
|
return ((1 + u.DIM / u.B * u.rate) / (u.x / 100 + u.A / u.B * u.rate) - 1) / (u.DSM / u.B);
|
|
1362
1362
|
}
|
|
1363
|
-
var Ie =
|
|
1363
|
+
var Ie = v({
|
|
1364
1364
|
TBILLEQ: () => Be,
|
|
1365
1365
|
TBILLPRICE: () => we,
|
|
1366
1366
|
TBILLYIELD: () => be
|
|
@@ -1386,8 +1386,8 @@ function Be(t, n, e) {
|
|
|
1386
1386
|
const u = r.days / (r.days > 365 ? 366 : 365);
|
|
1387
1387
|
return (-2 * u + 2 * Math.sqrt(u * u - (2 * u - 1) * (1 - 1 / i))) / (2 * u - 1);
|
|
1388
1388
|
}
|
|
1389
|
-
var xe =
|
|
1390
|
-
function
|
|
1389
|
+
var xe = v({ VDB: () => Ce }), Re = 1e7;
|
|
1390
|
+
function Ce(t, n, e, r, o, i = 2, u = !1) {
|
|
1391
1391
|
if (b.formatResults(Bt(b.getRuntime())), t < 0 || n < 0 || e < 0 || i < 0 || r < 0 || o > e || r > o) return NaN;
|
|
1392
1392
|
if (0 === e) throw B.BuiltIn.Div0;
|
|
1393
1393
|
if (r === o) return 0;
|
|
@@ -1416,7 +1416,7 @@ function Re(t, n, e, r, o, i = 2, u = !1) {
|
|
|
1416
1416
|
}
|
|
1417
1417
|
s -= o;
|
|
1418
1418
|
}
|
|
1419
|
-
if (i >
|
|
1419
|
+
if (i > Re) return s * xt(1 - r, i);
|
|
1420
1420
|
for (let t = 1; t <= i; t++) {
|
|
1421
1421
|
let o;
|
|
1422
1422
|
if (a) o = l;
|
|
@@ -1447,21 +1447,21 @@ var Ee = (t, n, e) => {
|
|
|
1447
1447
|
const r = t * n;
|
|
1448
1448
|
return Number.isFinite(r) ? t - r < e ? t - e : r : NaN;
|
|
1449
1449
|
};
|
|
1450
|
-
var
|
|
1450
|
+
var ve = () => B.BuiltIn.Value, Ae = (t, n) => {
|
|
1451
1451
|
let e, r = !1;
|
|
1452
1452
|
if (!0 === t?.isIFunction) e = [t];
|
|
1453
1453
|
else {
|
|
1454
|
-
if (!0 !== t?.isIRange) return
|
|
1454
|
+
if (!0 !== t?.isIRange) return ve();
|
|
1455
1455
|
{
|
|
1456
1456
|
const n = t, o = n.getRowCount();
|
|
1457
|
-
if (o > 1 && n.getColumnCount() > 1) return
|
|
1457
|
+
if (o > 1 && n.getColumnCount() > 1) return ve();
|
|
1458
1458
|
r = o > 1, e = [];
|
|
1459
1459
|
for (const t of n.entries()) {
|
|
1460
1460
|
const n = t.value;
|
|
1461
|
-
if (!0 !== n?.isIFunction) return
|
|
1461
|
+
if (!0 !== n?.isIFunction) return ve();
|
|
1462
1462
|
e.push(n);
|
|
1463
1463
|
}
|
|
1464
|
-
if (0 === e.length || e.length !== n.size) return
|
|
1464
|
+
if (0 === e.length || e.length !== n.size) return ve();
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
1467
|
const o = [], i = (t, n) => {
|
|
@@ -1500,37 +1500,24 @@ var Ae = () => B.BuiltIn.Value, ve = (t, n) => {
|
|
|
1500
1500
|
measures: o,
|
|
1501
1501
|
vertical: r,
|
|
1502
1502
|
named: e.length > 1
|
|
1503
|
-
} :
|
|
1504
|
-
}, De = (t, n
|
|
1505
|
-
let r;
|
|
1506
|
-
try {
|
|
1507
|
-
r = t.twoArgs ? t.fn.execute(n, e()) : t.fn.execute(n);
|
|
1508
|
-
} catch (t) {
|
|
1509
|
-
if (B.isError(t)) return t;
|
|
1510
|
-
throw t;
|
|
1511
|
-
}
|
|
1512
|
-
if (!0 === r?.isIRange) {
|
|
1513
|
-
const t = r;
|
|
1514
|
-
return !0 === t.isIReferenceRange && 1 === t.size ? t.getValueAt(0, 0) : Ae();
|
|
1515
|
-
}
|
|
1516
|
-
return r ?? null;
|
|
1517
|
-
}, Fe = (t, n) => {
|
|
1503
|
+
} : ve();
|
|
1504
|
+
}, De = (t, n) => {
|
|
1518
1505
|
let e = t;
|
|
1519
|
-
if (void 0 === e) e =
|
|
1520
|
-
else if (!Number.isInteger(e) || e < 0 || e > 3) return
|
|
1506
|
+
if (void 0 === e) e = Se(n) ? 1 : 0;
|
|
1507
|
+
else if (!Number.isInteger(e) || e < 0 || e > 3) return ve();
|
|
1521
1508
|
return {
|
|
1522
1509
|
hasHeader: 1 === e || 3 === e,
|
|
1523
1510
|
show: 2 === e || 3 === e
|
|
1524
1511
|
};
|
|
1525
|
-
},
|
|
1512
|
+
}, Fe = (t) => B.isError(t) ? "error" : typeof t, Se = (t) => {
|
|
1526
1513
|
if (t.getRowCount() < 2) return !1;
|
|
1527
1514
|
const n = t.getColumnCount();
|
|
1528
1515
|
for (let e = 0; e < n; e++) {
|
|
1529
1516
|
const n = t.getValueAt(0, e), r = t.getValueAt(1, e);
|
|
1530
|
-
if (null !== n && null !== r &&
|
|
1517
|
+
if (null !== n && null !== r && Fe(n) !== Fe(r)) return !0;
|
|
1531
1518
|
}
|
|
1532
1519
|
return !1;
|
|
1533
|
-
},
|
|
1520
|
+
}, Ve = (t, n) => Number.isInteger(t) && Math.abs(t) <= n, Te = (t, n, e) => {
|
|
1534
1521
|
const r = new Array(n).fill(1);
|
|
1535
1522
|
if (!t) return {
|
|
1536
1523
|
keyDirections: r,
|
|
@@ -1539,11 +1526,11 @@ var Ae = () => B.BuiltIn.Value, ve = (t, n) => {
|
|
|
1539
1526
|
const o = [];
|
|
1540
1527
|
for (const r of t.entries()) {
|
|
1541
1528
|
const t = r.value;
|
|
1542
|
-
if ("number" != typeof t || !Number.isInteger(t) || 0 === t) return
|
|
1543
|
-
if (Math.abs(t) > n + e) return
|
|
1529
|
+
if ("number" != typeof t || !Number.isInteger(t) || 0 === t) return ve();
|
|
1530
|
+
if (Math.abs(t) > n + e) return ve();
|
|
1544
1531
|
o.push(t);
|
|
1545
1532
|
}
|
|
1546
|
-
if (o.length !== t.size) return
|
|
1533
|
+
if (o.length !== t.size) return ve();
|
|
1547
1534
|
if (1 === o.length && Math.abs(o[0]) > n) return {
|
|
1548
1535
|
keyDirections: r,
|
|
1549
1536
|
byValue: {
|
|
@@ -1551,124 +1538,119 @@ var Ae = () => B.BuiltIn.Value, ve = (t, n) => {
|
|
|
1551
1538
|
direction: Math.sign(o[0])
|
|
1552
1539
|
}
|
|
1553
1540
|
};
|
|
1554
|
-
if (o.length > n) return
|
|
1541
|
+
if (o.length > n) return ve();
|
|
1555
1542
|
const i = /* @__PURE__ */ new Set();
|
|
1556
1543
|
for (const t of o) {
|
|
1557
1544
|
const e = Math.abs(t);
|
|
1558
|
-
if (e > n || i.has(e)) return
|
|
1545
|
+
if (e > n || i.has(e)) return ve();
|
|
1559
1546
|
i.add(e), r[e - 1] = Math.sign(t);
|
|
1560
1547
|
}
|
|
1561
1548
|
return {
|
|
1562
1549
|
keyDirections: r,
|
|
1563
1550
|
byValue: null
|
|
1564
1551
|
};
|
|
1565
|
-
},
|
|
1552
|
+
}, Pe = (t) => 1 === t.size && !0 === t.isIReferenceRange && null === t.getValueAt(0, 0), Oe = (t, n) => {
|
|
1566
1553
|
if (1 !== t.getColumnCount() || t.getRowCount() !== n) return !1;
|
|
1567
1554
|
for (const n of t.entries()) {
|
|
1568
1555
|
const t = typeof n.value;
|
|
1569
1556
|
if ("boolean" !== t && "number" !== t) return !1;
|
|
1570
1557
|
}
|
|
1571
1558
|
return !0;
|
|
1572
|
-
},
|
|
1573
|
-
|
|
1574
|
-
const
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1559
|
+
}, Le = (t, n, e, r, o, i) => {
|
|
1560
|
+
if (!n.twoArgs) {
|
|
1561
|
+
const i = t.getAggregate?.(e, n.fn, r, o);
|
|
1562
|
+
if (null === i) return "";
|
|
1563
|
+
if (void 0 !== i) return i;
|
|
1564
|
+
}
|
|
1565
|
+
const u = t.getMembers(e, r, o);
|
|
1566
|
+
return u ? ((t, n, e) => {
|
|
1567
|
+
let r;
|
|
1568
|
+
try {
|
|
1569
|
+
r = t.twoArgs ? t.fn.execute(n, e()) : t.fn.execute(n);
|
|
1570
|
+
} catch (t) {
|
|
1571
|
+
if (B.isError(t)) return t;
|
|
1572
|
+
throw t;
|
|
1583
1573
|
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
const n = i[t], e = new Array(n.getGroupCount());
|
|
1588
|
-
for (let r = 0; r < e.length; r++) {
|
|
1589
|
-
const o = n.getKeys(r)[t], u = 0 === t ? null : s[i[t - 1].getGroup(n.getFirstRecord(r))], l = {
|
|
1590
|
-
level: t,
|
|
1591
|
-
group: r,
|
|
1592
|
-
keys: u ? [...u.keys, o] : [o],
|
|
1593
|
-
parent: u,
|
|
1594
|
-
children: []
|
|
1595
|
-
};
|
|
1596
|
-
e[r] = l, u ? u.children.push(l) : a.push(l);
|
|
1597
|
-
}
|
|
1598
|
-
s = e;
|
|
1574
|
+
if (!0 === r?.isIRange) {
|
|
1575
|
+
const t = r;
|
|
1576
|
+
return !0 === t.isIReferenceRange && 1 === t.size ? t.getValueAt(0, 0) : ve();
|
|
1599
1577
|
}
|
|
1600
|
-
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1578
|
+
return r ?? null;
|
|
1579
|
+
})(n, u, i) : "";
|
|
1580
|
+
}, $e = class {
|
|
1581
|
+
constructor(t, n) {
|
|
1582
|
+
this.root = t.getRoot(), this.fieldCount = n;
|
|
1583
|
+
}
|
|
1584
|
+
sortTree(t, n) {
|
|
1585
|
+
const e = /* @__PURE__ */ new Map(), r = t.byValue, o = (i) => {
|
|
1586
|
+
const u = [...i.getChildren()];
|
|
1587
|
+
if (0 === u.length) return;
|
|
1588
|
+
const s = u[0].getLevel() - 1;
|
|
1589
|
+
u.sort((n, e) => ke(n.getKeys()[s], e.getKeys()[s], t.keyDirections[s])), r && u.sort((t, e) => qe(n(t), n(e), r.direction)), e.set(i, u);
|
|
1590
|
+
for (const t of u) o(t);
|
|
1591
|
+
};
|
|
1592
|
+
return o(this.root), e;
|
|
1607
1593
|
}
|
|
1608
|
-
|
|
1609
|
-
const
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
};
|
|
1614
|
-
return n(this.roots), t.sort((t, n) => {
|
|
1615
|
-
for (let e = 0; e < this.fieldCount; e++) {
|
|
1616
|
-
const o = r(t, n, e);
|
|
1617
|
-
if (0 !== o) return o;
|
|
1618
|
-
}
|
|
1619
|
-
return 0;
|
|
1620
|
-
}), o && t.sort(i), t;
|
|
1621
|
-
}
|
|
1622
|
-
const u = (t) => {
|
|
1623
|
-
if (0 === t.length) return;
|
|
1624
|
-
const n = t[0].level;
|
|
1625
|
-
t.sort((t, e) => r(t, e, n)), o && t.sort(i);
|
|
1626
|
-
for (const n of t) u(n.children);
|
|
1594
|
+
sortLeaves(t, n) {
|
|
1595
|
+
const e = [], r = (t) => {
|
|
1596
|
+
const n = t.getChildren();
|
|
1597
|
+
if (0 === n.length) e.push(t);
|
|
1598
|
+
else for (const t of n) r(t);
|
|
1627
1599
|
};
|
|
1628
|
-
|
|
1600
|
+
for (const t of this.root.getChildren()) r(t);
|
|
1601
|
+
e.sort((n, e) => {
|
|
1602
|
+
const r = n.getKeys(), o = e.getKeys();
|
|
1603
|
+
for (let n = 0; n < this.fieldCount; n++) {
|
|
1604
|
+
const e = ke(r[n], o[n], t.keyDirections[n]);
|
|
1605
|
+
if (0 !== e) return e;
|
|
1606
|
+
}
|
|
1607
|
+
return 0;
|
|
1608
|
+
});
|
|
1609
|
+
const o = t.byValue;
|
|
1610
|
+
return o && e.sort((t, e) => qe(n(t), n(e), o.direction)), e;
|
|
1629
1611
|
}
|
|
1630
1612
|
lines(t, n) {
|
|
1631
|
-
const e = [], r = n < 0, o = Math.max(0, Math.abs(n) - 1), i = (
|
|
1632
|
-
for (const
|
|
1633
|
-
if (0 ===
|
|
1613
|
+
const e = [], r = n < 0, o = Math.max(0, Math.abs(n) - 1), i = (n) => {
|
|
1614
|
+
for (const u of t.get(n) ?? n.getChildren()) {
|
|
1615
|
+
if (0 === u.getChildren().length) {
|
|
1634
1616
|
e.push({
|
|
1635
1617
|
kind: "group",
|
|
1636
|
-
node:
|
|
1618
|
+
node: u
|
|
1637
1619
|
});
|
|
1638
1620
|
continue;
|
|
1639
1621
|
}
|
|
1640
|
-
const t =
|
|
1622
|
+
const t = u.getLevel() - 1 < o;
|
|
1641
1623
|
t && r && e.push({
|
|
1642
1624
|
kind: "subtotal",
|
|
1643
|
-
node:
|
|
1644
|
-
}), i(
|
|
1625
|
+
node: u
|
|
1626
|
+
}), i(u), t && !r && e.push({
|
|
1645
1627
|
kind: "subtotal",
|
|
1646
|
-
node:
|
|
1628
|
+
node: u
|
|
1647
1629
|
});
|
|
1648
1630
|
}
|
|
1649
1631
|
};
|
|
1650
1632
|
return 0 !== n && r && e.push({
|
|
1651
1633
|
kind: "total",
|
|
1652
|
-
node:
|
|
1653
|
-
}), i(
|
|
1634
|
+
node: this.root
|
|
1635
|
+
}), i(this.root), 0 === n || r || e.push({
|
|
1654
1636
|
kind: "total",
|
|
1655
|
-
node:
|
|
1637
|
+
node: this.root
|
|
1656
1638
|
}), e;
|
|
1657
1639
|
}
|
|
1658
1640
|
keyCells(t, n) {
|
|
1659
1641
|
const e = new Array(this.fieldCount).fill("");
|
|
1660
1642
|
if ("total" === t.kind) return e[0] = Math.abs(n) > 1 ? "Grand Total" : "Total", e;
|
|
1661
|
-
const r = t.node.
|
|
1662
|
-
for (let
|
|
1663
|
-
const
|
|
1664
|
-
e[
|
|
1643
|
+
const r = t.node.getKeys();
|
|
1644
|
+
for (let t = 0; t < r.length; t++) {
|
|
1645
|
+
const n = r[t];
|
|
1646
|
+
e[t] = null === n ? 0 : n;
|
|
1665
1647
|
}
|
|
1666
1648
|
return e;
|
|
1667
1649
|
}
|
|
1668
|
-
},
|
|
1650
|
+
}, ke = (t, n, e) => null === t || null === n ? t === n ? 0 : null === t ? 1 : -1 : e * b.compare(t, n), qe = (t, n, e) => {
|
|
1669
1651
|
const r = B.isError(t), o = B.isError(n);
|
|
1670
1652
|
return r || o ? r && o ? 0 : r ? 1 : -1 : e * b.compare(t, n);
|
|
1671
|
-
},
|
|
1653
|
+
}, je = (t) => `Row Field ${t + 1}`, Ue = (t) => `Column Field ${t + 1}`, Ye = (t) => `Value ${t + 1}`, ze = (t) => {
|
|
1672
1654
|
const n = t.getColumnCount();
|
|
1673
1655
|
if (1 === n) return [t];
|
|
1674
1656
|
const e = t.getRowCount(), r = new Array(n);
|
|
@@ -1679,224 +1661,201 @@ var Ae = () => B.BuiltIn.Value, ve = (t, n) => {
|
|
|
1679
1661
|
colEnd: o
|
|
1680
1662
|
});
|
|
1681
1663
|
return r;
|
|
1682
|
-
},
|
|
1664
|
+
}, _e = (t) => t.slice({
|
|
1683
1665
|
rowStart: 1,
|
|
1684
1666
|
rowEnd: t.getRowCount() - 1,
|
|
1685
1667
|
colStart: 0,
|
|
1686
1668
|
colEnd: t.getColumnCount() - 1
|
|
1687
|
-
}), Ge =
|
|
1688
|
-
function
|
|
1689
|
-
if (t.getRowCount() !== n.getRowCount() ||
|
|
1690
|
-
const a =
|
|
1669
|
+
}), Ge = v({ GROUPBY: () => Ke });
|
|
1670
|
+
function Ke(t, n, e, r, o = 1, i, u, s = 0) {
|
|
1671
|
+
if (t.getRowCount() !== n.getRowCount() || Pe(n)) return B.BuiltIn.Value;
|
|
1672
|
+
const a = Ae(e, n.getColumnCount());
|
|
1691
1673
|
if (B.isError(a)) return a;
|
|
1692
|
-
const l =
|
|
1674
|
+
const l = De(r, n);
|
|
1693
1675
|
if (B.isError(l)) return l;
|
|
1694
1676
|
const f = t.getColumnCount(), c = o;
|
|
1695
|
-
if (!
|
|
1677
|
+
if (!Ve(c, f)) return B.BuiltIn.Value;
|
|
1696
1678
|
if (0 !== s && 1 !== s) return B.BuiltIn.Value;
|
|
1697
1679
|
const h = 1 === s;
|
|
1698
1680
|
if ((h || a.vertical) && Math.abs(c) > 1) return B.BuiltIn.Value;
|
|
1699
|
-
if (u &&
|
|
1700
|
-
const { measures: m, vertical: N } = a, g = n.getColumnCount(),
|
|
1701
|
-
if (B.isError(
|
|
1702
|
-
let
|
|
1681
|
+
if (u && !Oe(u, t.getRowCount())) return B.BuiltIn.Value;
|
|
1682
|
+
const { measures: m, vertical: N } = a, g = n.getColumnCount(), d = Te(i, f, N ? g : m.length);
|
|
1683
|
+
if (B.isError(d)) return d;
|
|
1684
|
+
let y = t, M = n, p = u, I = null, w = null;
|
|
1703
1685
|
if (l.hasHeader) {
|
|
1704
|
-
if (
|
|
1705
|
-
I =
|
|
1686
|
+
if (y.getRowCount() < 2) return B.BuiltIn.Value;
|
|
1687
|
+
I = Xe(y), w = Xe(M), y = _e(y), M = _e(M), p && (p = _e(p));
|
|
1706
1688
|
}
|
|
1707
|
-
const x =
|
|
1689
|
+
const x = b.createPivot(y, null, p ? { filter: p } : void 0);
|
|
1708
1690
|
if (0 === x.getRecordCount()) return B.BuiltIn.Value;
|
|
1709
|
-
const C =
|
|
1710
|
-
let n =
|
|
1711
|
-
return n || (n = m.map((n) => (N ? C.map((t, n) => n) : [n.column]).map((e) =>
|
|
1712
|
-
},
|
|
1691
|
+
const R = new $e(x.getRows(), f), C = ze(M), E = new Array(C.length), v = /* @__PURE__ */ new Map(), A = (t) => {
|
|
1692
|
+
let n = v.get(t);
|
|
1693
|
+
return n || (n = m.map((n) => (N ? C.map((t, n) => n) : [n.column]).map((e) => Le(x, n, C[e], t, void 0, ((t) => () => E[t] ??= x.getMembers(C[t]))(e)))), v.set(t, n), n);
|
|
1694
|
+
}, D = d.byValue, F = (t) => N ? A(t)[0][D.measure] : A(t)[D.measure][0], S = h ? We(R.sortLeaves(d, F), R.root, c) : R.lines(R.sortTree(d, F), c), V = [];
|
|
1713
1695
|
if (N) {
|
|
1714
|
-
l.show &&
|
|
1715
|
-
...
|
|
1696
|
+
l.show && V.push([
|
|
1697
|
+
...He(I, f),
|
|
1716
1698
|
"",
|
|
1717
|
-
...C.map((t, n) => w ? w[n] :
|
|
1699
|
+
...C.map((t, n) => w ? w[n] : Ye(n))
|
|
1718
1700
|
]);
|
|
1719
|
-
for (const t of
|
|
1720
|
-
const n =
|
|
1721
|
-
for (let t = 0; t < m.length; t++)
|
|
1701
|
+
for (const t of S) {
|
|
1702
|
+
const n = R.keyCells(t, c), e = A(t.node);
|
|
1703
|
+
for (let t = 0; t < m.length; t++) V.push([
|
|
1722
1704
|
...n,
|
|
1723
1705
|
m[t].label,
|
|
1724
1706
|
...e[t]
|
|
1725
1707
|
]);
|
|
1726
1708
|
}
|
|
1727
1709
|
} else {
|
|
1728
|
-
a.named &&
|
|
1729
|
-
for (const t of
|
|
1730
|
-
const n =
|
|
1710
|
+
a.named && V.push([...new Array(f).fill(""), ...m.map((t) => t.label)]), l.show && V.push([...He(I, f), ...m.map((t) => w ? w[t.column] : Ye(t.column))]);
|
|
1711
|
+
for (const t of S) {
|
|
1712
|
+
const n = R.keyCells(t, c);
|
|
1731
1713
|
for (const e of A(t.node)) n.push(e[0]);
|
|
1732
|
-
|
|
1714
|
+
V.push(n);
|
|
1733
1715
|
}
|
|
1734
1716
|
}
|
|
1735
|
-
return b.createRange(
|
|
1717
|
+
return b.createRange(V.length, V[0].length, V);
|
|
1736
1718
|
}
|
|
1737
|
-
var
|
|
1719
|
+
var Xe = (t) => {
|
|
1738
1720
|
const n = t.getColumnCount(), e = new Array(n);
|
|
1739
1721
|
for (let r = 0; r < n; r++) e[r] = t.getValueAt(0, r);
|
|
1740
1722
|
return e;
|
|
1741
|
-
},
|
|
1723
|
+
}, He = (t, n) => {
|
|
1742
1724
|
const e = new Array(n);
|
|
1743
|
-
for (let r = 0; r < n; r++) e[r] = t ? t[r] :
|
|
1725
|
+
for (let r = 0; r < n; r++) e[r] = t ? t[r] : je(r);
|
|
1744
1726
|
return e;
|
|
1745
|
-
},
|
|
1746
|
-
const
|
|
1727
|
+
}, We = (t, n, e) => {
|
|
1728
|
+
const r = t.map((t) => ({
|
|
1747
1729
|
kind: "group",
|
|
1748
1730
|
node: t
|
|
1749
1731
|
}));
|
|
1750
|
-
return
|
|
1732
|
+
return e > 0 ? r.push({
|
|
1751
1733
|
kind: "total",
|
|
1752
|
-
node:
|
|
1753
|
-
}) :
|
|
1734
|
+
node: n
|
|
1735
|
+
}) : e < 0 && r.unshift({
|
|
1754
1736
|
kind: "total",
|
|
1755
|
-
node:
|
|
1756
|
-
}),
|
|
1757
|
-
}, Ze =
|
|
1737
|
+
node: n
|
|
1738
|
+
}), r;
|
|
1739
|
+
}, Ze = v({ PIVOTBY: () => Qe });
|
|
1758
1740
|
function Qe(t, n, e, r, o, i = 1, u, s = 1, a, l, f = 0) {
|
|
1759
1741
|
const c = e.getRowCount();
|
|
1760
|
-
if (!t && !n ||
|
|
1742
|
+
if (!t && !n || Pe(e)) return B.BuiltIn.Value;
|
|
1761
1743
|
if (t && t.getRowCount() !== c) return B.BuiltIn.Value;
|
|
1762
1744
|
if (n && n.getRowCount() !== c) return B.BuiltIn.Value;
|
|
1763
|
-
const h =
|
|
1745
|
+
const h = Ae(r, e.getColumnCount());
|
|
1764
1746
|
if (B.isError(h)) return h;
|
|
1765
|
-
const m =
|
|
1747
|
+
const m = De(o, e);
|
|
1766
1748
|
if (B.isError(m)) return m;
|
|
1767
|
-
const N = t ? t.getColumnCount() : 0, g = n ? n.getColumnCount() : 0,
|
|
1768
|
-
if (t && !
|
|
1769
|
-
if (n && !
|
|
1770
|
-
if (h.vertical && Math.abs(
|
|
1749
|
+
const N = t ? t.getColumnCount() : 0, g = n ? n.getColumnCount() : 0, d = t ? i : 0, y = n ? s : 0;
|
|
1750
|
+
if (t && !Ve(d, N)) return B.BuiltIn.Value;
|
|
1751
|
+
if (n && !Ve(y, g)) return B.BuiltIn.Value;
|
|
1752
|
+
if (h.vertical && Math.abs(d) > 1) return B.BuiltIn.Value;
|
|
1771
1753
|
if (!Number.isInteger(f) || f < 0 || f > 4) return B.BuiltIn.Value;
|
|
1772
|
-
if (l &&
|
|
1773
|
-
const { measures:
|
|
1754
|
+
if (l && !Oe(l, c)) return B.BuiltIn.Value;
|
|
1755
|
+
const { measures: M, vertical: p } = h, I = e.getColumnCount(), w = p ? I : M.length, x = Te(u, N, w);
|
|
1774
1756
|
if (B.isError(x)) return x;
|
|
1775
|
-
const
|
|
1776
|
-
if (B.isError(
|
|
1777
|
-
let
|
|
1757
|
+
const R = Te(a, g, w);
|
|
1758
|
+
if (B.isError(R)) return R;
|
|
1759
|
+
let C = t, E = n, v = e, A = l, D = null, F = null, S = null;
|
|
1778
1760
|
if (m.hasHeader) {
|
|
1779
1761
|
if (c < 2) return B.BuiltIn.Value;
|
|
1780
|
-
|
|
1762
|
+
C && (D = Je(C), C = _e(C)), E && (F = Je(E), E = _e(E)), S = Je(v), v = _e(v), A && (A = _e(A));
|
|
1781
1763
|
}
|
|
1782
|
-
const V =
|
|
1783
|
-
if (0 ===
|
|
1784
|
-
const
|
|
1785
|
-
const o = O
|
|
1786
|
-
return
|
|
1764
|
+
const V = b.createPivot(C ?? null, E ?? null, A ? { filter: A } : void 0);
|
|
1765
|
+
if (0 === V.getRecordCount()) return B.BuiltIn.Value;
|
|
1766
|
+
const T = C ? new $e(V.getRows(), N) : null, P = E ? new $e(V.getColumns(), g) : null, O = ze(v), L = (t, n, e, r) => {
|
|
1767
|
+
const o = O[r];
|
|
1768
|
+
return Le(V, e, o, t, n, () => {
|
|
1787
1769
|
switch (f) {
|
|
1788
|
-
case 0: return
|
|
1789
|
-
case 1: return
|
|
1790
|
-
case 3: return
|
|
1791
|
-
case 4: return
|
|
1792
|
-
default: return
|
|
1770
|
+
case 0: return V.getMembers(o, void 0, n);
|
|
1771
|
+
case 1: return V.getMembers(o, t);
|
|
1772
|
+
case 3: return V.getMembers(o, t, n?.getParent() ?? void 0);
|
|
1773
|
+
case 4: return V.getMembers(o, t?.getParent() ?? void 0, n);
|
|
1774
|
+
default: return V.getMembers(o);
|
|
1793
1775
|
}
|
|
1794
|
-
})
|
|
1795
|
-
},
|
|
1776
|
+
});
|
|
1777
|
+
}, $ = (t) => (n, e) => p ? L(n, e, M[0], t.measure) : L(n, e, M[t.measure], M[t.measure].column), k = T ? T.lines(T.sortTree(x, (t) => $(x.byValue)(t, void 0)), d) : [{
|
|
1796
1778
|
kind: "total",
|
|
1797
|
-
node:
|
|
1798
|
-
}], q =
|
|
1799
|
-
|
|
1779
|
+
node: V.getRows().getRoot()
|
|
1780
|
+
}], q = P ? P.lines(P.sortTree(R, (t) => $(R.byValue)(void 0, t)), y) : [{
|
|
1781
|
+
kind: "total",
|
|
1782
|
+
node: V.getColumns().getRoot()
|
|
1783
|
+
}], j = [];
|
|
1784
|
+
for (const t of q) if (p) for (let n = 0; n < I; n++) j.push({
|
|
1800
1785
|
line: t,
|
|
1801
1786
|
measure: -1,
|
|
1802
1787
|
column: n
|
|
1803
1788
|
});
|
|
1804
|
-
else for (let n = 0; n <
|
|
1789
|
+
else for (let n = 0; n < M.length; n++) j.push({
|
|
1805
1790
|
line: t,
|
|
1806
1791
|
measure: n,
|
|
1807
|
-
column:
|
|
1792
|
+
column: M[n].column
|
|
1808
1793
|
});
|
|
1809
|
-
const U = !!
|
|
1810
|
-
if (m.show &&
|
|
1794
|
+
const U = !!P && !h.named && I > 1, Y = N + (p ? 1 : 0), z = () => new Array(Y).fill(""), _ = [];
|
|
1795
|
+
if (m.show && P) {
|
|
1811
1796
|
const t = [];
|
|
1812
|
-
for (let n = 0; n < g; n++) t.push(F ? String(F[n] ?? "") :
|
|
1813
|
-
|
|
1797
|
+
for (let n = 0; n < g; n++) t.push(F ? String(F[n] ?? "") : Ue(n));
|
|
1798
|
+
_.push([
|
|
1814
1799
|
...z(),
|
|
1815
1800
|
t.join(", "),
|
|
1816
1801
|
...new Array(j.length - 1).fill("")
|
|
1817
1802
|
]);
|
|
1818
1803
|
}
|
|
1819
|
-
if (
|
|
1820
|
-
const t = j.map((t) =>
|
|
1821
|
-
for (let n = 0; n < g; n++)
|
|
1804
|
+
if (P) {
|
|
1805
|
+
const t = j.map((t) => P.keyCells(t.line, y));
|
|
1806
|
+
for (let n = 0; n < g; n++) _.push([...z(), ...t.map((t) => t[n])]);
|
|
1822
1807
|
}
|
|
1823
|
-
if (h.named && !
|
|
1808
|
+
if (h.named && !p && _.push([...z(), ...j.map((t) => M[t.measure].label)]), m.show) {
|
|
1824
1809
|
const t = [];
|
|
1825
|
-
for (let n = 0; n < N; n++) t.push(D ? D[n] :
|
|
1826
|
-
|
|
1810
|
+
for (let n = 0; n < N; n++) t.push(D ? D[n] : je(n));
|
|
1811
|
+
p && t.push(""), _.push([...t, ...j.map((t) => S ? S[t.column] : Ye(t.column))]);
|
|
1827
1812
|
}
|
|
1828
|
-
const
|
|
1829
|
-
for (const t of
|
|
1830
|
-
const n =
|
|
1831
|
-
if (
|
|
1813
|
+
const G = (t, n) => j.map((e) => U && "group" !== e.line.kind ? "" : L(t, e.line.node, n ?? M[e.measure], e.column));
|
|
1814
|
+
for (const t of k) {
|
|
1815
|
+
const n = T ? T.keyCells(t, d) : [];
|
|
1816
|
+
if (p) for (const e of M) _.push([
|
|
1832
1817
|
...n,
|
|
1833
1818
|
e.label,
|
|
1834
|
-
...
|
|
1819
|
+
...G(t.node, e)
|
|
1835
1820
|
]);
|
|
1836
|
-
else
|
|
1821
|
+
else _.push([...n, ...G(t.node, null)]);
|
|
1837
1822
|
}
|
|
1838
|
-
return b.createRange(
|
|
1823
|
+
return b.createRange(_.length, _[0].length, _);
|
|
1839
1824
|
}
|
|
1840
1825
|
var Je = (t) => {
|
|
1841
1826
|
const n = t.getColumnCount(), e = new Array(n);
|
|
1842
1827
|
for (let r = 0; r < n; r++) e[r] = t.getValueAt(0, r);
|
|
1843
1828
|
return e;
|
|
1844
|
-
}, tr =
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
const r = this._columns[e];
|
|
1850
|
-
if (!t && !n) return (this._rows ?? this._cols).getMembers(r, null);
|
|
1851
|
-
if (!t) return this._cols.getMembers(r, n);
|
|
1852
|
-
if (!n) return this._rows.getMembers(r, t);
|
|
1853
|
-
const o = this._cross(t.level, n.level), i = o.groupOf.get(t.group * this._cols.groupings[n.level].getGroupCount() + n.group);
|
|
1854
|
-
return void 0 === i ? null : o.grouping.getMembers(r, [i]);
|
|
1855
|
-
}
|
|
1856
|
-
_cross(t, n) {
|
|
1857
|
-
const e = `${t},${n}`;
|
|
1858
|
-
let r = this._crossed.get(e);
|
|
1859
|
-
if (r) return r;
|
|
1860
|
-
const o = this._rows, i = this._cols, u = o.prefixes[t].concat(i.prefixes[n], x.Axis.Column), s = b.createGrouping(u, this._filter ? { filter: this._filter } : void 0), a = o.groupings[t], l = i.groupings[n], f = l.getGroupCount(), c = /* @__PURE__ */ new Map();
|
|
1861
|
-
for (let t = 0; t < s.getGroupCount(); t++) {
|
|
1862
|
-
const n = s.getFirstRecord(t);
|
|
1863
|
-
c.set(a.getGroup(n) * f + l.getGroup(n), t);
|
|
1864
|
-
}
|
|
1865
|
-
return r = {
|
|
1866
|
-
grouping: s,
|
|
1867
|
-
groupOf: c
|
|
1868
|
-
}, this._crossed.set(e, r), r;
|
|
1869
|
-
}
|
|
1870
|
-
}, nr = A({
|
|
1871
|
-
FORECAST_ETS: () => er,
|
|
1872
|
-
FORECAST_ETS_CONFINT: () => rr,
|
|
1873
|
-
FORECAST_ETS_SEASONALITY: () => or,
|
|
1874
|
-
FORECAST_ETS_STAT: () => ir
|
|
1829
|
+
}, tr = v({
|
|
1830
|
+
FORECAST_ETS: () => nr,
|
|
1831
|
+
FORECAST_ETS_CONFINT: () => er,
|
|
1832
|
+
FORECAST_ETS_SEASONALITY: () => rr,
|
|
1833
|
+
FORECAST_ETS_STAT: () => or
|
|
1875
1834
|
});
|
|
1876
|
-
function
|
|
1877
|
-
const u =
|
|
1835
|
+
function nr(t, n, e, r = 1, o = 1, i = 1) {
|
|
1836
|
+
const u = ar(n, e, o, i);
|
|
1878
1837
|
if (B.isError(u)) return u;
|
|
1879
1838
|
const { values: s, stepSize: a, lastTime: l, firstTime: f } = u;
|
|
1880
1839
|
if ((t - f) / a <= -.999) return B.BuiltIn.Num;
|
|
1881
1840
|
const c = (t - l) / a;
|
|
1882
1841
|
if (c > 2147483647) return B.BuiltIn.Num;
|
|
1883
|
-
const h =
|
|
1842
|
+
const h = cr(s, r);
|
|
1884
1843
|
if (B.isError(h)) return h;
|
|
1885
|
-
const { alpha: m, beta: N, gamma: g, period:
|
|
1886
|
-
let b =
|
|
1887
|
-
return
|
|
1844
|
+
const { alpha: m, beta: N, gamma: g, period: d, b0: y } = h, { L: M, T: p, S: I, finalIndex: w } = fr(s, m, N, g, d, y).finalState;
|
|
1845
|
+
let b = M + c * p;
|
|
1846
|
+
return d > 1 && (b += I[((w + Math.round(c)) % d + d) % d]), b;
|
|
1888
1847
|
}
|
|
1889
|
-
function
|
|
1848
|
+
function er(t, n, e, r = .95, o = 1, i = 1, u = 1) {
|
|
1890
1849
|
if (r < 0 || r >= 1) return B.BuiltIn.Num;
|
|
1891
|
-
const s =
|
|
1850
|
+
const s = ar(n, e, i, u);
|
|
1892
1851
|
if (B.isError(s)) return s;
|
|
1893
1852
|
const { values: a, stepSize: l, lastTime: f } = s;
|
|
1894
1853
|
if (t <= f) return B.BuiltIn.Num;
|
|
1895
1854
|
const c = Math.round((t - f) / l);
|
|
1896
1855
|
if (c > 2147483647) return B.BuiltIn.Num;
|
|
1897
|
-
const h =
|
|
1856
|
+
const h = cr(a, o);
|
|
1898
1857
|
if (B.isError(h)) return h;
|
|
1899
|
-
const { alpha: m, beta: N, gamma: g, period:
|
|
1858
|
+
const { alpha: m, beta: N, gamma: g, period: d, b0: y } = h, M = function(t, n, e, r, o, i) {
|
|
1900
1859
|
const u = t.length;
|
|
1901
1860
|
let s, a;
|
|
1902
1861
|
const l = new Array(Math.max(1, o)).fill(0);
|
|
@@ -1916,7 +1875,7 @@ function rr(t, n, e, r = .95, o = 1, i = 1, u = 1) {
|
|
|
1916
1875
|
o > 1 && (l[u] = r * (t[i] - N) + (1 - r) * c), s = N, a = g;
|
|
1917
1876
|
}
|
|
1918
1877
|
return Math.sqrt(f / u);
|
|
1919
|
-
}(a, m, N, g,
|
|
1878
|
+
}(a, m, N, g, d, y), p = function(t, n, e, r) {
|
|
1920
1879
|
const o = Math.abs(r);
|
|
1921
1880
|
if (0 === o) return 0;
|
|
1922
1881
|
let i = 0, u = 1;
|
|
@@ -1925,28 +1884,28 @@ function rr(t, n, e, r = .95, o = 1, i = 1, u = 1) {
|
|
|
1925
1884
|
u = u + t + (e > 1 && r % e === 0 ? n : 0);
|
|
1926
1885
|
}
|
|
1927
1886
|
return i;
|
|
1928
|
-
}(m, g,
|
|
1887
|
+
}(m, g, d, c);
|
|
1929
1888
|
return function(t) {
|
|
1930
1889
|
const n = (1 + t) / 2, e = b.getFunction("NORM.S.INV");
|
|
1931
1890
|
if (e) return e.execute(n);
|
|
1932
1891
|
const r = Math.sqrt(-2 * Math.log(1 - n));
|
|
1933
1892
|
return r - (2.515517 + .802853 * r + .010328 * r * r) / (1 + 1.432788 * r + .189269 * r * r + .001308 * r * r * r);
|
|
1934
|
-
}(r) *
|
|
1893
|
+
}(r) * M * Math.sqrt(p);
|
|
1935
1894
|
}
|
|
1936
|
-
function
|
|
1937
|
-
const o =
|
|
1895
|
+
function rr(t, n, e = 1, r = 1) {
|
|
1896
|
+
const o = ar(t, n, e, r);
|
|
1938
1897
|
if (B.isError(o)) return o;
|
|
1939
1898
|
const { values: i } = o;
|
|
1940
|
-
return i.length < 4 ? 0 :
|
|
1899
|
+
return i.length < 4 ? 0 : lr(i);
|
|
1941
1900
|
}
|
|
1942
|
-
function
|
|
1943
|
-
const u =
|
|
1901
|
+
function or(t, n, e, r = 1, o = 1, i = 1) {
|
|
1902
|
+
const u = ur(e);
|
|
1944
1903
|
if (null === u || u < 1 || u > 8) return B.BuiltIn.Num;
|
|
1945
|
-
const s =
|
|
1904
|
+
const s = ar(t, n, o, i);
|
|
1946
1905
|
if (B.isError(s)) return s;
|
|
1947
1906
|
const { values: a, stepSize: l } = s;
|
|
1948
1907
|
if (8 === u) return l;
|
|
1949
|
-
const f =
|
|
1908
|
+
const f = cr(a, r);
|
|
1950
1909
|
if (B.isError(f)) return f;
|
|
1951
1910
|
const { alpha: c, beta: h, gamma: m, period: N, b0: g } = f;
|
|
1952
1911
|
switch (u) {
|
|
@@ -1970,10 +1929,10 @@ function ir(t, n, e, r = 1, o = 1, i = 1) {
|
|
|
1970
1929
|
for (let n = 1; n < u; n++) m += Math.abs(t[n] - t[n - 1]);
|
|
1971
1930
|
const N = m / (u - 1);
|
|
1972
1931
|
for (let i = 0; i < u; i++) {
|
|
1973
|
-
const u = t[i], m = o > 1 ? i % o : 0, N = o > 1 ? l[m] : 0, g = s + a + N,
|
|
1974
|
-
f += Math.abs(
|
|
1975
|
-
const
|
|
1976
|
-
o > 1 && (l[m] = r * (u -
|
|
1932
|
+
const u = t[i], m = o > 1 ? i % o : 0, N = o > 1 ? l[m] : 0, g = s + a + N, d = u - g;
|
|
1933
|
+
f += Math.abs(d), c += d * d, h += Math.abs(d) / ((Math.abs(u) + Math.abs(g)) / 2 || 1);
|
|
1934
|
+
const y = n * (u - N) + (1 - n) * (s + a), M = e * (y - s) + (1 - e) * a;
|
|
1935
|
+
o > 1 && (l[m] = r * (u - y) + (1 - r) * N), s = y, a = M;
|
|
1977
1936
|
}
|
|
1978
1937
|
return {
|
|
1979
1938
|
mae: f / u,
|
|
@@ -1990,7 +1949,7 @@ function ir(t, n, e, r = 1, o = 1, i = 1) {
|
|
|
1990
1949
|
}
|
|
1991
1950
|
return B.BuiltIn.Num;
|
|
1992
1951
|
}
|
|
1993
|
-
function
|
|
1952
|
+
function ir(t, n) {
|
|
1994
1953
|
const e = t.map((t) => t.value);
|
|
1995
1954
|
switch (n) {
|
|
1996
1955
|
case 1: return e.reduce((t, n) => t + n, 0) / e.length;
|
|
@@ -2006,14 +1965,14 @@ function ur(t, n) {
|
|
|
2006
1965
|
default: return e.reduce((t, n) => t + n, 0);
|
|
2007
1966
|
}
|
|
2008
1967
|
}
|
|
2009
|
-
function
|
|
1968
|
+
function ur(t) {
|
|
2010
1969
|
return Number.isInteger(t) ? t : null;
|
|
2011
1970
|
}
|
|
2012
|
-
var
|
|
2013
|
-
function
|
|
2014
|
-
const o =
|
|
1971
|
+
var sr = 8784;
|
|
1972
|
+
function ar(t, n, e, r) {
|
|
1973
|
+
const o = ur(e);
|
|
2015
1974
|
if (0 !== o && 1 !== o) return B.BuiltIn.Num;
|
|
2016
|
-
const i =
|
|
1975
|
+
const i = ur(r);
|
|
2017
1976
|
if (null === i || i < 1 || i > 7) return B.BuiltIn.Num;
|
|
2018
1977
|
const u = t.flatten(), s = n.flatten();
|
|
2019
1978
|
if (u.getRowCount() !== s.getRowCount()) return B.BuiltIn.NA;
|
|
@@ -2032,12 +1991,12 @@ function lr(t, n, e, r) {
|
|
|
2032
1991
|
const n = a[t];
|
|
2033
1992
|
n.time === a[t - 1].time ? f.push(n) : (l.push({
|
|
2034
1993
|
time: f[0].time,
|
|
2035
|
-
value:
|
|
1994
|
+
value: ir(f, i)
|
|
2036
1995
|
}), f = [n]);
|
|
2037
1996
|
}
|
|
2038
1997
|
if (l.push({
|
|
2039
1998
|
time: f[0].time,
|
|
2040
|
-
value:
|
|
1999
|
+
value: ir(f, i)
|
|
2041
2000
|
}), l.length < 2) return B.BuiltIn.Div0;
|
|
2042
2001
|
const c = [];
|
|
2043
2002
|
for (let t = 1; t < l.length; t++) c.push(l[t].time - l[t - 1].time);
|
|
@@ -2064,7 +2023,7 @@ function lr(t, n, e, r) {
|
|
|
2064
2023
|
firstTime: l[0].time
|
|
2065
2024
|
};
|
|
2066
2025
|
}
|
|
2067
|
-
function
|
|
2026
|
+
function lr(t) {
|
|
2068
2027
|
const n = t.length;
|
|
2069
2028
|
if (n < 4) return 0;
|
|
2070
2029
|
const e = t.reduce((t, n) => t + n, 0) / n;
|
|
@@ -2081,7 +2040,7 @@ function fr(t) {
|
|
|
2081
2040
|
}
|
|
2082
2041
|
return i;
|
|
2083
2042
|
}
|
|
2084
|
-
function
|
|
2043
|
+
function fr(t, n, e, r, o, i) {
|
|
2085
2044
|
const u = t.length;
|
|
2086
2045
|
let s, a;
|
|
2087
2046
|
if (o > 1 && u >= 2 * o) {
|
|
@@ -2103,8 +2062,8 @@ function cr(t, n, e, r, o, i) {
|
|
|
2103
2062
|
for (let i = 0; i < u; i++) {
|
|
2104
2063
|
const u = t[i], h = o > 1 ? i % o : 0, m = o > 1 ? l[h] : 0, N = u - (s + a + m);
|
|
2105
2064
|
f += N * N;
|
|
2106
|
-
const g = n * (u - m) + (1 - n) * (s + a),
|
|
2107
|
-
o > 1 && (l[h] = r * (u - g) + (1 - r) * m), s = g, a =
|
|
2065
|
+
const g = n * (u - m) + (1 - n) * (s + a), d = e * (g - s) + (1 - e) * a;
|
|
2066
|
+
o > 1 && (l[h] = r * (u - g) + (1 - r) * m), s = g, a = d, c = h;
|
|
2108
2067
|
}
|
|
2109
2068
|
return {
|
|
2110
2069
|
mse: f / u,
|
|
@@ -2116,16 +2075,16 @@ function cr(t, n, e, r, o, i) {
|
|
|
2116
2075
|
}
|
|
2117
2076
|
};
|
|
2118
2077
|
}
|
|
2119
|
-
function
|
|
2120
|
-
const e =
|
|
2121
|
-
if (null === e || e < 0 || e >
|
|
2078
|
+
function cr(t, n) {
|
|
2079
|
+
const e = ur(n);
|
|
2080
|
+
if (null === e || e < 0 || e > sr) return B.BuiltIn.Num;
|
|
2122
2081
|
let r = 1;
|
|
2123
|
-
1 === e ? (r =
|
|
2082
|
+
1 === e ? (r = lr(t), r <= 1 && (r = 1)) : e > 1 && (r = e), r > 1 && t.length < 2 * r && (r = 1);
|
|
2124
2083
|
const o = t.length;
|
|
2125
2084
|
if (1 === r) {
|
|
2126
|
-
const n = Math.max(1, Math.floor(o / 4)), e =
|
|
2085
|
+
const n = Math.max(1, Math.floor(o / 4)), e = mr((n) => {
|
|
2127
2086
|
const e = Math.max(.001, Math.min(.999, n[0])), r = Math.max(.001, Math.min(.999, n[1])), o = n[2];
|
|
2128
|
-
return
|
|
2087
|
+
return fr(t, e, r, 0, 1, o).mse;
|
|
2129
2088
|
}, [
|
|
2130
2089
|
.9,
|
|
2131
2090
|
.1,
|
|
@@ -2139,7 +2098,7 @@ function hr(t, n) {
|
|
|
2139
2098
|
b0: e[2]
|
|
2140
2099
|
};
|
|
2141
2100
|
}
|
|
2142
|
-
const i =
|
|
2101
|
+
const i = mr((n) => fr(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, [
|
|
2143
2102
|
.9,
|
|
2144
2103
|
.1,
|
|
2145
2104
|
.1
|
|
@@ -2152,10 +2111,10 @@ function hr(t, n) {
|
|
|
2152
2111
|
b0: 0
|
|
2153
2112
|
};
|
|
2154
2113
|
}
|
|
2155
|
-
function
|
|
2114
|
+
function hr(t, n, e, r, o) {
|
|
2156
2115
|
for (let i = 0; i < t.length; ++i) t[i] = n * e[i] + r * o[i];
|
|
2157
2116
|
}
|
|
2158
|
-
function
|
|
2117
|
+
function mr(t, n, e) {
|
|
2159
2118
|
const r = (e = e || {}).maxIterations || 200 * n.length, o = e.nonZeroDelta || 1.05, i = e.zeroDelta || .001, u = e.minErrorDelta || 1e-6, s = e.minTolerance || 1e-5, a = 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;
|
|
2160
2119
|
let h;
|
|
2161
2120
|
const m = n.length, N = new Array(m + 1);
|
|
@@ -2168,9 +2127,9 @@ function Nr(t, n, e) {
|
|
|
2168
2127
|
for (let n = 0; n < t.length; n++) N[m][n] = t[n];
|
|
2169
2128
|
N[m].fx = t.fx;
|
|
2170
2129
|
}
|
|
2171
|
-
const
|
|
2130
|
+
const d = (t, n) => t.fx - n.fx, y = n.slice(), M = n.slice(), p = n.slice(), I = n.slice();
|
|
2172
2131
|
for (let n = 0; n < r; ++n) {
|
|
2173
|
-
if (N.sort(
|
|
2132
|
+
if (N.sort(d), e.history) {
|
|
2174
2133
|
const t = N.map((t) => {
|
|
2175
2134
|
const n = t.slice();
|
|
2176
2135
|
return n.fx = t.fx, n.id = t.id, n;
|
|
@@ -2185,34 +2144,34 @@ function Nr(t, n, e) {
|
|
|
2185
2144
|
for (let t = 0; t < m; ++t) h = Math.max(h, Math.abs(N[0][t] - N[1][t]));
|
|
2186
2145
|
if (Math.abs(N[0].fx - N[m].fx) < u && h < s) break;
|
|
2187
2146
|
for (let t = 0; t < m; ++t) {
|
|
2188
|
-
|
|
2189
|
-
for (let n = 0; n < m; ++n)
|
|
2190
|
-
|
|
2147
|
+
y[t] = 0;
|
|
2148
|
+
for (let n = 0; n < m; ++n) y[t] += N[n][t];
|
|
2149
|
+
y[t] /= m;
|
|
2191
2150
|
}
|
|
2192
2151
|
const n = N[m];
|
|
2193
|
-
if (
|
|
2194
|
-
else if (
|
|
2152
|
+
if (hr(M, 1 + a, y, -a, n), M.fx = t(M), M.fx < N[0].fx) hr(I, 1 + l, y, -l, n), I.fx = t(I), g(I.fx < M.fx ? I : M);
|
|
2153
|
+
else if (M.fx >= N[m - 1].fx) {
|
|
2195
2154
|
let e = !1;
|
|
2196
|
-
if (
|
|
2155
|
+
if (M.fx > n.fx ? (hr(p, 1 + f, y, -f, n), p.fx = t(p), p.fx < n.fx ? g(p) : e = !0) : (hr(p, 1 - f * a, y, f * a, n), p.fx = t(p), p.fx < M.fx ? g(p) : e = !0), e) {
|
|
2197
2156
|
if (c >= 1) break;
|
|
2198
|
-
for (let n = 1; n < N.length; ++n)
|
|
2157
|
+
for (let n = 1; n < N.length; ++n) hr(N[n], 1 - c, N[0], c, N[n]), N[n].fx = t(N[n]);
|
|
2199
2158
|
}
|
|
2200
|
-
} else g(
|
|
2159
|
+
} else g(M);
|
|
2201
2160
|
}
|
|
2202
|
-
return N.sort(
|
|
2161
|
+
return N.sort(d), {
|
|
2203
2162
|
fx: N[0].fx,
|
|
2204
2163
|
x: N[0]
|
|
2205
2164
|
};
|
|
2206
2165
|
}
|
|
2207
|
-
var
|
|
2208
|
-
type:
|
|
2166
|
+
var Nr = Object.freeze({ includeEmpty: !0 }), gr = (Object.freeze({ axis: x.Axis.Column }), Object.freeze({ axis: x.Axis.Row }), Object.freeze({
|
|
2167
|
+
type: R.Number,
|
|
2209
2168
|
axis: x.Axis.Row
|
|
2210
2169
|
})), dr = (t, n, e = !1) => {
|
|
2211
2170
|
const r = t.getRowCount(), o = t.getColumnCount(), i = r * o;
|
|
2212
2171
|
if (0 === i) throw B.BuiltIn.Value;
|
|
2213
2172
|
const u = 1 === r, s = r > 1 && o > 1;
|
|
2214
2173
|
if (!n || 0 === n.size) {
|
|
2215
|
-
const n =
|
|
2174
|
+
const n = br(t, i, e), a = new Array(i);
|
|
2216
2175
|
for (let t = 0; t < i; t++) a[t] = [t + 1];
|
|
2217
2176
|
return {
|
|
2218
2177
|
ys: n,
|
|
@@ -2227,7 +2186,7 @@ var gr = Object.freeze({ includeEmpty: !0 }), pr = (Object.freeze({ axis: x.Axis
|
|
|
2227
2186
|
const a = n.getRowCount(), l = n.getColumnCount();
|
|
2228
2187
|
if (s) {
|
|
2229
2188
|
if (a !== r || l !== o) throw B.BuiltIn.Ref;
|
|
2230
|
-
const f =
|
|
2189
|
+
const f = br(t, i, e), c = br(n, i), h = new Array(i);
|
|
2231
2190
|
for (let t = 0; t < i; t++) h[t] = [c[t]];
|
|
2232
2191
|
return {
|
|
2233
2192
|
ys: f,
|
|
@@ -2242,8 +2201,8 @@ var gr = Object.freeze({ includeEmpty: !0 }), pr = (Object.freeze({ axis: x.Axis
|
|
|
2242
2201
|
if ((u ? l : a) !== i) throw B.BuiltIn.Ref;
|
|
2243
2202
|
const f = u ? a : l;
|
|
2244
2203
|
return {
|
|
2245
|
-
ys:
|
|
2246
|
-
xs:
|
|
2204
|
+
ys: br(t, i, e),
|
|
2205
|
+
xs: Br(n, i, f, u),
|
|
2247
2206
|
k: f,
|
|
2248
2207
|
isRowOriented: u,
|
|
2249
2208
|
isRectangularY: s,
|
|
@@ -2275,14 +2234,14 @@ var gr = Object.freeze({ includeEmpty: !0 }), pr = (Object.freeze({ axis: x.Axis
|
|
|
2275
2234
|
throw B.BuiltIn.Value;
|
|
2276
2235
|
}
|
|
2277
2236
|
throw B.BuiltIn.Value;
|
|
2278
|
-
},
|
|
2237
|
+
}, pr = (t, n, e) => {
|
|
2279
2238
|
let r, o, i;
|
|
2280
2239
|
if (n && n.size > 0) {
|
|
2281
2240
|
const e = ((t, n) => {
|
|
2282
2241
|
const e = t.getRowCount(), r = t.getColumnCount(), o = e * r;
|
|
2283
2242
|
if (0 === o) throw B.BuiltIn.Ref;
|
|
2284
2243
|
if (1 === n.k) {
|
|
2285
|
-
const n =
|
|
2244
|
+
const n = br(t, o), i = new Array(o);
|
|
2286
2245
|
for (let t = 0; t < o; t++) i[t] = [n[t]];
|
|
2287
2246
|
return {
|
|
2288
2247
|
xs: i,
|
|
@@ -2293,7 +2252,7 @@ var gr = Object.freeze({ includeEmpty: !0 }), pr = (Object.freeze({ axis: x.Axis
|
|
|
2293
2252
|
const i = n.isRowOriented ? r : e;
|
|
2294
2253
|
if ((n.isRowOriented ? e : r) !== n.k) throw B.BuiltIn.Ref;
|
|
2295
2254
|
return {
|
|
2296
|
-
xs:
|
|
2255
|
+
xs: Br(t, i, n.k, n.isRowOriented),
|
|
2297
2256
|
rows: n.isRowOriented ? 1 : i,
|
|
2298
2257
|
cols: n.isRowOriented ? i : 1
|
|
2299
2258
|
};
|
|
@@ -2308,7 +2267,7 @@ var gr = Object.freeze({ includeEmpty: !0 }), pr = (Object.freeze({ axis: x.Axis
|
|
|
2308
2267
|
u[t] = n;
|
|
2309
2268
|
}
|
|
2310
2269
|
return u;
|
|
2311
|
-
},
|
|
2270
|
+
}, Ir = (t, n, e) => {
|
|
2312
2271
|
const r = t.length, o = n.length > 0 ? n[0].length : 0, i = [], u = [];
|
|
2313
2272
|
e && (i.push(new Array(r).fill(1)), u.push(o));
|
|
2314
2273
|
for (let t = o - 1; t >= 0; t--) {
|
|
@@ -2318,20 +2277,20 @@ var gr = Object.freeze({ includeEmpty: !0 }), pr = (Object.freeze({ axis: x.Axis
|
|
|
2318
2277
|
}
|
|
2319
2278
|
const s = [], a = [], l = [];
|
|
2320
2279
|
for (let t = 0; t < i.length; t++) {
|
|
2321
|
-
const n = i[t].slice(), e = Math.sqrt(
|
|
2280
|
+
const n = i[t].slice(), e = Math.sqrt(xr(n, n)), o = new Array(a.length).fill(0);
|
|
2322
2281
|
for (let t = 0; t < 2; t++) for (let t = 0; t < a.length; t++) {
|
|
2323
|
-
const e =
|
|
2282
|
+
const e = xr(a[t], n);
|
|
2324
2283
|
for (let o = 0; o < r; o++) n[o] -= e * a[t][o];
|
|
2325
2284
|
o[t] += e;
|
|
2326
2285
|
}
|
|
2327
|
-
const u = Math.sqrt(
|
|
2286
|
+
const u = Math.sqrt(xr(n, n));
|
|
2328
2287
|
if (!(u <= 1e-10 * (e || 1))) {
|
|
2329
2288
|
for (let t = 0; t < r; t++) n[t] /= u;
|
|
2330
2289
|
o.push(u), a.push(n), l.push(o), s.push(t);
|
|
2331
2290
|
}
|
|
2332
2291
|
}
|
|
2333
2292
|
const f = s.length, c = new Array(f);
|
|
2334
|
-
for (let n = 0; n < f; n++) c[n] =
|
|
2293
|
+
for (let n = 0; n < f; n++) c[n] = xr(a[n], t);
|
|
2335
2294
|
const h = new Array(f).fill(0);
|
|
2336
2295
|
for (let t = f - 1; t >= 0; t--) {
|
|
2337
2296
|
let n = c[t];
|
|
@@ -2355,25 +2314,25 @@ var gr = Object.freeze({ includeEmpty: !0 }), pr = (Object.freeze({ axis: x.Axis
|
|
|
2355
2314
|
for (let n = t; n < f; n++) e += m[t][n] * m[t][n];
|
|
2356
2315
|
g[n] = e;
|
|
2357
2316
|
}
|
|
2358
|
-
const
|
|
2317
|
+
const d = (t) => {
|
|
2359
2318
|
let n = e ? N[o] : 0;
|
|
2360
2319
|
for (let e = 0; e < o; e++) n += N[o - 1 - e] * t[e];
|
|
2361
2320
|
return n;
|
|
2362
2321
|
};
|
|
2363
|
-
let
|
|
2322
|
+
let y = 0;
|
|
2364
2323
|
for (let e = 0; e < r; e++) {
|
|
2365
|
-
const r = t[e] -
|
|
2366
|
-
|
|
2324
|
+
const r = t[e] - d(n[e] ?? []);
|
|
2325
|
+
y += r * r;
|
|
2367
2326
|
}
|
|
2368
|
-
let
|
|
2327
|
+
let M = 0;
|
|
2369
2328
|
if (e) {
|
|
2370
2329
|
let n = 0;
|
|
2371
2330
|
for (let e = 0; e < r; e++) n += t[e];
|
|
2372
2331
|
n /= r;
|
|
2373
|
-
for (let e = 0; e < r; e++)
|
|
2374
|
-
} else for (let n = 0; n < r; n++)
|
|
2375
|
-
e && 0 ===
|
|
2376
|
-
const
|
|
2332
|
+
for (let e = 0; e < r; e++) M += (t[e] - n) * (t[e] - n);
|
|
2333
|
+
} else for (let n = 0; n < r; n++) M += t[n] * t[n];
|
|
2334
|
+
e && 0 === M && (y = 0);
|
|
2335
|
+
const p = M - y, I = e ? f - 1 : f, w = r - I - (e ? 1 : 0), b = w > 0 ? y / w : 0, B = w > 0 ? Math.sqrt(b) : 0, x = new Array(o + 1).fill(0);
|
|
2377
2336
|
for (let t = 0; t <= o; t++) x[t] = B * Math.sqrt(Math.max(g[t], 0));
|
|
2378
2337
|
return {
|
|
2379
2338
|
coefficients: N,
|
|
@@ -2381,13 +2340,13 @@ var gr = Object.freeze({ includeEmpty: !0 }), pr = (Object.freeze({ axis: x.Axis
|
|
|
2381
2340
|
kEffective: I,
|
|
2382
2341
|
df: w,
|
|
2383
2342
|
sey: B,
|
|
2384
|
-
r2: 0 ===
|
|
2385
|
-
f: w > 0 && I > 0 && 0 !== b ?
|
|
2386
|
-
ssReg:
|
|
2387
|
-
ssResid:
|
|
2388
|
-
predict:
|
|
2343
|
+
r2: 0 === M ? 1 : p / M,
|
|
2344
|
+
f: w > 0 && I > 0 && 0 !== b ? p / I / b : null,
|
|
2345
|
+
ssReg: p,
|
|
2346
|
+
ssResid: y,
|
|
2347
|
+
predict: d
|
|
2389
2348
|
};
|
|
2390
|
-
},
|
|
2349
|
+
}, wr = (t, n, e) => {
|
|
2391
2350
|
const r = n.length, o = B.BuiltIn.NA, i = (t, n) => {
|
|
2392
2351
|
const e = new Array(r).fill(o);
|
|
2393
2352
|
return e[0] = t, r > 1 && (e[1] = n), e;
|
|
@@ -2399,10 +2358,10 @@ var gr = Object.freeze({ includeEmpty: !0 }), pr = (Object.freeze({ axis: x.Axis
|
|
|
2399
2358
|
i(t.f ?? B.BuiltIn.Num, t.df),
|
|
2400
2359
|
i(t.ssReg, t.ssResid)
|
|
2401
2360
|
];
|
|
2402
|
-
},
|
|
2361
|
+
}, br = (t, n, e = !1) => {
|
|
2403
2362
|
const r = new Array(n);
|
|
2404
2363
|
let o = 0;
|
|
2405
|
-
for (const n of t.values(
|
|
2364
|
+
for (const n of t.values(Nr)) {
|
|
2406
2365
|
if ("number" != typeof n) throw B.BuiltIn.Value;
|
|
2407
2366
|
if (e) {
|
|
2408
2367
|
if (n <= 0) throw B.BuiltIn.Num;
|
|
@@ -2410,77 +2369,77 @@ var gr = Object.freeze({ includeEmpty: !0 }), pr = (Object.freeze({ axis: x.Axis
|
|
|
2410
2369
|
} else r[o++] = n;
|
|
2411
2370
|
}
|
|
2412
2371
|
return r;
|
|
2413
|
-
},
|
|
2414
|
-
const o =
|
|
2372
|
+
}, Br = (t, n, e, r) => {
|
|
2373
|
+
const o = br(t, n * e), i = new Array(n);
|
|
2415
2374
|
for (let t = 0; t < n; t++) {
|
|
2416
2375
|
const u = new Array(e);
|
|
2417
2376
|
for (let i = 0; i < e; i++) u[i] = r ? o[i * n + t] : o[t * e + i];
|
|
2418
2377
|
i[t] = u;
|
|
2419
2378
|
}
|
|
2420
2379
|
return i;
|
|
2421
|
-
},
|
|
2380
|
+
}, xr = (t, n) => {
|
|
2422
2381
|
let e = 0;
|
|
2423
2382
|
for (let r = 0; r < t.length; r++) e += t[r] * n[r];
|
|
2424
2383
|
return e;
|
|
2425
|
-
}, Rr =
|
|
2426
|
-
GROWTH: () =>
|
|
2427
|
-
LINEST: () =>
|
|
2384
|
+
}, Rr = v({
|
|
2385
|
+
GROWTH: () => Dr,
|
|
2386
|
+
LINEST: () => Er,
|
|
2428
2387
|
LOGEST: () => vr,
|
|
2429
|
-
TREND: () =>
|
|
2430
|
-
}),
|
|
2388
|
+
TREND: () => Ar
|
|
2389
|
+
}), Cr = () => {
|
|
2431
2390
|
if (b.getArgs().getAreaCountAt(1) > 1) throw B.BuiltIn.Ref;
|
|
2432
2391
|
};
|
|
2433
|
-
function
|
|
2434
|
-
|
|
2392
|
+
function Er(t, n, e, r) {
|
|
2393
|
+
Cr();
|
|
2435
2394
|
const o = dr(t, n);
|
|
2436
2395
|
return yr(e, !0, (t) => {
|
|
2437
|
-
const n =
|
|
2438
|
-
return yr(r, !1, (e) => e ?
|
|
2396
|
+
const n = Ir(o.ys, o.xs, t);
|
|
2397
|
+
return yr(r, !1, (e) => e ? wr(n, n.coefficients, t) : [n.coefficients.slice()]);
|
|
2439
2398
|
});
|
|
2440
2399
|
}
|
|
2441
2400
|
function vr(t, n, e, r) {
|
|
2442
|
-
|
|
2401
|
+
Cr();
|
|
2443
2402
|
const o = dr(t, n, !0);
|
|
2444
2403
|
return yr(e, !0, (t) => {
|
|
2445
|
-
const n =
|
|
2446
|
-
return yr(r, !1, (r) => r ?
|
|
2404
|
+
const n = Ir(o.ys, o.xs, t), e = Fr(n);
|
|
2405
|
+
return yr(r, !1, (r) => r ? wr(n, e, t) : [e]);
|
|
2447
2406
|
});
|
|
2448
2407
|
}
|
|
2449
|
-
function
|
|
2450
|
-
|
|
2408
|
+
function Ar(t, n, e, r) {
|
|
2409
|
+
Cr();
|
|
2451
2410
|
const o = dr(t, n);
|
|
2452
2411
|
return yr(r, !0, (t) => {
|
|
2453
|
-
const n =
|
|
2454
|
-
return
|
|
2412
|
+
const n = Ir(o.ys, o.xs, t);
|
|
2413
|
+
return pr(o, e, n.predict);
|
|
2455
2414
|
});
|
|
2456
2415
|
}
|
|
2457
|
-
function
|
|
2458
|
-
|
|
2416
|
+
function Dr(t, n, e, r) {
|
|
2417
|
+
Cr();
|
|
2459
2418
|
const o = dr(t, n, !0);
|
|
2460
2419
|
return yr(r, !0, (t) => {
|
|
2461
|
-
const n =
|
|
2462
|
-
return
|
|
2420
|
+
const n = Ir(o.ys, o.xs, t).coefficients.map(Math.exp), r = o.k;
|
|
2421
|
+
return pr(o, e, (t) => {
|
|
2463
2422
|
let e = n[r];
|
|
2464
2423
|
for (let o = 0; o < r; o++) e *= n[r - 1 - o] ** t[o];
|
|
2465
2424
|
return Number.isFinite(e) ? e : B.BuiltIn.Num;
|
|
2466
2425
|
});
|
|
2467
2426
|
});
|
|
2468
2427
|
}
|
|
2469
|
-
var
|
|
2428
|
+
var Fr = (t) => t.coefficients.map((t) => {
|
|
2470
2429
|
const n = Math.exp(t);
|
|
2471
2430
|
return Number.isFinite(n) ? n : B.BuiltIn.Num;
|
|
2472
|
-
}),
|
|
2473
|
-
TTEST: () =>
|
|
2474
|
-
T_TEST: () =>
|
|
2475
|
-
}),
|
|
2431
|
+
}), Sr = v({
|
|
2432
|
+
TTEST: () => Tr,
|
|
2433
|
+
T_TEST: () => Pr
|
|
2434
|
+
}), Vr = (t) => {
|
|
2476
2435
|
const n = t.getCode();
|
|
2477
2436
|
return n === B.Code.Null || n === B.Code.GettingData ? B.BuiltIn.Num : t;
|
|
2478
2437
|
};
|
|
2479
|
-
function
|
|
2480
|
-
return
|
|
2438
|
+
function Tr(t, n, e, r) {
|
|
2439
|
+
return Pr(t, n, e, r);
|
|
2481
2440
|
}
|
|
2482
|
-
function
|
|
2483
|
-
if (e = Math.floor(e +
|
|
2441
|
+
function Pr(t, n, e, r) {
|
|
2442
|
+
if (e = Math.floor(e + Or), r = Math.floor(r + Or), 1 !== e && 2 !== e || r < 1 || r > 3) return NaN;
|
|
2484
2443
|
for (const e of [t, n]) if (1 === e.size && e.isIReferenceRange) {
|
|
2485
2444
|
if (e.hasError()) throw e.firstError();
|
|
2486
2445
|
if (e.entries({ includeEmpty: !1 }).next().done) throw B.BuiltIn.Value;
|
|
@@ -2491,14 +2450,14 @@ function Or(t, n, e, r) {
|
|
|
2491
2450
|
if (e.rows * e.columns !== r.rows * r.columns) throw B.BuiltIn.NA;
|
|
2492
2451
|
const i = [], u = [];
|
|
2493
2452
|
for (const [[e, r]] of t.flatten().alignValues([n.flatten()])) {
|
|
2494
|
-
if (B.isError(e)) throw
|
|
2495
|
-
if (B.isError(r)) throw
|
|
2453
|
+
if (B.isError(e)) throw Vr(e);
|
|
2454
|
+
if (B.isError(r)) throw Vr(r);
|
|
2496
2455
|
"number" == typeof e && "number" == typeof r && (i.push(e), u.push(r));
|
|
2497
2456
|
}
|
|
2498
2457
|
if (i.length < 2) throw B.BuiltIn.Div0;
|
|
2499
2458
|
o = function(t, n) {
|
|
2500
2459
|
const e = t.length;
|
|
2501
|
-
if (!Number.isFinite(
|
|
2460
|
+
if (!Number.isFinite(kr(t)) || !Number.isFinite(kr(n))) return { error: B.BuiltIn.Num };
|
|
2502
2461
|
let r = 0;
|
|
2503
2462
|
for (let o = 0; o < e; o++) r += t[o] - n[o];
|
|
2504
2463
|
const o = r / e;
|
|
@@ -2513,9 +2472,9 @@ function Or(t, n, e, r) {
|
|
|
2513
2472
|
};
|
|
2514
2473
|
}(i, u);
|
|
2515
2474
|
} else {
|
|
2516
|
-
if (t.hasError()) throw
|
|
2517
|
-
if (n.hasError()) throw
|
|
2518
|
-
const e = t.getValuesFlat(
|
|
2475
|
+
if (t.hasError()) throw Vr(t.firstError());
|
|
2476
|
+
if (n.hasError()) throw Vr(n.firstError());
|
|
2477
|
+
const e = t.getValuesFlat(gr), i = n.getValuesFlat(gr);
|
|
2519
2478
|
if (e.length < 2 || i.length < 2) throw B.BuiltIn.Div0;
|
|
2520
2479
|
o = 2 === r ? function(t, n) {
|
|
2521
2480
|
const e = t.length, r = n.length;
|
|
@@ -2550,14 +2509,14 @@ function Or(t, n, e, r) {
|
|
|
2550
2509
|
const e = .5 * function(t, n, e) {
|
|
2551
2510
|
if (e <= 0) return 0;
|
|
2552
2511
|
if (e >= 1) return 1;
|
|
2553
|
-
const r =
|
|
2554
|
-
return e < (t + 1) / (t + n + 2) ? o *
|
|
2512
|
+
const r = $r(t) + $r(n) - $r(t + n), o = Math.exp(Math.log(e) * t + Math.log(1 - e) * n - r);
|
|
2513
|
+
return e < (t + 1) / (t + n + 2) ? o * Lr(t, n, e) / t : 1 - o * Lr(n, t, 1 - e) / n;
|
|
2555
2514
|
}(n / 2, .5, n / (n + t * t));
|
|
2556
2515
|
return t >= 0 ? 1 - e : e;
|
|
2557
2516
|
}(-o.x, o.df) * e;
|
|
2558
2517
|
}
|
|
2559
|
-
var
|
|
2560
|
-
function
|
|
2518
|
+
var Or = 2 ** -22;
|
|
2519
|
+
function Lr(t, n, e) {
|
|
2561
2520
|
const r = 1e-30, o = t + n, i = t + 1, u = t - 1;
|
|
2562
2521
|
let s = 1, a = 1 - o * e / i;
|
|
2563
2522
|
Math.abs(a) < r && (a = r), a = 1 / a;
|
|
@@ -2571,7 +2530,7 @@ function kr(t, n, e) {
|
|
|
2571
2530
|
}
|
|
2572
2531
|
return l;
|
|
2573
2532
|
}
|
|
2574
|
-
function
|
|
2533
|
+
function $r(t) {
|
|
2575
2534
|
const n = [
|
|
2576
2535
|
.9999999999998099,
|
|
2577
2536
|
676.5203681218851,
|
|
@@ -2583,19 +2542,19 @@ function Lr(t) {
|
|
|
2583
2542
|
9984369578019572e-21,
|
|
2584
2543
|
1.5056327351493116e-7
|
|
2585
2544
|
];
|
|
2586
|
-
if (t < .5) return Math.log(Math.PI / Math.sin(Math.PI * t)) -
|
|
2545
|
+
if (t < .5) return Math.log(Math.PI / Math.sin(Math.PI * t)) - $r(1 - t);
|
|
2587
2546
|
t--;
|
|
2588
2547
|
let e = n[0];
|
|
2589
2548
|
for (let r = 1; r < 9; r++) e += n[r] / (t + r);
|
|
2590
2549
|
const r = t + 7.5;
|
|
2591
2550
|
return .5 * Math.log(2 * Math.PI) + (t + .5) * Math.log(r) - r + Math.log(e);
|
|
2592
2551
|
}
|
|
2593
|
-
function
|
|
2552
|
+
function kr(t) {
|
|
2594
2553
|
let n = 0;
|
|
2595
2554
|
for (const e of t) n += e * e;
|
|
2596
2555
|
return n;
|
|
2597
2556
|
}
|
|
2598
|
-
var
|
|
2557
|
+
var qr = "\\p{L}\\p{N}_", jr = {
|
|
2599
2558
|
alpha: "\\p{L}",
|
|
2600
2559
|
digit: "\\p{Nd}",
|
|
2601
2560
|
alnum: "\\p{L}\\p{N}",
|
|
@@ -2604,7 +2563,7 @@ var _r = "\\p{L}\\p{N}_", jr = {
|
|
|
2604
2563
|
space: "\\s",
|
|
2605
2564
|
blank: "\\t\\p{Zs}",
|
|
2606
2565
|
punct: "\\p{P}\\p{S}",
|
|
2607
|
-
word:
|
|
2566
|
+
word: qr,
|
|
2608
2567
|
cntrl: "\\p{Cc}",
|
|
2609
2568
|
xdigit: "0-9A-Fa-f",
|
|
2610
2569
|
ascii: "\\x00-\\x7F",
|
|
@@ -2619,7 +2578,7 @@ var _r = "\\p{L}\\p{N}_", jr = {
|
|
|
2619
2578
|
cntrl: "\\P{Cc}",
|
|
2620
2579
|
print: "\\p{C}",
|
|
2621
2580
|
graph: "\\p{C}"
|
|
2622
|
-
}, Yr = `(?:(?<=[${
|
|
2581
|
+
}, Yr = `(?:(?<=[${qr}])(?![${qr}])|(?<![${qr}])(?=[${qr}]))`, zr = `(?:(?<=[${qr}])(?=[${qr}])|(?<![${qr}])(?![${qr}]))`, _r = (t, n) => {
|
|
2623
2582
|
if (!t.startsWith("[:", n)) return null;
|
|
2624
2583
|
const e = t.indexOf(":]", n + 2);
|
|
2625
2584
|
if (-1 === e) return null;
|
|
@@ -2631,7 +2590,7 @@ var _r = "\\p{L}\\p{N}_", jr = {
|
|
|
2631
2590
|
emit: i,
|
|
2632
2591
|
next: e + 2
|
|
2633
2592
|
};
|
|
2634
|
-
},
|
|
2593
|
+
}, Gr = (t, n) => {
|
|
2635
2594
|
if (!t.startsWith("(?", n)) return null;
|
|
2636
2595
|
let e = n + 2, r = "", o = "", i = !1;
|
|
2637
2596
|
for (; e < t.length;) {
|
|
@@ -2652,13 +2611,13 @@ var _r = "\\p{L}\\p{N}_", jr = {
|
|
|
2652
2611
|
group: !0,
|
|
2653
2612
|
next: e + 1
|
|
2654
2613
|
} : null;
|
|
2655
|
-
},
|
|
2614
|
+
}, Kr = (t) => t.replace(/[^ims]/g, ""), Xr = (t) => (new RegExp(`${t.source}|`, t.flags.replace("g", "")).exec("")?.length ?? 1) - 1, Hr = (t, n, e = "") => {
|
|
2656
2615
|
const r = (n ? "i" : "") + e, o = (t, n) => {
|
|
2657
2616
|
try {
|
|
2658
2617
|
const e = new RegExp(t, n ? `${r}u` : r);
|
|
2659
2618
|
return {
|
|
2660
2619
|
regex: e,
|
|
2661
|
-
groups:
|
|
2620
|
+
groups: Xr(e)
|
|
2662
2621
|
};
|
|
2663
2622
|
} catch {
|
|
2664
2623
|
return null;
|
|
@@ -2684,7 +2643,7 @@ var _r = "\\p{L}\\p{N}_", jr = {
|
|
|
2684
2643
|
if ("C" === o) throw new SyntaxError("the any-byte escape is not supported");
|
|
2685
2644
|
if (r) {
|
|
2686
2645
|
if ("w" === o) {
|
|
2687
|
-
n +=
|
|
2646
|
+
n += qr, e += 2;
|
|
2688
2647
|
continue;
|
|
2689
2648
|
}
|
|
2690
2649
|
if ("d" === o) {
|
|
@@ -2709,11 +2668,11 @@ var _r = "\\p{L}\\p{N}_", jr = {
|
|
|
2709
2668
|
continue;
|
|
2710
2669
|
}
|
|
2711
2670
|
if ("w" === o) {
|
|
2712
|
-
n += `[${
|
|
2671
|
+
n += `[${qr}]`, e += 2;
|
|
2713
2672
|
continue;
|
|
2714
2673
|
}
|
|
2715
2674
|
if ("W" === o) {
|
|
2716
|
-
n += `[^${
|
|
2675
|
+
n += `[^${qr}]`, e += 2;
|
|
2717
2676
|
continue;
|
|
2718
2677
|
}
|
|
2719
2678
|
if ("d" === o) {
|
|
@@ -2729,7 +2688,7 @@ var _r = "\\p{L}\\p{N}_", jr = {
|
|
|
2729
2688
|
continue;
|
|
2730
2689
|
}
|
|
2731
2690
|
if (r) {
|
|
2732
|
-
const o =
|
|
2691
|
+
const o = _r(t, e);
|
|
2733
2692
|
if (o) {
|
|
2734
2693
|
n += o.emit, e = o.next;
|
|
2735
2694
|
continue;
|
|
@@ -2745,10 +2704,10 @@ var _r = "\\p{L}\\p{N}_", jr = {
|
|
|
2745
2704
|
r = !0, n += u, e += 1, "^" === t[e] && (n += "^", e += 1), "]" === t[e] && (n += "\\]", e += 1);
|
|
2746
2705
|
continue;
|
|
2747
2706
|
}
|
|
2748
|
-
const s =
|
|
2707
|
+
const s = Gr(t, e);
|
|
2749
2708
|
if (s) {
|
|
2750
2709
|
s.on.includes("U") && (o = !0), s.off.includes("U") && (o = !1);
|
|
2751
|
-
const t =
|
|
2710
|
+
const t = Kr(s.on), r = Kr(s.off);
|
|
2752
2711
|
s.group ? n += t || r ? `(?${t}${r ? `-${r}` : ""}:` : "(?:" : (t || r) && (n += `(?${t}${r ? `-${r}` : ""}:`, i.push(")")), e = s.next;
|
|
2753
2712
|
continue;
|
|
2754
2713
|
}
|
|
@@ -2771,21 +2730,21 @@ var _r = "\\p{L}\\p{N}_", jr = {
|
|
|
2771
2730
|
}
|
|
2772
2731
|
const u = i.replace(/\\([pP])\{([A-Za-z_]+)\}/g, "\\$1{Script=$2}");
|
|
2773
2732
|
return o(i, !0) ?? (u === i ? null : o(u, !0)) ?? o(t, !1) ?? B.BuiltIn.Value;
|
|
2774
|
-
},
|
|
2733
|
+
}, Wr = (t, n) => {
|
|
2775
2734
|
const e = Math.trunc(t);
|
|
2776
2735
|
return e >= 0 && e <= n ? e : B.BuiltIn.Value;
|
|
2777
|
-
},
|
|
2778
|
-
REGEXEXTRACT: () =>
|
|
2779
|
-
REGEXMATCH: () =>
|
|
2780
|
-
REGEXREPLACE: () =>
|
|
2781
|
-
REGEXTEST: () =>
|
|
2736
|
+
}, Zr = v({
|
|
2737
|
+
REGEXEXTRACT: () => Qr,
|
|
2738
|
+
REGEXMATCH: () => Jr,
|
|
2739
|
+
REGEXREPLACE: () => to,
|
|
2740
|
+
REGEXTEST: () => no
|
|
2782
2741
|
});
|
|
2783
|
-
function
|
|
2784
|
-
const o =
|
|
2742
|
+
function Qr(t, n, e = 0, r = 0) {
|
|
2743
|
+
const o = Wr(e, 2);
|
|
2785
2744
|
if (B.isError(o)) return o;
|
|
2786
|
-
const i =
|
|
2745
|
+
const i = Wr(r, 1);
|
|
2787
2746
|
if (B.isError(i)) return i;
|
|
2788
|
-
const u =
|
|
2747
|
+
const u = Hr(n, 1 === i);
|
|
2789
2748
|
if (B.isError(u)) return u;
|
|
2790
2749
|
const { regex: s } = u;
|
|
2791
2750
|
if (0 === o) {
|
|
@@ -2800,14 +2759,14 @@ function Jr(t, n, e = 0, r = 0) {
|
|
|
2800
2759
|
const a = t.match(s);
|
|
2801
2760
|
return a ? b.createRange().replace([a.slice(1).map((t) => t ?? B.BuiltIn.NA)]) : B.BuiltIn.NA;
|
|
2802
2761
|
}
|
|
2803
|
-
function
|
|
2804
|
-
const r =
|
|
2762
|
+
function Jr(t, n, e = !1) {
|
|
2763
|
+
const r = Hr(n, e);
|
|
2805
2764
|
return B.isError(r) ? r : r.regex.test(t);
|
|
2806
2765
|
}
|
|
2807
|
-
function
|
|
2808
|
-
const i =
|
|
2766
|
+
function to(t, n, e, r = 0, o = 0) {
|
|
2767
|
+
const i = Wr(o, 1);
|
|
2809
2768
|
if (B.isError(i)) return i;
|
|
2810
|
-
const u =
|
|
2769
|
+
const u = Hr(n, 1 === i);
|
|
2811
2770
|
if (B.isError(u)) return u;
|
|
2812
2771
|
const { regex: s, groups: a } = u, l = ((t, n) => {
|
|
2813
2772
|
let e = "", r = 0;
|
|
@@ -2879,11 +2838,11 @@ function no(t, n, e, r = 0, o = 0) {
|
|
|
2879
2838
|
const N = h[m], g = N.index;
|
|
2880
2839
|
return t.slice(0, g) + N[0].replace(s, l) + t.slice(g + N[0].length);
|
|
2881
2840
|
}
|
|
2882
|
-
function
|
|
2883
|
-
const r =
|
|
2841
|
+
function no(t, n, e = 0) {
|
|
2842
|
+
const r = Wr(e, 1);
|
|
2884
2843
|
if (B.isError(r)) return r;
|
|
2885
|
-
const o =
|
|
2844
|
+
const o = Hr(n, 1 === r);
|
|
2886
2845
|
return B.isError(o) ? o : o.regex.test(t);
|
|
2887
2846
|
}
|
|
2888
|
-
var
|
|
2889
|
-
export {
|
|
2847
|
+
var eo = () => import("./0T4CVS-eRgxCYtfc.mjs"), ro = () => import("./Bl_XKy6jAuDPfR9q.mjs"), oo = () => import("./wDK0UoVDut_yHFnN.mjs"), io = () => import("./DXL2nRPu379ZLJW4.mjs"), uo = () => import("./DIHbCSX3oHxaFWRN.mjs"), so = () => import("./COe-XUcPznzLainQ.mjs"), ao = () => import("./BCYJKZ1F4xTomy55.mjs"), lo = () => import("./DKZop8VVKKOl-zxC.mjs"), fo = () => import("./XKjpEaAe7snu5CA2.mjs"), co = () => import("./C4RRHqox3t77s061.mjs"), ho = () => import("./D-0RdQDA-k9FyfJp.mjs"), mo = () => import("./CeirmCdzQsLSw3D7.mjs"), No = () => import("./B6SWueGjJbR9GvFt.mjs"), go = () => import("./WqqCRFF2pHDYrHIR.mjs"), yo = () => import("./DoI7-GUWqVDLmhja.mjs"), Mo = () => import("./DYh11b5QiPmrgbxg.mjs"), po = () => import("./Dlcgl-1wfKMGrJTS.mjs"), Io = () => import("./Cvnn-NZsNEe7z_gs.mjs"), wo = () => import("./CDTu8Mmk15EYCQGg.mjs"), bo = () => import("./CqHFkqrXgFacCByh.mjs"), Bo = () => import("./b-DmHhG0rwDpMJ6g.mjs"), xo = (b, B, x) => (x || (x = /* @__PURE__ */ new Map()), B(x, b, A, t, eo, "Cube"), B(x, b, ht, I, ro, "Financial"), B(x, b, Et, r, oo, "Financial"), B(x, b, Dt, p, io, "Financial", w), B(x, b, Kt, n, uo, "Financial"), B(x, b, Jt, s, so, "Financial"), B(x, b, xn, a, ao, "Financial"), B(x, b, Fn, c, lo, "Financial"), B(x, b, Pn, N, fo, "Financial"), B(x, b, jn, u, co, "Financial"), B(x, b, ne, i, ho, "Financial"), B(x, b, se, M, mo, "Financial"), B(x, b, he, f, No, "Financial"), B(x, b, Ie, o, go, "Financial"), B(x, b, xe, d, yo, "Financial"), B(x, b, Ge, m, Mo, "Lookup & Reference"), B(x, b, Ze, e, po, "Lookup & Reference"), B(x, b, tr, l, Io, "Statistical"), B(x, b, Rr, g, wo, "Statistical"), B(x, b, Sr, h, bo, "Statistical"), B(x, b, Zr, y, Bo, "Text"), x);
|
|
2848
|
+
export { xo as default };
|