hyperframes 0.9.66 → 0.9.68

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 (290) hide show
  1. package/dist/{add-Q4W2PAZ6.js → add-C4WVIZBM.js} +14 -14
  2. package/dist/{agentPromptGenerator-BZ77OPI4.js → agentPromptGenerator-6LLQYHZV.js} +9 -9
  3. package/dist/{animatedGifPrep-3UBRNEEA.js → animatedGifPrep-3VMWRGRQ.js} +9 -9
  4. package/dist/api.js +39 -39
  5. package/dist/{asset-ZRTGYYEN.js → asset-WIUPYC6I.js} +4 -4
  6. package/dist/{assetCataloger-GTSOUOBQ.js → assetCataloger-35EEYGRW.js} +10 -10
  7. package/dist/{audio-ZUW3RHEO.js → audio-X6U5EPJC.js} +24 -24
  8. package/dist/{auth-TE5FMKUT.js → auth-6YJJF7JO.js} +4 -4
  9. package/dist/{autoUpdate-6JGNDMLP.js → autoUpdate-5RW6OSP5.js} +4 -4
  10. package/dist/{avatars-BJEF4TZR.js → avatars-3TUWVA5L.js} +18 -18
  11. package/dist/{backgroundChecks-EN5XLRLY.js → backgroundChecks-NFDJJ3A7.js} +5 -5
  12. package/dist/backgroundChecksWorker.js +5 -5
  13. package/dist/{batchRender-EEMYIEYR.js → batchRender-RD2SC67M.js} +6 -5
  14. package/dist/{beats-IPGSP5BV.js → beats-SEZBR7ZB.js} +12 -12
  15. package/dist/{benchmark-GZOATIPM.js → benchmark-HIHHSXWJ.js} +14 -14
  16. package/dist/{billing-3LF2YYP7.js → billing-KOAEFBSV.js} +23 -19
  17. package/dist/{browser-2IH45NN6.js → browser-CMQWPJW3.js} +9 -9
  18. package/dist/{bundleWithLocalizedFonts-QV6WDOXF.js → bundleWithLocalizedFonts-54M62O3L.js} +1 -1
  19. package/dist/{capture-K75SADNY.js → capture-M627KANC.js} +19 -19
  20. package/dist/{capture-4SIGWC4Q.js → capture-WG3M26CA.js} +6 -6
  21. package/dist/{captureCompositionFrame-XVEPPU4X.js → captureCompositionFrame-2MMKTYGJ.js} +16 -16
  22. package/dist/{captureProxy-4K3J652A.js → captureProxy-ZKHJ6HRI.js} +1 -1
  23. package/dist/{catalog-6N22YQEE.js → catalog-PNNNRYGW.js} +14 -14
  24. package/dist/{catch-up-67LVADSA.js → catch-up-LV2JRFEP.js} +9 -9
  25. package/dist/{check-NYD3WGR2.js → check-MNVZU53N.js} +46 -46
  26. package/dist/{checkAudio-APZTSEHX.js → checkAudio-ZI7CKTSP.js} +13 -13
  27. package/dist/{checkBrowser-2UA6O65I.js → checkBrowser-ZFRZGSZO.js} +39 -38
  28. package/dist/{chunk-3B4WQYCW.js → chunk-2EF7PBIL.js} +5 -5
  29. package/dist/{chunk-7BREEOLQ.js → chunk-2J5U5T4U.js} +14 -14
  30. package/dist/{chunk-TIGMUHSL.js → chunk-2LA5EFA7.js} +1 -1
  31. package/dist/{chunk-6PGDI5NG.js → chunk-2QY74XCK.js} +851 -631
  32. package/dist/{chunk-OB56G4VA.js → chunk-2TSEYJEW.js} +2 -2
  33. package/dist/{chunk-TUJB74AE.js → chunk-2ZRRIDLB.js} +2 -2
  34. package/dist/{chunk-PJQVJSMG.js → chunk-33JUCUTM.js} +7 -2
  35. package/dist/{chunk-TMB4L4GG.js → chunk-35JN6DUV.js} +2 -2
  36. package/dist/{chunk-6PYUPO4M.js → chunk-3DU5M4RZ.js} +2 -2
  37. package/dist/{chunk-AI5KNXSL.js → chunk-3PXYJAP2.js} +5 -5
  38. package/dist/{chunk-N6VNR4YE.js → chunk-42D2JWAH.js} +1 -1
  39. package/dist/{chunk-5UOYRGKV.js → chunk-44YM6GQW.js} +2 -2
  40. package/dist/{chunk-NSADX4IV.js → chunk-4M5C3543.js} +2 -2
  41. package/dist/{chunk-OI5WGQE3.js → chunk-52ZPRSRR.js} +5 -5
  42. package/dist/{chunk-H6LFXHAV.js → chunk-5JFK2MZE.js} +2 -2
  43. package/dist/{chunk-NMASYQXY.js → chunk-667DGYQF.js} +2 -2
  44. package/dist/{chunk-UCQTLZDJ.js → chunk-6KS7MRXE.js} +2 -2
  45. package/dist/{chunk-EIION6EA.js → chunk-6YQL5U3X.js} +7 -3
  46. package/dist/{chunk-XKIXRSVB.js → chunk-7HTUIFCU.js} +3 -3
  47. package/dist/{chunk-A6O65H7G.js → chunk-7KOPWRBA.js} +3 -3
  48. package/dist/{chunk-LNOG6KKM.js → chunk-7YFT3XBE.js} +6 -6
  49. package/dist/{chunk-LIXAC5NE.js → chunk-A6MOPSB7.js} +10 -10
  50. package/dist/{chunk-CUOX3TDY.js → chunk-ACLEARJ5.js} +1 -1
  51. package/dist/{chunk-XEIVSW2F.js → chunk-APV4EGPC.js} +6 -6
  52. package/dist/{chunk-745HLQBA.js → chunk-AYE5S3LS.js} +1 -1
  53. package/dist/{chunk-JGKI7FHX.js → chunk-BBEPJIL6.js} +11 -12
  54. package/dist/{chunk-DPMEWIVZ.js → chunk-BDEXAT2A.js} +4 -4
  55. package/dist/{chunk-IUUEMVZV.js → chunk-BFR4Z6XZ.js} +2 -2
  56. package/dist/{chunk-2Z7IW5EY.js → chunk-BIS25FPH.js} +2 -2
  57. package/dist/{chunk-6QITYZN7.js → chunk-BQ42ZSDC.js} +2 -2
  58. package/dist/{chunk-L7BY2FDJ.js → chunk-BX4EUXTT.js} +13 -13
  59. package/dist/{chunk-TZ3EPV4B.js → chunk-C4KEZBFB.js} +1 -1
  60. package/dist/{chunk-2FEZFXKE.js → chunk-CHEMP247.js} +1 -1
  61. package/dist/{chunk-AI4MXYGK.js → chunk-CJAUHCIH.js} +1 -1
  62. package/dist/{chunk-AWOHPIKF.js → chunk-CJGEN3HQ.js} +9 -9
  63. package/dist/{chunk-U6ZR7GBQ.js → chunk-CJGFAAQM.js} +11 -7
  64. package/dist/{chunk-S73AVUHJ.js → chunk-CUQRPA5X.js} +1 -1
  65. package/dist/{chunk-TU2WFCGS.js → chunk-D4V3A66O.js} +1 -1
  66. package/dist/{chunk-X3JZA7KH.js → chunk-DN2WT7UF.js} +76 -45
  67. package/dist/{chunk-6QZNF3JF.js → chunk-DXPKV74K.js} +53 -60
  68. package/dist/{chunk-ESYW3LJU.js → chunk-ERM6VZH5.js} +2 -2
  69. package/dist/{chunk-XMKDDEX4.js → chunk-F266JN4O.js} +6 -6
  70. package/dist/{chunk-LAXD6VM7.js → chunk-F3W2XNVF.js} +6 -6
  71. package/dist/{chunk-OMFIMZZD.js → chunk-FGBIIVLD.js} +1 -1
  72. package/dist/{chunk-GXKCFOMR.js → chunk-GDPNIGCY.js} +1 -1
  73. package/dist/{chunk-MH46RGG6.js → chunk-GIICVK4I.js} +1 -1
  74. package/dist/{chunk-TXTVVIW7.js → chunk-GJCRUFVA.js} +1 -1
  75. package/dist/{chunk-CTDCYNVK.js → chunk-GLPWQEIS.js} +2 -2
  76. package/dist/{chunk-KDQRJHLU.js → chunk-HFMRAULK.js} +3 -3
  77. package/dist/{chunk-RF3DT4CS.js → chunk-HJXFRTK3.js} +1 -1
  78. package/dist/{chunk-5GUYYSVT.js → chunk-HY67LTYS.js} +1 -1
  79. package/dist/{chunk-K2NOQNNY.js → chunk-ID6NFBRJ.js} +1 -1
  80. package/dist/{chunk-JHPOKDZI.js → chunk-IUMEFOOG.js} +12 -12
  81. package/dist/{chunk-JDJ6BM5E.js → chunk-IWOK7S6W.js} +2 -2
  82. package/dist/{chunk-FLJ4S7NA.js → chunk-J3FUIWZX.js} +2 -2
  83. package/dist/{chunk-WMJ3PV37.js → chunk-JJOEC2AX.js} +1 -1
  84. package/dist/{chunk-BSY6ZHP6.js → chunk-JK5EXU2V.js} +1 -1
  85. package/dist/{chunk-MG7UJJCP.js → chunk-JL2QIL62.js} +2 -2
  86. package/dist/{chunk-R5C2CV7J.js → chunk-JLITKVAK.js} +3 -3
  87. package/dist/{chunk-WWQWDRKU.js → chunk-K3JLION2.js} +1 -1
  88. package/dist/{chunk-3BKNPN36.js → chunk-KI4QH2XR.js} +2 -2
  89. package/dist/{chunk-MEZAMIT6.js → chunk-KNHIVCWP.js} +8 -8
  90. package/dist/{chunk-YB2ZJJFJ.js → chunk-LMUPRQ3G.js} +1 -1
  91. package/dist/{chunk-DZ3JB4F3.js → chunk-MG3X2IGB.js} +2 -2
  92. package/dist/{chunk-ULE2EYEY.js → chunk-MHPVT4IR.js} +2 -2
  93. package/dist/{chunk-37SEGJEO.js → chunk-MI3L5IN2.js} +4 -4
  94. package/dist/{chunk-ROODLZY7.js → chunk-MK2V4GOX.js} +8 -8
  95. package/dist/{chunk-QSQNXAHE.js → chunk-MNWXPKEP.js} +1 -1
  96. package/dist/chunk-MOIJOTXX.js +25 -0
  97. package/dist/{chunk-WY6354ZO.js → chunk-MPYCCFGC.js} +5 -5
  98. package/dist/{chunk-CEHYC2UD.js → chunk-N2IQL7QC.js} +3 -3
  99. package/dist/{chunk-NOCU3FBX.js → chunk-N2NX5H6U.js} +3 -3
  100. package/dist/{chunk-4ORH2OXS.js → chunk-NKRVZC5S.js} +1 -1
  101. package/dist/{chunk-XTKNMYRR.js → chunk-NXTKZZGR.js} +1 -1
  102. package/dist/{chunk-XSARHJSW.js → chunk-OWWIJYV3.js} +1 -1
  103. package/dist/{chunk-2UIAN6N7.js → chunk-P63PBGBD.js} +2 -2
  104. package/dist/{chunk-ZY55U6ER.js → chunk-PDCJFCXJ.js} +74 -24
  105. package/dist/{chunk-7LQFVACU.js → chunk-PTDAEAQY.js} +1 -1
  106. package/dist/{chunk-KXCAIQE4.js → chunk-PXUG4MJS.js} +4 -4
  107. package/dist/{chunk-66D5BC5K.js → chunk-Q6ECHIJY.js} +2 -2
  108. package/dist/{chunk-ZHIAAYY2.js → chunk-QA2QMK2I.js} +2 -2
  109. package/dist/{chunk-2OSPWUGX.js → chunk-QEKCHUUA.js} +2 -2
  110. package/dist/{chunk-SITGBEFO.js → chunk-QFO7O6CB.js} +26 -23
  111. package/dist/{chunk-Y57R6C5U.js → chunk-QK2QVBVK.js} +2 -1
  112. package/dist/{chunk-Y4QE4LEB.js → chunk-QQMYKUIG.js} +1 -1
  113. package/dist/{chunk-FBOKUG5B.js → chunk-RAOIICTD.js} +10 -10
  114. package/dist/{chunk-SDIQEPAR.js → chunk-RWDZPTDG.js} +1 -1
  115. package/dist/{chunk-HMNDJPLQ.js → chunk-S6WLGGFS.js} +1 -1
  116. package/dist/{chunk-NK2UW3WR.js → chunk-SDOVSUQP.js} +1 -1
  117. package/dist/{chunk-KFWSPEDG.js → chunk-SEZ6YFNG.js} +1 -1
  118. package/dist/{chunk-ERYGKPIR.js → chunk-SMLMTEV6.js} +1 -1
  119. package/dist/{chunk-YMSOS6CF.js → chunk-TDLDZZNW.js} +1 -1
  120. package/dist/{chunk-FCNBAYZ6.js → chunk-TIAWLVUB.js} +3 -3
  121. package/dist/{chunk-74M47HVE.js → chunk-TQU327UC.js} +1 -1
  122. package/dist/{chunk-3WE4UZHN.js → chunk-TYBLBWNS.js} +1 -1
  123. package/dist/{chunk-M4ABCFJO.js → chunk-U42FMHXX.js} +3 -3
  124. package/dist/{chunk-W672RTMC.js → chunk-UECOOH6G.js} +4 -4
  125. package/dist/{chunk-EPBYIJPM.js → chunk-UV6U7GP5.js} +1 -1
  126. package/dist/{chunk-ZQPXWUCP.js → chunk-UZLN7NLA.js} +4 -4
  127. package/dist/{chunk-Y6A5LED6.js → chunk-V3KCLOPE.js} +5 -2
  128. package/dist/{chunk-FAJRDYFU.js → chunk-V7A3632C.js} +3 -3
  129. package/dist/{chunk-TQYHQKOK.js → chunk-VB3MY67J.js} +1 -1
  130. package/dist/{chunk-ZS2ROUIG.js → chunk-VBNZJYTW.js} +1 -1
  131. package/dist/{chunk-U3WUAVAX.js → chunk-VWSXDENA.js} +4 -4
  132. package/dist/{chunk-XNJEXXKC.js → chunk-W3H5NVS7.js} +2 -2
  133. package/dist/{chunk-LBFV45YF.js → chunk-WUNTVKJ5.js} +1 -1
  134. package/dist/{chunk-PXMEW6TM.js → chunk-WVAA6ZNR.js} +3 -3
  135. package/dist/{chunk-IXGZSANV.js → chunk-X5DKQC4C.js} +1 -1
  136. package/dist/{chunk-MKZ73C57.js → chunk-XBKJYNHG.js} +2 -2
  137. package/dist/{chunk-3ODOQWSB.js → chunk-XERF7LKH.js} +2 -2
  138. package/dist/chunk-XO4BTSA5.js +38 -0
  139. package/dist/{chunk-D5YHSTHZ.js → chunk-XTYAKH7L.js} +4 -4
  140. package/dist/chunk-Y2D2KZC2.js +5146 -0
  141. package/dist/{chunk-VM2VBJRC.js → chunk-Z67ELZGQ.js} +16 -0
  142. package/dist/{chunk-RHZE7BIX.js → chunk-ZBICCHYQ.js} +2 -2
  143. package/dist/{chunk-7CKKKBNM.js → chunk-ZDM7GFKC.js} +2 -2
  144. package/dist/{chunk-AAZF6D3Z.js → chunk-ZDPZZNLV.js} +2 -2
  145. package/dist/{chunk-7EOREMZI.js → chunk-ZZMOJL4C.js} +13 -13
  146. package/dist/{clean-73IDEWIJ.js → clean-TGMFBGYJ.js} +25 -24
  147. package/dist/cli.js +68 -68
  148. package/dist/{cloud-SOZPWTDL.js → cloud-7RGF4WQT.js} +7 -7
  149. package/dist/{cloud-P32MAEIJ.js → cloud-TMGC6QCF.js} +4 -4
  150. package/dist/{cloudrun-H5TW5T4R.js → cloudrun-S6OJKIV4.js} +7 -7
  151. package/dist/{compare-BQSDHPZ3.js → compare-UY4WUT4M.js} +41 -43
  152. package/dist/{compiler-WNVDGRBH.js → compiler-B5OKYH72.js} +4 -4
  153. package/dist/{component-WWICYJFN.js → component-UNC53NZD.js} +5 -5
  154. package/dist/{compositions-VEMHHQR6.js → compositions-IHZGRDPY.js} +15 -15
  155. package/dist/{curve-5SCSMYX4.js → curve-PY3IWSSS.js} +14 -14
  156. package/dist/{cuts-POUL3RQ5.js → cuts-QDZJTR4C.js} +15 -15
  157. package/dist/{delete-NVS5PXRM.js → delete-NWSVGHB6.js} +11 -11
  158. package/dist/{deploy-SPJ5OWAI.js → deploy-46ZFBV7W.js} +6 -6
  159. package/dist/{describeProject-KJGRR7FM.js → describeProject-FUNFO4CI.js} +10 -10
  160. package/dist/{destroy-CPLVCITS.js → destroy-MGSLIVVF.js} +6 -6
  161. package/dist/{diff-O2JUFV2N.js → diff-KV5MIGRD.js} +37 -37
  162. package/dist/{dist-DCRKIIL4.js → dist-CZNBPI6A.js} +11 -10
  163. package/dist/{dist-XRESUN6B.js → dist-XBACRUL3.js} +2 -2
  164. package/dist/{dist-TTOW2KVO.js → dist-ZJCX2EDP.js} +2 -2
  165. package/dist/{doctor-L5GGDS2F.js → doctor-Y2HSNKRA.js} +18 -18
  166. package/dist/{dotEnv-7P4XI4ID.js → dotEnv-3XMUX3U6.js} +3 -3
  167. package/dist/{energy-43JTPLLL.js → energy-7OXUOWH5.js} +15 -15
  168. package/dist/{events-XRO5CFTD.js → events-2NABTDY4.js} +5 -5
  169. package/dist/{events-K576EL47.js → events-C6EY6OJ5.js} +8 -8
  170. package/dist/{events-33NDGOZM.js → events-EFOWGVWG.js} +17 -17
  171. package/dist/{execute-EWZ3WK3L.js → execute-3ZQSB2IX.js} +29 -28
  172. package/dist/{extract-NW375CQM.js → extract-V36OHCDI.js} +15 -15
  173. package/dist/{face-IVXIPAO5.js → face-27NDWNOT.js} +11 -11
  174. package/dist/{face-AVVUVV5L.js → face-UJ22O2MN.js} +15 -15
  175. package/dist/{feedback-MS34KB74.js → feedback-K6BSCEV7.js} +17 -17
  176. package/dist/{ffmpeg-I376KCKD.js → ffmpeg-YNZQRQCJ.js} +9 -9
  177. package/dist/{figma-M37MXYPR.js → figma-LIWR7AJJ.js} +3 -3
  178. package/dist/fontLocalizeCli.js +14 -13
  179. package/dist/{frames-6VGAHZBO.js → frames-4CSSTFJP.js} +16 -16
  180. package/dist/{generate-TM7AOJ27.js → generate-4Q37PFXG.js} +29 -29
  181. package/dist/{get-2JAJO7AP.js → get-AV65OF23.js} +11 -11
  182. package/dist/{gpuPolicy-DEH3KKNF.js → gpuPolicy-Y6OVUHUV.js} +9 -9
  183. package/dist/{grade-compare-UN6MPWVF.js → grade-compare-MBA4VG7M.js} +36 -35
  184. package/dist/{hands-ANSG7WHU.js → hands-2I2HWDTL.js} +17 -17
  185. package/dist/hangReport.js +2 -2
  186. package/dist/{heifImagePrep-YC3ZMWUC.js → heifImagePrep-JC3TQ4IG.js} +10 -10
  187. package/dist/{help-63QQYCMJ.js → help-JOQIPFII.js} +1 -1
  188. package/dist/{history-DRSL755Q.js → history-TLE2CGTY.js} +13 -13
  189. package/dist/hyperframe.manifest.json +1 -1
  190. package/dist/hyperframe.runtime.iife.js +64 -64
  191. package/dist/hyperframes-player.global.js +1 -1
  192. package/dist/{info-UNIWLP7I.js → info-3HMZZAAV.js} +17 -17
  193. package/dist/{init-3W3XSGXC.js → init-Y7FGDZUZ.js} +31 -31
  194. package/dist/{ink-OXJJIEQ7.js → ink-K4JHETG5.js} +15 -15
  195. package/dist/{inspect-UOXP5ICV.js → inspect-STYYLKV6.js} +40 -39
  196. package/dist/{installer-OWZSFVV2.js → installer-SRPSC2X7.js} +4 -4
  197. package/dist/{keyframes-LNCXSQJ6.js → keyframes-S6RFXNAA.js} +15 -15
  198. package/dist/{lambda-3ZIM5NW2.js → lambda-YDA3ROVC.js} +15 -15
  199. package/dist/{launch-HOSRCHWS.js → launch-5UBQEKDH.js} +10 -10
  200. package/dist/{layout-MRBHBZEA.js → layout-LVDEEUDY.js} +40 -39
  201. package/dist/{lint-U4PINYKO.js → lint-4OELSC7I.js} +13 -13
  202. package/dist/{lintProject-55U44GOP.js → lintProject-FPQL3VUS.js} +2 -2
  203. package/dist/{list-AMH6UUTI.js → list-5TBQYNHD.js} +11 -11
  204. package/dist/{localPage-JJ56YNKB.js → localPage-NEVG3XFX.js} +9 -9
  205. package/dist/{login-U42SSWF4.js → login-IWDL4RDU.js} +14 -12
  206. package/dist/{logout-DQVPSI4E.js → logout-ZTTDB46G.js} +6 -6
  207. package/dist/{look-6VTGMGIF.js → look-J5XK73IV.js} +15 -15
  208. package/dist/{manager-PXRZQDDT.js → manager-AA3ZNHAP.js} +4 -4
  209. package/dist/{manager-GHP2QIUD.js → manager-SNMVD5EK.js} +10 -10
  210. package/dist/{measure-NC4LN7EZ.js → measure-COGDPBLB.js} +12 -12
  211. package/dist/{media-VKM5WFRK.js → media-PYSX3S7F.js} +10 -10
  212. package/dist/{media-treatment-VNZS2MIT.js → media-treatment-HR3X5LCP.js} +17 -17
  213. package/dist/{media-use-JOQWGBS5.js → media-use-RHUAYJ66.js} +10 -10
  214. package/dist/{models-S55TNWF7.js → models-Z6RV3WVR.js} +14 -14
  215. package/dist/{motionShot-OUOXFKUG.js → motionShot-DFOO4EQ3.js} +20 -20
  216. package/dist/{normalize-audio-GYTTK5QE.js → normalize-audio-DV3OPHTW.js} +11 -11
  217. package/dist/{oauth-RETRT7QD.js → oauth-EZ2ZQ4XR.js} +16 -1
  218. package/dist/{open-KGXPI4BY.js → open-UOR7EZ5U.js} +16 -16
  219. package/dist/{parakeetRunner-IXUUFPGG.js → parakeetRunner-DTHAZ5YS.js} +16 -16
  220. package/dist/{pipeline-UE2Y2ZRB.js → pipeline-IO437FLW.js} +12 -12
  221. package/dist/{plan-AD4FZA6N.js → plan-NJNZYLV3.js} +21 -21
  222. package/dist/{play-G6JYDYIH.js → play-S6G25SBX.js} +55 -47
  223. package/dist/{preflight-QNDXHMOT.js → preflight-WQQIKPKE.js} +12 -12
  224. package/dist/{present-OK7QMCLR.js → present-KTL4QWTR.js} +25 -20
  225. package/dist/{preview-XD7J2KHY.js → preview-T6HZZTTI.js} +23 -23
  226. package/dist/{privateProjectFile-2WJ6GPY6.js → privateProjectFile-EPXXPIEV.js} +2 -2
  227. package/dist/{probe-34RS6LVV.js → probe-QVXQWQGR.js} +15 -15
  228. package/dist/{producer-AX7EDIPJ.js → producer-7YJ4HGWN.js} +1 -1
  229. package/dist/{projectConfig-YBFY4W5A.js → projectConfig-ORBFL2ON.js} +6 -6
  230. package/dist/{publicNetwork-66HWFKYG.js → publicNetwork-RUALPHQQ.js} +1 -1
  231. package/dist/{publication-JPKV2ZQO.js → publication-CFIXSMO5.js} +2 -2
  232. package/dist/{publish-LRUVQX2E.js → publish-OLO5DOLH.js} +25 -24
  233. package/dist/{receivedRecordFollow-6MPKPG36.js → receivedRecordFollow-K2WHSMQL.js} +5 -5
  234. package/dist/{refresh-HFE7YV57.js → refresh-FYXJG2PX.js} +6 -6
  235. package/dist/{remove-background-TS4QUALS.js → remove-background-CGJDVLEN.js} +13 -13
  236. package/dist/{render-UQICTWO6.js → render-JF4YUCUQ.js} +43 -41
  237. package/dist/{render-PSUJ4UCJ.js → render-ODVFUS2P.js} +72 -60
  238. package/dist/{render-NYFK74KL.js → render-U7GWG4G2.js} +5 -5
  239. package/dist/{render-batch-57ZDTS7Z.js → render-batch-GFCU3E6Q.js} +5 -5
  240. package/dist/renderSetupWorker.js +6 -6
  241. package/dist/{resolver-3HJC4XU3.js → resolver-7HNGNUD3.js} +4 -4
  242. package/dist/{reverse-CIMYQVFI.js → reverse-R4GX3IZN.js} +1 -1
  243. package/dist/{run-EFRNU53Z.js → run-JRDVPXZK.js} +10 -10
  244. package/dist/{sam-O7Y2CCK3.js → sam-PHMZPQBM.js} +4 -4
  245. package/dist/{screenshotCapture-K63UAXO7.js → screenshotCapture-332Y4ROA.js} +11 -11
  246. package/dist/{service-EEEGLRHX.js → service-FB4AF4RM.js} +17 -17
  247. package/dist/{share-WQVRXWH4.js → share-YSLQ7PGY.js} +24 -23
  248. package/dist/{sherpa-BOHH3Q32.js → sherpa-7RMA3KRP.js} +15 -15
  249. package/dist/sherpaWorker.js +3 -3
  250. package/dist/skills/hyperframes/references/plugin-installation.md +1 -1
  251. package/dist/skills/hyperframes/scripts/plugin-cli.mjs +4 -4
  252. package/dist/{skills-KB7UH26E.js → skills-F5S4ISKO.js} +13 -13
  253. package/dist/{skillsUpdateCheck-ZDA5FPJB.js → skillsUpdateCheck-MAMDFQR5.js} +5 -5
  254. package/dist/{snapshot-HRR6LIPD.js → snapshot-3GN5M7A4.js} +45 -45
  255. package/dist/{snapshotHeldVideos-QGJBXBJM.js → snapshotHeldVideos-NNAZHPYK.js} +10 -10
  256. package/dist/{src-QOVNNDZN.js → src-SHRAI2Y4.js} +12 -11
  257. package/dist/{src-FCITTGFH.js → src-WKQLHMUG.js} +13 -9
  258. package/dist/{start-I7H5I3AS.js → start-XXU5LDBV.js} +27 -27
  259. package/dist/{staticProjectServer-XEZD7JZE.js → staticProjectServer-RBNNFU6T.js} +21 -20
  260. package/dist/{status-2GKACMVC.js → status-CTL4EWQC.js} +20 -20
  261. package/dist/studio/assets/{hyperframes-player-VGx6ow_e.js → hyperframes-player-Dl0dFOXO.js} +1 -1
  262. package/dist/studio/assets/{index-B8Xt_Oyw.js → index-DPzReVPd.js} +179 -179
  263. package/dist/studio/assets/{index-BH18TdX9.js → index-DbMtST5n.js} +1 -1
  264. package/dist/studio/assets/{pausedVideoDecoder-Bx3fGNkU.js → pausedVideoDecoder-CCAL8jtm.js} +1 -1
  265. package/dist/studio/index.html +1 -1
  266. package/dist/{studio-api-KQ7DR667.js → studio-api-2AOIQOEV.js} +11 -10
  267. package/dist/{studioServer-KAU2XZ4F.js → studioServer-R6ADUV52.js} +69 -69
  268. package/dist/subCompositionWorker.js +13 -18
  269. package/dist/{sync-3OJZRVPG.js → sync-C4DLMXLD.js} +15 -15
  270. package/dist/{synthesize-JECKYUGO.js → synthesize-W7KYX6CI.js} +2 -2
  271. package/dist/{system-PKL4Y4MX.js → system-V6IZXVU4.js} +3 -3
  272. package/dist/{telemetry-HIZZLE6W.js → telemetry-PCNSNJZE.js} +8 -8
  273. package/dist/{templates-35GCXKO2.js → templates-LPGMBERL.js} +17 -17
  274. package/dist/{textOverFace-Q4I3PREP.js → textOverFace-WYPZHM6O.js} +3 -3
  275. package/dist/{timeline-U2V63I7B.js → timeline-KTEBNLHM.js} +23 -22
  276. package/dist/{tokens-24TKAZCA.js → tokens-WP5ZRTJ3.js} +4 -4
  277. package/dist/{transcribe-M3JJZ27F.js → transcribe-463K32RT.js} +13 -13
  278. package/dist/{transcribe-YHGN4HEM.js → transcribe-L65PBQ4S.js} +32 -32
  279. package/dist/{tts-CDBXQSAQ.js → tts-DDVJVSD4.js} +3 -3
  280. package/dist/{update-4DIZ3YQQ.js → update-6HCOMJ7L.js} +14 -14
  281. package/dist/{updateCheck-F56HX6MZ.js → updateCheck-RFRITDJM.js} +4 -4
  282. package/dist/{upgrade-6WAFZ7WN.js → upgrade-BOQF5LPW.js} +5 -5
  283. package/dist/{urlDownloader-DNNB6UOI.js → urlDownloader-MNYASBMV.js} +8 -8
  284. package/dist/{validate-N5KPU4GC.js → validate-RZNELWBT.js} +30 -29
  285. package/dist/{video-T6YYFBNI.js → video-FEMS6YLC.js} +10 -10
  286. package/dist/{voices-OI37IYYG.js → voices-LADMSNKC.js} +27 -27
  287. package/dist/warmCheck.js +46 -46
  288. package/dist/warmCheckClient.js +2 -2
  289. package/package.json +1 -1
  290. package/dist/chunk-RAHYMZNU.js +0 -5146
@@ -16,7 +16,7 @@ import {
16
16
  Semaphore,
17
17
  prepareHeifImageInputs,
18
18
  withMediaProbeSlot
19
- } from "./chunk-RHZE7BIX.js";
19
+ } from "./chunk-ZBICCHYQ.js";
20
20
  import {
21
21
  EncoderInterruptedError,
22
22
  encoderFailureError,
@@ -30,7 +30,7 @@ import {
30
30
  refusesOutsideLink,
31
31
  resolveRenderPaths,
32
32
  toExternalAssetKey
33
- } from "./chunk-H6LFXHAV.js";
33
+ } from "./chunk-5JFK2MZE.js";
34
34
  import {
35
35
  linksOutside
36
36
  } from "./chunk-6ACARSAZ.js";
@@ -39,6 +39,9 @@ import {
39
39
  openRangeEnd,
40
40
  parseEncoderOptions
41
41
  } from "./chunk-LD6JONPV.js";
42
+ import {
43
+ previewToken
44
+ } from "./chunk-HLVNKNSW.js";
42
45
  import {
43
46
  BROWSER_GPU_NOT_SOFTWARE,
44
47
  CaptureFailure,
@@ -93,6 +96,7 @@ import {
93
96
  computeWorkerSizing,
94
97
  concatVideoFiles,
95
98
  createCaptureSession,
99
+ createConcurrencyLimit,
96
100
  createFrameLookupTable,
97
101
  createFrameReorderBuffer,
98
102
  createReferenceBackgroundRecorder,
@@ -211,10 +215,10 @@ import {
211
215
  withPublicOnlyProxy,
212
216
  writeCapturedFrame,
213
217
  writeUrlDownloadTelemetry
214
- } from "./chunk-ZY55U6ER.js";
218
+ } from "./chunk-PDCJFCXJ.js";
215
219
  import {
216
220
  settleOnBrowserSafePort
217
- } from "./chunk-PJQVJSMG.js";
221
+ } from "./chunk-33JUCUTM.js";
218
222
  import {
219
223
  TRANSITIONS,
220
224
  convertTransfer,
@@ -236,7 +240,7 @@ import {
236
240
  parsesAsScript,
237
241
  prepareFlattenedInnerRoot,
238
242
  stripSdrPngColourTags
239
- } from "./chunk-JGKI7FHX.js";
243
+ } from "./chunk-BBEPJIL6.js";
240
244
  import {
241
245
  RENDER_TEMP_DIR
242
246
  } from "./chunk-F6PI5O3H.js";
@@ -264,7 +268,7 @@ import {
264
268
  redactTelemetryString,
265
269
  resolveAuthoredTimingWindow,
266
270
  toFps
267
- } from "./chunk-XSARHJSW.js";
271
+ } from "./chunk-OWWIJYV3.js";
268
272
  import {
269
273
  CAPTURE_CANVAS_SELECTOR,
270
274
  COMPOSITION_SOURCE_URL,
@@ -301,7 +305,7 @@ import {
301
305
  sourceTimeAt,
302
306
  styleElementsFor,
303
307
  timeAtSourceTime
304
- } from "./chunk-RAHYMZNU.js";
308
+ } from "./chunk-Y2D2KZC2.js";
305
309
  import {
306
310
  isSafePath,
307
311
  terminalText
@@ -311,7 +315,7 @@ import {
311
315
  } from "./chunk-LWX5PI73.js";
312
316
  import {
313
317
  resolveReferencedStart
314
- } from "./chunk-GXKCFOMR.js";
318
+ } from "./chunk-GDPNIGCY.js";
315
319
  import {
316
320
  isUnresolvedAssetPlaceholder,
317
321
  namesAnotherNetworkRoot,
@@ -327,7 +331,7 @@ import {
327
331
  getSystemTotalMb,
328
332
  hostCpuCount,
329
333
  usableCpuCount
330
- } from "./chunk-5GUYYSVT.js";
334
+ } from "./chunk-HY67LTYS.js";
331
335
  import {
332
336
  MEDIA_START_BASIS_ATTR,
333
337
  checkSubCompositionUsability,
@@ -373,19 +377,22 @@ import {
373
377
  isPrivateFileUnder,
374
378
  isStudioPrivatePath
375
379
  } from "./chunk-NTGTWXAO.js";
380
+ import {
381
+ concatListInputArgs
382
+ } from "./chunk-Z67ELZGQ.js";
376
383
 
377
384
  // ../producer/src/services/renderOrchestrator.ts
378
385
  import {
379
- existsSync as existsSync20,
386
+ existsSync as existsSync21,
380
387
  mkdirSync as mkdirSync10,
381
388
  readdirSync as readdirSync6,
382
389
  rmSync as rmSync10,
383
- statSync as statSync8,
390
+ statSync as statSync7,
384
391
  writeFileSync as writeFileSync6,
385
392
  copyFileSync as copyFileSync3,
386
393
  appendFileSync
387
394
  } from "fs";
388
- import { tmpdir as tmpdir2 } from "os";
395
+ import { tmpdir as tmpdir3 } from "os";
389
396
 
390
397
  // ../producer/src/services/htmlTagScans.ts
391
398
  function forwardFinder(text, pattern) {
@@ -679,7 +686,7 @@ function firstCompositionIdTag(html) {
679
686
  }
680
687
 
681
688
  // ../producer/src/services/renderOrchestrator.ts
682
- import { join as join29, dirname as dirname12, resolve as resolve6 } from "path";
689
+ import { join as join31, dirname as dirname12, resolve as resolve7 } from "path";
683
690
  import { totalmem as totalmem2 } from "os";
684
691
  import { randomUUID } from "crypto";
685
692
  import { fileURLToPath as fileURLToPath3 } from "url";
@@ -1497,13 +1504,13 @@ function createFileServer(options) {
1497
1504
  if (!streamOwnsFd) closeSync(fd);
1498
1505
  }
1499
1506
  });
1500
- return new Promise((resolve11, reject) => {
1507
+ return new Promise((resolve12, reject) => {
1501
1508
  const connections = /* @__PURE__ */ new Set();
1502
1509
  const server = serve({ fetch: app.fetch, port, hostname: "127.0.0.1" }, (info) => {
1503
1510
  const bound = port === 0 ? settleOnBrowserSafePort(server, "127.0.0.1") : Promise.resolve(info.port);
1504
1511
  bound.then((boundPort) => {
1505
1512
  listeningPort = boundPort;
1506
- resolve11({
1513
+ resolve12({
1507
1514
  url: `http://localhost:${boundPort}`,
1508
1515
  port: boundPort,
1509
1516
  addPreHeadScript: (script) => {
@@ -2054,10 +2061,117 @@ function buildRenderErrorDetails(input) {
2054
2061
  perfStages: Object.keys(input.perfStages).length > 0 ? { ...input.perfStages } : void 0,
2055
2062
  hdrDiagnostics: input.hdrDiagnostics.videoExtractionFailures > 0 || input.hdrDiagnostics.imageDecodeFailures > 0 ? { ...input.hdrDiagnostics } : void 0,
2056
2063
  observability: input.observability,
2057
- subTimelineWait: input.subTimelineWait
2064
+ subTimelineWait: input.subTimelineWait,
2065
+ missingPath: input.missingPath
2058
2066
  };
2059
2067
  }
2060
2068
 
2069
+ // ../producer/src/services/render/missingPath.ts
2070
+ import { existsSync as existsSync4, lstatSync, readlinkSync } from "fs";
2071
+ import { tmpdir } from "os";
2072
+ import { basename as basename2, join as join3, relative as relative2, resolve as resolve4, isAbsolute as isAbsolute2, sep as sep2 } from "path";
2073
+
2074
+ // ../core/dist/missingPath.js
2075
+ var quotedPath = (text) => /'([^']+)'/.exec(text)?.[1] ?? "";
2076
+ function errorChain(error) {
2077
+ const chain = [];
2078
+ for (let seen = error; seen instanceof Error && chain.length < 5; seen = seen.cause)
2079
+ chain.push(seen);
2080
+ return chain;
2081
+ }
2082
+ function missingPathOf(error) {
2083
+ const enoent = errorChain(error).find((seen) => seen.code === "ENOENT");
2084
+ if (enoent)
2085
+ return enoent.path ?? quotedPath(enoent.message);
2086
+ const message = error instanceof Error ? error.message : String(error);
2087
+ return /\bENOENT\b/.test(message) ? quotedPath(message) : void 0;
2088
+ }
2089
+ function errnoMissingPathOf(error) {
2090
+ const enoent = errorChain(error).find((seen) => seen.code === "ENOENT");
2091
+ return enoent?.path;
2092
+ }
2093
+
2094
+ // ../producer/src/services/render/missingPath.ts
2095
+ var SYNCED = /onedrive|dropbox|icloud|mobile documents|clouddocs|google ?drive|cloudstorage/i;
2096
+ var inside = (path, folder) => {
2097
+ const rel = relative2(resolve4(folder), resolve4(path));
2098
+ return rel === "" || !rel.startsWith("..") && !isAbsolute2(rel);
2099
+ };
2100
+ function lstatOrNull(path) {
2101
+ try {
2102
+ return lstatSync(path);
2103
+ } catch {
2104
+ return null;
2105
+ }
2106
+ }
2107
+ var ROOT_SCOPES = [
2108
+ ["tempRoot", "temp_root"],
2109
+ ["cacheDir", "cache_root"],
2110
+ ["workDir", "work_dir"]
2111
+ ];
2112
+ var NAME_SCOPES = [
2113
+ [/\.partial/, "cache_partial"],
2114
+ [/^hfcache-/, "cache_entry"],
2115
+ [/^hyperframes-extract-cache/, "cache_root"],
2116
+ [/^(hf-render-|work-[0-9a-f]{8}-)/, "work_dir"]
2117
+ ];
2118
+ function scopeOfGone(path, where, throughLink) {
2119
+ const root = ROOT_SCOPES.find(([key]) => {
2120
+ const dir = where[key];
2121
+ return !!dir && resolve4(path) === resolve4(dir);
2122
+ });
2123
+ if (root) return root[1];
2124
+ const name = basename2(path);
2125
+ return NAME_SCOPES.find(([pattern]) => pattern.test(name))?.[1] ?? (throughLink ? "link_target" : "other");
2126
+ }
2127
+ var MAX_LINK_HOPS = 4;
2128
+ function rootOf(path, where) {
2129
+ if (inside(path, where.tempRoot)) return "system_temp";
2130
+ if (where.cacheDir && inside(path, where.cacheDir)) return "cache_dir";
2131
+ return "other";
2132
+ }
2133
+ var ownerOf = (path, where) => [where.tempRoot, where.cacheDir, where.workDir].filter((root) => !!root && inside(path, root)).sort((a, b) => resolve4(a).length - resolve4(b).length)[0];
2134
+ var linkTarget = (link, folder) => resolve4(folder, readlinkSync(link).replace(/^\\\\\?\\/, ""));
2135
+ function goneAt(path, last, where, hops) {
2136
+ const scope = scopeOfGone(path, where, hops > 0);
2137
+ return last && scope === "other" ? "file" : scope;
2138
+ }
2139
+ function highestGone(path, where, hops = 0) {
2140
+ const root = ownerOf(path, where);
2141
+ if (!root || hops > MAX_LINK_HOPS) return "link_target";
2142
+ if (!existsSync4(root)) return scopeOfGone(root, where, hops > 0);
2143
+ const parts = relative2(resolve4(root), resolve4(path)).split(sep2).filter(Boolean);
2144
+ let at = resolve4(root);
2145
+ for (const [index, part] of parts.entries()) {
2146
+ const next = join3(at, part);
2147
+ const stat = lstatOrNull(next);
2148
+ if (!stat) return goneAt(next, index === parts.length - 1, where, hops);
2149
+ at = stat.isSymbolicLink() ? linkTarget(next, at) : next;
2150
+ const gone = at === next ? void 0 : highestGone(at, where, hops + 1);
2151
+ if (gone) return gone;
2152
+ }
2153
+ return void 0;
2154
+ }
2155
+ var isSpawnFailure = (error) => !!error?.syscall?.startsWith("spawn");
2156
+ function describeMissingPath(error, {
2157
+ cacheDir,
2158
+ workDir,
2159
+ tempRoot = tmpdir()
2160
+ } = {}) {
2161
+ try {
2162
+ const path = errnoMissingPathOf(error);
2163
+ if (!path || isSpawnFailure(error)) return void 0;
2164
+ const where = { tempRoot, cacheDir, workDir };
2165
+ return {
2166
+ scope: ownerOf(path, where) ? highestGone(path, where) ?? "other" : scopeOfGone(path, where, false),
2167
+ synced: SYNCED.test(path),
2168
+ root: rootOf(path, where)
2169
+ };
2170
+ } catch {
2171
+ return void 0;
2172
+ }
2173
+ }
2174
+
2061
2175
  // ../producer/src/services/render/renderEventPublisher.ts
2062
2176
  var FLUSH_TIMEOUT_MS = 1e4;
2063
2177
  function snapshotJob(job) {
@@ -2092,8 +2206,8 @@ var OrderedRenderEventPublisher = class {
2092
2206
  let timer;
2093
2207
  const drained = await Promise.race([
2094
2208
  this.tail.then(() => true),
2095
- new Promise((resolve11) => {
2096
- timer = setTimeout(() => resolve11(false), FLUSH_TIMEOUT_MS);
2209
+ new Promise((resolve12) => {
2210
+ timer = setTimeout(() => resolve12(false), FLUSH_TIMEOUT_MS);
2097
2211
  })
2098
2212
  ]);
2099
2213
  clearTimeout(timer);
@@ -2176,21 +2290,21 @@ var RenderExecutionContext = class {
2176
2290
  };
2177
2291
 
2178
2292
  // ../producer/src/services/render/artifactTransaction.ts
2179
- import { closeSync as closeSync2, existsSync as existsSync5, fstatSync as fstatSync2, openSync as openSync2, readSync, readdirSync as readdirSync2, rmSync as rmSync3 } from "fs";
2180
- import { basename as basename3, dirname as dirname4, extname as extname2, join as join4, resolve as resolve4 } from "path";
2293
+ import { closeSync as closeSync2, existsSync as existsSync6, fstatSync as fstatSync2, openSync as openSync2, readSync, readdirSync as readdirSync2, rmSync as rmSync3 } from "fs";
2294
+ import { basename as basename4, dirname as dirname4, extname as extname2, join as join5, resolve as resolve5 } from "path";
2181
2295
 
2182
2296
  // ../producer/src/services/render/renderDirOwner.ts
2183
2297
  import {
2184
- existsSync as existsSync4,
2185
- lstatSync,
2298
+ existsSync as existsSync5,
2299
+ lstatSync as lstatSync2,
2186
2300
  readFileSync as readFileSync2,
2187
2301
  readdirSync,
2188
- readlinkSync,
2302
+ readlinkSync as readlinkSync2,
2189
2303
  rmSync as rmSync2,
2190
2304
  writeFileSync as writeFileSync2
2191
2305
  } from "fs";
2192
2306
  import { hostname, uptime } from "os";
2193
- import { basename as basename2, dirname as dirname3, join as join3 } from "path";
2307
+ import { basename as basename3, dirname as dirname3, join as join4 } from "path";
2194
2308
  var OWNER_FILE = "owner.json";
2195
2309
  var TRANSACTION_BACKUP = "backup";
2196
2310
  var RENDER_JOB_DIR = /^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/;
@@ -2206,13 +2320,13 @@ function pidScope() {
2206
2320
  host: hostname(),
2207
2321
  // Without /proc (macOS, Windows) the boot time, to the minute, stands in for the boot id.
2208
2322
  boot: attempt(() => readFileSync2("/proc/sys/kernel/random/boot_id", "utf-8").trim()) ?? attempt(() => String(Math.round(Date.now() / 6e4 - uptime() / 60))),
2209
- pidns: attempt(() => readlinkSync("/proc/self/ns/pid"))
2323
+ pidns: attempt(() => readlinkSync2("/proc/self/ns/pid"))
2210
2324
  };
2211
2325
  }
2212
2326
  function createOwnedRenderDir(prefix) {
2213
- const dir = createStagingDir(dirname3(prefix), basename2(prefix));
2327
+ const dir = createStagingDir(dirname3(prefix), basename3(prefix));
2214
2328
  const owner = { pid: process.pid, ...pidScope() };
2215
- writeFileSync2(join3(dir, OWNER_FILE), JSON.stringify(owner));
2329
+ writeFileSync2(join4(dir, OWNER_FILE), JSON.stringify(owner));
2216
2330
  return dir;
2217
2331
  }
2218
2332
  function alive(pid) {
@@ -2235,7 +2349,7 @@ function inThisPidScope(owner) {
2235
2349
  function ownerState(dir) {
2236
2350
  let owner;
2237
2351
  try {
2238
- owner = JSON.parse(readFileSync2(join3(dir, OWNER_FILE), "utf-8"));
2352
+ owner = JSON.parse(readFileSync2(join4(dir, OWNER_FILE), "utf-8"));
2239
2353
  } catch (error) {
2240
2354
  return error.code === "ENOENT" ? "none" : "unknown";
2241
2355
  }
@@ -2246,16 +2360,16 @@ function ownerState(dir) {
2246
2360
  return alive(pid) ? "live" : "gone";
2247
2361
  }
2248
2362
  function newestWriteMs(path) {
2249
- const stat = lstatSync(path);
2363
+ const stat = lstatSync2(path);
2250
2364
  if (!stat.isDirectory()) return stat.mtimeMs;
2251
2365
  return readdirSync(path).reduce(
2252
- (newest, name) => Math.max(newest, newestWriteMs(join3(path, name))),
2366
+ (newest, name) => Math.max(newest, newestWriteMs(join4(path, name))),
2253
2367
  stat.mtimeMs
2254
2368
  );
2255
2369
  }
2256
2370
  function isAbandoned(dir, ownerlessIdleMs, now) {
2257
2371
  try {
2258
- if (!lstatSync(dir).isDirectory() || existsSync4(join3(dir, TRANSACTION_BACKUP))) return false;
2372
+ if (!lstatSync2(dir).isDirectory() || existsSync5(join4(dir, TRANSACTION_BACKUP))) return false;
2259
2373
  const owner = ownerState(dir);
2260
2374
  if (owner === "gone") return true;
2261
2375
  return owner === "none" && ownerlessIdleMs !== void 0 && now - newestWriteMs(dir) >= ownerlessIdleMs;
@@ -2271,7 +2385,7 @@ function listAbandonedRenderDirs(parent, options = {}) {
2271
2385
  return [];
2272
2386
  }
2273
2387
  const now = Date.now();
2274
- return names.filter((name) => (options.names ?? RENDER_TEMP_DIR).test(name)).map((name) => join3(parent, name)).filter((dir) => isAbandoned(dir, options.ownerlessIdleMs, now));
2388
+ return names.filter((name) => (options.names ?? RENDER_TEMP_DIR).test(name)).map((name) => join4(parent, name)).filter((dir) => isAbandoned(dir, options.ownerlessIdleMs, now));
2275
2389
  }
2276
2390
  function createRenderWorkDir(prefix, outputDir) {
2277
2391
  for (const parent of /* @__PURE__ */ new Set([outputDir, dirname3(prefix)])) {
@@ -2287,7 +2401,7 @@ function createRenderWorkDir(prefix, outputDir) {
2287
2401
 
2288
2402
  // ../producer/src/services/render/artifactTransaction.ts
2289
2403
  var defaultFileSystem = {
2290
- existsSync: existsSync5,
2404
+ existsSync: existsSync6,
2291
2405
  renameSync: (source, destination) => renameWithRetry(source, destination),
2292
2406
  rmSync: rmSync3
2293
2407
  };
@@ -2320,8 +2434,8 @@ function buildArtifactExpectation(input) {
2320
2434
  function createSiblingTransactionDirectory(destination) {
2321
2435
  const parent = dirname4(destination);
2322
2436
  const extension = extname2(destination);
2323
- const stem = extension ? basename3(destination, extension) : basename3(destination);
2324
- return createOwnedRenderDir(join4(parent, `.${stem}.hf-transaction-`));
2437
+ const stem = extension ? basename4(destination, extension) : basename4(destination);
2438
+ return createOwnedRenderDir(join5(parent, `.${stem}.hf-transaction-`));
2325
2439
  }
2326
2440
  function assertReadableNonEmptyFile(path) {
2327
2441
  const fd = openSync2(path, "r");
@@ -2339,7 +2453,7 @@ function collectDirectoryFiles(root) {
2339
2453
  const files = [];
2340
2454
  const visit = (directory) => {
2341
2455
  for (const entry of readdirSync2(directory, { withFileTypes: true })) {
2342
- const path = join4(directory, entry.name);
2456
+ const path = join5(directory, entry.name);
2343
2457
  if (entry.isDirectory()) visit(path);
2344
2458
  else if (entry.isFile()) files.push(path);
2345
2459
  }
@@ -2394,10 +2508,10 @@ var ArtifactTransaction = class {
2394
2508
  this.kind = kind;
2395
2509
  this.fileSystem = fileSystem;
2396
2510
  this.logger = logger;
2397
- this.destinationPath = resolve4(destinationPath);
2511
+ this.destinationPath = resolve5(destinationPath);
2398
2512
  this.transactionDirectory = createSiblingTransactionDirectory(this.destinationPath);
2399
- this.stagingPath = join4(this.transactionDirectory, basename3(this.destinationPath));
2400
- this.backupPath = join4(this.transactionDirectory, TRANSACTION_BACKUP);
2513
+ this.stagingPath = join5(this.transactionDirectory, basename4(this.destinationPath));
2514
+ this.backupPath = join5(this.transactionDirectory, TRANSACTION_BACKUP);
2401
2515
  this.durationProbe = durationProbe;
2402
2516
  }
2403
2517
  kind;
@@ -2440,19 +2554,19 @@ var ArtifactTransaction = class {
2440
2554
  */
2441
2555
  async assertDirectoryExpectation(expected, files) {
2442
2556
  for (const required of expected.requiredFiles ?? []) {
2443
- const path = join4(this.stagingPath, required);
2444
- if (!existsSync5(path)) {
2557
+ const path = join5(this.stagingPath, required);
2558
+ if (!existsSync6(path)) {
2445
2559
  throw new Error(`Render artifact directory is missing ${required}: ${this.stagingPath}`);
2446
2560
  }
2447
2561
  assertReadableNonEmptyFile(path);
2448
2562
  }
2449
2563
  if (expected.probeTarget !== void 0) {
2450
- await this.assertArtifactDuration(expected, join4(this.stagingPath, expected.probeTarget));
2564
+ await this.assertArtifactDuration(expected, join5(this.stagingPath, expected.probeTarget));
2451
2565
  return;
2452
2566
  }
2453
2567
  if (expected.expectedFrames === void 0) return;
2454
2568
  const frameCount = files.filter(
2455
- (file) => dirname4(file) === this.stagingPath && /^frame_\d+\.png$/.test(basename3(file))
2569
+ (file) => dirname4(file) === this.stagingPath && /^frame_\d+\.png$/.test(basename4(file))
2456
2570
  ).length;
2457
2571
  if (frameCount === 0) {
2458
2572
  throw new Error(
@@ -2690,8 +2804,8 @@ function replanAfterFailure(plan2, failure) {
2690
2804
  }
2691
2805
 
2692
2806
  // ../producer/src/services/render/stages/captureSegmentedStage.ts
2693
- import { existsSync as existsSync6, mkdirSync as mkdirSync3, rmSync as rmSync6, statSync as statSync3 } from "fs";
2694
- import { join as join8 } from "path";
2807
+ import { existsSync as existsSync8, mkdirSync as mkdirSync4, rmSync as rmSync6, statSync as statSync3 } from "fs";
2808
+ import { join as join11 } from "path";
2695
2809
 
2696
2810
  // ../producer/src/services/render/perfSummary.ts
2697
2811
  import { arch, platform, totalmem } from "os";
@@ -3084,7 +3198,7 @@ function getCaptureStageBrowserConsole(error) {
3084
3198
 
3085
3199
  // ../producer/src/services/hdrCompositor.ts
3086
3200
  import { readSync as readSync2 } from "fs";
3087
- import { join as join5 } from "path";
3201
+ import { join as join6 } from "path";
3088
3202
  function countNonZeroAlpha(rgba) {
3089
3203
  let n = 0;
3090
3204
  for (let p = 3; p < rgba.length; p += 4) {
@@ -3511,7 +3625,7 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
3511
3625
  if (shouldLog && debugDumpDir) {
3512
3626
  const after = countNonZeroRgb48(canvas);
3513
3627
  const dumpName = `frame_${String(debugFrameIndex).padStart(4, "0")}_layer_${String(layerIdx).padStart(2, "0")}_dom.png`;
3514
- const dumpPath = join5(debugDumpDir, dumpName);
3628
+ const dumpPath = join6(debugDumpDir, dumpName);
3515
3629
  writeFileExclusiveSync(dumpPath, domPng);
3516
3630
  log.info("[diag] dom layer blit", {
3517
3631
  frame: debugFrameIndex,
@@ -3550,7 +3664,7 @@ import { mkdirSync as mkdirSync2, readFileSync as readFileSync3, rmSync as rmSyn
3550
3664
 
3551
3665
  // ../producer/src/services/hdrFrameWindows.ts
3552
3666
  import { closeSync as closeSync3, constants as constants2, openSync as openSync3, rmSync as rmSync4 } from "fs";
3553
- import { join as join6 } from "path";
3667
+ import { join as join7 } from "path";
3554
3668
  function createHdrFrameWindows(opts) {
3555
3669
  const { dir, frameSize, windowFrames, maxResident, extract } = opts;
3556
3670
  let totalFrames = opts.totalFrames;
@@ -3574,7 +3688,7 @@ function createHdrFrameWindows(opts) {
3574
3688
  const firstFrame = index * windowFrames;
3575
3689
  const w = {
3576
3690
  firstFrame,
3577
- path: join6(dir, `window-${index}.rgb48le`),
3691
+ path: join7(dir, `window-${index}.rgb48le`),
3578
3692
  frames: 0,
3579
3693
  fd: -1,
3580
3694
  pins: 0,
@@ -4320,6 +4434,7 @@ function cleanupEndedHdrVideos(args) {
4320
4434
  }
4321
4435
 
4322
4436
  // ../producer/src/services/render/segmentPlan.ts
4437
+ import { join as join8 } from "path";
4323
4438
  var DEFAULT_SEGMENT_FRAMES = 3e3;
4324
4439
  var MIN_SEGMENT_FRAMES = 30;
4325
4440
  function assertPositiveInteger(name, value) {
@@ -4340,6 +4455,9 @@ function planSegments(totalFrames, segmentFrames) {
4340
4455
  }
4341
4456
  return slices;
4342
4457
  }
4458
+ function segmentOutputPath(segmentDir, index) {
4459
+ return join8(segmentDir, `segment_${String(index).padStart(5, "0")}.mp4`);
4460
+ }
4343
4461
  function resolveSegmentFrames(env) {
4344
4462
  const raw = env.HF_SEGMENT_FRAMES;
4345
4463
  if (raw === void 0 || raw.trim() === "") return DEFAULT_SEGMENT_FRAMES;
@@ -4357,6 +4475,142 @@ function createSegmentQueue(slices) {
4357
4475
  };
4358
4476
  }
4359
4477
 
4478
+ // ../producer/src/services/render/segmentManifest.ts
4479
+ import { createHash as createHash2, createHmac, timingSafeEqual } from "crypto";
4480
+ import {
4481
+ createReadStream as createReadStream2,
4482
+ existsSync as existsSync7,
4483
+ lstatSync as lstatSync3,
4484
+ mkdirSync as mkdirSync3,
4485
+ readFileSync as readFileSync4,
4486
+ writeFileSync as writeFileSync3
4487
+ } from "fs";
4488
+ import { join as join9 } from "path";
4489
+ var MANIFEST_FILENAME = "segments.json";
4490
+ function computeSegmentPlanHash(input) {
4491
+ const ordered = [
4492
+ input.compositionHash,
4493
+ input.cliVersion,
4494
+ String(input.totalFrames),
4495
+ String(input.segmentFrames),
4496
+ `${input.fps.num}/${input.fps.den}`,
4497
+ `${input.width}x${input.height}`,
4498
+ input.codec,
4499
+ input.preset,
4500
+ input.quality === void 0 ? "" : String(input.quality),
4501
+ input.bitrate ?? "",
4502
+ input.pixelFormat ?? "",
4503
+ input.imageFormat,
4504
+ input.useGpu ? "gpu" : "cpu",
4505
+ `${input.outputWidth}x${input.outputHeight}`,
4506
+ input.motionBlur,
4507
+ input.pageMotionBlur ?? "",
4508
+ input.captureQuality === void 0 ? "" : String(input.captureQuality)
4509
+ ];
4510
+ const delivery = [input.maxBitrate, input.bufferSize, input.gopSize].map((v) => v ?? "");
4511
+ if (delivery.some((v) => v !== "")) ordered.push(...delivery.map(String));
4512
+ return createHash2("sha256").update(ordered.join(" ")).digest("hex").slice(0, 16);
4513
+ }
4514
+ function segmentDirFor(projectRendersDir, planHash) {
4515
+ return join9(projectRendersDir, ".hf-segments", planHash);
4516
+ }
4517
+ function hasNumber(value, key) {
4518
+ return key in value && typeof Reflect.get(value, key) === "number";
4519
+ }
4520
+ function hasString(value, key) {
4521
+ return key in value && typeof Reflect.get(value, key) === "string";
4522
+ }
4523
+ function isEntry(value) {
4524
+ if (typeof value !== "object" || value === null) return false;
4525
+ return hasNumber(value, "index") && hasNumber(value, "startFrame") && hasNumber(value, "endFrame") && hasString(value, "path") && hasNumber(value, "bytes") && hasString(value, "sha256") && hasString(value, "completedAt");
4526
+ }
4527
+ function isManifest(value) {
4528
+ if (typeof value !== "object" || value === null) return false;
4529
+ const completed = Reflect.get(value, "completed");
4530
+ return Reflect.get(value, "version") === 1 && hasString(value, "planHash") && hasNumber(value, "totalFrames") && hasNumber(value, "segmentFrames") && Array.isArray(completed) && completed.every(isEntry);
4531
+ }
4532
+ function readSegmentManifest(segmentDir) {
4533
+ const path = join9(segmentDir, MANIFEST_FILENAME);
4534
+ if (!existsSync7(path)) return null;
4535
+ try {
4536
+ const parsed = JSON.parse(readFileSync4(path, "utf-8"));
4537
+ return isManifest(parsed) ? parsed : null;
4538
+ } catch {
4539
+ return null;
4540
+ }
4541
+ }
4542
+ function segmentManifestKey(token = previewToken()) {
4543
+ return token ? createHmac("sha256", token).update("segment-manifest").digest() : null;
4544
+ }
4545
+ function manifestMac(manifest, key) {
4546
+ const signed = [
4547
+ manifest.planHash,
4548
+ manifest.totalFrames,
4549
+ manifest.segmentFrames,
4550
+ manifest.completed.map((e) => [e.index, e.startFrame, e.endFrame, e.bytes, e.sha256])
4551
+ ];
4552
+ return createHmac("sha256", key).update(JSON.stringify(signed)).digest("hex");
4553
+ }
4554
+ function signSegmentManifest(manifest, key) {
4555
+ const { version, planHash, totalFrames, segmentFrames, completed } = manifest;
4556
+ const unsigned = { version, planHash, totalFrames, segmentFrames, completed };
4557
+ return key ? { ...unsigned, mac: manifestMac(unsigned, key) } : unsigned;
4558
+ }
4559
+ function hasValidMac(manifest, key) {
4560
+ if (!key || typeof manifest.mac !== "string") return false;
4561
+ const expected = Buffer.from(manifestMac(manifest, key), "hex");
4562
+ const actual = Buffer.from(manifest.mac, "hex");
4563
+ return actual.length === expected.length && timingSafeEqual(actual, expected);
4564
+ }
4565
+ async function hashSegmentFile(path) {
4566
+ const hash = createHash2("sha256");
4567
+ for await (const chunk of createReadStream2(path)) hash.update(chunk);
4568
+ return hash.digest("hex");
4569
+ }
4570
+ function writeSegmentManifest(segmentDir, manifest, key) {
4571
+ mkdirSync3(segmentDir, { recursive: true });
4572
+ const tmp = join9(segmentDir, `${MANIFEST_FILENAME}.${process.pid}.tmp`);
4573
+ writeFileSync3(tmp, JSON.stringify(signSegmentManifest(manifest, key), null, 2), "utf-8");
4574
+ renameWithRetry(tmp, join9(segmentDir, MANIFEST_FILENAME));
4575
+ }
4576
+ async function probeSegmentFrameCount(path, probe) {
4577
+ try {
4578
+ const meta = await probe(path);
4579
+ if (!Number.isFinite(meta.videoStreamDurationSeconds) || !Number.isFinite(meta.fps))
4580
+ return null;
4581
+ if (meta.fps <= 0) return null;
4582
+ return Math.round(meta.videoStreamDurationSeconds * meta.fps);
4583
+ } catch {
4584
+ return null;
4585
+ }
4586
+ }
4587
+ function plannedSlice(entry, plan2) {
4588
+ const slice = Number.isInteger(entry.index) ? plan2[entry.index] : void 0;
4589
+ if (!slice || slice.startFrame !== entry.startFrame || slice.endFrame !== entry.endFrame) {
4590
+ return void 0;
4591
+ }
4592
+ return slice;
4593
+ }
4594
+ function isPlainFileOfSize(path, bytes) {
4595
+ const stat = lstatSync3(path, { throwIfNoEntry: false });
4596
+ return stat !== void 0 && stat.isFile() && stat.size > 0 && stat.size === bytes;
4597
+ }
4598
+ async function validateCompletedSegments(manifest, check) {
4599
+ const ok = /* @__PURE__ */ new Set();
4600
+ if (manifest.planHash !== check.expectedHash || !hasValidMac(manifest, check.key)) return ok;
4601
+ for (const entry of manifest.completed) {
4602
+ const slice = plannedSlice(entry, check.plan);
4603
+ if (!slice) continue;
4604
+ const path = segmentOutputPath(check.segmentDir, slice.index);
4605
+ if (!isPlainFileOfSize(path, entry.bytes)) continue;
4606
+ if (await hashSegmentFile(path) !== entry.sha256) continue;
4607
+ const frames = await check.probeFrames(path);
4608
+ if (frames !== slice.endFrame - slice.startFrame) continue;
4609
+ ok.add(slice.index);
4610
+ }
4611
+ return ok;
4612
+ }
4613
+
4360
4614
  // ../producer/src/services/render/segmentRecycle.ts
4361
4615
  var DEFAULT_SEGMENT_BROWSER_RECYCLE = 3;
4362
4616
  function resolveSegmentBrowserRecycle(env) {
@@ -4373,8 +4627,8 @@ function isTargetLossError(error) {
4373
4627
 
4374
4628
  // ../producer/src/services/render/stages/captureStreamingStage.ts
4375
4629
  import { mkdtemp, writeFile } from "fs/promises";
4376
- import { tmpdir } from "os";
4377
- import { join as join7 } from "path";
4630
+ import { tmpdir as tmpdir2 } from "os";
4631
+ import { join as join10 } from "path";
4378
4632
 
4379
4633
  // ../producer/src/services/render/stallClock.ts
4380
4634
  var SUSPEND_GAP_MS = 15e3;
@@ -4448,7 +4702,7 @@ var SequentialCaptureStallError = class extends Error {
4448
4702
  }
4449
4703
  };
4450
4704
  function raceAgainstStall(promise, deadlineMs, input, signal) {
4451
- return new Promise((resolve11, reject) => {
4705
+ return new Promise((resolve12, reject) => {
4452
4706
  const clock = createStallClock();
4453
4707
  const trip = () => reject(
4454
4708
  signal?.aborted ? new Error(
@@ -4473,7 +4727,7 @@ function raceAgainstStall(promise, deadlineMs, input, signal) {
4473
4727
  promise.then(
4474
4728
  (value) => {
4475
4729
  clearTimeout(timer);
4476
- resolve11(value);
4730
+ resolve12(value);
4477
4731
  },
4478
4732
  (error) => {
4479
4733
  clearTimeout(timer);
@@ -4577,11 +4831,11 @@ async function verifyDrawElementSample(session, idx, buf, ctx) {
4577
4831
  return;
4578
4832
  }
4579
4833
  if (db < verifyMinDb) {
4580
- const dumpDir = await mkdtemp(join7(tmpdir(), "hf-de-verify-fail-")).catch(() => null);
4834
+ const dumpDir = await mkdtemp(join10(tmpdir2(), "hf-de-verify-fail-")).catch(() => null);
4581
4835
  if (dumpDir) {
4582
4836
  await Promise.all([
4583
- writeFile(join7(dumpDir, `frame-${idx}-de.jpg`), buf),
4584
- writeFile(join7(dumpDir, `frame-${idx}-truth.jpg`), truth)
4837
+ writeFile(join10(dumpDir, `frame-${idx}-de.jpg`), buf),
4838
+ writeFile(join10(dumpDir, `frame-${idx}-truth.jpg`), truth)
4585
4839
  ]).catch(() => {
4586
4840
  });
4587
4841
  }
@@ -5151,9 +5405,6 @@ async function runCaptureStreamingStage(input) {
5151
5405
  }
5152
5406
 
5153
5407
  // ../producer/src/services/render/stages/captureSegmentedStage.ts
5154
- function segmentOutputPath(segmentDir, index) {
5155
- return join8(segmentDir, `segment_${String(index).padStart(5, "0")}.mp4`);
5156
- }
5157
5408
  function segmentEncoderOptions(base, segment) {
5158
5409
  return {
5159
5410
  ...base,
@@ -5251,7 +5502,8 @@ async function captureSegmentToEncoder(ctx, segment) {
5251
5502
  path: segmentPath,
5252
5503
  // Recorded so resume can prove the file on disk is the one that
5253
5504
  // finished; absent only in unit tests, whose fake encoder writes none.
5254
- bytes: existsSync6(segmentPath) ? statSync3(segmentPath).size : 0
5505
+ bytes: existsSync8(segmentPath) ? statSync3(segmentPath).size : 0,
5506
+ sha256: existsSync8(segmentPath) ? await hashSegmentFile(segmentPath) : ""
5255
5507
  });
5256
5508
  return encodeResult;
5257
5509
  } finally {
@@ -5485,8 +5737,8 @@ async function runCaptureSegmentedStage(input) {
5485
5737
  const { log, dedupPerfs, assertNotAborted } = input;
5486
5738
  const deps = { ...DEFAULT_DEPS, ...input.deps };
5487
5739
  const segments = planSegments(input.totalFrames, input.segmentFrames);
5488
- const segmentDir = input.segmentDir ?? join8(input.workDir, "segments");
5489
- mkdirSync3(segmentDir, { recursive: true });
5740
+ const segmentDir = input.segmentDir ?? join11(input.workDir, "segments");
5741
+ mkdirSync4(segmentDir, { recursive: true });
5490
5742
  const skip = input.completedSegments ?? /* @__PURE__ */ new Set();
5491
5743
  const pending = segments.filter((s) => !skip.has(s.index));
5492
5744
  for (const index of skip) log.info("[Render] segment skipped (resume)", { index });
@@ -5641,7 +5893,7 @@ function startRenderEtaGuard(options) {
5641
5893
  }
5642
5894
 
5643
5895
  // ../producer/src/services/render/captureCost.ts
5644
- import { join as join9 } from "path";
5896
+ import { join as join12 } from "path";
5645
5897
  var CAPTURE_CALIBRATION_TARGET_MS = 600;
5646
5898
  var MAX_MEASURED_CAPTURE_COST_MULTIPLIER = 8;
5647
5899
  var CAPTURE_CALIBRATION_PROTOCOL_TIMEOUT_MS = 3e4;
@@ -5885,7 +6137,7 @@ async function runCaptureCalibration(input) {
5885
6137
  });
5886
6138
  let calibration;
5887
6139
  try {
5888
- calibration = await runOneCalibration(join9(workDir, "capture-calibration"), calibrationCfg);
6140
+ calibration = await runOneCalibration(join12(workDir, "capture-calibration"), calibrationCfg);
5889
6141
  } catch (error) {
5890
6142
  const shouldFallback = !forceScreenshot && shouldFallbackToScreenshotAfterCalibrationError(error);
5891
6143
  if (!shouldFallback) {
@@ -5919,7 +6171,7 @@ async function runCaptureCalibration(input) {
5919
6171
  const screenshotCfg = createCaptureCalibrationConfig({ ...cfg, forceScreenshot: true });
5920
6172
  try {
5921
6173
  calibration = await runOneCalibration(
5922
- join9(workDir, "capture-calibration-screenshot"),
6174
+ join12(workDir, "capture-calibration-screenshot"),
5923
6175
  screenshotCfg
5924
6176
  );
5925
6177
  } catch (fallbackError) {
@@ -5983,8 +6235,8 @@ function checkPageNeverReady(input) {
5983
6235
  }
5984
6236
 
5985
6237
  // ../producer/src/services/render/deferredVideoFrames.ts
5986
- import { mkdirSync as mkdirSync4, rmSync as rmSync7 } from "fs";
5987
- import { dirname as dirname5, join as join10 } from "path";
6238
+ import { mkdirSync as mkdirSync5, rmSync as rmSync7 } from "fs";
6239
+ import { dirname as dirname5, join as join13 } from "path";
5988
6240
  function contiguousRuns(sortedIndexes) {
5989
6241
  const runs2 = [];
5990
6242
  for (const index of sortedIndexes) {
@@ -6023,7 +6275,7 @@ async function extractDeferredFrames(input) {
6023
6275
  const shown = shownDeferredFrameIndexes(input, input.frames, input.fps);
6024
6276
  return Promise.all(
6025
6277
  deferred.map(async (video) => {
6026
- const outputDir = join10(input.outputRoot, mediaIdPathSegment(video.videoId));
6278
+ const outputDir = join13(input.outputRoot, mediaIdPathSegment(video.videoId));
6027
6279
  const indexes = [...shown.get(video.videoId) ?? []].sort((a, b) => a - b);
6028
6280
  if (indexes.length === 0) {
6029
6281
  return { ...video, outputDir, framePaths: /* @__PURE__ */ new Map(), ownedByLookup: false };
@@ -6079,7 +6331,7 @@ async function extractAllDeferredFrames(extracted, input) {
6079
6331
  maxTransientRetries: input.maxTransientRetries,
6080
6332
  onRetry: () => {
6081
6333
  rmSync7(video.outputDir, { recursive: true, force: true });
6082
- mkdirSync4(video.outputDir, { recursive: true });
6334
+ mkdirSync5(video.outputDir, { recursive: true });
6083
6335
  }
6084
6336
  }
6085
6337
  );
@@ -6165,10 +6417,10 @@ async function measureLocalShownBoxes(page, videos, fps, duration, log) {
6165
6417
  }
6166
6418
 
6167
6419
  // ../producer/src/services/render/segmentVideoFrames.ts
6168
- import { mkdirSync as mkdirSync5, rmSync as rmSync8 } from "fs";
6169
- import { join as join11 } from "path";
6420
+ import { mkdirSync as mkdirSync6, rmSync as rmSync8 } from "fs";
6421
+ import { join as join14 } from "path";
6170
6422
  function segmentFramesDir(rootDir, index) {
6171
- return join11(rootDir, "segment-frames", `segment_${String(index).padStart(5, "0")}`);
6423
+ return join14(rootDir, "segment-frames", `segment_${String(index).padStart(5, "0")}`);
6172
6424
  }
6173
6425
  function createSegmentVideoFrames(input) {
6174
6426
  const extractFrames = input.extractFrames ?? extractDeferredFrames;
@@ -6199,7 +6451,7 @@ function createSegmentVideoFrames(input) {
6199
6451
  let onDemandCalls = 0;
6200
6452
  const onDemandHook = () => Object.assign(
6201
6453
  async (page, time, heldVideoTime) => {
6202
- const dir = join11(
6454
+ const dir = join14(
6203
6455
  input.rootDir,
6204
6456
  "segment-frames",
6205
6457
  `on-demand_${String(onDemandCalls++).padStart(5, "0")}`
@@ -6216,11 +6468,11 @@ function createSegmentVideoFrames(input) {
6216
6468
  );
6217
6469
  return {
6218
6470
  async forFrames(frames, name) {
6219
- const dir = join11(input.rootDir, "segment-frames", name);
6471
+ const dir = join14(input.rootDir, "segment-frames", name);
6220
6472
  const release = () => rmSync8(dir, { recursive: true, force: true });
6221
6473
  try {
6222
6474
  release();
6223
- mkdirSync5(dir, { recursive: true });
6475
+ mkdirSync6(dir, { recursive: true });
6224
6476
  const table = await tableFor([...frames], dir);
6225
6477
  return { injector: () => createVideoFrameInjector(table, input.injectorOptions), release };
6226
6478
  } catch (error) {
@@ -6249,7 +6501,7 @@ function createSegmentVideoFrames(input) {
6249
6501
  folder = dir;
6250
6502
  try {
6251
6503
  rmSync8(dir, { recursive: true, force: true });
6252
- mkdirSync5(dir, { recursive: true });
6504
+ mkdirSync6(dir, { recursive: true });
6253
6505
  injector = await injectorFor(
6254
6506
  Array.from(
6255
6507
  { length: segment.endFrame - segment.startFrame },
@@ -6269,7 +6521,7 @@ function createSegmentVideoFrames(input) {
6269
6521
 
6270
6522
  // ../producer/src/services/render/videoFrameWindow.ts
6271
6523
  import { readdirSync as readdirSync3, statSync as statSync4 } from "fs";
6272
- import { join as join12 } from "path";
6524
+ import { join as join15 } from "path";
6273
6525
  function shouldWindowVideoFrames(args) {
6274
6526
  return args.segmented && args.env.HF_VIDEO_FRAME_WINDOW?.trim().toLowerCase() === "true";
6275
6527
  }
@@ -6282,7 +6534,7 @@ function directoryBytes(path) {
6282
6534
  return 0;
6283
6535
  }
6284
6536
  for (const entry of entries) {
6285
- const child2 = join12(path, entry.name);
6537
+ const child2 = join15(path, entry.name);
6286
6538
  try {
6287
6539
  bytes += entry.isDirectory() ? directoryBytes(child2) : statSync4(child2).size;
6288
6540
  } catch {
@@ -6300,7 +6552,7 @@ function trackSegmentFramePeak(frames, rootDir, onPeak) {
6300
6552
  ...worker,
6301
6553
  async prepare(segment) {
6302
6554
  await worker.prepare(segment);
6303
- const held = directoryBytes(join12(rootDir, "segment-frames"));
6555
+ const held = directoryBytes(join15(rootDir, "segment-frames"));
6304
6556
  if (held > peak) {
6305
6557
  peak = held;
6306
6558
  onPeak(peak);
@@ -6311,94 +6563,6 @@ function trackSegmentFramePeak(frames, rootDir, onPeak) {
6311
6563
  };
6312
6564
  }
6313
6565
 
6314
- // ../producer/src/services/render/segmentManifest.ts
6315
- import { createHash as createHash2 } from "crypto";
6316
- import { existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync4, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
6317
- import { join as join13 } from "path";
6318
- var MANIFEST_FILENAME = "segments.json";
6319
- function computeSegmentPlanHash(input) {
6320
- const ordered = [
6321
- input.compositionHash,
6322
- input.cliVersion,
6323
- String(input.totalFrames),
6324
- String(input.segmentFrames),
6325
- `${input.fps.num}/${input.fps.den}`,
6326
- `${input.width}x${input.height}`,
6327
- input.codec,
6328
- input.preset,
6329
- input.quality === void 0 ? "" : String(input.quality),
6330
- input.bitrate ?? "",
6331
- input.pixelFormat ?? "",
6332
- input.imageFormat,
6333
- input.useGpu ? "gpu" : "cpu",
6334
- `${input.outputWidth}x${input.outputHeight}`,
6335
- input.motionBlur,
6336
- input.pageMotionBlur ?? "",
6337
- input.captureQuality === void 0 ? "" : String(input.captureQuality)
6338
- ];
6339
- const delivery = [input.maxBitrate, input.bufferSize, input.gopSize].map((v) => v ?? "");
6340
- if (delivery.some((v) => v !== "")) ordered.push(...delivery.map(String));
6341
- return createHash2("sha256").update(ordered.join(" ")).digest("hex").slice(0, 16);
6342
- }
6343
- function segmentDirFor(projectRendersDir, planHash) {
6344
- return join13(projectRendersDir, ".hf-segments", planHash);
6345
- }
6346
- function hasNumber(value, key) {
6347
- return key in value && typeof Reflect.get(value, key) === "number";
6348
- }
6349
- function hasString(value, key) {
6350
- return key in value && typeof Reflect.get(value, key) === "string";
6351
- }
6352
- function isEntry(value) {
6353
- if (typeof value !== "object" || value === null) return false;
6354
- return hasNumber(value, "index") && hasNumber(value, "startFrame") && hasNumber(value, "endFrame") && hasString(value, "path") && hasNumber(value, "bytes") && hasString(value, "completedAt");
6355
- }
6356
- function isManifest(value) {
6357
- if (typeof value !== "object" || value === null) return false;
6358
- const completed = Reflect.get(value, "completed");
6359
- return Reflect.get(value, "version") === 1 && hasString(value, "planHash") && hasNumber(value, "totalFrames") && hasNumber(value, "segmentFrames") && Array.isArray(completed) && completed.every(isEntry);
6360
- }
6361
- function readSegmentManifest(segmentDir) {
6362
- const path = join13(segmentDir, MANIFEST_FILENAME);
6363
- if (!existsSync7(path)) return null;
6364
- try {
6365
- const parsed = JSON.parse(readFileSync4(path, "utf-8"));
6366
- return isManifest(parsed) ? parsed : null;
6367
- } catch {
6368
- return null;
6369
- }
6370
- }
6371
- function writeSegmentManifest(segmentDir, manifest) {
6372
- mkdirSync6(segmentDir, { recursive: true });
6373
- const tmp = join13(segmentDir, `${MANIFEST_FILENAME}.${process.pid}.tmp`);
6374
- writeFileSync3(tmp, JSON.stringify(manifest, null, 2), "utf-8");
6375
- renameWithRetry(tmp, join13(segmentDir, MANIFEST_FILENAME));
6376
- }
6377
- async function probeSegmentFrameCount(path, probe) {
6378
- try {
6379
- const meta = await probe(path);
6380
- if (!Number.isFinite(meta.videoStreamDurationSeconds) || !Number.isFinite(meta.fps))
6381
- return null;
6382
- if (meta.fps <= 0) return null;
6383
- return Math.round(meta.videoStreamDurationSeconds * meta.fps);
6384
- } catch {
6385
- return null;
6386
- }
6387
- }
6388
- async function validateCompletedSegments(manifest, expectedHash, probeFrames) {
6389
- const ok = /* @__PURE__ */ new Set();
6390
- if (manifest.planHash !== expectedHash) return ok;
6391
- for (const entry of manifest.completed) {
6392
- if (!existsSync7(entry.path)) continue;
6393
- const size = statSync5(entry.path).size;
6394
- if (size <= 0 || size !== entry.bytes) continue;
6395
- const frames = await probeFrames(entry.path);
6396
- if (frames !== entry.endFrame - entry.startFrame) continue;
6397
- ok.add(entry.index);
6398
- }
6399
- return ok;
6400
- }
6401
-
6402
6566
  // ../producer/src/services/render/hdrMode.ts
6403
6567
  function formatDowngradeWarning(outputFormat, forcedHdrWithoutSources) {
6404
6568
  const hdrSourceReason = forcedHdrWithoutSources ? "HDR was forced without detected HDR sources" : "HDR source detected";
@@ -6973,11 +7137,11 @@ function requireOutputDimensions(expected, width, height) {
6973
7137
  }
6974
7138
 
6975
7139
  // ../producer/src/services/render/stages/compileStage.ts
6976
- import { existsSync as existsSync11, writeFileSync as writeFileSync4 } from "fs";
6977
- import { join as join17, relative as relative3 } from "path";
7140
+ import { existsSync as existsSync12, writeFileSync as writeFileSync4 } from "fs";
7141
+ import { join as join19, relative as relative4 } from "path";
6978
7142
 
6979
7143
  // ../producer/src/services/compositionSizeLimit.ts
6980
- import { statSync as statSync6 } from "fs";
7144
+ import { statSync as statSync5 } from "fs";
6981
7145
  var MAX_COMPOSITION_HTML_BYTES = 16 * 1024 * 1024;
6982
7146
  var COMPOSITION_TOO_LARGE = "COMPOSITION_TOO_LARGE";
6983
7147
  var megabytes = (bytes) => `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
@@ -7000,6 +7164,8 @@ var fileTooLarge = (file, bytes) => new CompositionTooLargeError(
7000
7164
  { bytes, limitBytes: MAX_COMPOSITION_HTML_BYTES }
7001
7165
  );
7002
7166
  var limitText = `One render generates at most ${megabytes(MAX_EXPANDED_COMPOSITION_BYTES)}`;
7167
+ var REMOTE_SCRIPTS = "remote scripts";
7168
+ var REMOTE_STYLESHEETS = "remote stylesheets";
7003
7169
  function generatedTooLarge(file, bytes) {
7004
7170
  if (file === "composition variables") {
7005
7171
  return `Composition variable styles add up to ${megabytes(bytes)}. ${limitText}. Shorten the variable values or declare them on fewer elements.`;
@@ -7007,6 +7173,9 @@ function generatedTooLarge(file, bytes) {
7007
7173
  if (file === "variable media sources") {
7008
7174
  return `Variable-bound media sources add up to ${megabytes(bytes)}. ${limitText}. Use shorter URLs or bind fewer elements.`;
7009
7175
  }
7176
+ if (file === REMOTE_SCRIPTS || file === REMOTE_STYLESHEETS) {
7177
+ return `Inlined ${file} add up to ${megabytes(bytes)}. ${limitText}. Bundle scripts and fonts with the project, or link each one once.`;
7178
+ }
7010
7179
  return `Scripts, styles and rebased asset paths generated for compositions, ending at "${file}", add up to ${megabytes(bytes)}. One render generates at most ${megabytes(MAX_EXPANDED_COMPOSITION_BYTES)} for its mounts. Merge small inline scripts and style rules, keep data-composition-id values short, or mount scenes fewer times.`;
7011
7180
  }
7012
7181
  var CompositionExpansionBudget = class {
@@ -7048,7 +7217,7 @@ var CompositionExpansionBudget = class {
7048
7217
  function assertCompositionFileSize(path, file) {
7049
7218
  let bytes;
7050
7219
  try {
7051
- const stats = statSync6(path);
7220
+ const stats = statSync5(path);
7052
7221
  if (!stats.isFile()) return;
7053
7222
  bytes = stats.size;
7054
7223
  } catch {
@@ -7059,18 +7228,18 @@ function assertCompositionFileSize(path, file) {
7059
7228
 
7060
7229
  // ../producer/src/services/htmlCompiler.ts
7061
7230
  import { createHash as createHash4 } from "crypto";
7062
- import { createReadStream as createReadStream2, existsSync as existsSync10, mkdirSync as mkdirSync7, readFileSync as readFileSync6 } from "fs";
7063
- import { join as join16, dirname as dirname7, resolve as resolve5, basename as basename4, relative as relative2, sep as sep2 } from "path";
7231
+ import { createReadStream as createReadStream3, existsSync as existsSync11, mkdirSync as mkdirSync7, readFileSync as readFileSync6 } from "fs";
7232
+ import { join as join18, dirname as dirname7, resolve as resolve6, basename as basename5, relative as relative3, sep as sep3 } from "path";
7064
7233
 
7065
7234
  // ../producer/src/services/bundledScripts.ts
7066
- import { existsSync as existsSync8, readFileSync as readFileSync5 } from "fs";
7067
- import { join as join14 } from "path";
7235
+ import { existsSync as existsSync9, readFileSync as readFileSync5 } from "fs";
7236
+ import { join as join16 } from "path";
7068
7237
  var GSAP_VENDOR_DIR_ENV = "HYPERFRAMES_GSAP_VENDOR_DIR";
7069
7238
  function bundledScript(url) {
7070
7239
  const dir = process.env[GSAP_VENDOR_DIR_ENV];
7071
7240
  if (!dir || url !== `${gsapCdnDist()}gsap.min.js`) return null;
7072
- const file = join14(dir, "gsap.min.js");
7073
- return existsSync8(file) ? readFileSync5(file) : null;
7241
+ const file = join16(dir, "gsap.min.js");
7242
+ return existsSync9(file) ? readFileSync5(file) : null;
7074
7243
  }
7075
7244
 
7076
7245
  // ../producer/src/services/renderMediaCollector.ts
@@ -7220,8 +7389,8 @@ function getPositionEditsRenderScript() {
7220
7389
  }
7221
7390
 
7222
7391
  // ../producer/src/services/assetMediaType.ts
7223
- import { existsSync as existsSync9 } from "fs";
7224
- import { dirname as dirname6, join as join15 } from "path";
7392
+ import { existsSync as existsSync10 } from "fs";
7393
+ import { dirname as dirname6, join as join17 } from "path";
7225
7394
  var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
7226
7395
  var AssetMediaTypeMismatchError = class extends Error {
7227
7396
  // fallow-ignore-next-line unused-class-member
@@ -7262,11 +7431,11 @@ function assertAssetMediaTypeProfile(expected, profile, elementIdentity) {
7262
7431
  ]);
7263
7432
  }
7264
7433
  function mediaAssetRoots(projectDir, compiledDir) {
7265
- return [projectDir, compiledDir, join15(dirname6(compiledDir), "downloads")];
7434
+ return [projectDir, compiledDir, join17(dirname6(compiledDir), "downloads")];
7266
7435
  }
7267
7436
  function dropMediaOutsideProject(input) {
7268
7437
  const { projectDir, workDir, composition, log } = input;
7269
- const compiledDir = join15(workDir, "compiled");
7438
+ const compiledDir = join17(workDir, "compiled");
7270
7439
  const roots = mediaAssetRoots(projectDir, compiledDir);
7271
7440
  const staysInside = ({ id, src }) => {
7272
7441
  if (!src || isHttpUrl(src)) return true;
@@ -7321,7 +7490,7 @@ async function preflightCompositionAssetMediaTypes(input) {
7321
7490
  input.projectDir,
7322
7491
  input.compiledDir
7323
7492
  );
7324
- if (!existsSync9(resolvedPath)) continue;
7493
+ if (!existsSync10(resolvedPath)) continue;
7325
7494
  byPath.set(resolvedPath, [...byPath.get(resolvedPath) ?? [], reference]);
7326
7495
  }
7327
7496
  const mismatches = [];
@@ -7412,7 +7581,7 @@ function normalizeCompositionSrcs(html, projectDir) {
7412
7581
  if (!value.includes("%") && !/^\.?[\\/]/.test(value)) return whole;
7413
7582
  const file = resolveCompositionSrc(projectDir, value);
7414
7583
  if (file === null) return whole;
7415
- return `${name}${quote}${relative2(projectDir, file).split(sep2).join("/")}${quote}`;
7584
+ return `${name}${quote}${relative3(projectDir, file).split(sep3).join("/")}${quote}`;
7416
7585
  });
7417
7586
  }
7418
7587
  var COMPOSITION_FILE = /\.html?$/i;
@@ -7617,8 +7786,8 @@ function detectShaderTransitionUsage(html) {
7617
7786
  async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, baseDir, downloadDir, tagName, elementIdentity, log, urlByAbsentLocalPath, probes, assetRoot) {
7618
7787
  let filePath = src;
7619
7788
  if (isHttpUrl(src)) {
7620
- const remoteDir = join16(downloadDir, REMOTE_MEDIA_SUBDIR);
7621
- if (!existsSync10(remoteDir)) mkdirSync7(remoteDir, { recursive: true });
7789
+ const remoteDir = join18(downloadDir, REMOTE_MEDIA_SUBDIR);
7790
+ if (!existsSync11(remoteDir)) mkdirSync7(remoteDir, { recursive: true });
7622
7791
  try {
7623
7792
  filePath = await downloadToTemp(src, remoteDir, void 0, void 0, void 0, {
7624
7793
  onTelemetry: logRemoteDownloadTelemetry
@@ -7628,7 +7797,7 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, b
7628
7797
  }
7629
7798
  } else {
7630
7799
  filePath = decodedUrlPath(src);
7631
- if (!filePath.startsWith("/")) filePath = join16(baseDir, filePath);
7800
+ if (!filePath.startsWith("/")) filePath = join18(baseDir, filePath);
7632
7801
  if (escapesAssetRoot(filePath, assetRoot) || isPrivateUnderAssetRoots(filePath, [projectDir, downloadDir])) {
7633
7802
  return { duration: null, resolvedPath: filePath };
7634
7803
  }
@@ -7637,7 +7806,7 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, b
7637
7806
  return { duration: null, resolvedPath: filePath };
7638
7807
  }
7639
7808
  }
7640
- if (!isHttpUrl(filePath) && !existsSync10(filePath)) {
7809
+ if (!isHttpUrl(filePath) && !existsSync11(filePath)) {
7641
7810
  return { duration: null, resolvedPath: filePath };
7642
7811
  }
7643
7812
  const withSrcContext = (error) => {
@@ -8007,7 +8176,7 @@ function inlineSubCompositions2(html, subCompositions, projectDir, variableOverr
8007
8176
  parseHostVariables: parseHostVariableValues,
8008
8177
  resolveFilePath: (srcPath) => {
8009
8178
  const file = resolveCompositionFile(projectDir, srcPath, assetRoot);
8010
- return file && relative2(projectDir, file).split(sep2).join("/");
8179
+ return file && relative3(projectDir, file).split(sep3).join("/");
8011
8180
  },
8012
8181
  resolveHtml: (srcPath) => {
8013
8182
  const compHtml = resolveMountHtml(srcPath);
@@ -8171,7 +8340,8 @@ async function downloadScript(src, mirror) {
8171
8340
  }
8172
8341
  return fetchPublicHttpsBytes(src, { maxBytes: MAX_SCRIPT_BYTES, timeoutMs: 15e3 });
8173
8342
  }
8174
- async function inlineExternalScripts(html) {
8343
+ var MAX_CONCURRENT_SCRIPT_FETCHES = 4;
8344
+ async function inlineExternalScripts(html, budget = new CompositionExpansionBudget()) {
8175
8345
  const fullHtml = ensureFullDocument(html);
8176
8346
  const wrappedFragment = fullHtml !== html;
8177
8347
  const { document: document2 } = parseHTML(fullHtml);
@@ -8185,20 +8355,52 @@ async function inlineExternalScripts(html) {
8185
8355
  }
8186
8356
  if (externalScripts.length === 0) return html;
8187
8357
  const mirror = operatorGsapMirror();
8358
+ const limit = createConcurrencyLimit(MAX_CONCURRENT_SCRIPT_FETCHES);
8359
+ const stop = new AbortController();
8360
+ const fail = (error) => {
8361
+ stop.abort(error);
8362
+ throw error;
8363
+ };
8364
+ const charge = (bytes) => {
8365
+ try {
8366
+ budget.chargeGenerated(REMOTE_SCRIPTS, bytes);
8367
+ } catch (error) {
8368
+ fail(error);
8369
+ }
8370
+ };
8371
+ const fetches = /* @__PURE__ */ new Map();
8372
+ const fetchOnce = (src) => {
8373
+ let bytes = fetches.get(src);
8374
+ if (!bytes) {
8375
+ bytes = limit(async () => {
8376
+ if (stop.signal.aborted) throw stop.signal.reason;
8377
+ const downloaded = await downloadScript(src, mirror);
8378
+ charge(downloaded.byteLength);
8379
+ return downloaded;
8380
+ }, stop.signal);
8381
+ fetches.set(src, bytes);
8382
+ }
8383
+ return bytes;
8384
+ };
8385
+ const placed = /* @__PURE__ */ new Set();
8188
8386
  const downloads = await Promise.allSettled(
8189
8387
  externalScripts.map(async ({ el, src }) => {
8190
8388
  const integrity = el.getAttribute("integrity") || "";
8191
- const bundled = bundledScript(src);
8192
- if (bundled && matchesScriptIntegrity(bundled, integrity)) {
8193
- return { src, text: new TextDecoder().decode(bundled) };
8194
- }
8195
- const bytes = await downloadScript(src, mirror);
8196
- if (!matchesScriptIntegrity(bytes, integrity)) {
8197
- throw new ScriptIntegrityError(`Subresource integrity mismatch for ${src}`);
8389
+ let bytes = bundledScript(src);
8390
+ if (bytes && matchesScriptIntegrity(bytes, integrity)) {
8391
+ charge(bytes.byteLength);
8392
+ } else {
8393
+ bytes = await fetchOnce(src);
8394
+ if (!matchesScriptIntegrity(bytes, integrity)) {
8395
+ fail(new ScriptIntegrityError(`Subresource integrity mismatch for ${src}`));
8396
+ }
8397
+ if (placed.has(src)) charge(bytes.byteLength);
8398
+ placed.add(src);
8198
8399
  }
8199
8400
  return { src, text: new TextDecoder().decode(bytes) };
8200
8401
  })
8201
8402
  );
8403
+ if (stop.signal.aborted) throw stop.signal.reason;
8202
8404
  for (let i = 0; i < downloads.length; i++) {
8203
8405
  const download = downloads[i];
8204
8406
  const { el, src } = externalScripts[i];
@@ -8225,18 +8427,18 @@ ${safeText}
8225
8427
  return wrappedFragment ? document2.body.innerHTML || "" : document2.toString();
8226
8428
  }
8227
8429
  function collectExternalAssets(html, projectDir, log = defaultLogger, file = "index.html", policy = {}) {
8228
- const absProjectDir = resolve5(projectDir);
8430
+ const absProjectDir = resolve6(projectDir);
8229
8431
  const externalAssets = /* @__PURE__ */ new Map();
8230
8432
  const leftOut = /* @__PURE__ */ new Set();
8231
8433
  function processPath(rawPath) {
8232
8434
  const trimmed = rawPath.trim();
8233
8435
  if (isNonRelativeUrl(trimmed)) return null;
8234
- const absPath = resolve5(absProjectDir, trimmed);
8436
+ const absPath = resolve6(absProjectDir, trimmed);
8235
8437
  if (isPathInside(absPath, absProjectDir)) {
8236
8438
  return null;
8237
8439
  }
8238
8440
  const onShare = namesAnotherNetworkRoot(absProjectDir, absPath);
8239
- if (!onShare && !existsSync10(absPath)) return null;
8441
+ if (!onShare && !existsSync11(absPath)) return null;
8240
8442
  const refusal = onShare ? "network_share" : outsideAssetRefusal(absProjectDir, absPath, policy);
8241
8443
  if (refusal) {
8242
8444
  if (!leftOut.has(trimmed)) log.warn(`[Compiler] ${leftOutOfRender(file, trimmed, refusal)}`);
@@ -8289,7 +8491,7 @@ function collectExternalAssets(html, projectDir, log = defaultLogger, file = "in
8289
8491
  var REMOTE_MEDIA_SUBDIR = "_remote_media";
8290
8492
  async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLabel, extraRewrite) {
8291
8493
  if (urlSet.size === 0) return { html, remoteMediaAssets: /* @__PURE__ */ new Map() };
8292
- if (!existsSync10(remoteDir)) mkdirSync7(remoteDir, { recursive: true });
8494
+ if (!existsSync11(remoteDir)) mkdirSync7(remoteDir, { recursive: true });
8293
8495
  const urlToLocal = /* @__PURE__ */ new Map();
8294
8496
  await Promise.all(
8295
8497
  [...urlSet].map(async (url) => {
@@ -8312,7 +8514,7 @@ async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLab
8312
8514
  const remoteMediaAssets = /* @__PURE__ */ new Map();
8313
8515
  const urlToRelPath = /* @__PURE__ */ new Map();
8314
8516
  for (const [url, absPath] of urlToLocal) {
8315
- const relPath = `${REMOTE_MEDIA_SUBDIR}/${basename4(absPath)}`;
8517
+ const relPath = `${REMOTE_MEDIA_SUBDIR}/${basename5(absPath)}`;
8316
8518
  remoteMediaAssets.set(relPath, absPath);
8317
8519
  urlToRelPath.set(url, relPath);
8318
8520
  }
@@ -8329,7 +8531,7 @@ async function localizeRemoteMediaSources(html, downloadDir) {
8329
8531
  const localized = await downloadAndRewriteUrls(
8330
8532
  urlSet,
8331
8533
  html,
8332
- join16(downloadDir, REMOTE_MEDIA_SUBDIR),
8534
+ join18(downloadDir, REMOTE_MEDIA_SUBDIR),
8333
8535
  "Remote media download failed",
8334
8536
  "Localized remote media source(s)"
8335
8537
  );
@@ -8352,7 +8554,7 @@ async function localizeRemoteImageSources(html, downloadDir) {
8352
8554
  return downloadAndRewriteUrls(
8353
8555
  urlSet,
8354
8556
  html,
8355
- join16(downloadDir, REMOTE_MEDIA_SUBDIR),
8557
+ join18(downloadDir, REMOTE_MEDIA_SUBDIR),
8356
8558
  "Remote image download failed",
8357
8559
  "Localized remote image source(s)"
8358
8560
  );
@@ -8365,7 +8567,7 @@ async function localizeRemoteBackgroundImages(html, downloadDir) {
8365
8567
  return downloadAndRewriteUrls(
8366
8568
  urlSet,
8367
8569
  html,
8368
- join16(downloadDir, REMOTE_MEDIA_SUBDIR),
8570
+ join18(downloadDir, REMOTE_MEDIA_SUBDIR),
8369
8571
  "Remote background-image download failed",
8370
8572
  "Localized remote background-image(s)",
8371
8573
  // Quoted url('..')/url("..") are rewritten by downloadAndRewriteUrls' default
@@ -8422,48 +8624,50 @@ function matchingBraces(css) {
8422
8624
  }
8423
8625
  return closes;
8424
8626
  }
8425
- async function inlineExternalFontStylesheets(html) {
8426
- const hrefRe = /\bhref=["']([^"']+)["']/i;
8427
- const linkMatches = [];
8627
+ function remoteFontStylesheetHref(tag) {
8628
+ const href = /\bhref=["']([^"']+)["']/i.exec(tag)?.[1];
8629
+ if (!href || !/^https?:\/\//i.test(href) || isGoogleFontsUrl(href)) return void 0;
8630
+ return href;
8631
+ }
8632
+ async function inlineExternalFontStylesheets(html, budget = new CompositionExpansionBudget()) {
8633
+ const hrefs = /* @__PURE__ */ new Set();
8428
8634
  for (const { parts } of stylesheetLinkMatches(html)) {
8429
- const tag = parts[0];
8430
- const hrefMatch = hrefRe.exec(tag);
8431
- if (!hrefMatch?.[1]) continue;
8432
- const href = hrefMatch[1];
8433
- if (!/^https?:\/\//i.test(href)) continue;
8434
- if (isGoogleFontsUrl(href)) continue;
8435
- linkMatches.push({ fullMatch: tag, href });
8436
- }
8437
- if (linkMatches.length === 0) return html;
8438
- const MAX_CONCURRENT_STYLESHEET_FETCHES = 4;
8439
- const fetches = [];
8440
- for (let i = 0; i < linkMatches.length; i += MAX_CONCURRENT_STYLESHEET_FETCHES) {
8441
- const batch = linkMatches.slice(i, i + MAX_CONCURRENT_STYLESHEET_FETCHES);
8442
- const results = await Promise.all(
8443
- batch.map(async ({ fullMatch, href }) => {
8444
- const css = await fetchExternalStylesheetCss(href);
8445
- return { fullMatch, href, css };
8446
- })
8447
- );
8448
- fetches.push(...results);
8635
+ const href = remoteFontStylesheetHref(parts[0]);
8636
+ if (href) hrefs.add(href);
8449
8637
  }
8450
- let result = html;
8451
- for (const { fullMatch, href, css } of fetches) {
8452
- if (css === null) continue;
8453
- const fontFaceBlocks = extractFontFaceBlocks(css);
8454
- if (fontFaceBlocks.length === 0) continue;
8455
- const identity = safeDownloadUrlIdentity(href);
8456
- const inlineStyle = `<style>/* Inlined external font stylesheet */
8638
+ if (hrefs.size === 0) return html;
8639
+ const MAX_CONCURRENT_STYLESHEET_FETCHES = 4;
8640
+ const inlineByHref = /* @__PURE__ */ new Map();
8641
+ const unique = [...hrefs];
8642
+ for (let i = 0; i < unique.length; i += MAX_CONCURRENT_STYLESHEET_FETCHES) {
8643
+ const batch = unique.slice(i, i + MAX_CONCURRENT_STYLESHEET_FETCHES);
8644
+ const sheets = await Promise.all(batch.map(fetchExternalStylesheetCss));
8645
+ batch.forEach((href, index) => {
8646
+ const css = sheets[index];
8647
+ const fontFaceBlocks = css ? extractFontFaceBlocks(css) : [];
8648
+ if (fontFaceBlocks.length === 0) return;
8649
+ const inlineStyle = `<style>/* Inlined external font stylesheet */
8457
8650
  ${fontFaceBlocks.join("\n")}
8458
8651
  </style>`;
8459
- result = result.replace(fullMatch, inlineStyle);
8460
- defaultLogger.debug("[Compiler] Inlined external @font-face rule(s)", {
8461
- count: fontFaceBlocks.length,
8462
- urlFingerprint: identity.urlFingerprint,
8463
- host: identity.host
8652
+ budget.chargeGenerated(REMOTE_STYLESHEETS, inlineStyle.length);
8653
+ inlineByHref.set(href, inlineStyle);
8654
+ const identity = safeDownloadUrlIdentity(href);
8655
+ defaultLogger.debug("[Compiler] Inlined external @font-face rule(s)", {
8656
+ count: fontFaceBlocks.length,
8657
+ urlFingerprint: identity.urlFingerprint,
8658
+ host: identity.host
8659
+ });
8464
8660
  });
8465
8661
  }
8466
- return result;
8662
+ const placed = /* @__PURE__ */ new Set();
8663
+ return replaceMatches(html, stylesheetLinkMatches(html), (tag) => {
8664
+ const href = remoteFontStylesheetHref(tag);
8665
+ const inlineStyle = href ? inlineByHref.get(href) : void 0;
8666
+ if (!href || !inlineStyle) return tag;
8667
+ if (placed.has(href)) budget.chargeGenerated(REMOTE_STYLESHEETS, inlineStyle.length);
8668
+ placed.add(href);
8669
+ return inlineStyle;
8670
+ });
8467
8671
  }
8468
8672
  function projectStylesheetFontFamilies(html, projectDir) {
8469
8673
  const families = [];
@@ -8472,14 +8676,14 @@ function projectStylesheetFontFamilies(html, projectDir) {
8472
8676
  } of stylesheetLinkMatches(html)) {
8473
8677
  const href = /\bhref=["']([^"']+)["']/i.exec(tag)?.[1];
8474
8678
  if (!href || /^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(href)) continue;
8475
- const sheet = resolve5(projectDir, decodedUrlPath(href).replace(/^(?:\.?\/)+/, ""));
8476
- if (!isPathInside(sheet, projectDir) || !existsSync10(sheet)) continue;
8679
+ const sheet = resolve6(projectDir, decodedUrlPath(href).replace(/^(?:\.?\/)+/, ""));
8680
+ if (!isPathInside(sheet, projectDir) || !existsSync11(sheet)) continue;
8477
8681
  for (const face of extractFontFaceBlocks(readFileSync6(sheet, "utf8"))) {
8478
8682
  const family = /font-family\s*:\s*([^;}]+)/i.exec(face)?.[1]?.trim().replace(/^['"]|['"]$/g, "");
8479
8683
  const shipsFile = [...localFontFaceUrlMatches(face)].some(({ parts: [, url = ""] }) => {
8480
8684
  const path = decodedUrlPath(url);
8481
- const file = path.startsWith("/") ? resolve5(projectDir, `.${path}`) : resolve5(dirname7(sheet), path);
8482
- return isPathInside(file, projectDir) && existsSync10(file);
8685
+ const file = path.startsWith("/") ? resolve6(projectDir, `.${path}`) : resolve6(dirname7(sheet), path);
8686
+ return isPathInside(file, projectDir) && existsSync11(file);
8483
8687
  });
8484
8688
  if (family && shipsFile) families.push(family);
8485
8689
  }
@@ -8519,7 +8723,7 @@ function localizeFontFaceUrls(html, downloadDir) {
8519
8723
  return downloadAndRewriteUrls(
8520
8724
  collectFontFaceUrls(html),
8521
8725
  html,
8522
- join16(downloadDir, REMOTE_MEDIA_SUBDIR),
8726
+ join18(downloadDir, REMOTE_MEDIA_SUBDIR),
8523
8727
  "Remote font download failed",
8524
8728
  "Localized remote font face(s)",
8525
8729
  (h, url, relPath) => h.replaceAll(`url(${url})`, `url("${relPath}")`)
@@ -8529,7 +8733,7 @@ var MAX_LOCAL_FONT_DATA_URI_BYTES = 5 * 1024 * 1024;
8529
8733
  async function readLocalFont(absPath) {
8530
8734
  const chunks = [];
8531
8735
  let totalBytes = 0;
8532
- for await (const chunk of createReadStream2(absPath)) {
8736
+ for await (const chunk of createReadStream3(absPath)) {
8533
8737
  const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
8534
8738
  totalBytes += buffer.length;
8535
8739
  if (totalBytes > MAX_LOCAL_FONT_DATA_URI_BYTES) {
@@ -8540,7 +8744,7 @@ async function readLocalFont(absPath) {
8540
8744
  return { kind: "inline", buffer: Buffer.concat(chunks, totalBytes) };
8541
8745
  }
8542
8746
  async function localFontDataUri(localPath, projectDir, assetRoot, dataUriByAbsolutePath, log) {
8543
- const absPath = localPath.startsWith("/") ? localPath : resolve5(projectDir, localPath);
8747
+ const absPath = localPath.startsWith("/") ? localPath : resolve6(projectDir, localPath);
8544
8748
  if (!isPathInside(absPath, projectDir) || escapesAssetRoot(absPath, assetRoot)) return void 0;
8545
8749
  if (refusesOutsideLink(projectDir, absPath, (line) => log.warn(`[Compiler] ${line}`))) {
8546
8750
  return void 0;
@@ -8630,8 +8834,8 @@ function renderGsapDist() {
8630
8834
  function rewriteUnresolvableGsapToCdn(html, projectDir, compSrcPath) {
8631
8835
  let gsapDist;
8632
8836
  const exists = (path) => {
8633
- const file = resolve5(projectDir, path);
8634
- return !namesAnotherNetworkRoot(projectDir, file) && existsSync10(file);
8837
+ const file = resolve6(projectDir, path);
8838
+ return !namesAnotherNetworkRoot(projectDir, file) && existsSync11(file);
8635
8839
  };
8636
8840
  return replaceGsapDistScripts(html, (full, prefix, src, file, suffix) => {
8637
8841
  if (/^https?:\/\//i.test(src)) return full;
@@ -8643,7 +8847,7 @@ function rewriteUnresolvableGsapToCdn(html, projectDir, compSrcPath) {
8643
8847
  }
8644
8848
  function rebaseDirectEntryAssetPaths(html, projectDir, htmlPath, budget) {
8645
8849
  if (!isPathInside(htmlPath, projectDir)) return html;
8646
- const entryPath = relative2(projectDir, htmlPath).replace(/\\/g, "/");
8850
+ const entryPath = relative3(projectDir, htmlPath).replace(/\\/g, "/");
8647
8851
  if (!entryPath.includes("/")) return html;
8648
8852
  const { document: document2 } = parseHTML(html);
8649
8853
  const assetExists = projectAssetExists(projectDir);
@@ -8703,7 +8907,7 @@ function bindVariableMediaSources(html, variables, budget, log) {
8703
8907
  }
8704
8908
  return changed ? document2.toString() : html;
8705
8909
  }
8706
- var entryFileName = (projectDir, htmlPath) => isPathInside(htmlPath, projectDir) ? relative2(projectDir, htmlPath).split(sep2).join("/") : basename4(htmlPath);
8910
+ var entryFileName = (projectDir, htmlPath) => isPathInside(htmlPath, projectDir) ? relative3(projectDir, htmlPath).split(sep3).join("/") : basename5(htmlPath);
8707
8911
  async function compileForRender(projectDir, htmlPath, downloadDir, options = {}) {
8708
8912
  const assetRoot = options.allowOutsideProjectAssets ? void 0 : projectDir;
8709
8913
  const outsideFiles = { includeScripts: options.includeOutsideScripts };
@@ -8716,7 +8920,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
8716
8920
  if (!COMPOSITION_FILE.test(htmlPath)) {
8717
8921
  throw new Error(`Entry file ${htmlPath} is not an .html file, so it is refused`);
8718
8922
  }
8719
- assertCompositionFileSize(htmlPath, basename4(htmlPath));
8923
+ assertCompositionFileSize(htmlPath, basename5(htmlPath));
8720
8924
  const budget = new CompositionExpansionBudget();
8721
8925
  const entryHtml = rebaseDirectEntryAssetPaths(
8722
8926
  readTextFile(htmlPath),
@@ -8768,7 +8972,8 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
8768
8972
  const usesThreeDTransforms = detectThreeDTransformUsage(sanitizedHtml);
8769
8973
  const hasAncestorBackgroundImage = detectAncestorBackgroundImage(sanitizedHtml);
8770
8974
  const fontSheetHtml = await inlineExternalFontStylesheets(
8771
- promoteCssImportsToLinkTags(sanitizedHtml)
8975
+ promoteCssImportsToLinkTags(sanitizedHtml),
8976
+ budget
8772
8977
  );
8773
8978
  const normalizedFontHtml = normalizeSystemFontPrimaryFamilies(
8774
8979
  injectTextRenderingRule(coalesceHeadStylesAndBodyScripts(fontSheetHtml))
@@ -8780,7 +8985,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
8780
8985
  projectFontFamilies: projectStylesheetFontFamilies(fontSheetHtml, projectDir),
8781
8986
  abortSignal: options.abortSignal
8782
8987
  });
8783
- const assembledHtml = await inlineExternalScripts(coalescedHtml);
8988
+ const assembledHtml = await inlineExternalScripts(coalescedHtml, budget);
8784
8989
  const HF_POSITION_ATTRS = [
8785
8990
  'data-hf-studio-path-offset="true"',
8786
8991
  'data-hf-studio-box-size="true"',
@@ -8872,8 +9077,8 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
8872
9077
  const advised = /* @__PURE__ */ new Set();
8873
9078
  for (const video of videos) {
8874
9079
  if (isHttpUrl(video.src)) continue;
8875
- const videoPath = resolve5(projectDir, video.src);
8876
- if (advised.has(videoPath) || namesAnotherNetworkRoot(projectDir, videoPath) || !existsSync10(videoPath) || escapesAssetRoot(videoPath, assetRoot) || isPrivateUnderAssetRoots(videoPath, [projectDir, downloadDir]))
9080
+ const videoPath = resolve6(projectDir, video.src);
9081
+ if (advised.has(videoPath) || namesAnotherNetworkRoot(projectDir, videoPath) || !existsSync11(videoPath) || escapesAssetRoot(videoPath, assetRoot) || isPrivateUnderAssetRoots(videoPath, [projectDir, downloadDir]))
8877
9082
  continue;
8878
9083
  advised.add(videoPath);
8879
9084
  const reencode = `ffmpeg -i "${video.src}" -c:v libx264 -r 30 -g 30 -keyint_min 30 -movflags +faststart -c:a copy output.mp4`;
@@ -9288,7 +9493,7 @@ async function recompileWithResolutions(compiled, resolutions, projectDir, downl
9288
9493
  function animatedGifCacheDir(extractCacheDir) {
9289
9494
  try {
9290
9495
  const root = extractCacheDir && privateCacheRoot(extractCacheDir);
9291
- return root ? join17(root, "animated-gif") : void 0;
9496
+ return root ? join19(root, "animated-gif") : void 0;
9292
9497
  } catch {
9293
9498
  return void 0;
9294
9499
  }
@@ -9310,17 +9515,17 @@ function resolveEntryHtmlPath(input) {
9310
9515
  const readEntry = (path) => {
9311
9516
  if (escapesAssetRoot(path, input.assetRoot)) {
9312
9517
  throw new Error(
9313
- `Entry file "${relative3(projectDir, path)}" leads outside the project folder`
9518
+ `Entry file "${relative4(projectDir, path)}" leads outside the project folder`
9314
9519
  );
9315
9520
  }
9316
- assertCompositionFileSize(path, relative3(projectDir, path));
9521
+ assertCompositionFileSize(path, relative4(projectDir, path));
9317
9522
  return readTextFile(path);
9318
9523
  };
9319
- const htmlPath = join17(projectDir, entryFile);
9524
+ const htmlPath = join19(projectDir, entryFile);
9320
9525
  const rawEntry = readEntry(htmlPath);
9321
9526
  if (entryFile === "index.html" || !isTemplateEntry(rawEntry)) return htmlPath;
9322
- const projectIndexPath = join17(projectDir, "index.html");
9323
- if (!existsSync11(projectIndexPath)) {
9527
+ const projectIndexPath = join19(projectDir, "index.html");
9528
+ if (!existsSync12(projectIndexPath)) {
9324
9529
  throw new Error(
9325
9530
  `Template entry file "${entryFile}" requires a project index.html to extract its render shell.`
9326
9531
  );
@@ -9335,7 +9540,7 @@ function resolveEntryHtmlPath(input) {
9335
9540
  `Entry file "${entryFile}" is not mounted from index.html via data-composition-src, so it cannot be rendered independently.`
9336
9541
  );
9337
9542
  }
9338
- const wrapperPath = join17(workDir, "standalone-entry.html");
9543
+ const wrapperPath = join19(workDir, "standalone-entry.html");
9339
9544
  writeFileSync4(wrapperPath, standaloneHtml, "utf-8");
9340
9545
  log.info("Extracted standalone entry from index.html host context", { entryFile });
9341
9546
  return wrapperPath;
@@ -9365,7 +9570,7 @@ async function runCompileStage(input) {
9365
9570
  const assetRoot = job.config.allowOutsideProjectAssets ? void 0 : projectDir;
9366
9571
  const htmlPath = resolveEntryHtmlPath({ projectDir, workDir, entryFile, log, assetRoot });
9367
9572
  const compileStart = Date.now();
9368
- const compiled = await compileForRender(projectDir, htmlPath, join17(workDir, "downloads"), {
9573
+ const compiled = await compileForRender(projectDir, htmlPath, join19(workDir, "downloads"), {
9369
9574
  log,
9370
9575
  failClosedFontFetch: failClosedFontFetch === true,
9371
9576
  allowSystemFontCapture,
@@ -9440,7 +9645,7 @@ async function runCompileStage(input) {
9440
9645
  });
9441
9646
  await preflightCompositionAssetMediaTypes({
9442
9647
  projectDir,
9443
- compiledDir: join17(workDir, "compiled"),
9648
+ compiledDir: join19(workDir, "compiled"),
9444
9649
  composition,
9445
9650
  signal: abortSignal
9446
9651
  });
@@ -9488,7 +9693,7 @@ async function runCompileStage(input) {
9488
9693
 
9489
9694
  // ../producer/src/services/render/stages/probeStage.ts
9490
9695
  import { createHash as createHash5 } from "crypto";
9491
- import { basename as basename5, join as join18 } from "path";
9696
+ import { basename as basename6, join as join20 } from "path";
9492
9697
 
9493
9698
  // ../producer/src/services/render/stages/probeFailures.ts
9494
9699
  var NETWORK_FAILURE_PATTERN = /404|ERR_NAME_NOT_RESOLVED|ERR_CONNECTION_REFUSED|net::ERR_/i;
@@ -9711,7 +9916,7 @@ function probeRequiresBrowser(args) {
9711
9916
  function reportedLengthSource(source) {
9712
9917
  if (!source) return null;
9713
9918
  if (source.from !== "media") return { from: source.from };
9714
- const name = basename5(source.src.split(/[?#]/, 1)[0] ?? "");
9919
+ const name = basename6(source.src.split(/[?#]/, 1)[0] ?? "");
9715
9920
  const srcHash = createHash5("sha256").update(name).digest("hex").slice(0, 12);
9716
9921
  return { from: "media", tag: source.tag, trimmed: source.trimmed, srcHash };
9717
9922
  }
@@ -9777,7 +9982,7 @@ async function runProbeStage(input) {
9777
9982
  });
9778
9983
  fileServer = await createFileServer({
9779
9984
  projectDir,
9780
- compiledDir: join18(workDir, "compiled"),
9985
+ compiledDir: join20(workDir, "compiled"),
9781
9986
  port: 0,
9782
9987
  preHeadScripts: [VIRTUAL_TIME_SHIM],
9783
9988
  fps: job.config.fps,
@@ -9814,7 +10019,7 @@ async function runProbeStage(input) {
9814
10019
  log.info("Creating capture session...", { attempt, maxAttempts: PROBE_MAX_ATTEMPTS });
9815
10020
  probeSession = await createCaptureSession(
9816
10021
  fileServer.url,
9817
- join18(workDir, "probe"),
10022
+ join20(workDir, "probe"),
9818
10023
  captureOpts,
9819
10024
  null,
9820
10025
  probeCfg
@@ -9899,7 +10104,7 @@ async function runProbeStage(input) {
9899
10104
  });
9900
10105
  probeSession = await createCaptureSession(
9901
10106
  fileServer.url,
9902
- join18(workDir, "probe-screenshot"),
10107
+ join20(workDir, "probe-screenshot"),
9903
10108
  captureOpts,
9904
10109
  null,
9905
10110
  { ...probeCfg, forceScreenshot: true }
@@ -9937,7 +10142,7 @@ async function runProbeStage(input) {
9937
10142
  compiled,
9938
10143
  resolutions,
9939
10144
  projectDir,
9940
- join18(workDir, "downloads"),
10145
+ join20(workDir, "downloads"),
9941
10146
  job.config.allowOutsideProjectAssets ? void 0 : projectDir,
9942
10147
  { includeScripts: job.config.includeOutsideScripts }
9943
10148
  );
@@ -10137,7 +10342,7 @@ async function runProbeStage(input) {
10137
10342
  });
10138
10343
  await preflightCompositionAssetMediaTypes({
10139
10344
  projectDir,
10140
- compiledDir: join18(workDir, "compiled"),
10345
+ compiledDir: join20(workDir, "compiled"),
10141
10346
  composition,
10142
10347
  signal: abortSignal
10143
10348
  });
@@ -10295,8 +10500,8 @@ function validateDistributedDuration(input) {
10295
10500
  }
10296
10501
 
10297
10502
  // ../producer/src/services/render/stages/extractVideosStage.ts
10298
- import { existsSync as existsSync12 } from "fs";
10299
- import { join as join19 } from "path";
10503
+ import { existsSync as existsSync13 } from "fs";
10504
+ import { join as join21 } from "path";
10300
10505
 
10301
10506
  // ../producer/src/services/render/extractionFailureMetadata.ts
10302
10507
  function stringOrEmpty(value) {
@@ -10636,7 +10841,7 @@ async function runExtractVideosStage(input) {
10636
10841
  // because short boundary counts can differ by one frame.
10637
10842
  {
10638
10843
  fps: job.config.fps,
10639
- outputDir: join19(compiledDir, "__hyperframes_video_frames"),
10844
+ outputDir: join21(compiledDir, "__hyperframes_video_frames"),
10640
10845
  format: job.config.videoFrameFormat ?? "auto",
10641
10846
  toneMapHdrToSdr: rendersSdrOnly(job.config, composition),
10642
10847
  timelineEnd: composition.duration,
@@ -10644,7 +10849,7 @@ async function runExtractVideosStage(input) {
10644
10849
  collectProbeFailures: extractionPolicy.failureMode === "enforce",
10645
10850
  deferRangeExtraction,
10646
10851
  shownBoxes,
10647
- contentKeyedDirs: [join19(compiledDir, REMOTE_MEDIA_SUBDIR)],
10852
+ contentKeyedDirs: [join21(compiledDir, REMOTE_MEDIA_SUBDIR)],
10648
10853
  urlByAbsentLocalPath,
10649
10854
  assetRoots,
10650
10855
  onProgress: ({ planned = 0, done = 0 }) => {
@@ -10724,7 +10929,7 @@ function isPublicHttpsUrl(url) {
10724
10929
  }
10725
10930
  }
10726
10931
  function opensLocally(path, assetRoots) {
10727
- return existsSync12(path) && (!assetRoots || assetRootsRefusal(path, assetRoots) === null);
10932
+ return existsSync13(path) && (!assetRoots || assetRootsRefusal(path, assetRoots) === null);
10728
10933
  }
10729
10934
  function localProbeSource(src, input) {
10730
10935
  const path = resolveProjectRelativeSrc(src, input.projectDir, input.compiledDir);
@@ -10736,7 +10941,7 @@ async function remoteProbeSource(video, input) {
10736
10941
  if (!isPublicHttpsUrl(video.src)) return null;
10737
10942
  if (!resolveRestrictPageNetwork()) return video.src;
10738
10943
  if (!video.hasAudio || video.hidden) return null;
10739
- const downloadDir = input.downloadDir ?? join19(input.compiledDir, REMOTE_MEDIA_SUBDIR);
10944
+ const downloadDir = input.downloadDir ?? join21(input.compiledDir, REMOTE_MEDIA_SUBDIR);
10740
10945
  try {
10741
10946
  return await downloadToTemp(video.src, downloadDir, void 0, input.signal, void 0, {
10742
10947
  onTelemetry: writeUrlDownloadTelemetry
@@ -10777,7 +10982,7 @@ async function appendVideoAudioFromProbe(input) {
10777
10982
  }
10778
10983
 
10779
10984
  // ../producer/src/services/render/videoLayerPassthroughPlan.ts
10780
- import { existsSync as existsSync13 } from "fs";
10985
+ import { existsSync as existsSync14 } from "fs";
10781
10986
  var SAMPLES = 9;
10782
10987
  function inspectVideoLayout(id, w, h, time) {
10783
10988
  window.__hf?.seek?.(time);
@@ -10839,7 +11044,7 @@ async function planVideoLayerPassthrough(input) {
10839
11044
  const { video } = q;
10840
11045
  if (isHttpUrl(video.src)) return { reason: "remote_source" };
10841
11046
  const path = resolveProjectRelativeSrc(video.src, input.projectDir, input.compiledDir);
10842
- if (!existsSync13(path)) return { reason: "source_missing" };
11047
+ if (!existsSync14(path)) return { reason: "source_missing" };
10843
11048
  const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
10844
11049
  if ("reason" in layout) return layout;
10845
11050
  const layer = await buildVideoLayerInput(
@@ -10854,16 +11059,16 @@ async function planVideoLayerPassthrough(input) {
10854
11059
  }
10855
11060
 
10856
11061
  // ../producer/src/services/render/stages/audioStage.ts
10857
- import { existsSync as existsSync15 } from "fs";
10858
- import { join as join22 } from "path";
11062
+ import { existsSync as existsSync16 } from "fs";
11063
+ import { join as join24 } from "path";
10859
11064
 
10860
11065
  // ../producer/src/services/render/audioDeliveryLimit.ts
10861
- import { existsSync as existsSync14 } from "fs";
10862
- import { dirname as dirname9, join as join21 } from "path";
11066
+ import { existsSync as existsSync15 } from "fs";
11067
+ import { dirname as dirname9, join as join23 } from "path";
10863
11068
 
10864
11069
  // ../producer/src/services/render/audioPadTrim.ts
10865
11070
  import { spawn } from "child_process";
10866
- import { dirname as dirname8, join as join20 } from "path";
11071
+ import { dirname as dirname8, join as join22 } from "path";
10867
11072
 
10868
11073
  // ../producer/src/services/render/audioTruePeak.ts
10869
11074
  var toDbfs = (token) => token.toLowerCase() === "-inf" ? Number.NEGATIVE_INFINITY : Number(token);
@@ -11123,7 +11328,7 @@ async function constrainAacTruePeak(input) {
11123
11328
  }
11124
11329
  async function cutSource(input, scratchDir, attenuationDb) {
11125
11330
  if (!input.sourcePath || !input.rewriteSource) return true;
11126
- const cutPath = join20(scratchDir, "source.wav");
11331
+ const cutPath = join22(scratchDir, "source.wav");
11127
11332
  try {
11128
11333
  const result = await input.rewriteSource(input.sourcePath, cutPath, gainFilter(attenuationDb));
11129
11334
  if (!result.success) throw new Error(result.error);
@@ -11138,7 +11343,7 @@ async function enforceAacTruePeak(input) {
11138
11343
  let scratchDir;
11139
11344
  try {
11140
11345
  scratchDir = createStagingDir(dirname8(input.audioPath), ".true-peak-");
11141
- const correctedPath = join20(scratchDir, "audio.m4a");
11346
+ const correctedPath = join22(scratchDir, "audio.m4a");
11142
11347
  const measurements = [];
11143
11348
  let attenuationDb = 0;
11144
11349
  let sourcePeakDbfs;
@@ -11351,14 +11556,14 @@ async function limitDeliveryPeaks(input, deps = {
11351
11556
  applyChain: applyAudioFxChain,
11352
11557
  encode: encodeAac,
11353
11558
  rename: renameWithRetry,
11354
- sourceExists: existsSync14
11559
+ sourceExists: existsSync15
11355
11560
  }) {
11356
11561
  const { audioPath, sourcePath, signal, timeoutMs } = input;
11357
11562
  if (!deps.sourceExists(sourcePath)) return { success: true };
11358
11563
  const peak = await deps.measure(audioPath, { timeoutMs, signal });
11359
11564
  if (peak <= AAC_DELIVERY_TRUE_PEAK_DBFS) return { success: true };
11360
11565
  const alternating = ["a", "b"].map(
11361
- (k) => join21(dirname9(sourcePath), `audio-source-limited-${k}.wav`)
11566
+ (k) => join23(dirname9(sourcePath), `audio-source-limited-${k}.wav`)
11362
11567
  );
11363
11568
  let encodedFrom;
11364
11569
  let ceiling = AAC_DELIVERY_TRUE_PEAK_DBFS;
@@ -11431,7 +11636,7 @@ function runAudioStage(input) {
11431
11636
  }
11432
11637
  async function runAudioStageScoped(input) {
11433
11638
  const stageStart = Date.now();
11434
- const pcmSourcePath = join22(input.workDir, "audio-source.wav");
11639
+ const pcmSourcePath = join24(input.workDir, "audio-source.wav");
11435
11640
  const duration = input.totalFrames * input.fps.den / input.fps.num;
11436
11641
  let deliverySourcePath;
11437
11642
  try {
@@ -11447,7 +11652,7 @@ async function runAudioStageScoped(input) {
11447
11652
  );
11448
11653
  audioLoweredDb = guard.loweredDb;
11449
11654
  input.log?.info("[audio] phases", { ...result.audioPhaseMs, guard: Date.now() - guardStart });
11450
- if (input.keepDeliverySource && !guard.sourceStale && existsSync15(pcmSourcePath)) {
11655
+ if (input.keepDeliverySource && !guard.sourceStale && existsSync16(pcmSourcePath)) {
11451
11656
  deliverySourcePath = pcmSourcePath;
11452
11657
  }
11453
11658
  }
@@ -11496,7 +11701,7 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
11496
11701
  assertNotAborted,
11497
11702
  log
11498
11703
  } = input;
11499
- const audioOutputPath = join22(workDir, MIXED_AUDIO_FILENAME);
11704
+ const audioOutputPath = join24(workDir, MIXED_AUDIO_FILENAME);
11500
11705
  let hasAudio = false;
11501
11706
  let audioError;
11502
11707
  let audioFailures;
@@ -11576,8 +11781,8 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
11576
11781
  }
11577
11782
 
11578
11783
  // ../producer/src/services/render/stages/captureStage.ts
11579
- import { existsSync as existsSync16, readdirSync as readdirSync4, statfsSync as statfsSync2 } from "fs";
11580
- import { join as join23 } from "path";
11784
+ import { existsSync as existsSync17, readdirSync as readdirSync4, statfsSync as statfsSync2 } from "fs";
11785
+ import { join as join25 } from "path";
11581
11786
  function shouldAllowAdaptiveCaptureRetry(workerCount, _explicitlyConfigured) {
11582
11787
  return workerCount > 1;
11583
11788
  }
@@ -11633,16 +11838,16 @@ function diskCaptureShortfallError(needBytes, freeBytes, framesDir, basis, remed
11633
11838
  }
11634
11839
  function measureCaptureFrameBytes(workDir, framesDir) {
11635
11840
  let total = sampleDirectoryBytes(framesDir);
11636
- if (!existsSync16(workDir)) return total;
11841
+ if (!existsSync17(workDir)) return total;
11637
11842
  for (const attempt of readdirSync4(workDir)) {
11638
11843
  if (/^retry-\d+-batch-\d+-worker-\d+$/.test(attempt)) {
11639
- total += sampleDirectoryBytes(join23(workDir, attempt));
11844
+ total += sampleDirectoryBytes(join25(workDir, attempt));
11640
11845
  continue;
11641
11846
  }
11642
11847
  if (!/^capture-attempt-\d+$/.test(attempt)) continue;
11643
- const attemptDir = join23(workDir, attempt);
11848
+ const attemptDir = join25(workDir, attempt);
11644
11849
  for (const name of readdirSync4(attemptDir)) {
11645
- if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(join23(attemptDir, name));
11850
+ if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(join25(attemptDir, name));
11646
11851
  }
11647
11852
  }
11648
11853
  return total;
@@ -11940,8 +12145,8 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
11940
12145
  }
11941
12146
 
11942
12147
  // ../producer/src/services/render/stages/captureHdrStage.ts
11943
- import { existsSync as existsSync18, mkdirSync as mkdirSync8 } from "fs";
11944
- import { join as join27 } from "path";
12148
+ import { existsSync as existsSync19, mkdirSync as mkdirSync8 } from "fs";
12149
+ import { join as join29 } from "path";
11945
12150
 
11946
12151
  // ../producer/src/services/hdrImageTransferCache.ts
11947
12152
  var DEFAULT_MAX_BYTES = 200 * 1024 * 1024;
@@ -12003,7 +12208,7 @@ function createHdrImageTransferCache(options = {}) {
12003
12208
  }
12004
12209
 
12005
12210
  // ../producer/src/services/render/stages/captureHdrSequentialLoop.ts
12006
- import { join as join24 } from "path";
12211
+ import { join as join26 } from "path";
12007
12212
  async function runSequentialLayeredFrameLoop(input) {
12008
12213
  const {
12009
12214
  job,
@@ -12124,7 +12329,7 @@ async function runSequentialLayeredFrameLoop(input) {
12124
12329
  );
12125
12330
  if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
12126
12331
  writeFileExclusiveSync(
12127
- join24(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
12332
+ join26(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
12128
12333
  normalCanvas
12129
12334
  );
12130
12335
  }
@@ -12156,14 +12361,14 @@ async function runSequentialLayeredFrameLoop(input) {
12156
12361
  }
12157
12362
 
12158
12363
  // ../producer/src/services/render/stages/captureHdrHybridLoop.ts
12159
- import { join as join26 } from "path";
12364
+ import { join as join28 } from "path";
12160
12365
 
12161
12366
  // ../producer/src/services/shaderTransitionWorkerPool.ts
12162
12367
  import { Worker } from "worker_threads";
12163
12368
  import { fileURLToPath as fileURLToPath2, pathToFileURL } from "url";
12164
- import { dirname as dirname10, join as join25 } from "path";
12369
+ import { dirname as dirname10, join as join27 } from "path";
12165
12370
  import { createRequire } from "module";
12166
- import { existsSync as existsSync17 } from "fs";
12371
+ import { existsSync as existsSync18 } from "fs";
12167
12372
  function resolveWorkerEntry(explicit) {
12168
12373
  if (explicit && explicit.length > 0) {
12169
12374
  return { path: explicit, isTs: explicit.endsWith(".ts") };
@@ -12174,9 +12379,9 @@ function resolveWorkerEntry(explicit) {
12174
12379
  return { path: override, isTs };
12175
12380
  }
12176
12381
  const moduleDir = dirname10(fileURLToPath2(import.meta.url));
12177
- const jsPath = join25(moduleDir, "shaderTransitionWorker.js");
12178
- if (existsSync17(jsPath)) return { path: jsPath, isTs: false };
12179
- const tsPath = join25(moduleDir, "shaderTransitionWorker.ts");
12382
+ const jsPath = join27(moduleDir, "shaderTransitionWorker.js");
12383
+ if (existsSync18(jsPath)) return { path: jsPath, isTs: false };
12384
+ const tsPath = join27(moduleDir, "shaderTransitionWorker.ts");
12180
12385
  return { path: tsPath, isTs: true };
12181
12386
  }
12182
12387
  function buildExecArgv(entryIsTs) {
@@ -12319,8 +12524,8 @@ async function createShaderTransitionWorkerPool(opts) {
12319
12524
  if (terminated) {
12320
12525
  throw new Error("shader-blend pool already terminated");
12321
12526
  }
12322
- return new Promise((resolve11, reject) => {
12323
- const task = traceEnabled ? { req, resolve: resolve11, reject, enqueuedAtMs: Date.now(), traceId: ++nextTaskId } : { req, resolve: resolve11, reject };
12527
+ return new Promise((resolve12, reject) => {
12528
+ const task = traceEnabled ? { req, resolve: resolve12, reject, enqueuedAtMs: Date.now(), traceId: ++nextTaskId } : { req, resolve: resolve12, reject };
12324
12529
  const idle = slots.find((s) => !s.busy && !s.dead);
12325
12530
  if (idle) {
12326
12531
  queue.unshift(task);
@@ -12544,7 +12749,7 @@ async function runHybridLayeredFrameLoop(input) {
12544
12749
  );
12545
12750
  if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
12546
12751
  writeFileExclusiveSync(
12547
- join26(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
12752
+ join28(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
12548
12753
  canvas
12549
12754
  );
12550
12755
  }
@@ -12740,8 +12945,8 @@ async function runCaptureHdrStage(input) {
12740
12945
  if (hdrVideoFrameSources.has(v.id)) hdrVideoEndTimes.set(v.id, v.end);
12741
12946
  }
12742
12947
  const debugDumpEnabled = process.env.KEEP_TEMP === "1";
12743
- const debugDumpDir = debugDumpEnabled ? join27(framesDir, "debug-composite") : null;
12744
- if (debugDumpDir && !existsSync18(debugDumpDir)) {
12948
+ const debugDumpDir = debugDumpEnabled ? join29(framesDir, "debug-composite") : null;
12949
+ if (debugDumpDir && !existsSync19(debugDumpDir)) {
12745
12950
  mkdirSync8(debugDumpDir, { recursive: true });
12746
12951
  }
12747
12952
  const compositeTransfer = resolveCompositeTransfer(hasHdrContent, effectiveHdr);
@@ -12900,16 +13105,16 @@ async function runCaptureHdrStage(input) {
12900
13105
  // ../producer/src/services/render/stages/encodeStage.ts
12901
13106
  import {
12902
13107
  copyFileSync as copyFileSync2,
12903
- existsSync as existsSync19,
13108
+ existsSync as existsSync20,
12904
13109
  mkdirSync as mkdirSync9,
12905
13110
  readdirSync as readdirSync5,
12906
13111
  readFileSync as readFileSync7,
12907
13112
  rmSync as rmSync9,
12908
- statSync as statSync7,
13113
+ statSync as statSync6,
12909
13114
  writeFileSync as writeFileSync5
12910
13115
  } from "fs";
12911
13116
  import { readFile as readFile2 } from "fs/promises";
12912
- import { dirname as dirname11, join as join28 } from "path";
13117
+ import { dirname as dirname11, join as join30 } from "path";
12913
13118
 
12914
13119
  // ../producer/src/services/render/stages/gifEncodeArgs.ts
12915
13120
  function fpsToFfmpegArg2(fps) {
@@ -13019,7 +13224,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
13019
13224
  const failure = await reencodeWithClearedWholeFrames(argsInput, run, startTime);
13020
13225
  if (failure) return failure;
13021
13226
  }
13022
- const fileSize = existsSync19(outputPath) ? statSync7(outputPath).size : 0;
13227
+ const fileSize = existsSync20(outputPath) ? statSync6(outputPath).size : 0;
13023
13228
  return {
13024
13229
  success: true,
13025
13230
  outputPath,
@@ -13110,10 +13315,10 @@ function encodeWhileCapturing(input, totalFrames, captureBudget) {
13110
13315
  const stream = await encoder;
13111
13316
  for (let next = 0; next < totalFrames; next++) {
13112
13317
  while (!landed.has(next) && !captureDone && !signal.aborted) {
13113
- await new Promise((resolve11) => wake = resolve11);
13318
+ await new Promise((resolve12) => wake = resolve12);
13114
13319
  }
13115
13320
  if (signal.aborted) return;
13116
- const mergedPath = join28(input.framesDir, formatCaptureFrameName(next, "jpg"));
13321
+ const mergedPath = join30(input.framesDir, formatCaptureFrameName(next, "jpg"));
13117
13322
  const frame = await readLandedFrame(landed.get(next), mergedPath);
13118
13323
  landed.delete(next);
13119
13324
  if (!await stream.writeFrame(frame)) {
@@ -13188,7 +13393,7 @@ async function runEncodeStage(input) {
13188
13393
  const stage5Start = Date.now();
13189
13394
  if (isPngSequence) {
13190
13395
  const encoded = startEncodeProgress(job, "Writing PNG sequence", onProgress);
13191
- if (!existsSync19(outputPath)) mkdirSync9(outputPath, { recursive: true });
13396
+ if (!existsSync20(outputPath)) mkdirSync9(outputPath, { recursive: true });
13192
13397
  const captured = readdirSync5(framesDir).filter((name) => name.endsWith(".png")).sort();
13193
13398
  if (captured.length === 0) {
13194
13399
  throw new Error(
@@ -13196,11 +13401,11 @@ async function runEncodeStage(input) {
13196
13401
  );
13197
13402
  }
13198
13403
  captured.forEach((name, i) => {
13199
- const dst = join28(outputPath, formatExportFrameName(i, "png"));
13200
- copyFileSync2(join28(framesDir, name), dst);
13404
+ const dst = join30(outputPath, formatExportFrameName(i, "png"));
13405
+ copyFileSync2(join30(framesDir, name), dst);
13201
13406
  });
13202
- if (hasAudio && audioOutputPath && existsSync19(audioOutputPath)) {
13203
- copyFileSync2(audioOutputPath, join28(outputPath, MIXED_AUDIO_FILENAME));
13407
+ if (hasAudio && audioOutputPath && existsSync20(audioOutputPath)) {
13408
+ copyFileSync2(audioOutputPath, join30(outputPath, MIXED_AUDIO_FILENAME));
13204
13409
  log.info(
13205
13410
  `[Render] png-sequence: ${MIXED_AUDIO_FILENAME} sidecar written to ${outputPath}/${MIXED_AUDIO_FILENAME}`
13206
13411
  );
@@ -13220,7 +13425,7 @@ async function runEncodeStage(input) {
13220
13425
  const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
13221
13426
  fps: job.config.fps,
13222
13427
  loop,
13223
- palettePath: join28(dirname11(videoOnlyPath), "gif-palette.png"),
13428
+ palettePath: join30(dirname11(videoOnlyPath), "gif-palette.png"),
13224
13429
  preserveAlpha: needsAlpha,
13225
13430
  signal: abortSignal,
13226
13431
  timeout: engineCfg.ffmpegEncodeTimeout
@@ -13430,9 +13635,9 @@ function sampleDirectoryBytes(dir) {
13430
13635
  continue;
13431
13636
  }
13432
13637
  for (const name of entries) {
13433
- const full = join29(current, name);
13638
+ const full = join31(current, name);
13434
13639
  try {
13435
- const st = statSync8(full);
13640
+ const st = statSync7(full);
13436
13641
  if (st.isDirectory()) {
13437
13642
  stack.push(full);
13438
13643
  } else if (st.isFile()) {
@@ -13466,6 +13671,7 @@ function summarizeExtractionObservability(extractionResult, videoCount, coverage
13466
13671
  vfrPreflightCount: phaseBreakdown?.vfrPreflightCount,
13467
13672
  cacheHits: phaseBreakdown?.cacheHits,
13468
13673
  cacheMisses: phaseBreakdown?.cacheMisses,
13674
+ cachePublishFailures: phaseBreakdown?.cachePublishFailures,
13469
13675
  transientRetries: phaseBreakdown?.transientRetries,
13470
13676
  ...coverageGauges,
13471
13677
  authoredTimedClipCount
@@ -13587,8 +13793,8 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
13587
13793
  const ranges = [];
13588
13794
  let rangeStart = null;
13589
13795
  for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
13590
- const framePath = join29(framesDir, formatCaptureFrameName(frameIndex, frameExt));
13591
- const missing = !existsSync20(framePath) || statSync8(framePath).size <= 8;
13796
+ const framePath = join31(framesDir, formatCaptureFrameName(frameIndex, frameExt));
13797
+ const missing = !existsSync21(framePath) || statSync7(framePath).size <= 8;
13592
13798
  if (missing && rangeStart === null) {
13593
13799
  rangeStart = frameIndex;
13594
13800
  } else if (!missing && rangeStart !== null) {
@@ -13604,7 +13810,7 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
13604
13810
  function buildMissingFrameRetryBatches(ranges, maxWorkers, workDir, attempt, rangeStart = 0, stride = 1) {
13605
13811
  const workersPerBatch = Math.max(1, Math.floor(maxWorkers));
13606
13812
  const batches = [];
13607
- const outputDirFor = (batchIndex, workerId) => join29(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`);
13813
+ const outputDirFor = (batchIndex, workerId) => join31(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`);
13608
13814
  if (stride > 1) {
13609
13815
  const spans = /* @__PURE__ */ new Map();
13610
13816
  for (const range of ranges) {
@@ -13663,9 +13869,9 @@ function createCaptureObservabilityUpdater(observability, platform2 = process.pl
13663
13869
  function getNextRetryWorkerCount(currentWorkers) {
13664
13870
  return Math.max(1, Math.floor(currentWorkers / 2));
13665
13871
  }
13666
- function resolveRenderWorkDirPrefix(outputPath, jobId, platform2 = process.platform, systemTempDir = tmpdir2()) {
13667
- if (platform2 === "win32" || platform2 === "darwin") return join29(systemTempDir, "hf-render-");
13668
- return join29(dirname12(outputPath), `work-${jobId}-`);
13872
+ function resolveRenderWorkDirPrefix(outputPath, jobId, platform2 = process.platform, systemTempDir = tmpdir3()) {
13873
+ if (platform2 === "win32" || platform2 === "darwin") return join31(systemTempDir, "hf-render-");
13874
+ return join31(dirname12(outputPath), `work-${jobId}-`);
13669
13875
  }
13670
13876
  var MAX_TRANSIENT_CAPTURE_RETRIES = 1;
13671
13877
  function isTransientCaptureRetryEligible(failureKind, missing, retriesUsed) {
@@ -13720,8 +13926,8 @@ The composition is too large for the available memory. To reduce memory pressure
13720
13926
  function countCapturedFrames(totalFrames, framesDir, frameExt) {
13721
13927
  let captured = 0;
13722
13928
  for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
13723
- const framePath = join29(framesDir, formatCaptureFrameName(frameIndex, frameExt));
13724
- if (existsSync20(framePath)) captured++;
13929
+ const framePath = join31(framesDir, formatCaptureFrameName(frameIndex, frameExt));
13930
+ if (existsSync21(framePath)) captured++;
13725
13931
  }
13726
13932
  return captured;
13727
13933
  }
@@ -13746,7 +13952,7 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
13746
13952
  reason: attempt === 0 ? "initial" : pendingTransientRetry ? "transient-retry" : "retry"
13747
13953
  });
13748
13954
  pendingTransientRetry = false;
13749
- const attemptWorkDir = join29(options.workDir, `capture-attempt-${attempt}`);
13955
+ const attemptWorkDir = join31(options.workDir, `capture-attempt-${attempt}`);
13750
13956
  const batches = missingRanges ? buildMissingFrameRetryBatches(
13751
13957
  missingRanges,
13752
13958
  currentWorkers,
@@ -14393,8 +14599,8 @@ function deVerifyFallbackTelemetry(err) {
14393
14599
  };
14394
14600
  }
14395
14601
  function resolveRenderDebugDir() {
14396
- const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve6(process.env.PRODUCER_RENDERS_DIR, "..") : resolve6(dirname12(fileURLToPath3(import.meta.url)), "../..");
14397
- return join29(producerRoot, ".debug");
14602
+ const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve7(process.env.PRODUCER_RENDERS_DIR, "..") : resolve7(dirname12(fileURLToPath3(import.meta.url)), "../..");
14603
+ return join31(producerRoot, ".debug");
14398
14604
  }
14399
14605
  async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
14400
14606
  validateHlsRenderConfig(job.config);
@@ -14402,11 +14608,11 @@ async function executeRenderJob(job, projectDir, outputPath, progressSink, abort
14402
14608
  validateChromaSubsamplingConfig(job.config);
14403
14609
  const debugDir = resolveRenderDebugDir();
14404
14610
  const outputDir = dirname12(outputPath);
14405
- if (!existsSync20(outputDir)) mkdirSync10(outputDir, { recursive: true });
14406
- const workDir = job.config.debug ? join29(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
14611
+ if (!existsSync21(outputDir)) mkdirSync10(outputDir, { recursive: true });
14612
+ const workDir = job.config.debug ? join31(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
14407
14613
  const pipelineStart = Date.now();
14408
14614
  const baseLog = job.config.logger ?? defaultLogger;
14409
- const logPath = job.config.debug ? join29(workDir, "render.log") : null;
14615
+ const logPath = job.config.debug ? join31(workDir, "render.log") : null;
14410
14616
  const execution = new RenderExecutionContext({
14411
14617
  request: { renderJobId: job.id, projectDir, outputPath },
14412
14618
  logger: logPath ? createRenderFileLogger(logPath, baseLog) : baseLog,
@@ -14437,6 +14643,15 @@ async function executeRenderJob(job, projectDir, outputPath, progressSink, abort
14437
14643
  await execution.dispose();
14438
14644
  }
14439
14645
  }
14646
+ function loadResumeKeyOrWarn(resume, log) {
14647
+ const key = segmentManifestKey();
14648
+ if (resume && !key) {
14649
+ log.warn(
14650
+ "[Render] --resume: no preview token could be read or created, so every segment will be captured again"
14651
+ );
14652
+ }
14653
+ return key;
14654
+ }
14440
14655
  async function executeRenderPipeline(input) {
14441
14656
  const {
14442
14657
  job,
@@ -14474,7 +14689,7 @@ async function executeRenderPipeline(input) {
14474
14689
  imageDecodeFailures: 0
14475
14690
  };
14476
14691
  let hdrPerf;
14477
- const perfOutputPath = join29(workDir, "perf-summary.json");
14692
+ const perfOutputPath = join31(workDir, "perf-summary.json");
14478
14693
  const cfg = { ...job.config.producerConfig ?? resolveConfig() };
14479
14694
  const observability = new RenderObservabilityRecorder({
14480
14695
  pipelineStartMs: pipelineStart,
@@ -14550,7 +14765,7 @@ async function executeRenderPipeline(input) {
14550
14765
  job.startedAt = /* @__PURE__ */ new Date();
14551
14766
  assertNotAborted();
14552
14767
  assertConfiguredFfmpegBinariesExist();
14553
- if (!existsSync20(workDir)) mkdirSync10(workDir, { recursive: true });
14768
+ if (!existsSync21(workDir)) mkdirSync10(workDir, { recursive: true });
14554
14769
  if (job.config.debug) {
14555
14770
  log.info("[Render] Debug artifacts enabled", { workDir, logPath });
14556
14771
  }
@@ -14579,8 +14794,8 @@ async function executeRenderPipeline(input) {
14579
14794
  requestedWorkers: job.config.workers ?? "auto"
14580
14795
  });
14581
14796
  const entryFile = job.config.entryFile || "index.html";
14582
- const htmlPath = join29(projectDir, entryFile);
14583
- if (!existsSync20(htmlPath)) {
14797
+ const htmlPath = join31(projectDir, entryFile);
14798
+ if (!existsSync21(htmlPath)) {
14584
14799
  throw new Error(`Entry file not found: ${htmlPath}`);
14585
14800
  }
14586
14801
  assertNotAborted();
@@ -14676,7 +14891,7 @@ async function executeRenderPipeline(input) {
14676
14891
  const largerThanCanvas = await oversizedVideos(
14677
14892
  composition.videos,
14678
14893
  projectDir,
14679
- join29(workDir, "compiled"),
14894
+ join31(workDir, "compiled"),
14680
14895
  { width: outputWidth, height: outputHeight }
14681
14896
  );
14682
14897
  const probeResult = await observeRenderStage(
@@ -14773,7 +14988,7 @@ async function executeRenderPipeline(input) {
14773
14988
  canvas: { width, height },
14774
14989
  page: probeSession.page,
14775
14990
  projectDir,
14776
- compiledDir: join29(workDir, "compiled")
14991
+ compiledDir: join31(workDir, "compiled")
14777
14992
  });
14778
14993
  if (videoLayerPlan.videoId === void 0) {
14779
14994
  log.info(`[Render] Video layer passthrough off: ${videoLayerPlan.reason}`);
@@ -14791,7 +15006,7 @@ async function executeRenderPipeline(input) {
14791
15006
  updateJobStatus(job, "preprocessing", "Extracting video frames", 10, onProgress, {
14792
15007
  code: "extract_video"
14793
15008
  });
14794
- const compiledDir = join29(workDir, "compiled");
15009
+ const compiledDir = join31(workDir, "compiled");
14795
15010
  const segmentsCapture = (layeredOrEffectRoute) => shouldSegmentCapture({
14796
15011
  env: process.env,
14797
15012
  durationSeconds: probeResult.duration,
@@ -14927,7 +15142,7 @@ async function executeRenderPipeline(input) {
14927
15142
  try {
14928
15143
  fileServer = await createFileServer({
14929
15144
  projectDir,
14930
- compiledDir: join29(workDir, "compiled"),
15145
+ compiledDir: join31(workDir, "compiled"),
14931
15146
  port: 0,
14932
15147
  preHeadScripts: [VIRTUAL_TIME_SHIM],
14933
15148
  fps: job.config.fps,
@@ -14947,8 +15162,8 @@ async function executeRenderPipeline(input) {
14947
15162
  if (!activeFileServer) {
14948
15163
  throw new Error("File server failed to initialize before frame capture");
14949
15164
  }
14950
- const framesDir = join29(workDir, "captured-frames");
14951
- if (!existsSync20(framesDir)) mkdirSync10(framesDir, { recursive: true });
15165
+ const framesDir = join31(workDir, "captured-frames");
15166
+ if (!existsSync21(framesDir)) mkdirSync10(framesDir, { recursive: true });
14952
15167
  updateJobStatus(job, "rendering", "Checking browser GPU", 25, onProgress, {
14953
15168
  code: "start_browsers"
14954
15169
  });
@@ -15528,7 +15743,7 @@ async function executeRenderPipeline(input) {
15528
15743
  hls: ".mp4"
15529
15744
  };
15530
15745
  const videoExt = FORMAT_EXT[outputFormat] ?? ".mp4";
15531
- const videoOnlyPath = join29(workDir, `video-only${videoExt}`);
15746
+ const videoOnlyPath = join31(workDir, `video-only${videoExt}`);
15532
15747
  let usePageSideCompositingForTransitions = (cfg.enablePageSideCompositing || isGif) && compiled.hasShaderTransitions && !hasHdrContent && outputSupportsPageSideShaderCompositing(outputFormat);
15533
15748
  if (usePageSideCompositingForTransitions) {
15534
15749
  activeFileServer.addPreHeadScript(HF_PAGE_SIDE_COMPOSITING_STUB);
@@ -15845,16 +16060,19 @@ async function executeRenderPipeline(input) {
15845
16060
  pageMotionBlur: job.config.pageMotionBlur,
15846
16061
  captureQuality: captureOptions.quality
15847
16062
  });
15848
- const segmentDir = segmentDirFor(join29(projectDir, "renders"), segmentPlanHash);
16063
+ const segmentDir = segmentDirFor(join31(projectDir, "renders"), segmentPlanHash);
16064
+ const manifestKey = loadResumeKeyOrWarn(job.config.resumeSegments === true, log);
15849
16065
  let completedSegments = /* @__PURE__ */ new Set();
15850
16066
  if (job.config.resumeSegments === true) {
15851
16067
  const existing = readSegmentManifest(segmentDir);
15852
16068
  if (existing) {
15853
- completedSegments = await validateCompletedSegments(
15854
- existing,
15855
- segmentPlanHash,
15856
- (path) => probeSegmentFrameCount(path, extractMediaMetadata)
15857
- );
16069
+ completedSegments = await validateCompletedSegments(existing, {
16070
+ expectedHash: segmentPlanHash,
16071
+ segmentDir,
16072
+ plan: planSegments(totalFrames, segmentFrames),
16073
+ key: manifestKey,
16074
+ probeFrames: (path) => probeSegmentFrameCount(path, extractMediaMetadata)
16075
+ });
15858
16076
  log.info(`[Render] resuming: ${completedSegments.size} segments complete`, {
15859
16077
  segmentDir
15860
16078
  });
@@ -15928,7 +16146,7 @@ async function executeRenderPipeline(input) {
15928
16146
  ...segmentManifest.completed.filter((e) => e.index !== entry.index),
15929
16147
  { ...entry, completedAt: (/* @__PURE__ */ new Date()).toISOString() }
15930
16148
  ];
15931
- writeSegmentManifest(segmentDir, segmentManifest);
16149
+ writeSegmentManifest(segmentDir, segmentManifest, manifestKey);
15932
16150
  },
15933
16151
  updateCaptureObservability
15934
16152
  })
@@ -16389,7 +16607,7 @@ async function executeRenderPipeline(input) {
16389
16607
  })
16390
16608
  );
16391
16609
  const totalElapsed = Date.now() - pipelineStart;
16392
- const tmpPeakBytes = existsSync20(workDir) ? sampleDirectoryBytes(workDir) : 0;
16610
+ const tmpPeakBytes = existsSync21(workDir) ? sampleDirectoryBytes(workDir) : 0;
16393
16611
  recordTransientRetryObservability();
16394
16612
  observability.checkpoint("pipeline", "artifact validated", { totalElapsedMs: totalElapsed });
16395
16613
  const observabilitySummary = observability.summary({
@@ -16470,8 +16688,8 @@ async function executeRenderPipeline(input) {
16470
16688
  }
16471
16689
  }
16472
16690
  if (job.config.debug) {
16473
- if (!isPngSequence && !isHls && existsSync20(stagedOutputPath)) {
16474
- const debugOutput = join29(workDir, `output${videoExt}`);
16691
+ if (!isPngSequence && !isHls && existsSync21(stagedOutputPath)) {
16692
+ const debugOutput = join31(workDir, `output${videoExt}`);
16475
16693
  copyFileSync3(stagedOutputPath, debugOutput);
16476
16694
  }
16477
16695
  }
@@ -16550,7 +16768,8 @@ async function executeRenderPipeline(input) {
16550
16768
  perfStages,
16551
16769
  hdrDiagnostics,
16552
16770
  observability: observabilitySummary,
16553
- subTimelineWait: worstSubTimelineWaitOutcome(dedupPerfs)
16771
+ subTimelineWait: worstSubTimelineWaitOutcome(dedupPerfs),
16772
+ missingPath: describeMissingPath(error, { cacheDir: cfg.extractCacheDir, workDir })
16554
16773
  });
16555
16774
  publishRenderFailure(
16556
16775
  job,
@@ -16585,13 +16804,13 @@ async function executeRenderPipeline(input) {
16585
16804
 
16586
16805
  // ../producer/src/services/distributed/renderSpan.ts
16587
16806
  import { mkdirSync as mkdirSync18, mkdtempSync, readFileSync as readFileSync13, rmSync as rmSync16 } from "fs";
16588
- import { join as join43 } from "path";
16589
- import { tmpdir as tmpdir4 } from "os";
16807
+ import { join as join45 } from "path";
16808
+ import { tmpdir as tmpdir5 } from "os";
16590
16809
 
16591
16810
  // ../producer/src/services/distributed/mp4Stitch.ts
16592
- import { createReadStream as createReadStream3, createWriteStream, mkdirSync as mkdirSync11, rmSync as rmSync11 } from "fs";
16811
+ import { createReadStream as createReadStream4, createWriteStream, mkdirSync as mkdirSync11, rmSync as rmSync11 } from "fs";
16593
16812
  import { open } from "fs/promises";
16594
- import { basename as basename6, dirname as dirname13, join as join30 } from "path";
16813
+ import { basename as basename7, dirname as dirname13, join as join32 } from "path";
16595
16814
  import { finished, pipeline } from "stream/promises";
16596
16815
  function boxAt(src, off, at, limit) {
16597
16816
  let size = src.readUInt32BE(off);
@@ -16943,7 +17162,7 @@ function fileRange(path) {
16943
17162
  }
16944
17163
  async function copyPayload(path, layout, index, out) {
16945
17164
  const { payloadStart, payloadEnd } = layout;
16946
- const payload = createReadStream3(path, { start: payloadStart, end: payloadEnd - 1 });
17165
+ const payload = createReadStream4(path, { start: payloadStart, end: payloadEnd - 1 });
16947
17166
  await pipeline(payload, out, { end: false });
16948
17167
  if (payload.bytesRead !== payloadEnd - payloadStart) {
16949
17168
  throw new Error(
@@ -16956,14 +17175,14 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
16956
17175
  const layouts = await Promise.all(sourcePaths.map((path) => readMp4Layout(fileRange(path))));
16957
17176
  const header = audioPath ? buildStitchedHeader(layouts.slice(1), layouts[0]) : buildStitchedHeader(layouts);
16958
17177
  mkdirSync11(dirname13(outputPath), { recursive: true });
16959
- const workDir = createStagingDir(dirname13(outputPath), `${basename6(outputPath)}.stitch-`);
16960
- const out = createWriteStream(join30(workDir, "out.mp4"));
17178
+ const workDir = createStagingDir(dirname13(outputPath), `${basename7(outputPath)}.stitch-`);
17179
+ const out = createWriteStream(join32(workDir, "out.mp4"));
16961
17180
  try {
16962
17181
  out.write(header);
16963
17182
  for (const [i, path] of sourcePaths.entries()) await copyPayload(path, layouts[i], i, out);
16964
17183
  out.end();
16965
17184
  await finished(out);
16966
- renameWithRetry(join30(workDir, "out.mp4"), outputPath);
17185
+ renameWithRetry(join32(workDir, "out.mp4"), outputPath);
16967
17186
  } finally {
16968
17187
  out.destroy();
16969
17188
  rmSync11(workDir, { recursive: true, force: true });
@@ -16974,25 +17193,25 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
16974
17193
  import {
16975
17194
  copyFileSync as copyFileSync4,
16976
17195
  cpSync as cpSync2,
16977
- existsSync as existsSync25,
17196
+ existsSync as existsSync26,
16978
17197
  linkSync,
16979
17198
  mkdirSync as mkdirSync14,
16980
17199
  rmSync as rmSync12,
16981
17200
  writeFileSync as writeFileSync9
16982
17201
  } from "fs";
16983
- import { extname as extname6, isAbsolute as isAbsolute2, join as join38, relative as relative6, sep as sep3 } from "path";
17202
+ import { extname as extname6, isAbsolute as isAbsolute3, join as join40, relative as relative7, sep as sep4 } from "path";
16984
17203
 
16985
17204
  // ../producer/src/services/distributed/planFrameCost.ts
16986
- import { join as join33 } from "path";
17205
+ import { join as join35 } from "path";
16987
17206
 
16988
17207
  // ../producer/src/services/distributed/chunkFrames.ts
16989
- import { existsSync as existsSync22, readdirSync as readdirSync7 } from "fs";
16990
- import { extname as extname4, join as join32 } from "path";
17208
+ import { existsSync as existsSync23, readdirSync as readdirSync7 } from "fs";
17209
+ import { extname as extname4, join as join34 } from "path";
16991
17210
 
16992
17211
  // ../producer/src/services/distributed/shared.ts
16993
17212
  import { execFile as execFileCallback } from "child_process";
16994
- import { dirname as dirname14, join as join31 } from "path";
16995
- import { existsSync as existsSync21, readFileSync as readFileSync8 } from "fs";
17213
+ import { dirname as dirname14, join as join33 } from "path";
17214
+ import { existsSync as existsSync22, readFileSync as readFileSync8 } from "fs";
16996
17215
  import { fileURLToPath as fileURLToPath4 } from "url";
16997
17216
  import { promisify as promisify2 } from "util";
16998
17217
  var PLAN_VIDEOS_META_RELATIVE_PATH = "meta/videos.json";
@@ -17003,8 +17222,8 @@ function isPlanAudioArtifactPath(path) {
17003
17222
  }
17004
17223
  function resolvePlanAudioPath(planDir) {
17005
17224
  for (const name of [PLAN_AUDIO_RELATIVE_PATH, PLAN_AUDIO_LEGACY_RELATIVE_PATH]) {
17006
- const candidate = join31(planDir, name);
17007
- if (existsSync21(candidate)) return candidate;
17225
+ const candidate = join33(planDir, name);
17226
+ if (existsSync22(candidate)) return candidate;
17008
17227
  }
17009
17228
  return null;
17010
17229
  }
@@ -17268,8 +17487,8 @@ function readProducerVersion() {
17268
17487
  const startDir = dirname14(fileURLToPath4(import.meta.url));
17269
17488
  let current = startDir;
17270
17489
  for (let i = 0; i < 10; i++) {
17271
- const candidate = join31(current, "package.json");
17272
- if (existsSync21(candidate)) {
17490
+ const candidate = join33(current, "package.json");
17491
+ if (existsSync22(candidate)) {
17273
17492
  try {
17274
17493
  const pkg = JSON.parse(readFileSync8(candidate, "utf-8"));
17275
17494
  if (pkg.name === "@hyperframes/producer" && typeof pkg.version === "string") {
@@ -17323,8 +17542,8 @@ function frameNumberFromFileName(name) {
17323
17542
  function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v1") {
17324
17543
  const result = [];
17325
17544
  for (const v of videos) {
17326
- const outputDir = join32(planDir, "video-frames", mediaIdPathSegment(v.videoId));
17327
- if (!existsSync22(outputDir)) {
17545
+ const outputDir = join34(planDir, "video-frames", mediaIdPathSegment(v.videoId));
17546
+ if (!existsSync23(outputDir)) {
17328
17547
  throw new Error(
17329
17548
  `[renderChunk] planDir missing extracted video frames for ${JSON.stringify(v.videoId)}: ${outputDir} not present. plan() should have written frames here; the planDir is malformed.`
17330
17549
  );
@@ -17342,7 +17561,7 @@ function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v
17342
17561
  if (!frameName) continue;
17343
17562
  const frameNumber = indexMode === "sparse-v2" ? frameNumberFromFileName(frameName) : null;
17344
17563
  const frameIndex = frameNumber === null ? i : frameNumber - 1;
17345
- framePaths.set(frameIndex, join32(outputDir, frameName));
17564
+ framePaths.set(frameIndex, join34(outputDir, frameName));
17346
17565
  }
17347
17566
  result.push({
17348
17567
  videoId: v.videoId,
@@ -17422,8 +17641,8 @@ async function extractDeferredVideoFramesForChunk(input) {
17422
17641
  sourceOf: (video) => {
17423
17642
  const range = planned.get(video.videoId).deferredRange;
17424
17643
  const remoteUrl = remoteSources[range.sourcePath];
17425
- const sourcePath = remoteUrl ?? join32(input.planDir, ...range.sourcePath.split("/"));
17426
- if (remoteUrl === void 0 && !existsSync22(sourcePath)) {
17644
+ const sourcePath = remoteUrl ?? join34(input.planDir, ...range.sourcePath.split("/"));
17645
+ if (remoteUrl === void 0 && !existsSync23(sourcePath)) {
17427
17646
  throw new RenderChunkValidationError(
17428
17647
  MISSING_PLAN_ARTIFACT,
17429
17648
  `[renderChunk] planDir is missing the source for video ${JSON.stringify(video.videoId)}: ${range.sourcePath}`
@@ -17453,12 +17672,12 @@ async function measurePlanSecondsPerFrame(input) {
17453
17672
  planVideos,
17454
17673
  frames: sampled,
17455
17674
  fps: fpsRatio,
17456
- outputRoot: join33(workDir, "frame-cost-video-frames"),
17675
+ outputRoot: join35(workDir, "frame-cost-video-frames"),
17457
17676
  cfg: input.cfg
17458
17677
  })
17459
17678
  ];
17460
17679
  const lookup = extracted.length > 0 ? createFrameLookupTable(planVideos.videos, extracted, resolveRenderFpsConfig(fpsRatio).value) : null;
17461
- const compiledDir = join33(planDir, "compiled");
17680
+ const compiledDir = join35(planDir, "compiled");
17462
17681
  const fileServer = await createFileServer({
17463
17682
  projectDir: compiledDir,
17464
17683
  compiledDir,
@@ -17470,7 +17689,7 @@ async function measurePlanSecondsPerFrame(input) {
17470
17689
  try {
17471
17690
  session = await createCaptureSession(
17472
17691
  fileServer.url,
17473
- join33(workDir, "frame-cost"),
17692
+ join35(workDir, "frame-cost"),
17474
17693
  buildChunkCaptureOptions({
17475
17694
  dimensions: { ...input, fpsNum: fps, fpsDen: 1 },
17476
17695
  encoder: input,
@@ -17566,21 +17785,21 @@ function buildWeightedChunkSlices(weights, chunkCount, minFrames, maxFrames) {
17566
17785
  }
17567
17786
 
17568
17787
  // ../producer/src/services/render/planReferenceBackground.ts
17569
- import { join as join34 } from "path";
17788
+ import { join as join36 } from "path";
17570
17789
  async function readPlanReferenceBackground(input) {
17571
17790
  let server;
17572
17791
  let session;
17573
17792
  try {
17574
17793
  server = await createFileServer({
17575
17794
  projectDir: input.projectDir,
17576
- compiledDir: join34(input.workDir, "compiled"),
17795
+ compiledDir: join36(input.workDir, "compiled"),
17577
17796
  port: 0,
17578
17797
  preHeadScripts: [VIRTUAL_TIME_SHIM],
17579
17798
  fps: input.options.fps
17580
17799
  });
17581
17800
  session = await createCaptureSession(
17582
17801
  server.url,
17583
- join34(input.workDir, "reference"),
17802
+ join36(input.workDir, "reference"),
17584
17803
  {
17585
17804
  ...input.options,
17586
17805
  requiresWebGpu: false
@@ -17616,8 +17835,8 @@ async function readPlanReferenceBackground(input) {
17616
17835
  }
17617
17836
 
17618
17837
  // ../producer/src/services/render/stages/freezePlan.ts
17619
- import { existsSync as existsSync23, mkdirSync as mkdirSync12, readFileSync as readFileSync9, readdirSync as readdirSync8, writeFileSync as writeFileSync7 } from "fs";
17620
- import { join as join35, relative as relative4, resolve as resolve7 } from "path";
17838
+ import { existsSync as existsSync24, mkdirSync as mkdirSync12, readFileSync as readFileSync9, readdirSync as readdirSync8, writeFileSync as writeFileSync7 } from "fs";
17839
+ import { join as join37, relative as relative5, resolve as resolve8 } from "path";
17621
17840
 
17622
17841
  // ../producer/src/services/distributed/planProtocol.ts
17623
17842
  var PLAN_SCHEMA_VERSION = 1;
@@ -17712,7 +17931,7 @@ function readPlanProtocolV1(planJson, capabilities = DISTRIBUTED_RENDER_CAPABILI
17712
17931
 
17713
17932
  // ../producer/src/services/render/stages/planHash.ts
17714
17933
  import { createHash as createHash6 } from "crypto";
17715
- import { closeSync as closeSync4, createReadStream as createReadStream4, openSync as openSync4, readSync as readSync4 } from "fs";
17934
+ import { closeSync as closeSync4, createReadStream as createReadStream5, openSync as openSync4, readSync as readSync4 } from "fs";
17716
17935
  var PLAN_HASH_SCHEMA_PREFIX = "hyperframes-plan-hash-v1\0";
17717
17936
  var FIELD_DELIMITER = Buffer.from([0]);
17718
17937
  function computePlanHash(input) {
@@ -17784,7 +18003,7 @@ function sha256File(path) {
17784
18003
  }
17785
18004
  async function sha256FileAsync(path) {
17786
18005
  const hash = createHash6("sha256");
17787
- for await (const chunk of createReadStream4(path, { highWaterMark: 1024 * 1024 })) {
18006
+ for await (const chunk of createReadStream5(path, { highWaterMark: 1024 * 1024 })) {
17788
18007
  hash.update(chunk);
17789
18008
  }
17790
18009
  return hash.digest("hex");
@@ -17806,7 +18025,7 @@ function planFileSha256(absolutePath, digests) {
17806
18025
  return sha256;
17807
18026
  }
17808
18027
  async function prehashPlanFiles(dir, digests) {
17809
- if (!existsSync23(dir)) return;
18028
+ if (!existsSync24(dir)) return;
17810
18029
  for (const { absolutePath } of listPlanFiles(dir)) {
17811
18030
  if (!digests.has(absolutePath)) digests.set(absolutePath, await sha256FileAsync(absolutePath));
17812
18031
  }
@@ -17827,16 +18046,16 @@ function stripUndefined(value) {
17827
18046
  }
17828
18047
  function listPlanFiles(planDir) {
17829
18048
  const results = [];
17830
- const rootResolved = resolve7(planDir);
18049
+ const rootResolved = resolve8(planDir);
17831
18050
  function walk(dir) {
17832
18051
  const entries = readdirSync8(dir, { withFileTypes: true });
17833
18052
  for (const entry of entries) {
17834
- const full = join35(dir, entry.name);
18053
+ const full = join37(dir, entry.name);
17835
18054
  if (entry.isDirectory()) {
17836
18055
  walk(full);
17837
18056
  } else if (entry.isFile()) {
17838
18057
  results.push({
17839
- planRelativePath: relative4(rootResolved, full).split(/[\\/]+/).join("/"),
18058
+ planRelativePath: relative5(rootResolved, full).split(/[\\/]+/).join("/"),
17840
18059
  absolutePath: full
17841
18060
  });
17842
18061
  }
@@ -17872,19 +18091,19 @@ var PLAN_REMOTE_FILES_RELATIVE_PATH = "meta/remote-files.json";
17872
18091
  function writePlanRemoteFiles(planDir, files) {
17873
18092
  if (files.length === 0) return;
17874
18093
  const sorted = [...files].sort((a, b) => a.path < b.path ? -1 : 1);
17875
- writeFileSync7(join35(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH), JSON.stringify(sorted), "utf-8");
18094
+ writeFileSync7(join37(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH), JSON.stringify(sorted), "utf-8");
17876
18095
  }
17877
18096
  function readPlanRemoteFiles(planDir) {
17878
- const path = join35(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH);
17879
- return existsSync23(path) ? JSON.parse(readFileSync9(path, "utf-8")) : [];
18097
+ const path = join37(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH);
18098
+ return existsSync24(path) ? JSON.parse(readFileSync9(path, "utf-8")) : [];
17880
18099
  }
17881
18100
  function recomputePlanHashFromPlanDir(planDir, digests) {
17882
- const planJsonPath = join35(planDir, "plan.json");
17883
- const encoderJsonPath = join35(planDir, "meta", "encoder.json");
17884
- if (!existsSync23(planJsonPath)) {
18101
+ const planJsonPath = join37(planDir, "plan.json");
18102
+ const encoderJsonPath = join37(planDir, "meta", "encoder.json");
18103
+ if (!existsSync24(planJsonPath)) {
17885
18104
  throw new Error(`[freezePlan] plan.json missing: ${planJsonPath}`);
17886
18105
  }
17887
- if (!existsSync23(encoderJsonPath)) {
18106
+ if (!existsSync24(encoderJsonPath)) {
17888
18107
  throw new Error(`[freezePlan] meta/encoder.json missing: ${encoderJsonPath}`);
17889
18108
  }
17890
18109
  const planJson = JSON.parse(readFileSync9(planJsonPath, "utf-8"));
@@ -17914,21 +18133,21 @@ async function freezePlan(input) {
17914
18133
  hasAudio,
17915
18134
  digests
17916
18135
  } = input;
17917
- if (!existsSync23(planDir)) {
18136
+ if (!existsSync24(planDir)) {
17918
18137
  throw new Error(`[freezePlan] planDir does not exist: ${planDir}`);
17919
18138
  }
17920
- const metaDir = join35(planDir, "meta");
17921
- if (!existsSync23(metaDir)) mkdirSync12(metaDir, { recursive: true });
18139
+ const metaDir = join37(planDir, "meta");
18140
+ if (!existsSync24(metaDir)) mkdirSync12(metaDir, { recursive: true });
17922
18141
  writeFileSync7(
17923
- join35(metaDir, "composition.json"),
18142
+ join37(metaDir, "composition.json"),
17924
18143
  `${JSON.stringify(composition, null, 2)}
17925
18144
  `,
17926
18145
  "utf-8"
17927
18146
  );
17928
18147
  const encoderForCanonical = stripUndefined(encoder);
17929
18148
  const encoderConfigCanonicalJson = canonicalJsonStringify(encoderForCanonical);
17930
- writeFileSync7(join35(metaDir, "encoder.json"), encoderConfigCanonicalJson, "utf-8");
17931
- writeFileSync7(join35(metaDir, "chunks.json"), `${JSON.stringify(chunks, null, 2)}
18149
+ writeFileSync7(join37(metaDir, "encoder.json"), encoderConfigCanonicalJson, "utf-8");
18150
+ writeFileSync7(join37(metaDir, "chunks.json"), `${JSON.stringify(chunks, null, 2)}
17932
18151
  `, "utf-8");
17933
18152
  const { compositionHtml, assets } = collectPlanAssetShas(planDir, digests);
17934
18153
  const planHash = computePlanHash({
@@ -17953,7 +18172,7 @@ async function freezePlan(input) {
17953
18172
  duration: durationSeconds,
17954
18173
  hasAudio
17955
18174
  };
17956
- const planJsonPath = join35(planDir, "plan.json");
18175
+ const planJsonPath = join37(planDir, "plan.json");
17957
18176
  writeFileSync7(planJsonPath, `${JSON.stringify(planJson, null, 2)}
17958
18177
  `, "utf-8");
17959
18178
  return { planJsonPath, planHash };
@@ -17995,9 +18214,9 @@ function applyRuntimeEnvSnapshot(snapshot, env = process.env) {
17995
18214
  }
17996
18215
 
17997
18216
  // ../producer/src/services/distributed/chunkAudio.ts
17998
- import { closeSync as closeSync5, existsSync as existsSync24, ftruncateSync, mkdirSync as mkdirSync13, openSync as openSync5, readFileSync as readFileSync10 } from "fs";
18217
+ import { closeSync as closeSync5, existsSync as existsSync25, ftruncateSync, mkdirSync as mkdirSync13, openSync as openSync5, readFileSync as readFileSync10 } from "fs";
17999
18218
  import { writeFileSync as writeFileSync8, writeSync } from "fs";
18000
- import { join as join36 } from "path";
18219
+ import { join as join38 } from "path";
18001
18220
  function audioCutForChunk(grid, chunks, index, fps) {
18002
18221
  const firstPacketAt = (frame) => Math.min(
18003
18222
  grid.packetCount,
@@ -18084,7 +18303,7 @@ async function writeChunkAudioSlices(input) {
18084
18303
  });
18085
18304
  const bytes = readFileSync10(input.audioPath);
18086
18305
  const layout = { sizeBytes: bytes.length, payloadStart, payloadEnd, partStarts: {} };
18087
- mkdirSync13(join36(input.planDir, SLICE_DIR), { recursive: true });
18306
+ mkdirSync13(join38(input.planDir, SLICE_DIR), { recursive: true });
18088
18307
  input.chunks.forEach((_, index) => {
18089
18308
  const cut = audioCutForChunk(grid, input.chunks, index, input.fps);
18090
18309
  if (!cut) return;
@@ -18092,17 +18311,17 @@ async function writeChunkAudioSlices(input) {
18092
18311
  const start = offsets[cut.firstPacket];
18093
18312
  layout.partStarts[index] = start;
18094
18313
  const end = offsets[last] + track.sizes[last];
18095
- writeFileSync8(join36(input.planDir, chunkAudioSlicePath(index)), bytes.subarray(start, end));
18314
+ writeFileSync8(join38(input.planDir, chunkAudioSlicePath(index)), bytes.subarray(start, end));
18096
18315
  });
18097
18316
  const frame = [bytes.subarray(0, payloadStart), bytes.subarray(payloadEnd)];
18098
- writeFileSync8(join36(input.planDir, SLICE_FRAME), Buffer.concat(frame));
18099
- writeFileSync8(join36(input.planDir, SLICE_LAYOUT), JSON.stringify(layout));
18317
+ writeFileSync8(join38(input.planDir, SLICE_FRAME), Buffer.concat(frame));
18318
+ writeFileSync8(join38(input.planDir, SLICE_LAYOUT), JSON.stringify(layout));
18100
18319
  }
18101
18320
  function chunkAudioSource(planDir, chunkIndex, scratchPath) {
18102
- const layoutPath = join36(planDir, SLICE_LAYOUT);
18103
- if (!existsSync24(layoutPath)) return resolvePlanAudioPath(planDir);
18321
+ const layoutPath = join38(planDir, SLICE_LAYOUT);
18322
+ if (!existsSync25(layoutPath)) return resolvePlanAudioPath(planDir);
18104
18323
  const layout = JSON.parse(readFileSync10(layoutPath, "utf-8"));
18105
- const frame = readFileSync10(join36(planDir, SLICE_FRAME));
18324
+ const frame = readFileSync10(join38(planDir, SLICE_FRAME));
18106
18325
  const fd = openSync5(scratchPath, "w");
18107
18326
  try {
18108
18327
  writeSync(fd, frame, 0, layout.payloadStart, 0);
@@ -18115,7 +18334,7 @@ function chunkAudioSource(planDir, chunkIndex, scratchPath) {
18115
18334
  );
18116
18335
  const start = layout.partStarts[chunkIndex];
18117
18336
  if (start !== void 0) {
18118
- const part = readFileSync10(join36(planDir, chunkAudioSlicePath(chunkIndex)));
18337
+ const part = readFileSync10(join38(planDir, chunkAudioSlicePath(chunkIndex)));
18119
18338
  writeSync(fd, part, 0, part.length, start);
18120
18339
  }
18121
18340
  ftruncateSync(fd, layout.sizeBytes);
@@ -18170,8 +18389,8 @@ async function muxChunkWithAudio(input) {
18170
18389
 
18171
18390
  // ../producer/src/services/distributed/planSize.ts
18172
18391
  import { createHash as createHash7 } from "crypto";
18173
- import { lstatSync as lstatSync2, readdirSync as readdirSync9 } from "fs";
18174
- import { extname as extname5, join as join37, relative as relative5 } from "path";
18392
+ import { lstatSync as lstatSync4, readdirSync as readdirSync9 } from "fs";
18393
+ import { extname as extname5, join as join39, relative as relative6 } from "path";
18175
18394
  var MAX_TOP_COMPONENTS = 10;
18176
18395
  var SOURCE_MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
18177
18396
  ".aac",
@@ -18254,13 +18473,13 @@ function addCategoryBytes(result, category, filePath, sizeBytes) {
18254
18473
  function recordFile(result, components, rootDir, rootKind, filePath) {
18255
18474
  let sizeBytes;
18256
18475
  try {
18257
- const stat = lstatSync2(filePath);
18476
+ const stat = lstatSync4(filePath);
18258
18477
  if (!stat.isFile()) return;
18259
18478
  sizeBytes = stat.size;
18260
18479
  } catch {
18261
18480
  return;
18262
18481
  }
18263
- const rel = relative5(rootDir, filePath);
18482
+ const rel = relative6(rootDir, filePath);
18264
18483
  const segments = rel.split(/[\\/]+/).filter(Boolean);
18265
18484
  const classified = classifyFile(segments, rootKind);
18266
18485
  result.totalBytes += sizeBytes;
@@ -18283,7 +18502,7 @@ function walkRegularFiles(dir, visit) {
18283
18502
  return;
18284
18503
  }
18285
18504
  for (const entry of entries) {
18286
- const full = join37(dir, entry.name);
18505
+ const full = join39(dir, entry.name);
18287
18506
  if (entry.isDirectory()) {
18288
18507
  walkRegularFiles(full, visit);
18289
18508
  } else if (entry.isFile()) {
@@ -18499,13 +18718,13 @@ function assertPositiveInteger2(name, value) {
18499
18718
  }
18500
18719
  var FREEZE_OWNED_PLAN_FILES = [
18501
18720
  "plan.json",
18502
- join38("meta", "composition.json"),
18503
- join38("meta", "encoder.json"),
18504
- join38("meta", "chunks.json")
18721
+ join40("meta", "composition.json"),
18722
+ join40("meta", "encoder.json"),
18723
+ join40("meta", "chunks.json")
18505
18724
  ];
18506
18725
  function removeFreezeOwnedPlanFiles(planDir) {
18507
18726
  for (const relativePath of FREEZE_OWNED_PLAN_FILES) {
18508
- rmSync12(join38(planDir, relativePath), { force: true });
18727
+ rmSync12(join40(planDir, relativePath), { force: true });
18509
18728
  }
18510
18729
  }
18511
18730
  function buildChunkSlices(totalFrames, chunkCount, effectiveChunkSize) {
@@ -18644,16 +18863,16 @@ function resolveDistributedEngineConfig(config) {
18644
18863
  };
18645
18864
  }
18646
18865
  function leavesRoot(rel) {
18647
- return rel === ".." || rel.startsWith(`..${sep3}`) || isAbsolute2(rel);
18866
+ return rel === ".." || rel.startsWith(`..${sep4}`) || isAbsolute3(rel);
18648
18867
  }
18649
18868
  function pathInside(root, path) {
18650
- const rel = relative6(root, path);
18869
+ const rel = relative7(root, path);
18651
18870
  return rel === "" || leavesRoot(rel) ? null : rel;
18652
18871
  }
18653
18872
  function stableSourcePath(roots, srcPath) {
18654
18873
  for (const [root, prefix] of roots) {
18655
18874
  const rel = pathInside(root, srcPath);
18656
- if (rel !== null) return [prefix, ...rel.split(sep3)].filter(Boolean).join("/");
18875
+ if (rel !== null) return [prefix, ...rel.split(sep4)].filter(Boolean).join("/");
18657
18876
  }
18658
18877
  return srcPath;
18659
18878
  }
@@ -18663,19 +18882,19 @@ function createVideoSourceShipper(input) {
18663
18882
  const known = shipped.get(srcPath);
18664
18883
  if (known) return known;
18665
18884
  const stagedRel = pathInside(input.workVideoFramesDir, srcPath);
18666
- const current = stagedRel === null ? srcPath : join38(input.planDir, "video-frames", stagedRel);
18885
+ const current = stagedRel === null ? srcPath : join40(input.planDir, "video-frames", stagedRel);
18667
18886
  let result = null;
18668
18887
  for (const root of stagedRel === null ? [input.workCompiledDir, input.projectDir] : []) {
18669
18888
  const rel = pathInside(root, srcPath);
18670
- if (rel !== null && (existsSync25(join38(input.planDir, "compiled", rel)) || input.isRemote(srcPath))) {
18671
- result = ["compiled", ...rel.split(sep3)].join("/");
18889
+ if (rel !== null && (existsSync26(join40(input.planDir, "compiled", rel)) || input.isRemote(srcPath))) {
18890
+ result = ["compiled", ...rel.split(sep4)].join("/");
18672
18891
  break;
18673
18892
  }
18674
18893
  }
18675
18894
  if (result === null) {
18676
18895
  result = `video-sources/${shipped.size}${extname6(current)}`;
18677
- const destination = join38(input.planDir, ...result.split("/"));
18678
- mkdirSync14(join38(input.planDir, "video-sources"), { recursive: true });
18896
+ const destination = join40(input.planDir, ...result.split("/"));
18897
+ mkdirSync14(join40(input.planDir, "video-sources"), { recursive: true });
18679
18898
  try {
18680
18899
  linkSync(current, destination);
18681
18900
  } catch {
@@ -18695,7 +18914,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
18695
18914
  useGpu: false,
18696
18915
  browserGpuMode: "software"
18697
18916
  });
18698
- if (!existsSync25(planDir)) mkdirSync14(planDir, { recursive: true });
18917
+ if (!existsSync26(planDir)) mkdirSync14(planDir, { recursive: true });
18699
18918
  const log = config.logger ?? defaultLogger;
18700
18919
  const sizeLimitBytes = options.executionPlanSizeLimitBytes ?? config.planDirSizeLimitBytes ?? PLAN_DIR_SIZE_LIMIT_BYTES;
18701
18920
  const abortSignal = config.abortSignal;
@@ -18729,21 +18948,21 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
18729
18948
  includeOutsideScripts: options.includeOutsideScripts === true
18730
18949
  });
18731
18950
  const entryFile = config.entryFile ?? "index.html";
18732
- const htmlPath = join38(projectDir, entryFile);
18733
- if (!existsSync25(htmlPath)) {
18951
+ const htmlPath = join40(projectDir, entryFile);
18952
+ if (!existsSync26(htmlPath)) {
18734
18953
  throw new Error(`[plan] entry file not found: ${htmlPath}`);
18735
18954
  }
18736
- const workDir = join38(planDir, ".plan-work");
18955
+ const workDir = join40(planDir, ".plan-work");
18737
18956
  rmSync12(workDir, { recursive: true, force: true });
18738
18957
  mkdirSync14(workDir, { recursive: true });
18739
- const compiledDir = join38(workDir, "compiled");
18958
+ const compiledDir = join40(workDir, "compiled");
18740
18959
  mkdirSync14(compiledDir, { recursive: true });
18741
18960
  let stageStarted = Date.now();
18742
18961
  cpSync2(projectDir, compiledDir, {
18743
18962
  recursive: true,
18744
18963
  dereference: true,
18745
18964
  filter: (src) => {
18746
- const rel = relative6(projectDir, src);
18965
+ const rel = relative7(projectDir, src);
18747
18966
  if (rel === "") return true;
18748
18967
  if (leavesRoot(rel)) return false;
18749
18968
  if (job.config.allowOutsideProjectAssets) {
@@ -18751,15 +18970,15 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
18751
18970
  const policy = { includeScripts: job.config.includeOutsideScripts };
18752
18971
  if (refusesOutsideLink(projectDir, src, warn, policy)) return false;
18753
18972
  } else if (!isSafePath(projectDir, src)) return false;
18754
- const firstSegment = rel.split(sep3, 1)[0];
18973
+ const firstSegment = rel.split(sep4, 1)[0];
18755
18974
  return firstSegment === void 0 || !PLAN_PROJECT_DIR_SKIP_SEGMENTS.has(firstSegment);
18756
18975
  }
18757
18976
  });
18758
18977
  logPlanStage(log, "copy", stageStarted);
18759
- const finalCompiledDir = join38(planDir, "compiled");
18978
+ const finalCompiledDir = join40(planDir, "compiled");
18760
18979
  const needsAlpha = outputNeedsAlpha(config.format);
18761
18980
  const remoteFiles = Object.entries(options.remoteFiles ?? {});
18762
- const remoteLocalPath = (rel) => join38(projectDir, ...rel.split("/"));
18981
+ const remoteLocalPath = (rel) => join40(projectDir, ...rel.split("/"));
18763
18982
  for (const [, file] of remoteFiles) {
18764
18983
  declareContentAddressedUrl(file.url, file.sha256);
18765
18984
  if (file.probeFactsUrl) declareProbeFactsUrl(file.url, file.probeFactsUrl);
@@ -18856,7 +19075,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
18856
19075
  if (probeResult.fileServer) closeFileServerSafely(probeResult.fileServer, "plan", log);
18857
19076
  if (probeResult.probeSession) {
18858
19077
  try {
18859
- const { closeCaptureSession: closeCaptureSession2 } = await import("./src-FCITTGFH.js");
19078
+ const { closeCaptureSession: closeCaptureSession2 } = await import("./src-WKQLHMUG.js");
18860
19079
  await closeCaptureSession2(probeResult.probeSession);
18861
19080
  } catch (err) {
18862
19081
  log.warn("[plan] probe session close failed", {
@@ -18964,17 +19183,17 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
18964
19183
  let stageStarted = Date.now();
18965
19184
  const extractResult = await extractPlanVideos(c, options.deferVideoExtraction);
18966
19185
  logPlanStage(log, "extract", stageStarted);
18967
- const stagedVideoFrames = join38(compiledDir, "__hyperframes_video_frames");
18968
- const videoFramesDst = join38(planDir, "video-frames");
18969
- if (existsSync25(videoFramesDst)) rmSync12(videoFramesDst, { recursive: true, force: true });
18970
- const videoSourcesDir = join38(planDir, "video-sources");
19186
+ const stagedVideoFrames = join40(compiledDir, "__hyperframes_video_frames");
19187
+ const videoFramesDst = join40(planDir, "video-frames");
19188
+ if (existsSync26(videoFramesDst)) rmSync12(videoFramesDst, { recursive: true, force: true });
19189
+ const videoSourcesDir = join40(planDir, "video-sources");
18971
19190
  rmSync12(videoSourcesDir, { recursive: true, force: true });
18972
- if (existsSync25(stagedVideoFrames)) {
19191
+ if (existsSync26(stagedVideoFrames)) {
18973
19192
  renameWithRetry(stagedVideoFrames, videoFramesDst);
18974
19193
  } else {
18975
19194
  mkdirSync14(videoFramesDst, { recursive: true });
18976
19195
  }
18977
- if (existsSync25(finalCompiledDir)) rmSync12(finalCompiledDir, { recursive: true, force: true });
19196
+ if (existsSync26(finalCompiledDir)) rmSync12(finalCompiledDir, { recursive: true, force: true });
18978
19197
  renameWithRetry(compiledDir, finalCompiledDir);
18979
19198
  const shipVideoSource = createVideoSourceShipper({
18980
19199
  planDir,
@@ -19004,7 +19223,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
19004
19223
  };
19005
19224
  })
19006
19225
  });
19007
- mkdirSync14(join38(planDir, "meta"), { recursive: true });
19226
+ mkdirSync14(join40(planDir, "meta"), { recursive: true });
19008
19227
  writePlanRemoteFiles(
19009
19228
  planDir,
19010
19229
  remoteFiles.map(([rel, { sha256, sizeBytes }]) => ({
@@ -19014,7 +19233,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
19014
19233
  }))
19015
19234
  );
19016
19235
  writeFileSync9(
19017
- join38(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
19236
+ join40(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
19018
19237
  JSON.stringify(planVideosJson, null, 2),
19019
19238
  "utf-8"
19020
19239
  );
@@ -19094,11 +19313,11 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
19094
19313
  if (audioResult?.audioError) {
19095
19314
  applyDistributedAudioWarningPolicy(job, audioResult.audioError, audioResult.audioFailures, log);
19096
19315
  }
19097
- const planAudioPath = join38(planDir, PLAN_AUDIO_RELATIVE_PATH);
19098
- if (audioResult?.hasAudio && existsSync25(audioResult.audioOutputPath)) {
19316
+ const planAudioPath = join40(planDir, PLAN_AUDIO_RELATIVE_PATH);
19317
+ if (audioResult?.hasAudio && existsSync26(audioResult.audioOutputPath)) {
19099
19318
  renameWithRetry(audioResult.audioOutputPath, planAudioPath);
19100
19319
  }
19101
- if (chunksCarryAudio && existsSync25(planAudioPath)) {
19320
+ if (chunksCarryAudio && existsSync26(planAudioPath)) {
19102
19321
  if (options.sliceChunkAudio) {
19103
19322
  stageStarted = Date.now();
19104
19323
  await writeChunkAudioSlices({
@@ -19220,35 +19439,35 @@ async function plan(projectDir, config, planDir, options = {}) {
19220
19439
 
19221
19440
  // ../producer/src/services/distributed/renderChunk.ts
19222
19441
  import { randomBytes } from "crypto";
19223
- import { existsSync as existsSync28, mkdirSync as mkdirSync17, readFileSync as readFileSync12, readdirSync as readdirSync11, rmSync as rmSync15, writeFileSync as writeFileSync12 } from "fs";
19224
- import { join as join42 } from "path";
19442
+ import { existsSync as existsSync29, mkdirSync as mkdirSync17, readFileSync as readFileSync12, readdirSync as readdirSync11, rmSync as rmSync15, writeFileSync as writeFileSync12 } from "fs";
19443
+ import { join as join44 } from "path";
19225
19444
 
19226
19445
  // ../producer/src/services/distributed/planV2.ts
19227
19446
  import {
19228
19447
  copyFileSync as copyFileSync6,
19229
- existsSync as existsSync27,
19230
- lstatSync as lstatSync3,
19448
+ existsSync as existsSync28,
19449
+ lstatSync as lstatSync5,
19231
19450
  mkdirSync as mkdirSync16,
19232
19451
  readFileSync as readFileSync11,
19233
19452
  readdirSync as readdirSync10,
19234
19453
  rmSync as rmSync14,
19235
- statSync as statSync10,
19454
+ statSync as statSync9,
19236
19455
  writeFileSync as writeFileSync11
19237
19456
  } from "fs";
19238
- import { tmpdir as tmpdir3 } from "os";
19239
- import { dirname as dirname16, isAbsolute as isAbsolute3, join as join41, relative as relative7, resolve as resolve8, sep as sep4 } from "path";
19457
+ import { tmpdir as tmpdir4 } from "os";
19458
+ import { dirname as dirname16, isAbsolute as isAbsolute4, join as join43, relative as relative8, resolve as resolve9, sep as sep5 } from "path";
19240
19459
 
19241
19460
  // ../producer/src/services/distributed/planV2Publisher.ts
19242
19461
  import {
19243
19462
  copyFileSync as copyFileSync5,
19244
- existsSync as existsSync26,
19463
+ existsSync as existsSync27,
19245
19464
  linkSync as linkSync2,
19246
19465
  mkdirSync as mkdirSync15,
19247
19466
  rmSync as rmSync13,
19248
- statSync as statSync9,
19467
+ statSync as statSync8,
19249
19468
  writeFileSync as writeFileSync10
19250
19469
  } from "fs";
19251
- import { dirname as dirname15, join as join40 } from "path";
19470
+ import { dirname as dirname15, join as join42 } from "path";
19252
19471
 
19253
19472
  // ../producer/src/services/distributed/planV2Errors.ts
19254
19473
  var PLAN_V2_INTEGRITY_UNRECOVERABLE = "PLAN_V2_INTEGRITY_UNRECOVERABLE";
@@ -19263,7 +19482,7 @@ var PlanV2IntegrityError = class extends Error {
19263
19482
  };
19264
19483
 
19265
19484
  // ../producer/src/services/distributed/planV2Layout.ts
19266
- import { join as join39 } from "path";
19485
+ import { join as join41 } from "path";
19267
19486
  var SHA256_PATTERN = /^[0-9a-f]{64}$/;
19268
19487
  function assertPlanV2Sha256(value, field) {
19269
19488
  if (typeof value !== "string" || !SHA256_PATTERN.test(value)) {
@@ -19273,7 +19492,7 @@ function assertPlanV2Sha256(value, field) {
19273
19492
  }
19274
19493
  function planV2BlobPath(root, sha256) {
19275
19494
  const digest = assertPlanV2Sha256(sha256, "artifact sha256");
19276
- return join39(root, "artifacts", "sha256", digest.slice(0, 2), digest);
19495
+ return join41(root, "artifacts", "sha256", digest.slice(0, 2), digest);
19277
19496
  }
19278
19497
 
19279
19498
  // ../producer/src/services/distributed/planV2Publisher.ts
@@ -19303,7 +19522,7 @@ var LocalPlanV2ArtifactPublisher = class {
19303
19522
  #linkFile;
19304
19523
  #committed = false;
19305
19524
  constructor(destinationDir, options = {}) {
19306
- if (existsSync26(destinationDir)) {
19525
+ if (existsSync27(destinationDir)) {
19307
19526
  throw new PlanV2IntegrityError(`output directory already exists: ${destinationDir}`);
19308
19527
  }
19309
19528
  this.destinationDir = destinationDir;
@@ -19313,17 +19532,17 @@ var LocalPlanV2ArtifactPublisher = class {
19313
19532
  }
19314
19533
  async putBlob(blob) {
19315
19534
  const digest = assertPlanV2Sha256(blob.sha256, "published blob sha256");
19316
- const sourceSize = statSync9(blob.sourcePath).size;
19535
+ const sourceSize = statSync8(blob.sourcePath).size;
19317
19536
  if (sourceSize !== blob.sizeBytes) {
19318
19537
  throw new PlanV2IntegrityError(
19319
19538
  `published blob size changed for ${digest}: expected ${blob.sizeBytes}, got ${sourceSize}`
19320
19539
  );
19321
19540
  }
19322
19541
  const destinationPath = planV2BlobPath(this.temporaryDir, digest);
19323
- if (existsSync26(destinationPath)) return;
19542
+ if (existsSync27(destinationPath)) return;
19324
19543
  mkdirSync15(dirname15(destinationPath), { recursive: true });
19325
19544
  const stagingDir = createStagingDir(dirname15(destinationPath), ".plan-v2-blob-");
19326
- const temporaryPath = join40(stagingDir, "blob");
19545
+ const temporaryPath = join42(stagingDir, "blob");
19327
19546
  try {
19328
19547
  try {
19329
19548
  this.#linkFile(blob.sourcePath, temporaryPath);
@@ -19338,13 +19557,13 @@ var LocalPlanV2ArtifactPublisher = class {
19338
19557
  }
19339
19558
  async commitManifest(manifestBytes) {
19340
19559
  for (const digest of new Set(manifestDigests(manifestBytes))) {
19341
- if (!existsSync26(planV2BlobPath(this.temporaryDir, digest))) {
19560
+ if (!existsSync27(planV2BlobPath(this.temporaryDir, digest))) {
19342
19561
  throw new PlanV2IntegrityError(
19343
19562
  `cannot commit manifest before referenced blob is durable: ${digest}`
19344
19563
  );
19345
19564
  }
19346
19565
  }
19347
- writeFileSync10(join40(this.temporaryDir, "plan.json"), manifestBytes, "utf-8");
19566
+ writeFileSync10(join42(this.temporaryDir, "plan.json"), manifestBytes, "utf-8");
19348
19567
  renameWithRetry(this.temporaryDir, this.destinationDir);
19349
19568
  this.#committed = true;
19350
19569
  }
@@ -19380,21 +19599,21 @@ function readJsonFile(path, label) {
19380
19599
  }
19381
19600
  function assertSafeRelativePath(path) {
19382
19601
  const normalized = path.split(/[\\/]+/);
19383
- if (path.length === 0 || isAbsolute3(path) || normalized.some((part) => part === "" || part === "." || part === "..")) {
19602
+ if (path.length === 0 || isAbsolute4(path) || normalized.some((part) => part === "" || part === "." || part === "..")) {
19384
19603
  throw new PlanV2IntegrityError(`unsafe artifact path: ${JSON.stringify(path)}`);
19385
19604
  }
19386
19605
  }
19387
19606
  function listFiles(root) {
19388
19607
  const files = [];
19389
- const rootResolved = resolve8(root);
19608
+ const rootResolved = resolve9(root);
19390
19609
  function walk(dir) {
19391
19610
  for (const entry of readdirSync10(dir, { withFileTypes: true })) {
19392
- const absolutePath = join41(dir, entry.name);
19611
+ const absolutePath = join43(dir, entry.name);
19393
19612
  if (entry.isDirectory()) {
19394
19613
  walk(absolutePath);
19395
19614
  } else if (entry.isFile()) {
19396
19615
  files.push({
19397
- path: relative7(rootResolved, absolutePath).split(sep4).join("/"),
19616
+ path: relative8(rootResolved, absolutePath).split(sep5).join("/"),
19398
19617
  absolutePath
19399
19618
  });
19400
19619
  } else {
@@ -19408,7 +19627,7 @@ function listFiles(root) {
19408
19627
  return files.sort((a, b) => a.path.localeCompare(b.path));
19409
19628
  }
19410
19629
  function assertValidExtractionCacheCompleteSentinel(path) {
19411
- const sentinel = lstatSync3(path);
19630
+ const sentinel = lstatSync5(path);
19412
19631
  if (!sentinel.isFile() || sentinel.size !== 0) {
19413
19632
  throw new PlanV2IntegrityError(
19414
19633
  `${EXTRACTION_CACHE_COMPLETE_SENTINEL} must be a zero-byte regular file`
@@ -19416,13 +19635,13 @@ function assertValidExtractionCacheCompleteSentinel(path) {
19416
19635
  }
19417
19636
  }
19418
19637
  function validateExtractionCacheCompleteSentinels(executionPlanDir) {
19419
- const videoRoot = join41(executionPlanDir, "video-frames");
19420
- if (!existsSync27(videoRoot)) return;
19638
+ const videoRoot = join43(executionPlanDir, "video-frames");
19639
+ if (!existsSync28(videoRoot)) return;
19421
19640
  for (const videoEntry of readdirSync10(videoRoot, { withFileTypes: true })) {
19422
19641
  if (!videoEntry.isDirectory()) continue;
19423
- const videoDir = join41(videoRoot, videoEntry.name);
19642
+ const videoDir = join43(videoRoot, videoEntry.name);
19424
19643
  if (readdirSync10(videoDir).includes(EXTRACTION_CACHE_COMPLETE_SENTINEL)) {
19425
- const sentinelPath = join41(videoDir, EXTRACTION_CACHE_COMPLETE_SENTINEL);
19644
+ const sentinelPath = join43(videoDir, EXTRACTION_CACHE_COMPLETE_SENTINEL);
19426
19645
  assertValidExtractionCacheCompleteSentinel(sentinelPath);
19427
19646
  }
19428
19647
  }
@@ -19432,9 +19651,9 @@ function isExtractionCacheCompleteSentinelPath(path) {
19432
19651
  return segments.length === 3 && segments[0] === "video-frames" && segments[1] !== "" && segments[2] === EXTRACTION_CACHE_COMPLETE_SENTINEL;
19433
19652
  }
19434
19653
  function resolveExtractedVideoOutputDir(planDir, videoId) {
19435
- const videoRoot = resolve8(planDir, "video-frames");
19436
- const outputDir = resolve8(videoRoot, mediaIdPathSegment(videoId));
19437
- if (outputDir === videoRoot || !outputDir.startsWith(`${videoRoot}${sep4}`)) {
19654
+ const videoRoot = resolve9(planDir, "video-frames");
19655
+ const outputDir = resolve9(videoRoot, mediaIdPathSegment(videoId));
19656
+ if (outputDir === videoRoot || !outputDir.startsWith(`${videoRoot}${sep5}`)) {
19438
19657
  throw new PlanV2IntegrityError(`unsafe extracted video id: ${JSON.stringify(videoId)}`);
19439
19658
  }
19440
19659
  return outputDir;
@@ -19469,7 +19688,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
19469
19688
  if (video.deferredRange) {
19470
19689
  const framePaths2 = /* @__PURE__ */ new Map();
19471
19690
  for (let index = 0; index < video.totalFrames; index++) {
19472
- framePaths2.set(index, join41(outputDir, String(index)));
19691
+ framePaths2.set(index, join43(outputDir, String(index)));
19473
19692
  }
19474
19693
  return { ...video, outputDir, framePaths: framePaths2, ownedByLookup: false };
19475
19694
  }
@@ -19477,7 +19696,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
19477
19696
  const framePaths = /* @__PURE__ */ new Map();
19478
19697
  for (const frameName of frameNames) {
19479
19698
  if (frameName === EXTRACTION_CACHE_COMPLETE_SENTINEL) {
19480
- assertValidExtractionCacheCompleteSentinel(join41(outputDir, frameName));
19699
+ assertValidExtractionCacheCompleteSentinel(join43(outputDir, frameName));
19481
19700
  continue;
19482
19701
  }
19483
19702
  const match = /(\d+)(?=\.[^.]+$)/.exec(frameName);
@@ -19496,7 +19715,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
19496
19715
  `duplicate extracted frame index ${frameIndex} in ${outputDir}`
19497
19716
  );
19498
19717
  }
19499
- framePaths.set(frameIndex, join41(outputDir, frameName));
19718
+ framePaths.set(frameIndex, join43(outputDir, frameName));
19500
19719
  }
19501
19720
  return {
19502
19721
  ...video,
@@ -19517,8 +19736,8 @@ function parsePlanVideosJson2(value) {
19517
19736
  }
19518
19737
  }
19519
19738
  function materializeExtractedVideoDirectories(planDir) {
19520
- const videosPath = join41(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
19521
- if (!existsSync27(videosPath)) return;
19739
+ const videosPath = join43(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
19740
+ if (!existsSync28(videosPath)) return;
19522
19741
  const videos = parsePlanVideosJson2(readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH));
19523
19742
  for (const video of videos.extracted) {
19524
19743
  mkdirSync16(resolveExtractedVideoOutputDir(planDir, video.videoId), { recursive: true });
@@ -19551,13 +19770,13 @@ function parseChunkSlices(value) {
19551
19770
  });
19552
19771
  }
19553
19772
  function buildVideoChunkDependencies(executionPlanDir, dimensions) {
19554
- const videoRoot = join41(executionPlanDir, "video-frames");
19555
- const hasExtractedFrames = existsSync27(videoRoot) && listFiles(videoRoot).length > 0;
19556
- const videosPath = join41(executionPlanDir, PLAN_VIDEOS_META_RELATIVE_PATH);
19557
- if (!existsSync27(videosPath)) {
19773
+ const videoRoot = join43(executionPlanDir, "video-frames");
19774
+ const hasExtractedFrames = existsSync28(videoRoot) && listFiles(videoRoot).length > 0;
19775
+ const videosPath = join43(executionPlanDir, PLAN_VIDEOS_META_RELATIVE_PATH);
19776
+ if (!existsSync28(videosPath)) {
19558
19777
  return hasExtractedFrames ? { mode: "full-source-pack", dependencies: null } : { mode: "exact-rendered-frames", dependencies: /* @__PURE__ */ new Map() };
19559
19778
  }
19560
- const chunksPath = join41(executionPlanDir, "meta", "chunks.json");
19779
+ const chunksPath = join43(executionPlanDir, "meta", "chunks.json");
19561
19780
  const videos = readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH);
19562
19781
  const chunks = readJsonFile(chunksPath, "meta/chunks.json");
19563
19782
  const parsedVideos = parsePlanVideosJson2(videos);
@@ -19594,7 +19813,7 @@ function collectChunkVideoDependencies(input) {
19594
19813
  for (let frame = chunk.startFrame; frame < chunk.endFrame; frame++) {
19595
19814
  const globalTime = frame * input.fpsDen / input.fpsNum;
19596
19815
  for (const [videoId, payload] of input.table.getActiveFramePayloads(globalTime)) {
19597
- const path = input.deferredSources.get(videoId) ?? relative7(resolve8(input.executionPlanDir), payload.framePath).split(sep4).join("/");
19816
+ const path = input.deferredSources.get(videoId) ?? relative8(resolve9(input.executionPlanDir), payload.framePath).split(sep5).join("/");
19598
19817
  assertSafeRelativePath(path);
19599
19818
  const indexes = mutable.get(path) ?? /* @__PURE__ */ new Set();
19600
19819
  indexes.add(chunk.index);
@@ -19611,10 +19830,10 @@ function computeManifestHash(manifest) {
19611
19830
  return sha256Hex(`${PLAN_V2_HASH_PREFIX}${canonicalJsonStringify(manifestPayload(manifest))}`);
19612
19831
  }
19613
19832
  function writeBlob(sourcePath, destinationPath) {
19614
- if (existsSync27(destinationPath)) return;
19833
+ if (existsSync28(destinationPath)) return;
19615
19834
  mkdirSync16(dirname16(destinationPath), { recursive: true });
19616
19835
  const temporaryDir = createStagingDir(dirname16(destinationPath), ".plan-v2-blob-");
19617
- const temporaryPath = join41(temporaryDir, "blob");
19836
+ const temporaryPath = join43(temporaryDir, "blob");
19618
19837
  try {
19619
19838
  copyFileSync6(sourcePath, temporaryPath);
19620
19839
  renameWithRetry(temporaryPath, destinationPath);
@@ -19626,7 +19845,7 @@ function publishBlobFor(absolutePath, digests) {
19626
19845
  return {
19627
19846
  sourcePath: absolutePath,
19628
19847
  sha256: planFileSha256(absolutePath, digests),
19629
- sizeBytes: statSync10(absolutePath).size
19848
+ sizeBytes: statSync9(absolutePath).size
19630
19849
  };
19631
19850
  }
19632
19851
  async function putBlobs(publisher, blobs) {
@@ -19650,8 +19869,8 @@ async function putTasks(tasks) {
19650
19869
  if (failure) throw failure.reason;
19651
19870
  }
19652
19871
  function buildPlanV2Publication(executionPlanDir, digests) {
19653
- const executionPlanPath = join41(executionPlanDir, "plan.json");
19654
- if (!existsSync27(executionPlanPath)) {
19872
+ const executionPlanPath = join43(executionPlanDir, "plan.json");
19873
+ if (!existsSync28(executionPlanPath)) {
19655
19874
  throw new PlanV2IntegrityError(`execution plan is missing plan.json: ${executionPlanPath}`);
19656
19875
  }
19657
19876
  const executionPlanValue = readJsonFile(executionPlanPath, "execution plan.json");
@@ -19678,7 +19897,7 @@ function buildPlanV2Publication(executionPlanDir, digests) {
19678
19897
  }
19679
19898
  validateExtractionCacheCompleteSentinels(executionPlanDir);
19680
19899
  const videoDependencyPlan = buildVideoChunkDependencies(executionPlanDir, dimensions);
19681
- const encoder = readJsonFile(join41(executionPlanDir, "meta", "encoder.json"), "meta/encoder.json");
19900
+ const encoder = readJsonFile(join43(executionPlanDir, "meta", "encoder.json"), "meta/encoder.json");
19682
19901
  const files = listFiles(executionPlanDir);
19683
19902
  const chunkAudio = !isRecord3(encoder) || encoder.chunksCarryAudio !== true ? "none" : files.some((file) => chunkAudioSliceTarget(file.path) !== null) ? "sliced" : "whole";
19684
19903
  for (const file of files) {
@@ -19731,7 +19950,7 @@ function buildPlanV2Publication(executionPlanDir, digests) {
19731
19950
  };
19732
19951
  }
19733
19952
  function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
19734
- if (existsSync27(planV2Dir)) {
19953
+ if (existsSync28(planV2Dir)) {
19735
19954
  throw new PlanV2IntegrityError(`output directory already exists: ${planV2Dir}`);
19736
19955
  }
19737
19956
  const publication = buildPlanV2Publication(executionPlanDir);
@@ -19745,7 +19964,7 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
19745
19964
  writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
19746
19965
  }
19747
19966
  writeFileSync11(
19748
- join41(tempDir, "plan.json"),
19967
+ join43(tempDir, "plan.json"),
19749
19968
  canonicalJsonStringify(publication.manifest),
19750
19969
  "utf-8"
19751
19970
  );
@@ -19786,7 +20005,7 @@ async function publishExecutionPlan(executionPlanDir, publisher, { digests, log
19786
20005
  }
19787
20006
  }
19788
20007
  async function planV2WithPublisher(projectDir, config, publisher, options = {}) {
19789
- const stagingRoot = createStagingDir(options.stagingParentDir ?? tmpdir3(), ".execution-plan-");
20008
+ const stagingRoot = createStagingDir(options.stagingParentDir ?? tmpdir4(), ".execution-plan-");
19790
20009
  const digests = /* @__PURE__ */ new Map();
19791
20010
  try {
19792
20011
  const planned = await buildLocalExecutionPlan(projectDir, config, stagingRoot, {
@@ -19797,7 +20016,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
19797
20016
  // artifactTargets ships every compiled/ file to all chunks, so each is in the manifest.
19798
20017
  whileAudioMixes: () => putBlobs(
19799
20018
  publisher,
19800
- listFiles(join41(stagingRoot, "compiled")).map(
20019
+ listFiles(join43(stagingRoot, "compiled")).map(
19801
20020
  (file) => publishBlobFor(file.absolutePath, digests)
19802
20021
  )
19803
20022
  ),
@@ -19821,7 +20040,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
19821
20040
  }
19822
20041
  }
19823
20042
  async function planV2(projectDir, config, planV2Dir) {
19824
- if (existsSync27(planV2Dir)) {
20043
+ if (existsSync28(planV2Dir)) {
19825
20044
  throw new PlanV2IntegrityError(`output directory already exists: ${planV2Dir}`);
19826
20045
  }
19827
20046
  const publisher = new LocalPlanV2ArtifactPublisher(planV2Dir);
@@ -19838,7 +20057,7 @@ function resultFromManifest(planV2Dir, manifest) {
19838
20057
  isRecord3(executionPlan) ? executionPlan[REFERENCE_BACKGROUND_FIELD] : void 0
19839
20058
  ),
19840
20059
  planDir: planV2Dir,
19841
- manifestPath: join41(planV2Dir, "plan.json"),
20060
+ manifestPath: join43(planV2Dir, "plan.json"),
19842
20061
  planProtocol: PLAN_PROTOCOL_V2,
19843
20062
  planHash: manifest.planHash,
19844
20063
  sourcePlanV1Hash: getPlanV2ExecutionPlanHash(manifest),
@@ -19974,8 +20193,8 @@ function parsePlanV2Manifest(value) {
19974
20193
  return parsed;
19975
20194
  }
19976
20195
  function readPlanV2Manifest(planV2Dir) {
19977
- const manifestPath = join41(planV2Dir, "plan.json");
19978
- if (!existsSync27(manifestPath)) {
20196
+ const manifestPath = join43(planV2Dir, "plan.json");
20197
+ if (!existsSync28(manifestPath)) {
19979
20198
  throw new PlanV2IntegrityError(`missing v2 manifest: ${manifestPath}`);
19980
20199
  }
19981
20200
  const value = readJsonFile(manifestPath, "v2 manifest");
@@ -19994,10 +20213,10 @@ function listPlanV2ArtifactsForTarget(manifest, target) {
19994
20213
  }
19995
20214
  function verifyBlob(planV2Dir, artifact) {
19996
20215
  const sourcePath = planV2BlobPath(planV2Dir, artifact.sha256);
19997
- if (!existsSync27(sourcePath)) {
20216
+ if (!existsSync28(sourcePath)) {
19998
20217
  throw new PlanV2IntegrityError(`missing content-addressed artifact ${artifact.sha256}`);
19999
20218
  }
20000
- const stats = statSync10(sourcePath);
20219
+ const stats = statSync9(sourcePath);
20001
20220
  if (!stats.isFile() || stats.size !== artifact.sizeBytes) {
20002
20221
  throw new PlanV2IntegrityError(`artifact size mismatch for ${artifact.path}`);
20003
20222
  }
@@ -20007,7 +20226,7 @@ function verifyBlob(planV2Dir, artifact) {
20007
20226
  return sourcePath;
20008
20227
  }
20009
20228
  function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}) {
20010
- if (existsSync27(destinationDir)) {
20229
+ if (existsSync28(destinationDir)) {
20011
20230
  throw new PlanV2IntegrityError(`materialization destination already exists: ${destinationDir}`);
20012
20231
  }
20013
20232
  const manifest = readPlanV2Manifest(planV2Dir);
@@ -20023,13 +20242,13 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
20023
20242
  const tempDir = createStagingDir(dirname16(destinationDir), ".plan-v2-materialize-");
20024
20243
  try {
20025
20244
  for (const { artifact, sourcePath } of verified) {
20026
- const destinationPath = join41(tempDir, ...artifact.path.split("/"));
20245
+ const destinationPath = join43(tempDir, ...artifact.path.split("/"));
20027
20246
  mkdirSync16(dirname16(destinationPath), { recursive: true });
20028
20247
  copyFileSync6(sourcePath, destinationPath);
20029
20248
  }
20030
20249
  if (target.role === "chunk") materializeExtractedVideoDirectories(tempDir);
20031
20250
  writeFileSync11(
20032
- join41(tempDir, PLAN_V2_MATERIALIZATION_MARKER),
20251
+ join43(tempDir, PLAN_V2_MATERIALIZATION_MARKER),
20033
20252
  canonicalJsonStringify({
20034
20253
  manifest,
20035
20254
  target,
@@ -20052,7 +20271,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
20052
20271
  // Join the artifact's OWN name, not the current constant: a plan written
20053
20272
  // before the container change carries the legacy name, and materializing it
20054
20273
  // under the new one would point at a file that was never written.
20055
- audioPath: target.role === "assembler" ? audioArtifact ? join41(destinationDir, audioArtifact.path) : null : null
20274
+ audioPath: target.role === "assembler" ? audioArtifact ? join43(destinationDir, audioArtifact.path) : null : null
20056
20275
  };
20057
20276
  }
20058
20277
  function assertRemoteSources(remoteSources, artifacts) {
@@ -20071,8 +20290,8 @@ function validatePlanV2MaterializedTarget(planDir, expectedTarget) {
20071
20290
  return readValidatedPlanV2Materialization(planDir, expectedTarget)?.manifest ?? null;
20072
20291
  }
20073
20292
  function readValidatedPlanV2Materialization(planDir, expectedTarget) {
20074
- const markerPath = join41(planDir, PLAN_V2_MATERIALIZATION_MARKER);
20075
- if (!existsSync27(markerPath)) return null;
20293
+ const markerPath = join43(planDir, PLAN_V2_MATERIALIZATION_MARKER);
20294
+ if (!existsSync28(markerPath)) return null;
20076
20295
  const marker = readJsonFile(markerPath, "materialization marker");
20077
20296
  if (!isRecord3(marker) || !isRecord3(marker.manifest) || !isRecord3(marker.target)) {
20078
20297
  throw new PlanV2IntegrityError("malformed materialization marker");
@@ -20089,8 +20308,8 @@ function readValidatedPlanV2Materialization(planDir, expectedTarget) {
20089
20308
  assertRemoteSources(remoteSources, required);
20090
20309
  for (const artifact of required) {
20091
20310
  if (Object.hasOwn(remoteSources, artifact.path)) continue;
20092
- const path = join41(planDir, ...artifact.path.split("/"));
20093
- if (!existsSync27(path) || statSync10(path).size !== artifact.sizeBytes) {
20311
+ const path = join43(planDir, ...artifact.path.split("/"));
20312
+ if (!existsSync28(path) || statSync9(path).size !== artifact.sizeBytes) {
20094
20313
  throw new PlanV2IntegrityError(
20095
20314
  `materialized artifact missing or truncated: ${artifact.path}`
20096
20315
  );
@@ -20220,7 +20439,7 @@ function hashChunkOutput(outputPath, kind) {
20220
20439
  if (kind === "file") return sha256Hex(readFileSync12(outputPath));
20221
20440
  const entries = readdirSync11(outputPath).filter((name) => /\.(png|jpg|jpeg)$/i.test(name)).sort();
20222
20441
  const lines = entries.map(
20223
- (name) => `${name}\0${sha256Hex(readFileSync12(join42(outputPath, name)))}`
20442
+ (name) => `${name}\0${sha256Hex(readFileSync12(join44(outputPath, name)))}`
20224
20443
  );
20225
20444
  return sha256Hex(lines.join("\0"));
20226
20445
  }
@@ -20237,10 +20456,10 @@ function resolveLockedVp9CpuUsed(lockedEncoder) {
20237
20456
  async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
20238
20457
  const start = Date.now();
20239
20458
  const log = defaultLogger;
20240
- const planJsonPath = join42(planDir, "plan.json");
20241
- const encoderJsonPath = join42(planDir, "meta", "encoder.json");
20242
- const chunksJsonPath = join42(planDir, "meta", "chunks.json");
20243
- if (!existsSync28(planJsonPath)) {
20459
+ const planJsonPath = join44(planDir, "plan.json");
20460
+ const encoderJsonPath = join44(planDir, "meta", "encoder.json");
20461
+ const chunksJsonPath = join44(planDir, "meta", "chunks.json");
20462
+ if (!existsSync29(planJsonPath)) {
20244
20463
  throw new RenderChunkValidationError(
20245
20464
  MISSING_PLAN_ARTIFACT,
20246
20465
  `[renderChunk] planDir is missing required artifact: ${planJsonPath}`
@@ -20256,7 +20475,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
20256
20475
  const v2Manifest = v2Materialization?.manifest ?? null;
20257
20476
  const remoteSources = v2Materialization?.remoteSources ?? {};
20258
20477
  for (const required of [encoderJsonPath, chunksJsonPath]) {
20259
- if (!existsSync28(required)) {
20478
+ if (!existsSync29(required)) {
20260
20479
  throw new RenderChunkValidationError(
20261
20480
  MISSING_PLAN_ARTIFACT,
20262
20481
  `[renderChunk] planDir is missing required artifact: ${required}`
@@ -20265,9 +20484,9 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
20265
20484
  }
20266
20485
  const encoder = JSON.parse(readFileSync12(encoderJsonPath, "utf-8"));
20267
20486
  const chunks = JSON.parse(readFileSync12(chunksJsonPath, "utf-8"));
20268
- const videosJsonPath = join42(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
20487
+ const videosJsonPath = join44(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
20269
20488
  let planVideos = null;
20270
- if (existsSync28(videosJsonPath)) {
20489
+ if (existsSync29(videosJsonPath)) {
20271
20490
  try {
20272
20491
  planVideos = validatePlanVideosForChunk(JSON.parse(readFileSync12(videosJsonPath, "utf-8")));
20273
20492
  } catch (err) {
@@ -20297,8 +20516,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
20297
20516
  }
20298
20517
  const range = resolveChunkFrameRange(slice, chunkIndex, options?.frameRange);
20299
20518
  const framesInChunk = range.endFrame - range.startFrame;
20300
- const compiledDir = join42(planDir, "compiled");
20301
- if (!existsSync28(compiledDir)) {
20519
+ const compiledDir = join44(planDir, "compiled");
20520
+ if (!existsSync29(compiledDir)) {
20302
20521
  throw new RenderChunkValidationError(
20303
20522
  MISSING_PLAN_ARTIFACT,
20304
20523
  `[renderChunk] planDir missing compiled/ directory: ${compiledDir}`
@@ -20356,7 +20575,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
20356
20575
  };
20357
20576
  const workDir = `${outputChunkPath}.work.${process.pid}.${randomBytes(4).toString("hex")}`;
20358
20577
  mkdirSync17(workDir, { recursive: true });
20359
- const framesDir = join42(workDir, "captured-frames");
20578
+ const framesDir = join44(workDir, "captured-frames");
20360
20579
  mkdirSync17(framesDir, { recursive: true });
20361
20580
  const videoFramesDir = `${workDir}.video-frames`;
20362
20581
  const chunkFrameNumbers = Array.from({ length: framesInChunk }, (_, i) => range.startFrame + i);
@@ -20381,7 +20600,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
20381
20600
  dimensions: plan2.dimensions,
20382
20601
  encoder,
20383
20602
  videoCount: planVideos?.videos.length ?? 0,
20384
- html: readFileSync12(join42(compiledDir, "index.html"), "utf-8"),
20603
+ html: readFileSync12(join44(compiledDir, "index.html"), "utf-8"),
20385
20604
  // The plan ships a deferred source only to chunks that show it; don't wait on the rest.
20386
20605
  skipReadinessVideoIds: deferredVideos.filter(
20387
20606
  (video) => !shownFrames.get(video.videoId)?.size || remoteVideoIds.has(video.videoId)
@@ -20415,8 +20634,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
20415
20634
  const verifyInWorker = chunkWorkerCount > 1 && !forceScreenshotForChunk;
20416
20635
  let boxesMeasured;
20417
20636
  let boxesFailed;
20418
- const boxesReady = new Promise((resolve11, reject) => {
20419
- boxesMeasured = resolve11;
20637
+ const boxesReady = new Promise((resolve12, reject) => {
20638
+ boxesMeasured = resolve12;
20420
20639
  boxesFailed = reject;
20421
20640
  });
20422
20641
  boxesReady.catch(() => {
@@ -20550,10 +20769,10 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
20550
20769
  const effectiveBitrate = encoder.crf != null ? void 0 : encoder.bitrate;
20551
20770
  const videoOnlyPath = encoder.chunksCarryAudio ? `${outputChunkPath}.video.mp4` : outputChunkPath;
20552
20771
  if (isPngSequence) {
20553
- if (!existsSync28(outputChunkPath)) mkdirSync17(outputChunkPath, { recursive: true });
20772
+ if (!existsSync29(outputChunkPath)) mkdirSync17(outputChunkPath, { recursive: true });
20554
20773
  } else {
20555
- const outDir = join42(outputChunkPath, "..");
20556
- if (!existsSync28(outDir)) mkdirSync17(outDir, { recursive: true });
20774
+ const outDir = join44(outputChunkPath, "..");
20775
+ if (!existsSync29(outDir)) mkdirSync17(outDir, { recursive: true });
20557
20776
  }
20558
20777
  const encodeInput = {
20559
20778
  job,
@@ -20829,10 +21048,10 @@ async function renderSpan(projectDir, config, span, outputPath, options = {}) {
20829
21048
  if (config.cfr === true) {
20830
21049
  throw new RenderSpanUnsupportedError("--start/--end cannot be combined with a cfr re-encode.");
20831
21050
  }
20832
- const workDir = mkdtempSync(join43(tmpdir4(), "hf-render-span-"));
21051
+ const workDir = mkdtempSync(join45(tmpdir5(), "hf-render-span-"));
20833
21052
  try {
20834
- const planDir = join43(workDir, "plan");
20835
- const partsDir = join43(workDir, "parts");
21053
+ const planDir = join45(workDir, "plan");
21054
+ const partsDir = join45(workDir, "parts");
20836
21055
  mkdirSync18(partsDir, { recursive: true });
20837
21056
  const planned = await plan(
20838
21057
  projectDir,
@@ -20851,7 +21070,7 @@ async function renderSpan(projectDir, config, span, outputPath, options = {}) {
20851
21070
  planned.totalFrames
20852
21071
  );
20853
21072
  const slices = JSON.parse(
20854
- readFileSync13(join43(planDir, "meta", "chunks.json"), "utf-8")
21073
+ readFileSync13(join45(planDir, "meta", "chunks.json"), "utf-8")
20855
21074
  );
20856
21075
  const parts = [];
20857
21076
  for (const slice of slices) {
@@ -20861,7 +21080,7 @@ async function renderSpan(projectDir, config, span, outputPath, options = {}) {
20861
21080
  };
20862
21081
  if (range.endFrame <= range.startFrame) continue;
20863
21082
  throwIfAborted(config.abortSignal);
20864
- const part = join43(partsDir, `part-${String(parts.length).padStart(4, "0")}.mp4`);
21083
+ const part = join45(partsDir, `part-${String(parts.length).padStart(4, "0")}.mp4`);
20865
21084
  await renderChunk(planDir, slice.index, part, { frameRange: range });
20866
21085
  parts.push(part);
20867
21086
  }
@@ -21476,16 +21695,16 @@ function renderRequestFromDistributedConfig(input) {
21476
21695
 
21477
21696
  // ../producer/src/server.ts
21478
21697
  import {
21479
- existsSync as existsSync31,
21698
+ existsSync as existsSync32,
21480
21699
  mkdirSync as mkdirSync19,
21481
- statSync as statSync12,
21700
+ statSync as statSync11,
21482
21701
  mkdtempSync as mkdtempSync2,
21483
21702
  writeFileSync as writeFileSync13,
21484
21703
  rmSync as rmSync17,
21485
- createReadStream as createReadStream5
21704
+ createReadStream as createReadStream6
21486
21705
  } from "fs";
21487
- import { resolve as resolve10, dirname as dirname19, join as join46 } from "path";
21488
- import { tmpdir as tmpdir5 } from "os";
21706
+ import { resolve as resolve11, dirname as dirname19, join as join48 } from "path";
21707
+ import { tmpdir as tmpdir6 } from "os";
21489
21708
  import { parseArgs } from "util";
21490
21709
  import { isIP } from "net";
21491
21710
  import crypto from "crypto";
@@ -21495,15 +21714,15 @@ import { serve as serve2 } from "@hono/node-server";
21495
21714
 
21496
21715
  // ../producer/src/services/hyperframeLint.ts
21497
21716
  import {
21498
- existsSync as existsSync29,
21717
+ existsSync as existsSync30,
21499
21718
  readFileSync as readFileSync14,
21500
- statSync as statSync11,
21719
+ statSync as statSync10,
21501
21720
  openSync as openSync6,
21502
21721
  fstatSync as fstatSync3,
21503
21722
  closeSync as closeSync6,
21504
21723
  constants as constants3
21505
21724
  } from "fs";
21506
- import { resolve as resolve9, join as join44, relative as relative8, isAbsolute as isAbsolute4, sep as sep5, dirname as dirname17 } from "path";
21725
+ import { resolve as resolve10, join as join46, relative as relative9, isAbsolute as isAbsolute5, sep as sep6, dirname as dirname17 } from "path";
21507
21726
  import { fileURLToPath as fileURLToPath5 } from "url";
21508
21727
  import { Worker as Worker2 } from "worker_threads";
21509
21728
  function isStringRecord(value) {
@@ -21538,7 +21757,7 @@ function readEntryHtml(filePath) {
21538
21757
  } catch (error) {
21539
21758
  if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
21540
21759
  return null;
21541
- if (!statSync11(filePath, { throwIfNoEntry: false })?.isFile()) return null;
21760
+ if (!statSync10(filePath, { throwIfNoEntry: false })?.isFile()) return null;
21542
21761
  throw error;
21543
21762
  }
21544
21763
  try {
@@ -21549,19 +21768,19 @@ function readEntryHtml(filePath) {
21549
21768
  }
21550
21769
  }
21551
21770
  function leavesProject(absProjectDir, absoluteEntryPath, isAllowedEntry) {
21552
- const entryRelativePath = relative8(absProjectDir, absoluteEntryPath);
21553
- return entryRelativePath === ".." || entryRelativePath.startsWith(`..${sep5}`) || isAbsolute4(entryRelativePath) || isAllowedEntry !== void 0 && !isAllowedEntry(absoluteEntryPath);
21771
+ const entryRelativePath = relative9(absProjectDir, absoluteEntryPath);
21772
+ return entryRelativePath === ".." || entryRelativePath.startsWith(`..${sep6}`) || isAbsolute5(entryRelativePath) || isAllowedEntry !== void 0 && !isAllowedEntry(absoluteEntryPath);
21554
21773
  }
21555
21774
  function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
21556
- const absProjectDir = resolve9(projectDir);
21557
- if (!existsSync29(absProjectDir) || !statSync11(absProjectDir).isDirectory()) {
21775
+ const absProjectDir = resolve10(projectDir);
21776
+ if (!existsSync30(absProjectDir) || !statSync10(absProjectDir).isDirectory()) {
21558
21777
  return { error: `Project directory not found: ${absProjectDir}` };
21559
21778
  }
21560
21779
  const entryCandidates = [preferredEntryFile, "index.html", "src/index.html"].filter(
21561
21780
  (value) => typeof value === "string" && value.trim().length > 0
21562
21781
  );
21563
21782
  for (const entryFile of entryCandidates) {
21564
- const absoluteEntryPath = resolve9(absProjectDir, entryFile);
21783
+ const absoluteEntryPath = resolve10(absProjectDir, entryFile);
21565
21784
  if (leavesProject(absProjectDir, absoluteEntryPath, isAllowedEntry)) {
21566
21785
  return { error: `Entry file must stay inside project directory: ${entryFile}` };
21567
21786
  }
@@ -21575,7 +21794,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
21575
21794
  }
21576
21795
  }
21577
21796
  return {
21578
- error: `No HTML entry file found in project directory: ${join44(absProjectDir, preferredEntryFile || "index.html")}`
21797
+ error: `No HTML entry file found in project directory: ${join46(absProjectDir, preferredEntryFile || "index.html")}`
21579
21798
  };
21580
21799
  }
21581
21800
  function prepareHyperframeLintBody(body, isAllowedEntry) {
@@ -21621,16 +21840,16 @@ function takeLintSlot(limit, waitMs) {
21621
21840
  running++;
21622
21841
  return Promise.resolve(true);
21623
21842
  }
21624
- return new Promise((resolve11) => {
21843
+ return new Promise((resolve12) => {
21625
21844
  const entry = () => {
21626
21845
  clearTimeout(timer);
21627
21846
  running++;
21628
- resolve11(true);
21847
+ resolve12(true);
21629
21848
  };
21630
21849
  const timer = setTimeout(
21631
21850
  () => {
21632
21851
  waiting.splice(waiting.indexOf(entry), 1);
21633
- resolve11(false);
21852
+ resolve12(false);
21634
21853
  },
21635
21854
  Math.max(0, waitMs)
21636
21855
  );
@@ -21644,8 +21863,8 @@ function freeLintSlot() {
21644
21863
  function resolveLintWorkerEntry() {
21645
21864
  const here = dirname17(fileURLToPath5(import.meta.url));
21646
21865
  for (const name of ["hyperframeLintWorker.js", "hyperframeLintWorker.ts"]) {
21647
- const candidate = join44(here, name);
21648
- if (existsSync29(candidate)) return candidate;
21866
+ const candidate = join46(here, name);
21867
+ if (existsSync30(candidate)) return candidate;
21649
21868
  }
21650
21869
  return void 0;
21651
21870
  }
@@ -21715,8 +21934,8 @@ async function runHyperframeLint(prepared, options = {}) {
21715
21934
  // ../producer/src/services/healthWorker.ts
21716
21935
  import { Worker as Worker3 } from "worker_threads";
21717
21936
  import { fileURLToPath as fileURLToPath6 } from "url";
21718
- import { dirname as dirname18, join as join45 } from "path";
21719
- import { existsSync as existsSync30 } from "fs";
21937
+ import { dirname as dirname18, join as join47 } from "path";
21938
+ import { existsSync as existsSync31 } from "fs";
21720
21939
  var DEFAULT_HEALTH_PORT = 9848;
21721
21940
  async function startHealthWorker(options = {}) {
21722
21941
  const log = options.logger ?? defaultLogger2();
@@ -21734,12 +21953,12 @@ async function startHealthWorker(options = {}) {
21734
21953
  stdout: false,
21735
21954
  stderr: false
21736
21955
  });
21737
- await new Promise((resolve11, reject) => {
21956
+ await new Promise((resolve12, reject) => {
21738
21957
  const onMessage = (msg) => {
21739
21958
  if (msg?.type === "listening") {
21740
21959
  worker.off("error", onError);
21741
21960
  worker.off("message", onMessage);
21742
- resolve11();
21961
+ resolve12();
21743
21962
  } else if (msg?.type === "listen-error") {
21744
21963
  worker.off("error", onError);
21745
21964
  worker.off("message", onMessage);
@@ -21791,9 +22010,9 @@ function defaultLogger2() {
21791
22010
  }
21792
22011
  function resolveWorkerEntry2() {
21793
22012
  const here = dirname18(fileURLToPath6(import.meta.url));
21794
- const candidates = [join45(here, "healthWorkerThread.js"), join45(here, "healthWorkerThread.ts")];
22013
+ const candidates = [join47(here, "healthWorkerThread.js"), join47(here, "healthWorkerThread.ts")];
21795
22014
  for (const candidate of candidates) {
21796
- if (existsSync30(candidate)) return candidate;
22015
+ if (existsSync31(candidate)) return candidate;
21797
22016
  }
21798
22017
  return void 0;
21799
22018
  }
@@ -21957,7 +22176,7 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
21957
22176
  }
21958
22177
  }
21959
22178
  const outputDir = dirname19(absoluteOutputPath);
21960
- if (!existsSync31(outputDir)) mkdirSync19(outputDir, { recursive: true });
22179
+ if (!existsSync32(outputDir)) mkdirSync19(outputDir, { recursive: true });
21961
22180
  return { input, cleanupProjectDir, absoluteOutputPath };
21962
22181
  }
21963
22182
  function prepareRenderJob(prepared, rendersDir, log, confineOutput) {
@@ -22018,7 +22237,7 @@ function validateOutputResolutionOverride(body) {
22018
22237
  var MAX_PREVIEW_HTML_BYTES = 20 * 1024 * 1024;
22019
22238
  function resolveRenderRequestPolicy(options) {
22020
22239
  return {
22021
- projectsDir: resolve10(
22240
+ projectsDir: resolve11(
22022
22241
  options.projectsDir ?? (process.env.PRODUCER_PROJECTS_DIR || process.cwd())
22023
22242
  ),
22024
22243
  allowDebug: options.allowDebug ?? process.env.PRODUCER_ALLOW_DEBUG === "1"
@@ -22033,14 +22252,14 @@ function isAllowedEntryPath(policy, projectDir, path) {
22033
22252
  function prepareProjectDirectory(projectDir, options, policy) {
22034
22253
  const candidate = nonEmptyString(projectDir);
22035
22254
  if (!candidate) return null;
22036
- const absProjectDir = policy ? resolve10(policy.projectsDir, candidate) : resolve10(candidate);
22255
+ const absProjectDir = policy ? resolve11(policy.projectsDir, candidate) : resolve11(candidate);
22037
22256
  const shown = policy ? candidate : absProjectDir;
22038
- if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !existsSync31(absProjectDir) || !statSync12(absProjectDir).isDirectory()) {
22257
+ if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !existsSync32(absProjectDir) || !statSync11(absProjectDir).isDirectory()) {
22039
22258
  return { error: `Project directory not found: ${shown}` };
22040
22259
  }
22041
22260
  const entry = options.entryFile || "index.html";
22042
- const entryPath = resolve10(absProjectDir, entry);
22043
- if (policy && !isAllowedEntryPath(policy, absProjectDir, entryPath) || !existsSync31(entryPath)) {
22261
+ const entryPath = resolve11(absProjectDir, entry);
22262
+ if (policy && !isAllowedEntryPath(policy, absProjectDir, entryPath) || !existsSync32(entryPath)) {
22044
22263
  return { error: `Entry file "${entry}" not found in project directory: ${shown}` };
22045
22264
  }
22046
22265
  return { prepared: { input: { projectDir: absProjectDir, ...options } } };
@@ -22060,9 +22279,9 @@ async function resolveInlineRenderHtml(body) {
22060
22279
  }
22061
22280
  }
22062
22281
  function materializeInlineProject(html, options) {
22063
- const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR || tmpdir5();
22064
- const tempProjectDir = mkdtempSync2(join46(tempRoot, "producer-project-"));
22065
- writeFileSync13(join46(tempProjectDir, "index.html"), html, "utf-8");
22282
+ const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR || tmpdir6();
22283
+ const tempProjectDir = mkdtempSync2(join48(tempRoot, "producer-project-"));
22284
+ writeFileSync13(join48(tempProjectDir, "index.html"), html, "utf-8");
22066
22285
  return {
22067
22286
  prepared: {
22068
22287
  input: { projectDir: tempProjectDir, ...options },
@@ -22090,7 +22309,7 @@ function resolveOutputPath(projectDir, outputCandidate, rendersDir, log) {
22090
22309
  try {
22091
22310
  return resolveRenderPaths(projectDir, outputCandidate, rendersDir).absoluteOutputPath;
22092
22311
  } catch (error) {
22093
- const fallbackPath = resolve10(rendersDir, `producer-fallback-${Date.now()}.mp4`);
22312
+ const fallbackPath = resolve11(rendersDir, `producer-fallback-${Date.now()}.mp4`);
22094
22313
  log.warn("Failed to resolve output path, using fallback", {
22095
22314
  fallback: fallbackPath,
22096
22315
  error: error instanceof Error ? error.message : String(error)
@@ -22138,7 +22357,7 @@ function publicPerfSummary(job) {
22138
22357
  return job.perfSummary ? { ...job.perfSummary, renderId: void 0 } : null;
22139
22358
  }
22140
22359
  function outputFileSize(path) {
22141
- return existsSync31(path) ? statSync12(path).size : 0;
22360
+ return existsSync32(path) ? statSync11(path).size : 0;
22142
22361
  }
22143
22362
  function createBlockingProgressReporter(log, requestId) {
22144
22363
  let lastLoggedPct = -10;
@@ -22258,7 +22477,7 @@ function createRenderHandlers(options = {}) {
22258
22477
  const lintProjectDir = nonEmptyString(body.projectDir);
22259
22478
  let isAllowedEntry;
22260
22479
  if (policy && lintProjectDir) {
22261
- const absProjectDir = resolve10(policy.projectsDir, lintProjectDir);
22480
+ const absProjectDir = resolve11(policy.projectsDir, lintProjectDir);
22262
22481
  if (!isAllowedProjectPath(policy.projectsDir, absProjectDir)) {
22263
22482
  const error = `Project directory not found: ${lintProjectDir}`;
22264
22483
  return c.json({ success: false, requestId, error }, 400);
@@ -22465,12 +22684,12 @@ function createRenderHandlers(options = {}) {
22465
22684
  if (!artifact) {
22466
22685
  return c.json({ success: false, error: "Output artifact not found or expired" }, 404);
22467
22686
  }
22468
- if (!existsSync31(artifact.path)) {
22687
+ if (!existsSync32(artifact.path)) {
22469
22688
  store.delete(token);
22470
22689
  return c.json({ success: false, error: "Output artifact file missing" }, 404);
22471
22690
  }
22472
- const stats = statSync12(artifact.path);
22473
- return new Response(createReadStream5(artifact.path), {
22691
+ const stats = statSync11(artifact.path);
22692
+ return new Response(createReadStream6(artifact.path), {
22474
22693
  headers: {
22475
22694
  "content-type": "video/mp4",
22476
22695
  "content-length": String(stats.size),
@@ -22606,7 +22825,7 @@ function startServer(options = {}) {
22606
22825
  });
22607
22826
  async function shutdown(signal) {
22608
22827
  log.info(`Received ${signal}, shutting down`);
22609
- const { drainBrowserPool } = await import("./src-FCITTGFH.js");
22828
+ const { drainBrowserPool } = await import("./src-WKQLHMUG.js");
22610
22829
  await drainBrowserPool().catch(() => {
22611
22830
  });
22612
22831
  const handle = await Promise.race([
@@ -22630,7 +22849,7 @@ function startServer(options = {}) {
22630
22849
  process.on("SIGINT", () => shutdown("SIGINT"));
22631
22850
  return server;
22632
22851
  }
22633
- var entryScript = process.argv[1] ? resolve10(process.argv[1]) : "";
22852
+ var entryScript = process.argv[1] ? resolve11(process.argv[1]) : "";
22634
22853
  var isPublicServerEntry = entryScript.endsWith("/public-server.js") || entryScript.endsWith("/src/server.ts");
22635
22854
  if (isPublicServerEntry) {
22636
22855
  const { values } = parseArgs({
@@ -22643,21 +22862,21 @@ if (isPublicServerEntry) {
22643
22862
 
22644
22863
  // ../producer/src/services/distributed/planV2Execution.ts
22645
22864
  import { mkdtempSync as mkdtempSync3, rmSync as rmSync19 } from "fs";
22646
- import { tmpdir as tmpdir6 } from "os";
22647
- import { join as join48 } from "path";
22865
+ import { tmpdir as tmpdir7 } from "os";
22866
+ import { join as join50 } from "path";
22648
22867
 
22649
22868
  // ../producer/src/services/distributed/assemble.ts
22650
22869
  import {
22651
22870
  cpSync as cpSync3,
22652
- existsSync as existsSync32,
22871
+ existsSync as existsSync33,
22653
22872
  mkdirSync as mkdirSync20,
22654
22873
  readFileSync as readFileSync15,
22655
22874
  readdirSync as readdirSync12,
22656
22875
  rmSync as rmSync18,
22657
- statSync as statSync13,
22876
+ statSync as statSync12,
22658
22877
  writeFileSync as writeFileSync14
22659
22878
  } from "fs";
22660
- import { basename as basename7, dirname as dirname20, join as join47 } from "path";
22879
+ import { basename as basename8, dirname as dirname20, join as join49 } from "path";
22661
22880
  function cfrRateControlArgs(locked) {
22662
22881
  const preset = getEncoderPreset(locked.quality ?? "standard", "mp4");
22663
22882
  if (locked.crf == null && locked.bitrate) {
@@ -22685,15 +22904,15 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
22685
22904
  outputPath,
22686
22905
  durationMs: Date.now() - start,
22687
22906
  framesEncoded: plan2.totalFrames,
22688
- fileSize: statSync13(outputPath).size
22907
+ fileSize: statSync12(outputPath).size
22689
22908
  };
22690
22909
  }
22691
22910
  const format = plan2.dimensions.format;
22692
22911
  const cfrEncoder = cfr ? readCfrEncoder(planDir, format) : null;
22693
- if (!existsSync32(dirname20(outputPath))) {
22912
+ if (!existsSync33(dirname20(outputPath))) {
22694
22913
  mkdirSync20(dirname20(outputPath), { recursive: true });
22695
22914
  }
22696
- const workDir = createStagingDir(dirname20(outputPath), `${basename7(outputPath)}.assemble-work-`);
22915
+ const workDir = createStagingDir(dirname20(outputPath), `${basename8(outputPath)}.assemble-work-`);
22697
22916
  const fps = { num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen };
22698
22917
  const stageMs = {};
22699
22918
  const ctx = {
@@ -22713,8 +22932,8 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
22713
22932
  };
22714
22933
  try {
22715
22934
  const videoSources = cfrEncoder ? [await reencodeCfr(ctx, chunkPaths, cfrEncoder)] : chunkPaths;
22716
- const finalPath = join47(workDir, `output.${format}`);
22717
- const audio = audioPath !== null && existsSync32(audioPath) ? audioPath : null;
22935
+ const finalPath = join49(workDir, `output.${format}`);
22936
+ const audio = audioPath !== null && existsSync33(audioPath) ? audioPath : null;
22718
22937
  await writeJoined(ctx, videoSources, audio, finalPath);
22719
22938
  renameWithRetry(finalPath, outputPath);
22720
22939
  log.info("[assemble] stage timings", {
@@ -22732,7 +22951,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
22732
22951
  });
22733
22952
  }
22734
22953
  }
22735
- const fileSize = existsSync32(outputPath) ? statSync13(outputPath).size : 0;
22954
+ const fileSize = existsSync33(outputPath) ? statSync12(outputPath).size : 0;
22736
22955
  return {
22737
22956
  ...referenceBackgroundResult(plan2[REFERENCE_BACKGROUND_FIELD]),
22738
22957
  outputPath,
@@ -22742,15 +22961,15 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
22742
22961
  };
22743
22962
  }
22744
22963
  function readAssemblePlan(planDir, chunkPaths) {
22745
- const planJsonPath = join47(planDir, "plan.json");
22746
- const chunksJsonPath = join47(planDir, "meta", "chunks.json");
22747
- if (!existsSync32(planJsonPath)) {
22964
+ const planJsonPath = join49(planDir, "plan.json");
22965
+ const chunksJsonPath = join49(planDir, "meta", "chunks.json");
22966
+ if (!existsSync33(planJsonPath)) {
22748
22967
  throw new Error(`[assemble] planDir missing plan.json: ${planJsonPath}`);
22749
22968
  }
22750
22969
  const plan2 = JSON.parse(readFileSync15(planJsonPath, "utf-8"));
22751
22970
  readPlanProtocolV1(plan2, DISTRIBUTED_RENDER_CAPABILITIES.roles.assembler);
22752
22971
  validatePlanV2MaterializedTarget(planDir, { role: "assembler" });
22753
- if (!existsSync32(chunksJsonPath)) {
22972
+ if (!existsSync33(chunksJsonPath)) {
22754
22973
  throw new Error(`[assemble] planDir missing meta/chunks.json: ${chunksJsonPath}`);
22755
22974
  }
22756
22975
  const chunks = JSON.parse(readFileSync15(chunksJsonPath, "utf-8"));
@@ -22765,7 +22984,7 @@ function readAssemblePlan(planDir, chunkPaths) {
22765
22984
  }
22766
22985
  }
22767
22986
  for (const path of chunkPaths.flat()) {
22768
- if (!existsSync32(path)) {
22987
+ if (!existsSync33(path)) {
22769
22988
  throw new Error(`[assemble] chunk path does not exist: ${path}`);
22770
22989
  }
22771
22990
  }
@@ -22794,7 +23013,7 @@ function cfrEncodeArgs(inputArgs, encoder, fpsArg) {
22794
23013
  return args;
22795
23014
  }
22796
23015
  async function reencodeCfr(ctx, chunkPaths, encoder) {
22797
- const cfrOutputPath = join47(ctx.workDir, `cfr.${ctx.format}`);
23016
+ const cfrOutputPath = join49(ctx.workDir, `cfr.${ctx.format}`);
22798
23017
  const cfrArgs = cfrEncodeArgs(videoInputArgs(ctx, chunkPaths), encoder, ctx.fpsArg);
22799
23018
  appendRenderProvenanceArgs(cfrArgs, cfrOutputPath);
22800
23019
  cfrArgs.push("-y", cfrOutputPath);
@@ -22821,7 +23040,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
22821
23040
  );
22822
23041
  return;
22823
23042
  }
22824
- const paddedAudioPath = join47(ctx.workDir, "audio-padded.m4a");
23043
+ const paddedAudioPath = join49(ctx.workDir, "audio-padded.m4a");
22825
23044
  const padTrimResult = await ctx.timed(
22826
23045
  "audioMs",
22827
23046
  () => padOrTrimAudioToVideoFrameCount({
@@ -22861,11 +23080,11 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
22861
23080
  }
22862
23081
  }
22863
23082
  function concatDemuxerInput(chunkPaths, workDir, fpsArg) {
22864
- const listPath = join47(workDir, "concat-list.txt");
23083
+ const listPath = join49(workDir, "concat-list.txt");
22865
23084
  const body = chunkPaths.map((path) => `file '${path.replace(/'/g, "'\\''")}'`).join("\n");
22866
23085
  writeFileSync14(listPath, `${body}
22867
23086
  `, "utf-8");
22868
- return ["-r", fpsArg, "-f", "concat", "-safe", "0", "-i", listPath];
23087
+ return ["-r", fpsArg, ...concatListInputArgs(listPath)];
22869
23088
  }
22870
23089
  async function probeJoinedFrameInfo(videoPaths, fps, signal) {
22871
23090
  const infos = await Promise.all(
@@ -22899,12 +23118,12 @@ function stitchesSeparateAudio(planDir) {
22899
23118
  return lockedAudio(planDir).separateAudio === true;
22900
23119
  }
22901
23120
  function planFormat(planDir) {
22902
- const plan2 = JSON.parse(readFileSync15(join47(planDir, "plan.json"), "utf-8"));
23121
+ const plan2 = JSON.parse(readFileSync15(join49(planDir, "plan.json"), "utf-8"));
22903
23122
  return plan2.dimensions.format;
22904
23123
  }
22905
23124
  function lockedAudio(planDir) {
22906
- const encoderJsonPath = join47(planDir, "meta", "encoder.json");
22907
- if (!existsSync32(encoderJsonPath)) return {};
23125
+ const encoderJsonPath = join49(planDir, "meta", "encoder.json");
23126
+ if (!existsSync33(encoderJsonPath)) return {};
22908
23127
  return JSON.parse(readFileSync15(encoderJsonPath, "utf-8"));
22909
23128
  }
22910
23129
  function readCfrEncoder(planDir, format) {
@@ -22913,8 +23132,8 @@ function readCfrEncoder(planDir, format) {
22913
23132
  `[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.`
22914
23133
  );
22915
23134
  }
22916
- const encoderJsonPath = join47(planDir, "meta", "encoder.json");
22917
- if (!existsSync32(encoderJsonPath)) {
23135
+ const encoderJsonPath = join49(planDir, "meta", "encoder.json");
23136
+ if (!existsSync33(encoderJsonPath)) {
22918
23137
  throw new Error(`[assemble] planDir missing meta/encoder.json: ${encoderJsonPath}`);
22919
23138
  }
22920
23139
  const encoderJson = JSON.parse(readFileSync15(encoderJsonPath, "utf-8"));
@@ -22926,11 +23145,11 @@ function readCfrEncoder(planDir, format) {
22926
23145
  return encoderJson;
22927
23146
  }
22928
23147
  function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, startTimeMs) {
22929
- if (existsSync32(outputPath)) rmSync18(outputPath, { recursive: true, force: true });
23148
+ if (existsSync33(outputPath)) rmSync18(outputPath, { recursive: true, force: true });
22930
23149
  mkdirSync20(outputPath, { recursive: true });
22931
23150
  let globalIdx = 0;
22932
23151
  for (const chunkDir of chunkPaths) {
22933
- if (!statSync13(chunkDir).isDirectory()) {
23152
+ if (!statSync12(chunkDir).isDirectory()) {
22934
23153
  throw new Error(
22935
23154
  `[assemble] png-sequence chunk must be a directory: ${chunkDir} (got a file)`
22936
23155
  );
@@ -22940,8 +23159,8 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
22940
23159
  throw new Error(`[assemble] png-sequence chunk has no frames: ${chunkDir}`);
22941
23160
  }
22942
23161
  for (const frame of frames) {
22943
- const dst = join47(outputPath, formatExportFrameName(globalIdx, "png"));
22944
- cpSync3(join47(chunkDir, frame), dst);
23162
+ const dst = join49(outputPath, formatExportFrameName(globalIdx, "png"));
23163
+ cpSync3(join49(chunkDir, frame), dst);
22945
23164
  globalIdx += 1;
22946
23165
  }
22947
23166
  }
@@ -22950,14 +23169,14 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
22950
23169
  `[assemble] png-sequence frame count mismatch: merged ${globalIdx} frames vs plan.totalFrames=${totalFrames}. Using on-disk count.`
22951
23170
  );
22952
23171
  }
22953
- if (audioPath !== null && existsSync32(audioPath)) {
22954
- const sidecar = join47(outputPath, MIXED_AUDIO_FILENAME);
23172
+ if (audioPath !== null && existsSync33(audioPath)) {
23173
+ const sidecar = join49(outputPath, MIXED_AUDIO_FILENAME);
22955
23174
  cpSync3(audioPath, sidecar);
22956
23175
  }
22957
23176
  let fileSize = 0;
22958
23177
  for (const name of readdirSync12(outputPath)) {
22959
23178
  try {
22960
- fileSize += statSync13(join47(outputPath, name)).size;
23179
+ fileSize += statSync12(join49(outputPath, name)).size;
22961
23180
  } catch {
22962
23181
  }
22963
23182
  }
@@ -22971,8 +23190,8 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
22971
23190
 
22972
23191
  // ../producer/src/services/distributed/planV2Execution.ts
22973
23192
  async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
22974
- const workRoot = mkdtempSync3(join48(tmpdir6(), "hf-plan-v2-chunk-"));
22975
- const materializedPlanDir = join48(workRoot, "plan");
23193
+ const workRoot = mkdtempSync3(join50(tmpdir7(), "hf-plan-v2-chunk-"));
23194
+ const materializedPlanDir = join50(workRoot, "plan");
22976
23195
  try {
22977
23196
  materializePlanV2Target(planV2Dir, { role: "chunk", chunkIndex }, materializedPlanDir);
22978
23197
  return await renderChunk(materializedPlanDir, chunkIndex, outputChunkPath, options);
@@ -22981,8 +23200,8 @@ async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
22981
23200
  }
22982
23201
  }
22983
23202
  async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
22984
- const workRoot = mkdtempSync3(join48(tmpdir6(), "hf-plan-v2-assembler-"));
22985
- const materializedPlanDir = join48(workRoot, "plan");
23203
+ const workRoot = mkdtempSync3(join50(tmpdir7(), "hf-plan-v2-assembler-"));
23204
+ const materializedPlanDir = join50(workRoot, "plan");
22986
23205
  try {
22987
23206
  const materialized = materializePlanV2Target(
22988
23207
  planV2Dir,
@@ -23002,9 +23221,9 @@ async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
23002
23221
  }
23003
23222
 
23004
23223
  // ../producer/src/services/distributed/projectHash.ts
23005
- import { closeSync as closeSync7, openSync as openSync7, readdirSync as readdirSync13, readSync as readSync5, realpathSync as realpathSync2, statSync as statSync14 } from "fs";
23224
+ import { closeSync as closeSync7, openSync as openSync7, readdirSync as readdirSync13, readSync as readSync5, realpathSync as realpathSync2, statSync as statSync13 } from "fs";
23006
23225
  import { createHash as createHash8 } from "crypto";
23007
- import { join as join49, sep as sep6 } from "path";
23226
+ import { join as join51, sep as sep7 } from "path";
23008
23227
  var READ_CHUNK_BYTES = 256 * 1024;
23009
23228
 
23010
23229
  // ../producer/src/services/distributed/audioSidecar.ts
@@ -23020,6 +23239,7 @@ export {
23020
23239
  defaultLogger,
23021
23240
  createFileServer,
23022
23241
  normalizeErrorMessage,
23242
+ missingPathOf,
23023
23243
  RENDER_JOB_DIR,
23024
23244
  createOwnedRenderDir,
23025
23245
  listAbandonedRenderDirs,