@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.
- package/dist/image-ast/index.browser.js +87 -24
- package/dist/image-ast/index.js +87 -24
- package/dist/pdf-ast/ast.d.ts +3 -0
- package/dist/pdf-ast/index.js +103 -41
- package/dist/safe-bash/chunks/{chunk-WNWIBBJZ.js → chunk-AYPUGSOV.js} +7 -1
- package/dist/safe-bash/command-chunks/{chunk-F3J5ZLKF.js → chunk-522TDVLS.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-VFS2MDAB.js → chunk-6YLD37NH.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-YI3GKJ7Q.js → chunk-766IWMTB.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-WI35236J.js → chunk-7JA44PVV.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-H2FQA4OU.js → chunk-BAUGDXLZ.js} +87 -25
- package/dist/safe-bash/command-chunks/{chunk-KSH2F6RG.js → chunk-CUFCNL6G.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-KBBI4CSU.js → chunk-HVEAK3OS.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-S4MLIYSN.js → chunk-J2NPH7DO.js} +4 -0
- package/dist/safe-bash/command-chunks/{chunk-4F6PG2OT.js → chunk-YJWWRCIG.js} +8 -8
- package/dist/safe-bash/commands/python/index.browser.js +1 -1
- package/dist/safe-bash/commands/python/shell-capability.js +10 -2
- package/dist/safe-bash/core.browser.js +1 -1
- package/dist/safe-bash-command-column/column.js +3 -3
- package/dist/safe-bash-command-column/index.js +3 -3
- package/dist/safe-bash-command-column/layout.js +2 -2
- package/dist/safe-bash-command-factor/command.js +2 -2
- package/dist/safe-bash-command-factor/index.js +2 -2
- package/dist/safe-bash-command-ffmpeg/index.js +6300 -6265
- package/dist/safe-bash-command-imagemagick/index.js +2 -2
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pdfimages/index.js +87 -24
- package/dist/safe-bash-command-pdfinfo/index.js +103 -41
- package/dist/safe-bash-command-pdftk/index.js +87 -24
- package/dist/safe-bash-command-pdftoppm/index.js +103 -41
- package/dist/safe-bash-command-pdftotext/index.js +87 -24
- package/dist/safe-bash-command-qpdf/index.js +87 -24
- package/dist/safe-bash-command-sips/index.js +2 -2
- package/dist/safe-bash-command-soffice/index.js +2 -2
- package/dist/safe-bash-command-ssconvert/command-bindings.d.ts +18 -0
- package/dist/safe-bash-command-ssconvert/command.d.ts +5 -14
- package/dist/safe-bash-command-ssconvert/commands.d.ts +6 -0
- package/dist/safe-bash-command-ssconvert/commands.js +871 -0
- package/dist/safe-bash-command-ssconvert/core.js +1 -1
- package/dist/safe-bash-command-ssconvert/index.js +306 -236
- package/dist/safe-bash-command-wkhtmltopdf/index.js +88 -24
- package/dist/safe-bash-command-yq/index.js +4 -4
- package/dist/safe-bash-compression-engine/files.js +2 -2
- package/dist/safe-bash-compression-engine/operand.js +4 -4
- package/dist/safe-bash-markdown-engine/commonmark-blocks.js +4 -4
- package/dist/safe-bash-markdown-engine/commonmark-inlines.js +4 -4
- package/dist/safe-bash-markdown-engine/commonmark-syntax.js +2 -2
- package/dist/safe-bash-markdown-engine/gfm-syntax.js +3 -3
- package/dist/safe-bash-markdown-engine/index.js +7 -7
- package/dist/safe-bash-query-engine/index.js +5 -5
- package/dist/safe-bash-query-engine/interpreter.js +4 -4
- package/dist/safe-bash-query-engine/query-core.js +5 -5
- package/package.json +6 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +30 -0
- package/dist/safe-bash/command-chunks/{chunk-OQVIJMBY.js → chunk-7HINP7ZK.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-XAYEDOV5.js → chunk-CG4JSOK2.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-YIK4ZYQ4.js → chunk-DC52GWRK.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-TOTZFBDT.js → chunk-TKACIO4X.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-VTWKS4RM.js → chunk-WF2LSKMI.js} +3 -3
|
@@ -656,6 +656,7 @@ var messages_default = {
|
|
|
656
656
|
"-5": "buffer error",
|
|
657
657
|
"-6": "incompatible version"
|
|
658
658
|
};
|
|
659
|
+
var Z_BUF_ERROR = -5;
|
|
659
660
|
var MAX_MEM_LEVEL = 9;
|
|
660
661
|
var HEAP_SIZE = 573;
|
|
661
662
|
var MIN_MATCH = 3;
|
|
@@ -22547,22 +22548,31 @@ function decodeFlate(bytes, parms, maxDecodedBytes = DEFAULT_MAX_DECODED_BYTES)
|
|
|
22547
22548
|
inflated = new BoundedFlateStream(bytes, maxDecodedBytes).getBytes();
|
|
22548
22549
|
} catch (error) {
|
|
22549
22550
|
if (error instanceof PdfError && error.code === "E_LIMIT") throw error;
|
|
22551
|
+
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;
|
|
22550
22552
|
const decoder = new Inflate({
|
|
22551
|
-
raw: !
|
|
22553
|
+
raw: !wrapped,
|
|
22552
22554
|
chunkSize: Math.max(1, Math.min(64 * 1024, maxDecodedBytes + 1))
|
|
22553
22555
|
});
|
|
22556
|
+
const chunks = [];
|
|
22554
22557
|
let length = 0;
|
|
22555
22558
|
decoder.onData = (chunk) => {
|
|
22556
22559
|
length += chunk.length;
|
|
22557
22560
|
if (length > maxDecodedBytes) {
|
|
22558
22561
|
throw new PdfError("E_LIMIT", "FlateDecode output exceeds maximum decoded byte budget");
|
|
22559
22562
|
}
|
|
22560
|
-
|
|
22563
|
+
chunks.push(chunk);
|
|
22561
22564
|
};
|
|
22562
|
-
|
|
22565
|
+
const complete = decoder.push(bytes, true);
|
|
22566
|
+
const truncated = wrapped && decoder.err === Z_BUF_ERROR && length > 0;
|
|
22567
|
+
if ((!complete || decoder.err || !decoder.ended) && !truncated) {
|
|
22563
22568
|
throw new PdfError("E_CAPABILITY", "Invalid FlateDecode compressed stream");
|
|
22564
22569
|
}
|
|
22565
|
-
inflated =
|
|
22570
|
+
inflated = new Uint8Array(length);
|
|
22571
|
+
let offset = 0;
|
|
22572
|
+
for (const chunk of chunks) {
|
|
22573
|
+
inflated.set(chunk, offset);
|
|
22574
|
+
offset += chunk.length;
|
|
22575
|
+
}
|
|
22566
22576
|
}
|
|
22567
22577
|
return applyPredictor(inflated, parms);
|
|
22568
22578
|
}
|
|
@@ -25274,7 +25284,7 @@ var ParsedCosDocument = class {
|
|
|
25274
25284
|
return void 0;
|
|
25275
25285
|
}
|
|
25276
25286
|
};
|
|
25277
|
-
function parseNodeFromLexer(lexer, bytes, maxDepth,
|
|
25287
|
+
function parseNodeFromLexer(lexer, bytes, maxDepth, repair = false) {
|
|
25278
25288
|
const stack = [];
|
|
25279
25289
|
while (true) {
|
|
25280
25290
|
const tok = lexer.nextToken();
|
|
@@ -25283,7 +25293,7 @@ function parseNodeFromLexer(lexer, bytes, maxDepth, recoverEmptyObject = false)
|
|
|
25283
25293
|
if (!parent) return void 0;
|
|
25284
25294
|
throw new PdfError("E_PARSE", parent.kind === "array" ? "Unterminated PDF array" : "Unterminated PDF dictionary");
|
|
25285
25295
|
}
|
|
25286
|
-
if (!parent &&
|
|
25296
|
+
if (!parent && repair && tok.kind === "keyword" && tok.value === "endobj") {
|
|
25287
25297
|
return { kind: "null", span: tok.span };
|
|
25288
25298
|
}
|
|
25289
25299
|
let node;
|
|
@@ -25298,6 +25308,7 @@ function parseNodeFromLexer(lexer, bytes, maxDepth, recoverEmptyObject = false)
|
|
|
25298
25308
|
parent.key = { kind: "name", rawBytes: tok.rawBytes, decoded: tok.decoded, span: tok.span };
|
|
25299
25309
|
continue;
|
|
25300
25310
|
} else {
|
|
25311
|
+
if (repair) continue;
|
|
25301
25312
|
throw new PdfError("E_PARSE", `Expected dictionary key /Name, got ${tok.kind}`);
|
|
25302
25313
|
}
|
|
25303
25314
|
} else {
|
|
@@ -25466,7 +25477,7 @@ function parseHeaderVersion(bytes) {
|
|
|
25466
25477
|
}
|
|
25467
25478
|
return head.slice(idx + 5, idx + 8);
|
|
25468
25479
|
}
|
|
25469
|
-
function parseObjectAtOffset(bytes, offset, maxRecursionDepth,
|
|
25480
|
+
function parseObjectAtOffset(bytes, offset, maxRecursionDepth, repair = false) {
|
|
25470
25481
|
const lexer = new CosByteLexer(bytes, offset);
|
|
25471
25482
|
const objNumTok = lexer.nextToken();
|
|
25472
25483
|
const genNumTok = lexer.nextToken();
|
|
@@ -25474,7 +25485,7 @@ function parseObjectAtOffset(bytes, offset, maxRecursionDepth, recoverEmptyObjec
|
|
|
25474
25485
|
if (objNumTok?.kind !== "number" || genNumTok?.kind !== "number" || objKwTok?.kind !== "keyword" || objKwTok.value !== "obj") {
|
|
25475
25486
|
throw new PdfError("E_PARSE", `Malformed indirect object header at byte offset ${offset}`);
|
|
25476
25487
|
}
|
|
25477
|
-
const value = parseNodeFromLexer(lexer, bytes, maxRecursionDepth,
|
|
25488
|
+
const value = parseNodeFromLexer(lexer, bytes, maxRecursionDepth, repair);
|
|
25478
25489
|
if (!value) {
|
|
25479
25490
|
throw new PdfError("E_PARSE", `Empty indirect object ${objNumTok.value} at offset ${offset}`);
|
|
25480
25491
|
}
|
|
@@ -25663,7 +25674,7 @@ function repairScanCosDocument(bytes, maxObjects, maxRecursionDepth) {
|
|
|
25663
25674
|
try {
|
|
25664
25675
|
const token = lexer.nextToken();
|
|
25665
25676
|
if (token?.kind === "keyword" && token.value === "trailer") {
|
|
25666
|
-
const trailer = parseNodeFromLexer(lexer, bytes, maxRecursionDepth);
|
|
25677
|
+
const trailer = parseNodeFromLexer(lexer, bytes, maxRecursionDepth, true);
|
|
25667
25678
|
if (trailer?.kind === "dict") trailers.push(trailer);
|
|
25668
25679
|
pos = lexer.offset;
|
|
25669
25680
|
continue;
|
|
@@ -25719,7 +25730,7 @@ function unpackRecoveredObjects(objects, maxObjects, maxDecompressedBytes, maxRe
|
|
|
25719
25730
|
const t = dictGet(obj.value.dict, "Type");
|
|
25720
25731
|
if (t?.kind === "name" && t.decoded === "ObjStm") {
|
|
25721
25732
|
try {
|
|
25722
|
-
for (const [unpackedNum, unpackedVal] of unpackObjectStream(obj.value, maxDecompressedBytes, maxRecursionDepth).entries()) {
|
|
25733
|
+
for (const [unpackedNum, unpackedVal] of unpackObjectStream(obj.value, maxDecompressedBytes, maxRecursionDepth, true).entries()) {
|
|
25723
25734
|
if (!objects.has(unpackedNum)) {
|
|
25724
25735
|
objects.set(unpackedNum, {
|
|
25725
25736
|
objectNumber: unpackedNum,
|
|
@@ -25755,7 +25766,7 @@ function recoveredReferences(objects) {
|
|
|
25755
25766
|
}
|
|
25756
25767
|
return { ...rootRef ? { rootRef } : {}, ...infoRef ? { infoRef } : {} };
|
|
25757
25768
|
}
|
|
25758
|
-
function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth) {
|
|
25769
|
+
function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth, repair = false) {
|
|
25759
25770
|
const nNode = dictGet(streamObj.dict, "N");
|
|
25760
25771
|
const firstNode = dictGet(streamObj.dict, "First");
|
|
25761
25772
|
if (nNode?.kind !== "number" || firstNode?.kind !== "number") {
|
|
@@ -25775,7 +25786,7 @@ function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth)
|
|
|
25775
25786
|
for (const pair of pairs) {
|
|
25776
25787
|
try {
|
|
25777
25788
|
const valLexer = new CosByteLexer(decoded, firstNode.value + pair.relativeOffset);
|
|
25778
|
-
const node = parseNodeFromLexer(valLexer, decoded, maxRecursionDepth);
|
|
25789
|
+
const node = parseNodeFromLexer(valLexer, decoded, maxRecursionDepth, repair);
|
|
25779
25790
|
if (node) {
|
|
25780
25791
|
result.set(pair.objectNumber, node);
|
|
25781
25792
|
}
|
|
@@ -25958,7 +25969,7 @@ function parseCosDocument(bytes, options = {}) {
|
|
|
25958
25969
|
if (!unpacked) {
|
|
25959
25970
|
const stmObj = objects.get(entry.objectStreamNumber)?.value;
|
|
25960
25971
|
if (stmObj?.kind === "stream") {
|
|
25961
|
-
unpacked = unpackObjectStream(stmObj, maxDecompressedBytes, maxRecursionDepth);
|
|
25972
|
+
unpacked = unpackObjectStream(stmObj, maxDecompressedBytes, maxRecursionDepth, recovery === "repair");
|
|
25962
25973
|
objStmCache.set(entry.objectStreamNumber, unpacked);
|
|
25963
25974
|
}
|
|
25964
25975
|
}
|
|
@@ -34430,7 +34441,11 @@ function resolvePageFonts(doc, resourcesDict) {
|
|
|
34430
34441
|
let cmap;
|
|
34431
34442
|
const toUniNode = doc.resolve(dictGet(fObj, "ToUnicode"));
|
|
34432
34443
|
if (toUniNode?.kind === "stream") {
|
|
34433
|
-
|
|
34444
|
+
try {
|
|
34445
|
+
cmap = parseToUnicodeCMap(doc.decodeStream(toUniNode));
|
|
34446
|
+
} catch (error) {
|
|
34447
|
+
if (error instanceof PdfError && error.code === "E_LIMIT") throw error;
|
|
34448
|
+
}
|
|
34434
34449
|
}
|
|
34435
34450
|
const encNode = doc.resolve(dictGet(fObj, "Encoding"));
|
|
34436
34451
|
if (encNode?.kind === "dict") {
|
|
@@ -34446,7 +34461,7 @@ function resolvePageFonts(doc, resourcesDict) {
|
|
|
34446
34461
|
const glyphNames = buildFontEncodingGlyphNamesMap(encNode);
|
|
34447
34462
|
const widths = /* @__PURE__ */ new Map();
|
|
34448
34463
|
let defaultWidth = 556;
|
|
34449
|
-
const isTwoByteCid = subtype === "Type0"
|
|
34464
|
+
const isTwoByteCid = subtype === "Type0";
|
|
34450
34465
|
let fontMatrix;
|
|
34451
34466
|
let charProcs;
|
|
34452
34467
|
let fontResources;
|
|
@@ -35554,8 +35569,12 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
35554
35569
|
const images = [];
|
|
35555
35570
|
const operations = [];
|
|
35556
35571
|
const emit = (operation) => {
|
|
35557
|
-
const clipPaths = curState()
|
|
35558
|
-
if (clipPaths) operation = { ...operation, value: {
|
|
35572
|
+
const { clipPaths, clipImages } = curState();
|
|
35573
|
+
if (clipPaths || clipImages) operation = { ...operation, value: {
|
|
35574
|
+
...operation.value,
|
|
35575
|
+
...clipPaths ? { clipPaths } : {},
|
|
35576
|
+
...clipImages ? { clipImages } : {}
|
|
35577
|
+
} };
|
|
35559
35578
|
operations.push(operation);
|
|
35560
35579
|
switch (operation.kind) {
|
|
35561
35580
|
case "path":
|
|
@@ -35819,6 +35838,18 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
35819
35838
|
let hasTextClip = false;
|
|
35820
35839
|
let activeTm = [1, 0, 0, 1, 0, 0];
|
|
35821
35840
|
let activeTlm = [1, 0, 0, 1, 0, 0];
|
|
35841
|
+
const paintImage = (image, patternMask, resources, activeFonts, depth) => {
|
|
35842
|
+
if (!patternMask) {
|
|
35843
|
+
emit({ kind: "image", value: image });
|
|
35844
|
+
return;
|
|
35845
|
+
}
|
|
35846
|
+
const st = curState();
|
|
35847
|
+
stateStack.push({ ...st, clipImages: [...st.clipImages ?? [], image] });
|
|
35848
|
+
walkNodes([{ kind: "path-op", paint: "f", segments: [
|
|
35849
|
+
{ kind: "rect", x: 0, y: 0, width: 1, height: 1 }
|
|
35850
|
+
] }], void 0, void 0, resources, activeFonts, depth);
|
|
35851
|
+
stateStack.pop();
|
|
35852
|
+
};
|
|
35822
35853
|
const walkNodes = (nodes, mcid, actualText, activeResources = params.resourcesDict, activeFonts = fonts, depth = 0) => {
|
|
35823
35854
|
for (const node of nodes) {
|
|
35824
35855
|
switch (node.kind) {
|
|
@@ -36002,7 +36033,8 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36002
36033
|
st.fillAlpha,
|
|
36003
36034
|
"PatternShading_" + st.fillPatternName,
|
|
36004
36035
|
patClip,
|
|
36005
|
-
shading?.kind === "stream" ? shading : void 0
|
|
36036
|
+
shading?.kind === "stream" ? shading : void 0,
|
|
36037
|
+
st.blendMode
|
|
36006
36038
|
);
|
|
36007
36039
|
if (shImg) {
|
|
36008
36040
|
emit({ kind: "image", value: shImg });
|
|
@@ -36111,18 +36143,20 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36111
36143
|
const subNode = params.cosDoc.resolve(dictGet(xobjNode.dict, "Subtype"));
|
|
36112
36144
|
const sub = subNode?.kind === "name" ? subNode.decoded : "";
|
|
36113
36145
|
if (sub === "Image") {
|
|
36146
|
+
const maskNode = params.cosDoc.resolve(dictGet(xobjNode.dict, "ImageMask"));
|
|
36147
|
+
const patternMask = !!st.fillPatternName && maskNode?.kind === "boolean" && maskNode.value;
|
|
36114
36148
|
const decoded = decodeXObjectImageToRgba(
|
|
36115
36149
|
params.cosDoc,
|
|
36116
36150
|
xobjNode,
|
|
36117
36151
|
activeResources,
|
|
36118
|
-
{
|
|
36152
|
+
patternMask ? { r: 1, g: 1, b: 1, alpha: 1 } : {
|
|
36119
36153
|
r: st.fillColor.r,
|
|
36120
36154
|
g: st.fillColor.g,
|
|
36121
36155
|
b: st.fillColor.b,
|
|
36122
36156
|
alpha: st.fillAlpha
|
|
36123
36157
|
}
|
|
36124
36158
|
);
|
|
36125
|
-
|
|
36159
|
+
paintImage({
|
|
36126
36160
|
name: node.name,
|
|
36127
36161
|
matrix: [...st.ctm],
|
|
36128
36162
|
width: decoded.width,
|
|
@@ -36132,7 +36166,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36132
36166
|
decodedRgba: decoded.rgba,
|
|
36133
36167
|
...st.blendMode && st.blendMode !== "Normal" ? { blendMode: st.blendMode } : {},
|
|
36134
36168
|
...st.clipRect ? { clipRect: [...st.clipRect] } : {}
|
|
36135
|
-
}
|
|
36169
|
+
}, patternMask, activeResources, activeFonts, depth);
|
|
36136
36170
|
} else if (sub === "Form" && depth < 8) {
|
|
36137
36171
|
const formStreamBytes = params.cosDoc.decodeStream(xobjNode);
|
|
36138
36172
|
const formNodes = parseContentStream(formStreamBytes);
|
|
@@ -36188,19 +36222,22 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36188
36222
|
}
|
|
36189
36223
|
case "inline-image": {
|
|
36190
36224
|
const st = curState();
|
|
36225
|
+
const maskEntry = dictGet(node.dict, "ImageMask") ?? dictGet(node.dict, "IM");
|
|
36226
|
+
const maskNode = params.cosDoc ? params.cosDoc.resolve(maskEntry) : maskEntry;
|
|
36227
|
+
const patternMask = !!st.fillPatternName && maskNode?.kind === "boolean" && maskNode.value;
|
|
36191
36228
|
const decoded = decodeInlineImageNodeToRgba(
|
|
36192
36229
|
params.cosDoc,
|
|
36193
36230
|
node.dict,
|
|
36194
36231
|
node.data,
|
|
36195
36232
|
activeResources,
|
|
36196
|
-
{
|
|
36233
|
+
patternMask ? { r: 1, g: 1, b: 1, alpha: 1 } : {
|
|
36197
36234
|
r: st.fillColor.r,
|
|
36198
36235
|
g: st.fillColor.g,
|
|
36199
36236
|
b: st.fillColor.b,
|
|
36200
36237
|
alpha: st.fillAlpha
|
|
36201
36238
|
}
|
|
36202
36239
|
);
|
|
36203
|
-
|
|
36240
|
+
paintImage({
|
|
36204
36241
|
name: "InlineImage",
|
|
36205
36242
|
matrix: [...st.ctm],
|
|
36206
36243
|
width: decoded.width,
|
|
@@ -36210,7 +36247,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36210
36247
|
decodedRgba: decoded.rgba,
|
|
36211
36248
|
...st.blendMode && st.blendMode !== "Normal" ? { blendMode: st.blendMode } : {},
|
|
36212
36249
|
...st.clipRect ? { clipRect: [...st.clipRect] } : {}
|
|
36213
|
-
}
|
|
36250
|
+
}, patternMask, activeResources, activeFonts, depth);
|
|
36214
36251
|
break;
|
|
36215
36252
|
}
|
|
36216
36253
|
case "text-object": {
|
|
@@ -39670,6 +39707,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
39670
39707
|
const aaVec = options.antialiasVector !== false;
|
|
39671
39708
|
const aaTxt = options.antialiasText !== false;
|
|
39672
39709
|
const clipMasks = /* @__PURE__ */ new Map();
|
|
39710
|
+
const imageClipMasks = /* @__PURE__ */ new Map();
|
|
39673
39711
|
for (const original of paintOperations(displayList)) {
|
|
39674
39712
|
if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
|
|
39675
39713
|
const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
@@ -39684,6 +39722,31 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
39684
39722
|
}
|
|
39685
39723
|
clipMasks.set(clips, clipMask);
|
|
39686
39724
|
}
|
|
39725
|
+
const imageClips = original.value.clipImages;
|
|
39726
|
+
if (imageClips) {
|
|
39727
|
+
let imageMask = imageClipMasks.get(imageClips);
|
|
39728
|
+
if (!imageMask) {
|
|
39729
|
+
imageMask = new Uint8Array(width * height * 4).fill(255);
|
|
39730
|
+
for (const image of imageClips) {
|
|
39731
|
+
const layer = renderDisplayListToBitmap({
|
|
39732
|
+
...displayList,
|
|
39733
|
+
rotation: 0,
|
|
39734
|
+
paths: [],
|
|
39735
|
+
glyphs: [],
|
|
39736
|
+
images: [image],
|
|
39737
|
+
operations: [{ kind: "image", value: image }]
|
|
39738
|
+
}, { scale, transparent: true }).data;
|
|
39739
|
+
for (let i = 3; i < layer.length; i += 4) imageMask[i] = Math.round(imageMask[i] * layer[i] / 255);
|
|
39740
|
+
}
|
|
39741
|
+
imageClipMasks.set(imageClips, imageMask);
|
|
39742
|
+
}
|
|
39743
|
+
if (clipMask) {
|
|
39744
|
+
clipMask = clipMask.slice();
|
|
39745
|
+
for (let i = 3; i < clipMask.length; i += 4) clipMask[i] = Math.round(clipMask[i] * imageMask[i] / 255);
|
|
39746
|
+
} else {
|
|
39747
|
+
clipMask = imageMask;
|
|
39748
|
+
}
|
|
39749
|
+
}
|
|
39687
39750
|
if (operation.kind === "path") {
|
|
39688
39751
|
const path = operation.value;
|
|
39689
39752
|
if (path.fillColor) {
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
readImageMetadata,
|
|
12
12
|
resizeImage,
|
|
13
13
|
rotateImage
|
|
14
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
15
|
-
import "../safe-bash/command-chunks/chunk-
|
|
14
|
+
} from "../safe-bash/command-chunks/chunk-7JA44PVV.js";
|
|
15
|
+
import "../safe-bash/command-chunks/chunk-BAUGDXLZ.js";
|
|
16
16
|
import {
|
|
17
17
|
init_buffer
|
|
18
18
|
} from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createEngine
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../safe-bash/command-chunks/chunk-J2NPH7DO.js";
|
|
4
4
|
import {
|
|
5
5
|
xlsxFormat
|
|
6
6
|
} from "../safe-bash/command-chunks/chunk-QDPRSPHQ.js";
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
PdfDocument,
|
|
32
32
|
decodeFlate,
|
|
33
33
|
rgb
|
|
34
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
34
|
+
} from "../safe-bash/command-chunks/chunk-BAUGDXLZ.js";
|
|
35
35
|
import {
|
|
36
36
|
init_buffer
|
|
37
37
|
} from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ResourceIOOptions } from "./io/index.js";
|
|
2
|
+
import type { Engine, EngineConfig, EngineOptions } from "./contracts.js";
|
|
3
|
+
import { type CommandDefinition, type VirtualShellPlugin } from "../safe-bash-contracts/index.js";
|
|
4
|
+
export interface SsconvertCommandsOptions extends Omit<EngineConfig, "filesystem" | "codecs" | "environment"> {
|
|
5
|
+
readonly codecs?: EngineConfig["codecs"];
|
|
6
|
+
readonly environment?: EngineOptions["environment"];
|
|
7
|
+
readonly io?: Pick<ResourceIOOptions, "descriptors" | "adapters" | "transport">;
|
|
8
|
+
readonly replace?: boolean;
|
|
9
|
+
readonly profile?: import("./cli.js").CommandProfile;
|
|
10
|
+
}
|
|
11
|
+
export interface SsconvertCommandBindings {
|
|
12
|
+
createSsconvertCommand(options?: SsconvertCommandsOptions): CommandDefinition;
|
|
13
|
+
createSsconvertCommands(options?: SsconvertCommandsOptions): readonly CommandDefinition[];
|
|
14
|
+
ssconvertCommands(options?: SsconvertCommandsOptions): VirtualShellPlugin;
|
|
15
|
+
}
|
|
16
|
+
/** Bind one shell implementation to either explicit formats or the compatibility composition. */
|
|
17
|
+
export declare function createCommandBindings(createEngine: (options: EngineOptions) => Engine, compatibilityDefaults?: boolean): SsconvertCommandBindings;
|
|
18
|
+
//# sourceMappingURL=command-bindings.d.ts.map
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
readonly environment?: EngineOptions["environment"];
|
|
7
|
-
readonly io?: Pick<ResourceIOOptions, "descriptors" | "adapters" | "transport">;
|
|
8
|
-
readonly replace?: boolean;
|
|
9
|
-
readonly profile?: import("./cli.js").CommandProfile;
|
|
10
|
-
}
|
|
11
|
-
/** Explicit opt-in; the domain engine is the only conversion implementation. */
|
|
12
|
-
export declare function createSsconvertCommand(options?: SsconvertCommandsOptions): CommandDefinition;
|
|
13
|
-
export declare function ssconvertCommands(options?: SsconvertCommandsOptions): VirtualShellPlugin;
|
|
14
|
-
export declare function createSsconvertCommands(options?: SsconvertCommandsOptions): readonly CommandDefinition[];
|
|
1
|
+
import { type SsconvertCommandBindings } from "./command-bindings.js";
|
|
2
|
+
export type { SsconvertCommandsOptions } from "./command-bindings.js";
|
|
3
|
+
export declare const createSsconvertCommand: SsconvertCommandBindings["createSsconvertCommand"];
|
|
4
|
+
export declare const createSsconvertCommands: SsconvertCommandBindings["createSsconvertCommands"];
|
|
5
|
+
export declare const ssconvertCommands: SsconvertCommandBindings["ssconvertCommands"];
|
|
15
6
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type SsconvertCommandBindings } from "./command-bindings.js";
|
|
2
|
+
export type { SsconvertCommandsOptions } from "./command-bindings.js";
|
|
3
|
+
export declare const createSsconvertCommand: SsconvertCommandBindings["createSsconvertCommand"];
|
|
4
|
+
export declare const createSsconvertCommands: SsconvertCommandBindings["createSsconvertCommands"];
|
|
5
|
+
export declare const ssconvertCommands: SsconvertCommandBindings["ssconvertCommands"];
|
|
6
|
+
//# sourceMappingURL=commands.d.ts.map
|