@nodaro/shared 3.31.0 → 3.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (378) hide show
  1. package/README.md +17 -0
  2. package/dist/chunk-23FJQTEA.js +1604 -0
  3. package/dist/chunk-23FJQTEA.js.map +1 -0
  4. package/dist/chunk-2NIQO2J3.cjs +54 -0
  5. package/dist/chunk-2NIQO2J3.cjs.map +1 -0
  6. package/dist/chunk-2NQLSLSN.cjs +19 -0
  7. package/dist/chunk-2NQLSLSN.cjs.map +1 -0
  8. package/dist/chunk-2OJIVO7R.cjs +32 -0
  9. package/dist/chunk-2OJIVO7R.cjs.map +1 -0
  10. package/dist/chunk-2RF4Z7KG.cjs +803 -0
  11. package/dist/chunk-2RF4Z7KG.cjs.map +1 -0
  12. package/dist/chunk-3RYKIUAE.js +86 -0
  13. package/dist/chunk-3RYKIUAE.js.map +1 -0
  14. package/dist/chunk-44I73CQS.cjs +194 -0
  15. package/dist/chunk-44I73CQS.cjs.map +1 -0
  16. package/dist/chunk-5PC6JBGJ.cjs +1419 -0
  17. package/dist/chunk-5PC6JBGJ.cjs.map +1 -0
  18. package/dist/chunk-5RU2HCW2.js +30 -0
  19. package/dist/chunk-5RU2HCW2.js.map +1 -0
  20. package/dist/chunk-5RYLK3MQ.js +267 -0
  21. package/dist/chunk-5RYLK3MQ.js.map +1 -0
  22. package/dist/chunk-5THUHJ3E.js +46 -0
  23. package/dist/chunk-5THUHJ3E.js.map +1 -0
  24. package/dist/chunk-6DAWSVX2.cjs +103 -0
  25. package/dist/chunk-6DAWSVX2.cjs.map +1 -0
  26. package/dist/chunk-6WZ2VN7V.js +920 -0
  27. package/dist/chunk-6WZ2VN7V.js.map +1 -0
  28. package/dist/chunk-7G7G42KS.js +86 -0
  29. package/dist/chunk-7G7G42KS.js.map +1 -0
  30. package/dist/chunk-7Z5LUTGU.js +1567 -0
  31. package/dist/chunk-7Z5LUTGU.js.map +1 -0
  32. package/dist/chunk-AINCI23X.js +2171 -0
  33. package/dist/chunk-AINCI23X.js.map +1 -0
  34. package/dist/chunk-BG5D5CZ6.js +1922 -0
  35. package/dist/chunk-BG5D5CZ6.js.map +1 -0
  36. package/dist/chunk-CK3GK34R.js +1381 -0
  37. package/dist/chunk-CK3GK34R.js.map +1 -0
  38. package/dist/chunk-CUH22J4D.js +17 -0
  39. package/dist/chunk-CUH22J4D.js.map +1 -0
  40. package/dist/chunk-D26ENTN2.cjs +1770 -0
  41. package/dist/chunk-D26ENTN2.cjs.map +1 -0
  42. package/dist/chunk-D6GNRSCV.cjs +2017 -0
  43. package/dist/chunk-D6GNRSCV.cjs.map +1 -0
  44. package/dist/chunk-FBV5DF6D.js +95 -0
  45. package/dist/chunk-FBV5DF6D.js.map +1 -0
  46. package/dist/chunk-FG4E7MTG.cjs +4 -0
  47. package/dist/chunk-FG4E7MTG.cjs.map +1 -0
  48. package/dist/chunk-FT5CF6IA.js +42 -0
  49. package/dist/chunk-FT5CF6IA.js.map +1 -0
  50. package/dist/chunk-G6IIVKMO.js +26 -0
  51. package/dist/chunk-G6IIVKMO.js.map +1 -0
  52. package/dist/chunk-HC7VKIV5.cjs +430 -0
  53. package/dist/chunk-HC7VKIV5.cjs.map +1 -0
  54. package/dist/chunk-HGC5JNVA.cjs +1503 -0
  55. package/dist/chunk-HGC5JNVA.cjs.map +1 -0
  56. package/dist/chunk-HKFMXNVQ.cjs +1273 -0
  57. package/dist/chunk-HKFMXNVQ.cjs.map +1 -0
  58. package/dist/chunk-HRXEZ3SX.cjs +526 -0
  59. package/dist/chunk-HRXEZ3SX.cjs.map +1 -0
  60. package/dist/chunk-HSHCCBIV.js +255 -0
  61. package/dist/chunk-HSHCCBIV.js.map +1 -0
  62. package/dist/chunk-HUR6ZJ7S.cjs +159 -0
  63. package/dist/chunk-HUR6ZJ7S.cjs.map +1 -0
  64. package/dist/chunk-J7BMO73N.cjs +114 -0
  65. package/dist/chunk-J7BMO73N.cjs.map +1 -0
  66. package/dist/chunk-JFS3NWZ5.cjs +1714 -0
  67. package/dist/chunk-JFS3NWZ5.cjs.map +1 -0
  68. package/dist/chunk-JL4C5VJ7.cjs +488 -0
  69. package/dist/chunk-JL4C5VJ7.cjs.map +1 -0
  70. package/dist/chunk-JSGIEF6Z.cjs +1087 -0
  71. package/dist/chunk-JSGIEF6Z.cjs.map +1 -0
  72. package/dist/chunk-JWA5SGCS.js +203 -0
  73. package/dist/chunk-JWA5SGCS.js.map +1 -0
  74. package/dist/chunk-K3LLGRK7.cjs +3545 -0
  75. package/dist/chunk-K3LLGRK7.cjs.map +1 -0
  76. package/dist/chunk-KU6S7IYV.cjs +210 -0
  77. package/dist/chunk-KU6S7IYV.cjs.map +1 -0
  78. package/dist/chunk-M36G6SRP.js +447 -0
  79. package/dist/chunk-M36G6SRP.js.map +1 -0
  80. package/dist/chunk-M7GQBRZU.cjs +1963 -0
  81. package/dist/chunk-M7GQBRZU.cjs.map +1 -0
  82. package/dist/chunk-MRXGWL42.cjs +4 -0
  83. package/dist/chunk-MRXGWL42.cjs.map +1 -0
  84. package/dist/chunk-NEJ2PV4C.cjs +211 -0
  85. package/dist/chunk-NEJ2PV4C.cjs.map +1 -0
  86. package/dist/chunk-OTATNBMD.js +141 -0
  87. package/dist/chunk-OTATNBMD.js.map +1 -0
  88. package/dist/chunk-OZSACQ2V.js +471 -0
  89. package/dist/chunk-OZSACQ2V.js.map +1 -0
  90. package/dist/chunk-PHZ23DP3.js +1782 -0
  91. package/dist/chunk-PHZ23DP3.js.map +1 -0
  92. package/dist/chunk-PQHS255G.js +1369 -0
  93. package/dist/chunk-PQHS255G.js.map +1 -0
  94. package/dist/chunk-PRYE7AZQ.cjs +1227 -0
  95. package/dist/chunk-PRYE7AZQ.cjs.map +1 -0
  96. package/dist/chunk-PVJBAPYJ.js +404 -0
  97. package/dist/chunk-PVJBAPYJ.js.map +1 -0
  98. package/dist/chunk-PXFQVLBX.js +776 -0
  99. package/dist/chunk-PXFQVLBX.js.map +1 -0
  100. package/dist/chunk-QA3MVQ32.js +21 -0
  101. package/dist/chunk-QA3MVQ32.js.map +1 -0
  102. package/dist/chunk-QJRP44ZO.js +769 -0
  103. package/dist/chunk-QJRP44ZO.js.map +1 -0
  104. package/dist/chunk-SAW5OK36.cjs +54 -0
  105. package/dist/chunk-SAW5OK36.cjs.map +1 -0
  106. package/dist/chunk-SES6GDBQ.cjs +624 -0
  107. package/dist/chunk-SES6GDBQ.cjs.map +1 -0
  108. package/dist/chunk-SFW3UB2P.js +31 -0
  109. package/dist/chunk-SFW3UB2P.js.map +1 -0
  110. package/dist/chunk-TNPDV7I4.cjs +2346 -0
  111. package/dist/chunk-TNPDV7I4.cjs.map +1 -0
  112. package/dist/chunk-TU33KYKW.cjs +25 -0
  113. package/dist/chunk-TU33KYKW.cjs.map +1 -0
  114. package/dist/chunk-TZBIY5C3.js +187 -0
  115. package/dist/chunk-TZBIY5C3.js.map +1 -0
  116. package/dist/chunk-TZE673G6.js +3 -0
  117. package/dist/chunk-TZE673G6.js.map +1 -0
  118. package/dist/chunk-UCFWI6D4.js +29 -0
  119. package/dist/chunk-UCFWI6D4.js.map +1 -0
  120. package/dist/chunk-UTQSSKSG.js +1164 -0
  121. package/dist/chunk-UTQSSKSG.js.map +1 -0
  122. package/dist/chunk-VA42637J.cjs +287 -0
  123. package/dist/chunk-VA42637J.cjs.map +1 -0
  124. package/dist/chunk-VNQRI2RO.cjs +1047 -0
  125. package/dist/chunk-VNQRI2RO.cjs.map +1 -0
  126. package/dist/chunk-VXPLKQWY.cjs +821 -0
  127. package/dist/chunk-VXPLKQWY.cjs.map +1 -0
  128. package/dist/chunk-WD6HJRBG.cjs +197 -0
  129. package/dist/chunk-WD6HJRBG.cjs.map +1 -0
  130. package/dist/chunk-WDIBOWAA.js +1054 -0
  131. package/dist/chunk-WDIBOWAA.js.map +1 -0
  132. package/dist/chunk-WKOIGLQX.cjs +38 -0
  133. package/dist/chunk-WKOIGLQX.cjs.map +1 -0
  134. package/dist/chunk-WNVQ3SMB.cjs +96 -0
  135. package/dist/chunk-WNVQ3SMB.cjs.map +1 -0
  136. package/dist/chunk-WRSWH7US.cjs +285 -0
  137. package/dist/chunk-WRSWH7US.cjs.map +1 -0
  138. package/dist/chunk-XGFTL5XY.js +181 -0
  139. package/dist/chunk-XGFTL5XY.js.map +1 -0
  140. package/dist/chunk-XNISPHTZ.js +1039 -0
  141. package/dist/chunk-XNISPHTZ.js.map +1 -0
  142. package/dist/chunk-Y2PM3FFL.js +3 -0
  143. package/dist/chunk-Y2PM3FFL.js.map +1 -0
  144. package/dist/chunk-YBPBK5KI.js +1030 -0
  145. package/dist/chunk-YBPBK5KI.js.map +1 -0
  146. package/dist/chunk-YWNYGYI7.cjs +31 -0
  147. package/dist/chunk-YWNYGYI7.cjs.map +1 -0
  148. package/dist/chunk-YYV35XOS.js +122 -0
  149. package/dist/chunk-YYV35XOS.js.map +1 -0
  150. package/dist/chunk-Z2OL5AJD.cjs +133 -0
  151. package/dist/chunk-Z2OL5AJD.cjs.map +1 -0
  152. package/dist/chunk-ZDFHA2EC.js +572 -0
  153. package/dist/chunk-ZDFHA2EC.js.map +1 -0
  154. package/dist/chunk-ZL7UM6PU.cjs +34 -0
  155. package/dist/chunk-ZL7UM6PU.cjs.map +1 -0
  156. package/dist/chunk-ZNZDQAXN.js +175 -0
  157. package/dist/chunk-ZNZDQAXN.js.map +1 -0
  158. package/dist/chunk-ZO5PBBFX.js +3497 -0
  159. package/dist/chunk-ZO5PBBFX.js.map +1 -0
  160. package/dist/chunk-ZRL2UFTH.cjs +1073 -0
  161. package/dist/chunk-ZRL2UFTH.cjs.map +1 -0
  162. package/dist/entries/apps.cjs +155 -0
  163. package/dist/entries/apps.cjs.map +1 -0
  164. package/dist/entries/apps.d.cts +292 -0
  165. package/dist/entries/apps.d.ts +292 -0
  166. package/dist/entries/apps.js +10 -0
  167. package/dist/entries/apps.js.map +1 -0
  168. package/dist/entries/captions.cjs +124 -0
  169. package/dist/entries/captions.cjs.map +1 -0
  170. package/dist/entries/captions.d.cts +354 -0
  171. package/dist/entries/captions.d.ts +354 -0
  172. package/dist/entries/captions.js +3 -0
  173. package/dist/entries/captions.js.map +1 -0
  174. package/dist/entries/catalogs.cjs +165 -0
  175. package/dist/entries/catalogs.cjs.map +1 -0
  176. package/dist/entries/catalogs.d.cts +385 -0
  177. package/dist/entries/catalogs.d.ts +385 -0
  178. package/dist/entries/catalogs.js +4 -0
  179. package/dist/entries/catalogs.js.map +1 -0
  180. package/dist/entries/credits.cjs +596 -0
  181. package/dist/entries/credits.cjs.map +1 -0
  182. package/dist/entries/credits.d.cts +1460 -0
  183. package/dist/entries/credits.d.ts +1460 -0
  184. package/dist/entries/credits.js +11 -0
  185. package/dist/entries/credits.js.map +1 -0
  186. package/dist/entries/edl.cjs +409 -0
  187. package/dist/entries/edl.cjs.map +1 -0
  188. package/dist/entries/edl.d.cts +1199 -0
  189. package/dist/entries/edl.d.ts +1199 -0
  190. package/dist/entries/edl.js +4 -0
  191. package/dist/entries/edl.js.map +1 -0
  192. package/dist/entries/entities.cjs +530 -0
  193. package/dist/entries/entities.cjs.map +1 -0
  194. package/dist/entries/entities.d.cts +1371 -0
  195. package/dist/entries/entities.d.ts +1371 -0
  196. package/dist/entries/entities.js +5 -0
  197. package/dist/entries/entities.js.map +1 -0
  198. package/dist/entries/i18n.cjs +48 -0
  199. package/dist/entries/i18n.cjs.map +1 -0
  200. package/dist/entries/i18n.d.cts +69 -0
  201. package/dist/entries/i18n.d.ts +69 -0
  202. package/dist/entries/i18n.js +3 -0
  203. package/dist/entries/i18n.js.map +1 -0
  204. package/dist/entries/llm-models.cjs +177 -0
  205. package/dist/entries/llm-models.cjs.map +1 -0
  206. package/dist/entries/llm-models.d.cts +435 -0
  207. package/dist/entries/llm-models.d.ts +435 -0
  208. package/dist/entries/llm-models.js +4 -0
  209. package/dist/entries/llm-models.js.map +1 -0
  210. package/dist/entries/media.cjs +335 -0
  211. package/dist/entries/media.cjs.map +1 -0
  212. package/dist/entries/media.d.cts +518 -0
  213. package/dist/entries/media.d.ts +518 -0
  214. package/dist/entries/media.js +6 -0
  215. package/dist/entries/media.js.map +1 -0
  216. package/dist/entries/model-catalog.cjs +259 -0
  217. package/dist/entries/model-catalog.cjs.map +1 -0
  218. package/dist/entries/model-catalog.d.cts +202 -0
  219. package/dist/entries/model-catalog.d.ts +202 -0
  220. package/dist/entries/model-catalog.js +6 -0
  221. package/dist/entries/model-catalog.js.map +1 -0
  222. package/dist/entries/models.cjs +833 -0
  223. package/dist/entries/models.cjs.map +1 -0
  224. package/dist/entries/models.d.cts +287 -0
  225. package/dist/entries/models.d.ts +287 -0
  226. package/dist/entries/models.js +8 -0
  227. package/dist/entries/models.js.map +1 -0
  228. package/dist/entries/nodes.cjs +789 -0
  229. package/dist/entries/nodes.cjs.map +1 -0
  230. package/dist/entries/nodes.d.cts +1600 -0
  231. package/dist/entries/nodes.d.ts +1600 -0
  232. package/dist/entries/nodes.js +16 -0
  233. package/dist/entries/nodes.js.map +1 -0
  234. package/dist/entries/organizations.cjs +80 -0
  235. package/dist/entries/organizations.cjs.map +1 -0
  236. package/dist/entries/organizations.d.cts +466 -0
  237. package/dist/entries/organizations.d.ts +466 -0
  238. package/dist/entries/organizations.js +3 -0
  239. package/dist/entries/organizations.js.map +1 -0
  240. package/dist/entries/pipeline.cjs +594 -0
  241. package/dist/entries/pipeline.cjs.map +1 -0
  242. package/dist/entries/pipeline.d.cts +2617 -0
  243. package/dist/entries/pipeline.d.ts +2617 -0
  244. package/dist/entries/pipeline.js +5 -0
  245. package/dist/entries/pipeline.js.map +1 -0
  246. package/dist/entries/scene3d.cjs +704 -0
  247. package/dist/entries/scene3d.cjs.map +1 -0
  248. package/dist/entries/scene3d.d.cts +4284 -0
  249. package/dist/entries/scene3d.d.ts +4284 -0
  250. package/dist/entries/scene3d.js +3 -0
  251. package/dist/entries/scene3d.js.map +1 -0
  252. package/dist/entries/social.cjs +714 -0
  253. package/dist/entries/social.cjs.map +1 -0
  254. package/dist/entries/social.d.cts +1366 -0
  255. package/dist/entries/social.d.ts +1366 -0
  256. package/dist/entries/social.js +5 -0
  257. package/dist/entries/social.js.map +1 -0
  258. package/dist/entries/types.cjs +13 -0
  259. package/dist/entries/types.cjs.map +1 -0
  260. package/dist/entries/types.d.cts +162 -0
  261. package/dist/entries/types.d.ts +162 -0
  262. package/dist/entries/types.js +4 -0
  263. package/dist/entries/types.js.map +1 -0
  264. package/dist/entries/ugc.cjs +279 -0
  265. package/dist/entries/ugc.cjs.map +1 -0
  266. package/dist/entries/ugc.d.cts +575 -0
  267. package/dist/entries/ugc.d.ts +575 -0
  268. package/dist/entries/ugc.js +6 -0
  269. package/dist/entries/ugc.js.map +1 -0
  270. package/dist/entries/video.cjs +549 -0
  271. package/dist/entries/video.cjs.map +1 -0
  272. package/dist/entries/video.d.cts +1791 -0
  273. package/dist/entries/video.d.ts +1791 -0
  274. package/dist/entries/video.js +8 -0
  275. package/dist/entries/video.js.map +1 -0
  276. package/dist/entries/workflow.cjs +574 -0
  277. package/dist/entries/workflow.cjs.map +1 -0
  278. package/dist/entries/workflow.d.cts +1743 -0
  279. package/dist/entries/workflow.d.ts +1743 -0
  280. package/dist/entries/workflow.js +5 -0
  281. package/dist/entries/workflow.js.map +1 -0
  282. package/dist/fan-out-meta-Bu6VyXcZ.d.cts +19 -0
  283. package/dist/fan-out-meta-Bu6VyXcZ.d.ts +19 -0
  284. package/dist/gemini-omni-voices-zeRXxSbZ.d.cts +174 -0
  285. package/dist/gemini-omni-voices-zeRXxSbZ.d.ts +174 -0
  286. package/dist/image-overlay-layers-CyBfRhxJ.d.cts +208 -0
  287. package/dist/image-overlay-layers-CyBfRhxJ.d.ts +208 -0
  288. package/dist/index.cjs +7747 -27084
  289. package/dist/index.cjs.map +1 -1
  290. package/dist/index.d.cts +32 -24198
  291. package/dist/index.d.ts +32 -24198
  292. package/dist/index.js +40 -25220
  293. package/dist/index.js.map +1 -1
  294. package/dist/model-catalog-V-ZNzRSd.d.cts +651 -0
  295. package/dist/model-catalog-V-ZNzRSd.d.ts +651 -0
  296. package/dist/presentation-types-0ENOCjoj.d.cts +61 -0
  297. package/dist/presentation-types-0ENOCjoj.d.ts +61 -0
  298. package/dist/presentation-utils-D0kxsWf9.d.cts +92 -0
  299. package/dist/presentation-utils-pZwlEAzo.d.ts +92 -0
  300. package/dist/scene-node-types-C3kl_zyK.d.cts +1949 -0
  301. package/dist/scene-node-types-C3kl_zyK.d.ts +1949 -0
  302. package/dist/supported-fonts-CRoF1gOy.d.cts +16 -0
  303. package/dist/supported-fonts-CRoF1gOy.d.ts +16 -0
  304. package/dist/types-BRlFPEru.d.cts +511 -0
  305. package/dist/types-BRlFPEru.d.ts +511 -0
  306. package/dist/types-DffyGSy5.d.cts +67 -0
  307. package/dist/types-DffyGSy5.d.ts +67 -0
  308. package/package.json +102 -1
  309. package/src/__tests__/add-captions-plan.test.ts +6 -2
  310. package/src/__tests__/caption-edge-dash.test.ts +23 -0
  311. package/src/__tests__/fixtures/root-exports.baseline.json +4625 -0
  312. package/src/__tests__/input-field-extra-keys.test.ts +1 -0
  313. package/src/__tests__/model-makers.test.ts +76 -0
  314. package/src/__tests__/no-internal-imports.test.ts +1 -1
  315. package/src/__tests__/node-aspect-ratio.test.ts +25 -0
  316. package/src/__tests__/node-runtime-keys.test.ts +9 -0
  317. package/src/__tests__/package-entries.test.ts +50 -0
  318. package/src/__tests__/pitch-tempo-pricing.test.ts +21 -0
  319. package/src/__tests__/presentation-utils.test.ts +15 -0
  320. package/src/__tests__/preview-gate-use-case.test.ts +151 -0
  321. package/src/__tests__/private-host.test.ts +53 -0
  322. package/src/__tests__/run-continuation.test.ts +7 -1
  323. package/src/__tests__/site-capture-node.test.ts +58 -0
  324. package/src/__tests__/ugc-lane-wires.test.ts +228 -0
  325. package/src/__tests__/ugc-node-wires.test.ts +9 -3
  326. package/src/__tests__/ugc-run-state.test.ts +5 -4
  327. package/src/__tests__/video-analysis-catalog-sync.test.ts +1 -1
  328. package/src/__tests__/video-analysis-pricing.test.ts +6 -6
  329. package/src/__tests__/voice-changer-pro-quote.test.ts +79 -0
  330. package/src/add-captions-plan.ts +9 -3
  331. package/src/caption-edge-dash.ts +33 -0
  332. package/src/component-types.ts +9 -0
  333. package/src/credit-estimators/index.ts +22 -1
  334. package/src/credit-estimators/pitch-tempo.ts +15 -1
  335. package/src/credit-estimators/speech.ts +72 -4
  336. package/src/credit-estimators/unit-quote.ts +52 -0
  337. package/src/credit-estimators/video-sfx.ts +15 -0
  338. package/src/credit-estimators/voice-changer-pro-quote.ts +138 -0
  339. package/src/credit-identifiers.ts +62 -17
  340. package/src/entity-image-handle.ts +2 -0
  341. package/src/entries/apps.ts +63 -0
  342. package/src/entries/captions.ts +34 -0
  343. package/src/entries/catalogs.ts +65 -0
  344. package/src/entries/credits.ts +105 -0
  345. package/src/entries/edl.ts +42 -0
  346. package/src/entries/entities.ts +144 -0
  347. package/src/entries/i18n.ts +31 -0
  348. package/src/entries/llm-models.ts +63 -0
  349. package/src/entries/media.ts +36 -0
  350. package/src/entries/model-catalog.ts +95 -0
  351. package/src/entries/models.ts +266 -0
  352. package/src/entries/nodes.ts +245 -0
  353. package/src/entries/organizations.ts +9 -0
  354. package/src/entries/pipeline.ts +43 -0
  355. package/src/entries/scene3d.ts +27 -0
  356. package/src/entries/social.ts +297 -0
  357. package/src/entries/types.ts +26 -0
  358. package/src/entries/ugc.ts +14 -0
  359. package/src/entries/video.ts +59 -0
  360. package/src/entries/workflow.ts +172 -0
  361. package/src/fan-out-rows.ts +2 -0
  362. package/src/index.ts +25 -1845
  363. package/src/json-kinds.ts +4 -0
  364. package/src/model-catalog.ts +243 -34
  365. package/src/node-mappable-fields.ts +1 -0
  366. package/src/node-run-routes.ts +2 -0
  367. package/src/node-runtime-keys.ts +8 -0
  368. package/src/normalize-node-params.ts +30 -0
  369. package/src/presentation-utils.ts +12 -0
  370. package/src/preview-gate.ts +92 -14
  371. package/src/private-host.ts +89 -59
  372. package/src/producer-types.ts +16 -2
  373. package/src/run-continuation.ts +21 -0
  374. package/src/site-capture-node.ts +82 -0
  375. package/src/ugc-lane-wires.ts +246 -0
  376. package/src/ugc-node-wires.ts +37 -7
  377. package/src/ugc-run-state.ts +5 -3
  378. package/src/video-analysis-pricing.ts +31 -29
@@ -0,0 +1,624 @@
1
+ 'use strict';
2
+
3
+ var chunk5PC6JBGJ_cjs = require('./chunk-5PC6JBGJ.cjs');
4
+
5
+ // src/audio-crossfade-curves.ts
6
+ var AUDIO_CROSSFADE_CURVES = [
7
+ {
8
+ id: "linear",
9
+ ffmpeg: "tri",
10
+ label: "Linear",
11
+ description: "Straight-line fade. Default; predictable but can dip in the middle for music."
12
+ },
13
+ {
14
+ id: "equal-power",
15
+ ffmpeg: "qsin",
16
+ label: "Equal Power",
17
+ description: "Quarter-sine. Keeps perceived loudness roughly constant across the crossfade \u2014 best for music."
18
+ },
19
+ {
20
+ id: "smooth",
21
+ ffmpeg: "hsin",
22
+ label: "Smooth (Sine)",
23
+ description: "Half-sine. Gentler than equal-power; good for dialogue and ambient."
24
+ },
25
+ {
26
+ id: "logarithmic",
27
+ ffmpeg: "log",
28
+ label: "Logarithmic",
29
+ description: "Compensates for the ear's logarithmic loudness response. Long, slow tails."
30
+ },
31
+ {
32
+ id: "exponential",
33
+ ffmpeg: "exp",
34
+ label: "Exponential",
35
+ description: "Sharp out / slow in (or vice versa). Punchy \u2014 good for impact moments."
36
+ }
37
+ ];
38
+ var AUDIO_CROSSFADE_CURVE_IDS = AUDIO_CROSSFADE_CURVES.map((c) => c.id);
39
+ var DEFAULT_AUDIO_CROSSFADE_CURVE_ID = "linear";
40
+ var CURVES_BY_ID = new Map(
41
+ AUDIO_CROSSFADE_CURVES.map((c) => [c.id, c])
42
+ );
43
+ function getAudioCrossfadeCurve(id) {
44
+ return CURVES_BY_ID.get(id);
45
+ }
46
+ function resolveAudioCrossfadeCurve(id) {
47
+ if (!id) return "tri";
48
+ return CURVES_BY_ID.get(id)?.ffmpeg ?? "tri";
49
+ }
50
+
51
+ // src/smart-cut-windows.ts
52
+ var SMART_CUT_WINDOW_MAX = 24;
53
+ var SMART_CUT_WINDOW_MIN = 1;
54
+ var SMART_CUT_WINDOW_DEFAULT = 8;
55
+ function clampSmartCutWindow(value) {
56
+ if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
57
+ const n = Math.round(value);
58
+ if (n < SMART_CUT_WINDOW_MIN) return SMART_CUT_WINDOW_MIN;
59
+ if (n > SMART_CUT_WINDOW_MAX) return SMART_CUT_WINDOW_MAX;
60
+ return n;
61
+ }
62
+
63
+ // src/speaker-tracks.ts
64
+ var SPEAKER_TRACKS_VERSION = 1;
65
+ var SPEAKER_TRACK_ATTRIBUTION_METHODS = ["source-map", "region", "mouth-motion", "manual"];
66
+ var KNOWN_METHODS = new Set(SPEAKER_TRACK_ATTRIBUTION_METHODS);
67
+ var SPEAKER_TRACKS_MAX_BOXES_PER_SOURCE = 1e5;
68
+ var SPEAKER_TRACKS_MAX_BYTES = 64 * 1024 * 1024;
69
+ var isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
70
+ var isNum = (v) => typeof v === "number" && Number.isFinite(v);
71
+ var num = (v, fallback = 0) => isNum(v) ? v : fallback;
72
+ var str = (v) => typeof v === "string" ? v : void 0;
73
+ var clamp01 = (v) => Math.min(1, Math.max(0, v));
74
+ var arr = (v) => Array.isArray(v) ? v : [];
75
+ var int = (v) => {
76
+ const r = Math.round(v);
77
+ return r === 0 ? 0 : r;
78
+ };
79
+ function cropAxis(p, s) {
80
+ if (!(s > 0)) return void 0;
81
+ if (p >= 0 && p + s <= 1) return [p, s];
82
+ const lo = clamp01(p);
83
+ const hi = clamp01(p + s);
84
+ return hi > lo ? [lo, hi - lo] : void 0;
85
+ }
86
+ function normalizeBox(raw) {
87
+ if (!isObj(raw)) return void 0;
88
+ if (![raw.ms, raw.x, raw.y, raw.w, raw.h].every(isNum)) return void 0;
89
+ const xs = cropAxis(raw.x, raw.w);
90
+ const ys = cropAxis(raw.y, raw.h);
91
+ if (!xs || !ys) return void 0;
92
+ const [x, w] = xs;
93
+ const [y, h] = ys;
94
+ return { ms: int(raw.ms), x, y, w, h, ...isNum(raw.score) ? { score: clamp01(raw.score) } : {} };
95
+ }
96
+ function normalizeSpans(raw) {
97
+ if (!Array.isArray(raw)) return [];
98
+ const spans = raw.filter(isObj).filter((s) => isNum(s.startMs) && isNum(s.endMs)).map((s) => ({ startMs: int(s.startMs), endMs: int(s.endMs) })).filter((s) => s.endMs > s.startMs).sort((a, b) => a.startMs - b.startMs || a.endMs - b.endMs);
99
+ const merged = [];
100
+ for (const s of spans) {
101
+ const last = merged[merged.length - 1];
102
+ if (last && s.startMs <= last.endMs) merged[merged.length - 1] = { startMs: last.startMs, endMs: Math.max(last.endMs, s.endMs) };
103
+ else merged.push(s);
104
+ }
105
+ return merged;
106
+ }
107
+ function normalizeCuts(raw) {
108
+ if (!Array.isArray(raw)) return [];
109
+ const sorted = raw.filter(isNum).map(int).sort((a, b) => a - b);
110
+ return sorted.filter((c, i) => i === 0 || c !== sorted[i - 1]);
111
+ }
112
+ function normalizeAttribution(raw) {
113
+ if (!isObj(raw)) return void 0;
114
+ const method = str(raw.method);
115
+ if (!method) return void 0;
116
+ const rawSpeaker = str(raw.rawSpeaker);
117
+ return { method, confidence: clamp01(num(raw.confidence)), ...rawSpeaker ? { rawSpeaker } : {} };
118
+ }
119
+ function normalizeHeader(raw, fallbackId) {
120
+ const speaker = str(raw.speaker);
121
+ const attribution = normalizeAttribution(raw.attribution);
122
+ return {
123
+ id: str(raw.id) || fallbackId,
124
+ ...speaker ? { speaker } : {},
125
+ ...attribution ? { attribution } : {}
126
+ };
127
+ }
128
+ function normalizeSetFields(o) {
129
+ const detector = isObj(o.detector) ? o.detector : {};
130
+ const detectorVersion = str(detector.version);
131
+ return {
132
+ // Only an ABSENT version defaults to 1. Any present value — another
133
+ // number, "2", null — is kept as is so validate refuses it rather than
134
+ // reading a newer (or broken) body as this one.
135
+ version: o.version === void 0 ? SPEAKER_TRACKS_VERSION : o.version,
136
+ sampleFps: num(o.sampleFps),
137
+ detector: { id: str(detector.id) ?? "", ...detectorVersion ? { version: detectorVersion } : {} }
138
+ };
139
+ }
140
+ function normalizeSources(raw, track) {
141
+ if (!Array.isArray(raw)) return [];
142
+ return raw.map((r) => {
143
+ const s = isObj(r) ? r : {};
144
+ const sourceId = str(s.sourceId) ?? "";
145
+ const frame = isObj(s.frame) ? s.frame : {};
146
+ const cuts = normalizeCuts(s.cuts);
147
+ const tracks = Array.isArray(s.tracks) ? s.tracks.map((t, k) => track(isObj(t) ? t : {}, `${sourceId}/t${k + 1}`)) : [];
148
+ return {
149
+ sourceId,
150
+ // A clock other than "source" cannot be repaired: boxes on another clock
151
+ // would land offsetMs away from their frame. Keep it for validate to refuse.
152
+ clock: typeof s.clock === "string" ? s.clock : "source",
153
+ frame: { w: int(num(frame.w)), h: int(num(frame.h)) },
154
+ sampledSpans: normalizeSpans(s.sampledSpans),
155
+ tracks,
156
+ ...cuts.length > 0 ? { cuts } : {}
157
+ };
158
+ });
159
+ }
160
+ function normalizeSpeakerTracks(input) {
161
+ const o = isObj(input) ? input : {};
162
+ return {
163
+ ...normalizeSetFields(o),
164
+ sources: normalizeSources(o.sources, (t, fallbackId) => {
165
+ const boxes = Array.isArray(t.boxes) ? t.boxes.map(normalizeBox).filter((b) => b !== void 0) : [];
166
+ return { ...normalizeHeader(t, fallbackId), boxes: [...boxes].sort((a, b) => a.ms - b.ms) };
167
+ })
168
+ };
169
+ }
170
+ function normalizeSpeakerTrackSetDescriptor(input) {
171
+ const o = isObj(input) ? input : {};
172
+ return {
173
+ ...normalizeSetFields(o),
174
+ sources: normalizeSources(o.sources, (t, fallbackId) => ({
175
+ ...normalizeHeader(t, fallbackId),
176
+ boxCount: Math.max(0, int(num(t.boxCount)))
177
+ })),
178
+ url: str(o.url) ?? "",
179
+ sha256: str(o.sha256) ?? "",
180
+ bytes: int(num(o.bytes))
181
+ };
182
+ }
183
+ function describeSpeakerTracks(set, artifact) {
184
+ return {
185
+ version: set.version,
186
+ sampleFps: set.sampleFps,
187
+ detector: { ...set.detector },
188
+ sources: set.sources.map((s) => ({
189
+ sourceId: s.sourceId,
190
+ clock: s.clock,
191
+ frame: { ...s.frame },
192
+ sampledSpans: s.sampledSpans.map((sp) => ({ ...sp })),
193
+ tracks: s.tracks.map((t) => ({
194
+ id: t.id,
195
+ ...t.speaker !== void 0 ? { speaker: t.speaker } : {},
196
+ ...t.attribution ? { attribution: { ...t.attribution } } : {},
197
+ boxCount: t.boxes.length
198
+ })),
199
+ ...s.cuts && s.cuts.length > 0 ? { cuts: [...s.cuts] } : {}
200
+ })),
201
+ url: artifact.url,
202
+ sha256: artifact.sha256,
203
+ bytes: artifact.bytes
204
+ };
205
+ }
206
+ function edlSpeakerSpace(edl) {
207
+ const out = /* @__PURE__ */ new Set();
208
+ const add = (v) => {
209
+ if (typeof v === "string" && v) out.add(v);
210
+ };
211
+ for (const e of edlList(edl)) {
212
+ for (const s of Array.isArray(e.sources) ? e.sources : []) {
213
+ for (const sp of Array.isArray(s?.speakers) ? s.speakers : []) add(sp);
214
+ }
215
+ for (const seg of Array.isArray(e.segments) ? e.segments : []) {
216
+ add(seg?.speaker);
217
+ for (const slot of Array.isArray(seg?.layout?.slots) ? seg.layout.slots : []) add(slot?.speaker);
218
+ }
219
+ }
220
+ return [...out].sort();
221
+ }
222
+ function edlList(edl) {
223
+ if (!edl) return [];
224
+ const all = Array.isArray(edl) ? edl : [edl];
225
+ return all.filter((e) => isObj(e));
226
+ }
227
+ var SHA256_HEX = /^[0-9a-f]{64}$/;
228
+ function validateCommon(set, opts, perTrack) {
229
+ const f = { issues: [], warnings: [] };
230
+ const { issues, warnings } = f;
231
+ const sources = arr(set.sources);
232
+ const maxBoxes = opts.maxBoxesPerSource ?? SPEAKER_TRACKS_MAX_BOXES_PER_SOURCE;
233
+ if (set.version !== SPEAKER_TRACKS_VERSION) issues.push(`version must be ${SPEAKER_TRACKS_VERSION}`);
234
+ if (!(isNum(set.sampleFps) && set.sampleFps > 0)) issues.push("sampleFps must be a finite number > 0");
235
+ const edls = edlList(opts.edl);
236
+ const edlSources = /* @__PURE__ */ new Map();
237
+ for (const e of edls) {
238
+ for (const s of Array.isArray(e.sources) ? e.sources : []) {
239
+ if (s && typeof s.id === "string" && !edlSources.has(s.id)) edlSources.set(s.id, s);
240
+ }
241
+ }
242
+ const sourceIds = /* @__PURE__ */ new Set();
243
+ const trackIds = /* @__PURE__ */ new Set();
244
+ sources.forEach((s, i) => {
245
+ const sid = s.sourceId;
246
+ const at = `source "${sid}"`;
247
+ if (!sid) issues.push(`source[${i}]: sourceId is empty`);
248
+ else if (sourceIds.has(sid)) issues.push(`duplicate source id "${sid}"`);
249
+ sourceIds.add(sid);
250
+ if (sid && edls.length > 0) {
251
+ const es = edlSources.get(sid);
252
+ if (!es) issues.push(`${at}: not a source of the EDL`);
253
+ else if (es.kind !== "video") issues.push(`${at}: the EDL source is kind:"${es.kind}", tracks need a video source`);
254
+ }
255
+ if (s.clock !== "source") issues.push(`${at}: clock must be "source"`);
256
+ if (!(isObj(s.frame) && isNum(s.frame.w) && isNum(s.frame.h) && s.frame.w > 0 && s.frame.h > 0)) {
257
+ issues.push(`${at}: frame w/h must be positive`);
258
+ }
259
+ const spans = arr(s.sampledSpans);
260
+ spans.forEach((sp, j) => {
261
+ const startMs = sp?.startMs;
262
+ const endMs = sp?.endMs;
263
+ if (!(isNum(startMs) && isNum(endMs) && endMs > startMs)) {
264
+ issues.push(`${at}: sampledSpans[${j}] [${startMs},${endMs}) is not positive`);
265
+ return;
266
+ }
267
+ if (!(Number.isInteger(startMs) && Number.isInteger(endMs))) issues.push(`${at}: sampledSpans[${j}] [${startMs},${endMs}) is not integer ms`);
268
+ if (startMs < 0) issues.push(`${at}: sampledSpans[${j}] starts before 0`);
269
+ const prevEnd = spans[j - 1]?.endMs;
270
+ if (j > 0 && isNum(prevEnd) && startMs < prevEnd) {
271
+ issues.push(`${at}: sampledSpans must be sorted and non-overlapping (span ${j})`);
272
+ }
273
+ });
274
+ const cuts = s.cuts;
275
+ if (cuts !== void 0) {
276
+ const okCuts = Array.isArray(cuts) && cuts.every((c, k) => Number.isInteger(c) && c >= 0 && (k === 0 || c > cuts[k - 1]));
277
+ if (!okCuts) issues.push(`${at}: cuts must be ascending non-negative ms`);
278
+ }
279
+ let boxes = 0;
280
+ const tracks = arr(s.tracks);
281
+ tracks.forEach((t, k) => {
282
+ if (!t?.id) issues.push(`${at} track[${k}]: id is empty`);
283
+ else if (trackIds.has(t.id)) issues.push(`duplicate track id "${t.id}"`);
284
+ if (t?.id) trackIds.add(t.id);
285
+ const a = t?.attribution;
286
+ if (a) {
287
+ if (!(isNum(a.confidence) && a.confidence >= 0 && a.confidence <= 1)) {
288
+ issues.push(`track "${t.id}": attribution.confidence=${a.confidence} out of 0..1`);
289
+ }
290
+ if (!KNOWN_METHODS.has(a.method)) {
291
+ warnings.push(`track "${t.id}": unknown attribution method "${a.method}" (known: ${SPEAKER_TRACK_ATTRIBUTION_METHODS.join(", ")})`);
292
+ }
293
+ }
294
+ boxes += perTrack(t, s, f);
295
+ });
296
+ if (boxes > maxBoxes) issues.push(`${at}: ${boxes} boxes is over the cap of ${maxBoxes}`);
297
+ });
298
+ if (edls.length > 0) {
299
+ const space = edlSpeakerSpace(edls);
300
+ const attributed = sources.flatMap((s) => Array.isArray(s.tracks) ? s.tracks : []).filter((t) => !!t?.speaker);
301
+ if (space.length > 0 && attributed.length > 0) {
302
+ const inSpace = new Set(space);
303
+ const matches = (t) => inSpace.has(t.speaker) || !!t.attribution?.rawSpeaker && inSpace.has(t.attribution.rawSpeaker);
304
+ if (!attributed.some(matches)) {
305
+ const labels = [...new Set(attributed.map((t) => t.speaker))].sort();
306
+ issues.push(
307
+ `no tracked speaker is in the edit's speaker set: the tracks are labelled ${labels.map((l) => `"${l}"`).join(", ")} and the edit uses ${space.map((l) => `"${l}"`).join(", ")} \u2014 wire Speaker Frames to the same transcript as Camera Switch`
308
+ );
309
+ } else {
310
+ for (const t of attributed) {
311
+ if (!matches(t)) warnings.push(`track "${t.id}": speaker "${t.speaker}" is not in the edit's speaker set`);
312
+ }
313
+ }
314
+ }
315
+ }
316
+ return f;
317
+ }
318
+ var BOX_FINDINGS_PER_RULE = 5;
319
+ var MAX_LISTED_FINDINGS = 100;
320
+ function boxIssues(b, at) {
321
+ const out = [];
322
+ for (const k of ["x", "y", "w", "h"]) {
323
+ const v = b?.[k];
324
+ if (!isNum(v) || v < 0 || v > 1) out.push([`with ${k} out of 0..1`, `${at}: ${k}=${v} out of 0..1`]);
325
+ }
326
+ if (out.length > 0) return out;
327
+ if (b.w <= 0 || b.h <= 0) out.push(["with a non-positive w/h", `${at}: non-positive w/h`]);
328
+ if (b.x + b.w > 1 + 1e-9) out.push(["extending past the right edge", `${at}: extends past the right edge (x+w>1)`]);
329
+ if (b.y + b.h > 1 + 1e-9) out.push(["extending past the bottom edge", `${at}: extends past the bottom edge (y+h>1)`]);
330
+ if (b.score !== void 0 && !(isNum(b.score) && b.score >= 0 && b.score <= 1)) out.push(["with a score out of 0..1", `${at}: score=${b.score} out of 0..1`]);
331
+ return out;
332
+ }
333
+ function capListed(list, noun) {
334
+ if (list.length <= MAX_LISTED_FINDINGS) return [...list];
335
+ return [...list.slice(0, MAX_LISTED_FINDINGS), `${list.length - MAX_LISTED_FINDINGS} more ${noun} not listed`];
336
+ }
337
+ function inSpans(spans, ms) {
338
+ let lo = 0;
339
+ let hi = spans.length - 1;
340
+ while (lo <= hi) {
341
+ const mid = lo + hi >> 1;
342
+ const sp = spans[mid];
343
+ if (ms < sp.startMs) hi = mid - 1;
344
+ else if (ms >= sp.endMs) lo = mid + 1;
345
+ else return true;
346
+ }
347
+ return false;
348
+ }
349
+ function validateSpeakerTracks(set, opts = {}) {
350
+ const safe = isObj(set) ? set : {};
351
+ const f = validateCommon(safe, opts, (t, source, { issues }) => {
352
+ const boxes = Array.isArray(t?.boxes) ? t.boxes : [];
353
+ const spans = Array.isArray(source.sampledSpans) ? source.sampledSpans : [];
354
+ let first = Infinity;
355
+ let last = -Infinity;
356
+ const seen = /* @__PURE__ */ new Map();
357
+ const report = ([rule, message]) => {
358
+ const n = (seen.get(rule) ?? 0) + 1;
359
+ seen.set(rule, n);
360
+ if (n <= BOX_FINDINGS_PER_RULE) issues.push(message);
361
+ };
362
+ const outside = `outside every sampled span of source "${source.sourceId}"`;
363
+ boxes.forEach((b, j) => {
364
+ const at = `track "${t.id}" box[${j}]`;
365
+ boxIssues(b, at).forEach(report);
366
+ if (!isNum(b?.ms)) {
367
+ report(["whose ms is not a number", `${at}: ms is not a number`]);
368
+ return;
369
+ }
370
+ if (!Number.isInteger(b.ms)) report(["whose ms is not an integer", `${at}: ms ${b.ms} is not an integer`]);
371
+ const prev = boxes[j - 1]?.ms;
372
+ if (j > 0 && isNum(prev) && !(b.ms > prev)) report(["not after the previous box", `${at}: ms ${b.ms} is not after the previous box (${prev})`]);
373
+ if (!inSpans(spans, b.ms)) report([outside, `${at}: ms ${b.ms} is ${outside}`]);
374
+ first = Math.min(first, b.ms);
375
+ last = Math.max(last, b.ms);
376
+ });
377
+ for (const [rule, n] of seen) {
378
+ if (n > BOX_FINDINGS_PER_RULE) issues.push(`track "${t.id}": ${n - BOX_FINDINGS_PER_RULE} more boxes ${rule}`);
379
+ }
380
+ const cut = (Array.isArray(source.cuts) ? source.cuts : []).find((c) => first < c && c <= last);
381
+ if (cut !== void 0) issues.push(`track "${t.id}": spans the cut at ${cut} ms (boxes ${first}..${last})`);
382
+ return boxes.length;
383
+ });
384
+ const maxBytes = opts.maxBytes ?? SPEAKER_TRACKS_MAX_BYTES;
385
+ const bytes = opts.serializedBytes ?? new TextEncoder().encode(JSON.stringify(safe)).length;
386
+ if (bytes > maxBytes) f.issues.push(`the track set is ${bytes} bytes, over the cap of ${maxBytes}`);
387
+ return { ok: f.issues.length === 0, issues: capListed(f.issues, "issues"), warnings: capListed(f.warnings, "warnings") };
388
+ }
389
+ function validateSpeakerTrackSetDescriptor(d, opts = {}) {
390
+ const safe = isObj(d) ? d : {};
391
+ const f = validateCommon(safe, opts, (t, _source, { issues }) => {
392
+ if (!(Number.isInteger(t?.boxCount) && t.boxCount >= 0)) {
393
+ issues.push(`track "${t?.id}": boxCount must be a non-negative integer`);
394
+ return 0;
395
+ }
396
+ return t.boxCount;
397
+ });
398
+ if (!(typeof safe.url === "string" && safe.url.trim())) f.issues.push("url is empty");
399
+ if (!(typeof safe.sha256 === "string" && SHA256_HEX.test(safe.sha256))) f.issues.push("sha256 must be 64 lowercase hex characters");
400
+ const maxBytes = opts.maxBytes ?? SPEAKER_TRACKS_MAX_BYTES;
401
+ if (!(Number.isInteger(safe.bytes) && safe.bytes > 0)) f.issues.push("bytes must be a positive integer");
402
+ else if (safe.bytes > maxBytes) f.issues.push(`the track set is ${safe.bytes} bytes, over the cap of ${maxBytes}`);
403
+ return { ok: f.issues.length === 0, issues: capListed(f.issues, "issues"), warnings: capListed(f.warnings, "warnings") };
404
+ }
405
+
406
+ // src/camera-switch-contract.ts
407
+ var CAMERA_SWITCH_DEFAULTS = Object.freeze({
408
+ /** The shortest shot; a shorter turn (an interjection) holds the shot. */
409
+ minShotMs: 2500,
410
+ /** Cut this long before the new speaker starts. */
411
+ leadMs: 200,
412
+ /** With a `wide` camera: break to it after this long on one camera. */
413
+ maxShotMs: 2e4,
414
+ /** With a `wide` camera: every N-th cut goes to the wide (0 = off). */
415
+ wideEvery: 0,
416
+ /** Overlapping speech → a side-by-side / stacked layout hint. */
417
+ layoutHints: false
418
+ });
419
+ var CAMERA_SWITCH_CREDIT_ID = "camera-switch";
420
+ var parseMaybe = (raw) => {
421
+ if (typeof raw !== "string") return raw;
422
+ try {
423
+ return JSON.parse(raw);
424
+ } catch {
425
+ return void 0;
426
+ }
427
+ };
428
+ function transcriptSpeakerLabels(transcript) {
429
+ const parsed = parseMaybe(transcript);
430
+ if (!parsed || typeof parsed !== "object") return [];
431
+ const seen = /* @__PURE__ */ new Set();
432
+ for (const w of chunk5PC6JBGJ_cjs.normalizeTranscript(parsed).words) {
433
+ if (w.speaker && !seen.has(w.speaker)) seen.add(w.speaker);
434
+ }
435
+ return [...seen];
436
+ }
437
+ function cameraSwitchCameras(edl) {
438
+ const sources = parseMaybe(edl)?.sources;
439
+ if (!Array.isArray(sources)) return [];
440
+ return sources.filter((s) => !!s && typeof s.id === "string").filter((s) => s.kind !== "audio" && s.role !== "wide" && s.role !== "screen" && s.role !== "master-audio").map((s) => ({ id: s.id, ...s.role ? { role: s.role } : {} }));
441
+ }
442
+ var CAMERA_SWITCH_BOUNDS = Object.freeze({
443
+ minShotMs: Object.freeze({ min: 500, max: 6e4 }),
444
+ leadMs: Object.freeze({ min: 0, max: 5e3 }),
445
+ maxShotMs: Object.freeze({ min: 0, max: 6e5 }),
446
+ wideEvery: Object.freeze({ min: 0, max: 20 })
447
+ });
448
+ var CAMERA_SWITCH_NAME_MAX = 80;
449
+ function clampCameraSwitchSetting(key, value) {
450
+ if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
451
+ const { min, max } = CAMERA_SWITCH_BOUNDS[key];
452
+ return Math.min(max, Math.max(min, Math.round(value)));
453
+ }
454
+ function cleanSpeakerNames(raw) {
455
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
456
+ const out = {};
457
+ for (const [label, name] of Object.entries(raw)) {
458
+ const trimmed = typeof name === "string" ? name.trim() : "";
459
+ if (label && trimmed) out[label] = trimmed.slice(0, CAMERA_SWITCH_NAME_MAX);
460
+ }
461
+ return out;
462
+ }
463
+ function cameraSwitchEdlProblem(edl) {
464
+ const v = parseMaybe(edl);
465
+ if (!v || typeof v !== "object" || Array.isArray(v)) return "camera-switch: `edl` must be one edit (an EDL object).";
466
+ if (Array.isArray(v.clips)) return "camera-switch: `edl` is a clip set \u2014 pass one clip's EDL (a clip set fans out one run per clip on the canvas).";
467
+ if (!Array.isArray(v.sources) || !Array.isArray(v.segments)) return "camera-switch: `edl` needs `sources` and `segments`.";
468
+ if (v.segments.length === 0) return "camera-switch: `edl` has no segments.";
469
+ const num2 = (x) => typeof x === "number" && Number.isFinite(x) ? x : void 0;
470
+ for (const [i, row] of v.segments.entries()) {
471
+ const seg = row;
472
+ const inMs = num2(seg?.inMs), outMs = num2(seg?.outMs);
473
+ if (inMs === void 0 || outMs === void 0 || !(outMs > inMs)) return `camera-switch: segment ${i} needs a numeric inMs < outMs.`;
474
+ }
475
+ if (v.clock === "output") return "camera-switch: the edit must be on the master clock (an edit-plan EDL), not a rendered output's.";
476
+ return null;
477
+ }
478
+ function defaultSpeakerMap(labels, cameraIds, existing = {}) {
479
+ const out = {};
480
+ labels.forEach((label, i) => {
481
+ if (Object.prototype.hasOwnProperty.call(existing, label)) {
482
+ const kept = existing[label];
483
+ if (typeof kept === "string") out[label] = kept;
484
+ return;
485
+ }
486
+ if (i < cameraIds.length) out[label] = cameraIds[i];
487
+ });
488
+ return out;
489
+ }
490
+ function cameraSwitchSettingsPayload(data, edl, transcript) {
491
+ const existing = data.speakerMap && typeof data.speakerMap === "object" ? data.speakerMap : {};
492
+ const out = {
493
+ speakerMap: defaultSpeakerMap(transcriptSpeakerLabels(transcript), cameraSwitchCameras(edl).map((c) => c.id), existing),
494
+ speakerNames: cleanSpeakerNames(data.speakerNames),
495
+ layoutHints: data.layoutHints === true
496
+ };
497
+ for (const key of Object.keys(CAMERA_SWITCH_BOUNDS)) {
498
+ const v = clampCameraSwitchSetting(key, data[key]);
499
+ if (v !== void 0) out[key] = v;
500
+ }
501
+ return out;
502
+ }
503
+
504
+ // src/edit-plan-contract.ts
505
+ var EDIT_PLAN_MODES = ["tighten", "clips", "chapters", "trailer"];
506
+ var EDIT_PLAN_TIERS = ["economy", "standard", "premium"];
507
+ var EDIT_PLAN_BUCKET_MINUTES = [15, 30, 60, 90, 120, 180];
508
+ var EDIT_PLAN_MAX_MINUTES = 180;
509
+ var EDIT_PLAN_DEFAULT_CLIP_COUNT = 8;
510
+ var EDIT_PLAN_MAX_CLIP_COUNT = 50;
511
+ function clampEditPlanClipCount(count) {
512
+ if (typeof count !== "number" || !Number.isFinite(count) || count <= 0) return void 0;
513
+ return Math.min(EDIT_PLAN_MAX_CLIP_COUNT, Math.max(1, Math.floor(count)));
514
+ }
515
+ var EDIT_PLAN_BASE_CREDIT_ID = "edit-plan";
516
+ function editPlanBucketMinutes(durationSec) {
517
+ const secs = typeof durationSec === "number" && Number.isFinite(durationSec) ? durationSec : EDIT_PLAN_MAX_MINUTES * 60;
518
+ const mins = Math.max(1, Math.ceil(secs / 60));
519
+ const capped = Math.min(mins, EDIT_PLAN_MAX_MINUTES);
520
+ for (const b of EDIT_PLAN_BUCKET_MINUTES) if (capped <= b) return b;
521
+ return EDIT_PLAN_BUCKET_MINUTES[EDIT_PLAN_BUCKET_MINUTES.length - 1];
522
+ }
523
+ function buildEditPlanCreditId(mode, tier, durationSec) {
524
+ return editPlanMinutesCreditId(mode, tier, editPlanBucketMinutes(durationSec));
525
+ }
526
+ function editPlanStartedMinutes(durationSec) {
527
+ const secs = typeof durationSec === "number" && Number.isFinite(durationSec) ? durationSec : EDIT_PLAN_MAX_MINUTES * 60;
528
+ return Math.min(EDIT_PLAN_MAX_MINUTES, Math.max(1, Math.ceil(secs / 60)));
529
+ }
530
+ function editPlanMinutesCreditId(mode, tier, minutes) {
531
+ return `edit-plan:${mode}:${tier}:${minutes}m`;
532
+ }
533
+ function editPlanReserveCreditId(mode, tier, durationSec, perMinute) {
534
+ return perMinute ? editPlanMinutesCreditId(mode, tier, editPlanStartedMinutes(durationSec)) : buildEditPlanCreditId(mode, tier, durationSec);
535
+ }
536
+ function editPlanRateCreditId(mode, tier) {
537
+ return `edit-plan:${mode}:${tier}:per-minute`;
538
+ }
539
+ function editPlanFlatCreditId(mode, tier) {
540
+ return `edit-plan:${mode}:${tier}:flat`;
541
+ }
542
+ function parseEditPlanMinutesCreditId(id) {
543
+ const m = /^edit-plan:([a-z]+):([a-z]+):(\d+)m$/.exec(id);
544
+ if (!m) return void 0;
545
+ const mode = parseEditPlanMode(m[1]);
546
+ const tier = EDIT_PLAN_TIERS.includes(m[2]) ? m[2] : void 0;
547
+ const minutes = Number(m[3]);
548
+ if (!mode || !tier || !Number.isInteger(minutes) || minutes < 1 || minutes > EDIT_PLAN_MAX_MINUTES) return void 0;
549
+ return { mode, tier, minutes };
550
+ }
551
+ function editPlanMinutesBaseCredits(flat, rate, minutes) {
552
+ return Math.max(1, Math.ceil(flat + rate * minutes));
553
+ }
554
+ function asEditPlanMode(v) {
555
+ return parseEditPlanMode(v) ?? "tighten";
556
+ }
557
+ function parseEditPlanMode(v) {
558
+ return typeof v === "string" && EDIT_PLAN_MODES.includes(v) ? v : void 0;
559
+ }
560
+ function asEditPlanTier(v) {
561
+ return v === "economy" || v === "premium" ? v : "standard";
562
+ }
563
+ function unwrapEditPlanOutput(outputData) {
564
+ if (!outputData || typeof outputData !== "object") return outputData;
565
+ const o = outputData;
566
+ if (Array.isArray(o.clips)) return o.clips;
567
+ if (Array.isArray(o.chapters)) return { version: chunk5PC6JBGJ_cjs.EDL_VERSION, chapters: o.chapters };
568
+ const { viaNodaroCloud: _viaNodaroCloud, ...rest } = o;
569
+ return rest;
570
+ }
571
+
572
+ exports.AUDIO_CROSSFADE_CURVES = AUDIO_CROSSFADE_CURVES;
573
+ exports.AUDIO_CROSSFADE_CURVE_IDS = AUDIO_CROSSFADE_CURVE_IDS;
574
+ exports.CAMERA_SWITCH_BOUNDS = CAMERA_SWITCH_BOUNDS;
575
+ exports.CAMERA_SWITCH_CREDIT_ID = CAMERA_SWITCH_CREDIT_ID;
576
+ exports.CAMERA_SWITCH_DEFAULTS = CAMERA_SWITCH_DEFAULTS;
577
+ exports.CAMERA_SWITCH_NAME_MAX = CAMERA_SWITCH_NAME_MAX;
578
+ exports.DEFAULT_AUDIO_CROSSFADE_CURVE_ID = DEFAULT_AUDIO_CROSSFADE_CURVE_ID;
579
+ exports.EDIT_PLAN_BASE_CREDIT_ID = EDIT_PLAN_BASE_CREDIT_ID;
580
+ exports.EDIT_PLAN_BUCKET_MINUTES = EDIT_PLAN_BUCKET_MINUTES;
581
+ exports.EDIT_PLAN_DEFAULT_CLIP_COUNT = EDIT_PLAN_DEFAULT_CLIP_COUNT;
582
+ exports.EDIT_PLAN_MAX_CLIP_COUNT = EDIT_PLAN_MAX_CLIP_COUNT;
583
+ exports.EDIT_PLAN_MAX_MINUTES = EDIT_PLAN_MAX_MINUTES;
584
+ exports.EDIT_PLAN_MODES = EDIT_PLAN_MODES;
585
+ exports.EDIT_PLAN_TIERS = EDIT_PLAN_TIERS;
586
+ exports.SMART_CUT_WINDOW_DEFAULT = SMART_CUT_WINDOW_DEFAULT;
587
+ exports.SMART_CUT_WINDOW_MAX = SMART_CUT_WINDOW_MAX;
588
+ exports.SMART_CUT_WINDOW_MIN = SMART_CUT_WINDOW_MIN;
589
+ exports.SPEAKER_TRACKS_MAX_BOXES_PER_SOURCE = SPEAKER_TRACKS_MAX_BOXES_PER_SOURCE;
590
+ exports.SPEAKER_TRACKS_MAX_BYTES = SPEAKER_TRACKS_MAX_BYTES;
591
+ exports.SPEAKER_TRACKS_VERSION = SPEAKER_TRACKS_VERSION;
592
+ exports.SPEAKER_TRACK_ATTRIBUTION_METHODS = SPEAKER_TRACK_ATTRIBUTION_METHODS;
593
+ exports.asEditPlanMode = asEditPlanMode;
594
+ exports.asEditPlanTier = asEditPlanTier;
595
+ exports.buildEditPlanCreditId = buildEditPlanCreditId;
596
+ exports.cameraSwitchCameras = cameraSwitchCameras;
597
+ exports.cameraSwitchEdlProblem = cameraSwitchEdlProblem;
598
+ exports.cameraSwitchSettingsPayload = cameraSwitchSettingsPayload;
599
+ exports.clampCameraSwitchSetting = clampCameraSwitchSetting;
600
+ exports.clampEditPlanClipCount = clampEditPlanClipCount;
601
+ exports.clampSmartCutWindow = clampSmartCutWindow;
602
+ exports.cleanSpeakerNames = cleanSpeakerNames;
603
+ exports.defaultSpeakerMap = defaultSpeakerMap;
604
+ exports.describeSpeakerTracks = describeSpeakerTracks;
605
+ exports.editPlanBucketMinutes = editPlanBucketMinutes;
606
+ exports.editPlanFlatCreditId = editPlanFlatCreditId;
607
+ exports.editPlanMinutesBaseCredits = editPlanMinutesBaseCredits;
608
+ exports.editPlanMinutesCreditId = editPlanMinutesCreditId;
609
+ exports.editPlanRateCreditId = editPlanRateCreditId;
610
+ exports.editPlanReserveCreditId = editPlanReserveCreditId;
611
+ exports.editPlanStartedMinutes = editPlanStartedMinutes;
612
+ exports.edlSpeakerSpace = edlSpeakerSpace;
613
+ exports.getAudioCrossfadeCurve = getAudioCrossfadeCurve;
614
+ exports.normalizeSpeakerTrackSetDescriptor = normalizeSpeakerTrackSetDescriptor;
615
+ exports.normalizeSpeakerTracks = normalizeSpeakerTracks;
616
+ exports.parseEditPlanMinutesCreditId = parseEditPlanMinutesCreditId;
617
+ exports.parseEditPlanMode = parseEditPlanMode;
618
+ exports.resolveAudioCrossfadeCurve = resolveAudioCrossfadeCurve;
619
+ exports.transcriptSpeakerLabels = transcriptSpeakerLabels;
620
+ exports.unwrapEditPlanOutput = unwrapEditPlanOutput;
621
+ exports.validateSpeakerTrackSetDescriptor = validateSpeakerTrackSetDescriptor;
622
+ exports.validateSpeakerTracks = validateSpeakerTracks;
623
+ //# sourceMappingURL=chunk-SES6GDBQ.cjs.map
624
+ //# sourceMappingURL=chunk-SES6GDBQ.cjs.map