@nodaro/shared 3.31.0 → 3.32.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/README.md +17 -0
- package/dist/chunk-2NIQO2J3.cjs +54 -0
- package/dist/chunk-2NIQO2J3.cjs.map +1 -0
- package/dist/chunk-2OJIVO7R.cjs +32 -0
- package/dist/chunk-2OJIVO7R.cjs.map +1 -0
- package/dist/chunk-2RF4Z7KG.cjs +803 -0
- package/dist/chunk-2RF4Z7KG.cjs.map +1 -0
- package/dist/chunk-3CUFITU7.js +1905 -0
- package/dist/chunk-3CUFITU7.js.map +1 -0
- package/dist/chunk-3RYKIUAE.js +86 -0
- package/dist/chunk-3RYKIUAE.js.map +1 -0
- package/dist/chunk-44I73CQS.cjs +194 -0
- package/dist/chunk-44I73CQS.cjs.map +1 -0
- package/dist/chunk-5AUSSJIM.cjs +3372 -0
- package/dist/chunk-5AUSSJIM.cjs.map +1 -0
- package/dist/chunk-5PC6JBGJ.cjs +1419 -0
- package/dist/chunk-5PC6JBGJ.cjs.map +1 -0
- package/dist/chunk-5RU2HCW2.js +30 -0
- package/dist/chunk-5RU2HCW2.js.map +1 -0
- package/dist/chunk-5THUHJ3E.js +46 -0
- package/dist/chunk-5THUHJ3E.js.map +1 -0
- package/dist/chunk-5U7VLG43.js +141 -0
- package/dist/chunk-5U7VLG43.js.map +1 -0
- package/dist/chunk-6DAWSVX2.cjs +103 -0
- package/dist/chunk-6DAWSVX2.cjs.map +1 -0
- package/dist/chunk-6DKDOWBL.js +1567 -0
- package/dist/chunk-6DKDOWBL.js.map +1 -0
- package/dist/chunk-6IJOPRZP.cjs +197 -0
- package/dist/chunk-6IJOPRZP.cjs.map +1 -0
- package/dist/chunk-7G7G42KS.js +86 -0
- package/dist/chunk-7G7G42KS.js.map +1 -0
- package/dist/chunk-AINCI23X.js +2171 -0
- package/dist/chunk-AINCI23X.js.map +1 -0
- package/dist/chunk-AROWPFO2.js +773 -0
- package/dist/chunk-AROWPFO2.js.map +1 -0
- package/dist/chunk-AVQK77G6.cjs +2000 -0
- package/dist/chunk-AVQK77G6.cjs.map +1 -0
- package/dist/chunk-C57NEO3X.js +3327 -0
- package/dist/chunk-C57NEO3X.js.map +1 -0
- package/dist/chunk-CK3GK34R.js +1381 -0
- package/dist/chunk-CK3GK34R.js.map +1 -0
- package/dist/chunk-E2TGXG6X.cjs +1770 -0
- package/dist/chunk-E2TGXG6X.cjs.map +1 -0
- package/dist/chunk-EK362Q45.cjs +38 -0
- package/dist/chunk-EK362Q45.cjs.map +1 -0
- package/dist/chunk-FBV5DF6D.js +95 -0
- package/dist/chunk-FBV5DF6D.js.map +1 -0
- package/dist/chunk-FG4E7MTG.cjs +4 -0
- package/dist/chunk-FG4E7MTG.cjs.map +1 -0
- package/dist/chunk-G6IIVKMO.js +26 -0
- package/dist/chunk-G6IIVKMO.js.map +1 -0
- package/dist/chunk-HGC5JNVA.cjs +1503 -0
- package/dist/chunk-HGC5JNVA.cjs.map +1 -0
- package/dist/chunk-HSHCCBIV.js +255 -0
- package/dist/chunk-HSHCCBIV.js.map +1 -0
- package/dist/chunk-IEBZHTPE.js +254 -0
- package/dist/chunk-IEBZHTPE.js.map +1 -0
- package/dist/chunk-ISJDAFKS.js +1604 -0
- package/dist/chunk-ISJDAFKS.js.map +1 -0
- package/dist/chunk-J6KHW2E5.cjs +1963 -0
- package/dist/chunk-J6KHW2E5.cjs.map +1 -0
- package/dist/chunk-J7BMO73N.cjs +114 -0
- package/dist/chunk-J7BMO73N.cjs.map +1 -0
- package/dist/chunk-JL4C5VJ7.cjs +488 -0
- package/dist/chunk-JL4C5VJ7.cjs.map +1 -0
- package/dist/chunk-JSGIEF6Z.cjs +1087 -0
- package/dist/chunk-JSGIEF6Z.cjs.map +1 -0
- package/dist/chunk-JSNV5O2F.cjs +34 -0
- package/dist/chunk-JSNV5O2F.cjs.map +1 -0
- package/dist/chunk-JWA5SGCS.js +203 -0
- package/dist/chunk-JWA5SGCS.js.map +1 -0
- package/dist/chunk-JX5YZ4DH.cjs +430 -0
- package/dist/chunk-JX5YZ4DH.cjs.map +1 -0
- package/dist/chunk-KHCBJ7KD.js +42 -0
- package/dist/chunk-KHCBJ7KD.js.map +1 -0
- package/dist/chunk-KU6S7IYV.cjs +210 -0
- package/dist/chunk-KU6S7IYV.cjs.map +1 -0
- package/dist/chunk-LKAIXWK3.js +181 -0
- package/dist/chunk-LKAIXWK3.js.map +1 -0
- package/dist/chunk-LPW3XNC2.js +471 -0
- package/dist/chunk-LPW3XNC2.js.map +1 -0
- package/dist/chunk-M36G6SRP.js +447 -0
- package/dist/chunk-M36G6SRP.js.map +1 -0
- package/dist/chunk-MRXGWL42.cjs +4 -0
- package/dist/chunk-MRXGWL42.cjs.map +1 -0
- package/dist/chunk-NB72XWXQ.cjs +54 -0
- package/dist/chunk-NB72XWXQ.cjs.map +1 -0
- package/dist/chunk-NEJ2PV4C.cjs +211 -0
- package/dist/chunk-NEJ2PV4C.cjs.map +1 -0
- package/dist/chunk-NT6IJH4L.cjs +273 -0
- package/dist/chunk-NT6IJH4L.cjs.map +1 -0
- package/dist/chunk-O5MP52U2.cjs +526 -0
- package/dist/chunk-O5MP52U2.cjs.map +1 -0
- package/dist/chunk-O7PUQLJ3.cjs +818 -0
- package/dist/chunk-O7PUQLJ3.cjs.map +1 -0
- package/dist/chunk-PQHS255G.js +1369 -0
- package/dist/chunk-PQHS255G.js.map +1 -0
- package/dist/chunk-PRYE7AZQ.cjs +1227 -0
- package/dist/chunk-PRYE7AZQ.cjs.map +1 -0
- package/dist/chunk-Q4CDQ2KO.js +21 -0
- package/dist/chunk-Q4CDQ2KO.js.map +1 -0
- package/dist/chunk-QELDJGDK.cjs +1714 -0
- package/dist/chunk-QELDJGDK.cjs.map +1 -0
- package/dist/chunk-QJRP44ZO.js +769 -0
- package/dist/chunk-QJRP44ZO.js.map +1 -0
- package/dist/chunk-QNGNOU4Z.js +29 -0
- package/dist/chunk-QNGNOU4Z.js.map +1 -0
- package/dist/chunk-RJL7RCEM.cjs +159 -0
- package/dist/chunk-RJL7RCEM.cjs.map +1 -0
- package/dist/chunk-RN3RMBJZ.js +1164 -0
- package/dist/chunk-RN3RMBJZ.js.map +1 -0
- package/dist/chunk-S5DMKUWK.cjs +1273 -0
- package/dist/chunk-S5DMKUWK.cjs.map +1 -0
- package/dist/chunk-SES6GDBQ.cjs +624 -0
- package/dist/chunk-SES6GDBQ.cjs.map +1 -0
- package/dist/chunk-TNPDV7I4.cjs +2346 -0
- package/dist/chunk-TNPDV7I4.cjs.map +1 -0
- package/dist/chunk-TZBIY5C3.js +187 -0
- package/dist/chunk-TZBIY5C3.js.map +1 -0
- package/dist/chunk-TZE673G6.js +3 -0
- package/dist/chunk-TZE673G6.js.map +1 -0
- package/dist/chunk-ULXI7A6Q.cjs +1047 -0
- package/dist/chunk-ULXI7A6Q.cjs.map +1 -0
- package/dist/chunk-VIWSWVAW.js +1782 -0
- package/dist/chunk-VIWSWVAW.js.map +1 -0
- package/dist/chunk-VWGNPMJZ.cjs +19 -0
- package/dist/chunk-VWGNPMJZ.cjs.map +1 -0
- package/dist/chunk-WDIBOWAA.js +1054 -0
- package/dist/chunk-WDIBOWAA.js.map +1 -0
- package/dist/chunk-WNG7HRVA.cjs +25 -0
- package/dist/chunk-WNG7HRVA.cjs.map +1 -0
- package/dist/chunk-WNVQ3SMB.cjs +96 -0
- package/dist/chunk-WNVQ3SMB.cjs.map +1 -0
- package/dist/chunk-WRSWH7US.cjs +285 -0
- package/dist/chunk-WRSWH7US.cjs.map +1 -0
- package/dist/chunk-XAMC4S53.js +17 -0
- package/dist/chunk-XAMC4S53.js.map +1 -0
- package/dist/chunk-XNISPHTZ.js +1039 -0
- package/dist/chunk-XNISPHTZ.js.map +1 -0
- package/dist/chunk-Y2PM3FFL.js +3 -0
- package/dist/chunk-Y2PM3FFL.js.map +1 -0
- package/dist/chunk-YBPBK5KI.js +1030 -0
- package/dist/chunk-YBPBK5KI.js.map +1 -0
- package/dist/chunk-YHRG7UOC.js +31 -0
- package/dist/chunk-YHRG7UOC.js.map +1 -0
- package/dist/chunk-YWNYGYI7.cjs +31 -0
- package/dist/chunk-YWNYGYI7.cjs.map +1 -0
- package/dist/chunk-YYV35XOS.js +122 -0
- package/dist/chunk-YYV35XOS.js.map +1 -0
- package/dist/chunk-Z2OL5AJD.cjs +133 -0
- package/dist/chunk-Z2OL5AJD.cjs.map +1 -0
- package/dist/chunk-Z4AZW6FY.js +920 -0
- package/dist/chunk-Z4AZW6FY.js.map +1 -0
- package/dist/chunk-ZDFHA2EC.js +572 -0
- package/dist/chunk-ZDFHA2EC.js.map +1 -0
- package/dist/chunk-ZNZDQAXN.js +175 -0
- package/dist/chunk-ZNZDQAXN.js.map +1 -0
- package/dist/chunk-ZRL2UFTH.cjs +1073 -0
- package/dist/chunk-ZRL2UFTH.cjs.map +1 -0
- package/dist/chunk-ZT77RY6R.js +404 -0
- package/dist/chunk-ZT77RY6R.js.map +1 -0
- package/dist/entries/apps.cjs +155 -0
- package/dist/entries/apps.cjs.map +1 -0
- package/dist/entries/apps.d.cts +283 -0
- package/dist/entries/apps.d.ts +283 -0
- package/dist/entries/apps.js +10 -0
- package/dist/entries/apps.js.map +1 -0
- package/dist/entries/captions.cjs +124 -0
- package/dist/entries/captions.cjs.map +1 -0
- package/dist/entries/captions.d.cts +354 -0
- package/dist/entries/captions.d.ts +354 -0
- package/dist/entries/captions.js +3 -0
- package/dist/entries/captions.js.map +1 -0
- package/dist/entries/catalogs.cjs +165 -0
- package/dist/entries/catalogs.cjs.map +1 -0
- package/dist/entries/catalogs.d.cts +385 -0
- package/dist/entries/catalogs.d.ts +385 -0
- package/dist/entries/catalogs.js +4 -0
- package/dist/entries/catalogs.js.map +1 -0
- package/dist/entries/credits.cjs +592 -0
- package/dist/entries/credits.cjs.map +1 -0
- package/dist/entries/credits.d.cts +1429 -0
- package/dist/entries/credits.d.ts +1429 -0
- package/dist/entries/credits.js +11 -0
- package/dist/entries/credits.js.map +1 -0
- package/dist/entries/edl.cjs +409 -0
- package/dist/entries/edl.cjs.map +1 -0
- package/dist/entries/edl.d.cts +1199 -0
- package/dist/entries/edl.d.ts +1199 -0
- package/dist/entries/edl.js +4 -0
- package/dist/entries/edl.js.map +1 -0
- package/dist/entries/entities.cjs +530 -0
- package/dist/entries/entities.cjs.map +1 -0
- package/dist/entries/entities.d.cts +1371 -0
- package/dist/entries/entities.d.ts +1371 -0
- package/dist/entries/entities.js +5 -0
- package/dist/entries/entities.js.map +1 -0
- package/dist/entries/i18n.cjs +48 -0
- package/dist/entries/i18n.cjs.map +1 -0
- package/dist/entries/i18n.d.cts +69 -0
- package/dist/entries/i18n.d.ts +69 -0
- package/dist/entries/i18n.js +3 -0
- package/dist/entries/i18n.js.map +1 -0
- package/dist/entries/llm-models.cjs +177 -0
- package/dist/entries/llm-models.cjs.map +1 -0
- package/dist/entries/llm-models.d.cts +435 -0
- package/dist/entries/llm-models.d.ts +435 -0
- package/dist/entries/llm-models.js +4 -0
- package/dist/entries/llm-models.js.map +1 -0
- package/dist/entries/media.cjs +335 -0
- package/dist/entries/media.cjs.map +1 -0
- package/dist/entries/media.d.cts +518 -0
- package/dist/entries/media.d.ts +518 -0
- package/dist/entries/media.js +6 -0
- package/dist/entries/media.js.map +1 -0
- package/dist/entries/model-catalog.cjs +247 -0
- package/dist/entries/model-catalog.cjs.map +1 -0
- package/dist/entries/model-catalog.d.cts +202 -0
- package/dist/entries/model-catalog.d.ts +202 -0
- package/dist/entries/model-catalog.js +6 -0
- package/dist/entries/model-catalog.js.map +1 -0
- package/dist/entries/models.cjs +833 -0
- package/dist/entries/models.cjs.map +1 -0
- package/dist/entries/models.d.cts +287 -0
- package/dist/entries/models.d.ts +287 -0
- package/dist/entries/models.js +8 -0
- package/dist/entries/models.js.map +1 -0
- package/dist/entries/nodes.cjs +789 -0
- package/dist/entries/nodes.cjs.map +1 -0
- package/dist/entries/nodes.d.cts +1600 -0
- package/dist/entries/nodes.d.ts +1600 -0
- package/dist/entries/nodes.js +16 -0
- package/dist/entries/nodes.js.map +1 -0
- package/dist/entries/organizations.cjs +80 -0
- package/dist/entries/organizations.cjs.map +1 -0
- package/dist/entries/organizations.d.cts +466 -0
- package/dist/entries/organizations.d.ts +466 -0
- package/dist/entries/organizations.js +3 -0
- package/dist/entries/organizations.js.map +1 -0
- package/dist/entries/pipeline.cjs +594 -0
- package/dist/entries/pipeline.cjs.map +1 -0
- package/dist/entries/pipeline.d.cts +2617 -0
- package/dist/entries/pipeline.d.ts +2617 -0
- package/dist/entries/pipeline.js +5 -0
- package/dist/entries/pipeline.js.map +1 -0
- package/dist/entries/scene3d.cjs +704 -0
- package/dist/entries/scene3d.cjs.map +1 -0
- package/dist/entries/scene3d.d.cts +4284 -0
- package/dist/entries/scene3d.d.ts +4284 -0
- package/dist/entries/scene3d.js +3 -0
- package/dist/entries/scene3d.js.map +1 -0
- package/dist/entries/social.cjs +714 -0
- package/dist/entries/social.cjs.map +1 -0
- package/dist/entries/social.d.cts +1366 -0
- package/dist/entries/social.d.ts +1366 -0
- package/dist/entries/social.js +5 -0
- package/dist/entries/social.js.map +1 -0
- package/dist/entries/types.cjs +13 -0
- package/dist/entries/types.cjs.map +1 -0
- package/dist/entries/types.d.cts +162 -0
- package/dist/entries/types.d.ts +162 -0
- package/dist/entries/types.js +4 -0
- package/dist/entries/types.js.map +1 -0
- package/dist/entries/ugc.cjs +279 -0
- package/dist/entries/ugc.cjs.map +1 -0
- package/dist/entries/ugc.d.cts +575 -0
- package/dist/entries/ugc.d.ts +575 -0
- package/dist/entries/ugc.js +6 -0
- package/dist/entries/ugc.js.map +1 -0
- package/dist/entries/video.cjs +549 -0
- package/dist/entries/video.cjs.map +1 -0
- package/dist/entries/video.d.cts +1791 -0
- package/dist/entries/video.d.ts +1791 -0
- package/dist/entries/video.js +8 -0
- package/dist/entries/video.js.map +1 -0
- package/dist/entries/workflow.cjs +574 -0
- package/dist/entries/workflow.cjs.map +1 -0
- package/dist/entries/workflow.d.cts +1733 -0
- package/dist/entries/workflow.d.ts +1733 -0
- package/dist/entries/workflow.js +5 -0
- package/dist/entries/workflow.js.map +1 -0
- package/dist/fan-out-meta-Bu6VyXcZ.d.cts +19 -0
- package/dist/fan-out-meta-Bu6VyXcZ.d.ts +19 -0
- package/dist/gemini-omni-voices-zeRXxSbZ.d.cts +174 -0
- package/dist/gemini-omni-voices-zeRXxSbZ.d.ts +174 -0
- package/dist/image-overlay-layers-CyBfRhxJ.d.cts +208 -0
- package/dist/image-overlay-layers-CyBfRhxJ.d.ts +208 -0
- package/dist/index.cjs +7731 -27084
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -24198
- package/dist/index.d.ts +32 -24198
- package/dist/index.js +40 -25220
- package/dist/index.js.map +1 -1
- package/dist/model-catalog-flJYaa-g.d.cts +561 -0
- package/dist/model-catalog-flJYaa-g.d.ts +561 -0
- package/dist/presentation-types-0ENOCjoj.d.cts +61 -0
- package/dist/presentation-types-0ENOCjoj.d.ts +61 -0
- package/dist/presentation-utils-BIqiCzSA.d.cts +90 -0
- package/dist/presentation-utils-BdiObtwq.d.ts +90 -0
- package/dist/scene-node-types-DjenYFLO.d.cts +1949 -0
- package/dist/scene-node-types-DjenYFLO.d.ts +1949 -0
- package/dist/supported-fonts-CRoF1gOy.d.cts +16 -0
- package/dist/supported-fonts-CRoF1gOy.d.ts +16 -0
- package/dist/types-BRlFPEru.d.cts +511 -0
- package/dist/types-BRlFPEru.d.ts +511 -0
- package/dist/types-DffyGSy5.d.cts +67 -0
- package/dist/types-DffyGSy5.d.ts +67 -0
- package/package.json +102 -1
- package/src/__tests__/add-captions-plan.test.ts +6 -2
- package/src/__tests__/caption-edge-dash.test.ts +23 -0
- package/src/__tests__/fixtures/root-exports.baseline.json +4625 -0
- package/src/__tests__/input-field-extra-keys.test.ts +1 -0
- package/src/__tests__/no-internal-imports.test.ts +1 -1
- package/src/__tests__/node-aspect-ratio.test.ts +25 -0
- package/src/__tests__/node-runtime-keys.test.ts +9 -0
- package/src/__tests__/package-entries.test.ts +50 -0
- package/src/__tests__/pitch-tempo-pricing.test.ts +21 -0
- package/src/__tests__/preview-gate-use-case.test.ts +151 -0
- package/src/__tests__/run-continuation.test.ts +7 -1
- package/src/__tests__/site-capture-node.test.ts +58 -0
- package/src/__tests__/ugc-lane-wires.test.ts +228 -0
- package/src/__tests__/ugc-node-wires.test.ts +9 -3
- package/src/__tests__/ugc-run-state.test.ts +5 -4
- package/src/__tests__/video-analysis-catalog-sync.test.ts +1 -1
- package/src/__tests__/video-analysis-pricing.test.ts +6 -6
- package/src/__tests__/voice-changer-pro-quote.test.ts +79 -0
- package/src/add-captions-plan.ts +9 -3
- package/src/caption-edge-dash.ts +33 -0
- package/src/credit-estimators/index.ts +22 -1
- package/src/credit-estimators/pitch-tempo.ts +15 -1
- package/src/credit-estimators/speech.ts +72 -4
- package/src/credit-estimators/unit-quote.ts +52 -0
- package/src/credit-estimators/video-sfx.ts +15 -0
- package/src/credit-estimators/voice-changer-pro-quote.ts +138 -0
- package/src/entity-image-handle.ts +2 -0
- package/src/entries/apps.ts +63 -0
- package/src/entries/captions.ts +34 -0
- package/src/entries/catalogs.ts +65 -0
- package/src/entries/credits.ts +104 -0
- package/src/entries/edl.ts +42 -0
- package/src/entries/entities.ts +144 -0
- package/src/entries/i18n.ts +31 -0
- package/src/entries/llm-models.ts +63 -0
- package/src/entries/media.ts +36 -0
- package/src/entries/model-catalog.ts +89 -0
- package/src/entries/models.ts +266 -0
- package/src/entries/nodes.ts +245 -0
- package/src/entries/organizations.ts +9 -0
- package/src/entries/pipeline.ts +43 -0
- package/src/entries/scene3d.ts +27 -0
- package/src/entries/social.ts +297 -0
- package/src/entries/types.ts +26 -0
- package/src/entries/ugc.ts +14 -0
- package/src/entries/video.ts +59 -0
- package/src/entries/workflow.ts +172 -0
- package/src/fan-out-rows.ts +2 -0
- package/src/index.ts +25 -1845
- package/src/json-kinds.ts +4 -0
- package/src/model-catalog.ts +36 -34
- package/src/node-mappable-fields.ts +1 -0
- package/src/node-run-routes.ts +2 -0
- package/src/node-runtime-keys.ts +8 -0
- package/src/normalize-node-params.ts +30 -0
- package/src/presentation-utils.ts +5 -0
- package/src/preview-gate.ts +92 -14
- package/src/producer-types.ts +16 -2
- package/src/run-continuation.ts +21 -0
- package/src/site-capture-node.ts +82 -0
- package/src/ugc-lane-wires.ts +246 -0
- package/src/ugc-node-wires.ts +37 -7
- package/src/ugc-run-state.ts +5 -3
- package/src/video-analysis-pricing.ts +31 -29
|
@@ -0,0 +1,1419 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/combine-transitions.ts
|
|
4
|
+
var COMBINE_TRANSITIONS = [
|
|
5
|
+
// ===== Fades & Dips =====
|
|
6
|
+
{
|
|
7
|
+
id: "cut",
|
|
8
|
+
label: "Cut",
|
|
9
|
+
xfade: null,
|
|
10
|
+
group: "fades",
|
|
11
|
+
common: true,
|
|
12
|
+
description: "Hard cut \u2014 instant switch with no blend. Default, fastest."
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: "fade",
|
|
16
|
+
label: "Fade",
|
|
17
|
+
xfade: "fade",
|
|
18
|
+
group: "fades",
|
|
19
|
+
common: true,
|
|
20
|
+
description: "Smooth alpha cross-fade between two clips. Classic clean blend."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "dissolve",
|
|
24
|
+
label: "Dissolve",
|
|
25
|
+
xfade: "dissolve",
|
|
26
|
+
group: "fades",
|
|
27
|
+
common: true,
|
|
28
|
+
description: "Random-pixel dissolve. Grainy, organic feel \u2014 good for memory beats."
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "dip-to-black",
|
|
32
|
+
label: "Dip to Black",
|
|
33
|
+
xfade: "fadeblack",
|
|
34
|
+
group: "fades",
|
|
35
|
+
common: true,
|
|
36
|
+
description: "Fade through black. Use between scenes or time jumps."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "dip-to-white",
|
|
40
|
+
label: "Dip to White",
|
|
41
|
+
xfade: "fadewhite",
|
|
42
|
+
group: "fades",
|
|
43
|
+
common: true,
|
|
44
|
+
description: "Fade through white. Bright, ethereal \u2014 flashbacks, dream beats."
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "fadegrays",
|
|
48
|
+
label: "Fade through Greys",
|
|
49
|
+
xfade: "fadegrays",
|
|
50
|
+
group: "fades",
|
|
51
|
+
description: "Desaturates to grey at the midpoint, then re-saturates into B."
|
|
52
|
+
},
|
|
53
|
+
// ===== Wipes =====
|
|
54
|
+
{
|
|
55
|
+
id: "wipe-left",
|
|
56
|
+
label: "Wipe Left",
|
|
57
|
+
xfade: "wipeleft",
|
|
58
|
+
group: "wipes",
|
|
59
|
+
common: true,
|
|
60
|
+
description: "Hard edge sweeps from right to left, revealing the next clip."
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "wipe-right",
|
|
64
|
+
label: "Wipe Right",
|
|
65
|
+
xfade: "wiperight",
|
|
66
|
+
group: "wipes",
|
|
67
|
+
common: true,
|
|
68
|
+
description: "Hard edge sweeps from left to right."
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: "wipe-up",
|
|
72
|
+
label: "Wipe Up",
|
|
73
|
+
xfade: "wipeup",
|
|
74
|
+
group: "wipes",
|
|
75
|
+
description: "Edge sweeps from bottom to top."
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "wipe-down",
|
|
79
|
+
label: "Wipe Down",
|
|
80
|
+
xfade: "wipedown",
|
|
81
|
+
group: "wipes",
|
|
82
|
+
description: "Edge sweeps from top to bottom."
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: "wipe-tl",
|
|
86
|
+
label: "Wipe Top-Left",
|
|
87
|
+
xfade: "wipetl",
|
|
88
|
+
group: "wipes",
|
|
89
|
+
description: "Diagonal wipe from top-left corner."
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "wipe-tr",
|
|
93
|
+
label: "Wipe Top-Right",
|
|
94
|
+
xfade: "wipetr",
|
|
95
|
+
group: "wipes",
|
|
96
|
+
description: "Diagonal wipe from top-right corner."
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "wipe-bl",
|
|
100
|
+
label: "Wipe Bottom-Left",
|
|
101
|
+
xfade: "wipebl",
|
|
102
|
+
group: "wipes",
|
|
103
|
+
description: "Diagonal wipe from bottom-left corner."
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "wipe-br",
|
|
107
|
+
label: "Wipe Bottom-Right",
|
|
108
|
+
xfade: "wipebr",
|
|
109
|
+
group: "wipes",
|
|
110
|
+
description: "Diagonal wipe from bottom-right corner."
|
|
111
|
+
},
|
|
112
|
+
// ===== Slides =====
|
|
113
|
+
{
|
|
114
|
+
id: "slide-left",
|
|
115
|
+
label: "Slide Left",
|
|
116
|
+
xfade: "slideleft",
|
|
117
|
+
group: "slides",
|
|
118
|
+
common: true,
|
|
119
|
+
description: "Next clip pushes A off-screen, sliding in from the right."
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: "slide-right",
|
|
123
|
+
label: "Slide Right",
|
|
124
|
+
xfade: "slideright",
|
|
125
|
+
group: "slides",
|
|
126
|
+
common: true,
|
|
127
|
+
description: "Next clip pushes A off-screen, sliding in from the left."
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: "slide-up",
|
|
131
|
+
label: "Slide Up",
|
|
132
|
+
xfade: "slideup",
|
|
133
|
+
group: "slides",
|
|
134
|
+
description: "Next clip pushes A upward off-screen."
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: "slide-down",
|
|
138
|
+
label: "Slide Down",
|
|
139
|
+
xfade: "slidedown",
|
|
140
|
+
group: "slides",
|
|
141
|
+
description: "Next clip pushes A downward off-screen."
|
|
142
|
+
},
|
|
143
|
+
// ===== Smooth (gradient-edge wipes) =====
|
|
144
|
+
{
|
|
145
|
+
id: "smooth-left",
|
|
146
|
+
label: "Smooth Left",
|
|
147
|
+
xfade: "smoothleft",
|
|
148
|
+
group: "smooth",
|
|
149
|
+
description: "Soft-edged wipe sweeping leftward \u2014 gentler than a hard wipe."
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: "smooth-right",
|
|
153
|
+
label: "Smooth Right",
|
|
154
|
+
xfade: "smoothright",
|
|
155
|
+
group: "smooth",
|
|
156
|
+
description: "Soft-edged wipe sweeping rightward."
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: "smooth-up",
|
|
160
|
+
label: "Smooth Up",
|
|
161
|
+
xfade: "smoothup",
|
|
162
|
+
group: "smooth",
|
|
163
|
+
description: "Soft-edged wipe sweeping upward."
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "smooth-down",
|
|
167
|
+
label: "Smooth Down",
|
|
168
|
+
xfade: "smoothdown",
|
|
169
|
+
group: "smooth",
|
|
170
|
+
description: "Soft-edged wipe sweeping downward."
|
|
171
|
+
},
|
|
172
|
+
// ===== Shapes (circles, rectangles, openings) =====
|
|
173
|
+
{
|
|
174
|
+
id: "circle-open",
|
|
175
|
+
label: "Circle Open",
|
|
176
|
+
xfade: "circleopen",
|
|
177
|
+
group: "shapes",
|
|
178
|
+
common: true,
|
|
179
|
+
description: "Circular iris opens to reveal next clip from the center."
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
id: "circle-close",
|
|
183
|
+
label: "Circle Close",
|
|
184
|
+
xfade: "circleclose",
|
|
185
|
+
group: "shapes",
|
|
186
|
+
description: "Circular iris closes inward over the current clip."
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
id: "circle-crop",
|
|
190
|
+
label: "Circle Crop",
|
|
191
|
+
xfade: "circlecrop",
|
|
192
|
+
group: "shapes",
|
|
193
|
+
description: "Circular mask crops A then expands as B."
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
id: "rect-crop",
|
|
197
|
+
label: "Rectangle Crop",
|
|
198
|
+
xfade: "rectcrop",
|
|
199
|
+
group: "shapes",
|
|
200
|
+
description: "Rectangular mask crops A then expands as B."
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
id: "horz-open",
|
|
204
|
+
label: "Horizontal Open",
|
|
205
|
+
xfade: "horzopen",
|
|
206
|
+
group: "shapes",
|
|
207
|
+
description: "Two horizontal bars split apart from the center to reveal B."
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
id: "horz-close",
|
|
211
|
+
label: "Horizontal Close",
|
|
212
|
+
xfade: "horzclose",
|
|
213
|
+
group: "shapes",
|
|
214
|
+
description: "Top and bottom bars meet at the center."
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
id: "vert-open",
|
|
218
|
+
label: "Vertical Open",
|
|
219
|
+
xfade: "vertopen",
|
|
220
|
+
group: "shapes",
|
|
221
|
+
description: "Two vertical bars split apart from the center to reveal B."
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: "vert-close",
|
|
225
|
+
label: "Vertical Close",
|
|
226
|
+
xfade: "vertclose",
|
|
227
|
+
group: "shapes",
|
|
228
|
+
description: "Left and right bars meet at the center."
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
id: "diag-tl",
|
|
232
|
+
label: "Diagonal Top-Left",
|
|
233
|
+
xfade: "diagtl",
|
|
234
|
+
group: "shapes",
|
|
235
|
+
description: "Diagonal slash sweep originating top-left."
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: "diag-tr",
|
|
239
|
+
label: "Diagonal Top-Right",
|
|
240
|
+
xfade: "diagtr",
|
|
241
|
+
group: "shapes",
|
|
242
|
+
description: "Diagonal slash sweep originating top-right."
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
id: "diag-bl",
|
|
246
|
+
label: "Diagonal Bottom-Left",
|
|
247
|
+
xfade: "diagbl",
|
|
248
|
+
group: "shapes",
|
|
249
|
+
description: "Diagonal slash sweep originating bottom-left."
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
id: "diag-br",
|
|
253
|
+
label: "Diagonal Bottom-Right",
|
|
254
|
+
xfade: "diagbr",
|
|
255
|
+
group: "shapes",
|
|
256
|
+
description: "Diagonal slash sweep originating bottom-right."
|
|
257
|
+
},
|
|
258
|
+
// ===== Slices =====
|
|
259
|
+
{
|
|
260
|
+
id: "hl-slice",
|
|
261
|
+
label: "Horizontal Left Slice",
|
|
262
|
+
xfade: "hlslice",
|
|
263
|
+
group: "slices",
|
|
264
|
+
description: "Horizontal strips slice in from the left."
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
id: "hr-slice",
|
|
268
|
+
label: "Horizontal Right Slice",
|
|
269
|
+
xfade: "hrslice",
|
|
270
|
+
group: "slices",
|
|
271
|
+
description: "Horizontal strips slice in from the right."
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
id: "vu-slice",
|
|
275
|
+
label: "Vertical Up Slice",
|
|
276
|
+
xfade: "vuslice",
|
|
277
|
+
group: "slices",
|
|
278
|
+
description: "Vertical strips slice in from the bottom."
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
id: "vd-slice",
|
|
282
|
+
label: "Vertical Down Slice",
|
|
283
|
+
xfade: "vdslice",
|
|
284
|
+
group: "slices",
|
|
285
|
+
description: "Vertical strips slice in from the top."
|
|
286
|
+
},
|
|
287
|
+
// ===== Reveals =====
|
|
288
|
+
{
|
|
289
|
+
id: "reveal-left",
|
|
290
|
+
label: "Reveal Left",
|
|
291
|
+
xfade: "revealleft",
|
|
292
|
+
group: "reveals",
|
|
293
|
+
description: "A slides leftward off-screen, revealing the static B underneath."
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
id: "reveal-right",
|
|
297
|
+
label: "Reveal Right",
|
|
298
|
+
xfade: "revealright",
|
|
299
|
+
group: "reveals",
|
|
300
|
+
description: "A slides rightward off-screen, revealing B."
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
id: "reveal-up",
|
|
304
|
+
label: "Reveal Up",
|
|
305
|
+
xfade: "revealup",
|
|
306
|
+
group: "reveals",
|
|
307
|
+
description: "A slides upward, revealing B."
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
id: "reveal-down",
|
|
311
|
+
label: "Reveal Down",
|
|
312
|
+
xfade: "revealdown",
|
|
313
|
+
group: "reveals",
|
|
314
|
+
description: "A slides downward, revealing B."
|
|
315
|
+
},
|
|
316
|
+
// ===== Covers =====
|
|
317
|
+
{
|
|
318
|
+
id: "cover-left",
|
|
319
|
+
label: "Cover Left",
|
|
320
|
+
xfade: "coverleft",
|
|
321
|
+
group: "covers",
|
|
322
|
+
description: "B slides in from the right and covers A in place."
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
id: "cover-right",
|
|
326
|
+
label: "Cover Right",
|
|
327
|
+
xfade: "coverright",
|
|
328
|
+
group: "covers",
|
|
329
|
+
description: "B slides in from the left and covers A."
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
id: "cover-up",
|
|
333
|
+
label: "Cover Up",
|
|
334
|
+
xfade: "coverup",
|
|
335
|
+
group: "covers",
|
|
336
|
+
description: "B slides up from below and covers A."
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
id: "cover-down",
|
|
340
|
+
label: "Cover Down",
|
|
341
|
+
xfade: "coverdown",
|
|
342
|
+
group: "covers",
|
|
343
|
+
description: "B slides down from above and covers A."
|
|
344
|
+
},
|
|
345
|
+
// ===== Effects =====
|
|
346
|
+
{
|
|
347
|
+
id: "pixelize",
|
|
348
|
+
label: "Pixelize",
|
|
349
|
+
xfade: "pixelize",
|
|
350
|
+
group: "effects",
|
|
351
|
+
description: "Both clips pixelate to chunky blocks at the midpoint, then sharpen into B."
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
id: "radial",
|
|
355
|
+
label: "Radial Wipe",
|
|
356
|
+
xfade: "radial",
|
|
357
|
+
group: "effects",
|
|
358
|
+
description: "Clock-hand sweep around the center."
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
id: "hblur",
|
|
362
|
+
label: "Blur",
|
|
363
|
+
xfade: "hblur",
|
|
364
|
+
group: "effects",
|
|
365
|
+
description: "Heavy horizontal blur at midpoint \u2014 dreamy speed-blur look."
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
id: "distance",
|
|
369
|
+
label: "Distance",
|
|
370
|
+
xfade: "distance",
|
|
371
|
+
group: "effects",
|
|
372
|
+
description: "Distance-field morph between A and B. Subtle dimensional warp."
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
id: "zoom-in",
|
|
376
|
+
label: "Zoom In",
|
|
377
|
+
xfade: "zoomin",
|
|
378
|
+
group: "effects",
|
|
379
|
+
description: "B zooms outward from a point in A."
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
id: "squeeze-h",
|
|
383
|
+
label: "Squeeze Horizontal",
|
|
384
|
+
xfade: "squeezeh",
|
|
385
|
+
group: "effects",
|
|
386
|
+
description: "A squeezes horizontally to a line, then B expands."
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
id: "squeeze-v",
|
|
390
|
+
label: "Squeeze Vertical",
|
|
391
|
+
xfade: "squeezev",
|
|
392
|
+
group: "effects",
|
|
393
|
+
description: "A squeezes vertically to a line, then B expands."
|
|
394
|
+
}
|
|
395
|
+
];
|
|
396
|
+
var COMBINE_TRANSITION_IDS = COMBINE_TRANSITIONS.map((t) => t.id);
|
|
397
|
+
var COMBINE_TRANSITION_GROUP_ORDER = [
|
|
398
|
+
"fades",
|
|
399
|
+
"wipes",
|
|
400
|
+
"slides",
|
|
401
|
+
"smooth",
|
|
402
|
+
"shapes",
|
|
403
|
+
"slices",
|
|
404
|
+
"reveals",
|
|
405
|
+
"covers",
|
|
406
|
+
"effects"
|
|
407
|
+
];
|
|
408
|
+
var COMBINE_TRANSITION_GROUP_LABELS = {
|
|
409
|
+
fades: "Fades & Dips",
|
|
410
|
+
wipes: "Wipes",
|
|
411
|
+
slides: "Slides",
|
|
412
|
+
smooth: "Smooth",
|
|
413
|
+
shapes: "Shapes",
|
|
414
|
+
slices: "Slices",
|
|
415
|
+
reveals: "Reveals",
|
|
416
|
+
covers: "Covers",
|
|
417
|
+
effects: "Effects"
|
|
418
|
+
};
|
|
419
|
+
var TRANSITIONS_BY_ID = new Map(
|
|
420
|
+
COMBINE_TRANSITIONS.map((t) => [t.id, t])
|
|
421
|
+
);
|
|
422
|
+
function getCombineTransition(id) {
|
|
423
|
+
return TRANSITIONS_BY_ID.get(id);
|
|
424
|
+
}
|
|
425
|
+
function resolveXfadeName(id) {
|
|
426
|
+
const entry = TRANSITIONS_BY_ID.get(id);
|
|
427
|
+
if (!entry) {
|
|
428
|
+
throw new Error(`Unknown combine-videos transition: ${id}`);
|
|
429
|
+
}
|
|
430
|
+
return entry.xfade;
|
|
431
|
+
}
|
|
432
|
+
var PICKER_TO_COMBINE_TRANSITION = {
|
|
433
|
+
"none": "cut",
|
|
434
|
+
"auto": "dissolve",
|
|
435
|
+
// an explicitly wired "auto" wants A blend — the classic slideshow default
|
|
436
|
+
"cross-dissolve": "dissolve",
|
|
437
|
+
"fade-to-black": "dip-to-black",
|
|
438
|
+
"fade-to-white": "dip-to-white",
|
|
439
|
+
"iris": "circle-open",
|
|
440
|
+
"wipe": "wipe-left",
|
|
441
|
+
"pixelate-reform": "pixelize",
|
|
442
|
+
"dissolve-to-mist": "hblur",
|
|
443
|
+
"match-cut": "cut",
|
|
444
|
+
"smash-cut": "cut",
|
|
445
|
+
"freeze-frame-jump": "cut"
|
|
446
|
+
};
|
|
447
|
+
function resolveSlideshowTransition(value) {
|
|
448
|
+
if (!value) return "cut";
|
|
449
|
+
if (COMBINE_TRANSITION_IDS.includes(value)) return value;
|
|
450
|
+
return PICKER_TO_COMBINE_TRANSITION[value] ?? "cut";
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// src/edl-multicam.ts
|
|
454
|
+
var hasOwn = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
|
455
|
+
var isFiniteNumber = (v) => typeof v === "number" && Number.isFinite(v);
|
|
456
|
+
function mergeEdlSourceOffsets(edl, offsets, opts) {
|
|
457
|
+
const sources = Array.isArray(edl?.sources) ? edl.sources : [];
|
|
458
|
+
const rows = offsets && typeof offsets === "object" ? offsets : {};
|
|
459
|
+
const byId = /* @__PURE__ */ new Map();
|
|
460
|
+
for (const s of sources) if (s && typeof s === "object" && !byId.has(s.id)) byId.set(s.id, s);
|
|
461
|
+
let anchor;
|
|
462
|
+
if (opts?.anchor !== void 0) {
|
|
463
|
+
if (!byId.has(opts.anchor)) {
|
|
464
|
+
return { edl: { ...edl }, applied: [], ignored: [{ sourceId: opts.anchor, reason: "anchor-unknown" }] };
|
|
465
|
+
}
|
|
466
|
+
anchor = opts.anchor;
|
|
467
|
+
} else {
|
|
468
|
+
const masters = sources.filter((s) => s && typeof s === "object" && s.role === "master-audio");
|
|
469
|
+
if (masters.length === 1) anchor = masters[0].id;
|
|
470
|
+
}
|
|
471
|
+
let reference = 0;
|
|
472
|
+
if (anchor !== void 0 && hasOwn(rows, anchor)) {
|
|
473
|
+
const a = rows[anchor];
|
|
474
|
+
if (!isFiniteNumber(a)) {
|
|
475
|
+
return { edl: { ...edl }, anchor, applied: [], ignored: [{ sourceId: anchor, reason: "anchor-not-finite" }] };
|
|
476
|
+
}
|
|
477
|
+
reference = a;
|
|
478
|
+
}
|
|
479
|
+
const anchorOffsetMs = anchor !== void 0 ? byId.get(anchor)?.offsetMs ?? 0 : 0;
|
|
480
|
+
const next = /* @__PURE__ */ new Map();
|
|
481
|
+
const applied = [];
|
|
482
|
+
const ignored = [];
|
|
483
|
+
for (const sourceId of Object.keys(rows)) {
|
|
484
|
+
if (sourceId === anchor) continue;
|
|
485
|
+
if (!byId.has(sourceId)) {
|
|
486
|
+
ignored.push({ sourceId, reason: "unknown-source" });
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
const measured = rows[sourceId];
|
|
490
|
+
const offsetMs = isFiniteNumber(measured) ? Math.round(anchor !== void 0 ? anchorOffsetMs + measured - reference : measured) : Number.NaN;
|
|
491
|
+
if (!Number.isFinite(offsetMs)) {
|
|
492
|
+
ignored.push({ sourceId, reason: "not-finite" });
|
|
493
|
+
continue;
|
|
494
|
+
}
|
|
495
|
+
next.set(sourceId, offsetMs);
|
|
496
|
+
applied.push(sourceId);
|
|
497
|
+
}
|
|
498
|
+
const merged = Array.isArray(edl?.sources) ? { ...edl, sources: edl.sources.map((s) => s && typeof s === "object" && next.has(s.id) ? { ...s, offsetMs: next.get(s.id) } : s) } : { ...edl };
|
|
499
|
+
return { edl: merged, ...anchor !== void 0 ? { anchor } : {}, applied, ignored };
|
|
500
|
+
}
|
|
501
|
+
var AUDIO_SYNC_MIN_CONFIDENCE = 0.5;
|
|
502
|
+
function readAudioSyncRows(sync) {
|
|
503
|
+
let value = sync;
|
|
504
|
+
if (typeof value === "string") {
|
|
505
|
+
try {
|
|
506
|
+
value = JSON.parse(value);
|
|
507
|
+
} catch {
|
|
508
|
+
return null;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
if (!value || typeof value !== "object") return null;
|
|
512
|
+
const { reference, offsets } = value;
|
|
513
|
+
if (!Array.isArray(offsets)) return null;
|
|
514
|
+
const rows = /* @__PURE__ */ new Map();
|
|
515
|
+
for (const row of offsets) {
|
|
516
|
+
if (!row || typeof row !== "object") return null;
|
|
517
|
+
const { sourceId, offsetMs, confidence } = row;
|
|
518
|
+
if (typeof sourceId !== "string" || !isFiniteNumber(offsetMs)) return null;
|
|
519
|
+
if (!rows.has(sourceId)) rows.set(sourceId, { offsetMs, confidence: isFiniteNumber(confidence) ? confidence : 0 });
|
|
520
|
+
}
|
|
521
|
+
if (typeof reference === "string" && reference && !rows.has(reference)) rows.set(reference, { offsetMs: 0, confidence: 1 });
|
|
522
|
+
return rows;
|
|
523
|
+
}
|
|
524
|
+
var handSet = (s) => isFiniteNumber(s.offsetMs);
|
|
525
|
+
function plannerClockSource(sources) {
|
|
526
|
+
return sources.find((s) => s.role === "master-audio") ?? sources[0];
|
|
527
|
+
}
|
|
528
|
+
function applyAudioSyncOffsets(sources, sync) {
|
|
529
|
+
const rows = readAudioSyncRows(sync);
|
|
530
|
+
if (!rows) return { ok: false, issues: [{ code: "not-audio-sync" }] };
|
|
531
|
+
const list = Array.isArray(sources) ? sources.filter((s) => !!s && typeof s === "object") : [];
|
|
532
|
+
const anchor = plannerClockSource(list);
|
|
533
|
+
if (!anchor) return { ok: true, sources: [...list], applied: [] };
|
|
534
|
+
const issues = [];
|
|
535
|
+
for (const s of list) if (s.offsetMs !== void 0 && !handSet(s)) issues.push({ code: "invalid-offset", sourceId: s.id });
|
|
536
|
+
if (handSet(anchor) && anchor.offsetMs !== 0) {
|
|
537
|
+
issues.push({ code: "anchor-offset", sourceId: anchor.id, offsetMs: anchor.offsetMs });
|
|
538
|
+
}
|
|
539
|
+
const measured = {};
|
|
540
|
+
for (const s of list) {
|
|
541
|
+
if (s.id === anchor.id || handSet(s)) continue;
|
|
542
|
+
const row = rows.get(s.id);
|
|
543
|
+
if (!row) issues.push({ code: "unmeasured", sourceId: s.id });
|
|
544
|
+
else if (!(row.confidence >= AUDIO_SYNC_MIN_CONFIDENCE)) issues.push({ code: "weak-match", sourceId: s.id, confidence: row.confidence, anchor: false });
|
|
545
|
+
else measured[s.id] = row.offsetMs;
|
|
546
|
+
}
|
|
547
|
+
if (Object.keys(measured).length > 0) {
|
|
548
|
+
const row = rows.get(anchor.id);
|
|
549
|
+
if (!row) issues.push({ code: "anchor-unmeasured", sourceId: anchor.id });
|
|
550
|
+
else if (!(row.confidence >= AUDIO_SYNC_MIN_CONFIDENCE)) issues.push({ code: "weak-match", sourceId: anchor.id, confidence: row.confidence, anchor: true });
|
|
551
|
+
else measured[anchor.id] = row.offsetMs;
|
|
552
|
+
}
|
|
553
|
+
if (issues.length > 0) return { ok: false, issues };
|
|
554
|
+
if (Object.keys(measured).length === 0) return { ok: true, sources: [...list], anchor: anchor.id, applied: [] };
|
|
555
|
+
const pseudo = { version: 1, clock: "master", sources: list, segments: [] };
|
|
556
|
+
const merged = mergeEdlSourceOffsets(pseudo, measured, { anchor: anchor.id });
|
|
557
|
+
const byId = new Map(merged.edl.sources.map((s) => [s.id, s.offsetMs]));
|
|
558
|
+
const applied = new Set(merged.applied);
|
|
559
|
+
return {
|
|
560
|
+
ok: true,
|
|
561
|
+
sources: list.map((s) => applied.has(s.id) ? { ...s, offsetMs: byId.get(s.id) } : s),
|
|
562
|
+
anchor: anchor.id,
|
|
563
|
+
applied: merged.applied
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function resolveEditPlanSources(sources, opts = {}) {
|
|
567
|
+
const list = Array.isArray(sources) ? sources.filter((s) => !!s && typeof s === "object") : [];
|
|
568
|
+
const anchor = plannerClockSource(list);
|
|
569
|
+
const issues = [];
|
|
570
|
+
let planned = [...list];
|
|
571
|
+
if (opts.offsets !== void 0) {
|
|
572
|
+
const synced = applyAudioSyncOffsets(list, opts.offsets);
|
|
573
|
+
if (synced.ok) planned = synced.sources;
|
|
574
|
+
else issues.push(...synced.issues);
|
|
575
|
+
} else {
|
|
576
|
+
for (const s of list) if (s.offsetMs !== void 0 && !handSet(s)) issues.push({ code: "invalid-offset", sourceId: s.id });
|
|
577
|
+
if (anchor && handSet(anchor) && anchor.offsetMs !== 0) {
|
|
578
|
+
issues.push({ code: "anchor-offset", sourceId: anchor.id, offsetMs: anchor.offsetMs });
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
const spoken = opts.transcriptSourceId ? planned.find((s) => s.id === opts.transcriptSourceId) : void 0;
|
|
582
|
+
if (spoken && anchor && spoken.id !== anchor.id && handSet(spoken) && spoken.offsetMs !== 0) {
|
|
583
|
+
issues.push({ code: "transcript-off-clock", sourceId: spoken.id, masterId: anchor.id, offsetMs: spoken.offsetMs });
|
|
584
|
+
}
|
|
585
|
+
if (issues.length > 0) return { ok: false, issues };
|
|
586
|
+
return { ok: true, sources: planned, ...spoken ? { transcriptSourceId: spoken.id } : {} };
|
|
587
|
+
}
|
|
588
|
+
function editPlanTranscriptOrigin(producerId, typeOf, edges) {
|
|
589
|
+
if (typeOf(producerId) !== "transcribe") return void 0;
|
|
590
|
+
let current = producerId;
|
|
591
|
+
for (let hop = 0; hop < 4; hop++) {
|
|
592
|
+
const upstream = [...new Set(edges.filter((e) => e.target === current).map((e) => e.source))];
|
|
593
|
+
if (upstream.length !== 1) return void 0;
|
|
594
|
+
const up = upstream[0];
|
|
595
|
+
if (typeOf(up) !== "extract-audio") return up;
|
|
596
|
+
current = up;
|
|
597
|
+
}
|
|
598
|
+
return void 0;
|
|
599
|
+
}
|
|
600
|
+
function describeAudioSyncOffsetIssue(issue, labelOf = (id) => id) {
|
|
601
|
+
switch (issue.code) {
|
|
602
|
+
case "transcript-off-clock":
|
|
603
|
+
return `the transcript was made from "${labelOf(issue.sourceId)}", which is ${issue.offsetMs} ms off the master "${labelOf(issue.masterId)}" \u2014 the plan follows the master's clock, so transcribe "${labelOf(issue.masterId)}", or mark "${labelOf(issue.sourceId)}" as master audio`;
|
|
604
|
+
case "not-audio-sync":
|
|
605
|
+
return "the offsets carry no Audio Sync result \u2014 pass its job's output_data.json (on the canvas: connect Audio Sync's Offsets output and run it)";
|
|
606
|
+
case "invalid-offset":
|
|
607
|
+
return `the offset set on "${labelOf(issue.sourceId)}" is not a number of milliseconds`;
|
|
608
|
+
case "anchor-offset":
|
|
609
|
+
return `"${labelOf(issue.sourceId)}" is the master (the plan follows its clock), so its offset must be 0, not ${issue.offsetMs} ms`;
|
|
610
|
+
case "anchor-unmeasured":
|
|
611
|
+
return `audio-sync did not measure "${labelOf(issue.sourceId)}", the master the other sources are timed against \u2014 add it to audio-sync's sources`;
|
|
612
|
+
case "weak-match":
|
|
613
|
+
return issue.anchor ? `audio-sync's match for "${labelOf(issue.sourceId)}", the master the other sources are timed against, is too weak to trust (confidence ${issue.confidence}; ${AUDIO_SYNC_MIN_CONFIDENCE} needed) \u2014 set the other sources' offsets by hand, or mark a better-recorded source as master audio` : `audio-sync's match for "${labelOf(issue.sourceId)}" is too weak to trust (confidence ${issue.confidence}; ${AUDIO_SYNC_MIN_CONFIDENCE} needed) \u2014 set its offset by hand`;
|
|
614
|
+
case "unmeasured":
|
|
615
|
+
return `"${labelOf(issue.sourceId)}" was not measured by audio-sync \u2014 wire it into audio-sync, or set its offset by hand (0 if it started with the master)`;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
var EDL_FULL_FRAME = Object.freeze({ x: 0, y: 0, w: 1, h: 1 });
|
|
619
|
+
function isInFrameRegion(r) {
|
|
620
|
+
if (!r || typeof r !== "object") return false;
|
|
621
|
+
const { x, y, w, h } = r;
|
|
622
|
+
for (const v of [x, y, w, h]) if (!isFiniteNumber(v) || v < 0 || v > 1) return false;
|
|
623
|
+
const box = r;
|
|
624
|
+
return box.w > 0 && box.h > 0 && box.x + box.w <= 1 + 1e-9 && box.y + box.h <= 1 + 1e-9;
|
|
625
|
+
}
|
|
626
|
+
function resolveEdlSegmentSlots(edl, segment, opts) {
|
|
627
|
+
if (!segment || typeof segment !== "object") return [];
|
|
628
|
+
const sources = Array.isArray(edl?.sources) ? edl.sources : [];
|
|
629
|
+
const layoutSlots = Array.isArray(segment.layout?.slots) ? segment.layout.slots : [];
|
|
630
|
+
const slots = layoutSlots.length > 0 ? layoutSlots : typeof segment.video === "string" && segment.video ? [{ source: segment.video }] : [];
|
|
631
|
+
const single = slots.length === 1;
|
|
632
|
+
const out = [];
|
|
633
|
+
for (const slot of slots) {
|
|
634
|
+
if (!slot || typeof slot !== "object") continue;
|
|
635
|
+
const source = slot.source;
|
|
636
|
+
const speaker = slot.speaker ?? (single ? segment.speaker : void 0);
|
|
637
|
+
const rungs = [
|
|
638
|
+
["slot", () => slot.region],
|
|
639
|
+
["segment", () => single ? segment.region : void 0],
|
|
640
|
+
["resolver", () => opts?.regionFor?.({ segment, source, ...speaker !== void 0 ? { speaker } : {} })],
|
|
641
|
+
["speaker", () => speaker === void 0 ? void 0 : Array.isArray(opts?.speakerRegions) ? opts.speakerRegions.find((row) => row && row.source === source && row.speaker === speaker)?.region : void 0],
|
|
642
|
+
["source", () => sources.find((s) => s && typeof s === "object" && s.id === source)?.region]
|
|
643
|
+
];
|
|
644
|
+
let region = EDL_FULL_FRAME;
|
|
645
|
+
let regionFrom = "full";
|
|
646
|
+
for (const [from, read] of rungs) {
|
|
647
|
+
const candidate = read();
|
|
648
|
+
if (isInFrameRegion(candidate)) {
|
|
649
|
+
region = candidate;
|
|
650
|
+
regionFrom = from;
|
|
651
|
+
break;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
out.push({
|
|
655
|
+
source,
|
|
656
|
+
region,
|
|
657
|
+
regionFrom,
|
|
658
|
+
...speaker !== void 0 ? { speaker } : {},
|
|
659
|
+
...slot.weight !== void 0 ? { weight: slot.weight } : {}
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
return out;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// src/speaker-layouts.ts
|
|
666
|
+
var EDL_TARGET_ASPECTS = ["16:9", "9:16", "1:1", "4:5"];
|
|
667
|
+
var TARGET_ASPECT_SET = new Set(EDL_TARGET_ASPECTS);
|
|
668
|
+
function isEdlTargetAspect(v) {
|
|
669
|
+
return typeof v === "string" && TARGET_ASPECT_SET.has(v);
|
|
670
|
+
}
|
|
671
|
+
var SPEAKER_LAYOUTS = [
|
|
672
|
+
{ id: "single", minSlots: 1, maxSlots: 1, aspects: EDL_TARGET_ASPECTS },
|
|
673
|
+
{ id: "side-by-side", minSlots: 2, maxSlots: 2, aspects: ["16:9", "1:1"] },
|
|
674
|
+
{ id: "stacked", minSlots: 2, maxSlots: 2, aspects: ["9:16", "4:5", "1:1"] },
|
|
675
|
+
{ id: "grid", minSlots: 2, maxSlots: 6, aspects: EDL_TARGET_ASPECTS },
|
|
676
|
+
{ id: "pip", minSlots: 2, maxSlots: 2, aspects: EDL_TARGET_ASPECTS }
|
|
677
|
+
];
|
|
678
|
+
var SPEAKER_LAYOUT_IDS = SPEAKER_LAYOUTS.map((l) => l.id);
|
|
679
|
+
var LAYOUTS_BY_ID = new Map(SPEAKER_LAYOUTS.map((l) => [l.id, l]));
|
|
680
|
+
function getSpeakerLayout(id) {
|
|
681
|
+
return LAYOUTS_BY_ID.get(id);
|
|
682
|
+
}
|
|
683
|
+
function speakerLayoutAllows(sheet, q) {
|
|
684
|
+
if (q.aspect !== void 0 && !sheet.aspects.includes(q.aspect)) return false;
|
|
685
|
+
if (q.slotCount !== void 0 && !(q.slotCount >= sheet.minSlots && q.slotCount <= sheet.maxSlots)) return false;
|
|
686
|
+
return true;
|
|
687
|
+
}
|
|
688
|
+
var XFADE_SWITCH_PREFIX = "xfade:";
|
|
689
|
+
function speakerSwitchOverlaps(type) {
|
|
690
|
+
return typeof type === "string" && type.startsWith(XFADE_SWITCH_PREFIX);
|
|
691
|
+
}
|
|
692
|
+
var switchSheet = (id, requiresSameSource) => ({
|
|
693
|
+
id,
|
|
694
|
+
overlaps: speakerSwitchOverlaps(id),
|
|
695
|
+
requiresSameSource
|
|
696
|
+
});
|
|
697
|
+
var SPEAKER_SWITCHES = [
|
|
698
|
+
switchSheet("cut", false),
|
|
699
|
+
switchSheet("pan", true),
|
|
700
|
+
switchSheet("zoom", false),
|
|
701
|
+
...COMBINE_TRANSITIONS.filter((t) => t.xfade !== null).map((t) => switchSheet(XFADE_SWITCH_PREFIX + t.id, false))
|
|
702
|
+
];
|
|
703
|
+
var SPEAKER_SWITCH_IDS = SPEAKER_SWITCHES.map((s) => s.id);
|
|
704
|
+
var SWITCHES_BY_ID = new Map(SPEAKER_SWITCHES.map((s) => [s.id, s]));
|
|
705
|
+
function getSpeakerSwitch(id) {
|
|
706
|
+
return SWITCHES_BY_ID.get(id);
|
|
707
|
+
}
|
|
708
|
+
var SPEAKER_EMPHASIS_STYLES = ["none", "scale", "border", "dim"];
|
|
709
|
+
var EMPHASIS_STYLE_SET = new Set(SPEAKER_EMPHASIS_STYLES);
|
|
710
|
+
function parseSpeakerEmphasisStyle(style) {
|
|
711
|
+
if (typeof style !== "string") return [];
|
|
712
|
+
return style.split("+").map((atom) => atom.trim()).filter((atom) => atom.length > 0);
|
|
713
|
+
}
|
|
714
|
+
function isKnownSpeakerEmphasisStyle(style) {
|
|
715
|
+
const atoms = parseSpeakerEmphasisStyle(style);
|
|
716
|
+
if (atoms.length === 0 || !atoms.every((atom) => EMPHASIS_STYLE_SET.has(atom))) return false;
|
|
717
|
+
if (new Set(atoms).size !== atoms.length) return false;
|
|
718
|
+
return !(atoms.includes("none") && atoms.length > 1);
|
|
719
|
+
}
|
|
720
|
+
var isObject = (v) => !!v && typeof v === "object";
|
|
721
|
+
function speakerPresentationWarnings(edl) {
|
|
722
|
+
const warnings = [];
|
|
723
|
+
if (!isObject(edl)) return warnings;
|
|
724
|
+
const safe = {
|
|
725
|
+
...edl,
|
|
726
|
+
sources: Array.isArray(edl.sources) ? edl.sources : [],
|
|
727
|
+
segments: Array.isArray(edl.segments) ? edl.segments : []
|
|
728
|
+
};
|
|
729
|
+
const rawAspect = isObject(safe.meta) ? safe.meta.targetAspect : void 0;
|
|
730
|
+
const aspect = isEdlTargetAspect(rawAspect) ? rawAspect : void 0;
|
|
731
|
+
if (rawAspect != null && aspect === void 0) {
|
|
732
|
+
warnings.push(`meta.targetAspect "${String(rawAspect)}" is not a known target aspect (known: ${EDL_TARGET_ASPECTS.join(", ")})`);
|
|
733
|
+
}
|
|
734
|
+
safe.segments.forEach((seg, i) => {
|
|
735
|
+
if (!isObject(seg) || !isObject(seg.layout)) return;
|
|
736
|
+
const at = `segment[${i}] "${seg.id}"`;
|
|
737
|
+
const layout = seg.layout;
|
|
738
|
+
const sheet = typeof layout.mode === "string" ? getSpeakerLayout(layout.mode) : void 0;
|
|
739
|
+
if (!sheet) {
|
|
740
|
+
warnings.push(`${at}: unknown layout mode "${String(layout.mode)}" (known: ${SPEAKER_LAYOUT_IDS.join(", ")})`);
|
|
741
|
+
} else {
|
|
742
|
+
const slotCount = Array.isArray(layout.slots) ? layout.slots.length : 0;
|
|
743
|
+
if (slotCount > 0 && !speakerLayoutAllows(sheet, { slotCount })) {
|
|
744
|
+
const range = sheet.minSlots === sheet.maxSlots ? `${sheet.minSlots}` : `${sheet.minSlots}\u2013${sheet.maxSlots}`;
|
|
745
|
+
warnings.push(`${at}: layout "${sheet.id}" takes ${range} slot(s), got ${slotCount}`);
|
|
746
|
+
}
|
|
747
|
+
if (aspect !== void 0 && !speakerLayoutAllows(sheet, { aspect })) {
|
|
748
|
+
warnings.push(`${at}: layout "${sheet.id}" is not drawn for targetAspect ${aspect} (drawn for: ${sheet.aspects.join(", ")})`);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
if (isObject(layout.transition)) {
|
|
752
|
+
const type = layout.transition.type;
|
|
753
|
+
const sw = typeof type === "string" ? getSpeakerSwitch(type) : void 0;
|
|
754
|
+
if (!sw) {
|
|
755
|
+
warnings.push(`${at}: unknown layout transition "${String(type)}" (known: ${SPEAKER_SWITCHES.filter((s) => !s.overlaps).map((s) => s.id).join(", ")}, or ${XFADE_SWITCH_PREFIX}<id> for a combine-videos transition that is a real ffmpeg xfade \u2014 never ${XFADE_SWITCH_PREFIX}cut)`);
|
|
756
|
+
} else if (sw.requiresSameSource && i > 0) {
|
|
757
|
+
const prev = safe.segments[i - 1];
|
|
758
|
+
const cur = resolveEdlSegmentSlots(safe, seg);
|
|
759
|
+
const before = isObject(prev) ? resolveEdlSegmentSlots(safe, prev) : [];
|
|
760
|
+
if (cur.length === 1 && before.length === 1 && cur[0].source !== before[0].source) {
|
|
761
|
+
warnings.push(`${at}: switch "${sw.id}" moves within ONE picture source, but the previous segment shows "${before[0].source}" and this one "${cur[0].source}"`);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
if (isObject(layout.emphasis) && !isKnownSpeakerEmphasisStyle(layout.emphasis.style)) {
|
|
766
|
+
const style = String(layout.emphasis.style);
|
|
767
|
+
const atoms = parseSpeakerEmphasisStyle(layout.emphasis.style);
|
|
768
|
+
warnings.push(atoms.length > 0 && atoms.every((a) => EMPHASIS_STYLE_SET.has(a)) ? `${at}: emphasis style "${style}" \u2014 "none" must stand alone and no style may repeat` : `${at}: unknown emphasis style "${style}" (a "+"-joined set of: ${SPEAKER_EMPHASIS_STYLES.join(", ")})`);
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
return warnings;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
// src/edl.ts
|
|
775
|
+
var EDL_VERSION = 1;
|
|
776
|
+
var EDL_SOURCE_ROLES = ["master-audio", "camera", "wide", "screen"];
|
|
777
|
+
var KNOWN_SOURCE_ROLES = new Set(EDL_SOURCE_ROLES);
|
|
778
|
+
var FOLLOW_MOTIONS = ["static", "glide"];
|
|
779
|
+
var KNOWN_FOLLOW_MOTIONS = new Set(FOLLOW_MOTIONS);
|
|
780
|
+
function transcriptDurationSec(transcript) {
|
|
781
|
+
if (!transcript || typeof transcript !== "object") return void 0;
|
|
782
|
+
const t = transcript;
|
|
783
|
+
let maxEndMs = 0;
|
|
784
|
+
const scan = (rows) => {
|
|
785
|
+
if (!Array.isArray(rows)) return;
|
|
786
|
+
for (const row of rows) {
|
|
787
|
+
const endMs = row?.endMs;
|
|
788
|
+
if (typeof endMs === "number" && Number.isFinite(endMs) && endMs > maxEndMs) {
|
|
789
|
+
maxEndMs = endMs;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
scan(t.words);
|
|
794
|
+
scan(t.segments);
|
|
795
|
+
return maxEndMs > 0 ? maxEndMs / 1e3 : void 0;
|
|
796
|
+
}
|
|
797
|
+
function segmentTransitionOverlaps(t) {
|
|
798
|
+
return !!t && t.type === "crossfade" && (t.durationMs ?? 0) > 0;
|
|
799
|
+
}
|
|
800
|
+
function layoutTransitionOverlaps(t) {
|
|
801
|
+
return !!t && speakerSwitchOverlaps(t.type) && (t.durationMs ?? 0) > 0;
|
|
802
|
+
}
|
|
803
|
+
function overlapMsInto(seg) {
|
|
804
|
+
if (segmentTransitionOverlaps(seg.transition)) return seg.transition.durationMs ?? 0;
|
|
805
|
+
if (layoutTransitionOverlaps(seg.layout?.transition)) return seg.layout.transition.durationMs ?? 0;
|
|
806
|
+
return 0;
|
|
807
|
+
}
|
|
808
|
+
function edlDurationMs(edl) {
|
|
809
|
+
const starts = segmentOutputStarts(edl);
|
|
810
|
+
if (starts.length === 0) return 0;
|
|
811
|
+
const last = edl.segments[edl.segments.length - 1];
|
|
812
|
+
return Math.max(0, Math.round(starts[starts.length - 1] + Math.max(0, last.outMs - last.inMs)));
|
|
813
|
+
}
|
|
814
|
+
function edlSegmentOutputStarts(edl) {
|
|
815
|
+
return segmentOutputStarts(edl);
|
|
816
|
+
}
|
|
817
|
+
function segmentOutputStarts(edl) {
|
|
818
|
+
const starts = [];
|
|
819
|
+
let cursor = 0;
|
|
820
|
+
edl.segments.forEach((seg, i) => {
|
|
821
|
+
if (i > 0) cursor -= overlapMsInto(seg);
|
|
822
|
+
starts.push(Math.max(0, Math.round(cursor)));
|
|
823
|
+
cursor += Math.max(0, seg.outMs - seg.inMs);
|
|
824
|
+
});
|
|
825
|
+
return starts;
|
|
826
|
+
}
|
|
827
|
+
var inRange = (v, lo = 0, hi = 1) => v >= lo && v <= hi;
|
|
828
|
+
function regionIssues(r, where) {
|
|
829
|
+
const out = [];
|
|
830
|
+
for (const [k, v] of Object.entries(r)) {
|
|
831
|
+
if (!Number.isFinite(v) || !inRange(v)) out.push(`${where}: region.${k}=${v} out of 0..1`);
|
|
832
|
+
}
|
|
833
|
+
if (r.w <= 0 || r.h <= 0) out.push(`${where}: region has non-positive w/h`);
|
|
834
|
+
if (r.x + r.w > 1 + 1e-9) out.push(`${where}: region extends past right edge (x+w>1)`);
|
|
835
|
+
if (r.y + r.h > 1 + 1e-9) out.push(`${where}: region extends past bottom edge (y+h>1)`);
|
|
836
|
+
return out;
|
|
837
|
+
}
|
|
838
|
+
function validateEdl(edl) {
|
|
839
|
+
const issues = [];
|
|
840
|
+
const warnings = [];
|
|
841
|
+
if (!Array.isArray(edl.segments) || !Array.isArray(edl.sources)) {
|
|
842
|
+
edl = {
|
|
843
|
+
...edl,
|
|
844
|
+
sources: Array.isArray(edl.sources) ? edl.sources : [],
|
|
845
|
+
segments: Array.isArray(edl.segments) ? edl.segments : []
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
if (edl.version !== EDL_VERSION) issues.push(`version must be ${EDL_VERSION}`);
|
|
849
|
+
if (edl.clock !== "master" && edl.clock !== "output") issues.push(`clock must be "master" or "output"`);
|
|
850
|
+
const sourceIds = /* @__PURE__ */ new Set();
|
|
851
|
+
let masterAudioCount = 0;
|
|
852
|
+
for (const s of edl.sources) {
|
|
853
|
+
if (sourceIds.has(s.id)) issues.push(`duplicate source id "${s.id}"`);
|
|
854
|
+
sourceIds.add(s.id);
|
|
855
|
+
if (!s.url || !s.url.trim()) issues.push(`source "${s.id}": url is empty (media resolves from url)`);
|
|
856
|
+
if (s.role === "master-audio") masterAudioCount++;
|
|
857
|
+
else if (s.role != null && !KNOWN_SOURCE_ROLES.has(s.role)) {
|
|
858
|
+
warnings.push(`source "${s.id}": unknown role "${s.role}" (known: ${EDL_SOURCE_ROLES.join(", ")})`);
|
|
859
|
+
}
|
|
860
|
+
if (s.region) issues.push(...regionIssues(s.region, `source "${s.id}"`));
|
|
861
|
+
if (s.offsetMs !== void 0 && !Number.isFinite(s.offsetMs)) issues.push(`source "${s.id}": offsetMs not finite`);
|
|
862
|
+
}
|
|
863
|
+
if (masterAudioCount > 1) issues.push(`more than one source has role:"master-audio" (${masterAudioCount})`);
|
|
864
|
+
if (edl.segments.length === 0) issues.push("segments is empty");
|
|
865
|
+
edl.segments.forEach((seg, i) => {
|
|
866
|
+
const at = `segment[${i}] "${seg.id}"`;
|
|
867
|
+
if (!(seg.outMs > seg.inMs)) issues.push(`${at}: outMs (${seg.outMs}) must be > inMs (${seg.inMs})`);
|
|
868
|
+
if (seg.inMs < 0) issues.push(`${at}: inMs negative`);
|
|
869
|
+
if (seg.video && !sourceIds.has(seg.video)) issues.push(`${at}: video source "${seg.video}" not in sources`);
|
|
870
|
+
else if (seg.video) {
|
|
871
|
+
const vs = edl.sources.find((s) => s.id === seg.video);
|
|
872
|
+
if (vs && vs.kind !== "video") issues.push(`${at}: video source "${seg.video}" is kind:"${vs.kind}", must be video`);
|
|
873
|
+
}
|
|
874
|
+
if (seg.audio && !sourceIds.has(seg.audio)) issues.push(`${at}: audio source "${seg.audio}" not in sources`);
|
|
875
|
+
if (!seg.audio && masterAudioCount === 0 && !seg.video) {
|
|
876
|
+
issues.push(`${at}: no audio source and no master-audio/video fallback`);
|
|
877
|
+
}
|
|
878
|
+
if (i === 0 && (seg.transition || seg.layout?.transition)) {
|
|
879
|
+
issues.push(`${at}: segments[0] cannot have a transition ("into this segment" has no predecessor)`);
|
|
880
|
+
}
|
|
881
|
+
if (seg.transition && seg.layout?.transition) {
|
|
882
|
+
issues.push(`${at}: both EdlSegment.transition and EdlLayout.transition set (pick one)`);
|
|
883
|
+
}
|
|
884
|
+
const ov = overlapMsInto(seg);
|
|
885
|
+
if (ov > 0 && i > 0) {
|
|
886
|
+
const prev = edl.segments[i - 1];
|
|
887
|
+
const minAdj = Math.min(seg.outMs - seg.inMs, prev.outMs - prev.inMs);
|
|
888
|
+
if (ov > 0.9 * minAdj + 1e-9) {
|
|
889
|
+
issues.push(`${at}: overlap transition durationMs (${ov}) exceeds 0.9\xB7min(adjacent segment)=${(0.9 * minAdj).toFixed(1)} \u2014 ffmpeg xfade would error / be clamped`);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
if (seg.region) {
|
|
893
|
+
issues.push(...regionIssues(seg.region, at));
|
|
894
|
+
if (seg.layout?.slots && seg.layout.slots.length > 1) {
|
|
895
|
+
issues.push(`${at}: segment.region is invalid when the layout has >1 slot (put the region on the slot)`);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
for (const slot of seg.layout?.slots ?? []) {
|
|
899
|
+
if (!sourceIds.has(slot.source)) issues.push(`${at}: slot source "${slot.source}" not in sources`);
|
|
900
|
+
else {
|
|
901
|
+
const src = edl.sources.find((s) => s.id === slot.source);
|
|
902
|
+
if (src && src.kind !== "video") issues.push(`${at}: slot source "${slot.source}" is kind:"${src.kind}", slots must be video`);
|
|
903
|
+
}
|
|
904
|
+
if (slot.weight !== void 0 && !inRange(slot.weight)) issues.push(`${at}: slot.weight=${slot.weight} out of 0..1`);
|
|
905
|
+
if (slot.region) issues.push(...regionIssues(slot.region, `${at} slot "${slot.source}"`));
|
|
906
|
+
if (slot.follow) issues.push(...followIssues(slot.follow, slot.source, `${at} slot "${slot.source}"`));
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
for (const d of edl.dropped ?? []) {
|
|
910
|
+
if (!(d.outMs > d.inMs)) issues.push(`dropped range [${d.inMs},${d.outMs}) is not positive`);
|
|
911
|
+
for (const seg of edl.segments) {
|
|
912
|
+
if (seg.inMs < d.outMs && d.inMs < seg.outMs) {
|
|
913
|
+
issues.push(`dropped range [${d.inMs},${d.outMs}) overlaps kept segment "${seg.id}" [${seg.inMs},${seg.outMs})`);
|
|
914
|
+
break;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
warnings.push(...speakerPresentationWarnings(edl));
|
|
919
|
+
return { ok: issues.length === 0, issues, warnings };
|
|
920
|
+
}
|
|
921
|
+
function validateEdlClipSet(set) {
|
|
922
|
+
const issues = [];
|
|
923
|
+
const warnings = [];
|
|
924
|
+
if (set.version !== EDL_VERSION) issues.push(`clipset version must be ${EDL_VERSION}`);
|
|
925
|
+
if (set.clips.length === 0) issues.push("clipset has no clips");
|
|
926
|
+
set.clips.forEach((clip, i) => {
|
|
927
|
+
const r = validateEdl(clip);
|
|
928
|
+
if (!r.ok) issues.push(...r.issues.map((m) => `clip[${i}]: ${m}`));
|
|
929
|
+
warnings.push(...r.warnings.map((m) => `clip[${i}]: ${m}`));
|
|
930
|
+
});
|
|
931
|
+
return { ok: issues.length === 0, issues, warnings };
|
|
932
|
+
}
|
|
933
|
+
function offsetFor(edl, sourceId) {
|
|
934
|
+
if (!sourceId) return 0;
|
|
935
|
+
return edl.sources.find((s) => s.id === sourceId)?.offsetMs ?? 0;
|
|
936
|
+
}
|
|
937
|
+
function remapMsThroughEdl(edl, sourceMs, sourceId) {
|
|
938
|
+
const masterMs = sourceMs + offsetFor(edl, sourceId);
|
|
939
|
+
const starts = segmentOutputStarts(edl);
|
|
940
|
+
for (let i = 0; i < edl.segments.length; i++) {
|
|
941
|
+
const seg = edl.segments[i];
|
|
942
|
+
if (masterMs >= seg.inMs && masterMs < seg.outMs) {
|
|
943
|
+
return Math.round(starts[i] + (masterMs - seg.inMs));
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
return null;
|
|
947
|
+
}
|
|
948
|
+
function outputMsToMasterMs(edl, outputMs) {
|
|
949
|
+
if (!Number.isFinite(outputMs) || outputMs < 0) return null;
|
|
950
|
+
const starts = segmentOutputStarts(edl);
|
|
951
|
+
for (let i = edl.segments.length - 1; i >= 0; i--) {
|
|
952
|
+
const seg = edl.segments[i];
|
|
953
|
+
const dur = Math.max(0, seg.outMs - seg.inMs);
|
|
954
|
+
if (outputMs >= starts[i] && outputMs < starts[i] + dur) return Math.round(seg.inMs + (outputMs - starts[i]));
|
|
955
|
+
}
|
|
956
|
+
return null;
|
|
957
|
+
}
|
|
958
|
+
function remapTranscriptThroughEdl(edl, transcript) {
|
|
959
|
+
const off = offsetFor(edl, transcript.sourceId);
|
|
960
|
+
const starts = segmentOutputStarts(edl);
|
|
961
|
+
const touches = (j) => {
|
|
962
|
+
const a = edl.segments[j];
|
|
963
|
+
const b = edl.segments[j + 1];
|
|
964
|
+
return b.inMs === a.outMs && starts[j + 1] === starts[j] + Math.max(0, a.outMs - a.inMs);
|
|
965
|
+
};
|
|
966
|
+
const mapWord = (w) => {
|
|
967
|
+
const startMaster = w.startMs + off;
|
|
968
|
+
const endMaster = w.endMs + off;
|
|
969
|
+
if (startMaster === endMaster) {
|
|
970
|
+
for (let i = 0; i < edl.segments.length; i++) {
|
|
971
|
+
const seg = edl.segments[i];
|
|
972
|
+
if (startMaster >= seg.inMs && startMaster < seg.outMs) {
|
|
973
|
+
const out = Math.round(starts[i] + (startMaster - seg.inMs));
|
|
974
|
+
return { ...w, startMs: out, endMs: out };
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
return null;
|
|
978
|
+
}
|
|
979
|
+
for (let i = 0; i < edl.segments.length; i++) {
|
|
980
|
+
const seg = edl.segments[i];
|
|
981
|
+
const lo = Math.max(startMaster, seg.inMs);
|
|
982
|
+
let hi = Math.min(endMaster, seg.outMs);
|
|
983
|
+
if (lo < hi) {
|
|
984
|
+
for (let j = i; hi < endMaster && j + 1 < edl.segments.length && touches(j); j++) {
|
|
985
|
+
hi = Math.min(endMaster, edl.segments[j + 1].outMs);
|
|
986
|
+
}
|
|
987
|
+
return {
|
|
988
|
+
...w,
|
|
989
|
+
startMs: Math.round(starts[i] + (lo - seg.inMs)),
|
|
990
|
+
endMs: Math.round(starts[i] + (hi - seg.inMs))
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
return null;
|
|
995
|
+
};
|
|
996
|
+
const words = [];
|
|
997
|
+
for (const w of transcript.words) {
|
|
998
|
+
const mapped = mapWord(w);
|
|
999
|
+
if (mapped) words.push(mapped);
|
|
1000
|
+
}
|
|
1001
|
+
const mapSegment = (s) => {
|
|
1002
|
+
const startMaster = s.startMs + off;
|
|
1003
|
+
const endMaster = s.endMs + off;
|
|
1004
|
+
let outLo = null;
|
|
1005
|
+
let outHi = null;
|
|
1006
|
+
for (let i = 0; i < edl.segments.length; i++) {
|
|
1007
|
+
const seg = edl.segments[i];
|
|
1008
|
+
const lo = Math.max(startMaster, seg.inMs);
|
|
1009
|
+
const hi = Math.min(endMaster, seg.outMs);
|
|
1010
|
+
if (lo < hi) {
|
|
1011
|
+
const a = Math.round(starts[i] + (lo - seg.inMs));
|
|
1012
|
+
const b = Math.round(starts[i] + (hi - seg.inMs));
|
|
1013
|
+
if (outLo === null || a < outLo) outLo = a;
|
|
1014
|
+
if (outHi === null || b > outHi) outHi = b;
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
if (outLo === null || outHi === null) return null;
|
|
1018
|
+
return { ...s, startMs: outLo, endMs: outHi };
|
|
1019
|
+
};
|
|
1020
|
+
const segments = transcript.segments?.map(mapSegment).filter((s) => s !== null);
|
|
1021
|
+
return { ...transcript, words, ...segments ? { segments } : {} };
|
|
1022
|
+
}
|
|
1023
|
+
function speakerTurns(transcript, opts) {
|
|
1024
|
+
const turns = [];
|
|
1025
|
+
for (const w of transcript.words) {
|
|
1026
|
+
const speaker = w.speaker ?? "spk";
|
|
1027
|
+
const last = turns[turns.length - 1];
|
|
1028
|
+
if (last && last.speaker === speaker && w.startMs - last.endMs <= opts.mergeGapMs) {
|
|
1029
|
+
last.endMs = Math.max(last.endMs, w.endMs);
|
|
1030
|
+
} else {
|
|
1031
|
+
turns.push({ speaker, startMs: w.startMs, endMs: w.endMs });
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
return turns.filter((t) => t.endMs - t.startMs >= opts.minTurnMs);
|
|
1035
|
+
}
|
|
1036
|
+
var num = (v, fallback = 0) => typeof v === "number" && Number.isFinite(v) ? v : fallback;
|
|
1037
|
+
var clamp01 = (v) => Math.min(1, Math.max(0, v));
|
|
1038
|
+
var str = (v) => typeof v === "string" ? v : void 0;
|
|
1039
|
+
function normalizeRegion(r) {
|
|
1040
|
+
if (!r || typeof r !== "object") return void 0;
|
|
1041
|
+
const o = r;
|
|
1042
|
+
if (["x", "y", "w", "h"].some((k) => typeof o[k] !== "number")) return void 0;
|
|
1043
|
+
const x = clamp01(num(o.x));
|
|
1044
|
+
const y = clamp01(num(o.y));
|
|
1045
|
+
const w = Math.min(clamp01(num(o.w)), 1 - x);
|
|
1046
|
+
const h = Math.min(clamp01(num(o.h)), 1 - y);
|
|
1047
|
+
if (w <= 0 || h <= 0) return void 0;
|
|
1048
|
+
return { x, y, w, h };
|
|
1049
|
+
}
|
|
1050
|
+
function normalizeEdl(input) {
|
|
1051
|
+
const o = input && typeof input === "object" ? input : {};
|
|
1052
|
+
const sources = Array.isArray(o.sources) ? o.sources.map((raw, i) => {
|
|
1053
|
+
const s = raw ?? {};
|
|
1054
|
+
const src = {
|
|
1055
|
+
id: str(s.id) ?? `src-${i}`,
|
|
1056
|
+
url: str(s.url) ?? "",
|
|
1057
|
+
kind: s.kind === "audio" ? "audio" : "video",
|
|
1058
|
+
...s.offsetMs !== void 0 ? { offsetMs: Math.round(num(s.offsetMs)) } : {},
|
|
1059
|
+
...str(s.role) ? { role: s.role } : {},
|
|
1060
|
+
...Array.isArray(s.speakers) ? { speakers: s.speakers.filter((x) => typeof x === "string") } : {},
|
|
1061
|
+
...normalizeRegion(s.region) ? { region: normalizeRegion(s.region) } : {}
|
|
1062
|
+
};
|
|
1063
|
+
return src;
|
|
1064
|
+
}) : [];
|
|
1065
|
+
const segments = Array.isArray(o.segments) ? o.segments.map((raw, i) => {
|
|
1066
|
+
const s = raw ?? {};
|
|
1067
|
+
const region = normalizeRegion(s.region);
|
|
1068
|
+
const isFirst = i === 0;
|
|
1069
|
+
const t = isFirst ? void 0 : s.transition;
|
|
1070
|
+
const layout = normalizeLayout(s.layout, isFirst);
|
|
1071
|
+
const seg = {
|
|
1072
|
+
id: str(s.id) ?? `seg-${i}`,
|
|
1073
|
+
inMs: Math.round(num(s.inMs)),
|
|
1074
|
+
outMs: Math.round(num(s.outMs)),
|
|
1075
|
+
...str(s.video) ? { video: str(s.video) } : {},
|
|
1076
|
+
...str(s.audio) ? { audio: str(s.audio) } : {},
|
|
1077
|
+
...str(s.speaker) ? { speaker: str(s.speaker) } : {},
|
|
1078
|
+
...t && (t.type === "cut" || t.type === "crossfade") ? { transition: { type: t.type, durationMs: t.type === "cut" ? 0 : Math.round(num(t.durationMs)) } } : {},
|
|
1079
|
+
...region ? { region } : {},
|
|
1080
|
+
...layout ? { layout } : {},
|
|
1081
|
+
...Array.isArray(s.labels) ? { labels: s.labels.filter((x) => typeof x === "string") } : {}
|
|
1082
|
+
};
|
|
1083
|
+
return seg;
|
|
1084
|
+
}) : [];
|
|
1085
|
+
const dropped = Array.isArray(o.dropped) ? o.dropped.map((raw) => {
|
|
1086
|
+
const d = raw ?? {};
|
|
1087
|
+
return { inMs: Math.round(num(d.inMs)), outMs: Math.round(num(d.outMs)), reason: str(d.reason) ?? "manual" };
|
|
1088
|
+
}) : void 0;
|
|
1089
|
+
const meta = o.meta && typeof o.meta === "object" ? o.meta : void 0;
|
|
1090
|
+
return {
|
|
1091
|
+
version: EDL_VERSION,
|
|
1092
|
+
clock: o.clock === "output" ? "output" : "master",
|
|
1093
|
+
sources,
|
|
1094
|
+
segments,
|
|
1095
|
+
...dropped ? { dropped } : {},
|
|
1096
|
+
...o.derivedFrom && typeof o.derivedFrom === "object" ? { derivedFrom: { edlId: str(o.derivedFrom.edlId) ?? "", clock: "output" } } : {},
|
|
1097
|
+
...meta ? { meta } : {}
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
function followIssues(follow, slotSource, at) {
|
|
1101
|
+
const f = follow;
|
|
1102
|
+
const issues = [];
|
|
1103
|
+
if (f.sourceId !== slotSource) issues.push(`${at}: follow.sourceId ${JSON.stringify(f.sourceId)} is not the slot's source "${slotSource}"`);
|
|
1104
|
+
if (typeof f.trackId !== "string" || !f.trackId.trim()) issues.push(`${at}: follow.trackId is empty`);
|
|
1105
|
+
if (typeof f.motion !== "string" || !KNOWN_FOLLOW_MOTIONS.has(f.motion)) {
|
|
1106
|
+
issues.push(`${at}: follow.motion ${JSON.stringify(f.motion)} is not one of ${FOLLOW_MOTIONS.join(", ")}`);
|
|
1107
|
+
}
|
|
1108
|
+
return issues;
|
|
1109
|
+
}
|
|
1110
|
+
function normalizeFollow(input) {
|
|
1111
|
+
if (!input || typeof input !== "object") return void 0;
|
|
1112
|
+
const o = input;
|
|
1113
|
+
const sourceId = str(o.sourceId);
|
|
1114
|
+
const trackId = str(o.trackId);
|
|
1115
|
+
if (!sourceId || !trackId || typeof o.motion !== "string" || !KNOWN_FOLLOW_MOTIONS.has(o.motion)) return void 0;
|
|
1116
|
+
return { sourceId, trackId, motion: o.motion };
|
|
1117
|
+
}
|
|
1118
|
+
function normalizeLayout(input, dropTransition = false) {
|
|
1119
|
+
if (!input || typeof input !== "object") return void 0;
|
|
1120
|
+
const o = input;
|
|
1121
|
+
const mode = str(o.mode) || "single";
|
|
1122
|
+
const slots = Array.isArray(o.slots) ? o.slots.map((raw) => {
|
|
1123
|
+
const s = raw ?? {};
|
|
1124
|
+
const source = str(s.source);
|
|
1125
|
+
if (!source) return null;
|
|
1126
|
+
const region = normalizeRegion(s.region);
|
|
1127
|
+
const follow = normalizeFollow(s.follow);
|
|
1128
|
+
return {
|
|
1129
|
+
source,
|
|
1130
|
+
...region ? { region } : {},
|
|
1131
|
+
...str(s.speaker) ? { speaker: str(s.speaker) } : {},
|
|
1132
|
+
...s.weight !== void 0 ? { weight: clamp01(num(s.weight)) } : {},
|
|
1133
|
+
...follow ? { follow } : {}
|
|
1134
|
+
};
|
|
1135
|
+
}).filter((x) => x !== null) : void 0;
|
|
1136
|
+
const emphasis = o.emphasis && typeof o.emphasis === "object" ? { style: str(o.emphasis.style) ?? "none", durationMs: Math.round(num(o.emphasis.durationMs)) } : void 0;
|
|
1137
|
+
const transition = !dropTransition && o.transition && typeof o.transition === "object" ? { type: str(o.transition.type) ?? "cut", durationMs: Math.round(num(o.transition.durationMs)) } : void 0;
|
|
1138
|
+
return {
|
|
1139
|
+
mode,
|
|
1140
|
+
...slots ? { slots } : {},
|
|
1141
|
+
...emphasis ? { emphasis } : {},
|
|
1142
|
+
...transition ? { transition } : {}
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
function timeMs(v) {
|
|
1146
|
+
const n = typeof v === "number" ? v : typeof v === "string" && v.trim() !== "" ? Number(v) : Number.NaN;
|
|
1147
|
+
return Number.isFinite(n) && n >= 0 ? Math.round(n) : void 0;
|
|
1148
|
+
}
|
|
1149
|
+
function spanMs(o) {
|
|
1150
|
+
const startMs = timeMs(o.startMs ?? o.start);
|
|
1151
|
+
const endMs = timeMs(o.endMs ?? o.end);
|
|
1152
|
+
if (startMs === void 0 || endMs === void 0 || endMs < startMs) return void 0;
|
|
1153
|
+
return { startMs, endMs };
|
|
1154
|
+
}
|
|
1155
|
+
function normalizeTranscript(input) {
|
|
1156
|
+
const o = input && typeof input === "object" ? input : {};
|
|
1157
|
+
const words = [];
|
|
1158
|
+
if (Array.isArray(o.words)) {
|
|
1159
|
+
for (const raw of o.words) {
|
|
1160
|
+
if (!raw || typeof raw !== "object") continue;
|
|
1161
|
+
const w = raw;
|
|
1162
|
+
const span = spanMs(w);
|
|
1163
|
+
if (!span) continue;
|
|
1164
|
+
words.push({
|
|
1165
|
+
text: str(w.text) ?? "",
|
|
1166
|
+
...span,
|
|
1167
|
+
...str(w.speaker) ? { speaker: str(w.speaker) } : {},
|
|
1168
|
+
...typeof w.confidence === "number" ? { confidence: w.confidence } : {}
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
words.sort((a, b) => a.startMs - b.startMs);
|
|
1172
|
+
}
|
|
1173
|
+
const segments = Array.isArray(o.segments) ? o.segments.flatMap((raw) => {
|
|
1174
|
+
if (!raw || typeof raw !== "object") return [];
|
|
1175
|
+
const s = raw;
|
|
1176
|
+
const span = spanMs(s);
|
|
1177
|
+
return span ? [{ ...span, text: str(s.text) ?? "", ...str(s.speaker) ? { speaker: str(s.speaker) } : {} }] : [];
|
|
1178
|
+
}) : void 0;
|
|
1179
|
+
const speakerNames = speakerNamesOf(o.speakerNames);
|
|
1180
|
+
return {
|
|
1181
|
+
version: EDL_VERSION,
|
|
1182
|
+
...str(o.sourceId) ? { sourceId: str(o.sourceId) } : {},
|
|
1183
|
+
...str(o.language) ? { language: str(o.language) } : {},
|
|
1184
|
+
words,
|
|
1185
|
+
...segments ? { segments } : {},
|
|
1186
|
+
...speakerNames ? { speakerNames } : {}
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
function speakerNamesOf(v) {
|
|
1190
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return void 0;
|
|
1191
|
+
const entries = Object.entries(v).filter(
|
|
1192
|
+
(e) => e[0].length > 0 && typeof e[1] === "string" && e[1].length > 0
|
|
1193
|
+
);
|
|
1194
|
+
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
// src/edit-plan-review.ts
|
|
1198
|
+
var EDITED_EDL_VERSION = 1;
|
|
1199
|
+
function canonicalJson(value) {
|
|
1200
|
+
if (value === null) return "null";
|
|
1201
|
+
switch (typeof value) {
|
|
1202
|
+
case "string":
|
|
1203
|
+
case "boolean":
|
|
1204
|
+
return JSON.stringify(value);
|
|
1205
|
+
case "number":
|
|
1206
|
+
return Number.isFinite(value) ? JSON.stringify(value) : "null";
|
|
1207
|
+
case "object": {
|
|
1208
|
+
const toJSON = value.toJSON;
|
|
1209
|
+
if (typeof toJSON === "function") return canonicalJson(value.toJSON());
|
|
1210
|
+
if (Array.isArray(value)) return `[${value.map((item) => canonicalJson(item) ?? "null").join(",")}]`;
|
|
1211
|
+
const parts = [];
|
|
1212
|
+
for (const key of Object.keys(value).sort()) {
|
|
1213
|
+
const text = canonicalJson(value[key]);
|
|
1214
|
+
if (text !== void 0) parts.push(`${JSON.stringify(key)}:${text}`);
|
|
1215
|
+
}
|
|
1216
|
+
return `{${parts.join(",")}}`;
|
|
1217
|
+
}
|
|
1218
|
+
default:
|
|
1219
|
+
return void 0;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
function fnv1a64(text) {
|
|
1223
|
+
let hi = 3421674724;
|
|
1224
|
+
let lo = 2216829733;
|
|
1225
|
+
const mix = (byte) => {
|
|
1226
|
+
lo = (lo ^ byte) >>> 0;
|
|
1227
|
+
const loProduct = lo * 435;
|
|
1228
|
+
const carry = Math.floor(loProduct / 4294967296);
|
|
1229
|
+
hi = hi * 435 + carry + (lo << 8 >>> 0) >>> 0;
|
|
1230
|
+
lo = loProduct >>> 0;
|
|
1231
|
+
};
|
|
1232
|
+
for (let i = 0; i < text.length; i++) {
|
|
1233
|
+
let code = text.charCodeAt(i);
|
|
1234
|
+
if (code >= 55296 && code <= 56319) {
|
|
1235
|
+
const next = i + 1 < text.length ? text.charCodeAt(i + 1) : 0;
|
|
1236
|
+
if (next >= 56320 && next <= 57343) {
|
|
1237
|
+
code = 65536 + (code - 55296 << 10) + (next - 56320);
|
|
1238
|
+
i++;
|
|
1239
|
+
} else code = 65533;
|
|
1240
|
+
} else if (code >= 56320 && code <= 57343) code = 65533;
|
|
1241
|
+
if (code < 128) mix(code);
|
|
1242
|
+
else if (code < 2048) {
|
|
1243
|
+
mix(192 | code >> 6);
|
|
1244
|
+
mix(128 | code & 63);
|
|
1245
|
+
} else if (code < 65536) {
|
|
1246
|
+
mix(224 | code >> 12);
|
|
1247
|
+
mix(128 | code >> 6 & 63);
|
|
1248
|
+
mix(128 | code & 63);
|
|
1249
|
+
} else {
|
|
1250
|
+
mix(240 | code >> 18);
|
|
1251
|
+
mix(128 | code >> 12 & 63);
|
|
1252
|
+
mix(128 | code >> 6 & 63);
|
|
1253
|
+
mix(128 | code & 63);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
return hi.toString(16).padStart(8, "0") + lo.toString(16).padStart(8, "0");
|
|
1257
|
+
}
|
|
1258
|
+
var basisByPlan = /* @__PURE__ */ new WeakMap();
|
|
1259
|
+
function editPlanBasis(plan) {
|
|
1260
|
+
if (typeof plan !== "object" || plan === null) return fnv1a64(canonicalJson(plan) ?? "");
|
|
1261
|
+
const cached = basisByPlan.get(plan);
|
|
1262
|
+
if (cached !== void 0) return cached;
|
|
1263
|
+
const basis = fnv1a64(canonicalJson(plan) ?? "");
|
|
1264
|
+
basisByPlan.set(plan, basis);
|
|
1265
|
+
return basis;
|
|
1266
|
+
}
|
|
1267
|
+
var isRecord = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
1268
|
+
function planShape(plan) {
|
|
1269
|
+
if (Array.isArray(plan)) return "clips";
|
|
1270
|
+
if (isRecord(plan) && Array.isArray(plan.segments)) return "edl";
|
|
1271
|
+
return "other";
|
|
1272
|
+
}
|
|
1273
|
+
function checkEnvelope(edited, plan) {
|
|
1274
|
+
if (edited === void 0 || edited === null) return { status: "none" };
|
|
1275
|
+
if (!isRecord(edited)) return { status: "invalid", issue: "editedEdl must be an object" };
|
|
1276
|
+
if (edited.v !== EDITED_EDL_VERSION) return { status: "invalid", issue: `editedEdl.v must be ${EDITED_EDL_VERSION}` };
|
|
1277
|
+
if (typeof edited.basis !== "string" || edited.basis.length === 0) {
|
|
1278
|
+
return { status: "invalid", issue: "editedEdl.basis must be a non-empty string" };
|
|
1279
|
+
}
|
|
1280
|
+
if (edited.kind !== "edl" && edited.kind !== "clips") {
|
|
1281
|
+
return { status: "invalid", issue: `editedEdl.kind must be "edl" or "clips"` };
|
|
1282
|
+
}
|
|
1283
|
+
if (edited.basis !== editPlanBasis(plan)) {
|
|
1284
|
+
return { status: "stale", issue: "editedEdl.basis does not match the plan: the plan changed since this edit was made" };
|
|
1285
|
+
}
|
|
1286
|
+
const shape = planShape(plan);
|
|
1287
|
+
if (edited.kind === "edl") {
|
|
1288
|
+
if (shape !== "edl") return { status: "invalid", issue: `an "edl" edit needs a Tighten plan (one EDL); this plan is ${describeShape(shape)}` };
|
|
1289
|
+
const edl = edited.edl;
|
|
1290
|
+
if (!isRecord(edl) || !Array.isArray(edl.segments) || !Array.isArray(edl.dropped)) {
|
|
1291
|
+
return { status: "invalid", issue: "editedEdl.edl must hold a segments array and a dropped array" };
|
|
1292
|
+
}
|
|
1293
|
+
} else if (edited.kind === "clips") {
|
|
1294
|
+
if (shape !== "clips") return { status: "invalid", issue: `a "clips" edit needs a clip set; this plan is ${describeShape(shape)}` };
|
|
1295
|
+
const clips = edited.clips;
|
|
1296
|
+
if (!Array.isArray(clips)) return { status: "invalid", issue: "editedEdl.clips must be an array" };
|
|
1297
|
+
const planned = plan.length;
|
|
1298
|
+
if (clips.length !== planned) {
|
|
1299
|
+
return { status: "invalid", issue: `editedEdl.clips holds ${clips.length} decisions; the plan has ${planned} clips` };
|
|
1300
|
+
}
|
|
1301
|
+
const bad = clips.findIndex(
|
|
1302
|
+
(c) => !isRecord(c) || typeof c.keep !== "boolean" || c.hook !== void 0 && typeof c.hook !== "string"
|
|
1303
|
+
);
|
|
1304
|
+
if (bad >= 0) return { status: "invalid", issue: `editedEdl.clips[${bad}] must be {keep: boolean, hook?: string}` };
|
|
1305
|
+
}
|
|
1306
|
+
return { status: "applied", edited };
|
|
1307
|
+
}
|
|
1308
|
+
function describeShape(shape) {
|
|
1309
|
+
return shape === "edl" ? "a Tighten plan" : shape === "clips" ? "a clip set" : "neither (a chapter list, or no plan)";
|
|
1310
|
+
}
|
|
1311
|
+
function plannedList(plan) {
|
|
1312
|
+
return plan.map((clip) => typeof clip === "string" ? clip : JSON.stringify(clip));
|
|
1313
|
+
}
|
|
1314
|
+
function asOutput(plan) {
|
|
1315
|
+
return Array.isArray(plan) ? { json: plan, listResults: plannedList(plan) } : { json: plan };
|
|
1316
|
+
}
|
|
1317
|
+
function withHook(clip, hook) {
|
|
1318
|
+
if (hook === void 0) return clip;
|
|
1319
|
+
let value = clip;
|
|
1320
|
+
if (typeof clip === "string") {
|
|
1321
|
+
try {
|
|
1322
|
+
value = JSON.parse(clip);
|
|
1323
|
+
} catch {
|
|
1324
|
+
return clip;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
if (!isRecord(value)) return clip;
|
|
1328
|
+
const meta = isRecord(value.meta) ? value.meta : {};
|
|
1329
|
+
return { ...value, meta: { ...meta, hook } };
|
|
1330
|
+
}
|
|
1331
|
+
function resolveEditPlanOutput(plan, editedEdl) {
|
|
1332
|
+
const check = checkEnvelope(editedEdl, plan);
|
|
1333
|
+
if (check.status !== "applied") return { status: check.status, ...asOutput(plan) };
|
|
1334
|
+
const edited = check.edited;
|
|
1335
|
+
if (edited.kind === "edl") {
|
|
1336
|
+
const json = { ...plan, segments: edited.edl.segments, dropped: edited.edl.dropped };
|
|
1337
|
+
return { status: "applied", json };
|
|
1338
|
+
}
|
|
1339
|
+
const rows = plan.map((clip, i) => {
|
|
1340
|
+
const decision = edited.clips[i];
|
|
1341
|
+
return decision.keep ? withHook(clip, decision.hook) : void 0;
|
|
1342
|
+
});
|
|
1343
|
+
return {
|
|
1344
|
+
status: "applied",
|
|
1345
|
+
json: rows.filter((clip) => clip !== void 0),
|
|
1346
|
+
listResults: rows.map((clip) => clip === void 0 ? "" : typeof clip === "string" ? clip : JSON.stringify(clip))
|
|
1347
|
+
};
|
|
1348
|
+
}
|
|
1349
|
+
function editPlanSavedOutput(data) {
|
|
1350
|
+
const plan = data.generatedJson;
|
|
1351
|
+
if (plan === void 0) return void 0;
|
|
1352
|
+
const { status: _status, ...output } = resolveEditPlanOutput(plan, data.editedEdl);
|
|
1353
|
+
return output;
|
|
1354
|
+
}
|
|
1355
|
+
function editPlanResultPatch(plan, editedEdl) {
|
|
1356
|
+
const basis = isRecord(editedEdl) ? editedEdl.basis : void 0;
|
|
1357
|
+
const madeOnThisPlan = typeof basis === "string" && basis.length > 0 && basis === editPlanBasis(plan);
|
|
1358
|
+
return madeOnThisPlan ? { generatedJson: plan } : { generatedJson: plan, editedEdl: void 0 };
|
|
1359
|
+
}
|
|
1360
|
+
function validateEditedEdl(editedEdl, plan) {
|
|
1361
|
+
const check = checkEnvelope(editedEdl, plan);
|
|
1362
|
+
if (check.status === "none") return { ok: false, issues: ["there is no edit"], warnings: [] };
|
|
1363
|
+
if (check.status !== "applied") return { ok: false, issues: [check.issue], warnings: [] };
|
|
1364
|
+
if (check.edited.kind === "clips") return { ok: true, issues: [], warnings: [] };
|
|
1365
|
+
const resolved = resolveEditPlanOutput(plan, editedEdl).json;
|
|
1366
|
+
return validateEdl(resolved);
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
exports.AUDIO_SYNC_MIN_CONFIDENCE = AUDIO_SYNC_MIN_CONFIDENCE;
|
|
1370
|
+
exports.COMBINE_TRANSITIONS = COMBINE_TRANSITIONS;
|
|
1371
|
+
exports.COMBINE_TRANSITION_GROUP_LABELS = COMBINE_TRANSITION_GROUP_LABELS;
|
|
1372
|
+
exports.COMBINE_TRANSITION_GROUP_ORDER = COMBINE_TRANSITION_GROUP_ORDER;
|
|
1373
|
+
exports.COMBINE_TRANSITION_IDS = COMBINE_TRANSITION_IDS;
|
|
1374
|
+
exports.EDITED_EDL_VERSION = EDITED_EDL_VERSION;
|
|
1375
|
+
exports.EDL_FULL_FRAME = EDL_FULL_FRAME;
|
|
1376
|
+
exports.EDL_SOURCE_ROLES = EDL_SOURCE_ROLES;
|
|
1377
|
+
exports.EDL_TARGET_ASPECTS = EDL_TARGET_ASPECTS;
|
|
1378
|
+
exports.EDL_VERSION = EDL_VERSION;
|
|
1379
|
+
exports.PICKER_TO_COMBINE_TRANSITION = PICKER_TO_COMBINE_TRANSITION;
|
|
1380
|
+
exports.SPEAKER_EMPHASIS_STYLES = SPEAKER_EMPHASIS_STYLES;
|
|
1381
|
+
exports.SPEAKER_LAYOUTS = SPEAKER_LAYOUTS;
|
|
1382
|
+
exports.SPEAKER_LAYOUT_IDS = SPEAKER_LAYOUT_IDS;
|
|
1383
|
+
exports.SPEAKER_SWITCHES = SPEAKER_SWITCHES;
|
|
1384
|
+
exports.SPEAKER_SWITCH_IDS = SPEAKER_SWITCH_IDS;
|
|
1385
|
+
exports.applyAudioSyncOffsets = applyAudioSyncOffsets;
|
|
1386
|
+
exports.describeAudioSyncOffsetIssue = describeAudioSyncOffsetIssue;
|
|
1387
|
+
exports.editPlanBasis = editPlanBasis;
|
|
1388
|
+
exports.editPlanResultPatch = editPlanResultPatch;
|
|
1389
|
+
exports.editPlanSavedOutput = editPlanSavedOutput;
|
|
1390
|
+
exports.editPlanTranscriptOrigin = editPlanTranscriptOrigin;
|
|
1391
|
+
exports.edlDurationMs = edlDurationMs;
|
|
1392
|
+
exports.edlSegmentOutputStarts = edlSegmentOutputStarts;
|
|
1393
|
+
exports.getCombineTransition = getCombineTransition;
|
|
1394
|
+
exports.getSpeakerLayout = getSpeakerLayout;
|
|
1395
|
+
exports.getSpeakerSwitch = getSpeakerSwitch;
|
|
1396
|
+
exports.isEdlTargetAspect = isEdlTargetAspect;
|
|
1397
|
+
exports.isKnownSpeakerEmphasisStyle = isKnownSpeakerEmphasisStyle;
|
|
1398
|
+
exports.mergeEdlSourceOffsets = mergeEdlSourceOffsets;
|
|
1399
|
+
exports.normalizeEdl = normalizeEdl;
|
|
1400
|
+
exports.normalizeTranscript = normalizeTranscript;
|
|
1401
|
+
exports.outputMsToMasterMs = outputMsToMasterMs;
|
|
1402
|
+
exports.parseSpeakerEmphasisStyle = parseSpeakerEmphasisStyle;
|
|
1403
|
+
exports.remapMsThroughEdl = remapMsThroughEdl;
|
|
1404
|
+
exports.remapTranscriptThroughEdl = remapTranscriptThroughEdl;
|
|
1405
|
+
exports.resolveEditPlanOutput = resolveEditPlanOutput;
|
|
1406
|
+
exports.resolveEditPlanSources = resolveEditPlanSources;
|
|
1407
|
+
exports.resolveEdlSegmentSlots = resolveEdlSegmentSlots;
|
|
1408
|
+
exports.resolveSlideshowTransition = resolveSlideshowTransition;
|
|
1409
|
+
exports.resolveXfadeName = resolveXfadeName;
|
|
1410
|
+
exports.speakerLayoutAllows = speakerLayoutAllows;
|
|
1411
|
+
exports.speakerPresentationWarnings = speakerPresentationWarnings;
|
|
1412
|
+
exports.speakerSwitchOverlaps = speakerSwitchOverlaps;
|
|
1413
|
+
exports.speakerTurns = speakerTurns;
|
|
1414
|
+
exports.transcriptDurationSec = transcriptDurationSec;
|
|
1415
|
+
exports.validateEditedEdl = validateEditedEdl;
|
|
1416
|
+
exports.validateEdl = validateEdl;
|
|
1417
|
+
exports.validateEdlClipSet = validateEdlClipSet;
|
|
1418
|
+
//# sourceMappingURL=chunk-5PC6JBGJ.cjs.map
|
|
1419
|
+
//# sourceMappingURL=chunk-5PC6JBGJ.cjs.map
|