ooxml-core 1.31.0 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +755 -282
- package/dist/xlsx/index.mjs +755 -282
- 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.cjs
CHANGED
|
@@ -6950,7 +6950,7 @@ var ENGLISH_PIVOT_CAPTIONS = {
|
|
|
6950
6950
|
functions: FUNCTIONS,
|
|
6951
6951
|
aggregates: aggregateNames()
|
|
6952
6952
|
};
|
|
6953
|
-
var fillCaption = (
|
|
6953
|
+
var fillCaption = (template2, ...args) => template2.replace(/\{(\d)\}/g, (_match, at) => args[Number(at)] ?? "");
|
|
6954
6954
|
function pivotCaptions(pivot) {
|
|
6955
6955
|
const own = pivot.captions;
|
|
6956
6956
|
if (!own) return ENGLISH_PIVOT_CAPTIONS;
|
|
@@ -7651,8 +7651,8 @@ var DIV0 = { error: "#DIV/0!" };
|
|
|
7651
7651
|
function variance(numbers3, sample) {
|
|
7652
7652
|
const n = numbers3.length;
|
|
7653
7653
|
if (n < (sample ? 2 : 1)) return DIV0;
|
|
7654
|
-
const
|
|
7655
|
-
const squares = numbers3.reduce((total2, value2) => total2 + (value2 -
|
|
7654
|
+
const mean9 = numbers3.reduce((total2, value2) => total2 + value2, 0) / n;
|
|
7655
|
+
const squares = numbers3.reduce((total2, value2) => total2 + (value2 - mean9) ** 2, 0);
|
|
7656
7656
|
return squares / (sample ? n - 1 : n);
|
|
7657
7657
|
}
|
|
7658
7658
|
function aggregateValues(records, field, type) {
|
|
@@ -8173,9 +8173,9 @@ function aggregateCaptionsOf(pivot) {
|
|
|
8173
8173
|
]) {
|
|
8174
8174
|
const at = measure3.caption.indexOf(measure3.field);
|
|
8175
8175
|
if (at < 0 || measure3.caption === measure3.field) continue;
|
|
8176
|
-
const
|
|
8177
|
-
if (
|
|
8178
|
-
out[measure3.aggregate] =
|
|
8176
|
+
const template2 = `${measure3.caption.slice(0, at)}{0}${measure3.caption.slice(at + measure3.field.length)}`;
|
|
8177
|
+
if (template2 !== ENGLISH_PIVOT_CAPTIONS.aggregates[measure3.aggregate])
|
|
8178
|
+
out[measure3.aggregate] = template2;
|
|
8179
8179
|
}
|
|
8180
8180
|
return Object.keys(out).length ? out : void 0;
|
|
8181
8181
|
}
|
|
@@ -11759,9 +11759,9 @@ function prefixText(prefix) {
|
|
|
11759
11759
|
// xlsx/formula/shift-formula.ts
|
|
11760
11760
|
var templates = /* @__PURE__ */ new Map();
|
|
11761
11761
|
var MAX_TEMPLATES = 2e5;
|
|
11762
|
-
function remember(text,
|
|
11762
|
+
function remember(text, template2) {
|
|
11763
11763
|
if (templates.size >= MAX_TEMPLATES) templates.clear();
|
|
11764
|
-
templates.set(text,
|
|
11764
|
+
templates.set(text, template2);
|
|
11765
11765
|
}
|
|
11766
11766
|
function mergeSpacedAreas(tokens2) {
|
|
11767
11767
|
const out = [];
|
|
@@ -11792,16 +11792,16 @@ function templateOf2(formula2) {
|
|
|
11792
11792
|
const cached = templates.get(formula2);
|
|
11793
11793
|
if (cached !== void 0) return cached;
|
|
11794
11794
|
const raw2 = safeTokens(formula2);
|
|
11795
|
-
let
|
|
11795
|
+
let template2 = null;
|
|
11796
11796
|
if (raw2) {
|
|
11797
|
-
|
|
11797
|
+
template2 = [];
|
|
11798
11798
|
let literal2 = "";
|
|
11799
11799
|
for (const token2 of mergeSpacedAreas(raw2)) {
|
|
11800
11800
|
if (token2.kind !== "ref" && !(token2.kind === "name" && token2.prefix)) {
|
|
11801
11801
|
literal2 += token2.text;
|
|
11802
11802
|
continue;
|
|
11803
11803
|
}
|
|
11804
|
-
if (literal2)
|
|
11804
|
+
if (literal2) template2.push(literal2);
|
|
11805
11805
|
literal2 = "";
|
|
11806
11806
|
const part = { kind: token2.kind, text: token2.text };
|
|
11807
11807
|
if (token2.prefix) {
|
|
@@ -11810,23 +11810,23 @@ function templateOf2(formula2) {
|
|
|
11810
11810
|
}
|
|
11811
11811
|
if (token2.ref) part.ref = token2.ref;
|
|
11812
11812
|
if (token2.spill) part.spill = true;
|
|
11813
|
-
|
|
11813
|
+
template2.push(part);
|
|
11814
11814
|
}
|
|
11815
|
-
if (literal2)
|
|
11815
|
+
if (literal2) template2.push(literal2);
|
|
11816
11816
|
}
|
|
11817
|
-
remember(formula2,
|
|
11818
|
-
return
|
|
11817
|
+
remember(formula2, template2);
|
|
11818
|
+
return template2;
|
|
11819
11819
|
}
|
|
11820
11820
|
function rewriteTemplate(formula2, rewrite2) {
|
|
11821
|
-
const
|
|
11822
|
-
if (!
|
|
11821
|
+
const template2 = templateOf2(formula2);
|
|
11822
|
+
if (!template2) return formula2;
|
|
11823
11823
|
let next;
|
|
11824
|
-
for (let i2 = 0; i2 <
|
|
11825
|
-
const part =
|
|
11824
|
+
for (let i2 = 0; i2 < template2.length; i2++) {
|
|
11825
|
+
const part = template2[i2];
|
|
11826
11826
|
if (typeof part === "string") continue;
|
|
11827
11827
|
const changed = rewrite2(part);
|
|
11828
11828
|
if (!changed) continue;
|
|
11829
|
-
next ??=
|
|
11829
|
+
next ??= template2.slice();
|
|
11830
11830
|
next[i2] = changed;
|
|
11831
11831
|
}
|
|
11832
11832
|
if (!next) return formula2;
|
|
@@ -20210,7 +20210,8 @@ var pie = {
|
|
|
20210
20210
|
gd16("stAng", "pin 0 adj1 21599999"),
|
|
20211
20211
|
gd16("endAng", "pin 0 adj2 21599999"),
|
|
20212
20212
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
20213
|
-
gd16("
|
|
20213
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
20214
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
20214
20215
|
gd16("stx", "cos wd2 stAng"),
|
|
20215
20216
|
gd16("sty", "sin hd2 stAng"),
|
|
20216
20217
|
gd16("x1", "+- hc stx 0"),
|
|
@@ -20255,7 +20256,8 @@ var chord = {
|
|
|
20255
20256
|
gd16("stAng", "pin 0 adj1 21599999"),
|
|
20256
20257
|
gd16("endAng", "pin 0 adj2 21599999"),
|
|
20257
20258
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
20258
|
-
gd16("
|
|
20259
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
20260
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
20259
20261
|
gd16("stx", "cos wd2 stAng"),
|
|
20260
20262
|
gd16("sty", "sin hd2 stAng"),
|
|
20261
20263
|
gd16("x1", "+- hc stx 0"),
|
|
@@ -20279,7 +20281,8 @@ var arc = {
|
|
|
20279
20281
|
gd16("stAng", "pin 0 adj1 21599999"),
|
|
20280
20282
|
gd16("endAng", "pin 0 adj2 21599999"),
|
|
20281
20283
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
20282
|
-
gd16("
|
|
20284
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
20285
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
20283
20286
|
gd16("stx", "cos wd2 stAng"),
|
|
20284
20287
|
gd16("sty", "sin hd2 stAng"),
|
|
20285
20288
|
gd16("x1", "+- hc stx 0"),
|
|
@@ -20374,7 +20377,8 @@ var blockArc = {
|
|
|
20374
20377
|
gd16("iwd2", "+- wd2 0 thw"),
|
|
20375
20378
|
gd16("ihd2", "+- hd2 0 thh2"),
|
|
20376
20379
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
20377
|
-
gd16("
|
|
20380
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
20381
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
20378
20382
|
gd16("mswAng", "+- 0 0 swAng2"),
|
|
20379
20383
|
gd16("stx", "cos wd2 stAng"),
|
|
20380
20384
|
gd16("sty", "sin hd2 stAng"),
|
|
@@ -29705,8 +29709,8 @@ function buildGeneratedDiagramCache(dataXml2, input) {
|
|
|
29705
29709
|
);
|
|
29706
29710
|
const direct = model2.nodes.find((node2) => node2.modelId === shape2.sourceNodeId);
|
|
29707
29711
|
const fillIndex = shape2.style?.fill?.index;
|
|
29708
|
-
const
|
|
29709
|
-
if (!direct?.fill && shape2.fill?.kind === "solid" && shape2.fill.color.kind === "srgb" && (!
|
|
29712
|
+
const template2 = fillIndex ? input.formatScheme?.fillStyles[fillIndex - 1]?.fill : void 0;
|
|
29713
|
+
if (!direct?.fill && shape2.fill?.kind === "solid" && shape2.fill.color.kind === "srgb" && (!template2 || template2.kind === "solid" && template2.color.kind === "scheme" && template2.color.value === "phClr")) {
|
|
29710
29714
|
const original = themed.get(`#${shape2.fill.color.value}`.toUpperCase());
|
|
29711
29715
|
if (original)
|
|
29712
29716
|
shape2.fill.color = {
|
|
@@ -29714,9 +29718,9 @@ function buildGeneratedDiagramCache(dataXml2, input) {
|
|
|
29714
29718
|
transforms: [...original.transforms, ...shape2.fill.color.transforms]
|
|
29715
29719
|
};
|
|
29716
29720
|
}
|
|
29717
|
-
if (!direct?.fill && shape2.fill?.kind === "gradient" &&
|
|
29721
|
+
if (!direct?.fill && shape2.fill?.kind === "gradient" && template2?.kind === "gradient") {
|
|
29718
29722
|
shape2.fill.stops.forEach((stop, index3) => {
|
|
29719
|
-
const authored =
|
|
29723
|
+
const authored = template2.stops[index3]?.color;
|
|
29720
29724
|
if (authored?.kind === "scheme" && authored.value === "phClr" && stop.color.kind === "srgb") {
|
|
29721
29725
|
const original = themed.get(`#${stop.color.value}`.toUpperCase());
|
|
29722
29726
|
if (original)
|
|
@@ -33894,7 +33898,12 @@ function vmlCaption(vml, shapeId) {
|
|
|
33894
33898
|
const shape2 = vml.slice(start, end < 0 ? void 0 : end);
|
|
33895
33899
|
const box = /<v:textbox[^>]*>([\s\S]*?)<\/v:textbox>/.exec(shape2)?.[1];
|
|
33896
33900
|
if (!box) return void 0;
|
|
33897
|
-
|
|
33901
|
+
let stripped = box.replace(/<br\s*\/?>/gi, "\n");
|
|
33902
|
+
for (let prev = ""; prev !== stripped; ) {
|
|
33903
|
+
prev = stripped;
|
|
33904
|
+
stripped = stripped.replace(/<[^>]*>/g, "");
|
|
33905
|
+
}
|
|
33906
|
+
const text = stripped.replace(/&(#x?[0-9a-f]+|\w+);/gi, (match2, code) => {
|
|
33898
33907
|
if (code.startsWith("#")) {
|
|
33899
33908
|
const value2 = code[1]?.toLowerCase() === "x" ? parseInt(code.slice(2), 16) : Number(code.slice(1));
|
|
33900
33909
|
return Number.isFinite(value2) ? String.fromCodePoint(value2) : match2;
|
|
@@ -36599,12 +36608,12 @@ function reanchor(xml, anchor) {
|
|
|
36599
36608
|
).documentElement;
|
|
36600
36609
|
for (const candidate of Array.from(holder.childNodes)) {
|
|
36601
36610
|
if (candidate.nodeType !== 1) continue;
|
|
36602
|
-
const
|
|
36603
|
-
const original = first(old,
|
|
36604
|
-
const position = original ? original.cloneNode(true) : doc.importNode(
|
|
36605
|
-
for (const attribute2 of Array.from(
|
|
36611
|
+
const template2 = candidate;
|
|
36612
|
+
const original = first(old, template2.localName, NS.xdr);
|
|
36613
|
+
const position = original ? original.cloneNode(true) : doc.importNode(template2, true);
|
|
36614
|
+
for (const attribute2 of Array.from(template2.attributes))
|
|
36606
36615
|
position.setAttribute(attribute2.name, attribute2.value);
|
|
36607
|
-
for (const value2 of Array.from(
|
|
36616
|
+
for (const value2 of Array.from(template2.childNodes)) {
|
|
36608
36617
|
if (value2.nodeType !== 1) continue;
|
|
36609
36618
|
const item2 = value2;
|
|
36610
36619
|
const existing = first(position, item2.localName, NS.xdr);
|
|
@@ -38012,14 +38021,14 @@ function linearFit(xs, ys) {
|
|
|
38012
38021
|
return { slope, intercept: my - slope * mx };
|
|
38013
38022
|
}
|
|
38014
38023
|
function rank2(values2, x, ascending, average) {
|
|
38015
|
-
let
|
|
38024
|
+
let better2 = 0;
|
|
38016
38025
|
let ties = 0;
|
|
38017
38026
|
for (const v of values2) {
|
|
38018
38027
|
if (v === x) ties++;
|
|
38019
|
-
else if (ascending ? v < x : v > x)
|
|
38028
|
+
else if (ascending ? v < x : v > x) better2++;
|
|
38020
38029
|
}
|
|
38021
38030
|
if (ties === 0) fail(ERR.NA);
|
|
38022
|
-
return average ?
|
|
38031
|
+
return average ? better2 + (ties + 1) / 2 : better2 + 1;
|
|
38023
38032
|
}
|
|
38024
38033
|
var LANCZOS = [
|
|
38025
38034
|
676.5203681218851,
|
|
@@ -42863,11 +42872,11 @@ function binomDist(k, n, p, cumulative2) {
|
|
|
42863
42872
|
for (let i2 = 0; i2 <= kk; i2++) total2 += binomPmf(i2, nn, p);
|
|
42864
42873
|
return Math.min(1, total2);
|
|
42865
42874
|
}
|
|
42866
|
-
function poisson(k,
|
|
42875
|
+
function poisson(k, mean9, cumulative2) {
|
|
42867
42876
|
const kk = Math.trunc(k);
|
|
42868
|
-
if (kk < 0 ||
|
|
42869
|
-
if (cumulative2) return 1 - gammaP(kk + 1,
|
|
42870
|
-
return Math.exp(kk * Math.log(
|
|
42877
|
+
if (kk < 0 || mean9 < 0) fail(ERR.NUM);
|
|
42878
|
+
if (cumulative2) return 1 - gammaP(kk + 1, mean9);
|
|
42879
|
+
return Math.exp(kk * Math.log(mean9) - mean9 - gammaLn(kk + 1));
|
|
42871
42880
|
}
|
|
42872
42881
|
var normDist = (x, m, s, cumulative2) => {
|
|
42873
42882
|
positive2(s);
|
|
@@ -42875,13 +42884,272 @@ var normDist = (x, m, s, cumulative2) => {
|
|
|
42875
42884
|
return cumulative2 ? normCdf(z) : normPdf(z) / s;
|
|
42876
42885
|
};
|
|
42877
42886
|
|
|
42887
|
+
// xlsx/formula/functions/ets-init-three.ts
|
|
42888
|
+
var mean2 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
42889
|
+
function slopeOf(v) {
|
|
42890
|
+
const k = v.length;
|
|
42891
|
+
const mx = (k - 1) / 2;
|
|
42892
|
+
const my = mean2(v);
|
|
42893
|
+
let sxy = 0;
|
|
42894
|
+
let sxx = 0;
|
|
42895
|
+
for (let i2 = 0; i2 < k; i2++) {
|
|
42896
|
+
sxy += (i2 - mx) * (v[i2] - my);
|
|
42897
|
+
sxx += (i2 - mx) * (i2 - mx);
|
|
42898
|
+
}
|
|
42899
|
+
return sxx === 0 ? 0 : sxy / sxx;
|
|
42900
|
+
}
|
|
42901
|
+
function positionSlopes(y, m) {
|
|
42902
|
+
return Array.from({ length: m }, (_v, c2) => {
|
|
42903
|
+
const vals = [];
|
|
42904
|
+
for (let t = c2; t < y.length; t += m) vals.push(y[t]);
|
|
42905
|
+
return slopeOf(vals) / m;
|
|
42906
|
+
});
|
|
42907
|
+
}
|
|
42908
|
+
function isThreeSeasonLength(n, m) {
|
|
42909
|
+
return m >= 4 && n >= 3 * m && n <= 3 * m + Math.ceil(m / 2) + 1;
|
|
42910
|
+
}
|
|
42911
|
+
function threeSeasonSeasonals(y, m, slopeSumOverride) {
|
|
42912
|
+
const n = y.length;
|
|
42913
|
+
const extra = n - 3 * m;
|
|
42914
|
+
const j0 = Math.floor(m / 2);
|
|
42915
|
+
const at = (t) => y[t];
|
|
42916
|
+
const slope = (j) => (at(j + 2 * m) - at(j)) / (2 * m);
|
|
42917
|
+
const B = (j) => j + 2 * m < n ? slope(j) : slope(j % m);
|
|
42918
|
+
const e = (t) => at(t) - at(t - 1) - B(t - j0);
|
|
42919
|
+
const slopeSum = slopeSumOverride ?? positionSlopes(y, m).reduce((a2, b) => a2 + b, 0);
|
|
42920
|
+
const out = [0];
|
|
42921
|
+
for (let k = 1; k < m; k++) {
|
|
42922
|
+
let back = 0;
|
|
42923
|
+
for (let t = k + 1; t <= m; t++) back -= e(t);
|
|
42924
|
+
let fwd = 0;
|
|
42925
|
+
for (let t = m + 1; t <= m + k; t++) fwd += e(t);
|
|
42926
|
+
if (k < j0 - 1) {
|
|
42927
|
+
out.push(fwd);
|
|
42928
|
+
continue;
|
|
42929
|
+
}
|
|
42930
|
+
if (k === m - 1 && extra <= Math.ceil(m / 2)) {
|
|
42931
|
+
out.push(back);
|
|
42932
|
+
continue;
|
|
42933
|
+
}
|
|
42934
|
+
const wrapped = Math.max(0, k - j0 + 1 - extra);
|
|
42935
|
+
let corner4 = 0;
|
|
42936
|
+
for (let i2 = extra; i2 <= k - j0; i2++)
|
|
42937
|
+
corner4 += (at(i2 + m) + at(i2 + 2 * m) - 2 * at(i2)) / (4 * m);
|
|
42938
|
+
const level4 = (at(k) + at(m + k)) / 2 - at(m);
|
|
42939
|
+
const bb = back - (at(k) - at(m));
|
|
42940
|
+
const ff = fwd - (at(m + k) - at(m));
|
|
42941
|
+
out.push(level4 + (bb + ff) / 2 - 3 * wrapped / (4 * m) * slopeSum + corner4);
|
|
42942
|
+
}
|
|
42943
|
+
return out;
|
|
42944
|
+
}
|
|
42945
|
+
function padThreeSeasons(y, m, slopeMean = mean2(positionSlopes(y, m))) {
|
|
42946
|
+
const n = y.length;
|
|
42947
|
+
const total2 = Math.max(3 * m + Math.ceil(m / 2), n);
|
|
42948
|
+
const ext = [...y];
|
|
42949
|
+
for (let t = n; t < total2; t++) ext.push(y[t - 3 * m] + 3 * m * slopeMean);
|
|
42950
|
+
return ext;
|
|
42951
|
+
}
|
|
42952
|
+
function threeSeasonTrend(y, m, rel, slopeMean) {
|
|
42953
|
+
const ext = padThreeSeasons(y, m, slopeMean);
|
|
42954
|
+
const total2 = ext.length;
|
|
42955
|
+
const mx = (total2 - 1) / 2;
|
|
42956
|
+
let sxx = 0;
|
|
42957
|
+
let sxy = 0;
|
|
42958
|
+
for (let t = 0; t < total2; t++) {
|
|
42959
|
+
sxx += (t - mx) * (t - mx);
|
|
42960
|
+
sxy += (t - mx) * (ext[t] - rel[t % m]);
|
|
42961
|
+
}
|
|
42962
|
+
return sxy / sxx;
|
|
42963
|
+
}
|
|
42964
|
+
function isTwoSeasonLength(n, m) {
|
|
42965
|
+
return m >= 4 && n === 2 * m;
|
|
42966
|
+
}
|
|
42967
|
+
function isTwoPlusLength(n, m) {
|
|
42968
|
+
return m >= 4 && n > 2 * m && n < 3 * m;
|
|
42969
|
+
}
|
|
42970
|
+
function slopeSumOf(y, m) {
|
|
42971
|
+
return positionSlopes(y, m).reduce((a2, c2) => a2 + c2, 0);
|
|
42972
|
+
}
|
|
42973
|
+
function extendTwoSeasons(y, m) {
|
|
42974
|
+
const b = mean2(positionSlopes(y, m));
|
|
42975
|
+
const out = [...y];
|
|
42976
|
+
for (let t = y.length; t < 3 * m; t++) out.push(y[t - 2 * m] + 2 * m * b);
|
|
42977
|
+
return out;
|
|
42978
|
+
}
|
|
42979
|
+
function paddedSearchSeries(y, m) {
|
|
42980
|
+
if (isTwoSeasonLength(y.length, m) || isTwoPlusLength(y.length, m))
|
|
42981
|
+
return padThreeSeasons(extendTwoSeasons(y, m), m, slopeSumOf(y, m) / m);
|
|
42982
|
+
if (isThreeSeasonLength(y.length, m)) return padThreeSeasons(y, m);
|
|
42983
|
+
return void 0;
|
|
42984
|
+
}
|
|
42985
|
+
|
|
42986
|
+
// xlsx/formula/functions/ets-init-states.ts
|
|
42987
|
+
var mean3 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
42988
|
+
function chainStates(y, m, seasons) {
|
|
42989
|
+
const h2 = Math.floor(seasons / 2);
|
|
42990
|
+
const first2 = seasons - h2;
|
|
42991
|
+
const at = (t) => y[t];
|
|
42992
|
+
const meanFirst = (t) => mean3(Array.from({ length: first2 }, (_v, c2) => at(t + c2 * m)));
|
|
42993
|
+
const slope = (j) => {
|
|
42994
|
+
const early = mean3(Array.from({ length: h2 }, (_v, c2) => at(j + c2 * m)));
|
|
42995
|
+
const late = mean3(Array.from({ length: h2 }, (_v, c2) => at(j + (seasons - h2 + c2) * m)));
|
|
42996
|
+
return (late - early) / ((seasons - h2) * m);
|
|
42997
|
+
};
|
|
42998
|
+
const j0 = Math.floor(m / 2);
|
|
42999
|
+
const state = /* @__PURE__ */ new Map([[j0 - 1, 0]]);
|
|
43000
|
+
for (let t = j0; t <= j0 + m - 2; t++)
|
|
43001
|
+
state.set(t, state.get(t - 1) + meanFirst(t) - meanFirst(t - 1) - slope(t - j0));
|
|
43002
|
+
const byPosition = new Array(m).fill(0);
|
|
43003
|
+
for (const [t, s] of state) byPosition[t % m] = s;
|
|
43004
|
+
return byPosition;
|
|
43005
|
+
}
|
|
43006
|
+
function chainSeasonals(y, m, seasons) {
|
|
43007
|
+
const byPosition = chainStates(y, m, seasons);
|
|
43008
|
+
const origin = byPosition[0];
|
|
43009
|
+
return byPosition.map((s) => s - origin);
|
|
43010
|
+
}
|
|
43011
|
+
|
|
43012
|
+
// xlsx/formula/functions/ets-init-four.ts
|
|
43013
|
+
var mean4 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
43014
|
+
function template(w, m, a2) {
|
|
43015
|
+
const block = (c2) => mean4(w.slice(c2 * m, (c2 + 1) * m));
|
|
43016
|
+
const at = (i2) => w[i2];
|
|
43017
|
+
return (block(0) - block(2)) / 12 + (block(1) - block(3)) / 6 - (at(a2) + at(a2 + m) - 2 * at(a2 + 2 * m)) / 6;
|
|
43018
|
+
}
|
|
43019
|
+
function fourSeasonPlusSeasonals(y, m) {
|
|
43020
|
+
const r = y.length - 4 * m;
|
|
43021
|
+
const a2 = Math.floor(m / 2) - 1;
|
|
43022
|
+
const states = chainStates(y.slice(0, 4 * m), m, 4);
|
|
43023
|
+
for (let q = 0; q < r; q++) {
|
|
43024
|
+
const pos = (a2 + q) % m;
|
|
43025
|
+
states[pos] = states[pos] + template(y.slice(q, q + 4 * m), m, a2);
|
|
43026
|
+
}
|
|
43027
|
+
const origin = states[0];
|
|
43028
|
+
return states.map((s) => s - origin);
|
|
43029
|
+
}
|
|
43030
|
+
|
|
43031
|
+
// xlsx/formula/functions/ets-init-threeplus.ts
|
|
43032
|
+
var mean5 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
43033
|
+
function isThreePlusLength(n, m) {
|
|
43034
|
+
return m >= 4 && n >= 3 * m + Math.ceil(m / 2) + 2 && n < 4 * m;
|
|
43035
|
+
}
|
|
43036
|
+
function shift2(y, m, k) {
|
|
43037
|
+
const a2 = Math.ceil(m / 2) + 1;
|
|
43038
|
+
const at = (i2) => y[i2];
|
|
43039
|
+
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;
|
|
43040
|
+
}
|
|
43041
|
+
function isLowThreeLength(n, m) {
|
|
43042
|
+
return m === 2 && n >= 5 && n < 8 || m === 3 && n >= 6 && n < 12;
|
|
43043
|
+
}
|
|
43044
|
+
function lowSeasonSeasonals(y, m, slopeSum) {
|
|
43045
|
+
const base = threeSeasonSeasonals(y, m, slopeSum);
|
|
43046
|
+
const d = -shift2(y, m, -m);
|
|
43047
|
+
return base.map((s, k) => k === 0 ? 0 : s + d);
|
|
43048
|
+
}
|
|
43049
|
+
function threePlusSeasonals(y, m) {
|
|
43050
|
+
const base = threeSeasonSeasonals(y, m);
|
|
43051
|
+
const moved = y.length - 3 * m - Math.ceil(m / 2) - 1;
|
|
43052
|
+
const z = base.map((s, k) => k < moved ? s - shift2(y, m, k) : s);
|
|
43053
|
+
const origin = z[0];
|
|
43054
|
+
return z.map((s) => s - origin);
|
|
43055
|
+
}
|
|
43056
|
+
|
|
43057
|
+
// xlsx/formula/functions/ets-init-short.ts
|
|
43058
|
+
function seasonStart(m) {
|
|
43059
|
+
return Math.ceil(10 * (m + 1) / 7);
|
|
43060
|
+
}
|
|
43061
|
+
function isShortSeasonLength(n, m) {
|
|
43062
|
+
return m >= 5 && n >= seasonStart(m) && n < 2 * m;
|
|
43063
|
+
}
|
|
43064
|
+
function padTwoSeasons(y, m) {
|
|
43065
|
+
const p = [...y];
|
|
43066
|
+
for (let t = y.length; t < 2 * m; t++) p.push(p[t - m]);
|
|
43067
|
+
return p;
|
|
43068
|
+
}
|
|
43069
|
+
function trendShift(m, n) {
|
|
43070
|
+
const j0 = Math.floor(m / 2);
|
|
43071
|
+
const u = 2 * m - 1 - n;
|
|
43072
|
+
return (u * u - (j0 - 2) * u + 2 * (j0 - 1)) / 4;
|
|
43073
|
+
}
|
|
43074
|
+
function shortSeasonStart(y, m) {
|
|
43075
|
+
const n = y.length;
|
|
43076
|
+
const p = padTwoSeasons(y, m);
|
|
43077
|
+
const ss = slopeSumOf(p, m);
|
|
43078
|
+
const ext = extendTwoSeasons(p, m);
|
|
43079
|
+
const base = threeSeasonSeasonals(ext, m, ss);
|
|
43080
|
+
const total2 = 3 * m + Math.ceil(m / 2);
|
|
43081
|
+
const sxx = total2 * (total2 * total2 - 1) / 12;
|
|
43082
|
+
const trend = threeSeasonTrend(ext, m, base, ss / m) + trendShift(m, n) * ss / sxx;
|
|
43083
|
+
const rel = base.map((s, k) => k >= n - m && k <= m - 2 ? s + ss / 2 : s);
|
|
43084
|
+
return { rel, trend };
|
|
43085
|
+
}
|
|
43086
|
+
function shortSearchSeries(y, m) {
|
|
43087
|
+
const p = padTwoSeasons(y, m);
|
|
43088
|
+
return padThreeSeasons(extendTwoSeasons(p, m), m, slopeSumOf(p, m) / m);
|
|
43089
|
+
}
|
|
43090
|
+
|
|
43091
|
+
// xlsx/formula/functions/ets-init-chain.ts
|
|
43092
|
+
var MAX_SEASONS = 5;
|
|
43093
|
+
var mean6 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
43094
|
+
function isExactLength(n, m) {
|
|
43095
|
+
const whole = Math.floor(n / m);
|
|
43096
|
+
return whole >= MAX_SEASONS || whole === 4 || isThreeSeasonLength(n, m) || isThreePlusLength(n, m) || isLowThreeLength(n, m) || isTwoSeasonLength(n, m) || isTwoPlusLength(n, m) || isShortSeasonLength(n, m);
|
|
43097
|
+
}
|
|
43098
|
+
function fromRelative(y0, rel, trend) {
|
|
43099
|
+
const combined = rel.map((s) => y0 + s - trend);
|
|
43100
|
+
const level4 = mean6(combined);
|
|
43101
|
+
return { level: level4, trend, season: combined.map((c2) => c2 - level4) };
|
|
43102
|
+
}
|
|
43103
|
+
function chainStart(y, m) {
|
|
43104
|
+
const n = y.length;
|
|
43105
|
+
const whole = Math.floor(n / m);
|
|
43106
|
+
if (isShortSeasonLength(n, m)) {
|
|
43107
|
+
const { rel: rel2, trend } = shortSeasonStart(y, m);
|
|
43108
|
+
return fromRelative(y[0], rel2, trend);
|
|
43109
|
+
}
|
|
43110
|
+
if (isThreeSeasonLength(n, m) || isTwoSeasonLength(n, m) || isTwoPlusLength(n, m)) {
|
|
43111
|
+
const short = isTwoSeasonLength(n, m) || isTwoPlusLength(n, m);
|
|
43112
|
+
const series = short ? extendTwoSeasons(y, m) : y;
|
|
43113
|
+
const rel2 = threeSeasonSeasonals(series, m, short ? slopeSumOf(y, m) : void 0);
|
|
43114
|
+
return fromRelative(
|
|
43115
|
+
y[0],
|
|
43116
|
+
rel2,
|
|
43117
|
+
threeSeasonTrend(series, m, rel2, short ? slopeSumOf(y, m) / m : void 0)
|
|
43118
|
+
);
|
|
43119
|
+
}
|
|
43120
|
+
if (isLowThreeLength(n, m)) {
|
|
43121
|
+
const short = n < 3 * m;
|
|
43122
|
+
const series = short ? extendTwoSeasons(y, m) : y;
|
|
43123
|
+
const rel2 = lowSeasonSeasonals(series, m, short ? slopeSumOf(y, m) : void 0);
|
|
43124
|
+
const pad6 = short ? slopeSumOf(y, m) / m : void 0;
|
|
43125
|
+
return fromRelative(y[0], rel2, threeSeasonTrend(series, m, rel2, pad6));
|
|
43126
|
+
}
|
|
43127
|
+
if (isThreePlusLength(n, m)) {
|
|
43128
|
+
const rel2 = threePlusSeasonals(y, m);
|
|
43129
|
+
return fromRelative(y[0], rel2, threeSeasonTrend(y, m, rel2));
|
|
43130
|
+
}
|
|
43131
|
+
if (m < 2 || whole < 4) return void 0;
|
|
43132
|
+
const partial = whole < MAX_SEASONS && n % m !== 0;
|
|
43133
|
+
const rel = partial ? fourSeasonPlusSeasonals(y, m) : chainSeasonals(y, m, Math.min(whole, MAX_SEASONS));
|
|
43134
|
+
const mx = (n - 1) / 2;
|
|
43135
|
+
let sxy = 0;
|
|
43136
|
+
let sxx = 0;
|
|
43137
|
+
const my = mean6(y.map((v, t) => v - rel[t % m]));
|
|
43138
|
+
for (let t = 0; t < n; t++) {
|
|
43139
|
+
const d = y[t] - rel[t % m] - my;
|
|
43140
|
+
sxy += (t - mx) * d;
|
|
43141
|
+
sxx += (t - mx) * (t - mx);
|
|
43142
|
+
}
|
|
43143
|
+
return fromRelative(y[0], rel, sxy / sxx);
|
|
43144
|
+
}
|
|
43145
|
+
|
|
42878
43146
|
// xlsx/formula/functions/ets-init.ts
|
|
42879
43147
|
var MAX_EXACT_SEASON = 24;
|
|
42880
|
-
var
|
|
43148
|
+
var mean7 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
42881
43149
|
function olsSlope(y) {
|
|
42882
43150
|
const n = y.length;
|
|
42883
43151
|
const mx = (n - 1) / 2;
|
|
42884
|
-
const my =
|
|
43152
|
+
const my = mean7(y);
|
|
42885
43153
|
let sxy = 0;
|
|
42886
43154
|
let sxx = 0;
|
|
42887
43155
|
for (let i2 = 0; i2 < n; i2++) {
|
|
@@ -42890,12 +43158,30 @@ function olsSlope(y) {
|
|
|
42890
43158
|
}
|
|
42891
43159
|
return sxx === 0 ? 0 : sxy / sxx;
|
|
42892
43160
|
}
|
|
43161
|
+
var PADS = {
|
|
43162
|
+
6: [[0, 6]],
|
|
43163
|
+
5: [
|
|
43164
|
+
[1, 4],
|
|
43165
|
+
[0, 6]
|
|
43166
|
+
],
|
|
43167
|
+
4: [
|
|
43168
|
+
[0, 4],
|
|
43169
|
+
[1, 4],
|
|
43170
|
+
[0, 6]
|
|
43171
|
+
]
|
|
43172
|
+
};
|
|
43173
|
+
function shortSeriesTrend(y) {
|
|
43174
|
+
const pads = PADS[y.length];
|
|
43175
|
+
if (!pads) return olsSlope(y);
|
|
43176
|
+
const slope = olsSlope(y);
|
|
43177
|
+
return olsSlope([...y, ...pads.map(([src, lag]) => y[src] + lag * slope)]);
|
|
43178
|
+
}
|
|
42893
43179
|
function split(trend, combined) {
|
|
42894
|
-
const level4 =
|
|
43180
|
+
const level4 = mean7(combined);
|
|
42895
43181
|
return { level: level4, trend, season: combined.map((c2) => c2 - level4) };
|
|
42896
43182
|
}
|
|
42897
43183
|
function heuristicStates(y, m) {
|
|
42898
|
-
const trend = (
|
|
43184
|
+
const trend = (mean7(y.slice(m, 2 * m)) - mean7(y.slice(0, m))) / m;
|
|
42899
43185
|
return split(
|
|
42900
43186
|
trend,
|
|
42901
43187
|
Array.from({ length: m }, (_v, k) => y[k] - trend * (k + 1))
|
|
@@ -42932,9 +43218,11 @@ function solveSystem(a2, b) {
|
|
|
42932
43218
|
function initialStates(y, m, p, run2) {
|
|
42933
43219
|
const y0 = y[0];
|
|
42934
43220
|
if (m < 2) {
|
|
42935
|
-
const trend2 =
|
|
43221
|
+
const trend2 = shortSeriesTrend(y);
|
|
42936
43222
|
return { level: y0 - trend2, trend: trend2, season: [] };
|
|
42937
43223
|
}
|
|
43224
|
+
const exact = chainStart(y, m);
|
|
43225
|
+
if (exact) return exact;
|
|
42938
43226
|
if (m > MAX_EXACT_SEASON) return heuristicStates(y, m);
|
|
42939
43227
|
const zeros = new Array(y.length).fill(0);
|
|
42940
43228
|
const unit = (trend2, season) => run2(zeros, m, { level: 0, trend: trend2, season }, p).fitted;
|
|
@@ -42954,6 +43242,202 @@ function initialStates(y, m, p, run2) {
|
|
|
42954
43242
|
return split(trend, [y0 - trend, ...u.slice(1)]);
|
|
42955
43243
|
}
|
|
42956
43244
|
|
|
43245
|
+
// xlsx/formula/functions/ets-search-map.ts
|
|
43246
|
+
var LOW = 1e-3;
|
|
43247
|
+
var DRIFT_SHIFT = 1.5;
|
|
43248
|
+
var DRIFT_T = 9.3;
|
|
43249
|
+
var CANDIDATES = [
|
|
43250
|
+
...[2e-3, 0.1, 0.126, 0.25, 0.5, 0.75, 0.9].map((a2) => [a2, LOW]),
|
|
43251
|
+
[0.1, 0.099],
|
|
43252
|
+
[0.126, 0.125],
|
|
43253
|
+
[0.25, 0.249],
|
|
43254
|
+
[0.333333, 0.166667],
|
|
43255
|
+
[0.5, 0.25],
|
|
43256
|
+
[0.5, 0.499],
|
|
43257
|
+
[0.666667, 0.166667],
|
|
43258
|
+
[0.666667, 0.5],
|
|
43259
|
+
[0.75, 0.749],
|
|
43260
|
+
[0.833333, 0.75],
|
|
43261
|
+
[0.9, 0.899],
|
|
43262
|
+
[0.998, 0.099],
|
|
43263
|
+
[0.998, 0.249],
|
|
43264
|
+
[0.998, 0.499],
|
|
43265
|
+
[0.998, 0.749],
|
|
43266
|
+
[0.998, 0.899],
|
|
43267
|
+
[0.166667, 0.0833333],
|
|
43268
|
+
[0.833333, 0.0833333]
|
|
43269
|
+
];
|
|
43270
|
+
var ALWAYS_DRIFT = /* @__PURE__ */ new Set([
|
|
43271
|
+
"0.1/0.099",
|
|
43272
|
+
"0.998/0.899",
|
|
43273
|
+
"0.998/0.749",
|
|
43274
|
+
"0.166667/0.0833333",
|
|
43275
|
+
"0.25/0.249",
|
|
43276
|
+
"0.9/0.899",
|
|
43277
|
+
"0.666667/0.5",
|
|
43278
|
+
"0.75/0.749"
|
|
43279
|
+
]);
|
|
43280
|
+
var NEVER_DRIFT = /* @__PURE__ */ new Set(["0.333333/0.166667"]);
|
|
43281
|
+
function trendShape(y, h2) {
|
|
43282
|
+
const n = y.length;
|
|
43283
|
+
const hold = h2 > 0 ? h2 : Math.max(1, Math.round(0.3 * n));
|
|
43284
|
+
const mx = (n - 1) / 2;
|
|
43285
|
+
let my = 0;
|
|
43286
|
+
for (const v of y) my += v;
|
|
43287
|
+
my /= n;
|
|
43288
|
+
let sxy = 0;
|
|
43289
|
+
let sxx = 0;
|
|
43290
|
+
let syy = 0;
|
|
43291
|
+
for (let i2 = 0; i2 < n; i2++) {
|
|
43292
|
+
const dy = y[i2] - my;
|
|
43293
|
+
sxy += (i2 - mx) * dy;
|
|
43294
|
+
sxx += (i2 - mx) * (i2 - mx);
|
|
43295
|
+
syy += dy * dy;
|
|
43296
|
+
}
|
|
43297
|
+
if (syy === 0 || sxx === 0 || n < 3) return { shift: 0, t: 0 };
|
|
43298
|
+
const slope = sxy / sxx;
|
|
43299
|
+
const resid = syy - slope * sxy;
|
|
43300
|
+
const se = Math.sqrt(Math.max(resid, 0) / (n - 2) / sxx);
|
|
43301
|
+
let tail = 0;
|
|
43302
|
+
for (let i2 = n - hold; i2 < n; i2++) tail += y[i2];
|
|
43303
|
+
let head = 0;
|
|
43304
|
+
for (let i2 = 0; i2 < n - hold; i2++) head += y[i2];
|
|
43305
|
+
const shift3 = Math.abs(tail / hold - head / (n - hold)) / Math.sqrt(syy / n);
|
|
43306
|
+
return { shift: shift3, t: se === 0 ? Number.POSITIVE_INFINITY : Math.abs(slope / se) };
|
|
43307
|
+
}
|
|
43308
|
+
function reportedFor(alpha, beta, shape2) {
|
|
43309
|
+
const key = `${alpha}/${beta}`;
|
|
43310
|
+
let drift;
|
|
43311
|
+
if (beta === LOW) drift = false;
|
|
43312
|
+
else if (ALWAYS_DRIFT.has(key)) drift = true;
|
|
43313
|
+
else if (NEVER_DRIFT.has(key)) drift = false;
|
|
43314
|
+
else drift = shape2.shift <= DRIFT_SHIFT && shape2.t <= DRIFT_T;
|
|
43315
|
+
return { alpha, beta: drift ? LOW : beta, fit: [alpha, beta], drift };
|
|
43316
|
+
}
|
|
43317
|
+
|
|
43318
|
+
// xlsx/formula/functions/ets-search.ts
|
|
43319
|
+
var LOW2 = 1e-3;
|
|
43320
|
+
var MIN_SEARCH_POINTS = 4;
|
|
43321
|
+
var THREE_POINTS = { alpha: 0.1, beta: 0.099, gamma: LOW2, drift: false };
|
|
43322
|
+
var SEASON_ALPHAS = [2e-3, 0.126, 0.251, 0.501, 2 / 3, 0.75, 0.9];
|
|
43323
|
+
var SEASON_STEPS = [LOW2, 0.125, 0.25, 0.5, 0.75, 0.9];
|
|
43324
|
+
var SHORT_SERIES = 16;
|
|
43325
|
+
function better(c2, best) {
|
|
43326
|
+
return c2 < best * (1 - 1e-6) && c2 < best - 1e-12;
|
|
43327
|
+
}
|
|
43328
|
+
var SEASONAL_TRIPLES = [
|
|
43329
|
+
[0.126, LOW2, LOW2],
|
|
43330
|
+
[0.251, LOW2, LOW2],
|
|
43331
|
+
[0.501, LOW2, LOW2],
|
|
43332
|
+
[0.751, LOW2, LOW2],
|
|
43333
|
+
[2e-3, LOW2, 0.125],
|
|
43334
|
+
[2e-3, LOW2, 0.25],
|
|
43335
|
+
[2e-3, LOW2, 0.5],
|
|
43336
|
+
[2e-3, LOW2, 0.75],
|
|
43337
|
+
[0.251, LOW2, 0.25],
|
|
43338
|
+
[0.75, LOW2, 0.249],
|
|
43339
|
+
[0.9, LOW2, 0.099],
|
|
43340
|
+
[0.251, 0.25, LOW2],
|
|
43341
|
+
[0.1, LOW2, 0.899],
|
|
43342
|
+
[0.126, 0.125, LOW2],
|
|
43343
|
+
[0.998, 0.099, LOW2],
|
|
43344
|
+
[0.25, LOW2, 0.749],
|
|
43345
|
+
[0.5, LOW2, 0.499],
|
|
43346
|
+
[0.5, 0.25, LOW2],
|
|
43347
|
+
[0.251, 0.25, 0.25],
|
|
43348
|
+
[0.501, 0.5, LOW2]
|
|
43349
|
+
];
|
|
43350
|
+
var SHORT_EXTRA_TRIPLES = [
|
|
43351
|
+
[1 / 6, 1 / 12, 1 / 12],
|
|
43352
|
+
[1 / 3, 1 / 6, 1 / 6],
|
|
43353
|
+
[1 / 6, 1 / 12, 0.75],
|
|
43354
|
+
[1 / 3, 1 / 6, 0.5],
|
|
43355
|
+
[5 / 6, 1 / 12, 1 / 12]
|
|
43356
|
+
];
|
|
43357
|
+
function searchSeasonalLattice(cost, extra = []) {
|
|
43358
|
+
let best = { alpha: 0.126, beta: LOW2, gamma: LOW2 };
|
|
43359
|
+
let bestCost = cost(best);
|
|
43360
|
+
for (const [alpha, beta, gamma2] of [...SEASONAL_TRIPLES, ...extra]) {
|
|
43361
|
+
const c2 = cost({ alpha, beta, gamma: gamma2 });
|
|
43362
|
+
if (better(c2, bestCost)) {
|
|
43363
|
+
bestCost = c2;
|
|
43364
|
+
best = { alpha, beta, gamma: gamma2 };
|
|
43365
|
+
}
|
|
43366
|
+
}
|
|
43367
|
+
return { ...best, drift: false };
|
|
43368
|
+
}
|
|
43369
|
+
function searchSeasonal(n, cost) {
|
|
43370
|
+
let best = { alpha: 0.9, beta: LOW2, gamma: LOW2 };
|
|
43371
|
+
let bestCost = cost(best);
|
|
43372
|
+
for (const a2 of SEASON_ALPHAS)
|
|
43373
|
+
for (const b of n >= 7 && n <= SHORT_SERIES ? [LOW2, a2 - LOW2] : [LOW2])
|
|
43374
|
+
for (const g2 of [...SEASON_STEPS, 1 - a2 - LOW2]) {
|
|
43375
|
+
if (b < LOW2 || g2 > 1 - a2 - LOW2 + 1e-9) continue;
|
|
43376
|
+
const c2 = cost({ alpha: a2, beta: b, gamma: g2 });
|
|
43377
|
+
if (better(c2, bestCost)) {
|
|
43378
|
+
bestCost = c2;
|
|
43379
|
+
best = { alpha: a2, beta: b, gamma: g2 };
|
|
43380
|
+
}
|
|
43381
|
+
}
|
|
43382
|
+
return { ...best, drift: false };
|
|
43383
|
+
}
|
|
43384
|
+
function searchLattice(shape2, cost) {
|
|
43385
|
+
let best = [0.9, LOW2];
|
|
43386
|
+
let bestCost = cost({ alpha: 0.9, beta: LOW2, gamma: LOW2 });
|
|
43387
|
+
for (const [alpha, beta] of CANDIDATES) {
|
|
43388
|
+
const c2 = cost({ alpha, beta, gamma: LOW2 });
|
|
43389
|
+
if (better(c2, bestCost)) {
|
|
43390
|
+
bestCost = c2;
|
|
43391
|
+
best = [alpha, beta];
|
|
43392
|
+
}
|
|
43393
|
+
}
|
|
43394
|
+
const out = reportedFor(best[0], best[1], shape2);
|
|
43395
|
+
const [fa, fb] = out.fit;
|
|
43396
|
+
const same8 = fa === out.alpha && fb === out.beta;
|
|
43397
|
+
return {
|
|
43398
|
+
alpha: out.alpha,
|
|
43399
|
+
beta: out.beta,
|
|
43400
|
+
gamma: LOW2,
|
|
43401
|
+
drift: out.drift,
|
|
43402
|
+
...same8 ? {} : { fit: { alpha: fa, beta: fb, gamma: LOW2 } }
|
|
43403
|
+
};
|
|
43404
|
+
}
|
|
43405
|
+
function chooseSmoothing(n, m, cost, shape2 = { shift: 9, t: 99 }) {
|
|
43406
|
+
if (m >= 2 && isShortSeasonLength(n, m)) return searchSeasonalLattice(cost, SHORT_EXTRA_TRIPLES);
|
|
43407
|
+
if (m >= 2) return isExactLength(n, m) ? searchSeasonalLattice(cost) : searchSeasonal(n, cost);
|
|
43408
|
+
if (n < MIN_SEARCH_POINTS) return THREE_POINTS;
|
|
43409
|
+
return searchLattice(shape2, cost);
|
|
43410
|
+
}
|
|
43411
|
+
|
|
43412
|
+
// xlsx/formula/functions/ets-validate.ts
|
|
43413
|
+
function etsSearchSeries(y) {
|
|
43414
|
+
const pads = PADS[y.length];
|
|
43415
|
+
if (!pads) return y;
|
|
43416
|
+
const slope = olsSlope(y);
|
|
43417
|
+
return [...y, ...pads.map(([src, lag]) => y[src] + lag * slope)];
|
|
43418
|
+
}
|
|
43419
|
+
function etsValidationCost(y, m, init, p, holdout) {
|
|
43420
|
+
const n = y.length;
|
|
43421
|
+
const train = n - holdout;
|
|
43422
|
+
let { level: level4, trend } = init;
|
|
43423
|
+
const season = [...init.season];
|
|
43424
|
+
let sse = 0;
|
|
43425
|
+
for (let t = 0; t < train; t++) {
|
|
43426
|
+
const k = m >= 2 ? t % m : 0;
|
|
43427
|
+
const e = y[t] - (level4 + trend + (m >= 2 ? season[k] ?? 0 : 0));
|
|
43428
|
+
sse += e * e;
|
|
43429
|
+
level4 += trend + p.alpha * e;
|
|
43430
|
+
trend += p.beta * e;
|
|
43431
|
+
if (m >= 2) season[k] = (season[k] ?? 0) + p.gamma * e;
|
|
43432
|
+
}
|
|
43433
|
+
for (let j = 1; j <= holdout; j++) {
|
|
43434
|
+
const t = train + j - 1;
|
|
43435
|
+
const e = y[t] - (level4 + j * trend + (m >= 2 ? season[t % m] ?? 0 : 0));
|
|
43436
|
+
sse += e * e;
|
|
43437
|
+
}
|
|
43438
|
+
return sse;
|
|
43439
|
+
}
|
|
43440
|
+
|
|
42957
43441
|
// xlsx/formula/functions/ets-core.ts
|
|
42958
43442
|
function etsRun(y, m, init, p) {
|
|
42959
43443
|
let { level: level4, trend } = init;
|
|
@@ -42972,36 +43456,36 @@ function etsRun(y, m, init, p) {
|
|
|
42972
43456
|
}
|
|
42973
43457
|
return { fitted, level: level4, trend, season, sse };
|
|
42974
43458
|
}
|
|
42975
|
-
var LOW = 1e-3;
|
|
42976
|
-
var SHORT_SERIES = 16;
|
|
42977
43459
|
var NO_SEASON_GAMMA = Number.EPSILON;
|
|
42978
|
-
var ALPHAS = [2e-3, 0.1, 0.126, 0.25, 0.5, 2 / 3, 0.75, 0.9];
|
|
42979
|
-
var SEASON_ALPHAS = [2e-3, 0.126, 0.251, 0.501, 2 / 3, 0.75, 0.9];
|
|
42980
|
-
var SEASON_STEPS = [LOW, 0.125, 0.25, 0.5, 0.75, 0.9];
|
|
42981
43460
|
function fitEts(y, seasonLength) {
|
|
42982
43461
|
const n = y.length;
|
|
42983
43462
|
if (n < 2) fail(ERR.NUM);
|
|
42984
|
-
const m = seasonLength >= 2 && n >=
|
|
43463
|
+
const m = seasonLength >= 2 && n >= seasonStart(seasonLength) ? seasonLength : 0;
|
|
42985
43464
|
const solve2 = (p) => {
|
|
42986
43465
|
const init = initialStates(y, m, p, etsRun);
|
|
42987
43466
|
return { init, run: etsRun(y, m, init, p) };
|
|
42988
43467
|
};
|
|
42989
|
-
const
|
|
42990
|
-
|
|
42991
|
-
|
|
42992
|
-
|
|
42993
|
-
|
|
42994
|
-
|
|
42995
|
-
|
|
42996
|
-
|
|
42997
|
-
|
|
42998
|
-
|
|
42999
|
-
|
|
43000
|
-
|
|
43001
|
-
|
|
43002
|
-
|
|
43003
|
-
|
|
43004
|
-
|
|
43468
|
+
const exact = m < 2 || isExactLength(n, m);
|
|
43469
|
+
const padded = m >= 2 && exact ? isShortSeasonLength(n, m) ? shortSearchSeries(y, m) : paddedSearchSeries(y, m) : void 0;
|
|
43470
|
+
const searched = padded ?? (m >= 2 ? y : etsSearchSeries(y));
|
|
43471
|
+
const holdout = m >= 2 && !exact ? 0 : etsHoldout(padded && !(m >= 2 && isShortSeasonLength(n, m)) ? padded.length : n, m);
|
|
43472
|
+
const { drift, fit, ...chosen } = chooseSmoothing(
|
|
43473
|
+
n,
|
|
43474
|
+
m,
|
|
43475
|
+
(p) => etsValidationCost(searched, m, solve2(p).init, p, holdout),
|
|
43476
|
+
trendShape(y, holdout)
|
|
43477
|
+
);
|
|
43478
|
+
const { run: run2 } = solve2(fit ?? chosen);
|
|
43479
|
+
const state = drift ? solve2({ alpha: 1, beta: 0, gamma: chosen.gamma }).run : run2;
|
|
43480
|
+
return {
|
|
43481
|
+
...chosen,
|
|
43482
|
+
gamma: m >= 2 ? chosen.gamma : NO_SEASON_GAMMA,
|
|
43483
|
+
m,
|
|
43484
|
+
n,
|
|
43485
|
+
...run2,
|
|
43486
|
+
level: state.level,
|
|
43487
|
+
trend: state.trend
|
|
43488
|
+
};
|
|
43005
43489
|
}
|
|
43006
43490
|
function etsHoldout(n, m) {
|
|
43007
43491
|
if (n < 11) return 0;
|
|
@@ -43026,12 +43510,12 @@ function etsErrorSd(fit, h2) {
|
|
|
43026
43510
|
// xlsx/formula/functions/ets-season.ts
|
|
43027
43511
|
var MAX_POINTS = 8192;
|
|
43028
43512
|
var MIN_CYCLES = 3;
|
|
43029
|
-
var
|
|
43030
|
-
var
|
|
43513
|
+
var MIN_ACF = 0.3;
|
|
43514
|
+
var mean8 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
43031
43515
|
function detrend(y) {
|
|
43032
43516
|
const n = y.length;
|
|
43033
43517
|
const mx = (n - 1) / 2;
|
|
43034
|
-
const my =
|
|
43518
|
+
const my = mean8(y);
|
|
43035
43519
|
let sxy = 0;
|
|
43036
43520
|
let sxx = 0;
|
|
43037
43521
|
for (let i2 = 0; i2 < n; i2++) {
|
|
@@ -43048,34 +43532,23 @@ function detectSeasonality(series) {
|
|
|
43048
43532
|
const r = detrend(y);
|
|
43049
43533
|
const scale2 = Math.max(...y.map(Math.abs), 1);
|
|
43050
43534
|
if (r.every((v) => Math.abs(v) <= 1e-12 * scale2)) return 0;
|
|
43051
|
-
const
|
|
43052
|
-
|
|
43053
|
-
for (
|
|
43054
|
-
|
|
43055
|
-
|
|
43056
|
-
|
|
43057
|
-
|
|
43058
|
-
|
|
43059
|
-
let
|
|
43060
|
-
|
|
43061
|
-
|
|
43062
|
-
|
|
43063
|
-
|
|
43064
|
-
|
|
43065
|
-
|
|
43066
|
-
re += v * cos2[j];
|
|
43067
|
-
im -= v * sin2[j];
|
|
43068
|
-
}
|
|
43069
|
-
const power2 = re * re + im * im;
|
|
43070
|
-
total2 += power2;
|
|
43071
|
-
if (k >= MIN_CYCLES && power2 > best) {
|
|
43072
|
-
best = power2;
|
|
43073
|
-
bestK = k;
|
|
43074
|
-
}
|
|
43535
|
+
const maxLag = Math.floor(n / MIN_CYCLES);
|
|
43536
|
+
let energy = 0;
|
|
43537
|
+
for (const v of r) energy += v * v;
|
|
43538
|
+
const acf = (lag) => {
|
|
43539
|
+
let s = 0;
|
|
43540
|
+
for (let t = 0; t + lag < n; t++) s += r[t] * r[t + lag];
|
|
43541
|
+
return s / energy;
|
|
43542
|
+
};
|
|
43543
|
+
let prev = acf(1);
|
|
43544
|
+
let cur = acf(2);
|
|
43545
|
+
for (let lag = 2; lag <= maxLag; lag++) {
|
|
43546
|
+
const next = acf(lag + 1);
|
|
43547
|
+
if (cur >= prev && cur >= next && cur >= MIN_ACF) return lag;
|
|
43548
|
+
prev = cur;
|
|
43549
|
+
cur = next;
|
|
43075
43550
|
}
|
|
43076
|
-
|
|
43077
|
-
const period = Math.round(n / bestK);
|
|
43078
|
-
return period >= 2 ? period : 0;
|
|
43551
|
+
return 0;
|
|
43079
43552
|
}
|
|
43080
43553
|
|
|
43081
43554
|
// xlsx/formula/functions/ets-grid.ts
|
|
@@ -43147,9 +43620,9 @@ function aggregate2(code, xs) {
|
|
|
43147
43620
|
case 4:
|
|
43148
43621
|
return Math.max(...xs);
|
|
43149
43622
|
case 5:
|
|
43150
|
-
return Math.min(...xs);
|
|
43151
|
-
case 6:
|
|
43152
43623
|
return median2(xs);
|
|
43624
|
+
case 6:
|
|
43625
|
+
return Math.min(...xs);
|
|
43153
43626
|
default:
|
|
43154
43627
|
return xs.reduce((a2, b) => a2 + b, 0);
|
|
43155
43628
|
}
|
|
@@ -46331,9 +46804,9 @@ function needsArrayEvaluation(formula2) {
|
|
|
46331
46804
|
|
|
46332
46805
|
// xlsx/edit/range-math.ts
|
|
46333
46806
|
var axisMax = (axis) => axis === "row" ? MAX_ROW : MAX_COL;
|
|
46334
|
-
function shiftSpan(start, end,
|
|
46335
|
-
const { at, count: count2 } =
|
|
46336
|
-
const max = axisMax(
|
|
46807
|
+
function shiftSpan(start, end, shift3) {
|
|
46808
|
+
const { at, count: count2 } = shift3;
|
|
46809
|
+
const max = axisMax(shift3.axis);
|
|
46337
46810
|
if (count2 > 0) {
|
|
46338
46811
|
if (start >= at) {
|
|
46339
46812
|
if (start + count2 > max) return void 0;
|
|
@@ -46349,24 +46822,24 @@ function shiftSpan(start, end, shift2) {
|
|
|
46349
46822
|
const e = end >= max ? max : end < at ? end : end > last ? end - n : at - 1;
|
|
46350
46823
|
return s > e ? void 0 : { start: s, end: e };
|
|
46351
46824
|
}
|
|
46352
|
-
function shiftRange(range,
|
|
46353
|
-
if (
|
|
46354
|
-
const span3 = shiftSpan(range.start.row, range.end.row,
|
|
46825
|
+
function shiftRange(range, shift3) {
|
|
46826
|
+
if (shift3.axis === "row") {
|
|
46827
|
+
const span3 = shiftSpan(range.start.row, range.end.row, shift3);
|
|
46355
46828
|
return span3 && {
|
|
46356
46829
|
start: { row: span3.start, col: range.start.col },
|
|
46357
46830
|
end: { row: span3.end, col: range.end.col }
|
|
46358
46831
|
};
|
|
46359
46832
|
}
|
|
46360
|
-
const span2 = shiftSpan(range.start.col, range.end.col,
|
|
46833
|
+
const span2 = shiftSpan(range.start.col, range.end.col, shift3);
|
|
46361
46834
|
return span2 && {
|
|
46362
46835
|
start: { row: range.start.row, col: span2.start },
|
|
46363
46836
|
end: { row: range.end.row, col: span2.end }
|
|
46364
46837
|
};
|
|
46365
46838
|
}
|
|
46366
|
-
function shiftRangeInBand(range,
|
|
46367
|
-
const other =
|
|
46839
|
+
function shiftRangeInBand(range, shift3, lo, hi) {
|
|
46840
|
+
const other = shift3.axis === "row" ? "col" : "row";
|
|
46368
46841
|
if (range.end[other] < lo || range.start[other] > hi) return range;
|
|
46369
|
-
if (range.start[other] >= lo && range.end[other] <= hi) return shiftRange(range,
|
|
46842
|
+
if (range.start[other] >= lo && range.end[other] <= hi) return shiftRange(range, shift3);
|
|
46370
46843
|
return range;
|
|
46371
46844
|
}
|
|
46372
46845
|
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;
|
|
@@ -46377,7 +46850,7 @@ function pointsAt(token2, formulaSheet, sheet) {
|
|
|
46377
46850
|
if (!prefix) return formulaSheet.toLowerCase() === sheet.toLowerCase();
|
|
46378
46851
|
return prefix.book === void 0 && prefix.sheet2 === void 0 && prefix.sheet.toLowerCase() === sheet.toLowerCase();
|
|
46379
46852
|
}
|
|
46380
|
-
function shiftFormulaInBand(formula2, formulaSheet, sheet,
|
|
46853
|
+
function shiftFormulaInBand(formula2, formulaSheet, sheet, shift3, band) {
|
|
46381
46854
|
let tokens2;
|
|
46382
46855
|
try {
|
|
46383
46856
|
tokens2 = tokenize(formula2);
|
|
@@ -46398,7 +46871,7 @@ function shiftFormulaInBand(formula2, formulaSheet, sheet, shift2, band) {
|
|
|
46398
46871
|
},
|
|
46399
46872
|
end: { row: Math.max(ref.start.row, ref.end.row), col: Math.max(ref.start.col, ref.end.col) }
|
|
46400
46873
|
};
|
|
46401
|
-
const moved = shiftRangeInBand(range,
|
|
46874
|
+
const moved = shiftRangeInBand(range, shift3, band.lo, band.hi);
|
|
46402
46875
|
if (moved && sameRange(moved, range)) continue;
|
|
46403
46876
|
const prefix = token2.prefix?.text ?? "";
|
|
46404
46877
|
if (!moved) {
|
|
@@ -46436,15 +46909,15 @@ function carriedRefEdits(sourceSheets, currentSheets, shiftsOf = () => []) {
|
|
|
46436
46909
|
edits.deleted.push(source3.name);
|
|
46437
46910
|
continue;
|
|
46438
46911
|
}
|
|
46439
|
-
for (const
|
|
46912
|
+
for (const shift3 of shiftsOf(current)) edits.shifts.push({ sheet: source3.name, shift: shift3 });
|
|
46440
46913
|
if (current.name !== source3.name) edits.renamed.push([source3.name, current.name]);
|
|
46441
46914
|
}
|
|
46442
46915
|
return edits;
|
|
46443
46916
|
}
|
|
46444
46917
|
var hasCarriedRefEdits = (edits) => edits.shifts.length > 0 || edits.deleted.length > 0 || edits.renamed.length > 0;
|
|
46445
|
-
function shiftOne(formula2, formulaSheet, sheet,
|
|
46446
|
-
if (
|
|
46447
|
-
const spec2 = { sheet, axis:
|
|
46918
|
+
function shiftOne(formula2, formulaSheet, sheet, shift3) {
|
|
46919
|
+
if (shift3.band) return shiftFormulaInBand(formula2, formulaSheet, sheet, shift3, shift3.band);
|
|
46920
|
+
const spec2 = { sheet, axis: shift3.axis, at: shift3.at, count: shift3.count };
|
|
46448
46921
|
return shiftFormula(formula2, formulaSheet, spec2);
|
|
46449
46922
|
}
|
|
46450
46923
|
function renameAll(formula2, renamed, taken) {
|
|
@@ -46467,7 +46940,7 @@ var takenNames = (edits) => new Set(
|
|
|
46467
46940
|
);
|
|
46468
46941
|
function patchCarriedFormula(formula2, formulaSheet, edits) {
|
|
46469
46942
|
let out = formula2;
|
|
46470
|
-
for (const { sheet, shift:
|
|
46943
|
+
for (const { sheet, shift: shift3 } of edits.shifts) out = shiftOne(out, formulaSheet, sheet, shift3);
|
|
46471
46944
|
for (const sheet of edits.deleted) out = deleteSheetInFormula(out, sheet);
|
|
46472
46945
|
return renameAll(out, edits.renamed, takenNames(edits));
|
|
46473
46946
|
}
|
|
@@ -48053,7 +48526,7 @@ function addChartSeries(space, input) {
|
|
|
48053
48526
|
const group = groups.find((_, i2) => i2 === (input.groupIndex ?? groups.length - 1));
|
|
48054
48527
|
if (!group) throw new RangeError("The chart has no chart group to add a series to");
|
|
48055
48528
|
const all2 = chartSpaceSeries(draft);
|
|
48056
|
-
const
|
|
48529
|
+
const template2 = all2[0];
|
|
48057
48530
|
const series = {
|
|
48058
48531
|
index: nextNumber(all2.map((item2) => item2.index)),
|
|
48059
48532
|
order: nextNumber(all2.map((item2) => item2.order)),
|
|
@@ -48070,7 +48543,7 @@ function addChartSeries(space, input) {
|
|
|
48070
48543
|
};
|
|
48071
48544
|
else if (input.name !== void 0) series.tx = { value: input.name, text: input.name };
|
|
48072
48545
|
if (input.spPr) series.spPr = structuredClone(input.spPr);
|
|
48073
|
-
const templateCategories =
|
|
48546
|
+
const templateCategories = template2?.categories ?? template2?.xValues;
|
|
48074
48547
|
if (input.categories !== void 0)
|
|
48075
48548
|
series[categoryKey(group)] = categorySource(
|
|
48076
48549
|
input.categories,
|
|
@@ -50186,9 +50659,9 @@ function createFieldReader(options, date1904) {
|
|
|
50186
50659
|
}
|
|
50187
50660
|
|
|
50188
50661
|
// xlsx/load/csv.ts
|
|
50189
|
-
var
|
|
50662
|
+
var CANDIDATES2 = [",", ";", " "];
|
|
50190
50663
|
function delimiterCounts(text, maxLines = 20) {
|
|
50191
|
-
const counts = new Map(
|
|
50664
|
+
const counts = new Map(CANDIDATES2.map((d) => [d, [0]]));
|
|
50192
50665
|
let quoted = false;
|
|
50193
50666
|
let lines2 = 1;
|
|
50194
50667
|
for (let i2 = 0; i2 < text.length && lines2 <= maxLines; i2++) {
|
|
@@ -50213,8 +50686,8 @@ function detectDelimiter(text) {
|
|
|
50213
50686
|
const tally = /* @__PURE__ */ new Map();
|
|
50214
50687
|
for (const count2 of list2) if (count2 > 0) tally.set(count2, (tally.get(count2) ?? 0) + 1);
|
|
50215
50688
|
const score = Math.max(0, ...tally.values());
|
|
50216
|
-
const
|
|
50217
|
-
if (
|
|
50689
|
+
const better2 = score > best.score || score === best.score && score > 0 && preference.indexOf(delimiter) < preference.indexOf(best.delimiter);
|
|
50690
|
+
if (better2) best = { delimiter, score };
|
|
50218
50691
|
}
|
|
50219
50692
|
return best.delimiter;
|
|
50220
50693
|
}
|
|
@@ -50458,10 +50931,10 @@ function processCompoundFileStream(input, path3, replacement) {
|
|
|
50458
50931
|
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.
|
|
50459
50932
|
replacement && view.getUint16(28, true) !== 65534)
|
|
50460
50933
|
return reject();
|
|
50461
|
-
const major = view.getUint16(26, true),
|
|
50462
|
-
if (major !== 3 && major !== 4 ||
|
|
50934
|
+
const major = view.getUint16(26, true), shift3 = view.getUint16(30, true), miniShift = view.getUint16(32, true);
|
|
50935
|
+
if (major !== 3 && major !== 4 || shift3 !== (major === 3 ? 9 : 12) || miniShift !== 6)
|
|
50463
50936
|
return reject();
|
|
50464
|
-
const sectorSize = 1 <<
|
|
50937
|
+
const sectorSize = 1 << shift3, miniSize = 1 << miniShift;
|
|
50465
50938
|
if (input.length < sectorSize || replacement && input.length % sectorSize !== 0)
|
|
50466
50939
|
return reject();
|
|
50467
50940
|
const sectorCount = Math.ceil(input.length / sectorSize) - 1;
|