hyperframes 0.8.142 → 0.8.143

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 (189) hide show
  1. package/dist/{add-YS2RCWEK.js → add-Q5EYDUAY.js} +18 -17
  2. package/dist/{animatedGifPrep-SAMCDT7T.js → animatedGifPrep-H2DUQEZ3.js} +15 -14
  3. package/dist/{asset-BLWC2NWB.js → asset-C7JBYYX4.js} +4 -4
  4. package/dist/{assetCataloger-FVNBBRP3.js → assetCataloger-FRO4G6OU.js} +8 -7
  5. package/dist/{auth-DRZB7OAC.js → auth-FRWLCO36.js} +1 -1
  6. package/dist/{autoUpdate-I5I3BOJK.js → autoUpdate-E4OZXQK6.js} +2 -2
  7. package/dist/{backgroundChecks-VR2QHGNY.js → backgroundChecks-FSUVHN5L.js} +3 -3
  8. package/dist/backgroundChecksWorker.js +3 -3
  9. package/dist/{batchRender-4YUHQI6X.js → batchRender-4U73BYTU.js} +11 -10
  10. package/dist/{beats-7OT7ALV3.js → beats-U6KJWF35.js} +32 -27
  11. package/dist/{benchmark-Q2XQCRTR.js → benchmark-5ONT7V7B.js} +15 -14
  12. package/dist/{browser-7VAWQQZC.js → browser-R4DU46IE.js} +4 -4
  13. package/dist/{bundleWithLocalizedFonts-DDMLLL2R.js → bundleWithLocalizedFonts-VH55VOAL.js} +2 -2
  14. package/dist/{capture-HEJS6M5A.js → capture-26G2DPSI.js} +18 -17
  15. package/dist/{capture-U7ABPKS5.js → capture-OGQAEYKO.js} +2 -2
  16. package/dist/{catalog-DVJ3XPDN.js → catalog-RKORTIUE.js} +19 -18
  17. package/dist/{catch-up-DF6AVSN2.js → catch-up-4OBERRQO.js} +5 -5
  18. package/dist/{check-KXORRWAE.js → check-P2XDN57S.js} +43 -42
  19. package/dist/{checkBrowser-J7HZJTRH.js → checkBrowser-NTGJGAEA.js} +42 -41
  20. package/dist/{chunk-EFDXGAAD.js → chunk-2LBBHMKT.js} +1 -1
  21. package/dist/{chunk-IDX52YJN.js → chunk-33RZPZ4K.js} +189 -42
  22. package/dist/{chunk-JU6Y5TTZ.js → chunk-3NE7ZYU2.js} +2 -2
  23. package/dist/{chunk-TQFG7HTI.js → chunk-3RM2ETQT.js} +0 -168
  24. package/dist/{chunk-PFCFR3KZ.js → chunk-442JNXRM.js} +1 -1
  25. package/dist/{chunk-YFT3BL7N.js → chunk-4M4EC7JX.js} +19 -12
  26. package/dist/{chunk-AM5L5YIA.js → chunk-4OA4LDTU.js} +1 -1
  27. package/dist/{chunk-LQASVU3I.js → chunk-5FISWJ37.js} +12 -4
  28. package/dist/{chunk-JYYOAKHS.js → chunk-6IIGT7BX.js} +1 -1
  29. package/dist/chunk-6TPZSTCL.js +3681 -0
  30. package/dist/{chunk-QGRFOOLE.js → chunk-6XMFEICO.js} +263 -75
  31. package/dist/{chunk-YHRZQJXH.js → chunk-7UYBQ6NF.js} +260 -67
  32. package/dist/{chunk-U7E736AJ.js → chunk-BFDJ63J5.js} +32 -14
  33. package/dist/{chunk-WCJGTLPF.js → chunk-BHVFTYSI.js} +6 -3
  34. package/dist/{chunk-B6SMSALD.js → chunk-BT27OYYX.js} +9 -9
  35. package/dist/{chunk-IXCTG2WY.js → chunk-BYK73CR7.js} +4 -4
  36. package/dist/{chunk-75JJVANE.js → chunk-CLOH4LIB.js} +3 -3
  37. package/dist/{chunk-H2X52H2N.js → chunk-DF2BHILQ.js} +3 -3
  38. package/dist/{chunk-DPHJKWP5.js → chunk-F26LCYRY.js} +42 -34
  39. package/dist/{chunk-5Z63TBTX.js → chunk-FH7WODJH.js} +1 -1
  40. package/dist/{chunk-LTGGTEMA.js → chunk-FVYXDXEV.js} +2 -2
  41. package/dist/{chunk-KYN364DU.js → chunk-GNBGPUJ7.js} +6 -8
  42. package/dist/{chunk-RVCWIIZ7.js → chunk-GV5R5B7Q.js} +1 -1
  43. package/dist/{chunk-FZK35GT4.js → chunk-HC7EVDEL.js} +1 -1
  44. package/dist/{chunk-MVTUV4TP.js → chunk-HLYOEIWM.js} +14 -6
  45. package/dist/{chunk-WSGY5CDQ.js → chunk-HMT2RPZU.js} +6 -6
  46. package/dist/{chunk-JOTLPC6S.js → chunk-HW4AKJ5F.js} +1 -1
  47. package/dist/{chunk-IMY4QQTQ.js → chunk-I7QGQAZM.js} +8 -8
  48. package/dist/{chunk-JFKL3WAE.js → chunk-IWFLMU2N.js} +104 -19
  49. package/dist/{chunk-IHFUKJOR.js → chunk-K2FLNJVB.js} +8 -2
  50. package/dist/chunk-KJJLA674.js +121 -0
  51. package/dist/{chunk-BPZVDBHY.js → chunk-KO5QBV73.js} +1 -1
  52. package/dist/{chunk-WGVOWWVK.js → chunk-KQLGTGE5.js} +3 -3
  53. package/dist/{chunk-R2JEKLDZ.js → chunk-LVX6NK36.js} +3 -3
  54. package/dist/{chunk-6UYZB4TY.js → chunk-LW6HO6U3.js} +4 -4
  55. package/dist/{chunk-OZUQF4NB.js → chunk-MQZVBHEY.js} +123 -8
  56. package/dist/{chunk-7FCDA4RH.js → chunk-N3DQEVSI.js} +2 -2
  57. package/dist/{chunk-A4KQZXZI.js → chunk-NE55C6S5.js} +4 -2
  58. package/dist/{chunk-6RAD4BCC.js → chunk-OBXQRJWQ.js} +2 -2
  59. package/dist/{chunk-LBKDQKWV.js → chunk-OSSHSIMD.js} +1 -1
  60. package/dist/{chunk-TY6XOHEM.js → chunk-P7THMINS.js} +3 -3
  61. package/dist/{chunk-HMUF7FEO.js → chunk-PAGIICKN.js} +2 -2
  62. package/dist/{chunk-OSUKETIH.js → chunk-PJU63L6W.js} +1 -1
  63. package/dist/{chunk-GYE63V4P.js → chunk-POLR33RB.js} +20 -13
  64. package/dist/{chunk-7M4KAPAA.js → chunk-PUGIRFPX.js} +2 -2
  65. package/dist/{chunk-XGMNQQTJ.js → chunk-QFN7NVWM.js} +1 -1
  66. package/dist/{chunk-D2KNWIQ6.js → chunk-QFSCCQIR.js} +1 -1
  67. package/dist/{chunk-WTMUCJ6Z.js → chunk-QRKLPWEX.js} +1 -1
  68. package/dist/{chunk-XTLBLWOV.js → chunk-QVYVUCWD.js} +1 -1
  69. package/dist/{chunk-GK4AIFIH.js → chunk-SDYDNHEE.js} +34 -3
  70. package/dist/{chunk-2NCHQUPX.js → chunk-SQLK7SJL.js} +1 -1
  71. package/dist/{chunk-PMRBLBUP.js → chunk-T42U2W2R.js} +14 -2
  72. package/dist/{chunk-QXPCARFE.js → chunk-TAMQYQGJ.js} +1 -1
  73. package/dist/{chunk-PXSM4HPB.js → chunk-U3X3TPBW.js} +1 -1
  74. package/dist/{chunk-FWRNQOLT.js → chunk-UICWP23D.js} +1 -1
  75. package/dist/{chunk-OKCR3JTO.js → chunk-UM2GRYM3.js} +13 -10
  76. package/dist/{chunk-LJAU4TPS.js → chunk-VIVBA6E6.js} +2 -2
  77. package/dist/{chunk-DZEVA7DI.js → chunk-W35EKBS6.js} +2 -2
  78. package/dist/{chunk-YEIFI443.js → chunk-WPNE5NEP.js} +1 -1
  79. package/dist/{chunk-IW2CKH6A.js → chunk-XONFUK3M.js} +48 -25
  80. package/dist/{chunk-JLKMWY2T.js → chunk-Y6QL2LGO.js} +8 -5
  81. package/dist/{chunk-THXFSPLV.js → chunk-ZIRIDSDB.js} +1 -1
  82. package/dist/chunk-ZLW2V65P.js +209 -0
  83. package/dist/{chunk-6UM3R7PP.js → chunk-ZQQ3SEIE.js} +33 -32
  84. package/dist/{clean-KTHTV5G5.js → clean-YHGPY33K.js} +23 -22
  85. package/dist/cli.js +57 -159
  86. package/dist/{cloud-ARSZWALC.js → cloud-DOFI5ISR.js} +4 -4
  87. package/dist/{cloudrun-NM7RXOCL.js → cloudrun-KTZ4XDHL.js} +13 -12
  88. package/dist/commands/contrast-audit.browser.js +60 -4
  89. package/dist/commands/layout-audit.browser.js +68 -0
  90. package/dist/{compare-CY4UO3RW.js → compare-SMMIZN2C.js} +37 -36
  91. package/dist/{compiler-VTH2D3ID.js → compiler-TEXQWW6N.js} +14 -10
  92. package/dist/{component-FRUIAXIR.js → component-B3GCNGSS.js} +5 -5
  93. package/dist/{compositions-CUSY6ZYY.js → compositions-OQNZZTKF.js} +38 -33
  94. package/dist/{delete-KT3VHP4L.js → delete-EL5LVSEP.js} +4 -4
  95. package/dist/{deterministicFonts-F6WIVL2W.js → deterministicFonts-U2BIMGPG.js} +3 -3
  96. package/dist/{dist-7SZU7MA7.js → dist-5UVIRMSM.js} +7 -6
  97. package/dist/{dist-2GC6XKRQ.js → dist-XN234YFQ.js} +41 -39
  98. package/dist/{doctor-4ROTBL5U.js → doctor-UOL3OI2A.js} +17 -16
  99. package/dist/{dom-IROKGVJI.js → dom-37K6YOH4.js} +2 -2
  100. package/dist/{events-Q5PXT5UC.js → events-K2DB2PBC.js} +2 -2
  101. package/dist/{events-QJDVMKSR.js → events-NIZBS6S7.js} +3 -3
  102. package/dist/{feedback-PQ7TWESA.js → feedback-QMP4E6L7.js} +13 -12
  103. package/dist/{figma-JN5DDBDS.js → figma-2AUJRNVC.js} +3 -3
  104. package/dist/fontLocalizeCli.js +18 -17
  105. package/dist/{get-KT6OTERO.js → get-P5NC7SRM.js} +4 -4
  106. package/dist/{gpuPolicy-LCBWVGEH.js → gpuPolicy-7N5MCE2G.js} +15 -14
  107. package/dist/{grade-compare-VS3RP73G.js → grade-compare-HV5AFZ6P.js} +37 -36
  108. package/dist/{help-AD6FIZIO.js → help-3TSTXBLN.js} +1 -1
  109. package/dist/{history-ZRWYRY7R.js → history-D65XFJ6D.js} +6 -6
  110. package/dist/hyperframe-runtime.js +25 -25
  111. package/dist/hyperframe.manifest.json +1 -1
  112. package/dist/hyperframe.runtime.iife.js +25 -25
  113. package/dist/hyperframes-player.global.js +3 -3
  114. package/dist/hyperframes-slideshow.global.js +23 -23
  115. package/dist/{info-WBBQA2AX.js → info-TXV7MLFO.js} +17 -16
  116. package/dist/{init-A2XBDFGF.js → init-OSDMJZJV.js} +38 -37
  117. package/dist/{inspect-CLTZHA5O.js → inspect-RQQSAYIJ.js} +38 -37
  118. package/dist/{installer-WQDRVXH4.js → installer-CDOB32HE.js} +11 -10
  119. package/dist/{keyframes-3FYOK6H6.js → keyframes-V75Q6GRM.js} +10 -10
  120. package/dist/{lambda-Y2PA2BGS.js → lambda-RODV4RCX.js} +12 -11
  121. package/dist/{layout-4KP5O7IJ.js → layout-IZAI5SFC.js} +38 -37
  122. package/dist/{lint-V4GRFHOJ.js → lint-PLXOXY5R.js} +14 -13
  123. package/dist/{lintProject-RG2KGAXB.js → lintProject-OQ6H6XBR.js} +7 -6
  124. package/dist/{list-OQ4VED6E.js → list-BQBPNKDZ.js} +5 -5
  125. package/dist/{login-W47NKN5S.js → login-NP6F4FHC.js} +4 -4
  126. package/dist/{manager-DXB7JDHU.js → manager-GXYF4AVO.js} +2 -2
  127. package/dist/{manager-524RPYO7.js → manager-RFZNG5YT.js} +2 -2
  128. package/dist/{media-treatment-HJYL3EME.js → media-treatment-PXGMZ4A4.js} +22 -20
  129. package/dist/{models-DYBAD2GQ.js → models-CEZM6XZ7.js} +17 -16
  130. package/dist/{motionShot-7NE2YBB3.js → motionShot-R4GHYWYM.js} +25 -24
  131. package/dist/{normalize-IGLHCWTF.js → normalize-H6KUHHEI.js} +18 -7
  132. package/dist/{normalize-audio-INKCLMS2.js → normalize-audio-MQ7NFCOV.js} +10 -6
  133. package/dist/{open-TYC5THVY.js → open-AKQTGNXF.js} +5 -5
  134. package/dist/{pipeline-EVKEPQEW.js → pipeline-SYJYP2RM.js} +17 -16
  135. package/dist/{play-QMZEM6X3.js → play-NBH4B7PL.js} +31 -29
  136. package/dist/{present-Y7IK3C4W.js → present-XAX55CFS.js} +26 -25
  137. package/dist/{preview-5OQRYE6A.js → preview-OLANKNFA.js} +26 -25
  138. package/dist/{producer-Q6G6JU7B.js → producer-Q6YNZZUJ.js} +1 -1
  139. package/dist/{projectConfig-RJN3DKDB.js → projectConfig-EM26P45P.js} +13 -12
  140. package/dist/{publication-QCPGGN3U.js → publication-OXWJZKSX.js} +8 -7
  141. package/dist/{publish-VZLFIGYY.js → publish-4VBWP2UB.js} +17 -16
  142. package/dist/{remove-background-TKOEHBA5.js → remove-background-REB7427G.js} +19 -18
  143. package/dist/{render-XTXE5CRU.js → render-3CVZ2SZG.js} +13 -12
  144. package/dist/{render-KIIIF6PS.js → render-K25YOG3M.js} +19 -18
  145. package/dist/{render-X3NFNVEQ.js → render-TSE75QUL.js} +35 -34
  146. package/dist/{render-batch-M55YZLZ5.js → render-batch-GGUOK3DS.js} +13 -12
  147. package/dist/{renderCancellation-X5BEHAZU.js → renderCancellation-PZRWB53I.js} +15 -14
  148. package/dist/renderSetupWorker.js +7 -6
  149. package/dist/{resolver-GAMXRA42.js → resolver-S5VK6UCB.js} +10 -9
  150. package/dist/{sherpa-ZYTNFHD5.js → sherpa-LVIUEAGF.js} +18 -17
  151. package/dist/skills/hyperframes-cli/references/doctor-browser.md +24 -1
  152. package/dist/skills/media-use/scripts/lib/cache.mjs +28 -14
  153. package/dist/skills/media-use/scripts/lib/cache.test.mjs +110 -0
  154. package/dist/skills/media-use/scripts/lib/duck.mjs +2 -1
  155. package/dist/skills/media-use/scripts/lib/duck.test.mjs +87 -0
  156. package/dist/skills/media-use/scripts/lib/probe.mjs +6 -1
  157. package/dist/skills/media-use/scripts/lib/probe.test.mjs +73 -0
  158. package/dist/skills/media-use/scripts/lib/words.mjs +1 -1
  159. package/dist/{skills-CZHVAD3J.js → skills-I65FU5HD.js} +5 -5
  160. package/dist/{skillsUpdateCheck-6WLLX53A.js → skillsUpdateCheck-J57RNNIV.js} +3 -3
  161. package/dist/{slideshow-EJ4IMY6P.js → slideshow-4OJEPWNZ.js} +1 -1
  162. package/dist/{snapshot-K7BTJPYQ.js → snapshot-YROOGY22.js} +42 -38
  163. package/dist/{src-3I3RH3V5.js → src-JO5JOV7Y.js} +16 -13
  164. package/dist/{src-YUW26JU5.js → src-X426BZAG.js} +17 -16
  165. package/dist/{staticProjectServer-IKCSGN2B.js → staticProjectServer-5VMBS262.js} +23 -22
  166. package/dist/studio/assets/{hyperframes-player-sAsRuV73.js → hyperframes-player-BXSuksFh.js} +3 -3
  167. package/dist/studio/assets/{index-D3Vij9t1.js → index-BgOVCqjo.js} +1 -1
  168. package/dist/studio/assets/{index-D5q2_7Gw.js → index-FgyO_5Kv.js} +1 -1
  169. package/dist/studio/assets/{index-B-wffzRH.js → index-J7jpL4pj.js} +150 -150
  170. package/dist/studio/index.html +1 -1
  171. package/dist/studio/index.js +122 -160
  172. package/dist/studio/index.js.map +1 -1
  173. package/dist/{studio-api-SQ3NXFSM.js → studio-api-VRBZUGAE.js} +22 -17
  174. package/dist/{studioServer-VVEO7XCH.js → studioServer-DBNKZ6I6.js} +50 -49
  175. package/dist/{synthesize-77PTU6C5.js → synthesize-C3IWDAXF.js} +2 -2
  176. package/dist/{telemetry-FQDKR5XA.js → telemetry-CXAX3TO3.js} +3 -3
  177. package/dist/{timeline-N6ZASFNE.js → timeline-VQ34WH7J.js} +91 -69
  178. package/dist/{tokens-2OIIBBCW.js → tokens-62R7VFAZ.js} +4 -4
  179. package/dist/{transcribe-4F6MK73N.js → transcribe-7KR7IPJA.js} +18 -17
  180. package/dist/{transcribe-7YTUCXDX.js → transcribe-XOHPPL2O.js} +11 -11
  181. package/dist/{tts-TOHSPWEG.js → tts-MUV42JXT.js} +6 -6
  182. package/dist/{updateCheck-AZ2COZFR.js → updateCheck-POYNH3B5.js} +2 -2
  183. package/dist/{upgrade-QAJEYB4X.js → upgrade-NBNOT7J2.js} +2 -2
  184. package/dist/{urlDownloader-LSMFEO3R.js → urlDownloader-3NS63A7B.js} +14 -13
  185. package/dist/{validate-GW5MDL36.js → validate-Y2QDHAEP.js} +40 -27
  186. package/dist/{video-PRNOKUK3.js → video-SJDMTSTL.js} +15 -14
  187. package/package.json +1 -1
  188. package/dist/chunk-J4UX3RS3.js +0 -3717
  189. /package/dist/{chunk-HBBJFK6I.js → chunk-APDLWWFG.js} +0 -0
@@ -21,7 +21,7 @@ import {
21
21
  splitElementInHtml,
22
22
  unwrapElementsFromHtml,
23
23
  wrapElementsInHtml
24
- } from "./chunk-OKCR3JTO.js";
24
+ } from "./chunk-UM2GRYM3.js";
25
25
  import {
26
26
  MAX_WINDOW_IDLE_MS,
27
27
  STUDIO_SIGNATURE_MANIFEST_PATHS,
@@ -39,9 +39,11 @@ import {
39
39
  DEFAULT_TARGET_LUFS,
40
40
  absoluteLoudnessPlan,
41
41
  measureAudio,
42
+ requestSubPath,
43
+ requestedProjectPath,
42
44
  requiredFfmpeg,
43
45
  resolveLocalAudioPath
44
- } from "./chunk-U7E736AJ.js";
46
+ } from "./chunk-BFDJ63J5.js";
45
47
  import {
46
48
  PROXY_PARAMS_VERSION,
47
49
  PROXY_PENDING_RETRY_AFTER_SECONDS,
@@ -63,7 +65,7 @@ import {
63
65
  scanProjectMediaCodecMap,
64
66
  shouldPrewarmProxy,
65
67
  waitForProxy
66
- } from "./chunk-6UM3R7PP.js";
68
+ } from "./chunk-ZQQ3SEIE.js";
67
69
  import {
68
70
  STUDIO_MOTION_PATH,
69
71
  createStudioMotionRenderBodyScript,
@@ -96,10 +98,10 @@ import {
96
98
  } from "./chunk-TJSTGSAW.js";
97
99
  import {
98
100
  addScenePartsManifest
99
- } from "./chunk-DPHJKWP5.js";
101
+ } from "./chunk-F26LCYRY.js";
100
102
  import {
101
103
  ensureHfIds
102
- } from "./chunk-A4KQZXZI.js";
104
+ } from "./chunk-NE55C6S5.js";
103
105
  import {
104
106
  PREVIEW_PROXY_BOX_PARAM,
105
107
  formatPreviewProxyBox,
@@ -109,12 +111,7 @@ import {
109
111
  parseFps,
110
112
  parsePreviewProxyBox,
111
113
  sameInstant
112
- } from "./chunk-YFT3BL7N.js";
113
- import {
114
- MagicString,
115
- VALID_CANVAS_RESOLUTIONS,
116
- unrollComputedTimeline
117
- } from "./chunk-OZUQF4NB.js";
114
+ } from "./chunk-4M4EC7JX.js";
118
115
  import {
119
116
  AFTER_FONTS_SCRIPT_TYPE,
120
117
  RUNTIME_BOOTSTRAP_ATTR,
@@ -128,7 +125,15 @@ import {
128
125
  resolveRateSpec,
129
126
  sourceTimeAt,
130
127
  stripEmbeddedRuntimeScripts
131
- } from "./chunk-J4UX3RS3.js";
128
+ } from "./chunk-6TPZSTCL.js";
129
+ import {
130
+ HTML_ATTRIBUTE_ENTITIES,
131
+ MagicString,
132
+ VALID_CANVAS_RESOLUTIONS,
133
+ decodeAuthoredAttribute,
134
+ scanHtmlOpeningTags,
135
+ unrollComputedTimeline
136
+ } from "./chunk-MQZVBHEY.js";
132
137
  import {
133
138
  ProjectRootMissingError,
134
139
  folderGone,
@@ -140,20 +145,24 @@ import {
140
145
  import {
141
146
  isWithinProjectRoot,
142
147
  readProjectFile
143
- } from "./chunk-JFKL3WAE.js";
148
+ } from "./chunk-IWFLMU2N.js";
144
149
  import {
145
150
  FFPROBE_PATH_ENV,
146
151
  findFfBinary
147
152
  } from "./chunk-PJ3HDUCY.js";
148
153
  import {
154
+ decodeCssEscapes,
155
+ decodeWellFormedEscapes,
156
+ decodedUrlPath,
157
+ encodeUrlPath,
149
158
  readMediaOffsetSeconds,
150
159
  rewriteAssetPaths,
151
160
  rewriteCssAssetUrls,
152
161
  rewriteInlineStyleAssetUrls
153
- } from "./chunk-TQFG7HTI.js";
162
+ } from "./chunk-ZLW2V65P.js";
154
163
  import {
155
164
  parseHTML
156
- } from "./chunk-GK4AIFIH.js";
165
+ } from "./chunk-SDYDNHEE.js";
157
166
  import {
158
167
  ancestor,
159
168
  full,
@@ -291,7 +300,7 @@ function clearElementScreenshotIsolation() {
291
300
  page.__hfThumbnailFaded = [];
292
301
  }
293
302
 
294
- // ../studio-server/dist/chunk-5VCIZYUE.js
303
+ // ../studio-server/dist/chunk-AYKLBPP2.js
295
304
  import { resolve } from "path";
296
305
  function isAutoProxyEnabled(adapter) {
297
306
  return adapter.autoProxy !== false;
@@ -381,7 +390,7 @@ import {
381
390
  readdirSync as readdirSync2,
382
391
  realpathSync
383
392
  } from "fs";
384
- import { resolve as resolve2, dirname as dirname3, join as join6 } from "path";
393
+ import { resolve as resolve2, dirname as dirname3, join as join6, sep as sep2 } from "path";
385
394
  import { readFileSync as readFileSync2 } from "fs";
386
395
  import { createHash as createHash2 } from "crypto";
387
396
  import { existsSync, readFileSync as readFileSync3 } from "fs";
@@ -1950,8 +1959,8 @@ function upsertProp(ms, objNode, key, value) {
1950
1959
  if (existing) {
1951
1960
  ms.overwrite(existing.value.start, existing.value.end, valueToCode(value));
1952
1961
  } else {
1953
- const sep3 = objNode.properties.length > 0 ? ", " : "";
1954
- ms.appendLeft(objNode.end - 1, `${sep3}${safeKey(key)}: ${valueToCode(value)}`);
1962
+ const sep4 = objNode.properties.length > 0 ? ", " : "";
1963
+ ms.appendLeft(objNode.end - 1, `${sep4}${safeKey(key)}: ${valueToCode(value)}`);
1955
1964
  }
1956
1965
  }
1957
1966
  function isEditableVarKey(key) {
@@ -2569,8 +2578,8 @@ function insertNewKeyframe(ms, kfNode, percentage, pctKey, valueCode) {
2569
2578
  if (insertBeforeProp) {
2570
2579
  ms.appendLeft(insertBeforeProp.start, `${JSON.stringify(pctKey)}: ${valueCode}, `);
2571
2580
  } else {
2572
- const sep3 = allProps.length > 0 ? ", " : "";
2573
- ms.appendLeft(kfNode.end - 1, `${sep3}${JSON.stringify(pctKey)}: ${valueCode}`);
2581
+ const sep4 = allProps.length > 0 ? ", " : "";
2582
+ ms.appendLeft(kfNode.end - 1, `${sep4}${JSON.stringify(pctKey)}: ${valueCode}`);
2574
2583
  }
2575
2584
  }
2576
2585
  function collapseKeyframesToFlat(ms, varsNode, source, remainingRecord) {
@@ -3048,8 +3057,8 @@ function enableArcPath(ms, call, animation, config) {
3048
3057
  const k = propKeyName2(p);
3049
3058
  return k !== "x" && k !== "y";
3050
3059
  });
3051
- const sep3 = survivesRemoval ? ", " : "";
3052
- ms.appendRight(vars.start + 1, ` motionPath: ${motionPathCode}${sep3}`);
3060
+ const sep4 = survivesRemoval ? ", " : "";
3061
+ ms.appendRight(vars.start + 1, ` motionPath: ${motionPathCode}${sep4}`);
3053
3062
  stripXYFromKeyframes(ms, findPropertyNode2(call.varsArg, "keyframes"));
3054
3063
  removePropsByKey(ms, call.varsArg, /* @__PURE__ */ new Set(["x", "y"]));
3055
3064
  return true;
@@ -3612,7 +3621,7 @@ import { existsSync as existsSync7, readFileSync as readFileSync10, statSync as
3612
3621
  import { join as join12, resolve as resolve5 } from "path";
3613
3622
  import { execFile } from "child_process";
3614
3623
  import { readFileSync as readFileSync11, rmSync as rmSync5, statSync as statSync8 } from "fs";
3615
- import { basename as basename2, dirname as dirname6, join as join13, relative as relative4, sep as sep2 } from "path";
3624
+ import { basename as basename2, dirname as dirname6, join as join13, relative as relative4, sep as sep3 } from "path";
3616
3625
  import { createHash as createHash5, randomBytes } from "crypto";
3617
3626
  import { existsSync as existsSync8 } from "fs";
3618
3627
  import { existsSync as existsSync9, readFileSync as readFileSync12, statSync as statSync9 } from "fs";
@@ -4572,12 +4581,6 @@ function resolveGsapWriter(env) {
4572
4581
  if (configured === "recast" || configured === "acorn") return configured;
4573
4582
  throw new Error(`Invalid ${GSAP_WRITER_MIGRATION.flag}=${configured}; expected recast or acorn`);
4574
4583
  }
4575
- function requestSubPath(url, route) {
4576
- const routeSegments = route.split("/");
4577
- const segments = new URL(url).pathname.split("/");
4578
- const start = segments.indexOf(routeSegments[0] ?? "");
4579
- return decodeURIComponent(segments.slice(start + routeSegments.length).join("/"));
4580
- }
4581
4584
  async function loadGsapParser() {
4582
4585
  return import("./gsapParser-UP3PNPC2.js");
4583
4586
  }
@@ -4879,15 +4882,114 @@ var escapeRegExp = (text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4879
4882
  var SEPARATOR = String.raw`\\{0,2}[\\/]`;
4880
4883
  var REFERENCE_START = String.raw`(?<![\w./\\+-])`;
4881
4884
  var FILE_END = String.raw`(?![\w-]|\.\w)`;
4885
+ var ENTITY_SPELLINGS = HTML_ATTRIBUTE_ENTITIES;
4886
+ function referenceSpellings(char) {
4887
+ const spellings = [escapeRegExp(char)];
4888
+ const encoded = encodeUrlPath(char);
4889
+ if (encoded !== char)
4890
+ spellings.push(encoded.replace(/[A-F]/g, (hex) => `[${hex}${hex.toLowerCase()}]`));
4891
+ if (ENTITY_SPELLINGS[char]) spellings.push(...ENTITY_SPELLINGS[char]);
4892
+ if (["'", '"', "`", "$", " ", "(", ")"].includes(char)) {
4893
+ spellings.push(escapeRegExp(`&#92;${char}`), escapeRegExp(`&#92;${escapeHtmlReference(char)}`));
4894
+ }
4895
+ const scriptSpelling = escapeQuotedReference(char, '"');
4896
+ if (scriptSpelling !== char) spellings.push(escapeRegExp(scriptSpelling));
4897
+ if (["'", "`", "$", " ", "(", ")"].includes(char)) spellings.push(escapeRegExp(`\\${char}`));
4898
+ if (/[\t\n\f\r =<>`]/.test(char)) spellings.push(`&#${char.codePointAt(0)};`);
4899
+ if (char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127) {
4900
+ spellings.push(escapeRegExp(`\\${char.charCodeAt(0).toString(16)} `));
4901
+ }
4902
+ return spellings.length === 1 ? spellings[0] : `(?:${spellings.join("|")})`;
4903
+ }
4904
+ function escapeHtmlReference(path) {
4905
+ return path.replace(/[&"']/g, (char) => ENTITY_SPELLINGS[char][0]);
4906
+ }
4907
+ function escapeQuotedReference(path, quote) {
4908
+ const escaped = JSON.stringify(path).slice(1, -1);
4909
+ return quote === '"' ? escaped : escaped.replace(new RegExp(escapeRegExp(quote), "g"), `\\${quote}`);
4910
+ }
4911
+ function escapeRawUrlPath(path) {
4912
+ const encodeSpaces = path.startsWith(" ") || path.endsWith(" ");
4913
+ return path.replace(/[\s\S]/g, (char) => {
4914
+ if (char.charCodeAt(0) < 32 || ":?%#\\".includes(char) || encodeSpaces && char === " ") {
4915
+ return encodeUrlPath(char);
4916
+ }
4917
+ return char;
4918
+ });
4919
+ }
4920
+ function spellLike(reference, path, oldPath, context) {
4921
+ const { syntax, quote, url, encodeAll } = context;
4922
+ if (url && (encodeAll || reference !== oldPath && /%[0-9A-Fa-f]{2}/.test(reference)))
4923
+ return encodeUrlPath(path);
4924
+ switch (syntax) {
4925
+ case "html": {
4926
+ const escaped = escapeHtmlReference(url ? escapeRawUrlPath(path) : path);
4927
+ return ["'", '"'].includes(quote) ? escaped : escaped.replace(/[\t\n\f\r =<>`]/g, (char) => `&#${char.codePointAt(0)};`);
4928
+ }
4929
+ case "script": {
4930
+ if (!["'", '"', "`"].includes(quote)) return path;
4931
+ const escaped = escapeQuotedReference(path, quote);
4932
+ return quote === "`" ? escaped.replace(/\$\{/g, "\\${") : escaped;
4933
+ }
4934
+ case "css":
4935
+ return url ? encodeUrlPath(path) : path;
4936
+ case "plain":
4937
+ return path;
4938
+ }
4939
+ }
4940
+ function referenceSyntax(file) {
4941
+ if (/\.html$/i.test(file)) return "html";
4942
+ if (/\.css$/i.test(file)) return "css";
4943
+ if (/\.(?:[cm]?js|jsx|tsx?|json)$/i.test(file)) return "script";
4944
+ return "plain";
4945
+ }
4946
+ function decodeQuotedReference(text2, syntax) {
4947
+ if (syntax === "css") return decodeCssEscapes(text2);
4948
+ if (syntax === "script") {
4949
+ const controls = { b: "\b", f: "\f", n: "\n", r: "\r", t: " " };
4950
+ return text2.replace(
4951
+ /\\(?:u([0-9a-fA-F]{4})|([bfnrt"'`$\\/]))/g,
4952
+ (_escaped, hex, char) => {
4953
+ if (hex !== void 0) return String.fromCharCode(Number.parseInt(hex, 16));
4954
+ return controls[char] ?? char;
4955
+ }
4956
+ );
4957
+ }
4958
+ return text2;
4959
+ }
4882
4960
  function referencePattern(oldPath, isDirectory) {
4883
- const name = oldPath.split("/").map(escapeRegExp).join(SEPARATOR);
4961
+ const name = oldPath.split("/").map((segment) => Array.from(segment, referenceSpellings).join("")).join(SEPARATOR);
4884
4962
  const end = isDirectory ? `(?=${SEPARATOR})` : FILE_END;
4885
4963
  return new RegExp(
4886
4964
  String.raw`${REFERENCE_START}(?<lead>(?:\.{1,2}${SEPARATOR}|${SEPARATOR}){0,4})${name}${end}`,
4887
4965
  "g"
4888
4966
  );
4889
4967
  }
4968
+ function rewriteEntityAttributes(text2, rewrite) {
4969
+ const parts = [];
4970
+ let cursor = 0;
4971
+ for (const tag of scanHtmlOpeningTags(text2)) {
4972
+ for (const attr of tag.attributes) {
4973
+ if (attr.kind !== "value") continue;
4974
+ const decoded = decodeAuthoredAttribute(attr.value);
4975
+ if (decoded === attr.value) continue;
4976
+ let value = escapeHtmlReference(decoded);
4977
+ if (!attr.quote)
4978
+ value = value.replace(/[\t\n\f\r =<>`]/g, (char) => `&#${char.codePointAt(0)};`);
4979
+ const source = `<x ${attr.name}=${attr.quote}${value}${attr.quote}>`;
4980
+ const updated = rewrite(source);
4981
+ if (updated === source) continue;
4982
+ const replacement = scanHtmlOpeningTags(updated)[0].attributes[0];
4983
+ if (replacement.kind !== "value") throw new Error("Reference rewrite removed its attribute");
4984
+ parts.push(text2.slice(cursor, attr.valueStart), replacement.value);
4985
+ cursor = attr.valueEnd;
4986
+ }
4987
+ }
4988
+ parts.push(text2.slice(cursor));
4989
+ return parts.join("");
4990
+ }
4890
4991
  function referenceRewriter(oldPath, newPath, isDirectory, existing = []) {
4992
+ const oldIdentity = sep2 === "\\" ? oldPath.replace(/\\/g, "/") : oldPath;
4891
4993
  const pattern = referencePattern(oldPath, isDirectory);
4892
4994
  const around = /* @__PURE__ */ new Map();
4893
4995
  const afterLengths = /* @__PURE__ */ new Set();
@@ -4901,24 +5003,123 @@ function referenceRewriter(oldPath, newPath, isDirectory, existing = []) {
4901
5003
  before
4902
5004
  );
4903
5005
  afterLengths.add(after.length);
4904
- window2 = Math.max(window2, path.length * 3);
4905
- }
4906
- }
4907
- const normalized = (text2) => text2.replace(/\\{0,2}[\\/]/g, "/");
4908
- return (text2) => text2.replace(pattern, (...args) => {
4909
- const [match, offset] = [args[0], args.at(-3)];
4910
- const { lead } = args.at(-1);
4911
- const at = offset + lead.length;
4912
- const head = normalized(text2.slice(Math.max(0, at - window2), at));
4913
- const tail = normalized(text2.slice(offset + match.length, offset + match.length + window2));
4914
- const inLonger = [...afterLengths].some((after) => {
4915
- const befores = tail.length >= after && around.get(tail.slice(0, after));
4916
- return befores && [...befores].some(
4917
- ([length, set]) => head.length >= length && set.has(head.slice(head.length - length))
5006
+ window2 = Math.max(window2, path.length * 9);
5007
+ }
5008
+ }
5009
+ const normalized = (text2, context, full2 = false) => {
5010
+ let value = text2;
5011
+ if (context.syntax === "html" || context.htmlAttribute) {
5012
+ value = decodeAuthoredAttribute(value);
5013
+ }
5014
+ value = decodeQuotedReference(value, context.syntax);
5015
+ if (context.url) {
5016
+ value = value.replace(/\\/g, "/");
5017
+ value = full2 ? decodedUrlPath(value) : decodeWellFormedEscapes(value);
5018
+ }
5019
+ return sep2 === "\\" ? value.replace(/\\/g, "/") : value;
5020
+ };
5021
+ return function rewriteText(text2, syntax = "html", normalizeEntities = true) {
5022
+ if (syntax === "html" && normalizeEntities) {
5023
+ text2 = rewriteEntityAttributes(text2, (source) => rewriteText(source, "html", false));
5024
+ }
5025
+ pattern.lastIndex = 0;
5026
+ if (!pattern.test(text2)) return text2;
5027
+ pattern.lastIndex = 0;
5028
+ const tags = syntax === "html" ? scanHtmlOpeningTags(text2) : [];
5029
+ const inlineRegions = tags.filter(
5030
+ (tag) => tag.closed && ["script", "style"].includes(tag.name) && tag.rawTextEnd !== null
5031
+ ).map((tag) => ({
5032
+ start: tag.end,
5033
+ end: tag.rawTextEnd,
5034
+ syntax: tag.name === "style" ? "css" : "script"
5035
+ }));
5036
+ const attributes = tags.flatMap(
5037
+ (tag) => tag.attributes.flatMap((attr) => attr.kind === "value" ? [attr] : [])
5038
+ );
5039
+ const cssContexts = syntax === "css" ? [{ start: 0, end: text2.length, htmlAttribute: false }] : [
5040
+ ...inlineRegions.filter((region) => region.syntax === "css").map((region) => ({ ...region, htmlAttribute: false })),
5041
+ ...attributes.filter((attr) => attr.name === "style").map((attr) => ({ ...attr, htmlAttribute: true }))
5042
+ ];
5043
+ const cssFields = (pattern2) => cssContexts.flatMap(
5044
+ (context) => [...text2.slice(context.start, context.end).matchAll(pattern2)].map((match) => {
5045
+ const prefix = /^(?:url\(\s*|@import\s+)/i.exec(match[0])[0];
5046
+ const rest = match[0].slice(prefix.length);
5047
+ const delimiter = context.htmlAttribute ? /^(?:["']|&quot;|&#39;|&apos;)/.exec(rest)?.[0] : /^["']/.exec(rest)?.[0];
5048
+ const start = context.start + match.index + prefix.length + (delimiter?.length ?? 0);
5049
+ return {
5050
+ start,
5051
+ end: context.start + match.index + match[0].length,
5052
+ syntax: "css",
5053
+ htmlAttribute: context.htmlAttribute,
5054
+ encodeAll: true
5055
+ };
5056
+ })
5057
+ );
5058
+ const urlRegions = [
5059
+ ...attributes.filter((attr) => ["src", "href", "poster", "xlink:href"].includes(attr.name)).map((attr) => ({
5060
+ start: attr.valueStart + (/^[\t\n\f\r ]*/.exec(attr.value)?.[0].length ?? 0),
5061
+ end: attr.valueEnd,
5062
+ syntax: "html",
5063
+ htmlAttribute: true,
5064
+ encodeAll: false
5065
+ })),
5066
+ ...attributes.filter((attr) => attr.name === "srcset").flatMap(
5067
+ (attr) => [...attr.value.matchAll(/(^|,)[\t\n\f\r ]*([^,\t\n\f\r ]+)/g)].map((match) => ({
5068
+ start: attr.valueStart + match.index + match[0].length - match[2].length,
5069
+ end: attr.valueStart + match.index + match[0].length,
5070
+ syntax: "html",
5071
+ htmlAttribute: true,
5072
+ encodeAll: true
5073
+ }))
5074
+ ),
5075
+ ...cssFields(
5076
+ /\burl\((?:\s*"(?:\\.|[^"\\])*"\s*|\s*'(?:\\.|[^'\\])*'\s*|(?:\\.|[^)\\])*)\)/gi
5077
+ ),
5078
+ ...cssFields(/@import\s+(?:"[^"]*"|'[^']*')/gi)
5079
+ ].sort((a, b) => a.start - b.start);
5080
+ let urlIndex = 0;
5081
+ let regionIndex = 0;
5082
+ return text2.replace(pattern, (...args) => {
5083
+ const [match, offset] = [args[0], args.at(-3)];
5084
+ const { lead } = args.at(-1);
5085
+ while (inlineRegions[regionIndex] && inlineRegions[regionIndex].end <= offset) regionIndex++;
5086
+ const region = inlineRegions[regionIndex];
5087
+ const matchSyntax = region && offset >= region.start ? region.syntax : syntax;
5088
+ while (urlRegions[urlIndex] && urlRegions[urlIndex].end <= offset) urlIndex++;
5089
+ const urlRegion = urlRegions[urlIndex];
5090
+ const url = matchSyntax !== "script" && !!urlRegion && offset >= urlRegion.start;
5091
+ const context = {
5092
+ syntax: url ? urlRegion.syntax : matchSyntax,
5093
+ url,
5094
+ htmlAttribute: url && urlRegion.htmlAttribute,
5095
+ encodeAll: url && urlRegion.encodeAll,
5096
+ quote: text2[offset - 1] ?? ""
5097
+ };
5098
+ if (url && offset !== urlRegion.start) return match;
5099
+ const reference = match.slice(lead.length);
5100
+ if (normalized(reference, context, true) !== oldIdentity) return match;
5101
+ if (isDirectory && !normalized(
5102
+ text2.slice(offset + match.length, offset + match.length + 4),
5103
+ context
5104
+ ).startsWith("/"))
5105
+ return match;
5106
+ const at = offset + lead.length;
5107
+ const head = normalized(text2.slice(Math.max(0, at - window2), at), context);
5108
+ const tail = normalized(
5109
+ text2.slice(offset + match.length, offset + match.length + window2),
5110
+ context,
5111
+ context.url
4918
5112
  );
5113
+ const inLonger = [...afterLengths].some((after) => {
5114
+ const befores = tail.length >= after && around.get(tail.slice(0, after));
5115
+ return befores && [...befores].some(
5116
+ ([length, set]) => head.length >= length && set.has(head.slice(head.length - length))
5117
+ );
5118
+ });
5119
+ if (inLonger) return match;
5120
+ return `${lead}${spellLike(reference, newPath, oldPath, context)}`;
4919
5121
  });
4920
- return inLonger ? match : `${lead}${newPath}`;
4921
- });
5122
+ };
4922
5123
  }
4923
5124
  function occurrences(text2, part) {
4924
5125
  const at = [];
@@ -4951,7 +5152,7 @@ function updateReferences(projectDir, oldPath, newPath, isDirectory) {
4951
5152
  if (!isSafePath(projectDir, file) || isPrivateProjectFile(projectDir, file)) continue;
4952
5153
  const content = readableText(file);
4953
5154
  if (content === null) continue;
4954
- const updated = rewrite(content);
5155
+ const updated = rewrite(content, referenceSyntax(file));
4955
5156
  if (updated !== content) {
4956
5157
  replaceFileAtomically(file, updated, statSync3(file).mode);
4957
5158
  updatedCount++;
@@ -5240,7 +5441,7 @@ async function prepareGsapMutationScript(c, res, firstMutation) {
5240
5441
  let block = extractGsapScriptBlock(html);
5241
5442
  if (!block && (firstMutation.type === "add" || firstMutation.type === "add-with-keyframes")) {
5242
5443
  const compId = html.match(/data-composition-id="([^"]+)"/)?.[1] ?? "main";
5243
- const { GSAP_CDN } = await import("./dist-2GC6XKRQ.js");
5444
+ const { GSAP_CDN } = await import("./dist-XN234YFQ.js");
5244
5445
  const bootstrap = [
5245
5446
  `<script src="${GSAP_CDN}"></script>`,
5246
5447
  "<script>",
@@ -6828,10 +7029,11 @@ function registerFileRoutes(api, adapter) {
6828
7029
  const res = await resolveProjectFile(c, adapter, { mustExist: true });
6829
7030
  if ("error" in res) return res.error;
6830
7031
  const body = await c.req.json();
6831
- if (!body.newPath || body.newPath.includes("\0")) {
7032
+ const newPath = body !== null && typeof body === "object" && "newPath" in body ? body.newPath : void 0;
7033
+ if (typeof newPath !== "string" || !newPath || newPath.includes("\0") || /[\uD800-\uDFFF]/u.test(newPath)) {
6832
7034
  return c.json({ error: "newPath required" }, 400);
6833
7035
  }
6834
- const newAbs = resolveWithinProject(res.project.dir, body.newPath);
7036
+ const newAbs = resolveWithinProject(res.project.dir, newPath);
6835
7037
  if (!newAbs) {
6836
7038
  return c.json({ error: "forbidden" }, 403);
6837
7039
  }
@@ -6841,8 +7043,8 @@ function registerFileRoutes(api, adapter) {
6841
7043
  const isDirectory = statSync3(res.absPath, { throwIfNoEntry: false })?.isDirectory() ?? false;
6842
7044
  ensureDir(res.project.dir, newAbs);
6843
7045
  renameSync2(res.absPath, newAbs);
6844
- const updatedFiles = updateReferences(res.project.dir, res.filePath, body.newPath, isDirectory);
6845
- return c.json({ ok: true, path: body.newPath, updatedReferences: updatedFiles });
7046
+ const updatedFiles = updateReferences(res.project.dir, res.filePath, newPath, isDirectory);
7047
+ return c.json({ ok: true, path: newPath, updatedReferences: updatedFiles });
6846
7048
  });
6847
7049
  api.post("/projects/:id/duplicate-file", async (c) => {
6848
7050
  const project = await adapter.resolveProject(c.req.param("id"));
@@ -8074,12 +8276,7 @@ async function generateThumbnail(path, signal) {
8074
8276
  async function resolveSource(adapter, id, url) {
8075
8277
  const project = await adapter.resolveProject(id);
8076
8278
  if (!project) throw new HTTPException(404);
8077
- let relative5;
8078
- try {
8079
- relative5 = requestSubPath(url, "projects/:id/image-thumbnail");
8080
- } catch {
8081
- throw new HTTPException(400);
8082
- }
8279
+ const relative5 = requestSubPath(url, "projects/:id/image-thumbnail");
8083
8280
  if (!/\.jpe?g$/i.test(relative5)) throw new HTTPException(415);
8084
8281
  const path = pinWithinProject(project.dir, relative5);
8085
8282
  if (!path) throw new HTTPException(404);
@@ -8616,7 +8813,7 @@ async function extractStill(projectDir, absPath, source, playhead, tools) {
8616
8813
  imagePath
8617
8814
  );
8618
8815
  if (failed) return failed;
8619
- const depth = relative4(projectDir, fileDir).split(sep2).filter(Boolean).length;
8816
+ const depth = relative4(projectDir, fileDir).split(sep3).filter(Boolean).length;
8620
8817
  const stillPath = `${FREEZE_DIR.join("/")}/${fileName}`;
8621
8818
  return { imageSrc: `${"../".repeat(depth)}${stillPath}`, stillPath, imagePath };
8622
8819
  }
@@ -9159,9 +9356,6 @@ function isVideoPath(path) {
9159
9356
  function isImagePath(path) {
9160
9357
  return IMAGE_EXTENSIONS.has(extname(path).toLowerCase());
9161
9358
  }
9162
- function normalizeProjectAssetPath(path) {
9163
- return path.trim().replace(/^[.]\//, "").replace(/[?#].*$/, "");
9164
- }
9165
9359
  function containsNullByte(path) {
9166
9360
  return path.includes("\0");
9167
9361
  }
@@ -9226,7 +9420,7 @@ function registerMediaRoutes(api, adapter, options = {}) {
9226
9420
  api.get("/projects/:id/media/metadata", async (c) => {
9227
9421
  const project = await adapter.resolveProject(c.req.param("id"));
9228
9422
  if (!project) return c.json({ error: "not found" }, 404);
9229
- const assetPath = normalizeProjectAssetPath(c.req.query("path") ?? "");
9423
+ const assetPath = requestedProjectPath(project.dir, c.req.query("path") ?? "");
9230
9424
  if (!assetPath) return c.json({ error: "path required" }, 400);
9231
9425
  if (containsNullByte(assetPath)) return c.json({ error: "forbidden" }, 403);
9232
9426
  if (/^(?:https?:|data:|blob:)/i.test(assetPath)) {
@@ -9248,7 +9442,7 @@ function registerMediaRoutes(api, adapter, options = {}) {
9248
9442
  const project = await adapter.resolveProject(c.req.param("id"));
9249
9443
  if (!project) return c.json({ error: "not found" }, 404);
9250
9444
  const body = await c.req.json().catch(() => ({}));
9251
- const inputAssetPath = body.inputPath ? normalizeProjectAssetPath(body.inputPath) : "";
9445
+ const inputAssetPath = body.inputPath ? requestedProjectPath(project.dir, body.inputPath) : "";
9252
9446
  if (!inputAssetPath) return c.json({ error: "inputPath required" }, 400);
9253
9447
  if (containsNullByte(inputAssetPath)) return c.json({ error: "forbidden" }, 403);
9254
9448
  if (/^(?:https?:|data:|blob:)/i.test(inputAssetPath)) {
@@ -9262,7 +9456,7 @@ function registerMediaRoutes(api, adapter, options = {}) {
9262
9456
  if (!inputIsVideo && !inputIsImage) {
9263
9457
  return c.json({ error: "background removal supports video or image assets only" }, 400);
9264
9458
  }
9265
- const requestedOutput = body.outputPath ? posix.normalize(normalizeProjectAssetPath(body.outputPath)) : "";
9459
+ const requestedOutput = body.outputPath ? posix.normalize(requestedProjectPath(project.dir, body.outputPath)) : "";
9266
9460
  if (requestedOutput && containsNullByte(requestedOutput)) {
9267
9461
  return c.json({ error: "forbidden" }, 403);
9268
9462
  }
@@ -9693,7 +9887,6 @@ export {
9693
9887
  buildSubCompositionHtml,
9694
9888
  compositionsAffectedBy,
9695
9889
  applyFileMutations,
9696
- requestSubPath,
9697
9890
  MAX_UPLOAD_BYTES,
9698
9891
  affectsPreview,
9699
9892
  PREVIEW_BUNDLE_OPTIONS,
@@ -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
+ resolveWithinProject
9
+ } from "./chunk-G75ENCEZ.js";
7
10
  import {
8
11
  MAX_AUDIO_GAIN_DB,
9
12
  formatAudioGain,
@@ -12,11 +15,28 @@ import {
12
15
  import {
13
16
  findFfBinary
14
17
  } from "./chunk-PJ3HDUCY.js";
18
+ import {
19
+ decodeWellFormedEscapes,
20
+ decodedUrlPath,
21
+ readMediaOffsetSeconds
22
+ } from "./chunk-ZLW2V65P.js";
15
23
 
16
- // ../studio-server/dist/chunk-DSVQ2U7J.js
24
+ // ../studio-server/dist/chunk-32IH7WBY.js
17
25
  import { execFile } from "child_process";
18
26
  import { isAbsolute, relative, resolve } from "path";
19
27
  import { promisify } from "util";
28
+ import { existsSync } from "fs";
29
+ function requestSubPath(url, route) {
30
+ const routeSegments = route.split("/");
31
+ const segments = new URL(url).pathname.split("/");
32
+ const start = segments.indexOf(routeSegments[0] ?? "");
33
+ return decodeWellFormedEscapes(segments.slice(start + routeSegments.length).join("/"));
34
+ }
35
+ function requestedProjectPath(projectDir, field) {
36
+ const trimmed = field.trim().replace(/^[.]\//, "");
37
+ const named = resolveWithinProject(projectDir, trimmed);
38
+ return named && existsSync(named) ? trimmed : decodedUrlPath(trimmed);
39
+ }
20
40
  var execFileAsync = promisify(execFile);
21
41
  var FFMPEG_TIMEOUT_MS = 12e4;
22
42
  function authoredNumber(raw, fallback, attribute, id, strictlyPositive = false) {
@@ -161,6 +181,13 @@ function requiredAudioIdentity(attributes) {
161
181
  if (!src) throw new Error(`Audio #${id} has no src`);
162
182
  return { id, src };
163
183
  }
184
+ function authoredMediaStart(attributes, id) {
185
+ return readMediaOffsetSeconds((name) => {
186
+ const raw = attributes.get(name)?.value;
187
+ if (name === "data-media-start") authoredNumber(raw, 0, name, id);
188
+ return raw;
189
+ });
190
+ }
164
191
  function hasBareAttribute(html, range, name) {
165
192
  const unquoted = html.slice(range.start, range.end).replace(/"[^"]*"|'[^']*'/g, '""');
166
193
  return new RegExp(`\\s${name}(?=[\\s/>=])`, "i").test(unquoted);
@@ -185,12 +212,7 @@ function mediaTagFromRange(html, range) {
185
212
  id,
186
213
  src,
187
214
  volume: authoredNumber(volumeAttribute?.value, 1, "data-volume", id),
188
- mediaStart: authoredNumber(
189
- attributes.get("data-media-start")?.value,
190
- 0,
191
- "data-media-start",
192
- id
193
- ),
215
+ mediaStart: authoredMediaStart(attributes, id),
194
216
  duration: authoredDuration(attributes, id),
195
217
  playbackRate: authoredNumber(
196
218
  attributes.get("data-playback-rate")?.value,
@@ -217,13 +239,7 @@ function audioTags(html) {
217
239
  return tags;
218
240
  }
219
241
  function resolveLocalAudioPath(projectDir, src) {
220
- const withoutSuffix = src.split(/[?#]/, 1)[0] ?? "";
221
- let decoded = "";
222
- try {
223
- decoded = decodeURIComponent(withoutSuffix);
224
- } catch {
225
- throw new Error(`Audio source must be a local project file: ${src}`);
226
- }
242
+ const decoded = requestedProjectPath(projectDir, src);
227
243
  if (!decoded || isAbsolute(decoded) || /^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(decoded)) {
228
244
  throw new Error(`Audio source must be a local project file: ${src}`);
229
245
  }
@@ -358,6 +374,8 @@ function absoluteLoudnessPlan(track, targetLufs = DEFAULT_TARGET_LUFS) {
358
374
  }
359
375
 
360
376
  export {
377
+ requestSubPath,
378
+ requestedProjectPath,
361
379
  audioTags,
362
380
  resolveLocalAudioPath,
363
381
  parseEbur128Summary,
@@ -52,6 +52,7 @@ function downloadFile(url, dest, options = {}) {
52
52
  return new Promise((resolve, reject) => {
53
53
  const follow = (u, hops = 0) => {
54
54
  let activeResponse;
55
+ let responseDiscarded = false;
55
56
  let responsePipelineStarted = false;
56
57
  let requestError;
57
58
  let request;
@@ -61,15 +62,15 @@ function downloadFile(url, dest, options = {}) {
61
62
  if (res.statusCode && REDIRECT_CODES.has(res.statusCode)) {
62
63
  const location = res.headers.location;
63
64
  if (location) {
65
+ responseDiscarded = true;
66
+ res.destroy();
64
67
  if (hops >= MAX_REDIRECTS) {
65
- res.resume();
66
68
  removePartialFile(tmp);
67
69
  reject(
68
70
  new Error(`Download failed: more than ${MAX_REDIRECTS} redirects from ${url}`)
69
71
  );
70
72
  return;
71
73
  }
72
- res.resume();
73
74
  try {
74
75
  follow(redirectTarget(location, u), hops + 1);
75
76
  } catch (error) {
@@ -80,7 +81,8 @@ function downloadFile(url, dest, options = {}) {
80
81
  }
81
82
  }
82
83
  if (res.statusCode !== 200) {
83
- res.resume();
84
+ responseDiscarded = true;
85
+ res.destroy();
84
86
  removePartialFile(tmp);
85
87
  reject(new Error(`Download failed: HTTP ${res.statusCode}`));
86
88
  return;
@@ -107,6 +109,7 @@ function downloadFile(url, dest, options = {}) {
107
109
  request.destroy(new Error(`Download timed out after ${timeoutMs}ms`));
108
110
  });
109
111
  request.on("error", (err) => {
112
+ if (responseDiscarded) return;
110
113
  if (responsePipelineStarted) {
111
114
  requestError = err;
112
115
  activeResponse?.destroy(err);