ooxml-core 1.12.2 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/automation/index.cjs +1353 -645
  2. package/dist/automation/index.mjs +1353 -645
  3. package/dist/i18n/index.cjs +266 -0
  4. package/dist/i18n/index.d.ts +1 -0
  5. package/dist/i18n/index.d.ts.map +1 -1
  6. package/dist/i18n/index.mjs +265 -1
  7. package/dist/i18n/option-strings.d.ts +17 -0
  8. package/dist/i18n/option-strings.d.ts.map +1 -0
  9. package/dist/index.cjs +266 -0
  10. package/dist/index.mjs +266 -0
  11. package/dist/teams/chat.d.ts +6 -0
  12. package/dist/teams/chat.d.ts.map +1 -1
  13. package/dist/teams/index.cjs +6019 -4894
  14. package/dist/teams/index.d.ts +3 -0
  15. package/dist/teams/index.d.ts.map +1 -1
  16. package/dist/teams/index.mjs +5997 -4895
  17. package/dist/teams/pins.d.ts +22 -0
  18. package/dist/teams/pins.d.ts.map +1 -0
  19. package/dist/teams/presence-controller.d.ts +39 -0
  20. package/dist/teams/presence-controller.d.ts.map +1 -0
  21. package/dist/teams/presence.d.ts +55 -0
  22. package/dist/teams/presence.d.ts.map +1 -0
  23. package/dist/teams/store.d.ts +21 -1
  24. package/dist/teams/store.d.ts.map +1 -1
  25. package/dist/teams/view.d.ts +5 -0
  26. package/dist/teams/view.d.ts.map +1 -1
  27. package/dist/teams/workspace.d.ts +10 -2
  28. package/dist/teams/workspace.d.ts.map +1 -1
  29. package/dist/xlsx/formula/evaluator.d.ts.map +1 -1
  30. package/dist/xlsx/formula/functions/amordegrc.d.ts +6 -0
  31. package/dist/xlsx/formula/functions/amordegrc.d.ts.map +1 -0
  32. package/dist/xlsx/formula/functions/bahttext.d.ts +4 -0
  33. package/dist/xlsx/formula/functions/bahttext.d.ts.map +1 -0
  34. package/dist/xlsx/formula/functions/bessel.d.ts +7 -0
  35. package/dist/xlsx/formula/functions/bessel.d.ts.map +1 -0
  36. package/dist/xlsx/formula/functions/bonds.d.ts +3 -0
  37. package/dist/xlsx/formula/functions/bonds.d.ts.map +1 -1
  38. package/dist/xlsx/formula/functions/engineering.d.ts.map +1 -1
  39. package/dist/xlsx/formula/functions/financial.d.ts.map +1 -1
  40. package/dist/xlsx/formula/functions/getpivotdata.d.ts +2 -0
  41. package/dist/xlsx/formula/functions/getpivotdata.d.ts.map +1 -0
  42. package/dist/xlsx/formula/functions/groupby.d.ts +3 -0
  43. package/dist/xlsx/formula/functions/groupby.d.ts.map +1 -0
  44. package/dist/xlsx/formula/functions/logical.d.ts.map +1 -1
  45. package/dist/xlsx/formula/functions/modern.d.ts +3 -0
  46. package/dist/xlsx/formula/functions/modern.d.ts.map +1 -0
  47. package/dist/xlsx/formula/functions/odd-securities.d.ts +3 -0
  48. package/dist/xlsx/formula/functions/odd-securities.d.ts.map +1 -0
  49. package/dist/xlsx/formula/functions/registry.d.ts.map +1 -1
  50. package/dist/xlsx/formula/values.d.ts +2 -0
  51. package/dist/xlsx/formula/values.d.ts.map +1 -1
  52. package/dist/xlsx/index.cjs +3470 -2765
  53. package/dist/xlsx/index.mjs +3470 -2765
  54. package/dist/xlsx/load/index.cjs +1207 -501
  55. package/dist/xlsx/load/index.mjs +1207 -501
  56. package/dist/xlsx/ui/index.cjs +3497 -2435
  57. package/dist/xlsx/ui/index.mjs +3497 -2435
  58. package/dist/xlsx/ui/locales/de/index.d.ts.map +1 -1
  59. package/dist/xlsx/ui/locales/de/options.d.ts +2 -0
  60. package/dist/xlsx/ui/locales/de/options.d.ts.map +1 -0
  61. package/dist/xlsx/ui/locales/de/shell.d.ts.map +1 -1
  62. package/dist/xlsx/ui/locales/en/index.d.ts.map +1 -1
  63. package/dist/xlsx/ui/locales/en/options.d.ts +2 -0
  64. package/dist/xlsx/ui/locales/en/options.d.ts.map +1 -0
  65. package/dist/xlsx/ui/locales/en/shell.d.ts.map +1 -1
  66. package/dist/xlsx/ui/locales/es/index.d.ts.map +1 -1
  67. package/dist/xlsx/ui/locales/es/options.d.ts +2 -0
  68. package/dist/xlsx/ui/locales/es/options.d.ts.map +1 -0
  69. package/dist/xlsx/ui/locales/es/shell.d.ts.map +1 -1
  70. package/dist/xlsx/ui/locales/fr/index.d.ts.map +1 -1
  71. package/dist/xlsx/ui/locales/fr/options.d.ts +2 -0
  72. package/dist/xlsx/ui/locales/fr/options.d.ts.map +1 -0
  73. package/dist/xlsx/ui/locales/fr/shell.d.ts.map +1 -1
  74. package/dist/xlsx/ui/locales/zh-CN/index.d.ts.map +1 -1
  75. package/dist/xlsx/ui/locales/zh-CN/options.d.ts +2 -0
  76. package/dist/xlsx/ui/locales/zh-CN/options.d.ts.map +1 -0
  77. package/dist/xlsx/ui/locales/zh-CN/shell.d.ts.map +1 -1
  78. package/package.json +1 -1
@@ -577,11 +577,11 @@ async function hmac(algorithm, key, data) {
577
577
  var BLOCK = 16;
578
578
  var BATCH = 4096;
579
579
  async function aesEcbDecrypt(key, data) {
580
- const plain2 = await aesCbcDecryptRaw(key, new Uint8Array(BLOCK), data);
581
- for (let at = BLOCK; at < plain2.length && at < data.length; at++) {
582
- plain2[at] = plain2[at] ^ data[at - BLOCK];
580
+ const plain3 = await aesCbcDecryptRaw(key, new Uint8Array(BLOCK), data);
581
+ for (let at = BLOCK; at < plain3.length && at < data.length; at++) {
582
+ plain3[at] = plain3[at] ^ data[at - BLOCK];
583
583
  }
584
- return plain2;
584
+ return plain3;
585
585
  }
586
586
  async function aesEcbEncrypt(key, data) {
587
587
  const padded = new Uint8Array(Math.ceil(data.length / BLOCK) * BLOCK);
@@ -893,12 +893,12 @@ function transform(state, checksum, block) {
893
893
  x[32 + k] = state[k] ^ block[k];
894
894
  }
895
895
  let t = 0;
896
- for (let round2 = 0; round2 < 18; round2++) {
896
+ for (let round3 = 0; round3 < 18; round3++) {
897
897
  for (let k = 0; k < 48; k++) {
898
898
  x[k] = x[k] ^ S[t];
899
899
  t = x[k];
900
900
  }
901
- t = t + round2 & 255;
901
+ t = t + round3 & 255;
902
902
  }
903
903
  state.set(x.subarray(0, 16));
904
904
  t = checksum[15];
@@ -926,9 +926,9 @@ function rotl32(x, n) {
926
926
  return (x << n | x >>> 32 - n) >>> 0;
927
927
  }
928
928
  function add32(...values2) {
929
- let sum2 = 0;
930
- for (const value2 of values2) sum2 = sum2 + value2 >>> 0;
931
- return sum2;
929
+ let sum3 = 0;
930
+ for (const value2 of values2) sum3 = sum3 + value2 >>> 0;
931
+ return sum3;
932
932
  }
933
933
  function padMd4Style(message) {
934
934
  const paddedLength = message.length + 9 + 63 & -64;
@@ -1024,19 +1024,19 @@ var WORD_INDEX = [
1024
1024
  (idx) => 7 * idx % 16
1025
1025
  ];
1026
1026
  var ROUND_FNS = [f, g, h, i];
1027
- function buildOps(round2) {
1028
- const shifts = SHIFTS[round2];
1029
- const wordIndex = WORD_INDEX[round2];
1027
+ function buildOps(round3) {
1028
+ const shifts = SHIFTS[round3];
1029
+ const wordIndex = WORD_INDEX[round3];
1030
1030
  return Array.from({ length: 16 }, (_, idx) => {
1031
- const opNumber = round2 * 16 + idx;
1031
+ const opNumber = round3 * 16 + idx;
1032
1032
  return [wordIndex(idx), shifts[idx % 4], T[opNumber]];
1033
1033
  });
1034
1034
  }
1035
1035
  var ROUNDS = [0, 1, 2, 3].map(buildOps);
1036
1036
  function transform3(state, x) {
1037
1037
  const r = [...state];
1038
- for (let round2 = 0; round2 < 4; round2++) {
1039
- applyRotatingRound(r, ROUNDS[round2], ROUND_FNS[round2], x, true);
1038
+ for (let round3 = 0; round3 < 4; round3++) {
1039
+ applyRotatingRound(r, ROUNDS[round3], ROUND_FNS[round3], x, true);
1040
1040
  }
1041
1041
  for (let idx = 0; idx < 4; idx++) {
1042
1042
  state[idx] = add32(state[idx], r[idx]);
@@ -1218,9 +1218,9 @@ var RIGHT_FNS = [f4, f32, f22, f12];
1218
1218
  function transform4(state, x) {
1219
1219
  const left2 = [...state];
1220
1220
  const right2 = [...state];
1221
- for (let round2 = 0; round2 < 4; round2++) {
1222
- applyRotatingRound(left2, LEFT_ROUNDS[round2], LEFT_FNS[round2], x);
1223
- applyRotatingRound(right2, RIGHT_ROUNDS[round2], RIGHT_FNS[round2], x);
1221
+ for (let round3 = 0; round3 < 4; round3++) {
1222
+ applyRotatingRound(left2, LEFT_ROUNDS[round3], LEFT_FNS[round3], x);
1223
+ applyRotatingRound(right2, RIGHT_ROUNDS[round3], RIGHT_FNS[round3], x);
1224
1224
  }
1225
1225
  const orig = state;
1226
1226
  const newState = [
@@ -1432,8 +1432,8 @@ function applyLane(r, ops, f6, x, startTarget) {
1432
1432
  const i2 = (target + 2) % 5;
1433
1433
  const i3 = (target + 3) % 5;
1434
1434
  const i4 = (target + 4) % 5;
1435
- const sum2 = r[target] + f6(r[i1], r[i2], r[i3]) + x[k] + addConst >>> 0;
1436
- const newTarget = (sum2 << s | sum2 >>> 32 - s) + r[i4] >>> 0;
1435
+ const sum3 = r[target] + f6(r[i1], r[i2], r[i3]) + x[k] + addConst >>> 0;
1436
+ const newTarget = (sum3 << s | sum3 >>> 32 - s) + r[i4] >>> 0;
1437
1437
  const c2 = r[i2];
1438
1438
  r[i2] = (c2 << 10 | c2 >>> 22) >>> 0;
1439
1439
  r[target] = newTarget;
@@ -1446,9 +1446,9 @@ function transform5(state, x) {
1446
1446
  const right2 = [...state];
1447
1447
  let leftTarget = 0;
1448
1448
  let rightTarget = 0;
1449
- for (let round2 = 0; round2 < 5; round2++) {
1450
- leftTarget = applyLane(left2, LEFT_ROUNDS2[round2], LEFT_FNS2[round2], x, leftTarget);
1451
- rightTarget = applyLane(right2, RIGHT_ROUNDS2[round2], RIGHT_FNS2[round2], x, rightTarget);
1449
+ for (let round3 = 0; round3 < 5; round3++) {
1450
+ leftTarget = applyLane(left2, LEFT_ROUNDS2[round3], LEFT_FNS2[round3], x, leftTarget);
1451
+ rightTarget = applyLane(right2, RIGHT_ROUNDS2[round3], RIGHT_FNS2[round3], x, rightTarget);
1452
1452
  }
1453
1453
  const orig = state;
1454
1454
  const newState = [
@@ -2234,18 +2234,18 @@ var BLOCK_BYTES = 64;
2234
2234
  var WORDS = 8;
2235
2235
  var ROUNDS2 = 10;
2236
2236
  var words = () => ({ hi: new Uint32Array(WORDS), lo: new Uint32Array(WORDS) });
2237
- function op(src, column, out) {
2237
+ function op(src, column2, out) {
2238
2238
  const { hi: h2, lo: l } = src;
2239
- const b0 = h2[column] >>> 24;
2240
- const b1 = h2[column + 7 & 7] >>> 16 & 255;
2241
- const b2 = h2[column + 6 & 7] >>> 8 & 255;
2242
- const b3 = h2[column + 5 & 7] & 255;
2243
- const b4 = l[column + 4 & 7] >>> 24;
2244
- const b5 = l[column + 3 & 7] >>> 16 & 255;
2245
- const b6 = l[column + 2 & 7] >>> 8 & 255;
2246
- const b7 = l[column + 1 & 7] & 255;
2247
- out.hi[column] = TABLES_HI2[b0] ^ TABLES_HI2[256 + b1] ^ TABLES_HI2[512 + b2] ^ TABLES_HI2[768 + b3] ^ TABLES_HI2[1024 + b4] ^ TABLES_HI2[1280 + b5] ^ TABLES_HI2[1536 + b6] ^ TABLES_HI2[1792 + b7];
2248
- out.lo[column] = TABLES_LO2[b0] ^ TABLES_LO2[256 + b1] ^ TABLES_LO2[512 + b2] ^ TABLES_LO2[768 + b3] ^ TABLES_LO2[1024 + b4] ^ TABLES_LO2[1280 + b5] ^ TABLES_LO2[1536 + b6] ^ TABLES_LO2[1792 + b7];
2239
+ const b0 = h2[column2] >>> 24;
2240
+ const b1 = h2[column2 + 7 & 7] >>> 16 & 255;
2241
+ const b2 = h2[column2 + 6 & 7] >>> 8 & 255;
2242
+ const b3 = h2[column2 + 5 & 7] & 255;
2243
+ const b4 = l[column2 + 4 & 7] >>> 24;
2244
+ const b5 = l[column2 + 3 & 7] >>> 16 & 255;
2245
+ const b6 = l[column2 + 2 & 7] >>> 8 & 255;
2246
+ const b7 = l[column2 + 1 & 7] & 255;
2247
+ out.hi[column2] = TABLES_HI2[b0] ^ TABLES_HI2[256 + b1] ^ TABLES_HI2[512 + b2] ^ TABLES_HI2[768 + b3] ^ TABLES_HI2[1024 + b4] ^ TABLES_HI2[1280 + b5] ^ TABLES_HI2[1536 + b6] ^ TABLES_HI2[1792 + b7];
2248
+ out.lo[column2] = TABLES_LO2[b0] ^ TABLES_LO2[256 + b1] ^ TABLES_LO2[512 + b2] ^ TABLES_LO2[768 + b3] ^ TABLES_LO2[1024 + b4] ^ TABLES_LO2[1280 + b5] ^ TABLES_LO2[1536 + b6] ^ TABLES_LO2[1792 + b7];
2249
2249
  }
2250
2250
  var scratch = { key: words(), state: words(), initial: words(), nextKey: words(), next: words() };
2251
2251
  function processBlock(hash2, block) {
@@ -2258,10 +2258,10 @@ function processBlock(hash2, block) {
2258
2258
  key.lo.set(hash2.lo);
2259
2259
  state.hi.set(initial.hi);
2260
2260
  state.lo.set(initial.lo);
2261
- for (let round2 = 0; round2 < ROUNDS2; round2++) {
2261
+ for (let round3 = 0; round3 < ROUNDS2; round3++) {
2262
2262
  for (let j = 0; j < WORDS; j++) op(key, j, nextKey);
2263
- nextKey.hi[0] = nextKey.hi[0] ^ ROUND_CONSTANTS_HI2[round2];
2264
- nextKey.lo[0] = nextKey.lo[0] ^ ROUND_CONSTANTS_LO2[round2];
2263
+ nextKey.hi[0] = nextKey.hi[0] ^ ROUND_CONSTANTS_HI2[round3];
2264
+ nextKey.lo[0] = nextKey.lo[0] ^ ROUND_CONSTANTS_LO2[round3];
2265
2265
  for (let j = 0; j < WORDS; j++) {
2266
2266
  op(state, j, next);
2267
2267
  next.hi[j] = next.hi[j] ^ nextKey.hi[j];
@@ -4173,6 +4173,7 @@ function formatRange(range) {
4173
4173
  const a2 = formatAddress(start);
4174
4174
  return start.row === end.row && start.col === end.col ? a2 : `${a2}:${formatAddress(end)}`;
4175
4175
  }
4176
+ var rangeContains = (range, address2) => address2.row >= range.start.row && address2.row <= range.end.row && address2.col >= range.start.col && address2.col <= range.end.col;
4176
4177
  var rangeSize = (range) => (range.end.row - range.start.row + 1) * (range.end.col - range.start.col + 1);
4177
4178
  var cellKey = (row2, col) => row2 * (MAX_COL + 1) + col;
4178
4179
  function quoteSheetName(name) {
@@ -5495,14 +5496,14 @@ function parseCellInput(text, options = {}) {
5495
5496
  if (text === "") return { value: null };
5496
5497
  if (text.startsWith("=") && text.length > 1) return { value: null, formula: text.slice(1) };
5497
5498
  if (text.startsWith("'")) return { value: text.slice(1) };
5498
- const trimmed = text.trim();
5499
- if (trimmed === "") return { value: text };
5500
- const upper2 = trimmed.toUpperCase();
5501
- if (trimmed === text) {
5499
+ const trimmed2 = text.trim();
5500
+ if (trimmed2 === "") return { value: text };
5501
+ const upper2 = trimmed2.toUpperCase();
5502
+ if (trimmed2 === text) {
5502
5503
  if (upper2 === "TRUE" || upper2 === "FALSE") return { value: upper2 === "TRUE" };
5503
5504
  if (isErrorCode(upper2)) return { value: cellError(upper2) };
5504
5505
  }
5505
- const parsed = parseNumberInput(trimmed) ?? parseFractionInput(trimmed) ?? parseDateTimeInput(trimmed, options.date1904 ?? false);
5506
+ const parsed = parseNumberInput(trimmed2) ?? parseFractionInput(trimmed2) ?? parseDateTimeInput(trimmed2, options.date1904 ?? false);
5506
5507
  if (!parsed) return { value: text };
5507
5508
  return parsed.numFmt ? { value: parsed.value, numFmt: parsed.numFmt } : { value: parsed.value };
5508
5509
  }
@@ -5567,10 +5568,10 @@ function displayText(workbook, cell) {
5567
5568
 
5568
5569
  // xlsx/filter-rows.ts
5569
5570
  function rowMatchesFilter(workbook, sheet, row2, filter2) {
5570
- return (filter2.columns ?? []).every((column) => {
5571
- if (!column.values && !column.blank) return true;
5572
- const text = displayText(workbook, getCell(sheet, row2, filter2.range.start.col + column.offset));
5573
- return text === "" ? !!column.blank : (column.values ?? []).includes(text);
5571
+ return (filter2.columns ?? []).every((column2) => {
5572
+ if (!column2.values && !column2.blank) return true;
5573
+ const text = displayText(workbook, getCell(sheet, row2, filter2.range.start.col + column2.offset));
5574
+ return text === "" ? !!column2.blank : (column2.values ?? []).includes(text);
5574
5575
  });
5575
5576
  }
5576
5577
  function isFilteredRow(workbook, sheet, row2) {
@@ -6586,8 +6587,8 @@ function aggregate(records, field, type) {
6586
6587
  if (!numbers3.length) return type === "average" ? { error: "#DIV/0!" } : 0;
6587
6588
  if (type === "min") return numbers3.reduce((a2, b) => Math.min(a2, b));
6588
6589
  if (type === "max") return numbers3.reduce((a2, b) => Math.max(a2, b));
6589
- const sum2 = numbers3.reduce((total2, value2) => total2 + value2, 0);
6590
- return type === "average" ? sum2 / numbers3.length : sum2;
6590
+ const sum3 = numbers3.reduce((total2, value2) => total2 + value2, 0);
6591
+ return type === "average" ? sum3 / numbers3.length : sum3;
6591
6592
  }
6592
6593
  var pivotMeasureNumber = (pivot, records, measure) => aggregate(records, pivot.fields.indexOf(measure.field), measure.aggregate);
6593
6594
  var pivotNumbers = (pivot, records) => pivotMeasures(pivot).map((measure) => pivotMeasureNumber(pivot, records, measure));
@@ -6636,7 +6637,7 @@ function pivotHeaders(pivot, columns, labels, label3) {
6636
6637
  first2,
6637
6638
  [
6638
6639
  ...labels.map(() => null),
6639
- ...columns.flatMap((column) => [label3(column), ...measures.slice(1).map(() => null)]),
6640
+ ...columns.flatMap((column2) => [label3(column2), ...measures.slice(1).map(() => null)]),
6640
6641
  ...measures.map((measure) => `Total ${measure.caption}`)
6641
6642
  ],
6642
6643
  [
@@ -6670,9 +6671,9 @@ function appendFirstPivotValues(pivot, context) {
6670
6671
  pivotMeasures(pivot).forEach((measure, m) => {
6671
6672
  const numbers3 = (keys, records) => [
6672
6673
  ...columnItems.map(
6673
- (column) => pivotMeasureNumber(
6674
+ (column2) => pivotMeasureNumber(
6674
6675
  pivot,
6675
- buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [],
6676
+ buckets.get(JSON.stringify([...keys, pivotValueKey(column2)])) ?? [],
6676
6677
  measure
6677
6678
  )
6678
6679
  ),
@@ -6758,9 +6759,9 @@ function hierarchicalPivotGrid(pivot) {
6758
6759
  if (!children2.has(outer)) children2.set(outer, /* @__PURE__ */ new Set());
6759
6760
  children2.get(outer).add(inner);
6760
6761
  if (pivot.columnField) {
6761
- const column = pivotValueKey(record[columnField] ?? null);
6762
+ const column2 = pivotValueKey(record[columnField] ?? null);
6762
6763
  for (const key of [[], [outer], [outer, inner]])
6763
- collect(buckets, JSON.stringify([...key, column]), record);
6764
+ collect(buckets, JSON.stringify([...key, column2]), record);
6764
6765
  }
6765
6766
  }
6766
6767
  const dimensions = pivotHeaderDimensions(pivot, columnItems.length, rowLabelColumns);
@@ -6778,7 +6779,7 @@ function hierarchicalPivotGrid(pivot) {
6778
6779
  };
6779
6780
  const bands = (keys, records) => [
6780
6781
  ...columnItems.map(
6781
- (column) => pivotNumbers(pivot, buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [])
6782
+ (column2) => pivotNumbers(pivot, buckets.get(JSON.stringify([...keys, pivotValueKey(column2)])) ?? [])
6782
6783
  ),
6783
6784
  pivotNumbers(pivot, records)
6784
6785
  ];
@@ -6852,9 +6853,9 @@ function hierarchicalPivotGrid(pivot) {
6852
6853
  ],
6853
6854
  [
6854
6855
  ...columnItems.map(
6855
- (column) => pivotMeasureNumber(
6856
+ (column2) => pivotMeasureNumber(
6856
6857
  pivot,
6857
- buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [],
6858
+ buckets.get(JSON.stringify([...keys, pivotValueKey(column2)])) ?? [],
6858
6859
  measure
6859
6860
  )
6860
6861
  ),
@@ -7054,6 +7055,9 @@ function pivotDataGrid(pivot) {
7054
7055
  ]);
7055
7056
  return { values: values2, rowItems, columnItems, firstDataRow };
7056
7057
  }
7058
+ function pivotTableAt(sheet, at) {
7059
+ return sheet.pivotTables?.find((pivot) => rangeContains(pivot.location, at));
7060
+ }
7057
7061
 
7058
7062
  // xlsx/pivot/admission.ts
7059
7063
  var X14 = "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main";
@@ -7232,10 +7236,10 @@ function pivotValueAxisItems(measures, columns, columnIndices) {
7232
7236
  `<i${attrs({ i: measure || void 0 })}><x${attrs({ v: measure || void 0 })}/></i>`
7233
7237
  );
7234
7238
  } else {
7235
- for (let column = 0; column < columns; column++)
7239
+ for (let column2 = 0; column2 < columns; column2++)
7236
7240
  for (let measure = 0; measure < measures; measure++) {
7237
7241
  entries.push(
7238
- `<i${attrs({ r: measure ? 1 : void 0, i: measure || void 0 })}>${measure ? "" : `<x${attrs({ v: (columnIndices?.[column] ?? column) || void 0 })}/>`}<x${attrs({ v: measure || void 0 })}/></i>`
7242
+ `<i${attrs({ r: measure ? 1 : void 0, i: measure || void 0 })}>${measure ? "" : `<x${attrs({ v: (columnIndices?.[column2] ?? column2) || void 0 })}/>`}<x${attrs({ v: measure || void 0 })}/></i>`
7239
7243
  );
7240
7244
  }
7241
7245
  for (let measure = 0; measure < measures; measure++)
@@ -7306,8 +7310,8 @@ function assertPageAxisItems(root, pivot, shared, cache2, recordRoot) {
7306
7310
  literals(recordRoot);
7307
7311
  const cacheFields = children(first(cache2, "cacheFields", NS.x), "cacheField", NS.x);
7308
7312
  if (pivot.columnField) {
7309
- const column = children(first(root, "pivotFields", NS.x), "pivotField", NS.x)[pivot.fields.indexOf(pivot.columnField)];
7310
- const list = first(column, "extLst", NS.x);
7313
+ const column2 = children(first(root, "pivotFields", NS.x), "pivotField", NS.x)[pivot.fields.indexOf(pivot.columnField)];
7314
+ const list = first(column2, "extLst", NS.x);
7311
7315
  const extensions = list ? children(list, "ext", NS.x) : [];
7312
7316
  if (extensions.some(
7313
7317
  (extension) => children(
@@ -8695,14 +8699,14 @@ function rewrite(formula, visit) {
8695
8699
  }
8696
8700
  function stripFuturePrefixes(formula) {
8697
8701
  if (!formula.includes("_xl")) return formula;
8698
- const plain2 = rewrite(formula, (token, next, out) => {
8702
+ const plain3 = rewrite(formula, (token, next, out) => {
8699
8703
  if (!next.startsWith("(")) return false;
8700
8704
  const stripped = token.replace(/^(_xlfn\.)?(_xlws\.)?/i, "");
8701
8705
  if (stripped === token) return false;
8702
8706
  out.push(stripped);
8703
8707
  return true;
8704
8708
  });
8705
- return fromStoredSyntax(plain2);
8709
+ return fromStoredSyntax(plain3);
8706
8710
  }
8707
8711
  function addFuturePrefixes(formula) {
8708
8712
  return rewrite(toStoredSyntax(formula), (token, next, out) => {
@@ -8976,7 +8980,7 @@ function parsePoint(element2) {
8976
8980
  paragraphs,
8977
8981
  text: paragraphs.join("\n")
8978
8982
  };
8979
- const optional = [
8983
+ const optional2 = [
8980
8984
  ["connectionId", stringAttribute(element2, "cxnId")],
8981
8985
  ["presAssocId", stringAttribute(prSet, "presAssocID")],
8982
8986
  ["presName", stringAttribute(prSet, "presName")],
@@ -8988,7 +8992,7 @@ function parsePoint(element2) {
8988
8992
  ["quickStyleTypeId", stringAttribute(prSet, "qsTypeId")],
8989
8993
  ["colorsTypeId", stringAttribute(prSet, "csTypeId")]
8990
8994
  ];
8991
- for (const [key, value2] of optional)
8995
+ for (const [key, value2] of optional2)
8992
8996
  if (value2 !== void 0) point[key] = value2;
8993
8997
  const customLayout = prSet ? parseCustomLayoutAttributes(attributeReader(prSet)) : void 0;
8994
8998
  if (customLayout) point.customLayout = customLayout;
@@ -9935,16 +9939,16 @@ function readAutoFilter(node) {
9935
9939
  if (!node || !range) return void 0;
9936
9940
  const filter2 = { range };
9937
9941
  const columns = [];
9938
- for (const column of xChildren(node, "filterColumn")) {
9942
+ for (const column2 of xChildren(node, "filterColumn")) {
9939
9943
  const entry3 = {
9940
- offset: numAttr(column, "colId") ?? 0
9944
+ offset: numAttr(column2, "colId") ?? 0
9941
9945
  };
9942
- const filters = xFirst(column, "filters");
9946
+ const filters = xFirst(column2, "filters");
9943
9947
  if (filters) {
9944
9948
  entry3.values = xChildren(filters, "filter").map((f6) => att(f6, "val") ?? "");
9945
9949
  if (boolAttr(filters, "blank")) entry3.blank = true;
9946
9950
  }
9947
- entry3.sourceXml = outerXml(column).replace(MAIN_NS_DECL, "");
9951
+ entry3.sourceXml = outerXml(column2).replace(MAIN_NS_DECL, "");
9948
9952
  columns.push(entry3);
9949
9953
  }
9950
9954
  if (columns.length) filter2.columns = columns;
@@ -11892,16 +11896,16 @@ function parseTable(xml, partName) {
11892
11896
  const name = att(root, "name") ?? att(root, "displayName") ?? "Table";
11893
11897
  const columns = xChildren(xFirst(root, "tableColumns") ?? root, "tableColumn").map(
11894
11898
  (node) => {
11895
- const column = { name: att(node, "name") ?? "" };
11899
+ const column2 = { name: att(node, "name") ?? "" };
11896
11900
  const id = numAttr(node, "id");
11897
- if (id !== void 0 && Number.isInteger(id) && id >= 0) column.sourceId = id;
11901
+ if (id !== void 0 && Number.isInteger(id) && id >= 0) column2.sourceId = id;
11898
11902
  const fn = att(node, "totalsRowFunction");
11899
- if (fn && fn !== "none") column.totalsRowFunction = fn;
11903
+ if (fn && fn !== "none") column2.totalsRowFunction = fn;
11900
11904
  const label3 = att(node, "totalsRowLabel");
11901
- if (label3 !== void 0) column.totalsRowLabel = label3;
11905
+ if (label3 !== void 0) column2.totalsRowLabel = label3;
11902
11906
  const calculated = xFirst(node, "calculatedColumnFormula");
11903
- if (calculated) column.calculatedColumnFormula = stripFuturePrefixes(xText(calculated));
11904
- return column;
11907
+ if (calculated) column2.calculatedColumnFormula = stripFuturePrefixes(xText(calculated));
11908
+ return column2;
11905
11909
  }
11906
11910
  );
11907
11911
  const table2 = {
@@ -12199,12 +12203,12 @@ function guidFrom(seed) {
12199
12203
  let h1 = 2166136261;
12200
12204
  let h2 = 16777619;
12201
12205
  const hex = [];
12202
- for (let round2 = 0; round2 < 4; round2++) {
12206
+ for (let round3 = 0; round3 < 4; round3++) {
12203
12207
  for (let i2 = 0; i2 < seed.length; i2++) {
12204
12208
  h1 = Math.imul(h1 ^ seed.charCodeAt(i2), 16777619) >>> 0;
12205
- h2 = Math.imul(h2 ^ seed.charCodeAt(i2) + round2, 1540483477) >>> 0;
12209
+ h2 = Math.imul(h2 ^ seed.charCodeAt(i2) + round3, 1540483477) >>> 0;
12206
12210
  }
12207
- h1 = Math.imul(h1 ^ round2, 668265261) >>> 0;
12211
+ h1 = Math.imul(h1 ^ round3, 668265261) >>> 0;
12208
12212
  hex.push(((h1 ^ h2) >>> 0).toString(16).toUpperCase().padStart(8, "0"));
12209
12213
  }
12210
12214
  const s = hex.join("");
@@ -13040,8 +13044,8 @@ function chartPaletteSeriesColorChoice(palette, i2, n) {
13040
13044
  let transform6;
13041
13045
  if (palette.meth === "cycle") {
13042
13046
  base = palette.base[i2 % palette.base.length];
13043
- const round2 = Math.floor(i2 / palette.base.length);
13044
- transform6 = (palette.variations.length ? palette.variations[round2 % palette.variations.length] : {}) ?? {};
13047
+ const round3 = Math.floor(i2 / palette.base.length);
13048
+ transform6 = (palette.variations.length ? palette.variations[round3 % palette.variations.length] : {}) ?? {};
13045
13049
  } else {
13046
13050
  const index3 = palette.meth === "withinLinearReversed" ? n - 1 - i2 : i2;
13047
13051
  base = palette.base[0];
@@ -14067,8 +14071,8 @@ function parseNumberText(input) {
14067
14071
  const signText = `${signed?.[1] ?? ""}${signed?.[2] ?? ""}`;
14068
14072
  if (signText.length <= 1) {
14069
14073
  const body = text.slice(signed?.[0].length ?? 0);
14070
- const plain2 = parsePlainNumber(body);
14071
- if (plain2 !== void 0) return (signText === "-" ? -1 : 1) * sign * plain2 * scale2;
14074
+ const plain3 = parsePlainNumber(body);
14075
+ if (plain3 !== void 0) return (signText === "-" ? -1 : 1) * sign * plain3 * scale2;
14072
14076
  }
14073
14077
  if (scale2 !== 1 || sign !== 1) return void 0;
14074
14078
  const fraction = /^([+-]?)(?:(\d+)\s+)?(\d+)\/(\d+)$/.exec(text);
@@ -14109,13 +14113,13 @@ function numberToText(value2) {
14109
14113
  const [mantissa = "0", expText = "0"] = abs.toExponential(14).split("e");
14110
14114
  const exponent = Number(expText);
14111
14115
  const digits2 = mantissa.replace(".", "").replace(/0+$/, "") || "0";
14112
- let plain2;
14116
+ let plain3;
14113
14117
  if (exponent >= 0) {
14114
- plain2 = digits2.length <= exponent + 1 ? digits2 + "0".repeat(exponent + 1 - digits2.length) : `${digits2.slice(0, exponent + 1)}.${digits2.slice(exponent + 1)}`;
14118
+ plain3 = digits2.length <= exponent + 1 ? digits2 + "0".repeat(exponent + 1 - digits2.length) : `${digits2.slice(0, exponent + 1)}.${digits2.slice(exponent + 1)}`;
14115
14119
  } else {
14116
- plain2 = `0.${"0".repeat(-exponent - 1)}${digits2}`;
14120
+ plain3 = `0.${"0".repeat(-exponent - 1)}${digits2}`;
14117
14121
  }
14118
- if (plain2.length <= 20) return negative ? `-${plain2}` : plain2;
14122
+ if (plain3.length <= 20) return negative ? `-${plain3}` : plain3;
14119
14123
  const mant = digits2.length > 1 ? `${digits2[0]}.${digits2.slice(1)}` : digits2;
14120
14124
  const exp2 = `${exponent < 0 ? "-" : "+"}${String(Math.abs(exponent)).padStart(2, "0")}`;
14121
14125
  return `${negative ? "-" : ""}${mant}E${exp2}`;
@@ -14268,6 +14272,7 @@ var RefValue = class {
14268
14272
  return this.areas.length === 1 && area !== void 0 && area.range.start.row === area.range.end.row && area.range.start.col === area.range.end.col;
14269
14273
  }
14270
14274
  };
14275
+ var OMITTED_PREFIX = "#omitted:";
14271
14276
  var LambdaValue = class {
14272
14277
  constructor(params, body, scope) {
14273
14278
  this.params = params;
@@ -14770,10 +14775,10 @@ function sortBy(args, ctx) {
14770
14775
  const by = ctx.toMatrix(args[i2] ?? null);
14771
14776
  const order = i2 + 1 < args.length && args[i2 + 1] !== null ? num2(ctx.toScalar(args[i2 + 1] ?? null)) : 1;
14772
14777
  if (order !== 1 && order !== -1) fail(ERR.VALUE);
14773
- const column = by.cols === 1 && by.rows === m.rows;
14778
+ const column2 = by.cols === 1 && by.rows === m.rows;
14774
14779
  const row2 = by.rows === 1 && by.cols === m.cols;
14775
- if (!column && !row2) fail(ERR.VALUE);
14776
- const thisByCol = !column;
14780
+ if (!column2 && !row2) fail(ERR.VALUE);
14781
+ const thisByCol = !column2;
14777
14782
  if (byCol !== void 0 && byCol !== thisByCol) fail(ERR.VALUE);
14778
14783
  byCol = thisByCol;
14779
14784
  keys.push({ values: by.flat(), descending: order === -1 });
@@ -14786,14 +14791,14 @@ function unique(args, ctx) {
14786
14791
  const byCol = args.length > 1 && args[1] !== null && toBool(ctx.toScalar(args[1] ?? null));
14787
14792
  const once = args.length > 2 && args[2] !== null && toBool(ctx.toScalar(args[2] ?? null));
14788
14793
  if (byCol) m = transpose(m);
14789
- const keyOf = (row2) => JSON.stringify(
14794
+ const keyOf2 = (row2) => JSON.stringify(
14790
14795
  row2.map(
14791
14796
  (v) => isError(v) ? `#${v.error}` : typeof v === "string" ? `s${v.toLowerCase()}` : v
14792
14797
  )
14793
14798
  );
14794
14799
  const counts = /* @__PURE__ */ new Map();
14795
14800
  for (const row2 of m.data) {
14796
- const key = keyOf(row2);
14801
+ const key = keyOf2(row2);
14797
14802
  const entry3 = counts.get(key);
14798
14803
  if (entry3) entry3.count++;
14799
14804
  else counts.set(key, { row: row2, count: 1 });
@@ -15105,20 +15110,20 @@ function recordFilter(table2, criteria) {
15105
15110
  });
15106
15111
  const alternatives = rows.map(
15107
15112
  (row2) => row2.flatMap((cell, c2) => {
15108
- const column = columns[c2] ?? -1;
15113
+ const column2 = columns[c2] ?? -1;
15109
15114
  if (cell === null || cell === "") return [];
15110
- if (column < 0) return [() => false];
15115
+ if (column2 < 0) return [() => false];
15111
15116
  const matches2 = makeCriteria(cell);
15112
- return [(record) => matches2(record[column] ?? null)];
15117
+ return [(record) => matches2(record[column2] ?? null)];
15113
15118
  })
15114
15119
  );
15115
15120
  return (record) => alternatives.some((tests) => tests.every((test) => test(record)));
15116
15121
  }
15117
15122
  function selected(ctx, args) {
15118
15123
  const table2 = tableOf(ctx, args[0]);
15119
- const column = fieldIndex(table2, args[1]);
15124
+ const column2 = fieldIndex(table2, args[1]);
15120
15125
  const matches2 = recordFilter(table2, ctx.toMatrix(args[2] ?? null).data);
15121
- return table2.records.filter(matches2).map((record) => record[column] ?? null);
15126
+ return table2.records.filter(matches2).map((record) => record[column2] ?? null);
15122
15127
  }
15123
15128
  var numbers = (values2) => {
15124
15129
  for (const v of values2) if (isError(v)) fail(v);
@@ -15861,6 +15866,90 @@ var COMPLEX_FUNCTIONS = [
15861
15866
  )
15862
15867
  ];
15863
15868
 
15869
+ // xlsx/formula/functions/bessel.ts
15870
+ var C7 = "Engineering";
15871
+ var EULER = 0.5772156649015329;
15872
+ var LIMIT = 1e6;
15873
+ function besselJAll(x, nmax) {
15874
+ const top = Math.max(nmax, Math.ceil(x));
15875
+ let m = top + 40 + Math.ceil(2 * Math.sqrt(top));
15876
+ if (m % 2 === 1) m += 1;
15877
+ const j = new Array(m + 2).fill(0);
15878
+ j[m] = 1e-30;
15879
+ for (let k = m; k >= 1; k--) {
15880
+ j[k - 1] = 2 * k / x * j[k] - j[k + 1];
15881
+ if (Math.abs(j[k - 1]) > 1e250) {
15882
+ for (let i2 = k - 1; i2 <= m + 1; i2++) j[i2] = j[i2] * 1e-250;
15883
+ }
15884
+ }
15885
+ let sum3 = j[0];
15886
+ for (let k = 2; k <= m; k += 2) sum3 += 2 * j[k];
15887
+ return j.slice(0, m + 1).map((v) => v / sum3);
15888
+ }
15889
+ function besselJ(x, n) {
15890
+ if (x === 0) return n === 0 ? 1 : 0;
15891
+ const value2 = besselJAll(Math.abs(x), n)[n] ?? 0;
15892
+ return x < 0 && n % 2 === 1 ? -value2 : value2;
15893
+ }
15894
+ function besselY(x, n) {
15895
+ const j = besselJAll(x, n + 2);
15896
+ const j0 = j[0];
15897
+ const j1 = j[1];
15898
+ const lg = Math.log(x / 2) + EULER;
15899
+ let s0 = 0;
15900
+ let s1 = 0;
15901
+ for (let k = 1; 2 * k + 1 < j.length; k++) {
15902
+ const sign = k % 2 === 1 ? 1 : -1;
15903
+ s0 += sign * j[2 * k] / k;
15904
+ s1 += sign * (j[2 * k - 1] - j[2 * k + 1]) / k;
15905
+ }
15906
+ let prev = 2 / Math.PI * lg * j0 + 4 / Math.PI * s0;
15907
+ if (n === 0) return prev;
15908
+ let cur = 2 / Math.PI * (lg * j1 - j0 / x) - 2 / Math.PI * s1;
15909
+ for (let k = 1; k < n; k++) {
15910
+ const next = 2 * k / x * cur - prev;
15911
+ prev = cur;
15912
+ cur = next;
15913
+ }
15914
+ return cur;
15915
+ }
15916
+ function besselI(x, n) {
15917
+ const ax = Math.abs(x);
15918
+ if (ax > 700) fail(ERR.NUM);
15919
+ if (ax === 0) return n === 0 ? 1 : 0;
15920
+ const points = 2 * (Math.ceil(ax) + n) + 80;
15921
+ let sum3 = 0;
15922
+ for (let i2 = 0; i2 < points; i2++) {
15923
+ const t = 2 * Math.PI * i2 / points;
15924
+ sum3 += Math.exp(ax * (Math.cos(t) - 1)) * Math.cos(n * t);
15925
+ }
15926
+ const value2 = sum3 / points * Math.exp(ax);
15927
+ return x < 0 && n % 2 === 1 ? -value2 : value2;
15928
+ }
15929
+ function besselK(x, n) {
15930
+ const h2 = 0.1;
15931
+ let sum3 = 0.5 * Math.exp(-x);
15932
+ for (let i2 = 1; i2 < 1e5; i2++) {
15933
+ const t = i2 * h2;
15934
+ const term = Math.exp(-x * Math.cosh(t)) * Math.cosh(n * t);
15935
+ sum3 += term;
15936
+ if (term < sum3 * 1e-18 && t > n) break;
15937
+ }
15938
+ return sum3 * h2;
15939
+ }
15940
+ var bessel = (name, description, positiveOnly, fn) => spec(name, C7, `${name}(x, n)`, description, 2, 2, (args) => {
15941
+ const x = num2(args[0]);
15942
+ const n = Math.trunc(num2(args[1]));
15943
+ if (n < 0 || positiveOnly && x <= 0 || Math.abs(x) > LIMIT) fail(ERR.NUM);
15944
+ return finite(fn(x, n));
15945
+ });
15946
+ var BESSEL_FUNCTIONS = [
15947
+ bessel("BESSELJ", "The Bessel function Jn(x).", false, besselJ),
15948
+ bessel("BESSELY", "The Bessel function Yn(x), also called the Weber function.", true, besselY),
15949
+ bessel("BESSELI", "The modified Bessel function In(x).", false, besselI),
15950
+ bessel("BESSELK", "The modified Bessel function Kn(x).", true, besselK)
15951
+ ];
15952
+
15864
15953
  // xlsx/formula/functions/convert.ts
15865
15954
  var table = /* @__PURE__ */ new Map();
15866
15955
  var add = (dimension2, names, factor, extra = {}) => {
@@ -16039,7 +16128,7 @@ var CONVERT_FUNCTIONS = [
16039
16128
  ];
16040
16129
 
16041
16130
  // xlsx/formula/functions/engineering.ts
16042
- var C7 = "Engineering";
16131
+ var C8 = "Engineering";
16043
16132
  var BASES = { BIN: 2, OCT: 8, DEC: 10, HEX: 16 };
16044
16133
  var BITS = { BIN: 10, OCT: 30, DEC: 0, HEX: 40 };
16045
16134
  function parseBase(value2, base) {
@@ -16073,7 +16162,7 @@ for (const from of Object.keys(BASES)) {
16073
16162
  conversions.push(
16074
16163
  spec(
16075
16164
  name,
16076
- C7,
16165
+ C8,
16077
16166
  to === "DEC" ? `${name}(number)` : `${name}(number, [places])`,
16078
16167
  `Converts a ${from.toLowerCase()} number to ${to.toLowerCase()}.`,
16079
16168
  1,
@@ -16117,9 +16206,10 @@ var ENGINEERING_FUNCTIONS = [
16117
16206
  ...conversions,
16118
16207
  ...COMPLEX_FUNCTIONS,
16119
16208
  ...CONVERT_FUNCTIONS,
16209
+ ...BESSEL_FUNCTIONS,
16120
16210
  spec(
16121
16211
  "BITAND",
16122
- C7,
16212
+ C8,
16123
16213
  "BITAND(number1, number2)",
16124
16214
  "Bitwise AND.",
16125
16215
  2,
@@ -16128,7 +16218,7 @@ var ENGINEERING_FUNCTIONS = [
16128
16218
  ),
16129
16219
  spec(
16130
16220
  "BITOR",
16131
- C7,
16221
+ C8,
16132
16222
  "BITOR(number1, number2)",
16133
16223
  "Bitwise OR.",
16134
16224
  2,
@@ -16137,24 +16227,24 @@ var ENGINEERING_FUNCTIONS = [
16137
16227
  ),
16138
16228
  spec(
16139
16229
  "BITXOR",
16140
- C7,
16230
+ C8,
16141
16231
  "BITXOR(number1, number2)",
16142
16232
  "Bitwise XOR.",
16143
16233
  2,
16144
16234
  2,
16145
16235
  (args) => bitwise(bitArg(args[0]), bitArg(args[1]), (x, y) => x ^ y)
16146
16236
  ),
16147
- spec("BITLSHIFT", C7, "BITLSHIFT(number, shift_amount)", "Shifts bits left.", 2, 2, (args) => {
16237
+ spec("BITLSHIFT", C8, "BITLSHIFT(number, shift_amount)", "Shifts bits left.", 2, 2, (args) => {
16148
16238
  const out = Math.floor(bitArg(args[0]) * Math.pow(2, int3(args[1])));
16149
16239
  return out >= 2 ** 48 ? fail(ERR.NUM) : out;
16150
16240
  }),
16151
- spec("BITRSHIFT", C7, "BITRSHIFT(number, shift_amount)", "Shifts bits right.", 2, 2, (args) => {
16241
+ spec("BITRSHIFT", C8, "BITRSHIFT(number, shift_amount)", "Shifts bits right.", 2, 2, (args) => {
16152
16242
  const out = Math.floor(bitArg(args[0]) / Math.pow(2, int3(args[1])));
16153
16243
  return out >= 2 ** 48 ? fail(ERR.NUM) : out;
16154
16244
  }),
16155
16245
  numeric(
16156
16246
  "DELTA",
16157
- C7,
16247
+ C8,
16158
16248
  "DELTA(number1, [number2])",
16159
16249
  "1 when two numbers are equal, else 0.",
16160
16250
  1,
@@ -16163,7 +16253,7 @@ var ENGINEERING_FUNCTIONS = [
16163
16253
  ),
16164
16254
  numeric(
16165
16255
  "GESTEP",
16166
- C7,
16256
+ C8,
16167
16257
  "GESTEP(number, [step])",
16168
16258
  "1 when a number is at least step, else 0.",
16169
16259
  1,
@@ -16249,7 +16339,7 @@ var ENGINEERING_FUNCTIONS = [
16249
16339
  ];
16250
16340
 
16251
16341
  // xlsx/formula/functions/coupons.ts
16252
- var C8 = "Financial";
16342
+ var C9 = "Financial";
16253
16343
  function checkSecurity(settlement, maturity, frequency2, basis) {
16254
16344
  if (![1, 2, 4].includes(frequency2) || basis < 0 || basis > 4 || settlement >= maturity)
16255
16345
  fail(ERR.NUM);
@@ -16277,7 +16367,7 @@ function couponFacts(settlement, maturity, frequency2, basis, ctx) {
16277
16367
  }
16278
16368
  var security = (name, description, pick2) => spec(
16279
16369
  name,
16280
- C8,
16370
+ C9,
16281
16371
  `${name}(settlement, maturity, frequency, [basis])`,
16282
16372
  description,
16283
16373
  3,
@@ -16379,7 +16469,7 @@ function cumulative(args, principal) {
16379
16469
  }
16380
16470
 
16381
16471
  // xlsx/formula/functions/bonds.ts
16382
- var C9 = "Financial";
16472
+ var C10 = "Financial";
16383
16473
  var basisOf = (args, index3) => {
16384
16474
  const basis = args.length > index3 && args[index3] !== null ? int3(args[index3]) : 0;
16385
16475
  if (basis < 0 || basis > 4) fail(ERR.NUM);
@@ -16447,21 +16537,21 @@ function accruedInterest(args, ctx) {
16447
16537
  if (start >= settlement) return 0;
16448
16538
  const dates = quasiPeriods(first2, start, settlement, frequency2, ctx);
16449
16539
  const count2 = (a2, b) => basis === 0 || basis === 4 ? days360(a2, b, basis === 4, ctx) : b - a2;
16450
- let sum2 = 0;
16540
+ let sum3 = 0;
16451
16541
  for (let i2 = 0; i2 + 1 < dates.length; i2++) {
16452
16542
  const [p, q] = [dates[i2], dates[i2 + 1]];
16453
16543
  const a2 = count2(Math.max(start, p), Math.min(settlement, q));
16454
16544
  if (a2 <= 0) continue;
16455
16545
  const length = basis === 1 ? q - p : basis === 3 ? 365 / frequency2 : 360 / frequency2;
16456
- sum2 += a2 / length;
16546
+ sum3 += a2 / length;
16457
16547
  }
16458
- return par * rate / frequency2 * sum2;
16548
+ return par * rate / frequency2 * sum3;
16459
16549
  }
16460
16550
  var BOND_ARGS = (name, third, fourth, fifth) => `${name}(settlement, maturity, ${third}, ${fourth}, ${fifth}, frequency, [basis])`;
16461
16551
  var BOND_FUNCTIONS = [
16462
16552
  spec(
16463
16553
  "PRICE",
16464
- C9,
16554
+ C10,
16465
16555
  BOND_ARGS("PRICE", "rate", "yld", "redemption"),
16466
16556
  "The price per 100 face value of a security that pays periodic interest.",
16467
16557
  6,
@@ -16475,7 +16565,7 @@ var BOND_FUNCTIONS = [
16475
16565
  ),
16476
16566
  spec(
16477
16567
  "YIELD",
16478
- C9,
16568
+ C10,
16479
16569
  BOND_ARGS("YIELD", "rate", "pr", "redemption"),
16480
16570
  "The yield of a security that pays periodic interest.",
16481
16571
  6,
@@ -16491,7 +16581,7 @@ var BOND_FUNCTIONS = [
16491
16581
  ...["DURATION", "MDURATION"].map(
16492
16582
  (name) => spec(
16493
16583
  name,
16494
- C9,
16584
+ C10,
16495
16585
  `${name}(settlement, maturity, coupon, yld, frequency, [basis])`,
16496
16586
  name === "DURATION" ? "The Macaulay duration of a security with periodic interest." : "The modified Macaulay duration of a security.",
16497
16587
  5,
@@ -16514,7 +16604,7 @@ var BOND_FUNCTIONS = [
16514
16604
  ),
16515
16605
  spec(
16516
16606
  "ACCRINT",
16517
- C9,
16607
+ C10,
16518
16608
  "ACCRINT(issue, first_interest, settlement, rate, par, frequency, [basis], [calc_method])",
16519
16609
  "The accrued interest of a security that pays periodic interest.",
16520
16610
  6,
@@ -16523,7 +16613,7 @@ var BOND_FUNCTIONS = [
16523
16613
  ),
16524
16614
  spec(
16525
16615
  "ACCRINTM",
16526
- C9,
16616
+ C10,
16527
16617
  "ACCRINTM(issue, settlement, rate, [par], [basis])",
16528
16618
  "The accrued interest of a security that pays interest at maturity.",
16529
16619
  3,
@@ -16537,6 +16627,40 @@ var BOND_FUNCTIONS = [
16537
16627
  )
16538
16628
  ];
16539
16629
 
16630
+ // xlsx/formula/functions/amordegrc.ts
16631
+ var round2 = (value2) => Math.floor(value2 + 0.5);
16632
+ var AMORDEGRC = spec(
16633
+ "AMORDEGRC",
16634
+ "Financial",
16635
+ "AMORDEGRC(cost, date_purchased, first_period, salvage, period, rate, [basis])",
16636
+ "Depreciation of each accounting period using a depreciation coefficient.",
16637
+ 6,
16638
+ 7,
16639
+ (args, ctx) => {
16640
+ let cost = num2(args[0]);
16641
+ const salvage = num2(args[3]);
16642
+ const period = Math.floor(num2(args[4]));
16643
+ let rate = num2(args[5]);
16644
+ const basis = Math.trunc(optNum(args, 6, 0));
16645
+ const purchase = Math.floor(serialArg(args[1]));
16646
+ const firstPeriod = Math.floor(serialArg(args[2]));
16647
+ if (cost <= 0 || salvage < 0 || salvage > cost || rate <= 0 || period < 0 || ![0, 1, 3, 4].includes(basis) || purchase > firstPeriod)
16648
+ fail(ERR.NUM);
16649
+ const life = 1 / rate;
16650
+ rate *= life < 3 ? 1 : life < 5 ? 1.5 : life <= 6 ? 2 : 2.5;
16651
+ let depreciation = round2(yearFrac(purchase, firstPeriod, basis, ctx) * rate * cost);
16652
+ cost -= depreciation;
16653
+ let rest = cost - salvage;
16654
+ for (let n = 0; n < period; n++) {
16655
+ depreciation = round2(rate * cost);
16656
+ rest -= depreciation;
16657
+ if (rest < 0) return period - n === 1 ? round2(cost * 0.5) : 0;
16658
+ cost -= depreciation;
16659
+ }
16660
+ return finite(depreciation);
16661
+ }
16662
+ );
16663
+
16540
16664
  // xlsx/formula/functions/amorlinc.ts
16541
16665
  var AMORLINC = {
16542
16666
  ...spec(
@@ -16571,8 +16695,168 @@ var AMORLINC = {
16571
16695
  missingRequiredError: "#N/A"
16572
16696
  };
16573
16697
 
16698
+ // xlsx/formula/functions/odd-securities.ts
16699
+ var C11 = "Financial";
16700
+ function calendar2(dates, frequency2, basis, ctx) {
16701
+ const count2 = (a2, b) => basis === 0 || basis === 4 ? days360(a2, b, basis === 4, ctx) : b - a2;
16702
+ return {
16703
+ fraction(a2, b) {
16704
+ let sum3 = 0;
16705
+ for (let i2 = 0; i2 + 1 < dates.length; i2++) {
16706
+ const [p, q] = [dates[i2], dates[i2 + 1]];
16707
+ const days = count2(Math.max(a2, p), Math.min(b, q));
16708
+ if (days <= 0) continue;
16709
+ sum3 += days / (basis === 1 ? q - p : basis === 3 ? 365 / frequency2 : 360 / frequency2);
16710
+ }
16711
+ return sum3;
16712
+ }
16713
+ };
16714
+ }
16715
+ function basisOf2(args, index3) {
16716
+ const basis = args.length > index3 && args[index3] !== null ? int3(args[index3]) : 0;
16717
+ if (basis < 0 || basis > 4) fail(ERR.NUM);
16718
+ return basis;
16719
+ }
16720
+ function frequencyOf(value2) {
16721
+ const frequency2 = int3(value2);
16722
+ if (![1, 2, 4].includes(frequency2)) fail(ERR.NUM);
16723
+ return frequency2;
16724
+ }
16725
+ function oddFirstPrice(s, yld, ctx) {
16726
+ const { settlement, maturity, issue, firstCoupon, rate, redemption, frequency: frequency2, basis } = s;
16727
+ const months = 12 / frequency2;
16728
+ const coupon = 100 * rate / frequency2;
16729
+ const quasi = calendar2(
16730
+ quasiPeriods(firstCoupon, issue, firstCoupon, frequency2, ctx),
16731
+ frequency2,
16732
+ basis,
16733
+ ctx
16734
+ );
16735
+ const toFirst = quasi.fraction(settlement, firstCoupon);
16736
+ const { year, month, day } = serialToYmd(firstCoupon, ctx.date1904);
16737
+ const monthEnd = day === daysInMonth(year, month);
16738
+ let n = 1;
16739
+ while (addMonths(firstCoupon, n * months, ctx, monthEnd) < maturity) n += 1;
16740
+ n += 1;
16741
+ const base = 1 + yld / frequency2;
16742
+ let price = redemption / base ** (toFirst + n - 1);
16743
+ price += coupon * quasi.fraction(issue, firstCoupon) / base ** toFirst;
16744
+ for (let k = 2; k <= n; k++) price += coupon / base ** (toFirst + k - 1);
16745
+ return price - coupon * quasi.fraction(issue, settlement);
16746
+ }
16747
+ function firstOf2(args) {
16748
+ const [settlement, maturity, issue, firstCoupon] = [0, 1, 2, 3].map(
16749
+ (i2) => Math.floor(serialArg(args[i2]))
16750
+ );
16751
+ const frequency2 = frequencyOf(args[7]);
16752
+ const first2 = {
16753
+ settlement,
16754
+ maturity,
16755
+ issue,
16756
+ firstCoupon,
16757
+ rate: num2(args[4]),
16758
+ redemption: num2(args[6]),
16759
+ frequency: frequency2,
16760
+ basis: basisOf2(args, 8)
16761
+ };
16762
+ if (!(maturity > firstCoupon && firstCoupon > settlement && settlement > issue)) fail(ERR.NUM);
16763
+ if (first2.rate < 0 || first2.redemption <= 0) fail(ERR.NUM);
16764
+ return first2;
16765
+ }
16766
+ function lastOf(args, ctx) {
16767
+ const [settlement, maturity, lastInterest] = [0, 1, 2].map(
16768
+ (i2) => Math.floor(serialArg(args[i2]))
16769
+ );
16770
+ const frequency2 = frequencyOf(args[6]);
16771
+ const last = {
16772
+ settlement,
16773
+ maturity,
16774
+ lastInterest,
16775
+ rate: num2(args[3]),
16776
+ redemption: num2(args[5]),
16777
+ frequency: frequency2,
16778
+ cal: calendar2(
16779
+ quasiPeriods(lastInterest, lastInterest, maturity, frequency2, ctx),
16780
+ frequency2,
16781
+ basisOf2(args, 7),
16782
+ ctx
16783
+ )
16784
+ };
16785
+ if (!(maturity > settlement && settlement > lastInterest)) fail(ERR.NUM);
16786
+ if (last.rate < 0 || last.redemption <= 0) fail(ERR.NUM);
16787
+ return last;
16788
+ }
16789
+ function oddLastPrice(l, yld) {
16790
+ const coupon = 100 * l.rate / l.frequency;
16791
+ const full = l.redemption + coupon * l.cal.fraction(l.lastInterest, l.maturity);
16792
+ const discount2 = 1 + yld / l.frequency * l.cal.fraction(l.settlement, l.maturity);
16793
+ return full / discount2 - coupon * l.cal.fraction(l.lastInterest, l.settlement);
16794
+ }
16795
+ var ODD_SECURITY_FUNCTIONS = [
16796
+ spec(
16797
+ "ODDFPRICE",
16798
+ C11,
16799
+ "ODDFPRICE(settlement, maturity, issue, first_coupon, rate, yld, redemption, frequency, [basis])",
16800
+ "The price per 100 face value of a security with an odd first period.",
16801
+ 8,
16802
+ 9,
16803
+ (args, ctx) => {
16804
+ const first2 = firstOf2(args);
16805
+ const yld = num2(args[5]);
16806
+ if (yld < 0) fail(ERR.NUM);
16807
+ return oddFirstPrice(first2, yld, ctx);
16808
+ }
16809
+ ),
16810
+ spec(
16811
+ "ODDFYIELD",
16812
+ C11,
16813
+ "ODDFYIELD(settlement, maturity, issue, first_coupon, rate, pr, redemption, frequency, [basis])",
16814
+ "The yield of a security with an odd first period.",
16815
+ 8,
16816
+ 9,
16817
+ (args, ctx) => {
16818
+ const first2 = firstOf2(args);
16819
+ const price = num2(args[5]);
16820
+ if (price <= 0) fail(ERR.NUM);
16821
+ return solve((y) => oddFirstPrice(first2, y, ctx) - price, first2.rate || 0.05);
16822
+ }
16823
+ ),
16824
+ spec(
16825
+ "ODDLPRICE",
16826
+ C11,
16827
+ "ODDLPRICE(settlement, maturity, last_interest, rate, yld, redemption, frequency, [basis])",
16828
+ "The price per 100 face value of a security with an odd last period.",
16829
+ 7,
16830
+ 8,
16831
+ (args, ctx) => {
16832
+ const last = lastOf(args, ctx);
16833
+ const yld = num2(args[4]);
16834
+ if (yld < 0) fail(ERR.NUM);
16835
+ return oddLastPrice(last, yld);
16836
+ }
16837
+ ),
16838
+ spec(
16839
+ "ODDLYIELD",
16840
+ C11,
16841
+ "ODDLYIELD(settlement, maturity, last_interest, rate, pr, redemption, frequency, [basis])",
16842
+ "The yield of a security with an odd last period.",
16843
+ 7,
16844
+ 8,
16845
+ (args, ctx) => {
16846
+ const last = lastOf(args, ctx);
16847
+ const price = num2(args[4]);
16848
+ if (price <= 0) fail(ERR.NUM);
16849
+ const coupon = 100 * last.rate / last.frequency;
16850
+ const cal = last.cal;
16851
+ const dirty = price + coupon * cal.fraction(last.lastInterest, last.settlement);
16852
+ const full = last.redemption + coupon * cal.fraction(last.lastInterest, last.maturity);
16853
+ return (full - dirty) / dirty * (last.frequency / cal.fraction(last.settlement, last.maturity));
16854
+ }
16855
+ )
16856
+ ];
16857
+
16574
16858
  // xlsx/formula/functions/depreciation.ts
16575
- var C10 = "Financial";
16859
+ var C12 = "Financial";
16576
16860
  function variableDeclining(cost, salvage, life, start, end, factor, noSwitch) {
16577
16861
  let book = cost;
16578
16862
  let total2 = 0;
@@ -16590,7 +16874,7 @@ function variableDeclining(cost, salvage, life, start, end, factor, noSwitch) {
16590
16874
  var DEPRECIATION_FUNCTIONS = [
16591
16875
  numeric(
16592
16876
  "SLN",
16593
- C10,
16877
+ C12,
16594
16878
  "SLN(cost, salvage, life)",
16595
16879
  "Straight-line depreciation.",
16596
16880
  3,
@@ -16599,7 +16883,7 @@ var DEPRECIATION_FUNCTIONS = [
16599
16883
  ),
16600
16884
  numeric(
16601
16885
  "SYD",
16602
- C10,
16886
+ C12,
16603
16887
  "SYD(cost, salvage, life, per)",
16604
16888
  "Sum-of-years' digits depreciation.",
16605
16889
  4,
@@ -16611,7 +16895,7 @@ var DEPRECIATION_FUNCTIONS = [
16611
16895
  ),
16612
16896
  numeric(
16613
16897
  "DDB",
16614
- C10,
16898
+ C12,
16615
16899
  "DDB(cost, salvage, life, period, [factor])",
16616
16900
  "Double-declining balance depreciation.",
16617
16901
  4,
@@ -16625,7 +16909,7 @@ var DEPRECIATION_FUNCTIONS = [
16625
16909
  ),
16626
16910
  spec(
16627
16911
  "VDB",
16628
- C10,
16912
+ C12,
16629
16913
  "VDB(cost, salvage, life, start_period, end_period, [factor], [no_switch])",
16630
16914
  "Depreciation over any span of periods, switching to straight-line when that is larger.",
16631
16915
  5,
@@ -16649,7 +16933,7 @@ var DEPRECIATION_FUNCTIONS = [
16649
16933
  ),
16650
16934
  numeric(
16651
16935
  "DB",
16652
- C10,
16936
+ C12,
16653
16937
  "DB(cost, salvage, life, period, [month])",
16654
16938
  "Fixed-declining balance depreciation.",
16655
16939
  4,
@@ -16668,7 +16952,7 @@ var DEPRECIATION_FUNCTIONS = [
16668
16952
  ),
16669
16953
  numeric(
16670
16954
  "EFFECT",
16671
- C10,
16955
+ C12,
16672
16956
  "EFFECT(nominal_rate, npery)",
16673
16957
  "The effective annual interest rate.",
16674
16958
  2,
@@ -16681,7 +16965,7 @@ var DEPRECIATION_FUNCTIONS = [
16681
16965
  ),
16682
16966
  numeric(
16683
16967
  "NOMINAL",
16684
- C10,
16968
+ C12,
16685
16969
  "NOMINAL(effect_rate, npery)",
16686
16970
  "The nominal annual interest rate.",
16687
16971
  2,
@@ -16694,7 +16978,7 @@ var DEPRECIATION_FUNCTIONS = [
16694
16978
  ),
16695
16979
  numeric(
16696
16980
  "CUMIPMT",
16697
- C10,
16981
+ C12,
16698
16982
  "CUMIPMT(rate, nper, pv, start_period, end_period, type)",
16699
16983
  "Cumulative interest paid between periods.",
16700
16984
  6,
@@ -16703,7 +16987,7 @@ var DEPRECIATION_FUNCTIONS = [
16703
16987
  ),
16704
16988
  numeric(
16705
16989
  "CUMPRINC",
16706
- C10,
16990
+ C12,
16707
16991
  "CUMPRINC(rate, nper, pv, start_period, end_period, type)",
16708
16992
  "Cumulative principal paid between periods.",
16709
16993
  6,
@@ -16712,7 +16996,7 @@ var DEPRECIATION_FUNCTIONS = [
16712
16996
  ),
16713
16997
  numeric(
16714
16998
  "ISPMT",
16715
- C10,
16999
+ C12,
16716
17000
  "ISPMT(rate, per, nper, pv)",
16717
17001
  "Interest paid in a period of a straight-line loan.",
16718
17002
  4,
@@ -16724,7 +17008,7 @@ var DEPRECIATION_FUNCTIONS = [
16724
17008
  ),
16725
17009
  numeric(
16726
17010
  "PDURATION",
16727
- C10,
17011
+ C12,
16728
17012
  "PDURATION(rate, pv, fv)",
16729
17013
  "Periods required to reach a value.",
16730
17014
  3,
@@ -16736,7 +17020,7 @@ var DEPRECIATION_FUNCTIONS = [
16736
17020
  ),
16737
17021
  numeric(
16738
17022
  "RRI",
16739
- C10,
17023
+ C12,
16740
17024
  "RRI(nper, pv, fv)",
16741
17025
  "An equivalent interest rate for growth.",
16742
17026
  3,
@@ -16748,7 +17032,7 @@ var DEPRECIATION_FUNCTIONS = [
16748
17032
  ),
16749
17033
  spec(
16750
17034
  "FVSCHEDULE",
16751
- C10,
17035
+ C12,
16752
17036
  "FVSCHEDULE(principal, schedule)",
16753
17037
  "Future value with a schedule of rates.",
16754
17038
  2,
@@ -16758,7 +17042,7 @@ var DEPRECIATION_FUNCTIONS = [
16758
17042
  ),
16759
17043
  numeric(
16760
17044
  "DOLLARDE",
16761
- C10,
17045
+ C12,
16762
17046
  "DOLLARDE(fractional_dollar, fraction)",
16763
17047
  "Converts a fractional price to a decimal.",
16764
17048
  2,
@@ -16774,7 +17058,7 @@ var DEPRECIATION_FUNCTIONS = [
16774
17058
  ),
16775
17059
  numeric(
16776
17060
  "DOLLARFR",
16777
- C10,
17061
+ C12,
16778
17062
  "DOLLARFR(decimal_dollar, fraction)",
16779
17063
  "Converts a decimal price to a fraction.",
16780
17064
  2,
@@ -16791,8 +17075,8 @@ var DEPRECIATION_FUNCTIONS = [
16791
17075
  ];
16792
17076
 
16793
17077
  // xlsx/formula/functions/securities.ts
16794
- var C11 = "Financial";
16795
- var basisOf2 = (args, index3) => {
17078
+ var C13 = "Financial";
17079
+ var basisOf3 = (args, index3) => {
16796
17080
  const basis = args.length > index3 && args[index3] !== null ? int3(args[index3]) : 0;
16797
17081
  if (basis < 0 || basis > 4) fail(ERR.NUM);
16798
17082
  return basis;
@@ -16805,17 +17089,17 @@ function span(args) {
16805
17089
  var positive = (...values2) => {
16806
17090
  for (const v of values2) if (!(v > 0)) fail(ERR.NUM);
16807
17091
  };
16808
- var discount = (name, description, syntax, fn) => spec(name, C11, syntax, description, 4, 5, (args, ctx) => {
17092
+ var discount = (name, description, syntax, fn) => spec(name, C13, syntax, description, 4, 5, (args, ctx) => {
16809
17093
  const { s, m } = span(args);
16810
17094
  const [a2, b] = [num2(args[2]), num2(args[3])];
16811
17095
  positive(a2, b);
16812
- return fn(a2, b, yearFrac(s, m, basisOf2(args, 4), ctx));
17096
+ return fn(a2, b, yearFrac(s, m, basisOf3(args, 4), ctx));
16813
17097
  });
16814
- var atMaturity = (name, description, syntax, fn) => spec(name, C11, syntax, description, 5, 6, (args, ctx) => {
17098
+ var atMaturity = (name, description, syntax, fn) => spec(name, C13, syntax, description, 5, 6, (args, ctx) => {
16815
17099
  const { s, m } = span(args);
16816
17100
  const issue = Math.floor(serialArg(args[2]));
16817
17101
  const [rate, other] = [num2(args[3]), num2(args[4])];
16818
- const basis = basisOf2(args, 5);
17102
+ const basis = basisOf3(args, 5);
16819
17103
  if (issue > s || rate < 0 || other < 0) fail(ERR.NUM);
16820
17104
  return fn(
16821
17105
  rate,
@@ -16876,7 +17160,7 @@ var SECURITY_FUNCTIONS = [
16876
17160
  ),
16877
17161
  spec(
16878
17162
  "TBILLPRICE",
16879
- C11,
17163
+ C13,
16880
17164
  "TBILLPRICE(settlement, maturity, discount)",
16881
17165
  "The price per 100 face value of a Treasury bill.",
16882
17166
  3,
@@ -16891,7 +17175,7 @@ var SECURITY_FUNCTIONS = [
16891
17175
  ),
16892
17176
  spec(
16893
17177
  "TBILLYIELD",
16894
- C11,
17178
+ C13,
16895
17179
  "TBILLYIELD(settlement, maturity, pr)",
16896
17180
  "The yield of a Treasury bill.",
16897
17181
  3,
@@ -16905,7 +17189,7 @@ var SECURITY_FUNCTIONS = [
16905
17189
  ),
16906
17190
  spec(
16907
17191
  "TBILLEQ",
16908
- C11,
17192
+ C13,
16909
17193
  "TBILLEQ(settlement, maturity, discount)",
16910
17194
  "The bond-equivalent yield of a Treasury bill.",
16911
17195
  3,
@@ -16924,7 +17208,7 @@ var SECURITY_FUNCTIONS = [
16924
17208
  ];
16925
17209
 
16926
17210
  // xlsx/formula/functions/financial.ts
16927
- var C12 = "Financial";
17211
+ var C15 = "Financial";
16928
17212
  var npv = (rate, values2) => values2.reduce((acc, v, i2) => acc + v / Math.pow(1 + rate, i2 + 1), 0);
16929
17213
  function datedFlows(ctx, args) {
16930
17214
  const values2 = collectNumbers(ctx, [args[0] ?? null]);
@@ -16939,14 +17223,16 @@ var xnpv = (rate, values2, dates) => values2.reduce(
16939
17223
  0
16940
17224
  );
16941
17225
  var FINANCIAL_FUNCTIONS = [
17226
+ AMORDEGRC,
16942
17227
  AMORLINC,
17228
+ ...ODD_SECURITY_FUNCTIONS,
16943
17229
  ...DEPRECIATION_FUNCTIONS,
16944
17230
  ...COUPON_FUNCTIONS,
16945
17231
  ...BOND_FUNCTIONS,
16946
17232
  ...SECURITY_FUNCTIONS,
16947
17233
  numeric(
16948
17234
  "PMT",
16949
- C12,
17235
+ C15,
16950
17236
  "PMT(rate, nper, pv, [fv], [type])",
16951
17237
  "The payment for a loan.",
16952
17238
  3,
@@ -16955,7 +17241,7 @@ var FINANCIAL_FUNCTIONS = [
16955
17241
  ),
16956
17242
  numeric(
16957
17243
  "FV",
16958
- C12,
17244
+ C15,
16959
17245
  "FV(rate, nper, pmt, [pv], [type])",
16960
17246
  "The future value of an investment.",
16961
17247
  3,
@@ -16964,7 +17250,7 @@ var FINANCIAL_FUNCTIONS = [
16964
17250
  ),
16965
17251
  numeric(
16966
17252
  "PV",
16967
- C12,
17253
+ C15,
16968
17254
  "PV(rate, nper, pmt, [fv], [type])",
16969
17255
  "The present value of an investment.",
16970
17256
  3,
@@ -16973,7 +17259,7 @@ var FINANCIAL_FUNCTIONS = [
16973
17259
  ),
16974
17260
  numeric(
16975
17261
  "NPER",
16976
- C12,
17262
+ C15,
16977
17263
  "NPER(rate, pmt, pv, [fv], [type])",
16978
17264
  "The number of periods for an investment.",
16979
17265
  3,
@@ -16990,7 +17276,7 @@ var FINANCIAL_FUNCTIONS = [
16990
17276
  ),
16991
17277
  numeric(
16992
17278
  "IPMT",
16993
- C12,
17279
+ C15,
16994
17280
  "IPMT(rate, per, nper, pv, [fv], [type])",
16995
17281
  "The interest part of a payment.",
16996
17282
  4,
@@ -16999,7 +17285,7 @@ var FINANCIAL_FUNCTIONS = [
16999
17285
  ),
17000
17286
  numeric(
17001
17287
  "PPMT",
17002
- C12,
17288
+ C15,
17003
17289
  "PPMT(rate, per, nper, pv, [fv], [type])",
17004
17290
  "The principal part of a payment.",
17005
17291
  4,
@@ -17008,7 +17294,7 @@ var FINANCIAL_FUNCTIONS = [
17008
17294
  ),
17009
17295
  numeric(
17010
17296
  "RATE",
17011
- C12,
17297
+ C15,
17012
17298
  "RATE(nper, pmt, pv, [fv], [type], [guess])",
17013
17299
  "The interest rate per period.",
17014
17300
  3,
@@ -17021,7 +17307,7 @@ var FINANCIAL_FUNCTIONS = [
17021
17307
  ),
17022
17308
  spec(
17023
17309
  "NPV",
17024
- C12,
17310
+ C15,
17025
17311
  "NPV(rate, value1, [value2], ...)",
17026
17312
  "The net present value of cash flows.",
17027
17313
  2,
@@ -17031,7 +17317,7 @@ var FINANCIAL_FUNCTIONS = [
17031
17317
  ),
17032
17318
  spec(
17033
17319
  "IRR",
17034
- C12,
17320
+ C15,
17035
17321
  "IRR(values, [guess])",
17036
17322
  "The internal rate of return.",
17037
17323
  1,
@@ -17048,7 +17334,7 @@ var FINANCIAL_FUNCTIONS = [
17048
17334
  ),
17049
17335
  spec(
17050
17336
  "XNPV",
17051
- C12,
17337
+ C15,
17052
17338
  "XNPV(rate, values, dates)",
17053
17339
  "The net present value of dated cash flows.",
17054
17340
  3,
@@ -17061,7 +17347,7 @@ var FINANCIAL_FUNCTIONS = [
17061
17347
  ),
17062
17348
  spec(
17063
17349
  "XIRR",
17064
- C12,
17350
+ C15,
17065
17351
  "XIRR(values, dates, [guess])",
17066
17352
  "The internal rate of return of dated cash flows.",
17067
17353
  2,
@@ -17075,7 +17361,7 @@ var FINANCIAL_FUNCTIONS = [
17075
17361
  ),
17076
17362
  spec(
17077
17363
  "MIRR",
17078
- C12,
17364
+ C15,
17079
17365
  "MIRR(values, finance_rate, reinvest_rate)",
17080
17366
  "The modified internal rate of return.",
17081
17367
  3,
@@ -17105,7 +17391,7 @@ function sheetIndex(host, name) {
17105
17391
  }
17106
17392
 
17107
17393
  // xlsx/formula/functions/info.ts
17108
- var C13 = "Information";
17394
+ var C16 = "Information";
17109
17395
  var ERROR_NUMBERS = {
17110
17396
  "#NULL!": 1,
17111
17397
  "#DIV/0!": 2,
@@ -17118,7 +17404,7 @@ var ERROR_NUMBERS = {
17118
17404
  "#SPILL!": 9,
17119
17405
  "#CALC!": 14
17120
17406
  };
17121
- var is = (name, syntax, description, test) => spec(name, C13, syntax, description, 1, 1, (args) => test(scalar(args[0])));
17407
+ var is = (name, syntax, description, test) => spec(name, C16, syntax, description, 1, 1, (args) => test(scalar(args[0])));
17122
17408
  var parity = (v, odd) => {
17123
17409
  if (isError(v)) fail(v);
17124
17410
  if (typeof v === "boolean") fail(ERR.VALUE);
@@ -17155,7 +17441,7 @@ var INFO_FUNCTIONS = [
17155
17441
  is("ISODD", "ISODD(number)", "TRUE for odd numbers.", (v) => parity(v, true)),
17156
17442
  spec(
17157
17443
  "ISREF",
17158
- C13,
17444
+ C16,
17159
17445
  "ISREF(value)",
17160
17446
  "TRUE for references.",
17161
17447
  1,
@@ -17165,7 +17451,7 @@ var INFO_FUNCTIONS = [
17165
17451
  ),
17166
17452
  spec(
17167
17453
  "ISFORMULA",
17168
- C13,
17454
+ C16,
17169
17455
  "ISFORMULA(reference)",
17170
17456
  "TRUE when a cell holds a formula.",
17171
17457
  1,
@@ -17179,17 +17465,17 @@ var INFO_FUNCTIONS = [
17179
17465
  },
17180
17466
  ["any"]
17181
17467
  ),
17182
- spec("N", C13, "N(value)", "A value converted to a number (text is 0).", 1, 1, (args) => {
17468
+ spec("N", C16, "N(value)", "A value converted to a number (text is 0).", 1, 1, (args) => {
17183
17469
  const v = scalar(args[0]);
17184
17470
  if (isError(v)) return v;
17185
17471
  if (typeof v === "number") return v;
17186
17472
  if (typeof v === "boolean") return v ? 1 : 0;
17187
17473
  return 0;
17188
17474
  }),
17189
- spec("NA", C13, "NA()", "The #N/A error value.", 0, 0, () => ERR.NA),
17475
+ spec("NA", C16, "NA()", "The #N/A error value.", 0, 0, () => ERR.NA),
17190
17476
  spec(
17191
17477
  "TYPE",
17192
- C13,
17478
+ C16,
17193
17479
  "TYPE(value)",
17194
17480
  "The type of a value: 1 number, 2 text, 4 logical, 16 error, 64 array.",
17195
17481
  1,
@@ -17201,13 +17487,13 @@ var INFO_FUNCTIONS = [
17201
17487
  },
17202
17488
  ["any"]
17203
17489
  ),
17204
- spec("ERROR.TYPE", C13, "ERROR.TYPE(error_val)", "The number of an error value.", 1, 1, (args) => {
17490
+ spec("ERROR.TYPE", C16, "ERROR.TYPE(error_val)", "The number of an error value.", 1, 1, (args) => {
17205
17491
  const v = scalar(args[0]);
17206
17492
  return isError(v) ? ERROR_NUMBERS[v.error] ?? ERR.NA : ERR.NA;
17207
17493
  }),
17208
17494
  spec(
17209
17495
  "SHEET",
17210
- C13,
17496
+ C16,
17211
17497
  "SHEET([value])",
17212
17498
  "The sheet number of a reference or sheet name.",
17213
17499
  0,
@@ -17223,7 +17509,7 @@ var INFO_FUNCTIONS = [
17223
17509
  ),
17224
17510
  spec(
17225
17511
  "SHEETS",
17226
- C13,
17512
+ C16,
17227
17513
  "SHEETS([reference])",
17228
17514
  "The number of sheets in a reference (or the workbook).",
17229
17515
  0,
@@ -17238,7 +17524,7 @@ var INFO_FUNCTIONS = [
17238
17524
  ),
17239
17525
  spec(
17240
17526
  "CELL",
17241
- C13,
17527
+ C16,
17242
17528
  "CELL(info_type, [reference])",
17243
17529
  "Information about a cell (address, row, col, contents, type, filename, sheet).",
17244
17530
  1,
@@ -17324,7 +17610,7 @@ function broadcastShape(operands, at) {
17324
17610
  }
17325
17611
 
17326
17612
  // xlsx/formula/functions/lambda.ts
17327
- var C15 = "Logical";
17613
+ var C17 = "Logical";
17328
17614
  function lambdaArg(value2) {
17329
17615
  if (!(value2 instanceof LambdaValue)) fail(ERR.VALUE);
17330
17616
  return value2;
@@ -17341,7 +17627,7 @@ function element(ctx, value2) {
17341
17627
  var LAMBDA_HELPERS = [
17342
17628
  spec(
17343
17629
  "MAP",
17344
- C15,
17630
+ C17,
17345
17631
  "MAP(array1, ..., lambda)",
17346
17632
  "Applies a LAMBDA to each value of arrays.",
17347
17633
  2,
@@ -17367,7 +17653,7 @@ var LAMBDA_HELPERS = [
17367
17653
  ),
17368
17654
  spec(
17369
17655
  "REDUCE",
17370
- C15,
17656
+ C17,
17371
17657
  "REDUCE([initial_value], array, lambda)",
17372
17658
  "Reduces an array to an accumulated value.",
17373
17659
  2,
@@ -17383,7 +17669,7 @@ var LAMBDA_HELPERS = [
17383
17669
  ),
17384
17670
  spec(
17385
17671
  "SCAN",
17386
- C15,
17672
+ C17,
17387
17673
  "SCAN([initial_value], array, lambda)",
17388
17674
  "The intermediate values of a reduction, as an array.",
17389
17675
  2,
@@ -17401,7 +17687,7 @@ var LAMBDA_HELPERS = [
17401
17687
  ),
17402
17688
  spec(
17403
17689
  "BYROW",
17404
- C15,
17690
+ C17,
17405
17691
  "BYROW(array, lambda)",
17406
17692
  "Applies a LAMBDA to each row, returning a column.",
17407
17693
  2,
@@ -17417,7 +17703,7 @@ var LAMBDA_HELPERS = [
17417
17703
  ),
17418
17704
  spec(
17419
17705
  "BYCOL",
17420
- C15,
17706
+ C17,
17421
17707
  "BYCOL(array, lambda)",
17422
17708
  "Applies a LAMBDA to each column, returning a row.",
17423
17709
  2,
@@ -17427,8 +17713,8 @@ var LAMBDA_HELPERS = [
17427
17713
  const array = ctx.toMatrix(args[0] ?? null);
17428
17714
  const out = [];
17429
17715
  for (let c2 = 0; c2 < array.cols; c2++) {
17430
- const column = new Matrix(array.data.map((row2) => [row2[c2] ?? null]));
17431
- out.push(element(ctx, ctx.callLambda(fn, [column])));
17716
+ const column2 = new Matrix(array.data.map((row2) => [row2[c2] ?? null]));
17717
+ out.push(element(ctx, ctx.callLambda(fn, [column2])));
17432
17718
  }
17433
17719
  return new Matrix([out]);
17434
17720
  },
@@ -17436,7 +17722,7 @@ var LAMBDA_HELPERS = [
17436
17722
  ),
17437
17723
  spec(
17438
17724
  "MAKEARRAY",
17439
- C15,
17725
+ C17,
17440
17726
  "MAKEARRAY(rows, columns, lambda)",
17441
17727
  "An array built by calling a LAMBDA for each position.",
17442
17728
  3,
@@ -17453,7 +17739,7 @@ var LAMBDA_HELPERS = [
17453
17739
  ];
17454
17740
 
17455
17741
  // xlsx/formula/functions/logical.ts
17456
- var C16 = "Logical";
17742
+ var C18 = "Logical";
17457
17743
  function deref(ctx, value2) {
17458
17744
  if (value2 instanceof RefValue) {
17459
17745
  if (value2.isCell()) {
@@ -17523,7 +17809,7 @@ function logicalValues(ctx, args) {
17523
17809
  if (out.length === 0) fail(ERR.VALUE);
17524
17810
  return out;
17525
17811
  }
17526
- var lazySpec = (name, syntax, description, minArgs, maxArgs, lazy, category = C16) => ({ name, category, syntax, description, minArgs, maxArgs, lazy });
17812
+ var lazySpec = (name, syntax, description, minArgs, maxArgs, lazy2, category = C18) => ({ name, category, syntax, description, minArgs, maxArgs, lazy: lazy2 });
17527
17813
  function localName(arg) {
17528
17814
  const node = arg?.node;
17529
17815
  if (!node || node.type !== "name" || node.prefix) fail(ERR.VALUE);
@@ -17617,7 +17903,7 @@ var LOGICAL_FUNCTIONS = [
17617
17903
  ),
17618
17904
  {
17619
17905
  name: "NOT",
17620
- category: C16,
17906
+ category: C18,
17621
17907
  syntax: "NOT(logical)",
17622
17908
  description: "Reverses a logical value.",
17623
17909
  minArgs: 1,
@@ -17626,7 +17912,7 @@ var LOGICAL_FUNCTIONS = [
17626
17912
  },
17627
17913
  {
17628
17914
  name: "TRUE",
17629
- category: C16,
17915
+ category: C18,
17630
17916
  syntax: "TRUE()",
17631
17917
  description: "The logical value TRUE.",
17632
17918
  minArgs: 0,
@@ -17635,7 +17921,7 @@ var LOGICAL_FUNCTIONS = [
17635
17921
  },
17636
17922
  {
17637
17923
  name: "FALSE",
17638
- category: C16,
17924
+ category: C18,
17639
17925
  syntax: "FALSE()",
17640
17926
  description: "The logical value FALSE.",
17641
17927
  minArgs: 0,
@@ -17670,6 +17956,18 @@ var LOGICAL_FUNCTIONS = [
17670
17956
  const params = args.slice(0, -1).map((a2) => localName(a2));
17671
17957
  return new LambdaValue(params, args[args.length - 1].node, ctx.frame.scope);
17672
17958
  }
17959
+ ),
17960
+ lazySpec(
17961
+ "ISOMITTED",
17962
+ "ISOMITTED(argument)",
17963
+ "Whether a LAMBDA argument was left out.",
17964
+ 1,
17965
+ 1,
17966
+ (args, ctx) => {
17967
+ const node = args[0].node;
17968
+ if (node.type !== "name") return ERR.VALUE;
17969
+ return ctx.frame.scope?.get(OMITTED_PREFIX + normalizeLocalName(node.name)) === true;
17970
+ }
17673
17971
  )
17674
17972
  ];
17675
17973
 
@@ -17902,7 +18200,7 @@ function parseR1C1Range(text, base) {
17902
18200
  }
17903
18201
 
17904
18202
  // xlsx/formula/functions/reference.ts
17905
- var C17 = "Lookup & Reference";
18203
+ var C19 = "Lookup & Reference";
17906
18204
  function refArg(value2) {
17907
18205
  if (value2 instanceof RefValue) return value2;
17908
18206
  if (isError(value2)) fail(value2);
@@ -17976,7 +18274,7 @@ var REFERENCE_FUNCTIONS = [
17976
18274
  {
17977
18275
  ...spec(
17978
18276
  "OFFSET",
17979
- C17,
18277
+ C19,
17980
18278
  "OFFSET(reference, rows, cols, [height], [width])",
17981
18279
  "A reference offset from a starting reference.",
17982
18280
  3,
@@ -17992,7 +18290,7 @@ var REFERENCE_FUNCTIONS = [
17992
18290
  },
17993
18291
  spec(
17994
18292
  "INDIRECT",
17995
- C17,
18293
+ C19,
17996
18294
  "INDIRECT(ref_text, [a1])",
17997
18295
  "The reference named by a text.",
17998
18296
  1,
@@ -18008,7 +18306,7 @@ var REFERENCE_FUNCTIONS = [
18008
18306
  ),
18009
18307
  spec(
18010
18308
  "ROW",
18011
- C17,
18309
+ C19,
18012
18310
  "ROW([reference])",
18013
18311
  "The row number of a reference.",
18014
18312
  0,
@@ -18018,7 +18316,7 @@ var REFERENCE_FUNCTIONS = [
18018
18316
  ),
18019
18317
  spec(
18020
18318
  "COLUMN",
18021
- C17,
18319
+ C19,
18022
18320
  "COLUMN([reference])",
18023
18321
  "The column number of a reference.",
18024
18322
  0,
@@ -18028,7 +18326,7 @@ var REFERENCE_FUNCTIONS = [
18028
18326
  ),
18029
18327
  spec(
18030
18328
  "ROWS",
18031
- C17,
18329
+ C19,
18032
18330
  "ROWS(array)",
18033
18331
  "The number of rows in a reference or array.",
18034
18332
  1,
@@ -18041,7 +18339,7 @@ var REFERENCE_FUNCTIONS = [
18041
18339
  ),
18042
18340
  spec(
18043
18341
  "COLUMNS",
18044
- C17,
18342
+ C19,
18045
18343
  "COLUMNS(array)",
18046
18344
  "The number of columns in a reference or array.",
18047
18345
  1,
@@ -18054,7 +18352,7 @@ var REFERENCE_FUNCTIONS = [
18054
18352
  ),
18055
18353
  spec(
18056
18354
  "AREAS",
18057
- C17,
18355
+ C19,
18058
18356
  "AREAS(reference)",
18059
18357
  "The number of areas in a reference.",
18060
18358
  1,
@@ -18065,7 +18363,7 @@ var REFERENCE_FUNCTIONS = [
18065
18363
  {
18066
18364
  ...spec(
18067
18365
  "ADDRESS",
18068
- C17,
18366
+ C19,
18069
18367
  "ADDRESS(row_num, column_num, [abs_num], [a1], [sheet_text])",
18070
18368
  "A cell address as text.",
18071
18369
  2,
@@ -18076,7 +18374,7 @@ var REFERENCE_FUNCTIONS = [
18076
18374
  },
18077
18375
  spec(
18078
18376
  "HYPERLINK",
18079
- C17,
18377
+ C19,
18080
18378
  "HYPERLINK(link_location, [friendly_name])",
18081
18379
  "A link; the cell shows the friendly name.",
18082
18380
  1,
@@ -18085,7 +18383,7 @@ var REFERENCE_FUNCTIONS = [
18085
18383
  ),
18086
18384
  spec(
18087
18385
  "ANCHORARRAY",
18088
- C17,
18386
+ C19,
18089
18387
  "ANCHORARRAY(reference)",
18090
18388
  "The spill range of a dynamic array formula (A1#).",
18091
18389
  1,
@@ -18105,7 +18403,7 @@ var REFERENCE_FUNCTIONS = [
18105
18403
  ),
18106
18404
  spec(
18107
18405
  "SINGLE",
18108
- C17,
18406
+ C19,
18109
18407
  "SINGLE(value)",
18110
18408
  "Implicit intersection (the @ operator).",
18111
18409
  1,
@@ -18115,7 +18413,7 @@ var REFERENCE_FUNCTIONS = [
18115
18413
  ),
18116
18414
  spec(
18117
18415
  "FORMULATEXT",
18118
- C17,
18416
+ C19,
18119
18417
  "FORMULATEXT(reference)",
18120
18418
  "The formula of a cell as text.",
18121
18419
  1,
@@ -18135,7 +18433,7 @@ var REFERENCE_FUNCTIONS = [
18135
18433
  ];
18136
18434
 
18137
18435
  // xlsx/formula/functions/lookup.ts
18138
- var C18 = "Lookup & Reference";
18436
+ var C20 = "Lookup & Reference";
18139
18437
  function cellOf(value2, row2, col) {
18140
18438
  if (value2 instanceof RefValue) {
18141
18439
  const area = value2.areas[0];
@@ -18267,7 +18565,7 @@ var LOOKUP_FUNCTIONS = [
18267
18565
  ...REFERENCE_FUNCTIONS,
18268
18566
  spec(
18269
18567
  "VLOOKUP",
18270
- C18,
18568
+ C20,
18271
18569
  "VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])",
18272
18570
  "Looks up a value in the first column of a table.",
18273
18571
  3,
@@ -18277,7 +18575,7 @@ var LOOKUP_FUNCTIONS = [
18277
18575
  ),
18278
18576
  spec(
18279
18577
  "HLOOKUP",
18280
- C18,
18578
+ C20,
18281
18579
  "HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])",
18282
18580
  "Looks up a value in the first row of a table.",
18283
18581
  3,
@@ -18287,7 +18585,7 @@ var LOOKUP_FUNCTIONS = [
18287
18585
  ),
18288
18586
  spec(
18289
18587
  "LOOKUP",
18290
- C18,
18588
+ C20,
18291
18589
  "LOOKUP(lookup_value, lookup_vector, [result_vector])",
18292
18590
  "Looks up a value in a sorted vector or array.",
18293
18591
  2,
@@ -18297,7 +18595,7 @@ var LOOKUP_FUNCTIONS = [
18297
18595
  ),
18298
18596
  spec(
18299
18597
  "MATCH",
18300
- C18,
18598
+ C20,
18301
18599
  "MATCH(lookup_value, lookup_array, [match_type])",
18302
18600
  "The position of a value in a range.",
18303
18601
  2,
@@ -18308,7 +18606,7 @@ var LOOKUP_FUNCTIONS = [
18308
18606
  {
18309
18607
  ...spec(
18310
18608
  "XMATCH",
18311
- C18,
18609
+ C20,
18312
18610
  "XMATCH(lookup_value, lookup_array, [match_mode], [search_mode])",
18313
18611
  "The position of a value with flexible matching.",
18314
18612
  2,
@@ -18330,7 +18628,7 @@ var LOOKUP_FUNCTIONS = [
18330
18628
  },
18331
18629
  spec(
18332
18630
  "XLOOKUP",
18333
- C18,
18631
+ C20,
18334
18632
  "XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])",
18335
18633
  "Searches a range and returns the matching item from another.",
18336
18634
  3,
@@ -18340,7 +18638,7 @@ var LOOKUP_FUNCTIONS = [
18340
18638
  ),
18341
18639
  spec(
18342
18640
  "INDEX",
18343
- C18,
18641
+ C20,
18344
18642
  "INDEX(array, row_num, [column_num], [area_num])",
18345
18643
  "The value or reference at a position.",
18346
18644
  1,
@@ -18350,7 +18648,7 @@ var LOOKUP_FUNCTIONS = [
18350
18648
  ),
18351
18649
  spec(
18352
18650
  "CHOOSE",
18353
- C18,
18651
+ C20,
18354
18652
  "CHOOSE(index_num, value1, [value2], ...)",
18355
18653
  "Chooses a value from a list by index.",
18356
18654
  2,
@@ -18554,7 +18852,7 @@ function liftCriteria(ctx, pairs, fn) {
18554
18852
  }
18555
18853
 
18556
18854
  // xlsx/formula/functions/math-sum.ts
18557
- var C19 = "Math & Trig";
18855
+ var C21 = "Math & Trig";
18558
18856
  var numbersOf = (values2) => values2.filter((v) => typeof v === "number");
18559
18857
  function sumProduct(ctx, args) {
18560
18858
  const matrices = args.map((a2) => ctx.toMatrix(a2));
@@ -18660,7 +18958,7 @@ function aggregate2(code, values2, k) {
18660
18958
  var SUM_FUNCTIONS = [
18661
18959
  spec(
18662
18960
  "SUM",
18663
- C19,
18961
+ C21,
18664
18962
  "SUM(number1, [number2], ...)",
18665
18963
  "Adds its arguments.",
18666
18964
  0,
@@ -18670,7 +18968,7 @@ var SUM_FUNCTIONS = [
18670
18968
  ),
18671
18969
  spec(
18672
18970
  "PRODUCT",
18673
- C19,
18971
+ C21,
18674
18972
  "PRODUCT(number1, [number2], ...)",
18675
18973
  "Multiplies its arguments.",
18676
18974
  1,
@@ -18683,7 +18981,7 @@ var SUM_FUNCTIONS = [
18683
18981
  ),
18684
18982
  spec(
18685
18983
  "SUMSQ",
18686
- C19,
18984
+ C21,
18687
18985
  "SUMSQ(number1, [number2], ...)",
18688
18986
  "The sum of the squares of the arguments.",
18689
18987
  1,
@@ -18693,7 +18991,7 @@ var SUM_FUNCTIONS = [
18693
18991
  ),
18694
18992
  spec(
18695
18993
  "SUMPRODUCT",
18696
- C19,
18994
+ C21,
18697
18995
  "SUMPRODUCT(array1, [array2], ...)",
18698
18996
  "The sum of the products of corresponding array elements.",
18699
18997
  1,
@@ -18703,7 +19001,7 @@ var SUM_FUNCTIONS = [
18703
19001
  ),
18704
19002
  spec(
18705
19003
  "SUMX2MY2",
18706
- C19,
19004
+ C21,
18707
19005
  "SUMX2MY2(array_x, array_y)",
18708
19006
  "Sum of the differences of squares.",
18709
19007
  2,
@@ -18713,7 +19011,7 @@ var SUM_FUNCTIONS = [
18713
19011
  ),
18714
19012
  spec(
18715
19013
  "SUMX2PY2",
18716
- C19,
19014
+ C21,
18717
19015
  "SUMX2PY2(array_x, array_y)",
18718
19016
  "Sum of the sums of squares.",
18719
19017
  2,
@@ -18723,7 +19021,7 @@ var SUM_FUNCTIONS = [
18723
19021
  ),
18724
19022
  spec(
18725
19023
  "SUMXMY2",
18726
- C19,
19024
+ C21,
18727
19025
  "SUMXMY2(array_x, array_y)",
18728
19026
  "Sum of the squares of differences.",
18729
19027
  2,
@@ -18733,7 +19031,7 @@ var SUM_FUNCTIONS = [
18733
19031
  ),
18734
19032
  spec(
18735
19033
  "SUMIF",
18736
- C19,
19034
+ C21,
18737
19035
  "SUMIF(range, criteria, [sum_range])",
18738
19036
  "Adds the cells that meet a criterion.",
18739
19037
  2,
@@ -18746,7 +19044,7 @@ var SUM_FUNCTIONS = [
18746
19044
  ),
18747
19045
  spec(
18748
19046
  "SUMIFS",
18749
- C19,
19047
+ C21,
18750
19048
  "SUMIFS(sum_range, criteria_range1, criteria1, ...)",
18751
19049
  "Adds the cells that meet several criteria.",
18752
19050
  3,
@@ -18760,7 +19058,7 @@ var SUM_FUNCTIONS = [
18760
19058
  ),
18761
19059
  spec(
18762
19060
  "SUBTOTAL",
18763
- C19,
19061
+ C21,
18764
19062
  "SUBTOTAL(function_num, ref1, ...)",
18765
19063
  "A subtotal (1-11 include hidden rows, 101-111 ignore them).",
18766
19064
  2,
@@ -18775,7 +19073,7 @@ var SUM_FUNCTIONS = [
18775
19073
  ),
18776
19074
  spec(
18777
19075
  "AGGREGATE",
18778
- C19,
19076
+ C21,
18779
19077
  "AGGREGATE(function_num, options, ref1, ...)",
18780
19078
  "An aggregate that can ignore hidden rows and errors.",
18781
19079
  3,
@@ -18815,14 +19113,14 @@ var SUM_FUNCTIONS = [
18815
19113
  ];
18816
19114
 
18817
19115
  // xlsx/formula/functions/math-more.ts
18818
- var C20 = "Math & Trig";
19116
+ var C22 = "Math & Trig";
18819
19117
  var MATH_MORE = [
18820
- numeric("SIN", C20, "SIN(number)", "The sine of an angle in radians.", 1, 1, Math.sin),
18821
- numeric("COS", C20, "COS(number)", "The cosine of an angle in radians.", 1, 1, Math.cos),
18822
- numeric("TAN", C20, "TAN(number)", "The tangent of an angle in radians.", 1, 1, Math.tan),
19118
+ numeric("SIN", C22, "SIN(number)", "The sine of an angle in radians.", 1, 1, Math.sin),
19119
+ numeric("COS", C22, "COS(number)", "The cosine of an angle in radians.", 1, 1, Math.cos),
19120
+ numeric("TAN", C22, "TAN(number)", "The tangent of an angle in radians.", 1, 1, Math.tan),
18823
19121
  numeric(
18824
19122
  "ASIN",
18825
- C20,
19123
+ C22,
18826
19124
  "ASIN(number)",
18827
19125
  "The arcsine in radians.",
18828
19126
  1,
@@ -18831,17 +19129,17 @@ var MATH_MORE = [
18831
19129
  ),
18832
19130
  numeric(
18833
19131
  "ACOS",
18834
- C20,
19132
+ C22,
18835
19133
  "ACOS(number)",
18836
19134
  "The arccosine in radians.",
18837
19135
  1,
18838
19136
  1,
18839
19137
  (x) => domain(Math.abs(x) <= 1, Math.acos(x))
18840
19138
  ),
18841
- numeric("ATAN", C20, "ATAN(number)", "The arctangent in radians.", 1, 1, Math.atan),
19139
+ numeric("ATAN", C22, "ATAN(number)", "The arctangent in radians.", 1, 1, Math.atan),
18842
19140
  numeric(
18843
19141
  "ATAN2",
18844
- C20,
19142
+ C22,
18845
19143
  "ATAN2(x_num, y_num)",
18846
19144
  "The arctangent of x and y coordinates.",
18847
19145
  2,
@@ -18851,13 +19149,13 @@ var MATH_MORE = [
18851
19149
  return Math.atan2(y ?? 0, x);
18852
19150
  }
18853
19151
  ),
18854
- numeric("SINH", C20, "SINH(number)", "The hyperbolic sine.", 1, 1, Math.sinh),
18855
- numeric("COSH", C20, "COSH(number)", "The hyperbolic cosine.", 1, 1, Math.cosh),
18856
- numeric("TANH", C20, "TANH(number)", "The hyperbolic tangent.", 1, 1, Math.tanh),
18857
- numeric("ASINH", C20, "ASINH(number)", "The inverse hyperbolic sine.", 1, 1, Math.asinh),
19152
+ numeric("SINH", C22, "SINH(number)", "The hyperbolic sine.", 1, 1, Math.sinh),
19153
+ numeric("COSH", C22, "COSH(number)", "The hyperbolic cosine.", 1, 1, Math.cosh),
19154
+ numeric("TANH", C22, "TANH(number)", "The hyperbolic tangent.", 1, 1, Math.tanh),
19155
+ numeric("ASINH", C22, "ASINH(number)", "The inverse hyperbolic sine.", 1, 1, Math.asinh),
18858
19156
  numeric(
18859
19157
  "ACOSH",
18860
- C20,
19158
+ C22,
18861
19159
  "ACOSH(number)",
18862
19160
  "The inverse hyperbolic cosine.",
18863
19161
  1,
@@ -18866,7 +19164,7 @@ var MATH_MORE = [
18866
19164
  ),
18867
19165
  numeric(
18868
19166
  "ATANH",
18869
- C20,
19167
+ C22,
18870
19168
  "ATANH(number)",
18871
19169
  "The inverse hyperbolic tangent.",
18872
19170
  1,
@@ -18875,7 +19173,7 @@ var MATH_MORE = [
18875
19173
  ),
18876
19174
  numeric(
18877
19175
  "COT",
18878
- C20,
19176
+ C22,
18879
19177
  "COT(number)",
18880
19178
  "The cotangent of an angle.",
18881
19179
  1,
@@ -18884,7 +19182,7 @@ var MATH_MORE = [
18884
19182
  ),
18885
19183
  numeric(
18886
19184
  "COTH",
18887
- C20,
19185
+ C22,
18888
19186
  "COTH(number)",
18889
19187
  "The hyperbolic cotangent.",
18890
19188
  1,
@@ -18893,7 +19191,7 @@ var MATH_MORE = [
18893
19191
  ),
18894
19192
  numeric(
18895
19193
  "CSC",
18896
- C20,
19194
+ C22,
18897
19195
  "CSC(number)",
18898
19196
  "The cosecant of an angle.",
18899
19197
  1,
@@ -18902,19 +19200,19 @@ var MATH_MORE = [
18902
19200
  ),
18903
19201
  numeric(
18904
19202
  "CSCH",
18905
- C20,
19203
+ C22,
18906
19204
  "CSCH(number)",
18907
19205
  "The hyperbolic cosecant.",
18908
19206
  1,
18909
19207
  1,
18910
19208
  (x) => x === 0 ? fail(ERR.DIV0) : 1 / Math.sinh(x)
18911
19209
  ),
18912
- numeric("SEC", C20, "SEC(number)", "The secant of an angle.", 1, 1, (x) => 1 / Math.cos(x)),
18913
- numeric("SECH", C20, "SECH(number)", "The hyperbolic secant.", 1, 1, (x) => 1 / Math.cosh(x)),
18914
- numeric("ACOT", C20, "ACOT(number)", "The arccotangent.", 1, 1, (x) => Math.PI / 2 - Math.atan(x)),
19210
+ numeric("SEC", C22, "SEC(number)", "The secant of an angle.", 1, 1, (x) => 1 / Math.cos(x)),
19211
+ numeric("SECH", C22, "SECH(number)", "The hyperbolic secant.", 1, 1, (x) => 1 / Math.cosh(x)),
19212
+ numeric("ACOT", C22, "ACOT(number)", "The arccotangent.", 1, 1, (x) => Math.PI / 2 - Math.atan(x)),
18915
19213
  numeric(
18916
19214
  "ACOTH",
18917
- C20,
19215
+ C22,
18918
19216
  "ACOTH(number)",
18919
19217
  "The inverse hyperbolic cotangent.",
18920
19218
  1,
@@ -18923,7 +19221,7 @@ var MATH_MORE = [
18923
19221
  ),
18924
19222
  numeric(
18925
19223
  "DEGREES",
18926
- C20,
19224
+ C22,
18927
19225
  "DEGREES(angle)",
18928
19226
  "Converts radians to degrees.",
18929
19227
  1,
@@ -18932,7 +19230,7 @@ var MATH_MORE = [
18932
19230
  ),
18933
19231
  numeric(
18934
19232
  "RADIANS",
18935
- C20,
19233
+ C22,
18936
19234
  "RADIANS(angle)",
18937
19235
  "Converts degrees to radians.",
18938
19236
  1,
@@ -18941,7 +19239,7 @@ var MATH_MORE = [
18941
19239
  ),
18942
19240
  spec(
18943
19241
  "RAND",
18944
- C20,
19242
+ C22,
18945
19243
  "RAND()",
18946
19244
  "A random number between 0 and 1.",
18947
19245
  0,
@@ -18952,7 +19250,7 @@ var MATH_MORE = [
18952
19250
  ),
18953
19251
  spec(
18954
19252
  "RANDBETWEEN",
18955
- C20,
19253
+ C22,
18956
19254
  "RANDBETWEEN(bottom, top)",
18957
19255
  "A random integer between two numbers.",
18958
19256
  2,
@@ -18968,7 +19266,7 @@ var MATH_MORE = [
18968
19266
  ),
18969
19267
  spec(
18970
19268
  "SERIESSUM",
18971
- C20,
19269
+ C22,
18972
19270
  "SERIESSUM(x, n, m, coefficients)",
18973
19271
  "The sum of a power series.",
18974
19272
  4,
@@ -18987,7 +19285,7 @@ var MATH_MORE = [
18987
19285
  ];
18988
19286
 
18989
19287
  // xlsx/formula/functions/math-combin.ts
18990
- var C21 = "Math & Trig";
19288
+ var C23 = "Math & Trig";
18991
19289
  var fact = (n) => {
18992
19290
  if (n < 0) fail(ERR.NUM);
18993
19291
  let out = 1;
@@ -19011,8 +19309,8 @@ function integers(args, ctx) {
19011
19309
  });
19012
19310
  }
19013
19311
  var COMBINATORIC_FUNCTIONS = [
19014
- numeric("FACT", C21, "FACT(number)", "The factorial of a number.", 1, 1, fact),
19015
- numeric("FACTDOUBLE", C21, "FACTDOUBLE(number)", "The double factorial of a number.", 1, 1, (n) => {
19312
+ numeric("FACT", C23, "FACT(number)", "The factorial of a number.", 1, 1, fact),
19313
+ numeric("FACTDOUBLE", C23, "FACTDOUBLE(number)", "The double factorial of a number.", 1, 1, (n) => {
19016
19314
  if (n < -1) fail(ERR.NUM);
19017
19315
  let out = 1;
19018
19316
  for (let i2 = Math.trunc(n); i2 > 1; i2 -= 2) out *= i2;
@@ -19020,7 +19318,7 @@ var COMBINATORIC_FUNCTIONS = [
19020
19318
  }),
19021
19319
  numeric(
19022
19320
  "COMBIN",
19023
- C21,
19321
+ C23,
19024
19322
  "COMBIN(number, number_chosen)",
19025
19323
  "The number of combinations.",
19026
19324
  2,
@@ -19029,7 +19327,7 @@ var COMBINATORIC_FUNCTIONS = [
19029
19327
  ),
19030
19328
  numeric(
19031
19329
  "COMBINA",
19032
- C21,
19330
+ C23,
19033
19331
  "COMBINA(number, number_chosen)",
19034
19332
  "Combinations with repetitions.",
19035
19333
  2,
@@ -19041,7 +19339,7 @@ var COMBINATORIC_FUNCTIONS = [
19041
19339
  ),
19042
19340
  spec(
19043
19341
  "MULTINOMIAL",
19044
- C21,
19342
+ C23,
19045
19343
  "MULTINOMIAL(number1, ...)",
19046
19344
  "The multinomial of a set of numbers.",
19047
19345
  1,
@@ -19055,7 +19353,7 @@ var COMBINATORIC_FUNCTIONS = [
19055
19353
  ),
19056
19354
  spec(
19057
19355
  "GCD",
19058
- C21,
19356
+ C23,
19059
19357
  "GCD(number1, ...)",
19060
19358
  "The greatest common divisor.",
19061
19359
  1,
@@ -19065,7 +19363,7 @@ var COMBINATORIC_FUNCTIONS = [
19065
19363
  ),
19066
19364
  spec(
19067
19365
  "LCM",
19068
- C21,
19366
+ C23,
19069
19367
  "LCM(number1, ...)",
19070
19368
  "The least common multiple.",
19071
19369
  1,
@@ -19113,7 +19411,7 @@ function mround(x, m) {
19113
19411
  }
19114
19412
 
19115
19413
  // xlsx/formula/functions/math.ts
19116
- var C22 = "Math & Trig";
19414
+ var C24 = "Math & Trig";
19117
19415
  function roundTo(x, digits2, mode) {
19118
19416
  if (!Number.isFinite(x)) return x;
19119
19417
  const d = Math.trunc(digits2);
@@ -19132,10 +19430,10 @@ var quotientMultiple = (x, sig, op2) => {
19132
19430
  var MATH_FUNCTIONS = [
19133
19431
  ...MATH_MORE,
19134
19432
  ...SUM_FUNCTIONS,
19135
- numeric("ABS", C22, "ABS(number)", "The absolute value of a number.", 1, 1, Math.abs),
19433
+ numeric("ABS", C24, "ABS(number)", "The absolute value of a number.", 1, 1, Math.abs),
19136
19434
  numeric(
19137
19435
  "SIGN",
19138
- C22,
19436
+ C24,
19139
19437
  "SIGN(number)",
19140
19438
  "The sign of a number: 1, 0 or -1.",
19141
19439
  1,
@@ -19144,7 +19442,7 @@ var MATH_FUNCTIONS = [
19144
19442
  ),
19145
19443
  numeric(
19146
19444
  "INT",
19147
- C22,
19445
+ C24,
19148
19446
  "INT(number)",
19149
19447
  "Rounds a number down to the nearest integer.",
19150
19448
  1,
@@ -19153,7 +19451,7 @@ var MATH_FUNCTIONS = [
19153
19451
  ),
19154
19452
  numeric(
19155
19453
  "TRUNC",
19156
- C22,
19454
+ C24,
19157
19455
  "TRUNC(number, [num_digits])",
19158
19456
  "Truncates a number toward zero.",
19159
19457
  1,
@@ -19162,7 +19460,7 @@ var MATH_FUNCTIONS = [
19162
19460
  ),
19163
19461
  numeric(
19164
19462
  "ROUND",
19165
- C22,
19463
+ C24,
19166
19464
  "ROUND(number, num_digits)",
19167
19465
  "Rounds a number to a number of digits.",
19168
19466
  2,
@@ -19171,7 +19469,7 @@ var MATH_FUNCTIONS = [
19171
19469
  ),
19172
19470
  numeric(
19173
19471
  "ROUNDUP",
19174
- C22,
19472
+ C24,
19175
19473
  "ROUNDUP(number, num_digits)",
19176
19474
  "Rounds a number away from zero.",
19177
19475
  2,
@@ -19180,7 +19478,7 @@ var MATH_FUNCTIONS = [
19180
19478
  ),
19181
19479
  numeric(
19182
19480
  "ROUNDDOWN",
19183
- C22,
19481
+ C24,
19184
19482
  "ROUNDDOWN(number, num_digits)",
19185
19483
  "Rounds a number toward zero.",
19186
19484
  2,
@@ -19189,7 +19487,7 @@ var MATH_FUNCTIONS = [
19189
19487
  ),
19190
19488
  numeric(
19191
19489
  "MROUND",
19192
- C22,
19490
+ C24,
19193
19491
  "MROUND(number, multiple)",
19194
19492
  "Rounds a number to the nearest multiple.",
19195
19493
  2,
@@ -19198,7 +19496,7 @@ var MATH_FUNCTIONS = [
19198
19496
  ),
19199
19497
  numeric(
19200
19498
  "CEILING",
19201
- C22,
19499
+ C24,
19202
19500
  "CEILING(number, significance)",
19203
19501
  "Rounds a number up to a multiple of significance.",
19204
19502
  2,
@@ -19210,7 +19508,7 @@ var MATH_FUNCTIONS = [
19210
19508
  ),
19211
19509
  numeric(
19212
19510
  "FLOOR",
19213
- C22,
19511
+ C24,
19214
19512
  "FLOOR(number, significance)",
19215
19513
  "Rounds a number down to a multiple of significance.",
19216
19514
  2,
@@ -19223,7 +19521,7 @@ var MATH_FUNCTIONS = [
19223
19521
  ),
19224
19522
  numeric(
19225
19523
  "CEILING.MATH",
19226
- C22,
19524
+ C24,
19227
19525
  "CEILING.MATH(number, [significance], [mode])",
19228
19526
  "Rounds a number up to an integer or multiple.",
19229
19527
  1,
@@ -19236,7 +19534,7 @@ var MATH_FUNCTIONS = [
19236
19534
  ),
19237
19535
  numeric(
19238
19536
  "FLOOR.MATH",
19239
- C22,
19537
+ C24,
19240
19538
  "FLOOR.MATH(number, [significance], [mode])",
19241
19539
  "Rounds a number down to an integer or multiple.",
19242
19540
  1,
@@ -19249,7 +19547,7 @@ var MATH_FUNCTIONS = [
19249
19547
  ),
19250
19548
  numeric(
19251
19549
  "CEILING.PRECISE",
19252
- C22,
19550
+ C24,
19253
19551
  "CEILING.PRECISE(number, [significance])",
19254
19552
  "Rounds a number up regardless of sign.",
19255
19553
  1,
@@ -19258,7 +19556,7 @@ var MATH_FUNCTIONS = [
19258
19556
  ),
19259
19557
  numeric(
19260
19558
  "ISO.CEILING",
19261
- C22,
19559
+ C24,
19262
19560
  "ISO.CEILING(number, [significance])",
19263
19561
  "Rounds a number up regardless of sign.",
19264
19562
  1,
@@ -19267,7 +19565,7 @@ var MATH_FUNCTIONS = [
19267
19565
  ),
19268
19566
  numeric(
19269
19567
  "FLOOR.PRECISE",
19270
- C22,
19568
+ C24,
19271
19569
  "FLOOR.PRECISE(number, [significance])",
19272
19570
  "Rounds a number down regardless of sign.",
19273
19571
  1,
@@ -19276,7 +19574,7 @@ var MATH_FUNCTIONS = [
19276
19574
  ),
19277
19575
  numeric(
19278
19576
  "EVEN",
19279
- C22,
19577
+ C24,
19280
19578
  "EVEN(number)",
19281
19579
  "Rounds a number away from zero to an even integer.",
19282
19580
  1,
@@ -19285,7 +19583,7 @@ var MATH_FUNCTIONS = [
19285
19583
  ),
19286
19584
  numeric(
19287
19585
  "ODD",
19288
- C22,
19586
+ C24,
19289
19587
  "ODD(number)",
19290
19588
  "Rounds a number away from zero to an odd integer.",
19291
19589
  1,
@@ -19297,7 +19595,7 @@ var MATH_FUNCTIONS = [
19297
19595
  ),
19298
19596
  numeric(
19299
19597
  "MOD",
19300
- C22,
19598
+ C24,
19301
19599
  "MOD(number, divisor)",
19302
19600
  "The remainder after division (sign of the divisor).",
19303
19601
  2,
@@ -19306,7 +19604,7 @@ var MATH_FUNCTIONS = [
19306
19604
  ),
19307
19605
  numeric(
19308
19606
  "QUOTIENT",
19309
- C22,
19607
+ C24,
19310
19608
  "QUOTIENT(numerator, denominator)",
19311
19609
  "The integer part of a division.",
19312
19610
  2,
@@ -19318,7 +19616,7 @@ var MATH_FUNCTIONS = [
19318
19616
  ),
19319
19617
  numeric(
19320
19618
  "SQRT",
19321
- C22,
19619
+ C24,
19322
19620
  "SQRT(number)",
19323
19621
  "The positive square root.",
19324
19622
  1,
@@ -19327,7 +19625,7 @@ var MATH_FUNCTIONS = [
19327
19625
  ),
19328
19626
  numeric(
19329
19627
  "SQRTPI",
19330
- C22,
19628
+ C24,
19331
19629
  "SQRTPI(number)",
19332
19630
  "The square root of number * pi.",
19333
19631
  1,
@@ -19336,18 +19634,18 @@ var MATH_FUNCTIONS = [
19336
19634
  ),
19337
19635
  numeric(
19338
19636
  "POWER",
19339
- C22,
19637
+ C24,
19340
19638
  "POWER(number, power)",
19341
19639
  "A number raised to a power.",
19342
19640
  2,
19343
19641
  2,
19344
19642
  (b, e) => power(b, e ?? 1)
19345
19643
  ),
19346
- numeric("EXP", C22, "EXP(number)", "e raised to a power.", 1, 1, Math.exp),
19347
- numeric("LN", C22, "LN(number)", "The natural logarithm.", 1, 1, (x) => domain(x > 0, Math.log(x))),
19644
+ numeric("EXP", C24, "EXP(number)", "e raised to a power.", 1, 1, Math.exp),
19645
+ numeric("LN", C24, "LN(number)", "The natural logarithm.", 1, 1, (x) => domain(x > 0, Math.log(x))),
19348
19646
  numeric(
19349
19647
  "LOG10",
19350
- C22,
19648
+ C24,
19351
19649
  "LOG10(number)",
19352
19650
  "The base-10 logarithm.",
19353
19651
  1,
@@ -19356,7 +19654,7 @@ var MATH_FUNCTIONS = [
19356
19654
  ),
19357
19655
  numeric(
19358
19656
  "LOG",
19359
- C22,
19657
+ C24,
19360
19658
  "LOG(number, [base])",
19361
19659
  "The logarithm to a base (10 by default).",
19362
19660
  1,
@@ -19368,12 +19666,12 @@ var MATH_FUNCTIONS = [
19368
19666
  return base === 10 ? Math.log10(x) : Math.log(x) / Math.log(base);
19369
19667
  }
19370
19668
  ),
19371
- numeric("PI", C22, "PI()", "The value of pi.", 0, 0, () => Math.PI),
19669
+ numeric("PI", C24, "PI()", "The value of pi.", 0, 0, () => Math.PI),
19372
19670
  ...COMBINATORIC_FUNCTIONS
19373
19671
  ];
19374
19672
 
19375
19673
  // xlsx/formula/functions/matrix.ts
19376
- var C23 = "Math & Trig";
19674
+ var C25 = "Math & Trig";
19377
19675
  function numbers2(ctx, value2) {
19378
19676
  return ctx.toMatrix(value2 ?? null).data.map(
19379
19677
  (row2) => row2.map((v) => {
@@ -19432,7 +19730,7 @@ function eliminate(input, invert2) {
19432
19730
  var MATRIX_FUNCTIONS = [
19433
19731
  spec(
19434
19732
  "MMULT",
19435
- C23,
19733
+ C25,
19436
19734
  "MMULT(array1, array2)",
19437
19735
  "The matrix product of two arrays.",
19438
19736
  2,
@@ -19453,7 +19751,7 @@ var MATRIX_FUNCTIONS = [
19453
19751
  ),
19454
19752
  spec(
19455
19753
  "MDETERM",
19456
- C23,
19754
+ C25,
19457
19755
  "MDETERM(array)",
19458
19756
  "The determinant of a square matrix.",
19459
19757
  1,
@@ -19463,7 +19761,7 @@ var MATRIX_FUNCTIONS = [
19463
19761
  ),
19464
19762
  spec(
19465
19763
  "MINVERSE",
19466
- C23,
19764
+ C25,
19467
19765
  "MINVERSE(array)",
19468
19766
  "The inverse of a square matrix.",
19469
19767
  1,
@@ -19475,7 +19773,7 @@ var MATRIX_FUNCTIONS = [
19475
19773
  },
19476
19774
  ["any"]
19477
19775
  ),
19478
- spec("MUNIT", C23, "MUNIT(dimension)", "The identity matrix.", 1, 1, (args) => {
19776
+ spec("MUNIT", C25, "MUNIT(dimension)", "The identity matrix.", 1, 1, (args) => {
19479
19777
  const n = int3(args[0]);
19480
19778
  if (n < 1) fail(ERR.VALUE);
19481
19779
  return Matrix.build(n, n, (r, c2) => r === c2 ? 1 : 0);
@@ -19542,7 +19840,7 @@ function fitStatistics(fit) {
19542
19840
  }
19543
19841
 
19544
19842
  // xlsx/formula/functions/regression.ts
19545
- var C24 = "Statistical";
19843
+ var C26 = "Statistical";
19546
19844
  function numbersOf2(ctx, value2) {
19547
19845
  return ctx.toMatrix(value2 ?? null).data.map(
19548
19846
  (row2) => row2.map((v) => {
@@ -19552,22 +19850,22 @@ function numbersOf2(ctx, value2) {
19552
19850
  })
19553
19851
  );
19554
19852
  }
19555
- var asObservations = (m, column) => column ? m : (m[0] ?? []).map((_, c2) => m.map((row2) => row2[c2] ?? 0));
19853
+ var asObservations = (m, column2) => column2 ? m : (m[0] ?? []).map((_, c2) => m.map((row2) => row2[c2] ?? 0));
19556
19854
  function layout(ctx, args) {
19557
19855
  const ym = numbersOf2(ctx, args[0]);
19558
19856
  const rows = ym.length;
19559
19857
  const cols = ym[0]?.length ?? 0;
19560
19858
  if (rows === 0 || cols === 0 || rows > 1 && cols > 1) fail(ERR.REF);
19561
- const column = cols === 1;
19859
+ const column2 = cols === 1;
19562
19860
  const y = ym.flat();
19563
- if (omitted(args, 1)) return { y, x: y.map((_, i2) => [i2 + 1]), column };
19861
+ if (omitted(args, 1)) return { y, x: y.map((_, i2) => [i2 + 1]), column: column2 };
19564
19862
  const xm = numbersOf2(ctx, args[1]);
19565
- const x = asObservations(xm, column);
19863
+ const x = asObservations(xm, column2);
19566
19864
  if (x.length !== y.length) {
19567
19865
  if (xm.flat().length !== y.length) fail(ERR.REF);
19568
- return { y, x: xm.flat().map((v) => [v]), column };
19866
+ return { y, x: xm.flat().map((v) => [v]), column: column2 };
19569
19867
  }
19570
- return { y, x, column };
19868
+ return { y, x, column: column2 };
19571
19869
  }
19572
19870
  var withConst = (args, index3) => omitted(args, index3) ? true : bool(args[index3]);
19573
19871
  var row = (values2, width) => [
@@ -19611,7 +19909,7 @@ var ARGS = ["any"];
19611
19909
  var REGRESSION_FUNCTIONS = [
19612
19910
  spec(
19613
19911
  "LINEST",
19614
- C24,
19912
+ C26,
19615
19913
  "LINEST(known_y, [known_x], [const], [stats])",
19616
19914
  "The statistics of a straight-line (or multiple linear) least-squares fit.",
19617
19915
  1,
@@ -19625,7 +19923,7 @@ var REGRESSION_FUNCTIONS = [
19625
19923
  ),
19626
19924
  spec(
19627
19925
  "LOGEST",
19628
- C24,
19926
+ C26,
19629
19927
  "LOGEST(known_y, [known_x], [const], [stats])",
19630
19928
  "The statistics of an exponential-curve fit.",
19631
19929
  1,
@@ -19636,14 +19934,14 @@ var REGRESSION_FUNCTIONS = [
19636
19934
  const stats = !omitted(args, 3) && bool(args[3]);
19637
19935
  const table2 = coefficientTable(fit, stats, Math.exp);
19638
19936
  if (!stats) return table2;
19639
- const plain2 = coefficientTable(fit, true, (v) => v).data;
19640
- return new Matrix([table2.data[0] ?? [], ...plain2.slice(1)]);
19937
+ const plain3 = coefficientTable(fit, true, (v) => v).data;
19938
+ return new Matrix([table2.data[0] ?? [], ...plain3.slice(1)]);
19641
19939
  },
19642
19940
  ARGS
19643
19941
  ),
19644
19942
  spec(
19645
19943
  "TREND",
19646
- C24,
19944
+ C26,
19647
19945
  "TREND(known_y, [known_x], [new_x], [const])",
19648
19946
  "Values along a linear trend.",
19649
19947
  1,
@@ -19657,7 +19955,7 @@ var REGRESSION_FUNCTIONS = [
19657
19955
  ),
19658
19956
  spec(
19659
19957
  "GROWTH",
19660
- C24,
19958
+ C26,
19661
19959
  "GROWTH(known_y, [known_x], [new_x], [const])",
19662
19960
  "Values along an exponential trend.",
19663
19961
  1,
@@ -19678,15 +19976,15 @@ function gammaP(a2, x) {
19678
19976
  const lnPrefix = -x + a2 * Math.log(x) - gammaLn(a2);
19679
19977
  if (x < a2 + 1) {
19680
19978
  let ap = a2;
19681
- let sum2 = 1 / a2;
19682
- let del = sum2;
19979
+ let sum3 = 1 / a2;
19980
+ let del = sum3;
19683
19981
  for (let n = 0; n < 1e3; n++) {
19684
19982
  ap += 1;
19685
19983
  del *= x / ap;
19686
- sum2 += del;
19687
- if (Math.abs(del) < Math.abs(sum2) * EPS) break;
19984
+ sum3 += del;
19985
+ if (Math.abs(del) < Math.abs(sum3) * EPS) break;
19688
19986
  }
19689
- return sum2 * Math.exp(lnPrefix);
19987
+ return sum3 * Math.exp(lnPrefix);
19690
19988
  }
19691
19989
  let b = x + 1 - a2;
19692
19990
  let c2 = 1 / 1e-300;
@@ -19842,7 +20140,7 @@ var normDist = (x, m, s, cumulative2) => {
19842
20140
  };
19843
20141
 
19844
20142
  // xlsx/formula/functions/distributions-f.ts
19845
- var C25 = "Statistical";
20143
+ var C27 = "Statistical";
19846
20144
  var degrees = (...values2) => {
19847
20145
  for (const v of values2) if (v === void 0 || v < 1) fail(ERR.NUM);
19848
20146
  };
@@ -19901,7 +20199,7 @@ var negbinomPmf = (f6, s, p) => {
19901
20199
  var DISTRIBUTION_F = [
19902
20200
  numeric(
19903
20201
  "F.DIST",
19904
- C25,
20202
+ C27,
19905
20203
  "F.DIST(x, deg_freedom1, deg_freedom2, cumulative)",
19906
20204
  "The left-tailed F probability distribution.",
19907
20205
  4,
@@ -19917,7 +20215,7 @@ var DISTRIBUTION_F = [
19917
20215
  ...["F.DIST.RT", "FDIST"].map(
19918
20216
  (name) => numeric(
19919
20217
  name,
19920
- C25,
20218
+ C27,
19921
20219
  `${name}(x, deg_freedom1, deg_freedom2)`,
19922
20220
  "The right-tailed F probability distribution.",
19923
20221
  3,
@@ -19931,7 +20229,7 @@ var DISTRIBUTION_F = [
19931
20229
  ),
19932
20230
  numeric(
19933
20231
  "F.INV",
19934
- C25,
20232
+ C27,
19935
20233
  "F.INV(probability, deg_freedom1, deg_freedom2)",
19936
20234
  "The inverse of the left-tailed F distribution.",
19937
20235
  3,
@@ -19945,7 +20243,7 @@ var DISTRIBUTION_F = [
19945
20243
  ...["F.INV.RT", "FINV"].map(
19946
20244
  (name) => numeric(
19947
20245
  name,
19948
- C25,
20246
+ C27,
19949
20247
  `${name}(probability, deg_freedom1, deg_freedom2)`,
19950
20248
  "The inverse of the right-tailed F distribution.",
19951
20249
  3,
@@ -19960,7 +20258,7 @@ var DISTRIBUTION_F = [
19960
20258
  ...["BETA.INV", "BETAINV"].map(
19961
20259
  (name) => numeric(
19962
20260
  name,
19963
- C25,
20261
+ C27,
19964
20262
  `${name}(probability, alpha, beta, [A], [B])`,
19965
20263
  "The inverse of the cumulative beta distribution.",
19966
20264
  3,
@@ -19971,7 +20269,7 @@ var DISTRIBUTION_F = [
19971
20269
  ),
19972
20270
  numeric(
19973
20271
  "BETADIST",
19974
- C25,
20272
+ C27,
19975
20273
  "BETADIST(x, alpha, beta, [A], [B])",
19976
20274
  "The cumulative beta distribution.",
19977
20275
  3,
@@ -19985,7 +20283,7 @@ var DISTRIBUTION_F = [
19985
20283
  ...["GAMMA.INV", "GAMMAINV"].map(
19986
20284
  (name) => numeric(
19987
20285
  name,
19988
- C25,
20286
+ C27,
19989
20287
  `${name}(probability, alpha, beta)`,
19990
20288
  "The inverse of the gamma cumulative distribution.",
19991
20289
  3,
@@ -19995,7 +20293,7 @@ var DISTRIBUTION_F = [
19995
20293
  ),
19996
20294
  numeric(
19997
20295
  "GAMMADIST",
19998
- C25,
20296
+ C27,
19999
20297
  "GAMMADIST(x, alpha, beta, cumulative)",
20000
20298
  "The gamma distribution.",
20001
20299
  4,
@@ -20010,7 +20308,7 @@ var DISTRIBUTION_F = [
20010
20308
  ),
20011
20309
  numeric(
20012
20310
  "LOGINV",
20013
- C25,
20311
+ C27,
20014
20312
  "LOGINV(probability, mean, standard_dev)",
20015
20313
  "The inverse of the lognormal cumulative distribution.",
20016
20314
  3,
@@ -20023,7 +20321,7 @@ var DISTRIBUTION_F = [
20023
20321
  ),
20024
20322
  numeric(
20025
20323
  "LOGNORMDIST",
20026
- C25,
20324
+ C27,
20027
20325
  "LOGNORMDIST(x, mean, standard_dev)",
20028
20326
  "The cumulative lognormal distribution.",
20029
20327
  3,
@@ -20036,7 +20334,7 @@ var DISTRIBUTION_F = [
20036
20334
  ...["BINOM.INV", "CRITBINOM"].map(
20037
20335
  (name) => numeric(
20038
20336
  name,
20039
- C25,
20337
+ C27,
20040
20338
  `${name}(trials, probability_s, alpha)`,
20041
20339
  "The smallest value whose cumulative binomial distribution reaches the criterion.",
20042
20340
  3,
@@ -20046,7 +20344,7 @@ var DISTRIBUTION_F = [
20046
20344
  ),
20047
20345
  numeric(
20048
20346
  "BINOM.DIST.RANGE",
20049
- C25,
20347
+ C27,
20050
20348
  "BINOM.DIST.RANGE(trials, probability_s, number_s, [number_s2])",
20051
20349
  "The probability of a trial result within a range, from the binomial distribution.",
20052
20350
  3,
@@ -20064,7 +20362,7 @@ var DISTRIBUTION_F = [
20064
20362
  ),
20065
20363
  numeric(
20066
20364
  "HYPGEOMDIST",
20067
- C25,
20365
+ C27,
20068
20366
  "HYPGEOMDIST(sample_s, number_sample, population_s, number_pop)",
20069
20367
  "The hypergeometric distribution.",
20070
20368
  4,
@@ -20073,7 +20371,7 @@ var DISTRIBUTION_F = [
20073
20371
  ),
20074
20372
  numeric(
20075
20373
  "NEGBINOMDIST",
20076
- C25,
20374
+ C27,
20077
20375
  "NEGBINOMDIST(number_f, number_s, probability_s)",
20078
20376
  "The negative binomial distribution.",
20079
20377
  3,
@@ -20083,7 +20381,7 @@ var DISTRIBUTION_F = [
20083
20381
  ];
20084
20382
 
20085
20383
  // xlsx/formula/functions/statistical-shape.ts
20086
- var C26 = "Statistical";
20384
+ var C28 = "Statistical";
20087
20385
  function moments(values2) {
20088
20386
  const n = values2.length;
20089
20387
  return { n, m: mean(values2), s: stdev(values2, true) };
@@ -20100,7 +20398,7 @@ function frequency(data, bins) {
20100
20398
  var STATISTICAL_SHAPE = [
20101
20399
  spec(
20102
20400
  "GEOMEAN",
20103
- C26,
20401
+ C28,
20104
20402
  "GEOMEAN(number1, ...)",
20105
20403
  "The geometric mean.",
20106
20404
  1,
@@ -20114,7 +20412,7 @@ var STATISTICAL_SHAPE = [
20114
20412
  ),
20115
20413
  spec(
20116
20414
  "HARMEAN",
20117
- C26,
20415
+ C28,
20118
20416
  "HARMEAN(number1, ...)",
20119
20417
  "The harmonic mean.",
20120
20418
  1,
@@ -20128,7 +20426,7 @@ var STATISTICAL_SHAPE = [
20128
20426
  ),
20129
20427
  spec(
20130
20428
  "AVEDEV",
20131
- C26,
20429
+ C28,
20132
20430
  "AVEDEV(number1, ...)",
20133
20431
  "The mean absolute deviation from the mean.",
20134
20432
  1,
@@ -20143,7 +20441,7 @@ var STATISTICAL_SHAPE = [
20143
20441
  ),
20144
20442
  spec(
20145
20443
  "DEVSQ",
20146
- C26,
20444
+ C28,
20147
20445
  "DEVSQ(number1, ...)",
20148
20446
  "The sum of squared deviations from the mean.",
20149
20447
  1,
@@ -20156,7 +20454,7 @@ var STATISTICAL_SHAPE = [
20156
20454
  ),
20157
20455
  spec(
20158
20456
  "KURT",
20159
- C26,
20457
+ C28,
20160
20458
  "KURT(number1, ...)",
20161
20459
  "The kurtosis of a data set.",
20162
20460
  1,
@@ -20172,7 +20470,7 @@ var STATISTICAL_SHAPE = [
20172
20470
  ),
20173
20471
  spec(
20174
20472
  "SKEW",
20175
- C26,
20473
+ C28,
20176
20474
  "SKEW(number1, ...)",
20177
20475
  "The skewness of a distribution.",
20178
20476
  1,
@@ -20187,7 +20485,7 @@ var STATISTICAL_SHAPE = [
20187
20485
  ),
20188
20486
  spec(
20189
20487
  "SKEW.P",
20190
- C26,
20488
+ C28,
20191
20489
  "SKEW.P(number1, ...)",
20192
20490
  "The population skewness.",
20193
20491
  1,
@@ -20203,7 +20501,7 @@ var STATISTICAL_SHAPE = [
20203
20501
  ),
20204
20502
  numeric(
20205
20503
  "STANDARDIZE",
20206
- C26,
20504
+ C28,
20207
20505
  "STANDARDIZE(x, mean, standard_dev)",
20208
20506
  "A normalized value.",
20209
20507
  3,
@@ -20215,7 +20513,7 @@ var STATISTICAL_SHAPE = [
20215
20513
  ),
20216
20514
  spec(
20217
20515
  "TRIMMEAN",
20218
- C26,
20516
+ C28,
20219
20517
  "TRIMMEAN(array, percent)",
20220
20518
  "The mean of the interior of a data set.",
20221
20519
  2,
@@ -20231,7 +20529,7 @@ var STATISTICAL_SHAPE = [
20231
20529
  ),
20232
20530
  spec(
20233
20531
  "FREQUENCY",
20234
- C26,
20532
+ C28,
20235
20533
  "FREQUENCY(data_array, bins_array)",
20236
20534
  "How often values occur within ranges, as a vertical array.",
20237
20535
  2,
@@ -20241,7 +20539,7 @@ var STATISTICAL_SHAPE = [
20241
20539
  ),
20242
20540
  numeric(
20243
20541
  "PERMUT",
20244
- C26,
20542
+ C28,
20245
20543
  "PERMUT(number, number_chosen)",
20246
20544
  "The number of permutations.",
20247
20545
  2,
@@ -20257,7 +20555,7 @@ var STATISTICAL_SHAPE = [
20257
20555
  ),
20258
20556
  numeric(
20259
20557
  "PERMUTATIONA",
20260
- C26,
20558
+ C28,
20261
20559
  "PERMUTATIONA(number, number_chosen)",
20262
20560
  "Permutations with repetitions.",
20263
20561
  2,
@@ -20267,26 +20565,26 @@ var STATISTICAL_SHAPE = [
20267
20565
  return Math.pow(Math.trunc(n), Math.trunc(k ?? 0));
20268
20566
  }
20269
20567
  ),
20270
- numeric("FISHER", C26, "FISHER(x)", "The Fisher transformation.", 1, 1, (x) => {
20568
+ numeric("FISHER", C28, "FISHER(x)", "The Fisher transformation.", 1, 1, (x) => {
20271
20569
  if (x <= -1 || x >= 1) fail(ERR.NUM);
20272
20570
  return 0.5 * Math.log((1 + x) / (1 - x));
20273
20571
  }),
20274
20572
  numeric(
20275
20573
  "FISHERINV",
20276
- C26,
20574
+ C28,
20277
20575
  "FISHERINV(y)",
20278
20576
  "The inverse of the Fisher transformation.",
20279
20577
  1,
20280
20578
  1,
20281
20579
  (y) => Math.tanh(y)
20282
20580
  ),
20283
- numeric("GAMMA", C26, "GAMMA(number)", "The gamma function value.", 1, 1, (x) => {
20581
+ numeric("GAMMA", C28, "GAMMA(number)", "The gamma function value.", 1, 1, (x) => {
20284
20582
  if (x <= 0 && Number.isInteger(x)) fail(ERR.NUM);
20285
20583
  return gamma(x);
20286
20584
  }),
20287
20585
  numeric(
20288
20586
  "GAMMALN",
20289
- C26,
20587
+ C28,
20290
20588
  "GAMMALN(x)",
20291
20589
  "The natural logarithm of the gamma function.",
20292
20590
  1,
@@ -20295,7 +20593,7 @@ var STATISTICAL_SHAPE = [
20295
20593
  ),
20296
20594
  numeric(
20297
20595
  "GAMMALN.PRECISE",
20298
- C26,
20596
+ C28,
20299
20597
  "GAMMALN.PRECISE(x)",
20300
20598
  "The natural logarithm of the gamma function.",
20301
20599
  1,
@@ -20305,7 +20603,7 @@ var STATISTICAL_SHAPE = [
20305
20603
  ];
20306
20604
 
20307
20605
  // xlsx/formula/functions/statistical-more.ts
20308
- var C27 = "Statistical";
20606
+ var C29 = "Statistical";
20309
20607
  function pairedNumbers(ctx, a2, b) {
20310
20608
  const ma = ctx.toMatrix(a2).flat();
20311
20609
  const mb = ctx.toMatrix(b).flat();
@@ -20326,7 +20624,7 @@ function pairedNumbers(ctx, a2, b) {
20326
20624
  }
20327
20625
  var pairFn = (name, description, syntax, fn) => spec(
20328
20626
  name,
20329
- C27,
20627
+ C29,
20330
20628
  syntax,
20331
20629
  description,
20332
20630
  2,
@@ -20341,7 +20639,7 @@ var STATISTICAL_MORE = [
20341
20639
  ...STATISTICAL_SHAPE,
20342
20640
  spec(
20343
20641
  "MODE.MULT",
20344
- C27,
20642
+ C29,
20345
20643
  "MODE.MULT(number1, [number2], ...)",
20346
20644
  "A vertical array of the most frequent values.",
20347
20645
  1,
@@ -20423,7 +20721,7 @@ var STATISTICAL_MORE = [
20423
20721
  ...["FORECAST", "FORECAST.LINEAR"].map(
20424
20722
  (name) => spec(
20425
20723
  name,
20426
- C27,
20724
+ C29,
20427
20725
  `${name}(x, known_ys, known_xs)`,
20428
20726
  "Predicts a value along a linear trend.",
20429
20727
  3,
@@ -20440,7 +20738,7 @@ var STATISTICAL_MORE = [
20440
20738
  ];
20441
20739
 
20442
20740
  // xlsx/formula/functions/hypothesis-tests.ts
20443
- var C28 = "Statistical";
20741
+ var C30 = "Statistical";
20444
20742
  var ARRAYS = ["any"];
20445
20743
  var numbersOf3 = (ctx, value2) => collectNumbers(ctx, [value2 ?? null]);
20446
20744
  function tStatistic(a2, b, type) {
@@ -20525,7 +20823,7 @@ var HYPOTHESIS_TESTS = [
20525
20823
  ["Z.TEST", "ZTEST"],
20526
20824
  (name) => spec(
20527
20825
  name,
20528
- C28,
20826
+ C30,
20529
20827
  `${name}(array, x, [sigma])`,
20530
20828
  "The one-tailed P-value of a z-test.",
20531
20829
  2,
@@ -20544,7 +20842,7 @@ var HYPOTHESIS_TESTS = [
20544
20842
  ["T.TEST", "TTEST"],
20545
20843
  (name) => spec(
20546
20844
  name,
20547
- C28,
20845
+ C30,
20548
20846
  `${name}(array1, array2, tails, type)`,
20549
20847
  "The probability associated with a Student's t-test.",
20550
20848
  4,
@@ -20565,7 +20863,7 @@ var HYPOTHESIS_TESTS = [
20565
20863
  ["F.TEST", "FTEST"],
20566
20864
  (name) => spec(
20567
20865
  name,
20568
- C28,
20866
+ C30,
20569
20867
  `${name}(array1, array2)`,
20570
20868
  "The two-tailed probability that the variances of two arrays are not different.",
20571
20869
  2,
@@ -20578,7 +20876,7 @@ var HYPOTHESIS_TESTS = [
20578
20876
  ["CHISQ.TEST", "CHITEST"],
20579
20877
  (name) => spec(
20580
20878
  name,
20581
- C28,
20879
+ C30,
20582
20880
  `${name}(actual_range, expected_range)`,
20583
20881
  "The chi-squared test of independence.",
20584
20882
  2,
@@ -20589,7 +20887,7 @@ var HYPOTHESIS_TESTS = [
20589
20887
  ),
20590
20888
  spec(
20591
20889
  "PROB",
20592
- C28,
20890
+ C30,
20593
20891
  "PROB(x_range, prob_range, lower_limit, [upper_limit])",
20594
20892
  "The probability that values in a range are between two limits.",
20595
20893
  3,
@@ -20600,7 +20898,7 @@ var HYPOTHESIS_TESTS = [
20600
20898
  ];
20601
20899
 
20602
20900
  // xlsx/formula/functions/statistical-spread.ts
20603
- var C29 = "Statistical";
20901
+ var C31 = "Statistical";
20604
20902
  var STATISTICAL_SPREAD = [
20605
20903
  ...[
20606
20904
  ["STDEV", true, false],
@@ -20612,7 +20910,7 @@ var STATISTICAL_SPREAD = [
20612
20910
  ].map(
20613
20911
  ([name, sample, a2]) => spec(
20614
20912
  name,
20615
- C29,
20913
+ C31,
20616
20914
  `${name}(number1, [number2], ...)`,
20617
20915
  `The ${sample ? "sample" : "population"} standard deviation${a2 ? " counting logicals and text" : ""}.`,
20618
20916
  1,
@@ -20631,7 +20929,7 @@ var STATISTICAL_SPREAD = [
20631
20929
  ].map(
20632
20930
  ([name, sample, a2]) => spec(
20633
20931
  name,
20634
- C29,
20932
+ C31,
20635
20933
  `${name}(number1, [number2], ...)`,
20636
20934
  `The ${sample ? "sample" : "population"} variance${a2 ? " counting logicals and text" : ""}.`,
20637
20935
  1,
@@ -20643,7 +20941,7 @@ var STATISTICAL_SPREAD = [
20643
20941
  ...["PERCENTILE", "PERCENTILE.INC", "PERCENTILE.EXC"].map(
20644
20942
  (name) => spec(
20645
20943
  name,
20646
- C29,
20944
+ C31,
20647
20945
  `${name}(array, k)`,
20648
20946
  "The k-th percentile.",
20649
20947
  2,
@@ -20659,7 +20957,7 @@ var STATISTICAL_SPREAD = [
20659
20957
  ...["QUARTILE", "QUARTILE.INC", "QUARTILE.EXC"].map(
20660
20958
  (name) => spec(
20661
20959
  name,
20662
- C29,
20960
+ C31,
20663
20961
  `${name}(array, quart)`,
20664
20962
  "A quartile of a data set.",
20665
20963
  2,
@@ -20671,7 +20969,7 @@ var STATISTICAL_SPREAD = [
20671
20969
  ...["PERCENTRANK", "PERCENTRANK.INC", "PERCENTRANK.EXC"].map(
20672
20970
  (name) => spec(
20673
20971
  name,
20674
- C29,
20972
+ C31,
20675
20973
  `${name}(array, x, [significance])`,
20676
20974
  "The rank of a value as a percentage of the data set.",
20677
20975
  2,
@@ -20688,7 +20986,7 @@ var STATISTICAL_SPREAD = [
20688
20986
  ];
20689
20987
 
20690
20988
  // xlsx/formula/functions/statistical-count.ts
20691
- var C30 = "Statistical";
20989
+ var C32 = "Statistical";
20692
20990
  function count(ctx, args) {
20693
20991
  let n = 0;
20694
20992
  for (const arg of args) {
@@ -20754,7 +21052,7 @@ function countIf(ctx, range, criteria) {
20754
21052
  var COUNT_FUNCTIONS = [
20755
21053
  spec(
20756
21054
  "COUNT",
20757
- C30,
21055
+ C32,
20758
21056
  "COUNT(value1, [value2], ...)",
20759
21057
  "Counts the numbers in the arguments.",
20760
21058
  0,
@@ -20764,7 +21062,7 @@ var COUNT_FUNCTIONS = [
20764
21062
  ),
20765
21063
  spec(
20766
21064
  "COUNTA",
20767
- C30,
21065
+ C32,
20768
21066
  "COUNTA(value1, [value2], ...)",
20769
21067
  "Counts the non-empty values.",
20770
21068
  1,
@@ -20774,7 +21072,7 @@ var COUNT_FUNCTIONS = [
20774
21072
  ),
20775
21073
  spec(
20776
21074
  "COUNTBLANK",
20777
- C30,
21075
+ C32,
20778
21076
  "COUNTBLANK(range)",
20779
21077
  "Counts the empty cells in a range.",
20780
21078
  1,
@@ -20784,7 +21082,7 @@ var COUNT_FUNCTIONS = [
20784
21082
  ),
20785
21083
  spec(
20786
21084
  "COUNTIF",
20787
- C30,
21085
+ C32,
20788
21086
  "COUNTIF(range, criteria)",
20789
21087
  "Counts the cells that meet a criterion.",
20790
21088
  2,
@@ -20794,7 +21092,7 @@ var COUNT_FUNCTIONS = [
20794
21092
  ),
20795
21093
  spec(
20796
21094
  "COUNTIFS",
20797
- C30,
21095
+ C32,
20798
21096
  "COUNTIFS(criteria_range1, criteria1, ...)",
20799
21097
  "Counts the cells that meet several criteria.",
20800
21098
  2,
@@ -20807,7 +21105,7 @@ var COUNT_FUNCTIONS = [
20807
21105
  ),
20808
21106
  spec(
20809
21107
  "AVERAGE",
20810
- C30,
21108
+ C32,
20811
21109
  "AVERAGE(number1, [number2], ...)",
20812
21110
  "The arithmetic mean.",
20813
21111
  1,
@@ -20818,7 +21116,7 @@ var COUNT_FUNCTIONS = [
20818
21116
  ];
20819
21117
 
20820
21118
  // xlsx/formula/functions/statistical.ts
20821
- var C31 = "Statistical";
21119
+ var C33 = "Statistical";
20822
21120
  var numbersOf4 = (values2) => values2.filter((v) => typeof v === "number");
20823
21121
  var extreme2 = extreme;
20824
21122
  var STATISTICAL_FUNCTIONS = [
@@ -20829,7 +21127,7 @@ var STATISTICAL_FUNCTIONS = [
20829
21127
  ...COUNT_FUNCTIONS,
20830
21128
  spec(
20831
21129
  "AVERAGEA",
20832
- C31,
21130
+ C33,
20833
21131
  "AVERAGEA(value1, [value2], ...)",
20834
21132
  "The mean counting text as 0 and logicals.",
20835
21133
  1,
@@ -20839,7 +21137,7 @@ var STATISTICAL_FUNCTIONS = [
20839
21137
  ),
20840
21138
  spec(
20841
21139
  "AVERAGEIF",
20842
- C31,
21140
+ C33,
20843
21141
  "AVERAGEIF(range, criteria, [average_range])",
20844
21142
  "The mean of the cells that meet a criterion.",
20845
21143
  2,
@@ -20858,7 +21156,7 @@ var STATISTICAL_FUNCTIONS = [
20858
21156
  ),
20859
21157
  spec(
20860
21158
  "AVERAGEIFS",
20861
- C31,
21159
+ C33,
20862
21160
  "AVERAGEIFS(average_range, criteria_range1, criteria1, ...)",
20863
21161
  "The mean of the cells that meet several criteria.",
20864
21162
  3,
@@ -20872,7 +21170,7 @@ var STATISTICAL_FUNCTIONS = [
20872
21170
  ),
20873
21171
  spec(
20874
21172
  "MAX",
20875
- C31,
21173
+ C33,
20876
21174
  "MAX(number1, [number2], ...)",
20877
21175
  "The largest value.",
20878
21176
  1,
@@ -20882,7 +21180,7 @@ var STATISTICAL_FUNCTIONS = [
20882
21180
  ),
20883
21181
  spec(
20884
21182
  "MIN",
20885
- C31,
21183
+ C33,
20886
21184
  "MIN(number1, [number2], ...)",
20887
21185
  "The smallest value.",
20888
21186
  1,
@@ -20892,7 +21190,7 @@ var STATISTICAL_FUNCTIONS = [
20892
21190
  ),
20893
21191
  spec(
20894
21192
  "MAXA",
20895
- C31,
21193
+ C33,
20896
21194
  "MAXA(value1, [value2], ...)",
20897
21195
  "The largest value counting logicals and text.",
20898
21196
  1,
@@ -20902,7 +21200,7 @@ var STATISTICAL_FUNCTIONS = [
20902
21200
  ),
20903
21201
  spec(
20904
21202
  "MINA",
20905
- C31,
21203
+ C33,
20906
21204
  "MINA(value1, [value2], ...)",
20907
21205
  "The smallest value counting logicals and text.",
20908
21206
  1,
@@ -20912,7 +21210,7 @@ var STATISTICAL_FUNCTIONS = [
20912
21210
  ),
20913
21211
  spec(
20914
21212
  "MAXIFS",
20915
- C31,
21213
+ C33,
20916
21214
  "MAXIFS(max_range, criteria_range1, criteria1, ...)",
20917
21215
  "The largest value meeting criteria.",
20918
21216
  3,
@@ -20926,7 +21224,7 @@ var STATISTICAL_FUNCTIONS = [
20926
21224
  ),
20927
21225
  spec(
20928
21226
  "MINIFS",
20929
- C31,
21227
+ C33,
20930
21228
  "MINIFS(min_range, criteria_range1, criteria1, ...)",
20931
21229
  "The smallest value meeting criteria.",
20932
21230
  3,
@@ -20940,7 +21238,7 @@ var STATISTICAL_FUNCTIONS = [
20940
21238
  ),
20941
21239
  spec(
20942
21240
  "MEDIAN",
20943
- C31,
21241
+ C33,
20944
21242
  "MEDIAN(number1, [number2], ...)",
20945
21243
  "The median.",
20946
21244
  1,
@@ -20950,7 +21248,7 @@ var STATISTICAL_FUNCTIONS = [
20950
21248
  ),
20951
21249
  spec(
20952
21250
  "MODE",
20953
- C31,
21251
+ C33,
20954
21252
  "MODE(number1, [number2], ...)",
20955
21253
  "The most frequent value.",
20956
21254
  1,
@@ -20960,7 +21258,7 @@ var STATISTICAL_FUNCTIONS = [
20960
21258
  ),
20961
21259
  spec(
20962
21260
  "MODE.SNGL",
20963
- C31,
21261
+ C33,
20964
21262
  "MODE.SNGL(number1, [number2], ...)",
20965
21263
  "The most frequent value.",
20966
21264
  1,
@@ -20970,7 +21268,7 @@ var STATISTICAL_FUNCTIONS = [
20970
21268
  ),
20971
21269
  spec(
20972
21270
  "LARGE",
20973
- C31,
21271
+ C33,
20974
21272
  "LARGE(array, k)",
20975
21273
  "The k-th largest value.",
20976
21274
  2,
@@ -20980,7 +21278,7 @@ var STATISTICAL_FUNCTIONS = [
20980
21278
  ),
20981
21279
  spec(
20982
21280
  "SMALL",
20983
- C31,
21281
+ C33,
20984
21282
  "SMALL(array, k)",
20985
21283
  "The k-th smallest value.",
20986
21284
  2,
@@ -20991,7 +21289,7 @@ var STATISTICAL_FUNCTIONS = [
20991
21289
  ...["RANK", "RANK.EQ", "RANK.AVG"].map(
20992
21290
  (name) => spec(
20993
21291
  name,
20994
- C31,
21292
+ C33,
20995
21293
  `${name}(number, ref, [order])`,
20996
21294
  "The rank of a number in a list.",
20997
21295
  2,
@@ -21008,11 +21306,11 @@ var STATISTICAL_FUNCTIONS = [
21008
21306
  ];
21009
21307
 
21010
21308
  // xlsx/formula/functions/distributions-more.ts
21011
- var C32 = "Statistical";
21309
+ var C34 = "Statistical";
21012
21310
  var DISTRIBUTION_MORE = [
21013
21311
  numeric(
21014
21312
  "T.DIST",
21015
- C32,
21313
+ C34,
21016
21314
  "T.DIST(x, deg_freedom, cumulative)",
21017
21315
  "Student's left-tailed t-distribution.",
21018
21316
  3,
@@ -21024,7 +21322,7 @@ var DISTRIBUTION_MORE = [
21024
21322
  ),
21025
21323
  numeric(
21026
21324
  "T.DIST.RT",
21027
- C32,
21325
+ C34,
21028
21326
  "T.DIST.RT(x, deg_freedom)",
21029
21327
  "Student's right-tailed t-distribution.",
21030
21328
  2,
@@ -21036,7 +21334,7 @@ var DISTRIBUTION_MORE = [
21036
21334
  ),
21037
21335
  numeric(
21038
21336
  "T.DIST.2T",
21039
- C32,
21337
+ C34,
21040
21338
  "T.DIST.2T(x, deg_freedom)",
21041
21339
  "Student's two-tailed t-distribution.",
21042
21340
  2,
@@ -21048,7 +21346,7 @@ var DISTRIBUTION_MORE = [
21048
21346
  ),
21049
21347
  numeric(
21050
21348
  "TDIST",
21051
- C32,
21349
+ C34,
21052
21350
  "TDIST(x, deg_freedom, tails)",
21053
21351
  "Student's t-distribution.",
21054
21352
  3,
@@ -21060,7 +21358,7 @@ var DISTRIBUTION_MORE = [
21060
21358
  ),
21061
21359
  numeric(
21062
21360
  "T.INV",
21063
- C32,
21361
+ C34,
21064
21362
  "T.INV(probability, deg_freedom)",
21065
21363
  "The left-tailed inverse of Student's t-distribution.",
21066
21364
  2,
@@ -21075,7 +21373,7 @@ var DISTRIBUTION_MORE = [
21075
21373
  ...["T.INV.2T", "TINV"].map(
21076
21374
  (name) => numeric(
21077
21375
  name,
21078
- C32,
21376
+ C34,
21079
21377
  `${name}(probability, deg_freedom)`,
21080
21378
  "The two-tailed inverse of Student's t-distribution.",
21081
21379
  2,
@@ -21088,7 +21386,7 @@ var DISTRIBUTION_MORE = [
21088
21386
  ),
21089
21387
  numeric(
21090
21388
  "CHISQ.DIST",
21091
- C32,
21389
+ C34,
21092
21390
  "CHISQ.DIST(x, deg_freedom, cumulative)",
21093
21391
  "The chi-squared distribution.",
21094
21392
  3,
@@ -21102,7 +21400,7 @@ var DISTRIBUTION_MORE = [
21102
21400
  ...["CHISQ.DIST.RT", "CHIDIST"].map(
21103
21401
  (name) => numeric(
21104
21402
  name,
21105
- C32,
21403
+ C34,
21106
21404
  `${name}(x, deg_freedom)`,
21107
21405
  "The right-tailed chi-squared probability.",
21108
21406
  2,
@@ -21115,7 +21413,7 @@ var DISTRIBUTION_MORE = [
21115
21413
  ),
21116
21414
  numeric(
21117
21415
  "CHISQ.INV",
21118
- C32,
21416
+ C34,
21119
21417
  "CHISQ.INV(probability, deg_freedom)",
21120
21418
  "The inverse of the left-tailed chi-squared distribution.",
21121
21419
  2,
@@ -21128,7 +21426,7 @@ var DISTRIBUTION_MORE = [
21128
21426
  ...["CHISQ.INV.RT", "CHIINV"].map(
21129
21427
  (name) => numeric(
21130
21428
  name,
21131
- C32,
21429
+ C34,
21132
21430
  `${name}(probability, deg_freedom)`,
21133
21431
  "The inverse of the right-tailed chi-squared distribution.",
21134
21432
  2,
@@ -21141,7 +21439,7 @@ var DISTRIBUTION_MORE = [
21141
21439
  ),
21142
21440
  numeric(
21143
21441
  "BETA.DIST",
21144
- C32,
21442
+ C34,
21145
21443
  "BETA.DIST(x, alpha, beta, cumulative, [A], [B])",
21146
21444
  "The beta distribution.",
21147
21445
  4,
@@ -21161,7 +21459,7 @@ var DISTRIBUTION_MORE = [
21161
21459
  ),
21162
21460
  numeric(
21163
21461
  "NEGBINOM.DIST",
21164
- C32,
21462
+ C34,
21165
21463
  "NEGBINOM.DIST(number_f, number_s, probability_s, cumulative)",
21166
21464
  "The negative binomial distribution.",
21167
21465
  4,
@@ -21180,7 +21478,7 @@ var DISTRIBUTION_MORE = [
21180
21478
  ),
21181
21479
  numeric(
21182
21480
  "HYPGEOM.DIST",
21183
- C32,
21481
+ C34,
21184
21482
  "HYPGEOM.DIST(sample_s, number_sample, population_s, number_pop, cumulative)",
21185
21483
  "The hypergeometric distribution.",
21186
21484
  5,
@@ -21201,13 +21499,13 @@ var DISTRIBUTION_MORE = [
21201
21499
  ];
21202
21500
 
21203
21501
  // xlsx/formula/functions/distributions.ts
21204
- var C33 = "Statistical";
21502
+ var C35 = "Statistical";
21205
21503
  var DISTRIBUTION_FUNCTIONS = [
21206
21504
  ...DISTRIBUTION_MORE,
21207
21505
  ...DISTRIBUTION_F,
21208
21506
  numeric(
21209
21507
  "NORM.DIST",
21210
- C33,
21508
+ C35,
21211
21509
  "NORM.DIST(x, mean, standard_dev, cumulative)",
21212
21510
  "The normal distribution.",
21213
21511
  4,
@@ -21216,7 +21514,7 @@ var DISTRIBUTION_FUNCTIONS = [
21216
21514
  ),
21217
21515
  numeric(
21218
21516
  "NORMDIST",
21219
- C33,
21517
+ C35,
21220
21518
  "NORMDIST(x, mean, standard_dev, cumulative)",
21221
21519
  "The normal distribution.",
21222
21520
  4,
@@ -21225,7 +21523,7 @@ var DISTRIBUTION_FUNCTIONS = [
21225
21523
  ),
21226
21524
  numeric(
21227
21525
  "NORM.S.DIST",
21228
- C33,
21526
+ C35,
21229
21527
  "NORM.S.DIST(z, cumulative)",
21230
21528
  "The standard normal distribution.",
21231
21529
  2,
@@ -21234,7 +21532,7 @@ var DISTRIBUTION_FUNCTIONS = [
21234
21532
  ),
21235
21533
  numeric(
21236
21534
  "NORMSDIST",
21237
- C33,
21535
+ C35,
21238
21536
  "NORMSDIST(z)",
21239
21537
  "The standard normal cumulative distribution.",
21240
21538
  1,
@@ -21243,7 +21541,7 @@ var DISTRIBUTION_FUNCTIONS = [
21243
21541
  ),
21244
21542
  numeric(
21245
21543
  "NORM.INV",
21246
- C33,
21544
+ C35,
21247
21545
  "NORM.INV(probability, mean, standard_dev)",
21248
21546
  "The inverse of the normal cumulative distribution.",
21249
21547
  3,
@@ -21255,7 +21553,7 @@ var DISTRIBUTION_FUNCTIONS = [
21255
21553
  ),
21256
21554
  numeric(
21257
21555
  "NORMINV",
21258
- C33,
21556
+ C35,
21259
21557
  "NORMINV(probability, mean, standard_dev)",
21260
21558
  "The inverse of the normal cumulative distribution.",
21261
21559
  3,
@@ -21267,7 +21565,7 @@ var DISTRIBUTION_FUNCTIONS = [
21267
21565
  ),
21268
21566
  numeric(
21269
21567
  "NORM.S.INV",
21270
- C33,
21568
+ C35,
21271
21569
  "NORM.S.INV(probability)",
21272
21570
  "The inverse of the standard normal distribution.",
21273
21571
  1,
@@ -21276,17 +21574,17 @@ var DISTRIBUTION_FUNCTIONS = [
21276
21574
  ),
21277
21575
  numeric(
21278
21576
  "NORMSINV",
21279
- C33,
21577
+ C35,
21280
21578
  "NORMSINV(probability)",
21281
21579
  "The inverse of the standard normal distribution.",
21282
21580
  1,
21283
21581
  1,
21284
21582
  normInv
21285
21583
  ),
21286
- numeric("PHI", C33, "PHI(x)", "The standard normal density.", 1, 1, normPdf),
21584
+ numeric("PHI", C35, "PHI(x)", "The standard normal density.", 1, 1, normPdf),
21287
21585
  numeric(
21288
21586
  "GAUSS",
21289
- C33,
21587
+ C35,
21290
21588
  "GAUSS(z)",
21291
21589
  "The probability between the mean and z standard deviations.",
21292
21590
  1,
@@ -21324,7 +21622,7 @@ var DISTRIBUTION_FUNCTIONS = [
21324
21622
  ...["CONFIDENCE", "CONFIDENCE.NORM"].map(
21325
21623
  (name) => numeric(
21326
21624
  name,
21327
- C33,
21625
+ C35,
21328
21626
  `${name}(alpha, standard_dev, size)`,
21329
21627
  "The confidence interval for a population mean (normal).",
21330
21628
  3,
@@ -21339,7 +21637,7 @@ var DISTRIBUTION_FUNCTIONS = [
21339
21637
  ),
21340
21638
  numeric(
21341
21639
  "CONFIDENCE.T",
21342
- C33,
21640
+ C35,
21343
21641
  "CONFIDENCE.T(alpha, standard_dev, size)",
21344
21642
  "The confidence interval for a population mean (Student's t).",
21345
21643
  3,
@@ -21355,7 +21653,7 @@ var DISTRIBUTION_FUNCTIONS = [
21355
21653
  ...["BINOM.DIST", "BINOMDIST"].map(
21356
21654
  (name) => numeric(
21357
21655
  name,
21358
- C33,
21656
+ C35,
21359
21657
  `${name}(number_s, trials, probability_s, cumulative)`,
21360
21658
  "The binomial distribution probability.",
21361
21659
  4,
@@ -21366,7 +21664,7 @@ var DISTRIBUTION_FUNCTIONS = [
21366
21664
  ...["POISSON.DIST", "POISSON"].map(
21367
21665
  (name) => numeric(
21368
21666
  name,
21369
- C33,
21667
+ C35,
21370
21668
  `${name}(x, mean, cumulative)`,
21371
21669
  "The Poisson distribution.",
21372
21670
  3,
@@ -21377,7 +21675,7 @@ var DISTRIBUTION_FUNCTIONS = [
21377
21675
  ...["EXPON.DIST", "EXPONDIST"].map(
21378
21676
  (name) => numeric(
21379
21677
  name,
21380
- C33,
21678
+ C35,
21381
21679
  `${name}(x, lambda, cumulative)`,
21382
21680
  "The exponential distribution.",
21383
21681
  3,
@@ -21391,7 +21689,7 @@ var DISTRIBUTION_FUNCTIONS = [
21391
21689
  ),
21392
21690
  numeric(
21393
21691
  "LOGNORM.DIST",
21394
- C33,
21692
+ C35,
21395
21693
  "LOGNORM.DIST(x, mean, standard_dev, cumulative)",
21396
21694
  "The lognormal distribution.",
21397
21695
  4,
@@ -21404,7 +21702,7 @@ var DISTRIBUTION_FUNCTIONS = [
21404
21702
  ),
21405
21703
  numeric(
21406
21704
  "LOGNORM.INV",
21407
- C33,
21705
+ C35,
21408
21706
  "LOGNORM.INV(probability, mean, standard_dev)",
21409
21707
  "The inverse of the lognormal distribution.",
21410
21708
  3,
@@ -21417,7 +21715,7 @@ var DISTRIBUTION_FUNCTIONS = [
21417
21715
  ...["WEIBULL.DIST", "WEIBULL"].map(
21418
21716
  (name) => numeric(
21419
21717
  name,
21420
- C33,
21718
+ C35,
21421
21719
  `${name}(x, alpha, beta, cumulative)`,
21422
21720
  "The Weibull distribution.",
21423
21721
  4,
@@ -21433,7 +21731,7 @@ var DISTRIBUTION_FUNCTIONS = [
21433
21731
  ),
21434
21732
  numeric(
21435
21733
  "GAMMA.DIST",
21436
- C33,
21734
+ C35,
21437
21735
  "GAMMA.DIST(x, alpha, beta, cumulative)",
21438
21736
  "The gamma distribution.",
21439
21737
  4,
@@ -21449,7 +21747,7 @@ var DISTRIBUTION_FUNCTIONS = [
21449
21747
  ];
21450
21748
 
21451
21749
  // xlsx/formula/functions/text-convert.ts
21452
- var C34 = "Text";
21750
+ var C36 = "Text";
21453
21751
  var CP1252 = {
21454
21752
  128: 8364,
21455
21753
  130: 8218,
@@ -21494,7 +21792,7 @@ function fixed(value2, decimals, commas) {
21494
21792
  var TEXT_CONVERT = [
21495
21793
  spec(
21496
21794
  "TEXT",
21497
- C34,
21795
+ C36,
21498
21796
  "TEXT(value, format_text)",
21499
21797
  "Formats a value with a number format.",
21500
21798
  2,
@@ -21507,7 +21805,7 @@ var TEXT_CONVERT = [
21507
21805
  return formatValue(value2, str(args[1]), { date1904: ctx.date1904 }).text;
21508
21806
  }
21509
21807
  ),
21510
- spec("VALUE", C34, "VALUE(text)", "Converts text to a number.", 1, 1, (args) => {
21808
+ spec("VALUE", C36, "VALUE(text)", "Converts text to a number.", 1, 1, (args) => {
21511
21809
  const v = scalar(args[0]);
21512
21810
  if (typeof v === "number") return v;
21513
21811
  if (v === null) return 0;
@@ -21517,7 +21815,7 @@ var TEXT_CONVERT = [
21517
21815
  }),
21518
21816
  spec(
21519
21817
  "NUMBERVALUE",
21520
- C34,
21818
+ C36,
21521
21819
  "NUMBERVALUE(text, [decimal_separator], [group_separator])",
21522
21820
  "Converts text to a number with given separators.",
21523
21821
  1,
@@ -21544,7 +21842,7 @@ var TEXT_CONVERT = [
21544
21842
  ),
21545
21843
  spec(
21546
21844
  "FIXED",
21547
- C34,
21845
+ C36,
21548
21846
  "FIXED(number, [decimals], [no_commas])",
21549
21847
  "Formats a number as text with fixed decimals.",
21550
21848
  1,
@@ -21553,7 +21851,7 @@ var TEXT_CONVERT = [
21553
21851
  ),
21554
21852
  spec(
21555
21853
  "DOLLAR",
21556
- C34,
21854
+ C36,
21557
21855
  "DOLLAR(number, [decimals])",
21558
21856
  "Formats a number as currency text.",
21559
21857
  1,
@@ -21564,28 +21862,28 @@ var TEXT_CONVERT = [
21564
21862
  return value2 < 0 && text.replace(/[0.,]/g, "") !== "" ? `($${text})` : `$${text}`;
21565
21863
  }
21566
21864
  ),
21567
- spec("CHAR", C34, "CHAR(number)", "The character for a code (Windows-1252).", 1, 1, (args) => {
21865
+ spec("CHAR", C36, "CHAR(number)", "The character for a code (Windows-1252).", 1, 1, (args) => {
21568
21866
  const n = int3(args[0]);
21569
21867
  if (n < 1 || n > 255) fail(ERR.VALUE);
21570
21868
  return String.fromCharCode(CP1252[n] ?? n);
21571
21869
  }),
21572
- spec("CODE", C34, "CODE(text)", "The code of the first character (Windows-1252).", 1, 1, (args) => {
21870
+ spec("CODE", C36, "CODE(text)", "The code of the first character (Windows-1252).", 1, 1, (args) => {
21573
21871
  const text = str(args[0]);
21574
21872
  if (text === "") fail(ERR.VALUE);
21575
21873
  const code = text.charCodeAt(0);
21576
21874
  return CP1252_REVERSE.get(code) ?? (code <= 255 ? code : 63);
21577
21875
  }),
21578
- spec("UNICHAR", C34, "UNICHAR(number)", "The Unicode character for a code point.", 1, 1, (args) => {
21876
+ spec("UNICHAR", C36, "UNICHAR(number)", "The Unicode character for a code point.", 1, 1, (args) => {
21579
21877
  const n = int3(args[0]);
21580
21878
  if (n < 1 || n > 1114111) fail(ERR.VALUE);
21581
21879
  return String.fromCodePoint(n);
21582
21880
  }),
21583
- spec("UNICODE", C34, "UNICODE(text)", "The code point of the first character.", 1, 1, (args) => {
21881
+ spec("UNICODE", C36, "UNICODE(text)", "The code point of the first character.", 1, 1, (args) => {
21584
21882
  const text = str(args[0]);
21585
21883
  if (text === "") fail(ERR.VALUE);
21586
21884
  return text.codePointAt(0) ?? fail(ERR.VALUE);
21587
21885
  }),
21588
- spec("T", C34, "T(value)", "The text of a value, or empty text.", 1, 1, (args) => {
21886
+ spec("T", C36, "T(value)", "The text of a value, or empty text.", 1, 1, (args) => {
21589
21887
  const v = scalar(args[0]);
21590
21888
  if (isError(v)) return v;
21591
21889
  return typeof v === "string" ? v : "";
@@ -21635,7 +21933,7 @@ function right(text, n) {
21635
21933
  }
21636
21934
 
21637
21935
  // xlsx/formula/functions/text.ts
21638
- var C35 = "Text";
21936
+ var C37 = "Text";
21639
21937
  var MAX_TEXT = 32767;
21640
21938
  var limit = (text) => text.length > MAX_TEXT ? fail(ERR.VALUE) : text;
21641
21939
  function find(args, insensitive) {
@@ -21668,7 +21966,7 @@ var TEXT_FUNCTIONS = [
21668
21966
  ...TEXT_CONVERT,
21669
21967
  spec(
21670
21968
  "CONCATENATE",
21671
- C35,
21969
+ C37,
21672
21970
  "CONCATENATE(text1, [text2], ...)",
21673
21971
  "Joins text items.",
21674
21972
  1,
@@ -21677,7 +21975,7 @@ var TEXT_FUNCTIONS = [
21677
21975
  ),
21678
21976
  spec(
21679
21977
  "CONCAT",
21680
- C35,
21978
+ C37,
21681
21979
  "CONCAT(text1, [text2], ...)",
21682
21980
  "Joins text from items and ranges.",
21683
21981
  1,
@@ -21687,7 +21985,7 @@ var TEXT_FUNCTIONS = [
21687
21985
  ),
21688
21986
  spec(
21689
21987
  "TEXTJOIN",
21690
- C35,
21988
+ C37,
21691
21989
  "TEXTJOIN(delimiter, ignore_empty, text1, ...)",
21692
21990
  "Joins text with a delimiter.",
21693
21991
  3,
@@ -21706,14 +22004,14 @@ var TEXT_FUNCTIONS = [
21706
22004
  ["any"]
21707
22005
  ),
21708
22006
  ...["LEFT", "LEFTB"].map(
21709
- (name) => spec(name, C35, `${name}(text, [num_chars])`, "The first characters of a text.", 1, 2, (args) => {
22007
+ (name) => spec(name, C37, `${name}(text, [num_chars])`, "The first characters of a text.", 1, 2, (args) => {
21710
22008
  const n = optNum(args, 1, 1);
21711
22009
  if (n < 0) fail(ERR.VALUE);
21712
22010
  return left(str(args[0]), Math.trunc(n));
21713
22011
  })
21714
22012
  ),
21715
22013
  ...["RIGHT", "RIGHTB"].map(
21716
- (name) => spec(name, C35, `${name}(text, [num_chars])`, "The last characters of a text.", 1, 2, (args) => {
22014
+ (name) => spec(name, C37, `${name}(text, [num_chars])`, "The last characters of a text.", 1, 2, (args) => {
21717
22015
  const n = Math.trunc(optNum(args, 1, 1));
21718
22016
  if (n < 0) fail(ERR.VALUE);
21719
22017
  return right(str(args[0]), n);
@@ -21722,7 +22020,7 @@ var TEXT_FUNCTIONS = [
21722
22020
  ...["MID", "MIDB"].map(
21723
22021
  (name) => spec(
21724
22022
  name,
21725
- C35,
22023
+ C37,
21726
22024
  `${name}(text, start_num, num_chars)`,
21727
22025
  "Characters from the middle of a text.",
21728
22026
  3,
@@ -21738,7 +22036,7 @@ var TEXT_FUNCTIONS = [
21738
22036
  ...["LEN", "LENB"].map(
21739
22037
  (name) => spec(
21740
22038
  name,
21741
- C35,
22039
+ C37,
21742
22040
  `${name}(text)`,
21743
22041
  "The number of characters in a text.",
21744
22042
  1,
@@ -21748,7 +22046,7 @@ var TEXT_FUNCTIONS = [
21748
22046
  ),
21749
22047
  spec(
21750
22048
  "LOWER",
21751
- C35,
22049
+ C37,
21752
22050
  "LOWER(text)",
21753
22051
  "Converts text to lower case.",
21754
22052
  1,
@@ -21757,7 +22055,7 @@ var TEXT_FUNCTIONS = [
21757
22055
  ),
21758
22056
  spec(
21759
22057
  "UPPER",
21760
- C35,
22058
+ C37,
21761
22059
  "UPPER(text)",
21762
22060
  "Converts text to upper case.",
21763
22061
  1,
@@ -21766,7 +22064,7 @@ var TEXT_FUNCTIONS = [
21766
22064
  ),
21767
22065
  spec(
21768
22066
  "PROPER",
21769
- C35,
22067
+ C37,
21770
22068
  "PROPER(text)",
21771
22069
  "Capitalizes the first letter of each word.",
21772
22070
  1,
@@ -21775,7 +22073,7 @@ var TEXT_FUNCTIONS = [
21775
22073
  ),
21776
22074
  spec(
21777
22075
  "TRIM",
21778
- C35,
22076
+ C37,
21779
22077
  "TRIM(text)",
21780
22078
  "Removes extra spaces.",
21781
22079
  1,
@@ -21784,7 +22082,7 @@ var TEXT_FUNCTIONS = [
21784
22082
  ),
21785
22083
  spec(
21786
22084
  "CLEAN",
21787
- C35,
22085
+ C37,
21788
22086
  "CLEAN(text)",
21789
22087
  "Removes non-printable characters.",
21790
22088
  1,
@@ -21796,7 +22094,7 @@ var TEXT_FUNCTIONS = [
21796
22094
  ),
21797
22095
  spec(
21798
22096
  "SUBSTITUTE",
21799
- C35,
22097
+ C37,
21800
22098
  "SUBSTITUTE(text, old_text, new_text, [instance_num])",
21801
22099
  "Replaces occurrences of a text.",
21802
22100
  3,
@@ -21820,7 +22118,7 @@ var TEXT_FUNCTIONS = [
21820
22118
  ...["REPLACE", "REPLACEB"].map(
21821
22119
  (name) => spec(
21822
22120
  name,
21823
- C35,
22121
+ C37,
21824
22122
  `${name}(old_text, start_num, num_chars, new_text)`,
21825
22123
  "Replaces part of a text.",
21826
22124
  4,
@@ -21837,7 +22135,7 @@ var TEXT_FUNCTIONS = [
21837
22135
  ...["FIND", "FINDB"].map(
21838
22136
  (name) => spec(
21839
22137
  name,
21840
- C35,
22138
+ C37,
21841
22139
  `${name}(find_text, within_text, [start_num])`,
21842
22140
  "The position of a text (case-sensitive).",
21843
22141
  2,
@@ -21848,7 +22146,7 @@ var TEXT_FUNCTIONS = [
21848
22146
  ...["SEARCH", "SEARCHB"].map(
21849
22147
  (name) => spec(
21850
22148
  name,
21851
- C35,
22149
+ C37,
21852
22150
  `${name}(find_text, within_text, [start_num])`,
21853
22151
  "The position of a text (wildcards, any case).",
21854
22152
  2,
@@ -21856,7 +22154,7 @@ var TEXT_FUNCTIONS = [
21856
22154
  (args) => find(args, true)
21857
22155
  )
21858
22156
  ),
21859
- spec("REPT", C35, "REPT(text, number_times)", "Repeats a text.", 2, 2, (args) => {
22157
+ spec("REPT", C37, "REPT(text, number_times)", "Repeats a text.", 2, 2, (args) => {
21860
22158
  const n = Math.trunc(num2(args[1]));
21861
22159
  const text = str(args[0]);
21862
22160
  if (n < 0 || text.length * n > MAX_TEXT) fail(ERR.VALUE);
@@ -21864,7 +22162,7 @@ var TEXT_FUNCTIONS = [
21864
22162
  }),
21865
22163
  spec(
21866
22164
  "EXACT",
21867
- C35,
22165
+ C37,
21868
22166
  "EXACT(text1, text2)",
21869
22167
  "Whether two texts are identical (case-sensitive).",
21870
22168
  2,
@@ -21873,8 +22171,412 @@ var TEXT_FUNCTIONS = [
21873
22171
  )
21874
22172
  ];
21875
22173
 
22174
+ // xlsx/formula/functions/bahttext.ts
22175
+ var DIGITS = ["\u0E28\u0E39\u0E19\u0E22\u0E4C", "\u0E2B\u0E19\u0E36\u0E48\u0E07", "\u0E2A\u0E2D\u0E07", "\u0E2A\u0E32\u0E21", "\u0E2A\u0E35\u0E48", "\u0E2B\u0E49\u0E32", "\u0E2B\u0E01", "\u0E40\u0E08\u0E47\u0E14", "\u0E41\u0E1B\u0E14", "\u0E40\u0E01\u0E49\u0E32"];
22176
+ var PLACES = ["", "\u0E2A\u0E34\u0E1A", "\u0E23\u0E49\u0E2D\u0E22", "\u0E1E\u0E31\u0E19", "\u0E2B\u0E21\u0E37\u0E48\u0E19", "\u0E41\u0E2A\u0E19"];
22177
+ var MILLION = "\u0E25\u0E49\u0E32\u0E19";
22178
+ function belowMillion(n) {
22179
+ const digits2 = String(n).split("").map(Number);
22180
+ const len = digits2.length;
22181
+ let out = "";
22182
+ digits2.forEach((d, i2) => {
22183
+ const place = len - 1 - i2;
22184
+ if (d === 0) return;
22185
+ if (place === 0) out += d === 1 && len > 1 ? "\u0E40\u0E2D\u0E47\u0E14" : DIGITS[d] ?? "";
22186
+ else if (place === 1)
22187
+ out += (d === 1 ? "" : d === 2 ? "\u0E22\u0E35\u0E48" : DIGITS[d] ?? "") + (PLACES[1]);
22188
+ else out += (DIGITS[d] ?? "") + (PLACES[place] ?? "");
22189
+ });
22190
+ return out;
22191
+ }
22192
+ function thaiInteger(n) {
22193
+ if (n === 0) return DIGITS[0];
22194
+ const high = Math.floor(n / 1e6);
22195
+ const low = n % 1e6;
22196
+ return (high > 0 ? thaiInteger(high) + MILLION : "") + (low > 0 ? belowMillion(low) : "");
22197
+ }
22198
+ var BAHTTEXT = spec(
22199
+ "BAHTTEXT",
22200
+ "Text",
22201
+ "BAHTTEXT(number)",
22202
+ "A number as Thai text with the baht suffix.",
22203
+ 1,
22204
+ 1,
22205
+ (args) => {
22206
+ const value2 = num2(args[0]);
22207
+ const negative = value2 < 0;
22208
+ const satangTotal = Math.round(Math.abs(value2) * 100);
22209
+ if (!Number.isSafeInteger(satangTotal)) fail(ERR.VALUE);
22210
+ const baht = Math.floor(satangTotal / 100);
22211
+ const satang = satangTotal % 100;
22212
+ let text = "";
22213
+ if (baht > 0 || satang === 0) text += thaiInteger(baht) + "\u0E1A\u0E32\u0E17";
22214
+ text += satang === 0 ? "\u0E16\u0E49\u0E27\u0E19" : thaiInteger(satang) + "\u0E2A\u0E15\u0E32\u0E07\u0E04\u0E4C";
22215
+ return (negative && satangTotal > 0 ? "\u0E25\u0E1A" : "") + text;
22216
+ }
22217
+ );
22218
+
22219
+ // xlsx/formula/functions/getpivotdata.ts
22220
+ var same2 = (cached, wanted) => {
22221
+ if (typeof wanted === "number" && typeof cached === "number") return cached === wanted;
22222
+ if (cached === null) return wanted === null || wanted === "";
22223
+ if (typeof cached === "object") return false;
22224
+ return String(pivotItemLabel(cached)).toLowerCase() === String(wanted ?? "").toLowerCase();
22225
+ };
22226
+ var GETPIVOTDATA = spec(
22227
+ "GETPIVOTDATA",
22228
+ "Lookup & Reference",
22229
+ "GETPIVOTDATA(data_field, pivot_table, [field1, item1], ...)",
22230
+ "Data stored in a PivotTable report.",
22231
+ 2,
22232
+ 254,
22233
+ (args, ctx) => {
22234
+ const ref = args[1];
22235
+ const area = ref instanceof RefValue ? ref.first : void 0;
22236
+ if (!area) fail(ERR.REF);
22237
+ const sheet = ctx.workbook.sheets[area.sheet];
22238
+ const found = sheet ? pivotTableAt(sheet, area.range.start) : void 0;
22239
+ if (!found || (args.length - 2) % 2 !== 0) fail(ERR.REF);
22240
+ let pivot;
22241
+ try {
22242
+ pivot = pivotPageProjection(found);
22243
+ } catch {
22244
+ return fail(ERR.REF);
22245
+ }
22246
+ const wanted = str(args[0]).toLowerCase();
22247
+ const measure = pivotMeasures(pivot).find(
22248
+ (m) => m.caption.toLowerCase() === wanted || m.field.toLowerCase() === wanted
22249
+ );
22250
+ if (!measure) fail(ERR.REF);
22251
+ const axes2 = [pivot.rowField, pivot.secondRowField, pivot.columnField, pivot.pageFilter?.field];
22252
+ let records = pivot.records;
22253
+ for (let i2 = 2; i2 < args.length; i2 += 2) {
22254
+ const name = str(args[i2]);
22255
+ const index3 = pivot.fields.findIndex((f6) => f6.toLowerCase() === name.toLowerCase());
22256
+ const field = pivot.fields[index3];
22257
+ if (index3 < 0 || field === void 0 || !axes2.includes(field)) fail(ERR.REF);
22258
+ const item = scalar(args[i2 + 1]);
22259
+ if (isError(item)) return item;
22260
+ records = records.filter((record) => same2(record[index3] ?? null, item));
22261
+ }
22262
+ if (records.length === 0) fail(ERR.REF);
22263
+ const value2 = pivotMeasureNumber(pivot, records, measure);
22264
+ return value2;
22265
+ },
22266
+ ["any"]
22267
+ );
22268
+
22269
+ // xlsx/formula/functions/groupby.ts
22270
+ var column = (values2) => new Matrix(values2.map((v) => [v]));
22271
+ function aggregateOf(arg, ctx) {
22272
+ if (!arg) return fail(ERR.VALUE);
22273
+ const node = arg.node;
22274
+ if (node.type === "name" && !ctx.frame.scope?.has(node.name.toUpperCase())) {
22275
+ const name = node.name.toUpperCase();
22276
+ if (name === "PERCENTOF") {
22277
+ return (group, all2) => {
22278
+ const sum3 = (v) => collectNumbers(ctx, [column(v)]).reduce((a2, b) => a2 + b, 0);
22279
+ const total2 = sum3(all2);
22280
+ return total2 === 0 ? ERR.DIV0 : sum3(group) / total2;
22281
+ };
22282
+ }
22283
+ const call = {
22284
+ type: "call",
22285
+ name,
22286
+ rawName: node.name,
22287
+ args: [{ type: "name", name: "_G" }]
22288
+ };
22289
+ return (group) => ctx.toScalar(
22290
+ ctx.evaluate(call, new Map([...ctx.frame.scope ?? [], ["_G", column(group)]]))
22291
+ );
22292
+ }
22293
+ const lambda = arg.get();
22294
+ if (isError(lambda)) return fail(lambda);
22295
+ if (!(lambda instanceof LambdaValue)) return fail(ERR.VALUE);
22296
+ return (group) => ctx.toScalar(ctx.callLambda(lambda, [column(group)]));
22297
+ }
22298
+ var optional = (args, i2) => {
22299
+ const arg = args[i2];
22300
+ return arg && arg.node.type !== "missing" ? arg.get() : void 0;
22301
+ };
22302
+ function optionalInt(args, i2, ctx) {
22303
+ const value2 = optional(args, i2);
22304
+ return value2 === void 0 || value2 === null ? void 0 : int3(ctx.toScalar(value2));
22305
+ }
22306
+ function sortSpec(args, i2, ctx, fallback) {
22307
+ const value2 = optional(args, i2);
22308
+ if (value2 === void 0 || value2 === null) return fallback;
22309
+ const list = ctx.toMatrix(value2).flat().map((v) => typeof v === "number" ? Math.trunc(v) : fail(ERR.VALUE));
22310
+ if (list.some((n) => n === 0)) fail(ERR.VALUE);
22311
+ return list;
22312
+ }
22313
+ function totalDepth(args, i2, ctx) {
22314
+ const depth = optionalInt(args, i2, ctx) ?? 1;
22315
+ if (depth !== 0 && depth !== 1 && depth !== -1) fail(ERR.VALUE);
22316
+ return depth;
22317
+ }
22318
+ function headerMode(args, i2, ctx, firstRow) {
22319
+ const mode = optionalInt(args, i2, ctx);
22320
+ if (mode === void 0)
22321
+ return firstRow.length > 0 && firstRow.every((v) => typeof v === "string");
22322
+ if (mode === 0) return false;
22323
+ if (mode === 1 || mode === 3) return true;
22324
+ return fail(ERR.VALUE);
22325
+ }
22326
+ var keyOf = (values2) => JSON.stringify(values2);
22327
+ var plain2 = (v) => v === void 0 || isError(v) ? null : v;
22328
+ function compareBy(keys, rows) {
22329
+ return (a2, b) => {
22330
+ for (const key of keys) {
22331
+ const i2 = Math.abs(key) - 1;
22332
+ const result2 = compareScalars(plain2(rows[a2]?.[i2]), plain2(rows[b]?.[i2]));
22333
+ if (result2 !== 0) return key < 0 ? -result2 : result2;
22334
+ }
22335
+ return a2 - b;
22336
+ };
22337
+ }
22338
+ function filtered(rows, args, i2, ctx) {
22339
+ const value2 = optional(args, i2);
22340
+ const all2 = Array.from({ length: rows }, (_, r) => r);
22341
+ if (value2 === void 0 || value2 === null) return all2;
22342
+ const flags = ctx.toMatrix(value2).flat();
22343
+ if (flags.length !== rows) fail(ERR.VALUE);
22344
+ return all2.filter((r) => flags[r] === true || typeof flags[r] === "number" && flags[r] !== 0);
22345
+ }
22346
+ function groupby(args, ctx) {
22347
+ const keysM = ctx.toMatrix(args[0].get());
22348
+ const valuesM = ctx.toMatrix(args[1].get());
22349
+ if (keysM.rows !== valuesM.rows) fail(ERR.VALUE);
22350
+ const aggregate3 = aggregateOf(args[2], ctx);
22351
+ const hasHeaders = headerMode(args, 3, ctx, valuesM.data[0] ?? []);
22352
+ const depth = totalDepth(args, 4, ctx);
22353
+ const kCols = keysM.cols;
22354
+ const vCols = valuesM.cols;
22355
+ const sort2 = sortSpec(
22356
+ args,
22357
+ 5,
22358
+ ctx,
22359
+ Array.from({ length: kCols }, (_, i2) => i2 + 1)
22360
+ );
22361
+ const start = hasHeaders ? 1 : 0;
22362
+ const rows = filtered(keysM.rows, args, 6, ctx).filter((r) => r >= start);
22363
+ if (rows.length === 0) fail(ERR.CALC);
22364
+ const groups = /* @__PURE__ */ new Map();
22365
+ for (const r of rows) {
22366
+ const key = keyOf(keysM.data[r]);
22367
+ const found = groups.get(key);
22368
+ if (found) found.push(r);
22369
+ else groups.set(key, [r]);
22370
+ }
22371
+ const table2 = [...groups.values()].map((members) => {
22372
+ const key = keysM.data[members[0]];
22373
+ const cells = Array.from(
22374
+ { length: vCols },
22375
+ (_, c2) => aggregate3(
22376
+ members.map((r) => valuesM.data[r][c2] ?? null),
22377
+ rows.map((r) => valuesM.data[r][c2] ?? null)
22378
+ )
22379
+ );
22380
+ return [...key, ...cells];
22381
+ });
22382
+ for (const key of sort2) if (Math.abs(key) > kCols + vCols) fail(ERR.VALUE);
22383
+ const order = table2.map((_, i2) => i2).sort(compareBy(sort2, table2));
22384
+ const out = order.map((i2) => table2[i2]);
22385
+ if (depth !== 0) {
22386
+ const total2 = [
22387
+ "Total",
22388
+ ...Array(kCols - 1).fill(""),
22389
+ ...Array.from(
22390
+ { length: vCols },
22391
+ (_, c2) => aggregate3(
22392
+ rows.map((r) => valuesM.data[r][c2] ?? null),
22393
+ rows.map((r) => valuesM.data[r][c2] ?? null)
22394
+ )
22395
+ )
22396
+ ];
22397
+ if (depth === 1) out.push(total2);
22398
+ else out.unshift(total2);
22399
+ }
22400
+ if (hasHeaders) out.unshift([...keysM.data[0], ...valuesM.data[0]]);
22401
+ return new Matrix(out);
22402
+ }
22403
+ function pivotby(args, ctx) {
22404
+ const rowsM = ctx.toMatrix(args[0].get());
22405
+ const colsM = ctx.toMatrix(args[1].get());
22406
+ const valuesM = ctx.toMatrix(args[2].get());
22407
+ if (rowsM.rows !== valuesM.rows || colsM.rows !== valuesM.rows || valuesM.cols !== 1)
22408
+ fail(ERR.VALUE);
22409
+ if (colsM.cols !== 1) fail(ERR.VALUE);
22410
+ const aggregate3 = aggregateOf(args[3], ctx);
22411
+ const hasHeaders = headerMode(args, 4, ctx, valuesM.data[0] ?? []);
22412
+ const rowDepth = totalDepth(args, 5, ctx);
22413
+ const kCols = rowsM.cols;
22414
+ const rowSort = sortSpec(
22415
+ args,
22416
+ 6,
22417
+ ctx,
22418
+ Array.from({ length: kCols }, (_, i2) => i2 + 1)
22419
+ );
22420
+ const colDepth = totalDepth(args, 7, ctx);
22421
+ const colSort = sortSpec(args, 8, ctx, [1]);
22422
+ for (const key of rowSort) if (Math.abs(key) > kCols + 1) fail(ERR.VALUE);
22423
+ for (const key of colSort) if (Math.abs(key) > 2) fail(ERR.VALUE);
22424
+ const start = hasHeaders ? 1 : 0;
22425
+ const used = filtered(rowsM.rows, args, 9, ctx).filter((r) => r >= start);
22426
+ if (used.length === 0) fail(ERR.CALC);
22427
+ const val = (r) => valuesM.data[r][0] ?? null;
22428
+ const all2 = used.map(val);
22429
+ const rowKeys = /* @__PURE__ */ new Map();
22430
+ const colKeys = /* @__PURE__ */ new Map();
22431
+ for (const r of used) {
22432
+ for (const [map, key] of [
22433
+ [rowKeys, keyOf(rowsM.data[r])],
22434
+ [colKeys, keyOf(colsM.data[r])]
22435
+ ]) {
22436
+ const found = map.get(key);
22437
+ if (found) found.push(r);
22438
+ else map.set(key, [r]);
22439
+ }
22440
+ }
22441
+ const agg = (members) => aggregate3(members.map(val), all2);
22442
+ const colGroups = [...colKeys.values()].map((members) => ({
22443
+ label: colsM.data[members[0]][0] ?? null,
22444
+ members,
22445
+ total: agg(members)
22446
+ }));
22447
+ const colOrder = colGroups.map((_, i2) => i2).sort(
22448
+ compareBy(
22449
+ colSort,
22450
+ colGroups.map((g2) => [g2.label, g2.total])
22451
+ )
22452
+ );
22453
+ const rowGroups = [...rowKeys.values()].map((members) => ({
22454
+ key: rowsM.data[members[0]],
22455
+ members,
22456
+ total: agg(members)
22457
+ }));
22458
+ const rowOrder = rowGroups.map((_, i2) => i2).sort(
22459
+ compareBy(
22460
+ rowSort,
22461
+ rowGroups.map((g2) => [...g2.key, g2.total])
22462
+ )
22463
+ );
22464
+ const columns = colOrder.map((i2) => colGroups[i2]);
22465
+ const lines = rowOrder.map((i2) => {
22466
+ const group = rowGroups[i2];
22467
+ const cells = columns.map((col) => {
22468
+ const members = group.members.filter((r) => col.members.includes(r));
22469
+ return members.length ? agg(members) : "";
22470
+ });
22471
+ return [
22472
+ ...group.key,
22473
+ ...colDepth === 1 ? [...cells, group.total] : colDepth === -1 ? [group.total, ...cells] : cells
22474
+ ];
22475
+ });
22476
+ const grandRow = [
22477
+ "Total",
22478
+ ...Array(kCols - 1).fill(""),
22479
+ ...columns.map((col) => col.total),
22480
+ ...colDepth === 0 ? [] : [agg(used)]
22481
+ ];
22482
+ if (colDepth === -1)
22483
+ grandRow.splice(kCols, columns.length + 1, agg(used), ...columns.map((c2) => c2.total));
22484
+ if (rowDepth === 1) lines.push(grandRow);
22485
+ else if (rowDepth === -1) lines.unshift(grandRow);
22486
+ const header = [
22487
+ ...hasHeaders ? [rowsM.data[0].join(" "), ...Array(kCols - 1).fill("")] : Array(kCols).fill(""),
22488
+ ...colDepth === -1 ? ["Total"] : [],
22489
+ ...columns.map((col) => col.label),
22490
+ ...colDepth === 1 ? ["Total"] : []
22491
+ ];
22492
+ return new Matrix([header, ...lines]);
22493
+ }
22494
+ var lazy = (name, syntax, description, minArgs, maxArgs, fn) => ({
22495
+ name,
22496
+ category: "Lookup & Reference",
22497
+ syntax,
22498
+ description,
22499
+ minArgs,
22500
+ maxArgs,
22501
+ lazy: fn
22502
+ });
22503
+ var GROUPBY_FUNCTIONS = [
22504
+ lazy(
22505
+ "GROUPBY",
22506
+ "GROUPBY(row_fields, values, function, [field_headers], [total_depth], [sort_order], [filter_array], [field_relationship])",
22507
+ "Groups rows by the row fields and aggregates the values.",
22508
+ 3,
22509
+ 8,
22510
+ groupby
22511
+ ),
22512
+ lazy(
22513
+ "PIVOTBY",
22514
+ "PIVOTBY(row_fields, col_fields, values, function, [field_headers], [row_total_depth], [row_sort_order], [col_total_depth], [col_sort_order], [filter_array], [relative_to])",
22515
+ "Groups rows and columns by fields and aggregates the values into a table.",
22516
+ 4,
22517
+ 11,
22518
+ pivotby
22519
+ )
22520
+ ];
22521
+
22522
+ // xlsx/formula/functions/modern.ts
22523
+ var sum2 = (values2) => values2.reduce((a2, b) => a2 + b, 0);
22524
+ function trimmed(blank, mode) {
22525
+ let start = 0;
22526
+ let end = blank.length;
22527
+ if (mode === 1 || mode === 3) while (start < end && blank[start]) start++;
22528
+ if (mode === 2 || mode === 3) while (end > start && blank[end - 1]) end--;
22529
+ return [start, end];
22530
+ }
22531
+ var MODERN_FUNCTIONS = [
22532
+ spec(
22533
+ "PERCENTOF",
22534
+ "Math & Trig",
22535
+ "PERCENTOF(data_subset, data_all)",
22536
+ "The share a subset of values is of all values.",
22537
+ 2,
22538
+ 2,
22539
+ (args, ctx) => {
22540
+ const total2 = sum2(collectNumbers(ctx, [args[1] ?? null]));
22541
+ if (total2 === 0) fail(ERR.DIV0);
22542
+ return sum2(collectNumbers(ctx, [args[0] ?? null])) / total2;
22543
+ },
22544
+ ["any"]
22545
+ ),
22546
+ spec(
22547
+ "TRIMRANGE",
22548
+ "Lookup & Reference",
22549
+ "TRIMRANGE(range, [trim_rows], [trim_cols])",
22550
+ "Removes blank rows and columns from the edges of a range.",
22551
+ 1,
22552
+ 3,
22553
+ (args, ctx) => {
22554
+ const mode = (i2) => {
22555
+ const v = args[i2];
22556
+ if (v === void 0 || v === null) return 3;
22557
+ const n = Math.trunc(ctx.toScalar(v));
22558
+ if (typeof ctx.toScalar(v) !== "number" || n < 0 || n > 3) fail(ERR.VALUE);
22559
+ return n;
22560
+ };
22561
+ const data = ctx.toMatrix(args[0] ?? null).data;
22562
+ const cols = data[0]?.length ?? 0;
22563
+ const [r0, r1] = trimmed(
22564
+ data.map((row2) => row2.every((v) => v === null)),
22565
+ mode(1)
22566
+ );
22567
+ const [c0, c1] = trimmed(
22568
+ Array.from({ length: cols }, (_, c2) => data.every((row2) => row2[c2] === null)),
22569
+ mode(2)
22570
+ );
22571
+ if (r1 <= r0 || c1 <= c0) fail(ERR.CALC);
22572
+ return new Matrix(data.slice(r0, r1).map((row2) => row2.slice(c0, c1)));
22573
+ },
22574
+ ["any"]
22575
+ )
22576
+ ];
22577
+
21876
22578
  // xlsx/formula/functions/text-regex.ts
21877
- var C36 = "Text";
22579
+ var C38 = "Text";
21878
22580
  function compile(pattern, caseMode2, global) {
21879
22581
  if (caseMode2 !== 0 && caseMode2 !== 1) fail(ERR.VALUE);
21880
22582
  try {
@@ -21893,7 +22595,7 @@ function encodeUrl(text) {
21893
22595
  var TEXT_REGEX_FUNCTIONS = [
21894
22596
  spec(
21895
22597
  "ENCODEURL",
21896
- C36,
22598
+ C38,
21897
22599
  "ENCODEURL(text)",
21898
22600
  "Percent-encodes text for use in a URL.",
21899
22601
  1,
@@ -21902,7 +22604,7 @@ var TEXT_REGEX_FUNCTIONS = [
21902
22604
  ),
21903
22605
  spec(
21904
22606
  "REGEXTEST",
21905
- C36,
22607
+ C38,
21906
22608
  "REGEXTEST(text, pattern, [case_sensitivity])",
21907
22609
  "Whether any part of the text matches the pattern.",
21908
22610
  2,
@@ -21911,7 +22613,7 @@ var TEXT_REGEX_FUNCTIONS = [
21911
22613
  ),
21912
22614
  spec(
21913
22615
  "REGEXEXTRACT",
21914
- C36,
22616
+ C38,
21915
22617
  "REGEXEXTRACT(text, pattern, [return_mode], [case_sensitivity])",
21916
22618
  "Extracts the first match (0), all matches (1), or the first match\u2019s capture groups (2).",
21917
22619
  2,
@@ -21938,7 +22640,7 @@ var TEXT_REGEX_FUNCTIONS = [
21938
22640
  ),
21939
22641
  spec(
21940
22642
  "REGEXREPLACE",
21941
- C36,
22643
+ C38,
21942
22644
  "REGEXREPLACE(text, pattern, replacement, [occurrence], [case_sensitivity])",
21943
22645
  "Replaces the parts of the text that match the pattern.",
21944
22646
  3,
@@ -21958,7 +22660,7 @@ var TEXT_REGEX_FUNCTIONS = [
21958
22660
  ];
21959
22661
 
21960
22662
  // xlsx/formula/functions/text-extra.ts
21961
- var C37 = "Text";
22663
+ var C39 = "Text";
21962
22664
  function delimitersOf(ctx, value2) {
21963
22665
  if (value2 === void 0 || value2 === null) return [];
21964
22666
  return ctx.toMatrix(value2).flat().map((v) => {
@@ -22027,7 +22729,7 @@ var TEXT_EXTRA_FUNCTIONS = [
22027
22729
  ...TEXT_REGEX_FUNCTIONS,
22028
22730
  spec(
22029
22731
  "TEXTBEFORE",
22030
- C37,
22732
+ C39,
22031
22733
  "TEXTBEFORE(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])",
22032
22734
  "The text before a delimiter.",
22033
22735
  2,
@@ -22037,7 +22739,7 @@ var TEXT_EXTRA_FUNCTIONS = [
22037
22739
  ),
22038
22740
  spec(
22039
22741
  "TEXTAFTER",
22040
- C37,
22742
+ C39,
22041
22743
  "TEXTAFTER(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])",
22042
22744
  "The text after a delimiter.",
22043
22745
  2,
@@ -22047,7 +22749,7 @@ var TEXT_EXTRA_FUNCTIONS = [
22047
22749
  ),
22048
22750
  spec(
22049
22751
  "TEXTSPLIT",
22050
- C37,
22752
+ C39,
22051
22753
  "TEXTSPLIT(text, col_delimiter, [row_delimiter], [ignore_empty], [match_mode], [pad_with])",
22052
22754
  "Splits text into an array.",
22053
22755
  2,
@@ -22070,7 +22772,7 @@ var TEXT_EXTRA_FUNCTIONS = [
22070
22772
  ),
22071
22773
  spec(
22072
22774
  "VALUETOTEXT",
22073
- C37,
22775
+ C39,
22074
22776
  "VALUETOTEXT(value, [format])",
22075
22777
  "Text for any value.",
22076
22778
  1,
@@ -22079,7 +22781,7 @@ var TEXT_EXTRA_FUNCTIONS = [
22079
22781
  ),
22080
22782
  spec(
22081
22783
  "ARRAYTOTEXT",
22082
- C37,
22784
+ C39,
22083
22785
  "ARRAYTOTEXT(array, [format])",
22084
22786
  "Text for an array.",
22085
22787
  1,
@@ -22104,6 +22806,10 @@ var ALL = [
22104
22806
  ...LOGICAL_FUNCTIONS,
22105
22807
  ...TEXT_FUNCTIONS,
22106
22808
  ...TEXT_EXTRA_FUNCTIONS,
22809
+ BAHTTEXT,
22810
+ GETPIVOTDATA,
22811
+ ...GROUPBY_FUNCTIONS,
22812
+ ...MODERN_FUNCTIONS,
22107
22813
  ...DATETIME_FUNCTIONS,
22108
22814
  ...LOOKUP_FUNCTIONS,
22109
22815
  ...ARRAY_FUNCTIONS,
@@ -22130,7 +22836,7 @@ var paramKind = (spec2, index3) => {
22130
22836
  var isSpilledCell = (cell) => cell !== void 0 && "spillAnchor" in cell;
22131
22837
 
22132
22838
  // xlsx/formula/move.ts
22133
- var same2 = (a2, b) => a2.toLowerCase() === b.toLowerCase();
22839
+ var same3 = (a2, b) => a2.toLowerCase() === b.toLowerCase();
22134
22840
  function deleteSheetInFormula(formula, sheetName, tableNames = []) {
22135
22841
  const tokens2 = safeTokens(formula);
22136
22842
  if (!tokens2) return formula;
@@ -22138,7 +22844,7 @@ function deleteSheetInFormula(formula, sheetName, tableNames = []) {
22138
22844
  let changed = false;
22139
22845
  for (const token of tokens2) {
22140
22846
  const prefix = token.prefix;
22141
- const onSheet = prefix !== void 0 && prefix.book === void 0 && prefix.sheet2 === void 0 && same2(prefix.sheet, sheetName);
22847
+ const onSheet = prefix !== void 0 && prefix.book === void 0 && prefix.sheet2 === void 0 && same3(prefix.sheet, sheetName);
22142
22848
  const table2 = typeof token.value === "string" && tables.has(token.value.toLowerCase()) && (token.kind === "structured" || token.kind === "name" && !prefix);
22143
22849
  if ((token.kind === "ref" || token.kind === "name") && onSheet || table2) {
22144
22850
  token.text = "#REF!";
@@ -23340,8 +24046,8 @@ function pageXml(sheet) {
23340
24046
  const result2 = { margins: "", setup: setupXml(sheet, page), headerFooter: "" };
23341
24047
  const marginsSource = snapshotElement(sheet, "pageMargins");
23342
24048
  if (page.margins) {
23343
- const same3 = marginsSource && sameModel(readPageSetup(marginsSource, void 0, void 0, false)?.margins, page.margins);
23344
- result2.margins = same3 ? snapshotXml(sheet, "pageMargins") ?? "" : el("pageMargins", { ...page.margins });
24049
+ const same4 = marginsSource && sameModel(readPageSetup(marginsSource, void 0, void 0, false)?.margins, page.margins);
24050
+ result2.margins = same4 ? snapshotXml(sheet, "pageMargins") ?? "" : el("pageMargins", { ...page.margins });
23345
24051
  }
23346
24052
  result2.headerFooter = headerFooterXml(sheet, page);
23347
24053
  return result2;
@@ -23632,11 +24338,11 @@ function patchAutoFilter(doc, root, table2, before, names) {
23632
24338
  const list = xKid(root, "tableColumns");
23633
24339
  const original = list ? xKids(list, "tableColumn") : [];
23634
24340
  const current = new Map(sourceColumnsForPatch(root, table2, names).map((c2, index3) => [c2, index3]));
23635
- for (const column of xKids(filter2, "filterColumn")) {
23636
- const old = original[Number(column.getAttribute("colId") ?? "0")];
24341
+ for (const column2 of xKids(filter2, "filterColumn")) {
24342
+ const old = original[Number(column2.getAttribute("colId") ?? "0")];
23637
24343
  const index3 = old ? current.get(old) : void 0;
23638
- if (index3 === void 0) filter2.removeChild(column);
23639
- else column.setAttribute("colId", num(index3));
24344
+ if (index3 === void 0) filter2.removeChild(column2);
24345
+ else column2.setAttribute("colId", num(index3));
23640
24346
  }
23641
24347
  if (!existing) insertBefore(root, filter2, ["sortState", "tableColumns"]);
23642
24348
  const sort2 = xKid(filter2, "sortState") ?? xKid(root, "sortState");
@@ -23678,38 +24384,38 @@ function patchColumns(doc, root, sheet, table2, names) {
23678
24384
  else match2.removeAttribute("id");
23679
24385
  return match2;
23680
24386
  });
23681
- for (const column of sourceColumns) list.removeChild(column);
24387
+ for (const column2 of sourceColumns) list.removeChild(column2);
23682
24388
  let nextId = Math.max(0, ...ids) + 1;
23683
24389
  const totalsRow = table2.range.end.row;
23684
24390
  names.forEach((name, index3) => {
23685
- const column = picked[index3] ?? doc.createElementNS(NS.x, "tableColumn");
23686
- if (!column.getAttribute("id")) column.setAttribute("id", num(nextId++));
23687
- column.setAttribute("name", name);
24391
+ const column2 = picked[index3] ?? doc.createElementNS(NS.x, "tableColumn");
24392
+ if (!column2.getAttribute("id")) column2.setAttribute("id", num(nextId++));
24393
+ column2.setAttribute("name", name);
23688
24394
  const model = table2.columns[index3];
23689
24395
  const fn = table2.totalsRow ? model?.totalsRowFunction : void 0;
23690
- setOrRemove(column, "totalsRowFunction", fn);
23691
- setOrRemove(column, "totalsRowLabel", table2.totalsRow ? model?.totalsRowLabel : void 0);
24396
+ setOrRemove(column2, "totalsRowFunction", fn);
24397
+ setOrRemove(column2, "totalsRowLabel", table2.totalsRow ? model?.totalsRowLabel : void 0);
23692
24398
  const calculated = model?.calculatedColumnFormula;
23693
24399
  setChildText(
23694
24400
  doc,
23695
- column,
24401
+ column2,
23696
24402
  "calculatedColumnFormula",
23697
24403
  calculated ? addFuturePrefixes(calculated) : void 0,
23698
24404
  COLUMN_CHILD_ORDER.slice(1)
23699
24405
  );
23700
- if (fn !== "custom") setChildText(doc, column, "totalsRowFormula", void 0, []);
24406
+ if (fn !== "custom") setChildText(doc, column2, "totalsRowFormula", void 0, []);
23701
24407
  else {
23702
24408
  const cellFormula = sheet.rows.get(totalsRow)?.get(table2.range.start.col + index3)?.formula;
23703
24409
  if (cellFormula)
23704
24410
  setChildText(
23705
24411
  doc,
23706
- column,
24412
+ column2,
23707
24413
  "totalsRowFormula",
23708
24414
  addFuturePrefixes(cellFormula),
23709
24415
  COLUMN_CHILD_ORDER.slice(2)
23710
24416
  );
23711
24417
  }
23712
- list.appendChild(column);
24418
+ list.appendChild(column2);
23713
24419
  });
23714
24420
  list.setAttribute("count", num(names.length));
23715
24421
  }
@@ -23781,13 +24487,13 @@ function tableXml(table2, id, names) {
23781
24487
  const filterEnd = { ...table2.range.end, row: table2.range.end.row - (table2.totalsRow ? 1 : 0) };
23782
24488
  const filter2 = table2.headerRow && !table2.totalsRow ? `<autoFilter ref="${range}"/>` : table2.headerRow ? `<autoFilter ref="${formatRange({ start: table2.range.start, end: filterEnd })}"/>` : "";
23783
24489
  const columns = names.map((name, index3) => {
23784
- const column = table2.columns[index3];
23785
- const calculated = column?.calculatedColumnFormula ? `<calculatedColumnFormula>${escapeText2(addFuturePrefixes(column.calculatedColumnFormula))}</calculatedColumnFormula>` : "";
24490
+ const column2 = table2.columns[index3];
24491
+ const calculated = column2?.calculatedColumnFormula ? `<calculatedColumnFormula>${escapeText2(addFuturePrefixes(column2.calculatedColumnFormula))}</calculatedColumnFormula>` : "";
23786
24492
  const values2 = attrs({
23787
24493
  id: index3 + 1,
23788
24494
  name,
23789
- totalsRowFunction: table2.totalsRow ? column?.totalsRowFunction : void 0,
23790
- totalsRowLabel: table2.totalsRow ? column?.totalsRowLabel : void 0
24495
+ totalsRowFunction: table2.totalsRow ? column2?.totalsRowFunction : void 0,
24496
+ totalsRowLabel: table2.totalsRow ? column2?.totalsRowLabel : void 0
23791
24497
  });
23792
24498
  return calculated ? `<tableColumn${values2}>${calculated}</tableColumn>` : `<tableColumn${values2}/>`;
23793
24499
  }).join("");
@@ -24076,8 +24782,8 @@ function colsXml(sheet, styleCount) {
24076
24782
  const sorted2 = [...sheet.columns].sort((a2, b) => a2.min - b.min);
24077
24783
  let previous = -1;
24078
24784
  const out = [];
24079
- for (const column of sorted2) {
24080
- const col = { ...column, min: Math.max(column.min, previous + 1) };
24785
+ for (const column2 of sorted2) {
24786
+ const col = { ...column2, min: Math.max(column2.min, previous + 1) };
24081
24787
  if (col.max < col.min) continue;
24082
24788
  previous = col.max;
24083
24789
  const style2 = col.styleId && col.styleId < styleCount ? col.styleId : void 0;
@@ -24119,27 +24825,27 @@ function protectionXml2(sheet) {
24119
24825
  function sourceCriteria(xml) {
24120
24826
  try {
24121
24827
  const wrapped = `<autoFilter xmlns="${NS.x}" ref="A1">${xml}</autoFilter>`;
24122
- const column = readAutoFilter(parseXml(wrapped).documentElement)?.columns?.[0];
24123
- return column ? { values: column.values, blank: column.blank } : void 0;
24828
+ const column2 = readAutoFilter(parseXml(wrapped).documentElement)?.columns?.[0];
24829
+ return column2 ? { values: column2.values, blank: column2.blank } : void 0;
24124
24830
  } catch {
24125
24831
  return void 0;
24126
24832
  }
24127
24833
  }
24128
- function filterColumnXml(column) {
24129
- if (column.sourceXml && sameModel(sourceCriteria(column.sourceXml), { values: column.values, blank: column.blank })) {
24130
- const head = /^<filterColumn\b[^>]*?>/.exec(column.sourceXml)?.[0];
24834
+ function filterColumnXml(column2) {
24835
+ if (column2.sourceXml && sameModel(sourceCriteria(column2.sourceXml), { values: column2.values, blank: column2.blank })) {
24836
+ const head = /^<filterColumn\b[^>]*?>/.exec(column2.sourceXml)?.[0];
24131
24837
  if (head) {
24132
- const colId = ` colId="${column.offset}"`;
24838
+ const colId = ` colId="${column2.offset}"`;
24133
24839
  const patched = /\scolId="[^"]*"/.test(head) ? head.replace(/\scolId="[^"]*"/, colId) : head.replace(/^<filterColumn\b/, `<filterColumn${colId}`);
24134
- return patched + column.sourceXml.slice(head.length);
24840
+ return patched + column2.sourceXml.slice(head.length);
24135
24841
  }
24136
24842
  }
24137
- if (!column.values?.length && !column.blank) return "";
24138
- const values2 = (column.values ?? []).map((value2) => el("filter", { val: value2 })).join("");
24843
+ if (!column2.values?.length && !column2.blank) return "";
24844
+ const values2 = (column2.values ?? []).map((value2) => el("filter", { val: value2 })).join("");
24139
24845
  return el(
24140
24846
  "filterColumn",
24141
- { colId: column.offset },
24142
- el("filters", { blank: column.blank || void 0 }, values2) || "<filters/>"
24847
+ { colId: column2.offset },
24848
+ el("filters", { blank: column2.blank || void 0 }, values2) || "<filters/>"
24143
24849
  );
24144
24850
  }
24145
24851
  function autoFilterXml(sheet) {
@@ -24149,7 +24855,7 @@ function autoFilterXml(sheet) {
24149
24855
  if (source2 && sameModel(readAutoFilter(source2), filter2))
24150
24856
  return snapshotXml(sheet, "autoFilter") ?? "";
24151
24857
  const width = filter2.range.end.col - filter2.range.start.col + 1;
24152
- const columns = (filter2.columns ?? []).filter((column) => column.offset >= 0 && column.offset < width).sort((a2, b) => a2.offset - b.offset).map(filterColumnXml).join("");
24858
+ const columns = (filter2.columns ?? []).filter((column2) => column2.offset >= 0 && column2.offset < width).sort((a2, b) => a2.offset - b.offset).map(filterColumnXml).join("");
24153
24859
  const sort2 = source2 && sameModel(readAutoFilter(source2)?.range, filter2.range) ? elements(source2).filter((node) => node.localName === "sortState" || node.localName === "extLst").map((node) => outerXml(node)).join("") : "";
24154
24860
  return el("autoFilter", { ref: formatRange(filter2.range) }, columns + sort2);
24155
24861
  }
@@ -24793,8 +25499,8 @@ function sheetNameFromFileName(fileName) {
24793
25499
  let end = stem.length;
24794
25500
  while (start < end && stem[start] === "'") start++;
24795
25501
  while (end > start && stem[end - 1] === "'") end--;
24796
- const trimmed = stem.slice(start, end).slice(0, 31).trim();
24797
- return trimmed && trimmed.toLowerCase() !== "history" ? trimmed : "Sheet1";
25502
+ const trimmed2 = stem.slice(start, end).slice(0, 31).trim();
25503
+ return trimmed2 && trimmed2.toLowerCase() !== "history" ? trimmed2 : "Sheet1";
24798
25504
  }
24799
25505
  function csvToWorkbook(text, options = {}) {
24800
25506
  const workbook = createWorkbook({ sheets: [options.sheetName ?? "Sheet1"] });
@@ -25315,8 +26021,8 @@ function columnName(col) {
25315
26021
  return name;
25316
26022
  }
25317
26023
  function quoteSheetName2(name) {
25318
- const plain2 = /^[A-Za-z_][A-Za-z0-9_.]*$/.test(name) && !/^[A-Za-z]{1,3}[0-9]+$/.test(name) && !/^[Rr][0-9]*([Cc][0-9]*)?$/.test(name) && !/^(TRUE|FALSE)$/i.test(name);
25319
- return plain2 ? name : `'${name.replace(/'/g, "''")}'`;
26024
+ const plain3 = /^[A-Za-z_][A-Za-z0-9_.]*$/.test(name) && !/^[A-Za-z]{1,3}[0-9]+$/.test(name) && !/^[Rr][0-9]*([Cc][0-9]*)?$/.test(name) && !/^(TRUE|FALSE)$/i.test(name);
26025
+ return plain3 ? name : `'${name.replace(/'/g, "''")}'`;
25320
26026
  }
25321
26027
  function formatNumber2(value2) {
25322
26028
  return String(value2).replace("e", "E");
@@ -25530,7 +26236,7 @@ var SegmentReader = class _SegmentReader {
25530
26236
  function joinedData(record) {
25531
26237
  if (record.continues.length === 0)
25532
26238
  return record.data;
25533
- const total2 = record.continues.reduce((sum2, part) => sum2 + part.length, record.data.length);
26239
+ const total2 = record.continues.reduce((sum3, part) => sum3 + part.length, record.data.length);
25534
26240
  const out = new Uint8Array(total2);
25535
26241
  out.set(record.data, 0);
25536
26242
  let at = record.data.length;
@@ -26145,8 +26851,8 @@ function parseSupBook(data) {
26145
26851
  function sheetRange(first2, last) {
26146
26852
  if (first2 === last)
26147
26853
  return quoteSheetName2(first2);
26148
- const plain2 = quoteSheetName2(first2) === first2 && quoteSheetName2(last) === last;
26149
- return plain2 ? `${first2}:${last}` : `'${`${first2}:${last}`.replace(/'/g, "''")}'`;
26854
+ const plain3 = quoteSheetName2(first2) === first2 && quoteSheetName2(last) === last;
26855
+ return plain3 ? `${first2}:${last}` : `'${`${first2}:${last}`.replace(/'/g, "''")}'`;
26150
26856
  }
26151
26857
  function parseGlobals(records) {
26152
26858
  const first2 = records[0];
@@ -27194,18 +27900,18 @@ function mapSheet(source2, sheetId, style2) {
27194
27900
  putCell(sheet, item.row, item.col, cell);
27195
27901
  }
27196
27902
  sheet.merges = source2.merges.map(toRange);
27197
- sheet.columns = source2.columns.map((column) => {
27903
+ sheet.columns = source2.columns.map((column2) => {
27198
27904
  const info = {
27199
- min: column.firstCol,
27200
- max: column.lastCol,
27201
- width: column.width
27905
+ min: column2.firstCol,
27906
+ max: column2.lastCol,
27907
+ width: column2.width
27202
27908
  };
27203
- if (column.customWidth) info.customWidth = true;
27204
- if (column.hidden) info.hidden = true;
27205
- if (column.bestFit) info.bestFit = true;
27206
- if (column.outlineLevel) info.outlineLevel = column.outlineLevel;
27207
- if (column.collapsed) info.collapsed = true;
27208
- const styleId = style2(column.xf);
27909
+ if (column2.customWidth) info.customWidth = true;
27910
+ if (column2.hidden) info.hidden = true;
27911
+ if (column2.bestFit) info.bestFit = true;
27912
+ if (column2.outlineLevel) info.outlineLevel = column2.outlineLevel;
27913
+ if (column2.collapsed) info.collapsed = true;
27914
+ const styleId = style2(column2.xf);
27209
27915
  if (styleId) info.styleId = styleId;
27210
27916
  return info;
27211
27917
  });
@@ -27510,11 +28216,11 @@ async function decryptWorkbook(bytes, password) {
27510
28216
  "This workbook is password protected. Enter the password to open it."
27511
28217
  );
27512
28218
  }
27513
- const plain2 = await decryptOoxmlPackage(bytes, password);
27514
- if (!startsWith(plain2, ZIP_MAGIC)) {
28219
+ const plain3 = await decryptOoxmlPackage(bytes, password);
28220
+ if (!startsWith(plain3, ZIP_MAGIC)) {
27515
28221
  throw new Error("The decrypted file is not an Excel workbook package.");
27516
28222
  }
27517
- return plain2;
28223
+ return plain3;
27518
28224
  }
27519
28225
  async function loadWorkbook(input, options = {}) {
27520
28226
  let bytes = toBytes3(input);