@poe-platform/safe-bash 0.1.762 → 0.1.763
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 +186 -55
- package/dist/image-ast/index.js +186 -55
- package/dist/pdf-ast/ast.d.ts +23 -0
- package/dist/pdf-ast/index.js +273 -91
- package/dist/safe-bash/command-chunks/{chunk-D4GXXV65.js → chunk-4XHONGIU.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-P3Q2QSCA.js → chunk-S3G2B4OX.js} +186 -55
- package/dist/safe-bash/command-chunks/{chunk-F7MJRXQ2.js → chunk-S5EX6UP5.js} +1 -1
- package/dist/safe-bash/core.browser.js +1 -1
- package/dist/safe-bash/shell/runtime.js +1 -1
- package/dist/safe-bash-checksum-engine/index.d.ts +1 -1
- package/dist/safe-bash-checksum-engine/index.js +5 -1
- package/dist/safe-bash-command-ffmpeg/index.js +7486 -7432
- package/dist/safe-bash-command-gh/index.js +174 -105
- 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 +186 -55
- package/dist/safe-bash-command-pdfinfo/index.js +273 -91
- package/dist/safe-bash-command-pdftk/index.js +186 -55
- package/dist/safe-bash-command-pdftoppm/index.js +273 -91
- package/dist/safe-bash-command-pdftotext/index.js +186 -55
- package/dist/safe-bash-command-qpdf/index.js +186 -55
- package/dist/safe-bash-command-sips/index.js +2 -2
- package/dist/safe-bash-command-soffice/index.js +1 -1
- package/dist/safe-bash-command-ssconvert/index.js +249 -58
- package/dist/safe-bash-command-wkhtmltopdf/index.js +186 -55
- package/package.json +2 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +13 -0
|
@@ -32076,14 +32076,18 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
32076
32076
|
const paths = [];
|
|
32077
32077
|
const images = [];
|
|
32078
32078
|
const operations = [];
|
|
32079
|
+
let capturedOperations;
|
|
32080
|
+
let insideSoftMask = false;
|
|
32079
32081
|
const emit = (operation) => {
|
|
32080
|
-
const { clipPaths, clipImages } = curState();
|
|
32081
|
-
if (clipPaths || clipImages) operation = { ...operation, value: {
|
|
32082
|
+
const { clipPaths, clipImages, softMask } = curState();
|
|
32083
|
+
if (clipPaths || clipImages || softMask) operation = { ...operation, value: {
|
|
32082
32084
|
...operation.value,
|
|
32083
32085
|
...clipPaths ? { clipPaths } : {},
|
|
32084
|
-
...clipImages ? { clipImages } : {}
|
|
32086
|
+
...clipImages ? { clipImages } : {},
|
|
32087
|
+
...softMask ? { softMask } : {}
|
|
32085
32088
|
} };
|
|
32086
|
-
operations.push(operation);
|
|
32089
|
+
(capturedOperations ?? operations).push(operation);
|
|
32090
|
+
if (insideSoftMask) return;
|
|
32087
32091
|
switch (operation.kind) {
|
|
32088
32092
|
case "path":
|
|
32089
32093
|
paths.push(operation.value);
|
|
@@ -32189,7 +32193,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
32189
32193
|
);
|
|
32190
32194
|
return { r: kClamp(r), g: kClamp(g), b: kClamp(b) };
|
|
32191
32195
|
};
|
|
32192
|
-
const applyStateOperator = (st, operator, ops, activeResources) => {
|
|
32196
|
+
const applyStateOperator = (st, operator, ops, activeResources, activeFonts, depth) => {
|
|
32193
32197
|
const num = (i, fb = 0) => ops[i]?.kind === "number" ? ops[i].value : fb;
|
|
32194
32198
|
if (operator === "cm") {
|
|
32195
32199
|
const m = [num(0, 1), num(1, 0), num(2, 0), num(3, 1), num(4, 0), num(5, 0)];
|
|
@@ -32272,6 +32276,46 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
32272
32276
|
const extDict = params.cosDoc.resolveDict(dictGet(activeResources, "ExtGState"));
|
|
32273
32277
|
const gsDict = extDict ? params.cosDoc.resolveDict(dictGet(extDict, ops[0].decoded)) : void 0;
|
|
32274
32278
|
if (gsDict) {
|
|
32279
|
+
const mask = params.cosDoc.resolve(dictGet(gsDict, "SMask"));
|
|
32280
|
+
if (mask?.kind === "name" && mask.decoded === "None") {
|
|
32281
|
+
st.softMask = void 0;
|
|
32282
|
+
} else if (mask?.kind === "dict") {
|
|
32283
|
+
const subtype = params.cosDoc.resolve(dictGet(mask, "S"));
|
|
32284
|
+
const form = params.cosDoc.resolve(dictGet(mask, "G"));
|
|
32285
|
+
if (form?.kind === "stream" && subtype?.kind === "name" && (subtype.decoded === "Alpha" || subtype.decoded === "Luminosity")) {
|
|
32286
|
+
if (depth >= 8) throw new PdfError("E_LIMIT", "Soft-mask nesting exceeds the form depth limit");
|
|
32287
|
+
const parentOperations = capturedOperations;
|
|
32288
|
+
const parentInsideSoftMask = insideSoftMask;
|
|
32289
|
+
const savedTextState = { pendingTextClip, hasTextClip, activeTm, activeTlm };
|
|
32290
|
+
const captured = [];
|
|
32291
|
+
capturedOperations = captured;
|
|
32292
|
+
insideSoftMask = true;
|
|
32293
|
+
const maskState = { ...st, softMask: void 0, fillAlpha: 1, strokeAlpha: 1, blendMode: "Normal" };
|
|
32294
|
+
delete maskState.clipPaths;
|
|
32295
|
+
delete maskState.clipImages;
|
|
32296
|
+
delete maskState.clipRect;
|
|
32297
|
+
stateStack.push(maskState);
|
|
32298
|
+
try {
|
|
32299
|
+
paintForm(form, activeResources, activeFonts, depth, void 0, void 0, true);
|
|
32300
|
+
} finally {
|
|
32301
|
+
stateStack.pop();
|
|
32302
|
+
capturedOperations = parentOperations;
|
|
32303
|
+
insideSoftMask = parentInsideSoftMask;
|
|
32304
|
+
({ pendingTextClip, hasTextClip, activeTm, activeTlm } = savedTextState);
|
|
32305
|
+
}
|
|
32306
|
+
const group = params.cosDoc.resolveDict(dictGet(form.dict, "Group"));
|
|
32307
|
+
const colorSpace = group ? dictGet(group, "CS") : void 0;
|
|
32308
|
+
const bc = params.cosDoc.resolveArray(dictGet(mask, "BC"));
|
|
32309
|
+
const components = bc?.items.map((item) => {
|
|
32310
|
+
const value = params.cosDoc.resolve(item);
|
|
32311
|
+
return value?.kind === "number" ? value.value : 0;
|
|
32312
|
+
});
|
|
32313
|
+
const [r, g, b] = components ? convertColorSpaceComponentsToRgb(params.cosDoc, colorSpace, "DeviceRGB", components, activeResources) : [0, 0, 0];
|
|
32314
|
+
const transfer = params.cosDoc.resolve(dictGet(mask, "TR"));
|
|
32315
|
+
const transferMap = transfer?.kind === "dict" || transfer?.kind === "stream" ? Uint8Array.from({ length: 256 }, (_, i) => Math.floor(kClamp(Math.fround(evalShadingFunctionToComponents(params.cosDoc, transfer, Math.fround(i / 255))[0] ?? 0)) * 255)) : void 0;
|
|
32316
|
+
st.softMask = { subtype: subtype.decoded, operations: captured, backdrop: { r, g, b }, transferMap };
|
|
32317
|
+
}
|
|
32318
|
+
}
|
|
32275
32319
|
const bmNode = params.cosDoc.resolve(dictGet(gsDict, "BM"));
|
|
32276
32320
|
if (bmNode?.kind === "name") {
|
|
32277
32321
|
st.blendMode = bmNode.decoded === "Compatible" ? "Normal" : bmNode.decoded;
|
|
@@ -32358,6 +32402,84 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
32358
32402
|
] }], void 0, void 0, resources, activeFonts, depth);
|
|
32359
32403
|
stateStack.pop();
|
|
32360
32404
|
};
|
|
32405
|
+
const paintForm = (form, activeResources, activeFonts, depth, mcid, actualText, maskGroup = false) => {
|
|
32406
|
+
const st = curState();
|
|
32407
|
+
const group = params.cosDoc.resolveDict(dictGet(form.dict, "Group"));
|
|
32408
|
+
const groupType = group ? params.cosDoc.resolve(dictGet(group, "S")) : void 0;
|
|
32409
|
+
const isolated = group ? params.cosDoc.resolve(dictGet(group, "I")) : void 0;
|
|
32410
|
+
const isolate = !maskGroup && groupType?.kind === "name" && groupType.decoded === "Transparency" && isolated?.kind === "boolean" && isolated.value;
|
|
32411
|
+
const formStreamBytes = params.cosDoc.decodeStream(form);
|
|
32412
|
+
const formNodes = parseContentStream(formStreamBytes);
|
|
32413
|
+
const formResDict = params.cosDoc.resolveDict(dictGet(form.dict, "Resources")) ?? activeResources;
|
|
32414
|
+
const formFonts = new Map(activeFonts);
|
|
32415
|
+
for (const [k, v] of resolvePageFonts(params.cosDoc, formResDict).entries()) {
|
|
32416
|
+
formFonts.set(k, v);
|
|
32417
|
+
}
|
|
32418
|
+
let nextCtm = [...st.ctm];
|
|
32419
|
+
const matArr = params.cosDoc.resolveArray(dictGet(form.dict, "Matrix"));
|
|
32420
|
+
if (matArr && matArr.items.length >= 6) {
|
|
32421
|
+
const mn = (idx, fb = 0) => {
|
|
32422
|
+
const resolved = params.cosDoc.resolve(matArr.items[idx]);
|
|
32423
|
+
return resolved?.kind === "number" ? resolved.value : fb;
|
|
32424
|
+
};
|
|
32425
|
+
const formMat = [mn(0, 1), mn(1, 0), mn(2, 0), mn(3, 1), mn(4, 0), mn(5, 0)];
|
|
32426
|
+
nextCtm = multiplyMatrices(formMat, nextCtm);
|
|
32427
|
+
}
|
|
32428
|
+
let nextClip = !isolate && st.clipRect ? [...st.clipRect] : void 0;
|
|
32429
|
+
let nextClipPaths = isolate ? void 0 : st.clipPaths;
|
|
32430
|
+
const bboxArr = params.cosDoc.resolveArray(dictGet(form.dict, "BBox"));
|
|
32431
|
+
if (bboxArr && bboxArr.items.length >= 4) {
|
|
32432
|
+
const bn = (idx, fb = 0) => {
|
|
32433
|
+
const resolved = params.cosDoc.resolve(bboxArr.items[idx]);
|
|
32434
|
+
return resolved?.kind === "number" ? resolved.value : fb;
|
|
32435
|
+
};
|
|
32436
|
+
const bx0 = bn(0, 0), by0 = bn(1, 0), bx1 = bn(2, 0), by1 = bn(3, 0);
|
|
32437
|
+
const pts = [
|
|
32438
|
+
transformPoint(nextCtm, bx0, by0),
|
|
32439
|
+
transformPoint(nextCtm, bx1, by0),
|
|
32440
|
+
transformPoint(nextCtm, bx1, by1),
|
|
32441
|
+
transformPoint(nextCtm, bx0, by1)
|
|
32442
|
+
];
|
|
32443
|
+
nextClipPaths = [...nextClipPaths ?? [], [
|
|
32444
|
+
...pts.map(([x, y], index) => ({ kind: index === 0 ? "move" : "line", x, y })),
|
|
32445
|
+
{ kind: "close" }
|
|
32446
|
+
]];
|
|
32447
|
+
const fMinX = Math.min(...pts.map((p) => p[0]));
|
|
32448
|
+
const fMinY = Math.min(...pts.map((p) => p[1]));
|
|
32449
|
+
const fMaxX = Math.max(...pts.map((p) => p[0]));
|
|
32450
|
+
const fMaxY = Math.max(...pts.map((p) => p[1]));
|
|
32451
|
+
if (fMaxX > fMinX && fMaxY > fMinY) {
|
|
32452
|
+
nextClip = nextClip ? [
|
|
32453
|
+
Math.max(nextClip[0], fMinX),
|
|
32454
|
+
Math.max(nextClip[1], fMinY),
|
|
32455
|
+
Math.min(nextClip[2], fMaxX),
|
|
32456
|
+
Math.min(nextClip[3], fMaxY)
|
|
32457
|
+
] : [fMinX, fMinY, fMaxX, fMaxY];
|
|
32458
|
+
}
|
|
32459
|
+
}
|
|
32460
|
+
const parentOperations = capturedOperations;
|
|
32461
|
+
const children = [];
|
|
32462
|
+
const nextState = { ...st, ctm: nextCtm };
|
|
32463
|
+
if (isolate) {
|
|
32464
|
+
capturedOperations = children;
|
|
32465
|
+
nextState.fillAlpha = nextState.strokeAlpha = 1;
|
|
32466
|
+
nextState.blendMode = "Normal";
|
|
32467
|
+
nextState.softMask = void 0;
|
|
32468
|
+
delete nextState.clipImages;
|
|
32469
|
+
delete nextState.clipPaths;
|
|
32470
|
+
delete nextState.clipRect;
|
|
32471
|
+
}
|
|
32472
|
+
if (nextClip) nextState.clipRect = nextClip;
|
|
32473
|
+
if (nextClipPaths) nextState.clipPaths = nextClipPaths;
|
|
32474
|
+
stateStack.push(nextState);
|
|
32475
|
+
try {
|
|
32476
|
+
walkNodes(formNodes, mcid, actualText, formResDict, formFonts, depth + 1);
|
|
32477
|
+
} finally {
|
|
32478
|
+
stateStack.pop();
|
|
32479
|
+
capturedOperations = parentOperations;
|
|
32480
|
+
}
|
|
32481
|
+
if (isolate) emit({ kind: "group", value: { operations: children, alpha: st.fillAlpha, blendMode: st.blendMode, clipRect: st.clipRect } });
|
|
32482
|
+
};
|
|
32361
32483
|
const walkNodes = (nodes, mcid, actualText, activeResources = params.resourcesDict, activeFonts = fonts, depth = 0) => {
|
|
32362
32484
|
for (const node of nodes) {
|
|
32363
32485
|
switch (node.kind) {
|
|
@@ -32402,7 +32524,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
32402
32524
|
break;
|
|
32403
32525
|
}
|
|
32404
32526
|
case "state-op": {
|
|
32405
|
-
applyStateOperator(curState(), node.operator, node.operands, activeResources);
|
|
32527
|
+
applyStateOperator(curState(), node.operator, node.operands, activeResources, activeFonts, depth);
|
|
32406
32528
|
break;
|
|
32407
32529
|
}
|
|
32408
32530
|
case "path-op": {
|
|
@@ -32688,53 +32810,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
32688
32810
|
...st.clipRect ? { clipRect: [...st.clipRect] } : {}
|
|
32689
32811
|
}, patternMask, activeResources, activeFonts, depth);
|
|
32690
32812
|
} else if (sub === "Form" && depth < 8) {
|
|
32691
|
-
|
|
32692
|
-
const formNodes = parseContentStream(formStreamBytes);
|
|
32693
|
-
const formResDict = params.cosDoc.resolveDict(dictGet(xobjNode.dict, "Resources")) ?? activeResources;
|
|
32694
|
-
const formFonts = new Map(activeFonts);
|
|
32695
|
-
for (const [k, v] of resolvePageFonts(params.cosDoc, formResDict).entries()) {
|
|
32696
|
-
formFonts.set(k, v);
|
|
32697
|
-
}
|
|
32698
|
-
let nextCtm = [...st.ctm];
|
|
32699
|
-
const matArr = params.cosDoc.resolveArray(dictGet(xobjNode.dict, "Matrix"));
|
|
32700
|
-
if (matArr && matArr.items.length >= 6) {
|
|
32701
|
-
const mn = (idx, fb = 0) => {
|
|
32702
|
-
const resolved = params.cosDoc.resolve(matArr.items[idx]);
|
|
32703
|
-
return resolved?.kind === "number" ? resolved.value : fb;
|
|
32704
|
-
};
|
|
32705
|
-
const formMat = [mn(0, 1), mn(1, 0), mn(2, 0), mn(3, 1), mn(4, 0), mn(5, 0)];
|
|
32706
|
-
nextCtm = multiplyMatrices(formMat, nextCtm);
|
|
32707
|
-
}
|
|
32708
|
-
let nextClip = st.clipRect ? [...st.clipRect] : void 0;
|
|
32709
|
-
const bboxArr = params.cosDoc.resolveArray(dictGet(xobjNode.dict, "BBox"));
|
|
32710
|
-
if (bboxArr && bboxArr.items.length >= 4) {
|
|
32711
|
-
const bn = (idx, fb = 0) => {
|
|
32712
|
-
const resolved = params.cosDoc.resolve(bboxArr.items[idx]);
|
|
32713
|
-
return resolved?.kind === "number" ? resolved.value : fb;
|
|
32714
|
-
};
|
|
32715
|
-
const bx0 = bn(0, 0), by0 = bn(1, 0), bx1 = bn(2, 0), by1 = bn(3, 0);
|
|
32716
|
-
const pts = [
|
|
32717
|
-
transformPoint(nextCtm, bx0, by0),
|
|
32718
|
-
transformPoint(nextCtm, bx1, by0),
|
|
32719
|
-
transformPoint(nextCtm, bx0, by1),
|
|
32720
|
-
transformPoint(nextCtm, bx1, by1)
|
|
32721
|
-
];
|
|
32722
|
-
const fMinX = Math.min(...pts.map((p) => p[0]));
|
|
32723
|
-
const fMinY = Math.min(...pts.map((p) => p[1]));
|
|
32724
|
-
const fMaxX = Math.max(...pts.map((p) => p[0]));
|
|
32725
|
-
const fMaxY = Math.max(...pts.map((p) => p[1]));
|
|
32726
|
-
if (fMaxX > fMinX && fMaxY > fMinY) {
|
|
32727
|
-
nextClip = nextClip ? [
|
|
32728
|
-
Math.max(nextClip[0], fMinX),
|
|
32729
|
-
Math.max(nextClip[1], fMinY),
|
|
32730
|
-
Math.min(nextClip[2], fMaxX),
|
|
32731
|
-
Math.min(nextClip[3], fMaxY)
|
|
32732
|
-
] : [fMinX, fMinY, fMaxX, fMaxY];
|
|
32733
|
-
}
|
|
32734
|
-
}
|
|
32735
|
-
stateStack.push({ ...st, ctm: nextCtm, ...nextClip ? { clipRect: nextClip } : {} });
|
|
32736
|
-
walkNodes(formNodes, mcid, actualText, formResDict, formFonts, depth + 1);
|
|
32737
|
-
if (stateStack.length > 1) stateStack.pop();
|
|
32813
|
+
paintForm(xobjNode, activeResources, activeFonts, depth, mcid, actualText);
|
|
32738
32814
|
}
|
|
32739
32815
|
}
|
|
32740
32816
|
}
|
|
@@ -32953,7 +33029,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
32953
33029
|
st.textRenderMode = cmd.mode;
|
|
32954
33030
|
break;
|
|
32955
33031
|
case "state-op":
|
|
32956
|
-
applyStateOperator(st, cmd.operator, cmd.operands, activeResources);
|
|
33032
|
+
applyStateOperator(st, cmd.operator, cmd.operands, activeResources, activeFonts, depth);
|
|
32957
33033
|
break;
|
|
32958
33034
|
case "show-text":
|
|
32959
33035
|
emitTokenBytes(cmd.token.bytes);
|
|
@@ -34959,6 +35035,30 @@ function paintOperations(displayList) {
|
|
|
34959
35035
|
...displayList.glyphs.map((value) => ({ kind: "glyph", value }))
|
|
34960
35036
|
];
|
|
34961
35037
|
}
|
|
35038
|
+
function renderSoftMask(mask, displayList, scale) {
|
|
35039
|
+
const bitmap = renderDisplayListToBitmap({
|
|
35040
|
+
...displayList,
|
|
35041
|
+
rotation: 0,
|
|
35042
|
+
glyphs: [],
|
|
35043
|
+
paths: [],
|
|
35044
|
+
images: [],
|
|
35045
|
+
operations: mask.operations
|
|
35046
|
+
}, { scale, transparent: true });
|
|
35047
|
+
const { data } = bitmap;
|
|
35048
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
35049
|
+
let value = data[i + 3];
|
|
35050
|
+
if (mask.subtype === "Luminosity") {
|
|
35051
|
+
const alpha = value / 255;
|
|
35052
|
+
const r = Math.round(data[i] * alpha + mask.backdrop.r * 255 * (1 - alpha));
|
|
35053
|
+
const g = Math.round(data[i + 1] * alpha + mask.backdrop.g * 255 * (1 - alpha));
|
|
35054
|
+
const b = Math.round(data[i + 2] * alpha + mask.backdrop.b * 255 * (1 - alpha));
|
|
35055
|
+
value = Math.round(pdfLum(r, g, b));
|
|
35056
|
+
}
|
|
35057
|
+
data[i] = data[i + 1] = data[i + 2] = 0;
|
|
35058
|
+
data[i + 3] = mask.transferMap?.[value] ?? value;
|
|
35059
|
+
}
|
|
35060
|
+
return bitmap;
|
|
35061
|
+
}
|
|
34962
35062
|
function renderDisplayListToBitmap(displayList, options = {}) {
|
|
34963
35063
|
const baseScale = options.scale ?? (options.dpi ? options.dpi / 72 : 1.5);
|
|
34964
35064
|
const scaleX = options.dpiX !== void 0 ? options.dpiX / 72 : baseScale;
|
|
@@ -34982,10 +35082,28 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
34982
35082
|
const aaTxt = options.antialiasText !== false;
|
|
34983
35083
|
let cachedClips;
|
|
34984
35084
|
let cachedClipMask;
|
|
35085
|
+
let cachedSoftMask;
|
|
35086
|
+
let cachedSoftMaskPixels;
|
|
34985
35087
|
const imageClipMasks = /* @__PURE__ */ new Map();
|
|
34986
35088
|
for (const original of paintOperations(displayList)) {
|
|
34987
35089
|
if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
|
|
34988
|
-
|
|
35090
|
+
let operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
35091
|
+
if (operation.kind === "group") {
|
|
35092
|
+
const group = operation.value;
|
|
35093
|
+
const bitmap = renderDisplayListToBitmap({ ...displayList, rotation: 0, operations: group.operations }, { ...options, scale, dpiX: void 0, dpiY: void 0, cropRect: void 0, transparent: true });
|
|
35094
|
+
for (let i = 3; i < bitmap.data.length; i += 4) bitmap.data[i] = Math.round(bitmap.data[i] * group.alpha);
|
|
35095
|
+
operation = { kind: "image", value: {
|
|
35096
|
+
name: "TransparencyGroup",
|
|
35097
|
+
width: bitmap.width,
|
|
35098
|
+
height: bitmap.height,
|
|
35099
|
+
decodedRgba: bitmap.data,
|
|
35100
|
+
matrix: [bitmap.width / scale, 0, 0, bitmap.height / scale, 0, displayList.height - bitmap.height / scale],
|
|
35101
|
+
colorSpace: "DeviceRGB",
|
|
35102
|
+
bitsPerComponent: 8,
|
|
35103
|
+
blendMode: group.blendMode,
|
|
35104
|
+
clipRect: group.clipRect
|
|
35105
|
+
} };
|
|
35106
|
+
}
|
|
34989
35107
|
const clips = original.value.clipPaths;
|
|
34990
35108
|
let clipMask = clips && clips === cachedClips ? cachedClipMask : void 0;
|
|
34991
35109
|
if (clips && !clipMask) {
|
|
@@ -34999,6 +35117,19 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
34999
35117
|
cachedClips = clips;
|
|
35000
35118
|
cachedClipMask = clipMask;
|
|
35001
35119
|
}
|
|
35120
|
+
const softMask = original.value.softMask;
|
|
35121
|
+
if (softMask) {
|
|
35122
|
+
if (softMask !== cachedSoftMask) {
|
|
35123
|
+
cachedSoftMaskPixels = renderSoftMask(softMask, displayList, scale).data;
|
|
35124
|
+
cachedSoftMask = softMask;
|
|
35125
|
+
}
|
|
35126
|
+
if (clipMask) {
|
|
35127
|
+
clipMask = clipMask.slice();
|
|
35128
|
+
for (let i = 3; i < clipMask.length; i += 4) clipMask[i] = Math.round(clipMask[i] * cachedSoftMaskPixels[i] / 255);
|
|
35129
|
+
} else {
|
|
35130
|
+
clipMask = cachedSoftMaskPixels;
|
|
35131
|
+
}
|
|
35132
|
+
}
|
|
35002
35133
|
const imageClips = original.value.clipImages;
|
|
35003
35134
|
if (imageClips) {
|
|
35004
35135
|
let imageMask = imageClipMasks.get(imageClips);
|
|
@@ -90386,7 +90386,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
90386
90386
|
return false;
|
|
90387
90387
|
}
|
|
90388
90388
|
}, (s, d, sym) => this.tryLinkMemoryNodeSync(sym ? s : resolvePath(rawState.cwd, s), resolvePath(rawState.cwd, d), sym)) : (allArgs.includes("--help") || allArgs.includes("--version")) && (0, gnu_information_exports.gnuInformationSync)(w0Plain, allArgs) !== void 0 ? (0, gnu_information_exports.gnuInformationSync)(w0Plain, allArgs) : w0Plain === "mdq" ? evalSyncMdq(inBytes, allArgs, readFile) : w0Plain === "shuf" ? evalSyncShuf(inBytes, allArgs, readFile) : w0Plain === "html-to-markdown" ? (0, html_to_markdown_exports.evalSyncHtmlToMarkdown)(inBytes, allArgs, readFile) : w0Plain === "unrtf" ? evalSyncUnrtf(optInBytes, allArgs, readFile) : w0Plain === "fmt" ? this.evalSyncFmt(inBytes, allArgs, readFile) : w0Plain === "pr" ? evalSyncPr(optInBytes, allArgs, readFile) : w0Plain === "file" ? (0, file_exports.evalSyncFile)(optInBytes, allArgs, readFile, (p) => this.tryStatMemoryNodeTypeSync(resolvePath(rawState.cwd, p), true)) : w0Plain === "diff3" ? evalSyncDiff3(optInBytes, allArgs, readFile) : w0Plain === "cmp" ? evalSyncCmp(optInBytes, allArgs, readFile) : w0Plain === "diff" ? evalSyncDiff(optInBytes, allArgs, readFile) : w0Plain === "xan" ? evalSyncXan(optInBytes, allArgs, readFile) : w0Plain === "less" || w0Plain === "more" ? (0, less_exports.evalSyncLess)(optInBytes, allArgs, readFile) : w0Plain === "rg" ? evalSyncRg(optInBytes, allArgs, readFile) : w0Plain === "md5sum" || w0Plain === "sha1sum" || w0Plain === "sha224sum" || w0Plain === "sha256sum" || w0Plain === "sha384sum" || w0Plain === "sha512sum" || w0Plain === "cksum" ? (() => {
|
|
90389
|
-
const cs = evalSyncChecksum(w0Plain,
|
|
90389
|
+
const cs = evalSyncChecksum(w0Plain, optInBytes, allArgs, readFile);
|
|
90390
90390
|
return cs !== void 0 && !cs.includes("\0") ? cs : void 0;
|
|
90391
90391
|
})() : w0Plain === "base32" ? (() => {
|
|
90392
90392
|
const b32 = (0, base_exports.evalSyncBase32)(inBytes, allArgs, readFile);
|
|
@@ -38318,7 +38318,7 @@ export class Runtime {
|
|
|
38318
38318
|
: w0Plain === "rg"
|
|
38319
38319
|
? evalSyncRg(optInBytes, allArgs, readFile)
|
|
38320
38320
|
: (w0Plain === "md5sum" || w0Plain === "sha1sum" || w0Plain === "sha224sum" || w0Plain === "sha256sum" || w0Plain === "sha384sum" || w0Plain === "sha512sum" || w0Plain === "cksum")
|
|
38321
|
-
? (() => { const cs = evalSyncChecksum(w0Plain,
|
|
38321
|
+
? (() => { const cs = evalSyncChecksum(w0Plain, optInBytes, allArgs, readFile); return cs !== undefined && !cs.includes("\0") ? cs : undefined; })()
|
|
38322
38322
|
: w0Plain === "base32"
|
|
38323
38323
|
? (() => { const b32 = evalSyncBase32(inBytes, allArgs, readFile); return b32 !== undefined ? sharedSyncPipeDecoder.decode(b32) : undefined; })()
|
|
38324
38324
|
: (w0Plain === "xq" || w0Plain === "yq")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CommandDefinition } from "../safe-bash-contracts/index.js";
|
|
2
2
|
type Algorithm = "sha512" | "sha384" | "sha256" | "sha224" | "sha1" | "md5" | "crc" | "bsd" | "sysv" | "crc32b" | "sm3" | "blake2b" | "sha3";
|
|
3
3
|
export declare function command(name: string, algorithm: Algorithm, maxInputBytes: number): CommandDefinition;
|
|
4
|
-
export declare function evalSyncChecksum(name: string, inBytes: Uint8Array, opArgs: readonly string[], readFileSync?: (p: string) => Uint8Array | undefined, fileOperandName?: string): string | undefined;
|
|
4
|
+
export declare function evalSyncChecksum(name: string, inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (p: string) => Uint8Array | undefined, fileOperandName?: string): string | undefined;
|
|
5
5
|
export {};
|
|
@@ -505,7 +505,7 @@ function digestSync(bytes, algorithm, bits = 512) {
|
|
|
505
505
|
return { hex: String(~crc >>> 0), length };
|
|
506
506
|
}
|
|
507
507
|
function evalSyncChecksum(name, inBytes, opArgs, readFileSync, fileOperandName) {
|
|
508
|
-
if (inBytes.byteLength > 16384)
|
|
508
|
+
if (inBytes && inBytes.byteLength > 16384)
|
|
509
509
|
return void 0;
|
|
510
510
|
const baseAlg = name === "cksum" ? "crc" : name === "md5sum" ? "md5" : name === "sha1sum" ? "sha1" : name === "sha224sum" ? "sha224" : name === "sha256sum" ? "sha256" : name === "sha384sum" ? "sha384" : name === "sha512sum" ? "sha512" : void 0;
|
|
511
511
|
if (!baseAlg)
|
|
@@ -520,6 +520,8 @@ function evalSyncChecksum(name, inBytes, opArgs, readFileSync, fileOperandName)
|
|
|
520
520
|
} catch {
|
|
521
521
|
return void 0;
|
|
522
522
|
}
|
|
523
|
+
if (fileOperandName !== void 0 && settings.operands.includes("-"))
|
|
524
|
+
return void 0;
|
|
523
525
|
if (settings.encoding === "raw")
|
|
524
526
|
return void 0;
|
|
525
527
|
let stdinUsed = false;
|
|
@@ -530,6 +532,8 @@ function evalSyncChecksum(name, inBytes, opArgs, readFileSync, fileOperandName)
|
|
|
530
532
|
return void 0;
|
|
531
533
|
}
|
|
532
534
|
if (filename === "-") {
|
|
535
|
+
if (inBytes === void 0)
|
|
536
|
+
return void 0;
|
|
533
537
|
if (stdinUsed)
|
|
534
538
|
return new Uint8Array(0);
|
|
535
539
|
stdinUsed = true;
|