ooxml-core 0.21.2 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +3 -4
  2. package/dist/automation/index.cjs +34 -13
  3. package/dist/automation/index.mjs +34 -13
  4. package/dist/chart/index.cjs +242 -0
  5. package/dist/chart/index.d.ts +5 -0
  6. package/dist/chart/index.d.ts.map +1 -1
  7. package/dist/chart/index.mjs +227 -1
  8. package/dist/chart/pie-best-fit.d.ts +51 -0
  9. package/dist/chart/pie-best-fit.d.ts.map +1 -0
  10. package/dist/chart/pie-label-collision.d.ts +48 -0
  11. package/dist/chart/pie-label-collision.d.ts.map +1 -0
  12. package/dist/chart/radar-geometry.d.ts +19 -0
  13. package/dist/chart/radar-geometry.d.ts.map +1 -0
  14. package/dist/chart/treemap-squarify.d.ts +31 -0
  15. package/dist/chart/treemap-squarify.d.ts.map +1 -0
  16. package/dist/chart/trendline-equation.d.ts +39 -0
  17. package/dist/chart/trendline-equation.d.ts.map +1 -0
  18. package/dist/collab/index.cjs +6 -1
  19. package/dist/collab/index.mjs +6 -1
  20. package/dist/color/contrast.d.ts +18 -0
  21. package/dist/color/contrast.d.ts.map +1 -0
  22. package/dist/color/index.cjs +33 -0
  23. package/dist/color/index.d.ts +2 -0
  24. package/dist/color/index.d.ts.map +1 -1
  25. package/dist/color/index.mjs +31 -1
  26. package/dist/color/unit-rgb.d.ts +21 -0
  27. package/dist/color/unit-rgb.d.ts.map +1 -0
  28. package/dist/docx/embedded.cjs +1 -1
  29. package/dist/docx/embedded.mjs +1 -1
  30. package/dist/docx/index.cjs +1 -1
  31. package/dist/docx/index.mjs +1 -1
  32. package/dist/docx/load/index.cjs +1 -1
  33. package/dist/docx/load/index.mjs +1 -1
  34. package/dist/geometry/align-distribute.d.ts +145 -0
  35. package/dist/geometry/align-distribute.d.ts.map +1 -0
  36. package/dist/geometry/index.cjs +318 -0
  37. package/dist/geometry/index.d.ts +2 -0
  38. package/dist/geometry/index.d.ts.map +1 -1
  39. package/dist/geometry/index.mjs +307 -1
  40. package/dist/geometry/snap-guides.d.ts +125 -0
  41. package/dist/geometry/snap-guides.d.ts.map +1 -0
  42. package/dist/index.cjs +665 -0
  43. package/dist/index.mjs +665 -0
  44. package/dist/pptx/automation/index.cjs +24 -1
  45. package/dist/pptx/automation/index.d.ts +3 -3
  46. package/dist/pptx/automation/index.mjs +24 -1
  47. package/dist/pptx/chunks/{index-JaNVJ6Tf.d.ts → index-D2y7ehZ5.d.ts} +3 -3
  48. package/dist/pptx/chunks/{index-JaNVJ6Tf.d.ts.map → index-D2y7ehZ5.d.ts.map} +1 -1
  49. package/dist/pptx/chunks/{index-DHdHU9Qr.d.ts → index-ucqKcqvI.d.ts} +10 -2
  50. package/dist/pptx/chunks/{index-DHdHU9Qr.d.ts.map → index-ucqKcqvI.d.ts.map} +1 -1
  51. package/dist/pptx/chunks/{text-operations-DUEhSW5Z.d.ts → text-operations-CR3pUJi-.d.ts} +14 -2
  52. package/dist/pptx/chunks/text-operations-CR3pUJi-.d.ts.map +1 -0
  53. package/dist/pptx/cli/index.cjs +23 -0
  54. package/dist/pptx/cli/index.d.ts +1 -1
  55. package/dist/pptx/cli/index.mjs +23 -0
  56. package/dist/pptx/converter/index.d.ts +1 -1
  57. package/dist/pptx/index.cjs +33 -3
  58. package/dist/pptx/index.d.ts +3 -3
  59. package/dist/pptx/index.mjs +33 -3
  60. package/dist/teams/index.cjs +7 -2
  61. package/dist/teams/index.mjs +7 -2
  62. package/dist/text/decimal-tab.d.ts +24 -0
  63. package/dist/text/decimal-tab.d.ts.map +1 -0
  64. package/dist/text/index.cjs +72 -0
  65. package/dist/text/index.d.ts +2 -0
  66. package/dist/text/index.d.ts.map +1 -1
  67. package/dist/text/index.mjs +68 -1
  68. package/dist/text/tab-leader.d.ts +36 -0
  69. package/dist/text/tab-leader.d.ts.map +1 -0
  70. package/dist/xlsx/edit/charts.d.ts.map +1 -1
  71. package/dist/xlsx/edit/clipboard-html-parse.d.ts.map +1 -1
  72. package/dist/xlsx/index.cjs +33 -12
  73. package/dist/xlsx/index.mjs +33 -12
  74. package/dist/xlsx/ui/grid/cell-paint.d.ts.map +1 -1
  75. package/dist/xlsx/ui/index.cjs +37 -16
  76. package/dist/xlsx/ui/index.mjs +37 -16
  77. package/package.json +2 -2
  78. package/dist/pptx/chunks/text-operations-DUEhSW5Z.d.ts.map +0 -1
@@ -114,4 +114,71 @@ function hasDistinctScriptFonts(fonts) {
114
114
  return Boolean(fonts.eastAsia) && fonts.eastAsia !== base || Boolean(fonts.complexScript) && fonts.complexScript !== base || Boolean(fonts.symbol) && fonts.symbol !== base;
115
115
  }
116
116
 
117
- export { detectFontScript, hasDistinctScriptFonts, resolveFontForScript, segmentByScript };
117
+ // text/tab-leader.ts
118
+ function getLeaderCharacter(leader) {
119
+ switch (leader) {
120
+ case "dot":
121
+ return ".";
122
+ case "hyphen":
123
+ return "-";
124
+ case "underscore":
125
+ return "_";
126
+ case "heavy":
127
+ return "\u2501";
128
+ // box-drawing heavy horizontal
129
+ case "middleDot":
130
+ return "\xB7";
131
+ // middle dot
132
+ default:
133
+ return void 0;
134
+ }
135
+ }
136
+ function getLeaderStyles(widthPx, color) {
137
+ if (widthPx <= 0) {
138
+ return void 0;
139
+ }
140
+ return {
141
+ display: "inline-block",
142
+ width: `${widthPx}px`,
143
+ overflow: "hidden",
144
+ whiteSpace: "pre",
145
+ verticalAlign: "baseline",
146
+ ...color ? { color } : {}
147
+ };
148
+ }
149
+ function buildLeaderString(leader, widthPx, fontSizePx = 16) {
150
+ const char = getLeaderCharacter(leader);
151
+ if (!char || widthPx <= 0) {
152
+ return " ";
153
+ }
154
+ const charWidth = Math.max(1, fontSizePx * 0.6);
155
+ const count = Math.max(1, Math.ceil(widthPx / charWidth));
156
+ return char.repeat(count);
157
+ }
158
+
159
+ // text/decimal-tab.ts
160
+ function decimalSeparatorForLanguage(language) {
161
+ if (!language) {
162
+ return ".";
163
+ }
164
+ try {
165
+ const part = new Intl.NumberFormat(language).formatToParts(1.5).find((p) => p.type === "decimal");
166
+ return part?.value ?? ".";
167
+ } catch {
168
+ return ".";
169
+ }
170
+ }
171
+ function decimalAnchorIndex(text, separator) {
172
+ const first = text.search(/[0-9]/u);
173
+ if (first < 0) {
174
+ return text.length;
175
+ }
176
+ let end = first;
177
+ while (end < text.length && /[0-9.,]/u.test(text.charAt(end))) {
178
+ end++;
179
+ }
180
+ const sep = text.slice(first, end).indexOf(separator);
181
+ return sep >= 0 ? first + sep : end;
182
+ }
183
+
184
+ export { buildLeaderString, decimalAnchorIndex, decimalSeparatorForLanguage, detectFontScript, getLeaderCharacter, getLeaderStyles, hasDistinctScriptFonts, resolveFontForScript, segmentByScript };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Tab stop leader character rendering utilities.
3
+ *
4
+ * OOXML tab stops can specify a leader character that fills the gap between the
5
+ * preceding text and the tab stop position. This module provides the mapping
6
+ * from OOXML leader types to repeated characters and CSS styles for rendering
7
+ * them. Framework-agnostic; each binding maps the returned style map onto its
8
+ * own style binding.
9
+ */
10
+ /**
11
+ * Map an OOXML tab leader type to the character used to fill the tab gap.
12
+ * Returns `undefined` for 'none' or unknown types.
13
+ */
14
+ export declare function getLeaderCharacter(leader: string | undefined): string | undefined;
15
+ /**
16
+ * Build inline CSS for a tab leader span.
17
+ *
18
+ * The leader span is rendered as an inline-block element that fills the tab gap
19
+ * width with repeated leader characters.
20
+ *
21
+ * @param widthPx - Width of the tab gap in pixels.
22
+ * @param color - Text colour to inherit.
23
+ * @returns CSS properties for the leader span, or undefined if width is non-positive.
24
+ */
25
+ export declare function getLeaderStyles(widthPx: number, color?: string): Record<string, string | number> | undefined;
26
+ /**
27
+ * Generate a string of repeated leader characters sufficient to fill the given
28
+ * pixel width. Assumes ~0.6em per character at the given font size.
29
+ *
30
+ * @param leader - The OOXML leader type.
31
+ * @param widthPx - Width of the tab gap in pixels.
32
+ * @param fontSizePx - Font size in pixels (default 16).
33
+ * @returns The repeated leader string, or a plain tab character if no leader.
34
+ */
35
+ export declare function buildLeaderString(leader: string | undefined, widthPx: number, fontSizePx?: number): string;
36
+ //# sourceMappingURL=tab-leader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tab-leader.d.ts","sourceRoot":"","sources":["../../text/tab-leader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAejF;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACZ,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,SAAS,CAY7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,MAAM,EACf,UAAU,GAAE,MAAW,GACrB,MAAM,CAUR"}
@@ -1 +1 @@
1
- {"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/charts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,cAAc,CAAC;AAEzD,2DAA2D;AAC3D,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAU7D,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC;AAEzE,kGAAkG;AAClG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,MAAM,CAc9F;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAkB/F;AAED,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAS5E;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CACvB,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,aAAa,EACrB,IAAI,CAAC,EAAE,MAAM,GACX,WAAW,CAwBb"}
1
+ {"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/charts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,cAAc,CAAC;AAEzD,2DAA2D;AAC3D,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAU7D,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC;AAEzE,kGAAkG;AAClG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,MAAM,CAc9F;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAmB/F;AAED,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAS5E;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CACvB,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,aAAa,EACrB,IAAI,CAAC,EAAE,MAAM,GACX,WAAW,CAwBb"}
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard-html-parse.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/clipboard-html-parse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,SAAS,EAET,KAAK,EAGL,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,YAAY,CAAC;AAuBhE,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAkB7D;AAWD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnD;AAqFD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,cAAc,GAAG,SAAS,CAoDxF"}
1
+ {"version":3,"file":"clipboard-html-parse.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/clipboard-html-parse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,SAAS,EAET,KAAK,EAGL,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,YAAY,CAAC;AAuBhE,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAkB7D;AAWD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnD;AAwGD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,cAAc,GAAG,SAAS,CAoDxF"}
@@ -19366,7 +19366,7 @@ async function saveXlsx(workbook) {
19366
19366
 
19367
19367
  // xlsx/edit/context.ts
19368
19368
  function sheetAt(workbook, index2) {
19369
- const sheet = workbook.sheets[index2];
19369
+ const sheet = Number.isInteger(index2) ? workbook.sheets[index2] : void 0;
19370
19370
  if (!sheet) throw new RangeError(`No sheet at index ${index2}`);
19371
19371
  return sheet;
19372
19372
  }
@@ -20566,9 +20566,27 @@ function stylePatchFromCss(css, inner2) {
20566
20566
  if (numFmt) patch.numFmt = decodeNumberFormat(numFmt);
20567
20567
  return patch;
20568
20568
  }
20569
+ function stripTags(markup) {
20570
+ let previous;
20571
+ let text2 = markup;
20572
+ do {
20573
+ previous = text2;
20574
+ text2 = text2.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^<>]*>/g, "");
20575
+ } while (text2 !== previous);
20576
+ return removeAll(text2, ["<!--", "-->"]);
20577
+ }
20578
+ function removeAll(text2, tokens2) {
20579
+ let current = text2;
20580
+ let previous;
20581
+ do {
20582
+ previous = current;
20583
+ for (const token of tokens2) current = current.split(token).join("");
20584
+ } while (current !== previous);
20585
+ return current;
20586
+ }
20569
20587
  function cellText(inner2) {
20570
20588
  return decodeEntities(
20571
- inner2.replace(/<!--[\s\S]*?-->/g, "").replace(/<br\s*\/?>/gi, "\0").replace(/<[^>]+>/g, "").replace(/\s+/g, " ").replace(/ ?\u0000 ?/g, "\n")
20589
+ stripTags(inner2.replace(/<br\s*\/?>/gi, "\0")).replace(/\s+/g, " ").replace(/ ?\u0000 ?/g, "\n")
20572
20590
  ).replace(/ /g, " ").trim();
20573
20591
  }
20574
20592
  function parseHtmlTable(html, base) {
@@ -20576,7 +20594,9 @@ function parseHtmlTable(html, base) {
20576
20594
  if (table2 === void 0) return void 0;
20577
20595
  const classes = /* @__PURE__ */ new Map();
20578
20596
  for (const block of html.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi))
20579
- for (const rule of (block[1] ?? "").replace(/<!--|-->/g, "").matchAll(/\.([\w-]+)\s*\{([^}]*)\}/g))
20597
+ for (const rule of removeAll(block[1] ?? "", ["<!--", "-->"]).matchAll(
20598
+ /\.([\w-]+)\s*\{([^}]*)\}/g
20599
+ ))
20580
20600
  classes.set(rule[1] ?? "", rule[2] ?? "");
20581
20601
  const grid = [];
20582
20602
  const taken = /* @__PURE__ */ new Set();
@@ -21365,7 +21385,7 @@ function setAutoFilter(ctx, s, range) {
21365
21385
  const old = sheet.autoFilter;
21366
21386
  if (old) applyFilter(ctx, sheet, { range: old.range });
21367
21387
  if (r) sheet.autoFilter = { range: r };
21368
- else delete sheet.autoFilter;
21388
+ else Reflect.deleteProperty(sheet, "autoFilter");
21369
21389
  },
21370
21390
  { sheet: s, structural: true }
21371
21391
  );
@@ -22209,9 +22229,10 @@ function updateChart(ctx, s, index2, patch) {
22209
22229
  () => {
22210
22230
  const live = sheet.drawings[index2];
22211
22231
  for (const [key, value] of Object.entries(structuredClone(patch))) {
22212
- if (key === "kind" || key === "partName") continue;
22213
- if (value === void 0) delete live[key];
22214
- else live[key] = value;
22232
+ if (key === "kind" || key === "partName" || key === "__proto__") continue;
22233
+ if (key === "constructor" || key === "prototype") continue;
22234
+ if (value === void 0) Reflect.deleteProperty(live, key);
22235
+ else Reflect.set(live, key, value);
22215
22236
  }
22216
22237
  },
22217
22238
  { sheet: s }
@@ -22720,7 +22741,7 @@ function setDefaultColumnWidth(ctx, s, width) {
22720
22741
  "format",
22721
22742
  [{ kind: "sheet", sheet: s }],
22722
22743
  () => {
22723
- if (width === void 0) delete sheet.defaultColWidth;
22744
+ if (width === void 0) Reflect.deleteProperty(sheet, "defaultColWidth");
22724
22745
  else sheet.defaultColWidth = width;
22725
22746
  },
22726
22747
  { sheet: s, structural: true }
@@ -22742,7 +22763,7 @@ function setPageSetup(ctx, s, patch) {
22742
22763
  () => {
22743
22764
  const next = compact2({ ...sheet.pageSetup, ...structuredClone(patch) });
22744
22765
  if (Object.keys(next).length) sheet.pageSetup = next;
22745
- else delete sheet.pageSetup;
22766
+ else Reflect.deleteProperty(sheet, "pageSetup");
22746
22767
  },
22747
22768
  { sheet: s }
22748
22769
  );
@@ -22758,7 +22779,7 @@ function setPrintOptions(ctx, s, patch) {
22758
22779
  for (const key of Object.keys(next))
22759
22780
  if (!next[key]) delete next[key];
22760
22781
  if (Object.keys(next).length) sheet.printOptions = next;
22761
- else delete sheet.printOptions;
22782
+ else Reflect.deleteProperty(sheet, "printOptions");
22762
22783
  sheet.preserved.delete("printOptions");
22763
22784
  },
22764
22785
  { sheet: s }
@@ -23389,7 +23410,7 @@ function setSheetProtection(ctx, s, protection, password) {
23389
23410
  [{ kind: "sheet", sheet: s }],
23390
23411
  () => {
23391
23412
  if (!protection) {
23392
- delete sheet.protection;
23413
+ Reflect.deleteProperty(sheet, "protection");
23393
23414
  return;
23394
23415
  }
23395
23416
  const next = structuredClone(protection);
@@ -24405,7 +24426,7 @@ function setTabColor(ctx, index2, color) {
24405
24426
  [{ kind: "sheet", sheet: index2 }],
24406
24427
  () => {
24407
24428
  if (color) sheet.tabColor = { ...color };
24408
- else delete sheet.tabColor;
24429
+ else Reflect.deleteProperty(sheet, "tabColor");
24409
24430
  },
24410
24431
  { sheet: index2 }
24411
24432
  );
@@ -19360,7 +19360,7 @@ async function saveXlsx(workbook) {
19360
19360
 
19361
19361
  // xlsx/edit/context.ts
19362
19362
  function sheetAt(workbook, index2) {
19363
- const sheet = workbook.sheets[index2];
19363
+ const sheet = Number.isInteger(index2) ? workbook.sheets[index2] : void 0;
19364
19364
  if (!sheet) throw new RangeError(`No sheet at index ${index2}`);
19365
19365
  return sheet;
19366
19366
  }
@@ -20560,9 +20560,27 @@ function stylePatchFromCss(css, inner2) {
20560
20560
  if (numFmt) patch.numFmt = decodeNumberFormat(numFmt);
20561
20561
  return patch;
20562
20562
  }
20563
+ function stripTags(markup) {
20564
+ let previous;
20565
+ let text2 = markup;
20566
+ do {
20567
+ previous = text2;
20568
+ text2 = text2.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^<>]*>/g, "");
20569
+ } while (text2 !== previous);
20570
+ return removeAll(text2, ["<!--", "-->"]);
20571
+ }
20572
+ function removeAll(text2, tokens2) {
20573
+ let current = text2;
20574
+ let previous;
20575
+ do {
20576
+ previous = current;
20577
+ for (const token of tokens2) current = current.split(token).join("");
20578
+ } while (current !== previous);
20579
+ return current;
20580
+ }
20563
20581
  function cellText(inner2) {
20564
20582
  return decodeEntities(
20565
- inner2.replace(/<!--[\s\S]*?-->/g, "").replace(/<br\s*\/?>/gi, "\0").replace(/<[^>]+>/g, "").replace(/\s+/g, " ").replace(/ ?\u0000 ?/g, "\n")
20583
+ stripTags(inner2.replace(/<br\s*\/?>/gi, "\0")).replace(/\s+/g, " ").replace(/ ?\u0000 ?/g, "\n")
20566
20584
  ).replace(/ /g, " ").trim();
20567
20585
  }
20568
20586
  function parseHtmlTable(html, base) {
@@ -20570,7 +20588,9 @@ function parseHtmlTable(html, base) {
20570
20588
  if (table2 === void 0) return void 0;
20571
20589
  const classes = /* @__PURE__ */ new Map();
20572
20590
  for (const block of html.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi))
20573
- for (const rule of (block[1] ?? "").replace(/<!--|-->/g, "").matchAll(/\.([\w-]+)\s*\{([^}]*)\}/g))
20591
+ for (const rule of removeAll(block[1] ?? "", ["<!--", "-->"]).matchAll(
20592
+ /\.([\w-]+)\s*\{([^}]*)\}/g
20593
+ ))
20574
20594
  classes.set(rule[1] ?? "", rule[2] ?? "");
20575
20595
  const grid = [];
20576
20596
  const taken = /* @__PURE__ */ new Set();
@@ -21359,7 +21379,7 @@ function setAutoFilter(ctx, s, range) {
21359
21379
  const old = sheet.autoFilter;
21360
21380
  if (old) applyFilter(ctx, sheet, { range: old.range });
21361
21381
  if (r) sheet.autoFilter = { range: r };
21362
- else delete sheet.autoFilter;
21382
+ else Reflect.deleteProperty(sheet, "autoFilter");
21363
21383
  },
21364
21384
  { sheet: s, structural: true }
21365
21385
  );
@@ -22203,9 +22223,10 @@ function updateChart(ctx, s, index2, patch) {
22203
22223
  () => {
22204
22224
  const live = sheet.drawings[index2];
22205
22225
  for (const [key, value] of Object.entries(structuredClone(patch))) {
22206
- if (key === "kind" || key === "partName") continue;
22207
- if (value === void 0) delete live[key];
22208
- else live[key] = value;
22226
+ if (key === "kind" || key === "partName" || key === "__proto__") continue;
22227
+ if (key === "constructor" || key === "prototype") continue;
22228
+ if (value === void 0) Reflect.deleteProperty(live, key);
22229
+ else Reflect.set(live, key, value);
22209
22230
  }
22210
22231
  },
22211
22232
  { sheet: s }
@@ -22714,7 +22735,7 @@ function setDefaultColumnWidth(ctx, s, width) {
22714
22735
  "format",
22715
22736
  [{ kind: "sheet", sheet: s }],
22716
22737
  () => {
22717
- if (width === void 0) delete sheet.defaultColWidth;
22738
+ if (width === void 0) Reflect.deleteProperty(sheet, "defaultColWidth");
22718
22739
  else sheet.defaultColWidth = width;
22719
22740
  },
22720
22741
  { sheet: s, structural: true }
@@ -22736,7 +22757,7 @@ function setPageSetup(ctx, s, patch) {
22736
22757
  () => {
22737
22758
  const next = compact2({ ...sheet.pageSetup, ...structuredClone(patch) });
22738
22759
  if (Object.keys(next).length) sheet.pageSetup = next;
22739
- else delete sheet.pageSetup;
22760
+ else Reflect.deleteProperty(sheet, "pageSetup");
22740
22761
  },
22741
22762
  { sheet: s }
22742
22763
  );
@@ -22752,7 +22773,7 @@ function setPrintOptions(ctx, s, patch) {
22752
22773
  for (const key of Object.keys(next))
22753
22774
  if (!next[key]) delete next[key];
22754
22775
  if (Object.keys(next).length) sheet.printOptions = next;
22755
- else delete sheet.printOptions;
22776
+ else Reflect.deleteProperty(sheet, "printOptions");
22756
22777
  sheet.preserved.delete("printOptions");
22757
22778
  },
22758
22779
  { sheet: s }
@@ -23383,7 +23404,7 @@ function setSheetProtection(ctx, s, protection, password) {
23383
23404
  [{ kind: "sheet", sheet: s }],
23384
23405
  () => {
23385
23406
  if (!protection) {
23386
- delete sheet.protection;
23407
+ Reflect.deleteProperty(sheet, "protection");
23387
23408
  return;
23388
23409
  }
23389
23410
  const next = structuredClone(protection);
@@ -24399,7 +24420,7 @@ function setTabColor(ctx, index2, color) {
24399
24420
  [{ kind: "sheet", sheet: index2 }],
24400
24421
  () => {
24401
24422
  if (color) sheet.tabColor = { ...color };
24402
- else delete sheet.tabColor;
24423
+ else Reflect.deleteProperty(sheet, "tabColor");
24403
24424
  },
24404
24425
  { sheet: index2 }
24405
24426
  );
@@ -1 +1 @@
1
- {"version":3,"file":"cell-paint.d.ts","sourceRoot":"","sources":["../../../../xlsx/ui/grid/cell-paint.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,MAAM,gBAAgB,CAAC;AAYxB,uDAAuD;AACvD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED,2DAA2D;AAC3D,wBAAgB,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,SAAM,GAAG,MAAM,CAG1D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAKrD;AAyBD,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAWjF;AAED,MAAM,WAAW,SAAS;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAQ3E;AAED,eAAO,MAAM,OAAO,SAAU,QAAQ,GAAG,SAAS,KAAG,MAG/C,CAAC;AAEP,eAAO,MAAM,UAAU,MAAO,WAAW,KAAG,OACsC,CAAC;AAEnF,oDAAoD;AACpD,wBAAgB,WAAW,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAepF;AAED,2CAA2C;AAC3C,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAK9C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKhD;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAIvF;AAED,gEAAgE;AAChE,wBAAgB,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAGxE"}
1
+ {"version":3,"file":"cell-paint.d.ts","sourceRoot":"","sources":["../../../../xlsx/ui/grid/cell-paint.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAY7F,uDAAuD;AACvD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED,2DAA2D;AAC3D,wBAAgB,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,SAAM,GAAG,MAAM,CAG1D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAKrD;AAyBD,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAWjF;AAED,MAAM,WAAW,SAAS;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAQ3E;AAED,eAAO,MAAM,OAAO,SAAU,QAAQ,GAAG,SAAS,KAAG,MAG/C,CAAC;AAEP,eAAO,MAAM,UAAU,MAAO,WAAW,KAAG,OACsC,CAAC;AAEnF,oDAAoD;AACpD,wBAAgB,WAAW,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAepF;AAED,2CAA2C;AAC3C,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAK9C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKhD;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAIvF;AAED,gEAAgE;AAChE,wBAAgB,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAGxE"}
@@ -12879,7 +12879,7 @@ function shiftFormulaInBand(formula, formulaSheet, sheet, shift2, band) {
12879
12879
 
12880
12880
  // xlsx/edit/context.ts
12881
12881
  function sheetAt(workbook, index2) {
12882
- const sheet = workbook.sheets[index2];
12882
+ const sheet = Number.isInteger(index2) ? workbook.sheets[index2] : void 0;
12883
12883
  if (!sheet) throw new RangeError(`No sheet at index ${index2}`);
12884
12884
  return sheet;
12885
12885
  }
@@ -14079,9 +14079,27 @@ function stylePatchFromCss(css, inner2) {
14079
14079
  if (numFmt) patch.numFmt = decodeNumberFormat(numFmt);
14080
14080
  return patch;
14081
14081
  }
14082
+ function stripTags(markup) {
14083
+ let previous;
14084
+ let text = markup;
14085
+ do {
14086
+ previous = text;
14087
+ text = text.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^<>]*>/g, "");
14088
+ } while (text !== previous);
14089
+ return removeAll(text, ["<!--", "-->"]);
14090
+ }
14091
+ function removeAll(text, tokens) {
14092
+ let current = text;
14093
+ let previous;
14094
+ do {
14095
+ previous = current;
14096
+ for (const token of tokens) current = current.split(token).join("");
14097
+ } while (current !== previous);
14098
+ return current;
14099
+ }
14082
14100
  function cellText(inner2) {
14083
14101
  return decodeEntities(
14084
- inner2.replace(/<!--[\s\S]*?-->/g, "").replace(/<br\s*\/?>/gi, "\0").replace(/<[^>]+>/g, "").replace(/\s+/g, " ").replace(/ ?\u0000 ?/g, "\n")
14102
+ stripTags(inner2.replace(/<br\s*\/?>/gi, "\0")).replace(/\s+/g, " ").replace(/ ?\u0000 ?/g, "\n")
14085
14103
  ).replace(/ /g, " ").trim();
14086
14104
  }
14087
14105
  function parseHtmlTable(html, base) {
@@ -14089,7 +14107,9 @@ function parseHtmlTable(html, base) {
14089
14107
  if (table2 === void 0) return void 0;
14090
14108
  const classes = /* @__PURE__ */ new Map();
14091
14109
  for (const block of html.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi))
14092
- for (const rule of (block[1] ?? "").replace(/<!--|-->/g, "").matchAll(/\.([\w-]+)\s*\{([^}]*)\}/g))
14110
+ for (const rule of removeAll(block[1] ?? "", ["<!--", "-->"]).matchAll(
14111
+ /\.([\w-]+)\s*\{([^}]*)\}/g
14112
+ ))
14093
14113
  classes.set(rule[1] ?? "", rule[2] ?? "");
14094
14114
  const grid6 = [];
14095
14115
  const taken = /* @__PURE__ */ new Set();
@@ -14878,7 +14898,7 @@ function setAutoFilter(ctx, s, range2) {
14878
14898
  const old = sheet.autoFilter;
14879
14899
  if (old) applyFilter(ctx, sheet, { range: old.range });
14880
14900
  if (r) sheet.autoFilter = { range: r };
14881
- else delete sheet.autoFilter;
14901
+ else Reflect.deleteProperty(sheet, "autoFilter");
14882
14902
  },
14883
14903
  { sheet: s, structural: true }
14884
14904
  );
@@ -15718,9 +15738,10 @@ function updateChart(ctx, s, index2, patch) {
15718
15738
  () => {
15719
15739
  const live = sheet.drawings[index2];
15720
15740
  for (const [key, value2] of Object.entries(structuredClone(patch))) {
15721
- if (key === "kind" || key === "partName") continue;
15722
- if (value2 === void 0) delete live[key];
15723
- else live[key] = value2;
15741
+ if (key === "kind" || key === "partName" || key === "__proto__") continue;
15742
+ if (key === "constructor" || key === "prototype") continue;
15743
+ if (value2 === void 0) Reflect.deleteProperty(live, key);
15744
+ else Reflect.set(live, key, value2);
15724
15745
  }
15725
15746
  },
15726
15747
  { sheet: s }
@@ -16229,7 +16250,7 @@ function setDefaultColumnWidth(ctx, s, width) {
16229
16250
  "format",
16230
16251
  [{ kind: "sheet", sheet: s }],
16231
16252
  () => {
16232
- if (width === void 0) delete sheet.defaultColWidth;
16253
+ if (width === void 0) Reflect.deleteProperty(sheet, "defaultColWidth");
16233
16254
  else sheet.defaultColWidth = width;
16234
16255
  },
16235
16256
  { sheet: s, structural: true }
@@ -16251,7 +16272,7 @@ function setPageSetup(ctx, s, patch) {
16251
16272
  () => {
16252
16273
  const next = compact2({ ...sheet.pageSetup, ...structuredClone(patch) });
16253
16274
  if (Object.keys(next).length) sheet.pageSetup = next;
16254
- else delete sheet.pageSetup;
16275
+ else Reflect.deleteProperty(sheet, "pageSetup");
16255
16276
  },
16256
16277
  { sheet: s }
16257
16278
  );
@@ -16267,7 +16288,7 @@ function setPrintOptions(ctx, s, patch) {
16267
16288
  for (const key of Object.keys(next))
16268
16289
  if (!next[key]) delete next[key];
16269
16290
  if (Object.keys(next).length) sheet.printOptions = next;
16270
- else delete sheet.printOptions;
16291
+ else Reflect.deleteProperty(sheet, "printOptions");
16271
16292
  sheet.preserved.delete("printOptions");
16272
16293
  },
16273
16294
  { sheet: s }
@@ -16873,7 +16894,7 @@ function setSheetProtection(ctx, s, protection, password) {
16873
16894
  [{ kind: "sheet", sheet: s }],
16874
16895
  () => {
16875
16896
  if (!protection) {
16876
- delete sheet.protection;
16897
+ Reflect.deleteProperty(sheet, "protection");
16877
16898
  return;
16878
16899
  }
16879
16900
  const next = structuredClone(protection);
@@ -17875,7 +17896,7 @@ function setTabColor(ctx, index2, color) {
17875
17896
  [{ kind: "sheet", sheet: index2 }],
17876
17897
  () => {
17877
17898
  if (color) sheet.tabColor = { ...color };
17878
- else delete sheet.tabColor;
17899
+ else Reflect.deleteProperty(sheet, "tabColor");
17879
17900
  },
17880
17901
  { sheet: index2 }
17881
17902
  );
@@ -27023,12 +27044,12 @@ function diagonalSvg(b, w, h) {
27023
27044
  if (!b.diagonalUp && !b.diagonalDown) return void 0;
27024
27045
  const line2 = (edge, x1, y1, x2, y2) => {
27025
27046
  const dash = edge.style === "dashed" ? ' stroke-dasharray="4 2"' : edge.style === "dotted" ? ' stroke-dasharray="1 2"' : "";
27026
- return `<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="${edge.color}" stroke-width="${edge.widthPx}"${dash}/>`;
27047
+ return `<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="${edge.color.replace(/[^#\w(),.%\s-]/gu, "")}" stroke-width="${Number(edge.widthPx)}"${dash}/>`;
27027
27048
  };
27028
27049
  let body2 = "";
27029
27050
  if (b.diagonalDown) body2 += line2(b.diagonalDown, 0, 0, w, h);
27030
27051
  if (b.diagonalUp) body2 += line2(b.diagonalUp, 0, h, w, 0);
27031
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 ${w} ${h}">${body2}</svg>`;
27052
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${Number(w)}" height="${Number(h)}" viewBox="0 0 ${Number(w)} ${Number(h)}">${body2}</svg>`;
27032
27053
  }
27033
27054
  function justify(hAlign) {
27034
27055
  if (hAlign === "right") return "flex-end";
@@ -27421,8 +27442,8 @@ var YELLOW = "#f2b600";
27421
27442
  var GREEN = "#3f9b3f";
27422
27443
  var GRAY = "#7f7f7f";
27423
27444
  var BLACK2 = "#404040";
27424
- var svg = (body2, size) => `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 16 16" aria-hidden="true">${body2}</svg>`;
27425
- var arrow = (color, deg) => `<g transform="rotate(${deg} 8 8)"><path d="M8 1.5 14 8h-3.5v6.5h-5V8H2z" fill="${color}"/></g>`;
27445
+ var svg = (body2, size) => `<svg xmlns="http://www.w3.org/2000/svg" width="${Number(size)}" height="${Number(size)}" viewBox="0 0 16 16" aria-hidden="true">${body2}</svg>`;
27446
+ var arrow = (color, deg) => `<g transform="rotate(${Number(deg)} 8 8)"><path d="M8 1.5 14 8h-3.5v6.5h-5V8H2z" fill="${color}"/></g>`;
27426
27447
  var circle = (color, rim = false) => `<circle cx="8" cy="8" r="${rim ? 5.5 : 6.5}" fill="${color}"${rim ? ' stroke="#333" stroke-width="2.4"' : ""}/>`;
27427
27448
  var flag = (color) => `<path d="M3 1.5h1.3v13H3z" fill="#555"/><path d="M4.3 2h9l-2.6 3.5 2.6 3.5h-9z" fill="${color}"/>`;
27428
27449
  var symbol = (kind, color, circled) => {
@@ -12877,7 +12877,7 @@ function shiftFormulaInBand(formula, formulaSheet, sheet, shift2, band) {
12877
12877
 
12878
12878
  // xlsx/edit/context.ts
12879
12879
  function sheetAt(workbook, index2) {
12880
- const sheet = workbook.sheets[index2];
12880
+ const sheet = Number.isInteger(index2) ? workbook.sheets[index2] : void 0;
12881
12881
  if (!sheet) throw new RangeError(`No sheet at index ${index2}`);
12882
12882
  return sheet;
12883
12883
  }
@@ -14077,9 +14077,27 @@ function stylePatchFromCss(css, inner2) {
14077
14077
  if (numFmt) patch.numFmt = decodeNumberFormat(numFmt);
14078
14078
  return patch;
14079
14079
  }
14080
+ function stripTags(markup) {
14081
+ let previous;
14082
+ let text = markup;
14083
+ do {
14084
+ previous = text;
14085
+ text = text.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^<>]*>/g, "");
14086
+ } while (text !== previous);
14087
+ return removeAll(text, ["<!--", "-->"]);
14088
+ }
14089
+ function removeAll(text, tokens) {
14090
+ let current = text;
14091
+ let previous;
14092
+ do {
14093
+ previous = current;
14094
+ for (const token of tokens) current = current.split(token).join("");
14095
+ } while (current !== previous);
14096
+ return current;
14097
+ }
14080
14098
  function cellText(inner2) {
14081
14099
  return decodeEntities(
14082
- inner2.replace(/<!--[\s\S]*?-->/g, "").replace(/<br\s*\/?>/gi, "\0").replace(/<[^>]+>/g, "").replace(/\s+/g, " ").replace(/ ?\u0000 ?/g, "\n")
14100
+ stripTags(inner2.replace(/<br\s*\/?>/gi, "\0")).replace(/\s+/g, " ").replace(/ ?\u0000 ?/g, "\n")
14083
14101
  ).replace(/ /g, " ").trim();
14084
14102
  }
14085
14103
  function parseHtmlTable(html, base) {
@@ -14087,7 +14105,9 @@ function parseHtmlTable(html, base) {
14087
14105
  if (table2 === void 0) return void 0;
14088
14106
  const classes = /* @__PURE__ */ new Map();
14089
14107
  for (const block of html.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi))
14090
- for (const rule of (block[1] ?? "").replace(/<!--|-->/g, "").matchAll(/\.([\w-]+)\s*\{([^}]*)\}/g))
14108
+ for (const rule of removeAll(block[1] ?? "", ["<!--", "-->"]).matchAll(
14109
+ /\.([\w-]+)\s*\{([^}]*)\}/g
14110
+ ))
14091
14111
  classes.set(rule[1] ?? "", rule[2] ?? "");
14092
14112
  const grid6 = [];
14093
14113
  const taken = /* @__PURE__ */ new Set();
@@ -14876,7 +14896,7 @@ function setAutoFilter(ctx, s, range2) {
14876
14896
  const old = sheet.autoFilter;
14877
14897
  if (old) applyFilter(ctx, sheet, { range: old.range });
14878
14898
  if (r) sheet.autoFilter = { range: r };
14879
- else delete sheet.autoFilter;
14899
+ else Reflect.deleteProperty(sheet, "autoFilter");
14880
14900
  },
14881
14901
  { sheet: s, structural: true }
14882
14902
  );
@@ -15716,9 +15736,10 @@ function updateChart(ctx, s, index2, patch) {
15716
15736
  () => {
15717
15737
  const live = sheet.drawings[index2];
15718
15738
  for (const [key, value2] of Object.entries(structuredClone(patch))) {
15719
- if (key === "kind" || key === "partName") continue;
15720
- if (value2 === void 0) delete live[key];
15721
- else live[key] = value2;
15739
+ if (key === "kind" || key === "partName" || key === "__proto__") continue;
15740
+ if (key === "constructor" || key === "prototype") continue;
15741
+ if (value2 === void 0) Reflect.deleteProperty(live, key);
15742
+ else Reflect.set(live, key, value2);
15722
15743
  }
15723
15744
  },
15724
15745
  { sheet: s }
@@ -16227,7 +16248,7 @@ function setDefaultColumnWidth(ctx, s, width) {
16227
16248
  "format",
16228
16249
  [{ kind: "sheet", sheet: s }],
16229
16250
  () => {
16230
- if (width === void 0) delete sheet.defaultColWidth;
16251
+ if (width === void 0) Reflect.deleteProperty(sheet, "defaultColWidth");
16231
16252
  else sheet.defaultColWidth = width;
16232
16253
  },
16233
16254
  { sheet: s, structural: true }
@@ -16249,7 +16270,7 @@ function setPageSetup(ctx, s, patch) {
16249
16270
  () => {
16250
16271
  const next = compact2({ ...sheet.pageSetup, ...structuredClone(patch) });
16251
16272
  if (Object.keys(next).length) sheet.pageSetup = next;
16252
- else delete sheet.pageSetup;
16273
+ else Reflect.deleteProperty(sheet, "pageSetup");
16253
16274
  },
16254
16275
  { sheet: s }
16255
16276
  );
@@ -16265,7 +16286,7 @@ function setPrintOptions(ctx, s, patch) {
16265
16286
  for (const key of Object.keys(next))
16266
16287
  if (!next[key]) delete next[key];
16267
16288
  if (Object.keys(next).length) sheet.printOptions = next;
16268
- else delete sheet.printOptions;
16289
+ else Reflect.deleteProperty(sheet, "printOptions");
16269
16290
  sheet.preserved.delete("printOptions");
16270
16291
  },
16271
16292
  { sheet: s }
@@ -16871,7 +16892,7 @@ function setSheetProtection(ctx, s, protection, password) {
16871
16892
  [{ kind: "sheet", sheet: s }],
16872
16893
  () => {
16873
16894
  if (!protection) {
16874
- delete sheet.protection;
16895
+ Reflect.deleteProperty(sheet, "protection");
16875
16896
  return;
16876
16897
  }
16877
16898
  const next = structuredClone(protection);
@@ -17873,7 +17894,7 @@ function setTabColor(ctx, index2, color) {
17873
17894
  [{ kind: "sheet", sheet: index2 }],
17874
17895
  () => {
17875
17896
  if (color) sheet.tabColor = { ...color };
17876
- else delete sheet.tabColor;
17897
+ else Reflect.deleteProperty(sheet, "tabColor");
17877
17898
  },
17878
17899
  { sheet: index2 }
17879
17900
  );
@@ -27021,12 +27042,12 @@ function diagonalSvg(b, w, h) {
27021
27042
  if (!b.diagonalUp && !b.diagonalDown) return void 0;
27022
27043
  const line2 = (edge, x1, y1, x2, y2) => {
27023
27044
  const dash = edge.style === "dashed" ? ' stroke-dasharray="4 2"' : edge.style === "dotted" ? ' stroke-dasharray="1 2"' : "";
27024
- return `<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="${edge.color}" stroke-width="${edge.widthPx}"${dash}/>`;
27045
+ return `<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="${edge.color.replace(/[^#\w(),.%\s-]/gu, "")}" stroke-width="${Number(edge.widthPx)}"${dash}/>`;
27025
27046
  };
27026
27047
  let body2 = "";
27027
27048
  if (b.diagonalDown) body2 += line2(b.diagonalDown, 0, 0, w, h);
27028
27049
  if (b.diagonalUp) body2 += line2(b.diagonalUp, 0, h, w, 0);
27029
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 ${w} ${h}">${body2}</svg>`;
27050
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${Number(w)}" height="${Number(h)}" viewBox="0 0 ${Number(w)} ${Number(h)}">${body2}</svg>`;
27030
27051
  }
27031
27052
  function justify(hAlign) {
27032
27053
  if (hAlign === "right") return "flex-end";
@@ -27419,8 +27440,8 @@ var YELLOW = "#f2b600";
27419
27440
  var GREEN = "#3f9b3f";
27420
27441
  var GRAY = "#7f7f7f";
27421
27442
  var BLACK2 = "#404040";
27422
- var svg = (body2, size) => `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 16 16" aria-hidden="true">${body2}</svg>`;
27423
- var arrow = (color, deg) => `<g transform="rotate(${deg} 8 8)"><path d="M8 1.5 14 8h-3.5v6.5h-5V8H2z" fill="${color}"/></g>`;
27443
+ var svg = (body2, size) => `<svg xmlns="http://www.w3.org/2000/svg" width="${Number(size)}" height="${Number(size)}" viewBox="0 0 16 16" aria-hidden="true">${body2}</svg>`;
27444
+ var arrow = (color, deg) => `<g transform="rotate(${Number(deg)} 8 8)"><path d="M8 1.5 14 8h-3.5v6.5h-5V8H2z" fill="${color}"/></g>`;
27424
27445
  var circle = (color, rim = false) => `<circle cx="8" cy="8" r="${rim ? 5.5 : 6.5}" fill="${color}"${rim ? ' stroke="#333" stroke-width="2.4"' : ""}/>`;
27425
27446
  var flag = (color) => `<path d="M3 1.5h1.3v13H3z" fill="#555"/><path d="M4.3 2h9l-2.6 3.5 2.6 3.5h-9z" fill="${color}"/>`;
27426
27447
  var symbol = (kind, color, circled) => {