@poe-platform/safe-bash 0.1.749 → 0.1.751

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.
@@ -100951,6 +100951,18 @@ function metadataNode(value3, charge) {
100951
100951
  }
100952
100952
  return visit(value3);
100953
100953
  }
100954
+ var richUnderlines = {
100955
+ none: "none",
100956
+ single: "single",
100957
+ double: "double",
100958
+ low: "singleAccounting",
100959
+ error: "single",
100960
+ "single-line": "single",
100961
+ "double-line": "double",
100962
+ "error-line": "single",
100963
+ singleAccounting: "singleAccounting",
100964
+ doubleAccounting: "doubleAccounting"
100965
+ };
100954
100966
  function writeRichString(value3, runs, xml2, charge, target = "cell") {
100955
100967
  charge?.(value3.length);
100956
100968
  const t = (text2) => xml2("t", text2.trim() !== text2 ? { "xml:space": "preserve" } : {}, escapeXlsx(encodeXlsxString(text2)));
@@ -100973,7 +100985,9 @@ function writeRichString(value3, runs, xml2, charge, target = "cell") {
100973
100985
  if (attrs.size !== void 0) properties += xml2("sz", { val: Number(attrs.size) / 1024 });
100974
100986
  if (typeof attrs.family === "string") properties += xml2("rFont", { val: encodeXlsxString(attrs.family) });
100975
100987
  if (typeof attrs.color === "string") properties += xml2("color", { rgb: "FF" + attrs.color.split("x").join("").toUpperCase() });
100976
- if (typeof attrs.underline === "string") properties += xml2("u", { val: attrs.underline === "low" ? "singleAccounting" : attrs.underline === "error" ? "single" : attrs.underline });
100988
+ if (typeof attrs.underline === "string") properties += xml2("u", {
100989
+ val: Object.hasOwn(richUnderlines, attrs.underline) ? richUnderlines[attrs.underline] : "none"
100990
+ });
100977
100991
  if (attrs.subscript || attrs.superscript) properties += xml2("vertAlign", { val: attrs.subscript ? "subscript" : "superscript" });
100978
100992
  result2 += xml2("r", {}, (properties || target === "comment" ? xml2("rPr", {}, properties) : "") + t(decoder.decode(bytes.subarray(start, end2))));
100979
100993
  }
@@ -116237,6 +116251,40 @@ var BiffOutput = class {
116237
116251
  this.length += bytes.length;
116238
116252
  return at;
116239
116253
  }
116254
+ /** Keep tokens/elements intact; oversized UTF-16 array strings carry width flags. */
116255
+ continuedRecord(opcode, payload, boundaries, strings = []) {
116256
+ const at = this.length;
116257
+ let offset = 0, next = 0, stringIndex = 0;
116258
+ do {
116259
+ while (strings[stringIndex] && strings[stringIndex].end <= offset) stringIndex++;
116260
+ const continuedString = strings[stringIndex] && strings[stringIndex].start < offset;
116261
+ const prefix = continuedString ? 1 : 0;
116262
+ const maximum = Math.min(payload.length, offset + this.maximumRecord - prefix);
116263
+ let end2 = maximum;
116264
+ if (boundaries && maximum < payload.length) {
116265
+ end2 = offset;
116266
+ while (next < boundaries.length && boundaries[next] <= maximum) end2 = boundaries[next++];
116267
+ let candidate = stringIndex;
116268
+ while (strings[candidate] && strings[candidate].end <= maximum) candidate++;
116269
+ const string = strings[candidate];
116270
+ if (string && string.end - string.start + 4 > this.maximumRecord && string.start < maximum && maximum < string.end) {
116271
+ const characterEnd = maximum - (maximum - string.start) % 2;
116272
+ if (characterEnd > string.start) end2 = Math.max(end2, characterEnd);
116273
+ }
116274
+ if (end2 <= offset) throw new SsconvertError("unsupported-feature", "Excel BIFF formula token is too large");
116275
+ }
116276
+ let part = payload.subarray(offset, end2);
116277
+ if (prefix) {
116278
+ const continued = new Uint8Array(part.length + 1);
116279
+ continued[0] = 1;
116280
+ continued.set(part, 1);
116281
+ part = continued;
116282
+ }
116283
+ this.record(offset === 0 ? opcode : 60, part);
116284
+ offset = end2;
116285
+ } while (offset < payload.length);
116286
+ return at;
116287
+ }
116240
116288
  finish() {
116241
116289
  this.context.signal.throwIfAborted();
116242
116290
  const bytes = new Uint8Array(this.length);
@@ -128336,7 +128384,6 @@ var BiffFormulaWriter = class {
128336
128384
  macroNames = [];
128337
128385
  workbookIndices = /* @__PURE__ */ new Map();
128338
128386
  linkIndices = /* @__PURE__ */ new Map();
128339
- uniqueNameId = 0;
128340
128387
  relocations = [];
128341
128388
  externalBook(workbook) {
128342
128389
  let index2 = this.workbookIndices.get(workbook);
@@ -128457,6 +128504,11 @@ var BiffFormulaWriter = class {
128457
128504
  const relative = definition !== void 0;
128458
128505
  const root = definition ? parseNamedExpression(definition, this.book, parse2, () => this.context.signal.throwIfAborted()) : parse2(source, { sheet, row, column });
128459
128506
  const bytes = [], arrays = [], diagnostics = [];
128507
+ const tokenBoundaries = [], arrayBoundaries = [];
128508
+ const arrayStrings = [];
128509
+ const boundary = () => {
128510
+ if (bytes.length && tokenBoundaries.at(-1) !== bytes.length) tokenBoundaries.push(bytes.length);
128511
+ };
128460
128512
  let sheetLossReported = false;
128461
128513
  const relocations = [];
128462
128514
  const push = (part, target = bytes) => {
@@ -128499,12 +128551,14 @@ var BiffFormulaWriter = class {
128499
128551
  push([23]);
128500
128552
  push(biffString(text2, this.revision, this.context, 1));
128501
128553
  if (index2) push([8]);
128554
+ boundary();
128502
128555
  });
128503
128556
  if (chunks.length > 1) push([21]);
128504
128557
  }
128505
128558
  };
128506
128559
  const visit = (node3) => {
128507
128560
  this.context.signal.throwIfAborted();
128561
+ boundary();
128508
128562
  if (node3.kind === "literal") literal2(node3.value);
128509
128563
  else if (node3.kind === "omitted") push([22]);
128510
128564
  else if (node3.kind === "parentheses") {
@@ -128657,24 +128711,15 @@ var BiffFormulaWriter = class {
128657
128711
  push([28, 29]);
128658
128712
  return;
128659
128713
  }
128660
- if (node3.sheet !== void 0 && scope !== void 0) {
128661
- const data3 = new Uint8Array(this.revision === 8 ? 7 : 25), view2 = new DataView(data3.buffer);
128714
+ if (node3.sheet !== void 0 && scope !== void 0 && this.revision === 8) {
128715
+ const data3 = new Uint8Array(7), view2 = new DataView(data3.buffer);
128662
128716
  data3[0] = 89;
128663
128717
  const scopeIndex = this.book.sheets.indexOf(scope);
128664
- if (this.revision === 8) {
128665
- const externalIndex = this.sheetLink(void 0, scopeIndex, scopeIndex);
128666
- relocations.push({ offset: bytes.length + 1, index: externalIndex, kind: "sheet" });
128667
- view2.setUint16(1, externalIndex, true);
128668
- view2.setUint16(3, index2 + 1, true);
128669
- } else {
128670
- const externalIndex = current === scope ? this.book.sheets.length + 1 : scopeIndex;
128671
- view2.setInt16(1, -(externalIndex + 1), true);
128672
- view2.setUint16(9, 1, true);
128673
- view2.setUint16(11, index2 + 1, true);
128674
- view2.setUint16(19, 15, true);
128675
- view2.setUint32(21, ++this.uniqueNameId, true);
128676
- }
128677
- relocations.push({ offset: bytes.length + (this.revision === 8 ? 3 : 11), index: index2, kind: "name" });
128718
+ const externalIndex = this.sheetLink(void 0, scopeIndex, scopeIndex);
128719
+ relocations.push({ offset: bytes.length + 1, index: externalIndex, kind: "sheet" });
128720
+ view2.setUint16(1, externalIndex, true);
128721
+ view2.setUint16(3, index2 + 1, true);
128722
+ relocations.push({ offset: bytes.length + 3, index: index2, kind: "name" });
128678
128723
  push(data3);
128679
128724
  } else {
128680
128725
  const data3 = new Uint8Array(this.revision === 8 ? 5 : 15);
@@ -128732,12 +128777,15 @@ var BiffFormulaWriter = class {
128732
128777
  if (!columns || columns > 256 || node3.rows.length > 65536) throw new SsconvertError("unsupported-feature", "Excel BIFF array dimensions exceed limits");
128733
128778
  push([64, ...new Uint8Array(7)]);
128734
128779
  push([this.revision === 8 ? columns - 1 : columns & 255, ...words(node3.rows.length - (this.revision === 8 ? 1 : 0))], arrays);
128780
+ arrayBoundaries.push(arrays.length);
128735
128781
  for (const arrayRow of node3.rows) for (const item of arrayRow) {
128736
128782
  if (item.kind !== "literal") throw new SsconvertError("unsupported-feature", "Excel BIFF array requires literals");
128737
128783
  const value3 = item.value;
128738
128784
  if (value3.kind === "string") {
128785
+ const start = arrays.length + 4;
128739
128786
  push([2], arrays);
128740
128787
  push(biffString(value3.value, this.revision, this.context, this.revision === 8 ? 2 : 1), arrays);
128788
+ if (this.revision === 8 && arrays.length > start) arrayStrings.push({ start, end: arrays.length });
128741
128789
  } else {
128742
128790
  const data3 = new Uint8Array(9), view2 = new DataView(data3.buffer);
128743
128791
  data3[0] = value3.kind === "number" ? 1 : value3.kind === "boolean" ? 4 : value3.kind === "error" ? 16 : 0;
@@ -128746,15 +128794,23 @@ var BiffFormulaWriter = class {
128746
128794
  else if (value3.kind === "error") data3[1] = biffError(value3.value);
128747
128795
  push(data3, arrays);
128748
128796
  }
128797
+ arrayBoundaries.push(arrays.length);
128749
128798
  }
128750
128799
  }
128800
+ boundary();
128751
128801
  };
128752
128802
  visit(root);
128803
+ boundary();
128804
+ if (bytes.length > 65535)
128805
+ throw new SsconvertError("unsupported-feature", "Excel BIFF formula token length exceeds version limits");
128753
128806
  const tokens3 = new Uint8Array(bytes);
128754
128807
  for (const relocation of relocations) this.relocations.push({ ...relocation, tokens: tokens3 });
128755
128808
  return {
128756
128809
  tokens: tokens3,
128810
+ tokenBoundaries,
128757
128811
  arrays: new Uint8Array(arrays),
128812
+ arrayBoundaries,
128813
+ arrayStrings,
128758
128814
  diagnostics,
128759
128815
  nameDependencies: relocations.filter((relocation) => relocation.kind === "name").map((relocation) => relocation.index)
128760
128816
  };
@@ -129339,7 +129395,10 @@ async function writeBiffStream(book, revision2, dual, context, filepass) {
129339
129395
  if (group) {
129340
129396
  formulas.set(cell, {
129341
129397
  tokens: new Uint8Array([dataTables.has(group) ? 2 : 1, ...words(group.range.startRow, group.range.startColumn)]),
129398
+ tokenBoundaries: [5],
129342
129399
  arrays: new Uint8Array(),
129400
+ arrayBoundaries: [],
129401
+ arrayStrings: [],
129343
129402
  diagnostics: [],
129344
129403
  nameDependencies: []
129345
129404
  });
@@ -129429,8 +129488,22 @@ async function writeBiffStream(book, revision2, dual, context, filepass) {
129429
129488
  header4[3] = text2[0];
129430
129489
  view3.setUint16(4, formula3.tokens.length, true);
129431
129490
  const scope = name.sheet === void 0 ? 0 : book.sheets.findIndex((sheet) => sheet.id === name.sheet) + 1;
129432
- view3.setUint16(revision2 === 8 ? 8 : 6, scope, true);
129433
- output2.record(24, join(join(header4, text2.subarray(1)), join(formula3.tokens, formula3.arrays)));
129491
+ if (revision2 === 7 && scope) view3.setUint16(6, scope - 1, true);
129492
+ view3.setUint16(8, scope, true);
129493
+ const start = header4.length + text2.length - 1;
129494
+ output2.continuedRecord(
129495
+ 24,
129496
+ join(join(header4, text2.subarray(1)), join(formula3.tokens, formula3.arrays)),
129497
+ [
129498
+ start,
129499
+ ...formula3.tokenBoundaries.map((offset) => offset + start),
129500
+ ...formula3.arrayBoundaries.map((offset) => offset + start + formula3.tokens.length)
129501
+ ],
129502
+ formula3.arrayStrings.map((span2) => ({
129503
+ start: start + formula3.tokens.length + span2.start,
129504
+ end: start + formula3.tokens.length + span2.end
129505
+ }))
129506
+ );
129434
129507
  }
129435
129508
  if (revision2 === 8) {
129436
129509
  metadata3.global(output2);
@@ -129484,7 +129557,19 @@ async function writeBiffStream(book, revision2, dual, context, filepass) {
129484
129557
  view3.setUint16(12, formula3.tokens.length, true);
129485
129558
  data3.set(formula3.tokens, 14);
129486
129559
  data3.set(formula3.arrays, 14 + formula3.tokens.length);
129487
- output2.record(545, data3);
129560
+ output2.continuedRecord(
129561
+ 545,
129562
+ data3,
129563
+ [
129564
+ 14,
129565
+ ...formula3.tokenBoundaries.map((offset) => offset + 14),
129566
+ ...formula3.arrayBoundaries.map((offset) => offset + 14 + formula3.tokens.length)
129567
+ ],
129568
+ formula3.arrayStrings.map((span2) => ({
129569
+ start: 14 + formula3.tokens.length + span2.start,
129570
+ end: 14 + formula3.tokens.length + span2.end
129571
+ }))
129572
+ );
129488
129573
  }
129489
129574
  }
129490
129575
  const cached = cell.cachedResult ?? cell.value;
@@ -129566,7 +129651,19 @@ async function writeCell(output2, cell, xf, revision2, strings, context, formula
129566
129651
  view2.setUint16(20, formula3.tokens.length, true);
129567
129652
  data3.set(formula3.tokens, 22);
129568
129653
  data3.set(formula3.arrays, 22 + formula3.tokens.length);
129569
- output2.record(6, data3);
129654
+ output2.continuedRecord(
129655
+ 6,
129656
+ data3,
129657
+ [
129658
+ 22,
129659
+ ...formula3.tokenBoundaries.map((offset) => offset + 22),
129660
+ ...formula3.arrayBoundaries.map((offset) => offset + 22 + formula3.tokens.length)
129661
+ ],
129662
+ formula3.arrayStrings.map((span2) => ({
129663
+ start: 22 + formula3.tokens.length + span2.start,
129664
+ end: 22 + formula3.tokens.length + span2.end
129665
+ }))
129666
+ );
129570
129667
  return;
129571
129668
  }
129572
129669
  if (value3.kind === "number") {
@@ -130487,6 +130584,33 @@ async function readBiff(borrowed, context, encoding) {
130487
130584
  while (records[index2 + 1]?.opcode === 60) parts.push(records[++index2].data);
130488
130585
  return { parts, next: index2 };
130489
130586
  };
130587
+ const formulaParts = (index2, offset, length) => {
130588
+ const first = records[index2].data;
130589
+ let tokens3;
130590
+ if (offset + length <= first.bytes.length) {
130591
+ tokens3 = first.slice(offset, length);
130592
+ offset += length;
130593
+ } else {
130594
+ accountFormulaWork(length);
130595
+ tokens3 = new Uint8Array(length);
130596
+ let written = 0;
130597
+ while (written < length) {
130598
+ context.signal.throwIfAborted();
130599
+ const part = records[index2].data;
130600
+ const count = Math.min(length - written, part.bytes.length - offset);
130601
+ tokens3.set(part.slice(offset, count), written);
130602
+ written += count;
130603
+ offset += count;
130604
+ if (written < length) {
130605
+ if (records[index2 + 1]?.opcode !== 60) invalidBiff("truncated formula tokens/CONTINUE");
130606
+ index2++;
130607
+ offset = 0;
130608
+ }
130609
+ }
130610
+ }
130611
+ const extra = stringParts(index2, offset);
130612
+ return { tokens: tokens3, arrays: extra.parts, next: extra.next };
130613
+ };
130490
130614
  for (let index2 = 0; index2 < records.length; index2++) {
130491
130615
  context.signal.throwIfAborted();
130492
130616
  const record7 = records[index2], data3 = record7.data, opcode = record7.opcode;
@@ -130685,13 +130809,12 @@ async function readBiff(borrowed, context, encoding) {
130685
130809
  const name = accountText(ver >= 8 ? cursor.unicode(length).text : cursor.legacy(length));
130686
130810
  const end2 = 7 + cursor.consumedBytes;
130687
130811
  const tokenLength = end2 + 2 <= data3.bytes.length ? data3.u16(end2) : 0;
130688
- const tokens3 = tokenLength ? data3.slice(end2 + 2, tokenLength) : new Uint8Array();
130812
+ const formula4 = tokenLength ? formulaParts(index2, end2 + 2, tokenLength) : { tokens: new Uint8Array(), arrays: [], next: index2 };
130689
130813
  const legacyLink = (sheet?.legacyExternalLinks ?? legacyExternalLinks).get((sheet?.legacyExternalSheets ?? legacyExternalSheets).length - 1);
130690
130814
  const table2 = ver >= 8 ? supbooks.at(-1)?.names : legacyLink?.names;
130691
130815
  if (!table2) invalidBiff("EXTERNNAME without workbook link");
130692
- const arrays = tokenLength ? stringParts(index2, end2 + 2 + tokenLength) : { parts: [], next: index2 };
130693
- index2 = arrays.next;
130694
- table2.push({ name, sheetIndex: data3.u16(2), tokens: tokens3, arrays: arrays.parts, revision: ver, codepage, supported: flags === 0, record: record7 });
130816
+ index2 = formula4.next;
130817
+ table2.push({ name, sheetIndex: data3.u16(2), tokens: formula4.tokens, arrays: formula4.arrays, revision: ver, codepage, supported: flags === 0, record: record7 });
130695
130818
  const addin = ver >= 8 ? supbooks.at(-1)?.kind === "addin" : legacyLink?.addin;
130696
130819
  const externalIdentity = (ver >= 8 ? supbooks.at(-1)?.workbook : legacyLink?.workbook) !== void 0 && flags === 0;
130697
130820
  if (!addin || flags !== 0) await retain(record7, sheet?.unsupportedRecords ?? unsupported9, !externalIdentity);
@@ -130721,7 +130844,9 @@ async function readBiff(borrowed, context, encoding) {
130721
130844
  }
130722
130845
  if (opcode === 24 || opcode === 536) {
130723
130846
  const flags = data3.u16(0), length = data3.u8(3), tokenLength = ver === 2 ? data3.u8(4) : data3.u16(4);
130724
- const start = ver >= 7 ? 14 : ver >= 3 ? 6 : 5, sheetIndex = ver >= 8 ? data3.u16(8) : ver >= 7 ? data3.u16(6) : 0;
130847
+ const start = ver >= 7 ? 14 : ver >= 3 ? 6 : 5;
130848
+ const scopeIsWorksheet = ver >= 8 || ver >= 7 && data3.u16(8) !== 0;
130849
+ const sheetIndex = scopeIsWorksheet ? data3.u16(8) : ver >= 7 ? data3.u16(6) : 0;
130725
130850
  const cursor = new BiffStrings([new Binary(data3.slice(start, data3.bytes.length - start))], context, codepage);
130726
130851
  let name;
130727
130852
  if (flags & 32 && length) {
@@ -130745,10 +130870,20 @@ async function readBiff(borrowed, context, encoding) {
130745
130870
  ][builtin];
130746
130871
  name = (base ?? `_BIFF_BUILTIN_${builtin}`) + text2.slice(1);
130747
130872
  } else name = ver >= 8 ? cursor.unicode(length).text : cursor.legacy(length);
130748
- const tokens3 = data3.slice(start + cursor.consumedBytes, tokenLength);
130749
- const arrays = stringParts(index2, start + cursor.consumedBytes + tokenLength);
130750
- index2 = arrays.next;
130751
- names2.push({ name: accountText(name), flags, tokens: tokens3, arrays: arrays.parts, sheetIndex, revision: ver, codepage, record: record7, ...sheet ? { owner: sheet } : {} });
130873
+ const formula4 = formulaParts(index2, start + cursor.consumedBytes, tokenLength);
130874
+ index2 = formula4.next;
130875
+ names2.push({
130876
+ name: accountText(name),
130877
+ flags,
130878
+ tokens: formula4.tokens,
130879
+ arrays: formula4.arrays,
130880
+ sheetIndex,
130881
+ scopeIsWorksheet,
130882
+ revision: ver,
130883
+ codepage,
130884
+ record: record7,
130885
+ ...sheet ? { owner: sheet } : {}
130886
+ });
130752
130887
  continue;
130753
130888
  }
130754
130889
  if (ignoredOpcodes.has(opcode)) continue;
@@ -130822,13 +130957,15 @@ async function readBiff(borrowed, context, encoding) {
130822
130957
  if (kind > 3) invalidBiff("invalid formula cache tag");
130823
130958
  }
130824
130959
  lastFormula = addCell(sheet, data3, value3, { cachedResult: value3, formulaDirty: !!(data3.u16(14) & 3) });
130825
- lastFormula.tokens = data3.slice(tokenStart, tokenLength);
130826
- const arrays = stringParts(index2, tokenStart + tokenLength);
130827
- index2 = arrays.next;
130828
- lastFormula.arrays = arrays.parts;
130960
+ const formula4 = formulaParts(index2, tokenStart, tokenLength);
130961
+ index2 = formula4.next;
130962
+ lastFormula.tokens = formula4.tokens;
130963
+ lastFormula.arrays = formula4.arrays;
130829
130964
  const nextOpcode = records[index2 + 1]?.opcode;
130830
130965
  const groupFollows = nextOpcode === 1212 || nextOpcode === 33 || nextOpcode === 545 || nextOpcode === 54 || nextOpcode === 55 || nextOpcode === 566;
130831
- const stringOpcode = records[index2 + (groupFollows ? 2 : 1)]?.opcode;
130966
+ let stringIndex = index2 + (groupFollows ? 2 : 1);
130967
+ if (groupFollows) while (records[stringIndex]?.opcode === 60) stringIndex++;
130968
+ const stringOpcode = records[stringIndex]?.opcode;
130832
130969
  if (stringCache2 && stringOpcode !== 7 && stringOpcode !== 519) {
130833
130970
  const error2 = { kind: "error", value: "MISSING STRING" };
130834
130971
  lastFormula.cell = { ...lastFormula.cell, value: error2, cachedResult: error2 };
@@ -130868,10 +131005,17 @@ async function readBiff(borrowed, context, encoding) {
130868
131005
  }
130869
131006
  const kind = opcode === 1212 ? "shared" : "array";
130870
131007
  const start = kind === "shared" ? 10 : ver === 2 ? 8 : ver <= 4 ? 10 : 14;
130871
- const tokens3 = data3.slice(start, ver === 2 && kind === "array" ? data3.u8(start - 1) : data3.u16(start - 2));
130872
- const arrays = stringParts(index2, start + tokens3.length);
130873
- index2 = arrays.next;
130874
- sheet.groups.push({ id: `biff-${sheet.offset}-${record7.offset}`, kind, range: range3, tokens: tokens3, arrays: arrays.parts, keyRow: lastFormula.cell.row, keyColumn: lastFormula.cell.column });
131008
+ const formula4 = formulaParts(index2, start, ver === 2 && kind === "array" ? data3.u8(start - 1) : data3.u16(start - 2));
131009
+ index2 = formula4.next;
131010
+ sheet.groups.push({
131011
+ id: `biff-${sheet.offset}-${record7.offset}`,
131012
+ kind,
131013
+ range: range3,
131014
+ tokens: formula4.tokens,
131015
+ arrays: formula4.arrays,
131016
+ keyRow: lastFormula.cell.row,
131017
+ keyColumn: lastFormula.cell.column
131018
+ });
130875
131019
  continue;
130876
131020
  }
130877
131021
  if (opcode === 7 || opcode === 519) {
@@ -130979,7 +131123,7 @@ async function readBiff(borrowed, context, encoding) {
130979
131123
  const localSheets = sheets.map((sheet) => sheet.name);
130980
131124
  const nameSheets = names2.map((name) => {
130981
131125
  if (!name.sheetIndex) return void 0;
130982
- return (name.revision >= 8 ? sheets[name.sheetIndex - 1]?.name : (name.owner?.legacyExternalSheets ?? legacyExternalSheets)[name.sheetIndex - 1]) ?? void 0;
131126
+ return (name.scopeIsWorksheet ? sheets[name.sheetIndex - 1]?.name : (name.owner?.legacyExternalSheets ?? legacyExternalSheets)[name.sheetIndex - 1]) ?? void 0;
130983
131127
  });
130984
131128
  const externalNameTables = /* @__PURE__ */ new Map();
130985
131129
  const formulaNames = names2.map((name) => name.name);
@@ -144330,7 +144474,11 @@ function odfCellStyle(node3, parent, charge) {
144330
144474
  const italic = attr4(p2, "font-style", "fo");
144331
144475
  if (italic !== void 0) font2.Italic = italic === "italic" || italic === "oblique" ? 1 : 0;
144332
144476
  const underline = attr4(p2, "text-underline-style", "style");
144333
- if (underline !== void 0) font2.Underline = underline === "none" ? 0 : attr4(p2, "text-underline-type", "style") === "double" ? 2 : 1;
144477
+ if (underline !== void 0) {
144478
+ const type = attr4(p2, "text-underline-type", "style");
144479
+ const double = type === "double" || attr4(p2, "text-underline-width", "style") === "bold";
144480
+ font2.Underline = underline === "none" || type === "none" ? 0 : (double ? 2 : 1) + (attr4(p2, "text-underline-placement", "gnm") === "low" ? 2 : 0);
144481
+ }
144334
144482
  const strike = attr4(p2, "text-line-through-style", "style");
144335
144483
  if (strike !== void 0) font2.StrikeThrough = strike === "none" ? 0 : 1;
144336
144484
  family = attr4(p2, "font-family", "fo") ?? attr4(p2, "font-name", "style") ?? family;
@@ -144834,8 +144982,13 @@ function createOdfStyles(xml2, extended, book, context) {
144834
144982
  if (f2.Bold !== void 0) text2["fo:font-weight"] = Number(f2.Bold) ? "bold" : "normal";
144835
144983
  if (f2.Italic !== void 0) text2["fo:font-style"] = Number(f2.Italic) ? "italic" : "normal";
144836
144984
  if (f2.Underline !== void 0) {
144837
- text2["style:text-underline-style"] = Number(f2.Underline) ? "solid" : "none";
144838
- text2["style:text-underline-type"] = Number(f2.Underline) === 2 ? "double" : "single";
144985
+ const underline = Number(f2.Underline), low = underline === 3 || underline === 4;
144986
+ text2["style:text-underline-style"] = underline ? "solid" : "none";
144987
+ text2["style:text-underline-type"] = underline === 2 || underline === 4 ? "double" : underline ? "single" : "none";
144988
+ text2["style:text-underline-width"] = "auto";
144989
+ text2["style:text-underline-color"] = "font-color";
144990
+ text2["style:text-underline-mode"] = "continuous";
144991
+ if (extended && low) text2["gnm:text-underline-placement"] = "low";
144839
144992
  }
144840
144993
  if (f2.StrikeThrough !== void 0) text2["style:text-line-through-style"] = Number(f2.StrikeThrough) ? "solid" : "none";
144841
144994
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-bash",
3
- "version": "0.1.749",
3
+ "version": "0.1.751",
4
4
  "description": "Extensible virtual shell with pluggable filesystems and streaming commands",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -645,7 +645,7 @@
645
645
  "access": "public"
646
646
  },
647
647
  "dependencies": {
648
- "@poe-platform/safe-fs": "0.1.749",
648
+ "@poe-platform/safe-fs": "0.1.751",
649
649
  "pdf-lib": "1.17.1",
650
650
  "@types/node": "^25.2.2",
651
651
  "pako": "3.0.1",