@softure-ai/marketing-kit 0.5.0 → 0.7.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 (138) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/README.md +130 -17
  3. package/dist/cli/footage.d.ts.map +1 -1
  4. package/dist/cli/footage.js +5 -2
  5. package/dist/cli/footage.js.map +1 -1
  6. package/dist/compose/compose.d.ts.map +1 -1
  7. package/dist/compose/compose.js +3 -3
  8. package/dist/compose/compose.js.map +1 -1
  9. package/dist/compose/timeline.d.ts +16 -0
  10. package/dist/compose/timeline.d.ts.map +1 -1
  11. package/dist/compose/timeline.js +17 -1
  12. package/dist/compose/timeline.js.map +1 -1
  13. package/dist/config/config.d.ts.map +1 -1
  14. package/dist/config/config.js +25 -2
  15. package/dist/config/config.js.map +1 -1
  16. package/dist/config/schema.d.ts +17 -0
  17. package/dist/config/schema.d.ts.map +1 -1
  18. package/dist/config/schema.js +61 -3
  19. package/dist/config/schema.js.map +1 -1
  20. package/dist/footage/audio.d.ts +6 -2
  21. package/dist/footage/audio.d.ts.map +1 -1
  22. package/dist/footage/audio.js +15 -3
  23. package/dist/footage/audio.js.map +1 -1
  24. package/dist/footage/captions.d.ts +26 -3
  25. package/dist/footage/captions.d.ts.map +1 -1
  26. package/dist/footage/captions.js +35 -2
  27. package/dist/footage/captions.js.map +1 -1
  28. package/dist/footage/compose.d.ts +13 -2
  29. package/dist/footage/compose.d.ts.map +1 -1
  30. package/dist/footage/compose.js +79 -28
  31. package/dist/footage/compose.js.map +1 -1
  32. package/dist/footage/cuts.d.ts +44 -0
  33. package/dist/footage/cuts.d.ts.map +1 -0
  34. package/dist/footage/cuts.js +83 -0
  35. package/dist/footage/cuts.js.map +1 -0
  36. package/dist/footage/disk.d.ts +25 -0
  37. package/dist/footage/disk.d.ts.map +1 -0
  38. package/dist/footage/disk.js +72 -0
  39. package/dist/footage/disk.js.map +1 -0
  40. package/dist/footage/draft.d.ts +119 -0
  41. package/dist/footage/draft.d.ts.map +1 -0
  42. package/dist/footage/draft.js +296 -0
  43. package/dist/footage/draft.js.map +1 -0
  44. package/dist/footage/edl.d.ts +2 -1
  45. package/dist/footage/edl.d.ts.map +1 -1
  46. package/dist/footage/edl.js +5 -2
  47. package/dist/footage/edl.js.map +1 -1
  48. package/dist/footage/elevenlabs.d.ts.map +1 -1
  49. package/dist/footage/elevenlabs.js +2 -0
  50. package/dist/footage/elevenlabs.js.map +1 -1
  51. package/dist/footage/film.d.ts +54 -3
  52. package/dist/footage/film.d.ts.map +1 -1
  53. package/dist/footage/film.js +7 -1
  54. package/dist/footage/film.js.map +1 -1
  55. package/dist/footage/keyterms.d.ts +26 -0
  56. package/dist/footage/keyterms.d.ts.map +1 -0
  57. package/dist/footage/keyterms.js +36 -0
  58. package/dist/footage/keyterms.js.map +1 -0
  59. package/dist/footage/loudness.d.ts +20 -3
  60. package/dist/footage/loudness.d.ts.map +1 -1
  61. package/dist/footage/loudness.js +36 -18
  62. package/dist/footage/loudness.js.map +1 -1
  63. package/dist/footage/music.d.ts +3 -0
  64. package/dist/footage/music.d.ts.map +1 -1
  65. package/dist/footage/music.js +5 -0
  66. package/dist/footage/music.js.map +1 -1
  67. package/dist/footage/normalize.d.ts +30 -2
  68. package/dist/footage/normalize.d.ts.map +1 -1
  69. package/dist/footage/normalize.js +39 -11
  70. package/dist/footage/normalize.js.map +1 -1
  71. package/dist/footage/paid.d.ts +2 -1
  72. package/dist/footage/paid.d.ts.map +1 -1
  73. package/dist/footage/paid.js +13 -3
  74. package/dist/footage/paid.js.map +1 -1
  75. package/dist/footage/picture.d.ts +42 -0
  76. package/dist/footage/picture.d.ts.map +1 -0
  77. package/dist/footage/picture.js +141 -0
  78. package/dist/footage/picture.js.map +1 -0
  79. package/dist/footage/pipeline.d.ts +66 -4
  80. package/dist/footage/pipeline.d.ts.map +1 -1
  81. package/dist/footage/pipeline.js +172 -34
  82. package/dist/footage/pipeline.js.map +1 -1
  83. package/dist/footage/process.d.ts +2 -0
  84. package/dist/footage/process.d.ts.map +1 -1
  85. package/dist/footage/process.js +1 -0
  86. package/dist/footage/process.js.map +1 -1
  87. package/dist/footage/providers.d.ts +12 -3
  88. package/dist/footage/providers.d.ts.map +1 -1
  89. package/dist/footage/providers.js.map +1 -1
  90. package/dist/footage/publish.d.ts +4 -2
  91. package/dist/footage/publish.d.ts.map +1 -1
  92. package/dist/footage/publish.js +8 -5
  93. package/dist/footage/publish.js.map +1 -1
  94. package/dist/footage/render.d.ts +18 -3
  95. package/dist/footage/render.d.ts.map +1 -1
  96. package/dist/footage/render.js +67 -16
  97. package/dist/footage/render.js.map +1 -1
  98. package/dist/footage/tools.d.ts +15 -3
  99. package/dist/footage/tools.d.ts.map +1 -1
  100. package/dist/footage/tools.js +15 -2
  101. package/dist/footage/tools.js.map +1 -1
  102. package/dist/index.d.ts +14 -9
  103. package/dist/index.d.ts.map +1 -1
  104. package/dist/index.js +14 -9
  105. package/dist/index.js.map +1 -1
  106. package/docker/footage-worker.Dockerfile +7 -0
  107. package/fonts/DejaVuSans-Bold-Latin.ttf +0 -0
  108. package/fonts/LICENSE-DejaVu.txt +46 -0
  109. package/fonts/README.md +12 -0
  110. package/package.json +2 -1
  111. package/schema/marketing.schema.json +112 -4
  112. package/src/cli/footage.ts +4 -2
  113. package/src/compose/compose.ts +13 -3
  114. package/src/compose/timeline.ts +27 -1
  115. package/src/config/config.ts +26 -2
  116. package/src/config/schema.ts +63 -3
  117. package/src/footage/audio.ts +16 -3
  118. package/src/footage/captions.ts +45 -4
  119. package/src/footage/compose.ts +90 -28
  120. package/src/footage/cuts.ts +104 -0
  121. package/src/footage/disk.ts +75 -0
  122. package/src/footage/draft.ts +395 -0
  123. package/src/footage/edl.ts +5 -2
  124. package/src/footage/elevenlabs.ts +1 -0
  125. package/src/footage/film.ts +63 -5
  126. package/src/footage/keyterms.ts +38 -0
  127. package/src/footage/loudness.ts +38 -16
  128. package/src/footage/music.ts +7 -0
  129. package/src/footage/normalize.ts +51 -10
  130. package/src/footage/paid.ts +12 -3
  131. package/src/footage/picture.ts +179 -0
  132. package/src/footage/pipeline.ts +219 -37
  133. package/src/footage/process.ts +3 -0
  134. package/src/footage/providers.ts +10 -3
  135. package/src/footage/publish.ts +8 -5
  136. package/src/footage/render.ts +77 -16
  137. package/src/footage/tools.ts +23 -3
  138. package/src/index.ts +70 -4
@@ -1,14 +1,14 @@
1
1
  import { escapeHtml, fontFaces, fontStack } from "../compose/html.js";
2
- import { captionChunks } from "../compose/timeline.js";
3
- import { phraseChunks } from "./captions.js";
2
+ import { CAPTION_LINE_HEIGHT, captionChunks, getCaptionPillCss, getCaptionPositionCss } from "../compose/timeline.js";
3
+ import { getCaptionSpans, phraseChunks } from "./captions.js";
4
4
  import { getEdlDuration, getSegmentStarts } from "./edl.js";
5
- import { DEFAULT_EDIT, getFootageEdit } from "./film.js";
5
+ import { CAPTION_MIN_FONT_SCALE, DEFAULT_EDIT, getFootageEdit } from "./film.js";
6
6
  import { FOOTAGE_FPS } from "./normalize.js";
7
7
  const r3 = (value) => Math.round(value * 1000) / 1000 || 0;
8
8
  /**
9
9
  * The HyperFrames composition of a footage film (the same 0.8.85 contract as `composeFilm`): one `<video>` clip per
10
10
  * EDL segment over the normalized clip with its media start, the transitions (`fade` cross-fades from the segment
11
- * before over `fadeFrames`, `zoom` punches in by `zoomPercent` on alternate jump cuts, `whoosh` plays the whoosh
11
+ * before over `fadeFrames`, `zoom` punches in by `zoomPercent` on alternate jump cuts, eased over `zoomEaseFrames`, `whoosh` plays the whoosh
12
12
  * sound), a slow zoom on `kenburns` segments, the captions (plain phrases, or the word-highlight pill), the end card
13
13
  * over the cut's last frame (its whoosh only with `isEndCardWhoosh`), the cut speech track and the ducked music.
14
14
  */
@@ -32,6 +32,17 @@ export function getSegmentScales(edl, zoomPercent = DEFAULT_EDIT.zoomPercent) {
32
32
  });
33
33
  return scales;
34
34
  }
35
+ /**
36
+ * The frames each segment's zoom eases over (`zoomEaseFrames`, at most the segment's own frames): a `zoom` cut after
37
+ * the first segment that changes the scale and is not `kenburns` (its slow zoom owns the scale); 0 for every other.
38
+ */
39
+ export function getSegmentZoomEases(edl, edit) {
40
+ const scales = getSegmentScales(edl, edit.zoomPercent);
41
+ return edl.segments.map((segment, index) => {
42
+ const isEased = edit.zoomEaseFrames > 0 && index > 0 && segment.transition === "zoom" && segment.motion !== "kenburns" && scales[index - 1] !== scales[index];
43
+ return isEased ? Math.max(1, Math.min(edit.zoomEaseFrames, Math.floor((segment.end - segment.start) * FOOTAGE_FPS))) : 0;
44
+ });
45
+ }
35
46
  export function composeFootage(input) {
36
47
  const { film, edl, words, frame, colors: c, fonts, assets, caption: captionBox } = input;
37
48
  const starts = getSegmentStarts(edl);
@@ -39,45 +50,58 @@ export function composeFootage(input) {
39
50
  const end = getFootageFilmSeconds(film, edl);
40
51
  const edit = getFootageEdit(film);
41
52
  const scales = getSegmentScales(edl, edit.zoomPercent);
53
+ const eases = getSegmentZoomEases(edl, edit);
42
54
  const fadeSeconds = r3(edit.fadeFrames / FOOTAGE_FPS);
43
55
  const kenBurnsScale = 1 + (edit.kenBurnsPercent > 0 ? edit.kenBurnsPercent : HAND_KEN_BURNS_PERCENT) / 100;
44
- const segments = edl.segments.map((segment, index) => {
45
- const src = assets.clips[segment.clip];
46
- if (src === undefined)
47
- throw new Error(`The EDL names clip "${segment.clip}", which the film has no file for.`);
48
- const next = edl.segments[index + 1];
49
- const tail = next?.transition === "fade" ? fadeSeconds : 0;
50
- const start = starts[index];
51
- const duration = r3(segment.end - segment.start + tail);
52
- const scale = scales[index];
53
- const style = scale === 1 ? "" : ` style="transform:scale(${scale})"`;
54
- return `<video id="seg${index}" class="clip shot" src="${escapeHtml(src)}" data-start="${start}" data-media-start="${segment.start}" data-duration="${duration}"${style} muted playsinline></video>`;
55
- });
56
+ const picture = assets.picture;
57
+ const segments = picture === undefined
58
+ ? edl.segments.map((segment, index) => {
59
+ const src = assets.clips[segment.clip];
60
+ if (src === undefined)
61
+ throw new Error(`The EDL names clip "${segment.clip}", which the film has no file for.`);
62
+ const next = edl.segments[index + 1];
63
+ const tail = next?.transition === "fade" ? fadeSeconds : 0;
64
+ const start = starts[index];
65
+ const duration = r3(segment.end - segment.start + tail);
66
+ const scale = scales[index];
67
+ const style = scale === 1 ? "" : ` style="transform:scale(${scale})"`;
68
+ return `<video id="seg${index}" class="clip shot" src="${escapeHtml(src)}" data-start="${start}" data-media-start="${segment.start}" data-duration="${duration}"${style} muted playsinline></video>`;
69
+ })
70
+ : [`<video id="picture" class="clip shot" src="${escapeHtml(picture)}" data-start="0" data-media-start="0" data-duration="${cutEnd}" muted playsinline></video>`];
56
71
  const tweens = [];
57
72
  edl.segments.forEach((segment, index) => {
58
73
  const start = starts[index];
59
- if (segment.transition === "fade" && index > 0) {
60
- tweens.push(`tl.fromTo("#seg${index}", { opacity: 0 }, { opacity: 1, duration: ${fadeSeconds}, ease: "none", immediateRender: false }, ${start});`);
74
+ const scale = scales[index];
75
+ const target = picture === undefined ? `#seg${index}` : "#picture";
76
+ // One video carries every segment: each one sets the zoom it starts at (a fade is already in the picture).
77
+ if (picture !== undefined)
78
+ tweens.push(`tl.set("#picture", { scale: ${scale} }, ${start});`);
79
+ if (picture === undefined && segment.transition === "fade" && index > 0) {
80
+ tweens.push(`tl.fromTo("${target}", { opacity: 0 }, { opacity: 1, duration: ${fadeSeconds}, ease: "none", immediateRender: false }, ${start});`);
81
+ }
82
+ const ease = eases[index];
83
+ if (ease > 0) {
84
+ // Eases from the scale on screen before the cut, so the punch-in (or back out) reads as one move of the camera.
85
+ tweens.push(`tl.fromTo("${target}", { scale: ${scales[index - 1]} }, { scale: ${scales[index]}, duration: ${r3(ease / FOOTAGE_FPS)}, ease: "power1.out", immediateRender: false }, ${start});`);
61
86
  }
62
87
  if (segment.motion === "kenburns") {
63
- const from = scales[index];
64
- tweens.push(`tl.fromTo("#seg${index}", { scale: ${from} }, { scale: ${r3(from * kenBurnsScale)}, duration: ${r3(segment.end - segment.start)}, ease: "none", immediateRender: false }, ${start});`);
88
+ tweens.push(`tl.fromTo("${target}", { scale: ${scale} }, { scale: ${r3(scale * kenBurnsScale)}, duration: ${r3(segment.end - segment.start)}, ease: "none", immediateRender: false }, ${start});`);
65
89
  }
66
90
  });
67
91
  // --- Captions: plain phrases, or the pill that lights each word ---
68
92
  const isHighlight = film.captionStyle === "highlight";
69
93
  const caption = !film.captions ? [] : isHighlight ? captionChunks(words) : phraseChunks(words);
94
+ const spans = getCaptionSpans(caption, cutEnd);
70
95
  const captionHtml = caption
71
96
  .map((chunk, i) => {
72
- const next = caption[i + 1];
73
- const start = r3(chunk.start - 0.05);
74
- const stop = Math.min(chunk.end + 0.35, next === undefined ? cutEnd : next.start - 0.06);
97
+ const { start, end: stop } = spans[i];
75
98
  const box = isHighlight
76
99
  ? `<p class="pill">${chunk.words.map((w, j) => `<span id="cw${i}_${j}">${escapeHtml(w.text)}</span>`).join(" ")}</p>`
77
100
  : `<p class="phrase">${escapeHtml(chunk.words.map((w) => w.text).join(" "))}</p>`;
78
- return `<div id="cap${i}" class="clip caption" data-start="${start}" data-duration="${r3(Math.max(0.1, stop - start))}">${box}</div>`;
101
+ return `<div id="cap${i}" class="clip caption" data-start="${start}" data-duration="${r3(stop - start)}">${box}</div>`;
79
102
  })
80
103
  .join("\n ");
104
+ const captionFit = film.captions && film.captionMaxLines !== undefined ? getCaptionFitScript(film.captionMaxLines, Math.round(captionBox.fontSize * CAPTION_MIN_FONT_SCALE)) : "";
81
105
  // --- Sound ---
82
106
  const sfx = [];
83
107
  const play = (event, t, volume, dur) => {
@@ -136,10 +160,10 @@ html,body{width:${frame.width}px;height:${frame.height}px;overflow:hidden;backgr
136
160
  #root{position:relative;width:${frame.width}px;height:${frame.height}px;overflow:hidden;background:#000;font-family:${bodyFont};color:${c.foreground}}
137
161
  .shot{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;transform-origin:50% 42%}
138
162
  .shade{position:absolute;inset:0;background:${c.background};opacity:0}
139
- .caption{position:absolute;left:${captionBox.left}px;right:${captionBox.right}px;top:${captionBox.top}px;display:flex;justify-content:center}
140
- .pill{font-weight:650;font-size:${captionBox.fontSize}px;line-height:1.18;letter-spacing:-.01em;text-align:center;padding:16px 28px;border-radius:22px;background:${c.captionBackground};box-shadow:0 14px 44px rgba(0,0,0,.5);color:${c.captionText}}
163
+ .caption{position:absolute;left:${captionBox.left}px;right:${captionBox.right}px;${getCaptionPositionCss(captionBox)};display:flex;justify-content:center}
164
+ .pill{${getCaptionPillCss(captionBox.fontSize)};border-radius:22px;background:${c.captionBackground};box-shadow:0 14px 44px rgba(0,0,0,.5);color:${c.captionText}}
141
165
  .pill span{display:inline-block}
142
- .phrase{font-weight:650;font-size:${captionBox.fontSize}px;line-height:1.18;letter-spacing:-.01em;text-align:center;color:#fff;text-shadow:0 2px 6px rgba(0,0,0,.55),0 0 18px rgba(0,0,0,.35)}
166
+ .phrase{font-weight:650;font-size:${captionBox.fontSize}px;line-height:${CAPTION_LINE_HEIGHT};letter-spacing:-.01em;text-align:center;color:#fff;text-shadow:0 2px 6px rgba(0,0,0,.55),0 0 18px rgba(0,0,0,.35)}
143
167
  .endcard{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:0 80px;text-align:center}
144
168
  .brand{display:flex;justify-content:center;align-items:center;gap:18px;font-family:${headingFont};font-size:46px}
145
169
  .logo{height:60px;width:auto}
@@ -155,7 +179,7 @@ html,body{width:${frame.width}px;height:${frame.height}px;overflow:hidden;backgr
155
179
  ${captionHtml}
156
180
  ${audio}
157
181
  </div>
158
- <script>
182
+ ${captionFit}<script>
159
183
  const tl = gsap.timeline({ paused: true });
160
184
  ${tweens.join("\n")}
161
185
  const captions = ${JSON.stringify(isHighlight ? caption.map((chunk) => chunk.words.map((w) => w.start)) : [])};
@@ -172,4 +196,31 @@ window.__timelines["${COMPOSITION_ID}"] = tl;
172
196
  </html>
173
197
  `;
174
198
  }
199
+ /**
200
+ * A page script that shrinks each caption's font in 1 px steps until its text takes at most `maxLines` lines, or the
201
+ * font reaches `minFontSize`. Only the browser knows how the font wraps, so it measures there: once at load and again
202
+ * when the fonts are ready (hyperframes waits for them before the first frame). Hidden clips keep their layout.
203
+ */
204
+ function getCaptionFitScript(maxLines, minFontSize) {
205
+ return `<script>
206
+ (() => {
207
+ const captionMaxLines = ${maxLines}, captionMinFontSize = ${minFontSize};
208
+ const countLines = (el) => {
209
+ const style = getComputedStyle(el);
210
+ return Math.round((el.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom)) / parseFloat(style.lineHeight));
211
+ };
212
+ const fit = () => document.querySelectorAll(".caption > p").forEach((el) => {
213
+ el.style.fontSize = "";
214
+ let size = parseFloat(getComputedStyle(el).fontSize);
215
+ while (countLines(el) > captionMaxLines && size > captionMinFontSize) {
216
+ size -= 1;
217
+ el.style.fontSize = size + "px";
218
+ }
219
+ });
220
+ fit();
221
+ if (document.fonts) document.fonts.ready.then(fit);
222
+ })();
223
+ </script>
224
+ `;
225
+ }
175
226
  //# sourceMappingURL=compose.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compose.js","sourceRoot":"","sources":["../../src/footage/compose.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAsB,MAAM,wBAAwB,CAAC;AAE3E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAY,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAoB,MAAM,WAAW,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,EAAE,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAA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,WAAW;;oCAE5H,UAAU,CAAC,QAAQ,kBAAkB,mBAAmB;;qFAEP,WAAW;;wBAExE,WAAW,8BAA8B,KAAK,CAAC,YAAY;uHACoC,CAAC,CAAC,KAAK,eAAe,CAAC,CAAC,GAAG;6CACrG,CAAC,CAAC,KAAK;;;;sCAId,cAAc,mCAAmC,GAAG,iBAAiB,KAAK,CAAC,KAAK,kBAAkB,KAAK,CAAC,MAAM;IAChJ,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;IACrB,WAAW;IACX,WAAW;IACX,KAAK;;EAEP,UAAU;;EAEV,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;mBACA,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;;;qEAGxC,CAAC,CAAC,WAAW,kBAAkB,CAAC,CAAC,gBAAgB,qFAAqF,CAAC,CAAC,WAAW;;EAEtN,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;iBACT,GAAG;;sBAEE,cAAc;;;;CAInC,CAAC;AACF,CAAC;AAED;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,QAAgB,EAAE,WAAmB;IAChE,OAAO;;4BAEmB,QAAQ,0BAA0B,WAAW;;;;;;;;;;;;;;;;;CAiBxE,CAAC;AACF,CAAC"}
@@ -0,0 +1,44 @@
1
+ import type { Edl } from "./edl.js";
2
+ /**
3
+ * Transitions chosen from the frames around each jump cut (`transitions.jump: "auto"`): the last frame before a cut
4
+ * and the first after it, both from the normalized clips, are shrunk to a small gray thumbnail and compared. A small
5
+ * difference (the same framing, a removed filler) gets an eased punch-in (`zoom`), a large one (the camera moved) a
6
+ * short dissolve (`fade`). Deterministic and local: ffmpeg only, no provider.
7
+ */
8
+ /** The thumbnail both frames are compared at: small enough that handheld shake and noise average out. */
9
+ export declare const CUT_THUMBNAIL: {
10
+ readonly width: 48;
11
+ readonly height: 48;
12
+ };
13
+ /** What the frames around one cut measured and the transition it got. */
14
+ export interface CutMeasure {
15
+ /** The id of the segment the cut starts. */
16
+ segment: string;
17
+ /** The mean absolute difference of the two thumbnails' gray levels, 0 (the same) to 1 (black against white). */
18
+ difference: number;
19
+ transition: "zoom" | "fade";
20
+ }
21
+ /** The mean absolute difference of two gray frames of the same size, 0-1. */
22
+ export declare function measureFrameDifference(before: Uint8Array, after: Uint8Array): number;
23
+ /** `fade` from `threshold` up (the picture moved), `zoom` below it (the same shot). */
24
+ export declare function chooseCutTransition(difference: number, threshold?: number): "zoom" | "fade";
25
+ /** One frame of a clip at `seconds` as a raw gray thumbnail (`CUT_THUMBNAIL`). */
26
+ export declare function buildCutFrameArgs(file: string, seconds: number, output: string): string[];
27
+ /** The indexes of the jump cuts the auto choice sets: a plain cut inside one clip, after the first segment. */
28
+ export declare function findAutoCuts(edl: Edl): number[];
29
+ export interface ChooseCutTransitionsOptions {
30
+ /** The difference from which a cut fades; default `DEFAULT_AUTO_THRESHOLD`. */
31
+ threshold?: number;
32
+ /** A folder for the thumbnails; created, and removed when done. */
33
+ workDir: string;
34
+ signal?: AbortSignal;
35
+ }
36
+ /**
37
+ * Measures every plain jump cut of `edl` (`findAutoCuts`) on the normalized clips and gives it `zoom` or `fade`. Cuts
38
+ * between clips and every other transition stay as they are. Answers the new EDL and what each cut measured.
39
+ */
40
+ export declare function chooseCutTransitions(edl: Edl, clips: Record<string, string>, options: ChooseCutTransitionsOptions): Promise<{
41
+ edl: Edl;
42
+ cuts: CutMeasure[];
43
+ }>;
44
+ //# sourceMappingURL=cuts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cuts.d.ts","sourceRoot":"","sources":["../../src/footage/cuts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM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4
+ import { FOOTAGE_FPS } from "./normalize.js";
5
+ import { runFfmpeg } from "./process.js";
6
+ /**
7
+ * Transitions chosen from the frames around each jump cut (`transitions.jump: "auto"`): the last frame before a cut
8
+ * and the first after it, both from the normalized clips, are shrunk to a small gray thumbnail and compared. A small
9
+ * difference (the same framing, a removed filler) gets an eased punch-in (`zoom`), a large one (the camera moved) a
10
+ * short dissolve (`fade`). Deterministic and local: ffmpeg only, no provider.
11
+ */
12
+ /** The thumbnail both frames are compared at: small enough that handheld shake and noise average out. */
13
+ export const CUT_THUMBNAIL = { width: 48, height: 48 };
14
+ const r4 = (value) => Math.round(value * 10000) / 10000 || 0;
15
+ /** The mean absolute difference of two gray frames of the same size, 0-1. */
16
+ export function measureFrameDifference(before, after) {
17
+ if (before.length === 0 || before.length !== after.length) {
18
+ throw new Error(`Comparing the frames around a cut needs two frames of one size, got ${before.length} and ${after.length} bytes.`);
19
+ }
20
+ let sum = 0;
21
+ for (let index = 0; index < before.length; index++)
22
+ sum += Math.abs(before[index] - after[index]);
23
+ return r4(sum / before.length / 255);
24
+ }
25
+ /** `fade` from `threshold` up (the picture moved), `zoom` below it (the same shot). */
26
+ export function chooseCutTransition(difference, threshold = DEFAULT_AUTO_THRESHOLD) {
27
+ return difference >= threshold ? "fade" : "zoom";
28
+ }
29
+ /** One frame of a clip at `seconds` as a raw gray thumbnail (`CUT_THUMBNAIL`). */
30
+ export function buildCutFrameArgs(file, seconds, output) {
31
+ const { width, height } = CUT_THUMBNAIL;
32
+ return ["-v", "error", "-y", "-ss", String(seconds), "-i", file, "-frames:v", "1", "-vf", `scale=${width}:${height}:flags=area,format=gray`, "-f", "rawvideo", output];
33
+ }
34
+ /** The indexes of the jump cuts the auto choice sets: a plain cut inside one clip, after the first segment. */
35
+ export function findAutoCuts(edl) {
36
+ return edl.segments.flatMap((segment, index) => {
37
+ const previous = edl.segments[index - 1];
38
+ return previous !== undefined && previous.clip === segment.clip && segment.transition === "cut" ? [index] : [];
39
+ });
40
+ }
41
+ /**
42
+ * Measures every plain jump cut of `edl` (`findAutoCuts`) on the normalized clips and gives it `zoom` or `fade`. Cuts
43
+ * between clips and every other transition stay as they are. Answers the new EDL and what each cut measured.
44
+ */
45
+ export async function chooseCutTransitions(edl, clips, options) {
46
+ const threshold = options.threshold ?? DEFAULT_AUTO_THRESHOLD;
47
+ if (!(threshold >= 0 && threshold <= 1))
48
+ throw new Error(`transitions.autoThreshold must be between 0 and 1, got ${String(threshold)}.`);
49
+ const indexes = findAutoCuts(edl);
50
+ if (indexes.length === 0)
51
+ return { edl, cuts: [] };
52
+ const signal = options.signal === undefined ? {} : { signal: options.signal };
53
+ const getClip = (id) => {
54
+ const file = clips[id];
55
+ if (file === undefined)
56
+ throw new Error(`No file for clip "${id}" of the EDL.`);
57
+ return file;
58
+ };
59
+ mkdirSync(options.workDir, { recursive: true });
60
+ const segments = [...edl.segments];
61
+ const cuts = [];
62
+ try {
63
+ for (const index of indexes) {
64
+ const segment = segments[index];
65
+ const previous = segments[index - 1];
66
+ const beforeFile = join(options.workDir, `${segment.id}-before.gray`);
67
+ const afterFile = join(options.workDir, `${segment.id}-after.gray`);
68
+ // The last frame the cut shows before it, and the first after it.
69
+ const beforeAt = Math.round(Math.max(previous.start, previous.end - 1 / FOOTAGE_FPS) * 1000) / 1000;
70
+ await runFfmpeg(`The frame before cut ${segment.id}`, buildCutFrameArgs(getClip(previous.clip), beforeAt, beforeFile), { ...signal, output: beforeFile });
71
+ await runFfmpeg(`The frame after cut ${segment.id}`, buildCutFrameArgs(getClip(segment.clip), segment.start, afterFile), { ...signal, output: afterFile });
72
+ const difference = measureFrameDifference(readFileSync(beforeFile), readFileSync(afterFile));
73
+ const transition = chooseCutTransition(difference, threshold);
74
+ segments[index] = { ...segment, transition };
75
+ cuts.push({ segment: segment.id, difference, transition });
76
+ }
77
+ }
78
+ finally {
79
+ rmSync(options.workDir, { recursive: true, force: true });
80
+ }
81
+ return { edl: { ...edl, segments }, cuts };
82
+ }
83
+ //# s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AC7C,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The free space a hyperframes render needs. hyperframes 0.8.85 refuses to render (exit code 1, "Low disk space")
3
+ * when its temp folder (`os.tmpdir()`, where it also extracts the clips' frames) or its output's folder has under
4
+ * 1 GiB free, measured as `statfs` `bsize * bavail`. The kit measures the same way, so it never refuses a render
5
+ * hyperframes would run.
6
+ */
7
+ export declare const RENDER_MIN_FREE_BYTES: number;
8
+ /** Reads a folder's free bytes; null when it cannot be read. Injected in tests. */
9
+ export type FreeBytesReader = (folder: string) => number | null;
10
+ /** Free bytes for an unprivileged writer at `folder` (or its nearest existing parent); null when `statfs` fails. */
11
+ export declare function getFreeBytes(folder: string): number | null;
12
+ /**
13
+ * The temp folder the hyperframes process will use: `tempDir` when given (the kit passes it as `TMPDIR`), else the
14
+ * `TMPDIR`, `TMP` or `TEMP` of the environment it runs with, else this process's `os.tmpdir()`.
15
+ */
16
+ export declare function getRenderTempDir(env: NodeJS.ProcessEnv, tempDir?: string): string;
17
+ /**
18
+ * One sentence per folder with less free space than a render needs, naming the folder and how to fix it. Folders
19
+ * are checked once each; an unreadable one is skipped.
20
+ */
21
+ export declare function findLowDiskProblems(folders: {
22
+ temp: string;
23
+ build?: string;
24
+ }, readFreeBytes?: FreeBytesReader): string[];
25
+ //# sourceMappingURL=disk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disk.d.ts","sourceRoot":"","sources":["../../src/footage/disk.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAY,CAAC;AAE/C,mFAAmF;AACnF,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;AAahE,oHAAoH;AACpH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ1D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAOjF;AAID;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,aAAa,GAAE,eAA8B,GAAG,MAAM,EAAE,CAkBtI"}
@@ -0,0 +1,72 @@
1
+ import { existsSync, statfsSync } from "node:fs";
2
+ import { tmpdir } from "node:os";
3
+ import { dirname, resolve } from "node:path";
4
+ /**
5
+ * The free space a hyperframes render needs. hyperframes 0.8.85 refuses to render (exit code 1, "Low disk space")
6
+ * when its temp folder (`os.tmpdir()`, where it also extracts the clips' frames) or its output's folder has under
7
+ * 1 GiB free, measured as `statfs` `bsize * bavail`. The kit measures the same way, so it never refuses a render
8
+ * hyperframes would run.
9
+ */
10
+ export const RENDER_MIN_FREE_BYTES = 1024 ** 3;
11
+ /** The nearest existing folder of a path: a folder the run creates later is measured on the disk it will live on. */
12
+ function findExistingFolder(path) {
13
+ let current = resolve(path);
14
+ while (!existsSync(current)) {
15
+ const parent = dirname(current);
16
+ if (parent === current)
17
+ return current;
18
+ current = parent;
19
+ }
20
+ return current;
21
+ }
22
+ /** Free bytes for an unprivileged writer at `folder` (or its nearest existing parent); null when `statfs` fails. */
23
+ export function getFreeBytes(folder) {
24
+ try {
25
+ const stats = statfsSync(findExistingFolder(folder));
26
+ return stats.bsize * stats.bavail;
27
+ }
28
+ catch {
29
+ // An unreadable disk is not reported: hyperframes passes it as "Unable to check" too.
30
+ return null;
31
+ }
32
+ }
33
+ /**
34
+ * The temp folder the hyperframes process will use: `tempDir` when given (the kit passes it as `TMPDIR`), else the
35
+ * `TMPDIR`, `TMP` or `TEMP` of the environment it runs with, else this process's `os.tmpdir()`.
36
+ */
37
+ export function getRenderTempDir(env, tempDir) {
38
+ if (tempDir !== undefined && tempDir.length > 0)
39
+ return resolve(tempDir);
40
+ for (const name of ["TMPDIR", "TMP", "TEMP"]) {
41
+ const value = env[name];
42
+ if (value !== undefined && value.length > 0)
43
+ return resolve(value);
44
+ }
45
+ return tmpdir();
46
+ }
47
+ const toGiB = (bytes) => (bytes / 1024 ** 3).toFixed(1);
48
+ /**
49
+ * One sentence per folder with less free space than a render needs, naming the folder and how to fix it. Folders
50
+ * are checked once each; an unreadable one is skipped.
51
+ */
52
+ export function findLowDiskProblems(folders, readFreeBytes = getFreeBytes) {
53
+ const entries = [
54
+ {
55
+ folder: resolve(folders.temp),
56
+ role: "the temp folder",
57
+ hint: "hyperframes extracts the clips' frames there (hundreds of MB per minute of film): point TMPDIR (or renderFootage's tempDir) at a data volume, not a small tmpfs",
58
+ },
59
+ ];
60
+ if (folders.build !== undefined && resolve(folders.build) !== entries[0]?.folder) {
61
+ entries.push({ folder: resolve(folders.build), role: "the build folder", hint: "hyperframes writes the render there: free space or move buildDir to a larger disk" });
62
+ }
63
+ const problems = [];
64
+ for (const entry of entries) {
65
+ const free = readFreeBytes(entry.folder);
66
+ if (free === null || free >= RENDER_MIN_FREE_BYTES)
67
+ continue;
68
+ problems.push(`${entry.role} ${entry.folder} has ${toGiB(free)} GiB free and a hyperframes render needs ${toGiB(RENDER_MIN_FREE_BYTES)} GiB; ${entry.hint}.`);
69
+ }
70
+ return problems;
71
+ }
72
+ //# sourceMappingURL=disk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disk.js","sourceRoot":"","sources":["../../src/footage/disk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,IAAI,CAAC,CAAC;AAK/C,qHAAqH;AACrH,SAAS,kBAAkB,CAAC,IAAY;IACtC,IAAI,OAAO,G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gBAAiC,YAAY;IAC1H,MAAM,OAAO,GAAqD;QAChE;YACE,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;YAC7B,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE,iKAAiK;SACxK;KACF,CAAC;IACF,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;QACjF,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,mFAAmF,EAAE,CAAC,CAAC;IACxK,CAAC;IACD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI,qBAAqB;YAAE,SAAS;QAC7D,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,QAAQ,KAAK,CAAC,IAAI,CAAC,4CAA4C,KAAK,CAAC,qBAAqB,CAAC,SAAS,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;IAChK,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,119 @@
1
+ import type { CaptionLayout, LayoutOverride } from "../compose/timeline.js";
2
+ import type { TimedWord } from "../voice/voiceover.js";
3
+ import { type Edl } from "./edl.js";
4
+ import { type FootageFilm } from "./film.js";
5
+ import { type Frame } from "./normalize.js";
6
+ import { type FootageResult, type FootageRunOptions, type PreparedClip, type TranscribeOutcome } from "./pipeline.js";
7
+ /**
8
+ * A fast draft of a footage film, ffmpeg only (no hyperframes, no browser): the cut at a small width with the film's
9
+ * phrase captions burned in, its zoom cuts (eased as in the render), cross-fades and Ken Burns b-roll drawn as the full render draws them, and
10
+ * the speech track. No loudness pass, music, end card or cover. What an app shows the owner before the paid render.
11
+ */
12
+ /** The draft's default width: 540 makes a 540×960 draft of a 9:16 film. */
13
+ export declare const FOOTAGE_DRAFT_WIDTH = 540;
14
+ /** The font the draft's captions are drawn with: DejaVu Sans Bold, subset to Latin with every Polish letter, shipped in `fonts/`. */
15
+ export declare const FOOTAGE_DRAFT_FONT: {
16
+ readonly family: "DejaVu Sans";
17
+ readonly file: string;
18
+ };
19
+ /** The draft's frame: the film's frame scaled to `width`, both sides even (H.264 yuv420p needs them even). */
20
+ export declare function getFootageDraftFrame(frame: Frame, width?: number): Frame;
21
+ export interface FootageDraftCaptionsInput {
22
+ film: Pick<FootageFilm, "captions">;
23
+ edl: Edl;
24
+ /** The film's words in film time (`remapWords`). */
25
+ words: TimedWord[];
26
+ /** The caption box in the film's frame (`getFootageCaptionLayout`). */
27
+ caption: CaptionLayout;
28
+ /** The film's full frame; the ASS file is laid out in it and libass scales it to the draft. */
29
+ frame: Frame;
30
+ /** The font family the captions are drawn in; default `FOOTAGE_DRAFT_FONT.family`. */
31
+ fontFamily?: string;
32
+ }
33
+ /**
34
+ * The draft's captions as an ASS subtitle file: the film's phrases (`phraseChunks`) shown for the render's spans
35
+ * (`getCaptionSpans`), white bold text with a dark outline and shadow, centred in the caption box from its top (or
36
+ * from its foot, with `bottom`). Null when the film has no captions or nothing is said.
37
+ */
38
+ export declare function buildFootageDraftCaptions(input: FootageDraftCaptionsInput): string | null;
39
+ export interface FootageDraftArgsInput {
40
+ film: Pick<FootageFilm, "edit">;
41
+ edl: Edl;
42
+ /** The normalized clips by id. */
43
+ clips: Record<string, string>;
44
+ /** The cut speech track (`buildSpeechArgs`). */
45
+ speech: string;
46
+ /** The film's full frame (the normalized clips' size). */
47
+ frame: Frame;
48
+ /** The draft's width; default 540. */
49
+ width?: number;
50
+ /** The ASS captions file (`buildFootageDraftCaptions`), or null for none. */
51
+ captions: string | null;
52
+ /** The folder libass loads the captions' font from, or null for the system's fonts. */
53
+ fontsDir: string | null;
54
+ output: string;
55
+ /**
56
+ * ffmpeg's threads for every segment's decoder, the filter graph and the encoder; by default ffmpeg's own choice,
57
+ * which follows the host's cores, not a container's CPU quota. A positive whole number.
58
+ */
59
+ threads?: number;
60
+ }
61
+ /** A segment's picture as the draft plays it: how long its stream runs and the fade it starts with. */
62
+ export interface DraftSegmentPlan {
63
+ /** The segment's own length in the cut. */
64
+ length: number;
65
+ /** Seconds the segment's stream runs: its length plus the fade into the next segment, which plays over its end. */
66
+ seconds: number;
67
+ /** The film second the segment starts at. */
68
+ start: number;
69
+ /** The cross-fade from the segment before, in seconds; 0 for a plain cut. */
70
+ fade: number;
71
+ /** The zoom the segment starts at (`getSegmentScales`). */
72
+ scale: number;
73
+ /** The zoom it ends at: above `scale` for a `kenburns` segment, `scale` otherwise. */
74
+ endScale: number;
75
+ /** The zoom on screen before an eased `zoom` cut, which the segment eases from to `scale`; `scale` otherwise. */
76
+ startScale: number;
77
+ /** The frames the zoom eases over (`getSegmentZoomEases`); 0: the segment starts at `scale`. */
78
+ easeFrames: number;
79
+ }
80
+ /**
81
+ * How each segment plays in the draft. A `fade` cut lasts the film's `fadeFrames` (clamped to the incoming segment, so
82
+ * the cross-fade never outlasts it) and the outgoing segment runs on under it, as in the render.
83
+ */
84
+ export declare function planFootageDraft(film: Pick<FootageFilm, "edit">, edl: Edl): DraftSegmentPlan[];
85
+ /**
86
+ * The ffmpeg arguments of the draft: each segment read from its own seek into its clip, zoomed and scaled to the
87
+ * draft's width, joined by `xfade` at `fade` cuts and `concat` at the others, the captions burned in (`ass`), the
88
+ * speech track under it; H.264 yuv420p and AAC with fast start, exactly the cut's length.
89
+ */
90
+ export declare function buildFootageDraftArgs(input: FootageDraftArgsInput): string[];
91
+ export interface RenderFootageDraftOptions extends Pick<FootageRunOptions, "buildDir" | "log" | "signal" | "onProgress"> {
92
+ /** The draft MP4. */
93
+ output: string;
94
+ /** The draft's width; default 540 (540×960 for a 9:16 film). */
95
+ width?: number;
96
+ /** A project's override of the format's caption box (`marketing.json` `layout`), as the render takes it. */
97
+ layout?: LayoutOverride;
98
+ /**
99
+ * ffmpeg's threads for the draft's decoders, filter graph and encoder (`buildFootageDraftArgs`); by default ffmpeg's
100
+ * own choice, which follows the host's cores. Set it from a CPU-limited container's quota.
101
+ */
102
+ threads?: number;
103
+ }
104
+ export interface FootageDraft {
105
+ output: string;
106
+ /** The draft's length: the cut's. */
107
+ seconds: number;
108
+ width: number;
109
+ height: number;
110
+ bytes: number;
111
+ }
112
+ /**
113
+ * Makes the draft of a cut film: the speech track, the captions file and the font in `<buildDir>/draft/`, then one
114
+ * ffmpeg run (`buildFootageDraftArgs`). Spends nothing; takes the same clips, transcript and EDL as `renderFootage`.
115
+ */
116
+ export declare function renderFootageDraft(film: FootageFilm, clips: PreparedClip[], transcript: Extract<TranscribeOutcome, {
117
+ kind: "ready";
118
+ }>, edl: Edl, options: RenderFootageDraftOptions): Promise<FootageResult<FootageDraft>>;
119
+ //# sourceMappingURL=draft.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../src/footage/draft.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EAAgD,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAClF,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAA8B,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIhI;;;;GAIG;AAE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