@clipwright/core 0.55.1 → 0.57.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 (111) hide show
  1. package/dist/actors.js +2 -2
  2. package/dist/actors.js.map +1 -1
  3. package/dist/caption-funnel.d.ts +10 -0
  4. package/dist/caption-funnel.js +101 -0
  5. package/dist/caption-funnel.js.map +1 -0
  6. package/dist/contract-dispositions.d.ts +411 -1
  7. package/dist/contract-dispositions.js +8 -3
  8. package/dist/contract-dispositions.js.map +1 -1
  9. package/dist/contracts/v1/workflow-brief.d.ts +2730 -1078
  10. package/dist/contracts/v1/workflow-catalog.d.ts +2764 -1088
  11. package/dist/contracts/v1/workflow-catalog.js +2 -1
  12. package/dist/contracts/v1/workflow-catalog.js.map +1 -1
  13. package/dist/contracts/v1/workflow-client.d.ts +1285 -437
  14. package/dist/contracts/v1/workflow-execution.d.ts +5 -0
  15. package/dist/contracts/v1/workflow-next.d.ts +1 -0
  16. package/dist/contracts/v1/workflow-plan.d.ts +4220 -1724
  17. package/dist/contracts/v1/workflow-run-read.d.ts +2 -0
  18. package/dist/creator-profile.d.ts +81 -2
  19. package/dist/creator-profile.js +158 -18
  20. package/dist/creator-profile.js.map +1 -1
  21. package/dist/faceless-media-record.js +4 -2
  22. package/dist/faceless-media-record.js.map +1 -1
  23. package/dist/faceless-public.d.ts +932 -75
  24. package/dist/faceless-public.js +23 -2
  25. package/dist/faceless-public.js.map +1 -1
  26. package/dist/film-directions.d.ts +33 -0
  27. package/dist/film-directions.js +27 -0
  28. package/dist/film-directions.js.map +1 -0
  29. package/dist/film-guide.d.ts +4 -1
  30. package/dist/film-guide.js +1 -0
  31. package/dist/film-guide.js.map +1 -1
  32. package/dist/generations.d.ts +2 -2
  33. package/dist/generations.js +2 -1
  34. package/dist/generations.js.map +1 -1
  35. package/dist/index.d.ts +4 -0
  36. package/dist/index.js +4 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/mcp-ugc-descriptions.js +13 -6
  39. package/dist/mcp-ugc-descriptions.js.map +1 -1
  40. package/dist/parts-pricing.d.ts +4 -1
  41. package/dist/parts-pricing.js +9 -4
  42. package/dist/parts-pricing.js.map +1 -1
  43. package/dist/presenter-matte.d.ts +20 -0
  44. package/dist/presenter-matte.js +35 -0
  45. package/dist/presenter-matte.js.map +1 -0
  46. package/dist/reference-analysis.d.ts +24 -0
  47. package/dist/reference-analysis.js +9 -3
  48. package/dist/reference-analysis.js.map +1 -1
  49. package/dist/reference-display.js +2 -1
  50. package/dist/reference-display.js.map +1 -1
  51. package/dist/reference-kinds.d.ts +2 -2
  52. package/dist/reference-profile.d.ts +48 -0
  53. package/dist/reference-staging.d.ts +8 -0
  54. package/dist/reference-voice-over.d.ts +35 -0
  55. package/dist/reference-voice-over.js +27 -0
  56. package/dist/reference-voice-over.js.map +1 -0
  57. package/dist/resolved-timeline.d.ts +1 -0
  58. package/dist/resolved-timeline.js +6 -4
  59. package/dist/resolved-timeline.js.map +1 -1
  60. package/dist/run-static-warnings.js +2 -2
  61. package/dist/run-static-warnings.js.map +1 -1
  62. package/dist/runs.d.ts +2 -0
  63. package/dist/skills.d.ts +4707 -2667
  64. package/dist/skills.js +27 -17
  65. package/dist/skills.js.map +1 -1
  66. package/dist/templates/backdrop.d.ts +33 -0
  67. package/dist/templates/backdrop.js +50 -0
  68. package/dist/templates/backdrop.js.map +1 -0
  69. package/dist/templates/comment-cta.d.ts +106 -0
  70. package/dist/templates/comment-cta.js +178 -0
  71. package/dist/templates/comment-cta.js.map +1 -0
  72. package/dist/templates/cover-story.d.ts +16 -0
  73. package/dist/templates/cover-story.js +33 -0
  74. package/dist/templates/cover-story.js.map +1 -0
  75. package/dist/templates/index.d.ts +53 -2
  76. package/dist/templates/index.js +131 -11
  77. package/dist/templates/index.js.map +1 -1
  78. package/dist/templates/series-frame.d.ts +73 -0
  79. package/dist/templates/series-frame.js +179 -0
  80. package/dist/templates/series-frame.js.map +1 -0
  81. package/dist/trend-search.d.ts +3 -2
  82. package/dist/trend-search.js +4 -26
  83. package/dist/trend-search.js.map +1 -1
  84. package/dist/voice-admission.d.ts +1287 -467
  85. package/dist/workflows/catalog.d.ts +4 -0
  86. package/dist/workflows/catalog.js +15 -4
  87. package/dist/workflows/catalog.js.map +1 -1
  88. package/dist/workflows/film-directions.d.ts +10 -0
  89. package/dist/workflows/film-directions.js +67 -0
  90. package/dist/workflows/film-directions.js.map +1 -0
  91. package/dist/workflows/index.d.ts +1 -0
  92. package/dist/workflows/index.js +1 -0
  93. package/dist/workflows/index.js.map +1 -1
  94. package/dist/workflows/methods/faceless-explainer.d.ts +486 -4
  95. package/dist/workflows/methods/kinetic-launch.d.ts +4650 -4
  96. package/dist/workflows/methods/kinetic-launch.js +23 -1
  97. package/dist/workflows/methods/kinetic-launch.js.map +1 -1
  98. package/dist/workflows/methods/product-image-story.d.ts +486 -4
  99. package/dist/workflows/methods/reference-remake.d.ts +486 -4
  100. package/dist/workflows/methods/shared.d.ts +488 -4
  101. package/dist/workflows/methods/shared.js +5 -0
  102. package/dist/workflows/methods/shared.js.map +1 -1
  103. package/dist/workflows/methods/ugc-faq-answer.d.ts +486 -4
  104. package/dist/workflows/methods/ugc-product-intro.d.ts +486 -4
  105. package/dist/workflows/methods/website-proof-demo.d.ts +4650 -4
  106. package/dist/workflows/methods/website-proof-demo.js +25 -1
  107. package/dist/workflows/methods/website-proof-demo.js.map +1 -1
  108. package/dist/workflows/reference-remake.d.ts +32 -0
  109. package/dist/workflows/validate.js +3 -1
  110. package/dist/workflows/validate.js.map +1 -1
  111. package/package.json +1 -1
@@ -0,0 +1,178 @@
1
+ import { z } from "zod";
2
+ import { frameCanvasOf } from "../ugc-layers.js";
3
+ import { centredArea, fillingStep, templateSize } from "./size.js";
4
+ import { templateMedia } from "./slot.js";
5
+ export const CTA_LINES = { min: 2, max: 6 };
6
+ export const CTA_ITEMS = { min: 3, max: 17 };
7
+ /** The one format the page is drawn in. */
8
+ export const CTA_ASPECT = "9:16";
9
+ /** Frames the page takes to dissolve into the video's first frame when it loops. */
10
+ export const CTA_LOOP_FRAMES = 10;
11
+ /** The funnel's own pace, in frames at 25 fps: the code word starts typing after the first line enters, one letter at a time, is sent, then the
12
+ * message arrives, the follow button pops and is tapped, and the tap settles. */
13
+ export const CTA_FUNNEL = { typeDelay: 6, letter: 3, send: 6, arrive: 8, tap: 18, settle: 12 };
14
+ /** The least gap between two lines of the header, so each builds its words before the next replaces it. */
15
+ export const CTA_LINE_GAP = 10;
16
+ /** The labels a viewer's app shows, in English when absent. */
17
+ export const CTA_LABELS = { comment: "Add a comment…", follow: "Follow", following: "Following" };
18
+ /** Script languages whose letters are Latin: the English labels may stand in them, as their own words. */
19
+ const LATIN_LANGUAGES = ["en", "pl", "vi"];
20
+ /** On only where the flag says so; off, a comment_cta template is refused before any reserve. */
21
+ export function isCommentCtaEnabled(env = typeof process === "undefined" ? {} : process.env) {
22
+ return env.CLIPWRIGHT_COMMENT_CTA === "1";
23
+ }
24
+ export const COMMENT_CTA_DISABLED_MESSAGE = "comment_cta is not available right now; use another template kind";
25
+ const line = z.object({
26
+ text: z.string().min(1).max(32),
27
+ accent: z.string().min(1).max(24).optional(),
28
+ act: z.enum(["dm", "follow"]).optional(),
29
+ at: z.string().min(1).max(200).optional(),
30
+ }).strict();
31
+ const data = z.object({
32
+ title: z.string().min(1).max(40),
33
+ accent: z.string().min(1).max(24).optional(),
34
+ list_title: z.string().min(1).max(32),
35
+ items: z.array(z.string().min(1).max(24)).min(CTA_ITEMS.min).max(CTA_ITEMS.max),
36
+ code: z.string().min(1).max(16),
37
+ handle: z.string().min(1).max(30),
38
+ dm: z.string().min(1).max(40),
39
+ lines: z.array(line).min(CTA_LINES.min).max(CTA_LINES.max),
40
+ avatar: templateMedia.optional(),
41
+ labels: z.object({ comment: z.string().min(1).max(24).optional(), follow: z.string().min(1).max(12).optional(),
42
+ following: z.string().min(1).max(12).optional() }).strict().optional(),
43
+ loop: z.boolean().optional(),
44
+ size: templateSize,
45
+ }).strict().superRefine((value, context) => {
46
+ const issue = (path, message) => context.addIssue({ code: z.ZodIssueCode.custom, path, message });
47
+ if (value.accent !== undefined && !value.title.includes(value.accent))
48
+ issue(["accent"], "accent names words of the title, as written there");
49
+ value.lines.forEach((entry, index) => {
50
+ if (entry.accent !== undefined && !entry.text.includes(entry.accent))
51
+ issue(["lines", index, "accent"], "accent names words of the line, as written there");
52
+ });
53
+ for (const act of ["dm", "follow"]) {
54
+ const named = value.lines.flatMap((entry, index) => (entry.act === act ? [index] : []));
55
+ if (named.length > 1)
56
+ issue(["lines", named[1], "act"], `act ${act} names one line`);
57
+ }
58
+ const dm = value.lines.findIndex(entry => entry.act === "dm"), follow = value.lines.findIndex(entry => entry.act === "follow");
59
+ if (dm >= 0 && follow >= 0 && follow < dm)
60
+ issue(["lines", follow, "act"], "the follow comes after the message: put act follow on the dm line or a later one");
61
+ });
62
+ /** The lines the message and the follow arrive on: the ones that name them, else the middle line and the last. */
63
+ export function commentCtaActLines(lines) {
64
+ const follow = lines.findIndex(entry => entry.act === "follow"), dm = lines.findIndex(entry => entry.act === "dm");
65
+ const followLine = follow >= 0 ? follow : lines.length - 1;
66
+ return { dm: dm >= 0 ? dm : Math.min(Math.floor(lines.length / 2), followLine), follow: followLine };
67
+ }
68
+ /** The funnel's frames from the template's start, from the lines' frames: typing, its end, the send, the message, the follow and its tap. */
69
+ export function commentCtaSchedule(moments, code, acts) {
70
+ const type = moments[0] + CTA_FUNNEL.typeDelay, typed = type + Array.from(code).length * CTA_FUNNEL.letter, sent = typed + CTA_FUNNEL.send;
71
+ const dm = Math.max(moments[acts.dm], sent + CTA_FUNNEL.arrive), follow = Math.max(moments[acts.follow], dm + CTA_FUNNEL.arrive);
72
+ return { type, typed, sent, dm, follow, tap: follow + CTA_FUNNEL.tap };
73
+ }
74
+ const seconds = (frames, fps) => `${(frames / fps).toFixed(1)} s`;
75
+ /** Each line's first frame: the first on frame 0, a quoted line on its words, the rest spread before the follow's tap, each `CTA_LINE_GAP`
76
+ * after the one before. Acts past its words run on, asking `frames` up to `most` (#1457); past `most` the tap is cut; every move is named. */
77
+ export function commentCtaMoments(value, beats, duration, fps, id, most = duration) {
78
+ const count = value.lines.length, warnings = [], loop = value.loop ? CTA_LOOP_FRAMES : 0, limit = Math.max(duration, most);
79
+ const spread = Math.max(0, duration - loop - CTA_FUNNEL.tap - CTA_FUNNEL.settle);
80
+ const anchors = Array.from({ length: count + 1 }, (_, index) => (index === 0 ? 0 : index === count ? spread : beats[index]));
81
+ const targets = [0];
82
+ for (let from = 0; from < count;) {
83
+ let to = from + 1;
84
+ while (to < count && anchors[to] === undefined)
85
+ to++;
86
+ const start = targets[from], end = Math.max(start, anchors[to]);
87
+ for (let at = from + 1; at < to; at++)
88
+ targets[at] = Math.round(start + ((end - start) * (at - from)) / (to - from));
89
+ if (to < count)
90
+ targets[to] = anchors[to];
91
+ from = to;
92
+ }
93
+ const moments = [], rushed = [];
94
+ for (const [index, target] of targets.entries()) {
95
+ const earliest = index === 0 ? 0 : moments[index - 1] + CTA_LINE_GAP;
96
+ // A gap that would run past the frames it may reach gives way: the line starts on its own frame and the one before it is cut short (#1425).
97
+ if (earliest >= limit) {
98
+ moments.push(Math.min(limit - 1, Math.max(target, moments[index - 1] + 1)));
99
+ rushed.push(index);
100
+ continue;
101
+ }
102
+ moments.push(Math.min(limit - 1, Math.max(target, earliest)));
103
+ if (target < earliest && beats[index] !== undefined) {
104
+ warnings.push(`template "${id}" lines.${index}.at "${value.lines[index].at}" is spoken too close after the line before it: the line starts ` +
105
+ `${seconds(earliest - target, fps)} later`);
106
+ }
107
+ }
108
+ if (rushed.length) {
109
+ warnings.push(`template "${id}": ${rushed.map(index => `lines.${index}`).join(" and ")} ${rushed.length === 1 ? "starts" : "start"} less than ` +
110
+ `${seconds(CTA_LINE_GAP, fps)} after the line before, too near the template's end to wait: the line before ${rushed.length === 1 ? "it" : "each"} is cut short`);
111
+ }
112
+ // The tap settles, and the last line has its gap to build its words, before the loop.
113
+ const { tap } = commentCtaSchedule(moments, value.code, commentCtaActLines(value.lines));
114
+ const need = Math.max(tap + CTA_FUNNEL.settle, moments.at(-1) + CTA_LINE_GAP), frames = Math.max(duration, Math.min(need + loop, limit));
115
+ const room = frames - loop;
116
+ if (frames > duration) {
117
+ warnings.push(`template "${id}" runs ${seconds(frames - duration, fps)} past its words so that its comment, message and follow play to the end`);
118
+ }
119
+ if (need > room) {
120
+ warnings.push(`template "${id}": the call to action has ${seconds(room, fps)} and its comment, message and follow need ${seconds(need, fps)}, ` +
121
+ `so ${tap >= room ? "the follow button is not tapped on screen" : "the tap on the follow button is cut short"}`);
122
+ }
123
+ return { moments, warnings, ...(frames > duration ? { frames } : {}) };
124
+ }
125
+ /** Why the data cannot stand in this run, beyond its schema: labels the script's language needs, a loop that would not end the video. */
126
+ export function commentCtaRefusals(value, context) {
127
+ const refusals = [];
128
+ if (!LATIN_LANGUAGES.includes(context.language)) {
129
+ const missing = Object.keys(CTA_LABELS).filter(key => value.labels?.[key] === undefined);
130
+ if (missing.length)
131
+ refusals.push({ path: ["labels"], message: `comment_cta labels ${missing.join(", ")} are needed in the script's language: ` +
132
+ "the comment field and the follow button would read English otherwise" });
133
+ }
134
+ if (value.loop && !context.endsScript)
135
+ refusals.push({ path: ["loop"], message: "comment_cta loop ends the video on its first frame: " +
136
+ "the template must cover the script's last words, or drop loop" });
137
+ return refusals;
138
+ }
139
+ /** A full-frame comment funnel: the title, the avatar, a header line built word by word, the full list's card, the code word typed and sent,
140
+ * the handle's message, a follow button tapped; optionally ending on the video's first frame so it loops. */
141
+ export const commentCta = {
142
+ kind: "comment_cta",
143
+ kindVersion: 1,
144
+ description: "a full-frame closing call to action in 9:16 that acts out a comment-keyword funnel: the title and an avatar (the avatar image, " +
145
+ "else the handle's initial) over a card with the full list (list_title, 3–17 items, ticked); a header line of 2–6 lines, each building " +
146
+ "word by word on its at quote (the rest spread evenly), the accent words marked; a comment field types code letter by letter and sends it " +
147
+ "with a tick; the handle's message dm arrives on the line with act dm (else the middle line), and a follow pill with the avatar pops on " +
148
+ "the line with act follow (else the last) and is tapped to following; labels set the field's hint and the button's two words, needed when " +
149
+ "the script is not in Latin letters (English otherwise); when its words are shorter than the comment, message and follow need, the call to " +
150
+ "action runs on past them and the next template starts later, or, at the end of the video, the video holds its last frame past the last word " +
151
+ "until the follow is tapped; loop true dissolves the last frames into the video's first frame, so the video loops, and needs the template to " +
152
+ "cover the script's last words",
153
+ placements: ["full"],
154
+ aspects: [CTA_ASPECT],
155
+ data,
156
+ text: { title: 40, accent: 24, list_title: 32, items: 24, code: 16, handle: 30, dm: 40, "lines.text": 32, "lines.accent": 24,
157
+ "labels.comment": 24, "labels.follow": 12, "labels.following": 12 },
158
+ quotes: ["lines.at"],
159
+ spreads: "lines",
160
+ firstBeatAtStart: true,
161
+ fillsFrame: true,
162
+ slots: { avatar: { type: "image", cover: 1 } },
163
+ timing: (value, beats, duration, fps, id, most) => commentCtaMoments(value, beats, duration, fps, id, most),
164
+ check: (value, context) => commentCtaRefusals(value, context),
165
+ hidesCaptions: () => true,
166
+ onInserts: false,
167
+ // The page fills the frame at medium; small draws it a quarter smaller on the theme's ground.
168
+ rect: (value, aspectRatio) => {
169
+ const canvas = frameCanvasOf(aspectRatio), step = fillingStep(value.size);
170
+ return centredArea(canvas, step * canvas.width, step * canvas.height);
171
+ },
172
+ sample: { title: "5 AI tools for faster edits", accent: "AI tools", list_title: "5 AI tools", items: ["Auto captions", "Orbit intro", "Chat edits",
173
+ "Phone preview", "Timeline view"], code: "TOOLS", handle: "studio.daily", dm: "sent you the full list",
174
+ lines: [{ text: "Comment \"TOOLS\"", accent: "TOOLS", at: "comment" }, { text: "and I'll send", at: "send" },
175
+ { text: "the full list", accent: "list", act: "dm", at: "list" }, { text: "Don't forget to follow", accent: "follow", act: "follow", at: "follow" }],
176
+ avatar: { asset_id: `ast_${"7".repeat(32)}` }, labels: { comment: "Add a comment…", follow: "Follow", following: "Following" }, loop: true },
177
+ };
178
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,wBAAwB;QACtG,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,EAAE;YAC1G,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC;QACtJ,MAAM,EAAE,EAAE,QAAQ,EAAE,OAAO,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;CAC/I,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import type { TemplateKind } from "./index.js";
3
+ declare const data: z.ZodObject<{
4
+ masthead: z.ZodString;
5
+ issue: z.ZodOptional<z.ZodString>;
6
+ number: z.ZodOptional<z.ZodString>;
7
+ cover_line: z.ZodString;
8
+ size: z.ZodOptional<z.ZodEnum<{
9
+ large: "large";
10
+ medium: "medium";
11
+ small: "small";
12
+ }>>;
13
+ }, z.core.$strict>;
14
+ /** A magazine cover over the whole frame, its masthead behind the presenter's head (#1428): the presenter is cut out and stands in front. */
15
+ export declare const coverStory: TemplateKind<typeof data>;
16
+ export {};
@@ -0,0 +1,33 @@
1
+ import { z } from "zod";
2
+ import { frameCanvasOf } from "../ugc-layers.js";
3
+ import { centredArea, fillingStep, templateSize } from "./size.js";
4
+ const data = z.object({
5
+ masthead: z.string().min(1).max(10).regex(/^\S+$/u, "masthead is one word, without spaces"),
6
+ issue: z.string().min(1).max(28).optional(),
7
+ number: z.string().min(1).max(4).optional(),
8
+ cover_line: z.string().min(1).max(32),
9
+ size: templateSize,
10
+ }).strict();
11
+ /** A magazine cover over the whole frame, its masthead behind the presenter's head (#1428): the presenter is cut out and stands in front. */
12
+ export const coverStory = {
13
+ kind: "cover_story",
14
+ kindVersion: 1,
15
+ description: "a magazine cover filling the frame: the presenter stands in front of a huge masthead word, with an issue line, a big " +
16
+ "number and a cover line around them; it drops in over its first 10 frames; on a plain script run (no inserts, overlays, layout_windows, " +
17
+ "framing, call, interview or shots); free",
18
+ placements: ["full"],
19
+ data,
20
+ text: { masthead: 10, issue: 28, number: 4, cover_line: 32 },
21
+ slots: {},
22
+ cutout: true,
23
+ fillsFrame: true,
24
+ hidesCaptions: () => true,
25
+ onInserts: false,
26
+ // The type's area: the whole frame, a quarter smaller at small; the presenter is drawn over the whole frame at every size.
27
+ rect: (value, aspectRatio) => {
28
+ const canvas = frameCanvasOf(aspectRatio), step = fillingStep(value.size);
29
+ return centredArea(canvas, step * canvas.width, step * canvas.height);
30
+ },
31
+ sample: { masthead: "FOCUS", issue: "ISSUE 17 · NOVEMBER", number: "17", cover_line: "ONE HABIT, NO EDITOR" },
32
+ };
33
+ //# sourceMappingURL=cover-story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cover-story.js","sourceRoot":"","sources":["../../src/templates/cover-story.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEnE,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,sCAAsC,CAAC;I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AK,EAAE,qBAAqB,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,sBAAsB,EAAE;CAC9G,CAAC"}
@@ -27,8 +27,29 @@ export interface TemplateKind<D extends z.ZodObject = z.ZodObject> {
27
27
  firstBeatAtStart?: true;
28
28
  /** It fills the frame at medium, so large draws as medium, and says so (#1128). */
29
29
  fillsFrame?: true;
30
+ /** A full frame the presenter stands in front of, cut out of the take, instead of one that hides them (#1428). */
31
+ cutout?: true;
30
32
  /** Media fields, each `{ asset_id }`, and what each takes; they pin as `<id>.<slot>` (A1). */
31
33
  slots: Readonly<Record<string, TemplateSlot>>;
34
+ /** The most media it pins, where a slot sits in each element of a list; absent is one per slot. */
35
+ maxMedia?: number;
36
+ /** The formats it is drawn in; absent is every format. */
37
+ aspects?: readonly string[];
38
+ /** Its own beat frames from each beat's spoken frame (none for a beat without a quote) and its span, with what they move; `frames` when it
39
+ * runs on past its span, never past `most` (#1425). */
40
+ timing?(data: z.infer<D>, beats: readonly (number | undefined)[], duration: number, fps: number, id: string, most: number): {
41
+ moments: number[];
42
+ warnings: string[];
43
+ frames?: number;
44
+ };
45
+ /** Refusals its data earns in this run beyond its schema: the script's language, whether it covers the script's last words. */
46
+ check?(data: z.infer<D>, context: {
47
+ language: string;
48
+ endsScript: boolean;
49
+ }): {
50
+ path: (string | number)[];
51
+ message: string;
52
+ }[];
32
53
  /** Whether captions are hidden while it shows: it sits in the caption spot. */
33
54
  hidesCaptions(data: z.infer<D>): boolean;
34
55
  /** Drawn on full-frame insert frames too; other over-presenter kinds step aside there. */
@@ -43,7 +64,10 @@ export interface TemplateKind<D extends z.ZodObject = z.ZodObject> {
43
64
  sample: z.infer<D>;
44
65
  }
45
66
  export declare const TEMPLATE_KINDS: readonly TemplateKind[];
46
- export declare const TEMPLATE_KIND_IDS: readonly ["tag", "lower_third", "end_card", "title_card", "quote", "stat", "callout", "checklist", "phone_call", "compare", "notification", "progress", "rating", "chat_window", "video_grid", "word_title", "phone_screen", "terminal", "pointer_chips", "chart", "race", "hand_title", "word_fill"];
67
+ export declare const TEMPLATE_KIND_IDS: readonly ["tag", "lower_third", "end_card", "title_card", "quote", "stat", "callout", "checklist", "phone_call", "compare", "notification", "progress", "rating", "chat_window", "video_grid", "word_title", "phone_screen", "terminal", "pointer_chips", "chart", "race", "hand_title", "word_fill", "cover_story", "series_frame", "comment_cta", "backdrop"];
68
+ /** The kinds a request may name today: every kind whose switch is on, and a kind that cuts the presenter out only while that is on (#1428).
69
+ * The catalog, the tool's kind list and admission read it. */
70
+ export declare function offeredTemplateKinds(env?: Record<string, string | undefined>, kinds?: readonly TemplateKind[]): readonly TemplateKind[];
47
71
  /** Earlier versions of kinds a frozen timeline may still name, each with its own footprint (A8, #819). The phone's version 2 (#857 S5) and the
48
72
  * five kinds' version 2 (#1119) only add optional fields, and compare's version 3 (#1159) one reveal, so earlier versions keep their geometry. */
49
73
  export declare const TEMPLATE_KIND_HISTORY: readonly TemplateKind[];
@@ -73,6 +97,9 @@ export { CHART_EMS, CHART_TYPES, chartEms } from "./chart.js";
73
97
  export { RACE_EMS, raceEms } from "./race.js";
74
98
  export { HAND_MARKS, HAND_TITLE_EMS } from "./hand-title.js";
75
99
  export { WORD_FILL_EMS } from "./word-fill.js";
100
+ export { BACKDROP_NOTES_STYLES, BACKDROP_PICTURE_STYLES, BACKDROP_STYLES, type BackdropStyle } from "./backdrop.js";
101
+ export { isSeriesFrameEnabled, SERIES_ASPECT, SERIES_FRAME_DISABLED_MESSAGE, SERIES_ITEM_FLOOR_SEC, SERIES_ITEM_LOOKS, SERIES_ITEMS, SERIES_LOOP_FRAMES, SERIES_MAX_FRAMES, SERIES_ONE_COLUMN_MAX, seriesFitWarnings, seriesFrameMoments, seriesLeastFrames } from "./series-frame.js";
102
+ export { COMMENT_CTA_DISABLED_MESSAGE, commentCtaActLines, commentCtaMoments, commentCtaSchedule, CTA_ASPECT, CTA_FUNNEL, CTA_ITEMS, CTA_LABELS, CTA_LINE_GAP, CTA_LINES, CTA_LOOP_FRAMES, isCommentCtaEnabled } from "./comment-cta.js";
76
103
  export { templateMedia, type TemplateSlot } from "./slot.js";
77
104
  /** Every value at a dotted path of a kind's data, one per element where the path crosses or ends in a list, with its own path; an absent last
78
105
  * field is listed, a path through an absent object or list lists nothing. */
@@ -110,10 +137,28 @@ export declare function templateMoments(kind: TemplateKind, data: unknown, token
110
137
  }[], fps: number, span: {
111
138
  startFrame: number;
112
139
  endFrame: number;
113
- }, id?: string): {
140
+ }, id?: string, most?: number): {
114
141
  moments: number[];
115
142
  warnings: string[];
143
+ frames?: number;
116
144
  };
145
+ /** Kinds that run on past their words and, at the video's end, hold its last frame until they have played (#1452, #1457). */
146
+ export declare const HOLDING_TEMPLATE_KINDS: readonly string[];
147
+ /** What the video's held frame lets a template finish, as the line naming the video's new length says it. */
148
+ export declare function heldTemplateReason(template: {
149
+ id: string;
150
+ kind: string;
151
+ data: unknown;
152
+ }): string;
153
+ /** Before payment (#1457): a call to action whose acts take longer than its sentence, by the script's pace, is named with the time it runs on. */
154
+ export declare function commentCtaFitWarnings(input: {
155
+ script?: unknown;
156
+ templates?: unknown;
157
+ pause_trim?: unknown;
158
+ }): string[];
159
+ /** The most moments and pins one frozen template holds: the largest any kind, current or in a frozen timeline's history, admits (#1425 T6). */
160
+ export declare const MAX_MOMENTS_PER_TEMPLATE: number;
161
+ export declare const MAX_MEDIA_PER_TEMPLATE: number;
117
162
  /** The most pins a run's templates take: each template's slots. */
118
163
  export declare const MAX_TEMPLATE_MEDIA: number;
119
164
  /** Every way a kind draws: each placement with its sample, then each value of each enum field over the sample at its first placement;
@@ -132,6 +177,7 @@ export declare function templateMediaOf(templates: readonly {
132
177
  index: number;
133
178
  id: string;
134
179
  slot: string;
180
+ path?: string;
135
181
  asset_id: string;
136
182
  media_type: "image" | "video";
137
183
  cover?: number | undefined;
@@ -187,6 +233,7 @@ export interface TemplateCheckInput {
187
233
  script?: string | undefined;
188
234
  segments?: unknown;
189
235
  aspect_ratio?: string | undefined;
236
+ image?: unknown;
190
237
  presenter_framing?: PresenterFraming | undefined;
191
238
  actor_id?: string | undefined;
192
239
  inserts?: readonly (AnchoredItem & {
@@ -210,6 +257,10 @@ export interface TemplateCheckInput {
210
257
  caption_position?: LayerCheckInput["caption_position"];
211
258
  caption_place?: LayerCheckInput["caption_place"];
212
259
  presenter_place?: LayerCheckInput["presenter_place"];
260
+ framing?: unknown;
261
+ interview?: unknown;
262
+ presenter_gaze?: unknown;
263
+ end_hold_s?: unknown;
213
264
  }
214
265
  /** Every refusal of `templates`, `template_theme` and `template_sounds` against the run, named by path; empty when they render (D4, D5, D6, D8, D10, A5, A6). */
215
266
  export declare function templateRefusals(input: TemplateCheckInput, kinds?: readonly TemplateKind[]): LayerRefusal[];
@@ -7,6 +7,9 @@ import { callout } from "./callout.js";
7
7
  import { chatWindow, chatWindowV1 } from "./chat-window.js";
8
8
  import { checklist } from "./checklist.js";
9
9
  import { compare, compareV1, compareV2 } from "./compare.js";
10
+ import { backdrop } from "./backdrop.js";
11
+ import { coverStory } from "./cover-story.js";
12
+ import { isPresenterMatteEnabled } from "../presenter-matte.js";
10
13
  import { endCard } from "./end-card.js";
11
14
  import { lowerThird, lowerThirdV1 } from "./lower-third.js";
12
15
  import { notification, notificationV1 } from "./notification.js";
@@ -16,6 +19,10 @@ import { pointerChips } from "./pointer-chips.js";
16
19
  import { chart } from "./chart.js";
17
20
  import { handTitle } from "./hand-title.js";
18
21
  import { race } from "./race.js";
22
+ import { CANVAS_FPS } from "../media-timebase.js";
23
+ import { estimateWordsPerSecond, PAUSE_TRIM_PACE_FACTOR } from "../pacing.js";
24
+ import { isSeriesFrameEnabled, SERIES_FRAME_DISABLED_MESSAGE, SERIES_MAX_FRAMES, seriesFrame } from "./series-frame.js";
25
+ import { COMMENT_CTA_DISABLED_MESSAGE, commentCta, isCommentCtaEnabled } from "./comment-cta.js";
19
26
  import { progress } from "./progress.js";
20
27
  import { quote } from "./quote.js";
21
28
  import { rating } from "./rating.js";
@@ -32,10 +39,21 @@ export const TEMPLATE_PLACEMENTS = ["over", "full"];
32
39
  export const MAX_TEMPLATES = 40;
33
40
  export { contrastRatio, DEFAULT_TEMPLATE_PRESET, TEMPLATE_MIN_CONTRAST, TEMPLATE_PRESET_SURFACES, TEMPLATE_PRESETS, templateAccentRefusal, templateTheme } from "./theme.js";
34
41
  export const TEMPLATE_KINDS = [tag, lowerThird, endCard, titleCard, quote, stat, callout, checklist, phoneCall, compare,
35
- notification, progress, rating, chatWindow, videoGrid, wordTitle, phoneScreen, terminal, pointerChips, chart, race, handTitle, wordFill];
42
+ notification, progress, rating, chatWindow, videoGrid, wordTitle, phoneScreen, terminal, pointerChips, chart, race, handTitle, wordFill,
43
+ coverStory, seriesFrame, commentCta, backdrop];
36
44
  export const TEMPLATE_KIND_IDS = ["tag", "lower_third", "end_card", "title_card", "quote", "stat", "callout", "checklist", "phone_call", "compare",
37
45
  "notification", "progress", "rating", "chat_window", "video_grid", "word_title", "phone_screen", "terminal", "pointer_chips", "chart", "race",
38
- "hand_title", "word_fill"];
46
+ "hand_title", "word_fill", "cover_story", "series_frame", "comment_cta", "backdrop"];
47
+ /** Kinds behind a switch, each with the reason it is refused while off. */
48
+ const SWITCHED_KINDS = {
49
+ series_frame: { on: isSeriesFrameEnabled, off: SERIES_FRAME_DISABLED_MESSAGE },
50
+ comment_cta: { on: isCommentCtaEnabled, off: COMMENT_CTA_DISABLED_MESSAGE },
51
+ };
52
+ /** The kinds a request may name today: every kind whose switch is on, and a kind that cuts the presenter out only while that is on (#1428).
53
+ * The catalog, the tool's kind list and admission read it. */
54
+ export function offeredTemplateKinds(env, kinds = TEMPLATE_KINDS) {
55
+ return kinds.filter(kind => (SWITCHED_KINDS[kind.kind]?.on(env) ?? true) && (!kind.cutout || isPresenterMatteEnabled(env)));
56
+ }
39
57
  /** Earlier versions of kinds a frozen timeline may still name, each with its own footprint (A8, #819). The phone's version 2 (#857 S5) and the
40
58
  * five kinds' version 2 (#1119) only add optional fields, and compare's version 3 (#1159) one reveal, so earlier versions keep their geometry. */
41
59
  export const TEMPLATE_KIND_HISTORY = [{ ...phoneCall, kindVersion: 1 },
@@ -76,6 +94,9 @@ export { CHART_EMS, CHART_TYPES, chartEms } from "./chart.js";
76
94
  export { RACE_EMS, raceEms } from "./race.js";
77
95
  export { HAND_MARKS, HAND_TITLE_EMS } from "./hand-title.js";
78
96
  export { WORD_FILL_EMS } from "./word-fill.js";
97
+ export { BACKDROP_NOTES_STYLES, BACKDROP_PICTURE_STYLES, BACKDROP_STYLES } from "./backdrop.js";
98
+ export { isSeriesFrameEnabled, SERIES_ASPECT, SERIES_FRAME_DISABLED_MESSAGE, SERIES_ITEM_FLOOR_SEC, SERIES_ITEM_LOOKS, SERIES_ITEMS, SERIES_LOOP_FRAMES, SERIES_MAX_FRAMES, SERIES_ONE_COLUMN_MAX, seriesFitWarnings, seriesFrameMoments, seriesLeastFrames } from "./series-frame.js";
99
+ export { COMMENT_CTA_DISABLED_MESSAGE, commentCtaActLines, commentCtaMoments, commentCtaSchedule, CTA_ASPECT, CTA_FUNNEL, CTA_ITEMS, CTA_LABELS, CTA_LINE_GAP, CTA_LINES, CTA_LOOP_FRAMES, isCommentCtaEnabled } from "./comment-cta.js";
79
100
  export { templateMedia } from "./slot.js";
80
101
  /** Every value at a dotted path of a kind's data, one per element where the path crosses or ends in a list, with its own path; an absent last
81
102
  * field is listed, a path through an absent object or list lists nothing. */
@@ -143,9 +164,25 @@ export function templateLeadFrames(kind, data, tokens, range, words, fps, span)
143
164
  export const TEMPLATE_BEAT_GAP = 6;
144
165
  /** Each beat's frame from the template's start, frozen in the timeline; the renderer reads frames only (D11). A beat spoken before the kind's
145
166
  * `beatsFrom` moves there, the beats after it keep `TEMPLATE_BEAT_GAP`, and each move is a warning. */
146
- export function templateMoments(kind, data, tokens, range, words, fps, span, id = "template") {
167
+ export function templateMoments(kind, data, tokens, range, words, fps, span, id = "template", most = span.endFrame) {
147
168
  const lexical = words.filter(word => !/^\p{P}+$/u.test(word.word)), duration = span.endFrame - span.startFrame;
148
169
  const beats = templateMomentWords(kind, data, tokens, range), from = kind.beatsFrom ?? TEMPLATE_ENTER_FRAMES + 1, warnings = [];
170
+ // The composition refuses a beat outside its template, and with it every template (#1425): such a template is refused here, at the freeze.
171
+ // A kind that runs on past its span (`frames`) stays within `most`, the last frame the freeze lets it reach.
172
+ const inside = (result) => {
173
+ const length = result.frames ?? duration;
174
+ if (!Number.isSafeInteger(length) || length < duration || span.startFrame + length > Math.max(most, span.endFrame) ||
175
+ result.moments.some(moment => !Number.isSafeInteger(moment) || moment < 0 || moment >= length))
176
+ throw new Error("a beat lies outside the template's frames");
177
+ return result;
178
+ };
179
+ if (kind.timing) {
180
+ for (const beat of beats)
181
+ if (beat.refusal)
182
+ throw new Error(`template beat ${beat.path.join(".")} ${beat.refusal}`);
183
+ return inside(kind.timing(data, beats.map(beat => (beat.word === undefined ? undefined
184
+ : Math.max(0, Math.round(lexical[beat.word].startSec * fps) - span.startFrame))), duration, fps, id, Math.max(most, span.endFrame) - span.startFrame));
185
+ }
149
186
  let before;
150
187
  const moments = beats.map((beat, index) => {
151
188
  if (beat.refusal)
@@ -168,10 +205,72 @@ export function templateMoments(kind, data, tokens, range, words, fps, span, id
168
205
  }
169
206
  return moved;
170
207
  });
171
- return { moments, warnings };
208
+ return inside({ moments, warnings });
209
+ }
210
+ /** Kinds that run on past their words and, at the video's end, hold its last frame until they have played (#1452, #1457). */
211
+ export const HOLDING_TEMPLATE_KINDS = ["series_frame", "comment_cta"];
212
+ /** What the video's held frame lets a template finish, as the line naming the video's new length says it. */
213
+ export function heldTemplateReason(template) {
214
+ return template.kind === "comment_cta" ? `every act of template "${template.id}" plays, the follow button tapped`
215
+ : `all ${template.data.items.length} items of template "${template.id}" show`;
216
+ }
217
+ /** Before payment (#1457): a call to action whose acts take longer than its sentence, by the script's pace, is named with the time it runs on. */
218
+ export function commentCtaFitWarnings(input) {
219
+ if (typeof input.script !== "string" || !Array.isArray(input.templates))
220
+ return [];
221
+ const tokens = lexicalTokens(input.script), trimmed = typeof input.pause_trim === "object" && input.pause_trim !== null;
222
+ const pace = estimateWordsPerSecond(input.script) * (trimmed ? PAUSE_TRIM_PACE_FACTOR : 1);
223
+ const words = tokens.map((word, at) => ({ word, startSec: at / pace }));
224
+ return input.templates.flatMap(item => {
225
+ const data = item.kind === "comment_cta" && item.anchor ? commentCta.data.safeParse(item.data).data : undefined;
226
+ const range = data ? layerWordRange(tokens, item) : undefined, id = String(item.id);
227
+ if (!data || range === undefined || typeof range === "string")
228
+ return [];
229
+ const span = { startFrame: Math.round((range.startWord / pace) * CANVAS_FPS), endFrame: Math.round((range.coverWord / pace) * CANVAS_FPS) };
230
+ let frames;
231
+ try {
232
+ frames = templateMoments(commentCta, data, tokens, range, words, CANVAS_FPS, span, id, span.endFrame + SERIES_MAX_FRAMES).frames;
233
+ }
234
+ catch {
235
+ return [];
236
+ }
237
+ if (frames === undefined)
238
+ return [];
239
+ const spoken = (span.endFrame - span.startFrame) / CANVAS_FPS, more = ((frames - span.endFrame + span.startFrame) / CANVAS_FPS).toFixed(1);
240
+ return [`template "${id}": its sentence gives about ${spoken.toFixed(1)} s and its comment, message and follow need about ${more} s more; ` +
241
+ `${range.coverWord >= tokens.length ? `the video runs ${more} s past its last word so ${heldTemplateReason({ id, kind: "comment_cta", data })}`
242
+ : "the call to action will run on past it and the next template starts later"}; lengthen the sentence to keep the call to action on it`];
243
+ });
172
244
  }
245
+ /** The most values a dotted path of a kind's data holds: each list it crosses or ends in multiplies by its most elements. */
246
+ function mostValuesAt(schema, keys) {
247
+ const def = schema._zod.def;
248
+ if (def.type === "optional")
249
+ return mostValuesAt(def.innerType, keys);
250
+ if (def.type === "array") {
251
+ const { maxItems } = z.toJSONSchema(schema, { unrepresentable: "any" });
252
+ if (maxItems === undefined)
253
+ throw new Error(`a template list has no most length (${keys.join(".")})`);
254
+ return maxItems * mostValuesAt(def.element, keys);
255
+ }
256
+ if (!keys.length)
257
+ return 1;
258
+ const [key, ...rest] = keys, inner = def.type === "object" ? schema.shape[key] : undefined;
259
+ if (!inner)
260
+ throw new Error(`a template quote names no field ${keys.join(".")}`);
261
+ return mostValuesAt(inner, rest);
262
+ }
263
+ /** The most beats a kind freezes, as `templateMomentWords` lists them: every value of its quotes, or each element of its spread list. */
264
+ function mostBeatsOf(kind) {
265
+ const at = (field) => mostValuesAt(kind.data, field.split("."));
266
+ return Math.max(kind.spreads ? at(kind.spreads) : 0, (kind.quotes ?? []).reduce((sum, field) => sum + at(field), 0));
267
+ }
268
+ const FROZEN_KINDS = [...TEMPLATE_KINDS, ...TEMPLATE_KIND_HISTORY];
269
+ /** The most moments and pins one frozen template holds: the largest any kind, current or in a frozen timeline's history, admits (#1425 T6). */
270
+ export const MAX_MOMENTS_PER_TEMPLATE = Math.max(1, ...FROZEN_KINDS.map(mostBeatsOf));
271
+ export const MAX_MEDIA_PER_TEMPLATE = Math.max(1, ...FROZEN_KINDS.map(kind => kind.maxMedia ?? Object.keys(kind.slots).length));
173
272
  /** The most pins a run's templates take: each template's slots. */
174
- export const MAX_TEMPLATE_MEDIA = MAX_TEMPLATES * Math.max(...TEMPLATE_KINDS.map(kind => Object.keys(kind.slots).length));
273
+ export const MAX_TEMPLATE_MEDIA = MAX_TEMPLATES * MAX_MEDIA_PER_TEMPLATE;
175
274
  /** Every way a kind draws: each placement with its sample, then each value of each enum field over the sample at its first placement;
176
275
  * the composition declares motion phases for each, and the media test checks them. */
177
276
  export function templateVariants(kind) {
@@ -185,10 +284,12 @@ export function templateVariants(kind) {
185
284
  }
186
285
  /** Every media slot the templates fill, in item then slot order: what admission pins and every source walker reads (#778 S3a(ii)). */
187
286
  export function templateMediaOf(templates) {
188
- return (templates ?? []).flatMap((item, index) => Object.entries(TEMPLATE_KINDS.find(kind => kind.kind === item.kind)?.slots ?? {}).flatMap(([slot, takes]) => {
189
- const media = item.data[slot];
190
- return typeof media?.asset_id === "string" ? [{ index, id: item.id, slot, asset_id: media.asset_id, media_type: takes.type, cover: takes.cover }] : [];
191
- }));
287
+ // A slot inside each element of a list (`items.clip`) pins once per element, as `items_0_clip`: a slot name has no dots (A1).
288
+ return (templates ?? []).flatMap((item, index) => Object.entries(TEMPLATE_KINDS.find(kind => kind.kind === item.kind)?.slots ?? {}).flatMap(([slot, takes]) => templateFieldValues(item.data, slot).flatMap(({ path, value }) => {
289
+ const media = value;
290
+ return typeof media?.asset_id === "string" ? [{ index, id: item.id, slot: path.join("_"), ...(path.length > 1 ? { path: path.join(".") } : {}),
291
+ asset_id: media.asset_id, media_type: takes.type, cover: takes.cover }] : [];
292
+ })));
192
293
  }
193
294
  const RANGES = (pairs) => pairs.flatMap((value, index) => (index % 2 ? [] : [[value, pairs[index + 1]]]));
194
295
  /** Latin letters every face draws: ASCII, Latin-1 and Latin Extended-A/B; Vietnamese adds its own block. */
@@ -310,7 +411,7 @@ export function templateDataText(kind) {
310
411
  return Object.entries(kind.data.shape).map(([key, schema]) => catalogField(kind, key, schema)).join(", ");
311
412
  }
312
413
  /** The `templates` description: the gate, the text rules and one catalog line per kind, all from the registry. */
313
- export function templateCatalogText(kinds = TEMPLATE_KINDS) {
414
+ export function templateCatalogText(kinds = offeredTemplateKinds()) {
314
415
  return "Graphic templates, each { id, kind, anchor, cover_words?, placement?, transition?, data }. On any script run. Templates never " +
315
416
  "change the price: every run is billed by its parts as list_prices states them, and a presenter a template covers is still " +
316
417
  "presenter time. Ids are unique across inserts, overlays, layout_windows " +
@@ -321,6 +422,7 @@ export function templateCatalogText(kinds = TEMPLATE_KINDS) {
321
422
  "is spread evenly. A beat spoken before its template has entered moves just after the enter, with a warning. A template that meets the caption band hides captions while it shows; one elsewhere, such as a small one at the top, " +
322
423
  "leaves them. A full-frame template also hides the presenter, overlays " +
323
424
  "and over-presenter templates while it shows, never meets a wipe or zoom insert, and the covered presenter is billed. " +
425
+ kinds.filter(kind => kind.cutout).map(kind => `A ${kind.kind} keeps the presenter in front of it, drawn as a full frame otherwise. `).join("") +
324
426
  `At most ${MAX_OVERLAYS_AT_ONCE} overlays and over-presenter templates show at once, on footprints that do not ` +
325
427
  "overlap. template_theme sets the look of them all. Kinds: " +
326
428
  kinds.map(kind => `${kind.kind} (${kind.placements.join("|")}): ${kind.description}; data ${templateDataText(kind)}`).join(". ") + ".";
@@ -329,6 +431,8 @@ const overlaps = (a, b) => a.startWord < b.coverWord && b.startWord < a.coverWor
329
431
  const meets = (a, b) => a.coverWord === b.startWord || b.coverWord === a.startWord;
330
432
  const coveredBy = (range, cover) => Array.from({ length: range.coverWord - range.startWord }, (_, offset) => range.startWord + offset).every(word => cover.some(other => word >= other.startWord && word < other.coverWord));
331
433
  const MOVING = new Set(["wipe", "zoom"]);
434
+ /** The fields that make a run more than one plain take: a kind that cuts the presenter out of the take draws on a plain take only (#1428). */
435
+ const MORE_THAN_A_TAKE = ["inserts", "overlays", "layout_windows", "framing", "call", "interview", "presenter_gaze", "end_hold_s", "shots"];
332
436
  /** Every refusal of `templates`, `template_theme` and `template_sounds` against the run, named by path; empty when they render (D4, D5, D6, D8, D10, A5, A6). */
333
437
  export function templateRefusals(input, kinds = TEMPLATE_KINDS) {
334
438
  if (input.templates === undefined) {
@@ -386,9 +490,19 @@ export function templateRefusals(input, kinds = TEMPLATE_KINDS) {
386
490
  used.set(item.id, "templates");
387
491
  const kind = kinds.find(entry => entry.kind === item.kind);
388
492
  if (!kind) {
389
- refusals.push({ path: at("kind"), message: `unknown template kind "${item.kind}": use one of ${kinds.map(entry => entry.kind).join(", ")}` });
493
+ refusals.push({ path: at("kind"), message: `unknown template kind "${item.kind}": use one of ${offeredTemplateKinds(undefined, kinds).map(entry => entry.kind).join(", ")}` });
494
+ continue;
495
+ }
496
+ const switched = SWITCHED_KINDS[kind.kind];
497
+ if (switched && !switched.on()) {
498
+ refusals.push({ path: at("kind"), message: switched.off });
390
499
  continue;
391
500
  }
501
+ // A kind drawn in one format is refused in any other before money, never moved to it (rule 4); with an image the format follows the image.
502
+ if (kind.aspects && (input.aspect_ratio === undefined ? input.image !== undefined : !kind.aspects.includes(input.aspect_ratio))) {
503
+ refusals.push({ path: input.aspect_ratio === undefined ? at("kind") : ["aspect_ratio"], message: `${kind.kind} is drawn in ${kind.aspects.join(" or ")} only: ` +
504
+ `pass aspect_ratio ${kind.aspects[0]}${input.aspect_ratio === undefined ? " with image" : ""}, or use another template kind` });
505
+ }
392
506
  const parsed = kind.data.safeParse(item.data);
393
507
  if (!parsed.success) {
394
508
  for (const issue of parsed.error.issues)
@@ -396,6 +510,9 @@ export function templateRefusals(input, kinds = TEMPLATE_KINDS) {
396
510
  continue;
397
511
  }
398
512
  const placement = item.placement ?? kind.placements[0];
513
+ const beyond = kind.cutout ? MORE_THAN_A_TAKE.filter(field => input[field] !== undefined) : [];
514
+ if (beyond.length)
515
+ refusals.push({ path: at("kind"), message: `${item.kind} takes a plain script run, without ${beyond.join(", ")}` });
399
516
  if (!kind.placements.includes(placement))
400
517
  refusals.push({ path: at("placement"), message: `${item.kind} takes placement ${kind.placements.join(" or ")}, not ${placement}` });
401
518
  if (item.transition !== undefined && placement !== "full")
@@ -411,6 +528,9 @@ export function templateRefusals(input, kinds = TEMPLATE_KINDS) {
411
528
  refusals.push({ path: at("anchor"), message: `template "${item.id}": ${range}` });
412
529
  continue;
413
530
  }
531
+ for (const why of kind.check?.(parsed.data, { language, endsScript: range.coverWord >= tokens.length }) ?? []) {
532
+ refusals.push({ path: at("data", ...why.path), message: why.message });
533
+ }
414
534
  const beats = templateMomentWords(kind, parsed.data, tokens, range);
415
535
  for (const beat of beats)
416
536
  if (beat.refusal)