@poe-platform/safe-bash 0.1.811 → 0.1.812

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 (61) hide show
  1. package/dist/audio-ast/index.d.ts +1 -0
  2. package/dist/audio-ast/index.js +6 -1
  3. package/dist/audio-ast/vorbis.d.ts +14 -0
  4. package/dist/image-ast/index.js +1 -1
  5. package/dist/pdf-ast/cos/value-parser.d.ts +23 -2
  6. package/dist/pdf-ast/extract/retained-form-field-details.d.ts +20 -0
  7. package/dist/pdf-ast/extract/retained-form-fields.d.ts +17 -4
  8. package/dist/pdf-ast/index.d.ts +1 -0
  9. package/dist/pdf-ast/index.js +701 -336
  10. package/dist/pdf-ast/retained-document.d.ts +4 -0
  11. package/dist/safe-bash/audio-ast.browser.js +2 -1
  12. package/dist/safe-bash/command-chunks/{biff-3EFLKBAH-NYWZOYQS.js → biff-YKPDH35C-MVQIWNKV.js} +2309 -2277
  13. package/dist/safe-bash/command-chunks/{chunk-VU3EQF7F.js → chunk-2JSDKQ4J.js} +110 -31
  14. package/dist/safe-bash/command-chunks/{chunk-72C3TZ2U.js → chunk-3Q247UDJ.js} +1 -1
  15. package/dist/safe-bash/command-chunks/{chunk-HARUYHH7.js → chunk-5HUICAWD.js} +1 -1
  16. package/dist/safe-bash/command-chunks/{chunk-2VCKUNDZ.js → chunk-B2C3UPJS.js} +27 -17
  17. package/dist/safe-bash/command-chunks/{chunk-5LI2DLNZ.js → chunk-CJQSAATC.js} +1 -1
  18. package/dist/safe-bash/command-chunks/{chunk-ZHRGYR7B.js → chunk-FDCIPJBQ.js} +1 -1
  19. package/dist/safe-bash/command-chunks/{chunk-5MB64DWR.js → chunk-HWQ2UHMT.js} +8 -8
  20. package/dist/safe-bash/command-chunks/{chunk-5OO2P27R.js → chunk-NARD63DY.js} +98 -1
  21. package/dist/safe-bash/command-chunks/{chunk-Z5QOVRVH.js → chunk-SU26FZLJ.js} +1 -1
  22. package/dist/safe-bash/command-chunks/{chunk-DPR5CYQV.js → chunk-XITDDJFT.js} +2 -0
  23. package/dist/safe-bash/command-chunks/{chunk-YSY6R6AS.js → chunk-XVLWZTPY.js} +230 -28
  24. package/dist/safe-bash/command-chunks/{chunk-WH3TIOTS.js → chunk-ZEGNRZV2.js} +9 -2
  25. package/dist/safe-bash/command-chunks/{chunk-KL3OIBKB.js → chunk-ZEX53S5I.js} +1892 -1878
  26. package/dist/safe-bash/command-chunks/{command-engine-BEWABZ75.js → command-engine-BCUQGJJ4.js} +58 -21
  27. package/dist/safe-bash/command-chunks/{engine-AXXFTGCL-QBQNBI6K.js → engine-LAUEWYSQ-DQCEI5HE.js} +1 -1
  28. package/dist/safe-bash-command-apply-patch/apply.js +4 -4
  29. package/dist/safe-bash-command-apply-patch/index.js +4 -4
  30. package/dist/safe-bash-command-apply-patch/matcher.js +2 -2
  31. package/dist/safe-bash-command-apply-patch/parser.js +2 -2
  32. package/dist/safe-bash-command-apply-patch/shared.d.ts +2 -0
  33. package/dist/safe-bash-command-apply-patch/shared.js +1 -1
  34. package/dist/safe-bash-command-ffmpeg/index.js +1 -1
  35. package/dist/safe-bash-command-ffprobe/index.js +2 -2
  36. package/dist/safe-bash-command-ffprobe/media.js +2 -2
  37. package/dist/safe-bash-command-pandoc/command.js +1 -1
  38. package/dist/safe-bash-command-pandoc/index.js +1 -1
  39. package/dist/safe-bash-command-patch/index.js +2 -2
  40. package/dist/safe-bash-command-patch/patch-publication.js +1 -1
  41. package/dist/safe-bash-command-patch/patch.js +2 -2
  42. package/dist/safe-bash-command-pdftk/index.js +35 -2
  43. package/dist/safe-bash-command-pptx/command-engine.d.ts +12 -3
  44. package/dist/safe-bash-command-pptx/engine.d.ts +2 -2
  45. package/dist/safe-bash-command-pptx/engine.js +1 -1
  46. package/dist/safe-bash-command-ssconvert/index.js +2 -2
  47. package/dist/safe-bash-diff-engine/document.d.ts +2 -1
  48. package/dist/safe-bash-diff-engine/document.js +7 -4
  49. package/dist/safe-bash-presentation-engine/command-placeholder.js +4 -3
  50. package/dist/safe-bash-presentation-engine/index.d.ts +1 -1
  51. package/dist/safe-bash-presentation-engine/index.js +9 -7
  52. package/dist/safe-bash-presentation-engine/presentation-model.js +3 -2
  53. package/dist/safe-bash-presentation-engine/retained-slide-publication.d.ts +24 -0
  54. package/dist/safe-bash-presentation-engine/slides.d.ts +1 -0
  55. package/dist/safe-bash-presentation-engine/slides.js +6 -3
  56. package/dist/spreadsheet-format-xls/biff-encrypted-properties.d.ts +2 -2
  57. package/dist/spreadsheet-format-xls/biff-encrypted-properties.js +46 -13
  58. package/dist/spreadsheet-format-xls/biff-metadata.d.ts +1 -0
  59. package/dist/spreadsheet-format-xls/biff-metadata.js +2 -2
  60. package/dist/spreadsheet-format-xls/biff-write-metadata.js +10 -1
  61. package/package.json +2 -2
@@ -338267,8 +338267,117 @@ function isMp3Signature(bytes) {
338267
338267
  if (bytes[0] === 73 && bytes[1] === 68 && bytes[2] === 51) return true;
338268
338268
  return bytes[0] === 255 && (bytes[1] & 224) === 224 && (bytes[1] & 6) !== 0;
338269
338269
  }
338270
+ function mp3Document(byteLength, samples) {
338271
+ const sampleRate = 44100, channels = 2, count = Math.max(1, Math.floor(byteLength / 417));
338272
+ return {
338273
+ containerFormat: "mp3",
338274
+ timescale: sampleRate,
338275
+ duration: count * 1152,
338276
+ durationSeconds: count * 1152 / sampleRate,
338277
+ tracks: [
338278
+ {
338279
+ id: 1,
338280
+ type: "audio",
338281
+ handlerType: "soun",
338282
+ timescale: sampleRate,
338283
+ duration: count * 1152,
338284
+ language: "und",
338285
+ enabled: true,
338286
+ codecDescriptions: [
338287
+ {
338288
+ formatFourCC: ".mp3",
338289
+ codecName: "mp3",
338290
+ sampleRate,
338291
+ channels,
338292
+ bitsPerSample: 16
338293
+ }
338294
+ ],
338295
+ samples
338296
+ }
338297
+ ],
338298
+ metadata: {},
338299
+ byteLength
338300
+ };
338301
+ }
338302
+ function mp3Records(size, options) {
338303
+ options.signal?.throwIfAborted();
338304
+ if (!Number.isSafeInteger(size) || size < 0) throw new RangeError("Invalid MP3 source size");
338305
+ const count = Math.max(1, Math.floor(size / 417)), doc = mp3Document(size, []);
338306
+ const metadata = buildProbeResultFromDoc(doc, size, options.filename ?? "input.mp3", {
338307
+ formatName: "mp3",
338308
+ formatLongName: "MP2/3 (MPEG audio layer 2/3)"
338309
+ });
338310
+ const stream = {
338311
+ ...metadata.streams[0],
338312
+ nb_frames: String(count),
338313
+ bit_rate: String(Math.round(Math.min(size, count * 417) * 8 / doc.durationSeconds))
338314
+ };
338315
+ function* spans() {
338316
+ for (let index = 0; index < count; index++) {
338317
+ options.signal?.throwIfAborted();
338318
+ const pts = index * 1152;
338319
+ yield { pts, time: (pts / 44100).toFixed(6), size: String(Math.min(417, size - index * 417)), pos: String(index * 417) };
338320
+ }
338321
+ options.signal?.throwIfAborted();
338322
+ }
338323
+ return {
338324
+ ...metadata,
338325
+ streams: [stream],
338326
+ packets: options.showPackets ? { *[Symbol.iterator]() {
338327
+ for (const s of spans()) yield {
338328
+ codec_type: "audio",
338329
+ stream_index: 0,
338330
+ pts: s.pts,
338331
+ pts_time: s.time,
338332
+ dts: s.pts,
338333
+ dts_time: s.time,
338334
+ duration: 1152,
338335
+ duration_time: (1152 / 44100).toFixed(6),
338336
+ size: s.size,
338337
+ pos: s.pos,
338338
+ flags: "K_"
338339
+ };
338340
+ } } : void 0,
338341
+ frames: options.showFrames ? { *[Symbol.iterator]() {
338342
+ for (const s of spans()) yield {
338343
+ media_type: "audio",
338344
+ stream_index: 0,
338345
+ key_frame: 1,
338346
+ pts: s.pts,
338347
+ pts_time: s.time,
338348
+ pkt_dts: s.pts,
338349
+ pkt_dts_time: s.time,
338350
+ best_effort_timestamp: s.pts,
338351
+ best_effort_timestamp_time: s.time,
338352
+ pkt_duration: 1152,
338353
+ pkt_duration_time: (1152 / 44100).toFixed(6),
338354
+ pkt_size: s.size,
338355
+ width: void 0,
338356
+ height: void 0,
338357
+ pix_fmt: void 0,
338358
+ pict_type: void 0,
338359
+ sample_fmt: stream.sample_fmt,
338360
+ nb_samples: 1152,
338361
+ channels: 2
338362
+ };
338363
+ } } : void 0
338364
+ };
338365
+ }
338270
338366
  function mp3Ast() {
338271
338367
  return {
338368
+ async probeMetadata(source, options = {}) {
338369
+ return mp3Records(source.size, options);
338370
+ },
338371
+ async probeMetadataStream(source, options = {}) {
338372
+ options.signal?.throwIfAborted();
338373
+ let size = 0;
338374
+ for await (const chunk of source) {
338375
+ options.signal?.throwIfAborted();
338376
+ size += chunk.byteLength;
338377
+ if (!Number.isSafeInteger(size)) throw new RangeError("Invalid MP3 source size");
338378
+ }
338379
+ return mp3Records(size, options);
338380
+ },
338272
338381
  id: "mp3",
338273
338382
  formatName: "mp3",
338274
338383
  formatLongName: "MP2/3 (MPEG audio layer 2/3)",
@@ -338284,8 +338393,6 @@ function mp3Ast() {
338284
338393
  return false;
338285
338394
  },
338286
338395
  parse(bytes) {
338287
- const sampleRate = 44100;
338288
- const channels = 2;
338289
338396
  const numFrames = Math.max(1, Math.floor(bytes.byteLength / 417));
338290
338397
  const samples = [];
338291
338398
  for (let i = 0; i < numFrames; i++) {
@@ -338302,35 +338409,7 @@ function mp3Ast() {
338302
338409
  sampleDescriptionIndex: 1
338303
338410
  });
338304
338411
  }
338305
- return {
338306
- containerFormat: "mp3",
338307
- timescale: sampleRate,
338308
- duration: numFrames * 1152,
338309
- durationSeconds: numFrames * 1152 / sampleRate,
338310
- tracks: [
338311
- {
338312
- id: 1,
338313
- type: "audio",
338314
- handlerType: "soun",
338315
- timescale: sampleRate,
338316
- duration: numFrames * 1152,
338317
- language: "und",
338318
- enabled: true,
338319
- codecDescriptions: [
338320
- {
338321
- formatFourCC: ".mp3",
338322
- codecName: "mp3",
338323
- sampleRate,
338324
- channels,
338325
- bitsPerSample: 16
338326
- }
338327
- ],
338328
- samples
338329
- }
338330
- ],
338331
- metadata: {},
338332
- byteLength: bytes.byteLength
338333
- };
338412
+ return mp3Document(bytes.byteLength, samples);
338334
338413
  },
338335
338414
  serialize(doc) {
338336
338415
  const numFrames = Math.max(1, Math.ceil((doc.durationSeconds || 1) * 44100 / 1152));
@@ -4,7 +4,7 @@ import {
4
4
  TargetOutput,
5
5
  equalTargetLines,
6
6
  targetBytes
7
- } from "./chunk-WH3TIOTS.js";
7
+ } from "./chunk-ZEGNRZV2.js";
8
8
  import {
9
9
  unwrapPatch
10
10
  } from "./chunk-JKLOBSMP.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PatchError
3
- } from "./chunk-DPR5CYQV.js";
3
+ } from "./chunk-XITDDJFT.js";
4
4
 
5
5
  // packages/safe-bash-command-apply-patch/src/parser.ts
6
6
  import { resolvePath } from "../../safe-bash-contracts/index.js";
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  normalized,
3
3
  normalizedCharacter
4
- } from "./chunk-Z5QOVRVH.js";
4
+ } from "./chunk-SU26FZLJ.js";
5
5
  import {
6
6
  settings
7
7
  } from "./chunk-66QPYWEF.js";
8
8
  import {
9
9
  parseRecords
10
- } from "./chunk-HARUYHH7.js";
10
+ } from "./chunk-5HUICAWD.js";
11
11
  import {
12
12
  FileFailure,
13
13
  PatchError,
14
14
  Work,
15
15
  diagnostic
16
- } from "./chunk-DPR5CYQV.js";
16
+ } from "./chunk-XITDDJFT.js";
17
17
 
18
18
  // packages/safe-bash-command-apply-patch/src/apply.ts
19
- import { bytesFrom } from "../../safe-bash-byte-engine/index.js";
19
+ import { PagedStorage as PagedStorage2 } from "@poe-platform/safe-fs/storage";
20
20
  import {
21
21
  createOutputOperation,
22
22
  dirname,
@@ -657,7 +657,9 @@ var Invocation = class {
657
657
  const { context, work } = this;
658
658
  work.check();
659
659
  context.registerCleanup?.(work.close);
660
- let summary;
660
+ const summary = new PagedStorage2(context, 2, work.documentCache);
661
+ this.documents.add(summary);
662
+ let summaryBytes = 0;
661
663
  try {
662
664
  try {
663
665
  const input = await this.input();
@@ -666,17 +668,25 @@ var Invocation = class {
666
668
  const files = await parseDocument(input, work, metadata);
667
669
  await this.confine(files);
668
670
  const plans = await this.prepare(files);
669
- const lines = ["Success. Updated the following files:\n"];
670
- let bytes = lines[0].length;
671
- for (const file of files) {
672
- const line = `${file.kind === "add" ? "A" : file.kind === "delete" ? "D" : "M"} ${file.destinationLabel ?? file.label}
671
+ const header = "Success. Updated the following files:\n";
672
+ const summaryLine = (file) => `${file.kind === "add" ? "A" : file.kind === "delete" ? "D" : "M"} ${file.destinationLabel ?? file.label}
673
673
  `;
674
- bytes += await work.utf8(line, work.limits.maxOutputBytes - bytes);
675
- lines.push(line);
676
- }
677
- if (bytes > work.limits.maxOutputBytes) throw new PatchError("maxOutputBytes limit exceeded");
678
- await work.charge(bytes * 2);
679
- summary = bytesFrom(lines.join(""));
674
+ summaryBytes = header.length;
675
+ for (const file of files) summaryBytes += await work.utf8(summaryLine(file), work.limits.maxOutputBytes - summaryBytes);
676
+ if (summaryBytes > work.limits.maxOutputBytes) throw new PatchError("maxOutputBytes limit exceeded");
677
+ await work.charge(summaryBytes * 2);
678
+ const encoder = new TextEncoder();
679
+ const stage = async (text) => {
680
+ for (let offset = 0; offset < text.length; ) {
681
+ let end = Math.min(text.length, offset + 4096);
682
+ const unit = text.charCodeAt(end - 1);
683
+ if (end < text.length && unit >= 55296 && unit <= 56319) end--;
684
+ await summary.append(encoder.encode(text.slice(offset, end)));
685
+ offset = end;
686
+ }
687
+ };
688
+ await stage(header);
689
+ for (const file of files) await stage(summaryLine(file));
680
690
  await work.checkpoint();
681
691
  await this.publish(plans);
682
692
  work.check();
@@ -688,8 +698,8 @@ var Invocation = class {
688
698
  }
689
699
  const operation = createOutputOperation(context, context.stdout);
690
700
  try {
691
- for (let offset = 0; offset < summary.length; offset += 16 * 1024) {
692
- await writeBytes(operation.output, summary.subarray(offset, offset + 16 * 1024), operation.signal);
701
+ for (let offset = 0; offset < summaryBytes; offset += 16 * 1024) {
702
+ await writeBytes(operation.output, await summary.read(8 + offset, Math.min(16384, summaryBytes - offset)), operation.signal);
693
703
  }
694
704
  } finally {
695
705
  await operation.close();
@@ -30,7 +30,7 @@ import {
30
30
  } from "./chunk-PMAM4N33.js";
31
31
  import {
32
32
  prepareSlideInsertion
33
- } from "./chunk-5OO2P27R.js";
33
+ } from "./chunk-NARD63DY.js";
34
34
  import {
35
35
  CoreProperties,
36
36
  createPropertyPart
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Presentation
3
- } from "./chunk-5LI2DLNZ.js";
3
+ } from "./chunk-CJQSAATC.js";
4
4
  import {
5
5
  SlidePlaceholder
6
6
  } from "./chunk-ATTWQVR2.js";
@@ -2,7 +2,7 @@ import {
2
2
  g
3
3
  } from "./chunk-Z7ESJVFP.js";
4
4
 
5
- // packages/safe-bash-command-ssconvert/dist/chunks/chunk-N7CG2JZT.js
5
+ // packages/safe-bash-command-ssconvert/dist/chunks/chunk-7V5REDFO.js
6
6
  import { createEngine as vt } from "../../spreadsheet-engine/index.js";
7
7
  import { SsconvertError as O } from "../../spreadsheet-engine/contracts.js";
8
8
  import { decodeTextSource as ot } from "../../spreadsheet-engine/encoding/decode-source.js";
@@ -35,13 +35,13 @@ var te = { id: "Gnumeric_applix", services: [{ id: "applix", direction: "read",
35
35
  var re = { id: "Gnumeric_dif", services: [{ id: "dif", direction: "read", read: async (e, t) => (await import("./dif-BXKPQOCO-4KB3RC6G.js")).readDif(e, t), description: "Data Interchange Format (*.dif)", extensions: ["dif"], probePriority: 1 }, { id: "dif", direction: "write", write: async (e, t, i) => (await import("./dif-BXKPQOCO-4KB3RC6G.js")).writeDif(e, t, i), description: "Data Interchange Format (*.dif)", extensions: ["dif"], formatLevel: "manual_remember", saveScope: "sheet", selectionSource: "view" }], source: "plugins/dif/plugin.xml.in" };
36
36
  var Qe = ["xor", "rc4", ...[false, true].flatMap((e) => [40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128].map((t) => `rc4-cryptoapi-${t}${e ? "-properties" : ""}`))];
37
37
  var ie = ["xor"];
38
- var W = { id: "Gnumeric_Excel", source: "plugins/excel/plugin.xml.in", services: [{ id: "excel", direction: "read", readWorkbookSource: async (...e) => (await import("./biff-3EFLKBAH-NYWZOYQS.js")).readBiffWorkbookSource(...e), readSource: async (...e) => (await import("./biff-3EFLKBAH-NYWZOYQS.js")).readBiff(...e), probeSource: async (...e) => (await import("./biff-3EFLKBAH-NYWZOYQS.js")).probeBiff(...e), read: async (...e) => (await import("./biff-3EFLKBAH-NYWZOYQS.js")).readBiff(...e), probeContent: async (...e) => (await import("./biff-3EFLKBAH-NYWZOYQS.js")).probeBiff(...e), description: "MS Excel\u2122 (*.xls)", extensions: ["xls", "xlw", "xlt"], mimeTypes: ["application/vnd.ms-excel", "application/excel", "application/msexcel", "application/x-excel", "application/x-ms-excel", "application/x-msexcel", "application/x-xls", "application/xls", "application/x-dos_ms_excel", "zz-application/zz-winassoc-xls"], probePriority: 100, contentProbe: true }, { id: "excel_biff8", write: async (...e) => (await import("./biff-3EFLKBAH-NYWZOYQS.js")).createBiffWriter(8)(...e), writeStream: async function* (...e) {
39
- yield* (await import("./biff-3EFLKBAH-NYWZOYQS.js")).createBiffStreamWriter(8)(...e);
40
- }, labelRanges: true, exportOptionRules: { encryption: { kind: "enum", values: Qe } }, direction: "write", description: "MS Excel\u2122 97/2000/XP", extensions: ["xls"], mimeTypes: ["application/vnd.ms-excel"], formatLevel: "auto", defaultSaverPriority: 1 }, { id: "excel_biff7", write: async (...e) => (await import("./biff-3EFLKBAH-NYWZOYQS.js")).createBiffWriter(7)(...e), writeStream: async function* (...e) {
41
- yield* (await import("./biff-3EFLKBAH-NYWZOYQS.js")).createBiffStreamWriter(7)(...e);
42
- }, labelRanges: true, exportOptionRules: { encryption: { kind: "enum", values: ie } }, direction: "write", description: "MS Excel\u2122 5.0/95", extensions: ["xls"], mimeTypes: ["application/vnd.ms-excel"], formatLevel: "auto" }, { id: "excel_dsf", write: async (...e) => (await import("./biff-3EFLKBAH-NYWZOYQS.js")).createBiffWriter("dsf")(...e), writeStream: async function* (...e) {
43
- yield* (await import("./biff-3EFLKBAH-NYWZOYQS.js")).createBiffStreamWriter("dsf")(...e);
44
- }, labelRanges: true, exportOptionRules: { encryption: { kind: "enum", values: ie } }, direction: "write", description: "MS Excel\u2122 97/2000/XP & 5.0/95", extensions: ["xls"], mimeTypes: ["application/vnd.ms-excel"], formatLevel: "auto" }, { id: "excel_enc", direction: "read", read: async (...e) => (await import("./biff-3EFLKBAH-NYWZOYQS.js")).readBiff(...e), description: "MS Excel\u2122 (*.xls) requiring encoding specification", extensions: [], probePriority: 200, encodingDependent: true }] };
38
+ var W = { id: "Gnumeric_Excel", source: "plugins/excel/plugin.xml.in", services: [{ id: "excel", direction: "read", readWorkbookSource: async (...e) => (await import("./biff-YKPDH35C-MVQIWNKV.js")).readBiffWorkbookSource(...e), readSource: async (...e) => (await import("./biff-YKPDH35C-MVQIWNKV.js")).readBiff(...e), probeSource: async (...e) => (await import("./biff-YKPDH35C-MVQIWNKV.js")).probeBiff(...e), read: async (...e) => (await import("./biff-YKPDH35C-MVQIWNKV.js")).readBiff(...e), probeContent: async (...e) => (await import("./biff-YKPDH35C-MVQIWNKV.js")).probeBiff(...e), description: "MS Excel\u2122 (*.xls)", extensions: ["xls", "xlw", "xlt"], mimeTypes: ["application/vnd.ms-excel", "application/excel", "application/msexcel", "application/x-excel", "application/x-ms-excel", "application/x-msexcel", "application/x-xls", "application/xls", "application/x-dos_ms_excel", "zz-application/zz-winassoc-xls"], probePriority: 100, contentProbe: true }, { id: "excel_biff8", write: async (...e) => (await import("./biff-YKPDH35C-MVQIWNKV.js")).createBiffWriter(8)(...e), writeStream: async function* (...e) {
39
+ yield* (await import("./biff-YKPDH35C-MVQIWNKV.js")).createBiffStreamWriter(8)(...e);
40
+ }, labelRanges: true, exportOptionRules: { encryption: { kind: "enum", values: Qe } }, direction: "write", description: "MS Excel\u2122 97/2000/XP", extensions: ["xls"], mimeTypes: ["application/vnd.ms-excel"], formatLevel: "auto", defaultSaverPriority: 1 }, { id: "excel_biff7", write: async (...e) => (await import("./biff-YKPDH35C-MVQIWNKV.js")).createBiffWriter(7)(...e), writeStream: async function* (...e) {
41
+ yield* (await import("./biff-YKPDH35C-MVQIWNKV.js")).createBiffStreamWriter(7)(...e);
42
+ }, labelRanges: true, exportOptionRules: { encryption: { kind: "enum", values: ie } }, direction: "write", description: "MS Excel\u2122 5.0/95", extensions: ["xls"], mimeTypes: ["application/vnd.ms-excel"], formatLevel: "auto" }, { id: "excel_dsf", write: async (...e) => (await import("./biff-YKPDH35C-MVQIWNKV.js")).createBiffWriter("dsf")(...e), writeStream: async function* (...e) {
43
+ yield* (await import("./biff-YKPDH35C-MVQIWNKV.js")).createBiffStreamWriter("dsf")(...e);
44
+ }, labelRanges: true, exportOptionRules: { encryption: { kind: "enum", values: ie } }, direction: "write", description: "MS Excel\u2122 97/2000/XP & 5.0/95", extensions: ["xls"], mimeTypes: ["application/vnd.ms-excel"], formatLevel: "auto" }, { id: "excel_enc", direction: "read", read: async (...e) => (await import("./biff-YKPDH35C-MVQIWNKV.js")).readBiff(...e), description: "MS Excel\u2122 (*.xls) requiring encoding specification", extensions: [], probePriority: 200, encodingDependent: true }] };
45
45
  var oe = { id: "Gnumeric_Excel", source: "plugins/excel/plugin.xml.in", services: [{ id: "xlsx", direction: "read", probeContent: async (e, t) => (await import("./xlsx-RE54MFCS-DI3F765V.js")).probeXlsx(e, t), probeSource: async (e, t) => (await import("./xlsx-RE54MFCS-DI3F765V.js")).probeXlsx(e, t), readWorkbookSource: async (e, t) => (await import("./xlsx-RE54MFCS-DI3F765V.js")).readXlsx(e, t, true), readSource: async (e, t) => (await import("./xlsx-RE54MFCS-DI3F765V.js")).readXlsx(e, t), read: async (e, t) => (await import("./xlsx-RE54MFCS-DI3F765V.js")).readXlsx(e, t), description: "ECMA 376 / Office Open XML [MS Excel\u2122 2007/2010] (*.xlsx)", extensions: ["xlsx", "xltx", "xlsb", "xlsm", "xltm"], mimeTypes: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.spreadsheetml.template"], probePriority: 100, contentProbe: true }, { id: "xlsx", direction: "write", sourceAxes: true, write: async (e, t, i) => (await import("./xlsx-RE54MFCS-DI3F765V.js")).createXlsxWriter("2006")(e, t, i), writeStream: async function* (e, t, i) {
46
46
  yield* (await import("./xlsx-RE54MFCS-DI3F765V.js")).createXlsxStreamWriter("2006")(e, t, i);
47
47
  }, writeWorkbookSource: async function* (e, t, i) {
@@ -1,5 +1,10 @@
1
1
  import {
2
- openRetainedPresentationIndex
2
+ openPackageArchive
3
+ } from "./chunk-ZXR6LXV5.js";
4
+ import {
5
+ openRetainedPresentationIndex,
6
+ stageRetainedOutput,
7
+ streamJson
3
8
  } from "./chunk-L5MCW6CM.js";
4
9
  import {
5
10
  writePackageArchive
@@ -325,6 +330,97 @@ async function openRetainedSlideSettings(archive, fingerprint, options, settings
325
330
  }
326
331
  }
327
332
 
333
+ // packages/safe-bash-presentation-engine/src/retained-slide-publication.ts
334
+ import { PagedStorage as PagedStorage2 } from "@poe-platform/safe-fs/storage";
335
+ import { sha256 } from "@noble/hashes/sha2.js";
336
+ async function stageRetainedSlideSettings(input, options, settings, output) {
337
+ const signal = settings.signal ?? new AbortController().signal;
338
+ const hash = sha256.create();
339
+ for await (const bytes of input.stream()) {
340
+ signal.throwIfAborted();
341
+ hash.update(bytes);
342
+ }
343
+ const hex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
344
+ const before = hex(hash.digest());
345
+ const archive = await openPackageArchive(input, settings);
346
+ let mutation, pages, response;
347
+ let closed = false, closing;
348
+ const check = () => {
349
+ if (closed) throw new OfficeError("invalid-handle", "Slide output is closed.", "publish");
350
+ signal.throwIfAborted();
351
+ };
352
+ const close = () => {
353
+ closed = true;
354
+ return closing ??= (async () => {
355
+ const results = await Promise.allSettled([response?.close(), mutation?.close(), pages?.close(), archive.close()]);
356
+ for (const result of results) if (result.status === "rejected") throw result.reason;
357
+ })();
358
+ };
359
+ try {
360
+ mutation = await openRetainedSlideSettings(archive, before, options, settings);
361
+ let size = input.size, fingerprint = before, start = 0;
362
+ if (mutation.changed) {
363
+ const working = settings.workingStorage;
364
+ pages = new PagedStorage2({ fs: working.fs, cwd: working.directory, env: {}, signal }, (working.cacheBytes ?? 1024 * 1024) / 16384);
365
+ start = pages.allocate(0);
366
+ size = 0;
367
+ const digest = sha256.create();
368
+ await archive.rewrite({ async write(bytes2) {
369
+ check();
370
+ for (let offset = 0; offset < bytes2.length; offset += 16384) {
371
+ check();
372
+ const owned = new Uint8Array(bytes2.subarray(offset, offset + 16384));
373
+ await pages.append(owned);
374
+ digest.update(owned);
375
+ size += owned.length;
376
+ }
377
+ } }, { replace: mutation.replacement });
378
+ fingerprint = hex(digest.digest());
379
+ }
380
+ async function* bytes() {
381
+ check();
382
+ if (!pages) {
383
+ yield* input.stream();
384
+ check();
385
+ return;
386
+ }
387
+ for (let offset = 0; offset < size; offset += 16384) {
388
+ check();
389
+ yield await pages.read(start + offset, Math.min(16384, size - offset));
390
+ }
391
+ check();
392
+ }
393
+ async function* locations() {
394
+ for await (const location of mutation.targets()) yield { ...location, fingerprint };
395
+ }
396
+ async function* effects() {
397
+ if (fingerprint !== before) for await (const location of locations()) yield { location, action: "update", feature: "F07" };
398
+ }
399
+ const dryRun = output.dryRun;
400
+ async function* content() {
401
+ if (output.destination === "-" && !dryRun) {
402
+ yield* bytes();
403
+ return;
404
+ }
405
+ if (output.json) {
406
+ yield* streamJson({ version: 1, operation: "slides.set", ok: true, data: {
407
+ effects: effects(),
408
+ outputs: dryRun ? [] : [{ path: output.destination, sha256: fingerprint, bytes: size }],
409
+ fingerprint: dryRun ? null : fingerprint
410
+ }, warnings: [], errors: [], affected: mutation.affected, locations: locations() });
411
+ yield new TextEncoder().encode("\n");
412
+ } else yield new TextEncoder().encode(`${dryRun ? "Validated" : "Updated"} ${mutation.affected} slide(s)
413
+ `);
414
+ }
415
+ response = await stageRetainedOutput(content(), settings, output.maxOutputBytes);
416
+ return Object.freeze({ bytes, size, fingerprint, output: response, close });
417
+ } catch (error) {
418
+ await close().catch(() => {
419
+ });
420
+ throw error;
421
+ }
422
+ }
423
+
328
424
  // packages/safe-bash-presentation-engine/src/slides.ts
329
425
  var contentNamespace = "http://schemas.openxmlformats.org/package/2006/content-types";
330
426
  var packageRelationships = "http://schemas.openxmlformats.org/package/2006/relationships";
@@ -865,6 +961,7 @@ async function mutateSlides(input, options, context) {
865
961
 
866
962
  export {
867
963
  openRetainedSlideSettings,
964
+ stageRetainedSlideSettings,
868
965
  addSlide,
869
966
  prepareSlideInsertion,
870
967
  prepareSlideMutationOptions,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PatchError
3
- } from "./chunk-DPR5CYQV.js";
3
+ } from "./chunk-XITDDJFT.js";
4
4
 
5
5
  // packages/safe-bash-command-apply-patch/src/matcher.ts
6
6
  async function records(text, work) {
@@ -1,5 +1,6 @@
1
1
  // packages/safe-bash-command-apply-patch/src/shared.ts
2
2
  import { utf8ByteLength, bytesFrom } from "../../safe-bash-byte-engine/index.js";
3
+ import { PagedStorageCache } from "@poe-platform/safe-fs/storage";
3
4
  import { yieldTurn } from "../../safe-bash-contracts/yield.js";
4
5
  import { escapeText } from "../../safe-bash-contracts/escaping.js";
5
6
  import { isFsError } from "../../safe-bash-contracts/index.js";
@@ -27,6 +28,7 @@ var Work = class {
27
28
  }
28
29
  context;
29
30
  limits;
31
+ documentCache = new PagedStorageCache(16);
30
32
  units = 0;
31
33
  nextYield = 4096;
32
34
  closed = false;