@poe-platform/safe-bash 0.1.754 → 0.1.755

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 (51) hide show
  1. package/dist/image-ast/index.browser.js +13 -1
  2. package/dist/image-ast/index.js +13 -1
  3. package/dist/pdf-ast/fonts/truetype.d.ts +1 -0
  4. package/dist/pdf-ast/index.js +13 -1
  5. package/dist/safe-bash/chunks/{chunk-R2WG64VB.js → chunk-6XDKK63A.js} +14 -2
  6. package/dist/safe-bash/chunks/{chunk-3W6CRM25.js → chunk-JEFBTRY7.js} +553 -289
  7. package/dist/safe-bash/chunks/{chunk-WNB4XH45.js → chunk-QHB7HBLA.js} +3 -3
  8. package/dist/safe-bash/chunks/{chunk-37Y7GZTK.js → chunk-RSAWYAEH.js} +2 -2
  9. package/dist/safe-bash/chunks/{pdf-renderer-DHQDZC6N.js → pdf-renderer-XIFUTX34.js} +3 -3
  10. package/dist/safe-bash/chunks/{src-S52LORVD.js → src-V4VCM5OX.js} +5 -3
  11. package/dist/safe-bash/command-chunks/{chunk-IJHV6I6X.js → chunk-3DOHQQJR.js} +8 -6
  12. package/dist/safe-bash/command-chunks/chunk-IDR3WWKI.js +46 -0
  13. package/dist/safe-bash/command-chunks/{chunk-XAZ3NTJ4.js → chunk-KB2LQ4HG.js} +2 -2
  14. package/dist/safe-bash/command-chunks/{chunk-YY7HJMBG.js → chunk-KOM3FNCE.js} +1 -37
  15. package/dist/safe-bash/command-chunks/{chunk-CM4SVTIA.js → chunk-MENC7RPR.js} +1 -1
  16. package/dist/safe-bash/command-chunks/chunk-QQOAK7JQ.js +888 -0
  17. package/dist/safe-bash/command-chunks/{chunk-BE4AM2JW.js → chunk-UGX6MXDD.js} +5 -3
  18. package/dist/safe-bash/command-chunks/{chunk-PUOJAS3O.js → chunk-XRVNFK7Z.js} +13 -1
  19. package/dist/safe-bash/commands/ssconvert/index.d.ts +1 -2
  20. package/dist/safe-bash/commands/ssconvert/index.js +6 -260
  21. package/dist/safe-bash/core.browser.js +5 -207
  22. package/dist/safe-bash-command-csvkit/index.js +277 -49
  23. package/dist/safe-bash-command-ffmpeg/index.js +1723 -1717
  24. package/dist/safe-bash-command-imagemagick/index.js +2 -2
  25. package/dist/safe-bash-command-pandoc/command.js +3 -3
  26. package/dist/safe-bash-command-pandoc/index.js +3 -3
  27. package/dist/safe-bash-command-pdfimages/index.js +13 -1
  28. package/dist/safe-bash-command-pdfinfo/index.js +13 -1
  29. package/dist/safe-bash-command-pdftk/index.js +13 -1
  30. package/dist/safe-bash-command-pdftoppm/index.js +13 -1
  31. package/dist/safe-bash-command-pdftotext/index.js +13 -1
  32. package/dist/safe-bash-command-qpdf/index.js +13 -1
  33. package/dist/safe-bash-command-sips/index.js +2 -2
  34. package/dist/safe-bash-command-soffice/index.js +5 -4
  35. package/dist/safe-bash-command-ssconvert/formats/csv.js +4 -3
  36. package/dist/safe-bash-command-ssconvert/formats/spreadsheetml.js +4 -2
  37. package/dist/safe-bash-command-ssconvert/formats/xls.js +10 -666
  38. package/dist/safe-bash-command-ssconvert/index.d.ts +1 -0
  39. package/dist/safe-bash-command-ssconvert/index.js +680 -390
  40. package/dist/safe-bash-command-ssconvert/sync.d.ts +7 -0
  41. package/dist/safe-bash-command-timeout/index.js +1 -1
  42. package/dist/safe-bash-command-wkhtmltopdf/index.js +13 -1
  43. package/dist/spreadsheet-format-csv/text-export.d.ts +14 -0
  44. package/dist/spreadsheet-format-csv/text-export.js +2 -2
  45. package/dist/spreadsheet-format-xls/biff-binary.d.ts +7 -2
  46. package/dist/spreadsheet-format-xls/biff-binary.js +10 -1
  47. package/dist/spreadsheet-format-xls/biff-strings.d.ts +2 -3
  48. package/dist/spreadsheet-format-xls/biff-strings.js +14 -2
  49. package/package.json +2 -3
  50. package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +7 -0
  51. package/dist/safe-bash/command-chunks/chunk-MPUNHXWI.js +0 -205
@@ -18,6 +18,8 @@ import {
18
18
  import { builtInDirectContextExecutors } from "../safe-bash-contracts/runtime-control.js";
19
19
  import { shellValueByteLength } from "../safe-bash-contracts/value.js";
20
20
  import { writeFileOutput } from "../safe-bash-contracts/filesystem-output.js";
21
+ import { builtInDirectContextExecutors as builtInDirectContextExecutors2 } from "../safe-bash-contracts/runtime-control.js";
22
+ import { parseXml } from "@poe-platform/safe-fs/xml";
21
23
  var __create = Object.create;
22
24
  var __defProp = Object.defineProperty;
23
25
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -11813,12 +11815,12 @@ var require_PDFPageLeaf = __commonJS({
11813
11815
  return this.context.lookupMaybe(numberOrRef, PDFNumber_1.default);
11814
11816
  };
11815
11817
  PDFPageLeaf2.prototype.getInheritableAttribute = function(name) {
11816
- var attribute6;
11818
+ var attribute7;
11817
11819
  this.ascend(function(node3) {
11818
- if (!attribute6)
11819
- attribute6 = node3.get(name);
11820
+ if (!attribute7)
11821
+ attribute7 = node3.get(name);
11820
11822
  });
11821
- return attribute6;
11823
+ return attribute7;
11822
11824
  };
11823
11825
  PDFPageLeaf2.prototype.setParent = function(parentRef) {
11824
11826
  this.set(PDFName_1.default.Parent, parentRef);
@@ -21529,12 +21531,12 @@ var require_PDFAcroField = __commonJS({
21529
21531
  this.clearFlag(flag);
21530
21532
  };
21531
21533
  PDFAcroField2.prototype.getInheritableAttribute = function(name) {
21532
- var attribute6;
21534
+ var attribute7;
21533
21535
  this.ascend(function(node3) {
21534
- if (!attribute6)
21535
- attribute6 = node3.dict.get(name);
21536
+ if (!attribute7)
21537
+ attribute7 = node3.dict.get(name);
21536
21538
  });
21537
- return attribute6;
21539
+ return attribute7;
21538
21540
  };
21539
21541
  PDFAcroField2.prototype.ascend = function(visitor) {
21540
21542
  visitor(this);
@@ -22730,12 +22732,12 @@ var require_utils3 = __commonJS({
22730
22732
  return (flags & flag) !== 0;
22731
22733
  };
22732
22734
  var getInheritableAttribute = function(startNode, name) {
22733
- var attribute6;
22735
+ var attribute7;
22734
22736
  ascend(startNode, function(node3) {
22735
- if (!attribute6)
22736
- attribute6 = node3.get(name);
22737
+ if (!attribute7)
22738
+ attribute7 = node3.get(name);
22737
22739
  });
22738
- return attribute6;
22740
+ return attribute7;
22739
22741
  };
22740
22742
  var ascend = function(startNode, visitor) {
22741
22743
  visitor(startNode);
@@ -24825,7 +24827,7 @@ var require_svgPath = __commonJS({
24825
24827
  ["Z", 0],
24826
24828
  ["z", 0]
24827
24829
  ]);
24828
- var parse2 = function(path2) {
24830
+ var parse3 = function(path2) {
24829
24831
  var cmd;
24830
24832
  var ret = [];
24831
24833
  var args = [];
@@ -25147,7 +25149,7 @@ var require_svgPath = __commonJS({
25147
25149
  return result2;
25148
25150
  };
25149
25151
  exports.svgPathToOperators = function(path2) {
25150
- return apply(parse2(path2));
25152
+ return apply(parse3(path2));
25151
25153
  };
25152
25154
  }
25153
25155
  });
@@ -33931,8 +33933,8 @@ var require_fontkit_umd = __commonJS({
33931
33933
  var safer_1 = safer;
33932
33934
  var BOMChar = "\uFEFF";
33933
33935
  var PrependBOM = PrependBOMWrapper;
33934
- function PrependBOMWrapper(encoder3, options) {
33935
- this.encoder = encoder3;
33936
+ function PrependBOMWrapper(encoder4, options) {
33937
+ this.encoder = encoder4;
33936
33938
  this.addBOM = true;
33937
33939
  }
33938
33940
  PrependBOMWrapper.prototype.write = function(str2) {
@@ -33946,8 +33948,8 @@ var require_fontkit_umd = __commonJS({
33946
33948
  return this.encoder.end();
33947
33949
  };
33948
33950
  var StripBOM = StripBOMWrapper;
33949
- function StripBOMWrapper(decoder, options) {
33950
- this.decoder = decoder;
33951
+ function StripBOMWrapper(decoder2, options) {
33952
+ this.decoder = decoder2;
33951
33953
  this.pass = false;
33952
33954
  this.options = options || {};
33953
33955
  }
@@ -44164,9 +44166,9 @@ var require_fontkit_umd = __commonJS({
44164
44166
  iconv.defaultCharSingleByte = "?";
44165
44167
  iconv.encode = function encode(str2, encoding, options) {
44166
44168
  str2 = "" + (str2 || "");
44167
- var encoder3 = iconv.getEncoder(encoding, options);
44168
- var res = encoder3.write(str2);
44169
- var trail = encoder3.end();
44169
+ var encoder4 = iconv.getEncoder(encoding, options);
44170
+ var res = encoder4.write(str2);
44171
+ var trail = encoder4.end();
44170
44172
  return trail && trail.length > 0 ? Buffer3.concat([res, trail]) : res;
44171
44173
  };
44172
44174
  iconv.decode = function decode4(buf, encoding, options) {
@@ -44177,9 +44179,9 @@ var require_fontkit_umd = __commonJS({
44177
44179
  }
44178
44180
  buf = Buffer3.from("" + (buf || ""), "binary");
44179
44181
  }
44180
- var decoder = iconv.getDecoder(encoding, options);
44181
- var res = decoder.write(buf);
44182
- var trail = decoder.end();
44182
+ var decoder2 = iconv.getDecoder(encoding, options);
44183
+ var res = decoder2.write(buf);
44184
+ var trail = decoder2.end();
44183
44185
  return trail ? res + trail : res;
44184
44186
  };
44185
44187
  iconv.encodingExists = function encodingExists(enc) {
@@ -44226,14 +44228,14 @@ var require_fontkit_umd = __commonJS({
44226
44228
  return ("" + encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "");
44227
44229
  };
44228
44230
  iconv.getEncoder = function getEncoder(encoding, options) {
44229
- var codec = iconv.getCodec(encoding), encoder3 = new codec.encoder(options, codec);
44230
- if (codec.bomAware && options && options.addBOM) encoder3 = new bomHandling.PrependBOM(encoder3, options);
44231
- return encoder3;
44231
+ var codec = iconv.getCodec(encoding), encoder4 = new codec.encoder(options, codec);
44232
+ if (codec.bomAware && options && options.addBOM) encoder4 = new bomHandling.PrependBOM(encoder4, options);
44233
+ return encoder4;
44232
44234
  };
44233
44235
  iconv.getDecoder = function getDecoder2(encoding, options) {
44234
- var codec = iconv.getCodec(encoding), decoder = new codec.decoder(options, codec);
44235
- if (codec.bomAware && !(options && options.stripBOM === false)) decoder = new bomHandling.StripBOM(decoder, options);
44236
- return decoder;
44236
+ var codec = iconv.getCodec(encoding), decoder2 = new codec.decoder(options, codec);
44237
+ if (codec.bomAware && !(options && options.stripBOM === false)) decoder2 = new bomHandling.StripBOM(decoder2, options);
44238
+ return decoder2;
44237
44239
  };
44238
44240
  var nodeVer = typeof process2 !== "undefined" && process2.versions && process2.versions.node;
44239
44241
  if (nodeVer) {
@@ -60829,7 +60831,7 @@ var require_fontkit_umd = __commonJS({
60829
60831
  path2.moveTo(x2, y2);
60830
60832
  open = true;
60831
60833
  }
60832
- var parse2 = function parse3() {
60834
+ var parse3 = function parse4() {
60833
60835
  while (stream.pos < end2) {
60834
60836
  var op = stream.readUInt8();
60835
60837
  if (op < 32) {
@@ -60891,7 +60893,7 @@ var require_fontkit_umd = __commonJS({
60891
60893
  var e = end2;
60892
60894
  stream.pos = subr.offset;
60893
60895
  end2 = subr.offset + subr.length;
60894
- parse3();
60896
+ parse4();
60895
60897
  stream.pos = p2;
60896
60898
  end2 = e;
60897
60899
  }
@@ -61033,7 +61035,7 @@ var require_fontkit_umd = __commonJS({
61033
61035
  var e = end2;
61034
61036
  stream.pos = subr.offset;
61035
61037
  end2 = subr.offset + subr.length;
61036
- parse3();
61038
+ parse4();
61037
61039
  stream.pos = p2;
61038
61040
  end2 = e;
61039
61041
  }
@@ -61266,7 +61268,7 @@ var require_fontkit_umd = __commonJS({
61266
61268
  }
61267
61269
  }
61268
61270
  };
61269
- parse2();
61271
+ parse3();
61270
61272
  if (open) {
61271
61273
  path2.closePath();
61272
61274
  }
@@ -74319,9 +74321,9 @@ function parseExpression(source, options) {
74319
74321
  options.onWork?.();
74320
74322
  if (++nodes > (options.maximumNodes ?? Infinity))
74321
74323
  throw new SsconvertError("resource-limit", "ssconvert formula node limit exceeded");
74322
- const children7 = value3.kind === "binary" ? [value3.left, value3.right] : value3.kind === "unary" || value3.kind === "parentheses" ? [value3.child] : value3.kind === "call" ? value3.args : value3.kind === "array" ? value3.rows.flat() : [];
74324
+ const children8 = value3.kind === "binary" ? [value3.left, value3.right] : value3.kind === "unary" || value3.kind === "parentheses" ? [value3.child] : value3.kind === "call" ? value3.args : value3.kind === "array" ? value3.rows.flat() : [];
74323
74325
  let height = 1;
74324
- for (const child7 of children7)
74326
+ for (const child7 of children8)
74325
74327
  height = Math.max(height, 1 + (heights.get(child7) ?? 1));
74326
74328
  if (height > (options.maximumDepth ?? Infinity))
74327
74329
  throw new SsconvertError("resource-limit", "ssconvert formula depth limit exceeded");
@@ -75056,7 +75058,7 @@ function parseExpression(source, options) {
75056
75058
  return { ok: false, source, diagnostic };
75057
75059
  }
75058
75060
  }
75059
- function parseNamedExpression(name, book, parse2, tick, maximumDepth = Infinity) {
75061
+ function parseNamedExpression(name, book, parse3, tick, maximumDepth = Infinity) {
75060
75062
  if (name.expression === "" || name.expression === "=") {
75061
75063
  tick();
75062
75064
  return { kind: "literal", value: { kind: "blank" }, start: 0, end: 0 };
@@ -75084,7 +75086,7 @@ function parseNamedExpression(name, book, parse2, tick, maximumDepth = Infinity)
75084
75086
  return { ...node3, rows: node3.rows.map((row) => row.map((child7) => bind(child7, depth + 1))) };
75085
75087
  return node3;
75086
75088
  }
75087
- return bind(parse2(name.expression, position, name.arrayStringLiterals));
75089
+ return bind(parse3(name.expression, position, name.arrayStringLiterals));
75088
75090
  }
75089
75091
  function encodeByteText(source, tick) {
75090
75092
  let end2 = 0;
@@ -75392,7 +75394,7 @@ function binary(op, left, right, admission) {
75392
75394
  return error("#NUM!");
75393
75395
  return numericResult(op === "+" ? a3 + b3 : op === "-" ? a3 - b3 : op === "*" ? a3 * b3 : op === "/" ? a3 / b3 : a3 ** b3);
75394
75396
  }
75395
- function buildDependencyGraph(book, roots, resolve, parse2, tick, onRange, maximumDepth = Infinity) {
75397
+ function buildDependencyGraph(book, roots, resolve, parse3, tick, onRange, maximumDepth = Infinity) {
75396
75398
  const precedents = /* @__PURE__ */ new Map(), dependents = /* @__PURE__ */ new Map(), volatile = /* @__PURE__ */ new Set();
75397
75399
  const link = (cell, precedent) => {
75398
75400
  tick();
@@ -75402,12 +75404,12 @@ function buildDependencyGraph(book, roots, resolve, parse2, tick, onRange, maxim
75402
75404
  precedents.set(cell, parents);
75403
75405
  }
75404
75406
  parents.add(precedent);
75405
- let children7 = dependents.get(precedent);
75406
- if (!children7) {
75407
- children7 = /* @__PURE__ */ new Set();
75408
- dependents.set(precedent, children7);
75407
+ let children8 = dependents.get(precedent);
75408
+ if (!children8) {
75409
+ children8 = /* @__PURE__ */ new Set();
75410
+ dependents.set(precedent, children8);
75409
75411
  }
75410
- children7.add(cell);
75412
+ children8.add(cell);
75411
75413
  };
75412
75414
  const range3 = (cell, value3) => {
75413
75415
  tick();
@@ -75468,7 +75470,7 @@ function buildDependencyGraph(book, roots, resolve, parse2, tick, onRange, maxim
75468
75470
  const name = named(node3, position);
75469
75471
  if (!name || names2.has(name))
75470
75472
  return [];
75471
- return staticRanges(parseNamedExpression(name, book, parse2, tick, maximumDepth), position, /* @__PURE__ */ new Set([...names2, name]), depth + 1);
75473
+ return staticRanges(parseNamedExpression(name, book, parse3, tick, maximumDepth), position, /* @__PURE__ */ new Set([...names2, name]), depth + 1);
75472
75474
  }
75473
75475
  if (node3.kind === "call" && (node3.name === "IF" || node3.name === "CHOOSE")) {
75474
75476
  const ranges3 = [];
@@ -75577,12 +75579,12 @@ function buildDependencyGraph(book, roots, resolve, parse2, tick, onRange, maxim
75577
75579
  if (node3.kind === "name" && (node3.workbook === void 0 || node3.workbook === "")) {
75578
75580
  const name = named(node3, position2);
75579
75581
  if (name && !names3.has(name)) {
75580
- pending.push({ node: parseNamedExpression(name, book, parse2, tick, maximumDepth), position: position2, names: /* @__PURE__ */ new Set([...names3, name]), depth: depth + 1 });
75582
+ pending.push({ node: parseNamedExpression(name, book, parse3, tick, maximumDepth), position: position2, names: /* @__PURE__ */ new Set([...names3, name]), depth: depth + 1 });
75581
75583
  }
75582
75584
  }
75583
- const children7 = node3.kind === "unary" || node3.kind === "parentheses" ? [node3.child] : node3.kind === "binary" ? [node3.left, node3.right] : node3.kind === "call" ? node3.args : node3.kind === "array" ? node3.rows.flat() : [];
75584
- for (let index2 = children7.length - 1; index2 >= 0; index2--)
75585
- pending.push({ node: children7[index2], position: position2, names: names3, depth: depth + 1 });
75585
+ const children8 = node3.kind === "unary" || node3.kind === "parentheses" ? [node3.child] : node3.kind === "binary" ? [node3.left, node3.right] : node3.kind === "call" ? node3.args : node3.kind === "array" ? node3.rows.flat() : [];
75586
+ for (let index2 = children8.length - 1; index2 >= 0; index2--)
75587
+ pending.push({ node: children8[index2], position: position2, names: names3, depth: depth + 1 });
75586
75588
  }
75587
75589
  }
75588
75590
  for (const sheet of book.sheets)
@@ -76288,8 +76290,8 @@ function resizeRetainedRecords(sheet, old, size, context) {
76288
76290
  throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: resize style bounds");
76289
76291
  return [{ node: node3, r0, r1, c0, c1 }];
76290
76292
  });
76291
- const children7 = rectangles2.filter((r) => r.r0 < size.rows && r.c0 < size.columns).map((r) => attributes(r.node, { endRow: String(Math.min(r.r1, size.rows - 1)), endCol: String(Math.min(r.c1, size.columns - 1)) }));
76292
- return [{ ...record7, data: { ...data3, children: children7 } }];
76293
+ const children8 = rectangles2.filter((r) => r.r0 < size.rows && r.c0 < size.columns).map((r) => attributes(r.node, { endRow: String(Math.min(r.r1, size.rows - 1)), endCol: String(Math.min(r.c1, size.columns - 1)) }));
76294
+ return [{ ...record7, data: { ...data3, children: children8 } }];
76293
76295
  });
76294
76296
  if (size.rows <= old.rows && size.columns <= old.columns)
76295
76297
  return retained2;
@@ -76588,14 +76590,14 @@ var odfNamespaces = {
76588
76590
  function odfObject(value3) {
76589
76591
  return value3 !== null && typeof value3 === "object" && !Array.isArray(value3) ? value3 : void 0;
76590
76592
  }
76591
- function odfAttributes(value3, namespace5) {
76593
+ function odfAttributes(value3, namespace6) {
76592
76594
  const source = odfObject(value3)?.attributes;
76593
76595
  if (Array.isArray(source))
76594
76596
  return Object.fromEntries(source.flatMap((a3) => {
76595
76597
  const v = odfObject(a3);
76596
- return typeof v?.name === "string" && typeof v.value === "string" && (namespace5 === void 0 || v.namespace === namespace5) ? [[v.name, v.value]] : [];
76598
+ return typeof v?.name === "string" && typeof v.value === "string" && (namespace6 === void 0 || v.namespace === namespace6) ? [[v.name, v.value]] : [];
76597
76599
  }));
76598
- if (namespace5 !== void 0)
76600
+ if (namespace6 !== void 0)
76599
76601
  return {};
76600
76602
  return Object.fromEntries(Object.entries(odfObject(source) ?? {}).filter((entry2) => typeof entry2[1] === "string"));
76601
76603
  }
@@ -76606,7 +76608,7 @@ function odfChildren(value3) {
76606
76608
  function upgradeOdfAnnotation(node3, charge) {
76607
76609
  const original = odfChildren(node3);
76608
76610
  charge(original.length);
76609
- const attributes4 = [], children7 = [...original];
76611
+ const attributes4 = [], children8 = [...original];
76610
76612
  for (const value3 of Array.isArray(node3.attributes) ? node3.attributes : []) {
76611
76613
  charge();
76612
76614
  const a3 = odfObject(value3);
@@ -76617,7 +76619,7 @@ function upgradeOdfAnnotation(node3, charge) {
76617
76619
  continue;
76618
76620
  if (a3.name === "create-date" || a3.name === "create-date-string") {
76619
76621
  const date = a3.name === "create-date";
76620
- children7.push({
76622
+ children8.push({
76621
76623
  name: date ? "date" : "date-string",
76622
76624
  namespace: odfNamespaces[date ? "dc" : "meta"],
76623
76625
  attributes: [],
@@ -76634,13 +76636,13 @@ function upgradeOdfAnnotation(node3, charge) {
76634
76636
  ...node3,
76635
76637
  namespace: odfNamespaces.office,
76636
76638
  attributes: attributes4,
76637
- children: children7,
76638
- content: children7.map((_, index2) => ({ kind: "element", index: index2 }))
76639
+ children: children8,
76640
+ content: children8.map((_, index2) => ({ kind: "element", index: index2 }))
76639
76641
  };
76640
76642
  }
76641
76643
  function createOdfXml(context, extended) {
76642
76644
  let work = 0, nodes = 0;
76643
- const encoder3 = new TextEncoder(), names2 = /* @__PURE__ */ new Set();
76645
+ const encoder4 = new TextEncoder(), names2 = /* @__PURE__ */ new Set();
76644
76646
  const declarations = {
76645
76647
  ...Object.fromEntries(Object.entries(odfNamespaces).map(([prefix, uri]) => ["xmlns:" + prefix, uri])),
76646
76648
  "xmlns:loext": odfEncryptionNamespace
@@ -76691,7 +76693,7 @@ function createOdfXml(context, extended) {
76691
76693
  result2 += ` ${key}="${escape3(String(value3))}"`;
76692
76694
  }
76693
76695
  result2 += content2 ? ">" + content2 + "</" + tag + ">" : "/>";
76694
- if (result2.length > context.limits.outputBytes || encoder3.encode(result2).length > context.limits.outputBytes)
76696
+ if (result2.length > context.limits.outputBytes || encoder4.encode(result2).length > context.limits.outputBytes)
76695
76697
  throw new SsconvertError("resource-limit", "ssconvert OpenDocument output bytes limit exceeded");
76696
76698
  return result2;
76697
76699
  }
@@ -76740,17 +76742,17 @@ function createOdfXml(context, extended) {
76740
76742
  if (Array.isArray(v.attributes))
76741
76743
  for (const a3 of v.attributes) {
76742
76744
  charge();
76743
- const attribute6 = odfObject(a3);
76744
- if (typeof attribute6?.name !== "string" || typeof attribute6.value !== "string" || typeof attribute6.namespace !== "string")
76745
+ const attribute7 = odfObject(a3);
76746
+ if (typeof attribute7?.name !== "string" || typeof attribute7.value !== "string" || typeof attribute7.namespace !== "string")
76745
76747
  continue;
76746
- const p2 = Object.entries(odfNamespaces).find(([, uri]) => uri === attribute6.namespace)?.[0];
76747
- if (attribute6.namespace && (!p2 || !extended && ["gnm", "calcext"].includes(p2)))
76748
+ const p2 = Object.entries(odfNamespaces).find(([, uri]) => uri === attribute7.namespace)?.[0];
76749
+ if (attribute7.namespace && (!p2 || !extended && ["gnm", "calcext"].includes(p2)))
76748
76750
  continue;
76749
- attributes4[(p2 ? p2 + ":" : "") + attribute6.name] = attribute6.value;
76751
+ attributes4[(p2 ? p2 + ":" : "") + attribute7.name] = attribute7.value;
76750
76752
  }
76751
76753
  if (prefix === "text" && v.name === "a" && attributes4["xlink:href"] !== void 0 && hyperlink)
76752
76754
  attributes4["xlink:href"] = hyperlink(attributes4["xlink:href"]);
76753
- const children7 = odfChildren(v);
76755
+ const children8 = odfChildren(v);
76754
76756
  const childHyperlinkContent = Boolean(hyperlink) && prefix === "text" && v.name === "a" && attributes4["xlink:href"] !== void 0;
76755
76757
  const content2 = contentOverride ?? (Array.isArray(v.content) ? v.content.map((c4) => {
76756
76758
  charge();
@@ -76761,11 +76763,11 @@ function createOdfXml(context, extended) {
76761
76763
  return "";
76762
76764
  if (item.index === void 0)
76763
76765
  return retained2(item.value, depth + 1, hyperlink, childHyperlinkContent);
76764
- if (typeof item.index !== "number" || !Number.isSafeInteger(item.index) || item.index < 0 || item.index >= children7.length)
76766
+ if (typeof item.index !== "number" || !Number.isSafeInteger(item.index) || item.index < 0 || item.index >= children8.length)
76765
76767
  throw new SsconvertError("invalid-request", "Invalid OpenDocument metadata child index");
76766
- return retained2(children7[item.index], depth + 1, hyperlink, childHyperlinkContent);
76767
- }).join("") : (typeof v.text === "string" ? escape3(v.text) : "") + children7.map((c4) => retained2(c4, depth + 1, hyperlink, childHyperlinkContent)).join(""));
76768
- if (hyperlinkContent && prefix === "text" && !content2 && !children7.length) {
76768
+ return retained2(children8[item.index], depth + 1, hyperlink, childHyperlinkContent);
76769
+ }).join("") : (typeof v.text === "string" ? escape3(v.text) : "") + children8.map((c4) => retained2(c4, depth + 1, hyperlink, childHyperlinkContent)).join(""));
76770
+ if (hyperlinkContent && prefix === "text" && !content2 && !children8.length) {
76769
76771
  if (v.name === "s" && Object.keys(attributes4).every((key) => key === "text:c")) {
76770
76772
  const count = Number(attributes4["text:c"] ?? "1");
76771
76773
  if (!Number.isSafeInteger(count) || count < 0)
@@ -76919,27 +76921,27 @@ function rewriteWorkbookHyperlinks(book, names2, context) {
76919
76921
  item.assign(updated);
76920
76922
  const attributes4 = odfObject(node3.attributes);
76921
76923
  const list = Array.isArray(node3.attributes) ? node3.attributes : [];
76922
- const field = (name, namespace5) => {
76923
- if (attributes4 && !namespace5 && typeof attributes4[name] === "string")
76924
+ const field = (name, namespace6) => {
76925
+ if (attributes4 && !namespace6 && typeof attributes4[name] === "string")
76924
76926
  return attributes4[name];
76925
76927
  for (const value4 of list) {
76926
76928
  charge();
76927
- const attribute6 = odfObject(value4);
76928
- if (attribute6?.name === name && attribute6.namespace === namespace5 && typeof attribute6.value === "string")
76929
- return attribute6.value;
76929
+ const attribute7 = odfObject(value4);
76930
+ if (attribute7?.name === name && attribute7.namespace === namespace6 && typeof attribute7.value === "string")
76931
+ return attribute7.value;
76930
76932
  }
76931
76933
  return void 0;
76932
76934
  };
76933
76935
  const link = odf ? node3.name === "a" : node3.name === "HyperLink" && field("type", "") === "GnmHLinkCurWB";
76934
76936
  if (link) {
76935
- const name = odf ? "href" : "target", namespace5 = odf ? odfNamespaces.xlink : "";
76936
- const source = field(name, namespace5);
76937
+ const name = odf ? "href" : "target", namespace6 = odf ? odfNamespaces.xlink : "";
76938
+ const source = field(name, namespace6);
76937
76939
  if (source !== void 0) {
76938
76940
  const rewritten = target(source, odf);
76939
76941
  updated.attributes = attributes4 ? { ...attributes4, [name]: rewritten } : list.map((value4) => {
76940
76942
  charge();
76941
- const attribute6 = odfObject(value4);
76942
- return attribute6?.name === name && attribute6.namespace === namespace5 ? { ...attribute6, value: rewritten } : value4;
76943
+ const attribute7 = odfObject(value4);
76944
+ return attribute7?.name === name && attribute7.namespace === namespace6 ? { ...attribute7, value: rewritten } : value4;
76943
76945
  });
76944
76946
  }
76945
76947
  }
@@ -76951,10 +76953,10 @@ function rewriteWorkbookHyperlinks(book, names2, context) {
76951
76953
  pending.push({ value: value4, role: childRole ?? child7.name, depth: item.depth + 1, assign });
76952
76954
  };
76953
76955
  if (Array.isArray(node3.children)) {
76954
- const children7 = [...node3.children];
76955
- updated.children = children7;
76956
- children7.forEach((child7, index2) => enqueue(child7, (next) => {
76957
- children7[index2] = next;
76956
+ const children8 = [...node3.children];
76957
+ updated.children = children8;
76958
+ children8.forEach((child7, index2) => enqueue(child7, (next) => {
76959
+ children8[index2] = next;
76958
76960
  }));
76959
76961
  }
76960
76962
  if (odf && Array.isArray(node3.content)) {
@@ -77012,23 +77014,23 @@ function rewriteWorkbook(book, context, rewrite) {
77012
77014
  throw new SsconvertError("unsupported-feature", `Unsupported ssconvert feature: formula syntax at ${parsed.diagnostic.start}:${parsed.diagnostic.end}`);
77013
77015
  return rewrite(parsed.document, namedExpression);
77014
77016
  };
77015
- const chart = (value3, sheet, parent, namespace5) => {
77017
+ const chart = (value3, sheet, parent, namespace6) => {
77016
77018
  context.signal.throwIfAborted();
77017
77019
  if (++work > maximum)
77018
77020
  throw new SsconvertError("resource-limit", "ssconvert workbook work limit exceeded");
77019
77021
  if (value3 === null || typeof value3 !== "object" || Array.isArray(value3))
77020
77022
  return value3;
77021
77023
  const node3 = value3;
77022
- const role = parent === void 0 && node3.name === "Objects" ? "Objects" : parent === "Objects" && node3.namespace === namespace5 && (node3.name === "SheetObjectGraph" || node3.name === "GnmGraph") ? "graph" : (parent === "graph" || parent === "GogObject") && node3.namespace === "" && node3.name === "GogObject" ? "GogObject" : parent === "GogObject" && node3.namespace === "" && node3.name === "data" ? "data" : void 0;
77024
+ const role = parent === void 0 && node3.name === "Objects" ? "Objects" : parent === "Objects" && node3.namespace === namespace6 && (node3.name === "SheetObjectGraph" || node3.name === "GnmGraph") ? "graph" : (parent === "graph" || parent === "GogObject") && node3.namespace === "" && node3.name === "GogObject" ? "GogObject" : parent === "GogObject" && node3.namespace === "" && node3.name === "data" ? "data" : void 0;
77023
77025
  const dimension = parent === "data" && node3.name === "dimension" && node3.namespace === "";
77024
77026
  if (role === void 0 && !dimension)
77025
77027
  return value3;
77026
- const type = Array.isArray(node3.attributes) ? node3.attributes.find((attribute6) => attribute6 !== null && typeof attribute6 === "object" && !Array.isArray(attribute6) && attribute6.name === "type" && attribute6.namespace === "") : void 0;
77028
+ const type = Array.isArray(node3.attributes) ? node3.attributes.find((attribute7) => attribute7 !== null && typeof attribute7 === "object" && !Array.isArray(attribute7) && attribute7.name === "type" && attribute7.namespace === "") : void 0;
77027
77029
  const typeName = type && typeof type === "object" && !Array.isArray(type) && typeof type.value === "string" ? type.value : "";
77028
77030
  return {
77029
77031
  ...node3,
77030
77032
  ...dimension && Object.hasOwn(chartDataTypes, typeName) && chartDataTypes[typeName].storage === "expression" && typeof node3.text === "string" && node3.text ? { text: formula3(node3.text, { sheet, row: 0, column: 0 }) } : {},
77031
- ...role !== void 0 && Array.isArray(node3.children) ? { children: node3.children.map((child7) => chart(child7, sheet, role, role === "Objects" && typeof node3.namespace === "string" ? node3.namespace : namespace5)) } : {}
77033
+ ...role !== void 0 && Array.isArray(node3.children) ? { children: node3.children.map((child7) => chart(child7, sheet, role, role === "Objects" && typeof node3.namespace === "string" ? node3.namespace : namespace6)) } : {}
77032
77034
  };
77033
77035
  };
77034
77036
  const rewriteSheet = (sheet) => ({
@@ -82652,7 +82654,7 @@ function caseByteText(input, uppercase, maximum, tick) {
82652
82654
  tick();
82653
82655
  end2++;
82654
82656
  }
82655
- const source = input.subarray(0, end2), encoder3 = new TextEncoder();
82657
+ const source = input.subarray(0, end2), encoder4 = new TextEncoder();
82656
82658
  const fullCases = uppercase ? upperFullCases : lowerFullCases;
82657
82659
  const traverse = (emit) => {
82658
82660
  let position = 0;
@@ -82667,7 +82669,7 @@ function caseByteText(input, uppercase, maximum, tick) {
82667
82669
  const mark = readByteTextCharacter(source, position, tick);
82668
82670
  if (!hasProperty(mark.point, 4))
82669
82671
  break;
82670
- const bytes2 = encoder3.encode(String.fromCodePoint(mark.point));
82672
+ const bytes2 = encoder4.encode(String.fromCodePoint(mark.point));
82671
82673
  emit(bytes2, 0, bytes2.length);
82672
82674
  position = mark.next;
82673
82675
  }
@@ -82678,7 +82680,7 @@ function caseByteText(input, uppercase, maximum, tick) {
82678
82680
  emit(source, start, next);
82679
82681
  continue;
82680
82682
  }
82681
- const bytes = encoder3.encode(text2);
82683
+ const bytes = encoder4.encode(text2);
82682
82684
  emit(bytes, 0, bytes.length);
82683
82685
  }
82684
82686
  };
@@ -98837,7 +98839,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
98837
98839
  const key = JSON.stringify([value3.sheets.map((sheet) => sheet.id), value3.firstRow, value3.lastRow, value3.firstColumn, value3.lastColumn]);
98838
98840
  ranges2.set(key, value3);
98839
98841
  }
98840
- function parse2(source, position, arrayStringLiterals = false) {
98842
+ function parse3(source, position, arrayStringLiterals = false) {
98841
98843
  tick();
98842
98844
  const parsed = parseExpression(source, { position, arrayStringLiterals, workbook: book, signal: context.signal, maximumDepth: context.limits.formulaDepth, maximumLength: context.limits.inputBytes, maximumNodes: maximumWork2 - work, onWork: tick });
98843
98845
  if (!parsed.ok)
@@ -98852,7 +98854,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
98852
98854
  const group = sheet.formulaGroups?.find((group2) => group2.id === cell.formulaGroup && group2.kind === "array");
98853
98855
  if (group)
98854
98856
  arrayKeys.set(cell, `${sheet.id}:${group.id}`);
98855
- const root = parse2(cell.formula, { sheet: sheet.id, row: group?.range.startRow ?? cell.row, column: group?.range.startColumn ?? cell.column }, cell.arrayStringLiterals);
98857
+ const root = parse3(cell.formula, { sheet: sheet.id, row: group?.range.startRow ?? cell.row, column: group?.range.startColumn ?? cell.column }, cell.arrayStringLiterals);
98856
98858
  expressions.set(cell, root);
98857
98859
  if (work - checkpoint >= WORK_QUANTUM) {
98858
98860
  checkpoint = work;
@@ -98931,7 +98933,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
98931
98933
  const name = book.names?.find((entry2) => entry2.sheet === sheet && matches(entry2)) ?? book.names?.find((entry2) => entry2.sheet === void 0 && matches(entry2));
98932
98934
  if (!name || names2.has(name))
98933
98935
  return error("#REF!");
98934
- return indirectRange(parseNamedExpression(name, book, parse2, tick, context.limits.formulaDependencyDepth ?? Infinity), position, /* @__PURE__ */ new Set([...names2, name]), depth2 + 1);
98936
+ return indirectRange(parseNamedExpression(name, book, parse3, tick, context.limits.formulaDependencyDepth ?? Infinity), position, /* @__PURE__ */ new Set([...names2, name]), depth2 + 1);
98935
98937
  }
98936
98938
  function scalar2(value3, position) {
98937
98939
  const label = scalarLabels.get(value3);
@@ -99025,7 +99027,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
99025
99027
  const name = book.names?.find((entry2) => entry2.sheet === sheet && matches(entry2)) ?? book.names?.find((entry2) => entry2.sheet === void 0 && matches(entry2));
99026
99028
  if (!name || names2.has(name))
99027
99029
  return error("#NAME?");
99028
- return evaluate(parseNamedExpression(name, book, parse2, tick, context.limits.formulaDependencyDepth ?? Infinity), position, array, /* @__PURE__ */ new Set([...names2, name]), wantReference);
99030
+ return evaluate(parseNamedExpression(name, book, parse3, tick, context.limits.formulaDependencyDepth ?? Infinity), position, array, /* @__PURE__ */ new Set([...names2, name]), wantReference);
99029
99031
  }
99030
99032
  if (node3.kind === "unary") {
99031
99033
  const apply = (value3) => {
@@ -99413,7 +99415,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
99413
99415
  activeCell = cell;
99414
99416
  const group = sheet.formulaGroups?.find((g) => g.id === cell.formulaGroup && g.kind === "array");
99415
99417
  const position = { sheet: sheet.id, row: group?.range.startRow ?? cell.row, column: group?.range.startColumn ?? cell.column };
99416
- const node3 = expressions.get(cell) ?? parse2(cell.formula, position);
99418
+ const node3 = expressions.get(cell) ?? parse3(cell.formula, position);
99417
99419
  let result2 = cell.cachedResult ?? cell.value;
99418
99420
  try {
99419
99421
  let remaining = book.iteration?.maximum ?? 0;
@@ -99461,7 +99463,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
99461
99463
  }
99462
99464
  const currentValues = /* @__PURE__ */ new Map();
99463
99465
  const dependencyRanges = [];
99464
- const graph = buildDependencyGraph(book, expressions, (node3, position) => localReferenceRange(book, node3, position), parse2, tick, (cell, range3) => dependencyRanges.push([cell, range3]), context.limits.formulaDependencyDepth ?? Infinity);
99466
+ const graph = buildDependencyGraph(book, expressions, (node3, position) => localReferenceRange(book, node3, position), parse3, tick, (cell, range3) => dependencyRanges.push([cell, range3]), context.limits.formulaDependencyDepth ?? Infinity);
99465
99467
  const pending = /* @__PURE__ */ new Set();
99466
99468
  const queue = [];
99467
99469
  const queueVolatile = typeof options === "boolean" || options.queueVolatile !== false;
@@ -99844,8 +99846,8 @@ async function openDatasourceSession(capability, context) {
99844
99846
  } });
99845
99847
  }
99846
99848
  function compareServiceIds(a3, b3) {
99847
- const encoder3 = new TextEncoder();
99848
- const left = encoder3.encode(a3.id), right = encoder3.encode(b3.id);
99849
+ const encoder4 = new TextEncoder();
99850
+ const left = encoder4.encode(a3.id), right = encoder4.encode(b3.id);
99849
99851
  for (let index2 = 0; index2 < Math.min(left.length, right.length); index2++) {
99850
99852
  const difference2 = left[index2] - right[index2];
99851
99853
  if (difference2)
@@ -101796,15 +101798,15 @@ async function runSolverValidation(book, context, registry = solverAlgorithms) {
101796
101798
  }
101797
101799
  function kaplanMeierChart(name, rows, probability, ticks, size, context) {
101798
101800
  let work = 0;
101799
- const node3 = (name2, attributes4 = {}, children7 = [], text2 = "", namespace6 = "") => {
101801
+ const node3 = (name2, attributes4 = {}, children8 = [], text2 = "", namespace7 = "") => {
101800
101802
  context.signal.throwIfAborted();
101801
101803
  work += 1 + text2.length + Object.entries(attributes4).reduce((sum2, [key, value3]) => sum2 + key.length + value3.length, 0);
101802
101804
  if (work > context.limits.operations)
101803
101805
  throw new SsconvertError("resource-limit", "ssconvert analysis chart exceeds workbook limits");
101804
- return { name: name2, namespace: namespace6, text: text2, attributes: Object.entries(attributes4).map(([name3, value3]) => ({ name: name3, namespace: "", value: value3 })), children: children7 };
101806
+ return { name: name2, namespace: namespace7, text: text2, attributes: Object.entries(attributes4).map(([name3, value3]) => ({ name: name3, namespace: "", value: value3 })), children: children8 };
101805
101807
  };
101806
101808
  const property = (name2, value3) => node3("property", { name: name2 }, [], value3);
101807
- const style2 = (children7) => node3("property", { name: "style", type: "GogStyle" }, children7);
101809
+ const style2 = (children8) => node3("property", { name: "style", type: "GogStyle" }, children8);
101808
101810
  const line = () => node3("line", { "auto-dash": "1", "auto-width": "1", "auto-color": "1" });
101809
101811
  const fill = () => node3("fill", { type: "none", "auto-type": "1", "is-auto": "1", "auto-fore": "1" });
101810
101812
  const axis = (role) => node3("GogObject", { role }, [
@@ -101861,13 +101863,13 @@ function kaplanMeierChart(name, rows, probability, ticks, size, context) {
101861
101863
  plot
101862
101864
  ])
101863
101865
  ]);
101864
- const namespace5 = "http://www.gnumeric.org/v10.dtd";
101866
+ const namespace6 = "http://www.gnumeric.org/v10.dtd";
101865
101867
  return { source: "Gnumeric_XmlIO:sax", kind: "Objects", disposition: "retained", data: node3("Objects", {}, [node3("SheetObjectGraph", {
101866
101868
  ObjectBound: `A2:${formatA1(Math.min(20, size.rows - 1), Math.min(5, size.columns - 1), size)}`,
101867
101869
  ObjectOffset: "0 0 0 0",
101868
101870
  Direction: "255",
101869
101871
  Print: "1"
101870
- }, [graph], "", namespace5)], "", namespace5) };
101872
+ }, [graph], "", namespace6)], "", namespace6) };
101871
101873
  }
101872
101874
  async function analysisUtility(book, tool, options, context, add5, merges) {
101873
101875
  const p2 = options.properties;
@@ -103649,14 +103651,14 @@ async function statisticalAnalysis(book, tool, options, context) {
103649
103651
  if (cell.row === anovaValidityRow && cell.column === 0)
103650
103652
  return { ...cell, format: '"ANOVA";[Red]"Invalid ANOVA: Missing Observations"', style: { italic: true, horizontalAlignment: "left", verticalAlignment: "bottom" } };
103651
103653
  if (cell.row === anovaValidityRow + 1 || cell.row === anovaErrorRow) {
103652
- const namespace5 = "http://www.gnumeric.org/v10.dtd";
103654
+ const namespace6 = "http://www.gnumeric.org/v10.dtd";
103653
103655
  return { ...cell, style: { ...cell.style, ...cell.row === anovaValidityRow + 1 ? { italic: true } : {}, gnumeric: {
103654
103656
  name: "Style",
103655
- namespace: namespace5,
103657
+ namespace: namespace6,
103656
103658
  attributes: [],
103657
- children: [{ name: "StyleBorder", namespace: namespace5, attributes: [], children: [{
103659
+ children: [{ name: "StyleBorder", namespace: namespace6, attributes: [], children: [{
103658
103660
  name: "Bottom",
103659
- namespace: namespace5,
103661
+ namespace: namespace6,
103660
103662
  attributes: [{ name: "Style", namespace: "", value: "1" }, { name: "Color", namespace: "", value: "0:0:0" }],
103661
103663
  children: []
103662
103664
  }] }]
@@ -104359,7 +104361,7 @@ function dirtyWorkbook(book, changes, context) {
104359
104361
  const tick = budget(context);
104360
104362
  book = snapshotWorkbook(book, context.limits);
104361
104363
  const dirty = /* @__PURE__ */ new Set();
104362
- function parse2(source, position, arrayStringLiterals = false) {
104364
+ function parse3(source, position, arrayStringLiterals = false) {
104363
104365
  tick();
104364
104366
  const parsed = parseExpression(source, {
104365
104367
  maximumDepth: context.limits.formulaDepth,
@@ -104382,11 +104384,11 @@ function dirtyWorkbook(book, changes, context) {
104382
104384
  const source = cell.formula ?? group?.expression;
104383
104385
  if (!source)
104384
104386
  continue;
104385
- roots.set(cell, parse2(source, { sheet: sheet.id, row: group?.range.startRow ?? cell.row, column: group?.range.startColumn ?? cell.column }, cell.arrayStringLiterals ?? group?.arrayStringLiterals));
104387
+ roots.set(cell, parse3(source, { sheet: sheet.id, row: group?.range.startRow ?? cell.row, column: group?.range.startColumn ?? cell.column }, cell.arrayStringLiterals ?? group?.arrayStringLiterals));
104386
104388
  if (cell.formulaDirty)
104387
104389
  dirty.add(cell);
104388
104390
  }
104389
- const graph = buildDependencyGraph(book, roots, (node3, position) => localReferenceRange(book, node3, position), parse2, tick, (cell, range3) => {
104391
+ const graph = buildDependencyGraph(book, roots, (node3, position) => localReferenceRange(book, node3, position), parse3, tick, (cell, range3) => {
104390
104392
  for (const sheet of range3.sheets)
104391
104393
  for (const change of changes) {
104392
104394
  tick();
@@ -106170,8 +106172,8 @@ ${errors.map((e) => ` E ${e}`).join("\n")}`);
106170
106172
  const parsed = legacyExpression(formula3, { ...gnumericGrammar, quoteSheetName: quoteNativeSheet }, { sheet: id, row, column }, context);
106171
106173
  return parsed.ok ? rewriteReferences(parsed.document, { sheets: renames, signal: context.signal }) : formula3;
106172
106174
  }
106173
- function node3(name, style3, children7 = [], text2 = "") {
106174
- return { name, namespace: "http://www.gnumeric.org/v10.dtd", text: text2, children: children7, attributes: Object.entries(style3).map(([name2, value3]) => {
106175
+ function node3(name, style3, children8 = [], text2 = "") {
106176
+ return { name, namespace: "http://www.gnumeric.org/v10.dtd", text: text2, children: children8, attributes: Object.entries(style3).map(([name2, value3]) => {
106175
106177
  let text3 = typeof value3 === "boolean" ? String(Number(value3)) : String(value3);
106176
106178
  if (["Fore", "Back", "PatternColor", "Color"].includes(name2) && text3.length === 8 && [...text3].every((c4) => "0123456789ABCDEF".includes(c4)))
106177
106179
  text3 = [text3.slice(2, 4), text3.slice(4, 6), text3.slice(6, 8)].map((s) => (parseInt(s, 16) * 257).toString(16).toUpperCase()).join(":");
@@ -106333,7 +106335,7 @@ function escapeXlsx(value3) {
106333
106335
  }
106334
106336
  function createXlsxXml(context) {
106335
106337
  let nodes = 0, work = 0;
106336
- const encoder3 = new TextEncoder();
106338
+ const encoder4 = new TextEncoder();
106337
106339
  const names2 = /* @__PURE__ */ new Set();
106338
106340
  function charge(amount = 1) {
106339
106341
  context.signal.throwIfAborted();
@@ -106380,7 +106382,7 @@ function createXlsxXml(context) {
106380
106382
  text2 += ` ${key}="${escapeXlsx(raw).split("\n").join("&#10;").split(" ").join("&#9;")}"`;
106381
106383
  }
106382
106384
  text2 += content2 ? ">" + content2 + "</" + name + ">" : "/>";
106383
- if (text2.length > context.limits.outputBytes || encoder3.encode(text2).length > context.limits.outputBytes)
106385
+ if (text2.length > context.limits.outputBytes || encoder4.encode(text2).length > context.limits.outputBytes)
106384
106386
  throw new SsconvertError("resource-limit", "ssconvert XLSX output bytes limit exceeded");
106385
106387
  return text2;
106386
106388
  };
@@ -106405,10 +106407,10 @@ function metadataNode(value3, charge) {
106405
106407
  for (const a3 of source.attributes) {
106406
106408
  charge?.();
106407
106409
  if (a3 && typeof a3 === "object" && !Array.isArray(a3)) {
106408
- const attribute6 = a3;
106409
- if (typeof attribute6.name === "string" && typeof attribute6.value === "string") {
106410
- charge?.(attribute6.name.length + attribute6.value.length);
106411
- attributes4[attribute6.name] = attribute6.value;
106410
+ const attribute7 = a3;
106411
+ if (typeof attribute7.name === "string" && typeof attribute7.value === "string") {
106412
+ charge?.(attribute7.name.length + attribute7.value.length);
106413
+ attributes4[attribute7.name] = attribute7.value;
106412
106414
  }
106413
106415
  }
106414
106416
  }
@@ -106955,15 +106957,24 @@ function readCfb(bytes, context) {
106955
106957
  return result2;
106956
106958
  }
106957
106959
  function readBiffRecords(bytes, context) {
106960
+ context.signal.throwIfAborted();
106961
+ if (bytes.length > context.limits.inputBytes)
106962
+ throw new SsconvertError("resource-limit", "ssconvert input bytes limit exceeded");
106958
106963
  const binary3 = new Binary(bytes), records = [];
106959
106964
  for (let offset = 0; offset < bytes.length; ) {
106960
106965
  context.signal.throwIfAborted();
106966
+ context.work?.();
106961
106967
  binary3.check(offset, 4);
106962
106968
  const opcode = binary3.u16(offset), length = binary3.u16(offset + 2);
106963
- if (opcode === 0 && length === 0 && bytes.subarray(offset).every((byte) => byte === 0))
106969
+ if (opcode === 0 && length === 0 && bytes.subarray(offset).every((byte) => {
106970
+ context.signal.throwIfAborted();
106971
+ context.work?.();
106972
+ return byte === 0;
106973
+ }))
106964
106974
  break;
106965
106975
  if (records.length >= (context.limits.workbookNodes ?? context.limits.inputBytes))
106966
106976
  throw new SsconvertError("resource-limit", "ssconvert BIFF record limit exceeded");
106977
+ context.retain?.(128);
106967
106978
  records.push({ opcode, offset, data: new Binary(binary3.slice(offset + 4, length)) });
106968
106979
  offset += length + 4;
106969
106980
  }
@@ -107855,6 +107866,8 @@ function biffOverrideCodepage(encoding) {
107855
107866
  return encoding === void 0 ? void 0 : overrideCodepages[encoding];
107856
107867
  }
107857
107868
  function biffDecode(bytes, codepage) {
107869
+ if (codepage === 65001)
107870
+ return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
107858
107871
  const multibyte = biffDbcsTables[codepage];
107859
107872
  if (multibyte) {
107860
107873
  const characters2 = [];
@@ -107871,7 +107884,7 @@ function biffDecode(bytes, codepage) {
107871
107884
  }
107872
107885
  return characters2.join("");
107873
107886
  }
107874
- const name = codepage === 1200 || codepage === 1201 ? "iso-8859-1" : codepage === 1e4 ? "macintosh" : codepage >= 1250 && codepage <= 1258 ? `windows-${codepage}` : `cp${codepage}`;
107887
+ const name = codepage === 20127 ? "ascii" : codepage === 1200 || codepage === 1201 || codepage === 28591 ? "iso-8859-1" : codepage === 1e4 ? "macintosh" : codepage >= 1250 && codepage <= 1258 ? `windows-${codepage}` : `cp${codepage}`;
107875
107888
  const table2 = singleByteTables[name];
107876
107889
  if (!table2)
107877
107890
  throw new SsconvertError("unsupported-feature", `Unsupported ssconvert feature: BIFF codepage ${codepage}`);
@@ -107900,6 +107913,8 @@ var BiffStrings = class {
107900
107913
  }
107901
107914
  advance() {
107902
107915
  while (this.part < this.parts.length && this.offset === this.parts[this.part].bytes.length) {
107916
+ this.context.signal.throwIfAborted();
107917
+ this.context.work?.();
107903
107918
  this.part++;
107904
107919
  this.offset = 0;
107905
107920
  }
@@ -107907,6 +107922,8 @@ var BiffStrings = class {
107907
107922
  invalidBiff("truncated string/CONTINUE");
107908
107923
  }
107909
107924
  byte() {
107925
+ this.context.signal.throwIfAborted();
107926
+ this.context.work?.();
107910
107927
  this.advance();
107911
107928
  return this.parts[this.part].u8(this.offset++);
107912
107929
  }
@@ -107929,6 +107946,7 @@ var BiffStrings = class {
107929
107946
  this.context.signal.throwIfAborted();
107930
107947
  if (length > (this.context.limits.workbookTextBytes ?? this.context.limits.inputBytes))
107931
107948
  throw new SsconvertError("resource-limit", "ssconvert BIFF string limit exceeded");
107949
+ this.context.retain?.(length * 16);
107932
107950
  }
107933
107951
  unicode(length) {
107934
107952
  this.admit(length * 3);
@@ -107941,6 +107959,7 @@ var BiffStrings = class {
107941
107959
  const characters = [];
107942
107960
  for (let i = 0; i < length; i++) {
107943
107961
  this.context.signal.throwIfAborted();
107962
+ this.context.work?.();
107944
107963
  if (this.offset === this.parts[this.part].bytes.length) {
107945
107964
  this.advance();
107946
107965
  const width2 = this.byte();
@@ -112683,8 +112702,8 @@ function translateBiffFormula(bytes, context) {
112683
112702
  const rawSheet = data3.u16(offset), signedSheet = rawSheet >= 32768 ? rawSheet - 65536 : rawSheet;
112684
112703
  const index2 = context.revision >= 8 ? data3.u32(offset + 2) : data3.u16(offset + 10);
112685
112704
  offset += width2;
112686
- const namespace5 = context.revision >= 8 ? rawSheet : signedSheet > 0 ? signedSheet - 1 : void 0;
112687
- const extern = namespace5 === void 0 ? void 0 : context.externalNames?.[namespace5];
112705
+ const namespace6 = context.revision >= 8 ? rawSheet : signedSheet > 0 ? signedSheet - 1 : void 0;
112706
+ const extern = namespace6 === void 0 ? void 0 : context.externalNames?.[namespace6];
112688
112707
  if (extern !== void 0) {
112689
112708
  const name2 = extern[index2 - 1];
112690
112709
  if (!name2) {
@@ -112899,7 +112918,7 @@ function biffExternalPath(path2) {
112899
112918
  function biffFormulaExtras(parts, revision2, codepage, context, accountWork) {
112900
112919
  const cursor = new BiffStrings(parts, context, codepage);
112901
112920
  const number5 = new Uint8Array(8), view2 = new DataView(number5.buffer);
112902
- const encoder3 = new TextEncoder();
112921
+ const encoder4 = new TextEncoder();
112903
112922
  const workLimit = context.limits.workbookWork ?? context.limits.inputBytes * 8;
112904
112923
  const textLimit = context.limits.workbookTextBytes ?? context.limits.inputBytes;
112905
112924
  let work = 0, textBytes = 0;
@@ -112914,7 +112933,7 @@ function biffFormulaExtras(parts, revision2, codepage, context, accountWork) {
112914
112933
  accountWork?.(columns * rows);
112915
112934
  const chunks = [];
112916
112935
  const append = (text2) => {
112917
- textBytes += encoder3.encode(text2).length;
112936
+ textBytes += encoder4.encode(text2).length;
112918
112937
  if (textBytes > textLimit)
112919
112938
  throw new SsconvertError("resource-limit", "ssconvert BIFF array text limit exceeded");
112920
112939
  chunks.push(text2);
@@ -113276,8 +113295,8 @@ var BiffNameBindings = class {
113276
113295
  });
113277
113296
  }
113278
113297
  };
113279
- function biffNode(name, attributes4, text2 = "", children7 = []) {
113280
- return { name, namespace: "http://www.gnumeric.org/v10.dtd", attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), text: text2, children: children7 };
113298
+ function biffNode(name, attributes4, text2 = "", children8 = []) {
113299
+ return { name, namespace: "http://www.gnumeric.org/v10.dtd", attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), text: text2, children: children8 };
113281
113300
  }
113282
113301
  var biffMetadataOpcodes = /* @__PURE__ */ new Set([
113283
113302
  42,
@@ -125864,7 +125883,7 @@ var BiffFormulaWriter = class {
125864
125883
  return order;
125865
125884
  }
125866
125885
  compile(source, sheet, row, column, definition, arrayStringLiterals) {
125867
- const parse2 = (expression2, position, literals = arrayStringLiterals ?? false) => {
125886
+ const parse3 = (expression2, position, literals = arrayStringLiterals ?? false) => {
125868
125887
  const parsed = parseExpression(expression2, {
125869
125888
  maximumDepth: this.context.limits.formulaDepth,
125870
125889
  workbook: this.book,
@@ -125884,7 +125903,7 @@ var BiffFormulaWriter = class {
125884
125903
  }).root;
125885
125904
  };
125886
125905
  const relative = definition !== void 0;
125887
- const root = definition ? parseNamedExpression(definition, this.book, parse2, () => this.context.signal.throwIfAborted()) : parse2(source, { sheet, row, column });
125906
+ const root = definition ? parseNamedExpression(definition, this.book, parse3, () => this.context.signal.throwIfAborted()) : parse3(source, { sheet, row, column });
125888
125907
  const bytes = [], arrays = [], diagnostics = [];
125889
125908
  const tokenBoundaries = [], arrayBoundaries = [];
125890
125909
  const arrayStrings = [];
@@ -127168,12 +127187,12 @@ async function mergeBiffProperties(book, streams, handled, context, charge, allo
127168
127187
  snapshots.delete(name);
127169
127188
  if (!snapshots.size)
127170
127189
  return preserved;
127171
- const parse2 = (bytes) => readBiffPropertySections(bytes, admit2, charge).map((section) => {
127190
+ const parse3 = (bytes) => readBiffPropertySections(bytes, admit2, charge).map((section) => {
127172
127191
  const data3 = bytes.subarray(section.offset, section.end);
127173
127192
  return { ...section, bytes: data3, ...biffPropertyFields.has(section.guid) || section.guid === biffPropertyFormats.custom ? { values: readBiffPropertyValues(new Binary(data3), admit2, charge) } : {} };
127174
127193
  });
127175
- const old = new Map([...snapshots].map(([name, snapshot]) => [name, parse2(snapshot.bytes)]));
127176
- const fresh = new Map([...streams].map(([name, bytes]) => [name, parse2(bytes)]));
127194
+ const old = new Map([...snapshots].map(([name, snapshot]) => [name, parse3(snapshot.bytes)]));
127195
+ const fresh = new Map([...streams].map(([name, bytes]) => [name, parse3(bytes)]));
127177
127196
  const original = /* @__PURE__ */ new Map(), pending = /* @__PURE__ */ new Map();
127178
127197
  const identity2 = (property) => `${property.stream}:${property.section}:${property.id}`;
127179
127198
  const readContext = { ...context, limits: { ...context.limits, inputBytes: context.limits.outputBytes } };
@@ -127467,7 +127486,7 @@ function handledPropertyRecord(record7, keys, charge) {
127467
127486
  charge(data3.name.length + data3.namespace.length + data3.text.length + data3.attributes.length + data3.children.length);
127468
127487
  return data3;
127469
127488
  };
127470
- const attributes4 = (n, namespace5, allowed) => {
127489
+ const attributes4 = (n, namespace6, allowed) => {
127471
127490
  const result2 = /* @__PURE__ */ new Map();
127472
127491
  for (const value3 of n.attributes) {
127473
127492
  charge(1);
@@ -127480,9 +127499,9 @@ function handledPropertyRecord(record7, keys, charge) {
127480
127499
  if (!["name", "namespace", "value"].includes(key))
127481
127500
  return void 0;
127482
127501
  }
127483
- if (typeof attr6.name !== "string" || attr6.namespace !== namespace5 || typeof attr6.value !== "string" || !allowed.includes(attr6.name) || result2.has(attr6.name))
127502
+ if (typeof attr6.name !== "string" || attr6.namespace !== namespace6 || typeof attr6.value !== "string" || !allowed.includes(attr6.name) || result2.has(attr6.name))
127484
127503
  return void 0;
127485
- charge(attr6.name.length + namespace5.length + attr6.value.length);
127504
+ charge(attr6.name.length + namespace6.length + attr6.value.length);
127486
127505
  result2.set(attr6.name, attr6.value);
127487
127506
  }
127488
127507
  return result2;
@@ -132594,10 +132613,10 @@ function crc322(bytes, previous = 0) {
132594
132613
  function createZipCodec(runtime = defaults, profile = {}) {
132595
132614
  const { yieldTurn, fail: fail2 } = runtime;
132596
132615
  const { codec, CodecReader } = runtime.compression;
132597
- const decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
132616
+ const decoder2 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
132598
132617
  function text2(bytes) {
132599
132618
  try {
132600
- return decoder.decode(bytes);
132619
+ return decoder2.decode(bytes);
132601
132620
  } catch {
132602
132621
  return fail2("invalid UTF-8 archive name or metadata");
132603
132622
  }
@@ -135209,8 +135228,8 @@ function number(value3, fallback = 0) {
135209
135228
  function sourceRecord(node3) {
135210
135229
  return { name: node3.localName, namespace: node3.namespace, attributes: Object.fromEntries(node3.attributes.filter((a3) => a3.namespace !== "http://www.w3.org/2000/xmlns/").map((a3) => [a3.name, a3.value])), text: node3.text, children: node3.children.map(sourceRecord) };
135211
135230
  }
135212
- function record2(name, attributes4, text2 = "", children7 = []) {
135213
- return { name, namespace, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), text: text2, children: children7 };
135231
+ function record2(name, attributes4, text2 = "", children8 = []) {
135232
+ return { name, namespace, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), text: text2, children: children8 };
135214
135233
  }
135215
135234
  function indexed(index2) {
135216
135235
  if (index2 < 8)
@@ -135462,8 +135481,8 @@ function numeric3(source, fallback) {
135462
135481
  throw new SsconvertError("io", "E Invalid XLSX: invalid print number");
135463
135482
  return value3;
135464
135483
  }
135465
- function gnode(name, attributes4 = {}, children7 = [], text2 = "") {
135466
- return { name, namespace: gnumericNamespace, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), children: children7, text: text2 };
135484
+ function gnode(name, attributes4 = {}, children8 = [], text2 = "") {
135485
+ return { name, namespace: gnumericNamespace, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), children: children8, text: text2 };
135467
135486
  }
135468
135487
  function header2(source) {
135469
135488
  const sections = { Left: "", Middle: "", Right: "" };
@@ -135693,7 +135712,7 @@ function header3(node3, fallback, charge) {
135693
135712
  return "&" + ["L", "C", "R"][index2] + output2;
135694
135713
  }).join("");
135695
135714
  }
135696
- async function writeXlsxSheetSettings(sheet, records, xml2, context, namespace5, charge) {
135715
+ async function writeXlsxSheetSettings(sheet, records, xml2, context, namespace6, charge) {
135697
135716
  const handled = /* @__PURE__ */ new Set(), raw = /* @__PURE__ */ new Map();
135698
135717
  for (const { record: record7, node: node4 } of records) {
135699
135718
  charge();
@@ -135704,7 +135723,7 @@ async function writeXlsxSheetSettings(sheet, records, xml2, context, namespace5,
135704
135723
  }
135705
135724
  const node3 = (name, attributes4 = {}, content2 = [], text2 = "") => {
135706
135725
  charge();
135707
- return { name, namespace: namespace5, attributes: Object.fromEntries(Object.entries(attributes4).flatMap(([key, value3]) => value3 === void 0 ? [] : [[key, String(value3)]])), children: content2, text: text2 };
135726
+ return { name, namespace: namespace6, attributes: Object.fromEntries(Object.entries(attributes4).flatMap(([key, value3]) => value3 === void 0 ? [] : [[key, String(value3)]])), children: content2, text: text2 };
135708
135727
  };
135709
135728
  const originalPrint = metadataNode(readXlsxMetadata(node3("worksheet", {}, [...raw.values()])).find((record7) => record7.kind === "PrintInformation")?.data, charge);
135710
135729
  const currentPrint = records.find((record7) => record7.record.kind === "PrintInformation")?.node ?? originalPrint;
@@ -135902,7 +135921,7 @@ function rgb(source, fallback) {
135902
135921
  function alignment(value3, fallback) {
135903
135922
  return value3 === void 0 ? fallback : value3.toLowerCase().split("_").at(-1) ?? fallback;
135904
135923
  }
135905
- function createXlsxStyles(xml2, edition, namespace5, charge) {
135924
+ function createXlsxStyles(xml2, edition, namespace6, charge) {
135906
135925
  const styles = [{ format: "General" }];
135907
135926
  const dxfs = [];
135908
135927
  const differentialIds = /* @__PURE__ */ new Map();
@@ -135965,7 +135984,7 @@ function createXlsxStyles(xml2, edition, namespace5, charge) {
135965
135984
  defaultXf = xml2("xf", attrs, properties);
135966
135985
  xfs.push(xml2("xf", { applyAlignment: 1, applyBorder: 1, applyFont: 1, applyFill: 1, applyNumberFormat: 1, ...attrs, xfId: 0 }, properties));
135967
135986
  }
135968
- return xml2("styleSheet", { xmlns: namespace5 }, (custom2.size ? xml2("numFmts", { count: custom2.size }, [...custom2].map(([formatCode, numFmtId]) => xml2("numFmt", { formatCode, numFmtId })).join("")) : "") + xml2("fonts", { count: fonts.length }, fonts.join("")) + xml2("fills", { count: fills.length }, fills.join("")) + xml2("borders", { count: borders.length }, borders.join("")) + xml2("cellStyleXfs", { count: 1 }, defaultXf) + xml2("cellXfs", { count: xfs.length }, xfs.join("")) + xml2("cellStyles", { count: 1 }, xml2("cellStyle", { name: "Normal", xfId: 0, builtinId: 0 })) + (dxfs.length ? xml2("dxfs", { count: dxfs.length }, dxfs.map((node3) => {
135987
+ return xml2("styleSheet", { xmlns: namespace6 }, (custom2.size ? xml2("numFmts", { count: custom2.size }, [...custom2].map(([formatCode, numFmtId]) => xml2("numFmt", { formatCode, numFmtId })).join("")) : "") + xml2("fonts", { count: fonts.length }, fonts.join("")) + xml2("fills", { count: fills.length }, fills.join("")) + xml2("borders", { count: borders.length }, borders.join("")) + xml2("cellStyleXfs", { count: 1 }, defaultXf) + xml2("cellXfs", { count: xfs.length }, xfs.join("")) + xml2("cellStyles", { count: 1 }, xml2("cellStyle", { name: "Normal", xfId: 0, builtinId: 0 })) + (dxfs.length ? xml2("dxfs", { count: dxfs.length }, dxfs.map((node3) => {
135969
135988
  const a3 = node3.attributes;
135970
135989
  let content2 = "";
135971
135990
  if (a3.Back !== void 0 || a3.Shade !== void 0)
@@ -135995,9 +136014,9 @@ function styleRecord(style2) {
135995
136014
  function child3(node3, name) {
135996
136015
  return node3?.children.find((n) => n.name === name);
135997
136016
  }
135998
- async function writeXlsxSheetMetadata(sheet, number5, xml2, context, namespace5, formula3, styles, charge) {
136017
+ async function writeXlsxSheetMetadata(sheet, number5, xml2, context, namespace6, formula3, styles, charge) {
135999
136018
  const records = (sheet.unsupportedRecords ?? []).map((record7) => ({ record: record7, node: metadataNode(record7.data, charge) }));
136000
- const settings = await writeXlsxSheetSettings(sheet, records, xml2, context, namespace5, charge);
136019
+ const settings = await writeXlsxSheetSettings(sheet, records, xml2, context, namespace6, charge);
136001
136020
  const pi2 = records.find((r) => r.record.kind === "PrintInformation")?.node;
136002
136021
  let print = settings.print;
136003
136022
  let filters = "", rules = "";
@@ -136005,7 +136024,7 @@ async function writeXlsxSheetMetadata(sheet, number5, xml2, context, namespace5,
136005
136024
  const handled = /* @__PURE__ */ new Set(["PrintInformation", "SheetLayout", "Styles"]);
136006
136025
  const render = (node3) => {
136007
136026
  charge();
136008
- if (node3.namespace !== namespace5 || Object.keys(node3.attributes).some((name) => name === "xmlns" || name.includes(":") && name !== "xml:space"))
136027
+ if (node3.namespace !== namespace6 || Object.keys(node3.attributes).some((name) => name === "xmlns" || name.includes(":") && name !== "xml:space"))
136009
136028
  throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: XLSX metadata namespace or relationship");
136010
136029
  return xml2(node3.name, node3.attributes, escapeXlsx(node3.text) + node3.children.map(render).join(""));
136011
136030
  };
@@ -136014,7 +136033,7 @@ async function writeXlsxSheetMetadata(sheet, number5, xml2, context, namespace5,
136014
136033
  const breaks = child3(pi2, gnm);
136015
136034
  if (!breaks || breaks.children.length === 0)
136016
136035
  continue;
136017
- const raw = records.find((r) => r.record.kind === name && r.node?.namespace === namespace5)?.node;
136036
+ const raw = records.find((r) => r.record.kind === name && r.node?.namespace === namespace6)?.node;
136018
136037
  const original = raw?.children.filter((n) => {
136019
136038
  charge();
136020
136039
  return n.name === "brk";
@@ -136167,7 +136186,7 @@ async function writeXlsxSheetMetadata(sheet, number5, xml2, context, namespace5,
136167
136186
  name: `comments${number5}.xml`,
136168
136187
  relation: "comments",
136169
136188
  type: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
136170
- content: xml2("comments", { xmlns: namespace5 }, xml2("authors", {}, authors.map((a3) => xml2("author", {}, escapeXlsx(encodeXlsxString(a3)))).join("")) + xml2("commentList", {}, comments.map((comment) => xml2("comment", { ref: comment.attributes.ObjectBound?.split(":")[0] ?? "A1", authorId: comment.attributes.Author === void 0 ? void 0 : authors.indexOf(comment.attributes.Author) }, commentText(comment))).join("")))
136189
+ content: xml2("comments", { xmlns: namespace6 }, xml2("authors", {}, authors.map((a3) => xml2("author", {}, escapeXlsx(encodeXlsxString(a3)))).join("")) + xml2("commentList", {}, comments.map((comment) => xml2("comment", { ref: comment.attributes.ObjectBound?.split(":")[0] ?? "A1", authorId: comment.attributes.Author === void 0 ? void 0 : authors.indexOf(comment.attributes.Author) }, commentText(comment))).join("")))
136171
136190
  });
136172
136191
  if (comments.length)
136173
136192
  parts.push({
@@ -136263,7 +136282,7 @@ async function writeXlsxSheetMetadata(sheet, number5, xml2, context, namespace5,
136263
136282
  continue;
136264
136283
  if (record7.source === "Gnumeric_XmlIO:sax" && (record7.kind === "Rows" && sheet.rows !== void 0 || record7.kind === "Cols" && sheet.columns !== void 0))
136265
136284
  continue;
136266
- if (node3?.namespace === namespace5 && record7.kind === "dataValidations") {
136285
+ if (node3?.namespace === namespace6 && record7.kind === "dataValidations") {
136267
136286
  rules += render(node3);
136268
136287
  continue;
136269
136288
  }
@@ -136321,8 +136340,8 @@ function writeXlsxProperties(book, xml2) {
136321
136340
  "xlsx:HyperlinksChanged": ["HyperlinksChanged", "bool"],
136322
136341
  "gsf:security": ["DocSecurity", "int"]
136323
136342
  };
136324
- const encoder3 = new TextEncoder();
136325
- const sorted = Object.entries(book.properties ?? {}).map(([key, value3]) => ({ key, value: value3, bytes: encoder3.encode(key) })).sort((a3, b3) => {
136343
+ const encoder4 = new TextEncoder();
136344
+ const sorted = Object.entries(book.properties ?? {}).map(([key, value3]) => ({ key, value: value3, bytes: encoder4.encode(key) })).sort((a3, b3) => {
136326
136345
  for (let index2 = 0; index2 < Math.min(a3.bytes.length, b3.bytes.length); index2++) {
136327
136346
  const diff = a3.bytes[index2] - b3.bytes[index2];
136328
136347
  if (diff)
@@ -136399,18 +136418,18 @@ function nativeOpenFormula(source, position, context, arrayStringLiterals = fals
136399
136418
  return serializeExpression(parsed.document, gnumericGrammar, false, true, { relativeSheets: "fixed" });
136400
136419
  }
136401
136420
  function readFormulaSemantics(node3) {
136402
- const value3 = node3?.attributes.find((attribute6) => attribute6.namespace === namespace2 && attribute6.localName === "array-string-literals")?.value;
136421
+ const value3 = node3?.attributes.find((attribute7) => attribute7.namespace === namespace2 && attribute7.localName === "array-string-literals")?.value;
136403
136422
  if (value3 !== void 0 && value3 !== "0" && value3 !== "1")
136404
136423
  throw new SsconvertError("io", "Invalid ssconvert formula array string semantics");
136405
136424
  return value3 === "1" ? { arrayStringLiterals: true } : {};
136406
136425
  }
136407
136426
  function readOpenFormula(node3) {
136408
- const source = node3?.attributes.find((attribute6) => attribute6.namespace === namespace2 && attribute6.localName === "openformula")?.value;
136427
+ const source = node3?.attributes.find((attribute7) => attribute7.namespace === namespace2 && attribute7.localName === "openformula")?.value;
136409
136428
  if (source === void 0)
136410
136429
  return void 0;
136411
136430
  if (!source.startsWith("of:="))
136412
136431
  throw new SsconvertError("io", "Invalid ssconvert OpenFormula expression");
136413
- const anchor = node3?.attributes.find((attribute6) => attribute6.namespace === namespace2 && attribute6.localName === "openformula-origin")?.value;
136432
+ const anchor = node3?.attributes.find((attribute7) => attribute7.namespace === namespace2 && attribute7.localName === "openformula-origin")?.value;
136414
136433
  if (anchor === void 0)
136415
136434
  return { source };
136416
136435
  let values2;
@@ -136464,27 +136483,27 @@ async function recognize(root, schema, context) {
136464
136483
  context.signal.throwIfAborted();
136465
136484
  const matches = edges2.get(parent + ":" + node3.localName) ?? [];
136466
136485
  const scans = ancestors.length === 0 || xlsxNamespaceScanElements.has(ancestors[ancestors.length - 1]);
136467
- let namespace5 = inheritedNamespace;
136486
+ let namespace6 = inheritedNamespace;
136468
136487
  if (scans)
136469
- for (const attribute6 of node3.attributes) {
136470
- if (attribute6.namespace !== "http://www.w3.org/2000/xmlns/")
136488
+ for (const attribute7 of node3.attributes) {
136489
+ if (attribute7.namespace !== "http://www.w3.org/2000/xmlns/")
136471
136490
  continue;
136472
- const key = Object.keys(xlsxNamespaces).find((key2) => xlsxNamespaces[key2].includes(attribute6.value));
136473
- if (attribute6.name === "xmlns") {
136491
+ const key = Object.keys(xlsxNamespaces).find((key2) => xlsxNamespaces[key2].includes(attribute7.value));
136492
+ if (attribute7.name === "xmlns") {
136474
136493
  if (key)
136475
- namespace5 = key;
136494
+ namespace6 = key;
136476
136495
  } else if (key) {
136477
- const prefix2 = attribute6.localName;
136496
+ const prefix2 = attribute7.localName;
136478
136497
  if (!prefixes.has(prefix2)) {
136479
136498
  prefixes.set(prefix2, key);
136480
136499
  if (!namespacePrefixes.has(key))
136481
136500
  namespacePrefixes.set(key, prefix2);
136482
136501
  }
136483
136502
  } else
136484
- unknownPrefixes.add(attribute6.localName);
136503
+ unknownPrefixes.add(attribute7.localName);
136485
136504
  }
136486
136505
  const colon = node3.name.indexOf(":"), prefix = colon < 0 ? void 0 : node3.name.slice(0, colon);
136487
- const match3 = matches.find((m) => prefix === void 0 ? m[2] === namespace5 : namespacePrefixes.get(m[2]) === prefix);
136506
+ const match3 = matches.find((m) => prefix === void 0 ? m[2] === namespace6 : namespacePrefixes.get(m[2]) === prefix);
136488
136507
  if (!match3) {
136489
136508
  if (prefix !== void 0 && unknownPrefixes.has(prefix))
136490
136509
  return void 0;
@@ -136503,7 +136522,7 @@ async function recognize(root, schema, context) {
136503
136522
  return node3;
136504
136523
  const accepted2 = [];
136505
136524
  for (const item of node3.children) {
136506
- const child7 = await visit(item, match3[1], [...ancestors, node3.localName], namespace5);
136525
+ const child7 = await visit(item, match3[1], [...ancestors, node3.localName], namespace6);
136507
136526
  if (child7)
136508
136527
  accepted2.push(child7);
136509
136528
  }
@@ -136511,10 +136530,10 @@ async function recognize(root, schema, context) {
136511
136530
  ...node3,
136512
136531
  namespace: xlsxNamespaces[match3[2]]?.[0] ?? node3.namespace,
136513
136532
  children: accepted2,
136514
- attributes: node3.attributes.map((attribute6) => {
136515
- const colon2 = attribute6.name.indexOf(":");
136516
- const key = colon2 < 0 ? void 0 : prefixes.get(attribute6.name.slice(0, colon2));
136517
- return key ? { ...attribute6, namespace: xlsxNamespaces[key][0] } : attribute6;
136533
+ attributes: node3.attributes.map((attribute7) => {
136534
+ const colon2 = attribute7.name.indexOf(":");
136535
+ const key = colon2 < 0 ? void 0 : prefixes.get(attribute7.name.slice(0, colon2));
136536
+ return key ? { ...attribute7, namespace: xlsxNamespaces[key][0] } : attribute7;
136518
136537
  })
136519
136538
  };
136520
136539
  }
@@ -136532,8 +136551,8 @@ function children3(node3, name) {
136532
136551
  function child4(node3, name) {
136533
136552
  return children3(node3, name)[0];
136534
136553
  }
136535
- function attr2(node3, name, namespace5 = "") {
136536
- return node3?.attributes.find((item) => item.localName === name && item.namespace === namespace5)?.value;
136554
+ function attr2(node3, name, namespace6 = "") {
136555
+ return node3?.attributes.find((item) => item.localName === name && item.namespace === namespace6)?.value;
136537
136556
  }
136538
136557
  function number2(value3, fallback = 0) {
136539
136558
  if (value3 === void 0)
@@ -137255,8 +137274,8 @@ function createXlsxWriter(edition) {
137255
137274
  }) };
137256
137275
  }) };
137257
137276
  }
137258
- const namespace5 = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
137259
- const styles = createXlsxStyles(xml2, edition, namespace5, charge);
137277
+ const namespace6 = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
137278
+ const styles = createXlsxStyles(xml2, edition, namespace6, charge);
137260
137279
  const zip = createZipCodec();
137261
137280
  const bounds2 = {
137262
137281
  ...zipLimits(context),
@@ -137268,20 +137287,20 @@ function createXlsxWriter(edition) {
137268
137287
  const entries2 = [], types2 = [
137269
137288
  { name: "xl/workbook.xml", type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" }
137270
137289
  ];
137271
- const encoder3 = new TextEncoder();
137290
+ const encoder4 = new TextEncoder();
137272
137291
  let plainBytes = 0;
137273
137292
  const declaration = '<?xml version="1.0" encoding="UTF-8"?>\n';
137274
137293
  const modified = new Date(context.clock?.now() ?? Date.UTC(2e3, 0, 1));
137275
137294
  async function add5(name, content2, type) {
137276
137295
  context.signal.throwIfAborted();
137277
137296
  charge(content2.length);
137278
- const length = encoder3.encode(declaration + content2 + "\n").length;
137297
+ const length = encoder4.encode(declaration + content2 + "\n").length;
137279
137298
  if (length > context.limits.outputBytes - plainBytes)
137280
137299
  limit("output bytes");
137281
137300
  if (entries2.length >= bounds2.maxMembers)
137282
137301
  limit("members");
137283
137302
  plainBytes += length;
137284
- entries2.push(await zip.makeZipEntry(name, encoder3.encode(declaration + content2 + "\n"), { modified, mode: 420, directory: false, symlink: false, compression: "deflate" }, bounds2, context.signal));
137303
+ entries2.push(await zip.makeZipEntry(name, encoder4.encode(declaration + content2 + "\n"), { modified, mode: 420, directory: false, symlink: false, compression: "deflate" }, bounds2, context.signal));
137285
137304
  if (type)
137286
137305
  types2.push({ name, type });
137287
137306
  }
@@ -137455,7 +137474,7 @@ function createXlsxWriter(edition) {
137455
137474
  for (const [gnm, xlsx, invert] of [["DisplayFormulas", "showFormulas", false], ["HideZero", "showZeros", true], ["HideGrid", "showGridLines", true], ["HideColHeader", "showRowColHeaders", true], ["DisplayOutlines", "showOutlineSymbols", false], ["RTL_Layout", "rightToLeft", false]])
137456
137475
  if (view2[gnm] !== void 0)
137457
137476
  viewAttrs[xlsx] = (invert ? !Number(view2[gnm]) : !!Number(view2[gnm])) ? 1 : 0;
137458
- const metadata3 = await writeXlsxSheetMetadata(sheet, index2 + 1, xml2, context, namespace5, exportXlsxFormula.bind(null, book), styles, charge);
137477
+ const metadata3 = await writeXlsxSheetMetadata(sheet, index2 + 1, xml2, context, namespace6, exportXlsxFormula.bind(null, book), styles, charge);
137459
137478
  let cols = "", nextColumn = 0;
137460
137479
  for (const c4 of [...sheet.columns ?? []].sort((a3, b3) => a3.index - b3.index)) {
137461
137480
  const importedColumn = metadataNode(c4.style?.gnumeric, charge);
@@ -137507,7 +137526,7 @@ function createXlsxWriter(edition) {
137507
137526
  tooltip: link.attributes.tip
137508
137527
  });
137509
137528
  }
137510
- const sheetXml = xml2("worksheet", { xmlns: namespace5, "xmlns:r": relationships, "xmlns:gnmx": "http://www.gnumeric.org/ext/spreadsheetml" }, metadata3.properties + xml2("dimension", { ref: dimension }) + xml2("sheetViews", {}, xml2("sheetView", viewAttrs, xml2("selection", { activeCell: "A1", sqref: "A1" }))) + metadata3.format + xml2("cols", {}, cols) + xml2("sheetData", {}, sheetData) + metadata3.protection + metadata3.filters + (sheet.merges?.length ? xml2("mergeCells", {}, sheet.merges.map((r) => xml2("mergeCell", { ref: rangeText(r) })).join("")) : "") + metadata3.rules + (hyperlinks ? xml2("hyperlinks", {}, hyperlinks) : "") + metadata3.print + (legacyDrawing ? xml2("legacyDrawing", { "r:id": legacyDrawing }) : ""));
137529
+ const sheetXml = xml2("worksheet", { xmlns: namespace6, "xmlns:r": relationships, "xmlns:gnmx": "http://www.gnumeric.org/ext/spreadsheetml" }, metadata3.properties + xml2("dimension", { ref: dimension }) + xml2("sheetViews", {}, xml2("sheetView", viewAttrs, xml2("selection", { activeCell: "A1", sqref: "A1" }))) + metadata3.format + xml2("cols", {}, cols) + xml2("sheetData", {}, sheetData) + metadata3.protection + metadata3.filters + (sheet.merges?.length ? xml2("mergeCells", {}, sheet.merges.map((r) => xml2("mergeCell", { ref: rangeText(r) })).join("")) : "") + metadata3.rules + (hyperlinks ? xml2("hyperlinks", {}, hyperlinks) : "") + metadata3.print + (legacyDrawing ? xml2("legacyDrawing", { "r:id": legacyDrawing }) : ""));
137511
137530
  const partName = `worksheets/sheet${index2 + 1}.xml`;
137512
137531
  await add5("xl/" + partName, sheetXml);
137513
137532
  if (rels.length)
@@ -137517,7 +137536,7 @@ function createXlsxWriter(edition) {
137517
137536
  sheetNodes.push(xml2("sheet", { name: sheet.name, sheetId: index2 + 1, "r:id": id }));
137518
137537
  }
137519
137538
  if (shared.length) {
137520
- await add5("xl/sharedStrings.xml", xml2("sst", { xmlns: namespace5, uniqueCount: shared.length, count: shared.length }, shared.map((cell) => xml2("si", {}, writeRichString(cell.value.kind === "string" ? cell.value.value : "", cell.richText, xml2, charge))).join("")), "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml");
137539
+ await add5("xl/sharedStrings.xml", xml2("sst", { xmlns: namespace6, uniqueCount: shared.length, count: shared.length }, shared.map((cell) => xml2("si", {}, writeRichString(cell.value.kind === "string" ? cell.value.value : "", cell.richText, xml2, charge))).join("")), "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml");
137521
137540
  workbookRelations.push({ id: `rId${workbookRelations.length + 1}`, type: relationships + "/sharedStrings", target: "sharedStrings.xml" });
137522
137541
  }
137523
137542
  await add5("xl/styles.xml", styles.serialize(), "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml");
@@ -137546,7 +137565,7 @@ function createXlsxWriter(edition) {
137546
137565
  if (!book.names?.some((n) => n.name === name && n.sheet === sheet.id))
137547
137566
  names2 += xml2("definedName", { name: "_xlnm." + name, localSheetId: index2 }, escapeXlsx(expression2));
137548
137567
  }
137549
- await add5("xl/workbook.xml", xml2("workbook", { xmlns: namespace5, "xmlns:r": relationships }, xml2("fileVersion", { lastEdited: 4, lowestEdited: 4, rupBuild: 3820 }) + xml2("workbookPr", { date1904: book.dateSystem === "1904" ? 1 : 0 }) + xml2("bookViews", {}, xml2("workbookView", { activeTab: active })) + xml2("sheets", {}, sheetNodes.join("")) + xml2("definedNames", {}, names2) + xml2("calcPr", {
137568
+ await add5("xl/workbook.xml", xml2("workbook", { xmlns: namespace6, "xmlns:r": relationships }, xml2("fileVersion", { lastEdited: 4, lowestEdited: 4, rupBuild: 3820 }) + xml2("workbookPr", { date1904: book.dateSystem === "1904" ? 1 : 0 }) + xml2("bookViews", {}, xml2("workbookView", { activeTab: active })) + xml2("sheets", {}, sheetNodes.join("")) + xml2("definedNames", {}, names2) + xml2("calcPr", {
137550
137569
  calcMode: book.calculationMode === "manual" ? "manual" : "auto",
137551
137570
  iterate: book.iteration?.enabled === false ? 0 : 1,
137552
137571
  iterateCount: book.iteration?.maximum ?? 100,
@@ -137687,8 +137706,8 @@ var xlsxFormat = {
137687
137706
  };
137688
137707
  var xl = "urn:schemas-microsoft-com:office:excel";
137689
137708
  var gnumeric = "http://www.gnumeric.org/v10.dtd";
137690
- function node(name, attributes4 = {}, children7 = []) {
137691
- return { name, namespace: gnumeric, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), text: "", children: children7 };
137709
+ function node(name, attributes4 = {}, children8 = []) {
137710
+ return { name, namespace: gnumeric, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), text: "", children: children8 };
137692
137711
  }
137693
137712
  function readSpreadsheetMLMetadata(worksheet, sheet, context, chargeWorkbookWork) {
137694
137713
  const result2 = [];
@@ -137992,10 +138011,10 @@ async function recognize2(root, context, positions, warnings) {
137992
138011
  async function visit(node3, parent, ancestors, inherited) {
137993
138012
  context.signal.throwIfAborted();
137994
138013
  const start = position++;
137995
- let namespace5 = inherited;
138014
+ let namespace6 = inherited;
137996
138015
  const defaultNamespace = node3.attributes.find((a3) => a3.name === "xmlns");
137997
138016
  if (defaultNamespace)
137998
- namespace5 = Object.keys(namespaces).find((key) => namespaces[key].includes(defaultNamespace.value)) ?? "";
138017
+ namespace6 = Object.keys(namespaces).find((key) => namespaces[key].includes(defaultNamespace.value)) ?? "";
137999
138018
  if (parent === "START" || parent === "WORKBOOK")
138000
138019
  for (const a3 of node3.attributes) {
138001
138020
  if (a3.namespace !== "http://www.w3.org/2000/xmlns/")
@@ -138003,7 +138022,7 @@ async function recognize2(root, context, positions, warnings) {
138003
138022
  const key = Object.keys(namespaces).find((key2) => namespaces[key2].includes(a3.value));
138004
138023
  if (a3.name === "xmlns") {
138005
138024
  if (key)
138006
- namespace5 = key;
138025
+ namespace6 = key;
138007
138026
  } else if (key) {
138008
138027
  if (!prefixes.has(a3.localName)) {
138009
138028
  prefixes.set(a3.localName, key);
@@ -138014,7 +138033,7 @@ async function recognize2(root, context, positions, warnings) {
138014
138033
  unknown.add(a3.localName);
138015
138034
  }
138016
138035
  const colon = node3.name.indexOf(":"), prefix = colon < 0 ? void 0 : node3.name.slice(0, colon);
138017
- const match3 = spreadsheetmlSchema.find((n) => n[0] === parent && n[3] === node3.localName && (prefix === void 0 ? n[2] === namespace5 : primary.get(n[2]) === prefix));
138036
+ const match3 = spreadsheetmlSchema.find((n) => n[0] === parent && n[3] === node3.localName && (prefix === void 0 ? n[2] === namespace6 : primary.get(n[2]) === prefix));
138018
138037
  if (!match3) {
138019
138038
  if (prefix === void 0 || !unknown.has(prefix)) {
138020
138039
  const message = `Unexpected element '${node3.name}' in state :
@@ -138026,7 +138045,7 @@ async function recognize2(root, context, positions, warnings) {
138026
138045
  }
138027
138046
  const accepted2 = [];
138028
138047
  for (const child7 of node3.children) {
138029
- const value3 = await visit(child7, match3[1], [...ancestors, node3.localName], namespace5);
138048
+ const value3 = await visit(child7, match3[1], [...ancestors, node3.localName], namespace6);
138030
138049
  if (value3)
138031
138050
  accepted2.push(value3);
138032
138051
  }
@@ -138044,8 +138063,8 @@ async function recognize2(root, context, positions, warnings) {
138044
138063
  }
138045
138064
  return visit(root, "START", [], "");
138046
138065
  }
138047
- function children4(node3, name, namespace5 = "SS") {
138048
- return node3?.children.filter((n) => n.localName === name && n.namespace === namespaces[namespace5][0]) ?? [];
138066
+ function children4(node3, name, namespace6 = "SS") {
138067
+ return node3?.children.filter((n) => n.localName === name && n.namespace === namespaces[namespace6][0]) ?? [];
138049
138068
  }
138050
138069
  function attr3(node3, name) {
138051
138070
  return node3?.attributes.find((a3) => a3.localName === name && a3.namespace === namespaces.SS[0])?.value;
@@ -138059,11 +138078,11 @@ function content(node3) {
138059
138078
  function styleMetadata(style2) {
138060
138079
  const attributes4 = [], nested = [];
138061
138080
  const color5 = (value3) => value3.startsWith("#") && value3.length === 7 ? [value3.slice(1, 3), value3.slice(3, 5), value3.slice(5, 7)].map((c4) => (parseInt(c4, 16) * 257).toString(16).toUpperCase()).join(":") : value3;
138062
- const node3 = (name, values2, children7 = [], text2 = "") => ({
138081
+ const node3 = (name, values2, children8 = [], text2 = "") => ({
138063
138082
  name,
138064
138083
  namespace: "http://www.gnumeric.org/v10.dtd",
138065
138084
  text: text2,
138066
- children: children7,
138085
+ children: children8,
138067
138086
  attributes: Object.entries(values2).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(name2 === "Color" ? color5(String(value3)) : value3) }))
138068
138087
  });
138069
138088
  const fullStyle = {
@@ -138480,23 +138499,23 @@ async function readSpreadsheetML(bytes, context) {
138480
138499
  charge();
138481
138500
  const origin = colIndex;
138482
138501
  let across = 0, down = 0, explicit;
138483
- for (const attribute6 of node3.attributes) {
138484
- if (attribute6.namespace !== namespaces.SS[0])
138502
+ for (const attribute7 of node3.attributes) {
138503
+ if (attribute7.namespace !== namespaces.SS[0])
138485
138504
  continue;
138486
- if (attribute6.localName === "Index") {
138505
+ if (attribute7.localName === "Index") {
138487
138506
  const index3 = await numeric4(node3, "Index", colIndex + 1, true, name, rowIndex, colIndex);
138488
138507
  if (index3 > 0)
138489
138508
  colIndex = index3 - 1;
138490
- } else if (attribute6.localName === "Formula") {
138491
- const result2 = await formula3(attribute6.value, name, rowIndex, origin, colIndex);
138509
+ } else if (attribute7.localName === "Formula") {
138510
+ const result2 = await formula3(attribute7.value, name, rowIndex, origin, colIndex);
138492
138511
  if (result2 !== void 0)
138493
138512
  pending = result2;
138494
- } else if (attribute6.localName === "MergeAcross")
138513
+ } else if (attribute7.localName === "MergeAcross")
138495
138514
  across = await numeric4(node3, "MergeAcross", 0, true, name, rowIndex, colIndex);
138496
- else if (attribute6.localName === "MergeDown")
138515
+ else if (attribute7.localName === "MergeDown")
138497
138516
  down = await numeric4(node3, "MergeDown", 0, true, name, rowIndex, colIndex);
138498
- else if (attribute6.localName === "StyleID")
138499
- explicit = styles.get(attribute6.value);
138517
+ else if (attribute7.localName === "StyleID")
138518
+ explicit = styles.get(attribute7.value);
138500
138519
  }
138501
138520
  if (rowIndex >= 1048576 || colIndex >= 16384)
138502
138521
  limit2("cell coordinates");
@@ -141049,20 +141068,20 @@ var EntityDecoder2 = class {
141049
141068
  };
141050
141069
  function getDecoder(decodeTree) {
141051
141070
  let ret = "";
141052
- const decoder = new EntityDecoder2(decodeTree, (str2) => ret += fromCodePoint2(str2));
141071
+ const decoder2 = new EntityDecoder2(decodeTree, (str2) => ret += fromCodePoint2(str2));
141053
141072
  return function decodeWithTrie(str2, decodeMode) {
141054
141073
  let lastIndex = 0;
141055
141074
  let offset = 0;
141056
141075
  while ((offset = str2.indexOf("&", offset)) >= 0) {
141057
141076
  ret += str2.slice(lastIndex, offset);
141058
- decoder.startEntity(decodeMode);
141059
- const len = decoder.write(
141077
+ decoder2.startEntity(decodeMode);
141078
+ const len = decoder2.write(
141060
141079
  str2,
141061
141080
  // Skip the "&"
141062
141081
  offset + 1
141063
141082
  );
141064
141083
  if (len < 0) {
141065
- lastIndex = offset + decoder.end();
141084
+ lastIndex = offset + decoder2.end();
141066
141085
  break;
141067
141086
  }
141068
141087
  lastIndex = offset + len;
@@ -142190,8 +142209,8 @@ function probeHtml(bytes, context) {
142190
142209
  return text2.includes("<table") || text2.includes("<html") || text2.includes("<!doctype html");
142191
142210
  }
142192
142211
  var namespace3 = "http://www.gnumeric.org/v10.dtd";
142193
- function record4(name, attributes4, children7 = [], text2 = "") {
142194
- return { name, namespace: namespace3, text: text2, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), children: children7 };
142212
+ function record4(name, attributes4, children8 = [], text2 = "") {
142213
+ return { name, namespace: namespace3, text: text2, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), children: children8 };
142195
142214
  }
142196
142215
  function span(source) {
142197
142216
  if (source === void 0)
@@ -142646,36 +142665,36 @@ function createHtmlWriter(profile) {
142646
142665
  tick();
142647
142666
  if (from < run.start || from >= run.end)
142648
142667
  continue;
142649
- for (const [key, attribute6] of Object.entries(run.attributes)) {
142668
+ for (const [key, attribute7] of Object.entries(run.attributes)) {
142650
142669
  tick();
142651
- attributes4.set(key, attribute6);
142670
+ attributes4.set(key, attribute7);
142652
142671
  }
142653
142672
  }
142654
- for (const [key, attribute6] of attributes4) {
142673
+ for (const [key, attribute7] of attributes4) {
142655
142674
  tick();
142656
142675
  let open = "", close = "";
142657
- if (key === "bold" && Number(attribute6)) {
142676
+ if (key === "bold" && Number(attribute7)) {
142658
142677
  open = "<b>";
142659
142678
  close = "</b>";
142660
142679
  }
142661
- if (key === "italic" && Number(attribute6)) {
142680
+ if (key === "italic" && Number(attribute7)) {
142662
142681
  open = "<i>";
142663
142682
  close = "</i>";
142664
142683
  }
142665
- if (key === "strikethrough" && Number(attribute6)) {
142684
+ if (key === "strikethrough" && Number(attribute7)) {
142666
142685
  open = profile.legacy ? "<strike>" : '<span style="text-decoration: line-through;">';
142667
142686
  close = profile.legacy ? "</strike>" : "</span>";
142668
142687
  }
142669
- if (key === "underline" && attribute6 !== "none") {
142670
- const value4 = String(attribute6);
142688
+ if (key === "underline" && attribute7 !== "none") {
142689
+ const value4 = String(attribute7);
142671
142690
  const name = Object.hasOwn(richUnderlineClasses, value4) ? richUnderlineClasses[value4] : void 0;
142672
142691
  if (name) {
142673
142692
  open = profile.legacy ? "<u>" : `<span class="${name}">`;
142674
142693
  close = profile.legacy ? "</u>" : "</span>";
142675
142694
  }
142676
142695
  }
142677
- if (key === "rise" && Math.abs(Number(attribute6)) > 5 || key === "subscript" && Number(attribute6) || key === "superscript" && Number(attribute6)) {
142678
- const sub = key === "subscript" || key === "rise" && Number(attribute6) < 0;
142696
+ if (key === "rise" && Math.abs(Number(attribute7)) > 5 || key === "subscript" && Number(attribute7) || key === "superscript" && Number(attribute7)) {
142697
+ const sub = key === "subscript" || key === "rise" && Number(attribute7) < 0;
142679
142698
  open = sub ? "<sub>" : "<sup>";
142680
142699
  close = sub ? "</sub>" : "</sup>";
142681
142700
  }
@@ -144668,7 +144687,7 @@ async function readLotusWorks(bytes, context, formula3, decodeLmbcs) {
144668
144687
  if (id === 21594) {
144669
144688
  const font2 = fonts[data3.u8(4)], align = data3.u8(1), style3 = {};
144670
144689
  if (font2) {
144671
- for (const [bit, attribute6] of [[1, "bold"], [2, "italic"], [4, "underline"], [8, "strike"]]) style3[attribute6] = !!(font2.variant & bit);
144690
+ for (const [bit, attribute7] of [[1, "bold"], [2, "italic"], [4, "underline"], [8, "strike"]]) style3[attribute7] = !!(font2.variant & bit);
144672
144691
  if (font2.size) style3.fontSize = font2.size / 2;
144673
144692
  if (font2.variant & 240) style3.fontColor = colors[font2.variant >> 4 & 15];
144674
144693
  style3.fontName = font2.name;
@@ -147543,13 +147562,13 @@ var lpsolve_default = {
147543
147562
  ],
147544
147563
  "source": "plugins/lpsolve/plugin.xml.in"
147545
147564
  };
147546
- function solverRecord(attributes4, children7 = []) {
147565
+ function solverRecord(attributes4, children8 = []) {
147547
147566
  return {
147548
147567
  name: "Solver",
147549
147568
  namespace: "http://www.gnumeric.org/v10.dtd",
147550
147569
  text: "",
147551
147570
  attributes: Object.entries(attributes4).map(([name, value3]) => ({ name, namespace: "", value: value3 })),
147552
- children: children7
147571
+ children: children8
147553
147572
  };
147554
147573
  }
147555
147574
  function constraintRecord(type, lhs, rhs) {
@@ -147749,12 +147768,12 @@ var mps_default = {
147749
147768
  "source": "plugins/mps/plugin.xml.in"
147750
147769
  };
147751
147770
  function sylkStyleNode(style2) {
147752
- function node3(name, attributes4, children7 = [], text2 = "") {
147771
+ function node3(name, attributes4, children8 = [], text2 = "") {
147753
147772
  return {
147754
147773
  name,
147755
147774
  namespace: "http://www.gnumeric.org/v10.dtd",
147756
147775
  text: text2,
147757
- children: children7,
147776
+ children: children8,
147758
147777
  attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) }))
147759
147778
  };
147760
147779
  }
@@ -149848,8 +149867,8 @@ function invalid4(message) {
149848
149867
  function unsupported4(message = "package") {
149849
149868
  throw new SsconvertError("unsupported-feature", `Unsupported ssconvert feature: encrypted OpenDocument ${message}`);
149850
149869
  }
149851
- function attribute3(node3, name, namespace5 = manifestNamespace) {
149852
- return node3?.attributes.find((a3) => a3.namespace === namespace5 && a3.localName === name)?.value;
149870
+ function attribute3(node3, name, namespace6 = manifestNamespace) {
149871
+ return node3?.attributes.find((a3) => a3.namespace === namespace6 && a3.localName === name)?.value;
149853
149872
  }
149854
149873
  function child5(node3, name, optional = false) {
149855
149874
  const found = node3.children.filter((c4) => c4.namespace === manifestNamespace && c4.localName === name);
@@ -150846,8 +150865,8 @@ var namespaces2 = {
150846
150865
  svg: [odfNamespaces.svg, "http://www.w3.org/2000/svg"],
150847
150866
  gnm: [odfNamespaces.gnm]
150848
150867
  };
150849
- function attribute4(node3, name, namespace5) {
150850
- return node3.attributes.find((a3) => a3.localName === name && namespaces2[namespace5].includes(a3.namespace))?.value;
150868
+ function attribute4(node3, name, namespace6) {
150869
+ return node3.attributes.find((a3) => a3.localName === name && namespaces2[namespace6].includes(a3.namespace))?.value;
150851
150870
  }
150852
150871
  function pointSize(source) {
150853
150872
  if (!source)
@@ -151039,11 +151058,11 @@ var ns = {
151039
151058
  xlink: ["http://www.w3.org/1999/xlink"],
151040
151059
  gnm: ["http://www.gnumeric.org/odf-extension/1.0"]
151041
151060
  };
151042
- function attr4(node3, name, namespace5) {
151043
- return node3?.attributes.find((a3) => a3.localName === name && ns[namespace5].includes(a3.namespace))?.value;
151061
+ function attr4(node3, name, namespace6) {
151062
+ return node3?.attributes.find((a3) => a3.localName === name && ns[namespace6].includes(a3.namespace))?.value;
151044
151063
  }
151045
- function gnode2(name, attributes4 = {}, children7 = [], text2 = "") {
151046
- return { name, namespace: "http://www.gnumeric.org/v10.dtd", attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), children: children7, text: text2 };
151064
+ function gnode2(name, attributes4 = {}, children8 = [], text2 = "") {
151065
+ return { name, namespace: "http://www.gnumeric.org/v10.dtd", attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), children: children8, text: text2 };
151047
151066
  }
151048
151067
  function object2(value3) {
151049
151068
  return value3 !== null && typeof value3 === "object" && !Array.isArray(value3) ? value3 : void 0;
@@ -151334,7 +151353,7 @@ function readOdfLabelRanges(parent, sheets, context, charge) {
151334
151353
  function invalid11() {
151335
151354
  throw new SsconvertError("io", "E Invalid OpenDocument: invalid label range");
151336
151355
  }
151337
- function attribute6(node3, name) {
151356
+ function attribute7(node3, name) {
151338
151357
  return node3.attributes.find((a3) => a3.localName === name && tableNamespaces.includes(a3.namespace))?.value;
151339
151358
  }
151340
151359
  function address(source) {
@@ -151369,11 +151388,11 @@ function readOdfLabelRanges(parent, sheets, context, charge) {
151369
151388
  charge();
151370
151389
  if (node3.localName !== "label-range" || !tableNamespaces.includes(node3.namespace))
151371
151390
  continue;
151372
- const axis = attribute6(node3, "orientation");
151391
+ const axis = attribute7(node3, "orientation");
151373
151392
  if (axis !== "row" && axis !== "column")
151374
151393
  invalid11();
151375
- const labels = address(attribute6(node3, "label-cell-range-address"));
151376
- const data3 = address(attribute6(node3, "data-cell-range-address"));
151394
+ const labels = address(attribute7(node3, "label-cell-range-address"));
151395
+ const data3 = address(attribute7(node3, "data-cell-range-address"));
151377
151396
  include(labels.sheet, labels.range);
151378
151397
  include(data3.sheet, data3.range);
151379
151398
  let pairs = ranges2.get(labels.sheet.id);
@@ -151811,8 +151830,8 @@ function createOdfStyleDefinitions(book, xml2) {
151811
151830
  continue;
151812
151831
  const attributes4 = node3.attributes.filter((value3) => {
151813
151832
  xml2.charge();
151814
- const attribute6 = odfObject(value3);
151815
- return attribute6?.namespace !== odfNamespaces.style || attribute6?.name !== "name";
151833
+ const attribute7 = odfObject(value3);
151834
+ return attribute7?.namespace !== odfNamespaces.style || attribute7?.name !== "name";
151816
151835
  });
151817
151836
  byShape.set(xml2.retained({ ...node3, attributes: attributes4 }), name);
151818
151837
  }
@@ -152251,13 +152270,13 @@ var odfWriterFunctionNames = Object.freeze({
152251
152270
  });
152252
152271
  async function writeOdfRegion(node3, r, id, sheet, xml2, styles, context, formula3, sheetNames) {
152253
152272
  const e = xml2.element, a3 = odfAttributes(node3), base = styles.register({ style: { gnumeric: node3 }, ...a3.Format ? { format: a3.Format } : {} });
152254
- const children7 = odfChildren(node3), baseAddress = quoteFormulaString(sheet.name, "'", odfGrammar) + "." + formatA1(r.startRow, r.startColumn);
152273
+ const children8 = odfChildren(node3), baseAddress = quoteFormulaString(sheet.name, "'", odfGrammar) + "." + formatA1(r.startRow, r.startColumn);
152255
152274
  function expression2(source, name) {
152256
152275
  const n = odfChildren(source).find((n2) => odfObject(n2)?.name === name), text2 = odfObject(n)?.text;
152257
152276
  return typeof text2 === "string" ? formula3(text2.startsWith("=") ? text2 : "=" + text2, sheet, r.startRow, r.startColumn).slice(4) : "";
152258
152277
  }
152259
152278
  let maps = "", validationXml = "";
152260
- for (const condition of children7.filter((n) => odfObject(n)?.name === "Condition")) {
152279
+ for (const condition of children8.filter((n) => odfObject(n)?.name === "Condition")) {
152261
152280
  xml2.charge();
152262
152281
  const a4 = odfAttributes(condition), op = Number(a4.Operator), overlay = odfChildren(condition).find((n) => odfObject(n)?.name === "Style");
152263
152282
  const first = expression2(condition, "Expression0"), last = expression2(condition, "Expression1");
@@ -152272,7 +152291,7 @@ async function writeOdfRegion(node3, r, id, sheet, xml2, styles, context, formul
152272
152291
  }
152273
152292
  const styleName = maps ? id + "c" : base.name;
152274
152293
  const styleXml = maps ? e("style:style", { "style:name": styleName, "style:family": "table-cell", "style:parent-style-name": base.name }, maps) : "";
152275
- const validation = children7.find((n) => odfObject(n)?.name === "Validation"), input = children7.find((n) => odfObject(n)?.name === "InputMessage");
152294
+ const validation = children8.find((n) => odfObject(n)?.name === "Validation"), input = children8.find((n) => odfObject(n)?.name === "InputMessage");
152276
152295
  let validationName;
152277
152296
  if (validation || input) {
152278
152297
  const a4 = odfAttributes(validation), type = (a4.Type ?? "GNM_VALIDATION_TYPE_ANY").slice("GNM_VALIDATION_TYPE_".length), op = (a4.Operator ?? "GNM_VALIDATION_OP_NONE").slice("GNM_VALIDATION_OP_".length);
@@ -152308,7 +152327,7 @@ async function writeOdfRegion(node3, r, id, sheet, xml2, styles, context, formul
152308
152327
  }, content2);
152309
152328
  }
152310
152329
  }
152311
- const link = children7.find((n) => odfObject(n)?.name === "HyperLink"), linkAttributes = odfAttributes(link);
152330
+ const link = children8.find((n) => odfObject(n)?.name === "HyperLink"), linkAttributes = odfAttributes(link);
152312
152331
  return { styleName, styleXml, validationName, validationXml, ...linkAttributes.target ? { link: {
152313
152332
  "xlink:href": linkAttributes.type === "GnmHLinkCurWB" ? translateOdfHyperlink(linkAttributes.target, "export", xml2.charge, sheetNames) : linkAttributes.target,
152314
152333
  "xlink:type": "simple",
@@ -153895,14 +153914,14 @@ function createOdfWriter(profile) {
153895
153914
  });
153896
153915
  }
153897
153916
  spreadsheet = prelude + (validations ? e("table:content-validations", {}, validations) : "") + spreadsheet + (labelRanges ? e("table:label-ranges", {}, labelRanges) : "") + names2() + databaseRanges;
153898
- const parts = /* @__PURE__ */ new Map(), encoder3 = new TextEncoder();
153917
+ const parts = /* @__PURE__ */ new Map(), encoder4 = new TextEncoder();
153899
153918
  if (wrapped)
153900
153919
  context.own(() => {
153901
153920
  for (const bytes of parts.values())
153902
153921
  bytes.fill(0);
153903
153922
  });
153904
153923
  function part(name, value3) {
153905
- parts.set(name, encoder3.encode(value3));
153924
+ parts.set(name, encoder4.encode(value3));
153906
153925
  }
153907
153926
  part("mimetype", "application/vnd.oasis.opendocument.spreadsheet");
153908
153927
  part("content.xml", xml2.document("office:document-content", e("office:scripts") + e("office:font-face-decls", {}, definitions3.render("fonts")) + e("office:automatic-styles", {}, definitions3.render("contentAutomatic") + automatic + cellStyles.styles.join("")) + e("office:body", {}, e("office:spreadsheet", {}, spreadsheet))));
@@ -154006,7 +154025,7 @@ function createOdfWriter(profile) {
154006
154025
  }, member.declaration));
154007
154026
  return await packageParts(/* @__PURE__ */ new Map([
154008
154027
  ["mimetype", mime],
154009
- ["META-INF/manifest.xml", encoder3.encode(manifest)],
154028
+ ["META-INF/manifest.xml", encoder4.encode(manifest)],
154010
154029
  ["encrypted-package", member.bytes]
154011
154030
  ]), encrypted);
154012
154031
  } finally {
@@ -155988,22 +156007,22 @@ function sheetObjects(sheet, context) {
155988
156007
  charge();
155989
156008
  if (!item || typeof item !== "object" || Array.isArray(item))
155990
156009
  continue;
155991
- const attribute6 = item;
155992
- if (typeof attribute6.name === "string" && typeof attribute6.namespace === "string" && typeof attribute6.value === "string") {
155993
- charge(attribute6.name.length + attribute6.namespace.length + attribute6.value.length);
155994
- if (attribute6.namespace === "")
155995
- attributes4[attribute6.name] = attribute6.value;
156010
+ const attribute7 = item;
156011
+ if (typeof attribute7.name === "string" && typeof attribute7.namespace === "string" && typeof attribute7.value === "string") {
156012
+ charge(attribute7.name.length + attribute7.namespace.length + attribute7.value.length);
156013
+ if (attribute7.namespace === "")
156014
+ attributes4[attribute7.name] = attribute7.value;
155996
156015
  else
155997
- qualifiedAttributes.push({ name: attribute6.name, namespace: attribute6.namespace, value: attribute6.value });
156016
+ qualifiedAttributes.push({ name: attribute7.name, namespace: attribute7.namespace, value: attribute7.value });
155998
156017
  }
155999
156018
  }
156000
- const children7 = [];
156019
+ const children8 = [];
156001
156020
  for (const child7 of Array.isArray(record7.children) ? record7.children : []) {
156002
156021
  const parsed = node3(child7, depth + 1);
156003
156022
  if (parsed)
156004
- children7.push(parsed);
156023
+ children8.push(parsed);
156005
156024
  }
156006
- return { name: record7.name, namespace: record7.namespace, text: record7.text, attributes: attributes4, qualifiedAttributes, children: children7 };
156025
+ return { name: record7.name, namespace: record7.namespace, text: record7.text, attributes: attributes4, qualifiedAttributes, children: children8 };
156007
156026
  };
156008
156027
  const style2 = (value3) => {
156009
156028
  if (!value3 || value3.namespace !== "")
@@ -156490,18 +156509,18 @@ function sheetPrintSettings(sheet, context) {
156490
156509
  const attributes4 = /* @__PURE__ */ Object.create(null);
156491
156510
  for (const value4 of Array.isArray(data3.attributes) ? data3.attributes : []) {
156492
156511
  tick();
156493
- const attribute6 = record7(value4);
156494
- if (attribute6?.namespace === "" && typeof attribute6.name === "string" && typeof attribute6.value === "string") {
156495
- tick(attribute6.name.length + attribute6.value.length);
156496
- attributes4[attribute6.name] = attribute6.value;
156512
+ const attribute7 = record7(value4);
156513
+ if (attribute7?.namespace === "" && typeof attribute7.name === "string" && typeof attribute7.value === "string") {
156514
+ tick(attribute7.name.length + attribute7.value.length);
156515
+ attributes4[attribute7.name] = attribute7.value;
156497
156516
  }
156498
156517
  }
156499
- const children7 = [];
156518
+ const children8 = [];
156500
156519
  for (const value4 of Array.isArray(data3.children) ? data3.children : []) {
156501
156520
  const child7 = project(value4, depth + 1);
156502
- if (child7) children7.push(child7);
156521
+ if (child7) children8.push(child7);
156503
156522
  }
156504
- return { name: data3.name, text: data3.text, attributes: attributes4, children: children7 };
156523
+ return { name: data3.name, text: data3.text, attributes: attributes4, children: children8 };
156505
156524
  };
156506
156525
  const margins = { top: 120, bottom: 120, left: 72, right: 72 };
156507
156526
  let firstPageNumber;
@@ -163047,12 +163066,12 @@ ${warnings.map((w) => ` W ${w}`).join("\n")}`);
163047
163066
  if (!Object.keys(style2).length) return cell;
163048
163067
  return { ...cell, ...typeof style2.Format === "string" ? { format: style2.Format } : {}, style: { ...style2, gnumeric: sylkStyleNode(style2) } };
163049
163068
  });
163050
- function node3(name, attributes4, children7 = []) {
163069
+ function node3(name, attributes4, children8 = []) {
163051
163070
  return {
163052
163071
  name,
163053
163072
  namespace: "http://www.gnumeric.org/v10.dtd",
163054
163073
  text: "",
163055
- children: children7,
163074
+ children: children8,
163056
163075
  attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) }))
163057
163076
  };
163058
163077
  }
@@ -163423,10 +163442,10 @@ function decodeText(bytes, encoding) {
163423
163442
  throw new RangeError("Invalid UCS-2");
163424
163443
  }
163425
163444
  }
163426
- const decoder = new TextDecoder(decoderLabel, { fatal: true });
163427
- if (decoder.encoding === "windows-1252" && bytes.some((b3) => [129, 141, 143, 144, 157].includes(b3)))
163445
+ const decoder2 = new TextDecoder(decoderLabel, { fatal: true });
163446
+ if (decoder2.encoding === "windows-1252" && bytes.some((b3) => [129, 141, 143, 144, 157].includes(b3)))
163428
163447
  continue;
163429
- return decoder.decode(bytes, { stream: true });
163448
+ return decoder2.decode(bytes, { stream: true });
163430
163449
  } catch {
163431
163450
  }
163432
163451
  }
@@ -163784,7 +163803,7 @@ function byteField(source, options, maximum, tick) {
163784
163803
  append([quote]);
163785
163804
  return Uint8Array.from(result2);
163786
163805
  }
163787
- function appendField(text2, options, append) {
163806
+ function appendTextField(text2, options, append) {
163788
163807
  const whitespace3 = (c4) => c4 !== void 0 && c4 !== "\v" && c4 !== "\uFEFF" && c4.trim() === "";
163789
163808
  const quoted = options.mode === "always" || options.mode === "auto" && (text2.includes(",") || text2.includes(" ") || text2.includes(" ") || text2.includes("\n") || text2.includes('"') || options.whitespace && (whitespace3(text2[0]) || whitespace3(text2.at(-1))));
163790
163809
  if (!quoted || !options.quote) {
@@ -163860,7 +163879,7 @@ async function exportText(args, options) {
163860
163879
  length += bytes.length;
163861
163880
  chunks.push(bytes);
163862
163881
  } else
163863
- appendField(cell ? await renderCellText(cell, book, renderingContext, options.format) : "", options, append);
163882
+ appendTextField(cell ? await renderCellText(cell, book, renderingContext, options.format) : "", options, append);
163864
163883
  }
163865
163884
  append(options.eol);
163866
163885
  }
@@ -165336,19 +165355,19 @@ function clipboardStyles(sheet, selection, defaults2, cellStyle, context) {
165336
165355
  if (!a3 || !b3) return patch;
165337
165356
  const attrs = /* @__PURE__ */ new Map();
165338
165357
  for (const source of [a3, b3]) for (const raw of Array.isArray(source.attributes) ? source.attributes : []) {
165339
- const attribute6 = object3(raw);
165340
- if (attribute6) attrs.set(`${String(attribute6.namespace)}:${String(attribute6.name)}`, raw);
165358
+ const attribute7 = object3(raw);
165359
+ if (attribute7) attrs.set(`${String(attribute7.namespace)}:${String(attribute7.name)}`, raw);
165341
165360
  }
165342
- const children7 = [...Array.isArray(a3.children) ? a3.children : []];
165361
+ const children8 = [...Array.isArray(a3.children) ? a3.children : []];
165343
165362
  for (const child7 of Array.isArray(b3.children) ? b3.children : []) {
165344
- const node3 = object3(child7), index2 = children7.findIndex((raw) => {
165363
+ const node3 = object3(child7), index2 = children8.findIndex((raw) => {
165345
165364
  const old = object3(raw);
165346
165365
  return old?.name === node3?.name && old?.namespace === node3?.namespace;
165347
165366
  });
165348
- if (index2 < 0) children7.push(child7);
165349
- else children7[index2] = merge(children7[index2], child7);
165367
+ if (index2 < 0) children8.push(child7);
165368
+ else children8[index2] = merge(children8[index2], child7);
165350
165369
  }
165351
- return { ...a3, ...b3, text: children7.length ? "" : b3.text || a3.text || "", attributes: [...attrs.values()], children: children7 };
165370
+ return { ...a3, ...b3, text: children8.length ? "" : b3.text || a3.text || "", attributes: [...attrs.values()], children: children8 };
165352
165371
  };
165353
165372
  let regions = [{ range: selection, style: merge(defaults2, {}) }];
165354
165373
  const apply = (range3, style2) => {
@@ -186935,7 +186954,7 @@ function compileCharString(charStringCode, cmds, font2, glyphId) {
186935
186954
  let x = 0, y = 0;
186936
186955
  let stems = 0;
186937
186956
  let firstPoint = null;
186938
- function parse2(code) {
186957
+ function parse3(code) {
186939
186958
  const view2 = new DataView(code.buffer, code.byteOffset, code.byteLength);
186940
186959
  let i = 0;
186941
186960
  while (i < code.length) {
@@ -187018,7 +187037,7 @@ function compileCharString(charStringCode, cmds, font2, glyphId) {
187018
187037
  subrCode = font2.subrs[n + font2.subrsBias];
187019
187038
  }
187020
187039
  if (subrCode) {
187021
- parse2(subrCode);
187040
+ parse3(subrCode);
187022
187041
  }
187023
187042
  break;
187024
187043
  case 11:
@@ -187217,7 +187236,7 @@ function compileCharString(charStringCode, cmds, font2, glyphId) {
187217
187236
  n = stack.pop() + font2.gsubrsBias;
187218
187237
  subrCode = font2.gsubrs[n];
187219
187238
  if (subrCode) {
187220
- parse2(subrCode);
187239
+ parse3(subrCode);
187221
187240
  }
187222
187241
  break;
187223
187242
  case 30:
@@ -187283,7 +187302,7 @@ function compileCharString(charStringCode, cmds, font2, glyphId) {
187283
187302
  }
187284
187303
  }
187285
187304
  }
187286
- parse2(charStringCode);
187305
+ parse3(charStringCode);
187287
187306
  }
187288
187307
  var Commands = class {
187289
187308
  cmds = [];
@@ -195955,22 +195974,22 @@ function decodeFlate(bytes, parms, maxDecodedBytes = DEFAULT_MAX_DECODED_BYTES)
195955
195974
  inflated = new BoundedFlateStream(bytes, maxDecodedBytes).getBytes();
195956
195975
  } catch (error2) {
195957
195976
  if (error2 instanceof PdfError2 && error2.code === "E_LIMIT") throw error2;
195958
- const decoder = new Inflate22({
195977
+ const decoder2 = new Inflate22({
195959
195978
  raw: !(bytes[0] === 31 && bytes[1] === 139),
195960
195979
  chunkSize: Math.max(1, Math.min(64 * 1024, maxDecodedBytes + 1))
195961
195980
  });
195962
195981
  let length = 0;
195963
- decoder.onData = (chunk) => {
195982
+ decoder2.onData = (chunk) => {
195964
195983
  length += chunk.length;
195965
195984
  if (length > maxDecodedBytes) {
195966
195985
  throw new PdfError2("E_LIMIT", "FlateDecode output exceeds maximum decoded byte budget");
195967
195986
  }
195968
- decoder.chunks.push(chunk);
195987
+ decoder2.chunks.push(chunk);
195969
195988
  };
195970
- if (!decoder.push(bytes, true) || decoder.err || !decoder.ended) {
195989
+ if (!decoder2.push(bytes, true) || decoder2.err || !decoder2.ended) {
195971
195990
  throw new PdfError2("E_CAPABILITY", "Invalid FlateDecode compressed stream");
195972
195991
  }
195973
- inflated = decoder.result;
195992
+ inflated = decoder2.result;
195974
195993
  }
195975
195994
  return applyPredictor(inflated, parms);
195976
195995
  }
@@ -200073,17 +200092,22 @@ function parseTrueTypeFont(bytes) {
200073
200092
  const cmapNumTables = cmap ? readU16(view2, cmapOffset + 2) : 0;
200074
200093
  let format4Offset = 0;
200075
200094
  let format12Offset = 0;
200095
+ let format4IsSymbolic = false;
200096
+ let format12IsSymbolic = false;
200076
200097
  for (let i = 0; i < cmapNumTables; i++) {
200077
200098
  const rec = cmapOffset + 4 + i * 8;
200078
200099
  if (rec + 8 > bytes.byteLength) break;
200079
200100
  const platformID = readU16(view2, rec);
200101
+ const encodingID = readU16(view2, rec + 2);
200080
200102
  const subOffset = cmapOffset + readU32(view2, rec + 4);
200081
200103
  if (subOffset + 4 > bytes.byteLength) continue;
200082
200104
  const fmt = readU16(view2, subOffset);
200083
200105
  if (fmt === 12 && (platformID === 3 || platformID === 0)) {
200084
200106
  format12Offset = subOffset;
200107
+ format12IsSymbolic = platformID === 3 && encodingID === 0;
200085
200108
  } else if (fmt === 4 && (platformID === 3 || platformID === 0)) {
200086
200109
  format4Offset = subOffset;
200110
+ format4IsSymbolic = platformID === 3 && encodingID === 0;
200087
200111
  }
200088
200112
  }
200089
200113
  if (format12Offset > 0) {
@@ -200372,6 +200396,7 @@ function parseTrueTypeFont(bytes) {
200372
200396
  numGlyphs,
200373
200397
  isCff: renderCffGlyph !== void 0,
200374
200398
  hasCmap: cmap !== void 0,
200399
+ isSymbolicCmap: format12Offset > 0 ? format12IsSymbolic : format4IsSymbolic,
200375
200400
  glyphNames,
200376
200401
  getGlyphId(codePoint) {
200377
200402
  return codePointToGlyph.get(codePoint) ?? 0;
@@ -202272,8 +202297,8 @@ var DecodingContext = class {
202272
202297
  this.end = end2;
202273
202298
  }
202274
202299
  get decoder() {
202275
- const decoder = new ArithmeticDecoder(this.data, this.start, this.end);
202276
- return util_shadow(this, "decoder", decoder);
202300
+ const decoder2 = new ArithmeticDecoder(this.data, this.start, this.end);
202301
+ return util_shadow(this, "decoder", decoder2);
202277
202302
  }
202278
202303
  get contextCache() {
202279
202304
  const cache = new ContextCache();
@@ -202282,13 +202307,13 @@ var DecodingContext = class {
202282
202307
  };
202283
202308
  var MAX_INT_322 = 2 ** 31 - 1;
202284
202309
  var MIN_INT_32 = -(2 ** 31);
202285
- function decodeInteger(contextCache, procedure, decoder) {
202310
+ function decodeInteger(contextCache, procedure, decoder2) {
202286
202311
  const contexts2 = contextCache.getContexts(procedure);
202287
202312
  let prev = 1;
202288
202313
  function readBits(length) {
202289
202314
  let v = 0;
202290
202315
  for (let i = 0; i < length; i++) {
202291
- const bit = decoder.readBit(contexts2, prev);
202316
+ const bit = decoder2.readBit(contexts2, prev);
202292
202317
  prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
202293
202318
  v = v << 1 | bit;
202294
202319
  }
@@ -202307,11 +202332,11 @@ function decodeInteger(contextCache, procedure, decoder) {
202307
202332
  }
202308
202333
  return null;
202309
202334
  }
202310
- function decodeIAID(contextCache, decoder, codeLength) {
202335
+ function decodeIAID(contextCache, decoder2, codeLength) {
202311
202336
  const contexts2 = contextCache.getContexts("IAID");
202312
202337
  let prev = 1;
202313
202338
  for (let i = 0; i < codeLength; i++) {
202314
- const bit = decoder.readBit(contexts2, prev);
202339
+ const bit = decoder2.readBit(contexts2, prev);
202315
202340
  prev = prev << 1 | bit;
202316
202341
  }
202317
202342
  if (codeLength < 31) {
@@ -202520,7 +202545,7 @@ var RefinementTemplates = [{
202520
202545
  var ReusedContexts = [39717, 1941, 229, 405];
202521
202546
  var RefinementReusedContexts = [32, 8];
202522
202547
  function decodeBitmapTemplate0(width2, height, decodingContext) {
202523
- const decoder = decodingContext.decoder;
202548
+ const decoder2 = decodingContext.decoder;
202524
202549
  const contexts2 = decodingContext.contextCache.getContexts("GB");
202525
202550
  const bitmap = [];
202526
202551
  let contextLabel, i, j, pixel, row, row1, row2;
@@ -202531,7 +202556,7 @@ function decodeBitmapTemplate0(width2, height, decodingContext) {
202531
202556
  row2 = i < 2 ? row : bitmap[i - 2];
202532
202557
  contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
202533
202558
  for (j = 0; j < width2; j++) {
202534
- row[j] = pixel = decoder.readBit(contexts2, contextLabel);
202559
+ row[j] = pixel = decoder2.readBit(contexts2, contextLabel);
202535
202560
  contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width2 ? row2[j + 3] << 11 : 0) | (j + 4 < width2 ? row1[j + 4] << 4 : 0) | pixel;
202536
202561
  }
202537
202562
  }
@@ -202585,12 +202610,12 @@ function decodeBitmap(mmr, width2, height, templateIndex, prediction, skip, at,
202585
202610
  const pseudoPixelContext = ReusedContexts[templateIndex];
202586
202611
  let row = new Uint8Array(width2);
202587
202612
  const bitmap = [];
202588
- const decoder = decodingContext.decoder;
202613
+ const decoder2 = decodingContext.decoder;
202589
202614
  const contexts2 = decodingContext.contextCache.getContexts("GB");
202590
202615
  let ltp = 0, j, i0, j0, contextLabel = 0, bit, shift;
202591
202616
  for (let i = 0; i < height; i++) {
202592
202617
  if (prediction) {
202593
- const sltp = decoder.readBit(contexts2, pseudoPixelContext);
202618
+ const sltp = decoder2.readBit(contexts2, pseudoPixelContext);
202594
202619
  ltp ^= sltp;
202595
202620
  if (ltp) {
202596
202621
  bitmap.push(row);
@@ -202631,7 +202656,7 @@ function decodeBitmap(mmr, width2, height, templateIndex, prediction, skip, at,
202631
202656
  }
202632
202657
  }
202633
202658
  }
202634
- const pixel = decoder.readBit(contexts2, contextLabel);
202659
+ const pixel = decoder2.readBit(contexts2, contextLabel);
202635
202660
  row[j] = pixel;
202636
202661
  }
202637
202662
  }
@@ -202666,12 +202691,12 @@ function decodeRefinement(width2, height, templateIndex, referenceBitmap, offset
202666
202691
  const referenceHeight = referenceBitmap.length;
202667
202692
  const pseudoPixelContext = RefinementReusedContexts[templateIndex];
202668
202693
  const bitmap = [];
202669
- const decoder = decodingContext.decoder;
202694
+ const decoder2 = decodingContext.decoder;
202670
202695
  const contexts2 = decodingContext.contextCache.getContexts("GR");
202671
202696
  let ltp = 0;
202672
202697
  for (let i = 0; i < height; i++) {
202673
202698
  if (prediction) {
202674
- const sltp = decoder.readBit(contexts2, pseudoPixelContext);
202699
+ const sltp = decoder2.readBit(contexts2, pseudoPixelContext);
202675
202700
  ltp ^= sltp;
202676
202701
  if (ltp) {
202677
202702
  throw new Jbig2Error("prediction is not supported");
@@ -202700,7 +202725,7 @@ function decodeRefinement(width2, height, templateIndex, referenceBitmap, offset
202700
202725
  contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
202701
202726
  }
202702
202727
  }
202703
- const pixel = decoder.readBit(contexts2, contextLabel);
202728
+ const pixel = decoder2.readBit(contexts2, contextLabel);
202704
202729
  row[j] = pixel;
202705
202730
  }
202706
202731
  }
@@ -202713,7 +202738,7 @@ function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols
202713
202738
  const newSymbols = [];
202714
202739
  let currentHeight = 0;
202715
202740
  let symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
202716
- const decoder = decodingContext.decoder;
202741
+ const decoder2 = decodingContext.decoder;
202717
202742
  const contextCache = decodingContext.contextCache;
202718
202743
  let tableB1, symbolWidths;
202719
202744
  if (huffman) {
@@ -202722,12 +202747,12 @@ function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols
202722
202747
  symbolCodeLength = Math.max(symbolCodeLength, 1);
202723
202748
  }
202724
202749
  while (newSymbols.length < numberOfNewSymbols) {
202725
- const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
202750
+ const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder2);
202726
202751
  currentHeight += deltaHeight;
202727
202752
  let currentWidth = 0, totalWidth = 0;
202728
202753
  const firstSymbol = huffman ? symbolWidths.length : 0;
202729
202754
  while (true) {
202730
- const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
202755
+ const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder2);
202731
202756
  if (deltaWidth === null) {
202732
202757
  break;
202733
202758
  }
@@ -202735,13 +202760,13 @@ function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols
202735
202760
  totalWidth += currentWidth;
202736
202761
  let bitmap;
202737
202762
  if (refinement) {
202738
- const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
202763
+ const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder2);
202739
202764
  if (numberOfInstances > 1) {
202740
202765
  bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
202741
202766
  } else {
202742
- const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
202743
- const rdx = decodeInteger(contextCache, "IARDX", decoder);
202744
- const rdy = decodeInteger(contextCache, "IARDY", decoder);
202767
+ const symbolId = decodeIAID(contextCache, decoder2, symbolCodeLength);
202768
+ const rdx = decodeInteger(contextCache, "IARDX", decoder2);
202769
+ const rdy = decodeInteger(contextCache, "IARDY", decoder2);
202745
202770
  const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
202746
202771
  bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
202747
202772
  }
@@ -202789,7 +202814,7 @@ function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols
202789
202814
  let currentFlag = false, i, ii;
202790
202815
  const totalSymbolsLength = symbols.length + numberOfNewSymbols;
202791
202816
  while (flags.length < totalSymbolsLength) {
202792
- let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
202817
+ let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder2);
202793
202818
  while (runLength--) {
202794
202819
  flags.push(currentFlag);
202795
202820
  }
@@ -202823,33 +202848,33 @@ function decodeTextRegion(huffman, refinement, width2, height, defaultPixelValue
202823
202848
  }
202824
202849
  bitmap.push(row);
202825
202850
  }
202826
- const decoder = decodingContext.decoder;
202851
+ const decoder2 = decodingContext.decoder;
202827
202852
  const contextCache = decodingContext.contextCache;
202828
- let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
202853
+ let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder2);
202829
202854
  let firstS = 0;
202830
202855
  i = 0;
202831
202856
  while (i < numberOfSymbolInstances) {
202832
- const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
202857
+ const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder2);
202833
202858
  stripT += deltaT;
202834
- const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
202859
+ const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder2);
202835
202860
  firstS += deltaFirstS;
202836
202861
  let currentS = firstS;
202837
202862
  do {
202838
202863
  let currentT = 0;
202839
202864
  if (stripSize > 1) {
202840
- currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
202865
+ currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder2);
202841
202866
  }
202842
202867
  const t = stripSize * stripT + currentT;
202843
- const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
202844
- const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
202868
+ const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder2, symbolCodeLength);
202869
+ const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder2));
202845
202870
  let symbolBitmap = inputSymbols[symbolId];
202846
202871
  let symbolWidth = symbolBitmap[0].length;
202847
202872
  let symbolHeight = symbolBitmap.length;
202848
202873
  if (applyRefinement) {
202849
- const rdw = decodeInteger(contextCache, "IARDW", decoder);
202850
- const rdh = decodeInteger(contextCache, "IARDH", decoder);
202851
- const rdx = decodeInteger(contextCache, "IARDX", decoder);
202852
- const rdy = decodeInteger(contextCache, "IARDY", decoder);
202874
+ const rdw = decodeInteger(contextCache, "IARDW", decoder2);
202875
+ const rdh = decodeInteger(contextCache, "IARDH", decoder2);
202876
+ const rdx = decodeInteger(contextCache, "IARDX", decoder2);
202877
+ const rdy = decodeInteger(contextCache, "IARDY", decoder2);
202853
202878
  symbolWidth += rdw;
202854
202879
  symbolHeight += rdh;
202855
202880
  symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
@@ -202916,7 +202941,7 @@ function decodeTextRegion(huffman, refinement, width2, height, defaultPixelValue
202916
202941
  }
202917
202942
  }
202918
202943
  i++;
202919
- const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
202944
+ const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder2);
202920
202945
  if (deltaS === null) {
202921
202946
  break;
202922
202947
  }
@@ -203971,7 +203996,7 @@ function decodeMMRBitmap(input, width2, height, endOfBlock) {
203971
203996
  BlackIs1: true,
203972
203997
  EndOfBlock: endOfBlock
203973
203998
  };
203974
- const decoder = new CCITTFaxDecoder(input, params);
203999
+ const decoder2 = new CCITTFaxDecoder(input, params);
203975
204000
  const bitmap = [];
203976
204001
  let currentByte, eof = false;
203977
204002
  for (let y = 0; y < height; y++) {
@@ -203980,7 +204005,7 @@ function decodeMMRBitmap(input, width2, height, endOfBlock) {
203980
204005
  let shift = -1;
203981
204006
  for (let x = 0; x < width2; x++) {
203982
204007
  if (shift < 0) {
203983
- currentByte = decoder.readNextChar();
204008
+ currentByte = decoder2.readNextChar();
203984
204009
  if (currentByte === -1) {
203985
204010
  currentByte = 0;
203986
204011
  eof = true;
@@ -203994,7 +204019,7 @@ function decodeMMRBitmap(input, width2, height, endOfBlock) {
203994
204019
  if (endOfBlock && !eof) {
203995
204020
  const lookForEOFLimit = 5;
203996
204021
  for (let i = 0; i < lookForEOFLimit; i++) {
203997
- if (decoder.readNextChar() === -1) {
204022
+ if (decoder2.readNextChar() === -1) {
203998
204023
  break;
203999
204024
  }
204000
204025
  }
@@ -206198,8 +206223,8 @@ function copyCoefficients(coefficients2, levelWidth, levelHeight, subband, delta
206198
206223
  encodedData.set(chunk, position);
206199
206224
  position += chunk.length;
206200
206225
  }
206201
- const decoder = new ArithmeticDecoder(encodedData, 0, totalLength);
206202
- bitModel.setDecoder(decoder);
206226
+ const decoder2 = new ArithmeticDecoder(encodedData, 0, totalLength);
206227
+ bitModel.setDecoder(decoder2);
206203
206228
  for (j = 0; j < codingpasses; j++) {
206204
206229
  switch (currentCodingpassType) {
206205
206230
  case 0:
@@ -206550,8 +206575,8 @@ var BitModel = class _BitModel {
206550
206575
  this.bitsDecoded = bitsDecoded;
206551
206576
  this.reset();
206552
206577
  }
206553
- setDecoder(decoder) {
206554
- this.decoder = decoder;
206578
+ setDecoder(decoder2) {
206579
+ this.decoder = decoder2;
206555
206580
  }
206556
206581
  reset() {
206557
206582
  this.contexts = new Int8Array(19);
@@ -206594,7 +206619,7 @@ var BitModel = class _BitModel {
206594
206619
  neighborsSignificance[index2] |= 128;
206595
206620
  }
206596
206621
  runSignificancePropagationPass() {
206597
- const decoder = this.decoder;
206622
+ const decoder2 = this.decoder;
206598
206623
  const width2 = this.width, height = this.height;
206599
206624
  const coefficentsMagnitude = this.coefficentsMagnitude;
206600
206625
  const coefficentsSign = this.coefficentsSign;
@@ -206619,7 +206644,7 @@ var BitModel = class _BitModel {
206619
206644
  continue;
206620
206645
  }
206621
206646
  const contextLabel = labels[neighborsSignificance[index2]];
206622
- const decision = decoder.readBit(contexts2, contextLabel);
206647
+ const decision = decoder2.readBit(contexts2, contextLabel);
206623
206648
  if (decision) {
206624
206649
  const sign = this.decodeSignBit(i, j, index2);
206625
206650
  coefficentsSign[index2] = sign;
@@ -206680,7 +206705,7 @@ var BitModel = class _BitModel {
206680
206705
  return decoded;
206681
206706
  }
206682
206707
  runMagnitudeRefinementPass() {
206683
- const decoder = this.decoder;
206708
+ const decoder2 = this.decoder;
206684
206709
  const width2 = this.width, height = this.height;
206685
206710
  const coefficentsMagnitude = this.coefficentsMagnitude;
206686
206711
  const neighborsSignificance = this.neighborsSignificance;
@@ -206704,7 +206729,7 @@ var BitModel = class _BitModel {
206704
206729
  const significance = neighborsSignificance[index2] & 127;
206705
206730
  contextLabel = significance === 0 ? 15 : 14;
206706
206731
  }
206707
- const bit = decoder.readBit(contexts2, contextLabel);
206732
+ const bit = decoder2.readBit(contexts2, contextLabel);
206708
206733
  coefficentsMagnitude[index2] = coefficentsMagnitude[index2] << 1 | bit;
206709
206734
  bitsDecoded[index2]++;
206710
206735
  processingFlags[index2] |= processedMask;
@@ -206713,7 +206738,7 @@ var BitModel = class _BitModel {
206713
206738
  }
206714
206739
  }
206715
206740
  runCleanupPass() {
206716
- const decoder = this.decoder;
206741
+ const decoder2 = this.decoder;
206717
206742
  const width2 = this.width, height = this.height;
206718
206743
  const neighborsSignificance = this.neighborsSignificance;
206719
206744
  const coefficentsMagnitude = this.coefficentsMagnitude;
@@ -206738,7 +206763,7 @@ var BitModel = class _BitModel {
206738
206763
  let i1 = 0, index2 = index0;
206739
206764
  let i = i0, sign;
206740
206765
  if (allEmpty) {
206741
- const hasSignificantCoefficent = decoder.readBit(contexts2, _BitModel.RUNLENGTH_CONTEXT);
206766
+ const hasSignificantCoefficent = decoder2.readBit(contexts2, _BitModel.RUNLENGTH_CONTEXT);
206742
206767
  if (!hasSignificantCoefficent) {
206743
206768
  bitsDecoded[index0]++;
206744
206769
  bitsDecoded[index0 + oneRowDown]++;
@@ -206746,7 +206771,7 @@ var BitModel = class _BitModel {
206746
206771
  bitsDecoded[index0 + threeRowsDown]++;
206747
206772
  continue;
206748
206773
  }
206749
- i1 = decoder.readBit(contexts2, _BitModel.UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts2, _BitModel.UNIFORM_CONTEXT);
206774
+ i1 = decoder2.readBit(contexts2, _BitModel.UNIFORM_CONTEXT) << 1 | decoder2.readBit(contexts2, _BitModel.UNIFORM_CONTEXT);
206750
206775
  if (i1 !== 0) {
206751
206776
  i = i0 + i1;
206752
206777
  index2 += i1 * width2;
@@ -206767,7 +206792,7 @@ var BitModel = class _BitModel {
206767
206792
  continue;
206768
206793
  }
206769
206794
  const contextLabel = labels[neighborsSignificance[index2]];
206770
- const decision = decoder.readBit(contexts2, contextLabel);
206795
+ const decision = decoder2.readBit(contexts2, contextLabel);
206771
206796
  if (decision === 1) {
206772
206797
  sign = this.decodeSignBit(i, j, index2);
206773
206798
  coefficentsSign[index2] = sign;
@@ -206781,9 +206806,9 @@ var BitModel = class _BitModel {
206781
206806
  }
206782
206807
  }
206783
206808
  checkSegmentationSymbol() {
206784
- const decoder = this.decoder;
206809
+ const decoder2 = this.decoder;
206785
206810
  const contexts2 = this.contexts;
206786
- const symbol = decoder.readBit(contexts2, _BitModel.UNIFORM_CONTEXT) << 3 | decoder.readBit(contexts2, _BitModel.UNIFORM_CONTEXT) << 2 | decoder.readBit(contexts2, _BitModel.UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts2, _BitModel.UNIFORM_CONTEXT);
206811
+ const symbol = decoder2.readBit(contexts2, _BitModel.UNIFORM_CONTEXT) << 3 | decoder2.readBit(contexts2, _BitModel.UNIFORM_CONTEXT) << 2 | decoder2.readBit(contexts2, _BitModel.UNIFORM_CONTEXT) << 1 | decoder2.readBit(contexts2, _BitModel.UNIFORM_CONTEXT);
206787
206812
  if (symbol !== 10) {
206788
206813
  throw new JpxError("Invalid segmentation symbol");
206789
206814
  }
@@ -207179,21 +207204,21 @@ function extractRawJpegFromStream(doc, stream, filters) {
207179
207204
  function decodeJpegToRgba(jpegBytes, fallbackWidth = 1, fallbackHeight = 1, maxDecodedBytes = Infinity, options = {}) {
207180
207205
  assertDecodedByteBudget(fallbackWidth * fallbackHeight * 4, maxDecodedBytes);
207181
207206
  const decodeTransform = options.decode ? Int32Array.from(options.decode.flatMap(([low, high]) => [(high - low) * 256, low * 255])) : void 0;
207182
- const decoder = new __webpack_exports__JpegImage({
207207
+ const decoder2 = new __webpack_exports__JpegImage({
207183
207208
  colorTransform: options.colorTransform,
207184
207209
  decodeTransform,
207185
207210
  onImageDimensions: (width22, height2) => assertDecodedByteBudget(width22 * height2 * 4, maxDecodedBytes)
207186
207211
  });
207187
207212
  let start = 0;
207188
207213
  while (start + 1 < jpegBytes.length && !(jpegBytes[start] === 255 && jpegBytes[start + 1] === 216)) start++;
207189
- decoder.parse(jpegBytes.subarray(start));
207190
- const { width: width2, height, numComponents: components22 } = decoder;
207214
+ decoder2.parse(jpegBytes.subarray(start));
207215
+ const { width: width2, height, numComponents: components22 } = decoder2;
207191
207216
  if (!Number.isSafeInteger(width2) || !Number.isSafeInteger(height) || width2 <= 0 || height <= 0) {
207192
207217
  throw new PdfError2("E_PARSE", "Invalid JPEG image dimensions");
207193
207218
  }
207194
207219
  if (![1, 3, 4].includes(components22)) throw new PdfError2("E_CAPABILITY", "Unsupported JPEG component count");
207195
207220
  assertDecodedByteBudget(width2 * height * 4, maxDecodedBytes);
207196
- const rgb22 = decoder.getData({ width: width2, height, forceRGB: true, isSourcePDF: options.isSourcePdf ?? false });
207221
+ const rgb22 = decoder2.getData({ width: width2, height, forceRGB: true, isSourcePDF: options.isSourcePdf ?? false });
207197
207222
  if (rgb22.length !== width2 * height * 3) throw new PdfError2("E_PARSE", "Invalid decoded JPEG sample count");
207198
207223
  const rgba = new Uint8Array(width2 * height * 4);
207199
207224
  for (let p2 = 0; p2 < width2 * height; p2++) {
@@ -207207,19 +207232,19 @@ function decodeJpegToRgba(jpegBytes, fallbackWidth = 1, fallbackHeight = 1, maxD
207207
207232
  function decodeJbig2ToRgba(jbig2Bytes, fallbackWidth = 1, fallbackHeight = 1, globals, maxDecodedBytes = Infinity) {
207208
207233
  if (jbig2Bytes.length < 11) throw new PdfError2("E_PARSE", "Invalid JBIG2 stream");
207209
207234
  assertDecodedByteBudget(fallbackWidth * fallbackHeight * 4, maxDecodedBytes);
207210
- const decoder = new __webpack_exports__Jbig2Image((width22, height2) => assertDecodedByteBudget(width22 * height2 * 4, maxDecodedBytes));
207235
+ const decoder2 = new __webpack_exports__Jbig2Image((width22, height2) => assertDecodedByteBudget(width22 * height2 * 4, maxDecodedBytes));
207211
207236
  const signature2 = [151, 74, 66, 50, 13, 10, 26, 10];
207212
207237
  const standalone = signature2.every((byte, i) => jbig2Bytes[i] === byte);
207213
207238
  let width2 = fallbackWidth, height = fallbackHeight;
207214
207239
  let pixels;
207215
207240
  if (standalone) {
207216
- pixels = decoder.parse(jbig2Bytes);
207217
- width2 = decoder.width;
207218
- height = decoder.height;
207241
+ pixels = decoder2.parse(jbig2Bytes);
207242
+ width2 = decoder2.width;
207243
+ height = decoder2.height;
207219
207244
  } else {
207220
207245
  const chunks = globals ? [{ data: globals, start: 0, end: globals.length }] : [];
207221
207246
  chunks.push({ data: jbig2Bytes, start: 0, end: jbig2Bytes.length });
207222
- const decoded = decoder.parseChunks(chunks);
207247
+ const decoded = decoder2.parseChunks(chunks);
207223
207248
  if (!decoded) throw new PdfError2("E_PARSE", "JBIG2 stream has no page bitmap");
207224
207249
  pixels = decoded;
207225
207250
  }
@@ -207237,10 +207262,10 @@ function decodeJbig2ToRgba(jbig2Bytes, fallbackWidth = 1, fallbackHeight = 1, gl
207237
207262
  return rgba;
207238
207263
  }
207239
207264
  function decodeJpxSamples(bytes, maxDecodedBytes = Infinity) {
207240
- const decoder = new __webpack_exports__JpxImage((width22, height2) => assertDecodedByteBudget(width22 * height2 * 4, maxDecodedBytes));
207241
- decoder.failOnCorruptedImage = true;
207242
- decoder.parse(bytes);
207243
- const { width: width2, height, componentsCount: components22, tiles } = decoder;
207265
+ const decoder2 = new __webpack_exports__JpxImage((width22, height2) => assertDecodedByteBudget(width22 * height2 * 4, maxDecodedBytes));
207266
+ decoder2.failOnCorruptedImage = true;
207267
+ decoder2.parse(bytes);
207268
+ const { width: width2, height, componentsCount: components22, tiles } = decoder2;
207244
207269
  if (!Number.isSafeInteger(width2) || !Number.isSafeInteger(height) || width2 <= 0 || height <= 0 || !Number.isSafeInteger(components22) || components22 <= 0 || !tiles?.length) {
207245
207270
  throw new PdfError2("E_PARSE", "JPEG 2000 stream has no valid image");
207246
207271
  }
@@ -207956,7 +207981,13 @@ function resolvePageFonts(doc, resourcesDict) {
207956
207981
  embeddedCff = parseEmbeddedCffFont(doc.decodeStream(program), baseEncoding?.kind === "name" ? baseEncoding.decoded : void 0, glyphNames);
207957
207982
  } else {
207958
207983
  embeddedTrueType = parseTrueTypeFont(doc.decodeStream(program));
207959
- if (subtype !== "Type0" && !embeddedTrueType.hasCmap) {
207984
+ if (subtype !== "Type0" && embeddedTrueType.isSymbolicCmap) {
207985
+ simpleToGid = /* @__PURE__ */ new Map();
207986
+ for (let code = 0; code < 256; code++) {
207987
+ const gid = embeddedTrueType.getGlyphId(61440 + code) || embeddedTrueType.getGlyphId(code);
207988
+ if (gid > 0) simpleToGid.set(code, gid);
207989
+ }
207990
+ } else if (subtype !== "Type0" && !embeddedTrueType.hasCmap) {
207960
207991
  simpleToGid = /* @__PURE__ */ new Map();
207961
207992
  const encoding = baseEncoding?.kind === "name" ? getEncoding(baseEncoding.decoded) : void 0;
207962
207993
  for (let code = 0; code < 256; code++) {
@@ -223698,13 +223729,13 @@ function* parseXmlSteps6(input, limits = {}) {
223698
223729
  break;
223699
223730
  if (ws === 0)
223700
223731
  invalid9("attributes require whitespace");
223701
- const [attribute6, attrPrefix, attrLocal, wAttr] = scanName();
223732
+ const [attribute7, attrPrefix, attrLocal, wAttr] = scanName();
223702
223733
  pendingWork += wAttr;
223703
223734
  while (pendingWork >= 512) {
223704
223735
  yield 512;
223705
223736
  pendingWork -= 512;
223706
223737
  }
223707
- if (attributes4?.has(attribute6))
223738
+ if (attributes4?.has(attribute7))
223708
223739
  invalid9("duplicate attribute");
223709
223740
  if (++attributeCount > maxAttributes)
223710
223741
  throw new XmlLimitError4("maxAttributes", "XML attribute limit exceeded");
@@ -223741,11 +223772,11 @@ function* parseXmlSteps6(input, limits = {}) {
223741
223772
  pendingWork -= 512;
223742
223773
  }
223743
223774
  admitText(value3);
223744
- (attributes4 ??= /* @__PURE__ */ new Map()).set(attribute6, value3);
223745
- attrMeta.push([attribute6, attrPrefix, attrLocal]);
223775
+ (attributes4 ??= /* @__PURE__ */ new Map()).set(attribute7, value3);
223776
+ attrMeta.push([attribute7, attrPrefix, attrLocal]);
223746
223777
  offset = end2 + 1;
223747
- if (attribute6 === "xmlns" || attribute6.startsWith("xmlns:")) {
223748
- const nsPrefix = attribute6 === "xmlns" ? "" : attribute6.slice(6);
223778
+ if (attribute7 === "xmlns" || attribute7.startsWith("xmlns:")) {
223779
+ const nsPrefix = attribute7 === "xmlns" ? "" : attribute7.slice(6);
223749
223780
  if (nsPrefix === "xmlns" || value3 === xmlnsNamespace || nsPrefix === "xml" !== (value3 === xmlNamespace) || nsPrefix !== "" && value3 === "")
223750
223781
  invalid9("invalid namespace binding");
223751
223782
  if (!ownsNamespaces) {
@@ -223765,10 +223796,10 @@ function* parseXmlSteps6(input, limits = {}) {
223765
223796
  if (attrMeta.length > 0) {
223766
223797
  const expanded = attrMeta.length > 1 ? /* @__PURE__ */ new Set() : void 0;
223767
223798
  for (let i = 0; i < attrMeta.length; i++) {
223768
- const [attribute6, attrPrefix, attrLocal] = attrMeta[i];
223769
- if (attribute6 === "xmlns" || attribute6.startsWith("xmlns:"))
223799
+ const [attribute7, attrPrefix, attrLocal] = attrMeta[i];
223800
+ if (attribute7 === "xmlns" || attribute7.startsWith("xmlns:"))
223770
223801
  continue;
223771
- pendingWork += attribute6.length;
223802
+ pendingWork += attribute7.length;
223772
223803
  if (attrPrefix && !namespaces5.has(attrPrefix))
223773
223804
  invalid9("unbound attribute prefix");
223774
223805
  if (expanded) {
@@ -223790,22 +223821,22 @@ function* parseXmlSteps6(input, limits = {}) {
223790
223821
  throw new XmlLimitError4("maxNodes", "XML resource limit exceeded");
223791
223822
  if (stack.length + 1 > maxDepth)
223792
223823
  throw new XmlLimitError4("maxDepth", "XML resource limit exceeded");
223793
- const namespace5 = namespaces5.get(prefix) ?? "";
223794
- limits.onElement?.({ name, namespace: namespace5, localName }, stack.at(-1)?.element, stack.length + 1);
223824
+ const namespace6 = namespaces5.get(prefix) ?? "";
223825
+ limits.onElement?.({ name, namespace: namespace6, localName }, stack.at(-1)?.element, stack.length + 1);
223795
223826
  admitContent();
223796
223827
  const retainedAttributes = [];
223797
223828
  if (retainContent && attributes4) {
223798
223829
  for (let i = 0; i < attrMeta.length; i++) {
223799
- const [attribute6, attrPrefix, attrLocal] = attrMeta[i];
223800
- const value3 = attributes4.get(attribute6);
223830
+ const [attribute7, attrPrefix, attrLocal] = attrMeta[i];
223831
+ const value3 = attributes4.get(attribute7);
223801
223832
  admitContent();
223802
223833
  retainedAttributes.push({
223803
- name: attribute6,
223834
+ name: attribute7,
223804
223835
  localName: attrLocal,
223805
- namespace: attribute6 === "xmlns" || attrPrefix === "xmlns" ? xmlnsNamespace : attrPrefix ? namespaces5.get(attrPrefix) : "",
223836
+ namespace: attribute7 === "xmlns" || attrPrefix === "xmlns" ? xmlnsNamespace : attrPrefix ? namespaces5.get(attrPrefix) : "",
223806
223837
  value: value3
223807
223838
  });
223808
- pendingWork += attribute6.length + 1;
223839
+ pendingWork += attribute7.length + 1;
223809
223840
  }
223810
223841
  }
223811
223842
  while (pendingWork >= 512) {
@@ -223813,7 +223844,7 @@ function* parseXmlSteps6(input, limits = {}) {
223813
223844
  pendingWork -= 512;
223814
223845
  }
223815
223846
  const content2 = retainContent ? [] : void 0;
223816
- const element2 = { kind: "element", name, namespace: namespace5, localName, children: [], text: "", content: content2 ?? emptyContent, attributes: retainContent ? retainedAttributes : emptyAttributes, namespaces: retainContent ? namespaces5 : emptyNamespaces, ...root === void 0 && retainContent ? { prolog, epilog, ...declaration === void 0 ? {} : { declaration } } : {} };
223847
+ const element2 = { kind: "element", name, namespace: namespace6, localName, children: [], text: "", content: content2 ?? emptyContent, attributes: retainContent ? retainedAttributes : emptyAttributes, namespaces: retainContent ? namespaces5 : emptyNamespaces, ...root === void 0 && retainContent ? { prolog, epilog, ...declaration === void 0 ? {} : { declaration } } : {} };
223817
223848
  const parent = stack.at(-1);
223818
223849
  if (parent) {
223819
223850
  parent.element.children.push(element2);
@@ -223877,10 +223908,10 @@ function davChildren(element2, localName) {
223877
223908
  return element2.children.filter((child7) => child7.namespace === "DAV:" && child7.localName === localName);
223878
223909
  }
223879
223910
  function davChild(element2, localName) {
223880
- const children7 = davChildren(element2, localName);
223881
- if (children7.length > 1)
223911
+ const children8 = davChildren(element2, localName);
223912
+ if (children8.length > 1)
223882
223913
  invalid22(`duplicate DAV:${localName}`);
223883
- return children7[0];
223914
+ return children8[0];
223884
223915
  }
223885
223916
  function scalar(element2) {
223886
223917
  if (element2.children.length)
@@ -224669,7 +224700,7 @@ var WebDavFileSystem = class {
224669
224700
  if (response.status !== 207)
224670
224701
  this.httpError(response.status, "PROPFIND", path2);
224671
224702
  const result2 = /* @__PURE__ */ new Map();
224672
- let children7 = 0;
224703
+ let children8 = 0;
224673
224704
  for (const element2 of await this.multistatus(response, signal)) {
224674
224705
  signal.throwIfAborted();
224675
224706
  const href = davChild(element2, "href");
@@ -224683,7 +224714,7 @@ var WebDavFileSystem = class {
224683
224714
  if (result2.has(member))
224684
224715
  throw new Error("duplicate response href");
224685
224716
  if (member !== path2)
224686
- admitDirectoryEntries(++children7, limit7, path2);
224717
+ admitDirectoryEntries(++children8, limit7, path2);
224687
224718
  const stat = this.entryStat(element2, member);
224688
224719
  recordOwnedResourceStat(response, this, member, stat);
224689
224720
  result2.set(member, stat);
@@ -228091,23 +228122,23 @@ function clipboardObjectRecords(sheet, range3, context) {
228091
228122
  name: value3.name,
228092
228123
  namespace: value3.namespace,
228093
228124
  text: value3.text,
228094
- attributes: [...Object.entries(value3.attributes).map(([name, value4]) => ({ name, namespace: "", value: value4 })), ...value3.qualifiedAttributes].map((attribute6) => ({
228095
- ...attribute6,
228096
- value: bound !== void 0 && attribute6.namespace === "" && attribute6.name === "ObjectBound" ? bound : attribute6.value
228125
+ attributes: [...Object.entries(value3.attributes).map(([name, value4]) => ({ name, namespace: "", value: value4 })), ...value3.qualifiedAttributes].map((attribute7) => ({
228126
+ ...attribute7,
228127
+ value: bound !== void 0 && attribute7.namespace === "" && attribute7.name === "ObjectBound" ? bound : attribute7.value
228097
228128
  })),
228098
228129
  children: value3.children.map((child7) => node3(child7))
228099
228130
  };
228100
228131
  };
228101
- const children7 = copied.map((object5) => {
228132
+ const children8 = copied.map((object5) => {
228102
228133
  const bound = object5.anchor.range;
228103
228134
  return node3(object5.payload, `${formatA1(bound.startRow - range3.startRow, bound.startColumn - range3.startColumn)}:${formatA1(bound.endRow - range3.startRow, bound.endColumn - range3.startColumn)}`);
228104
228135
  });
228105
- return children7.length ? [{ source: "Gnumeric_XmlIO:sax", kind: "Objects", disposition: "retained", data: {
228136
+ return children8.length ? [{ source: "Gnumeric_XmlIO:sax", kind: "Objects", disposition: "retained", data: {
228106
228137
  name: "Objects",
228107
228138
  namespace: copied[0].payload.namespace,
228108
228139
  text: "",
228109
228140
  attributes: [],
228110
- children: children7
228141
+ children: children8
228111
228142
  } }] : [];
228112
228143
  }
228113
228144
  function imageBytes(text2, maximum, context) {
@@ -229166,13 +229197,13 @@ function clipboardStyleRecords(sheet, range3, context) {
229166
229197
  }
229167
229198
  return record6(step.value.children[0], true);
229168
229199
  };
229169
- const children7 = clipboardStyles(sheet, range3, styleNode({ Script: 0 }, "General", true), styleNode, context).map((region) => ({ name: "StyleRegion", namespace: namespace4, text: "", attributes: Object.entries({
229200
+ const children8 = clipboardStyles(sheet, range3, styleNode({ Script: 0 }, "General", true), styleNode, context).map((region) => ({ name: "StyleRegion", namespace: namespace4, text: "", attributes: Object.entries({
229170
229201
  startCol: region.range.startColumn - range3.startColumn,
229171
229202
  startRow: region.range.startRow - range3.startRow,
229172
229203
  endCol: region.range.endColumn - range3.startColumn,
229173
229204
  endRow: region.range.endRow - range3.startRow
229174
229205
  }).map(([name, value3]) => ({ name, namespace: "", value: String(value3) })), children: [region.style] }));
229175
- return [{ source: "Gnumeric_XmlIO:sax", kind: "Styles", disposition: "retained", data: { name: "Styles", namespace: namespace4, text: "", attributes: [], children: children7 } }];
229206
+ return [{ source: "Gnumeric_XmlIO:sax", kind: "Styles", disposition: "retained", data: { name: "Styles", namespace: namespace4, text: "", attributes: [], children: children8 } }];
229176
229207
  }
229177
229208
  function writeClipboardGnumeric(book, sheet, range3, context) {
229178
229209
  const writer = new XmlWriter(context.limits.outputBytes, context);
@@ -229821,10 +229852,10 @@ Run 'ssconvert --help' to see a full list of available command line options.
229821
229852
  `
229822
229853
  );
229823
229854
  function parseCommand(supplied, profile) {
229824
- const encoder3 = new TextEncoder();
229825
- const decoder = new TextDecoder("utf8", { ignoreBOM: true });
229855
+ const encoder4 = new TextEncoder();
229856
+ const decoder2 = new TextDecoder("utf8", { ignoreBOM: true });
229826
229857
  const byteMode = supplied.some((argument) => typeof argument !== "string");
229827
- const bytes = supplied.map((argument) => typeof argument === "string" ? encoder3.encode(argument) : new Uint8Array(argument));
229858
+ const bytes = supplied.map((argument) => typeof argument === "string" ? encoder4.encode(argument) : new Uint8Array(argument));
229828
229859
  const argv = bytes.map((argument) => Array.from(argument, (byte) => String.fromCharCode(byte)).join(""));
229829
229860
  const operandBytes = [];
229830
229861
  const unknown = (index2) => {
@@ -229838,15 +229869,15 @@ function parseCommand(supplied, profile) {
229838
229869
  message = "[Invalid UTF-8] Unknown option " + Array.from(option, (byte) => byte >= 32 && byte < 127 || byte === 9 || byte === 10 ? String.fromCharCode(byte) : `\\x${byte.toString(16).padStart(2, "0")}`).join("");
229839
229870
  }
229840
229871
  const result2 = parserError(message);
229841
- return { ...result2, stderrBytes: encoder3.encode(result2.stderr) };
229872
+ return { ...result2, stderrBytes: encoder4.encode(result2.stderr) };
229842
229873
  }
229843
- const prefix = encoder3.encode("Unknown option ");
229844
- const suffix = encoder3.encode("\nRun 'ssconvert --help' to see a full list of available command line options.\n");
229874
+ const prefix = encoder4.encode("Unknown option ");
229875
+ const suffix = encoder4.encode("\nRun 'ssconvert --help' to see a full list of available command line options.\n");
229845
229876
  const raw = new Uint8Array(prefix.length + option.length + suffix.length);
229846
229877
  raw.set(prefix);
229847
229878
  raw.set(option, prefix.length);
229848
229879
  raw.set(suffix, prefix.length + option.length);
229849
- return { kind: "terminal", exitCode: 1, stdout: "", stderr: decoder.decode(raw), stderrBytes: raw };
229880
+ return { kind: "terminal", exitCode: 1, stdout: "", stderr: decoder2.decode(raw), stderrBytes: raw };
229850
229881
  };
229851
229882
  const operands = [], scalars = {}, scalarBytes = {}, arrays = {}, flags = /* @__PURE__ */ new Set();
229852
229883
  let options = true;
@@ -229862,7 +229893,7 @@ function parseCommand(supplied, profile) {
229862
229893
  continue;
229863
229894
  }
229864
229895
  if (!options || !argument.startsWith("-") || argument === "-") {
229865
- operands.push(decoder.decode(bytes[index2]));
229896
+ operands.push(decoder2.decode(bytes[index2]));
229866
229897
  operandBytes.push(bytes[index2]);
229867
229898
  continue;
229868
229899
  }
@@ -229909,7 +229940,7 @@ function parseCommand(supplied, profile) {
229909
229940
  let decoded;
229910
229941
  if (scalar2 === "lib-dir" || scalar2 === "data-dir") {
229911
229942
  scalarBytes[scalar2] = new Uint8Array(valueBytes);
229912
- decoded = decoder.decode(valueBytes);
229943
+ decoded = decoder2.decode(valueBytes);
229913
229944
  } else {
229914
229945
  try {
229915
229946
  decoded = new TextDecoder("utf8", { fatal: true, ignoreBOM: true }).decode(valueBytes);
@@ -229990,7 +230021,7 @@ async function runCommand(argv, engine, operation, profile) {
229990
230021
  return { exitCode: error2.exitCode };
229991
230022
  }
229992
230023
  const parsed = parseCommand(argv, profile);
229993
- const encoder3 = new TextEncoder();
230024
+ const encoder4 = new TextEncoder();
229994
230025
  let stderrFailed = false;
229995
230026
  async function report(bytes) {
229996
230027
  operation.signal.throwIfAborted();
@@ -230010,7 +230041,7 @@ async function runCommand(argv, engine, operation, profile) {
230010
230041
  if (outputBytes2 > (engine.limits.commandOutputBytes ?? Infinity))
230011
230042
  throw new SsconvertError("resource-limit", "ssconvert output bytes limit exceeded");
230012
230043
  }
230013
- return encoder3.encode(text2);
230044
+ return encoder4.encode(text2);
230014
230045
  }
230015
230046
  try {
230016
230047
  if (parsed.kind === "terminal") {
@@ -230111,7 +230142,7 @@ async function runCommand(argv, engine, operation, profile) {
230111
230142
  ...operation,
230112
230143
  async diagnostic(diagnostic) {
230113
230144
  operation.signal.throwIfAborted();
230114
- await report(diagnostic.bytes ?? encoder3.encode(`${diagnostic.message}
230145
+ await report(diagnostic.bytes ?? encoder4.encode(`${diagnostic.message}
230115
230146
  `));
230116
230147
  emitted.add(diagnostic);
230117
230148
  operation.signal.throwIfAborted();
@@ -230124,7 +230155,7 @@ async function runCommand(argv, engine, operation, profile) {
230124
230155
  for (const diagnostic of result2.diagnostics) {
230125
230156
  if (emitted.has(diagnostic)) continue;
230126
230157
  operation.signal.throwIfAborted();
230127
- await report(diagnostic.bytes ?? encoder3.encode(`${diagnostic.message}
230158
+ await report(diagnostic.bytes ?? encoder4.encode(`${diagnostic.message}
230128
230159
  `));
230129
230160
  }
230130
230161
  operation.signal.throwIfAborted();
@@ -230133,7 +230164,7 @@ async function runCommand(argv, engine, operation, profile) {
230133
230164
  operation.signal.throwIfAborted();
230134
230165
  if (stderrFailed) throw error2;
230135
230166
  if (!isSsconvertError(error2)) throw error2;
230136
- await report(encoder3.encode(`${error2.message}
230167
+ await report(encoder4.encode(`${error2.message}
230137
230168
  `));
230138
230169
  operation.signal.throwIfAborted();
230139
230170
  return { exitCode: error2.exitCode };
@@ -233363,6 +233394,264 @@ function ssconvertCommands(options = {}) {
233363
233394
  function createSsconvertCommands(options = {}) {
233364
233395
  return Object.freeze([createSsconvertCommand(options)]);
233365
233396
  }
233397
+ function parseSimpleSeparatedRows(text2, sep) {
233398
+ const rows = [];
233399
+ let row = [];
233400
+ let field = "";
233401
+ let quoted = false;
233402
+ for (let i = 0; i < text2.length; i++) {
233403
+ const ch3 = text2[i];
233404
+ if (ch3 === '"') {
233405
+ if (quoted && text2[i + 1] === '"') {
233406
+ field += '"';
233407
+ i++;
233408
+ } else if (quoted || field.length === 0) {
233409
+ quoted = !quoted;
233410
+ } else {
233411
+ return void 0;
233412
+ }
233413
+ } else if (!quoted && ch3 === sep) {
233414
+ if (field.startsWith("=") || field.startsWith("'"))
233415
+ return void 0;
233416
+ row.push(field);
233417
+ field = "";
233418
+ } else if (!quoted && (ch3 === "\r" || ch3 === "\n")) {
233419
+ if (field.startsWith("=") || field.startsWith("'"))
233420
+ return void 0;
233421
+ row.push(field);
233422
+ rows.push(row);
233423
+ row = [];
233424
+ field = "";
233425
+ if (ch3 === "\r" && text2[i + 1] === "\n")
233426
+ i++;
233427
+ } else {
233428
+ field += ch3;
233429
+ }
233430
+ }
233431
+ if (quoted)
233432
+ return void 0;
233433
+ if (field.length > 0 || row.length > 0) {
233434
+ if (field.startsWith("=") || field.startsWith("'"))
233435
+ return void 0;
233436
+ row.push(field);
233437
+ rows.push(row);
233438
+ }
233439
+ return rows;
233440
+ }
233441
+ function formatSimpleCsv(rows) {
233442
+ let output2 = "";
233443
+ for (const row of rows) {
233444
+ for (let index2 = 0; index2 < row.length; index2++) {
233445
+ if (index2)
233446
+ output2 += ",";
233447
+ const value3 = row[index2];
233448
+ appendTextField(typeof value3 === "string" ? value3 : rendered(value3), { mode: "auto", quote: '"', whitespace: true }, (text2) => {
233449
+ output2 += text2;
233450
+ });
233451
+ }
233452
+ output2 += "\n";
233453
+ }
233454
+ return output2;
233455
+ }
233456
+ var namespace5 = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
233457
+ var decoder = new TextDecoder("utf-8", { fatal: true });
233458
+ var encoder3 = new TextEncoder();
233459
+ function parse2(bytes) {
233460
+ if (bytes.byteLength > 2097152)
233461
+ throw new RangeError("Synchronous XLSX XML limit exceeded");
233462
+ return parseXml(decoder.decode(bytes), { maxDepth: 32, maxNodes: 1e5, maxAttributes: 2e5, maxTextLength: 2097152 });
233463
+ }
233464
+ function attribute6(node3, name) {
233465
+ return node3.attributes.find((item) => item.name === name)?.value;
233466
+ }
233467
+ function children7(node3, name) {
233468
+ return node3.children.filter((item) => item.namespace === namespace5 && item.localName === name);
233469
+ }
233470
+ function stringValue(node3) {
233471
+ return decodeXlsxString(node3.children.flatMap((item) => {
233472
+ if (item.namespace !== namespace5)
233473
+ return [];
233474
+ if (item.localName === "t")
233475
+ return [item.text];
233476
+ return item.localName === "r" ? children7(item, "t").map((text2) => text2.text) : [];
233477
+ }).join(""));
233478
+ }
233479
+ function parseSimpleXlsxTable(entries2) {
233480
+ let expandedBytes = 0;
233481
+ for (const [name, bytes] of entries2) {
233482
+ expandedBytes += bytes.byteLength;
233483
+ if (expandedBytes > 2097152 || name === "EncryptionInfo" || name === "EncryptedPackage" || name.startsWith("xl/worksheets/") && name.endsWith(".xml") && name !== "xl/worksheets/sheet1.xml")
233484
+ return void 0;
233485
+ }
233486
+ const workbookBytes2 = entries2.get("xl/workbook.xml");
233487
+ let sheetName2 = "Sheet1";
233488
+ if (workbookBytes2) {
233489
+ const workbook = parse2(workbookBytes2);
233490
+ const sheets = children7(workbook, "sheets")[0];
233491
+ if (!sheets || children7(sheets, "sheet").length !== 1)
233492
+ return void 0;
233493
+ sheetName2 = attribute6(children7(sheets, "sheet")[0], "name") ?? sheetName2;
233494
+ }
233495
+ const sheetBytes = entries2.get("xl/worksheets/sheet1.xml");
233496
+ if (!sheetBytes)
233497
+ return void 0;
233498
+ const sheet = parse2(sheetBytes);
233499
+ if (sheet.namespace !== namespace5 || sheet.localName !== "worksheet")
233500
+ return void 0;
233501
+ const data3 = children7(sheet, "sheetData")[0];
233502
+ if (!data3)
233503
+ return void 0;
233504
+ const sharedBytes = entries2.get("xl/sharedStrings.xml");
233505
+ const sharedItems = sharedBytes ? children7(parse2(sharedBytes), "si") : [];
233506
+ if (sharedItems.some((item) => children7(item, "r").some((run) => children7(run, "rPr").length)))
233507
+ return void 0;
233508
+ const strings = sharedItems.map(stringValue);
233509
+ const rows = [];
233510
+ for (const row of children7(data3, "row")) {
233511
+ if (attribute6(row, "r") !== String(rows.length + 1))
233512
+ return void 0;
233513
+ const values2 = [];
233514
+ for (const cell of children7(row, "c")) {
233515
+ const ref = attribute6(cell, "r");
233516
+ if (ref === void 0 || attribute6(cell, "s") !== void 0 || children7(cell, "f").length)
233517
+ return void 0;
233518
+ const address = parseA1(ref);
233519
+ if (address.row !== rows.length || address.column !== values2.length)
233520
+ return void 0;
233521
+ const type = attribute6(cell, "t") ?? "n";
233522
+ const raw = children7(cell, "v")[0]?.text ?? "";
233523
+ if (type === "inlineStr") {
233524
+ const value3 = children7(cell, "is")[0];
233525
+ if (value3 && children7(value3, "r").some((run) => children7(run, "rPr").length))
233526
+ return void 0;
233527
+ values2.push({ kind: "string", value: value3 ? stringValue(value3) : "" });
233528
+ } else if (type === "s") {
233529
+ const index2 = Number(raw);
233530
+ if (!Number.isSafeInteger(index2) || index2 < 0 || String(index2) !== raw || strings[index2] === void 0)
233531
+ return void 0;
233532
+ values2.push({ kind: "string", value: strings[index2] });
233533
+ } else if (type === "b") {
233534
+ if (raw !== "0" && raw !== "1")
233535
+ return void 0;
233536
+ values2.push({ kind: "boolean", value: raw === "1" });
233537
+ } else if (type === "str")
233538
+ values2.push({ kind: "string", value: decodeXlsxString(raw) });
233539
+ else if (type === "n") {
233540
+ if (raw === "")
233541
+ values2.push({ kind: "blank" });
233542
+ else if (Number.isFinite(Number(raw)))
233543
+ values2.push({ kind: "number", value: Number(raw) });
233544
+ else
233545
+ return void 0;
233546
+ } else
233547
+ return void 0;
233548
+ }
233549
+ if (rows.length && values2.length !== rows[0].length)
233550
+ return void 0;
233551
+ rows.push(values2);
233552
+ }
233553
+ return { rows, sheetName: sheetName2 };
233554
+ }
233555
+ function simpleDecimal(value3) {
233556
+ let offset = value3.startsWith("-") ? 1 : 0;
233557
+ const first = offset;
233558
+ while (offset < value3.length && value3.charCodeAt(offset) >= 48 && value3.charCodeAt(offset) <= 57)
233559
+ offset++;
233560
+ if (offset === first || offset > first + 1 && value3[first] === "0")
233561
+ return false;
233562
+ if (value3[offset] === ".") {
233563
+ const start = ++offset;
233564
+ while (offset < value3.length && value3.charCodeAt(offset) >= 48 && value3.charCodeAt(offset) <= 57)
233565
+ offset++;
233566
+ if (offset === start)
233567
+ return false;
233568
+ }
233569
+ return offset === value3.length && Number.isFinite(Number(value3));
233570
+ }
233571
+ function buildSimpleXlsx(rows, sheetName2 = "Sheet1") {
233572
+ const sheetRows = rows.map((row, rowIndex) => `<row r="${rowIndex + 1}">${row.map((value3, column) => {
233573
+ const reference = formatA1(rowIndex, column);
233574
+ const cell = typeof value3 === "string" ? simpleDecimal(value3) ? { kind: "number", value: Number(value3) } : { kind: "string", value: value3 } : value3;
233575
+ if (cell.kind === "blank")
233576
+ return `<c r="${reference}"/>`;
233577
+ if (cell.kind === "number")
233578
+ return `<c r="${reference}" t="n"><v>${cell.value}</v></c>`;
233579
+ if (cell.kind === "boolean")
233580
+ return `<c r="${reference}" t="b"><v>${cell.value ? 1 : 0}</v></c>`;
233581
+ if (cell.kind !== "string")
233582
+ throw new TypeError("Unsupported synchronous XLSX cell");
233583
+ return `<c r="${reference}" t="inlineStr"><is><t xml:space="preserve">${escapeXlsx(encodeXlsxString(cell.value))}</t></is></c>`;
233584
+ }).join("")}</row>`).join("");
233585
+ return {
233586
+ "[Content_Types].xml": encoder3.encode('<?xml version="1.0" encoding="UTF-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/></Types>'),
233587
+ "_rels/.rels": encoder3.encode('<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>'),
233588
+ "xl/workbook.xml": encoder3.encode(`<?xml version="1.0" encoding="UTF-8"?><workbook xmlns="${namespace5}"><sheets><sheet name="${escapeXlsx(sheetName2)}" sheetId="1" r:id="rId1" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"/></sheets></workbook>`),
233589
+ "xl/_rels/workbook.xml.rels": encoder3.encode('<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/></Relationships>'),
233590
+ "xl/worksheets/sheet1.xml": encoder3.encode(`<?xml version="1.0" encoding="UTF-8"?><worksheet xmlns="${namespace5}"><sheetData>${sheetRows}</sheetData></worksheet>`)
233591
+ };
233592
+ }
233593
+ var syncUtf8Decoder = new TextDecoder("utf-8", { fatal: true });
233594
+ var syncUtf8Encoder = new TextEncoder();
233595
+ function createSyncSsconvertEvaluator(archive) {
233596
+ return function evalSyncSsconvert(execute, opArgs, inBytes, readFileSync, writeFileSync) {
233597
+ if (!builtInDirectContextExecutors2.has(execute) || opArgs.length === 0) return void 0;
233598
+ try {
233599
+ const parsed = parseCommand(opArgs);
233600
+ if (parsed.kind === "terminal") {
233601
+ if (parsed.exitCode === 0 && !parsed.stderr && parsed.stdout) {
233602
+ return parsed.stdout;
233603
+ }
233604
+ return void 0;
233605
+ }
233606
+ if (parsed.action !== "convert" || parsed.flags.length > 0 || Object.keys(parsed.arrays).length > 0 || parsed.scalars.clipboard !== void 0 || parsed.scalars.resize !== void 0 || parsed.scalars["export-range"] !== void 0 || parsed.scalars["export-options"] !== void 0 || parsed.scalars["import-encoding"] !== void 0 || parsed.operands.length !== 2) {
233607
+ return void 0;
233608
+ }
233609
+ const [srcUri, dstUri] = parsed.operands;
233610
+ if (srcUri.includes("%") || dstUri.includes("%")) return void 0;
233611
+ if (srcUri.includes("://") && srcUri !== "fd://0") return void 0;
233612
+ if (dstUri.includes("://") && dstUri !== "fd://1") return void 0;
233613
+ const impType = parsed.scalars["import-type"];
233614
+ const expType = parsed.scalars["export-type"];
233615
+ const lowerSrc = srcUri.toLowerCase();
233616
+ const lowerDst = dstUri.toLowerCase();
233617
+ let inFmt;
233618
+ if (impType === "Gnumeric_stf:stf_csvtab" || !impType && lowerSrc.endsWith(".csv")) inFmt = "csv";
233619
+ else if (!impType && lowerSrc.endsWith(".tsv")) inFmt = "tsv";
233620
+ else if (impType === "Gnumeric_Excel:xlsx" || !impType && lowerSrc.endsWith(".xlsx")) inFmt = "xlsx";
233621
+ if (!inFmt) return void 0;
233622
+ let outFmt;
233623
+ if (expType === "Gnumeric_stf:stf_csv" || !expType && lowerDst.endsWith(".csv")) outFmt = "csv";
233624
+ else if (expType === "Gnumeric_Excel:xlsx" || expType === "Gnumeric_Excel:xlsx2" || !expType && lowerDst.endsWith(".xlsx")) outFmt = "xlsx";
233625
+ if (!outFmt) return void 0;
233626
+ if (dstUri === "fd://1" && (!expType || outFmt !== "csv")) return void 0;
233627
+ const srcBytes = srcUri === "fd://0" ? inBytes : readFileSync?.(srcUri);
233628
+ if (!srcBytes || srcBytes.byteLength === 0 || srcBytes.byteLength > 131072) return void 0;
233629
+ let rows;
233630
+ let sheetName2 = srcUri === "fd://0" ? "Sheet1" : srcUri.split("/").pop() || "Sheet1";
233631
+ if (inFmt === "csv" || inFmt === "tsv") {
233632
+ const text2 = syncUtf8Decoder.decode(srcBytes);
233633
+ rows = parseSimpleSeparatedRows(text2, inFmt === "tsv" ? " " : ",");
233634
+ } else {
233635
+ const table2 = parseSimpleXlsxTable(archive.read(srcBytes));
233636
+ if (!table2) return void 0;
233637
+ rows = table2.rows;
233638
+ sheetName2 = table2.sheetName;
233639
+ }
233640
+ if (!rows) return void 0;
233641
+ if (outFmt === "csv") {
233642
+ const csvText = formatSimpleCsv(rows);
233643
+ if (dstUri === "fd://1") return csvText;
233644
+ if (!writeFileSync || !writeFileSync(dstUri, syncUtf8Encoder.encode(csvText))) return void 0;
233645
+ return "";
233646
+ }
233647
+ const xlsxBytes = archive.write(buildSimpleXlsx(rows, sheetName2));
233648
+ if (!writeFileSync || !writeFileSync(dstUri, xlsxBytes)) return void 0;
233649
+ return "";
233650
+ } catch {
233651
+ return void 0;
233652
+ }
233653
+ };
233654
+ }
233366
233655
  export {
233367
233656
  DEFAULT_SHEET_SIZE,
233368
233657
  ImageExportError,
@@ -233382,6 +233671,7 @@ export {
233382
233671
  createResourceIO,
233383
233672
  createSsconvertCommand,
233384
233673
  createSsconvertCommands,
233674
+ createSyncSsconvertEvaluator,
233385
233675
  createVfsOutput,
233386
233676
  createXlsxWriter,
233387
233677
  csvFormat,