@poe-platform/safe-bash 0.1.757 → 0.1.759

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 (59) hide show
  1. package/dist/image-ast/index.browser.js +87 -24
  2. package/dist/image-ast/index.js +87 -24
  3. package/dist/pdf-ast/ast.d.ts +3 -0
  4. package/dist/pdf-ast/index.js +103 -41
  5. package/dist/safe-bash/chunks/{chunk-WNWIBBJZ.js → chunk-AYPUGSOV.js} +7 -1
  6. package/dist/safe-bash/command-chunks/{chunk-F3J5ZLKF.js → chunk-522TDVLS.js} +1 -1
  7. package/dist/safe-bash/command-chunks/{chunk-VFS2MDAB.js → chunk-6YLD37NH.js} +2 -2
  8. package/dist/safe-bash/command-chunks/{chunk-YI3GKJ7Q.js → chunk-766IWMTB.js} +2 -2
  9. package/dist/safe-bash/command-chunks/{chunk-WI35236J.js → chunk-7JA44PVV.js} +1 -1
  10. package/dist/safe-bash/command-chunks/{chunk-H2FQA4OU.js → chunk-BAUGDXLZ.js} +87 -25
  11. package/dist/safe-bash/command-chunks/{chunk-KSH2F6RG.js → chunk-CUFCNL6G.js} +1 -1
  12. package/dist/safe-bash/command-chunks/{chunk-KBBI4CSU.js → chunk-HVEAK3OS.js} +2 -2
  13. package/dist/safe-bash/command-chunks/{chunk-S4MLIYSN.js → chunk-J2NPH7DO.js} +4 -0
  14. package/dist/safe-bash/command-chunks/{chunk-4F6PG2OT.js → chunk-YJWWRCIG.js} +8 -8
  15. package/dist/safe-bash/commands/python/index.browser.js +1 -1
  16. package/dist/safe-bash/commands/python/shell-capability.js +10 -2
  17. package/dist/safe-bash/core.browser.js +1 -1
  18. package/dist/safe-bash-command-column/column.js +3 -3
  19. package/dist/safe-bash-command-column/index.js +3 -3
  20. package/dist/safe-bash-command-column/layout.js +2 -2
  21. package/dist/safe-bash-command-factor/command.js +2 -2
  22. package/dist/safe-bash-command-factor/index.js +2 -2
  23. package/dist/safe-bash-command-ffmpeg/index.js +6300 -6265
  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 +87 -24
  28. package/dist/safe-bash-command-pdfinfo/index.js +103 -41
  29. package/dist/safe-bash-command-pdftk/index.js +87 -24
  30. package/dist/safe-bash-command-pdftoppm/index.js +103 -41
  31. package/dist/safe-bash-command-pdftotext/index.js +87 -24
  32. package/dist/safe-bash-command-qpdf/index.js +87 -24
  33. package/dist/safe-bash-command-sips/index.js +2 -2
  34. package/dist/safe-bash-command-soffice/index.js +2 -2
  35. package/dist/safe-bash-command-ssconvert/command-bindings.d.ts +18 -0
  36. package/dist/safe-bash-command-ssconvert/command.d.ts +5 -14
  37. package/dist/safe-bash-command-ssconvert/commands.d.ts +6 -0
  38. package/dist/safe-bash-command-ssconvert/commands.js +871 -0
  39. package/dist/safe-bash-command-ssconvert/core.js +1 -1
  40. package/dist/safe-bash-command-ssconvert/index.js +306 -236
  41. package/dist/safe-bash-command-wkhtmltopdf/index.js +88 -24
  42. package/dist/safe-bash-command-yq/index.js +4 -4
  43. package/dist/safe-bash-compression-engine/files.js +2 -2
  44. package/dist/safe-bash-compression-engine/operand.js +4 -4
  45. package/dist/safe-bash-markdown-engine/commonmark-blocks.js +4 -4
  46. package/dist/safe-bash-markdown-engine/commonmark-inlines.js +4 -4
  47. package/dist/safe-bash-markdown-engine/commonmark-syntax.js +2 -2
  48. package/dist/safe-bash-markdown-engine/gfm-syntax.js +3 -3
  49. package/dist/safe-bash-markdown-engine/index.js +7 -7
  50. package/dist/safe-bash-query-engine/index.js +5 -5
  51. package/dist/safe-bash-query-engine/interpreter.js +4 -4
  52. package/dist/safe-bash-query-engine/query-core.js +5 -5
  53. package/package.json +6 -2
  54. package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +30 -0
  55. package/dist/safe-bash/command-chunks/{chunk-OQVIJMBY.js → chunk-7HINP7ZK.js} +4 -4
  56. package/dist/safe-bash/command-chunks/{chunk-XAYEDOV5.js → chunk-CG4JSOK2.js} +3 -3
  57. package/dist/safe-bash/command-chunks/{chunk-YIK4ZYQ4.js → chunk-DC52GWRK.js} +9 -9
  58. package/dist/safe-bash/command-chunks/{chunk-TOTZFBDT.js → chunk-TKACIO4X.js} +4 -4
  59. package/dist/safe-bash/command-chunks/{chunk-VTWKS4RM.js → chunk-WF2LSKMI.js} +3 -3
@@ -4,7 +4,7 @@ import {
4
4
 
5
5
  // packages/pdf-ast/src/cos/filters.ts
6
6
  init_buffer();
7
- import { deflate, Inflate } from "pako";
7
+ import { deflate, Inflate, Z_BUF_ERROR } from "pako";
8
8
 
9
9
  // packages/pdf-ast/src/vendor/pdfjs-fonts.mjs
10
10
  init_buffer();
@@ -19365,22 +19365,31 @@ function decodeFlate(bytes, parms, maxDecodedBytes = DEFAULT_MAX_DECODED_BYTES)
19365
19365
  inflated = new BoundedFlateStream(bytes, maxDecodedBytes).getBytes();
19366
19366
  } catch (error) {
19367
19367
  if (error instanceof PdfError && error.code === "E_LIMIT") throw error;
19368
+ const wrapped = bytes[0] === 31 && bytes[1] === 139 || bytes.length >= 2 && (bytes[0] & 15) === 8 && bytes[0] >>> 4 <= 7 && (bytes[0] << 8 | bytes[1]) % 31 === 0;
19368
19369
  const decoder = new Inflate({
19369
- raw: !(bytes[0] === 31 && bytes[1] === 139),
19370
+ raw: !wrapped,
19370
19371
  chunkSize: Math.max(1, Math.min(64 * 1024, maxDecodedBytes + 1))
19371
19372
  });
19373
+ const chunks = [];
19372
19374
  let length = 0;
19373
19375
  decoder.onData = (chunk) => {
19374
19376
  length += chunk.length;
19375
19377
  if (length > maxDecodedBytes) {
19376
19378
  throw new PdfError("E_LIMIT", "FlateDecode output exceeds maximum decoded byte budget");
19377
19379
  }
19378
- decoder.chunks.push(chunk);
19380
+ chunks.push(chunk);
19379
19381
  };
19380
- if (!decoder.push(bytes, true) || decoder.err || !decoder.ended) {
19382
+ const complete = decoder.push(bytes, true);
19383
+ const truncated = wrapped && decoder.err === Z_BUF_ERROR && length > 0;
19384
+ if ((!complete || decoder.err || !decoder.ended) && !truncated) {
19381
19385
  throw new PdfError("E_CAPABILITY", "Invalid FlateDecode compressed stream");
19382
19386
  }
19383
- inflated = decoder.result;
19387
+ inflated = new Uint8Array(length);
19388
+ let offset = 0;
19389
+ for (const chunk of chunks) {
19390
+ inflated.set(chunk, offset);
19391
+ offset += chunk.length;
19392
+ }
19384
19393
  }
19385
19394
  return applyPredictor(inflated, parms);
19386
19395
  }
@@ -28747,7 +28756,7 @@ var ParsedCosDocument = class {
28747
28756
  return void 0;
28748
28757
  }
28749
28758
  };
28750
- function parseNodeFromLexer(lexer, bytes, maxDepth, recoverEmptyObject = false) {
28759
+ function parseNodeFromLexer(lexer, bytes, maxDepth, repair = false) {
28751
28760
  const stack = [];
28752
28761
  while (true) {
28753
28762
  const tok = lexer.nextToken();
@@ -28756,7 +28765,7 @@ function parseNodeFromLexer(lexer, bytes, maxDepth, recoverEmptyObject = false)
28756
28765
  if (!parent) return void 0;
28757
28766
  throw new PdfError("E_PARSE", parent.kind === "array" ? "Unterminated PDF array" : "Unterminated PDF dictionary");
28758
28767
  }
28759
- if (!parent && recoverEmptyObject && tok.kind === "keyword" && tok.value === "endobj") {
28768
+ if (!parent && repair && tok.kind === "keyword" && tok.value === "endobj") {
28760
28769
  return { kind: "null", span: tok.span };
28761
28770
  }
28762
28771
  let node;
@@ -28771,6 +28780,7 @@ function parseNodeFromLexer(lexer, bytes, maxDepth, recoverEmptyObject = false)
28771
28780
  parent.key = { kind: "name", rawBytes: tok.rawBytes, decoded: tok.decoded, span: tok.span };
28772
28781
  continue;
28773
28782
  } else {
28783
+ if (repair) continue;
28774
28784
  throw new PdfError("E_PARSE", `Expected dictionary key /Name, got ${tok.kind}`);
28775
28785
  }
28776
28786
  } else {
@@ -28939,7 +28949,7 @@ function parseHeaderVersion(bytes) {
28939
28949
  }
28940
28950
  return head.slice(idx + 5, idx + 8);
28941
28951
  }
28942
- function parseObjectAtOffset(bytes, offset, maxRecursionDepth, recoverEmptyObject = false) {
28952
+ function parseObjectAtOffset(bytes, offset, maxRecursionDepth, repair = false) {
28943
28953
  const lexer = new CosByteLexer(bytes, offset);
28944
28954
  const objNumTok = lexer.nextToken();
28945
28955
  const genNumTok = lexer.nextToken();
@@ -28947,7 +28957,7 @@ function parseObjectAtOffset(bytes, offset, maxRecursionDepth, recoverEmptyObjec
28947
28957
  if (objNumTok?.kind !== "number" || genNumTok?.kind !== "number" || objKwTok?.kind !== "keyword" || objKwTok.value !== "obj") {
28948
28958
  throw new PdfError("E_PARSE", `Malformed indirect object header at byte offset ${offset}`);
28949
28959
  }
28950
- const value = parseNodeFromLexer(lexer, bytes, maxRecursionDepth, recoverEmptyObject);
28960
+ const value = parseNodeFromLexer(lexer, bytes, maxRecursionDepth, repair);
28951
28961
  if (!value) {
28952
28962
  throw new PdfError("E_PARSE", `Empty indirect object ${objNumTok.value} at offset ${offset}`);
28953
28963
  }
@@ -29136,7 +29146,7 @@ function repairScanCosDocument(bytes, maxObjects, maxRecursionDepth) {
29136
29146
  try {
29137
29147
  const token = lexer.nextToken();
29138
29148
  if (token?.kind === "keyword" && token.value === "trailer") {
29139
- const trailer = parseNodeFromLexer(lexer, bytes, maxRecursionDepth);
29149
+ const trailer = parseNodeFromLexer(lexer, bytes, maxRecursionDepth, true);
29140
29150
  if (trailer?.kind === "dict") trailers.push(trailer);
29141
29151
  pos = lexer.offset;
29142
29152
  continue;
@@ -29192,7 +29202,7 @@ function unpackRecoveredObjects(objects, maxObjects, maxDecompressedBytes, maxRe
29192
29202
  const t = dictGet(obj.value.dict, "Type");
29193
29203
  if (t?.kind === "name" && t.decoded === "ObjStm") {
29194
29204
  try {
29195
- for (const [unpackedNum, unpackedVal] of unpackObjectStream(obj.value, maxDecompressedBytes, maxRecursionDepth).entries()) {
29205
+ for (const [unpackedNum, unpackedVal] of unpackObjectStream(obj.value, maxDecompressedBytes, maxRecursionDepth, true).entries()) {
29196
29206
  if (!objects.has(unpackedNum)) {
29197
29207
  objects.set(unpackedNum, {
29198
29208
  objectNumber: unpackedNum,
@@ -29228,7 +29238,7 @@ function recoveredReferences(objects) {
29228
29238
  }
29229
29239
  return { ...rootRef ? { rootRef } : {}, ...infoRef ? { infoRef } : {} };
29230
29240
  }
29231
- function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth) {
29241
+ function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth, repair = false) {
29232
29242
  const nNode = dictGet(streamObj.dict, "N");
29233
29243
  const firstNode = dictGet(streamObj.dict, "First");
29234
29244
  if (nNode?.kind !== "number" || firstNode?.kind !== "number") {
@@ -29248,7 +29258,7 @@ function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth)
29248
29258
  for (const pair of pairs) {
29249
29259
  try {
29250
29260
  const valLexer = new CosByteLexer(decoded, firstNode.value + pair.relativeOffset);
29251
- const node = parseNodeFromLexer(valLexer, decoded, maxRecursionDepth);
29261
+ const node = parseNodeFromLexer(valLexer, decoded, maxRecursionDepth, repair);
29252
29262
  if (node) {
29253
29263
  result.set(pair.objectNumber, node);
29254
29264
  }
@@ -29431,7 +29441,7 @@ function parseCosDocument(bytes, options = {}) {
29431
29441
  if (!unpacked) {
29432
29442
  const stmObj = objects.get(entry.objectStreamNumber)?.value;
29433
29443
  if (stmObj?.kind === "stream") {
29434
- unpacked = unpackObjectStream(stmObj, maxDecompressedBytes, maxRecursionDepth);
29444
+ unpacked = unpackObjectStream(stmObj, maxDecompressedBytes, maxRecursionDepth, recovery === "repair");
29435
29445
  objStmCache.set(entry.objectStreamNumber, unpacked);
29436
29446
  }
29437
29447
  }
@@ -30939,7 +30949,11 @@ function resolvePageFonts(doc, resourcesDict) {
30939
30949
  let cmap;
30940
30950
  const toUniNode = doc.resolve(dictGet(fObj, "ToUnicode"));
30941
30951
  if (toUniNode?.kind === "stream") {
30942
- cmap = parseToUnicodeCMap(doc.decodeStream(toUniNode));
30952
+ try {
30953
+ cmap = parseToUnicodeCMap(doc.decodeStream(toUniNode));
30954
+ } catch (error) {
30955
+ if (error instanceof PdfError && error.code === "E_LIMIT") throw error;
30956
+ }
30943
30957
  }
30944
30958
  const encNode = doc.resolve(dictGet(fObj, "Encoding"));
30945
30959
  if (encNode?.kind === "dict") {
@@ -30955,7 +30969,7 @@ function resolvePageFonts(doc, resourcesDict) {
30955
30969
  const glyphNames = buildFontEncodingGlyphNamesMap(encNode);
30956
30970
  const widths = /* @__PURE__ */ new Map();
30957
30971
  let defaultWidth = 556;
30958
- const isTwoByteCid = subtype === "Type0" || Boolean(cmap?.isTwoByte);
30972
+ const isTwoByteCid = subtype === "Type0";
30959
30973
  let fontMatrix;
30960
30974
  let charProcs;
30961
30975
  let fontResources;
@@ -32063,8 +32077,12 @@ function evaluateContentStreamToDisplayList(params) {
32063
32077
  const images = [];
32064
32078
  const operations = [];
32065
32079
  const emit = (operation) => {
32066
- const clipPaths = curState().clipPaths;
32067
- if (clipPaths) operation = { ...operation, value: { ...operation.value, clipPaths } };
32080
+ const { clipPaths, clipImages } = curState();
32081
+ if (clipPaths || clipImages) operation = { ...operation, value: {
32082
+ ...operation.value,
32083
+ ...clipPaths ? { clipPaths } : {},
32084
+ ...clipImages ? { clipImages } : {}
32085
+ } };
32068
32086
  operations.push(operation);
32069
32087
  switch (operation.kind) {
32070
32088
  case "path":
@@ -32328,6 +32346,18 @@ function evaluateContentStreamToDisplayList(params) {
32328
32346
  let hasTextClip = false;
32329
32347
  let activeTm = [1, 0, 0, 1, 0, 0];
32330
32348
  let activeTlm = [1, 0, 0, 1, 0, 0];
32349
+ const paintImage = (image, patternMask, resources, activeFonts, depth) => {
32350
+ if (!patternMask) {
32351
+ emit({ kind: "image", value: image });
32352
+ return;
32353
+ }
32354
+ const st = curState();
32355
+ stateStack.push({ ...st, clipImages: [...st.clipImages ?? [], image] });
32356
+ walkNodes([{ kind: "path-op", paint: "f", segments: [
32357
+ { kind: "rect", x: 0, y: 0, width: 1, height: 1 }
32358
+ ] }], void 0, void 0, resources, activeFonts, depth);
32359
+ stateStack.pop();
32360
+ };
32331
32361
  const walkNodes = (nodes, mcid, actualText, activeResources = params.resourcesDict, activeFonts = fonts, depth = 0) => {
32332
32362
  for (const node of nodes) {
32333
32363
  switch (node.kind) {
@@ -32511,7 +32541,8 @@ function evaluateContentStreamToDisplayList(params) {
32511
32541
  st.fillAlpha,
32512
32542
  "PatternShading_" + st.fillPatternName,
32513
32543
  patClip,
32514
- shading?.kind === "stream" ? shading : void 0
32544
+ shading?.kind === "stream" ? shading : void 0,
32545
+ st.blendMode
32515
32546
  );
32516
32547
  if (shImg) {
32517
32548
  emit({ kind: "image", value: shImg });
@@ -32620,18 +32651,20 @@ function evaluateContentStreamToDisplayList(params) {
32620
32651
  const subNode = params.cosDoc.resolve(dictGet(xobjNode.dict, "Subtype"));
32621
32652
  const sub = subNode?.kind === "name" ? subNode.decoded : "";
32622
32653
  if (sub === "Image") {
32654
+ const maskNode = params.cosDoc.resolve(dictGet(xobjNode.dict, "ImageMask"));
32655
+ const patternMask = !!st.fillPatternName && maskNode?.kind === "boolean" && maskNode.value;
32623
32656
  const decoded = decodeXObjectImageToRgba(
32624
32657
  params.cosDoc,
32625
32658
  xobjNode,
32626
32659
  activeResources,
32627
- {
32660
+ patternMask ? { r: 1, g: 1, b: 1, alpha: 1 } : {
32628
32661
  r: st.fillColor.r,
32629
32662
  g: st.fillColor.g,
32630
32663
  b: st.fillColor.b,
32631
32664
  alpha: st.fillAlpha
32632
32665
  }
32633
32666
  );
32634
- emit({ kind: "image", value: {
32667
+ paintImage({
32635
32668
  name: node.name,
32636
32669
  matrix: [...st.ctm],
32637
32670
  width: decoded.width,
@@ -32641,7 +32674,7 @@ function evaluateContentStreamToDisplayList(params) {
32641
32674
  decodedRgba: decoded.rgba,
32642
32675
  ...st.blendMode && st.blendMode !== "Normal" ? { blendMode: st.blendMode } : {},
32643
32676
  ...st.clipRect ? { clipRect: [...st.clipRect] } : {}
32644
- } });
32677
+ }, patternMask, activeResources, activeFonts, depth);
32645
32678
  } else if (sub === "Form" && depth < 8) {
32646
32679
  const formStreamBytes = params.cosDoc.decodeStream(xobjNode);
32647
32680
  const formNodes = parseContentStream(formStreamBytes);
@@ -32697,19 +32730,22 @@ function evaluateContentStreamToDisplayList(params) {
32697
32730
  }
32698
32731
  case "inline-image": {
32699
32732
  const st = curState();
32733
+ const maskEntry = dictGet(node.dict, "ImageMask") ?? dictGet(node.dict, "IM");
32734
+ const maskNode = params.cosDoc ? params.cosDoc.resolve(maskEntry) : maskEntry;
32735
+ const patternMask = !!st.fillPatternName && maskNode?.kind === "boolean" && maskNode.value;
32700
32736
  const decoded = decodeInlineImageNodeToRgba(
32701
32737
  params.cosDoc,
32702
32738
  node.dict,
32703
32739
  node.data,
32704
32740
  activeResources,
32705
- {
32741
+ patternMask ? { r: 1, g: 1, b: 1, alpha: 1 } : {
32706
32742
  r: st.fillColor.r,
32707
32743
  g: st.fillColor.g,
32708
32744
  b: st.fillColor.b,
32709
32745
  alpha: st.fillAlpha
32710
32746
  }
32711
32747
  );
32712
- emit({ kind: "image", value: {
32748
+ paintImage({
32713
32749
  name: "InlineImage",
32714
32750
  matrix: [...st.ctm],
32715
32751
  width: decoded.width,
@@ -32719,7 +32755,7 @@ function evaluateContentStreamToDisplayList(params) {
32719
32755
  decodedRgba: decoded.rgba,
32720
32756
  ...st.blendMode && st.blendMode !== "Normal" ? { blendMode: st.blendMode } : {},
32721
32757
  ...st.clipRect ? { clipRect: [...st.clipRect] } : {}
32722
- } });
32758
+ }, patternMask, activeResources, activeFonts, depth);
32723
32759
  break;
32724
32760
  }
32725
32761
  case "text-object": {
@@ -34854,6 +34890,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
34854
34890
  const aaVec = options.antialiasVector !== false;
34855
34891
  const aaTxt = options.antialiasText !== false;
34856
34892
  const clipMasks = /* @__PURE__ */ new Map();
34893
+ const imageClipMasks = /* @__PURE__ */ new Map();
34857
34894
  for (const original of paintOperations(displayList)) {
34858
34895
  if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
34859
34896
  const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
@@ -34868,6 +34905,31 @@ function renderDisplayListToBitmap(displayList, options = {}) {
34868
34905
  }
34869
34906
  clipMasks.set(clips, clipMask);
34870
34907
  }
34908
+ const imageClips = original.value.clipImages;
34909
+ if (imageClips) {
34910
+ let imageMask = imageClipMasks.get(imageClips);
34911
+ if (!imageMask) {
34912
+ imageMask = new Uint8Array(width * height * 4).fill(255);
34913
+ for (const image of imageClips) {
34914
+ const layer = renderDisplayListToBitmap({
34915
+ ...displayList,
34916
+ rotation: 0,
34917
+ paths: [],
34918
+ glyphs: [],
34919
+ images: [image],
34920
+ operations: [{ kind: "image", value: image }]
34921
+ }, { scale, transparent: true }).data;
34922
+ for (let i = 3; i < layer.length; i += 4) imageMask[i] = Math.round(imageMask[i] * layer[i] / 255);
34923
+ }
34924
+ imageClipMasks.set(imageClips, imageMask);
34925
+ }
34926
+ if (clipMask) {
34927
+ clipMask = clipMask.slice();
34928
+ for (let i = 3; i < clipMask.length; i += 4) clipMask[i] = Math.round(clipMask[i] * imageMask[i] / 255);
34929
+ } else {
34930
+ clipMask = imageMask;
34931
+ }
34932
+ }
34871
34933
  if (operation.kind === "path") {
34872
34934
  const path = operation.value;
34873
34935
  if (path.fillColor) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Interpreter
3
- } from "./chunk-YIK4ZYQ4.js";
3
+ } from "./chunk-DC52GWRK.js";
4
4
  import {
5
5
  parse
6
6
  } from "./chunk-ACRMXIQC.js";
@@ -48,11 +48,11 @@ import {
48
48
  trimImage,
49
49
  unflattenImage,
50
50
  unpremultiplyRgbaImage
51
- } from "./chunk-WI35236J.js";
51
+ } from "./chunk-7JA44PVV.js";
52
52
  import {
53
53
  PdfDocument,
54
54
  encodePng
55
- } from "./chunk-H2FQA4OU.js";
55
+ } from "./chunk-BAUGDXLZ.js";
56
56
  import {
57
57
  createLuaFilterCapability
58
58
  } from "./chunk-Y2KHC6TZ.js";
@@ -5141,7 +5141,11 @@ function createResourceIO(options) {
5141
5141
  init_buffer();
5142
5142
 
5143
5143
  export {
5144
+ compareServiceIds,
5144
5145
  createRegistry,
5146
+ FileWriteError,
5147
+ ioFailure,
5148
+ imageFormats,
5145
5149
  defaultSsconvertLimits,
5146
5150
  createEngine,
5147
5151
  createResourceIO
@@ -1,6 +1,13 @@
1
1
  import {
2
2
  configuredTable
3
- } from "./chunk-TOTZFBDT.js";
3
+ } from "./chunk-TKACIO4X.js";
4
+ import {
5
+ cell,
6
+ decode,
7
+ fields,
8
+ validateScalar,
9
+ whitespace
10
+ } from "./chunk-FXNKUBHR.js";
4
11
  import {
5
12
  ColumnInputs,
6
13
  diagnostics
@@ -11,13 +18,6 @@ import {
11
18
  settings,
12
19
  usage
13
20
  } from "./chunk-6WTZPHDU.js";
14
- import {
15
- cell,
16
- decode,
17
- fields,
18
- validateScalar,
19
- whitespace
20
- } from "./chunk-FXNKUBHR.js";
21
21
  import {
22
22
  init_buffer
23
23
  } from "./chunk-HX3SHTCE.js";
@@ -16,7 +16,7 @@ import {
16
16
  pythonCommands,
17
17
  pythonDocumentPackages,
18
18
  pythonHostFailureCode
19
- } from "../../chunks/chunk-WNWIBBJZ.js";
19
+ } from "../../chunks/chunk-AYPUGSOV.js";
20
20
  import {
21
21
  PythonFailure,
22
22
  inspectPythonCapabilities
@@ -73,10 +73,15 @@ export function createPythonShellCapability(context, options = {}) {
73
73
  const stdout = [];
74
74
  const stderr = [];
75
75
  let captured = 0;
76
+ let outputFailure;
76
77
  const sink = (target, type) => ({ async write(chunk) {
77
78
  childSignal.throwIfAborted();
78
- if (chunk.length > outputLimit - captured)
79
- throw new RangeError('Python shell output limit exceeded');
79
+ if (outputFailure)
80
+ throw outputFailure;
81
+ if (chunk.length > outputLimit - captured) {
82
+ outputFailure = new RangeError('Python shell output limit exceeded');
83
+ throw outputFailure;
84
+ }
80
85
  captured += chunk.length;
81
86
  if (publish) {
82
87
  for (let offset = 0; offset < chunk.length; offset += chunkBytes) {
@@ -97,6 +102,9 @@ export function createPythonShellCapability(context, options = {}) {
97
102
  stdin: childInput, stdout: sink(stdout, 'stdout'), stderr: sink(stderr, 'stderr'), externalInvocation: true,
98
103
  });
99
104
  childSignal.throwIfAborted();
105
+ // A command may catch sink rejection and return a status; the host limit still failed.
106
+ if (outputFailure)
107
+ throw outputFailure;
100
108
  return { stdout, stderr, exitCode: result.exitCode };
101
109
  }
102
110
  catch (error) {
@@ -158,7 +158,7 @@ import {
158
158
  sha256,
159
159
  sha384,
160
160
  sha512
161
- } from "./chunks/chunk-WNWIBBJZ.js";
161
+ } from "./chunks/chunk-AYPUGSOV.js";
162
162
  import {
163
163
  PythonFailure,
164
164
  inspectPythonCapabilities
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  createColumnCommand
3
- } from "../safe-bash/command-chunks/chunk-4F6PG2OT.js";
4
- import "../safe-bash/command-chunks/chunk-TOTZFBDT.js";
3
+ } from "../safe-bash/command-chunks/chunk-YJWWRCIG.js";
4
+ import "../safe-bash/command-chunks/chunk-TKACIO4X.js";
5
+ import "../safe-bash/command-chunks/chunk-FXNKUBHR.js";
5
6
  import "../safe-bash/command-chunks/chunk-JWRXOTLM.js";
6
7
  import "../safe-bash/command-chunks/chunk-XBWDYU3X.js";
7
8
  import "../safe-bash/command-chunks/chunk-6WTZPHDU.js";
8
- import "../safe-bash/command-chunks/chunk-FXNKUBHR.js";
9
9
  import "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
10
10
  export {
11
11
  createColumnCommand
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  createColumnCommand
3
- } from "../safe-bash/command-chunks/chunk-4F6PG2OT.js";
4
- import "../safe-bash/command-chunks/chunk-TOTZFBDT.js";
3
+ } from "../safe-bash/command-chunks/chunk-YJWWRCIG.js";
4
+ import "../safe-bash/command-chunks/chunk-TKACIO4X.js";
5
+ import "../safe-bash/command-chunks/chunk-FXNKUBHR.js";
5
6
  import "../safe-bash/command-chunks/chunk-JWRXOTLM.js";
6
7
  import "../safe-bash/command-chunks/chunk-XBWDYU3X.js";
7
8
  import "../safe-bash/command-chunks/chunk-6WTZPHDU.js";
8
- import "../safe-bash/command-chunks/chunk-FXNKUBHR.js";
9
9
  import {
10
10
  init_buffer
11
11
  } from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  configuredTable
3
- } from "../safe-bash/command-chunks/chunk-TOTZFBDT.js";
3
+ } from "../safe-bash/command-chunks/chunk-TKACIO4X.js";
4
+ import "../safe-bash/command-chunks/chunk-FXNKUBHR.js";
4
5
  import "../safe-bash/command-chunks/chunk-JWRXOTLM.js";
5
6
  import "../safe-bash/command-chunks/chunk-XBWDYU3X.js";
6
7
  import "../safe-bash/command-chunks/chunk-6WTZPHDU.js";
7
- import "../safe-bash/command-chunks/chunk-FXNKUBHR.js";
8
8
  import "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
9
9
  export {
10
10
  configuredTable
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createFactorCommand
3
- } from "../safe-bash/command-chunks/chunk-OQVIJMBY.js";
3
+ } from "../safe-bash/command-chunks/chunk-7HINP7ZK.js";
4
+ import "../safe-bash/command-chunks/chunk-MYVOHXZB.js";
4
5
  import "../safe-bash/command-chunks/chunk-QE6VKMVV.js";
5
6
  import "../safe-bash/command-chunks/chunk-4SYSDBZA.js";
6
- import "../safe-bash/command-chunks/chunk-MYVOHXZB.js";
7
7
  import "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
8
8
  export {
9
9
  createFactorCommand
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createFactorCommand
3
- } from "../safe-bash/command-chunks/chunk-OQVIJMBY.js";
3
+ } from "../safe-bash/command-chunks/chunk-7HINP7ZK.js";
4
+ import "../safe-bash/command-chunks/chunk-MYVOHXZB.js";
4
5
  import "../safe-bash/command-chunks/chunk-QE6VKMVV.js";
5
6
  import "../safe-bash/command-chunks/chunk-4SYSDBZA.js";
6
- import "../safe-bash/command-chunks/chunk-MYVOHXZB.js";
7
7
  import {
8
8
  init_buffer
9
9
  } from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";