hyperframes 0.8.226 → 0.8.227

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 (203) hide show
  1. package/dist/{add-3NBOSGKQ.js → add-XX23UL2L.js} +11 -11
  2. package/dist/{agentPromptGenerator-GQSDTAV5.js → agentPromptGenerator-IMNWTMHM.js} +5 -5
  3. package/dist/{animatedGifPrep-UXFFDGA7.js → animatedGifPrep-MPU6T26Y.js} +5 -5
  4. package/dist/api.d.ts +122 -1
  5. package/dist/api.js +25 -17
  6. package/dist/{asset-VQVAYC7E.js → asset-FZSKOSMO.js} +2 -2
  7. package/dist/{assetCataloger-C6KNE2IQ.js → assetCataloger-SITUNOV5.js} +6 -6
  8. package/dist/{audio-2KULGXHA.js → audio-T5RHG57J.js} +11 -11
  9. package/dist/{auth-QNMLPJOW.js → auth-CMGIWJ6S.js} +1 -1
  10. package/dist/{autoUpdate-VFQQ47UD.js → autoUpdate-NNHBVLHN.js} +2 -2
  11. package/dist/{backgroundChecks-SSQ2U3ZY.js → backgroundChecks-HQYOBCV2.js} +3 -3
  12. package/dist/backgroundChecksWorker.js +3 -3
  13. package/dist/{batchRender-Y45PZC3Q.js → batchRender-5URYGOLM.js} +3 -3
  14. package/dist/{beats-YSJT4NUG.js → beats-J7IBNLP4.js} +7 -7
  15. package/dist/{benchmark-6UOMMUXF.js → benchmark-Q2BILDRB.js} +8 -8
  16. package/dist/{browser-GM4ZTCRQ.js → browser-EERGHDRV.js} +3 -3
  17. package/dist/{bundleWithLocalizedFonts-CUTSKVRK.js → bundleWithLocalizedFonts-FKU44QSO.js} +2 -2
  18. package/dist/{capture-SZ65WG5Z.js → capture-5W7BR36Q.js} +3 -3
  19. package/dist/{capture-J24XSJTZ.js → capture-IRJ7DO45.js} +10 -10
  20. package/dist/{captureCompositionFrame-5UUXIOF2.js → captureCompositionFrame-R4LFCHHV.js} +11 -11
  21. package/dist/{catalog-5EQFE3BC.js → catalog-IRFBKRFP.js} +11 -11
  22. package/dist/{catch-up-ASBRKHDL.js → catch-up-RGQAFA3E.js} +4 -4
  23. package/dist/{check-BA4SSXPY.js → check-EXLZVGDY.js} +36 -36
  24. package/dist/{checkAudio-TU4GPHIR.js → checkAudio-K3XKXNEN.js} +8 -8
  25. package/dist/{checkBrowser-27SFNNPD.js → checkBrowser-ZOU5XFMN.js} +30 -30
  26. package/dist/{chunk-RRT5S42U.js → chunk-27JEDDX5.js} +1 -1
  27. package/dist/{chunk-6EQSJ7MT.js → chunk-2M6LMJ32.js} +1 -1
  28. package/dist/{chunk-LVV5EUSO.js → chunk-3TWAMQF6.js} +2 -2
  29. package/dist/{chunk-6CU2ZQGW.js → chunk-5ETFQB5F.js} +28 -23
  30. package/dist/{chunk-ZI64CTVC.js → chunk-62LATJB6.js} +1 -1
  31. package/dist/{chunk-7LUZ4RQX.js → chunk-65LMGFJ5.js} +12 -12
  32. package/dist/{chunk-CRIVUWLA.js → chunk-6HPCEV3U.js} +2 -2
  33. package/dist/{chunk-Y2NSHQVE.js → chunk-6PQXDPKV.js} +2 -2
  34. package/dist/{chunk-EYDV3MHA.js → chunk-6RSOEYIG.js} +7 -7
  35. package/dist/{chunk-7UKRCWBO.js → chunk-6TXW6LHH.js} +75 -21
  36. package/dist/{chunk-DW7W4J7D.js → chunk-7XNMKKXI.js} +2 -2
  37. package/dist/{chunk-3V3XMQEF.js → chunk-A3UIADPB.js} +1 -1
  38. package/dist/{chunk-GUJ45PRX.js → chunk-AI6Z7BVD.js} +1 -1
  39. package/dist/{chunk-OMT75FQI.js → chunk-AJREH4PX.js} +2 -2
  40. package/dist/{chunk-JIYNPDH6.js → chunk-AQ2C6AQH.js} +1 -1
  41. package/dist/{chunk-RKDMYKGL.js → chunk-AXRFHQRS.js} +1 -1
  42. package/dist/{chunk-5TXYCG4M.js → chunk-BKK57WEL.js} +4 -4
  43. package/dist/{chunk-WESIEW2M.js → chunk-BW3CQT3A.js} +3 -3
  44. package/dist/{chunk-V2N747YM.js → chunk-CQKK7S4I.js} +7 -7
  45. package/dist/{chunk-5X65O5WM.js → chunk-E2GNVQSH.js} +1 -1
  46. package/dist/{chunk-ZNXUM4D2.js → chunk-FD7Z5BDR.js} +2 -2
  47. package/dist/{chunk-ZJE2XWQC.js → chunk-FFCQR7AP.js} +2 -2
  48. package/dist/{chunk-HYB3WSJL.js → chunk-GIGZYW5Q.js} +1 -1
  49. package/dist/{chunk-37PS2IPO.js → chunk-HGEFDPRP.js} +1 -1
  50. package/dist/{chunk-ETH6WXKZ.js → chunk-HNB7DA2F.js} +1 -1
  51. package/dist/{chunk-PHUTMTHB.js → chunk-IN2355UQ.js} +1 -1
  52. package/dist/{chunk-XDTRM4OS.js → chunk-IQFLDX7I.js} +4 -4
  53. package/dist/{chunk-7WNPWUJP.js → chunk-ISEHEDSN.js} +40 -11
  54. package/dist/{chunk-KQARKGEJ.js → chunk-IUQCPWHU.js} +10 -9
  55. package/dist/{chunk-XCGPPU32.js → chunk-IZRC24DI.js} +1 -1
  56. package/dist/{chunk-XH7SSJSQ.js → chunk-JP6C673M.js} +1 -1
  57. package/dist/{chunk-2JBCK6DX.js → chunk-K6YHKCVX.js} +1 -1
  58. package/dist/{chunk-B243Y7MM.js → chunk-K7LS42XC.js} +3 -3
  59. package/dist/{chunk-3XYDZQJF.js → chunk-KLTD64CP.js} +1 -1
  60. package/dist/{chunk-P7TDUSPH.js → chunk-KU6VRNJF.js} +1 -1
  61. package/dist/{chunk-Z257R7TN.js → chunk-L2XYH5SQ.js} +1 -1
  62. package/dist/{chunk-PXSCN6X5.js → chunk-M63U54H7.js} +2 -2
  63. package/dist/{chunk-BJ3Q3XK7.js → chunk-MBS45ZKL.js} +8 -8
  64. package/dist/{chunk-UXHGYMX4.js → chunk-MR7I3L6N.js} +1 -1
  65. package/dist/{chunk-PZ6VVOOE.js → chunk-NFUJ35XX.js} +1 -1
  66. package/dist/{chunk-EQGBGOQQ.js → chunk-NQ4MVBNC.js} +9 -9
  67. package/dist/{chunk-YTQSLNIA.js → chunk-OG3S6SE6.js} +1 -1
  68. package/dist/{chunk-ABNPD4NF.js → chunk-OJW6TC57.js} +1 -1
  69. package/dist/{chunk-S4UDVFAN.js → chunk-OVLO32XC.js} +2 -2
  70. package/dist/{chunk-WGVREWKN.js → chunk-OWJTWCE6.js} +2 -2
  71. package/dist/{chunk-VB77RRT7.js → chunk-PFGBFTNS.js} +1 -1
  72. package/dist/{chunk-76N526VX.js → chunk-PSRFHITV.js} +13 -13
  73. package/dist/{chunk-CU3SVSKX.js → chunk-PVLG6IY4.js} +1 -1
  74. package/dist/chunk-PXH3TD4X.js +760 -0
  75. package/dist/{chunk-PCH3O6I6.js → chunk-Q7S4JN73.js} +5 -5
  76. package/dist/{chunk-OSCRZUEB.js → chunk-RABQDJMA.js} +1 -1
  77. package/dist/{chunk-6AEHVBMX.js → chunk-RG7WG2BC.js} +1 -1
  78. package/dist/{chunk-BD2CQDXP.js → chunk-RVKHNBJI.js} +17 -17
  79. package/dist/{chunk-B7OI3WAR.js → chunk-SANQC4QD.js} +1 -1
  80. package/dist/chunk-SBQV5FLG.js +5030 -0
  81. package/dist/{chunk-U6LQ4BTL.js → chunk-SPN4SJV7.js} +1 -1
  82. package/dist/{chunk-HSXV7QPC.js → chunk-SQJNSPL5.js} +1 -1
  83. package/dist/{chunk-2IQONCMF.js → chunk-SZVMN7L3.js} +7 -7
  84. package/dist/{chunk-EJEHDDVX.js → chunk-T53C5UTH.js} +1 -1
  85. package/dist/{chunk-GADKBSZ5.js → chunk-TG5RBLCM.js} +2 -2
  86. package/dist/{chunk-UIJLEBHQ.js → chunk-TJ6G325N.js} +1 -1
  87. package/dist/{chunk-PVBSCPZI.js → chunk-TJPZYMYX.js} +3 -3
  88. package/dist/{chunk-AMTAKSKJ.js → chunk-TMTZ5M4R.js} +9 -9
  89. package/dist/{chunk-4XYLQYUE.js → chunk-TNPFF5TQ.js} +2 -2
  90. package/dist/{chunk-OQYGHP3E.js → chunk-UIDZKSF6.js} +1 -1
  91. package/dist/{chunk-PWHOMCFB.js → chunk-V7BBBD5C.js} +2 -2
  92. package/dist/{chunk-RBYSMHB7.js → chunk-VHREBR3T.js} +1 -1
  93. package/dist/{chunk-35LAWHTD.js → chunk-VO55NLTM.js} +32 -9
  94. package/dist/{chunk-A23K6P7L.js → chunk-WISN2ACZ.js} +1 -1
  95. package/dist/{chunk-APCGOECM.js → chunk-XZULISH5.js} +2 -2
  96. package/dist/{chunk-DGQOBTFQ.js → chunk-YKOHWGUC.js} +1 -1
  97. package/dist/{chunk-B52P2FU2.js → chunk-YTMWGLEQ.js} +1 -1
  98. package/dist/{chunk-MWQNQA77.js → chunk-ZAE5Q7D5.js} +2 -2
  99. package/dist/{chunk-JE5ZPFN2.js → chunk-ZSZKNGSQ.js} +3 -3
  100. package/dist/{chunk-MF6KVPWF.js → chunk-ZU5GYVRG.js} +2 -2
  101. package/dist/{clean-X5VL4ILR.js → clean-IXG2MEQ6.js} +16 -16
  102. package/dist/cli.js +56 -56
  103. package/dist/{cloud-4GUUYRD3.js → cloud-C2SUZ4ML.js} +4 -4
  104. package/dist/{cloudrun-KPL32MBI.js → cloudrun-SWS7AI67.js} +4 -4
  105. package/dist/{compare-CVEB5SQC.js → compare-HKONJNY4.js} +27 -27
  106. package/dist/{compiler-RRTQNBUH.js → compiler-67X7VCNS.js} +2 -2
  107. package/dist/{component-TZ2SIYOX.js → component-YBGAFPNS.js} +3 -3
  108. package/dist/{compositions-KRTRDV72.js → compositions-B5T65NKW.js} +9 -9
  109. package/dist/{curve-ZXUAGU4T.js → curve-QZCRRLBS.js} +9 -9
  110. package/dist/{cuts-GY2K2CTK.js → cuts-5DIKHPDZ.js} +10 -10
  111. package/dist/{delete-ZT4FCUX2.js → delete-GHNNYUXL.js} +2 -2
  112. package/dist/{deploy-DVKSQTC7.js → deploy-IARSTZY6.js} +1 -1
  113. package/dist/{describeProject-L4ZW5CI7.js → describeProject-6DA3FMM2.js} +6 -6
  114. package/dist/{diff-AFOP2B3Y.js → diff-JWNEN6CO.js} +19 -19
  115. package/dist/{dist-DPOLFG5U.js → dist-AY2X5DPM.js} +2 -2
  116. package/dist/{doctor-Y7YVL34W.js → doctor-BMUGN4C2.js} +9 -9
  117. package/dist/{energy-YFLFELFX.js → energy-DSK2FPBK.js} +10 -10
  118. package/dist/{events-VL7JKI2K.js → events-6VLVSDSN.js} +3 -3
  119. package/dist/{events-C5QV2MQG.js → events-HD5CYSPO.js} +2 -2
  120. package/dist/{events-THASMGN6.js → events-KKH2U7U5.js} +11 -11
  121. package/dist/{extract-GTNBVQ63.js → extract-IFMYI2DA.js} +10 -10
  122. package/dist/{face-BSRKCB5W.js → face-JD2ZVOH3.js} +10 -10
  123. package/dist/{feedback-MCQ2FKCC.js → feedback-LI55MDGG.js} +11 -11
  124. package/dist/{ffmpeg-3QNN3TQ5.js → ffmpeg-A4M2I6R3.js} +5 -5
  125. package/dist/{figma-IGXE3KWU.js → figma-CNVJZ7BL.js} +3 -3
  126. package/dist/fontLocalizeCli.js +8 -8
  127. package/dist/{frames-XIFLB5KC.js → frames-MOAPFEBS.js} +11 -11
  128. package/dist/{generate-55FZPR3J.js → generate-ZRQYOJ3I.js} +12 -12
  129. package/dist/{get-2MHD7XFA.js → get-2RNNB5KC.js} +2 -2
  130. package/dist/{gpuPolicy-REJFNHWD.js → gpuPolicy-MXPGQGRO.js} +5 -5
  131. package/dist/{grade-compare-CM45H7CR.js → grade-compare-CQHZR7LX.js} +28 -28
  132. package/dist/{heifImagePrep-O3UZHGWR.js → heifImagePrep-PRXKTL2U.js} +6 -6
  133. package/dist/{help-V2GGIKP2.js → help-MDT2MEPS.js} +1 -1
  134. package/dist/{history-NUOQVUNY.js → history-N7H2FN6R.js} +7 -7
  135. package/dist/hyperframe.manifest.json +1 -1
  136. package/dist/hyperframe.runtime.iife.js +64 -64
  137. package/dist/hyperframes-player.global.js +1 -1
  138. package/dist/{info-5CMRZEJA.js → info-NXYRDRHE.js} +7 -7
  139. package/dist/{init-JNL5R27I.js → init-DJ5EJAQI.js} +25 -25
  140. package/dist/{ink-HGQUC6L3.js → ink-WZSITVIW.js} +10 -10
  141. package/dist/{inspect-GGOCM324.js → inspect-JAXBBYA3.js} +28 -28
  142. package/dist/{installer-BBY3T5MJ.js → installer-N5OHXI5C.js} +4 -4
  143. package/dist/{keyframes-2D4ZS6HE.js → keyframes-TXNYBMOV.js} +6 -6
  144. package/dist/{lambda-TY2ZCPEN.js → lambda-4LVII6VK.js} +9 -9
  145. package/dist/{layout-X5GT4O2L.js → layout-AS4FJ53O.js} +28 -28
  146. package/dist/{lint-NVOUXE2L.js → lint-DCAYD4CN.js} +6 -6
  147. package/dist/{list-CB4UDTID.js → list-7Z6YRO6I.js} +2 -2
  148. package/dist/{localPage-EYPZRIGY.js → localPage-FUOBAMSA.js} +5 -5
  149. package/dist/{login-L7JTVKV5.js → login-JZ4COLEB.js} +4 -4
  150. package/dist/{look-VHQA2JSS.js → look-QELVFTKU.js} +10 -10
  151. package/dist/{manager-FGQKQMI7.js → manager-ZJPSMHK6.js} +6 -6
  152. package/dist/{measure-5F7QZLO5.js → measure-2I5VAVHN.js} +11 -11
  153. package/dist/{media-treatment-RRFIZKSA.js → media-treatment-MDTQ6564.js} +11 -11
  154. package/dist/{media-use-5YGFOFKI.js → media-use-NFGRWEGA.js} +1 -1
  155. package/dist/{models-5B2RGGBT.js → models-DKSUFPQ6.js} +9 -9
  156. package/dist/{motionShot-JJBQLYCC.js → motionShot-BJARRLMN.js} +14 -14
  157. package/dist/{normalize-audio-LWTNZWDJ.js → normalize-audio-EW5JUESE.js} +8 -8
  158. package/dist/{open-PGRJXREV.js → open-737GUSFD.js} +12 -12
  159. package/dist/{parakeetRunner-OV4NSPB3.js → parakeetRunner-OIVHACYW.js} +10 -10
  160. package/dist/{pipeline-HXGPFQZC.js → pipeline-UTNPWFMF.js} +8 -8
  161. package/dist/{play-JONX6CIM.js → play-ZCYUVL2Y.js} +19 -19
  162. package/dist/{preflight-7OKMMUWG.js → preflight-HWFWGTIG.js} +6 -6
  163. package/dist/{present-EHU52MSU.js → present-AO3XZKSL.js} +15 -15
  164. package/dist/{preview-DCEIITM6.js → preview-ORIRMNIU.js} +17 -17
  165. package/dist/{probe-EA4N3WOT.js → probe-HYO2KC2E.js} +9 -9
  166. package/dist/{producer-FGAOUR7O.js → producer-B4VCP4D2.js} +1 -1
  167. package/dist/{projectConfig-N3ZRVJKB.js → projectConfig-HUR4LZME.js} +6 -6
  168. package/dist/{publication-ZKY2LVN5.js → publication-YH74GUD4.js} +2 -2
  169. package/dist/{publish-RZVDFTBX.js → publish-WIEB5ON4.js} +18 -18
  170. package/dist/{remove-background-V5UXYPJS.js → remove-background-NHLEPVOM.js} +9 -9
  171. package/dist/{render-NEZLBRAY.js → render-3WFVN7HO.js} +38 -38
  172. package/dist/{render-YZSDHP3U.js → render-DQSNIKEG.js} +30 -763
  173. package/dist/{render-UJCPQXGB.js → render-GBJSUM3R.js} +5 -5
  174. package/dist/{render-batch-KPGYARDI.js → render-batch-YZF2XMYL.js} +8 -8
  175. package/dist/{resolver-HWNPLSXK.js → resolver-KGTY7RJU.js} +4 -4
  176. package/dist/{sherpa-HSBYKUQC.js → sherpa-B3T3I2PX.js} +9 -9
  177. package/dist/skills/media-use/references/heygen.md +2 -1
  178. package/dist/{skills-CW23U675.js → skills-FATGE2YZ.js} +5 -5
  179. package/dist/{skillsUpdateCheck-LGBNNYLI.js → skillsUpdateCheck-AHDI2POI.js} +3 -3
  180. package/dist/{snapshot-RK7ED6DW.js → snapshot-SELBWDZ7.js} +52 -36
  181. package/dist/{src-ZDLQFZ4B.js → src-55VXHZM5.js} +7 -7
  182. package/dist/{src-KORQVG7O.js → src-6H4ENHBH.js} +4 -4
  183. package/dist/{staticProjectServer-TFWT5G2L.js → staticProjectServer-E4BZ4YZO.js} +16 -16
  184. package/dist/studio/assets/{hyperframes-player-qeY0knUZ.js → hyperframes-player-merzSkao.js} +1 -1
  185. package/dist/studio/assets/{index-B9O4nOYD.js → index-B4XEg_n-.js} +1 -1
  186. package/dist/studio/assets/{index-BhZkOhf2.js → index-DoXOJGW5.js} +4 -4
  187. package/dist/studio/index.html +1 -1
  188. package/dist/{studio-api-OIZEPWHS.js → studio-api-IERYGFXT.js} +8 -8
  189. package/dist/{studioServer-62MG7LJR.js → studioServer-3RCCQB3T.js} +46 -46
  190. package/dist/{sync-Q3XYLXTX.js → sync-VV7L5GRE.js} +10 -10
  191. package/dist/{telemetry-3YDPEGQK.js → telemetry-KZRSFUC6.js} +3 -3
  192. package/dist/{timeline-VDLKFZZ7.js → timeline-ALU6E3WE.js} +17 -17
  193. package/dist/{tokens-ZZ4G2VKC.js → tokens-XEZF2LGB.js} +2 -2
  194. package/dist/{transcribe-2D6UIVAE.js → transcribe-HJX65J5D.js} +8 -8
  195. package/dist/{transcribe-OYRCZUZM.js → transcribe-OVOOUYK7.js} +16 -16
  196. package/dist/{updateCheck-ZRG5DR74.js → updateCheck-FEOJQNLJ.js} +2 -2
  197. package/dist/{upgrade-ZU6BHCTC.js → upgrade-VM2DGLXZ.js} +2 -2
  198. package/dist/{urlDownloader-5WPUC6C6.js → urlDownloader-YENOMQQF.js} +4 -4
  199. package/dist/{validate-OZRPF6YZ.js → validate-HXTL5C7J.js} +22 -22
  200. package/dist/{video-N2KXXYS3.js → video-3BIRQK2N.js} +6 -6
  201. package/dist/warmCheck.js +36 -36
  202. package/package.json +1 -1
  203. package/dist/chunk-XINVBLXA.js +0 -5030
@@ -20,19 +20,6 @@ import {
20
20
  uploadZipViaDirectUpload
21
21
  } from "./chunk-CE7EQUBV.js";
22
22
  import "./chunk-6A45RKAK.js";
23
- import {
24
- TEXT_FILE_EXTS,
25
- assertUnchanged,
26
- readChecked,
27
- readStaged,
28
- rewriteCssUrls,
29
- rewriteHtmlAttributes,
30
- rewriteStyleBlocks,
31
- stagePublishFiles,
32
- stagedSize,
33
- zipPublishFileMap
34
- } from "./chunk-VUDMPRZN.js";
35
- import "./chunk-53ZOVLGJ.js";
36
23
  import {
37
24
  compositionEntryErrorMessage,
38
25
  parseCompositionEntryArg
@@ -46,30 +33,35 @@ import {
46
33
  reportVariableIssues,
47
34
  resolveVariablesArg,
48
35
  validateVariablesAgainstProject
49
- } from "./chunk-RKDMYKGL.js";
36
+ } from "./chunk-AXRFHQRS.js";
50
37
  import "./chunk-ZBAF6L74.js";
38
+ import {
39
+ OFFLOAD_MIN_BYTES,
40
+ offloadHeavyMedia
41
+ } from "./chunk-PXH3TD4X.js";
51
42
  import {
52
43
  downloadToFile
53
44
  } from "./chunk-NO6F7CLR.js";
45
+ import {
46
+ readStaged,
47
+ stagePublishFiles,
48
+ stagedSize,
49
+ zipPublishFileMap
50
+ } from "./chunk-VUDMPRZN.js";
51
+ import "./chunk-53ZOVLGJ.js";
54
52
  import {
55
53
  resolveCloudBaseUrl
56
54
  } from "./chunk-3ZWUNOTS.js";
57
55
  import "./chunk-V4SD6HQ6.js";
58
- import {
59
- probeAudio
60
- } from "./chunk-SWC3QIEH.js";
61
- import {
62
- findFFmpeg,
63
- findFFprobe,
64
- getFFmpegInstallHint
65
- } from "./chunk-PZ6VVOOE.js";
56
+ import "./chunk-SWC3QIEH.js";
57
+ import "./chunk-NFUJ35XX.js";
66
58
  import {
67
59
  resolveProject
68
- } from "./chunk-OQYGHP3E.js";
60
+ } from "./chunk-UIDZKSF6.js";
69
61
  import {
70
62
  resolveDefaultFpsArg
71
- } from "./chunk-WESIEW2M.js";
72
- import "./chunk-GUJ45PRX.js";
63
+ } from "./chunk-BW3CQT3A.js";
64
+ import "./chunk-AI6Z7BVD.js";
73
65
  import {
74
66
  errorBox,
75
67
  formatBytes,
@@ -77,8 +69,8 @@ import {
77
69
  } from "./chunk-5LOZWO2M.js";
78
70
  import "./chunk-EHZESMRB.js";
79
71
  import "./chunk-A4ZTSQLW.js";
80
- import "./chunk-YTQSLNIA.js";
81
- import "./chunk-6AEHVBMX.js";
72
+ import "./chunk-OG3S6SE6.js";
73
+ import "./chunk-RG7WG2BC.js";
82
74
  import "./chunk-PXVQOMKL.js";
83
75
  import "./chunk-MCDNAIFF.js";
84
76
  import "./chunk-6NJVSTSY.js";
@@ -90,17 +82,15 @@ import "./chunk-54HJ63Q2.js";
90
82
  import {
91
83
  c
92
84
  } from "./chunk-2GICKZ3I.js";
93
- import "./chunk-7UKRCWBO.js";
85
+ import "./chunk-6TXW6LHH.js";
94
86
  import "./chunk-Z5J67X44.js";
95
87
  import "./chunk-5S7W3TUO.js";
96
88
  import "./chunk-D3MUHMFG.js";
97
- import "./chunk-3XYDZQJF.js";
89
+ import "./chunk-KLTD64CP.js";
98
90
  import "./chunk-YWRUQ7XZ.js";
99
- import {
100
- parseAnimatedGifMetadata
101
- } from "./chunk-XCGPPU32.js";
91
+ import "./chunk-IZRC24DI.js";
102
92
  import "./chunk-MEJH7VEA.js";
103
- import "./chunk-XINVBLXA.js";
93
+ import "./chunk-SBQV5FLG.js";
104
94
  import "./chunk-VC76R6W2.js";
105
95
  import "./chunk-OFQWTKPW.js";
106
96
  import "./chunk-RQVDTPGD.js";
@@ -114,31 +104,20 @@ import "./chunk-K4MJX7SR.js";
114
104
  import "./chunk-WE42NVH7.js";
115
105
  import "./chunk-GR2T3BOX.js";
116
106
  import "./chunk-HYRPH6LL.js";
117
- import {
118
- cleanAssetUrl,
119
- isRemoteOrInlineUrl,
120
- resolveLocalAssetCandidates
121
- } from "./chunk-2GTFW4MK.js";
107
+ import "./chunk-2GTFW4MK.js";
122
108
  import "./chunk-CZGHFATT.js";
123
- import {
124
- readAuthoredDurationSeconds,
125
- readMediaOffsetSeconds,
126
- readPlaybackRate,
127
- rewriteAssetPath
128
- } from "./chunk-C2KEGBR3.js";
109
+ import "./chunk-C2KEGBR3.js";
129
110
  import "./chunk-T5ELONXY.js";
130
111
  import "./chunk-FR7YBU3H.js";
131
112
  import "./chunk-DPVXBVLL.js";
132
- import {
133
- parseHTML
134
- } from "./chunk-GWTIFRF5.js";
113
+ import "./chunk-GWTIFRF5.js";
135
114
  import "./chunk-2RY2LWAA.js";
136
115
  import "./chunk-EPQC3FGZ.js";
137
116
  import "./chunk-WC4MTXGN.js";
138
117
  import "./chunk-FBN2M2HK.js";
139
118
  import {
140
119
  withMeta
141
- } from "./chunk-B7OI3WAR.js";
120
+ } from "./chunk-SANQC4QD.js";
142
121
  import "./chunk-BR2JQQC5.js";
143
122
  import "./chunk-BLBMPEBX.js";
144
123
  import "./chunk-ISN5GRYI.js";
@@ -149,7 +128,7 @@ import {
149
128
  } from "./chunk-66W5IWLO.js";
150
129
  import "./chunk-J3RXEDR2.js";
151
130
  import "./chunk-QBXDU24O.js";
152
- import "./chunk-PWHOMCFB.js";
131
+ import "./chunk-V7BBBD5C.js";
153
132
  import {
154
133
  normalizeErrorMessage
155
134
  } from "./chunk-E63BDV4Z.js";
@@ -203,720 +182,8 @@ function detectAspectRatioFromHtmlString(html) {
203
182
  return { kind: "no-match", width, height, ratio };
204
183
  }
205
184
 
206
- // src/cloud/offload.ts
207
- import { execFile } from "child_process";
208
- import { createHash } from "crypto";
209
- import {
210
- copyFileSync,
211
- createReadStream,
212
- mkdirSync,
213
- mkdtempSync,
214
- readFileSync as readFileSync2,
215
- renameSync,
216
- rmSync,
217
- writeFileSync
218
- } from "fs";
219
- import { homedir, tmpdir } from "os";
220
- import { basename as basename2, dirname, extname, join, posix, relative, resolve } from "path";
221
- import { promisify } from "util";
222
-
223
- // src/cloud/offloadTrim.ts
224
- import { basename } from "path";
225
- var TRIM_MARGIN_SECONDS = 0.5;
226
- var RETIMING_SCRIPT_RE = /data-(?:playback-start|media-start|start|duration|end|playback-rate)|\b(?:dataset|setAttribute|currentTime|playbackRate)\b|\.(?:src|loop)\b/;
227
- function mediaSources(el) {
228
- const own = el.getAttribute("src");
229
- const nested = [...el.querySelectorAll("source[src]")].map((s) => s.getAttribute("src"));
230
- return [...own ? [own] : [], ...nested];
231
- }
232
- function hasTimedAncestor(el) {
233
- for (let p = el.parentElement; p; p = p.parentElement) {
234
- const get = (name) => p.getAttribute(name);
235
- if (readMediaOffsetSeconds(get) > 0) return true;
236
- if (p.hasAttribute("data-composition-id") && p.parentElement?.closest("[data-composition-id]")) {
237
- return true;
238
- }
239
- }
240
- return false;
241
- }
242
- function playedWindow(el) {
243
- if (el.hasAttribute("loop") || el.hasAttribute("data-automation") || el.hasAttribute("data-var-src") || hasTimedAncestor(el)) {
244
- return null;
245
- }
246
- const get = (name) => el.getAttribute(name);
247
- const start = readMediaOffsetSeconds(get);
248
- const duration = readAuthoredDurationSeconds(get, Number(get("data-start") ?? 0));
249
- if (duration === null || !(duration > 0)) return null;
250
- return { start, end: start + duration * readPlaybackRate(get) };
251
- }
252
- function mergeWindows(windows, gridPerSecond) {
253
- const down = (t) => Math.floor(t * gridPerSecond) / gridPerSecond;
254
- const up = (t) => Math.ceil(t * gridPerSecond) / gridPerSecond;
255
- const merged = [];
256
- for (const w of [...windows].sort((a, b) => a.start - b.start)) {
257
- const start = down(Math.max(0, w.start - TRIM_MARGIN_SECONDS));
258
- const end = up(w.end + TRIM_MARGIN_SECONDS);
259
- const last = merged.at(-1);
260
- if (last && start <= last.end) last.end = Math.max(last.end, end);
261
- else merged.push({ start, end });
262
- }
263
- return merged;
264
- }
265
- function shiftMediaStart(el, segments) {
266
- const get = (name) => el.getAttribute(name);
267
- const start = readMediaOffsetSeconds(get);
268
- let offset = 0;
269
- for (const segment of segments) {
270
- if (start >= segment.start && start < segment.end) {
271
- const attr = Number.parseFloat(get("data-playback-start") ?? "") >= 0 ? "data-playback-start" : "data-media-start";
272
- el.setAttribute(attr, String(offset + (start - segment.start)));
273
- return;
274
- }
275
- offset += segment.end - segment.start;
276
- }
277
- }
278
- function planTrim(input) {
279
- if (input.mentionedElsewhere || RETIMING_SCRIPT_RE.test(input.scriptCode)) return null;
280
- const { document } = parseHTML(input.entryHtml);
281
- const uses = [];
282
- let sources = 0;
283
- for (const el of document.querySelectorAll("video, audio")) {
284
- const matching = mediaSources(el).filter((src) => input.resolveKey(src) === input.path);
285
- if (matching.length === 0) continue;
286
- if (matching.some((src) => src.includes("#"))) return null;
287
- uses.push(el);
288
- sources += matching.length;
289
- }
290
- if (uses.length === 0 || input.entryHtml.split(basename(input.path)).length - 1 !== sources) {
291
- return null;
292
- }
293
- const windows = uses.map(playedWindow);
294
- if (windows.some((w) => w === null)) return null;
295
- const segments = mergeWindows(windows, input.gridPerSecond);
296
- for (const el of uses) shiftMediaStart(el, segments);
297
- return { segments, html: document.toString() };
298
- }
299
-
300
- // src/cloud/offload.ts
301
- var execFileAsync = promisify(execFile);
302
- var OFFLOAD_MIN_BYTES = 5 * 1024 * 1024;
303
- var MiB = 1024 * 1024;
304
- var AUDIO_MAX_BYTES = 15e8;
305
- var ACCEPTED = {
306
- ".mp4": { contentType: "video/mp4", maxBytes: 200 * MiB },
307
- ".m4v": { contentType: "video/mp4", maxBytes: 200 * MiB },
308
- ".mov": { contentType: "video/quicktime", maxBytes: 200 * MiB },
309
- ".webm": { contentType: "video/webm", maxBytes: 200 * MiB },
310
- ".png": { contentType: "image/png", maxBytes: 200 * MiB },
311
- ".jpg": { contentType: "image/jpeg", maxBytes: 200 * MiB },
312
- ".jpeg": { contentType: "image/jpeg", maxBytes: 200 * MiB },
313
- ".webp": { contentType: "image/webp", maxBytes: 200 * MiB },
314
- ".wav": { contentType: "audio/wav", maxBytes: AUDIO_MAX_BYTES },
315
- ".mp3": { contentType: "audio/mpeg", maxBytes: AUDIO_MAX_BYTES }
316
- };
317
- var VIDEO_EXTS = /* @__PURE__ */ new Set([
318
- ".mp4",
319
- ".m4v",
320
- ".mov",
321
- ".webm",
322
- ".mkv",
323
- ".avi",
324
- ".mpg",
325
- ".mpeg",
326
- ".ts",
327
- ".m2ts",
328
- ".mts",
329
- ".flv",
330
- ".wmv",
331
- ".ogv",
332
- ".3gp"
333
- ]);
334
- var AUDIO_EXTS = /* @__PURE__ */ new Set([
335
- ".wav",
336
- ".mp3",
337
- ".m4a",
338
- ".aac",
339
- ".ogg",
340
- ".oga",
341
- ".opus",
342
- ".flac",
343
- ".aif",
344
- ".aiff",
345
- ".wma"
346
- ]);
347
- var CONVERTIBLE_IMAGE_EXTS = /* @__PURE__ */ new Set([".gif", ".avif", ".bmp", ".tif", ".tiff"]);
348
- var REENCODE_PRESETS = {
349
- video: {
350
- ext: ".mp4",
351
- contentType: "video/mp4",
352
- args: ["-c:v", "libx264", "-preset", "slow", "-crf", "18", "-pix_fmt", "yuv420p"],
353
- audio: ["-c:a", "aac", "-b:a", "320k", "-movflags", "+faststart"]
354
- },
355
- hdrVideo: {
356
- ext: ".mp4",
357
- contentType: "video/mp4",
358
- args: ["-c:v", "libx265", "-preset", "slow", "-crf", "18", "-pix_fmt", "yuv420p10le"],
359
- audio: ["-tag:v", "hvc1", "-c:a", "aac", "-b:a", "320k", "-movflags", "+faststart"]
360
- },
361
- alphaVideo: {
362
- ext: ".webm",
363
- contentType: "video/webm",
364
- args: ["-c:v", "libvpx-vp9", "-crf", "18", "-b:v", "0", "-pix_fmt", "yuva420p"],
365
- audio: ["-c:a", "libopus", "-b:a", "256k"]
366
- },
367
- audio: {
368
- ext: ".wav",
369
- contentType: "audio/wav",
370
- args: ["-vn"],
371
- audio: ["-c:a", "pcm_s16le"]
372
- },
373
- image: {
374
- ext: ".png",
375
- contentType: "image/png",
376
- args: ["-frames:v", "1"],
377
- audio: []
378
- }
379
- };
380
- function defaultOffloadCachePath() {
381
- return join(homedir(), ".cache", "hyperframes", "cloud-assets.json");
382
- }
383
- function readCache(path) {
384
- try {
385
- return JSON.parse(readFileSync2(path, "utf-8")) ?? {};
386
- } catch {
387
- return {};
388
- }
389
- }
390
- function writeCache(path, cache) {
391
- mkdirSync(dirname(path), { recursive: true });
392
- const tmp = `${path}.${process.pid}.tmp`;
393
- writeFileSync(tmp, JSON.stringify(cache, null, 2));
394
- renameSync(tmp, path);
395
- }
396
- async function stillServed(entry, fetchImpl) {
397
- try {
398
- const res = await fetchImpl(entry.url, { method: "HEAD" });
399
- return res.ok && Number(res.headers.get("content-length")) === entry.size_bytes;
400
- } catch {
401
- return false;
402
- }
403
- }
404
- function mediaKind(path) {
405
- const ext = extname(path).toLowerCase();
406
- if (VIDEO_EXTS.has(ext)) return "video";
407
- if (AUDIO_EXTS.has(ext)) return "audio";
408
- if (ACCEPTED[ext] || CONVERTIBLE_IMAGE_EXTS.has(ext)) return "image";
409
- return null;
410
- }
411
- async function probeVideo(path) {
412
- const ffprobe = findFFprobe();
413
- if (!ffprobe)
414
- throw new Error(`Re-encoding needs ffprobe. Install ffmpeg: ${getFFmpegInstallHint()}`);
415
- const { stdout } = await execFileAsync(ffprobe, [
416
- "-v",
417
- "error",
418
- "-select_streams",
419
- "v:0",
420
- "-show_entries",
421
- "stream=codec_name,pix_fmt,color_primaries,color_transfer,color_space:stream_tags",
422
- "-of",
423
- "json",
424
- "--",
425
- path
426
- ]);
427
- const stream = JSON.parse(stdout).streams?.[0] ?? {};
428
- const tags = stream.tags ?? {};
429
- const alphaTag = Object.entries(tags).some(
430
- ([k, v]) => k.toLowerCase() === "alpha_mode" && v === "1"
431
- );
432
- const transfer = stream.color_transfer;
433
- return {
434
- // VP9 alpha keeps pix_fmt yuv420p and flags the plane only in the ALPHA_MODE tag.
435
- alpha: alphaTag || /^(yuva|rgba|argb|bgra|abgr|gbrap|ya)/.test(String(stream.pix_fmt ?? "")),
436
- hdr: transfer === "smpte2084" || transfer === "arib-std-b67",
437
- codec: stream.codec_name,
438
- color: {
439
- primaries: stream.color_primaries,
440
- transfer,
441
- space: stream.color_space
442
- }
443
- };
444
- }
445
- function alphaDecoderArgs(probe) {
446
- if (!probe.alpha) return [];
447
- if (probe.codec === "vp9") return ["-c:v", "libvpx-vp9"];
448
- if (probe.codec === "vp8") return ["-c:v", "libvpx"];
449
- return [];
450
- }
451
- function hdrColorArgs({ color }) {
452
- return [
453
- ...color.primaries ? ["-color_primaries", color.primaries] : [],
454
- ...color.transfer ? ["-color_trc", color.transfer] : [],
455
- ...color.space ? ["-colorspace", color.space] : []
456
- ];
457
- }
458
- var seconds = (t) => (Math.floor(t * 1e6) / 1e6).toFixed(6);
459
- async function segmentArgs(sourcePath, decoder, segments, media) {
460
- if (media === "image") return [...decoder, "-i", sourcePath];
461
- const audio = await keptAudio(sourcePath, media);
462
- const cuts = segments?.length ? segments : [void 0];
463
- const inputs = cuts.flatMap((s) => [...decoder, ...seekArgs(s), "-i", sourcePath]);
464
- const video = media === "video";
465
- return [
466
- ...inputs,
467
- ...cuts.length > 1 ? concatArgs(cuts.length, video, audio) : streamMaps(video, audio)
468
- ];
469
- }
470
- async function keptAudio(sourcePath, media) {
471
- const audio = (await probeAudio(sourcePath))?.audioStream ?? null;
472
- if (media === "audio" && audio === null) {
473
- throw new Error("the file has no audio track ffmpeg can decode");
474
- }
475
- return audio;
476
- }
477
- var seekArgs = (s) => s ? ["-ss", seconds(s.start), "-t", seconds(s.end - s.start)] : [];
478
- var streamMaps = (video, audio) => [
479
- ...video ? ["-map", "0:V:0"] : [],
480
- ...audio === null ? [] : ["-map", `0:a:${audio}`]
481
- ];
482
- var mediaOf = (preset) => preset === "audio" || preset === "image" ? preset : "video";
483
- function concatArgs(count, video, audio) {
484
- const pad = (i) => (video ? `[${i}:v]` : "") + (audio === null ? "" : `[${i}:a:${audio}]`);
485
- const pads = Array.from({ length: count }, (_, i) => pad(i)).join("");
486
- const flags = `n=${count}:v=${video ? 1 : 0}:a=${audio === null ? 0 : 1}`;
487
- return [
488
- "-filter_complex",
489
- `${pads}concat=${flags}${video ? "[v]" : ""}${audio === null ? "" : "[a]"}`,
490
- ...video ? ["-map", "[v]"] : [],
491
- ...audio === null ? [] : ["-map", "[a]"]
492
- ];
493
- }
494
- async function ffmpegReencode(sourcePath, presetName, segments) {
495
- const ffmpeg = findFFmpeg();
496
- if (!ffmpeg) throw new Error(`Re-encoding needs ffmpeg. Install it: ${getFFmpegInstallHint()}`);
497
- const preset = REENCODE_PRESETS[presetName];
498
- const probe = preset.contentType.startsWith("video/") ? await probeVideo(sourcePath) : void 0;
499
- const decoder = probe ? alphaDecoderArgs(probe) : [];
500
- const color = presetName === "hdrVideo" && probe ? hdrColorArgs(probe) : [];
501
- const workDir = mkdtempSync(join(tmpdir(), "hf-offload-"));
502
- const outPath = join(workDir, `${basename2(sourcePath, extname(sourcePath))}${preset.ext}`);
503
- try {
504
- await execFileAsync(
505
- ffmpeg,
506
- [
507
- "-v",
508
- "error",
509
- "-y",
510
- ...await segmentArgs(sourcePath, decoder, segments, mediaOf(presetName)),
511
- ...preset.args,
512
- ...color,
513
- ...preset.audio,
514
- outPath
515
- ],
516
- { maxBuffer: 16 * MiB }
517
- );
518
- return {
519
- bytes: readChecked(outPath, ({ size }) => assertFitsAsset(sourcePath, outPath, size)),
520
- filename: basename2(outPath),
521
- contentType: preset.contentType
522
- };
523
- } finally {
524
- rmSync(workDir, { recursive: true, force: true });
525
- }
526
- }
527
- async function choosePreset(sourcePath, kind) {
528
- if (kind === "audio") return "audio";
529
- if (kind === "image") return await isAnimatedImage(sourcePath) ? null : "image";
530
- const probe = await probeVideo(sourcePath);
531
- return probe.alpha ? "alphaVideo" : probe.hdr ? "hdrVideo" : "video";
532
- }
533
- async function isAnimatedImage(path) {
534
- if (extname(path).toLowerCase() === ".gif") {
535
- return parseAnimatedGifMetadata(readFileSync2(path))?.animated ?? true;
536
- }
537
- const ffprobe = findFFprobe();
538
- if (!ffprobe) return true;
539
- try {
540
- const { stdout } = await execFileAsync(ffprobe, [
541
- "-v",
542
- "error",
543
- "-show_entries",
544
- "stream=nb_frames",
545
- "-of",
546
- "csv=p=0",
547
- "--",
548
- path
549
- ]);
550
- return stdout.split("\n").some((line) => Number(line) > 1);
551
- } catch {
552
- return true;
553
- }
554
- }
555
- async function trimGrid(sourcePath, kind) {
556
- if (kind === "audio") return 1e3;
557
- if (kind !== "video") return null;
558
- const ffprobe = findFFprobe();
559
- if (!ffprobe) return null;
560
- const { stdout } = await execFileAsync(ffprobe, [
561
- "-v",
562
- "error",
563
- "-select_streams",
564
- "v:0",
565
- "-show_entries",
566
- "stream=r_frame_rate,avg_frame_rate",
567
- "-of",
568
- "csv=p=0",
569
- "--",
570
- sourcePath
571
- ]);
572
- const rate = (fraction) => {
573
- const [num, den] = (fraction ?? "").split("/").map(Number);
574
- return num && den ? num / den : NaN;
575
- };
576
- const [real, average] = stdout.trim().split(",");
577
- const fps = rate(real);
578
- return Number.isFinite(fps) && Math.abs(fps - rate(average)) < 0.01 ? fps : null;
579
- }
580
- var ffmpegReencoder = { choose: choosePreset, trimGrid, run: ffmpegReencode };
581
- async function stagedSha256(file) {
582
- if (Buffer.isBuffer(file)) return createHash("sha256").update(file).digest("hex");
583
- const hash = createHash("sha256");
584
- for await (const chunk of createReadStream(file.absPath)) hash.update(chunk);
585
- assertUnchanged(file);
586
- return hash.digest("hex");
587
- }
588
- function snapshotPath(path, file, tempFiles) {
589
- return Buffer.isBuffer(file) ? stagedCopy(path, file, tempFiles) : file.absPath;
590
- }
591
- function stagedCopy(path, file, tempFiles) {
592
- const dir = mkdtempSync(join(tmpdir(), "hf-offload-src-"));
593
- tempFiles.push(dir);
594
- const copy = join(dir, basename2(path));
595
- if (Buffer.isBuffer(file)) writeFileSync(copy, file);
596
- else {
597
- copyFileSync(file.absPath, copy);
598
- assertUnchanged(file);
599
- }
600
- return copy;
601
- }
602
- function textOf(path, file) {
603
- return TEXT_FILE_EXTS.test(path) && Buffer.isBuffer(file) ? file.toString("utf-8") : void 0;
604
- }
605
- function scriptCode(fileMap) {
606
- const parts = [];
607
- for (const [path, content] of fileMap) {
608
- const text = textOf(path, content);
609
- if (text === void 0) continue;
610
- if (/\.html?$/i.test(path)) {
611
- for (const script of parseHTML(text).document.querySelectorAll("script:not([src])")) {
612
- parts.push(script.textContent ?? "");
613
- }
614
- } else if (/\.(m?js|cjs|json)$/i.test(path)) parts.push(text);
615
- }
616
- return parts.join("\n");
617
- }
618
- function assertFitsAsset(path, filename, size) {
619
- const maxBytes = ACCEPTED[extname(filename).toLowerCase()]?.maxBytes ?? 0;
620
- if (size > maxBytes) {
621
- throw new Error(
622
- `${path} is ${formatBytes(size)} after re-encoding at visually lossless quality, over the ${formatBytes(maxBytes)} a HeyGen asset can hold.`
623
- );
624
- }
625
- }
626
- async function planFile(ctx, path, file) {
627
- const kind = mediaKind(path);
628
- const size = stagedSize(file);
629
- if (!kind || size < OFFLOAD_MIN_BYTES) return null;
630
- const accepted = ACCEPTED[extname(path).toLowerCase()];
631
- const asIs = accepted !== void 0 && size <= accepted.maxBytes;
632
- const mayBeCached = ctx.opts.upload !== void 0 || (asIs ? ctx.cachedSizes.has(size) : ctx.cachedSizes.size > 0);
633
- const sha256 = mayBeCached ? await stagedSha256(file) : void 0;
634
- const keyFor = (variant2) => sha256 && `${ctx.opts.apiBaseUrl} ${sha256} ${variant2}`;
635
- if (asIs) {
636
- return { key: keyFor("as-is"), sourcePath: "", contentType: accepted?.contentType };
637
- }
638
- const sourcePath = snapshotPath(path, file, ctx.tempFiles);
639
- const preset = await ctx.reencoder.choose(sourcePath, kind);
640
- if (!preset) return null;
641
- const segments = kind === "image" ? null : await planFileTrim(ctx, path, sourcePath, kind);
642
- const variant = JSON.stringify([REENCODE_PRESETS[preset], segments]);
643
- return { key: keyFor(variant), preset, sourcePath, segments: segments ?? void 0 };
644
- }
645
- async function planFileTrim(ctx, path, sourcePath, kind) {
646
- const entryPath = ctx.opts.entryPath ?? "index.html";
647
- const entryHtml = textOf(entryPath, ctx.fileMap.get(entryPath));
648
- const gridPerSecond = entryHtml ? await ctx.reencoder.trimGrid?.(sourcePath, kind) : null;
649
- if (!entryHtml || !gridPerSecond) return null;
650
- const name = basename2(path);
651
- const plan = planTrim({
652
- entryHtml,
653
- path,
654
- gridPerSecond,
655
- resolveKey: (raw) => htmlSrcKey(ctx.absDir, entryPath, raw, ctx.fileMap),
656
- mentionedElsewhere: [...ctx.fileMap].some(
657
- ([other, content]) => other !== entryPath && other !== path && !!textOf(other, content)?.includes(name)
658
- ),
659
- scriptCode: scriptCode(ctx.fileMap)
660
- });
661
- if (!plan) return null;
662
- ctx.fileMap.set(entryPath, Buffer.from(plan.html, "utf-8"));
663
- return plan.segments;
664
- }
665
- async function offloadFile(ctx, path, file) {
666
- const plan = await planFile(ctx, path, file);
667
- if (!plan) return null;
668
- const item = {
669
- path,
670
- size_bytes: stagedSize(file),
671
- action: plan.preset ? "reencode" : "upload",
672
- ...plan.segments && {
673
- trimmed_to_seconds: plan.segments.reduce((sum, s) => sum + s.end - s.start, 0)
674
- }
675
- };
676
- const hit = plan.key === void 0 ? void 0 : ctx.cache[plan.key];
677
- if (hit && (!ctx.opts.upload || await stillServed(hit, ctx.fetchImpl))) {
678
- return { ...item, action: "cached", url: hit.url };
679
- }
680
- if (!ctx.opts.upload) return item;
681
- return { ...item, url: await uploadPlanned(ctx, ctx.opts.upload, path, file, plan) };
682
- }
683
- async function uploadPlanned(ctx, upload, path, staged, plan) {
684
- const filename = basename2(path);
685
- const file = plan.preset ? await ctx.reencoder.run(plan.sourcePath, plan.preset, plan.segments) : Buffer.isBuffer(staged) ? { bytes: staged, filename, contentType: plan.contentType } : { path: staged.absPath, size: staged.size, filename, contentType: plan.contentType };
686
- if (plan.preset && !Buffer.isBuffer(staged)) assertUnchanged(staged);
687
- const size = "bytes" in file ? file.bytes.byteLength : file.size;
688
- assertFitsAsset(path, file.filename, size);
689
- const asset = await upload(file);
690
- if (!Buffer.isBuffer(staged)) assertUnchanged(staged);
691
- if (plan.key !== void 0) {
692
- ctx.cache[plan.key] = { asset_id: asset.asset_id, url: asset.url, size_bytes: size };
693
- writeCache(ctx.cachePath, ctx.cache);
694
- }
695
- return asset.url;
696
- }
697
- var GIF_PREFIX = "_animated_gif";
698
- async function prepareEntryGifs(ctx, fileMap) {
699
- const entryPath = ctx.opts.entryPath ?? "index.html";
700
- const html = textOf(entryPath, fileMap.get(entryPath));
701
- if (!html || !/\.gif\b/i.test(html)) return;
702
- const sourceAssets = entryGifSources(ctx, entryPath, html);
703
- if (!sourceAssets) return;
704
- const prep = ctx.opts.gifPrep ?? (await import("./src-ZDLQFZ4B.js")).prepareAnimatedGifInputs;
705
- const outputDir = mkdtempSync(join(tmpdir(), "hf-offload-gif-"));
706
- ctx.tempFiles.push(outputDir);
707
- const result = await prep(html, {
708
- projectDir: ctx.absDir,
709
- downloadDir: outputDir,
710
- outputDir,
711
- outputSrcPrefix: posix.relative(posix.dirname(entryPath), GIF_PREFIX),
712
- cacheDir: join(homedir(), ".cache", "hyperframes", "animated-gif"),
713
- sourceAssets
714
- });
715
- if (result.preparedGifs.length === 0) return;
716
- fileMap.set(entryPath, Buffer.from(result.html, "utf-8"));
717
- for (const gif of result.preparedGifs) {
718
- fileMap.set(`${GIF_PREFIX}/${basename2(gif.outputPath)}`, readFileSync2(gif.outputPath));
719
- const source = htmlSrcKey(ctx.absDir, entryPath, gif.sourceSrc.trim(), fileMap);
720
- if (source) ctx.preparedGifSources.push(source);
721
- }
722
- }
723
- function entryGifSources(ctx, entryPath, html) {
724
- const sourceAssets = /* @__PURE__ */ new Map();
725
- let heavy = false;
726
- for (const img of parseHTML(html).document.querySelectorAll("img[src]")) {
727
- const src = img.getAttribute("src").trim();
728
- const key = htmlSrcKey(ctx.absDir, entryPath, src, ctx.fileMap);
729
- if (!key?.toLowerCase().endsWith(".gif")) continue;
730
- const file = ctx.fileMap.get(key);
731
- sourceAssets.set(src, stagedCopy(key, file, ctx.tempFiles));
732
- heavy ||= stagedSize(file) >= OFFLOAD_MIN_BYTES;
733
- }
734
- return heavy ? sourceAssets : null;
735
- }
736
- async function offloadHeavyMedia(projectDir, fileMap, opts) {
737
- const cachePath = opts.cachePath ?? defaultOffloadCachePath();
738
- const cache = readCache(cachePath);
739
- const apiPrefix = `${opts.apiBaseUrl} `;
740
- const ctx = {
741
- absDir: resolve(projectDir),
742
- opts,
743
- cachePath,
744
- cache,
745
- cachedSizes: new Set(
746
- Object.entries(cache).flatMap(
747
- ([key, entry]) => key.startsWith(apiPrefix) ? [entry.size_bytes] : []
748
- )
749
- ),
750
- fetchImpl: opts.fetchImpl ?? fetch,
751
- reencoder: opts.reencoder ?? ffmpegReencoder,
752
- tempFiles: [],
753
- preparedGifSources: [],
754
- fileMap
755
- };
756
- const urls = /* @__PURE__ */ new Map();
757
- const report = [];
758
- let referenced = /* @__PURE__ */ new Set();
759
- try {
760
- await prepareEntryGifs(ctx, fileMap);
761
- referenced = referencedFiles(ctx.absDir, fileMap);
762
- for (const [path, file] of [...fileMap].sort(([a], [b]) => a.localeCompare(b))) {
763
- if (!referenced.has(path)) continue;
764
- const item = await offloadFile(ctx, path, file);
765
- if (!item) continue;
766
- urls.set(path, item.url ?? `https://assets.invalid/${report.length}`);
767
- report.push(item);
768
- opts.onFile?.(item);
769
- }
770
- } finally {
771
- for (const dir of ctx.tempFiles) rmSync(dir, { recursive: true, force: true });
772
- }
773
- if (urls.size > 0) rewriteReferences(ctx.absDir, fileMap, (key) => urls.get(key) ?? null);
774
- dropReplacedFiles(fileMap, report, ctx.preparedGifSources, [...urls.values()]);
775
- dropUnusedHeavyFiles(ctx, referenced, [...urls.values()]);
776
- return report;
777
- }
778
- function dropUnusedHeavyFiles(ctx, referenced, assetUrls) {
779
- const { fileMap } = ctx;
780
- const withoutUrls = (text) => assetUrls.reduce((acc, url) => acc.replaceAll(url, ""), text);
781
- const code = withoutUrls(scriptCode(fileMap));
782
- const variables = ctx.opts.variablesText ?? "";
783
- for (const [path, file] of [...fileMap]) {
784
- if (referenced.has(path) || stagedSize(file) < OFFLOAD_MIN_BYTES) continue;
785
- if (variables.includes(basename2(path))) continue;
786
- if (!isStillMentioned(fileMap, path, code, withoutUrls)) fileMap.delete(path);
787
- }
788
- }
789
- function dropReplacedFiles(fileMap, report, preparedGifSources, assetUrls) {
790
- const withoutUrls = (text) => assetUrls.reduce((acc, url) => acc.replaceAll(url, ""), text);
791
- const code = withoutUrls(scriptCode(fileMap));
792
- for (const item of report) {
793
- if (isStillMentioned(fileMap, item.path, code, withoutUrls)) item.kept_in_archive = true;
794
- else fileMap.delete(item.path);
795
- }
796
- for (const gif of preparedGifSources) {
797
- if (!isStillMentioned(fileMap, gif, code, withoutUrls)) fileMap.delete(gif);
798
- }
799
- }
800
- function isStillMentioned(fileMap, path, code, withoutUrls) {
801
- const ext = extname(path);
802
- if (code.includes(basename2(path, ext)) && code.includes(ext.slice(1))) return true;
803
- const name = basename2(path);
804
- for (const [entryPath, content] of fileMap) {
805
- const contentText = textOf(entryPath, content);
806
- if (entryPath === path || !contentText?.includes(name)) continue;
807
- if (withoutUrls(contentText).includes(name)) return true;
808
- }
809
- return false;
810
- }
811
- function htmlSrcKey(absDir, entryPath, raw, fileMap) {
812
- const clean = cleanAssetUrl(raw);
813
- if (!clean || isRemoteOrInlineUrl(clean)) return null;
814
- const rootRelative = clean.startsWith("/") ? clean : rewriteAssetPath(entryPath, clean, (p) => fileMap.has(p));
815
- for (const candidate of resolveLocalAssetCandidates(absDir, rootRelative)) {
816
- const key = relative(absDir, candidate).replaceAll("\\", "/");
817
- if (fileMap.has(key)) return key;
818
- }
819
- return null;
820
- }
821
- function referencedFiles(absDir, fileMap) {
822
- const keys = /* @__PURE__ */ new Set();
823
- rewriteReferences(absDir, fileMap, (key) => {
824
- if (fileMap.has(key)) keys.add(key);
825
- return null;
826
- });
827
- return keys;
828
- }
829
- function rewriteReferences(absDir, fileMap, urlForKey) {
830
- const urlFor = (rootRelative) => {
831
- for (const candidate of resolveLocalAssetCandidates(absDir, rootRelative)) {
832
- const url = urlForKey(relative(absDir, candidate).replaceAll("\\", "/"));
833
- if (url) return url;
834
- }
835
- return null;
836
- };
837
- for (const [entryPath, content] of [...fileMap]) {
838
- const rewrite = rewriterFor(absDir, entryPath, urlFor, fileMap);
839
- const text = rewrite ? textOf(entryPath, content) : void 0;
840
- const next = rewrite && text !== void 0 ? rewrite(text) : null;
841
- if (next !== null) fileMap.set(entryPath, Buffer.from(next, "utf-8"));
842
- }
843
- }
844
- function rewriterFor(absDir, entryPath, urlFor, fileMap) {
845
- if (/\.html?$/i.test(entryPath)) {
846
- return (text) => rewriteHtmlEntry(absDir, entryPath, text, urlFor, fileMap);
847
- }
848
- if (/\.css$/i.test(entryPath)) return (text) => rewriteCssEntry(absDir, entryPath, text, urlFor);
849
- if (/\.(m?js|cjs|json)$/i.test(entryPath)) return (text) => rewriteStringLiterals(text, urlFor);
850
- return null;
851
- }
852
- function localTarget(raw, toRootRelative, urlFor) {
853
- const clean = cleanAssetUrl(raw);
854
- if (!clean || isRemoteOrInlineUrl(clean)) return null;
855
- const url = urlFor(clean.startsWith("/") ? clean : toRootRelative(clean));
856
- return url && url + raw.trim().slice(clean.length);
857
- }
858
- function rewriteCssEntry(absDir, entryPath, css, urlFor) {
859
- const result = rewriteCssUrls(
860
- css,
861
- resolve(absDir, dirname(entryPath)),
862
- entryPath,
863
- (raw) => localTarget(raw, (clean) => posix.join(posix.dirname(entryPath), clean), urlFor)
864
- );
865
- return result.modified ? result.css : null;
866
- }
867
- function rewriteHtmlEntry(absDir, entryPath, html, urlFor, fileMap) {
868
- const referrerAbsDir = resolve(absDir, dirname(entryPath));
869
- const resolveTarget = (raw) => localTarget(raw, (clean) => rewriteAssetPath(entryPath, clean, (p) => fileMap.has(p)), urlFor);
870
- const { document } = parseHTML(html);
871
- const attrs = rewriteHtmlAttributes(document, referrerAbsDir, entryPath, resolveTarget, {
872
- attrs: ["src", "poster", "href"]
873
- });
874
- const srcsets = rewriteSrcsets(document, resolveTarget);
875
- const styles = rewriteStyleBlocks(document, referrerAbsDir, entryPath, resolveTarget);
876
- let scripts = false;
877
- for (const script of document.querySelectorAll("script")) {
878
- if (script.hasAttribute("src")) continue;
879
- const next = rewriteStringLiterals(script.textContent ?? "", urlFor);
880
- if (next === null) continue;
881
- script.textContent = next;
882
- scripts = true;
883
- }
884
- return attrs || srcsets || styles || scripts ? document.toString() : null;
885
- }
886
- var STRING_LITERAL_RE = /(["'`])([^"'`\\\n$]+)\1/g;
887
- function rewriteStringLiterals(code, urlFor) {
888
- let modified = false;
889
- const next = code.replace(STRING_LITERAL_RE, (full, quote, value) => {
890
- const url = localTarget(value, (clean) => clean, urlFor);
891
- if (!url) return full;
892
- modified = true;
893
- return `${quote}${url}${quote}`;
894
- });
895
- return modified ? next : null;
896
- }
897
- function rewriteSrcsets(document, resolveTarget) {
898
- let modified = false;
899
- for (const el of document.querySelectorAll("[srcset]")) {
900
- const srcset = el.getAttribute("srcset") ?? "";
901
- if (srcset.includes("data:")) continue;
902
- let changed = false;
903
- const next = srcset.split(",").map((part) => {
904
- const [url, ...descriptors] = part.trim().split(/\s+/);
905
- const target = url ? resolveTarget(url, "") : null;
906
- if (!target) return part.trim();
907
- changed = true;
908
- return [target, ...descriptors].join(" ");
909
- }).join(", ");
910
- if (changed) {
911
- el.setAttribute("srcset", next);
912
- modified = true;
913
- }
914
- }
915
- return modified;
916
- }
917
-
918
185
  // src/commands/cloud/render.ts
919
- import { isAbsolute, relative as relative2, resolve as resolvePath } from "path";
186
+ import { isAbsolute, relative, resolve as resolvePath } from "path";
920
187
  import { statSync } from "fs";
921
188
  var VALID_QUALITY = ["draft", "standard", "high"];
922
189
  var VALID_FORMAT = ["mp4", "webm", "mov"];
@@ -1310,7 +577,7 @@ async function prepareLocalArchive(source, composition, asJson, upload, variable
1310
577
  function stageProjectFiles(project, composition) {
1311
578
  try {
1312
579
  const fileMap = stagePublishFiles(project.dir, OFFLOAD_MIN_BYTES);
1313
- const entryPath = relative2(
580
+ const entryPath = relative(
1314
581
  project.dir,
1315
582
  resolvePath(project.dir, composition ?? "index.html")
1316
583
  ).replaceAll("\\", "/");