hyperframes 0.8.200 → 0.8.202

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 (194) hide show
  1. package/dist/{add-MFJDOJHQ.js → add-YC7QXNDO.js} +14 -17
  2. package/dist/{animatedGifPrep-WBZ2VVP6.js → animatedGifPrep-SFHFVFFE.js} +8 -11
  3. package/dist/api.js +16 -19
  4. package/dist/{asset-PTAQLOR6.js → asset-5E5BQ6BR.js} +2 -2
  5. package/dist/{assetCataloger-N3UGZ2RC.js → assetCataloger-F6YSU3H6.js} +8 -11
  6. package/dist/{audio-CPHWRLC4.js → audio-UZKBYVZ5.js} +33 -31
  7. package/dist/{auth-ZWOJIYK7.js → auth-5DWW5DMO.js} +2 -2
  8. package/dist/{autoUpdate-DO74673A.js → autoUpdate-D6HTQGOE.js} +2 -2
  9. package/dist/{backgroundChecks-HOAN7YB6.js → backgroundChecks-FW4MBBK2.js} +3 -3
  10. package/dist/backgroundChecksWorker.js +3 -3
  11. package/dist/{batchRender-AZFHTPSV.js → batchRender-DXD5THWY.js} +5 -7
  12. package/dist/{beats-JRMM6JQQ.js → beats-WRF4CRL7.js} +32 -23
  13. package/dist/{benchmark-2PEQUV7H.js → benchmark-NDCR2AAG.js} +11 -13
  14. package/dist/{browser-2D6IHFO6.js → browser-KSG6M66G.js} +5 -5
  15. package/dist/{bundleWithLocalizedFonts-ERB43NFP.js → bundleWithLocalizedFonts-GJ2UYZ6E.js} +2 -2
  16. package/dist/{capture-3ODEX55X.js → capture-DTF47QX3.js} +2 -2
  17. package/dist/{capture-WNC2DWF7.js → capture-FRVDEVPB.js} +15 -17
  18. package/dist/{captureCompositionFrame-JXXTHR7J.js → captureCompositionFrame-IC3MEOJR.js} +13 -16
  19. package/dist/{catalog-MHTRTKSY.js → catalog-TX3BMPOA.js} +14 -17
  20. package/dist/{catch-up-XNDRKMKL.js → catch-up-YMVIJI2W.js} +5 -5
  21. package/dist/{check-7IB355TM.js → check-2LBOZR6Z.js} +40 -43
  22. package/dist/{checkBrowser-E3ZCTAGY.js → checkBrowser-56C73ZNX.js} +34 -37
  23. package/dist/{chunk-Q5IJYX7X.js → chunk-24PUQCZO.js} +2 -2
  24. package/dist/{chunk-MMQ52NIZ.js → chunk-2BGOB2QK.js} +500 -17
  25. package/dist/{chunk-BIZPUWBG.js → chunk-3HTXEXQ6.js} +1 -1
  26. package/dist/{chunk-4VZAIVZQ.js → chunk-4OPDZMV6.js} +1 -1
  27. package/dist/{chunk-57Y5X4VU.js → chunk-5KPZ4QAS.js} +10 -12
  28. package/dist/{chunk-2LKHE32Z.js → chunk-73BGPSUW.js} +5 -5
  29. package/dist/{chunk-UUFY6A7I.js → chunk-75KIZWAD.js} +131 -92
  30. package/dist/{chunk-OE7AUN6G.js → chunk-7J4GQHSG.js} +82 -34
  31. package/dist/{chunk-4UPGPCMB.js → chunk-7KGCJQGS.js} +1 -1
  32. package/dist/{chunk-7NWSVRFE.js → chunk-ABTBAQDB.js} +1 -1
  33. package/dist/{chunk-OYVVDYM6.js → chunk-ANH7DV34.js} +10 -10
  34. package/dist/{chunk-NC3TVM27.js → chunk-AQLRXGNN.js} +6 -6
  35. package/dist/{chunk-63S4VUOL.js → chunk-AQVLMH5C.js} +1 -1
  36. package/dist/{chunk-QP4UWICL.js → chunk-B22YBW5W.js} +2 -2
  37. package/dist/{chunk-7WV27W7R.js → chunk-B2OUZUY5.js} +2 -2
  38. package/dist/chunk-B7CYKBXQ.js +36 -0
  39. package/dist/{chunk-7LRVGYKZ.js → chunk-BIV4FVEN.js} +16 -3
  40. package/dist/{chunk-WAG4AX5C.js → chunk-BU6XD7H2.js} +1 -1
  41. package/dist/{chunk-HBRPELT6.js → chunk-BUIJG2BQ.js} +3 -3
  42. package/dist/{chunk-DRTUJVLE.js → chunk-CL6ZTNQH.js} +326 -91
  43. package/dist/{chunk-3XXSRN36.js → chunk-COHU6S2X.js} +2 -2
  44. package/dist/{chunk-IC6BO4GU.js → chunk-CV32PRH3.js} +65 -21
  45. package/dist/{chunk-BERGVZKN.js → chunk-CXTXB2LZ.js} +1 -1
  46. package/dist/{chunk-OMXXJSCK.js → chunk-DMZ3SCCU.js} +108 -20
  47. package/dist/{chunk-QYQY5ACN.js → chunk-DYDFCX4L.js} +1 -1
  48. package/dist/{chunk-XOTUPVIF.js → chunk-E3F5L6AB.js} +38 -1
  49. package/dist/{chunk-63JJFXAD.js → chunk-EPZXTQOO.js} +6 -6
  50. package/dist/{chunk-VHBBV5DH.js → chunk-ERUINDRT.js} +62 -25
  51. package/dist/{chunk-FTD5QXGF.js → chunk-FWS2ZWV6.js} +2 -2
  52. package/dist/{chunk-5CTORVUM.js → chunk-GHROWWUN.js} +32 -1
  53. package/dist/{chunk-3YGSZSEN.js → chunk-GZCACSED.js} +1 -1
  54. package/dist/{chunk-32V3VHMK.js → chunk-I64A5P5H.js} +6 -43
  55. package/dist/{chunk-HXHSGDU6.js → chunk-IB6ICAI7.js} +60 -34
  56. package/dist/{chunk-D35MPIGJ.js → chunk-IKX2UHEM.js} +15 -15
  57. package/dist/{chunk-6JR2XUEE.js → chunk-IXXVS2Z4.js} +1 -1
  58. package/dist/{chunk-HN6TP4D2.js → chunk-J3CZK6PI.js} +1 -1
  59. package/dist/{chunk-ZFBET3PD.js → chunk-JCS7WFRM.js} +1 -1
  60. package/dist/{chunk-PFFR4NQV.js → chunk-JNBHYUEU.js} +8 -10
  61. package/dist/{chunk-FTUKOLLB.js → chunk-KFJMWPZT.js} +1 -1
  62. package/dist/{chunk-I6A2B3IJ.js → chunk-L5IKISP2.js} +3 -3
  63. package/dist/{chunk-G7RKSAKS.js → chunk-LEQU6P6H.js} +28 -6
  64. package/dist/{chunk-FMTJ4I6I.js → chunk-LMRTEJYY.js} +1 -1
  65. package/dist/{chunk-FZ3R5XOH.js → chunk-MO4VKSFT.js} +1 -1
  66. package/dist/{chunk-KPUTRG54.js → chunk-MS4BAXOQ.js} +2 -2
  67. package/dist/{chunk-KVFSXCN6.js → chunk-NT3L4IMM.js} +1 -1
  68. package/dist/{chunk-VFLBOKDI.js → chunk-NZEASM7M.js} +3 -3
  69. package/dist/{chunk-7D7V3UDI.js → chunk-OJDOYHPQ.js} +2 -2
  70. package/dist/chunk-PH5PJY5Z.js +39 -0
  71. package/dist/{chunk-GYSPF5ZT.js → chunk-PI256PSW.js} +27 -21
  72. package/dist/{chunk-JBQNDHRT.js → chunk-PLL6VC4F.js} +1 -1
  73. package/dist/{chunk-TOC6E65N.js → chunk-PYS6IKKM.js} +2 -2
  74. package/dist/{chunk-57GN6KWT.js → chunk-PZIWSVMO.js} +11 -1
  75. package/dist/{chunk-QDK7XCOB.js → chunk-QB4K2EWI.js} +1 -1
  76. package/dist/{chunk-IW4LKYDY.js → chunk-QDEZ7LRH.js} +3 -3
  77. package/dist/{chunk-I4VEFPZE.js → chunk-QGB5DECO.js} +1 -1
  78. package/dist/{chunk-BQA3X7TI.js → chunk-QSFWGZG6.js} +4 -6
  79. package/dist/chunk-QTGKDF7D.js +3983 -0
  80. package/dist/{chunk-QXPZGDTI.js → chunk-QXQ74PYD.js} +3 -3
  81. package/dist/{chunk-DY53XJ3P.js → chunk-QZTFCWG7.js} +1 -1
  82. package/dist/{chunk-ML4IULLQ.js → chunk-REFMKHRE.js} +10 -10
  83. package/dist/{chunk-H2X4TQVK.js → chunk-REUZB3HL.js} +7 -7
  84. package/dist/{chunk-ISN6BAZX.js → chunk-RFZJGC6V.js} +1 -1
  85. package/dist/{chunk-TDF2O2RM.js → chunk-RNLJJDGE.js} +2 -2
  86. package/dist/{chunk-5ULL3P6S.js → chunk-SQNPFWFM.js} +2 -2
  87. package/dist/{chunk-733CEBPF.js → chunk-TOFL5P27.js} +5 -5
  88. package/dist/{chunk-GR2G5L2O.js → chunk-UI7YYCN2.js} +3 -3
  89. package/dist/{chunk-TUVNQA5B.js → chunk-UMGDRGF5.js} +3 -3
  90. package/dist/{chunk-XV7ZNBVY.js → chunk-V6MTGX7B.js} +3 -3
  91. package/dist/{chunk-TTFHBTXQ.js → chunk-VOKI2HSE.js} +1 -1
  92. package/dist/{chunk-ACH5ZR7X.js → chunk-WAXBJLV6.js} +3 -3
  93. package/dist/{chunk-PGDWNIOK.js → chunk-XDMZY3H7.js} +57 -5
  94. package/dist/{chunk-VLVQQJOX.js → chunk-Z4PSJSDF.js} +22 -3
  95. package/dist/{clean-BOYUTBAU.js → clean-LFPT6GNS.js} +21 -24
  96. package/dist/cli.js +54 -54
  97. package/dist/{cloud-3O2MEZO4.js → cloud-XX5XB277.js} +4 -4
  98. package/dist/{cloudrun-MCTN22O6.js → cloudrun-ANWC6QGV.js} +7 -9
  99. package/dist/{compare-A57RHCPB.js → compare-CISKXIRF.js} +31 -34
  100. package/dist/{compiler-LVNWLZCX.js → compiler-XYZMBTYR.js} +6 -10
  101. package/dist/{component-MIJC3LWO.js → component-D4JJIDOC.js} +3 -3
  102. package/dist/{compositions-OUNZAEC3.js → compositions-UGRTLUBT.js} +13 -16
  103. package/dist/{delete-X6Q3S3SL.js → delete-TPH7N5PK.js} +2 -2
  104. package/dist/{deploy-XXMIXGUF.js → deploy-ZUXLAVVX.js} +72 -20
  105. package/dist/{deterministicFonts-RMA7GDJC.js → deterministicFonts-NQ6KL66D.js} +2 -2
  106. package/dist/{dist-ONHJ6ZDA.js → dist-TFHABY7N.js} +2 -4
  107. package/dist/{dist-2UO4RVFN.js → dist-UXLDRI4D.js} +30 -16
  108. package/dist/{doctor-ASSDEPCO.js → doctor-LVOS4EDV.js} +14 -17
  109. package/dist/{dotEnv-64S3VKGH.js → dotEnv-RPHCAUBZ.js} +1 -1
  110. package/dist/{events-DVWSV3TQ.js → events-FIWA6UBT.js} +4 -4
  111. package/dist/{events-4ULC5VUK.js → events-UHIKJIWA.js} +3 -3
  112. package/dist/{feedback-OB3NJPNF.js → feedback-SPOCVRKJ.js} +10 -12
  113. package/dist/{ffmpeg-JH3JXES2.js → ffmpeg-7SDXE5P5.js} +8 -11
  114. package/dist/{figma-GV4OGXC2.js → figma-ONGILUUE.js} +3 -3
  115. package/dist/fontLocalizeCli.js +11 -14
  116. package/dist/{get-FLMCUJGR.js → get-W7ADZ5XS.js} +2 -2
  117. package/dist/{gpuPolicy-RZ2OUY4M.js → gpuPolicy-GETTDB3G.js} +8 -11
  118. package/dist/{grade-compare-O62JAOA7.js → grade-compare-YIIQJNL3.js} +32 -35
  119. package/dist/{help-6POZ4GNV.js → help-HSKEDFT6.js} +1 -1
  120. package/dist/{history-72ZIF5WR.js → history-JS6QALDS.js} +8 -8
  121. package/dist/hyperframe.manifest.json +1 -1
  122. package/dist/hyperframe.runtime.iife.js +65 -64
  123. package/dist/hyperframes-player.global.js +3 -3
  124. package/dist/{info-GGIFZ5CT.js → info-BIIA6M7Q.js} +10 -12
  125. package/dist/{init-QYRN6HG2.js → init-TGDKBWUY.js} +29 -32
  126. package/dist/{inspect-KSL4YVIU.js → inspect-MVMUFUHY.js} +32 -35
  127. package/dist/{installer-ENQCLSJQ.js → installer-HITNNXHY.js} +6 -9
  128. package/dist/{keyframes-6PNLGKOO.js → keyframes-XJ7DUUBW.js} +7 -7
  129. package/dist/{lambda-3RFOOJV6.js → lambda-4C7APDR5.js} +24 -14
  130. package/dist/{layout-3XFC6N3L.js → layout-O3LEAM7S.js} +32 -35
  131. package/dist/{lint-5XGLCTV5.js → lint-72FKMBD2.js} +9 -11
  132. package/dist/{lintProject-FKPKSU6M.js → lintProject-Q36Y3AHA.js} +2 -4
  133. package/dist/{list-B76BTLOM.js → list-YUK5VA2D.js} +2 -2
  134. package/dist/{login-MNXS7GEL.js → login-TXBDKLOH.js} +4 -4
  135. package/dist/{manager-QZZVJV7Z.js → manager-APB2JLSH.js} +9 -12
  136. package/dist/{manager-BWU4U7DV.js → manager-F34TSFV6.js} +2 -2
  137. package/dist/{media-treatment-J3OWRCBF.js → media-treatment-GMP4JL46.js} +66 -42
  138. package/dist/{models-MCDUTV54.js → models-DW22WMQ5.js} +12 -15
  139. package/dist/{motionShot-RWEH3VWI.js → motionShot-UQJVQT76.js} +17 -20
  140. package/dist/{normalize-audio-N7VRZODX.js → normalize-audio-4KYSZBWI.js} +44 -26
  141. package/dist/{open-ROUFAVKD.js → open-HNYN6VM2.js} +14 -17
  142. package/dist/{parakeetRunner-PTVV5M44.js → parakeetRunner-SJ2QW77R.js} +13 -16
  143. package/dist/{pipeline-HN5KMORF.js → pipeline-MG2W6NIW.js} +9 -12
  144. package/dist/{play-AO7AF4Y4.js → play-ZQ6RNKIE.js} +23 -26
  145. package/dist/{preflight-ARNDDFGX.js → preflight-HSQEJNA2.js} +11 -14
  146. package/dist/{present-FBPKUC5R.js → present-7M3W5E3Q.js} +19 -22
  147. package/dist/{preview-35X5G426.js → preview-TT5Z6JK6.js} +20 -23
  148. package/dist/{producer-FVGPLR5E.js → producer-B2Y4IKZS.js} +1 -1
  149. package/dist/{projectConfig-SRUJLOHL.js → projectConfig-VZVY6ZZP.js} +8 -11
  150. package/dist/{publication-XH2BRL3V.js → publication-SRAYE6LT.js} +4 -6
  151. package/dist/{publish-RI4ZQZNT.js → publish-3QMV3Q7B.js} +11 -14
  152. package/dist/{remove-background-J22P5JFW.js → remove-background-5GA2S5OI.js} +10 -13
  153. package/dist/{render-2EZQT4IS.js → render-LN24E3OI.js} +37 -33
  154. package/dist/{render-UXYZN6D2.js → render-W3VX647V.js} +17 -17
  155. package/dist/{render-IJUKJILU.js → render-WRLXYVSQ.js} +34 -37
  156. package/dist/{render-batch-X34UZ442.js → render-batch-C73ELOQ7.js} +17 -17
  157. package/dist/renderSetupWorker.js +4 -6
  158. package/dist/{resolver-UUEIRLMY.js → resolver-ALD2ZELQ.js} +6 -8
  159. package/dist/{sherpa-FI4VNAFT.js → sherpa-AHD5UPU3.js} +12 -15
  160. package/dist/skills/hyperframes/references/runtimes.md +26 -0
  161. package/dist/skills/hyperframes-cli/references/lambda.md +1 -0
  162. package/dist/skills/media-use/references/mixing.md +1 -1
  163. package/dist/skills/media-use/scripts/lib/grade-analyzer.mjs +38 -26
  164. package/dist/{skills-LGKXQFW7.js → skills-WYJGVMR5.js} +6 -6
  165. package/dist/{skillsUpdateCheck-NDPKSX3H.js → skillsUpdateCheck-OHEGRQ2N.js} +3 -3
  166. package/dist/{snapshot-JM6427YW.js → snapshot-S6CGQACZ.js} +94 -61
  167. package/dist/{src-WEECPY6E.js → src-DAW4JYSR.js} +11 -10
  168. package/dist/{src-26NBARTO.js → src-I6WD5SMQ.js} +10 -13
  169. package/dist/{staticProjectServer-I5WGMJOV.js → staticProjectServer-3BFEACQ6.js} +19 -22
  170. package/dist/{status-SCCC7A6N.js → status-LR7VXITS.js} +1 -1
  171. package/dist/studio/assets/{hyperframes-player-LmRUJE8q.js → hyperframes-player-DnrkDR-_.js} +1 -1
  172. package/dist/studio/assets/{index-BmTWk8xf.js → index-BhFxhBMA.js} +162 -162
  173. package/dist/studio/assets/{index-CKNiEwbW.js → index-WFQeAouT.js} +1 -1
  174. package/dist/studio/index.html +1 -1
  175. package/dist/{studio-api-N774Q4NO.js → studio-api-2O6R4CM5.js} +12 -15
  176. package/dist/{studioServer-KZIM5UBJ.js → studioServer-6ZSAJBVY.js} +53 -56
  177. package/dist/{system-HV7PYIXE.js → system-YD4AW5ZX.js} +1 -1
  178. package/dist/{telemetry-JIETM7WP.js → telemetry-WFLPGSUG.js} +4 -4
  179. package/dist/{timeline-JJ6JG7GQ.js → timeline-BZJH266Q.js} +23 -25
  180. package/dist/{tokens-VOIMSCGX.js → tokens-5TX42ZMQ.js} +2 -2
  181. package/dist/{transcribe-2V23EQHD.js → transcribe-IEYR46HB.js} +18 -21
  182. package/dist/{transcribe-7BDHDQVP.js → transcribe-WPFFLNTS.js} +11 -14
  183. package/dist/{updateCheck-7B7L3UWO.js → updateCheck-TESZGKRJ.js} +2 -2
  184. package/dist/{upgrade-TUA2QZTY.js → upgrade-3EW4MYS7.js} +2 -2
  185. package/dist/{urlDownloader-CGV6EYL7.js → urlDownloader-JULHEBLS.js} +7 -10
  186. package/dist/{validate-JLCXEI2U.js → validate-RSJPGXUZ.js} +26 -29
  187. package/dist/{video-TI3EOA2D.js → video-TW4TSAM4.js} +8 -11
  188. package/dist/warmCheck.js +40 -43
  189. package/package.json +1 -1
  190. package/dist/chunk-BSQ7XANM.js +0 -210
  191. package/dist/chunk-PKZ7RK5N.js +0 -281
  192. package/dist/chunk-PW22CDII.js +0 -3901
  193. package/dist/chunk-RFQ6BIRL.js +0 -40
  194. package/dist/chunk-X7HBSTCZ.js +0 -53
@@ -12,12 +12,13 @@ import {
12
12
  firstFrameColourArgs,
13
13
  formatPreviewProxyBox,
14
14
  hdrToSdrToneMapFilter,
15
+ isHeavyForPreview,
15
16
  parseFirstFrameColour
16
- } from "./chunk-G7RKSAKS.js";
17
+ } from "./chunk-LEQU6P6H.js";
17
18
  import {
18
19
  decodeAuthoredAttribute,
19
20
  scanHtmlOpeningTags
20
- } from "./chunk-XOTUPVIF.js";
21
+ } from "./chunk-E3F5L6AB.js";
21
22
  import {
22
23
  mkdirWithinProject,
23
24
  realProjectRoot,
@@ -34,9 +35,9 @@ import {
34
35
  } from "./chunk-6BNTGNGD.js";
35
36
  import {
36
37
  rewriteAssetPath
37
- } from "./chunk-BSQ7XANM.js";
38
+ } from "./chunk-2BGOB2QK.js";
38
39
 
39
- // ../studio-server/dist/chunk-XMNHDWQI.js
40
+ // ../studio-server/dist/chunk-C2RFW2FX.js
40
41
  import { statSync } from "fs";
41
42
  import { sep } from "path";
42
43
  import { execFile } from "child_process";
@@ -124,6 +125,22 @@ async function probeFirstFrameColour(filePath, runner = execFileRunner) {
124
125
  });
125
126
  return result.status === 0 ? parseFirstFrameColour(String(result.stderr)) : {};
126
127
  }
128
+ function bitDepthOf(stream) {
129
+ const raw = Number(stream.bits_per_raw_sample);
130
+ if (Number.isFinite(raw) && raw > 0) return raw;
131
+ const suffixed = /(\d{1,3})(?:le|be)$/.exec(stream.pix_fmt ?? "");
132
+ return suffixed ? Number(suffixed[1]) : 8;
133
+ }
134
+ function sourceFactsOf(stream, formatBitrate) {
135
+ if (!stream?.width || !stream.height) return void 0;
136
+ const bitrate = Number(stream.bit_rate ?? formatBitrate);
137
+ return {
138
+ width: stream.width,
139
+ height: stream.height,
140
+ bitDepth: bitDepthOf(stream),
141
+ bitrate: Number.isFinite(bitrate) ? bitrate : 0
142
+ };
143
+ }
127
144
  async function probeMediaMetadata(filePath, runner = execFileRunner) {
128
145
  const kind = inferKindFromPath(filePath);
129
146
  if (kind === "audio" || kind === "unknown") {
@@ -139,7 +156,7 @@ async function probeMediaMetadata(filePath, runner = execFileRunner) {
139
156
  "-v",
140
157
  "error",
141
158
  "-show_entries",
142
- "stream=codec_type,codec_name,profile,pix_fmt,color_space,color_transfer,color_primaries,bits_per_raw_sample:stream_disposition=attached_pic:stream_tags=alpha_mode:format=duration",
159
+ "stream=codec_type,codec_name,profile,pix_fmt,color_space,color_transfer,color_primaries,bits_per_raw_sample,width,height,bit_rate:stream_disposition=attached_pic:stream_tags=alpha_mode:format=duration,bit_rate",
143
160
  "-of",
144
161
  "json",
145
162
  "--",
@@ -165,6 +182,7 @@ async function probeMediaMetadata(filePath, runner = execFileRunner) {
165
182
  metadata.hasAlpha = stream !== void 0 && videoStreamHasAlpha(stream);
166
183
  const duration = Number(parsed.format?.duration);
167
184
  if (Number.isFinite(duration) && duration > 0) metadata.durationSeconds = duration;
185
+ metadata.source = sourceFactsOf(stream, parsed.format?.bit_rate);
168
186
  }
169
187
  return metadata;
170
188
  } catch {
@@ -232,18 +250,22 @@ function resolveProxyVariantRequest(request, facts) {
232
250
  const expected = proxyVariantFor(facts);
233
251
  return request === "auto" || request === expected ? expected : null;
234
252
  }
235
- function decideMediaProxyEligibility(facts) {
253
+ function decideMediaProxyEligibility(facts, lightBox) {
236
254
  if (!facts) return { eligible: false, reason: "unknown_codec" };
237
- if (!facts.browserHostile) return { eligible: false, reason: "browser_safe_codec" };
238
- return { eligible: true };
255
+ if (facts.browserHostile) return { eligible: true };
256
+ if (lightBox && facts.source && isHeavyForPreview(facts.source, lightBox)) {
257
+ return { eligible: true };
258
+ }
259
+ return { eligible: false, reason: "browser_safe_codec" };
239
260
  }
240
- function codecFactsFor(codecName, hasAlpha) {
261
+ function codecFactsFor(codecName, hasAlpha, source) {
241
262
  const hostile = hostileCodecEntry(codecName);
242
263
  return {
243
264
  codecName,
244
265
  browserHostile: hostile !== void 0,
245
266
  representativeMime: hostile?.representativeMime ?? null,
246
- hasAlpha
267
+ hasAlpha,
268
+ ...source && { source }
247
269
  };
248
270
  }
249
271
  async function probeCodecFacts(filePath, runner) {
@@ -252,7 +274,7 @@ async function probeCodecFacts(filePath, runner) {
252
274
  if (metadata.kind !== "video") return null;
253
275
  const codecName = metadata.color.codecName;
254
276
  if (!codecName) return null;
255
- return codecFactsFor(codecName, metadata.hasAlpha === true);
277
+ return codecFactsFor(codecName, metadata.hasAlpha === true, metadata.source);
256
278
  }
257
279
  function createMediaCodecProbeCache() {
258
280
  return /* @__PURE__ */ new Map();
@@ -314,9 +336,8 @@ function collectLocalVideoAssets(projectDir, htmlSources) {
314
336
  return candidates;
315
337
  }
316
338
  var PROBE_CONCURRENCY = 8;
317
- async function scanProjectMediaCodecMap(projectDir, htmlSources, options = {}) {
339
+ async function probeProjectAssets(projectDir, htmlSources, options) {
318
340
  const candidates = collectLocalVideoAssets(projectDir, htmlSources);
319
- if (candidates.size === 0) return {};
320
341
  const cache = options.cache ?? defaultProbeCache;
321
342
  const entries = [...candidates.entries()];
322
343
  const facts = new Array(entries.length).fill(null);
@@ -332,31 +353,58 @@ async function scanProjectMediaCodecMap(projectDir, htmlSources, options = {}) {
332
353
  }
333
354
  })
334
355
  );
335
- const map = {};
336
- entries.forEach(([, pathname], index) => {
337
- const entryFacts = facts[index];
338
- if (entryFacts?.browserHostile) map[pathname] = entryFacts;
339
- });
340
- return map;
356
+ return entries.map(([, pathname], index) => [pathname, facts[index] ?? null]);
357
+ }
358
+ async function scanProjectMedia(projectDir, htmlSources, options = {}) {
359
+ const scan = { codecMap: {}, sourceFacts: {} };
360
+ for (const [pathname, facts] of await probeProjectAssets(projectDir, htmlSources, options)) {
361
+ if (facts?.browserHostile) scan.codecMap[pathname] = facts;
362
+ if (facts?.source) scan.sourceFacts[pathname] = facts.source;
363
+ }
364
+ return scan;
365
+ }
366
+ async function scanProjectMediaCodecMap(projectDir, htmlSources, options = {}) {
367
+ return (await scanProjectMedia(projectDir, htmlSources, options)).codecMap;
341
368
  }
342
369
 
343
- // ../studio-server/dist/chunk-URMIRXBS.js
370
+ // ../studio-server/dist/chunk-RX6VALW3.js
344
371
  import { spawn } from "child_process";
345
- import { createHash, randomUUID } from "crypto";
372
+ import { randomUUID } from "crypto";
346
373
  import {
347
- existsSync as existsSync2,
374
+ existsSync as existsSync4,
348
375
  mkdtempSync,
349
376
  renameSync,
350
- rmSync,
351
- statSync as statSync2,
377
+ rmSync as rmSync2,
352
378
  unlinkSync as unlinkSync2,
353
379
  utimesSync,
380
+ writeFileSync as writeFileSync2
381
+ } from "fs";
382
+ import { availableParallelism, tmpdir, totalmem } from "os";
383
+ import { basename as basename3, dirname as dirname3, extname as extname3, isAbsolute, join as join4, relative, resolve, sep as sep2 } from "path";
384
+ import { existsSync, readdirSync, statSync as statSync2, unlinkSync } from "fs";
385
+ import { extname as extname2, join } from "path";
386
+ import { createHash } from "crypto";
387
+ import {
388
+ closeSync,
389
+ createReadStream,
390
+ existsSync as existsSync2,
391
+ fstatSync,
392
+ openSync,
393
+ readFileSync,
394
+ statSync as statSync22,
354
395
  writeFileSync
355
396
  } from "fs";
356
- import { availableParallelism, tmpdir } from "os";
357
- import { basename, dirname, extname as extname2, isAbsolute, join as join2, relative, resolve, sep as sep2 } from "path";
358
- import { existsSync, readdirSync, statSync as statSync3, unlinkSync } from "fs";
359
- import { extname as extname3, join } from "path";
397
+ import { basename, dirname, extname as extname22, join as join2 } from "path";
398
+ import {
399
+ closeSync as closeSync2,
400
+ existsSync as existsSync3,
401
+ openSync as openSync2,
402
+ readFileSync as readFileSync2,
403
+ rmSync,
404
+ statSync as statSync3,
405
+ writeSync
406
+ } from "fs";
407
+ import { basename as basename2, dirname as dirname2, join as join3 } from "path";
360
408
  var DEFAULT_MAX_BYTES = 10 * 1024 * 1024 * 1024;
361
409
  var DEFAULT_STALE_TEMP_MS = 60 * 60 * 1e3;
362
410
  var DEFAULT_MIN_SWEEP_INTERVAL_MS = 5 * 60 * 1e3;
@@ -404,7 +452,7 @@ function readCacheInventory(cacheDir, protectedPaths, now, staleTempMs) {
404
452
  for (const dirent of readdirSync(cacheDir, { withFileTypes: true })) {
405
453
  if (!dirent.isFile()) continue;
406
454
  const path = join(cacheDir, dirent.name);
407
- const stat = statSync3(path);
455
+ const stat = statSync2(path);
408
456
  const entry = {
409
457
  path,
410
458
  size: stat.size,
@@ -415,7 +463,7 @@ function readCacheInventory(cacheDir, protectedPaths, now, staleTempMs) {
415
463
  if (leftoverIsDead(cacheDir, dirent.name, stat.mtimeMs, protectedPaths, now, staleTempMs)) {
416
464
  staleTemps.push(entry);
417
465
  }
418
- } else if (TRANSCODER_PROXY_NAME.test(dirent.name) && PROXY_EXTENSIONS.has(extname3(dirent.name))) {
466
+ } else if (TRANSCODER_PROXY_NAME.test(dirent.name) && PROXY_EXTENSIONS.has(extname2(dirent.name))) {
419
467
  entries.push(entry);
420
468
  }
421
469
  }
@@ -465,7 +513,110 @@ function cleanupProxyCache(cacheDir, options = {}) {
465
513
  skipped: false
466
514
  };
467
515
  }
468
- var PROXY_PARAMS_VERSION = "v6";
516
+ var SMALL_FILE_BYTES = 16 * 1024 * 1024;
517
+ var COPY_NAME = /^[0-9a-f]{64}\.(?:mp4|webm)$/;
518
+ function digest(...parts) {
519
+ return createHash("sha256").update(parts.join("\0")).digest("hex");
520
+ }
521
+ function boxPart(box) {
522
+ return box ? formatPreviewProxyBox(box) : "";
523
+ }
524
+ function fastCopyKey(sourcePath, version, variant, box) {
525
+ const stat = statSync22(sourcePath);
526
+ return digest(
527
+ sourcePath,
528
+ String(stat.mtimeMs),
529
+ String(stat.size),
530
+ version,
531
+ variant,
532
+ boxPart(box)
533
+ );
534
+ }
535
+ async function contentCopyKey(sourcePath, version, variant, box, signal) {
536
+ const hash = createHash("sha256");
537
+ const fd = openSync(sourcePath, "r");
538
+ try {
539
+ if (fstatSync(fd).size <= SMALL_FILE_BYTES) hash.update(readFileSync(fd));
540
+ else
541
+ for await (const chunk of createReadStream(sourcePath, { fd, autoClose: false, signal }))
542
+ hash.update(chunk);
543
+ } finally {
544
+ closeSync(fd);
545
+ }
546
+ return digest(hash.digest("hex"), version, variant, boxPart(box));
547
+ }
548
+ function fastIndexPath(cachePath) {
549
+ return join2(dirname(cachePath), `.fast-${basename(cachePath, extname22(cachePath))}`);
550
+ }
551
+ function contentIndexPath(cacheDir, contentKey) {
552
+ return join2(cacheDir, `.content-${contentKey}`);
553
+ }
554
+ function readCopyIndex(indexPath) {
555
+ try {
556
+ const name = readFileSync(indexPath, "utf8").trim();
557
+ const target = join2(dirname(indexPath), name);
558
+ return COPY_NAME.test(name) && existsSync2(target) ? target : null;
559
+ } catch {
560
+ return null;
561
+ }
562
+ }
563
+ function writeCopyIndex(indexPath, copyPath) {
564
+ writeFileSync(indexPath, basename(copyPath));
565
+ }
566
+ var POLL_MS = 500;
567
+ var UNREADABLE_LOCK_MS = 1e4;
568
+ function lockPathFor(cachePath) {
569
+ return join3(dirname2(cachePath), `.lock-${basename2(cachePath)}`);
570
+ }
571
+ function ownerIsAlive(lockPath) {
572
+ try {
573
+ const pid = Number(readFileSync2(lockPath, "utf8"));
574
+ if (!Number.isInteger(pid) || pid <= 0) {
575
+ return Date.now() - statSync3(lockPath).mtimeMs < UNREADABLE_LOCK_MS;
576
+ }
577
+ try {
578
+ process.kill(pid, 0);
579
+ return true;
580
+ } catch (err) {
581
+ return err.code === "EPERM";
582
+ }
583
+ } catch {
584
+ return false;
585
+ }
586
+ }
587
+ function pause(ms, signal) {
588
+ return new Promise((resolve2, reject) => {
589
+ const timer = setTimeout(() => {
590
+ signal.removeEventListener("abort", onAbort);
591
+ resolve2();
592
+ }, ms);
593
+ const onAbort = () => {
594
+ clearTimeout(timer);
595
+ reject(signal.reason);
596
+ };
597
+ signal.addEventListener("abort", onAbort, { once: true });
598
+ });
599
+ }
600
+ async function acquireCopyLock(cachePath, signal) {
601
+ const lockPath = lockPathFor(cachePath);
602
+ for (; ; ) {
603
+ signal.throwIfAborted();
604
+ if (existsSync3(cachePath)) return null;
605
+ try {
606
+ const fd = openSync2(lockPath, "wx");
607
+ writeSync(fd, String(process.pid));
608
+ closeSync2(fd);
609
+ if (!existsSync3(cachePath)) return () => rmSync(lockPath, { force: true });
610
+ rmSync(lockPath, { force: true });
611
+ return null;
612
+ } catch (err) {
613
+ if (err.code !== "EEXIST") throw err;
614
+ }
615
+ if (ownerIsAlive(lockPath)) await pause(POLL_MS, signal);
616
+ else rmSync(lockPath, { force: true });
617
+ }
618
+ }
619
+ var PROXY_PARAMS_VERSION = "v7";
469
620
  var CACHE_DIR_NAME = ".transcode-cache";
470
621
  function boundedEnvInteger(name, fallback, min, max) {
471
622
  const raw = process.env[name]?.trim();
@@ -556,33 +707,16 @@ function canonicalizeProxySource(projectDir, absoluteSourcePath) {
556
707
  if (requestedRelativePath === ".." || requestedRelativePath.startsWith(`..${sep2}`) || isAbsolute(requestedRelativePath)) {
557
708
  throw new ProxySourceOutsideProjectError();
558
709
  }
559
- const canonicalProjectDir = realProjectRoot(projectDir);
560
- const canonicalSourcePath = realpath(absoluteSourcePath);
561
- const canonicalRelativePath = relative(canonicalProjectDir, canonicalSourcePath);
562
- const sourceIsInsideCanonicalProject = canonicalRelativePath !== ".." && !canonicalRelativePath.startsWith(`..${sep2}`) && !isAbsolute(canonicalRelativePath);
563
- return {
564
- projectDir: canonicalProjectDir,
565
- sourcePath: canonicalSourcePath,
566
- relativePath: requestedRelativePath.normalize("NFC"),
567
- // An external target needs a stable identity in addition to its project-local
568
- // symlink path, otherwise retargeting the link can reuse an unrelated proxy.
569
- cacheIdentity: (sourceIsInsideCanonicalProject ? canonicalRelativePath : canonicalSourcePath).normalize("NFC")
570
- };
571
- }
572
- function buildProxyCacheKey(source, variant, box) {
573
- const stat = statSync2(source.sourcePath);
574
- const size = box ? `\0${formatPreviewProxyBox(box)}` : "";
575
- return createHash("sha256").update(
576
- `${source.relativePath}\0${source.cacheIdentity}\0${stat.mtimeMs}\0${stat.size}\0${PROXY_PARAMS_VERSION}\0${variant}${size}`
577
- ).digest("hex");
710
+ return { projectDir: realProjectRoot(projectDir), sourcePath: realpath(absoluteSourcePath) };
578
711
  }
579
712
  function getCanonicalProxyCachePath(source, variant, box) {
580
- const key = buildProxyCacheKey(source, variant, box);
581
- return join2(
713
+ const key = fastCopyKey(source.sourcePath, PROXY_PARAMS_VERSION, variant, box);
714
+ const made = join4(
582
715
  source.projectDir,
583
716
  CACHE_DIR_NAME,
584
717
  `${key}${PROXY_VARIANT_CONFIG[variant].extension}`
585
718
  );
719
+ return existsSync4(made) ? made : readCopyIndex(fastIndexPath(made)) ?? made;
586
720
  }
587
721
  function getProxyCachePath(projectDir, absoluteSourcePath, variant = "h264", box) {
588
722
  return getCanonicalProxyCachePath(
@@ -738,42 +872,106 @@ function chunkRanges(durationSeconds) {
738
872
  lengthSeconds: index === count - 1 ? durationSeconds - index * PROXY_CHUNK_SECONDS : PROXY_CHUNK_SECONDS
739
873
  }));
740
874
  }
741
- async function encodeInChunks(ranges, chunkPrefix, tempPath, encode, concat, onDone = () => {
875
+ var UNGATED = { size: 1, acquire: async () => {
876
+ }, release: () => {
877
+ } };
878
+ function createPieceGate(size) {
879
+ let free = size;
880
+ const waiters = [];
881
+ return {
882
+ size,
883
+ acquire: (signal) => {
884
+ signal.throwIfAborted();
885
+ if (free > 0) {
886
+ free--;
887
+ return Promise.resolve();
888
+ }
889
+ return new Promise((resolve2, reject) => {
890
+ const grant = () => {
891
+ signal.removeEventListener("abort", onAbort);
892
+ resolve2();
893
+ };
894
+ const onAbort = () => {
895
+ waiters.splice(waiters.indexOf(grant), 1);
896
+ reject(signal.reason);
897
+ };
898
+ signal.addEventListener("abort", onAbort, { once: true });
899
+ waiters.push(grant);
900
+ });
901
+ },
902
+ release: () => {
903
+ const next = waiters.shift();
904
+ if (next) next();
905
+ else free++;
906
+ }
907
+ };
908
+ }
909
+ async function encodeInChunks(ranges, chunkPrefix, tempPath, encode, concat, signal, gate, onDone = () => {
742
910
  }) {
743
- const extension = extname2(tempPath);
911
+ const extension = extname3(tempPath);
744
912
  const pieces = ranges.map((_, index) => `${chunkPrefix}${index}${extension}`);
913
+ const pending = ranges.flatMap((_, index) => existsSync4(pieces[index]) ? [] : [index]);
745
914
  let doneSeconds = 0;
746
915
  for (const [index, range] of ranges.entries()) {
747
- if (existsSync2(pieces[index])) doneSeconds += range.lengthSeconds;
916
+ if (!pending.includes(index)) doneSeconds += range.lengthSeconds;
748
917
  }
749
918
  if (doneSeconds) onDone(doneSeconds);
750
- for (const [index, range] of ranges.entries()) {
751
- const piece = pieces[index];
752
- if (existsSync2(piece)) continue;
753
- const pieceTemp = join2(dirname(piece), `.tmp-${randomUUID()}-${basename(piece)}`);
754
- try {
755
- await encode(pieceTemp, range);
756
- renameSync(pieceTemp, piece);
757
- doneSeconds += range.lengthSeconds;
758
- onDone(doneSeconds);
759
- } finally {
760
- if (existsSync2(pieceTemp)) unlinkSync2(pieceTemp);
919
+ const inFlight2 = /* @__PURE__ */ new Map();
920
+ const stop = new AbortController();
921
+ const pieceSignal = AbortSignal.any([signal, stop.signal]);
922
+ let failure;
923
+ let cursor = 0;
924
+ const work = async () => {
925
+ for (; ; ) {
926
+ await gate.acquire(pieceSignal);
927
+ try {
928
+ if (cursor >= pending.length) return;
929
+ const index = pending[cursor++];
930
+ const range = ranges[index];
931
+ const piece = pieces[index];
932
+ const pieceTemp = join4(dirname3(piece), `.tmp-${randomUUID()}-${basename3(piece)}`);
933
+ try {
934
+ await encode(pieceTemp, range, pieceSignal, (encodedSeconds) => {
935
+ inFlight2.set(index, encodedSeconds);
936
+ onDone(doneSeconds + [...inFlight2.values()].reduce((sum, seconds) => sum + seconds, 0));
937
+ });
938
+ renameSync(pieceTemp, piece);
939
+ inFlight2.delete(index);
940
+ doneSeconds += range.lengthSeconds;
941
+ onDone(doneSeconds);
942
+ } finally {
943
+ if (existsSync4(pieceTemp)) unlinkSync2(pieceTemp);
944
+ }
945
+ } finally {
946
+ gate.release();
947
+ }
761
948
  }
762
- }
763
- const listDir = mkdtempSync(join2(tmpdir(), "hf-proxy-join-"));
949
+ };
950
+ await Promise.all(
951
+ Array.from(
952
+ { length: Math.min(gate.size, pending.length) },
953
+ () => work().catch((error) => {
954
+ failure ??= error;
955
+ stop.abort();
956
+ })
957
+ )
958
+ );
959
+ if (failure !== void 0) throw failure;
960
+ const listDir = mkdtempSync(join4(tmpdir(), "hf-proxy-join-"));
764
961
  try {
765
- const listPath = join2(listDir, "pieces.txt");
766
- writeFileSync(
962
+ const listPath = join4(listDir, "pieces.txt");
963
+ writeFileSync2(
767
964
  listPath,
768
965
  pieces.map((piece) => `file '${piece.replace(/\\/g, "/").replace(/'/g, "'\\''")}'
769
966
  `).join("")
770
967
  );
771
968
  await concat(listPath, tempPath);
772
969
  } finally {
773
- rmSync(listDir, { recursive: true, force: true });
970
+ rmSync2(listDir, { recursive: true, force: true });
774
971
  }
775
- for (const piece of pieces) if (existsSync2(piece)) unlinkSync2(piece);
972
+ for (const piece of pieces) if (existsSync4(piece)) unlinkSync2(piece);
776
973
  }
974
+ var KEYFRAME_EVERY_SECOND_ARGS = ["-force_key_frames", "expr:gte(t,n_forced*1)"];
777
975
  var H264_ARGS = [
778
976
  "-c:v",
779
977
  "libx264",
@@ -796,7 +994,11 @@ var H264_ARGS = [
796
994
  "-movflags",
797
995
  "+faststart"
798
996
  ];
799
- var VP8_THREADS = String(Math.min(4, availableParallelism()));
997
+ var CORES = availableParallelism();
998
+ var PIECE_MEMORY_BYTES = 3 * 1024 ** 3;
999
+ var ALPHA_PIECE_GATE = createPieceGate(
1000
+ Math.max(1, Math.min(4, CORES - 1, Math.floor(totalmem() / PIECE_MEMORY_BYTES)))
1001
+ );
800
1002
  var VP8_ARGS = [
801
1003
  "-c:v",
802
1004
  "libvpx",
@@ -816,8 +1018,6 @@ var VP8_ARGS = [
816
1018
  "bt709",
817
1019
  "-cpu-used",
818
1020
  "4",
819
- "-threads",
820
- VP8_THREADS,
821
1021
  "-auto-alt-ref",
822
1022
  "0",
823
1023
  "-metadata:s:v:0",
@@ -851,7 +1051,12 @@ async function runFfmpeg(sourcePath, outputPath, chunkPrefix, variant, box, sign
851
1051
  const alphaDecoder = keepsAlpha ? alphaDecoderFor(metadata.color.codecName) : null;
852
1052
  const decoderArgs = alphaDecoder ? ["-c:v", alphaDecoder] : [];
853
1053
  const totalSeconds = metadata.durationSeconds;
854
- const encode = (target, range) => spawnFfmpeg(
1054
+ const gate = keepsAlpha ? ALPHA_PIECE_GATE : UNGATED;
1055
+ const vp8Threads = (pieces) => [
1056
+ "-threads",
1057
+ String(Math.min(4, Math.floor(CORES / pieces)))
1058
+ ];
1059
+ const encode = (target, range, pieceSignal, onEncoded) => spawnFfmpeg(
855
1060
  ffmpegPath,
856
1061
  [
857
1062
  "-y",
@@ -865,21 +1070,31 @@ async function runFfmpeg(sourcePath, outputPath, chunkPrefix, variant, box, sign
865
1070
  ...range ? ["-t", String(range.lengthSeconds)] : [],
866
1071
  "-vf",
867
1072
  videoFilter,
868
- ...variant === "vp8" ? VP8_ARGS : H264_ARGS,
1073
+ ...KEYFRAME_EVERY_SECOND_ARGS,
1074
+ ...keepsAlpha ? [...VP8_ARGS, ...vp8Threads(range ? gate.size : 1)] : H264_ARGS,
869
1075
  target
870
1076
  ],
871
1077
  TRANSCODE_STALL_MS,
872
- signal,
873
- (encodedSeconds) => onProgress({ doneSeconds: (range?.startSeconds ?? 0) + encodedSeconds, totalSeconds })
1078
+ pieceSignal,
1079
+ onEncoded
874
1080
  );
875
1081
  const ranges = chunkRanges(totalSeconds);
876
- if (!ranges) return encode(outputPath);
1082
+ if (!ranges) {
1083
+ return encode(
1084
+ outputPath,
1085
+ void 0,
1086
+ signal,
1087
+ (encodedSeconds) => onProgress({ doneSeconds: encodedSeconds, totalSeconds })
1088
+ );
1089
+ }
877
1090
  await encodeInChunks(
878
1091
  ranges,
879
1092
  chunkPrefix,
880
1093
  outputPath,
881
1094
  encode,
882
1095
  (listPath, target) => spawnFfmpeg(ffmpegPath, concatArgs(listPath, target, variant), CONCAT_TIMEOUT_MS, signal),
1096
+ signal,
1097
+ gate,
883
1098
  (doneSeconds) => onProgress({ doneSeconds, totalSeconds })
884
1099
  );
885
1100
  }
@@ -974,14 +1189,31 @@ function spawnFfmpeg(ffmpegPath, args, stallMs, signal, onProgress) {
974
1189
  async function transcodeToCache(job, projectDir, absoluteSourcePath, cachePath, variant, box) {
975
1190
  await acquireSlot(job);
976
1191
  try {
977
- if (existsSync2(cachePath)) return cachePath;
978
- const cacheDir = dirname(cachePath);
1192
+ if (existsSync4(cachePath)) return cachePath;
1193
+ const cacheDir = dirname3(cachePath);
979
1194
  mkdirWithinProject(projectDir, cacheDir);
980
- const tempPath = join2(cacheDir, `.tmp-${randomUUID()}-${basename(cachePath)}`);
1195
+ const contentIndex = contentIndexPath(
1196
+ cacheDir,
1197
+ await contentCopyKey(
1198
+ absoluteSourcePath,
1199
+ PROXY_PARAMS_VERSION,
1200
+ variant,
1201
+ box,
1202
+ job.abandoned.signal
1203
+ )
1204
+ );
1205
+ const sameContent = readCopyIndex(contentIndex);
1206
+ if (sameContent) {
1207
+ writeCopyIndex(fastIndexPath(cachePath), sameContent);
1208
+ return sameContent;
1209
+ }
1210
+ const release = await acquireCopyLock(cachePath, job.abandoned.signal);
1211
+ if (!release) return cachePath;
1212
+ const tempPath = join4(cacheDir, `.tmp-${randomUUID()}-${basename3(cachePath)}`);
981
1213
  try {
982
- const chunkPrefix = join2(
1214
+ const chunkPrefix = join4(
983
1215
  cacheDir,
984
- `${CHUNK_PREFIX}${basename(cachePath, extname2(cachePath))}-`
1216
+ `${CHUNK_PREFIX}${basename3(cachePath, extname3(cachePath))}-`
985
1217
  );
986
1218
  await runFfmpeg(
987
1219
  absoluteSourcePath,
@@ -993,10 +1225,12 @@ async function transcodeToCache(job, projectDir, absoluteSourcePath, cachePath,
993
1225
  (progress) => reportProgress(job, progress)
994
1226
  );
995
1227
  renameSync(tempPath, cachePath);
1228
+ writeCopyIndex(contentIndex, cachePath);
996
1229
  maintainProxyCache(cacheDir);
997
1230
  return cachePath;
998
1231
  } finally {
999
- if (existsSync2(tempPath)) unlinkSync2(tempPath);
1232
+ if (existsSync4(tempPath)) unlinkSync2(tempPath);
1233
+ release();
1000
1234
  }
1001
1235
  } finally {
1002
1236
  releaseSlot();
@@ -1004,8 +1238,8 @@ async function transcodeToCache(job, projectDir, absoluteSourcePath, cachePath,
1004
1238
  }
1005
1239
  var proxyActivity = 0;
1006
1240
  function proxyActivityMark(projectDir) {
1007
- if (!existsSync2(projectDir)) return String(proxyActivity);
1008
- const cacheDir = join2(realpath(projectDir), CACHE_DIR_NAME) + sep2;
1241
+ if (!existsSync4(projectDir)) return String(proxyActivity);
1242
+ const cacheDir = join4(realpath(projectDir), CACHE_DIR_NAME) + sep2;
1009
1243
  for (const cachePath of inFlight.keys()) if (cachePath.startsWith(cacheDir)) return null;
1010
1244
  return String(proxyActivity);
1011
1245
  }
@@ -1013,9 +1247,9 @@ async function resolveProxy(projectDir, absoluteSourcePath, variant = "h264", bo
1013
1247
  options.signal?.throwIfAborted();
1014
1248
  const source = canonicalizeProxySource(projectDir, absoluteSourcePath);
1015
1249
  const cachePath = getCanonicalProxyCachePath(source, variant, box);
1016
- if (existsSync2(cachePath)) {
1250
+ if (existsSync4(cachePath)) {
1017
1251
  markCacheEntryUsed(cachePath);
1018
- maintainProxyCache(dirname(cachePath));
1252
+ maintainProxyCache(dirname3(cachePath));
1019
1253
  return cachePath;
1020
1254
  }
1021
1255
  const rememberedFailure = failedTranscodes.get(cachePath);
@@ -1072,7 +1306,7 @@ async function resolveProxies(projectDir, sources, onSettled = () => {
1072
1306
  const first = sources[0];
1073
1307
  if (first) {
1074
1308
  maintainProxyCache(
1075
- dirname(getProxyCachePath(projectDir, first.sourcePath, first.variant)),
1309
+ dirname3(getProxyCachePath(projectDir, first.sourcePath, first.variant)),
1076
1310
  Math.min(
1077
1311
  Number(process.env.HYPERFRAMES_PROXY_CACHE_STALE_TEMP_MS) || UNTOUCHED_TEMP_IS_DEAD_MS,
1078
1312
  UNTOUCHED_TEMP_IS_DEAD_MS
@@ -1123,6 +1357,7 @@ export {
1123
1357
  decideMediaProxyEligibility,
1124
1358
  createMediaCodecProbeCache,
1125
1359
  probeAssetCodec,
1360
+ scanProjectMedia,
1126
1361
  scanProjectMediaCodecMap,
1127
1362
  cleanupProxyCache,
1128
1363
  PROXY_PARAMS_VERSION,
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  resolveConfig,
9
9
  usesSoftwareWebGpu
10
- } from "./chunk-UUFY6A7I.js";
10
+ } from "./chunk-75KIZWAD.js";
11
11
 
12
12
  // src/browser/gpuPolicy.ts
13
13
  function resolveLocalBrowserGpuMode(browserGpuArg, envMode = process.env.PRODUCER_BROWSER_GPU_MODE) {
@@ -17,7 +17,7 @@ function resolveLocalBrowserGpuMode(browserGpuArg, envMode = process.env.PRODUCE
17
17
  return "auto";
18
18
  }
19
19
  async function resolveCaptureBrowserGpuMode(requestedMode, chromePath, probeLifecycle) {
20
- const { resolveBrowserGpuMode } = await import("./src-WEECPY6E.js");
20
+ const { resolveBrowserGpuMode } = await import("./src-DAW4JYSR.js");
21
21
  return resolveBrowserGpuMode(requestedMode, { chromePath, probeLifecycle });
22
22
  }
23
23
  function resolveLocalWebGpu(browserGpuMode, requiresWebGpu) {