@nodaro/shared 3.49.0 → 3.51.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 (175) hide show
  1. package/dist/{chunk-XQBBBQZH.cjs → chunk-25OWMP6B.cjs} +47 -47
  2. package/dist/{chunk-XQBBBQZH.cjs.map → chunk-25OWMP6B.cjs.map} +1 -1
  3. package/dist/{chunk-T4EBNTKT.js → chunk-2LNQ2MDO.js} +3 -3
  4. package/dist/{chunk-T4EBNTKT.js.map → chunk-2LNQ2MDO.js.map} +1 -1
  5. package/dist/{chunk-HPT244UT.cjs → chunk-34EXMNOX.cjs} +9 -7
  6. package/dist/chunk-34EXMNOX.cjs.map +1 -0
  7. package/dist/{chunk-QHODM5TS.cjs → chunk-3APO7ABM.cjs} +31 -2
  8. package/dist/chunk-3APO7ABM.cjs.map +1 -0
  9. package/dist/{chunk-7VDPBFER.cjs → chunk-3M4BNKFJ.cjs} +32 -2
  10. package/dist/chunk-3M4BNKFJ.cjs.map +1 -0
  11. package/dist/{chunk-D33YBZ3B.cjs → chunk-5M43XMRB.cjs} +8 -8
  12. package/dist/{chunk-D33YBZ3B.cjs.map → chunk-5M43XMRB.cjs.map} +1 -1
  13. package/dist/{chunk-QZANEGZ3.cjs → chunk-66GADQRV.cjs} +21 -21
  14. package/dist/{chunk-QZANEGZ3.cjs.map → chunk-66GADQRV.cjs.map} +1 -1
  15. package/dist/{chunk-KOVIMPZS.js → chunk-6CVY3345.js} +3 -3
  16. package/dist/{chunk-KOVIMPZS.js.map → chunk-6CVY3345.js.map} +1 -1
  17. package/dist/{chunk-DZOCFLMK.js → chunk-6LCZPDIF.js} +3 -3
  18. package/dist/{chunk-DZOCFLMK.js.map → chunk-6LCZPDIF.js.map} +1 -1
  19. package/dist/{chunk-QLCSS6DK.js → chunk-7FCTCWHD.js} +3 -3
  20. package/dist/{chunk-QLCSS6DK.js.map → chunk-7FCTCWHD.js.map} +1 -1
  21. package/dist/{chunk-BQSXEU3O.cjs → chunk-7HWXJIQ6.cjs} +4 -4
  22. package/dist/{chunk-BQSXEU3O.cjs.map → chunk-7HWXJIQ6.cjs.map} +1 -1
  23. package/dist/{chunk-2JUNYRMS.cjs → chunk-7YFQKR5C.cjs} +21 -21
  24. package/dist/{chunk-2JUNYRMS.cjs.map → chunk-7YFQKR5C.cjs.map} +1 -1
  25. package/dist/{chunk-ML7Q2LTB.js → chunk-A24LLEXS.js} +9 -6
  26. package/dist/chunk-A24LLEXS.js.map +1 -0
  27. package/dist/{chunk-6TL7JMVF.js → chunk-AJFQ5242.js} +5 -5
  28. package/dist/{chunk-6TL7JMVF.js.map → chunk-AJFQ5242.js.map} +1 -1
  29. package/dist/{chunk-AENQLVQH.js → chunk-AJPV3RZJ.js} +5 -5
  30. package/dist/{chunk-AENQLVQH.js.map → chunk-AJPV3RZJ.js.map} +1 -1
  31. package/dist/{chunk-NEJ2PV4C.cjs → chunk-ANMCMSGR.cjs} +6 -3
  32. package/dist/chunk-ANMCMSGR.cjs.map +1 -0
  33. package/dist/{chunk-U6BDA2CX.cjs → chunk-AVUW7XKP.cjs} +16 -16
  34. package/dist/{chunk-U6BDA2CX.cjs.map → chunk-AVUW7XKP.cjs.map} +1 -1
  35. package/dist/{chunk-HCZYIYKK.js → chunk-BG5272F5.js} +4 -4
  36. package/dist/{chunk-HCZYIYKK.js.map → chunk-BG5272F5.js.map} +1 -1
  37. package/dist/{chunk-NU6UR5RI.cjs → chunk-CSPELPDB.cjs} +8 -8
  38. package/dist/{chunk-NU6UR5RI.cjs.map → chunk-CSPELPDB.cjs.map} +1 -1
  39. package/dist/{chunk-KZGGUDAB.js → chunk-DSSPAET7.js} +27 -3
  40. package/dist/{chunk-QHODM5TS.cjs.map → chunk-DSSPAET7.js.map} +1 -1
  41. package/dist/{chunk-P4QT7JGD.cjs → chunk-FBLMWA2R.cjs} +13 -13
  42. package/dist/{chunk-P4QT7JGD.cjs.map → chunk-FBLMWA2R.cjs.map} +1 -1
  43. package/dist/{chunk-X62EMX7Y.js → chunk-FIROF3TM.js} +5 -5
  44. package/dist/{chunk-X62EMX7Y.js.map → chunk-FIROF3TM.js.map} +1 -1
  45. package/dist/{chunk-27LQR7DO.js → chunk-FRXVOYL2.js} +6 -4
  46. package/dist/chunk-FRXVOYL2.js.map +1 -0
  47. package/dist/{chunk-2BHOAYZW.js → chunk-FVII3KHN.js} +32 -2
  48. package/dist/chunk-FVII3KHN.js.map +1 -0
  49. package/dist/{chunk-VCHWYREY.js → chunk-GL5Z3CC4.js} +3 -3
  50. package/dist/{chunk-VCHWYREY.js.map → chunk-GL5Z3CC4.js.map} +1 -1
  51. package/dist/chunk-H7HKLN2W.cjs +27 -0
  52. package/dist/{chunk-QIXL2ZLX.cjs.map → chunk-H7HKLN2W.cjs.map} +1 -1
  53. package/dist/{chunk-WPT5ZTA2.js → chunk-HZL7QMXK.js} +17 -4
  54. package/dist/chunk-HZL7QMXK.js.map +1 -0
  55. package/dist/{chunk-TZBIY5C3.js → chunk-IB5B3EBD.js} +6 -3
  56. package/dist/chunk-IB5B3EBD.js.map +1 -0
  57. package/dist/{chunk-DDTA6X2S.cjs → chunk-IJ6XNHSD.cjs} +10 -10
  58. package/dist/{chunk-DDTA6X2S.cjs.map → chunk-IJ6XNHSD.cjs.map} +1 -1
  59. package/dist/{chunk-NGT2FYP2.cjs → chunk-J3HPEKGJ.cjs} +9 -6
  60. package/dist/chunk-J3HPEKGJ.cjs.map +1 -0
  61. package/dist/{chunk-HSJU5KNR.cjs → chunk-J4CVGAAV.cjs} +17 -4
  62. package/dist/chunk-J4CVGAAV.cjs.map +1 -0
  63. package/dist/{chunk-FV43YJ5I.js → chunk-JAD2SBD4.js} +4 -4
  64. package/dist/{chunk-FV43YJ5I.js.map → chunk-JAD2SBD4.js.map} +1 -1
  65. package/dist/{chunk-WAUWKYLF.js → chunk-JAGYUDOK.js} +3 -3
  66. package/dist/{chunk-WAUWKYLF.js.map → chunk-JAGYUDOK.js.map} +1 -1
  67. package/dist/{chunk-77R3HYOE.js → chunk-JZJRD7RG.js} +6 -6
  68. package/dist/{chunk-77R3HYOE.js.map → chunk-JZJRD7RG.js.map} +1 -1
  69. package/dist/{chunk-UDYFWB7D.cjs → chunk-MI63SSCJ.cjs} +4 -4
  70. package/dist/{chunk-UDYFWB7D.cjs.map → chunk-MI63SSCJ.cjs.map} +1 -1
  71. package/dist/{chunk-TA5MZZKE.cjs → chunk-MI6CZQCG.cjs} +45 -45
  72. package/dist/{chunk-TA5MZZKE.cjs.map → chunk-MI6CZQCG.cjs.map} +1 -1
  73. package/dist/{chunk-HNBJP2IR.js → chunk-OWVWV4T2.js} +3 -3
  74. package/dist/{chunk-HNBJP2IR.js.map → chunk-OWVWV4T2.js.map} +1 -1
  75. package/dist/{chunk-TMXFL6RC.cjs → chunk-QBXC3AXS.cjs} +12 -12
  76. package/dist/{chunk-TMXFL6RC.cjs.map → chunk-QBXC3AXS.cjs.map} +1 -1
  77. package/dist/{chunk-FEPSSBD5.cjs → chunk-SRLWSI6Q.cjs} +5 -5
  78. package/dist/{chunk-FEPSSBD5.cjs.map → chunk-SRLWSI6Q.cjs.map} +1 -1
  79. package/dist/{chunk-GIU37YMD.js → chunk-TRZMLQSL.js} +3 -3
  80. package/dist/{chunk-GIU37YMD.js.map → chunk-TRZMLQSL.js.map} +1 -1
  81. package/dist/{chunk-PSAWDKO3.cjs → chunk-TWF2OSH4.cjs} +4 -4
  82. package/dist/{chunk-PSAWDKO3.cjs.map → chunk-TWF2OSH4.cjs.map} +1 -1
  83. package/dist/{chunk-6GTTATPR.cjs → chunk-VLNOQJDO.cjs} +6 -6
  84. package/dist/{chunk-6GTTATPR.cjs.map → chunk-VLNOQJDO.cjs.map} +1 -1
  85. package/dist/{chunk-DPUIJHM7.cjs → chunk-VNHX6TQT.cjs} +5 -5
  86. package/dist/{chunk-DPUIJHM7.cjs.map → chunk-VNHX6TQT.cjs.map} +1 -1
  87. package/dist/{chunk-JGCGLHZL.js → chunk-VSNQLSME.js} +3 -3
  88. package/dist/{chunk-JGCGLHZL.js.map → chunk-VSNQLSME.js.map} +1 -1
  89. package/dist/{chunk-26L7NHK4.js → chunk-WBPJNXYN.js} +4 -4
  90. package/dist/{chunk-26L7NHK4.js.map → chunk-WBPJNXYN.js.map} +1 -1
  91. package/dist/{chunk-S5CRPOYD.cjs → chunk-XRXPWW7P.cjs} +52 -52
  92. package/dist/chunk-XRXPWW7P.cjs.map +1 -0
  93. package/dist/{chunk-QBRTPVT6.js → chunk-YOH5AUYL.js} +10 -10
  94. package/dist/chunk-YOH5AUYL.js.map +1 -0
  95. package/dist/{chunk-BLZBDPZJ.js → chunk-ZES6EZC4.js} +3 -3
  96. package/dist/{chunk-BLZBDPZJ.js.map → chunk-ZES6EZC4.js.map} +1 -1
  97. package/dist/entries/apps.cjs +43 -43
  98. package/dist/entries/apps.d.cts +1 -1
  99. package/dist/entries/apps.d.ts +1 -1
  100. package/dist/entries/apps.js +8 -8
  101. package/dist/entries/credits.cjs +151 -151
  102. package/dist/entries/credits.d.cts +1 -1
  103. package/dist/entries/credits.d.ts +1 -1
  104. package/dist/entries/credits.js +8 -8
  105. package/dist/entries/llm-models.cjs +57 -57
  106. package/dist/entries/llm-models.d.cts +7 -0
  107. package/dist/entries/llm-models.d.ts +7 -0
  108. package/dist/entries/llm-models.js +2 -2
  109. package/dist/entries/media.cjs +70 -50
  110. package/dist/entries/media.d.cts +92 -1
  111. package/dist/entries/media.d.ts +92 -1
  112. package/dist/entries/media.js +1 -1
  113. package/dist/entries/model-catalog.cjs +66 -66
  114. package/dist/entries/model-catalog.d.cts +2 -2
  115. package/dist/entries/model-catalog.d.ts +2 -2
  116. package/dist/entries/model-catalog.js +4 -4
  117. package/dist/entries/models.cjs +277 -277
  118. package/dist/entries/models.d.cts +1 -1
  119. package/dist/entries/models.d.ts +1 -1
  120. package/dist/entries/models.js +5 -5
  121. package/dist/entries/nodes.cjs +208 -208
  122. package/dist/entries/nodes.d.cts +9 -6
  123. package/dist/entries/nodes.d.ts +9 -6
  124. package/dist/entries/nodes.js +10 -10
  125. package/dist/entries/pipeline.cjs +149 -149
  126. package/dist/entries/pipeline.js +3 -3
  127. package/dist/entries/social.cjs +177 -177
  128. package/dist/entries/social.js +2 -2
  129. package/dist/entries/ugc.cjs +71 -71
  130. package/dist/entries/ugc.js +4 -4
  131. package/dist/entries/video.cjs +141 -141
  132. package/dist/entries/video.d.cts +1 -1
  133. package/dist/entries/video.d.ts +1 -1
  134. package/dist/entries/video.js +5 -5
  135. package/dist/entries/workflow.cjs +146 -146
  136. package/dist/entries/workflow.d.cts +13 -0
  137. package/dist/entries/workflow.d.ts +13 -0
  138. package/dist/entries/workflow.js +2 -2
  139. package/dist/index.cjs +1526 -1506
  140. package/dist/index.d.cts +2 -2
  141. package/dist/index.d.ts +2 -2
  142. package/dist/index.js +24 -24
  143. package/dist/{model-catalog-Ciqsc0ha.d.ts → model-catalog-Dm2UiwUe.d.cts} +4 -3
  144. package/dist/{model-catalog-Ciqsc0ha.d.cts → model-catalog-Dm2UiwUe.d.ts} +4 -3
  145. package/package.json +1 -1
  146. package/src/__tests__/llm-models.test.ts +18 -0
  147. package/src/__tests__/model-makers.test.ts +10 -0
  148. package/src/__tests__/model-tree.test.ts +5 -4
  149. package/src/__tests__/node-runtime-keys.test.ts +11 -0
  150. package/src/__tests__/preview-gate-use-case.test.ts +6 -0
  151. package/src/__tests__/template-categories.test.ts +9 -3
  152. package/src/__tests__/video-face-mesh.test.ts +51 -0
  153. package/src/entries/media.ts +1 -0
  154. package/src/llm-models.ts +37 -0
  155. package/src/model-catalog.ts +11 -7
  156. package/src/node-execution-state.ts +13 -0
  157. package/src/node-runtime-keys.ts +13 -0
  158. package/src/preview-gate.ts +7 -4
  159. package/src/template-categories.ts +2 -0
  160. package/src/video-face-mesh.ts +107 -0
  161. package/src/video-link.ts +3 -0
  162. package/dist/chunk-27LQR7DO.js.map +0 -1
  163. package/dist/chunk-2BHOAYZW.js.map +0 -1
  164. package/dist/chunk-7VDPBFER.cjs.map +0 -1
  165. package/dist/chunk-HPT244UT.cjs.map +0 -1
  166. package/dist/chunk-HSJU5KNR.cjs.map +0 -1
  167. package/dist/chunk-KZGGUDAB.js.map +0 -1
  168. package/dist/chunk-ML7Q2LTB.js.map +0 -1
  169. package/dist/chunk-NEJ2PV4C.cjs.map +0 -1
  170. package/dist/chunk-NGT2FYP2.cjs.map +0 -1
  171. package/dist/chunk-QBRTPVT6.js.map +0 -1
  172. package/dist/chunk-QIXL2ZLX.cjs +0 -27
  173. package/dist/chunk-S5CRPOYD.cjs.map +0 -1
  174. package/dist/chunk-TZBIY5C3.js.map +0 -1
  175. package/dist/chunk-WPT5ZTA2.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { DEFAULT_DIALOGUE_PROVIDER } from './chunk-GIU37YMD.js';
2
- import { MODEL_CATALOG } from './chunk-ML7Q2LTB.js';
1
+ import { DEFAULT_DIALOGUE_PROVIDER } from './chunk-TRZMLQSL.js';
2
+ import { MODEL_CATALOG } from './chunk-A24LLEXS.js';
3
3
 
4
4
  // src/dialogue-capabilities.ts
5
5
  function findDialogueCapabilities(provider) {
@@ -27,5 +27,5 @@ function dialogueStabilityAccepted(provider, value) {
27
27
  }
28
28
 
29
29
  export { dialogueHasLever, dialogueProviderOf, dialogueStabilityAccepted, dialogueSupportsTimestamps, findDialogueCapabilities, getDialogueCapabilities };
30
- //# sourceMappingURL=chunk-HCZYIYKK.js.map
31
- //# sourceMappingURL=chunk-HCZYIYKK.js.map
30
+ //# sourceMappingURL=chunk-BG5272F5.js.map
31
+ //# sourceMappingURL=chunk-BG5272F5.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dialogue-capabilities.ts"],"names":[],"mappings":";;;;AAeO,SAAS,yBAAyB,QAAA,EAAgD;AACvF,EAAA,IAAI,OAAO,QAAA,KAAa,QAAA,IAAY,CAAC,UAAU,OAAO,MAAA;AACtD,EAAA,IAAI,CAAC,MAAA,CAAO,MAAA,CAAO,aAAA,EAAe,QAAQ,GAAG,OAAO,MAAA;AACpD,EAAA,MAAM,KAAA,GAAQ,cAAc,QAAQ,CAAA;AACpC,EAAA,OAAO,MAAM,KAAA,CAAM,QAAA,CAAS,UAAU,CAAA,GAAI,MAAM,GAAA,GAAM,MAAA;AACxD;AAGO,SAAS,mBAAmB,QAAA,EAAqC;AACtE,EAAA,OAAO,wBAAA,CAAyB,QAAQ,CAAA,GAAK,QAAA,GAAgC,yBAAA;AAC/E;AAGO,SAAS,wBAAwB,QAAA,EAAoC;AAC1E,EAAA,OAAO,aAAA,CAAc,kBAAA,CAAmB,QAAQ,CAAC,CAAA,CAAG,GAAA;AACtD;AAGO,SAAS,gBAAA,CAAiB,UAAmB,KAAA,EAAiC;AACnF,EAAA,OAAO,uBAAA,CAAwB,QAAQ,CAAA,CAAE,MAAA,CAAO,SAAS,KAAK,CAAA;AAChE;AAGO,SAAS,2BAA2B,QAAA,EAA4B;AACrE,EAAA,OAAO,uBAAA,CAAwB,QAAQ,CAAA,CAAE,UAAA;AAC3C;AAGO,SAAS,yBAAA,CAA0B,UAAmB,KAAA,EAAwB;AACnF,EAAA,IAAI,CAAC,OAAO,QAAA,CAAS,KAAK,KAAK,KAAA,GAAQ,CAAA,IAAK,KAAA,GAAQ,CAAA,EAAG,OAAO,KAAA;AAC9D,EAAA,MAAM,KAAA,GAAQ,uBAAA,CAAwB,QAAQ,CAAA,CAAE,cAAA;AAChD,EAAA,OAAO,KAAA,GAAQ,KAAA,CAAM,QAAA,CAAS,KAAK,CAAA,GAAI,IAAA;AACzC","file":"chunk-HCZYIYKK.js","sourcesContent":["/**\n * Capability lookups for the DIALOGUE lane (`/v1/text-to-dialogue`, the Text to\n * Dialogue node, the voiced-video multi-speaker track).\n *\n * The dialogue models carry a `tts` sheet in `MODEL_CATALOG` like the\n * text-to-speech models, but each lane answers only for its own models: the\n * text-to-speech lookups (`tts-capabilities.ts`) treat a dialogue id as unknown,\n * and these treat a text-to-speech id as unknown. An unknown id here runs as\n * {@link DEFAULT_DIALOGUE_PROVIDER} (v3 dialogue) — not as the text-to-speech\n * fallback (turbo), which has no dialogue form.\n */\nimport { MODEL_CATALOG, type TtsCapabilities, type TtsSettingLever } from \"./model-catalog.js\"\nimport { DEFAULT_DIALOGUE_PROVIDER, type DialogueProvider } from \"./model-constants.js\"\n\n/** The sheet of a dialogue model, or `undefined` when the id is not one. Own properties only; a non-string is unknown. */\nexport function findDialogueCapabilities(provider: unknown): TtsCapabilities | undefined {\n if (typeof provider !== \"string\" || !provider) return undefined\n if (!Object.hasOwn(MODEL_CATALOG, provider)) return undefined\n const entry = MODEL_CATALOG[provider]!\n return entry.modes.includes(\"dialogue\") ? entry.tts : undefined\n}\n\n/** The dialogue model a request naming `provider` runs on (and is billed as). */\nexport function dialogueProviderOf(provider: unknown): DialogueProvider {\n return findDialogueCapabilities(provider) ? (provider as DialogueProvider) : DEFAULT_DIALOGUE_PROVIDER\n}\n\n/** The sheet a dialogue request runs under. */\nexport function getDialogueCapabilities(provider: unknown): TtsCapabilities {\n return MODEL_CATALOG[dialogueProviderOf(provider)]!.tts!\n}\n\n/** The dialogue model honours this voice-setting lever. */\nexport function dialogueHasLever(provider: unknown, lever: TtsSettingLever): boolean {\n return getDialogueCapabilities(provider).levers.includes(lever)\n}\n\n/** The dialogue model answers `/v1/text-to-dialogue/with-timestamps` (character timings + per-line voice segments). */\nexport function dialogueSupportsTimestamps(provider: unknown): boolean {\n return getDialogueCapabilities(provider).timestamps\n}\n\n/** `value` is a stability this platform accepts for the dialogue model: one of its steps, or any finite 0–1 when it has none. */\nexport function dialogueStabilityAccepted(provider: unknown, value: number): boolean {\n if (!Number.isFinite(value) || value < 0 || value > 1) return false\n const steps = getDialogueCapabilities(provider).stabilitySteps\n return steps ? steps.includes(value) : true\n}\n"]}
1
+ {"version":3,"sources":["../src/dialogue-capabilities.ts"],"names":[],"mappings":";;;;AAeO,SAAS,yBAAyB,QAAA,EAAgD;AACvF,EAAA,IAAI,OAAO,QAAA,KAAa,QAAA,IAAY,CAAC,UAAU,OAAO,MAAA;AACtD,EAAA,IAAI,CAAC,MAAA,CAAO,MAAA,CAAO,aAAA,EAAe,QAAQ,GAAG,OAAO,MAAA;AACpD,EAAA,MAAM,KAAA,GAAQ,cAAc,QAAQ,CAAA;AACpC,EAAA,OAAO,MAAM,KAAA,CAAM,QAAA,CAAS,UAAU,CAAA,GAAI,MAAM,GAAA,GAAM,MAAA;AACxD;AAGO,SAAS,mBAAmB,QAAA,EAAqC;AACtE,EAAA,OAAO,wBAAA,CAAyB,QAAQ,CAAA,GAAK,QAAA,GAAgC,yBAAA;AAC/E;AAGO,SAAS,wBAAwB,QAAA,EAAoC;AAC1E,EAAA,OAAO,aAAA,CAAc,kBAAA,CAAmB,QAAQ,CAAC,CAAA,CAAG,GAAA;AACtD;AAGO,SAAS,gBAAA,CAAiB,UAAmB,KAAA,EAAiC;AACnF,EAAA,OAAO,uBAAA,CAAwB,QAAQ,CAAA,CAAE,MAAA,CAAO,SAAS,KAAK,CAAA;AAChE;AAGO,SAAS,2BAA2B,QAAA,EAA4B;AACrE,EAAA,OAAO,uBAAA,CAAwB,QAAQ,CAAA,CAAE,UAAA;AAC3C;AAGO,SAAS,yBAAA,CAA0B,UAAmB,KAAA,EAAwB;AACnF,EAAA,IAAI,CAAC,OAAO,QAAA,CAAS,KAAK,KAAK,KAAA,GAAQ,CAAA,IAAK,KAAA,GAAQ,CAAA,EAAG,OAAO,KAAA;AAC9D,EAAA,MAAM,KAAA,GAAQ,uBAAA,CAAwB,QAAQ,CAAA,CAAE,cAAA;AAChD,EAAA,OAAO,KAAA,GAAQ,KAAA,CAAM,QAAA,CAAS,KAAK,CAAA,GAAI,IAAA;AACzC","file":"chunk-BG5272F5.js","sourcesContent":["/**\n * Capability lookups for the DIALOGUE lane (`/v1/text-to-dialogue`, the Text to\n * Dialogue node, the voiced-video multi-speaker track).\n *\n * The dialogue models carry a `tts` sheet in `MODEL_CATALOG` like the\n * text-to-speech models, but each lane answers only for its own models: the\n * text-to-speech lookups (`tts-capabilities.ts`) treat a dialogue id as unknown,\n * and these treat a text-to-speech id as unknown. An unknown id here runs as\n * {@link DEFAULT_DIALOGUE_PROVIDER} (v3 dialogue) — not as the text-to-speech\n * fallback (turbo), which has no dialogue form.\n */\nimport { MODEL_CATALOG, type TtsCapabilities, type TtsSettingLever } from \"./model-catalog.js\"\nimport { DEFAULT_DIALOGUE_PROVIDER, type DialogueProvider } from \"./model-constants.js\"\n\n/** The sheet of a dialogue model, or `undefined` when the id is not one. Own properties only; a non-string is unknown. */\nexport function findDialogueCapabilities(provider: unknown): TtsCapabilities | undefined {\n if (typeof provider !== \"string\" || !provider) return undefined\n if (!Object.hasOwn(MODEL_CATALOG, provider)) return undefined\n const entry = MODEL_CATALOG[provider]!\n return entry.modes.includes(\"dialogue\") ? entry.tts : undefined\n}\n\n/** The dialogue model a request naming `provider` runs on (and is billed as). */\nexport function dialogueProviderOf(provider: unknown): DialogueProvider {\n return findDialogueCapabilities(provider) ? (provider as DialogueProvider) : DEFAULT_DIALOGUE_PROVIDER\n}\n\n/** The sheet a dialogue request runs under. */\nexport function getDialogueCapabilities(provider: unknown): TtsCapabilities {\n return MODEL_CATALOG[dialogueProviderOf(provider)]!.tts!\n}\n\n/** The dialogue model honours this voice-setting lever. */\nexport function dialogueHasLever(provider: unknown, lever: TtsSettingLever): boolean {\n return getDialogueCapabilities(provider).levers.includes(lever)\n}\n\n/** The dialogue model answers `/v1/text-to-dialogue/with-timestamps` (character timings + per-line voice segments). */\nexport function dialogueSupportsTimestamps(provider: unknown): boolean {\n return getDialogueCapabilities(provider).timestamps\n}\n\n/** `value` is a stability this platform accepts for the dialogue model: one of its steps, or any finite 0–1 when it has none. */\nexport function dialogueStabilityAccepted(provider: unknown, value: number): boolean {\n if (!Number.isFinite(value) || value < 0 || value > 1) return false\n const steps = getDialogueCapabilities(provider).stabilitySteps\n return steps ? steps.includes(value) : true\n}\n"]}
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var chunk2JUNYRMS_cjs = require('./chunk-2JUNYRMS.cjs');
4
- var chunkNGT2FYP2_cjs = require('./chunk-NGT2FYP2.cjs');
3
+ var chunk7YFQKR5C_cjs = require('./chunk-7YFQKR5C.cjs');
4
+ var chunkJ3HPEKGJ_cjs = require('./chunk-J3HPEKGJ.cjs');
5
5
 
6
6
  // src/dialogue-capabilities.ts
7
7
  function findDialogueCapabilities(provider) {
8
8
  if (typeof provider !== "string" || !provider) return void 0;
9
- if (!Object.hasOwn(chunkNGT2FYP2_cjs.MODEL_CATALOG, provider)) return void 0;
10
- const entry = chunkNGT2FYP2_cjs.MODEL_CATALOG[provider];
9
+ if (!Object.hasOwn(chunkJ3HPEKGJ_cjs.MODEL_CATALOG, provider)) return void 0;
10
+ const entry = chunkJ3HPEKGJ_cjs.MODEL_CATALOG[provider];
11
11
  return entry.modes.includes("dialogue") ? entry.tts : void 0;
12
12
  }
13
13
  function dialogueProviderOf(provider) {
14
- return findDialogueCapabilities(provider) ? provider : chunk2JUNYRMS_cjs.DEFAULT_DIALOGUE_PROVIDER;
14
+ return findDialogueCapabilities(provider) ? provider : chunk7YFQKR5C_cjs.DEFAULT_DIALOGUE_PROVIDER;
15
15
  }
16
16
  function getDialogueCapabilities(provider) {
17
- return chunkNGT2FYP2_cjs.MODEL_CATALOG[dialogueProviderOf(provider)].tts;
17
+ return chunkJ3HPEKGJ_cjs.MODEL_CATALOG[dialogueProviderOf(provider)].tts;
18
18
  }
19
19
  function dialogueHasLever(provider, lever) {
20
20
  return getDialogueCapabilities(provider).levers.includes(lever);
@@ -34,5 +34,5 @@ exports.dialogueStabilityAccepted = dialogueStabilityAccepted;
34
34
  exports.dialogueSupportsTimestamps = dialogueSupportsTimestamps;
35
35
  exports.findDialogueCapabilities = findDialogueCapabilities;
36
36
  exports.getDialogueCapabilities = getDialogueCapabilities;
37
- //# sourceMappingURL=chunk-NU6UR5RI.cjs.map
38
- //# sourceMappingURL=chunk-NU6UR5RI.cjs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cAAA;AAChD,EAAA,OAAO,KAAA,GAAQ,KAAA,CAAM,QAAA,CAAS,KAAK,CAAA,GAAI,IAAA;AACzC","file":"chunk-NU6UR5RI.cjs","sourcesContent":["/**\n * Capability lookups for the DIALOGUE lane (`/v1/text-to-dialogue`, the Text to\n * Dialogue node, the voiced-video multi-speaker track).\n *\n * The dialogue models carry a `tts` sheet in `MODEL_CATALOG` like the\n * text-to-speech models, but each lane answers only for its own models: the\n * text-to-speech lookups (`tts-capabilities.ts`) treat a dialogue id as unknown,\n * and these treat a text-to-speech id as unknown. An unknown id here runs as\n * {@link DEFAULT_DIALOGUE_PROVIDER} (v3 dialogue) — not as the text-to-speech\n * fallback (turbo), which has no dialogue form.\n */\nimport { MODEL_CATALOG, type TtsCapabilities, type TtsSettingLever } from \"./model-catalog.js\"\nimport { DEFAULT_DIALOGUE_PROVIDER, type DialogueProvider } from \"./model-constants.js\"\n\n/** The sheet of a dialogue model, or `undefined` when the id is not one. Own properties only; a non-string is unknown. */\nexport function findDialogueCapabilities(provider: unknown): TtsCapabilities | undefined {\n if (typeof provider !== \"string\" || !provider) return undefined\n if (!Object.hasOwn(MODEL_CATALOG, provider)) return undefined\n const entry = MODEL_CATALOG[provider]!\n return entry.modes.includes(\"dialogue\") ? entry.tts : undefined\n}\n\n/** The dialogue model a request naming `provider` runs on (and is billed as). */\nexport function dialogueProviderOf(provider: unknown): DialogueProvider {\n return findDialogueCapabilities(provider) ? (provider as DialogueProvider) : DEFAULT_DIALOGUE_PROVIDER\n}\n\n/** The sheet a dialogue request runs under. */\nexport function getDialogueCapabilities(provider: unknown): TtsCapabilities {\n return MODEL_CATALOG[dialogueProviderOf(provider)]!.tts!\n}\n\n/** The dialogue model honours this voice-setting lever. */\nexport function dialogueHasLever(provider: unknown, lever: TtsSettingLever): boolean {\n return getDialogueCapabilities(provider).levers.includes(lever)\n}\n\n/** The dialogue model answers `/v1/text-to-dialogue/with-timestamps` (character timings + per-line voice segments). */\nexport function dialogueSupportsTimestamps(provider: unknown): boolean {\n return getDialogueCapabilities(provider).timestamps\n}\n\n/** `value` is a stability this platform accepts for the dialogue model: one of its steps, or any finite 0–1 when it has none. */\nexport function dialogueStabilityAccepted(provider: unknown, value: number): boolean {\n if (!Number.isFinite(value) || value < 0 || value > 1) return false\n const steps = getDialogueCapabilities(provider).stabilitySteps\n return steps ? steps.includes(value) : true\n}\n"]}
1
+ {"version":3,"sources":["../src/dialogue-capabilities.ts"],"names":["MODEL_CATALOG","DEFAULT_DIALOGUE_PROVIDER"],"mappings":";;;;;;AAeO,SAAS,yBAAyB,QAAA,EAAgD;AACvF,EAAA,IAAI,OAAO,QAAA,KAAa,QAAA,IAAY,CAAC,UAAU,OAAO,MAAA;AACtD,EAAA,IAAI,CAAC,MAAA,CAAO,MAAA,CAAOA,+BAAA,EAAe,QAAQ,GAAG,OAAO,MAAA;AACpD,EAAA,MAAM,KAAA,GAAQA,gCAAc,QAAQ,CAAA;AACpC,EAAA,OAAO,MAAM,KAAA,CAAM,QAAA,CAAS,UAAU,CAAA,GAAI,MAAM,GAAA,GAAM,MAAA;AACxD;AAGO,SAAS,mBAAmB,QAAA,EAAqC;AACtE,EAAA,OAAO,wBAAA,CAAyB,QAAQ,CAAA,GAAK,QAAA,GAAgCC,2CAAA;AAC/E;AAGO,SAAS,wBAAwB,QAAA,EAAoC;AAC1E,EAAA,OAAOD,+BAAA,CAAc,kBAAA,CAAmB,QAAQ,CAAC,CAAA,CAAG,GAAA;AACtD;AAGO,SAAS,gBAAA,CAAiB,UAAmB,KAAA,EAAiC;AACnF,EAAA,OAAO,uBAAA,CAAwB,QAAQ,CAAA,CAAE,MAAA,CAAO,SAAS,KAAK,CAAA;AAChE;AAGO,SAAS,2BAA2B,QAAA,EAA4B;AACrE,EAAA,OAAO,uBAAA,CAAwB,QAAQ,CAAA,CAAE,UAAA;AAC3C;AAGO,SAAS,yBAAA,CAA0B,UAAmB,KAAA,EAAwB;AACnF,EAAA,IAAI,CAAC,OAAO,QAAA,CAAS,KAAK,KAAK,KAAA,GAAQ,CAAA,IAAK,KAAA,GAAQ,CAAA,EAAG,OAAO,KAAA;AAC9D,EAAA,MAAM,KAAA,GAAQ,uBAAA,CAAwB,QAAQ,CAAA,CAAE,cAAA;AAChD,EAAA,OAAO,KAAA,GAAQ,KAAA,CAAM,QAAA,CAAS,KAAK,CAAA,GAAI,IAAA;AACzC","file":"chunk-CSPELPDB.cjs","sourcesContent":["/**\n * Capability lookups for the DIALOGUE lane (`/v1/text-to-dialogue`, the Text to\n * Dialogue node, the voiced-video multi-speaker track).\n *\n * The dialogue models carry a `tts` sheet in `MODEL_CATALOG` like the\n * text-to-speech models, but each lane answers only for its own models: the\n * text-to-speech lookups (`tts-capabilities.ts`) treat a dialogue id as unknown,\n * and these treat a text-to-speech id as unknown. An unknown id here runs as\n * {@link DEFAULT_DIALOGUE_PROVIDER} (v3 dialogue) — not as the text-to-speech\n * fallback (turbo), which has no dialogue form.\n */\nimport { MODEL_CATALOG, type TtsCapabilities, type TtsSettingLever } from \"./model-catalog.js\"\nimport { DEFAULT_DIALOGUE_PROVIDER, type DialogueProvider } from \"./model-constants.js\"\n\n/** The sheet of a dialogue model, or `undefined` when the id is not one. Own properties only; a non-string is unknown. */\nexport function findDialogueCapabilities(provider: unknown): TtsCapabilities | undefined {\n if (typeof provider !== \"string\" || !provider) return undefined\n if (!Object.hasOwn(MODEL_CATALOG, provider)) return undefined\n const entry = MODEL_CATALOG[provider]!\n return entry.modes.includes(\"dialogue\") ? entry.tts : undefined\n}\n\n/** The dialogue model a request naming `provider` runs on (and is billed as). */\nexport function dialogueProviderOf(provider: unknown): DialogueProvider {\n return findDialogueCapabilities(provider) ? (provider as DialogueProvider) : DEFAULT_DIALOGUE_PROVIDER\n}\n\n/** The sheet a dialogue request runs under. */\nexport function getDialogueCapabilities(provider: unknown): TtsCapabilities {\n return MODEL_CATALOG[dialogueProviderOf(provider)]!.tts!\n}\n\n/** The dialogue model honours this voice-setting lever. */\nexport function dialogueHasLever(provider: unknown, lever: TtsSettingLever): boolean {\n return getDialogueCapabilities(provider).levers.includes(lever)\n}\n\n/** The dialogue model answers `/v1/text-to-dialogue/with-timestamps` (character timings + per-line voice segments). */\nexport function dialogueSupportsTimestamps(provider: unknown): boolean {\n return getDialogueCapabilities(provider).timestamps\n}\n\n/** `value` is a stability this platform accepts for the dialogue model: one of its steps, or any finite 0–1 when it has none. */\nexport function dialogueStabilityAccepted(provider: unknown, value: number): boolean {\n if (!Number.isFinite(value) || value < 0 || value > 1) return false\n const steps = getDialogueCapabilities(provider).stabilitySteps\n return steps ? steps.includes(value) : true\n}\n"]}
@@ -500,6 +500,30 @@ function resolveVideoMaskRedetectSec(value) {
500
500
  return Math.min(VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MAX, Math.max(VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MIN, value));
501
501
  }
502
502
 
503
+ // src/video-face-mesh.ts
504
+ var VIDEO_FACE_MESH_PATH = "/v1/video-face-mesh";
505
+ var VIDEO_FACE_MESH_LIMITS = {
506
+ /** The longest clip a run accepts, in seconds of PRICED length (the 30 fps basis): Video Mask's own cap. */
507
+ MAX_BILLED_SEC: VIDEO_MASK_LIMITS.MAX_BILLED_SEC,
508
+ /** `minFaceHeightPct` / `maxFaceHeightPct` bounds (0 = off). */
509
+ FACE_HEIGHT_PCT_MIN: 0,
510
+ FACE_HEIGHT_PCT_MAX: 100,
511
+ /** `zone` margin bounds, as Video Mask's. */
512
+ ZONE_MARGIN_PCT_MIN: VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN,
513
+ ZONE_MARGIN_PCT_MAX: VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MAX
514
+ };
515
+ var VIDEO_FACE_MESH_RECIPE = "2026-11-01";
516
+ var VIDEO_FACE_MESH_BUCKETS_SEC = [5, 10, 15, 30, 60, 120, 300];
517
+ function videoFaceMeshCreditIds() {
518
+ return VIDEO_FACE_MESH_BUCKETS_SEC.map((sec) => `video-face-mesh:${sec}s`);
519
+ }
520
+ function videoFaceMeshCreditId(billedSec) {
521
+ const ids = videoFaceMeshCreditIds();
522
+ if (typeof billedSec !== "number" || !Number.isFinite(billedSec) || billedSec <= 0) return ids[ids.length - 1];
523
+ const i = VIDEO_FACE_MESH_BUCKETS_SEC.findIndex((b) => billedSec <= b);
524
+ return ids[i === -1 ? ids.length - 1 : i];
525
+ }
526
+
503
527
  // src/generate-mask.ts
504
528
  var GENERATE_MASK_LIMITS = {
505
529
  /** Subject description length cap. */
@@ -585,6 +609,6 @@ function maskCompositeEffectiveAudioSource(s) {
585
609
  return "background";
586
610
  }
587
611
 
588
- 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_UNIT_SEC, NODARO_IMPORT_FILES, NODARO_LOAD_TIMELINE, NODARO_LOAD_VIDEO, NODARO_RESET_PROJECT, 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, videoMaskBilledSeconds, videoMaskCreditId, videoMaskCreditIds };
589
- //# sourceMappingURL=chunk-KZGGUDAB.js.map
590
- //# sourceMappingURL=chunk-KZGGUDAB.js.map
612
+ 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_UNIT_SEC, NODARO_IMPORT_FILES, NODARO_LOAD_TIMELINE, NODARO_LOAD_VIDEO, NODARO_RESET_PROJECT, VIDEO_FACE_MESH_LIMITS, 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, videoMaskBilledSeconds, videoMaskCreditId, videoMaskCreditIds };
613
+ //# sourceMappingURL=chunk-DSSPAET7.js.map
614
+ //# sourceMappingURL=chunk-DSSPAET7.js.map
@@ -1 +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/generate-mask.ts","../src/mask-composite.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,MAAM,SAAS,CAAC,CAAA,KAAc,KAAK,KAAA,CAAM,CAAA,GAAI,GAAG,CAAA,GAAI,GAAA;AACpD,EAAA,MAAM,EAAA,GAAKA,QAAAA,CAAQ,GAAA,CAAI,CAAA,GAAI,MAAM,KAAK,CAAA;AACtC,EAAA,MAAM,EAAA,GAAKA,QAAAA,CAAQ,GAAA,CAAI,CAAA,GAAI,MAAM,MAAM,CAAA;AACvC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A,CAAK,YAAA,EAAc,EAAE,kBAAA,EAAoB,CAAA,CAAE,kBAAA,EAAoB,CAAA,CAAE,YAAY,CAAA;AAAA,IACvG,eAAA,EAAiB,YAAY,IAAA,CAAK,eAAA,EAAiB,EAAE,qBAAA,EAAuB,CAAA,CAAE,qBAAA,EAAuB,CAAA,CAAE,eAAe,CAAA;AAAA,IACtH,aAAA,EAAgB,+BAAqD,QAAA,CAAS,IAAA,CAAK,aAAuB,CAAA,GACrG,IAAA,CAAK,gBACN,CAAA,CAAE,aAAA;AAAA,IACN,WAAA,EAAc,6BAAmD,QAAA,CAAS,IAAA,CAAK,WAAqB,CAAA,GAC/F,IAAA,CAAK,cACN,CAAA,CAAE;AAAA,GACR;AACF;AAGO,SAAS,oBAAoB,IAAA,EAA+E;AACjH,EAAA,MAAM,IAAI,IAAA,EAAM,IAAA;AAChB,EAAA,OAAQ,oBAAA,CAA2C,QAAA,CAAS,CAAW,CAAA,GAAK,IAA0B,uBAAA,CAAwB,IAAA;AAChI;AAGO,SAAS,4BAA4B,IAAA,EAAkC;AAC5E,EAAA,OAAO,IAAA,KAAS,OAAA;AAClB;AAQO,SAAS,wBAAwB,IAAA,EAA0F;AAChI,EAAA,OAAO,2BAAA,CAA4B,mBAAA,CAAoB,IAAI,CAAC,IAAI,OAAA,GAAU,kBAAA;AAC5E;AAQO,SAAS,kCAAkC,CAAA,EAAkF;AAClI,EAAA,IAAI,2BAAA,CAA4B,CAAA,CAAE,IAAI,CAAA,SAAU,CAAA,CAAE,WAAA;AAClD,EAAA,OAAO,YAAA;AACT","file":"chunk-QHODM5TS.cjs","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\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`, 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 */\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.\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. An unknown or\n * non-positive length prices the LONGEST row (a clip the route could not\n * measure is refused, so this is only the pre-run quote for a clip whose\n * length is not known yet); anything past the cap prices the last 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 i = VIDEO_MASK_BUCKETS_SEC.findIndex((b) => billedSec <= 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 * 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 */\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 * Pricing units for a result `durationSec` long: one per started 5 seconds,\n * at least one. An unknown length counts the longest result a run accepts\n * (an upper bound — the pre-run quote for a clip whose length is not known\n * 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 // The epsilon absorbs float noise (a 10.0000001 s probe is 2 units, not 3).\n return Math.max(1, Math.ceil(sec / MASK_COMPOSITE_UNIT_SEC - 1e-6))\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"]}
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"],"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,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AE,OAAO,CAAA;AAAA,IAC1E,IAAA,EAAM,oBAAoB,IAAI,CAAA;AAAA,IAC9B,YAAA,EAAc,YAAY,IAAA,CAAK,YAAA,EAAc,EAAE,kBAAA,EAAoB,CAAA,CAAE,kBAAA,EAAoB,CAAA,CAAE,YAAY,CAAA;AAAA,IACvG,eAAA,EAAiB,YAAY,IAAA,CAAK,eAAA,EAAiB,EAAE,qBAAA,EAAuB,CAAA,CAAE,qBAAA,EAAuB,CAAA,CAAE,eAAe,CAAA;AAAA,IACtH,aAAA,EAAgB,+BAAqD,QAAA,CAAS,IAAA,CAAK,aAAuB,CAAA,GACrG,IAAA,CAAK,gBACN,CAAA,CAAE,aAAA;AAAA,IACN,WAAA,EAAc,6BAAmD,QAAA,CAAS,IAAA,CAAK,WAAqB,CAAA,GAC/F,IAAA,CAAK,cACN,CAAA,CAAE;AAAA,GACR;AACF;AAGO,SAAS,oBAAoB,IAAA,EAA+E;AACjH,EAAA,MAAM,IAAI,IAAA,EAAM,IAAA;AAChB,EAAA,OAAQ,oBAAA,CAA2C,QAAA,CAAS,CAAW,CAAA,GAAK,IAA0B,uBAAA,CAAwB,IAAA;AAChI;AAGO,SAAS,4BAA4B,IAAA,EAAkC;AAC5E,EAAA,OAAO,IAAA,KAAS,OAAA;AAClB;AAQO,SAAS,wBAAwB,IAAA,EAA0F;AAChI,EAAA,OAAO,2BAAA,CAA4B,mBAAA,CAAoB,IAAI,CAAC,IAAI,OAAA,GAAU,kBAAA;AAC5E;AAQO,SAAS,kCAAkC,CAAA,EAAkF;AAClI,EAAA,IAAI,2BAAA,CAA4B,CAAA,CAAE,IAAI,CAAA,SAAU,CAAA,CAAE,WAAA;AAClD,EAAA,OAAO,YAAA;AACT","file":"chunk-DSSPAET7.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\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`, 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 */\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.\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. An unknown or\n * non-positive length prices the LONGEST row (a clip the route could not\n * measure is refused, so this is only the pre-run quote for a clip whose\n * length is not known yet); anything past the cap prices the last 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 i = VIDEO_MASK_BUCKETS_SEC.findIndex((b) => billedSec <= 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.\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 { 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 * 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.\n */\nexport const VIDEO_FACE_MESH_RECIPE = \"2026-11-01\"\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. 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 i = VIDEO_FACE_MESH_BUCKETS_SEC.findIndex((b) => billedSec <= 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\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 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 */\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 * Pricing units for a result `durationSec` long: one per started 5 seconds,\n * at least one. An unknown length counts the longest result a run accepts\n * (an upper bound — the pre-run quote for a clip whose length is not known\n * 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 // The epsilon absorbs float noise (a 10.0000001 s probe is 2 units, not 3).\n return Math.max(1, Math.ceil(sec / MASK_COMPOSITE_UNIT_SEC - 1e-6))\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"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkHSJU5KNR_cjs = require('./chunk-HSJU5KNR.cjs');
3
+ var chunkJ4CVGAAV_cjs = require('./chunk-J4CVGAAV.cjs');
4
4
  var chunkYWNYGYI7_cjs = require('./chunk-YWNYGYI7.cjs');
5
5
  var chunk5PCI6M44_cjs = require('./chunk-5PCI6M44.cjs');
6
6
  var zod = require('zod');
@@ -914,10 +914,10 @@ function pickHeldRow(rows, edge, iterating) {
914
914
  if (rows.length === 0) return { kind: "unaffected" };
915
915
  const mode = edge?.outputMode ?? "each";
916
916
  const held = (row) => isBlank(row) ? { kind: "none" } : { kind: "value", value: row };
917
- if (mode === "item") return held(rows[chunkHSJU5KNR_cjs.resolveIndex(edge?.itemIndex ?? "1", rows.length)]);
917
+ if (mode === "item") return held(rows[chunkJ4CVGAAV_cjs.resolveIndex(edge?.itemIndex ?? "1", rows.length)]);
918
918
  if (mode.startsWith("item:")) return held(rows[parseInt(mode.slice(5), 10)]);
919
- if (mode !== "each" || iterating || chunkHSJU5KNR_cjs.isDefaultSelectorConfig(edge)) return { kind: "unaffected" };
920
- const kept = compactWithRows(chunkHSJU5KNR_cjs.selectListItems([...rows], edge)).items;
919
+ if (mode !== "each" || iterating || chunkJ4CVGAAV_cjs.isDefaultSelectorConfig(edge)) return { kind: "unaffected" };
920
+ const kept = compactWithRows(chunkJ4CVGAAV_cjs.selectListItems([...rows], edge)).items;
921
921
  return kept.length > 0 ? { kind: "value", value: kept[0] } : { kind: "none" };
922
922
  }
923
923
  function liveRowColumn(rows, colIndex) {
@@ -973,9 +973,9 @@ function alignedFieldList(value, path) {
973
973
  if (!Array.isArray(value) || value.length === 0) return void 0;
974
974
  const out = [];
975
975
  for (const element of value) {
976
- const found = chunkHSJU5KNR_cjs.evaluateJsonPath(element, path);
976
+ const found = chunkJ4CVGAAV_cjs.evaluateJsonPath(element, path);
977
977
  if (found.length > 1) return void 0;
978
- out.push(chunkHSJU5KNR_cjs.stringifyPathResults(found)[0] ?? "");
978
+ out.push(chunkJ4CVGAAV_cjs.stringifyPathResults(found)[0] ?? "");
979
979
  }
980
980
  return out.some((v) => v.length > 0) ? out : void 0;
981
981
  }
@@ -1095,8 +1095,8 @@ var textCollator = new Intl.Collator(void 0, {
1095
1095
  });
1096
1096
  function extractRawKey(item, field) {
1097
1097
  if (field === "") return item;
1098
- const parsed = chunkHSJU5KNR_cjs.tryParseJson(item);
1099
- const matches = chunkHSJU5KNR_cjs.evaluateJsonPath(parsed, field);
1098
+ const parsed = chunkJ4CVGAAV_cjs.tryParseJson(item);
1099
+ const matches = chunkJ4CVGAAV_cjs.evaluateJsonPath(parsed, field);
1100
1100
  return matches.length > 0 ? matches[0] : void 0;
1101
1101
  }
1102
1102
  function isMissing(v) {
@@ -1657,7 +1657,7 @@ function zipMergeLists(lists) {
1657
1657
  for (const list of nonEmpty) {
1658
1658
  const item = list[i % list.length];
1659
1659
  rawItems.push(item);
1660
- const parsed = chunkHSJU5KNR_cjs.tryParseJson(item);
1660
+ const parsed = chunkJ4CVGAAV_cjs.tryParseJson(item);
1661
1661
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
1662
1662
  hasObject = true;
1663
1663
  Object.assign(merged, parsed);
@@ -1671,7 +1671,7 @@ function zipMergeLists(lists) {
1671
1671
  // src/workflow-export.ts
1672
1672
  var TEMPLATE_KEEP_CONFIG_KEYS = /* @__PURE__ */ new Set(["shots"]);
1673
1673
  var GENERATED_FIELDS = [
1674
- ...[...chunkHSJU5KNR_cjs.EXECUTION_DATA_KEYS].filter((k) => !TEMPLATE_KEEP_CONFIG_KEYS.has(k)),
1674
+ ...[...chunkJ4CVGAAV_cjs.EXECUTION_DATA_KEYS].filter((k) => !TEMPLATE_KEEP_CONFIG_KEYS.has(k)),
1675
1675
  "assetId"
1676
1676
  ];
1677
1677
  var NODE_EXTRA_FIELDS = {
@@ -1732,7 +1732,7 @@ function stripExportContent(nodes) {
1732
1732
  return stripUnownedRefs(nodes).map((node) => {
1733
1733
  const data = { ...node.data };
1734
1734
  for (const field of GENERATED_FIELDS) delete data[field];
1735
- for (const field of chunkHSJU5KNR_cjs.NODE_TYPE_EXECUTION_DATA_KEYS[node.type] ?? []) delete data[field];
1735
+ for (const field of chunkJ4CVGAAV_cjs.NODE_TYPE_EXECUTION_DATA_KEYS[node.type] ?? []) delete data[field];
1736
1736
  const extras = NODE_EXTRA_FIELDS[node.type] ?? [];
1737
1737
  for (const field of extras) delete data[field];
1738
1738
  const provenance = data.mcpProvenance;
@@ -2068,5 +2068,5 @@ exports.timezoneOffsetMinutes = timezoneOffsetMinutes;
2068
2068
  exports.validateSubWorkflowRoutes = validateSubWorkflowRoutes;
2069
2069
  exports.variantJobId = variantJobId;
2070
2070
  exports.zipMergeLists = zipMergeLists;
2071
- //# sourceMappingURL=chunk-P4QT7JGD.cjs.map
2072
- //# sourceMappingURL=chunk-P4QT7JGD.cjs.map
2071
+ //# sourceMappingURL=chunk-FBLMWA2R.cjs.map
2072
+ //# sourceMappingURL=chunk-FBLMWA2R.cjs.map