hyperframes 0.8.139 → 0.8.141

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 (200) hide show
  1. package/dist/{add-VYJQ4S3P.js → add-KH2CF4FD.js} +20 -22
  2. package/dist/{animatedGifPrep-IBMW6FZB.js → animatedGifPrep-QO4BSKR7.js} +15 -8
  3. package/dist/{asset-FLSUS73X.js → asset-4RDZILVJ.js} +3 -3
  4. package/dist/{assetCataloger-TGD7TRCR.js → assetCataloger-WGR4LYYN.js} +6 -3
  5. package/dist/{auth-EZXIN4M4.js → auth-WYQCOYE5.js} +7 -7
  6. package/dist/{autoUpdate-ZPMY5T3X.js → autoUpdate-PC5TN3NL.js} +2 -2
  7. package/dist/{backgroundChecks-JIDTAUFE.js → backgroundChecks-7M3T44EP.js} +3 -3
  8. package/dist/backgroundChecksWorker.js +3 -3
  9. package/dist/{batchRender-FNZ6TJYY.js → batchRender-GOLLOE4V.js} +11 -8
  10. package/dist/beat-analyzer.global.js +5 -2
  11. package/dist/{beats-EAA4U3YN.js → beats-XJ7WP6QS.js} +24 -17
  12. package/dist/{benchmark-KKZQVK2Y.js → benchmark-HCGFBEZJ.js} +20 -23
  13. package/dist/{browser-ZIVVJLJT.js → browser-VQKO2FKG.js} +14 -28
  14. package/dist/{bundleWithLocalizedFonts-2XWC3PEM.js → bundleWithLocalizedFonts-FH7PHTTX.js} +5 -5
  15. package/dist/{capture-EFYPXI42.js → capture-TFZZSF6F.js} +22 -15
  16. package/dist/{capture-MKJHABUL.js → capture-XD3P3YQR.js} +2 -2
  17. package/dist/{catalog-EWX4BBI2.js → catalog-4S33QWJJ.js} +28 -30
  18. package/dist/{catch-up-FJFH7T4W.js → catch-up-RW7YXXNT.js} +11 -25
  19. package/dist/{check-YJNVDCBP.js → check-XVTRRN4Y.js} +72 -54
  20. package/dist/{checkBrowser-I6SPPEGD.js → checkBrowser-HZXJ2EDU.js} +81 -36
  21. package/dist/chunk-24OWOBQH.js +3656 -0
  22. package/dist/{chunk-OENM2JVZ.js → chunk-34TXESM7.js} +3 -3
  23. package/dist/{chunk-GWV2Y36Q.js → chunk-35RSNI77.js} +5 -106
  24. package/dist/{chunk-BC3OY2ED.js → chunk-3A5AAPMP.js} +1 -1
  25. package/dist/{chunk-U3HX7WE6.js → chunk-3NBKW2QJ.js} +1 -1
  26. package/dist/{chunk-A4X2YWNQ.js → chunk-4BB7V6AI.js} +38 -301
  27. package/dist/{chunk-EJ7OWYF2.js → chunk-6E6CM7WS.js} +19 -163
  28. package/dist/{chunk-CDMB3PRC.js → chunk-6IFXWJDX.js} +7 -7
  29. package/dist/{chunk-Z67RZ4XO.js → chunk-6Q6FR4KH.js} +279 -1968
  30. package/dist/{chunk-R4QIE6UY.js → chunk-7M4KAPAA.js} +92 -31
  31. package/dist/{chunk-25DHUDOK.js → chunk-7XTZVLE6.js} +12 -3
  32. package/dist/chunk-A4KQZXZI.js +116 -0
  33. package/dist/{chunk-DUQJF7FK.js → chunk-A7YQNIQT.js} +8 -8
  34. package/dist/{chunk-XOZ3J3LB.js → chunk-AVWEIOEN.js} +1 -1
  35. package/dist/{chunk-UQXOHEQ7.js → chunk-BM5PX3DJ.js} +4 -4
  36. package/dist/{chunk-SHB5VDMH.js → chunk-BRITLL56.js} +1 -1
  37. package/dist/{chunk-JX7Y57YY.js → chunk-E4BSCXMU.js} +1 -1
  38. package/dist/{chunk-QXOFUKBF.js → chunk-E6SDW5FV.js} +168 -165
  39. package/dist/{chunk-JH556Q42.js → chunk-EDYBFSPE.js} +2 -2
  40. package/dist/{chunk-R7LWDIKB.js → chunk-EKA4ZZBI.js} +1 -1
  41. package/dist/chunk-FXMKHHPO.js +123 -0
  42. package/dist/chunk-G75ENCEZ.js +283 -0
  43. package/dist/{chunk-PLNWWGE7.js → chunk-GQJZORQP.js} +1 -1
  44. package/dist/{chunk-U3GEXWI5.js → chunk-GS6FE3IW.js} +1 -1
  45. package/dist/{chunk-Y6W4DVPS.js → chunk-HKCNZITN.js} +1 -1
  46. package/dist/{chunk-HOIHGPWO.js → chunk-IKVBTDLO.js} +1 -1
  47. package/dist/{chunk-YOL4QRSL.js → chunk-INI3TM6I.js} +2 -2
  48. package/dist/{chunk-SIKMUO45.js → chunk-IO7ZIDRP.js} +12 -12
  49. package/dist/{chunk-W7SAWBQC.js → chunk-IV7EI5E2.js} +1 -1
  50. package/dist/{chunk-TCWL4BKK.js → chunk-IYFKBFTW.js} +1 -1
  51. package/dist/{chunk-JIIIBTN2.js → chunk-J5IPIQU2.js} +1 -1
  52. package/dist/chunk-JFKL3WAE.js +161 -0
  53. package/dist/{chunk-IBRZUVTH.js → chunk-K2GOFLTX.js} +2 -2
  54. package/dist/{chunk-X3TMMIDP.js → chunk-KFH6UD26.js} +8 -8
  55. package/dist/{chunk-O6K5DWXM.js → chunk-KOEWEFHK.js} +1 -1
  56. package/dist/{chunk-VTVS4IIP.js → chunk-L3JSAB4L.js} +2 -2
  57. package/dist/{chunk-3RT6D4P6.js → chunk-N77KD7ZZ.js} +1 -1
  58. package/dist/{chunk-FLRCVYNE.js → chunk-NORZWWLK.js} +2 -2
  59. package/dist/{chunk-4VZBKOQJ.js → chunk-O3SKIXQK.js} +1 -1
  60. package/dist/{chunk-PFI3VD77.js → chunk-OLDDJS3S.js} +10 -10
  61. package/dist/{chunk-UGI77E35.js → chunk-P6E4HFFU.js} +167 -61
  62. package/dist/{chunk-GIDHR5OL.js → chunk-Q65ZQFF2.js} +1 -1
  63. package/dist/chunk-QZ3AZTXI.js +1740 -0
  64. package/dist/{chunk-NTIOLSFE.js → chunk-R7UDXKI3.js} +3 -3
  65. package/dist/{chunk-7SI7GCX6.js → chunk-RCFCZT5O.js} +6 -6
  66. package/dist/{chunk-DW32KBHN.js → chunk-RPYPW5NN.js} +13 -13
  67. package/dist/chunk-SYKKFAUW.js +3711 -0
  68. package/dist/chunk-T76PLPD6.js +57 -0
  69. package/dist/{chunk-JTAYFSLO.js → chunk-TC2FBZJZ.js} +1 -1
  70. package/dist/{chunk-Q73ISOVQ.js → chunk-U7E736AJ.js} +1 -1
  71. package/dist/chunk-USDEMXXL.js +110 -0
  72. package/dist/{chunk-UMWROSIP.js → chunk-W6HTOVHU.js} +2 -2
  73. package/dist/{chunk-STA43FMY.js → chunk-WY5OODN5.js} +71 -3855
  74. package/dist/{chunk-EZ2P7LAP.js → chunk-XDSOIJC3.js} +8 -8
  75. package/dist/{chunk-ZTZ7NCJT.js → chunk-XTFJOR3K.js} +1 -1
  76. package/dist/{chunk-CDJ7FPPJ.js → chunk-XWVGSEUT.js} +1 -1
  77. package/dist/chunk-YA62XGXS.js +45 -0
  78. package/dist/{chunk-EH4VUY27.js → chunk-YURXPGAM.js} +2 -2
  79. package/dist/{clean-P4KTCOUA.js → clean-L2E4VD57.js} +29 -20
  80. package/dist/cli.js +55 -55
  81. package/dist/{cloud-PDY7S4HU.js → cloud-IDUQRYLO.js} +7 -7
  82. package/dist/{cloudrun-54MA2W5H.js → cloudrun-R3JXWXGG.js} +11 -8
  83. package/dist/commands/layout-audit.browser.js +37 -8
  84. package/dist/commands/motion-signature.browser.js +51 -2
  85. package/dist/{compare-LDWVSPC5.js → compare-VYBWSP3Y.js} +40 -31
  86. package/dist/{compiler-CWSZ4W7J.js → compiler-ACHWOU5N.js} +7 -3
  87. package/dist/{component-FIEGC22U.js → component-PYYV2V3F.js} +4 -4
  88. package/dist/{compositions-JR7PX356.js → compositions-B5GQSXH7.js} +23 -16
  89. package/dist/{delete-FXA2IHOS.js → delete-EAX2U3WI.js} +8 -8
  90. package/dist/{deterministicFonts-GTITFRSJ.js → deterministicFonts-F6WIVL2W.js} +1 -1
  91. package/dist/{dist-OJTEVNJR.js → dist-NZSQCYOF.js} +3 -1
  92. package/dist/{dist-4JZWRWS6.js → dist-ROUDWGLO.js} +27 -15
  93. package/dist/{doctor-OTDHPM6K.js → doctor-PJX7MLFG.js} +20 -13
  94. package/dist/{events-UAFTI24U.js → events-SBC54MHO.js} +6 -22
  95. package/dist/{events-6T7M2VCO.js → events-YFFXKAQQ.js} +10 -23
  96. package/dist/{feedback-ZGZODHB6.js → feedback-UETLWREV.js} +67 -45
  97. package/dist/{figma-D26EJ7ZB.js → figma-QDSJPIRW.js} +6 -6
  98. package/dist/fontLocalizeCli.js +18 -11
  99. package/dist/{get-IAREU7IK.js → get-B5TS6C7H.js} +8 -8
  100. package/dist/{gpuPolicy-NS7WZRDJ.js → gpuPolicy-LYOVBAJP.js} +15 -8
  101. package/dist/{grade-compare-ZXHFHCD2.js → grade-compare-LBIHMAUN.js} +40 -31
  102. package/dist/{help-RVNYHW3N.js → help-XBP6A6LT.js} +4 -4
  103. package/dist/{history-THP4VNMF.js → history-2S42ZXKL.js} +12 -30
  104. package/dist/hyperframe-runtime.js +59 -59
  105. package/dist/hyperframe.manifest.json +1 -1
  106. package/dist/hyperframe.runtime.iife.js +59 -59
  107. package/dist/hyperframes-player.global.js +3 -3
  108. package/dist/{info-EOFRHN5A.js → info-I2VDAWT7.js} +17 -20
  109. package/dist/{init-YLIJE4CG.js → init-BGHSDODI.js} +48 -41
  110. package/dist/{inspect-3D56ONJD.js → inspect-MZK5B5RP.js} +39 -30
  111. package/dist/{installer-GRR2GDZK.js → installer-LL4QAKFW.js} +8 -5
  112. package/dist/{keyframes-NXNCTQPK.js → keyframes-2EBF7OSS.js} +14 -25
  113. package/dist/{lambda-VGRZD7TR.js → lambda-XKFPAOFE.js} +16 -13
  114. package/dist/{layout-Z5DOS6DU.js → layout-TP5ERKEF.js} +39 -30
  115. package/dist/{lint-YD6NJGR2.js → lint-FQ6CEI7E.js} +17 -23
  116. package/dist/{lintProject-ANMPLBIT.js → lintProject-LM3XZRPZ.js} +3 -1
  117. package/dist/{list-XGDKILYN.js → list-FRNUJXZ3.js} +8 -8
  118. package/dist/{login-GD5SA4RD.js → login-C25QU3BQ.js} +9 -9
  119. package/dist/{logout-Q654A3SI.js → logout-GJXZQKOA.js} +5 -5
  120. package/dist/{media-treatment-TY4X4GQQ.js → media-treatment-DCANGWSV.js} +21 -20
  121. package/dist/{models-MXRDH4WJ.js → models-GOD6ARB3.js} +19 -12
  122. package/dist/{motionShot-6LKR3C2E.js → motionShot-FSKETANX.js} +22 -15
  123. package/dist/{normalize-O76AC4HE.js → normalize-IGLHCWTF.js} +0 -4
  124. package/dist/{normalize-audio-5ADDZKPJ.js → normalize-audio-C2IM7OID.js} +13 -26
  125. package/dist/{open-JXAMO325.js → open-VVISXIII.js} +11 -25
  126. package/dist/{pipeline-Q5MOPIIX.js → pipeline-7YHZPYIS.js} +15 -8
  127. package/dist/{play-3SPH5GWZ.js → play-DSELK7G3.js} +38 -32
  128. package/dist/{preflight-2PWAPKWC.js → preflight-Y5DN5D37.js} +3 -18
  129. package/dist/{present-ZTJQDKXZ.js → present-N72YFDKP.js} +32 -26
  130. package/dist/{preview-4A3XZR6J.js → preview-XTYN4NJ2.js} +33 -26
  131. package/dist/{producer-5ZKKKQPB.js → producer-NDCU3MHK.js} +1 -1
  132. package/dist/{projectConfig-WA4CS4SN.js → projectConfig-MH4QU4AC.js} +10 -7
  133. package/dist/{publication-CLG2FRRI.js → publication-KUSHI5MG.js} +6 -3
  134. package/dist/{publish-YTT2WMXO.js → publish-3XEEFWMF.js} +27 -20
  135. package/dist/{refresh-K24ETHMA.js → refresh-MFITBIKV.js} +5 -5
  136. package/dist/{remove-background-W35INR3B.js → remove-background-2QKJ7XOD.js} +22 -15
  137. package/dist/{render-WUBFQMAH.js → render-2DVYTVLQ.js} +52 -32
  138. package/dist/{render-7A4P5WMU.js → render-75E342ZU.js} +10 -7
  139. package/dist/{render-KICXUPNR.js → render-S73DW4KK.js} +23 -26
  140. package/dist/{render-batch-N7EFGE6S.js → render-batch-YURBS54Q.js} +11 -8
  141. package/dist/{renderCancellation-LYQPPFAO.js → renderCancellation-373ASJTO.js} +15 -8
  142. package/dist/renderSetupWorker.js +4 -2
  143. package/dist/{resolver-YTT2NENF.js → resolver-FE3GBZ4T.js} +8 -5
  144. package/dist/{sherpa-353MW4UV.js → sherpa-B2D3AGP6.js} +16 -9
  145. package/dist/skills/hyperframes/references/capability-menu.md +1 -1
  146. package/dist/skills/hyperframes-cli/SKILL.md +5 -0
  147. package/dist/skills/hyperframes-cli/references/lint-validate-inspect.md +1 -1
  148. package/dist/skills/hyperframes-cli/references/preview-render.md +1 -1
  149. package/dist/skills/media-use/SKILL.md +9 -5
  150. package/dist/skills/media-use/audio/scripts/lib/heygen.mjs +47 -4
  151. package/dist/skills/media-use/audio/scripts/lib/heygen.test.mjs +125 -18
  152. package/dist/skills/media-use/audio/scripts/lib/host-audio.mjs +28 -0
  153. package/dist/skills/media-use/audio/scripts/lib/host-audio.test.mjs +106 -0
  154. package/dist/skills/media-use/references/setup-providers.md +16 -2
  155. package/dist/skills/media-use/scripts/lib/heygen-cli.mjs +21 -1
  156. package/dist/skills/media-use/scripts/lib/heygen-cli.test.mjs +14 -0
  157. package/dist/skills/media-use/scripts/resolve.mjs +11 -6
  158. package/dist/{skills-2XJIOEBT.js → skills-ICJ22CZZ.js} +15 -30
  159. package/dist/{skillsUpdateCheck-LMCCWGNO.js → skillsUpdateCheck-GXZN56I5.js} +3 -3
  160. package/dist/{snapshot-WBRSTLJ2.js → snapshot-XHKOAWF4.js} +41 -32
  161. package/dist/{src-ZS3BLTZ5.js → src-74PFDTDX.js} +17 -10
  162. package/dist/{src-YWFJILQF.js → src-I7UC3JTL.js} +19 -11
  163. package/dist/{staticProjectServer-4VKVHPNG.js → staticProjectServer-2DGKD6TF.js} +24 -16
  164. package/dist/{status-73MBN37B.js → status-JA6SKQVH.js} +7 -24
  165. package/dist/studio/assets/hyperframes-player-5Vx2AiUz.js +473 -0
  166. package/dist/studio/assets/{index-DsEkE5_G.js → index-BAnh7cSQ.js} +1 -1
  167. package/dist/studio/assets/{index-Br1Whc0f.js → index-C0thd4eM.js} +204 -204
  168. package/dist/studio/assets/{index-BmIPrb8I.js → index-P8fgj_Xa.js} +1 -1
  169. package/dist/studio/{chunk-E422JDF5.js → chunk-H2DUOXTF.js} +2 -1
  170. package/dist/studio/index.d.ts +19 -3
  171. package/dist/studio/index.html +1 -1
  172. package/dist/studio/index.js +6518 -5813
  173. package/dist/studio/index.js.map +1 -1
  174. package/dist/studio/player.js +1 -1
  175. package/dist/{studio-api-5V4TVSQV.js → studio-api-PROBO7JG.js} +40 -28
  176. package/dist/{studioServer-M5XY3HYC.js → studioServer-ID6UV2NE.js} +100 -69
  177. package/dist/{system-RCRNX5VF.js → system-OQLOGGPJ.js} +2 -19
  178. package/dist/{telemetry-LOBRQGUD.js → telemetry-65LFHIWH.js} +8 -23
  179. package/dist/{timeline-3JCP6PXU.js → timeline-6UV3JJXD.js} +32 -22
  180. package/dist/{tokens-MLMIJBVF.js → tokens-HIL4TZXI.js} +3 -3
  181. package/dist/{transcribe-KNFXDEAX.js → transcribe-TIO6W3EQ.js} +16 -9
  182. package/dist/{transcribe-POH25ZPX.js → transcribe-V7F6QDSN.js} +20 -44
  183. package/dist/{updateCheck-5ITBSBST.js → updateCheck-GZELANMA.js} +2 -2
  184. package/dist/{upgrade-K6OK4FKT.js → upgrade-BX3KDDZJ.js} +5 -5
  185. package/dist/{urlDownloader-TJJQKADT.js → urlDownloader-R76OHFIE.js} +14 -7
  186. package/dist/{validate-PPPOBJHB.js → validate-7UX4I443.js} +26 -19
  187. package/dist/{video-OB22HWXZ.js → video-RVGYEFQU.js} +18 -11
  188. package/package.json +1 -1
  189. package/dist/chunk-HYYSJI5D.js +0 -3742
  190. package/dist/studio/assets/hyperframes-player-CckOoCJ8.js +0 -473
  191. package/dist/{chunk-I465DBM6.js → chunk-246MOR5U.js} +3 -3
  192. package/dist/{deploy-MX76RZ36.js → deploy-5G4Z6LPA.js} +1 -1
  193. package/dist/{destroy-H2TZBYHH.js → destroy-GFQLTIY3.js} +1 -1
  194. package/dist/{docs-QAPJEGLS.js → docs-MPOM3PHH.js} +3 -3
  195. package/dist/{policies-FSDZVS2E.js → policies-4FEXMXPK.js} +3 -3
  196. package/dist/{progress-FBIEEB7Y.js → progress-5AM2MZ7V.js} +3 -3
  197. package/dist/{sites-TNVKZS73.js → sites-HZMADOA3.js} +1 -1
  198. package/dist/studio/{chunk-E422JDF5.js.map → chunk-H2DUOXTF.js.map} +0 -0
  199. package/dist/{telemetry-2YC4SGQU.js → telemetry-W5AKPI4R.js} +3 -3
  200. package/dist/{tts-FU35O6YB.js → tts-TOHSPWEG.js} +4 -4
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  getMimeType,
9
9
  injectMediaCodecMapIntoHtml
10
- } from "./chunk-Z67RZ4XO.js";
10
+ } from "./chunk-6Q6FR4KH.js";
11
11
  import {
12
12
  PROXY_VARIANT_CONFIG,
13
13
  ProxyCapacityError,
@@ -18,10 +18,10 @@ import {
18
18
  recordProxyRequest,
19
19
  resolveProxy,
20
20
  resolveProxyVariantRequest
21
- } from "./chunk-A4X2YWNQ.js";
21
+ } from "./chunk-4BB7V6AI.js";
22
22
  import {
23
23
  resolveAutoProxy
24
- } from "./chunk-XOZ3J3LB.js";
24
+ } from "./chunk-AVWEIOEN.js";
25
25
 
26
26
  // src/utils/staticProjectServer.ts
27
27
  import { createServer } from "http";
@@ -4,6 +4,9 @@ import { dirname as __hf_dirname } from "node:path";
4
4
  var require = __hf_createRequire(import.meta.url);
5
5
  var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
+ import {
8
+ ensureHfIds
9
+ } from "./chunk-A4KQZXZI.js";
7
10
  import {
8
11
  HF_COLOR_GRADING_ATTR,
9
12
  INLINED_FILE_ATTR,
@@ -32,7 +35,7 @@ import {
32
35
  stripEmbeddedRuntimeScripts,
33
36
  styleElementsFor,
34
37
  warnUnknownEnumValues
35
- } from "./chunk-HYYSJI5D.js";
38
+ } from "./chunk-SYKKFAUW.js";
36
39
  import {
37
40
  cssVariableName
38
41
  } from "./chunk-VC76R6W2.js";
@@ -42,7 +45,7 @@ import {
42
45
  } from "./chunk-OFQWTKPW.js";
43
46
  import {
44
47
  lintHyperframeHtml
45
- } from "./chunk-STA43FMY.js";
48
+ } from "./chunk-WY5OODN5.js";
46
49
  import {
47
50
  CSS_URL_RE,
48
51
  checkSubCompositionUsability,
@@ -1810,106 +1813,6 @@ function inlineSubCompositions(document, hosts, options) {
1810
1813
  };
1811
1814
  }
1812
1815
 
1813
- // ../parsers/dist/hfIds.js
1814
- var EXCLUDED_TAGS = /* @__PURE__ */ new Set([
1815
- "script",
1816
- "style",
1817
- "template",
1818
- "meta",
1819
- "link",
1820
- "noscript",
1821
- "base"
1822
- ]);
1823
- function fnv1a(str) {
1824
- let h = 2166136261;
1825
- for (let i = 0; i < str.length; i++) {
1826
- h ^= str.charCodeAt(i);
1827
- h = Math.imul(h, 16777619);
1828
- }
1829
- return h >>> 0;
1830
- }
1831
- function toHfId(hash2) {
1832
- const s = (hash2 >>> 0).toString(36);
1833
- const four = s.length >= 4 ? s.slice(-4) : s.padStart(4, "0");
1834
- return `hf-${four}`;
1835
- }
1836
- function ownText(el) {
1837
- let text = "";
1838
- el.childNodes.forEach((n) => {
1839
- if (n.nodeType === 3) text += n.nodeValue ?? "";
1840
- });
1841
- return text.trim();
1842
- }
1843
- function getContractAttribute(el, name) {
1844
- return Array.from(el.attributes).find((attr) => attr.name.toLowerCase() === name)?.value ?? null;
1845
- }
1846
- function contentKey(el) {
1847
- const attrs = Array.from(el.attributes).filter((a) => !a.name.toLowerCase().startsWith("data-hf-")).map((a) => `${a.name.toLowerCase()}\0${a.value}`).sort().join("");
1848
- return `${el.tagName.toLowerCase()}|${attrs}|${ownText(el)}`;
1849
- }
1850
- function mintHfId(el, assigned) {
1851
- const key = contentKey(el);
1852
- let id = toHfId(fnv1a(key));
1853
- let dup = 0;
1854
- while (assigned.has(id)) {
1855
- dup += 1;
1856
- if (dup > 1e4) {
1857
- id = `hf-${(fnv1a(key) >>> 0).toString(36)}-${dup}`;
1858
- break;
1859
- }
1860
- id = toHfId(fnv1a(`${key}#${dup}`));
1861
- }
1862
- assigned.add(id);
1863
- return id;
1864
- }
1865
- function getChildElements(parent) {
1866
- const directChildren = Array.from(parent.children);
1867
- if (directChildren.length || parent.tagName.toLowerCase() !== "template") return directChildren;
1868
- const content = parent.content;
1869
- if (content?.children.length) return Array.from(content.children);
1870
- return directChildren;
1871
- }
1872
- function isCompositionTemplate(el) {
1873
- if (el.tagName.toLowerCase() !== "template") return false;
1874
- if (getContractAttribute(el, "data-composition-id") !== null) return true;
1875
- for (const child of getChildElements(el)) {
1876
- if (getContractAttribute(child, "data-composition-id") !== null) return true;
1877
- }
1878
- return false;
1879
- }
1880
- function walkCompositionDescendants(root, visit) {
1881
- const rootElement = root.nodeType === 9 ? root.documentElement : root;
1882
- if (!rootElement) return;
1883
- const walk = (parent) => {
1884
- for (const child of getChildElements(parent)) {
1885
- const isTemplate = child.tagName.toLowerCase() === "template";
1886
- if (isTemplate && !isCompositionTemplate(child)) continue;
1887
- visit(child);
1888
- walk(child);
1889
- }
1890
- };
1891
- walk(rootElement);
1892
- }
1893
- function assignHfIds(body) {
1894
- const assigned = /* @__PURE__ */ new Set();
1895
- walkCompositionDescendants(body, (el) => {
1896
- const existing = getContractAttribute(el, "data-hf-id");
1897
- if (existing) assigned.add(existing);
1898
- });
1899
- walkCompositionDescendants(body, (el) => {
1900
- if (EXCLUDED_TAGS.has(el.tagName.toLowerCase())) return;
1901
- if (getContractAttribute(el, "data-hf-id")) return;
1902
- el.setAttribute("data-hf-id", mintHfId(el, assigned));
1903
- });
1904
- }
1905
- function ensureHfIds(html) {
1906
- const wrapped = !/<!doctype|<html[\s>]/i.test(html);
1907
- const { document } = wrapped ? parseHTML(`<!DOCTYPE html><html><head></head><body>${html}</body></html>`) : parseHTML(html);
1908
- if (!document.body) return html;
1909
- assignHfIds(document.body);
1910
- return wrapped ? document.body.innerHTML || "" : document.toString();
1911
- }
1912
-
1913
1816
  // ../core/dist/compiler/htmlBundler.js
1914
1817
  var DEFAULT_RUNTIME_SCRIPT_URL = "";
1915
1818
  function getRuntimeScriptUrl() {
@@ -3122,10 +3025,6 @@ export {
3122
3025
  validateHyperframeHtmlContract,
3123
3026
  ensureExternalLinkTag,
3124
3027
  inlineSubCompositions,
3125
- EXCLUDED_TAGS,
3126
- mintHfId,
3127
- walkCompositionDescendants,
3128
- ensureHfIds,
3129
3028
  assignBundledRuntimeCompositionIds,
3130
3029
  prepareFlattenedInnerRoot,
3131
3030
  bundleToSingleHtml,
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  setHostHandlesSigint
9
- } from "./chunk-QXOFUKBF.js";
9
+ } from "./chunk-E6SDW5FV.js";
10
10
  import {
11
11
  processAncestorSnapshot,
12
12
  processIdentity,
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-AWDFDFI3.js";
15
15
  import {
16
16
  isBlockedNetworkHost
17
- } from "./chunk-QXOFUKBF.js";
17
+ } from "./chunk-E6SDW5FV.js";
18
18
  import {
19
19
  DOMParser,
20
20
  parseHTML
@@ -4,19 +4,16 @@ import { dirname as __hf_dirname } from "node:path";
4
4
  var require = __hf_createRequire(import.meta.url);
5
5
  var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
- import {
8
- STUDIO_MANUAL_EDITS_PATH
9
- } from "./chunk-KC5XXX3X.js";
10
7
  import {
11
8
  firstFrameColourArgs,
9
+ formatPreviewProxyBox,
12
10
  hdrToSdrToneMapFilter,
13
11
  parseFirstFrameColour
14
- } from "./chunk-EJ7OWYF2.js";
12
+ } from "./chunk-6E6CM7WS.js";
15
13
  import {
16
14
  mkdirWithinProject,
17
15
  realProjectRoot,
18
- realpath,
19
- resolveWithinProject
16
+ realpath
20
17
  } from "./chunk-OFQWTKPW.js";
21
18
  import {
22
19
  cleanAssetUrl,
@@ -24,7 +21,7 @@ import {
24
21
  isUnresolvedAssetPlaceholder,
25
22
  maskNonScannableRanges,
26
23
  resolveLocalAssetCandidates
27
- } from "./chunk-STA43FMY.js";
24
+ } from "./chunk-JFKL3WAE.js";
28
25
  import {
29
26
  findFfBinary
30
27
  } from "./chunk-PJ3HDUCY.js";
@@ -32,267 +29,9 @@ import {
32
29
  rewriteAssetPath
33
30
  } from "./chunk-TQFG7HTI.js";
34
31
 
35
- // ../studio-server/dist/chunk-4ETS2LXI.js
36
- var STUDIO_MOTION_PATH = ".hyperframes/studio-motion.json";
37
- function hasStudioMotionEntries(manifestContent) {
38
- try {
39
- const parsed = JSON.parse(manifestContent);
40
- return Array.isArray(parsed.motions) && parsed.motions.length > 0;
41
- } catch {
42
- return false;
43
- }
44
- }
45
- function createStudioMotionRenderBodyScript(manifestContent, options = {}) {
46
- if (!manifestContent.trim() || !hasStudioMotionEntries(manifestContent)) return null;
47
- return `(${studioMotionRenderRuntime.toString()})(${JSON.stringify(manifestContent)}, ${JSON.stringify(options.activeCompositionPath ?? null)});`;
48
- }
49
- function studioMotionRenderRuntime(manifestContent, activeCompositionPath) {
50
- const STUDIO_MOTION_TIMELINE_ID = "studio-motion";
51
- const STUDIO_MOTION_ATTR = "data-hf-studio-motion";
52
- const ORIGINAL_TRANSFORM_ATTR = "data-hf-studio-motion-original-transform";
53
- const ORIGINAL_OPACITY_ATTR = "data-hf-studio-motion-original-opacity";
54
- const ORIGINAL_VISIBILITY_ATTR = "data-hf-studio-motion-original-visibility";
55
- const objectRecord = (value) => value && typeof value === "object" ? value : null;
56
- const finiteNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
57
- const runtimeWindow = window;
58
- const parseMotionValues = (value) => {
59
- const record = objectRecord(value);
60
- if (!record) return null;
61
- const parsed = {};
62
- for (const key of ["x", "y", "scale", "rotation", "opacity", "autoAlpha"]) {
63
- const next = finiteNumber(record[key]);
64
- if (next != null) parsed[key] = next;
65
- }
66
- return Object.keys(parsed).length > 0 ? parsed : null;
67
- };
68
- const parseCustomEase = (value) => {
69
- const record = objectRecord(value);
70
- if (!record) return null;
71
- const id = typeof record.id === "string" ? record.id.trim() : "";
72
- const data = typeof record.data === "string" ? record.data.trim() : "";
73
- if (!id || !data) return null;
74
- return { id, data };
75
- };
76
- const parsedManifest = (() => {
77
- try {
78
- return objectRecord(JSON.parse(manifestContent));
79
- } catch {
80
- return null;
81
- }
82
- })();
83
- const manifestMotions = Array.isArray(parsedManifest?.motions) ? parsedManifest.motions : [];
84
- const sourceFileForElement = (element) => {
85
- let current = element;
86
- while (current) {
87
- const sourceFile = current.getAttribute("data-composition-file") ?? current.getAttribute("data-composition-src");
88
- if (sourceFile) return sourceFile;
89
- current = current.parentElement;
90
- }
91
- return activeCompositionPath ?? "index.html";
92
- };
93
- const elementMatchesSourceFile = (element, sourceFile) => sourceFileForElement(element) === sourceFile;
94
- const isHTMLElement = (element) => element instanceof HTMLElement;
95
- const querySelectorCandidates = (selector) => {
96
- const className = selector.match(/^\.([A-Za-z0-9_-]+)$/)?.[1];
97
- if (className) {
98
- return Array.from(document.getElementsByTagName("*")).filter(
99
- (element) => isHTMLElement(element) && element.classList.contains(className)
100
- );
101
- }
102
- if (/^[A-Za-z][A-Za-z0-9-]*$/.test(selector)) {
103
- return Array.from(document.getElementsByTagName(selector)).filter(isHTMLElement);
104
- }
105
- return Array.from(document.querySelectorAll(selector)).filter(isHTMLElement);
106
- };
107
- const resolveTarget = (targetRecord) => {
108
- const sourceFile = typeof targetRecord.sourceFile === "string" ? targetRecord.sourceFile : "";
109
- if (!sourceFile) return null;
110
- const id = typeof targetRecord.id === "string" ? targetRecord.id : "";
111
- if (id) {
112
- const byId = document.getElementById(id);
113
- if (isHTMLElement(byId) && elementMatchesSourceFile(byId, sourceFile)) return byId;
114
- }
115
- const selector = typeof targetRecord.selector === "string" ? targetRecord.selector : "";
116
- if (!selector) return null;
117
- try {
118
- const selectorIndex = Math.max(0, Math.floor(finiteNumber(targetRecord.selectorIndex) ?? 0));
119
- return querySelectorCandidates(selector).filter(
120
- (element) => elementMatchesSourceFile(element, sourceFile)
121
- )[selectorIndex] ?? null;
122
- } catch {
123
- return null;
124
- }
125
- };
126
- const restoreElement = (element) => {
127
- runtimeWindow.gsap?.set?.(element, { clearProps: "transform,opacity,visibility" });
128
- element.style.transform = element.getAttribute(ORIGINAL_TRANSFORM_ATTR) ?? "";
129
- element.style.opacity = element.getAttribute(ORIGINAL_OPACITY_ATTR) ?? "";
130
- element.style.visibility = element.getAttribute(ORIGINAL_VISIBILITY_ATTR) ?? "";
131
- element.removeAttribute(STUDIO_MOTION_ATTR);
132
- element.removeAttribute(ORIGINAL_TRANSFORM_ATTR);
133
- element.removeAttribute(ORIGINAL_OPACITY_ATTR);
134
- element.removeAttribute(ORIGINAL_VISIBILITY_ATTR);
135
- };
136
- const restoreStudioMotionElements = () => {
137
- for (const element of Array.from(document.querySelectorAll(`[${STUDIO_MOTION_ATTR}]`))) {
138
- if (isHTMLElement(element)) restoreElement(element);
139
- }
140
- };
141
- const readCurrentTime = () => {
142
- try {
143
- const playerTime = runtimeWindow.__player?.getTime?.();
144
- if (typeof playerTime === "number" && Number.isFinite(playerTime)) {
145
- return Math.max(0, playerTime);
146
- }
147
- } catch {
148
- }
149
- try {
150
- const timelineTime = runtimeWindow.__timeline?.time?.();
151
- if (typeof timelineTime === "number" && Number.isFinite(timelineTime)) {
152
- return Math.max(0, timelineTime);
153
- }
154
- } catch {
155
- }
156
- return 0;
157
- };
158
- const resolveEase = (motion) => {
159
- const fallback = typeof motion.ease === "string" && motion.ease.trim() ? motion.ease.trim() : "none";
160
- const customEase = parseCustomEase(motion.customEase);
161
- const customEasePlugin = runtimeWindow.CustomEase;
162
- if (!customEase || typeof customEasePlugin?.create !== "function") return fallback;
163
- try {
164
- runtimeWindow.gsap?.registerPlugin?.(customEasePlugin);
165
- customEasePlugin.create(customEase.id, customEase.data);
166
- return customEase.id;
167
- } catch {
168
- return fallback;
169
- }
170
- };
171
- const applyManifest = () => {
172
- runtimeWindow.__timelines = runtimeWindow.__timelines ?? {};
173
- runtimeWindow.__timelines[STUDIO_MOTION_TIMELINE_ID]?.kill?.();
174
- delete runtimeWindow.__timelines[STUDIO_MOTION_TIMELINE_ID];
175
- restoreStudioMotionElements();
176
- const gsap = runtimeWindow.gsap;
177
- if (!gsap?.timeline || manifestMotions.length === 0) return 0;
178
- const timeline = gsap.timeline({ paused: true, defaults: { overwrite: "auto" } });
179
- let applied = 0;
180
- for (const motionValue of manifestMotions) {
181
- const motion = objectRecord(motionValue);
182
- if (!motion || motion.kind !== "gsap-motion") continue;
183
- const targetRecord = objectRecord(motion.target);
184
- if (!targetRecord) continue;
185
- const target = resolveTarget(targetRecord);
186
- if (!target || typeof timeline.fromTo !== "function") continue;
187
- const start = finiteNumber(motion.start);
188
- const duration = finiteNumber(motion.duration);
189
- if (start == null || duration == null || start < 0 || duration <= 0) continue;
190
- const from = parseMotionValues(motion.from);
191
- const to = parseMotionValues(motion.to);
192
- if (!from || !to) continue;
193
- if (!target.hasAttribute(STUDIO_MOTION_ATTR)) {
194
- target.setAttribute(ORIGINAL_TRANSFORM_ATTR, target.style.transform);
195
- target.setAttribute(ORIGINAL_OPACITY_ATTR, target.style.opacity);
196
- target.setAttribute(ORIGINAL_VISIBILITY_ATTR, target.style.visibility);
197
- }
198
- target.setAttribute(STUDIO_MOTION_ATTR, "true");
199
- timeline.fromTo(
200
- target,
201
- from,
202
- { ...to, duration, ease: resolveEase(motion), overwrite: "auto", immediateRender: false },
203
- start
204
- );
205
- applied += 1;
206
- }
207
- if (applied === 0) {
208
- timeline.kill?.();
209
- return 0;
210
- }
211
- runtimeWindow.__timelines[STUDIO_MOTION_TIMELINE_ID] = timeline;
212
- timeline.pause?.();
213
- const currentTime = readCurrentTime();
214
- if (typeof timeline.totalTime === "function") timeline.totalTime(currentTime, false);
215
- else timeline.time?.(currentTime);
216
- return applied;
217
- };
218
- runtimeWindow.__hfStudioMotionApply = applyManifest;
219
- applyManifest();
220
- }
221
-
222
- // ../studio-server/dist/chunk-DTKK7TKL.js
223
- import { basename, dirname, isAbsolute, join, relative, sep } from "path";
224
- import { readdirSync } from "fs";
225
- function resolveWithinProject2(base, relativePath) {
226
- const resolved = resolveWithinProject(base, relativePath);
227
- return resolved && !isPrivateProjectFile(base, resolved) ? resolved : null;
228
- }
229
- function realFilePath(filePath) {
230
- try {
231
- return realpath(filePath);
232
- } catch {
233
- const dir = dirname(filePath);
234
- return dir === filePath ? filePath : join(realFilePath(dir), basename(filePath));
235
- }
236
- }
237
- var STUDIO_FILES = /* @__PURE__ */ new Set([STUDIO_MOTION_PATH, STUDIO_MANUAL_EDITS_PATH]);
238
- var STUDIO_FOLDERS = [".hyperframes/prepared-assets", ".hyperframes/requests"];
239
- function isPrivateProjectPath(relPath) {
240
- const path = relPath.toLowerCase();
241
- return (path === ".hyperframes" || path.startsWith(".hyperframes/")) && !STUDIO_FILES.has(path) && !STUDIO_FOLDERS.some((folder) => path === folder || path.startsWith(`${folder}/`));
242
- }
243
- function isPrivateProjectFile(projectDir, filePath) {
244
- const rel = (from, to) => relative(from, to).split(sep).join("/");
245
- return [rel(projectDir, filePath), rel(realFilePath(projectDir), realFilePath(filePath))].some(
246
- isPrivateProjectPath
247
- );
248
- }
249
- function pinWithinProject(base, relativePath) {
250
- const checked = resolveWithinProject2(base, relativePath);
251
- if (!checked) return null;
252
- const inside = relative(realFilePath(base), realFilePath(checked));
253
- const escapes = inside === ".." || inside.startsWith(`..${sep}`) || isAbsolute(inside);
254
- return escapes ? null : join(base, inside);
255
- }
256
- var IGNORE_DIRS = /* @__PURE__ */ new Set([
257
- ".thumbnails",
258
- ".transcode-cache",
259
- ".waveform-cache",
260
- "node_modules",
261
- ".git"
262
- ]);
263
- function shouldIgnoreDir(rel) {
264
- return rel === ".hyperframes/backup";
265
- }
266
- function isInHiddenOrVendorDir(relPath) {
267
- const segments = relPath.split("/");
268
- return segments.slice(0, -1).some((seg) => seg.startsWith(".") || seg === "node_modules");
269
- }
270
- var UNREADABLE_DIR_CODES = /* @__PURE__ */ new Set(["EACCES", "EPERM", "ENOENT", "ENOTDIR"]);
271
- function walkDir(dir, prefix = "") {
272
- let entries;
273
- try {
274
- entries = readdirSync(dir, { withFileTypes: true });
275
- } catch (err) {
276
- const code = err.code;
277
- if (!prefix || !code || !UNREADABLE_DIR_CODES.has(code)) throw err;
278
- return [];
279
- }
280
- const files = [];
281
- for (const entry of entries) {
282
- const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
283
- if (IGNORE_DIRS.has(entry.name) || shouldIgnoreDir(rel)) continue;
284
- if (entry.isDirectory()) {
285
- files.push(...walkDir(join(dir, entry.name), rel));
286
- } else {
287
- files.push(rel);
288
- }
289
- }
290
- return files;
291
- }
292
-
293
32
  // ../studio-server/dist/chunk-74JVVCWL.js
294
33
  import { existsSync, statSync } from "fs";
295
- import { relative as relative2, resolve, sep as sep2 } from "path";
34
+ import { relative, resolve, sep } from "path";
296
35
  import { execFile } from "child_process";
297
36
  import { extname } from "path";
298
37
  var execFileRunner = (command, args, options) => new Promise((resolvePromise) => {
@@ -547,7 +286,7 @@ function resolveExistingLocalAsset(projectDir, url) {
547
286
  (candidate) => existsSync(candidate)
548
287
  );
549
288
  if (!resolvedPath) return null;
550
- const rootRelative = relative2(projectRoot, resolvedPath).split(sep2).join("/");
289
+ const rootRelative = relative(projectRoot, resolvedPath).split(sep).join("/");
551
290
  return { resolvedPath, rootRelativePathname: `/${rootRelative}` };
552
291
  }
553
292
  function collectLocalVideoAssets(projectDir, htmlSources) {
@@ -596,13 +335,13 @@ async function scanProjectMediaCodecMap(projectDir, htmlSources, options = {}) {
596
335
  return map;
597
336
  }
598
337
 
599
- // ../studio-server/dist/chunk-6RFZWPPN.js
338
+ // ../studio-server/dist/chunk-QP7LKFU2.js
600
339
  import { spawn } from "child_process";
601
340
  import { createHash, randomUUID } from "crypto";
602
341
  import { existsSync as existsSync2, renameSync, statSync as statSync2, unlinkSync as unlinkSync2, utimesSync } from "fs";
603
- import { basename as basename2, dirname as dirname2, isAbsolute as isAbsolute2, join as join2, relative as relative3, resolve as resolve2, sep as sep3 } from "path";
604
- import { existsSync as existsSync3, readdirSync as readdirSync2, statSync as statSync3, unlinkSync } from "fs";
605
- import { extname as extname2, join as join3 } from "path";
342
+ import { basename, dirname, isAbsolute, join as join2, relative as relative2, resolve as resolve2, sep as sep2 } from "path";
343
+ import { existsSync as existsSync3, readdirSync, statSync as statSync3, unlinkSync } from "fs";
344
+ import { extname as extname2, join } from "path";
606
345
  var DEFAULT_MAX_BYTES = 10 * 1024 * 1024 * 1024;
607
346
  var DEFAULT_STALE_TEMP_MS = 60 * 60 * 1e3;
608
347
  var DEFAULT_MIN_SWEEP_INTERVAL_MS = 5 * 60 * 1e3;
@@ -636,9 +375,9 @@ function shouldSkipSweep(cacheDir, now, minSweepIntervalMs) {
636
375
  function readCacheInventory(cacheDir, protectedPaths, now, staleTempMs) {
637
376
  const entries = [];
638
377
  const staleTemps = [];
639
- for (const dirent of readdirSync2(cacheDir, { withFileTypes: true })) {
378
+ for (const dirent of readdirSync(cacheDir, { withFileTypes: true })) {
640
379
  if (!dirent.isFile()) continue;
641
- const path = join3(cacheDir, dirent.name);
380
+ const path = join(cacheDir, dirent.name);
642
381
  const stat = statSync3(path);
643
382
  const entry = {
644
383
  path,
@@ -775,14 +514,14 @@ async function waitForProxy(promise, timeoutMs = DEFAULT_PROXY_WAIT_TIMEOUT_MS)
775
514
  function canonicalizeProxySource(projectDir, absoluteSourcePath) {
776
515
  const requestedProjectDir = resolve2(projectDir);
777
516
  const requestedSourcePath = resolve2(absoluteSourcePath);
778
- const requestedRelativePath = relative3(requestedProjectDir, requestedSourcePath);
779
- if (requestedRelativePath === ".." || requestedRelativePath.startsWith(`..${sep3}`) || isAbsolute2(requestedRelativePath)) {
517
+ const requestedRelativePath = relative2(requestedProjectDir, requestedSourcePath);
518
+ if (requestedRelativePath === ".." || requestedRelativePath.startsWith(`..${sep2}`) || isAbsolute(requestedRelativePath)) {
780
519
  throw new ProxySourceOutsideProjectError();
781
520
  }
782
521
  const canonicalProjectDir = realProjectRoot(projectDir);
783
522
  const canonicalSourcePath = realpath(absoluteSourcePath);
784
- const canonicalRelativePath = relative3(canonicalProjectDir, canonicalSourcePath);
785
- const sourceIsInsideCanonicalProject = canonicalRelativePath !== ".." && !canonicalRelativePath.startsWith(`..${sep3}`) && !isAbsolute2(canonicalRelativePath);
523
+ const canonicalRelativePath = relative2(canonicalProjectDir, canonicalSourcePath);
524
+ const sourceIsInsideCanonicalProject = canonicalRelativePath !== ".." && !canonicalRelativePath.startsWith(`..${sep2}`) && !isAbsolute(canonicalRelativePath);
786
525
  return {
787
526
  projectDir: canonicalProjectDir,
788
527
  sourcePath: canonicalSourcePath,
@@ -792,14 +531,15 @@ function canonicalizeProxySource(projectDir, absoluteSourcePath) {
792
531
  cacheIdentity: (sourceIsInsideCanonicalProject ? canonicalRelativePath : canonicalSourcePath).normalize("NFC")
793
532
  };
794
533
  }
795
- function buildProxyCacheKey(source, variant) {
534
+ function buildProxyCacheKey(source, variant, box) {
796
535
  const stat = statSync2(source.sourcePath);
536
+ const size = box ? `\0${formatPreviewProxyBox(box)}` : "";
797
537
  return createHash("sha256").update(
798
- `${source.relativePath}\0${source.cacheIdentity}\0${stat.mtimeMs}\0${stat.size}\0${PROXY_PARAMS_VERSION}\0${variant}`
538
+ `${source.relativePath}\0${source.cacheIdentity}\0${stat.mtimeMs}\0${stat.size}\0${PROXY_PARAMS_VERSION}\0${variant}${size}`
799
539
  ).digest("hex");
800
540
  }
801
- function getCanonicalProxyCachePath(source, variant) {
802
- const key = buildProxyCacheKey(source, variant);
541
+ function getCanonicalProxyCachePath(source, variant, box) {
542
+ const key = buildProxyCacheKey(source, variant, box);
803
543
  return join2(
804
544
  source.projectDir,
805
545
  CACHE_DIR_NAME,
@@ -882,7 +622,13 @@ function rememberFailure(cachePath, error) {
882
622
  failedTranscodes.delete(oldest);
883
623
  }
884
624
  }
885
- async function runFfmpeg(sourcePath, outputPath, variant) {
625
+ function proxyScaleFilter(box) {
626
+ if (!box) return "scale=trunc(iw/2)*2:trunc(ih/2)*2";
627
+ const factor = `min(1\\,max(${box.width}/iw\\,${box.height}/ih))`;
628
+ const side = (d) => `min(trunc(${d}/2)*2\\,ceil(${d}*${factor}/2)*2)`;
629
+ return `scale=${side("iw")}:${side("ih")}`;
630
+ }
631
+ async function runFfmpeg(sourcePath, outputPath, variant, box) {
886
632
  const metadata = await probeMediaMetadata(sourcePath);
887
633
  const ffmpegPath = findFfBinary("ffmpeg", { configuredMustExist: true });
888
634
  if (!ffmpegPath) {
@@ -893,7 +639,7 @@ async function runFfmpeg(sourcePath, outputPath, variant) {
893
639
  const toneMap = (hdrTransfer === "pq" || hdrTransfer === "hlg") && !keepsAlpha;
894
640
  if (toneMap) await ensureHdrFilters(ffmpegPath);
895
641
  const firstFrame = toneMap ? await probeFirstFrameColour(sourcePath) : {};
896
- const evenScale = "scale=trunc(iw/2)*2:trunc(ih/2)*2";
642
+ const evenScale = proxyScaleFilter(box);
897
643
  const pixelFormat = keepsAlpha ? "yuva420p" : "yuv420p";
898
644
  const videoFilter = toneMap ? [
899
645
  hdrToSdrToneMapFilter(metadata.color, firstFrame),
@@ -983,15 +729,15 @@ async function runFfmpeg(sourcePath, outputPath, variant) {
983
729
  });
984
730
  });
985
731
  }
986
- async function transcodeToCache(projectDir, absoluteSourcePath, cachePath, variant) {
732
+ async function transcodeToCache(projectDir, absoluteSourcePath, cachePath, variant, box) {
987
733
  await acquireSlot();
988
734
  try {
989
735
  if (existsSync2(cachePath)) return cachePath;
990
- const cacheDir = dirname2(cachePath);
736
+ const cacheDir = dirname(cachePath);
991
737
  mkdirWithinProject(projectDir, cacheDir);
992
- const tempPath = join2(cacheDir, `.tmp-${randomUUID()}-${basename2(cachePath)}`);
738
+ const tempPath = join2(cacheDir, `.tmp-${randomUUID()}-${basename(cachePath)}`);
993
739
  try {
994
- await runFfmpeg(absoluteSourcePath, tempPath, variant);
740
+ await runFfmpeg(absoluteSourcePath, tempPath, variant, box);
995
741
  renameSync(tempPath, cachePath);
996
742
  maintainProxyCache(cacheDir);
997
743
  return cachePath;
@@ -1005,16 +751,16 @@ async function transcodeToCache(projectDir, absoluteSourcePath, cachePath, varia
1005
751
  var settledProxyCount = 0;
1006
752
  function proxyActivityMark(projectDir) {
1007
753
  if (!existsSync2(projectDir)) return String(settledProxyCount);
1008
- const cacheDir = join2(realpath(projectDir), CACHE_DIR_NAME) + sep3;
754
+ const cacheDir = join2(realpath(projectDir), CACHE_DIR_NAME) + sep2;
1009
755
  for (const cachePath of inFlight.keys()) if (cachePath.startsWith(cacheDir)) return null;
1010
756
  return String(settledProxyCount);
1011
757
  }
1012
- async function resolveProxy(projectDir, absoluteSourcePath, variant = "h264") {
758
+ async function resolveProxy(projectDir, absoluteSourcePath, variant = "h264", box) {
1013
759
  const source = canonicalizeProxySource(projectDir, absoluteSourcePath);
1014
- const cachePath = getCanonicalProxyCachePath(source, variant);
760
+ const cachePath = getCanonicalProxyCachePath(source, variant, box);
1015
761
  if (existsSync2(cachePath)) {
1016
762
  markCacheEntryUsed(cachePath);
1017
- maintainProxyCache(dirname2(cachePath));
763
+ maintainProxyCache(dirname(cachePath));
1018
764
  return cachePath;
1019
765
  }
1020
766
  const rememberedFailure = failedTranscodes.get(cachePath);
@@ -1024,7 +770,7 @@ async function resolveProxy(projectDir, absoluteSourcePath, variant = "h264") {
1024
770
  }
1025
771
  const existing = inFlight.get(cachePath);
1026
772
  if (existing) return existing;
1027
- const promise = transcodeToCache(source.projectDir, source.sourcePath, cachePath, variant).catch((err) => {
773
+ const promise = transcodeToCache(source.projectDir, source.sourcePath, cachePath, variant, box).catch((err) => {
1028
774
  if (!(err instanceof ProxyCapacityError)) rememberFailure(cachePath, err);
1029
775
  throw err;
1030
776
  }).finally(() => {
@@ -1036,15 +782,6 @@ async function resolveProxy(projectDir, absoluteSourcePath, variant = "h264") {
1036
782
  }
1037
783
 
1038
784
  export {
1039
- STUDIO_MOTION_PATH,
1040
- createStudioMotionRenderBodyScript,
1041
- resolveWithinProject2 as resolveWithinProject,
1042
- realFilePath,
1043
- isPrivateProjectPath,
1044
- isPrivateProjectFile,
1045
- pinWithinProject,
1046
- isInHiddenOrVendorDir,
1047
- walkDir,
1048
785
  probeMediaMetadata,
1049
786
  shouldPrewarmProxy,
1050
787
  recordProxyPrewarm,