@sheetxl/formulas-extended 0.8.0-beta.11 → 0.8.0-beta.13
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/{node/esm/D25GpXzrju6GyQn2.mjs → browser/esm/-gjh-c5r-kqWZw9o.mjs} +1 -1
- package/{node/esm/D0XFBj8GRIDAu37v.mjs → browser/esm/B6ojJF7WA6DiQR2T.mjs} +1 -1
- package/browser/esm/{Bf0x5wP966yEyeU1.mjs → BHd0M_vc0wMVhN4M.mjs} +1 -1
- package/browser/esm/{D4kfW2yw0rsWNLi0.mjs → Bp7v8eImXSaAUiaa.mjs} +1 -1
- package/browser/esm/{CjKII1gh4dO5nTCs.mjs → BuGd_WozQ5GACryc.mjs} +1 -1
- package/browser/esm/{cfrOLasJbMwF7L77.mjs → BzsAYB0O4AGQyHhT.mjs} +1 -1
- package/browser/esm/{B0dkCLIUbDz5vaVn.mjs → C5QRZhBj0R2s5scX.mjs} +1 -1
- package/browser/esm/{0yxQHUFt5rjQCIev.mjs → C8cZUVI0utH84RoY.mjs} +1 -1
- package/browser/esm/{qAolCiBy-hQL59hu.mjs → CYYsvsWpauQOJMsM.mjs} +1 -1
- package/browser/esm/{CoHdir1CxZhcwJYt.mjs → D23E5LzPcseeh6hA.mjs} +1 -1
- package/{node/esm/o8LeKZ4-9nq29pqg.mjs → browser/esm/D5YXRS6-9JR6Jnuy.mjs} +1 -1
- package/browser/esm/{zWOO2QFn-kMYJv1L.mjs → DRA4FqoQ1dJXOyPu.mjs} +1 -1
- package/{node/esm/BJjZHVPRHerJoONT.mjs → browser/esm/DvQaVDnNxRMcD29t.mjs} +1 -1
- package/browser/esm/{g4CKPtGz1NpGDtQq.mjs → DygYeEKVAggDDD_C.mjs} +12 -41
- package/browser/esm/{BfcYyyl5rbLdyDeQ.mjs → JeU0hWKFq05N2_wk.mjs} +1 -1
- package/{node/esm/CNDVQpzD85y-8iJ4.mjs → browser/esm/KELE0bwOYLDc5LU1.mjs} +1 -1
- package/{node/esm/CZ7GTErfSkfNcFRk.mjs → browser/esm/N6ZNg1DcQqnCub6Y.mjs} +1 -1
- package/{node/esm/Dt0ErrS3YGvCicxr.mjs → browser/esm/NLoLzdQXAOTuwqvv.mjs} +1 -1
- package/{node/esm/DXTaMRX8ten_8WHT.mjs → browser/esm/P2KKIUxWzaRqA578.mjs} +1 -1
- package/browser/esm/{CiTyrOKe-UEYKcPV.mjs → TsVRWlV0aBAj11q_.mjs} +1 -1
- package/browser/esm/declarations.mjs +24 -28
- package/browser/esm/index.mjs +836 -844
- package/{node/esm/D4ySsDPVL4IH96en.mjs → browser/esm/kHBrNyVWu-GLkTFD.mjs} +1 -1
- package/browser/esm/{C2ZfbEIW-6-61CUe.mjs → pEF9hsQQaka-GGnX.mjs} +1 -1
- package/{browser/esm/D25GpXzrju6GyQn2.mjs → node/esm/-gjh-c5r-kqWZw9o.mjs} +1 -1
- package/{browser/esm/D0XFBj8GRIDAu37v.mjs → node/esm/B6ojJF7WA6DiQR2T.mjs} +1 -1
- package/node/esm/{Bf0x5wP966yEyeU1.mjs → BHd0M_vc0wMVhN4M.mjs} +1 -1
- package/node/esm/{C3Qy2cWt_qACxJiF.mjs → BVcZk6dCLKI8-HRM.mjs} +1 -1
- package/node/esm/{CgY5V9Cmm0UJmyGW.mjs → BbUWXLsnVo-QSDn_.mjs} +12 -41
- package/node/esm/{D4kfW2yw0rsWNLi0.mjs → Bp7v8eImXSaAUiaa.mjs} +1 -1
- package/node/esm/{CjKII1gh4dO5nTCs.mjs → BuGd_WozQ5GACryc.mjs} +1 -1
- package/node/esm/{cfrOLasJbMwF7L77.mjs → BzsAYB0O4AGQyHhT.mjs} +1 -1
- package/node/esm/{B0dkCLIUbDz5vaVn.mjs → C5QRZhBj0R2s5scX.mjs} +1 -1
- package/node/esm/{0yxQHUFt5rjQCIev.mjs → C8cZUVI0utH84RoY.mjs} +1 -1
- package/node/esm/{qAolCiBy-hQL59hu.mjs → CYYsvsWpauQOJMsM.mjs} +1 -1
- package/{browser/esm/o8LeKZ4-9nq29pqg.mjs → node/esm/D5YXRS6-9JR6Jnuy.mjs} +1 -1
- package/{browser/esm/BJjZHVPRHerJoONT.mjs → node/esm/DvQaVDnNxRMcD29t.mjs} +1 -1
- package/node/esm/{Bnco0vB0yNDiLGre.mjs → FxwjPPWZTalxCLby.mjs} +1 -1
- package/node/esm/{BfcYyyl5rbLdyDeQ.mjs → JeU0hWKFq05N2_wk.mjs} +1 -1
- package/{browser/esm/CNDVQpzD85y-8iJ4.mjs → node/esm/KELE0bwOYLDc5LU1.mjs} +1 -1
- package/{browser/esm/CZ7GTErfSkfNcFRk.mjs → node/esm/N6ZNg1DcQqnCub6Y.mjs} +1 -1
- package/{browser/esm/Dt0ErrS3YGvCicxr.mjs → node/esm/NLoLzdQXAOTuwqvv.mjs} +1 -1
- package/{browser/esm/DXTaMRX8ten_8WHT.mjs → node/esm/P2KKIUxWzaRqA578.mjs} +1 -1
- package/node/esm/{CiTyrOKe-UEYKcPV.mjs → TsVRWlV0aBAj11q_.mjs} +1 -1
- package/node/esm/declarations.mjs +24 -28
- package/node/esm/index.mjs +894 -902
- package/{browser/esm/D4ySsDPVL4IH96en.mjs → node/esm/kHBrNyVWu-GLkTFD.mjs} +1 -1
- package/node/esm/{C2ZfbEIW-6-61CUe.mjs → pEF9hsQQaka-GGnX.mjs} +1 -1
- package/package.json +3 -3
- package/types/src/_utils/AnyArgs.d.ts +0 -12
- package/types/src/_utils/FinanaceSolver.d.ts +0 -27
- package/types/src/_utils/FinanceAmor.d.ts +0 -9
- package/types/src/_utils/FinanceCashflow.d.ts +0 -17
- package/types/src/_utils/FinanceCoupon.d.ts +0 -63
- package/types/src/_utils/FinanceDate.d.ts +0 -7
- package/types/src/_utils/FinanceDayCount.d.ts +0 -74
- package/types/src/_utils/FinanceOdd.d.ts +0 -62
- package/types/src/_utils/FinanceSecurity.d.ts +0 -21
- package/types/src/_utils/FinanceUtils.d.ts +0 -34
- package/types/src/cube/Cube.d.ts +7 -7
- package/types/src/financial/ACCRINT.d.ts +0 -23
- package/types/src/financial/AMORDEGRC.d.ts +0 -22
- package/types/src/financial/Cashflow.d.ts +0 -49
- package/types/src/financial/Coupon.d.ts +0 -14
- package/types/src/financial/Date.d.ts +0 -29
- package/types/src/financial/Depreciation.d.ts +0 -9
- package/types/src/financial/Odd.d.ts +0 -18
- package/types/src/financial/Security.d.ts +0 -10
- package/types/src/financial/SecurityMaturity.d.ts +0 -40
- package/types/src/financial/TBill.d.ts +0 -17
- package/types/src/financial/VDB.d.ts +0 -17
- package/browser/esm/BDiwqEqe9Jl-Rmly.mjs +0 -19
- package/node/esm/0vsGDvrSkTeFOp0A.mjs +0 -19
- package/types/src/.generated/decl/financial/STOCKHISTORY.decl.d.ts +0 -4
- package/types/src/.generated/desc/financial/STOCKHISTORY.desc.d.ts +0 -4
- package/types/src/financial/STOCKHISTORY.d.ts +0 -17
package/node/esm/index.mjs
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
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.13
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import { FormulaContext as
|
|
9
|
-
var
|
|
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 p, t as d, u as y, v as M, x as I, y as w } from "./BbUWXLsnVo-QSDn_.mjs";
|
|
8
|
+
import { FormulaContext as b, FormulaError as B, IRange as x, ScalarType as C, ValueKind as R } from "@sheetxl/primitives";
|
|
9
|
+
var E = Object.defineProperty, A = (t, n) => {
|
|
10
10
|
let e = {};
|
|
11
|
-
for (var r in t)
|
|
11
|
+
for (var r in t) E(e, r, {
|
|
12
12
|
get: t[r],
|
|
13
13
|
enumerable: !0
|
|
14
14
|
});
|
|
15
|
-
return n ||
|
|
16
|
-
},
|
|
17
|
-
CUBEKPIMEMBER: () =>
|
|
18
|
-
CUBEMEMBER: () =>
|
|
19
|
-
CUBEMEMBERPROPERTY: () =>
|
|
20
|
-
CUBERANKEDMEMBER: () =>
|
|
21
|
-
CUBESET: () =>
|
|
22
|
-
CUBESETCOUNT: () =>
|
|
23
|
-
CUBEVALUE: () =>
|
|
15
|
+
return n || E(e, Symbol.toStringTag, { value: "Module" }), e;
|
|
16
|
+
}, v = A({
|
|
17
|
+
CUBEKPIMEMBER: () => D,
|
|
18
|
+
CUBEMEMBER: () => F,
|
|
19
|
+
CUBEMEMBERPROPERTY: () => S,
|
|
20
|
+
CUBERANKEDMEMBER: () => V,
|
|
21
|
+
CUBESET: () => T,
|
|
22
|
+
CUBESETCOUNT: () => P,
|
|
23
|
+
CUBEVALUE: () => O
|
|
24
24
|
});
|
|
25
|
-
function
|
|
26
|
-
throw
|
|
25
|
+
function D(t, n, e, r) {
|
|
26
|
+
throw B.BuiltIn.NA;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
throw
|
|
28
|
+
function F(t, n, e) {
|
|
29
|
+
throw B.BuiltIn.NA;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
throw
|
|
31
|
+
function S(t, n, e) {
|
|
32
|
+
throw B.BuiltIn.NA;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
throw
|
|
34
|
+
function V(t, n, e, r) {
|
|
35
|
+
throw B.BuiltIn.NA;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
throw
|
|
37
|
+
function T(t, n, e, r, o) {
|
|
38
|
+
throw B.BuiltIn.NA;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
throw
|
|
40
|
+
function P(t) {
|
|
41
|
+
throw B.BuiltIn.NA;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
throw
|
|
43
|
+
function O(t, ...n) {
|
|
44
|
+
throw B.BuiltIn.NA;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function $(t) {
|
|
47
47
|
if (null === t) return 0;
|
|
48
48
|
if ("string" == typeof t) try {
|
|
49
|
-
return
|
|
49
|
+
return b.parseAsNumber(t);
|
|
50
50
|
} catch {
|
|
51
|
-
return
|
|
51
|
+
return b.parseAsSerialDate(t);
|
|
52
52
|
}
|
|
53
|
-
return
|
|
53
|
+
return b.parseAsSerialDate(t);
|
|
54
|
+
}
|
|
55
|
+
function k(t) {
|
|
56
|
+
if (void 0 === t) throw B.BuiltIn.NA;
|
|
57
|
+
return $(t);
|
|
54
58
|
}
|
|
55
59
|
function L(t) {
|
|
56
|
-
|
|
57
|
-
return k(t);
|
|
60
|
+
return null === t ? 0 : b.parseAsNumber(t);
|
|
58
61
|
}
|
|
59
62
|
function q(t) {
|
|
60
|
-
|
|
63
|
+
if (void 0 === t) throw B.BuiltIn.NA;
|
|
64
|
+
return L(t);
|
|
61
65
|
}
|
|
62
|
-
|
|
63
|
-
if (void 0 === t) throw x.BuiltIn.NA;
|
|
64
|
-
return q(t);
|
|
65
|
-
}
|
|
66
|
-
var j = [
|
|
66
|
+
var _ = [
|
|
67
67
|
31,
|
|
68
68
|
29,
|
|
69
69
|
31,
|
|
@@ -76,7 +76,7 @@ var j = [
|
|
|
76
76
|
31,
|
|
77
77
|
30,
|
|
78
78
|
31
|
|
79
|
-
],
|
|
79
|
+
], j = [
|
|
80
80
|
31,
|
|
81
81
|
28,
|
|
82
82
|
31,
|
|
@@ -90,45 +90,45 @@ var j = [
|
|
|
90
90
|
30,
|
|
91
91
|
31
|
|
92
92
|
];
|
|
93
|
-
function
|
|
93
|
+
function U(t) {
|
|
94
94
|
return t % 4 == 0 && t % 100 != 0 || t % 400 == 0;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
return
|
|
96
|
+
function Y(t, n) {
|
|
97
|
+
return U(t) ? _[n] : j[n];
|
|
98
98
|
}
|
|
99
|
-
var
|
|
99
|
+
var z = (t, n) => Y(t, n - 1), G = (t) => t.d === z(t.y, t.m);
|
|
100
100
|
function X(t) {
|
|
101
|
-
const n =
|
|
101
|
+
const n = b.getDateParts(t);
|
|
102
102
|
return {
|
|
103
103
|
y: n.year,
|
|
104
104
|
m: n.month,
|
|
105
105
|
d: n.day
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function H(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 W(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, z(r, e))
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
return
|
|
121
|
+
function K(t) {
|
|
122
|
+
return b.getDateParts(Math.max(0, Math.floor(t)));
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function Z(t, n, e, r, o, i) {
|
|
125
125
|
return 360 * (r - t) + 30 * (o - n) + (i - e);
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function Q(t, n, e) {
|
|
128
128
|
switch (e) {
|
|
129
129
|
case 0: return function(t, n) {
|
|
130
130
|
return {
|
|
131
|
-
days: Math.abs(
|
|
131
|
+
days: Math.abs(et(t, n)),
|
|
132
132
|
yearDays: 360
|
|
133
133
|
};
|
|
134
134
|
}(t, n);
|
|
@@ -137,24 +137,24 @@ function J(t, n, e) {
|
|
|
137
137
|
days: 0,
|
|
138
138
|
yearDays: 365
|
|
139
139
|
};
|
|
140
|
-
const e =
|
|
141
|
-
let c, h =
|
|
140
|
+
const e = K(t), r = K(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
|
+
let c, h = b.getSerialDate(l, 1, 1);
|
|
142
142
|
1900 === l && (h += 1);
|
|
143
|
-
if (0 === s) c =
|
|
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 =
|
|
146
|
-
if (u > 0 || 0 === u && i.day > o.day) c = (
|
|
145
|
+
const e = Math.min(t, n), r = Math.max(t, n), o = K(e), i = K(r), u = i.month - o.month;
|
|
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 (
|
|
150
|
-
const n =
|
|
149
|
+
for (const t of [l, f]) if (U(t)) {
|
|
150
|
+
const n = b.getSerialDate(t, 2, 29);
|
|
151
151
|
if (n >= e && n <= r) {
|
|
152
152
|
c = 366;
|
|
153
153
|
break;
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
} else c = (
|
|
157
|
+
} else c = (b.getSerialDate(f + 1, 1, 1) - h) / a;
|
|
158
158
|
return {
|
|
159
159
|
days: u,
|
|
160
160
|
yearDays: c
|
|
@@ -170,80 +170,80 @@ function J(t, n, e) {
|
|
|
170
170
|
yearDays: 365
|
|
171
171
|
};
|
|
172
172
|
case 4: return function(t, n) {
|
|
173
|
-
const e =
|
|
173
|
+
const e = K(t), r = K(n);
|
|
174
174
|
let o = e.day, i = r.day;
|
|
175
175
|
31 === o && (o = 30);
|
|
176
176
|
31 === i && (i = 30);
|
|
177
177
|
return {
|
|
178
|
-
days: Math.abs(
|
|
178
|
+
days: Math.abs(Z(e.year, e.month, o, r.year, r.month, i)),
|
|
179
179
|
yearDays: 360
|
|
180
180
|
};
|
|
181
181
|
}(t, n);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function J(t) {
|
|
185
185
|
return t >= 0 && Math.floor(t) <= 2958465;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function tt(t, n, e) {
|
|
188
188
|
let r = Math.floor(t), o = Math.floor(n);
|
|
189
189
|
if (r > o) {
|
|
190
190
|
const t = r;
|
|
191
191
|
r = o, o = t;
|
|
192
192
|
}
|
|
193
|
-
if (0 === e) return
|
|
194
|
-
const { days: i, yearDays: u } =
|
|
193
|
+
if (0 === e) return et(r, o) / 360;
|
|
194
|
+
const { days: i, yearDays: u } = Q(r, o, e);
|
|
195
195
|
return i / u;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function nt(t, n, e) {
|
|
198
198
|
const r = X(t);
|
|
199
199
|
let o = X(n).y - r.y, i = t;
|
|
200
200
|
for (; o > 0; o -= 1) {
|
|
201
|
-
const t =
|
|
202
|
-
if (i =
|
|
201
|
+
const t = W(r, 12 * o);
|
|
202
|
+
if (i = H(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 = K(t), o = K(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
|
-
return
|
|
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 / (U(X(n).y) ? 366 : 365);
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
const e =
|
|
214
|
+
function et(t, n) {
|
|
215
|
+
const e = K(t), r = K(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 === (U(o) ? 29 : 28) && (u = 30, f = !0) : 31 === u && (u = 30), f && 2 === a && l === (U(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
|
-
function
|
|
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 =
|
|
222
|
+
return 0 === e || 4 === e ? (i = Q(r, o, e).days, u = 360) : (i = ot(o) - ot(r), u = 3 !== e && U(K(r).year) ? 366 : 365), {
|
|
223
223
|
days: 0 === i ? u : i,
|
|
224
224
|
yearDays: u
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
const n =
|
|
229
|
-
return 2 === n.month && 29 === n.day &&
|
|
227
|
+
function ot(t) {
|
|
228
|
+
const n = K(t);
|
|
229
|
+
return 2 === n.month && 29 === n.day && U(n.year) ? t - 1 : t;
|
|
230
230
|
}
|
|
231
|
-
function
|
|
232
|
-
const n = void 0 === t ? 0 :
|
|
233
|
-
if (n < 0 || e > 4) throw
|
|
231
|
+
function it(t) {
|
|
232
|
+
const n = void 0 === t ? 0 : L(t), e = Math.trunc(n);
|
|
233
|
+
if (n < 0 || e > 4) throw B.BuiltIn.Num;
|
|
234
234
|
return e;
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function ut(t, n) {
|
|
237
237
|
const e = Math.floor(t), r = Math.floor(n);
|
|
238
|
-
if (!
|
|
238
|
+
if (!J(t) || !J(n) || e >= r) throw B.BuiltIn.Num;
|
|
239
239
|
return {
|
|
240
240
|
settlement: e,
|
|
241
241
|
maturity: r
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
|
-
function
|
|
245
|
-
const i =
|
|
246
|
-
if (a <= 0 || l <= 0) throw
|
|
244
|
+
function st(t, n, e, r, o) {
|
|
245
|
+
const i = it(o), u = k(t), s = k(n), a = q(e), l = q(r), f = ut(u, s);
|
|
246
|
+
if (a <= 0 || l <= 0) throw B.BuiltIn.Num;
|
|
247
247
|
return {
|
|
248
248
|
...f,
|
|
249
249
|
x: a,
|
|
@@ -251,27 +251,27 @@ function at(t, n, e, r, o) {
|
|
|
251
251
|
basis: i
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
|
-
function
|
|
255
|
-
const r =
|
|
254
|
+
function at(t, n, e) {
|
|
255
|
+
const r = k(t), o = k(n), i = q(e), u = ut(r, o);
|
|
256
256
|
if (u.maturity > function(t) {
|
|
257
|
-
const n =
|
|
258
|
-
if (n.year >= 9999) throw
|
|
259
|
-
if (0 === n.day) return
|
|
260
|
-
const e =
|
|
261
|
-
return n.day > e ?
|
|
262
|
-
}(u.settlement) || i <= 0) throw
|
|
257
|
+
const n = b.getDateParts(t);
|
|
258
|
+
if (n.year >= 9999) throw B.BuiltIn.Num;
|
|
259
|
+
if (0 === n.day) return b.getSerialDate(n.year + 1, n.month, 1) - 1;
|
|
260
|
+
const e = Y(n.year + 1, n.month - 1);
|
|
261
|
+
return n.day > e ? b.getSerialDate(n.year + 1, n.month + 1, 1) : b.getSerialDate(n.year + 1, n.month, n.day);
|
|
262
|
+
}(u.settlement) || i <= 0) throw B.BuiltIn.Num;
|
|
263
263
|
return {
|
|
264
264
|
...u,
|
|
265
265
|
x: i,
|
|
266
266
|
days: u.maturity - u.settlement
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
const u =
|
|
271
|
-
if (!
|
|
269
|
+
function lt(t, n, e, r, o, i) {
|
|
270
|
+
const u = it(i), s = k(t), a = k(n), l = k(e), f = q(r), c = q(o);
|
|
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
|
-
if (!(N < h && h < m)) throw
|
|
274
|
-
const { days: g, yearDays: p } =
|
|
273
|
+
if (!(N < h && h < m)) throw B.BuiltIn.Num;
|
|
274
|
+
const { days: g, yearDays: p } = Q(N, h, u), d = Q(N, m, u).days;
|
|
275
275
|
return {
|
|
276
276
|
rate: f,
|
|
277
277
|
x: c,
|
|
@@ -281,104 +281,104 @@ function ft(t, n, e, r, o, i) {
|
|
|
281
281
|
B: p
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
|
-
function
|
|
285
|
-
let u = i ? 0 :
|
|
286
|
-
const s =
|
|
287
|
-
if (!
|
|
288
|
-
const a =
|
|
289
|
-
if (!
|
|
290
|
-
const l = e.map(
|
|
291
|
-
if (1 !== f && 2 !== f && 4 !== f) throw
|
|
292
|
-
return i && (u =
|
|
293
|
-
...
|
|
284
|
+
function ft(t, n, e, r, o, i = !1) {
|
|
285
|
+
let u = i ? 0 : it(o);
|
|
286
|
+
const s = k(t);
|
|
287
|
+
if (!J(s)) throw B.BuiltIn.Num;
|
|
288
|
+
const a = k(n);
|
|
289
|
+
if (!J(a)) throw B.BuiltIn.Num;
|
|
290
|
+
const l = e.map(q), f = Math.trunc(q(r));
|
|
291
|
+
if (1 !== f && 2 !== f && 4 !== f) throw B.BuiltIn.Num;
|
|
292
|
+
return i && (u = it(o)), {
|
|
293
|
+
...ut(s, a),
|
|
294
294
|
numbers: l,
|
|
295
295
|
frequency: f,
|
|
296
296
|
basis: u
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
|
-
var
|
|
300
|
-
ACCRINT: () =>
|
|
301
|
-
ACCRINTM: () =>
|
|
299
|
+
var ct = (t) => Number.isFinite(t) ? t : 0, ht = A({
|
|
300
|
+
ACCRINT: () => mt,
|
|
301
|
+
ACCRINTM: () => Nt
|
|
302
302
|
});
|
|
303
|
-
function
|
|
303
|
+
function mt(t, n, e, r, o, i, u = 0, s = !0) {
|
|
304
304
|
const a = function(t) {
|
|
305
305
|
if (void 0 === t) return !0;
|
|
306
306
|
if (null === t) return !1;
|
|
307
307
|
if ("boolean" == typeof t) return t;
|
|
308
308
|
if ("number" == typeof t) return 0 !== t;
|
|
309
|
-
if (
|
|
310
|
-
throw
|
|
311
|
-
}(s), l =
|
|
312
|
-
if (!
|
|
313
|
-
const f =
|
|
314
|
-
if (!
|
|
315
|
-
const c =
|
|
316
|
-
if (!
|
|
317
|
-
const h =
|
|
318
|
-
if (1 !== N && 2 !== N && 4 !== N) throw
|
|
319
|
-
const g =
|
|
320
|
-
if (p >= d || h <= 0 || m <= 0) throw
|
|
309
|
+
if (B.isError(t)) throw t;
|
|
310
|
+
throw B.BuiltIn.Value;
|
|
311
|
+
}(s), l = k(t);
|
|
312
|
+
if (!J(l)) throw B.BuiltIn.Num;
|
|
313
|
+
const f = k(n);
|
|
314
|
+
if (!J(f)) throw B.BuiltIn.Num;
|
|
315
|
+
const c = k(e);
|
|
316
|
+
if (!J(c)) throw B.BuiltIn.Num;
|
|
317
|
+
const h = q(r), m = void 0 === o ? 1e3 : L(o), N = Math.trunc(q(i));
|
|
318
|
+
if (1 !== N && 2 !== N && 4 !== N) throw B.BuiltIn.Num;
|
|
319
|
+
const g = it(u), p = Math.floor(l), d = Math.floor(c);
|
|
320
|
+
if (p >= d || h <= 0 || m <= 0) throw B.BuiltIn.Num;
|
|
321
321
|
const y = function(t, n, e, r, o, i) {
|
|
322
|
-
const u = 12 / r, s =
|
|
322
|
+
const u = 12 / r, s = G(X(n));
|
|
323
323
|
let a;
|
|
324
324
|
if (e > n && i) {
|
|
325
325
|
a = n;
|
|
326
|
-
for (let t = n; t < e;) a = t, t =
|
|
327
|
-
} else a =
|
|
328
|
-
const l = 3 === o ? 365 / r : 1 === o ? n -
|
|
329
|
-
let f =
|
|
326
|
+
for (let t = n; t < e;) a = t, t = wt(t, u, s);
|
|
327
|
+
} else a = wt(n, -u, s);
|
|
328
|
+
const l = 3 === o ? 365 / r : 1 === o ? n - wt(n, -u, s) : 360 / r;
|
|
329
|
+
let f = Mt(Math.max(t, a), e, o) / l;
|
|
330
330
|
for (let n = a; n > t;) {
|
|
331
|
-
const e =
|
|
332
|
-
t <= e ? i && (f += 1) : f +=
|
|
331
|
+
const e = wt(n, -u, s);
|
|
332
|
+
t <= e ? i && (f += 1) : f += Mt(t, n, o) / It(e, n, r, o), n = e;
|
|
333
333
|
}
|
|
334
334
|
return f;
|
|
335
335
|
}(p, Math.floor(f), d, N, g, a);
|
|
336
|
-
return
|
|
337
|
-
}
|
|
338
|
-
function
|
|
339
|
-
const i =
|
|
340
|
-
if (!
|
|
341
|
-
const u =
|
|
342
|
-
if (!
|
|
343
|
-
const s =
|
|
344
|
-
if (Math.floor(i) > Math.floor(u) || s <= 0 || a <= 0) throw
|
|
345
|
-
const f = a * s *
|
|
336
|
+
return ct(m * (h / N) * y);
|
|
337
|
+
}
|
|
338
|
+
function Nt(t, n, e, r, o = 0) {
|
|
339
|
+
const i = k(t);
|
|
340
|
+
if (!J(i)) throw B.BuiltIn.Num;
|
|
341
|
+
const u = k(n);
|
|
342
|
+
if (!J(u)) throw B.BuiltIn.Num;
|
|
343
|
+
const s = q(e), a = void 0 === r ? 1e3 : L(r), l = it(o);
|
|
344
|
+
if (Math.floor(i) > Math.floor(u) || s <= 0 || a <= 0) throw B.BuiltIn.Num;
|
|
345
|
+
const f = a * s * tt(i, u, l);
|
|
346
346
|
return Number.isFinite(f) ? f : 0;
|
|
347
347
|
}
|
|
348
|
-
var
|
|
349
|
-
function
|
|
348
|
+
var gt = (t, n) => 360 * (n.y - t.y) + 30 * (n.m - t.m) + (n.d - t.d), pt = (t) => 2 === t.m && t.d === z(t.y, 2);
|
|
349
|
+
function dt(t, n, e) {
|
|
350
350
|
const r = X(t), o = X(n);
|
|
351
|
-
return
|
|
351
|
+
return pt(o) && (e || pt(r)) && (o.d = 30), 31 === o.d && (e || r.d >= 30) && (o.d = 30), (31 === r.d || pt(r)) && (r.d = 30), gt(r, o);
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function yt(t, n) {
|
|
354
354
|
const e = X(t), r = X(n);
|
|
355
|
-
return 31 === e.d && (e.d = 30), 31 === r.d && (r.d = 30),
|
|
355
|
+
return 31 === e.d && (e.d = 30), 31 === r.d && (r.d = 30), gt(e, r);
|
|
356
356
|
}
|
|
357
|
-
var
|
|
358
|
-
function
|
|
359
|
-
if (t < 1) throw
|
|
360
|
-
const r =
|
|
361
|
-
if (o < 1 || o > 2958465) throw
|
|
357
|
+
var Mt = (t, n, e) => 0 === e ? dt(t, n, !1) : 4 === e ? yt(t, n) : n - t, It = (t, n, e, r) => 1 === r ? n - t : 3 === r ? 365 / e : 4 === r ? yt(t, n) : dt(t, n, !0);
|
|
358
|
+
function wt(t, n, e) {
|
|
359
|
+
if (t < 1) throw B.BuiltIn.Num;
|
|
360
|
+
const r = W(X(t), n), o = H(r.y, r.m, e ? z(r.y, r.m) : r.d);
|
|
361
|
+
if (o < 1 || o > 2958465) throw B.BuiltIn.Num;
|
|
362
362
|
return o;
|
|
363
363
|
}
|
|
364
|
-
function
|
|
365
|
-
const s =
|
|
366
|
-
if (s <= 0 || f < 0 || f > s || c < 0 || h <= 0 || !
|
|
367
|
-
const m = Math.floor(
|
|
364
|
+
function bt(t, n, e, r, o, i, u) {
|
|
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
|
+
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(L(u ?? 0));
|
|
368
368
|
return m < 0 || 2 === m || m > 4 ? null : {
|
|
369
369
|
cost: s,
|
|
370
370
|
salvage: f,
|
|
371
371
|
periodIndex: c > 1 ? Math.floor(c) : Math.ceil(c),
|
|
372
372
|
rate: h,
|
|
373
|
-
...
|
|
373
|
+
...rt(a, l, m)
|
|
374
374
|
};
|
|
375
375
|
}
|
|
376
|
-
var
|
|
376
|
+
var Bt = (t) => {
|
|
377
377
|
const n = t.getLocaleProfile().currencySymbol;
|
|
378
378
|
return `${n}#,##0.00_);[Red](${n}#,##0.00)`;
|
|
379
|
-
},
|
|
379
|
+
}, xt = (t, n) => {
|
|
380
380
|
if (0 === t) {
|
|
381
|
-
if (n < 0) throw
|
|
381
|
+
if (n < 0) throw B.BuiltIn.Div0;
|
|
382
382
|
if (0 === n) return NaN;
|
|
383
383
|
}
|
|
384
384
|
if (!Number.isInteger(n) || Math.abs(n) > 4294967294) {
|
|
@@ -391,30 +391,30 @@ var xt = (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
|
-
}, Ct = (t) => t >= 2147483648 || t <= -2147483649 || Number.isNaN(t) ? -2147483648 : Math.trunc(t),
|
|
394
|
+
}, Ct = (t) => t >= 2147483648 || t <= -2147483649 || Number.isNaN(t) ? -2147483648 : Math.trunc(t), Rt = (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
|
-
},
|
|
398
|
-
function
|
|
399
|
-
const s =
|
|
397
|
+
}, Et = A({ AMORDEGRC: () => vt }), At = 1e6;
|
|
398
|
+
function vt(t, n, e, r, o, i, u = 0) {
|
|
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
403
|
const p = c * (g <= 4 ? 1.5 : g <= 6 ? 2 : 2.5), d = Math.ceil(g);
|
|
404
404
|
if (a - l === 0) return 0;
|
|
405
|
-
const y =
|
|
405
|
+
const y = Rt(Math.min(a * p * N, a - l));
|
|
406
406
|
if (0 === f) return y;
|
|
407
407
|
let M = a - y;
|
|
408
408
|
const I = Math.min(f, d - 3);
|
|
409
409
|
let w = 1;
|
|
410
410
|
if (I >= 1) {
|
|
411
|
-
if (I - 1 <=
|
|
411
|
+
if (I - 1 <= At) for (; w < I; w++) {
|
|
412
412
|
if (M < l) return 0;
|
|
413
413
|
M -= M * p;
|
|
414
414
|
}
|
|
415
|
-
else M *=
|
|
415
|
+
else M *= xt(1 - p, I - 1), w = I;
|
|
416
416
|
if (M < l) return 0;
|
|
417
|
-
if (f === I) return
|
|
417
|
+
if (f === I) return Rt(M * p);
|
|
418
418
|
M -= M * p, w++;
|
|
419
419
|
}
|
|
420
420
|
for (; w <= f; w++) {
|
|
@@ -422,56 +422,56 @@ function Dt(t, n, e, r, o, i, u = 0) {
|
|
|
422
422
|
const t = d - w;
|
|
423
423
|
if (t < 1) return 0;
|
|
424
424
|
const n = t <= 2 ? M / t : M * p;
|
|
425
|
-
if (w === f) return
|
|
425
|
+
if (w === f) return Rt(n);
|
|
426
426
|
M -= n;
|
|
427
427
|
}
|
|
428
428
|
return 0;
|
|
429
429
|
}
|
|
430
|
-
var
|
|
431
|
-
CUMIPMT: () =>
|
|
432
|
-
CUMPRINC: () =>
|
|
433
|
-
FV: () =>
|
|
434
|
-
IPMT: () =>
|
|
435
|
-
ISPMT: () =>
|
|
436
|
-
NPER: () =>
|
|
437
|
-
PMT: () =>
|
|
438
|
-
PPMT: () =>
|
|
439
|
-
PV: () =>
|
|
440
|
-
RATE: () =>
|
|
430
|
+
var Dt = A({
|
|
431
|
+
CUMIPMT: () => kt,
|
|
432
|
+
CUMPRINC: () => Lt,
|
|
433
|
+
FV: () => Ft,
|
|
434
|
+
IPMT: () => Ot,
|
|
435
|
+
ISPMT: () => qt,
|
|
436
|
+
NPER: () => Tt,
|
|
437
|
+
PMT: () => Vt,
|
|
438
|
+
PPMT: () => $t,
|
|
439
|
+
PV: () => St,
|
|
440
|
+
RATE: () => Pt
|
|
441
441
|
});
|
|
442
|
-
function
|
|
443
|
-
if (
|
|
444
|
-
const i =
|
|
442
|
+
function Ft(t, n, e, r = 0, o = 0) {
|
|
443
|
+
if (b.formatResults(Bt(b.getRuntime())), 0 === t) return -(r + e * n);
|
|
444
|
+
const i = xt(1 + t, n);
|
|
445
445
|
return -(r * i + (i - 1) / t * (1 + t * (o ? 1 : 0)) * e);
|
|
446
446
|
}
|
|
447
|
-
function
|
|
448
|
-
if (
|
|
449
|
-
const i =
|
|
450
|
-
if (0 === i) throw
|
|
447
|
+
function St(t, n, e, r = 0, o = 0) {
|
|
448
|
+
if (b.formatResults(Bt(b.getRuntime())), 0 === t) return -(r + e * n);
|
|
449
|
+
const i = xt(1 + t, n);
|
|
450
|
+
if (0 === i) throw B.BuiltIn.Div0;
|
|
451
451
|
return -(r + (i - 1) / t * (1 + t * (o ? 1 : 0)) * e) / i;
|
|
452
452
|
}
|
|
453
|
-
function
|
|
454
|
-
if (
|
|
453
|
+
function Vt(t, n, e, r = 0, o = 0) {
|
|
454
|
+
if (b.formatResults(Bt(b.getRuntime())), 0 === n) return NaN;
|
|
455
455
|
if (0 === t) return (-e - r) / n;
|
|
456
456
|
if (t <= -1) return NaN;
|
|
457
457
|
const i = n * Math.log1p(t), u = (e / -Math.expm1(-i) + r / Math.expm1(i)) * t;
|
|
458
458
|
return -(o ? u / (1 + t) : u);
|
|
459
459
|
}
|
|
460
|
-
function
|
|
460
|
+
function Tt(t, n, e, r = 0, o = 0) {
|
|
461
461
|
if (0 === t) {
|
|
462
|
-
if (0 === n) throw
|
|
462
|
+
if (0 === n) throw B.BuiltIn.Div0;
|
|
463
463
|
return (-e - r) / n;
|
|
464
464
|
}
|
|
465
465
|
if (t <= -1) return NaN;
|
|
466
466
|
const i = Math.log(1 + t);
|
|
467
|
-
if (0 === i) throw
|
|
467
|
+
if (0 === i) throw B.BuiltIn.Div0;
|
|
468
468
|
return o && (n *= 1 + t), Math.log((n - r * t) / (e * t + n)) / i;
|
|
469
469
|
}
|
|
470
|
-
function
|
|
471
|
-
if (
|
|
470
|
+
function Pt(t, n, e, r = 0, o = 0, i = .1) {
|
|
471
|
+
if (b.formatResults("0%"), i <= -1) throw B.BuiltIn.Value;
|
|
472
472
|
const u = o ? 1 : 0, s = (o) => {
|
|
473
473
|
if (0 === o) return e + n * t + r;
|
|
474
|
-
const i =
|
|
474
|
+
const i = xt(1 + o, t);
|
|
475
475
|
return e * i + (i - 1) / o * (1 + o * u) * n + r;
|
|
476
476
|
};
|
|
477
477
|
let a = i, l = s(a), f = l > 0 ? i - .001 : i + .001, c = s(f);
|
|
@@ -485,16 +485,16 @@ function Ot(t, n, e, r = 0, o = 0, i = .1) {
|
|
|
485
485
|
}
|
|
486
486
|
return NaN;
|
|
487
487
|
}
|
|
488
|
-
function
|
|
489
|
-
if (
|
|
488
|
+
function Ot(t, n, e, r, o = 0, i = 0) {
|
|
489
|
+
if (b.formatResults(Bt(b.getRuntime())), n < 1 || n - 1 >= e) return NaN;
|
|
490
490
|
if (1 === n && i) return 0;
|
|
491
491
|
if (0 === t) return 0;
|
|
492
492
|
if (t <= -1) return NaN;
|
|
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
|
|
497
|
-
if (
|
|
496
|
+
function $t(t, n, e, r, o = 0, i = 0) {
|
|
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;
|
|
500
500
|
const u = Math.log1p(t), s = -Math.expm1(-e * u);
|
|
@@ -502,31 +502,31 @@ function kt(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 kt(t, n, e, r, o, i) {
|
|
506
|
+
const u = jt(..._t(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 Lt(t, n, e, r, o, i) {
|
|
512
|
+
const u = jt(..._t(t, n, e, r, o, i));
|
|
513
513
|
return u ? u.principal : NaN;
|
|
514
514
|
}
|
|
515
|
-
function
|
|
516
|
-
if (0 === e) throw
|
|
515
|
+
function qt(t, n, e, r) {
|
|
516
|
+
if (0 === e) throw B.BuiltIn.Div0;
|
|
517
517
|
const o = r * (n - e) * t / e;
|
|
518
518
|
return Number.isFinite(o) ? o : NaN;
|
|
519
519
|
}
|
|
520
|
-
var
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
],
|
|
520
|
+
var _t = (t, n, e, r, o, i) => [
|
|
521
|
+
q(t),
|
|
522
|
+
q(n),
|
|
523
|
+
q(e),
|
|
524
|
+
q(r),
|
|
525
|
+
q(o),
|
|
526
|
+
q(i)
|
|
527
|
+
], jt = (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
|
-
const u =
|
|
529
|
+
const u = Vt(t, n, e, 0, i);
|
|
530
530
|
if (!Number.isFinite(u)) return null;
|
|
531
531
|
const s = Math.ceil(r), a = Math.floor(o), l = a - s + 1;
|
|
532
532
|
if (l <= 0) return {
|
|
@@ -550,30 +550,30 @@ var jt = (t, n, e, r, o, i) => [
|
|
|
550
550
|
principal: m,
|
|
551
551
|
count: l
|
|
552
552
|
};
|
|
553
|
-
},
|
|
554
|
-
const n =
|
|
553
|
+
}, Ut = (t) => {
|
|
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 Yt(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
|
-
if (s !== u.getRowCount()) throw
|
|
560
|
-
const a = !
|
|
559
|
+
if (s !== u.getRowCount()) throw B.BuiltIn.Num;
|
|
560
|
+
const a = !Ut(e + 1), l = Ut(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
|
-
if (
|
|
566
|
-
if (!o && (N =
|
|
567
|
-
if (
|
|
565
|
+
if (B.isError(e)) throw e;
|
|
566
|
+
if (!o && (N = zt(e, f, o, 0), N < c || N > 2958465)) throw B.BuiltIn.Num;
|
|
567
|
+
if (B.isError(n)) throw n;
|
|
568
568
|
} else {
|
|
569
|
-
if (
|
|
570
|
-
if (
|
|
569
|
+
if (B.isError(n)) throw n;
|
|
570
|
+
if (B.isError(e)) throw e;
|
|
571
571
|
}
|
|
572
572
|
if (o && null === n) continue;
|
|
573
|
-
if (o && null === e && a) throw
|
|
574
|
-
const r =
|
|
575
|
-
if (r > 2958465 || r < c) throw
|
|
576
|
-
if (!o && r < N) throw
|
|
573
|
+
if (o && null === e && a) throw B.BuiltIn.Num;
|
|
574
|
+
const r = zt(e, f, o, t), s = Gt(n, l, o, t);
|
|
575
|
+
if (r > 2958465 || r < c) throw B.BuiltIn.Num;
|
|
576
|
+
if (!o && r < N) throw B.BuiltIn.Num;
|
|
577
577
|
void 0 === N && (N = r), h.push(s), m.push(r);
|
|
578
578
|
}
|
|
579
579
|
const g = N ?? 0;
|
|
@@ -582,48 +582,48 @@ function zt(t, n, e, r = "xnpv") {
|
|
|
582
582
|
days: m.map((t) => t - g)
|
|
583
583
|
};
|
|
584
584
|
}
|
|
585
|
-
function
|
|
586
|
-
const o = n ?
|
|
587
|
-
if ("number" != typeof o || Number.isNaN(o)) throw e || 0 === r ?
|
|
585
|
+
function zt(t, n, e, r) {
|
|
586
|
+
const o = n ? $(t) : t;
|
|
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
|
-
function
|
|
591
|
-
const o = n ?
|
|
592
|
-
if ("number" != typeof o || Number.isNaN(o)) throw e || 0 === r ?
|
|
590
|
+
function Gt(t, n, e, r) {
|
|
591
|
+
const o = n ? L(t) : t;
|
|
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 Xt =
|
|
596
|
-
IRR: () =>
|
|
597
|
-
MIRR: () =>
|
|
598
|
-
NPV: () =>
|
|
599
|
-
XIRR: () =>
|
|
600
|
-
XNPV: () =>
|
|
595
|
+
var Xt = A({
|
|
596
|
+
IRR: () => Wt,
|
|
597
|
+
MIRR: () => Kt,
|
|
598
|
+
NPV: () => Ht,
|
|
599
|
+
XIRR: () => Qt,
|
|
600
|
+
XNPV: () => Zt
|
|
601
601
|
});
|
|
602
|
-
function
|
|
603
|
-
|
|
602
|
+
function Ht(t, n) {
|
|
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);
|
|
606
606
|
const r = e.length, o = 1 + t;
|
|
607
|
-
if (0 === o) throw
|
|
608
|
-
if (!Number.isFinite(
|
|
607
|
+
if (0 === o) throw B.BuiltIn.Div0;
|
|
608
|
+
if (!Number.isFinite(xt(o, r - 1))) throw B.BuiltIn.Div0;
|
|
609
609
|
let i = 0;
|
|
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 (
|
|
615
|
-
if (n <= -1 || 1 + n === n) throw
|
|
616
|
-
if (void 0 === t) throw
|
|
613
|
+
function Wt(t, n = .1) {
|
|
614
|
+
if (b.formatResults("0%"), b.getArgs().getKindAt(0) === R.Error) throw t[0];
|
|
615
|
+
if (n <= -1 || 1 + n === n) throw B.BuiltIn.Value;
|
|
616
|
+
if (void 0 === t) throw B.BuiltIn.Value;
|
|
617
617
|
const e = [];
|
|
618
618
|
for (const n of t) {
|
|
619
|
-
if (
|
|
619
|
+
if (B.isError(n)) throw B.BuiltIn.Value;
|
|
620
620
|
"number" == typeof n && e.push(n);
|
|
621
621
|
}
|
|
622
622
|
let r = !1, o = !1;
|
|
623
623
|
for (const t of e) t > 0 ? r = !0 : t < 0 && (o = !0);
|
|
624
624
|
if (!r || !o) return NaN;
|
|
625
625
|
const i = (t) => {
|
|
626
|
-
if (0 === t) throw
|
|
626
|
+
if (0 === t) throw B.BuiltIn.Div0;
|
|
627
627
|
const n = 1 / t;
|
|
628
628
|
let r = 0, o = 1;
|
|
629
629
|
for (let t = 0; t < e.length; t++) r += e[t] / o, o *= n;
|
|
@@ -644,52 +644,52 @@ function Kt(t, n = .1) {
|
|
|
644
644
|
}
|
|
645
645
|
return NaN;
|
|
646
646
|
}
|
|
647
|
-
function
|
|
648
|
-
if (
|
|
647
|
+
function Kt(t, n, e) {
|
|
648
|
+
if (b.formatResults("0%"), void 0 === t) throw B.BuiltIn.Value;
|
|
649
649
|
const r = [];
|
|
650
650
|
for (const n of t) {
|
|
651
|
-
if (
|
|
651
|
+
if (B.isError(n)) throw n;
|
|
652
652
|
"number" == typeof n && r.push(n);
|
|
653
653
|
}
|
|
654
654
|
const o = r.length;
|
|
655
|
-
if (o < 2) throw
|
|
656
|
-
if (!Number.isFinite(
|
|
657
|
-
if (!Number.isFinite(
|
|
655
|
+
if (o < 2) throw B.BuiltIn.Div0;
|
|
656
|
+
if (!Number.isFinite(xt(1 + e, o - 1))) throw B.BuiltIn.Div0;
|
|
657
|
+
if (!Number.isFinite(xt(1 + e, o)) || !Number.isFinite(xt(1 + n, o))) return NaN;
|
|
658
658
|
let i = 0, u = 0;
|
|
659
659
|
for (let t = 0; t < o; t++) {
|
|
660
660
|
const o = r[t];
|
|
661
661
|
if (o > 0) {
|
|
662
662
|
const n = Math.pow(1 + e, t);
|
|
663
|
-
if (0 === n) throw
|
|
663
|
+
if (0 === n) throw B.BuiltIn.Div0;
|
|
664
664
|
i += o / n;
|
|
665
665
|
} else if (o < 0) {
|
|
666
666
|
const e = Math.pow(1 + n, t);
|
|
667
|
-
if (0 === e) throw
|
|
667
|
+
if (0 === e) throw B.BuiltIn.Div0;
|
|
668
668
|
u += o / e;
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
|
-
if (0 === u) throw
|
|
671
|
+
if (0 === u) throw B.BuiltIn.Div0;
|
|
672
672
|
const s = i * Math.pow(1 + e, o - 1), a = Math.pow(-s / u, 1 / (o - 1)) - 1;
|
|
673
673
|
return Number.isFinite(a) ? a : NaN;
|
|
674
674
|
}
|
|
675
|
-
function
|
|
676
|
-
const r =
|
|
677
|
-
if (void 0 === n || void 0 === e) throw
|
|
675
|
+
function Zt(t, n, e) {
|
|
676
|
+
const r = q(t);
|
|
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 = Yt(n, e, 1);
|
|
680
680
|
let i = 0;
|
|
681
681
|
for (let t = 0; t < o.values.length; t++) {
|
|
682
|
-
const n =
|
|
682
|
+
const n = xt(1 + r, o.days[t] / 365);
|
|
683
683
|
if (!Number.isFinite(n)) return NaN;
|
|
684
684
|
i += o.values[t] / n;
|
|
685
685
|
}
|
|
686
686
|
return Number.isFinite(i) ? i : NaN;
|
|
687
687
|
}
|
|
688
|
-
function
|
|
689
|
-
const r =
|
|
690
|
-
if (void 0 === t || void 0 === n) throw
|
|
691
|
-
const o =
|
|
692
|
-
if (1 === u) throw
|
|
688
|
+
function Qt(t, n, e = .1) {
|
|
689
|
+
const r = L(e);
|
|
690
|
+
if (void 0 === t || void 0 === n) throw B.BuiltIn.NA;
|
|
691
|
+
const o = Yt(t, n, 0, "xirr"), i = o.values, u = i.length;
|
|
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);
|
|
695
695
|
if (!s || !a) return NaN;
|
|
@@ -764,139 +764,139 @@ function Jt(t, n, e = .1) {
|
|
|
764
764
|
const M = Math.abs(f(m)) <= Math.abs(f(N)) ? m : N;
|
|
765
765
|
return Number.isFinite(M) ? M : NaN;
|
|
766
766
|
}
|
|
767
|
-
var
|
|
768
|
-
DOLLARDE: () =>
|
|
769
|
-
DOLLARFR: () =>
|
|
770
|
-
EFFECT: () =>
|
|
771
|
-
NOMINAL: () =>
|
|
767
|
+
var Jt = A({
|
|
768
|
+
DOLLARDE: () => en,
|
|
769
|
+
DOLLARFR: () => rn,
|
|
770
|
+
EFFECT: () => tn,
|
|
771
|
+
NOMINAL: () => nn
|
|
772
772
|
});
|
|
773
|
-
function
|
|
774
|
-
const e =
|
|
773
|
+
function tn(t, n) {
|
|
774
|
+
const e = q(t), r = Math.trunc(q(n));
|
|
775
775
|
if (e <= 0 || r < 1) return NaN;
|
|
776
|
-
const o =
|
|
776
|
+
const o = xt(1 + e / r, r) - 1;
|
|
777
777
|
return Number.isFinite(o) ? o : NaN;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
780
|
-
const e =
|
|
779
|
+
function nn(t, n) {
|
|
780
|
+
const e = q(t), r = Math.trunc(q(n));
|
|
781
781
|
if (e <= 0 || r < 1) return NaN;
|
|
782
|
-
const o = (
|
|
782
|
+
const o = (xt(e + 1, 1 / r) - 1) * r;
|
|
783
783
|
return Number.isFinite(o) ? o : NaN;
|
|
784
784
|
}
|
|
785
|
-
function
|
|
786
|
-
const e =
|
|
785
|
+
function en(t, n) {
|
|
786
|
+
const e = q(t), { denominator: r, scale: o } = on(q(n));
|
|
787
787
|
if (Number.isNaN(r)) return NaN;
|
|
788
788
|
const i = e < 0 ? -1 : 1, u = Math.abs(e), s = Math.trunc(u);
|
|
789
789
|
return i * (s + (u - s) * o / r);
|
|
790
790
|
}
|
|
791
|
-
function
|
|
792
|
-
const e =
|
|
791
|
+
function rn(t, n) {
|
|
792
|
+
const e = q(t), { denominator: r, scale: o } = on(q(n));
|
|
793
793
|
if (Number.isNaN(r)) return NaN;
|
|
794
794
|
const i = e < 0 ? -1 : 1, u = Math.abs(e), s = Math.trunc(u);
|
|
795
795
|
return i * (s + (u - s) * r / o);
|
|
796
796
|
}
|
|
797
|
-
var
|
|
797
|
+
var on = (t) => {
|
|
798
798
|
if (t < 0) return {
|
|
799
799
|
denominator: NaN,
|
|
800
800
|
scale: 1
|
|
801
801
|
};
|
|
802
802
|
const n = Math.trunc(t);
|
|
803
|
-
if (0 === n) throw
|
|
803
|
+
if (0 === n) throw B.BuiltIn.Div0;
|
|
804
804
|
return {
|
|
805
805
|
denominator: n,
|
|
806
806
|
scale: 10 ** Math.ceil(Math.log10(n))
|
|
807
807
|
};
|
|
808
808
|
};
|
|
809
|
-
var
|
|
810
|
-
function
|
|
811
|
-
const e = Math.min(t.d,
|
|
809
|
+
var un = (t, n) => Y(t, n - 1), sn = (t) => t.d === un(t.y, t.m);
|
|
810
|
+
function an(t, n = !1) {
|
|
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;
|
|
813
813
|
}
|
|
814
|
-
function
|
|
815
|
-
const e =
|
|
816
|
-
return
|
|
814
|
+
function ln(t, n) {
|
|
815
|
+
const e = an(t) < 1;
|
|
816
|
+
return an(n, e) - an(t, e);
|
|
817
817
|
}
|
|
818
|
-
function
|
|
819
|
-
const n =
|
|
818
|
+
function fn(t) {
|
|
819
|
+
const n = b.getDateParts(t);
|
|
820
820
|
return {
|
|
821
821
|
y: n.year,
|
|
822
822
|
m: n.month,
|
|
823
823
|
d: n.day
|
|
824
824
|
};
|
|
825
825
|
}
|
|
826
|
-
function
|
|
826
|
+
function cn(t, n, e, r) {
|
|
827
827
|
let o = t.m - 1 - n;
|
|
828
828
|
const i = t.y + Math.floor(o / 12);
|
|
829
829
|
o = (o % 12 + 12) % 12 + 1;
|
|
830
|
-
const u =
|
|
830
|
+
const u = un(i, o);
|
|
831
831
|
return {
|
|
832
832
|
y: i,
|
|
833
833
|
m: o,
|
|
834
834
|
d: r ? u : Math.min(e, u)
|
|
835
835
|
};
|
|
836
836
|
}
|
|
837
|
-
function
|
|
838
|
-
const o =
|
|
839
|
-
return r && !o && (i.d = Math.min(t.d, 2 === i.m ? 29 :
|
|
837
|
+
function hn(t, n, e, r = !1) {
|
|
838
|
+
const o = sn(t), i = cn(t, n * e, t.d, o);
|
|
839
|
+
return r && !o && (i.d = Math.min(t.d, 2 === i.m ? 29 : un(i.y, i.m))), i;
|
|
840
840
|
}
|
|
841
|
-
function
|
|
842
|
-
const r = 12 / e, o =
|
|
841
|
+
function mn(t, n, e) {
|
|
842
|
+
const r = 12 / e, o = fn(n);
|
|
843
843
|
let i = 0, u = o;
|
|
844
|
-
for (; (0 === i ? n :
|
|
844
|
+
for (; (0 === i ? n : an(u)) > t;) i++, u = hn(o, i, r);
|
|
845
845
|
return {
|
|
846
846
|
maturity: o,
|
|
847
847
|
pcd: u,
|
|
848
|
-
ncd:
|
|
848
|
+
ncd: hn(o, i - 1, r),
|
|
849
849
|
count: i,
|
|
850
850
|
step: r
|
|
851
851
|
};
|
|
852
852
|
}
|
|
853
|
+
function Nn(t, n, e) {
|
|
854
|
+
return Math.max(0, an(mn(t, n, e).pcd));
|
|
855
|
+
}
|
|
853
856
|
function gn(t, n, e) {
|
|
854
|
-
return
|
|
857
|
+
return an(mn(t, n, e).ncd);
|
|
855
858
|
}
|
|
856
859
|
function pn(t, n, e) {
|
|
857
|
-
|
|
860
|
+
const r = mn(t, n, e);
|
|
861
|
+
return an(r.pcd) <= 0 ? NaN : r.count;
|
|
858
862
|
}
|
|
859
|
-
function dn(t, n, e) {
|
|
860
|
-
const r = Nn(t, n, e);
|
|
861
|
-
return ln(r.pcd) <= 0 ? NaN : r.count;
|
|
862
|
-
}
|
|
863
|
-
function yn(t, n, e, r) {
|
|
863
|
+
function dn(t, n, e, r) {
|
|
864
864
|
return function(t, n, e) {
|
|
865
|
-
const { days: r } =
|
|
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
|
|
870
|
-
const o =
|
|
871
|
-
if (0 !== r && 4 !== r) return
|
|
872
|
-
const i =
|
|
873
|
-
let a = s ?
|
|
874
|
-
return 4 === r ? (a = Math.min(a, 30), l = Math.min(l, 30)) : ((31 === a || s && 2 === i.m && a >=
|
|
869
|
+
function yn(t, n, e, r) {
|
|
870
|
+
const o = mn(t, n, e);
|
|
871
|
+
if (0 !== r && 4 !== r) return an(o.ncd) - t;
|
|
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
|
+
let a = s ? hn(o.maturity, o.count, o.step, !0).d : i.d, l = u.d;
|
|
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 Mn(t, n, e, r) {
|
|
877
877
|
if (3 === r) return 365 / e;
|
|
878
878
|
if (1 !== r) return 360 / e;
|
|
879
|
-
const o = 12 / e, i =
|
|
880
|
-
let a =
|
|
879
|
+
const o = 12 / e, i = fn(n), u = [i], s = [i];
|
|
880
|
+
let a = sn(i), l = i.d;
|
|
881
881
|
const f = (t) => t[t.length - 1];
|
|
882
|
-
for (;
|
|
883
|
-
const t =
|
|
884
|
-
|
|
885
|
-
const n =
|
|
882
|
+
for (; an(f(u)) > t || an(f(s)) > t;) {
|
|
883
|
+
const t = cn(f(u), o, f(u).d, a);
|
|
884
|
+
sn(t) && (a = !0), u.push(t);
|
|
885
|
+
const n = cn(f(s), o, l, !1);
|
|
886
886
|
l = n.d, s.push(n);
|
|
887
887
|
}
|
|
888
|
-
const c = s.findIndex((n) =>
|
|
889
|
-
if (
|
|
890
|
-
const h = u.findIndex((n) =>
|
|
891
|
-
return
|
|
888
|
+
const c = s.findIndex((n) => an(n) <= t);
|
|
889
|
+
if (an(s[c - 1]) !== an(u[c - 1])) return ln(s[c], s[c - 1]);
|
|
890
|
+
const h = u.findIndex((n) => an(n) <= t);
|
|
891
|
+
return ln(u[h], u[h - 1]);
|
|
892
892
|
}
|
|
893
|
-
function
|
|
894
|
-
const o =
|
|
895
|
-
if (!
|
|
896
|
-
const a = Math.trunc(
|
|
897
|
-
if (1 !== a && 2 !== a && 4 !== a) throw
|
|
898
|
-
const l = void 0 === r ? 0 :
|
|
899
|
-
if (l < 0 || f > 4) throw
|
|
893
|
+
function In(t, n, e, r) {
|
|
894
|
+
const o = k(t), i = k(n), u = Math.floor(o), s = Math.floor(i);
|
|
895
|
+
if (!J(o) || !J(i) || u >= s) throw B.BuiltIn.Num;
|
|
896
|
+
const a = Math.trunc(q(e));
|
|
897
|
+
if (1 !== a && 2 !== a && 4 !== a) throw B.BuiltIn.Num;
|
|
898
|
+
const l = void 0 === r ? 0 : L(r), f = Math.trunc(l);
|
|
899
|
+
if (l < 0 || f > 4) throw B.BuiltIn.Num;
|
|
900
900
|
return {
|
|
901
901
|
settlement: u,
|
|
902
902
|
maturity: s,
|
|
@@ -904,8 +904,8 @@ function wn(t, n, e, r) {
|
|
|
904
904
|
basis: f
|
|
905
905
|
};
|
|
906
906
|
}
|
|
907
|
-
function
|
|
908
|
-
const o =
|
|
907
|
+
function wn(t, n, e, r) {
|
|
908
|
+
const o = pn(t, n, e), i = dn(t, n, e, r), u = 1 === r ? i + yn(t, n, e, r) : Mn(t, n, e, r);
|
|
909
909
|
return {
|
|
910
910
|
N: o,
|
|
911
911
|
A: i,
|
|
@@ -913,8 +913,8 @@ function bn(t, n, e, r) {
|
|
|
913
913
|
DSC: u - i
|
|
914
914
|
};
|
|
915
915
|
}
|
|
916
|
-
function
|
|
917
|
-
const { N: s, A: a, E: l, DSC: f } =
|
|
916
|
+
function bn(t, n, e, r, o, i, u) {
|
|
917
|
+
const { N: s, A: a, E: l, DSC: f } = wn(t, n, i, u);
|
|
918
918
|
if (Number.isNaN(s)) return NaN;
|
|
919
919
|
const c = 100 * e / i, h = r / i;
|
|
920
920
|
if (1 === s) return (c + o) / (h * f / l + 1) - c * a / l;
|
|
@@ -924,8 +924,8 @@ function Bn(t, n, e, r, o, i, u) {
|
|
|
924
924
|
for (let t = 1; t <= s; t++) N += c / (1 + h) ** (t - 1 + f / l);
|
|
925
925
|
return N + o / m - c * a / l;
|
|
926
926
|
}
|
|
927
|
-
function
|
|
928
|
-
const { N: u, A: s, E: a, DSC: l } =
|
|
927
|
+
function Bn(t, n, e, r, o, i) {
|
|
928
|
+
const { N: u, A: s, E: a, DSC: l } = wn(t, n, o, i);
|
|
929
929
|
if (Number.isNaN(u)) return NaN;
|
|
930
930
|
const f = l / a - 1, c = 1 + r / o, h = 100 * e / o;
|
|
931
931
|
let m = 0, N = 0;
|
|
@@ -938,101 +938,101 @@ function xn(t, n, e, r, o, i) {
|
|
|
938
938
|
const d = 100 / p;
|
|
939
939
|
return m += g * d, N += d, m / N / o;
|
|
940
940
|
}
|
|
941
|
-
var
|
|
941
|
+
var xn = A({
|
|
942
942
|
COUPDAYBS: () => Cn,
|
|
943
|
-
COUPDAYS: () =>
|
|
944
|
-
COUPDAYSNC: () =>
|
|
945
|
-
COUPNCD: () =>
|
|
946
|
-
COUPNUM: () =>
|
|
947
|
-
COUPPCD: () =>
|
|
943
|
+
COUPDAYS: () => Rn,
|
|
944
|
+
COUPDAYSNC: () => En,
|
|
945
|
+
COUPNCD: () => An,
|
|
946
|
+
COUPNUM: () => Dn,
|
|
947
|
+
COUPPCD: () => vn
|
|
948
948
|
});
|
|
949
949
|
function Cn(t, n, e, r = 0) {
|
|
950
|
-
const o =
|
|
951
|
-
return
|
|
950
|
+
const o = In(t, n, e, r);
|
|
951
|
+
return dn(o.settlement, o.maturity, o.frequency, o.basis);
|
|
952
|
+
}
|
|
953
|
+
function Rn(t, n, e, r = 0) {
|
|
954
|
+
const o = In(t, n, e, r);
|
|
955
|
+
return Mn(o.settlement, o.maturity, o.frequency, o.basis);
|
|
952
956
|
}
|
|
953
957
|
function En(t, n, e, r = 0) {
|
|
954
|
-
const o =
|
|
955
|
-
return
|
|
958
|
+
const o = In(t, n, e, r);
|
|
959
|
+
return yn(o.settlement, o.maturity, o.frequency, o.basis);
|
|
956
960
|
}
|
|
957
961
|
function An(t, n, e, r = 0) {
|
|
958
|
-
const o =
|
|
959
|
-
return
|
|
962
|
+
const o = In(t, n, e, r);
|
|
963
|
+
return gn(o.settlement, o.maturity, o.frequency);
|
|
960
964
|
}
|
|
961
965
|
function vn(t, n, e, r = 0) {
|
|
962
|
-
const o =
|
|
963
|
-
return
|
|
966
|
+
const o = In(t, n, e, r);
|
|
967
|
+
return Nn(o.settlement, o.maturity, o.frequency);
|
|
964
968
|
}
|
|
965
969
|
function Dn(t, n, e, r = 0) {
|
|
966
|
-
const o =
|
|
967
|
-
return
|
|
968
|
-
}
|
|
969
|
-
function Fn(t, n, e, r = 0) {
|
|
970
|
-
const o = wn(t, n, e, r);
|
|
971
|
-
return dn(o.settlement, o.maturity, o.frequency);
|
|
970
|
+
const o = In(t, n, e, r);
|
|
971
|
+
return pn(o.settlement, o.maturity, o.frequency);
|
|
972
972
|
}
|
|
973
|
-
var
|
|
974
|
-
DATEDIF: () =>
|
|
975
|
-
DAYS360: () =>
|
|
976
|
-
YEARFRAC: () =>
|
|
973
|
+
var Fn = A({
|
|
974
|
+
DATEDIF: () => Sn,
|
|
975
|
+
DAYS360: () => Tn,
|
|
976
|
+
YEARFRAC: () => Vn
|
|
977
977
|
});
|
|
978
|
-
function
|
|
978
|
+
function Sn(t, n, e) {
|
|
979
979
|
const r = Math.floor(t), o = Math.floor(n);
|
|
980
|
-
if (!
|
|
981
|
-
const i =
|
|
980
|
+
if (!J(t) || !J(n) || r > o) return NaN;
|
|
981
|
+
const i = b.getDateParts(r), u = b.getDateParts(o);
|
|
982
982
|
e = e.toLowerCase();
|
|
983
|
-
const s = u.year - i.year, a = u.month - i.month, l = u.day - i.day, f = a < 0 || 0 === a && l < 0, c = l < 0 ? -1 : 0, h = o -
|
|
983
|
+
const s = u.year - i.year, a = u.month - i.month, l = u.day - i.day, f = a < 0 || 0 === a && l < 0, c = l < 0 ? -1 : 0, h = o - b.getSerialDate(u.year, u.month + c, i.day), m = (c + 12 * s + a) % 12;
|
|
984
984
|
switch (e) {
|
|
985
985
|
case "y": return s - (f ? 1 : 0);
|
|
986
986
|
case "m": return 12 * s + a + c;
|
|
987
987
|
case "d": return o - r;
|
|
988
988
|
case "md": return h;
|
|
989
989
|
case "ym": return m;
|
|
990
|
-
case "yd": return
|
|
990
|
+
case "yd": return b.getSerialDate(i.year, i.month + m, i.day) + h - r;
|
|
991
991
|
}
|
|
992
992
|
return NaN;
|
|
993
993
|
}
|
|
994
|
-
function
|
|
995
|
-
const r = void 0 === e ? 0 :
|
|
994
|
+
function Vn(t, n, e = 0) {
|
|
995
|
+
const r = void 0 === e ? 0 : L(e), o = Math.trunc(r);
|
|
996
996
|
if (r < 0 || o > 4) return NaN;
|
|
997
|
-
const i =
|
|
998
|
-
if (!
|
|
999
|
-
const u =
|
|
1000
|
-
return
|
|
1001
|
-
}
|
|
1002
|
-
function
|
|
1003
|
-
if (!
|
|
1004
|
-
const r = Math.floor(t),
|
|
1005
|
-
return e ? (
|
|
1006
|
-
const e =
|
|
997
|
+
const i = k(t);
|
|
998
|
+
if (!J(i)) return NaN;
|
|
999
|
+
const u = k(n);
|
|
1000
|
+
return J(u) ? tt(i, u, o) : NaN;
|
|
1001
|
+
}
|
|
1002
|
+
function Tn(t, n, e = !1) {
|
|
1003
|
+
if (!J(t) || !J(n)) return NaN;
|
|
1004
|
+
const r = .5 / 86400, o = Math.floor(t + r), i = Math.floor(n + r);
|
|
1005
|
+
return e ? (i >= o ? 1 : -1) * Q(o, i, 4).days : function(t, n) {
|
|
1006
|
+
const e = K(t), r = K(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 ===
|
|
1009
|
-
}(
|
|
1010
|
-
}
|
|
1011
|
-
var
|
|
1012
|
-
AMORLINC: () =>
|
|
1013
|
-
DB: () =>
|
|
1014
|
-
DDB: () =>
|
|
1015
|
-
SLN: () =>
|
|
1016
|
-
SYD: () =>
|
|
1008
|
+
return 2 === i ? 3 === K(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
|
+
}(o, i);
|
|
1010
|
+
}
|
|
1011
|
+
var Pn = A({
|
|
1012
|
+
AMORLINC: () => qn,
|
|
1013
|
+
DB: () => kn,
|
|
1014
|
+
DDB: () => Ln,
|
|
1015
|
+
SLN: () => On,
|
|
1016
|
+
SYD: () => $n
|
|
1017
1017
|
});
|
|
1018
|
-
function
|
|
1019
|
-
if (
|
|
1018
|
+
function On(t, n, e) {
|
|
1019
|
+
if (b.formatResults(Bt(b.getRuntime())), 0 === e) throw B.BuiltIn.Div0;
|
|
1020
1020
|
return (t - n) / e;
|
|
1021
1021
|
}
|
|
1022
|
-
function
|
|
1023
|
-
if (
|
|
1022
|
+
function $n(t, n, e, r) {
|
|
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
|
-
if (!Number.isFinite(o)) throw
|
|
1025
|
+
if (!Number.isFinite(o)) throw B.BuiltIn.Div0;
|
|
1026
1026
|
return (t - n) * (e + 1 - r) / o;
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1029
|
-
if (
|
|
1028
|
+
function kn(t, n, e, r, o = 12) {
|
|
1029
|
+
if (b.formatResults(Bt(b.getRuntime())), t < 0 || n < 0 || e <= 0 || r <= 0) return NaN;
|
|
1030
1030
|
const i = Ct(o);
|
|
1031
1031
|
if (i < 1 || i > 12) return NaN;
|
|
1032
1032
|
const u = Ct(e), s = Ct(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 = Rt(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,14 +1040,14 @@ function Ln(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
|
|
1044
|
-
if (
|
|
1045
|
-
const i = o / e, u = Math.max(r, 1) - 1, s = 0 === u ? t : t *
|
|
1043
|
+
function Ln(t, n, e, r, o = 2) {
|
|
1044
|
+
if (b.formatResults(Bt(b.getRuntime())), t < 0 || n < 0 || e <= 0 || r <= 0 || r > e || o <= 0) return NaN;
|
|
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;
|
|
1047
1047
|
return Number.isFinite(a) ? (s - a < n && (a = s - n), Math.max(a, 0)) : NaN;
|
|
1048
1048
|
}
|
|
1049
|
-
function
|
|
1050
|
-
const s =
|
|
1049
|
+
function qn(t, n, e, r, o, i, u = 0) {
|
|
1050
|
+
const s = bt(t, n, e, r, o, i, u);
|
|
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;
|
|
@@ -1056,75 +1056,75 @@ function _n(t, n, e, r, o, i, u = 0) {
|
|
|
1056
1056
|
const d = Math.floor((g - p) / N);
|
|
1057
1057
|
return f <= d ? N : f === d + 1 ? (g - p) % N : 0;
|
|
1058
1058
|
}
|
|
1059
|
-
var
|
|
1060
|
-
FVSCHEDULE: () =>
|
|
1061
|
-
PDURATION: () =>
|
|
1062
|
-
RRI: () =>
|
|
1059
|
+
var _n = A({
|
|
1060
|
+
FVSCHEDULE: () => jn,
|
|
1061
|
+
PDURATION: () => Yn,
|
|
1062
|
+
RRI: () => Un
|
|
1063
1063
|
});
|
|
1064
|
-
function
|
|
1065
|
-
if (void 0 === t || void 0 === n) throw
|
|
1066
|
-
let e =
|
|
1067
|
-
const r =
|
|
1068
|
-
if (!i || u) e *= 1 +
|
|
1064
|
+
function jn(t, n) {
|
|
1065
|
+
if (void 0 === t || void 0 === n) throw B.BuiltIn.NA;
|
|
1066
|
+
let e = q(t);
|
|
1067
|
+
const r = b.getArgs().getRawAt(1), o = r, i = !0 === o?.isIRange, u = i && 1 === o.size && !0 === o.isIReferenceRange;
|
|
1068
|
+
if (!i || u) e *= 1 + q(i ? o.getValueAt(0, 0) ?? null : r);
|
|
1069
1069
|
else for (const t of n.values()) if (null != t) {
|
|
1070
|
-
if (
|
|
1071
|
-
if ("number" != typeof t) throw
|
|
1070
|
+
if (B.isError(t)) throw t;
|
|
1071
|
+
if ("number" != typeof t) throw B.BuiltIn.Value;
|
|
1072
1072
|
e *= 1 + t;
|
|
1073
1073
|
}
|
|
1074
1074
|
return Number.isFinite(e) ? e : 0;
|
|
1075
1075
|
}
|
|
1076
|
-
function
|
|
1076
|
+
function Un(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
|
-
const r =
|
|
1079
|
+
const r = xt(e / n, 1 / t) - 1;
|
|
1080
1080
|
return Number.isFinite(r) ? r : NaN;
|
|
1081
1081
|
}
|
|
1082
|
-
function
|
|
1082
|
+
function Yn(t, n, e) {
|
|
1083
1083
|
if (t <= 0 || n <= 0 || e <= 0) return NaN;
|
|
1084
1084
|
const r = Math.log(1 + t);
|
|
1085
|
-
if (0 === r) throw
|
|
1085
|
+
if (0 === r) throw B.BuiltIn.Div0;
|
|
1086
1086
|
return (Math.log(e) - Math.log(n)) / r;
|
|
1087
1087
|
}
|
|
1088
|
-
function
|
|
1088
|
+
function zn(t, n, e, r) {
|
|
1089
1089
|
const o = t.map((t) => {
|
|
1090
|
-
const n =
|
|
1091
|
-
if (!
|
|
1090
|
+
const n = k(t);
|
|
1091
|
+
if (!J(n)) throw B.BuiltIn.Num;
|
|
1092
1092
|
return Math.floor(n);
|
|
1093
|
-
}), i = n.map(
|
|
1094
|
-
if (1 !== u && 2 !== u && 4 !== u) throw
|
|
1093
|
+
}), i = n.map(q), u = Math.trunc(q(e));
|
|
1094
|
+
if (1 !== u && 2 !== u && 4 !== u) throw B.BuiltIn.Num;
|
|
1095
1095
|
return {
|
|
1096
1096
|
dates: o,
|
|
1097
1097
|
numbers: i,
|
|
1098
1098
|
frequency: u,
|
|
1099
|
-
basis:
|
|
1099
|
+
basis: it(r)
|
|
1100
1100
|
};
|
|
1101
1101
|
}
|
|
1102
|
-
var
|
|
1102
|
+
var Gn = (t) => H(t.y, t.m, t.d);
|
|
1103
1103
|
function Xn(t, n, e) {
|
|
1104
|
-
const r =
|
|
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, H(i, o, r ? z(i, o) : Math.min(t.d, z(i, o)));
|
|
1108
1108
|
}
|
|
1109
|
-
var
|
|
1110
|
-
function
|
|
1109
|
+
var Hn = (t, n) => 360 * (n.y - t.y) + 30 * (n.m - t.m) + (n.d - t.d);
|
|
1110
|
+
function Wn(t, n) {
|
|
1111
1111
|
return 0 !== t && 4 !== t ? (t, n) => n - t : (e, r) => {
|
|
1112
1112
|
const o = X(e), i = X(r);
|
|
1113
|
-
return 4 === t ? (31 === o.d && (o.d = 30), 31 === i.d && (i.d = 30),
|
|
1113
|
+
return 4 === t ? (31 === o.d && (o.d = 30), 31 === i.d && (i.d = 30), Hn(o, i)) : (G(o) && (o.d = 30), n && G(i) && (i.d = 30), Hn(o, i));
|
|
1114
1114
|
};
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1117
|
-
const i = 12 / r, u = X(e), s =
|
|
1116
|
+
function Kn(t, n, e, r, o) {
|
|
1117
|
+
const i = 12 / r, u = X(e), s = Wn(o, !1), a = Wn(o, !0);
|
|
1118
1118
|
let l = X(n);
|
|
1119
|
-
for (;
|
|
1120
|
-
if (
|
|
1119
|
+
for (; Gn(l) > e;) l = W(l, -i);
|
|
1120
|
+
if (Gn(l) < 1) throw B.BuiltIn.Num;
|
|
1121
1121
|
let f = 1;
|
|
1122
1122
|
for (; Xn(u, f, i) < n;) f++;
|
|
1123
|
-
if (Xn(u, f, i) > 2958465) throw
|
|
1123
|
+
if (Xn(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 =
|
|
1127
|
-
const r =
|
|
1126
|
+
g = W(g, i);
|
|
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
|
}
|
|
1130
1130
|
return {
|
|
@@ -1133,21 +1133,21 @@ function Zn(t, n, e, r, o) {
|
|
|
1133
1133
|
DSC: m
|
|
1134
1134
|
};
|
|
1135
1135
|
}
|
|
1136
|
-
function
|
|
1137
|
-
if (
|
|
1138
|
-
const u = 12 / o, s =
|
|
1139
|
-
if (Number.isNaN(s)) throw
|
|
1136
|
+
function Zn(t, n, e, r, o, i) {
|
|
1137
|
+
if (Nn(r, n, o) !== r) throw B.BuiltIn.Num;
|
|
1138
|
+
const u = 12 / o, s = pn(e, r, o);
|
|
1139
|
+
if (Number.isNaN(s)) throw B.BuiltIn.Num;
|
|
1140
1140
|
const a = [r];
|
|
1141
1141
|
let l = X(r);
|
|
1142
|
-
for (let t = 0; t < s; t++) l =
|
|
1143
|
-
if (a[a.length - 1] < 1) throw
|
|
1144
|
-
const f = (t, n) =>
|
|
1145
|
-
if (Number.isNaN(c.N)) throw
|
|
1142
|
+
for (let t = 0; t < s; t++) l = W(l, -u), a.push(Gn(l));
|
|
1143
|
+
if (a[a.length - 1] < 1) throw B.BuiltIn.Num;
|
|
1144
|
+
const f = (t, n) => Q(t, n, i).days, c = wn(t, r, o, i);
|
|
1145
|
+
if (Number.isNaN(c.N)) throw B.BuiltIn.Num;
|
|
1146
1146
|
const h = c.E, m = f(e, r);
|
|
1147
|
-
if (m === h) throw
|
|
1147
|
+
if (m === h) throw B.BuiltIn.Num;
|
|
1148
1148
|
if (m < h) {
|
|
1149
|
-
const i =
|
|
1150
|
-
if (Number.isNaN(i)) throw
|
|
1149
|
+
const i = pn(t, n, o) - 1;
|
|
1150
|
+
if (Number.isNaN(i)) throw B.BuiltIn.Num;
|
|
1151
1151
|
return {
|
|
1152
1152
|
N: i,
|
|
1153
1153
|
A: f(e, t) / h,
|
|
@@ -1155,25 +1155,25 @@ function Qn(t, n, e, r, o, i) {
|
|
|
1155
1155
|
u: f(t, r) / h
|
|
1156
1156
|
};
|
|
1157
1157
|
}
|
|
1158
|
-
const N =
|
|
1158
|
+
const N = pn(r, n, o);
|
|
1159
1159
|
let g = 0, p = 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
1162
|
t > c && u > c && (g += f(c, Math.min(u, t)) / l), p += 0 === n ? u > e ? f(e, u) / l : 0 : 1;
|
|
1163
1163
|
}
|
|
1164
|
-
const d = X(t), y =
|
|
1164
|
+
const d = X(t), y = H(d.y, d.m, z(d.y, d.m)), M = y < r && gn(y - 1, r, o) === y, I = G(X(r)) && t !== y && !M ? 1 : 0;
|
|
1165
1165
|
return {
|
|
1166
1166
|
N,
|
|
1167
1167
|
A: g,
|
|
1168
1168
|
DC: p,
|
|
1169
|
-
u: c.N - 1 + I + (2 === i || 3 === i ?
|
|
1169
|
+
u: c.N - 1 + I + (2 === i || 3 === i ? gn(t, r, o) - t : c.DSC) / h
|
|
1170
1170
|
};
|
|
1171
1171
|
}
|
|
1172
|
-
var
|
|
1173
|
-
function
|
|
1172
|
+
var Qn = (t) => Number.isFinite(t) ? t : 0;
|
|
1173
|
+
function Jn(t, n, e) {
|
|
1174
1174
|
return (100 * t + (100 - n) / e) / ((100 + n) / 2 - (100 - n) / (4 * e));
|
|
1175
1175
|
}
|
|
1176
|
-
function
|
|
1176
|
+
function te(t, n, e) {
|
|
1177
1177
|
let r = t;
|
|
1178
1178
|
for (let t = 0; t < 100; t++) {
|
|
1179
1179
|
const t = e(r);
|
|
@@ -1185,23 +1185,23 @@ function ne(t, n, e) {
|
|
|
1185
1185
|
}
|
|
1186
1186
|
return r;
|
|
1187
1187
|
}
|
|
1188
|
-
var
|
|
1189
|
-
ODDFPRICE: () =>
|
|
1190
|
-
ODDFYIELD: () =>
|
|
1191
|
-
ODDLPRICE: () =>
|
|
1192
|
-
ODDLYIELD: () =>
|
|
1188
|
+
var ne = A({
|
|
1189
|
+
ODDFPRICE: () => re,
|
|
1190
|
+
ODDFYIELD: () => oe,
|
|
1191
|
+
ODDLPRICE: () => ie,
|
|
1192
|
+
ODDLYIELD: () => ue
|
|
1193
1193
|
});
|
|
1194
|
-
function
|
|
1195
|
-
const { N: l, A: f, DC: c, u: h } =
|
|
1196
|
-
if (!Number.isFinite(g)) throw
|
|
1194
|
+
function ee(t, n, e, r, o, i, u, s, a) {
|
|
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
|
+
if (!Number.isFinite(g)) throw B.BuiltIn.Num;
|
|
1197
1197
|
let p = 0;
|
|
1198
|
-
for (let t = 1; t <= l; t++) p += N /
|
|
1199
|
-
const d = u / g + N * c /
|
|
1200
|
-
if (!Number.isFinite(d)) throw
|
|
1198
|
+
for (let t = 1; t <= l; t++) p += N / xt(1 + m, t + h);
|
|
1199
|
+
const d = u / g + N * c / xt(1 + m, h) + p - N * f;
|
|
1200
|
+
if (!Number.isFinite(d)) throw B.BuiltIn.Num;
|
|
1201
1201
|
return d;
|
|
1202
1202
|
}
|
|
1203
|
-
function
|
|
1204
|
-
const l =
|
|
1203
|
+
function re(t, n, e, r, o, i, u, s, a = 0) {
|
|
1204
|
+
const l = zn([
|
|
1205
1205
|
t,
|
|
1206
1206
|
n,
|
|
1207
1207
|
e,
|
|
@@ -1211,11 +1211,11 @@ function oe(t, n, e, r, o, i, u, s, a = 0) {
|
|
|
1211
1211
|
i,
|
|
1212
1212
|
u
|
|
1213
1213
|
], s, a), [f, c, h, m] = l.dates, [N, g, p] = l.numbers;
|
|
1214
|
-
if (!(h < f && f < m && m < c) || N < 0 || g < 0 || p <= 0) throw
|
|
1215
|
-
return
|
|
1214
|
+
if (!(h < f && f < m && m < c) || N < 0 || g < 0 || p <= 0) throw B.BuiltIn.Num;
|
|
1215
|
+
return ee(f, c, h, m, N, g, p, l.frequency, l.basis);
|
|
1216
1216
|
}
|
|
1217
|
-
function
|
|
1218
|
-
const l =
|
|
1217
|
+
function oe(t, n, e, r, o, i, u, s, a = 0) {
|
|
1218
|
+
const l = zn([
|
|
1219
1219
|
t,
|
|
1220
1220
|
n,
|
|
1221
1221
|
e,
|
|
@@ -1225,26 +1225,26 @@ function ie(t, n, e, r, o, i, u, s, a = 0) {
|
|
|
1225
1225
|
i,
|
|
1226
1226
|
u
|
|
1227
1227
|
], s, a), [f, c, h, m] = l.dates, [N, g, p] = l.numbers;
|
|
1228
|
-
if (!(h < f && f < m && m < c) || N < 0 || g <= 0 || p <= 0) throw
|
|
1229
|
-
|
|
1230
|
-
const d =
|
|
1228
|
+
if (!(h < f && f < m && m < c) || N < 0 || g <= 0 || p <= 0) throw B.BuiltIn.Num;
|
|
1229
|
+
Zn(f, c, h, m, l.frequency, l.basis);
|
|
1230
|
+
const d = te(Jn(N, g, nt(f, c, l.basis)), (t) => {
|
|
1231
1231
|
try {
|
|
1232
|
-
return
|
|
1232
|
+
return ee(f, c, h, m, N, t, p, l.frequency, l.basis) - g;
|
|
1233
1233
|
} catch {
|
|
1234
1234
|
return NaN;
|
|
1235
1235
|
}
|
|
1236
1236
|
}, (t) => function(t, n, e, r, o, i, u, s, a) {
|
|
1237
|
-
const { N: l, DC: f, u: c } =
|
|
1238
|
-
let N = -u * (l + c) / s /
|
|
1239
|
-
N += -m * f * c / s /
|
|
1240
|
-
for (let t = 1; t <= l; t++) N += -m * (t + c) / s /
|
|
1237
|
+
const { N: l, DC: f, u: c } = Zn(t, n, e, r, s, a), h = 1 + i / s, m = 100 * o / s;
|
|
1238
|
+
let N = -u * (l + c) / s / xt(h, l + c + 1);
|
|
1239
|
+
N += -m * f * c / s / xt(h, c + 1);
|
|
1240
|
+
for (let t = 1; t <= l; t++) N += -m * (t + c) / s / xt(h, t + c + 1);
|
|
1241
1241
|
return N;
|
|
1242
1242
|
}(f, c, h, m, N, t, p, l.frequency, l.basis));
|
|
1243
|
-
if (!Number.isFinite(d)) throw
|
|
1243
|
+
if (!Number.isFinite(d)) throw B.BuiltIn.Num;
|
|
1244
1244
|
return d;
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1247
|
-
const a =
|
|
1246
|
+
function ie(t, n, e, r, o, i, u, s = 0) {
|
|
1247
|
+
const a = zn([
|
|
1248
1248
|
t,
|
|
1249
1249
|
n,
|
|
1250
1250
|
e
|
|
@@ -1253,12 +1253,12 @@ function ue(t, n, e, r, o, i, u, s = 0) {
|
|
|
1253
1253
|
o,
|
|
1254
1254
|
i
|
|
1255
1255
|
], u, s), [l, f, c] = a.dates, [h, m, N] = a.numbers;
|
|
1256
|
-
if (!(c < l && l < f) || h < 0 || m < 0 || N <= 0) throw
|
|
1257
|
-
const { A: g, DC: p, DSC: d } =
|
|
1258
|
-
return (N +
|
|
1256
|
+
if (!(c < l && l < f) || h < 0 || m < 0 || N <= 0) throw B.BuiltIn.Num;
|
|
1257
|
+
const { A: g, DC: p, DSC: d } = Kn(l, f, c, a.frequency, a.basis), y = 100 * h / a.frequency;
|
|
1258
|
+
return (N + Qn(y * p)) / (1 + m / a.frequency * d) - Qn(y * g);
|
|
1259
1259
|
}
|
|
1260
|
-
function
|
|
1261
|
-
const a =
|
|
1260
|
+
function ue(t, n, e, r, o, i, u, s = 0) {
|
|
1261
|
+
const a = zn([
|
|
1262
1262
|
t,
|
|
1263
1263
|
n,
|
|
1264
1264
|
e
|
|
@@ -1267,147 +1267,136 @@ function se(t, n, e, r, o, i, u, s = 0) {
|
|
|
1267
1267
|
o,
|
|
1268
1268
|
i
|
|
1269
1269
|
], u, s), [l, f, c] = a.dates, [h, m, N] = a.numbers;
|
|
1270
|
-
if (!(c < l && l < f) || h < 0 || m <= 0 || N <= 0) throw
|
|
1271
|
-
const { A: g, DC: p, DSC: d } =
|
|
1270
|
+
if (!(c < l && l < f) || h < 0 || m <= 0 || N <= 0) throw B.BuiltIn.Num;
|
|
1271
|
+
const { A: g, DC: p, DSC: d } = Kn(l, f, c, a.frequency, a.basis), y = 100 * h / a.frequency, M = N + Qn(y * p), I = m + Qn(y * g);
|
|
1272
1272
|
return (M - I) / I * (a.frequency / d);
|
|
1273
1273
|
}
|
|
1274
|
-
var
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
3,
|
|
1280
|
-
4
|
|
1281
|
-
]) {
|
|
1282
|
-
const u = e ?? n;
|
|
1283
|
-
if (!B.isValidDate(n) || !B.isValidDate(u)) throw x.BuiltIn.Num;
|
|
1284
|
-
}
|
|
1285
|
-
var fe = v({
|
|
1286
|
-
DURATION: () => he,
|
|
1287
|
-
MDURATION: () => me,
|
|
1288
|
-
PRICE: () => ce,
|
|
1289
|
-
YIELD: () => Ne
|
|
1274
|
+
var se = A({
|
|
1275
|
+
DURATION: () => le,
|
|
1276
|
+
MDURATION: () => fe,
|
|
1277
|
+
PRICE: () => ae,
|
|
1278
|
+
YIELD: () => ce
|
|
1290
1279
|
});
|
|
1291
|
-
function
|
|
1292
|
-
const s =
|
|
1280
|
+
function ae(t, n, e, r, o, i, u = 0) {
|
|
1281
|
+
const s = ft(t, n, [
|
|
1293
1282
|
e,
|
|
1294
1283
|
r,
|
|
1295
1284
|
o
|
|
1296
1285
|
], i, u), [a, l, f] = s.numbers;
|
|
1297
|
-
if (a < 0 || l < 0 || f <= 0) throw
|
|
1298
|
-
return
|
|
1286
|
+
if (a < 0 || l < 0 || f <= 0) throw B.BuiltIn.Num;
|
|
1287
|
+
return bn(s.settlement, s.maturity, a, l, f, s.frequency, s.basis);
|
|
1299
1288
|
}
|
|
1300
|
-
function
|
|
1301
|
-
const u =
|
|
1302
|
-
if (s < 0 || a < 0) throw
|
|
1303
|
-
return
|
|
1289
|
+
function le(t, n, e, r, o, i = 0) {
|
|
1290
|
+
const u = ft(t, n, [e, r], o, i, !0), [s, a] = u.numbers;
|
|
1291
|
+
if (s < 0 || a < 0) throw B.BuiltIn.Num;
|
|
1292
|
+
return Bn(u.settlement, u.maturity, s, a, u.frequency, u.basis);
|
|
1304
1293
|
}
|
|
1305
|
-
function
|
|
1306
|
-
const u =
|
|
1307
|
-
if (s < 0 || a < 0) throw
|
|
1308
|
-
return
|
|
1294
|
+
function fe(t, n, e, r, o, i = 0) {
|
|
1295
|
+
const u = ft(t, n, [e, r], o, i, !0), [s, a] = u.numbers;
|
|
1296
|
+
if (s < 0 || a < 0) throw B.BuiltIn.Num;
|
|
1297
|
+
return Bn(u.settlement, u.maturity, s, a, u.frequency, u.basis) / (1 + a / u.frequency);
|
|
1309
1298
|
}
|
|
1310
|
-
function
|
|
1311
|
-
const s =
|
|
1299
|
+
function ce(t, n, e, r, o, i, u = 0) {
|
|
1300
|
+
const s = ft(t, n, [
|
|
1312
1301
|
e,
|
|
1313
1302
|
r,
|
|
1314
1303
|
o
|
|
1315
1304
|
], i, u), [a, l, f] = s.numbers;
|
|
1316
|
-
if (a < 0 || l <= 0 || f <= 0) throw
|
|
1317
|
-
const { settlement: c, maturity: h, frequency: m, basis: N } = s, g =
|
|
1318
|
-
if (Number.isNaN(g.N)) throw
|
|
1305
|
+
if (a < 0 || l <= 0 || f <= 0) throw B.BuiltIn.Num;
|
|
1306
|
+
const { settlement: c, maturity: h, frequency: m, basis: N } = s, g = wn(c, h, m, N);
|
|
1307
|
+
if (Number.isNaN(g.N)) throw B.BuiltIn.Num;
|
|
1319
1308
|
if (g.N > 1) {
|
|
1320
|
-
const t =
|
|
1321
|
-
const { N: s, A: a, E: l, DSC: f } =
|
|
1309
|
+
const t = te(Jn(a, l, nt(c, h, N)), (t) => bn(c, h, a, t, f, m, N) - l, (t) => function(t, n, e, r, o, i, u) {
|
|
1310
|
+
const { N: s, A: a, E: l, DSC: f } = wn(t, n, i, u);
|
|
1322
1311
|
if (Number.isNaN(s)) return NaN;
|
|
1323
1312
|
const c = 100 * e / i, h = 1 + r / i;
|
|
1324
1313
|
let m = -o * (s - 1 + f / l) / i / h ** (s + f / l);
|
|
1325
1314
|
for (let t = 1; t <= s; t++) m += -c * (t - 1 + f / l) / i / h ** (t + f / l);
|
|
1326
1315
|
return m;
|
|
1327
1316
|
}(c, h, a, t, f, m, N));
|
|
1328
|
-
if (Number.isNaN(t)) throw
|
|
1317
|
+
if (Number.isNaN(t)) throw B.BuiltIn.Num;
|
|
1329
1318
|
return t;
|
|
1330
1319
|
}
|
|
1331
|
-
const p = g.A, d =
|
|
1332
|
-
return
|
|
1333
|
-
}
|
|
1334
|
-
var
|
|
1335
|
-
DISC: () =>
|
|
1336
|
-
INTRATE: () =>
|
|
1337
|
-
PRICEDISC: () =>
|
|
1338
|
-
PRICEMAT: () =>
|
|
1339
|
-
RECEIVED: () =>
|
|
1340
|
-
YIELDDISC: () =>
|
|
1341
|
-
YIELDMAT: () =>
|
|
1320
|
+
const p = g.A, d = Q(c, h, N).days, y = 1 === N || 2 === N || 3 === N ? p + d : g.E, M = l / 100 + p / y * (a / m);
|
|
1321
|
+
return ct((f / 100 + a / m - M) / M * m * (y / d));
|
|
1322
|
+
}
|
|
1323
|
+
var he = A({
|
|
1324
|
+
DISC: () => me,
|
|
1325
|
+
INTRATE: () => pe,
|
|
1326
|
+
PRICEDISC: () => Ne,
|
|
1327
|
+
PRICEMAT: () => ye,
|
|
1328
|
+
RECEIVED: () => de,
|
|
1329
|
+
YIELDDISC: () => ge,
|
|
1330
|
+
YIELDMAT: () => Me
|
|
1342
1331
|
});
|
|
1343
|
-
function
|
|
1344
|
-
const i =
|
|
1332
|
+
function me(t, n, e, r, o = 0) {
|
|
1333
|
+
const i = st(t, n, e, r, o), u = (1 - i.x / i.y) / tt(i.settlement, i.maturity, i.basis);
|
|
1345
1334
|
return Number.isFinite(u) ? u : NaN;
|
|
1346
1335
|
}
|
|
1347
|
-
function
|
|
1348
|
-
const i =
|
|
1336
|
+
function Ne(t, n, e, r, o = 0) {
|
|
1337
|
+
const i = st(t, n, e, r, o), u = i.y - i.x * i.y * tt(i.settlement, i.maturity, i.basis);
|
|
1349
1338
|
return Number.isFinite(u) ? u : NaN;
|
|
1350
1339
|
}
|
|
1351
|
-
function
|
|
1352
|
-
const i =
|
|
1340
|
+
function ge(t, n, e, r, o = 0) {
|
|
1341
|
+
const i = st(t, n, e, r, o), u = (i.y - i.x) / i.x / tt(i.settlement, i.maturity, i.basis);
|
|
1353
1342
|
return Number.isFinite(u) ? u : NaN;
|
|
1354
1343
|
}
|
|
1355
|
-
function
|
|
1356
|
-
const i =
|
|
1344
|
+
function pe(t, n, e, r, o = 0) {
|
|
1345
|
+
const i = st(t, n, e, r, o), u = (i.y - i.x) / i.x / tt(i.settlement, i.maturity, i.basis);
|
|
1357
1346
|
return Number.isFinite(u) ? u : NaN;
|
|
1358
1347
|
}
|
|
1359
|
-
function
|
|
1360
|
-
const i =
|
|
1361
|
-
if (!(u > 0)) throw
|
|
1348
|
+
function de(t, n, e, r, o = 0) {
|
|
1349
|
+
const i = st(t, n, e, r, o), u = 1 - i.y * tt(i.settlement, i.maturity, i.basis);
|
|
1350
|
+
if (!(u > 0)) throw B.BuiltIn.Num;
|
|
1362
1351
|
return i.x / u;
|
|
1363
1352
|
}
|
|
1364
|
-
function
|
|
1365
|
-
const u =
|
|
1366
|
-
if (u.rate < 0 || u.x < 0) throw
|
|
1367
|
-
return (100 +
|
|
1353
|
+
function ye(t, n, e, r, o, i = 0) {
|
|
1354
|
+
const u = lt(t, n, e, r, o, i);
|
|
1355
|
+
if (u.rate < 0 || u.x < 0) throw B.BuiltIn.Num;
|
|
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);
|
|
1368
1357
|
}
|
|
1369
|
-
function
|
|
1370
|
-
const u =
|
|
1371
|
-
if (u.rate < 0 || u.x <= 0) throw
|
|
1358
|
+
function Me(t, n, e, r, o, i = 0) {
|
|
1359
|
+
const u = lt(t, n, e, r, o, i);
|
|
1360
|
+
if (u.rate < 0 || u.x <= 0) throw B.BuiltIn.Num;
|
|
1372
1361
|
return ((1 + u.DIM / u.B * u.rate) / (u.x / 100 + u.A / u.B * u.rate) - 1) / (u.DSM / u.B);
|
|
1373
1362
|
}
|
|
1374
|
-
var
|
|
1375
|
-
TBILLEQ: () =>
|
|
1376
|
-
TBILLPRICE: () =>
|
|
1377
|
-
TBILLYIELD: () =>
|
|
1363
|
+
var Ie = A({
|
|
1364
|
+
TBILLEQ: () => Be,
|
|
1365
|
+
TBILLPRICE: () => we,
|
|
1366
|
+
TBILLYIELD: () => be
|
|
1378
1367
|
});
|
|
1379
|
-
function
|
|
1380
|
-
const r =
|
|
1381
|
-
if (o < 0) throw
|
|
1368
|
+
function we(t, n, e) {
|
|
1369
|
+
const r = at(t, n, e), o = 100 * (1 - ct(r.x * r.days) / 360);
|
|
1370
|
+
if (o < 0) throw B.BuiltIn.Num;
|
|
1382
1371
|
return o;
|
|
1383
1372
|
}
|
|
1384
|
-
function
|
|
1385
|
-
const r =
|
|
1373
|
+
function be(t, n, e) {
|
|
1374
|
+
const r = at(t, n, e);
|
|
1386
1375
|
return (100 - r.x) / r.x * 360 / r.days;
|
|
1387
1376
|
}
|
|
1388
|
-
function
|
|
1389
|
-
const r =
|
|
1377
|
+
function Be(t, n, e) {
|
|
1378
|
+
const r = at(t, n, e), o = ct(r.x * r.days);
|
|
1390
1379
|
if (r.days <= 182) {
|
|
1391
1380
|
const t = 360 - o;
|
|
1392
|
-
if (!(t > 0)) throw
|
|
1393
|
-
return
|
|
1381
|
+
if (!(t > 0)) throw B.BuiltIn.Num;
|
|
1382
|
+
return ct(365 * r.x) / t;
|
|
1394
1383
|
}
|
|
1395
1384
|
const i = 1 - o / 360;
|
|
1396
|
-
if (!(i > 0)) throw
|
|
1385
|
+
if (!(i > 0)) throw B.BuiltIn.Num;
|
|
1397
1386
|
const u = r.days / (r.days > 365 ? 366 : 365);
|
|
1398
1387
|
return (-2 * u + 2 * Math.sqrt(u * u - (2 * u - 1) * (1 - 1 / i))) / (2 * u - 1);
|
|
1399
1388
|
}
|
|
1400
|
-
var
|
|
1401
|
-
function
|
|
1402
|
-
if (
|
|
1403
|
-
if (0 === e) throw
|
|
1389
|
+
var xe = A({ VDB: () => Re }), Ce = 1e7;
|
|
1390
|
+
function Re(t, n, e, r, o, i = 2, u = !1) {
|
|
1391
|
+
if (b.formatResults(Bt(b.getRuntime())), t < 0 || n < 0 || e < 0 || i < 0 || r < 0 || o > e || r > o) return NaN;
|
|
1392
|
+
if (0 === e) throw B.BuiltIn.Div0;
|
|
1404
1393
|
if (r === o) return 0;
|
|
1405
1394
|
const s = i / e;
|
|
1406
1395
|
if (u) return function(t, n, e, r, o, i) {
|
|
1407
1396
|
const u = Math.floor(r) + 1, s = Math.ceil(o);
|
|
1408
1397
|
let a = 0;
|
|
1409
1398
|
for (let e = u; e <= s; e++) {
|
|
1410
|
-
let f =
|
|
1399
|
+
let f = Ee(1 === e ? t : t * xt(1 - i, e - 1), i, n);
|
|
1411
1400
|
if (Number.isNaN(f)) return NaN;
|
|
1412
1401
|
f = Math.max(f, 0), e === u ? f *= Math.min(o, u) - r : e === s && (f *= o - (s - 1)), a += f;
|
|
1413
1402
|
}
|
|
@@ -1417,7 +1406,7 @@ function ve(t, n, e, r, o, i = 2, u = !1) {
|
|
|
1417
1406
|
const i = Math.floor(o), u = o - i;
|
|
1418
1407
|
let s = t, a = !1, l = 0;
|
|
1419
1408
|
if (u > 0) {
|
|
1420
|
-
const t =
|
|
1409
|
+
const t = Ee(s, r, n);
|
|
1421
1410
|
if (Number.isNaN(t)) return NaN;
|
|
1422
1411
|
let o;
|
|
1423
1412
|
if (l = (s - n) / e, l > t && l > 0) o = l * u;
|
|
@@ -1427,12 +1416,12 @@ function ve(t, n, e, r, o, i = 2, u = !1) {
|
|
|
1427
1416
|
}
|
|
1428
1417
|
s -= o;
|
|
1429
1418
|
}
|
|
1430
|
-
if (i >
|
|
1419
|
+
if (i > Ce) return s * xt(1 - r, i);
|
|
1431
1420
|
for (let t = 1; t <= i; t++) {
|
|
1432
1421
|
let o;
|
|
1433
1422
|
if (a) o = l;
|
|
1434
1423
|
else {
|
|
1435
|
-
if (o =
|
|
1424
|
+
if (o = Ee(s, r, n), Number.isNaN(o)) return NaN;
|
|
1436
1425
|
l = (s - n) / (e - (u + t - 1)), l > o && l > 0 && (a = !0, o = l);
|
|
1437
1426
|
}
|
|
1438
1427
|
s -= o;
|
|
@@ -1446,7 +1435,7 @@ function ve(t, n, e, r, o, i = 2, u = !1) {
|
|
|
1446
1435
|
let f;
|
|
1447
1436
|
if (s) f = a;
|
|
1448
1437
|
else {
|
|
1449
|
-
if (f =
|
|
1438
|
+
if (f = Ee(t, r, n), Number.isNaN(f)) return NaN;
|
|
1450
1439
|
a = (t - n) / (e - (l - 1)), a > f && a > 0 && (s = !0, f = a);
|
|
1451
1440
|
}
|
|
1452
1441
|
u += l === i ? f * (o - (i - 1)) : f, t -= f;
|
|
@@ -1454,25 +1443,25 @@ function ve(t, n, e, r, o, i = 2, u = !1) {
|
|
|
1454
1443
|
return u;
|
|
1455
1444
|
}(a, n, e - r, s, o - r);
|
|
1456
1445
|
}
|
|
1457
|
-
var
|
|
1446
|
+
var Ee = (t, n, e) => {
|
|
1458
1447
|
const r = t * n;
|
|
1459
1448
|
return Number.isFinite(r) ? t - r < e ? t - e : r : NaN;
|
|
1460
1449
|
};
|
|
1461
|
-
var
|
|
1450
|
+
var Ae = () => B.BuiltIn.Value, ve = (t, n) => {
|
|
1462
1451
|
let e, r = !1;
|
|
1463
1452
|
if (!0 === t?.isIFunction) e = [t];
|
|
1464
1453
|
else {
|
|
1465
|
-
if (!0 !== t?.isIRange) return
|
|
1454
|
+
if (!0 !== t?.isIRange) return Ae();
|
|
1466
1455
|
{
|
|
1467
1456
|
const n = t, o = n.getRowCount();
|
|
1468
|
-
if (o > 1 && n.getColumnCount() > 1) return
|
|
1457
|
+
if (o > 1 && n.getColumnCount() > 1) return Ae();
|
|
1469
1458
|
r = o > 1, e = [];
|
|
1470
1459
|
for (const t of n.entries()) {
|
|
1471
1460
|
const n = t.value;
|
|
1472
|
-
if (!0 !== n?.isIFunction) return
|
|
1461
|
+
if (!0 !== n?.isIFunction) return Ae();
|
|
1473
1462
|
e.push(n);
|
|
1474
1463
|
}
|
|
1475
|
-
if (0 === e.length || e.length !== n.size) return
|
|
1464
|
+
if (0 === e.length || e.length !== n.size) return Ae();
|
|
1476
1465
|
}
|
|
1477
1466
|
}
|
|
1478
1467
|
const o = [], i = (t, n) => {
|
|
@@ -1511,37 +1500,37 @@ var Fe = () => x.BuiltIn.Value, Se = (t, n) => {
|
|
|
1511
1500
|
measures: o,
|
|
1512
1501
|
vertical: r,
|
|
1513
1502
|
named: e.length > 1
|
|
1514
|
-
} :
|
|
1515
|
-
},
|
|
1503
|
+
} : Ae();
|
|
1504
|
+
}, De = (t, n, e) => {
|
|
1516
1505
|
let r;
|
|
1517
1506
|
try {
|
|
1518
1507
|
r = t.twoArgs ? t.fn.execute(n, e()) : t.fn.execute(n);
|
|
1519
1508
|
} catch (t) {
|
|
1520
|
-
if (
|
|
1509
|
+
if (B.isError(t)) return t;
|
|
1521
1510
|
throw t;
|
|
1522
1511
|
}
|
|
1523
1512
|
if (!0 === r?.isIRange) {
|
|
1524
1513
|
const t = r;
|
|
1525
|
-
return !0 === t.isIReferenceRange && 1 === t.size ? t.getValueAt(0, 0) :
|
|
1514
|
+
return !0 === t.isIReferenceRange && 1 === t.size ? t.getValueAt(0, 0) : Ae();
|
|
1526
1515
|
}
|
|
1527
1516
|
return r ?? null;
|
|
1528
|
-
},
|
|
1517
|
+
}, Fe = (t, n) => {
|
|
1529
1518
|
let e = t;
|
|
1530
|
-
if (void 0 === e) e =
|
|
1531
|
-
else if (!Number.isInteger(e) || e < 0 || e > 3) return
|
|
1519
|
+
if (void 0 === e) e = Ve(n) ? 1 : 0;
|
|
1520
|
+
else if (!Number.isInteger(e) || e < 0 || e > 3) return Ae();
|
|
1532
1521
|
return {
|
|
1533
1522
|
hasHeader: 1 === e || 3 === e,
|
|
1534
1523
|
show: 2 === e || 3 === e
|
|
1535
1524
|
};
|
|
1536
|
-
},
|
|
1525
|
+
}, Se = (t) => B.isError(t) ? "error" : typeof t, Ve = (t) => {
|
|
1537
1526
|
if (t.getRowCount() < 2) return !1;
|
|
1538
1527
|
const n = t.getColumnCount();
|
|
1539
1528
|
for (let e = 0; e < n; e++) {
|
|
1540
1529
|
const n = t.getValueAt(0, e), r = t.getValueAt(1, e);
|
|
1541
|
-
if (null !== n && null !== r &&
|
|
1530
|
+
if (null !== n && null !== r && Se(n) !== Se(r)) return !0;
|
|
1542
1531
|
}
|
|
1543
1532
|
return !1;
|
|
1544
|
-
},
|
|
1533
|
+
}, Te = (t, n) => Number.isInteger(t) && Math.abs(t) <= n, Pe = (t, n, e) => {
|
|
1545
1534
|
const r = new Array(n).fill(1);
|
|
1546
1535
|
if (!t) return {
|
|
1547
1536
|
keyDirections: r,
|
|
@@ -1550,11 +1539,11 @@ var Fe = () => x.BuiltIn.Value, Se = (t, n) => {
|
|
|
1550
1539
|
const o = [];
|
|
1551
1540
|
for (const r of t.entries()) {
|
|
1552
1541
|
const t = r.value;
|
|
1553
|
-
if ("number" != typeof t || !Number.isInteger(t) || 0 === t) return
|
|
1554
|
-
if (Math.abs(t) > n + e) return
|
|
1542
|
+
if ("number" != typeof t || !Number.isInteger(t) || 0 === t) return Ae();
|
|
1543
|
+
if (Math.abs(t) > n + e) return Ae();
|
|
1555
1544
|
o.push(t);
|
|
1556
1545
|
}
|
|
1557
|
-
if (o.length !== t.size) return
|
|
1546
|
+
if (o.length !== t.size) return Ae();
|
|
1558
1547
|
if (1 === o.length && Math.abs(o[0]) > n) return {
|
|
1559
1548
|
keyDirections: r,
|
|
1560
1549
|
byValue: {
|
|
@@ -1562,25 +1551,25 @@ var Fe = () => x.BuiltIn.Value, Se = (t, n) => {
|
|
|
1562
1551
|
direction: Math.sign(o[0])
|
|
1563
1552
|
}
|
|
1564
1553
|
};
|
|
1565
|
-
if (o.length > n) return
|
|
1554
|
+
if (o.length > n) return Ae();
|
|
1566
1555
|
const i = /* @__PURE__ */ new Set();
|
|
1567
1556
|
for (const t of o) {
|
|
1568
1557
|
const e = Math.abs(t);
|
|
1569
|
-
if (e > n || i.has(e)) return
|
|
1558
|
+
if (e > n || i.has(e)) return Ae();
|
|
1570
1559
|
i.add(e), r[e - 1] = Math.sign(t);
|
|
1571
1560
|
}
|
|
1572
1561
|
return {
|
|
1573
1562
|
keyDirections: r,
|
|
1574
1563
|
byValue: null
|
|
1575
1564
|
};
|
|
1576
|
-
},
|
|
1565
|
+
}, Oe = (t) => 1 === t.size && !0 === t.isIReferenceRange && null === t.getValueAt(0, 0), $e = (t, n) => {
|
|
1577
1566
|
if (1 !== t.getColumnCount() || t.getRowCount() !== n) return !1;
|
|
1578
1567
|
for (const n of t.entries()) {
|
|
1579
1568
|
const t = typeof n.value;
|
|
1580
1569
|
if ("boolean" !== t && "number" !== t) return !1;
|
|
1581
1570
|
}
|
|
1582
1571
|
return !0;
|
|
1583
|
-
},
|
|
1572
|
+
}, ke = class {
|
|
1584
1573
|
constructor(t, n) {
|
|
1585
1574
|
const e = t.getColumnCount(), r = t.getRowCount(), o = n ? { filter: n } : void 0, i = new Array(e), u = new Array(e);
|
|
1586
1575
|
for (let n = 0; n < e; n++) {
|
|
@@ -1590,7 +1579,7 @@ var Fe = () => x.BuiltIn.Value, Se = (t, n) => {
|
|
|
1590
1579
|
colStart: 0,
|
|
1591
1580
|
colEnd: n
|
|
1592
1581
|
});
|
|
1593
|
-
u[n] = s, i[n] =
|
|
1582
|
+
u[n] = s, i[n] = b.createGrouping(s, o);
|
|
1594
1583
|
}
|
|
1595
1584
|
let s = [];
|
|
1596
1585
|
const a = [];
|
|
@@ -1617,7 +1606,7 @@ var Fe = () => x.BuiltIn.Value, Se = (t, n) => {
|
|
|
1617
1606
|
return null === n ? this.groupings[this.fieldCount - 1].getMembers(t) : this.groupings[n.level].getMembers(t, [n.group]);
|
|
1618
1607
|
}
|
|
1619
1608
|
sort(t, n, e) {
|
|
1620
|
-
const r = (n, e, r) =>
|
|
1609
|
+
const r = (n, e, r) => Le(n.keys[r], e.keys[r], t.keyDirections[r]), o = t.byValue, i = (t, e) => qe(n(t), n(e), o.direction);
|
|
1621
1610
|
if (e) {
|
|
1622
1611
|
const t = [], n = (e) => {
|
|
1623
1612
|
for (const r of e) 0 === r.children.length ? t.push(r) : n(r.children);
|
|
@@ -1676,10 +1665,10 @@ var Fe = () => x.BuiltIn.Value, Se = (t, n) => {
|
|
|
1676
1665
|
}
|
|
1677
1666
|
return e;
|
|
1678
1667
|
}
|
|
1679
|
-
},
|
|
1680
|
-
const r =
|
|
1681
|
-
return r || o ? r && o ? 0 : r ? 1 : -1 : e *
|
|
1682
|
-
},
|
|
1668
|
+
}, Le = (t, n, e) => null === t || null === n ? t === n ? 0 : null === t ? 1 : -1 : e * b.compare(t, n), qe = (t, n, e) => {
|
|
1669
|
+
const r = B.isError(t), o = B.isError(n);
|
|
1670
|
+
return r || o ? r && o ? 0 : r ? 1 : -1 : e * b.compare(t, n);
|
|
1671
|
+
}, _e = (t) => `Row Field ${t + 1}`, je = (t) => `Column Field ${t + 1}`, Ue = (t) => `Value ${t + 1}`, Ye = (t) => {
|
|
1683
1672
|
const n = t.getColumnCount();
|
|
1684
1673
|
if (1 === n) return [t];
|
|
1685
1674
|
const e = t.getRowCount(), r = new Array(n);
|
|
@@ -1690,45 +1679,45 @@ var Fe = () => x.BuiltIn.Value, Se = (t, n) => {
|
|
|
1690
1679
|
colEnd: o
|
|
1691
1680
|
});
|
|
1692
1681
|
return r;
|
|
1693
|
-
},
|
|
1682
|
+
}, ze = (t) => t.slice({
|
|
1694
1683
|
rowStart: 1,
|
|
1695
1684
|
rowEnd: t.getRowCount() - 1,
|
|
1696
1685
|
colStart: 0,
|
|
1697
1686
|
colEnd: t.getColumnCount() - 1
|
|
1698
|
-
}),
|
|
1699
|
-
function
|
|
1700
|
-
if (t.getRowCount() !== n.getRowCount() ||
|
|
1701
|
-
const a =
|
|
1702
|
-
if (
|
|
1703
|
-
const l =
|
|
1704
|
-
if (
|
|
1687
|
+
}), Ge = A({ GROUPBY: () => Xe });
|
|
1688
|
+
function Xe(t, n, e, r, o = 1, i, u, s = 0) {
|
|
1689
|
+
if (t.getRowCount() !== n.getRowCount() || Oe(n)) return B.BuiltIn.Value;
|
|
1690
|
+
const a = ve(e, n.getColumnCount());
|
|
1691
|
+
if (B.isError(a)) return a;
|
|
1692
|
+
const l = Fe(r, n);
|
|
1693
|
+
if (B.isError(l)) return l;
|
|
1705
1694
|
const f = t.getColumnCount(), c = o;
|
|
1706
|
-
if (
|
|
1707
|
-
if (0 !== s && 1 !== s) return
|
|
1695
|
+
if (!Te(c, f)) return B.BuiltIn.Value;
|
|
1696
|
+
if (0 !== s && 1 !== s) return B.BuiltIn.Value;
|
|
1708
1697
|
const h = 1 === s;
|
|
1709
|
-
if ((h || a.vertical) && Math.abs(c) > 1) return
|
|
1710
|
-
if (u &&
|
|
1711
|
-
const { measures: m, vertical: N } = a, g = n.getColumnCount(), p =
|
|
1712
|
-
if (
|
|
1698
|
+
if ((h || a.vertical) && Math.abs(c) > 1) return B.BuiltIn.Value;
|
|
1699
|
+
if (u && !$e(u, t.getRowCount())) return B.BuiltIn.Value;
|
|
1700
|
+
const { measures: m, vertical: N } = a, g = n.getColumnCount(), p = Pe(i, f, N ? g : m.length);
|
|
1701
|
+
if (B.isError(p)) return p;
|
|
1713
1702
|
let d = t, y = n, M = u, I = null, w = null;
|
|
1714
1703
|
if (l.hasHeader) {
|
|
1715
|
-
if (d.getRowCount() < 2) return
|
|
1716
|
-
I =
|
|
1704
|
+
if (d.getRowCount() < 2) return B.BuiltIn.Value;
|
|
1705
|
+
I = He(d), w = He(y), d = ze(d), y = ze(y), M && (M = ze(M));
|
|
1717
1706
|
}
|
|
1718
|
-
const
|
|
1719
|
-
if (0 ===
|
|
1720
|
-
const
|
|
1707
|
+
const x = new ke(d, M);
|
|
1708
|
+
if (0 === x.getRecordCount()) return B.BuiltIn.Value;
|
|
1709
|
+
const C = Ye(y), R = new Array(C.length), E = /* @__PURE__ */ new Map(), A = (t) => {
|
|
1721
1710
|
let n = E.get(t);
|
|
1722
|
-
return n || (n = m.map((n) => (N ?
|
|
1723
|
-
}, v = p.byValue, D =
|
|
1711
|
+
return n || (n = m.map((n) => (N ? C.map((t, n) => n) : [n.column]).map((e) => De(n, x.getMembers(C[e], t), ((t) => () => R[t] ??= x.getMembers(C[t], null))(e)))), E.set(t, n), n);
|
|
1712
|
+
}, v = p.byValue, D = x.sort(p, (t) => N ? A(t)[0][v.measure] : A(t)[v.measure][0], h), F = h ? Ke(D, c) : x.lines(D, c), S = [];
|
|
1724
1713
|
if (N) {
|
|
1725
1714
|
l.show && S.push([
|
|
1726
|
-
...
|
|
1715
|
+
...We(I, f),
|
|
1727
1716
|
"",
|
|
1728
|
-
...
|
|
1717
|
+
...C.map((t, n) => w ? w[n] : Ue(n))
|
|
1729
1718
|
]);
|
|
1730
1719
|
for (const t of F) {
|
|
1731
|
-
const n =
|
|
1720
|
+
const n = x.keyCells(t, c), e = A(t.node);
|
|
1732
1721
|
for (let t = 0; t < m.length; t++) S.push([
|
|
1733
1722
|
...n,
|
|
1734
1723
|
m[t].label,
|
|
@@ -1736,24 +1725,24 @@ function Ke(t, n, e, r, o = 1, i, u, s = 0) {
|
|
|
1736
1725
|
]);
|
|
1737
1726
|
}
|
|
1738
1727
|
} else {
|
|
1739
|
-
a.named && S.push([...new Array(f).fill(""), ...m.map((t) => t.label)]), l.show && S.push([...
|
|
1728
|
+
a.named && S.push([...new Array(f).fill(""), ...m.map((t) => t.label)]), l.show && S.push([...We(I, f), ...m.map((t) => w ? w[t.column] : Ue(t.column))]);
|
|
1740
1729
|
for (const t of F) {
|
|
1741
|
-
const n =
|
|
1730
|
+
const n = x.keyCells(t, c);
|
|
1742
1731
|
for (const e of A(t.node)) n.push(e[0]);
|
|
1743
1732
|
S.push(n);
|
|
1744
1733
|
}
|
|
1745
1734
|
}
|
|
1746
|
-
return
|
|
1735
|
+
return b.createRange(S.length, S[0].length, S);
|
|
1747
1736
|
}
|
|
1748
|
-
var
|
|
1737
|
+
var He = (t) => {
|
|
1749
1738
|
const n = t.getColumnCount(), e = new Array(n);
|
|
1750
1739
|
for (let r = 0; r < n; r++) e[r] = t.getValueAt(0, r);
|
|
1751
1740
|
return e;
|
|
1752
|
-
},
|
|
1741
|
+
}, We = (t, n) => {
|
|
1753
1742
|
const e = new Array(n);
|
|
1754
|
-
for (let r = 0; r < n; r++) e[r] = t ? t[r] :
|
|
1743
|
+
for (let r = 0; r < n; r++) e[r] = t ? t[r] : _e(r);
|
|
1755
1744
|
return e;
|
|
1756
|
-
},
|
|
1745
|
+
}, Ke = (t, n) => {
|
|
1757
1746
|
const e = t.map((t) => ({
|
|
1758
1747
|
kind: "group",
|
|
1759
1748
|
node: t
|
|
@@ -1765,36 +1754,36 @@ var Ze = (t) => {
|
|
|
1765
1754
|
kind: "total",
|
|
1766
1755
|
node: null
|
|
1767
1756
|
}), e;
|
|
1768
|
-
},
|
|
1769
|
-
function
|
|
1757
|
+
}, Ze = A({ PIVOTBY: () => Qe });
|
|
1758
|
+
function Qe(t, n, e, r, o, i = 1, u, s = 1, a, l, f = 0) {
|
|
1770
1759
|
const c = e.getRowCount();
|
|
1771
|
-
if (!t && !n ||
|
|
1772
|
-
if (t && t.getRowCount() !== c) return
|
|
1773
|
-
if (n && n.getRowCount() !== c) return
|
|
1774
|
-
const h =
|
|
1775
|
-
if (
|
|
1776
|
-
const m =
|
|
1777
|
-
if (
|
|
1760
|
+
if (!t && !n || Oe(e)) return B.BuiltIn.Value;
|
|
1761
|
+
if (t && t.getRowCount() !== c) return B.BuiltIn.Value;
|
|
1762
|
+
if (n && n.getRowCount() !== c) return B.BuiltIn.Value;
|
|
1763
|
+
const h = ve(r, e.getColumnCount());
|
|
1764
|
+
if (B.isError(h)) return h;
|
|
1765
|
+
const m = Fe(o, e);
|
|
1766
|
+
if (B.isError(m)) return m;
|
|
1778
1767
|
const N = t ? t.getColumnCount() : 0, g = n ? n.getColumnCount() : 0, p = t ? i : 0, d = n ? s : 0;
|
|
1779
|
-
if (t &&
|
|
1780
|
-
if (n &&
|
|
1781
|
-
if (h.vertical && Math.abs(p) > 1) return
|
|
1782
|
-
if (!Number.isInteger(f) || f < 0 || f > 4) return
|
|
1783
|
-
if (l &&
|
|
1784
|
-
const { measures: y, vertical: M } = h, I = e.getColumnCount(), w = M ? I : y.length,
|
|
1785
|
-
if (
|
|
1786
|
-
const
|
|
1787
|
-
if (
|
|
1788
|
-
let
|
|
1768
|
+
if (t && !Te(p, N)) return B.BuiltIn.Value;
|
|
1769
|
+
if (n && !Te(d, g)) return B.BuiltIn.Value;
|
|
1770
|
+
if (h.vertical && Math.abs(p) > 1) return B.BuiltIn.Value;
|
|
1771
|
+
if (!Number.isInteger(f) || f < 0 || f > 4) return B.BuiltIn.Value;
|
|
1772
|
+
if (l && !$e(l, c)) return B.BuiltIn.Value;
|
|
1773
|
+
const { measures: y, vertical: M } = h, I = e.getColumnCount(), w = M ? I : y.length, x = Pe(u, N, w);
|
|
1774
|
+
if (B.isError(x)) return x;
|
|
1775
|
+
const C = Pe(a, g, w);
|
|
1776
|
+
if (B.isError(C)) return C;
|
|
1777
|
+
let R = t, E = n, A = e, v = l, D = null, F = null, S = null;
|
|
1789
1778
|
if (m.hasHeader) {
|
|
1790
|
-
if (c < 2) return
|
|
1791
|
-
|
|
1779
|
+
if (c < 2) return B.BuiltIn.Value;
|
|
1780
|
+
R && (D = Je(R), R = ze(R)), E && (F = Je(E), E = ze(E)), S = Je(A), A = ze(A), v && (v = ze(v));
|
|
1792
1781
|
}
|
|
1793
|
-
const V =
|
|
1794
|
-
if (0 === (V ?? T).getRecordCount()) return
|
|
1795
|
-
const O = new
|
|
1782
|
+
const V = R ? new ke(R, v) : null, T = E ? new ke(E, v) : null;
|
|
1783
|
+
if (0 === (V ?? T).getRecordCount()) return B.BuiltIn.Value;
|
|
1784
|
+
const O = new tr(V, T, Ye(A), v), $ = (t, n, e, r) => {
|
|
1796
1785
|
const o = O.members(t, n, r);
|
|
1797
|
-
return o ?
|
|
1786
|
+
return o ? De(e, o, () => {
|
|
1798
1787
|
switch (f) {
|
|
1799
1788
|
case 0: return O.members(null, n, r);
|
|
1800
1789
|
case 1: return O.members(t, null, r);
|
|
@@ -1806,7 +1795,7 @@ function nr(t, n, e, r, o, i = 1, u, s = 1, a, l, f = 0) {
|
|
|
1806
1795
|
}, k = (t) => (n, e) => M ? $(n, e, y[0], t.measure) : $(n, e, y[t.measure], y[t.measure].column), L = [{
|
|
1807
1796
|
kind: "total",
|
|
1808
1797
|
node: null
|
|
1809
|
-
}], q = V ? V.lines(V.sort(
|
|
1798
|
+
}], q = V ? V.lines(V.sort(x, (t) => k(x.byValue)(t, null), !1), p) : L, _ = T ? T.lines(T.sort(C, (t) => k(C.byValue)(null, t), !1), d) : L, j = [];
|
|
1810
1799
|
for (const t of _) if (M) for (let n = 0; n < I; n++) j.push({
|
|
1811
1800
|
line: t,
|
|
1812
1801
|
measure: -1,
|
|
@@ -1820,7 +1809,7 @@ function nr(t, n, e, r, o, i = 1, u, s = 1, a, l, f = 0) {
|
|
|
1820
1809
|
const U = !!T && !h.named && I > 1, Y = N + (M ? 1 : 0), z = () => new Array(Y).fill(""), G = [];
|
|
1821
1810
|
if (m.show && T) {
|
|
1822
1811
|
const t = [];
|
|
1823
|
-
for (let n = 0; n < g; n++) t.push(F ? String(F[n] ?? "") :
|
|
1812
|
+
for (let n = 0; n < g; n++) t.push(F ? String(F[n] ?? "") : je(n));
|
|
1824
1813
|
G.push([
|
|
1825
1814
|
...z(),
|
|
1826
1815
|
t.join(", "),
|
|
@@ -1833,26 +1822,26 @@ function nr(t, n, e, r, o, i = 1, u, s = 1, a, l, f = 0) {
|
|
|
1833
1822
|
}
|
|
1834
1823
|
if (h.named && !M && G.push([...z(), ...j.map((t) => y[t.measure].label)]), m.show) {
|
|
1835
1824
|
const t = [];
|
|
1836
|
-
for (let n = 0; n < N; n++) t.push(D ? D[n] :
|
|
1837
|
-
M && t.push(""), G.push([...t, ...j.map((t) => S ? S[t.column] :
|
|
1825
|
+
for (let n = 0; n < N; n++) t.push(D ? D[n] : _e(n));
|
|
1826
|
+
M && t.push(""), G.push([...t, ...j.map((t) => S ? S[t.column] : Ue(t.column))]);
|
|
1838
1827
|
}
|
|
1839
|
-
const
|
|
1828
|
+
const X = (t, n) => j.map((e) => U && "group" !== e.line.kind ? "" : $(t, e.line.node, n ?? y[e.measure], e.column));
|
|
1840
1829
|
for (const t of q) {
|
|
1841
1830
|
const n = V ? V.keyCells(t, p) : [];
|
|
1842
1831
|
if (M) for (const e of y) G.push([
|
|
1843
1832
|
...n,
|
|
1844
1833
|
e.label,
|
|
1845
|
-
...
|
|
1834
|
+
...X(t.node, e)
|
|
1846
1835
|
]);
|
|
1847
|
-
else G.push([...n, ...
|
|
1836
|
+
else G.push([...n, ...X(t.node, null)]);
|
|
1848
1837
|
}
|
|
1849
|
-
return
|
|
1838
|
+
return b.createRange(G.length, G[0].length, G);
|
|
1850
1839
|
}
|
|
1851
|
-
var
|
|
1840
|
+
var Je = (t) => {
|
|
1852
1841
|
const n = t.getColumnCount(), e = new Array(n);
|
|
1853
1842
|
for (let r = 0; r < n; r++) e[r] = t.getValueAt(0, r);
|
|
1854
1843
|
return e;
|
|
1855
|
-
},
|
|
1844
|
+
}, tr = class {
|
|
1856
1845
|
constructor(t, n, e, r) {
|
|
1857
1846
|
this._rows = t, this._cols = n, this._columns = e, this._filter = r, this._crossed = /* @__PURE__ */ new Map();
|
|
1858
1847
|
}
|
|
@@ -1868,7 +1857,7 @@ var er = (t) => {
|
|
|
1868
1857
|
const e = `${t},${n}`;
|
|
1869
1858
|
let r = this._crossed.get(e);
|
|
1870
1859
|
if (r) return r;
|
|
1871
|
-
const o = this._rows, i = this._cols, u = o.prefixes[t].concat(i.prefixes[n],
|
|
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();
|
|
1872
1861
|
for (let t = 0; t < s.getGroupCount(); t++) {
|
|
1873
1862
|
const n = s.getFirstRecord(t);
|
|
1874
1863
|
c.set(a.getGroup(n) * f + l.getGroup(n), t);
|
|
@@ -1878,35 +1867,35 @@ var er = (t) => {
|
|
|
1878
1867
|
groupOf: c
|
|
1879
1868
|
}, this._crossed.set(e, r), r;
|
|
1880
1869
|
}
|
|
1881
|
-
},
|
|
1882
|
-
FORECAST_ETS: () =>
|
|
1883
|
-
FORECAST_ETS_CONFINT: () =>
|
|
1884
|
-
FORECAST_ETS_SEASONALITY: () =>
|
|
1885
|
-
FORECAST_ETS_STAT: () =>
|
|
1870
|
+
}, nr = A({
|
|
1871
|
+
FORECAST_ETS: () => er,
|
|
1872
|
+
FORECAST_ETS_CONFINT: () => rr,
|
|
1873
|
+
FORECAST_ETS_SEASONALITY: () => or,
|
|
1874
|
+
FORECAST_ETS_STAT: () => ir
|
|
1886
1875
|
});
|
|
1887
|
-
function
|
|
1888
|
-
const u =
|
|
1889
|
-
if (
|
|
1876
|
+
function er(t, n, e, r = 1, o = 1, i = 1) {
|
|
1877
|
+
const u = lr(n, e, o, i);
|
|
1878
|
+
if (B.isError(u)) return u;
|
|
1890
1879
|
const { values: s, stepSize: a, lastTime: l, firstTime: f } = u;
|
|
1891
|
-
if ((t - f) / a <= -.999) return
|
|
1880
|
+
if ((t - f) / a <= -.999) return B.BuiltIn.Num;
|
|
1892
1881
|
const c = (t - l) / a;
|
|
1893
|
-
if (c > 2147483647) return
|
|
1894
|
-
const h =
|
|
1895
|
-
if (
|
|
1896
|
-
const { alpha: m, beta: N, gamma: g, period: p, b0: d } = h, { L: y, T: M, S: I, finalIndex: w } =
|
|
1882
|
+
if (c > 2147483647) return B.BuiltIn.Num;
|
|
1883
|
+
const h = hr(s, r);
|
|
1884
|
+
if (B.isError(h)) return h;
|
|
1885
|
+
const { alpha: m, beta: N, gamma: g, period: p, b0: d } = h, { L: y, T: M, S: I, finalIndex: w } = cr(s, m, N, g, p, d).finalState;
|
|
1897
1886
|
let b = y + c * M;
|
|
1898
1887
|
return p > 1 && (b += I[((w + Math.round(c)) % p + p) % p]), b;
|
|
1899
1888
|
}
|
|
1900
|
-
function
|
|
1901
|
-
if (r < 0 || r >= 1) return
|
|
1902
|
-
const s =
|
|
1903
|
-
if (
|
|
1889
|
+
function rr(t, n, e, r = .95, o = 1, i = 1, u = 1) {
|
|
1890
|
+
if (r < 0 || r >= 1) return B.BuiltIn.Num;
|
|
1891
|
+
const s = lr(n, e, i, u);
|
|
1892
|
+
if (B.isError(s)) return s;
|
|
1904
1893
|
const { values: a, stepSize: l, lastTime: f } = s;
|
|
1905
|
-
if (t <= f) return
|
|
1894
|
+
if (t <= f) return B.BuiltIn.Num;
|
|
1906
1895
|
const c = Math.round((t - f) / l);
|
|
1907
|
-
if (c > 2147483647) return
|
|
1908
|
-
const h =
|
|
1909
|
-
if (
|
|
1896
|
+
if (c > 2147483647) return B.BuiltIn.Num;
|
|
1897
|
+
const h = hr(a, o);
|
|
1898
|
+
if (B.isError(h)) return h;
|
|
1910
1899
|
const { alpha: m, beta: N, gamma: g, period: p, b0: d } = h, y = function(t, n, e, r, o, i) {
|
|
1911
1900
|
const u = t.length;
|
|
1912
1901
|
let s, a;
|
|
@@ -1938,27 +1927,27 @@ function ur(t, n, e, r = .95, o = 1, i = 1, u = 1) {
|
|
|
1938
1927
|
return i;
|
|
1939
1928
|
}(m, g, p, c);
|
|
1940
1929
|
return function(t) {
|
|
1941
|
-
const n = (1 + t) / 2, e =
|
|
1930
|
+
const n = (1 + t) / 2, e = b.getFunction("NORM.S.INV");
|
|
1942
1931
|
if (e) return e.execute(n);
|
|
1943
1932
|
const r = Math.sqrt(-2 * Math.log(1 - n));
|
|
1944
1933
|
return r - (2.515517 + .802853 * r + .010328 * r * r) / (1 + 1.432788 * r + .189269 * r * r + .001308 * r * r * r);
|
|
1945
1934
|
}(r) * y * Math.sqrt(M);
|
|
1946
1935
|
}
|
|
1947
|
-
function
|
|
1948
|
-
const o =
|
|
1949
|
-
if (
|
|
1936
|
+
function or(t, n, e = 1, r = 1) {
|
|
1937
|
+
const o = lr(t, n, e, r);
|
|
1938
|
+
if (B.isError(o)) return o;
|
|
1950
1939
|
const { values: i } = o;
|
|
1951
|
-
return i.length < 4 ? 0 :
|
|
1940
|
+
return i.length < 4 ? 0 : fr(i);
|
|
1952
1941
|
}
|
|
1953
|
-
function
|
|
1954
|
-
const u =
|
|
1955
|
-
if (null === u || u < 1 || u > 8) return
|
|
1956
|
-
const s =
|
|
1957
|
-
if (
|
|
1942
|
+
function ir(t, n, e, r = 1, o = 1, i = 1) {
|
|
1943
|
+
const u = sr(e);
|
|
1944
|
+
if (null === u || u < 1 || u > 8) return B.BuiltIn.Num;
|
|
1945
|
+
const s = lr(t, n, o, i);
|
|
1946
|
+
if (B.isError(s)) return s;
|
|
1958
1947
|
const { values: a, stepSize: l } = s;
|
|
1959
1948
|
if (8 === u) return l;
|
|
1960
|
-
const f =
|
|
1961
|
-
if (
|
|
1949
|
+
const f = hr(a, r);
|
|
1950
|
+
if (B.isError(f)) return f;
|
|
1962
1951
|
const { alpha: c, beta: h, gamma: m, period: N, b0: g } = f;
|
|
1963
1952
|
switch (u) {
|
|
1964
1953
|
case 1: return c;
|
|
@@ -1999,9 +1988,9 @@ function ar(t, n, e, r = 1, o = 1, i = 1) {
|
|
|
1999
1988
|
if (7 === u) return t.rmse;
|
|
2000
1989
|
}
|
|
2001
1990
|
}
|
|
2002
|
-
return
|
|
1991
|
+
return B.BuiltIn.Num;
|
|
2003
1992
|
}
|
|
2004
|
-
function
|
|
1993
|
+
function ur(t, n) {
|
|
2005
1994
|
const e = t.map((t) => t.value);
|
|
2006
1995
|
switch (n) {
|
|
2007
1996
|
case 1: return e.reduce((t, n) => t + n, 0) / e.length;
|
|
@@ -2017,44 +2006,44 @@ function lr(t, n) {
|
|
|
2017
2006
|
default: return e.reduce((t, n) => t + n, 0);
|
|
2018
2007
|
}
|
|
2019
2008
|
}
|
|
2020
|
-
function
|
|
2009
|
+
function sr(t) {
|
|
2021
2010
|
return Number.isInteger(t) ? t : null;
|
|
2022
2011
|
}
|
|
2023
|
-
var
|
|
2024
|
-
function
|
|
2025
|
-
const o =
|
|
2026
|
-
if (0 !== o && 1 !== o) return
|
|
2027
|
-
const i =
|
|
2028
|
-
if (null === i || i < 1 || i > 7) return
|
|
2012
|
+
var ar = 8784;
|
|
2013
|
+
function lr(t, n, e, r) {
|
|
2014
|
+
const o = sr(e);
|
|
2015
|
+
if (0 !== o && 1 !== o) return B.BuiltIn.Num;
|
|
2016
|
+
const i = sr(r);
|
|
2017
|
+
if (null === i || i < 1 || i > 7) return B.BuiltIn.Num;
|
|
2029
2018
|
const u = t.flatten(), s = n.flatten();
|
|
2030
|
-
if (u.getRowCount() !== s.getRowCount()) return
|
|
2019
|
+
if (u.getRowCount() !== s.getRowCount()) return B.BuiltIn.NA;
|
|
2031
2020
|
if (t.hasError()) return t.firstError();
|
|
2032
2021
|
if (n.hasError()) return n.firstError();
|
|
2033
|
-
if (u.getRowCount() < 2) return
|
|
2022
|
+
if (u.getRowCount() < 2) return B.BuiltIn.Div0;
|
|
2034
2023
|
const a = [];
|
|
2035
2024
|
for (const [[t, n]] of u.alignValues([s])) "number" == typeof t && "number" == typeof n && a.push({
|
|
2036
2025
|
time: n,
|
|
2037
2026
|
value: t
|
|
2038
2027
|
});
|
|
2039
|
-
if (a.sort((t, n) => t.time - n.time), a.length < 2) return
|
|
2028
|
+
if (a.sort((t, n) => t.time - n.time), a.length < 2) return B.BuiltIn.Div0;
|
|
2040
2029
|
const l = [];
|
|
2041
2030
|
let f = [a[0]];
|
|
2042
2031
|
for (let t = 1; t < a.length; t++) {
|
|
2043
2032
|
const n = a[t];
|
|
2044
2033
|
n.time === a[t - 1].time ? f.push(n) : (l.push({
|
|
2045
2034
|
time: f[0].time,
|
|
2046
|
-
value:
|
|
2035
|
+
value: ur(f, i)
|
|
2047
2036
|
}), f = [n]);
|
|
2048
2037
|
}
|
|
2049
2038
|
if (l.push({
|
|
2050
2039
|
time: f[0].time,
|
|
2051
|
-
value:
|
|
2052
|
-
}), l.length < 2) return
|
|
2040
|
+
value: ur(f, i)
|
|
2041
|
+
}), l.length < 2) return B.BuiltIn.Div0;
|
|
2053
2042
|
const c = [];
|
|
2054
2043
|
for (let t = 1; t < l.length; t++) c.push(l[t].time - l[t - 1].time);
|
|
2055
2044
|
c.sort((t, n) => t - n);
|
|
2056
2045
|
const h = Math.floor(c.length / 2), m = c.length % 2 != 0 ? c[h] : (c[h - 1] + c[h]) / 2;
|
|
2057
|
-
if (m <= 0) return
|
|
2046
|
+
if (m <= 0) return B.BuiltIn.Num;
|
|
2058
2047
|
const N = [l[0].value];
|
|
2059
2048
|
for (let t = 1; t < l.length; t++) {
|
|
2060
2049
|
const n = l[t - 1].time, e = l[t].time, r = n + m;
|
|
@@ -2065,7 +2054,7 @@ function hr(t, n, e, r) {
|
|
|
2065
2054
|
const e = l[t - 1].value, o = l[t].value;
|
|
2066
2055
|
N.push(e + n / (r + 1) * (o - e));
|
|
2067
2056
|
}
|
|
2068
|
-
} else if (Math.abs(e - r) > .01 * m) return
|
|
2057
|
+
} else if (Math.abs(e - r) > .01 * m) return B.BuiltIn.Num;
|
|
2069
2058
|
N.push(l[t].value);
|
|
2070
2059
|
}
|
|
2071
2060
|
return {
|
|
@@ -2075,7 +2064,7 @@ function hr(t, n, e, r) {
|
|
|
2075
2064
|
firstTime: l[0].time
|
|
2076
2065
|
};
|
|
2077
2066
|
}
|
|
2078
|
-
function
|
|
2067
|
+
function fr(t) {
|
|
2079
2068
|
const n = t.length;
|
|
2080
2069
|
if (n < 4) return 0;
|
|
2081
2070
|
const e = t.reduce((t, n) => t + n, 0) / n;
|
|
@@ -2092,7 +2081,7 @@ function mr(t) {
|
|
|
2092
2081
|
}
|
|
2093
2082
|
return i;
|
|
2094
2083
|
}
|
|
2095
|
-
function
|
|
2084
|
+
function cr(t, n, e, r, o, i) {
|
|
2096
2085
|
const u = t.length;
|
|
2097
2086
|
let s, a;
|
|
2098
2087
|
if (o > 1 && u >= 2 * o) {
|
|
@@ -2127,16 +2116,16 @@ function Nr(t, n, e, r, o, i) {
|
|
|
2127
2116
|
}
|
|
2128
2117
|
};
|
|
2129
2118
|
}
|
|
2130
|
-
function
|
|
2131
|
-
const e =
|
|
2132
|
-
if (null === e || e < 0 || e >
|
|
2119
|
+
function hr(t, n) {
|
|
2120
|
+
const e = sr(n);
|
|
2121
|
+
if (null === e || e < 0 || e > ar) return B.BuiltIn.Num;
|
|
2133
2122
|
let r = 1;
|
|
2134
|
-
1 === e ? (r =
|
|
2123
|
+
1 === e ? (r = fr(t), r <= 1 && (r = 1)) : e > 1 && (r = e), r > 1 && t.length < 2 * r && (r = 1);
|
|
2135
2124
|
const o = t.length;
|
|
2136
2125
|
if (1 === r) {
|
|
2137
|
-
const n = Math.max(1, Math.floor(o / 4)), e =
|
|
2126
|
+
const n = Math.max(1, Math.floor(o / 4)), e = Nr((n) => {
|
|
2138
2127
|
const e = Math.max(.001, Math.min(.999, n[0])), r = Math.max(.001, Math.min(.999, n[1])), o = n[2];
|
|
2139
|
-
return
|
|
2128
|
+
return cr(t, e, r, 0, 1, o).mse;
|
|
2140
2129
|
}, [
|
|
2141
2130
|
.9,
|
|
2142
2131
|
.1,
|
|
@@ -2150,7 +2139,7 @@ function gr(t, n) {
|
|
|
2150
2139
|
b0: e[2]
|
|
2151
2140
|
};
|
|
2152
2141
|
}
|
|
2153
|
-
const i =
|
|
2142
|
+
const i = Nr((n) => cr(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, [
|
|
2154
2143
|
.9,
|
|
2155
2144
|
.1,
|
|
2156
2145
|
.1
|
|
@@ -2163,10 +2152,10 @@ function gr(t, n) {
|
|
|
2163
2152
|
b0: 0
|
|
2164
2153
|
};
|
|
2165
2154
|
}
|
|
2166
|
-
function
|
|
2155
|
+
function mr(t, n, e, r, o) {
|
|
2167
2156
|
for (let i = 0; i < t.length; ++i) t[i] = n * e[i] + r * o[i];
|
|
2168
2157
|
}
|
|
2169
|
-
function
|
|
2158
|
+
function Nr(t, n, e) {
|
|
2170
2159
|
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;
|
|
2171
2160
|
let h;
|
|
2172
2161
|
const m = n.length, N = new Array(m + 1);
|
|
@@ -2201,12 +2190,12 @@ function dr(t, n, e) {
|
|
|
2201
2190
|
d[t] /= m;
|
|
2202
2191
|
}
|
|
2203
2192
|
const n = N[m];
|
|
2204
|
-
if (
|
|
2193
|
+
if (mr(y, 1 + a, d, -a, n), y.fx = t(y), y.fx < N[0].fx) mr(I, 1 + l, d, -l, n), I.fx = t(I), g(I.fx < y.fx ? I : y);
|
|
2205
2194
|
else if (y.fx >= N[m - 1].fx) {
|
|
2206
2195
|
let e = !1;
|
|
2207
|
-
if (y.fx > n.fx ? (
|
|
2196
|
+
if (y.fx > n.fx ? (mr(M, 1 + f, d, -f, n), M.fx = t(M), M.fx < n.fx ? g(M) : e = !0) : (mr(M, 1 - f * a, d, f * a, n), M.fx = t(M), M.fx < y.fx ? g(M) : e = !0), e) {
|
|
2208
2197
|
if (c >= 1) break;
|
|
2209
|
-
for (let n = 1; n < N.length; ++n)
|
|
2198
|
+
for (let n = 1; n < N.length; ++n) mr(N[n], 1 - c, N[0], c, N[n]), N[n].fx = t(N[n]);
|
|
2210
2199
|
}
|
|
2211
2200
|
} else g(y);
|
|
2212
2201
|
}
|
|
@@ -2215,15 +2204,15 @@ function dr(t, n, e) {
|
|
|
2215
2204
|
x: N[0]
|
|
2216
2205
|
};
|
|
2217
2206
|
}
|
|
2218
|
-
var
|
|
2207
|
+
var gr = Object.freeze({ includeEmpty: !0 }), pr = (Object.freeze({ axis: x.Axis.Column }), Object.freeze({ axis: x.Axis.Row }), Object.freeze({
|
|
2219
2208
|
type: C.Number,
|
|
2220
|
-
axis:
|
|
2221
|
-
})),
|
|
2209
|
+
axis: x.Axis.Row
|
|
2210
|
+
})), dr = (t, n, e = !1) => {
|
|
2222
2211
|
const r = t.getRowCount(), o = t.getColumnCount(), i = r * o;
|
|
2223
|
-
if (0 === i) throw
|
|
2212
|
+
if (0 === i) throw B.BuiltIn.Value;
|
|
2224
2213
|
const u = 1 === r, s = r > 1 && o > 1;
|
|
2225
2214
|
if (!n || 0 === n.size) {
|
|
2226
|
-
const n =
|
|
2215
|
+
const n = Br(t, i, e), a = new Array(i);
|
|
2227
2216
|
for (let t = 0; t < i; t++) a[t] = [t + 1];
|
|
2228
2217
|
return {
|
|
2229
2218
|
ys: n,
|
|
@@ -2237,8 +2226,8 @@ var yr = Object.freeze({ includeEmpty: !0 }), Mr = (Object.freeze({ axis: R.Axis
|
|
|
2237
2226
|
}
|
|
2238
2227
|
const a = n.getRowCount(), l = n.getColumnCount();
|
|
2239
2228
|
if (s) {
|
|
2240
|
-
if (a !== r || l !== o) throw
|
|
2241
|
-
const f =
|
|
2229
|
+
if (a !== r || l !== o) throw B.BuiltIn.Ref;
|
|
2230
|
+
const f = Br(t, i, e), c = Br(n, i), h = new Array(i);
|
|
2242
2231
|
for (let t = 0; t < i; t++) h[t] = [c[t]];
|
|
2243
2232
|
return {
|
|
2244
2233
|
ys: f,
|
|
@@ -2250,32 +2239,32 @@ var yr = Object.freeze({ includeEmpty: !0 }), Mr = (Object.freeze({ axis: R.Axis
|
|
|
2250
2239
|
yCols: o
|
|
2251
2240
|
};
|
|
2252
2241
|
}
|
|
2253
|
-
if ((u ? l : a) !== i) throw
|
|
2242
|
+
if ((u ? l : a) !== i) throw B.BuiltIn.Ref;
|
|
2254
2243
|
const f = u ? a : l;
|
|
2255
2244
|
return {
|
|
2256
|
-
ys:
|
|
2257
|
-
xs:
|
|
2245
|
+
ys: Br(t, i, e),
|
|
2246
|
+
xs: xr(n, i, f, u),
|
|
2258
2247
|
k: f,
|
|
2259
2248
|
isRowOriented: u,
|
|
2260
2249
|
isRectangularY: s,
|
|
2261
2250
|
yRows: r,
|
|
2262
2251
|
yCols: o
|
|
2263
2252
|
};
|
|
2264
|
-
},
|
|
2253
|
+
}, yr = (t, n, e) => {
|
|
2265
2254
|
if (void 0 === t) return e(n);
|
|
2266
2255
|
if (null === t) return e(!1);
|
|
2267
2256
|
if ("boolean" == typeof t) return e(t);
|
|
2268
|
-
if (Array.isArray(t)) throw
|
|
2269
|
-
return e(
|
|
2257
|
+
if (Array.isArray(t)) throw B.BuiltIn.Value;
|
|
2258
|
+
return e(Mr(((t) => {
|
|
2270
2259
|
const n = t.getRowCount(), e = t.getColumnCount();
|
|
2271
|
-
if (1 === n && 1 === e || !
|
|
2272
|
-
const r = t.getCoords(), o =
|
|
2260
|
+
if (1 === n && 1 === e || !b.isImplicitIntersect()) return t.getValueAt(0, 0);
|
|
2261
|
+
const r = t.getCoords(), o = b.getRow() - r.rowStart, i = b.getColumn() - r.colStart, u = o >= 0 && o < n, s = i >= 0 && i < e;
|
|
2273
2262
|
if (u && s) return t.getValueAt(o, i);
|
|
2274
2263
|
if (u && 1 === e) return t.getValueAt(o, 0);
|
|
2275
2264
|
if (s && 1 === n) return t.getValueAt(0, i);
|
|
2276
|
-
throw
|
|
2265
|
+
throw B.BuiltIn.Value;
|
|
2277
2266
|
})(t)));
|
|
2278
|
-
},
|
|
2267
|
+
}, Mr = (t) => {
|
|
2279
2268
|
if (null == t) return !1;
|
|
2280
2269
|
if ("boolean" == typeof t) return t;
|
|
2281
2270
|
if ("number" == typeof t) return !(t > -22250738585072014e-324 && t < 22250738585072014e-324);
|
|
@@ -2283,17 +2272,17 @@ var yr = Object.freeze({ includeEmpty: !0 }), Mr = (Object.freeze({ axis: R.Axis
|
|
|
2283
2272
|
const n = t.toUpperCase();
|
|
2284
2273
|
if ("TRUE" === n) return !0;
|
|
2285
2274
|
if ("FALSE" === n) return !1;
|
|
2286
|
-
throw
|
|
2275
|
+
throw B.BuiltIn.Value;
|
|
2287
2276
|
}
|
|
2288
|
-
throw
|
|
2289
|
-
},
|
|
2277
|
+
throw B.BuiltIn.Value;
|
|
2278
|
+
}, Ir = (t, n, e) => {
|
|
2290
2279
|
let r, o, i;
|
|
2291
2280
|
if (n && n.size > 0) {
|
|
2292
2281
|
const e = ((t, n) => {
|
|
2293
2282
|
const e = t.getRowCount(), r = t.getColumnCount(), o = e * r;
|
|
2294
|
-
if (0 === o) throw
|
|
2283
|
+
if (0 === o) throw B.BuiltIn.Ref;
|
|
2295
2284
|
if (1 === n.k) {
|
|
2296
|
-
const n =
|
|
2285
|
+
const n = Br(t, o), i = new Array(o);
|
|
2297
2286
|
for (let t = 0; t < o; t++) i[t] = [n[t]];
|
|
2298
2287
|
return {
|
|
2299
2288
|
xs: i,
|
|
@@ -2302,9 +2291,9 @@ var yr = Object.freeze({ includeEmpty: !0 }), Mr = (Object.freeze({ axis: R.Axis
|
|
|
2302
2291
|
};
|
|
2303
2292
|
}
|
|
2304
2293
|
const i = n.isRowOriented ? r : e;
|
|
2305
|
-
if ((n.isRowOriented ? e : r) !== n.k) throw
|
|
2294
|
+
if ((n.isRowOriented ? e : r) !== n.k) throw B.BuiltIn.Ref;
|
|
2306
2295
|
return {
|
|
2307
|
-
xs:
|
|
2296
|
+
xs: xr(t, i, n.k, n.isRowOriented),
|
|
2308
2297
|
rows: n.isRowOriented ? 1 : i,
|
|
2309
2298
|
cols: n.isRowOriented ? i : 1
|
|
2310
2299
|
};
|
|
@@ -2319,7 +2308,7 @@ var yr = Object.freeze({ includeEmpty: !0 }), Mr = (Object.freeze({ axis: R.Axis
|
|
|
2319
2308
|
u[t] = n;
|
|
2320
2309
|
}
|
|
2321
2310
|
return u;
|
|
2322
|
-
},
|
|
2311
|
+
}, wr = (t, n, e) => {
|
|
2323
2312
|
const r = t.length, o = n.length > 0 ? n[0].length : 0, i = [], u = [];
|
|
2324
2313
|
e && (i.push(new Array(r).fill(1)), u.push(o));
|
|
2325
2314
|
for (let t = o - 1; t >= 0; t--) {
|
|
@@ -2329,20 +2318,20 @@ var yr = Object.freeze({ includeEmpty: !0 }), Mr = (Object.freeze({ axis: R.Axis
|
|
|
2329
2318
|
}
|
|
2330
2319
|
const s = [], a = [], l = [];
|
|
2331
2320
|
for (let t = 0; t < i.length; t++) {
|
|
2332
|
-
const n = i[t].slice(), e = Math.sqrt(
|
|
2321
|
+
const n = i[t].slice(), e = Math.sqrt(Cr(n, n)), o = new Array(a.length).fill(0);
|
|
2333
2322
|
for (let t = 0; t < 2; t++) for (let t = 0; t < a.length; t++) {
|
|
2334
|
-
const e =
|
|
2323
|
+
const e = Cr(a[t], n);
|
|
2335
2324
|
for (let o = 0; o < r; o++) n[o] -= e * a[t][o];
|
|
2336
2325
|
o[t] += e;
|
|
2337
2326
|
}
|
|
2338
|
-
const u = Math.sqrt(
|
|
2327
|
+
const u = Math.sqrt(Cr(n, n));
|
|
2339
2328
|
if (!(u <= 1e-10 * (e || 1))) {
|
|
2340
2329
|
for (let t = 0; t < r; t++) n[t] /= u;
|
|
2341
2330
|
o.push(u), a.push(n), l.push(o), s.push(t);
|
|
2342
2331
|
}
|
|
2343
2332
|
}
|
|
2344
2333
|
const f = s.length, c = new Array(f);
|
|
2345
|
-
for (let n = 0; n < f; n++) c[n] =
|
|
2334
|
+
for (let n = 0; n < f; n++) c[n] = Cr(a[n], t);
|
|
2346
2335
|
const h = new Array(f).fill(0);
|
|
2347
2336
|
for (let t = f - 1; t >= 0; t--) {
|
|
2348
2337
|
let n = c[t];
|
|
@@ -2398,8 +2387,8 @@ var yr = Object.freeze({ includeEmpty: !0 }), Mr = (Object.freeze({ axis: R.Axis
|
|
|
2398
2387
|
ssResid: d,
|
|
2399
2388
|
predict: p
|
|
2400
2389
|
};
|
|
2401
|
-
},
|
|
2402
|
-
const r = n.length, o =
|
|
2390
|
+
}, br = (t, n, e) => {
|
|
2391
|
+
const r = n.length, o = B.BuiltIn.NA, i = (t, n) => {
|
|
2403
2392
|
const e = new Array(r).fill(o);
|
|
2404
2393
|
return e[0] = t, r > 1 && (e[1] = n), e;
|
|
2405
2394
|
}, u = t.standardErrors.slice();
|
|
@@ -2407,106 +2396,109 @@ var yr = Object.freeze({ includeEmpty: !0 }), Mr = (Object.freeze({ axis: R.Axis
|
|
|
2407
2396
|
n.slice(),
|
|
2408
2397
|
u,
|
|
2409
2398
|
i(t.r2, t.sey),
|
|
2410
|
-
i(t.f ??
|
|
2399
|
+
i(t.f ?? B.BuiltIn.Num, t.df),
|
|
2411
2400
|
i(t.ssReg, t.ssResid)
|
|
2412
2401
|
];
|
|
2413
|
-
},
|
|
2402
|
+
}, Br = (t, n, e = !1) => {
|
|
2414
2403
|
const r = new Array(n);
|
|
2415
2404
|
let o = 0;
|
|
2416
|
-
for (const n of t.values(
|
|
2417
|
-
if ("number" != typeof n) throw
|
|
2405
|
+
for (const n of t.values(gr)) {
|
|
2406
|
+
if ("number" != typeof n) throw B.BuiltIn.Value;
|
|
2418
2407
|
if (e) {
|
|
2419
|
-
if (n <= 0) throw
|
|
2408
|
+
if (n <= 0) throw B.BuiltIn.Num;
|
|
2420
2409
|
r[o++] = Math.log(n);
|
|
2421
2410
|
} else r[o++] = n;
|
|
2422
2411
|
}
|
|
2423
2412
|
return r;
|
|
2424
|
-
},
|
|
2425
|
-
const o =
|
|
2413
|
+
}, xr = (t, n, e, r) => {
|
|
2414
|
+
const o = Br(t, n * e), i = new Array(n);
|
|
2426
2415
|
for (let t = 0; t < n; t++) {
|
|
2427
2416
|
const u = new Array(e);
|
|
2428
2417
|
for (let i = 0; i < e; i++) u[i] = r ? o[i * n + t] : o[t * e + i];
|
|
2429
2418
|
i[t] = u;
|
|
2430
2419
|
}
|
|
2431
2420
|
return i;
|
|
2432
|
-
},
|
|
2421
|
+
}, Cr = (t, n) => {
|
|
2433
2422
|
let e = 0;
|
|
2434
2423
|
for (let r = 0; r < t.length; r++) e += t[r] * n[r];
|
|
2435
2424
|
return e;
|
|
2436
|
-
},
|
|
2437
|
-
GROWTH: () =>
|
|
2438
|
-
LINEST: () =>
|
|
2439
|
-
LOGEST: () =>
|
|
2440
|
-
TREND: () =>
|
|
2441
|
-
}),
|
|
2442
|
-
if (
|
|
2425
|
+
}, Rr = A({
|
|
2426
|
+
GROWTH: () => Fr,
|
|
2427
|
+
LINEST: () => Ar,
|
|
2428
|
+
LOGEST: () => vr,
|
|
2429
|
+
TREND: () => Dr
|
|
2430
|
+
}), Er = () => {
|
|
2431
|
+
if (b.getArgs().getAreaCountAt(1) > 1) throw B.BuiltIn.Ref;
|
|
2443
2432
|
};
|
|
2444
|
-
function
|
|
2445
|
-
|
|
2446
|
-
const o =
|
|
2447
|
-
return
|
|
2448
|
-
const n =
|
|
2449
|
-
return
|
|
2433
|
+
function Ar(t, n, e, r) {
|
|
2434
|
+
Er();
|
|
2435
|
+
const o = dr(t, n);
|
|
2436
|
+
return yr(e, !0, (t) => {
|
|
2437
|
+
const n = wr(o.ys, o.xs, t);
|
|
2438
|
+
return yr(r, !1, (e) => e ? br(n, n.coefficients, t) : [n.coefficients.slice()]);
|
|
2450
2439
|
});
|
|
2451
2440
|
}
|
|
2452
|
-
function
|
|
2453
|
-
|
|
2454
|
-
const o =
|
|
2455
|
-
return
|
|
2456
|
-
const n =
|
|
2457
|
-
return
|
|
2441
|
+
function vr(t, n, e, r) {
|
|
2442
|
+
Er();
|
|
2443
|
+
const o = dr(t, n, !0);
|
|
2444
|
+
return yr(e, !0, (t) => {
|
|
2445
|
+
const n = wr(o.ys, o.xs, t), e = Sr(n);
|
|
2446
|
+
return yr(r, !1, (r) => r ? br(n, e, t) : [e]);
|
|
2458
2447
|
});
|
|
2459
2448
|
}
|
|
2460
|
-
function
|
|
2461
|
-
|
|
2462
|
-
const o =
|
|
2463
|
-
return
|
|
2464
|
-
const n =
|
|
2465
|
-
return
|
|
2449
|
+
function Dr(t, n, e, r) {
|
|
2450
|
+
Er();
|
|
2451
|
+
const o = dr(t, n);
|
|
2452
|
+
return yr(r, !0, (t) => {
|
|
2453
|
+
const n = wr(o.ys, o.xs, t);
|
|
2454
|
+
return Ir(o, e, n.predict);
|
|
2466
2455
|
});
|
|
2467
2456
|
}
|
|
2468
|
-
function
|
|
2469
|
-
|
|
2470
|
-
const o =
|
|
2471
|
-
return
|
|
2472
|
-
const n =
|
|
2473
|
-
return
|
|
2457
|
+
function Fr(t, n, e, r) {
|
|
2458
|
+
Er();
|
|
2459
|
+
const o = dr(t, n, !0);
|
|
2460
|
+
return yr(r, !0, (t) => {
|
|
2461
|
+
const n = wr(o.ys, o.xs, t).coefficients.map(Math.exp), r = o.k;
|
|
2462
|
+
return Ir(o, e, (t) => {
|
|
2474
2463
|
let e = n[r];
|
|
2475
2464
|
for (let o = 0; o < r; o++) e *= n[r - 1 - o] ** t[o];
|
|
2476
|
-
return Number.isFinite(e) ? e :
|
|
2465
|
+
return Number.isFinite(e) ? e : B.BuiltIn.Num;
|
|
2477
2466
|
});
|
|
2478
2467
|
});
|
|
2479
2468
|
}
|
|
2480
|
-
var
|
|
2469
|
+
var Sr = (t) => t.coefficients.map((t) => {
|
|
2481
2470
|
const n = Math.exp(t);
|
|
2482
|
-
return Number.isFinite(n) ? n :
|
|
2483
|
-
}),
|
|
2484
|
-
TTEST: () =>
|
|
2485
|
-
T_TEST: () =>
|
|
2486
|
-
})
|
|
2487
|
-
|
|
2488
|
-
return
|
|
2471
|
+
return Number.isFinite(n) ? n : B.BuiltIn.Num;
|
|
2472
|
+
}), Vr = A({
|
|
2473
|
+
TTEST: () => Pr,
|
|
2474
|
+
T_TEST: () => Or
|
|
2475
|
+
}), Tr = (t) => {
|
|
2476
|
+
const n = t.getCode();
|
|
2477
|
+
return n === B.Code.Null || n === B.Code.GettingData ? B.BuiltIn.Num : t;
|
|
2478
|
+
};
|
|
2479
|
+
function Pr(t, n, e, r) {
|
|
2480
|
+
return Or(t, n, e, r);
|
|
2489
2481
|
}
|
|
2490
|
-
function
|
|
2491
|
-
if (e = Math.floor(e +
|
|
2482
|
+
function Or(t, n, e, r) {
|
|
2483
|
+
if (e = Math.floor(e + $r), r = Math.floor(r + $r), 1 !== e && 2 !== e || r < 1 || r > 3) return NaN;
|
|
2492
2484
|
for (const e of [t, n]) if (1 === e.size && e.isIReferenceRange) {
|
|
2493
2485
|
if (e.hasError()) throw e.firstError();
|
|
2494
|
-
if (e.entries({ includeEmpty: !1 }).next().done) throw
|
|
2486
|
+
if (e.entries({ includeEmpty: !1 }).next().done) throw B.BuiltIn.Value;
|
|
2495
2487
|
}
|
|
2496
2488
|
let o;
|
|
2497
2489
|
if (1 === r) {
|
|
2498
2490
|
const e = t.getShape(), r = n.getShape();
|
|
2499
|
-
if (e.rows * e.columns !== r.rows * r.columns) throw
|
|
2491
|
+
if (e.rows * e.columns !== r.rows * r.columns) throw B.BuiltIn.NA;
|
|
2500
2492
|
const i = [], u = [];
|
|
2501
2493
|
for (const [[e, r]] of t.flatten().alignValues([n.flatten()])) {
|
|
2502
|
-
if (
|
|
2503
|
-
if (
|
|
2494
|
+
if (B.isError(e)) throw Tr(e);
|
|
2495
|
+
if (B.isError(r)) throw Tr(r);
|
|
2504
2496
|
"number" == typeof e && "number" == typeof r && (i.push(e), u.push(r));
|
|
2505
2497
|
}
|
|
2506
|
-
if (i.length < 2) throw
|
|
2498
|
+
if (i.length < 2) throw B.BuiltIn.Div0;
|
|
2507
2499
|
o = function(t, n) {
|
|
2508
2500
|
const e = t.length;
|
|
2509
|
-
if (!Number.isFinite(
|
|
2501
|
+
if (!Number.isFinite(qr(t)) || !Number.isFinite(qr(n))) return { error: B.BuiltIn.Num };
|
|
2510
2502
|
let r = 0;
|
|
2511
2503
|
for (let o = 0; o < e; o++) r += t[o] - n[o];
|
|
2512
2504
|
const o = r / e;
|
|
@@ -2515,24 +2507,24 @@ function kr(t, n, e, r) {
|
|
|
2515
2507
|
const e = t[r] - n[r] - o;
|
|
2516
2508
|
i += e * e;
|
|
2517
2509
|
}
|
|
2518
|
-
return 0 === i ? { error:
|
|
2510
|
+
return 0 === i ? { error: B.BuiltIn.Div0 } : {
|
|
2519
2511
|
x: Math.abs(o) * Math.sqrt(e * (e - 1) / i),
|
|
2520
2512
|
df: e - 1
|
|
2521
2513
|
};
|
|
2522
2514
|
}(i, u);
|
|
2523
2515
|
} else {
|
|
2524
|
-
if (t.hasError()) throw t.firstError();
|
|
2525
|
-
if (n.hasError()) throw n.firstError();
|
|
2526
|
-
const e = t.getValuesFlat(
|
|
2527
|
-
if (e.length < 2 || i.length < 2) throw
|
|
2516
|
+
if (t.hasError()) throw Tr(t.firstError());
|
|
2517
|
+
if (n.hasError()) throw Tr(n.firstError());
|
|
2518
|
+
const e = t.getValuesFlat(pr), i = n.getValuesFlat(pr);
|
|
2519
|
+
if (e.length < 2 || i.length < 2) throw B.BuiltIn.Div0;
|
|
2528
2520
|
o = 2 === r ? function(t, n) {
|
|
2529
2521
|
const e = t.length, r = n.length;
|
|
2530
2522
|
let o = 0, i = 0, u = 0, s = 0;
|
|
2531
2523
|
for (const n of t) o += n, i += n * n;
|
|
2532
2524
|
for (const t of n) u += t, s += t * t;
|
|
2533
|
-
if (!Number.isFinite(i) || !Number.isFinite(s)) return { error:
|
|
2525
|
+
if (!Number.isFinite(i) || !Number.isFinite(s)) return { error: B.BuiltIn.Num };
|
|
2534
2526
|
const a = i - o ** 2 / e, l = s - u ** 2 / r, f = Math.sqrt(a + l);
|
|
2535
|
-
if (0 === f) return { error:
|
|
2527
|
+
if (0 === f) return { error: B.BuiltIn.Div0 };
|
|
2536
2528
|
const c = e + r - 2;
|
|
2537
2529
|
return {
|
|
2538
2530
|
x: Math.abs(o / e - u / r) / f * Math.sqrt(e * r * c / (e + r)),
|
|
@@ -2543,9 +2535,9 @@ function kr(t, n, e, r) {
|
|
|
2543
2535
|
let o = 0, i = 0, u = 0, s = 0;
|
|
2544
2536
|
for (const n of t) o += n, i += n * n;
|
|
2545
2537
|
for (const t of n) u += t, s += t * t;
|
|
2546
|
-
if (!Number.isFinite(i) || !Number.isFinite(s)) return { error:
|
|
2538
|
+
if (!Number.isFinite(i) || !Number.isFinite(s)) return { error: B.BuiltIn.Num };
|
|
2547
2539
|
const a = (i - o ** 2 / e) / (e * (e - 1)), l = (s - u ** 2 / r) / (r * (r - 1));
|
|
2548
|
-
if (a + l === 0) return { error:
|
|
2540
|
+
if (a + l === 0) return { error: B.BuiltIn.Div0 };
|
|
2549
2541
|
const f = Math.abs(o / e - u / r) / Math.sqrt(a + l), c = a / (a + l);
|
|
2550
2542
|
return {
|
|
2551
2543
|
x: f,
|
|
@@ -2558,14 +2550,14 @@ function kr(t, n, e, r) {
|
|
|
2558
2550
|
const e = .5 * function(t, n, e) {
|
|
2559
2551
|
if (e <= 0) return 0;
|
|
2560
2552
|
if (e >= 1) return 1;
|
|
2561
|
-
const r =
|
|
2562
|
-
return e < (t + 1) / (t + n + 2) ? o *
|
|
2553
|
+
const r = Lr(t) + Lr(n) - Lr(t + n), o = Math.exp(Math.log(e) * t + Math.log(1 - e) * n - r);
|
|
2554
|
+
return e < (t + 1) / (t + n + 2) ? o * kr(t, n, e) / t : 1 - o * kr(n, t, 1 - e) / n;
|
|
2563
2555
|
}(n / 2, .5, n / (n + t * t));
|
|
2564
2556
|
return t >= 0 ? 1 - e : e;
|
|
2565
2557
|
}(-o.x, o.df) * e;
|
|
2566
2558
|
}
|
|
2567
|
-
var
|
|
2568
|
-
function
|
|
2559
|
+
var $r = 2 ** -22;
|
|
2560
|
+
function kr(t, n, e) {
|
|
2569
2561
|
const r = 1e-30, o = t + n, i = t + 1, u = t - 1;
|
|
2570
2562
|
let s = 1, a = 1 - o * e / i;
|
|
2571
2563
|
Math.abs(a) < r && (a = r), a = 1 / a;
|
|
@@ -2579,7 +2571,7 @@ function qr(t, n, e) {
|
|
|
2579
2571
|
}
|
|
2580
2572
|
return l;
|
|
2581
2573
|
}
|
|
2582
|
-
function
|
|
2574
|
+
function Lr(t) {
|
|
2583
2575
|
const n = [
|
|
2584
2576
|
.9999999999998099,
|
|
2585
2577
|
676.5203681218851,
|
|
@@ -2591,19 +2583,19 @@ function _r(t) {
|
|
|
2591
2583
|
9984369578019572e-21,
|
|
2592
2584
|
1.5056327351493116e-7
|
|
2593
2585
|
];
|
|
2594
|
-
if (t < .5) return Math.log(Math.PI / Math.sin(Math.PI * t)) -
|
|
2586
|
+
if (t < .5) return Math.log(Math.PI / Math.sin(Math.PI * t)) - Lr(1 - t);
|
|
2595
2587
|
t--;
|
|
2596
2588
|
let e = n[0];
|
|
2597
2589
|
for (let r = 1; r < 9; r++) e += n[r] / (t + r);
|
|
2598
2590
|
const r = t + 7.5;
|
|
2599
2591
|
return .5 * Math.log(2 * Math.PI) + (t + .5) * Math.log(r) - r + Math.log(e);
|
|
2600
2592
|
}
|
|
2601
|
-
function
|
|
2593
|
+
function qr(t) {
|
|
2602
2594
|
let n = 0;
|
|
2603
2595
|
for (const e of t) n += e * e;
|
|
2604
2596
|
return n;
|
|
2605
2597
|
}
|
|
2606
|
-
var
|
|
2598
|
+
var _r = "\\p{L}\\p{N}_", jr = {
|
|
2607
2599
|
alpha: "\\p{L}",
|
|
2608
2600
|
digit: "\\p{Nd}",
|
|
2609
2601
|
alnum: "\\p{L}\\p{N}",
|
|
@@ -2612,13 +2604,13 @@ var Ur = "\\p{L}\\p{N}_", Yr = {
|
|
|
2612
2604
|
space: "\\s",
|
|
2613
2605
|
blank: "\\t\\p{Zs}",
|
|
2614
2606
|
punct: "\\p{P}\\p{S}",
|
|
2615
|
-
word:
|
|
2607
|
+
word: _r,
|
|
2616
2608
|
cntrl: "\\p{Cc}",
|
|
2617
2609
|
xdigit: "0-9A-Fa-f",
|
|
2618
2610
|
ascii: "\\x00-\\x7F",
|
|
2619
2611
|
print: "\\P{C}",
|
|
2620
2612
|
graph: "\\P{C}"
|
|
2621
|
-
},
|
|
2613
|
+
}, Ur = {
|
|
2622
2614
|
alpha: "\\P{L}",
|
|
2623
2615
|
digit: "\\P{Nd}",
|
|
2624
2616
|
upper: "\\P{Lu}",
|
|
@@ -2627,19 +2619,19 @@ var Ur = "\\p{L}\\p{N}_", Yr = {
|
|
|
2627
2619
|
cntrl: "\\P{Cc}",
|
|
2628
2620
|
print: "\\p{C}",
|
|
2629
2621
|
graph: "\\p{C}"
|
|
2630
|
-
},
|
|
2622
|
+
}, Yr = `(?:(?<=[${_r}])(?![${_r}])|(?<![${_r}])(?=[${_r}]))`, zr = `(?:(?<=[${_r}])(?=[${_r}])|(?<![${_r}])(?![${_r}]))`, Gr = (t, n) => {
|
|
2631
2623
|
if (!t.startsWith("[:", n)) return null;
|
|
2632
2624
|
const e = t.indexOf(":]", n + 2);
|
|
2633
2625
|
if (-1 === e) return null;
|
|
2634
2626
|
let r = t.slice(n + 2, e);
|
|
2635
2627
|
const o = r.startsWith("^");
|
|
2636
2628
|
o && (r = r.slice(1));
|
|
2637
|
-
const i = o ?
|
|
2629
|
+
const i = o ? Ur[r] : jr[r];
|
|
2638
2630
|
return void 0 === i ? null : {
|
|
2639
2631
|
emit: i,
|
|
2640
2632
|
next: e + 2
|
|
2641
2633
|
};
|
|
2642
|
-
},
|
|
2634
|
+
}, Xr = (t, n) => {
|
|
2643
2635
|
if (!t.startsWith("(?", n)) return null;
|
|
2644
2636
|
let e = n + 2, r = "", o = "", i = !1;
|
|
2645
2637
|
for (; e < t.length;) {
|
|
@@ -2660,13 +2652,13 @@ var Ur = "\\p{L}\\p{N}_", Yr = {
|
|
|
2660
2652
|
group: !0,
|
|
2661
2653
|
next: e + 1
|
|
2662
2654
|
} : null;
|
|
2663
|
-
},
|
|
2655
|
+
}, Hr = (t) => t.replace(/[^ims]/g, ""), Wr = (t) => (new RegExp(`${t.source}|`, t.flags.replace("g", "")).exec("")?.length ?? 1) - 1, Kr = (t, n, e = "") => {
|
|
2664
2656
|
const r = (n ? "i" : "") + e, o = (t, n) => {
|
|
2665
2657
|
try {
|
|
2666
2658
|
const e = new RegExp(t, n ? `${r}u` : r);
|
|
2667
2659
|
return {
|
|
2668
2660
|
regex: e,
|
|
2669
|
-
groups:
|
|
2661
|
+
groups: Wr(e)
|
|
2670
2662
|
};
|
|
2671
2663
|
} catch {
|
|
2672
2664
|
return null;
|
|
@@ -2692,7 +2684,7 @@ var Ur = "\\p{L}\\p{N}_", Yr = {
|
|
|
2692
2684
|
if ("C" === o) throw new SyntaxError("the any-byte escape is not supported");
|
|
2693
2685
|
if (r) {
|
|
2694
2686
|
if ("w" === o) {
|
|
2695
|
-
n +=
|
|
2687
|
+
n += _r, e += 2;
|
|
2696
2688
|
continue;
|
|
2697
2689
|
}
|
|
2698
2690
|
if ("d" === o) {
|
|
@@ -2709,19 +2701,19 @@ var Ur = "\\p{L}\\p{N}_", Yr = {
|
|
|
2709
2701
|
continue;
|
|
2710
2702
|
}
|
|
2711
2703
|
if ("b" === o) {
|
|
2712
|
-
n +=
|
|
2704
|
+
n += Yr, e += 2;
|
|
2713
2705
|
continue;
|
|
2714
2706
|
}
|
|
2715
2707
|
if ("B" === o) {
|
|
2716
|
-
n +=
|
|
2708
|
+
n += zr, e += 2;
|
|
2717
2709
|
continue;
|
|
2718
2710
|
}
|
|
2719
2711
|
if ("w" === o) {
|
|
2720
|
-
n += `[${
|
|
2712
|
+
n += `[${_r}]`, e += 2;
|
|
2721
2713
|
continue;
|
|
2722
2714
|
}
|
|
2723
2715
|
if ("W" === o) {
|
|
2724
|
-
n += `[^${
|
|
2716
|
+
n += `[^${_r}]`, e += 2;
|
|
2725
2717
|
continue;
|
|
2726
2718
|
}
|
|
2727
2719
|
if ("d" === o) {
|
|
@@ -2737,7 +2729,7 @@ var Ur = "\\p{L}\\p{N}_", Yr = {
|
|
|
2737
2729
|
continue;
|
|
2738
2730
|
}
|
|
2739
2731
|
if (r) {
|
|
2740
|
-
const o =
|
|
2732
|
+
const o = Gr(t, e);
|
|
2741
2733
|
if (o) {
|
|
2742
2734
|
n += o.emit, e = o.next;
|
|
2743
2735
|
continue;
|
|
@@ -2753,10 +2745,10 @@ var Ur = "\\p{L}\\p{N}_", Yr = {
|
|
|
2753
2745
|
r = !0, n += u, e += 1, "^" === t[e] && (n += "^", e += 1), "]" === t[e] && (n += "\\]", e += 1);
|
|
2754
2746
|
continue;
|
|
2755
2747
|
}
|
|
2756
|
-
const s =
|
|
2748
|
+
const s = Xr(t, e);
|
|
2757
2749
|
if (s) {
|
|
2758
2750
|
s.on.includes("U") && (o = !0), s.off.includes("U") && (o = !1);
|
|
2759
|
-
const t =
|
|
2751
|
+
const t = Hr(s.on), r = Hr(s.off);
|
|
2760
2752
|
s.group ? n += t || r ? `(?${t}${r ? `-${r}` : ""}:` : "(?:" : (t || r) && (n += `(?${t}${r ? `-${r}` : ""}:`, i.push(")")), e = s.next;
|
|
2761
2753
|
continue;
|
|
2762
2754
|
}
|
|
@@ -2775,48 +2767,48 @@ var Ur = "\\p{L}\\p{N}_", Yr = {
|
|
|
2775
2767
|
return n + i.join("");
|
|
2776
2768
|
})(t);
|
|
2777
2769
|
} catch {
|
|
2778
|
-
return
|
|
2770
|
+
return B.BuiltIn.Value;
|
|
2779
2771
|
}
|
|
2780
2772
|
const u = i.replace(/\\([pP])\{([A-Za-z_]+)\}/g, "\\$1{Script=$2}");
|
|
2781
|
-
return o(i, !0) ?? (u === i ? null : o(u, !0)) ?? o(t, !1) ??
|
|
2782
|
-
},
|
|
2773
|
+
return o(i, !0) ?? (u === i ? null : o(u, !0)) ?? o(t, !1) ?? B.BuiltIn.Value;
|
|
2774
|
+
}, Zr = (t, n) => {
|
|
2783
2775
|
const e = Math.trunc(t);
|
|
2784
|
-
return e >= 0 && e <= n ? e :
|
|
2785
|
-
},
|
|
2786
|
-
REGEXEXTRACT: () =>
|
|
2787
|
-
REGEXMATCH: () =>
|
|
2788
|
-
REGEXREPLACE: () =>
|
|
2789
|
-
REGEXTEST: () =>
|
|
2776
|
+
return e >= 0 && e <= n ? e : B.BuiltIn.Value;
|
|
2777
|
+
}, Qr = A({
|
|
2778
|
+
REGEXEXTRACT: () => Jr,
|
|
2779
|
+
REGEXMATCH: () => to,
|
|
2780
|
+
REGEXREPLACE: () => no,
|
|
2781
|
+
REGEXTEST: () => eo
|
|
2790
2782
|
});
|
|
2791
|
-
function
|
|
2792
|
-
const o =
|
|
2793
|
-
if (
|
|
2794
|
-
const i =
|
|
2795
|
-
if (
|
|
2796
|
-
const u =
|
|
2797
|
-
if (
|
|
2783
|
+
function Jr(t, n, e = 0, r = 0) {
|
|
2784
|
+
const o = Zr(e, 2);
|
|
2785
|
+
if (B.isError(o)) return o;
|
|
2786
|
+
const i = Zr(r, 1);
|
|
2787
|
+
if (B.isError(i)) return i;
|
|
2788
|
+
const u = Kr(n, 1 === i);
|
|
2789
|
+
if (B.isError(u)) return u;
|
|
2798
2790
|
const { regex: s } = u;
|
|
2799
2791
|
if (0 === o) {
|
|
2800
2792
|
const n = t.match(s);
|
|
2801
|
-
return n ?
|
|
2793
|
+
return n ? b.createRange().replace([[n[0]]]) : B.BuiltIn.NA;
|
|
2802
2794
|
}
|
|
2803
2795
|
if (1 === o) {
|
|
2804
2796
|
const n = [...t.matchAll(new RegExp(s.source, `${s.flags}g`))];
|
|
2805
|
-
return 0 === n.length ?
|
|
2797
|
+
return 0 === n.length ? B.BuiltIn.NA : b.createRange().replace([n.map((t) => t[0])]);
|
|
2806
2798
|
}
|
|
2807
|
-
if (0 === u.groups) return
|
|
2799
|
+
if (0 === u.groups) return B.BuiltIn.Value;
|
|
2808
2800
|
const a = t.match(s);
|
|
2809
|
-
return a ?
|
|
2801
|
+
return a ? b.createRange().replace([a.slice(1).map((t) => t ?? B.BuiltIn.NA)]) : B.BuiltIn.NA;
|
|
2810
2802
|
}
|
|
2811
|
-
function
|
|
2812
|
-
const r =
|
|
2813
|
-
return
|
|
2803
|
+
function to(t, n, e = !1) {
|
|
2804
|
+
const r = Kr(n, e);
|
|
2805
|
+
return B.isError(r) ? r : r.regex.test(t);
|
|
2814
2806
|
}
|
|
2815
|
-
function
|
|
2816
|
-
const i =
|
|
2817
|
-
if (
|
|
2818
|
-
const u =
|
|
2819
|
-
if (
|
|
2807
|
+
function no(t, n, e, r = 0, o = 0) {
|
|
2808
|
+
const i = Zr(o, 1);
|
|
2809
|
+
if (B.isError(i)) return i;
|
|
2810
|
+
const u = Kr(n, 1 === i);
|
|
2811
|
+
if (B.isError(u)) return u;
|
|
2820
2812
|
const { regex: s, groups: a } = u, l = ((t, n) => {
|
|
2821
2813
|
let e = "", r = 0;
|
|
2822
2814
|
for (; r < t.length;) {
|
|
@@ -2829,7 +2821,7 @@ function ro(t, n, e, r = 0, o = 0) {
|
|
|
2829
2821
|
e += "$&", r += 1 + o.length;
|
|
2830
2822
|
continue;
|
|
2831
2823
|
}
|
|
2832
|
-
if (i > n) return
|
|
2824
|
+
if (i > n) return B.BuiltIn.Value;
|
|
2833
2825
|
e += `$${i}`, r += 1 + o.length;
|
|
2834
2826
|
continue;
|
|
2835
2827
|
}
|
|
@@ -2852,7 +2844,7 @@ function ro(t, n, e, r = 0, o = 0) {
|
|
|
2852
2844
|
e += "$&", r += 1 + o.length;
|
|
2853
2845
|
continue;
|
|
2854
2846
|
}
|
|
2855
|
-
if (i > n) return
|
|
2847
|
+
if (i > n) return B.BuiltIn.Value;
|
|
2856
2848
|
e += `$${i}`, r += 1 + o.length;
|
|
2857
2849
|
continue;
|
|
2858
2850
|
}
|
|
@@ -2866,20 +2858,20 @@ function ro(t, n, e, r = 0, o = 0) {
|
|
|
2866
2858
|
e += "$&", r = o + 1;
|
|
2867
2859
|
continue;
|
|
2868
2860
|
}
|
|
2869
|
-
if (t > n) return
|
|
2861
|
+
if (t > n) return B.BuiltIn.Value;
|
|
2870
2862
|
e += `$${t}`;
|
|
2871
2863
|
} else e += `$<${i}>`;
|
|
2872
2864
|
r = o + 1;
|
|
2873
2865
|
continue;
|
|
2874
2866
|
}
|
|
2875
2867
|
}
|
|
2876
|
-
return
|
|
2868
|
+
return B.BuiltIn.Value;
|
|
2877
2869
|
}
|
|
2878
2870
|
e += o + i, r += 2;
|
|
2879
2871
|
}
|
|
2880
2872
|
return e;
|
|
2881
2873
|
})(e, a);
|
|
2882
|
-
if (
|
|
2874
|
+
if (B.isError(l)) return l;
|
|
2883
2875
|
const f = Math.trunc(r), c = new RegExp(s.source, `${s.flags}g`);
|
|
2884
2876
|
if (0 === f) return t.replace(c, l);
|
|
2885
2877
|
const h = [...t.matchAll(c)], m = f > 0 ? f - 1 : h.length + f;
|
|
@@ -2887,11 +2879,11 @@ function ro(t, n, e, r = 0, o = 0) {
|
|
|
2887
2879
|
const N = h[m], g = N.index;
|
|
2888
2880
|
return t.slice(0, g) + N[0].replace(s, l) + t.slice(g + N[0].length);
|
|
2889
2881
|
}
|
|
2890
|
-
function
|
|
2891
|
-
const r =
|
|
2892
|
-
if (
|
|
2893
|
-
const o =
|
|
2894
|
-
return
|
|
2882
|
+
function eo(t, n, e = 0) {
|
|
2883
|
+
const r = Zr(e, 1);
|
|
2884
|
+
if (B.isError(r)) return r;
|
|
2885
|
+
const o = Kr(n, 1 === r);
|
|
2886
|
+
return B.isError(o) ? o : o.regex.test(t);
|
|
2895
2887
|
}
|
|
2896
|
-
var
|
|
2897
|
-
export {
|
|
2888
|
+
var ro = () => import("./KELE0bwOYLDc5LU1.mjs"), oo = () => import("./C8cZUVI0utH84RoY.mjs"), io = () => import("./P2KKIUxWzaRqA578.mjs"), uo = () => import("./BuGd_WozQ5GACryc.mjs"), so = () => import("./TsVRWlV0aBAj11q_.mjs"), ao = () => import("./C5QRZhBj0R2s5scX.mjs"), lo = () => import("./CYYsvsWpauQOJMsM.mjs"), fo = () => import("./BzsAYB0O4AGQyHhT.mjs"), co = () => import("./JeU0hWKFq05N2_wk.mjs"), ho = () => import("./N6ZNg1DcQqnCub6Y.mjs"), mo = () => import("./kHBrNyVWu-GLkTFD.mjs"), No = () => import("./NLoLzdQXAOTuwqvv.mjs"), go = () => import("./-gjh-c5r-kqWZw9o.mjs"), po = () => import("./DvQaVDnNxRMcD29t.mjs"), yo = () => import("./BHd0M_vc0wMVhN4M.mjs"), Mo = () => import("./B6ojJF7WA6DiQR2T.mjs"), Io = () => import("./D5YXRS6-9JR6Jnuy.mjs"), wo = () => import("./Bp7v8eImXSaAUiaa.mjs"), bo = () => import("./BVcZk6dCLKI8-HRM.mjs"), Bo = () => import("./FxwjPPWZTalxCLby.mjs"), xo = () => import("./pEF9hsQQaka-GGnX.mjs"), Co = (b, B, x) => (x || (x = /* @__PURE__ */ new Map()), B(x, b, v, t, ro, "Cube"), B(x, b, ht, I, oo, "Financial"), B(x, b, Et, r, io, "Financial"), B(x, b, Dt, M, uo, "Financial", w), B(x, b, Xt, n, so, "Financial"), B(x, b, Jt, s, ao, "Financial"), B(x, b, xn, a, lo, "Financial"), B(x, b, Fn, c, fo, "Financial"), B(x, b, Pn, N, co, "Financial"), B(x, b, _n, u, ho, "Financial"), B(x, b, ne, i, mo, "Financial"), B(x, b, se, y, No, "Financial"), B(x, b, he, f, go, "Financial"), B(x, b, Ie, o, po, "Financial"), B(x, b, xe, p, yo, "Financial"), B(x, b, Ge, m, Mo, "Lookup & Reference"), B(x, b, Ze, e, Io, "Lookup & Reference"), B(x, b, nr, l, wo, "Statistical"), B(x, b, Rr, g, bo, "Statistical"), B(x, b, Vr, h, Bo, "Statistical"), B(x, b, Qr, d, xo, "Text"), x);
|
|
2889
|
+
export { Co as default };
|