@poe-platform/safe-bash 0.1.765 → 0.1.766
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 +17 -8
- package/dist/image-ast/index.js +17 -8
- package/dist/pdf-ast/index.js +29 -11
- package/dist/safe-bash/command-chunks/{chunk-DT4MFWV4.js → chunk-DKWMTHU3.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-SVL6HYQL.js → chunk-IOH3F3ZO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-KO4PXCNL.js → chunk-XFUFHHLU.js} +17 -8
- package/dist/safe-bash-command-ffmpeg/index.js +199 -192
- 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 +17 -8
- package/dist/safe-bash-command-pdfinfo/index.js +29 -11
- package/dist/safe-bash-command-pdftk/index.js +17 -8
- package/dist/safe-bash-command-pdftoppm/index.js +29 -11
- package/dist/safe-bash-command-pdftotext/index.js +17 -8
- package/dist/safe-bash-command-qpdf/index.js +17 -8
- 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 +17 -8
- package/dist/safe-bash-command-wkhtmltopdf/index.js +17 -8
- package/package.json +2 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +3 -0
|
@@ -28,8 +28,8 @@ import {
|
|
|
28
28
|
thresholdImage,
|
|
29
29
|
tintImage,
|
|
30
30
|
trimImage
|
|
31
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
32
|
-
import "../safe-bash/command-chunks/chunk-
|
|
31
|
+
} from "../safe-bash/command-chunks/chunk-IOH3F3ZO.js";
|
|
32
|
+
import "../safe-bash/command-chunks/chunk-XFUFHHLU.js";
|
|
33
33
|
import {
|
|
34
34
|
init_buffer
|
|
35
35
|
} from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
createPandocCommand,
|
|
3
3
|
createPandocCommands,
|
|
4
4
|
pandocCommands
|
|
5
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
5
|
+
} from "../safe-bash/command-chunks/chunk-DKWMTHU3.js";
|
|
6
6
|
import "../safe-bash/command-chunks/chunk-MKQVQMXO.js";
|
|
7
7
|
import "../safe-bash/command-chunks/chunk-RDV7UCYZ.js";
|
|
8
|
-
import "../safe-bash/command-chunks/chunk-
|
|
9
|
-
import "../safe-bash/command-chunks/chunk-
|
|
8
|
+
import "../safe-bash/command-chunks/chunk-IOH3F3ZO.js";
|
|
9
|
+
import "../safe-bash/command-chunks/chunk-XFUFHHLU.js";
|
|
10
10
|
import "../safe-bash/command-chunks/chunk-Y2KHC6TZ.js";
|
|
11
11
|
import "../safe-bash/command-chunks/chunk-YGYOVXTO.js";
|
|
12
12
|
import "../safe-bash/command-chunks/chunk-I5GLTNVH.js";
|
|
@@ -21,11 +21,11 @@ import {
|
|
|
21
21
|
readDocument,
|
|
22
22
|
resolveConversionArgs,
|
|
23
23
|
writeDocument
|
|
24
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
24
|
+
} from "../safe-bash/command-chunks/chunk-DKWMTHU3.js";
|
|
25
25
|
import "../safe-bash/command-chunks/chunk-MKQVQMXO.js";
|
|
26
26
|
import "../safe-bash/command-chunks/chunk-RDV7UCYZ.js";
|
|
27
|
-
import "../safe-bash/command-chunks/chunk-
|
|
28
|
-
import "../safe-bash/command-chunks/chunk-
|
|
27
|
+
import "../safe-bash/command-chunks/chunk-IOH3F3ZO.js";
|
|
28
|
+
import "../safe-bash/command-chunks/chunk-XFUFHHLU.js";
|
|
29
29
|
import {
|
|
30
30
|
createLuaFilterCapability
|
|
31
31
|
} from "../safe-bash/command-chunks/chunk-Y2KHC6TZ.js";
|
|
@@ -36184,10 +36184,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36184
36184
|
const patArr = params.cosDoc.resolveArray(dArr.items[0]);
|
|
36185
36185
|
const phaseNode = params.cosDoc.resolve(dArr.items[1]);
|
|
36186
36186
|
if (patArr) {
|
|
36187
|
-
|
|
36187
|
+
const dashArray = patArr.items.map((it) => {
|
|
36188
36188
|
const r = params.cosDoc.resolve(it);
|
|
36189
36189
|
return r?.kind === "number" ? r.value : 0;
|
|
36190
|
-
}).filter((n) => n
|
|
36190
|
+
}).filter((n) => n >= 0);
|
|
36191
|
+
st.dashArray = dashArray.some((value) => value > 0) ? dashArray : void 0;
|
|
36191
36192
|
st.dashPhase = phaseNode?.kind === "number" ? phaseNode.value : 0;
|
|
36192
36193
|
}
|
|
36193
36194
|
}
|
|
@@ -39191,7 +39192,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
39191
39192
|
while (remaining <= 0) {
|
|
39192
39193
|
if (++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
39193
39194
|
if (index % 2 === 0) {
|
|
39194
|
-
if (pattern[index] === 0) result.push({ points: [point, point], closed: false });
|
|
39195
|
+
if (pattern[index] === 0) result.push({ points: [point, point], closed: false, zeroLengthDash: true });
|
|
39195
39196
|
flush();
|
|
39196
39197
|
}
|
|
39197
39198
|
index = (index + 1) % pattern.length;
|
|
@@ -39206,7 +39207,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
39206
39207
|
throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
39207
39208
|
}
|
|
39208
39209
|
let distance = 0;
|
|
39209
|
-
while (distance
|
|
39210
|
+
while (length - distance > 8 * Number.EPSILON * Math.max(1, length)) {
|
|
39210
39211
|
const point = [start[0] + dx * distance / length, start[1] + dy * distance / length];
|
|
39211
39212
|
advance(point);
|
|
39212
39213
|
const step = Math.min(remaining, length - distance);
|
|
@@ -39321,7 +39322,15 @@ function strokeOutlines(paths, width, cap, join, miterLimit, dashArray = [], das
|
|
|
39321
39322
|
let closed = subpath.closed;
|
|
39322
39323
|
if (closed && points.length > 1 && Math.hypot(points[0][0] - points[points.length - 1][0], points[0][1] - points[points.length - 1][1]) <= 1e-14) points.pop();
|
|
39323
39324
|
if (points.length < 3) closed = false;
|
|
39324
|
-
if (points.length === 1 &&
|
|
39325
|
+
if (points.length === 1 && cap === 2 && subpath.zeroLengthDash) {
|
|
39326
|
+
contour = [];
|
|
39327
|
+
const [x, y] = points[0];
|
|
39328
|
+
add(x - half, y - half);
|
|
39329
|
+
add(x + half, y - half);
|
|
39330
|
+
add(x + half, y + half);
|
|
39331
|
+
add(x - half, y + half);
|
|
39332
|
+
contours.push(contour);
|
|
39333
|
+
} else if (points.length === 1 && subpath.points.length > 1 && cap === 1) {
|
|
39325
39334
|
contour = [];
|
|
39326
39335
|
const [x, y] = points[0];
|
|
39327
39336
|
addCap([x, y], [x + 1, y]);
|
|
@@ -40267,7 +40276,7 @@ function prepareStroke(path, scale) {
|
|
|
40267
40276
|
}
|
|
40268
40277
|
return { matrix, width, dashArray, dashPhase };
|
|
40269
40278
|
}
|
|
40270
|
-
function
|
|
40279
|
+
function strokeContours(path, pageHeight, scale) {
|
|
40271
40280
|
const stroke = prepareStroke(path, scale);
|
|
40272
40281
|
if (!stroke) return [];
|
|
40273
40282
|
const inverse = inverseStrokeMatrix(stroke.matrix);
|
|
@@ -40291,7 +40300,7 @@ function strokeEdges(path, pageHeight, scale) {
|
|
|
40291
40300
|
stroke.dashArray?.map((value) => Math.max(0, value * strokeScale)),
|
|
40292
40301
|
stroke.dashPhase * strokeScale
|
|
40293
40302
|
);
|
|
40294
|
-
return
|
|
40303
|
+
return contours.map((points) => points.map(toScreen));
|
|
40295
40304
|
}
|
|
40296
40305
|
function pathsToEdges(paths, closeSubpaths = false) {
|
|
40297
40306
|
const edges = [];
|
|
@@ -40544,7 +40553,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
40544
40553
|
if (path.strokeColor) {
|
|
40545
40554
|
const rawSw = path.strokeWidth * scale * (path.strokeMatrix ? Math.hypot(path.strokeMatrix[0], path.strokeMatrix[1]) : 1);
|
|
40546
40555
|
const strokeAlpha = options.thinLineMode === "shape" && rawSw < 1 ? (path.strokeAlpha ?? 1) * Math.max(0.25, rawSw) : path.strokeAlpha ?? 1;
|
|
40547
|
-
const edges =
|
|
40556
|
+
const edges = pathsToEdges(strokeContours(path, displayList.height, scale).map((points) => ({ points, closed: true })));
|
|
40548
40557
|
const clipScreen = path.clipRect ? [path.clipRect[0] * scale, (displayList.height - path.clipRect[3]) * scale, path.clipRect[2] * scale, (displayList.height - path.clipRect[1]) * scale] : void 0;
|
|
40549
40558
|
fillEdgesScanline4x4(
|
|
40550
40559
|
rgba,
|
|
@@ -36378,10 +36378,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36378
36378
|
const patArr = params.cosDoc.resolveArray(dArr.items[0]);
|
|
36379
36379
|
const phaseNode = params.cosDoc.resolve(dArr.items[1]);
|
|
36380
36380
|
if (patArr) {
|
|
36381
|
-
|
|
36381
|
+
const dashArray = patArr.items.map((it) => {
|
|
36382
36382
|
const r = params.cosDoc.resolve(it);
|
|
36383
36383
|
return r?.kind === "number" ? r.value : 0;
|
|
36384
|
-
}).filter((n) => n
|
|
36384
|
+
}).filter((n) => n >= 0);
|
|
36385
|
+
st.dashArray = dashArray.some((value) => value > 0) ? dashArray : void 0;
|
|
36385
36386
|
st.dashPhase = phaseNode?.kind === "number" ? phaseNode.value : 0;
|
|
36386
36387
|
}
|
|
36387
36388
|
}
|
|
@@ -39385,7 +39386,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
39385
39386
|
while (remaining <= 0) {
|
|
39386
39387
|
if (++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
39387
39388
|
if (index % 2 === 0) {
|
|
39388
|
-
if (pattern[index] === 0) result.push({ points: [point, point], closed: false });
|
|
39389
|
+
if (pattern[index] === 0) result.push({ points: [point, point], closed: false, zeroLengthDash: true });
|
|
39389
39390
|
flush();
|
|
39390
39391
|
}
|
|
39391
39392
|
index = (index + 1) % pattern.length;
|
|
@@ -39400,7 +39401,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
39400
39401
|
throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
39401
39402
|
}
|
|
39402
39403
|
let distance = 0;
|
|
39403
|
-
while (distance
|
|
39404
|
+
while (length - distance > 8 * Number.EPSILON * Math.max(1, length)) {
|
|
39404
39405
|
const point = [start[0] + dx * distance / length, start[1] + dy * distance / length];
|
|
39405
39406
|
advance(point);
|
|
39406
39407
|
const step = Math.min(remaining, length - distance);
|
|
@@ -39515,7 +39516,15 @@ function strokeOutlines(paths, width, cap, join, miterLimit, dashArray = [], das
|
|
|
39515
39516
|
let closed = subpath.closed;
|
|
39516
39517
|
if (closed && points.length > 1 && Math.hypot(points[0][0] - points[points.length - 1][0], points[0][1] - points[points.length - 1][1]) <= 1e-14) points.pop();
|
|
39517
39518
|
if (points.length < 3) closed = false;
|
|
39518
|
-
if (points.length === 1 &&
|
|
39519
|
+
if (points.length === 1 && cap === 2 && subpath.zeroLengthDash) {
|
|
39520
|
+
contour = [];
|
|
39521
|
+
const [x, y] = points[0];
|
|
39522
|
+
add(x - half, y - half);
|
|
39523
|
+
add(x + half, y - half);
|
|
39524
|
+
add(x + half, y + half);
|
|
39525
|
+
add(x - half, y + half);
|
|
39526
|
+
contours.push(contour);
|
|
39527
|
+
} else if (points.length === 1 && subpath.points.length > 1 && cap === 1) {
|
|
39519
39528
|
contour = [];
|
|
39520
39529
|
const [x, y] = points[0];
|
|
39521
39530
|
addCap([x, y], [x + 1, y]);
|
|
@@ -40703,7 +40712,7 @@ function prepareStroke(path, scale) {
|
|
|
40703
40712
|
}
|
|
40704
40713
|
return { matrix, width, dashArray, dashPhase };
|
|
40705
40714
|
}
|
|
40706
|
-
function
|
|
40715
|
+
function strokeContours(path, pageHeight, scale) {
|
|
40707
40716
|
const stroke = prepareStroke(path, scale);
|
|
40708
40717
|
if (!stroke) return [];
|
|
40709
40718
|
const inverse = inverseStrokeMatrix(stroke.matrix);
|
|
@@ -40727,7 +40736,7 @@ function strokeEdges(path, pageHeight, scale) {
|
|
|
40727
40736
|
stroke.dashArray?.map((value) => Math.max(0, value * strokeScale)),
|
|
40728
40737
|
stroke.dashPhase * strokeScale
|
|
40729
40738
|
);
|
|
40730
|
-
return
|
|
40739
|
+
return contours.map((points) => points.map(toScreen));
|
|
40731
40740
|
}
|
|
40732
40741
|
function pathsToEdges(paths, closeSubpaths = false) {
|
|
40733
40742
|
const edges = [];
|
|
@@ -40980,7 +40989,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
40980
40989
|
if (path.strokeColor) {
|
|
40981
40990
|
const rawSw = path.strokeWidth * scale * (path.strokeMatrix ? Math.hypot(path.strokeMatrix[0], path.strokeMatrix[1]) : 1);
|
|
40982
40991
|
const strokeAlpha = options.thinLineMode === "shape" && rawSw < 1 ? (path.strokeAlpha ?? 1) * Math.max(0.25, rawSw) : path.strokeAlpha ?? 1;
|
|
40983
|
-
const edges =
|
|
40992
|
+
const edges = pathsToEdges(strokeContours(path, displayList.height, scale).map((points) => ({ points, closed: true })));
|
|
40984
40993
|
const clipScreen = path.clipRect ? [path.clipRect[0] * scale, (displayList.height - path.clipRect[3]) * scale, path.clipRect[2] * scale, (displayList.height - path.clipRect[1]) * scale] : void 0;
|
|
40985
40994
|
fillEdgesScanline4x4(
|
|
40986
40995
|
rgba,
|
|
@@ -41222,6 +41231,7 @@ function renderDisplayListToSvg(displayList, options = {}) {
|
|
|
41222
41231
|
} else if (operation.kind === "path") {
|
|
41223
41232
|
const p = operation.value;
|
|
41224
41233
|
const prepared = p.strokeColor ? prepareStroke(p, Math.max(scaleX, scaleY)) : void 0;
|
|
41234
|
+
const outlineStroke = prepared && p.dashArray?.includes(0);
|
|
41225
41235
|
const matrix = prepared && (prepared.matrix[0] !== 1 || prepared.matrix[1] !== 0 || prepared.matrix[2] !== 0 || prepared.matrix[3] !== 1) ? prepared.matrix : void 0;
|
|
41226
41236
|
const inverse = matrix ? inverseStrokeMatrix(matrix) : void 0;
|
|
41227
41237
|
const pathData = svgPathData(p.segments, inverse ? 0 : displayList.height, inverse);
|
|
@@ -41236,10 +41246,18 @@ function renderDisplayListToSvg(displayList, options = {}) {
|
|
|
41236
41246
|
const lineCapAttr = p.lineCap === 1 ? ` stroke-linecap="round"` : p.lineCap === 2 ? ` stroke-linecap="square"` : "";
|
|
41237
41247
|
const lineJoinAttr = p.lineJoin === 1 ? ` stroke-linejoin="round"` : p.lineJoin === 2 ? ` stroke-linejoin="bevel"` : "";
|
|
41238
41248
|
const miterLimitAttr = p.miterLimit !== void 0 && p.miterLimit !== 10 ? ` stroke-miterlimit="${p.miterLimit}"` : "";
|
|
41239
|
-
const dashArrayAttr = prepared?.dashArray?.length ? ` stroke-dasharray="${prepared.dashArray.join(" ")}"` : "";
|
|
41240
|
-
const dashOffsetAttr = prepared?.dashPhase ? ` stroke-dashoffset="${prepared.dashPhase}"` : "";
|
|
41249
|
+
const dashArrayAttr = !outlineStroke && prepared?.dashArray?.length ? ` stroke-dasharray="${prepared.dashArray.join(" ")}"` : "";
|
|
41250
|
+
const dashOffsetAttr = !outlineStroke && prepared?.dashPhase ? ` stroke-dashoffset="${prepared.dashPhase}"` : "";
|
|
41241
41251
|
const labelAttr = original.kind === "glyph" ? ` aria-label="${escapeXmlText(original.value.unicode)}"` : "";
|
|
41242
|
-
|
|
41252
|
+
if (!outlineStroke || p.fillColor) {
|
|
41253
|
+
parts.push(` <path${labelAttr}${transformAttr} d="${pathData}" fill="${fill}"${fillRuleAttr}${fillOpacityAttr} stroke="${outlineStroke ? "none" : stroke}"${strokeOpacityAttr}${strokeWidthAttr}${lineCapAttr}${lineJoinAttr}${miterLimitAttr}${dashArrayAttr}${dashOffsetAttr}/>`);
|
|
41254
|
+
}
|
|
41255
|
+
if (outlineStroke) {
|
|
41256
|
+
const outlineScale = Math.max(scaleX, scaleY);
|
|
41257
|
+
const contours = strokeContours(p, displayList.height, outlineScale);
|
|
41258
|
+
const outlineData = contours.map((points) => points.map(([x, y], i) => `${i === 0 ? "M" : "L"} ${x / outlineScale} ${y / outlineScale}`).join(" ") + " Z").join(" ");
|
|
41259
|
+
if (outlineData) parts.push(` <path${labelAttr} d="${outlineData}" fill="${stroke}" fill-opacity="${p.strokeAlpha ?? 1}"/>`);
|
|
41260
|
+
}
|
|
41243
41261
|
}
|
|
41244
41262
|
} else if (operation.kind === "image") {
|
|
41245
41263
|
parts.push(` ${svgImage(operation.value, displayList.height)}`);
|
|
@@ -35839,10 +35839,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
35839
35839
|
const patArr = params.cosDoc.resolveArray(dArr.items[0]);
|
|
35840
35840
|
const phaseNode = params.cosDoc.resolve(dArr.items[1]);
|
|
35841
35841
|
if (patArr) {
|
|
35842
|
-
|
|
35842
|
+
const dashArray = patArr.items.map((it) => {
|
|
35843
35843
|
const r = params.cosDoc.resolve(it);
|
|
35844
35844
|
return r?.kind === "number" ? r.value : 0;
|
|
35845
|
-
}).filter((n) => n
|
|
35845
|
+
}).filter((n) => n >= 0);
|
|
35846
|
+
st.dashArray = dashArray.some((value) => value > 0) ? dashArray : void 0;
|
|
35846
35847
|
st.dashPhase = phaseNode?.kind === "number" ? phaseNode.value : 0;
|
|
35847
35848
|
}
|
|
35848
35849
|
}
|
|
@@ -39410,7 +39411,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
39410
39411
|
while (remaining <= 0) {
|
|
39411
39412
|
if (++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
39412
39413
|
if (index % 2 === 0) {
|
|
39413
|
-
if (pattern[index] === 0) result.push({ points: [point, point], closed: false });
|
|
39414
|
+
if (pattern[index] === 0) result.push({ points: [point, point], closed: false, zeroLengthDash: true });
|
|
39414
39415
|
flush();
|
|
39415
39416
|
}
|
|
39416
39417
|
index = (index + 1) % pattern.length;
|
|
@@ -39425,7 +39426,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
39425
39426
|
throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
39426
39427
|
}
|
|
39427
39428
|
let distance = 0;
|
|
39428
|
-
while (distance
|
|
39429
|
+
while (length - distance > 8 * Number.EPSILON * Math.max(1, length)) {
|
|
39429
39430
|
const point = [start[0] + dx * distance / length, start[1] + dy * distance / length];
|
|
39430
39431
|
advance(point);
|
|
39431
39432
|
const step = Math.min(remaining, length - distance);
|
|
@@ -39540,7 +39541,15 @@ function strokeOutlines(paths, width, cap, join, miterLimit, dashArray = [], das
|
|
|
39540
39541
|
let closed = subpath.closed;
|
|
39541
39542
|
if (closed && points.length > 1 && Math.hypot(points[0][0] - points[points.length - 1][0], points[0][1] - points[points.length - 1][1]) <= 1e-14) points.pop();
|
|
39542
39543
|
if (points.length < 3) closed = false;
|
|
39543
|
-
if (points.length === 1 &&
|
|
39544
|
+
if (points.length === 1 && cap === 2 && subpath.zeroLengthDash) {
|
|
39545
|
+
contour = [];
|
|
39546
|
+
const [x, y] = points[0];
|
|
39547
|
+
add(x - half, y - half);
|
|
39548
|
+
add(x + half, y - half);
|
|
39549
|
+
add(x + half, y + half);
|
|
39550
|
+
add(x - half, y + half);
|
|
39551
|
+
contours.push(contour);
|
|
39552
|
+
} else if (points.length === 1 && subpath.points.length > 1 && cap === 1) {
|
|
39544
39553
|
contour = [];
|
|
39545
39554
|
const [x, y] = points[0];
|
|
39546
39555
|
addCap([x, y], [x + 1, y]);
|
|
@@ -40332,7 +40341,7 @@ function prepareStroke(path, scale) {
|
|
|
40332
40341
|
}
|
|
40333
40342
|
return { matrix, width, dashArray, dashPhase };
|
|
40334
40343
|
}
|
|
40335
|
-
function
|
|
40344
|
+
function strokeContours(path, pageHeight, scale) {
|
|
40336
40345
|
const stroke = prepareStroke(path, scale);
|
|
40337
40346
|
if (!stroke) return [];
|
|
40338
40347
|
const inverse = inverseStrokeMatrix(stroke.matrix);
|
|
@@ -40356,7 +40365,7 @@ function strokeEdges(path, pageHeight, scale) {
|
|
|
40356
40365
|
stroke.dashArray?.map((value) => Math.max(0, value * strokeScale)),
|
|
40357
40366
|
stroke.dashPhase * strokeScale
|
|
40358
40367
|
);
|
|
40359
|
-
return
|
|
40368
|
+
return contours.map((points) => points.map(toScreen));
|
|
40360
40369
|
}
|
|
40361
40370
|
function pathsToEdges(paths, closeSubpaths = false) {
|
|
40362
40371
|
const edges = [];
|
|
@@ -40609,7 +40618,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
40609
40618
|
if (path.strokeColor) {
|
|
40610
40619
|
const rawSw = path.strokeWidth * scale * (path.strokeMatrix ? Math.hypot(path.strokeMatrix[0], path.strokeMatrix[1]) : 1);
|
|
40611
40620
|
const strokeAlpha = options.thinLineMode === "shape" && rawSw < 1 ? (path.strokeAlpha ?? 1) * Math.max(0.25, rawSw) : path.strokeAlpha ?? 1;
|
|
40612
|
-
const edges =
|
|
40621
|
+
const edges = pathsToEdges(strokeContours(path, displayList.height, scale).map((points) => ({ points, closed: true })));
|
|
40613
40622
|
const clipScreen = path.clipRect ? [path.clipRect[0] * scale, (displayList.height - path.clipRect[3]) * scale, path.clipRect[2] * scale, (displayList.height - path.clipRect[1]) * scale] : void 0;
|
|
40614
40623
|
fillEdgesScanline4x4(
|
|
40615
40624
|
rgba,
|
|
@@ -36033,10 +36033,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36033
36033
|
const patArr = params.cosDoc.resolveArray(dArr.items[0]);
|
|
36034
36034
|
const phaseNode = params.cosDoc.resolve(dArr.items[1]);
|
|
36035
36035
|
if (patArr) {
|
|
36036
|
-
|
|
36036
|
+
const dashArray = patArr.items.map((it) => {
|
|
36037
36037
|
const r = params.cosDoc.resolve(it);
|
|
36038
36038
|
return r?.kind === "number" ? r.value : 0;
|
|
36039
|
-
}).filter((n) => n
|
|
36039
|
+
}).filter((n) => n >= 0);
|
|
36040
|
+
st.dashArray = dashArray.some((value) => value > 0) ? dashArray : void 0;
|
|
36040
36041
|
st.dashPhase = phaseNode?.kind === "number" ? phaseNode.value : 0;
|
|
36041
36042
|
}
|
|
36042
36043
|
}
|
|
@@ -39040,7 +39041,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
39040
39041
|
while (remaining <= 0) {
|
|
39041
39042
|
if (++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
39042
39043
|
if (index % 2 === 0) {
|
|
39043
|
-
if (pattern[index] === 0) result.push({ points: [point, point], closed: false });
|
|
39044
|
+
if (pattern[index] === 0) result.push({ points: [point, point], closed: false, zeroLengthDash: true });
|
|
39044
39045
|
flush();
|
|
39045
39046
|
}
|
|
39046
39047
|
index = (index + 1) % pattern.length;
|
|
@@ -39055,7 +39056,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
39055
39056
|
throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
39056
39057
|
}
|
|
39057
39058
|
let distance = 0;
|
|
39058
|
-
while (distance
|
|
39059
|
+
while (length - distance > 8 * Number.EPSILON * Math.max(1, length)) {
|
|
39059
39060
|
const point = [start[0] + dx * distance / length, start[1] + dy * distance / length];
|
|
39060
39061
|
advance(point);
|
|
39061
39062
|
const step = Math.min(remaining, length - distance);
|
|
@@ -39170,7 +39171,15 @@ function strokeOutlines(paths, width, cap, join, miterLimit, dashArray = [], das
|
|
|
39170
39171
|
let closed = subpath.closed;
|
|
39171
39172
|
if (closed && points.length > 1 && Math.hypot(points[0][0] - points[points.length - 1][0], points[0][1] - points[points.length - 1][1]) <= 1e-14) points.pop();
|
|
39172
39173
|
if (points.length < 3) closed = false;
|
|
39173
|
-
if (points.length === 1 &&
|
|
39174
|
+
if (points.length === 1 && cap === 2 && subpath.zeroLengthDash) {
|
|
39175
|
+
contour = [];
|
|
39176
|
+
const [x, y] = points[0];
|
|
39177
|
+
add(x - half, y - half);
|
|
39178
|
+
add(x + half, y - half);
|
|
39179
|
+
add(x + half, y + half);
|
|
39180
|
+
add(x - half, y + half);
|
|
39181
|
+
contours.push(contour);
|
|
39182
|
+
} else if (points.length === 1 && subpath.points.length > 1 && cap === 1) {
|
|
39174
39183
|
contour = [];
|
|
39175
39184
|
const [x, y] = points[0];
|
|
39176
39185
|
addCap([x, y], [x + 1, y]);
|
|
@@ -40358,7 +40367,7 @@ function prepareStroke(path, scale) {
|
|
|
40358
40367
|
}
|
|
40359
40368
|
return { matrix, width, dashArray, dashPhase };
|
|
40360
40369
|
}
|
|
40361
|
-
function
|
|
40370
|
+
function strokeContours(path, pageHeight, scale) {
|
|
40362
40371
|
const stroke = prepareStroke(path, scale);
|
|
40363
40372
|
if (!stroke) return [];
|
|
40364
40373
|
const inverse = inverseStrokeMatrix(stroke.matrix);
|
|
@@ -40382,7 +40391,7 @@ function strokeEdges(path, pageHeight, scale) {
|
|
|
40382
40391
|
stroke.dashArray?.map((value) => Math.max(0, value * strokeScale)),
|
|
40383
40392
|
stroke.dashPhase * strokeScale
|
|
40384
40393
|
);
|
|
40385
|
-
return
|
|
40394
|
+
return contours.map((points) => points.map(toScreen));
|
|
40386
40395
|
}
|
|
40387
40396
|
function pathsToEdges(paths, closeSubpaths = false) {
|
|
40388
40397
|
const edges = [];
|
|
@@ -40635,7 +40644,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
40635
40644
|
if (path.strokeColor) {
|
|
40636
40645
|
const rawSw = path.strokeWidth * scale * (path.strokeMatrix ? Math.hypot(path.strokeMatrix[0], path.strokeMatrix[1]) : 1);
|
|
40637
40646
|
const strokeAlpha = options.thinLineMode === "shape" && rawSw < 1 ? (path.strokeAlpha ?? 1) * Math.max(0.25, rawSw) : path.strokeAlpha ?? 1;
|
|
40638
|
-
const edges =
|
|
40647
|
+
const edges = pathsToEdges(strokeContours(path, displayList.height, scale).map((points) => ({ points, closed: true })));
|
|
40639
40648
|
const clipScreen = path.clipRect ? [path.clipRect[0] * scale, (displayList.height - path.clipRect[3]) * scale, path.clipRect[2] * scale, (displayList.height - path.clipRect[1]) * scale] : void 0;
|
|
40640
40649
|
fillEdgesScanline4x4(
|
|
40641
40650
|
rgba,
|
|
@@ -40877,6 +40886,7 @@ function renderDisplayListToSvg(displayList, options = {}) {
|
|
|
40877
40886
|
} else if (operation.kind === "path") {
|
|
40878
40887
|
const p = operation.value;
|
|
40879
40888
|
const prepared = p.strokeColor ? prepareStroke(p, Math.max(scaleX, scaleY)) : void 0;
|
|
40889
|
+
const outlineStroke = prepared && p.dashArray?.includes(0);
|
|
40880
40890
|
const matrix = prepared && (prepared.matrix[0] !== 1 || prepared.matrix[1] !== 0 || prepared.matrix[2] !== 0 || prepared.matrix[3] !== 1) ? prepared.matrix : void 0;
|
|
40881
40891
|
const inverse = matrix ? inverseStrokeMatrix(matrix) : void 0;
|
|
40882
40892
|
const pathData = svgPathData(p.segments, inverse ? 0 : displayList.height, inverse);
|
|
@@ -40891,10 +40901,18 @@ function renderDisplayListToSvg(displayList, options = {}) {
|
|
|
40891
40901
|
const lineCapAttr = p.lineCap === 1 ? ` stroke-linecap="round"` : p.lineCap === 2 ? ` stroke-linecap="square"` : "";
|
|
40892
40902
|
const lineJoinAttr = p.lineJoin === 1 ? ` stroke-linejoin="round"` : p.lineJoin === 2 ? ` stroke-linejoin="bevel"` : "";
|
|
40893
40903
|
const miterLimitAttr = p.miterLimit !== void 0 && p.miterLimit !== 10 ? ` stroke-miterlimit="${p.miterLimit}"` : "";
|
|
40894
|
-
const dashArrayAttr = prepared?.dashArray?.length ? ` stroke-dasharray="${prepared.dashArray.join(" ")}"` : "";
|
|
40895
|
-
const dashOffsetAttr = prepared?.dashPhase ? ` stroke-dashoffset="${prepared.dashPhase}"` : "";
|
|
40904
|
+
const dashArrayAttr = !outlineStroke && prepared?.dashArray?.length ? ` stroke-dasharray="${prepared.dashArray.join(" ")}"` : "";
|
|
40905
|
+
const dashOffsetAttr = !outlineStroke && prepared?.dashPhase ? ` stroke-dashoffset="${prepared.dashPhase}"` : "";
|
|
40896
40906
|
const labelAttr = original.kind === "glyph" ? ` aria-label="${escapeXmlText(original.value.unicode)}"` : "";
|
|
40897
|
-
|
|
40907
|
+
if (!outlineStroke || p.fillColor) {
|
|
40908
|
+
parts.push(` <path${labelAttr}${transformAttr} d="${pathData}" fill="${fill}"${fillRuleAttr}${fillOpacityAttr} stroke="${outlineStroke ? "none" : stroke}"${strokeOpacityAttr}${strokeWidthAttr}${lineCapAttr}${lineJoinAttr}${miterLimitAttr}${dashArrayAttr}${dashOffsetAttr}/>`);
|
|
40909
|
+
}
|
|
40910
|
+
if (outlineStroke) {
|
|
40911
|
+
const outlineScale = Math.max(scaleX, scaleY);
|
|
40912
|
+
const contours = strokeContours(p, displayList.height, outlineScale);
|
|
40913
|
+
const outlineData = contours.map((points) => points.map(([x, y], i) => `${i === 0 ? "M" : "L"} ${x / outlineScale} ${y / outlineScale}`).join(" ") + " Z").join(" ");
|
|
40914
|
+
if (outlineData) parts.push(` <path${labelAttr} d="${outlineData}" fill="${stroke}" fill-opacity="${p.strokeAlpha ?? 1}"/>`);
|
|
40915
|
+
}
|
|
40898
40916
|
}
|
|
40899
40917
|
} else if (operation.kind === "image") {
|
|
40900
40918
|
parts.push(` ${svgImage(operation.value, displayList.height)}`);
|
|
@@ -36184,10 +36184,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36184
36184
|
const patArr = params.cosDoc.resolveArray(dArr.items[0]);
|
|
36185
36185
|
const phaseNode = params.cosDoc.resolve(dArr.items[1]);
|
|
36186
36186
|
if (patArr) {
|
|
36187
|
-
|
|
36187
|
+
const dashArray = patArr.items.map((it) => {
|
|
36188
36188
|
const r = params.cosDoc.resolve(it);
|
|
36189
36189
|
return r?.kind === "number" ? r.value : 0;
|
|
36190
|
-
}).filter((n) => n
|
|
36190
|
+
}).filter((n) => n >= 0);
|
|
36191
|
+
st.dashArray = dashArray.some((value) => value > 0) ? dashArray : void 0;
|
|
36191
36192
|
st.dashPhase = phaseNode?.kind === "number" ? phaseNode.value : 0;
|
|
36192
36193
|
}
|
|
36193
36194
|
}
|
|
@@ -39191,7 +39192,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
39191
39192
|
while (remaining <= 0) {
|
|
39192
39193
|
if (++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
39193
39194
|
if (index % 2 === 0) {
|
|
39194
|
-
if (pattern[index] === 0) result.push({ points: [point, point], closed: false });
|
|
39195
|
+
if (pattern[index] === 0) result.push({ points: [point, point], closed: false, zeroLengthDash: true });
|
|
39195
39196
|
flush();
|
|
39196
39197
|
}
|
|
39197
39198
|
index = (index + 1) % pattern.length;
|
|
@@ -39206,7 +39207,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
39206
39207
|
throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
39207
39208
|
}
|
|
39208
39209
|
let distance = 0;
|
|
39209
|
-
while (distance
|
|
39210
|
+
while (length - distance > 8 * Number.EPSILON * Math.max(1, length)) {
|
|
39210
39211
|
const point = [start[0] + dx * distance / length, start[1] + dy * distance / length];
|
|
39211
39212
|
advance(point);
|
|
39212
39213
|
const step = Math.min(remaining, length - distance);
|
|
@@ -39321,7 +39322,15 @@ function strokeOutlines(paths, width, cap, join, miterLimit, dashArray = [], das
|
|
|
39321
39322
|
let closed = subpath.closed;
|
|
39322
39323
|
if (closed && points.length > 1 && Math.hypot(points[0][0] - points[points.length - 1][0], points[0][1] - points[points.length - 1][1]) <= 1e-14) points.pop();
|
|
39323
39324
|
if (points.length < 3) closed = false;
|
|
39324
|
-
if (points.length === 1 &&
|
|
39325
|
+
if (points.length === 1 && cap === 2 && subpath.zeroLengthDash) {
|
|
39326
|
+
contour = [];
|
|
39327
|
+
const [x, y] = points[0];
|
|
39328
|
+
add(x - half, y - half);
|
|
39329
|
+
add(x + half, y - half);
|
|
39330
|
+
add(x + half, y + half);
|
|
39331
|
+
add(x - half, y + half);
|
|
39332
|
+
contours.push(contour);
|
|
39333
|
+
} else if (points.length === 1 && subpath.points.length > 1 && cap === 1) {
|
|
39325
39334
|
contour = [];
|
|
39326
39335
|
const [x, y] = points[0];
|
|
39327
39336
|
addCap([x, y], [x + 1, y]);
|
|
@@ -40340,7 +40349,7 @@ function prepareStroke(path, scale) {
|
|
|
40340
40349
|
}
|
|
40341
40350
|
return { matrix, width, dashArray, dashPhase };
|
|
40342
40351
|
}
|
|
40343
|
-
function
|
|
40352
|
+
function strokeContours(path, pageHeight, scale) {
|
|
40344
40353
|
const stroke = prepareStroke(path, scale);
|
|
40345
40354
|
if (!stroke) return [];
|
|
40346
40355
|
const inverse = inverseStrokeMatrix(stroke.matrix);
|
|
@@ -40364,7 +40373,7 @@ function strokeEdges(path, pageHeight, scale) {
|
|
|
40364
40373
|
stroke.dashArray?.map((value) => Math.max(0, value * strokeScale)),
|
|
40365
40374
|
stroke.dashPhase * strokeScale
|
|
40366
40375
|
);
|
|
40367
|
-
return
|
|
40376
|
+
return contours.map((points) => points.map(toScreen));
|
|
40368
40377
|
}
|
|
40369
40378
|
function pathsToEdges(paths, closeSubpaths = false) {
|
|
40370
40379
|
const edges = [];
|
|
@@ -40617,7 +40626,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
40617
40626
|
if (path.strokeColor) {
|
|
40618
40627
|
const rawSw = path.strokeWidth * scale * (path.strokeMatrix ? Math.hypot(path.strokeMatrix[0], path.strokeMatrix[1]) : 1);
|
|
40619
40628
|
const strokeAlpha = options.thinLineMode === "shape" && rawSw < 1 ? (path.strokeAlpha ?? 1) * Math.max(0.25, rawSw) : path.strokeAlpha ?? 1;
|
|
40620
|
-
const edges =
|
|
40629
|
+
const edges = pathsToEdges(strokeContours(path, displayList.height, scale).map((points) => ({ points, closed: true })));
|
|
40621
40630
|
const clipScreen = path.clipRect ? [path.clipRect[0] * scale, (displayList.height - path.clipRect[3]) * scale, path.clipRect[2] * scale, (displayList.height - path.clipRect[1]) * scale] : void 0;
|
|
40622
40631
|
fillEdgesScanline4x4(
|
|
40623
40632
|
rgba,
|
|
@@ -35839,10 +35839,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
35839
35839
|
const patArr = params.cosDoc.resolveArray(dArr.items[0]);
|
|
35840
35840
|
const phaseNode = params.cosDoc.resolve(dArr.items[1]);
|
|
35841
35841
|
if (patArr) {
|
|
35842
|
-
|
|
35842
|
+
const dashArray = patArr.items.map((it) => {
|
|
35843
35843
|
const r = params.cosDoc.resolve(it);
|
|
35844
35844
|
return r?.kind === "number" ? r.value : 0;
|
|
35845
|
-
}).filter((n) => n
|
|
35845
|
+
}).filter((n) => n >= 0);
|
|
35846
|
+
st.dashArray = dashArray.some((value) => value > 0) ? dashArray : void 0;
|
|
35846
35847
|
st.dashPhase = phaseNode?.kind === "number" ? phaseNode.value : 0;
|
|
35847
35848
|
}
|
|
35848
35849
|
}
|
|
@@ -38956,7 +38957,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
38956
38957
|
while (remaining <= 0) {
|
|
38957
38958
|
if (++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
38958
38959
|
if (index % 2 === 0) {
|
|
38959
|
-
if (pattern[index] === 0) result.push({ points: [point, point], closed: false });
|
|
38960
|
+
if (pattern[index] === 0) result.push({ points: [point, point], closed: false, zeroLengthDash: true });
|
|
38960
38961
|
flush();
|
|
38961
38962
|
}
|
|
38962
38963
|
index = (index + 1) % pattern.length;
|
|
@@ -38971,7 +38972,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
38971
38972
|
throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
38972
38973
|
}
|
|
38973
38974
|
let distance = 0;
|
|
38974
|
-
while (distance
|
|
38975
|
+
while (length - distance > 8 * Number.EPSILON * Math.max(1, length)) {
|
|
38975
38976
|
const point = [start[0] + dx * distance / length, start[1] + dy * distance / length];
|
|
38976
38977
|
advance(point);
|
|
38977
38978
|
const step = Math.min(remaining, length - distance);
|
|
@@ -39086,7 +39087,15 @@ function strokeOutlines(paths, width, cap, join, miterLimit, dashArray = [], das
|
|
|
39086
39087
|
let closed = subpath.closed;
|
|
39087
39088
|
if (closed && points.length > 1 && Math.hypot(points[0][0] - points[points.length - 1][0], points[0][1] - points[points.length - 1][1]) <= 1e-14) points.pop();
|
|
39088
39089
|
if (points.length < 3) closed = false;
|
|
39089
|
-
if (points.length === 1 &&
|
|
39090
|
+
if (points.length === 1 && cap === 2 && subpath.zeroLengthDash) {
|
|
39091
|
+
contour = [];
|
|
39092
|
+
const [x, y] = points[0];
|
|
39093
|
+
add(x - half, y - half);
|
|
39094
|
+
add(x + half, y - half);
|
|
39095
|
+
add(x + half, y + half);
|
|
39096
|
+
add(x - half, y + half);
|
|
39097
|
+
contours.push(contour);
|
|
39098
|
+
} else if (points.length === 1 && subpath.points.length > 1 && cap === 1) {
|
|
39090
39099
|
contour = [];
|
|
39091
39100
|
const [x, y] = points[0];
|
|
39092
39101
|
addCap([x, y], [x + 1, y]);
|
|
@@ -39878,7 +39887,7 @@ function prepareStroke(path, scale) {
|
|
|
39878
39887
|
}
|
|
39879
39888
|
return { matrix, width, dashArray, dashPhase };
|
|
39880
39889
|
}
|
|
39881
|
-
function
|
|
39890
|
+
function strokeContours(path, pageHeight, scale) {
|
|
39882
39891
|
const stroke = prepareStroke(path, scale);
|
|
39883
39892
|
if (!stroke) return [];
|
|
39884
39893
|
const inverse = inverseStrokeMatrix(stroke.matrix);
|
|
@@ -39902,7 +39911,7 @@ function strokeEdges(path, pageHeight, scale) {
|
|
|
39902
39911
|
stroke.dashArray?.map((value) => Math.max(0, value * strokeScale)),
|
|
39903
39912
|
stroke.dashPhase * strokeScale
|
|
39904
39913
|
);
|
|
39905
|
-
return
|
|
39914
|
+
return contours.map((points) => points.map(toScreen));
|
|
39906
39915
|
}
|
|
39907
39916
|
function pathsToEdges(paths, closeSubpaths = false) {
|
|
39908
39917
|
const edges = [];
|
|
@@ -40155,7 +40164,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
40155
40164
|
if (path.strokeColor) {
|
|
40156
40165
|
const rawSw = path.strokeWidth * scale * (path.strokeMatrix ? Math.hypot(path.strokeMatrix[0], path.strokeMatrix[1]) : 1);
|
|
40157
40166
|
const strokeAlpha = options.thinLineMode === "shape" && rawSw < 1 ? (path.strokeAlpha ?? 1) * Math.max(0.25, rawSw) : path.strokeAlpha ?? 1;
|
|
40158
|
-
const edges =
|
|
40167
|
+
const edges = pathsToEdges(strokeContours(path, displayList.height, scale).map((points) => ({ points, closed: true })));
|
|
40159
40168
|
const clipScreen = path.clipRect ? [path.clipRect[0] * scale, (displayList.height - path.clipRect[3]) * scale, path.clipRect[2] * scale, (displayList.height - path.clipRect[1]) * scale] : void 0;
|
|
40160
40169
|
fillEdgesScanline4x4(
|
|
40161
40170
|
rgba,
|
|
@@ -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-IOH3F3ZO.js";
|
|
15
|
+
import "../safe-bash/command-chunks/chunk-XFUFHHLU.js";
|
|
16
16
|
import {
|
|
17
17
|
init_buffer
|
|
18
18
|
} from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
|