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.
Files changed (123) hide show
  1. package/dist/{PptxHandler-KKLAYUGQ.mjs → PptxHandler-QY5VL3CY.mjs} +2 -2
  2. package/dist/PptxHandler-SJ5ZUIUX.mjs +4 -0
  3. package/dist/{PptxHandler-DHQPVTUI.cjs → PptxHandler-TESZUH66.cjs} +3 -3
  4. package/dist/{PresentationBuilder-YYZYCKTZ.mjs → PresentationBuilder-3CH5TR4W.mjs} +2 -2
  5. package/dist/{PresentationBuilder-JORMF5CP.cjs → PresentationBuilder-5NFBUP7Y.cjs} +5 -5
  6. package/dist/{PresentationBuilder-Q2Z33LLM.mjs → PresentationBuilder-S6HXHKEJ.mjs} +2 -2
  7. package/dist/automation/index.cjs +862 -389
  8. package/dist/automation/index.mjs +862 -389
  9. package/dist/{chunk-GJDFCP2T.mjs → chunk-3H5UAJB3.mjs} +258 -155
  10. package/dist/{chunk-MKDONWNO.mjs → chunk-4R65YYAD.mjs} +32 -14
  11. package/dist/{chunk-KWJYMAEF.mjs → chunk-IOTGRLJH.mjs} +255 -152
  12. package/dist/{chunk-6FXOAMNL.mjs → chunk-N6424WKA.mjs} +1 -1
  13. package/dist/{chunk-WZJ25K7P.mjs → chunk-NAWLWKOJ.mjs} +1 -1
  14. package/dist/{chunk-DJ3CDTMX.mjs → chunk-O7SVHLD7.mjs} +23 -5
  15. package/dist/{chunk-CZXM4ZJH.cjs → chunk-Q6NM64J2.cjs} +23 -4
  16. package/dist/{chunk-FFJBOR2Y.mjs → chunk-UYMSFJQZ.mjs} +76 -4
  17. package/dist/{chunk-B4LXDHBX.cjs → chunk-X6VNUBES.cjs} +1419 -1316
  18. package/dist/diagram/index.cjs +8 -4
  19. package/dist/diagram/index.mjs +8 -4
  20. package/dist/docx/embedded.cjs +8 -4
  21. package/dist/docx/embedded.mjs +8 -4
  22. package/dist/docx/index.cjs +8 -4
  23. package/dist/docx/index.mjs +8 -4
  24. package/dist/docx/layout/index.cjs +8 -4
  25. package/dist/docx/layout/index.mjs +8 -4
  26. package/dist/docx/load/index.cjs +8 -4
  27. package/dist/docx/load/index.mjs +8 -4
  28. package/dist/docx/ui/index.cjs +8 -4
  29. package/dist/docx/ui/index.mjs +8 -4
  30. package/dist/geometry/index.cjs +16 -12
  31. package/dist/geometry/index.mjs +16 -12
  32. package/dist/geometry/preset-shape-definitions-table.d.ts.map +1 -1
  33. package/dist/index.cjs +16 -12
  34. package/dist/index.mjs +16 -12
  35. package/dist/pptx/automation/index.cjs +294 -157
  36. package/dist/pptx/automation/index.d.ts +3 -3
  37. package/dist/pptx/automation/index.mjs +5 -5
  38. package/dist/pptx/chunks/{index-PdM5zpmu.d.ts → index-D-FdgqrP.d.ts} +102 -3
  39. package/dist/pptx/chunks/index-D-FdgqrP.d.ts.map +1 -0
  40. package/dist/pptx/chunks/{index-BQDcu_0a.d.ts → index-DKybuHPT.d.ts} +51 -3
  41. package/dist/pptx/chunks/{index-BQDcu_0a.d.ts.map → index-DKybuHPT.d.ts.map} +1 -1
  42. package/dist/pptx/chunks/{index-CBV1oHN7.d.ts → index-DnWlmYCy.d.ts} +2 -2
  43. package/dist/pptx/chunks/{index-CBV1oHN7.d.ts.map → index-DnWlmYCy.d.ts.map} +1 -1
  44. package/dist/pptx/cli/index.cjs +294 -157
  45. package/dist/pptx/cli/index.mjs +4 -4
  46. package/dist/pptx/converter/index.cjs +8 -4
  47. package/dist/pptx/converter/index.d.ts +1 -1
  48. package/dist/pptx/converter/index.mjs +2 -2
  49. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  50. package/dist/pptx/editor/render/find-replace.d.ts +1 -1
  51. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  52. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  53. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  54. package/dist/pptx/index.cjs +380 -171
  55. package/dist/pptx/index.d.ts +4 -4
  56. package/dist/pptx/index.mjs +5 -5
  57. package/dist/pptx/node/index.d.ts +1 -1
  58. package/dist/teams/chat-view.d.ts +10 -1
  59. package/dist/teams/chat-view.d.ts.map +1 -1
  60. package/dist/teams/index.cjs +805 -144
  61. package/dist/teams/index.d.ts +1 -0
  62. package/dist/teams/index.d.ts.map +1 -1
  63. package/dist/teams/index.mjs +795 -145
  64. package/dist/teams/presence-controller.d.ts +18 -3
  65. package/dist/teams/presence-controller.d.ts.map +1 -1
  66. package/dist/teams/presence-meetings.d.ts +21 -0
  67. package/dist/teams/presence-meetings.d.ts.map +1 -0
  68. package/dist/teams/presence.d.ts +40 -2
  69. package/dist/teams/presence.d.ts.map +1 -1
  70. package/dist/teams/store.d.ts +5 -0
  71. package/dist/teams/store.d.ts.map +1 -1
  72. package/dist/teams/view.d.ts +5 -0
  73. package/dist/teams/view.d.ts.map +1 -1
  74. package/dist/teams/workspace.d.ts +5 -2
  75. package/dist/teams/workspace.d.ts.map +1 -1
  76. package/dist/visio/index.cjs +6 -1
  77. package/dist/visio/index.mjs +6 -1
  78. package/dist/visio/ui/index.cjs +6 -1
  79. package/dist/visio/ui/index.mjs +6 -1
  80. package/dist/xlsx/formula/ets-drift-compare.d.ts +19 -0
  81. package/dist/xlsx/formula/ets-drift-compare.d.ts.map +1 -0
  82. package/dist/xlsx/formula/ets-excel-compare.d.ts +12 -0
  83. package/dist/xlsx/formula/ets-excel-compare.d.ts.map +1 -1
  84. package/dist/xlsx/formula/ets-init-compare.d.ts +24 -0
  85. package/dist/xlsx/formula/ets-init-compare.d.ts.map +1 -0
  86. package/dist/xlsx/formula/ets-init-maps.d.ts +21 -0
  87. package/dist/xlsx/formula/ets-init-maps.d.ts.map +1 -0
  88. package/dist/xlsx/formula/functions/ets-core.d.ts +1 -1
  89. package/dist/xlsx/formula/functions/ets-core.d.ts.map +1 -1
  90. package/dist/xlsx/formula/functions/ets-init-chain.d.ts +11 -0
  91. package/dist/xlsx/formula/functions/ets-init-chain.d.ts.map +1 -0
  92. package/dist/xlsx/formula/functions/ets-init-four.d.ts +3 -0
  93. package/dist/xlsx/formula/functions/ets-init-four.d.ts.map +1 -0
  94. package/dist/xlsx/formula/functions/ets-init-short.d.ts +17 -0
  95. package/dist/xlsx/formula/functions/ets-init-short.d.ts.map +1 -0
  96. package/dist/xlsx/formula/functions/ets-init-states.d.ts +5 -0
  97. package/dist/xlsx/formula/functions/ets-init-states.d.ts.map +1 -0
  98. package/dist/xlsx/formula/functions/ets-init-three.d.ts +23 -0
  99. package/dist/xlsx/formula/functions/ets-init-three.d.ts.map +1 -0
  100. package/dist/xlsx/formula/functions/ets-init-threeplus.d.ts +13 -0
  101. package/dist/xlsx/formula/functions/ets-init-threeplus.d.ts.map +1 -0
  102. package/dist/xlsx/formula/functions/ets-init.d.ts +18 -0
  103. package/dist/xlsx/formula/functions/ets-init.d.ts.map +1 -1
  104. package/dist/xlsx/formula/functions/ets-search-map.d.ts +24 -0
  105. package/dist/xlsx/formula/functions/ets-search-map.d.ts.map +1 -0
  106. package/dist/xlsx/formula/functions/ets-search.d.ts +17 -0
  107. package/dist/xlsx/formula/functions/ets-search.d.ts.map +1 -0
  108. package/dist/xlsx/formula/functions/ets-season.d.ts +2 -2
  109. package/dist/xlsx/formula/functions/ets-season.d.ts.map +1 -1
  110. package/dist/xlsx/formula/functions/ets-validate.d.ts +16 -0
  111. package/dist/xlsx/formula/functions/ets-validate.d.ts.map +1 -0
  112. package/dist/xlsx/index.cjs +762 -289
  113. package/dist/xlsx/index.mjs +762 -289
  114. package/dist/xlsx/layout/form-control-view.d.ts.map +1 -1
  115. package/dist/xlsx/layout/shape-view.d.ts.map +1 -1
  116. package/dist/xlsx/load/index.cjs +599 -126
  117. package/dist/xlsx/load/index.mjs +599 -126
  118. package/dist/xlsx/read/form-control.d.ts.map +1 -1
  119. package/dist/xlsx/ui/index.cjs +756 -283
  120. package/dist/xlsx/ui/index.mjs +756 -283
  121. package/package.json +1 -1
  122. package/dist/PptxHandler-E4DDV3FQ.mjs +0 -4
  123. package/dist/pptx/chunks/index-PdM5zpmu.d.ts.map +0 -1
@@ -5451,11 +5451,11 @@ function moveMarkers(before, after, markers) {
5451
5451
  const move = ({ position: position3, opening, exact }) => {
5452
5452
  if (!exact && opening && position3 === 0) return 0;
5453
5453
  if (!exact && !opening && position3 === from.length) return to.length;
5454
- let shift3 = 0;
5454
+ let shift4 = 0;
5455
5455
  for (const [index4, change] of changes.entries()) {
5456
5456
  if (position3 < change.fromStart) break;
5457
5457
  if (position3 > change.fromEnd) {
5458
- shift3 = change.toEnd - change.fromEnd;
5458
+ shift4 = change.toEnd - change.fromEnd;
5459
5459
  continue;
5460
5460
  }
5461
5461
  const next = changes[index4 + 1];
@@ -5465,7 +5465,7 @@ function moveMarkers(before, after, markers) {
5465
5465
  if (position3 === change.fromEnd) return change.toEnd;
5466
5466
  return opening ? change.toStart : change.toEnd;
5467
5467
  }
5468
- return position3 + shift3;
5468
+ return position3 + shift4;
5469
5469
  };
5470
5470
  return markers.map((marker4) => ({ ...marker4, position: move(marker4) }));
5471
5471
  }
@@ -16313,7 +16313,8 @@ var pie = {
16313
16313
  gd16("stAng", "pin 0 adj1 21599999"),
16314
16314
  gd16("endAng", "pin 0 adj2 21599999"),
16315
16315
  gd16("swAng", "+- endAng 0 stAng"),
16316
- gd16("swAng2", "?: swAng swAng +- 21600000 swAng 0"),
16316
+ gd16("swAngWrap", "+- swAng 21600000 0"),
16317
+ gd16("swAng2", "?: swAng swAng swAngWrap"),
16317
16318
  gd16("stx", "cos wd2 stAng"),
16318
16319
  gd16("sty", "sin hd2 stAng"),
16319
16320
  gd16("x1", "+- hc stx 0"),
@@ -16358,7 +16359,8 @@ var chord = {
16358
16359
  gd16("stAng", "pin 0 adj1 21599999"),
16359
16360
  gd16("endAng", "pin 0 adj2 21599999"),
16360
16361
  gd16("swAng", "+- endAng 0 stAng"),
16361
- gd16("swAng2", "?: swAng swAng +- 21600000 swAng 0"),
16362
+ gd16("swAngWrap", "+- swAng 21600000 0"),
16363
+ gd16("swAng2", "?: swAng swAng swAngWrap"),
16362
16364
  gd16("stx", "cos wd2 stAng"),
16363
16365
  gd16("sty", "sin hd2 stAng"),
16364
16366
  gd16("x1", "+- hc stx 0"),
@@ -16382,7 +16384,8 @@ var arc = {
16382
16384
  gd16("stAng", "pin 0 adj1 21599999"),
16383
16385
  gd16("endAng", "pin 0 adj2 21599999"),
16384
16386
  gd16("swAng", "+- endAng 0 stAng"),
16385
- gd16("swAng2", "?: swAng swAng +- 21600000 swAng 0"),
16387
+ gd16("swAngWrap", "+- swAng 21600000 0"),
16388
+ gd16("swAng2", "?: swAng swAng swAngWrap"),
16386
16389
  gd16("stx", "cos wd2 stAng"),
16387
16390
  gd16("sty", "sin hd2 stAng"),
16388
16391
  gd16("x1", "+- hc stx 0"),
@@ -16477,7 +16480,8 @@ var blockArc = {
16477
16480
  gd16("iwd2", "+- wd2 0 thw"),
16478
16481
  gd16("ihd2", "+- hd2 0 thh2"),
16479
16482
  gd16("swAng", "+- endAng 0 stAng"),
16480
- gd16("swAng2", "?: swAng swAng +- 21600000 swAng 0"),
16483
+ gd16("swAngWrap", "+- swAng 21600000 0"),
16484
+ gd16("swAng2", "?: swAng swAng swAngWrap"),
16481
16485
  gd16("mswAng", "+- 0 0 swAng2"),
16482
16486
  gd16("stx", "cos wd2 stAng"),
16483
16487
  gd16("sty", "sin hd2 stAng"),
@@ -24986,8 +24990,8 @@ function writeDiagramFormatDefinition(source3, change) {
24986
24990
  (entry3) => entry3.id === change.value
24987
24991
  ))
24988
24992
  throw new RangeError("Unknown SmartArt format preset.");
24989
- const template = change.kind === "colors" ? buildFabricatedColorsXml(change.value) : buildFabricatedQuickStyleXml(change.value);
24990
- const fresh = parseXml(template).documentElement;
24993
+ const template2 = change.kind === "colors" ? buildFabricatedColorsXml(change.value) : buildFabricatedQuickStyleXml(change.value);
24994
+ const fresh = parseXml(template2).documentElement;
24991
24995
  if (!source3) {
24992
24996
  fresh.setAttribute("uniqueId", `urn:ooxml-core/${change.kind}/${change.value}`);
24993
24997
  return buildXml(fresh);
@@ -26260,8 +26264,8 @@ function buildGeneratedDiagramCache(dataXml2, input2) {
26260
26264
  );
26261
26265
  const direct = model2.nodes.find((node4) => node4.modelId === shape2.sourceNodeId);
26262
26266
  const fillIndex = shape2.style?.fill?.index;
26263
- const template = fillIndex ? input2.formatScheme?.fillStyles[fillIndex - 1]?.fill : void 0;
26264
- if (!direct?.fill && shape2.fill?.kind === "solid" && shape2.fill.color.kind === "srgb" && (!template || template.kind === "solid" && template.color.kind === "scheme" && template.color.value === "phClr")) {
26267
+ const template2 = fillIndex ? input2.formatScheme?.fillStyles[fillIndex - 1]?.fill : void 0;
26268
+ if (!direct?.fill && shape2.fill?.kind === "solid" && shape2.fill.color.kind === "srgb" && (!template2 || template2.kind === "solid" && template2.color.kind === "scheme" && template2.color.value === "phClr")) {
26265
26269
  const original = themed.get(`#${shape2.fill.color.value}`.toUpperCase());
26266
26270
  if (original)
26267
26271
  shape2.fill.color = {
@@ -26269,9 +26273,9 @@ function buildGeneratedDiagramCache(dataXml2, input2) {
26269
26273
  transforms: [...original.transforms, ...shape2.fill.color.transforms]
26270
26274
  };
26271
26275
  }
26272
- if (!direct?.fill && shape2.fill?.kind === "gradient" && template?.kind === "gradient") {
26276
+ if (!direct?.fill && shape2.fill?.kind === "gradient" && template2?.kind === "gradient") {
26273
26277
  shape2.fill.stops.forEach((stop, index4) => {
26274
- const authored = template.stops[index4]?.color;
26278
+ const authored = template2.stops[index4]?.color;
26275
26279
  if (authored?.kind === "scheme" && authored.value === "phClr" && stop.color.kind === "srgb") {
26276
26280
  const original = themed.get(`#${stop.color.value}`.toUpperCase());
26277
26281
  if (original)
@@ -27288,8 +27292,8 @@ function scottBinCount(values2, min, max) {
27288
27292
  if (values2.length < 2 || max <= min) {
27289
27293
  return 1;
27290
27294
  }
27291
- const mean4 = values2.reduce((sum3, value3) => sum3 + value3, 0) / values2.length;
27292
- const variance3 = values2.reduce((sum3, value3) => sum3 + (value3 - mean4) ** 2, 0) / (values2.length - 1);
27295
+ const mean9 = values2.reduce((sum3, value3) => sum3 + value3, 0) / values2.length;
27296
+ const variance3 = values2.reduce((sum3, value3) => sum3 + (value3 - mean9) ** 2, 0) / (values2.length - 1);
27293
27297
  const sd = Math.sqrt(variance3);
27294
27298
  if (!(sd > 0)) {
27295
27299
  return 1;
@@ -33840,7 +33844,7 @@ function addChartSeries(space, input2) {
33840
33844
  const group3 = groups.find((_, i2) => i2 === (input2.groupIndex ?? groups.length - 1));
33841
33845
  if (!group3) throw new RangeError("The chart has no chart group to add a series to");
33842
33846
  const all2 = chartSpaceSeries(draft);
33843
- const template = all2[0];
33847
+ const template2 = all2[0];
33844
33848
  const series = {
33845
33849
  index: nextNumber(all2.map((item2) => item2.index)),
33846
33850
  order: nextNumber(all2.map((item2) => item2.order)),
@@ -33857,7 +33861,7 @@ function addChartSeries(space, input2) {
33857
33861
  };
33858
33862
  else if (input2.name !== void 0) series.tx = { value: input2.name, text: input2.name };
33859
33863
  if (input2.spPr) series.spPr = structuredClone(input2.spPr);
33860
- const templateCategories = template?.categories ?? template?.xValues;
33864
+ const templateCategories = template2?.categories ?? template2?.xValues;
33861
33865
  if (input2.categories !== void 0)
33862
33866
  series[categoryKey(group3)] = categorySource(
33863
33867
  input2.categories,
@@ -37828,9 +37832,9 @@ function keepsUnmodeledProperties(before, after, basis = basisOf) {
37828
37832
  const owners = (runs) => runs.flatMap((run2) => Array.from({ length: positionText(run2).length }, () => basis(run2)));
37829
37833
  const was = owners(before);
37830
37834
  const now = owners(after);
37831
- const kept = (from, to, shift3) => {
37835
+ const kept = (from, to, shift4) => {
37832
37836
  for (let at3 = from; at3 < to; at3++)
37833
- if (was[at3] !== void 0 && was[at3] !== now[at3 + shift3]) return false;
37837
+ if (was[at3] !== void 0 && was[at3] !== now[at3 + shift4]) return false;
37834
37838
  return true;
37835
37839
  };
37836
37840
  let fromAt = 0;
@@ -39149,7 +39153,7 @@ async function createHeaderFooterParts(zip, model2, base3, docPrIds) {
39149
39153
  }
39150
39154
  async function applyHeaderFooterEdits(zip, model2, base3, pendingMedia, docPrIds, preferred) {
39151
39155
  const next = partContents(model2.sections);
39152
- const better = preferred && partContents(preferred.sections);
39156
+ const better2 = preferred && partContents(preferred.sections);
39153
39157
  const previous = partContents(base3.sections);
39154
39158
  const sources = new Map(
39155
39159
  (model2.sections ?? []).flatMap(
@@ -39167,7 +39171,7 @@ async function applyHeaderFooterEdits(zip, model2, base3, pendingMedia, docPrIds
39167
39171
  for (const [partName, blocks] of next) {
39168
39172
  const original = previous.get(partName) ?? previous.get(sources.get(partName) ?? "") ?? (created.has(partName) ? [] : void 0);
39169
39173
  if (!original) continue;
39170
- const wanted = better?.get(partName);
39174
+ const wanted = better2?.get(partName);
39171
39175
  const choices = wanted && JSON.stringify(wanted) !== JSON.stringify(blocks) ? [wanted, blocks] : [blocks];
39172
39176
  let built;
39173
39177
  for (const [index4, content2] of choices.entries()) {
@@ -45273,7 +45277,7 @@ var ENGLISH_PIVOT_CAPTIONS = {
45273
45277
  functions: FUNCTIONS,
45274
45278
  aggregates: aggregateNames()
45275
45279
  };
45276
- var fillCaption = (template, ...args) => template.replace(/\{(\d)\}/g, (_match, at3) => args[Number(at3)] ?? "");
45280
+ var fillCaption = (template2, ...args) => template2.replace(/\{(\d)\}/g, (_match, at3) => args[Number(at3)] ?? "");
45277
45281
  function pivotCaptions(pivot) {
45278
45282
  const own3 = pivot.captions;
45279
45283
  if (!own3) return ENGLISH_PIVOT_CAPTIONS;
@@ -46056,8 +46060,8 @@ var DIV0 = { error: "#DIV/0!" };
46056
46060
  function variance(numbers3, sample) {
46057
46061
  const n = numbers3.length;
46058
46062
  if (n < (sample ? 2 : 1)) return DIV0;
46059
- const mean4 = numbers3.reduce((total2, value3) => total2 + value3, 0) / n;
46060
- const squares = numbers3.reduce((total2, value3) => total2 + (value3 - mean4) ** 2, 0);
46063
+ const mean9 = numbers3.reduce((total2, value3) => total2 + value3, 0) / n;
46064
+ const squares = numbers3.reduce((total2, value3) => total2 + (value3 - mean9) ** 2, 0);
46061
46065
  return squares / (sample ? n - 1 : n);
46062
46066
  }
46063
46067
  function aggregateValues(records, field2, type) {
@@ -46578,9 +46582,9 @@ function aggregateCaptionsOf(pivot) {
46578
46582
  ]) {
46579
46583
  const at3 = measure4.caption.indexOf(measure4.field);
46580
46584
  if (at3 < 0 || measure4.caption === measure4.field) continue;
46581
- const template = `${measure4.caption.slice(0, at3)}{0}${measure4.caption.slice(at3 + measure4.field.length)}`;
46582
- if (template !== ENGLISH_PIVOT_CAPTIONS.aggregates[measure4.aggregate])
46583
- out[measure4.aggregate] = template;
46585
+ const template2 = `${measure4.caption.slice(0, at3)}{0}${measure4.caption.slice(at3 + measure4.field.length)}`;
46586
+ if (template2 !== ENGLISH_PIVOT_CAPTIONS.aggregates[measure4.aggregate])
46587
+ out[measure4.aggregate] = template2;
46584
46588
  }
46585
46589
  return Object.keys(out).length ? out : void 0;
46586
46590
  }
@@ -48876,9 +48880,9 @@ function prefixText(prefix3) {
48876
48880
  // xlsx/formula/shift-formula.ts
48877
48881
  var templates = /* @__PURE__ */ new Map();
48878
48882
  var MAX_TEMPLATES = 2e5;
48879
- function remember2(text7, template) {
48883
+ function remember2(text7, template2) {
48880
48884
  if (templates.size >= MAX_TEMPLATES) templates.clear();
48881
- templates.set(text7, template);
48885
+ templates.set(text7, template2);
48882
48886
  }
48883
48887
  function mergeSpacedAreas(tokens3) {
48884
48888
  const out = [];
@@ -48909,16 +48913,16 @@ function templateOf2(formula2) {
48909
48913
  const cached7 = templates.get(formula2);
48910
48914
  if (cached7 !== void 0) return cached7;
48911
48915
  const raw2 = safeTokens(formula2);
48912
- let template = null;
48916
+ let template2 = null;
48913
48917
  if (raw2) {
48914
- template = [];
48918
+ template2 = [];
48915
48919
  let literal4 = "";
48916
48920
  for (const token2 of mergeSpacedAreas(raw2)) {
48917
48921
  if (token2.kind !== "ref" && !(token2.kind === "name" && token2.prefix)) {
48918
48922
  literal4 += token2.text;
48919
48923
  continue;
48920
48924
  }
48921
- if (literal4) template.push(literal4);
48925
+ if (literal4) template2.push(literal4);
48922
48926
  literal4 = "";
48923
48927
  const part = { kind: token2.kind, text: token2.text };
48924
48928
  if (token2.prefix) {
@@ -48927,23 +48931,23 @@ function templateOf2(formula2) {
48927
48931
  }
48928
48932
  if (token2.ref) part.ref = token2.ref;
48929
48933
  if (token2.spill) part.spill = true;
48930
- template.push(part);
48934
+ template2.push(part);
48931
48935
  }
48932
- if (literal4) template.push(literal4);
48936
+ if (literal4) template2.push(literal4);
48933
48937
  }
48934
- remember2(formula2, template);
48935
- return template;
48938
+ remember2(formula2, template2);
48939
+ return template2;
48936
48940
  }
48937
48941
  function rewriteTemplate(formula2, rewrite2) {
48938
- const template = templateOf2(formula2);
48939
- if (!template) return formula2;
48942
+ const template2 = templateOf2(formula2);
48943
+ if (!template2) return formula2;
48940
48944
  let next;
48941
- for (let i2 = 0; i2 < template.length; i2++) {
48942
- const part = template[i2];
48945
+ for (let i2 = 0; i2 < template2.length; i2++) {
48946
+ const part = template2[i2];
48943
48947
  if (typeof part === "string") continue;
48944
48948
  const changed = rewrite2(part);
48945
48949
  if (!changed) continue;
48946
- next ??= template.slice();
48950
+ next ??= template2.slice();
48947
48951
  next[i2] = changed;
48948
48952
  }
48949
48953
  if (!next) return formula2;
@@ -49974,7 +49978,12 @@ function vmlCaption(vml, shapeId2) {
49974
49978
  const shape2 = vml.slice(start, end < 0 ? void 0 : end);
49975
49979
  const box5 = /<v:textbox[^>]*>([\s\S]*?)<\/v:textbox>/.exec(shape2)?.[1];
49976
49980
  if (!box5) return void 0;
49977
- const text7 = box5.replace(/<br\s*\/?>/gi, "\n").replace(/<[^>]*>/g, "").replace(/&(#x?[0-9a-f]+|\w+);/gi, (match2, code) => {
49981
+ let stripped = box5.replace(/<br\s*\/?>/gi, "\n");
49982
+ for (let prev = ""; prev !== stripped; ) {
49983
+ prev = stripped;
49984
+ stripped = stripped.replace(/<[^>]*>/g, "");
49985
+ }
49986
+ const text7 = stripped.replace(/&(#x?[0-9a-f]+|\w+);/gi, (match2, code) => {
49978
49987
  if (code.startsWith("#")) {
49979
49988
  const value3 = code[1]?.toLowerCase() === "x" ? parseInt(code.slice(2), 16) : Number(code.slice(1));
49980
49989
  return Number.isFinite(value3) ? String.fromCodePoint(value3) : match2;
@@ -52030,12 +52039,12 @@ function reanchor(xml, anchor2) {
52030
52039
  ).documentElement;
52031
52040
  for (const candidate of Array.from(holder.childNodes)) {
52032
52041
  if (candidate.nodeType !== 1) continue;
52033
- const template = candidate;
52034
- const original = first(old, template.localName, NS.xdr);
52035
- const position3 = original ? original.cloneNode(true) : doc.importNode(template, true);
52036
- for (const attribute4 of Array.from(template.attributes))
52042
+ const template2 = candidate;
52043
+ const original = first(old, template2.localName, NS.xdr);
52044
+ const position3 = original ? original.cloneNode(true) : doc.importNode(template2, true);
52045
+ for (const attribute4 of Array.from(template2.attributes))
52037
52046
  position3.setAttribute(attribute4.name, attribute4.value);
52038
- for (const value3 of Array.from(template.childNodes)) {
52047
+ for (const value3 of Array.from(template2.childNodes)) {
52039
52048
  if (value3.nodeType !== 1) continue;
52040
52049
  const item2 = value3;
52041
52050
  const existing = first(position3, item2.localName, NS.xdr);
@@ -53890,14 +53899,14 @@ function linearFit(xs, ys) {
53890
53899
  return { slope, intercept: my - slope * mx };
53891
53900
  }
53892
53901
  function rank3(values2, x, ascending, average) {
53893
- let better = 0;
53902
+ let better2 = 0;
53894
53903
  let ties = 0;
53895
53904
  for (const v of values2) {
53896
53905
  if (v === x) ties++;
53897
- else if (ascending ? v < x : v > x) better++;
53906
+ else if (ascending ? v < x : v > x) better2++;
53898
53907
  }
53899
53908
  if (ties === 0) fail(ERR.NA);
53900
- return average ? better + (ties + 1) / 2 : better + 1;
53909
+ return average ? better2 + (ties + 1) / 2 : better2 + 1;
53901
53910
  }
53902
53911
  var LANCZOS = [
53903
53912
  676.5203681218851,
@@ -58930,11 +58939,11 @@ function binomDist(k, n, p, cumulative2) {
58930
58939
  for (let i2 = 0; i2 <= kk; i2++) total2 += binomPmf(i2, nn, p);
58931
58940
  return Math.min(1, total2);
58932
58941
  }
58933
- function poisson(k, mean4, cumulative2) {
58942
+ function poisson(k, mean9, cumulative2) {
58934
58943
  const kk = Math.trunc(k);
58935
- if (kk < 0 || mean4 < 0) fail(ERR.NUM);
58936
- if (cumulative2) return 1 - gammaP(kk + 1, mean4);
58937
- return Math.exp(kk * Math.log(mean4) - mean4 - gammaLn(kk + 1));
58944
+ if (kk < 0 || mean9 < 0) fail(ERR.NUM);
58945
+ if (cumulative2) return 1 - gammaP(kk + 1, mean9);
58946
+ return Math.exp(kk * Math.log(mean9) - mean9 - gammaLn(kk + 1));
58938
58947
  }
58939
58948
  var normDist = (x, m, s, cumulative2) => {
58940
58949
  positive2(s);
@@ -58942,13 +58951,272 @@ var normDist = (x, m, s, cumulative2) => {
58942
58951
  return cumulative2 ? normCdf(z2) : normPdf(z2) / s;
58943
58952
  };
58944
58953
 
58954
+ // xlsx/formula/functions/ets-init-three.ts
58955
+ var mean2 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
58956
+ function slopeOf(v) {
58957
+ const k = v.length;
58958
+ const mx = (k - 1) / 2;
58959
+ const my = mean2(v);
58960
+ let sxy = 0;
58961
+ let sxx = 0;
58962
+ for (let i2 = 0; i2 < k; i2++) {
58963
+ sxy += (i2 - mx) * (v[i2] - my);
58964
+ sxx += (i2 - mx) * (i2 - mx);
58965
+ }
58966
+ return sxx === 0 ? 0 : sxy / sxx;
58967
+ }
58968
+ function positionSlopes(y, m) {
58969
+ return Array.from({ length: m }, (_v, c2) => {
58970
+ const vals = [];
58971
+ for (let t = c2; t < y.length; t += m) vals.push(y[t]);
58972
+ return slopeOf(vals) / m;
58973
+ });
58974
+ }
58975
+ function isThreeSeasonLength(n, m) {
58976
+ return m >= 4 && n >= 3 * m && n <= 3 * m + Math.ceil(m / 2) + 1;
58977
+ }
58978
+ function threeSeasonSeasonals(y, m, slopeSumOverride) {
58979
+ const n = y.length;
58980
+ const extra = n - 3 * m;
58981
+ const j0 = Math.floor(m / 2);
58982
+ const at3 = (t) => y[t];
58983
+ const slope = (j) => (at3(j + 2 * m) - at3(j)) / (2 * m);
58984
+ const B = (j) => j + 2 * m < n ? slope(j) : slope(j % m);
58985
+ const e = (t) => at3(t) - at3(t - 1) - B(t - j0);
58986
+ const slopeSum = slopeSumOverride ?? positionSlopes(y, m).reduce((a2, b) => a2 + b, 0);
58987
+ const out = [0];
58988
+ for (let k = 1; k < m; k++) {
58989
+ let back = 0;
58990
+ for (let t = k + 1; t <= m; t++) back -= e(t);
58991
+ let fwd = 0;
58992
+ for (let t = m + 1; t <= m + k; t++) fwd += e(t);
58993
+ if (k < j0 - 1) {
58994
+ out.push(fwd);
58995
+ continue;
58996
+ }
58997
+ if (k === m - 1 && extra <= Math.ceil(m / 2)) {
58998
+ out.push(back);
58999
+ continue;
59000
+ }
59001
+ const wrapped = Math.max(0, k - j0 + 1 - extra);
59002
+ let corner4 = 0;
59003
+ for (let i2 = extra; i2 <= k - j0; i2++)
59004
+ corner4 += (at3(i2 + m) + at3(i2 + 2 * m) - 2 * at3(i2)) / (4 * m);
59005
+ const level4 = (at3(k) + at3(m + k)) / 2 - at3(m);
59006
+ const bb = back - (at3(k) - at3(m));
59007
+ const ff = fwd - (at3(m + k) - at3(m));
59008
+ out.push(level4 + (bb + ff) / 2 - 3 * wrapped / (4 * m) * slopeSum + corner4);
59009
+ }
59010
+ return out;
59011
+ }
59012
+ function padThreeSeasons(y, m, slopeMean = mean2(positionSlopes(y, m))) {
59013
+ const n = y.length;
59014
+ const total2 = Math.max(3 * m + Math.ceil(m / 2), n);
59015
+ const ext = [...y];
59016
+ for (let t = n; t < total2; t++) ext.push(y[t - 3 * m] + 3 * m * slopeMean);
59017
+ return ext;
59018
+ }
59019
+ function threeSeasonTrend(y, m, rel, slopeMean) {
59020
+ const ext = padThreeSeasons(y, m, slopeMean);
59021
+ const total2 = ext.length;
59022
+ const mx = (total2 - 1) / 2;
59023
+ let sxx = 0;
59024
+ let sxy = 0;
59025
+ for (let t = 0; t < total2; t++) {
59026
+ sxx += (t - mx) * (t - mx);
59027
+ sxy += (t - mx) * (ext[t] - rel[t % m]);
59028
+ }
59029
+ return sxy / sxx;
59030
+ }
59031
+ function isTwoSeasonLength(n, m) {
59032
+ return m >= 4 && n === 2 * m;
59033
+ }
59034
+ function isTwoPlusLength(n, m) {
59035
+ return m >= 4 && n > 2 * m && n < 3 * m;
59036
+ }
59037
+ function slopeSumOf(y, m) {
59038
+ return positionSlopes(y, m).reduce((a2, c2) => a2 + c2, 0);
59039
+ }
59040
+ function extendTwoSeasons(y, m) {
59041
+ const b = mean2(positionSlopes(y, m));
59042
+ const out = [...y];
59043
+ for (let t = y.length; t < 3 * m; t++) out.push(y[t - 2 * m] + 2 * m * b);
59044
+ return out;
59045
+ }
59046
+ function paddedSearchSeries(y, m) {
59047
+ if (isTwoSeasonLength(y.length, m) || isTwoPlusLength(y.length, m))
59048
+ return padThreeSeasons(extendTwoSeasons(y, m), m, slopeSumOf(y, m) / m);
59049
+ if (isThreeSeasonLength(y.length, m)) return padThreeSeasons(y, m);
59050
+ return void 0;
59051
+ }
59052
+
59053
+ // xlsx/formula/functions/ets-init-states.ts
59054
+ var mean3 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
59055
+ function chainStates(y, m, seasons) {
59056
+ const h2 = Math.floor(seasons / 2);
59057
+ const first3 = seasons - h2;
59058
+ const at3 = (t) => y[t];
59059
+ const meanFirst = (t) => mean3(Array.from({ length: first3 }, (_v, c2) => at3(t + c2 * m)));
59060
+ const slope = (j) => {
59061
+ const early = mean3(Array.from({ length: h2 }, (_v, c2) => at3(j + c2 * m)));
59062
+ const late = mean3(Array.from({ length: h2 }, (_v, c2) => at3(j + (seasons - h2 + c2) * m)));
59063
+ return (late - early) / ((seasons - h2) * m);
59064
+ };
59065
+ const j0 = Math.floor(m / 2);
59066
+ const state = /* @__PURE__ */ new Map([[j0 - 1, 0]]);
59067
+ for (let t = j0; t <= j0 + m - 2; t++)
59068
+ state.set(t, state.get(t - 1) + meanFirst(t) - meanFirst(t - 1) - slope(t - j0));
59069
+ const byPosition2 = new Array(m).fill(0);
59070
+ for (const [t, s] of state) byPosition2[t % m] = s;
59071
+ return byPosition2;
59072
+ }
59073
+ function chainSeasonals(y, m, seasons) {
59074
+ const byPosition2 = chainStates(y, m, seasons);
59075
+ const origin = byPosition2[0];
59076
+ return byPosition2.map((s) => s - origin);
59077
+ }
59078
+
59079
+ // xlsx/formula/functions/ets-init-four.ts
59080
+ var mean4 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
59081
+ function template(w, m, a2) {
59082
+ const block = (c2) => mean4(w.slice(c2 * m, (c2 + 1) * m));
59083
+ const at3 = (i2) => w[i2];
59084
+ return (block(0) - block(2)) / 12 + (block(1) - block(3)) / 6 - (at3(a2) + at3(a2 + m) - 2 * at3(a2 + 2 * m)) / 6;
59085
+ }
59086
+ function fourSeasonPlusSeasonals(y, m) {
59087
+ const r = y.length - 4 * m;
59088
+ const a2 = Math.floor(m / 2) - 1;
59089
+ const states2 = chainStates(y.slice(0, 4 * m), m, 4);
59090
+ for (let q = 0; q < r; q++) {
59091
+ const pos = (a2 + q) % m;
59092
+ states2[pos] = states2[pos] + template(y.slice(q, q + 4 * m), m, a2);
59093
+ }
59094
+ const origin = states2[0];
59095
+ return states2.map((s) => s - origin);
59096
+ }
59097
+
59098
+ // xlsx/formula/functions/ets-init-threeplus.ts
59099
+ var mean5 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
59100
+ function isThreePlusLength(n, m) {
59101
+ return m >= 4 && n >= 3 * m + Math.ceil(m / 2) + 2 && n < 4 * m;
59102
+ }
59103
+ function shift2(y, m, k) {
59104
+ const a2 = Math.ceil(m / 2) + 1;
59105
+ const at3 = (i2) => y[i2];
59106
+ return (at3(m + k) - at3(2 * m + k)) / 2 - (mean5(y.slice(a2 + k, a2 + k + m)) - mean5(y.slice(a2 + 2 * m + k, a2 + 3 * m + k))) / 4;
59107
+ }
59108
+ function isLowThreeLength(n, m) {
59109
+ return m === 2 && n >= 5 && n < 8 || m === 3 && n >= 6 && n < 12;
59110
+ }
59111
+ function lowSeasonSeasonals(y, m, slopeSum) {
59112
+ const base3 = threeSeasonSeasonals(y, m, slopeSum);
59113
+ const d = -shift2(y, m, -m);
59114
+ return base3.map((s, k) => k === 0 ? 0 : s + d);
59115
+ }
59116
+ function threePlusSeasonals(y, m) {
59117
+ const base3 = threeSeasonSeasonals(y, m);
59118
+ const moved = y.length - 3 * m - Math.ceil(m / 2) - 1;
59119
+ const z2 = base3.map((s, k) => k < moved ? s - shift2(y, m, k) : s);
59120
+ const origin = z2[0];
59121
+ return z2.map((s) => s - origin);
59122
+ }
59123
+
59124
+ // xlsx/formula/functions/ets-init-short.ts
59125
+ function seasonStart(m) {
59126
+ return Math.ceil(10 * (m + 1) / 7);
59127
+ }
59128
+ function isShortSeasonLength(n, m) {
59129
+ return m >= 5 && n >= seasonStart(m) && n < 2 * m;
59130
+ }
59131
+ function padTwoSeasons(y, m) {
59132
+ const p = [...y];
59133
+ for (let t = y.length; t < 2 * m; t++) p.push(p[t - m]);
59134
+ return p;
59135
+ }
59136
+ function trendShift(m, n) {
59137
+ const j0 = Math.floor(m / 2);
59138
+ const u = 2 * m - 1 - n;
59139
+ return (u * u - (j0 - 2) * u + 2 * (j0 - 1)) / 4;
59140
+ }
59141
+ function shortSeasonStart(y, m) {
59142
+ const n = y.length;
59143
+ const p = padTwoSeasons(y, m);
59144
+ const ss = slopeSumOf(p, m);
59145
+ const ext = extendTwoSeasons(p, m);
59146
+ const base3 = threeSeasonSeasonals(ext, m, ss);
59147
+ const total2 = 3 * m + Math.ceil(m / 2);
59148
+ const sxx = total2 * (total2 * total2 - 1) / 12;
59149
+ const trend = threeSeasonTrend(ext, m, base3, ss / m) + trendShift(m, n) * ss / sxx;
59150
+ const rel = base3.map((s, k) => k >= n - m && k <= m - 2 ? s + ss / 2 : s);
59151
+ return { rel, trend };
59152
+ }
59153
+ function shortSearchSeries(y, m) {
59154
+ const p = padTwoSeasons(y, m);
59155
+ return padThreeSeasons(extendTwoSeasons(p, m), m, slopeSumOf(p, m) / m);
59156
+ }
59157
+
59158
+ // xlsx/formula/functions/ets-init-chain.ts
59159
+ var MAX_SEASONS = 5;
59160
+ var mean6 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
59161
+ function isExactLength(n, m) {
59162
+ const whole = Math.floor(n / m);
59163
+ return whole >= MAX_SEASONS || whole === 4 || isThreeSeasonLength(n, m) || isThreePlusLength(n, m) || isLowThreeLength(n, m) || isTwoSeasonLength(n, m) || isTwoPlusLength(n, m) || isShortSeasonLength(n, m);
59164
+ }
59165
+ function fromRelative(y0, rel, trend) {
59166
+ const combined = rel.map((s) => y0 + s - trend);
59167
+ const level4 = mean6(combined);
59168
+ return { level: level4, trend, season: combined.map((c2) => c2 - level4) };
59169
+ }
59170
+ function chainStart(y, m) {
59171
+ const n = y.length;
59172
+ const whole = Math.floor(n / m);
59173
+ if (isShortSeasonLength(n, m)) {
59174
+ const { rel: rel2, trend } = shortSeasonStart(y, m);
59175
+ return fromRelative(y[0], rel2, trend);
59176
+ }
59177
+ if (isThreeSeasonLength(n, m) || isTwoSeasonLength(n, m) || isTwoPlusLength(n, m)) {
59178
+ const short = isTwoSeasonLength(n, m) || isTwoPlusLength(n, m);
59179
+ const series = short ? extendTwoSeasons(y, m) : y;
59180
+ const rel2 = threeSeasonSeasonals(series, m, short ? slopeSumOf(y, m) : void 0);
59181
+ return fromRelative(
59182
+ y[0],
59183
+ rel2,
59184
+ threeSeasonTrend(series, m, rel2, short ? slopeSumOf(y, m) / m : void 0)
59185
+ );
59186
+ }
59187
+ if (isLowThreeLength(n, m)) {
59188
+ const short = n < 3 * m;
59189
+ const series = short ? extendTwoSeasons(y, m) : y;
59190
+ const rel2 = lowSeasonSeasonals(series, m, short ? slopeSumOf(y, m) : void 0);
59191
+ const pad8 = short ? slopeSumOf(y, m) / m : void 0;
59192
+ return fromRelative(y[0], rel2, threeSeasonTrend(series, m, rel2, pad8));
59193
+ }
59194
+ if (isThreePlusLength(n, m)) {
59195
+ const rel2 = threePlusSeasonals(y, m);
59196
+ return fromRelative(y[0], rel2, threeSeasonTrend(y, m, rel2));
59197
+ }
59198
+ if (m < 2 || whole < 4) return void 0;
59199
+ const partial2 = whole < MAX_SEASONS && n % m !== 0;
59200
+ const rel = partial2 ? fourSeasonPlusSeasonals(y, m) : chainSeasonals(y, m, Math.min(whole, MAX_SEASONS));
59201
+ const mx = (n - 1) / 2;
59202
+ let sxy = 0;
59203
+ let sxx = 0;
59204
+ const my = mean6(y.map((v, t) => v - rel[t % m]));
59205
+ for (let t = 0; t < n; t++) {
59206
+ const d = y[t] - rel[t % m] - my;
59207
+ sxy += (t - mx) * d;
59208
+ sxx += (t - mx) * (t - mx);
59209
+ }
59210
+ return fromRelative(y[0], rel, sxy / sxx);
59211
+ }
59212
+
58945
59213
  // xlsx/formula/functions/ets-init.ts
58946
59214
  var MAX_EXACT_SEASON = 24;
58947
- var mean2 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
59215
+ var mean7 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
58948
59216
  function olsSlope(y) {
58949
59217
  const n = y.length;
58950
59218
  const mx = (n - 1) / 2;
58951
- const my = mean2(y);
59219
+ const my = mean7(y);
58952
59220
  let sxy = 0;
58953
59221
  let sxx = 0;
58954
59222
  for (let i2 = 0; i2 < n; i2++) {
@@ -58957,12 +59225,30 @@ function olsSlope(y) {
58957
59225
  }
58958
59226
  return sxx === 0 ? 0 : sxy / sxx;
58959
59227
  }
59228
+ var PADS = {
59229
+ 6: [[0, 6]],
59230
+ 5: [
59231
+ [1, 4],
59232
+ [0, 6]
59233
+ ],
59234
+ 4: [
59235
+ [0, 4],
59236
+ [1, 4],
59237
+ [0, 6]
59238
+ ]
59239
+ };
59240
+ function shortSeriesTrend(y) {
59241
+ const pads = PADS[y.length];
59242
+ if (!pads) return olsSlope(y);
59243
+ const slope = olsSlope(y);
59244
+ return olsSlope([...y, ...pads.map(([src, lag]) => y[src] + lag * slope)]);
59245
+ }
58960
59246
  function split(trend, combined) {
58961
- const level4 = mean2(combined);
59247
+ const level4 = mean7(combined);
58962
59248
  return { level: level4, trend, season: combined.map((c2) => c2 - level4) };
58963
59249
  }
58964
59250
  function heuristicStates(y, m) {
58965
- const trend = (mean2(y.slice(m, 2 * m)) - mean2(y.slice(0, m))) / m;
59251
+ const trend = (mean7(y.slice(m, 2 * m)) - mean7(y.slice(0, m))) / m;
58966
59252
  return split(
58967
59253
  trend,
58968
59254
  Array.from({ length: m }, (_v, k) => y[k] - trend * (k + 1))
@@ -58999,9 +59285,11 @@ function solveSystem(a2, b) {
58999
59285
  function initialStates(y, m, p, run2) {
59000
59286
  const y0 = y[0];
59001
59287
  if (m < 2) {
59002
- const trend2 = olsSlope(y);
59288
+ const trend2 = shortSeriesTrend(y);
59003
59289
  return { level: y0 - trend2, trend: trend2, season: [] };
59004
59290
  }
59291
+ const exact = chainStart(y, m);
59292
+ if (exact) return exact;
59005
59293
  if (m > MAX_EXACT_SEASON) return heuristicStates(y, m);
59006
59294
  const zeros = new Array(y.length).fill(0);
59007
59295
  const unit3 = (trend2, season) => run2(zeros, m, { level: 0, trend: trend2, season }, p).fitted;
@@ -59021,6 +59309,202 @@ function initialStates(y, m, p, run2) {
59021
59309
  return split(trend, [y0 - trend, ...u.slice(1)]);
59022
59310
  }
59023
59311
 
59312
+ // xlsx/formula/functions/ets-search-map.ts
59313
+ var LOW = 1e-3;
59314
+ var DRIFT_SHIFT = 1.5;
59315
+ var DRIFT_T = 9.3;
59316
+ var CANDIDATES = [
59317
+ ...[2e-3, 0.1, 0.126, 0.25, 0.5, 0.75, 0.9].map((a2) => [a2, LOW]),
59318
+ [0.1, 0.099],
59319
+ [0.126, 0.125],
59320
+ [0.25, 0.249],
59321
+ [0.333333, 0.166667],
59322
+ [0.5, 0.25],
59323
+ [0.5, 0.499],
59324
+ [0.666667, 0.166667],
59325
+ [0.666667, 0.5],
59326
+ [0.75, 0.749],
59327
+ [0.833333, 0.75],
59328
+ [0.9, 0.899],
59329
+ [0.998, 0.099],
59330
+ [0.998, 0.249],
59331
+ [0.998, 0.499],
59332
+ [0.998, 0.749],
59333
+ [0.998, 0.899],
59334
+ [0.166667, 0.0833333],
59335
+ [0.833333, 0.0833333]
59336
+ ];
59337
+ var ALWAYS_DRIFT = /* @__PURE__ */ new Set([
59338
+ "0.1/0.099",
59339
+ "0.998/0.899",
59340
+ "0.998/0.749",
59341
+ "0.166667/0.0833333",
59342
+ "0.25/0.249",
59343
+ "0.9/0.899",
59344
+ "0.666667/0.5",
59345
+ "0.75/0.749"
59346
+ ]);
59347
+ var NEVER_DRIFT = /* @__PURE__ */ new Set(["0.333333/0.166667"]);
59348
+ function trendShape(y, h2) {
59349
+ const n = y.length;
59350
+ const hold = h2 > 0 ? h2 : Math.max(1, Math.round(0.3 * n));
59351
+ const mx = (n - 1) / 2;
59352
+ let my = 0;
59353
+ for (const v of y) my += v;
59354
+ my /= n;
59355
+ let sxy = 0;
59356
+ let sxx = 0;
59357
+ let syy = 0;
59358
+ for (let i2 = 0; i2 < n; i2++) {
59359
+ const dy = y[i2] - my;
59360
+ sxy += (i2 - mx) * dy;
59361
+ sxx += (i2 - mx) * (i2 - mx);
59362
+ syy += dy * dy;
59363
+ }
59364
+ if (syy === 0 || sxx === 0 || n < 3) return { shift: 0, t: 0 };
59365
+ const slope = sxy / sxx;
59366
+ const resid = syy - slope * sxy;
59367
+ const se = Math.sqrt(Math.max(resid, 0) / (n - 2) / sxx);
59368
+ let tail = 0;
59369
+ for (let i2 = n - hold; i2 < n; i2++) tail += y[i2];
59370
+ let head = 0;
59371
+ for (let i2 = 0; i2 < n - hold; i2++) head += y[i2];
59372
+ const shift4 = Math.abs(tail / hold - head / (n - hold)) / Math.sqrt(syy / n);
59373
+ return { shift: shift4, t: se === 0 ? Number.POSITIVE_INFINITY : Math.abs(slope / se) };
59374
+ }
59375
+ function reportedFor(alpha, beta, shape2) {
59376
+ const key2 = `${alpha}/${beta}`;
59377
+ let drift;
59378
+ if (beta === LOW) drift = false;
59379
+ else if (ALWAYS_DRIFT.has(key2)) drift = true;
59380
+ else if (NEVER_DRIFT.has(key2)) drift = false;
59381
+ else drift = shape2.shift <= DRIFT_SHIFT && shape2.t <= DRIFT_T;
59382
+ return { alpha, beta: drift ? LOW : beta, fit: [alpha, beta], drift };
59383
+ }
59384
+
59385
+ // xlsx/formula/functions/ets-search.ts
59386
+ var LOW2 = 1e-3;
59387
+ var MIN_SEARCH_POINTS = 4;
59388
+ var THREE_POINTS = { alpha: 0.1, beta: 0.099, gamma: LOW2, drift: false };
59389
+ var SEASON_ALPHAS = [2e-3, 0.126, 0.251, 0.501, 2 / 3, 0.75, 0.9];
59390
+ var SEASON_STEPS = [LOW2, 0.125, 0.25, 0.5, 0.75, 0.9];
59391
+ var SHORT_SERIES = 16;
59392
+ function better(c2, best) {
59393
+ return c2 < best * (1 - 1e-6) && c2 < best - 1e-12;
59394
+ }
59395
+ var SEASONAL_TRIPLES = [
59396
+ [0.126, LOW2, LOW2],
59397
+ [0.251, LOW2, LOW2],
59398
+ [0.501, LOW2, LOW2],
59399
+ [0.751, LOW2, LOW2],
59400
+ [2e-3, LOW2, 0.125],
59401
+ [2e-3, LOW2, 0.25],
59402
+ [2e-3, LOW2, 0.5],
59403
+ [2e-3, LOW2, 0.75],
59404
+ [0.251, LOW2, 0.25],
59405
+ [0.75, LOW2, 0.249],
59406
+ [0.9, LOW2, 0.099],
59407
+ [0.251, 0.25, LOW2],
59408
+ [0.1, LOW2, 0.899],
59409
+ [0.126, 0.125, LOW2],
59410
+ [0.998, 0.099, LOW2],
59411
+ [0.25, LOW2, 0.749],
59412
+ [0.5, LOW2, 0.499],
59413
+ [0.5, 0.25, LOW2],
59414
+ [0.251, 0.25, 0.25],
59415
+ [0.501, 0.5, LOW2]
59416
+ ];
59417
+ var SHORT_EXTRA_TRIPLES = [
59418
+ [1 / 6, 1 / 12, 1 / 12],
59419
+ [1 / 3, 1 / 6, 1 / 6],
59420
+ [1 / 6, 1 / 12, 0.75],
59421
+ [1 / 3, 1 / 6, 0.5],
59422
+ [5 / 6, 1 / 12, 1 / 12]
59423
+ ];
59424
+ function searchSeasonalLattice(cost, extra = []) {
59425
+ let best = { alpha: 0.126, beta: LOW2, gamma: LOW2 };
59426
+ let bestCost = cost(best);
59427
+ for (const [alpha, beta, gamma2] of [...SEASONAL_TRIPLES, ...extra]) {
59428
+ const c2 = cost({ alpha, beta, gamma: gamma2 });
59429
+ if (better(c2, bestCost)) {
59430
+ bestCost = c2;
59431
+ best = { alpha, beta, gamma: gamma2 };
59432
+ }
59433
+ }
59434
+ return { ...best, drift: false };
59435
+ }
59436
+ function searchSeasonal(n, cost) {
59437
+ let best = { alpha: 0.9, beta: LOW2, gamma: LOW2 };
59438
+ let bestCost = cost(best);
59439
+ for (const a2 of SEASON_ALPHAS)
59440
+ for (const b of n >= 7 && n <= SHORT_SERIES ? [LOW2, a2 - LOW2] : [LOW2])
59441
+ for (const g2 of [...SEASON_STEPS, 1 - a2 - LOW2]) {
59442
+ if (b < LOW2 || g2 > 1 - a2 - LOW2 + 1e-9) continue;
59443
+ const c2 = cost({ alpha: a2, beta: b, gamma: g2 });
59444
+ if (better(c2, bestCost)) {
59445
+ bestCost = c2;
59446
+ best = { alpha: a2, beta: b, gamma: g2 };
59447
+ }
59448
+ }
59449
+ return { ...best, drift: false };
59450
+ }
59451
+ function searchLattice(shape2, cost) {
59452
+ let best = [0.9, LOW2];
59453
+ let bestCost = cost({ alpha: 0.9, beta: LOW2, gamma: LOW2 });
59454
+ for (const [alpha, beta] of CANDIDATES) {
59455
+ const c2 = cost({ alpha, beta, gamma: LOW2 });
59456
+ if (better(c2, bestCost)) {
59457
+ bestCost = c2;
59458
+ best = [alpha, beta];
59459
+ }
59460
+ }
59461
+ const out = reportedFor(best[0], best[1], shape2);
59462
+ const [fa, fb] = out.fit;
59463
+ const same16 = fa === out.alpha && fb === out.beta;
59464
+ return {
59465
+ alpha: out.alpha,
59466
+ beta: out.beta,
59467
+ gamma: LOW2,
59468
+ drift: out.drift,
59469
+ ...same16 ? {} : { fit: { alpha: fa, beta: fb, gamma: LOW2 } }
59470
+ };
59471
+ }
59472
+ function chooseSmoothing(n, m, cost, shape2 = { shift: 9, t: 99 }) {
59473
+ if (m >= 2 && isShortSeasonLength(n, m)) return searchSeasonalLattice(cost, SHORT_EXTRA_TRIPLES);
59474
+ if (m >= 2) return isExactLength(n, m) ? searchSeasonalLattice(cost) : searchSeasonal(n, cost);
59475
+ if (n < MIN_SEARCH_POINTS) return THREE_POINTS;
59476
+ return searchLattice(shape2, cost);
59477
+ }
59478
+
59479
+ // xlsx/formula/functions/ets-validate.ts
59480
+ function etsSearchSeries(y) {
59481
+ const pads = PADS[y.length];
59482
+ if (!pads) return y;
59483
+ const slope = olsSlope(y);
59484
+ return [...y, ...pads.map(([src, lag]) => y[src] + lag * slope)];
59485
+ }
59486
+ function etsValidationCost(y, m, init, p, holdout) {
59487
+ const n = y.length;
59488
+ const train = n - holdout;
59489
+ let { level: level4, trend } = init;
59490
+ const season = [...init.season];
59491
+ let sse = 0;
59492
+ for (let t = 0; t < train; t++) {
59493
+ const k = m >= 2 ? t % m : 0;
59494
+ const e = y[t] - (level4 + trend + (m >= 2 ? season[k] ?? 0 : 0));
59495
+ sse += e * e;
59496
+ level4 += trend + p.alpha * e;
59497
+ trend += p.beta * e;
59498
+ if (m >= 2) season[k] = (season[k] ?? 0) + p.gamma * e;
59499
+ }
59500
+ for (let j = 1; j <= holdout; j++) {
59501
+ const t = train + j - 1;
59502
+ const e = y[t] - (level4 + j * trend + (m >= 2 ? season[t % m] ?? 0 : 0));
59503
+ sse += e * e;
59504
+ }
59505
+ return sse;
59506
+ }
59507
+
59024
59508
  // xlsx/formula/functions/ets-core.ts
59025
59509
  function etsRun(y, m, init, p) {
59026
59510
  let { level: level4, trend } = init;
@@ -59039,36 +59523,36 @@ function etsRun(y, m, init, p) {
59039
59523
  }
59040
59524
  return { fitted, level: level4, trend, season, sse };
59041
59525
  }
59042
- var LOW = 1e-3;
59043
- var SHORT_SERIES = 16;
59044
59526
  var NO_SEASON_GAMMA = Number.EPSILON;
59045
- var ALPHAS = [2e-3, 0.1, 0.126, 0.25, 0.5, 2 / 3, 0.75, 0.9];
59046
- var SEASON_ALPHAS = [2e-3, 0.126, 0.251, 0.501, 2 / 3, 0.75, 0.9];
59047
- var SEASON_STEPS = [LOW, 0.125, 0.25, 0.5, 0.75, 0.9];
59048
59527
  function fitEts(y, seasonLength) {
59049
59528
  const n = y.length;
59050
59529
  if (n < 2) fail(ERR.NUM);
59051
- const m = seasonLength >= 2 && n >= 2 * seasonLength ? seasonLength : 0;
59530
+ const m = seasonLength >= 2 && n >= seasonStart(seasonLength) ? seasonLength : 0;
59052
59531
  const solve2 = (p) => {
59053
59532
  const init = initialStates(y, m, p, etsRun);
59054
59533
  return { init, run: etsRun(y, m, init, p) };
59055
59534
  };
59056
- const cost = (v) => solve2({ alpha: v[0], beta: v[1], gamma: v[2] }).run.sse;
59057
- let best = [0.9, LOW, LOW];
59058
- let bestCost = cost(best);
59059
- for (const a2 of m >= 2 ? SEASON_ALPHAS : ALPHAS)
59060
- for (const b of n >= 7 && n <= SHORT_SERIES ? [LOW, a2 - LOW] : [LOW])
59061
- for (const g2 of m >= 2 ? [...SEASON_STEPS, 1 - a2 - LOW] : [LOW]) {
59062
- if (b < LOW || g2 > 1 - a2 - LOW + 1e-9) continue;
59063
- const c2 = cost([a2, b, g2]);
59064
- if (c2 < bestCost * (1 - 1e-6) && c2 < bestCost - 1e-12) {
59065
- bestCost = c2;
59066
- best = [a2, b, g2];
59067
- }
59068
- }
59069
- const [alpha, beta, gamma2] = best;
59070
- const { run: run2 } = solve2({ alpha, beta, gamma: gamma2 });
59071
- return { alpha, beta, gamma: m >= 2 ? gamma2 : NO_SEASON_GAMMA, m, n, ...run2 };
59535
+ const exact = m < 2 || isExactLength(n, m);
59536
+ const padded = m >= 2 && exact ? isShortSeasonLength(n, m) ? shortSearchSeries(y, m) : paddedSearchSeries(y, m) : void 0;
59537
+ const searched = padded ?? (m >= 2 ? y : etsSearchSeries(y));
59538
+ const holdout = m >= 2 && !exact ? 0 : etsHoldout(padded && !(m >= 2 && isShortSeasonLength(n, m)) ? padded.length : n, m);
59539
+ const { drift, fit: fit3, ...chosen } = chooseSmoothing(
59540
+ n,
59541
+ m,
59542
+ (p) => etsValidationCost(searched, m, solve2(p).init, p, holdout),
59543
+ trendShape(y, holdout)
59544
+ );
59545
+ const { run: run2 } = solve2(fit3 ?? chosen);
59546
+ const state = drift ? solve2({ alpha: 1, beta: 0, gamma: chosen.gamma }).run : run2;
59547
+ return {
59548
+ ...chosen,
59549
+ gamma: m >= 2 ? chosen.gamma : NO_SEASON_GAMMA,
59550
+ m,
59551
+ n,
59552
+ ...run2,
59553
+ level: state.level,
59554
+ trend: state.trend
59555
+ };
59072
59556
  }
59073
59557
  function etsHoldout(n, m) {
59074
59558
  if (n < 11) return 0;
@@ -59093,12 +59577,12 @@ function etsErrorSd(fit3, h2) {
59093
59577
  // xlsx/formula/functions/ets-season.ts
59094
59578
  var MAX_POINTS = 8192;
59095
59579
  var MIN_CYCLES = 3;
59096
- var MIN_SHARE = 0.3;
59097
- var mean3 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
59580
+ var MIN_ACF = 0.3;
59581
+ var mean8 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
59098
59582
  function detrend(y) {
59099
59583
  const n = y.length;
59100
59584
  const mx = (n - 1) / 2;
59101
- const my = mean3(y);
59585
+ const my = mean8(y);
59102
59586
  let sxy = 0;
59103
59587
  let sxx = 0;
59104
59588
  for (let i2 = 0; i2 < n; i2++) {
@@ -59115,34 +59599,23 @@ function detectSeasonality(series) {
59115
59599
  const r = detrend(y);
59116
59600
  const scale2 = Math.max(...y.map(Math.abs), 1);
59117
59601
  if (r.every((v) => Math.abs(v) <= 1e-12 * scale2)) return 0;
59118
- const cos2 = new Float64Array(n);
59119
- const sin2 = new Float64Array(n);
59120
- for (let j = 0; j < n; j++) {
59121
- cos2[j] = Math.cos(2 * Math.PI * j / n);
59122
- sin2[j] = Math.sin(2 * Math.PI * j / n);
59123
- }
59124
- let total2 = 0;
59125
- let best = 0;
59126
- let bestK = 0;
59127
- for (let k = 1; k <= Math.floor(n / 2); k++) {
59128
- let re = 0;
59129
- let im = 0;
59130
- for (let t = 0; t < n; t++) {
59131
- const j = k * t % n;
59132
- const v = r[t];
59133
- re += v * cos2[j];
59134
- im -= v * sin2[j];
59135
- }
59136
- const power2 = re * re + im * im;
59137
- total2 += power2;
59138
- if (k >= MIN_CYCLES && power2 > best) {
59139
- best = power2;
59140
- bestK = k;
59141
- }
59602
+ const maxLag = Math.floor(n / MIN_CYCLES);
59603
+ let energy = 0;
59604
+ for (const v of r) energy += v * v;
59605
+ const acf = (lag) => {
59606
+ let s = 0;
59607
+ for (let t = 0; t + lag < n; t++) s += r[t] * r[t + lag];
59608
+ return s / energy;
59609
+ };
59610
+ let prev = acf(1);
59611
+ let cur = acf(2);
59612
+ for (let lag = 2; lag <= maxLag; lag++) {
59613
+ const next = acf(lag + 1);
59614
+ if (cur >= prev && cur >= next && cur >= MIN_ACF) return lag;
59615
+ prev = cur;
59616
+ cur = next;
59142
59617
  }
59143
- if (bestK === 0 || !(best / total2 >= MIN_SHARE)) return 0;
59144
- const period = Math.round(n / bestK);
59145
- return period >= 2 ? period : 0;
59618
+ return 0;
59146
59619
  }
59147
59620
 
59148
59621
  // xlsx/formula/functions/ets-grid.ts
@@ -59214,9 +59687,9 @@ function aggregate2(code, xs) {
59214
59687
  case 4:
59215
59688
  return Math.max(...xs);
59216
59689
  case 5:
59217
- return Math.min(...xs);
59218
- case 6:
59219
59690
  return median2(xs);
59691
+ case 6:
59692
+ return Math.min(...xs);
59220
59693
  default:
59221
59694
  return xs.reduce((a2, b) => a2 + b, 0);
59222
59695
  }
@@ -62947,11 +63420,11 @@ var ParseCache = class {
62947
63420
  parseNew(formula2) {
62948
63421
  if (formula2.length > MAX_TEMPLATE_LENGTH) return treeOf(makeTemplate(formula2, NO_RUNS));
62949
63422
  const shape2 = formulaShape(formula2);
62950
- const template = this.templates.get(shape2.hash);
62951
- const reused = template && fromTemplate(template, formula2, shape2);
63423
+ const template2 = this.templates.get(shape2.hash);
63424
+ const reused = template2 && fromTemplate(template2, formula2, shape2);
62952
63425
  if (reused) return reused;
62953
63426
  const made = makeTemplate(formula2, shape2);
62954
- if (!template && "ast" in made) {
63427
+ if (!template2 && "ast" in made) {
62955
63428
  if (this.templates.size > MAX_TEMPLATES2) this.templates.clear();
62956
63429
  this.templates.set(shape2.hash, made);
62957
63430
  }
@@ -63669,22 +64142,22 @@ function astTraits(ast) {
63669
64142
  traitsCache.set(ast, traits);
63670
64143
  return traits;
63671
64144
  }
63672
- function intervalDelta(a2, b, shift3) {
63673
- const { at: at3, count: count3 } = shift3;
64145
+ function intervalDelta(a2, b, shift4) {
64146
+ const { at: at3, count: count3 } = shift4;
63674
64147
  if (count3 > 0) {
63675
64148
  if (b < at3) return 0;
63676
64149
  if (a2 < at3) return void 0;
63677
- return b + count3 > (shift3.axis === "row" ? MAX_ROW : MAX_COL) ? void 0 : count3;
64150
+ return b + count3 > (shift4.axis === "row" ? MAX_ROW : MAX_COL) ? void 0 : count3;
63678
64151
  }
63679
64152
  const last = at3 - count3 - 1;
63680
64153
  if (b < at3) return 0;
63681
64154
  if (a2 > last) return count3;
63682
64155
  return void 0;
63683
64156
  }
63684
- function areaDelta(area, sheet2, shift3) {
64157
+ function areaDelta(area, sheet2, shift4) {
63685
64158
  if (area.sheet !== sheet2) return 0;
63686
64159
  const { start, end } = area.range;
63687
- return shift3.axis === "row" ? intervalDelta(start.row, end.row, shift3) : intervalDelta(start.col, end.col, shift3);
64160
+ return shift4.axis === "row" ? intervalDelta(start.row, end.row, shift4) : intervalDelta(start.col, end.col, shift4);
63688
64161
  }
63689
64162
  function movedRange(range3, axis, delta) {
63690
64163
  if (delta === 0) return range3;
@@ -63696,10 +64169,10 @@ function movedRange(range3, axis, delta) {
63696
64169
  end: { row: range3.end.row, col: range3.end.col + delta }
63697
64170
  };
63698
64171
  }
63699
- function reachesEdit(areas, sheet2, shift3) {
64172
+ function reachesEdit(areas, sheet2, shift4) {
63700
64173
  for (const area of areas) {
63701
64174
  if (area.sheet !== sheet2) continue;
63702
- if ((shift3.axis === "row" ? area.range.end.row : area.range.end.col) >= shift3.at) return true;
64175
+ if ((shift4.axis === "row" ? area.range.end.row : area.range.end.col) >= shift4.at) return true;
63703
64176
  }
63704
64177
  return false;
63705
64178
  }
@@ -63748,8 +64221,8 @@ var EngineStructure = class extends EngineCore {
63748
64221
  * changed (cells moved, formulas rewritten). Spills on the sheet, array formulas the edit cuts
63749
64222
  * and anything unexpected fall back to a rebuild on the next recalculation.
63750
64223
  */
63751
- shiftCells(sheet2, shift3) {
63752
- if (!this.graphReady() || !this.shiftable(sheet2, shift3)) {
64224
+ shiftCells(sheet2, shift4) {
64225
+ if (!this.graphReady() || !this.shiftable(sheet2, shift4)) {
63753
64226
  this.invalidate();
63754
64227
  return;
63755
64228
  }
@@ -63760,15 +64233,15 @@ var EngineStructure = class extends EngineCore {
63760
64233
  if (own3) {
63761
64234
  const next = /* @__PURE__ */ new Map();
63762
64235
  for (const node4 of own3.values()) {
63763
- const pos = shift3.axis === "row" ? node4.row : node4.col;
63764
- const delta = intervalDelta(pos, pos, shift3);
64236
+ const pos = shift4.axis === "row" ? node4.row : node4.col;
64237
+ const delta = intervalDelta(pos, pos, shift4);
63765
64238
  if (delta === void 0) {
63766
64239
  this.dropNode(node4);
63767
64240
  continue;
63768
64241
  }
63769
64242
  if (delta !== 0) {
63770
64243
  moved.set(node4, delta);
63771
- if (shift3.axis === "row") node4.row += delta;
64244
+ if (shift4.axis === "row") node4.row += delta;
63772
64245
  else node4.col += delta;
63773
64246
  }
63774
64247
  next.set(cellKey(node4.row, node4.col), node4);
@@ -63777,7 +64250,7 @@ var EngineStructure = class extends EngineCore {
63777
64250
  }
63778
64251
  for (const map2 of this.nodes.values())
63779
64252
  for (const node4 of map2.values()) {
63780
- if (!this.shiftNode(node4, sheet2, shift3, moved.get(node4) ?? 0)) {
64253
+ if (!this.shiftNode(node4, sheet2, shift4, moved.get(node4) ?? 0)) {
63781
64254
  this.invalidate();
63782
64255
  return;
63783
64256
  }
@@ -63786,11 +64259,11 @@ var EngineStructure = class extends EngineCore {
63786
64259
  this.graphChanged();
63787
64260
  }
63788
64261
  /** No spill or stale spilled value on the sheet, and no array formula the edit cuts. */
63789
- shiftable(sheet2, shift3) {
64262
+ shiftable(sheet2, shift4) {
63790
64263
  for (const node4 of this.footprints) {
63791
64264
  if (node4.sheet !== sheet2) continue;
63792
64265
  if (node4.spill || node4.blockedSpill) return false;
63793
- if (node4.arrayRange && areaDelta({ sheet: sheet2, range: node4.arrayRange }, sheet2, shift3) === void 0)
64266
+ if (node4.arrayRange && areaDelta({ sheet: sheet2, range: node4.arrayRange }, sheet2, shift4) === void 0)
63794
64267
  return false;
63795
64268
  }
63796
64269
  const ws = this.workbook.sheets[sheet2];
@@ -63806,19 +64279,19 @@ var EngineStructure = class extends EngineCore {
63806
64279
  this.footprints.delete(node4);
63807
64280
  }
63808
64281
  /** Updates one formula for the edit; false when the graph cannot follow it. */
63809
- shiftNode(node4, sheet2, shift3, nodeDelta) {
64282
+ shiftNode(node4, sheet2, shift4, nodeDelta) {
63810
64283
  const cell2 = this.workbook.sheets[node4.sheet]?.rows.get(node4.row)?.get(node4.col);
63811
64284
  if (cell2?.formula === void 0) return false;
63812
64285
  if (node4.arrayRange) {
63813
- const delta = areaDelta({ sheet: node4.sheet, range: node4.arrayRange }, sheet2, shift3);
64286
+ const delta = areaDelta({ sheet: node4.sheet, range: node4.arrayRange }, sheet2, shift4);
63814
64287
  if (delta === void 0) return false;
63815
- node4.arrayRange = movedRange(node4.arrayRange, shift3.axis, delta);
64288
+ node4.arrayRange = movedRange(node4.arrayRange, shift4.axis, delta);
63816
64289
  if (!cell2.arrayRange || !sameRange(node4.arrayRange, normalizeRange(cell2.arrayRange)))
63817
64290
  return false;
63818
64291
  }
63819
64292
  const changed = cell2.formula !== node4.formula;
63820
64293
  const traits = node4.ast && astTraits(node4.ast);
63821
- const reached = reachesEdit(node4.deps, sheet2, shift3) || reachesEdit(node4.dynamicDeps, sheet2, shift3);
64294
+ const reached = reachesEdit(node4.deps, sheet2, shift4) || reachesEdit(node4.dynamicDeps, sheet2, shift4);
63822
64295
  if (!changed && !reached && nodeDelta === 0 && !traits?.descriptive && !traits?.opaque)
63823
64296
  return true;
63824
64297
  if (traits?.complex) {
@@ -63827,10 +64300,10 @@ var EngineStructure = class extends EngineCore {
63827
64300
  this.structuralSeeds.add(node4);
63828
64301
  return true;
63829
64302
  }
63830
- const pos = shift3.axis === "row" ? node4.row - nodeDelta : node4.col - nodeDelta;
64303
+ const pos = shift4.axis === "row" ? node4.row - nodeDelta : node4.col - nodeDelta;
63831
64304
  const moves = { seed: !!traits?.descriptive, moved: false, cut: false };
63832
- const deps = this.moveAreas(node4.deps, sheet2, shift3, pos, nodeDelta, moves);
63833
- const dynamicDeps = this.moveAreas(node4.dynamicDeps, sheet2, shift3, pos, nodeDelta, moves);
64305
+ const deps = this.moveAreas(node4.deps, sheet2, shift4, pos, nodeDelta, moves);
64306
+ const dynamicDeps = this.moveAreas(node4.dynamicDeps, sheet2, shift4, pos, nodeDelta, moves);
63834
64307
  const { cut, moved: anyMoved } = moves;
63835
64308
  let seed = moves.seed;
63836
64309
  if (cut || changed !== anyMoved) {
@@ -63854,20 +64327,20 @@ var EngineStructure = class extends EngineCore {
63854
64327
  * moved, one was cut (deleted, widened, pushed off the grid) and whether implicit intersection
63855
64328
  * with one can now pick another cell.
63856
64329
  */
63857
- moveAreas(list3, sheet2, shift3, pos, nodeDelta, moves) {
64330
+ moveAreas(list3, sheet2, shift4, pos, nodeDelta, moves) {
63858
64331
  let out;
63859
64332
  for (let i2 = 0; i2 < list3.length; i2++) {
63860
64333
  const area = list3[i2];
63861
- const delta = areaDelta(area, sheet2, shift3);
64334
+ const delta = areaDelta(area, sheet2, shift4);
63862
64335
  if (delta === void 0) {
63863
64336
  moves.cut = true;
63864
64337
  continue;
63865
64338
  }
63866
- if (intersectionMoves(area, delta, pos, nodeDelta, shift3.axis)) moves.seed = true;
64339
+ if (intersectionMoves(area, delta, pos, nodeDelta, shift4.axis)) moves.seed = true;
63867
64340
  if (delta === 0) continue;
63868
64341
  moves.moved = true;
63869
64342
  out ??= list3.slice();
63870
- out[i2] = { sheet: area.sheet, range: movedRange(area.range, shift3.axis, delta) };
64343
+ out[i2] = { sheet: area.sheet, range: movedRange(area.range, shift4.axis, delta) };
63871
64344
  }
63872
64345
  return out ?? list3;
63873
64346
  }
@@ -64416,9 +64889,9 @@ function needsArrayEvaluation(formula2) {
64416
64889
 
64417
64890
  // xlsx/edit/range-math.ts
64418
64891
  var axisMax = (axis) => axis === "row" ? MAX_ROW : MAX_COL;
64419
- function shiftSpan(start, end, shift3) {
64420
- const { at: at3, count: count3 } = shift3;
64421
- const max = axisMax(shift3.axis);
64892
+ function shiftSpan(start, end, shift4) {
64893
+ const { at: at3, count: count3 } = shift4;
64894
+ const max = axisMax(shift4.axis);
64422
64895
  if (count3 > 0) {
64423
64896
  if (start >= at3) {
64424
64897
  if (start + count3 > max) return void 0;
@@ -64434,35 +64907,35 @@ function shiftSpan(start, end, shift3) {
64434
64907
  const e = end >= max ? max : end < at3 ? end : end > last ? end - n : at3 - 1;
64435
64908
  return s > e ? void 0 : { start: s, end: e };
64436
64909
  }
64437
- function shiftIndex(index4, shift3) {
64438
- const { at: at3, count: count3 } = shift3;
64910
+ function shiftIndex(index4, shift4) {
64911
+ const { at: at3, count: count3 } = shift4;
64439
64912
  if (index4 < at3) return index4;
64440
- if (count3 > 0) return index4 + count3 > axisMax(shift3.axis) ? void 0 : index4 + count3;
64913
+ if (count3 > 0) return index4 + count3 > axisMax(shift4.axis) ? void 0 : index4 + count3;
64441
64914
  return index4 < at3 - count3 ? void 0 : index4 + count3;
64442
64915
  }
64443
- function shiftIndexClamped(index4, shift3) {
64444
- const moved = shiftIndex(index4, shift3);
64916
+ function shiftIndexClamped(index4, shift4) {
64917
+ const moved = shiftIndex(index4, shift4);
64445
64918
  if (moved !== void 0) return moved;
64446
- return shift3.count > 0 ? axisMax(shift3.axis) : shift3.at;
64919
+ return shift4.count > 0 ? axisMax(shift4.axis) : shift4.at;
64447
64920
  }
64448
- function shiftRange(range3, shift3) {
64449
- if (shift3.axis === "row") {
64450
- const span5 = shiftSpan(range3.start.row, range3.end.row, shift3);
64921
+ function shiftRange(range3, shift4) {
64922
+ if (shift4.axis === "row") {
64923
+ const span5 = shiftSpan(range3.start.row, range3.end.row, shift4);
64451
64924
  return span5 && {
64452
64925
  start: { row: span5.start, col: range3.start.col },
64453
64926
  end: { row: span5.end, col: range3.end.col }
64454
64927
  };
64455
64928
  }
64456
- const span4 = shiftSpan(range3.start.col, range3.end.col, shift3);
64929
+ const span4 = shiftSpan(range3.start.col, range3.end.col, shift4);
64457
64930
  return span4 && {
64458
64931
  start: { row: range3.start.row, col: span4.start },
64459
64932
  end: { row: range3.end.row, col: span4.end }
64460
64933
  };
64461
64934
  }
64462
- function shiftRangeInBand(range3, shift3, lo, hi) {
64463
- const other = shift3.axis === "row" ? "col" : "row";
64935
+ function shiftRangeInBand(range3, shift4, lo, hi) {
64936
+ const other = shift4.axis === "row" ? "col" : "row";
64464
64937
  if (range3.end[other] < lo || range3.start[other] > hi) return range3;
64465
- if (range3.start[other] >= lo && range3.end[other] <= hi) return shiftRange(range3, shift3);
64938
+ if (range3.start[other] >= lo && range3.end[other] <= hi) return shiftRange(range3, shift4);
64466
64939
  return range3;
64467
64940
  }
64468
64941
  function subtractRange(a2, b) {
@@ -64493,7 +64966,7 @@ function pointsAt(token2, formulaSheet, sheet2) {
64493
64966
  if (!prefix3) return formulaSheet.toLowerCase() === sheet2.toLowerCase();
64494
64967
  return prefix3.book === void 0 && prefix3.sheet2 === void 0 && prefix3.sheet.toLowerCase() === sheet2.toLowerCase();
64495
64968
  }
64496
- function shiftFormulaInBand(formula2, formulaSheet, sheet2, shift3, band2) {
64969
+ function shiftFormulaInBand(formula2, formulaSheet, sheet2, shift4, band2) {
64497
64970
  let tokens3;
64498
64971
  try {
64499
64972
  tokens3 = tokenize(formula2);
@@ -64514,7 +64987,7 @@ function shiftFormulaInBand(formula2, formulaSheet, sheet2, shift3, band2) {
64514
64987
  },
64515
64988
  end: { row: Math.max(ref.start.row, ref.end.row), col: Math.max(ref.start.col, ref.end.col) }
64516
64989
  };
64517
- const moved = shiftRangeInBand(range3, shift3, band2.lo, band2.hi);
64990
+ const moved = shiftRangeInBand(range3, shift4, band2.lo, band2.hi);
64518
64991
  if (moved && sameRange2(moved, range3)) continue;
64519
64992
  const prefix3 = token2.prefix?.text ?? "";
64520
64993
  if (!moved) {
@@ -64552,15 +65025,15 @@ function carriedRefEdits(sourceSheets, currentSheets, shiftsOf = () => []) {
64552
65025
  edits2.deleted.push(source3.name);
64553
65026
  continue;
64554
65027
  }
64555
- for (const shift3 of shiftsOf(current)) edits2.shifts.push({ sheet: source3.name, shift: shift3 });
65028
+ for (const shift4 of shiftsOf(current)) edits2.shifts.push({ sheet: source3.name, shift: shift4 });
64556
65029
  if (current.name !== source3.name) edits2.renamed.push([source3.name, current.name]);
64557
65030
  }
64558
65031
  return edits2;
64559
65032
  }
64560
65033
  var hasCarriedRefEdits = (edits2) => edits2.shifts.length > 0 || edits2.deleted.length > 0 || edits2.renamed.length > 0;
64561
- function shiftOne(formula2, formulaSheet, sheet2, shift3) {
64562
- if (shift3.band) return shiftFormulaInBand(formula2, formulaSheet, sheet2, shift3, shift3.band);
64563
- const spec2 = { sheet: sheet2, axis: shift3.axis, at: shift3.at, count: shift3.count };
65034
+ function shiftOne(formula2, formulaSheet, sheet2, shift4) {
65035
+ if (shift4.band) return shiftFormulaInBand(formula2, formulaSheet, sheet2, shift4, shift4.band);
65036
+ const spec2 = { sheet: sheet2, axis: shift4.axis, at: shift4.at, count: shift4.count };
64564
65037
  return shiftFormula(formula2, formulaSheet, spec2);
64565
65038
  }
64566
65039
  function renameAll(formula2, renamed, taken) {
@@ -64583,7 +65056,7 @@ var takenNames = (edits2) => new Set(
64583
65056
  );
64584
65057
  function patchCarriedFormula(formula2, formulaSheet, edits2) {
64585
65058
  let out = formula2;
64586
- for (const { sheet: sheet2, shift: shift3 } of edits2.shifts) out = shiftOne(out, formulaSheet, sheet2, shift3);
65059
+ for (const { sheet: sheet2, shift: shift4 } of edits2.shifts) out = shiftOne(out, formulaSheet, sheet2, shift4);
64587
65060
  for (const sheet2 of edits2.deleted) out = deleteSheetInFormula(out, sheet2);
64588
65061
  return renameAll(out, edits2.renamed, takenNames(edits2));
64589
65062
  }
@@ -68327,8 +68800,8 @@ async function saveXlsx(workbook) {
68327
68800
 
68328
68801
  // xlsx/edit/shift-preserved.ts
68329
68802
  var XM3 = "http://schemas.microsoft.com/office/excel/2006/main";
68330
- function hasPreservedOverflow(sheet2, shift3, clipped, banded) {
68331
- const keys = banded ? ["extLst"] : [shift3.axis === "row" ? "rowBreaks" : "colBreaks", "extLst"];
68803
+ function hasPreservedOverflow(sheet2, shift4, clipped, banded) {
68804
+ const keys = banded ? ["extLst"] : [shift4.axis === "row" ? "rowBreaks" : "colBreaks", "extLst"];
68332
68805
  for (const key2 of keys)
68333
68806
  for (const xml of sheet2.preserved.get(key2) ?? []) {
68334
68807
  if (!xml.includes(key2 === "extLst" ? "sqref" : "brk")) continue;
@@ -68344,7 +68817,7 @@ function hasPreservedOverflow(sheet2, shift3, clipped, banded) {
68344
68817
  ))
68345
68818
  return true;
68346
68819
  } else if (elements(root).some(
68347
- (node4) => node4.localName === "brk" && shiftIndex(Number(node4.getAttribute("id") ?? "0"), shift3) === void 0
68820
+ (node4) => node4.localName === "brk" && shiftIndex(Number(node4.getAttribute("id") ?? "0"), shift4) === void 0
68348
68821
  ))
68349
68822
  return true;
68350
68823
  }
@@ -68376,11 +68849,11 @@ function editEntries(sheet2, key2, edit2, quick) {
68376
68849
  if (next.length) sheet2.preserved.set(key2, next);
68377
68850
  else sheet2.preserved.delete(key2);
68378
68851
  }
68379
- function shiftBreaks(root, shift3) {
68852
+ function shiftBreaks(root, shift4) {
68380
68853
  let changed = false;
68381
68854
  for (const brk of elements(root).filter((e) => e.localName === "brk")) {
68382
68855
  const id4 = Number(brk.getAttribute("id") ?? "0");
68383
- const moved = shiftIndex(id4, shift3);
68856
+ const moved = shiftIndex(id4, shift4);
68384
68857
  if (moved === id4) continue;
68385
68858
  changed = true;
68386
68859
  if (moved === void 0 || moved === 0) root.removeChild(brk);
@@ -68425,12 +68898,12 @@ function shiftSqrefs(root, moveRange) {
68425
68898
  list3.setAttribute("count", String(elements(list3).length));
68426
68899
  return elements(root).length > 0 ? "changed" : "drop";
68427
68900
  }
68428
- function shiftPreservedXml(sheet2, shift3, moveRange, banded) {
68901
+ function shiftPreservedXml(sheet2, shift4, moveRange, banded) {
68429
68902
  if (!banded)
68430
68903
  editEntries(
68431
68904
  sheet2,
68432
- shift3.axis === "row" ? "rowBreaks" : "colBreaks",
68433
- (root) => shiftBreaks(root, shift3),
68905
+ shift4.axis === "row" ? "rowBreaks" : "colBreaks",
68906
+ (root) => shiftBreaks(root, shift4),
68434
68907
  (xml) => xml.includes("brk")
68435
68908
  );
68436
68909
  editEntries(
@@ -69585,25 +70058,25 @@ function setBorders(ctx, s, range3, preset, edge2 = { style: "thin" }) {
69585
70058
  }
69586
70059
 
69587
70060
  // xlsx/edit/insert-guard.ts
69588
- function assertInsertFits(sheet2, shift3, band2) {
70061
+ function assertInsertFits(sheet2, shift4, band2) {
69589
70062
  for (const pivot of sheet2.pivotTables ?? []) {
69590
- const start = pivot.location.start[shift3.axis];
69591
- const end = pivot.location.end[shift3.axis];
69592
- const other2 = shift3.axis === "row" ? "col" : "row";
70063
+ const start = pivot.location.start[shift4.axis];
70064
+ const end = pivot.location.end[shift4.axis];
70065
+ const other2 = shift4.axis === "row" ? "col" : "row";
69593
70066
  if (band2 && (band2.hi < pivot.location.start[other2] || band2.lo > pivot.location.end[other2]))
69594
70067
  continue;
69595
70068
  const partial2 = band2 && (band2.lo > pivot.location.start[other2] || band2.hi < pivot.location.end[other2]);
69596
- const overlap = shift3.count > 0 ? shift3.at > start && shift3.at <= end : shift3.at <= end && shift3.at - shift3.count > start;
69597
- if (overlap || partial2 && shift3.at <= end)
70069
+ const overlap = shift4.count > 0 ? shift4.at > start && shift4.at <= end : shift4.at <= end && shift4.at - shift4.count > start;
70070
+ if (overlap || partial2 && shift4.at <= end)
69598
70071
  throw new Error("Cannot move or remove part of a PivotTable. Delete the PivotTable first.");
69599
70072
  }
69600
- if (shift3.count <= 0) return;
69601
- const max = shift3.axis === "row" ? MAX_ROW : MAX_COL;
69602
- if (shift3.at + shift3.count > max + 1)
70073
+ if (shift4.count <= 0) return;
70074
+ const max = shift4.axis === "row" ? MAX_ROW : MAX_COL;
70075
+ if (shift4.at + shift4.count > max + 1)
69603
70076
  throw new RangeError("The insert area extends beyond the sheet.");
69604
- const first3 = max - shift3.count + 1;
69605
- const lost = shift3.axis === "row" ? cellRange(first3, band2?.lo ?? 0, MAX_ROW, band2?.hi ?? MAX_COL) : cellRange(band2?.lo ?? 0, first3, band2?.hi ?? MAX_ROW, MAX_COL);
69606
- const other = shift3.axis === "row" ? "col" : "row";
70077
+ const first3 = max - shift4.count + 1;
70078
+ const lost = shift4.axis === "row" ? cellRange(first3, band2?.lo ?? 0, MAX_ROW, band2?.hi ?? MAX_COL) : cellRange(band2?.lo ?? 0, first3, band2?.hi ?? MAX_ROW, MAX_COL);
70079
+ const other = shift4.axis === "row" ? "col" : "row";
69607
70080
  const clipped = (range3) => (!band2 || range3.start[other] >= band2.lo && range3.end[other] <= band2.hi) && rangesIntersect(range3, lost);
69608
70081
  const fail4 = () => {
69609
70082
  throw new Error("Cannot insert cells: non-empty cells would be pushed off the sheet.");
@@ -69614,14 +70087,14 @@ function assertInsertFits(sheet2, shift3, band2) {
69614
70087
  if (col >= lost.start.col && col <= lost.end.col && (!isEmptyCell(cell2) || cell2.cellMetadata !== void 0 || cell2.valueMetadata !== void 0))
69615
70088
  fail4();
69616
70089
  }
69617
- if (sheet2.comments.some((c2) => rangesIntersect(cellRange(c2.address.row, c2.address.col), lost)) || sheet2.hyperlinks.some((h2) => rangesIntersect(h2.range, lost)) || sheet2.merges.some((m) => rangesIntersect(m, lost)) || sheet2.tables.some((t) => rangesIntersect(t.range, lost)) || sheet2.dataValidations.some((rule2) => rule2.ranges.some(clipped)) || sheet2.conditionalFormats.some((format8) => format8.ranges.some(clipped)) || sheet2.autoFilter !== void 0 && clipped(sheet2.autoFilter.range) || sheet2.pageSetup?.printArea !== void 0 && clipped(sheet2.pageSetup.printArea) || hasPreservedOverflow(sheet2, shift3, clipped, !!band2))
70090
+ if (sheet2.comments.some((c2) => rangesIntersect(cellRange(c2.address.row, c2.address.col), lost)) || sheet2.hyperlinks.some((h2) => rangesIntersect(h2.range, lost)) || sheet2.merges.some((m) => rangesIntersect(m, lost)) || sheet2.tables.some((t) => rangesIntersect(t.range, lost)) || sheet2.dataValidations.some((rule2) => rule2.ranges.some(clipped)) || sheet2.conditionalFormats.some((format8) => format8.ranges.some(clipped)) || sheet2.autoFilter !== void 0 && clipped(sheet2.autoFilter.range) || sheet2.pageSetup?.printArea !== void 0 && clipped(sheet2.pageSetup.printArea) || hasPreservedOverflow(sheet2, shift4, clipped, !!band2))
69618
70091
  fail4();
69619
70092
  for (const { anchor: anchor2 } of sheet2.drawings) {
69620
70093
  if (band2 && (anchor2.from[other] < band2.lo || anchor2.from[other] > band2.hi)) continue;
69621
- if (anchor2.from[shift3.axis] >= first3 || anchor2.to && anchor2.to[shift3.axis] >= first3) fail4();
70094
+ if (anchor2.from[shift4.axis] >= first3 || anchor2.to && anchor2.to[shift4.axis] >= first3) fail4();
69622
70095
  }
69623
70096
  if (band2) return;
69624
- if (shift3.axis === "row") {
70097
+ if (shift4.axis === "row") {
69625
70098
  for (const [row3, info] of sheet2.rowInfo) if (row3 >= first3 && Object.keys(info).length) fail4();
69626
70099
  } else {
69627
70100
  if (normalizeColumns(sheet2.columns).some((c2) => c2.min >= first3)) fail4();
@@ -69629,11 +70102,11 @@ function assertInsertFits(sheet2, shift3, band2) {
69629
70102
  }
69630
70103
 
69631
70104
  // xlsx/edit/shift-rule-anchors.ts
69632
- function rebaseRulesForDeletion(sheet2, shift3, band2) {
69633
- if (shift3.count >= 0) return;
69634
- const last = shift3.at - shift3.count - 1;
69635
- const removed2 = shift3.axis === "row" ? cellRange(shift3.at, band2?.lo ?? 0, last, band2?.hi ?? MAX_COL) : cellRange(band2?.lo ?? 0, shift3.at, band2?.hi ?? MAX_ROW, last);
69636
- const other = shift3.axis === "row" ? "col" : "row";
70105
+ function rebaseRulesForDeletion(sheet2, shift4, band2) {
70106
+ if (shift4.count >= 0) return;
70107
+ const last = shift4.at - shift4.count - 1;
70108
+ const removed2 = shift4.axis === "row" ? cellRange(shift4.at, band2?.lo ?? 0, last, band2?.hi ?? MAX_COL) : cellRange(band2?.lo ?? 0, shift4.at, band2?.hi ?? MAX_ROW, last);
70109
+ const other = shift4.axis === "row" ? "col" : "row";
69637
70110
  const surviving = (ranges) => ranges.flatMap(
69638
70111
  (range3) => band2 && (range3.start[other] < band2.lo || range3.end[other] > band2.hi) ? [range3] : subtractRange(range3, removed2)
69639
70112
  );
@@ -69889,10 +70362,10 @@ function shiftScenarios(sheet2, move) {
69889
70362
  }
69890
70363
 
69891
70364
  // xlsx/edit/shift-sheet.ts
69892
- function shiftSheetContent(sheet2, shift3, band2) {
69893
- assertInsertFits(sheet2, shift3, band2);
69894
- const moveRange = (range3) => band2 ? shiftRangeInBand(range3, shift3, band2.lo, band2.hi) : shiftRange(range3, shift3);
69895
- shiftCells(sheet2, shift3, band2, moveRange);
70365
+ function shiftSheetContent(sheet2, shift4, band2) {
70366
+ assertInsertFits(sheet2, shift4, band2);
70367
+ const moveRange = (range3) => band2 ? shiftRangeInBand(range3, shift4, band2.lo, band2.hi) : shiftRange(range3, shift4);
70368
+ shiftCells(sheet2, shift4, band2, moveRange);
69896
70369
  sheet2.merges = sheet2.merges.map(moveRange).filter((m) => !!m && (m.start.row !== m.end.row || m.start.col !== m.end.col));
69897
70370
  sheet2.conditionalFormats = sheet2.conditionalFormats.map((cf) => ({ ...cf, ranges: cf.ranges.map(moveRange).filter((r) => !!r) })).filter((cf) => cf.ranges.length > 0);
69898
70371
  sheet2.dataValidations = sheet2.dataValidations.map((dv) => ({ ...dv, ranges: dv.ranges.map(moveRange).filter((r) => !!r) })).filter((dv) => dv.ranges.length > 0);
@@ -69904,7 +70377,7 @@ function shiftSheetContent(sheet2, shift3, band2) {
69904
70377
  const range3 = moveRange({ start: c2.address, end: c2.address });
69905
70378
  return range3 ? [{ ...c2, address: range3.start }] : [];
69906
70379
  });
69907
- sheet2.tables = sheet2.tables.flatMap((t) => shiftTable2(sheet2, t, shift3, moveRange));
70380
+ sheet2.tables = sheet2.tables.flatMap((t) => shiftTable2(sheet2, t, shift4, moveRange));
69908
70381
  shiftDataTables(sheet2, moveRange);
69909
70382
  shiftScenarios(sheet2, moveRange);
69910
70383
  for (const pivot of sheet2.pivotTables ?? []) {
@@ -69914,8 +70387,8 @@ function shiftSheetContent(sheet2, shift3, band2) {
69914
70387
  pivot.dirty = true;
69915
70388
  }
69916
70389
  }
69917
- for (const drawing of sheet2.drawings) shiftAnchor(drawing.anchor, shift3, band2);
69918
- if (!band2) shiftAxisFormats(sheet2, shift3);
70390
+ for (const drawing of sheet2.drawings) shiftAnchor(drawing.anchor, shift4, band2);
70391
+ if (!band2) shiftAxisFormats(sheet2, shift4);
69919
70392
  if (sheet2.autoFilter) {
69920
70393
  const old = sheet2.autoFilter.range;
69921
70394
  const range3 = moveRange(old);
@@ -69924,39 +70397,39 @@ function shiftSheetContent(sheet2, shift3, band2) {
69924
70397
  clearFilteredRows(sheet2);
69925
70398
  } else {
69926
70399
  const filter2 = { ...sheet2.autoFilter, range: range3 };
69927
- if (shift3.axis === "col" && filter2.columns)
70400
+ if (shift4.axis === "col" && filter2.columns)
69928
70401
  filter2.columns = filter2.columns.flatMap((fc) => {
69929
- const abs2 = shiftIndex(old.start.col + fc.offset, shift3);
70402
+ const abs2 = shiftIndex(old.start.col + fc.offset, shift4);
69930
70403
  return abs2 === void 0 ? [] : [{ ...fc, offset: abs2 - range3.start.col }];
69931
70404
  });
69932
70405
  sheet2.autoFilter = filter2;
69933
70406
  }
69934
70407
  }
69935
- if (!band2) shiftFreeze(sheet2, shift3);
70408
+ if (!band2) shiftFreeze(sheet2, shift4);
69936
70409
  const printArea = sheet2.pageSetup?.printArea;
69937
70410
  if (sheet2.pageSetup && printArea) {
69938
70411
  const moved = moveRange(printArea);
69939
70412
  if (moved) sheet2.pageSetup.printArea = moved;
69940
70413
  else delete sheet2.pageSetup.printArea;
69941
70414
  }
69942
- shiftPreservedXml(sheet2, shift3, moveRange, !!band2);
70415
+ shiftPreservedXml(sheet2, shift4, moveRange, !!band2);
69943
70416
  }
69944
- function shiftCells(sheet2, shift3, band2, moveRange) {
70417
+ function shiftCells(sheet2, shift4, band2, moveRange) {
69945
70418
  const old = sheet2.rows;
69946
70419
  sheet2.rows = /* @__PURE__ */ new Map();
69947
70420
  for (const [row3, cells3] of old)
69948
70421
  for (const [col, cell2] of cells3) {
69949
- const along = shift3.axis === "row" ? row3 : col;
69950
- const across = shift3.axis === "row" ? col : row3;
70422
+ const along = shift4.axis === "row" ? row3 : col;
70423
+ const across = shift4.axis === "row" ? col : row3;
69951
70424
  const inBand = !band2 || across >= band2.lo && across <= band2.hi;
69952
- const moved = inBand ? shiftIndex(along, shift3) : along;
70425
+ const moved = inBand ? shiftIndex(along, shift4) : along;
69953
70426
  if (moved === void 0) continue;
69954
70427
  if (cell2.arrayRange) {
69955
70428
  const range3 = moveRange(cell2.arrayRange);
69956
70429
  if (range3) cell2.arrayRange = range3;
69957
70430
  else delete cell2.arrayRange;
69958
70431
  }
69959
- if (shift3.axis === "row") putCell(sheet2, moved, col, cell2);
70432
+ if (shift4.axis === "row") putCell(sheet2, moved, col, cell2);
69960
70433
  else putCell(sheet2, row3, moved, cell2);
69961
70434
  }
69962
70435
  }
@@ -69964,73 +70437,73 @@ function uniqueColumnName(columns2) {
69964
70437
  const taken = new Set(columns2.map((c2) => c2.name.toLowerCase()));
69965
70438
  for (let n = 1; ; n++) if (!taken.has(`column${n}`)) return `Column${n}`;
69966
70439
  }
69967
- function shiftTable2(sheet2, table4, shift3, moveRange) {
70440
+ function shiftTable2(sheet2, table4, shift4, moveRange) {
69968
70441
  const old = table4.range;
69969
70442
  const range3 = moveRange(old);
69970
70443
  if (!range3) return [];
69971
70444
  const next = { ...table4, range: range3, columns: [...table4.columns] };
69972
70445
  const widened = range3.end.col - range3.start.col !== old.end.col - old.start.col;
69973
- if (shift3.axis === "col" && widened) {
69974
- if (shift3.count > 0) {
69975
- const offset2 = shift3.at - old.start.col;
69976
- for (let i2 = 0; i2 < shift3.count; i2++) {
70446
+ if (shift4.axis === "col" && widened) {
70447
+ if (shift4.count > 0) {
70448
+ const offset2 = shift4.at - old.start.col;
70449
+ for (let i2 = 0; i2 < shift4.count; i2++) {
69977
70450
  const column3 = { name: uniqueColumnName(next.columns) };
69978
70451
  next.columns.splice(offset2 + i2, 0, column3);
69979
70452
  if (next.headerRow) {
69980
70453
  const cell2 = { value: column3.name };
69981
- putCell(sheet2, range3.start.row, shift3.at + i2, cell2);
70454
+ putCell(sheet2, range3.start.row, shift4.at + i2, cell2);
69982
70455
  }
69983
70456
  }
69984
70457
  } else {
69985
70458
  next.columns = next.columns.filter(
69986
- (_c, i2) => shiftIndex(old.start.col + i2, shift3) !== void 0
70459
+ (_c, i2) => shiftIndex(old.start.col + i2, shift4) !== void 0
69987
70460
  );
69988
70461
  }
69989
70462
  }
69990
70463
  return [next];
69991
70464
  }
69992
- function shiftAnchor(anchor2, shift3, band2) {
69993
- const key2 = shift3.axis === "row" ? "row" : "col";
69994
- const other = shift3.axis === "row" ? "col" : "row";
70465
+ function shiftAnchor(anchor2, shift4, band2) {
70466
+ const key2 = shift4.axis === "row" ? "row" : "col";
70467
+ const other = shift4.axis === "row" ? "col" : "row";
69995
70468
  if (band2 && (anchor2.from[other] < band2.lo || anchor2.from[other] > band2.hi)) return;
69996
70469
  const from = anchor2.from[key2];
69997
- const movedFrom = shiftIndexClamped(from, shift3);
69998
- if (shiftIndex(from, shift3) === void 0)
70470
+ const movedFrom = shiftIndexClamped(from, shift4);
70471
+ if (shiftIndex(from, shift4) === void 0)
69999
70472
  anchor2.from[key2 === "row" ? "rowOffset" : "colOffset"] = 0;
70000
70473
  anchor2.from[key2] = movedFrom;
70001
70474
  if (anchor2.to) {
70002
70475
  const to = anchor2.to[key2];
70003
- const moved = shiftIndex(to, shift3);
70476
+ const moved = shiftIndex(to, shift4);
70004
70477
  if (moved === void 0) {
70005
- anchor2.to[key2] = Math.max(movedFrom, shiftIndexClamped(to, shift3));
70478
+ anchor2.to[key2] = Math.max(movedFrom, shiftIndexClamped(to, shift4));
70006
70479
  anchor2.to[key2 === "row" ? "rowOffset" : "colOffset"] = 0;
70007
70480
  } else anchor2.to[key2] = moved;
70008
70481
  }
70009
70482
  }
70010
- function shiftAxisFormats(sheet2, shift3) {
70011
- if (shift3.axis === "row") {
70483
+ function shiftAxisFormats(sheet2, shift4) {
70484
+ if (shift4.axis === "row") {
70012
70485
  const old = sheet2.rowInfo;
70013
70486
  sheet2.rowInfo = /* @__PURE__ */ new Map();
70014
70487
  for (const [row3, info] of old) {
70015
- const moved = shiftIndex(row3, shift3);
70488
+ const moved = shiftIndex(row3, shift4);
70016
70489
  if (moved !== void 0) sheet2.rowInfo.set(moved, info);
70017
70490
  }
70018
70491
  return;
70019
70492
  }
70020
70493
  sheet2.columns = normalizeColumns(
70021
70494
  sheet2.columns.flatMap((info) => {
70022
- const span4 = shiftSpan(info.min, info.max, shift3);
70495
+ const span4 = shiftSpan(info.min, info.max, shift4);
70023
70496
  return span4 ? [{ ...info, min: span4.start, max: span4.end }] : [];
70024
70497
  })
70025
70498
  );
70026
70499
  }
70027
- function shiftFreeze(sheet2, shift3) {
70500
+ function shiftFreeze(sheet2, shift4) {
70028
70501
  const freeze = sheet2.view.freeze;
70029
70502
  if (!freeze) return;
70030
- const key2 = shift3.axis === "row" ? "rows" : "cols";
70503
+ const key2 = shift4.axis === "row" ? "rows" : "cols";
70031
70504
  const frozen = freeze[key2];
70032
- if (shift3.at >= frozen) return;
70033
- const next = shift3.count > 0 ? frozen + shift3.count : frozen - Math.min(-shift3.count, frozen - shift3.at);
70505
+ if (shift4.at >= frozen) return;
70506
+ const next = shift4.count > 0 ? frozen + shift4.count : frozen - Math.min(-shift4.count, frozen - shift4.at);
70034
70507
  sheet2.view.freeze = { ...freeze, [key2]: next };
70035
70508
  }
70036
70509
 
@@ -70040,15 +70513,15 @@ function checkSpan(axis, at3, count3) {
70040
70513
  if (!Number.isInteger(at3) || !Number.isInteger(count3) || at3 < 0 || at3 > max || count3 < 1 || at3 + count3 > max + 1)
70041
70514
  throw new RangeError(`Invalid ${axis} span ${at3} + ${count3}`);
70042
70515
  }
70043
- function applyAxisShift(ctx, sheet2, shift3) {
70044
- assertInsertFits(sheet2, shift3);
70045
- rebaseRulesForDeletion(sheet2, shift3);
70046
- const spec2 = { sheet: sheet2.name, axis: shift3.axis, at: shift3.at, count: shift3.count };
70516
+ function applyAxisShift(ctx, sheet2, shift4) {
70517
+ assertInsertFits(sheet2, shift4);
70518
+ rebaseRulesForDeletion(sheet2, shift4);
70519
+ const spec2 = { sheet: sheet2.name, axis: shift4.axis, at: shift4.at, count: shift4.count };
70047
70520
  rewriteFormulas(
70048
70521
  ctx.workbook,
70049
70522
  (formula2, formulaSheet) => shiftFormula(formula2, formulaSheet, spec2)
70050
70523
  );
70051
- shiftSheetContent(sheet2, shift3);
70524
+ shiftSheetContent(sheet2, shift4);
70052
70525
  }
70053
70526
  function inheritFormats(sheet2, axis, at3, count3) {
70054
70527
  if (at3 === 0) return;
@@ -70074,17 +70547,17 @@ function shiftAxis(ctx, s, axis, at3, count3, insert3) {
70074
70547
  checkSpan(axis, at3, count3);
70075
70548
  const sheet2 = sheetAt(ctx.workbook, s);
70076
70549
  const noun = axis === "row" ? count3 === 1 ? "row" : "rows" : count3 === 1 ? "column" : "columns";
70077
- const shift3 = { axis, at: at3, count: insert3 ? count3 : -count3 };
70078
- assertInsertFits(sheet2, shift3);
70550
+ const shift4 = { axis, at: at3, count: insert3 ? count3 : -count3 };
70551
+ assertInsertFits(sheet2, shift4);
70079
70552
  const info = { sheet: s, structural: true };
70080
- if (!sheet2.autoFilter || shiftRange(sheet2.autoFilter.range, shift3))
70081
- info.calc = { kind: "shift", sheet: s, shift: shift3 };
70553
+ if (!sheet2.autoFilter || shiftRange(sheet2.autoFilter.range, shift4))
70554
+ info.calc = { kind: "shift", sheet: s, shift: shift4 };
70082
70555
  ctx.run(
70083
70556
  `${insert3 ? "Insert" : "Delete"} ${noun}`,
70084
70557
  "structure",
70085
- [{ kind: "shift", sheet: s, shift: shift3 }],
70558
+ [{ kind: "shift", sheet: s, shift: shift4 }],
70086
70559
  () => {
70087
- applyAxisShift(ctx, sheet2, shift3);
70560
+ applyAxisShift(ctx, sheet2, shift4);
70088
70561
  if (insert3) inheritFormats(sheet2, axis, at3, count3);
70089
70562
  },
70090
70563
  info
@@ -70096,9 +70569,9 @@ var insertColumns = (ctx, s, at3, count3) => shiftAxis(ctx, s, "col", at3, count
70096
70569
  var deleteColumns = (ctx, s, at3, count3) => shiftAxis(ctx, s, "col", at3, count3, false);
70097
70570
 
70098
70571
  // xlsx/edit/cell-shift.ts
70099
- function assertBandIntact(sheet2, shift3, band2) {
70100
- const zone = shift3.axis === "row" ? cellRange(shift3.at, band2.lo, MAX_ROW, band2.hi) : cellRange(band2.lo, shift3.at, band2.hi, MAX_COL);
70101
- const other = shift3.axis === "row" ? "col" : "row";
70572
+ function assertBandIntact(sheet2, shift4, band2) {
70573
+ const zone = shift4.axis === "row" ? cellRange(shift4.at, band2.lo, MAX_ROW, band2.hi) : cellRange(band2.lo, shift4.at, band2.hi, MAX_COL);
70574
+ const other = shift4.axis === "row" ? "col" : "row";
70102
70575
  const torn = (r) => rangesIntersect(r, zone) && (r.start[other] < band2.lo || r.end[other] > band2.hi);
70103
70576
  if (sheet2.merges.some(torn))
70104
70577
  throw new Error("Cannot shift cells: a merged range would be split.");
@@ -70111,25 +70584,25 @@ function shiftBand(ctx, s, range3, direction) {
70111
70584
  const vertical2 = direction === "down" || direction === "up";
70112
70585
  const insert3 = direction === "down" || direction === "right";
70113
70586
  const size3 = vertical2 ? r.end.row - r.start.row + 1 : r.end.col - r.start.col + 1;
70114
- const shift3 = {
70587
+ const shift4 = {
70115
70588
  axis: vertical2 ? "row" : "col",
70116
70589
  at: vertical2 ? r.start.row : r.start.col,
70117
70590
  count: insert3 ? size3 : -size3
70118
70591
  };
70119
70592
  const band2 = vertical2 ? { lo: r.start.col, hi: r.end.col } : { lo: r.start.row, hi: r.end.row };
70120
- assertBandIntact(sheet2, shift3, band2);
70121
- assertInsertFits(sheet2, shift3, band2);
70593
+ assertBandIntact(sheet2, shift4, band2);
70594
+ assertInsertFits(sheet2, shift4, band2);
70122
70595
  ctx.run(
70123
70596
  `${insert3 ? "Insert" : "Delete"} cells`,
70124
70597
  "structure",
70125
- [{ kind: "shift", sheet: s, shift: shift3, band: band2 }],
70598
+ [{ kind: "shift", sheet: s, shift: shift4, band: band2 }],
70126
70599
  () => {
70127
- rebaseRulesForDeletion(sheet2, shift3, band2);
70600
+ rebaseRulesForDeletion(sheet2, shift4, band2);
70128
70601
  rewriteFormulas(
70129
70602
  ctx.workbook,
70130
- (formula2, formulaSheet) => shiftFormulaInBand(formula2, formulaSheet, sheet2.name, shift3, band2)
70603
+ (formula2, formulaSheet) => shiftFormulaInBand(formula2, formulaSheet, sheet2.name, shift4, band2)
70131
70604
  );
70132
- shiftSheetContent(sheet2, shift3, band2);
70605
+ shiftSheetContent(sheet2, shift4, band2);
70133
70606
  },
70134
70607
  { sheet: s, ranges: [r], structural: true }
70135
70608
  );
@@ -71657,14 +72130,14 @@ function restoreRefs(workbook, data) {
71657
72130
  }
71658
72131
  var sameRange3 = (a2, b) => a2 === b || !!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;
71659
72132
  var sameEntry = (a2, b) => a2.formula === b.formula && sameRange3(a2.arrayRange, b.arrayRange);
71660
- function movePosition(spec2, shift3, s, row3, col) {
71661
- if (!spec2 || !shift3 || s !== spec2.sheet) return [row3, col];
71662
- const along = shift3.axis === "row" ? row3 : col;
71663
- const across = shift3.axis === "row" ? col : row3;
72133
+ function movePosition(spec2, shift4, s, row3, col) {
72134
+ if (!spec2 || !shift4 || s !== spec2.sheet) return [row3, col];
72135
+ const along = shift4.axis === "row" ? row3 : col;
72136
+ const across = shift4.axis === "row" ? col : row3;
71664
72137
  if (spec2.band && (across < spec2.band.lo || across > spec2.band.hi)) return [row3, col];
71665
- const moved = shiftIndex(along, shift3);
72138
+ const moved = shiftIndex(along, shift4);
71666
72139
  if (moved === void 0) return void 0;
71667
- return shift3.axis === "row" ? [moved, col] : [row3, moved];
72140
+ return shift4.axis === "row" ? [moved, col] : [row3, moved];
71668
72141
  }
71669
72142
  function diffRefs(workbook, before, spec2) {
71670
72143
  const keptBefore = [];
@@ -71685,37 +72158,37 @@ function diffRefs(workbook, before, spec2) {
71685
72158
  before.formulas = keptBefore;
71686
72159
  return keptAfter;
71687
72160
  }
71688
- function moveCellsRaw(sheet2, shift3, band2) {
72161
+ function moveCellsRaw(sheet2, shift4, band2) {
71689
72162
  const old = sheet2.rows;
71690
72163
  sheet2.rows = /* @__PURE__ */ new Map();
71691
- if (shift3.axis === "row" && !band2) {
72164
+ if (shift4.axis === "row" && !band2) {
71692
72165
  for (const [row3, cells3] of old) {
71693
- const moved = shiftIndex(row3, shift3);
72166
+ const moved = shiftIndex(row3, shift4);
71694
72167
  if (moved !== void 0) sheet2.rows.set(moved, cells3);
71695
72168
  }
71696
72169
  return;
71697
72170
  }
71698
72171
  for (const [row3, cells3] of old)
71699
72172
  for (const [col, cell2] of cells3) {
71700
- const along = shift3.axis === "row" ? row3 : col;
71701
- const across = shift3.axis === "row" ? col : row3;
72173
+ const along = shift4.axis === "row" ? row3 : col;
72174
+ const across = shift4.axis === "row" ? col : row3;
71702
72175
  const inBand = !band2 || across >= band2.lo && across <= band2.hi;
71703
- const moved = inBand ? shiftIndex(along, shift3) : along;
72176
+ const moved = inBand ? shiftIndex(along, shift4) : along;
71704
72177
  if (moved === void 0) continue;
71705
- if (shift3.axis === "row") putCell(sheet2, moved, col, cell2);
72178
+ if (shift4.axis === "row") putCell(sheet2, moved, col, cell2);
71706
72179
  else putCell(sheet2, row3, moved, cell2);
71707
72180
  }
71708
72181
  }
71709
72182
  function shiftEdgeCells(sheet2, spec2, phase) {
71710
- const { shift: shift3, band: band2 } = spec2;
72183
+ const { shift: shift4, band: band2 } = spec2;
71711
72184
  const out = [];
71712
- if (phase === "after" && shift3.count < 0) return out;
71713
- const hit = (along) => phase === "before" ? shiftIndex(along, shift3) === void 0 : along >= shift3.at && along < shift3.at + shift3.count;
72185
+ if (phase === "after" && shift4.count < 0) return out;
72186
+ const hit = (along) => phase === "before" ? shiftIndex(along, shift4) === void 0 : along >= shift4.at && along < shift4.at + shift4.count;
71714
72187
  for (const [row3, cells3] of sheet2.rows) {
71715
- if (shift3.axis === "row" && !hit(row3)) continue;
72188
+ if (shift4.axis === "row" && !hit(row3)) continue;
71716
72189
  for (const [col, cell2] of cells3) {
71717
- const along = shift3.axis === "row" ? row3 : col;
71718
- const across = shift3.axis === "row" ? col : row3;
72190
+ const along = shift4.axis === "row" ? row3 : col;
72191
+ const across = shift4.axis === "row" ? col : row3;
71719
72192
  if (band2 && (across < band2.lo || across > band2.hi)) continue;
71720
72193
  if (hit(along)) out.push([row3, col, structuredClone(cell2)]);
71721
72194
  }
@@ -71858,8 +72331,8 @@ function restoreShift(workbook, snapshot2) {
71858
72331
  const { spec: spec2 } = snapshot2;
71859
72332
  const sheet2 = workbook.sheets[spec2.sheet];
71860
72333
  if (!sheet2) return;
71861
- const shift3 = snapshot2.phase === "before" ? { ...spec2.shift, count: -spec2.shift.count } : spec2.shift;
71862
- moveCellsRaw(sheet2, shift3, spec2.band);
72334
+ const shift4 = snapshot2.phase === "before" ? { ...spec2.shift, count: -spec2.shift.count } : spec2.shift;
72335
+ moveCellsRaw(sheet2, shift4, spec2.band);
71863
72336
  for (const [row3, col, cell2] of snapshot2.cells) putCell(sheet2, row3, col, cloneCell(cell2));
71864
72337
  restoreRefs(workbook, snapshot2.data);
71865
72338
  workbook.activeSheet = snapshot2.activeSheet;
@@ -74752,11 +75225,11 @@ var byId = (sheet2, id4) => {
74752
75225
  return table4;
74753
75226
  };
74754
75227
  function insertBandRow(workbook, sheet2, table4, row3) {
74755
- const shift3 = { axis: "row", at: row3, count: 1 };
75228
+ const shift4 = { axis: "row", at: row3, count: 1 };
74756
75229
  const band2 = { lo: table4.range.start.col, hi: table4.range.end.col };
74757
- assertInsertFits(sheet2, shift3, band2);
74758
- rewriteFormulas(workbook, (f6, fs) => shiftFormulaInBand(f6, fs, sheet2.name, shift3, band2));
74759
- shiftSheetContent(sheet2, shift3, band2);
75230
+ assertInsertFits(sheet2, shift4, band2);
75231
+ rewriteFormulas(workbook, (f6, fs) => shiftFormulaInBand(f6, fs, sheet2.name, shift4, band2));
75232
+ shiftSheetContent(sheet2, shift4, band2);
74760
75233
  }
74761
75234
  function setHeaderRow(workbook, sheet2, id4, on) {
74762
75235
  let table4 = byId(sheet2, id4);
@@ -77783,10 +78256,10 @@ function createTable2(ctx, s, range3, hasHeader, styleName = "TableStyleMedium2"
77783
78256
  [hasHeader ? { kind: "sheet", sheet: s } : { kind: "workbook" }],
77784
78257
  () => {
77785
78258
  if (!hasHeader) {
77786
- const shift3 = { axis: "row", at: r.start.row, count: 1 };
78259
+ const shift4 = { axis: "row", at: r.start.row, count: 1 };
77787
78260
  const band2 = { lo: r.start.col, hi: r.end.col };
77788
- rewriteFormulas(workbook, (f6, fs) => shiftFormulaInBand(f6, fs, sheet2.name, shift3, band2));
77789
- shiftSheetContent(sheet2, shift3, band2);
78261
+ rewriteFormulas(workbook, (f6, fs) => shiftFormulaInBand(f6, fs, sheet2.name, shift4, band2));
78262
+ shiftSheetContent(sheet2, shift4, band2);
77790
78263
  r = { start: r.start, end: { row: r.end.row + 1, col: r.end.col } };
77791
78264
  }
77792
78265
  const width = r.end.col - r.start.col + 1;
@@ -91340,9 +91813,9 @@ var isMarkup = (node4) => node4.nodeType !== 3 && node4.nodeType !== 4;
91340
91813
  var knownMarkup = (text7) => Array.from(text7.childNodes).every(
91341
91814
  (node4) => !isMarkup(node4) || ["cp", "pp", "tp", "fld"].includes(node4.localName)
91342
91815
  );
91343
- function assertUnlocked2(shape2, template) {
91816
+ function assertUnlocked2(shape2, template2) {
91344
91817
  const local = children3(shape2, "Cell").some((cell2) => attribute3(cell2, "N") === "LockTextEdit");
91345
- for (const cell2 of children3(local ? shape2 : template, "Cell")) {
91818
+ for (const cell2 of children3(local ? shape2 : template2, "Cell")) {
91346
91819
  if (attribute3(cell2, "N") !== "LockTextEdit") continue;
91347
91820
  if (cell2.hasAttribute("E") || cell2.hasAttribute("F") || Number(attribute3(cell2, "V")) !== 0)
91348
91821
  fail3("EDIT_PROTECTED_CELL", "The shape is protected against text editing.");
@@ -91360,9 +91833,9 @@ function insertBeforeTail(shape2, node4, tail) {
91360
91833
  shape2.insertBefore(node4, after ?? null);
91361
91834
  }
91362
91835
  var AFTER_TEXT = ["Data1", "Data2", "Data3", "ForeignData", "Shapes"];
91363
- function replaceInstanceText(shape2, template, text7) {
91836
+ function replaceInstanceText(shape2, template2, text7) {
91364
91837
  const local = single2(shape2, "The shape");
91365
- const inherited = single2(template, "The master shape");
91838
+ const inherited = single2(template2, "The master shape");
91366
91839
  if (local && Array.from(local.childNodes).some(isMarkup))
91367
91840
  fail3(
91368
91841
  "UNSUPPORTED_TEXT_EDIT",
@@ -91372,8 +91845,8 @@ function replaceInstanceText(shape2, template, text7) {
91372
91845
  fail3("UNSUPPORTED_TEXT_EDIT", "The master text has markup this editor does not know.");
91373
91846
  if (fieldSections(shape2).length)
91374
91847
  fail3("UNSUPPORTED_TEXT_EDIT", "This stencil shape has its own text fields; edit around them.");
91375
- assertUnlocked2(shape2, template);
91376
- const fields = local ? [] : fieldSections(template).flatMap((section3) => children3(section3, "Row"));
91848
+ assertUnlocked2(shape2, template2);
91849
+ const fields = local ? [] : fieldSections(template2).flatMap((section3) => children3(section3, "Row"));
91377
91850
  const current = local ?? inherited;
91378
91851
  if (!fields.length && current && !Array.from(current.childNodes).some(isMarkup)) {
91379
91852
  if (decodeVisioPlainText(current.textContent ?? "") === text7) return false;
@@ -91402,12 +91875,12 @@ function replaceInstanceText(shape2, template, text7) {
91402
91875
  node4.appendChild(document.createTextNode(encodeVisioPlainText(text7)));
91403
91876
  return true;
91404
91877
  }
91405
- function instanceTextNode(shape2, template) {
91878
+ function instanceTextNode(shape2, template2) {
91406
91879
  const local = single2(shape2, "The shape");
91407
- assertUnlocked2(shape2, template);
91880
+ assertUnlocked2(shape2, template2);
91408
91881
  if (local) return { text: local, discard: () => {
91409
91882
  } };
91410
- const inherited = single2(template, "The master shape");
91883
+ const inherited = single2(template2, "The master shape");
91411
91884
  if (!inherited) fail3("UNSUPPORTED_TEXT_RANGE", "The stencil shape has no text to edit.");
91412
91885
  if (!knownMarkup(inherited))
91413
91886
  fail3("UNSUPPORTED_TEXT_RANGE", "The master text has markup this editor does not know.");
@@ -91426,9 +91899,9 @@ async function replacePlainText(root, document, shapeId2, text7, check4, assertD
91426
91899
  if (found.masterId !== void 0) {
91427
91900
  if (!masterTemplate2)
91428
91901
  fail3("UNSUPPORTED_TEXT_EDIT", "Stencil shapes cannot be edited without their masters.");
91429
- const template = await masterTemplate2(found.masterId, found.masterShapeId);
91902
+ const template2 = await masterTemplate2(found.masterId, found.masterShapeId);
91430
91903
  check4();
91431
- return replaceInstanceText(found.node, template, text7);
91904
+ return replaceInstanceText(found.node, template2, text7);
91432
91905
  }
91433
91906
  const target3 = localTextTarget(root, document, shapeId2, check4);
91434
91907
  const texts = children3(target3, "Text");
@@ -91644,7 +92117,7 @@ function assertMasterMarkup(root, known, check4) {
91644
92117
  );
91645
92118
  }
91646
92119
  }
91647
- function masterStyleCells(document, template, instance, check4, charge = () => {
92120
+ function masterStyleCells(document, template2, instance, check4, charge = () => {
91648
92121
  }, verifyMovementProtection = false) {
91649
92122
  const styles = /* @__PURE__ */ new Map();
91650
92123
  for (const container of children3(document, "StyleSheets"))
@@ -91679,7 +92152,7 @@ function masterStyleCells(document, template, instance, check4, charge = () => {
91679
92152
  };
91680
92153
  const result2 = /* @__PURE__ */ new Map();
91681
92154
  for (const category of ["LineStyle", "FillStyle", "TextStyle"]) {
91682
- const id4 = attribute3(instance, category) ?? attribute3(template, category) ?? attribute3(defaults, category) ?? (styles.has("0") ? "0" : void 0);
92155
+ const id4 = attribute3(instance, category) ?? attribute3(template2, category) ?? attribute3(defaults, category) ?? (styles.has("0") ? "0" : void 0);
91683
92156
  if (id4 !== void 0)
91684
92157
  for (const [name3, node4] of collect(id4, category)) {
91685
92158
  charge();
@@ -91795,14 +92268,14 @@ var templates2 = /* @__PURE__ */ new WeakMap();
91795
92268
  var topShapes = (root) => children3(children3(root, "Shapes")[0], "Shape");
91796
92269
  var deleted = (node4) => ["1", "true"].includes(attribute3(node4, "Del") ?? "");
91797
92270
  var plain4 = (shape2) => ["Shape", void 0].includes(attribute3(shape2, "Type")) && !children3(shape2, "Shapes").length && !children3(shape2, "ForeignData").length && !deleted(shape2);
91798
- async function registerStencilShapes(roots, template, check4) {
92271
+ async function registerStencilShapes(roots, template2, check4) {
91799
92272
  for (const root of roots.values())
91800
92273
  for (const shape2 of topShapes(root)) {
91801
92274
  const master2 = attribute3(shape2, "Master");
91802
92275
  if (master2 === void 0 || shape2.hasAttribute("MasterShape") || !plain4(shape2)) continue;
91803
92276
  check4();
91804
92277
  try {
91805
- const source3 = await template(master2);
92278
+ const source3 = await template2(master2);
91806
92279
  if (plain4(source3) && !source3.hasAttribute("Master") && !source3.hasAttribute("MasterShape"))
91807
92280
  templates2.set(shape2, source3);
91808
92281
  } catch (error62) {
@@ -91811,8 +92284,8 @@ async function registerStencilShapes(roots, template, check4) {
91811
92284
  }
91812
92285
  }
91813
92286
  var stencilTemplate = (shape2) => shape2 ? templates2.get(shape2) : void 0;
91814
- function registerStencilShape(shape2, template) {
91815
- templates2.set(shape2, template);
92287
+ function registerStencilShape(shape2, template2) {
92288
+ templates2.set(shape2, template2);
91816
92289
  }
91817
92290
  var cellMap = (parent) => new Map(children3(parent, "Cell").map((node4) => [attribute3(node4, "N") ?? "", node4]));
91818
92291
  function effectiveCells(shape2) {
@@ -91871,8 +92344,8 @@ var LOCAL_FORM = {
91871
92344
  Width: ["inh", "guard(endx-beginx)", "guard(0.25dl)"],
91872
92345
  Height: ["inh", "guard(endy-beginy)", "guard(0.25dl)"]
91873
92346
  };
91874
- function isDynamicConnectorMaster(template) {
91875
- const cells3 = cellMap(template);
92347
+ function isDynamicConnectorMaster(template2) {
92348
+ const cells3 = cellMap(template2);
91876
92349
  if (!END_CELLS.every((name3) => cells3.has(name3))) return false;
91877
92350
  if (!MASTER_FORM.every(
91878
92351
  ([name3, forms]) => forms.includes(normal(attribute3(cells3.get(name3), "F")) ?? "")
@@ -91882,7 +92355,7 @@ function isDynamicConnectorMaster(template) {
91882
92355
  const node4 = cells3.get(name3);
91883
92356
  if (node4 && Number(attribute3(node4, "V") ?? "0") !== 0) return false;
91884
92357
  }
91885
- const geometry2 = children3(template, "Section").filter(
92358
+ const geometry2 = children3(template2, "Section").filter(
91886
92359
  (node4) => attribute3(node4, "N") === "Geometry"
91887
92360
  );
91888
92361
  if (geometry2.length !== 1 || deleted(geometry2[0])) return false;
@@ -91891,7 +92364,7 @@ function isDynamicConnectorMaster(template) {
91891
92364
  (row3, index4) => attribute3(row3, "IX") !== String(index4 + 1) || deleted(row3) || index4 > 0 && attribute3(row3, "T") !== "LineTo" || children3(row3, "Cell").some((cell2) => executableCellFormula(attribute3(cell2, "F")))
91892
92365
  ))
91893
92366
  return false;
91894
- const control = sectionRows2(template, "Control").filter(
92367
+ const control = sectionRows2(template2, "Control").filter(
91895
92368
  (row3) => attribute3(row3, "N") === "TextPosition"
91896
92369
  );
91897
92370
  if (control.length !== 1) return false;
@@ -91899,14 +92372,14 @@ function isDynamicConnectorMaster(template) {
91899
92372
  return normal(attribute3(position3.get("XDyn"), "F")) === "controls.textposition" && normal(attribute3(position3.get("YDyn"), "F")) === "controls.textposition.y";
91900
92373
  }
91901
92374
  function isStencilConnector(shape2) {
91902
- const template = stencilTemplate(shape2);
91903
- return !!template && END_CELLS.some((name3) => cellMap(template).has(name3));
92375
+ const template2 = stencilTemplate(shape2);
92376
+ return !!template2 && END_CELLS.some((name3) => cellMap(template2).has(name3));
91904
92377
  }
91905
92378
  var STENCIL_CONNECTOR_FORM = "This connector comes from a stencil and is not built like Visio's Dynamic connector, so it cannot be rerouted here; it and the shapes glued to it cannot be moved or resized.";
91906
92379
  function proveStencilConnector(shape2) {
91907
- const template = stencilTemplate(shape2);
92380
+ const template2 = stencilTemplate(shape2);
91908
92381
  const refuse4 = () => fail3("UNSUPPORTED_GEOMETRY_EDIT", STENCIL_CONNECTOR_FORM);
91909
- if (!template || !isDynamicConnectorMaster(template)) return refuse4();
92382
+ if (!template2 || !isDynamicConnectorMaster(template2)) return refuse4();
91910
92383
  const local = cellMap(shape2);
91911
92384
  for (const [name3, forms] of Object.entries(LOCAL_FORM)) {
91912
92385
  const node4 = local.get(name3);
@@ -91925,7 +92398,7 @@ function proveStencilConnector(shape2) {
91925
92398
  if (attribute3(row3, "N") !== "TextPosition" || deleted(row3)) refuse4();
91926
92399
  }
91927
92400
  }
91928
- return template;
92401
+ return template2;
91929
92402
  }
91930
92403
  function stencilConnectorRoute(shape2) {
91931
92404
  const cells3 = effectiveCells(shape2);
@@ -91968,8 +92441,8 @@ function unique3(items, key2, what) {
91968
92441
  return result2;
91969
92442
  }
91970
92443
  var cellMap2 = (parent) => unique3(children3(parent, "Cell"), (cell2) => attribute3(cell2, "N") ?? "", "cell");
91971
- function instanceSheet(instance, template, options2 = {}) {
91972
- for (const node4 of [instance, template]) {
92444
+ function instanceSheet(instance, template2, options2 = {}) {
92445
+ for (const node4 of [instance, template2]) {
91973
92446
  const type = attribute3(node4, "Type");
91974
92447
  if (!(options2.group ? ["Shape", "Group", void 0] : ["Shape", void 0]).includes(type) || !options2.group && children3(node4, "Shapes").length > 0 || children3(node4, "ForeignData").length || deleted2(node4))
91975
92448
  fail3(
@@ -91977,11 +92450,11 @@ function instanceSheet(instance, template, options2 = {}) {
91977
92450
  options2.group ? "A stencil shape that holds a picture or a deleted part cannot be changed." : "Only stencil shapes made of one plain shape can be changed; grouped, picture and deleted ones cannot."
91978
92451
  );
91979
92452
  }
91980
- if (template.hasAttribute("Master") || template.hasAttribute("MasterShape"))
92453
+ if (template2.hasAttribute("Master") || template2.hasAttribute("MasterShape"))
91981
92454
  fail3("UNSUPPORTED_INSTANCE_EDIT", "The master of this stencil shape inherits another master.");
91982
92455
  const cells3 = [];
91983
92456
  const localCells = cellMap2(instance);
91984
- const masterCells2 = cellMap2(template);
92457
+ const masterCells2 = cellMap2(template2);
91985
92458
  for (const name3 of /* @__PURE__ */ new Set([...masterCells2.keys(), ...localCells.keys()])) {
91986
92459
  const local = localCells.get(name3), inherited = masterCells2.get(name3);
91987
92460
  cells3.push({
@@ -91993,7 +92466,7 @@ function instanceSheet(instance, template, options2 = {}) {
91993
92466
  });
91994
92467
  }
91995
92468
  const sections2 = (shape2) => unique3(children3(shape2, "Section"), sectionKey, "section");
91996
- const localSections = sections2(instance), masterSections = sections2(template);
92469
+ const localSections = sections2(instance), masterSections = sections2(template2);
91997
92470
  for (const key2 of /* @__PURE__ */ new Set([...masterSections.keys(), ...localSections.keys()])) {
91998
92471
  const localSection = localSections.get(key2), masterSection = masterSections.get(key2);
91999
92472
  const section3 = masterSection ?? localSection;
@@ -92044,7 +92517,7 @@ function instanceSheet(instance, template, options2 = {}) {
92044
92517
  const byName2 = /* @__PURE__ */ new Map();
92045
92518
  for (const cell2 of cells3)
92046
92519
  for (const name3 of cell2.names) if (!byName2.has(name3)) byName2.set(name3, cell2);
92047
- return { instance, template, cells: cells3, byName: byName2 };
92520
+ return { instance, template: template2, cells: cells3, byName: byName2 };
92048
92521
  }
92049
92522
  var effectiveNode = (cell2) => cell2.local?.hasAttribute("V") || !cell2.inherited ? cell2.local : cell2.inherited;
92050
92523
  function effectiveFormula(cell2) {
@@ -92105,7 +92578,7 @@ function writeInstanceCell(sheet2, cell2, value3, options2 = {}) {
92105
92578
  else node4.removeAttribute("F");
92106
92579
  return node4;
92107
92580
  }
92108
- async function instanceTarget(root, shapeId2, template, code = "UNSUPPORTED_INSTANCE_EDIT") {
92581
+ async function instanceTarget(root, shapeId2, template2, code = "UNSUPPORTED_INSTANCE_EDIT") {
92109
92582
  const containers = children3(root, "Shapes");
92110
92583
  if (containers.length !== 1) return void 0;
92111
92584
  const candidates = children3(containers[0], "Shape").filter(
@@ -92115,7 +92588,7 @@ async function instanceTarget(root, shapeId2, template, code = "UNSUPPORTED_INST
92115
92588
  const masterId = instance && attribute3(instance, "Master");
92116
92589
  if (!instance || masterId === void 0) return void 0;
92117
92590
  try {
92118
- return { instance, template: await template(masterId) };
92591
+ return { instance, template: await template2(masterId) };
92119
92592
  } catch (error62) {
92120
92593
  if (error62 instanceof VisioPackageError && error62.code === "UNSUPPORTED_TEXT_EDIT")
92121
92594
  fail3(code, error62.message);
@@ -92194,11 +92667,11 @@ function singleScope(sheet2) {
92194
92667
  }
92195
92668
  var members = (shape2) => children3(shape2, "Shapes").flatMap((container) => children3(container, "Shape"));
92196
92669
  var isGroupInstance = (instance) => attribute3(instance, "Type") === "Group" || members(instance).length > 0;
92197
- async function groupScope(instance, template, code = "UNSUPPORTED_INSTANCE_EDIT") {
92670
+ async function groupScope(instance, template2, code = "UNSUPPORTED_INSTANCE_EDIT") {
92198
92671
  const masterId = attribute3(instance, "Master");
92199
92672
  const resolved = async (masterShapeId) => {
92200
92673
  try {
92201
- return await template(masterId, masterShapeId);
92674
+ return await template2(masterId, masterShapeId);
92202
92675
  } catch (error62) {
92203
92676
  if (error62 instanceof VisioPackageError && error62.code === "UNSUPPORTED_TEXT_EDIT")
92204
92677
  return void 0;
@@ -92241,13 +92714,13 @@ async function groupScope(instance, template, code = "UNSUPPORTED_INSTANCE_EDIT"
92241
92714
  }
92242
92715
  return scopeOf(sheets, byMaster);
92243
92716
  }
92244
- async function instanceScope(root, shapeId2, template, code = "UNSUPPORTED_INSTANCE_EDIT") {
92717
+ async function instanceScope(root, shapeId2, template2, code = "UNSUPPORTED_INSTANCE_EDIT") {
92245
92718
  const containers = children3(root, "Shapes");
92246
92719
  const candidates = containers.length === 1 ? children3(containers[0], "Shape").filter((shape2) => attribute3(shape2, "ID") === shapeId2) : [];
92247
92720
  const instance = candidates.length === 1 ? candidates[0] : void 0;
92248
92721
  if (!instance || !instance.hasAttribute("Master")) return void 0;
92249
- if (isGroupInstance(instance)) return groupScope(instance, template, code);
92250
- const target3 = await instanceTarget(root, shapeId2, template, code);
92722
+ if (isGroupInstance(instance)) return groupScope(instance, template2, code);
92723
+ const target3 = await instanceTarget(root, shapeId2, template2, code);
92251
92724
  return target3 && singleScope(instanceSheet(target3.instance, target3.template));
92252
92725
  }
92253
92726
 
@@ -93569,7 +94042,7 @@ var drop = (shape2, node4) => {
93569
94042
  if (!node4.childNodes.length && node4.parentNode === shape2) shape2.removeChild(node4);
93570
94043
  };
93571
94044
  function writeStencilConnector(shape2, route, vertices) {
93572
- const template = proveStencilConnector(shape2);
94045
+ const template2 = proveStencilConnector(shape2);
93573
94046
  const effective = effectiveCells(shape2);
93574
94047
  for (const [name3, allowed] of [
93575
94048
  ["ShapeRouteStyle", [0, 1, 16]],
@@ -93586,19 +94059,19 @@ function writeStencilConnector(shape2, route, vertices) {
93586
94059
  const dx = end.x - begin.x, dy = end.y - begin.y;
93587
94060
  const flatX = Math.abs(dx) < FLAT - EPSILON4, flatY = Math.abs(dy) < FLAT - EPSILON4;
93588
94061
  const width = flatX ? FLAT : dx, height = flatY ? FLAT : dy;
93589
- put(shape2, template, "PinX", (begin.x + end.x) / 2, "Inh");
93590
- put(shape2, template, "PinY", (begin.y + end.y) / 2, "Inh");
94062
+ put(shape2, template2, "PinX", (begin.x + end.x) / 2, "Inh");
94063
+ put(shape2, template2, "PinY", (begin.y + end.y) / 2, "Inh");
93591
94064
  put(shape2, void 0, "Width", width, flatX ? "GUARD(0.25DL)" : "GUARD(EndX-BeginX)");
93592
94065
  put(shape2, void 0, "Height", height, flatY ? "GUARD(0.25DL)" : "GUARD(EndY-BeginY)");
93593
- put(shape2, template, "LocPinX", width / 2, "Inh");
93594
- put(shape2, template, "LocPinY", height / 2, "Inh");
94066
+ put(shape2, template2, "LocPinX", width / 2, "Inh");
94067
+ put(shape2, template2, "LocPinY", height / 2, "Inh");
93595
94068
  for (const [name3, value3] of [
93596
94069
  ["BeginX", begin.x],
93597
94070
  ["BeginY", begin.y],
93598
94071
  ["EndX", end.x],
93599
94072
  ["EndY", end.y]
93600
94073
  ])
93601
- put(shape2, template, name3, value3);
94074
+ put(shape2, template2, name3, value3);
93602
94075
  const at3 = (point3) => ({
93603
94076
  x: point3.x - (begin.x + end.x) / 2 + width / 2,
93604
94077
  y: point3.y - (begin.y + end.y) / 2 + height / 2
@@ -93606,7 +94079,7 @@ function writeStencilConnector(shape2, route, vertices) {
93606
94079
  const curved2 = route === "curved" && (vertices.length === 5 || !flatX && !flatY && vertices.length === 4);
93607
94080
  const local = (curved2 || route !== "curved" ? vertices : [begin, end]).map(at3);
93608
94081
  const [internalKnot, lastKnot] = local.length === 5 ? cornerCurveKnots(local) : [0, 1];
93609
- const masterGeometry = children3(template, "Section").find(
94082
+ const masterGeometry = children3(template2, "Section").find(
93610
94083
  (item2) => attribute3(item2, "N") === "Geometry"
93611
94084
  );
93612
94085
  const masterRows = children3(masterGeometry, "Row");
@@ -93676,7 +94149,7 @@ function writeStencilConnector(shape2, route, vertices) {
93676
94149
  }
93677
94150
  drop(shape2, geometry2);
93678
94151
  const middle = curved2 ? connectorCurveMiddle(local) : connectorPolylineMiddle(local);
93679
- const masterControl = children3(template, "Section").filter((item2) => attribute3(item2, "N") === "Control").flatMap((item2) => children3(item2, "Row")).find((row3) => attribute3(row3, "N") === "TextPosition");
94152
+ const masterControl = children3(template2, "Section").filter((item2) => attribute3(item2, "N") === "Control").flatMap((item2) => children3(item2, "Row")).find((row3) => attribute3(row3, "N") === "TextPosition");
93680
94153
  const control = section(shape2, "Control");
93681
94154
  let position3 = children3(control, "Row").find((row3) => attribute3(row3, "N") === "TextPosition");
93682
94155
  if (!position3) {
@@ -93690,8 +94163,8 @@ function writeStencilConnector(shape2, route, vertices) {
93690
94163
  put(position3, masterControl, "YDyn", middle.y, "Inh");
93691
94164
  drop(control, position3);
93692
94165
  drop(shape2, control);
93693
- put(shape2, template, "TxtPinX", middle.x, "Inh");
93694
- put(shape2, template, "TxtPinY", middle.y, "Inh");
94166
+ put(shape2, template2, "TxtPinX", middle.x, "Inh");
94167
+ put(shape2, template2, "TxtPinY", middle.y, "Inh");
93695
94168
  }
93696
94169
 
93697
94170
  // visio/edit-stencil-connector-layout.ts
@@ -93751,15 +94224,15 @@ var format = (value3) => String(Object.is(value3, -0) ? 0 : value3);
93751
94224
  var near = (a2, b) => Math.abs(a2 - b) <= 1e-9 * Math.max(1, Math.abs(a2), Math.abs(b));
93752
94225
  var NAMES3 = { begin: ["BeginX", "BeginY"], end: ["EndX", "EndY"] };
93753
94226
  function isStencilLine(shape2) {
93754
- const template = stencilTemplate(shape2);
93755
- return !!shape2 && !!template && isStencilConnector(shape2) && !isDynamicConnectorMaster(template);
94227
+ const template2 = stencilTemplate(shape2);
94228
+ return !!shape2 && !!template2 && isStencilConnector(shape2) && !isDynamicConnectorMaster(template2);
93756
94229
  }
93757
94230
  function proveStencilLine(shape2) {
93758
- const template = stencilTemplate(shape2);
93759
- if (!template) return refuse();
94231
+ const template2 = stencilTemplate(shape2);
94232
+ if (!template2) return refuse();
93760
94233
  let sheet2;
93761
94234
  try {
93762
- sheet2 = instanceSheet(shape2, template);
94235
+ sheet2 = instanceSheet(shape2, template2);
93763
94236
  } catch (error62) {
93764
94237
  if (error62 instanceof VisioPackageError && error62.code === "UNSUPPORTED_INSTANCE_EDIT")
93765
94238
  return refuse();
@@ -94662,11 +95135,11 @@ function measures(shape2) {
94662
95135
  }
94663
95136
  return false;
94664
95137
  }
94665
- async function measuresOwnText(root, shapeId2, template, check4) {
95138
+ async function measuresOwnText(root, shapeId2, template2, check4) {
94666
95139
  try {
94667
95140
  const found = textTarget(root, shapeId2, check4);
94668
95141
  if (measures(found.node)) return true;
94669
- return found.masterId !== void 0 && measures(await template(found.masterId, found.masterShapeId));
95142
+ return found.masterId !== void 0 && measures(await template2(found.masterId, found.masterShapeId));
94670
95143
  } catch (error62) {
94671
95144
  if (!(error62 instanceof VisioPackageError) || error62.code.startsWith("LIMIT_")) throw error62;
94672
95145
  return false;
@@ -94687,7 +95160,7 @@ async function refreshTextSizes(targets, result2, options2, deadline) {
94687
95160
  let resized = 0;
94688
95161
  try {
94689
95162
  const { pkg, parts, pages } = await openEditablePackage(result2.bytes, limits, check4);
94690
- const template = masterTemplate(pkg);
95163
+ const template2 = masterTemplate(pkg);
94691
95164
  const roots = /* @__PURE__ */ new Map();
94692
95165
  for (const [pageId2, path4] of pages) {
94693
95166
  const source3 = await visioXml(pkg, path4, "PageContents");
@@ -94703,7 +95176,7 @@ async function refreshTextSizes(targets, result2, options2, deadline) {
94703
95176
  const trial = new Map(roots).set(target3.pageId, copy8);
94704
95177
  try {
94705
95178
  const found = textTarget(copy8, target3.shapeId, check4);
94706
- const master2 = found.masterId === void 0 ? void 0 : await template(found.masterId, found.masterShapeId);
95179
+ const master2 = found.masterId === void 0 ? void 0 : await template2(found.masterId, found.masterShapeId);
94707
95180
  if (!measures(found.node) && !(master2 && measures(master2))) continue;
94708
95181
  const sheet2 = instanceSheet(
94709
95182
  found.node,
@@ -95051,7 +95524,7 @@ async function refreshLineJumpCaches(pageIds2, source3, result2, options2, deadl
95051
95524
  const { pkg, parts, pages } = await openEditablePackage(result2.bytes, limits, check4);
95052
95525
  const model2 = await parseVsdx(result2.bytes, { limits });
95053
95526
  const before = source3 ? await parseVsdx(source3, { limits }) : void 0;
95054
- const template = masterTemplate(pkg);
95527
+ const template2 = masterTemplate(pkg);
95055
95528
  const changed = new Set(result2.changedParts);
95056
95529
  const kept = [];
95057
95530
  let referenced = false;
@@ -95090,7 +95563,7 @@ async function refreshLineJumpCaches(pageIds2, source3, result2, options2, deadl
95090
95563
  const indices = /* @__PURE__ */ new Map();
95091
95564
  const masterId = attribute3(target3, "Master");
95092
95565
  if (masterId) {
95093
- const master2 = await template(masterId, attribute3(target3, "MasterShape"));
95566
+ const master2 = await template2(masterId, attribute3(target3, "MasterShape"));
95094
95567
  const base3 = children3(master2, "Section").find(
95095
95568
  (node4) => attribute3(node4, "N") === "Geometry" && attribute3(node4, "IX") === attribute3(section3, "IX")
95096
95569
  );
@@ -95241,10 +95714,10 @@ function followConnectors(roots, pageId2, shapeId2, check4) {
95241
95714
  return [...pages];
95242
95715
  }
95243
95716
  var format3 = (value3) => String(Object.is(value3, -0) ? 0 : value3);
95244
- async function applyInstanceGeometryEdit(roots, edit2, template, check4) {
95717
+ async function applyInstanceGeometryEdit(roots, edit2, template2, check4) {
95245
95718
  const root = roots.get(edit2.pageId);
95246
95719
  if (!root) fail3("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
95247
- const scope = await instanceScope(root, edit2.shapeId, template);
95720
+ const scope = await instanceScope(root, edit2.shapeId, template2);
95248
95721
  if (!scope) fail3("EDIT_TARGET_NOT_FOUND", "A unique top-level stencil shape is required.");
95249
95722
  check4();
95250
95723
  const sheet2 = scope.root;
@@ -95418,7 +95891,7 @@ function overlayCells(base3, local) {
95418
95891
  }
95419
95892
  var MAX_MEMBERS3 = 2e3;
95420
95893
  var members2 = (shape2) => children3(shape2, "Shapes").flatMap((container) => children3(container, "Shape"));
95421
- async function formattingInstances(root, shapeId2, template) {
95894
+ async function formattingInstances(root, shapeId2, template2) {
95422
95895
  let found;
95423
95896
  const pending2 = members2(root).map((node4) => ({ node: node4, masterId: attribute3(node4, "Master") }));
95424
95897
  for (let count3 = 0; pending2.length; ) {
@@ -95435,13 +95908,13 @@ async function formattingInstances(root, shapeId2, template) {
95435
95908
  if (!found) return void 0;
95436
95909
  const top = found.node.hasAttribute("Master");
95437
95910
  if (top && !isGroupInstance(found.node)) {
95438
- const single3 = await formattingInstance(root, shapeId2, template);
95911
+ const single3 = await formattingInstance(root, shapeId2, template2);
95439
95912
  return single3 && [single3];
95440
95913
  }
95441
95914
  const masterId = found.masterId;
95442
95915
  const resolved = async (masterShapeId) => {
95443
95916
  try {
95444
- return await template(masterId, masterShapeId);
95917
+ return await template2(masterId, masterShapeId);
95445
95918
  } catch (error62) {
95446
95919
  if (error62 instanceof VisioPackageError && error62.code === "UNSUPPORTED_TEXT_EDIT")
95447
95920
  return void 0;
@@ -95466,8 +95939,8 @@ async function formattingInstances(root, shapeId2, template) {
95466
95939
  }
95467
95940
  return result2;
95468
95941
  }
95469
- async function formattingInstance(root, shapeId2, template) {
95470
- const target3 = await instanceTarget(root, shapeId2, template, "UNSUPPORTED_FORMAT_EDIT");
95942
+ async function formattingInstance(root, shapeId2, template2) {
95943
+ const target3 = await instanceTarget(root, shapeId2, template2, "UNSUPPORTED_FORMAT_EDIT");
95471
95944
  if (!target3) return void 0;
95472
95945
  return formattingView(target3, false);
95473
95946
  }
@@ -95709,14 +96182,14 @@ function reorderVisioShape(root, document, edit2, check4, views = /* @__PURE__ *
95709
96182
  // visio/edit-instance-shape.ts
95710
96183
  var deleted3 = (node4) => ["1", "true"].includes(attribute3(node4, "Del") ?? "");
95711
96184
  var pageShapes = (root) => children3(root, "Shapes").flatMap((container) => children3(container, "Shape"));
95712
- async function stencilInstance(root, shapeId2, template, code = "UNSUPPORTED_INSTANCE_EDIT") {
96185
+ async function stencilInstance(root, shapeId2, template2, code = "UNSUPPORTED_INSTANCE_EDIT") {
95713
96186
  const matches3 = pageShapes(root).filter((shape2) => attribute3(shape2, "ID") === shapeId2);
95714
96187
  const instance = matches3.length === 1 ? matches3[0] : void 0;
95715
96188
  const masterId = instance && attribute3(instance, "Master");
95716
96189
  if (!instance || masterId === void 0) return void 0;
95717
96190
  if (deleted3(instance)) fail3(code, "The stencil shape is deleted.");
95718
96191
  try {
95719
- return { instance, template: await template(masterId) };
96192
+ return { instance, template: await template2(masterId) };
95720
96193
  } catch (error62) {
95721
96194
  if (error62 instanceof VisioPackageError && error62.code === "UNSUPPORTED_TEXT_EDIT")
95722
96195
  fail3(code, error62.message);
@@ -95781,12 +96254,12 @@ async function assertInstanceLayerUnlocked(pkg, root, pageId2, shapeId2) {
95781
96254
  attribute3(cellNamed(shape2, "LayerMember"), "V")
95782
96255
  );
95783
96256
  }
95784
- async function shapeIsStructural(shape2, template) {
96257
+ async function shapeIsStructural(shape2, template2) {
95785
96258
  if (isStructureSheet(shape2)) return true;
95786
96259
  const masterId = attribute3(shape2, "Master");
95787
96260
  if (masterId === void 0) return false;
95788
96261
  try {
95789
- return isStructureSheet(await template(masterId));
96262
+ return isStructureSheet(await template2(masterId));
95790
96263
  } catch {
95791
96264
  return true;
95792
96265
  }
@@ -95874,12 +96347,12 @@ function instancePin(target3) {
95874
96347
  }
95875
96348
 
95876
96349
  // visio/edit-instance-delete.ts
95877
- async function admitInstanceDeletes(pkg, roots, edits2, template, check4) {
96350
+ async function admitInstanceDeletes(pkg, roots, edits2, template2, check4) {
95878
96351
  const admitted4 = /* @__PURE__ */ new Set();
95879
96352
  for (const edit2 of edits2) {
95880
96353
  check4();
95881
96354
  const root = roots.get(edit2.pageId);
95882
- const target3 = root && await stencilInstance(root, edit2.shapeId, template);
96355
+ const target3 = root && await stencilInstance(root, edit2.shapeId, template2);
95883
96356
  if (!target3) continue;
95884
96357
  await assertInstanceUnlocked(pkg, edit2.pageId, target3, ["LockDelete"], "deletion");
95885
96358
  admitted4.add(target3.instance);
@@ -96044,13 +96517,13 @@ var TRANSFORM2 = [
96044
96517
  "FlipX",
96045
96518
  "FlipY"
96046
96519
  ];
96047
- async function prove(pkg, pageId2, instance, template, regroup) {
96520
+ async function prove(pkg, pageId2, instance, template2, regroup) {
96048
96521
  const refuse4 = (message) => fail3("UNSUPPORTED_GROUP_EDIT", message);
96049
96522
  if (["1", "true"].includes(attribute3(instance, "Del") ?? ""))
96050
96523
  refuse4("A stencil shape is deleted.");
96051
96524
  let master2;
96052
96525
  try {
96053
- master2 = await template(attribute3(instance, "Master"));
96526
+ master2 = await template2(attribute3(instance, "Master"));
96054
96527
  } catch (error62) {
96055
96528
  if (!(error62 instanceof VisioPackageError) || error62.code.startsWith("LIMIT_")) throw error62;
96056
96529
  return refuse4("The master of a stencil shape cannot be resolved.");
@@ -96091,7 +96564,7 @@ function instancesIn(top) {
96091
96564
  }
96092
96565
  return found;
96093
96566
  }
96094
- async function groupInstances(pkg, roots, commands, template, check4) {
96567
+ async function groupInstances(pkg, roots, commands, template2, check4) {
96095
96568
  const result2 = /* @__PURE__ */ new Map();
96096
96569
  for (const command2 of commands) {
96097
96570
  check4();
@@ -96107,7 +96580,7 @@ async function groupInstances(pkg, roots, commands, template, check4) {
96107
96580
  const regroup = grouping || command2.type === "ungroup-shape";
96108
96581
  for (const instance of instances)
96109
96582
  if (!result2.has(instance))
96110
- result2.set(instance, await prove(pkg, command2.pageId, instance, template, regroup));
96583
+ result2.set(instance, await prove(pkg, command2.pageId, instance, template2, regroup));
96111
96584
  }
96112
96585
  }
96113
96586
  return result2;
@@ -96226,8 +96699,8 @@ async function linkPage(pkg, parts, pagePath, masterPart, limits, check4) {
96226
96699
  fail3("LIMIT_ENTRIES", "The edit exceeds the package entry limit.");
96227
96700
  parts.set(relsPart, serializeEditedXml(rels, limits, check4).bytes);
96228
96701
  }
96229
- async function replaceInstanceMaster(pkg, parts, pagePath, root, edit2, template, limits, check4) {
96230
- const target3 = await stencilInstance(root, edit2.shapeId, template, "UNSUPPORTED_CHANGE_SHAPE");
96702
+ async function replaceInstanceMaster(pkg, parts, pagePath, root, edit2, template2, limits, check4) {
96703
+ const target3 = await stencilInstance(root, edit2.shapeId, template2, "UNSUPPORTED_CHANGE_SHAPE");
96231
96704
  if (!target3) return refuse2("Only a stencil shape can take another master.");
96232
96705
  const { instance } = target3;
96233
96706
  if (attribute3(instance, "Master") === edit2.masterId) return false;
@@ -96235,7 +96708,7 @@ async function replaceInstanceMaster(pkg, parts, pagePath, root, edit2, template
96235
96708
  let before, replacement;
96236
96709
  try {
96237
96710
  before = instanceSheet(instance, target3.template);
96238
- replacement = await template(edit2.masterId);
96711
+ replacement = await template2(edit2.masterId);
96239
96712
  } catch (error62) {
96240
96713
  if (!(error62 instanceof VisioPackageError) || error62.code.startsWith("LIMIT_")) throw error62;
96241
96714
  return refuse2("Only shapes of a master made of one plain shape can change master.");
@@ -96319,24 +96792,24 @@ async function replaceInstanceMaster(pkg, parts, pagePath, root, edit2, template
96319
96792
  }
96320
96793
 
96321
96794
  // visio/edit-instance-order.ts
96322
- async function orderTargetsAreStructural(roots, commands, template) {
96795
+ async function orderTargetsAreStructural(roots, commands, template2) {
96323
96796
  for (const command2 of commands) {
96324
96797
  const ids = command2.type === "reorder-shape" || command2.type === "ungroup-shape" ? [command2.shapeId] : command2.type === "group-shapes" ? command2.memberIds : [];
96325
96798
  const root = ids.length && "pageId" in command2 ? roots.get(command2.pageId) : void 0;
96326
96799
  for (const id4 of ids) {
96327
96800
  const shape2 = root && pageShapes(root).find((item2) => attribute3(item2, "ID") === id4);
96328
- if (!shape2 || await shapeIsStructural(shape2, template)) return true;
96801
+ if (!shape2 || await shapeIsStructural(shape2, template2)) return true;
96329
96802
  }
96330
96803
  }
96331
96804
  return false;
96332
96805
  }
96333
- async function instanceOrderViews(pkg, pageId2, root, shapeId2, template, check4) {
96806
+ async function instanceOrderViews(pkg, pageId2, root, shapeId2, template2, check4) {
96334
96807
  const views = /* @__PURE__ */ new Map();
96335
96808
  for (const shape2 of pageShapes(root)) {
96336
96809
  check4();
96337
96810
  const id4 = attribute3(shape2, "ID");
96338
96811
  if (id4 === void 0 || !shape2.hasAttribute("Master")) continue;
96339
- const target3 = await stencilInstance(root, id4, template, "UNSUPPORTED_SHAPE_ORDER");
96812
+ const target3 = await stencilInstance(root, id4, template2, "UNSUPPORTED_SHAPE_ORDER");
96340
96813
  if (!target3) continue;
96341
96814
  if (id4 === shapeId2) await assertInstanceUnlocked(pkg, pageId2, target3, [], "reordering");
96342
96815
  views.set(shape2, instanceView(target3, ["DisplayLevel", "LockSelect", "LockFormat"]));
@@ -97523,7 +97996,7 @@ var VISIO_DEFAULT_TITLE = "Title";
97523
97996
  var ACCENT = { background: "Background Accent", border: "Border Accent" };
97524
97997
  function visioShade(color4, amount) {
97525
97998
  const value3 = Number.parseInt(color4.slice(1), 16);
97526
- const channel = (shift3) => Math.round((value3 >> shift3 & 255) * (1 - amount)).toString(16).padStart(2, "0");
97999
+ const channel = (shift4) => Math.round((value3 >> shift4 & 255) * (1 - amount)).toString(16).padStart(2, "0");
97527
98000
  return `#${channel(16)}${channel(8)}${channel(0)}`.toUpperCase();
97528
98001
  }
97529
98002
  function visioDecorationName(name3) {
@@ -101099,32 +101572,32 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check4) {
101099
101572
  if (byTemplate.has(id4)) problem("MasterShape mappings are ambiguous.");
101100
101573
  byTemplate.set(id4, local);
101101
101574
  }
101102
- for (const template of templates3) {
101575
+ for (const template2 of templates3) {
101103
101576
  charge();
101104
101577
  if (bindings.length >= 1e4) problem("Master effective binding limit exceeded.");
101105
101578
  check4();
101106
- if (template.hasAttribute("Master") || template.hasAttribute("MasterShape"))
101579
+ if (template2.hasAttribute("Master") || template2.hasAttribute("MasterShape"))
101107
101580
  problem("Chained master definitions are unsupported.");
101108
- const templateId = attribute3(template, "ID");
101581
+ const templateId = attribute3(template2, "ID");
101109
101582
  if (!templateId || context.has(templateId)) problem("Master-local sheet IDs are ambiguous.");
101110
101583
  const local = byTemplate.get(templateId), cells3 = /* @__PURE__ */ new Map();
101111
101584
  const movedInstance = local === instance && movingTargets.has(JSON.stringify([pageId2, attribute3(local, "ID")]));
101112
101585
  for (const [name3, node4] of masterStyleCells(
101113
101586
  document,
101114
- template,
101587
+ template2,
101115
101588
  local,
101116
101589
  check4,
101117
101590
  charge,
101118
101591
  movedInstance
101119
101592
  ))
101120
101593
  cells3.set(name3, { node: node4, kind: "style" });
101121
- overlay(cells3, masterCells(template, charge), "template", charge);
101594
+ overlay(cells3, masterCells(template2, charge), "template", charge);
101122
101595
  const inheritedCells = new Map(cells3);
101123
101596
  overlay(cells3, masterCells(local, charge), "instance", charge);
101124
101597
  const binding = {
101125
101598
  id: `${pageId2}:${attribute3(instance, "ID")}:${templateId}`,
101126
101599
  pageId: pageId2,
101127
- template,
101600
+ template: template2,
101128
101601
  cells: cells3,
101129
101602
  inheritedCells,
101130
101603
  context,
@@ -103013,7 +103486,7 @@ function planLineCopy(shape2, code = "UNSUPPORTED_DUPLICATE") {
103013
103486
  const local = cells(shape2);
103014
103487
  return { x: numeric4(local.get("PinX")), y: numeric4(local.get("PinY")) };
103015
103488
  }
103016
- var shift2 = (node4, delta, name3) => {
103489
+ var shift3 = (node4, delta, name3) => {
103017
103490
  if (!node4) fail3("UNSUPPORTED_DUPLICATE", `The line has no local ${name3}.`);
103018
103491
  const value3 = numeric4(node4);
103019
103492
  node4.setAttribute("V", String(Object.is(value3 + delta, -0) ? 0 : value3 + delta));
@@ -103025,10 +103498,10 @@ function finishLineCopy(shape2, dx, dy) {
103025
103498
  const node4 = local.get(name3);
103026
103499
  const formula2 = executableCellFormula(attribute3(node4, "F"));
103027
103500
  if (formula2 && isNativeGlueCell(name3, formula2)) node4.removeAttribute("F");
103028
- shift2(node4, name3.endsWith("X") ? dx : dy, name3);
103501
+ shift3(node4, name3.endsWith("X") ? dx : dy, name3);
103029
103502
  }
103030
- shift2(local.get("PinX"), dx, "PinX");
103031
- shift2(local.get("PinY"), dy, "PinY");
103503
+ shift3(local.get("PinX"), dx, "PinX");
103504
+ shift3(local.get("PinY"), dy, "PinY");
103032
103505
  }
103033
103506
  var isStencilConnector2 = (target3) => ENDS2.some((name3) => instanceCell(target3, name3));
103034
103507
  function planConnectorCopy(target3, code = "UNSUPPORTED_DUPLICATE") {
@@ -103044,9 +103517,9 @@ function planConnectorCopy(target3, code = "UNSUPPORTED_DUPLICATE") {
103044
103517
  }
103045
103518
  function finishConnectorCopy(shape2, id4, dx, dy) {
103046
103519
  const local = cells(shape2);
103047
- for (const name3 of ENDS2) shift2(local.get(name3), name3.endsWith("X") ? dx : dy, name3);
103048
- shift2(local.get("PinX"), dx, "PinX");
103049
- shift2(local.get("PinY"), dy, "PinY");
103520
+ for (const name3 of ENDS2) shift3(local.get(name3), name3.endsWith("X") ? dx : dy, name3);
103521
+ shift3(local.get("PinX"), dx, "PinX");
103522
+ shift3(local.get("PinY"), dy, "PinY");
103050
103523
  for (const name3 of ["BegTrigger", "EndTrigger"]) {
103051
103524
  const node4 = local.get(name3);
103052
103525
  if (!node4) continue;
@@ -103103,7 +103576,7 @@ async function planInstanceCopy(pkg, pageId2, sourceRoot, target3, offsetX, offs
103103
103576
  fail3(code, "Duplicated pins exceed coordinate limits.");
103104
103577
  return { x, y, connector: connector2 };
103105
103578
  }
103106
- function finishInstanceCopy(clone3, template, x, y, taken, check4) {
103579
+ function finishInstanceCopy(clone3, template2, x, y, taken, check4) {
103107
103580
  const mapping = /* @__PURE__ */ new Map();
103108
103581
  let next = 0;
103109
103582
  for (const id4 of taken) next = Math.max(next, Number(id4) || 0);
@@ -103141,7 +103614,7 @@ function finishInstanceCopy(clone3, template, x, y, taken, check4) {
103141
103614
  )
103142
103615
  );
103143
103616
  }
103144
- placeInstance({ instance: clone3, template }, x, y, check4);
103617
+ placeInstance({ instance: clone3, template: template2 }, x, y, check4);
103145
103618
  return [...mapping.values()];
103146
103619
  }
103147
103620
 
@@ -103178,11 +103651,11 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit2, chec
103178
103651
  fail3("INVALID_SHAPE_ID", "Duplicate shape ID already exists.");
103179
103652
  const sourceRoot = detached?.root ?? root;
103180
103653
  const sourcePageId = detached?.pageId ?? edit2.pageId;
103181
- const template = masterTemplate(pkg);
103654
+ const template2 = masterTemplate(pkg);
103182
103655
  let structural = false;
103183
103656
  for (const copy8 of edit2.copies) {
103184
103657
  const source3 = pageShapes(sourceRoot).find((shape2) => attribute3(shape2, "ID") === copy8.shapeId);
103185
- structural ||= !source3 || await shapeIsStructural(source3, template);
103658
+ structural ||= !source3 || await shapeIsStructural(source3, template2);
103186
103659
  }
103187
103660
  await assertDuplicateScope(pkg, pagePaths, root, newIds, check4, structural);
103188
103661
  const glueTargets = new Set(
@@ -103223,7 +103696,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit2, chec
103223
103696
  const stencil = await stencilInstance(
103224
103697
  sourceRoot,
103225
103698
  copy8.shapeId,
103226
- template,
103699
+ template2,
103227
103700
  "UNSUPPORTED_DUPLICATE"
103228
103701
  );
103229
103702
  if (stencil) {
@@ -103973,10 +104446,10 @@ async function applyShapeAltText(pkg, pagePaths, roots, edit2, check4) {
103973
104446
  if (/^visio\/.*\.xml$/i.test(path4) && !pagePaths.has(path4)) inspect3(await pkg.readXml(path4));
103974
104447
  }
103975
104448
  if (target3.masterId !== void 0) {
103976
- const template = await masterTemplate(pkg)(target3.masterId, target3.masterShapeId);
103977
- if (template.hasAttribute("Master") || template.hasAttribute("MasterShape"))
104449
+ const template2 = await masterTemplate(pkg)(target3.masterId, target3.masterShapeId);
104450
+ if (template2.hasAttribute("Master") || template2.hasAttribute("MasterShape"))
103978
104451
  fail3("UNSUPPORTED_METADATA_EDIT", "Chained master accessibility metadata is not supported.");
103979
- const inherited = template.cloneNode(true);
104452
+ const inherited = template2.cloneNode(true);
103980
104453
  for (const section3 of children3(inherited, "Section").filter(
103981
104454
  (section4) => attribute3(section4, "N") === "User"
103982
104455
  )) {
@@ -105147,11 +105620,11 @@ async function captureVisioClipboard(input2, pageId2, shapeIds2, options2 = {})
105147
105620
  if (!path4) fail3("EDIT_TARGET_NOT_FOUND", "Clipboard page does not exist.");
105148
105621
  const root = await visioXml(pkg, path4, "PageContents");
105149
105622
  const document = await visioXml(pkg, await related(pkg, "", "document"), "VisioDocument");
105150
- const template = masterTemplate(pkg);
105623
+ const template2 = masterTemplate(pkg);
105151
105624
  let structural = false;
105152
105625
  for (const id4 of selected2) {
105153
105626
  const shape2 = pageShapes(root).find((item2) => attribute3(item2, "ID") === id4);
105154
- structural ||= !shape2 || await shapeIsStructural(shape2, template);
105627
+ structural ||= !shape2 || await shapeIsStructural(shape2, template2);
105155
105628
  }
105156
105629
  await assertShapeOrderPackageScope(pkg, check4, structural);
105157
105630
  const evaluate = createVisioCellEvaluator(
@@ -105163,7 +105636,7 @@ async function captureVisioClipboard(input2, pageId2, shapeIds2, options2 = {})
105163
105636
  const masterIds = /* @__PURE__ */ new Set();
105164
105637
  for (const id4 of selected2) {
105165
105638
  check4();
105166
- const stencil = await stencilInstance(root, id4, template, "UNSUPPORTED_CLIPBOARD");
105639
+ const stencil = await stencilInstance(root, id4, template2, "UNSUPPORTED_CLIPBOARD");
105167
105640
  if (stencil) {
105168
105641
  await planInstanceCopy(pkg, pageId2, root, stencil, 0, 0, "UNSUPPORTED_CLIPBOARD");
105169
105642
  assertClipboardResourceReferences(stencil.instance, document);