@pixerate/editor 0.74.0 → 0.76.0

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 (62) hide show
  1. package/THIRD_PARTY_NOTICES.md +2 -0
  2. package/dist/agent/index.cjs +28 -28
  3. package/dist/agent/index.js +3 -3
  4. package/dist/animation-editor/index.cjs +322 -273
  5. package/dist/animation-editor/index.cjs.map +1 -1
  6. package/dist/animation-editor/index.d.cts +96 -3
  7. package/dist/animation-editor/index.d.ts +96 -3
  8. package/dist/animation-editor/index.js +138 -89
  9. package/dist/animation-editor/index.js.map +1 -1
  10. package/dist/canvas/index.cjs +26 -26
  11. package/dist/canvas/index.js +2 -2
  12. package/dist/{chunk-3TLL5OID.js → chunk-4JLB2USO.js} +2 -2
  13. package/dist/{chunk-YJLCBA7V.cjs → chunk-7MD7C6XQ.cjs} +87 -87
  14. package/dist/{chunk-YJLCBA7V.cjs.map → chunk-7MD7C6XQ.cjs.map} +1 -1
  15. package/dist/{chunk-OK7T2LHK.js → chunk-GNO5PEMH.js} +2 -2
  16. package/dist/{chunk-EIXXBKUB.js → chunk-IMSX4IVG.js} +7 -7
  17. package/dist/chunk-INZJALPY.js +87 -0
  18. package/dist/chunk-INZJALPY.js.map +1 -0
  19. package/dist/{chunk-MLREO6J3.cjs → chunk-JEYDXRWQ.cjs} +46 -46
  20. package/dist/{chunk-MLREO6J3.cjs.map → chunk-JEYDXRWQ.cjs.map} +1 -1
  21. package/dist/{chunk-PL3MPFPA.cjs → chunk-MXF4DP2C.cjs} +77 -77
  22. package/dist/{chunk-PL3MPFPA.cjs.map → chunk-MXF4DP2C.cjs.map} +1 -1
  23. package/dist/{chunk-T4XWVPJK.cjs → chunk-RKJDBXTY.cjs} +3 -3
  24. package/dist/{chunk-T4XWVPJK.cjs.map → chunk-RKJDBXTY.cjs.map} +1 -1
  25. package/dist/{chunk-HNDSPZ5T.cjs → chunk-ROXFP2LQ.cjs} +4 -4
  26. package/dist/{chunk-HNDSPZ5T.cjs.map → chunk-ROXFP2LQ.cjs.map} +1 -1
  27. package/dist/{chunk-WON34HKM.js → chunk-SVW2UNUC.js} +2 -2
  28. package/dist/{chunk-66IMF6OD.cjs → chunk-TYOAJDFD.cjs} +3 -3
  29. package/dist/{chunk-66IMF6OD.cjs.map → chunk-TYOAJDFD.cjs.map} +1 -1
  30. package/dist/chunk-WAJQKWQU.cjs +87 -0
  31. package/dist/chunk-WAJQKWQU.cjs.map +1 -0
  32. package/dist/{chunk-O2UH7LZE.cjs → chunk-XGD3FSNC.cjs} +239 -239
  33. package/dist/chunk-XGD3FSNC.cjs.map +1 -0
  34. package/dist/{chunk-VWZB6BCY.js → chunk-Y3NW4VJE.js} +2 -2
  35. package/dist/{chunk-GTMJ4Y3S.js → chunk-YCSFS3GK.js} +244 -244
  36. package/dist/{chunk-GTMJ4Y3S.js.map → chunk-YCSFS3GK.js.map} +1 -1
  37. package/dist/{chunk-UKI64KUD.js → chunk-ZQNDSUZO.js} +6 -6
  38. package/dist/extensions/index.cjs +7 -7
  39. package/dist/extensions/index.cjs.map +1 -1
  40. package/dist/extensions/index.js +6 -6
  41. package/dist/index.cjs +35 -35
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.js +17 -17
  44. package/dist/serializers/index.cjs +4 -4
  45. package/dist/serializers/index.cjs.map +1 -1
  46. package/dist/serializers/index.js +3 -3
  47. package/dist/vector/index.cjs +532 -532
  48. package/dist/vector/index.js +3 -3
  49. package/dist/video-editor/index.cjs +2219 -0
  50. package/dist/video-editor/index.cjs.map +1 -0
  51. package/dist/video-editor/index.d.cts +985 -0
  52. package/dist/video-editor/index.d.ts +985 -0
  53. package/dist/video-editor/index.js +2219 -0
  54. package/dist/video-editor/index.js.map +1 -0
  55. package/package.json +6 -1
  56. package/dist/chunk-O2UH7LZE.cjs.map +0 -1
  57. /package/dist/{chunk-3TLL5OID.js.map → chunk-4JLB2USO.js.map} +0 -0
  58. /package/dist/{chunk-OK7T2LHK.js.map → chunk-GNO5PEMH.js.map} +0 -0
  59. /package/dist/{chunk-EIXXBKUB.js.map → chunk-IMSX4IVG.js.map} +0 -0
  60. /package/dist/{chunk-WON34HKM.js.map → chunk-SVW2UNUC.js.map} +0 -0
  61. /package/dist/{chunk-VWZB6BCY.js.map → chunk-Y3NW4VJE.js.map} +0 -0
  62. /package/dist/{chunk-UKI64KUD.js.map → chunk-ZQNDSUZO.js.map} +0 -0
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-633QC34G.js";
16
16
  import {
17
17
  plainTextToSlice
18
- } from "./chunk-UKI64KUD.js";
18
+ } from "./chunk-ZQNDSUZO.js";
19
19
  import {
20
20
  TRACK_CHANGES_SKIP_META,
21
21
  isTrackChangesEnabled
@@ -2286,4 +2286,4 @@ export {
2286
2286
  replaceWithTextTransaction,
2287
2287
  typeAgentText
2288
2288
  };
2289
- //# sourceMappingURL=chunk-OK7T2LHK.js.map
2289
+ //# sourceMappingURL=chunk-GNO5PEMH.js.map
@@ -1,3 +1,6 @@
1
+ import {
2
+ compareDocuments
3
+ } from "./chunk-QJSOZFCZ.js";
1
4
  import {
2
5
  DEFAULT_STYLES,
3
6
  NORMAL_STYLE_ID,
@@ -31,13 +34,10 @@ import {
31
34
  searchDocument,
32
35
  sliceContainsTable,
33
36
  syncInitialContent
34
- } from "./chunk-OK7T2LHK.js";
37
+ } from "./chunk-GNO5PEMH.js";
35
38
  import {
36
39
  chartDataToTable
37
40
  } from "./chunk-633QC34G.js";
38
- import {
39
- compareDocuments
40
- } from "./chunk-QJSOZFCZ.js";
41
41
  import {
42
42
  INSTRUCTION_REGEX,
43
43
  TEMPLATE_REGEX,
@@ -53,13 +53,13 @@ import {
53
53
  rtfToPlainText,
54
54
  sanitizeImportedHtml,
55
55
  serializeRichClipboardPayload
56
- } from "./chunk-WON34HKM.js";
56
+ } from "./chunk-SVW2UNUC.js";
57
57
  import {
58
58
  escapeHtml,
59
59
  htmlToPlainText,
60
60
  markdownToTipTapHtml,
61
61
  plainTextToSlice
62
- } from "./chunk-UKI64KUD.js";
62
+ } from "./chunk-ZQNDSUZO.js";
63
63
  import {
64
64
  CommentStore,
65
65
  TRACK_CHANGES_SKIP_META,
@@ -6755,4 +6755,4 @@ export {
6755
6755
  validateFindPattern,
6756
6756
  createTableCommands
6757
6757
  };
6758
- //# sourceMappingURL=chunk-EIXXBKUB.js.map
6758
+ //# sourceMappingURL=chunk-IMSX4IVG.js.map
@@ -0,0 +1,87 @@
1
+ // src/animation-editor/issues.ts
2
+ var MOTION_ISSUE_CODES = {
3
+ "no-shots": { severity: "note", wording: "The scene has no shots yet." },
4
+ "duplicate-shot-id": { severity: "error", wording: "Two shots share an id." },
5
+ "unknown-target": { severity: "error", wording: "A command names a node the artwork does not have." },
6
+ "unknown-path": { severity: "error", wording: "A follow command names a path the artwork does not have." },
7
+ "not-a-path": { severity: "error", wording: "A follow path must be a path node, not a group." },
8
+ "reveal-no-box": { severity: "warning", wording: "A wipe, iris or split cannot clip a node with no width or height (a lone straight line), so it fades instead." },
9
+ "driver-cycle": { severity: "error", wording: "Drivers follow each other in a loop, so none of them has a value." },
10
+ "split-not-text": { severity: "warning", wording: "A command splits a target into letters, but it is not a group of letter paths, so it animates as a whole." },
11
+ "unknown-clip": { severity: "error", wording: "A play command names a clip the scene does not have." },
12
+ "unknown-shape": { severity: "error", wording: "A morph names a shape the artwork does not have." },
13
+ "match-self": { severity: "error", wording: "A match turns a group into itself or into a group it holds (or that holds it)." },
14
+ "match-unpaired": { severity: "note", wording: `Parts of a match's "into" group have no partner in the target, so they do not appear.` },
15
+ "unknown-effect": { severity: "error", wording: "An effect command names an effect the node does not have." },
16
+ "unknown-effect-param": { severity: "error", wording: "An effect command names a parameter that is not a number of that effect." },
17
+ "unknown-frame": { severity: "error", wording: "A camera frames a node the artwork does not have." },
18
+ "invalid-camera": { severity: "error", wording: "A camera rectangle has no area." },
19
+ "invalid-color": { severity: "error", wording: "A colour cannot be read." },
20
+ "paint-not-color": { severity: "warning", wording: "A style command recolours a gradient or empty paint, which only switches at the end, or a colour pulse has no solid paint to tint." },
21
+ "overlap": { severity: "warning", wording: "Two commands change the same property of a node at the same time; the later one wins." },
22
+ "enter-visible": { severity: "warning", wording: "A node enters while it is already showing, so it blinks out first." },
23
+ "exit-hidden": { severity: "warning", wording: "A node exits or animates while it is hidden." },
24
+ "out-of-frame": { severity: "warning", wording: "A node a command animates ends up outside the camera." },
25
+ "too-fast": { severity: "warning", wording: "A change is too quick to follow." },
26
+ "spring-cut-short": { severity: "warning", wording: "A spring is given a duration shorter than it takes to settle, so it jumps to its end." },
27
+ "unknown-cue": { severity: "error", wording: "A shot is cued to a beat with no beat grid, or to a word the narration does not have." },
28
+ "cue-missed": { severity: "warning", wording: "A shot starts after its cue, because the shot before runs past it." },
29
+ "trigger-loop": { severity: "note", wording: "A scene that plays on a trigger ignores its loop." },
30
+ "click-cue": { severity: "warning", wording: "A shot of a click-triggered scene is cued, but clicks decide when its shots start." },
31
+ "click-one-shot": { severity: "note", wording: "A click-triggered scene has one shot, so every click replays it." },
32
+ "scene-too-long": { severity: "warning", wording: "The scene runs past its target length." },
33
+ "scene-too-short": { severity: "warning", wording: "The scene ends before its target length." },
34
+ "unknown-control-color": { severity: "warning", wording: "A control stands for a colour the scene never uses." },
35
+ "empty-shot": { severity: "note", wording: "A shot neither moves the camera nor runs a command." },
36
+ "camera-aspect": { severity: "note", wording: "A camera rectangle has a different shape from the artwork, so it is letterboxed." }
37
+ };
38
+ function motionIssue(code, message, extra = {}) {
39
+ return { code, severity: MOTION_ISSUE_CODES[code].severity, message, ...extra };
40
+ }
41
+ function motionIssueKey(issue) {
42
+ if (issue.ids?.length) return `${issue.code}:${[...issue.ids].sort().join(",")}`;
43
+ return `${issue.code}@${issue.shot ?? ""}#${issue.command ?? ""}`;
44
+ }
45
+ function motionIssueLine(issue) {
46
+ const where = issue.shot !== void 0 ? `Shot "${issue.shot}"${issue.command !== void 0 ? `, command ${issue.command + 1}` : ""}: ` : "";
47
+ return `${where}${issue.message}`;
48
+ }
49
+ function editDistance(a, b) {
50
+ const d = Array.from({ length: a.length + 1 }, (_, i) => [i, ...Array(b.length).fill(0)]);
51
+ for (let j = 1; j <= b.length; j++) d[0][j] = j;
52
+ for (let i = 1; i <= a.length; i++) {
53
+ for (let j = 1; j <= b.length; j++) {
54
+ const cost = a[i - 1] === b[j - 1] ? 0 : 1;
55
+ d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
56
+ if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
57
+ }
58
+ }
59
+ return d[a.length][b.length];
60
+ }
61
+ function suggestName(word, candidates) {
62
+ const w = word.toLowerCase();
63
+ let best;
64
+ let bestDistance = Infinity;
65
+ for (const c of candidates) {
66
+ const distance = editDistance(w, c.toLowerCase());
67
+ if (distance < bestDistance) {
68
+ best = c;
69
+ bestDistance = distance;
70
+ }
71
+ }
72
+ return best !== void 0 && bestDistance <= Math.max(1, Math.floor(word.length / 3)) ? best : void 0;
73
+ }
74
+ function namedWithSuggestion(word, candidates) {
75
+ const s = suggestName(word, candidates);
76
+ return s !== void 0 && s !== word ? `"${word}" (did you mean "${s}"?)` : `"${word}"`;
77
+ }
78
+
79
+ export {
80
+ MOTION_ISSUE_CODES,
81
+ motionIssue,
82
+ motionIssueKey,
83
+ motionIssueLine,
84
+ suggestName,
85
+ namedWithSuggestion
86
+ };
87
+ //# sourceMappingURL=chunk-INZJALPY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/animation-editor/issues.ts"],"sourcesContent":["/**\n * Problems with a scene, as data: every issue has a stable `code`, a severity, the shot and\n * command it is in and the ids it is about, beside its prose `message`, so an agent (or a UI)\n * can act on it without parsing sentences.\n */\n\n/** `error`: the scene does not play as written. `warning`: it plays, but probably not as meant. `note`: may well be intended. */\nexport type MotionIssueSeverity = 'error' | 'warning' | 'note';\n\n/** Every issue code with its severity and what it means. */\nexport const MOTION_ISSUE_CODES = {\n\t'no-shots': { severity: 'note', wording: 'The scene has no shots yet.' },\n\t'duplicate-shot-id': { severity: 'error', wording: 'Two shots share an id.' },\n\t'unknown-target': { severity: 'error', wording: 'A command names a node the artwork does not have.' },\n\t'unknown-path': { severity: 'error', wording: 'A follow command names a path the artwork does not have.' },\n\t'not-a-path': { severity: 'error', wording: 'A follow path must be a path node, not a group.' },\n\t'reveal-no-box': { severity: 'warning', wording: 'A wipe, iris or split cannot clip a node with no width or height (a lone straight line), so it fades instead.' },\n\t'driver-cycle': { severity: 'error', wording: 'Drivers follow each other in a loop, so none of them has a value.' },\n\t'split-not-text': { severity: 'warning', wording: 'A command splits a target into letters, but it is not a group of letter paths, so it animates as a whole.' },\n\t'unknown-clip': { severity: 'error', wording: 'A play command names a clip the scene does not have.' },\n\t'unknown-shape': { severity: 'error', wording: 'A morph names a shape the artwork does not have.' },\n\t'match-self': { severity: 'error', wording: 'A match turns a group into itself or into a group it holds (or that holds it).' },\n\t'match-unpaired': { severity: 'note', wording: 'Parts of a match\\'s \"into\" group have no partner in the target, so they do not appear.' },\n\t'unknown-effect': { severity: 'error', wording: 'An effect command names an effect the node does not have.' },\n\t'unknown-effect-param': { severity: 'error', wording: 'An effect command names a parameter that is not a number of that effect.' },\n\t'unknown-frame': { severity: 'error', wording: 'A camera frames a node the artwork does not have.' },\n\t'invalid-camera': { severity: 'error', wording: 'A camera rectangle has no area.' },\n\t'invalid-color': { severity: 'error', wording: 'A colour cannot be read.' },\n\t'paint-not-color': { severity: 'warning', wording: 'A style command recolours a gradient or empty paint, which only switches at the end, or a colour pulse has no solid paint to tint.' },\n\t'overlap': { severity: 'warning', wording: 'Two commands change the same property of a node at the same time; the later one wins.' },\n\t'enter-visible': { severity: 'warning', wording: 'A node enters while it is already showing, so it blinks out first.' },\n\t'exit-hidden': { severity: 'warning', wording: 'A node exits or animates while it is hidden.' },\n\t'out-of-frame': { severity: 'warning', wording: 'A node a command animates ends up outside the camera.' },\n\t'too-fast': { severity: 'warning', wording: 'A change is too quick to follow.' },\n\t'spring-cut-short': { severity: 'warning', wording: 'A spring is given a duration shorter than it takes to settle, so it jumps to its end.' },\n\t'unknown-cue': { severity: 'error', wording: 'A shot is cued to a beat with no beat grid, or to a word the narration does not have.' },\n\t'cue-missed': { severity: 'warning', wording: 'A shot starts after its cue, because the shot before runs past it.' },\n\t'trigger-loop': { severity: 'note', wording: 'A scene that plays on a trigger ignores its loop.' },\n\t'click-cue': { severity: 'warning', wording: 'A shot of a click-triggered scene is cued, but clicks decide when its shots start.' },\n\t'click-one-shot': { severity: 'note', wording: 'A click-triggered scene has one shot, so every click replays it.' },\n\t'scene-too-long': { severity: 'warning', wording: 'The scene runs past its target length.' },\n\t'scene-too-short': { severity: 'warning', wording: 'The scene ends before its target length.' },\n\t'unknown-control-color': { severity: 'warning', wording: 'A control stands for a colour the scene never uses.' },\n\t'empty-shot': { severity: 'note', wording: 'A shot neither moves the camera nor runs a command.' },\n\t'camera-aspect': { severity: 'note', wording: 'A camera rectangle has a different shape from the artwork, so it is letterboxed.' }\n} as const satisfies Record<string, { severity: MotionIssueSeverity; wording: string }>;\n\nexport type MotionIssueCode = keyof typeof MOTION_ISSUE_CODES;\n\nexport interface MotionIssue {\n\tcode: MotionIssueCode;\n\tseverity: MotionIssueSeverity;\n\tmessage: string;\n\t/** Id of the shot it is in, when it is in one. */\n\tshot?: string;\n\t/** Index of the command in that shot's `run`. */\n\tcommand?: number;\n\t/** Node ids it is about. */\n\tids?: string[];\n\t/** What was measured, what was needed and in what unit (e.g. 80 vs 120 ms). */\n\tmeasured?: number;\n\tneeded?: number;\n\tunit?: 'ms' | 's' | 'units';\n}\n\nexport function motionIssue(code: MotionIssueCode, message: string, extra: Omit<MotionIssue, 'code' | 'severity' | 'message'> = {}): MotionIssue {\n\treturn { code, severity: MOTION_ISSUE_CODES[code].severity, message, ...extra };\n}\n\n/** A stable key for an issue (code and ids, else code and place), to compare two checks. */\nexport function motionIssueKey(issue: MotionIssue): string {\n\tif (issue.ids?.length) return `${issue.code}:${[...issue.ids].sort().join(',')}`;\n\treturn `${issue.code}@${issue.shot ?? ''}#${issue.command ?? ''}`;\n}\n\n/** One line: `Shot \"intro\", command 2: …`. */\nexport function motionIssueLine(issue: MotionIssue): string {\n\tconst where = issue.shot !== undefined ? `Shot \"${issue.shot}\"${issue.command !== undefined ? `, command ${issue.command + 1}` : ''}: ` : '';\n\treturn `${where}${issue.message}`;\n}\n\n/** Optimal string alignment (Damerau–Levenshtein) distance. */\nfunction editDistance(a: string, b: string): number {\n\tconst d: number[][] = Array.from({ length: a.length + 1 }, (_, i) => [i, ...Array(b.length).fill(0)]);\n\tfor (let j = 1; j <= b.length; j++) d[0][j] = j;\n\tfor (let i = 1; i <= a.length; i++) {\n\t\tfor (let j = 1; j <= b.length; j++) {\n\t\t\tconst cost = a[i - 1] === b[j - 1] ? 0 : 1;\n\t\t\td[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);\n\t\t\tif (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);\n\t\t}\n\t}\n\treturn d[a.length][b.length];\n}\n\n/** The candidate closest to `word` (case-insensitive), if it is within a third of its length. */\nexport function suggestName(word: string, candidates: Iterable<string>): string | undefined {\n\tconst w = word.toLowerCase();\n\tlet best: string | undefined;\n\tlet bestDistance = Infinity;\n\tfor (const c of candidates) {\n\t\tconst distance = editDistance(w, c.toLowerCase());\n\t\tif (distance < bestDistance) {\n\t\t\tbest = c;\n\t\t\tbestDistance = distance;\n\t\t}\n\t}\n\treturn best !== undefined && bestDistance <= Math.max(1, Math.floor(word.length / 3)) ? best : undefined;\n}\n\n/** `\"sunn\" (did you mean \"sun\"?)`, or just `\"sunn\"`. */\nexport function namedWithSuggestion(word: string, candidates: Iterable<string>): string {\n\t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UAAa,gBAAgB,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,SAAS,CAAC,CAAC,IAAI,OAAO;AAChG;AAGO,SAAS,oBAAoB,MAAc,YAAsC;AACvF,QAAM,IAAI,YAAY,MAAM,UAAU;AACtC,SAAO,MAAM,UAAa,MAAM,OAAO,IAAI,IAAI,oBAAoB,CAAC,QAAQ,IAAI,IAAI;AACrF;","names":[]}
@@ -16,7 +16,7 @@
16
16
 
17
17
 
18
18
 
19
- var _chunkO2UH7LZEcjs = require('./chunk-O2UH7LZE.cjs');
19
+ var _chunkXGD3FSNCcjs = require('./chunk-XGD3FSNC.cjs');
20
20
 
21
21
  // src/canvas/pathops/planar.ts
22
22
  var twin = (h) => h ^ 1;
@@ -65,11 +65,11 @@ function pinEnds(pts, a, b) {
65
65
  return out;
66
66
  }
67
67
  function interiorPoint(path) {
68
- const chains = Array.isArray(path) && path.length > 0 && Array.isArray(path[0]) && Array.isArray(_optionalChain([path, 'access', _2 => _2[0], 'access', _3 => _3[0], 'optionalAccess', _4 => _4[0]])) ? path : _chunkO2UH7LZEcjs.pathToContours.call(void 0, path).map((c) => _chunkO2UH7LZEcjs.closeContour.call(void 0, c, true));
68
+ const chains = Array.isArray(path) && path.length > 0 && Array.isArray(path[0]) && Array.isArray(_optionalChain([path, 'access', _2 => _2[0], 'access', _3 => _3[0], 'optionalAccess', _4 => _4[0]])) ? path : _chunkXGD3FSNCcjs.pathToContours.call(void 0, path).map((c) => _chunkXGD3FSNCcjs.closeContour.call(void 0, c, true));
69
69
  const b = boundsOf(chains.flat());
70
70
  if (!(b.maxX > b.minX) || !(b.maxY > b.minY)) return null;
71
71
  const tol = Math.max(b.maxX - b.minX, b.maxY - b.minY) * 1e-3;
72
- const rings = chains.filter((c) => c.length).map((c) => _chunkO2UH7LZEcjs.flattenChain.call(void 0, c, tol));
72
+ const rings = chains.filter((c) => c.length).map((c) => _chunkXGD3FSNCcjs.flattenChain.call(void 0, c, tol));
73
73
  let best = null;
74
74
  for (const f of [0.5, 0.25, 0.75, 0.125, 0.375, 0.625, 0.875, 0.0625, 0.9375]) {
75
75
  const y = b.minY + (b.maxY - b.minY) * (f + 61803e-7);
@@ -86,7 +86,7 @@ function interiorPoint(path) {
86
86
  const width = xs[i + 1] - xs[i];
87
87
  if (!(width > (_nullishCoalesce(_optionalChain([best, 'optionalAccess', _5 => _5.width]), () => ( 0))))) continue;
88
88
  const m = [(xs[i] + xs[i + 1]) / 2, y];
89
- if (_chunkO2UH7LZEcjs.windingNumber.call(void 0, chains, m) !== 0) best = { width, p: m };
89
+ if (_chunkXGD3FSNCcjs.windingNumber.call(void 0, chains, m) !== 0) best = { width, p: m };
90
90
  }
91
91
  }
92
92
  return _nullishCoalesce(_optionalChain([best, 'optionalAccess', _6 => _6.p]), () => ( null));
@@ -99,7 +99,7 @@ var PlanarMap = (_class = class _PlanarMap {
99
99
  this.eps = eps;
100
100
  this.inputCount = inputCount;
101
101
  this.fills = inputs.map((input) => {
102
- const chains = input.fills === false ? [] : _chunkO2UH7LZEcjs.pathToContours.call(void 0, input.path).filter((c) => c.closed).map((c) => _chunkO2UH7LZEcjs.closeContour.call(void 0, c));
102
+ const chains = input.fills === false ? [] : _chunkXGD3FSNCcjs.pathToContours.call(void 0, input.path).filter((c) => c.closed).map((c) => _chunkXGD3FSNCcjs.closeContour.call(void 0, c));
103
103
  return { chains, fillRule: _nullishCoalesce(input.fillRule, () => ( "nonzero")), bounds: boundsOf(chains.flat()) };
104
104
  });
105
105
  const nv = vertices.length;
@@ -110,7 +110,7 @@ var PlanarMap = (_class = class _PlanarMap {
110
110
  if (list.length === 0) return;
111
111
  const at = vertices[v];
112
112
  let r = Infinity;
113
- for (const h of list) r = Math.min(r, _chunkO2UH7LZEcjs.dist.call(void 0, at, vertices[this.origin(twin(h))]));
113
+ for (const h of list) r = Math.min(r, _chunkXGD3FSNCcjs.dist.call(void 0, at, vertices[this.origin(twin(h))]));
114
114
  r *= 0.5;
115
115
  const keyed = list.map((h) => ({ h, angle: this.leavingAngle(h, at, r) }));
116
116
  keyed.sort((a, b) => a.angle - b.angle);
@@ -148,12 +148,12 @@ var PlanarMap = (_class = class _PlanarMap {
148
148
  * not settle) or have no edges.
149
149
  */
150
150
  static build(inputs, options = {}) {
151
- const chains = inputs.map((input) => _chunkO2UH7LZEcjs.pathToContours.call(void 0, input.path).map((c) => _chunkO2UH7LZEcjs.closeContour.call(void 0, c)).filter((c) => c.length));
151
+ const chains = inputs.map((input) => _chunkXGD3FSNCcjs.pathToContours.call(void 0, input.path).map((c) => _chunkXGD3FSNCcjs.closeContour.call(void 0, c)).filter((c) => c.length));
152
152
  const count = chains.reduce((n, cs) => n + cs.reduce((m, c) => m + c.length, 0), 0);
153
153
  if (count === 0 || count > (_nullishCoalesce(options.maxSegments, () => ( 4096)))) return null;
154
154
  let split;
155
155
  try {
156
- split = _chunkO2UH7LZEcjs.planarSplit.call(void 0, chains, options);
156
+ split = _chunkXGD3FSNCcjs.planarSplit.call(void 0, chains, options);
157
157
  } catch (e2) {
158
158
  return null;
159
159
  }
@@ -181,7 +181,7 @@ var PlanarMap = (_class = class _PlanarMap {
181
181
  /** Direction (angle) in which half-edge `h`, leaving `at`, first gets `r` away from it. */
182
182
  leavingAngle(h, at, r) {
183
183
  const pts = this.halfPts(h);
184
- const d = (t2) => _chunkO2UH7LZEcjs.dist.call(void 0, _chunkO2UH7LZEcjs.segmentPoint.call(void 0, pts, t2), at);
184
+ const d = (t2) => _chunkXGD3FSNCcjs.dist.call(void 0, _chunkXGD3FSNCcjs.segmentPoint.call(void 0, pts, t2), at);
185
185
  let lo = 0;
186
186
  let hi = 1;
187
187
  const steps = pts.length === 2 ? 1 : 16;
@@ -197,9 +197,9 @@ var PlanarMap = (_class = class _PlanarMap {
197
197
  if (d(m) >= r) hi = m;
198
198
  else lo = m;
199
199
  }
200
- const p = _chunkO2UH7LZEcjs.segmentPoint.call(void 0, pts, hi);
201
- if (_chunkO2UH7LZEcjs.dist.call(void 0, p, at) > 0) return Math.atan2(p[1] - at[1], p[0] - at[0]);
202
- const t = _chunkO2UH7LZEcjs.segmentTangent.call(void 0, pts, 0);
200
+ const p = _chunkXGD3FSNCcjs.segmentPoint.call(void 0, pts, hi);
201
+ if (_chunkXGD3FSNCcjs.dist.call(void 0, p, at) > 0) return Math.atan2(p[1] - at[1], p[0] - at[0]);
202
+ const t = _chunkXGD3FSNCcjs.segmentTangent.call(void 0, pts, 0);
203
203
  return Math.atan2(t[1], t[0]);
204
204
  }
205
205
  /** Segments of a run of half-edges (a loop unless `closed` is false), pieces of one input segment joined again. */
@@ -230,7 +230,7 @@ var PlanarMap = (_class = class _PlanarMap {
230
230
  const a = this.vertices[this.origin(first.h)];
231
231
  const b = this.vertices[this.origin(twin(last.h))];
232
232
  const seg = this.sources[first.src];
233
- out.push(seg.length === 2 ? [a, b] : pinEnds(_chunkO2UH7LZEcjs.subSegment.call(void 0, seg, first.from, last.to), a, b));
233
+ out.push(seg.length === 2 ? [a, b] : pinEnds(_chunkXGD3FSNCcjs.subSegment.call(void 0, seg, first.from, last.to), a, b));
234
234
  }
235
235
  i = j;
236
236
  }
@@ -255,9 +255,9 @@ var PlanarMap = (_class = class _PlanarMap {
255
255
  const cycle = withoutSpurs(walk);
256
256
  if (!cycle.length) continue;
257
257
  const segments = this.cycleSegments(cycle);
258
- const area = _chunkO2UH7LZEcjs.contourSignedArea.call(void 0, segments);
258
+ const area = _chunkXGD3FSNCcjs.contourSignedArea.call(void 0, segments);
259
259
  let perimeter = 0;
260
- for (const s of segments) perimeter += s.length === 2 ? _chunkO2UH7LZEcjs.dist.call(void 0, s[0], s[1]) : _chunkO2UH7LZEcjs.segmentLength.call(void 0, s, 0, 1, 1e-6);
260
+ for (const s of segments) perimeter += s.length === 2 ? _chunkXGD3FSNCcjs.dist.call(void 0, s[0], s[1]) : _chunkXGD3FSNCcjs.segmentLength.call(void 0, s, 0, 1, 1e-6);
261
261
  if (!(perimeter > 0)) continue;
262
262
  const entry = { halves: cycle, segments, area, bounds: boundsOf(segments) };
263
263
  if (area > 0 && 2 * area / perimeter >= sliver) faces.push(entry);
@@ -272,7 +272,7 @@ var PlanarMap = (_class = class _PlanarMap {
272
272
  faces.forEach((face, i) => {
273
273
  if (this.component[this.origin(face.halves[0])] === own || !inBounds(face.bounds, p)) return;
274
274
  if (best >= 0 && faces[best].area <= face.area) return;
275
- if (_chunkO2UH7LZEcjs.windingNumber.call(void 0, [face.segments], p) !== 0) best = i;
275
+ if (_chunkXGD3FSNCcjs.windingNumber.call(void 0, [face.segments], p) !== 0) best = i;
276
276
  });
277
277
  if (best >= 0) faceHoles[best].push(k);
278
278
  });
@@ -295,7 +295,7 @@ var PlanarMap = (_class = class _PlanarMap {
295
295
  return faces.map((f, i) => {
296
296
  const chains = this.faceChains(i);
297
297
  const area = f.area + faceHoles[i].reduce((sum, k) => sum + holes[k].area, 0);
298
- return { path: _chunkO2UH7LZEcjs.contoursToPath.call(void 0, chains.map((segments) => ({ segments, closed: true }))), area, bounds: f.bounds };
298
+ return { path: _chunkXGD3FSNCcjs.contoursToPath.call(void 0, chains.map((segments) => ({ segments, closed: true }))), area, bounds: f.bounds };
299
299
  });
300
300
  }
301
301
  /** The inputs whose fill covers face `i`, ascending (empty for an area only outlines enclose). */
@@ -308,7 +308,7 @@ var PlanarMap = (_class = class _PlanarMap {
308
308
  if (p) {
309
309
  this.fills.forEach((fill, k) => {
310
310
  if (!fill.chains.length || !inBounds(fill.bounds, p)) return;
311
- const w = _chunkO2UH7LZEcjs.windingNumber.call(void 0, fill.chains, p);
311
+ const w = _chunkXGD3FSNCcjs.windingNumber.call(void 0, fill.chains, p);
312
312
  if (fill.fillRule === "evenodd" ? (w & 1) === 1 : w !== 0) out.push(k);
313
313
  });
314
314
  }
@@ -325,7 +325,7 @@ var PlanarMap = (_class = class _PlanarMap {
325
325
  let best = -1;
326
326
  faces.forEach((face, i) => {
327
327
  if (!inBounds(face.bounds, p) || best >= 0 && faces[best].area <= face.area) return;
328
- if (_chunkO2UH7LZEcjs.windingNumber.call(void 0, this.faceChains(i), p) !== 0) best = i;
328
+ if (_chunkXGD3FSNCcjs.windingNumber.call(void 0, this.faceChains(i), p) !== 0) best = i;
329
329
  });
330
330
  return best;
331
331
  }
@@ -370,7 +370,7 @@ var PlanarMap = (_class = class _PlanarMap {
370
370
  if (!ok || h !== start) continue;
371
371
  contours.push({ segments: this.cycleSegments(cycle), closed: true });
372
372
  }
373
- return _chunkO2UH7LZEcjs.contoursToPath.call(void 0, contours);
373
+ return _chunkXGD3FSNCcjs.contoursToPath.call(void 0, contours);
374
374
  }
375
375
  /**
376
376
  * The edges joined into runs between junctions: vertices where other than two edges meet, or
@@ -429,8 +429,8 @@ var PlanarMap = (_class = class _PlanarMap {
429
429
  const ay = this.vertices[e.a][1];
430
430
  const by = this.vertices[e.b][1];
431
431
  if (ay > p[1] === by > p[1]) return;
432
- const t = _chunkO2UH7LZEcjs.solveMonotone.call(void 0, e.pts, 1, p[1]);
433
- const x = _chunkO2UH7LZEcjs.segmentPoint.call(void 0, e.pts, t)[0];
432
+ const t = _chunkXGD3FSNCcjs.solveMonotone.call(void 0, e.pts, 1, p[1]);
433
+ const x = _chunkXGD3FSNCcjs.segmentPoint.call(void 0, e.pts, t)[0];
434
434
  if (x > p[0]) hits.push({ x, e: i });
435
435
  });
436
436
  hits.sort((a, b) => a.x - b.x);
@@ -450,12 +450,12 @@ var PlanarMap = (_class = class _PlanarMap {
450
450
  const cycle = withoutSpurs(walk);
451
451
  if (!cycle.length) continue;
452
452
  const segments = this.cycleSegments(cycle);
453
- if (!(_chunkO2UH7LZEcjs.contourSignedArea.call(void 0, segments) > 0) || _chunkO2UH7LZEcjs.windingNumber.call(void 0, [segments], p) === 0) continue;
453
+ if (!(_chunkXGD3FSNCcjs.contourSignedArea.call(void 0, segments) > 0) || _chunkXGD3FSNCcjs.windingNumber.call(void 0, [segments], p) === 0) continue;
454
454
  const face = faceOf[cycle[0]];
455
455
  if (face >= 0 && faces[face].halves.includes(cycle[0])) {
456
- return _chunkO2UH7LZEcjs.contoursToPath.call(void 0, this.faceChains(face).map((s) => ({ segments: s, closed: true })));
456
+ return _chunkXGD3FSNCcjs.contoursToPath.call(void 0, this.faceChains(face).map((s) => ({ segments: s, closed: true })));
457
457
  }
458
- return _chunkO2UH7LZEcjs.contoursToPath.call(void 0, [{ segments, closed: true }]);
458
+ return _chunkXGD3FSNCcjs.contoursToPath.call(void 0, [{ segments, closed: true }]);
459
459
  }
460
460
  return null;
461
461
  }
@@ -483,7 +483,7 @@ function closeGaps(vertices, edges, gap) {
483
483
  const pv = vertices[v];
484
484
  if (pv[0] > pu[0] + gap) break;
485
485
  if (v === u || joined.has(v) || linked.has(`${Math.min(u, v)},${Math.max(u, v)}`)) continue;
486
- const d = _chunkO2UH7LZEcjs.dist.call(void 0, pu, pv);
486
+ const d = _chunkXGD3FSNCcjs.dist.call(void 0, pu, pv);
487
487
  if (d <= gap && d < bestD) {
488
488
  best = v;
489
489
  bestD = d;
@@ -498,17 +498,17 @@ function closeGaps(vertices, edges, gap) {
498
498
  }
499
499
  }
500
500
  function contourEnclosesArea(contour) {
501
- const segs = _chunkO2UH7LZEcjs.closeContour.call(void 0, contour, true);
501
+ const segs = _chunkXGD3FSNCcjs.closeContour.call(void 0, contour, true);
502
502
  if (!segs.length) return false;
503
503
  const b = boundsOf(segs);
504
504
  const w = b.maxX - b.minX;
505
505
  const h = b.maxY - b.minY;
506
- return Math.abs(_chunkO2UH7LZEcjs.contourSignedArea.call(void 0, segs)) > 1e-9 * (w * w + h * h);
506
+ return Math.abs(_chunkXGD3FSNCcjs.contourSignedArea.call(void 0, segs)) > 1e-9 * (w * w + h * h);
507
507
  }
508
508
  function nearestU(segs, p) {
509
509
  let best = null;
510
510
  segs.forEach((seg, k) => {
511
- const n = _chunkO2UH7LZEcjs.segmentNearest.call(void 0, seg, p);
511
+ const n = _chunkXGD3FSNCcjs.segmentNearest.call(void 0, seg, p);
512
512
  if (!best || n.distance < best.d) best = { u: k + n.t, d: n.distance };
513
513
  });
514
514
  return best;
@@ -522,7 +522,7 @@ function span(segs, u0, u1) {
522
522
  for (let k = first; k < last; k++) {
523
523
  const t0 = Math.min(1, Math.max(0, u0 - k));
524
524
  const t1 = Math.min(1, Math.max(0, u1 - k));
525
- if (t1 - t0 > 1e-12) out.push(_chunkO2UH7LZEcjs.subSegment.call(void 0, segs[k % n], t0, t1));
525
+ if (t1 - t0 > 1e-12) out.push(_chunkXGD3FSNCcjs.subSegment.call(void 0, segs[k % n], t0, t1));
526
526
  }
527
527
  return out;
528
528
  }
@@ -530,7 +530,7 @@ function snapEnds(segs, to, tol) {
530
530
  if (!segs.length) return segs;
531
531
  const out = segs.map((s) => [...s]);
532
532
  const move = (seg, end, handle) => {
533
- const q = to.find((t) => _chunkO2UH7LZEcjs.dist.call(void 0, t, seg[end]) <= tol);
533
+ const q = to.find((t) => _chunkXGD3FSNCcjs.dist.call(void 0, t, seg[end]) <= tol);
534
534
  if (!q) return;
535
535
  const d = [q[0] - seg[end][0], q[1] - seg[end][1]];
536
536
  seg[end] = q;
@@ -548,31 +548,31 @@ function cutOutPiece(path, piece, fillCloses, tol) {
548
548
  let longest = -1;
549
549
  let perimeter = 0;
550
550
  for (const seg of segs) {
551
- const len2 = _chunkO2UH7LZEcjs.segmentLength.call(void 0, seg);
551
+ const len2 = _chunkXGD3FSNCcjs.segmentLength.call(void 0, seg);
552
552
  perimeter += len2;
553
553
  if (len2 > longest) {
554
554
  longest = len2;
555
- mid = _chunkO2UH7LZEcjs.segmentPoint.call(void 0, seg, 0.5);
555
+ mid = _chunkXGD3FSNCcjs.segmentPoint.call(void 0, seg, 0.5);
556
556
  }
557
557
  }
558
558
  if (!mid || perimeter <= tol) return null;
559
559
  const a = segs[0][0];
560
560
  const lastSeg = segs[segs.length - 1];
561
561
  const b = lastSeg[lastSeg.length - 1];
562
- const whole = !!piece.closed || _chunkO2UH7LZEcjs.dist.call(void 0, a, b) <= tol;
563
- const contours = _chunkO2UH7LZEcjs.pathToContours.call(void 0, path);
562
+ const whole = !!piece.closed || _chunkXGD3FSNCcjs.dist.call(void 0, a, b) <= tol;
563
+ const contours = _chunkXGD3FSNCcjs.pathToContours.call(void 0, path);
564
564
  let found = null;
565
565
  contours.forEach((c, index2) => {
566
566
  if (!c.segments.length) return;
567
567
  const closed2 = c.closed || fillCloses && contourEnclosesArea(c);
568
- const ring2 = _chunkO2UH7LZEcjs.closeContour.call(void 0, c, closed2);
568
+ const ring2 = _chunkXGD3FSNCcjs.closeContour.call(void 0, c, closed2);
569
569
  const n = nearestU(ring2, mid);
570
570
  if (n && n.d <= tol && (!found || n.d < found.d)) found = { index: index2, ring: ring2, closed: closed2, um: n.u, d: n.d };
571
571
  });
572
572
  if (!found) return null;
573
573
  const { index, ring, closed, um } = found;
574
574
  const len = ring.length;
575
- const real = _chunkO2UH7LZEcjs.closeContour.call(void 0, contours[index]).length;
575
+ const real = _chunkXGD3FSNCcjs.closeContour.call(void 0, contours[index]).length;
576
576
  const at = (p) => {
577
577
  const n = nearestU(ring, p);
578
578
  return n && n.d <= tol ? n.u : null;
@@ -603,21 +603,21 @@ function cutOutPiece(path, piece, fillCloses, tol) {
603
603
  if (run.length) out.push({ segments: snapEnds(run, [a, b], tol), closed: false });
604
604
  }
605
605
  out.push(...contours.slice(index + 1));
606
- return _chunkO2UH7LZEcjs.contoursToPath.call(void 0, out);
606
+ return _chunkXGD3FSNCcjs.contoursToPath.call(void 0, out);
607
607
  }
608
608
 
609
609
  // src/canvas/pathops/hatch.ts
610
610
  function hatchPath(path, options = {}) {
611
611
  const out = [];
612
- const b = _chunkO2UH7LZEcjs.bezierPathBounds.call(void 0, path);
612
+ const b = _chunkXGD3FSNCcjs.bezierPathBounds.call(void 0, path);
613
613
  if (!b || b.maxX - b.minX <= 0 || b.maxY - b.minY <= 0) return out;
614
614
  const want = Math.max(_nullishCoalesce(options.gap, () => ( 4)), 1e-3);
615
615
  const s = Math.SQRT1_2;
616
616
  const rot = (p) => [(p[0] + p[1]) * s, (p[1] - p[0]) * s];
617
617
  const unrot = (x, y) => ({ x: (x - y) * s, y: (x + y) * s });
618
618
  const edges = [];
619
- for (const contour of _chunkO2UH7LZEcjs.pathToContours.call(void 0, path)) {
620
- const pts = _chunkO2UH7LZEcjs.flattenChain.call(void 0, _chunkO2UH7LZEcjs.closeContour.call(void 0, contour, true), want * 0.1).map(rot);
619
+ for (const contour of _chunkXGD3FSNCcjs.pathToContours.call(void 0, path)) {
620
+ const pts = _chunkXGD3FSNCcjs.flattenChain.call(void 0, _chunkXGD3FSNCcjs.closeContour.call(void 0, contour, true), want * 0.1).map(rot);
621
621
  for (let i = 0; i < pts.length; i++) {
622
622
  const p = pts[i];
623
623
  const q = pts[(i + 1) % pts.length];
@@ -658,7 +658,7 @@ function pathfinder(op, shapes, options = {}) {
658
658
  options
659
659
  );
660
660
  if (!map) return { pieces: [], engine: "curve", error: "could not map the outlines" };
661
- const pieces = map.chains().map((c) => ({ path: _chunkO2UH7LZEcjs.contoursToPath.call(void 0, [{ segments: c.segments, closed: c.closed }]), source: c.source, open: !c.closed }));
661
+ const pieces = map.chains().map((c) => ({ path: _chunkXGD3FSNCcjs.contoursToPath.call(void 0, [{ segments: c.segments, closed: c.closed }]), source: c.source, open: !c.closed }));
662
662
  return { pieces, engine: "curve" };
663
663
  }
664
664
  if (op === "divide") {
@@ -672,7 +672,7 @@ function pathfinder(op, shapes, options = {}) {
672
672
  });
673
673
  return { pieces, engine: "curve" };
674
674
  }
675
- const result = _chunkO2UH7LZEcjs.dividePaths.call(void 0, operands, options);
675
+ const result = _chunkXGD3FSNCcjs.dividePaths.call(void 0, operands, options);
676
676
  return { ...report(result), pieces: result.pieces.map((p) => ({ path: p.path, source: top(p.operands) })) };
677
677
  }
678
678
  const index = shapes.flatMap((s, i) => s.line ? [] : [i]);
@@ -680,7 +680,7 @@ function pathfinder(op, shapes, options = {}) {
680
680
  if (m === 0) return { pieces: [], engine: "curve" };
681
681
  const ops = index.map((i) => operands[i]);
682
682
  const key = (k) => _nullishCoalesce(shapes[index[k]].key, () => ( index[k]));
683
- const select = (selectors) => _chunkO2UH7LZEcjs.pathBooleanSelect.call(void 0, ops, selectors, options);
683
+ const select = (selectors) => _chunkXGD3FSNCcjs.pathBooleanSelect.call(void 0, ops, selectors, options);
684
684
  const joined = (parts) => parts.flat();
685
685
  switch (op) {
686
686
  case "trim": {
@@ -722,7 +722,7 @@ function report(r) {
722
722
  return { engine: r.engine, ...r.fallbackReason ? { fallbackReason: r.fallbackReason } : {}, ...r.error ? { error: r.error } : {} };
723
723
  }
724
724
  function closeAll(path) {
725
- return _chunkO2UH7LZEcjs.contoursToPath.call(void 0, _chunkO2UH7LZEcjs.pathToContours.call(void 0, path).map((c) => ({ segments: c.segments, closed: true })));
725
+ return _chunkXGD3FSNCcjs.contoursToPath.call(void 0, _chunkXGD3FSNCcjs.pathToContours.call(void 0, path).map((c) => ({ segments: c.segments, closed: true })));
726
726
  }
727
727
 
728
728
 
@@ -734,4 +734,4 @@ function closeAll(path) {
734
734
 
735
735
 
736
736
  exports.interiorPoint = interiorPoint; exports.PlanarMap = PlanarMap; exports.contourEnclosesArea = contourEnclosesArea; exports.cutOutPiece = cutOutPiece; exports.hatchPath = hatchPath; exports.PATHFINDER_OPERATIONS = PATHFINDER_OPERATIONS; exports.pathfinder = pathfinder;
737
- //# sourceMappingURL=chunk-MLREO6J3.cjs.map
737
+ //# sourceMappingURL=chunk-JEYDXRWQ.cjs.map