@poe-platform/safe-bash 0.1.762 → 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.
Files changed (35) hide show
  1. package/dist/image-ast/index.browser.js +454 -208
  2. package/dist/image-ast/index.js +454 -208
  3. package/dist/pdf-ast/ast.d.ts +23 -0
  4. package/dist/pdf-ast/index.js +543 -244
  5. package/dist/safe-bash/chunks/{chunk-CRQDMBQA.js → chunk-FSH7QRIC.js} +10 -1
  6. package/dist/safe-bash/command-chunks/{chunk-D4GXXV65.js → chunk-B7YLGJRF.js} +2 -2
  7. package/dist/safe-bash/command-chunks/{chunk-P3Q2QSCA.js → chunk-G3IIEU2N.js} +457 -208
  8. package/dist/safe-bash/command-chunks/{chunk-F7MJRXQ2.js → chunk-RDPJGIQF.js} +1 -1
  9. package/dist/safe-bash/commands/python/index.browser.js +1 -1
  10. package/dist/safe-bash/commands/python/llm-module.js +3 -1
  11. package/dist/safe-bash/commands/python/shell-module.js +7 -0
  12. package/dist/safe-bash/core.browser.js +33 -13
  13. package/dist/safe-bash/shell/runtime.js +44 -12
  14. package/dist/safe-bash-checksum-engine/index.d.ts +1 -1
  15. package/dist/safe-bash-checksum-engine/index.js +5 -1
  16. package/dist/safe-bash-command-ffmpeg/index.js +7476 -7338
  17. package/dist/safe-bash-command-gh/index.js +174 -105
  18. package/dist/safe-bash-command-imagemagick/index.js +2 -2
  19. package/dist/safe-bash-command-pandoc/command.js +3 -3
  20. package/dist/safe-bash-command-pandoc/index.js +3 -3
  21. package/dist/safe-bash-command-pdfimages/index.js +454 -208
  22. package/dist/safe-bash-command-pdfinfo/index.js +541 -244
  23. package/dist/safe-bash-command-pdftk/index.js +454 -208
  24. package/dist/safe-bash-command-pdftoppm/index.js +541 -244
  25. package/dist/safe-bash-command-pdftotext/index.js +454 -208
  26. package/dist/safe-bash-command-qpdf/index.js +454 -208
  27. package/dist/safe-bash-command-sips/index.js +2 -2
  28. package/dist/safe-bash-command-soffice/index.js +1 -1
  29. package/dist/safe-bash-command-ssconvert/index.js +514 -208
  30. package/dist/safe-bash-command-wkhtmltopdf/index.js +455 -208
  31. package/dist/safe-playwright-cloudflare/browser-snapshot-labels.d.ts +14 -0
  32. package/dist/safe-playwright-cloudflare/browser-snapshot-labels.js +62 -0
  33. package/dist/safe-playwright-cloudflare/browser-snapshot-scheduler.js +8 -1
  34. package/package.json +2 -2
  35. package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +27 -0
@@ -35568,14 +35568,18 @@ function evaluateContentStreamToDisplayList(params) {
35568
35568
  const paths = [];
35569
35569
  const images = [];
35570
35570
  const operations = [];
35571
+ let capturedOperations;
35572
+ let insideSoftMask = false;
35571
35573
  const emit = (operation) => {
35572
- const { clipPaths, clipImages } = curState();
35573
- if (clipPaths || clipImages) operation = { ...operation, value: {
35574
+ const { clipPaths, clipImages, softMask } = curState();
35575
+ if (clipPaths || clipImages || softMask) operation = { ...operation, value: {
35574
35576
  ...operation.value,
35575
35577
  ...clipPaths ? { clipPaths } : {},
35576
- ...clipImages ? { clipImages } : {}
35578
+ ...clipImages ? { clipImages } : {},
35579
+ ...softMask ? { softMask } : {}
35577
35580
  } };
35578
- operations.push(operation);
35581
+ (capturedOperations ?? operations).push(operation);
35582
+ if (insideSoftMask) return;
35579
35583
  switch (operation.kind) {
35580
35584
  case "path":
35581
35585
  paths.push(operation.value);
@@ -35681,7 +35685,7 @@ function evaluateContentStreamToDisplayList(params) {
35681
35685
  );
35682
35686
  return { r: kClamp(r), g: kClamp(g), b: kClamp(b) };
35683
35687
  };
35684
- const applyStateOperator = (st, operator, ops, activeResources) => {
35688
+ const applyStateOperator = (st, operator, ops, activeResources, activeFonts, depth) => {
35685
35689
  const num = (i, fb = 0) => ops[i]?.kind === "number" ? ops[i].value : fb;
35686
35690
  if (operator === "cm") {
35687
35691
  const m = [num(0, 1), num(1, 0), num(2, 0), num(3, 1), num(4, 0), num(5, 0)];
@@ -35764,6 +35768,46 @@ function evaluateContentStreamToDisplayList(params) {
35764
35768
  const extDict = params.cosDoc.resolveDict(dictGet(activeResources, "ExtGState"));
35765
35769
  const gsDict = extDict ? params.cosDoc.resolveDict(dictGet(extDict, ops[0].decoded)) : void 0;
35766
35770
  if (gsDict) {
35771
+ const mask = params.cosDoc.resolve(dictGet(gsDict, "SMask"));
35772
+ if (mask?.kind === "name" && mask.decoded === "None") {
35773
+ st.softMask = void 0;
35774
+ } else if (mask?.kind === "dict") {
35775
+ const subtype = params.cosDoc.resolve(dictGet(mask, "S"));
35776
+ const form = params.cosDoc.resolve(dictGet(mask, "G"));
35777
+ if (form?.kind === "stream" && subtype?.kind === "name" && (subtype.decoded === "Alpha" || subtype.decoded === "Luminosity")) {
35778
+ if (depth >= 8) throw new PdfError("E_LIMIT", "Soft-mask nesting exceeds the form depth limit");
35779
+ const parentOperations = capturedOperations;
35780
+ const parentInsideSoftMask = insideSoftMask;
35781
+ const savedTextState = { pendingTextClip, hasTextClip, activeTm, activeTlm };
35782
+ const captured = [];
35783
+ capturedOperations = captured;
35784
+ insideSoftMask = true;
35785
+ const maskState = { ...st, softMask: void 0, fillAlpha: 1, strokeAlpha: 1, blendMode: "Normal" };
35786
+ delete maskState.clipPaths;
35787
+ delete maskState.clipImages;
35788
+ delete maskState.clipRect;
35789
+ stateStack.push(maskState);
35790
+ try {
35791
+ paintForm(form, activeResources, activeFonts, depth, void 0, void 0, true);
35792
+ } finally {
35793
+ stateStack.pop();
35794
+ capturedOperations = parentOperations;
35795
+ insideSoftMask = parentInsideSoftMask;
35796
+ ({ pendingTextClip, hasTextClip, activeTm, activeTlm } = savedTextState);
35797
+ }
35798
+ const group = params.cosDoc.resolveDict(dictGet(form.dict, "Group"));
35799
+ const colorSpace = group ? dictGet(group, "CS") : void 0;
35800
+ const bc = params.cosDoc.resolveArray(dictGet(mask, "BC"));
35801
+ const components = bc?.items.map((item) => {
35802
+ const value = params.cosDoc.resolve(item);
35803
+ return value?.kind === "number" ? value.value : 0;
35804
+ });
35805
+ const [r, g, b] = components ? convertColorSpaceComponentsToRgb(params.cosDoc, colorSpace, "DeviceRGB", components, activeResources) : [0, 0, 0];
35806
+ const transfer = params.cosDoc.resolve(dictGet(mask, "TR"));
35807
+ 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;
35808
+ st.softMask = { subtype: subtype.decoded, operations: captured, backdrop: { r, g, b }, transferMap };
35809
+ }
35810
+ }
35767
35811
  const bmNode = params.cosDoc.resolve(dictGet(gsDict, "BM"));
35768
35812
  if (bmNode?.kind === "name") {
35769
35813
  st.blendMode = bmNode.decoded === "Compatible" ? "Normal" : bmNode.decoded;
@@ -35850,6 +35894,84 @@ function evaluateContentStreamToDisplayList(params) {
35850
35894
  ] }], void 0, void 0, resources, activeFonts, depth);
35851
35895
  stateStack.pop();
35852
35896
  };
35897
+ const paintForm = (form, activeResources, activeFonts, depth, mcid, actualText, maskGroup = false) => {
35898
+ const st = curState();
35899
+ const group = params.cosDoc.resolveDict(dictGet(form.dict, "Group"));
35900
+ const groupType = group ? params.cosDoc.resolve(dictGet(group, "S")) : void 0;
35901
+ const isolated = group ? params.cosDoc.resolve(dictGet(group, "I")) : void 0;
35902
+ const isolate = !maskGroup && groupType?.kind === "name" && groupType.decoded === "Transparency" && isolated?.kind === "boolean" && isolated.value;
35903
+ const formStreamBytes = params.cosDoc.decodeStream(form);
35904
+ const formNodes = parseContentStream(formStreamBytes);
35905
+ const formResDict = params.cosDoc.resolveDict(dictGet(form.dict, "Resources")) ?? activeResources;
35906
+ const formFonts = new Map(activeFonts);
35907
+ for (const [k, v] of resolvePageFonts(params.cosDoc, formResDict).entries()) {
35908
+ formFonts.set(k, v);
35909
+ }
35910
+ let nextCtm = [...st.ctm];
35911
+ const matArr = params.cosDoc.resolveArray(dictGet(form.dict, "Matrix"));
35912
+ if (matArr && matArr.items.length >= 6) {
35913
+ const mn = (idx, fb = 0) => {
35914
+ const resolved = params.cosDoc.resolve(matArr.items[idx]);
35915
+ return resolved?.kind === "number" ? resolved.value : fb;
35916
+ };
35917
+ const formMat = [mn(0, 1), mn(1, 0), mn(2, 0), mn(3, 1), mn(4, 0), mn(5, 0)];
35918
+ nextCtm = multiplyMatrices(formMat, nextCtm);
35919
+ }
35920
+ let nextClip = !isolate && st.clipRect ? [...st.clipRect] : void 0;
35921
+ let nextClipPaths = isolate ? void 0 : st.clipPaths;
35922
+ const bboxArr = params.cosDoc.resolveArray(dictGet(form.dict, "BBox"));
35923
+ if (bboxArr && bboxArr.items.length >= 4) {
35924
+ const bn = (idx, fb = 0) => {
35925
+ const resolved = params.cosDoc.resolve(bboxArr.items[idx]);
35926
+ return resolved?.kind === "number" ? resolved.value : fb;
35927
+ };
35928
+ const bx0 = bn(0, 0), by0 = bn(1, 0), bx1 = bn(2, 0), by1 = bn(3, 0);
35929
+ const pts = [
35930
+ transformPoint(nextCtm, bx0, by0),
35931
+ transformPoint(nextCtm, bx1, by0),
35932
+ transformPoint(nextCtm, bx1, by1),
35933
+ transformPoint(nextCtm, bx0, by1)
35934
+ ];
35935
+ nextClipPaths = [...nextClipPaths ?? [], [
35936
+ ...pts.map(([x, y], index) => ({ kind: index === 0 ? "move" : "line", x, y })),
35937
+ { kind: "close" }
35938
+ ]];
35939
+ const fMinX = Math.min(...pts.map((p) => p[0]));
35940
+ const fMinY = Math.min(...pts.map((p) => p[1]));
35941
+ const fMaxX = Math.max(...pts.map((p) => p[0]));
35942
+ const fMaxY = Math.max(...pts.map((p) => p[1]));
35943
+ if (fMaxX > fMinX && fMaxY > fMinY) {
35944
+ nextClip = nextClip ? [
35945
+ Math.max(nextClip[0], fMinX),
35946
+ Math.max(nextClip[1], fMinY),
35947
+ Math.min(nextClip[2], fMaxX),
35948
+ Math.min(nextClip[3], fMaxY)
35949
+ ] : [fMinX, fMinY, fMaxX, fMaxY];
35950
+ }
35951
+ }
35952
+ const parentOperations = capturedOperations;
35953
+ const children = [];
35954
+ const nextState = { ...st, ctm: nextCtm };
35955
+ if (isolate) {
35956
+ capturedOperations = children;
35957
+ nextState.fillAlpha = nextState.strokeAlpha = 1;
35958
+ nextState.blendMode = "Normal";
35959
+ nextState.softMask = void 0;
35960
+ delete nextState.clipImages;
35961
+ delete nextState.clipPaths;
35962
+ delete nextState.clipRect;
35963
+ }
35964
+ if (nextClip) nextState.clipRect = nextClip;
35965
+ if (nextClipPaths) nextState.clipPaths = nextClipPaths;
35966
+ stateStack.push(nextState);
35967
+ try {
35968
+ walkNodes(formNodes, mcid, actualText, formResDict, formFonts, depth + 1);
35969
+ } finally {
35970
+ stateStack.pop();
35971
+ capturedOperations = parentOperations;
35972
+ }
35973
+ if (isolate) emit({ kind: "group", value: { operations: children, alpha: st.fillAlpha, blendMode: st.blendMode, clipRect: st.clipRect } });
35974
+ };
35853
35975
  const walkNodes = (nodes, mcid, actualText, activeResources = params.resourcesDict, activeFonts = fonts, depth = 0) => {
35854
35976
  for (const node of nodes) {
35855
35977
  switch (node.kind) {
@@ -35894,7 +36016,7 @@ function evaluateContentStreamToDisplayList(params) {
35894
36016
  break;
35895
36017
  }
35896
36018
  case "state-op": {
35897
- applyStateOperator(curState(), node.operator, node.operands, activeResources);
36019
+ applyStateOperator(curState(), node.operator, node.operands, activeResources, activeFonts, depth);
35898
36020
  break;
35899
36021
  }
35900
36022
  case "path-op": {
@@ -36180,53 +36302,7 @@ function evaluateContentStreamToDisplayList(params) {
36180
36302
  ...st.clipRect ? { clipRect: [...st.clipRect] } : {}
36181
36303
  }, patternMask, activeResources, activeFonts, depth);
36182
36304
  } else if (sub === "Form" && depth < 8) {
36183
- const formStreamBytes = params.cosDoc.decodeStream(xobjNode);
36184
- const formNodes = parseContentStream(formStreamBytes);
36185
- const formResDict = params.cosDoc.resolveDict(dictGet(xobjNode.dict, "Resources")) ?? activeResources;
36186
- const formFonts = new Map(activeFonts);
36187
- for (const [k, v] of resolvePageFonts(params.cosDoc, formResDict).entries()) {
36188
- formFonts.set(k, v);
36189
- }
36190
- let nextCtm = [...st.ctm];
36191
- const matArr = params.cosDoc.resolveArray(dictGet(xobjNode.dict, "Matrix"));
36192
- if (matArr && matArr.items.length >= 6) {
36193
- const mn = (idx, fb = 0) => {
36194
- const resolved = params.cosDoc.resolve(matArr.items[idx]);
36195
- return resolved?.kind === "number" ? resolved.value : fb;
36196
- };
36197
- const formMat = [mn(0, 1), mn(1, 0), mn(2, 0), mn(3, 1), mn(4, 0), mn(5, 0)];
36198
- nextCtm = multiplyMatrices(formMat, nextCtm);
36199
- }
36200
- let nextClip = st.clipRect ? [...st.clipRect] : void 0;
36201
- const bboxArr = params.cosDoc.resolveArray(dictGet(xobjNode.dict, "BBox"));
36202
- if (bboxArr && bboxArr.items.length >= 4) {
36203
- const bn = (idx, fb = 0) => {
36204
- const resolved = params.cosDoc.resolve(bboxArr.items[idx]);
36205
- return resolved?.kind === "number" ? resolved.value : fb;
36206
- };
36207
- const bx0 = bn(0, 0), by0 = bn(1, 0), bx1 = bn(2, 0), by1 = bn(3, 0);
36208
- const pts = [
36209
- transformPoint(nextCtm, bx0, by0),
36210
- transformPoint(nextCtm, bx1, by0),
36211
- transformPoint(nextCtm, bx0, by1),
36212
- transformPoint(nextCtm, bx1, by1)
36213
- ];
36214
- const fMinX = Math.min(...pts.map((p) => p[0]));
36215
- const fMinY = Math.min(...pts.map((p) => p[1]));
36216
- const fMaxX = Math.max(...pts.map((p) => p[0]));
36217
- const fMaxY = Math.max(...pts.map((p) => p[1]));
36218
- if (fMaxX > fMinX && fMaxY > fMinY) {
36219
- nextClip = nextClip ? [
36220
- Math.max(nextClip[0], fMinX),
36221
- Math.max(nextClip[1], fMinY),
36222
- Math.min(nextClip[2], fMaxX),
36223
- Math.min(nextClip[3], fMaxY)
36224
- ] : [fMinX, fMinY, fMaxX, fMaxY];
36225
- }
36226
- }
36227
- stateStack.push({ ...st, ctm: nextCtm, ...nextClip ? { clipRect: nextClip } : {} });
36228
- walkNodes(formNodes, mcid, actualText, formResDict, formFonts, depth + 1);
36229
- if (stateStack.length > 1) stateStack.pop();
36305
+ paintForm(xobjNode, activeResources, activeFonts, depth, mcid, actualText);
36230
36306
  }
36231
36307
  }
36232
36308
  }
@@ -36445,7 +36521,7 @@ function evaluateContentStreamToDisplayList(params) {
36445
36521
  st.textRenderMode = cmd.mode;
36446
36522
  break;
36447
36523
  case "state-op":
36448
- applyStateOperator(st, cmd.operator, cmd.operands, activeResources);
36524
+ applyStateOperator(st, cmd.operator, cmd.operands, activeResources, activeFonts, depth);
36449
36525
  break;
36450
36526
  case "show-text":
36451
36527
  emitTokenBytes(cmd.token.bytes);
@@ -38859,6 +38935,184 @@ function downscaleImage(image, widthScale, heightScale) {
38859
38935
  }
38860
38936
  return image;
38861
38937
  }
38938
+ var MAX_STROKE_VERTICES = 1e6;
38939
+ function dashSubpath(path, pattern, phase) {
38940
+ const cycle = pattern.reduce((sum, value) => sum + value, 0);
38941
+ if (!(cycle > 0)) return [path];
38942
+ let offset = (phase % cycle + cycle) % cycle, index = 0;
38943
+ while (offset > 0) {
38944
+ if (offset < pattern[index]) break;
38945
+ offset -= pattern[index];
38946
+ index = (index + 1) % pattern.length;
38947
+ }
38948
+ let remaining = pattern[index] - offset;
38949
+ const points = path.closed ? [...path.points, path.points[0]] : path.points;
38950
+ const result = [];
38951
+ let current = [];
38952
+ let steps = 0;
38953
+ const flush = () => {
38954
+ if (current.length) result.push({ points: current, closed: false });
38955
+ current = [];
38956
+ };
38957
+ const advance = (point) => {
38958
+ while (remaining <= 0) {
38959
+ if (++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
38960
+ if (index % 2 === 0) {
38961
+ if (pattern[index] === 0) result.push({ points: [point, point], closed: false });
38962
+ flush();
38963
+ }
38964
+ index = (index + 1) % pattern.length;
38965
+ remaining = pattern[index];
38966
+ }
38967
+ };
38968
+ for (let i = 1; i < points.length; i++) {
38969
+ const start = points[i - 1], end = points[i];
38970
+ const dx = end[0] - start[0], dy = end[1] - start[1];
38971
+ const length = Math.hypot(dx, dy);
38972
+ if (!Number.isFinite(length) || length / cycle * pattern.length > MAX_STROKE_VERTICES) {
38973
+ throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
38974
+ }
38975
+ let distance = 0;
38976
+ while (distance < length) {
38977
+ const point = [start[0] + dx * distance / length, start[1] + dy * distance / length];
38978
+ advance(point);
38979
+ const step = Math.min(remaining, length - distance);
38980
+ if (distance + step === distance || ++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
38981
+ distance += step;
38982
+ remaining -= step;
38983
+ if (index % 2 === 0) {
38984
+ if (!current.length) current.push(point);
38985
+ current.push([start[0] + dx * distance / length, start[1] + dy * distance / length]);
38986
+ }
38987
+ }
38988
+ }
38989
+ flush();
38990
+ if (path.closed && result.length) {
38991
+ const first = result[0], last = result[result.length - 1];
38992
+ const start = path.points[0];
38993
+ const firstPoint = first.points[0], lastPoint = last.points[last.points.length - 1];
38994
+ if (firstPoint[0] === start[0] && firstPoint[1] === start[1] && lastPoint[0] === start[0] && lastPoint[1] === start[1]) {
38995
+ if (first === last) result[0] = { points: first.points, closed: true };
38996
+ else {
38997
+ result[0] = { points: [...last.points, ...first.points.slice(1)], closed: false };
38998
+ result.pop();
38999
+ }
39000
+ }
39001
+ }
39002
+ return result;
39003
+ }
39004
+ function strokeOutlines(paths, width, cap, join, miterLimit, dashArray = [], dashPhase = 0) {
39005
+ const half = width / 2;
39006
+ const contours = [];
39007
+ const pattern = dashArray.length % 2 ? [...dashArray, ...dashArray] : dashArray;
39008
+ let count = 0;
39009
+ let contour = [];
39010
+ const add = (x, y) => {
39011
+ if (++count > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke outline exceeds the vertex limit");
39012
+ contour.push([x, y]);
39013
+ };
39014
+ const arc = (point, dx1, dy1, dx2, dy2) => {
39015
+ let a1 = Math.atan2(dy1, dx1), a2 = Math.atan2(dy2, dx2);
39016
+ const ccw = a1 - a2 > 0 && a1 - a2 < Math.PI;
39017
+ const step = Math.acos(half / (half + 0.125)) * 2;
39018
+ add(point[0] + dx1, point[1] + dy1);
39019
+ if (step > 0) {
39020
+ if (!ccw) {
39021
+ if (a1 > a2) a2 += 2 * Math.PI;
39022
+ a2 -= step / 4;
39023
+ if ((a2 - a1) / step > MAX_STROKE_VERTICES - count) throw new PdfError("E_LIMIT", "Stroke arc exceeds the vertex limit");
39024
+ for (a1 += step; a1 < a2; a1 += step) add(point[0] + half * Math.cos(a1), point[1] + half * Math.sin(a1));
39025
+ } else {
39026
+ if (a1 < a2) a2 -= 2 * Math.PI;
39027
+ a2 += step / 4;
39028
+ if ((a1 - a2) / step > MAX_STROKE_VERTICES - count) throw new PdfError("E_LIMIT", "Stroke arc exceeds the vertex limit");
39029
+ for (a1 -= step; a1 > a2; a1 -= step) add(point[0] + half * Math.cos(a1), point[1] + half * Math.sin(a1));
39030
+ }
39031
+ }
39032
+ add(point[0] + dx2, point[1] + dy2);
39033
+ };
39034
+ const addCap = (point, next) => {
39035
+ const length = Math.hypot(next[0] - point[0], next[1] - point[1]);
39036
+ const dx = half * (next[1] - point[1]) / length;
39037
+ const dy = half * (next[0] - point[0]) / length;
39038
+ if (cap !== 1) {
39039
+ const sx = cap === 2 ? dy : 0, sy = cap === 2 ? dx : 0;
39040
+ add(point[0] - dx - sx, point[1] + dy - sy);
39041
+ add(point[0] + dx - sx, point[1] - dy - sy);
39042
+ } else {
39043
+ const angle = Math.atan2(dy, -dx);
39044
+ const step = Math.max(1e-3, Math.acos(half / (half + 0.125)) * 2);
39045
+ add(point[0] - dx, point[1] + dy);
39046
+ 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));
39047
+ add(point[0] + dx, point[1] - dy);
39048
+ }
39049
+ };
39050
+ const addJoin = (prev, point, next) => {
39051
+ const len1 = Math.hypot(point[0] - prev[0], point[1] - prev[1]);
39052
+ const len2 = Math.hypot(next[0] - point[0], next[1] - point[1]);
39053
+ const dx1 = half * (point[1] - prev[1]) / len1, dy1 = half * (point[0] - prev[0]) / len1;
39054
+ const dx2 = half * (next[1] - point[1]) / len2, dy2 = half * (next[0] - point[0]) / len2;
39055
+ const inner = (next[0] - point[0]) * (point[1] - prev[1]) - (next[1] - point[1]) * (point[0] - prev[0]) > 0;
39056
+ if (!inner && join === 1) {
39057
+ arc(point, dx1, -dy1, dx2, -dy2);
39058
+ return;
39059
+ }
39060
+ if (inner || join === 0) {
39061
+ const ax = prev[0] + dx1, ay = prev[1] - dy1;
39062
+ const bx = point[0] + dx1, by = point[1] - dy1;
39063
+ const cx = point[0] + dx2, cy = point[1] - dy2;
39064
+ const dx = next[0] + dx2, dy = next[1] - dy2;
39065
+ const den = (bx - ax) * (dy - cy) - (by - ay) * (dx - cx);
39066
+ if (Math.abs(den) >= 1e-30) {
39067
+ const t = ((ay - cy) * (dx - cx) - (ax - cx) * (dy - cy)) / den;
39068
+ const x = ax + (bx - ax) * t, y = ay + (by - ay) * t;
39069
+ if (Math.hypot(x - point[0], y - point[1]) <= half * (inner ? 1.01 : miterLimit)) {
39070
+ add(x, y);
39071
+ return;
39072
+ }
39073
+ } else if ((bx - prev[0]) * dy1 - (prev[1] - by) * dx1 < 0 !== (bx - next[0]) * dy1 - (next[1] - by) * dx1 < 0) {
39074
+ add(bx, by);
39075
+ return;
39076
+ }
39077
+ }
39078
+ add(point[0] + dx1, point[1] - dy1);
39079
+ add(point[0] + dx2, point[1] - dy2);
39080
+ };
39081
+ for (const path of paths) {
39082
+ for (const subpath of pattern.length ? dashSubpath(path, pattern, dashPhase) : [path]) {
39083
+ const points = [];
39084
+ for (const point of subpath.points) {
39085
+ const prev = points[points.length - 1];
39086
+ if (!prev || Math.hypot(prev[0] - point[0], prev[1] - point[1]) > 1e-14) points.push(point);
39087
+ }
39088
+ let closed = subpath.closed;
39089
+ 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();
39090
+ if (points.length < 3) closed = false;
39091
+ if (points.length === 1 && subpath.points.length > 1 && cap === 1) {
39092
+ contour = [];
39093
+ const [x, y] = points[0];
39094
+ addCap([x, y], [x + 1, y]);
39095
+ addCap([x, y], [x - 1, y]);
39096
+ contours.push(contour);
39097
+ } else if (points.length >= 2) {
39098
+ contour = [];
39099
+ if (!closed) addCap(points[0], points[1]);
39100
+ for (let i = closed ? 0 : 1; i < points.length - (closed ? 0 : 1); i++) {
39101
+ addJoin(points[(i + points.length - 1) % points.length], points[i], points[(i + 1) % points.length]);
39102
+ }
39103
+ if (closed) {
39104
+ contours.push(contour);
39105
+ contour = [];
39106
+ } else addCap(points[points.length - 1], points[points.length - 2]);
39107
+ for (let i = points.length - (closed ? 1 : 2); i >= (closed ? 0 : 1); i--) {
39108
+ addJoin(points[(i + 1) % points.length], points[i], points[(i + points.length - 1) % points.length]);
39109
+ }
39110
+ contours.push(contour);
39111
+ }
39112
+ }
39113
+ }
39114
+ return contours;
39115
+ }
38862
39116
  function decodePng(pngBytes) {
38863
39117
  if (pngBytes.length < 24 || pngBytes[0] !== 137 || pngBytes[1] !== 80 || pngBytes[2] !== 78 || pngBytes[3] !== 71) {
38864
39118
  throw new Error("Invalid PNG signature");
@@ -39553,111 +39807,60 @@ function blendPixel(rgba, width, height, px, py, color, alpha, blendMode, clipMa
39553
39807
  rgba[idx + 2] = Math.round((effB * a + cbB * dstA * (1 - a)) / outA * 255);
39554
39808
  rgba[idx + 3] = Math.round(outA * 255);
39555
39809
  }
39556
- function drawAntiAliasedSegment(rgba, width, height, x0, y0, x1, y1, strokeWidth, color, alpha = 1, lineCap = 0, antialias = true, blendMode, clipMask) {
39557
- const halfW = Math.max(0.6, strokeWidth * 0.5);
39558
- const dx = x1 - x0;
39559
- const dy = y1 - y0;
39560
- const lenSq = dx * dx + dy * dy;
39561
- const segLen = Math.sqrt(lenSq);
39562
- const pad = lineCap === 2 ? halfW + 2 : halfW + 1;
39563
- const minX = Math.max(0, Math.floor(Math.min(x0, x1) - pad));
39564
- const maxX = Math.min(width - 1, Math.ceil(Math.max(x0, x1) + pad));
39565
- const minY = Math.max(0, Math.floor(Math.min(y0, y1) - pad));
39566
- const maxY = Math.min(height - 1, Math.ceil(Math.max(y0, y1) + pad));
39567
- for (let py = minY; py <= maxY; py++) {
39568
- for (let px = minX; px <= maxX; px++) {
39569
- const cx = px + 0.5;
39570
- const cy = py + 0.5;
39571
- if (segLen > 1e-6 && (lineCap === 0 || lineCap === 2)) {
39572
- const ux = dx / segLen;
39573
- const uy = dy / segLen;
39574
- const along = (cx - x0) * ux + (cy - y0) * uy;
39575
- const perp = Math.abs(-(cx - x0) * uy + (cy - y0) * ux);
39576
- const minAlong = lineCap === 2 ? -halfW : 0;
39577
- const maxAlong = lineCap === 2 ? segLen + halfW : segLen;
39578
- const overAlong = along < minAlong ? minAlong - along : along > maxAlong ? along - maxAlong : 0;
39579
- const dist2 = overAlong > 0 ? Math.max(perp, halfW + overAlong) : perp;
39580
- if (dist2 <= halfW + 0.75) {
39581
- const cov = antialias ? Math.max(0, Math.min(1, halfW + 0.5 - dist2)) : dist2 <= halfW + 0.25 ? 1 : 0;
39582
- blendPixel(rgba, width, height, px, py, color, cov * alpha, blendMode, clipMask);
39583
- }
39584
- continue;
39585
- }
39586
- let t = lenSq > 1e-6 ? ((cx - x0) * dx + (cy - y0) * dy) / lenSq : 0;
39587
- t = Math.max(0, Math.min(1, t));
39588
- const projX = x0 + t * dx;
39589
- const projY = y0 + t * dy;
39590
- const dist = Math.hypot(cx - projX, cy - projY);
39591
- if (dist <= halfW + 0.75) {
39592
- const cov = antialias ? Math.max(0, Math.min(1, halfW + 0.5 - dist)) : dist <= halfW + 0.25 ? 1 : 0;
39593
- blendPixel(rgba, width, height, px, py, color, cov * alpha, blendMode, clipMask);
39594
- }
39595
- }
39596
- }
39597
- }
39598
- function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = false) {
39599
- const edges = [];
39600
- let curX = 0;
39601
- let curY = 0;
39602
- let startX = 0;
39603
- let startY = 0;
39604
- let hasOpenSubpath = false;
39810
+ function segmentsToScreenPaths(segments, pageHeight, scale) {
39811
+ const paths = [];
39812
+ let points = [];
39813
+ let current = [0, 0];
39605
39814
  const toScreen = (x, y) => [x * scale, (pageHeight - y) * scale];
39606
- for (const seg of segments) {
39607
- if (seg.kind === "move") {
39608
- if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
39609
- edges.push({ x0: curX, y0: curY, x1: startX, y1: startY });
39610
- }
39611
- [curX, curY] = toScreen(seg.x, seg.y);
39612
- startX = curX;
39613
- startY = curY;
39614
- hasOpenSubpath = false;
39615
- } else if (seg.kind === "line") {
39616
- const [nx, ny] = toScreen(seg.x, seg.y);
39617
- edges.push({ x0: curX, y0: curY, x1: nx, y1: ny });
39618
- curX = nx;
39619
- curY = ny;
39620
- hasOpenSubpath = true;
39621
- } else if (seg.kind === "cubic") {
39622
- const [p1x, p1y] = toScreen(seg.x1, seg.y1);
39623
- const [p2x, p2y] = toScreen(seg.x2, seg.y2);
39624
- const [p3x, p3y] = toScreen(seg.x, seg.y);
39625
- const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
39626
- let px = curX;
39627
- let py = curY;
39628
- for (let i = 1; i < points.length; i++) {
39629
- const [qx, qy] = points[i];
39630
- edges.push({ x0: px, y0: py, x1: qx, y1: qy });
39631
- px = qx;
39632
- py = qy;
39633
- }
39634
- curX = p3x;
39635
- curY = p3y;
39636
- hasOpenSubpath = true;
39637
- } else if (seg.kind === "close") {
39638
- if (curX !== startX || curY !== startY) {
39639
- edges.push({ x0: curX, y0: curY, x1: startX, y1: startY });
39640
- curX = startX;
39641
- curY = startY;
39642
- }
39643
- hasOpenSubpath = false;
39644
- } else if (seg.kind === "rect") {
39645
- if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
39646
- edges.push({ x0: curX, y0: curY, x1: startX, y1: startY });
39647
- }
39648
- const [rx0, ry0] = toScreen(seg.x, seg.y);
39649
- const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y + seg.height);
39650
- edges.push(
39651
- { x0: rx0, y0: ry0, x1: rx1, y1: ry0 },
39652
- { x0: rx1, y0: ry0, x1: rx1, y1: ry1 },
39653
- { x0: rx1, y0: ry1, x1: rx0, y1: ry1 },
39654
- { x0: rx0, y0: ry1, x1: rx0, y1: ry0 }
39655
- );
39656
- hasOpenSubpath = false;
39815
+ for (const segment of segments) {
39816
+ if (segment.kind === "move") {
39817
+ if (points.length) paths.push({ points, closed: false });
39818
+ current = toScreen(segment.x, segment.y);
39819
+ points = [current];
39820
+ } else if (segment.kind === "line") {
39821
+ if (!points.length) points = [current];
39822
+ current = toScreen(segment.x, segment.y);
39823
+ points.push(current);
39824
+ } else if (segment.kind === "cubic") {
39825
+ if (!points.length) points = [current];
39826
+ const a = toScreen(segment.x1, segment.y1), b = toScreen(segment.x2, segment.y2);
39827
+ const end = toScreen(segment.x, segment.y);
39828
+ const curve = flattenCubic(current[0], current[1], a[0], a[1], b[0], b[1], end[0], end[1]);
39829
+ for (let i = 1; i < curve.length; i++) points.push(curve[i]);
39830
+ current = end;
39831
+ } else if (segment.kind === "close") {
39832
+ if (points.length) {
39833
+ paths.push({ points, closed: true });
39834
+ current = points[0];
39835
+ points = [];
39836
+ }
39837
+ } else if (segment.kind === "rect") {
39838
+ if (points.length) paths.push({ points, closed: false });
39839
+ const first = toScreen(segment.x, segment.y);
39840
+ paths.push({ points: [
39841
+ first,
39842
+ toScreen(segment.x + segment.width, segment.y),
39843
+ toScreen(segment.x + segment.width, segment.y + segment.height),
39844
+ toScreen(segment.x, segment.y + segment.height)
39845
+ ], closed: true });
39846
+ current = first;
39847
+ points = [];
39848
+ }
39849
+ }
39850
+ if (points.length) paths.push({ points, closed: false });
39851
+ return paths;
39852
+ }
39853
+ function pathsToEdges(paths, closeSubpaths = false) {
39854
+ const edges = [];
39855
+ for (const { points, closed } of paths) {
39856
+ for (let i = 1; i < points.length; i++) {
39857
+ const a = points[i - 1], b = points[i];
39858
+ edges.push({ x0: a[0], y0: a[1], x1: b[0], y1: b[1] });
39859
+ }
39860
+ if ((closed || closeSubpaths) && points.length > 1) {
39861
+ const a = points[points.length - 1], b = points[0];
39862
+ edges.push({ x0: a[0], y0: a[1], x1: b[0], y1: b[1] });
39657
39863
  }
39658
- }
39659
- if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
39660
- edges.push({ x0: curX, y0: curY, x1: startX, y1: startY });
39661
39864
  }
39662
39865
  return edges;
39663
39866
  }
@@ -39768,6 +39971,30 @@ function paintOperations(displayList) {
39768
39971
  ...displayList.glyphs.map((value) => ({ kind: "glyph", value }))
39769
39972
  ];
39770
39973
  }
39974
+ function renderSoftMask(mask, displayList, scale) {
39975
+ const bitmap = renderDisplayListToBitmap({
39976
+ ...displayList,
39977
+ rotation: 0,
39978
+ glyphs: [],
39979
+ paths: [],
39980
+ images: [],
39981
+ operations: mask.operations
39982
+ }, { scale, transparent: true });
39983
+ const { data } = bitmap;
39984
+ for (let i = 0; i < data.length; i += 4) {
39985
+ let value = data[i + 3];
39986
+ if (mask.subtype === "Luminosity") {
39987
+ const alpha = value / 255;
39988
+ const r = Math.round(data[i] * alpha + mask.backdrop.r * 255 * (1 - alpha));
39989
+ const g = Math.round(data[i + 1] * alpha + mask.backdrop.g * 255 * (1 - alpha));
39990
+ const b = Math.round(data[i + 2] * alpha + mask.backdrop.b * 255 * (1 - alpha));
39991
+ value = Math.round(pdfLum(r, g, b));
39992
+ }
39993
+ data[i] = data[i + 1] = data[i + 2] = 0;
39994
+ data[i + 3] = mask.transferMap?.[value] ?? value;
39995
+ }
39996
+ return bitmap;
39997
+ }
39771
39998
  function renderDisplayListToBitmap(displayList, options = {}) {
39772
39999
  const baseScale = options.scale ?? (options.dpi ? options.dpi / 72 : 1.5);
39773
40000
  const scaleX = options.dpiX !== void 0 ? options.dpiX / 72 : baseScale;
@@ -39791,10 +40018,28 @@ function renderDisplayListToBitmap(displayList, options = {}) {
39791
40018
  const aaTxt = options.antialiasText !== false;
39792
40019
  let cachedClips;
39793
40020
  let cachedClipMask;
40021
+ let cachedSoftMask;
40022
+ let cachedSoftMaskPixels;
39794
40023
  const imageClipMasks = /* @__PURE__ */ new Map();
39795
40024
  for (const original of paintOperations(displayList)) {
39796
40025
  if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
39797
- const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
40026
+ let operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
40027
+ if (operation.kind === "group") {
40028
+ const group = operation.value;
40029
+ const bitmap = renderDisplayListToBitmap({ ...displayList, rotation: 0, operations: group.operations }, { ...options, scale, dpiX: void 0, dpiY: void 0, cropRect: void 0, transparent: true });
40030
+ for (let i = 3; i < bitmap.data.length; i += 4) bitmap.data[i] = Math.round(bitmap.data[i] * group.alpha);
40031
+ operation = { kind: "image", value: {
40032
+ name: "TransparencyGroup",
40033
+ width: bitmap.width,
40034
+ height: bitmap.height,
40035
+ decodedRgba: bitmap.data,
40036
+ matrix: [bitmap.width / scale, 0, 0, bitmap.height / scale, 0, displayList.height - bitmap.height / scale],
40037
+ colorSpace: "DeviceRGB",
40038
+ bitsPerComponent: 8,
40039
+ blendMode: group.blendMode,
40040
+ clipRect: group.clipRect
40041
+ } };
40042
+ }
39798
40043
  const clips = original.value.clipPaths;
39799
40044
  let clipMask = clips && clips === cachedClips ? cachedClipMask : void 0;
39800
40045
  if (clips && !clipMask) {
@@ -39802,12 +40047,25 @@ function renderDisplayListToBitmap(displayList, options = {}) {
39802
40047
  for (const clip of clips) {
39803
40048
  const { segments, fillRule } = "segments" in clip ? clip : { segments: clip, fillRule: "nonzero" };
39804
40049
  const layer = new Uint8Array(width * height * 4);
39805
- fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 }, 1, fillRule);
40050
+ fillEdgesScanline4x4(layer, width, height, pathsToEdges(segmentsToScreenPaths(segments, displayList.height, scale), true), { r: 1, g: 1, b: 1 }, 1, fillRule);
39806
40051
  for (let i = 3; i < layer.length; i += 4) clipMask[i] = Math.round(clipMask[i] * layer[i] / 255);
39807
40052
  }
39808
40053
  cachedClips = clips;
39809
40054
  cachedClipMask = clipMask;
39810
40055
  }
40056
+ const softMask = original.value.softMask;
40057
+ if (softMask) {
40058
+ if (softMask !== cachedSoftMask) {
40059
+ cachedSoftMaskPixels = renderSoftMask(softMask, displayList, scale).data;
40060
+ cachedSoftMask = softMask;
40061
+ }
40062
+ if (clipMask) {
40063
+ clipMask = clipMask.slice();
40064
+ for (let i = 3; i < clipMask.length; i += 4) clipMask[i] = Math.round(clipMask[i] * cachedSoftMaskPixels[i] / 255);
40065
+ } else {
40066
+ clipMask = cachedSoftMaskPixels;
40067
+ }
40068
+ }
39811
40069
  const imageClips = original.value.clipImages;
39812
40070
  if (imageClips) {
39813
40071
  let imageMask = imageClipMasks.get(imageClips);
@@ -39836,62 +40094,38 @@ function renderDisplayListToBitmap(displayList, options = {}) {
39836
40094
  if (operation.kind === "path") {
39837
40095
  const path = operation.value;
39838
40096
  if (path.fillColor) {
39839
- const edges = segmentsToScreenEdges(path.segments, displayList.height, scale, true);
40097
+ const edges = pathsToEdges(segmentsToScreenPaths(path.segments, displayList.height, scale), true);
39840
40098
  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;
39841
40099
  fillEdgesScanline4x4(rgba, width, height, edges, path.fillColor, path.fillAlpha ?? 1, path.fillRule ?? "nonzero", clipScreen, original.kind === "glyph" ? aaTxt : aaVec, path.blendMode, clipMask);
39842
40100
  }
39843
40101
  if (path.strokeColor) {
39844
- const edges = segmentsToScreenEdges(path.segments, displayList.height, scale, false);
39845
40102
  const rawSw = path.strokeWidth * scale;
39846
40103
  const sw = Math.max(1, rawSw);
39847
40104
  const strokeAlpha = options.thinLineMode === "shape" && rawSw < 1 ? (path.strokeAlpha ?? 1) * Math.max(0.25, rawSw) : path.strokeAlpha ?? 1;
39848
- const dashArr = path.dashArray && path.dashArray.length > 0 ? path.dashArray.map((d) => Math.max(0, d * scale)) : void 0;
39849
- const dashCycle = dashArr ? dashArr.reduce((a, b) => a + b, 0) : 0;
39850
- let dashDist = (path.dashPhase ?? 0) * scale % (dashCycle || 1);
39851
- if (dashDist < 0) dashDist += dashCycle;
39852
- for (const e of edges) {
39853
- if (!dashArr || dashCycle <= 1e-4) {
39854
- drawAntiAliasedSegment(rgba, width, height, e.x0, e.y0, e.x1, e.y1, sw, path.strokeColor, strokeAlpha, path.lineCap ?? 0, original.kind === "glyph" ? aaTxt : aaVec, path.blendMode, clipMask);
39855
- } else {
39856
- const dx = e.x1 - e.x0;
39857
- const dy = e.y1 - e.y0;
39858
- const edgeLen = Math.hypot(dx, dy);
39859
- if (edgeLen <= 1e-4) continue;
39860
- let pos = 0;
39861
- while (pos < edgeLen) {
39862
- let cycleRem = dashDist % dashCycle;
39863
- let dIdx = 0;
39864
- while (dIdx < dashArr.length - 1 && cycleRem >= dashArr[dIdx]) {
39865
- cycleRem -= dashArr[dIdx];
39866
- dIdx++;
39867
- }
39868
- const segRemainInDash = Math.max(1e-4, dashArr[dIdx] - cycleRem);
39869
- const step = Math.min(edgeLen - pos, segRemainInDash);
39870
- if (dIdx % 2 === 0) {
39871
- const t0 = pos / edgeLen;
39872
- const t1 = (pos + step) / edgeLen;
39873
- drawAntiAliasedSegment(
39874
- rgba,
39875
- width,
39876
- height,
39877
- e.x0 + dx * t0,
39878
- e.y0 + dy * t0,
39879
- e.x0 + dx * t1,
39880
- e.y0 + dy * t1,
39881
- sw,
39882
- path.strokeColor,
39883
- strokeAlpha,
39884
- path.lineCap ?? 0,
39885
- original.kind === "glyph" ? aaTxt : aaVec,
39886
- path.blendMode,
39887
- clipMask
39888
- );
39889
- }
39890
- pos += step;
39891
- dashDist = (dashDist + step) % dashCycle;
39892
- }
39893
- }
39894
- }
40105
+ const contours = strokeOutlines(
40106
+ segmentsToScreenPaths(path.segments, displayList.height, scale),
40107
+ sw,
40108
+ path.lineCap ?? 0,
40109
+ path.lineJoin ?? 0,
40110
+ path.miterLimit ?? 10,
40111
+ path.dashArray?.map((value) => Math.max(0, value * scale)),
40112
+ (path.dashPhase ?? 0) * scale
40113
+ );
40114
+ const edges = pathsToEdges(contours.map((points) => ({ points, closed: true })));
40115
+ 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;
40116
+ fillEdgesScanline4x4(
40117
+ rgba,
40118
+ width,
40119
+ height,
40120
+ edges,
40121
+ path.strokeColor,
40122
+ strokeAlpha,
40123
+ "nonzero",
40124
+ clipScreen,
40125
+ original.kind === "glyph" ? aaTxt : aaVec,
40126
+ path.blendMode,
40127
+ clipMask
40128
+ );
39895
40129
  }
39896
40130
  } else if (operation.kind === "image") {
39897
40131
  const img = operation.value;
@@ -43186,3 +43420,15 @@ export {
43186
43420
  * Copyright 2012 Mozilla Foundation. Licensed under Apache-2.0.
43187
43421
  * See THIRD_PARTY_NOTICES.md for the source revision and adaptations.
43188
43422
  */
43423
+ /*!
43424
+ * Anti-Grain Geometry - Version 2.3
43425
+ * Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
43426
+ *
43427
+ * Permission to copy, use, modify, sell and distribute this software
43428
+ * is granted provided this copyright notice appears in all copies.
43429
+ * This software is provided "as is" without express or implied
43430
+ * warranty, and with no claim as to its suitability for any purpose.
43431
+ *
43432
+ * Adapted from PDFium agg_math_stroke.h and agg_vcgen_stroke.cpp.
43433
+ * See THIRD_PARTY_NOTICES.md for the source revision and adaptations.
43434
+ */