@poe-platform/safe-bash 0.1.763 → 0.1.764
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 +268 -153
- package/dist/image-ast/index.js +268 -153
- package/dist/pdf-ast/index.js +270 -153
- package/dist/safe-bash/chunks/{chunk-CRQDMBQA.js → chunk-FSH7QRIC.js} +10 -1
- package/dist/safe-bash/command-chunks/{chunk-4XHONGIU.js → chunk-B7YLGJRF.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-S3G2B4OX.js → chunk-G3IIEU2N.js} +271 -153
- package/dist/safe-bash/command-chunks/{chunk-S5EX6UP5.js → chunk-RDPJGIQF.js} +1 -1
- package/dist/safe-bash/commands/python/index.browser.js +1 -1
- package/dist/safe-bash/commands/python/llm-module.js +3 -1
- package/dist/safe-bash/commands/python/shell-module.js +7 -0
- package/dist/safe-bash/core.browser.js +32 -12
- package/dist/safe-bash/shell/runtime.js +43 -11
- package/dist/safe-bash-command-ffmpeg/index.js +5649 -5565
- 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 +268 -153
- package/dist/safe-bash-command-pdfinfo/index.js +268 -153
- package/dist/safe-bash-command-pdftk/index.js +268 -153
- package/dist/safe-bash-command-pdftoppm/index.js +268 -153
- package/dist/safe-bash-command-pdftotext/index.js +268 -153
- package/dist/safe-bash-command-qpdf/index.js +268 -153
- 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 +265 -150
- package/dist/safe-bash-command-wkhtmltopdf/index.js +269 -153
- package/dist/safe-playwright-cloudflare/browser-snapshot-labels.d.ts +14 -0
- package/dist/safe-playwright-cloudflare/browser-snapshot-labels.js +62 -0
- package/dist/safe-playwright-cloudflare/browser-snapshot-scheduler.js +8 -1
- package/package.json +2 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +14 -0
package/dist/pdf-ast/index.js
CHANGED
|
@@ -40232,6 +40232,186 @@ function downscaleImage(image, widthScale, heightScale) {
|
|
|
40232
40232
|
return image;
|
|
40233
40233
|
}
|
|
40234
40234
|
|
|
40235
|
+
// src/render/stroke.ts
|
|
40236
|
+
var MAX_STROKE_VERTICES = 1e6;
|
|
40237
|
+
function dashSubpath(path, pattern, phase) {
|
|
40238
|
+
const cycle = pattern.reduce((sum, value) => sum + value, 0);
|
|
40239
|
+
if (!(cycle > 0)) return [path];
|
|
40240
|
+
let offset = (phase % cycle + cycle) % cycle, index = 0;
|
|
40241
|
+
while (offset > 0) {
|
|
40242
|
+
if (offset < pattern[index]) break;
|
|
40243
|
+
offset -= pattern[index];
|
|
40244
|
+
index = (index + 1) % pattern.length;
|
|
40245
|
+
}
|
|
40246
|
+
let remaining = pattern[index] - offset;
|
|
40247
|
+
const points = path.closed ? [...path.points, path.points[0]] : path.points;
|
|
40248
|
+
const result = [];
|
|
40249
|
+
let current = [];
|
|
40250
|
+
let steps = 0;
|
|
40251
|
+
const flush = () => {
|
|
40252
|
+
if (current.length) result.push({ points: current, closed: false });
|
|
40253
|
+
current = [];
|
|
40254
|
+
};
|
|
40255
|
+
const advance = (point) => {
|
|
40256
|
+
while (remaining <= 0) {
|
|
40257
|
+
if (++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
40258
|
+
if (index % 2 === 0) {
|
|
40259
|
+
if (pattern[index] === 0) result.push({ points: [point, point], closed: false });
|
|
40260
|
+
flush();
|
|
40261
|
+
}
|
|
40262
|
+
index = (index + 1) % pattern.length;
|
|
40263
|
+
remaining = pattern[index];
|
|
40264
|
+
}
|
|
40265
|
+
};
|
|
40266
|
+
for (let i = 1; i < points.length; i++) {
|
|
40267
|
+
const start = points[i - 1], end = points[i];
|
|
40268
|
+
const dx = end[0] - start[0], dy = end[1] - start[1];
|
|
40269
|
+
const length = Math.hypot(dx, dy);
|
|
40270
|
+
if (!Number.isFinite(length) || length / cycle * pattern.length > MAX_STROKE_VERTICES) {
|
|
40271
|
+
throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
40272
|
+
}
|
|
40273
|
+
let distance = 0;
|
|
40274
|
+
while (distance < length) {
|
|
40275
|
+
const point = [start[0] + dx * distance / length, start[1] + dy * distance / length];
|
|
40276
|
+
advance(point);
|
|
40277
|
+
const step = Math.min(remaining, length - distance);
|
|
40278
|
+
if (distance + step === distance || ++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
40279
|
+
distance += step;
|
|
40280
|
+
remaining -= step;
|
|
40281
|
+
if (index % 2 === 0) {
|
|
40282
|
+
if (!current.length) current.push(point);
|
|
40283
|
+
current.push([start[0] + dx * distance / length, start[1] + dy * distance / length]);
|
|
40284
|
+
}
|
|
40285
|
+
}
|
|
40286
|
+
}
|
|
40287
|
+
flush();
|
|
40288
|
+
if (path.closed && result.length) {
|
|
40289
|
+
const first = result[0], last = result[result.length - 1];
|
|
40290
|
+
const start = path.points[0];
|
|
40291
|
+
const firstPoint = first.points[0], lastPoint = last.points[last.points.length - 1];
|
|
40292
|
+
if (firstPoint[0] === start[0] && firstPoint[1] === start[1] && lastPoint[0] === start[0] && lastPoint[1] === start[1]) {
|
|
40293
|
+
if (first === last) result[0] = { points: first.points, closed: true };
|
|
40294
|
+
else {
|
|
40295
|
+
result[0] = { points: [...last.points, ...first.points.slice(1)], closed: false };
|
|
40296
|
+
result.pop();
|
|
40297
|
+
}
|
|
40298
|
+
}
|
|
40299
|
+
}
|
|
40300
|
+
return result;
|
|
40301
|
+
}
|
|
40302
|
+
function strokeOutlines(paths, width, cap, join, miterLimit, dashArray = [], dashPhase = 0) {
|
|
40303
|
+
const half = width / 2;
|
|
40304
|
+
const contours = [];
|
|
40305
|
+
const pattern = dashArray.length % 2 ? [...dashArray, ...dashArray] : dashArray;
|
|
40306
|
+
let count = 0;
|
|
40307
|
+
let contour = [];
|
|
40308
|
+
const add = (x, y) => {
|
|
40309
|
+
if (++count > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke outline exceeds the vertex limit");
|
|
40310
|
+
contour.push([x, y]);
|
|
40311
|
+
};
|
|
40312
|
+
const arc = (point, dx1, dy1, dx2, dy2) => {
|
|
40313
|
+
let a1 = Math.atan2(dy1, dx1), a2 = Math.atan2(dy2, dx2);
|
|
40314
|
+
const ccw = a1 - a2 > 0 && a1 - a2 < Math.PI;
|
|
40315
|
+
const step = Math.acos(half / (half + 0.125)) * 2;
|
|
40316
|
+
add(point[0] + dx1, point[1] + dy1);
|
|
40317
|
+
if (step > 0) {
|
|
40318
|
+
if (!ccw) {
|
|
40319
|
+
if (a1 > a2) a2 += 2 * Math.PI;
|
|
40320
|
+
a2 -= step / 4;
|
|
40321
|
+
if ((a2 - a1) / step > MAX_STROKE_VERTICES - count) throw new PdfError("E_LIMIT", "Stroke arc exceeds the vertex limit");
|
|
40322
|
+
for (a1 += step; a1 < a2; a1 += step) add(point[0] + half * Math.cos(a1), point[1] + half * Math.sin(a1));
|
|
40323
|
+
} else {
|
|
40324
|
+
if (a1 < a2) a2 -= 2 * Math.PI;
|
|
40325
|
+
a2 += step / 4;
|
|
40326
|
+
if ((a1 - a2) / step > MAX_STROKE_VERTICES - count) throw new PdfError("E_LIMIT", "Stroke arc exceeds the vertex limit");
|
|
40327
|
+
for (a1 -= step; a1 > a2; a1 -= step) add(point[0] + half * Math.cos(a1), point[1] + half * Math.sin(a1));
|
|
40328
|
+
}
|
|
40329
|
+
}
|
|
40330
|
+
add(point[0] + dx2, point[1] + dy2);
|
|
40331
|
+
};
|
|
40332
|
+
const addCap = (point, next) => {
|
|
40333
|
+
const length = Math.hypot(next[0] - point[0], next[1] - point[1]);
|
|
40334
|
+
const dx = half * (next[1] - point[1]) / length;
|
|
40335
|
+
const dy = half * (next[0] - point[0]) / length;
|
|
40336
|
+
if (cap !== 1) {
|
|
40337
|
+
const sx = cap === 2 ? dy : 0, sy = cap === 2 ? dx : 0;
|
|
40338
|
+
add(point[0] - dx - sx, point[1] + dy - sy);
|
|
40339
|
+
add(point[0] + dx - sx, point[1] - dy - sy);
|
|
40340
|
+
} else {
|
|
40341
|
+
const angle = Math.atan2(dy, -dx);
|
|
40342
|
+
const step = Math.max(1e-3, Math.acos(half / (half + 0.125)) * 2);
|
|
40343
|
+
add(point[0] - dx, point[1] + dy);
|
|
40344
|
+
for (let a = angle + step; a < angle + Math.PI - step / 4; a += step) add(point[0] + half * Math.cos(a), point[1] + half * Math.sin(a));
|
|
40345
|
+
add(point[0] + dx, point[1] - dy);
|
|
40346
|
+
}
|
|
40347
|
+
};
|
|
40348
|
+
const addJoin = (prev, point, next) => {
|
|
40349
|
+
const len1 = Math.hypot(point[0] - prev[0], point[1] - prev[1]);
|
|
40350
|
+
const len2 = Math.hypot(next[0] - point[0], next[1] - point[1]);
|
|
40351
|
+
const dx1 = half * (point[1] - prev[1]) / len1, dy1 = half * (point[0] - prev[0]) / len1;
|
|
40352
|
+
const dx2 = half * (next[1] - point[1]) / len2, dy2 = half * (next[0] - point[0]) / len2;
|
|
40353
|
+
const inner = (next[0] - point[0]) * (point[1] - prev[1]) - (next[1] - point[1]) * (point[0] - prev[0]) > 0;
|
|
40354
|
+
if (!inner && join === 1) {
|
|
40355
|
+
arc(point, dx1, -dy1, dx2, -dy2);
|
|
40356
|
+
return;
|
|
40357
|
+
}
|
|
40358
|
+
if (inner || join === 0) {
|
|
40359
|
+
const ax = prev[0] + dx1, ay = prev[1] - dy1;
|
|
40360
|
+
const bx = point[0] + dx1, by = point[1] - dy1;
|
|
40361
|
+
const cx = point[0] + dx2, cy = point[1] - dy2;
|
|
40362
|
+
const dx = next[0] + dx2, dy = next[1] - dy2;
|
|
40363
|
+
const den = (bx - ax) * (dy - cy) - (by - ay) * (dx - cx);
|
|
40364
|
+
if (Math.abs(den) >= 1e-30) {
|
|
40365
|
+
const t = ((ay - cy) * (dx - cx) - (ax - cx) * (dy - cy)) / den;
|
|
40366
|
+
const x = ax + (bx - ax) * t, y = ay + (by - ay) * t;
|
|
40367
|
+
if (Math.hypot(x - point[0], y - point[1]) <= half * (inner ? 1.01 : miterLimit)) {
|
|
40368
|
+
add(x, y);
|
|
40369
|
+
return;
|
|
40370
|
+
}
|
|
40371
|
+
} else if ((bx - prev[0]) * dy1 - (prev[1] - by) * dx1 < 0 !== (bx - next[0]) * dy1 - (next[1] - by) * dx1 < 0) {
|
|
40372
|
+
add(bx, by);
|
|
40373
|
+
return;
|
|
40374
|
+
}
|
|
40375
|
+
}
|
|
40376
|
+
add(point[0] + dx1, point[1] - dy1);
|
|
40377
|
+
add(point[0] + dx2, point[1] - dy2);
|
|
40378
|
+
};
|
|
40379
|
+
for (const path of paths) {
|
|
40380
|
+
for (const subpath of pattern.length ? dashSubpath(path, pattern, dashPhase) : [path]) {
|
|
40381
|
+
const points = [];
|
|
40382
|
+
for (const point of subpath.points) {
|
|
40383
|
+
const prev = points[points.length - 1];
|
|
40384
|
+
if (!prev || Math.hypot(prev[0] - point[0], prev[1] - point[1]) > 1e-14) points.push(point);
|
|
40385
|
+
}
|
|
40386
|
+
let closed = subpath.closed;
|
|
40387
|
+
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();
|
|
40388
|
+
if (points.length < 3) closed = false;
|
|
40389
|
+
if (points.length === 1 && subpath.points.length > 1 && cap === 1) {
|
|
40390
|
+
contour = [];
|
|
40391
|
+
const [x, y] = points[0];
|
|
40392
|
+
addCap([x, y], [x + 1, y]);
|
|
40393
|
+
addCap([x, y], [x - 1, y]);
|
|
40394
|
+
contours.push(contour);
|
|
40395
|
+
} else if (points.length >= 2) {
|
|
40396
|
+
contour = [];
|
|
40397
|
+
if (!closed) addCap(points[0], points[1]);
|
|
40398
|
+
for (let i = closed ? 0 : 1; i < points.length - (closed ? 0 : 1); i++) {
|
|
40399
|
+
addJoin(points[(i + points.length - 1) % points.length], points[i], points[(i + 1) % points.length]);
|
|
40400
|
+
}
|
|
40401
|
+
if (closed) {
|
|
40402
|
+
contours.push(contour);
|
|
40403
|
+
contour = [];
|
|
40404
|
+
} else addCap(points[points.length - 1], points[points.length - 2]);
|
|
40405
|
+
for (let i = points.length - (closed ? 1 : 2); i >= (closed ? 0 : 1); i--) {
|
|
40406
|
+
addJoin(points[(i + 1) % points.length], points[i], points[(i + points.length - 1) % points.length]);
|
|
40407
|
+
}
|
|
40408
|
+
contours.push(contour);
|
|
40409
|
+
}
|
|
40410
|
+
}
|
|
40411
|
+
}
|
|
40412
|
+
return contours;
|
|
40413
|
+
}
|
|
40414
|
+
|
|
40235
40415
|
// src/render/raster.ts
|
|
40236
40416
|
function encodePng(bitmap) {
|
|
40237
40417
|
return encodeRgbaToPng(bitmap.width, bitmap.height, bitmap.data);
|
|
@@ -41323,111 +41503,60 @@ function blendPixel(rgba, width, height, px, py, color, alpha, blendMode, clipMa
|
|
|
41323
41503
|
rgba[idx + 2] = Math.round((effB * a + cbB * dstA * (1 - a)) / outA * 255);
|
|
41324
41504
|
rgba[idx + 3] = Math.round(outA * 255);
|
|
41325
41505
|
}
|
|
41326
|
-
function
|
|
41327
|
-
const
|
|
41328
|
-
|
|
41329
|
-
|
|
41330
|
-
const lenSq = dx * dx + dy * dy;
|
|
41331
|
-
const segLen = Math.sqrt(lenSq);
|
|
41332
|
-
const pad = lineCap === 2 ? halfW + 2 : halfW + 1;
|
|
41333
|
-
const minX = Math.max(0, Math.floor(Math.min(x0, x1) - pad));
|
|
41334
|
-
const maxX = Math.min(width - 1, Math.ceil(Math.max(x0, x1) + pad));
|
|
41335
|
-
const minY = Math.max(0, Math.floor(Math.min(y0, y1) - pad));
|
|
41336
|
-
const maxY = Math.min(height - 1, Math.ceil(Math.max(y0, y1) + pad));
|
|
41337
|
-
for (let py = minY; py <= maxY; py++) {
|
|
41338
|
-
for (let px = minX; px <= maxX; px++) {
|
|
41339
|
-
const cx = px + 0.5;
|
|
41340
|
-
const cy = py + 0.5;
|
|
41341
|
-
if (segLen > 1e-6 && (lineCap === 0 || lineCap === 2)) {
|
|
41342
|
-
const ux = dx / segLen;
|
|
41343
|
-
const uy = dy / segLen;
|
|
41344
|
-
const along = (cx - x0) * ux + (cy - y0) * uy;
|
|
41345
|
-
const perp = Math.abs(-(cx - x0) * uy + (cy - y0) * ux);
|
|
41346
|
-
const minAlong = lineCap === 2 ? -halfW : 0;
|
|
41347
|
-
const maxAlong = lineCap === 2 ? segLen + halfW : segLen;
|
|
41348
|
-
const overAlong = along < minAlong ? minAlong - along : along > maxAlong ? along - maxAlong : 0;
|
|
41349
|
-
const dist2 = overAlong > 0 ? Math.max(perp, halfW + overAlong) : perp;
|
|
41350
|
-
if (dist2 <= halfW + 0.75) {
|
|
41351
|
-
const cov = antialias ? Math.max(0, Math.min(1, halfW + 0.5 - dist2)) : dist2 <= halfW + 0.25 ? 1 : 0;
|
|
41352
|
-
blendPixel(rgba, width, height, px, py, color, cov * alpha, blendMode, clipMask);
|
|
41353
|
-
}
|
|
41354
|
-
continue;
|
|
41355
|
-
}
|
|
41356
|
-
let t = lenSq > 1e-6 ? ((cx - x0) * dx + (cy - y0) * dy) / lenSq : 0;
|
|
41357
|
-
t = Math.max(0, Math.min(1, t));
|
|
41358
|
-
const projX = x0 + t * dx;
|
|
41359
|
-
const projY = y0 + t * dy;
|
|
41360
|
-
const dist = Math.hypot(cx - projX, cy - projY);
|
|
41361
|
-
if (dist <= halfW + 0.75) {
|
|
41362
|
-
const cov = antialias ? Math.max(0, Math.min(1, halfW + 0.5 - dist)) : dist <= halfW + 0.25 ? 1 : 0;
|
|
41363
|
-
blendPixel(rgba, width, height, px, py, color, cov * alpha, blendMode, clipMask);
|
|
41364
|
-
}
|
|
41365
|
-
}
|
|
41366
|
-
}
|
|
41367
|
-
}
|
|
41368
|
-
function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = false) {
|
|
41369
|
-
const edges = [];
|
|
41370
|
-
let curX = 0;
|
|
41371
|
-
let curY = 0;
|
|
41372
|
-
let startX = 0;
|
|
41373
|
-
let startY = 0;
|
|
41374
|
-
let hasOpenSubpath = false;
|
|
41506
|
+
function segmentsToScreenPaths(segments, pageHeight, scale) {
|
|
41507
|
+
const paths = [];
|
|
41508
|
+
let points = [];
|
|
41509
|
+
let current = [0, 0];
|
|
41375
41510
|
const toScreen = (x, y) => [x * scale, (pageHeight - y) * scale];
|
|
41376
|
-
for (const
|
|
41377
|
-
if (
|
|
41378
|
-
if (
|
|
41379
|
-
|
|
41380
|
-
|
|
41381
|
-
|
|
41382
|
-
|
|
41383
|
-
|
|
41384
|
-
|
|
41385
|
-
} else if (
|
|
41386
|
-
|
|
41387
|
-
|
|
41388
|
-
|
|
41389
|
-
|
|
41390
|
-
|
|
41391
|
-
|
|
41392
|
-
|
|
41393
|
-
|
|
41394
|
-
|
|
41395
|
-
|
|
41396
|
-
|
|
41397
|
-
|
|
41398
|
-
|
|
41399
|
-
|
|
41400
|
-
|
|
41401
|
-
|
|
41402
|
-
|
|
41403
|
-
|
|
41404
|
-
|
|
41405
|
-
|
|
41406
|
-
|
|
41407
|
-
|
|
41408
|
-
|
|
41409
|
-
|
|
41410
|
-
|
|
41411
|
-
|
|
41412
|
-
|
|
41413
|
-
|
|
41414
|
-
|
|
41415
|
-
|
|
41416
|
-
|
|
41417
|
-
|
|
41418
|
-
const [
|
|
41419
|
-
|
|
41420
|
-
|
|
41421
|
-
|
|
41422
|
-
|
|
41423
|
-
|
|
41424
|
-
{ x0: rx0, y0: ry1, x1: rx0, y1: ry0 }
|
|
41425
|
-
);
|
|
41426
|
-
hasOpenSubpath = false;
|
|
41511
|
+
for (const segment of segments) {
|
|
41512
|
+
if (segment.kind === "move") {
|
|
41513
|
+
if (points.length) paths.push({ points, closed: false });
|
|
41514
|
+
current = toScreen(segment.x, segment.y);
|
|
41515
|
+
points = [current];
|
|
41516
|
+
} else if (segment.kind === "line") {
|
|
41517
|
+
if (!points.length) points = [current];
|
|
41518
|
+
current = toScreen(segment.x, segment.y);
|
|
41519
|
+
points.push(current);
|
|
41520
|
+
} else if (segment.kind === "cubic") {
|
|
41521
|
+
if (!points.length) points = [current];
|
|
41522
|
+
const a = toScreen(segment.x1, segment.y1), b = toScreen(segment.x2, segment.y2);
|
|
41523
|
+
const end = toScreen(segment.x, segment.y);
|
|
41524
|
+
const curve = flattenCubic(current[0], current[1], a[0], a[1], b[0], b[1], end[0], end[1]);
|
|
41525
|
+
for (let i = 1; i < curve.length; i++) points.push(curve[i]);
|
|
41526
|
+
current = end;
|
|
41527
|
+
} else if (segment.kind === "close") {
|
|
41528
|
+
if (points.length) {
|
|
41529
|
+
paths.push({ points, closed: true });
|
|
41530
|
+
current = points[0];
|
|
41531
|
+
points = [];
|
|
41532
|
+
}
|
|
41533
|
+
} else if (segment.kind === "rect") {
|
|
41534
|
+
if (points.length) paths.push({ points, closed: false });
|
|
41535
|
+
const first = toScreen(segment.x, segment.y);
|
|
41536
|
+
paths.push({ points: [
|
|
41537
|
+
first,
|
|
41538
|
+
toScreen(segment.x + segment.width, segment.y),
|
|
41539
|
+
toScreen(segment.x + segment.width, segment.y + segment.height),
|
|
41540
|
+
toScreen(segment.x, segment.y + segment.height)
|
|
41541
|
+
], closed: true });
|
|
41542
|
+
current = first;
|
|
41543
|
+
points = [];
|
|
41544
|
+
}
|
|
41545
|
+
}
|
|
41546
|
+
if (points.length) paths.push({ points, closed: false });
|
|
41547
|
+
return paths;
|
|
41548
|
+
}
|
|
41549
|
+
function pathsToEdges(paths, closeSubpaths = false) {
|
|
41550
|
+
const edges = [];
|
|
41551
|
+
for (const { points, closed } of paths) {
|
|
41552
|
+
for (let i = 1; i < points.length; i++) {
|
|
41553
|
+
const a = points[i - 1], b = points[i];
|
|
41554
|
+
edges.push({ x0: a[0], y0: a[1], x1: b[0], y1: b[1] });
|
|
41555
|
+
}
|
|
41556
|
+
if ((closed || closeSubpaths) && points.length > 1) {
|
|
41557
|
+
const a = points[points.length - 1], b = points[0];
|
|
41558
|
+
edges.push({ x0: a[0], y0: a[1], x1: b[0], y1: b[1] });
|
|
41427
41559
|
}
|
|
41428
|
-
}
|
|
41429
|
-
if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
|
|
41430
|
-
edges.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
41431
41560
|
}
|
|
41432
41561
|
return edges;
|
|
41433
41562
|
}
|
|
@@ -41614,7 +41743,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
41614
41743
|
for (const clip of clips) {
|
|
41615
41744
|
const { segments, fillRule } = "segments" in clip ? clip : { segments: clip, fillRule: "nonzero" };
|
|
41616
41745
|
const layer = new Uint8Array(width * height * 4);
|
|
41617
|
-
fillEdgesScanline4x4(layer, width, height,
|
|
41746
|
+
fillEdgesScanline4x4(layer, width, height, pathsToEdges(segmentsToScreenPaths(segments, displayList.height, scale), true), { r: 1, g: 1, b: 1 }, 1, fillRule);
|
|
41618
41747
|
for (let i = 3; i < layer.length; i += 4) clipMask[i] = Math.round(clipMask[i] * layer[i] / 255);
|
|
41619
41748
|
}
|
|
41620
41749
|
cachedClips = clips;
|
|
@@ -41661,62 +41790,38 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
41661
41790
|
if (operation.kind === "path") {
|
|
41662
41791
|
const path = operation.value;
|
|
41663
41792
|
if (path.fillColor) {
|
|
41664
|
-
const edges =
|
|
41793
|
+
const edges = pathsToEdges(segmentsToScreenPaths(path.segments, displayList.height, scale), true);
|
|
41665
41794
|
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;
|
|
41666
41795
|
fillEdgesScanline4x4(rgba, width, height, edges, path.fillColor, path.fillAlpha ?? 1, path.fillRule ?? "nonzero", clipScreen, original.kind === "glyph" ? aaTxt : aaVec, path.blendMode, clipMask);
|
|
41667
41796
|
}
|
|
41668
41797
|
if (path.strokeColor) {
|
|
41669
|
-
const edges = segmentsToScreenEdges(path.segments, displayList.height, scale, false);
|
|
41670
41798
|
const rawSw = path.strokeWidth * scale;
|
|
41671
41799
|
const sw = Math.max(1, rawSw);
|
|
41672
41800
|
const strokeAlpha = options.thinLineMode === "shape" && rawSw < 1 ? (path.strokeAlpha ?? 1) * Math.max(0.25, rawSw) : path.strokeAlpha ?? 1;
|
|
41673
|
-
const
|
|
41674
|
-
|
|
41675
|
-
|
|
41676
|
-
|
|
41677
|
-
|
|
41678
|
-
|
|
41679
|
-
|
|
41680
|
-
|
|
41681
|
-
|
|
41682
|
-
|
|
41683
|
-
|
|
41684
|
-
|
|
41685
|
-
|
|
41686
|
-
|
|
41687
|
-
|
|
41688
|
-
|
|
41689
|
-
|
|
41690
|
-
|
|
41691
|
-
|
|
41692
|
-
|
|
41693
|
-
|
|
41694
|
-
|
|
41695
|
-
|
|
41696
|
-
|
|
41697
|
-
const t1 = (pos + step) / edgeLen;
|
|
41698
|
-
drawAntiAliasedSegment(
|
|
41699
|
-
rgba,
|
|
41700
|
-
width,
|
|
41701
|
-
height,
|
|
41702
|
-
e.x0 + dx * t0,
|
|
41703
|
-
e.y0 + dy * t0,
|
|
41704
|
-
e.x0 + dx * t1,
|
|
41705
|
-
e.y0 + dy * t1,
|
|
41706
|
-
sw,
|
|
41707
|
-
path.strokeColor,
|
|
41708
|
-
strokeAlpha,
|
|
41709
|
-
path.lineCap ?? 0,
|
|
41710
|
-
original.kind === "glyph" ? aaTxt : aaVec,
|
|
41711
|
-
path.blendMode,
|
|
41712
|
-
clipMask
|
|
41713
|
-
);
|
|
41714
|
-
}
|
|
41715
|
-
pos += step;
|
|
41716
|
-
dashDist = (dashDist + step) % dashCycle;
|
|
41717
|
-
}
|
|
41718
|
-
}
|
|
41719
|
-
}
|
|
41801
|
+
const contours = strokeOutlines(
|
|
41802
|
+
segmentsToScreenPaths(path.segments, displayList.height, scale),
|
|
41803
|
+
sw,
|
|
41804
|
+
path.lineCap ?? 0,
|
|
41805
|
+
path.lineJoin ?? 0,
|
|
41806
|
+
path.miterLimit ?? 10,
|
|
41807
|
+
path.dashArray?.map((value) => Math.max(0, value * scale)),
|
|
41808
|
+
(path.dashPhase ?? 0) * scale
|
|
41809
|
+
);
|
|
41810
|
+
const edges = pathsToEdges(contours.map((points) => ({ points, closed: true })));
|
|
41811
|
+
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;
|
|
41812
|
+
fillEdgesScanline4x4(
|
|
41813
|
+
rgba,
|
|
41814
|
+
width,
|
|
41815
|
+
height,
|
|
41816
|
+
edges,
|
|
41817
|
+
path.strokeColor,
|
|
41818
|
+
strokeAlpha,
|
|
41819
|
+
"nonzero",
|
|
41820
|
+
clipScreen,
|
|
41821
|
+
original.kind === "glyph" ? aaTxt : aaVec,
|
|
41822
|
+
path.blendMode,
|
|
41823
|
+
clipMask
|
|
41824
|
+
);
|
|
41720
41825
|
}
|
|
41721
41826
|
} else if (operation.kind === "image") {
|
|
41722
41827
|
const img = operation.value;
|
|
@@ -42928,3 +43033,15 @@ export {
|
|
|
42928
43033
|
* Copyright 2012 Mozilla Foundation. Licensed under Apache-2.0.
|
|
42929
43034
|
* See THIRD_PARTY_NOTICES.md for the source revision and adaptations.
|
|
42930
43035
|
*/
|
|
43036
|
+
/*!
|
|
43037
|
+
* Anti-Grain Geometry - Version 2.3
|
|
43038
|
+
* Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
|
43039
|
+
*
|
|
43040
|
+
* Permission to copy, use, modify, sell and distribute this software
|
|
43041
|
+
* is granted provided this copyright notice appears in all copies.
|
|
43042
|
+
* This software is provided "as is" without express or implied
|
|
43043
|
+
* warranty, and with no claim as to its suitability for any purpose.
|
|
43044
|
+
*
|
|
43045
|
+
* Adapted from PDFium agg_math_stroke.h and agg_vcgen_stroke.cpp.
|
|
43046
|
+
* See THIRD_PARTY_NOTICES.md for the source revision and adaptations.
|
|
43047
|
+
*/
|
|
@@ -2049,6 +2049,7 @@ import asyncio
|
|
|
2049
2049
|
import copy
|
|
2050
2050
|
import inspect
|
|
2051
2051
|
import math
|
|
2052
|
+
import os
|
|
2052
2053
|
from dataclasses import dataclass, field, replace
|
|
2053
2054
|
from typing import Any, AsyncIterator, Callable, Mapping, Optional, Protocol, Sequence, Union
|
|
2054
2055
|
|
|
@@ -2091,7 +2092,8 @@ class Attachment:
|
|
|
2091
2092
|
def payload(self):
|
|
2092
2093
|
if not isinstance(self.path, str) or not self.path or "\0" in self.path:
|
|
2093
2094
|
raise ValueError("Attachment requires an agent filesystem path")
|
|
2094
|
-
|
|
2095
|
+
path = self.path if os.path.isabs(self.path) else os.path.join(os.getcwd(), self.path)
|
|
2096
|
+
result = {"path": path}
|
|
2095
2097
|
if self.mime_type is not None:
|
|
2096
2098
|
result["mimeType"] = self.mime_type
|
|
2097
2099
|
return result
|
|
@@ -2479,6 +2481,7 @@ from __future__ import annotations
|
|
|
2479
2481
|
import asyncio
|
|
2480
2482
|
import math
|
|
2481
2483
|
import inspect
|
|
2484
|
+
import os
|
|
2482
2485
|
import subprocess
|
|
2483
2486
|
from dataclasses import dataclass
|
|
2484
2487
|
|
|
@@ -2534,6 +2537,12 @@ def _payload(args, *, shell=False, input=None, cwd=None, env=None, timeout=None,
|
|
|
2534
2537
|
elif not isinstance(input, (bytes, bytearray, memoryview)):
|
|
2535
2538
|
raise TypeError('Binary input must be bytes')
|
|
2536
2539
|
result['input'] = list(input)
|
|
2540
|
+
# The host retains the original shell context; snapshot the current guest state.
|
|
2541
|
+
if cwd is None:
|
|
2542
|
+
cwd = os.getcwd()
|
|
2543
|
+
elif cwd and not os.path.isabs(cwd):
|
|
2544
|
+
cwd = os.path.join(os.getcwd(), cwd)
|
|
2545
|
+
env = dict(os.environ if env is None else env)
|
|
2537
2546
|
result.update(cwd=cwd, env=env, timeout=timeout, max_output_bytes=max_output_bytes)
|
|
2538
2547
|
return result
|
|
2539
2548
|
|
|
@@ -48,11 +48,11 @@ import {
|
|
|
48
48
|
trimImage,
|
|
49
49
|
unflattenImage,
|
|
50
50
|
unpremultiplyRgbaImage
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-RDPJGIQF.js";
|
|
52
52
|
import {
|
|
53
53
|
PdfDocument,
|
|
54
54
|
encodePng
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-G3IIEU2N.js";
|
|
56
56
|
import {
|
|
57
57
|
createLuaFilterCapability
|
|
58
58
|
} from "./chunk-Y2KHC6TZ.js";
|