ooxml-core 1.31.0 → 1.32.1
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/dist/{PptxHandler-KKLAYUGQ.mjs → PptxHandler-QY5VL3CY.mjs} +2 -2
- package/dist/PptxHandler-SJ5ZUIUX.mjs +4 -0
- package/dist/{PptxHandler-DHQPVTUI.cjs → PptxHandler-TESZUH66.cjs} +3 -3
- package/dist/{PresentationBuilder-YYZYCKTZ.mjs → PresentationBuilder-3CH5TR4W.mjs} +2 -2
- package/dist/{PresentationBuilder-JORMF5CP.cjs → PresentationBuilder-5NFBUP7Y.cjs} +5 -5
- package/dist/{PresentationBuilder-Q2Z33LLM.mjs → PresentationBuilder-S6HXHKEJ.mjs} +2 -2
- package/dist/automation/index.cjs +862 -389
- package/dist/automation/index.mjs +862 -389
- package/dist/{chunk-GJDFCP2T.mjs → chunk-3H5UAJB3.mjs} +258 -155
- package/dist/{chunk-MKDONWNO.mjs → chunk-4R65YYAD.mjs} +32 -14
- package/dist/{chunk-KWJYMAEF.mjs → chunk-IOTGRLJH.mjs} +255 -152
- package/dist/{chunk-6FXOAMNL.mjs → chunk-N6424WKA.mjs} +1 -1
- package/dist/{chunk-WZJ25K7P.mjs → chunk-NAWLWKOJ.mjs} +1 -1
- package/dist/{chunk-DJ3CDTMX.mjs → chunk-O7SVHLD7.mjs} +23 -5
- package/dist/{chunk-CZXM4ZJH.cjs → chunk-Q6NM64J2.cjs} +23 -4
- package/dist/{chunk-FFJBOR2Y.mjs → chunk-UYMSFJQZ.mjs} +76 -4
- package/dist/{chunk-B4LXDHBX.cjs → chunk-X6VNUBES.cjs} +1419 -1316
- package/dist/diagram/index.cjs +8 -4
- package/dist/diagram/index.mjs +8 -4
- package/dist/docx/embedded.cjs +8 -4
- package/dist/docx/embedded.mjs +8 -4
- package/dist/docx/index.cjs +8 -4
- package/dist/docx/index.mjs +8 -4
- package/dist/docx/layout/index.cjs +8 -4
- package/dist/docx/layout/index.mjs +8 -4
- package/dist/docx/load/index.cjs +8 -4
- package/dist/docx/load/index.mjs +8 -4
- package/dist/docx/ui/index.cjs +8 -4
- package/dist/docx/ui/index.mjs +8 -4
- package/dist/geometry/index.cjs +16 -12
- package/dist/geometry/index.mjs +16 -12
- package/dist/geometry/preset-shape-definitions-table.d.ts.map +1 -1
- package/dist/index.cjs +16 -12
- package/dist/index.mjs +16 -12
- package/dist/pptx/automation/index.cjs +294 -157
- package/dist/pptx/automation/index.d.ts +3 -3
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-PdM5zpmu.d.ts → index-D-FdgqrP.d.ts} +102 -3
- package/dist/pptx/chunks/index-D-FdgqrP.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-BQDcu_0a.d.ts → index-DKybuHPT.d.ts} +51 -3
- package/dist/pptx/chunks/{index-BQDcu_0a.d.ts.map → index-DKybuHPT.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-CBV1oHN7.d.ts → index-DnWlmYCy.d.ts} +2 -2
- package/dist/pptx/chunks/{index-CBV1oHN7.d.ts.map → index-DnWlmYCy.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +294 -157
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +8 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.cjs +14 -14
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- package/dist/pptx/editor/render/find-replace.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/index.cjs +380 -171
- package/dist/pptx/index.d.ts +4 -4
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/teams/chat-view.d.ts +10 -1
- package/dist/teams/chat-view.d.ts.map +1 -1
- package/dist/teams/index.cjs +805 -144
- package/dist/teams/index.d.ts +1 -0
- package/dist/teams/index.d.ts.map +1 -1
- package/dist/teams/index.mjs +795 -145
- package/dist/teams/presence-controller.d.ts +18 -3
- package/dist/teams/presence-controller.d.ts.map +1 -1
- package/dist/teams/presence-meetings.d.ts +21 -0
- package/dist/teams/presence-meetings.d.ts.map +1 -0
- package/dist/teams/presence.d.ts +40 -2
- package/dist/teams/presence.d.ts.map +1 -1
- package/dist/teams/store.d.ts +5 -0
- package/dist/teams/store.d.ts.map +1 -1
- package/dist/teams/view.d.ts +5 -0
- package/dist/teams/view.d.ts.map +1 -1
- package/dist/teams/workspace.d.ts +5 -2
- package/dist/teams/workspace.d.ts.map +1 -1
- package/dist/visio/index.cjs +6 -1
- package/dist/visio/index.mjs +6 -1
- package/dist/visio/ui/index.cjs +6 -1
- package/dist/visio/ui/index.mjs +6 -1
- package/dist/xlsx/formula/ets-drift-compare.d.ts +19 -0
- package/dist/xlsx/formula/ets-drift-compare.d.ts.map +1 -0
- package/dist/xlsx/formula/ets-excel-compare.d.ts +12 -0
- package/dist/xlsx/formula/ets-excel-compare.d.ts.map +1 -1
- package/dist/xlsx/formula/ets-init-compare.d.ts +24 -0
- package/dist/xlsx/formula/ets-init-compare.d.ts.map +1 -0
- package/dist/xlsx/formula/ets-init-maps.d.ts +21 -0
- package/dist/xlsx/formula/ets-init-maps.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-core.d.ts +1 -1
- package/dist/xlsx/formula/functions/ets-core.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/ets-init-chain.d.ts +11 -0
- package/dist/xlsx/formula/functions/ets-init-chain.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-four.d.ts +3 -0
- package/dist/xlsx/formula/functions/ets-init-four.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-short.d.ts +17 -0
- package/dist/xlsx/formula/functions/ets-init-short.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-states.d.ts +5 -0
- package/dist/xlsx/formula/functions/ets-init-states.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-three.d.ts +23 -0
- package/dist/xlsx/formula/functions/ets-init-three.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-threeplus.d.ts +13 -0
- package/dist/xlsx/formula/functions/ets-init-threeplus.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init.d.ts +18 -0
- package/dist/xlsx/formula/functions/ets-init.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/ets-search-map.d.ts +24 -0
- package/dist/xlsx/formula/functions/ets-search-map.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-search.d.ts +17 -0
- package/dist/xlsx/formula/functions/ets-search.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-season.d.ts +2 -2
- package/dist/xlsx/formula/functions/ets-season.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/ets-validate.d.ts +16 -0
- package/dist/xlsx/formula/functions/ets-validate.d.ts.map +1 -0
- package/dist/xlsx/index.cjs +762 -289
- package/dist/xlsx/index.mjs +762 -289
- package/dist/xlsx/layout/form-control-view.d.ts.map +1 -1
- package/dist/xlsx/layout/shape-view.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +599 -126
- package/dist/xlsx/load/index.mjs +599 -126
- package/dist/xlsx/read/form-control.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +756 -283
- package/dist/xlsx/ui/index.mjs +756 -283
- package/package.json +1 -1
- package/dist/PptxHandler-E4DDV3FQ.mjs +0 -4
- package/dist/pptx/chunks/index-PdM5zpmu.d.ts.map +0 -1
package/dist/xlsx/load/index.mjs
CHANGED
|
@@ -6944,7 +6944,7 @@ var ENGLISH_PIVOT_CAPTIONS = {
|
|
|
6944
6944
|
functions: FUNCTIONS,
|
|
6945
6945
|
aggregates: aggregateNames()
|
|
6946
6946
|
};
|
|
6947
|
-
var fillCaption = (
|
|
6947
|
+
var fillCaption = (template2, ...args) => template2.replace(/\{(\d)\}/g, (_match, at) => args[Number(at)] ?? "");
|
|
6948
6948
|
function pivotCaptions(pivot) {
|
|
6949
6949
|
const own = pivot.captions;
|
|
6950
6950
|
if (!own) return ENGLISH_PIVOT_CAPTIONS;
|
|
@@ -7645,8 +7645,8 @@ var DIV0 = { error: "#DIV/0!" };
|
|
|
7645
7645
|
function variance(numbers3, sample) {
|
|
7646
7646
|
const n = numbers3.length;
|
|
7647
7647
|
if (n < (sample ? 2 : 1)) return DIV0;
|
|
7648
|
-
const
|
|
7649
|
-
const squares = numbers3.reduce((total2, value2) => total2 + (value2 -
|
|
7648
|
+
const mean9 = numbers3.reduce((total2, value2) => total2 + value2, 0) / n;
|
|
7649
|
+
const squares = numbers3.reduce((total2, value2) => total2 + (value2 - mean9) ** 2, 0);
|
|
7650
7650
|
return squares / (sample ? n - 1 : n);
|
|
7651
7651
|
}
|
|
7652
7652
|
function aggregateValues(records, field, type) {
|
|
@@ -8167,9 +8167,9 @@ function aggregateCaptionsOf(pivot) {
|
|
|
8167
8167
|
]) {
|
|
8168
8168
|
const at = measure3.caption.indexOf(measure3.field);
|
|
8169
8169
|
if (at < 0 || measure3.caption === measure3.field) continue;
|
|
8170
|
-
const
|
|
8171
|
-
if (
|
|
8172
|
-
out[measure3.aggregate] =
|
|
8170
|
+
const template2 = `${measure3.caption.slice(0, at)}{0}${measure3.caption.slice(at + measure3.field.length)}`;
|
|
8171
|
+
if (template2 !== ENGLISH_PIVOT_CAPTIONS.aggregates[measure3.aggregate])
|
|
8172
|
+
out[measure3.aggregate] = template2;
|
|
8173
8173
|
}
|
|
8174
8174
|
return Object.keys(out).length ? out : void 0;
|
|
8175
8175
|
}
|
|
@@ -11753,9 +11753,9 @@ function prefixText(prefix) {
|
|
|
11753
11753
|
// xlsx/formula/shift-formula.ts
|
|
11754
11754
|
var templates = /* @__PURE__ */ new Map();
|
|
11755
11755
|
var MAX_TEMPLATES = 2e5;
|
|
11756
|
-
function remember(text,
|
|
11756
|
+
function remember(text, template2) {
|
|
11757
11757
|
if (templates.size >= MAX_TEMPLATES) templates.clear();
|
|
11758
|
-
templates.set(text,
|
|
11758
|
+
templates.set(text, template2);
|
|
11759
11759
|
}
|
|
11760
11760
|
function mergeSpacedAreas(tokens2) {
|
|
11761
11761
|
const out = [];
|
|
@@ -11786,16 +11786,16 @@ function templateOf2(formula2) {
|
|
|
11786
11786
|
const cached = templates.get(formula2);
|
|
11787
11787
|
if (cached !== void 0) return cached;
|
|
11788
11788
|
const raw2 = safeTokens(formula2);
|
|
11789
|
-
let
|
|
11789
|
+
let template2 = null;
|
|
11790
11790
|
if (raw2) {
|
|
11791
|
-
|
|
11791
|
+
template2 = [];
|
|
11792
11792
|
let literal2 = "";
|
|
11793
11793
|
for (const token2 of mergeSpacedAreas(raw2)) {
|
|
11794
11794
|
if (token2.kind !== "ref" && !(token2.kind === "name" && token2.prefix)) {
|
|
11795
11795
|
literal2 += token2.text;
|
|
11796
11796
|
continue;
|
|
11797
11797
|
}
|
|
11798
|
-
if (literal2)
|
|
11798
|
+
if (literal2) template2.push(literal2);
|
|
11799
11799
|
literal2 = "";
|
|
11800
11800
|
const part = { kind: token2.kind, text: token2.text };
|
|
11801
11801
|
if (token2.prefix) {
|
|
@@ -11804,23 +11804,23 @@ function templateOf2(formula2) {
|
|
|
11804
11804
|
}
|
|
11805
11805
|
if (token2.ref) part.ref = token2.ref;
|
|
11806
11806
|
if (token2.spill) part.spill = true;
|
|
11807
|
-
|
|
11807
|
+
template2.push(part);
|
|
11808
11808
|
}
|
|
11809
|
-
if (literal2)
|
|
11809
|
+
if (literal2) template2.push(literal2);
|
|
11810
11810
|
}
|
|
11811
|
-
remember(formula2,
|
|
11812
|
-
return
|
|
11811
|
+
remember(formula2, template2);
|
|
11812
|
+
return template2;
|
|
11813
11813
|
}
|
|
11814
11814
|
function rewriteTemplate(formula2, rewrite2) {
|
|
11815
|
-
const
|
|
11816
|
-
if (!
|
|
11815
|
+
const template2 = templateOf2(formula2);
|
|
11816
|
+
if (!template2) return formula2;
|
|
11817
11817
|
let next;
|
|
11818
|
-
for (let i2 = 0; i2 <
|
|
11819
|
-
const part =
|
|
11818
|
+
for (let i2 = 0; i2 < template2.length; i2++) {
|
|
11819
|
+
const part = template2[i2];
|
|
11820
11820
|
if (typeof part === "string") continue;
|
|
11821
11821
|
const changed = rewrite2(part);
|
|
11822
11822
|
if (!changed) continue;
|
|
11823
|
-
next ??=
|
|
11823
|
+
next ??= template2.slice();
|
|
11824
11824
|
next[i2] = changed;
|
|
11825
11825
|
}
|
|
11826
11826
|
if (!next) return formula2;
|
|
@@ -20204,7 +20204,8 @@ var pie = {
|
|
|
20204
20204
|
gd16("stAng", "pin 0 adj1 21599999"),
|
|
20205
20205
|
gd16("endAng", "pin 0 adj2 21599999"),
|
|
20206
20206
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
20207
|
-
gd16("
|
|
20207
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
20208
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
20208
20209
|
gd16("stx", "cos wd2 stAng"),
|
|
20209
20210
|
gd16("sty", "sin hd2 stAng"),
|
|
20210
20211
|
gd16("x1", "+- hc stx 0"),
|
|
@@ -20249,7 +20250,8 @@ var chord = {
|
|
|
20249
20250
|
gd16("stAng", "pin 0 adj1 21599999"),
|
|
20250
20251
|
gd16("endAng", "pin 0 adj2 21599999"),
|
|
20251
20252
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
20252
|
-
gd16("
|
|
20253
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
20254
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
20253
20255
|
gd16("stx", "cos wd2 stAng"),
|
|
20254
20256
|
gd16("sty", "sin hd2 stAng"),
|
|
20255
20257
|
gd16("x1", "+- hc stx 0"),
|
|
@@ -20273,7 +20275,8 @@ var arc = {
|
|
|
20273
20275
|
gd16("stAng", "pin 0 adj1 21599999"),
|
|
20274
20276
|
gd16("endAng", "pin 0 adj2 21599999"),
|
|
20275
20277
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
20276
|
-
gd16("
|
|
20278
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
20279
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
20277
20280
|
gd16("stx", "cos wd2 stAng"),
|
|
20278
20281
|
gd16("sty", "sin hd2 stAng"),
|
|
20279
20282
|
gd16("x1", "+- hc stx 0"),
|
|
@@ -20368,7 +20371,8 @@ var blockArc = {
|
|
|
20368
20371
|
gd16("iwd2", "+- wd2 0 thw"),
|
|
20369
20372
|
gd16("ihd2", "+- hd2 0 thh2"),
|
|
20370
20373
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
20371
|
-
gd16("
|
|
20374
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
20375
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
20372
20376
|
gd16("mswAng", "+- 0 0 swAng2"),
|
|
20373
20377
|
gd16("stx", "cos wd2 stAng"),
|
|
20374
20378
|
gd16("sty", "sin hd2 stAng"),
|
|
@@ -29699,8 +29703,8 @@ function buildGeneratedDiagramCache(dataXml2, input) {
|
|
|
29699
29703
|
);
|
|
29700
29704
|
const direct = model2.nodes.find((node2) => node2.modelId === shape2.sourceNodeId);
|
|
29701
29705
|
const fillIndex = shape2.style?.fill?.index;
|
|
29702
|
-
const
|
|
29703
|
-
if (!direct?.fill && shape2.fill?.kind === "solid" && shape2.fill.color.kind === "srgb" && (!
|
|
29706
|
+
const template2 = fillIndex ? input.formatScheme?.fillStyles[fillIndex - 1]?.fill : void 0;
|
|
29707
|
+
if (!direct?.fill && shape2.fill?.kind === "solid" && shape2.fill.color.kind === "srgb" && (!template2 || template2.kind === "solid" && template2.color.kind === "scheme" && template2.color.value === "phClr")) {
|
|
29704
29708
|
const original = themed.get(`#${shape2.fill.color.value}`.toUpperCase());
|
|
29705
29709
|
if (original)
|
|
29706
29710
|
shape2.fill.color = {
|
|
@@ -29708,9 +29712,9 @@ function buildGeneratedDiagramCache(dataXml2, input) {
|
|
|
29708
29712
|
transforms: [...original.transforms, ...shape2.fill.color.transforms]
|
|
29709
29713
|
};
|
|
29710
29714
|
}
|
|
29711
|
-
if (!direct?.fill && shape2.fill?.kind === "gradient" &&
|
|
29715
|
+
if (!direct?.fill && shape2.fill?.kind === "gradient" && template2?.kind === "gradient") {
|
|
29712
29716
|
shape2.fill.stops.forEach((stop, index3) => {
|
|
29713
|
-
const authored =
|
|
29717
|
+
const authored = template2.stops[index3]?.color;
|
|
29714
29718
|
if (authored?.kind === "scheme" && authored.value === "phClr" && stop.color.kind === "srgb") {
|
|
29715
29719
|
const original = themed.get(`#${stop.color.value}`.toUpperCase());
|
|
29716
29720
|
if (original)
|
|
@@ -33888,7 +33892,12 @@ function vmlCaption(vml, shapeId) {
|
|
|
33888
33892
|
const shape2 = vml.slice(start, end < 0 ? void 0 : end);
|
|
33889
33893
|
const box = /<v:textbox[^>]*>([\s\S]*?)<\/v:textbox>/.exec(shape2)?.[1];
|
|
33890
33894
|
if (!box) return void 0;
|
|
33891
|
-
|
|
33895
|
+
let stripped = box.replace(/<br\s*\/?>/gi, "\n");
|
|
33896
|
+
for (let prev = ""; prev !== stripped; ) {
|
|
33897
|
+
prev = stripped;
|
|
33898
|
+
stripped = stripped.replace(/<[^>]*>/g, "");
|
|
33899
|
+
}
|
|
33900
|
+
const text = stripped.replace(/&(#x?[0-9a-f]+|\w+);/gi, (match2, code) => {
|
|
33892
33901
|
if (code.startsWith("#")) {
|
|
33893
33902
|
const value2 = code[1]?.toLowerCase() === "x" ? parseInt(code.slice(2), 16) : Number(code.slice(1));
|
|
33894
33903
|
return Number.isFinite(value2) ? String.fromCodePoint(value2) : match2;
|
|
@@ -36593,12 +36602,12 @@ function reanchor(xml, anchor) {
|
|
|
36593
36602
|
).documentElement;
|
|
36594
36603
|
for (const candidate of Array.from(holder.childNodes)) {
|
|
36595
36604
|
if (candidate.nodeType !== 1) continue;
|
|
36596
|
-
const
|
|
36597
|
-
const original = first(old,
|
|
36598
|
-
const position = original ? original.cloneNode(true) : doc.importNode(
|
|
36599
|
-
for (const attribute2 of Array.from(
|
|
36605
|
+
const template2 = candidate;
|
|
36606
|
+
const original = first(old, template2.localName, NS.xdr);
|
|
36607
|
+
const position = original ? original.cloneNode(true) : doc.importNode(template2, true);
|
|
36608
|
+
for (const attribute2 of Array.from(template2.attributes))
|
|
36600
36609
|
position.setAttribute(attribute2.name, attribute2.value);
|
|
36601
|
-
for (const value2 of Array.from(
|
|
36610
|
+
for (const value2 of Array.from(template2.childNodes)) {
|
|
36602
36611
|
if (value2.nodeType !== 1) continue;
|
|
36603
36612
|
const item2 = value2;
|
|
36604
36613
|
const existing = first(position, item2.localName, NS.xdr);
|
|
@@ -38006,14 +38015,14 @@ function linearFit(xs, ys) {
|
|
|
38006
38015
|
return { slope, intercept: my - slope * mx };
|
|
38007
38016
|
}
|
|
38008
38017
|
function rank2(values2, x, ascending, average) {
|
|
38009
|
-
let
|
|
38018
|
+
let better2 = 0;
|
|
38010
38019
|
let ties = 0;
|
|
38011
38020
|
for (const v of values2) {
|
|
38012
38021
|
if (v === x) ties++;
|
|
38013
|
-
else if (ascending ? v < x : v > x)
|
|
38022
|
+
else if (ascending ? v < x : v > x) better2++;
|
|
38014
38023
|
}
|
|
38015
38024
|
if (ties === 0) fail(ERR.NA);
|
|
38016
|
-
return average ?
|
|
38025
|
+
return average ? better2 + (ties + 1) / 2 : better2 + 1;
|
|
38017
38026
|
}
|
|
38018
38027
|
var LANCZOS = [
|
|
38019
38028
|
676.5203681218851,
|
|
@@ -42857,11 +42866,11 @@ function binomDist(k, n, p, cumulative2) {
|
|
|
42857
42866
|
for (let i2 = 0; i2 <= kk; i2++) total2 += binomPmf(i2, nn, p);
|
|
42858
42867
|
return Math.min(1, total2);
|
|
42859
42868
|
}
|
|
42860
|
-
function poisson(k,
|
|
42869
|
+
function poisson(k, mean9, cumulative2) {
|
|
42861
42870
|
const kk = Math.trunc(k);
|
|
42862
|
-
if (kk < 0 ||
|
|
42863
|
-
if (cumulative2) return 1 - gammaP(kk + 1,
|
|
42864
|
-
return Math.exp(kk * Math.log(
|
|
42871
|
+
if (kk < 0 || mean9 < 0) fail(ERR.NUM);
|
|
42872
|
+
if (cumulative2) return 1 - gammaP(kk + 1, mean9);
|
|
42873
|
+
return Math.exp(kk * Math.log(mean9) - mean9 - gammaLn(kk + 1));
|
|
42865
42874
|
}
|
|
42866
42875
|
var normDist = (x, m, s, cumulative2) => {
|
|
42867
42876
|
positive2(s);
|
|
@@ -42869,13 +42878,272 @@ var normDist = (x, m, s, cumulative2) => {
|
|
|
42869
42878
|
return cumulative2 ? normCdf(z) : normPdf(z) / s;
|
|
42870
42879
|
};
|
|
42871
42880
|
|
|
42881
|
+
// xlsx/formula/functions/ets-init-three.ts
|
|
42882
|
+
var mean2 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
42883
|
+
function slopeOf(v) {
|
|
42884
|
+
const k = v.length;
|
|
42885
|
+
const mx = (k - 1) / 2;
|
|
42886
|
+
const my = mean2(v);
|
|
42887
|
+
let sxy = 0;
|
|
42888
|
+
let sxx = 0;
|
|
42889
|
+
for (let i2 = 0; i2 < k; i2++) {
|
|
42890
|
+
sxy += (i2 - mx) * (v[i2] - my);
|
|
42891
|
+
sxx += (i2 - mx) * (i2 - mx);
|
|
42892
|
+
}
|
|
42893
|
+
return sxx === 0 ? 0 : sxy / sxx;
|
|
42894
|
+
}
|
|
42895
|
+
function positionSlopes(y, m) {
|
|
42896
|
+
return Array.from({ length: m }, (_v, c2) => {
|
|
42897
|
+
const vals = [];
|
|
42898
|
+
for (let t = c2; t < y.length; t += m) vals.push(y[t]);
|
|
42899
|
+
return slopeOf(vals) / m;
|
|
42900
|
+
});
|
|
42901
|
+
}
|
|
42902
|
+
function isThreeSeasonLength(n, m) {
|
|
42903
|
+
return m >= 4 && n >= 3 * m && n <= 3 * m + Math.ceil(m / 2) + 1;
|
|
42904
|
+
}
|
|
42905
|
+
function threeSeasonSeasonals(y, m, slopeSumOverride) {
|
|
42906
|
+
const n = y.length;
|
|
42907
|
+
const extra = n - 3 * m;
|
|
42908
|
+
const j0 = Math.floor(m / 2);
|
|
42909
|
+
const at = (t) => y[t];
|
|
42910
|
+
const slope = (j) => (at(j + 2 * m) - at(j)) / (2 * m);
|
|
42911
|
+
const B = (j) => j + 2 * m < n ? slope(j) : slope(j % m);
|
|
42912
|
+
const e = (t) => at(t) - at(t - 1) - B(t - j0);
|
|
42913
|
+
const slopeSum = slopeSumOverride ?? positionSlopes(y, m).reduce((a2, b) => a2 + b, 0);
|
|
42914
|
+
const out = [0];
|
|
42915
|
+
for (let k = 1; k < m; k++) {
|
|
42916
|
+
let back = 0;
|
|
42917
|
+
for (let t = k + 1; t <= m; t++) back -= e(t);
|
|
42918
|
+
let fwd = 0;
|
|
42919
|
+
for (let t = m + 1; t <= m + k; t++) fwd += e(t);
|
|
42920
|
+
if (k < j0 - 1) {
|
|
42921
|
+
out.push(fwd);
|
|
42922
|
+
continue;
|
|
42923
|
+
}
|
|
42924
|
+
if (k === m - 1 && extra <= Math.ceil(m / 2)) {
|
|
42925
|
+
out.push(back);
|
|
42926
|
+
continue;
|
|
42927
|
+
}
|
|
42928
|
+
const wrapped = Math.max(0, k - j0 + 1 - extra);
|
|
42929
|
+
let corner4 = 0;
|
|
42930
|
+
for (let i2 = extra; i2 <= k - j0; i2++)
|
|
42931
|
+
corner4 += (at(i2 + m) + at(i2 + 2 * m) - 2 * at(i2)) / (4 * m);
|
|
42932
|
+
const level4 = (at(k) + at(m + k)) / 2 - at(m);
|
|
42933
|
+
const bb = back - (at(k) - at(m));
|
|
42934
|
+
const ff = fwd - (at(m + k) - at(m));
|
|
42935
|
+
out.push(level4 + (bb + ff) / 2 - 3 * wrapped / (4 * m) * slopeSum + corner4);
|
|
42936
|
+
}
|
|
42937
|
+
return out;
|
|
42938
|
+
}
|
|
42939
|
+
function padThreeSeasons(y, m, slopeMean = mean2(positionSlopes(y, m))) {
|
|
42940
|
+
const n = y.length;
|
|
42941
|
+
const total2 = Math.max(3 * m + Math.ceil(m / 2), n);
|
|
42942
|
+
const ext = [...y];
|
|
42943
|
+
for (let t = n; t < total2; t++) ext.push(y[t - 3 * m] + 3 * m * slopeMean);
|
|
42944
|
+
return ext;
|
|
42945
|
+
}
|
|
42946
|
+
function threeSeasonTrend(y, m, rel, slopeMean) {
|
|
42947
|
+
const ext = padThreeSeasons(y, m, slopeMean);
|
|
42948
|
+
const total2 = ext.length;
|
|
42949
|
+
const mx = (total2 - 1) / 2;
|
|
42950
|
+
let sxx = 0;
|
|
42951
|
+
let sxy = 0;
|
|
42952
|
+
for (let t = 0; t < total2; t++) {
|
|
42953
|
+
sxx += (t - mx) * (t - mx);
|
|
42954
|
+
sxy += (t - mx) * (ext[t] - rel[t % m]);
|
|
42955
|
+
}
|
|
42956
|
+
return sxy / sxx;
|
|
42957
|
+
}
|
|
42958
|
+
function isTwoSeasonLength(n, m) {
|
|
42959
|
+
return m >= 4 && n === 2 * m;
|
|
42960
|
+
}
|
|
42961
|
+
function isTwoPlusLength(n, m) {
|
|
42962
|
+
return m >= 4 && n > 2 * m && n < 3 * m;
|
|
42963
|
+
}
|
|
42964
|
+
function slopeSumOf(y, m) {
|
|
42965
|
+
return positionSlopes(y, m).reduce((a2, c2) => a2 + c2, 0);
|
|
42966
|
+
}
|
|
42967
|
+
function extendTwoSeasons(y, m) {
|
|
42968
|
+
const b = mean2(positionSlopes(y, m));
|
|
42969
|
+
const out = [...y];
|
|
42970
|
+
for (let t = y.length; t < 3 * m; t++) out.push(y[t - 2 * m] + 2 * m * b);
|
|
42971
|
+
return out;
|
|
42972
|
+
}
|
|
42973
|
+
function paddedSearchSeries(y, m) {
|
|
42974
|
+
if (isTwoSeasonLength(y.length, m) || isTwoPlusLength(y.length, m))
|
|
42975
|
+
return padThreeSeasons(extendTwoSeasons(y, m), m, slopeSumOf(y, m) / m);
|
|
42976
|
+
if (isThreeSeasonLength(y.length, m)) return padThreeSeasons(y, m);
|
|
42977
|
+
return void 0;
|
|
42978
|
+
}
|
|
42979
|
+
|
|
42980
|
+
// xlsx/formula/functions/ets-init-states.ts
|
|
42981
|
+
var mean3 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
42982
|
+
function chainStates(y, m, seasons) {
|
|
42983
|
+
const h2 = Math.floor(seasons / 2);
|
|
42984
|
+
const first2 = seasons - h2;
|
|
42985
|
+
const at = (t) => y[t];
|
|
42986
|
+
const meanFirst = (t) => mean3(Array.from({ length: first2 }, (_v, c2) => at(t + c2 * m)));
|
|
42987
|
+
const slope = (j) => {
|
|
42988
|
+
const early = mean3(Array.from({ length: h2 }, (_v, c2) => at(j + c2 * m)));
|
|
42989
|
+
const late = mean3(Array.from({ length: h2 }, (_v, c2) => at(j + (seasons - h2 + c2) * m)));
|
|
42990
|
+
return (late - early) / ((seasons - h2) * m);
|
|
42991
|
+
};
|
|
42992
|
+
const j0 = Math.floor(m / 2);
|
|
42993
|
+
const state = /* @__PURE__ */ new Map([[j0 - 1, 0]]);
|
|
42994
|
+
for (let t = j0; t <= j0 + m - 2; t++)
|
|
42995
|
+
state.set(t, state.get(t - 1) + meanFirst(t) - meanFirst(t - 1) - slope(t - j0));
|
|
42996
|
+
const byPosition = new Array(m).fill(0);
|
|
42997
|
+
for (const [t, s] of state) byPosition[t % m] = s;
|
|
42998
|
+
return byPosition;
|
|
42999
|
+
}
|
|
43000
|
+
function chainSeasonals(y, m, seasons) {
|
|
43001
|
+
const byPosition = chainStates(y, m, seasons);
|
|
43002
|
+
const origin = byPosition[0];
|
|
43003
|
+
return byPosition.map((s) => s - origin);
|
|
43004
|
+
}
|
|
43005
|
+
|
|
43006
|
+
// xlsx/formula/functions/ets-init-four.ts
|
|
43007
|
+
var mean4 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
43008
|
+
function template(w, m, a2) {
|
|
43009
|
+
const block = (c2) => mean4(w.slice(c2 * m, (c2 + 1) * m));
|
|
43010
|
+
const at = (i2) => w[i2];
|
|
43011
|
+
return (block(0) - block(2)) / 12 + (block(1) - block(3)) / 6 - (at(a2) + at(a2 + m) - 2 * at(a2 + 2 * m)) / 6;
|
|
43012
|
+
}
|
|
43013
|
+
function fourSeasonPlusSeasonals(y, m) {
|
|
43014
|
+
const r = y.length - 4 * m;
|
|
43015
|
+
const a2 = Math.floor(m / 2) - 1;
|
|
43016
|
+
const states = chainStates(y.slice(0, 4 * m), m, 4);
|
|
43017
|
+
for (let q = 0; q < r; q++) {
|
|
43018
|
+
const pos = (a2 + q) % m;
|
|
43019
|
+
states[pos] = states[pos] + template(y.slice(q, q + 4 * m), m, a2);
|
|
43020
|
+
}
|
|
43021
|
+
const origin = states[0];
|
|
43022
|
+
return states.map((s) => s - origin);
|
|
43023
|
+
}
|
|
43024
|
+
|
|
43025
|
+
// xlsx/formula/functions/ets-init-threeplus.ts
|
|
43026
|
+
var mean5 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
43027
|
+
function isThreePlusLength(n, m) {
|
|
43028
|
+
return m >= 4 && n >= 3 * m + Math.ceil(m / 2) + 2 && n < 4 * m;
|
|
43029
|
+
}
|
|
43030
|
+
function shift2(y, m, k) {
|
|
43031
|
+
const a2 = Math.ceil(m / 2) + 1;
|
|
43032
|
+
const at = (i2) => y[i2];
|
|
43033
|
+
return (at(m + k) - at(2 * m + k)) / 2 - (mean5(y.slice(a2 + k, a2 + k + m)) - mean5(y.slice(a2 + 2 * m + k, a2 + 3 * m + k))) / 4;
|
|
43034
|
+
}
|
|
43035
|
+
function isLowThreeLength(n, m) {
|
|
43036
|
+
return m === 2 && n >= 5 && n < 8 || m === 3 && n >= 6 && n < 12;
|
|
43037
|
+
}
|
|
43038
|
+
function lowSeasonSeasonals(y, m, slopeSum) {
|
|
43039
|
+
const base = threeSeasonSeasonals(y, m, slopeSum);
|
|
43040
|
+
const d = -shift2(y, m, -m);
|
|
43041
|
+
return base.map((s, k) => k === 0 ? 0 : s + d);
|
|
43042
|
+
}
|
|
43043
|
+
function threePlusSeasonals(y, m) {
|
|
43044
|
+
const base = threeSeasonSeasonals(y, m);
|
|
43045
|
+
const moved = y.length - 3 * m - Math.ceil(m / 2) - 1;
|
|
43046
|
+
const z = base.map((s, k) => k < moved ? s - shift2(y, m, k) : s);
|
|
43047
|
+
const origin = z[0];
|
|
43048
|
+
return z.map((s) => s - origin);
|
|
43049
|
+
}
|
|
43050
|
+
|
|
43051
|
+
// xlsx/formula/functions/ets-init-short.ts
|
|
43052
|
+
function seasonStart(m) {
|
|
43053
|
+
return Math.ceil(10 * (m + 1) / 7);
|
|
43054
|
+
}
|
|
43055
|
+
function isShortSeasonLength(n, m) {
|
|
43056
|
+
return m >= 5 && n >= seasonStart(m) && n < 2 * m;
|
|
43057
|
+
}
|
|
43058
|
+
function padTwoSeasons(y, m) {
|
|
43059
|
+
const p = [...y];
|
|
43060
|
+
for (let t = y.length; t < 2 * m; t++) p.push(p[t - m]);
|
|
43061
|
+
return p;
|
|
43062
|
+
}
|
|
43063
|
+
function trendShift(m, n) {
|
|
43064
|
+
const j0 = Math.floor(m / 2);
|
|
43065
|
+
const u = 2 * m - 1 - n;
|
|
43066
|
+
return (u * u - (j0 - 2) * u + 2 * (j0 - 1)) / 4;
|
|
43067
|
+
}
|
|
43068
|
+
function shortSeasonStart(y, m) {
|
|
43069
|
+
const n = y.length;
|
|
43070
|
+
const p = padTwoSeasons(y, m);
|
|
43071
|
+
const ss = slopeSumOf(p, m);
|
|
43072
|
+
const ext = extendTwoSeasons(p, m);
|
|
43073
|
+
const base = threeSeasonSeasonals(ext, m, ss);
|
|
43074
|
+
const total2 = 3 * m + Math.ceil(m / 2);
|
|
43075
|
+
const sxx = total2 * (total2 * total2 - 1) / 12;
|
|
43076
|
+
const trend = threeSeasonTrend(ext, m, base, ss / m) + trendShift(m, n) * ss / sxx;
|
|
43077
|
+
const rel = base.map((s, k) => k >= n - m && k <= m - 2 ? s + ss / 2 : s);
|
|
43078
|
+
return { rel, trend };
|
|
43079
|
+
}
|
|
43080
|
+
function shortSearchSeries(y, m) {
|
|
43081
|
+
const p = padTwoSeasons(y, m);
|
|
43082
|
+
return padThreeSeasons(extendTwoSeasons(p, m), m, slopeSumOf(p, m) / m);
|
|
43083
|
+
}
|
|
43084
|
+
|
|
43085
|
+
// xlsx/formula/functions/ets-init-chain.ts
|
|
43086
|
+
var MAX_SEASONS = 5;
|
|
43087
|
+
var mean6 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
43088
|
+
function isExactLength(n, m) {
|
|
43089
|
+
const whole = Math.floor(n / m);
|
|
43090
|
+
return whole >= MAX_SEASONS || whole === 4 || isThreeSeasonLength(n, m) || isThreePlusLength(n, m) || isLowThreeLength(n, m) || isTwoSeasonLength(n, m) || isTwoPlusLength(n, m) || isShortSeasonLength(n, m);
|
|
43091
|
+
}
|
|
43092
|
+
function fromRelative(y0, rel, trend) {
|
|
43093
|
+
const combined = rel.map((s) => y0 + s - trend);
|
|
43094
|
+
const level4 = mean6(combined);
|
|
43095
|
+
return { level: level4, trend, season: combined.map((c2) => c2 - level4) };
|
|
43096
|
+
}
|
|
43097
|
+
function chainStart(y, m) {
|
|
43098
|
+
const n = y.length;
|
|
43099
|
+
const whole = Math.floor(n / m);
|
|
43100
|
+
if (isShortSeasonLength(n, m)) {
|
|
43101
|
+
const { rel: rel2, trend } = shortSeasonStart(y, m);
|
|
43102
|
+
return fromRelative(y[0], rel2, trend);
|
|
43103
|
+
}
|
|
43104
|
+
if (isThreeSeasonLength(n, m) || isTwoSeasonLength(n, m) || isTwoPlusLength(n, m)) {
|
|
43105
|
+
const short = isTwoSeasonLength(n, m) || isTwoPlusLength(n, m);
|
|
43106
|
+
const series = short ? extendTwoSeasons(y, m) : y;
|
|
43107
|
+
const rel2 = threeSeasonSeasonals(series, m, short ? slopeSumOf(y, m) : void 0);
|
|
43108
|
+
return fromRelative(
|
|
43109
|
+
y[0],
|
|
43110
|
+
rel2,
|
|
43111
|
+
threeSeasonTrend(series, m, rel2, short ? slopeSumOf(y, m) / m : void 0)
|
|
43112
|
+
);
|
|
43113
|
+
}
|
|
43114
|
+
if (isLowThreeLength(n, m)) {
|
|
43115
|
+
const short = n < 3 * m;
|
|
43116
|
+
const series = short ? extendTwoSeasons(y, m) : y;
|
|
43117
|
+
const rel2 = lowSeasonSeasonals(series, m, short ? slopeSumOf(y, m) : void 0);
|
|
43118
|
+
const pad6 = short ? slopeSumOf(y, m) / m : void 0;
|
|
43119
|
+
return fromRelative(y[0], rel2, threeSeasonTrend(series, m, rel2, pad6));
|
|
43120
|
+
}
|
|
43121
|
+
if (isThreePlusLength(n, m)) {
|
|
43122
|
+
const rel2 = threePlusSeasonals(y, m);
|
|
43123
|
+
return fromRelative(y[0], rel2, threeSeasonTrend(y, m, rel2));
|
|
43124
|
+
}
|
|
43125
|
+
if (m < 2 || whole < 4) return void 0;
|
|
43126
|
+
const partial = whole < MAX_SEASONS && n % m !== 0;
|
|
43127
|
+
const rel = partial ? fourSeasonPlusSeasonals(y, m) : chainSeasonals(y, m, Math.min(whole, MAX_SEASONS));
|
|
43128
|
+
const mx = (n - 1) / 2;
|
|
43129
|
+
let sxy = 0;
|
|
43130
|
+
let sxx = 0;
|
|
43131
|
+
const my = mean6(y.map((v, t) => v - rel[t % m]));
|
|
43132
|
+
for (let t = 0; t < n; t++) {
|
|
43133
|
+
const d = y[t] - rel[t % m] - my;
|
|
43134
|
+
sxy += (t - mx) * d;
|
|
43135
|
+
sxx += (t - mx) * (t - mx);
|
|
43136
|
+
}
|
|
43137
|
+
return fromRelative(y[0], rel, sxy / sxx);
|
|
43138
|
+
}
|
|
43139
|
+
|
|
42872
43140
|
// xlsx/formula/functions/ets-init.ts
|
|
42873
43141
|
var MAX_EXACT_SEASON = 24;
|
|
42874
|
-
var
|
|
43142
|
+
var mean7 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
42875
43143
|
function olsSlope(y) {
|
|
42876
43144
|
const n = y.length;
|
|
42877
43145
|
const mx = (n - 1) / 2;
|
|
42878
|
-
const my =
|
|
43146
|
+
const my = mean7(y);
|
|
42879
43147
|
let sxy = 0;
|
|
42880
43148
|
let sxx = 0;
|
|
42881
43149
|
for (let i2 = 0; i2 < n; i2++) {
|
|
@@ -42884,12 +43152,30 @@ function olsSlope(y) {
|
|
|
42884
43152
|
}
|
|
42885
43153
|
return sxx === 0 ? 0 : sxy / sxx;
|
|
42886
43154
|
}
|
|
43155
|
+
var PADS = {
|
|
43156
|
+
6: [[0, 6]],
|
|
43157
|
+
5: [
|
|
43158
|
+
[1, 4],
|
|
43159
|
+
[0, 6]
|
|
43160
|
+
],
|
|
43161
|
+
4: [
|
|
43162
|
+
[0, 4],
|
|
43163
|
+
[1, 4],
|
|
43164
|
+
[0, 6]
|
|
43165
|
+
]
|
|
43166
|
+
};
|
|
43167
|
+
function shortSeriesTrend(y) {
|
|
43168
|
+
const pads = PADS[y.length];
|
|
43169
|
+
if (!pads) return olsSlope(y);
|
|
43170
|
+
const slope = olsSlope(y);
|
|
43171
|
+
return olsSlope([...y, ...pads.map(([src, lag]) => y[src] + lag * slope)]);
|
|
43172
|
+
}
|
|
42887
43173
|
function split(trend, combined) {
|
|
42888
|
-
const level4 =
|
|
43174
|
+
const level4 = mean7(combined);
|
|
42889
43175
|
return { level: level4, trend, season: combined.map((c2) => c2 - level4) };
|
|
42890
43176
|
}
|
|
42891
43177
|
function heuristicStates(y, m) {
|
|
42892
|
-
const trend = (
|
|
43178
|
+
const trend = (mean7(y.slice(m, 2 * m)) - mean7(y.slice(0, m))) / m;
|
|
42893
43179
|
return split(
|
|
42894
43180
|
trend,
|
|
42895
43181
|
Array.from({ length: m }, (_v, k) => y[k] - trend * (k + 1))
|
|
@@ -42926,9 +43212,11 @@ function solveSystem(a2, b) {
|
|
|
42926
43212
|
function initialStates(y, m, p, run2) {
|
|
42927
43213
|
const y0 = y[0];
|
|
42928
43214
|
if (m < 2) {
|
|
42929
|
-
const trend2 =
|
|
43215
|
+
const trend2 = shortSeriesTrend(y);
|
|
42930
43216
|
return { level: y0 - trend2, trend: trend2, season: [] };
|
|
42931
43217
|
}
|
|
43218
|
+
const exact = chainStart(y, m);
|
|
43219
|
+
if (exact) return exact;
|
|
42932
43220
|
if (m > MAX_EXACT_SEASON) return heuristicStates(y, m);
|
|
42933
43221
|
const zeros = new Array(y.length).fill(0);
|
|
42934
43222
|
const unit = (trend2, season) => run2(zeros, m, { level: 0, trend: trend2, season }, p).fitted;
|
|
@@ -42948,6 +43236,202 @@ function initialStates(y, m, p, run2) {
|
|
|
42948
43236
|
return split(trend, [y0 - trend, ...u.slice(1)]);
|
|
42949
43237
|
}
|
|
42950
43238
|
|
|
43239
|
+
// xlsx/formula/functions/ets-search-map.ts
|
|
43240
|
+
var LOW = 1e-3;
|
|
43241
|
+
var DRIFT_SHIFT = 1.5;
|
|
43242
|
+
var DRIFT_T = 9.3;
|
|
43243
|
+
var CANDIDATES = [
|
|
43244
|
+
...[2e-3, 0.1, 0.126, 0.25, 0.5, 0.75, 0.9].map((a2) => [a2, LOW]),
|
|
43245
|
+
[0.1, 0.099],
|
|
43246
|
+
[0.126, 0.125],
|
|
43247
|
+
[0.25, 0.249],
|
|
43248
|
+
[0.333333, 0.166667],
|
|
43249
|
+
[0.5, 0.25],
|
|
43250
|
+
[0.5, 0.499],
|
|
43251
|
+
[0.666667, 0.166667],
|
|
43252
|
+
[0.666667, 0.5],
|
|
43253
|
+
[0.75, 0.749],
|
|
43254
|
+
[0.833333, 0.75],
|
|
43255
|
+
[0.9, 0.899],
|
|
43256
|
+
[0.998, 0.099],
|
|
43257
|
+
[0.998, 0.249],
|
|
43258
|
+
[0.998, 0.499],
|
|
43259
|
+
[0.998, 0.749],
|
|
43260
|
+
[0.998, 0.899],
|
|
43261
|
+
[0.166667, 0.0833333],
|
|
43262
|
+
[0.833333, 0.0833333]
|
|
43263
|
+
];
|
|
43264
|
+
var ALWAYS_DRIFT = /* @__PURE__ */ new Set([
|
|
43265
|
+
"0.1/0.099",
|
|
43266
|
+
"0.998/0.899",
|
|
43267
|
+
"0.998/0.749",
|
|
43268
|
+
"0.166667/0.0833333",
|
|
43269
|
+
"0.25/0.249",
|
|
43270
|
+
"0.9/0.899",
|
|
43271
|
+
"0.666667/0.5",
|
|
43272
|
+
"0.75/0.749"
|
|
43273
|
+
]);
|
|
43274
|
+
var NEVER_DRIFT = /* @__PURE__ */ new Set(["0.333333/0.166667"]);
|
|
43275
|
+
function trendShape(y, h2) {
|
|
43276
|
+
const n = y.length;
|
|
43277
|
+
const hold = h2 > 0 ? h2 : Math.max(1, Math.round(0.3 * n));
|
|
43278
|
+
const mx = (n - 1) / 2;
|
|
43279
|
+
let my = 0;
|
|
43280
|
+
for (const v of y) my += v;
|
|
43281
|
+
my /= n;
|
|
43282
|
+
let sxy = 0;
|
|
43283
|
+
let sxx = 0;
|
|
43284
|
+
let syy = 0;
|
|
43285
|
+
for (let i2 = 0; i2 < n; i2++) {
|
|
43286
|
+
const dy = y[i2] - my;
|
|
43287
|
+
sxy += (i2 - mx) * dy;
|
|
43288
|
+
sxx += (i2 - mx) * (i2 - mx);
|
|
43289
|
+
syy += dy * dy;
|
|
43290
|
+
}
|
|
43291
|
+
if (syy === 0 || sxx === 0 || n < 3) return { shift: 0, t: 0 };
|
|
43292
|
+
const slope = sxy / sxx;
|
|
43293
|
+
const resid = syy - slope * sxy;
|
|
43294
|
+
const se = Math.sqrt(Math.max(resid, 0) / (n - 2) / sxx);
|
|
43295
|
+
let tail = 0;
|
|
43296
|
+
for (let i2 = n - hold; i2 < n; i2++) tail += y[i2];
|
|
43297
|
+
let head = 0;
|
|
43298
|
+
for (let i2 = 0; i2 < n - hold; i2++) head += y[i2];
|
|
43299
|
+
const shift3 = Math.abs(tail / hold - head / (n - hold)) / Math.sqrt(syy / n);
|
|
43300
|
+
return { shift: shift3, t: se === 0 ? Number.POSITIVE_INFINITY : Math.abs(slope / se) };
|
|
43301
|
+
}
|
|
43302
|
+
function reportedFor(alpha, beta, shape2) {
|
|
43303
|
+
const key = `${alpha}/${beta}`;
|
|
43304
|
+
let drift;
|
|
43305
|
+
if (beta === LOW) drift = false;
|
|
43306
|
+
else if (ALWAYS_DRIFT.has(key)) drift = true;
|
|
43307
|
+
else if (NEVER_DRIFT.has(key)) drift = false;
|
|
43308
|
+
else drift = shape2.shift <= DRIFT_SHIFT && shape2.t <= DRIFT_T;
|
|
43309
|
+
return { alpha, beta: drift ? LOW : beta, fit: [alpha, beta], drift };
|
|
43310
|
+
}
|
|
43311
|
+
|
|
43312
|
+
// xlsx/formula/functions/ets-search.ts
|
|
43313
|
+
var LOW2 = 1e-3;
|
|
43314
|
+
var MIN_SEARCH_POINTS = 4;
|
|
43315
|
+
var THREE_POINTS = { alpha: 0.1, beta: 0.099, gamma: LOW2, drift: false };
|
|
43316
|
+
var SEASON_ALPHAS = [2e-3, 0.126, 0.251, 0.501, 2 / 3, 0.75, 0.9];
|
|
43317
|
+
var SEASON_STEPS = [LOW2, 0.125, 0.25, 0.5, 0.75, 0.9];
|
|
43318
|
+
var SHORT_SERIES = 16;
|
|
43319
|
+
function better(c2, best) {
|
|
43320
|
+
return c2 < best * (1 - 1e-6) && c2 < best - 1e-12;
|
|
43321
|
+
}
|
|
43322
|
+
var SEASONAL_TRIPLES = [
|
|
43323
|
+
[0.126, LOW2, LOW2],
|
|
43324
|
+
[0.251, LOW2, LOW2],
|
|
43325
|
+
[0.501, LOW2, LOW2],
|
|
43326
|
+
[0.751, LOW2, LOW2],
|
|
43327
|
+
[2e-3, LOW2, 0.125],
|
|
43328
|
+
[2e-3, LOW2, 0.25],
|
|
43329
|
+
[2e-3, LOW2, 0.5],
|
|
43330
|
+
[2e-3, LOW2, 0.75],
|
|
43331
|
+
[0.251, LOW2, 0.25],
|
|
43332
|
+
[0.75, LOW2, 0.249],
|
|
43333
|
+
[0.9, LOW2, 0.099],
|
|
43334
|
+
[0.251, 0.25, LOW2],
|
|
43335
|
+
[0.1, LOW2, 0.899],
|
|
43336
|
+
[0.126, 0.125, LOW2],
|
|
43337
|
+
[0.998, 0.099, LOW2],
|
|
43338
|
+
[0.25, LOW2, 0.749],
|
|
43339
|
+
[0.5, LOW2, 0.499],
|
|
43340
|
+
[0.5, 0.25, LOW2],
|
|
43341
|
+
[0.251, 0.25, 0.25],
|
|
43342
|
+
[0.501, 0.5, LOW2]
|
|
43343
|
+
];
|
|
43344
|
+
var SHORT_EXTRA_TRIPLES = [
|
|
43345
|
+
[1 / 6, 1 / 12, 1 / 12],
|
|
43346
|
+
[1 / 3, 1 / 6, 1 / 6],
|
|
43347
|
+
[1 / 6, 1 / 12, 0.75],
|
|
43348
|
+
[1 / 3, 1 / 6, 0.5],
|
|
43349
|
+
[5 / 6, 1 / 12, 1 / 12]
|
|
43350
|
+
];
|
|
43351
|
+
function searchSeasonalLattice(cost, extra = []) {
|
|
43352
|
+
let best = { alpha: 0.126, beta: LOW2, gamma: LOW2 };
|
|
43353
|
+
let bestCost = cost(best);
|
|
43354
|
+
for (const [alpha, beta, gamma2] of [...SEASONAL_TRIPLES, ...extra]) {
|
|
43355
|
+
const c2 = cost({ alpha, beta, gamma: gamma2 });
|
|
43356
|
+
if (better(c2, bestCost)) {
|
|
43357
|
+
bestCost = c2;
|
|
43358
|
+
best = { alpha, beta, gamma: gamma2 };
|
|
43359
|
+
}
|
|
43360
|
+
}
|
|
43361
|
+
return { ...best, drift: false };
|
|
43362
|
+
}
|
|
43363
|
+
function searchSeasonal(n, cost) {
|
|
43364
|
+
let best = { alpha: 0.9, beta: LOW2, gamma: LOW2 };
|
|
43365
|
+
let bestCost = cost(best);
|
|
43366
|
+
for (const a2 of SEASON_ALPHAS)
|
|
43367
|
+
for (const b of n >= 7 && n <= SHORT_SERIES ? [LOW2, a2 - LOW2] : [LOW2])
|
|
43368
|
+
for (const g2 of [...SEASON_STEPS, 1 - a2 - LOW2]) {
|
|
43369
|
+
if (b < LOW2 || g2 > 1 - a2 - LOW2 + 1e-9) continue;
|
|
43370
|
+
const c2 = cost({ alpha: a2, beta: b, gamma: g2 });
|
|
43371
|
+
if (better(c2, bestCost)) {
|
|
43372
|
+
bestCost = c2;
|
|
43373
|
+
best = { alpha: a2, beta: b, gamma: g2 };
|
|
43374
|
+
}
|
|
43375
|
+
}
|
|
43376
|
+
return { ...best, drift: false };
|
|
43377
|
+
}
|
|
43378
|
+
function searchLattice(shape2, cost) {
|
|
43379
|
+
let best = [0.9, LOW2];
|
|
43380
|
+
let bestCost = cost({ alpha: 0.9, beta: LOW2, gamma: LOW2 });
|
|
43381
|
+
for (const [alpha, beta] of CANDIDATES) {
|
|
43382
|
+
const c2 = cost({ alpha, beta, gamma: LOW2 });
|
|
43383
|
+
if (better(c2, bestCost)) {
|
|
43384
|
+
bestCost = c2;
|
|
43385
|
+
best = [alpha, beta];
|
|
43386
|
+
}
|
|
43387
|
+
}
|
|
43388
|
+
const out = reportedFor(best[0], best[1], shape2);
|
|
43389
|
+
const [fa, fb] = out.fit;
|
|
43390
|
+
const same8 = fa === out.alpha && fb === out.beta;
|
|
43391
|
+
return {
|
|
43392
|
+
alpha: out.alpha,
|
|
43393
|
+
beta: out.beta,
|
|
43394
|
+
gamma: LOW2,
|
|
43395
|
+
drift: out.drift,
|
|
43396
|
+
...same8 ? {} : { fit: { alpha: fa, beta: fb, gamma: LOW2 } }
|
|
43397
|
+
};
|
|
43398
|
+
}
|
|
43399
|
+
function chooseSmoothing(n, m, cost, shape2 = { shift: 9, t: 99 }) {
|
|
43400
|
+
if (m >= 2 && isShortSeasonLength(n, m)) return searchSeasonalLattice(cost, SHORT_EXTRA_TRIPLES);
|
|
43401
|
+
if (m >= 2) return isExactLength(n, m) ? searchSeasonalLattice(cost) : searchSeasonal(n, cost);
|
|
43402
|
+
if (n < MIN_SEARCH_POINTS) return THREE_POINTS;
|
|
43403
|
+
return searchLattice(shape2, cost);
|
|
43404
|
+
}
|
|
43405
|
+
|
|
43406
|
+
// xlsx/formula/functions/ets-validate.ts
|
|
43407
|
+
function etsSearchSeries(y) {
|
|
43408
|
+
const pads = PADS[y.length];
|
|
43409
|
+
if (!pads) return y;
|
|
43410
|
+
const slope = olsSlope(y);
|
|
43411
|
+
return [...y, ...pads.map(([src, lag]) => y[src] + lag * slope)];
|
|
43412
|
+
}
|
|
43413
|
+
function etsValidationCost(y, m, init, p, holdout) {
|
|
43414
|
+
const n = y.length;
|
|
43415
|
+
const train = n - holdout;
|
|
43416
|
+
let { level: level4, trend } = init;
|
|
43417
|
+
const season = [...init.season];
|
|
43418
|
+
let sse = 0;
|
|
43419
|
+
for (let t = 0; t < train; t++) {
|
|
43420
|
+
const k = m >= 2 ? t % m : 0;
|
|
43421
|
+
const e = y[t] - (level4 + trend + (m >= 2 ? season[k] ?? 0 : 0));
|
|
43422
|
+
sse += e * e;
|
|
43423
|
+
level4 += trend + p.alpha * e;
|
|
43424
|
+
trend += p.beta * e;
|
|
43425
|
+
if (m >= 2) season[k] = (season[k] ?? 0) + p.gamma * e;
|
|
43426
|
+
}
|
|
43427
|
+
for (let j = 1; j <= holdout; j++) {
|
|
43428
|
+
const t = train + j - 1;
|
|
43429
|
+
const e = y[t] - (level4 + j * trend + (m >= 2 ? season[t % m] ?? 0 : 0));
|
|
43430
|
+
sse += e * e;
|
|
43431
|
+
}
|
|
43432
|
+
return sse;
|
|
43433
|
+
}
|
|
43434
|
+
|
|
42951
43435
|
// xlsx/formula/functions/ets-core.ts
|
|
42952
43436
|
function etsRun(y, m, init, p) {
|
|
42953
43437
|
let { level: level4, trend } = init;
|
|
@@ -42966,36 +43450,36 @@ function etsRun(y, m, init, p) {
|
|
|
42966
43450
|
}
|
|
42967
43451
|
return { fitted, level: level4, trend, season, sse };
|
|
42968
43452
|
}
|
|
42969
|
-
var LOW = 1e-3;
|
|
42970
|
-
var SHORT_SERIES = 16;
|
|
42971
43453
|
var NO_SEASON_GAMMA = Number.EPSILON;
|
|
42972
|
-
var ALPHAS = [2e-3, 0.1, 0.126, 0.25, 0.5, 2 / 3, 0.75, 0.9];
|
|
42973
|
-
var SEASON_ALPHAS = [2e-3, 0.126, 0.251, 0.501, 2 / 3, 0.75, 0.9];
|
|
42974
|
-
var SEASON_STEPS = [LOW, 0.125, 0.25, 0.5, 0.75, 0.9];
|
|
42975
43454
|
function fitEts(y, seasonLength) {
|
|
42976
43455
|
const n = y.length;
|
|
42977
43456
|
if (n < 2) fail(ERR.NUM);
|
|
42978
|
-
const m = seasonLength >= 2 && n >=
|
|
43457
|
+
const m = seasonLength >= 2 && n >= seasonStart(seasonLength) ? seasonLength : 0;
|
|
42979
43458
|
const solve2 = (p) => {
|
|
42980
43459
|
const init = initialStates(y, m, p, etsRun);
|
|
42981
43460
|
return { init, run: etsRun(y, m, init, p) };
|
|
42982
43461
|
};
|
|
42983
|
-
const
|
|
42984
|
-
|
|
42985
|
-
|
|
42986
|
-
|
|
42987
|
-
|
|
42988
|
-
|
|
42989
|
-
|
|
42990
|
-
|
|
42991
|
-
|
|
42992
|
-
|
|
42993
|
-
|
|
42994
|
-
|
|
42995
|
-
|
|
42996
|
-
|
|
42997
|
-
|
|
42998
|
-
|
|
43462
|
+
const exact = m < 2 || isExactLength(n, m);
|
|
43463
|
+
const padded = m >= 2 && exact ? isShortSeasonLength(n, m) ? shortSearchSeries(y, m) : paddedSearchSeries(y, m) : void 0;
|
|
43464
|
+
const searched = padded ?? (m >= 2 ? y : etsSearchSeries(y));
|
|
43465
|
+
const holdout = m >= 2 && !exact ? 0 : etsHoldout(padded && !(m >= 2 && isShortSeasonLength(n, m)) ? padded.length : n, m);
|
|
43466
|
+
const { drift, fit, ...chosen } = chooseSmoothing(
|
|
43467
|
+
n,
|
|
43468
|
+
m,
|
|
43469
|
+
(p) => etsValidationCost(searched, m, solve2(p).init, p, holdout),
|
|
43470
|
+
trendShape(y, holdout)
|
|
43471
|
+
);
|
|
43472
|
+
const { run: run2 } = solve2(fit ?? chosen);
|
|
43473
|
+
const state = drift ? solve2({ alpha: 1, beta: 0, gamma: chosen.gamma }).run : run2;
|
|
43474
|
+
return {
|
|
43475
|
+
...chosen,
|
|
43476
|
+
gamma: m >= 2 ? chosen.gamma : NO_SEASON_GAMMA,
|
|
43477
|
+
m,
|
|
43478
|
+
n,
|
|
43479
|
+
...run2,
|
|
43480
|
+
level: state.level,
|
|
43481
|
+
trend: state.trend
|
|
43482
|
+
};
|
|
42999
43483
|
}
|
|
43000
43484
|
function etsHoldout(n, m) {
|
|
43001
43485
|
if (n < 11) return 0;
|
|
@@ -43020,12 +43504,12 @@ function etsErrorSd(fit, h2) {
|
|
|
43020
43504
|
// xlsx/formula/functions/ets-season.ts
|
|
43021
43505
|
var MAX_POINTS = 8192;
|
|
43022
43506
|
var MIN_CYCLES = 3;
|
|
43023
|
-
var
|
|
43024
|
-
var
|
|
43507
|
+
var MIN_ACF = 0.3;
|
|
43508
|
+
var mean8 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
43025
43509
|
function detrend(y) {
|
|
43026
43510
|
const n = y.length;
|
|
43027
43511
|
const mx = (n - 1) / 2;
|
|
43028
|
-
const my =
|
|
43512
|
+
const my = mean8(y);
|
|
43029
43513
|
let sxy = 0;
|
|
43030
43514
|
let sxx = 0;
|
|
43031
43515
|
for (let i2 = 0; i2 < n; i2++) {
|
|
@@ -43042,34 +43526,23 @@ function detectSeasonality(series) {
|
|
|
43042
43526
|
const r = detrend(y);
|
|
43043
43527
|
const scale2 = Math.max(...y.map(Math.abs), 1);
|
|
43044
43528
|
if (r.every((v) => Math.abs(v) <= 1e-12 * scale2)) return 0;
|
|
43045
|
-
const
|
|
43046
|
-
|
|
43047
|
-
for (
|
|
43048
|
-
|
|
43049
|
-
|
|
43050
|
-
|
|
43051
|
-
|
|
43052
|
-
|
|
43053
|
-
let
|
|
43054
|
-
|
|
43055
|
-
|
|
43056
|
-
|
|
43057
|
-
|
|
43058
|
-
|
|
43059
|
-
|
|
43060
|
-
re += v * cos2[j];
|
|
43061
|
-
im -= v * sin2[j];
|
|
43062
|
-
}
|
|
43063
|
-
const power2 = re * re + im * im;
|
|
43064
|
-
total2 += power2;
|
|
43065
|
-
if (k >= MIN_CYCLES && power2 > best) {
|
|
43066
|
-
best = power2;
|
|
43067
|
-
bestK = k;
|
|
43068
|
-
}
|
|
43529
|
+
const maxLag = Math.floor(n / MIN_CYCLES);
|
|
43530
|
+
let energy = 0;
|
|
43531
|
+
for (const v of r) energy += v * v;
|
|
43532
|
+
const acf = (lag) => {
|
|
43533
|
+
let s = 0;
|
|
43534
|
+
for (let t = 0; t + lag < n; t++) s += r[t] * r[t + lag];
|
|
43535
|
+
return s / energy;
|
|
43536
|
+
};
|
|
43537
|
+
let prev = acf(1);
|
|
43538
|
+
let cur = acf(2);
|
|
43539
|
+
for (let lag = 2; lag <= maxLag; lag++) {
|
|
43540
|
+
const next = acf(lag + 1);
|
|
43541
|
+
if (cur >= prev && cur >= next && cur >= MIN_ACF) return lag;
|
|
43542
|
+
prev = cur;
|
|
43543
|
+
cur = next;
|
|
43069
43544
|
}
|
|
43070
|
-
|
|
43071
|
-
const period = Math.round(n / bestK);
|
|
43072
|
-
return period >= 2 ? period : 0;
|
|
43545
|
+
return 0;
|
|
43073
43546
|
}
|
|
43074
43547
|
|
|
43075
43548
|
// xlsx/formula/functions/ets-grid.ts
|
|
@@ -43141,9 +43614,9 @@ function aggregate2(code, xs) {
|
|
|
43141
43614
|
case 4:
|
|
43142
43615
|
return Math.max(...xs);
|
|
43143
43616
|
case 5:
|
|
43144
|
-
return Math.min(...xs);
|
|
43145
|
-
case 6:
|
|
43146
43617
|
return median2(xs);
|
|
43618
|
+
case 6:
|
|
43619
|
+
return Math.min(...xs);
|
|
43147
43620
|
default:
|
|
43148
43621
|
return xs.reduce((a2, b) => a2 + b, 0);
|
|
43149
43622
|
}
|
|
@@ -46325,9 +46798,9 @@ function needsArrayEvaluation(formula2) {
|
|
|
46325
46798
|
|
|
46326
46799
|
// xlsx/edit/range-math.ts
|
|
46327
46800
|
var axisMax = (axis) => axis === "row" ? MAX_ROW : MAX_COL;
|
|
46328
|
-
function shiftSpan(start, end,
|
|
46329
|
-
const { at, count: count2 } =
|
|
46330
|
-
const max = axisMax(
|
|
46801
|
+
function shiftSpan(start, end, shift3) {
|
|
46802
|
+
const { at, count: count2 } = shift3;
|
|
46803
|
+
const max = axisMax(shift3.axis);
|
|
46331
46804
|
if (count2 > 0) {
|
|
46332
46805
|
if (start >= at) {
|
|
46333
46806
|
if (start + count2 > max) return void 0;
|
|
@@ -46343,24 +46816,24 @@ function shiftSpan(start, end, shift2) {
|
|
|
46343
46816
|
const e = end >= max ? max : end < at ? end : end > last ? end - n : at - 1;
|
|
46344
46817
|
return s > e ? void 0 : { start: s, end: e };
|
|
46345
46818
|
}
|
|
46346
|
-
function shiftRange(range,
|
|
46347
|
-
if (
|
|
46348
|
-
const span3 = shiftSpan(range.start.row, range.end.row,
|
|
46819
|
+
function shiftRange(range, shift3) {
|
|
46820
|
+
if (shift3.axis === "row") {
|
|
46821
|
+
const span3 = shiftSpan(range.start.row, range.end.row, shift3);
|
|
46349
46822
|
return span3 && {
|
|
46350
46823
|
start: { row: span3.start, col: range.start.col },
|
|
46351
46824
|
end: { row: span3.end, col: range.end.col }
|
|
46352
46825
|
};
|
|
46353
46826
|
}
|
|
46354
|
-
const span2 = shiftSpan(range.start.col, range.end.col,
|
|
46827
|
+
const span2 = shiftSpan(range.start.col, range.end.col, shift3);
|
|
46355
46828
|
return span2 && {
|
|
46356
46829
|
start: { row: range.start.row, col: span2.start },
|
|
46357
46830
|
end: { row: range.end.row, col: span2.end }
|
|
46358
46831
|
};
|
|
46359
46832
|
}
|
|
46360
|
-
function shiftRangeInBand(range,
|
|
46361
|
-
const other =
|
|
46833
|
+
function shiftRangeInBand(range, shift3, lo, hi) {
|
|
46834
|
+
const other = shift3.axis === "row" ? "col" : "row";
|
|
46362
46835
|
if (range.end[other] < lo || range.start[other] > hi) return range;
|
|
46363
|
-
if (range.start[other] >= lo && range.end[other] <= hi) return shiftRange(range,
|
|
46836
|
+
if (range.start[other] >= lo && range.end[other] <= hi) return shiftRange(range, shift3);
|
|
46364
46837
|
return range;
|
|
46365
46838
|
}
|
|
46366
46839
|
var sameRange = (a2, b) => a2.start.row === b.start.row && a2.start.col === b.start.col && a2.end.row === b.end.row && a2.end.col === b.end.col;
|
|
@@ -46371,7 +46844,7 @@ function pointsAt(token2, formulaSheet, sheet) {
|
|
|
46371
46844
|
if (!prefix) return formulaSheet.toLowerCase() === sheet.toLowerCase();
|
|
46372
46845
|
return prefix.book === void 0 && prefix.sheet2 === void 0 && prefix.sheet.toLowerCase() === sheet.toLowerCase();
|
|
46373
46846
|
}
|
|
46374
|
-
function shiftFormulaInBand(formula2, formulaSheet, sheet,
|
|
46847
|
+
function shiftFormulaInBand(formula2, formulaSheet, sheet, shift3, band) {
|
|
46375
46848
|
let tokens2;
|
|
46376
46849
|
try {
|
|
46377
46850
|
tokens2 = tokenize(formula2);
|
|
@@ -46392,7 +46865,7 @@ function shiftFormulaInBand(formula2, formulaSheet, sheet, shift2, band) {
|
|
|
46392
46865
|
},
|
|
46393
46866
|
end: { row: Math.max(ref.start.row, ref.end.row), col: Math.max(ref.start.col, ref.end.col) }
|
|
46394
46867
|
};
|
|
46395
|
-
const moved = shiftRangeInBand(range,
|
|
46868
|
+
const moved = shiftRangeInBand(range, shift3, band.lo, band.hi);
|
|
46396
46869
|
if (moved && sameRange(moved, range)) continue;
|
|
46397
46870
|
const prefix = token2.prefix?.text ?? "";
|
|
46398
46871
|
if (!moved) {
|
|
@@ -46430,15 +46903,15 @@ function carriedRefEdits(sourceSheets, currentSheets, shiftsOf = () => []) {
|
|
|
46430
46903
|
edits.deleted.push(source3.name);
|
|
46431
46904
|
continue;
|
|
46432
46905
|
}
|
|
46433
|
-
for (const
|
|
46906
|
+
for (const shift3 of shiftsOf(current)) edits.shifts.push({ sheet: source3.name, shift: shift3 });
|
|
46434
46907
|
if (current.name !== source3.name) edits.renamed.push([source3.name, current.name]);
|
|
46435
46908
|
}
|
|
46436
46909
|
return edits;
|
|
46437
46910
|
}
|
|
46438
46911
|
var hasCarriedRefEdits = (edits) => edits.shifts.length > 0 || edits.deleted.length > 0 || edits.renamed.length > 0;
|
|
46439
|
-
function shiftOne(formula2, formulaSheet, sheet,
|
|
46440
|
-
if (
|
|
46441
|
-
const spec2 = { sheet, axis:
|
|
46912
|
+
function shiftOne(formula2, formulaSheet, sheet, shift3) {
|
|
46913
|
+
if (shift3.band) return shiftFormulaInBand(formula2, formulaSheet, sheet, shift3, shift3.band);
|
|
46914
|
+
const spec2 = { sheet, axis: shift3.axis, at: shift3.at, count: shift3.count };
|
|
46442
46915
|
return shiftFormula(formula2, formulaSheet, spec2);
|
|
46443
46916
|
}
|
|
46444
46917
|
function renameAll(formula2, renamed, taken) {
|
|
@@ -46461,7 +46934,7 @@ var takenNames = (edits) => new Set(
|
|
|
46461
46934
|
);
|
|
46462
46935
|
function patchCarriedFormula(formula2, formulaSheet, edits) {
|
|
46463
46936
|
let out = formula2;
|
|
46464
|
-
for (const { sheet, shift:
|
|
46937
|
+
for (const { sheet, shift: shift3 } of edits.shifts) out = shiftOne(out, formulaSheet, sheet, shift3);
|
|
46465
46938
|
for (const sheet of edits.deleted) out = deleteSheetInFormula(out, sheet);
|
|
46466
46939
|
return renameAll(out, edits.renamed, takenNames(edits));
|
|
46467
46940
|
}
|
|
@@ -48047,7 +48520,7 @@ function addChartSeries(space, input) {
|
|
|
48047
48520
|
const group = groups.find((_, i2) => i2 === (input.groupIndex ?? groups.length - 1));
|
|
48048
48521
|
if (!group) throw new RangeError("The chart has no chart group to add a series to");
|
|
48049
48522
|
const all2 = chartSpaceSeries(draft);
|
|
48050
|
-
const
|
|
48523
|
+
const template2 = all2[0];
|
|
48051
48524
|
const series = {
|
|
48052
48525
|
index: nextNumber(all2.map((item2) => item2.index)),
|
|
48053
48526
|
order: nextNumber(all2.map((item2) => item2.order)),
|
|
@@ -48064,7 +48537,7 @@ function addChartSeries(space, input) {
|
|
|
48064
48537
|
};
|
|
48065
48538
|
else if (input.name !== void 0) series.tx = { value: input.name, text: input.name };
|
|
48066
48539
|
if (input.spPr) series.spPr = structuredClone(input.spPr);
|
|
48067
|
-
const templateCategories =
|
|
48540
|
+
const templateCategories = template2?.categories ?? template2?.xValues;
|
|
48068
48541
|
if (input.categories !== void 0)
|
|
48069
48542
|
series[categoryKey(group)] = categorySource(
|
|
48070
48543
|
input.categories,
|
|
@@ -50180,9 +50653,9 @@ function createFieldReader(options, date1904) {
|
|
|
50180
50653
|
}
|
|
50181
50654
|
|
|
50182
50655
|
// xlsx/load/csv.ts
|
|
50183
|
-
var
|
|
50656
|
+
var CANDIDATES2 = [",", ";", " "];
|
|
50184
50657
|
function delimiterCounts(text, maxLines = 20) {
|
|
50185
|
-
const counts = new Map(
|
|
50658
|
+
const counts = new Map(CANDIDATES2.map((d) => [d, [0]]));
|
|
50186
50659
|
let quoted = false;
|
|
50187
50660
|
let lines2 = 1;
|
|
50188
50661
|
for (let i2 = 0; i2 < text.length && lines2 <= maxLines; i2++) {
|
|
@@ -50207,8 +50680,8 @@ function detectDelimiter(text) {
|
|
|
50207
50680
|
const tally = /* @__PURE__ */ new Map();
|
|
50208
50681
|
for (const count2 of list2) if (count2 > 0) tally.set(count2, (tally.get(count2) ?? 0) + 1);
|
|
50209
50682
|
const score = Math.max(0, ...tally.values());
|
|
50210
|
-
const
|
|
50211
|
-
if (
|
|
50683
|
+
const better2 = score > best.score || score === best.score && score > 0 && preference.indexOf(delimiter) < preference.indexOf(best.delimiter);
|
|
50684
|
+
if (better2) best = { delimiter, score };
|
|
50212
50685
|
}
|
|
50213
50686
|
return best.delimiter;
|
|
50214
50687
|
}
|
|
@@ -50452,10 +50925,10 @@ function processCompoundFileStream(input, path3, replacement) {
|
|
|
50452
50925
|
if (input[0] !== 208 || input[1] !== 207 || input[2] !== 17 || input[3] !== 224 || input[4] !== 161 || input[5] !== 177 || input[6] !== 26 || input[7] !== 225 || // Readers tolerate a non-canonical byte-order mark; edits do not.
|
|
50453
50926
|
replacement && view.getUint16(28, true) !== 65534)
|
|
50454
50927
|
return reject();
|
|
50455
|
-
const major = view.getUint16(26, true),
|
|
50456
|
-
if (major !== 3 && major !== 4 ||
|
|
50928
|
+
const major = view.getUint16(26, true), shift3 = view.getUint16(30, true), miniShift = view.getUint16(32, true);
|
|
50929
|
+
if (major !== 3 && major !== 4 || shift3 !== (major === 3 ? 9 : 12) || miniShift !== 6)
|
|
50457
50930
|
return reject();
|
|
50458
|
-
const sectorSize = 1 <<
|
|
50931
|
+
const sectorSize = 1 << shift3, miniSize = 1 << miniShift;
|
|
50459
50932
|
if (input.length < sectorSize || replacement && input.length % sectorSize !== 0)
|
|
50460
50933
|
return reject();
|
|
50461
50934
|
const sectorCount = Math.ceil(input.length / sectorSize) - 1;
|