hyperframes 0.8.147 → 0.8.149

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 (184) hide show
  1. package/dist/{add-5CNUY3EW.js → add-MG53577L.js} +18 -18
  2. package/dist/{animatedGifPrep-ZID2XJRQ.js → animatedGifPrep-HV4ZFVPV.js} +5 -5
  3. package/dist/api.d.ts +209 -0
  4. package/dist/api.js +75 -0
  5. package/dist/{asset-TFEENZ7K.js → asset-3GIBXLLL.js} +3 -3
  6. package/dist/{assetCataloger-GX4B55VB.js → assetCataloger-JJQ4JW2P.js} +2 -2
  7. package/dist/{auth-EJVZW6C3.js → auth-XQMT727H.js} +4 -4
  8. package/dist/{autoUpdate-MBNEZ2U4.js → autoUpdate-CREZJGMU.js} +2 -2
  9. package/dist/{backgroundChecks-DNW5NPTY.js → backgroundChecks-K3S5QKR3.js} +3 -3
  10. package/dist/backgroundChecksWorker.js +3 -3
  11. package/dist/{batchRender-T7S2CGJE.js → batchRender-42AKNX73.js} +6 -6
  12. package/dist/{beats-STXBGN6Z.js → beats-Y7IKETUS.js} +21 -21
  13. package/dist/{benchmark-AC6IGEQP.js → benchmark-22SAXSO5.js} +18 -18
  14. package/dist/{browser-FB5AK32T.js → browser-ABNISCC3.js} +14 -13
  15. package/dist/{bundleWithLocalizedFonts-HSCWGCFO.js → bundleWithLocalizedFonts-OE5ZI4JE.js} +5 -5
  16. package/dist/{capture-VEIVUHWB.js → capture-DBNHO4WJ.js} +2 -2
  17. package/dist/{capture-I24MXH3Y.js → capture-HQG5W42I.js} +19 -19
  18. package/dist/{catalog-JRC4VTTI.js → catalog-KICZFIDX.js} +34 -34
  19. package/dist/{catch-up-NTCK7Z3G.js → catch-up-ZCQUCI45.js} +13 -13
  20. package/dist/{check-7M7W4LPN.js → check-TGXIICEF.js} +48 -48
  21. package/dist/{checkBrowser-2YRVCAYB.js → checkBrowser-3N23I56J.js} +36 -36
  22. package/dist/{chunk-A72OAGNB.js → chunk-2HWB4TCI.js} +1 -1
  23. package/dist/chunk-3WD4JNMU.js +3795 -0
  24. package/dist/{chunk-XOJDBRNF.js → chunk-4S4VUXW3.js} +1 -1
  25. package/dist/{chunk-JBQJKC23.js → chunk-62RUQJ5J.js} +1 -1
  26. package/dist/{chunk-A6S35NYA.js → chunk-7IEGPJ4P.js} +1 -1
  27. package/dist/{chunk-BAKPN2D2.js → chunk-AHBYQRGI.js} +1 -1
  28. package/dist/{chunk-H7B6JSHI.js → chunk-AY2BONTF.js} +1 -1
  29. package/dist/{chunk-A4Q7W4LV.js → chunk-B3XLIBFL.js} +4 -2
  30. package/dist/{chunk-ZVZSFDW3.js → chunk-BNYRD7PQ.js} +2 -2
  31. package/dist/{chunk-DYWSCPCR.js → chunk-CNPJHUOX.js} +17 -17
  32. package/dist/{chunk-B45OFFOQ.js → chunk-CT6ZQRLD.js} +6 -8
  33. package/dist/chunk-CYFFYK2F.js +56 -0
  34. package/dist/{chunk-KVGDFUVO.js → chunk-CZQLCBWY.js} +26 -13
  35. package/dist/{chunk-6IIGT7BX.js → chunk-DNZMBQTH.js} +1 -1
  36. package/dist/{chunk-SYUGVPYH.js → chunk-DUUFDLC4.js} +1 -1
  37. package/dist/{chunk-3YUFN37G.js → chunk-GESJSXFH.js} +1 -1
  38. package/dist/chunk-HU2SPFNG.js +103 -0
  39. package/dist/{chunk-4OA4LDTU.js → chunk-IYLHJV34.js} +1 -1
  40. package/dist/{chunk-KBB4RG6F.js → chunk-JZIEZCQM.js} +9 -2
  41. package/dist/{chunk-XVIYZU3D.js → chunk-K35E45SI.js} +1 -1
  42. package/dist/{chunk-EGO6Z24R.js → chunk-K44HCHZN.js} +3 -3
  43. package/dist/{chunk-4YVMMRHR.js → chunk-K4RIT6PX.js} +2 -2
  44. package/dist/chunk-KGPLIH7B.js +127 -0
  45. package/dist/{chunk-B4P5VDFQ.js → chunk-KMAAOHLO.js} +1 -1
  46. package/dist/{chunk-MOL32UKR.js → chunk-KMJLHHBF.js} +1 -1
  47. package/dist/{chunk-3HSWLZ6S.js → chunk-KQHJKJ3V.js} +1 -1
  48. package/dist/{chunk-2IDHEEAN.js → chunk-KUTT3JXL.js} +88 -28
  49. package/dist/{chunk-3BETQ4XI.js → chunk-L274XRWA.js} +81 -8
  50. package/dist/{chunk-3PPO64IB.js → chunk-LACFOFWX.js} +10 -10
  51. package/dist/chunk-LCILS4AF.js +329 -0
  52. package/dist/{chunk-6BSIQJPW.js → chunk-LTJDUBSQ.js} +1 -1
  53. package/dist/{chunk-66SAATRI.js → chunk-M5B42RL5.js} +9 -9
  54. package/dist/{chunk-6WD636E5.js → chunk-MI6U3OIN.js} +2 -2
  55. package/dist/{chunk-YCGU3UNU.js → chunk-MXB6CWVH.js} +1 -1
  56. package/dist/{chunk-Z5C4LEAD.js → chunk-NKM53WMI.js} +11 -11
  57. package/dist/{chunk-QTTDKWSM.js → chunk-OMBSUO4T.js} +2 -2
  58. package/dist/{chunk-AL2YEVOT.js → chunk-P7NTODQE.js} +3 -3
  59. package/dist/{chunk-BHVFTYSI.js → chunk-PO2SDVQA.js} +4 -1
  60. package/dist/{chunk-DDNS2674.js → chunk-PR7QQBSC.js} +1 -1
  61. package/dist/{chunk-FDL4HV44.js → chunk-Q2Y5OZCY.js} +2 -2
  62. package/dist/{chunk-P6HELLPU.js → chunk-QIJLIULK.js} +2 -2
  63. package/dist/{chunk-5OKZLMQK.js → chunk-RMIFSBRV.js} +1 -1
  64. package/dist/{chunk-AFIATIKS.js → chunk-SFUBSJFP.js} +1 -1
  65. package/dist/{chunk-LE7T4ML7.js → chunk-SP6XL3NP.js} +1 -1
  66. package/dist/{chunk-SEABQTBP.js → chunk-TPIG7ZBX.js} +9 -9
  67. package/dist/{chunk-POKK6XXU.js → chunk-U7SASZC5.js} +15 -15
  68. package/dist/{chunk-JF5L5SQ6.js → chunk-VC7JBNPS.js} +72 -107
  69. package/dist/{chunk-N53FLAMZ.js → chunk-VGCEMOQA.js} +10 -10
  70. package/dist/{normalize-U3SL5VG3.js → chunk-VHZ6DL3M.js} +3 -3
  71. package/dist/chunk-VX4AL2FQ.js +26 -0
  72. package/dist/{chunk-3BYMCR4O.js → chunk-VXM4BH23.js} +23 -12
  73. package/dist/{chunk-ZLL72U3I.js → chunk-WX7VCRM7.js} +2 -2
  74. package/dist/{chunk-KPJMBC4K.js → chunk-XHBX7QN6.js} +4 -4
  75. package/dist/{chunk-BYSBRF24.js → chunk-XPQSL5VS.js} +5 -120
  76. package/dist/{chunk-55RZG5SQ.js → chunk-Y475GD4L.js} +4 -4
  77. package/dist/{chunk-ZQXNL5DL.js → chunk-YDRX42P3.js} +6 -6
  78. package/dist/{chunk-4SFGME7K.js → chunk-YJDB4FLT.js} +1 -1
  79. package/dist/{chunk-QATWIE4K.js → chunk-YU2QRNWN.js} +2 -2
  80. package/dist/{chunk-BPUFVVSH.js → chunk-ZK3BQXHC.js} +1 -1
  81. package/dist/{chunk-QHRPB2JQ.js → chunk-ZKDKFJCK.js} +13 -13
  82. package/dist/{clean-3RY3Y2GX.js → clean-6QP7VAV4.js} +32 -31
  83. package/dist/cli.js +55 -55
  84. package/dist/{cloud-MLPBFCVE.js → cloud-5TME5ROM.js} +4 -4
  85. package/dist/{cloudrun-NQF5KFQI.js → cloudrun-F5VVCVF5.js} +6 -6
  86. package/dist/{compare-6EZX2754.js → compare-XPY2EXX6.js} +35 -35
  87. package/dist/{compiler-ACCPOZMQ.js → compiler-NPD3MYMO.js} +2 -2
  88. package/dist/{component-F5PQHP6A.js → component-OPVL3PUX.js} +4 -4
  89. package/dist/{compositions-AUHWSI2H.js → compositions-WSEOI454.js} +19 -19
  90. package/dist/{delete-VUF4SHHJ.js → delete-SLMH57VH.js} +11 -11
  91. package/dist/{dist-GPDOV3IQ.js → dist-CUIR3GFX.js} +2 -2
  92. package/dist/{doctor-3XHCA5JM.js → doctor-QZW3EKIH.js} +20 -19
  93. package/dist/{events-FKOIB3R3.js → events-6C3ZG7LS.js} +8 -8
  94. package/dist/{events-TIU72LZM.js → events-FIFWFRGC.js} +6 -6
  95. package/dist/{feedback-V6VATYBE.js → feedback-VKXM7YJ5.js} +24 -24
  96. package/dist/{ffmpeg-5V4FP3R6.js → ffmpeg-TZB5WAYE.js} +3 -2
  97. package/dist/{figma-YBJM2VGE.js → figma-3UYNADNA.js} +3 -3
  98. package/dist/fontLocalizeCli.js +10 -10
  99. package/dist/{get-3YVCGZBX.js → get-VH7VMRVX.js} +11 -11
  100. package/dist/{gpuPolicy-ZOUG66M7.js → gpuPolicy-M2JZGGVW.js} +5 -5
  101. package/dist/{grade-compare-MYXIRKQI.js → grade-compare-OSC2YQWN.js} +40 -39
  102. package/dist/{help-WFZ2SUUR.js → help-DCBFEZPT.js} +3 -3
  103. package/dist/{history-HWPRJFR5.js → history-XYJMQE26.js} +15 -15
  104. package/dist/hyperframe-runtime.js +62 -62
  105. package/dist/hyperframe.manifest.json +1 -1
  106. package/dist/hyperframe.runtime.iife.js +62 -62
  107. package/dist/hyperframes-player.global.js +1 -1
  108. package/dist/{info-WJDTQ4OZ.js → info-YEHGENAH.js} +17 -17
  109. package/dist/{init-EXHDN7RO.js → init-64SML7PY.js} +52 -51
  110. package/dist/{inspect-EAOLZOMQ.js → inspect-GFOQKRJI.js} +32 -32
  111. package/dist/{installer-LZ4X5TZZ.js → installer-Q4MMZKLA.js} +4 -4
  112. package/dist/{keyframes-FSZYNEDN.js → keyframes-ORYFWKBZ.js} +16 -16
  113. package/dist/{lambda-3GAKHMC3.js → lambda-DRMOJGTC.js} +8 -8
  114. package/dist/{layout-M2TQ2CIX.js → layout-ZEQBE6UQ.js} +32 -32
  115. package/dist/{lint-7C5UPTNQ.js → lint-67KGFY63.js} +19 -19
  116. package/dist/{list-GU5KBZ73.js → list-T6OU5ARJ.js} +11 -11
  117. package/dist/{login-ZL2NYBIZ.js → login-2PXIGDP7.js} +9 -9
  118. package/dist/{logout-B4KS4A7S.js → logout-DKJANASY.js} +3 -3
  119. package/dist/{manager-5ORDVWJB.js → manager-ES2UFT4X.js} +6 -4
  120. package/dist/{manager-BPSR6D3V.js → manager-GWU5J6RJ.js} +3 -2
  121. package/dist/{media-treatment-QC3TAHVU.js → media-treatment-NAAHID6M.js} +27 -26
  122. package/dist/{models-A54I4QR5.js → models-P6XB6RWK.js} +19 -17
  123. package/dist/{motionShot-ZXPK562F.js → motionShot-7MHRIV6V.js} +13 -13
  124. package/dist/normalize-4UDISLPL.js +24 -0
  125. package/dist/{normalize-audio-CAP3DAE6.js → normalize-audio-LWNFYR2F.js} +15 -15
  126. package/dist/{open-GUSBNMDB.js → open-DAP5C7UD.js} +13 -13
  127. package/dist/{parakeetRunner-GCCH72CO.js → parakeetRunner-3ZVFPOD4.js} +17 -27
  128. package/dist/{pipeline-SCJ2MWYH.js → pipeline-V4YJCPUX.js} +9 -9
  129. package/dist/{play-FP2QLMGM.js → play-UDCESJO3.js} +35 -35
  130. package/dist/{preflight-ONF5AJNO.js → preflight-JOD4OXGC.js} +5 -4
  131. package/dist/{present-H5SA4APW.js → present-DXTHBH3F.js} +26 -26
  132. package/dist/{preview-ATPVKA6K.js → preview-YHXKRXKB.js} +39 -37
  133. package/dist/{producer-VBYUC27R.js → producer-343ENLAM.js} +1 -1
  134. package/dist/{projectConfig-SBRMQZGG.js → projectConfig-YXKU3CTB.js} +6 -6
  135. package/dist/{publication-5BQICRZO.js → publication-ODXP3JI7.js} +2 -2
  136. package/dist/{publish-XDUZA3E3.js → publish-UEFBFGV3.js} +22 -22
  137. package/dist/{refresh-PVHBEABE.js → refresh-MGCVWX56.js} +3 -3
  138. package/dist/{remove-background-GA6F7JZW.js → remove-background-FMV6IDOH.js} +38 -34
  139. package/dist/{render-XCYXFZTL.js → render-N7QGX6RJ.js} +30 -30
  140. package/dist/{render-PCFO45RK.js → render-SYC4RPGT.js} +6 -6
  141. package/dist/{render-KUVZFNQD.js → render-ZTXNPRGF.js} +61 -60
  142. package/dist/{render-batch-7R2NRNVJ.js → render-batch-SZRPCRUJ.js} +6 -6
  143. package/dist/renderSetupWorker.js +4 -3
  144. package/dist/{resolver-C4FPX72I.js → resolver-7MYXNEAX.js} +4 -4
  145. package/dist/{sherpa-IQY52XU6.js → sherpa-M4Z2Q5Y2.js} +15 -14
  146. package/dist/sherpaWorker.js +3 -1
  147. package/dist/{skills-JSSAEKUW.js → skills-NEHNSHZK.js} +15 -15
  148. package/dist/{skillsUpdateCheck-XE5E2K2F.js → skillsUpdateCheck-O77QR72A.js} +3 -3
  149. package/dist/{snapshot-QMQOE2DD.js → snapshot-GDVXFBVY.js} +54 -53
  150. package/dist/{src-R55QLGWI.js → src-PTIV7IVV.js} +6 -6
  151. package/dist/{src-2GMPFYHL.js → src-VMTHSARJ.js} +6 -4
  152. package/dist/{staticProjectServer-YH2RHYKW.js → staticProjectServer-3D2NXQ6W.js} +14 -14
  153. package/dist/{status-PTKNQD2E.js → status-NBRMGL7D.js} +5 -5
  154. package/dist/studio/assets/{hyperframes-player-_eMxRXF_.js → hyperframes-player-C-2YwYre.js} +1 -1
  155. package/dist/studio/assets/{index-bXzd7tvF.js → index-ByJU5J6n.js} +115 -115
  156. package/dist/studio/assets/{index-CEq9KmY2.js → index-BybGk67U.js} +1 -1
  157. package/dist/studio/assets/{index-6okhHdnH.js → index-Cfs2r3fz.js} +1 -1
  158. package/dist/studio/assets/{index-CVd4O6eH.css → index-DkQKsFxx.css} +1 -1
  159. package/dist/studio/index.html +2 -2
  160. package/dist/{studio-api-T2TS2CHL.js → studio-api-XIBDLRHB.js} +7 -7
  161. package/dist/{studioServer-Q4MT44LT.js → studioServer-QIQK47UN.js} +70 -69
  162. package/dist/{synthesize-UCI4X5O7.js → synthesize-22B7L5GX.js} +6 -6
  163. package/dist/{telemetry-V5JYZDS4.js → telemetry-565KDZUW.js} +8 -8
  164. package/dist/{timeline-KTCTOKF5.js → timeline-E6XB7I6W.js} +24 -24
  165. package/dist/{tokens-ZHREZPK6.js → tokens-3ZAJENSE.js} +3 -3
  166. package/dist/transcribe-WODP3T77.js +332 -0
  167. package/dist/{transcribe-CRAV4FU3.js → transcribe-XWQQCCBG.js} +13 -12
  168. package/dist/{tts-B6AHFQEO.js → tts-QSAQZVEZ.js} +3 -3
  169. package/dist/{updateCheck-E7RMSK3E.js → updateCheck-QPYU4GRL.js} +2 -2
  170. package/dist/{upgrade-27PFTDCV.js → upgrade-2FJ5ZEN6.js} +5 -5
  171. package/dist/{urlDownloader-EAF6PLUP.js → urlDownloader-352AY25I.js} +4 -4
  172. package/dist/{validate-OKNFDBMG.js → validate-SP2VGNEI.js} +25 -25
  173. package/dist/{video-IEVS4FIH.js → video-RVNPFEA6.js} +8 -8
  174. package/package.json +8 -1
  175. package/dist/chunk-6IHWCZ3W.js +0 -54
  176. package/dist/chunk-SQLK7SJL.js +0 -88
  177. package/dist/chunk-Z6FLHIDV.js +0 -3795
  178. package/dist/manager-RFZNG5YT.js +0 -30
  179. package/dist/renderCancellation-NIXEWRAO.js +0 -43
  180. package/dist/transcribe-4QDEWCE6.js +0 -466
  181. package/dist/{chunk-DKSDVDXG.js → chunk-NAMGMP3R.js} +3 -3
  182. package/dist/{policies-4FEXMXPK.js → policies-DCSIM4AB.js} +3 -3
  183. package/dist/{screenshotCapture-3JXXUZND.js → screenshotCapture-TEUIWXWN.js} +3 -3
  184. package/dist/{telemetry-W5AKPI4R.js → telemetry-CQYHCCPL.js} +3 -3
@@ -0,0 +1,329 @@
1
+ import { createRequire as __hf_createRequire } from "node:module";
2
+ import { fileURLToPath as __hf_fileURLToPath } from "node:url";
3
+ import { dirname as __hf_dirname } from "node:path";
4
+ var require = __hf_createRequire(import.meta.url);
5
+ var __filename = __hf_fileURLToPath(import.meta.url);
6
+ var __dirname = __hf_dirname(__filename);
7
+ import {
8
+ parakeetRunner
9
+ } from "./chunk-VX4AL2FQ.js";
10
+ import {
11
+ DecodeCancelled,
12
+ prepareSherpaWav,
13
+ sherpaUnsupportedReason,
14
+ transcribeWithSherpa
15
+ } from "./chunk-CT6ZQRLD.js";
16
+ import {
17
+ initialModelForLanguage,
18
+ transcribe
19
+ } from "./chunk-KUTT3JXL.js";
20
+ import {
21
+ createRenderCancellationScope,
22
+ stoppedByCancelSignal
23
+ } from "./chunk-P7NTODQE.js";
24
+ import {
25
+ formatSrt,
26
+ formatVtt,
27
+ loadTranscript,
28
+ patchCaptionHtml
29
+ } from "./chunk-VHZ6DL3M.js";
30
+ import {
31
+ DEFAULT_MODEL,
32
+ isWhisperUnavailable
33
+ } from "./chunk-CZQLCBWY.js";
34
+ import {
35
+ normalizeErrorMessage
36
+ } from "./chunk-KNU5COPB.js";
37
+ import {
38
+ PARAKEET_INSTALL_COMMAND,
39
+ PARAKEET_LANGUAGES,
40
+ parakeetSpeaks,
41
+ transcribeWithParakeet
42
+ } from "./chunk-JZIEZCQM.js";
43
+ import {
44
+ TRANSCRIPT_FILE
45
+ } from "./chunk-IR35BCLK.js";
46
+
47
+ // src/api/transcribe.ts
48
+ import { existsSync, realpathSync, rmSync, statSync, writeFileSync } from "fs";
49
+ import { basename, dirname, extname, join, resolve } from "path";
50
+ var MIN_TIMEOUT_MS = 5e3;
51
+ var TranscribeError = class extends Error {
52
+ code;
53
+ /** whisper_unavailable: the command that installs Parakeet, when Parakeet would cover this run. */
54
+ install;
55
+ /** caption_write_failed after transcribing: the transcript, which was saved. */
56
+ transcriptPath;
57
+ constructor(code, message, options = {}) {
58
+ super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
59
+ this.name = "TranscribeError";
60
+ this.code = code;
61
+ if (options.install !== void 0) this.install = options.install;
62
+ if (options.transcriptPath !== void 0) this.transcriptPath = options.transcriptPath;
63
+ }
64
+ };
65
+ async function runTranscribe(options) {
66
+ if (options.signal?.aborted) {
67
+ throw new TranscribeError("cancelled", "Transcription cancelled", {
68
+ cause: options.signal.reason
69
+ });
70
+ }
71
+ const inputPath = resolve(options.input);
72
+ if (!existsSync(inputPath)) {
73
+ throw new TranscribeError("input_not_found", `File not found: ${options.input}`);
74
+ }
75
+ const dir = resolve(options.dir ?? dirname(inputPath));
76
+ const ext = extname(inputPath).toLowerCase();
77
+ const isImport = ext === ".json" || ext === ".srt" || ext === ".vtt";
78
+ const sidecar = parseSidecar(options.captions, inputPath, dir);
79
+ if (sidecar && isImport) return exportTranscript(inputPath, sidecar);
80
+ if (isImport) return importTranscript(inputPath, dir);
81
+ const { timeoutMs } = options;
82
+ if (timeoutMs !== void 0 && !(Number.isInteger(timeoutMs) && timeoutMs >= MIN_TIMEOUT_MS)) {
83
+ throw new TranscribeError(
84
+ "invalid_timeout",
85
+ `Invalid timeoutMs: ${timeoutMs}. Must be an integer >= ${MIN_TIMEOUT_MS} (ms).`
86
+ );
87
+ }
88
+ return transcribeAudio(inputPath, dir, sidecar, options);
89
+ }
90
+ function parseExportFormat(value) {
91
+ if (!value) return void 0;
92
+ const normalized = value.toLowerCase();
93
+ if (normalized === "srt" || normalized === "vtt") return normalized;
94
+ throw new TranscribeError(
95
+ "invalid_option",
96
+ `Unsupported caption export format: ${value}. Use srt or vtt.`
97
+ );
98
+ }
99
+ function parseSidecar(captions, inputPath, dir) {
100
+ const to = parseExportFormat(captions?.format);
101
+ if (!to) return void 0;
102
+ const output = captions?.outputPath;
103
+ const outPath = resolve(output ?? join(dir, `transcript.${to}`));
104
+ const keep = [inputPath, join(dir, TRANSCRIPT_FILE)];
105
+ const problem = output !== void 0 && outputProblem(output, outPath, to) || overwriteProblem(outPath, keep);
106
+ if (problem) throw new TranscribeError("invalid_option", problem);
107
+ return { to, outPath, preserveCues: captions?.preserveCues === true, keep };
108
+ }
109
+ function outputProblem(output, outPath, to) {
110
+ if (!output) return "--output needs a file path";
111
+ const folder = dirname(outPath);
112
+ if (!existsSync(folder) || !statSync(folder).isDirectory()) {
113
+ return `Output folder not found: ${folder}`;
114
+ }
115
+ if (/[\\/]$/.test(output) || existsSync(outPath) && statSync(outPath).isDirectory()) {
116
+ return `--output is a folder; give a file path such as ${join(outPath, `transcript.${to}`)}`;
117
+ }
118
+ return void 0;
119
+ }
120
+ function overwriteProblem(outPath, keep) {
121
+ const hit = keep.find((file) => sameFile(outPath, file));
122
+ return hit && `The caption file would overwrite ${hit}; choose another file with --output`;
123
+ }
124
+ function sameFile(out, file) {
125
+ if (existsSync(out) && existsSync(file)) {
126
+ const [a, b] = [statSync(out, { bigint: true }), statSync(file, { bigint: true })];
127
+ if (a.ino !== 0n && b.ino !== 0n) return a.dev === b.dev && a.ino === b.ino;
128
+ return realpathSync.native(out) === realpathSync.native(file);
129
+ }
130
+ const realDir = (p) => existsSync(dirname(p)) ? realpathSync.native(dirname(p)) : dirname(p);
131
+ return realDir(out) === realDir(file) && basename(out).toLowerCase() === basename(file).toLowerCase();
132
+ }
133
+ function readTranscript(inputPath) {
134
+ let transcript;
135
+ try {
136
+ transcript = loadTranscript(inputPath);
137
+ } catch (err) {
138
+ throw new TranscribeError("invalid_transcript", normalizeErrorMessage(err), { cause: err });
139
+ }
140
+ if (transcript.words.length === 0) {
141
+ throw new TranscribeError("no_words", "No words found in transcript.");
142
+ }
143
+ return transcript;
144
+ }
145
+ function importTranscript(inputPath, dir) {
146
+ const { words, format } = readTranscript(inputPath);
147
+ const transcriptPath = join(dir, TRANSCRIPT_FILE);
148
+ writeFileSync(transcriptPath, JSON.stringify(words, null, 2));
149
+ patchCaptionHtml(dir, words);
150
+ return { kind: "imported", format, wordCount: words.length, transcriptPath };
151
+ }
152
+ function exportTranscript(inputPath, sidecar) {
153
+ const { words, format } = readTranscript(inputPath);
154
+ try {
155
+ writeCaptionSidecar(words, sidecar, format === "srt" || format === "vtt" || void 0);
156
+ } catch (err) {
157
+ throw new TranscribeError(
158
+ "caption_write_failed",
159
+ `The caption file ${sidecar.outPath} could not be written: ${normalizeErrorMessage(err)}`,
160
+ { cause: err }
161
+ );
162
+ }
163
+ return {
164
+ kind: "exported",
165
+ format: sidecar.to,
166
+ wordCount: words.length,
167
+ outputPath: sidecar.outPath
168
+ };
169
+ }
170
+ function writeCaptionSidecar(words, { to, outPath, preserveCues, keep }, phraseLevelSource) {
171
+ const hit = keep.find((file) => sameFile(outPath, file));
172
+ if (hit) throw new Error(`it is the same file as ${hit}`);
173
+ const preGrouped = preserveCues || phraseLevelSource;
174
+ const content = to === "srt" ? formatSrt(words, { preGrouped }) : formatVtt(words, { preGrouped });
175
+ writeFileSync(outPath, content);
176
+ }
177
+ function pickRunner(engine, parakeet, language) {
178
+ if (engine === "whisper" || !parakeetSpeaks(language)) return "whisper";
179
+ return parakeet() ?? "whisper";
180
+ }
181
+ var parakeetFallsBack = (engine) => engine === "auto";
182
+ function withoutTrailingDots(text) {
183
+ let end = text.length;
184
+ while (end > 0 && text[end - 1] === ".") end--;
185
+ return text.slice(0, end);
186
+ }
187
+ var engineOf = (runner) => runner === "whisper" ? "whisper" : "parakeet";
188
+ function failureMessage(err) {
189
+ const base = err instanceof Error ? err.message : String(err);
190
+ const stderr = err && typeof err === "object" && "stderr" in err && err.stderr ? String(err.stderr).trim().split("\n").slice(-3).filter((line) => !base.includes(line)).join("\n") : "";
191
+ return stderr ? `${base}
192
+ ${stderr}` : base;
193
+ }
194
+ async function transcribeAudio(inputPath, dir, sidecar, options) {
195
+ const engine = (options.engine ?? "auto").toLowerCase();
196
+ if (engine !== "auto" && engine !== "parakeet" && engine !== "whisper") {
197
+ throw new TranscribeError(
198
+ "invalid_option",
199
+ `Unknown --engine: ${options.engine}. Use auto, parakeet, or whisper.`
200
+ );
201
+ }
202
+ const unsupported = sherpaUnsupportedReason();
203
+ let runner = pickRunner(engine, () => parakeetRunner({ unsupported }), options.language);
204
+ if (engine === "parakeet" && runner === "whisper") {
205
+ throw new TranscribeError(
206
+ "parakeet_unavailable",
207
+ !parakeetSpeaks(options.language) ? `Parakeet does not transcribe --language ${options.language}; it covers ${PARAKEET_LANGUAGES.split(" ").join(", ")}. Use --engine whisper.` : unsupported ?? `Parakeet is not installed. Install it with: ${PARAKEET_INSTALL_COMMAND} (or use --engine whisper)`
208
+ );
209
+ }
210
+ const model = options.model ?? DEFAULT_MODEL;
211
+ const whisperModel = initialModelForLanguage(model, options.language);
212
+ options.onEngine?.({ runner, engine: engineOf(runner), model: whisperModel });
213
+ const { onStatus, onProgress } = options;
214
+ const startScope = () => options.stopOnProcessSignals ? createRenderCancellationScope() : { signal: options.signal ?? new AbortController().signal, dispose: () => {
215
+ } };
216
+ let wavPath = inputPath;
217
+ let cancellation = runner === "sherpa" || !options.stopOnProcessSignals ? startScope() : null;
218
+ const librarySignal = options.stopOnProcessSignals ? void 0 : cancellation?.signal;
219
+ const run = (r) => {
220
+ switch (r) {
221
+ case "sherpa":
222
+ return transcribeWithSherpa(wavPath, dir, {
223
+ onProgress: onStatus,
224
+ onEvent: onProgress,
225
+ signal: cancellation.signal
226
+ });
227
+ case "parakeet-mlx":
228
+ return transcribeWithParakeet(wavPath, dir, {
229
+ onProgress: onStatus,
230
+ onEvent: onProgress,
231
+ signal: librarySignal
232
+ });
233
+ case "whisper":
234
+ return transcribe(wavPath, dir, {
235
+ model,
236
+ language: options.language,
237
+ onProgress: onStatus,
238
+ onEvent: onProgress,
239
+ timeoutMs: options.timeoutMs,
240
+ installRuntime: options.installRuntime,
241
+ signal: librarySignal,
242
+ startCancellation: () => (cancellation ??= startScope()).signal
243
+ });
244
+ default: {
245
+ const unreachable = r;
246
+ throw new Error(`Unknown transcription runner: ${unreachable}`);
247
+ }
248
+ }
249
+ };
250
+ try {
251
+ if (runner === "sherpa") {
252
+ wavPath = await prepareSherpaWav(inputPath, onStatus, librarySignal);
253
+ }
254
+ let result;
255
+ try {
256
+ result = await run(runner);
257
+ } catch (err) {
258
+ if (runner !== "sherpa" || err instanceof DecodeCancelled) throw err;
259
+ const reason = withoutTrailingDots(normalizeErrorMessage(err));
260
+ const parakeetError = `Parakeet failed: ${reason}. To repair it, run: ${PARAKEET_INSTALL_COMMAND}`;
261
+ if (!parakeetFallsBack(engine)) throw new Error(parakeetError);
262
+ runner = pickRunner(
263
+ engine,
264
+ () => parakeetRunner({ unsupported, skipSherpa: true }),
265
+ options.language
266
+ );
267
+ options.onEngine?.({
268
+ runner,
269
+ engine: engineOf(runner),
270
+ model: whisperModel,
271
+ fallbackReason: parakeetError
272
+ });
273
+ try {
274
+ result = await run(runner);
275
+ } catch (fallbackErr) {
276
+ if (stoppedByCancelSignal(fallbackErr)) {
277
+ throw new DecodeCancelled("Transcription cancelled");
278
+ }
279
+ const why = normalizeErrorMessage(fallbackErr);
280
+ throw new Error(`${parakeetError}. The ${runner} fallback failed too: ${why}`);
281
+ }
282
+ }
283
+ const { words } = loadTranscript(result.transcriptPath);
284
+ writeFileSync(result.transcriptPath, JSON.stringify(words, null, 2));
285
+ patchCaptionHtml(dir, words);
286
+ if (sidecar) {
287
+ try {
288
+ writeCaptionSidecar(words, sidecar, false);
289
+ } catch (err) {
290
+ throw new TranscribeError(
291
+ "caption_write_failed",
292
+ `Transcript saved to ${result.transcriptPath}, but the caption file ${sidecar.outPath} could not be written: ${normalizeErrorMessage(err)}`,
293
+ { cause: err, transcriptPath: result.transcriptPath }
294
+ );
295
+ }
296
+ }
297
+ return {
298
+ kind: "transcribed",
299
+ engine: engineOf(runner),
300
+ model: result.model,
301
+ detectedLanguage: result.detectedLanguage,
302
+ wordCount: words.length,
303
+ durationSeconds: result.durationSeconds,
304
+ speechOnsetSeconds: result.speechOnsetSeconds,
305
+ transcriptPath: result.transcriptPath,
306
+ ...sidecar && { captions: { format: sidecar.to, outputPath: sidecar.outPath } }
307
+ };
308
+ } catch (err) {
309
+ if (err instanceof TranscribeError) throw err;
310
+ if (err instanceof DecodeCancelled || cancellation?.signal.aborted) {
311
+ throw new TranscribeError("cancelled", "Transcription cancelled", { cause: err });
312
+ }
313
+ const message = failureMessage(err);
314
+ if (isWhisperUnavailable(err)) {
315
+ const install = engine === "auto" && parakeetSpeaks(options.language) && !unsupported ? PARAKEET_INSTALL_COMMAND : void 0;
316
+ throw new TranscribeError("whisper_unavailable", message, { cause: err, install });
317
+ }
318
+ throw new TranscribeError("failed", message, { cause: err });
319
+ } finally {
320
+ cancellation?.dispose();
321
+ if (wavPath !== inputPath) rmSync(wavPath, { force: true });
322
+ }
323
+ }
324
+
325
+ export {
326
+ MIN_TIMEOUT_MS,
327
+ TranscribeError,
328
+ runTranscribe
329
+ };
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  VERSION
9
- } from "./chunk-QTTDKWSM.js";
9
+ } from "./chunk-OMBSUO4T.js";
10
10
 
11
11
  // src/registry/compatibility.ts
12
12
  import { compareVersions } from "compare-versions";
@@ -4,23 +4,23 @@ 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
- chromeDepsInstallCommand,
9
- detectLinuxDistro,
10
- distroLabel,
11
- getFFmpegInstallHint,
12
- parseLddMissingLibs
13
- } from "./chunk-SYUGVPYH.js";
14
7
  import {
15
8
  getFreeDiskMb
16
9
  } from "./chunk-XBSPQ52S.js";
17
10
  import {
18
11
  ensureBrowser,
19
12
  findBrowser
20
- } from "./chunk-A6S35NYA.js";
13
+ } from "./chunk-7IEGPJ4P.js";
14
+ import {
15
+ chromeDepsInstallCommand,
16
+ detectLinuxDistro,
17
+ distroLabel,
18
+ getFFmpegInstallHint,
19
+ parseLddMissingLibs
20
+ } from "./chunk-DUUFDLC4.js";
21
21
  import {
22
22
  runCancellableProcess
23
- } from "./chunk-BYSBRF24.js";
23
+ } from "./chunk-XPQSL5VS.js";
24
24
  import {
25
25
  FFMPEG_PATH_ENV,
26
26
  FFPROBE_PATH_ENV,
@@ -7,10 +7,10 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  trackLintReport,
9
9
  trackLintRuleStreak
10
- } from "./chunk-55RZG5SQ.js";
10
+ } from "./chunk-Y475GD4L.js";
11
11
  import {
12
12
  shouldTrack
13
- } from "./chunk-3PPO64IB.js";
13
+ } from "./chunk-LACFOFWX.js";
14
14
  import {
15
15
  LINT_RULE_COUNT,
16
16
  LINT_RULE_GROUP_COUNTS
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  updateNoticesSuppressed
9
- } from "./chunk-3YUFN37G.js";
9
+ } from "./chunk-GESJSXFH.js";
10
10
  import {
11
11
  hostAnswers
12
12
  } from "./chunk-K4WIOZFP.js";
@@ -21,7 +21,7 @@ import {
21
21
  splitElementInHtml,
22
22
  unwrapElementsFromHtml,
23
23
  wrapElementsInHtml
24
- } from "./chunk-A72OAGNB.js";
24
+ } from "./chunk-2HWB4TCI.js";
25
25
  import {
26
26
  MAX_WINDOW_IDLE_MS,
27
27
  STUDIO_SIGNATURE_MANIFEST_PATHS,
@@ -65,7 +65,7 @@ import {
65
65
  scanProjectMediaCodecMap,
66
66
  shouldPrewarmProxy,
67
67
  waitForProxy
68
- } from "./chunk-MOL32UKR.js";
68
+ } from "./chunk-KMJLHHBF.js";
69
69
  import {
70
70
  STUDIO_MOTION_PATH,
71
71
  createStudioMotionRenderBodyScript,
@@ -77,11 +77,6 @@ import {
77
77
  resolveWithinProject,
78
78
  walkDir
79
79
  } from "./chunk-AIJS74LG.js";
80
- import {
81
- atomicTempPath,
82
- createFileAtomically,
83
- replaceFileAtomically
84
- } from "./chunk-EOVYQ3IG.js";
85
80
  import {
86
81
  findTimelineScript,
87
82
  parseGsapScriptAcorn
@@ -96,9 +91,14 @@ import {
96
91
  getSystemProfilerFamilies,
97
92
  locateSystemFont
98
93
  } from "./chunk-TJSTGSAW.js";
94
+ import {
95
+ atomicTempPath,
96
+ createFileAtomically,
97
+ replaceFileAtomically
98
+ } from "./chunk-EOVYQ3IG.js";
99
99
  import {
100
100
  addScenePartsManifest
101
- } from "./chunk-JBQJKC23.js";
101
+ } from "./chunk-62RUQJ5J.js";
102
102
  import {
103
103
  ensureHfIds
104
104
  } from "./chunk-NE55C6S5.js";
@@ -111,7 +111,7 @@ import {
111
111
  parseFps,
112
112
  parsePreviewProxyBox,
113
113
  sameInstant
114
- } from "./chunk-BAKPN2D2.js";
114
+ } from "./chunk-AHBYQRGI.js";
115
115
  import {
116
116
  AFTER_FONTS_SCRIPT_TYPE,
117
117
  RUNTIME_BOOTSTRAP_ATTR,
@@ -125,7 +125,7 @@ import {
125
125
  resolveRateSpec,
126
126
  sourceTimeAt,
127
127
  stripEmbeddedRuntimeScripts
128
- } from "./chunk-Z6FLHIDV.js";
128
+ } from "./chunk-3WD4JNMU.js";
129
129
  import {
130
130
  HTML_ATTRIBUTE_ENTITIES,
131
131
  MagicString,
@@ -5446,7 +5446,7 @@ async function prepareGsapMutationScript(c, res, firstMutation) {
5446
5446
  let block = extractGsapScriptBlock(html);
5447
5447
  if (!block && (firstMutation.type === "add" || firstMutation.type === "add-with-keyframes")) {
5448
5448
  const compId = html.match(/data-composition-id="([^"]+)"/)?.[1] ?? "main";
5449
- const { GSAP_CDN } = await import("./dist-GPDOV3IQ.js");
5449
+ const { GSAP_CDN } = await import("./dist-CUIR3GFX.js");
5450
5450
  const bootstrap = [
5451
5451
  `<script src="${GSAP_CDN}"></script>`,
5452
5452
  "<script>",
@@ -6,8 +6,8 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
 
8
8
  // src/version.ts
9
- var VERSION = true ? "0.8.147" : "0.0.0-dev";
10
- var PRODUCER_VERSION = true ? "0.8.147" : "0.0.0-dev";
9
+ var VERSION = true ? "0.8.149" : "0.0.0-dev";
10
+ var PRODUCER_VERSION = true ? "0.8.149" : "0.0.0-dev";
11
11
 
12
12
  export {
13
13
  VERSION,
@@ -6,15 +6,15 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  setHostHandlesSigint
9
- } from "./chunk-JF5L5SQ6.js";
9
+ } from "./chunk-VC7JBNPS.js";
10
10
  import {
11
11
  processAncestorSnapshot,
12
12
  processIdentity,
13
13
  processParentPid
14
- } from "./chunk-A4Q7W4LV.js";
14
+ } from "./chunk-B3XLIBFL.js";
15
15
  import {
16
16
  processIsAlive
17
- } from "./chunk-BYSBRF24.js";
17
+ } from "./chunk-KGPLIH7B.js";
18
18
 
19
19
  // src/utils/renderCancellation.ts
20
20
  var RENDER_CANCELLATION_SIGNALS = [
@@ -46,6 +46,9 @@ function measureDownload(options, contentLength) {
46
46
  });
47
47
  return { stream, complete: () => options.onProgress?.(receivedBytes, totalBytes) };
48
48
  }
49
+ function getUrl(url, signal, onResponse) {
50
+ return signal ? httpsGet(url, { signal }, onResponse) : httpsGet(url, onResponse);
51
+ }
49
52
  function downloadFile(url, dest, options = {}) {
50
53
  const tmp = `${dest}.${process.pid}.${randomUUID()}.tmp`;
51
54
  const timeoutMs = options.timeoutMs ?? DEFAULT_DOWNLOAD_TIMEOUT_MS;
@@ -57,7 +60,7 @@ function downloadFile(url, dest, options = {}) {
57
60
  let requestError;
58
61
  let request;
59
62
  try {
60
- request = httpsGet(u, (res) => {
63
+ request = getUrl(u, options.signal, (res) => {
61
64
  activeResponse = res;
62
65
  if (res.statusCode && REDIRECT_CODES.has(res.statusCode)) {
63
66
  const location = res.headers.location;
@@ -8,7 +8,7 @@ import {
8
8
  DEFAULT_REGISTRY_URL,
9
9
  fetchItemManifest,
10
10
  fetchRegistryManifest
11
- } from "./chunk-XVIYZU3D.js";
11
+ } from "./chunk-K35E45SI.js";
12
12
 
13
13
  // src/registry/resolver.ts
14
14
  function defaultWarn(message) {
@@ -8,14 +8,14 @@ import {
8
8
  DEFAULT_REGISTRY_URL,
9
9
  fetchItemFile,
10
10
  validRegistryItem
11
- } from "./chunk-XVIYZU3D.js";
11
+ } from "./chunk-K35E45SI.js";
12
12
  import {
13
13
  publishRegistryFile,
14
14
  registryTargetPath
15
15
  } from "./chunk-GMECXFAN.js";
16
16
  import {
17
17
  validateVariables
18
- } from "./chunk-BAKPN2D2.js";
18
+ } from "./chunk-AHBYQRGI.js";
19
19
  import {
20
20
  realProjectRoot
21
21
  } from "./chunk-OFQWTKPW.js";
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  resolveConfig,
9
9
  usesSoftwareWebGpu
10
- } from "./chunk-JF5L5SQ6.js";
10
+ } from "./chunk-VC7JBNPS.js";
11
11
 
12
12
  // src/browser/gpuPolicy.ts
13
13
  function resolveLocalBrowserGpuMode(browserGpuArg, envMode = process.env.PRODUCER_BROWSER_GPU_MODE) {
@@ -17,7 +17,7 @@ function resolveLocalBrowserGpuMode(browserGpuArg, envMode = process.env.PRODUCE
17
17
  return "auto";
18
18
  }
19
19
  async function resolveCaptureBrowserGpuMode(requestedMode, chromePath) {
20
- const { resolveBrowserGpuMode } = await import("./src-2GMPFYHL.js");
20
+ const { resolveBrowserGpuMode } = await import("./src-VMTHSARJ.js");
21
21
  return resolveBrowserGpuMode(requestedMode, { chromePath });
22
22
  }
23
23
  function resolveLocalWebGpu(browserGpuMode, requiresWebGpu) {
@@ -1278,7 +1278,7 @@ async function withFigmaErrors(command, fn) {
1278
1278
  } catch (err) {
1279
1279
  if (err instanceof Error) {
1280
1280
  try {
1281
- const { trackCommandFailure } = await import("./events-FKOIB3R3.js");
1281
+ const { trackCommandFailure } = await import("./events-6C3ZG7LS.js");
1282
1282
  trackCommandFailure(
1283
1283
  command,
1284
1284
  err,
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-K2FLNJVB.js";
10
10
  import {
11
11
  trackCommandFailure
12
- } from "./chunk-55RZG5SQ.js";
12
+ } from "./chunk-Y475GD4L.js";
13
13
  import {
14
14
  failCommand
15
15
  } from "./chunk-PBN6GBJE.js";
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-HVW7ABXD.js";
13
13
  import {
14
14
  DEFAULT_REGISTRY_URL
15
- } from "./chunk-XVIYZU3D.js";
15
+ } from "./chunk-K35E45SI.js";
16
16
 
17
17
  // src/utils/projectConfig.ts
18
18
  import { readFileSync, writeFileSync } from "fs";
@@ -10,25 +10,25 @@ import {
10
10
  import {
11
11
  launchManagedBrowser,
12
12
  resolveManagedGpuMode
13
- } from "./chunk-XOJDBRNF.js";
13
+ } from "./chunk-4S4VUXW3.js";
14
14
  import {
15
15
  resolveDiagnosticNavigationTimeoutMs,
16
16
  windowsChromeCrashRemediation
17
- } from "./chunk-3HSWLZ6S.js";
17
+ } from "./chunk-KQHJKJ3V.js";
18
18
  import {
19
19
  resolveLocalBrowserGpuMode,
20
20
  resolveLocalWebGpu
21
- } from "./chunk-P6HELLPU.js";
21
+ } from "./chunk-QIJLIULK.js";
22
+ import {
23
+ c
24
+ } from "./chunk-ZTZA4UWZ.js";
22
25
  import {
23
26
  assertWebGpuAdapterAvailable,
24
27
  compositionRequiresWebGpu
25
- } from "./chunk-JF5L5SQ6.js";
28
+ } from "./chunk-VC7JBNPS.js";
26
29
  import {
27
30
  normalizeErrorMessage
28
31
  } from "./chunk-KNU5COPB.js";
29
- import {
30
- c
31
- } from "./chunk-ZTZA4UWZ.js";
32
32
 
33
33
  // src/capture/captureCompositionFrame.ts
34
34
  import { spawn } from "child_process";
@@ -104,10 +104,10 @@ async function installPageFunctionGuard(page) {
104
104
  }
105
105
  async function openSettledCompositionPage(html, url, options) {
106
106
  const viewport = resolveCompositionViewportFromHtml(html);
107
- const { ensureBrowser, findSystemBrowser } = await import("./manager-BPSR6D3V.js");
107
+ const { ensureBrowser, findSystemBrowser } = await import("./manager-GWU5J6RJ.js");
108
108
  const browser = await ensureBrowser();
109
109
  const puppeteer = await import("puppeteer-core");
110
- const { buildChromeArgs } = await import("./src-2GMPFYHL.js");
110
+ const { buildChromeArgs } = await import("./src-VMTHSARJ.js");
111
111
  const requestedGpuMode = options.browserGpuMode ?? resolveCliChromeGpuMode();
112
112
  const requiresWebGpu = compositionRequiresWebGpu(html);
113
113
  let softwareWebGpu = false;