hyperframes 0.9.30 → 0.9.32

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 (278) hide show
  1. package/dist/{add-JBBBMWP4.js → add-HYI4YJC5.js} +16 -16
  2. package/dist/{agentPromptGenerator-NJL6ZJQA.js → agentPromptGenerator-JAQNBEUZ.js} +35 -18
  3. package/dist/{animatedGifPrep-AVZAMI2D.js → animatedGifPrep-DVYRCZVR.js} +10 -10
  4. package/dist/api.js +40 -36
  5. package/dist/{appHistory-DLDRURHW.js → appHistory-WZIHFCPK.js} +3 -3
  6. package/dist/{asset-VFG5LF4B.js → asset-7FG3M3FQ.js} +2 -2
  7. package/dist/{assetCataloger-WGNEAI5A.js → assetCataloger-QDQZYHUC.js} +12 -12
  8. package/dist/{audio-URYC7ND7.js → audio-R6ZG62DU.js} +20 -19
  9. package/dist/{auth-E4ZBU47K.js → auth-IPDYZXOG.js} +2 -2
  10. package/dist/{autoUpdate-CEYR6IHF.js → autoUpdate-GAEDDZRN.js} +2 -2
  11. package/dist/{avatars-ZPRQ3ZCD.js → avatars-A45VFUZ4.js} +14 -14
  12. package/dist/{backgroundChecks-BL4XMMXE.js → backgroundChecks-US74BS6V.js} +3 -3
  13. package/dist/backgroundChecksWorker.js +4 -4
  14. package/dist/{batchRender-FK7U2GUF.js → batchRender-VBSYVQA7.js} +5 -5
  15. package/dist/{beats-XK4QL74K.js → beats-UPJ3KANG.js} +12 -12
  16. package/dist/{benchmark-MABRDF7U.js → benchmark-2RWYJGL2.js} +10 -10
  17. package/dist/{billing-2CABBLDC.js → billing-MD66MJTA.js} +15 -15
  18. package/dist/{browser-SHU4XK5O.js → browser-JXCS62NX.js} +7 -7
  19. package/dist/{bundleWithLocalizedFonts-W7SSOXOO.js → bundleWithLocalizedFonts-RAD7BNJF.js} +1 -1
  20. package/dist/{capture-CFESIHJR.js → capture-DJ4WRP62.js} +52 -28
  21. package/dist/{capture-VPWHIN5C.js → capture-M6DT5WZT.js} +4 -4
  22. package/dist/{captureCompositionFrame-MT3CHQJ6.js → captureCompositionFrame-IRXG7ZFU.js} +17 -16
  23. package/dist/{captureFile-O7JMINHC.js → captureFile-Y2ZMB7HK.js} +3 -3
  24. package/dist/{catalog-BBPONQOO.js → catalog-GW45OWKU.js} +16 -16
  25. package/dist/{catch-up-DEZVG3A5.js → catch-up-YKJQ4IYC.js} +10 -10
  26. package/dist/{check-LIC6DYFD.js → check-7QTKMPGA.js} +49 -48
  27. package/dist/{checkAudio-RHF5CWWX.js → checkAudio-7WHUYGUZ.js} +14 -14
  28. package/dist/{checkBrowser-LUHIFDJZ.js → checkBrowser-USAOWTAF.js} +42 -41
  29. package/dist/chunk-262ADJJN.js +193 -0
  30. package/dist/{chunk-2YZ6GA4E.js → chunk-2NMBD5AH.js} +1 -1
  31. package/dist/{chunk-BUYUJ3EV.js → chunk-2T7EDEKE.js} +7 -7
  32. package/dist/{chunk-NTNS5EFN.js → chunk-2W4VQ3YZ.js} +2 -2
  33. package/dist/{chunk-YNRQTFYH.js → chunk-2Z42EUHG.js} +2 -2
  34. package/dist/{chunk-RYT22J4V.js → chunk-3367VNGK.js} +2 -2
  35. package/dist/{chunk-UPVM6UDG.js → chunk-34S7GYVK.js} +9 -4
  36. package/dist/{chunk-QBRBXVCE.js → chunk-3HT3UGF2.js} +1 -1
  37. package/dist/{chunk-AOPNJEQC.js → chunk-3PHCFSPD.js} +2 -2
  38. package/dist/{chunk-NFUXYBOR.js → chunk-3R2X2VKB.js} +2 -2
  39. package/dist/{chunk-RCYKUNVZ.js → chunk-4CSZZXL6.js} +3 -3
  40. package/dist/{chunk-JLUOG6S2.js → chunk-4FTJE22M.js} +2 -2
  41. package/dist/{chunk-Q7FX7HOX.js → chunk-5FFYMVRD.js} +2 -2
  42. package/dist/{chunk-TNZ2EF2Y.js → chunk-5GXMZIQZ.js} +8 -8
  43. package/dist/{chunk-VMLPDIR6.js → chunk-5VN7ZXJR.js} +3 -3
  44. package/dist/{chunk-VEIGTKYZ.js → chunk-64F653HO.js} +36 -9
  45. package/dist/{chunk-VPQXRTEW.js → chunk-6BI6URO2.js} +8 -7
  46. package/dist/{chunk-WJPEMXI3.js → chunk-6MTSP2XE.js} +8 -8
  47. package/dist/{chunk-5RLMHG3E.js → chunk-6NNLDCX4.js} +1 -1
  48. package/dist/{chunk-3OA75WJW.js → chunk-6RFCS4IU.js} +9 -4
  49. package/dist/{chunk-76MHB2H6.js → chunk-6SNGKC6B.js} +1 -1
  50. package/dist/{chunk-SWOAB4GM.js → chunk-77UB5EHM.js} +1 -1
  51. package/dist/{chunk-J4Z7LQKU.js → chunk-ADP2GIBS.js} +2 -2
  52. package/dist/{chunk-CWN75OWQ.js → chunk-AOQRVS63.js} +13 -3
  53. package/dist/{chunk-6FHIR4KD.js → chunk-AWT5FHTN.js} +1 -1
  54. package/dist/{chunk-GQNV4DG6.js → chunk-AZ2QJETV.js} +1 -1
  55. package/dist/{chunk-AGHSWES2.js → chunk-BA3EQ2KL.js} +3 -3
  56. package/dist/{chunk-J3OVTOVC.js → chunk-CHJGVW5W.js} +15 -2
  57. package/dist/{chunk-TCQKCUDA.js → chunk-CKJDY6EK.js} +1 -1
  58. package/dist/{chunk-SPPSVPY7.js → chunk-CMYUPVMI.js} +2 -2
  59. package/dist/{chunk-S3S3IHCR.js → chunk-D6BV6TTI.js} +1 -1
  60. package/dist/{chunk-7DMIAJD7.js → chunk-D7NNNL2K.js} +13 -13
  61. package/dist/{chunk-FNC3JNO7.js → chunk-E5S4QMX7.js} +2 -2
  62. package/dist/{chunk-RZK5ZGVX.js → chunk-EBG5RCPM.js} +4 -4
  63. package/dist/{chunk-7GJKUOPX.js → chunk-EJPWGGPK.js} +68 -26
  64. package/dist/{chunk-G3WGKT3B.js → chunk-EXW2LV4K.js} +141 -71
  65. package/dist/{chunk-F2GWIWHN.js → chunk-G2XAFJ2B.js} +2 -2
  66. package/dist/{chunk-OSDNRYQJ.js → chunk-G6JLFSII.js} +9 -73
  67. package/dist/{chunk-FJQGA6H6.js → chunk-G7NKYELQ.js} +23 -15
  68. package/dist/{chunk-FRBQ3FIM.js → chunk-GBIASKIH.js} +1 -1
  69. package/dist/{chunk-XVDXYUQJ.js → chunk-GCJRV7LU.js} +28 -8
  70. package/dist/{chunk-UTU3HSJS.js → chunk-GJUL3PRV.js} +4 -4
  71. package/dist/{chunk-BIQJKM2O.js → chunk-GOMTMQRT.js} +1 -1
  72. package/dist/{chunk-VHOETOGT.js → chunk-GTHRXU37.js} +15 -15
  73. package/dist/{chunk-AMZ22QP7.js → chunk-GWSCUFGL.js} +2 -2
  74. package/dist/{chunk-5QGDLMU3.js → chunk-H4C3P2KV.js} +3 -3
  75. package/dist/{chunk-V4Z37HFN.js → chunk-H7AJLEBR.js} +26 -23
  76. package/dist/{chunk-B23DUMZ4.js → chunk-HDCVU64B.js} +1 -1
  77. package/dist/{chunk-LMCFILEY.js → chunk-HWMNSWEA.js} +6 -6
  78. package/dist/{chunk-NZUUKNNZ.js → chunk-HXQDDCGY.js} +1 -1
  79. package/dist/{chunk-OFQWTKPW.js → chunk-HZTRKUKE.js} +8 -2
  80. package/dist/{chunk-AW2M5TZW.js → chunk-I3QXWJ7V.js} +7 -7
  81. package/dist/{chunk-IEXRKKHC.js → chunk-IEEIPTDW.js} +1 -1
  82. package/dist/{chunk-MSL2BS73.js → chunk-JHX76QFC.js} +1 -1
  83. package/dist/{chunk-MVJ7AX6W.js → chunk-JMV63CNH.js} +14 -11
  84. package/dist/{chunk-V4ZFL2E2.js → chunk-K72X2YXR.js} +3 -3
  85. package/dist/{chunk-F4Z2UPAA.js → chunk-KAG5KXNO.js} +2 -2
  86. package/dist/{chunk-IYYZMZD2.js → chunk-KFXHBP2E.js} +2 -2
  87. package/dist/{chunk-YAKPBJOU.js → chunk-KG3TONXU.js} +6 -6
  88. package/dist/{chunk-HYRPH6LL.js → chunk-KRWPTZBY.js} +2 -5
  89. package/dist/{chunk-2II5FCVK.js → chunk-KXOKZJBZ.js} +10 -10
  90. package/dist/{chunk-ZGQZTSP2.js → chunk-L72MPEM2.js} +1 -1
  91. package/dist/{chunk-BJYCLZBQ.js → chunk-LBQQNNRC.js} +1 -1
  92. package/dist/{chunk-SP5GQGP2.js → chunk-LHFBKUVY.js} +2 -2
  93. package/dist/{chunk-5IAFM6M5.js → chunk-LJMTEZOP.js} +10 -10
  94. package/dist/{chunk-NLKHXPTZ.js → chunk-LXIEKLAC.js} +5 -5
  95. package/dist/{chunk-PVRJKEU5.js → chunk-M6FNCANA.js} +1 -1
  96. package/dist/{chunk-WGVWW6O4.js → chunk-M6LAGO6O.js} +2 -2
  97. package/dist/{chunk-EPOBJVVG.js → chunk-MYFAVVA6.js} +22 -22
  98. package/dist/{chunk-XEPGN46Q.js → chunk-N6Y645MX.js} +1 -1
  99. package/dist/{chunk-IOPIOX5K.js → chunk-N7C7U3ZR.js} +7 -4
  100. package/dist/{chunk-EBU7T3WZ.js → chunk-NNOAOQLT.js} +2 -2
  101. package/dist/{chunk-6LCIO2YY.js → chunk-NXSKZE3C.js} +2 -2
  102. package/dist/{chunk-DYKBB5HB.js → chunk-P5E3RHW3.js} +2 -2
  103. package/dist/{chunk-IX3K55NA.js → chunk-P7TCIUP2.js} +4 -4
  104. package/dist/{chunk-YJYEKNJG.js → chunk-PVSRPNIV.js} +1 -1
  105. package/dist/{chunk-5SDUQLZ3.js → chunk-PXDRW3QN.js} +1 -1
  106. package/dist/{chunk-MKZ34726.js → chunk-PXY3JZP2.js} +2 -2
  107. package/dist/{chunk-HCC7XLD7.js → chunk-RCRUWNQ4.js} +3 -3
  108. package/dist/{chunk-GGDJLN5I.js → chunk-REJ4NIBY.js} +1 -1
  109. package/dist/{chunk-PGZSYDLZ.js → chunk-SFPIVVUE.js} +2 -2
  110. package/dist/{chunk-LDTJCZZ2.js → chunk-SIRYW7SY.js} +2 -2
  111. package/dist/{chunk-SHOE3UR6.js → chunk-SVI2CJ6R.js} +1 -1
  112. package/dist/{chunk-JVAD6LD7.js → chunk-SXOIG6VG.js} +540 -390
  113. package/dist/chunk-TFBPCJPG.js +26 -0
  114. package/dist/{chunk-74PW4UVC.js → chunk-TLUDJLBN.js} +1 -1
  115. package/dist/{chunk-P74B5H73.js → chunk-TTSLKH63.js} +3 -3
  116. package/dist/chunk-TVQNABOI.js +82 -0
  117. package/dist/{chunk-CK3DD2MC.js → chunk-TZH6HNZH.js} +2 -2
  118. package/dist/{chunk-3F2DTPBD.js → chunk-UC4X6I35.js} +6 -0
  119. package/dist/{chunk-3JFV42QB.js → chunk-UWMOMAYI.js} +35 -7
  120. package/dist/{chunk-DJVSNDF3.js → chunk-VB3JZKMN.js} +104 -14
  121. package/dist/{chunk-JHOPRAJN.js → chunk-VK3MQSA2.js} +11 -5
  122. package/dist/{chunk-YZH2IWEE.js → chunk-W3HNLDK6.js} +2 -2
  123. package/dist/{chunk-KMGF6GJU.js → chunk-WLNQAJQC.js} +2 -2
  124. package/dist/{chunk-LRDS7MG5.js → chunk-WTO4DHBH.js} +1 -1
  125. package/dist/{chunk-ALVXFXUG.js → chunk-WXOOAAT4.js} +27 -4
  126. package/dist/{chunk-J7PDBGQM.js → chunk-X6DWLN55.js} +3 -3
  127. package/dist/{chunk-NBF7SU6Q.js → chunk-XB7HE2R5.js} +3 -3
  128. package/dist/{chunk-2QUQKYOK.js → chunk-XDRSEU2I.js} +63 -33
  129. package/dist/{chunk-XKSHWUIF.js → chunk-XH6LGDIB.js} +4 -4
  130. package/dist/{chunk-HKWKMXAC.js → chunk-XPT4GC6X.js} +6 -6
  131. package/dist/{chunk-2NK3K7JL.js → chunk-Y3YHDU7T.js} +1 -1
  132. package/dist/{chunk-SWC3QIEH.js → chunk-YAS347ZS.js} +1 -1
  133. package/dist/chunk-YAZQBB2S.js +5049 -0
  134. package/dist/{chunk-4TCEF2I7.js → chunk-YCTWMO3G.js} +1 -1
  135. package/dist/{chunk-NHJ5YUBZ.js → chunk-YIE5FU73.js} +3 -3
  136. package/dist/{chunk-HLRYLZFX.js → chunk-YMIEJZB6.js} +3 -3
  137. package/dist/{chunk-WCSEEQ5R.js → chunk-Z6X64P6C.js} +3 -3
  138. package/dist/{chunk-54FVSPRH.js → chunk-ZIYXPDKY.js} +2 -2
  139. package/dist/{clean-AGQEPUBC.js → clean-MJBET4EN.js} +26 -26
  140. package/dist/cli.js +64 -64
  141. package/dist/{cloud-H5HJH6SD.js → cloud-WEDQYHZE.js} +4 -4
  142. package/dist/{cloud-TDXVUIUM.js → cloud-Z4Q76MLS.js} +3 -3
  143. package/dist/{cloudrun-7BR5FKOC.js → cloudrun-2KGSRAKA.js} +7 -7
  144. package/dist/{compare-YWZ6O2FL.js → compare-MJKWQOD7.js} +41 -40
  145. package/dist/{compiler-ZSIKBZBR.js → compiler-ETXRTUQC.js} +6 -6
  146. package/dist/{component-MX2PJOTA.js → component-PZGKEJ6L.js} +3 -3
  147. package/dist/{compositions-PLT4OLGR.js → compositions-N3FEEWH7.js} +14 -14
  148. package/dist/{contactSheet-PZXG3REG.js → contactSheet-HZMP42FZ.js} +4 -4
  149. package/dist/{curve-BJYCZUEY.js → curve-MWABBM7Q.js} +14 -14
  150. package/dist/{cuts-TWAVF7WI.js → cuts-BQFSSNY7.js} +15 -15
  151. package/dist/{delete-3KCBCPBD.js → delete-HPHGJABK.js} +5 -5
  152. package/dist/deploy-JY2QOB5F.js +213 -0
  153. package/dist/{describeProject-HZLM3B55.js → describeProject-S6AGYZWL.js} +11 -11
  154. package/dist/{destroy-4DOMPOYB.js → destroy-AZK7J4IR.js} +19 -15
  155. package/dist/{deterministicFonts-SKRN3TCP.js → deterministicFonts-2ZPRAI3C.js} +4 -4
  156. package/dist/{diff-XC6IU3IY.js → diff-XDNFCAU4.js} +36 -36
  157. package/dist/{dist-EFXKPJJT.js → dist-6EE3Y4M7.js} +3 -3
  158. package/dist/{dist-M5WQQ6WE.js → dist-EYEYDD4F.js} +20 -18
  159. package/dist/{dist-QRXJMFI7.js → dist-TYGDYK56.js} +4 -4
  160. package/dist/docs/rendering.md +2 -0
  161. package/dist/{doctor-VRUSZ6GH.js → doctor-6IRSMKZD.js} +16 -16
  162. package/dist/{energy-VNAAJYAW.js → energy-VCJ2FJEF.js} +15 -15
  163. package/dist/{events-MR72RS47.js → events-DNTIMCUM.js} +17 -17
  164. package/dist/{events-WZJTLFCQ.js → events-M6A7BT3V.js} +7 -7
  165. package/dist/{events-6WYNARX7.js → events-QQYBD7JM.js} +2 -2
  166. package/dist/{extract-MKOCZIFN.js → extract-X3IVXYHX.js} +15 -15
  167. package/dist/{face-NIV5ZSUX.js → face-MZHXKBDB.js} +16 -16
  168. package/dist/{feedback-A4F4G5JO.js → feedback-TAMGYFUO.js} +15 -11
  169. package/dist/{ffmpeg-OAKTUK5S.js → ffmpeg-XWPYYYB6.js} +10 -10
  170. package/dist/{figma-4WZIDYAD.js → figma-WMD7AR2S.js} +3 -3
  171. package/dist/fontLocalizeCli.js +17 -17
  172. package/dist/{frames-DAKLRIWG.js → frames-OU2UOLBU.js} +17 -17
  173. package/dist/{generate-NRPHH4NJ.js → generate-6F6QEFXW.js} +26 -26
  174. package/dist/{get-ISXQCK3G.js → get-VVDO7DXG.js} +5 -5
  175. package/dist/{gpuPolicy-SLVPAQK2.js → gpuPolicy-CVNSHXHJ.js} +10 -10
  176. package/dist/{grade-compare-TVMAAZVC.js → grade-compare-O6LY2U73.js} +40 -39
  177. package/dist/{gsapParser-3H7ON3DO.js → gsapParser-L7TM3RGH.js} +49 -26
  178. package/dist/hangReport.js +1 -1
  179. package/dist/{heifImagePrep-BOIWW7FW.js → heifImagePrep-J6TILZTM.js} +11 -11
  180. package/dist/{help-ZOYDS3YW.js → help-XLSTTDHR.js} +1 -1
  181. package/dist/{history-CLGGMJ7Z.js → history-DBCCWBDG.js} +13 -13
  182. package/dist/hyperframe.manifest.json +1 -1
  183. package/dist/hyperframe.runtime.iife.js +67 -67
  184. package/dist/hyperframes-player.global.js +3 -3
  185. package/dist/{info-ZTFII4N4.js → info-E46BWAQ7.js} +16 -16
  186. package/dist/{init-RCDPQKFA.js → init-23TG5W7S.js} +33 -33
  187. package/dist/{ink-2ATPIDWC.js → ink-6UFSNJRW.js} +15 -15
  188. package/dist/{inspect-GDMUC5F6.js → inspect-RKI6XACH.js} +40 -39
  189. package/dist/{installer-VPGNKCEU.js → installer-JWPK75BR.js} +8 -8
  190. package/dist/{keyframes-EPAX446T.js → keyframes-J65V5A2G.js} +10 -10
  191. package/dist/{lambda-HG6Y6KOH.js → lambda-RZSXXBJU.js} +19 -19
  192. package/dist/{layout-KXBKGHOS.js → layout-RJQUOYWB.js} +40 -39
  193. package/dist/{lint-O62OPAW7.js → lint-4TUHKKA2.js} +12 -12
  194. package/dist/{lintProject-5CBL7VFV.js → lintProject-R6RTBSCZ.js} +3 -3
  195. package/dist/{list-4HWWKMM6.js → list-HOD2N4VS.js} +5 -5
  196. package/dist/{localPage-66UVNGQR.js → localPage-TC4NC3VL.js} +11 -11
  197. package/dist/{login-2H4XMPUT.js → login-NTOS3HKD.js} +4 -4
  198. package/dist/{look-W6PV445D.js → look-GC63E2I7.js} +15 -15
  199. package/dist/{manager-ML4OLLSM.js → manager-FICBET24.js} +11 -11
  200. package/dist/{measure-CWOXQCGH.js → measure-WTQCSQ55.js} +11 -11
  201. package/dist/{media-treatment-SDGXF2PK.js → media-treatment-KTZ6X2P2.js} +16 -16
  202. package/dist/{media-use-NWNX24MD.js → media-use-K75FDXJ3.js} +10 -5
  203. package/dist/{models-J2P2DLSA.js → models-JKOA542M.js} +14 -14
  204. package/dist/{motionShot-VQ2KFPMR.js → motionShot-A3TYKTQU.js} +20 -19
  205. package/dist/{normalize-audio-MABOG5XR.js → normalize-audio-7JUM42YB.js} +12 -12
  206. package/dist/{open-KWTFPDML.js → open-F6GI4TRA.js} +18 -18
  207. package/dist/{parakeetRunner-GP47AAVT.js → parakeetRunner-6XIAKJLS.js} +17 -17
  208. package/dist/{pipeline-5HUQFOCY.js → pipeline-7P7LGGQG.js} +13 -13
  209. package/dist/{play-6MSC2ZCU.js → play-DYOZLKWX.js} +36 -30
  210. package/dist/{preflight-NTJMXUS2.js → preflight-VM4HSRBY.js} +11 -11
  211. package/dist/{present-X5T75QS4.js → present-IINIEZJC.js} +30 -24
  212. package/dist/{preview-7NW7RUET.js → preview-NJO2UXWJ.js} +35 -26
  213. package/dist/{probe-XTZVXTQ2.js → probe-LQQHFX5Q.js} +15 -15
  214. package/dist/{producer-ZZROH3WZ.js → producer-LH2SZHJ2.js} +1 -1
  215. package/dist/{progress-TGYZ2TKQ.js → progress-IY6U35WH.js} +1 -1
  216. package/dist/{projectConfig-UHYPGWD5.js → projectConfig-BLACFLUW.js} +11 -11
  217. package/dist/{publication-5KOANEHK.js → publication-NFF2BXIE.js} +6 -6
  218. package/dist/{publish-3BBHK2NK.js → publish-JST5Y4UR.js} +19 -17
  219. package/dist/{remove-background-W7WMLL5C.js → remove-background-WUBESLWN.js} +14 -14
  220. package/dist/{render-5G6745C3.js → render-4KWUUC5H.js} +81 -44
  221. package/dist/{render-ZGCH2FZJ.js → render-DA4V7CEE.js} +8 -8
  222. package/dist/{render-ZIBXBMNI.js → render-R4VNR4E2.js} +34 -30
  223. package/dist/{render-batch-ONWJJ627.js → render-batch-JMPG4RLT.js} +8 -8
  224. package/dist/renderSetupWorker.js +4 -4
  225. package/dist/{resolver-ZWNLOG6O.js → resolver-PNIFIDIE.js} +8 -8
  226. package/dist/{reverse-5YTLWWDZ.js → reverse-4NI7D2C3.js} +1 -1
  227. package/dist/{run-24USN7TA.js → run-FWBIBLYE.js} +4 -3
  228. package/dist/{screenshotCapture-ZZE3GMOF.js → screenshotCapture-KOLNFU7W.js} +13 -12
  229. package/dist/{sherpa-7ISRANWA.js → sherpa-W3BMN67E.js} +16 -16
  230. package/dist/sherpaWorker.js +1 -1
  231. package/dist/{sites-LILUBMRM.js → sites-QK3F4AUS.js} +1 -1
  232. package/dist/skills/hyperframes-cli/references/preview-render.md +1 -0
  233. package/dist/skills/media-use/audio/scripts/lib/heygen.mjs +15 -4
  234. package/dist/skills/media-use/audio/scripts/lib/heygen.test.mjs +42 -6
  235. package/dist/skills/media-use/audio/scripts/lib/python.mjs +17 -2
  236. package/dist/skills/media-use/audio/scripts/lib/python.test.mjs +50 -4
  237. package/dist/skills/media-use/audio/scripts/lib/tts.mjs +11 -1
  238. package/dist/skills/media-use/scripts/lib/svg-sanitize.mjs +2 -1
  239. package/dist/skills/media-use/scripts/lib/tts-local-provider.test.mjs +31 -0
  240. package/dist/{skills-YMSZHKK4.js → skills-KQQVUFGO.js} +10 -10
  241. package/dist/{skillsUpdateCheck-YJYYN5CH.js → skillsUpdateCheck-VY5PS46S.js} +3 -3
  242. package/dist/{snapshot-4MZGXL4A.js → snapshot-VIEJQAUB.js} +82 -56
  243. package/dist/{src-NIMSUB4P.js → src-HHPRCLEW.js} +11 -9
  244. package/dist/{src-CHPZUZZ3.js → src-MQU5F7GJ.js} +15 -15
  245. package/dist/{start-FPEBVENS.js → start-ZBNNVFMU.js} +24 -24
  246. package/dist/{state-W3AS6O2J.js → state-7OIPR4BG.js} +1 -1
  247. package/dist/{staticProjectServer-XZNME57Y.js → staticProjectServer-VPGZWJF4.js} +27 -27
  248. package/dist/{status-7TRDJU47.js → status-RBZJYT7T.js} +17 -17
  249. package/dist/studio/assets/{codec-B1UWDNJp.js → codec-Bz1jsLs8.js} +1 -1
  250. package/dist/studio/assets/{hyperframes-player-DQd2VPm2.js → hyperframes-player-cdH5Sz_t.js} +1 -1
  251. package/dist/studio/assets/{index-gkyTLE7n.js → index-D1l7izdf.js} +176 -176
  252. package/dist/studio/assets/{index-B7CtVv8e.js → index-DFRbcd5J.js} +1 -1
  253. package/dist/studio/assets/{pausedVideoDecoder-Bfv1WSlz.js → pausedVideoDecoder-CgV8YB6S.js} +1 -1
  254. package/dist/studio/index.html +1 -1
  255. package/dist/{studio-api-JKJXAELI.js → studio-api-EPZGLIWW.js} +20 -18
  256. package/dist/{studioServer-UCRCZOLS.js → studioServer-YFQQ2ESJ.js} +72 -62
  257. package/dist/{sync-E72XNR2G.js → sync-FRT55PVW.js} +15 -15
  258. package/dist/{synthesize-MDW4ZWTN.js → synthesize-FR5KPBRP.js} +4 -4
  259. package/dist/{telemetry-L5D3U4IO.js → telemetry-HAPPFR7P.js} +7 -7
  260. package/dist/{templates-O7HEL7HC.js → templates-2IHYIWMA.js} +15 -15
  261. package/dist/{timeline-QTODTYKQ.js → timeline-AY2F7BJF.js} +25 -25
  262. package/dist/{tokens-D7JYFE2K.js → tokens-B3G257V3.js} +2 -2
  263. package/dist/{transcribe-FGVGCTEU.js → transcribe-EGQD32PT.js} +14 -14
  264. package/dist/{transcribe-D2WFL2RO.js → transcribe-RJCILGPA.js} +30 -30
  265. package/dist/{tts-IXX2HHHJ.js → tts-ZE776B4I.js} +1 -1
  266. package/dist/{update-SCMEUTRM.js → update-XTFIGQKW.js} +12 -11
  267. package/dist/{updateCheck-KNTQDXMN.js → updateCheck-M6YC52A4.js} +2 -2
  268. package/dist/{upgrade-V2BP5PAQ.js → upgrade-AKLIZKAO.js} +5 -3
  269. package/dist/{urlDownloader-4RWM3UH2.js → urlDownloader-57A7Q7FC.js} +9 -9
  270. package/dist/{validate-W3E6QVJ6.js → validate-YWSXJL54.js} +32 -31
  271. package/dist/{video-KC4AFMAY.js → video-I5DDNK3Y.js} +12 -12
  272. package/dist/{voices-7N6QU3C6.js → voices-IBMJU73H.js} +24 -24
  273. package/dist/warmCheck.js +50 -49
  274. package/dist/warmCheckClient.js +1 -1
  275. package/package.json +1 -1
  276. package/dist/chunk-2X4PQEYM.js +0 -34
  277. package/dist/chunk-F24B2PLD.js +0 -5049
  278. package/dist/deploy-KWTMJNBL.js +0 -361
@@ -11,21 +11,21 @@ import {
11
11
  iterateFontFamilyDeclarations,
12
12
  normalizeSystemFontPrimaryFamilies,
13
13
  resolveFontFamilyDeclarationFamilies
14
- } from "./chunk-JLUOG6S2.js";
14
+ } from "./chunk-4FTJE22M.js";
15
15
  import {
16
16
  Semaphore,
17
17
  prepareHeifImageInputs,
18
18
  withMediaProbeSlot
19
- } from "./chunk-HCC7XLD7.js";
19
+ } from "./chunk-RCRUWNQ4.js";
20
20
  import {
21
21
  EncoderInterruptedError,
22
22
  encoderFailureError,
23
23
  prepareAnimatedGifInputs
24
- } from "./chunk-J7PDBGQM.js";
24
+ } from "./chunk-X6DWLN55.js";
25
25
  import {
26
26
  openRangeEnd,
27
27
  parseEncoderOptions
28
- } from "./chunk-VEIGTKYZ.js";
28
+ } from "./chunk-64F653HO.js";
29
29
  import {
30
30
  RENDER_TEMP_DIR,
31
31
  createStudioPositionSeekReapplyScript
@@ -139,6 +139,7 @@ import {
139
139
  isVideoPastTimelineEnd,
140
140
  keyframeIntervalToGopSize,
141
141
  measureVideoShownBoxes,
142
+ mediaIdPathSegment,
142
143
  mergeWorkerFrames,
143
144
  muxVideoWithAudio,
144
145
  normalizeObjectFit,
@@ -186,7 +187,7 @@ import {
186
187
  videoAudioId,
187
188
  videoStartOnMediaTimeline,
188
189
  writeCapturedFrame
189
- } from "./chunk-7GJKUOPX.js";
190
+ } from "./chunk-EJPWGGPK.js";
190
191
  import {
191
192
  assignBundledRuntimeCompositionIds,
192
193
  emitMountedModuleScripts,
@@ -198,13 +199,13 @@ import {
198
199
  parsesAsScript,
199
200
  prepareFlattenedInnerRoot,
200
201
  stripSdrPngColourTags
201
- } from "./chunk-NHJ5YUBZ.js";
202
+ } from "./chunk-YIE5FU73.js";
202
203
  import {
203
204
  collectScratchLeftovers,
204
205
  createStagingDir,
205
206
  removeScratch,
206
207
  renameWithRetry
207
- } from "./chunk-IEXRKKHC.js";
208
+ } from "./chunk-IEEIPTDW.js";
208
209
  import {
209
210
  TRANSITIONS,
210
211
  convertTransfer,
@@ -227,7 +228,7 @@ import {
227
228
  redactTelemetryString,
228
229
  resolveAuthoredTimingWindow,
229
230
  toFps
230
- } from "./chunk-RYT22J4V.js";
231
+ } from "./chunk-3367VNGK.js";
231
232
  import {
232
233
  COMPOSITION_SOURCE_URL,
233
234
  HF_COLOR_GRADING_ATTR,
@@ -262,14 +263,14 @@ import {
262
263
  sourceTimeAt,
263
264
  styleElementsFor,
264
265
  timeAtSourceTime
265
- } from "./chunk-F24B2PLD.js";
266
+ } from "./chunk-YAZQBB2S.js";
266
267
  import {
267
268
  chromeMajorCeiling
268
269
  } from "./chunk-WE42NVH7.js";
269
270
  import {
270
271
  lintHyperframeHtml,
271
272
  resolveReferencedStart
272
- } from "./chunk-DJVSNDF3.js";
273
+ } from "./chunk-VB3JZKMN.js";
273
274
  import {
274
275
  isUnresolvedAssetPlaceholder,
275
276
  readProjectFile,
@@ -308,14 +309,14 @@ import {
308
309
  isAspectAgnosticResolutionAlias,
309
310
  normalizeResolutionFlag,
310
311
  suggestMatchingPreset
311
- } from "./chunk-IOPIOX5K.js";
312
+ } from "./chunk-N7C7U3ZR.js";
312
313
  import {
313
314
  parseHTML
314
315
  } from "./chunk-GWTIFRF5.js";
315
316
 
316
317
  // ../producer/src/services/renderOrchestrator.ts
317
318
  import {
318
- existsSync as existsSync20,
319
+ existsSync as existsSync21,
319
320
  mkdirSync as mkdirSync10,
320
321
  readdirSync as readdirSync6,
321
322
  rmSync as rmSync10,
@@ -325,7 +326,7 @@ import {
325
326
  appendFileSync
326
327
  } from "fs";
327
328
  import { tmpdir as tmpdir2 } from "os";
328
- import { join as join28, dirname as dirname11, resolve as resolve6 } from "path";
329
+ import { join as join29, dirname as dirname11, resolve as resolve6 } from "path";
329
330
  import { totalmem as totalmem2 } from "os";
330
331
  import { randomUUID } from "crypto";
331
332
  import { fileURLToPath as fileURLToPath4 } from "url";
@@ -1226,6 +1227,33 @@ function resolveDeliveryEncoderOptions(config) {
1226
1227
  return { maxBitrate, bufferSize, ...gop };
1227
1228
  }
1228
1229
 
1230
+ // ../producer/src/services/render/chromaSubsampling.ts
1231
+ function validateChromaSubsamplingConfig(config) {
1232
+ if (config.chromaSubsampling !== "444") return;
1233
+ const format = config.format ?? "mp4";
1234
+ if (format !== "mp4") {
1235
+ throw new Error(
1236
+ `[Render] chromaSubsampling "444" supports format "mp4" only (got "${format}"). WebM, MOV and GIF use their own pixel formats, and HLS targets broad playback. Use --format mp4, or drop --chroma-subsampling 444.`
1237
+ );
1238
+ }
1239
+ if (config.hdrMode === "force-hdr") {
1240
+ throw new Error(
1241
+ `[Render] chromaSubsampling "444" is SDR only; HDR output stays 10-bit 4:2:0 H.265. Drop --hdr, or drop --chroma-subsampling 444.`
1242
+ );
1243
+ }
1244
+ if (config.useGpu === true) {
1245
+ throw new Error(
1246
+ `[Render] chromaSubsampling "444" requires the software encoder (libx264); GPU encoders do not reliably support 4:4:4. Re-run without --gpu.`
1247
+ );
1248
+ }
1249
+ }
1250
+ function assertChromaSubsamplingSdr(config, hasHdrContent) {
1251
+ if (config.chromaSubsampling !== "444" || !hasHdrContent) return;
1252
+ throw new Error(
1253
+ `[Render] chromaSubsampling "444" is SDR only, but this composition has HDR sources. Re-run with --sdr (hdrMode "force-sdr"), or drop --chroma-subsampling 444.`
1254
+ );
1255
+ }
1256
+
1229
1257
  // ../producer/src/services/render/shared.ts
1230
1258
  import {
1231
1259
  copyFileSync,
@@ -1330,6 +1358,10 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
1330
1358
  writeFileSync(join3(compileDir, "index.html"), compiled.html, "utf-8");
1331
1359
  for (const [srcPath, html] of compiled.subCompositions) {
1332
1360
  const outPath = join3(compileDir, srcPath);
1361
+ if (!isPathInside2(outPath, compileDir)) {
1362
+ console.warn(`[Render] Skipping sub-composition with unsafe path: ${srcPath}`);
1363
+ continue;
1364
+ }
1333
1365
  mkdirSync(dirname2(outPath), { recursive: true });
1334
1366
  writeFileSync(outPath, html, "utf-8");
1335
1367
  }
@@ -1591,7 +1623,7 @@ function materializeExtractedFramesForCompiledDir(extracted, compiledDir, option
1591
1623
  for (const ext of extracted) {
1592
1624
  const resolvedOut = pathModule.resolve(ext.outputDir);
1593
1625
  if (isPathInside2(resolvedOut, resolvedCompiledDir, { pathModule })) continue;
1594
- const linkPath = pathModule.join(compiledFrameRoot, ext.videoId);
1626
+ const linkPath = pathModule.join(compiledFrameRoot, mediaIdPathSegment(ext.videoId));
1595
1627
  if (!fileSystem.existsSync(linkPath)) {
1596
1628
  fileSystem.mkdirSync(pathModule.dirname(linkPath), { recursive: true });
1597
1629
  stageExtractedFrameDir(
@@ -5584,7 +5616,7 @@ async function extractDeferredFrames(input) {
5584
5616
  const shown = shownDeferredFrameIndexes(input, input.frames, input.fps);
5585
5617
  return Promise.all(
5586
5618
  deferred.map(async (video) => {
5587
- const outputDir = join11(input.outputRoot, video.videoId);
5619
+ const outputDir = join11(input.outputRoot, mediaIdPathSegment(video.videoId));
5588
5620
  const indexes = [...shown.get(video.videoId) ?? []].sort((a, b) => a - b);
5589
5621
  if (indexes.length === 0) {
5590
5622
  return { ...video, outputDir, framePaths: /* @__PURE__ */ new Map(), ownedByLookup: false };
@@ -6433,13 +6465,24 @@ function countAuthoredTimedClips(html) {
6433
6465
  }
6434
6466
 
6435
6467
  // ../producer/src/services/render/stages/compileStage.ts
6436
- import { existsSync as existsSync11, writeFileSync as writeFileSync4 } from "fs";
6437
- import { join as join16 } from "path";
6468
+ import { existsSync as existsSync12, writeFileSync as writeFileSync4 } from "fs";
6469
+ import { join as join17 } from "path";
6438
6470
 
6439
6471
  // ../producer/src/services/htmlCompiler.ts
6440
6472
  import { createHash as createHash4 } from "crypto";
6441
- import { createReadStream as createReadStream2, existsSync as existsSync10, mkdirSync as mkdirSync7, readFileSync as readFileSync5 } from "fs";
6442
- import { join as join15, dirname as dirname6, resolve as resolve5, basename as basename5, relative as relative2, sep as sep2 } from "path";
6473
+ import { createReadStream as createReadStream2, existsSync as existsSync11, mkdirSync as mkdirSync7, readFileSync as readFileSync6 } from "fs";
6474
+ import { join as join16, dirname as dirname6, resolve as resolve5, basename as basename5, relative as relative2, sep as sep2 } from "path";
6475
+
6476
+ // ../producer/src/services/bundledScripts.ts
6477
+ import { existsSync as existsSync9, readFileSync as readFileSync5 } from "fs";
6478
+ import { join as join15 } from "path";
6479
+ var GSAP_VENDOR_DIR_ENV = "HYPERFRAMES_GSAP_VENDOR_DIR";
6480
+ function bundledScript(url) {
6481
+ const dir = process.env[GSAP_VENDOR_DIR_ENV];
6482
+ if (!dir || url !== `${gsapCdnDist()}gsap.min.js`) return null;
6483
+ const file = join15(dir, "gsap.min.js");
6484
+ return existsSync9(file) ? readFileSync5(file) : null;
6485
+ }
6443
6486
 
6444
6487
  // ../producer/src/services/renderMediaCollector.ts
6445
6488
  function resolveHostEnd(host, hostStart) {
@@ -6588,7 +6631,7 @@ function getPositionEditsRenderScript() {
6588
6631
  }
6589
6632
 
6590
6633
  // ../producer/src/services/assetMediaType.ts
6591
- import { existsSync as existsSync9 } from "fs";
6634
+ import { existsSync as existsSync10 } from "fs";
6592
6635
  var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
6593
6636
  var AssetMediaTypeMismatchError = class extends Error {
6594
6637
  code = ASSET_MEDIA_TYPE_MISMATCH;
@@ -6654,7 +6697,7 @@ async function preflightCompositionAssetMediaTypes(input) {
6654
6697
  input.projectDir,
6655
6698
  input.compiledDir
6656
6699
  );
6657
- if (!existsSync9(resolvedPath)) continue;
6700
+ if (!existsSync10(resolvedPath)) continue;
6658
6701
  byPath.set(resolvedPath, [...byPath.get(resolvedPath) ?? [], reference]);
6659
6702
  }
6660
6703
  const mismatches = [];
@@ -6907,8 +6950,8 @@ function detectShaderTransitionUsage(html) {
6907
6950
  async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, downloadDir, tagName, elementIdentity, log, urlByAbsentLocalPath, probes) {
6908
6951
  let filePath = src;
6909
6952
  if (isHttpUrl(src)) {
6910
- const remoteDir = join15(downloadDir, REMOTE_MEDIA_SUBDIR);
6911
- if (!existsSync10(remoteDir)) mkdirSync7(remoteDir, { recursive: true });
6953
+ const remoteDir = join16(downloadDir, REMOTE_MEDIA_SUBDIR);
6954
+ if (!existsSync11(remoteDir)) mkdirSync7(remoteDir, { recursive: true });
6912
6955
  try {
6913
6956
  filePath = await downloadToTemp(src, remoteDir, void 0, void 0, void 0, {
6914
6957
  onTelemetry: logRemoteDownloadTelemetry
@@ -6918,10 +6961,10 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, down
6918
6961
  }
6919
6962
  } else {
6920
6963
  filePath = decodedUrlPath(src);
6921
- if (!filePath.startsWith("/")) filePath = join15(baseDir, filePath);
6964
+ if (!filePath.startsWith("/")) filePath = join16(baseDir, filePath);
6922
6965
  filePath = urlByAbsentLocalPath?.get(filePath) ?? filePath;
6923
6966
  }
6924
- if (!isHttpUrl(filePath) && !existsSync10(filePath)) {
6967
+ if (!isHttpUrl(filePath) && !existsSync11(filePath)) {
6925
6968
  return { duration: null, resolvedPath: filePath };
6926
6969
  }
6927
6970
  const withSrcContext = (error) => {
@@ -7270,7 +7313,7 @@ function inlineSubCompositions2(html, subCompositions, projectDir, variableOverr
7270
7313
  parseHtml: (htmlStr) => parseHTML(htmlStr).document,
7271
7314
  // Mirrors the preview bundler: a sub-composition's SIBLING assets resolve
7272
7315
  // against its own directory, project-root refs stay as authored.
7273
- assetExists: (path) => existsSync10(resolve5(projectDir, path)),
7316
+ assetExists: (path) => existsSync11(resolve5(projectDir, path)),
7274
7317
  // Preserve the authored root wrapper as a child of the host, matching
7275
7318
  // the preview bundler's shape (htmlBundler.ts's prepareFlattenedInnerRoot,
7276
7319
  // which the runtime compositionLoader mirrors with its own copy for the
@@ -7415,12 +7458,17 @@ async function inlineExternalScripts(html) {
7415
7458
  if (externalScripts.length === 0) return html;
7416
7459
  const downloads = await Promise.allSettled(
7417
7460
  externalScripts.map(async ({ el, src }) => {
7461
+ const integrity = el.getAttribute("integrity") || "";
7462
+ const bundled = bundledScript(src);
7463
+ if (bundled && matchesScriptIntegrity(bundled, integrity)) {
7464
+ return { src, text: new TextDecoder().decode(bundled) };
7465
+ }
7418
7466
  const response = await fetch(src, {
7419
7467
  signal: AbortSignal.timeout(15e3)
7420
7468
  });
7421
7469
  if (!response.ok) throw new Error(`HTTP ${response.status} for ${src}`);
7422
7470
  const bytes = new Uint8Array(await response.arrayBuffer());
7423
- if (!matchesScriptIntegrity(bytes, el.getAttribute("integrity") || "")) {
7471
+ if (!matchesScriptIntegrity(bytes, integrity)) {
7424
7472
  throw new ScriptIntegrityError(`Subresource integrity mismatch for ${src}`);
7425
7473
  }
7426
7474
  return { src, text: new TextDecoder().decode(bytes) };
@@ -7461,7 +7509,7 @@ function collectExternalAssets(html, projectDir) {
7461
7509
  if (isPathInside2(absPath, absProjectDir)) {
7462
7510
  return null;
7463
7511
  }
7464
- if (!existsSync10(absPath)) return null;
7512
+ if (!existsSync11(absPath)) return null;
7465
7513
  const safeKey = toExternalAssetKey(absPath);
7466
7514
  externalAssets.set(safeKey, absPath);
7467
7515
  return safeKey;
@@ -7511,7 +7559,7 @@ var REMOTE_SOURCE_TAG_RE = /<source\b[^>]*?\bsrc\s*=\s*["'](https?:\/\/[^"']+)["
7511
7559
  var REMOTE_IMG_TAG_RE = /<img\b[^>]*?(?<![\w-])src\s*=\s*["'](https?:\/\/[^"']+)["'][^>]*>/gi;
7512
7560
  async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLabel, extraRewrite) {
7513
7561
  if (urlSet.size === 0) return { html, remoteMediaAssets: /* @__PURE__ */ new Map() };
7514
- if (!existsSync10(remoteDir)) mkdirSync7(remoteDir, { recursive: true });
7562
+ if (!existsSync11(remoteDir)) mkdirSync7(remoteDir, { recursive: true });
7515
7563
  const urlToLocal = /* @__PURE__ */ new Map();
7516
7564
  await Promise.all(
7517
7565
  [...urlSet].map(async (url) => {
@@ -7558,7 +7606,7 @@ async function localizeRemoteMediaSources(html, downloadDir) {
7558
7606
  return downloadAndRewriteUrls(
7559
7607
  urlSet,
7560
7608
  html,
7561
- join15(downloadDir, REMOTE_MEDIA_SUBDIR),
7609
+ join16(downloadDir, REMOTE_MEDIA_SUBDIR),
7562
7610
  "Remote media download failed",
7563
7611
  "Localized remote media source(s)"
7564
7612
  );
@@ -7573,7 +7621,7 @@ async function localizeRemoteImageSources(html, downloadDir) {
7573
7621
  return downloadAndRewriteUrls(
7574
7622
  urlSet,
7575
7623
  html,
7576
- join15(downloadDir, REMOTE_MEDIA_SUBDIR),
7624
+ join16(downloadDir, REMOTE_MEDIA_SUBDIR),
7577
7625
  "Remote image download failed",
7578
7626
  "Localized remote image source(s)"
7579
7627
  );
@@ -7589,7 +7637,7 @@ async function localizeRemoteBackgroundImages(html, downloadDir) {
7589
7637
  return downloadAndRewriteUrls(
7590
7638
  urlSet,
7591
7639
  html,
7592
- join15(downloadDir, REMOTE_MEDIA_SUBDIR),
7640
+ join16(downloadDir, REMOTE_MEDIA_SUBDIR),
7593
7641
  "Remote background-image download failed",
7594
7642
  "Localized remote background-image(s)",
7595
7643
  // Quoted url('..')/url("..") are rewritten by downloadAndRewriteUrls' default
@@ -7694,13 +7742,13 @@ function projectStylesheetFontFamilies(html, projectDir) {
7694
7742
  const href = /\bhref=["']([^"']+)["']/i.exec(tag)?.[1];
7695
7743
  if (!href || /^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(href)) continue;
7696
7744
  const sheet = resolve5(projectDir, decodedUrlPath(href).replace(/^(?:\.?\/)+/, ""));
7697
- if (!isPathInside2(sheet, projectDir) || !existsSync10(sheet)) continue;
7698
- for (const face of extractFontFaceBlocks(readFileSync5(sheet, "utf8"))) {
7745
+ if (!isPathInside2(sheet, projectDir) || !existsSync11(sheet)) continue;
7746
+ for (const face of extractFontFaceBlocks(readFileSync6(sheet, "utf8"))) {
7699
7747
  const family = /font-family\s*:\s*([^;}]+)/i.exec(face)?.[1]?.trim().replace(/^['"]|['"]$/g, "");
7700
7748
  const shipsFile = [...face.matchAll(LOCAL_FONTFACE_URL_RE)].some(([, url = ""]) => {
7701
7749
  const path = decodedUrlPath(url);
7702
7750
  const file = path.startsWith("/") ? resolve5(projectDir, `.${path}`) : resolve5(dirname6(sheet), path);
7703
- return isPathInside2(file, projectDir) && existsSync10(file);
7751
+ return isPathInside2(file, projectDir) && existsSync11(file);
7704
7752
  });
7705
7753
  if (family && shipsFile) families.push(family);
7706
7754
  }
@@ -7744,7 +7792,7 @@ function localizeFontFaceUrls(html, downloadDir) {
7744
7792
  return downloadAndRewriteUrls(
7745
7793
  collectFontFaceUrls(html),
7746
7794
  html,
7747
- join15(downloadDir, REMOTE_MEDIA_SUBDIR),
7795
+ join16(downloadDir, REMOTE_MEDIA_SUBDIR),
7748
7796
  "Remote font download failed",
7749
7797
  "Localized remote font face(s)",
7750
7798
  (h, url, relPath) => h.replaceAll(`url(${url})`, `url("${relPath}")`)
@@ -7770,7 +7818,7 @@ async function readLocalFont(absPath) {
7770
7818
  return { kind: "inline", buffer: Buffer.concat(chunks, totalBytes) };
7771
7819
  }
7772
7820
  async function embedLocalFontFaces(html, projectDir) {
7773
- const { fontToDataUri: toDataUri } = await import("./deterministicFonts-SKRN3TCP.js");
7821
+ const { fontToDataUri: toDataUri } = await import("./deterministicFonts-2ZPRAI3C.js");
7774
7822
  const styleBlockRe = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
7775
7823
  const fontFaceRe = /@font-face\s*\{([^}]*)\}/gi;
7776
7824
  let result = html;
@@ -7838,7 +7886,7 @@ function renderGsapDist() {
7838
7886
  }
7839
7887
  function rewriteUnresolvableGsapToCdn(html, projectDir, compSrcPath) {
7840
7888
  let gsapDist;
7841
- const exists = (path) => existsSync10(resolve5(projectDir, path));
7889
+ const exists = (path) => existsSync11(resolve5(projectDir, path));
7842
7890
  return html.replace(
7843
7891
  /(<script\b[^>]*\bsrc=["'])([^"']*gsap[^"']*\/dist\/([^"']+))(["'][^>]*>)/gi,
7844
7892
  (full, prefix, src, file, suffix) => {
@@ -7855,7 +7903,7 @@ function rebaseDirectEntryAssetPaths(html, projectDir, htmlPath) {
7855
7903
  const entryPath = relative2(projectDir, htmlPath).replace(/\\/g, "/");
7856
7904
  if (!entryPath.includes("/")) return html;
7857
7905
  const { document: document2 } = parseHTML(html);
7858
- const assetExists = (path) => existsSync10(resolve5(projectDir, path));
7906
+ const assetExists = (path) => existsSync11(resolve5(projectDir, path));
7859
7907
  rewriteAssetPaths(
7860
7908
  document2.querySelectorAll("[src], [href], [srcset]"),
7861
7909
  entryPath,
@@ -8421,11 +8469,11 @@ function adaptAspectAgnosticResolution(requested, aspectAgnostic, width, height,
8421
8469
  }
8422
8470
  function resolveEntryHtmlPath(input) {
8423
8471
  const { projectDir, workDir, entryFile, log } = input;
8424
- const htmlPath = join16(projectDir, entryFile);
8472
+ const htmlPath = join17(projectDir, entryFile);
8425
8473
  const rawEntry = readTextFile(htmlPath);
8426
8474
  if (entryFile === "index.html" || !isTemplateEntry(rawEntry)) return htmlPath;
8427
- const projectIndexPath = join16(projectDir, "index.html");
8428
- if (!existsSync11(projectIndexPath)) {
8475
+ const projectIndexPath = join17(projectDir, "index.html");
8476
+ if (!existsSync12(projectIndexPath)) {
8429
8477
  throw new Error(
8430
8478
  `Template entry file "${entryFile}" requires a project index.html to extract its render shell.`
8431
8479
  );
@@ -8440,11 +8488,19 @@ function resolveEntryHtmlPath(input) {
8440
8488
  `Entry file "${entryFile}" is not mounted from index.html via data-composition-src, so it cannot be rendered independently.`
8441
8489
  );
8442
8490
  }
8443
- const wrapperPath = join16(workDir, "standalone-entry.html");
8491
+ const wrapperPath = join17(workDir, "standalone-entry.html");
8444
8492
  writeFileSync4(wrapperPath, standaloneHtml, "utf-8");
8445
8493
  log.info("Extracted standalone entry from index.html host context", { entryFile });
8446
8494
  return wrapperPath;
8447
8495
  }
8496
+ function applyChroma444Gate(cfg, chromaSubsampling, gate, log) {
8497
+ if (!cfg.useDrawElement || chromaSubsampling !== "444") return gate;
8498
+ cfg.useDrawElement = false;
8499
+ log.info(
8500
+ "[Render] Fast capture: chromaSubsampling 444 captures lossless PNG frames, so disabling drawElementImage for this render. Capture uses the platform's baseline route."
8501
+ );
8502
+ return "chroma_444";
8503
+ }
8448
8504
  async function runCompileStage(input) {
8449
8505
  const {
8450
8506
  projectDir,
@@ -8461,7 +8517,7 @@ async function runCompileStage(input) {
8461
8517
  } = input;
8462
8518
  const htmlPath = resolveEntryHtmlPath({ projectDir, workDir, entryFile, log });
8463
8519
  const compileStart = Date.now();
8464
- const compiled = await compileForRender(projectDir, htmlPath, join16(workDir, "downloads"), {
8520
+ const compiled = await compileForRender(projectDir, htmlPath, join17(workDir, "downloads"), {
8465
8521
  log,
8466
8522
  failClosedFontFetch: failClosedFontFetch === true,
8467
8523
  allowSystemFontCapture,
@@ -8469,7 +8525,7 @@ async function runCompileStage(input) {
8469
8525
  variables: input.variables,
8470
8526
  urlByAbsentLocalPath: input.urlByAbsentLocalPath,
8471
8527
  pageMotionBlur: input.pageMotionBlur,
8472
- animatedGifCacheDir: cfg.extractCacheDir ? join16(cfg.extractCacheDir, "animated-gif") : void 0,
8528
+ animatedGifCacheDir: cfg.extractCacheDir ? join17(cfg.extractCacheDir, "animated-gif") : void 0,
8473
8529
  ffmpegProcessTimeout: cfg.ffmpegProcessTimeout
8474
8530
  });
8475
8531
  assertNotAborted();
@@ -8496,6 +8552,7 @@ async function runCompileStage(input) {
8496
8552
  "[Render] Fast capture: composition uses shader transitions, so disabling drawElementImage so page-side compositing stays available."
8497
8553
  );
8498
8554
  }
8555
+ deCompileGate = applyChroma444Gate(cfg, job.config.chromaSubsampling, deCompileGate, log);
8499
8556
  if (!cfg.useDrawElement && cfg.pageSideCompositingAutoDisabled) {
8500
8557
  cfg.enablePageSideCompositing = true;
8501
8558
  cfg.pageSideCompositingAutoDisabled = false;
@@ -8526,7 +8583,7 @@ async function runCompileStage(input) {
8526
8583
  };
8527
8584
  await preflightCompositionAssetMediaTypes({
8528
8585
  projectDir,
8529
- compiledDir: join16(workDir, "compiled"),
8586
+ compiledDir: join17(workDir, "compiled"),
8530
8587
  composition,
8531
8588
  signal: abortSignal
8532
8589
  });
@@ -8572,7 +8629,7 @@ async function runCompileStage(input) {
8572
8629
 
8573
8630
  // ../producer/src/services/render/stages/probeStage.ts
8574
8631
  import { createHash as createHash5 } from "crypto";
8575
- import { basename as basename6, join as join17 } from "path";
8632
+ import { basename as basename6, join as join18 } from "path";
8576
8633
 
8577
8634
  // ../producer/src/services/render/stages/probeFailures.ts
8578
8635
  var NETWORK_FAILURE_PATTERN = /404|ERR_NAME_NOT_RESOLVED|ERR_CONNECTION_REFUSED|net::ERR_/i;
@@ -8583,11 +8640,19 @@ function isActionableProbeFailure(line) {
8583
8640
 
8584
8641
  // ../producer/src/services/render/captureImageFormat.ts
8585
8642
  function resolveCaptureImageFormat(input) {
8586
- return input.needsAlpha || input.motionBlur ? "png" : "jpeg";
8643
+ return input.needsAlpha || input.motionBlur || input.chromaSubsampling === "444" ? "png" : "jpeg";
8587
8644
  }
8588
8645
  function resolveCaptureJpegQuality(quality) {
8589
8646
  return quality === "draft" ? 80 : 100;
8590
8647
  }
8648
+ function resolveCaptureSurface(input, quality) {
8649
+ const format = resolveCaptureImageFormat(input);
8650
+ return {
8651
+ format,
8652
+ quality: format === "png" ? void 0 : resolveCaptureJpegQuality(quality),
8653
+ transparent: input.needsAlpha
8654
+ };
8655
+ }
8591
8656
 
8592
8657
  // ../producer/src/services/render/stages/probeStage.ts
8593
8658
  var FRAME_BOUNDARY_EPSILON = 1e-3;
@@ -8757,22 +8822,22 @@ async function runProbeStage(input) {
8757
8822
  });
8758
8823
  fileServer = await createFileServer({
8759
8824
  projectDir,
8760
- compiledDir: join17(workDir, "compiled"),
8825
+ compiledDir: join18(workDir, "compiled"),
8761
8826
  port: 0,
8762
8827
  preHeadScripts: [VIRTUAL_TIME_SHIM],
8763
8828
  fps: job.config.fps
8764
8829
  });
8765
8830
  assertNotAborted();
8766
8831
  const motionBlur = job.config.motionBlur;
8767
- const captureFormat = resolveCaptureImageFormat({ needsAlpha, motionBlur });
8768
8832
  const captureOpts = {
8769
8833
  recordReferenceBackground: input.recordReferenceBackground,
8770
8834
  width,
8771
8835
  height,
8772
8836
  fps: job.config.fps,
8773
- format: captureFormat,
8774
- transparent: needsAlpha,
8775
- quality: captureFormat === "png" ? void 0 : resolveCaptureJpegQuality(job.config.quality),
8837
+ ...resolveCaptureSurface(
8838
+ { needsAlpha, motionBlur, chromaSubsampling: job.config.chromaSubsampling },
8839
+ job.config.quality
8840
+ ),
8776
8841
  variables: job.config.variables,
8777
8842
  deviceScaleFactor,
8778
8843
  motionBlur,
@@ -8787,7 +8852,7 @@ async function runProbeStage(input) {
8787
8852
  log.info("Creating capture session...", { attempt, maxAttempts: PROBE_MAX_ATTEMPTS });
8788
8853
  probeSession = await createCaptureSession(
8789
8854
  fileServer.url,
8790
- join17(workDir, "probe"),
8855
+ join18(workDir, "probe"),
8791
8856
  captureOpts,
8792
8857
  null,
8793
8858
  probeCfg
@@ -8872,7 +8937,7 @@ async function runProbeStage(input) {
8872
8937
  });
8873
8938
  probeSession = await createCaptureSession(
8874
8939
  fileServer.url,
8875
- join17(workDir, "probe-screenshot"),
8940
+ join18(workDir, "probe-screenshot"),
8876
8941
  captureOpts,
8877
8942
  null,
8878
8943
  { ...probeCfg, forceScreenshot: true }
@@ -8910,7 +8975,7 @@ async function runProbeStage(input) {
8910
8975
  compiled,
8911
8976
  resolutions,
8912
8977
  projectDir,
8913
- join17(workDir, "downloads")
8978
+ join18(workDir, "downloads")
8914
8979
  );
8915
8980
  assertNotAborted();
8916
8981
  composition.videos = compiled.videos;
@@ -9101,7 +9166,7 @@ async function runProbeStage(input) {
9101
9166
  }
9102
9167
  await preflightCompositionAssetMediaTypes({
9103
9168
  projectDir,
9104
- compiledDir: join17(workDir, "compiled"),
9169
+ compiledDir: join18(workDir, "compiled"),
9105
9170
  composition,
9106
9171
  signal: abortSignal
9107
9172
  });
@@ -9258,8 +9323,8 @@ function validateDistributedDuration(input) {
9258
9323
  }
9259
9324
 
9260
9325
  // ../producer/src/services/render/stages/extractVideosStage.ts
9261
- import { existsSync as existsSync12 } from "fs";
9262
- import { join as join18 } from "path";
9326
+ import { existsSync as existsSync13 } from "fs";
9327
+ import { join as join19 } from "path";
9263
9328
 
9264
9329
  // ../producer/src/services/render/extractionFailureMetadata.ts
9265
9330
  function stringOrEmpty(value) {
@@ -9515,7 +9580,7 @@ async function runExtractVideosStage(input) {
9515
9580
  const probeFailures = await Promise.all(
9516
9581
  composition.videos.map(async (v) => {
9517
9582
  const videoPath = resolveProjectRelativeSrc(v.src, projectDir, compiledDir);
9518
- if (!existsSync12(videoPath)) return null;
9583
+ if (!existsSync13(videoPath)) return null;
9519
9584
  try {
9520
9585
  const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata(videoPath), retries: 0 } : await runVideoExtractionWithRetry(() => extractMediaMetadata(videoPath), {
9521
9586
  signal: abortSignal,
@@ -9553,7 +9618,7 @@ async function runExtractVideosStage(input) {
9553
9618
  const probed = await Promise.all(
9554
9619
  composition.images.map(async (img) => {
9555
9620
  const imgPath = resolveProjectRelativeSrc(img.src, projectDir, compiledDir);
9556
- if (!existsSync12(imgPath)) return null;
9621
+ if (!existsSync13(imgPath)) return null;
9557
9622
  const colorSpace = await probeColorSpaceSafely(imgPath, log);
9558
9623
  if (isHdrColorSpace(colorSpace)) {
9559
9624
  nativeHdrImageIds.add(img.id);
@@ -9587,14 +9652,14 @@ async function runExtractVideosStage(input) {
9587
9652
  // because short boundary counts can differ by one frame.
9588
9653
  {
9589
9654
  fps: job.config.fps,
9590
- outputDir: join18(compiledDir, "__hyperframes_video_frames"),
9655
+ outputDir: join19(compiledDir, "__hyperframes_video_frames"),
9591
9656
  format: job.config.videoFrameFormat ?? "auto",
9592
9657
  toneMapHdrToSdr: rendersSdrOnly(job.config, composition),
9593
9658
  timelineEnd: composition.duration,
9594
9659
  maxTransientRetries: extractionPolicy.maxTransientRetries,
9595
9660
  collectProbeFailures: extractionPolicy.failureMode === "enforce",
9596
9661
  deferRangeExtraction,
9597
- contentKeyedDirs: [join18(compiledDir, REMOTE_MEDIA_SUBDIR)],
9662
+ contentKeyedDirs: [join19(compiledDir, REMOTE_MEDIA_SUBDIR)],
9598
9663
  urlByAbsentLocalPath,
9599
9664
  onProgress: ({ planned = 0, done = 0 }) => {
9600
9665
  framesPlanned += planned;
@@ -9673,7 +9738,7 @@ async function appendVideoAudioFromProbe(input) {
9673
9738
  videos.map(async (video) => {
9674
9739
  const path = isHttpUrl(video.src) ? video.src : resolveProjectRelativeSrc(video.src, projectDir, compiledDir);
9675
9740
  const readFrom = urlByAbsentLocalPath?.get(path) ?? path;
9676
- if (!isHttpUrl(readFrom) && !existsSync12(readFrom)) return null;
9741
+ if (!isHttpUrl(readFrom) && !existsSync13(readFrom)) return null;
9677
9742
  const metadata = await extractMediaMetadata(readFrom);
9678
9743
  const window2 = await resolveFinalFrameExtractionWindow(
9679
9744
  readFrom,
@@ -9693,7 +9758,7 @@ async function appendVideoAudioFromProbe(input) {
9693
9758
  }
9694
9759
 
9695
9760
  // ../producer/src/services/render/videoLayerPassthroughPlan.ts
9696
- import { existsSync as existsSync13 } from "fs";
9761
+ import { existsSync as existsSync14 } from "fs";
9697
9762
  var SAMPLES = 9;
9698
9763
  function inspectVideoLayout(id, w, h, time) {
9699
9764
  window.__hf?.seek?.(time);
@@ -9755,7 +9820,7 @@ async function planVideoLayerPassthrough(input) {
9755
9820
  const { video } = q;
9756
9821
  if (isHttpUrl(video.src)) return { reason: "remote_source" };
9757
9822
  const path = resolveProjectRelativeSrc(video.src, input.projectDir, input.compiledDir);
9758
- if (!existsSync13(path)) return { reason: "source_missing" };
9823
+ if (!existsSync14(path)) return { reason: "source_missing" };
9759
9824
  const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
9760
9825
  if ("reason" in layout) return layout;
9761
9826
  const layer = await buildVideoLayerInput(
@@ -9770,16 +9835,16 @@ async function planVideoLayerPassthrough(input) {
9770
9835
  }
9771
9836
 
9772
9837
  // ../producer/src/services/render/stages/audioStage.ts
9773
- import { existsSync as existsSync15 } from "fs";
9774
- import { join as join21 } from "path";
9838
+ import { existsSync as existsSync16 } from "fs";
9839
+ import { join as join22 } from "path";
9775
9840
 
9776
9841
  // ../producer/src/services/render/audioDeliveryLimit.ts
9777
- import { existsSync as existsSync14 } from "fs";
9778
- import { dirname as dirname8, join as join20 } from "path";
9842
+ import { existsSync as existsSync15 } from "fs";
9843
+ import { dirname as dirname8, join as join21 } from "path";
9779
9844
 
9780
9845
  // ../producer/src/services/render/audioPadTrim.ts
9781
9846
  import { spawn } from "child_process";
9782
- import { dirname as dirname7, join as join19 } from "path";
9847
+ import { dirname as dirname7, join as join20 } from "path";
9783
9848
 
9784
9849
  // ../producer/src/services/render/audioTruePeak.ts
9785
9850
  var toDbfs = (token) => token.toLowerCase() === "-inf" ? Number.NEGATIVE_INFINITY : Number(token);
@@ -10039,7 +10104,7 @@ async function constrainAacTruePeak(input) {
10039
10104
  }
10040
10105
  async function cutSource(input, scratchDir, attenuationDb) {
10041
10106
  if (!input.sourcePath || !input.rewriteSource) return true;
10042
- const cutPath = join19(scratchDir, "source.wav");
10107
+ const cutPath = join20(scratchDir, "source.wav");
10043
10108
  try {
10044
10109
  const result = await input.rewriteSource(input.sourcePath, cutPath, gainFilter(attenuationDb));
10045
10110
  if (!result.success) throw new Error(result.error);
@@ -10054,7 +10119,7 @@ async function enforceAacTruePeak(input) {
10054
10119
  let scratchDir;
10055
10120
  try {
10056
10121
  scratchDir = createStagingDir(dirname7(input.audioPath), ".true-peak-");
10057
- const correctedPath = join19(scratchDir, "audio.m4a");
10122
+ const correctedPath = join20(scratchDir, "audio.m4a");
10058
10123
  const measurements = [];
10059
10124
  let attenuationDb = 0;
10060
10125
  let sourcePeakDbfs;
@@ -10257,14 +10322,14 @@ async function limitDeliveryPeaks(input, deps = {
10257
10322
  applyChain: applyAudioFxChain,
10258
10323
  encode: encodeAac,
10259
10324
  rename: renameWithRetry,
10260
- sourceExists: existsSync14
10325
+ sourceExists: existsSync15
10261
10326
  }) {
10262
10327
  const { audioPath, sourcePath, signal, timeoutMs } = input;
10263
10328
  if (!deps.sourceExists(sourcePath)) return { success: true };
10264
10329
  const peak = await deps.measure(audioPath, { timeoutMs, signal });
10265
10330
  if (peak <= AAC_DELIVERY_TRUE_PEAK_DBFS) return { success: true };
10266
10331
  const alternating = ["a", "b"].map(
10267
- (k) => join20(dirname8(sourcePath), `audio-source-limited-${k}.wav`)
10332
+ (k) => join21(dirname8(sourcePath), `audio-source-limited-${k}.wav`)
10268
10333
  );
10269
10334
  let encodedFrom;
10270
10335
  let ceiling = AAC_DELIVERY_TRUE_PEAK_DBFS;
@@ -10336,7 +10401,7 @@ function runAudioStage(input) {
10336
10401
  }
10337
10402
  async function runAudioStageScoped(input) {
10338
10403
  const stageStart = Date.now();
10339
- const pcmSourcePath = join21(input.workDir, "audio-source.wav");
10404
+ const pcmSourcePath = join22(input.workDir, "audio-source.wav");
10340
10405
  const duration = input.totalFrames * input.fps.den / input.fps.num;
10341
10406
  let deliverySourcePath;
10342
10407
  try {
@@ -10352,7 +10417,7 @@ async function runAudioStageScoped(input) {
10352
10417
  );
10353
10418
  audioLoweredDb = guard.loweredDb;
10354
10419
  input.log?.info("[audio] phases", { ...result.audioPhaseMs, guard: Date.now() - guardStart });
10355
- if (input.keepDeliverySource && !guard.sourceStale && existsSync15(pcmSourcePath)) {
10420
+ if (input.keepDeliverySource && !guard.sourceStale && existsSync16(pcmSourcePath)) {
10356
10421
  deliverySourcePath = pcmSourcePath;
10357
10422
  }
10358
10423
  }
@@ -10401,7 +10466,7 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
10401
10466
  assertNotAborted,
10402
10467
  log
10403
10468
  } = input;
10404
- const audioOutputPath = join21(workDir, MIXED_AUDIO_FILENAME);
10469
+ const audioOutputPath = join22(workDir, MIXED_AUDIO_FILENAME);
10405
10470
  let hasAudio = false;
10406
10471
  let audioError;
10407
10472
  let audioFailures;
@@ -10412,7 +10477,7 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
10412
10477
  audioResult = await processCompositionAudio(
10413
10478
  audios,
10414
10479
  projectDir,
10415
- join21(workDir, "audio-work"),
10480
+ join22(workDir, "audio-work"),
10416
10481
  audioOutputPath,
10417
10482
  duration,
10418
10483
  abortSignal,
@@ -10480,8 +10545,8 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
10480
10545
  }
10481
10546
 
10482
10547
  // ../producer/src/services/render/stages/captureStage.ts
10483
- import { existsSync as existsSync16, readdirSync as readdirSync4, statfsSync as statfsSync2 } from "fs";
10484
- import { join as join22 } from "path";
10548
+ import { existsSync as existsSync17, readdirSync as readdirSync4, statfsSync as statfsSync2 } from "fs";
10549
+ import { join as join23 } from "path";
10485
10550
  function shouldAllowAdaptiveCaptureRetry(workerCount, _explicitlyConfigured) {
10486
10551
  return workerCount > 1;
10487
10552
  }
@@ -10537,16 +10602,16 @@ function diskCaptureShortfallError(needBytes, freeBytes, framesDir, basis, remed
10537
10602
  }
10538
10603
  function measureCaptureFrameBytes(workDir, framesDir) {
10539
10604
  let total = sampleDirectoryBytes(framesDir);
10540
- if (!existsSync16(workDir)) return total;
10605
+ if (!existsSync17(workDir)) return total;
10541
10606
  for (const attempt of readdirSync4(workDir)) {
10542
10607
  if (/^retry-\d+-batch-\d+-worker-\d+$/.test(attempt)) {
10543
- total += sampleDirectoryBytes(join22(workDir, attempt));
10608
+ total += sampleDirectoryBytes(join23(workDir, attempt));
10544
10609
  continue;
10545
10610
  }
10546
10611
  if (!/^capture-attempt-\d+$/.test(attempt)) continue;
10547
- const attemptDir = join22(workDir, attempt);
10612
+ const attemptDir = join23(workDir, attempt);
10548
10613
  for (const name of readdirSync4(attemptDir)) {
10549
- if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(join22(attemptDir, name));
10614
+ if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(join23(attemptDir, name));
10550
10615
  }
10551
10616
  }
10552
10617
  return total;
@@ -10844,8 +10909,8 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
10844
10909
  }
10845
10910
 
10846
10911
  // ../producer/src/services/render/stages/captureHdrStage.ts
10847
- import { existsSync as existsSync18, mkdirSync as mkdirSync8 } from "fs";
10848
- import { join as join26 } from "path";
10912
+ import { existsSync as existsSync19, mkdirSync as mkdirSync8 } from "fs";
10913
+ import { join as join27 } from "path";
10849
10914
 
10850
10915
  // ../producer/src/services/hdrImageTransferCache.ts
10851
10916
  var DEFAULT_MAX_BYTES = 200 * 1024 * 1024;
@@ -10907,7 +10972,7 @@ function createHdrImageTransferCache(options = {}) {
10907
10972
  }
10908
10973
 
10909
10974
  // ../producer/src/services/render/stages/captureHdrSequentialLoop.ts
10910
- import { join as join23 } from "path";
10975
+ import { join as join24 } from "path";
10911
10976
  async function runSequentialLayeredFrameLoop(input) {
10912
10977
  const {
10913
10978
  job,
@@ -11028,7 +11093,7 @@ async function runSequentialLayeredFrameLoop(input) {
11028
11093
  );
11029
11094
  if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
11030
11095
  writeFileExclusiveSync(
11031
- join23(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
11096
+ join24(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
11032
11097
  normalCanvas
11033
11098
  );
11034
11099
  }
@@ -11060,14 +11125,14 @@ async function runSequentialLayeredFrameLoop(input) {
11060
11125
  }
11061
11126
 
11062
11127
  // ../producer/src/services/render/stages/captureHdrHybridLoop.ts
11063
- import { join as join25 } from "path";
11128
+ import { join as join26 } from "path";
11064
11129
 
11065
11130
  // ../producer/src/services/shaderTransitionWorkerPool.ts
11066
11131
  import { Worker } from "worker_threads";
11067
11132
  import { fileURLToPath as fileURLToPath3, pathToFileURL } from "url";
11068
- import { dirname as dirname9, join as join24 } from "path";
11133
+ import { dirname as dirname9, join as join25 } from "path";
11069
11134
  import { createRequire } from "module";
11070
- import { existsSync as existsSync17 } from "fs";
11135
+ import { existsSync as existsSync18 } from "fs";
11071
11136
  import { cpus as cpus2 } from "os";
11072
11137
  function resolveWorkerEntry(explicit) {
11073
11138
  if (explicit && explicit.length > 0) {
@@ -11079,9 +11144,9 @@ function resolveWorkerEntry(explicit) {
11079
11144
  return { path: override, isTs };
11080
11145
  }
11081
11146
  const moduleDir = dirname9(fileURLToPath3(import.meta.url));
11082
- const jsPath = join24(moduleDir, "shaderTransitionWorker.js");
11083
- if (existsSync17(jsPath)) return { path: jsPath, isTs: false };
11084
- const tsPath = join24(moduleDir, "shaderTransitionWorker.ts");
11147
+ const jsPath = join25(moduleDir, "shaderTransitionWorker.js");
11148
+ if (existsSync18(jsPath)) return { path: jsPath, isTs: false };
11149
+ const tsPath = join25(moduleDir, "shaderTransitionWorker.ts");
11085
11150
  return { path: tsPath, isTs: true };
11086
11151
  }
11087
11152
  function buildExecArgv(entryIsTs) {
@@ -11449,7 +11514,7 @@ async function runHybridLayeredFrameLoop(input) {
11449
11514
  );
11450
11515
  if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
11451
11516
  writeFileExclusiveSync(
11452
- join25(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
11517
+ join26(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
11453
11518
  canvas
11454
11519
  );
11455
11520
  }
@@ -11640,8 +11705,8 @@ async function runCaptureHdrStage(input) {
11640
11705
  if (hdrVideoFrameSources.has(v.id)) hdrVideoEndTimes.set(v.id, v.end);
11641
11706
  }
11642
11707
  const debugDumpEnabled = process.env.KEEP_TEMP === "1";
11643
- const debugDumpDir = debugDumpEnabled ? join26(framesDir, "debug-composite") : null;
11644
- if (debugDumpDir && !existsSync18(debugDumpDir)) {
11708
+ const debugDumpDir = debugDumpEnabled ? join27(framesDir, "debug-composite") : null;
11709
+ if (debugDumpDir && !existsSync19(debugDumpDir)) {
11645
11710
  mkdirSync8(debugDumpDir, { recursive: true });
11646
11711
  }
11647
11712
  const compositeTransfer = resolveCompositeTransfer(hasHdrContent, effectiveHdr);
@@ -11798,16 +11863,16 @@ async function runCaptureHdrStage(input) {
11798
11863
  // ../producer/src/services/render/stages/encodeStage.ts
11799
11864
  import {
11800
11865
  copyFileSync as copyFileSync2,
11801
- existsSync as existsSync19,
11866
+ existsSync as existsSync20,
11802
11867
  mkdirSync as mkdirSync9,
11803
11868
  readdirSync as readdirSync5,
11804
- readFileSync as readFileSync6,
11869
+ readFileSync as readFileSync7,
11805
11870
  rmSync as rmSync9,
11806
11871
  statSync as statSync6,
11807
11872
  writeFileSync as writeFileSync5
11808
11873
  } from "fs";
11809
11874
  import { readFile as readFile2 } from "fs/promises";
11810
- import { dirname as dirname10, join as join27 } from "path";
11875
+ import { dirname as dirname10, join as join28 } from "path";
11811
11876
 
11812
11877
  // ../producer/src/services/render/stages/gifEncodeArgs.ts
11813
11878
  function fpsToFfmpegArg2(fps) {
@@ -11880,7 +11945,7 @@ async function reencodeWithClearedWholeFrames(argsInput, run, startTime) {
11880
11945
  const error = formatFfmpegError(result.exitCode, result.stderr);
11881
11946
  return gifEncodeFailure(startTime, outputPath, error, result.failureReason);
11882
11947
  }
11883
- const gif = readFileSync6(outputPath);
11948
+ const gif = readFileSync7(outputPath);
11884
11949
  if (!clearGifFramesBeforeNext(gif)) {
11885
11950
  const error = "[FFmpeg] GIF output could not be parsed to clear its frames";
11886
11951
  return gifEncodeFailure(startTime, outputPath, error);
@@ -11913,11 +11978,11 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
11913
11978
  return gifEncodeFailure(startTime, outputPath, error, result.failureReason);
11914
11979
  }
11915
11980
  }
11916
- if (input.preserveAlpha && gifClearsAfterLeavingFrameInPlace(readFileSync6(outputPath)) !== false) {
11981
+ if (input.preserveAlpha && gifClearsAfterLeavingFrameInPlace(readFileSync7(outputPath)) !== false) {
11917
11982
  const failure = await reencodeWithClearedWholeFrames(argsInput, run, startTime);
11918
11983
  if (failure) return failure;
11919
11984
  }
11920
- const fileSize = existsSync19(outputPath) ? statSync6(outputPath).size : 0;
11985
+ const fileSize = existsSync20(outputPath) ? statSync6(outputPath).size : 0;
11921
11986
  return {
11922
11987
  success: true,
11923
11988
  outputPath,
@@ -12003,7 +12068,7 @@ function encodeWhileCapturing(input, totalFrames) {
12003
12068
  await new Promise((resolve11) => wake = resolve11);
12004
12069
  }
12005
12070
  if (signal.aborted) return;
12006
- const mergedPath = join27(input.framesDir, formatCaptureFrameName(next, "jpg"));
12071
+ const mergedPath = join28(input.framesDir, formatCaptureFrameName(next, "jpg"));
12007
12072
  const frame = await readLandedFrame(landed.get(next), mergedPath);
12008
12073
  landed.delete(next);
12009
12074
  if (!await stream.writeFrame(frame)) {
@@ -12078,7 +12143,7 @@ async function runEncodeStage(input) {
12078
12143
  const stage5Start = Date.now();
12079
12144
  if (isPngSequence) {
12080
12145
  const encoded = startEncodeProgress(job, "Writing PNG sequence", onProgress);
12081
- if (!existsSync19(outputPath)) mkdirSync9(outputPath, { recursive: true });
12146
+ if (!existsSync20(outputPath)) mkdirSync9(outputPath, { recursive: true });
12082
12147
  const captured = readdirSync5(framesDir).filter((name) => name.endsWith(".png")).sort();
12083
12148
  if (captured.length === 0) {
12084
12149
  throw new Error(
@@ -12086,11 +12151,11 @@ async function runEncodeStage(input) {
12086
12151
  );
12087
12152
  }
12088
12153
  captured.forEach((name, i) => {
12089
- const dst = join27(outputPath, formatExportFrameName(i, "png"));
12090
- copyFileSync2(join27(framesDir, name), dst);
12154
+ const dst = join28(outputPath, formatExportFrameName(i, "png"));
12155
+ copyFileSync2(join28(framesDir, name), dst);
12091
12156
  });
12092
- if (hasAudio && audioOutputPath && existsSync19(audioOutputPath)) {
12093
- copyFileSync2(audioOutputPath, join27(outputPath, MIXED_AUDIO_FILENAME));
12157
+ if (hasAudio && audioOutputPath && existsSync20(audioOutputPath)) {
12158
+ copyFileSync2(audioOutputPath, join28(outputPath, MIXED_AUDIO_FILENAME));
12094
12159
  log.info(
12095
12160
  `[Render] png-sequence: ${MIXED_AUDIO_FILENAME} sidecar written to ${outputPath}/${MIXED_AUDIO_FILENAME}`
12096
12161
  );
@@ -12110,7 +12175,7 @@ async function runEncodeStage(input) {
12110
12175
  const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
12111
12176
  fps: job.config.fps,
12112
12177
  loop,
12113
- palettePath: join27(dirname10(videoOnlyPath), "gif-palette.png"),
12178
+ palettePath: join28(dirname10(videoOnlyPath), "gif-palette.png"),
12114
12179
  preserveAlpha: needsAlpha,
12115
12180
  signal: abortSignal,
12116
12181
  timeout: engineCfg.ffmpegEncodeTimeout
@@ -12320,7 +12385,7 @@ function sampleDirectoryBytes(dir) {
12320
12385
  continue;
12321
12386
  }
12322
12387
  for (const name of entries) {
12323
- const full = join28(current, name);
12388
+ const full = join29(current, name);
12324
12389
  try {
12325
12390
  const st = statSync7(full);
12326
12391
  if (st.isDirectory()) {
@@ -12476,8 +12541,8 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
12476
12541
  const ranges = [];
12477
12542
  let rangeStart = null;
12478
12543
  for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
12479
- const framePath = join28(framesDir, formatCaptureFrameName(frameIndex, frameExt));
12480
- const missing = !existsSync20(framePath) || statSync7(framePath).size <= 8;
12544
+ const framePath = join29(framesDir, formatCaptureFrameName(frameIndex, frameExt));
12545
+ const missing = !existsSync21(framePath) || statSync7(framePath).size <= 8;
12481
12546
  if (missing && rangeStart === null) {
12482
12547
  rangeStart = frameIndex;
12483
12548
  } else if (!missing && rangeStart !== null) {
@@ -12493,7 +12558,7 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
12493
12558
  function buildMissingFrameRetryBatches(ranges, maxWorkers, workDir, attempt, rangeStart = 0, stride = 1) {
12494
12559
  const workersPerBatch = Math.max(1, Math.floor(maxWorkers));
12495
12560
  const batches = [];
12496
- const outputDirFor = (batchIndex, workerId) => join28(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`);
12561
+ const outputDirFor = (batchIndex, workerId) => join29(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`);
12497
12562
  if (stride > 1) {
12498
12563
  const spans = /* @__PURE__ */ new Map();
12499
12564
  for (const range of ranges) {
@@ -12553,8 +12618,8 @@ function getNextRetryWorkerCount(currentWorkers) {
12553
12618
  return Math.max(1, Math.floor(currentWorkers / 2));
12554
12619
  }
12555
12620
  function resolveRenderWorkDirPrefix(outputPath, jobId, platform2 = process.platform, systemTempDir = tmpdir2()) {
12556
- if (platform2 === "win32" || platform2 === "darwin") return join28(systemTempDir, "hf-render-");
12557
- return join28(dirname11(outputPath), `work-${jobId}-`);
12621
+ if (platform2 === "win32" || platform2 === "darwin") return join29(systemTempDir, "hf-render-");
12622
+ return join29(dirname11(outputPath), `work-${jobId}-`);
12558
12623
  }
12559
12624
  var MAX_TRANSIENT_CAPTURE_RETRIES = 1;
12560
12625
  function isTransientCaptureRetryEligible(failureKind, missing, retriesUsed) {
@@ -12567,13 +12632,20 @@ function resetCaptureAttemptProgress(job) {
12567
12632
  job.framesRendered = 0;
12568
12633
  }
12569
12634
  var FIRST_FRAME_STALL_MS = 3e5;
12635
+ var FIRST_FRAME_STARTUP_FACTOR = 2;
12636
+ var FIRST_FRAME_STALL_CEILING_MS = 9e5;
12570
12637
  var TAIL_STALL_MS = FIRST_FRAME_STALL_MS;
12571
- function frameStallRule(job, totalFrames) {
12638
+ function firstFrameWindowMs(probeStartupMs) {
12639
+ const fromStartup = (probeStartupMs ?? 0) * FIRST_FRAME_STARTUP_FACTOR;
12640
+ if (!Number.isFinite(fromStartup)) return FIRST_FRAME_STALL_MS;
12641
+ return Math.max(FIRST_FRAME_STALL_MS, Math.min(FIRST_FRAME_STALL_CEILING_MS, fromStartup));
12642
+ }
12643
+ function frameStallRule(job, totalFrames, probeStartupMs) {
12572
12644
  const noProgressMs = resolveCaptureStallTimeoutMs();
12573
12645
  return {
12574
12646
  progress: () => job.framesRendered ?? 0,
12575
12647
  noProgressMs,
12576
- firstProgressMs: Math.max(FIRST_FRAME_STALL_MS, noProgressMs),
12648
+ firstProgressMs: Math.max(firstFrameWindowMs(probeStartupMs), noProgressMs),
12577
12649
  complete: () => (job.framesRendered ?? 0) >= totalFrames,
12578
12650
  tailMs: Math.max(TAIL_STALL_MS, noProgressMs),
12579
12651
  detail: () => describeWorkerPhases(job),
@@ -12601,8 +12673,8 @@ The composition is too large for the available memory. To reduce memory pressure
12601
12673
  function countCapturedFrames(totalFrames, framesDir, frameExt) {
12602
12674
  let captured = 0;
12603
12675
  for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
12604
- const framePath = join28(framesDir, formatCaptureFrameName(frameIndex, frameExt));
12605
- if (existsSync20(framePath)) captured++;
12676
+ const framePath = join29(framesDir, formatCaptureFrameName(frameIndex, frameExt));
12677
+ if (existsSync21(framePath)) captured++;
12606
12678
  }
12607
12679
  return captured;
12608
12680
  }
@@ -12627,7 +12699,7 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
12627
12699
  reason: attempt === 0 ? "initial" : pendingTransientRetry ? "transient-retry" : "retry"
12628
12700
  });
12629
12701
  pendingTransientRetry = false;
12630
- const attemptWorkDir = join28(options.workDir, `capture-attempt-${attempt}`);
12702
+ const attemptWorkDir = join29(options.workDir, `capture-attempt-${attempt}`);
12631
12703
  const batches = missingRanges ? buildMissingFrameRetryBatches(
12632
12704
  missingRanges,
12633
12705
  currentWorkers,
@@ -13260,18 +13332,19 @@ function deVerifyFallbackTelemetry(err) {
13260
13332
  }
13261
13333
  function resolveRenderDebugDir() {
13262
13334
  const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve6(process.env.PRODUCER_RENDERS_DIR, "..") : resolve6(dirname11(fileURLToPath4(import.meta.url)), "../..");
13263
- return join28(producerRoot, ".debug");
13335
+ return join29(producerRoot, ".debug");
13264
13336
  }
13265
13337
  async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
13266
13338
  validateHlsRenderConfig(job.config);
13267
13339
  validateDeliveryEncoderConfig(job.config);
13340
+ validateChromaSubsamplingConfig(job.config);
13268
13341
  const debugDir = resolveRenderDebugDir();
13269
13342
  const outputDir = dirname11(outputPath);
13270
- if (!existsSync20(outputDir)) mkdirSync10(outputDir, { recursive: true });
13271
- const workDir = job.config.debug ? join28(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
13343
+ if (!existsSync21(outputDir)) mkdirSync10(outputDir, { recursive: true });
13344
+ const workDir = job.config.debug ? join29(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
13272
13345
  const pipelineStart = Date.now();
13273
13346
  const baseLog = job.config.logger ?? defaultLogger;
13274
- const logPath = job.config.debug ? join28(workDir, "render.log") : null;
13347
+ const logPath = job.config.debug ? join29(workDir, "render.log") : null;
13275
13348
  const execution = new RenderExecutionContext({
13276
13349
  request: { renderJobId: job.id, projectDir, outputPath },
13277
13350
  logger: logPath ? createRenderFileLogger(logPath, baseLog) : baseLog,
@@ -13333,7 +13406,7 @@ async function executeRenderPipeline(input) {
13333
13406
  imageDecodeFailures: 0
13334
13407
  };
13335
13408
  let hdrPerf;
13336
- const perfOutputPath = join28(workDir, "perf-summary.json");
13409
+ const perfOutputPath = join29(workDir, "perf-summary.json");
13337
13410
  const cfg = { ...job.config.producerConfig ?? resolveConfig() };
13338
13411
  const observability = new RenderObservabilityRecorder({
13339
13412
  pipelineStartMs: pipelineStart,
@@ -13409,7 +13482,7 @@ async function executeRenderPipeline(input) {
13409
13482
  job.startedAt = /* @__PURE__ */ new Date();
13410
13483
  assertNotAborted();
13411
13484
  assertConfiguredFfmpegBinariesExist();
13412
- if (!existsSync20(workDir)) mkdirSync10(workDir, { recursive: true });
13485
+ if (!existsSync21(workDir)) mkdirSync10(workDir, { recursive: true });
13413
13486
  if (job.config.debug) {
13414
13487
  log.info("[Render] Debug artifacts enabled", { workDir, logPath });
13415
13488
  }
@@ -13438,8 +13511,8 @@ async function executeRenderPipeline(input) {
13438
13511
  requestedWorkers: job.config.workers ?? "auto"
13439
13512
  });
13440
13513
  const entryFile = job.config.entryFile || "index.html";
13441
- const htmlPath = join28(projectDir, entryFile);
13442
- if (!existsSync20(htmlPath)) {
13514
+ const htmlPath = join29(projectDir, entryFile);
13515
+ if (!existsSync21(htmlPath)) {
13443
13516
  throw new Error(`Entry file not found: ${htmlPath}`);
13444
13517
  }
13445
13518
  assertNotAborted();
@@ -13615,7 +13688,7 @@ async function executeRenderPipeline(input) {
13615
13688
  canvas: { width, height },
13616
13689
  page: probeSession.page,
13617
13690
  projectDir,
13618
- compiledDir: join28(workDir, "compiled")
13691
+ compiledDir: join29(workDir, "compiled")
13619
13692
  });
13620
13693
  if (videoLayerPlan.videoId === void 0) {
13621
13694
  log.info(`[Render] Video layer passthrough off: ${videoLayerPlan.reason}`);
@@ -13633,7 +13706,7 @@ async function executeRenderPipeline(input) {
13633
13706
  updateJobStatus(job, "preprocessing", "Extracting video frames", 10, onProgress, {
13634
13707
  code: "extract_video"
13635
13708
  });
13636
- const compiledDir = join28(workDir, "compiled");
13709
+ const compiledDir = join29(workDir, "compiled");
13637
13710
  const segmentsCapture = (layeredOrEffectRoute) => shouldSegmentCapture({
13638
13711
  env: process.env,
13639
13712
  durationSeconds: probeResult.duration,
@@ -13764,7 +13837,7 @@ async function executeRenderPipeline(input) {
13764
13837
  try {
13765
13838
  fileServer = await createFileServer({
13766
13839
  projectDir,
13767
- compiledDir: join28(workDir, "compiled"),
13840
+ compiledDir: join29(workDir, "compiled"),
13768
13841
  port: 0,
13769
13842
  preHeadScripts: [VIRTUAL_TIME_SHIM],
13770
13843
  fps: job.config.fps
@@ -13782,8 +13855,8 @@ async function executeRenderPipeline(input) {
13782
13855
  if (!activeFileServer) {
13783
13856
  throw new Error("File server failed to initialize before frame capture");
13784
13857
  }
13785
- const framesDir = join28(workDir, "captured-frames");
13786
- if (!existsSync20(framesDir)) mkdirSync10(framesDir, { recursive: true });
13858
+ const framesDir = join29(workDir, "captured-frames");
13859
+ if (!existsSync21(framesDir)) mkdirSync10(framesDir, { recursive: true });
13787
13860
  updateJobStatus(job, "rendering", "Checking browser GPU", 25, onProgress, {
13788
13861
  code: "start_browsers"
13789
13862
  });
@@ -13802,18 +13875,28 @@ async function executeRenderPipeline(input) {
13802
13875
  forceScreenshot: captureForceScreenshot
13803
13876
  });
13804
13877
  const videoCaptureBeyondViewport = resolveVideoCaptureBeyondViewport(composition.videos.length);
13805
- const captureImageFormat = resolveCaptureImageFormat({
13806
- needsAlpha,
13807
- motionBlur: job.config.motionBlur
13808
- });
13878
+ const captureSurface = resolveCaptureSurface(
13879
+ {
13880
+ needsAlpha,
13881
+ motionBlur: job.config.motionBlur,
13882
+ chromaSubsampling: job.config.chromaSubsampling
13883
+ },
13884
+ job.config.quality
13885
+ );
13886
+ if (job.config.chromaSubsampling === "444") {
13887
+ log.info("[Render] Capture: png (chromaSubsampling 444, lossless)");
13888
+ }
13809
13889
  const captureOptions = {
13810
13890
  width,
13811
13891
  height,
13812
13892
  fps: job.config.fps,
13813
- format: videoLayer ? "png" : captureImageFormat,
13814
- transparent: needsAlpha || videoLayer !== void 0,
13815
- ...videoLayer ? { hiddenElementIds: [videoLayer.videoId] } : {},
13816
- quality: captureImageFormat === "png" ? void 0 : resolveCaptureJpegQuality(job.config.quality),
13893
+ ...captureSurface,
13894
+ ...videoLayer ? {
13895
+ format: "png",
13896
+ quality: void 0,
13897
+ transparent: true,
13898
+ hiddenElementIds: [videoLayer.videoId]
13899
+ } : {},
13817
13900
  variables: job.config.variables,
13818
13901
  deviceScaleFactor,
13819
13902
  motionBlur: job.config.motionBlur,
@@ -13920,6 +14003,7 @@ async function executeRenderPipeline(input) {
13920
14003
  );
13921
14004
  const nativeHdrIds = /* @__PURE__ */ new Set([...nativeHdrVideoIds, ...nativeHdrImageIds]);
13922
14005
  const hasHdrContent = Boolean(effectiveHdr && nativeHdrIds.size > 0);
14006
+ assertChromaSubsamplingSdr(job.config, hasHdrContent);
13923
14007
  if (hasHdrContent) assertOutputScaleSupported(deviceScaleFactor, "hdr_layered");
13924
14008
  routePageMotionBlur = pageMotionBlurForRoute({ hasHdrContent, useLayeredComposite: false });
13925
14009
  const deSingleMinFrames = resolveDeSingleMinFrames(process.env);
@@ -14347,7 +14431,7 @@ async function executeRenderPipeline(input) {
14347
14431
  hls: ".mp4"
14348
14432
  };
14349
14433
  const videoExt = FORMAT_EXT[outputFormat] ?? ".mp4";
14350
- const videoOnlyPath = join28(workDir, `video-only${videoExt}`);
14434
+ const videoOnlyPath = join29(workDir, `video-only${videoExt}`);
14351
14435
  const usePageSideCompositingForTransitions = (cfg.enablePageSideCompositing || isGif) && compiled.hasShaderTransitions && !hasHdrContent && outputSupportsPageSideShaderCompositing(outputFormat);
14352
14436
  if (usePageSideCompositingForTransitions) {
14353
14437
  activeFileServer.addPreHeadScript(HF_PAGE_SIDE_COMPOSITING_STUB);
@@ -14502,7 +14586,9 @@ async function executeRenderPipeline(input) {
14502
14586
  usePageSideCompositing: capturePlan.usePageSideCompositing,
14503
14587
  hasHdrContent: capturePlan.hasHdrContent,
14504
14588
  hasShaderTransitions: compiled.hasShaderTransitions,
14505
- isPngSequence
14589
+ isPngSequence,
14590
+ captureImageFormat: captureOptions.format ?? "jpeg",
14591
+ chromaSubsampling: job.config.chromaSubsampling ?? "420"
14506
14592
  });
14507
14593
  const encoderHdr = hasHdrContent ? effectiveHdr : void 0;
14508
14594
  const presetFormat = outputFormat === "webm" || outputFormat === "mov" ? outputFormat : "mp4";
@@ -14510,7 +14596,8 @@ async function executeRenderPipeline(input) {
14510
14596
  job.config.quality,
14511
14597
  presetFormat,
14512
14598
  encoderHdr,
14513
- job.config.proresProfile
14599
+ job.config.proresProfile,
14600
+ job.config.chromaSubsampling
14514
14601
  );
14515
14602
  if (job.config.crf != null && job.config.videoBitrate) {
14516
14603
  log.warn(
@@ -14592,7 +14679,7 @@ async function executeRenderPipeline(input) {
14592
14679
  onProgress
14593
14680
  });
14594
14681
  },
14595
- { stall: frameStallRule(job, totalFrames) }
14682
+ { stall: frameStallRule(job, totalFrames, perfStages.browserProbeMs) }
14596
14683
  );
14597
14684
  lastBrowserConsole = hdrRes.lastBrowserConsole;
14598
14685
  layeredCaptureWarnings.push(...hdrRes.warnings);
@@ -14633,7 +14720,7 @@ async function executeRenderPipeline(input) {
14633
14720
  pageMotionBlur: job.config.pageMotionBlur,
14634
14721
  captureQuality: captureOptions.quality
14635
14722
  });
14636
- const segmentDir = segmentDirFor(join28(projectDir, "renders"), segmentPlanHash);
14723
+ const segmentDir = segmentDirFor(join29(projectDir, "renders"), segmentPlanHash);
14637
14724
  let completedSegments = /* @__PURE__ */ new Set();
14638
14725
  if (job.config.resumeSegments === true) {
14639
14726
  const existing = readSegmentManifest(segmentDir);
@@ -15044,7 +15131,7 @@ async function executeRenderPipeline(input) {
15044
15131
  interleaveFrames: overlap !== null,
15045
15132
  openAttempt
15046
15133
  }),
15047
- { stall: frameStallRule(job, totalFrames) }
15134
+ { stall: frameStallRule(job, totalFrames, perfStages.browserProbeMs) }
15048
15135
  );
15049
15136
  let captureRes;
15050
15137
  try {
@@ -15174,7 +15261,7 @@ async function executeRenderPipeline(input) {
15174
15261
  })
15175
15262
  );
15176
15263
  const totalElapsed = Date.now() - pipelineStart;
15177
- const tmpPeakBytes = existsSync20(workDir) ? sampleDirectoryBytes(workDir) : 0;
15264
+ const tmpPeakBytes = existsSync21(workDir) ? sampleDirectoryBytes(workDir) : 0;
15178
15265
  recordTransientRetryObservability();
15179
15266
  observability.checkpoint("pipeline", "artifact validated", { totalElapsedMs: totalElapsed });
15180
15267
  const observabilitySummary = observability.summary({
@@ -15255,8 +15342,8 @@ async function executeRenderPipeline(input) {
15255
15342
  }
15256
15343
  }
15257
15344
  if (job.config.debug) {
15258
- if (!isPngSequence && !isHls && existsSync20(stagedOutputPath)) {
15259
- const debugOutput = join28(workDir, `output${videoExt}`);
15345
+ if (!isPngSequence && !isHls && existsSync21(stagedOutputPath)) {
15346
+ const debugOutput = join29(workDir, `output${videoExt}`);
15260
15347
  copyFileSync3(stagedOutputPath, debugOutput);
15261
15348
  }
15262
15349
  }
@@ -15366,14 +15453,14 @@ async function executeRenderPipeline(input) {
15366
15453
  }
15367
15454
 
15368
15455
  // ../producer/src/services/distributed/renderSpan.ts
15369
- import { mkdirSync as mkdirSync18, mkdtempSync, readFileSync as readFileSync12, rmSync as rmSync16 } from "fs";
15370
- import { join as join42 } from "path";
15456
+ import { mkdirSync as mkdirSync18, mkdtempSync, readFileSync as readFileSync13, rmSync as rmSync16 } from "fs";
15457
+ import { join as join43 } from "path";
15371
15458
  import { tmpdir as tmpdir4 } from "os";
15372
15459
 
15373
15460
  // ../producer/src/services/distributed/mp4Stitch.ts
15374
15461
  import { createReadStream as createReadStream3, createWriteStream, mkdirSync as mkdirSync11, rmSync as rmSync11 } from "fs";
15375
15462
  import { open } from "fs/promises";
15376
- import { basename as basename7, dirname as dirname12, join as join29 } from "path";
15463
+ import { basename as basename7, dirname as dirname12, join as join30 } from "path";
15377
15464
  import { finished, pipeline } from "stream/promises";
15378
15465
  function boxAt(src, off, at, limit) {
15379
15466
  let size = src.readUInt32BE(off);
@@ -15739,13 +15826,13 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
15739
15826
  const header = audioPath ? buildStitchedHeader(layouts.slice(1), layouts[0]) : buildStitchedHeader(layouts);
15740
15827
  mkdirSync11(dirname12(outputPath), { recursive: true });
15741
15828
  const workDir = createStagingDir(dirname12(outputPath), `${basename7(outputPath)}.stitch-`);
15742
- const out = createWriteStream(join29(workDir, "out.mp4"));
15829
+ const out = createWriteStream(join30(workDir, "out.mp4"));
15743
15830
  try {
15744
15831
  out.write(header);
15745
15832
  for (const [i, path] of sourcePaths.entries()) await copyPayload(path, layouts[i], i, out);
15746
15833
  out.end();
15747
15834
  await finished(out);
15748
- renameWithRetry(join29(workDir, "out.mp4"), outputPath);
15835
+ renameWithRetry(join30(workDir, "out.mp4"), outputPath);
15749
15836
  } finally {
15750
15837
  out.destroy();
15751
15838
  rmSync11(workDir, { recursive: true, force: true });
@@ -15756,25 +15843,25 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
15756
15843
  import {
15757
15844
  copyFileSync as copyFileSync4,
15758
15845
  cpSync as cpSync2,
15759
- existsSync as existsSync25,
15846
+ existsSync as existsSync26,
15760
15847
  linkSync,
15761
15848
  mkdirSync as mkdirSync14,
15762
15849
  rmSync as rmSync12,
15763
15850
  writeFileSync as writeFileSync9
15764
15851
  } from "fs";
15765
- import { extname as extname6, isAbsolute as isAbsolute2, join as join37, relative as relative5, sep as sep3 } from "path";
15852
+ import { extname as extname6, isAbsolute as isAbsolute2, join as join38, relative as relative5, sep as sep3 } from "path";
15766
15853
 
15767
15854
  // ../producer/src/services/distributed/planFrameCost.ts
15768
- import { join as join32 } from "path";
15855
+ import { join as join33 } from "path";
15769
15856
 
15770
15857
  // ../producer/src/services/distributed/chunkFrames.ts
15771
- import { existsSync as existsSync22, readdirSync as readdirSync7 } from "fs";
15772
- import { extname as extname4, join as join31 } from "path";
15858
+ import { existsSync as existsSync23, readdirSync as readdirSync7 } from "fs";
15859
+ import { extname as extname4, join as join32 } from "path";
15773
15860
 
15774
15861
  // ../producer/src/services/distributed/shared.ts
15775
15862
  import { execFile as execFileCallback } from "child_process";
15776
- import { dirname as dirname13, join as join30 } from "path";
15777
- import { existsSync as existsSync21, readFileSync as readFileSync7 } from "fs";
15863
+ import { dirname as dirname13, join as join31 } from "path";
15864
+ import { existsSync as existsSync22, readFileSync as readFileSync8 } from "fs";
15778
15865
  import { fileURLToPath as fileURLToPath5 } from "url";
15779
15866
  import { promisify as promisify2 } from "util";
15780
15867
  var PLAN_VIDEOS_META_RELATIVE_PATH = "meta/videos.json";
@@ -15785,8 +15872,8 @@ function isPlanAudioArtifactPath(path) {
15785
15872
  }
15786
15873
  function resolvePlanAudioPath(planDir) {
15787
15874
  for (const name of [PLAN_AUDIO_RELATIVE_PATH, PLAN_AUDIO_LEGACY_RELATIVE_PATH]) {
15788
- const candidate = join30(planDir, name);
15789
- if (existsSync21(candidate)) return candidate;
15875
+ const candidate = join31(planDir, name);
15876
+ if (existsSync22(candidate)) return candidate;
15790
15877
  }
15791
15878
  return null;
15792
15879
  }
@@ -16046,10 +16133,10 @@ function readProducerVersion() {
16046
16133
  const startDir = dirname13(fileURLToPath5(import.meta.url));
16047
16134
  let current = startDir;
16048
16135
  for (let i = 0; i < 10; i++) {
16049
- const candidate = join30(current, "package.json");
16050
- if (existsSync21(candidate)) {
16136
+ const candidate = join31(current, "package.json");
16137
+ if (existsSync22(candidate)) {
16051
16138
  try {
16052
- const pkg = JSON.parse(readFileSync7(candidate, "utf-8"));
16139
+ const pkg = JSON.parse(readFileSync8(candidate, "utf-8"));
16053
16140
  if (pkg.name === "@hyperframes/producer" && typeof pkg.version === "string") {
16054
16141
  cachedProducerVersion = pkg.version;
16055
16142
  return pkg.version;
@@ -16101,8 +16188,8 @@ function frameNumberFromFileName(name) {
16101
16188
  function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v1") {
16102
16189
  const result = [];
16103
16190
  for (const v of videos) {
16104
- const outputDir = join31(planDir, "video-frames", v.videoId);
16105
- if (!existsSync22(outputDir)) {
16191
+ const outputDir = join32(planDir, "video-frames", mediaIdPathSegment(v.videoId));
16192
+ if (!existsSync23(outputDir)) {
16106
16193
  throw new Error(
16107
16194
  `[renderChunk] planDir missing extracted video frames for ${JSON.stringify(v.videoId)}: ${outputDir} not present. plan() should have written frames here; the planDir is malformed.`
16108
16195
  );
@@ -16120,7 +16207,7 @@ function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v
16120
16207
  if (!frameName) continue;
16121
16208
  const frameNumber = indexMode === "sparse-v2" ? frameNumberFromFileName(frameName) : null;
16122
16209
  const frameIndex = frameNumber === null ? i : frameNumber - 1;
16123
- framePaths.set(frameIndex, join31(outputDir, frameName));
16210
+ framePaths.set(frameIndex, join32(outputDir, frameName));
16124
16211
  }
16125
16212
  result.push({
16126
16213
  videoId: v.videoId,
@@ -16200,8 +16287,8 @@ async function extractDeferredVideoFramesForChunk(input) {
16200
16287
  sourceOf: (video) => {
16201
16288
  const range = planned.get(video.videoId).deferredRange;
16202
16289
  const remoteUrl = remoteSources[range.sourcePath];
16203
- const sourcePath = remoteUrl ?? join31(input.planDir, ...range.sourcePath.split("/"));
16204
- if (remoteUrl === void 0 && !existsSync22(sourcePath)) {
16290
+ const sourcePath = remoteUrl ?? join32(input.planDir, ...range.sourcePath.split("/"));
16291
+ if (remoteUrl === void 0 && !existsSync23(sourcePath)) {
16205
16292
  throw new RenderChunkValidationError(
16206
16293
  MISSING_PLAN_ARTIFACT,
16207
16294
  `[renderChunk] planDir is missing the source for video ${JSON.stringify(video.videoId)}: ${range.sourcePath}`
@@ -16231,12 +16318,12 @@ async function measurePlanSecondsPerFrame(input) {
16231
16318
  planVideos,
16232
16319
  frames: sampled,
16233
16320
  fps: fpsRatio,
16234
- outputRoot: join32(workDir, "frame-cost-video-frames"),
16321
+ outputRoot: join33(workDir, "frame-cost-video-frames"),
16235
16322
  cfg: input.cfg
16236
16323
  })
16237
16324
  ];
16238
16325
  const lookup = extracted.length > 0 ? createFrameLookupTable(planVideos.videos, extracted, resolveRenderFpsConfig(fpsRatio).value) : null;
16239
- const compiledDir = join32(planDir, "compiled");
16326
+ const compiledDir = join33(planDir, "compiled");
16240
16327
  const fileServer = await createFileServer({
16241
16328
  projectDir: compiledDir,
16242
16329
  compiledDir,
@@ -16248,7 +16335,7 @@ async function measurePlanSecondsPerFrame(input) {
16248
16335
  try {
16249
16336
  session = await createCaptureSession(
16250
16337
  fileServer.url,
16251
- join32(workDir, "frame-cost"),
16338
+ join33(workDir, "frame-cost"),
16252
16339
  buildChunkCaptureOptions({
16253
16340
  dimensions: { ...input, fpsNum: fps, fpsDen: 1 },
16254
16341
  encoder: input,
@@ -16344,21 +16431,21 @@ function buildWeightedChunkSlices(weights, chunkCount, minFrames, maxFrames) {
16344
16431
  }
16345
16432
 
16346
16433
  // ../producer/src/services/render/planReferenceBackground.ts
16347
- import { join as join33 } from "path";
16434
+ import { join as join34 } from "path";
16348
16435
  async function readPlanReferenceBackground(input) {
16349
16436
  let server;
16350
16437
  let session;
16351
16438
  try {
16352
16439
  server = await createFileServer({
16353
16440
  projectDir: input.projectDir,
16354
- compiledDir: join33(input.workDir, "compiled"),
16441
+ compiledDir: join34(input.workDir, "compiled"),
16355
16442
  port: 0,
16356
16443
  preHeadScripts: [VIRTUAL_TIME_SHIM],
16357
16444
  fps: input.options.fps
16358
16445
  });
16359
16446
  session = await createCaptureSession(
16360
16447
  server.url,
16361
- join33(input.workDir, "reference"),
16448
+ join34(input.workDir, "reference"),
16362
16449
  {
16363
16450
  ...input.options,
16364
16451
  requiresWebGpu: false
@@ -16394,8 +16481,8 @@ async function readPlanReferenceBackground(input) {
16394
16481
  }
16395
16482
 
16396
16483
  // ../producer/src/services/render/stages/freezePlan.ts
16397
- import { existsSync as existsSync23, mkdirSync as mkdirSync12, readFileSync as readFileSync8, readdirSync as readdirSync8, writeFileSync as writeFileSync7 } from "fs";
16398
- import { join as join34, relative as relative3, resolve as resolve7 } from "path";
16484
+ import { existsSync as existsSync24, mkdirSync as mkdirSync12, readFileSync as readFileSync9, readdirSync as readdirSync8, writeFileSync as writeFileSync7 } from "fs";
16485
+ import { join as join35, relative as relative3, resolve as resolve7 } from "path";
16399
16486
 
16400
16487
  // ../producer/src/services/distributed/planProtocol.ts
16401
16488
  var PLAN_SCHEMA_VERSION = 1;
@@ -16584,7 +16671,7 @@ function planFileSha256(absolutePath, digests) {
16584
16671
  return sha256;
16585
16672
  }
16586
16673
  async function prehashPlanFiles(dir, digests) {
16587
- if (!existsSync23(dir)) return;
16674
+ if (!existsSync24(dir)) return;
16588
16675
  for (const { absolutePath } of listPlanFiles(dir)) {
16589
16676
  if (!digests.has(absolutePath)) digests.set(absolutePath, await sha256FileAsync(absolutePath));
16590
16677
  }
@@ -16609,7 +16696,7 @@ function listPlanFiles(planDir) {
16609
16696
  function walk(dir) {
16610
16697
  const entries = readdirSync8(dir, { withFileTypes: true });
16611
16698
  for (const entry of entries) {
16612
- const full = join34(dir, entry.name);
16699
+ const full = join35(dir, entry.name);
16613
16700
  if (entry.isDirectory()) {
16614
16701
  walk(full);
16615
16702
  } else if (entry.isFile()) {
@@ -16630,7 +16717,7 @@ function collectPlanAssetShas(planDir, digests) {
16630
16717
  const assets = [];
16631
16718
  for (const file of files) {
16632
16719
  if (file.planRelativePath === COMPILED_INDEX_RELATIVE_PATH) {
16633
- compositionHtml = readFileSync8(file.absolutePath);
16720
+ compositionHtml = readFileSync9(file.absolutePath);
16634
16721
  continue;
16635
16722
  }
16636
16723
  if (HASH_EXCLUDED_PLAN_FILES.has(file.planRelativePath)) continue;
@@ -16650,23 +16737,23 @@ var PLAN_REMOTE_FILES_RELATIVE_PATH = "meta/remote-files.json";
16650
16737
  function writePlanRemoteFiles(planDir, files) {
16651
16738
  if (files.length === 0) return;
16652
16739
  const sorted = [...files].sort((a, b) => a.path < b.path ? -1 : 1);
16653
- writeFileSync7(join34(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH), JSON.stringify(sorted), "utf-8");
16740
+ writeFileSync7(join35(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH), JSON.stringify(sorted), "utf-8");
16654
16741
  }
16655
16742
  function readPlanRemoteFiles(planDir) {
16656
- const path = join34(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH);
16657
- return existsSync23(path) ? JSON.parse(readFileSync8(path, "utf-8")) : [];
16743
+ const path = join35(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH);
16744
+ return existsSync24(path) ? JSON.parse(readFileSync9(path, "utf-8")) : [];
16658
16745
  }
16659
16746
  function recomputePlanHashFromPlanDir(planDir, digests) {
16660
- const planJsonPath = join34(planDir, "plan.json");
16661
- const encoderJsonPath = join34(planDir, "meta", "encoder.json");
16662
- if (!existsSync23(planJsonPath)) {
16747
+ const planJsonPath = join35(planDir, "plan.json");
16748
+ const encoderJsonPath = join35(planDir, "meta", "encoder.json");
16749
+ if (!existsSync24(planJsonPath)) {
16663
16750
  throw new Error(`[freezePlan] plan.json missing: ${planJsonPath}`);
16664
16751
  }
16665
- if (!existsSync23(encoderJsonPath)) {
16752
+ if (!existsSync24(encoderJsonPath)) {
16666
16753
  throw new Error(`[freezePlan] meta/encoder.json missing: ${encoderJsonPath}`);
16667
16754
  }
16668
- const planJson = JSON.parse(readFileSync8(planJsonPath, "utf-8"));
16669
- const encoderConfigCanonicalJson = readFileSync8(encoderJsonPath, "utf-8");
16755
+ const planJson = JSON.parse(readFileSync9(planJsonPath, "utf-8"));
16756
+ const encoderConfigCanonicalJson = readFileSync9(encoderJsonPath, "utf-8");
16670
16757
  const { compositionHtml, assets } = collectPlanAssetShas(planDir, digests);
16671
16758
  return computePlanHash({
16672
16759
  compositionHtml,
@@ -16692,21 +16779,21 @@ async function freezePlan(input) {
16692
16779
  hasAudio,
16693
16780
  digests
16694
16781
  } = input;
16695
- if (!existsSync23(planDir)) {
16782
+ if (!existsSync24(planDir)) {
16696
16783
  throw new Error(`[freezePlan] planDir does not exist: ${planDir}`);
16697
16784
  }
16698
- const metaDir = join34(planDir, "meta");
16699
- if (!existsSync23(metaDir)) mkdirSync12(metaDir, { recursive: true });
16785
+ const metaDir = join35(planDir, "meta");
16786
+ if (!existsSync24(metaDir)) mkdirSync12(metaDir, { recursive: true });
16700
16787
  writeFileSync7(
16701
- join34(metaDir, "composition.json"),
16788
+ join35(metaDir, "composition.json"),
16702
16789
  `${JSON.stringify(composition, null, 2)}
16703
16790
  `,
16704
16791
  "utf-8"
16705
16792
  );
16706
16793
  const encoderForCanonical = stripUndefined(encoder);
16707
16794
  const encoderConfigCanonicalJson = canonicalJsonStringify(encoderForCanonical);
16708
- writeFileSync7(join34(metaDir, "encoder.json"), encoderConfigCanonicalJson, "utf-8");
16709
- writeFileSync7(join34(metaDir, "chunks.json"), `${JSON.stringify(chunks, null, 2)}
16795
+ writeFileSync7(join35(metaDir, "encoder.json"), encoderConfigCanonicalJson, "utf-8");
16796
+ writeFileSync7(join35(metaDir, "chunks.json"), `${JSON.stringify(chunks, null, 2)}
16710
16797
  `, "utf-8");
16711
16798
  const { compositionHtml, assets } = collectPlanAssetShas(planDir, digests);
16712
16799
  const planHash = computePlanHash({
@@ -16731,7 +16818,7 @@ async function freezePlan(input) {
16731
16818
  duration: durationSeconds,
16732
16819
  hasAudio
16733
16820
  };
16734
- const planJsonPath = join34(planDir, "plan.json");
16821
+ const planJsonPath = join35(planDir, "plan.json");
16735
16822
  writeFileSync7(planJsonPath, `${JSON.stringify(planJson, null, 2)}
16736
16823
  `, "utf-8");
16737
16824
  return { planJsonPath, planHash };
@@ -16773,9 +16860,9 @@ function applyRuntimeEnvSnapshot(snapshot, env = process.env) {
16773
16860
  }
16774
16861
 
16775
16862
  // ../producer/src/services/distributed/chunkAudio.ts
16776
- import { closeSync as closeSync5, existsSync as existsSync24, ftruncateSync, mkdirSync as mkdirSync13, openSync as openSync5, readFileSync as readFileSync9 } from "fs";
16863
+ import { closeSync as closeSync5, existsSync as existsSync25, ftruncateSync, mkdirSync as mkdirSync13, openSync as openSync5, readFileSync as readFileSync10 } from "fs";
16777
16864
  import { writeFileSync as writeFileSync8, writeSync } from "fs";
16778
- import { join as join35 } from "path";
16865
+ import { join as join36 } from "path";
16779
16866
  function audioCutForChunk(grid, chunks, index, fps) {
16780
16867
  const firstPacketAt = (frame) => Math.min(
16781
16868
  grid.packetCount,
@@ -16860,9 +16947,9 @@ async function writeChunkAudioSlices(input) {
16860
16947
  offset += track.sizes[offsets.length - 1];
16861
16948
  }
16862
16949
  });
16863
- const bytes = readFileSync9(input.audioPath);
16950
+ const bytes = readFileSync10(input.audioPath);
16864
16951
  const layout = { sizeBytes: bytes.length, payloadStart, payloadEnd, partStarts: {} };
16865
- mkdirSync13(join35(input.planDir, SLICE_DIR), { recursive: true });
16952
+ mkdirSync13(join36(input.planDir, SLICE_DIR), { recursive: true });
16866
16953
  input.chunks.forEach((_, index) => {
16867
16954
  const cut = audioCutForChunk(grid, input.chunks, index, input.fps);
16868
16955
  if (!cut) return;
@@ -16870,17 +16957,17 @@ async function writeChunkAudioSlices(input) {
16870
16957
  const start = offsets[cut.firstPacket];
16871
16958
  layout.partStarts[index] = start;
16872
16959
  const end = offsets[last] + track.sizes[last];
16873
- writeFileSync8(join35(input.planDir, chunkAudioSlicePath(index)), bytes.subarray(start, end));
16960
+ writeFileSync8(join36(input.planDir, chunkAudioSlicePath(index)), bytes.subarray(start, end));
16874
16961
  });
16875
16962
  const frame = [bytes.subarray(0, payloadStart), bytes.subarray(payloadEnd)];
16876
- writeFileSync8(join35(input.planDir, SLICE_FRAME), Buffer.concat(frame));
16877
- writeFileSync8(join35(input.planDir, SLICE_LAYOUT), JSON.stringify(layout));
16963
+ writeFileSync8(join36(input.planDir, SLICE_FRAME), Buffer.concat(frame));
16964
+ writeFileSync8(join36(input.planDir, SLICE_LAYOUT), JSON.stringify(layout));
16878
16965
  }
16879
16966
  function chunkAudioSource(planDir, chunkIndex, scratchPath) {
16880
- const layoutPath = join35(planDir, SLICE_LAYOUT);
16881
- if (!existsSync24(layoutPath)) return resolvePlanAudioPath(planDir);
16882
- const layout = JSON.parse(readFileSync9(layoutPath, "utf-8"));
16883
- const frame = readFileSync9(join35(planDir, SLICE_FRAME));
16967
+ const layoutPath = join36(planDir, SLICE_LAYOUT);
16968
+ if (!existsSync25(layoutPath)) return resolvePlanAudioPath(planDir);
16969
+ const layout = JSON.parse(readFileSync10(layoutPath, "utf-8"));
16970
+ const frame = readFileSync10(join36(planDir, SLICE_FRAME));
16884
16971
  const fd = openSync5(scratchPath, "w");
16885
16972
  try {
16886
16973
  writeSync(fd, frame, 0, layout.payloadStart, 0);
@@ -16893,7 +16980,7 @@ function chunkAudioSource(planDir, chunkIndex, scratchPath) {
16893
16980
  );
16894
16981
  const start = layout.partStarts[chunkIndex];
16895
16982
  if (start !== void 0) {
16896
- const part = readFileSync9(join35(planDir, chunkAudioSlicePath(chunkIndex)));
16983
+ const part = readFileSync10(join36(planDir, chunkAudioSlicePath(chunkIndex)));
16897
16984
  writeSync(fd, part, 0, part.length, start);
16898
16985
  }
16899
16986
  ftruncateSync(fd, layout.sizeBytes);
@@ -16949,7 +17036,7 @@ async function muxChunkWithAudio(input) {
16949
17036
  // ../producer/src/services/distributed/planSize.ts
16950
17037
  import { createHash as createHash7 } from "crypto";
16951
17038
  import { lstatSync as lstatSync2, readdirSync as readdirSync9 } from "fs";
16952
- import { extname as extname5, join as join36, relative as relative4 } from "path";
17039
+ import { extname as extname5, join as join37, relative as relative4 } from "path";
16953
17040
  var MAX_TOP_COMPONENTS = 10;
16954
17041
  var SOURCE_MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
16955
17042
  ".aac",
@@ -17061,7 +17148,7 @@ function walkRegularFiles(dir, visit) {
17061
17148
  return;
17062
17149
  }
17063
17150
  for (const entry of entries) {
17064
- const full = join36(dir, entry.name);
17151
+ const full = join37(dir, entry.name);
17065
17152
  if (entry.isDirectory()) {
17066
17153
  walkRegularFiles(full, visit);
17067
17154
  } else if (entry.isFile()) {
@@ -17277,13 +17364,13 @@ function assertPositiveInteger2(name, value) {
17277
17364
  }
17278
17365
  var FREEZE_OWNED_PLAN_FILES = [
17279
17366
  "plan.json",
17280
- join37("meta", "composition.json"),
17281
- join37("meta", "encoder.json"),
17282
- join37("meta", "chunks.json")
17367
+ join38("meta", "composition.json"),
17368
+ join38("meta", "encoder.json"),
17369
+ join38("meta", "chunks.json")
17283
17370
  ];
17284
17371
  function removeFreezeOwnedPlanFiles(planDir) {
17285
17372
  for (const relativePath of FREEZE_OWNED_PLAN_FILES) {
17286
- rmSync12(join37(planDir, relativePath), { force: true });
17373
+ rmSync12(join38(planDir, relativePath), { force: true });
17287
17374
  }
17288
17375
  }
17289
17376
  function buildChunkSlices(totalFrames, chunkCount, effectiveChunkSize) {
@@ -17438,19 +17525,19 @@ function createVideoSourceShipper(input) {
17438
17525
  const known = shipped.get(srcPath);
17439
17526
  if (known) return known;
17440
17527
  const stagedRel = pathInside(input.workVideoFramesDir, srcPath);
17441
- const current = stagedRel === null ? srcPath : join37(input.planDir, "video-frames", stagedRel);
17528
+ const current = stagedRel === null ? srcPath : join38(input.planDir, "video-frames", stagedRel);
17442
17529
  let result = null;
17443
17530
  for (const root of stagedRel === null ? [input.workCompiledDir, input.projectDir] : []) {
17444
17531
  const rel = pathInside(root, srcPath);
17445
- if (rel !== null && (existsSync25(join37(input.planDir, "compiled", rel)) || input.isRemote(srcPath))) {
17532
+ if (rel !== null && (existsSync26(join38(input.planDir, "compiled", rel)) || input.isRemote(srcPath))) {
17446
17533
  result = ["compiled", ...rel.split(sep3)].join("/");
17447
17534
  break;
17448
17535
  }
17449
17536
  }
17450
17537
  if (result === null) {
17451
17538
  result = `video-sources/${shipped.size}${extname6(current)}`;
17452
- const destination = join37(input.planDir, ...result.split("/"));
17453
- mkdirSync14(join37(input.planDir, "video-sources"), { recursive: true });
17539
+ const destination = join38(input.planDir, ...result.split("/"));
17540
+ mkdirSync14(join38(input.planDir, "video-sources"), { recursive: true });
17454
17541
  try {
17455
17542
  linkSync(current, destination);
17456
17543
  } catch {
@@ -17470,7 +17557,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
17470
17557
  useGpu: false,
17471
17558
  browserGpuMode: "software"
17472
17559
  });
17473
- if (!existsSync25(planDir)) mkdirSync14(planDir, { recursive: true });
17560
+ if (!existsSync26(planDir)) mkdirSync14(planDir, { recursive: true });
17474
17561
  const log = config.logger ?? defaultLogger;
17475
17562
  const sizeLimitBytes = options.executionPlanSizeLimitBytes ?? config.planDirSizeLimitBytes ?? PLAN_DIR_SIZE_LIMIT_BYTES;
17476
17563
  const abortSignal = config.abortSignal;
@@ -17500,14 +17587,14 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
17500
17587
  pageMotionBlur: config.pageMotionBlur
17501
17588
  });
17502
17589
  const entryFile = config.entryFile ?? "index.html";
17503
- const htmlPath = join37(projectDir, entryFile);
17504
- if (!existsSync25(htmlPath)) {
17590
+ const htmlPath = join38(projectDir, entryFile);
17591
+ if (!existsSync26(htmlPath)) {
17505
17592
  throw new Error(`[plan] entry file not found: ${htmlPath}`);
17506
17593
  }
17507
- const workDir = join37(planDir, ".plan-work");
17594
+ const workDir = join38(planDir, ".plan-work");
17508
17595
  rmSync12(workDir, { recursive: true, force: true });
17509
17596
  mkdirSync14(workDir, { recursive: true });
17510
- const compiledDir = join37(workDir, "compiled");
17597
+ const compiledDir = join38(workDir, "compiled");
17511
17598
  mkdirSync14(compiledDir, { recursive: true });
17512
17599
  let stageStarted = Date.now();
17513
17600
  cpSync2(projectDir, compiledDir, {
@@ -17521,10 +17608,10 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
17521
17608
  }
17522
17609
  });
17523
17610
  logPlanStage(log, "copy", stageStarted);
17524
- const finalCompiledDir = join37(planDir, "compiled");
17611
+ const finalCompiledDir = join38(planDir, "compiled");
17525
17612
  const needsAlpha = outputNeedsAlpha(config.format);
17526
17613
  const remoteFiles = Object.entries(options.remoteFiles ?? {});
17527
- const remoteLocalPath = (rel) => join37(projectDir, ...rel.split("/"));
17614
+ const remoteLocalPath = (rel) => join38(projectDir, ...rel.split("/"));
17528
17615
  for (const [, file] of remoteFiles) {
17529
17616
  declareContentAddressedUrl(file.url, file.sha256);
17530
17617
  if (file.probeFactsUrl) declareProbeFactsUrl(file.url, file.probeFactsUrl);
@@ -17620,7 +17707,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
17620
17707
  if (probeResult.fileServer) closeFileServerSafely(probeResult.fileServer, "plan", log);
17621
17708
  if (probeResult.probeSession) {
17622
17709
  try {
17623
- const { closeCaptureSession: closeCaptureSession2 } = await import("./src-NIMSUB4P.js");
17710
+ const { closeCaptureSession: closeCaptureSession2 } = await import("./src-HHPRCLEW.js");
17624
17711
  await closeCaptureSession2(probeResult.probeSession);
17625
17712
  } catch (err) {
17626
17713
  log.warn("[plan] probe session close failed", {
@@ -17727,17 +17814,17 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
17727
17814
  let stageStarted = Date.now();
17728
17815
  const extractResult = await extractPlanVideos(c, options.deferVideoExtraction);
17729
17816
  logPlanStage(log, "extract", stageStarted);
17730
- const stagedVideoFrames = join37(compiledDir, "__hyperframes_video_frames");
17731
- const videoFramesDst = join37(planDir, "video-frames");
17732
- if (existsSync25(videoFramesDst)) rmSync12(videoFramesDst, { recursive: true, force: true });
17733
- const videoSourcesDir = join37(planDir, "video-sources");
17817
+ const stagedVideoFrames = join38(compiledDir, "__hyperframes_video_frames");
17818
+ const videoFramesDst = join38(planDir, "video-frames");
17819
+ if (existsSync26(videoFramesDst)) rmSync12(videoFramesDst, { recursive: true, force: true });
17820
+ const videoSourcesDir = join38(planDir, "video-sources");
17734
17821
  rmSync12(videoSourcesDir, { recursive: true, force: true });
17735
- if (existsSync25(stagedVideoFrames)) {
17822
+ if (existsSync26(stagedVideoFrames)) {
17736
17823
  renameWithRetry(stagedVideoFrames, videoFramesDst);
17737
17824
  } else {
17738
17825
  mkdirSync14(videoFramesDst, { recursive: true });
17739
17826
  }
17740
- if (existsSync25(finalCompiledDir)) rmSync12(finalCompiledDir, { recursive: true, force: true });
17827
+ if (existsSync26(finalCompiledDir)) rmSync12(finalCompiledDir, { recursive: true, force: true });
17741
17828
  renameWithRetry(compiledDir, finalCompiledDir);
17742
17829
  const shipVideoSource = createVideoSourceShipper({
17743
17830
  planDir,
@@ -17767,7 +17854,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
17767
17854
  };
17768
17855
  })
17769
17856
  });
17770
- mkdirSync14(join37(planDir, "meta"), { recursive: true });
17857
+ mkdirSync14(join38(planDir, "meta"), { recursive: true });
17771
17858
  writePlanRemoteFiles(
17772
17859
  planDir,
17773
17860
  remoteFiles.map(([rel, { sha256, sizeBytes }]) => ({
@@ -17777,7 +17864,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
17777
17864
  }))
17778
17865
  );
17779
17866
  writeFileSync9(
17780
- join37(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
17867
+ join38(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
17781
17868
  JSON.stringify(planVideosJson, null, 2),
17782
17869
  "utf-8"
17783
17870
  );
@@ -17857,11 +17944,11 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
17857
17944
  if (audioResult?.audioError) {
17858
17945
  applyDistributedAudioWarningPolicy(job, audioResult.audioError, audioResult.audioFailures, log);
17859
17946
  }
17860
- const planAudioPath = join37(planDir, PLAN_AUDIO_RELATIVE_PATH);
17861
- if (audioResult?.hasAudio && existsSync25(audioResult.audioOutputPath)) {
17947
+ const planAudioPath = join38(planDir, PLAN_AUDIO_RELATIVE_PATH);
17948
+ if (audioResult?.hasAudio && existsSync26(audioResult.audioOutputPath)) {
17862
17949
  renameWithRetry(audioResult.audioOutputPath, planAudioPath);
17863
17950
  }
17864
- if (chunksCarryAudio && existsSync25(planAudioPath)) {
17951
+ if (chunksCarryAudio && existsSync26(planAudioPath)) {
17865
17952
  if (options.sliceChunkAudio) {
17866
17953
  stageStarted = Date.now();
17867
17954
  await writeChunkAudioSlices({
@@ -17979,36 +18066,36 @@ async function plan(projectDir, config, planDir, options = {}) {
17979
18066
 
17980
18067
  // ../producer/src/services/distributed/renderChunk.ts
17981
18068
  import { randomBytes } from "crypto";
17982
- import { existsSync as existsSync28, mkdirSync as mkdirSync17, readFileSync as readFileSync11, readdirSync as readdirSync11, rmSync as rmSync15, writeFileSync as writeFileSync12 } from "fs";
18069
+ import { existsSync as existsSync29, mkdirSync as mkdirSync17, readFileSync as readFileSync12, readdirSync as readdirSync11, rmSync as rmSync15, writeFileSync as writeFileSync12 } from "fs";
17983
18070
  import { cpus as cpus3 } from "os";
17984
- import { join as join41 } from "path";
18071
+ import { join as join42 } from "path";
17985
18072
 
17986
18073
  // ../producer/src/services/distributed/planV2.ts
17987
18074
  import {
17988
18075
  copyFileSync as copyFileSync6,
17989
- existsSync as existsSync27,
18076
+ existsSync as existsSync28,
17990
18077
  lstatSync as lstatSync3,
17991
18078
  mkdirSync as mkdirSync16,
17992
- readFileSync as readFileSync10,
18079
+ readFileSync as readFileSync11,
17993
18080
  readdirSync as readdirSync10,
17994
18081
  rmSync as rmSync14,
17995
18082
  statSync as statSync9,
17996
18083
  writeFileSync as writeFileSync11
17997
18084
  } from "fs";
17998
18085
  import { tmpdir as tmpdir3 } from "os";
17999
- import { dirname as dirname15, isAbsolute as isAbsolute3, join as join40, relative as relative6, resolve as resolve8, sep as sep4 } from "path";
18086
+ import { dirname as dirname15, isAbsolute as isAbsolute3, join as join41, relative as relative6, resolve as resolve8, sep as sep4 } from "path";
18000
18087
 
18001
18088
  // ../producer/src/services/distributed/planV2Publisher.ts
18002
18089
  import {
18003
18090
  copyFileSync as copyFileSync5,
18004
- existsSync as existsSync26,
18091
+ existsSync as existsSync27,
18005
18092
  linkSync as linkSync2,
18006
18093
  mkdirSync as mkdirSync15,
18007
18094
  rmSync as rmSync13,
18008
18095
  statSync as statSync8,
18009
18096
  writeFileSync as writeFileSync10
18010
18097
  } from "fs";
18011
- import { dirname as dirname14, join as join39 } from "path";
18098
+ import { dirname as dirname14, join as join40 } from "path";
18012
18099
 
18013
18100
  // ../producer/src/services/distributed/planV2Errors.ts
18014
18101
  var PLAN_V2_INTEGRITY_UNRECOVERABLE = "PLAN_V2_INTEGRITY_UNRECOVERABLE";
@@ -18023,7 +18110,7 @@ var PlanV2IntegrityError = class extends Error {
18023
18110
  };
18024
18111
 
18025
18112
  // ../producer/src/services/distributed/planV2Layout.ts
18026
- import { join as join38 } from "path";
18113
+ import { join as join39 } from "path";
18027
18114
  var SHA256_PATTERN = /^[0-9a-f]{64}$/;
18028
18115
  function assertPlanV2Sha256(value, field) {
18029
18116
  if (typeof value !== "string" || !SHA256_PATTERN.test(value)) {
@@ -18033,7 +18120,7 @@ function assertPlanV2Sha256(value, field) {
18033
18120
  }
18034
18121
  function planV2BlobPath(root, sha256) {
18035
18122
  const digest = assertPlanV2Sha256(sha256, "artifact sha256");
18036
- return join38(root, "artifacts", "sha256", digest.slice(0, 2), digest);
18123
+ return join39(root, "artifacts", "sha256", digest.slice(0, 2), digest);
18037
18124
  }
18038
18125
 
18039
18126
  // ../producer/src/services/distributed/planV2Publisher.ts
@@ -18068,7 +18155,7 @@ var LocalPlanV2ArtifactPublisher = class {
18068
18155
  #linkFile;
18069
18156
  #committed = false;
18070
18157
  constructor(destinationDir, options = {}) {
18071
- if (existsSync26(destinationDir)) {
18158
+ if (existsSync27(destinationDir)) {
18072
18159
  throw new PlanV2IntegrityError(`output directory already exists: ${destinationDir}`);
18073
18160
  }
18074
18161
  this.destinationDir = destinationDir;
@@ -18085,10 +18172,10 @@ var LocalPlanV2ArtifactPublisher = class {
18085
18172
  );
18086
18173
  }
18087
18174
  const destinationPath = planV2BlobPath(this.temporaryDir, digest);
18088
- if (existsSync26(destinationPath)) return;
18175
+ if (existsSync27(destinationPath)) return;
18089
18176
  mkdirSync15(dirname14(destinationPath), { recursive: true });
18090
18177
  const stagingDir = createStagingDir(dirname14(destinationPath), ".plan-v2-blob-");
18091
- const temporaryPath = join39(stagingDir, "blob");
18178
+ const temporaryPath = join40(stagingDir, "blob");
18092
18179
  try {
18093
18180
  try {
18094
18181
  this.#linkFile(blob.sourcePath, temporaryPath);
@@ -18103,13 +18190,13 @@ var LocalPlanV2ArtifactPublisher = class {
18103
18190
  }
18104
18191
  async commitManifest(manifestBytes) {
18105
18192
  for (const digest of new Set(manifestDigests(manifestBytes))) {
18106
- if (!existsSync26(planV2BlobPath(this.temporaryDir, digest))) {
18193
+ if (!existsSync27(planV2BlobPath(this.temporaryDir, digest))) {
18107
18194
  throw new PlanV2IntegrityError(
18108
18195
  `cannot commit manifest before referenced blob is durable: ${digest}`
18109
18196
  );
18110
18197
  }
18111
18198
  }
18112
- writeFileSync10(join39(this.temporaryDir, "plan.json"), manifestBytes, "utf-8");
18199
+ writeFileSync10(join40(this.temporaryDir, "plan.json"), manifestBytes, "utf-8");
18113
18200
  renameWithRetry(this.temporaryDir, this.destinationDir);
18114
18201
  this.#committed = true;
18115
18202
  }
@@ -18134,7 +18221,7 @@ function isNonNegativeIntegerArray(value) {
18134
18221
  return Array.isArray(value) && value.every((item) => typeof item === "number" && Number.isInteger(item) && item >= 0);
18135
18222
  }
18136
18223
  function readJsonFile(path, label) {
18137
- const contents = readFileSync10(path, "utf-8");
18224
+ const contents = readFileSync11(path, "utf-8");
18138
18225
  try {
18139
18226
  const parsed = JSON.parse(contents);
18140
18227
  return parsed;
@@ -18154,7 +18241,7 @@ function listFiles(root) {
18154
18241
  const rootResolved = resolve8(root);
18155
18242
  function walk(dir) {
18156
18243
  for (const entry of readdirSync10(dir, { withFileTypes: true })) {
18157
- const absolutePath = join40(dir, entry.name);
18244
+ const absolutePath = join41(dir, entry.name);
18158
18245
  if (entry.isDirectory()) {
18159
18246
  walk(absolutePath);
18160
18247
  } else if (entry.isFile()) {
@@ -18181,13 +18268,13 @@ function assertValidExtractionCacheCompleteSentinel(path) {
18181
18268
  }
18182
18269
  }
18183
18270
  function validateExtractionCacheCompleteSentinels(executionPlanDir) {
18184
- const videoRoot = join40(executionPlanDir, "video-frames");
18185
- if (!existsSync27(videoRoot)) return;
18271
+ const videoRoot = join41(executionPlanDir, "video-frames");
18272
+ if (!existsSync28(videoRoot)) return;
18186
18273
  for (const videoEntry of readdirSync10(videoRoot, { withFileTypes: true })) {
18187
18274
  if (!videoEntry.isDirectory()) continue;
18188
- const videoDir = join40(videoRoot, videoEntry.name);
18275
+ const videoDir = join41(videoRoot, videoEntry.name);
18189
18276
  if (readdirSync10(videoDir).includes(EXTRACTION_CACHE_COMPLETE_SENTINEL)) {
18190
- const sentinelPath = join40(videoDir, EXTRACTION_CACHE_COMPLETE_SENTINEL);
18277
+ const sentinelPath = join41(videoDir, EXTRACTION_CACHE_COMPLETE_SENTINEL);
18191
18278
  assertValidExtractionCacheCompleteSentinel(sentinelPath);
18192
18279
  }
18193
18280
  }
@@ -18198,7 +18285,7 @@ function isExtractionCacheCompleteSentinelPath(path) {
18198
18285
  }
18199
18286
  function resolveExtractedVideoOutputDir(planDir, videoId) {
18200
18287
  const videoRoot = resolve8(planDir, "video-frames");
18201
- const outputDir = resolve8(videoRoot, videoId);
18288
+ const outputDir = resolve8(videoRoot, mediaIdPathSegment(videoId));
18202
18289
  if (outputDir === videoRoot || !outputDir.startsWith(`${videoRoot}${sep4}`)) {
18203
18290
  throw new PlanV2IntegrityError(`unsafe extracted video id: ${JSON.stringify(videoId)}`);
18204
18291
  }
@@ -18234,7 +18321,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
18234
18321
  if (video.deferredRange) {
18235
18322
  const framePaths2 = /* @__PURE__ */ new Map();
18236
18323
  for (let index = 0; index < video.totalFrames; index++) {
18237
- framePaths2.set(index, join40(outputDir, String(index)));
18324
+ framePaths2.set(index, join41(outputDir, String(index)));
18238
18325
  }
18239
18326
  return { ...video, outputDir, framePaths: framePaths2, ownedByLookup: false };
18240
18327
  }
@@ -18242,7 +18329,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
18242
18329
  const framePaths = /* @__PURE__ */ new Map();
18243
18330
  for (const frameName of frameNames) {
18244
18331
  if (frameName === EXTRACTION_CACHE_COMPLETE_SENTINEL) {
18245
- assertValidExtractionCacheCompleteSentinel(join40(outputDir, frameName));
18332
+ assertValidExtractionCacheCompleteSentinel(join41(outputDir, frameName));
18246
18333
  continue;
18247
18334
  }
18248
18335
  const match = /(\d+)(?=\.[^.]+$)/.exec(frameName);
@@ -18261,7 +18348,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
18261
18348
  `duplicate extracted frame index ${frameIndex} in ${outputDir}`
18262
18349
  );
18263
18350
  }
18264
- framePaths.set(frameIndex, join40(outputDir, frameName));
18351
+ framePaths.set(frameIndex, join41(outputDir, frameName));
18265
18352
  }
18266
18353
  return {
18267
18354
  ...video,
@@ -18282,8 +18369,8 @@ function parsePlanVideosJson2(value) {
18282
18369
  }
18283
18370
  }
18284
18371
  function materializeExtractedVideoDirectories(planDir) {
18285
- const videosPath = join40(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
18286
- if (!existsSync27(videosPath)) return;
18372
+ const videosPath = join41(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
18373
+ if (!existsSync28(videosPath)) return;
18287
18374
  const videos = parsePlanVideosJson2(readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH));
18288
18375
  for (const video of videos.extracted) {
18289
18376
  mkdirSync16(resolveExtractedVideoOutputDir(planDir, video.videoId), { recursive: true });
@@ -18316,13 +18403,13 @@ function parseChunkSlices(value) {
18316
18403
  });
18317
18404
  }
18318
18405
  function buildVideoChunkDependencies(executionPlanDir, dimensions) {
18319
- const videoRoot = join40(executionPlanDir, "video-frames");
18320
- const hasExtractedFrames = existsSync27(videoRoot) && listFiles(videoRoot).length > 0;
18321
- const videosPath = join40(executionPlanDir, PLAN_VIDEOS_META_RELATIVE_PATH);
18322
- if (!existsSync27(videosPath)) {
18406
+ const videoRoot = join41(executionPlanDir, "video-frames");
18407
+ const hasExtractedFrames = existsSync28(videoRoot) && listFiles(videoRoot).length > 0;
18408
+ const videosPath = join41(executionPlanDir, PLAN_VIDEOS_META_RELATIVE_PATH);
18409
+ if (!existsSync28(videosPath)) {
18323
18410
  return hasExtractedFrames ? { mode: "full-source-pack", dependencies: null } : { mode: "exact-rendered-frames", dependencies: /* @__PURE__ */ new Map() };
18324
18411
  }
18325
- const chunksPath = join40(executionPlanDir, "meta", "chunks.json");
18412
+ const chunksPath = join41(executionPlanDir, "meta", "chunks.json");
18326
18413
  const videos = readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH);
18327
18414
  const chunks = readJsonFile(chunksPath, "meta/chunks.json");
18328
18415
  const parsedVideos = parsePlanVideosJson2(videos);
@@ -18376,10 +18463,10 @@ function computeManifestHash(manifest) {
18376
18463
  return sha256Hex(`${PLAN_V2_HASH_PREFIX}${canonicalJsonStringify(manifestPayload(manifest))}`);
18377
18464
  }
18378
18465
  function writeBlob(sourcePath, destinationPath) {
18379
- if (existsSync27(destinationPath)) return;
18466
+ if (existsSync28(destinationPath)) return;
18380
18467
  mkdirSync16(dirname15(destinationPath), { recursive: true });
18381
18468
  const temporaryDir = createStagingDir(dirname15(destinationPath), ".plan-v2-blob-");
18382
- const temporaryPath = join40(temporaryDir, "blob");
18469
+ const temporaryPath = join41(temporaryDir, "blob");
18383
18470
  try {
18384
18471
  copyFileSync6(sourcePath, temporaryPath);
18385
18472
  renameWithRetry(temporaryPath, destinationPath);
@@ -18415,8 +18502,8 @@ async function putTasks(tasks) {
18415
18502
  if (failure) throw failure.reason;
18416
18503
  }
18417
18504
  function buildPlanV2Publication(executionPlanDir, digests) {
18418
- const executionPlanPath = join40(executionPlanDir, "plan.json");
18419
- if (!existsSync27(executionPlanPath)) {
18505
+ const executionPlanPath = join41(executionPlanDir, "plan.json");
18506
+ if (!existsSync28(executionPlanPath)) {
18420
18507
  throw new PlanV2IntegrityError(`execution plan is missing plan.json: ${executionPlanPath}`);
18421
18508
  }
18422
18509
  const executionPlanValue = readJsonFile(executionPlanPath, "execution plan.json");
@@ -18443,7 +18530,7 @@ function buildPlanV2Publication(executionPlanDir, digests) {
18443
18530
  }
18444
18531
  validateExtractionCacheCompleteSentinels(executionPlanDir);
18445
18532
  const videoDependencyPlan = buildVideoChunkDependencies(executionPlanDir, dimensions);
18446
- const encoder = readJsonFile(join40(executionPlanDir, "meta", "encoder.json"), "meta/encoder.json");
18533
+ const encoder = readJsonFile(join41(executionPlanDir, "meta", "encoder.json"), "meta/encoder.json");
18447
18534
  const files = listFiles(executionPlanDir);
18448
18535
  const chunkAudio = !isRecord3(encoder) || encoder.chunksCarryAudio !== true ? "none" : files.some((file) => chunkAudioSliceTarget(file.path) !== null) ? "sliced" : "whole";
18449
18536
  for (const file of files) {
@@ -18496,7 +18583,7 @@ function buildPlanV2Publication(executionPlanDir, digests) {
18496
18583
  };
18497
18584
  }
18498
18585
  function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
18499
- if (existsSync27(planV2Dir)) {
18586
+ if (existsSync28(planV2Dir)) {
18500
18587
  throw new PlanV2IntegrityError(`output directory already exists: ${planV2Dir}`);
18501
18588
  }
18502
18589
  const publication = buildPlanV2Publication(executionPlanDir);
@@ -18510,7 +18597,7 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
18510
18597
  writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
18511
18598
  }
18512
18599
  writeFileSync11(
18513
- join40(tempDir, "plan.json"),
18600
+ join41(tempDir, "plan.json"),
18514
18601
  canonicalJsonStringify(publication.manifest),
18515
18602
  "utf-8"
18516
18603
  );
@@ -18562,7 +18649,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
18562
18649
  // artifactTargets ships every compiled/ file to all chunks, so each is in the manifest.
18563
18650
  whileAudioMixes: () => putBlobs(
18564
18651
  publisher,
18565
- listFiles(join40(stagingRoot, "compiled")).map(
18652
+ listFiles(join41(stagingRoot, "compiled")).map(
18566
18653
  (file) => publishBlobFor(file.absolutePath, digests)
18567
18654
  )
18568
18655
  ),
@@ -18582,7 +18669,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
18582
18669
  }
18583
18670
  }
18584
18671
  async function planV2(projectDir, config, planV2Dir) {
18585
- if (existsSync27(planV2Dir)) {
18672
+ if (existsSync28(planV2Dir)) {
18586
18673
  throw new PlanV2IntegrityError(`output directory already exists: ${planV2Dir}`);
18587
18674
  }
18588
18675
  const publisher = new LocalPlanV2ArtifactPublisher(planV2Dir);
@@ -18599,7 +18686,7 @@ function resultFromManifest(planV2Dir, manifest) {
18599
18686
  isRecord3(executionPlan) ? executionPlan[REFERENCE_BACKGROUND_FIELD] : void 0
18600
18687
  ),
18601
18688
  planDir: planV2Dir,
18602
- manifestPath: join40(planV2Dir, "plan.json"),
18689
+ manifestPath: join41(planV2Dir, "plan.json"),
18603
18690
  planProtocol: PLAN_PROTOCOL_V2,
18604
18691
  planHash: manifest.planHash,
18605
18692
  sourcePlanV1Hash: getPlanV2ExecutionPlanHash(manifest),
@@ -18735,8 +18822,8 @@ function parsePlanV2Manifest(value) {
18735
18822
  return parsed;
18736
18823
  }
18737
18824
  function readPlanV2Manifest(planV2Dir) {
18738
- const manifestPath = join40(planV2Dir, "plan.json");
18739
- if (!existsSync27(manifestPath)) {
18825
+ const manifestPath = join41(planV2Dir, "plan.json");
18826
+ if (!existsSync28(manifestPath)) {
18740
18827
  throw new PlanV2IntegrityError(`missing v2 manifest: ${manifestPath}`);
18741
18828
  }
18742
18829
  const value = readJsonFile(manifestPath, "v2 manifest");
@@ -18755,7 +18842,7 @@ function listPlanV2ArtifactsForTarget(manifest, target) {
18755
18842
  }
18756
18843
  function verifyBlob(planV2Dir, artifact) {
18757
18844
  const sourcePath = planV2BlobPath(planV2Dir, artifact.sha256);
18758
- if (!existsSync27(sourcePath)) {
18845
+ if (!existsSync28(sourcePath)) {
18759
18846
  throw new PlanV2IntegrityError(`missing content-addressed artifact ${artifact.sha256}`);
18760
18847
  }
18761
18848
  const stats = statSync9(sourcePath);
@@ -18768,7 +18855,7 @@ function verifyBlob(planV2Dir, artifact) {
18768
18855
  return sourcePath;
18769
18856
  }
18770
18857
  function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}) {
18771
- if (existsSync27(destinationDir)) {
18858
+ if (existsSync28(destinationDir)) {
18772
18859
  throw new PlanV2IntegrityError(`materialization destination already exists: ${destinationDir}`);
18773
18860
  }
18774
18861
  const manifest = readPlanV2Manifest(planV2Dir);
@@ -18784,13 +18871,13 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
18784
18871
  const tempDir = createStagingDir(dirname15(destinationDir), ".plan-v2-materialize-");
18785
18872
  try {
18786
18873
  for (const { artifact, sourcePath } of verified) {
18787
- const destinationPath = join40(tempDir, ...artifact.path.split("/"));
18874
+ const destinationPath = join41(tempDir, ...artifact.path.split("/"));
18788
18875
  mkdirSync16(dirname15(destinationPath), { recursive: true });
18789
18876
  copyFileSync6(sourcePath, destinationPath);
18790
18877
  }
18791
18878
  if (target.role === "chunk") materializeExtractedVideoDirectories(tempDir);
18792
18879
  writeFileSync11(
18793
- join40(tempDir, PLAN_V2_MATERIALIZATION_MARKER),
18880
+ join41(tempDir, PLAN_V2_MATERIALIZATION_MARKER),
18794
18881
  canonicalJsonStringify({
18795
18882
  manifest,
18796
18883
  target,
@@ -18813,7 +18900,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
18813
18900
  // Join the artifact's OWN name, not the current constant: a plan written
18814
18901
  // before the container change carries the legacy name, and materializing it
18815
18902
  // under the new one would point at a file that was never written.
18816
- audioPath: target.role === "assembler" ? audioArtifact ? join40(destinationDir, audioArtifact.path) : null : null
18903
+ audioPath: target.role === "assembler" ? audioArtifact ? join41(destinationDir, audioArtifact.path) : null : null
18817
18904
  };
18818
18905
  }
18819
18906
  function assertRemoteSources(remoteSources, artifacts) {
@@ -18832,8 +18919,8 @@ function validatePlanV2MaterializedTarget(planDir, expectedTarget) {
18832
18919
  return readValidatedPlanV2Materialization(planDir, expectedTarget)?.manifest ?? null;
18833
18920
  }
18834
18921
  function readValidatedPlanV2Materialization(planDir, expectedTarget) {
18835
- const markerPath = join40(planDir, PLAN_V2_MATERIALIZATION_MARKER);
18836
- if (!existsSync27(markerPath)) return null;
18922
+ const markerPath = join41(planDir, PLAN_V2_MATERIALIZATION_MARKER);
18923
+ if (!existsSync28(markerPath)) return null;
18837
18924
  const marker = readJsonFile(markerPath, "materialization marker");
18838
18925
  if (!isRecord3(marker) || !isRecord3(marker.manifest) || !isRecord3(marker.target)) {
18839
18926
  throw new PlanV2IntegrityError("malformed materialization marker");
@@ -18850,8 +18937,8 @@ function readValidatedPlanV2Materialization(planDir, expectedTarget) {
18850
18937
  assertRemoteSources(remoteSources, required);
18851
18938
  for (const artifact of required) {
18852
18939
  if (Object.hasOwn(remoteSources, artifact.path)) continue;
18853
- const path = join40(planDir, ...artifact.path.split("/"));
18854
- if (!existsSync27(path) || statSync9(path).size !== artifact.sizeBytes) {
18940
+ const path = join41(planDir, ...artifact.path.split("/"));
18941
+ if (!existsSync28(path) || statSync9(path).size !== artifact.sizeBytes) {
18855
18942
  throw new PlanV2IntegrityError(
18856
18943
  `materialized artifact missing or truncated: ${artifact.path}`
18857
18944
  );
@@ -18978,10 +19065,10 @@ async function beginFrameSessionNeedsScreenshotFallback(session, probe = probeBe
18978
19065
  return !await probe(session.page, timeoutMs, probeTick, session.beginFrameIntervalMs);
18979
19066
  }
18980
19067
  function hashChunkOutput(outputPath, kind) {
18981
- if (kind === "file") return sha256Hex(readFileSync11(outputPath));
19068
+ if (kind === "file") return sha256Hex(readFileSync12(outputPath));
18982
19069
  const entries = readdirSync11(outputPath).filter((name) => /\.(png|jpg|jpeg)$/i.test(name)).sort();
18983
19070
  const lines = entries.map(
18984
- (name) => `${name}\0${sha256Hex(readFileSync11(join41(outputPath, name)))}`
19071
+ (name) => `${name}\0${sha256Hex(readFileSync12(join42(outputPath, name)))}`
18985
19072
  );
18986
19073
  return sha256Hex(lines.join("\0"));
18987
19074
  }
@@ -18998,16 +19085,16 @@ function resolveLockedVp9CpuUsed(lockedEncoder) {
18998
19085
  async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18999
19086
  const start = Date.now();
19000
19087
  const log = defaultLogger;
19001
- const planJsonPath = join41(planDir, "plan.json");
19002
- const encoderJsonPath = join41(planDir, "meta", "encoder.json");
19003
- const chunksJsonPath = join41(planDir, "meta", "chunks.json");
19004
- if (!existsSync28(planJsonPath)) {
19088
+ const planJsonPath = join42(planDir, "plan.json");
19089
+ const encoderJsonPath = join42(planDir, "meta", "encoder.json");
19090
+ const chunksJsonPath = join42(planDir, "meta", "chunks.json");
19091
+ if (!existsSync29(planJsonPath)) {
19005
19092
  throw new RenderChunkValidationError(
19006
19093
  MISSING_PLAN_ARTIFACT,
19007
19094
  `[renderChunk] planDir is missing required artifact: ${planJsonPath}`
19008
19095
  );
19009
19096
  }
19010
- const plan2 = JSON.parse(readFileSync11(planJsonPath, "utf-8"));
19097
+ const plan2 = JSON.parse(readFileSync12(planJsonPath, "utf-8"));
19011
19098
  readPlanProtocolV1(plan2, DISTRIBUTED_RENDER_CAPABILITIES.roles.chunk);
19012
19099
  const planHashStarted = Date.now();
19013
19100
  const v2Materialization = readValidatedPlanV2Materialization(planDir, {
@@ -19017,20 +19104,20 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
19017
19104
  const v2Manifest = v2Materialization?.manifest ?? null;
19018
19105
  const remoteSources = v2Materialization?.remoteSources ?? {};
19019
19106
  for (const required of [encoderJsonPath, chunksJsonPath]) {
19020
- if (!existsSync28(required)) {
19107
+ if (!existsSync29(required)) {
19021
19108
  throw new RenderChunkValidationError(
19022
19109
  MISSING_PLAN_ARTIFACT,
19023
19110
  `[renderChunk] planDir is missing required artifact: ${required}`
19024
19111
  );
19025
19112
  }
19026
19113
  }
19027
- const encoder = JSON.parse(readFileSync11(encoderJsonPath, "utf-8"));
19028
- const chunks = JSON.parse(readFileSync11(chunksJsonPath, "utf-8"));
19029
- const videosJsonPath = join41(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
19114
+ const encoder = JSON.parse(readFileSync12(encoderJsonPath, "utf-8"));
19115
+ const chunks = JSON.parse(readFileSync12(chunksJsonPath, "utf-8"));
19116
+ const videosJsonPath = join42(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
19030
19117
  let planVideos = null;
19031
- if (existsSync28(videosJsonPath)) {
19118
+ if (existsSync29(videosJsonPath)) {
19032
19119
  try {
19033
- planVideos = validatePlanVideosForChunk(JSON.parse(readFileSync11(videosJsonPath, "utf-8")));
19120
+ planVideos = validatePlanVideosForChunk(JSON.parse(readFileSync12(videosJsonPath, "utf-8")));
19034
19121
  } catch (err) {
19035
19122
  if (err instanceof RenderChunkValidationError) throw err;
19036
19123
  throw new RenderChunkValidationError(
@@ -19058,8 +19145,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
19058
19145
  }
19059
19146
  const range = resolveChunkFrameRange(slice, chunkIndex, options?.frameRange);
19060
19147
  const framesInChunk = range.endFrame - range.startFrame;
19061
- const compiledDir = join41(planDir, "compiled");
19062
- if (!existsSync28(compiledDir)) {
19148
+ const compiledDir = join42(planDir, "compiled");
19149
+ if (!existsSync29(compiledDir)) {
19063
19150
  throw new RenderChunkValidationError(
19064
19151
  MISSING_PLAN_ARTIFACT,
19065
19152
  `[renderChunk] planDir missing compiled/ directory: ${compiledDir}`
@@ -19117,7 +19204,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
19117
19204
  };
19118
19205
  const workDir = `${outputChunkPath}.work.${process.pid}.${randomBytes(4).toString("hex")}`;
19119
19206
  mkdirSync17(workDir, { recursive: true });
19120
- const framesDir = join41(workDir, "captured-frames");
19207
+ const framesDir = join42(workDir, "captured-frames");
19121
19208
  mkdirSync17(framesDir, { recursive: true });
19122
19209
  const videoFramesDir = `${workDir}.video-frames`;
19123
19210
  const chunkFrameNumbers = Array.from({ length: framesInChunk }, (_, i) => range.startFrame + i);
@@ -19142,7 +19229,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
19142
19229
  dimensions: plan2.dimensions,
19143
19230
  encoder,
19144
19231
  videoCount: planVideos?.videos.length ?? 0,
19145
- html: readFileSync11(join41(compiledDir, "index.html"), "utf-8"),
19232
+ html: readFileSync12(join42(compiledDir, "index.html"), "utf-8"),
19146
19233
  // The plan ships a deferred source only to chunks that show it; don't wait on the rest.
19147
19234
  skipReadinessVideoIds: deferredVideos.filter(
19148
19235
  (video) => !shownFrames.get(video.videoId)?.size || remoteVideoIds.has(video.videoId)
@@ -19310,10 +19397,10 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
19310
19397
  const effectiveBitrate = encoder.crf != null ? void 0 : encoder.bitrate;
19311
19398
  const videoOnlyPath = encoder.chunksCarryAudio ? `${outputChunkPath}.video.mp4` : outputChunkPath;
19312
19399
  if (isPngSequence) {
19313
- if (!existsSync28(outputChunkPath)) mkdirSync17(outputChunkPath, { recursive: true });
19400
+ if (!existsSync29(outputChunkPath)) mkdirSync17(outputChunkPath, { recursive: true });
19314
19401
  } else {
19315
- const outDir = join41(outputChunkPath, "..");
19316
- if (!existsSync28(outDir)) mkdirSync17(outDir, { recursive: true });
19402
+ const outDir = join42(outputChunkPath, "..");
19403
+ if (!existsSync29(outDir)) mkdirSync17(outDir, { recursive: true });
19317
19404
  }
19318
19405
  const encodeInput = {
19319
19406
  job,
@@ -19420,7 +19507,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
19420
19507
  openAttempt,
19421
19508
  verifyFirstSession: forceScreenshot || !verifyInWorker ? void 0 : verifyFirstWorker
19422
19509
  }),
19423
- { stall: frameStallRule(job, framesInChunk) }
19510
+ { stall: frameStallRule(job, framesInChunk, void 0) }
19424
19511
  ).catch(async (captureError) => {
19425
19512
  await overlap.current?.abort();
19426
19513
  overlap.current = null;
@@ -19586,10 +19673,10 @@ async function renderSpan(projectDir, config, span, outputPath) {
19586
19673
  if (config.cfr === true) {
19587
19674
  throw new RenderSpanUnsupportedError("--start/--end cannot be combined with a cfr re-encode.");
19588
19675
  }
19589
- const workDir = mkdtempSync(join42(tmpdir4(), "hf-render-span-"));
19676
+ const workDir = mkdtempSync(join43(tmpdir4(), "hf-render-span-"));
19590
19677
  try {
19591
- const planDir = join42(workDir, "plan");
19592
- const partsDir = join42(workDir, "parts");
19678
+ const planDir = join43(workDir, "plan");
19679
+ const partsDir = join43(workDir, "parts");
19593
19680
  mkdirSync18(partsDir, { recursive: true });
19594
19681
  const planned = await plan(
19595
19682
  projectDir,
@@ -19604,7 +19691,7 @@ async function renderSpan(projectDir, config, span, outputPath) {
19604
19691
  planned.totalFrames
19605
19692
  );
19606
19693
  const slices = JSON.parse(
19607
- readFileSync12(join42(planDir, "meta", "chunks.json"), "utf-8")
19694
+ readFileSync13(join43(planDir, "meta", "chunks.json"), "utf-8")
19608
19695
  );
19609
19696
  const parts = [];
19610
19697
  for (const slice of slices) {
@@ -19614,7 +19701,7 @@ async function renderSpan(projectDir, config, span, outputPath) {
19614
19701
  };
19615
19702
  if (range.endFrame <= range.startFrame) continue;
19616
19703
  throwIfAborted(config.abortSignal);
19617
- const part = join42(partsDir, `part-${String(parts.length).padStart(4, "0")}.mp4`);
19704
+ const part = join43(partsDir, `part-${String(parts.length).padStart(4, "0")}.mp4`);
19618
19705
  await renderChunk(planDir, slice.index, part, { frameRange: range });
19619
19706
  parts.push(part);
19620
19707
  }
@@ -19834,6 +19921,13 @@ function validateDistributedRenderConfig(config) {
19834
19921
  `distributed mode supports only ${ALLOWED_HDR_MODES.join(", ")}; got ${String(config.hdrMode)}`
19835
19922
  );
19836
19923
  }
19924
+ const chromaSubsampling = config.chromaSubsampling;
19925
+ if (chromaSubsampling !== void 0 && chromaSubsampling !== "420") {
19926
+ throw new InvalidConfigError(
19927
+ "config.chromaSubsampling",
19928
+ `distributed mode encodes 4:2:0 only; got ${String(chromaSubsampling)}`
19929
+ );
19930
+ }
19837
19931
  if (config.variables !== void 0) {
19838
19932
  validateVariablesPayload(config.variables);
19839
19933
  }
@@ -20017,6 +20111,7 @@ function assertRequestOptionScalars(options) {
20017
20111
  assertOptionalEnum(options, "proresProfile", PRORES_PROFILE_NAMES);
20018
20112
  assertOptionalEnum(options, "strictness", ["strict", "best-effort"]);
20019
20113
  assertOptionalEnum(options, "hdrMode", ["auto", "force-hdr", "force-sdr"]);
20114
+ assertOptionalEnum(options, "chromaSubsampling", ["420", "444"]);
20020
20115
  assertOptionalEnum(options, "pageMotionBlur", ["off"]);
20021
20116
  if (options.videoFrameFormat !== void 0 && !isVideoFrameFormat(options.videoFrameFormat)) {
20022
20117
  throw new Error("Render request videoFrameFormat is invalid");
@@ -20105,6 +20200,11 @@ function distributedConfigFromRequest(request, runtime = {}) {
20105
20200
  if (options.hdrMode === "force-hdr") {
20106
20201
  throw new Error("Distributed render does not support force-hdr");
20107
20202
  }
20203
+ if (options.chromaSubsampling === "444") {
20204
+ throw new Error(
20205
+ "Distributed render does not support chromaSubsampling 444: chunk workers and the assemble encode 4:2:0"
20206
+ );
20207
+ }
20108
20208
  return {
20109
20209
  fps: distributedFps(options.fps),
20110
20210
  width: distributed.width,
@@ -20190,7 +20290,7 @@ function renderRequestFromDistributedConfig(input) {
20190
20290
 
20191
20291
  // ../producer/src/server.ts
20192
20292
  import {
20193
- existsSync as existsSync31,
20293
+ existsSync as existsSync32,
20194
20294
  mkdirSync as mkdirSync19,
20195
20295
  statSync as statSync11,
20196
20296
  mkdtempSync as mkdtempSync2,
@@ -20198,7 +20298,7 @@ import {
20198
20298
  rmSync as rmSync17,
20199
20299
  createReadStream as createReadStream5
20200
20300
  } from "fs";
20201
- import { resolve as resolve10, dirname as dirname17, join as join45 } from "path";
20301
+ import { resolve as resolve10, dirname as dirname17, join as join46 } from "path";
20202
20302
  import { tmpdir as tmpdir5 } from "os";
20203
20303
  import { parseArgs } from "util";
20204
20304
  import crypto from "crypto";
@@ -20208,15 +20308,15 @@ import { serve as serve2 } from "@hono/node-server";
20208
20308
 
20209
20309
  // ../producer/src/services/hyperframeLint.ts
20210
20310
  import {
20211
- existsSync as existsSync29,
20212
- readFileSync as readFileSync13,
20311
+ existsSync as existsSync30,
20312
+ readFileSync as readFileSync14,
20213
20313
  statSync as statSync10,
20214
20314
  openSync as openSync6,
20215
20315
  fstatSync as fstatSync3,
20216
20316
  closeSync as closeSync6,
20217
20317
  constants as constants3
20218
20318
  } from "fs";
20219
- import { resolve as resolve9, join as join43, relative as relative7, isAbsolute as isAbsolute4, sep as sep5 } from "path";
20319
+ import { resolve as resolve9, join as join44, relative as relative7, isAbsolute as isAbsolute4, sep as sep5 } from "path";
20220
20320
  function isStringRecord(value) {
20221
20321
  if (!value || typeof value !== "object" || Array.isArray(value)) {
20222
20322
  return false;
@@ -20254,14 +20354,14 @@ function readEntryHtml(filePath) {
20254
20354
  }
20255
20355
  try {
20256
20356
  if (!fstatSync3(fd).isFile()) return null;
20257
- return readFileSync13(fd, "utf-8");
20357
+ return readFileSync14(fd, "utf-8");
20258
20358
  } finally {
20259
20359
  closeSync6(fd);
20260
20360
  }
20261
20361
  }
20262
20362
  function readProjectEntryFile(projectDir, preferredEntryFile) {
20263
20363
  const absProjectDir = resolve9(projectDir);
20264
- if (!existsSync29(absProjectDir) || !statSync10(absProjectDir).isDirectory()) {
20364
+ if (!existsSync30(absProjectDir) || !statSync10(absProjectDir).isDirectory()) {
20265
20365
  return { error: `Project directory not found: ${absProjectDir}` };
20266
20366
  }
20267
20367
  const entryCandidates = [preferredEntryFile, "index.html", "src/index.html"].filter(
@@ -20283,7 +20383,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile) {
20283
20383
  }
20284
20384
  }
20285
20385
  return {
20286
- error: `No HTML entry file found in project directory: ${join43(absProjectDir, preferredEntryFile || "index.html")}`
20386
+ error: `No HTML entry file found in project directory: ${join44(absProjectDir, preferredEntryFile || "index.html")}`
20287
20387
  };
20288
20388
  }
20289
20389
  function prepareHyperframeLintBody(body) {
@@ -20329,8 +20429,8 @@ async function runHyperframeLint(prepared) {
20329
20429
  // ../producer/src/services/healthWorker.ts
20330
20430
  import { Worker as Worker2 } from "worker_threads";
20331
20431
  import { fileURLToPath as fileURLToPath6 } from "url";
20332
- import { dirname as dirname16, join as join44 } from "path";
20333
- import { existsSync as existsSync30 } from "fs";
20432
+ import { dirname as dirname16, join as join45 } from "path";
20433
+ import { existsSync as existsSync31 } from "fs";
20334
20434
  var DEFAULT_HEALTH_PORT = 9848;
20335
20435
  async function startHealthWorker(options = {}) {
20336
20436
  const log = options.logger ?? defaultLogger2();
@@ -20405,9 +20505,9 @@ function defaultLogger2() {
20405
20505
  }
20406
20506
  function resolveWorkerEntry2() {
20407
20507
  const here = dirname16(fileURLToPath6(import.meta.url));
20408
- const candidates = [join44(here, "healthWorkerThread.js"), join44(here, "healthWorkerThread.ts")];
20508
+ const candidates = [join45(here, "healthWorkerThread.js"), join45(here, "healthWorkerThread.ts")];
20409
20509
  for (const candidate of candidates) {
20410
- if (existsSync30(candidate)) return candidate;
20510
+ if (existsSync31(candidate)) return candidate;
20411
20511
  }
20412
20512
  return void 0;
20413
20513
  }
@@ -20477,7 +20577,15 @@ function parseRenderOptions(body) {
20477
20577
  const format = parseServerFormat(body.format);
20478
20578
  const outputDynamicRange = parseServerOutputDynamicRange(body.outputDynamicRange) ?? fromRenderHdrMode(parseLegacyServerHdrMode(body.hdrMode));
20479
20579
  const encoder = parseEncoderOptions(body, format ?? "mp4");
20480
- const { crf, videoBitrate, videoFrameFormat, keyframeIntervalSeconds, maxBitrate, bufferSize } = encoder.ok ? encoder.options : {};
20580
+ const {
20581
+ crf,
20582
+ videoBitrate,
20583
+ videoFrameFormat,
20584
+ keyframeIntervalSeconds,
20585
+ maxBitrate,
20586
+ bufferSize,
20587
+ chromaSubsampling
20588
+ } = encoder.ok ? encoder.options : {};
20481
20589
  const { variables, outputResolution, outputResolutionAspectAgnostic } = parseRenderOverrides(body);
20482
20590
  return {
20483
20591
  outputPath,
@@ -20490,6 +20598,7 @@ function parseRenderOptions(body) {
20490
20598
  keyframeIntervalSeconds,
20491
20599
  maxBitrate,
20492
20600
  bufferSize,
20601
+ chromaSubsampling,
20493
20602
  useGpu,
20494
20603
  debug,
20495
20604
  forceScreenshot,
@@ -20529,6 +20638,7 @@ function buildRenderJobConfig(input, outputPath, log) {
20529
20638
  keyframeIntervalSeconds: input.keyframeIntervalSeconds,
20530
20639
  maxBitrate: input.maxBitrate,
20531
20640
  bufferSize: input.bufferSize,
20641
+ chromaSubsampling: input.chromaSubsampling,
20532
20642
  useGpu: input.useGpu,
20533
20643
  debug: input.debug,
20534
20644
  strictness: input.strictness,
@@ -20547,15 +20657,28 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log) {
20547
20657
  const { input, cleanupProjectDir } = prepared;
20548
20658
  const absoluteOutputPath = resolveOutputPath(input.projectDir, input.outputPath, rendersDir, log);
20549
20659
  const outputDir = dirname17(absoluteOutputPath);
20550
- if (!existsSync31(outputDir)) mkdirSync19(outputDir, { recursive: true });
20660
+ if (!existsSync32(outputDir)) mkdirSync19(outputDir, { recursive: true });
20551
20661
  return { input, cleanupProjectDir, absoluteOutputPath };
20552
20662
  }
20663
+ function prepareRenderJob(prepared, rendersDir, log) {
20664
+ try {
20665
+ const output = resolvePreparedRenderOutput(prepared, rendersDir, log);
20666
+ const job = createRenderJob(buildRenderJobConfig(output.input, output.absoluteOutputPath, log));
20667
+ return { ...output, job };
20668
+ } catch (error) {
20669
+ cleanupTempDir(prepared.cleanupProjectDir, log);
20670
+ return { error: error instanceof Error ? error.message : String(error) };
20671
+ }
20672
+ }
20553
20673
  function validateRenderOverrides(body) {
20554
20674
  const encoder = parseEncoderOptions(body, parseServerFormat(body.format) ?? "mp4");
20555
20675
  if (!encoder.ok) return encoder.error;
20556
20676
  if (body.maxRenderMs !== void 0 && (typeof body.maxRenderMs !== "number" || !Number.isInteger(body.maxRenderMs) || body.maxRenderMs < 0)) {
20557
20677
  return "maxRenderMs must be a non-negative integer number of milliseconds";
20558
20678
  }
20679
+ if (typeof body.workers === "number" && (!Number.isInteger(body.workers) || body.workers < 1)) {
20680
+ return "workers must be a positive integer";
20681
+ }
20559
20682
  if (body.variables !== void 0 && !isPlainObject2(body.variables)) {
20560
20683
  return 'variables must be a JSON object keyed by variable id (e.g. {"title":"Hello"})';
20561
20684
  }
@@ -20570,6 +20693,9 @@ function validateRenderOverrides(body) {
20570
20693
  if (outputDynamicRange !== void 0 && legacyHdrMode !== void 0 && outputDynamicRange !== fromRenderHdrMode(legacyHdrMode)) {
20571
20694
  return "outputDynamicRange and legacy hdrMode must describe the same output policy";
20572
20695
  }
20696
+ if (body.chromaSubsampling === "444" && outputDynamicRange === "hdr") {
20697
+ return 'chromaSubsampling "444" is SDR only, not outputDynamicRange "hdr"';
20698
+ }
20573
20699
  return validateOutputResolutionOverride(body);
20574
20700
  }
20575
20701
  function validateOutputResolutionOverride(body) {
@@ -20588,11 +20714,11 @@ function prepareProjectDirectory(projectDir, options) {
20588
20714
  const candidate = nonEmptyString(projectDir);
20589
20715
  if (!candidate) return null;
20590
20716
  const absProjectDir = resolve10(candidate);
20591
- if (!existsSync31(absProjectDir) || !statSync11(absProjectDir).isDirectory()) {
20717
+ if (!existsSync32(absProjectDir) || !statSync11(absProjectDir).isDirectory()) {
20592
20718
  return { error: `Project directory not found: ${absProjectDir}` };
20593
20719
  }
20594
20720
  const entry = options.entryFile || "index.html";
20595
- if (!existsSync31(resolve10(absProjectDir, entry))) {
20721
+ if (!existsSync32(resolve10(absProjectDir, entry))) {
20596
20722
  return { error: `Entry file "${entry}" not found in project directory: ${absProjectDir}` };
20597
20723
  }
20598
20724
  return { prepared: { input: { projectDir: absProjectDir, ...options } } };
@@ -20613,8 +20739,8 @@ async function resolveInlineRenderHtml(body) {
20613
20739
  }
20614
20740
  function materializeInlineProject(html, options) {
20615
20741
  const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR || tmpdir5();
20616
- const tempProjectDir = mkdtempSync2(join45(tempRoot, "producer-project-"));
20617
- writeFileSync13(join45(tempProjectDir, "index.html"), html, "utf-8");
20742
+ const tempProjectDir = mkdtempSync2(join46(tempRoot, "producer-project-"));
20743
+ writeFileSync13(join46(tempProjectDir, "index.html"), html, "utf-8");
20618
20744
  return {
20619
20745
  prepared: {
20620
20746
  input: { projectDir: tempProjectDir, ...options },
@@ -20684,7 +20810,7 @@ function cleanupTempDir(dir, log) {
20684
20810
  }
20685
20811
  }
20686
20812
  function outputFileSize(path) {
20687
- return existsSync31(path) ? statSync11(path).size : 0;
20813
+ return existsSync32(path) ? statSync11(path).size : 0;
20688
20814
  }
20689
20815
  function createBlockingProgressReporter(log, requestId) {
20690
20816
  let lastLoggedPct = -10;
@@ -20833,11 +20959,11 @@ function createRenderHandlers(options = {}) {
20833
20959
  if ("error" in preparedResult) {
20834
20960
  return c.json({ success: false, requestId, error: preparedResult.error }, 400);
20835
20961
  }
20836
- const { input, cleanupProjectDir, absoluteOutputPath } = resolvePreparedRenderOutput(
20837
- preparedResult.prepared,
20838
- rendersDir,
20839
- log
20840
- );
20962
+ const preparedJob = prepareRenderJob(preparedResult.prepared, rendersDir, log);
20963
+ if ("error" in preparedJob) {
20964
+ return c.json({ success: false, requestId, error: preparedJob.error }, 400);
20965
+ }
20966
+ const { job, input, cleanupProjectDir, absoluteOutputPath } = preparedJob;
20841
20967
  const release = await renderSemaphore.acquire();
20842
20968
  log.info("render started", {
20843
20969
  requestId,
@@ -20845,7 +20971,6 @@ function createRenderHandlers(options = {}) {
20845
20971
  fps: input.fps,
20846
20972
  quality: input.quality
20847
20973
  });
20848
- const job = createRenderJob(buildRenderJobConfig(input, absoluteOutputPath, log));
20849
20974
  try {
20850
20975
  await executeRenderJob(
20851
20976
  job,
@@ -20913,13 +21038,20 @@ function createRenderHandlers(options = {}) {
20913
21038
  const t0 = Date.now();
20914
21039
  const prepared = await prepareSseRenderRequest(c, stream, requestId);
20915
21040
  if (!prepared) return;
20916
- const { input, cleanupProjectDir, absoluteOutputPath } = resolvePreparedRenderOutput(
20917
- prepared,
20918
- rendersDir,
20919
- log
20920
- );
21041
+ const preparedJob = prepareRenderJob(prepared, rendersDir, log);
21042
+ if ("error" in preparedJob) {
21043
+ await stream.writeSSE({
21044
+ data: JSON.stringify({
21045
+ type: "error",
21046
+ requestId,
21047
+ error: preparedJob.error,
21048
+ stage: "validation"
21049
+ })
21050
+ });
21051
+ return;
21052
+ }
21053
+ const { job, input, cleanupProjectDir, absoluteOutputPath } = preparedJob;
20921
21054
  log.info("render-stream started", { requestId, projectDir: input.projectDir });
20922
- const job = createRenderJob(buildRenderJobConfig(input, absoluteOutputPath, log));
20923
21055
  const abortController = new AbortController();
20924
21056
  const onRequestAbort = () => abortController.abort(new RenderCancelledError("request_aborted"));
20925
21057
  c.req.raw.signal.addEventListener("abort", onRequestAbort, { once: true });
@@ -20963,7 +21095,8 @@ function createRenderHandlers(options = {}) {
20963
21095
  videoDurationSeconds: job.duration ?? null,
20964
21096
  outcome: job.outcome ?? "completed",
20965
21097
  warnings: job.warnings,
20966
- perf: job.perfSummary ?? null
21098
+ perf: job.perfSummary ?? null,
21099
+ producerVersion: readProducerVersion()
20967
21100
  })
20968
21101
  });
20969
21102
  } catch (error) {
@@ -20988,7 +21121,7 @@ function createRenderHandlers(options = {}) {
20988
21121
  if (!artifact) {
20989
21122
  return c.json({ success: false, error: "Output artifact not found or expired" }, 404);
20990
21123
  }
20991
- if (!existsSync31(artifact.path)) {
21124
+ if (!existsSync32(artifact.path)) {
20992
21125
  store.delete(token);
20993
21126
  return c.json({ success: false, error: "Output artifact file missing" }, 404);
20994
21127
  }
@@ -21008,9 +21141,26 @@ function createRenderHandlers(options = {}) {
21008
21141
  });
21009
21142
  return { render, renderStream, lint, health, outputs, queue };
21010
21143
  }
21144
+ function isCrossOriginBrowserRequest(c) {
21145
+ const fetchSite = c.req.header("sec-fetch-site");
21146
+ if (fetchSite) return fetchSite !== "same-origin" && fetchSite !== "none";
21147
+ const origin = c.req.header("origin");
21148
+ if (!origin) return false;
21149
+ try {
21150
+ return new URL(origin).host !== c.req.header("host");
21151
+ } catch {
21152
+ return true;
21153
+ }
21154
+ }
21011
21155
  function createProducerApp(options = {}) {
21012
21156
  const app = new Hono2();
21013
21157
  const handlers = createRenderHandlers(options);
21158
+ app.post("*", async (c, next) => {
21159
+ if (isCrossOriginBrowserRequest(c)) {
21160
+ return c.json({ success: false, error: "Cross-origin requests are not allowed" }, 403);
21161
+ }
21162
+ await next();
21163
+ });
21014
21164
  app.get("/health", handlers.health);
21015
21165
  app.post("/render", handlers.render);
21016
21166
  app.post("/render/stream", handlers.renderStream);
@@ -21035,7 +21185,7 @@ function startServer(options = {}) {
21035
21185
  });
21036
21186
  async function shutdown(signal) {
21037
21187
  log.info(`Received ${signal}, shutting down`);
21038
- const { drainBrowserPool } = await import("./src-NIMSUB4P.js");
21188
+ const { drainBrowserPool } = await import("./src-HHPRCLEW.js");
21039
21189
  await drainBrowserPool().catch(() => {
21040
21190
  });
21041
21191
  const handle = await Promise.race([
@@ -21073,20 +21223,20 @@ if (isPublicServerEntry) {
21073
21223
  // ../producer/src/services/distributed/planV2Execution.ts
21074
21224
  import { mkdtempSync as mkdtempSync3, rmSync as rmSync19 } from "fs";
21075
21225
  import { tmpdir as tmpdir6 } from "os";
21076
- import { join as join47 } from "path";
21226
+ import { join as join48 } from "path";
21077
21227
 
21078
21228
  // ../producer/src/services/distributed/assemble.ts
21079
21229
  import {
21080
21230
  cpSync as cpSync3,
21081
- existsSync as existsSync32,
21231
+ existsSync as existsSync33,
21082
21232
  mkdirSync as mkdirSync20,
21083
- readFileSync as readFileSync14,
21233
+ readFileSync as readFileSync15,
21084
21234
  readdirSync as readdirSync12,
21085
21235
  rmSync as rmSync18,
21086
21236
  statSync as statSync12,
21087
21237
  writeFileSync as writeFileSync14
21088
21238
  } from "fs";
21089
- import { basename as basename8, dirname as dirname18, join as join46 } from "path";
21239
+ import { basename as basename8, dirname as dirname18, join as join47 } from "path";
21090
21240
  function cfrRateControlArgs(locked) {
21091
21241
  const preset = getEncoderPreset(locked.quality ?? "standard", "mp4");
21092
21242
  if (locked.crf == null && locked.bitrate) {
@@ -21119,7 +21269,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
21119
21269
  }
21120
21270
  const format = plan2.dimensions.format;
21121
21271
  const cfrEncoder = cfr ? readCfrEncoder(planDir, format) : null;
21122
- if (!existsSync32(dirname18(outputPath))) {
21272
+ if (!existsSync33(dirname18(outputPath))) {
21123
21273
  mkdirSync20(dirname18(outputPath), { recursive: true });
21124
21274
  }
21125
21275
  const workDir = createStagingDir(dirname18(outputPath), `${basename8(outputPath)}.assemble-work-`);
@@ -21142,8 +21292,8 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
21142
21292
  };
21143
21293
  try {
21144
21294
  const videoSources = cfrEncoder ? [await reencodeCfr(ctx, chunkPaths, cfrEncoder)] : chunkPaths;
21145
- const finalPath = join46(workDir, `output.${format}`);
21146
- const audio = audioPath !== null && existsSync32(audioPath) ? audioPath : null;
21295
+ const finalPath = join47(workDir, `output.${format}`);
21296
+ const audio = audioPath !== null && existsSync33(audioPath) ? audioPath : null;
21147
21297
  await writeJoined(ctx, videoSources, audio, finalPath);
21148
21298
  renameWithRetry(finalPath, outputPath);
21149
21299
  log.info("[assemble] stage timings", {
@@ -21161,7 +21311,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
21161
21311
  });
21162
21312
  }
21163
21313
  }
21164
- const fileSize = existsSync32(outputPath) ? statSync12(outputPath).size : 0;
21314
+ const fileSize = existsSync33(outputPath) ? statSync12(outputPath).size : 0;
21165
21315
  return {
21166
21316
  ...referenceBackgroundResult(plan2[REFERENCE_BACKGROUND_FIELD]),
21167
21317
  outputPath,
@@ -21171,18 +21321,18 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
21171
21321
  };
21172
21322
  }
21173
21323
  function readAssemblePlan(planDir, chunkPaths) {
21174
- const planJsonPath = join46(planDir, "plan.json");
21175
- const chunksJsonPath = join46(planDir, "meta", "chunks.json");
21176
- if (!existsSync32(planJsonPath)) {
21324
+ const planJsonPath = join47(planDir, "plan.json");
21325
+ const chunksJsonPath = join47(planDir, "meta", "chunks.json");
21326
+ if (!existsSync33(planJsonPath)) {
21177
21327
  throw new Error(`[assemble] planDir missing plan.json: ${planJsonPath}`);
21178
21328
  }
21179
- const plan2 = JSON.parse(readFileSync14(planJsonPath, "utf-8"));
21329
+ const plan2 = JSON.parse(readFileSync15(planJsonPath, "utf-8"));
21180
21330
  readPlanProtocolV1(plan2, DISTRIBUTED_RENDER_CAPABILITIES.roles.assembler);
21181
21331
  validatePlanV2MaterializedTarget(planDir, { role: "assembler" });
21182
- if (!existsSync32(chunksJsonPath)) {
21332
+ if (!existsSync33(chunksJsonPath)) {
21183
21333
  throw new Error(`[assemble] planDir missing meta/chunks.json: ${chunksJsonPath}`);
21184
21334
  }
21185
- const chunks = JSON.parse(readFileSync14(chunksJsonPath, "utf-8"));
21335
+ const chunks = JSON.parse(readFileSync15(chunksJsonPath, "utf-8"));
21186
21336
  if (chunkPaths.length !== chunks.length) {
21187
21337
  throw new Error(
21188
21338
  `[assemble] chunkPaths length (${chunkPaths.length}) does not match chunks.json length (${chunks.length}). Adapters must pass one path per chunk, ordered by index.`
@@ -21194,7 +21344,7 @@ function readAssemblePlan(planDir, chunkPaths) {
21194
21344
  }
21195
21345
  }
21196
21346
  for (const path of chunkPaths.flat()) {
21197
- if (!existsSync32(path)) {
21347
+ if (!existsSync33(path)) {
21198
21348
  throw new Error(`[assemble] chunk path does not exist: ${path}`);
21199
21349
  }
21200
21350
  }
@@ -21223,7 +21373,7 @@ function cfrEncodeArgs(inputArgs, encoder, fpsArg) {
21223
21373
  return args;
21224
21374
  }
21225
21375
  async function reencodeCfr(ctx, chunkPaths, encoder) {
21226
- const cfrOutputPath = join46(ctx.workDir, `cfr.${ctx.format}`);
21376
+ const cfrOutputPath = join47(ctx.workDir, `cfr.${ctx.format}`);
21227
21377
  const cfrArgs = cfrEncodeArgs(videoInputArgs(ctx, chunkPaths), encoder, ctx.fpsArg);
21228
21378
  appendRenderProvenanceArgs(cfrArgs, cfrOutputPath);
21229
21379
  cfrArgs.push("-y", cfrOutputPath);
@@ -21250,7 +21400,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
21250
21400
  );
21251
21401
  return;
21252
21402
  }
21253
- const paddedAudioPath = join46(ctx.workDir, "audio-padded.m4a");
21403
+ const paddedAudioPath = join47(ctx.workDir, "audio-padded.m4a");
21254
21404
  const padTrimResult = await ctx.timed(
21255
21405
  "audioMs",
21256
21406
  () => padOrTrimAudioToVideoFrameCount({
@@ -21290,7 +21440,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
21290
21440
  }
21291
21441
  }
21292
21442
  function concatDemuxerInput(chunkPaths, workDir, fpsArg) {
21293
- const listPath = join46(workDir, "concat-list.txt");
21443
+ const listPath = join47(workDir, "concat-list.txt");
21294
21444
  const body = chunkPaths.map((path) => `file '${path.replace(/'/g, "'\\''")}'`).join("\n");
21295
21445
  writeFileSync14(listPath, `${body}
21296
21446
  `, "utf-8");
@@ -21328,13 +21478,13 @@ function stitchesSeparateAudio(planDir) {
21328
21478
  return lockedAudio(planDir).separateAudio === true;
21329
21479
  }
21330
21480
  function planFormat(planDir) {
21331
- const plan2 = JSON.parse(readFileSync14(join46(planDir, "plan.json"), "utf-8"));
21481
+ const plan2 = JSON.parse(readFileSync15(join47(planDir, "plan.json"), "utf-8"));
21332
21482
  return plan2.dimensions.format;
21333
21483
  }
21334
21484
  function lockedAudio(planDir) {
21335
- const encoderJsonPath = join46(planDir, "meta", "encoder.json");
21336
- if (!existsSync32(encoderJsonPath)) return {};
21337
- return JSON.parse(readFileSync14(encoderJsonPath, "utf-8"));
21485
+ const encoderJsonPath = join47(planDir, "meta", "encoder.json");
21486
+ if (!existsSync33(encoderJsonPath)) return {};
21487
+ return JSON.parse(readFileSync15(encoderJsonPath, "utf-8"));
21338
21488
  }
21339
21489
  function readCfrEncoder(planDir, format) {
21340
21490
  if (format !== "mp4") {
@@ -21342,11 +21492,11 @@ function readCfrEncoder(planDir, format) {
21342
21492
  `[assemble] cfr=true is only supported for format="mp4" (got "${format}"). Stream-copy paths for webm and mov already produce exact avg_frame_rate; cfr re-encode is not needed.`
21343
21493
  );
21344
21494
  }
21345
- const encoderJsonPath = join46(planDir, "meta", "encoder.json");
21346
- if (!existsSync32(encoderJsonPath)) {
21495
+ const encoderJsonPath = join47(planDir, "meta", "encoder.json");
21496
+ if (!existsSync33(encoderJsonPath)) {
21347
21497
  throw new Error(`[assemble] planDir missing meta/encoder.json: ${encoderJsonPath}`);
21348
21498
  }
21349
- const encoderJson = JSON.parse(readFileSync14(encoderJsonPath, "utf-8"));
21499
+ const encoderJson = JSON.parse(readFileSync15(encoderJsonPath, "utf-8"));
21350
21500
  if (encoderJson.encoder === "libx265-software") {
21351
21501
  throw new Error(
21352
21502
  `[assemble] cfr=true is not yet supported with codec: "h265". The cfr re-encode pass uses libx264 and would silently transcode the h265 chunks. Either disable cfr or render with codec: "h264".`
@@ -21355,7 +21505,7 @@ function readCfrEncoder(planDir, format) {
21355
21505
  return encoderJson;
21356
21506
  }
21357
21507
  function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, startTimeMs) {
21358
- if (existsSync32(outputPath)) rmSync18(outputPath, { recursive: true, force: true });
21508
+ if (existsSync33(outputPath)) rmSync18(outputPath, { recursive: true, force: true });
21359
21509
  mkdirSync20(outputPath, { recursive: true });
21360
21510
  let globalIdx = 0;
21361
21511
  for (const chunkDir of chunkPaths) {
@@ -21369,8 +21519,8 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
21369
21519
  throw new Error(`[assemble] png-sequence chunk has no frames: ${chunkDir}`);
21370
21520
  }
21371
21521
  for (const frame of frames) {
21372
- const dst = join46(outputPath, formatExportFrameName(globalIdx, "png"));
21373
- cpSync3(join46(chunkDir, frame), dst);
21522
+ const dst = join47(outputPath, formatExportFrameName(globalIdx, "png"));
21523
+ cpSync3(join47(chunkDir, frame), dst);
21374
21524
  globalIdx += 1;
21375
21525
  }
21376
21526
  }
@@ -21379,14 +21529,14 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
21379
21529
  `[assemble] png-sequence frame count mismatch: merged ${globalIdx} frames vs plan.totalFrames=${totalFrames}. Using on-disk count.`
21380
21530
  );
21381
21531
  }
21382
- if (audioPath !== null && existsSync32(audioPath)) {
21383
- const sidecar = join46(outputPath, MIXED_AUDIO_FILENAME);
21532
+ if (audioPath !== null && existsSync33(audioPath)) {
21533
+ const sidecar = join47(outputPath, MIXED_AUDIO_FILENAME);
21384
21534
  cpSync3(audioPath, sidecar);
21385
21535
  }
21386
21536
  let fileSize = 0;
21387
21537
  for (const name of readdirSync12(outputPath)) {
21388
21538
  try {
21389
- fileSize += statSync12(join46(outputPath, name)).size;
21539
+ fileSize += statSync12(join47(outputPath, name)).size;
21390
21540
  } catch {
21391
21541
  }
21392
21542
  }
@@ -21400,8 +21550,8 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
21400
21550
 
21401
21551
  // ../producer/src/services/distributed/planV2Execution.ts
21402
21552
  async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
21403
- const workRoot = mkdtempSync3(join47(tmpdir6(), "hf-plan-v2-chunk-"));
21404
- const materializedPlanDir = join47(workRoot, "plan");
21553
+ const workRoot = mkdtempSync3(join48(tmpdir6(), "hf-plan-v2-chunk-"));
21554
+ const materializedPlanDir = join48(workRoot, "plan");
21405
21555
  try {
21406
21556
  materializePlanV2Target(planV2Dir, { role: "chunk", chunkIndex }, materializedPlanDir);
21407
21557
  return await renderChunk(materializedPlanDir, chunkIndex, outputChunkPath, options);
@@ -21410,8 +21560,8 @@ async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
21410
21560
  }
21411
21561
  }
21412
21562
  async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
21413
- const workRoot = mkdtempSync3(join47(tmpdir6(), "hf-plan-v2-assembler-"));
21414
- const materializedPlanDir = join47(workRoot, "plan");
21563
+ const workRoot = mkdtempSync3(join48(tmpdir6(), "hf-plan-v2-assembler-"));
21564
+ const materializedPlanDir = join48(workRoot, "plan");
21415
21565
  try {
21416
21566
  const materialized = materializePlanV2Target(
21417
21567
  planV2Dir,
@@ -21433,7 +21583,7 @@ async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
21433
21583
  // ../producer/src/services/distributed/projectHash.ts
21434
21584
  import { closeSync as closeSync7, openSync as openSync7, readdirSync as readdirSync13, readSync as readSync5, realpathSync as realpathSync2, statSync as statSync13 } from "fs";
21435
21585
  import { createHash as createHash8 } from "crypto";
21436
- import { join as join48 } from "path";
21586
+ import { join as join49 } from "path";
21437
21587
  var READ_CHUNK_BYTES = 256 * 1024;
21438
21588
 
21439
21589
  // ../producer/src/services/distributed/audioSidecar.ts