@nodaro/shared 3.62.0 → 3.64.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.
- package/dist/{chunk-C7POAYFE.js → chunk-36VWLB4J.js} +3 -3
- package/dist/{chunk-C7POAYFE.js.map → chunk-36VWLB4J.js.map} +1 -1
- package/dist/{chunk-S24ZBUB4.js → chunk-3AYM47GW.js} +6 -32
- package/dist/chunk-3AYM47GW.js.map +1 -0
- package/dist/{chunk-YCXRSWCQ.js → chunk-3KTWYYCN.js} +8 -5
- package/dist/chunk-3KTWYYCN.js.map +1 -0
- package/dist/{chunk-ZES6EZC4.js → chunk-4IUE2JB7.js} +3 -3
- package/dist/{chunk-ZES6EZC4.js.map → chunk-4IUE2JB7.js.map} +1 -1
- package/dist/{chunk-MYJQELFN.cjs → chunk-5OBTGNUQ.cjs} +547 -29
- package/dist/chunk-5OBTGNUQ.cjs.map +1 -0
- package/dist/{chunk-TWF2OSH4.cjs → chunk-67CMMTLN.cjs} +4 -4
- package/dist/{chunk-TWF2OSH4.cjs.map → chunk-67CMMTLN.cjs.map} +1 -1
- package/dist/{chunk-WRSWH7US.cjs → chunk-6BRWPJPP.cjs} +17 -2
- package/dist/chunk-6BRWPJPP.cjs.map +1 -0
- package/dist/{chunk-S5TMRJMX.js → chunk-6YIV37V7.js} +4 -4
- package/dist/{chunk-S5TMRJMX.js.map → chunk-6YIV37V7.js.map} +1 -1
- package/dist/{chunk-3M4BNKFJ.cjs → chunk-7AJGUI7L.cjs} +202 -16
- package/dist/chunk-7AJGUI7L.cjs.map +1 -0
- package/dist/{chunk-JZGZ26YB.js → chunk-7KQ6W5DS.js} +4 -4
- package/dist/{chunk-JZGZ26YB.js.map → chunk-7KQ6W5DS.js.map} +1 -1
- package/dist/{chunk-IWWVPR3W.cjs → chunk-ACZZHHFZ.cjs} +149 -34
- package/dist/chunk-ACZZHHFZ.cjs.map +1 -0
- package/dist/{chunk-2W745U4A.cjs → chunk-AZNZ5WNZ.cjs} +42 -70
- package/dist/chunk-AZNZ5WNZ.cjs.map +1 -0
- package/dist/{chunk-HSHCCBIV.js → chunk-BQYCZLMF.js} +16 -3
- package/dist/chunk-BQYCZLMF.js.map +1 -0
- package/dist/chunk-CHS2SIP6.cjs +504 -0
- package/dist/chunk-CHS2SIP6.cjs.map +1 -0
- package/dist/{chunk-CIPPPT7E.cjs → chunk-CHTZZRAL.cjs} +6 -6
- package/dist/{chunk-CIPPPT7E.cjs.map → chunk-CHTZZRAL.cjs.map} +1 -1
- package/dist/{chunk-AOJ6B7K4.cjs → chunk-D4KWNDPH.cjs} +12 -12
- package/dist/chunk-D4KWNDPH.cjs.map +1 -0
- package/dist/{chunk-5YYN5X57.js → chunk-DZ4IOP3Q.js} +536 -30
- package/dist/chunk-DZ4IOP3Q.js.map +1 -0
- package/dist/{chunk-VACPZPUA.cjs → chunk-EXEVT6D2.cjs} +15 -5
- package/dist/chunk-EXEVT6D2.cjs.map +1 -0
- package/dist/{chunk-5M43XMRB.cjs → chunk-FHGRKQVZ.cjs} +8 -8
- package/dist/{chunk-5M43XMRB.cjs.map → chunk-FHGRKQVZ.cjs.map} +1 -1
- package/dist/{chunk-KJSRPHJ2.cjs → chunk-GTWUS6MQ.cjs} +165 -54
- package/dist/chunk-GTWUS6MQ.cjs.map +1 -0
- package/dist/{chunk-Q6IES3U2.js → chunk-H5KHWTAE.js} +5 -2
- package/dist/chunk-H5KHWTAE.js.map +1 -0
- package/dist/{chunk-G3KVK7OU.cjs → chunk-HDPJNNMF.cjs} +21 -21
- package/dist/{chunk-G3KVK7OU.cjs.map → chunk-HDPJNNMF.cjs.map} +1 -1
- package/dist/{chunk-3OYO3XCC.js → chunk-IYSOVS7O.js} +118 -24
- package/dist/chunk-IYSOVS7O.js.map +1 -0
- package/dist/{chunk-AFYTX4AI.cjs → chunk-J6B7J73J.cjs} +110 -50
- package/dist/chunk-J6B7J73J.cjs.map +1 -0
- package/dist/{chunk-I2RQB7VG.js → chunk-KB2SQAR3.js} +3 -3
- package/dist/{chunk-I2RQB7VG.js.map → chunk-KB2SQAR3.js.map} +1 -1
- package/dist/{chunk-BLJUCPMV.cjs → chunk-KSHAAPQF.cjs} +5 -2
- package/dist/chunk-KSHAAPQF.cjs.map +1 -0
- package/dist/{chunk-6G7NN4S4.js → chunk-NIAFR5EE.js} +2 -2
- package/dist/chunk-NIAFR5EE.js.map +1 -0
- package/dist/{chunk-CF4S4N5X.js → chunk-O2QOBA6Q.js} +2 -2
- package/dist/{chunk-CF4S4N5X.js.map → chunk-O2QOBA6Q.js.map} +1 -1
- package/dist/{chunk-IDTKF5EX.cjs → chunk-O4RPXBDZ.cjs} +12 -8
- package/dist/chunk-O4RPXBDZ.cjs.map +1 -0
- package/dist/{chunk-4GGLKRYI.cjs → chunk-O6TBB4IF.cjs} +2 -2
- package/dist/{chunk-4GGLKRYI.cjs.map → chunk-O6TBB4IF.cjs.map} +1 -1
- package/dist/{chunk-PTD6EDUU.js → chunk-OBOOHG3N.js} +13 -4
- package/dist/chunk-OBOOHG3N.js.map +1 -0
- package/dist/{chunk-2D5LQFV4.cjs → chunk-OOZW2MM6.cjs} +9 -9
- package/dist/{chunk-2D5LQFV4.cjs.map → chunk-OOZW2MM6.cjs.map} +1 -1
- package/dist/{chunk-A2PX5IRC.cjs → chunk-PERUFUVH.cjs} +13 -13
- package/dist/{chunk-A2PX5IRC.cjs.map → chunk-PERUFUVH.cjs.map} +1 -1
- package/dist/{chunk-G4U3HW6W.js → chunk-PJJAZQVZ.js} +3 -3
- package/dist/{chunk-G4U3HW6W.js.map → chunk-PJJAZQVZ.js.map} +1 -1
- package/dist/{chunk-E2HZTGYX.js → chunk-Q2Y4JHF7.js} +7 -7
- package/dist/chunk-Q2Y4JHF7.js.map +1 -0
- package/dist/{chunk-FVII3KHN.js → chunk-QYU7J5EQ.js} +198 -17
- package/dist/chunk-QYU7J5EQ.js.map +1 -0
- package/dist/{chunk-JJNNM23P.js → chunk-S3UGLZSF.js} +3 -3
- package/dist/{chunk-JJNNM23P.js.map → chunk-S3UGLZSF.js.map} +1 -1
- package/dist/{chunk-CC4V2B7S.js → chunk-SHH2T4CR.js} +3 -3
- package/dist/{chunk-CC4V2B7S.js.map → chunk-SHH2T4CR.js.map} +1 -1
- package/dist/{chunk-4ZEFP2FQ.cjs → chunk-SPAHI7DY.cjs} +4 -4
- package/dist/{chunk-4ZEFP2FQ.cjs.map → chunk-SPAHI7DY.cjs.map} +1 -1
- package/dist/{chunk-Y6X7UJSD.js → chunk-SXHHLZ22.js} +122 -15
- package/dist/chunk-SXHHLZ22.js.map +1 -0
- package/dist/{chunk-HRY7KGAE.cjs → chunk-T2OVDF2M.cjs} +6 -6
- package/dist/{chunk-HRY7KGAE.cjs.map → chunk-T2OVDF2M.cjs.map} +1 -1
- package/dist/{chunk-2QKF7M2Z.js → chunk-TAPBDT47.js} +3 -3
- package/dist/{chunk-2QKF7M2Z.js.map → chunk-TAPBDT47.js.map} +1 -1
- package/dist/{chunk-NGKKNSK6.js → chunk-TPQJKS7D.js} +139 -16
- package/dist/chunk-TPQJKS7D.js.map +1 -0
- package/dist/{chunk-N7OUQK7E.cjs → chunk-TQW3R44P.cjs} +8 -8
- package/dist/{chunk-N7OUQK7E.cjs.map → chunk-TQW3R44P.cjs.map} +1 -1
- package/dist/{chunk-GSFB537T.js → chunk-TTGZ2L3O.js} +23 -4
- package/dist/chunk-TTGZ2L3O.js.map +1 -0
- package/dist/{chunk-SYWR5G3T.js → chunk-VPTA4Z7G.js} +54 -7
- package/dist/chunk-VPTA4Z7G.js.map +1 -0
- package/dist/{chunk-2HZGDZZN.cjs → chunk-VZ6TE23U.cjs} +6 -6
- package/dist/{chunk-2HZGDZZN.cjs.map → chunk-VZ6TE23U.cjs.map} +1 -1
- package/dist/{chunk-TRVWMKNE.cjs → chunk-W6VJAUGM.cjs} +285 -64
- package/dist/chunk-W6VJAUGM.cjs.map +1 -0
- package/dist/{chunk-UDDVDQMF.js → chunk-W7KHHNZR.js} +235 -37
- package/dist/chunk-W7KHHNZR.js.map +1 -0
- package/dist/{chunk-KYMHFVAZ.cjs → chunk-Y4GCJJPF.cjs} +2 -2
- package/dist/chunk-Y4GCJJPF.cjs.map +1 -0
- package/dist/{chunk-6CSXMWL4.cjs → chunk-YQV53HRR.cjs} +27 -4
- package/dist/chunk-YQV53HRR.cjs.map +1 -0
- package/dist/{chunk-7FCTCWHD.js → chunk-ZI3QDUHO.js} +3 -3
- package/dist/{chunk-7FCTCWHD.js.map → chunk-ZI3QDUHO.js.map} +1 -1
- package/dist/entries/apps.cjs +43 -42
- package/dist/entries/apps.js +8 -7
- package/dist/entries/captions.cjs +38 -30
- package/dist/entries/captions.d.cts +47 -1
- package/dist/entries/captions.d.ts +47 -1
- package/dist/entries/captions.js +1 -1
- package/dist/entries/credits.cjs +354 -174
- package/dist/entries/credits.d.cts +378 -27
- package/dist/entries/credits.d.ts +378 -27
- package/dist/entries/credits.js +11 -11
- package/dist/entries/llm-models.cjs +77 -57
- package/dist/entries/llm-models.d.cts +108 -7
- package/dist/entries/llm-models.d.ts +108 -7
- package/dist/entries/llm-models.js +2 -2
- package/dist/entries/media.cjs +63 -63
- package/dist/entries/media.d.cts +8 -0
- package/dist/entries/media.d.ts +8 -0
- package/dist/entries/media.js +1 -1
- package/dist/entries/model-catalog.cjs +161 -105
- package/dist/entries/model-catalog.d.cts +109 -22
- package/dist/entries/model-catalog.d.ts +109 -22
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +466 -322
- package/dist/entries/models.d.cts +71 -5
- package/dist/entries/models.d.ts +71 -5
- package/dist/entries/models.js +5 -5
- package/dist/entries/nodes.cjs +226 -209
- package/dist/entries/nodes.d.cts +66 -7
- package/dist/entries/nodes.d.ts +66 -7
- package/dist/entries/nodes.js +10 -9
- package/dist/entries/pipeline.cjs +156 -152
- package/dist/entries/pipeline.d.cts +14 -4
- package/dist/entries/pipeline.d.ts +14 -4
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/runtime-config.cjs +29 -29
- package/dist/entries/runtime-config.d.cts +10 -7
- package/dist/entries/runtime-config.d.ts +10 -7
- package/dist/entries/runtime-config.js +1 -1
- package/dist/entries/social.cjs +177 -177
- package/dist/entries/social.js +2 -2
- package/dist/entries/types.d.cts +8 -0
- package/dist/entries/types.d.ts +8 -0
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +154 -150
- package/dist/entries/video.d.cts +11 -2
- package/dist/entries/video.d.ts +11 -2
- package/dist/entries/video.js +6 -6
- package/dist/entries/workflow.cjs +150 -150
- package/dist/entries/workflow.d.cts +1 -1
- package/dist/entries/workflow.d.ts +1 -1
- package/dist/entries/workflow.js +2 -2
- package/dist/index.cjs +2136 -1704
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +27 -27
- package/dist/{model-catalog-CCEcv08q.d.ts → model-catalog-Cf9fkEUp.d.cts} +45 -2
- package/dist/{model-catalog-CCEcv08q.d.cts → model-catalog-Cf9fkEUp.d.ts} +45 -2
- package/dist/{model-constants-B88p6XR0.d.ts → model-constants-BxjiWVQ9.d.ts} +215 -32
- package/dist/{model-constants-Cf3zaITt.d.cts → model-constants-C_Nyft_i.d.cts} +215 -32
- package/package.json +1 -1
- package/src/__tests__/add-captions-nemotron-pricing.test.ts +111 -0
- package/src/__tests__/credit-identifiers.test.ts +29 -0
- package/src/__tests__/extend-providers.test.ts +359 -39
- package/src/__tests__/fixtures/mask-composite-quote-parity.json +1 -1
- package/src/__tests__/fixtures/measured-input-quote-parity.json +1435 -0
- package/src/__tests__/fixtures/planned-length-quote-parity.json +1866 -0
- package/src/__tests__/fixtures/video-utility-quote-parity.json +2343 -0
- package/src/__tests__/flux-3-klein.test.ts +203 -0
- package/src/__tests__/gpt-image-2-6-formats.test.ts +3 -1
- package/src/__tests__/gvp-supported-providers.test.ts +27 -2
- package/src/__tests__/lip-sync-audio-rate.test.ts +74 -0
- package/src/__tests__/lip-sync-levers.test.ts +31 -0
- package/src/__tests__/llm-models.test.ts +139 -12
- package/src/__tests__/llm-price-key.test.ts +164 -1
- package/src/__tests__/model-makers.test.ts +3 -0
- package/src/__tests__/nemotron-transcribe-pricing.test.ts +61 -0
- package/src/__tests__/node-runtime-keys.test.ts +7 -0
- package/src/__tests__/normalize-node-params.test.ts +172 -1
- package/src/__tests__/pixverse-v6-max-catalog.test.ts +271 -0
- package/src/__tests__/prompt-length-limits.test.ts +4 -0
- package/src/__tests__/retired-lip-sync-providers.test.ts +43 -0
- package/src/__tests__/seedance-extend-source-credit-id.test.ts +89 -0
- package/src/__tests__/seedance-task-type.test.ts +13 -3
- package/src/__tests__/sequence-execution.test.ts +22 -1
- package/src/__tests__/suno-credit-type.test.ts +21 -2
- package/src/__tests__/transcribe-capabilities.test.ts +41 -2
- package/src/__tests__/transcribe-preflight.test.ts +50 -1
- package/src/__tests__/video-analysis-catalog-sync.test.ts +4 -2
- package/src/__tests__/video-analysis-pricing.test.ts +10 -9
- package/src/__tests__/video-audio-capability.test.ts +35 -6
- package/src/__tests__/video-resolution-billed-as-named.test.ts +30 -0
- package/src/__tests__/video-upscale-params.test.ts +62 -0
- package/src/caption-styles.ts +62 -0
- package/src/catalog-projection.ts +8 -0
- package/src/credit-estimators/add-captions-nemotron.ts +73 -0
- package/src/credit-estimators/index.ts +20 -0
- package/src/credit-estimators/nemotron-transcribe.ts +87 -0
- package/src/credit-identifiers.ts +351 -41
- package/src/entries/captions.ts +2 -0
- package/src/entries/credits.ts +37 -2
- package/src/entries/llm-models.ts +6 -0
- package/src/entries/model-catalog.ts +22 -0
- package/src/entries/models.ts +50 -0
- package/src/entries/nodes.ts +4 -0
- package/src/entries/pipeline.ts +1 -1
- package/src/entries/video.ts +1 -1
- package/src/flux-3-klein.ts +69 -0
- package/src/freecut-protocol.ts +8 -0
- package/src/input-image-pricing.ts +23 -6
- package/src/lip-sync-levers.ts +56 -0
- package/src/lip-sync-pricing.ts +91 -1
- package/src/llm-models.ts +305 -16
- package/src/model-catalog.ts +529 -28
- package/src/model-constants.ts +417 -41
- package/src/model-tree.ts +2 -1
- package/src/nodaro-video-upscale.ts +48 -0
- package/src/node-default-mappings.ts +6 -0
- package/src/node-runtime-keys.ts +3 -0
- package/src/normalize-node-params.ts +172 -3
- package/src/runtime-config/contract.ts +10 -7
- package/src/seedance-draft.ts +2 -1
- package/src/seedance-extend-rate.ts +116 -0
- package/src/sequence-execution.ts +24 -0
- package/src/transcribe-preflight.ts +81 -7
- package/src/video-analysis-pricing.ts +28 -15
- package/src/video-duration.ts +9 -0
- package/src/video-ui-defaults.ts +5 -3
- package/src/video-upscale-params.ts +67 -0
- package/dist/chunk-2W745U4A.cjs.map +0 -1
- package/dist/chunk-3M4BNKFJ.cjs.map +0 -1
- package/dist/chunk-3OYO3XCC.js.map +0 -1
- package/dist/chunk-5YYN5X57.js.map +0 -1
- package/dist/chunk-6CSXMWL4.cjs.map +0 -1
- package/dist/chunk-6G7NN4S4.js.map +0 -1
- package/dist/chunk-AFYTX4AI.cjs.map +0 -1
- package/dist/chunk-AOJ6B7K4.cjs.map +0 -1
- package/dist/chunk-BLJUCPMV.cjs.map +0 -1
- package/dist/chunk-E2HZTGYX.js.map +0 -1
- package/dist/chunk-FVII3KHN.js.map +0 -1
- package/dist/chunk-GSFB537T.js.map +0 -1
- package/dist/chunk-HSHCCBIV.js.map +0 -1
- package/dist/chunk-IDTKF5EX.cjs.map +0 -1
- package/dist/chunk-IWWVPR3W.cjs.map +0 -1
- package/dist/chunk-KJSRPHJ2.cjs.map +0 -1
- package/dist/chunk-KYMHFVAZ.cjs.map +0 -1
- package/dist/chunk-MYJQELFN.cjs.map +0 -1
- package/dist/chunk-NGKKNSK6.js.map +0 -1
- package/dist/chunk-PTD6EDUU.js.map +0 -1
- package/dist/chunk-Q6IES3U2.js.map +0 -1
- package/dist/chunk-QWYFHQYK.cjs +0 -357
- package/dist/chunk-QWYFHQYK.cjs.map +0 -1
- package/dist/chunk-S24ZBUB4.js.map +0 -1
- package/dist/chunk-SYWR5G3T.js.map +0 -1
- package/dist/chunk-TRVWMKNE.cjs.map +0 -1
- package/dist/chunk-UDDVDQMF.js.map +0 -1
- package/dist/chunk-VACPZPUA.cjs.map +0 -1
- package/dist/chunk-WRSWH7US.cjs.map +0 -1
- package/dist/chunk-Y6X7UJSD.js.map +0 -1
- package/dist/chunk-YCXRSWCQ.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/image-model-roles.ts"],"names":["MODEL_CATALOG"],"mappings":";;;;;AAuBO,IAAM,yBAAA,GAA4B;AAAA,EACvC,SAAA,EAAW,aAAA;AAAA,EACX,OAAA,EAAS,aAAA;AAAA,EACT,MAAA,EAAQ,aAAA;AAAA,EACR,IAAA,EAAM;AACR;AAWO,IAAM,2BAAA,GAAmF;AAAA,EAC9F,SAAA,EAAW,CAAC,wBAAA,EAA0B,wBAAA,EAA0B,iBAAiB,CAAA;AAAA,EACjF,OAAA,EAAS,CAAC,wBAAA,EAA0B,wBAAA,EAA0B,iBAAiB,CAAA;AAAA,EAC/E,MAAA,EAAQ,CAAC,wBAAA,EAA0B,wBAAA,EAA0B,iBAAiB,CAAA;AAAA,EAC9E,IAAA,EAAM,CAAC,4BAAA,EAA8B,4BAAA,EAA8B,iBAAiB;AACtF;AAGO,SAAS,oBAAA,CAAqB,SAAiB,WAAA,EAAsC;AAC1F,EAAA,IAAI,CAAC,aAAa,OAAO,IAAA;AACzB,EAAA,MAAM,MAAA,GAASA,+BAAA,CAAc,OAAO,CAAA,EAAG,YAAA;AACvC,EAAA,OAAO,MAAA,KAAW,MAAA,IAAa,MAAA,CAAO,QAAA,CAAS,WAAW,CAAA;AAC5D;AAQO,SAAS,iBAAA,CAAkB,MAAsB,WAAA,EAAqC;AAC3F,EAAA,MAAM,OAAA,GAAU,0BAA0B,IAAI,CAAA;AAC9C,EAAA,IAAI,oBAAA,CAAqB,OAAA,EAAS,WAAW,CAAA,EAAG,OAAO,OAAA;AACvD,EAAA,OAAO,2BAAA,CAA4B,IAAI,CAAA,CAAE,IAAA,CAAK,CAAC,OAAO,oBAAA,CAAqB,EAAA,EAAI,WAAW,CAAC,CAAA,IAAK,OAAA;AAClG;AAOO,SAAS,wBAAA,CAAyB,UAAkB,WAAA,EAAiD;AAC1G,EAAA,QAAQ,QAAA;AAAU,IAChB,KAAK,gBAAA;AACH,MAAA,OAAO,iBAAA,CAAkB,WAAW,WAAW,CAAA;AAAA,IACjD,KAAK,gBAAA;AAAA,IACL,KAAK,cAAA;AACH,MAAA,OAAO,iBAAA,CAAkB,QAAQ,WAAW,CAAA;AAAA,IAC9C,KAAK,iBAAA;AACH,MAAA,OAAO,iBAAA,CAAkB,aAAa,WAAW,CAAA;AAAA,IACnD;AACE,MAAA,OAAO,MAAA;AAAA;AAEb","file":"chunk-6CSXMWL4.cjs","sourcesContent":["import { MODEL_CATALOG } from \"./model-catalog.js\"\n\n/**\n * The platform's answer to \"which image model, when the caller names none\".\n *\n * One table by ROLE, so every surface that picks for the user (node defaults,\n * route and workflow fallbacks, MCP tools, studios, pipelines) reads the same\n * model instead of keeping its own literal. Before this table those literals\n * had drifted apart: the Generate Image node started on Nano Banana Pro, the\n * routes fell back to the original Nano Banana, and MCP used Nano Banana 2.1.\n *\n * Decided on 2026-10-08 from a blind five-model comparison, quality\n * first and price second:\n * - characters, general text-to-image and video anchors on GPT Image 2;\n * - edits on the current GPT Image Flare (2.6 since 2026-11-09), which renders\n * at its default Medium when a run names no quality.\n * With reference images attached, GPT Image 2 runs as its i2i sibling (the\n * provider swaps it), so `character` covers identity-from-reference too.\n *\n * Nano Banana Pro is no longer a default. It remains a FALLBACK only: last in\n * the ratio chain below, the GPT-family safety-block retry, and the swimwear\n * dressing model.\n */\nexport const IMAGE_MODEL_ROLE_DEFAULTS = {\n character: \"gpt-image-2\",\n general: \"gpt-image-2\",\n anchor: \"gpt-image-2\",\n edit: \"gpt-image-2-6-flare-i2i\",\n} as const\n\nexport type ImageModelRole = keyof typeof IMAGE_MODEL_ROLE_DEFAULTS\n\n/**\n * Where a role's model goes when it cannot draw the requested aspect ratio.\n * GPT Image 2 draws only auto / 1:1 / 16:9 / 9:16 / 4:3 / 3:4, so 21:9, 3:2,\n * 2:3, 4:5, 5:4 and the other wide or in-between ratios move to GPT Image 2.6\n * Sunburst. GPT Image 2.5 Sunburst stays behind it for the ratios only 2.5\n * draws, and Nano Banana Pro comes last.\n */\nexport const IMAGE_MODEL_RATIO_FALLBACKS: Readonly<Record<ImageModelRole, readonly string[]>> = {\n character: [\"gpt-image-2-6-sunburst\", \"gpt-image-2-5-sunburst\", \"nano-banana-pro\"],\n general: [\"gpt-image-2-6-sunburst\", \"gpt-image-2-5-sunburst\", \"nano-banana-pro\"],\n anchor: [\"gpt-image-2-6-sunburst\", \"gpt-image-2-5-sunburst\", \"nano-banana-pro\"],\n edit: [\"gpt-image-2-6-sunburst-i2i\", \"gpt-image-2-5-sunburst-i2i\", \"nano-banana-pro\"],\n}\n\n/** True when the model's catalog entry lists the ratio (or no ratio was asked for). */\nexport function imageModelDrawsRatio(modelId: string, aspectRatio?: string | null): boolean {\n if (!aspectRatio) return true\n const ratios = MODEL_CATALOG[modelId]?.aspectRatios\n return ratios === undefined || ratios.includes(aspectRatio)\n}\n\n/**\n * The default image model for a role at the requested aspect ratio: the role's\n * model when it draws the ratio, else the first fallback that does, else the\n * role's model (whose own ratio normalization then snaps the ratio). Read from\n * the catalog, so widening a model's documented ratios moves this with it.\n */\nexport function defaultImageModel(role: ImageModelRole, aspectRatio?: string | null): string {\n const primary = IMAGE_MODEL_ROLE_DEFAULTS[role]\n if (imageModelDrawsRatio(primary, aspectRatio)) return primary\n return IMAGE_MODEL_RATIO_FALLBACKS[role].find((id) => imageModelDrawsRatio(id, aspectRatio)) ?? primary\n}\n\n/**\n * The model an image node that names none runs on, by node type: the same\n * default its route and its workflow branch apply. For the node types that\n * have one; undefined for any other.\n */\nexport function defaultImageModelForNode(nodeType: string, aspectRatio?: string | null): string | undefined {\n switch (nodeType) {\n case \"generate-image\":\n return defaultImageModel(\"general\", aspectRatio)\n case \"image-to-image\":\n case \"modify-image\":\n return defaultImageModel(\"edit\", aspectRatio)\n case \"reference-board\":\n return defaultImageModel(\"character\", aspectRatio)\n default:\n return undefined\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
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,KAAc,IAAA,CAAK,GAAA,CAAI,GAAG,IAAA,CAAK,GAAA,CAAI,CAAA,EAAG,CAAC,CAAC,CAAA;AACzD,EAAA,MAAM,SAAS,CAAC,CAAA,KAA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7NN4S4.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`, 5.005 s at 29.97 fps → `sam-3.1-video:5s`, 12 s at 24 fps → `sam-3.1-video:15s`,\n * 10 s at 60 fps (priced as 20 s) → `sam-3.1-video:30s`, 45 s at 30 fps → `sam-3.1-video:60s`,\n * 100 s at 30 fps → `sam-3.1-video:120s`, 4 min at 30 fps on SAM 3 → `sam-3-video:240s`.\n *\n * Wire contract only — no I/O.\n */\nimport { pricedClipSeconds } from \"./priced-clip-seconds.js\"\n\n/** Segmentation models a Video Mask run can use. SAM 3.1 (the default)\n * tracks several objects in one pass and runs faster; SAM 3 costs half. */\nexport const VIDEO_MASK_PROVIDERS = [\"sam-3.1\", \"sam-3\"] as const\nexport type VideoMaskProvider = (typeof VIDEO_MASK_PROVIDERS)[number]\nexport const DEFAULT_VIDEO_MASK_PROVIDER: VideoMaskProvider = \"sam-3.1\"\n\n/**\n * `zone`: keep only the subjects whose bounding-box CENTRE lies inside an\n * inner rectangle, given as margins in % of the frame (each\n * `VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN`–`ZONE_MARGIN_PCT_MAX`). All zero, or\n * no zone, = off.\n */\nexport interface VideoMaskZone {\n readonly leftPct: number\n readonly rightPct: number\n readonly topPct: number\n readonly bottomPct: number\n}\n\n/** A new Video Mask node's settings — spread into its node definition. */\nexport const VIDEO_MASK_DEFAULTS = {\n threshold: 0.5,\n provider: \"sam-3.1\" as VideoMaskProvider,\n /** Off: the mask is the model's, frame for frame (see `HOLD_EMPTY_BELOW_FRACTION`). */\n holdLastMask: false,\n /** 0 = off: every region the model finds is kept (see `MIN_SUBJECT_HEIGHT_PCT_*`). */\n minSubjectHeightPct: 0,\n /** 0 = off: no ceiling on a region's height (see `MAX_SUBJECT_HEIGHT_PCT_*`). */\n maxSubjectHeightPct: 0,\n /** Off: subjects anywhere in the frame are kept (see `ZONE_MARGIN_PCT_*`). */\n zone: null as VideoMaskZone | null,\n /**\n * Off: one pass over the whole clip. On: the clip's scene cuts are found\n * first and each shot is segmented on its own — the model starts afresh\n * after every cut (finding the new shot's subjects), and `holdLastMask`\n * never carries a mask across a cut. A clip with no cut (a flash is\n * usually not one) is one shot: the same mask, fitted to the clip's exact\n * frame count.\n */\n perShot: false,\n /**\n * 0 = off: a new detection only where a request starts anyway (the clip's\n * start, every 1,800 frames, and every cut with `perShot`). Above 0: the\n * model is also sent a new request every this many seconds of footage, so a\n * subject that first appears mid-shot is found within that time (see\n * `REDETECT_EVERY_SEC_*`). These boundaries are not cuts: `holdLastMask`\n * keeps holding across them.\n */\n redetectEverySec: 0,\n} as const\n\nexport const VIDEO_MASK_LIMITS = {\n /** The longest input clip a run accepts, in seconds of PRICED length (see `videoMaskBilledSeconds`). */\n MAX_BILLED_SEC: 300,\n /** Frame rate the price rows assume. A faster clip is priced proportionally longer. */\n FPS_BASIS: 30,\n /** Subject description length cap. */\n PROMPT_MAX_LENGTH: 500,\n /** Detection confidence bounds (the model's own range, narrowed to useful values). */\n THRESHOLD_MIN: 0.05,\n THRESHOLD_MAX: 0.95,\n THRESHOLD_STEP: 0.05,\n /** Default detection confidence. Lower finds more (and less precise) regions. */\n THRESHOLD_DEFAULT: VIDEO_MASK_DEFAULTS.threshold,\n /**\n * `holdLastMask`: a frame whose mask covers less than this fraction of the\n * picture (0.002 % — about 41 px at 1080p: a stray speck, never a subject) counts as empty — the subject lost (hidden behind a\n * hand, turned away) — and shows the most recent non-empty frame's mask\n * instead. Frames before the first detection stay as they are.\n */\n HOLD_EMPTY_BELOW_FRACTION: 0.00002,\n /**\n * `holdLastMask`: the longest a mask is held, in seconds of frames (at the\n * clip's rate). The hold is for a subject hidden for a moment; a run of\n * empty frames longer than this shows the held mask for its first second\n * and then nothing, until the model finds the subject again — a mask held\n * on for longer sits where the subject no longer is.\n */\n HOLD_MAX_SEC: 1,\n /**\n * `minSubjectHeightPct`: drop every connected white region (8-connected)\n * whose bounding box is shorter than this % of the frame height — extras'\n * small faces behind the main subject. 0 = off. Applied before\n * `holdLastMask`, so a frame left with only small regions counts as empty\n * and is held from the last frame with a big subject.\n */\n MIN_SUBJECT_HEIGHT_PCT_MIN: 0,\n MIN_SUBJECT_HEIGHT_PCT_MAX: 100,\n /**\n * `maxSubjectHeightPct`, the mirror: drop every region whose bounding box is\n * TALLER than this % of the frame height (keep only the small subjects — a\n * paste-back mask of the background faces). 0 = off. With both set, a\n * region is kept when min ≤ height ≤ max (min > max is refused). Same pass,\n * same order (before `holdLastMask`).\n */\n MAX_SUBJECT_HEIGHT_PCT_MIN: 0,\n MAX_SUBJECT_HEIGHT_PCT_MAX: 100,\n /**\n * `zone` margins (left / right / top / bottom, % of the frame width or\n * height): drop every connected region whose bounding-box centre lies\n * outside `[w·left/100, w·(1−right/100)] × [h·top/100, h·(1−bottom/100)]`\n * — the faces at the edges of the picture. At most 49 % a side, so the\n * inner rectangle is never empty. Applied after the size cut and before\n * `holdLastMask`, so a frame left with nothing inside counts as empty.\n */\n ZONE_MARGIN_PCT_MIN: 0,\n ZONE_MARGIN_PCT_MAX: 49,\n /**\n * `redetectEverySec`: 0 (off) or `REDETECT_EVERY_SEC_MIN`–`MAX` seconds. The\n * model picks up its subjects near the start of each request; a face that\n * turns to the camera, or a person who walks in, partway through a request is\n * never masked. On, the clip (each shot, with `perShot`) is cut into requests\n * of at most this many seconds of frames — counted from the shot's start, a\n * last piece shorter than `VIDEO_MASK_MIN_SHOT_FRAMES` joining the one before\n * — so the subjects are detected again at every such boundary. Each request\n * adds wall time (they run three at a time); the price follows the clip's\n * length and does not change.\n */\n REDETECT_EVERY_SEC_MIN: 1,\n REDETECT_EVERY_SEC_MAX: 10,\n /** The panel's step (the API takes any value in range). */\n REDETECT_EVERY_SEC_STEP: 1,\n} as const\n\n/**\n * The version of what a Video Mask run's mask looks like for a given clip and\n * settings: every finished `video-mask` job reports it as `output_data.recipe`.\n * A mask stored ahead of time and reused (a trend's approved face mask) is\n * held to it, and reads as out of date once it changes.\n *\n * BUMP IT (to the date of the change) whenever the algorithm changes the mask\n * a run produces from the same clip and settings: the cut rule (`perShot`),\n * the hold (`holdLastMask`, `HOLD_*`), the size and zone filters, the\n * rendering. Never for a change that leaves every mask the same (pricing,\n * limits on what is accepted, messages). `\"2026-10-25\"`: the lone-spike cut\n * rule and the 1 s hold cap.\n */\nexport const VIDEO_MASK_RECIPE = \"2026-10-25\"\n\nconst VIDEO_MASK_BUCKETS_SEC = [5, 10, 15, 30, 60, 90, 120, 180, 240, 300] as const\n\n/** Every price row a provider can be charged from, smallest first. */\nexport function videoMaskCreditIds(provider: VideoMaskProvider = DEFAULT_VIDEO_MASK_PROVIDER): string[] {\n return VIDEO_MASK_BUCKETS_SEC.map((sec) => `${provider}-video:${sec}s`)\n}\n\n/**\n * The length a clip is priced at: its duration at the 30 fps basis. A clip\n * at or under 30 fps is priced at its own length; a 60 fps clip at twice it.\n * An unknown frame rate counts as the basis. The cap reads this figure; the\n * price row reads it through `pricedClipSeconds`.\n */\nexport function videoMaskBilledSeconds(durationSec: number, fps?: number | null): number {\n const rate = typeof fps === \"number\" && Number.isFinite(fps) && fps > 0 ? fps : VIDEO_MASK_LIMITS.FPS_BASIS\n return durationSec * Math.max(1, rate / VIDEO_MASK_LIMITS.FPS_BASIS)\n}\n\n/**\n * The price row for a clip priced at `billedSec` seconds: the smallest that\n * holds it, after `pricedClipSeconds` (up to 0.05 s past a row's length stays in\n * that row). An unknown or non-positive length prices the LONGEST row (a clip\n * the route could not measure is refused, so this is only the pre-run quote for\n * a clip whose length is not known yet); anything past the cap prices the last\n * row.\n */\nexport function videoMaskCreditId(\n billedSec: number | null | undefined,\n provider: VideoMaskProvider = DEFAULT_VIDEO_MASK_PROVIDER,\n): string {\n const ids = videoMaskCreditIds(provider)\n if (typeof billedSec !== \"number\" || !Number.isFinite(billedSec) || billedSec <= 0) return ids[ids.length - 1]!\n const priced = pricedClipSeconds(billedSec)\n const i = VIDEO_MASK_BUCKETS_SEC.findIndex((b) => priced <= b)\n return ids[i === -1 ? ids.length - 1 : i]!\n}\n\n/** Narrow an arbitrary value to a known provider, falling back to the default. */\nexport function resolveVideoMaskProvider(value: unknown): VideoMaskProvider {\n return (VIDEO_MASK_PROVIDERS as readonly string[]).includes(value as string)\n ? (value as VideoMaskProvider)\n : DEFAULT_VIDEO_MASK_PROVIDER\n}\n\n/**\n * A zone as the region filter reads it: each margin a finite number clamped\n * to `ZONE_MARGIN_PCT_MIN`–`ZONE_MARGIN_PCT_MAX` (anything else is 0), and\n * null when there is no zone or every margin is 0 (off). The one reading\n * shared by the worker, a workflow run's payload and the node's own run.\n */\nexport function resolveVideoMaskZone(value: unknown): VideoMaskZone | null {\n if (!value || typeof value !== \"object\") return null\n const v = value as Record<string, unknown>\n const margin = (x: unknown) =>\n typeof x === \"number\" && Number.isFinite(x)\n ? Math.min(VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MAX, Math.max(VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN, x))\n : 0\n const zone = { leftPct: margin(v.leftPct), rightPct: margin(v.rightPct), topPct: margin(v.topPct), bottomPct: margin(v.bottomPct) }\n return zone.leftPct > 0 || zone.rightPct > 0 || zone.topPct > 0 || zone.bottomPct > 0 ? zone : null\n}\n\n/**\n * `redetectEverySec` as a run reads it: a finite number above 0 clamped to\n * `REDETECT_EVERY_SEC_MIN`–`MAX` (a value between 0 and the minimum snaps up\n * to it — it asked for re-detection); anything else (absent, 0, negative,\n * not a number) is 0 = off. The one reading shared by the worker, a workflow\n * run's payload, the node's own run and its panel (the route refuses a value\n * out of range instead).\n */\nexport function resolveVideoMaskRedetectSec(value: unknown): number {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value <= 0) return 0\n return Math.min(VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MAX, Math.max(VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MIN, value))\n}\n\n/** `POST /v1/video-mask` request body. */\nexport interface VideoMaskRequest {\n /** The clip to segment. */\n readonly videoUrl: string\n /** What to track: a short noun phrase; separate several with commas. */\n readonly prompt: string\n /** Detection confidence, `VIDEO_MASK_LIMITS.THRESHOLD_MIN`–`THRESHOLD_MAX` (default 0.5). */\n readonly threshold?: number\n readonly provider?: VideoMaskProvider\n /** Hold the last mask where the subject is lost (default false): an empty frame\n * after the first detection repeats the most recent non-empty one. */\n readonly holdLastMask?: boolean\n /** Ignore subjects smaller than this % of the frame height, 0–100 (default 0 = off):\n * connected regions whose bounding box is shorter are dropped from every frame. */\n readonly minSubjectHeightPct?: number\n /** Ignore subjects larger than this % of the frame height, 0–100 (default 0 = off):\n * connected regions whose bounding box is taller are dropped from every frame. */\n readonly maxSubjectHeightPct?: number\n /** Keep only the subjects whose bounding-box centre is inside these margins, each\n * 0–49 % of the frame (a margin left out is 0). null / omitted / all 0 = off. */\n readonly zone?: Partial<VideoMaskZone> | null\n /** Segment each shot on its own (default false): the clip's scene cuts are found\n * first and the subjects are detected again in every shot; `holdLastMask` never\n * carries a mask across a cut. The output then carries `shots`. */\n readonly perShot?: boolean\n /** Detect the subjects again every this many seconds (0 = off, the default, or\n * `VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MIN`–`MAX`): the clip — each shot, with\n * `perShot` — is sent to the model in pieces of at most that length, so a subject\n * that first appears mid-shot is masked from the next boundary on. Not a cut:\n * `holdLastMask` holds across these boundaries. Slower (more requests); same price. */\n readonly redetectEverySec?: number\n}\n","/**\n * Video Face Mesh (`POST /v1/video-face-mesh`, job type `video-face-mesh`):\n * thin GRAY face lines — a wireframe, and darker eye and lip outlines, each a\n * tone of the picture under it — drawn on the faces of a clip, frame for\n * frame. An internal step of Nodaro Motion's face masking: the lines go on\n * the masked (or depth) clip so the video model still sees where the mouth\n * and the eyes are. A request may draw only the eye and lip outlines, only\n * the lip outline, or the face's contours (`parts`).\n *\n * Priced by the clip's length at the 30 fps basis Video Mask uses\n * (`videoMaskBilledSeconds`), one row per length bucket.\n */\nimport { pricedClipSeconds } from \"./priced-clip-seconds.js\"\nimport { VIDEO_MASK_LIMITS, type VideoMaskZone } from \"./video-mask.js\"\nimport type { VideoDepthColormap } from \"./video-depth.js\"\n\n/** The route, as the Cast Swap engine calls it. */\nexport const VIDEO_FACE_MESH_PATH = \"/v1/video-face-mesh\"\n\nexport const VIDEO_FACE_MESH_LIMITS = {\n /** The longest clip a run accepts, in seconds of PRICED length (the 30 fps basis): Video Mask's own cap. */\n MAX_BILLED_SEC: VIDEO_MASK_LIMITS.MAX_BILLED_SEC,\n /** `minFaceHeightPct` / `maxFaceHeightPct` bounds (0 = off). */\n FACE_HEIGHT_PCT_MIN: 0,\n FACE_HEIGHT_PCT_MAX: 100,\n /** `zone` margin bounds, as Video Mask's. */\n ZONE_MARGIN_PCT_MIN: VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN,\n ZONE_MARGIN_PCT_MAX: VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MAX,\n} as const\n\n/**\n * What a face mesh run draws on each face (`VideoFaceMeshRequest.parts`):\n * `\"full\"` (the default) the thin wireframe and the darker eye and lip\n * outlines; `\"features\"` the eye outlines and the lip outline only, no\n * wireframe; `\"mouth\"` the lip outline only; `\"contours\"` the face oval,\n * both eyebrows, the nose and the eye and lip outlines, no wireframe (a host\n * that draws them says so to its engine: `videoFaceMeshContours`).\n */\nexport const VIDEO_FACE_MESH_PARTS = [\"full\", \"features\", \"mouth\", \"contours\"] as const\nexport type VideoFaceMeshParts = (typeof VIDEO_FACE_MESH_PARTS)[number]\n\n/**\n * The face mesh's layers (`VideoFaceMeshRequest.layers`), each drawn or not\n * on its own:\n * - `wireframe`: the thin mesh over the whole face;\n * - `eyes`: the eye outlines; `lips`: the lip outline, outer and inner;\n * - `contours`: the face oval, both eyebrows and the nose. With it on, every\n * line drawn leaves out what the face hides (a turned face's far side);\n * with it off, nothing is left out;\n * - `irises`: a circle round each iris and a dot at its centre, drawn only\n * inside the eye's opening (an eyelid covers it, a closed eye hides it);\n * - `bold`: the lines drawn thicker and in a deeper tone. It draws nothing\n * of its own: it changes the lines of the other layers.\n * Every `parts` value is one set of layers (`videoFaceMeshLayersOfParts`),\n * drawn exactly as that value is.\n */\nexport const VIDEO_FACE_MESH_LAYERS = [\"wireframe\", \"eyes\", \"lips\", \"contours\", \"irises\", \"bold\"] as const\nexport type VideoFaceMeshLayer = (typeof VIDEO_FACE_MESH_LAYERS)[number]\n/** The layers that draw lines of their own (all but `bold`): a set needs at least one. */\nexport const VIDEO_FACE_MESH_LINE_LAYERS = [\"wireframe\", \"eyes\", \"lips\", \"contours\", \"irises\"] as const satisfies readonly VideoFaceMeshLayer[]\n/** A set of layers: each one on when `true`; left out or `false` is off. */\nexport type VideoFaceMeshLayers = { readonly [K in VideoFaceMeshLayer]?: boolean }\n\nconst PARTS_LAYERS: Readonly<Record<VideoFaceMeshParts, readonly VideoFaceMeshLayer[]>> = {\n full: [\"wireframe\", \"eyes\", \"lips\"],\n features: [\"eyes\", \"lips\"],\n mouth: [\"lips\"],\n contours: [\"eyes\", \"lips\", \"contours\"],\n}\n\n/** The set of layers a `parts` value draws (left out: `\"full\"`), a new object with only its layers, each `true`. */\nexport function videoFaceMeshLayersOfParts(parts: VideoFaceMeshParts = \"full\"): VideoFaceMeshLayers {\n return Object.fromEntries(PARTS_LAYERS[parts].map((l) => [l, true]))\n}\n\n/** The set with only its layers that are on, each `true`, in `VIDEO_FACE_MESH_LAYERS` order: a new object. */\nexport function videoFaceMeshLayersOn(layers: VideoFaceMeshLayers | null | undefined): VideoFaceMeshLayers {\n return Object.fromEntries(VIDEO_FACE_MESH_LAYERS.filter((l) => layers?.[l] === true).map((l) => [l, true]))\n}\n\n/** Whether the set draws any line (a layer other than `bold` on). */\nexport function videoFaceMeshLayersDrawLines(layers: VideoFaceMeshLayers | null | undefined): boolean {\n return VIDEO_FACE_MESH_LINE_LAYERS.some((l) => layers?.[l] === true)\n}\n\n/**\n * The `parts` value that draws exactly this set of layers, or undefined when\n * none does (a set only layers can name: the irises, bold lines, the eyes\n * alone…). `among` limits the values it may answer (a setting that takes only\n * some of them).\n */\nexport function videoFaceMeshPartsOfLayers(\n layers: VideoFaceMeshLayers | null | undefined,\n among: readonly VideoFaceMeshParts[] = VIDEO_FACE_MESH_PARTS,\n): VideoFaceMeshParts | undefined {\n const on = VIDEO_FACE_MESH_LAYERS.filter((l) => layers?.[l] === true)\n return among.find((p) => PARTS_LAYERS[p].length === on.length && PARTS_LAYERS[p].every((l) => on.includes(l)))\n}\n\n/**\n * The version of what a face mesh run draws for a given clip and settings:\n * every finished `video-face-mesh` job reports it as `output_data.recipe`,\n * for the caller to record beside a clip it stores with the lines on it (a\n * trend's approved face mask). Nothing on the platform compares it yet: a\n * stored mask is held to Video Mask's recipe and the engine's own.\n *\n * BUMP IT (to the date of the change) whenever the drawing changes for the\n * same input: the model, the crop, the smoothing, the filters, the colours or\n * the widths. Never for pricing, limits or messages. 2026-11-02: MediaPipe's\n * refined landmark model (478 points, a 256 × 256 crop) in place of the basic\n * one; the lines' colours and widths are 2026-11-01's. 2026-11-03: a face gets\n * lines only when it is found in at least 3 frames of its track (found faces\n * at the same place in frames at most 2 apart): one found in a frame or two\n * is never drawn.\n */\nexport const VIDEO_FACE_MESH_RECIPE = \"2026-11-03\"\n\nconst VIDEO_FACE_MESH_BUCKETS_SEC = [5, 10, 15, 30, 60, 120, 300] as const\n\n/** Every price row, smallest first (`video-face-mesh:<n>s`). */\nexport function videoFaceMeshCreditIds(): string[] {\n return VIDEO_FACE_MESH_BUCKETS_SEC.map((sec) => `video-face-mesh:${sec}s`)\n}\n\n/**\n * The price row for a clip priced at `billedSec` seconds: the smallest bucket\n * that holds it, after `pricedClipSeconds` (up to 0.05 s past a bucket's length\n * stays in that bucket). An unknown or non-positive length, or one past the cap,\n * prices the LONGEST row (the route measures every clip and refuses one past\n * the cap, so this is only ever a ceiling).\n */\nexport function videoFaceMeshCreditId(billedSec: number | null | undefined): string {\n const ids = videoFaceMeshCreditIds()\n if (typeof billedSec !== \"number\" || !Number.isFinite(billedSec) || billedSec <= 0) return ids[ids.length - 1]!\n const priced = pricedClipSeconds(billedSec)\n const i = VIDEO_FACE_MESH_BUCKETS_SEC.findIndex((b) => priced <= b)\n return ids[i === -1 ? ids.length - 1 : i]!\n}\n\n/** `POST /v1/video-face-mesh` request body. */\nexport interface VideoFaceMeshRequest {\n /** The clip the faces are FOUND in (the original). */\n readonly videoUrl: string\n /** The clip the lines are DRAWN on (default `videoUrl`): the masked or depth clip. Same frame count. */\n readonly drawOnUrl?: string\n /** A mask video (white = covered, same frame count): only faces whose box centre lies inside it are drawn. */\n readonly maskUrl?: string\n /** Draw only faces at least this % of the frame's height (default 0 = off). */\n readonly minFaceHeightPct?: number\n /** Draw only faces at most this % of the frame's height (0 = no cap). */\n readonly maxFaceHeightPct?: number\n /** Margins (% of the frame) where no face is drawn. */\n readonly zone?: Partial<VideoMaskZone> | null\n /**\n * The depth map's colormap (Video Depth's `VIDEO_DEPTH_COLORMAPS`) when the\n * lines go on a depth map: each line is then a colour OF that map — the map\n * at the line's tone of the depth under it. Needs `depthUrl`, except\n * `grayscale` (a gray depth clip is its own depth). Left out with a\n * `depthUrl`: `grayscale`.\n */\n readonly colormap?: VideoDepthColormap\n /**\n * The GRAYSCALE depth render of the clip (Video Depth with `colormap:\n * \"grayscale\"`, same frame count as `videoUrl`, any size): the depth each\n * line's colour is read from. Left out (a blurred mask, a gray depth clip\n * drawn on directly): each line is a gray tone of the pixel under it.\n */\n readonly depthUrl?: string\n /**\n * What is drawn on each face (`VIDEO_FACE_MESH_PARTS`): left out or\n * `\"full\"`, the wireframe and the eye and lip outlines; `\"features\"`, the\n * eye and lip outlines only; `\"mouth\"`, the lip outline only. The outlines\n * are drawn as they are in the full mesh (the same tone and width).\n */\n readonly parts?: VideoFaceMeshParts\n /**\n * What is drawn, layer by layer (`VIDEO_FACE_MESH_LAYERS`), in place of\n * `parts` (never both). At least one layer other than `bold`. A set that is\n * a `parts` value's draws exactly as that value does.\n */\n readonly layers?: VideoFaceMeshLayers\n}\n\n/** A finished `video-face-mesh` job's `output_data`. */\nexport interface VideoFaceMeshOutput {\n /** The drawn clip: `drawOnUrl`'s frame count, size and frame rate, its audio copied untouched. */\n readonly videoUrl: string\n readonly width: number\n readonly height: number\n readonly frames: number\n /** Frames with at least one face drawn. */\n readonly framesWithFaces: number\n /** Faces drawn, summed over the frames (0 = nothing drawn; the clip comes back as it was sent). */\n readonly facesDrawn: number\n /** The map the lines were coloured from (a request with `depthUrl`); absent = gray tones of the pixel under them. */\n readonly colormap?: VideoDepthColormap\n /** What was drawn when it was not the full mesh (a request with `parts` `\"features\"` or `\"mouth\"`); absent = the full mesh. */\n readonly parts?: Exclude<VideoFaceMeshParts, \"full\">\n /** The layers drawn, for a request that named `layers` (only those on, each `true`); absent: `parts` says. */\n readonly layers?: VideoFaceMeshLayers\n readonly recipe: string\n}\n","/**\n * Generate Mask — text-prompted IMAGE segmentation (Grounded SAM). The wire\n * contract of `POST /v1/generate-mask`, the `generate_mask` MCP verb, the SDK's\n * `nodes.run(\"generate-mask\", …)` and `nodaro media generate-mask`, defined ONCE:\n * every bound the route schema and the SDK/CLI read.\n *\n * The finished job's output is `{ maskUrl, imageUrl }`: `maskUrl` is the\n * black-and-white mask PNG (white = the subject), `imageUrl` is the SOURCE\n * image passed through unchanged, so an inpainting step can take the pair.\n *\n * Wire contract only — no I/O.\n */\n\nexport const GENERATE_MASK_LIMITS = {\n /** Subject description length cap. */\n PROMPT_MAX_LENGTH: 500,\n /** Segmentation confidence bounds. */\n THRESHOLD_MIN: 0,\n THRESHOLD_MAX: 1,\n /** Default segmentation confidence. Lower selects more (and less precise) regions. */\n THRESHOLD_DEFAULT: 0.3,\n} as const\n\n/** `POST /v1/generate-mask` request body. */\nexport interface GenerateMaskRequest {\n /** The image to segment. */\n readonly imageUrl: string\n /** What to select, in plain words (e.g. \"the person\", \"sky and clouds\"). 1–500 characters. */\n readonly prompt: string\n /** Segmentation confidence, `GENERATE_MASK_LIMITS.THRESHOLD_MIN`–`THRESHOLD_MAX` (default 0.3). */\n readonly threshold?: number\n}\n\n/** A completed Generate Mask job's `output_data`. */\nexport interface GenerateMaskOutput {\n /** The mask: a black-and-white PNG, white = the subject. */\n readonly maskUrl: string\n /** The source image, passed through unchanged. */\n readonly imageUrl: string\n}\n","/**\n * Mask Composite — place a foreground video over a background video through a\n * mask video (white = keep the foreground, black = show the background). The\n * wire contract of the `mask-composite` node, `POST /v1/mask-composite`, the\n * `mask_composite` MCP verb, `client.media.maskComposite` and\n * `nodaro media mask-composite`, defined ONCE. Pair it with Video Mask, whose\n * output is exactly such a mask.\n *\n * The render follows the FOREGROUND: its size, frame rate and length. The\n * background is fitted to that frame (`backgroundFit`) and loops when shorter;\n * the mask is stretched to the frame and holds its last frame when shorter.\n *\n * `fill` picks what fills the masked area. `\"video\"` (the default) is the\n * foreground, as above. `\"pixelate\"` and `\"blur\"` fill it with the BACKGROUND\n * itself, pixelated or blurred: there is no foreground then (a sent\n * `foregroundUrl` is ignored), so the render follows the BACKGROUND (its size,\n * frame rate and length; `backgroundFit` has nothing to fit), and the run is\n * priced on the background's length. With no foreground the result always\n * carries the background's sound — `audioSource` is ignored there\n * ({@link maskCompositeEffectiveAudioSource}); the canvas hides the control.\n *\n * Priced per started 5 seconds of the result (the foreground's length), like\n * Trim / Loop / Combine Videos: the node's own `model_pricing` row is ONE unit\n * (`maskCompositeUnits` counts them). Worked examples (repeated in\n * docs/nodes/processing-video/mask-composite.md, at the 10-credit row):\n * 3 s → 1 unit (10), 10 s → 2 units (20), 61 s → 13 units (130), 5 min → 60 units (600).\n *\n * Wire contract only — no I/O.\n */\nimport { pricedClipSeconds } from \"./priced-clip-seconds.js\"\n\n/** How the background is fitted to the foreground's frame. */\nexport const MASK_COMPOSITE_BACKGROUND_FITS = [\"cover\", \"contain\", \"stretch\"] as const\nexport type MaskCompositeBackgroundFit = (typeof MASK_COMPOSITE_BACKGROUND_FITS)[number]\n\n/** What fills the masked area: the foreground video, or the background itself pixelated or blurred. */\nexport const MASK_COMPOSITE_FILLS = [\"video\", \"pixelate\", \"blur\"] as const\nexport type MaskCompositeFill = (typeof MASK_COMPOSITE_FILLS)[number]\n\n/** Which sound the result carries. `mix` blends both tracks at equal level. */\nexport const MASK_COMPOSITE_AUDIO_SOURCES = [\"foreground\", \"background\", \"mix\", \"none\"] as const\nexport type MaskCompositeAudioSource = (typeof MASK_COMPOSITE_AUDIO_SOURCES)[number]\n\nexport const MASK_COMPOSITE_BOUNDS = {\n /** Edge softening, pixels of blur radius on the mask (0 = hard edge). */\n FEATHER_MIN: 0,\n FEATHER_MAX: 20,\n /** Grow (+) or shrink (−) the white region, pixels. */\n GROW_MIN: -10,\n GROW_MAX: 10,\n /** How strongly the foreground covers the background inside the mask\n * (1 = fully, today's output; 0 = not at all). */\n OPACITY_MIN: 0,\n OPACITY_MAX: 1,\n /** Pixelate: the block size as a % of the frame's WIDTH (relative, so a\n * setting looks the same at any resolution); the worker makes the blocks\n * max(2, round(width × pct / 100)) px. 1.25 % = 16 px on a 1280-wide frame. */\n PIXEL_SIZE_PCT_MIN: 0.2,\n PIXEL_SIZE_PCT_MAX: 10,\n /** Blur: the gaussian's sigma as a % of the frame's WIDTH (2 % ≈ sigma 25 px on a 1280-wide frame). */\n BLUR_STRENGTH_PCT_MIN: 0.1,\n BLUR_STRENGTH_PCT_MAX: 5,\n /** The longest leading video (the foreground; the background when `fill` is not video) a run accepts, seconds. */\n MAX_DURATION_SEC: 300,\n} as const\n\n/** Seconds of result one pricing unit covers. */\nexport const MASK_COMPOSITE_UNIT_SEC = 5\n\n/**\n * How much longer, in seconds, the leading video the render downloads may run\n * than the one measured before the run was charged, before the render refuses\n * it as changed: a re-measure can read a hair longer (a re-encode, a\n * container's rounding), and that is not a different file. Applied to the\n * seconds, never to the units, before the price's own 0.05 s grace\n * (`pricedClipSeconds`): a run billed for 10 s renders a lead of up to about\n * 10.55 s. The same slack as Video Overlay's base.\n */\nexport const MASK_COMPOSITE_REMEASURE_SLACK_SEC = 0.5\n\n/**\n * Pricing units for a result `durationSec` long: one per started 5 seconds,\n * at least one, after `pricedClipSeconds` (up to 0.05 s past a whole second is\n * ignored, so a 10.01 s result is 2 units, not 3). An unknown length counts the\n * longest result a run accepts (an upper bound — the pre-run quote for a clip\n * whose length is not known yet; every run measures its foreground).\n */\nexport function maskCompositeUnits(durationSec: number | null | undefined): number {\n const sec =\n typeof durationSec === \"number\" && Number.isFinite(durationSec) && durationSec > 0\n ? Math.min(durationSec, MASK_COMPOSITE_BOUNDS.MAX_DURATION_SEC)\n : MASK_COMPOSITE_BOUNDS.MAX_DURATION_SEC\n return Math.ceil(pricedClipSeconds(sec) / MASK_COMPOSITE_UNIT_SEC)\n}\n\nexport const MASK_COMPOSITE_DEFAULTS = {\n invertMask: false,\n feather: 2,\n grow: 0,\n opacity: 1,\n fill: \"video\" as MaskCompositeFill,\n pixelSizePct: 1.25,\n blurStrengthPct: 2,\n backgroundFit: \"cover\" as MaskCompositeBackgroundFit,\n audioSource: \"foreground\" as MaskCompositeAudioSource,\n} as const\n\nexport interface MaskCompositeSettings {\n readonly invertMask: boolean\n readonly feather: number\n readonly grow: number\n /** Inside the mask: opacity × foreground + (1 − opacity) × background. */\n readonly opacity: number\n /** What fills the masked area (`video` = the foreground). */\n readonly fill: MaskCompositeFill\n /** Pixelate block size, % of the frame width (used when `fill` is `pixelate`). */\n readonly pixelSizePct: number\n /** Blur strength: the gaussian's sigma as a % of the frame width (used when `fill` is `blur`). */\n readonly blurStrengthPct: number\n readonly backgroundFit: MaskCompositeBackgroundFit\n readonly audioSource: MaskCompositeAudioSource\n}\n\nconst clampInt = (v: unknown, min: number, max: number, fallback: number): number =>\n typeof v === \"number\" && Number.isFinite(v) ? Math.min(max, Math.max(min, Math.round(v))) : fallback\n\nconst clampNumber = (v: unknown, min: number, max: number, fallback: number): number =>\n typeof v === \"number\" && Number.isFinite(v) ? Math.min(max, Math.max(min, v)) : fallback\n\n/**\n * Node data (or any loose object) → settings every engine renders with.\n * Unknown enum values fall back to the default and numbers are clamped, so a\n * node written straight into workflow JSON renders the same as one set in the\n * panel. The ONE normaliser both workflow engines and the worker call.\n */\nexport function resolveMaskCompositeSettings(data: Readonly<Record<string, unknown>>): MaskCompositeSettings {\n const d = MASK_COMPOSITE_DEFAULTS\n const b = MASK_COMPOSITE_BOUNDS\n return {\n invertMask: typeof data.invertMask === \"boolean\" ? data.invertMask : d.invertMask,\n feather: clampInt(data.feather, b.FEATHER_MIN, b.FEATHER_MAX, d.feather),\n grow: clampInt(data.grow, b.GROW_MIN, b.GROW_MAX, d.grow),\n opacity: clampNumber(data.opacity, b.OPACITY_MIN, b.OPACITY_MAX, d.opacity),\n fill: maskCompositeFillOf(data),\n pixelSizePct: clampNumber(data.pixelSizePct, b.PIXEL_SIZE_PCT_MIN, b.PIXEL_SIZE_PCT_MAX, d.pixelSizePct),\n blurStrengthPct: clampNumber(data.blurStrengthPct, b.BLUR_STRENGTH_PCT_MIN, b.BLUR_STRENGTH_PCT_MAX, d.blurStrengthPct),\n backgroundFit: (MASK_COMPOSITE_BACKGROUND_FITS as readonly string[]).includes(data.backgroundFit as string)\n ? (data.backgroundFit as MaskCompositeBackgroundFit)\n : d.backgroundFit,\n audioSource: (MASK_COMPOSITE_AUDIO_SOURCES as readonly string[]).includes(data.audioSource as string)\n ? (data.audioSource as MaskCompositeAudioSource)\n : d.audioSource,\n }\n}\n\n/** The fill a node, payload or request body asks for: an unknown value is `video` (the default). */\nexport function maskCompositeFillOf(data: Readonly<Record<string, unknown>> | null | undefined): MaskCompositeFill {\n const f = data?.fill\n return (MASK_COMPOSITE_FILLS as readonly string[]).includes(f as string) ? (f as MaskCompositeFill) : MASK_COMPOSITE_DEFAULTS.fill\n}\n\n/** Does this fill take a foreground video? Only `video` does; pixelate and blur fill from the background. */\nexport function maskCompositeUsesForeground(fill: MaskCompositeFill): boolean {\n return fill === \"video\"\n}\n\n/**\n * The input whose size, rate and length the result has (and so the one a run\n * is measured and priced on): the canvas handle — `video` (the foreground) for\n * the video fill, `background-video` for pixelate and blur. The one rule the\n * route, the workflow run, the run estimates and the length walks read.\n */\nexport function maskCompositeLeadHandle(data: Readonly<Record<string, unknown>> | null | undefined): \"video\" | \"background-video\" {\n return maskCompositeUsesForeground(maskCompositeFillOf(data)) ? \"video\" : \"background-video\"\n}\n\n/**\n * The sound a render actually carries. With no foreground (pixelate / blur) it\n * is ALWAYS the background's — the only track there is — whatever\n * `audioSource` says (the canvas hides that control for these fills, so a\n * stored `none` from the Video fill can never silently mute the result).\n */\nexport function maskCompositeEffectiveAudioSource(s: Pick<MaskCompositeSettings, \"fill\" | \"audioSource\">): MaskCompositeAudioSource {\n if (maskCompositeUsesForeground(s.fill)) return s.audioSource\n return \"background\"\n}\n\n/** `POST /v1/mask-composite` request body. */\nexport interface MaskCompositeRequest extends Partial<MaskCompositeSettings> {\n /** The video whose white-masked region is kept (its size, rate and length lead).\n * Required when `fill` is `video` (the default); not used by `pixelate` / `blur`. */\n readonly foregroundUrl?: string\n /** The video shown where the mask is black. */\n readonly backgroundUrl: string\n /** The mask video — white = foreground (Video Mask's output). */\n readonly maskUrl: string\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cast-swap-limits.ts","../src/gemini-omni-voices.ts","../src/node-default-mappings.ts","../src/tts-neighbour-text.ts","../src/provider-directive-defaults.ts","../src/lora-routing.ts","../src/suno-track-sources.ts","../src/voice-changer-models.ts","../src/model-tree.ts","../src/topaz-video.ts","../src/audio-soundtrack.ts"],"names":["IMAGE_GEN_PROVIDERS","IMAGE_I2I_PROVIDERS","IMAGE_EDIT_PROVIDERS","UPSCALE_IMAGE_PROVIDERS","TEXT_TO_VIDEO_PROVIDERS","IMAGE_TO_VIDEO_PROVIDERS","VIDEO_GEN_PROVIDERS","LIP_SYNC_PROVIDERS","TTS_PROVIDERS","VO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BAAkB,CAAA,IAC5C,IAAA,CAAK,eAAA,KAAoB,KAAA,IACzB,KAAK,aAAA,GAAgB,CAAA;AAEzB;AAWO,SAAS,sBAAA,CAAuB,UAAkB,SAAA,EAA2B;AAClF,EAAA,MAAM,MAAM,CAAC,MAAA,CAAO,QAAA,CAAS,QAAQ,KAAK,QAAA,IAAY,CAAA,GAAI,SAAA,GAAY,IAAA,CAAK,IAAI,SAAA,EAAW,IAAA,CAAK,GAAA,CAAI,wBAAA,EAA0B,QAAQ,CAAC,CAAA;AACtI,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,GAAA,GAAM,oBAAoB,CAAA,GAAI,oBAAA;AAClD;AAUO,SAAS,qBAAA,CAAsB,MAAA,EAAgB,WAAA,EAAqB,QAAA,GAAW,OAAO,iBAAA,EAA2B;AACtH,EAAA,MAAM,KAAA,GAAQ,UAAU,WAAW,CAAA,CAAA;AACnC,EAAA,MAAM,UAAU,MAAA,CAAO,OAAA,CAAQ,0BAAA,EAA4B,CAAC,OAAO,MAAA,KAAmB;AACpF,IAAA,MAAM,CAAA,GAAI,OAAO,MAAM,CAAA;AACvB,IAAA,IAAI,CAAA,KAAM,GAAG,OAAO,KAAA;AACpB,IAAA,OAAO,CAAA,GAAI,CAAA,GAAI,CAAA,OAAA,EAAU,CAAA,GAAI,CAAC,CAAA,CAAA,GAAK,KAAA;AAAA,EACrC,CAAC,CAAA;AACD,EAAA,MAAM,IAAA,GACJ,GAAG,KAAK,CAAA,sKAAA,CAAA;AAEV,EAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,IAAA,EAAK,GAAI,GAAG,IAAI;AAAA,EAAK,OAAO,CAAA,CAAA,GAAK,IAAA;AAC1D,EAAA,OAAO,QAAA,CAAS,MAAA,IAAU,QAAA,GAAW,QAAA,GAAW,OAAA;AAClD","file":"chunk-AFYTX4AI.cjs","sourcesContent":["/**\n * Cast Swap's input limits, and what a trend built on it may put in its\n * prompts. One definition read by the server (which enforces them) and by\n * every screen that edits them (which holds Save before a refusal), so the two\n * cannot drift apart.\n */\n\n/** The longest `postPrompt` Cast Swap takes. */\nexport const CAST_SWAP_POST_PROMPT_MAX = 4000\n\n/**\n * A trend's prompt limits.\n *\n * - `trendPromptMax` / `prePromptMax`: the longest prompt a trend version may\n * store.\n * - `detailsMax`: the longest details a user may add to a run. They follow the\n * trend prompt in Cast Swap's `postPrompt`, after a blank line, so a new\n * trend prompt is held to `CAST_SWAP_POST_PROMPT_MAX − 2 − detailsMax`.\n * - `engineTextReserve`: the room kept for the text Cast Swap writes around a\n * trend's prompts in the prompt it builds, at its longest (a block for each\n * of the 13 roles a run allows with 200-character role names, five\n * 500-character reference lines, the keep, mask and edit lines and the\n * header: about 16,100 characters, rounded up so a small wording change does\n * not need this moved). The pre prompt, the trend prompt and the details\n * share what is left of Seedance 2.5's prompt cap.\n */\nexport const TREND_PROMPT_LIMITS = {\n trendPromptMax: 3000,\n prePromptMax: 3000,\n detailsMax: 1000,\n engineTextReserve: 17_000,\n} as const\n\n/** Cast Swap's `faceMasking` bounds, each `[min, max]` inclusive. */\nexport const CAST_SWAP_FACE_MASKING_BOUNDS = {\n /** `minFaceHeightPct` and `maxFaceHeightPct`, % of the frame's height (max 0 = no limit). */\n faceHeightPct: [0, 100],\n /** Each `zone` margin, % of the frame. */\n zonePct: [0, 49],\n /** % of the frame's width. */\n blurStrengthPct: [0.1, 5],\n threshold: [0.05, 0.95],\n} as const satisfies Record<string, readonly [number, number]>\n\n/**\n * What a Cast Swap face mask covers (`faceMasking.target`):\n *\n * - `\"head\"` (the default): the whole head, hair included, and people seen\n * from behind or turned away, with a bigger mask.\n * - `\"face\"`: the face only; the hair, and a person turned away, stay visible.\n * - `\"body\"`: the whole person. A face mask that takes it hides everyone in\n * the clip, body and head (the biggest mask); a trend clip that keeps its\n * people as they are (the rest of the frame prepared) keeps them whole. A\n * clip made into depth as a whole takes no target.\n */\nexport const CAST_SWAP_FACE_MASK_TARGETS = [\"face\", \"head\", \"body\"] as const\n\nexport type CastSwapFaceMaskTarget = (typeof CAST_SWAP_FACE_MASK_TARGETS)[number]\n\n/**\n * How a direct Nodaro Motion run follows its clip (`style`, a public run\n * field): `\"precise\"` (the default) follows the clip exactly; `\"motion\"`\n * follows only the clip's movement and takes every look from the photos. A\n * trend run ignores it (its trend decides).\n */\nexport const CAST_SWAP_STYLES = [\"precise\", \"motion\"] as const\n\nexport type CastSwapStyle = (typeof CAST_SWAP_STYLES)[number]\n\n/** What Cast Swap uses for a `faceMasking` setting left out. */\nexport const CAST_SWAP_FACE_MASKING_DEFAULTS = {\n /** What a mask covers: the whole head (`CAST_SWAP_FACE_MASK_TARGETS`). */\n target: \"head\",\n /** What covers a masked face: a blur (`\"depth\"`, a depth-color view of it, is the other fill). */\n fill: \"blur\",\n minFaceHeightPct: 15,\n maxFaceHeightPct: 0,\n /**\n * The frame margins when `zone` is left out: a face centred in the outer 10 %\n * at the left or right is not masked (people walking in at the edge). An\n * explicit `zone: null`, or all four margins 0, means no margins.\n */\n zone: { leftPct: 10, rightPct: 10, topPct: 0, bottomPct: 0 },\n /** A margin left out of a `zone` that is given. */\n zonePct: 0,\n blurStrengthPct: 2,\n threshold: 0.5,\n} as const\n\n/**\n * The video engines Cast Swap runs on. A run or estimate that leaves `engine`\n * out runs on `CAST_SWAP_ENGINE_WHEN_OMITTED`, so callers that predate the\n * choice keep what they had.\n */\nexport const CAST_SWAP_ENGINES = [\"seedance-2-5\", \"kling-4\"] as const\n\nexport type CastSwapEngine = (typeof CAST_SWAP_ENGINES)[number]\n\n/** The engine of a run, estimate or trend that names none. */\nexport const CAST_SWAP_ENGINE_WHEN_OMITTED: CastSwapEngine = \"seedance-2-5\"\n\n/**\n * Nodaro Motion — what people see of Cast Swap. Its two engines' PUBLIC ids,\n * the only ones documented and returned (a trend's `engine`, a run record, a\n * quote): `\"motion-prism\"` (Nodaro Motion Prism) and `\"motion-pulse\"` (Nodaro\n * Motion Pulse).\n *\n * `CAST_SWAP_ENGINES` stays the INTERNAL vocabulary: what a stored trend\n * version names, and what the platform sends the Cast Swap engine (which takes\n * it in every version). A public id is mapped to it at every boundary that\n * reads one (`castSwapEngineFrom`), and back at every boundary a person reads\n * (`nodaroMotionEngineOf`). The engines' earlier public ids\n * (`NODARO_MOTION_LEGACY_ENGINES`) are read the same way and never returned.\n */\nexport const NODARO_MOTION_ENGINES = [\"motion-prism\", \"motion-pulse\"] as const\n\nexport type NodaroMotionEngine = (typeof NODARO_MOTION_ENGINES)[number]\n\n/**\n * The public ids the engines had before (renamed 2026-10-26), each with the\n * id it became. Still read wherever an engine is read — a request, a stored\n * run, an engine's declared engines, an admin setting's keys — and never\n * returned or documented.\n */\nexport const NODARO_MOTION_LEGACY_ENGINES = {\n \"motion-pro\": \"motion-prism\",\n \"motion-lite\": \"motion-pulse\",\n} as const satisfies Record<string, NodaroMotionEngine>\n\nexport type NodaroMotionLegacyEngine = keyof typeof NODARO_MOTION_LEGACY_ENGINES\n\n/** Each public id's earlier id (the inverse of `NODARO_MOTION_LEGACY_ENGINES`). */\nexport const NODARO_MOTION_LEGACY_ENGINE_OF = {\n \"motion-prism\": \"motion-pro\",\n \"motion-pulse\": \"motion-lite\",\n} as const satisfies Record<NodaroMotionEngine, NodaroMotionLegacyEngine>\n\n/**\n * Each public engine's name, as people read it. The earlier ids are keys too,\n * each answering the name of the engine it became, so code written against\n * them keeps reading a name (never undefined); iterate `NODARO_MOTION_ENGINES`,\n * not these keys.\n */\nexport const NODARO_MOTION_ENGINE_NAMES = {\n \"motion-prism\": \"Nodaro Motion Prism\",\n \"motion-pulse\": \"Nodaro Motion Pulse\",\n \"motion-pro\": \"Nodaro Motion Prism\",\n \"motion-lite\": \"Nodaro Motion Pulse\",\n} as const satisfies Record<NodaroMotionEngine | NodaroMotionLegacyEngine, string>\n\n/**\n * The internal engine each public id runs on (and the inverse, below). The\n * earlier ids are keys too, as in `NODARO_MOTION_ENGINE_NAMES`.\n */\nexport const CAST_SWAP_ENGINE_OF_NODARO_MOTION = {\n \"motion-prism\": \"seedance-2-5\",\n \"motion-pulse\": \"kling-4\",\n \"motion-pro\": \"seedance-2-5\",\n \"motion-lite\": \"kling-4\",\n} as const satisfies Record<NodaroMotionEngine | NodaroMotionLegacyEngine, CastSwapEngine>\n\n/** The public id of each internal engine. */\nexport const NODARO_MOTION_ENGINE_OF_CAST_SWAP = {\n \"seedance-2-5\": \"motion-prism\",\n \"kling-4\": \"motion-pulse\",\n} as const satisfies Record<CastSwapEngine, NodaroMotionEngine>\n\n/** The public id of an internal engine. */\nexport function nodaroMotionEngineOf(engine: CastSwapEngine): NodaroMotionEngine {\n return NODARO_MOTION_ENGINE_OF_CAST_SWAP[engine]\n}\n\n/** The name people read for an internal engine (\"Nodaro Motion Prism\" / \"Nodaro Motion Pulse\"). */\nexport function nodaroMotionEngineName(engine: CastSwapEngine): string {\n return NODARO_MOTION_ENGINE_NAMES[nodaroMotionEngineOf(engine)]\n}\n\n/**\n * The internal engine a value names, in any vocabulary: a public id\n * (`\"motion-prism\"`, `\"motion-pulse\"`), an earlier public id (`\"motion-pro\"`,\n * `\"motion-lite\"`) or an internal one (`\"seedance-2-5\"`, `\"kling-4\"`), the\n * last two still accepted from older clients, older engines and stored data.\n * Undefined for anything else.\n */\nexport function castSwapEngineFrom(value: unknown): CastSwapEngine | undefined {\n if (typeof value !== \"string\") return undefined\n // Its keys are the current and the earlier public ids.\n if (Object.hasOwn(CAST_SWAP_ENGINE_OF_NODARO_MOTION, value)) {\n return CAST_SWAP_ENGINE_OF_NODARO_MOTION[value as NodaroMotionEngine | NodaroMotionLegacyEngine]\n }\n return (CAST_SWAP_ENGINES as readonly string[]).includes(value) ? (value as CastSwapEngine) : undefined\n}\n\n/** The public id a value names, in any vocabulary (`castSwapEngineFrom`); undefined for anything else. */\nexport function nodaroMotionEngineFrom(value: unknown): NodaroMotionEngine | undefined {\n const engine = castSwapEngineFrom(value)\n return engine ? nodaroMotionEngineOf(engine) : undefined\n}\n\n/**\n * Every engine id a request may name: the public ids, then the earlier public\n * ids and the internal ones (still accepted, never documented).\n */\nexport const CAST_SWAP_ENGINE_IDS_ACCEPTED = [\n ...NODARO_MOTION_ENGINES,\n \"motion-pro\",\n \"motion-lite\",\n ...CAST_SWAP_ENGINES,\n] as const satisfies readonly (NodaroMotionEngine | NodaroMotionLegacyEngine | CastSwapEngine)[]\n\n/**\n * The resolutions each engine renders, the default first. Seedance 2.5's 480p\n * is plain unless a run asks for a draft (`draft` is 480p only); Kling 4 has\n * no draft and no 480p.\n */\nexport const CAST_SWAP_RESOLUTIONS_BY_ENGINE = {\n \"seedance-2-5\": [\"480p\", \"720p\", \"1080p\"],\n \"kling-4\": [\"720p\", \"1080p\"],\n} as const satisfies Record<CastSwapEngine, readonly (\"480p\" | \"720p\" | \"1080p\")[]>\n\n/** Whether an engine renders drafts (Seedance 2.5's 480p draft; Kling 4 has none). */\nexport function castSwapEngineHasDraft(engine: CastSwapEngine): boolean {\n return engine === \"seedance-2-5\"\n}\n\n/**\n * Where a Kling 4 run cuts the clip to whole seconds (Kling renders whole\n * seconds, and asked for more than the clip it stretches the motion; Seedance\n * 2.5 ignores it): `\"cut-end\"` (the default) drops the fraction of a second at\n * the clip's end, `\"cut-start\"` at its start.\n */\nexport const CAST_SWAP_KLING_LENGTHS = [\"cut-end\", \"cut-start\"] as const\n\nexport type CastSwapKlingLength = (typeof CAST_SWAP_KLING_LENGTHS)[number]\n\n/** The `klingLength` of a run or trend that names none. */\nexport const CAST_SWAP_KLING_LENGTH_WHEN_OMITTED: CastSwapKlingLength = \"cut-end\"\n\n/**\n * The most images one Kling 4 Cast Swap run sends, across every role and fixed\n * reference (a role with prepared references counts its one prepared\n * picture). Over it the route answers `too_many_images`.\n */\nexport const CAST_SWAP_KLING_MAX_IMAGES = 10\n","/**\n * The 30 preset voices Gemini Omni's audio-persona endpoint accepts, with the\n * style labels its documentation gives each one. DATA, so the API docs, the MCP\n * tool text and any client picker list them from one place instead of copying a\n * table that drifts.\n *\n * A preset is the BASE voice; a persona is that voice plus a free-text\n * description (timbre, pace, emotion) and an example line. Pinning a persona to a\n * character is what keeps one voice across separate clips.\n */\nexport interface GeminiOmniVoicePreset {\n id: string\n gender: \"female\" | \"male\" | \"genderless\"\n /** The documented character of the voice (\"soft\", \"raspy\", \"intellectual\"…). */\n style: string\n /** The documented pitch band (\"low\", \"mid-low\", \"mid\", \"mid-high\", \"high\"; \"younger\" for fenrir). */\n pitch: string\n}\n\nexport const GEMINI_OMNI_VOICE_PRESETS = [\n { id: \"achernar\", gender: \"female\", style: \"soft\", pitch: \"high\" },\n { id: \"achird\", gender: \"male\", style: \"friendly\", pitch: \"mid\" },\n { id: \"algenib\", gender: \"male\", style: \"raspy\", pitch: \"low\" },\n { id: \"algieba\", gender: \"male\", style: \"easygoing\", pitch: \"mid-low\" },\n { id: \"alnilam\", gender: \"male\", style: \"steady\", pitch: \"mid-low\" },\n { id: \"aoede\", gender: \"female\", style: \"brisk\", pitch: \"mid\" },\n { id: \"autonoe\", gender: \"female\", style: \"bright\", pitch: \"mid\" },\n { id: \"callirrhoe\", gender: \"female\", style: \"easygoing\", pitch: \"mid\" },\n { id: \"charon\", gender: \"male\", style: \"intellectual\", pitch: \"low\" },\n { id: \"despina\", gender: \"female\", style: \"smooth\", pitch: \"mid\" },\n { id: \"enceladus\", gender: \"male\", style: \"breathy\", pitch: \"low\" },\n { id: \"erinome\", gender: \"female\", style: \"clear\", pitch: \"mid\" },\n { id: \"fenrir\", gender: \"male\", style: \"lively\", pitch: \"younger\" },\n { id: \"gacrux\", gender: \"female\", style: \"mature\", pitch: \"mid\" },\n { id: \"iapetus\", gender: \"male\", style: \"clear\", pitch: \"mid-low\" },\n { id: \"kore\", gender: \"female\", style: \"capable\", pitch: \"mid\" },\n { id: \"laomedeia\", gender: \"female\", style: \"cheerful\", pitch: \"mid-high\" },\n { id: \"leda\", gender: \"female\", style: \"young\", pitch: \"mid-high\" },\n { id: \"orus\", gender: \"male\", style: \"steady\", pitch: \"mid-low\" },\n { id: \"puck\", gender: \"male\", style: \"cheerful\", pitch: \"mid\" },\n { id: \"pulcherrima\", gender: \"genderless\", style: \"forward\", pitch: \"mid-high\" },\n { id: \"rasalgethi\", gender: \"male\", style: \"intellectual\", pitch: \"mid\" },\n { id: \"sadachbia\", gender: \"male\", style: \"vivid\", pitch: \"low\" },\n { id: \"sadaltager\", gender: \"male\", style: \"knowledgeable\", pitch: \"mid\" },\n { id: \"schedar\", gender: \"male\", style: \"smooth\", pitch: \"mid-low\" },\n { id: \"sulafat\", gender: \"female\", style: \"warm\", pitch: \"mid\" },\n { id: \"umbriel\", gender: \"male\", style: \"smooth\", pitch: \"low\" },\n { id: \"vindemiatrix\", gender: \"female\", style: \"gentle\", pitch: \"mid\" },\n { id: \"zephyr\", gender: \"female\", style: \"bright\", pitch: \"mid-high\" },\n { id: \"zubenelgenubi\", gender: \"male\", style: \"casual\", pitch: \"mid-low\" },\n] as const satisfies readonly GeminiOmniVoicePreset[]\n\nexport type GeminiOmniVoicePresetId = (typeof GEMINI_OMNI_VOICE_PRESETS)[number][\"id\"]\n\n/** The preset ids as a non-empty tuple — what `z.enum(...)` takes. */\nexport const GEMINI_OMNI_VOICE_PRESET_IDS = GEMINI_OMNI_VOICE_PRESETS.map((v) => v.id) as unknown as readonly [\n GeminiOmniVoicePresetId,\n ...GeminiOmniVoicePresetId[],\n]\n","import {\n IMAGE_GEN_PROVIDERS,\n IMAGE_I2I_PROVIDERS,\n IMAGE_EDIT_PROVIDERS,\n UPSCALE_IMAGE_PROVIDERS,\n TEXT_TO_VIDEO_PROVIDERS,\n IMAGE_TO_VIDEO_PROVIDERS,\n VIDEO_GEN_PROVIDERS,\n LIP_SYNC_PROVIDERS,\n TTS_PROVIDERS,\n VOICE_DESIGN_MODELS,\n} from \"./model-constants.js\"\nimport { LLM_MODEL_IDS } from \"./llm-models.js\"\nimport { SEEDREAM_5_5_DEFAULT_RESOLUTION } from \"./seedream-5-5.js\"\n\n// ──────────────────────────────────────────────────────────────────────────\n// Types\n// ──────────────────────────────────────────────────────────────────────────\n\nexport type QualityLevel = \"low\" | \"mid\" | \"high\"\nexport type SemanticAspectRatio = \"auto\" | \"1:1\" | \"4:3\" | \"3:4\" | \"16:9\" | \"9:16\"\n\nexport const NODE_DEFAULT_TYPES = [\n // Image\n \"generate-image\",\n \"image-to-image\",\n \"edit-image\",\n \"upscale-image\",\n // Video\n \"text-to-video\",\n \"image-to-video\",\n \"generate-video\",\n // Composition\n \"lip-sync\",\n // Audio / Music\n \"text-to-speech\",\n \"generate-music\",\n \"voice-design\",\n // LLM-driven\n \"ai-writer\",\n \"llm-chat\",\n \"lottie-overlay\",\n \"3d-title\",\n \"motion-graphics\",\n \"image-to-text\",\n \"qa-check\",\n] as const\n\nexport type NodeDefaultType = (typeof NODE_DEFAULT_TYPES)[number]\n\nexport const QUALITY_LEVELS: readonly QualityLevel[] = [\"low\", \"mid\", \"high\"] as const\nexport const SEMANTIC_ASPECT_RATIOS: readonly SemanticAspectRatio[] = [\n \"auto\",\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n] as const\n\n// ──────────────────────────────────────────────────────────────────────────\n// Per-node-type registry\n// ──────────────────────────────────────────────────────────────────────────\n\n/**\n * Per-node-type metadata: which field on the node carries the admin-set value,\n * the valid value set, and which optional dimensions apply.\n *\n * `field` distinguishes nodes that use `data.provider` (image/video/audio)\n * from nodes that use `data.model` (LLM nodes, voice-design).\n */\ninterface NodeTypeMeta {\n field: \"provider\" | \"model\"\n validValues: readonly string[]\n hasQuality: boolean\n hasAspectRatio: boolean\n}\n\n// Music providers per the runtime: enum currently only lists \"minimax\", but\n// `generate-music.defaultData.provider` is \"suno\" with a separate `modelVersion`.\n// Until that mismatch is fixed, accept both values for admin defaults.\nconst MUSIC_PROVIDERS_FOR_VALIDATION = [\"suno\", \"minimax\"] as const\n\nconst META: Record<NodeDefaultType, NodeTypeMeta> = {\n \"generate-image\": { field: \"provider\", validValues: IMAGE_GEN_PROVIDERS, hasQuality: true, hasAspectRatio: true },\n \"image-to-image\": { field: \"provider\", validValues: IMAGE_I2I_PROVIDERS, hasQuality: true, hasAspectRatio: true },\n \"edit-image\": { field: \"provider\", validValues: IMAGE_EDIT_PROVIDERS, hasQuality: false, hasAspectRatio: false },\n \"upscale-image\": { field: \"provider\", validValues: UPSCALE_IMAGE_PROVIDERS, hasQuality: false, hasAspectRatio: false },\n \"text-to-video\": { field: \"provider\", validValues: TEXT_TO_VIDEO_PROVIDERS, hasQuality: true, hasAspectRatio: true },\n \"image-to-video\": { field: \"provider\", validValues: IMAGE_TO_VIDEO_PROVIDERS, hasQuality: true, hasAspectRatio: true },\n \"generate-video\": { field: \"provider\", validValues: VIDEO_GEN_PROVIDERS, hasQuality: true, hasAspectRatio: true },\n \"lip-sync\": { field: \"provider\", validValues: LIP_SYNC_PROVIDERS, hasQuality: false, hasAspectRatio: false },\n \"text-to-speech\": { field: \"provider\", validValues: TTS_PROVIDERS, hasQuality: false, hasAspectRatio: false },\n \"generate-music\": { field: \"provider\", validValues: MUSIC_PROVIDERS_FOR_VALIDATION, hasQuality: false, hasAspectRatio: false },\n \"voice-design\": { field: \"model\", validValues: VOICE_DESIGN_MODELS, hasQuality: false, hasAspectRatio: false },\n \"ai-writer\": { field: \"model\", validValues: LLM_MODEL_IDS, hasQuality: false, hasAspectRatio: false },\n \"llm-chat\": { field: \"model\", validValues: LLM_MODEL_IDS, hasQuality: false, hasAspectRatio: false },\n \"lottie-overlay\": { field: \"model\", validValues: LLM_MODEL_IDS, hasQuality: false, hasAspectRatio: false },\n \"3d-title\": { field: \"model\", validValues: LLM_MODEL_IDS, hasQuality: false, hasAspectRatio: false },\n \"motion-graphics\": { field: \"model\", validValues: LLM_MODEL_IDS, hasQuality: false, hasAspectRatio: false },\n \"image-to-text\": { field: \"model\", validValues: LLM_MODEL_IDS, hasQuality: false, hasAspectRatio: false },\n \"qa-check\": { field: \"model\", validValues: LLM_MODEL_IDS, hasQuality: false, hasAspectRatio: false },\n}\n\nexport function getTargetField(nodeType: NodeDefaultType): \"provider\" | \"model\" {\n return META[nodeType].field\n}\n\nexport function getValidValues(nodeType: NodeDefaultType): readonly string[] {\n return META[nodeType].validValues\n}\n\nexport function supportedDefaultDimensions(nodeType: NodeDefaultType): {\n quality: boolean\n aspectRatio: boolean\n} {\n const m = META[nodeType]\n return { quality: m.hasQuality, aspectRatio: m.hasAspectRatio }\n}\n\nexport function validateProviderForNodeType(\n nodeType: NodeDefaultType,\n value: string,\n): string | null {\n const valid = META[nodeType].validValues\n if (!valid.includes(value)) {\n return `value \"${value}\" is not valid for node type \"${nodeType}\"`\n }\n return null\n}\n\n// ──────────────────────────────────────────────────────────────────────────\n// Semantic mappings — quality + aspect ratio per provider\n// ──────────────────────────────────────────────────────────────────────────\n\n/**\n * Each provider stores its quality lever on a different field of node data:\n * - `resolution` (1K/2K/4K, 720p/1080p, …) — most image + video providers\n * - `quality` (medium/high, basic/high) — gpt-image, seedream\n *\n * Mapping a semantic level (low/mid/high) to a concrete value is meaningless\n * without knowing WHICH field it belongs to, because writing \"medium\" into\n * `resolution` (or \"2K\" into `quality`) trips the route's Zod enum at\n * generate-time. Each entry pairs the field with the per-level values built\n * from frontend/src/components/editor/config-panels/model-options.ts.\n *\n * Providers absent from this table return `undefined` from `mapQuality`,\n * letting the caller fall back to the factory default value.\n *\n * When a provider has fewer than 3 levels, semantic levels collapse onto\n * the closest concrete value (e.g. gpt-image only has medium/high → low maps\n * to medium).\n */\nexport type QualityField = \"resolution\" | \"quality\"\n\ninterface QualityMapping {\n field: QualityField\n values: Partial<Record<QualityLevel, string>>\n}\n\nconst QUALITY_MAP: Record<string, QualityMapping> = {\n // Image gen — resolution-style (1K/2K/4K)\n \"nano-banana-pro\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n \"nano-banana-2\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n \"nano-banana-2-1\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n \"flux\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"2K\" } },\n \"flux-flex\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"2K\" } },\n \"flux-i2i\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"2K\" } },\n \"flux-pro-i2i\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"2K\" } },\n \"gpt-image-2\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n \"gpt-image-2-i2i\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n \"gpt-image-2-5-flare\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n \"gpt-image-2-5-flare-i2i\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n \"gpt-image-2-5-sunburst\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n \"gpt-image-2-5-sunburst-i2i\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n \"gpt-image-2-6-flare\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n \"gpt-image-2-6-flare-i2i\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n \"gpt-image-2-6-sunburst\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n \"gpt-image-2-6-sunburst-i2i\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n // Image gen — quality-style (medium/high or basic/high)\n \"gpt-image\": { field: \"quality\", values: { low: \"medium\", mid: \"medium\", high: \"high\" } },\n \"gpt-image-i2i\": { field: \"quality\", values: { low: \"medium\", mid: \"medium\", high: \"high\" } },\n \"seedream\": { field: \"quality\", values: { low: \"basic\", mid: \"basic\", high: \"high\" } },\n \"seedream-edit\": { field: \"quality\", values: { low: \"basic\", mid: \"basic\", high: \"high\" } },\n \"seedream-5-lite\": { field: \"quality\", values: { low: \"basic\", mid: \"basic\", high: \"high\" } },\n \"seedream-5-lite-i2i\": { field: \"quality\", values: { low: \"basic\", mid: \"basic\", high: \"high\" } },\n \"seedream-5-pro\": { field: \"quality\", values: { low: \"basic\", mid: \"basic\", high: \"high\" } },\n \"seedream-5-pro-i2i\": { field: \"quality\", values: { low: \"basic\", mid: \"basic\", high: \"high\" } },\n // Seedream 5 Flash's lever is size (sent as KIE `size`), flat-priced — resolution-style.\n \"seedream-5-flash\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"2K\" } },\n \"seedream-5-flash-i2i\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"2K\" } },\n // MiniMax H3 Image: 1K and 2K cost the same, 2K is its default.\n \"minimax-h3-image\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n \"minimax-h3-image-i2i\": { field: \"resolution\", values: { low: \"1K\", mid: \"2K\", high: \"4K\" } },\n // Seedream 5.5's lever is its size too (KIE `size`): mid is its default, 2K;\n // low the cheapest, 1K (1.5K costs the same, and is the panel's to pick).\n \"seedream-5-5\": { field: \"resolution\", values: { low: \"1K\", mid: SEEDREAM_5_5_DEFAULT_RESOLUTION, high: \"2K\" } },\n \"seedream-5-5-i2i\": { field: \"resolution\", values: { low: \"1K\", mid: SEEDREAM_5_5_DEFAULT_RESOLUTION, high: \"2K\" } },\n // Video gen — resolution-style (720p/1080p)\n \"veo3\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"1080p\" } },\n \"veo3.1\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"1080p\" } },\n \"kling\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"1080p\" } },\n \"kling-3.0\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"1080p\" } },\n \"seedance-2\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"1080p\" } },\n \"seedance-2-fast\": { field: \"resolution\", values: { low: \"480p\", mid: \"720p\", high: \"720p\" } },\n \"seedance-2-mini\": { field: \"resolution\", values: { low: \"480p\", mid: \"720p\", high: \"720p\" } },\n // Seedance 2.5 spans 480p/720p/1080p on KIE (1080p accepted since the\n // 2026-08-17 re-probe; 4k still rejected), so each quality rung gets its own tier.\n \"seedance-2-5\": { field: \"resolution\", values: { low: \"480p\", mid: \"720p\", high: \"1080p\" } },\n // Wan 3.0 family — 480p / 720p / 1080p (lowercase catalog spellings; the\n // uppercase KIE wire form is produced only by normalizeWan3Resolution).\n \"wan-3\": { field: \"resolution\", values: { low: \"480p\", mid: \"720p\", high: \"1080p\" } },\n \"wan-3-prime\": { field: \"resolution\", values: { low: \"480p\", mid: \"720p\", high: \"1080p\" } },\n // Vidu Q4 — five tiers; the quality rungs stop at 1080p so \"high\" never\n // lands on the 2k/4k ladder (4k is closed to the free tier).\n \"vidu-q4\": { field: \"resolution\", values: { low: \"540p\", mid: \"720p\", high: \"1080p\" } },\n // Kling 4.0 — two tiers on both endpoints.\n \"kling-4\": { field: \"resolution\", values: { low: \"720p\", mid: \"720p\", high: \"1080p\" } },\n \"kling-4-keyframes\": { field: \"resolution\", values: { low: \"720p\", mid: \"720p\", high: \"1080p\" } },\n // Kling 4.0 Flash — 720p only, so every level lands on it.\n \"kling-4-flash\": { field: \"resolution\", values: { low: \"720p\", mid: \"720p\", high: \"720p\" } },\n \"wan-2.7-i2v\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"1080p\" } },\n \"wan-2.7-t2v\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"1080p\" } },\n \"happyhorse\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"1080p\" } },\n \"happyhorse-i2v\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"1080p\" } },\n \"happyhorse-ref2v\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"1080p\" } },\n \"happyhorse-edit\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"1080p\" } },\n \"kling-3-omni\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"1080p\" } },\n \"wan-videoedit\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"1080p\" } },\n // Lightricks LTX 2.3 — 1080p / 2k / 4k (lowercase, matching VIDEO_RESOLUTION_OPTIONS).\n // `field: \"resolution\"` is mandatory — see Provider Enum Sync pitfall 4.\n \"ltx-2.3-pro\": { field: \"resolution\", values: { low: \"1080p\", mid: \"2k\", high: \"4k\" } },\n \"ltx-2.3-fast\": { field: \"resolution\", values: { low: \"1080p\", mid: \"2k\", high: \"4k\" } },\n \"gemini-omni-video\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"4k\" } },\n \"gemini-omni-flash\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"4k\" } },\n \"gemini-omni-flash-1-2\": { field: \"resolution\", values: { low: \"720p\", mid: \"1080p\", high: \"4k\" } },\n // Grok Imagine Video 1.5 — 480p / 720p / 1080p, each quality rung its own tier.\n \"grok-imagine-video-1.5\": { field: \"resolution\", values: { low: \"480p\", mid: \"720p\", high: \"1080p\" } },\n // Replicate Flux 2 family — MP-based resolution (matching IMAGE_RESOLUTION_OPTIONS[\"flux-2-*\"]).\n // `field: \"resolution\"` is mandatory — see Provider Enum Sync pitfall 4.\n // mid = provider default: 1 MP for Klein, 2 MP for Pro/Max.\n \"flux-2-klein\": { field: \"resolution\", values: { low: \"0.5 MP\", mid: \"1 MP\", high: \"2 MP\" } },\n \"flux-2-pro\": { field: \"resolution\", values: { low: \"1 MP\", mid: \"2 MP\", high: \"4 MP\" } },\n \"flux-2-max\": { field: \"resolution\", values: { low: \"1 MP\", mid: \"2 MP\", high: \"4 MP\" } },\n}\n\nconst ASPECT_PASSTHROUGH_PROVIDERS = new Set([\n ...IMAGE_GEN_PROVIDERS,\n ...IMAGE_I2I_PROVIDERS,\n ...TEXT_TO_VIDEO_PROVIDERS,\n ...IMAGE_TO_VIDEO_PROVIDERS,\n])\n\nexport interface MappedQuality {\n field: QualityField\n value: string\n}\n\nexport function mapQuality(provider: string, level: QualityLevel): MappedQuality | undefined {\n const m = QUALITY_MAP[provider]\n const value = m?.values[level]\n return value === undefined ? undefined : { field: m!.field, value }\n}\n\nexport function mapAspectRatio(\n provider: string,\n ratio: SemanticAspectRatio,\n): string | undefined {\n if (ratio === \"auto\") return undefined\n if (!ASPECT_PASSTHROUGH_PROVIDERS.has(provider as never)) return ratio\n return ratio\n}\n\n// ──────────────────────────────────────────────────────────────────────────\n// Linked field derivation\n// ──────────────────────────────────────────────────────────────────────────\n\n/**\n * When admin sets `provider` for a node that has linked fields (e.g.\n * generate-image stores both `provider` AND `model`), derive the linked\n * fields so the resolver writes a coherent snapshot.\n *\n * For unmapped providers, returns `{}` — the runtime config panel applies\n * its own defaulting when needed.\n */\nconst GENERATE_IMAGE_PROVIDER_TO_MODEL: Record<string, string> = {\n \"nano-banana\": \"gemini-2.5-flash-image\",\n \"nano-banana-pro\": \"gemini-2.5-flash-image\",\n \"nano-banana-2\": \"gemini-2.5-flash-image\",\n \"nano-banana-2-lite\": \"gemini-3.1-flash-lite-image\",\n}\n\nexport function deriveLinkedFields(\n nodeType: NodeDefaultType,\n value: string,\n): Record<string, unknown> {\n if (nodeType === \"generate-image\") {\n const model = GENERATE_IMAGE_PROVIDER_TO_MODEL[value]\n return model ? { model } : {}\n }\n return {}\n}\n","/**\n * The neighbour-text rule of Text to Speech — what is spoken just BEFORE and just AFTER a clip in the finished\n * piece — in ONE place, so the editor's run, the provider exits and the REST route cannot drift: a request that\n * the editor sends must be one the route accepts.\n *\n * A string is trimmed; an empty one, or anything that is not a string, is ABSENT. Over the cap the value is\n * TRIMMED, never rejected, by every sender and exit: previous text keeps its LAST characters (what leads into\n * the clip), next text its FIRST (what the clip leads into). The REST route is the one place that rejects an\n * over-cap value — measured on the trimmed text, for a model that stitches only. Whether a model takes the\n * fields at all is its sheet (`ttsSupportsStitching`), never decided here.\n */\n\n/**\n * The most characters of context sent on each side. ElevenLabs documents no limit for the text-to-speech\n * endpoint's fields; this bounds what we send (and what the vendor may count) to about two sentences' worth of\n * run-in and run-out — enough to carry intonation across a cut.\n */\nexport const TTS_NEIGHBOUR_TEXT_MAX_CHARS = 1000\n\n/** The normalised pair: only non-empty strings within the cap; a side that was unusable is not a key. */\nexport interface TtsNeighbourText {\n previousText?: string\n nextText?: string\n}\n\nfunction usableText(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined\n const trimmed = value.trim()\n return trimmed ? trimmed : undefined\n}\n\n/** `previousText` / `nextText` of `options`, normalised. Other keys are not carried over; the input is never mutated. */\nexport function normalizeTtsNeighbourText(\n options: Readonly<{ previousText?: unknown; nextText?: unknown }> | undefined,\n): TtsNeighbourText {\n const out: TtsNeighbourText = {}\n const previous = usableText(options?.previousText)\n if (previous !== undefined) {\n out.previousText = previous.length > TTS_NEIGHBOUR_TEXT_MAX_CHARS ? previous.slice(-TTS_NEIGHBOUR_TEXT_MAX_CHARS) : previous\n }\n const next = usableText(options?.nextText)\n if (next !== undefined) {\n out.nextText = next.length > TTS_NEIGHBOUR_TEXT_MAX_CHARS ? next.slice(0, TTS_NEIGHBOUR_TEXT_MAX_CHARS) : next\n }\n return out\n}\n","import type { ShotSpec } from \"./scene-node-types.js\"\n\n/**\n * Provider-specific directive defaults. Architecture spec §5.14.\n *\n * Each video model can have side-effects the user usually wants (Seedance baking in\n * ambient music, VEO supporting loop seeds, etc.). The engine applies these defaults\n * at provider-call time, allowing them to be overridden by the Scene Director's\n * `shot_intent` field (provider-neutral) which we map below.\n *\n * Keys are canonical provider identifiers (matching VIDEO_MODEL_CAPS in\n * model-constants.ts). Non-canonical keys would silently break downstream\n * route validation + payload building.\n */\nexport const PROVIDER_DIRECTIVE_DEFAULTS = {\n \"seedance-2\": { multishot: true, disable_internal_music: true, allow_sfx: true },\n veo3: { reference_count: \"auto\" as const },\n \"veo3.1\": { reference_count: \"auto\" as const },\n kling: { reference_count: \"auto\" as const },\n \"kling-3-omni\": { reference_count: \"auto\" as const },\n \"kling-turbo\": { reference_count: \"auto\" as const },\n hailuo: {} as Record<string, never>,\n \"hailuo-2.3-pro\": {} as Record<string, never>,\n \"hailuo-standard\": {} as Record<string, never>,\n minimax: {} as Record<string, never>,\n // MiniMax Hailuo 3 — multimodal like seedance-2 but no verified directive\n // semantics yet; empty until probed (NOTE: never match `minimax-h3` with a\n // startsWith(\"seedance\") / startsWith(\"minimax\") prefix check — exact keys only).\n \"minimax-h3\": {} as Record<string, never>,\n \"bytedance-lite\": {} as Record<string, never>,\n} as const\n\n/**\n * Maps a Scene Director's provider-neutral shot_intent to provider-specific directives.\n * Architecture spec §5.14 mapping table.\n *\n * Unknown providers fall through to an empty object — the directive degrades to a text\n * hint in the motion_prompt (Scene Director includes it there as a fallback when\n * `needs_music_suppression: true`).\n */\nexport function mapShotIntentToProviderDirectives(\n provider: string,\n shotIntent: ShotSpec[\"shot_intent\"],\n): Record<string, unknown> {\n const directives: Record<string, unknown> = {\n ...(PROVIDER_DIRECTIVE_DEFAULTS[provider as keyof typeof PROVIDER_DIRECTIVE_DEFAULTS] ?? {}),\n }\n\n if (shotIntent.needs_multishot_reference) {\n if (provider.startsWith(\"seedance\")) {\n directives.multishot = true\n }\n // VEO + Kling: accepts reference_images array — engine attaches the refs separately.\n // Hailuo: only 1 ref — silently ignored at engine layer.\n }\n\n if (shotIntent.is_loopable) {\n if (provider.startsWith(\"veo\")) {\n directives.loop_seed = \"stable\"\n }\n // Other providers: no native loop_seed → degrade to motion_prompt frame-matching hint.\n }\n\n if (shotIntent.needs_music_suppression) {\n if (provider.startsWith(\"seedance\")) {\n directives.disable_internal_music = true\n }\n // VEO / Kling / Hailuo don't bake in music; no directive needed.\n }\n\n return directives\n}\n","/**\n * Character LoRA routing decision + identifier constants.\n *\n * Shared between backend (orchestrator's payload-builder) and frontend\n * (single-node Run's execute-node). MUST agree byte-for-byte — the backend\n * stamps the credit identifier and worker payload off this decision, the\n * frontend stamps the `_internalLora` body hint off it. Mismatches would\n * silently degrade trained-character generations to ref injection.\n */\n\n/**\n * Synthetic Replicate model id selected by the orchestrator (and the\n * single-node Run pre-Zod swap) when a single trained `@character` mention\n * is detected. Routes through `black-forest-labs/flux-dev-lora` with the\n * character's trained version under `extraParams.lora_version`. Never\n * appears in user-facing dropdowns.\n */\nexport const FLUX_LORA_CHARACTER_MODEL_ID = \"flux-lora-character\" as const\n\n/**\n * `jobs.job_type` discriminator + credit identifier for character LoRA\n * training jobs. Used for `STATIC_CREDIT_COSTS`/`model_pricing` lookup,\n * `creditGuard` reservation, refund flow, and webhook job lookup.\n */\nexport const CHARACTER_LORA_TRAINING_JOB_TYPE = \"character-lora-training\" as const\n\n/**\n * The three LoRA fields read off `CharacterNodeData` and stamped onto every\n * `ConnectedReference` produced from a wired character. Shared between the\n * backend's `expandWiredCharacterRefs` and the frontend's\n * `expandCharacterNodeIntoRefs` so both sides emit the same three fields\n * without copy-paste drift.\n */\nexport interface CharacterLoraFields {\n readonly loraReplicateVersion: string | null\n readonly loraTriggerWord: string | null\n readonly loraTrainingStatus: string | null\n}\n\n/**\n * Extract the three LoRA fields from a character node's `data`, normalized\n * to `null` for missing/undefined values so downstream type-checks (e.g.\n * `selectLoraRoutingForMentions`'s `=== \"succeeded\"`) are deterministic.\n */\nexport function extractCharacterLoraFields(charData: {\n loraReplicateVersion?: string | null\n loraTriggerWord?: string | null\n loraTrainingStatus?: string | null\n}): CharacterLoraFields {\n return {\n loraReplicateVersion: charData.loraReplicateVersion ?? null,\n loraTriggerWord: charData.loraTriggerWord ?? null,\n loraTrainingStatus: charData.loraTrainingStatus ?? null,\n }\n}\n\nexport interface LoraRouting {\n readonly characterSlug: string\n readonly triggerWord: string\n readonly loraVersion: string\n}\n\nexport interface LoraEligibleRef {\n readonly characterSlug?: string\n readonly loraReplicateVersion?: string | null\n readonly loraTriggerWord?: string | null\n readonly loraTrainingStatus?: string | null\n}\n\n/**\n * Returns a LoraRouting iff EXACTLY ONE distinct character is mentioned AND\n * that character has a successful LoRA. Returns null otherwise → caller\n * falls back to ref injection. Multi-character LoRA composition is Phase 2.\n */\nexport function selectLoraRoutingForMentions(\n refs: readonly LoraEligibleRef[],\n): LoraRouting | null {\n const distinct = new Set(refs.map((r) => r.characterSlug).filter(Boolean))\n if (distinct.size !== 1) return null\n const slug = [...distinct][0]!\n const match = refs.find((r) => r.characterSlug === slug)\n if (\n !match ||\n !match.loraReplicateVersion ||\n !match.loraTriggerWord ||\n match.loraTrainingStatus !== \"succeeded\"\n ) {\n return null\n }\n return {\n characterSlug: slug,\n triggerWord: match.loraTriggerWord,\n loraVersion: match.loraReplicateVersion,\n }\n}\n","/**\n * Node types whose output carries Suno chaining ids (`sunoTrackId` /\n * `sunoTaskId`) for a downstream Suno node (extend / separate / replace /\n * add-vocals / …) to chain off.\n *\n * One set for the three readers — the canvas resolver, the orchestrator\n * resolver, and the config panels' \"Inherited\" hint (#819). They used to keep\n * their own copies and drifted: the canvas read ids off a `suno-separate`\n * (whose output is stems, not a track) while the orchestrator ignored it, so\n * the same graph resolved on one path and not the other. Structural\n * vocabulary only — node type names, no prompt content.\n */\nexport const SUNO_TRACK_SOURCE_TYPES: ReadonlySet<string> = new Set([\n \"suno-generate\",\n \"suno-cover\",\n \"suno-extend\",\n \"suno-mashup\",\n \"suno-replace-section\",\n \"suno-add-instrumental\",\n \"suno-add-vocals\",\n \"suno-convert-wav\",\n \"suno-upload-extend\",\n])\n","/**\n * ElevenLabs speech-to-speech (voice changer) models — single source of truth\n * for the Voice Changer node's model picker (frontend config panel) AND the\n * `/v1/voice-changer` route Zod enum (backend). Lifting the list here keeps the\n * dropdown and the validation enum from ever drifting apart.\n *\n * These are the two `model_id` values ElevenLabs' `/v1/speech-to-speech/{voiceId}`\n * endpoint accepts with `can_do_voice_conversion`. ElevenLabs' own docs\n * recommend Multilingual v2 even for English source audio (it often\n * outperforms the English-only model), and it's required for non-English\n * audio (e.g. Hebrew), so it's the default — English v2 stays selectable.\n */\nexport const VOICE_CHANGER_MODELS = [\n {\n value: \"eleven_multilingual_sts_v2\",\n label: \"Multilingual v2\",\n desc: \"29 languages; preserves emotion, cadence & timing. Default — ElevenLabs recommends this even for English audio.\",\n },\n {\n value: \"eleven_english_sts_v2\",\n label: \"English v2\",\n desc: \"English-optimized speech-to-speech.\",\n },\n] as const\n\nexport type VoiceChangerModel = (typeof VOICE_CHANGER_MODELS)[number][\"value\"]\n\n/** Plain id list for the route's `z.enum(...)`. */\nexport const VOICE_CHANGER_MODEL_IDS: VoiceChangerModel[] = VOICE_CHANGER_MODELS.map(\n (m) => m.value,\n)\n\n/** ElevenLabs recommends Multilingual v2 even for English source audio (it\n * often outperforms the English-only model), and it's required for\n * non-English audio — so it's the default. English v2 remains selectable. */\nexport const DEFAULT_VOICE_CHANGER_MODEL: VoiceChangerModel = \"eleven_multilingual_sts_v2\"\n","/**\n * Models-tab data source: maps each catalog model to the node it creates\n * (`modelToNodeTarget`) and groups node-creatable models into product lines\n * (`buildModelTree`). Consumed by the add-node popup's Models tab. Pure — derives\n * everything from `MODEL_CATALOG` + the provider enums, so models added to the\n * catalog/enums flow through automatically.\n */\nimport { MODEL_CATALOG, type ModelKind, type ModelMode } from \"./model-catalog.js\"\nimport {\n IMAGE_GEN_PROVIDERS, VIDEO_GEN_PROVIDERS, IMAGE_TO_VIDEO_PROVIDERS, TEXT_TO_VIDEO_PROVIDERS,\n UPSCALE_IMAGE_PROVIDERS, VIDEO_UPSCALE_PROVIDERS, MODIFY_IMAGE_PROVIDERS, IMAGE_EDIT_PROVIDERS,\n VIDEO_TO_VIDEO_PROVIDERS, EXTEND_VIDEO_PROVIDERS, MOTION_TRANSFER_PROVIDERS, LIP_SYNC_PROVIDERS,\n FACE_SWAP_PROVIDERS, TTS_PROVIDERS, DIALOGUE_PROVIDERS, TEXT_TO_AUDIO_PROVIDERS, TRANSCRIBE_PROVIDERS, MUSIC_PROVIDERS,\n} from \"./model-constants.js\"\nimport { VIDEO_DEPTH_PROVIDERS } from \"./video-depth.js\"\n\nexport interface ModelNodeTarget {\n nodeType: string\n field?: \"provider\" | \"model\"\n value?: string\n}\nexport interface ModelTreeVariant extends ModelNodeTarget {\n id: string\n label: string\n kind: ModelKind\n}\nexport interface ModelTreeLine {\n series: string\n family: string\n kind: ModelKind\n models: ModelTreeVariant[]\n}\n\n// A model id that is a valid provider-enum value gets a node + provider preset.\nconst ENUM_TARGETS: ReadonlyArray<readonly [readonly string[], string]> = [\n [IMAGE_GEN_PROVIDERS, \"generate-image\"],\n [VIDEO_GEN_PROVIDERS, \"generate-video\"],\n [IMAGE_TO_VIDEO_PROVIDERS, \"generate-video\"],\n [TEXT_TO_VIDEO_PROVIDERS, \"generate-video\"],\n [UPSCALE_IMAGE_PROVIDERS, \"upscale-image\"],\n [VIDEO_UPSCALE_PROVIDERS, \"video-upscale\"],\n [VIDEO_DEPTH_PROVIDERS, \"video-depth\"],\n [MODIFY_IMAGE_PROVIDERS, \"modify-image\"],\n [IMAGE_EDIT_PROVIDERS, \"modify-image\"],\n [VIDEO_TO_VIDEO_PROVIDERS, \"video-to-video\"],\n [EXTEND_VIDEO_PROVIDERS, \"extend-video\"],\n [MOTION_TRANSFER_PROVIDERS, \"motion-transfer\"],\n [LIP_SYNC_PROVIDERS, \"lip-sync\"],\n [FACE_SWAP_PROVIDERS, \"face-swap\"],\n [TTS_PROVIDERS, \"text-to-speech\"],\n // A dialogue model's id is the node's `provider`: without this row the Models\n // tab would create a BARE dialogue node, which runs as the default (v3) whatever\n // the user picked.\n [DIALOGUE_PROVIDERS, \"text-to-dialogue\"],\n [TEXT_TO_AUDIO_PROVIDERS, \"text-to-audio\"],\n [TRANSCRIBE_PROVIDERS, \"transcribe\"],\n [MUSIC_PROVIDERS, \"suno-generate\"],\n]\n\n// Fallback by the catalog's own `modes`, for models whose id is NOT a provider-enum\n// value — single-provider utility nodes (voice-design, dubbing, …) and catalog models\n// that no node exposes as a provider option. These create a bare node of the right\n// type (no provider preset — the user picks the model inside the node).\nconst MODE_TO_NODE: Readonly<Partial<Record<ModelMode, string>>> = {\n \"t2i\": \"generate-image\", \"i2i\": \"modify-image\", \"edit\": \"modify-image\", \"remove-bg\": \"modify-image\",\n \"t2v\": \"generate-video\", \"i2v\": \"generate-video\", \"v2v\": \"video-to-video\", \"extend\": \"extend-video\",\n \"upscale\": \"upscale-image\", \"video-upscale\": \"video-upscale\", \"motion-transfer\": \"motion-transfer\",\n \"lip-sync\": \"lip-sync\", \"tts\": \"text-to-speech\", \"sfx\": \"text-to-audio\",\n \"music\": \"suno-generate\", \"voice-design\": \"voice-design\", \"voice-changer\": \"voice-changer\",\n \"isolation\": \"audio-isolation\", \"dubbing\": \"dubbing\", \"forced-alignment\": \"forced-alignment\", \"stt\": \"transcribe\",\n \"dialogue\": \"text-to-dialogue\",\n \"video-analysis\": \"video-analysis\",\n}\n\nexport function modelToNodeTarget(modelId: string): ModelNodeTarget | null {\n const entry = MODEL_CATALOG[modelId]\n if (!entry) return null\n // Resolve the target node: a valid provider-enum value wins, else the catalog's modes.\n const enumMatch = ENUM_TARGETS.find(([providers]) => providers.includes(modelId))\n const nodeType = enumMatch?.[1] ?? entry.modes.map((m) => MODE_TO_NODE[m]).find(Boolean)\n if (!nodeType) return null\n // suno-generate stores its model in `data.model` (a V-code carried on the catalog\n // entry as `dataValue`), not as a `provider` id. Every other node takes a `provider`\n // preset when the id is a valid enum value, and a bare node otherwise.\n if (nodeType === \"suno-generate\") {\n return entry.dataValue ? { nodeType, field: \"model\", value: entry.dataValue } : { nodeType }\n }\n return enumMatch ? { nodeType, field: \"provider\", value: modelId } : { nodeType }\n}\n\n/**\n * Flat, query-filtered model variants for the add-node search. The single source\n * of truth shared by the Models tab/category browser and every tab's search\n * (image/video/audio narrow by `kind`; models/all/common pass no kind). Filters\n * by label/id substring; a blank query returns `[]`. Derived from\n * `buildModelTree`, so only node-creatable models appear and new catalog entries\n * flow through automatically.\n */\n// MODEL_CATALOG + the provider enums are static module constants, so the tree\n// never changes at runtime — build it once and reuse for every search keystroke.\nlet _modelTree: ModelTreeLine[] | null = null\nfunction getModelTree(): ModelTreeLine[] {\n return (_modelTree ??= buildModelTree())\n}\n\nexport function searchModelVariants(query: string, kind?: ModelKind): ModelTreeVariant[] {\n const q = query.trim().toLowerCase()\n if (!q) return []\n return getModelTree()\n .flatMap((l) => l.models)\n .filter((m) => (!kind || m.kind === kind) && (m.label.toLowerCase().includes(q) || m.id.toLowerCase().includes(q)))\n}\n\nexport function buildModelTree(): ModelTreeLine[] {\n const bySeries = new Map<string, ModelTreeLine>()\n for (const entry of Object.values(MODEL_CATALOG)) {\n const target = modelToNodeTarget(entry.id)\n if (!target || !entry.series) continue\n let line = bySeries.get(entry.series)\n if (!line) {\n line = { series: entry.series, family: entry.family, kind: entry.kind, models: [] }\n bySeries.set(entry.series, line)\n }\n line.models.push({ id: entry.id, label: entry.label, kind: entry.kind, ...target })\n }\n return [...bySeries.values()].sort((a, b) => a.series.localeCompare(b.series))\n}\n","/**\n * Topaz video upscale — the lever a caller sets and the target it resolves to.\n *\n * Topaz takes an absolute TARGET, never a factor: a resolution (720p, 1080p or\n * 4K — the short side of the frame; a portrait clip keeps its orientation) and\n * an output frame rate (15–60 fps; frames it has to invent are interpolated).\n * The editor used to send a 1×/2×/4× factor, which saved workflows, older API\n * callers and private plugins still do, so a factor is still accepted and is\n * mapped onto the target here: factor × the source's short side, snapped to\n * the nearest target.\n *\n * One resolver for every lane (route, workflow run, plugin toolkit), so the\n * target a run is priced at is the one sent.\n */\n\nexport const TOPAZ_VIDEO_RESOLUTIONS = [\"720p\", \"1080p\", \"4k\"] as const\nexport type TopazVideoResolution = (typeof TOPAZ_VIDEO_RESOLUTIONS)[number]\n\nexport const TOPAZ_VIDEO_DEFAULT_RESOLUTION: TopazVideoResolution = \"1080p\"\n\n/** The short side, in pixels, of each target resolution. */\nexport const TOPAZ_VIDEO_SHORT_SIDE: Readonly<Record<TopazVideoResolution, number>> = {\n \"720p\": 720,\n \"1080p\": 1080,\n \"4k\": 2160,\n}\n\nexport const TOPAZ_VIDEO_FPS_MIN = 15\nexport const TOPAZ_VIDEO_FPS_MAX = 60\n/** The frame rates the editor offers beside \"same as source\". */\nexport const TOPAZ_VIDEO_FPS_CHOICES = [24, 25, 30, 50, 60] as const\n/** The rate used when neither the caller nor the source names one. */\nexport const TOPAZ_VIDEO_FALLBACK_FPS = 30\n\nexport function isTopazVideoResolution(v: unknown): v is TopazVideoResolution {\n return typeof v === \"string\" && (TOPAZ_VIDEO_RESOLUTIONS as readonly string[]).includes(v)\n}\n\n/**\n * The target whose short side is nearest `shortSide` px (4K above it, 720p\n * below; a tie takes the larger). A legacy factor lands here: a 720p clip at\n * 2× (1440 px) renders at 1080p, a 1080p clip at 2× at 4K.\n */\nexport function topazVideoResolutionNearest(shortSide: number): TopazVideoResolution {\n let best: TopazVideoResolution = TOPAZ_VIDEO_RESOLUTIONS[0]\n for (const r of TOPAZ_VIDEO_RESOLUTIONS) {\n if (Math.abs(TOPAZ_VIDEO_SHORT_SIDE[r] - shortSide) <= Math.abs(TOPAZ_VIDEO_SHORT_SIDE[best] - shortSide)) best = r\n }\n return best\n}\n\nexport function clampTopazVideoFps(fps: number): number {\n return Math.min(TOPAZ_VIDEO_FPS_MAX, Math.max(TOPAZ_VIDEO_FPS_MIN, Math.round(fps)))\n}\n\nexport interface TopazVideoSource {\n width: number\n height: number\n /** The source's own frame rate; absent when it has none (variable or unreadable). */\n fps?: number\n}\n\nexport interface TopazVideoTargetInput {\n targetResolution?: string | null\n /** Output frame rate; absent (or \"source\") = the source's own rate. */\n targetFps?: number | string | null\n /** Legacy relative lever (\"1\" | \"2\" | \"4\"): read only when no `targetResolution` is set. */\n upscaleFactor?: string | null\n source?: TopazVideoSource\n}\n\nexport interface TopazVideoTarget {\n resolution: TopazVideoResolution\n fps: number\n /** What was read in place of what was asked, for the job log. Empty when the request was taken as sent. */\n adjustments: string[]\n}\n\nconst LEGACY_FACTORS: Readonly<Record<string, number>> = { \"1\": 1, \"2\": 2, \"4\": 4 }\n\n/**\n * The target a Topaz video upscale renders at. `targetResolution` wins; else a\n * legacy factor over the source's short side; else 1080p. `targetFps` is\n * clamped to 15–60; absent, the source's rate (clamped), else 30.\n */\nexport function resolveTopazVideoTarget(input: TopazVideoTargetInput): TopazVideoTarget {\n const adjustments: string[] = []\n const shortSide = input.source ? Math.min(input.source.width, input.source.height) : undefined\n\n let resolution: TopazVideoResolution\n if (isTopazVideoResolution(input.targetResolution)) {\n resolution = input.targetResolution\n } else {\n if (input.targetResolution != null && input.targetResolution !== \"\") {\n adjustments.push(`targetResolution \"${input.targetResolution}\" is not one of ${TOPAZ_VIDEO_RESOLUTIONS.join(\", \")}`)\n }\n const factor = typeof input.upscaleFactor === \"string\" ? LEGACY_FACTORS[input.upscaleFactor.trim()] : undefined\n if (factor !== undefined && shortSide !== undefined) {\n resolution = topazVideoResolutionNearest(shortSide * factor)\n adjustments.push(`upscaleFactor ${factor}× of a ${shortSide}px short side → ${resolution}`)\n } else {\n resolution = TOPAZ_VIDEO_DEFAULT_RESOLUTION\n if (factor !== undefined) adjustments.push(`upscaleFactor ${factor}× with no readable source size → ${resolution}`)\n }\n }\n\n const asked = typeof input.targetFps === \"number\"\n ? input.targetFps\n : typeof input.targetFps === \"string\" && input.targetFps.trim() !== \"\" && input.targetFps !== \"source\"\n ? Number(input.targetFps)\n : undefined\n let fps: number\n if (asked !== undefined && Number.isFinite(asked)) {\n fps = clampTopazVideoFps(asked)\n if (fps !== asked) adjustments.push(`targetFps ${asked} → ${fps}`)\n } else if (input.source?.fps !== undefined && Number.isFinite(input.source.fps) && input.source.fps > 0) {\n fps = clampTopazVideoFps(input.source.fps)\n } else {\n fps = TOPAZ_VIDEO_FALLBACK_FPS\n }\n\n return { resolution, fps, adjustments }\n}\n\n/**\n * The output frame size a target renders a source at: the short side at the\n * target, the long side scaled by the source's aspect, both even. Without a\n * source, a 16:9 frame.\n */\nexport function topazVideoOutputSize(\n resolution: TopazVideoResolution,\n source?: Pick<TopazVideoSource, \"width\" | \"height\">,\n): { width: number; height: number } {\n const short = TOPAZ_VIDEO_SHORT_SIDE[resolution]\n const ratio = source && source.width > 0 && source.height > 0\n ? Math.max(source.width, source.height) / Math.min(source.width, source.height)\n : 16 / 9\n const long = Math.round((short * ratio) / 2) * 2\n const portrait = source ? source.height > source.width : false\n return portrait ? { width: short, height: long } : { width: long, height: short }\n}\n","import { hasFeature } from \"./model-catalog.js\"\n\n/**\n * Audio soundtrack: a video model whose reference audio clips are VOICE samples\n * (catalog feature `voice-references`, Kling 4.0) cannot play a clip as it is —\n * but it keeps a reference VIDEO's own sound when asked (`keep_original_sound`).\n * A model declaring `audio-soundtrack` therefore plays the FIRST reference audio\n * clip as the result's soundtrack: the platform turns that clip into a short\n * reference video (one still frame carrying the audio) and sends it with the\n * video's sound kept, so the people in the scene perform to the exact track.\n * Any further clips stay voice samples.\n *\n * On by default (`audioSoundtrack` unset = on); a caller turns it off with\n * `audioSoundtrack: false`. The clip then IS a reference video everywhere a run\n * is checked or priced — the reference-video price, the 5-clip and 30-second\n * caps — because the request carries it as one before any of those run.\n */\n\n/** The shortest reference video Kling 4.0 accepts; a shorter clip is padded with silence. */\nexport const AUDIO_SOUNDTRACK_MIN_SEC = 2\n\n/** The soundtrack clip's frame rate: its length is a whole number of these frames. */\nexport const AUDIO_SOUNDTRACK_FPS = 24\n\n/** Whether this run plays its first reference audio clip as the soundtrack. */\nexport function audioSoundtrackActive(args: {\n provider: string | undefined\n /** The node / request lever; unset = on. */\n audioSoundtrack: boolean | undefined\n /** How many reference audio clips the run carries (or has wired). */\n audioRefCount: number\n}): boolean {\n return (\n !!args.provider &&\n hasFeature(args.provider, \"audio-soundtrack\") &&\n args.audioSoundtrack !== false &&\n args.audioRefCount > 0\n )\n}\n\n/**\n * The length of the soundtrack clip a run sends: the audio's own length, at\n * least {@link AUDIO_SOUNDTRACK_MIN_SEC} (padded with silence) and at most the\n * clip being made (the rest of a longer track is not played), on whole frames\n * of {@link AUDIO_SOUNDTRACK_FPS} — the length the rendered file measures, so\n * the quote, the estimate and the run's own reservation all read one number.\n * An audio whose length is unknown counts as the whole clip — the longest it\n * can be, so a price built from it is never below the run's.\n */\nexport function audioSoundtrackClipSec(audioSec: number, outputSec: number): number {\n const sec = !Number.isFinite(audioSec) || audioSec <= 0 ? outputSec : Math.min(outputSec, Math.max(AUDIO_SOUNDTRACK_MIN_SEC, audioSec))\n return Math.round(sec * AUDIO_SOUNDTRACK_FPS) / AUDIO_SOUNDTRACK_FPS\n}\n\n/**\n * The prompt for a soundtrack run: the soundtrack clip is reference video\n * `@video_<videoNumber>` (after the caller's own clips), so a mention of the\n * first audio clip (`@audio_1`) now names it, and the remaining audio clips\n * move down one (`@audio_2` → `@audio_1`). A sentence before the prompt says\n * what that clip is for, when it fits within `maxChars` (the model's prompt\n * limit) — a prompt already near the limit keeps only the renaming.\n */\nexport function audioSoundtrackPrompt(prompt: string, videoNumber: number, maxChars = Number.POSITIVE_INFINITY): string {\n const video = `@video_${videoNumber}`\n const renamed = prompt.replace(/@audio_(\\d+)(?![\\w一-龥])/g, (whole, digits: string) => {\n const n = Number(digits)\n if (n === 1) return video\n return n > 1 ? `@audio_${n - 1}` : whole\n })\n const lead =\n `${video} is the soundtrack: the people in the scene perform to this exact audio, ` +\n \"their lips in sync with any singing or speech. Take only its sound, nothing from its picture.\"\n const withLead = renamed.trim() ? `${lead}\\n${renamed}` : lead\n return withLead.length <= maxChars ? withLead : renamed\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/producer-types.ts","../src/video-ui-defaults.ts"],"names":["composeUnitSet","unitProducers","composeUnitRecord","UGC_PRIMARY_HANDLE","unitFanOutEach","unitListPips","isSeedance2Provider","isMinimaxH3Provider","isWan3Provider","isKling4RunnerProvider","isViduQ4Provider","isGeminiOmniPerSecondProvider","PRIC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OO,gCAAc,QAAQ,CAAA,EAAG,cAAc,CAAC,CAAA;AAClF,EAAA,OAAO,MAAA;AACT;AAUO,SAAS,eAAe,QAAA,EAAsC;AACnE,EAAA,IAAIL,gCAAA,CAAe,QAAQ,CAAA,IAAKE,kCAAA,CAAiB,QAAQ,CAAA,IAAKD,wCAAA,CAAuB,QAAQ,CAAA,EAAG,OAAO,CAAA;AACvG,EAAA,IAAIK,sCAAA,CAAqB,QAAQ,CAAA,EAAG,OAAO,CAAA;AAC3C,EAAA,OAAO,MAAA;AACT","file":"chunk-AOJ6B7K4.cjs","sourcesContent":["/**\n * Producer-type sets — single source of truth for the node types whose\n * primary output is a video URL, audio URL, etc.\n *\n * Consumed by:\n * - backend/src/services/workflow-engine/execution-graph.ts (orchestrator\n * dispatch + asset-type tagging in payload-builder, output-extractor,\n * inline-executor — re-exported there as VIDEO_SOURCE_TYPES /\n * AUDIO_SOURCE_TYPES for backwards compatibility).\n * - frontend/src/lib/generate-video-handles.ts (handle connection\n * validation on the Generate Video node).\n *\n * Lifting these here ensures the frontend handle validator can never reject\n * a connection from a node type that the backend would happily route at\n * execution time (the prior drift bug, see issue 1 of the Task 4.1 review).\n */\nimport { UGC_PRIMARY_HANDLE } from \"./ugc-node-wires.js\"\nimport { composeUnitRecord, composeUnitSet, unitFanOutEach, unitListPips, unitProducers } from \"./unit-contract-compose.js\"\n\n// Each producer set below is its hand-written members ∪ the node units\n// (tools/units/README.md) of that producer kind, from their generated contract\n// rows, in that order — a type in both throws at load (composeUnitSet).\n\n/**\n * Source node types whose primary output is a video URL.\n * Mirrors the backend execution-graph VIDEO_SOURCE_TYPES verbatim.\n */\nexport const VIDEO_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"VIDEO_PRODUCER_TYPES\", [\n \"image-to-video\",\n \"video-to-video\",\n \"switchx\", // Beeble SwitchX relight/composite\n \"text-to-video\",\n // Unified video node — emits videoUrl identically to i2v/t2v (its payload-builder\n // case dispatches dynamically to \"image-to-video\" or \"text-to-video\" jobName based\n // on whether a start frame is wired). Without this, getPrimaryOutput would fall\n // through to the imageUrl/videoUrl/audioUrl/text default and downstream consumers\n // could silently misroute the output.\n \"generate-video\",\n // Generate Video Pro — Seedance-2-family multi-segment stitch variant of\n // generate-video (same \"emits videoUrl\" contract; a trimmed provider +\n // handle set). Must mirror generate-video here or its output can't connect\n // downstream (the recurring \"cannot connect the outputs\" bug class).\n \"generate-video-pro\",\n // Edit Video Pro — Seedance-2-family span-replace sibling of generate-\n // video-pro (same \"emits videoUrl\" contract; source video + prompt in,\n // ONE video out). Must mirror generate-video-pro here or its output can't\n // connect downstream (the recurring \"cannot connect the outputs\" bug class).\n \"edit-video-pro\",\n \"upload-video\",\n \"youtube-video\",\n \"combine-videos\",\n \"lip-sync\",\n \"speech-to-video\",\n \"motion-transfer\",\n \"video-upscale\",\n \"video-depth\",\n \"extend-video\",\n // face-swap output is video (writes generatedVideoUrl, per-result `url`).\n // Frontend execution-graph already includes it in VIDEO_SOURCE_TYPES; this\n // entry brings the shared set in line so canvas typed-handle validation\n // doesn't reject face-swap → video-consumer edges that the orchestrator\n // would happily route at runtime.\n \"face-swap\",\n // Speaker View (C3.2): an EDL rendered with its speakers framed — one VIDEO\n // out (no audio-only render). Registered in RENDER_NODE_TYPES as well.\n \"speaker-view\",\n \"video-retake\",\n // video-sfx: adds an SFX track to a video → emits a video URL. Belongs here so\n // canvas handle validation accepts video-sfx → video-consumer edges and the\n // backend routes its output as video (it was previously relying on a fallback).\n \"video-sfx\",\n \"suno-music-video\",\n \"merge-video-audio\",\n \"add-captions\",\n \"resize-video\",\n \"social-media-format\",\n \"trim-video\",\n \"render-video\",\n \"speed-ramp\",\n \"loop-video\",\n \"fade-video\",\n // Video Mask emits its mask as a video; Mask Composite its composite.\n \"video-mask\",\n \"mask-composite\",\n \"transcode-video\",\n \"manual-edit\",\n // AI Avatar (HeyGen): avatar + voice/audio → video.\n \"ai-avatar\",\n // Cinematic Avatar (HeyGen cinematic_avatar): prompt + 1–3 avatar looks → video.\n \"cinematic-avatar\",\n // Assemble Narrated Video: fits N (clip, voice) blocks into one MP4 → video.\n \"assemble-narrated-video\",\n // Still to Video: one still image + one audio track → MP4 (local FFmpeg,\n // no provider). Emits generatedVideoUrl like every other ffmpeg video node.\n \"still-to-video\",\n // Slideshow: 2-100 stills + one optional audio track → MP4 (local FFmpeg,\n // no provider). Same contract; images arrive via the image-collage lane.\n \"slideshow\",\n // 3D Render Pro: authors a scene AND exports it in one operation, settling\n // with the standard `videoUrl` field. It is a video producer as much as it\n // is a composition producer — omitting it here is the \"cannot connect the\n // outputs\" bug, and its `composition` handle is typed separately.\n \"pro-3d-render\",\n // Video Overlay: timed image layers over a video in one local FFmpeg pass\n // (the base audio copied) — emits a video URL on `video-out`.\n \"video-overlay\",\n // UGC Clip: renders one clip of a UGC video from its ticket — emits a video\n // URL on `video-out` (one per fan-out iteration).\n \"ugc-clip\",\n // UGC Finish: the video's clips, finished, as one ordered list — a registered producer, so a\n // Bundle edge into Combine Videos routes each one as a video, in order.\n \"ugc-finish-clips\",\n], unitProducers(\"video\"))\n\n/**\n * Source node types whose output media-type cannot be classified\n * statically — iterators, dynamic dispatchers, sub-workflow wrappers.\n * The orchestrator decides their actual output type at execution time\n * based on what's wired upstream (loop iterates upstream column type;\n * sub-workflow emits its leaf node's type; adjust-volume passes through\n * video or audio based on its `lastInputType` runtime field;\n * voice-changer emits audio in audio mode, video+audio in video mode).\n *\n * Typed-handle validators (frontend/src/lib/{generate-image,generate-\n * video,ffmpeg}-handles.ts) must include these as acceptors on EVERY\n * media-typed input handle — otherwise the canvas validator hard-\n * rejects edges that the orchestrator would happily route at runtime.\n *\n * Lifted here from `frontend/src/lib/ffmpeg-handles.ts` (where the\n * escape hatch was first added) so the same set drives ALL handle\n * validators uniformly. Adding a new dynamic-output node type means\n * one edit here instead of N across sibling validator files.\n *\n * Intentionally OMITTED:\n * - `webhook-trigger` / `schedule-trigger` — their outputs are\n * user-defined JSON shapes, not media URLs. Accepting them as\n * media producers creates false-positive drops at the canvas\n * that fail at execution. Users wanting trigger → media flows\n * should wire through an upload node.\n */\nexport const DYNAMIC_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"DYNAMIC_PRODUCER_TYPES\", [\n \"list\",\n \"sub-workflow\",\n \"adjust-volume\",\n // Pitch & Tempo: audio in → audio out, video in → video out (picture\n // copied). Dual-mode like adjust-volume; stays in AUDIO_PRODUCER_TYPES as\n // its default.\n \"pitch-tempo\",\n // Dual-mode: audio in → audio out; video in → video out (+ revoiced audio).\n // Listed here so canvas validators accept its output on BOTH audio and video\n // input handles (it also stays in AUDIO_PRODUCER_TYPES as its default).\n \"voice-changer\",\n // voice-changer-pro (renamed from voice-recast in #3581) is a behavioral\n // twin of voice-changer — identical dual-mode output. Must mirror it in\n // EVERY producer set or its outputs can't connect (was the \"cannot connect\n // the outputs of voice-changer-pro\" bug). Guarded by producer-types.test.ts.\n \"voice-changer-pro\",\n // Dubbing joined the dual-mode family with the full-surface upgrade:\n // audio in → dubbed audio; video in (or a video sourceUrl) → dubbed VIDEO\n // (+ audio sidecar). Same wiring contract as voice-changer; stays in\n // AUDIO_PRODUCER_TYPES as its default. Explicitly asserted in\n // producer-types.test.ts (the suite does not fail on omission).\n \"dubbing\",\n \"reduce\",\n // Dual-output time chunker (UI label \"Split into Chunks\"; type id stays\n // \"split-media\"): video in → video chunks, audio in → audio chunks — two\n // independent lanes on two output handles. Like voice-changer, the canvas\n // validator only sees the source NODE type, not which handle a wire leaves,\n // so it lives here to be accepted on BOTH audio and video input handles. The\n // backend routes the correct lane by sourceHandle in getPrimaryOutput\n // (output-extractor.ts); the frontend does so in extractNodeOutput.\n \"split-media\",\n // apply-edl renders an EDL into ONE media output whose type is decided at\n // run time by the node's `output` setting (video OR audio) — so its static\n // medium is genuinely unknown and it belongs here, letting canvas validators\n // accept its default media handle on BOTH audio and video input handles. It\n // ALSO emits a fixed `json` handle (the remapped Transcript); that half lives\n // in JSON_PRODUCER_TYPES (frontend/src/lib/data-handles.ts). The FIRST node\n // with both a dynamic media handle and a fixed json handle. Because\n // getOutputType (presentation-utils.ts) deliberately returns \"data\" for\n // DYNAMIC members, apply-edl is ALSO added to the literal VIDEO_OUTPUT_TYPES\n // there so a published app renders the cut as video, mirroring the\n // voice-changer/dubbing precedent. Asserted in producer-types.test.ts (the\n // suite does not fail on omission).\n \"apply-edl\",\n], unitProducers(\"dynamic\"))\n\n/**\n * Source node types whose primary output is an audio URL.\n * Mirrors the backend execution-graph AUDIO_SOURCE_TYPES verbatim.\n */\nexport const AUDIO_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"AUDIO_PRODUCER_TYPES\", [\n \"text-to-speech\",\n \"text-to-audio\",\n \"generate-music\",\n \"upload-audio\",\n \"suno-generate\",\n \"suno-cover\",\n \"suno-extend\",\n \"suno-separate\",\n \"audio-separation\",\n \"suno-mashup\",\n \"suno-replace-section\",\n \"suno-add-instrumental\",\n \"suno-add-vocals\",\n \"suno-convert-wav\",\n \"suno-upload-extend\",\n \"trim-audio\",\n \"mix-audio\",\n \"combine-audio\",\n \"adjust-volume\",\n \"audio-fx\",\n \"pitch-tempo\",\n \"reference-audio\",\n \"audio-isolation\",\n \"text-to-dialogue\",\n \"voice-changer\",\n // Twin of voice-changer (see DYNAMIC_PRODUCER_TYPES note). Audio is its\n // default output mode; video mode is handled via DYNAMIC membership.\n \"voice-changer-pro\",\n \"dubbing\",\n \"voice-remix\",\n \"voice-design\",\n // Extract Audio: demuxes a video's audio track to a standalone MP3.\n \"extract-audio\",\n], unitProducers(\"audio\"))\n\n/**\n * Source node types whose output is an IMAGE URL — what feeds a References\n * input. ONE set for the canvas validators (`frontend/src/lib/\n * generate-image-handles.ts` re-exports it), the backend's Generate Image\n * handle migration and the MCP edge normalizer (`llm-chat`'s legacy `in`):\n * they used to keep separate copies, and the backend's lagged by eight types.\n */\nexport const IMAGE_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"IMAGE_PRODUCER_TYPES\", [\n \"upload-image\", \"generate-image\", \"edit-image\", \"image-to-image\", \"modify-image\", \"upscale-image\", \"remove-background\",\n // extract-frame produces a single still image extracted from a video source.\n \"extract-frame\",\n // generate-mask emits the source image AND a mask PNG; its `image` source\n // pip is the passthrough (the same image as the input).\n \"generate-mask\",\n // paint-mask emits the hand-painted mask PNG (a plain image at runtime).\n // Membership is what makes mask targets accept it — mask is an advisory\n // color, not a gated type.\n \"paint-mask\",\n // reference-sheet's `sheet` is one composited image and `panels` carries\n // clean reference images; both resolve to image URLs at runtime.\n \"reference-sheet\",\n // reference-board's `image` pip emits a real generated board image.\n \"reference-board\",\n // image-collage composites N images → ONE image.\n \"image-collage\",\n // image-overlay places layers on a base → ONE image.\n \"image-overlay\",\n // 3D Render Pro's `stills` handle carries one PNG per shot of the exported\n // composition (spread into referenceImageUrls like reference-sheet\n // `panels`). A validator sees only the source NODE type, so this also makes\n // its `video` pip droppable on an image input — the handle-blind trade\n // reference-sheet and split-media already make; the input resolvers route\n // by handle, so only `stills` becomes an image at runtime. Deliberately NOT\n // in IMAGE_SOURCE_TYPES on either engine: that set types the node's PRIMARY\n // asset, and 3D Render Pro's is the MP4.\n \"pro-3d-render\",\n], unitProducers(\"image\"))\n\n/**\n * Source node types whose primary output is a LIST that, by default, fans out\n * one downstream execution per element when an edge leaves them WITHOUT an\n * explicit `outputMode` (all other edges default to \"last\"). `selector` is\n * included because its picked/rest channels are lists too.\n *\n * Single source of truth for the fan-out \"each\" default, consumed by:\n * - backend/src/services/workflow-engine/input-resolver.ts (DEFAULT_EACH_TYPES)\n * - frontend/src/components/editor/workflow-editor/types.ts (FAN_OUT_EACH_TYPES)\n * - frontend/src/components/editor/workflow-editor/node-input-resolver.ts\n *\n * These three previously kept independent copies; the backend copy drifted\n * (missing the four list-transform types), so server-side workflow runs\n * silently dropped all-but-the-first item for filter-list / deduplicate /\n * merge-lists / sort-list sources while the canvas fanned out N ways. Lifting\n * the set here makes that drift impossible.\n */\nexport const FAN_OUT_EACH_TYPES: ReadonlySet<string> = new Set([\n \"list\",\n \"split-text\",\n \"filter-list\",\n \"deduplicate\",\n \"merge-lists\",\n \"sort-list\",\n \"selector\",\n // edit-plan `clips` mode emits a bare `Edl[]` on `data.generatedJson`, so an\n // edge leaving it defaults to \"each\" — one downstream execution (typically an\n // apply-edl render) per clip. The `tighten`/`chapters` modes emit an OBJECT,\n // for which the list extractors return undefined, so an \"each\" edge falls back\n // to the scalar `edl` value (no fan-out) — the same graceful degradation\n // web-scrape relies on. See `unwrapEditPlanOutput` in `edit-plan-contract.ts`.\n \"edit-plan\",\n // Content Ideas emits one creative brief per idea on `listResults`, so an\n // edge leaving it defaults to \"each\" — the node after it (typically\n // Generate Script) runs once per idea, on the server too.\n \"content-ideas\",\n])\n\n/**\n * Per-HANDLE \"each\" defaults, for a node whose outputs differ in kind: on the\n * `each` handles an edge without an explicit `outputMode` defaults to \"each\",\n * on its other handles to \"last\". `primary` is the handle an edge with no\n * `sourceHandle` reads (agent-written workflow JSON often omits it).\n *\n * The list an \"each\" edge reads is the node's per-iteration results\n * (`listResults`) — it exists only when the node itself ran once per item, so\n * after a single run the edge degrades to the single value, exactly like a\n * `FAN_OUT_EACH_TYPES` member with one item.\n *\n * Its hand-written rows ∪ the node units' rows (`contract.fanOutEach`,\n * generated/unit-contracts.ts); a type in both refuses to load.\n */\nexport const FAN_OUT_EACH_HANDLES: Readonly<Record<string, { readonly each: readonly string[]; readonly primary: string }>> = composeUnitRecord(\"FAN_OUT_EACH_HANDLES\", {\n // Camera Switch run once per clip (Edit Plan in clips mode): each clip's\n // switched EDL is its own Apply EDL render. Its transcript is the same for\n // every clip (the master clock, renamed), so that handle stays one value\n // (decided 2026-10-04).\n \"camera-switch\": { each: [\"edl\"], primary: \"edl\" },\n // UGC Clips: one ticket per clip on `clips` (each); `plan-out` and\n // `transcript` carry one value. Not a FAN_OUT_EACH_TYPES member — every\n // handle of such a member would fan out. Its one run writes the tickets as\n // its list (`listResults`, the editor's `__listResults`). The pip an edge\n // with no handle reads is the UGC wires' own (UGC_PRIMARY_HANDLE).\n \"ugc-clips\": { each: [\"clips\"], primary: UGC_PRIMARY_HANDLE[\"ugc-clips\"]! },\n // A node unit declares its row in unit.json (contract.fanOutEach); it is added after these.\n}, unitFanOutEach())\n\n/**\n * Fan-out nodes whose iterations must ALL succeed: one failed item fails the\n * node (today's rule tolerates a partial list). UGC Clip — a missing clip\n * silently drops a beat from the script (spec R17). Already-started items\n * finish and settle; their jobs are reused on the next run.\n */\nexport const FAN_OUT_ALL_OR_NOTHING_TYPES: ReadonlySet<string> = new Set([\"ugc-clip\"])\n\n/**\n * Nodes whose saved list is the list their last run PRODUCED — `__listResults`\n * (Extract Field's JSON value on `generatedJson`) — and never a history in\n * `generatedResults`: Extract Field, JSON Process and Site Capture. No run of the first two writes\n * one; earlier builds' server runs did (the run's text, the links of a list of\n * links), and both engines' list readers leave it out for these two (decided\n * 2026-10-05). Single source of truth for the backend engine and the editor.\n */\nexport const OWN_LIST_NODE_TYPES: ReadonlySet<string> = new Set([\n \"extract-field\",\n \"json-process\",\n // Site Capture: its stills, in page order — the last capture's, never every capture's (site-capture-node.ts).\n \"site-capture\",\n])\n\n/** Whether a node's saved list is its own `__listResults`, never a history. */\nexport function ownsItsList(nodeType: string | null | undefined): boolean {\n return typeof nodeType === \"string\" && OWN_LIST_NODE_TYPES.has(nodeType)\n}\n\n/**\n * The output pips that carry the LIST one run produced — several files on one\n * pip (a node unit's `handles.outputs[].list`: each layer of a split image). An\n * edge leaving one runs the next node once per item by default (\"each\"); a\n * Bundle hands the whole list to a node that takes several. Unlike\n * FAN_OUT_EACH_HANDLES, the list is what ONE run made on that pip, never the\n * node's per-iteration results. An edge naming no pip reads the node's primary\n * output, which is never a list pip (tools/units/json-output-rules.mjs).\n * Node units only (generated/unit-contracts.ts UNIT_LIST_PIPS).\n */\nexport const LIST_OUTPUT_HANDLES: Readonly<Record<string, readonly string[]>> = composeUnitRecord(\"LIST_OUTPUT_HANDLES\", {}, unitListPips())\n\n/** Whether an edge leaving `sourceHandle` of a `sourceType` node carries a list one run produced (LIST_OUTPUT_HANDLES). */\nexport function isListOutputHandle(\n sourceType: string | null | undefined,\n sourceHandle: string | null | undefined,\n): boolean {\n if (typeof sourceType !== \"string\" || typeof sourceHandle !== \"string\" || !Object.hasOwn(LIST_OUTPUT_HANDLES, sourceType)) return false\n return LIST_OUTPUT_HANDLES[sourceType]!.includes(sourceHandle)\n}\n\n/** The `outputMode` an edge has when none is set on it — the ONE rule both\n * engines, the credit estimate and the editor read. */\nexport function defaultEdgeOutputMode(\n sourceType: string | null | undefined,\n sourceHandle: string | null | undefined,\n): \"each\" | \"last\" {\n if (typeof sourceType !== \"string\") return \"last\"\n if (FAN_OUT_EACH_TYPES.has(sourceType)) return \"each\"\n if (isListOutputHandle(sourceType, sourceHandle)) return \"each\"\n const entry = FAN_OUT_EACH_HANDLES[sourceType]\n if (!entry) return \"last\"\n return entry.each.includes(sourceHandle || entry.primary) ? \"each\" : \"last\"\n}\n\n/** Whether an edge from `sourceHandle` reads the node's per-iteration results\n * (`listResults` — each iteration's PRIMARY output). False on the other\n * handles of a `FAN_OUT_EACH_HANDLES` node: Camera Switch's transcript is one\n * value, never the list of switched EDLs, whatever mode its edge is set to. */\nexport function listResultsServeHandle(\n sourceType: string | null | undefined,\n sourceHandle: string | null | undefined,\n): boolean {\n const entry = typeof sourceType === \"string\" ? FAN_OUT_EACH_HANDLES[sourceType] : undefined\n return !entry || entry.each.includes(sourceHandle || entry.primary)\n}\n\n/**\n * FAN-IN targets: nodes that FOLD everything wired into them into ONE run,\n * instead of running once per upstream item. Keyed by node type; the value\n * names the target handles that fold (`\"*\"` = every handle). An edge into any\n * other handle of such a node is routed normally — Content Ideas folds its\n * recipes but reads its brand from a `field-brand` wire like any field.\n *\n * Single source of truth for both engines' input resolvers (the backend and\n * the editor each used to keep a private `new Set([\"reduce\"])`). A fan-in\n * node is never itself fanned out by an upstream list.\n */\nexport const FAN_IN_TARGETS: Readonly<Record<string, \"*\" | readonly string[]>> = {\n // Choose Best — every wire is a candidate.\n reduce: \"*\",\n // Content Ideas — one or more recipes, from several Content Recipe nodes\n // and/or one that ran once per post.\n \"content-ideas\": [\"recipes\"],\n // Telegram Reply — one message per run, whatever is wired into its text\n // input: a list (or a writer that ran once per item) arrives as one\n // message, never as a burst of sends to the owner's chat.\n \"telegram-account-send\": [\"in\"],\n // The list operators — they READ the whole list wired into them (their\n // executors collect every upstream item themselves) and emit a list. Run\n // once per item by an \"each\" wire (a Split Text, a List, a node that ran per\n // item), every iteration saw the same whole list and answered with its\n // first match: a Filter List fed 11 stories handed 11 copies of story one\n // downstream, and every paid stage after it ran 11 times on it\n // (2026-10-06). A list operator is never fanned out, on any wire.\n \"filter-list\": \"*\",\n deduplicate: \"*\",\n \"merge-lists\": \"*\",\n \"sort-list\": \"*\",\n selector: \"*\",\n // Speaker Frames on a clip pack (P3-24 (a), decided 2026-10-06): ONE run over\n // the union of the clips' spans — the pack's EDLs fold onto its `edl` wire\n // instead of running one detection job (and one minimum charge) per clip.\n \"speaker-frames\": [\"edl\"],\n // UGC Finish: ONE run over every clip of the video, in clip order — the finish plans its\n // cut and its sound over all of them at once, so it is never run once per clip.\n \"ugc-finish-clips\": [\"clips\"],\n}\n\nexport function isFanInNodeType(nodeType: string | undefined | null): boolean {\n return typeof nodeType === \"string\" && Object.prototype.hasOwnProperty.call(FAN_IN_TARGETS, nodeType)\n}\n\n/** True when an edge into `targetHandle` of a `targetType` node is folded.\n * An edge with NO target handle (workflow JSON written by an agent often\n * omits it) lands on the node's primary input, which is the folding one. */\nexport function isFanInEdge(targetType: string | undefined | null, targetHandle: string | null | undefined): boolean {\n if (!isFanInNodeType(targetType)) return false\n const spec = FAN_IN_TARGETS[targetType as string]!\n if (spec === \"*\") return true\n return targetHandle == null || targetHandle === \"\" || spec.includes(targetHandle)\n}\n","/**\n * UI-default fills for the unified video nodes — the ONE source of truth shared\n * by the backend DAG payload builder, the config-panel fail-safe snaps and the\n * node's hover/run strip.\n *\n * Several config panels RENDER a default without persisting it to node data, so\n * an untouched node submits `aspectRatio` / `resolution` undefined and the\n * enqueued job row (and the /v1/jobs echo) then disagrees with what actually\n * renders. Worse, the panels' generic snap writes `resolutions[0]` for a stale\n * value, which is the CHEAPEST tier under the repo's ascending-resolution\n * convention — not necessarily the tier the model renders and bills.\n *\n * These helpers were local to `backend/src/services/workflow-engine/payload-builder.ts`\n * until the Wan 3.0 launch gave the platform its first provider whose declared\n * billing default differs from `resolutions[0]`; three surfaces then had to\n * agree, so they live here.\n *\n * The resolution fill is per-family ON PURPOSE. Wan 3.0 (and Vidu Q4, whose\n * ascending list starts at 540p) reads its DECLARED\n * billing default (PRICING_DEFAULT_RESOLUTION = 720p) because its catalog list\n * is ascending, so an index-0 fill would write 480p — a tier both `runWan3`\n * (which renders 720P) and the credit identifier (which bills the 720p row)\n * disagree with. The Seedance family keeps its historical first-catalog-tier\n * fill, deliberately: switching it to PRICING_DEFAULT_RESOLUTION would reprice\n * live seedance-2-5 runs, whose declared default (720p) differs from the 480p\n * this has always filled. That 480p-fill vs 720p-billing-default divergence on\n * seedance-2-5 is a KNOWN pre-existing gap, out of scope here — do not \"align\"\n * the branches without repricing it deliberately.\n */\n\nimport {\n PRICING_DEFAULT_RESOLUTION,\n isSeedance2Provider,\n isMinimaxH3Provider,\n isWan3Provider,\n isViduQ4Provider,\n isKling4RunnerProvider,\n isGeminiOmniProvider,\n isGeminiOmniPerSecondProvider,\n} from \"./model-constants.js\"\nimport { MODEL_CATALOG } from \"./model-catalog.js\"\n\n/** `adaptive` is the aspect default for Seedance 2, MiniMax H3 and Wan 3.0. */\nexport function uiAspectRatioFill(provider: string): string | undefined {\n if (isSeedance2Provider(provider) || isMinimaxH3Provider(provider) || isWan3Provider(provider)) return \"adaptive\"\n // Kling 4.0 (and Flash): `auto` follows the materials (frames / references)\n // and renders 16:9 with none — KIE's own default when the field is omitted.\n // Flash's keyframe endpoint has no `auto`, but it runs only with a start\n // frame, where the ratio is never sent (the clip follows the frame).\n if (isKling4RunnerProvider(provider)) return \"auto\"\n return undefined\n}\n\n/** See the file docstring — per-family on purpose; never a generic\n * PRICING_DEFAULT_RESOLUTION read (that would reprice seedance-2-5). */\nexport function uiResolutionFill(provider: string): string | undefined {\n if (isWan3Provider(provider) || isViduQ4Provider(provider) || isKling4RunnerProvider(provider) || isGeminiOmniPerSecondProvider(provider)) return PRICING_DEFAULT_RESOLUTION[provider]\n if (isSeedance2Provider(provider)) return MODEL_CATALOG[provider]?.resolutions?.[0]\n return undefined\n}\n\n/**\n * Duration the node RENDERS and BILLS when `data.duration` is unset, for the\n * families whose credit identifier declares a duration fallback that is NOT\n * `durations[0]`. Wan 3.0's bare identifier is the 5s tier while its ladder\n * starts at 2s; Vidu Q4's is the 5s tier while its ladder starts at 3s; the\n * Gemini Omni family's is the 8s tier while its ladder starts at 4s. Everyone else falls back to the first listed duration, so this returns\n * undefined and the caller keeps `durations[0]`.\n */\nexport function uiDurationFill(provider: string): number | undefined {\n if (isWan3Provider(provider) || isViduQ4Provider(provider) || isKling4RunnerProvider(provider)) return 5\n if (isGeminiOmniProvider(provider)) return 8\n return undefined\n}\n"]}
|