@nodaro/shared 3.64.0 → 3.65.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 (205) hide show
  1. package/dist/{chunk-PJJAZQVZ.js → chunk-222QM7CO.js} +3 -3
  2. package/dist/{chunk-PJJAZQVZ.js.map → chunk-222QM7CO.js.map} +1 -1
  3. package/dist/chunk-27HA6YOL.cjs +377 -0
  4. package/dist/chunk-27HA6YOL.cjs.map +1 -0
  5. package/dist/{chunk-TTGZ2L3O.js → chunk-2NKF476Z.js} +3 -3
  6. package/dist/{chunk-TTGZ2L3O.js.map → chunk-2NKF476Z.js.map} +1 -1
  7. package/dist/chunk-3AU52TSW.js +143 -0
  8. package/dist/chunk-3AU52TSW.js.map +1 -0
  9. package/dist/{chunk-7AJGUI7L.cjs → chunk-5NVGKXJV.cjs} +34 -17
  10. package/dist/chunk-5NVGKXJV.cjs.map +1 -0
  11. package/dist/{chunk-3AYM47GW.js → chunk-5SSMPYE5.js} +99 -9
  12. package/dist/chunk-5SSMPYE5.js.map +1 -0
  13. package/dist/{chunk-KHH54GRP.cjs → chunk-6ET3KDO4.cjs} +15 -338
  14. package/dist/chunk-6ET3KDO4.cjs.map +1 -0
  15. package/dist/{chunk-ACZZHHFZ.cjs → chunk-6OSIOVF7.cjs} +44 -22
  16. package/dist/chunk-6OSIOVF7.cjs.map +1 -0
  17. package/dist/{chunk-OBOOHG3N.js → chunk-6X5PBAC4.js} +3 -3
  18. package/dist/{chunk-OBOOHG3N.js.map → chunk-6X5PBAC4.js.map} +1 -1
  19. package/dist/chunk-7BN4EDIC.cjs +185 -0
  20. package/dist/chunk-7BN4EDIC.cjs.map +1 -0
  21. package/dist/{chunk-IYSOVS7O.js → chunk-7OWXHW7Z.js} +31 -13
  22. package/dist/chunk-7OWXHW7Z.js.map +1 -0
  23. package/dist/{chunk-ZI3QDUHO.js → chunk-AT53ZQUC.js} +3 -3
  24. package/dist/{chunk-ZI3QDUHO.js.map → chunk-AT53ZQUC.js.map} +1 -1
  25. package/dist/{chunk-SHH2T4CR.js → chunk-BSTAAGLY.js} +3 -3
  26. package/dist/{chunk-SHH2T4CR.js.map → chunk-BSTAAGLY.js.map} +1 -1
  27. package/dist/{chunk-DZ4IOP3Q.js → chunk-CW6MMQNO.js} +277 -3
  28. package/dist/chunk-CW6MMQNO.js.map +1 -0
  29. package/dist/{chunk-Q2Y4JHF7.js → chunk-D5Y3EYRM.js} +5 -5
  30. package/dist/{chunk-Q2Y4JHF7.js.map → chunk-D5Y3EYRM.js.map} +1 -1
  31. package/dist/{chunk-EXEVT6D2.cjs → chunk-DQ2PARNH.cjs} +5 -5
  32. package/dist/{chunk-EXEVT6D2.cjs.map → chunk-DQ2PARNH.cjs.map} +1 -1
  33. package/dist/{chunk-OOZW2MM6.cjs → chunk-E66HSC2E.cjs} +9 -9
  34. package/dist/{chunk-OOZW2MM6.cjs.map → chunk-E66HSC2E.cjs.map} +1 -1
  35. package/dist/{chunk-NIAFR5EE.js → chunk-FGBGKBML.js} +32 -3
  36. package/dist/chunk-FGBGKBML.js.map +1 -0
  37. package/dist/{chunk-5OBTGNUQ.cjs → chunk-FI3HJZWM.cjs} +294 -2
  38. package/dist/chunk-FI3HJZWM.cjs.map +1 -0
  39. package/dist/{chunk-SPAHI7DY.cjs → chunk-FJZTQTF4.cjs} +4 -4
  40. package/dist/{chunk-SPAHI7DY.cjs.map → chunk-FJZTQTF4.cjs.map} +1 -1
  41. package/dist/{chunk-J6B7J73J.cjs → chunk-GJ3D5X4X.cjs} +49 -49
  42. package/dist/{chunk-J6B7J73J.cjs.map → chunk-GJ3D5X4X.cjs.map} +1 -1
  43. package/dist/{chunk-KB2SQAR3.js → chunk-H745DQ6V.js} +3 -3
  44. package/dist/{chunk-KB2SQAR3.js.map → chunk-H745DQ6V.js.map} +1 -1
  45. package/dist/{chunk-7KQ6W5DS.js → chunk-HAH2F7LT.js} +4 -4
  46. package/dist/{chunk-7KQ6W5DS.js.map → chunk-HAH2F7LT.js.map} +1 -1
  47. package/dist/{chunk-HDPJNNMF.cjs → chunk-JQMFJAYU.cjs} +21 -21
  48. package/dist/{chunk-HDPJNNMF.cjs.map → chunk-JQMFJAYU.cjs.map} +1 -1
  49. package/dist/{chunk-D4KWNDPH.cjs → chunk-JYU5EIRM.cjs} +12 -12
  50. package/dist/{chunk-D4KWNDPH.cjs.map → chunk-JYU5EIRM.cjs.map} +1 -1
  51. package/dist/{chunk-AZNZ5WNZ.cjs → chunk-K6RIN3LW.cjs} +142 -45
  52. package/dist/chunk-K6RIN3LW.cjs.map +1 -0
  53. package/dist/{chunk-YQV53HRR.cjs → chunk-KTCEKGBJ.cjs} +7 -7
  54. package/dist/{chunk-YQV53HRR.cjs.map → chunk-KTCEKGBJ.cjs.map} +1 -1
  55. package/dist/{chunk-W6VJAUGM.cjs → chunk-KWYS4IIM.cjs} +83 -37
  56. package/dist/chunk-KWYS4IIM.cjs.map +1 -0
  57. package/dist/{chunk-GTWUS6MQ.cjs → chunk-MIT2USTS.cjs} +61 -61
  58. package/dist/{chunk-GTWUS6MQ.cjs.map → chunk-MIT2USTS.cjs.map} +1 -1
  59. package/dist/{chunk-Y4GCJJPF.cjs → chunk-NYZQOIXJ.cjs} +35 -2
  60. package/dist/chunk-NYZQOIXJ.cjs.map +1 -0
  61. package/dist/{chunk-FHGRKQVZ.cjs → chunk-PGDR7CO3.cjs} +8 -8
  62. package/dist/{chunk-FHGRKQVZ.cjs.map → chunk-PGDR7CO3.cjs.map} +1 -1
  63. package/dist/{chunk-W7KHHNZR.js → chunk-PL7AQQV7.js} +53 -9
  64. package/dist/chunk-PL7AQQV7.js.map +1 -0
  65. package/dist/chunk-Q4YOLT4M.js +164 -0
  66. package/dist/chunk-Q4YOLT4M.js.map +1 -0
  67. package/dist/{chunk-CHS2SIP6.cjs → chunk-R5ILCNCC.cjs} +90 -76
  68. package/dist/chunk-R5ILCNCC.cjs.map +1 -0
  69. package/dist/chunk-RP4KQUNU.cjs +168 -0
  70. package/dist/chunk-RP4KQUNU.cjs.map +1 -0
  71. package/dist/{chunk-CHTZZRAL.cjs → chunk-SPU7MUWE.cjs} +6 -6
  72. package/dist/{chunk-CHTZZRAL.cjs.map → chunk-SPU7MUWE.cjs.map} +1 -1
  73. package/dist/{chunk-VPTA4Z7G.js → chunk-ST7OBB5J.js} +5 -5
  74. package/dist/{chunk-VPTA4Z7G.js.map → chunk-ST7OBB5J.js.map} +1 -1
  75. package/dist/{chunk-TPQJKS7D.js → chunk-V5NLQ4L5.js} +21 -7
  76. package/dist/{chunk-CHS2SIP6.cjs.map → chunk-V5NLQ4L5.js.map} +1 -1
  77. package/dist/{chunk-QYU7J5EQ.js → chunk-V6OXSXIX.js} +29 -18
  78. package/dist/chunk-V6OXSXIX.js.map +1 -0
  79. package/dist/{chunk-T2OVDF2M.cjs → chunk-WQMPIURW.cjs} +6 -6
  80. package/dist/{chunk-T2OVDF2M.cjs.map → chunk-WQMPIURW.cjs.map} +1 -1
  81. package/dist/{chunk-67CMMTLN.cjs → chunk-WZG6GZIL.cjs} +4 -4
  82. package/dist/{chunk-67CMMTLN.cjs.map → chunk-WZG6GZIL.cjs.map} +1 -1
  83. package/dist/{chunk-36VWLB4J.js → chunk-XJANKTIL.js} +3 -3
  84. package/dist/{chunk-36VWLB4J.js.map → chunk-XJANKTIL.js.map} +1 -1
  85. package/dist/{chunk-O7RZRUMZ.js → chunk-XJWED257.js} +14 -309
  86. package/dist/chunk-XJWED257.js.map +1 -0
  87. package/dist/chunk-XSSLNINL.js +346 -0
  88. package/dist/chunk-XSSLNINL.js.map +1 -0
  89. package/dist/{chunk-O4RPXBDZ.cjs → chunk-YD4XY74W.cjs} +8 -8
  90. package/dist/{chunk-O4RPXBDZ.cjs.map → chunk-YD4XY74W.cjs.map} +1 -1
  91. package/dist/{chunk-SXHHLZ22.js → chunk-YMZUE2IX.js} +9 -9
  92. package/dist/{chunk-SXHHLZ22.js.map → chunk-YMZUE2IX.js.map} +1 -1
  93. package/dist/{chunk-4IUE2JB7.js → chunk-Z77M7Q2R.js} +3 -3
  94. package/dist/{chunk-4IUE2JB7.js.map → chunk-Z77M7Q2R.js.map} +1 -1
  95. package/dist/{chunk-3KTWYYCN.js → chunk-ZSRXY5YT.js} +3 -3
  96. package/dist/{chunk-3KTWYYCN.js.map → chunk-ZSRXY5YT.js.map} +1 -1
  97. package/dist/entries/apps.cjs +42 -42
  98. package/dist/entries/apps.js +7 -7
  99. package/dist/entries/captions.d.cts +1 -1
  100. package/dist/entries/captions.d.ts +1 -1
  101. package/dist/entries/credits.cjs +230 -214
  102. package/dist/entries/credits.d.cts +51 -14
  103. package/dist/entries/credits.d.ts +51 -14
  104. package/dist/entries/credits.js +10 -10
  105. package/dist/entries/entities.cjs +202 -193
  106. package/dist/entries/entities.d.cts +44 -9
  107. package/dist/entries/entities.d.ts +44 -9
  108. package/dist/entries/entities.js +2 -1
  109. package/dist/entries/llm-models.cjs +86 -62
  110. package/dist/entries/llm-models.d.cts +46 -15
  111. package/dist/entries/llm-models.d.ts +46 -15
  112. package/dist/entries/llm-models.js +2 -2
  113. package/dist/entries/media.cjs +79 -63
  114. package/dist/entries/media.d.cts +154 -1
  115. package/dist/entries/media.d.ts +154 -1
  116. package/dist/entries/media.js +1 -1
  117. package/dist/entries/model-catalog.cjs +175 -119
  118. package/dist/entries/model-catalog.d.cts +4 -54
  119. package/dist/entries/model-catalog.d.ts +4 -54
  120. package/dist/entries/model-catalog.js +4 -4
  121. package/dist/entries/models.cjs +491 -358
  122. package/dist/entries/models.d.cts +86 -7
  123. package/dist/entries/models.d.ts +86 -7
  124. package/dist/entries/models.js +6 -5
  125. package/dist/entries/nodes.cjs +212 -212
  126. package/dist/entries/nodes.d.cts +1 -1
  127. package/dist/entries/nodes.d.ts +1 -1
  128. package/dist/entries/nodes.js +8 -8
  129. package/dist/entries/pipeline.cjs +153 -153
  130. package/dist/entries/pipeline.d.cts +3 -3
  131. package/dist/entries/pipeline.d.ts +3 -3
  132. package/dist/entries/pipeline.js +3 -3
  133. package/dist/entries/social.cjs +177 -177
  134. package/dist/entries/social.js +2 -2
  135. package/dist/entries/ugc.cjs +71 -71
  136. package/dist/entries/ugc.js +4 -4
  137. package/dist/entries/video.cjs +174 -145
  138. package/dist/entries/video.d.cts +114 -2
  139. package/dist/entries/video.d.ts +114 -2
  140. package/dist/entries/video.js +7 -6
  141. package/dist/entries/workflow.d.cts +1 -1
  142. package/dist/entries/workflow.d.ts +1 -1
  143. package/dist/index.cjs +2074 -1793
  144. package/dist/index.d.cts +10 -9
  145. package/dist/index.d.ts +10 -9
  146. package/dist/index.js +24 -23
  147. package/dist/{model-catalog-Cf9fkEUp.d.ts → model-catalog-BoUKGFNl.d.cts} +167 -1
  148. package/dist/{model-catalog-Cf9fkEUp.d.cts → model-catalog-BoUKGFNl.d.ts} +167 -1
  149. package/dist/{model-constants-BxjiWVQ9.d.ts → model-constants-BElS3AeE.d.ts} +55 -6
  150. package/dist/{model-constants-C_Nyft_i.d.cts → model-constants-CpQz1bGa.d.cts} +55 -6
  151. package/dist/tts-capabilities-BtnDWK9K.d.ts +133 -0
  152. package/dist/tts-capabilities-C52UccTI.d.cts +133 -0
  153. package/package.json +1 -1
  154. package/src/__tests__/dialogue-capabilities.test.ts +167 -6
  155. package/src/__tests__/extend-providers.test.ts +87 -0
  156. package/src/__tests__/kling4-catalog.test.ts +1 -1
  157. package/src/__tests__/llm-models.test.ts +41 -4
  158. package/src/__tests__/speech-pricing.test.ts +62 -1
  159. package/src/__tests__/tts-capabilities.test.ts +160 -4
  160. package/src/__tests__/video-analysis-pricing.test.ts +13 -1
  161. package/src/__tests__/video-subjects.test.ts +192 -0
  162. package/src/__tests__/wired-character-names.test.ts +142 -0
  163. package/src/credit-estimators/index.ts +4 -0
  164. package/src/credit-estimators/speech.ts +57 -9
  165. package/src/credit-identifiers.ts +48 -13
  166. package/src/dialogue-capabilities.ts +220 -3
  167. package/src/dubbing-structure.ts +186 -0
  168. package/src/entries/entities.ts +2 -0
  169. package/src/entries/llm-models.ts +7 -0
  170. package/src/entries/media.ts +3 -1
  171. package/src/entries/model-catalog.ts +17 -0
  172. package/src/entries/models.ts +39 -0
  173. package/src/entries/video.ts +8 -1
  174. package/src/gemini-tts.ts +144 -0
  175. package/src/llm-models.ts +71 -21
  176. package/src/model-catalog.ts +259 -0
  177. package/src/model-constants.ts +101 -8
  178. package/src/tts-capabilities.ts +193 -1
  179. package/src/video-analysis-pricing.ts +11 -0
  180. package/src/video-character-refs.ts +160 -3
  181. package/src/wired-character-names.ts +134 -18
  182. package/src/wired-character-video-subjects.ts +63 -0
  183. package/dist/chunk-3AYM47GW.js.map +0 -1
  184. package/dist/chunk-5OBTGNUQ.cjs.map +0 -1
  185. package/dist/chunk-6YIV37V7.js +0 -31
  186. package/dist/chunk-6YIV37V7.js.map +0 -1
  187. package/dist/chunk-7AJGUI7L.cjs.map +0 -1
  188. package/dist/chunk-ACZZHHFZ.cjs.map +0 -1
  189. package/dist/chunk-AZNZ5WNZ.cjs.map +0 -1
  190. package/dist/chunk-DZ4IOP3Q.js.map +0 -1
  191. package/dist/chunk-IYSOVS7O.js.map +0 -1
  192. package/dist/chunk-KHH54GRP.cjs.map +0 -1
  193. package/dist/chunk-NIAFR5EE.js.map +0 -1
  194. package/dist/chunk-O7RZRUMZ.js.map +0 -1
  195. package/dist/chunk-QYU7J5EQ.js.map +0 -1
  196. package/dist/chunk-S3UGLZSF.js +0 -42
  197. package/dist/chunk-S3UGLZSF.js.map +0 -1
  198. package/dist/chunk-TPQJKS7D.js.map +0 -1
  199. package/dist/chunk-TQW3R44P.cjs +0 -38
  200. package/dist/chunk-TQW3R44P.cjs.map +0 -1
  201. package/dist/chunk-VZ6TE23U.cjs +0 -54
  202. package/dist/chunk-VZ6TE23U.cjs.map +0 -1
  203. package/dist/chunk-W6VJAUGM.cjs.map +0 -1
  204. package/dist/chunk-W7KHHNZR.js.map +0 -1
  205. package/dist/chunk-Y4GCJJPF.cjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkYTXP4VHD_cjs = require('./chunk-YTXP4VHD.cjs');
4
- var chunkCHS2SIP6_cjs = require('./chunk-CHS2SIP6.cjs');
5
- var chunkD4KWNDPH_cjs = require('./chunk-D4KWNDPH.cjs');
4
+ var chunkR5ILCNCC_cjs = require('./chunk-R5ILCNCC.cjs');
5
+ var chunkJYU5EIRM_cjs = require('./chunk-JYU5EIRM.cjs');
6
6
  var chunkV24EPI5N_cjs = require('./chunk-V24EPI5N.cjs');
7
7
 
8
8
  // src/exposed-field-keys.ts
@@ -35,7 +35,7 @@ var descriptor = (d) => Object.freeze({ ...d, creditIds: Object.freeze([...d.cre
35
35
  var RENDER_NODE_TYPES = Object.freeze({
36
36
  "apply-edl": descriptor({
37
37
  mediumOf: outputSettingMedium,
38
- creditId: (quality) => chunkCHS2SIP6_cjs.applyEdlCreditId(quality),
38
+ creditId: (quality) => chunkR5ILCNCC_cjs.applyEdlCreditId(quality),
39
39
  creditIds: ["apply-edl", "apply-edl:proxy"],
40
40
  clockMapFrom: "input",
41
41
  ownerOnlyListing: true,
@@ -50,8 +50,8 @@ var RENDER_NODE_TYPES = Object.freeze({
50
50
  // `transcript` pip (decided 2026-10-08) — what a caption step reads.
51
51
  "speaker-view": descriptor({
52
52
  mediumOf: () => "video",
53
- creditId: (quality, _output, priceTier) => chunkCHS2SIP6_cjs.speakerViewCreditId(quality, priceTier),
54
- creditIds: chunkCHS2SIP6_cjs.SPEAKER_VIEW_CREDIT_IDS,
53
+ creditId: (quality, _output, priceTier) => chunkR5ILCNCC_cjs.speakerViewCreditId(quality, priceTier),
54
+ creditIds: chunkR5ILCNCC_cjs.SPEAKER_VIEW_CREDIT_IDS,
55
55
  clockMapFrom: "output-json",
56
56
  ownerOnlyListing: true,
57
57
  latestBatch: true,
@@ -296,8 +296,8 @@ function getOutputType(nodeType) {
296
296
  if (VIDEO_OUTPUT_TYPES.has(nodeType)) return "video";
297
297
  if (AUDIO_OUTPUT_TYPES.has(nodeType)) return "audio";
298
298
  if (TEXT_OUTPUT_TYPES.has(nodeType)) return "text";
299
- if (chunkD4KWNDPH_cjs.VIDEO_PRODUCER_TYPES.has(nodeType)) return "video";
300
- if (chunkD4KWNDPH_cjs.AUDIO_PRODUCER_TYPES.has(nodeType)) return "audio";
299
+ if (chunkJYU5EIRM_cjs.VIDEO_PRODUCER_TYPES.has(nodeType)) return "video";
300
+ if (chunkJYU5EIRM_cjs.AUDIO_PRODUCER_TYPES.has(nodeType)) return "audio";
301
301
  return "data";
302
302
  }
303
303
  function isMediaProducingType(nodeType) {
@@ -493,5 +493,5 @@ exports.renderTranscriptOutputOf = renderTranscriptOutputOf;
493
493
  exports.rendersLatestBatch = rendersLatestBatch;
494
494
  exports.rendersTranscriptJson = rendersTranscriptJson;
495
495
  exports.validateNoNestedGroups = validateNoNestedGroups;
496
- //# sourceMappingURL=chunk-OOZW2MM6.cjs.map
497
- //# sourceMappingURL=chunk-OOZW2MM6.cjs.map
496
+ //# sourceMappingURL=chunk-E66HSC2E.cjs.map
497
+ //# sourceMappingURL=chunk-E66HSC2E.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/exposed-field-keys.ts","../src/render-nodes.ts","../src/presentation-utils.ts"],"names":["applyEdlCreditId","speakerViewCreditId","SPEAKER_VIEW_CREDIT_IDS","composeUnitSet","unitsPresenting","VIDEO_PRODUCER_TYPES","AUDIO_PRODUCER_TYPES","url","text","dropStaleVideoLinkFields"],"mappings":";;;;;;;;AAiBO,IAAM,yBAAA,GAAwF;AAAA;AAAA;AAAA,EAGnG,gBAAA,EAAkB,EAAE,UAAA,EAAY,iBAAA;AAClC;AAGO,SAAS,wBAAA,CAAyB,UAA8B,GAAA,EAAqB;AAC1F,EAAA,IAAI,OAAO,aAAa,QAAA,IAAY,CAAC,OAAO,MAAA,CAAO,yBAAA,EAA2B,QAAQ,CAAA,EAAG,OAAO,GAAA;AAChG,EAAA,MAAM,OAAA,GAAU,0BAA0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AA,CAAK,SAAS,OAAA,EAAS;AACzB,MAAA,OAAO,EAAE,GAAG,IAAA,EAAM,KAAA,EAAO,mBAAmB,IAAA,CAAK,KAAA,EAAO,OAAO,CAAA,EAAE;AAAA,IACnE;AACA,IAAA,OAAO,IAAA;AAAA,EACT,CAAC,CAAA;AACL","file":"chunk-OOZW2MM6.cjs","sourcesContent":["/**\n * Exposed-field keys that were renamed to the node's real data field.\n *\n * A published app stores which fields it exposes as `{ type: \"field\", nodeId, field }` items in its\n * immutable snapshot settings, and external callers send `inputOverrides[nodeId][field]` with that same\n * string — it is part of the public wire contract (docs/embed-app-guide.md). Renaming a descriptor's key\n * must not strand the apps already published with the old spelling: they keep that string forever, so every\n * place that turns a stored key into a node-data key — or compares it with a descriptor key — goes through\n * `canonicalExposedFieldKey`.\n *\n * CLOSED LIST. A row needs a spelling that was published (a card that existed in apps) and a target the\n * node's descriptor now declares (the frontend guard `exposable-field-keys.test.ts` checks both). Only list a\n * field whose card cannot carry `allowedValues` (slider / toggle / text / color): the server validates\n * `allowedValues` against the stored key (backend routes/app-runner.ts `validateRestrictedFields`). Never list\n * a field of an outbound node type: the run-request override lock (backend lib/input-override-lock.ts) reads\n * the stored key, before this table renames it.\n */\nexport const LEGACY_EXPOSED_FIELD_KEYS: Readonly<Record<string, Readonly<Record<string, string>>>> = {\n // Published as the Text to Speech slider's key. The node's data field, and every runner, route and config\n // panel, has always been `similarityBoost` — so the slider moved nothing.\n \"text-to-speech\": { similarity: \"similarityBoost\" },\n}\n\n/** The node-data key an exposed field's stored key stands for. Unknown node types and keys pass through. */\nexport function canonicalExposedFieldKey(nodeType: string | undefined, key: string): string {\n if (typeof nodeType !== \"string\" || !Object.hasOwn(LEGACY_EXPOSED_FIELD_KEYS, nodeType)) return key\n const renames = LEGACY_EXPOSED_FIELD_KEYS[nodeType]!\n return Object.hasOwn(renames, key) ? renames[key]! : key\n}\n\n/**\n * The override map with every legacy spelling replaced by its current key. When the caller sent both\n * spellings the current one wins (it is their current intent) and the legacy key is dropped — a dead key\n * is never written to node data. Returns the same object when nothing renames; never mutates.\n */\nexport function canonicalizeOverrideKeys(\n nodeType: string | undefined,\n overrides: Record<string, unknown>,\n): Record<string, unknown> {\n let out: Record<string, unknown> | undefined\n for (const key of Object.keys(overrides)) {\n const current = canonicalExposedFieldKey(nodeType, key)\n if (current === key) continue\n out ??= { ...overrides }\n delete out[key]\n if (!Object.hasOwn(overrides, current)) out[current] = overrides[key]\n }\n return out ?? overrides\n}\n","/**\n * The render-node registry (SV18, decided 2026-10-06): every node type that\n * turns an EDL into a finished file, and how each one behaves wherever the\n * platform gives a render its meaning — review and the Preview label, privacy,\n * the latest-batch reader, the owner-only listings, and what its `json` handle\n * carries.\n *\n * ONE registry, read by both engines, the editor, the listings and MCP, so a\n * second render (Speaker View) joins by adding one entry — never by finding\n * every `=== \"apply-edl\"`. The backend census test\n * (`render-node-census.test.ts`) fails a new `apply-edl` literal at any site\n * that is not pure registration of that node.\n *\n * The key is the node type AND the job name: a render's job is never renamed\n * (by quality or otherwise — only its credit id changes), so the same key\n * answers for `node.type` and for `jobs.job_type`.\n */\nimport { applyEdlCreditId, speakerViewCreditId, SPEAKER_VIEW_CREDIT_IDS } from \"./credit-identifiers.js\"\nimport type { RenderMedium } from \"./render-output.js\"\n\n/** Where a render's player maps the output clock back to the master clock\n * from: the EDL it was given (`input_data.edl`), or the EDL it emitted on its\n * `json` output (a render that rewrites its EDL, e.g. by splitting turns). */\nexport type RenderClockSource = \"input\" | \"output-json\"\n\n/** What a render's `json` output handle carries. Only a `transcript` is handed\n * on as one (Add Captions, the word-timing preflight). */\nexport type RenderJsonKind = \"transcript\" | \"edl\"\n\n/** Where a render's wired transcript, remapped through its cut, comes out\n * (Apply EDL's on its `json`; Speaker View's on its own `transcript` pip,\n * decided 2026-10-08). */\nexport interface RenderTranscriptOutput {\n /** The output pip — also the key it rides on the job's `output_data` and on\n * a run's node output. */\n readonly handle: string\n /** The saved node-data field that holds it (the landed take's). */\n readonly dataField: string\n}\n\n/** The pip a render's `json` output (its `jsonKind`) comes out on, and its key\n * on the job's `output_data`. */\nexport const RENDER_JSON_HANDLE = \"json\"\n\nexport interface RenderNodeDescriptor {\n /** The medium the render's order asks for (its node data, or its job's\n * `input_data`) — before any output exists to say. */\n readonly mediumOf: (data: Readonly<Record<string, unknown>>) => RenderMedium\n /** The credit id a render reserves on — a per-OUTPUT-MINUTE row: every\n * render is charged its row × the minutes it renders. Chosen from the\n * render's `quality` and `output` (as its node data or its job's request\n * carries them) and, for a render priced in tiers, the `priceTier` the\n * render rule judged it to be in (Speaker View's, decided 2026-10-10). A\n * tiered render given no tier names its dearer row. */\n readonly creditId: (quality: unknown, output?: unknown, priceTier?: unknown) => string\n /** Every id `creditId` can name (each must have a price row). */\n readonly creditIds: readonly string[]\n readonly clockMapFrom: RenderClockSource\n /** Listed in its owner's own views only, never in a public one (decided\n * 2026-10-06): a Preview is private, and a public final would be exposure\n * nobody decided. */\n readonly ownerOnlyListing: boolean\n /** An `each` wire reads its LATEST batch only, never its accumulated history\n * (TA6, decided 2026-10-04). */\n readonly latestBatch: boolean\n readonly jsonKind: RenderJsonKind\n /** Where its remapped transcript comes out. On the `json` pip exactly when\n * `jsonKind` is `transcript` (a guard test holds the two together). */\n readonly transcriptOutput: RenderTranscriptOutput\n}\n\ntype Data = Readonly<Record<string, unknown>>\n\n/** Its `output` setting, video when absent. */\nconst outputSettingMedium = (data: Data): RenderMedium => (data.output === \"audio\" ? \"audio\" : \"video\")\n\nconst descriptor = (d: RenderNodeDescriptor): RenderNodeDescriptor =>\n Object.freeze({ ...d, creditIds: Object.freeze([...d.creditIds]), transcriptOutput: Object.freeze({ ...d.transcriptOutput }) })\n\nexport const RENDER_NODE_TYPES: Readonly<Record<string, RenderNodeDescriptor>> = Object.freeze({\n \"apply-edl\": descriptor({\n mediumOf: outputSettingMedium,\n creditId: (quality) => applyEdlCreditId(quality),\n creditIds: [\"apply-edl\", \"apply-edl:proxy\"],\n clockMapFrom: \"input\",\n ownerOnlyListing: true,\n latestBatch: true,\n jsonKind: \"transcript\",\n transcriptOutput: { handle: RENDER_JSON_HANDLE, dataField: \"generatedJson\" },\n }),\n // Speaker View (C3.2): video only; its `json` is the EDL as it drew it (the\n // turns split, the layouts written), so a player maps the output clock\n // through THAT, and Add Captions never takes it for a Transcript. The wired\n // transcript, remapped through that same drawn edit, comes out on its own\n // `transcript` pip (decided 2026-10-08) — what a caption step reads.\n \"speaker-view\": descriptor({\n mediumOf: () => \"video\",\n creditId: (quality, _output, priceTier) => speakerViewCreditId(quality, priceTier),\n creditIds: SPEAKER_VIEW_CREDIT_IDS,\n clockMapFrom: \"output-json\",\n ownerOnlyListing: true,\n latestBatch: true,\n jsonKind: \"edl\",\n transcriptOutput: { handle: \"transcript\", dataField: \"generatedTranscript\" },\n }),\n})\n\n/** Every render node type, in registry order. */\nexport const RENDER_NODE_TYPE_IDS: readonly string[] = Object.freeze(Object.keys(RENDER_NODE_TYPES))\n\n/** The descriptor of a render node type (or job name); `undefined` for any\n * other value. Own keys only, so `\"constructor\"` is not a render. */\nexport function renderNodeOf(type: unknown): RenderNodeDescriptor | undefined {\n return typeof type === \"string\" && Object.hasOwn(RENDER_NODE_TYPES, type) ? RENDER_NODE_TYPES[type] : undefined\n}\n\n/** Is this node type (or job name) a render? */\nexport function isRenderNodeType(type: unknown): type is string {\n return renderNodeOf(type) !== undefined\n}\n\n/** Does an `each` wire from this node read its latest batch only? */\nexport function rendersLatestBatch(type: unknown): boolean {\n return renderNodeOf(type)?.latestBatch === true\n}\n\n/** Is this node a render whose `json` output is a Transcript? */\nexport function rendersTranscriptJson(type: unknown): boolean {\n return renderNodeOf(type)?.jsonKind === \"transcript\"\n}\n\n/** Where a render's remapped transcript comes out; `undefined` for any other\n * node type. */\nexport function renderTranscriptOutputOf(type: unknown): RenderTranscriptOutput | undefined {\n return renderNodeOf(type)?.transcriptOutput\n}\n\n/** Is `handle` one of a render's data pips — its `json` or its transcript —\n * rather than its media? Every other pip of a render (the default included)\n * is the rendered media. `false` for any other node type. */\nexport function isRenderDataHandle(type: unknown, handle: unknown): boolean {\n const d = renderNodeOf(type)\n if (!d || typeof handle !== \"string\") return false\n return handle === RENDER_JSON_HANDLE || handle === d.transcriptOutput.handle\n}\n\n/** One json output a render lands on its node: its key on the job's\n * `output_data` (and on a run's node output) and its saved node-data field. */\nexport interface RenderSavedJsonOutput {\n readonly outputKey: string\n readonly dataField: string\n}\n\n/** The json outputs a render lands on its node, `json` first, each once — what\n * every lane that lands a take (or picks one) writes or restores. Empty for\n * any other node type. */\nexport function renderSavedJsonOutputs(type: unknown): readonly RenderSavedJsonOutput[] {\n const d = renderNodeOf(type)\n if (!d) return []\n const json: RenderSavedJsonOutput = { outputKey: RENDER_JSON_HANDLE, dataField: \"generatedJson\" }\n const t = d.transcriptOutput\n return t.handle === RENDER_JSON_HANDLE ? [json] : [json, { outputKey: t.handle, dataField: t.dataField }]\n}\n\n/** The render job types that list in their owner's own views only. */\nexport const OWNER_ONLY_LISTING_RENDER_TYPES: readonly string[] = Object.freeze(\n RENDER_NODE_TYPE_IDS.filter((t) => RENDER_NODE_TYPES[t]!.ownerOnlyListing),\n)\n","/**\n * Presentation / API utilities — pure logic, no React deps.\n * Shared between frontend (presentation mode) and backend (API schema generation).\n */\n\nimport type { GenericNode, GenericEdge } from \"./types.js\"\nimport type { PresentationItem } from \"./presentation-types.js\"\nimport { AUDIO_PRODUCER_TYPES, VIDEO_PRODUCER_TYPES } from \"./producer-types.js\"\nimport { canonicalizeOverrideKeys } from \"./exposed-field-keys.js\"\nimport { RENDER_NODE_TYPE_IDS } from \"./render-nodes.js\"\nimport { dropStaleVideoLinkFields } from \"./video-link.js\"\nimport { composeUnitSet, unitsPresenting } from \"./unit-contract-compose.js\"\n\n// ---------------------------------------------------------------------------\n// Node type sets\n// ---------------------------------------------------------------------------\n\nexport const INPUT_NODE_TYPES = new Set([\n \"text-prompt\",\n \"upload-image\",\n \"upload-video\",\n \"upload-audio\",\n \"tone\",\n \"style-guide\",\n \"provider\",\n \"scene-count\",\n \"duration\",\n \"aspect-ratio\",\n \"motion\",\n \"camera-motion\",\n \"framing\",\n \"lens\",\n \"camera-format\",\n \"lighting\",\n \"color-look\",\n \"atmosphere\",\n \"action-fx\",\n \"temporal\",\n \"reference-audio\",\n \"youtube-video\",\n])\n\nconst TRIGGER_NODE_TYPES = new Set([\n \"webhook-trigger\",\n \"schedule-trigger\",\n])\n\nconst ALWAYS_EXCLUDED_TYPES = new Set([\n \"sticky-note\",\n \"webhook-trigger\",\n \"schedule-trigger\",\n \"sub-workflow-input\",\n \"sub-workflow-output\",\n])\n\nconst NON_OUTPUT_TYPES = new Set([\n \"text-prompt\",\n \"list\",\n \"upload-image\",\n \"upload-video\",\n \"upload-audio\",\n \"reference-audio\",\n \"rss-feed\",\n \"youtube-video\",\n \"tone\",\n \"style-guide\",\n \"provider\",\n \"scene-count\",\n \"duration\",\n \"aspect-ratio\",\n \"motion\",\n \"camera-motion\",\n \"framing\",\n \"lens\",\n \"camera-format\",\n \"lighting\",\n \"color-look\",\n \"atmosphere\",\n \"action-fx\",\n \"temporal\",\n \"sticky-note\",\n \"sub-workflow-input\",\n \"sub-workflow-output\",\n \"webhook-trigger\",\n \"schedule-trigger\",\n \"combine-text\",\n \"split-text\",\n \"save-to-storage\",\n \"webhook-output\",\n \"component\",\n])\n\n/**\n * Node types that count as an output even when something is wired to their\n * output handle (the legacy `presentationVisible` rule below).\n *\n * A hand-kept list, and one the platform has outgrown: it is unioned at the use\n * site with the producer vocabularies the canvas validators already maintain\n * (see `isMediaProducingType`), so a new media node is covered by the set it\n * must join anyway rather than by remembering to edit this one.\n */\nconst MEDIA_PRODUCING_TYPES = new Set([\n \"generate-image\",\n \"edit-image\",\n \"image-to-image\",\n \"image-to-video\",\n \"text-to-video\",\n \"video-to-video\",\n \"text-to-speech\",\n \"generate-music\",\n \"text-to-audio\",\n \"generate-script\",\n \"ai-writer\",\n \"llm-chat\",\n \"render-video\",\n \"video-composer\",\n \"after-effects\",\n \"lottie-overlay\",\n \"3d-title\",\n \"motion-graphics\",\n \"composite\",\n \"text-to-dialogue\",\n \"voice-changer\",\n \"dubbing\",\n \"voice-remix\",\n \"voice-design\",\n \"extend-video\",\n \"lip-sync\",\n \"motion-transfer\",\n \"video-upscale\",\n \"video-depth\",\n])\n\n// Output type categorizations — each the hand-written list ∪ the node units\n// that declare the same presentation (contract.presents, generated rows); a\n// type in both throws at load (composeUnitSet).\nconst IMAGE_OUTPUT_TYPES = composeUnitSet(\"IMAGE_OUTPUT_TYPES\", [\n \"generate-image\", \"edit-image\", \"image-to-image\",\n \"upload-image\",\n], unitsPresenting(\"image\"))\n\n/**\n * Video-output types NOT already declared by `VIDEO_PRODUCER_TYPES` — the two\n * are unioned in `getOutputType`, which is where the reading order (and the\n * reason the literal sets win) is documented.\n */\nconst VIDEO_OUTPUT_TYPES = composeUnitSet(\"VIDEO_OUTPUT_TYPES\", [\n \"image-to-video\", \"text-to-video\", \"video-to-video\", \"extend-video\",\n \"render-video\", \"video-composer\", \"after-effects\", \"lottie-overlay\",\n \"3d-title\", \"motion-graphics\", \"composite\",\n \"combine-videos\", \"merge-video-audio\", \"resize-video\", \"trim-video\",\n \"speed-ramp\", \"loop-video\", \"fade-video\", \"transcode-video\",\n \"upload-video\",\n \"lip-sync\", \"motion-transfer\", \"video-upscale\", \"video-depth\", \"add-captions\",\n \"social-media-format\",\n // A render (Apply EDL) renders an EDL into video OR audio. Its medium is\n // decided at run time (DYNAMIC_PRODUCER_TYPES), so getOutputType would answer\n // \"data\" and a published app would render the cut as a JSON blob. Declaring\n // every render here — as the voice-changer/dubbing precedent does for their\n // default medium — makes the classifier answer \"video\" (the common case; an\n // audio-only cut still plays in a video element). Asserted in\n // producer-types.test.ts.\n ...RENDER_NODE_TYPE_IDS,\n], unitsPresenting(\"video\"))\n\nconst AUDIO_OUTPUT_TYPES = composeUnitSet(\"AUDIO_OUTPUT_TYPES\", [\n \"text-to-speech\", \"generate-music\", \"text-to-audio\",\n \"text-to-dialogue\", \"voice-changer\", \"dubbing\", \"voice-remix\",\n \"voice-design\", \"mix-audio\", \"adjust-volume\", \"audio-fx\", \"pitch-tempo\", \"trim-audio\",\n \"audio-isolation\",\n \"audio-separation\",\n \"upload-audio\",\n], unitsPresenting(\"audio\"))\n\nconst TEXT_OUTPUT_TYPES = composeUnitSet(\"TEXT_OUTPUT_TYPES\", [\n \"generate-script\", \"ai-writer\", \"llm-chat\", \"transcribe\", \"image-to-text\", \"qa-check\",\n \"text-prompt\",\n // UGC Cards' output card is its Notes: a run hands it on as the node's text\n // (`output.text`, `generatedText` on the canvas).\n \"ugc-cards\",\n], unitsPresenting(\"text\"))\n\n// ---------------------------------------------------------------------------\n// Output type enum\n// ---------------------------------------------------------------------------\n\nexport type OutputType = \"image\" | \"video\" | \"audio\" | \"text\" | \"data\"\n\n// ---------------------------------------------------------------------------\n// Core functions\n// ---------------------------------------------------------------------------\n\n/** Get nodes that act as user inputs (text prompts, uploads, parameters). */\nexport function getInputNodes<T extends GenericNode>(nodes: T[], curatedOnly = true): T[] {\n return nodes.filter((n) => {\n if (!n.type || ALWAYS_EXCLUDED_TYPES.has(n.type)) return false\n if (n.hidden) return false\n if (curatedOnly) {\n // New explicit flag\n if (n.data.presentationInput === true) return true\n // Backwards compat: old flag on input-type nodes\n if (n.data.presentationVisible === true && INPUT_NODE_TYPES.has(n.type)) return true\n return false\n }\n return true\n })\n}\n\n/** Get leaf/media-producing nodes that represent workflow outputs. */\nexport function getOutputNodes<T extends GenericNode>(\n nodes: T[],\n edges: GenericEdge[],\n curatedOnly = true,\n): T[] {\n const nodesWithOutgoing = new Set(edges.map((e) => e.source))\n\n return nodes.filter((n) => {\n if (!n.type || ALWAYS_EXCLUDED_TYPES.has(n.type)) return false\n if (n.hidden) return false\n if (curatedOnly) {\n // New explicit flag\n if (n.data.presentationOutput === true) return true\n // Backwards compat: old flag on output-eligible nodes\n if (n.data.presentationVisible === true) {\n if (NON_OUTPUT_TYPES.has(n.type)) return false\n return !nodesWithOutgoing.has(n.id) || isMediaProducingType(n.type)\n }\n return false\n }\n return true\n })\n}\n\n/**\n * Map node type to its output media type.\n *\n * The four literal sets above are read FIRST and win: they are the presentation\n * classifier's own opinion, including for dual-mode nodes whose default medium\n * is not their handle set (voice-changer and dubbing are audio here even though\n * they can emit video).\n *\n * Anything they do not name falls through to the producer vocabularies the\n * canvas validators and the orchestrator already maintain\n * (`packages/shared/src/producer-types.ts`). Those sets are what a new media\n * node MUST join for its outputs to connect at all, so deriving the tail from\n * them is what stops this map from silently drifting behind the node catalogue\n * — which it had (3D Render Pro, Generate Video, Generate Video Pro and a dozen\n * ffmpeg nodes all read as `\"data\"`, so a published app rendered them as a JSON\n * blob and `/v1` app schemas declared the wrong output type).\n *\n * `DYNAMIC_PRODUCER_TYPES` is deliberately NOT consulted: a node whose medium\n * is decided at run time has no static answer, and `\"data\"` is the honest one.\n */\nexport function getOutputType(nodeType: string | undefined): OutputType {\n if (!nodeType) return \"data\"\n if (IMAGE_OUTPUT_TYPES.has(nodeType)) return \"image\"\n if (VIDEO_OUTPUT_TYPES.has(nodeType)) return \"video\"\n if (AUDIO_OUTPUT_TYPES.has(nodeType)) return \"audio\"\n if (TEXT_OUTPUT_TYPES.has(nodeType)) return \"text\"\n if (VIDEO_PRODUCER_TYPES.has(nodeType)) return \"video\"\n if (AUDIO_PRODUCER_TYPES.has(nodeType)) return \"audio\"\n return \"data\"\n}\n\n/**\n * Whether a node produces media of its own — the test the legacy\n * `presentationVisible` rule uses to keep a media node as an OUTPUT even when\n * it also feeds something downstream.\n *\n * Same union, same reason as `getOutputType`: the hand-kept list plus the\n * producer vocabularies. Text producers stay where the literal list put them\n * (`generate-script`, `ai-writer`, `llm-chat` are members; `transcribe` and\n * `qa-check` are not) — this is about media, not about every node with a value.\n */\nfunction isMediaProducingType(nodeType: string): boolean {\n if (MEDIA_PRODUCING_TYPES.has(nodeType)) return true\n const output = getOutputType(nodeType)\n return output === \"image\" || output === \"video\" || output === \"audio\"\n}\n\n/** Extract the result URL or text from a node's data. */\nexport function getNodeResult(\n nodeData: Record<string, unknown>,\n): { url?: string; text?: string } {\n // Preview node: extract first visible item from previewItems\n const previewItems = nodeData.previewItems as\n | Array<{ type: string; value: string; visible?: boolean }>\n | undefined\n if (previewItems && previewItems.length > 0) {\n const first = previewItems.find((item) => item.visible !== false) ?? previewItems[0]\n if (first) {\n if (first.type === \"image\" || first.type === \"video\" || first.type === \"audio\") {\n return { url: first.value }\n }\n return { text: first.value }\n }\n }\n\n const results = nodeData.generatedResults as\n | Array<Record<string, unknown>>\n | undefined\n\n if (results && results.length > 0) {\n const idx = (nodeData.activeResultIndex as number) ?? 0\n const active = results[idx] ?? results[0]\n const url = (active?.url ?? active?.imageUrl ?? active?.videoUrl ?? active?.audioUrl) as\n | string\n | undefined\n const text = (active?.text ?? active?.script) as string | undefined\n return { url, text }\n }\n\n // Fallback to individual generated fields\n const url = (nodeData.generatedImageUrl ??\n nodeData.generatedVideoUrl ??\n nodeData.generatedAudioUrl) as string | undefined\n const text = (nodeData.generatedScript ?? nodeData.generatedText) as\n | string\n | undefined\n\n return { url, text }\n}\n\n/** Human-readable label for a node. */\nexport function getNodeLabel(node: GenericNode): string {\n return (\n (node.data.label as string) ||\n node.type?.replace(/-/g, \" \").replace(/\\b\\w/g, (c) => c.toUpperCase()) ||\n \"Node\"\n )\n}\n\n// ---------------------------------------------------------------------------\n// Input field schema (for API schema generation)\n// ---------------------------------------------------------------------------\n\nexport interface InputFieldSchema {\n key: string\n type: \"text\" | \"image-url\" | \"video-url\" | \"audio-url\" | \"select\" | \"number\"\n options?: string[]\n}\n\n// Override field per input-node type. The `key` for a parameter-picker MUST be\n// the field that `getParameterValue()` (parameter-node-value.ts) actually reads\n// — for multi-dimension pickers, its FIRST per-dimension field (the\n// \"representative key\"). A mismatch silently drops the curated app/MCP/SDK input\n// (the override lands on a field nothing reads). This map is the single source\n// of truth for app-input override fields (consumed by extract-app-inputs.ts,\n// api-tokens.ts, and the app-runner). Its parity with getParameterValue is\n// guarded by input-field-map-parity.test.ts so the two can't drift.\nexport const INPUT_FIELD_MAP: Record<string, InputFieldSchema> = {\n // --- Source / upload nodes (not parameter pickers) ---\n \"text-prompt\": { key: \"text\", type: \"text\" },\n \"upload-image\": { key: \"url\", type: \"image-url\" },\n \"upload-video\": { key: \"url\", type: \"video-url\" },\n \"upload-audio\": { key: \"url\", type: \"audio-url\" },\n \"reference-audio\": { key: \"extractedAudioUrl\", type: \"audio-url\" },\n // A LINK, not an upload (rule: `videoLinkInputProblem`, video-link.ts); still a `video-url` media input.\n \"youtube-video\": { key: \"youtubeUrl\", type: \"video-url\" },\n // --- Classic parameters ---\n \"provider\": { key: \"provider\", type: \"select\" },\n \"style-guide\": { key: \"text\", type: \"text\" }, // reads data.text (was wrongly \"styleGuide\")\n \"scene-count\": { key: \"count\", type: \"number\" },\n \"duration\": { key: \"seconds\", type: \"number\" }, // reads data.seconds (was wrongly \"duration\")\n \"aspect-ratio\": { key: \"ratio\", type: \"select\" }, // reads data.ratio (was wrongly \"aspectRatio\")\n // --- Single-field parameter pickers ---\n \"tone\": { key: \"tone\", type: \"select\" },\n \"motion\": { key: \"motion\", type: \"select\" },\n \"camera-motion\": { key: \"cameraMotion\", type: \"select\" },\n \"lens\": { key: \"lens\", type: \"select\" },\n \"camera-format\": { key: \"cameraFormat\", type: \"select\" },\n \"color-look\": { key: \"colorLook\", type: \"select\" },\n \"atmosphere\": { key: \"atmosphere\", type: \"select\" },\n \"style\": { key: \"style\", type: \"select\" },\n \"setting\": { key: \"setting\", type: \"select\" },\n \"mood\": { key: \"mood\", type: \"select\" },\n \"photographer\": { key: \"photographer\", type: \"select\" },\n \"aesthetic\": { key: \"aesthetic\", type: \"select\" },\n \"era\": { key: \"era\", type: \"select\" },\n \"material\": { key: \"material\", type: \"select\" },\n \"animal\": { key: \"animal\", type: \"select\" },\n \"vehicle\": { key: \"vehicle\", type: \"select\" },\n \"weapon\": { key: \"weapon\", type: \"select\" },\n \"furniture\": { key: \"furniture\", type: \"select\" },\n \"photo-genre\": { key: \"photoGenre\", type: \"select\" },\n \"backdrop\": { key: \"backdrop\", type: \"select\" },\n \"held-prop\": { key: \"heldProp\", type: \"select\" },\n \"render-quality\": { key: \"renderQuality\", type: \"select\" },\n \"composition-effects\": { key: \"compositionEffect\", type: \"select\" },\n \"post-process-effects\": { key: \"postProcess\", type: \"select\" },\n \"action-fx\": { key: \"actionFx\", type: \"select\" },\n \"character-fx\": { key: \"characterFx\", type: \"select\" },\n \"character-motion\": { key: \"characterMotion\", type: \"select\" },\n \"transition\": { key: \"transition\", type: \"select\" },\n \"loop-subject\": { key: \"loopSubject\", type: \"select\" },\n // --- Multi-dimension pickers: representative (first) field. Overriding only\n // sets that dimension; full hint composition runs in the executors. ---\n \"framing\": { key: \"shotSize\", type: \"select\" },\n \"lighting\": { key: \"timeOfDay\", type: \"select\" },\n \"temporal\": { key: \"temporalSpeed\", type: \"select\" },\n \"person\": { key: \"type\", type: \"select\" },\n \"pose\": { key: \"pose\", type: \"select\" },\n \"styling\": { key: \"makeup\", type: \"select\" },\n \"exposure-settings\": { key: \"aperture\", type: \"select\" },\n \"music-genre\": { key: \"subgenre\", type: \"select\" },\n \"music-mood\": { key: \"emotion\", type: \"select\" },\n \"instrumentation\": { key: \"production\", type: \"select\" },\n \"voice-character\": { key: \"timbre\", type: \"select\" },\n \"voice-delivery\": { key: \"archetype\", type: \"select\" },\n // --- UGC (Cloud) ---\n \"ugc-creator\": { key: \"source\", type: \"select\" },\n}\n\n/**\n * Extra API-settable keys for node types whose card writes more than one field\n * (INPUT_FIELD_MAP is one key per node type). Read by extract-app-inputs and the\n * app runner; every key here must be in UGC_OVERRIDABLE_FIELDS for a UGC type.\n */\nexport const INPUT_FIELD_EXTRA_KEYS: Readonly<Record<string, readonly InputFieldSchema[]>> = {\n \"ugc-creator\": [{ key: \"gender\", type: \"select\" }, { key: \"photoUrl\", type: \"image-url\" }],\n // The script's language: changes together with UGC_OVERRIDABLE_FIELDS[\"ugc-script\"] and UgcScriptData.language.\n \"ugc-script\": [{ key: \"language\", type: \"select\" }],\n}\n\n/** The extra override fields of a node type (none for most types). */\nexport function getInputFieldExtraKeys(nodeType: string): readonly InputFieldSchema[] {\n return Object.hasOwn(INPUT_FIELD_EXTRA_KEYS, nodeType) ? INPUT_FIELD_EXTRA_KEYS[nodeType]! : []\n}\n\n/** Get the overridable field schema for an input node type. */\nexport function getInputFieldSchema(nodeType: string): InputFieldSchema | undefined {\n return INPUT_FIELD_MAP[nodeType]\n}\n\nconst MEDIA_INPUT_FIELD_TYPES: ReadonlySet<InputFieldSchema[\"type\"]> = new Set([\n \"image-url\",\n \"video-url\",\n \"audio-url\",\n])\n\n/**\n * Shallow-merge run-time input overrides (a published app's inputs, an API-token\n * run, MCP `run_app` / `run_workflow` inputs, a wired component handle) over a\n * node's SAVED data — the one merge every such lane must use.\n *\n * `metadata` holds facts measured FROM the node's media (its length, its\n * dimensions). When an override swaps that media — the node's primary input\n * field is a media url (`INPUT_FIELD_MAP`) and the override changes it — the\n * snapshot's facts describe a file that is no longer there, so they are dropped\n * unless the override supplies its own. Left behind, a publisher's\n * `metadata.durationSeconds` outranks the run's own transcript as Edit Plan's\n * duration basis and under-buckets a caller's longer episode: an estimate that\n * passes the balance precheck for a run the reserve then refuses.\n *\n * Schema-driven on purpose: a new media input node is covered by its\n * `INPUT_FIELD_MAP` row, with no list to remember here.\n *\n * An override sent under a renamed exposed-field key (an app published before\n * the rename) lands on the node's current field — `canonicalizeOverrideKeys`.\n *\n * An override of `null` clears the field: the merged node has no such key.\n */\nexport function mergeNodeInputOverrides(\n nodeType: string | undefined,\n data: Record<string, unknown>,\n overrides: Record<string, unknown>,\n): Record<string, unknown> {\n const incoming = canonicalizeOverrideKeys(nodeType, overrides)\n // A Video URL node on a new link sheds what was fetched for the old one.\n const base = nodeType === \"youtube-video\" ? dropStaleVideoLinkFields(data, incoming) : data\n const merged: Record<string, unknown> = { ...base, ...incoming }\n // A null override CLEARS the field: the run has no value there, neither null nor the saved one. JSON cannot\n // carry `undefined`, so this is how a run says \"unset\" (an app card clearing a lever the chosen model lacks).\n for (const [key, value] of Object.entries(incoming)) {\n if (value === null) delete merged[key]\n }\n const schema = nodeType ? INPUT_FIELD_MAP[nodeType] : undefined\n if (\n schema &&\n MEDIA_INPUT_FIELD_TYPES.has(schema.type) &&\n schema.key in overrides &&\n overrides[schema.key] !== data[schema.key] &&\n !(\"metadata\" in overrides)\n ) {\n delete merged.metadata\n }\n return merged\n}\n\n// ---------------------------------------------------------------------------\n// Migration & validation helpers (PresentationItem)\n// ---------------------------------------------------------------------------\n\n/** Migrate a legacy string[] order to PresentationItem[]. */\nexport function migrateToItems(order: string[] | undefined): PresentationItem[] | undefined {\n if (!order) return undefined\n return order.map((nodeId) => ({ type: \"node\" as const, nodeId }))\n}\n\n/** Strip nested groups — groups may only contain non-group items. */\nexport function validateNoNestedGroups(items: PresentationItem[]): PresentationItem[] {\n return items.map((item) => {\n if (item.type === \"group\") {\n return { ...item, items: item.items.filter((child) => child.type !== \"group\") }\n }\n return item\n })\n}\n\n/** Recursively flatten all items, unwrapping groups. */\nexport function flattenItems(items: PresentationItem[]): PresentationItem[] {\n const result: PresentationItem[] = []\n for (const item of items) {\n if (item.type === \"group\") {\n result.push(...flattenItems(item.items))\n } else {\n result.push(item)\n }\n }\n return result\n}\n\n/** Get the sortable/unique ID for a PresentationItem. */\nexport function getItemSortId(item: PresentationItem): string {\n return item.type === \"node\" ? item.nodeId : item.id\n}\n\n/** Remove items whose nodeId no longer exists in the workflow. */\nexport function cleanOrphanedItems(\n items: PresentationItem[],\n nodeIds: Set<string>\n): PresentationItem[] {\n return items\n .filter((item) => {\n if (item.type === \"node\" || item.type === \"field\" || item.type === \"output\") return nodeIds.has(item.nodeId)\n return true\n })\n .map((item) => {\n if (item.type === \"group\") {\n return { ...item, items: cleanOrphanedItems(item.items, nodeIds) }\n }\n return item\n })\n}\n"]}
1
+ {"version":3,"sources":["../src/exposed-field-keys.ts","../src/render-nodes.ts","../src/presentation-utils.ts"],"names":["applyEdlCreditId","speakerViewCreditId","SPEAKER_VIEW_CREDIT_IDS","composeUnitSet","unitsPresenting","VIDEO_PRODUCER_TYPES","AUDIO_PRODUCER_TYPES","url","text","dropStaleVideoLinkFields"],"mappings":";;;;;;;;AAiBO,IAAM,yBAAA,GAAwF;AAAA;AAAA;AAAA,EAGnG,gBAAA,EAAkB,EAAE,UAAA,EAAY,iBAAA;AAClC;AAGO,SAAS,wBAAA,CAAyB,UAA8B,GAAA,EAAqB;AAC1F,EAAA,IAAI,OAAO,aAAa,QAAA,IAAY,CAAC,OAAO,MAAA,CAAO,yBAAA,EAA2B,QAAQ,CAAA,EAAG,OAAO,GAAA;AAChG,EAAA,MAAM,OAAA,GAAU,0BAA0B,QAAQ,CAAA;AAClD,EAAA,OAAO,OAAO,MAAA,CAAO,OAAA,EAAS,GAAG,CAAA,GAAI,OAAA,CAAQ,GAAG,CAAA,GAAK,GAAA;AACvD;AAOO,SAAS,wBAAA,CACd,UACA,SAAA,EACyB;AACzB,EAAA,IAAI,GAAA;AACJ,EAAA,KAAA,MAAW,GAAA,IAAO,MAAA,CAAO,IAAA,CAAK,SAAS,CAAA,EAAG;AACxC,IAAA,MAAM,OAAA,GAAU,wBAAA,CAAyB,QAAA,EAAU,GAAG,CAAA;AACtD,IAAA,IAAI,YAAY,GAAA,EAAK;AACrB,IAAA,GAAA,KAAQ,EAAE,GAAG,SAAA,EAAU;AACvB,IAAA,OAAO,IAAI,GAAG,CAAA;AACd,IAAA,IAAI,CAAC,MAAA,CAAO,MAAA,CAAO,SAAA,EAAW,OAAO,GAAG,GAAA,CAAI,OAAO,CAAA,GAAI,SAAA,CAAU,GAAG,CAAA;AAAA,EACtE;AACA,EAAA,OAAO,GAAA,IAAO,SAAA;AAChB;;;ACNO,IAAM,kBAAA,GAAqB;AAgClC,IAAM,sBAAsB,CAAC,IAAA,KAA8B,IAAA,CAAK,M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AACT;AAGO,SAAS,cAAc,IAAA,EAAgC;AAC5D,EAAA,OAAO,IAAA,CAAK,IAAA,KAAS,MAAA,GAAS,IAAA,CAAK,SAAS,IAAA,CAAK,EAAA;AACnD;AAGO,SAAS,kBAAA,CACd,OACA,OAAA,EACoB;AACpB,EAAA,OAAO,KAAA,CACJ,MAAA,CAAO,CAAC,IAAA,KAAS;AAChB,IAAA,IAAI,IAAA,CAAK,IAAA,KAAS,MAAA,IAAU,IAAA,CAAK,IAAA,KAAS,OAAA,IAAW,IAAA,CAAK,IAAA,KAAS,QAAA,EAAU,OAAO,OAAA,CAAQ,GAAA,CAAI,KAAK,MAAM,CAAA;AAC3G,IAAA,OAAO,IAAA;AAAA,EACT,CAAC,CAAA,CACA,GAAA,CAAI,CAAC,IAAA,KAAS;AACb,IAAA,IAAI,IAAA,CAAK,SAAS,OAAA,EAAS;AACzB,MAAA,OAAO,EAAE,GAAG,IAAA,EAAM,KAAA,EAAO,mBAAmB,IAAA,CAAK,KAAA,EAAO,OAAO,CAAA,EAAE;AAAA,IACnE;AACA,IAAA,OAAO,IAAA;AAAA,EACT,CAAC,CAAA;AACL","file":"chunk-E66HSC2E.cjs","sourcesContent":["/**\n * Exposed-field keys that were renamed to the node's real data field.\n *\n * A published app stores which fields it exposes as `{ type: \"field\", nodeId, field }` items in its\n * immutable snapshot settings, and external callers send `inputOverrides[nodeId][field]` with that same\n * string — it is part of the public wire contract (docs/embed-app-guide.md). Renaming a descriptor's key\n * must not strand the apps already published with the old spelling: they keep that string forever, so every\n * place that turns a stored key into a node-data key — or compares it with a descriptor key — goes through\n * `canonicalExposedFieldKey`.\n *\n * CLOSED LIST. A row needs a spelling that was published (a card that existed in apps) and a target the\n * node's descriptor now declares (the frontend guard `exposable-field-keys.test.ts` checks both). Only list a\n * field whose card cannot carry `allowedValues` (slider / toggle / text / color): the server validates\n * `allowedValues` against the stored key (backend routes/app-runner.ts `validateRestrictedFields`). Never list\n * a field of an outbound node type: the run-request override lock (backend lib/input-override-lock.ts) reads\n * the stored key, before this table renames it.\n */\nexport const LEGACY_EXPOSED_FIELD_KEYS: Readonly<Record<string, Readonly<Record<string, string>>>> = {\n // Published as the Text to Speech slider's key. The node's data field, and every runner, route and config\n // panel, has always been `similarityBoost` — so the slider moved nothing.\n \"text-to-speech\": { similarity: \"similarityBoost\" },\n}\n\n/** The node-data key an exposed field's stored key stands for. Unknown node types and keys pass through. */\nexport function canonicalExposedFieldKey(nodeType: string | undefined, key: string): string {\n if (typeof nodeType !== \"string\" || !Object.hasOwn(LEGACY_EXPOSED_FIELD_KEYS, nodeType)) return key\n const renames = LEGACY_EXPOSED_FIELD_KEYS[nodeType]!\n return Object.hasOwn(renames, key) ? renames[key]! : key\n}\n\n/**\n * The override map with every legacy spelling replaced by its current key. When the caller sent both\n * spellings the current one wins (it is their current intent) and the legacy key is dropped — a dead key\n * is never written to node data. Returns the same object when nothing renames; never mutates.\n */\nexport function canonicalizeOverrideKeys(\n nodeType: string | undefined,\n overrides: Record<string, unknown>,\n): Record<string, unknown> {\n let out: Record<string, unknown> | undefined\n for (const key of Object.keys(overrides)) {\n const current = canonicalExposedFieldKey(nodeType, key)\n if (current === key) continue\n out ??= { ...overrides }\n delete out[key]\n if (!Object.hasOwn(overrides, current)) out[current] = overrides[key]\n }\n return out ?? overrides\n}\n","/**\n * The render-node registry (SV18, decided 2026-10-06): every node type that\n * turns an EDL into a finished file, and how each one behaves wherever the\n * platform gives a render its meaning — review and the Preview label, privacy,\n * the latest-batch reader, the owner-only listings, and what its `json` handle\n * carries.\n *\n * ONE registry, read by both engines, the editor, the listings and MCP, so a\n * second render (Speaker View) joins by adding one entry — never by finding\n * every `=== \"apply-edl\"`. The backend census test\n * (`render-node-census.test.ts`) fails a new `apply-edl` literal at any site\n * that is not pure registration of that node.\n *\n * The key is the node type AND the job name: a render's job is never renamed\n * (by quality or otherwise — only its credit id changes), so the same key\n * answers for `node.type` and for `jobs.job_type`.\n */\nimport { applyEdlCreditId, speakerViewCreditId, SPEAKER_VIEW_CREDIT_IDS } from \"./credit-identifiers.js\"\nimport type { RenderMedium } from \"./render-output.js\"\n\n/** Where a render's player maps the output clock back to the master clock\n * from: the EDL it was given (`input_data.edl`), or the EDL it emitted on its\n * `json` output (a render that rewrites its EDL, e.g. by splitting turns). */\nexport type RenderClockSource = \"input\" | \"output-json\"\n\n/** What a render's `json` output handle carries. Only a `transcript` is handed\n * on as one (Add Captions, the word-timing preflight). */\nexport type RenderJsonKind = \"transcript\" | \"edl\"\n\n/** Where a render's wired transcript, remapped through its cut, comes out\n * (Apply EDL's on its `json`; Speaker View's on its own `transcript` pip,\n * decided 2026-10-08). */\nexport interface RenderTranscriptOutput {\n /** The output pip — also the key it rides on the job's `output_data` and on\n * a run's node output. */\n readonly handle: string\n /** The saved node-data field that holds it (the landed take's). */\n readonly dataField: string\n}\n\n/** The pip a render's `json` output (its `jsonKind`) comes out on, and its key\n * on the job's `output_data`. */\nexport const RENDER_JSON_HANDLE = \"json\"\n\nexport interface RenderNodeDescriptor {\n /** The medium the render's order asks for (its node data, or its job's\n * `input_data`) — before any output exists to say. */\n readonly mediumOf: (data: Readonly<Record<string, unknown>>) => RenderMedium\n /** The credit id a render reserves on — a per-OUTPUT-MINUTE row: every\n * render is charged its row × the minutes it renders. Chosen from the\n * render's `quality` and `output` (as its node data or its job's request\n * carries them) and, for a render priced in tiers, the `priceTier` the\n * render rule judged it to be in (Speaker View's, decided 2026-10-10). A\n * tiered render given no tier names its dearer row. */\n readonly creditId: (quality: unknown, output?: unknown, priceTier?: unknown) => string\n /** Every id `creditId` can name (each must have a price row). */\n readonly creditIds: readonly string[]\n readonly clockMapFrom: RenderClockSource\n /** Listed in its owner's own views only, never in a public one (decided\n * 2026-10-06): a Preview is private, and a public final would be exposure\n * nobody decided. */\n readonly ownerOnlyListing: boolean\n /** An `each` wire reads its LATEST batch only, never its accumulated history\n * (TA6, decided 2026-10-04). */\n readonly latestBatch: boolean\n readonly jsonKind: RenderJsonKind\n /** Where its remapped transcript comes out. On the `json` pip exactly when\n * `jsonKind` is `transcript` (a guard test holds the two together). */\n readonly transcriptOutput: RenderTranscriptOutput\n}\n\ntype Data = Readonly<Record<string, unknown>>\n\n/** Its `output` setting, video when absent. */\nconst outputSettingMedium = (data: Data): RenderMedium => (data.output === \"audio\" ? \"audio\" : \"video\")\n\nconst descriptor = (d: RenderNodeDescriptor): RenderNodeDescriptor =>\n Object.freeze({ ...d, creditIds: Object.freeze([...d.creditIds]), transcriptOutput: Object.freeze({ ...d.transcriptOutput }) })\n\nexport const RENDER_NODE_TYPES: Readonly<Record<string, RenderNodeDescriptor>> = Object.freeze({\n \"apply-edl\": descriptor({\n mediumOf: outputSettingMedium,\n creditId: (quality) => applyEdlCreditId(quality),\n creditIds: [\"apply-edl\", \"apply-edl:proxy\"],\n clockMapFrom: \"input\",\n ownerOnlyListing: true,\n latestBatch: true,\n jsonKind: \"transcript\",\n transcriptOutput: { handle: RENDER_JSON_HANDLE, dataField: \"generatedJson\" },\n }),\n // Speaker View (C3.2): video only; its `json` is the EDL as it drew it (the\n // turns split, the layouts written), so a player maps the output clock\n // through THAT, and Add Captions never takes it for a Transcript. The wired\n // transcript, remapped through that same drawn edit, comes out on its own\n // `transcript` pip (decided 2026-10-08) — what a caption step reads.\n \"speaker-view\": descriptor({\n mediumOf: () => \"video\",\n creditId: (quality, _output, priceTier) => speakerViewCreditId(quality, priceTier),\n creditIds: SPEAKER_VIEW_CREDIT_IDS,\n clockMapFrom: \"output-json\",\n ownerOnlyListing: true,\n latestBatch: true,\n jsonKind: \"edl\",\n transcriptOutput: { handle: \"transcript\", dataField: \"generatedTranscript\" },\n }),\n})\n\n/** Every render node type, in registry order. */\nexport const RENDER_NODE_TYPE_IDS: readonly string[] = Object.freeze(Object.keys(RENDER_NODE_TYPES))\n\n/** The descriptor of a render node type (or job name); `undefined` for any\n * other value. Own keys only, so `\"constructor\"` is not a render. */\nexport function renderNodeOf(type: unknown): RenderNodeDescriptor | undefined {\n return typeof type === \"string\" && Object.hasOwn(RENDER_NODE_TYPES, type) ? RENDER_NODE_TYPES[type] : undefined\n}\n\n/** Is this node type (or job name) a render? */\nexport function isRenderNodeType(type: unknown): type is string {\n return renderNodeOf(type) !== undefined\n}\n\n/** Does an `each` wire from this node read its latest batch only? */\nexport function rendersLatestBatch(type: unknown): boolean {\n return renderNodeOf(type)?.latestBatch === true\n}\n\n/** Is this node a render whose `json` output is a Transcript? */\nexport function rendersTranscriptJson(type: unknown): boolean {\n return renderNodeOf(type)?.jsonKind === \"transcript\"\n}\n\n/** Where a render's remapped transcript comes out; `undefined` for any other\n * node type. */\nexport function renderTranscriptOutputOf(type: unknown): RenderTranscriptOutput | undefined {\n return renderNodeOf(type)?.transcriptOutput\n}\n\n/** Is `handle` one of a render's data pips — its `json` or its transcript —\n * rather than its media? Every other pip of a render (the default included)\n * is the rendered media. `false` for any other node type. */\nexport function isRenderDataHandle(type: unknown, handle: unknown): boolean {\n const d = renderNodeOf(type)\n if (!d || typeof handle !== \"string\") return false\n return handle === RENDER_JSON_HANDLE || handle === d.transcriptOutput.handle\n}\n\n/** One json output a render lands on its node: its key on the job's\n * `output_data` (and on a run's node output) and its saved node-data field. */\nexport interface RenderSavedJsonOutput {\n readonly outputKey: string\n readonly dataField: string\n}\n\n/** The json outputs a render lands on its node, `json` first, each once — what\n * every lane that lands a take (or picks one) writes or restores. Empty for\n * any other node type. */\nexport function renderSavedJsonOutputs(type: unknown): readonly RenderSavedJsonOutput[] {\n const d = renderNodeOf(type)\n if (!d) return []\n const json: RenderSavedJsonOutput = { outputKey: RENDER_JSON_HANDLE, dataField: \"generatedJson\" }\n const t = d.transcriptOutput\n return t.handle === RENDER_JSON_HANDLE ? [json] : [json, { outputKey: t.handle, dataField: t.dataField }]\n}\n\n/** The render job types that list in their owner's own views only. */\nexport const OWNER_ONLY_LISTING_RENDER_TYPES: readonly string[] = Object.freeze(\n RENDER_NODE_TYPE_IDS.filter((t) => RENDER_NODE_TYPES[t]!.ownerOnlyListing),\n)\n","/**\n * Presentation / API utilities — pure logic, no React deps.\n * Shared between frontend (presentation mode) and backend (API schema generation).\n */\n\nimport type { GenericNode, GenericEdge } from \"./types.js\"\nimport type { PresentationItem } from \"./presentation-types.js\"\nimport { AUDIO_PRODUCER_TYPES, VIDEO_PRODUCER_TYPES } from \"./producer-types.js\"\nimport { canonicalizeOverrideKeys } from \"./exposed-field-keys.js\"\nimport { RENDER_NODE_TYPE_IDS } from \"./render-nodes.js\"\nimport { dropStaleVideoLinkFields } from \"./video-link.js\"\nimport { composeUnitSet, unitsPresenting } from \"./unit-contract-compose.js\"\n\n// ---------------------------------------------------------------------------\n// Node type sets\n// ---------------------------------------------------------------------------\n\nexport const INPUT_NODE_TYPES = new Set([\n \"text-prompt\",\n \"upload-image\",\n \"upload-video\",\n \"upload-audio\",\n \"tone\",\n \"style-guide\",\n \"provider\",\n \"scene-count\",\n \"duration\",\n \"aspect-ratio\",\n \"motion\",\n \"camera-motion\",\n \"framing\",\n \"lens\",\n \"camera-format\",\n \"lighting\",\n \"color-look\",\n \"atmosphere\",\n \"action-fx\",\n \"temporal\",\n \"reference-audio\",\n \"youtube-video\",\n])\n\nconst TRIGGER_NODE_TYPES = new Set([\n \"webhook-trigger\",\n \"schedule-trigger\",\n])\n\nconst ALWAYS_EXCLUDED_TYPES = new Set([\n \"sticky-note\",\n \"webhook-trigger\",\n \"schedule-trigger\",\n \"sub-workflow-input\",\n \"sub-workflow-output\",\n])\n\nconst NON_OUTPUT_TYPES = new Set([\n \"text-prompt\",\n \"list\",\n \"upload-image\",\n \"upload-video\",\n \"upload-audio\",\n \"reference-audio\",\n \"rss-feed\",\n \"youtube-video\",\n \"tone\",\n \"style-guide\",\n \"provider\",\n \"scene-count\",\n \"duration\",\n \"aspect-ratio\",\n \"motion\",\n \"camera-motion\",\n \"framing\",\n \"lens\",\n \"camera-format\",\n \"lighting\",\n \"color-look\",\n \"atmosphere\",\n \"action-fx\",\n \"temporal\",\n \"sticky-note\",\n \"sub-workflow-input\",\n \"sub-workflow-output\",\n \"webhook-trigger\",\n \"schedule-trigger\",\n \"combine-text\",\n \"split-text\",\n \"save-to-storage\",\n \"webhook-output\",\n \"component\",\n])\n\n/**\n * Node types that count as an output even when something is wired to their\n * output handle (the legacy `presentationVisible` rule below).\n *\n * A hand-kept list, and one the platform has outgrown: it is unioned at the use\n * site with the producer vocabularies the canvas validators already maintain\n * (see `isMediaProducingType`), so a new media node is covered by the set it\n * must join anyway rather than by remembering to edit this one.\n */\nconst MEDIA_PRODUCING_TYPES = new Set([\n \"generate-image\",\n \"edit-image\",\n \"image-to-image\",\n \"image-to-video\",\n \"text-to-video\",\n \"video-to-video\",\n \"text-to-speech\",\n \"generate-music\",\n \"text-to-audio\",\n \"generate-script\",\n \"ai-writer\",\n \"llm-chat\",\n \"render-video\",\n \"video-composer\",\n \"after-effects\",\n \"lottie-overlay\",\n \"3d-title\",\n \"motion-graphics\",\n \"composite\",\n \"text-to-dialogue\",\n \"voice-changer\",\n \"dubbing\",\n \"voice-remix\",\n \"voice-design\",\n \"extend-video\",\n \"lip-sync\",\n \"motion-transfer\",\n \"video-upscale\",\n \"video-depth\",\n])\n\n// Output type categorizations — each the hand-written list ∪ the node units\n// that declare the same presentation (contract.presents, generated rows); a\n// type in both throws at load (composeUnitSet).\nconst IMAGE_OUTPUT_TYPES = composeUnitSet(\"IMAGE_OUTPUT_TYPES\", [\n \"generate-image\", \"edit-image\", \"image-to-image\",\n \"upload-image\",\n], unitsPresenting(\"image\"))\n\n/**\n * Video-output types NOT already declared by `VIDEO_PRODUCER_TYPES` — the two\n * are unioned in `getOutputType`, which is where the reading order (and the\n * reason the literal sets win) is documented.\n */\nconst VIDEO_OUTPUT_TYPES = composeUnitSet(\"VIDEO_OUTPUT_TYPES\", [\n \"image-to-video\", \"text-to-video\", \"video-to-video\", \"extend-video\",\n \"render-video\", \"video-composer\", \"after-effects\", \"lottie-overlay\",\n \"3d-title\", \"motion-graphics\", \"composite\",\n \"combine-videos\", \"merge-video-audio\", \"resize-video\", \"trim-video\",\n \"speed-ramp\", \"loop-video\", \"fade-video\", \"transcode-video\",\n \"upload-video\",\n \"lip-sync\", \"motion-transfer\", \"video-upscale\", \"video-depth\", \"add-captions\",\n \"social-media-format\",\n // A render (Apply EDL) renders an EDL into video OR audio. Its medium is\n // decided at run time (DYNAMIC_PRODUCER_TYPES), so getOutputType would answer\n // \"data\" and a published app would render the cut as a JSON blob. Declaring\n // every render here — as the voice-changer/dubbing precedent does for their\n // default medium — makes the classifier answer \"video\" (the common case; an\n // audio-only cut still plays in a video element). Asserted in\n // producer-types.test.ts.\n ...RENDER_NODE_TYPE_IDS,\n], unitsPresenting(\"video\"))\n\nconst AUDIO_OUTPUT_TYPES = composeUnitSet(\"AUDIO_OUTPUT_TYPES\", [\n \"text-to-speech\", \"generate-music\", \"text-to-audio\",\n \"text-to-dialogue\", \"voice-changer\", \"dubbing\", \"voice-remix\",\n \"voice-design\", \"mix-audio\", \"adjust-volume\", \"audio-fx\", \"pitch-tempo\", \"trim-audio\",\n \"audio-isolation\",\n \"audio-separation\",\n \"upload-audio\",\n], unitsPresenting(\"audio\"))\n\nconst TEXT_OUTPUT_TYPES = composeUnitSet(\"TEXT_OUTPUT_TYPES\", [\n \"generate-script\", \"ai-writer\", \"llm-chat\", \"transcribe\", \"image-to-text\", \"qa-check\",\n \"text-prompt\",\n // UGC Cards' output card is its Notes: a run hands it on as the node's text\n // (`output.text`, `generatedText` on the canvas).\n \"ugc-cards\",\n], unitsPresenting(\"text\"))\n\n// ---------------------------------------------------------------------------\n// Output type enum\n// ---------------------------------------------------------------------------\n\nexport type OutputType = \"image\" | \"video\" | \"audio\" | \"text\" | \"data\"\n\n// ---------------------------------------------------------------------------\n// Core functions\n// ---------------------------------------------------------------------------\n\n/** Get nodes that act as user inputs (text prompts, uploads, parameters). */\nexport function getInputNodes<T extends GenericNode>(nodes: T[], curatedOnly = true): T[] {\n return nodes.filter((n) => {\n if (!n.type || ALWAYS_EXCLUDED_TYPES.has(n.type)) return false\n if (n.hidden) return false\n if (curatedOnly) {\n // New explicit flag\n if (n.data.presentationInput === true) return true\n // Backwards compat: old flag on input-type nodes\n if (n.data.presentationVisible === true && INPUT_NODE_TYPES.has(n.type)) return true\n return false\n }\n return true\n })\n}\n\n/** Get leaf/media-producing nodes that represent workflow outputs. */\nexport function getOutputNodes<T extends GenericNode>(\n nodes: T[],\n edges: GenericEdge[],\n curatedOnly = true,\n): T[] {\n const nodesWithOutgoing = new Set(edges.map((e) => e.source))\n\n return nodes.filter((n) => {\n if (!n.type || ALWAYS_EXCLUDED_TYPES.has(n.type)) return false\n if (n.hidden) return false\n if (curatedOnly) {\n // New explicit flag\n if (n.data.presentationOutput === true) return true\n // Backwards compat: old flag on output-eligible nodes\n if (n.data.presentationVisible === true) {\n if (NON_OUTPUT_TYPES.has(n.type)) return false\n return !nodesWithOutgoing.has(n.id) || isMediaProducingType(n.type)\n }\n return false\n }\n return true\n })\n}\n\n/**\n * Map node type to its output media type.\n *\n * The four literal sets above are read FIRST and win: they are the presentation\n * classifier's own opinion, including for dual-mode nodes whose default medium\n * is not their handle set (voice-changer and dubbing are audio here even though\n * they can emit video).\n *\n * Anything they do not name falls through to the producer vocabularies the\n * canvas validators and the orchestrator already maintain\n * (`packages/shared/src/producer-types.ts`). Those sets are what a new media\n * node MUST join for its outputs to connect at all, so deriving the tail from\n * them is what stops this map from silently drifting behind the node catalogue\n * — which it had (3D Render Pro, Generate Video, Generate Video Pro and a dozen\n * ffmpeg nodes all read as `\"data\"`, so a published app rendered them as a JSON\n * blob and `/v1` app schemas declared the wrong output type).\n *\n * `DYNAMIC_PRODUCER_TYPES` is deliberately NOT consulted: a node whose medium\n * is decided at run time has no static answer, and `\"data\"` is the honest one.\n */\nexport function getOutputType(nodeType: string | undefined): OutputType {\n if (!nodeType) return \"data\"\n if (IMAGE_OUTPUT_TYPES.has(nodeType)) return \"image\"\n if (VIDEO_OUTPUT_TYPES.has(nodeType)) return \"video\"\n if (AUDIO_OUTPUT_TYPES.has(nodeType)) return \"audio\"\n if (TEXT_OUTPUT_TYPES.has(nodeType)) return \"text\"\n if (VIDEO_PRODUCER_TYPES.has(nodeType)) return \"video\"\n if (AUDIO_PRODUCER_TYPES.has(nodeType)) return \"audio\"\n return \"data\"\n}\n\n/**\n * Whether a node produces media of its own — the test the legacy\n * `presentationVisible` rule uses to keep a media node as an OUTPUT even when\n * it also feeds something downstream.\n *\n * Same union, same reason as `getOutputType`: the hand-kept list plus the\n * producer vocabularies. Text producers stay where the literal list put them\n * (`generate-script`, `ai-writer`, `llm-chat` are members; `transcribe` and\n * `qa-check` are not) — this is about media, not about every node with a value.\n */\nfunction isMediaProducingType(nodeType: string): boolean {\n if (MEDIA_PRODUCING_TYPES.has(nodeType)) return true\n const output = getOutputType(nodeType)\n return output === \"image\" || output === \"video\" || output === \"audio\"\n}\n\n/** Extract the result URL or text from a node's data. */\nexport function getNodeResult(\n nodeData: Record<string, unknown>,\n): { url?: string; text?: string } {\n // Preview node: extract first visible item from previewItems\n const previewItems = nodeData.previewItems as\n | Array<{ type: string; value: string; visible?: boolean }>\n | undefined\n if (previewItems && previewItems.length > 0) {\n const first = previewItems.find((item) => item.visible !== false) ?? previewItems[0]\n if (first) {\n if (first.type === \"image\" || first.type === \"video\" || first.type === \"audio\") {\n return { url: first.value }\n }\n return { text: first.value }\n }\n }\n\n const results = nodeData.generatedResults as\n | Array<Record<string, unknown>>\n | undefined\n\n if (results && results.length > 0) {\n const idx = (nodeData.activeResultIndex as number) ?? 0\n const active = results[idx] ?? results[0]\n const url = (active?.url ?? active?.imageUrl ?? active?.videoUrl ?? active?.audioUrl) as\n | string\n | undefined\n const text = (active?.text ?? active?.script) as string | undefined\n return { url, text }\n }\n\n // Fallback to individual generated fields\n const url = (nodeData.generatedImageUrl ??\n nodeData.generatedVideoUrl ??\n nodeData.generatedAudioUrl) as string | undefined\n const text = (nodeData.generatedScript ?? nodeData.generatedText) as\n | string\n | undefined\n\n return { url, text }\n}\n\n/** Human-readable label for a node. */\nexport function getNodeLabel(node: GenericNode): string {\n return (\n (node.data.label as string) ||\n node.type?.replace(/-/g, \" \").replace(/\\b\\w/g, (c) => c.toUpperCase()) ||\n \"Node\"\n )\n}\n\n// ---------------------------------------------------------------------------\n// Input field schema (for API schema generation)\n// ---------------------------------------------------------------------------\n\nexport interface InputFieldSchema {\n key: string\n type: \"text\" | \"image-url\" | \"video-url\" | \"audio-url\" | \"select\" | \"number\"\n options?: string[]\n}\n\n// Override field per input-node type. The `key` for a parameter-picker MUST be\n// the field that `getParameterValue()` (parameter-node-value.ts) actually reads\n// — for multi-dimension pickers, its FIRST per-dimension field (the\n// \"representative key\"). A mismatch silently drops the curated app/MCP/SDK input\n// (the override lands on a field nothing reads). This map is the single source\n// of truth for app-input override fields (consumed by extract-app-inputs.ts,\n// api-tokens.ts, and the app-runner). Its parity with getParameterValue is\n// guarded by input-field-map-parity.test.ts so the two can't drift.\nexport const INPUT_FIELD_MAP: Record<string, InputFieldSchema> = {\n // --- Source / upload nodes (not parameter pickers) ---\n \"text-prompt\": { key: \"text\", type: \"text\" },\n \"upload-image\": { key: \"url\", type: \"image-url\" },\n \"upload-video\": { key: \"url\", type: \"video-url\" },\n \"upload-audio\": { key: \"url\", type: \"audio-url\" },\n \"reference-audio\": { key: \"extractedAudioUrl\", type: \"audio-url\" },\n // A LINK, not an upload (rule: `videoLinkInputProblem`, video-link.ts); still a `video-url` media input.\n \"youtube-video\": { key: \"youtubeUrl\", type: \"video-url\" },\n // --- Classic parameters ---\n \"provider\": { key: \"provider\", type: \"select\" },\n \"style-guide\": { key: \"text\", type: \"text\" }, // reads data.text (was wrongly \"styleGuide\")\n \"scene-count\": { key: \"count\", type: \"number\" },\n \"duration\": { key: \"seconds\", type: \"number\" }, // reads data.seconds (was wrongly \"duration\")\n \"aspect-ratio\": { key: \"ratio\", type: \"select\" }, // reads data.ratio (was wrongly \"aspectRatio\")\n // --- Single-field parameter pickers ---\n \"tone\": { key: \"tone\", type: \"select\" },\n \"motion\": { key: \"motion\", type: \"select\" },\n \"camera-motion\": { key: \"cameraMotion\", type: \"select\" },\n \"lens\": { key: \"lens\", type: \"select\" },\n \"camera-format\": { key: \"cameraFormat\", type: \"select\" },\n \"color-look\": { key: \"colorLook\", type: \"select\" },\n \"atmosphere\": { key: \"atmosphere\", type: \"select\" },\n \"style\": { key: \"style\", type: \"select\" },\n \"setting\": { key: \"setting\", type: \"select\" },\n \"mood\": { key: \"mood\", type: \"select\" },\n \"photographer\": { key: \"photographer\", type: \"select\" },\n \"aesthetic\": { key: \"aesthetic\", type: \"select\" },\n \"era\": { key: \"era\", type: \"select\" },\n \"material\": { key: \"material\", type: \"select\" },\n \"animal\": { key: \"animal\", type: \"select\" },\n \"vehicle\": { key: \"vehicle\", type: \"select\" },\n \"weapon\": { key: \"weapon\", type: \"select\" },\n \"furniture\": { key: \"furniture\", type: \"select\" },\n \"photo-genre\": { key: \"photoGenre\", type: \"select\" },\n \"backdrop\": { key: \"backdrop\", type: \"select\" },\n \"held-prop\": { key: \"heldProp\", type: \"select\" },\n \"render-quality\": { key: \"renderQuality\", type: \"select\" },\n \"composition-effects\": { key: \"compositionEffect\", type: \"select\" },\n \"post-process-effects\": { key: \"postProcess\", type: \"select\" },\n \"action-fx\": { key: \"actionFx\", type: \"select\" },\n \"character-fx\": { key: \"characterFx\", type: \"select\" },\n \"character-motion\": { key: \"characterMotion\", type: \"select\" },\n \"transition\": { key: \"transition\", type: \"select\" },\n \"loop-subject\": { key: \"loopSubject\", type: \"select\" },\n // --- Multi-dimension pickers: representative (first) field. Overriding only\n // sets that dimension; full hint composition runs in the executors. ---\n \"framing\": { key: \"shotSize\", type: \"select\" },\n \"lighting\": { key: \"timeOfDay\", type: \"select\" },\n \"temporal\": { key: \"temporalSpeed\", type: \"select\" },\n \"person\": { key: \"type\", type: \"select\" },\n \"pose\": { key: \"pose\", type: \"select\" },\n \"styling\": { key: \"makeup\", type: \"select\" },\n \"exposure-settings\": { key: \"aperture\", type: \"select\" },\n \"music-genre\": { key: \"subgenre\", type: \"select\" },\n \"music-mood\": { key: \"emotion\", type: \"select\" },\n \"instrumentation\": { key: \"production\", type: \"select\" },\n \"voice-character\": { key: \"timbre\", type: \"select\" },\n \"voice-delivery\": { key: \"archetype\", type: \"select\" },\n // --- UGC (Cloud) ---\n \"ugc-creator\": { key: \"source\", type: \"select\" },\n}\n\n/**\n * Extra API-settable keys for node types whose card writes more than one field\n * (INPUT_FIELD_MAP is one key per node type). Read by extract-app-inputs and the\n * app runner; every key here must be in UGC_OVERRIDABLE_FIELDS for a UGC type.\n */\nexport const INPUT_FIELD_EXTRA_KEYS: Readonly<Record<string, readonly InputFieldSchema[]>> = {\n \"ugc-creator\": [{ key: \"gender\", type: \"select\" }, { key: \"photoUrl\", type: \"image-url\" }],\n // The script's language: changes together with UGC_OVERRIDABLE_FIELDS[\"ugc-script\"] and UgcScriptData.language.\n \"ugc-script\": [{ key: \"language\", type: \"select\" }],\n}\n\n/** The extra override fields of a node type (none for most types). */\nexport function getInputFieldExtraKeys(nodeType: string): readonly InputFieldSchema[] {\n return Object.hasOwn(INPUT_FIELD_EXTRA_KEYS, nodeType) ? INPUT_FIELD_EXTRA_KEYS[nodeType]! : []\n}\n\n/** Get the overridable field schema for an input node type. */\nexport function getInputFieldSchema(nodeType: string): InputFieldSchema | undefined {\n return INPUT_FIELD_MAP[nodeType]\n}\n\nconst MEDIA_INPUT_FIELD_TYPES: ReadonlySet<InputFieldSchema[\"type\"]> = new Set([\n \"image-url\",\n \"video-url\",\n \"audio-url\",\n])\n\n/**\n * Shallow-merge run-time input overrides (a published app's inputs, an API-token\n * run, MCP `run_app` / `run_workflow` inputs, a wired component handle) over a\n * node's SAVED data — the one merge every such lane must use.\n *\n * `metadata` holds facts measured FROM the node's media (its length, its\n * dimensions). When an override swaps that media — the node's primary input\n * field is a media url (`INPUT_FIELD_MAP`) and the override changes it — the\n * snapshot's facts describe a file that is no longer there, so they are dropped\n * unless the override supplies its own. Left behind, a publisher's\n * `metadata.durationSeconds` outranks the run's own transcript as Edit Plan's\n * duration basis and under-buckets a caller's longer episode: an estimate that\n * passes the balance precheck for a run the reserve then refuses.\n *\n * Schema-driven on purpose: a new media input node is covered by its\n * `INPUT_FIELD_MAP` row, with no list to remember here.\n *\n * An override sent under a renamed exposed-field key (an app published before\n * the rename) lands on the node's current field — `canonicalizeOverrideKeys`.\n *\n * An override of `null` clears the field: the merged node has no such key.\n */\nexport function mergeNodeInputOverrides(\n nodeType: string | undefined,\n data: Record<string, unknown>,\n overrides: Record<string, unknown>,\n): Record<string, unknown> {\n const incoming = canonicalizeOverrideKeys(nodeType, overrides)\n // A Video URL node on a new link sheds what was fetched for the old one.\n const base = nodeType === \"youtube-video\" ? dropStaleVideoLinkFields(data, incoming) : data\n const merged: Record<string, unknown> = { ...base, ...incoming }\n // A null override CLEARS the field: the run has no value there, neither null nor the saved one. JSON cannot\n // carry `undefined`, so this is how a run says \"unset\" (an app card clearing a lever the chosen model lacks).\n for (const [key, value] of Object.entries(incoming)) {\n if (value === null) delete merged[key]\n }\n const schema = nodeType ? INPUT_FIELD_MAP[nodeType] : undefined\n if (\n schema &&\n MEDIA_INPUT_FIELD_TYPES.has(schema.type) &&\n schema.key in overrides &&\n overrides[schema.key] !== data[schema.key] &&\n !(\"metadata\" in overrides)\n ) {\n delete merged.metadata\n }\n return merged\n}\n\n// ---------------------------------------------------------------------------\n// Migration & validation helpers (PresentationItem)\n// ---------------------------------------------------------------------------\n\n/** Migrate a legacy string[] order to PresentationItem[]. */\nexport function migrateToItems(order: string[] | undefined): PresentationItem[] | undefined {\n if (!order) return undefined\n return order.map((nodeId) => ({ type: \"node\" as const, nodeId }))\n}\n\n/** Strip nested groups — groups may only contain non-group items. */\nexport function validateNoNestedGroups(items: PresentationItem[]): PresentationItem[] {\n return items.map((item) => {\n if (item.type === \"group\") {\n return { ...item, items: item.items.filter((child) => child.type !== \"group\") }\n }\n return item\n })\n}\n\n/** Recursively flatten all items, unwrapping groups. */\nexport function flattenItems(items: PresentationItem[]): PresentationItem[] {\n const result: PresentationItem[] = []\n for (const item of items) {\n if (item.type === \"group\") {\n result.push(...flattenItems(item.items))\n } else {\n result.push(item)\n }\n }\n return result\n}\n\n/** Get the sortable/unique ID for a PresentationItem. */\nexport function getItemSortId(item: PresentationItem): string {\n return item.type === \"node\" ? item.nodeId : item.id\n}\n\n/** Remove items whose nodeId no longer exists in the workflow. */\nexport function cleanOrphanedItems(\n items: PresentationItem[],\n nodeIds: Set<string>\n): PresentationItem[] {\n return items\n .filter((item) => {\n if (item.type === \"node\" || item.type === \"field\" || item.type === \"output\") return nodeIds.has(item.nodeId)\n return true\n })\n .map((item) => {\n if (item.type === \"group\") {\n return { ...item, items: cleanOrphanedItems(item.items, nodeIds) }\n }\n return item\n })\n}\n"]}
@@ -636,6 +636,35 @@ function maskCompositeEffectiveAudioSource(s) {
636
636
  return "background";
637
637
  }
638
638
 
639
- export { AUDIO_FX_PRESETS, AUDIO_FX_PRESET_LABELS, AUDIO_FX_PRESET_SET, AUDIO_FX_REVERB_PRESETS, DEFAULT_VIDEO_MASK_PROVIDER, FREECUT_EXPORT_COMPLETE, FREECUT_EXPORT_PROGRESS, FREECUT_READY, FREECUT_REQUEST_IMPORT, GENERATE_MASK_LIMITS, LEGACY_LOTTIE_HOST_REMAP, LOTTIE_OVERLAY_CATALOG, LOTTIE_SLOT_FIELD_PREFIX, MASK_COMPOSITE_AUDIO_SOURCES, MASK_COMPOSITE_BACKGROUND_FITS, MASK_COMPOSITE_BOUNDS, MASK_COMPOSITE_DEFAULTS, MASK_COMPOSITE_FILLS, MASK_COMPOSITE_REMEASURE_SLACK_SEC, MASK_COMPOSITE_UNIT_SEC, NODARO_IMPORT_FILES, NODARO_LOAD_TIMELINE, NODARO_LOAD_VIDEO, NODARO_RESET_PROJECT, VIDEO_FACE_MESH_LAYERS, VIDEO_FACE_MESH_LIMITS, VIDEO_FACE_MESH_LINE_LAYERS, VIDEO_FACE_MESH_PARTS, VIDEO_FACE_MESH_PATH, VIDEO_FACE_MESH_RECIPE, VIDEO_MASK_DEFAULTS, VIDEO_MASK_LIMITS, VIDEO_MASK_PROVIDERS, VIDEO_MASK_RECIPE, applySlots, deriveLottieSlotFields, describeMaskRegion, describeSlotControl, hexToRgbaArray, humanizeSlotSid, listSlotSids, maskCompositeEffectiveAudioSource, maskCompositeFillOf, maskCompositeLeadHandle, maskCompositeUnits, maskCompositeUsesForeground, normalizeLottieLayers, resolveLottieOverlaySrc, resolveMaskCompositeSettings, resolveVideoMaskProvider, resolveVideoMaskRedetectSec, resolveVideoMaskZone, rgbaArrayToHex, videoFaceMeshCreditId, videoFaceMeshCreditIds, videoFaceMeshLayersDrawLines, videoFaceMeshLayersOfParts, videoFaceMeshLayersOn, videoFaceMeshPartsOfLayers, videoMaskBilledSeconds, videoMaskCreditId, videoMaskCreditIds };
640
- //# sourceMappingURL=chunk-NIAFR5EE.js.map
641
- //# sourceMappingURL=chunk-NIAFR5EE.js.map
639
+ // src/dubbing-structure.ts
640
+ var DUBBING_CAPTION_FORMATS = ["srt", "vtt"];
641
+ var DUBBING_SOURCE_LANGUAGE = "source";
642
+ var DUBBING_LANGUAGE_STATUSES = ["processing", "completed", "stale", "failed"];
643
+ var DUBBING_ERROR_CODES = [
644
+ /** 422: the job is not a dub. */
645
+ "not_a_dubbing_job",
646
+ /** 409: the dub is still being made. */
647
+ "dubbing_not_ready",
648
+ /** 422: the dub was not made. */
649
+ "dubbing_failed",
650
+ /** 410: the dub is no longer held where it was made. */
651
+ "dubbing_unavailable",
652
+ /** 404: the dub has no such language. */
653
+ "dubbing_language_not_found",
654
+ /** 409: that language is still being made. */
655
+ "dubbing_language_processing",
656
+ /** 422: that language has no captions to export. */
657
+ "dubbing_captions_unavailable",
658
+ /** 409: the dub already speaks that language. */
659
+ "dubbing_language_exists",
660
+ /** 422: the length of the dub cannot be read, so a language cannot be priced. */
661
+ "unreadable_dubbing_source",
662
+ /** 413: the dub is longer than 30 minutes, so a language cannot be added to it. */
663
+ "media_duration_exceeds_limit",
664
+ /** 502: the dubbing service did not answer. */
665
+ "dubbing_read_failed"
666
+ ];
667
+
668
+ export { AUDIO_FX_PRESETS, AUDIO_FX_PRESET_LABELS, AUDIO_FX_PRESET_SET, AUDIO_FX_REVERB_PRESETS, DEFAULT_VIDEO_MASK_PROVIDER, DUBBING_CAPTION_FORMATS, DUBBING_ERROR_CODES, DUBBING_LANGUAGE_STATUSES, DUBBING_SOURCE_LANGUAGE, FREECUT_EXPORT_COMPLETE, FREECUT_EXPORT_PROGRESS, FREECUT_READY, FREECUT_REQUEST_IMPORT, GENERATE_MASK_LIMITS, LEGACY_LOTTIE_HOST_REMAP, LOTTIE_OVERLAY_CATALOG, LOTTIE_SLOT_FIELD_PREFIX, MASK_COMPOSITE_AUDIO_SOURCES, MASK_COMPOSITE_BACKGROUND_FITS, MASK_COMPOSITE_BOUNDS, MASK_COMPOSITE_DEFAULTS, MASK_COMPOSITE_FILLS, MASK_COMPOSITE_REMEASURE_SLACK_SEC, MASK_COMPOSITE_UNIT_SEC, NODARO_IMPORT_FILES, NODARO_LOAD_TIMELINE, NODARO_LOAD_VIDEO, NODARO_RESET_PROJECT, VIDEO_FACE_MESH_LAYERS, VIDEO_FACE_MESH_LIMITS, VIDEO_FACE_MESH_LINE_LAYERS, VIDEO_FACE_MESH_PARTS, VIDEO_FACE_MESH_PATH, VIDEO_FACE_MESH_RECIPE, VIDEO_MASK_DEFAULTS, VIDEO_MASK_LIMITS, VIDEO_MASK_PROVIDERS, VIDEO_MASK_RECIPE, applySlots, deriveLottieSlotFields, describeMaskRegion, describeSlotControl, hexToRgbaArray, humanizeSlotSid, listSlotSids, maskCompositeEffectiveAudioSource, maskCompositeFillOf, maskCompositeLeadHandle, maskCompositeUnits, maskCompositeUsesForeground, normalizeLottieLayers, resolveLottieOverlaySrc, resolveMaskCompositeSettings, resolveVideoMaskProvider, resolveVideoMaskRedetectSec, resolveVideoMaskZone, rgbaArrayToHex, videoFaceMeshCreditId, videoFaceMeshCreditIds, videoFaceMeshLayersDrawLines, videoFaceMeshLayersOfParts, videoFaceMeshLayersOn, videoFaceMeshPartsOfLayers, videoMaskBilledSeconds, videoMaskCreditId, videoMaskCreditIds };
669
+ //# sourceMappingURL=chunk-FGBGKBML.js.map
670
+ //# sourceMappingURL=chunk-FGBGKBML.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/freecut-protocol.ts","../src/inpaint-region.ts","../src/lottie-slots.ts","../src/lottie-overlay-catalog.ts","../src/audio-fx-presets.ts","../src/video-mask.ts","../src/video-face-mesh.ts","../src/generate-mask.ts","../src/mask-composite.ts","../src/dubbing-structure.ts"],"names":["clamp01","copy"],"mappings":";;;AAMO,IAAM,iBAAA,GAAoB;AAI1B,IAAM,oBAAA,GAAuB;AAC7B,IAAM,mBAAA,GAAsB;AAC5B,IAAM,oBAAA,GAAuB;AAG7B,IAAM,aAAA,GAAgB;AACtB,IAAM,uBAAA,GAA0B;AAChC,IAAM,uBAAA,GAA0B;AAChC,IAAM,sBAAA,GAAyB;;;ACPtC,SAAS,KAAK,MAAA,EAAwC;AACpD,EAAA,IAAI,MAAA,GAAS,CAAA,GAAI,CAAA,EAAG,OAAO,KAAA;AAC3B,EAAA,IAAI,MAAA,GAAS,CAAA,GAAI,CAAA,EAAG,OAAO,MAAA;AAC3B,EAAA,OAAO,KAAA;AACT;AAEA,IAAM,OAAO,EAAE,GAAA,EAAK,SAAS,GAAA,EAAK,QAAA,EAAU,MAAM,OAAA,EAAQ;AAC1D,IAAM,OAAO,EAAE,GAAA,EAAK,QAAQ,GAAA,EAAK,QAAA,EAAU,MAAM,OAAA,EAAQ;AAQlD,SAAS,kBAAA,CAAmB,KAAe,KAAA,EAAgE;AAChH,EAAA,MAAMA,QAAAA,GAAU,CAAC,CAAA,KAAc,IAAA,CAAK,GAAA,CAAI,GAAG,IAAA,CAAK,GAAA,CAAI,CAAA,EAAG,CAAC,CAAC,CAAA;AACzD,EAAA,MAA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O,YAAA;AACT;;;ACrKO,IAAM,uBAAA,GAA0B,CAAC,KAAA,EAAO,KAAK;AAI7C,IAAM,uBAAA,GAA0B;AAShC,IAAM,yBAAA,GAA4B,CAAC,YAAA,EAAc,WAAA,EAAa,SAAS,QAAQ;AAgI/E,IAAM,mBAAA,GAAsB;AAAA;AAAA,EAEjC,mBAAA;AAAA;AAAA,EAEA,mBAAA;AAAA;AAAA,EAEA,gBAAA;AAAA;AAAA,EAEA,qBAAA;AAAA;AAAA,EAEA,4BAAA;AAAA;AAAA,EAEA,6BAAA;AAAA;AAAA,EAEA,8BAAA;AAAA;AAAA,EAEA,yBAAA;AAAA;AAAA,EAEA,2BAAA;AAAA;AAAA,EAEA,8BAAA;AAAA;AAAA,EAEA;AACF","file":"chunk-FGBGKBML.js","sourcesContent":["// Single source of truth for the Nodaro <-> FreeCut iframe postMessage protocol.\n// Imported by app's freecut-editor-modal and Studio's ported modal so the wire\n// format cannot drift. The fork (Nodaro-ai/freecut-fork) mirrors these strings in\n// src/features/embedded/services/embedded-message-handler.ts + use-send-back.ts.\n\n// Nodaro (parent) -> FreeCut (iframe)\nexport const NODARO_LOAD_VIDEO = \"NODARO_LOAD_VIDEO\"\n// Multi-clip analog of NODARO_LOAD_VIDEO: lay N ordered urls on the timeline as\n// sequential clips (FreeCut fetches them itself). Used by Studio's production\n// \"Edit in FreeCut\" to assemble the whole cut.\nexport const NODARO_LOAD_TIMELINE = \"NODARO_LOAD_TIMELINE\"\nexport const NODARO_IMPORT_FILES = \"NODARO_IMPORT_FILES\"\nexport const NODARO_RESET_PROJECT = \"NODARO_RESET_PROJECT\"\n\n// FreeCut (iframe) -> Nodaro (parent)\nexport const FREECUT_READY = \"FREECUT_READY\"\nexport const FREECUT_EXPORT_COMPLETE = \"FREECUT_EXPORT_COMPLETE\"\nexport const FREECUT_EXPORT_PROGRESS = \"FREECUT_EXPORT_PROGRESS\" // reserved; fork emits it, v1 parents ignore it\nexport const FREECUT_REQUEST_IMPORT = \"FREECUT_REQUEST_IMPORT\"\n\nexport interface FreecutImportFile {\n readonly name: string\n readonly type: string\n readonly size: number\n readonly buffer: ArrayBuffer\n}\n\nexport interface NodaroLoadVideoPayload {\n readonly videoUrl: string\n /** Display/file name for the primary video (\"Shot 1.mp4\") — optional; absent = URL-derived name (fork default). */\n readonly videoName?: string\n readonly videoBuffer?: ArrayBuffer\n readonly projectJson?: unknown\n readonly additionalFiles?: ReadonlyArray<FreecutImportFile>\n /**\n * What the editor's Save & Exit hands back. \"video\": it renders the timeline\n * and answers with FREECUT_EXPORT_COMPLETE (the video and the project JSON),\n * for a parent that keeps an edit as a new video (the workflow editor).\n * Absent or \"project\": it answers with the project JSON alone\n * (FREECUT_SAVE_EXIT), for a parent that renders the cut itself (Studio).\n */\n readonly saveExit?: \"video\" | \"project\"\n}\n\nexport interface NodaroLoadTimelinePayload {\n // Ordered clip urls; FreeCut fetches each and lays them end-to-end on the timeline.\n readonly clips: ReadonlyArray<string>\n}\n\nexport interface FreecutExportCompletePayload {\n readonly videoBuffer: ArrayBuffer\n readonly projectJson?: unknown\n}\n\nexport interface FreecutExportProgressPayload {\n readonly percent: number\n}\n\nexport interface FreecutRequestImportPayload {\n readonly accept?: string\n readonly multiple?: boolean\n}\n","export interface PixelBox { x: number; y: number; width: number; height: number }\n\nexport interface MaskRegionDescriptor {\n /** bbox normalized to 0..1 against the image, clamped so x+width ≤ 1 and y+height ≤ 1. */\n normBbox: PixelBox\n /** Natural-language location, e.g. \"the upper-left region\" / \"the center\". */\n location: string\n /** Prompt fragment to PREPEND to the user instruction. */\n fragment: string\n}\n\nfunction band(center: number): \"low\" | \"mid\" | \"high\" {\n if (center < 1 / 3) return \"low\"\n if (center > 2 / 3) return \"high\"\n return \"mid\"\n}\n\nconst VERT = { low: \"upper\", mid: \"middle\", high: \"lower\" } as const\nconst HORZ = { low: \"left\", mid: \"center\", high: \"right\" } as const\n\n/**\n * Turn a pixel bounding box of the masked (edit) region into a normalized bbox\n * + natural-language location + a prompt fragment. Pure — no IO. This is the\n * Tier-B descriptor injected for strong instruction-following editors, and the\n * exact primitive Phase 2 (named regions) will reuse.\n */\nexport function describeMaskRegion(box: PixelBox, image: { width: number; height: number }): MaskRegionDescriptor {\n const clamp01 = (n: number) => Math.max(0, Math.min(1, n))\n const round2 = (n: number) => Math.round(n * 100) / 100\n const nx = clamp01(box.x / image.width)\n const ny = clamp01(box.y / image.height)\n const normBbox: PixelBox = {\n x: round2(nx),\n y: round2(ny),\n width: round2(Math.max(0, Math.min(1 - nx, box.width / image.width))),\n height: round2(Math.max(0, Math.min(1 - ny, box.height / image.height))),\n }\n\n const cx = (box.x + box.width / 2) / image.width\n const cy = (box.y + box.height / 2) / image.height\n const v = VERT[band(cy)]\n const h = HORZ[band(cx)]\n const location = v === \"middle\" && h === \"center\" ? \"the center\" : `the ${v}-${h} region`\n\n const fragment =\n `Apply the following change ONLY to ${location} of the image ` +\n `(normalized region x=${normBbox.x} y=${normBbox.y} w=${normBbox.width} h=${normBbox.height}), ` +\n `leaving everything else unchanged: `\n\n return { normBbox, location, fragment }\n}\n","/**\n * Lottie slot substitution — single source of truth (design §5).\n *\n * A slotted property is an object containing a `sid` key (canonically exactly\n * `{\"sid\": \"name\"}`; tolerantly also the annotation form `{a, k, sid}`). The\n * slot manifest maps sid → { p: <whatever belongs at the reference position> }.\n * Overrides map sid → raw value (what UI controls write).\n *\n * KEY CONVENTION: a slot's `p` is, by design, EXACTLY what belongs at the\n * reference position — and we substitute it VERBATIM, never auto-wrapping it in\n * an `{a:0,k:...}` envelope. At a property position (a fill color, a shape size)\n * that means `p` is a property object like `{\"a\":0,\"k\":[1,0,0,1]}`. At a RAW\n * position inside a text document — `layers[].t.d.k[0].s.t`, where lottie-web's\n * `buildFinalText` iterates string characters — `p` is a BARE string, e.g.\n * `{ \"nameText\": { \"p\": \"John Smith\" } }` substitutes the string `\"John Smith\"`\n * straight onto `s.t`. (Auto-wrapping there produced `{a:0,k:\"John Smith\"}` and\n * broke text rendering — the defect this contract fixes.)\n *\n * An override is wrapped ONLY when it lands on a property-object default: the\n * `{...p, k: override}` form preserves the default's envelope (animated/static\n * flags). On a raw default (or a missing slot) the override is substituted\n * verbatim too — so a raw text override stays a bare string.\n *\n * Substitution is renderer-agnostic: we replace every sid node ourselves and\n * never rely on lottie-web's version-dependent native slot support.\n */\n\ntype JsonRecord = Record<string, unknown>\n\nfunction isPlainObject(v: unknown): v is JsonRecord {\n return typeof v === \"object\" && v !== null && !Array.isArray(v)\n}\n\n/** True when `p` already looks like a lottie animated-property object. */\nfunction isPropertyObject(v: unknown): v is JsonRecord {\n return isPlainObject(v) && \"k\" in v\n}\n\nfunction resolveSlotNode(\n node: JsonRecord,\n slots: JsonRecord,\n overrides: JsonRecord,\n): unknown {\n const sid = node.sid as string\n const slot = slots[sid]\n const slotP = isPlainObject(slot) ? (slot as JsonRecord).p : undefined\n const override = overrides[sid]\n\n if (override !== undefined) {\n // Wrap into the default's property-object envelope when the default IS one\n // (preserves animated/static flags); otherwise substitute the raw override\n // verbatim — a raw text override must stay a bare string at `s.t`.\n if (isPropertyObject(slotP)) return { ...slotP, k: structuredClone(override) }\n return structuredClone(override)\n }\n if (slotP !== undefined) {\n // `p` is by convention exactly what belongs at the reference position —\n // substitute it verbatim, never auto-wrap (a bare string stays a string).\n return structuredClone(slotP)\n }\n // No slot, no override — leave the node as-is (validator rule #6 should\n // prevent this; belt-and-braces for hand-fed documents).\n return node\n}\n\nfunction walk(value: unknown, slots: JsonRecord, overrides: JsonRecord): unknown {\n if (Array.isArray(value)) {\n return value.map((item) => walk(item, slots, overrides))\n }\n if (isPlainObject(value)) {\n if (typeof value.sid === \"string\") {\n const resolved = resolveSlotNode(value, slots, overrides)\n // The original node comes back only in the missing-slot case; replacements\n // are leaf property objects and need no further walking.\n if (resolved === value) {\n const copy: JsonRecord = {}\n for (const [k, v] of Object.entries(value)) copy[k] = walk(v, slots, overrides)\n return copy\n }\n return resolved\n }\n const copy: JsonRecord = {}\n for (const [k, v] of Object.entries(value)) copy[k] = walk(v, slots, overrides)\n return copy\n }\n return value\n}\n\n/** Pure: returns a new document; never mutates inputs. */\nexport function applySlots(\n lottie: JsonRecord,\n slots: JsonRecord | undefined,\n overrides: JsonRecord | undefined,\n): JsonRecord {\n return walk(lottie, slots ?? {}, overrides ?? {}) as JsonRecord\n}\n\n// ── Playback normalization ───────────────────────────────────────────────────\n//\n// lottie-web computes a layer's local time as `frame - layer.st` and gates the\n// layer on `local >= ip && local < op`. A layer missing `st` yields NaN, fails\n// the gate, and stays `display:none` forever — the document \"loads\" (DOMLoaded\n// fires) but every frame renders blank (prod incident 2026-06-12: all authored\n// lottie renders came out as empty frames in headless Chrome). `st` and `sr`\n// are spec-optional with defaults, so documents routinely omit them; complete\n// them at the playback boundary so any source — authored plan, baked export,\n// catalog asset, external URL — renders. Mutates `doc` in place and returns it\n// (callers pass freshly fetched or freshly copied documents).\n\nexport function normalizeLottieLayers<T>(doc: T): T {\n if (!isPlainObject(doc)) return doc\n const fix = (layers: unknown): void => {\n if (!Array.isArray(layers)) return\n for (const layer of layers) {\n if (!isPlainObject(layer)) continue\n if (typeof layer.st !== \"number\") layer.st = 0\n if (typeof layer.sr !== \"number\") layer.sr = 1\n }\n }\n fix((doc as JsonRecord).layers)\n const assets = (doc as JsonRecord).assets\n if (Array.isArray(assets)) {\n for (const asset of assets) {\n if (isPlainObject(asset)) fix(asset.layers)\n }\n }\n return doc\n}\n\n// ── Slot control descriptors (Phase 2 — UI mapping) ──────────────────────────\n//\n// A slot manifest entry is `{ p: <whatever belongs at the reference position> }`\n// (Amendment 1). `describeSlotControl` unwraps that envelope to the editable raw\n// value and classifies it into the control kind the config panel should render.\n// `p` is either a property object `{a, k}` (colors, sizes, scalars) whose `k`\n// holds the value, or a bare raw value (text strings live unwrapped at `s.t`).\n\nexport type SlotControlKind = \"color\" | \"text\" | \"number\" | \"point\"\nexport interface SlotControlDescriptor {\n kind: SlotControlKind\n value: unknown\n}\n\n/**\n * Unwraps a slot entry to its editable raw value and classifies it:\n * {p:{a:0,k:[1,0,0,1]}} → { kind:\"color\", value:[1,0,0,1] }\n * {p:\"John\"} → { kind:\"text\", value:\"John\" }\n * {p:{a:0,k:42}} → { kind:\"number\", value:42 }\n * {p:{a:0,k:[10,20]}} → { kind:\"point\", value:[10,20] }\n * Animated property objects (`a:1`) and anything that doesn't map to a known\n * control kind return null (no editable control).\n */\nexport function describeSlotControl(slot: unknown): SlotControlDescriptor | null {\n if (!isPlainObject(slot)) return null\n const p = (slot as JsonRecord).p\n let value: unknown = p\n if (isPropertyObject(p)) {\n if ((p as JsonRecord).a === 1) return null\n value = (p as JsonRecord).k\n }\n if (typeof value === \"string\") return { kind: \"text\", value }\n if (typeof value === \"number\") return { kind: \"number\", value }\n if (\n Array.isArray(value) &&\n value.length === 4 &&\n value.every((n) => typeof n === \"number\" && n >= 0 && n <= 1)\n ) {\n return { kind: \"color\", value }\n }\n if (Array.isArray(value) && value.length === 2 && value.every((n) => typeof n === \"number\")) {\n return { kind: \"point\", value }\n }\n return null\n}\n\nfunction clamp01(n: number): number {\n if (Number.isNaN(n)) return 0\n return n < 0 ? 0 : n > 1 ? 1 : n\n}\n\nfunction toHexByte(component: number): string {\n return Math.round(clamp01(component) * 255)\n .toString(16)\n .padStart(2, \"0\")\n}\n\n/**\n * RGBA array (components 0..1) → hex string. The alpha component is omitted\n * when it is exactly 1 (`[1,0,0,1]` → `\"#ff0000\"`); otherwise an 8-digit hex is\n * emitted (`[0,1,0,0.5]` → `\"#00ff0080\"`). Output is always lowercase.\n */\nexport function rgbaArrayToHex(rgba: number[]): string {\n const [r = 0, g = 0, b = 0, a = 1] = rgba\n const base = `#${toHexByte(r)}${toHexByte(g)}${toHexByte(b)}`\n return a >= 1 ? base : `${base}${toHexByte(a)}`\n}\n\n/**\n * Hex string → RGBA array (components 0..1). Accepts `#rgb`, `#rrggbb`, and\n * `#rrggbbaa`; alpha defaults to 1 when absent. Leading `#` is optional.\n */\nexport function hexToRgbaArray(hex: string): number[] {\n let h = hex.trim().replace(/^#/, \"\")\n if (h.length === 3) {\n h = h\n .split(\"\")\n .map((c) => c + c)\n .join(\"\")\n }\n const r = parseInt(h.slice(0, 2), 16) / 255\n const g = parseInt(h.slice(2, 4), 16) / 255\n const b = parseInt(h.slice(4, 6), 16) / 255\n const a = h.length >= 8 ? parseInt(h.slice(6, 8), 16) / 255 : 1\n return [r, g, b, a]\n}\n\n/** Manifest sids in insertion order (drives the slot-control list ordering). */\nexport function listSlotSids(slots: Record<string, unknown>): string[] {\n return Object.keys(slots ?? {})\n}\n\n// ── Slot → app-field derivation (Phase 3 — single source of truth) ────────────\n//\n// `deriveLottieSlotFields` turns a lottie-graphic plan's slot manifest into\n// ExposableField-shaped descriptors. ONE function feeds three surfaces: the\n// editor's publish picker, the published-app runtime, and the backend MCP\n// schema extractor — so the set of slots an app exposes can never drift between\n// them. It deliberately mirrors `describeSlotControl`'s classification (the\n// editor's live slot controls use the same source of truth).\n\n/** Prefix for the synthetic field key of a derived slot field: `slot:<sid>`. */\nexport const LOTTIE_SLOT_FIELD_PREFIX = \"slot:\"\n\n/** \"primaryColor\" → \"Primary Color\"; \"bar_size\" → \"Bar Size\". */\nexport function humanizeSlotSid(sid: string): string {\n return sid\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .replace(/[_-]+/g, \" \")\n .replace(/\\s+/g, \" \")\n .trim()\n .replace(/\\b\\w/g, (c) => c.toUpperCase())\n}\n\n/** ExposableField-shaped descriptor derived from one slot. */\nexport interface LottieSlotField {\n /** Synthetic field key: `slot:<sid>`. */\n key: string\n /** Humanized sid (camelCase / snake_case → Title Case). */\n label: string\n /** Maps onto the `ExposableField.type` members used in apps. */\n type: \"color\" | \"text\" | \"slider\"\n min?: number\n max?: number\n step?: number\n /** Hex string for color; raw value for text/number. */\n defaultValue?: unknown\n}\n\n/**\n * Derive ExposableField-shaped descriptors from a motion-graphics node's plan.\n *\n * Returns [] unless `motionPlan.planType === \"lottie-graphic\"` and `slots` is a\n * non-empty object — the elements engine and absent plans expose nothing.\n *\n * Per slot, via `describeSlotControl`:\n * - color → `{ type: \"color\", defaultValue: rgbaArrayToHex(value) }`\n * - text → `{ type: \"text\", defaultValue: value }`\n * - number → `{ type: \"slider\", min, max, step, defaultValue: value }`\n * (0–1 values → 0..1 step 0.01; larger → 0..ceil(value*2) step 1)\n * - point / null → SKIPPED. Point-kind slots are intentionally not exposed in\n * apps (no paired-number card; positions are rarely end-user-meaningful).\n */\nexport function deriveLottieSlotFields(\n motionPlan: Record<string, unknown> | undefined,\n): LottieSlotField[] {\n if (!motionPlan || motionPlan.planType !== \"lottie-graphic\") return []\n const slots = motionPlan.slots\n if (!isPlainObject(slots)) return []\n\n const fields: LottieSlotField[] = []\n for (const [sid, slot] of Object.entries(slots)) {\n const control = describeSlotControl(slot)\n if (!control) continue\n const base = { key: `${LOTTIE_SLOT_FIELD_PREFIX}${sid}`, label: humanizeSlotSid(sid) }\n\n if (control.kind === \"color\") {\n fields.push({\n ...base,\n type: \"color\",\n defaultValue: rgbaArrayToHex(control.value as number[]),\n })\n } else if (control.kind === \"text\") {\n fields.push({ ...base, type: \"text\", defaultValue: control.value })\n } else if (control.kind === \"number\") {\n const value = Number(control.value)\n const isUnit = value <= 1\n fields.push({\n ...base,\n type: \"slider\",\n min: 0,\n max: isUnit ? 1 : Math.ceil(value * 2) || 100,\n step: isUnit ? 0.01 : 1,\n defaultValue: control.value,\n })\n }\n // point / unrecognized kinds are intentionally not exposed.\n }\n return fields\n}\n","/**\n * Built-in Lottie Overlay catalog — single source of truth.\n *\n * The Lottie Overlay node ships a curated set of 12 animations the overlay LLM\n * can pick from. They were originally served from the third-party lottie.host\n * CDN, which went dead (origin returns 403) and broke every catalog-based\n * overlay render in production. The replacements were authored with our own\n * Lottie engine, baked (slots resolved, no `sid` refs), and are now self-hosted\n * on the Nodaro CDN at `https://cdn.nodaro.ai/lottie-catalog/<slug>.json`.\n *\n * This module is the ONE place the catalog lives:\n * - `LOTTIE_OVERLAY_CATALOG` feeds the overlay system prompt (the LLM's menu).\n * - `LEGACY_LOTTIE_HOST_REMAP` + `resolveLottieOverlaySrc` heal saved overlay\n * plans at render time — a plan authored before the cut-over still points at\n * a dead lottie.host URL, so the renderer rewrites it to its self-hosted\n * replacement before fetching.\n */\n\nexport interface LottieOverlayCatalogEntry {\n /** Stable system key — the R2 object is `lottie-catalog/<slug>.json`. */\n readonly slug: string\n /** Display name — mirrors the original prompt's catalog labels. */\n readonly name: string\n /** Catalog group (drives the grouped layout in the system prompt). */\n readonly group:\n | \"Celebration\"\n | \"Social / Reactions\"\n | \"UI / Indicators\"\n | \"Ambient / Decorative\"\n /** One placement-intent line for the overlay LLM. */\n readonly description: string\n /** Public CDN URL: `https://cdn.nodaro.ai/lottie-catalog/<slug>.json`. */\n readonly url: string\n /** Whether the animation is continuous (loop) or a one-shot effect. */\n readonly loop: boolean\n}\n\nconst CDN_BASE = \"https://cdn.nodaro.ai/lottie-catalog\"\n\nexport const LOTTIE_OVERLAY_CATALOG: readonly LottieOverlayCatalogEntry[] = [\n // ── Celebration ────────────────────────────────────────────────────────────\n {\n slug: \"confetti-burst\",\n name: \"Confetti burst\",\n group: \"Celebration\",\n description: \"Multicolor confetti shower — large coverage at a celebratory peak; one-shot.\",\n url: `${CDN_BASE}/confetti-burst.json`,\n loop: false,\n },\n {\n slug: \"fireworks\",\n name: \"Fireworks\",\n group: \"Celebration\",\n description: \"Bursting fireworks against the sky — big-moment payoff over the upper frame; one-shot.\",\n url: `${CDN_BASE}/fireworks.json`,\n loop: false,\n },\n {\n slug: \"party-popper\",\n name: \"Party popper\",\n group: \"Celebration\",\n description: \"Party popper streamers from a corner — a quick celebratory accent; one-shot.\",\n url: `${CDN_BASE}/party-popper.json`,\n loop: false,\n },\n {\n slug: \"stars-sparkle\",\n name: \"Stars sparkle\",\n group: \"Celebration\",\n description: \"Twinkling stars/sparkles — small accent over a highlight; loops.\",\n url: `${CDN_BASE}/stars-sparkle.json`,\n loop: true,\n },\n // ── Social / Reactions ──────────────────────────────────────────────────────\n {\n slug: \"heart-pulse\",\n name: \"Heart pulse\",\n group: \"Social / Reactions\",\n description: \"Pulsing heart reaction — medium size at a corner or edge; loops.\",\n url: `${CDN_BASE}/heart-pulse.json`,\n loop: true,\n },\n {\n slug: \"thumbs-up\",\n name: \"Thumbs up\",\n group: \"Social / Reactions\",\n description: \"Thumbs-up approval reaction — medium size, pops in once; one-shot.\",\n url: `${CDN_BASE}/thumbs-up.json`,\n loop: false,\n },\n {\n slug: \"fire-flame\",\n name: \"Fire emoji\",\n group: \"Social / Reactions\",\n description: \"Flickering flame reaction (“this is fire”) — small size at an edge; loops.\",\n url: `${CDN_BASE}/fire-flame.json`,\n loop: true,\n },\n // ── UI / Indicators ─────────────────────────────────────────────────────────\n {\n slug: \"loading-spinner\",\n name: \"Loading spinner\",\n group: \"UI / Indicators\",\n description: \"Circular loading spinner — small, centered, signals progress; loops.\",\n url: `${CDN_BASE}/loading-spinner.json`,\n loop: true,\n },\n {\n slug: \"checkmark-success\",\n name: \"Checkmark success\",\n group: \"UI / Indicators\",\n description: \"Animated success checkmark — small, marks a completed/correct moment; one-shot.\",\n url: `${CDN_BASE}/checkmark-success.json`,\n loop: false,\n },\n {\n slug: \"arrow-pointer\",\n name: \"Arrow pointer\",\n group: \"UI / Indicators\",\n description: \"Animated arrow drawing attention to a spot — small, timed to a key area; loops.\",\n url: `${CDN_BASE}/arrow-pointer.json`,\n loop: true,\n },\n // ── Ambient / Decorative ────────────────────────────────────────────────────\n {\n slug: \"floating-particles\",\n name: \"Floating particles\",\n group: \"Ambient / Decorative\",\n description: \"Soft drifting particles — large coverage, low opacity, full-duration ambience; loops.\",\n url: `${CDN_BASE}/floating-particles.json`,\n loop: true,\n },\n {\n slug: \"glowing-ring\",\n name: \"Glowing ring\",\n group: \"Ambient / Decorative\",\n description: \"Pulsing glowing ring/halo — decorative accent around a focal point; loops.\",\n url: `${CDN_BASE}/glowing-ring.json`,\n loop: true,\n },\n] as const\n\n/**\n * Dead lottie.host URLs (origin returns 403) → their replacement catalog URLs.\n * Heals saved plans at render time. The keys are copied EXACTLY from the\n * original `lottie-overlay-system.ts` prompt — they are the literal `src`\n * strings the overlay LLM emitted before the cut-over.\n */\nexport const LEGACY_LOTTIE_HOST_REMAP: Readonly<Record<string, string>> = {\n // Celebration\n \"https://lottie.host/d7313e87-e4c9-4e0d-8e03-c3a59e87d8fb/TjHnrCGBjI.json\": `${CDN_BASE}/confetti-burst.json`,\n \"https://lottie.host/d5cad0dd-4e93-4bbe-b023-e94a04bc1581/JHEZMrqfMk.json\": `${CDN_BASE}/fireworks.json`,\n \"https://lottie.host/0060c9cd-75da-42d5-af7c-1a191fa8a8fd/c1xHMRnGTO.json\": `${CDN_BASE}/party-popper.json`,\n \"https://lottie.host/c04a2758-a1d9-40a9-b81f-6f3e4e13a88c/xKCYDU2w0O.json\": `${CDN_BASE}/stars-sparkle.json`,\n // Social / Reactions\n \"https://lottie.host/44c9e8d1-856c-4641-bfbe-d0e2a5c9850e/GIBsMSIkkq.json\": `${CDN_BASE}/heart-pulse.json`,\n \"https://lottie.host/9a611d56-1f35-4f51-9fa4-6a4daa6b8714/EH71MjHKPD.json\": `${CDN_BASE}/thumbs-up.json`,\n \"https://lottie.host/66db1de9-c1a8-4d0b-bb03-47a8932a8a86/q5JBGQ8fxu.json\": `${CDN_BASE}/fire-flame.json`,\n // UI / Indicators\n \"https://lottie.host/b03d748c-3b4a-4c07-a10c-e9eb3c967349/eMVAVEnb5x.json\": `${CDN_BASE}/loading-spinner.json`,\n \"https://lottie.host/3ffaab4a-58b0-4a72-9f1c-5eaa484d8c88/g27v7IPaJc.json\": `${CDN_BASE}/checkmark-success.json`,\n \"https://lottie.host/6f831c6e-693a-4d1d-90a0-d7e2b3f00e68/PFj0MwSPrj.json\": `${CDN_BASE}/arrow-pointer.json`,\n // Ambient / Decorative\n \"https://lottie.host/9c8e1aef-f8e5-4ce8-bc80-1647ffb0724d/mNDClfKJVB.json\": `${CDN_BASE}/floating-particles.json`,\n \"https://lottie.host/b5d3e7e7-40bc-44fa-9a53-78b98ad66e80/pQVdNsVDmQ.json\": `${CDN_BASE}/glowing-ring.json`,\n}\n\n/**\n * Resolve an overlay `src` through the legacy remap: a dead lottie.host URL is\n * rewritten to its self-hosted replacement; everything else (already-migrated\n * catalog URLs, user-provided assets) passes through unchanged.\n */\nexport function resolveLottieOverlaySrc(src: string): string {\n return LEGACY_LOTTIE_HOST_REMAP[src] ?? src\n}\n","/**\n * Audio FX node — preset id union (single source of truth).\n *\n * Shared so the backend Zod route enum, the frontend config dropdown, and the\n * `AudioFxData` node type can't drift. The per-preset FFmpeg filter chains\n * (IR DUR/SHAPE, delay/EQ knobs) live in the backend provider's PRESET_CHAINS\n * map — this file only fixes the id set + their human labels.\n *\n * Reverb presets are named by ON-SCREEN SCENARIO (where the voice is happening\n * in the scene) rather than abstract size, so a creator picking \"Church\" or\n * \"Car\" gets a believable space for that shot.\n */\n\nexport const AUDIO_FX_PRESETS = [\n // — reverb / spaces (afir + inline-synth IR), ordered small → large —\n \"room\", // ordinary indoor room — bedroom / office dialogue\n \"bathroom\", // small, bright, tiled — hard early reflections\n \"car\", // tight, very damped cabin\n \"hall\", // lobby / corridor / large room\n \"concert-hall\", // big, lush, musical tail\n \"church\", // cathedral — long, dark, reverberant\n \"cave\", // dark, diffuse, long\n \"arena\", // stadium / PA — huge, bright tail\n \"outdoor\", // open air — almost dry, faint early reflections\n // — character / non-reverb —\n \"telephone\", // band-limited phone line\n \"megaphone\", // PA / bullhorn — mid-forward + light grit\n \"echo\", // discrete echo / slap-back\n \"custom\", // manual: reverb wet · delay · EQ\n] as const\n\nexport type AudioFxPreset = (typeof AUDIO_FX_PRESETS)[number]\n\nexport const AUDIO_FX_PRESET_SET: ReadonlySet<string> = new Set(AUDIO_FX_PRESETS)\n\n/** Display labels for the config dropdown. */\nexport const AUDIO_FX_PRESET_LABELS: Record<AudioFxPreset, string> = {\n room: \"Room (indoor)\",\n bathroom: \"Bathroom\",\n car: \"Car interior\",\n hall: \"Hall / Lobby\",\n \"concert-hall\": \"Concert Hall\",\n church: \"Church\",\n cave: \"Cave\",\n arena: \"Arena / Stadium\",\n outdoor: \"Outdoor (open air)\",\n telephone: \"Telephone\",\n megaphone: \"Megaphone / PA\",\n echo: \"Echo / Slap-back\",\n custom: \"Custom\",\n}\n\n/** Presets that apply convolution reverb (afir + inline-synth IR). */\nexport const AUDIO_FX_REVERB_PRESETS: ReadonlySet<AudioFxPreset> = new Set<AudioFxPreset>([\n \"room\",\n \"bathroom\",\n \"car\",\n \"hall\",\n \"concert-hall\",\n \"church\",\n \"cave\",\n \"arena\",\n \"outdoor\",\n])\n","/**\n * Video Mask — text-prompted video segmentation (SAM 3.1 / SAM 3). The wire contract of\n * the `video-mask` node, `POST /v1/video-mask`, the `video_mask` MCP verb,\n * `client.media.videoMask` and `nodaro media video-mask`, defined ONCE:\n * - every bound the route schema, the node panel and the MCP verb read;\n * - `videoMaskBilledSeconds`: the length a run is priced at — the clip's\n * length at the 30 fps basis, so a 60 fps clip is priced at twice its\n * length (the segmentation works per FRAME);\n * - `videoMaskCreditId`: which price row (`model_pricing`) that length is\n * charged from. The credit amounts live in the rows, never here.\n *\n * Worked examples (repeated in docs/nodes/ai-video/video-mask.md):\n * 4 s at 30 fps → `sam-3.1-video:5s`, 5.005 s at 29.97 fps → `sam-3.1-video:5s`, 12 s at 24 fps → `sam-3.1-video:15s`,\n * 10 s at 60 fps (priced as 20 s) → `sam-3.1-video:30s`, 45 s at 30 fps → `sam-3.1-video:60s`,\n * 100 s at 30 fps → `sam-3.1-video:120s`, 4 min at 30 fps on SAM 3 → `sam-3-video:240s`.\n *\n * Wire contract only — no I/O.\n */\nimport { pricedClipSeconds } from \"./priced-clip-seconds.js\"\n\n/** Segmentation models a Video Mask run can use. SAM 3.1 (the default)\n * tracks several objects in one pass and runs faster; SAM 3 costs half. */\nexport const VIDEO_MASK_PROVIDERS = [\"sam-3.1\", \"sam-3\"] as const\nexport type VideoMaskProvider = (typeof VIDEO_MASK_PROVIDERS)[number]\nexport const DEFAULT_VIDEO_MASK_PROVIDER: VideoMaskProvider = \"sam-3.1\"\n\n/**\n * `zone`: keep only the subjects whose bounding-box CENTRE lies inside an\n * inner rectangle, given as margins in % of the frame (each\n * `VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN`–`ZONE_MARGIN_PCT_MAX`). All zero, or\n * no zone, = off.\n */\nexport interface VideoMaskZone {\n readonly leftPct: number\n readonly rightPct: number\n readonly topPct: number\n readonly bottomPct: number\n}\n\n/** A new Video Mask node's settings — spread into its node definition. */\nexport const VIDEO_MASK_DEFAULTS = {\n threshold: 0.5,\n provider: \"sam-3.1\" as VideoMaskProvider,\n /** Off: the mask is the model's, frame for frame (see `HOLD_EMPTY_BELOW_FRACTION`). */\n holdLastMask: false,\n /** 0 = off: every region the model finds is kept (see `MIN_SUBJECT_HEIGHT_PCT_*`). */\n minSubjectHeightPct: 0,\n /** 0 = off: no ceiling on a region's height (see `MAX_SUBJECT_HEIGHT_PCT_*`). */\n maxSubjectHeightPct: 0,\n /** Off: subjects anywhere in the frame are kept (see `ZONE_MARGIN_PCT_*`). */\n zone: null as VideoMaskZone | null,\n /**\n * Off: one pass over the whole clip. On: the clip's scene cuts are found\n * first and each shot is segmented on its own — the model starts afresh\n * after every cut (finding the new shot's subjects), and `holdLastMask`\n * never carries a mask across a cut. A clip with no cut (a flash is\n * usually not one) is one shot: the same mask, fitted to the clip's exact\n * frame count.\n */\n perShot: false,\n /**\n * 0 = off: a new detection only where a request starts anyway (the clip's\n * start, every 1,800 frames, and every cut with `perShot`). Above 0: the\n * model is also sent a new request every this many seconds of footage, so a\n * subject that first appears mid-shot is found within that time (see\n * `REDETECT_EVERY_SEC_*`). These boundaries are not cuts: `holdLastMask`\n * keeps holding across them.\n */\n redetectEverySec: 0,\n} as const\n\nexport const VIDEO_MASK_LIMITS = {\n /** The longest input clip a run accepts, in seconds of PRICED length (see `videoMaskBilledSeconds`). */\n MAX_BILLED_SEC: 300,\n /** Frame rate the price rows assume. A faster clip is priced proportionally longer. */\n FPS_BASIS: 30,\n /** Subject description length cap. */\n PROMPT_MAX_LENGTH: 500,\n /** Detection confidence bounds (the model's own range, narrowed to useful values). */\n THRESHOLD_MIN: 0.05,\n THRESHOLD_MAX: 0.95,\n THRESHOLD_STEP: 0.05,\n /** Default detection confidence. Lower finds more (and less precise) regions. */\n THRESHOLD_DEFAULT: VIDEO_MASK_DEFAULTS.threshold,\n /**\n * `holdLastMask`: a frame whose mask covers less than this fraction of the\n * picture (0.002 % — about 41 px at 1080p: a stray speck, never a subject) counts as empty — the subject lost (hidden behind a\n * hand, turned away) — and shows the most recent non-empty frame's mask\n * instead. Frames before the first detection stay as they are.\n */\n HOLD_EMPTY_BELOW_FRACTION: 0.00002,\n /**\n * `holdLastMask`: the longest a mask is held, in seconds of frames (at the\n * clip's rate). The hold is for a subject hidden for a moment; a run of\n * empty frames longer than this shows the held mask for its first second\n * and then nothing, until the model finds the subject again — a mask held\n * on for longer sits where the subject no longer is.\n */\n HOLD_MAX_SEC: 1,\n /**\n * `minSubjectHeightPct`: drop every connected white region (8-connected)\n * whose bounding box is shorter than this % of the frame height — extras'\n * small faces behind the main subject. 0 = off. Applied before\n * `holdLastMask`, so a frame left with only small regions counts as empty\n * and is held from the last frame with a big subject.\n */\n MIN_SUBJECT_HEIGHT_PCT_MIN: 0,\n MIN_SUBJECT_HEIGHT_PCT_MAX: 100,\n /**\n * `maxSubjectHeightPct`, the mirror: drop every region whose bounding box is\n * TALLER than this % of the frame height (keep only the small subjects — a\n * paste-back mask of the background faces). 0 = off. With both set, a\n * region is kept when min ≤ height ≤ max (min > max is refused). Same pass,\n * same order (before `holdLastMask`).\n */\n MAX_SUBJECT_HEIGHT_PCT_MIN: 0,\n MAX_SUBJECT_HEIGHT_PCT_MAX: 100,\n /**\n * `zone` margins (left / right / top / bottom, % of the frame width or\n * height): drop every connected region whose bounding-box centre lies\n * outside `[w·left/100, w·(1−right/100)] × [h·top/100, h·(1−bottom/100)]`\n * — the faces at the edges of the picture. At most 49 % a side, so the\n * inner rectangle is never empty. Applied after the size cut and before\n * `holdLastMask`, so a frame left with nothing inside counts as empty.\n */\n ZONE_MARGIN_PCT_MIN: 0,\n ZONE_MARGIN_PCT_MAX: 49,\n /**\n * `redetectEverySec`: 0 (off) or `REDETECT_EVERY_SEC_MIN`–`MAX` seconds. The\n * model picks up its subjects near the start of each request; a face that\n * turns to the camera, or a person who walks in, partway through a request is\n * never masked. On, the clip (each shot, with `perShot`) is cut into requests\n * of at most this many seconds of frames — counted from the shot's start, a\n * last piece shorter than `VIDEO_MASK_MIN_SHOT_FRAMES` joining the one before\n * — so the subjects are detected again at every such boundary. Each request\n * adds wall time (they run three at a time); the price follows the clip's\n * length and does not change.\n */\n REDETECT_EVERY_SEC_MIN: 1,\n REDETECT_EVERY_SEC_MAX: 10,\n /** The panel's step (the API takes any value in range). */\n REDETECT_EVERY_SEC_STEP: 1,\n} as const\n\n/**\n * The version of what a Video Mask run's mask looks like for a given clip and\n * settings: every finished `video-mask` job reports it as `output_data.recipe`.\n * A mask stored ahead of time and reused (a trend's approved face mask) is\n * held to it, and reads as out of date once it changes.\n *\n * BUMP IT (to the date of the change) whenever the algorithm changes the mask\n * a run produces from the same clip and settings: the cut rule (`perShot`),\n * the hold (`holdLastMask`, `HOLD_*`), the size and zone filters, the\n * rendering. Never for a change that leaves every mask the same (pricing,\n * limits on what is accepted, messages). `\"2026-10-25\"`: the lone-spike cut\n * rule and the 1 s hold cap.\n */\nexport const VIDEO_MASK_RECIPE = \"2026-10-25\"\n\nconst VIDEO_MASK_BUCKETS_SEC = [5, 10, 15, 30, 60, 90, 120, 180, 240, 300] as const\n\n/** Every price row a provider can be charged from, smallest first. */\nexport function videoMaskCreditIds(provider: VideoMaskProvider = DEFAULT_VIDEO_MASK_PROVIDER): string[] {\n return VIDEO_MASK_BUCKETS_SEC.map((sec) => `${provider}-video:${sec}s`)\n}\n\n/**\n * The length a clip is priced at: its duration at the 30 fps basis. A clip\n * at or under 30 fps is priced at its own length; a 60 fps clip at twice it.\n * An unknown frame rate counts as the basis. The cap reads this figure; the\n * price row reads it through `pricedClipSeconds`.\n */\nexport function videoMaskBilledSeconds(durationSec: number, fps?: number | null): number {\n const rate = typeof fps === \"number\" && Number.isFinite(fps) && fps > 0 ? fps : VIDEO_MASK_LIMITS.FPS_BASIS\n return durationSec * Math.max(1, rate / VIDEO_MASK_LIMITS.FPS_BASIS)\n}\n\n/**\n * The price row for a clip priced at `billedSec` seconds: the smallest that\n * holds it, after `pricedClipSeconds` (up to 0.05 s past a row's length stays in\n * that row). An unknown or non-positive length prices the LONGEST row (a clip\n * the route could not measure is refused, so this is only the pre-run quote for\n * a clip whose length is not known yet); anything past the cap prices the last\n * row.\n */\nexport function videoMaskCreditId(\n billedSec: number | null | undefined,\n provider: VideoMaskProvider = DEFAULT_VIDEO_MASK_PROVIDER,\n): string {\n const ids = videoMaskCreditIds(provider)\n if (typeof billedSec !== \"number\" || !Number.isFinite(billedSec) || billedSec <= 0) return ids[ids.length - 1]!\n const priced = pricedClipSeconds(billedSec)\n const i = VIDEO_MASK_BUCKETS_SEC.findIndex((b) => priced <= b)\n return ids[i === -1 ? ids.length - 1 : i]!\n}\n\n/** Narrow an arbitrary value to a known provider, falling back to the default. */\nexport function resolveVideoMaskProvider(value: unknown): VideoMaskProvider {\n return (VIDEO_MASK_PROVIDERS as readonly string[]).includes(value as string)\n ? (value as VideoMaskProvider)\n : DEFAULT_VIDEO_MASK_PROVIDER\n}\n\n/**\n * A zone as the region filter reads it: each margin a finite number clamped\n * to `ZONE_MARGIN_PCT_MIN`–`ZONE_MARGIN_PCT_MAX` (anything else is 0), and\n * null when there is no zone or every margin is 0 (off). The one reading\n * shared by the worker, a workflow run's payload and the node's own run.\n */\nexport function resolveVideoMaskZone(value: unknown): VideoMaskZone | null {\n if (!value || typeof value !== \"object\") return null\n const v = value as Record<string, unknown>\n const margin = (x: unknown) =>\n typeof x === \"number\" && Number.isFinite(x)\n ? Math.min(VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MAX, Math.max(VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN, x))\n : 0\n const zone = { leftPct: margin(v.leftPct), rightPct: margin(v.rightPct), topPct: margin(v.topPct), bottomPct: margin(v.bottomPct) }\n return zone.leftPct > 0 || zone.rightPct > 0 || zone.topPct > 0 || zone.bottomPct > 0 ? zone : null\n}\n\n/**\n * `redetectEverySec` as a run reads it: a finite number above 0 clamped to\n * `REDETECT_EVERY_SEC_MIN`–`MAX` (a value between 0 and the minimum snaps up\n * to it — it asked for re-detection); anything else (absent, 0, negative,\n * not a number) is 0 = off. The one reading shared by the worker, a workflow\n * run's payload, the node's own run and its panel (the route refuses a value\n * out of range instead).\n */\nexport function resolveVideoMaskRedetectSec(value: unknown): number {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value <= 0) return 0\n return Math.min(VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MAX, Math.max(VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MIN, value))\n}\n\n/** `POST /v1/video-mask` request body. */\nexport interface VideoMaskRequest {\n /** The clip to segment. */\n readonly videoUrl: string\n /** What to track: a short noun phrase; separate several with commas. */\n readonly prompt: string\n /** Detection confidence, `VIDEO_MASK_LIMITS.THRESHOLD_MIN`–`THRESHOLD_MAX` (default 0.5). */\n readonly threshold?: number\n readonly provider?: VideoMaskProvider\n /** Hold the last mask where the subject is lost (default false): an empty frame\n * after the first detection repeats the most recent non-empty one. */\n readonly holdLastMask?: boolean\n /** Ignore subjects smaller than this % of the frame height, 0–100 (default 0 = off):\n * connected regions whose bounding box is shorter are dropped from every frame. */\n readonly minSubjectHeightPct?: number\n /** Ignore subjects larger than this % of the frame height, 0–100 (default 0 = off):\n * connected regions whose bounding box is taller are dropped from every frame. */\n readonly maxSubjectHeightPct?: number\n /** Keep only the subjects whose bounding-box centre is inside these margins, each\n * 0–49 % of the frame (a margin left out is 0). null / omitted / all 0 = off. */\n readonly zone?: Partial<VideoMaskZone> | null\n /** Segment each shot on its own (default false): the clip's scene cuts are found\n * first and the subjects are detected again in every shot; `holdLastMask` never\n * carries a mask across a cut. The output then carries `shots`. */\n readonly perShot?: boolean\n /** Detect the subjects again every this many seconds (0 = off, the default, or\n * `VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MIN`–`MAX`): the clip — each shot, with\n * `perShot` — is sent to the model in pieces of at most that length, so a subject\n * that first appears mid-shot is masked from the next boundary on. Not a cut:\n * `holdLastMask` holds across these boundaries. Slower (more requests); same price. */\n readonly redetectEverySec?: number\n}\n","/**\n * Video Face Mesh (`POST /v1/video-face-mesh`, job type `video-face-mesh`):\n * thin GRAY face lines — a wireframe, and darker eye and lip outlines, each a\n * tone of the picture under it — drawn on the faces of a clip, frame for\n * frame. An internal step of Nodaro Motion's face masking: the lines go on\n * the masked (or depth) clip so the video model still sees where the mouth\n * and the eyes are. A request may draw only the eye and lip outlines, only\n * the lip outline, or the face's contours (`parts`).\n *\n * Priced by the clip's length at the 30 fps basis Video Mask uses\n * (`videoMaskBilledSeconds`), one row per length bucket.\n */\nimport { pricedClipSeconds } from \"./priced-clip-seconds.js\"\nimport { VIDEO_MASK_LIMITS, type VideoMaskZone } from \"./video-mask.js\"\nimport type { VideoDepthColormap } from \"./video-depth.js\"\n\n/** The route, as the Cast Swap engine calls it. */\nexport const VIDEO_FACE_MESH_PATH = \"/v1/video-face-mesh\"\n\nexport const VIDEO_FACE_MESH_LIMITS = {\n /** The longest clip a run accepts, in seconds of PRICED length (the 30 fps basis): Video Mask's own cap. */\n MAX_BILLED_SEC: VIDEO_MASK_LIMITS.MAX_BILLED_SEC,\n /** `minFaceHeightPct` / `maxFaceHeightPct` bounds (0 = off). */\n FACE_HEIGHT_PCT_MIN: 0,\n FACE_HEIGHT_PCT_MAX: 100,\n /** `zone` margin bounds, as Video Mask's. */\n ZONE_MARGIN_PCT_MIN: VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN,\n ZONE_MARGIN_PCT_MAX: VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MAX,\n} as const\n\n/**\n * What a face mesh run draws on each face (`VideoFaceMeshRequest.parts`):\n * `\"full\"` (the default) the thin wireframe and the darker eye and lip\n * outlines; `\"features\"` the eye outlines and the lip outline only, no\n * wireframe; `\"mouth\"` the lip outline only; `\"contours\"` the face oval,\n * both eyebrows, the nose and the eye and lip outlines, no wireframe (a host\n * that draws them says so to its engine: `videoFaceMeshContours`).\n */\nexport const VIDEO_FACE_MESH_PARTS = [\"full\", \"features\", \"mouth\", \"contours\"] as const\nexport type VideoFaceMeshParts = (typeof VIDEO_FACE_MESH_PARTS)[number]\n\n/**\n * The face mesh's layers (`VideoFaceMeshRequest.layers`), each drawn or not\n * on its own:\n * - `wireframe`: the thin mesh over the whole face;\n * - `eyes`: the eye outlines; `lips`: the lip outline, outer and inner;\n * - `contours`: the face oval, both eyebrows and the nose. With it on, every\n * line drawn leaves out what the face hides (a turned face's far side);\n * with it off, nothing is left out;\n * - `irises`: a circle round each iris and a dot at its centre, drawn only\n * inside the eye's opening (an eyelid covers it, a closed eye hides it);\n * - `bold`: the lines drawn thicker and in a deeper tone. It draws nothing\n * of its own: it changes the lines of the other layers.\n * Every `parts` value is one set of layers (`videoFaceMeshLayersOfParts`),\n * drawn exactly as that value is.\n */\nexport const VIDEO_FACE_MESH_LAYERS = [\"wireframe\", \"eyes\", \"lips\", \"contours\", \"irises\", \"bold\"] as const\nexport type VideoFaceMeshLayer = (typeof VIDEO_FACE_MESH_LAYERS)[number]\n/** The layers that draw lines of their own (all but `bold`): a set needs at least one. */\nexport const VIDEO_FACE_MESH_LINE_LAYERS = [\"wireframe\", \"eyes\", \"lips\", \"contours\", \"irises\"] as const satisfies readonly VideoFaceMeshLayer[]\n/** A set of layers: each one on when `true`; left out or `false` is off. */\nexport type VideoFaceMeshLayers = { readonly [K in VideoFaceMeshLayer]?: boolean }\n\nconst PARTS_LAYERS: Readonly<Record<VideoFaceMeshParts, readonly VideoFaceMeshLayer[]>> = {\n full: [\"wireframe\", \"eyes\", \"lips\"],\n features: [\"eyes\", \"lips\"],\n mouth: [\"lips\"],\n contours: [\"eyes\", \"lips\", \"contours\"],\n}\n\n/** The set of layers a `parts` value draws (left out: `\"full\"`), a new object with only its layers, each `true`. */\nexport function videoFaceMeshLayersOfParts(parts: VideoFaceMeshParts = \"full\"): VideoFaceMeshLayers {\n return Object.fromEntries(PARTS_LAYERS[parts].map((l) => [l, true]))\n}\n\n/** The set with only its layers that are on, each `true`, in `VIDEO_FACE_MESH_LAYERS` order: a new object. */\nexport function videoFaceMeshLayersOn(layers: VideoFaceMeshLayers | null | undefined): VideoFaceMeshLayers {\n return Object.fromEntries(VIDEO_FACE_MESH_LAYERS.filter((l) => layers?.[l] === true).map((l) => [l, true]))\n}\n\n/** Whether the set draws any line (a layer other than `bold` on). */\nexport function videoFaceMeshLayersDrawLines(layers: VideoFaceMeshLayers | null | undefined): boolean {\n return VIDEO_FACE_MESH_LINE_LAYERS.some((l) => layers?.[l] === true)\n}\n\n/**\n * The `parts` value that draws exactly this set of layers, or undefined when\n * none does (a set only layers can name: the irises, bold lines, the eyes\n * alone…). `among` limits the values it may answer (a setting that takes only\n * some of them).\n */\nexport function videoFaceMeshPartsOfLayers(\n layers: VideoFaceMeshLayers | null | undefined,\n among: readonly VideoFaceMeshParts[] = VIDEO_FACE_MESH_PARTS,\n): VideoFaceMeshParts | undefined {\n const on = VIDEO_FACE_MESH_LAYERS.filter((l) => layers?.[l] === true)\n return among.find((p) => PARTS_LAYERS[p].length === on.length && PARTS_LAYERS[p].every((l) => on.includes(l)))\n}\n\n/**\n * The version of what a face mesh run draws for a given clip and settings:\n * every finished `video-face-mesh` job reports it as `output_data.recipe`,\n * for the caller to record beside a clip it stores with the lines on it (a\n * trend's approved face mask). Nothing on the platform compares it yet: a\n * stored mask is held to Video Mask's recipe and the engine's own.\n *\n * BUMP IT (to the date of the change) whenever the drawing changes for the\n * same input: the model, the crop, the smoothing, the filters, the colours or\n * the widths. Never for pricing, limits or messages. 2026-11-02: MediaPipe's\n * refined landmark model (478 points, a 256 × 256 crop) in place of the basic\n * one; the lines' colours and widths are 2026-11-01's. 2026-11-03: a face gets\n * lines only when it is found in at least 3 frames of its track (found faces\n * at the same place in frames at most 2 apart): one found in a frame or two\n * is never drawn.\n */\nexport const VIDEO_FACE_MESH_RECIPE = \"2026-11-03\"\n\nconst VIDEO_FACE_MESH_BUCKETS_SEC = [5, 10, 15, 30, 60, 120, 300] as const\n\n/** Every price row, smallest first (`video-face-mesh:<n>s`). */\nexport function videoFaceMeshCreditIds(): string[] {\n return VIDEO_FACE_MESH_BUCKETS_SEC.map((sec) => `video-face-mesh:${sec}s`)\n}\n\n/**\n * The price row for a clip priced at `billedSec` seconds: the smallest bucket\n * that holds it, after `pricedClipSeconds` (up to 0.05 s past a bucket's length\n * stays in that bucket). An unknown or non-positive length, or one past the cap,\n * prices the LONGEST row (the route measures every clip and refuses one past\n * the cap, so this is only ever a ceiling).\n */\nexport function videoFaceMeshCreditId(billedSec: number | null | undefined): string {\n const ids = videoFaceMeshCreditIds()\n if (typeof billedSec !== \"number\" || !Number.isFinite(billedSec) || billedSec <= 0) return ids[ids.length - 1]!\n const priced = pricedClipSeconds(billedSec)\n const i = VIDEO_FACE_MESH_BUCKETS_SEC.findIndex((b) => priced <= b)\n return ids[i === -1 ? ids.length - 1 : i]!\n}\n\n/** `POST /v1/video-face-mesh` request body. */\nexport interface VideoFaceMeshRequest {\n /** The clip the faces are FOUND in (the original). */\n readonly videoUrl: string\n /** The clip the lines are DRAWN on (default `videoUrl`): the masked or depth clip. Same frame count. */\n readonly drawOnUrl?: string\n /** A mask video (white = covered, same frame count): only faces whose box centre lies inside it are drawn. */\n readonly maskUrl?: string\n /** Draw only faces at least this % of the frame's height (default 0 = off). */\n readonly minFaceHeightPct?: number\n /** Draw only faces at most this % of the frame's height (0 = no cap). */\n readonly maxFaceHeightPct?: number\n /** Margins (% of the frame) where no face is drawn. */\n readonly zone?: Partial<VideoMaskZone> | null\n /**\n * The depth map's colormap (Video Depth's `VIDEO_DEPTH_COLORMAPS`) when the\n * lines go on a depth map: each line is then a colour OF that map — the map\n * at the line's tone of the depth under it. Needs `depthUrl`, except\n * `grayscale` (a gray depth clip is its own depth). Left out with a\n * `depthUrl`: `grayscale`.\n */\n readonly colormap?: VideoDepthColormap\n /**\n * The GRAYSCALE depth render of the clip (Video Depth with `colormap:\n * \"grayscale\"`, same frame count as `videoUrl`, any size): the depth each\n * line's colour is read from. Left out (a blurred mask, a gray depth clip\n * drawn on directly): each line is a gray tone of the pixel under it.\n */\n readonly depthUrl?: string\n /**\n * What is drawn on each face (`VIDEO_FACE_MESH_PARTS`): left out or\n * `\"full\"`, the wireframe and the eye and lip outlines; `\"features\"`, the\n * eye and lip outlines only; `\"mouth\"`, the lip outline only. The outlines\n * are drawn as they are in the full mesh (the same tone and width).\n */\n readonly parts?: VideoFaceMeshParts\n /**\n * What is drawn, layer by layer (`VIDEO_FACE_MESH_LAYERS`), in place of\n * `parts` (never both). At least one layer other than `bold`. A set that is\n * a `parts` value's draws exactly as that value does.\n */\n readonly layers?: VideoFaceMeshLayers\n}\n\n/** A finished `video-face-mesh` job's `output_data`. */\nexport interface VideoFaceMeshOutput {\n /** The drawn clip: `drawOnUrl`'s frame count, size and frame rate, its audio copied untouched. */\n readonly videoUrl: string\n readonly width: number\n readonly height: number\n readonly frames: number\n /** Frames with at least one face drawn. */\n readonly framesWithFaces: number\n /** Faces drawn, summed over the frames (0 = nothing drawn; the clip comes back as it was sent). */\n readonly facesDrawn: number\n /** The map the lines were coloured from (a request with `depthUrl`); absent = gray tones of the pixel under them. */\n readonly colormap?: VideoDepthColormap\n /** What was drawn when it was not the full mesh (a request with `parts` `\"features\"` or `\"mouth\"`); absent = the full mesh. */\n readonly parts?: Exclude<VideoFaceMeshParts, \"full\">\n /** The layers drawn, for a request that named `layers` (only those on, each `true`); absent: `parts` says. */\n readonly layers?: VideoFaceMeshLayers\n readonly recipe: string\n}\n","/**\n * Generate Mask — text-prompted IMAGE segmentation (Grounded SAM). The wire\n * contract of `POST /v1/generate-mask`, the `generate_mask` MCP verb, the SDK's\n * `nodes.run(\"generate-mask\", …)` and `nodaro media generate-mask`, defined ONCE:\n * every bound the route schema and the SDK/CLI read.\n *\n * The finished job's output is `{ maskUrl, imageUrl }`: `maskUrl` is the\n * black-and-white mask PNG (white = the subject), `imageUrl` is the SOURCE\n * image passed through unchanged, so an inpainting step can take the pair.\n *\n * Wire contract only — no I/O.\n */\n\nexport const GENERATE_MASK_LIMITS = {\n /** Subject description length cap. */\n PROMPT_MAX_LENGTH: 500,\n /** Segmentation confidence bounds. */\n THRESHOLD_MIN: 0,\n THRESHOLD_MAX: 1,\n /** Default segmentation confidence. Lower selects more (and less precise) regions. */\n THRESHOLD_DEFAULT: 0.3,\n} as const\n\n/** `POST /v1/generate-mask` request body. */\nexport interface GenerateMaskRequest {\n /** The image to segment. */\n readonly imageUrl: string\n /** What to select, in plain words (e.g. \"the person\", \"sky and clouds\"). 1–500 characters. */\n readonly prompt: string\n /** Segmentation confidence, `GENERATE_MASK_LIMITS.THRESHOLD_MIN`–`THRESHOLD_MAX` (default 0.3). */\n readonly threshold?: number\n}\n\n/** A completed Generate Mask job's `output_data`. */\nexport interface GenerateMaskOutput {\n /** The mask: a black-and-white PNG, white = the subject. */\n readonly maskUrl: string\n /** The source image, passed through unchanged. */\n readonly imageUrl: string\n}\n","/**\n * Mask Composite — place a foreground video over a background video through a\n * mask video (white = keep the foreground, black = show the background). The\n * wire contract of the `mask-composite` node, `POST /v1/mask-composite`, the\n * `mask_composite` MCP verb, `client.media.maskComposite` and\n * `nodaro media mask-composite`, defined ONCE. Pair it with Video Mask, whose\n * output is exactly such a mask.\n *\n * The render follows the FOREGROUND: its size, frame rate and length. The\n * background is fitted to that frame (`backgroundFit`) and loops when shorter;\n * the mask is stretched to the frame and holds its last frame when shorter.\n *\n * `fill` picks what fills the masked area. `\"video\"` (the default) is the\n * foreground, as above. `\"pixelate\"` and `\"blur\"` fill it with the BACKGROUND\n * itself, pixelated or blurred: there is no foreground then (a sent\n * `foregroundUrl` is ignored), so the render follows the BACKGROUND (its size,\n * frame rate and length; `backgroundFit` has nothing to fit), and the run is\n * priced on the background's length. With no foreground the result always\n * carries the background's sound — `audioSource` is ignored there\n * ({@link maskCompositeEffectiveAudioSource}); the canvas hides the control.\n *\n * Priced per started 5 seconds of the result (the foreground's length), like\n * Trim / Loop / Combine Videos: the node's own `model_pricing` row is ONE unit\n * (`maskCompositeUnits` counts them). Worked examples (repeated in\n * docs/nodes/processing-video/mask-composite.md, at the 10-credit row):\n * 3 s → 1 unit (10), 10 s → 2 units (20), 61 s → 13 units (130), 5 min → 60 units (600).\n *\n * Wire contract only — no I/O.\n */\nimport { pricedClipSeconds } from \"./priced-clip-seconds.js\"\n\n/** How the background is fitted to the foreground's frame. */\nexport const MASK_COMPOSITE_BACKGROUND_FITS = [\"cover\", \"contain\", \"stretch\"] as const\nexport type MaskCompositeBackgroundFit = (typeof MASK_COMPOSITE_BACKGROUND_FITS)[number]\n\n/** What fills the masked area: the foreground video, or the background itself pixelated or blurred. */\nexport const MASK_COMPOSITE_FILLS = [\"video\", \"pixelate\", \"blur\"] as const\nexport type MaskCompositeFill = (typeof MASK_COMPOSITE_FILLS)[number]\n\n/** Which sound the result carries. `mix` blends both tracks at equal level. */\nexport const MASK_COMPOSITE_AUDIO_SOURCES = [\"foreground\", \"background\", \"mix\", \"none\"] as const\nexport type MaskCompositeAudioSource = (typeof MASK_COMPOSITE_AUDIO_SOURCES)[number]\n\nexport const MASK_COMPOSITE_BOUNDS = {\n /** Edge softening, pixels of blur radius on the mask (0 = hard edge). */\n FEATHER_MIN: 0,\n FEATHER_MAX: 20,\n /** Grow (+) or shrink (−) the white region, pixels. */\n GROW_MIN: -10,\n GROW_MAX: 10,\n /** How strongly the foreground covers the background inside the mask\n * (1 = fully, today's output; 0 = not at all). */\n OPACITY_MIN: 0,\n OPACITY_MAX: 1,\n /** Pixelate: the block size as a % of the frame's WIDTH (relative, so a\n * setting looks the same at any resolution); the worker makes the blocks\n * max(2, round(width × pct / 100)) px. 1.25 % = 16 px on a 1280-wide frame. */\n PIXEL_SIZE_PCT_MIN: 0.2,\n PIXEL_SIZE_PCT_MAX: 10,\n /** Blur: the gaussian's sigma as a % of the frame's WIDTH (2 % ≈ sigma 25 px on a 1280-wide frame). */\n BLUR_STRENGTH_PCT_MIN: 0.1,\n BLUR_STRENGTH_PCT_MAX: 5,\n /** The longest leading video (the foreground; the background when `fill` is not video) a run accepts, seconds. */\n MAX_DURATION_SEC: 300,\n} as const\n\n/** Seconds of result one pricing unit covers. */\nexport const MASK_COMPOSITE_UNIT_SEC = 5\n\n/**\n * How much longer, in seconds, the leading video the render downloads may run\n * than the one measured before the run was charged, before the render refuses\n * it as changed: a re-measure can read a hair longer (a re-encode, a\n * container's rounding), and that is not a different file. Applied to the\n * seconds, never to the units, before the price's own 0.05 s grace\n * (`pricedClipSeconds`): a run billed for 10 s renders a lead of up to about\n * 10.55 s. The same slack as Video Overlay's base.\n */\nexport const MASK_COMPOSITE_REMEASURE_SLACK_SEC = 0.5\n\n/**\n * Pricing units for a result `durationSec` long: one per started 5 seconds,\n * at least one, after `pricedClipSeconds` (up to 0.05 s past a whole second is\n * ignored, so a 10.01 s result is 2 units, not 3). An unknown length counts the\n * longest result a run accepts (an upper bound — the pre-run quote for a clip\n * whose length is not known yet; every run measures its foreground).\n */\nexport function maskCompositeUnits(durationSec: number | null | undefined): number {\n const sec =\n typeof durationSec === \"number\" && Number.isFinite(durationSec) && durationSec > 0\n ? Math.min(durationSec, MASK_COMPOSITE_BOUNDS.MAX_DURATION_SEC)\n : MASK_COMPOSITE_BOUNDS.MAX_DURATION_SEC\n return Math.ceil(pricedClipSeconds(sec) / MASK_COMPOSITE_UNIT_SEC)\n}\n\nexport const MASK_COMPOSITE_DEFAULTS = {\n invertMask: false,\n feather: 2,\n grow: 0,\n opacity: 1,\n fill: \"video\" as MaskCompositeFill,\n pixelSizePct: 1.25,\n blurStrengthPct: 2,\n backgroundFit: \"cover\" as MaskCompositeBackgroundFit,\n audioSource: \"foreground\" as MaskCompositeAudioSource,\n} as const\n\nexport interface MaskCompositeSettings {\n readonly invertMask: boolean\n readonly feather: number\n readonly grow: number\n /** Inside the mask: opacity × foreground + (1 − opacity) × background. */\n readonly opacity: number\n /** What fills the masked area (`video` = the foreground). */\n readonly fill: MaskCompositeFill\n /** Pixelate block size, % of the frame width (used when `fill` is `pixelate`). */\n readonly pixelSizePct: number\n /** Blur strength: the gaussian's sigma as a % of the frame width (used when `fill` is `blur`). */\n readonly blurStrengthPct: number\n readonly backgroundFit: MaskCompositeBackgroundFit\n readonly audioSource: MaskCompositeAudioSource\n}\n\nconst clampInt = (v: unknown, min: number, max: number, fallback: number): number =>\n typeof v === \"number\" && Number.isFinite(v) ? Math.min(max, Math.max(min, Math.round(v))) : fallback\n\nconst clampNumber = (v: unknown, min: number, max: number, fallback: number): number =>\n typeof v === \"number\" && Number.isFinite(v) ? Math.min(max, Math.max(min, v)) : fallback\n\n/**\n * Node data (or any loose object) → settings every engine renders with.\n * Unknown enum values fall back to the default and numbers are clamped, so a\n * node written straight into workflow JSON renders the same as one set in the\n * panel. The ONE normaliser both workflow engines and the worker call.\n */\nexport function resolveMaskCompositeSettings(data: Readonly<Record<string, unknown>>): MaskCompositeSettings {\n const d = MASK_COMPOSITE_DEFAULTS\n const b = MASK_COMPOSITE_BOUNDS\n return {\n invertMask: typeof data.invertMask === \"boolean\" ? data.invertMask : d.invertMask,\n feather: clampInt(data.feather, b.FEATHER_MIN, b.FEATHER_MAX, d.feather),\n grow: clampInt(data.grow, b.GROW_MIN, b.GROW_MAX, d.grow),\n opacity: clampNumber(data.opacity, b.OPACITY_MIN, b.OPACITY_MAX, d.opacity),\n fill: maskCompositeFillOf(data),\n pixelSizePct: clampNumber(data.pixelSizePct, b.PIXEL_SIZE_PCT_MIN, b.PIXEL_SIZE_PCT_MAX, d.pixelSizePct),\n blurStrengthPct: clampNumber(data.blurStrengthPct, b.BLUR_STRENGTH_PCT_MIN, b.BLUR_STRENGTH_PCT_MAX, d.blurStrengthPct),\n backgroundFit: (MASK_COMPOSITE_BACKGROUND_FITS as readonly string[]).includes(data.backgroundFit as string)\n ? (data.backgroundFit as MaskCompositeBackgroundFit)\n : d.backgroundFit,\n audioSource: (MASK_COMPOSITE_AUDIO_SOURCES as readonly string[]).includes(data.audioSource as string)\n ? (data.audioSource as MaskCompositeAudioSource)\n : d.audioSource,\n }\n}\n\n/** The fill a node, payload or request body asks for: an unknown value is `video` (the default). */\nexport function maskCompositeFillOf(data: Readonly<Record<string, unknown>> | null | undefined): MaskCompositeFill {\n const f = data?.fill\n return (MASK_COMPOSITE_FILLS as readonly string[]).includes(f as string) ? (f as MaskCompositeFill) : MASK_COMPOSITE_DEFAULTS.fill\n}\n\n/** Does this fill take a foreground video? Only `video` does; pixelate and blur fill from the background. */\nexport function maskCompositeUsesForeground(fill: MaskCompositeFill): boolean {\n return fill === \"video\"\n}\n\n/**\n * The input whose size, rate and length the result has (and so the one a run\n * is measured and priced on): the canvas handle — `video` (the foreground) for\n * the video fill, `background-video` for pixelate and blur. The one rule the\n * route, the workflow run, the run estimates and the length walks read.\n */\nexport function maskCompositeLeadHandle(data: Readonly<Record<string, unknown>> | null | undefined): \"video\" | \"background-video\" {\n return maskCompositeUsesForeground(maskCompositeFillOf(data)) ? \"video\" : \"background-video\"\n}\n\n/**\n * The sound a render actually carries. With no foreground (pixelate / blur) it\n * is ALWAYS the background's — the only track there is — whatever\n * `audioSource` says (the canvas hides that control for these fills, so a\n * stored `none` from the Video fill can never silently mute the result).\n */\nexport function maskCompositeEffectiveAudioSource(s: Pick<MaskCompositeSettings, \"fill\" | \"audioSource\">): MaskCompositeAudioSource {\n if (maskCompositeUsesForeground(s.fill)) return s.audioSource\n return \"background\"\n}\n\n/** `POST /v1/mask-composite` request body. */\nexport interface MaskCompositeRequest extends Partial<MaskCompositeSettings> {\n /** The video whose white-masked region is kept (its size, rate and length lead).\n * Required when `fill` is `video` (the default); not used by `pixelate` / `blur`. */\n readonly foregroundUrl?: string\n /** The video shown where the mask is black. */\n readonly backgroundUrl: string\n /** The mask video — white = foreground (Video Mask's output). */\n readonly maskUrl: string\n}\n","/**\n * Dubbing structure — the wire contract of a dub read back by its job id\n * (`GET /v1/dubbing/:jobId`), and of the captions export beside it\n * (`GET /v1/dubbing/:jobId/captions`).\n *\n * One shape whichever engine made the dub, so a client is written once. A\n * field an engine does not tell is null, never absent:\n * - `sourceSegmentId` names the source line a language's line translates.\n * It is null where the dub's lines carry no link to the source lines; the\n * two lists are then read side by side, by time.\n * - `sourceText` is the original text a line translates, as the dub keeps\n * it beside the line; null where the dub keeps none. Each of the two is\n * told on its own: a line can carry `sourceText` and no `sourceSegmentId`.\n * - a speaker's `name` and `voice` are null until they can be read.\n *\n * `capabilities` says what can be done to this dub now. A client offers an\n * action only when its capability is true.\n */\n\n/** The caption file formats a dub exports. */\nexport const DUBBING_CAPTION_FORMATS = [\"srt\", \"vtt\"] as const\nexport type DubbingCaptionFormat = (typeof DUBBING_CAPTION_FORMATS)[number]\n\n/** The `language` value that names the original speech in a captions request. */\nexport const DUBBING_SOURCE_LANGUAGE = \"source\"\n\n/**\n * Where a language of a dub stands:\n * - `processing`: being made; its lines are not readable yet.\n * - `completed`: it is made; its lines and captions are readable where the dubbing service gives them.\n * - `stale`: its lines changed after its media was last made.\n * - `failed`: it was not made.\n */\nexport const DUBBING_LANGUAGE_STATUSES = [\"processing\", \"completed\", \"stale\", \"failed\"] as const\nexport type DubbingLanguageStatus = (typeof DUBBING_LANGUAGE_STATUSES)[number]\n\n/** One line of the original speech. Times are seconds from the start of the media. */\nexport interface DubbingSourceSegment {\n /** Unique within the source lines. */\n id: string\n speakerId: string | null\n start: number\n end: number\n text: string\n}\n\n/** One line of a dubbed language. Times are seconds from the start of the media. */\nexport interface DubbingSegment {\n /** Unique within this language's lines. */\n id: string\n speakerId: string | null\n start: number\n end: number\n /**\n * The `id` of the source line this one translates; null where the dub's\n * lines carry no link to the source lines.\n */\n sourceSegmentId: string | null\n /**\n * The original text this line translates, as the dub keeps it beside the\n * line; null where it keeps none. It can be told where `sourceSegmentId` is\n * null.\n */\n sourceText: string | null\n text: string\n}\n\n/** One language a dub speaks. */\nexport interface DubbingLanguage {\n /** The language code the dub was asked for (`es`, `pt-BR`); unique within a dub. */\n code: string\n /**\n * The job whose result is this language's dubbed media. null when the\n * language was made but no job of the account holds its media: adding the\n * language again delivers it, unless its status is `stale` (its lines\n * changed after its media was made), when adding it is refused.\n */\n jobId: string | null\n status: DubbingLanguageStatus\n /** Empty unless `status` is `completed` or `stale`, and where the dubbing service does not give the language's lines. */\n segments: DubbingSegment[]\n}\n\n/** The voice a speaker is dubbed in. */\nexport interface DubbingSpeakerVoice {\n id: string\n name: string | null\n previewUrl: string | null\n}\n\n/** One speaker the dub tells apart. */\nexport interface DubbingSpeaker {\n /** The `speakerId` its lines carry. */\n id: string\n name: string | null\n voice: DubbingSpeakerVoice | null\n /** How many source lines the speaker has (lines of the first language when the source is not readable). */\n segmentCount: number\n}\n\n/** What can be done to a dub now. */\nexport interface DubbingCapabilities {\n /** Change a line's text. */\n editSegments: boolean\n /** Make chosen lines again. */\n regenerate: boolean\n /** Replace a speaker's voice. */\n setSpeakerVoice: boolean\n /** Render the media again after edits. */\n render: boolean\n /** Add a target language (`POST /v1/dubbing/:jobId/languages`). */\n addLanguage: boolean\n /** Export captions (`GET /v1/dubbing/:jobId/captions`). */\n captions: boolean\n}\n\n/**\n * What adding a language to this dub is charged. The price is the answer of\n * `POST /v1/credits/model-costs` for `creditIdByLanguage[language] ?? creditId`.\n */\nexport interface DubbingAddLanguagePrice {\n /** Whole minutes an added language is charged for; null when the length is only known once it runs. */\n billableMinutes: number | null\n /** The price id of an added language; null with `billableMinutes`. */\n creditId: string | null\n /** The languages priced by another id than `creditId`, by lowercase language code. */\n creditIdByLanguage: Record<string, string>\n}\n\n/** `GET /v1/dubbing/:jobId`. */\nexport interface DubbingStructure {\n /** The job the dub was created by. Languages added later hang off it. */\n jobId: string\n /** Seconds of media the dub covers; null when not known. */\n durationSec: number | null\n /** The original speech; null when its lines are not readable. */\n source: { language: string | null; segments: DubbingSourceSegment[] } | null\n languages: DubbingLanguage[]\n speakers: DubbingSpeaker[]\n capabilities: DubbingCapabilities\n addLanguage: DubbingAddLanguagePrice\n}\n\n/** `POST /v1/dubbing/:jobId/languages` request. */\nexport interface DubbingAddLanguageInput {\n /** The language to add (`es`, `pt-BR`). */\n targetLanguage: string\n /** The rights confirmation, when the dub was made from a link the deployment asks one for. */\n confirmationId?: string\n}\n\n/** `POST /v1/dubbing/:jobId/languages` response: the job that delivers the added language. */\nexport interface DubbingAddLanguageResult {\n jobId: string\n}\n\n/**\n * The error codes the dubbing reads and the add-language call answer beside\n * the platform's own (`not_found`, `unauthorized`, `validation_error`). Each\n * is the `error.code` of the response body.\n */\nexport const DUBBING_ERROR_CODES = [\n /** 422: the job is not a dub. */\n \"not_a_dubbing_job\",\n /** 409: the dub is still being made. */\n \"dubbing_not_ready\",\n /** 422: the dub was not made. */\n \"dubbing_failed\",\n /** 410: the dub is no longer held where it was made. */\n \"dubbing_unavailable\",\n /** 404: the dub has no such language. */\n \"dubbing_language_not_found\",\n /** 409: that language is still being made. */\n \"dubbing_language_processing\",\n /** 422: that language has no captions to export. */\n \"dubbing_captions_unavailable\",\n /** 409: the dub already speaks that language. */\n \"dubbing_language_exists\",\n /** 422: the length of the dub cannot be read, so a language cannot be priced. */\n \"unreadable_dubbing_source\",\n /** 413: the dub is longer than 30 minutes, so a language cannot be added to it. */\n \"media_duration_exceeds_limit\",\n /** 502: the dubbing service did not answer. */\n \"dubbing_read_failed\",\n] as const\nexport type DubbingErrorCode = (typeof DUBBING_ERROR_CODES)[number]\n"]}