@cj-tech-master/excelts 5.0.0 → 5.0.1-canary.20260123024428.98c7ee0

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 (55) hide show
  1. package/dist/browser/modules/excel/column.d.ts +5 -0
  2. package/dist/browser/modules/excel/column.js +10 -2
  3. package/dist/browser/modules/excel/row.d.ts +2 -0
  4. package/dist/browser/modules/excel/row.js +3 -1
  5. package/dist/browser/modules/excel/workbook.d.ts +4 -0
  6. package/dist/browser/modules/excel/workbook.js +4 -1
  7. package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +1 -0
  8. package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +17 -10
  9. package/dist/browser/modules/excel/xlsx/xform/sheet/row-xform.d.ts +1 -0
  10. package/dist/browser/modules/excel/xlsx/xform/sheet/row-xform.js +7 -1
  11. package/dist/browser/modules/excel/xlsx/xform/sheet/sheet-format-properties-xform.d.ts +1 -0
  12. package/dist/browser/modules/excel/xlsx/xform/sheet/sheet-format-properties-xform.js +9 -4
  13. package/dist/browser/modules/excel/xlsx/xform/sheet/sheet-view-xform.js +4 -2
  14. package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +2 -1
  15. package/dist/browser/modules/excel/xlsx/xform/style/style-xform.d.ts +7 -0
  16. package/dist/browser/modules/excel/xlsx/xform/style/style-xform.js +26 -6
  17. package/dist/browser/modules/excel/xlsx/xform/style/styles-xform.d.ts +6 -0
  18. package/dist/browser/modules/excel/xlsx/xform/style/styles-xform.js +52 -4
  19. package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +9 -1
  20. package/dist/browser/modules/excel/xlsx/xlsx.browser.js +24 -10
  21. package/dist/cjs/modules/excel/column.js +10 -2
  22. package/dist/cjs/modules/excel/row.js +3 -1
  23. package/dist/cjs/modules/excel/workbook.js +4 -1
  24. package/dist/cjs/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +17 -10
  25. package/dist/cjs/modules/excel/xlsx/xform/sheet/row-xform.js +7 -1
  26. package/dist/cjs/modules/excel/xlsx/xform/sheet/sheet-format-properties-xform.js +9 -4
  27. package/dist/cjs/modules/excel/xlsx/xform/sheet/sheet-view-xform.js +4 -2
  28. package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +2 -1
  29. package/dist/cjs/modules/excel/xlsx/xform/style/style-xform.js +26 -6
  30. package/dist/cjs/modules/excel/xlsx/xform/style/styles-xform.js +52 -4
  31. package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +24 -10
  32. package/dist/esm/modules/excel/column.js +10 -2
  33. package/dist/esm/modules/excel/row.js +3 -1
  34. package/dist/esm/modules/excel/workbook.js +4 -1
  35. package/dist/esm/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +17 -10
  36. package/dist/esm/modules/excel/xlsx/xform/sheet/row-xform.js +7 -1
  37. package/dist/esm/modules/excel/xlsx/xform/sheet/sheet-format-properties-xform.js +9 -4
  38. package/dist/esm/modules/excel/xlsx/xform/sheet/sheet-view-xform.js +4 -2
  39. package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +2 -1
  40. package/dist/esm/modules/excel/xlsx/xform/style/style-xform.js +26 -6
  41. package/dist/esm/modules/excel/xlsx/xform/style/styles-xform.js +52 -4
  42. package/dist/esm/modules/excel/xlsx/xlsx.browser.js +24 -10
  43. package/dist/iife/excelts.iife.js +463 -400
  44. package/dist/iife/excelts.iife.js.map +1 -1
  45. package/dist/iife/excelts.iife.min.js +7 -7
  46. package/dist/types/modules/excel/column.d.ts +5 -0
  47. package/dist/types/modules/excel/row.d.ts +2 -0
  48. package/dist/types/modules/excel/workbook.d.ts +4 -0
  49. package/dist/types/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +1 -0
  50. package/dist/types/modules/excel/xlsx/xform/sheet/row-xform.d.ts +1 -0
  51. package/dist/types/modules/excel/xlsx/xform/sheet/sheet-format-properties-xform.d.ts +1 -0
  52. package/dist/types/modules/excel/xlsx/xform/style/style-xform.d.ts +7 -0
  53. package/dist/types/modules/excel/xlsx/xform/style/styles-xform.d.ts +6 -0
  54. package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +9 -1
  55. package/package.json +14 -14
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @cj-tech-master/excelts v5.0.0
2
+ * @cj-tech-master/excelts v5.0.1-canary.20260123024428.98c7ee0
3
3
  * TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.
4
4
  * (c) 2026 cjnoname
5
5
  * Released under the MIT License
@@ -228,8 +228,8 @@ var ExcelTS = (function(exports) {
228
228
  default: throw new Error("Can only encode with 2 or 4 arguments");
229
229
  }
230
230
  },
231
- inRange(range$1, address) {
232
- const [left, top, , right, bottom] = range$1;
231
+ inRange(range, address) {
232
+ const [left, top, , right, bottom] = range;
233
233
  const [col, row] = address;
234
234
  return col >= left && col <= right && row >= top && row <= bottom;
235
235
  }
@@ -435,47 +435,47 @@ var ExcelTS = (function(exports) {
435
435
 
436
436
  //#endregion
437
437
  //#region src/modules/excel/enums.ts
438
- let ValueType = /* @__PURE__ */ function(ValueType$1) {
439
- ValueType$1[ValueType$1["Null"] = 0] = "Null";
440
- ValueType$1[ValueType$1["Merge"] = 1] = "Merge";
441
- ValueType$1[ValueType$1["Number"] = 2] = "Number";
442
- ValueType$1[ValueType$1["String"] = 3] = "String";
443
- ValueType$1[ValueType$1["Date"] = 4] = "Date";
444
- ValueType$1[ValueType$1["Hyperlink"] = 5] = "Hyperlink";
445
- ValueType$1[ValueType$1["Formula"] = 6] = "Formula";
446
- ValueType$1[ValueType$1["SharedString"] = 7] = "SharedString";
447
- ValueType$1[ValueType$1["RichText"] = 8] = "RichText";
448
- ValueType$1[ValueType$1["Boolean"] = 9] = "Boolean";
449
- ValueType$1[ValueType$1["Error"] = 10] = "Error";
450
- ValueType$1[ValueType$1["JSON"] = 11] = "JSON";
451
- ValueType$1[ValueType$1["Checkbox"] = 12] = "Checkbox";
452
- return ValueType$1;
438
+ let ValueType = /* @__PURE__ */ function(ValueType) {
439
+ ValueType[ValueType["Null"] = 0] = "Null";
440
+ ValueType[ValueType["Merge"] = 1] = "Merge";
441
+ ValueType[ValueType["Number"] = 2] = "Number";
442
+ ValueType[ValueType["String"] = 3] = "String";
443
+ ValueType[ValueType["Date"] = 4] = "Date";
444
+ ValueType[ValueType["Hyperlink"] = 5] = "Hyperlink";
445
+ ValueType[ValueType["Formula"] = 6] = "Formula";
446
+ ValueType[ValueType["SharedString"] = 7] = "SharedString";
447
+ ValueType[ValueType["RichText"] = 8] = "RichText";
448
+ ValueType[ValueType["Boolean"] = 9] = "Boolean";
449
+ ValueType[ValueType["Error"] = 10] = "Error";
450
+ ValueType[ValueType["JSON"] = 11] = "JSON";
451
+ ValueType[ValueType["Checkbox"] = 12] = "Checkbox";
452
+ return ValueType;
453
453
  }({});
454
- let FormulaType = /* @__PURE__ */ function(FormulaType$1) {
455
- FormulaType$1[FormulaType$1["None"] = 0] = "None";
456
- FormulaType$1[FormulaType$1["Master"] = 1] = "Master";
457
- FormulaType$1[FormulaType$1["Shared"] = 2] = "Shared";
458
- return FormulaType$1;
454
+ let FormulaType = /* @__PURE__ */ function(FormulaType) {
455
+ FormulaType[FormulaType["None"] = 0] = "None";
456
+ FormulaType[FormulaType["Master"] = 1] = "Master";
457
+ FormulaType[FormulaType["Shared"] = 2] = "Shared";
458
+ return FormulaType;
459
459
  }({});
460
- let RelationshipType = /* @__PURE__ */ function(RelationshipType$1) {
461
- RelationshipType$1[RelationshipType$1["None"] = 0] = "None";
462
- RelationshipType$1[RelationshipType$1["OfficeDocument"] = 1] = "OfficeDocument";
463
- RelationshipType$1[RelationshipType$1["Worksheet"] = 2] = "Worksheet";
464
- RelationshipType$1[RelationshipType$1["CalcChain"] = 3] = "CalcChain";
465
- RelationshipType$1[RelationshipType$1["SharedStrings"] = 4] = "SharedStrings";
466
- RelationshipType$1[RelationshipType$1["Styles"] = 5] = "Styles";
467
- RelationshipType$1[RelationshipType$1["Theme"] = 6] = "Theme";
468
- RelationshipType$1[RelationshipType$1["Hyperlink"] = 7] = "Hyperlink";
469
- return RelationshipType$1;
460
+ let RelationshipType = /* @__PURE__ */ function(RelationshipType) {
461
+ RelationshipType[RelationshipType["None"] = 0] = "None";
462
+ RelationshipType[RelationshipType["OfficeDocument"] = 1] = "OfficeDocument";
463
+ RelationshipType[RelationshipType["Worksheet"] = 2] = "Worksheet";
464
+ RelationshipType[RelationshipType["CalcChain"] = 3] = "CalcChain";
465
+ RelationshipType[RelationshipType["SharedStrings"] = 4] = "SharedStrings";
466
+ RelationshipType[RelationshipType["Styles"] = 5] = "Styles";
467
+ RelationshipType[RelationshipType["Theme"] = 6] = "Theme";
468
+ RelationshipType[RelationshipType["Hyperlink"] = 7] = "Hyperlink";
469
+ return RelationshipType;
470
470
  }({});
471
- let DocumentType = /* @__PURE__ */ function(DocumentType$1) {
472
- DocumentType$1[DocumentType$1["Xlsx"] = 1] = "Xlsx";
473
- return DocumentType$1;
471
+ let DocumentType = /* @__PURE__ */ function(DocumentType) {
472
+ DocumentType[DocumentType["Xlsx"] = 1] = "Xlsx";
473
+ return DocumentType;
474
474
  }({});
475
- let ReadingOrder = /* @__PURE__ */ function(ReadingOrder$1) {
476
- ReadingOrder$1[ReadingOrder$1["LeftToRight"] = 1] = "LeftToRight";
477
- ReadingOrder$1[ReadingOrder$1["RightToLeft"] = 2] = "RightToLeft";
478
- return ReadingOrder$1;
475
+ let ReadingOrder = /* @__PURE__ */ function(ReadingOrder) {
476
+ ReadingOrder[ReadingOrder["LeftToRight"] = 1] = "LeftToRight";
477
+ ReadingOrder[ReadingOrder["RightToLeft"] = 2] = "RightToLeft";
478
+ return ReadingOrder;
479
479
  }({});
480
480
  const ErrorValue = {
481
481
  NotApplicable: "#N/A",
@@ -1830,7 +1830,8 @@ var ExcelTS = (function(exports) {
1830
1830
  style: this.style,
1831
1831
  hidden: this.hidden,
1832
1832
  outlineLevel: this.outlineLevel,
1833
- collapsed: this.collapsed
1833
+ collapsed: this.collapsed,
1834
+ dyDescent: this.dyDescent
1834
1835
  } : null;
1835
1836
  }
1836
1837
  set model(value) {
@@ -1864,6 +1865,7 @@ var ExcelTS = (function(exports) {
1864
1865
  else delete this.height;
1865
1866
  this.hidden = value.hidden;
1866
1867
  this.outlineLevel = value.outlineLevel || 0;
1868
+ this.dyDescent = value.dyDescent;
1867
1869
  this.style = value.style && JSON.parse(JSON.stringify(value.style)) || {};
1868
1870
  }
1869
1871
  };
@@ -1904,7 +1906,8 @@ var ExcelTS = (function(exports) {
1904
1906
  width: this.width,
1905
1907
  style: this.style,
1906
1908
  hidden: this.hidden,
1907
- outlineLevel: this.outlineLevel
1909
+ outlineLevel: this.outlineLevel,
1910
+ bestFit: this.bestFit
1908
1911
  };
1909
1912
  }
1910
1913
  set defn(value) {
@@ -1916,12 +1919,14 @@ var ExcelTS = (function(exports) {
1916
1919
  else this.style = {};
1917
1920
  this.header = value.header;
1918
1921
  this._hidden = !!value.hidden;
1922
+ this.bestFit = value.bestFit;
1919
1923
  } else {
1920
1924
  delete this._header;
1921
1925
  delete this._key;
1922
1926
  delete this.width;
1923
1927
  this.style = {};
1924
1928
  this.outlineLevel = 0;
1929
+ delete this.bestFit;
1925
1930
  }
1926
1931
  }
1927
1932
  /**
@@ -1993,12 +1998,13 @@ var ExcelTS = (function(exports) {
1993
1998
  return this.width === other.width && this.hidden === other.hidden && this.outlineLevel === other.outlineLevel && isEqual(this.style, other.style);
1994
1999
  }
1995
2000
  equivalentToModel(model) {
1996
- return this.width === model.width && this.hidden === model.hidden && this.outlineLevel === model.outlineLevel && isEqual(this.style, model.style);
2001
+ return this.width === model.width && this.hidden === model.hidden && this.outlineLevel === model.outlineLevel && this.bestFit === model.bestFit && isEqual(this.style, model.style);
1997
2002
  }
1998
2003
  get isDefault() {
1999
2004
  if (this.isCustomWidth) return false;
2000
2005
  if (this.hidden) return false;
2001
2006
  if (this.outlineLevel) return false;
2007
+ if (this.bestFit) return false;
2002
2008
  const s = this.style;
2003
2009
  if (s && (s.font || s.numFmt || s.alignment || s.border || s.fill || s.protection)) return false;
2004
2010
  return true;
@@ -2126,7 +2132,8 @@ var ExcelTS = (function(exports) {
2126
2132
  isCustomWidth: column.isCustomWidth,
2127
2133
  hidden: column.hidden,
2128
2134
  outlineLevel: column.outlineLevel,
2129
- collapsed: column.collapsed
2135
+ collapsed: column.collapsed,
2136
+ bestFit: column.bestFit
2130
2137
  };
2131
2138
  cols.push(col);
2132
2139
  } else col.max = index + 1;
@@ -2261,12 +2268,12 @@ var ExcelTS = (function(exports) {
2261
2268
  default: throw new Error("Invalid Image Type");
2262
2269
  }
2263
2270
  }
2264
- set model({ type, imageId, range: range$1, hyperlinks }) {
2271
+ set model({ type, imageId, range, hyperlinks }) {
2265
2272
  this.type = type;
2266
2273
  this.imageId = imageId;
2267
2274
  if (type === "image") {
2268
- if (typeof range$1 === "string") {
2269
- const decoded = colCache.decode(range$1);
2275
+ if (typeof range === "string") {
2276
+ const decoded = colCache.decode(range);
2270
2277
  if ("top" in decoded) this.range = {
2271
2278
  tl: new Anchor(this.worksheet, {
2272
2279
  col: decoded.left,
@@ -2278,12 +2285,12 @@ var ExcelTS = (function(exports) {
2278
2285
  }, 0),
2279
2286
  editAs: "oneCell"
2280
2287
  };
2281
- } else if (range$1) this.range = {
2282
- tl: new Anchor(this.worksheet, range$1.tl, 0),
2283
- br: range$1.br ? new Anchor(this.worksheet, range$1.br, 0) : void 0,
2284
- ext: range$1.ext,
2285
- editAs: range$1.editAs,
2286
- hyperlinks: hyperlinks || ("hyperlinks" in range$1 ? range$1.hyperlinks : void 0)
2288
+ } else if (range) this.range = {
2289
+ tl: new Anchor(this.worksheet, range.tl, 0),
2290
+ br: range.br ? new Anchor(this.worksheet, range.br, 0) : void 0,
2291
+ ext: range.ext,
2292
+ editAs: range.editAs,
2293
+ hyperlinks: hyperlinks || ("hyperlinks" in range ? range.hyperlinks : void 0)
2287
2294
  };
2288
2295
  }
2289
2296
  }
@@ -2395,17 +2402,17 @@ var ExcelTS = (function(exports) {
2395
2402
  }
2396
2403
  validate() {
2397
2404
  const { table } = this;
2398
- const assign$1 = (o, name, dflt) => {
2405
+ const assign = (o, name, dflt) => {
2399
2406
  if (o[name] === void 0) o[name] = dflt;
2400
2407
  };
2401
- assign$1(table, "headerRow", true);
2402
- assign$1(table, "totalsRow", false);
2403
- assign$1(table, "style", {});
2404
- assign$1(table.style, "theme", "TableStyleMedium2");
2405
- assign$1(table.style, "showFirstColumn", false);
2406
- assign$1(table.style, "showLastColumn", false);
2407
- assign$1(table.style, "showRowStripes", false);
2408
- assign$1(table.style, "showColumnStripes", false);
2408
+ assign(table, "headerRow", true);
2409
+ assign(table, "totalsRow", false);
2410
+ assign(table, "style", {});
2411
+ assign(table.style, "theme", "TableStyleMedium2");
2412
+ assign(table.style, "showFirstColumn", false);
2413
+ assign(table.style, "showLastColumn", false);
2414
+ assign(table.style, "showRowStripes", false);
2415
+ assign(table.style, "showColumnStripes", false);
2409
2416
  const assert = (test, message) => {
2410
2417
  if (!test) throw new Error(message);
2411
2418
  };
@@ -2421,9 +2428,9 @@ var ExcelTS = (function(exports) {
2421
2428
  table.tableRef = colCache.encode(row, col, row + tableHeight - 1, col + width - 1);
2422
2429
  table.columns.forEach((column, i) => {
2423
2430
  assert(!!column.name, `Column ${i} must have a name`);
2424
- if (i === 0) assign$1(column, "totalsRowLabel", "Total");
2431
+ if (i === 0) assign(column, "totalsRowLabel", "Total");
2425
2432
  else {
2426
- assign$1(column, "totalsRowFunction", "none");
2433
+ assign(column, "totalsRowFunction", "none");
2427
2434
  column.totalsRowFormula = this.getFormula(column) || void 0;
2428
2435
  }
2429
2436
  });
@@ -2654,8 +2661,8 @@ var ExcelTS = (function(exports) {
2654
2661
  constructor(model) {
2655
2662
  this.model = model || {};
2656
2663
  }
2657
- add(address, validation$2) {
2658
- return this.model[address] = validation$2;
2664
+ add(address, validation) {
2665
+ return this.model[address] = validation;
2659
2666
  }
2660
2667
  find(address) {
2661
2668
  const direct = this.model[address];
@@ -2699,9 +2706,9 @@ var ExcelTS = (function(exports) {
2699
2706
  /** Default end row offset in EMUs (~20 pixels) */
2700
2707
  const DEFAULT_END_ROW_OFF = 190500;
2701
2708
  var FormCheckbox = class FormCheckbox {
2702
- constructor(worksheet, range$1, options) {
2709
+ constructor(worksheet, range, options) {
2703
2710
  this.worksheet = worksheet;
2704
- const { tl, br } = this._parseRange(range$1);
2711
+ const { tl, br } = this._parseRange(range);
2705
2712
  const shapeId = 1025 + (worksheet.formControls?.length || 0);
2706
2713
  let link;
2707
2714
  if (options?.link) link = this._toAbsoluteRef(options.link);
@@ -2764,11 +2771,11 @@ var ExcelTS = (function(exports) {
2764
2771
  /**
2765
2772
  * Parse range input into anchor positions
2766
2773
  */
2767
- _parseRange(range$1) {
2774
+ _parseRange(range) {
2768
2775
  let tl;
2769
2776
  let br;
2770
- if (typeof range$1 === "string") if (range$1.includes(":")) {
2771
- const decoded = colCache.decode(range$1);
2777
+ if (typeof range === "string") if (range.includes(":")) {
2778
+ const decoded = colCache.decode(range);
2772
2779
  if ("top" in decoded) if (decoded.left === decoded.right && decoded.top === decoded.bottom) {
2773
2780
  const col = decoded.left - 1;
2774
2781
  const row = decoded.top - 1;
@@ -2813,7 +2820,7 @@ var ExcelTS = (function(exports) {
2813
2820
  };
2814
2821
  }
2815
2822
  } else {
2816
- const decoded = colCache.decodeAddress(range$1);
2823
+ const decoded = colCache.decodeAddress(range);
2817
2824
  tl = {
2818
2825
  col: decoded.col - 1,
2819
2826
  colOff: DEFAULT_COL_OFF,
@@ -2827,22 +2834,22 @@ var ExcelTS = (function(exports) {
2827
2834
  rowOff: DEFAULT_END_ROW_OFF
2828
2835
  };
2829
2836
  }
2830
- else if ("startCol" in range$1) {
2837
+ else if ("startCol" in range) {
2831
2838
  tl = {
2832
- col: range$1.startCol,
2833
- colOff: range$1.startColOff ?? DEFAULT_COL_OFF,
2834
- row: range$1.startRow,
2835
- rowOff: range$1.startRowOff ?? DEFAULT_ROW_OFF
2839
+ col: range.startCol,
2840
+ colOff: range.startColOff ?? DEFAULT_COL_OFF,
2841
+ row: range.startRow,
2842
+ rowOff: range.startRowOff ?? DEFAULT_ROW_OFF
2836
2843
  };
2837
2844
  br = {
2838
- col: range$1.endCol,
2839
- colOff: range$1.endColOff ?? DEFAULT_END_COL_OFF,
2840
- row: range$1.endRow,
2841
- rowOff: range$1.endRowOff ?? DEFAULT_END_ROW_OFF
2845
+ col: range.endCol,
2846
+ colOff: range.endColOff ?? DEFAULT_END_COL_OFF,
2847
+ row: range.endRow,
2848
+ rowOff: range.endRowOff ?? DEFAULT_END_ROW_OFF
2842
2849
  };
2843
2850
  } else {
2844
- if (typeof range$1.tl === "string") {
2845
- const decoded = colCache.decodeAddress(range$1.tl);
2851
+ if (typeof range.tl === "string") {
2852
+ const decoded = colCache.decodeAddress(range.tl);
2846
2853
  tl = {
2847
2854
  col: decoded.col - 1,
2848
2855
  colOff: DEFAULT_COL_OFF,
@@ -2850,13 +2857,13 @@ var ExcelTS = (function(exports) {
2850
2857
  rowOff: DEFAULT_ROW_OFF
2851
2858
  };
2852
2859
  } else tl = {
2853
- col: range$1.tl.col,
2854
- colOff: range$1.tl.colOff ?? DEFAULT_COL_OFF,
2855
- row: range$1.tl.row,
2856
- rowOff: range$1.tl.rowOff ?? DEFAULT_ROW_OFF
2860
+ col: range.tl.col,
2861
+ colOff: range.tl.colOff ?? DEFAULT_COL_OFF,
2862
+ row: range.tl.row,
2863
+ rowOff: range.tl.rowOff ?? DEFAULT_ROW_OFF
2857
2864
  };
2858
- if (range$1.br) if (typeof range$1.br === "string") {
2859
- const decoded = colCache.decodeAddress(range$1.br);
2865
+ if (range.br) if (typeof range.br === "string") {
2866
+ const decoded = colCache.decodeAddress(range.br);
2860
2867
  br = {
2861
2868
  col: decoded.col - 1,
2862
2869
  colOff: DEFAULT_END_COL_OFF,
@@ -2864,10 +2871,10 @@ var ExcelTS = (function(exports) {
2864
2871
  rowOff: DEFAULT_END_ROW_OFF
2865
2872
  };
2866
2873
  } else br = {
2867
- col: range$1.br.col,
2868
- colOff: range$1.br.colOff ?? DEFAULT_END_COL_OFF,
2869
- row: range$1.br.row,
2870
- rowOff: range$1.br.rowOff ?? DEFAULT_END_ROW_OFF
2874
+ col: range.br.col,
2875
+ colOff: range.br.colOff ?? DEFAULT_END_COL_OFF,
2876
+ row: range.br.row,
2877
+ rowOff: range.br.rowOff ?? DEFAULT_END_ROW_OFF
2871
2878
  };
2872
2879
  else br = {
2873
2880
  col: tl.col + 2,
@@ -3080,9 +3087,9 @@ var ExcelTS = (function(exports) {
3080
3087
  if (latin1Decoder) try {
3081
3088
  return btoa(latin1Decoder.decode(bytes));
3082
3089
  } catch {}
3083
- const CHUNK_SIZE$1 = 32768;
3090
+ const CHUNK_SIZE = 32768;
3084
3091
  const chunks = [];
3085
- for (let i = 0; i < bytes.length; i += CHUNK_SIZE$1) chunks.push(String.fromCharCode.apply(null, bytes.subarray(i, i + CHUNK_SIZE$1)));
3092
+ for (let i = 0; i < bytes.length; i += CHUNK_SIZE) chunks.push(String.fromCharCode.apply(null, bytes.subarray(i, i + CHUNK_SIZE)));
3086
3093
  return btoa(chunks.join(""));
3087
3094
  }
3088
3095
  /**
@@ -3512,11 +3519,11 @@ var ExcelTS = (function(exports) {
3512
3519
  this._didRead = true;
3513
3520
  if (this._bufferedLength() > 0) {
3514
3521
  if (this.objectMode || size === void 0) {
3515
- const chunk$1 = this._bufferShift();
3516
- if (!this.objectMode) this._bufferSize -= this._getChunkSize(chunk$1);
3517
- const decoded$1 = this._applyEncoding(chunk$1);
3522
+ const chunk = this._bufferShift();
3523
+ if (!this.objectMode) this._bufferSize -= this._getChunkSize(chunk);
3524
+ const decoded = this._applyEncoding(chunk);
3518
3525
  if (this._ended && this._bufferedLength() === 0) queueMicrotask(() => this._emitEndOnce());
3519
- return decoded$1;
3526
+ return decoded;
3520
3527
  }
3521
3528
  const chunk = this._bufferShift();
3522
3529
  if (!this.objectMode) this._bufferSize -= this._getChunkSize(chunk);
@@ -3924,8 +3931,8 @@ var ExcelTS = (function(exports) {
3924
3931
  while (true) {
3925
3932
  if (streamError) throw streamError;
3926
3933
  if (dataQueueIndex < dataQueue.length) {
3927
- const chunk$1 = dataQueue[dataQueueIndex++];
3928
- queuedSize -= chunkSizeForBackpressure(chunk$1);
3934
+ const chunk = dataQueue[dataQueueIndex++];
3935
+ queuedSize -= chunkSizeForBackpressure(chunk);
3929
3936
  if (dataQueueIndex >= 1024 && dataQueueIndex * 2 >= dataQueue.length) {
3930
3937
  dataQueue.splice(0, dataQueueIndex);
3931
3938
  dataQueueIndex = 0;
@@ -3934,7 +3941,7 @@ var ExcelTS = (function(exports) {
3934
3941
  pausedByIterator = false;
3935
3942
  this.resume();
3936
3943
  }
3937
- yield chunk$1;
3944
+ yield chunk;
3938
3945
  continue;
3939
3946
  }
3940
3947
  if (done) break;
@@ -6043,8 +6050,8 @@ var ExcelTS = (function(exports) {
6043
6050
  }
6044
6051
  }
6045
6052
  }
6046
- fillFormula(range$1, formula, results, shareType = "shared") {
6047
- const { top, left, bottom, right } = colCache.decode(range$1);
6053
+ fillFormula(range, formula, results, shareType = "shared") {
6054
+ const { top, left, bottom, right } = colCache.decode(range);
6048
6055
  const width = right - left + 1;
6049
6056
  const masterAddress = colCache.encodeAddress(top, left);
6050
6057
  const isShared = shareType === "shared";
@@ -6059,7 +6066,7 @@ var ExcelTS = (function(exports) {
6059
6066
  cell.value = {
6060
6067
  shareType,
6061
6068
  formula,
6062
- ref: range$1,
6069
+ ref: range,
6063
6070
  result: getResult(r, c)
6064
6071
  };
6065
6072
  first = false;
@@ -6072,11 +6079,11 @@ var ExcelTS = (function(exports) {
6072
6079
  * Using the image id from `Workbook.addImage`,
6073
6080
  * embed an image within the worksheet to cover a range
6074
6081
  */
6075
- addImage(imageId, range$1) {
6082
+ addImage(imageId, range) {
6076
6083
  const model = {
6077
6084
  type: "image",
6078
6085
  imageId: String(imageId),
6079
- range: range$1
6086
+ range
6080
6087
  };
6081
6088
  this._media.push(new Image(this, model));
6082
6089
  }
@@ -6121,8 +6128,8 @@ var ExcelTS = (function(exports) {
6121
6128
  * checked: false
6122
6129
  * });
6123
6130
  */
6124
- addFormCheckbox(range$1, options) {
6125
- const checkbox = new FormCheckbox(this, range$1, options);
6131
+ addFormCheckbox(range, options) {
6132
+ const checkbox = new FormCheckbox(this, range, options);
6126
6133
  this.formControls.push(checkbox);
6127
6134
  return checkbox;
6128
6135
  }
@@ -6471,7 +6478,7 @@ var ExcelTS = (function(exports) {
6471
6478
  _explore(matrix, cell) {
6472
6479
  cell.mark = false;
6473
6480
  const { sheetName } = cell;
6474
- const range$1 = new Range(cell.row, cell.col, cell.row, cell.col, sheetName);
6481
+ const range = new Range(cell.row, cell.col, cell.row, cell.col, sheetName);
6475
6482
  let x;
6476
6483
  let y;
6477
6484
  const getCell = (row, col) => {
@@ -6480,7 +6487,7 @@ var ExcelTS = (function(exports) {
6480
6487
  function vGrow(yy, edge) {
6481
6488
  const c = getCell(yy, cell.col);
6482
6489
  if (!c || !c.mark) return false;
6483
- range$1[edge] = yy;
6490
+ range[edge] = yy;
6484
6491
  c.mark = false;
6485
6492
  return true;
6486
6493
  }
@@ -6488,18 +6495,18 @@ var ExcelTS = (function(exports) {
6488
6495
  for (y = cell.row + 1; vGrow(y, "bottom"); y++);
6489
6496
  function hGrow(xx, edge) {
6490
6497
  const cells = [];
6491
- for (y = range$1.top; y <= range$1.bottom; y++) {
6498
+ for (y = range.top; y <= range.bottom; y++) {
6492
6499
  const c = getCell(y, xx);
6493
6500
  if (c && c.mark) cells.push(c);
6494
6501
  else return false;
6495
6502
  }
6496
- range$1[edge] = xx;
6503
+ range[edge] = xx;
6497
6504
  for (let i = 0; i < cells.length; i++) cells[i].mark = false;
6498
6505
  return true;
6499
6506
  }
6500
6507
  for (x = cell.col - 1; hGrow(x, "left"); x--);
6501
6508
  for (x = cell.col + 1; hGrow(x, "right"); x++);
6502
- return range$1;
6509
+ return range;
6503
6510
  }
6504
6511
  getRanges(name, matrix) {
6505
6512
  matrix = matrix || this.matrixMap[name];
@@ -6512,7 +6519,7 @@ var ExcelTS = (function(exports) {
6512
6519
  });
6513
6520
  return {
6514
6521
  name,
6515
- ranges: matrix.map((cell) => cell.mark && this._explore(matrix, cell)).filter(Boolean).map((range$1) => range$1.$shortRange)
6522
+ ranges: matrix.map((cell) => cell.mark && this._explore(matrix, cell)).filter(Boolean).map((range) => range.$shortRange)
6516
6523
  };
6517
6524
  }
6518
6525
  normaliseMatrix(matrix, sheetName) {
@@ -7614,9 +7621,9 @@ var ExcelTS = (function(exports) {
7614
7621
  reconcile(_model, _options) {}
7615
7622
  reset() {
7616
7623
  this.model = null;
7617
- if (this.map) Object.values(this.map).forEach((xform$1) => {
7618
- if (xform$1 instanceof BaseXform) xform$1.reset();
7619
- else if (xform$1.xform) xform$1.xform.reset();
7624
+ if (this.map) Object.values(this.map).forEach((xform) => {
7625
+ if (xform instanceof BaseXform) xform.reset();
7626
+ else if (xform.xform) xform.xform.reset();
7620
7627
  });
7621
7628
  }
7622
7629
  mergeModel(obj) {
@@ -9006,12 +9013,13 @@ var ExcelTS = (function(exports) {
9006
9013
  borderId: model.borderId || 0
9007
9014
  });
9008
9015
  if (this.xfId) xmlStream.addAttribute("xfId", model.xfId || 0);
9009
- if (model.numFmtId) xmlStream.addAttribute("applyNumberFormat", "1");
9010
- if (model.fontId) xmlStream.addAttribute("applyFont", "1");
9011
- if (model.fillId) xmlStream.addAttribute("applyFill", "1");
9012
- if (model.borderId) xmlStream.addAttribute("applyBorder", "1");
9013
- if (model.alignment) xmlStream.addAttribute("applyAlignment", "1");
9014
- if (model.protection) xmlStream.addAttribute("applyProtection", "1");
9016
+ if (model.applyNumberFormat || model.numFmtId) xmlStream.addAttribute("applyNumberFormat", "1");
9017
+ if (model.applyFont || model.fontId) xmlStream.addAttribute("applyFont", "1");
9018
+ if (model.applyFill || model.fillId) xmlStream.addAttribute("applyFill", "1");
9019
+ if (model.applyBorder || model.borderId) xmlStream.addAttribute("applyBorder", "1");
9020
+ if (model.applyAlignment || model.alignment) xmlStream.addAttribute("applyAlignment", "1");
9021
+ if (model.applyProtection || model.protection) xmlStream.addAttribute("applyProtection", "1");
9022
+ if (model.pivotButton) xmlStream.addAttribute("pivotButton", "1");
9015
9023
  /**
9016
9024
  * Rendering tags causes close of XML stream.
9017
9025
  * Therefore adding attributes must be done before rendering tags.
@@ -9044,6 +9052,15 @@ var ExcelTS = (function(exports) {
9044
9052
  borderId: parseInt(node.attributes.borderId, 10)
9045
9053
  };
9046
9054
  if (this.xfId) this.model.xfId = parseInt(node.attributes.xfId, 10);
9055
+ if (node.attributes.pivotButton === "1") this.model.pivotButton = true;
9056
+ for (const flag of [
9057
+ "applyNumberFormat",
9058
+ "applyFont",
9059
+ "applyFill",
9060
+ "applyBorder",
9061
+ "applyAlignment",
9062
+ "applyProtection"
9063
+ ]) if (node.attributes[flag] === "1") this.model[flag] = true;
9047
9064
  return true;
9048
9065
  case "alignment":
9049
9066
  this.parser = this.map.alignment;
@@ -9237,6 +9254,13 @@ var ExcelTS = (function(exports) {
9237
9254
  this.weakMap = /* @__PURE__ */ new WeakMap();
9238
9255
  this._hasCheckboxes = false;
9239
9256
  }
9257
+ /**
9258
+ * Set the default font to use when no font is explicitly specified.
9259
+ * This preserves the original file's default font during round-trip.
9260
+ */
9261
+ setDefaultFont(font) {
9262
+ this.defaultFont = font;
9263
+ }
9240
9264
  render(xmlStream, model) {
9241
9265
  const renderModel = model || this.model;
9242
9266
  xmlStream.openXml(XmlStream.StdDocAttributes);
@@ -9249,7 +9273,7 @@ var ExcelTS = (function(exports) {
9249
9273
  });
9250
9274
  xmlStream.closeNode();
9251
9275
  }
9252
- if (!renderModel.fonts.length) this._addFont({
9276
+ if (!renderModel.fonts.length) this._addFont(this.defaultFont || {
9253
9277
  size: 11,
9254
9278
  color: { theme: 1 },
9255
9279
  name: "Calibri",
@@ -9332,8 +9356,8 @@ var ExcelTS = (function(exports) {
9332
9356
  switch (name) {
9333
9357
  case "styleSheet": {
9334
9358
  this.model = {};
9335
- const add = (propName, xform$1) => {
9336
- if (xform$1.model && xform$1.model.length) this.model[propName] = xform$1.model;
9359
+ const add = (propName, xform) => {
9360
+ if (xform.model && xform.model.length) this.model[propName] = xform.model;
9337
9361
  };
9338
9362
  add("numFmts", this.map.numFmts);
9339
9363
  add("fonts", this.map.fonts);
@@ -9341,6 +9365,7 @@ var ExcelTS = (function(exports) {
9341
9365
  add("borders", this.map.borders);
9342
9366
  add("styles", this.map.cellXfs);
9343
9367
  add("dxfs", this.map.dxfs);
9368
+ if (this.map.fonts.model && this.map.fonts.model.length > 0) this.defaultFont = this.map.fonts.model[0];
9344
9369
  this.index = {
9345
9370
  model: [],
9346
9371
  numFmt: {}
@@ -9358,7 +9383,7 @@ var ExcelTS = (function(exports) {
9358
9383
  }
9359
9384
  addStyleModel(model, cellType) {
9360
9385
  if (!model) return 0;
9361
- if (!this.model.fonts.length) this._addFont({
9386
+ if (!this.model.fonts.length) this._addFont(this.defaultFont || {
9362
9387
  size: 11,
9363
9388
  color: { theme: 1 },
9364
9389
  name: "Calibri",
@@ -9383,6 +9408,15 @@ var ExcelTS = (function(exports) {
9383
9408
  if (model.fill) style.fillId = this._addFill(model.fill);
9384
9409
  if (model.alignment) style.alignment = model.alignment;
9385
9410
  if (model.protection) style.protection = model.protection;
9411
+ for (const flag of [
9412
+ "pivotButton",
9413
+ "applyNumberFormat",
9414
+ "applyFont",
9415
+ "applyFill",
9416
+ "applyBorder",
9417
+ "applyAlignment",
9418
+ "applyProtection"
9419
+ ]) if (model[flag]) style[flag] = true;
9386
9420
  if (type === Enums.ValueType.Checkbox) {
9387
9421
  this._hasCheckboxes = true;
9388
9422
  style.alignment = style.alignment || {};
@@ -9414,6 +9448,15 @@ var ExcelTS = (function(exports) {
9414
9448
  addStyle("fill", this.model.fills, style.fillId);
9415
9449
  if (style.alignment) model.alignment = style.alignment;
9416
9450
  if (style.protection) model.protection = style.protection;
9451
+ for (const flag of [
9452
+ "pivotButton",
9453
+ "applyNumberFormat",
9454
+ "applyFont",
9455
+ "applyFill",
9456
+ "applyBorder",
9457
+ "applyAlignment",
9458
+ "applyProtection"
9459
+ ]) if (style[flag]) model[flag] = true;
9417
9460
  return model;
9418
9461
  }
9419
9462
  addDxfStyle(style) {
@@ -10653,12 +10696,12 @@ var ExcelTS = (function(exports) {
10653
10696
  const cellRangeRegexp = /^[$]?[A-Za-z]{1,3}[$]?\d+(:[$]?[A-Za-z]{1,3}[$]?\d+)?$/;
10654
10697
  const rowRangeRegexp = /^[$]?\d+:[$]?\d+$/;
10655
10698
  const colRangeRegexp = /^[$]?[A-Za-z]{1,3}:[$]?[A-Za-z]{1,3}$/;
10656
- function isValidRange(range$1) {
10657
- if (range$1.startsWith("{") || range$1.endsWith("}")) return false;
10658
- const cellRef = range$1.split("!").pop() || "";
10699
+ function isValidRange(range) {
10700
+ if (range.startsWith("{") || range.endsWith("}")) return false;
10701
+ const cellRef = range.split("!").pop() || "";
10659
10702
  if (!cellRangeRegexp.test(cellRef) && !rowRangeRegexp.test(cellRef) && !colRangeRegexp.test(cellRef)) return false;
10660
10703
  try {
10661
- const decoded = colCache.decodeEx(range$1);
10704
+ const decoded = colCache.decodeEx(range);
10662
10705
  if ("row" in decoded && typeof decoded.row === "number" || "top" in decoded && typeof decoded.top === "number" || "left" in decoded && typeof decoded.left === "number") return true;
10663
10706
  return false;
10664
10707
  } catch {
@@ -10974,8 +11017,8 @@ var ExcelTS = (function(exports) {
10974
11017
  worksheet = worksheets[definedName.localSheetId];
10975
11018
  if (worksheet) {
10976
11019
  if (!worksheet.pageSetup) worksheet.pageSetup = {};
10977
- const range$1 = colCache.decodeEx(definedName.ranges[0]);
10978
- worksheet.pageSetup.printArea = worksheet.pageSetup.printArea ? `${worksheet.pageSetup.printArea}&&${range$1.dimensions}` : range$1.dimensions;
11020
+ const range = colCache.decodeEx(definedName.ranges[0]);
11021
+ worksheet.pageSetup.printArea = worksheet.pageSetup.printArea ? `${worksheet.pageSetup.printArea}&&${range.dimensions}` : range.dimensions;
10979
11022
  }
10980
11023
  } else if (definedName.name === "_xlnm.Print_Titles") {
10981
11024
  worksheet = worksheets[definedName.localSheetId];
@@ -10985,13 +11028,13 @@ var ExcelTS = (function(exports) {
10985
11028
  const dollarRegex = /\$/g;
10986
11029
  const rowRangeMatches = rangeString.match(/\$\d+:\$\d+/);
10987
11030
  if (rowRangeMatches && rowRangeMatches.length) {
10988
- const range$1 = rowRangeMatches[0];
10989
- worksheet.pageSetup.printTitlesRow = range$1.replace(dollarRegex, "");
11031
+ const range = rowRangeMatches[0];
11032
+ worksheet.pageSetup.printTitlesRow = range.replace(dollarRegex, "");
10990
11033
  }
10991
11034
  const columnRangeMatches = rangeString.match(/\$[A-Z]+:\$[A-Z]+/);
10992
11035
  if (columnRangeMatches && columnRangeMatches.length) {
10993
- const range$1 = columnRangeMatches[0];
10994
- worksheet.pageSetup.printTitlesColumn = range$1.replace(dollarRegex, "");
11036
+ const range = columnRangeMatches[0];
11037
+ worksheet.pageSetup.printTitlesColumn = range.replace(dollarRegex, "");
10995
11038
  }
10996
11039
  }
10997
11040
  } else definedNames.push(definedName);
@@ -11055,8 +11098,8 @@ var ExcelTS = (function(exports) {
11055
11098
  add(merge) {
11056
11099
  if (this.merges[merge.master]) this.merges[merge.master].expandToAddress(merge.address);
11057
11100
  else {
11058
- const range$1 = `${merge.master}:${merge.address}`;
11059
- this.merges[merge.master] = new Range(range$1);
11101
+ const range = `${merge.master}:${merge.address}`;
11102
+ this.merges[merge.master] = new Range(range);
11060
11103
  }
11061
11104
  }
11062
11105
  get mergeCells() {
@@ -11079,8 +11122,8 @@ var ExcelTS = (function(exports) {
11079
11122
  });
11080
11123
  }
11081
11124
  getMasterAddress(address) {
11082
- const range$1 = this.hash[address];
11083
- return range$1 && range$1.tl;
11125
+ const range = this.hash[address];
11126
+ return range && range.tl;
11084
11127
  }
11085
11128
  };
11086
11129
 
@@ -11472,6 +11515,7 @@ var ExcelTS = (function(exports) {
11472
11515
  xmlStream.addAttribute("s", model.styleId);
11473
11516
  xmlStream.addAttribute("customFormat", "1");
11474
11517
  }
11518
+ if (model.dyDescent !== void 0) xmlStream.addAttribute("x14ac:dyDescent", model.dyDescent);
11475
11519
  if (model.outlineLevel) xmlStream.addAttribute("outlineLevel", model.outlineLevel);
11476
11520
  if (model.collapsed) xmlStream.addAttribute("collapsed", "1");
11477
11521
  const cellXform = this.map.c;
@@ -11501,6 +11545,7 @@ var ExcelTS = (function(exports) {
11501
11545
  if (node.attributes.ht) model.height = parseFloat(node.attributes.ht);
11502
11546
  if (node.attributes.outlineLevel) model.outlineLevel = parseInt(node.attributes.outlineLevel, 10);
11503
11547
  if (parseBoolean(node.attributes.collapsed)) model.collapsed = true;
11548
+ if (node.attributes["x14ac:dyDescent"] !== void 0) model.dyDescent = parseFloat(node.attributes["x14ac:dyDescent"]);
11504
11549
  return true;
11505
11550
  }
11506
11551
  this.parser = this.map[node.name];
@@ -12001,10 +12046,10 @@ var ExcelTS = (function(exports) {
12001
12046
  defaultRowHeight: model.defaultRowHeight,
12002
12047
  outlineLevelRow: model.outlineLevelRow || void 0,
12003
12048
  outlineLevelCol: model.outlineLevelCol || void 0,
12004
- "x14ac:dyDescent": model.dyDescent || void 0
12049
+ "x14ac:dyDescent": model.dyDescent !== void 0 && model.dyDescent !== 0 ? model.dyDescent : void 0
12005
12050
  };
12006
12051
  if (model.defaultColWidth) attributes.defaultColWidth = model.defaultColWidth;
12007
- if (!model.defaultRowHeight || model.defaultRowHeight !== 15) attributes.customHeight = "1";
12052
+ if (model.customHeight) attributes.customHeight = "1";
12008
12053
  if (Object.values(attributes).some((value) => value !== void 0)) xmlStream.leafNode("sheetFormatPr", attributes);
12009
12054
  }
12010
12055
  }
@@ -12012,11 +12057,12 @@ var ExcelTS = (function(exports) {
12012
12057
  if (node.name === "sheetFormatPr") {
12013
12058
  this.model = {
12014
12059
  defaultRowHeight: parseFloat(node.attributes.defaultRowHeight || "0"),
12015
- dyDescent: parseFloat(node.attributes["x14ac:dyDescent"] || "0"),
12060
+ dyDescent: node.attributes["x14ac:dyDescent"] !== void 0 ? parseFloat(node.attributes["x14ac:dyDescent"]) : void 0,
12016
12061
  outlineLevelRow: parseInt(node.attributes.outlineLevelRow || "0", 10),
12017
12062
  outlineLevelCol: parseInt(node.attributes.outlineLevelCol || "0", 10)
12018
12063
  };
12019
12064
  if (node.attributes.defaultColWidth) this.model.defaultColWidth = parseFloat(node.attributes.defaultColWidth);
12065
+ if (node.attributes.customHeight === "1") this.model.customHeight = true;
12020
12066
  return true;
12021
12067
  }
12022
12068
  return false;
@@ -12059,8 +12105,8 @@ var ExcelTS = (function(exports) {
12059
12105
  add("showRuler", "0", model.showRuler === false);
12060
12106
  add("showRowColHeaders", "0", model.showRowColHeaders === false);
12061
12107
  add("showGridLines", "0", model.showGridLines === false);
12062
- add("zoomScale", model.zoomScale, model.zoomScale);
12063
- add("zoomScaleNormal", model.zoomScaleNormal, model.zoomScaleNormal);
12108
+ add("zoomScale", model.zoomScale, model.zoomScale !== void 0 && model.zoomScale !== 100);
12109
+ add("zoomScaleNormal", model.zoomScaleNormal, model.zoomScaleNormal !== void 0 && model.zoomScaleNormal !== 100);
12064
12110
  add("view", model.style, model.style);
12065
12111
  let topLeftCell;
12066
12112
  let xSplit;
@@ -12156,6 +12202,7 @@ var ExcelTS = (function(exports) {
12156
12202
  model = this.model = {
12157
12203
  workbookViewId: this.sheetView.workbookViewId,
12158
12204
  rightToLeft: this.sheetView.rightToLeft,
12205
+ tabSelected: this.sheetView.tabSelected,
12159
12206
  state: VIEW_STATES[this.pane.state] || "split",
12160
12207
  xSplit: this.pane.xSplit,
12161
12208
  ySplit: this.pane.ySplit,
@@ -12174,6 +12221,7 @@ var ExcelTS = (function(exports) {
12174
12221
  model = this.model = {
12175
12222
  workbookViewId: this.sheetView.workbookViewId,
12176
12223
  rightToLeft: this.sheetView.rightToLeft,
12224
+ tabSelected: this.sheetView.tabSelected,
12177
12225
  state: "normal",
12178
12226
  showRuler: this.sheetView.showRuler,
12179
12227
  showRowColHeaders: this.sheetView.showRowColHeaders,
@@ -14059,7 +14107,8 @@ var ExcelTS = (function(exports) {
14059
14107
  defaultRowHeight: model.properties.defaultRowHeight,
14060
14108
  dyDescent: model.properties.dyDescent,
14061
14109
  outlineLevelCol: model.properties.outlineLevelCol,
14062
- outlineLevelRow: model.properties.outlineLevelRow
14110
+ outlineLevelRow: model.properties.outlineLevelRow,
14111
+ customHeight: model.properties.customHeight
14063
14112
  } : void 0;
14064
14113
  if (model.properties && model.properties.defaultColWidth) sheetFormatPropertiesModel.defaultColWidth = model.properties.defaultColWidth;
14065
14114
  const sheetPropertiesModel = {
@@ -14155,8 +14204,8 @@ var ExcelTS = (function(exports) {
14155
14204
  return true;
14156
14205
  }
14157
14206
  if (node.name === "worksheet") {
14158
- Object.values(this.map).forEach((xform$1) => {
14159
- xform$1.reset();
14207
+ Object.values(this.map).forEach((xform) => {
14208
+ xform.reset();
14160
14209
  });
14161
14210
  return true;
14162
14211
  }
@@ -16195,11 +16244,13 @@ var ExcelTS = (function(exports) {
16195
16244
  for (const item of model.rowItems) this.renderRowColItem(xmlStream, item);
16196
16245
  xmlStream.closeNode();
16197
16246
  } else xmlStream.writeXml("<rowItems count=\"1\"><i t=\"grand\"><x/></i></rowItems>");
16198
- const colFieldCount = model.colFields.length === 0 ? 1 : model.colFields.length;
16199
- xmlStream.openNode("colFields", { count: colFieldCount });
16200
- if (model.colFields.length === 0) xmlStream.leafNode("field", { x: -2 });
16201
- else for (const fieldIndex of model.colFields) xmlStream.leafNode("field", { x: fieldIndex });
16202
- xmlStream.closeNode();
16247
+ if (model.hasColFields || model.colFields.length > 0) {
16248
+ const colFieldCount = model.colFields.length === 0 ? 1 : model.colFields.length;
16249
+ xmlStream.openNode("colFields", { count: colFieldCount });
16250
+ if (model.colFields.length === 0) xmlStream.leafNode("field", { x: -2 });
16251
+ else for (const fieldIndex of model.colFields) xmlStream.leafNode("field", { x: fieldIndex });
16252
+ xmlStream.closeNode();
16253
+ }
16203
16254
  if (model.colItems && model.colItems.length > 0) {
16204
16255
  xmlStream.openNode("colItems", { count: model.colItems.length });
16205
16256
  for (const item of model.colItems) this.renderRowColItem(xmlStream, item);
@@ -16345,6 +16396,7 @@ var ExcelTS = (function(exports) {
16345
16396
  break;
16346
16397
  case "colFields":
16347
16398
  this.state.inColFields = true;
16399
+ if (this.model) this.model.hasColFields = true;
16348
16400
  break;
16349
16401
  case "dataFields":
16350
16402
  this.state.inDataFields = true;
@@ -16521,13 +16573,13 @@ var ExcelTS = (function(exports) {
16521
16573
  function buildColItems(columns, cacheFields, valueCount) {
16522
16574
  if (columns.length === 0) {
16523
16575
  if (valueCount > 1) {
16524
- const items$1 = [];
16525
- for (let i = 0; i < valueCount; i++) if (i === 0) items$1.push("<i><x /></i>");
16526
- else items$1.push(`<i><x v="${i}" /></i>`);
16527
- items$1.push("<i t=\"grand\"><x /></i>");
16576
+ const items = [];
16577
+ for (let i = 0; i < valueCount; i++) if (i === 0) items.push("<i><x /></i>");
16578
+ else items.push(`<i><x v="${i}" /></i>`);
16579
+ items.push("<i t=\"grand\"><x /></i>");
16528
16580
  return {
16529
- count: items$1.length,
16530
- xml: items$1.join("\n ")
16581
+ count: items.length,
16582
+ xml: items.join("\n ")
16531
16583
  };
16532
16584
  }
16533
16585
  return {
@@ -17232,7 +17284,6 @@ var ExcelTS = (function(exports) {
17232
17284
  switch (checked) {
17233
17285
  case "Checked": return "1";
17234
17286
  case "Mixed": return "2";
17235
- case "Unchecked":
17236
17287
  default: return "0";
17237
17288
  }
17238
17289
  }
@@ -17421,9 +17472,9 @@ var ExcelTS = (function(exports) {
17421
17472
  read(size) {
17422
17473
  if (size === 0) return null;
17423
17474
  if (size === void 0 || size >= this.length) {
17424
- const buf$1 = this.toBuffer();
17475
+ const buf = this.toBuffer();
17425
17476
  this.iRead = this.iWrite;
17426
- return buf$1;
17477
+ return buf;
17427
17478
  }
17428
17479
  const buf = this.buffer.slice(this.iRead, this.iRead + size);
17429
17480
  this.iRead += size;
@@ -17601,18 +17652,18 @@ var ExcelTS = (function(exports) {
17601
17652
  */
17602
17653
  read(size) {
17603
17654
  if (size) {
17604
- const buffers$1 = [];
17655
+ const buffers = [];
17605
17656
  let remaining = size;
17606
17657
  while (remaining && this.buffers.length && !this.buffers[0].eod) {
17607
17658
  const first = this.buffers[0];
17608
17659
  const buffer = first.read(remaining);
17609
17660
  if (buffer) {
17610
17661
  remaining -= buffer.length;
17611
- buffers$1.push(buffer);
17662
+ buffers.push(buffer);
17612
17663
  }
17613
17664
  if (first.eod && first.full) this.buffers.shift();
17614
17665
  }
17615
- return concatUint8Arrays$1(buffers$1);
17666
+ return concatUint8Arrays$1(buffers);
17616
17667
  }
17617
17668
  const buffers = this.buffers.map((buf) => buf.toBuffer()).filter(Boolean);
17618
17669
  this.buffers = [];
@@ -18118,7 +18169,7 @@ var ExcelTS = (function(exports) {
18118
18169
  const hdist = reader.readBits(5) + 1;
18119
18170
  const hclen = reader.readBits(4) + 4;
18120
18171
  const codeLengthLengths = new Uint8Array(19);
18121
- for (let i$1 = 0; i$1 < hclen; i$1++) codeLengthLengths[CODE_LENGTH_ORDER[i$1]] = reader.readBits(3);
18172
+ for (let i = 0; i < hclen; i++) codeLengthLengths[CODE_LENGTH_ORDER[i]] = reader.readBits(3);
18122
18173
  const codeLengthTree = buildHuffmanTree(codeLengthLengths, 19);
18123
18174
  const allLengths = new Uint8Array(hlit + hdist);
18124
18175
  let i = 0;
@@ -18580,7 +18631,7 @@ var ExcelTS = (function(exports) {
18580
18631
  const c = this._chunks[0];
18581
18632
  const start = this._headOffset;
18582
18633
  const end = start + length;
18583
- const out$1 = c.subarray(start, end);
18634
+ const out = c.subarray(start, end);
18584
18635
  this._headOffset = end;
18585
18636
  this._length -= length;
18586
18637
  if (this._length === 0) {
@@ -18590,7 +18641,7 @@ var ExcelTS = (function(exports) {
18590
18641
  this._chunks.shift();
18591
18642
  this._headOffset = 0;
18592
18643
  }
18593
- return out$1;
18644
+ return out;
18594
18645
  }
18595
18646
  const out = new Uint8Array(length);
18596
18647
  let outOffset = 0;
@@ -18772,10 +18823,10 @@ var ExcelTS = (function(exports) {
18772
18823
  }
18773
18824
  /** Peek a little-endian uint32 at `offset` without consuming bytes. Returns null if not enough bytes. */
18774
18825
  peekUint32LE(offset) {
18775
- const off$1 = offset | 0;
18776
- if (off$1 < 0 || off$1 + 4 > this._length) return null;
18826
+ const off = offset | 0;
18827
+ if (off < 0 || off + 4 > this._length) return null;
18777
18828
  const chunks = this._chunks;
18778
- let remaining = off$1;
18829
+ let remaining = off;
18779
18830
  for (let i = 0; i < chunks.length; i++) {
18780
18831
  const c = chunks[i];
18781
18832
  const start = i === 0 ? this._headOffset : 0;
@@ -18783,11 +18834,11 @@ var ExcelTS = (function(exports) {
18783
18834
  if (remaining < avail) {
18784
18835
  const idx = start + remaining;
18785
18836
  if (idx + 4 <= c.length) {
18786
- const b0$1 = c[idx] | 0;
18787
- const b1$1 = c[idx + 1] | 0;
18788
- const b2$1 = c[idx + 2] | 0;
18789
- const b3$1 = c[idx + 3] | 0;
18790
- return (b0$1 | b1$1 << 8 | b2$1 << 16 | b3$1 << 24) >>> 0;
18837
+ const b0 = c[idx] | 0;
18838
+ const b1 = c[idx + 1] | 0;
18839
+ const b2 = c[idx + 2] | 0;
18840
+ const b3 = c[idx + 3] | 0;
18841
+ return (b0 | b1 << 8 | b2 << 16 | b3 << 24) >>> 0;
18791
18842
  }
18792
18843
  const b0 = c[idx] | 0;
18793
18844
  let b1 = 0;
@@ -18816,9 +18867,9 @@ var ExcelTS = (function(exports) {
18816
18867
  }
18817
18868
  /** Peek a single byte at `offset` without consuming bytes. */
18818
18869
  peekByte(offset) {
18819
- const off$1 = offset | 0;
18820
- if (off$1 < 0 || off$1 >= this._length) throw new RangeError("ByteQueue: peek beyond available data");
18821
- let remaining = off$1;
18870
+ const off = offset | 0;
18871
+ if (off < 0 || off >= this._length) throw new RangeError("ByteQueue: peek beyond available data");
18872
+ let remaining = off;
18822
18873
  for (let i = 0; i < this._chunks.length; i++) {
18823
18874
  const c = this._chunks[i];
18824
18875
  const start = i === 0 ? this._headOffset : 0;
@@ -19102,9 +19153,9 @@ var ExcelTS = (function(exports) {
19102
19153
  }
19103
19154
  };
19104
19155
  var BufferedCodec = class extends EventEmitter {
19105
- constructor(process$1) {
19156
+ constructor(process) {
19106
19157
  super();
19107
- this.process = process$1;
19158
+ this.process = process;
19108
19159
  this.chunks = [];
19109
19160
  this.ended = false;
19110
19161
  }
@@ -19712,27 +19763,27 @@ var ExcelTS = (function(exports) {
19712
19763
  }
19713
19764
  _pushUnchained(data, final, callback) {
19714
19765
  if (this._finalized) {
19715
- const promise$1 = Promise.reject(/* @__PURE__ */ new Error("Cannot push to finalized ZipDeflateFile"));
19716
- this._tapCallback(promise$1, callback);
19717
- return promise$1;
19766
+ const promise = Promise.reject(/* @__PURE__ */ new Error("Cannot push to finalized ZipDeflateFile"));
19767
+ this._tapCallback(promise, callback);
19768
+ return promise;
19718
19769
  }
19719
19770
  if (this._deflateWanted === null) {
19720
19771
  this._accumulateSample(data);
19721
19772
  if (!this._shouldDecide(final)) {
19722
19773
  if (data.length > 0) this._pendingChunks.push(data);
19723
- const promise$2 = Promise.resolve();
19724
- this._tapCallback(promise$2, callback);
19725
- return promise$2;
19774
+ const promise = Promise.resolve();
19775
+ this._tapCallback(promise, callback);
19776
+ return promise;
19726
19777
  }
19727
19778
  this._decideCompressionIfNeeded(final);
19728
19779
  this._emitHeaderIfNeeded();
19729
19780
  const hadPendingChunks = this._pendingChunks.length > 0;
19730
19781
  const flushPromise = this._flushPendingChunks();
19731
- let writePromise$1 = flushPromise;
19732
- if (data.length > 0) writePromise$1 = hadPendingChunks ? flushPromise.then(() => this._writeData(data)) : this._writeData(data);
19733
- const promise$1 = final ? this._finalizeAfterWrite(writePromise$1) : writePromise$1;
19734
- this._tapCallback(promise$1, callback);
19735
- return promise$1;
19782
+ let writePromise = flushPromise;
19783
+ if (data.length > 0) writePromise = hadPendingChunks ? flushPromise.then(() => this._writeData(data)) : this._writeData(data);
19784
+ const promise = final ? this._finalizeAfterWrite(writePromise) : writePromise;
19785
+ this._tapCallback(promise, callback);
19786
+ return promise;
19736
19787
  }
19737
19788
  this._emitHeaderIfNeeded();
19738
19789
  const writePromise = this._writeData(data);
@@ -20446,8 +20497,8 @@ var ExcelTS = (function(exports) {
20446
20497
  /**
20447
20498
  * Write all passthrough files to a ZIP writer
20448
20499
  */
20449
- writeToZip(zip$1) {
20450
- for (const [path, data] of this.files) zip$1.append(data, { name: path });
20500
+ writeToZip(zip) {
20501
+ for (const [path, data] of this.files) zip.append(data, { name: path });
20451
20502
  }
20452
20503
  /**
20453
20504
  * Clear all stored files
@@ -20602,23 +20653,23 @@ var ExcelTS = (function(exports) {
20602
20653
  * Write all workbook content to a ZIP writer
20603
20654
  * Shared by both Node.js write() and browser writeBuffer()
20604
20655
  */
20605
- async writeToZip(zip$1, options) {
20656
+ async writeToZip(zip, options) {
20606
20657
  const { model } = this.workbook;
20607
20658
  this.prepareModel(model, options);
20608
- await this.addContentTypes(zip$1, model);
20609
- await this.addOfficeRels(zip$1, model);
20610
- await this.addWorkbookRels(zip$1, model);
20611
- await this.addWorksheets(zip$1, model);
20612
- await this.addSharedStrings(zip$1, model);
20613
- this.addDrawings(zip$1, model);
20614
- this.addTables(zip$1, model);
20615
- this.addPivotTables(zip$1, model);
20616
- this.addPassthrough(zip$1, model);
20617
- await Promise.all([this.addThemes(zip$1, model), this.addStyles(zip$1, model)]);
20618
- await this.addFeaturePropertyBag(zip$1, model);
20619
- await this.addMedia(zip$1, model);
20620
- await Promise.all([this.addApp(zip$1, model), this.addCore(zip$1, model)]);
20621
- await this.addWorkbook(zip$1, model);
20659
+ await this.addContentTypes(zip, model);
20660
+ await this.addOfficeRels(zip, model);
20661
+ await this.addWorkbookRels(zip, model);
20662
+ await this.addWorksheets(zip, model);
20663
+ await this.addSharedStrings(zip, model);
20664
+ this.addDrawings(zip, model);
20665
+ this.addTables(zip, model);
20666
+ this.addPivotTables(zip, model);
20667
+ this.addPassthrough(zip, model);
20668
+ await Promise.all([this.addThemes(zip, model), this.addStyles(zip, model)]);
20669
+ await this.addFeaturePropertyBag(zip, model);
20670
+ await this.addMedia(zip, model);
20671
+ await Promise.all([this.addApp(zip, model), this.addCore(zip, model)]);
20672
+ await this.addWorkbook(zip, model);
20622
20673
  }
20623
20674
  /**
20624
20675
  * Read workbook from a stream
@@ -20654,10 +20705,10 @@ var ExcelTS = (function(exports) {
20654
20705
  options = options || {};
20655
20706
  options.zip = options.zip || {};
20656
20707
  options.zip.modTime ??= this.workbook.modified ?? this.workbook.created;
20657
- const zip$1 = this.createZipWriter(options.zip);
20658
- zip$1.pipe(stream);
20659
- await this.writeToZip(zip$1, options);
20660
- return this._finalize(zip$1);
20708
+ const zip = this.createZipWriter(options.zip);
20709
+ zip.pipe(stream);
20710
+ await this.writeToZip(zip, options);
20711
+ return this._finalize(zip);
20661
20712
  }
20662
20713
  /**
20663
20714
  * Load workbook from buffer/ArrayBuffer/Uint8Array
@@ -20830,32 +20881,32 @@ var ExcelTS = (function(exports) {
20830
20881
  options = options || {};
20831
20882
  options.zip = options.zip || {};
20832
20883
  options.zip.modTime ??= this.workbook.modified ?? this.workbook.created;
20833
- const zip$1 = this.createZipWriter(options.zip);
20884
+ const zip = this.createZipWriter(options.zip);
20834
20885
  const stream = this.createStreamBuf();
20835
- zip$1.pipe(stream);
20836
- await this.writeToZip(zip$1, options);
20837
- await this._finalize(zip$1);
20886
+ zip.pipe(stream);
20887
+ await this.writeToZip(zip, options);
20888
+ await this._finalize(zip);
20838
20889
  return stream.read() || new Uint8Array(0);
20839
20890
  }
20840
20891
  /**
20841
20892
  * Add media files to ZIP
20842
20893
  * Supports buffer, base64, and filename (if readFileAsync is provided)
20843
20894
  */
20844
- async addMedia(zip$1, model) {
20895
+ async addMedia(zip, model) {
20845
20896
  await Promise.all(model.media.map(async (medium) => {
20846
20897
  if (medium.type !== "image") throw new Error("Unsupported media");
20847
20898
  const filename = mediaPath(`${medium.name ?? "undefined"}.${medium.extension}`);
20848
20899
  if (medium.filename) {
20849
20900
  if (this.readFileAsync) {
20850
20901
  const data = await this.readFileAsync(medium.filename);
20851
- return zip$1.append(data, { name: filename });
20902
+ return zip.append(data, { name: filename });
20852
20903
  }
20853
20904
  throw new Error("Loading images from filename is not supported in this environment");
20854
20905
  }
20855
- if (medium.buffer) return zip$1.append(medium.buffer, { name: filename });
20906
+ if (medium.buffer) return zip.append(medium.buffer, { name: filename });
20856
20907
  if (medium.base64) {
20857
20908
  const content = medium.base64.substring(medium.base64.indexOf(",") + 1);
20858
- return zip$1.append(content, {
20909
+ return zip.append(content, {
20859
20910
  name: filename,
20860
20911
  base64: true
20861
20912
  });
@@ -20932,6 +20983,7 @@ var ExcelTS = (function(exports) {
20932
20983
  delete model.sharedStrings;
20933
20984
  delete model.workbookRels;
20934
20985
  delete model.sheetDefs;
20986
+ model.defaultFont = model.styles?.defaultFont;
20935
20987
  delete model.styles;
20936
20988
  delete model.mediaIndex;
20937
20989
  delete model.drawings;
@@ -21072,13 +21124,21 @@ var ExcelTS = (function(exports) {
21072
21124
  });
21073
21125
  }
21074
21126
  }
21075
- async _processDrawingEntry(entry, model, name) {
21076
- const rawData = await this.collectStreamData(entry);
21077
- const xform$1 = new DrawingXform();
21078
- const xmlString = this.bufferToString(rawData);
21079
- const drawing = await xform$1.parseStream(this.createTextStream(xmlString));
21127
+ /**
21128
+ * Process a drawing XML entry.
21129
+ *
21130
+ * @param stream - Stream to read from (used in loadFromZipEntries path)
21131
+ * @param model - Model to populate
21132
+ * @param name - Drawing name (e.g., "drawing1")
21133
+ * @param rawData - Pre-read raw data (used in loadFromFiles path to avoid re-reading stream)
21134
+ */
21135
+ async _processDrawingEntry(stream, model, name, rawData) {
21136
+ const data = rawData ?? await this.collectStreamData(stream);
21137
+ const xform = new DrawingXform();
21138
+ const xmlString = this.bufferToString(data);
21139
+ const drawing = await xform.parseStream(this.createTextStream(xmlString));
21080
21140
  model.drawings[name] = drawing;
21081
- model.rawDrawings[name] = rawData;
21141
+ model.rawDrawings[name] = data;
21082
21142
  }
21083
21143
  async _processDrawingRelsEntry(entry, model, name) {
21084
21144
  const relationships = await new RelationshipsXform().parseStream(entry);
@@ -21165,8 +21225,7 @@ var ExcelTS = (function(exports) {
21165
21225
  }
21166
21226
  const drawingName = getDrawingNameFromPath(entryName);
21167
21227
  if (drawingName) {
21168
- await this._processDrawingEntry(stream, model, drawingName);
21169
- if (rawData) model.rawDrawings[drawingName] = rawData;
21228
+ await this._processDrawingEntry(stream, model, drawingName, rawData);
21170
21229
  return true;
21171
21230
  }
21172
21231
  const drawingRelsName = getDrawingNameFromRelsPath(entryName);
@@ -21234,26 +21293,26 @@ var ExcelTS = (function(exports) {
21234
21293
  const data = await this.collectStreamData(stream);
21235
21294
  model.passthrough[entryName] = data;
21236
21295
  }
21237
- async addContentTypes(zip$1, model) {
21296
+ async addContentTypes(zip, model) {
21238
21297
  const xml = new ContentTypesXform().toXml(model);
21239
- zip$1.append(xml, { name: OOXML_PATHS.contentTypes });
21298
+ zip.append(xml, { name: OOXML_PATHS.contentTypes });
21240
21299
  }
21241
- async addApp(zip$1, model) {
21300
+ async addApp(zip, model) {
21242
21301
  const xml = new AppXform().toXml(model);
21243
- zip$1.append(xml, { name: OOXML_PATHS.docPropsApp });
21302
+ zip.append(xml, { name: OOXML_PATHS.docPropsApp });
21244
21303
  }
21245
- async addCore(zip$1, model) {
21246
- const xform$1 = new CoreXform();
21247
- zip$1.append(xform$1.toXml(model), { name: OOXML_PATHS.docPropsCore });
21304
+ async addCore(zip, model) {
21305
+ const xform = new CoreXform();
21306
+ zip.append(xform.toXml(model), { name: OOXML_PATHS.docPropsCore });
21248
21307
  }
21249
- async addThemes(zip$1, model) {
21308
+ async addThemes(zip, model) {
21250
21309
  const themes = model.themes || { theme1: theme1Xml };
21251
21310
  Object.keys(themes).forEach((name) => {
21252
21311
  const xml = themes[name];
21253
- zip$1.append(xml, { name: themePath(name) });
21312
+ zip.append(xml, { name: themePath(name) });
21254
21313
  });
21255
21314
  }
21256
- async addOfficeRels(zip$1, _model) {
21315
+ async addOfficeRels(zip, _model) {
21257
21316
  const xml = new RelationshipsXform().toXml([
21258
21317
  {
21259
21318
  Id: "rId1",
@@ -21271,9 +21330,9 @@ var ExcelTS = (function(exports) {
21271
21330
  Target: OOXML_PATHS.docPropsApp
21272
21331
  }
21273
21332
  ]);
21274
- zip$1.append(xml, { name: OOXML_PATHS.rootRels });
21333
+ zip.append(xml, { name: OOXML_PATHS.rootRels });
21275
21334
  }
21276
- async addWorkbookRels(zip$1, model) {
21335
+ async addWorkbookRels(zip, model) {
21277
21336
  let count = 1;
21278
21337
  const relationships = [{
21279
21338
  Id: `rId${count++}`,
@@ -21312,25 +21371,25 @@ var ExcelTS = (function(exports) {
21312
21371
  });
21313
21372
  });
21314
21373
  const xml = new RelationshipsXform().toXml(relationships);
21315
- zip$1.append(xml, { name: OOXML_PATHS.xlWorkbookRels });
21374
+ zip.append(xml, { name: OOXML_PATHS.xlWorkbookRels });
21316
21375
  }
21317
- async addFeaturePropertyBag(zip$1, model) {
21376
+ async addFeaturePropertyBag(zip, model) {
21318
21377
  if (!model.hasCheckboxes) return;
21319
- const xform$1 = new FeaturePropertyBagXform();
21320
- zip$1.append(xform$1.toXml({}), { name: OOXML_PATHS.xlFeaturePropertyBag });
21378
+ const xform = new FeaturePropertyBagXform();
21379
+ zip.append(xform.toXml({}), { name: OOXML_PATHS.xlFeaturePropertyBag });
21321
21380
  }
21322
- async addSharedStrings(zip$1, model) {
21323
- if (model.sharedStrings && model.sharedStrings.count) zip$1.append(model.sharedStrings.xml, { name: OOXML_PATHS.xlSharedStrings });
21381
+ async addSharedStrings(zip, model) {
21382
+ if (model.sharedStrings && model.sharedStrings.count) zip.append(model.sharedStrings.xml, { name: OOXML_PATHS.xlSharedStrings });
21324
21383
  }
21325
- async addStyles(zip$1, model) {
21384
+ async addStyles(zip, model) {
21326
21385
  const { xml } = model.styles;
21327
- if (xml) zip$1.append(xml, { name: OOXML_PATHS.xlStyles });
21386
+ if (xml) zip.append(xml, { name: OOXML_PATHS.xlStyles });
21328
21387
  }
21329
- async addWorkbook(zip$1, model) {
21330
- const xform$1 = new WorkbookXform();
21331
- zip$1.append(xform$1.toXml(model), { name: OOXML_PATHS.xlWorkbook });
21388
+ async addWorkbook(zip, model) {
21389
+ const xform = new WorkbookXform();
21390
+ zip.append(xform.toXml(model), { name: OOXML_PATHS.xlWorkbook });
21332
21391
  }
21333
- async addWorksheets(zip$1, model) {
21392
+ async addWorksheets(zip, model) {
21334
21393
  const worksheetXform = new WorkSheetXform();
21335
21394
  const relationshipsXform = new RelationshipsXform();
21336
21395
  const commentsXform = new CommentsXform();
@@ -21340,16 +21399,16 @@ var ExcelTS = (function(exports) {
21340
21399
  const fileIndex = worksheet.fileIndex || index + 1;
21341
21400
  let xmlStream = new XmlStream();
21342
21401
  worksheetXform.render(xmlStream, worksheet);
21343
- zip$1.append(xmlStream.xml, { name: worksheetPath(fileIndex) });
21402
+ zip.append(xmlStream.xml, { name: worksheetPath(fileIndex) });
21344
21403
  if (worksheet.rels && worksheet.rels.length) {
21345
21404
  xmlStream = new XmlStream();
21346
21405
  relationshipsXform.render(xmlStream, worksheet.rels);
21347
- zip$1.append(xmlStream.xml, { name: worksheetRelsPath(fileIndex) });
21406
+ zip.append(xmlStream.xml, { name: worksheetRelsPath(fileIndex) });
21348
21407
  }
21349
21408
  if (worksheet.comments.length > 0) {
21350
21409
  xmlStream = new XmlStream();
21351
21410
  commentsXform.render(xmlStream, worksheet);
21352
- zip$1.append(xmlStream.xml, { name: commentsPath(fileIndex) });
21411
+ zip.append(xmlStream.xml, { name: commentsPath(fileIndex) });
21353
21412
  }
21354
21413
  const hasComments = worksheet.comments.length > 0;
21355
21414
  const hasFormControls = worksheet.formControls && worksheet.formControls.length > 0;
@@ -21359,22 +21418,22 @@ var ExcelTS = (function(exports) {
21359
21418
  comments: hasComments ? worksheet.comments : [],
21360
21419
  formControls: hasFormControls ? worksheet.formControls : []
21361
21420
  });
21362
- zip$1.append(xmlStream.xml, { name: vmlDrawingPath(fileIndex) });
21421
+ zip.append(xmlStream.xml, { name: vmlDrawingPath(fileIndex) });
21363
21422
  }
21364
21423
  if (hasFormControls) worksheet.formControls.forEach((control) => {
21365
21424
  const xml = ctrlPropXform.toXml(control);
21366
- zip$1.append(xml, { name: ctrlPropPath(control.ctrlPropId) });
21425
+ zip.append(xml, { name: ctrlPropPath(control.ctrlPropId) });
21367
21426
  });
21368
21427
  });
21369
21428
  }
21370
- addDrawings(zip$1, model) {
21429
+ addDrawings(zip, model) {
21371
21430
  const drawingXform = new DrawingXform();
21372
21431
  const relsXform = new RelationshipsXform();
21373
21432
  const rawDrawings = model.rawDrawings || {};
21374
21433
  model.worksheets.forEach((worksheet) => {
21375
21434
  const { drawing } = worksheet;
21376
21435
  if (drawing) {
21377
- if (this.drawingHasChartReference(drawing) && rawDrawings[drawing.name]) zip$1.append(rawDrawings[drawing.name], { name: drawingPath(drawing.name) });
21436
+ if (this.drawingHasChartReference(drawing) && rawDrawings[drawing.name]) zip.append(rawDrawings[drawing.name], { name: drawingPath(drawing.name) });
21378
21437
  else {
21379
21438
  const filteredAnchors = (drawing.anchors || []).filter((a) => {
21380
21439
  if (a == null) return false;
@@ -21389,21 +21448,21 @@ var ExcelTS = (function(exports) {
21389
21448
  } : drawing;
21390
21449
  drawingXform.prepare(drawingForWrite);
21391
21450
  const xml = drawingXform.toXml(drawingForWrite);
21392
- zip$1.append(xml, { name: drawingPath(drawing.name) });
21451
+ zip.append(xml, { name: drawingPath(drawing.name) });
21393
21452
  }
21394
21453
  const relsXml = relsXform.toXml(drawing.rels);
21395
- zip$1.append(relsXml, { name: drawingRelsPath(drawing.name) });
21454
+ zip.append(relsXml, { name: drawingRelsPath(drawing.name) });
21396
21455
  }
21397
21456
  });
21398
21457
  }
21399
- addTables(zip$1, model) {
21458
+ addTables(zip, model) {
21400
21459
  const tableXform = new TableXform();
21401
21460
  model.worksheets.forEach((worksheet) => {
21402
21461
  const { tables } = worksheet;
21403
21462
  tables.forEach((table) => {
21404
21463
  tableXform.prepare(table, {});
21405
21464
  const tableXml = tableXform.toXml(table);
21406
- zip$1.append(tableXml, { name: tablePath(table.target) });
21465
+ zip.append(tableXml, { name: tablePath(table.target) });
21407
21466
  });
21408
21467
  });
21409
21468
  }
@@ -21411,12 +21470,12 @@ var ExcelTS = (function(exports) {
21411
21470
  * Write passthrough files (charts, etc.) that were preserved during read.
21412
21471
  * These files are written back unchanged to preserve unsupported features.
21413
21472
  */
21414
- addPassthrough(zip$1, model) {
21473
+ addPassthrough(zip, model) {
21415
21474
  const passthroughManager = new PassthroughManager();
21416
21475
  passthroughManager.fromRecord(model.passthrough || {});
21417
- passthroughManager.writeToZip(zip$1);
21476
+ passthroughManager.writeToZip(zip);
21418
21477
  }
21419
- addPivotTables(zip$1, model) {
21478
+ addPivotTables(zip, model) {
21420
21479
  if (!model.pivotTables.length) return;
21421
21480
  const pivotCacheRecordsXform = new PivotCacheRecordsXform();
21422
21481
  const pivotCacheDefinitionXform = new PivotCacheDefinitionXform();
@@ -21426,42 +21485,42 @@ var ExcelTS = (function(exports) {
21426
21485
  const n = pivotTable.tableNumber;
21427
21486
  if (pivotTable.isLoaded) {
21428
21487
  if (pivotTable.cacheDefinition) {
21429
- const xml$1 = pivotCacheDefinitionXform.toXml(pivotTable.cacheDefinition);
21430
- zip$1.append(xml$1, { name: pivotCacheDefinitionPath(n) });
21488
+ const xml = pivotCacheDefinitionXform.toXml(pivotTable.cacheDefinition);
21489
+ zip.append(xml, { name: pivotCacheDefinitionPath(n) });
21431
21490
  }
21432
21491
  if (pivotTable.cacheRecords) {
21433
- const xml$1 = pivotCacheRecordsXform.toXml(pivotTable.cacheRecords);
21434
- zip$1.append(xml$1, { name: pivotCacheRecordsPath(n) });
21492
+ const xml = pivotCacheRecordsXform.toXml(pivotTable.cacheRecords);
21493
+ zip.append(xml, { name: pivotCacheRecordsPath(n) });
21435
21494
  }
21436
21495
  } else {
21437
- let xml$1 = pivotCacheRecordsXform.toXml(pivotTable);
21438
- zip$1.append(xml$1, { name: pivotCacheRecordsPath(n) });
21439
- xml$1 = pivotCacheDefinitionXform.toXml(pivotTable);
21440
- zip$1.append(xml$1, { name: pivotCacheDefinitionPath(n) });
21496
+ let xml = pivotCacheRecordsXform.toXml(pivotTable);
21497
+ zip.append(xml, { name: pivotCacheRecordsPath(n) });
21498
+ xml = pivotCacheDefinitionXform.toXml(pivotTable);
21499
+ zip.append(xml, { name: pivotCacheDefinitionPath(n) });
21441
21500
  }
21442
21501
  let xml = relsXform.toXml([{
21443
21502
  Id: "rId1",
21444
21503
  Type: XLSX.RelType.PivotCacheRecords,
21445
21504
  Target: pivotCacheRecordsRelTarget(n)
21446
21505
  }]);
21447
- zip$1.append(xml, { name: pivotCacheDefinitionRelsPath(n) });
21506
+ zip.append(xml, { name: pivotCacheDefinitionRelsPath(n) });
21448
21507
  xml = pivotTableXform.toXml(pivotTable);
21449
- zip$1.append(xml, { name: pivotTablePath(n) });
21508
+ zip.append(xml, { name: pivotTablePath(n) });
21450
21509
  xml = relsXform.toXml([{
21451
21510
  Id: "rId1",
21452
21511
  Type: XLSX.RelType.PivotCacheDefinition,
21453
21512
  Target: pivotCacheDefinitionRelTargetFromPivotTable(n)
21454
21513
  }]);
21455
- zip$1.append(xml, { name: pivotTableRelsPath(n) });
21514
+ zip.append(xml, { name: pivotTableRelsPath(n) });
21456
21515
  });
21457
21516
  }
21458
- _finalize(zip$1) {
21517
+ _finalize(zip) {
21459
21518
  return new Promise((resolve, reject) => {
21460
- zip$1.on("finish", () => {
21519
+ zip.on("finish", () => {
21461
21520
  resolve(this);
21462
21521
  });
21463
- zip$1.on("error", reject);
21464
- zip$1.finalize();
21522
+ zip.on("error", reject);
21523
+ zip.finalize();
21465
21524
  });
21466
21525
  }
21467
21526
  prepareModel(model, options) {
@@ -21472,7 +21531,9 @@ var ExcelTS = (function(exports) {
21472
21531
  model.useSharedStrings = options.useSharedStrings !== void 0 ? options.useSharedStrings : true;
21473
21532
  model.useStyles = options.useStyles !== void 0 ? options.useStyles : true;
21474
21533
  model.sharedStrings = new SharedStringsXform();
21534
+ const oldDefaultFont = model.defaultFont;
21475
21535
  model.styles = model.useStyles ? new StylesXform(true) : new StylesXform.Mock();
21536
+ if (oldDefaultFont && model.styles.setDefaultFont) model.styles.setDefaultFont(oldDefaultFont);
21476
21537
  const workbookXform = new WorkbookXform();
21477
21538
  const worksheetXform = new WorkSheetXform();
21478
21539
  workbookXform.prepare(model);
@@ -21660,26 +21721,26 @@ var ExcelTS = (function(exports) {
21660
21721
  parseAll(values) {
21661
21722
  const len = values.length;
21662
21723
  const out = new Array(len);
21663
- const parse$1 = this.parse;
21664
- for (let i = 0; i < len; i++) out[i] = parse$1(values[i]);
21724
+ const parse = this.parse;
21725
+ for (let i = 0; i < len; i++) out[i] = parse(values[i]);
21665
21726
  return out;
21666
21727
  }
21667
21728
  /** Parse and filter valid dates */
21668
21729
  parseValid(values) {
21669
21730
  const out = [];
21670
- const parse$1 = this.parse;
21731
+ const parse = this.parse;
21671
21732
  for (let i = 0, len = values.length; i < len; i++) {
21672
- const d = parse$1(values[i]);
21733
+ const d = parse(values[i]);
21673
21734
  if (d) out.push(d);
21674
21735
  }
21675
21736
  return out;
21676
21737
  }
21677
21738
  };
21678
21739
  function tzOffset(d) {
21679
- const off$1 = -d.getTimezoneOffset();
21680
- const sign = off$1 >= 0 ? "+" : "-";
21681
- const h = Math.abs(off$1) / 60 | 0;
21682
- const m = Math.abs(off$1) % 60;
21740
+ const off = -d.getTimezoneOffset();
21741
+ const sign = off >= 0 ? "+" : "-";
21742
+ const h = Math.abs(off) / 60 | 0;
21743
+ const m = Math.abs(off) % 60;
21683
21744
  return `${sign}${PAD2[h]}:${PAD2[m]}`;
21684
21745
  }
21685
21746
  /**
@@ -21723,9 +21784,9 @@ var ExcelTS = (function(exports) {
21723
21784
  });
21724
21785
  }
21725
21786
  /** Create custom format formatter */
21726
- static create(format$1, options) {
21787
+ static create(format, options) {
21727
21788
  const utc = options?.utc ?? false;
21728
- if (format$1 === "YYYY-MM-DD") return utc ? new DateFormatter((d) => {
21789
+ if (format === "YYYY-MM-DD") return utc ? new DateFormatter((d) => {
21729
21790
  if (!(d instanceof Date)) return "";
21730
21791
  const t = d.getTime();
21731
21792
  if (t !== t) return "";
@@ -21736,7 +21797,7 @@ var ExcelTS = (function(exports) {
21736
21797
  if (t !== t) return "";
21737
21798
  return `${d.getFullYear()}-${PAD2[d.getMonth() + 1]}-${PAD2[d.getDate()]}`;
21738
21799
  });
21739
- if (format$1 === "YYYY-MM-DD HH:mm:ss") return utc ? new DateFormatter((d) => {
21800
+ if (format === "YYYY-MM-DD HH:mm:ss") return utc ? new DateFormatter((d) => {
21740
21801
  if (!(d instanceof Date)) return "";
21741
21802
  const t = d.getTime();
21742
21803
  if (t !== t) return "";
@@ -21747,8 +21808,8 @@ var ExcelTS = (function(exports) {
21747
21808
  if (t !== t) return "";
21748
21809
  return `${d.getFullYear()}-${PAD2[d.getMonth() + 1]}-${PAD2[d.getDate()]} ${PAD2[d.getHours()]}:${PAD2[d.getMinutes()]}:${PAD2[d.getSeconds()]}`;
21749
21810
  });
21750
- if (format$1 === "MM-DD-YYYY" || format$1 === "MM/DD/YYYY") {
21751
- const sep = format$1.charAt(2);
21811
+ if (format === "MM-DD-YYYY" || format === "MM/DD/YYYY") {
21812
+ const sep = format.charAt(2);
21752
21813
  return utc ? new DateFormatter((d) => {
21753
21814
  if (!(d instanceof Date)) return "";
21754
21815
  const t = d.getTime();
@@ -21761,8 +21822,8 @@ var ExcelTS = (function(exports) {
21761
21822
  return `${PAD2[d.getMonth() + 1]}${sep}${PAD2[d.getDate()]}${sep}${d.getFullYear()}`;
21762
21823
  });
21763
21824
  }
21764
- if (format$1 === "DD-MM-YYYY" || format$1 === "DD/MM/YYYY") {
21765
- const sep = format$1.charAt(2);
21825
+ if (format === "DD-MM-YYYY" || format === "DD/MM/YYYY") {
21826
+ const sep = format.charAt(2);
21766
21827
  return utc ? new DateFormatter((d) => {
21767
21828
  if (!(d instanceof Date)) return "";
21768
21829
  const t = d.getTime();
@@ -21775,12 +21836,12 @@ var ExcelTS = (function(exports) {
21775
21836
  return `${PAD2[d.getDate()]}${sep}${PAD2[d.getMonth() + 1]}${sep}${d.getFullYear()}`;
21776
21837
  });
21777
21838
  }
21778
- return DateFormatter.createGeneric(format$1, utc);
21839
+ return DateFormatter.createGeneric(format, utc);
21779
21840
  }
21780
21841
  /** Generic formatter for arbitrary formats */
21781
- static createGeneric(format$1, utc) {
21842
+ static createGeneric(format, utc) {
21782
21843
  const esc = [];
21783
- const tpl = format$1.replace(/\[([^\]]*)\]/g, (_, c) => {
21844
+ const tpl = format.replace(/\[([^\]]*)\]/g, (_, c) => {
21784
21845
  esc.push(c);
21785
21846
  return `\x00${esc.length - 1}\x00`;
21786
21847
  });
@@ -21862,8 +21923,8 @@ var ExcelTS = (function(exports) {
21862
21923
  /**
21863
21924
  * Check if a validate function is synchronous (1 argument) vs async (2 arguments)
21864
21925
  */
21865
- function isSyncValidate(validate$1) {
21866
- return validate$1.length === 1;
21926
+ function isSyncValidate(validate) {
21927
+ return validate.length === 1;
21867
21928
  }
21868
21929
  /**
21869
21930
  * Check if headers are unique
@@ -21881,7 +21942,7 @@ var ExcelTS = (function(exports) {
21881
21942
  * Parse a CSV string into rows of fields
21882
21943
  */
21883
21944
  function parseCsv(input, options = {}) {
21884
- const { delimiter = ",", quote: quoteOption = "\"", escape: escapeOption = "\"", skipEmptyLines = false, ignoreEmpty = false, trim = false, ltrim = false, rtrim = false, headers = false, renameHeaders = false, comment, maxRows, skipLines = 0, skipRows = 0, strictColumnHandling = false, discardUnmappedColumns = false, transform, validate: validate$1 } = options;
21945
+ const { delimiter = ",", quote: quoteOption = "\"", escape: escapeOption = "\"", skipEmptyLines = false, ignoreEmpty = false, trim = false, ltrim = false, rtrim = false, headers = false, renameHeaders = false, comment, maxRows, skipLines = 0, skipRows = 0, strictColumnHandling = false, discardUnmappedColumns = false, transform, validate } = options;
21885
21946
  const shouldSkipEmpty = skipEmptyLines || ignoreEmpty;
21886
21947
  const quoteEnabled = quoteOption !== null && quoteOption !== false;
21887
21948
  const quote = quoteEnabled ? String(quoteOption) : "";
@@ -22031,10 +22092,10 @@ var ExcelTS = (function(exports) {
22031
22092
  return obj;
22032
22093
  });
22033
22094
  if (transform) dataRows = dataRows.map((row) => transform(row)).filter((row) => row !== null && row !== void 0);
22034
- if (validate$1) {
22095
+ if (validate) {
22035
22096
  const validatedRows = [];
22036
22097
  for (const row of dataRows) {
22037
- const result = validate$1(row);
22098
+ const result = validate(row);
22038
22099
  if (typeof result === "boolean") if (result) validatedRows.push(row);
22039
22100
  else invalidRows.push({
22040
22101
  row: Object.values(row),
@@ -22048,7 +22109,7 @@ var ExcelTS = (function(exports) {
22048
22109
  }
22049
22110
  dataRows = validatedRows;
22050
22111
  }
22051
- if ((strictColumnHandling || validate$1) && invalidRows.length > 0) return {
22112
+ if ((strictColumnHandling || validate) && invalidRows.length > 0) return {
22052
22113
  headers: headerRow.filter((h) => h !== null && h !== void 0),
22053
22114
  rows: dataRows,
22054
22115
  invalidRows
@@ -22060,11 +22121,11 @@ var ExcelTS = (function(exports) {
22060
22121
  }
22061
22122
  let resultRows = rows;
22062
22123
  if (transform) resultRows = resultRows.map((row) => transform(row)).filter((row) => row !== null && row !== void 0);
22063
- if (validate$1) {
22124
+ if (validate) {
22064
22125
  const validatedRows = [];
22065
22126
  const arrayInvalidRows = [];
22066
22127
  for (const row of resultRows) {
22067
- const result = validate$1(row);
22128
+ const result = validate(row);
22068
22129
  if (typeof result === "boolean") if (result) validatedRows.push(row);
22069
22130
  else arrayInvalidRows.push({
22070
22131
  row,
@@ -22093,7 +22154,7 @@ var ExcelTS = (function(exports) {
22093
22154
  const quoteEnabled = quoteOption !== false && quoteOption !== null;
22094
22155
  const quote = quoteEnabled ? String(quoteOption) : "";
22095
22156
  const escape = escapeOption !== void 0 && escapeOption !== false && escapeOption !== null ? String(escapeOption) : quote;
22096
- const needsQuoteRegex = quoteEnabled ? /* @__PURE__ */ new RegExp(`[${escapeRegex$1(delimiter)}${escapeRegex$1(quote)}\r\n]`) : null;
22157
+ const needsQuoteRegex = quoteEnabled ? new RegExp(`[${escapeRegex$1(delimiter)}${escapeRegex$1(quote)}\r\n]`) : null;
22097
22158
  const escapeQuoteRegex = quoteEnabled ? new RegExp(escapeRegex$1(quote), "g") : null;
22098
22159
  const escapedQuote = escape + quote;
22099
22160
  const lines = [];
@@ -23624,8 +23685,8 @@ var ExcelTS = (function(exports) {
23624
23685
  media: this.media,
23625
23686
  hasCheckboxes: this.styles.hasCheckboxes
23626
23687
  };
23627
- const xform$1 = new ContentTypesXform();
23628
- this._addFile(xform$1.toXml(model), OOXML_PATHS.contentTypes);
23688
+ const xform = new ContentTypesXform();
23689
+ this._addFile(xform.toXml(model), OOXML_PATHS.contentTypes);
23629
23690
  resolve();
23630
23691
  });
23631
23692
  }
@@ -23652,30 +23713,30 @@ var ExcelTS = (function(exports) {
23652
23713
  }
23653
23714
  addApp() {
23654
23715
  return new Promise((resolve) => {
23655
- const xform$1 = new AppXform();
23656
- this._addFile(xform$1.toXml({ worksheets: this._worksheets.filter(Boolean) }), OOXML_PATHS.docPropsApp);
23716
+ const xform = new AppXform();
23717
+ this._addFile(xform.toXml({ worksheets: this._worksheets.filter(Boolean) }), OOXML_PATHS.docPropsApp);
23657
23718
  resolve();
23658
23719
  });
23659
23720
  }
23660
23721
  addCore() {
23661
23722
  return new Promise((resolve) => {
23662
- const xform$1 = new CoreXform();
23663
- this._addFile(xform$1.toXml(this), OOXML_PATHS.docPropsCore);
23723
+ const xform = new CoreXform();
23724
+ this._addFile(xform.toXml(this), OOXML_PATHS.docPropsCore);
23664
23725
  resolve();
23665
23726
  });
23666
23727
  }
23667
23728
  addSharedStrings() {
23668
23729
  if (this.sharedStrings.count) return new Promise((resolve) => {
23669
- const xform$1 = new SharedStringsXform();
23670
- this._addFile(xform$1.toXml(this.sharedStrings), OOXML_PATHS.xlSharedStrings);
23730
+ const xform = new SharedStringsXform();
23731
+ this._addFile(xform.toXml(this.sharedStrings), OOXML_PATHS.xlSharedStrings);
23671
23732
  resolve();
23672
23733
  });
23673
23734
  return Promise.resolve();
23674
23735
  }
23675
23736
  addFeaturePropertyBag() {
23676
23737
  if (this.styles.hasCheckboxes) {
23677
- const xform$1 = new FeaturePropertyBagXform();
23678
- this._addFile(xform$1.toXml({}), OOXML_PATHS.xlFeaturePropertyBag);
23738
+ const xform = new FeaturePropertyBagXform();
23739
+ this._addFile(xform.toXml({}), OOXML_PATHS.xlFeaturePropertyBag);
23679
23740
  }
23680
23741
  return Promise.resolve();
23681
23742
  }
@@ -23711,8 +23772,8 @@ var ExcelTS = (function(exports) {
23711
23772
  }
23712
23773
  });
23713
23774
  return new Promise((resolve) => {
23714
- const xform$1 = new RelationshipsXform();
23715
- this._addFile(xform$1.toXml(relationships), OOXML_PATHS.xlWorkbookRels);
23775
+ const xform = new RelationshipsXform();
23776
+ this._addFile(xform.toXml(relationships), OOXML_PATHS.xlWorkbookRels);
23716
23777
  resolve();
23717
23778
  });
23718
23779
  }
@@ -23725,9 +23786,9 @@ var ExcelTS = (function(exports) {
23725
23786
  calcProperties: {}
23726
23787
  };
23727
23788
  return new Promise((resolve) => {
23728
- const xform$1 = new WorkbookXform();
23729
- xform$1.prepare(model);
23730
- this._addFile(xform$1.toXml(model), OOXML_PATHS.xlWorkbook);
23789
+ const xform = new WorkbookXform();
23790
+ xform.prepare(model);
23791
+ this._addFile(xform.toXml(model), OOXML_PATHS.xlWorkbook);
23731
23792
  resolve();
23732
23793
  });
23733
23794
  }
@@ -23771,11 +23832,11 @@ var ExcelTS = (function(exports) {
23771
23832
  * ]
23772
23833
  * @returns An object with keys set to their associated extracted values.
23773
23834
  */
23774
- function parse(buffer, format$1) {
23835
+ function parse(buffer, format) {
23775
23836
  const result = {};
23776
23837
  const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
23777
23838
  let offset = 0;
23778
- for (const [key, size] of format$1) {
23839
+ for (const [key, size] of format) {
23779
23840
  if (buffer.length >= offset + size) switch (size) {
23780
23841
  case 1:
23781
23842
  result[key] = view.getUint8(offset);
@@ -23798,8 +23859,8 @@ var ExcelTS = (function(exports) {
23798
23859
  }
23799
23860
  return result;
23800
23861
  }
23801
- function parseTyped(buffer, format$1) {
23802
- return parse(buffer, format$1);
23862
+ function parseTyped(buffer, format) {
23863
+ return parse(buffer, format);
23803
23864
  }
23804
23865
 
23805
23866
  //#endregion
@@ -24031,14 +24092,14 @@ var ExcelTS = (function(exports) {
24031
24092
  * This encapsulates the shared logic used by both Node and browser parsers.
24032
24093
  */
24033
24094
  function streamUntilValidatedDataDescriptor(options) {
24034
- const { source, dataDescriptorSignature: dataDescriptorSignature$1 } = options;
24095
+ const { source, dataDescriptorSignature } = options;
24035
24096
  const keepTailBytes = options.keepTailBytes ?? 20;
24036
24097
  const errorMessage = options.errorMessage ?? "FILE_ENDED: Data descriptor not found";
24037
24098
  const output = new PassThrough({ highWaterMark: DEFAULT_UNZIP_STREAM_HIGH_WATER_MARK$1 });
24038
24099
  let done = false;
24039
24100
  let waitingDrain = false;
24040
24101
  let bytesEmitted = 0;
24041
- const scanner = new PatternScanner(dataDescriptorSignature$1);
24102
+ const scanner = new PatternScanner(dataDescriptorSignature);
24042
24103
  let unsubscribe;
24043
24104
  const cleanup = () => {
24044
24105
  if (unsubscribe) {
@@ -24116,9 +24177,9 @@ var ExcelTS = (function(exports) {
24116
24177
  const parts = source.peekChunks(flushLen);
24117
24178
  let written = 0;
24118
24179
  for (const part of parts) {
24119
- const ok$1 = output.write(part);
24180
+ const ok = output.write(part);
24120
24181
  written += part.length;
24121
- if (!ok$1) {
24182
+ if (!ok) {
24122
24183
  waitingDrain = true;
24123
24184
  output.once("drain", () => {
24124
24185
  waitingDrain = false;
@@ -24210,7 +24271,7 @@ var ExcelTS = (function(exports) {
24210
24271
  }
24211
24272
  }
24212
24273
  async function pumpKnownCompressedSizeToEntry(io, inflater, entry, compressedSize) {
24213
- const CHUNK_SIZE$1 = 256 * 1024;
24274
+ const CHUNK_SIZE = 256 * 1024;
24214
24275
  let remaining = compressedSize;
24215
24276
  let err = null;
24216
24277
  const onError = (e) => {
@@ -24270,7 +24331,7 @@ var ExcelTS = (function(exports) {
24270
24331
  while (remaining > 0) {
24271
24332
  if (err) throw err;
24272
24333
  if (!skipping && (entry.__autodraining || entry.destroyed)) await switchToSkip();
24273
- const toPull = Math.min(CHUNK_SIZE$1, remaining);
24334
+ const toPull = Math.min(CHUNK_SIZE, remaining);
24274
24335
  const chunk = await io.pull(toPull);
24275
24336
  if (chunk.length !== toPull) throw new Error("FILE_ENDED");
24276
24337
  remaining -= chunk.length;
@@ -24702,7 +24763,7 @@ onmessage = async (ev) => {
24702
24763
  * - Writable side: accepts ZIP data
24703
24764
  * - Readable side: emits ZipEntry objects
24704
24765
  */
24705
- return class Parse$1 extends Duplex {
24766
+ return class Parse extends Duplex {
24706
24767
  constructor(opts = {}) {
24707
24768
  super({
24708
24769
  objectMode: true,
@@ -24911,10 +24972,10 @@ onmessage = async (ev) => {
24911
24972
  this.match = match;
24912
24973
  const endIndex = includeEof ? match + patternLen : match;
24913
24974
  if (endIndex > 0) {
24914
- const ok$1 = output.write(this._buffer.read(endIndex));
24975
+ const ok = output.write(this._buffer.read(endIndex));
24915
24976
  scanner.onConsume(endIndex);
24916
24977
  this._maybeReleaseWriteCallback();
24917
- if (!ok$1) {
24978
+ if (!ok) {
24918
24979
  waitingDrain = true;
24919
24980
  output.once("drain", () => {
24920
24981
  waitingDrain = false;
@@ -25677,10 +25738,10 @@ onmessage = async (ev) => {
25677
25738
  };
25678
25739
  }
25679
25740
  async *_parseEntries(stream) {
25680
- const zip$1 = createParse({ forceStream: true });
25681
- stream.on("error", (err) => zip$1.emit("error", err));
25682
- stream.pipe(zip$1);
25683
- for await (const entry of iterateStream(zip$1)) {
25741
+ const zip = createParse({ forceStream: true });
25742
+ stream.on("error", (err) => zip.emit("error", err));
25743
+ stream.pipe(zip);
25744
+ for await (const entry of iterateStream(zip)) {
25684
25745
  let sheetNo;
25685
25746
  const normalizedPath = normalizeZipPath(entry.path);
25686
25747
  switch (normalizedPath) {
@@ -25730,9 +25791,9 @@ onmessage = async (ev) => {
25730
25791
  }
25731
25792
  async _storeWaitingWorksheet(sheetNo, entry) {
25732
25793
  const chunks = [];
25733
- const encoder$1 = new TextEncoder();
25794
+ const encoder = new TextEncoder();
25734
25795
  for await (const chunk of iterateStream(entry)) if (chunk instanceof Uint8Array) chunks.push(chunk);
25735
- else if (typeof chunk === "string") chunks.push(encoder$1.encode(chunk));
25796
+ else if (typeof chunk === "string") chunks.push(encoder.encode(chunk));
25736
25797
  return {
25737
25798
  sheetNo,
25738
25799
  data: chunks
@@ -25960,7 +26021,8 @@ onmessage = async (ev) => {
25960
26021
  pivotTables: this.pivotTables,
25961
26022
  calcProperties: this.calcProperties,
25962
26023
  passthrough: this._passthrough,
25963
- rawDrawings: this._rawDrawings
26024
+ rawDrawings: this._rawDrawings,
26025
+ defaultFont: this._defaultFont
25964
26026
  };
25965
26027
  }
25966
26028
  set model(value) {
@@ -26001,25 +26063,26 @@ onmessage = async (ev) => {
26001
26063
  this.pivotTables = value.pivotTables || value.loadedPivotTables || [];
26002
26064
  this._passthrough = value.passthrough || {};
26003
26065
  this._rawDrawings = value.rawDrawings || {};
26066
+ this._defaultFont = value.defaultFont;
26004
26067
  }
26005
26068
  };
26006
26069
 
26007
26070
  //#endregion
26008
26071
  //#region src/modules/excel/types.ts
26009
- let PaperSize = /* @__PURE__ */ function(PaperSize$1) {
26010
- PaperSize$1[PaperSize$1["Legal"] = 5] = "Legal";
26011
- PaperSize$1[PaperSize$1["Executive"] = 7] = "Executive";
26012
- PaperSize$1[PaperSize$1["A4"] = 9] = "A4";
26013
- PaperSize$1[PaperSize$1["A5"] = 11] = "A5";
26014
- PaperSize$1[PaperSize$1["B5"] = 13] = "B5";
26015
- PaperSize$1[PaperSize$1["Envelope_10"] = 20] = "Envelope_10";
26016
- PaperSize$1[PaperSize$1["Envelope_DL"] = 27] = "Envelope_DL";
26017
- PaperSize$1[PaperSize$1["Envelope_C5"] = 28] = "Envelope_C5";
26018
- PaperSize$1[PaperSize$1["Envelope_B5"] = 34] = "Envelope_B5";
26019
- PaperSize$1[PaperSize$1["Envelope_Monarch"] = 37] = "Envelope_Monarch";
26020
- PaperSize$1[PaperSize$1["Double_Japan_Postcard_Rotated"] = 82] = "Double_Japan_Postcard_Rotated";
26021
- PaperSize$1[PaperSize$1["K16_197x273_mm"] = 119] = "K16_197x273_mm";
26022
- return PaperSize$1;
26072
+ let PaperSize = /* @__PURE__ */ function(PaperSize) {
26073
+ PaperSize[PaperSize["Legal"] = 5] = "Legal";
26074
+ PaperSize[PaperSize["Executive"] = 7] = "Executive";
26075
+ PaperSize[PaperSize["A4"] = 9] = "A4";
26076
+ PaperSize[PaperSize["A5"] = 11] = "A5";
26077
+ PaperSize[PaperSize["B5"] = 13] = "B5";
26078
+ PaperSize[PaperSize["Envelope_10"] = 20] = "Envelope_10";
26079
+ PaperSize[PaperSize["Envelope_DL"] = 27] = "Envelope_DL";
26080
+ PaperSize[PaperSize["Envelope_C5"] = 28] = "Envelope_C5";
26081
+ PaperSize[PaperSize["Envelope_B5"] = 34] = "Envelope_B5";
26082
+ PaperSize[PaperSize["Envelope_Monarch"] = 37] = "Envelope_Monarch";
26083
+ PaperSize[PaperSize["Double_Japan_Postcard_Rotated"] = 82] = "Double_Japan_Postcard_Rotated";
26084
+ PaperSize[PaperSize["K16_197x273_mm"] = 119] = "K16_197x273_mm";
26085
+ return PaperSize;
26023
26086
  }({});
26024
26087
 
26025
26088
  //#endregion
@@ -26216,9 +26279,9 @@ onmessage = async (ev) => {
26216
26279
  const sign = val < 0 ? "-" : "";
26217
26280
  const absVal = Math.abs(val);
26218
26281
  if (absVal === 0) {
26219
- const decMatch$1 = fmt.match(/\.([0#]+)E/i);
26220
- const decPlaces$1 = decMatch$1 ? decMatch$1[1].length : 2;
26221
- return "0." + "0".repeat(decPlaces$1) + "E+00";
26282
+ const decMatch = fmt.match(/\.([0#]+)E/i);
26283
+ const decPlaces = decMatch ? decMatch[1].length : 2;
26284
+ return "0." + "0".repeat(decPlaces) + "E+00";
26222
26285
  }
26223
26286
  const decMatch = fmt.match(/\.([0#]+)E/i);
26224
26287
  const decPlaces = decMatch ? decMatch[1].length : 2;
@@ -26278,15 +26341,15 @@ onmessage = async (ev) => {
26278
26341
  const absVal = Math.abs(val);
26279
26342
  const fixedDenomMatch = fmt.match(/\?+\s*\/\s*(\d+)/);
26280
26343
  if (fixedDenomMatch) {
26281
- const denom$1 = parseInt(fixedDenomMatch[1], 10);
26282
- const whole$1 = Math.floor(absVal);
26283
- const frac = absVal - whole$1;
26284
- const numer$1 = Math.round(frac * denom$1);
26344
+ const denom = parseInt(fixedDenomMatch[1], 10);
26345
+ const whole = Math.floor(absVal);
26346
+ const frac = absVal - whole;
26347
+ const numer = Math.round(frac * denom);
26285
26348
  if (fmt.includes("#") || fmt.includes("0")) {
26286
- if (numer$1 === 0) return sign + whole$1.toString();
26287
- return sign + (whole$1 > 0 ? whole$1 + " " : "") + numer$1 + "/" + denom$1;
26349
+ if (numer === 0) return sign + whole.toString();
26350
+ return sign + (whole > 0 ? whole + " " : "") + numer + "/" + denom;
26288
26351
  }
26289
- return sign + (whole$1 * denom$1 + numer$1) + "/" + denom$1;
26352
+ return sign + (whole * denom + numer) + "/" + denom;
26290
26353
  }
26291
26354
  const denomMatch = fmt.match(/\/\s*(\?+)/);
26292
26355
  const maxDigits = denomMatch ? denomMatch[1].length : 2;
@@ -26415,8 +26478,8 @@ onmessage = async (ev) => {
26415
26478
  */
26416
26479
  function chooseFormat(fmt, val) {
26417
26480
  if (typeof val === "string") {
26418
- const sections$1 = splitFormat(fmt);
26419
- if (sections$1.length >= 4 && sections$1[3]) return processQuotedText(sections$1[3]).replace(/@/g, val);
26481
+ const sections = splitFormat(fmt);
26482
+ if (sections.length >= 4 && sections[3]) return processQuotedText(sections[3]).replace(/@/g, val);
26420
26483
  return val;
26421
26484
  }
26422
26485
  if (typeof val === "boolean") return val ? "TRUE" : "FALSE";
@@ -26636,24 +26699,24 @@ onmessage = async (ev) => {
26636
26699
  * Decode range string to Range object
26637
26700
  * @example decodeRange("A1:B2") => {s: {c: 0, r: 0}, e: {c: 1, r: 1}}
26638
26701
  */
26639
- function decodeRange(range$1) {
26640
- const idx = range$1.indexOf(":");
26702
+ function decodeRange(range) {
26703
+ const idx = range.indexOf(":");
26641
26704
  if (idx === -1) {
26642
- const cell = decodeCell(range$1);
26705
+ const cell = decodeCell(range);
26643
26706
  return {
26644
26707
  s: cell,
26645
26708
  e: { ...cell }
26646
26709
  };
26647
26710
  }
26648
26711
  return {
26649
- s: decodeCell(range$1.slice(0, idx)),
26650
- e: decodeCell(range$1.slice(idx + 1))
26712
+ s: decodeCell(range.slice(0, idx)),
26713
+ e: decodeCell(range.slice(idx + 1))
26651
26714
  };
26652
26715
  }
26653
26716
  function encodeRange(startOrRange, end) {
26654
26717
  if (end === void 0) {
26655
- const range$1 = startOrRange;
26656
- return encodeRange(range$1.s, range$1.e);
26718
+ const range = startOrRange;
26719
+ return encodeRange(range.s, range.e);
26657
26720
  }
26658
26721
  const startStr = encodeCell(startOrRange);
26659
26722
  const endStr = encodeCell(end);
@@ -26766,8 +26829,8 @@ onmessage = async (ev) => {
26766
26829
  if (endRow < startRow || endCol < startCol) return [];
26767
26830
  const headerOpt = o.header;
26768
26831
  if (headerOpt === 1) {
26769
- const result$1 = [];
26770
- const includeBlank$1 = o.blankrows !== false;
26832
+ const result = [];
26833
+ const includeBlank = o.blankrows !== false;
26771
26834
  for (let row = startRow; row <= endRow; row++) {
26772
26835
  const rowData = [];
26773
26836
  let isEmpty = true;
@@ -26780,13 +26843,13 @@ onmessage = async (ev) => {
26780
26843
  } else if (o.defval !== void 0) rowData[col - startCol] = o.defval;
26781
26844
  else rowData[col - startCol] = null;
26782
26845
  }
26783
- if (!isEmpty || includeBlank$1) result$1.push(rowData);
26846
+ if (!isEmpty || includeBlank) result.push(rowData);
26784
26847
  }
26785
- return result$1;
26848
+ return result;
26786
26849
  }
26787
26850
  if (headerOpt === "A") {
26788
- const result$1 = [];
26789
- const includeBlank$1 = o.blankrows === true;
26851
+ const result = [];
26852
+ const includeBlank = o.blankrows === true;
26790
26853
  for (let row = startRow; row <= endRow; row++) {
26791
26854
  const rowData = {};
26792
26855
  let isEmpty = true;
@@ -26799,13 +26862,13 @@ onmessage = async (ev) => {
26799
26862
  isEmpty = false;
26800
26863
  } else if (o.defval !== void 0) rowData[key] = o.defval;
26801
26864
  }
26802
- if (!isEmpty || includeBlank$1) result$1.push(rowData);
26865
+ if (!isEmpty || includeBlank) result.push(rowData);
26803
26866
  }
26804
- return result$1;
26867
+ return result;
26805
26868
  }
26806
26869
  if (Array.isArray(headerOpt)) {
26807
- const result$1 = [];
26808
- const includeBlank$1 = o.blankrows === true;
26870
+ const result = [];
26871
+ const includeBlank = o.blankrows === true;
26809
26872
  for (let row = startRow; row <= endRow; row++) {
26810
26873
  const rowData = {};
26811
26874
  let isEmpty = true;
@@ -26819,9 +26882,9 @@ onmessage = async (ev) => {
26819
26882
  isEmpty = false;
26820
26883
  } else if (o.defval !== void 0) rowData[key] = o.defval;
26821
26884
  }
26822
- if (!isEmpty || includeBlank$1) result$1.push(rowData);
26885
+ if (!isEmpty || includeBlank) result.push(rowData);
26823
26886
  }
26824
- return result$1;
26887
+ return result;
26825
26888
  }
26826
26889
  const headers = [];
26827
26890
  const headerCounts = {};
@@ -27458,7 +27521,7 @@ onmessage = async (ev) => {
27458
27521
  stream() {
27459
27522
  this._sealed = true;
27460
27523
  const queue = createAsyncQueue();
27461
- const zip$1 = new StreamingZip((err, data, final) => {
27524
+ const zip = new StreamingZip((err, data, final) => {
27462
27525
  if (err) {
27463
27526
  queue.fail(err);
27464
27527
  return;
@@ -27477,7 +27540,7 @@ onmessage = async (ev) => {
27477
27540
  comment: entry.options?.comment,
27478
27541
  smartStore: this._options.smartStore
27479
27542
  });
27480
- zip$1.add(file);
27543
+ zip.add(file);
27481
27544
  if (entry.source instanceof Uint8Array || entry.source instanceof ArrayBuffer || typeof entry.source === "string" || typeof Blob !== "undefined" && entry.source instanceof Blob) {
27482
27545
  const bytes = await toUint8Array(entry.source);
27483
27546
  await file.push(bytes, true);
@@ -27487,7 +27550,7 @@ onmessage = async (ev) => {
27487
27550
  }
27488
27551
  await file.complete();
27489
27552
  }
27490
- zip$1.end();
27553
+ zip.end();
27491
27554
  } catch (e) {
27492
27555
  queue.fail(e instanceof Error ? e : new Error(String(e)));
27493
27556
  }
@@ -27640,27 +27703,27 @@ onmessage = async (ev) => {
27640
27703
  });
27641
27704
  return;
27642
27705
  }
27643
- const parse$1 = createParse({
27706
+ const parse = createParse({
27644
27707
  ...this._options.parse ?? {},
27645
27708
  forceStream: true
27646
27709
  });
27647
27710
  const feedPromise = (async () => {
27648
27711
  try {
27649
27712
  for await (const chunk of toAsyncIterable(this._source)) await new Promise((resolve, reject) => {
27650
- parse$1.write(chunk, (err) => {
27713
+ parse.write(chunk, (err) => {
27651
27714
  if (err) reject(err);
27652
27715
  else resolve();
27653
27716
  });
27654
27717
  });
27655
- parse$1.end();
27656
- await parse$1.promise();
27718
+ parse.end();
27719
+ await parse.promise();
27657
27720
  } catch (e) {
27658
- parse$1.destroy(e instanceof Error ? e : new Error(String(e)));
27721
+ parse.destroy(e instanceof Error ? e : new Error(String(e)));
27659
27722
  throw e;
27660
27723
  }
27661
27724
  })();
27662
27725
  try {
27663
- for await (const entry of parse$1) yield new UnzipEntry({
27726
+ for await (const entry of parse) yield new UnzipEntry({
27664
27727
  kind: "stream",
27665
27728
  entry
27666
27729
  });