hyperframes 0.8.205 → 0.8.207

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 (221) hide show
  1. package/bin/hyperframes.mjs +1 -0
  2. package/dist/{add-BA4AU262.js → add-LXFWHBE3.js} +19 -18
  3. package/dist/{agentPromptGenerator-KYO5MKTW.js → agentPromptGenerator-D2E62ZP5.js} +1 -1
  4. package/dist/{animatedGifPrep-UNUCFGLQ.js → animatedGifPrep-VBPJZKFT.js} +21 -15
  5. package/dist/api.js +31 -31
  6. package/dist/{appHistory-QVCSAOI4.js → appHistory-HIBH6XZW.js} +3 -1
  7. package/dist/{asset-KCDVTNC3.js → asset-JX4RW3GO.js} +2 -2
  8. package/dist/{assetCataloger-5FCVQ3N6.js → assetCataloger-JKKOPBCF.js} +15 -14
  9. package/dist/{audio-KDBPEHRS.js → audio-OXQ3L6DW.js} +24 -24
  10. package/dist/{auth-IMPBZZXJ.js → auth-JAL7P7ZA.js} +1 -1
  11. package/dist/{autoUpdate-YE2RKCAG.js → autoUpdate-MRI2AICE.js} +2 -2
  12. package/dist/{backgroundChecks-OWY2UFSR.js → backgroundChecks-ORR46PBY.js} +3 -3
  13. package/dist/backgroundChecksWorker.js +3 -3
  14. package/dist/{batchRender-AN4HWKET.js → batchRender-IFZYPGIW.js} +9 -9
  15. package/dist/{beats-VTQJ4JH6.js → beats-UDLOEW6U.js} +21 -21
  16. package/dist/{benchmark-PBEWHJ5K.js → benchmark-VTVDNKSO.js} +14 -14
  17. package/dist/{browser-E7ANEHNU.js → browser-QJC4BL2Y.js} +6 -6
  18. package/dist/{bundleWithLocalizedFonts-I3BWMRSP.js → bundleWithLocalizedFonts-Z2JTBNDS.js} +2 -2
  19. package/dist/{capture-MP7R72WU.js → capture-2P4JERSX.js} +14 -3
  20. package/dist/{capture-XODFC4S4.js → capture-GLM2ACPM.js} +81 -41
  21. package/dist/{captureCompositionFrame-2OYGVDI3.js → captureCompositionFrame-A2A5MGQB.js} +19 -19
  22. package/dist/{captureFile-LYOJOUIE.js → captureFile-RPUEOZO6.js} +1 -1
  23. package/dist/{catalog-ORVCCEQR.js → catalog-5ZLVUQVJ.js} +25 -24
  24. package/dist/{catch-up-SYAQOXTT.js → catch-up-FRMVYJHZ.js} +5 -5
  25. package/dist/{check-6SQR6SSA.js → check-WVY7SM7C.js} +50 -48
  26. package/dist/checkAudio-PLEQY3SZ.js +201 -0
  27. package/dist/{checkBrowser-HOTD3CDE.js → checkBrowser-XSZUA2DQ.js} +42 -41
  28. package/dist/{chunk-JFNB4CMI.js → chunk-526VSRZ4.js} +20 -8
  29. package/dist/{chunk-DQBY7FRR.js → chunk-543U46OR.js} +4 -1
  30. package/dist/{chunk-CUGADCIV.js → chunk-5KBMYSF2.js} +54 -15
  31. package/dist/{chunk-2ST4WAFY.js → chunk-5PCALX6G.js} +13 -1
  32. package/dist/{chunk-TZ7MTRVJ.js → chunk-5PYRU5DT.js} +13 -13
  33. package/dist/{chunk-AYH5ANVS.js → chunk-5YHQBCWH.js} +52 -3
  34. package/dist/{chunk-KBZSMKKD.js → chunk-63DP5CB2.js} +29 -3
  35. package/dist/{chunk-GLBEBBS2.js → chunk-6IYIS2U7.js} +2 -2
  36. package/dist/{chunk-GSTFETKE.js → chunk-6KCFVLO6.js} +5 -5
  37. package/dist/{chunk-EXRHI43B.js → chunk-6KOHY5EP.js} +10 -9
  38. package/dist/{chunk-CU76YDPX.js → chunk-6Z7XDUUJ.js} +1 -1
  39. package/dist/{chunk-XNAIYEKD.js → chunk-7PJ3AJB2.js} +1 -1
  40. package/dist/{chunk-6GAYBX5C.js → chunk-7RWUY3BJ.js} +64 -62
  41. package/dist/{chunk-3CISA3OS.js → chunk-AF3L5JJX.js} +1 -1
  42. package/dist/chunk-BDJIQZN2.js +4830 -0
  43. package/dist/{chunk-75WNFDRU.js → chunk-C53ZNJDZ.js} +4 -4
  44. package/dist/{chunk-GBQCTZON.js → chunk-CVZO6TFE.js} +13 -43
  45. package/dist/{chunk-RQDVTUVD.js → chunk-DJQZ7DEH.js} +15 -15
  46. package/dist/{chunk-KAIQPYCM.js → chunk-DML6BD4K.js} +2 -2
  47. package/dist/{chunk-BTYT3RT3.js → chunk-EG3B2VWK.js} +2 -2
  48. package/dist/{chunk-OB7QARSN.js → chunk-EGRIVMCQ.js} +1 -1
  49. package/dist/{chunk-V4K4BSCM.js → chunk-EHFZEKQM.js} +57 -5
  50. package/dist/{chunk-H4MSJ2NZ.js → chunk-FEO7YW7V.js} +8 -8
  51. package/dist/{chunk-FNBEYIZH.js → chunk-FVAI7AHF.js} +13 -12
  52. package/dist/{chunk-PLGGKTCB.js → chunk-GXUONASF.js} +13 -20
  53. package/dist/{chunk-L6N2TLXR.js → chunk-H3LQ5X6Q.js} +84 -79
  54. package/dist/{chunk-MVXOY5RC.js → chunk-HA3V4XAF.js} +6 -6
  55. package/dist/{chunk-WB55EQNJ.js → chunk-HM7SUIQD.js} +38 -9
  56. package/dist/{chunk-G445Y3YG.js → chunk-HVOTYAS4.js} +15 -7
  57. package/dist/{chunk-IKYXXIMP.js → chunk-I2TDHVFV.js} +3 -3
  58. package/dist/{chunk-3N4T6I3O.js → chunk-I3TYUQLB.js} +1 -1
  59. package/dist/{chunk-AECL3B23.js → chunk-IBZHSU2J.js} +1 -1
  60. package/dist/{chunk-2FEOM3ZT.js → chunk-ID766OZB.js} +12 -12
  61. package/dist/{chunk-4UIEQIF4.js → chunk-IK4JY2LI.js} +2 -2
  62. package/dist/{chunk-C4LV6L4Q.js → chunk-IW5P4KK7.js} +3 -3
  63. package/dist/{chunk-N7VQD4WB.js → chunk-IYZT62UR.js} +1 -1
  64. package/dist/chunk-JKE24AG7.js +62 -0
  65. package/dist/chunk-JLCAHJUO.js +91 -0
  66. package/dist/{chunk-EUFBE5BW.js → chunk-JLGVBK5M.js} +1 -1
  67. package/dist/{chunk-6NC4KBS2.js → chunk-JQ32262N.js} +1 -1
  68. package/dist/{chunk-J2E3VVOS.js → chunk-KDHHPJOG.js} +4 -4
  69. package/dist/{chunk-A42PDANH.js → chunk-LCCYYTEK.js} +1 -1
  70. package/dist/{chunk-T2UR3T4L.js → chunk-LK6KPVX2.js} +263 -74
  71. package/dist/{chunk-RWOWD3PW.js → chunk-LPI7HX4G.js} +2 -2
  72. package/dist/{chunk-UR6BAPOD.js → chunk-LXP6XWJL.js} +2 -2
  73. package/dist/{chunk-4RPCYGZG.js → chunk-MAUGXKSI.js} +4 -4
  74. package/dist/{chunk-AII6P2TC.js → chunk-MMJAHBH2.js} +1 -1
  75. package/dist/{chunk-LFGJWOVA.js → chunk-MNNK7RV5.js} +11 -8
  76. package/dist/{chunk-26OI2B2X.js → chunk-MSHL6CF2.js} +1 -1
  77. package/dist/{chunk-SVVAUJPL.js → chunk-NHA4NRBE.js} +136 -25
  78. package/dist/{chunk-5F6B6KMK.js → chunk-NHL5CMO2.js} +18 -3
  79. package/dist/{chunk-NF6KI46X.js → chunk-NJNC2DQV.js} +31 -28
  80. package/dist/{chunk-I7IXUCKL.js → chunk-NSC5A4IR.js} +1 -1
  81. package/dist/{chunk-MRF4AMKD.js → chunk-NWGXTUYS.js} +32 -10
  82. package/dist/{chunk-57I5KNTL.js → chunk-PL36HK3U.js} +3 -3
  83. package/dist/{chunk-TOEIJ4WF.js → chunk-PUIG6DHT.js} +5 -5
  84. package/dist/{chunk-BA7MQJXG.js → chunk-QE4WRS3N.js} +3 -3
  85. package/dist/{chunk-7V7OUKTU.js → chunk-QTWXVOZI.js} +1 -1
  86. package/dist/{chunk-V2XXV2EH.js → chunk-QZ2JQ6O4.js} +6 -6
  87. package/dist/{chunk-BHOGXIBO.js → chunk-RPZNQV6D.js} +58 -826
  88. package/dist/{chunk-2BGOB2QK.js → chunk-SE2MXV2N.js} +136 -25
  89. package/dist/{chunk-HADQPG7O.js → chunk-SXOD5J7T.js} +2 -2
  90. package/dist/{chunk-32R2AFZ3.js → chunk-T4JGFCXU.js} +3 -3
  91. package/dist/chunk-TQBQYO4L.js +55 -0
  92. package/dist/{chunk-ZSUWGNIT.js → chunk-TSTONNOD.js} +2 -2
  93. package/dist/chunk-TSYRN646.js +84 -0
  94. package/dist/{chunk-BZ727KLT.js → chunk-U32PA6DI.js} +1 -1
  95. package/dist/{chunk-5PVPGWMH.js → chunk-UAT2UMTP.js} +1 -1
  96. package/dist/{chunk-TGS33LDU.js → chunk-UKM3JYNB.js} +5 -71
  97. package/dist/{chunk-UEOGIZ3Q.js → chunk-UUOIH4RW.js} +3 -3
  98. package/dist/{chunk-MASFRPCB.js → chunk-UYPWH7PH.js} +10 -10
  99. package/dist/{chunk-LSQM3NBR.js → chunk-VAVDAOUA.js} +1 -1
  100. package/dist/chunk-VBPNCOD7.js +355 -0
  101. package/dist/{chunk-HQ3CFNHL.js → chunk-VH4PNYOS.js} +1 -1
  102. package/dist/{chunk-IXXVS2Z4.js → chunk-VQB7G5BM.js} +1 -1
  103. package/dist/{chunk-FLREUEHW.js → chunk-W4DMQZL5.js} +1 -1
  104. package/dist/{chunk-RXATE6FZ.js → chunk-WC4MTXGN.js} +22 -0
  105. package/dist/{chunk-F2ASNL2K.js → chunk-WL263XM2.js} +1 -1
  106. package/dist/{chunk-ZB6SCA4J.js → chunk-XAGBSYIQ.js} +9 -2
  107. package/dist/{chunk-LQUMMPGK.js → chunk-XKW4Z7BU.js} +1 -1
  108. package/dist/chunk-XMRA7CQG.js +22 -0
  109. package/dist/{chunk-6YYFNGCS.js → chunk-XULJBZ7K.js} +7 -4
  110. package/dist/chunk-YJK6HOL5.js +29 -0
  111. package/dist/{chunk-KVNXEAVT.js → chunk-ZCJ5EGLU.js} +30 -10
  112. package/dist/{chunk-ERUINDRT.js → chunk-ZF3R2IPC.js} +184 -183
  113. package/dist/{chunk-AECSY5LT.js → chunk-ZYGIDXAK.js} +569 -378
  114. package/dist/{clean-BW7NHQS5.js → clean-TL3IPJDN.js} +28 -28
  115. package/dist/cli.js +55 -55
  116. package/dist/{cloud-TZVXTWZO.js → cloud-EYMRPJNY.js} +4 -4
  117. package/dist/{cloudrun-KRIETALO.js → cloudrun-TOJ36NLX.js} +11 -11
  118. package/dist/commands/layout-audit.browser.js +3 -15
  119. package/dist/{compare-WYWHJ4CR.js → compare-MP5EOW4D.js} +40 -40
  120. package/dist/{compiler-ANIPXLJ7.js → compiler-NOPVLJ2S.js} +15 -15
  121. package/dist/{component-CY7DCX56.js → component-ASACDCZK.js} +3 -3
  122. package/dist/{compositions-5YEB24E3.js → compositions-WKNZJY34.js} +19 -19
  123. package/dist/{contactSheet-5APX35L3.js → contactSheet-YOBPATEM.js} +2 -2
  124. package/dist/{delete-6642PDON.js → delete-DQTFHP3G.js} +2 -2
  125. package/dist/{deploy-NZP6TZLS.js → deploy-HHCFOUFM.js} +4 -4
  126. package/dist/{deterministicFonts-HQYCUUAL.js → deterministicFonts-LKAGUNE5.js} +3 -3
  127. package/dist/{dist-V2BGP46S.js → dist-L4Z4ZEYW.js} +7 -4
  128. package/dist/{dist-DGFC75NC.js → dist-NQEYA4ZX.js} +44 -36
  129. package/dist/docs/rendering.md +3 -0
  130. package/dist/{doctor-ZW4A2FS3.js → doctor-JDM65CP7.js} +20 -20
  131. package/dist/{events-NJU4VFDA.js → events-MBRNA3UF.js} +3 -3
  132. package/dist/{events-XRCHY2F6.js → events-RKRHRLJD.js} +2 -2
  133. package/dist/{feedback-NQLSZMES.js → feedback-LZWIWV5J.js} +17 -17
  134. package/dist/{ffmpeg-RYDQLG3G.js → ffmpeg-4PZKSIGE.js} +15 -15
  135. package/dist/{figma-TJAMP2CI.js → figma-QFNYUT3F.js} +3 -3
  136. package/dist/fontLocalizeCli.js +20 -18
  137. package/dist/{get-RRZ3O26X.js → get-2B5ENJOH.js} +2 -2
  138. package/dist/{gpuPolicy-4WLHUUS3.js → gpuPolicy-E5FB2GFR.js} +13 -13
  139. package/dist/{grade-compare-P7PE3NAA.js → grade-compare-4GUAPJHE.js} +40 -40
  140. package/dist/{gsapParser-IEUSLYDJ.js → gsapParser-3H7ON3DO.js} +1 -1
  141. package/dist/{gsapParserAcorn-LZJKCFQI.js → gsapParserAcorn-5YD4N6HQ.js} +2 -2
  142. package/dist/hangReport.js +47 -0
  143. package/dist/heifImagePrep-C2RYIEER.js +53 -0
  144. package/dist/{help-6RELRVIW.js → help-XGDAXV67.js} +1 -1
  145. package/dist/{history-GIIDYND3.js → history-WNFF6HGU.js} +108 -60
  146. package/dist/hyperframe.manifest.json +1 -1
  147. package/dist/hyperframe.runtime.iife.js +75 -68
  148. package/dist/hyperframes-player.global.js +3 -3
  149. package/dist/hyperframes-slideshow.global.js +16 -16
  150. package/dist/{info-LBUA2DXE.js → info-BR2LKGJD.js} +16 -16
  151. package/dist/{init-QUPXBONY.js → init-P6UWPUY3.js} +59 -58
  152. package/dist/{inspect-CL42DJZ4.js → inspect-MSRPF7ZO.js} +40 -39
  153. package/dist/inspection.js +4 -4
  154. package/dist/{installer-VR7XDLR3.js → installer-MPUQS3ZX.js} +10 -10
  155. package/dist/{keyframes-LELLROMA.js → keyframes-J6K66QTO.js} +11 -11
  156. package/dist/{lambda-I6KFXWOO.js → lambda-LJ2OSWFJ.js} +32 -13
  157. package/dist/{layout-NR6SNRZE.js → layout-CDY65XGA.js} +40 -39
  158. package/dist/{lint-DYEMSEQR.js → lint-CAUNBGPX.js} +13 -10
  159. package/dist/{lintProject-EA4NPL2X.js → lintProject-ZTSX3AWT.js} +7 -4
  160. package/dist/{list-RDURYO5U.js → list-33BYQNRZ.js} +2 -2
  161. package/dist/{login-VKLET5OL.js → login-5QMRKOHK.js} +4 -4
  162. package/dist/{manager-IYT3THJN.js → manager-3JOHHPVR.js} +17 -17
  163. package/dist/{manager-7TSUZKXU.js → manager-RMYSZ3KI.js} +7 -3
  164. package/dist/{media-treatment-I4AFEQZ3.js → media-treatment-4WP22CFN.js} +23 -23
  165. package/dist/{models-LLPVGC2E.js → models-HPWCHAZX.js} +28 -28
  166. package/dist/{motionShot-6A6HH6IK.js → motionShot-I7GDIROQ.js} +23 -23
  167. package/dist/{normalize-audio-KVQJBYLT.js → normalize-audio-VTMXPSC7.js} +14 -14
  168. package/dist/{open-J4ZT4X3C.js → open-SAO7OQTT.js} +19 -19
  169. package/dist/{parakeetRunner-FLUCIDIZ.js → parakeetRunner-ZYPBIA73.js} +25 -25
  170. package/dist/{pipeline-RRVLGALQ.js → pipeline-VNBMR6QU.js} +16 -16
  171. package/dist/{play-QGJSXUVM.js → play-7VI6A7KN.js} +42 -32
  172. package/dist/{preflight-SP2ZERBE.js → preflight-VWV7L45J.js} +17 -17
  173. package/dist/{present-UR4YBHMX.js → present-CSJGYOFF.js} +37 -27
  174. package/dist/{preview-6ENCRU4C.js → preview-B246ZTVO.js} +60 -45
  175. package/dist/{producer-OMHZRY6A.js → producer-WJLFDVQJ.js} +1 -1
  176. package/dist/{projectConfig-NGS7GJ47.js → projectConfig-OMR46ZWQ.js} +14 -13
  177. package/dist/{publication-6NYQA22Y.js → publication-AA7NNYET.js} +8 -8
  178. package/dist/{publish-E6RE5VHB.js → publish-TJ4QVVSP.js} +18 -17
  179. package/dist/{remove-background-66PQRA7R.js → remove-background-LQ2V7W7N.js} +20 -20
  180. package/dist/{render-ZLRJUFMX.js → render-AWEEPG3F.js} +39 -37
  181. package/dist/{render-SBAZWXPO.js → render-E5QJG74D.js} +14 -11
  182. package/dist/{render-IMSGS6BD.js → render-JLTNZ36U.js} +83 -51
  183. package/dist/{render-batch-MO7LYZSP.js → render-batch-U4T4VSCM.js} +14 -11
  184. package/dist/renderSetupWorker.js +11 -8
  185. package/dist/{resolver-QMBVTAKT.js → resolver-GXCTUKPV.js} +10 -10
  186. package/dist/{screenshotCapture-I5EDCITF.js → screenshotCapture-X6OKIXCB.js} +1 -1
  187. package/dist/{sherpa-JZRDL3OE.js → sherpa-4VZWVHWZ.js} +24 -24
  188. package/dist/skills/hyperframes-cli/references/init-and-scaffold.md +1 -0
  189. package/dist/skills/hyperframes-cli/references/lambda.md +3 -0
  190. package/dist/skills/hyperframes-cli/references/preview-render.md +3 -0
  191. package/dist/{skills-YBTEWFYS.js → skills-WUKR7SUE.js} +8 -8
  192. package/dist/{skillsUpdateCheck-Z4HTDZJN.js → skillsUpdateCheck-YXRBY3JC.js} +3 -3
  193. package/dist/{snapshot-5F5UV6H5.js → snapshot-Q7S2FTNG.js} +143 -77
  194. package/dist/{src-WWXYV2TS.js → src-CLAALR5W.js} +26 -19
  195. package/dist/{src-UTW3F2PM.js → src-ZOXUSGAP.js} +24 -12
  196. package/dist/{staticProjectServer-UHZ63C5O.js → staticProjectServer-DQ7PIDPA.js} +26 -26
  197. package/dist/studio/assets/hyperframes-player-Cm5aBiKq.js +478 -0
  198. package/dist/studio/assets/{index-dy6GQJn4.js → index-BF9YeBnC.js} +142 -142
  199. package/dist/studio/assets/{index-C8hp9Y7c.js → index-BrqAmMRt.js} +1 -1
  200. package/dist/studio/index.html +1 -1
  201. package/dist/{studio-api-BHZ3PHL2.js → studio-api-NUE227JM.js} +18 -18
  202. package/dist/{studioSelectionClient-IUUPKUHZ.js → studioSelectionClient-D6VMGTKQ.js} +1 -1
  203. package/dist/{studioServer-AFUXWRB5.js → studioServer-HVOKP4VI.js} +81 -70
  204. package/dist/{synthesize-PKTB5ATG.js → synthesize-QZHRXGRY.js} +30 -8
  205. package/dist/{telemetry-UYKOT4OJ.js → telemetry-2Y5JXLDB.js} +3 -3
  206. package/dist/{timeline-K5NLEMH4.js → timeline-WOQGXFRV.js} +28 -28
  207. package/dist/{tokens-FCOSWE2O.js → tokens-T3OHTWUC.js} +2 -2
  208. package/dist/{transcribe-SIFMTW5W.js → transcribe-4U74P5TG.js} +22 -22
  209. package/dist/{transcribe-K2QTXDQR.js → transcribe-JZ3BO546.js} +32 -32
  210. package/dist/{tts-5I2AJNLM.js → tts-AY4JO5NQ.js} +2 -2
  211. package/dist/{updateCheck-JZ6TBZVE.js → updateCheck-6EUAGAM4.js} +2 -2
  212. package/dist/{upgrade-TUPAJXQQ.js → upgrade-55K6F4MP.js} +2 -2
  213. package/dist/upstreamProxy-W5FWAT5Z.js +17 -0
  214. package/dist/{urlDownloader-L4775QID.js → urlDownloader-47JMOLNN.js} +12 -12
  215. package/dist/{validate-4HVVMEBV.js → validate-QBJ3SBS4.js} +32 -32
  216. package/dist/{video-4OGPF3IE.js → video-3ZAUNAR3.js} +17 -15
  217. package/dist/warmCheck.js +50 -48
  218. package/package.json +2 -1
  219. package/dist/chunk-4YYJOFKS.js +0 -28
  220. package/dist/chunk-ZUQZP6QD.js +0 -3986
  221. package/dist/studio/assets/hyperframes-player-DzdSmJdB.js +0 -478
@@ -22,15 +22,18 @@ import {
22
22
  hasClipStarted,
23
23
  hdrToSdrToneMapFilter,
24
24
  isInClipWindow,
25
+ mediaElementTime,
25
26
  parseFirstFrameColour,
26
27
  quantizeSeekTime,
27
28
  quantizeTimeToFrame,
28
29
  renderFrameIdForRenderId,
29
30
  resolveAuthoredTimingWindow,
30
31
  toFps
31
- } from "./chunk-6GAYBX5C.js";
32
+ } from "./chunk-7RWUY3BJ.js";
32
33
  import {
33
34
  AUDIO_GROUP_RENDER_ID_ATTR,
35
+ AUTHORED_SOURCE_BEGIN,
36
+ AUTHORED_SOURCE_END,
34
37
  COLOR_GRADING_SOURCE_HIDDEN_ATTR,
35
38
  COMPOSITION_SOURCE_URL,
36
39
  HF_AUDIO_AUTOMATION_ATTR,
@@ -41,6 +44,7 @@ import {
41
44
  MEDIA_RENDER_ID_ATTR,
42
45
  PAGE_DEVICE_SCALE_GLOBAL,
43
46
  PAGE_MOTION_BLUR_OFF_GLOBAL,
47
+ RUNTIME_BOOTSTRAP_ATTR,
44
48
  VOLUME_TARGET,
45
49
  acceleratedCanvasTrackerSource,
46
50
  clampAudioGain,
@@ -68,7 +72,7 @@ import {
68
72
  sourceTimeAt,
69
73
  timeAtSourceTime,
70
74
  volumeSegmentSampleCount
71
- } from "./chunk-ZUQZP6QD.js";
75
+ } from "./chunk-BDJIQZN2.js";
72
76
  import {
73
77
  redactTelemetryString,
74
78
  redactUrlQueryStrings
@@ -86,7 +90,7 @@ import {
86
90
  } from "./chunk-4UMPIPCQ.js";
87
91
  import {
88
92
  resolveReferencedStart
89
- } from "./chunk-KVNXEAVT.js";
93
+ } from "./chunk-ZCJ5EGLU.js";
90
94
  import {
91
95
  FFMPEG_PATH_ENV,
92
96
  FFPROBE_PATH_ENV,
@@ -98,7 +102,7 @@ import {
98
102
  } from "./chunk-PBNWRWKA.js";
99
103
  import {
100
104
  isPathInside
101
- } from "./chunk-2BGOB2QK.js";
105
+ } from "./chunk-SE2MXV2N.js";
102
106
  import {
103
107
  parseHTML
104
108
  } from "./chunk-GWTIFRF5.js";
@@ -898,7 +902,7 @@ var hostHandlesSigint = false;
898
902
  function setHostHandlesSigint(owned) {
899
903
  hostHandlesSigint = owned;
900
904
  }
901
- var sigintLaunchOptions = () => ({ handleSIGINT: !hostHandlesSigint });
905
+ var ownedLaunchOptions = () => ({ handleSIGINT: !hostHandlesSigint, pipe: true });
902
906
  function isSoftwareWebGlRenderer(rendererInfo) {
903
907
  const renderer = rendererInfo.trim().toLowerCase();
904
908
  return renderer.includes("swiftshader") || renderer.includes("llvmpipe") || renderer.includes("lavapipe") || renderer.includes("softpipe") || renderer.includes("mesa offscreen") || renderer.includes("microsoft basic render driver") || renderer.includes("software rasterizer");
@@ -920,7 +924,7 @@ async function probeHardwareWebGlInfo(ppt, options) {
920
924
  let probeBrowser;
921
925
  try {
922
926
  const launchOptions = {
923
- ...sigintLaunchOptions(),
927
+ ...ownedLaunchOptions(),
924
928
  headless: true,
925
929
  args: withHyperframesBrowserMarker(options.args),
926
930
  defaultViewport: { width: 64, height: 64 },
@@ -1395,7 +1399,7 @@ async function launchBrowser(fingerprint) {
1395
1399
  let captureMode = fingerprint.requestedCaptureMode;
1396
1400
  let browser;
1397
1401
  const launch = (args) => ppt.launch({
1398
- ...sigintLaunchOptions(),
1402
+ ...ownedLaunchOptions(),
1399
1403
  headless: true,
1400
1404
  args: withHyperframesBrowserMarker(args),
1401
1405
  defaultViewport: null,
@@ -1448,6 +1452,8 @@ async function launchBrowser(fingerprint) {
1448
1452
  }
1449
1453
  function forceCloseBrowserProcess(browser) {
1450
1454
  const proc = browser.process?.();
1455
+ for (const stream of proc?.stdio ?? []) stream?.on("error", () => {
1456
+ });
1451
1457
  if (proc && !proc.killed) {
1452
1458
  try {
1453
1459
  proc.kill("SIGKILL");
@@ -1779,6 +1785,19 @@ var DrawElementCaptureError = class extends Error {
1779
1785
  this.frameIndex = frameIndex;
1780
1786
  }
1781
1787
  };
1788
+ function markRejectionHandled(promise) {
1789
+ promise.catch(() => {
1790
+ });
1791
+ }
1792
+ function asDrawElementCaptureFailure(frameIndex, encodeResult) {
1793
+ const wrapped = encodeResult.catch((cause) => {
1794
+ if (isDrawElementCaptureError(cause)) throw cause;
1795
+ const reason = cause instanceof Error ? cause.message : String(cause);
1796
+ throw new DrawElementCaptureError(frameIndex, reason, cause);
1797
+ });
1798
+ markRejectionHandled(wrapped);
1799
+ return wrapped;
1800
+ }
1782
1801
  function isDrawElementCaptureError(error) {
1783
1802
  let current = error;
1784
1803
  for (let depth = 0; depth < 5 && typeof current === "object" && current !== null; depth++) {
@@ -6105,6 +6124,37 @@ async function waitForSubCompositionTimelines(session, page, timeoutMs, options
6105
6124
  memo.unregisteredIds = session.pendingTimelineIds ?? [];
6106
6125
  }
6107
6126
  }
6127
+ async function authorScriptsMayRegisterTimelines(runtimeAttr, authoredBegin, authoredEnd) {
6128
+ if (document.readyState !== "complete") return true;
6129
+ const memo = globalThis;
6130
+ memo.__hfAuthorScan ??= await (async () => {
6131
+ const scripts = [
6132
+ ...Array.from(document.querySelectorAll("script")),
6133
+ ...Array.from(document.querySelectorAll("template")).flatMap(
6134
+ (t) => Array.from(t.content.querySelectorAll("script"))
6135
+ )
6136
+ ].filter((script) => !script.hasAttribute(runtimeAttr));
6137
+ const mayRegister = (code) => code.includes("__timelines") || /\bimport\s*\(|^\s*import\s*[\w{*"']/m.test(code);
6138
+ for (const script of scripts) {
6139
+ if (script.type === "module") return true;
6140
+ if (!script.src) {
6141
+ const text = script.textContent ?? "";
6142
+ const authored = text.includes(authoredBegin) ? text.split(authoredBegin).slice(1).map((region) => region.split(authoredEnd)[0]).join("\n") : text;
6143
+ if (mayRegister(authored)) return true;
6144
+ continue;
6145
+ }
6146
+ const url = new URL(script.src, location.href);
6147
+ if (url.origin !== location.origin) return true;
6148
+ try {
6149
+ if (mayRegister(await (await fetch(url)).text())) return true;
6150
+ } catch {
6151
+ return true;
6152
+ }
6153
+ }
6154
+ return false;
6155
+ })();
6156
+ return memo.__hfAuthorScan;
6157
+ }
6108
6158
  async function pollSubCompositionTimelines(page, timeoutMs, {
6109
6159
  intervalMs = 150,
6110
6160
  getScriptLoadFailures,
@@ -6134,13 +6184,18 @@ async function pollSubCompositionTimelines(page, timeoutMs, {
6134
6184
  let scriptFailureBail = false;
6135
6185
  let errorSeenAt;
6136
6186
  for (; ; ) {
6137
- ready = Boolean(await page.evaluate(expression));
6138
- if (ready || shouldStop?.()) break;
6139
- const now = Date.now();
6140
- if (now >= deadline) break;
6141
6187
  const failures = getScriptLoadFailures?.() ?? [];
6142
6188
  const errors = getPageErrors?.() ?? [];
6143
6189
  const failed = failures.length > 0 ? failures : errors;
6190
+ ready = Boolean(await page.evaluate(expression)) || failed.length === 0 && !await page.evaluate(
6191
+ authorScriptsMayRegisterTimelines,
6192
+ RUNTIME_BOOTSTRAP_ATTR,
6193
+ AUTHORED_SOURCE_BEGIN,
6194
+ AUTHORED_SOURCE_END
6195
+ );
6196
+ if (ready || shouldStop?.()) break;
6197
+ const now = Date.now();
6198
+ if (now >= deadline) break;
6144
6199
  const graceMs = failures.length > 0 ? scriptFailureGraceMs : scriptErrorGraceMs;
6145
6200
  if (failed.length > 0) errorSeenAt ??= now;
6146
6201
  const sinceFailure = failures.length > 0 ? now - start : now - (errorSeenAt ?? now);
@@ -6467,8 +6522,31 @@ function classifyPageError(details, projectScripts) {
6467
6522
  const frames = (details.stackTrace?.callFrames ?? []).map((frame) => frame.url);
6468
6523
  if (frames.length === 0 && details.text.startsWith("Uncaught (in promise)")) return null;
6469
6524
  const urls = frames.length > 0 ? frames : [details.url];
6470
- const owned = (url) => url !== void 0 && (projectScripts.has(url) || url.startsWith(COMPOSITION_SOURCE_URL));
6471
- return urls.some(owned) ? `runtime-error:${firstLine}` : null;
6525
+ return urls.some((url) => isOwnedScriptUrl(url, projectScripts)) ? `runtime-error:${firstLine}` : null;
6526
+ }
6527
+ function isOwnedScriptUrl(url, projectScripts) {
6528
+ return url !== void 0 && (projectScripts.has(url) || url.startsWith(COMPOSITION_SOURCE_URL));
6529
+ }
6530
+ var LOOKUP_CALL = /\b(?:getElementById|querySelectorAll|querySelector|getElementsByClassName|getElementsByTagName)\(\s*(["'`])((?:(?!\1).)*)\1/g;
6531
+ async function describeThrowSite(client, details, projectScripts) {
6532
+ const frame = (details.stackTrace?.callFrames ?? []).find(
6533
+ (f) => isOwnedScriptUrl(f.url, projectScripts)
6534
+ );
6535
+ if (!frame) return "";
6536
+ let where = `${frame.url}:${frame.lineNumber + 1}:${frame.columnNumber + 1}`;
6537
+ try {
6538
+ await client.send("Debugger.enable");
6539
+ const { scriptSource } = await client.send("Debugger.getScriptSource", {
6540
+ scriptId: frame.scriptId
6541
+ });
6542
+ const line = scriptSource.split("\n")[frame.lineNumber] ?? "";
6543
+ const lookups = [...line.matchAll(LOOKUP_CALL)];
6544
+ if (lookups.length === 1) where += `, ${lookups[0]?.[0]})`;
6545
+ } catch {
6546
+ } finally {
6547
+ await client.send("Debugger.disable").catch(() => void 0);
6548
+ }
6549
+ return ` [thrown at: ${where}]`;
6472
6550
  }
6473
6551
  async function initializeSession(session) {
6474
6552
  const { page, serverUrl } = session;
@@ -6534,7 +6612,15 @@ async function initializeSession(session) {
6534
6612
  const url = `${serverUrl}/index.html`;
6535
6613
  const runtimeClient = await getCdpSession(page);
6536
6614
  runtimeClient.on("Runtime.exceptionThrown", ({ exceptionDetails }) => {
6537
- recordPageError(session, classifyPageError(exceptionDetails, projectScripts));
6615
+ const error = classifyPageError(exceptionDetails, projectScripts);
6616
+ recordPageError(session, error);
6617
+ if (!error) return;
6618
+ void describeThrowSite(runtimeClient, exceptionDetails, projectScripts).then((site) => {
6619
+ const i = session.pageErrors.indexOf(error);
6620
+ if (!site || i < 0) return;
6621
+ if (session.pageErrors.includes(`${error}${site}`)) session.pageErrors.splice(i, 1);
6622
+ else session.pageErrors[i] = `${error}${site}`;
6623
+ });
6538
6624
  });
6539
6625
  await runtimeClient.send("Runtime.enable");
6540
6626
  const pageNavigationTimeout = session.config?.pageNavigationTimeout ?? DEFAULT_CONFIG.pageNavigationTimeout;
@@ -7773,13 +7859,14 @@ async function captureFrameToBufferPipelined(session, frameIndex, time) {
7773
7859
  "boundary screenshot requested on an injected canvas page"
7774
7860
  );
7775
7861
  }
7776
- const { encodeResult } = await produceDrawElementFrame(
7862
+ const produced = await produceDrawElementFrame(
7777
7863
  page,
7778
7864
  options.width,
7779
7865
  options.height,
7780
7866
  options.quality ?? 80,
7781
7867
  true
7782
7868
  );
7869
+ const encodeResult = asDrawElementCaptureFailure(frameIndex, produced.encodeResult);
7783
7870
  const captureTimeMs = Date.now() - startTime;
7784
7871
  session.capturePerf.frames += 1;
7785
7872
  session.capturePerf.seekMs += seekMs;
@@ -7858,7 +7945,10 @@ async function captureFramesBatchPipelined(session, frameIndices, times) {
7858
7945
  const frameIndex = frameIndices[i];
7859
7946
  const encodeResult = encodeResults[i];
7860
7947
  if (frameIndex === void 0 || !encodeResult) break;
7861
- results.push({ frameIndex, encodeResult });
7948
+ results.push({
7949
+ frameIndex,
7950
+ encodeResult: asDrawElementCaptureFailure(frameIndex, encodeResult)
7951
+ });
7862
7952
  }
7863
7953
  if (failedAt !== null) {
7864
7954
  if (isRecoverableDrawElementError(error)) {
@@ -9811,6 +9901,34 @@ function lockedGopCodecParams(codec, gopSize) {
9811
9901
  const shared = "scenecut=0:open-gop=0:repeat-headers=1";
9812
9902
  return codec === "h264" ? shared : `keyint=${gopSize}:min-keyint=${gopSize}:${shared}`;
9813
9903
  }
9904
+ function keyframeIntervalToGopSize(fps, seconds) {
9905
+ return Math.max(1, Math.round(fpsToNumber(fps) * seconds));
9906
+ }
9907
+ var BITRATE_PATTERN = /^(\d+(?:\.\d+)?)([kKmMgG]?)$/;
9908
+ function bitrateToBitsPerSecond(value) {
9909
+ const match = BITRATE_PATTERN.exec(value);
9910
+ if (!match) throw new Error(`[chunkEncoder] invalid bitrate ${JSON.stringify(value)}`);
9911
+ const unit = match[2].toLowerCase();
9912
+ const scale = { g: 1e9, m: 1e6, k: 1e3 }[unit] ?? 1;
9913
+ return Number(match[1]) * scale;
9914
+ }
9915
+ function appendRateCapArgs(args, options) {
9916
+ const { maxBitrate, bufferSize } = options;
9917
+ if (maxBitrate === void 0) {
9918
+ if (bufferSize !== void 0) throw new Error("[chunkEncoder] bufferSize requires maxBitrate");
9919
+ return;
9920
+ }
9921
+ const codec = options.codec ?? "h264";
9922
+ if (codec !== "h264" && codec !== "h265") {
9923
+ throw new Error(`[chunkEncoder] maxBitrate is not supported for codec ${codec}`);
9924
+ }
9925
+ const cap = bitrateToBitsPerSecond(maxBitrate);
9926
+ const buffer = bufferSize !== void 0 ? bitrateToBitsPerSecond(bufferSize) : cap * 2;
9927
+ if (cap <= 0 || buffer <= 0) {
9928
+ throw new Error("[chunkEncoder] maxBitrate and bufferSize must be positive");
9929
+ }
9930
+ args.push("-maxrate", String(Math.round(cap)), "-bufsize", String(Math.round(buffer)));
9931
+ }
9814
9932
  function buildEncoderArgs(options, inputArgs, outputPath, gpuEncoder = null) {
9815
9933
  const {
9816
9934
  fps,
@@ -9830,6 +9948,7 @@ function buildEncoderArgs(options, inputArgs, outputPath, gpuEncoder = null) {
9830
9948
  }
9831
9949
  const args = ["-xerror", ...inputArgs, "-r", fpsToFfmpegArg(fps)];
9832
9950
  const shouldUseGpu = useGpu && gpuEncoder !== null;
9951
+ appendRateCapArgs(args, options);
9833
9952
  if (codec === "h264" || codec === "h265") {
9834
9953
  if (shouldUseGpu) {
9835
9954
  const encoderName = getGpuEncoderName(gpuEncoder, codec);
@@ -10535,6 +10654,7 @@ function buildStreamingArgs(options, outputPath, gpuEncoder = null) {
10535
10654
  }
10536
10655
  args.push("-r", fpsToFfmpegArg(fps));
10537
10656
  const shouldUseGpu = useGpu && gpuEncoder !== null;
10657
+ appendRateCapArgs(args, options);
10538
10658
  if (codec === "h264" || codec === "h265") {
10539
10659
  if (shouldUseGpu) {
10540
10660
  const encoderName = getGpuEncoderName(gpuEncoder, codec);
@@ -10897,7 +11017,7 @@ function isMemberGroupHidden(groupsById, el) {
10897
11017
  }
10898
11018
 
10899
11019
  // ../engine/src/services/videoFrameExtractor.ts
10900
- import { copyFileSync as copyFileSync2, existsSync as existsSync9, linkSync as linkSync2, mkdirSync as mkdirSync6, rmSync as rmSync5 } from "fs";
11020
+ import { copyFileSync as copyFileSync3, existsSync as existsSync9, linkSync as linkSync2, mkdirSync as mkdirSync6, rmSync as rmSync6 } from "fs";
10901
11021
  import { join as join11 } from "path";
10902
11022
  import { cpus } from "os";
10903
11023
 
@@ -11330,8 +11450,8 @@ function resolveRedirectUrl(response, currentUrl, redirects) {
11330
11450
  if (redirects >= MAX_REDIRECTS) {
11331
11451
  throw new UrlDownloadError("http_rejected", false, "Download exceeded redirect limit");
11332
11452
  }
11333
- const location = response.headers.get("location");
11334
- if (!location) {
11453
+ const location2 = response.headers.get("location");
11454
+ if (!location2) {
11335
11455
  throw new UrlDownloadError(
11336
11456
  "http_rejected",
11337
11457
  false,
@@ -11339,7 +11459,7 @@ function resolveRedirectUrl(response, currentUrl, redirects) {
11339
11459
  );
11340
11460
  }
11341
11461
  try {
11342
- return new URL(location, currentUrl).toString();
11462
+ return new URL(location2, currentUrl).toString();
11343
11463
  } catch {
11344
11464
  throw new UrlDownloadError("http_rejected", false, "Download redirect Location is invalid");
11345
11465
  }
@@ -12041,47 +12161,98 @@ import {
12041
12161
  lstatSync as lstatSync2,
12042
12162
  mkdirSync as mkdirSync5,
12043
12163
  readdirSync as readdirSync5,
12044
- rmSync as rmSync4,
12164
+ rmSync as rmSync5,
12045
12165
  statSync as statSync6,
12046
12166
  utimesSync,
12047
12167
  writeFileSync as writeFileSync3
12048
12168
  } from "fs";
12049
12169
 
12050
12170
  // ../engine/src/utils/renameWithRetry.ts
12051
- import { renameSync } from "fs";
12052
- import { rename } from "fs/promises";
12171
+ import { copyFileSync as copyFileSync2, renameSync } from "fs";
12172
+ import { copyFile, rename } from "fs/promises";
12173
+
12174
+ // ../engine/src/utils/removeScratch.ts
12175
+ import { AsyncLocalStorage } from "async_hooks";
12176
+ import { rmSync as rmSync4 } from "fs";
12177
+ var collecting = new AsyncLocalStorage();
12178
+ function removeScratch(path) {
12179
+ try {
12180
+ rmSync4(path, { recursive: true, force: true });
12181
+ } catch {
12182
+ collecting.getStore()?.push(path);
12183
+ }
12184
+ }
12185
+ async function collectScratchLeftovers(run, report) {
12186
+ const left = [];
12187
+ try {
12188
+ return await collecting.run(left, run);
12189
+ } finally {
12190
+ report(left);
12191
+ }
12192
+ }
12193
+
12194
+ // ../engine/src/utils/renameWithRetry.ts
12053
12195
  var RETRYABLE = /* @__PURE__ */ new Set(["EPERM", "EACCES", "EBUSY"]);
12054
12196
  var BACKOFF_MS = [10, 20, 40, 80, 160, 320, 640];
12055
12197
  function isRetryable(error, platform) {
12056
12198
  if (platform !== "win32") return false;
12057
12199
  return RETRYABLE.has(error?.code ?? "");
12058
12200
  }
12201
+ function nextStep(error, attempt, options, platform) {
12202
+ if (!isRetryable(error, platform)) return "throw";
12203
+ if (attempt < BACKOFF_MS.length) return "wait";
12204
+ return options.copyFallback ? "copy" : "throw";
12205
+ }
12059
12206
  function sleepSync(ms) {
12060
12207
  Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
12061
12208
  }
12062
12209
  function renameWithRetry(from, to, options = {}) {
12063
12210
  const doRename = options.rename ?? renameSync;
12211
+ const doCopy = options.copy ?? copyFileSync2;
12064
12212
  const platform = options.platform ?? process.platform;
12065
12213
  for (let attempt = 0; ; attempt++) {
12066
12214
  try {
12067
12215
  doRename(from, to);
12068
12216
  return;
12069
12217
  } catch (error) {
12070
- if (attempt >= BACKOFF_MS.length || !isRetryable(error, platform)) throw error;
12071
- sleepSync(BACKOFF_MS[attempt]);
12218
+ const step = nextStep(error, attempt, options, platform);
12219
+ if (step === "throw") throw error;
12220
+ if (step === "wait") {
12221
+ sleepSync(BACKOFF_MS[attempt]);
12222
+ continue;
12223
+ }
12224
+ try {
12225
+ doCopy(from, to);
12226
+ } catch {
12227
+ throw error;
12228
+ }
12229
+ removeScratch(from);
12230
+ return;
12072
12231
  }
12073
12232
  }
12074
12233
  }
12075
12234
  async function renameWithRetryAsync(from, to, options = {}) {
12076
12235
  const doRename = options.rename ?? rename;
12236
+ const doCopy = options.copy ?? copyFile;
12077
12237
  const platform = options.platform ?? process.platform;
12078
12238
  for (let attempt = 0; ; attempt++) {
12079
12239
  try {
12080
12240
  await doRename(from, to);
12081
12241
  return;
12082
12242
  } catch (error) {
12083
- if (attempt >= BACKOFF_MS.length || !isRetryable(error, platform)) throw error;
12084
- await new Promise((resolve2) => setTimeout(resolve2, BACKOFF_MS[attempt]));
12243
+ const step = nextStep(error, attempt, options, platform);
12244
+ if (step === "throw") throw error;
12245
+ if (step === "wait") {
12246
+ await new Promise((resolve2) => setTimeout(resolve2, BACKOFF_MS[attempt]));
12247
+ continue;
12248
+ }
12249
+ try {
12250
+ await doCopy(from, to);
12251
+ } catch {
12252
+ throw error;
12253
+ }
12254
+ removeScratch(from);
12255
+ return;
12085
12256
  }
12086
12257
  }
12087
12258
  }
@@ -12169,7 +12340,7 @@ function publishCacheEntry(entry, partialDir) {
12169
12340
  const winner = adoptPublishedWinner(entry, partialDir);
12170
12341
  if (winner) return winner;
12171
12342
  try {
12172
- rmSync4(entry.dir, { recursive: true, force: true });
12343
+ rmSync5(entry.dir, { recursive: true, force: true });
12173
12344
  } catch {
12174
12345
  return { dir: partialDir, published: false };
12175
12346
  }
@@ -12231,7 +12402,7 @@ function directorySizeBytes(path) {
12231
12402
  }
12232
12403
  function removeDir(path) {
12233
12404
  try {
12234
- rmSync4(path, { recursive: true, force: true });
12405
+ rmSync5(path, { recursive: true, force: true });
12235
12406
  } catch {
12236
12407
  }
12237
12408
  }
@@ -12741,6 +12912,12 @@ function chromeGuessForUntaggedMatrix(metadata) {
12741
12912
  const hd = metadata.height >= 720 && !CHROME_BT601_UNTAGGED_CODECS.has(metadata.videoCodec);
12742
12913
  return [`setparams=colorspace=${hd ? "bt709" : "smpte170m"}`];
12743
12914
  }
12915
+ function sdrCanvasColourFilters(metadata, toneMappedToSdr = false) {
12916
+ if (!isHdrColorSpace(metadata.colorSpace)) {
12917
+ return [...chromeGuessForUntaggedMatrix(metadata), SDR_CANVAS_PASSTHROUGH_FILTER];
12918
+ }
12919
+ return toneMappedToSdr ? [SDR_CANVAS_PASSTHROUGH_FILTER] : [];
12920
+ }
12744
12921
  var EXTRACTION_SEGMENT_SECONDS = 120;
12745
12922
  function undoTickRoundingOnTheSourceFrameGrid(seek, lead) {
12746
12923
  const sinceFileStart = `(PTS*TB+${seek}-${lead})`;
@@ -12870,9 +13047,6 @@ async function extractVideoFramesRangeUnredacted(videoPath, videoId, startTime,
12870
13047
  throw new Error("frameRanges extraction needs a constant-frame-rate source");
12871
13048
  }
12872
13049
  const args = urlInputArgs(videoPath);
12873
- if (decodeWithVideoToolbox) {
12874
- args.push("-hwaccel", "videotoolbox");
12875
- }
12876
13050
  if (codecMayHaveAlpha(metadata.videoCodec)) {
12877
13051
  args.push("-c:v", decoderForCodec(metadata.videoCodec));
12878
13052
  }
@@ -12902,10 +13076,7 @@ async function extractVideoFramesRangeUnredacted(videoPath, videoId, startTime,
12902
13076
  vfFilters.push(hdrToSdrToneMapFilter(metadata.colorSpace ?? {}, frameColour));
12903
13077
  }
12904
13078
  if (toneMappedToSdr || !isHdr && !options.sdrToHdrTransfer) {
12905
- vfFilters.push(
12906
- ...isHdr ? [] : chromeGuessForUntaggedMatrix(metadata),
12907
- SDR_CANVAS_PASSTHROUGH_FILTER
12908
- );
13079
+ vfFilters.push(...sdrCanvasColourFilters(metadata, toneMappedToSdr));
12909
13080
  if (format === "jpg") {
12910
13081
  if (options.shownBox) vfFilters.push(halveToCoverScaleFilter(options.shownBox));
12911
13082
  vfFilters.push(SDR_JPEG_AS_BT601_FULL_RANGE_FILTER);
@@ -12923,8 +13094,8 @@ async function extractVideoFramesRangeUnredacted(videoPath, videoId, startTime,
12923
13094
  const segmentFrames = Math.round(EXTRACTION_SEGMENT_SECONDS * fps);
12924
13095
  const totalFrames = extractionFrameCountForDuration(duration, normalizedFps, metadata.isVFR);
12925
13096
  const boundVfrFrameCount = metadata.isVFR && totalFrames > 0;
12926
- const processResult = sampleAtOutputFps && (options.frameRanges || boundVfrFrameCount || totalFrames > segmentFrames) ? await runSegmentedExtraction({
12927
- decodeArgs,
13097
+ const extract = (hwaccel) => sampleAtOutputFps && (options.frameRanges || boundVfrFrameCount || totalFrames > segmentFrames) ? runSegmentedExtraction({
13098
+ decodeArgs: [...hwaccel, ...decodeArgs],
12928
13099
  filterAndEncodeArgs: (seek) => [...filterArgsFor(seek), ...encodeArgs],
12929
13100
  videoPath,
12930
13101
  startTime,
@@ -12935,10 +13106,17 @@ async function extractVideoFramesRangeUnredacted(videoPath, videoId, startTime,
12935
13106
  segmentFrames
12936
13107
  ),
12937
13108
  runOptions
12938
- }) : await inExtractionSlot(
12939
- () => runFfmpeg([...args, ...filterArgsFor(startTime), ...encodeArgs], runOptions),
13109
+ }) : inExtractionSlot(
13110
+ () => runFfmpeg(
13111
+ [...hwaccel, ...args, ...filterArgsFor(startTime), ...encodeArgs],
13112
+ runOptions
13113
+ ),
12940
13114
  signal
12941
13115
  );
13116
+ let processResult = await extract(decodeWithVideoToolbox ? ["-hwaccel", "videotoolbox"] : []);
13117
+ const ffmpegExitedFailing = processResult.terminationReason === "exit" && !processResult.success && !processResult.failureReason;
13118
+ const videoToolboxWasOptional = decodeWithVideoToolbox && !keepsHdrForChrome;
13119
+ if (ffmpegExitedFailing && videoToolboxWasOptional) processResult = await extract([]);
12942
13120
  if (processResult.failureReason === "external_interruption") {
12943
13121
  throw new VideoSourceExtractionError(
12944
13122
  "external_interruption",
@@ -13237,7 +13415,7 @@ function linkOrCopyFrame(src, dest) {
13237
13415
  try {
13238
13416
  linkSync2(src, dest);
13239
13417
  } catch {
13240
- copyFileSync2(src, dest);
13418
+ copyFileSync3(src, dest);
13241
13419
  }
13242
13420
  }
13243
13421
  function supersetGroupingKey(work, fps) {
@@ -13327,7 +13505,7 @@ function planSupersetGroups(misses, fps) {
13327
13505
  }
13328
13506
  function sliceSupersetMember(member, superset, outputDir, fps, configuredFps) {
13329
13507
  const { work } = member.miss;
13330
- rmSync5(outputDir, { recursive: true, force: true });
13508
+ rmSync6(outputDir, { recursive: true, force: true });
13331
13509
  mkdirSync6(outputDir, { recursive: true });
13332
13510
  const requestedFrames = extractionFrameCountForDuration(
13333
13511
  work.videoDuration,
@@ -13659,14 +13837,14 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
13659
13837
  maxTransientRetries,
13660
13838
  onRetry: () => {
13661
13839
  recordTransientRetries(1);
13662
- rmSync5(outputDir, { recursive: true, force: true });
13840
+ rmSync6(outputDir, { recursive: true, force: true });
13663
13841
  }
13664
13842
  }
13665
13843
  );
13666
13844
  return attempted2.result;
13667
13845
  }
13668
13846
  const partialDir = partialCacheEntryDir(cacheTarget.entry);
13669
- rmSync5(partialDir, { recursive: true, force: true });
13847
+ rmSync6(partialDir, { recursive: true, force: true });
13670
13848
  mkdirSync6(partialDir, { recursive: true });
13671
13849
  const attempted = await runVideoExtractionWithRetry(
13672
13850
  () => extractVideoFramesRange(
@@ -13684,7 +13862,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
13684
13862
  maxTransientRetries,
13685
13863
  onRetry: () => {
13686
13864
  recordTransientRetries(1);
13687
- rmSync5(partialDir, { recursive: true, force: true });
13865
+ rmSync6(partialDir, { recursive: true, force: true });
13688
13866
  mkdirSync6(partialDir, { recursive: true });
13689
13867
  }
13690
13868
  }
@@ -13768,7 +13946,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
13768
13946
  } catch {
13769
13947
  return null;
13770
13948
  } finally {
13771
- rmSync5(probeDir, { recursive: true, force: true });
13949
+ rmSync6(probeDir, { recursive: true, force: true });
13772
13950
  }
13773
13951
  }
13774
13952
  async function executeDirectMiss(miss, maxTransientRetries = options.maxTransientRetries ?? 0) {
@@ -13804,7 +13982,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
13804
13982
  if (!first) return [];
13805
13983
  const tempDir = cacheRootDir ? join11(cacheRootDir, `${group.groupId}.partial-${process.pid}`) : join11(options.outputDir, group.groupId);
13806
13984
  try {
13807
- rmSync5(tempDir, { recursive: true, force: true });
13985
+ rmSync6(tempDir, { recursive: true, force: true });
13808
13986
  const superset = await extractVideoFramesRange(
13809
13987
  first.videoPath,
13810
13988
  group.groupId,
@@ -13837,7 +14015,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
13837
14015
  );
13838
14016
  return fallback;
13839
14017
  } finally {
13840
- rmSync5(tempDir, { recursive: true, force: true });
14018
+ rmSync6(tempDir, { recursive: true, force: true });
13841
14019
  }
13842
14020
  }
13843
14021
  const preparedExtractions = await Promise.all(
@@ -14005,7 +14183,8 @@ function getFrameIndexAtTime(extracted, globalTime, videoStart, loop = false, me
14005
14183
  const cycle = Math.max(0, resolvePlayableVideoDuration(extracted.metadata) - mediaStart);
14006
14184
  if (cycle > 0 && sourceTime >= cycle) sourceTime %= cycle;
14007
14185
  }
14008
- const frameIndex = Math.floor(sourceTime * extracted.fps + 1e-9);
14186
+ const shownTime = mediaElementTime(mediaStart + sourceTime) - mediaStart;
14187
+ const frameIndex = Math.floor(shownTime * extracted.fps);
14009
14188
  if (frameIndex < 0 || extracted.totalFrames <= 0) return null;
14010
14189
  if (isVideoHiddenBeforeStreamStart(
14011
14190
  extracted.metadata.videoStreamLeadSeconds,
@@ -14145,7 +14324,7 @@ var FrameLookupTable = class {
14145
14324
  for (const video of this.videos.values()) {
14146
14325
  if (video.extracted.ownedByLookup) continue;
14147
14326
  if (existsSync9(video.extracted.outputDir)) {
14148
- rmSync5(video.extracted.outputDir, { recursive: true, force: true });
14327
+ rmSync6(video.extracted.outputDir, { recursive: true, force: true });
14149
14328
  }
14150
14329
  }
14151
14330
  this.videos.clear();
@@ -14650,7 +14829,7 @@ async function queryElementStacking(page, nativeHdrIds) {
14650
14829
  }
14651
14830
 
14652
14831
  // ../engine/src/services/audioMixer.ts
14653
- import { closeSync as closeSync4, existsSync as existsSync11, mkdirSync as mkdirSync7, mkdtempSync as mkdtempSync8, openSync as openSync4, rmSync as rmSync9, writeFileSync as writeFileSync7 } from "fs";
14832
+ import { closeSync as closeSync4, existsSync as existsSync11, mkdirSync as mkdirSync7, mkdtempSync as mkdtempSync8, openSync as openSync4, rmSync as rmSync8, writeFileSync as writeFileSync7 } from "fs";
14654
14833
  import { join as join15, dirname as dirname7, isAbsolute, relative } from "path";
14655
14834
 
14656
14835
  // ../engine/src/utils/notMediaPayload.ts
@@ -14770,7 +14949,7 @@ import { cpus as cpus2 } from "os";
14770
14949
 
14771
14950
  // ../engine/src/services/aacEncode.ts
14772
14951
  import { execFile as execFile3 } from "child_process";
14773
- import { mkdtempSync as mkdtempSync5, readFileSync as readFileSync5, rmSync as rmSync6, writeFileSync as writeFileSync4 } from "fs";
14952
+ import { mkdtempSync as mkdtempSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
14774
14953
  import { dirname as dirname5, join as join12 } from "path";
14775
14954
  var SAMPLE_RATE = 48e3;
14776
14955
  var FRAME_SAMPLES = 1024;
@@ -14896,7 +15075,7 @@ async function encodeAac(input, outputPath, totalDuration, {
14896
15075
  const slowest = Math.max(...results.map((result) => result.durationMs));
14897
15076
  return { ...muxed, durationMs: slowest + muxed.durationMs };
14898
15077
  } finally {
14899
- rmSync6(dir, { recursive: true, force: true });
15078
+ removeScratch(dir);
14900
15079
  }
14901
15080
  }
14902
15081
 
@@ -15361,7 +15540,6 @@ import {
15361
15540
  openSync as openSync3,
15362
15541
  readFileSync as readFileSync7,
15363
15542
  readSync,
15364
- rmSync as rmSync8,
15365
15543
  statSync as statSync7,
15366
15544
  writeFileSync as writeFileSync6,
15367
15545
  writeSync as writeSync2
@@ -15734,7 +15912,7 @@ async function withFxBrowser(options, body) {
15734
15912
  `Audio FX failed for track ${options.trackId}: ${err.message}`
15735
15913
  );
15736
15914
  } finally {
15737
- rmSync8(hostDir, { recursive: true, force: true });
15915
+ removeScratch(hostDir);
15738
15916
  await lease?.release().catch(() => void 0);
15739
15917
  }
15740
15918
  }
@@ -16253,7 +16431,7 @@ async function extractAudioSegment(srcPath, outputPath, stage, mediaStart, durat
16253
16431
  failure: failure2
16254
16432
  };
16255
16433
  } finally {
16256
- rmSync9(cycleDir, { recursive: true, force: true });
16434
+ removeScratch(cycleDir);
16257
16435
  }
16258
16436
  }
16259
16437
  const inputSeek = mediaStart >= (metadata?.latestStreamLeadSeconds ?? 0);
@@ -16427,7 +16605,7 @@ async function mixAudioTracksFlat(tracks, outputPath, totalDuration, signal, con
16427
16605
  currentArgs[currentArgs.indexOf("-filter_complex_script")] = "-/filter_complex";
16428
16606
  return await runFfmpeg(currentArgs, { signal, timeout: ffmpegProcessTimeout });
16429
16607
  } finally {
16430
- rmSync9(scriptDir, { recursive: true, force: true });
16608
+ removeScratch(scriptDir);
16431
16609
  }
16432
16610
  };
16433
16611
  let useNormalize = true;
@@ -16547,7 +16725,7 @@ async function mixGroupMembersFlat(memberTracks, outputPath, totalDuration, sign
16547
16725
  currentArgs[currentArgs.indexOf("-filter_complex_script")] = "-/filter_complex";
16548
16726
  return await runFfmpeg(currentArgs, { signal, timeout: ffmpegProcessTimeout });
16549
16727
  } finally {
16550
- rmSync9(scriptDir, { recursive: true, force: true });
16728
+ removeScratch(scriptDir);
16551
16729
  }
16552
16730
  };
16553
16731
  let useNormalize = true;
@@ -16608,8 +16786,8 @@ async function sumInSlices(tracks, scratchDir, totalDuration, signal, config) {
16608
16786
  signal,
16609
16787
  config
16610
16788
  );
16611
- rmSync9(running.srcPath, { force: true });
16612
- rmSync9(slicePath, { force: true });
16789
+ removeScratch(running.srcPath);
16790
+ removeScratch(slicePath);
16613
16791
  if (!folded.success) return folded;
16614
16792
  running = wavTrack(id, foldedPath);
16615
16793
  }
@@ -16625,10 +16803,10 @@ async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal,
16625
16803
  try {
16626
16804
  const summed = await sumInSlices(memberTracks, scratchDir, totalDuration, signal, config);
16627
16805
  if (!summed.success) return summed;
16628
- renameWithRetry(summed.track.srcPath, outputPath);
16806
+ renameWithRetry(summed.track.srcPath, outputPath, { copyFallback: true });
16629
16807
  return { success: true, degradedAutomation: summed.degradedAutomation };
16630
16808
  } finally {
16631
- rmSync9(scratchDir, { recursive: true, force: true });
16809
+ removeScratch(scratchDir);
16632
16810
  }
16633
16811
  }
16634
16812
  async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config) {
@@ -16662,7 +16840,7 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
16662
16840
  error: summed.degradedAutomation ? "Volume automation exceeded this ffmpeg build's expression limits; rendered at base volume" : mixed.error
16663
16841
  } : mixed;
16664
16842
  } finally {
16665
- rmSync9(scratchDir, { recursive: true, force: true });
16843
+ removeScratch(scratchDir);
16666
16844
  }
16667
16845
  }
16668
16846
  async function mixThroughFloatSum(tracks, masterChain, outputPath, workDir, totalDuration, signal, config) {
@@ -16695,7 +16873,8 @@ async function mixThroughFloatSum(tracks, masterChain, outputPath, workDir, tota
16695
16873
  failures: [failure]
16696
16874
  };
16697
16875
  }
16698
- if (config?.keepEncoderInputAt) renameWithRetry(encoderInput, config.keepEncoderInputAt);
16876
+ if (config?.keepEncoderInputAt)
16877
+ renameWithRetry(encoderInput, config.keepEncoderInputAt, { copyFallback: true });
16699
16878
  return {
16700
16879
  ...sum,
16701
16880
  outputPath,
@@ -16948,7 +17127,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
16948
17127
  ).catch((err) => {
16949
17128
  internalController.abort();
16950
17129
  try {
16951
- rmSync9(workDir, { recursive: true, force: true });
17130
+ rmSync8(workDir, { recursive: true, force: true });
16952
17131
  } catch {
16953
17132
  }
16954
17133
  throw err;
@@ -16973,7 +17152,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
16973
17152
  });
16974
17153
  const removeWorkDir = () => {
16975
17154
  try {
16976
- rmSync9(workDir, { recursive: true, force: true });
17155
+ rmSync8(workDir, { recursive: true, force: true });
16977
17156
  } catch {
16978
17157
  }
16979
17158
  };
@@ -17132,7 +17311,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
17132
17311
  // ../engine/src/services/parallelCoordinator.ts
17133
17312
  import { cpus as cpus3, freemem } from "os";
17134
17313
  import { existsSync as existsSync12, mkdirSync as mkdirSync8, readdirSync as readdirSync6 } from "fs";
17135
- import { copyFile, readFile as readFile2 } from "fs/promises";
17314
+ import { copyFile as copyFile2, readFile as readFile2 } from "fs/promises";
17136
17315
  import { join as join17 } from "path";
17137
17316
  import { getHeapStatistics } from "v8";
17138
17317
 
@@ -17438,18 +17617,20 @@ function resolveParallelWorkerTimeoutMs(enabled) {
17438
17617
  const parsed = raw ? Number(raw) : Number.NaN;
17439
17618
  return Number.isFinite(parsed) && parsed > 0 ? parsed : 3e4;
17440
17619
  }
17441
- async function captureFrameRange(session, task, captureOptions, signal, onFrameCaptured, onFrameBuffer, phaseTimeoutMs, diagnosticFor, onWorkerPhase) {
17620
+ async function captureFrameRange(session, task, captureOptions, signal, onFrameCaptured, onFrameBuffer, phaseTimeoutMs, diagnosticFor, onWorkerPhase, onWorkerOperation) {
17442
17621
  let framesCaptured = 0;
17443
17622
  const outputOffset = task.outputFrameOffset ?? 0;
17444
17623
  const stride = task.frameStride ?? 1;
17445
17624
  const runCaptureOperation = (phase, frameIndex, operation) => {
17446
- const diagnostic = diagnosticFor(phase, frameIndex);
17625
+ const diagnostic = { ...diagnosticFor(phase, frameIndex), readStep: () => session.captureStep };
17447
17626
  if (framesCaptured === 0) onWorkerPhase?.(diagnostic);
17627
+ onWorkerOperation?.(diagnostic);
17448
17628
  return withParallelWorkerDeadline(operation(), diagnostic, phaseTimeoutMs, signal);
17449
17629
  };
17450
17630
  const awaitEncode = (frameIndex, encodeResult) => {
17451
17631
  const diagnostic = diagnosticFor("frame_encode", frameIndex);
17452
17632
  if (framesCaptured === 0) onWorkerPhase?.(diagnostic);
17633
+ onWorkerOperation?.(diagnostic);
17453
17634
  return withParallelWorkerDeadline(encodeResult, diagnostic, phaseTimeoutMs, signal);
17454
17635
  };
17455
17636
  if (onFrameBuffer && session.workerEncodeEnabled) {
@@ -17595,7 +17776,7 @@ async function verifyDiskDrawElementSamples(session, task, streaming) {
17595
17776
  assertDiskSampleAboveFloor(db, verifyMinDb, idx, task.workerId);
17596
17777
  }
17597
17778
  }
17598
- async function executeWorkerTask(task, serverUrl, captureOptions, createBeforeCaptureHook, signal, onFrameCaptured, onFrameBuffer, config, parallel, onFailure, onWorkerPhase) {
17779
+ async function executeWorkerTask(task, serverUrl, captureOptions, createBeforeCaptureHook, signal, onFrameCaptured, onFrameBuffer, config, parallel, onFailure, onWorkerPhase, onWorkerOperation) {
17599
17780
  const startTime = Date.now();
17600
17781
  let framesCaptured = 0;
17601
17782
  if (!existsSync12(task.outputDir)) mkdirSync8(task.outputDir, { recursive: true });
@@ -17668,7 +17849,8 @@ async function executeWorkerTask(task, serverUrl, captureOptions, createBeforeCa
17668
17849
  onFrameBuffer,
17669
17850
  phaseTimeoutMs,
17670
17851
  diagnosticFor,
17671
- onWorkerPhase
17852
+ onWorkerPhase,
17853
+ onWorkerOperation
17672
17854
  );
17673
17855
  await verifyDiskDrawElementSamples(activeSession, task, Boolean(onFrameBuffer));
17674
17856
  perf = getCapturePerfSummary(activeSession);
@@ -17808,7 +17990,8 @@ async function executeParallelCapture(serverUrl, workDir, tasks, captureOptions,
17808
17990
  config,
17809
17991
  parallel,
17810
17992
  onFailure,
17811
- onWorkerPhase
17993
+ onWorkerPhase,
17994
+ hooks?.onWorkerOperation
17812
17995
  )
17813
17996
  )
17814
17997
  );
@@ -17843,7 +18026,7 @@ async function mergeWorkerFrames(workDir, tasks, outputDir) {
17843
18026
  try {
17844
18027
  await renameWithRetryAsync(sourcePath, targetPath);
17845
18028
  } catch {
17846
- await copyFile(sourcePath, targetPath);
18029
+ await copyFile2(sourcePath, targetPath);
17847
18030
  }
17848
18031
  });
17849
18032
  await Promise.all(copyTasks);
@@ -18247,7 +18430,7 @@ async function launchHdrBrowser(width, height) {
18247
18430
  );
18248
18431
  }
18249
18432
  const browser = await ppt.launch({
18250
- ...sigintLaunchOptions(),
18433
+ ...ownedLaunchOptions(),
18251
18434
  headless: false,
18252
18435
  executablePath: chromePath,
18253
18436
  args: withHyperframesBrowserMarker(buildHdrChromeArgs(width, height))
@@ -18392,6 +18575,7 @@ export {
18392
18575
  formatFfmpegError,
18393
18576
  describeFfmpegFailure,
18394
18577
  runFfmpeg,
18578
+ runFfprobe,
18395
18579
  declareContentAddressedUrl,
18396
18580
  declareProbeFactsUrl,
18397
18581
  PROBE_FACTS_VERSION,
@@ -18413,6 +18597,8 @@ export {
18413
18597
  readRenderProvenance,
18414
18598
  ENCODER_PRESETS,
18415
18599
  getEncoderPreset,
18600
+ keyframeIntervalToGopSize,
18601
+ appendRateCapArgs,
18416
18602
  buildEncoderArgs,
18417
18603
  encodeFramesFromDir,
18418
18604
  buildConcatArgs,
@@ -18436,6 +18622,8 @@ export {
18436
18622
  fetchPublicHttpsText,
18437
18623
  downloadToTemp,
18438
18624
  isHttpUrl,
18625
+ removeScratch,
18626
+ collectScratchLeftovers,
18439
18627
  renameWithRetry,
18440
18628
  renameWithRetryAsync,
18441
18629
  directorySizeBytes,
@@ -18451,6 +18639,7 @@ export {
18451
18639
  runVideoExtractionWithRetry,
18452
18640
  parseVideoElements,
18453
18641
  parseImageElements,
18642
+ sdrCanvasColourFilters,
18454
18643
  extractVideoFramesRange,
18455
18644
  isVideoPastTimelineEnd,
18456
18645
  rebaseVideoToWindow,