hyperframes 0.4.14 → 0.4.15-alpha.1

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 (2) hide show
  1. package/dist/cli.js +547 -366
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -54,7 +54,7 @@ var VERSION;
54
54
  var init_version = __esm({
55
55
  "src/version.ts"() {
56
56
  "use strict";
57
- VERSION = true ? "0.4.14" : "0.0.0-dev";
57
+ VERSION = true ? "0.4.15-alpha.1" : "0.0.0-dev";
58
58
  }
59
59
  });
60
60
 
@@ -9821,7 +9821,7 @@ import { get as httpsGet } from "https";
9821
9821
  import { pipeline } from "stream/promises";
9822
9822
  function downloadFile(url, dest) {
9823
9823
  const tmp = `${dest}.tmp`;
9824
- return new Promise((resolve35, reject) => {
9824
+ return new Promise((resolve36, reject) => {
9825
9825
  const follow = (u) => {
9826
9826
  httpsGet(u, (res) => {
9827
9827
  if (res.statusCode === 301 || res.statusCode === 302) {
@@ -9838,7 +9838,7 @@ function downloadFile(url, dest) {
9838
9838
  const file = createWriteStream(tmp);
9839
9839
  pipeline(res, file).then(() => {
9840
9840
  renameSync(tmp, dest);
9841
- resolve35();
9841
+ resolve36();
9842
9842
  }).catch((err) => {
9843
9843
  try {
9844
9844
  unlinkSync(tmp);
@@ -10556,7 +10556,7 @@ function hasNpx() {
10556
10556
  }
10557
10557
  }
10558
10558
  function runSkillsAdd(repo) {
10559
- return new Promise((resolve35, reject) => {
10559
+ return new Promise((resolve36, reject) => {
10560
10560
  const child = spawn("npx", ["skills", "add", repo, "--all"], {
10561
10561
  stdio: "inherit",
10562
10562
  timeout: 12e4,
@@ -10570,7 +10570,7 @@ function runSkillsAdd(repo) {
10570
10570
  env: { ...process.env, GIT_CLONE_PROTECTION_ACTIVE: "0" }
10571
10571
  });
10572
10572
  child.on("close", (code, signal) => {
10573
- if (code === 0) resolve35();
10573
+ if (code === 0) resolve36();
10574
10574
  else if (signal === "SIGINT" || code === 130) process.exit(0);
10575
10575
  else reject(new Error(`npx skills add exited with code ${code}`));
10576
10576
  });
@@ -14850,10 +14850,10 @@ function compareDocumentPosition(nodeA, nodeB) {
14850
14850
  function uniqueSort(nodes) {
14851
14851
  nodes = nodes.filter((node, i2, arr) => !arr.includes(node, i2 + 1));
14852
14852
  nodes.sort((a, b) => {
14853
- const relative5 = compareDocumentPosition(a, b);
14854
- if (relative5 & DocumentPosition.PRECEDING) {
14853
+ const relative6 = compareDocumentPosition(a, b);
14854
+ if (relative6 & DocumentPosition.PRECEDING) {
14855
14855
  return -1;
14856
- } else if (relative5 & DocumentPosition.FOLLOWING) {
14856
+ } else if (relative6 & DocumentPosition.FOLLOWING) {
14857
14857
  return 1;
14858
14858
  }
14859
14859
  return 0;
@@ -15315,8 +15315,8 @@ var init_custom_element_registry = __esm({
15315
15315
  } : (element) => element.localName === localName;
15316
15316
  registry.set(localName, { Class, check });
15317
15317
  if (waiting.has(localName)) {
15318
- for (const resolve35 of waiting.get(localName))
15319
- resolve35(Class);
15318
+ for (const resolve36 of waiting.get(localName))
15319
+ resolve36(Class);
15320
15320
  waiting.delete(localName);
15321
15321
  }
15322
15322
  ownerDocument.querySelectorAll(
@@ -15356,13 +15356,13 @@ var init_custom_element_registry = __esm({
15356
15356
  */
15357
15357
  whenDefined(localName) {
15358
15358
  const { registry, waiting } = this;
15359
- return new Promise((resolve35) => {
15359
+ return new Promise((resolve36) => {
15360
15360
  if (registry.has(localName))
15361
- resolve35(registry.get(localName).Class);
15361
+ resolve36(registry.get(localName).Class);
15362
15362
  else {
15363
15363
  if (!waiting.has(localName))
15364
15364
  waiting.set(localName, []);
15365
- waiting.get(localName).push(resolve35);
15365
+ waiting.get(localName).push(resolve36);
15366
15366
  }
15367
15367
  });
15368
15368
  }
@@ -25397,7 +25397,7 @@ async function pollPageExpression(page, expression, timeoutMs, intervalMs = 100)
25397
25397
  while (Date.now() < deadline) {
25398
25398
  const ready = Boolean(await page.evaluate(expression));
25399
25399
  if (ready) return true;
25400
- await new Promise((resolve35) => setTimeout(resolve35, intervalMs));
25400
+ await new Promise((resolve36) => setTimeout(resolve36, intervalMs));
25401
25401
  }
25402
25402
  return Boolean(await page.evaluate(expression));
25403
25403
  }
@@ -25680,7 +25680,7 @@ var init_frameCapture = __esm({
25680
25680
  // ../engine/src/utils/gpuEncoder.ts
25681
25681
  import { spawn as spawn2 } from "child_process";
25682
25682
  async function detectGpuEncoder() {
25683
- return new Promise((resolve35) => {
25683
+ return new Promise((resolve36) => {
25684
25684
  const ffmpeg = spawn2("ffmpeg", ["-encoders"], {
25685
25685
  stdio: ["pipe", "pipe", "pipe"]
25686
25686
  });
@@ -25689,13 +25689,13 @@ async function detectGpuEncoder() {
25689
25689
  stdout2 += data.toString();
25690
25690
  });
25691
25691
  ffmpeg.on("close", () => {
25692
- if (stdout2.includes("h264_nvenc")) resolve35("nvenc");
25693
- else if (stdout2.includes("h264_videotoolbox")) resolve35("videotoolbox");
25694
- else if (stdout2.includes("h264_vaapi")) resolve35("vaapi");
25695
- else if (stdout2.includes("h264_qsv")) resolve35("qsv");
25696
- else resolve35(null);
25692
+ if (stdout2.includes("h264_nvenc")) resolve36("nvenc");
25693
+ else if (stdout2.includes("h264_videotoolbox")) resolve36("videotoolbox");
25694
+ else if (stdout2.includes("h264_vaapi")) resolve36("vaapi");
25695
+ else if (stdout2.includes("h264_qsv")) resolve36("qsv");
25696
+ else resolve36(null);
25697
25697
  });
25698
- ffmpeg.on("error", () => resolve35(null));
25698
+ ffmpeg.on("error", () => resolve36(null));
25699
25699
  });
25700
25700
  }
25701
25701
  async function getCachedGpuEncoder() {
@@ -25734,7 +25734,7 @@ async function runFfmpeg(args, opts) {
25734
25734
  const signal = opts?.signal;
25735
25735
  const timeout = opts?.timeout ?? DEFAULT_TIMEOUT;
25736
25736
  const onStderr = opts?.onStderr;
25737
- return new Promise((resolve35) => {
25737
+ return new Promise((resolve36) => {
25738
25738
  const ffmpeg = spawn3("ffmpeg", args);
25739
25739
  let stderr = "";
25740
25740
  const onAbort = () => {
@@ -25760,7 +25760,7 @@ async function runFfmpeg(args, opts) {
25760
25760
  ffmpeg.on("close", (code) => {
25761
25761
  clearTimeout(timer);
25762
25762
  if (signal) signal.removeEventListener("abort", onAbort);
25763
- resolve35({
25763
+ resolve36({
25764
25764
  success: !signal?.aborted && code === 0,
25765
25765
  exitCode: code,
25766
25766
  stderr,
@@ -25770,7 +25770,7 @@ async function runFfmpeg(args, opts) {
25770
25770
  ffmpeg.on("error", (err) => {
25771
25771
  clearTimeout(timer);
25772
25772
  if (signal) signal.removeEventListener("abort", onAbort);
25773
- resolve35({
25773
+ resolve36({
25774
25774
  success: false,
25775
25775
  exitCode: null,
25776
25776
  stderr: err.message,
@@ -25941,7 +25941,7 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
25941
25941
  const inputPath = join19(framesDir, framePattern);
25942
25942
  const inputArgs = ["-framerate", String(options.fps), "-i", inputPath];
25943
25943
  const args = buildEncoderArgs(options, inputArgs, outputPath, gpuEncoder);
25944
- return new Promise((resolve35) => {
25944
+ return new Promise((resolve36) => {
25945
25945
  const ffmpeg = spawn4("ffmpeg", args);
25946
25946
  let stderr = "";
25947
25947
  const onAbort = () => {
@@ -25966,7 +25966,7 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
25966
25966
  if (signal) signal.removeEventListener("abort", onAbort);
25967
25967
  const durationMs = Date.now() - startTime;
25968
25968
  if (signal?.aborted) {
25969
- resolve35({
25969
+ resolve36({
25970
25970
  success: false,
25971
25971
  outputPath,
25972
25972
  durationMs,
@@ -25977,7 +25977,7 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
25977
25977
  return;
25978
25978
  }
25979
25979
  if (code !== 0) {
25980
- resolve35({
25980
+ resolve36({
25981
25981
  success: false,
25982
25982
  outputPath,
25983
25983
  durationMs,
@@ -25988,12 +25988,12 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
25988
25988
  return;
25989
25989
  }
25990
25990
  const fileSize = existsSync15(outputPath) ? statSync4(outputPath).size : 0;
25991
- resolve35({ success: true, outputPath, durationMs, framesEncoded: frameCount, fileSize });
25991
+ resolve36({ success: true, outputPath, durationMs, framesEncoded: frameCount, fileSize });
25992
25992
  });
25993
25993
  ffmpeg.on("error", (err) => {
25994
25994
  clearTimeout(timer);
25995
25995
  if (signal) signal.removeEventListener("abort", onAbort);
25996
- resolve35({
25996
+ resolve36({
25997
25997
  success: false,
25998
25998
  outputPath,
25999
25999
  durationMs: Date.now() - startTime,
@@ -26051,18 +26051,18 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
26051
26051
  let gpuEncoder = null;
26052
26052
  if (options.useGpu) gpuEncoder = await getCachedGpuEncoder();
26053
26053
  const args = buildEncoderArgs(options, inputArgs, chunkPath, gpuEncoder);
26054
- const chunkResult = await new Promise((resolve35) => {
26054
+ const chunkResult = await new Promise((resolve36) => {
26055
26055
  const ffmpeg = spawn4("ffmpeg", args);
26056
26056
  let stderr = "";
26057
26057
  ffmpeg.stderr.on("data", (d) => {
26058
26058
  stderr += d.toString();
26059
26059
  });
26060
26060
  ffmpeg.on("close", (code) => {
26061
- if (code === 0) resolve35({ success: true });
26062
- else resolve35({ success: false, error: `Chunk ${i2} encode failed: ${stderr.slice(-400)}` });
26061
+ if (code === 0) resolve36({ success: true });
26062
+ else resolve36({ success: false, error: `Chunk ${i2} encode failed: ${stderr.slice(-400)}` });
26063
26063
  });
26064
26064
  ffmpeg.on("error", (err) => {
26065
- resolve35({ success: false, error: `Chunk ${i2} encode error: ${err.message}` });
26065
+ resolve36({ success: false, error: `Chunk ${i2} encode error: ${err.message}` });
26066
26066
  });
26067
26067
  });
26068
26068
  if (!chunkResult.success) {
@@ -26092,18 +26092,18 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
26092
26092
  "-y",
26093
26093
  outputPath
26094
26094
  ];
26095
- const concatResult = await new Promise((resolve35) => {
26095
+ const concatResult = await new Promise((resolve36) => {
26096
26096
  const ffmpeg = spawn4("ffmpeg", concatArgs);
26097
26097
  let stderr = "";
26098
26098
  ffmpeg.stderr.on("data", (d) => {
26099
26099
  stderr += d.toString();
26100
26100
  });
26101
26101
  ffmpeg.on("close", (code) => {
26102
- if (code === 0) resolve35({ success: true });
26103
- else resolve35({ success: false, error: `Chunk concat failed: ${stderr.slice(-400)}` });
26102
+ if (code === 0) resolve36({ success: true });
26103
+ else resolve36({ success: false, error: `Chunk concat failed: ${stderr.slice(-400)}` });
26104
26104
  });
26105
26105
  ffmpeg.on("error", (err) => {
26106
- resolve35({ success: false, error: `Chunk concat error: ${err.message}` });
26106
+ resolve36({ success: false, error: `Chunk concat error: ${err.message}` });
26107
26107
  });
26108
26108
  });
26109
26109
  if (!concatResult.success) {
@@ -26247,37 +26247,37 @@ import { dirname as dirname6 } from "path";
26247
26247
  function createFrameReorderBuffer(startFrame, endFrame) {
26248
26248
  let cursor = startFrame;
26249
26249
  const pending = /* @__PURE__ */ new Map();
26250
- const enqueueAt = (frame, resolve35) => {
26250
+ const enqueueAt = (frame, resolve36) => {
26251
26251
  const list = pending.get(frame);
26252
26252
  if (list === void 0) {
26253
- pending.set(frame, [resolve35]);
26253
+ pending.set(frame, [resolve36]);
26254
26254
  } else {
26255
- list.push(resolve35);
26255
+ list.push(resolve36);
26256
26256
  }
26257
26257
  };
26258
26258
  const flushAt = (frame) => {
26259
26259
  const list = pending.get(frame);
26260
26260
  if (list === void 0) return;
26261
26261
  pending.delete(frame);
26262
- for (const resolve35 of list) resolve35();
26262
+ for (const resolve36 of list) resolve36();
26263
26263
  };
26264
- const waitForFrame = (frame) => new Promise((resolve35) => {
26264
+ const waitForFrame = (frame) => new Promise((resolve36) => {
26265
26265
  if (frame === cursor) {
26266
- resolve35();
26266
+ resolve36();
26267
26267
  return;
26268
26268
  }
26269
- enqueueAt(frame, resolve35);
26269
+ enqueueAt(frame, resolve36);
26270
26270
  });
26271
26271
  const advanceTo = (frame) => {
26272
26272
  cursor = frame;
26273
26273
  flushAt(frame);
26274
26274
  };
26275
- const waitForAllDone = () => new Promise((resolve35) => {
26275
+ const waitForAllDone = () => new Promise((resolve36) => {
26276
26276
  if (cursor >= endFrame) {
26277
- resolve35();
26277
+ resolve36();
26278
26278
  return;
26279
26279
  }
26280
- enqueueAt(endFrame, resolve35);
26280
+ enqueueAt(endFrame, resolve36);
26281
26281
  });
26282
26282
  return { waitForFrame, advanceTo, waitForAllDone };
26283
26283
  }
@@ -26439,7 +26439,7 @@ async function spawnStreamingEncoder(outputPath, options, signal, config) {
26439
26439
  let stderr = "";
26440
26440
  let exitCode = null;
26441
26441
  let exitPromiseResolve = null;
26442
- const exitPromise = new Promise((resolve35) => exitPromiseResolve = resolve35);
26442
+ const exitPromise = new Promise((resolve36) => exitPromiseResolve = resolve36);
26443
26443
  ffmpeg.stderr?.on("data", (data) => {
26444
26444
  stderr += data.toString();
26445
26445
  });
@@ -26485,8 +26485,8 @@ Process error: ${err.message}`;
26485
26485
  if (signal) signal.removeEventListener("abort", onAbort);
26486
26486
  const stdin = ffmpeg.stdin;
26487
26487
  if (stdin && !stdin.destroyed) {
26488
- await new Promise((resolve35) => {
26489
- stdin.end(() => resolve35());
26488
+ await new Promise((resolve36) => {
26489
+ stdin.end(() => resolve36());
26490
26490
  });
26491
26491
  }
26492
26492
  await exitPromise;
@@ -26528,7 +26528,7 @@ import { spawn as spawn6 } from "child_process";
26528
26528
  import { readFileSync as readFileSync14 } from "fs";
26529
26529
  import { extname as extname4 } from "path";
26530
26530
  function runFfprobe(args) {
26531
- return new Promise((resolve35, reject) => {
26531
+ return new Promise((resolve36, reject) => {
26532
26532
  const proc = spawn6("ffprobe", args);
26533
26533
  let stdout2 = "";
26534
26534
  let stderr = "";
@@ -26542,7 +26542,7 @@ function runFfprobe(args) {
26542
26542
  if (code !== 0) {
26543
26543
  reject(new Error(`[FFmpeg] ffprobe exited with code ${code}: ${stderr}`));
26544
26544
  } else {
26545
- resolve35(stdout2);
26545
+ resolve36(stdout2);
26546
26546
  }
26547
26547
  });
26548
26548
  proc.on("error", (err) => {
@@ -26956,7 +26956,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
26956
26956
  args.push("-q:v", format === "jpg" ? String(Math.ceil((100 - quality) / 3)) : "0");
26957
26957
  if (format === "png") args.push("-compression_level", "6");
26958
26958
  args.push("-y", outputPattern);
26959
- return new Promise((resolve35, reject) => {
26959
+ return new Promise((resolve36, reject) => {
26960
26960
  const ffmpeg = spawn7("ffmpeg", args);
26961
26961
  let stderr = "";
26962
26962
  const onAbort = () => {
@@ -26991,7 +26991,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
26991
26991
  files.forEach((file, index) => {
26992
26992
  framePaths.set(index, join21(videoOutputDir, file));
26993
26993
  });
26994
- resolve35({
26994
+ resolve36({
26995
26995
  videoId,
26996
26996
  srcPath: videoPath,
26997
26997
  outputDir: videoOutputDir,
@@ -28237,11 +28237,11 @@ function createFileServer(options) {
28237
28237
  headers: { "Content-Type": contentType }
28238
28238
  });
28239
28239
  });
28240
- return new Promise((resolve35) => {
28240
+ return new Promise((resolve36) => {
28241
28241
  const server = serve({ fetch: app.fetch, port }, (info) => {
28242
28242
  const actualPort = info.port;
28243
28243
  const url = `http://localhost:${actualPort}`;
28244
- resolve35({
28244
+ resolve36({
28245
28245
  url,
28246
28246
  port: actualPort,
28247
28247
  close: () => server.close()
@@ -30615,10 +30615,10 @@ function createFileServer2(options) {
30615
30615
  headers: { "Content-Type": contentType }
30616
30616
  });
30617
30617
  });
30618
- return new Promise((resolve35) => {
30618
+ return new Promise((resolve36) => {
30619
30619
  const connections = /* @__PURE__ */ new Set();
30620
30620
  const server = serve2({ fetch: app.fetch, port }, (info) => {
30621
- resolve35({
30621
+ resolve36({
30622
30622
  url: `http://localhost:${info.port}`,
30623
30623
  port: info.port,
30624
30624
  close: () => {
@@ -34019,10 +34019,10 @@ var init_semaphore = __esm({
34019
34019
  this.active++;
34020
34020
  return () => this.release();
34021
34021
  }
34022
- return new Promise((resolve35) => {
34022
+ return new Promise((resolve36) => {
34023
34023
  this.queue.push(() => {
34024
34024
  this.active++;
34025
- resolve35(() => this.release());
34025
+ resolve36(() => this.release());
34026
34026
  });
34027
34027
  });
34028
34028
  }
@@ -34930,8 +34930,8 @@ async function runDevMode(dir, projectName) {
34930
34930
  }
34931
34931
  });
34932
34932
  }
34933
- return new Promise((resolve35) => {
34934
- child.on("close", () => resolve35());
34933
+ return new Promise((resolve36) => {
34934
+ child.on("close", () => resolve36());
34935
34935
  });
34936
34936
  }
34937
34937
  function hasLocalStudio(dir) {
@@ -35001,8 +35001,8 @@ async function runLocalStudioMode(dir, projectName) {
35001
35001
  }
35002
35002
  });
35003
35003
  }
35004
- return new Promise((resolve35) => {
35005
- child.on("close", () => resolve35());
35004
+ return new Promise((resolve36) => {
35005
+ child.on("close", () => resolve36());
35006
35006
  });
35007
35007
  }
35008
35008
  async function runEmbeddedMode(dir, startPort, projectName, forceNew = false) {
@@ -36412,6 +36412,184 @@ var init_play = __esm({
36412
36412
  }
36413
36413
  });
36414
36414
 
36415
+ // src/utils/publishProject.ts
36416
+ import { basename as basename6, join as join37, relative as relative4 } from "path";
36417
+ import { readdirSync as readdirSync13, readFileSync as readFileSync26, statSync as statSync12 } from "fs";
36418
+ import AdmZip from "adm-zip";
36419
+ function shouldIgnoreSegment(segment) {
36420
+ return segment.startsWith(".") || IGNORED_DIRS.has(segment) || IGNORED_FILES.has(segment);
36421
+ }
36422
+ function collectProjectFiles(rootDir, currentDir, paths) {
36423
+ for (const entry of readdirSync13(currentDir, { withFileTypes: true })) {
36424
+ if (shouldIgnoreSegment(entry.name)) continue;
36425
+ const absolutePath = join37(currentDir, entry.name);
36426
+ const relativePath = relative4(rootDir, absolutePath).replaceAll("\\", "/");
36427
+ if (!relativePath) continue;
36428
+ if (entry.isDirectory()) {
36429
+ collectProjectFiles(rootDir, absolutePath, paths);
36430
+ continue;
36431
+ }
36432
+ if (!statSync12(absolutePath).isFile()) continue;
36433
+ paths.push(relativePath);
36434
+ }
36435
+ }
36436
+ function createPublishArchive(projectDir) {
36437
+ const filePaths = [];
36438
+ collectProjectFiles(projectDir, projectDir, filePaths);
36439
+ if (!filePaths.includes("index.html")) {
36440
+ throw new Error("Project must include an index.html file at the root before publish.");
36441
+ }
36442
+ const archive = new AdmZip();
36443
+ for (const filePath of filePaths) {
36444
+ archive.addFile(filePath, readFileSync26(join37(projectDir, filePath)));
36445
+ }
36446
+ return {
36447
+ buffer: archive.toBuffer(),
36448
+ fileCount: filePaths.length
36449
+ };
36450
+ }
36451
+ function getPublishApiBaseUrl() {
36452
+ return (process.env["HYPERFRAMES_PUBLISHED_PROJECTS_API_URL"] || process.env["HEYGEN_API_URL"] || "https://api2.heygen.com").replace(/\/$/, "");
36453
+ }
36454
+ async function publishProjectArchive(projectDir) {
36455
+ const title = basename6(projectDir);
36456
+ const archive = createPublishArchive(projectDir);
36457
+ const archiveBytes = new Uint8Array(archive.buffer.byteLength);
36458
+ archiveBytes.set(archive.buffer);
36459
+ const body = new FormData();
36460
+ body.set("title", title);
36461
+ body.set("file", new File([archiveBytes], `${title}.zip`, { type: "application/zip" }));
36462
+ const headers = {
36463
+ heygen_route: "canary"
36464
+ };
36465
+ const response = await fetch(`${getPublishApiBaseUrl()}/v1/hyperframes/projects/publish`, {
36466
+ method: "POST",
36467
+ body,
36468
+ headers,
36469
+ signal: AbortSignal.timeout(3e4)
36470
+ });
36471
+ const payload = await response.json().catch(() => null);
36472
+ const message = typeof payload?.message === "string" ? payload.message : "Failed to publish project";
36473
+ if (!response.ok || !payload?.data) {
36474
+ throw new Error(message);
36475
+ }
36476
+ return {
36477
+ projectId: String(payload.data.project_id),
36478
+ title: String(payload.data.title),
36479
+ fileCount: Number(payload.data.file_count),
36480
+ url: String(payload.data.url),
36481
+ claimToken: String(payload.data.claim_token)
36482
+ };
36483
+ }
36484
+ var IGNORED_DIRS, IGNORED_FILES;
36485
+ var init_publishProject = __esm({
36486
+ "src/utils/publishProject.ts"() {
36487
+ "use strict";
36488
+ IGNORED_DIRS = /* @__PURE__ */ new Set([".git", "node_modules", "dist", ".next", "coverage"]);
36489
+ IGNORED_FILES = /* @__PURE__ */ new Set([".DS_Store", "Thumbs.db"]);
36490
+ }
36491
+ });
36492
+
36493
+ // src/commands/publish.ts
36494
+ var publish_exports = {};
36495
+ __export(publish_exports, {
36496
+ default: () => publish_default,
36497
+ examples: () => examples6
36498
+ });
36499
+ import { basename as basename7, resolve as resolve25 } from "path";
36500
+ import { existsSync as existsSync37 } from "fs";
36501
+ import { join as join38 } from "path";
36502
+ var examples6, publish_default;
36503
+ var init_publish = __esm({
36504
+ "src/commands/publish.ts"() {
36505
+ "use strict";
36506
+ init_dist();
36507
+ init_dist3();
36508
+ init_colors();
36509
+ init_lintProject();
36510
+ init_lintFormat();
36511
+ init_publishProject();
36512
+ examples6 = [
36513
+ ["Publish the current project with a public URL", "hyperframes publish"],
36514
+ ["Publish a specific directory", "hyperframes publish ./my-video"],
36515
+ ["Skip the consent prompt (scripts)", "hyperframes publish --yes"]
36516
+ ];
36517
+ publish_default = defineCommand({
36518
+ meta: {
36519
+ name: "publish",
36520
+ description: "Upload the project and return a stable public URL"
36521
+ },
36522
+ args: {
36523
+ dir: { type: "positional", description: "Project directory", required: false },
36524
+ yes: {
36525
+ type: "boolean",
36526
+ alias: "y",
36527
+ description: "Skip the publish confirmation prompt",
36528
+ default: false
36529
+ }
36530
+ },
36531
+ async run({ args }) {
36532
+ const rawArg = args.dir;
36533
+ const dir = resolve25(rawArg ?? ".");
36534
+ const isImplicitCwd = !rawArg || rawArg === "." || rawArg === "./";
36535
+ const projectName = isImplicitCwd ? basename7(process.env["PWD"] ?? dir) : basename7(dir);
36536
+ const indexPath = join38(dir, "index.html");
36537
+ if (existsSync37(indexPath)) {
36538
+ const lintResult = lintProject({ dir, name: projectName, indexPath });
36539
+ if (lintResult.totalErrors > 0 || lintResult.totalWarnings > 0) {
36540
+ console.log();
36541
+ for (const line of formatLintFindings(lintResult)) console.log(line);
36542
+ console.log();
36543
+ }
36544
+ }
36545
+ if (args.yes !== true) {
36546
+ console.log();
36547
+ console.log(
36548
+ ` ${c.bold("hyperframes publish uploads this project and creates a stable public URL.")}`
36549
+ );
36550
+ console.log(
36551
+ ` ${c.dim("Anyone with the URL can open the published project and claim it after authenticating.")}`
36552
+ );
36553
+ console.log();
36554
+ const approved = await Rt({ message: "Publish this project?" });
36555
+ if (Ct(approved) || approved !== true) {
36556
+ console.log();
36557
+ console.log(` ${c.dim("Aborted.")}`);
36558
+ console.log();
36559
+ return;
36560
+ }
36561
+ }
36562
+ Wt2(c.bold("hyperframes publish"));
36563
+ const publishSpinner = be();
36564
+ publishSpinner.start("Uploading project...");
36565
+ try {
36566
+ const published = await publishProjectArchive(dir);
36567
+ const claimUrl = new URL(published.url);
36568
+ claimUrl.searchParams.set("claim_token", published.claimToken);
36569
+ publishSpinner.stop(c.success("Project published"));
36570
+ console.log();
36571
+ console.log(` ${c.dim("Project")} ${c.accent(published.title)}`);
36572
+ console.log(` ${c.dim("Files")} ${String(published.fileCount)}`);
36573
+ console.log(` ${c.dim("Public")} ${c.accent(claimUrl.toString())}`);
36574
+ console.log();
36575
+ console.log(
36576
+ ` ${c.dim("Open the URL on hyperframes.dev to claim the project and continue editing.")}`
36577
+ );
36578
+ console.log();
36579
+ return;
36580
+ } catch (err) {
36581
+ publishSpinner.stop(c.error("Publish failed"));
36582
+ console.error();
36583
+ console.error(` ${err.message}`);
36584
+ console.error();
36585
+ process.exitCode = 1;
36586
+ return;
36587
+ }
36588
+ }
36589
+ });
36590
+ }
36591
+ });
36592
+
36415
36593
  // src/utils/producer.ts
36416
36594
  async function loadProducer() {
36417
36595
  return await Promise.resolve().then(() => (init_src3(), src_exports3));
@@ -36525,11 +36703,11 @@ var init_ffmpeg = __esm({
36525
36703
  var render_exports = {};
36526
36704
  __export(render_exports, {
36527
36705
  default: () => render_default,
36528
- examples: () => examples6
36706
+ examples: () => examples7
36529
36707
  });
36530
- import { mkdirSync as mkdirSync21, readFileSync as readFileSync26, statSync as statSync12, writeFileSync as writeFileSync14, rmSync as rmSync8 } from "fs";
36708
+ import { mkdirSync as mkdirSync21, readFileSync as readFileSync27, statSync as statSync13, writeFileSync as writeFileSync14, rmSync as rmSync8 } from "fs";
36531
36709
  import { cpus as cpus3, freemem as freemem3, tmpdir as tmpdir3 } from "os";
36532
- import { resolve as resolve25, dirname as dirname15, join as join37, basename as basename6 } from "path";
36710
+ import { resolve as resolve26, dirname as dirname15, join as join39, basename as basename8 } from "path";
36533
36711
  import { execFileSync as execFileSync5, spawn as spawn10 } from "child_process";
36534
36712
  function defaultWorkerCount() {
36535
36713
  return Math.max(1, Math.min(Math.floor(CPU_CORE_COUNT * 3 / 4), 8));
@@ -36538,11 +36716,11 @@ function dockerImageTag(version) {
36538
36716
  return `${DOCKER_IMAGE_PREFIX}:${version}`;
36539
36717
  }
36540
36718
  function resolveDockerfilePath() {
36541
- const builtPath = resolve25(__dirname, "docker", "Dockerfile.render");
36542
- const devPath = resolve25(__dirname, "..", "src", "docker", "Dockerfile.render");
36719
+ const builtPath = resolve26(__dirname, "docker", "Dockerfile.render");
36720
+ const devPath = resolve26(__dirname, "..", "src", "docker", "Dockerfile.render");
36543
36721
  for (const p of [builtPath, devPath]) {
36544
36722
  try {
36545
- statSync12(p);
36723
+ statSync13(p);
36546
36724
  return p;
36547
36725
  } catch {
36548
36726
  continue;
@@ -36566,9 +36744,9 @@ function ensureDockerImage(version, quiet) {
36566
36744
  }
36567
36745
  if (!quiet) console.log(c.dim(` Building Docker image: ${tag}...`));
36568
36746
  const dockerfilePath = resolveDockerfilePath();
36569
- const tmpDir = join37(tmpdir3(), `hyperframes-docker-${Date.now()}`);
36747
+ const tmpDir = join39(tmpdir3(), `hyperframes-docker-${Date.now()}`);
36570
36748
  mkdirSync21(tmpDir, { recursive: true });
36571
- writeFileSync14(join37(tmpDir, "Dockerfile"), readFileSync26(dockerfilePath));
36749
+ writeFileSync14(join39(tmpDir, "Dockerfile"), readFileSync27(dockerfilePath));
36572
36750
  try {
36573
36751
  execFileSync5(
36574
36752
  "docker",
@@ -36613,11 +36791,11 @@ async function renderDocker(projectDir, outputPath, options) {
36613
36791
  process.exit(1);
36614
36792
  }
36615
36793
  const outputDir = dirname15(outputPath);
36616
- const outputFilename = basename6(outputPath);
36794
+ const outputFilename = basename8(outputPath);
36617
36795
  const dockerArgs = buildDockerRunArgs({
36618
36796
  imageTag,
36619
- projectDir: resolve25(projectDir),
36620
- outputDir: resolve25(outputDir),
36797
+ projectDir: resolve26(projectDir),
36798
+ outputDir: resolve26(outputDir),
36621
36799
  outputFilename,
36622
36800
  options: {
36623
36801
  fps: options.fps,
@@ -36736,7 +36914,7 @@ function printRenderComplete(outputPath, elapsedMs, quiet) {
36736
36914
  if (quiet) return;
36737
36915
  let fileSize = "unknown";
36738
36916
  try {
36739
- fileSize = formatBytes(statSync12(outputPath).size);
36917
+ fileSize = formatBytes(statSync13(outputPath).size);
36740
36918
  } catch {
36741
36919
  }
36742
36920
  const duration = formatDuration(elapsedMs);
@@ -36744,7 +36922,7 @@ function printRenderComplete(outputPath, elapsedMs, quiet) {
36744
36922
  console.log(c.success("\u25C7") + " " + c.accent(outputPath));
36745
36923
  console.log(" " + c.bold(fileSize) + c.dim(" \xB7 " + duration + " \xB7 completed"));
36746
36924
  }
36747
- var examples6, VALID_FPS, VALID_QUALITY, VALID_FORMAT, FORMAT_EXT, CPU_CORE_COUNT, render_default, DOCKER_IMAGE_PREFIX;
36925
+ var examples7, VALID_FPS, VALID_QUALITY, VALID_FORMAT, FORMAT_EXT, CPU_CORE_COUNT, render_default, DOCKER_IMAGE_PREFIX;
36748
36926
  var init_render2 = __esm({
36749
36927
  "src/commands/render.ts"() {
36750
36928
  "use strict";
@@ -36761,7 +36939,7 @@ var init_render2 = __esm({
36761
36939
  init_version();
36762
36940
  init_env();
36763
36941
  init_dockerRunArgs();
36764
- examples6 = [
36942
+ examples7 = [
36765
36943
  ["Render to MP4", "hyperframes render --output output.mp4"],
36766
36944
  ["Render transparent overlay (ProRes)", "hyperframes render --format mov --output overlay.mov"],
36767
36945
  ["Render transparent WebM overlay", "hyperframes render --format webm --output overlay.webm"],
@@ -36892,12 +37070,12 @@ var init_render2 = __esm({
36892
37070
  }
36893
37071
  process.env.PRODUCER_MAX_CONCURRENT_RENDERS = String(parsed);
36894
37072
  }
36895
- const rendersDir = resolve25("renders");
37073
+ const rendersDir = resolve26("renders");
36896
37074
  const ext = FORMAT_EXT[format] ?? ".mp4";
36897
37075
  const now = /* @__PURE__ */ new Date();
36898
37076
  const datePart = now.toISOString().slice(0, 10);
36899
37077
  const timePart = now.toTimeString().slice(0, 8).replace(/:/g, "-");
36900
- const outputPath = args.output ? resolve25(args.output) : join37(rendersDir, `${project.name}_${datePart}_${timePart}${ext}`);
37078
+ const outputPath = args.output ? resolve26(args.output) : join39(rendersDir, `${project.name}_${datePart}_${timePart}${ext}`);
36901
37079
  mkdirSync21(dirname15(outputPath), { recursive: true });
36902
37080
  const useDocker = args.docker ?? false;
36903
37081
  const useGpu = args.gpu ?? false;
@@ -37126,9 +37304,9 @@ var init_updateCheck = __esm({
37126
37304
  var lint_exports2 = {};
37127
37305
  __export(lint_exports2, {
37128
37306
  default: () => lint_default,
37129
- examples: () => examples7
37307
+ examples: () => examples8
37130
37308
  });
37131
- var examples7, lint_default;
37309
+ var examples8, lint_default;
37132
37310
  var init_lint3 = __esm({
37133
37311
  "src/commands/lint.ts"() {
37134
37312
  "use strict";
@@ -37138,7 +37316,7 @@ var init_lint3 = __esm({
37138
37316
  init_lintProject();
37139
37317
  init_project();
37140
37318
  init_updateCheck();
37141
- examples7 = [
37319
+ examples8 = [
37142
37320
  ["Lint the current project", "hyperframes lint"],
37143
37321
  ["Lint a specific directory", "hyperframes lint ./my-video"],
37144
37322
  ["Output findings as JSON", "hyperframes lint --json"],
@@ -37243,23 +37421,23 @@ var init_dom = __esm({
37243
37421
  var info_exports = {};
37244
37422
  __export(info_exports, {
37245
37423
  default: () => info_default,
37246
- examples: () => examples8
37424
+ examples: () => examples9
37247
37425
  });
37248
- import { readFileSync as readFileSync27, readdirSync as readdirSync13, statSync as statSync13 } from "fs";
37249
- import { join as join38 } from "path";
37426
+ import { readFileSync as readFileSync28, readdirSync as readdirSync14, statSync as statSync14 } from "fs";
37427
+ import { join as join40 } from "path";
37250
37428
  function totalSize(dir) {
37251
37429
  let total = 0;
37252
- for (const entry of readdirSync13(dir, { withFileTypes: true })) {
37253
- const path2 = join38(dir, entry.name);
37430
+ for (const entry of readdirSync14(dir, { withFileTypes: true })) {
37431
+ const path2 = join40(dir, entry.name);
37254
37432
  if (entry.isDirectory()) {
37255
37433
  total += totalSize(path2);
37256
37434
  } else {
37257
- total += statSync13(path2).size;
37435
+ total += statSync14(path2).size;
37258
37436
  }
37259
37437
  }
37260
37438
  return total;
37261
37439
  }
37262
- var examples8, info_default;
37440
+ var examples9, info_default;
37263
37441
  var init_info = __esm({
37264
37442
  "src/commands/info.ts"() {
37265
37443
  "use strict";
@@ -37270,7 +37448,7 @@ var init_info = __esm({
37270
37448
  init_dom();
37271
37449
  init_project();
37272
37450
  init_updateCheck();
37273
- examples8 = [
37451
+ examples9 = [
37274
37452
  ["Show project metadata", "hyperframes info"],
37275
37453
  ["Output as JSON", "hyperframes info --json"]
37276
37454
  ];
@@ -37282,7 +37460,7 @@ var init_info = __esm({
37282
37460
  },
37283
37461
  async run({ args }) {
37284
37462
  const project = resolveProject(args.dir);
37285
- const html = readFileSync27(project.indexPath, "utf-8");
37463
+ const html = readFileSync28(project.indexPath, "utf-8");
37286
37464
  ensureDOMParser();
37287
37465
  const parsed = parseHtml(html);
37288
37466
  const tracks = new Set(parsed.elements.map((el) => el.zIndex));
@@ -37336,10 +37514,10 @@ var init_info = __esm({
37336
37514
  var compositions_exports = {};
37337
37515
  __export(compositions_exports, {
37338
37516
  default: () => compositions_default,
37339
- examples: () => examples9
37517
+ examples: () => examples10
37340
37518
  });
37341
- import { existsSync as existsSync37, readFileSync as readFileSync28 } from "fs";
37342
- import { resolve as resolve26, dirname as dirname16 } from "path";
37519
+ import { existsSync as existsSync38, readFileSync as readFileSync29 } from "fs";
37520
+ import { resolve as resolve27, dirname as dirname16 } from "path";
37343
37521
  function parseCompositions(html, baseDir) {
37344
37522
  const parser = new DOMParser();
37345
37523
  const doc = parser.parseFromString(html, "text/html");
@@ -37351,9 +37529,9 @@ function parseCompositions(html, baseDir) {
37351
37529
  const height = parseInt(div.getAttribute("data-height") ?? "1080", 10);
37352
37530
  const compositionSrc = div.getAttribute("data-composition-src");
37353
37531
  if (compositionSrc) {
37354
- const subPath = resolve26(baseDir, compositionSrc);
37355
- if (existsSync37(subPath)) {
37356
- const subHtml = readFileSync28(subPath, "utf-8");
37532
+ const subPath = resolve27(baseDir, compositionSrc);
37533
+ if (existsSync38(subPath)) {
37534
+ const subHtml = readFileSync29(subPath, "utf-8");
37357
37535
  const subInfo = parseSubComposition(subHtml, id, width, height);
37358
37536
  compositions.push({ ...subInfo, source: compositionSrc });
37359
37537
  return;
@@ -37426,7 +37604,7 @@ function parseSubComposition(html, fallbackId, fallbackWidth, fallbackHeight) {
37426
37604
  }
37427
37605
  return { id, duration, width, height, elementCount };
37428
37606
  }
37429
- var examples9, compositions_default;
37607
+ var examples10, compositions_default;
37430
37608
  var init_compositions = __esm({
37431
37609
  "src/commands/compositions.ts"() {
37432
37610
  "use strict";
@@ -37435,7 +37613,7 @@ var init_compositions = __esm({
37435
37613
  init_dom();
37436
37614
  init_project();
37437
37615
  init_updateCheck();
37438
- examples9 = [
37616
+ examples10 = [
37439
37617
  ["List compositions in the current project", "hyperframes compositions"],
37440
37618
  ["Output as JSON", "hyperframes compositions --json"]
37441
37619
  ];
@@ -37447,7 +37625,7 @@ var init_compositions = __esm({
37447
37625
  },
37448
37626
  async run({ args }) {
37449
37627
  const project = resolveProject(args.dir);
37450
- const html = readFileSync28(project.indexPath, "utf-8");
37628
+ const html = readFileSync29(project.indexPath, "utf-8");
37451
37629
  ensureDOMParser();
37452
37630
  const compositions = parseCompositions(html, dirname16(project.indexPath));
37453
37631
  if (compositions.length === 0) {
@@ -37483,11 +37661,11 @@ var init_compositions = __esm({
37483
37661
  var benchmark_exports = {};
37484
37662
  __export(benchmark_exports, {
37485
37663
  default: () => benchmark_default,
37486
- examples: () => examples10
37664
+ examples: () => examples11
37487
37665
  });
37488
- import { existsSync as existsSync38, statSync as statSync14 } from "fs";
37489
- import { resolve as resolve27, join as join39 } from "path";
37490
- var examples10, DEFAULT_CONFIGS, benchmark_default;
37666
+ import { existsSync as existsSync39, statSync as statSync15 } from "fs";
37667
+ import { resolve as resolve28, join as join41 } from "path";
37668
+ var examples11, DEFAULT_CONFIGS, benchmark_default;
37491
37669
  var init_benchmark = __esm({
37492
37670
  "src/commands/benchmark.ts"() {
37493
37671
  "use strict";
@@ -37498,7 +37676,7 @@ var init_benchmark = __esm({
37498
37676
  init_format();
37499
37677
  init_dist3();
37500
37678
  init_updateCheck();
37501
- examples10 = [
37679
+ examples11 = [
37502
37680
  ["Run benchmarks with default settings (3 runs)", "hyperframes benchmark"],
37503
37681
  ["Run 5 iterations per config", "hyperframes benchmark --runs 5"],
37504
37682
  ["Output results as JSON", "hyperframes benchmark --json"]
@@ -37528,7 +37706,7 @@ var init_benchmark = __esm({
37528
37706
  process.exit(1);
37529
37707
  }
37530
37708
  const jsonOutput = args.json ?? false;
37531
- const benchDir = resolve27("renders", ".benchmark");
37709
+ const benchDir = resolve28("renders", ".benchmark");
37532
37710
  let producer = null;
37533
37711
  try {
37534
37712
  producer = await loadProducer();
@@ -37561,7 +37739,7 @@ var init_benchmark = __esm({
37561
37739
  s2?.start(`Benchmarking ${config.label}...`);
37562
37740
  for (let i2 = 0; i2 < runsPerConfig; i2++) {
37563
37741
  s2?.message(`${config.label} \u2014 run ${i2 + 1}/${runsPerConfig}`);
37564
- const outputPath = join39(
37742
+ const outputPath = join41(
37565
37743
  benchDir,
37566
37744
  `${config.label.replace(/[^a-zA-Z0-9]/g, "_")}_run${i2}.mp4`
37567
37745
  );
@@ -37575,8 +37753,8 @@ var init_benchmark = __esm({
37575
37753
  await producer.executeRenderJob(job, project.dir, outputPath);
37576
37754
  const elapsedMs = Date.now() - startTime;
37577
37755
  let fileSize = null;
37578
- if (existsSync38(outputPath)) {
37579
- const stat3 = statSync14(outputPath);
37756
+ if (existsSync39(outputPath)) {
37757
+ const stat3 = statSync15(outputPath);
37580
37758
  fileSize = stat3.size;
37581
37759
  }
37582
37760
  runs.push({ elapsedMs, fileSize });
@@ -37658,7 +37836,7 @@ var init_benchmark = __esm({
37658
37836
  var browser_exports = {};
37659
37837
  __export(browser_exports, {
37660
37838
  default: () => browser_default,
37661
- examples: () => examples11
37839
+ examples: () => examples12
37662
37840
  });
37663
37841
  async function runEnsure() {
37664
37842
  Wt2(c.bold("hyperframes browser ensure"));
@@ -37721,7 +37899,7 @@ function runClear() {
37721
37899
  Gt(c.dim("No cached browser to remove."));
37722
37900
  }
37723
37901
  }
37724
- var examples11, browser_default;
37902
+ var examples12, browser_default;
37725
37903
  var init_browser = __esm({
37726
37904
  "src/commands/browser.ts"() {
37727
37905
  "use strict";
@@ -37731,7 +37909,7 @@ var init_browser = __esm({
37731
37909
  init_format();
37732
37910
  init_manager2();
37733
37911
  init_events();
37734
- examples11 = [
37912
+ examples12 = [
37735
37913
  ["Find or download Chrome for rendering", "hyperframes browser ensure"],
37736
37914
  ["Print the Chrome executable path", "hyperframes browser path"],
37737
37915
  ["Remove cached Chrome download", "hyperframes browser clear"]
@@ -37789,10 +37967,10 @@ Run ${c.accent("hyperframes browser --help")} for usage.`
37789
37967
  var transcribe_exports2 = {};
37790
37968
  __export(transcribe_exports2, {
37791
37969
  default: () => transcribe_default,
37792
- examples: () => examples12
37970
+ examples: () => examples13
37793
37971
  });
37794
- import { existsSync as existsSync39, writeFileSync as writeFileSync15 } from "fs";
37795
- import { resolve as resolve28, join as join40, extname as extname8 } from "path";
37972
+ import { existsSync as existsSync40, writeFileSync as writeFileSync15 } from "fs";
37973
+ import { resolve as resolve29, join as join42, extname as extname8 } from "path";
37796
37974
  async function importTranscript(inputPath, dir, json) {
37797
37975
  const { loadTranscript: loadTranscript2, patchCaptionHtml: patchCaptionHtml2 } = await Promise.resolve().then(() => (init_normalize(), normalize_exports));
37798
37976
  const { words, format } = loadTranscript2(inputPath);
@@ -37800,7 +37978,7 @@ async function importTranscript(inputPath, dir, json) {
37800
37978
  console.error(c.error("No words found in transcript."));
37801
37979
  process.exit(1);
37802
37980
  }
37803
- const outPath = join40(dir, "transcript.json");
37981
+ const outPath = join42(dir, "transcript.json");
37804
37982
  writeFileSync15(outPath, JSON.stringify(words, null, 2));
37805
37983
  patchCaptionHtml2(dir, words);
37806
37984
  if (json) {
@@ -37867,7 +38045,7 @@ async function transcribeAudio(inputPath, dir, opts) {
37867
38045
  process.exit(1);
37868
38046
  }
37869
38047
  }
37870
- var examples12, transcribe_default;
38048
+ var examples13, transcribe_default;
37871
38049
  var init_transcribe2 = __esm({
37872
38050
  "src/commands/transcribe.ts"() {
37873
38051
  "use strict";
@@ -37875,7 +38053,7 @@ var init_transcribe2 = __esm({
37875
38053
  init_dist3();
37876
38054
  init_colors();
37877
38055
  init_manager();
37878
- examples12 = [
38056
+ examples13 = [
37879
38057
  ["Transcribe an audio file", "hyperframes transcribe audio.mp3"],
37880
38058
  ["Transcribe a video file", "hyperframes transcribe video.mp4"],
37881
38059
  ["Use a larger model for better accuracy", "hyperframes transcribe audio.mp3 --model medium.en"],
@@ -37916,12 +38094,12 @@ var init_transcribe2 = __esm({
37916
38094
  }
37917
38095
  },
37918
38096
  async run({ args }) {
37919
- const inputPath = resolve28(args.input);
37920
- if (!existsSync39(inputPath)) {
38097
+ const inputPath = resolve29(args.input);
38098
+ if (!existsSync40(inputPath)) {
37921
38099
  console.error(c.error(`File not found: ${args.input}`));
37922
38100
  process.exit(1);
37923
38101
  }
37924
- const dir = resolve28(args.dir ?? ".");
38102
+ const dir = resolve29(args.dir ?? ".");
37925
38103
  const ext = extname8(inputPath).toLowerCase();
37926
38104
  const isImport = ext === ".json" || ext === ".srt" || ext === ".vtt";
37927
38105
  if (isImport) {
@@ -37938,9 +38116,9 @@ var init_transcribe2 = __esm({
37938
38116
  });
37939
38117
 
37940
38118
  // src/tts/manager.ts
37941
- import { existsSync as existsSync40, mkdirSync as mkdirSync22 } from "fs";
38119
+ import { existsSync as existsSync41, mkdirSync as mkdirSync22 } from "fs";
37942
38120
  import { homedir as homedir8 } from "os";
37943
- import { join as join41 } from "path";
38121
+ import { join as join43 } from "path";
37944
38122
  function inferLangFromVoiceId(voiceId) {
37945
38123
  const first = voiceId.charAt(0).toLowerCase();
37946
38124
  return VOICE_PREFIX_LANG[first] ?? "en-us";
@@ -37949,8 +38127,8 @@ function isSupportedLang(value) {
37949
38127
  return SUPPORTED_LANGS.includes(value);
37950
38128
  }
37951
38129
  async function ensureModel2(model = DEFAULT_MODEL2, options) {
37952
- const modelPath = join41(MODELS_DIR2, `${model}.onnx`);
37953
- if (existsSync40(modelPath)) return modelPath;
38130
+ const modelPath = join43(MODELS_DIR2, `${model}.onnx`);
38131
+ if (existsSync41(modelPath)) return modelPath;
37954
38132
  const url = MODEL_URLS[model];
37955
38133
  if (!url) {
37956
38134
  throw new Error(
@@ -37960,18 +38138,18 @@ async function ensureModel2(model = DEFAULT_MODEL2, options) {
37960
38138
  mkdirSync22(MODELS_DIR2, { recursive: true });
37961
38139
  options?.onProgress?.(`Downloading TTS model ${model} (~311 MB)...`);
37962
38140
  await downloadFile(url, modelPath);
37963
- if (!existsSync40(modelPath)) {
38141
+ if (!existsSync41(modelPath)) {
37964
38142
  throw new Error(`Model download failed: ${model}`);
37965
38143
  }
37966
38144
  return modelPath;
37967
38145
  }
37968
38146
  async function ensureVoices(options) {
37969
- const voicesPath = join41(VOICES_DIR, "voices-v1.0.bin");
37970
- if (existsSync40(voicesPath)) return voicesPath;
38147
+ const voicesPath = join43(VOICES_DIR, "voices-v1.0.bin");
38148
+ if (existsSync41(voicesPath)) return voicesPath;
37971
38149
  mkdirSync22(VOICES_DIR, { recursive: true });
37972
38150
  options?.onProgress?.("Downloading voice data (~27 MB)...");
37973
38151
  await downloadFile(VOICES_URL, voicesPath);
37974
- if (!existsSync40(voicesPath)) {
38152
+ if (!existsSync41(voicesPath)) {
37975
38153
  throw new Error("Voice data download failed");
37976
38154
  }
37977
38155
  return voicesPath;
@@ -37981,9 +38159,9 @@ var init_manager3 = __esm({
37981
38159
  "src/tts/manager.ts"() {
37982
38160
  "use strict";
37983
38161
  init_download();
37984
- CACHE_DIR3 = join41(homedir8(), ".cache", "hyperframes", "tts");
37985
- MODELS_DIR2 = join41(CACHE_DIR3, "models");
37986
- VOICES_DIR = join41(CACHE_DIR3, "voices");
38162
+ CACHE_DIR3 = join43(homedir8(), ".cache", "hyperframes", "tts");
38163
+ MODELS_DIR2 = join43(CACHE_DIR3, "models");
38164
+ VOICES_DIR = join43(CACHE_DIR3, "voices");
37987
38165
  DEFAULT_MODEL2 = "kokoro-v1.0";
37988
38166
  MODEL_URLS = {
37989
38167
  "kokoro-v1.0": "https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/kokoro-v1.0.onnx"
@@ -38044,8 +38222,8 @@ __export(synthesize_exports, {
38044
38222
  synthesize: () => synthesize
38045
38223
  });
38046
38224
  import { execFileSync as execFileSync6 } from "child_process";
38047
- import { existsSync as existsSync41, writeFileSync as writeFileSync16, mkdirSync as mkdirSync23, readdirSync as readdirSync14, unlinkSync as unlinkSync6 } from "fs";
38048
- import { join as join42, dirname as dirname17, basename as basename7 } from "path";
38225
+ import { existsSync as existsSync42, writeFileSync as writeFileSync16, mkdirSync as mkdirSync23, readdirSync as readdirSync15, unlinkSync as unlinkSync6 } from "fs";
38226
+ import { join as join44, dirname as dirname17, basename as basename9 } from "path";
38049
38227
  import { homedir as homedir9 } from "os";
38050
38228
  function findPython() {
38051
38229
  for (const name of ["python3", "python"]) {
@@ -38081,15 +38259,15 @@ function hasPythonPackage(python, pkg) {
38081
38259
  }
38082
38260
  }
38083
38261
  function ensureSynthScript() {
38084
- if (!existsSync41(SCRIPT_PATH)) {
38262
+ if (!existsSync42(SCRIPT_PATH)) {
38085
38263
  mkdirSync23(SCRIPT_DIR, { recursive: true });
38086
38264
  writeFileSync16(SCRIPT_PATH, SYNTH_SCRIPT);
38087
- const currentName = basename7(SCRIPT_PATH);
38265
+ const currentName = basename9(SCRIPT_PATH);
38088
38266
  try {
38089
- for (const entry of readdirSync14(SCRIPT_DIR)) {
38267
+ for (const entry of readdirSync15(SCRIPT_DIR)) {
38090
38268
  if (entry !== currentName && /^synth(-v\d+)?\.py$/.test(entry)) {
38091
38269
  try {
38092
- unlinkSync6(join42(SCRIPT_DIR, entry));
38270
+ unlinkSync6(join44(SCRIPT_DIR, entry));
38093
38271
  } catch {
38094
38272
  }
38095
38273
  }
@@ -38135,7 +38313,7 @@ async function synthesize(text, outputPath, options) {
38135
38313
  stdio: ["pipe", "pipe", "pipe"]
38136
38314
  }
38137
38315
  );
38138
- if (!existsSync41(outputPath)) {
38316
+ if (!existsSync42(outputPath)) {
38139
38317
  throw new Error("Synthesis completed but no output file was created");
38140
38318
  }
38141
38319
  const lines = stdout2.trim().split("\n");
@@ -38148,7 +38326,7 @@ async function synthesize(text, outputPath, options) {
38148
38326
  langApplied: result.langApplied
38149
38327
  };
38150
38328
  } catch (err) {
38151
- if (err instanceof SyntaxError && existsSync41(outputPath)) {
38329
+ if (err instanceof SyntaxError && existsSync42(outputPath)) {
38152
38330
  throw new Error(
38153
38331
  "Speech was generated but metadata could not be read. Check the output file manually."
38154
38332
  );
@@ -38199,8 +38377,8 @@ print(json.dumps({
38199
38377
  "langApplied": bool(lang and supports_lang),
38200
38378
  }))
38201
38379
  `;
38202
- SCRIPT_DIR = join42(homedir9(), ".cache", "hyperframes", "tts");
38203
- SCRIPT_PATH = join42(SCRIPT_DIR, "synth-v2.py");
38380
+ SCRIPT_DIR = join44(homedir9(), ".cache", "hyperframes", "tts");
38381
+ SCRIPT_PATH = join44(SCRIPT_DIR, "synth-v2.py");
38204
38382
  }
38205
38383
  });
38206
38384
 
@@ -38208,10 +38386,10 @@ print(json.dumps({
38208
38386
  var tts_exports = {};
38209
38387
  __export(tts_exports, {
38210
38388
  default: () => tts_default,
38211
- examples: () => examples13
38389
+ examples: () => examples14
38212
38390
  });
38213
- import { existsSync as existsSync42, readFileSync as readFileSync29 } from "fs";
38214
- import { resolve as resolve29, extname as extname9 } from "path";
38391
+ import { existsSync as existsSync43, readFileSync as readFileSync30 } from "fs";
38392
+ import { resolve as resolve30, extname as extname9 } from "path";
38215
38393
  function listVoices(json) {
38216
38394
  const rows = BUNDLED_VOICES.map((v) => ({ ...v, defaultLang: inferLangFromVoiceId(v.id) }));
38217
38395
  if (json) {
@@ -38241,7 +38419,7 @@ ${c.bold("Available voices")} (Kokoro-82M)
38241
38419
  `
38242
38420
  );
38243
38421
  }
38244
- var examples13, voiceList, langList, tts_default;
38422
+ var examples14, voiceList, langList, tts_default;
38245
38423
  var init_tts = __esm({
38246
38424
  "src/commands/tts.ts"() {
38247
38425
  "use strict";
@@ -38250,7 +38428,7 @@ var init_tts = __esm({
38250
38428
  init_colors();
38251
38429
  init_format();
38252
38430
  init_manager3();
38253
- examples13 = [
38431
+ examples14 = [
38254
38432
  ["Generate speech from text", 'hyperframes tts "Welcome to HyperFrames"'],
38255
38433
  ["Choose a voice", 'hyperframes tts "Hello world" --voice am_adam'],
38256
38434
  ["Save to a specific file", 'hyperframes tts "Intro" --voice bf_emma --output narration.wav'],
@@ -38319,9 +38497,9 @@ var init_tts = __esm({
38319
38497
  process.exit(1);
38320
38498
  }
38321
38499
  let text;
38322
- const maybeFile = resolve29(args.input);
38323
- if (existsSync42(maybeFile) && extname9(maybeFile).toLowerCase() === ".txt") {
38324
- text = readFileSync29(maybeFile, "utf-8").trim();
38500
+ const maybeFile = resolve30(args.input);
38501
+ if (existsSync43(maybeFile) && extname9(maybeFile).toLowerCase() === ".txt") {
38502
+ text = readFileSync30(maybeFile, "utf-8").trim();
38325
38503
  if (!text) {
38326
38504
  console.error(c.error("File is empty."));
38327
38505
  process.exit(1);
@@ -38333,7 +38511,7 @@ var init_tts = __esm({
38333
38511
  console.error(c.error("No text provided."));
38334
38512
  process.exit(1);
38335
38513
  }
38336
- const output = resolve29(args.output ?? "speech.wav");
38514
+ const output = resolve30(args.output ?? "speech.wav");
38337
38515
  const voice = args.voice ?? DEFAULT_VOICE;
38338
38516
  const speed = args.speed ? parseFloat(args.speed) : 1;
38339
38517
  if (isNaN(speed) || speed <= 0 || speed > 3) {
@@ -38411,17 +38589,17 @@ var init_tts = __esm({
38411
38589
  var docs_exports = {};
38412
38590
  __export(docs_exports, {
38413
38591
  default: () => docs_default,
38414
- examples: () => examples14
38592
+ examples: () => examples15
38415
38593
  });
38416
- import { readFileSync as readFileSync30, existsSync as existsSync43 } from "fs";
38417
- import { resolve as resolve30, dirname as dirname18, join as join43 } from "path";
38594
+ import { readFileSync as readFileSync31, existsSync as existsSync44 } from "fs";
38595
+ import { resolve as resolve31, dirname as dirname18, join as join45 } from "path";
38418
38596
  import { fileURLToPath as fileURLToPath6 } from "url";
38419
38597
  function docsDir() {
38420
38598
  const thisFile = fileURLToPath6(import.meta.url);
38421
38599
  const dir = dirname18(thisFile);
38422
- const devPath = resolve30(dir, "..", "docs");
38423
- const builtPath = resolve30(dir, "docs");
38424
- return existsSync43(devPath) ? devPath : builtPath;
38600
+ const devPath = resolve31(dir, "..", "docs");
38601
+ const builtPath = resolve31(dir, "docs");
38602
+ return existsSync44(devPath) ? devPath : builtPath;
38425
38603
  }
38426
38604
  function formatInlineCode(line) {
38427
38605
  return line.replace(/`([^`]+)`/g, (_match, code) => c.accent(code));
@@ -38448,13 +38626,13 @@ function renderMarkdown(content) {
38448
38626
  console.log(formatInlineCode(line));
38449
38627
  }
38450
38628
  }
38451
- var examples14, TOPICS, TOPIC_NAMES, docs_default;
38629
+ var examples15, TOPICS, TOPIC_NAMES, docs_default;
38452
38630
  var init_docs = __esm({
38453
38631
  "src/commands/docs.ts"() {
38454
38632
  "use strict";
38455
38633
  init_dist();
38456
38634
  init_colors();
38457
- examples14 = [
38635
+ examples15 = [
38458
38636
  ["List all available topics", "hyperframes docs"],
38459
38637
  ["Read about data attributes", "hyperframes docs data-attributes"],
38460
38638
  ["Read about rendering", "hyperframes docs rendering"],
@@ -38518,12 +38696,12 @@ var init_docs = __esm({
38518
38696
  }
38519
38697
  process.exit(1);
38520
38698
  }
38521
- const filePath = join43(docsDir(), entry.file);
38522
- if (!existsSync43(filePath)) {
38699
+ const filePath = join45(docsDir(), entry.file);
38700
+ if (!existsSync44(filePath)) {
38523
38701
  console.error(c.error(`Doc file not found: ${filePath}`));
38524
38702
  process.exit(1);
38525
38703
  }
38526
- const content = readFileSync30(filePath, "utf-8");
38704
+ const content = readFileSync31(filePath, "utf-8");
38527
38705
  console.log();
38528
38706
  renderMarkdown(content);
38529
38707
  }
@@ -38535,7 +38713,7 @@ var init_docs = __esm({
38535
38713
  var doctor_exports = {};
38536
38714
  __export(doctor_exports, {
38537
38715
  default: () => doctor_default,
38538
- examples: () => examples15
38716
+ examples: () => examples16
38539
38717
  });
38540
38718
  import { execSync as execSync3 } from "child_process";
38541
38719
  import { freemem as freemem4, platform as platform4 } from "os";
@@ -38677,7 +38855,7 @@ function checkEnvironment() {
38677
38855
  }
38678
38856
  return { ok: true, detail: parts.join(" \xB7 ") };
38679
38857
  }
38680
- var examples15, doctor_default;
38858
+ var examples16, doctor_default;
38681
38859
  var init_doctor = __esm({
38682
38860
  "src/commands/doctor.ts"() {
38683
38861
  "use strict";
@@ -38688,7 +38866,7 @@ var init_doctor = __esm({
38688
38866
  init_version();
38689
38867
  init_updateCheck();
38690
38868
  init_system();
38691
- examples15 = [["Check system dependencies", "hyperframes doctor"]];
38869
+ examples16 = [["Check system dependencies", "hyperframes doctor"]];
38692
38870
  doctor_default = defineCommand({
38693
38871
  meta: { name: "doctor", description: "Check system dependencies and environment" },
38694
38872
  args: {},
@@ -38743,10 +38921,10 @@ var init_doctor = __esm({
38743
38921
  var upgrade_exports = {};
38744
38922
  __export(upgrade_exports, {
38745
38923
  default: () => upgrade_default,
38746
- examples: () => examples16
38924
+ examples: () => examples17
38747
38925
  });
38748
38926
  import { execSync as execSync4 } from "child_process";
38749
- var examples16, upgrade_default;
38927
+ var examples17, upgrade_default;
38750
38928
  var init_upgrade = __esm({
38751
38929
  "src/commands/upgrade.ts"() {
38752
38930
  "use strict";
@@ -38755,7 +38933,7 @@ var init_upgrade = __esm({
38755
38933
  init_colors();
38756
38934
  init_version();
38757
38935
  init_updateCheck();
38758
- examples16 = [
38936
+ examples17 = [
38759
38937
  ["Check for updates interactively", "hyperframes upgrade"],
38760
38938
  ["Check for updates without prompting", "hyperframes upgrade --check"],
38761
38939
  ["Upgrade non-interactively", "hyperframes upgrade --yes"]
@@ -38833,7 +39011,7 @@ var init_upgrade = __esm({
38833
39011
  var telemetry_exports = {};
38834
39012
  __export(telemetry_exports, {
38835
39013
  default: () => telemetry_default,
38836
- examples: () => examples17
39014
+ examples: () => examples18
38837
39015
  });
38838
39016
  function runEnable() {
38839
39017
  const config = readConfig();
@@ -38863,14 +39041,14 @@ function runStatus() {
38863
39041
  console.log(` ${c.dim("Env var:")} ${c.accent("HYPERFRAMES_NO_TELEMETRY=1")}`);
38864
39042
  console.log();
38865
39043
  }
38866
- var examples17, telemetry_default;
39044
+ var examples18, telemetry_default;
38867
39045
  var init_telemetry = __esm({
38868
39046
  "src/commands/telemetry.ts"() {
38869
39047
  "use strict";
38870
39048
  init_dist();
38871
39049
  init_colors();
38872
39050
  init_config();
38873
- examples17 = [
39051
+ examples18 = [
38874
39052
  ["Check current telemetry status", "hyperframes telemetry status"],
38875
39053
  ["Disable telemetry", "hyperframes telemetry disable"],
38876
39054
  ["Enable telemetry", "hyperframes telemetry enable"]
@@ -38949,8 +39127,8 @@ var validate_exports = {};
38949
39127
  __export(validate_exports, {
38950
39128
  default: () => validate_default
38951
39129
  });
38952
- import { existsSync as existsSync44, readFileSync as readFileSync31 } from "fs";
38953
- import { resolve as resolve31, join as join44, dirname as dirname19 } from "path";
39130
+ import { existsSync as existsSync45, readFileSync as readFileSync32 } from "fs";
39131
+ import { resolve as resolve32, join as join46, dirname as dirname19 } from "path";
38954
39132
  import { fileURLToPath as fileURLToPath7 } from "url";
38955
39133
  async function getCompositionDuration2(page) {
38956
39134
  return page.evaluate(() => {
@@ -38996,7 +39174,7 @@ async function validateInBrowser(projectDir, opts) {
38996
39174
  const { bundleToSingleHtml: bundleToSingleHtml2 } = await Promise.resolve().then(() => (init_compiler(), compiler_exports));
38997
39175
  const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
38998
39176
  let html = await bundleToSingleHtml2(projectDir);
38999
- const runtimePath = resolve31(
39177
+ const runtimePath = resolve32(
39000
39178
  __dirname2,
39001
39179
  "..",
39002
39180
  "..",
@@ -39005,8 +39183,8 @@ async function validateInBrowser(projectDir, opts) {
39005
39183
  "dist",
39006
39184
  "hyperframe.runtime.iife.js"
39007
39185
  );
39008
- if (existsSync44(runtimePath)) {
39009
- const runtimeSource = readFileSync31(runtimePath, "utf-8");
39186
+ if (existsSync45(runtimePath)) {
39187
+ const runtimeSource = readFileSync32(runtimePath, "utf-8");
39010
39188
  html = html.replace(
39011
39189
  /<script[^>]*data-hyperframes-preview-runtime[^>]*src="[^"]*"[^>]*><\/script>/,
39012
39190
  () => `<script data-hyperframes-preview-runtime="1">${runtimeSource}</script>`
@@ -39021,10 +39199,10 @@ async function validateInBrowser(projectDir, opts) {
39021
39199
  res.end(html);
39022
39200
  return;
39023
39201
  }
39024
- const filePath = join44(projectDir, decodeURIComponent(url));
39025
- if (existsSync44(filePath)) {
39202
+ const filePath = join46(projectDir, decodeURIComponent(url));
39203
+ if (existsSync45(filePath)) {
39026
39204
  res.writeHead(200, { "Content-Type": getMimeType2(filePath) });
39027
- res.end(readFileSync31(filePath));
39205
+ res.end(readFileSync32(filePath));
39028
39206
  return;
39029
39207
  }
39030
39208
  res.writeHead(404);
@@ -39212,16 +39390,16 @@ Examples:
39212
39390
  var snapshot_exports = {};
39213
39391
  __export(snapshot_exports, {
39214
39392
  default: () => snapshot_default,
39215
- examples: () => examples18
39393
+ examples: () => examples19
39216
39394
  });
39217
39395
  import { spawn as spawn11 } from "child_process";
39218
- import { existsSync as existsSync45, mkdtempSync as mkdtempSync2, readFileSync as readFileSync32, mkdirSync as mkdirSync24, rmSync as rmSync9 } from "fs";
39396
+ import { existsSync as existsSync46, mkdtempSync as mkdtempSync2, readFileSync as readFileSync33, mkdirSync as mkdirSync24, rmSync as rmSync9 } from "fs";
39219
39397
  import { tmpdir as tmpdir4 } from "os";
39220
- import { resolve as resolve32, join as join45, dirname as dirname20, relative as relative4, isAbsolute as isAbsolute4 } from "path";
39398
+ import { resolve as resolve33, join as join47, dirname as dirname20, relative as relative5, isAbsolute as isAbsolute4 } from "path";
39221
39399
  import { fileURLToPath as fileURLToPath8 } from "url";
39222
39400
  async function extractVideoFrameToBuffer(videoPath, timeSeconds) {
39223
- const tmp = mkdtempSync2(join45(tmpdir4(), "hf-snapshot-frame-"));
39224
- const outPath = join45(tmp, "frame.png");
39401
+ const tmp = mkdtempSync2(join47(tmpdir4(), "hf-snapshot-frame-"));
39402
+ const outPath = join47(tmp, "frame.png");
39225
39403
  try {
39226
39404
  const result = await new Promise(
39227
39405
  (resolvePromise) => {
@@ -39259,8 +39437,8 @@ async function extractVideoFrameToBuffer(videoPath, timeSeconds) {
39259
39437
  });
39260
39438
  }
39261
39439
  );
39262
- if (result.code !== 0 || result.timedOut || !existsSync45(outPath)) return null;
39263
- return readFileSync32(outPath);
39440
+ if (result.code !== 0 || result.timedOut || !existsSync46(outPath)) return null;
39441
+ return readFileSync33(outPath);
39264
39442
  } finally {
39265
39443
  try {
39266
39444
  rmSync9(tmp, { recursive: true, force: true });
@@ -39273,7 +39451,7 @@ async function captureSnapshots(projectDir, opts) {
39273
39451
  const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
39274
39452
  const numFrames = opts.frames ?? 5;
39275
39453
  let html = await bundleToSingleHtml2(projectDir);
39276
- const runtimePath = resolve32(
39454
+ const runtimePath = resolve33(
39277
39455
  __dirname3,
39278
39456
  "..",
39279
39457
  "..",
@@ -39282,8 +39460,8 @@ async function captureSnapshots(projectDir, opts) {
39282
39460
  "dist",
39283
39461
  "hyperframe.runtime.iife.js"
39284
39462
  );
39285
- if (existsSync45(runtimePath)) {
39286
- const runtimeSource = readFileSync32(runtimePath, "utf-8");
39463
+ if (existsSync46(runtimePath)) {
39464
+ const runtimeSource = readFileSync33(runtimePath, "utf-8");
39287
39465
  html = html.replace(
39288
39466
  /<script[^>]*data-hyperframes-preview-runtime[^>]*src="[^"]*"[^>]*><\/script>/,
39289
39467
  () => `<script data-hyperframes-preview-runtime="1">${runtimeSource}</script>`
@@ -39298,16 +39476,16 @@ async function captureSnapshots(projectDir, opts) {
39298
39476
  res.end(html);
39299
39477
  return;
39300
39478
  }
39301
- const filePath = resolve32(projectDir, decodeURIComponent(url).replace(/^\//, ""));
39302
- const rel = relative4(projectDir, filePath);
39479
+ const filePath = resolve33(projectDir, decodeURIComponent(url).replace(/^\//, ""));
39480
+ const rel = relative5(projectDir, filePath);
39303
39481
  if (rel.startsWith("..") || isAbsolute4(rel)) {
39304
39482
  res.writeHead(403);
39305
39483
  res.end();
39306
39484
  return;
39307
39485
  }
39308
- if (existsSync45(filePath)) {
39486
+ if (existsSync46(filePath)) {
39309
39487
  res.writeHead(200, { "Content-Type": getMimeType2(filePath) });
39310
- res.end(readFileSync32(filePath));
39488
+ res.end(readFileSync33(filePath));
39311
39489
  return;
39312
39490
  }
39313
39491
  res.writeHead(404);
@@ -39380,7 +39558,7 @@ async function captureSnapshots(projectDir, opts) {
39380
39558
  return [];
39381
39559
  }
39382
39560
  const positions = opts.at?.length ? opts.at : numFrames === 1 ? [duration / 2] : Array.from({ length: numFrames }, (_2, i2) => i2 / (numFrames - 1) * duration);
39383
- const snapshotDir = join45(projectDir, "snapshots");
39561
+ const snapshotDir = join47(projectDir, "snapshots");
39384
39562
  mkdirSync24(snapshotDir, { recursive: true });
39385
39563
  let injectVideoFramesBatch2 = null;
39386
39564
  let syncVideoFrameVisibility2 = null;
@@ -39439,9 +39617,9 @@ async function captureSnapshots(projectDir, opts) {
39439
39617
  try {
39440
39618
  const url = new URL(v.src);
39441
39619
  const decodedPath = decodeURIComponent(url.pathname).replace(/^\//, "");
39442
- const candidate = resolve32(projectDir, decodedPath);
39443
- const rel = relative4(projectDir, candidate);
39444
- if (!rel.startsWith("..") && !isAbsolute4(rel) && existsSync45(candidate)) {
39620
+ const candidate = resolve33(projectDir, decodedPath);
39621
+ const rel = relative5(projectDir, candidate);
39622
+ if (!rel.startsWith("..") && !isAbsolute4(rel) && existsSync46(candidate)) {
39445
39623
  filePath = candidate;
39446
39624
  }
39447
39625
  } catch {
@@ -39467,7 +39645,7 @@ async function captureSnapshots(projectDir, opts) {
39467
39645
  }
39468
39646
  const timeLabel = opts.at?.length ? `${time.toFixed(1)}s` : `${Math.round(time / duration * 100)}pct`;
39469
39647
  const filename = `frame-${String(i2).padStart(2, "0")}-at-${timeLabel}.png`;
39470
- const framePath = join45(snapshotDir, filename);
39648
+ const framePath = join47(snapshotDir, filename);
39471
39649
  await page.screenshot({ path: framePath, type: "png" });
39472
39650
  savedPaths.push(`snapshots/${filename}`);
39473
39651
  }
@@ -39479,7 +39657,7 @@ async function captureSnapshots(projectDir, opts) {
39479
39657
  }
39480
39658
  return savedPaths;
39481
39659
  }
39482
- var __filename2, __dirname3, FFMPEG_EXTRACT_TIMEOUT_MS, examples18, snapshot_default;
39660
+ var __filename2, __dirname3, FFMPEG_EXTRACT_TIMEOUT_MS, examples19, snapshot_default;
39483
39661
  var init_snapshot = __esm({
39484
39662
  "src/commands/snapshot.ts"() {
39485
39663
  "use strict";
@@ -39489,7 +39667,7 @@ var init_snapshot = __esm({
39489
39667
  __filename2 = fileURLToPath8(import.meta.url);
39490
39668
  __dirname3 = dirname20(__filename2);
39491
39669
  FFMPEG_EXTRACT_TIMEOUT_MS = 3e4;
39492
- examples18 = [
39670
+ examples19 = [
39493
39671
  ["Capture 5 key frames from a composition", "snapshot captures/stripe"],
39494
39672
  ["Capture 10 evenly-spaced frames", "snapshot captures/stripe --frames 10"]
39495
39673
  ];
@@ -39553,13 +39731,13 @@ ${c.error("\u2717")} Snapshot failed: ${msg}`);
39553
39731
 
39554
39732
  // src/capture/assetDownloader.ts
39555
39733
  import { writeFileSync as writeFileSync17, mkdirSync as mkdirSync25 } from "fs";
39556
- import { join as join46, extname as extname10 } from "path";
39734
+ import { join as join48, extname as extname10 } from "path";
39557
39735
  async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks) {
39558
- const assetsDir = join46(outputDir, "assets");
39736
+ const assetsDir = join48(outputDir, "assets");
39559
39737
  mkdirSync25(assetsDir, { recursive: true });
39560
39738
  const assets = [];
39561
39739
  const downloadedUrls = /* @__PURE__ */ new Set();
39562
- mkdirSync25(join46(outputDir, "assets", "svgs"), { recursive: true });
39740
+ mkdirSync25(join48(outputDir, "assets", "svgs"), { recursive: true });
39563
39741
  for (let i2 = 0; i2 < tokens.svgs.length && i2 < 30; i2++) {
39564
39742
  const svg = tokens.svgs[i2];
39565
39743
  if (!svg.outerHTML || svg.outerHTML.length < 50) continue;
@@ -39567,7 +39745,7 @@ async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks)
39567
39745
  const name = label2 ? slugify(label2) + ".svg" : svg.isLogo ? `logo-${i2}.svg` : `icon-${i2}.svg`;
39568
39746
  const localPath = `assets/svgs/${name}`;
39569
39747
  try {
39570
- writeFileSync17(join46(outputDir, localPath), svg.outerHTML, "utf-8");
39748
+ writeFileSync17(join48(outputDir, localPath), svg.outerHTML, "utf-8");
39571
39749
  assets.push({ url: "", localPath, type: "svg" });
39572
39750
  } catch {
39573
39751
  }
@@ -39580,7 +39758,7 @@ async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks)
39580
39758
  const localPath = `assets/${name}`;
39581
39759
  const buffer = await fetchBuffer(icon.href);
39582
39760
  if (buffer) {
39583
- writeFileSync17(join46(outputDir, localPath), buffer);
39761
+ writeFileSync17(join48(outputDir, localPath), buffer);
39584
39762
  assets.push({ url: icon.href, localPath, type: "favicon" });
39585
39763
  break;
39586
39764
  }
@@ -39637,7 +39815,7 @@ async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks)
39637
39815
  const slug = isMeaningful ? slugify(rawName) : `${prefix}-${imgIdx}`;
39638
39816
  const name = `${slug}${ext}`;
39639
39817
  const localPath = `assets/${name}`;
39640
- writeFileSync17(join46(outputDir, localPath), buffer);
39818
+ writeFileSync17(join48(outputDir, localPath), buffer);
39641
39819
  assets.push({ url, localPath, type: "image" });
39642
39820
  imgIdx++;
39643
39821
  } catch {
@@ -39650,7 +39828,7 @@ async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks)
39650
39828
  const localPath = `assets/og-image${ext}`;
39651
39829
  const buffer = await fetchBuffer(tokens.ogImage);
39652
39830
  if (buffer && buffer.length > 5e3) {
39653
- writeFileSync17(join46(outputDir, localPath), buffer);
39831
+ writeFileSync17(join48(outputDir, localPath), buffer);
39654
39832
  assets.push({ url: tokens.ogImage, localPath, type: "image" });
39655
39833
  }
39656
39834
  } catch {
@@ -39673,7 +39851,7 @@ function normalizeUrl(u) {
39673
39851
  }
39674
39852
  }
39675
39853
  async function downloadAndRewriteFonts(css, outputDir) {
39676
- const assetsDir = join46(outputDir, "assets", "fonts");
39854
+ const assetsDir = join48(outputDir, "assets", "fonts");
39677
39855
  mkdirSync25(assetsDir, { recursive: true });
39678
39856
  const fontUrlRegex = /url\(['"]?(https?:\/\/[^'")\s]+\.(?:woff2?|ttf|otf)[^'")\s]*?)['"]?\)/g;
39679
39857
  const fontUrls = /* @__PURE__ */ new Set();
@@ -39709,7 +39887,7 @@ async function downloadAndRewriteFonts(css, outputDir) {
39709
39887
  try {
39710
39888
  const urlObj = new URL(fontUrl);
39711
39889
  const filename = urlObj.pathname.split("/").pop() || `font-${count}.woff2`;
39712
- const localPath = join46(assetsDir, filename);
39890
+ const localPath = join48(assetsDir, filename);
39713
39891
  const relativePath = `assets/fonts/${filename}`;
39714
39892
  const buffer = await fetchBuffer(fontUrl);
39715
39893
  if (buffer) {
@@ -40506,8 +40684,8 @@ var init_animationCataloger = __esm({
40506
40684
  });
40507
40685
 
40508
40686
  // src/capture/mediaCapture.ts
40509
- import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync18, readdirSync as readdirSync15, readFileSync as readFileSync33, statSync as statSync15 } from "fs";
40510
- import { join as join47 } from "path";
40687
+ import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync18, readdirSync as readdirSync16, readFileSync as readFileSync34, statSync as statSync16 } from "fs";
40688
+ import { join as join49 } from "path";
40511
40689
  async function saveLottieAnimations(discoveredLotties, lottieDir) {
40512
40690
  let savedCount = 0;
40513
40691
  const savedHashes = /* @__PURE__ */ new Set();
@@ -40527,8 +40705,8 @@ async function saveLottieAnimations(discoveredLotties, lottieDir) {
40527
40705
  const buf = Buffer.from(await res.arrayBuffer());
40528
40706
  if (lottieItem.url.endsWith(".lottie")) {
40529
40707
  try {
40530
- const AdmZip = (await import("adm-zip")).default;
40531
- const zip = new AdmZip(buf);
40708
+ const AdmZip2 = (await import("adm-zip")).default;
40709
+ const zip = new AdmZip2(buf);
40532
40710
  const entries2 = zip.getEntries();
40533
40711
  const animEntry = entries2.find(
40534
40712
  (e2) => (e2.entryName.startsWith("a/") || e2.entryName.startsWith("animations/")) && e2.entryName.endsWith(".json")
@@ -40540,7 +40718,7 @@ async function saveLottieAnimations(discoveredLotties, lottieDir) {
40540
40718
  const hash2 = buf.toString("base64").slice(0, 100);
40541
40719
  if (savedHashes.has(hash2)) continue;
40542
40720
  savedHashes.add(hash2);
40543
- writeFileSync18(join47(lottieDir, `animation-${savedCount}.lottie`), buf);
40721
+ writeFileSync18(join49(lottieDir, `animation-${savedCount}.lottie`), buf);
40544
40722
  savedCount++;
40545
40723
  continue;
40546
40724
  }
@@ -40558,7 +40736,7 @@ async function saveLottieAnimations(discoveredLotties, lottieDir) {
40558
40736
  } catch {
40559
40737
  continue;
40560
40738
  }
40561
- writeFileSync18(join47(lottieDir, `animation-${savedCount}.json`), jsonData, "utf-8");
40739
+ writeFileSync18(join49(lottieDir, `animation-${savedCount}.json`), jsonData, "utf-8");
40562
40740
  savedCount++;
40563
40741
  }
40564
40742
  } catch {
@@ -40568,22 +40746,22 @@ async function saveLottieAnimations(discoveredLotties, lottieDir) {
40568
40746
  }
40569
40747
  async function renderLottiePreviews(chromeBrowser, lottieDir, outputDir) {
40570
40748
  const manifest = [];
40571
- const previewDir = join47(lottieDir, "previews");
40749
+ const previewDir = join49(lottieDir, "previews");
40572
40750
  mkdirSync26(previewDir, { recursive: true });
40573
- for (const file of readdirSync15(lottieDir)) {
40751
+ for (const file of readdirSync16(lottieDir)) {
40574
40752
  if (!file.endsWith(".json")) continue;
40575
40753
  try {
40576
- const raw = JSON.parse(readFileSync33(join47(lottieDir, file), "utf-8"));
40754
+ const raw = JSON.parse(readFileSync34(join49(lottieDir, file), "utf-8"));
40577
40755
  const fr = raw.fr || 30;
40578
40756
  const dur = ((raw.op || 0) - (raw.ip || 0)) / fr;
40579
40757
  const previewName = file.replace(".json", "-preview.png");
40580
- const fileSize = statSync15(join47(lottieDir, file)).size;
40758
+ const fileSize = statSync16(join49(lottieDir, file)).size;
40581
40759
  if (fileSize > 2e6) continue;
40582
40760
  let previewPage;
40583
40761
  try {
40584
40762
  previewPage = await chromeBrowser.newPage();
40585
40763
  await previewPage.setViewport({ width: 400, height: 400 });
40586
- const animData = JSON.parse(readFileSync33(join47(lottieDir, file), "utf-8"));
40764
+ const animData = JSON.parse(readFileSync34(join49(lottieDir, file), "utf-8"));
40587
40765
  const midFrame = Math.floor(((raw.op || 0) - (raw.ip || 0)) * 0.3);
40588
40766
  await previewPage.setContent(
40589
40767
  `<!DOCTYPE html>
@@ -40613,7 +40791,7 @@ async function renderLottiePreviews(chromeBrowser, lottieDir, outputDir) {
40613
40791
  await previewPage.waitForFunction(() => window.__READY === true, { timeout: 5e3 }).catch(() => {
40614
40792
  });
40615
40793
  await previewPage.screenshot({
40616
- path: join47(previewDir, previewName),
40794
+ path: join49(previewDir, previewName),
40617
40795
  type: "png",
40618
40796
  omitBackground: true
40619
40797
  });
@@ -40637,7 +40815,7 @@ async function renderLottiePreviews(chromeBrowser, lottieDir, outputDir) {
40637
40815
  }
40638
40816
  if (manifest.length > 0) {
40639
40817
  writeFileSync18(
40640
- join47(outputDir, "extracted", "lottie-manifest.json"),
40818
+ join49(outputDir, "extracted", "lottie-manifest.json"),
40641
40819
  JSON.stringify(manifest, null, 2),
40642
40820
  "utf-8"
40643
40821
  );
@@ -40699,15 +40877,15 @@ async function captureVideoManifest(page, outputDir, progress) {
40699
40877
  return true;
40700
40878
  });
40701
40879
  if (uniqueVideos.length > 0) {
40702
- const videoManifestDir = join47(outputDir, "assets", "videos");
40880
+ const videoManifestDir = join49(outputDir, "assets", "videos");
40703
40881
  mkdirSync26(videoManifestDir, { recursive: true });
40704
- const previewDir = join47(videoManifestDir, "previews");
40882
+ const previewDir = join49(videoManifestDir, "previews");
40705
40883
  mkdirSync26(previewDir, { recursive: true });
40706
40884
  const videoManifest = [];
40707
40885
  for (let vi = 0; vi < uniqueVideos.length && vi < 20; vi++) {
40708
40886
  const v = uniqueVideos[vi];
40709
40887
  const previewName = `video-${vi}-preview.png`;
40710
- const previewPath = join47(previewDir, previewName);
40888
+ const previewPath = join49(previewDir, previewName);
40711
40889
  try {
40712
40890
  await page.evaluate(`window.scrollTo(0, ${Math.max(0, v.top - 100)})`);
40713
40891
  await new Promise((r2) => setTimeout(r2, 300));
@@ -40746,7 +40924,7 @@ async function captureVideoManifest(page, outputDir, progress) {
40746
40924
  }
40747
40925
  if (videoManifest.length > 0) {
40748
40926
  writeFileSync18(
40749
- join47(outputDir, "extracted", "video-manifest.json"),
40927
+ join49(outputDir, "extracted", "video-manifest.json"),
40750
40928
  JSON.stringify(videoManifest, null, 2),
40751
40929
  "utf-8"
40752
40930
  );
@@ -41028,7 +41206,7 @@ var require_p_retry = __commonJS({
41028
41206
  return error;
41029
41207
  };
41030
41208
  var isNetworkError = (errorMessage) => networkErrorMsgs.includes(errorMessage);
41031
- var pRetry2 = (input, options) => new Promise((resolve35, reject) => {
41209
+ var pRetry2 = (input, options) => new Promise((resolve36, reject) => {
41032
41210
  options = {
41033
41211
  onFailedAttempt: () => {
41034
41212
  },
@@ -41038,7 +41216,7 @@ var require_p_retry = __commonJS({
41038
41216
  const operation = retry.operation(options);
41039
41217
  operation.attempt(async (attemptNumber) => {
41040
41218
  try {
41041
- resolve35(await input(attemptNumber));
41219
+ resolve36(await input(attemptNumber));
41042
41220
  } catch (error) {
41043
41221
  if (!(error instanceof Error)) {
41044
41222
  reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
@@ -41574,8 +41752,8 @@ var require_retry3 = __commonJS({
41574
41752
  }
41575
41753
  const delay = getNextRetryDelay(config);
41576
41754
  err.config.retryConfig.currentRetryAttempt += 1;
41577
- const backoff = config.retryBackoff ? config.retryBackoff(err, delay) : new Promise((resolve35) => {
41578
- setTimeout(resolve35, delay);
41755
+ const backoff = config.retryBackoff ? config.retryBackoff(err, delay) : new Promise((resolve36) => {
41756
+ setTimeout(resolve36, delay);
41579
41757
  });
41580
41758
  if (config.onRetryAttempt) {
41581
41759
  await config.onRetryAttempt(err);
@@ -42483,8 +42661,8 @@ var require_helpers = __commonJS({
42483
42661
  function req(url, opts = {}) {
42484
42662
  const href = typeof url === "string" ? url : url.href;
42485
42663
  const req2 = (href.startsWith("https:") ? https2 : http4).request(url, opts);
42486
- const promise = new Promise((resolve35, reject) => {
42487
- req2.once("response", resolve35).once("error", reject).end();
42664
+ const promise = new Promise((resolve36, reject) => {
42665
+ req2.once("response", resolve36).once("error", reject).end();
42488
42666
  });
42489
42667
  req2.then = promise.then.bind(promise);
42490
42668
  return req2;
@@ -42661,7 +42839,7 @@ var require_parse_proxy_response = __commonJS({
42661
42839
  var debug_1 = __importDefault(require_src2());
42662
42840
  var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
42663
42841
  function parseProxyResponse(socket) {
42664
- return new Promise((resolve35, reject) => {
42842
+ return new Promise((resolve36, reject) => {
42665
42843
  let buffersLength = 0;
42666
42844
  const buffers = [];
42667
42845
  function read() {
@@ -42727,7 +42905,7 @@ var require_parse_proxy_response = __commonJS({
42727
42905
  }
42728
42906
  debug("got proxy server response: %o %o", firstLine, headers);
42729
42907
  cleanup();
42730
- resolve35({
42908
+ resolve36({
42731
42909
  connect: {
42732
42910
  statusCode,
42733
42911
  statusText,
@@ -42971,7 +43149,7 @@ var require_ponyfill_es2018 = __commonJS({
42971
43149
  return new originalPromise(executor);
42972
43150
  }
42973
43151
  function promiseResolvedWith(value) {
42974
- return newPromise((resolve35) => resolve35(value));
43152
+ return newPromise((resolve36) => resolve36(value));
42975
43153
  }
42976
43154
  function promiseRejectedWith(reason) {
42977
43155
  return originalPromiseReject(reason);
@@ -43141,8 +43319,8 @@ var require_ponyfill_es2018 = __commonJS({
43141
43319
  return new TypeError("Cannot " + name + " a stream using a released reader");
43142
43320
  }
43143
43321
  function defaultReaderClosedPromiseInitialize(reader) {
43144
- reader._closedPromise = newPromise((resolve35, reject) => {
43145
- reader._closedPromise_resolve = resolve35;
43322
+ reader._closedPromise = newPromise((resolve36, reject) => {
43323
+ reader._closedPromise_resolve = resolve36;
43146
43324
  reader._closedPromise_reject = reject;
43147
43325
  });
43148
43326
  }
@@ -43316,8 +43494,8 @@ var require_ponyfill_es2018 = __commonJS({
43316
43494
  }
43317
43495
  let resolvePromise;
43318
43496
  let rejectPromise;
43319
- const promise = newPromise((resolve35, reject) => {
43320
- resolvePromise = resolve35;
43497
+ const promise = newPromise((resolve36, reject) => {
43498
+ resolvePromise = resolve36;
43321
43499
  rejectPromise = reject;
43322
43500
  });
43323
43501
  const readRequest = {
@@ -43422,8 +43600,8 @@ var require_ponyfill_es2018 = __commonJS({
43422
43600
  const reader = this._reader;
43423
43601
  let resolvePromise;
43424
43602
  let rejectPromise;
43425
- const promise = newPromise((resolve35, reject) => {
43426
- resolvePromise = resolve35;
43603
+ const promise = newPromise((resolve36, reject) => {
43604
+ resolvePromise = resolve36;
43427
43605
  rejectPromise = reject;
43428
43606
  });
43429
43607
  const readRequest = {
@@ -44442,8 +44620,8 @@ var require_ponyfill_es2018 = __commonJS({
44442
44620
  }
44443
44621
  let resolvePromise;
44444
44622
  let rejectPromise;
44445
- const promise = newPromise((resolve35, reject) => {
44446
- resolvePromise = resolve35;
44623
+ const promise = newPromise((resolve36, reject) => {
44624
+ resolvePromise = resolve36;
44447
44625
  rejectPromise = reject;
44448
44626
  });
44449
44627
  const readIntoRequest = {
@@ -44755,10 +44933,10 @@ var require_ponyfill_es2018 = __commonJS({
44755
44933
  wasAlreadyErroring = true;
44756
44934
  reason = void 0;
44757
44935
  }
44758
- const promise = newPromise((resolve35, reject) => {
44936
+ const promise = newPromise((resolve36, reject) => {
44759
44937
  stream._pendingAbortRequest = {
44760
44938
  _promise: void 0,
44761
- _resolve: resolve35,
44939
+ _resolve: resolve36,
44762
44940
  _reject: reject,
44763
44941
  _reason: reason,
44764
44942
  _wasAlreadyErroring: wasAlreadyErroring
@@ -44775,9 +44953,9 @@ var require_ponyfill_es2018 = __commonJS({
44775
44953
  if (state === "closed" || state === "errored") {
44776
44954
  return promiseRejectedWith(new TypeError(`The stream (in ${state} state) is not in the writable state and cannot be closed`));
44777
44955
  }
44778
- const promise = newPromise((resolve35, reject) => {
44956
+ const promise = newPromise((resolve36, reject) => {
44779
44957
  const closeRequest = {
44780
- _resolve: resolve35,
44958
+ _resolve: resolve36,
44781
44959
  _reject: reject
44782
44960
  };
44783
44961
  stream._closeRequest = closeRequest;
@@ -44790,9 +44968,9 @@ var require_ponyfill_es2018 = __commonJS({
44790
44968
  return promise;
44791
44969
  }
44792
44970
  function WritableStreamAddWriteRequest(stream) {
44793
- const promise = newPromise((resolve35, reject) => {
44971
+ const promise = newPromise((resolve36, reject) => {
44794
44972
  const writeRequest = {
44795
- _resolve: resolve35,
44973
+ _resolve: resolve36,
44796
44974
  _reject: reject
44797
44975
  };
44798
44976
  stream._writeRequests.push(writeRequest);
@@ -45408,8 +45586,8 @@ var require_ponyfill_es2018 = __commonJS({
45408
45586
  return new TypeError("Cannot " + name + " a stream using a released writer");
45409
45587
  }
45410
45588
  function defaultWriterClosedPromiseInitialize(writer) {
45411
- writer._closedPromise = newPromise((resolve35, reject) => {
45412
- writer._closedPromise_resolve = resolve35;
45589
+ writer._closedPromise = newPromise((resolve36, reject) => {
45590
+ writer._closedPromise_resolve = resolve36;
45413
45591
  writer._closedPromise_reject = reject;
45414
45592
  writer._closedPromiseState = "pending";
45415
45593
  });
@@ -45445,8 +45623,8 @@ var require_ponyfill_es2018 = __commonJS({
45445
45623
  writer._closedPromiseState = "resolved";
45446
45624
  }
45447
45625
  function defaultWriterReadyPromiseInitialize(writer) {
45448
- writer._readyPromise = newPromise((resolve35, reject) => {
45449
- writer._readyPromise_resolve = resolve35;
45626
+ writer._readyPromise = newPromise((resolve36, reject) => {
45627
+ writer._readyPromise_resolve = resolve36;
45450
45628
  writer._readyPromise_reject = reject;
45451
45629
  });
45452
45630
  writer._readyPromiseState = "pending";
@@ -45533,7 +45711,7 @@ var require_ponyfill_es2018 = __commonJS({
45533
45711
  source._disturbed = true;
45534
45712
  let shuttingDown = false;
45535
45713
  let currentWrite = promiseResolvedWith(void 0);
45536
- return newPromise((resolve35, reject) => {
45714
+ return newPromise((resolve36, reject) => {
45537
45715
  let abortAlgorithm;
45538
45716
  if (signal !== void 0) {
45539
45717
  abortAlgorithm = () => {
@@ -45678,7 +45856,7 @@ var require_ponyfill_es2018 = __commonJS({
45678
45856
  if (isError) {
45679
45857
  reject(error);
45680
45858
  } else {
45681
- resolve35(void 0);
45859
+ resolve36(void 0);
45682
45860
  }
45683
45861
  return null;
45684
45862
  }
@@ -45959,8 +46137,8 @@ var require_ponyfill_es2018 = __commonJS({
45959
46137
  let branch1;
45960
46138
  let branch2;
45961
46139
  let resolveCancelPromise;
45962
- const cancelPromise = newPromise((resolve35) => {
45963
- resolveCancelPromise = resolve35;
46140
+ const cancelPromise = newPromise((resolve36) => {
46141
+ resolveCancelPromise = resolve36;
45964
46142
  });
45965
46143
  function pullAlgorithm() {
45966
46144
  if (reading) {
@@ -46051,8 +46229,8 @@ var require_ponyfill_es2018 = __commonJS({
46051
46229
  let branch1;
46052
46230
  let branch2;
46053
46231
  let resolveCancelPromise;
46054
- const cancelPromise = newPromise((resolve35) => {
46055
- resolveCancelPromise = resolve35;
46232
+ const cancelPromise = newPromise((resolve36) => {
46233
+ resolveCancelPromise = resolve36;
46056
46234
  });
46057
46235
  function forwardReaderError(thisReader) {
46058
46236
  uponRejection(thisReader._closedPromise, (r2) => {
@@ -46832,8 +47010,8 @@ var require_ponyfill_es2018 = __commonJS({
46832
47010
  const writableHighWaterMark = ExtractHighWaterMark(writableStrategy, 1);
46833
47011
  const writableSizeAlgorithm = ExtractSizeAlgorithm(writableStrategy);
46834
47012
  let startPromise_resolve;
46835
- const startPromise = newPromise((resolve35) => {
46836
- startPromise_resolve = resolve35;
47013
+ const startPromise = newPromise((resolve36) => {
47014
+ startPromise_resolve = resolve36;
46837
47015
  });
46838
47016
  InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
46839
47017
  SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);
@@ -46926,8 +47104,8 @@ var require_ponyfill_es2018 = __commonJS({
46926
47104
  if (stream._backpressureChangePromise !== void 0) {
46927
47105
  stream._backpressureChangePromise_resolve();
46928
47106
  }
46929
- stream._backpressureChangePromise = newPromise((resolve35) => {
46930
- stream._backpressureChangePromise_resolve = resolve35;
47107
+ stream._backpressureChangePromise = newPromise((resolve36) => {
47108
+ stream._backpressureChangePromise_resolve = resolve36;
46931
47109
  });
46932
47110
  stream._backpressure = backpressure;
46933
47111
  }
@@ -47095,8 +47273,8 @@ var require_ponyfill_es2018 = __commonJS({
47095
47273
  return controller._finishPromise;
47096
47274
  }
47097
47275
  const readable = stream._readable;
47098
- controller._finishPromise = newPromise((resolve35, reject) => {
47099
- controller._finishPromise_resolve = resolve35;
47276
+ controller._finishPromise = newPromise((resolve36, reject) => {
47277
+ controller._finishPromise_resolve = resolve36;
47100
47278
  controller._finishPromise_reject = reject;
47101
47279
  });
47102
47280
  const cancelPromise = controller._cancelAlgorithm(reason);
@@ -47122,8 +47300,8 @@ var require_ponyfill_es2018 = __commonJS({
47122
47300
  return controller._finishPromise;
47123
47301
  }
47124
47302
  const readable = stream._readable;
47125
- controller._finishPromise = newPromise((resolve35, reject) => {
47126
- controller._finishPromise_resolve = resolve35;
47303
+ controller._finishPromise = newPromise((resolve36, reject) => {
47304
+ controller._finishPromise_resolve = resolve36;
47127
47305
  controller._finishPromise_reject = reject;
47128
47306
  });
47129
47307
  const flushPromise = controller._flushAlgorithm();
@@ -47153,8 +47331,8 @@ var require_ponyfill_es2018 = __commonJS({
47153
47331
  return controller._finishPromise;
47154
47332
  }
47155
47333
  const writable = stream._writable;
47156
- controller._finishPromise = newPromise((resolve35, reject) => {
47157
- controller._finishPromise_resolve = resolve35;
47334
+ controller._finishPromise = newPromise((resolve36, reject) => {
47335
+ controller._finishPromise_resolve = resolve36;
47158
47336
  controller._finishPromise_reject = reject;
47159
47337
  });
47160
47338
  const cancelPromise = controller._cancelAlgorithm(reason);
@@ -47700,8 +47878,8 @@ var require_node_domexception = __commonJS({
47700
47878
  });
47701
47879
 
47702
47880
  // ../../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/from.js
47703
- import { statSync as statSync16, createReadStream as createReadStream2, promises as fs2 } from "fs";
47704
- import { basename as basename8 } from "path";
47881
+ import { statSync as statSync17, createReadStream as createReadStream2, promises as fs2 } from "fs";
47882
+ import { basename as basename10 } from "path";
47705
47883
  var import_node_domexception, stat, blobFromSync, blobFrom, fileFrom, fileFromSync, fromBlob, fromFile, BlobDataItem;
47706
47884
  var init_from = __esm({
47707
47885
  "../../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/from.js"() {
@@ -47710,10 +47888,10 @@ var init_from = __esm({
47710
47888
  init_file();
47711
47889
  init_fetch_blob();
47712
47890
  ({ stat } = fs2);
47713
- blobFromSync = (path2, type) => fromBlob(statSync16(path2), path2, type);
47891
+ blobFromSync = (path2, type) => fromBlob(statSync17(path2), path2, type);
47714
47892
  blobFrom = (path2, type) => stat(path2).then((stat3) => fromBlob(stat3, path2, type));
47715
47893
  fileFrom = (path2, type) => stat(path2).then((stat3) => fromFile(stat3, path2, type));
47716
- fileFromSync = (path2, type) => fromFile(statSync16(path2), path2, type);
47894
+ fileFromSync = (path2, type) => fromFile(statSync17(path2), path2, type);
47717
47895
  fromBlob = (stat3, path2, type = "") => new fetch_blob_default([new BlobDataItem({
47718
47896
  path: path2,
47719
47897
  size: stat3.size,
@@ -47725,7 +47903,7 @@ var init_from = __esm({
47725
47903
  size: stat3.size,
47726
47904
  lastModified: stat3.mtimeMs,
47727
47905
  start: 0
47728
- })], basename8(path2), { type, lastModified: stat3.mtimeMs });
47906
+ })], basename10(path2), { type, lastModified: stat3.mtimeMs });
47729
47907
  BlobDataItem = class _BlobDataItem {
47730
47908
  #path;
47731
47909
  #start;
@@ -49123,7 +49301,7 @@ import zlib from "zlib";
49123
49301
  import Stream2, { PassThrough as PassThrough2, pipeline as pump } from "stream";
49124
49302
  import { Buffer as Buffer3 } from "buffer";
49125
49303
  async function fetch3(url, options_) {
49126
- return new Promise((resolve35, reject) => {
49304
+ return new Promise((resolve36, reject) => {
49127
49305
  const request = new Request2(url, options_);
49128
49306
  const { parsedURL, options } = getNodeRequestOptions(request);
49129
49307
  if (!supportedSchemas.has(parsedURL.protocol)) {
@@ -49132,7 +49310,7 @@ async function fetch3(url, options_) {
49132
49310
  if (parsedURL.protocol === "data:") {
49133
49311
  const data = dist_default(request.url);
49134
49312
  const response2 = new Response2(data, { headers: { "Content-Type": data.typeFull } });
49135
- resolve35(response2);
49313
+ resolve36(response2);
49136
49314
  return;
49137
49315
  }
49138
49316
  const send = (parsedURL.protocol === "https:" ? https : http3).request;
@@ -49254,7 +49432,7 @@ async function fetch3(url, options_) {
49254
49432
  if (responseReferrerPolicy) {
49255
49433
  requestOptions.referrerPolicy = responseReferrerPolicy;
49256
49434
  }
49257
- resolve35(fetch3(new Request2(locationURL, requestOptions)));
49435
+ resolve36(fetch3(new Request2(locationURL, requestOptions)));
49258
49436
  finalize();
49259
49437
  return;
49260
49438
  }
@@ -49287,7 +49465,7 @@ async function fetch3(url, options_) {
49287
49465
  const codings = headers.get("Content-Encoding");
49288
49466
  if (!request.compress || request.method === "HEAD" || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {
49289
49467
  response = new Response2(body, responseOptions);
49290
- resolve35(response);
49468
+ resolve36(response);
49291
49469
  return;
49292
49470
  }
49293
49471
  const zlibOptions = {
@@ -49301,7 +49479,7 @@ async function fetch3(url, options_) {
49301
49479
  }
49302
49480
  });
49303
49481
  response = new Response2(body, responseOptions);
49304
- resolve35(response);
49482
+ resolve36(response);
49305
49483
  return;
49306
49484
  }
49307
49485
  if (codings === "deflate" || codings === "x-deflate") {
@@ -49325,12 +49503,12 @@ async function fetch3(url, options_) {
49325
49503
  });
49326
49504
  }
49327
49505
  response = new Response2(body, responseOptions);
49328
- resolve35(response);
49506
+ resolve36(response);
49329
49507
  });
49330
49508
  raw.once("end", () => {
49331
49509
  if (!response) {
49332
49510
  response = new Response2(body, responseOptions);
49333
- resolve35(response);
49511
+ resolve36(response);
49334
49512
  }
49335
49513
  });
49336
49514
  return;
@@ -49342,11 +49520,11 @@ async function fetch3(url, options_) {
49342
49520
  }
49343
49521
  });
49344
49522
  response = new Response2(body, responseOptions);
49345
- resolve35(response);
49523
+ resolve36(response);
49346
49524
  return;
49347
49525
  }
49348
49526
  response = new Response2(body, responseOptions);
49349
- resolve35(response);
49527
+ resolve36(response);
49350
49528
  });
49351
49529
  writeToStream(request_, request).catch(reject);
49352
49530
  });
@@ -55428,7 +55606,7 @@ var require_jwtaccess = __commonJS({
55428
55606
  }
55429
55607
  }
55430
55608
  fromStreamAsync(inputStream) {
55431
- return new Promise((resolve35, reject) => {
55609
+ return new Promise((resolve36, reject) => {
55432
55610
  if (!inputStream) {
55433
55611
  reject(new Error("Must pass in a stream containing the service account auth settings."));
55434
55612
  }
@@ -55437,7 +55615,7 @@ var require_jwtaccess = __commonJS({
55437
55615
  try {
55438
55616
  const data = JSON.parse(s2);
55439
55617
  this.fromJSON(data);
55440
- resolve35();
55618
+ resolve36();
55441
55619
  } catch (err) {
55442
55620
  reject(err);
55443
55621
  }
@@ -55676,7 +55854,7 @@ var require_jwtclient = __commonJS({
55676
55854
  }
55677
55855
  }
55678
55856
  fromStreamAsync(inputStream) {
55679
- return new Promise((resolve35, reject) => {
55857
+ return new Promise((resolve36, reject) => {
55680
55858
  if (!inputStream) {
55681
55859
  throw new Error("Must pass in a stream containing the service account auth settings.");
55682
55860
  }
@@ -55685,7 +55863,7 @@ var require_jwtclient = __commonJS({
55685
55863
  try {
55686
55864
  const data = JSON.parse(s2);
55687
55865
  this.fromJSON(data);
55688
- resolve35();
55866
+ resolve36();
55689
55867
  } catch (e2) {
55690
55868
  reject(e2);
55691
55869
  }
@@ -55818,7 +55996,7 @@ var require_refreshclient = __commonJS({
55818
55996
  }
55819
55997
  }
55820
55998
  async fromStreamAsync(inputStream) {
55821
- return new Promise((resolve35, reject) => {
55999
+ return new Promise((resolve36, reject) => {
55822
56000
  if (!inputStream) {
55823
56001
  return reject(new Error("Must pass in a stream containing the user refresh token."));
55824
56002
  }
@@ -55827,7 +56005,7 @@ var require_refreshclient = __commonJS({
55827
56005
  try {
55828
56006
  const data = JSON.parse(s2);
55829
56007
  this.fromJSON(data);
55830
- return resolve35();
56008
+ return resolve36();
55831
56009
  } catch (err) {
55832
56010
  return reject(err);
55833
56011
  }
@@ -57660,7 +57838,7 @@ var require_pluggable_auth_handler = __commonJS({
57660
57838
  * @return A promise that resolves with the executable response.
57661
57839
  */
57662
57840
  retrieveResponseFromExecutable(envMap) {
57663
- return new Promise((resolve35, reject) => {
57841
+ return new Promise((resolve36, reject) => {
57664
57842
  const child = childProcess.spawn(this.commandComponents[0], this.commandComponents.slice(1), {
57665
57843
  env: { ...process.env, ...Object.fromEntries(envMap) }
57666
57844
  });
@@ -57682,7 +57860,7 @@ var require_pluggable_auth_handler = __commonJS({
57682
57860
  try {
57683
57861
  const responseJson = JSON.parse(output);
57684
57862
  const response = new executable_response_1.ExecutableResponse(responseJson);
57685
- return resolve35(response);
57863
+ return resolve36(response);
57686
57864
  } catch (error) {
57687
57865
  if (error instanceof executable_response_1.ExecutableResponseError) {
57688
57866
  return reject(error);
@@ -58585,7 +58763,7 @@ var require_googleauth = __commonJS({
58585
58763
  }
58586
58764
  }
58587
58765
  fromStreamAsync(inputStream, options) {
58588
- return new Promise((resolve35, reject) => {
58766
+ return new Promise((resolve36, reject) => {
58589
58767
  if (!inputStream) {
58590
58768
  throw new Error("Must pass in a stream containing the Google auth settings.");
58591
58769
  }
@@ -58595,7 +58773,7 @@ var require_googleauth = __commonJS({
58595
58773
  try {
58596
58774
  const data = JSON.parse(chunks.join(""));
58597
58775
  const r2 = this._cacheClientFromJSON(data, options);
58598
- return resolve35(r2);
58776
+ return resolve36(r2);
58599
58777
  } catch (err) {
58600
58778
  if (!this.keyFilename)
58601
58779
  throw err;
@@ -58605,7 +58783,7 @@ var require_googleauth = __commonJS({
58605
58783
  });
58606
58784
  this.cachedCredential = client;
58607
58785
  this.setGapicJWTValues(client);
58608
- return resolve35(client);
58786
+ return resolve36(client);
58609
58787
  }
58610
58788
  } catch (err) {
58611
58789
  return reject(err);
@@ -58641,17 +58819,17 @@ var require_googleauth = __commonJS({
58641
58819
  * Run the Google Cloud SDK command that prints the default project ID
58642
58820
  */
58643
58821
  async getDefaultServiceProjectId() {
58644
- return new Promise((resolve35) => {
58822
+ return new Promise((resolve36) => {
58645
58823
  (0, child_process_1.exec)("gcloud config config-helper --format json", (err, stdout2) => {
58646
58824
  if (!err && stdout2) {
58647
58825
  try {
58648
58826
  const projectId = JSON.parse(stdout2).configuration.properties.core.project;
58649
- resolve35(projectId);
58827
+ resolve36(projectId);
58650
58828
  return;
58651
58829
  } catch (e2) {
58652
58830
  }
58653
58831
  }
58654
- resolve35(null);
58832
+ resolve36(null);
58655
58833
  });
58656
58834
  });
58657
58835
  }
@@ -66423,14 +66601,14 @@ function __asyncValues(o) {
66423
66601
  }, i2);
66424
66602
  function verb(n) {
66425
66603
  i2[n] = o[n] && function(v) {
66426
- return new Promise(function(resolve35, reject) {
66427
- v = o[n](v), settle(resolve35, reject, v.done, v.value);
66604
+ return new Promise(function(resolve36, reject) {
66605
+ v = o[n](v), settle(resolve36, reject, v.done, v.value);
66428
66606
  });
66429
66607
  };
66430
66608
  }
66431
- function settle(resolve35, reject, d, v) {
66609
+ function settle(resolve36, reject, d, v) {
66432
66610
  Promise.resolve(v).then(function(v2) {
66433
- resolve35({ value: v2, done: d });
66611
+ resolve36({ value: v2, done: d });
66434
66612
  }, reject);
66435
66613
  }
66436
66614
  }
@@ -76933,8 +77111,8 @@ var init_node4 = __esm({
76933
77111
  const url = `${websocketBaseUrl}/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.BidiGenerateMusic?key=${apiKey}`;
76934
77112
  let onopenResolve = () => {
76935
77113
  };
76936
- const onopenPromise = new Promise((resolve35) => {
76937
- onopenResolve = resolve35;
77114
+ const onopenPromise = new Promise((resolve36) => {
77115
+ onopenResolve = resolve36;
76938
77116
  });
76939
77117
  const callbacks = params.callbacks;
76940
77118
  const onopenAwaitedCallback = function() {
@@ -77140,8 +77318,8 @@ var init_node4 = __esm({
77140
77318
  }
77141
77319
  let onopenResolve = () => {
77142
77320
  };
77143
- const onopenPromise = new Promise((resolve35) => {
77144
- onopenResolve = resolve35;
77321
+ const onopenPromise = new Promise((resolve36) => {
77322
+ onopenResolve = resolve36;
77145
77323
  });
77146
77324
  const callbacks = params.callbacks;
77147
77325
  const onopenAwaitedCallback = function() {
@@ -79450,7 +79628,7 @@ var init_node4 = __esm({
79450
79628
  return void 0;
79451
79629
  }
79452
79630
  };
79453
- sleep$1 = (ms) => new Promise((resolve35) => setTimeout(resolve35, ms));
79631
+ sleep$1 = (ms) => new Promise((resolve36) => setTimeout(resolve36, ms));
79454
79632
  FallbackEncoder = ({ headers, body }) => {
79455
79633
  return {
79456
79634
  bodyHeaders: {
@@ -79959,8 +80137,8 @@ ${underline2}`);
79959
80137
  };
79960
80138
  APIPromise = class _APIPromise extends Promise {
79961
80139
  constructor(client, responsePromise, parseResponse = defaultParseResponse) {
79962
- super((resolve35) => {
79963
- resolve35(null);
80140
+ super((resolve36) => {
80141
+ resolve36(null);
79964
80142
  });
79965
80143
  this.responsePromise = responsePromise;
79966
80144
  this.parseResponse = parseResponse;
@@ -81201,8 +81379,8 @@ ${underline2}`);
81201
81379
  });
81202
81380
 
81203
81381
  // src/capture/contentExtractor.ts
81204
- import { readdirSync as readdirSync16, statSync as statSync17, readFileSync as readFileSync34 } from "fs";
81205
- import { join as join48 } from "path";
81382
+ import { readdirSync as readdirSync17, statSync as statSync18, readFileSync as readFileSync35 } from "fs";
81383
+ import { join as join50 } from "path";
81206
81384
  async function detectLibraries(page, capturedShaders) {
81207
81385
  let detectedLibraries = [];
81208
81386
  try {
@@ -81322,7 +81500,7 @@ async function captionImagesWithGemini(outputDir, progress, warnings) {
81322
81500
  try {
81323
81501
  const { GoogleGenAI: GoogleGenAI2 } = await Promise.resolve().then(() => (init_node4(), node_exports));
81324
81502
  const ai = new GoogleGenAI2({ apiKey: geminiKey });
81325
- const imageFiles = readdirSync16(join48(outputDir, "assets")).filter(
81503
+ const imageFiles = readdirSync17(join50(outputDir, "assets")).filter(
81326
81504
  (f3) => /\.(png|jpg|jpeg|webp|gif)$/i.test(f3)
81327
81505
  );
81328
81506
  const model = process.env.HYPERFRAMES_GEMINI_MODEL || "gemini-3.1-flash-lite-preview";
@@ -81331,10 +81509,10 @@ async function captionImagesWithGemini(outputDir, progress, warnings) {
81331
81509
  const batch = imageFiles.slice(i2, i2 + BATCH_SIZE);
81332
81510
  const results = await Promise.allSettled(
81333
81511
  batch.map(async (file) => {
81334
- const filePath = join48(outputDir, "assets", file);
81335
- const stat3 = statSync17(filePath);
81512
+ const filePath = join50(outputDir, "assets", file);
81513
+ const stat3 = statSync18(filePath);
81336
81514
  if (stat3.size > 4e6) return { file, caption: "" };
81337
- const buffer = readFileSync34(filePath);
81515
+ const buffer = readFileSync35(filePath);
81338
81516
  const base64 = buffer.toString("base64");
81339
81517
  const ext = file.split(".").pop()?.toLowerCase() || "png";
81340
81518
  const mimeType = ext === "jpg" ? "image/jpeg" : `image/${ext}`;
@@ -81380,12 +81558,12 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
81380
81558
  const uncaptionedLines = [];
81381
81559
  const svgLines = [];
81382
81560
  const fontLines = [];
81383
- const assetsPath = join48(outputDir, "assets");
81561
+ const assetsPath = join50(outputDir, "assets");
81384
81562
  try {
81385
- for (const file of readdirSync16(assetsPath)) {
81563
+ for (const file of readdirSync17(assetsPath)) {
81386
81564
  if (file === "svgs" || file === "fonts" || file === "lottie" || file === "videos") continue;
81387
- const filePath = join48(assetsPath, file);
81388
- const stat3 = statSync17(filePath);
81565
+ const filePath = join50(assetsPath, file);
81566
+ const stat3 = statSync18(filePath);
81389
81567
  if (!stat3.isFile()) continue;
81390
81568
  const sizeKb = Math.round(stat3.size / 1024);
81391
81569
  const catalogMatch = catalogedAssets.find(
@@ -81413,8 +81591,8 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
81413
81591
  } catch {
81414
81592
  }
81415
81593
  try {
81416
- const svgsPath = join48(assetsPath, "svgs");
81417
- for (const file of readdirSync16(svgsPath)) {
81594
+ const svgsPath = join50(assetsPath, "svgs");
81595
+ for (const file of readdirSync17(svgsPath)) {
81418
81596
  if (!file.endsWith(".svg")) continue;
81419
81597
  const svgMatch = tokens.svgs.find(
81420
81598
  (s2) => s2.label && file.includes(
@@ -81428,8 +81606,8 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
81428
81606
  } catch {
81429
81607
  }
81430
81608
  try {
81431
- const fontsPath = join48(assetsPath, "fonts");
81432
- for (const file of readdirSync16(fontsPath)) {
81609
+ const fontsPath = join50(assetsPath, "fonts");
81610
+ for (const file of readdirSync17(fontsPath)) {
81433
81611
  fontLines.push(`fonts/${file} \u2014 font file`);
81434
81612
  }
81435
81613
  } catch {
@@ -81448,12 +81626,12 @@ __export(agentPromptGenerator_exports, {
81448
81626
  generateAgentPrompt: () => generateAgentPrompt
81449
81627
  });
81450
81628
  import { writeFileSync as writeFileSync19 } from "fs";
81451
- import { join as join49 } from "path";
81629
+ import { join as join51 } from "path";
81452
81630
  function generateAgentPrompt(outputDir, url, tokens, _animations, hasScreenshot, hasLottie, hasShaders, _catalogedAssets, detectedLibraries) {
81453
81631
  const prompt = buildPrompt(url, tokens, hasScreenshot, hasLottie, hasShaders, detectedLibraries);
81454
- writeFileSync19(join49(outputDir, "AGENTS.md"), prompt, "utf-8");
81455
- writeFileSync19(join49(outputDir, "CLAUDE.md"), prompt, "utf-8");
81456
- writeFileSync19(join49(outputDir, ".cursorrules"), prompt, "utf-8");
81632
+ writeFileSync19(join51(outputDir, "AGENTS.md"), prompt, "utf-8");
81633
+ writeFileSync19(join51(outputDir, "CLAUDE.md"), prompt, "utf-8");
81634
+ writeFileSync19(join51(outputDir, ".cursorrules"), prompt, "utf-8");
81457
81635
  }
81458
81636
  function buildPrompt(url, tokens, hasScreenshot, hasLottie, hasShaders, detectedLibraries) {
81459
81637
  const title = tokens.title || new URL(url).hostname.replace(/^www\./, "");
@@ -81520,15 +81698,15 @@ var init_agentPromptGenerator = __esm({
81520
81698
  });
81521
81699
 
81522
81700
  // src/capture/scaffolding.ts
81523
- import { existsSync as existsSync46, writeFileSync as writeFileSync20, readFileSync as readFileSync35 } from "fs";
81524
- import { join as join50, resolve as resolve33 } from "path";
81701
+ import { existsSync as existsSync47, writeFileSync as writeFileSync20, readFileSync as readFileSync36 } from "fs";
81702
+ import { join as join52, resolve as resolve34 } from "path";
81525
81703
  function loadEnvFile(startDir) {
81526
81704
  try {
81527
- let dir = resolve33(startDir);
81705
+ let dir = resolve34(startDir);
81528
81706
  for (let i2 = 0; i2 < 5; i2++) {
81529
- const envPath = resolve33(dir, ".env");
81707
+ const envPath = resolve34(dir, ".env");
81530
81708
  try {
81531
- const envContent = readFileSync35(envPath, "utf-8");
81709
+ const envContent = readFileSync36(envPath, "utf-8");
81532
81710
  for (const line of envContent.split("\n")) {
81533
81711
  const trimmed = line.trim();
81534
81712
  if (!trimmed || trimmed.startsWith("#")) continue;
@@ -81540,15 +81718,15 @@ function loadEnvFile(startDir) {
81540
81718
  }
81541
81719
  break;
81542
81720
  } catch {
81543
- dir = resolve33(dir, "..");
81721
+ dir = resolve34(dir, "..");
81544
81722
  }
81545
81723
  }
81546
81724
  } catch {
81547
81725
  }
81548
81726
  }
81549
81727
  async function generateProjectScaffold(outputDir, url, tokens, animationCatalog, hasScreenshots, hasLotties, hasShaders, catalogedAssets, progress, warnings, detectedLibraries) {
81550
- const metaPath = join50(outputDir, "meta.json");
81551
- if (!existsSync46(metaPath)) {
81728
+ const metaPath = join52(outputDir, "meta.json");
81729
+ if (!existsSync47(metaPath)) {
81552
81730
  const hostname = new URL(url).hostname.replace(/^www\./, "");
81553
81731
  writeFileSync20(
81554
81732
  metaPath,
@@ -81586,9 +81764,9 @@ __export(screenshotCapture_exports, {
81586
81764
  captureScrollScreenshots: () => captureScrollScreenshots
81587
81765
  });
81588
81766
  import { writeFileSync as writeFileSync21, mkdirSync as mkdirSync27 } from "fs";
81589
- import { join as join51 } from "path";
81767
+ import { join as join53 } from "path";
81590
81768
  async function captureScrollScreenshots(page, outputDir) {
81591
- const screenshotsDir = join51(outputDir, "screenshots");
81769
+ const screenshotsDir = join53(outputDir, "screenshots");
81592
81770
  mkdirSync27(screenshotsDir, { recursive: true });
81593
81771
  const MAX_SCREENSHOTS = 20;
81594
81772
  const filePaths = [];
@@ -81622,7 +81800,7 @@ async function captureScrollScreenshots(page, outputDir) {
81622
81800
  finalPositions[i2] / Math.max(1, scrollHeight - viewportHeight) * 100
81623
81801
  );
81624
81802
  const filename = `scroll-${String(Math.min(pct, 100)).padStart(3, "0")}.png`;
81625
- const filePath = join51(screenshotsDir, filename);
81803
+ const filePath = join53(screenshotsDir, filename);
81626
81804
  const buffer = await page.screenshot({ type: "png" });
81627
81805
  writeFileSync21(filePath, buffer);
81628
81806
  filePaths.push(`screenshots/${filename}`);
@@ -81935,8 +82113,8 @@ var capture_exports = {};
81935
82113
  __export(capture_exports, {
81936
82114
  captureWebsite: () => captureWebsite
81937
82115
  });
81938
- import { mkdirSync as mkdirSync28, writeFileSync as writeFileSync22, existsSync as existsSync47 } from "fs";
81939
- import { join as join52 } from "path";
82116
+ import { mkdirSync as mkdirSync28, writeFileSync as writeFileSync22, existsSync as existsSync48 } from "fs";
82117
+ import { join as join54 } from "path";
81940
82118
  async function captureWebsite(opts, onProgress) {
81941
82119
  const {
81942
82120
  url,
@@ -81953,9 +82131,9 @@ async function captureWebsite(opts, onProgress) {
81953
82131
  onProgress?.(stage, detail);
81954
82132
  };
81955
82133
  loadEnvFile(outputDir);
81956
- mkdirSync28(join52(outputDir, "extracted"), { recursive: true });
81957
- mkdirSync28(join52(outputDir, "screenshots"), { recursive: true });
81958
- mkdirSync28(join52(outputDir, "assets"), { recursive: true });
82134
+ mkdirSync28(join54(outputDir, "extracted"), { recursive: true });
82135
+ mkdirSync28(join54(outputDir, "screenshots"), { recursive: true });
82136
+ mkdirSync28(join54(outputDir, "assets"), { recursive: true });
81959
82137
  progress("browser", "Launching headless Chrome...");
81960
82138
  const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
81961
82139
  const browser = await ensureBrowser2();
@@ -82111,7 +82289,7 @@ async function captureWebsite(opts, onProgress) {
82111
82289
  } catch {
82112
82290
  }
82113
82291
  if (discoveredLotties.length > 0) {
82114
- const lottieDir = join52(outputDir, "assets", "lottie");
82292
+ const lottieDir = join54(outputDir, "assets", "lottie");
82115
82293
  mkdirSync28(lottieDir, { recursive: true });
82116
82294
  const savedCount = await saveLottieAnimations(discoveredLotties, lottieDir);
82117
82295
  if (savedCount > 0) {
@@ -82131,7 +82309,7 @@ async function captureWebsite(opts, onProgress) {
82131
82309
  });
82132
82310
  capturedShaders = unique;
82133
82311
  writeFileSync22(
82134
- join52(outputDir, "extracted", "shaders.json"),
82312
+ join54(outputDir, "extracted", "shaders.json"),
82135
82313
  JSON.stringify(unique, null, 2),
82136
82314
  "utf-8"
82137
82315
  );
@@ -82142,7 +82320,7 @@ async function captureWebsite(opts, onProgress) {
82142
82320
  progress("tokens", "Extracting design tokens...");
82143
82321
  const tokens = await extractTokens(page1);
82144
82322
  writeFileSync22(
82145
- join52(outputDir, "extracted", "tokens.json"),
82323
+ join54(outputDir, "extracted", "tokens.json"),
82146
82324
  JSON.stringify(tokens, null, 2),
82147
82325
  "utf-8"
82148
82326
  );
@@ -82216,7 +82394,7 @@ async function captureWebsite(opts, onProgress) {
82216
82394
  representativeAnimations: representativeAnims
82217
82395
  };
82218
82396
  writeFileSync22(
82219
- join52(outputDir, "extracted", "animations.json"),
82397
+ join54(outputDir, "extracted", "animations.json"),
82220
82398
  JSON.stringify(leanCatalog, null, 2),
82221
82399
  "utf-8"
82222
82400
  );
@@ -82227,18 +82405,18 @@ async function captureWebsite(opts, onProgress) {
82227
82405
  assets = await downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks);
82228
82406
  }
82229
82407
  if (visibleTextContent) {
82230
- writeFileSync22(join52(outputDir, "extracted", "visible-text.txt"), visibleTextContent, "utf-8");
82408
+ writeFileSync22(join54(outputDir, "extracted", "visible-text.txt"), visibleTextContent, "utf-8");
82231
82409
  }
82232
82410
  if (catalogedAssets.length > 0) {
82233
82411
  writeFileSync22(
82234
- join52(outputDir, "extracted", "assets-catalog.json"),
82412
+ join54(outputDir, "extracted", "assets-catalog.json"),
82235
82413
  JSON.stringify(catalogedAssets, null, 2),
82236
82414
  "utf-8"
82237
82415
  );
82238
82416
  }
82239
82417
  if (detectedLibraries.length > 0) {
82240
82418
  writeFileSync22(
82241
- join52(outputDir, "extracted", "detected-libraries.json"),
82419
+ join54(outputDir, "extracted", "detected-libraries.json"),
82242
82420
  JSON.stringify(detectedLibraries, null, 2),
82243
82421
  "utf-8"
82244
82422
  );
@@ -82249,7 +82427,7 @@ async function captureWebsite(opts, onProgress) {
82249
82427
  const lines = generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCaptions);
82250
82428
  if (lines.length > 0) {
82251
82429
  writeFileSync22(
82252
- join52(outputDir, "extracted", "asset-descriptions.md"),
82430
+ join54(outputDir, "extracted", "asset-descriptions.md"),
82253
82431
  "# Asset Descriptions\n\nOne line per file. Read this instead of opening every image individually.\n\n" + lines.map((l) => "- " + l).join("\n") + "\n",
82254
82432
  "utf-8"
82255
82433
  );
@@ -82265,7 +82443,7 @@ async function captureWebsite(opts, onProgress) {
82265
82443
  animationCatalog,
82266
82444
  screenshots.length > 0,
82267
82445
  discoveredLotties.length > 0,
82268
- existsSync47(join52(outputDir, "extracted", "shaders.json")),
82446
+ existsSync48(join54(outputDir, "extracted", "shaders.json")),
82269
82447
  catalogedAssets,
82270
82448
  progress,
82271
82449
  warnings,
@@ -82305,15 +82483,15 @@ var init_capture = __esm({
82305
82483
  var capture_exports2 = {};
82306
82484
  __export(capture_exports2, {
82307
82485
  default: () => capture_default,
82308
- examples: () => examples19
82486
+ examples: () => examples20
82309
82487
  });
82310
- import { resolve as resolve34 } from "path";
82311
- var examples19, capture_default;
82488
+ import { resolve as resolve35 } from "path";
82489
+ var examples20, capture_default;
82312
82490
  var init_capture2 = __esm({
82313
82491
  "src/commands/capture.ts"() {
82314
82492
  "use strict";
82315
82493
  init_dist();
82316
- examples19 = [
82494
+ examples20 = [
82317
82495
  ["Capture a website", "hyperframes capture https://stripe.com"],
82318
82496
  ["Capture to a specific directory", "hyperframes capture https://linear.app -o linear-video"],
82319
82497
  ["JSON output for AI agents", "hyperframes capture https://example.com --json"]
@@ -82366,7 +82544,7 @@ var init_capture2 = __esm({
82366
82544
  const hostname = new URL(url).hostname.replace(/^www\./, "");
82367
82545
  outputName = `captures/${hostname.replace(/\./g, "-")}`;
82368
82546
  }
82369
- const outputDir = resolve34(outputName);
82547
+ const outputDir = resolve35(outputName);
82370
82548
  const isJson = args.json;
82371
82549
  if (!isJson) {
82372
82550
  const { c: c2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
@@ -82614,7 +82792,7 @@ __export(autoUpdate_exports, {
82614
82792
  import { spawn as spawn12 } from "child_process";
82615
82793
  import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync29, openSync } from "fs";
82616
82794
  import { homedir as homedir10 } from "os";
82617
- import { join as join53 } from "path";
82795
+ import { join as join55 } from "path";
82618
82796
  import { compareVersions as compareVersions2 } from "compare-versions";
82619
82797
  function isAutoInstallDisabled() {
82620
82798
  if (isDevMode()) return true;
@@ -82637,7 +82815,7 @@ function log(line) {
82637
82815
  }
82638
82816
  function launchDetachedInstall(installCommand, version) {
82639
82817
  mkdirSync29(CONFIG_DIR2, { recursive: true, mode: 448 });
82640
- const configFile = join53(CONFIG_DIR2, "config.json");
82818
+ const configFile = join55(CONFIG_DIR2, "config.json");
82641
82819
  const nodeScript = `
82642
82820
  const { exec } = require("node:child_process");
82643
82821
  const { readFileSync, renameSync, writeFileSync } = require("node:fs");
@@ -82756,8 +82934,8 @@ var init_autoUpdate = __esm({
82756
82934
  init_config();
82757
82935
  init_env();
82758
82936
  init_installerDetection();
82759
- CONFIG_DIR2 = join53(homedir10(), ".hyperframes");
82760
- LOG_FILE = join53(CONFIG_DIR2, "auto-update.log");
82937
+ CONFIG_DIR2 = join55(homedir10(), ".hyperframes");
82938
+ LOG_FILE = join55(CONFIG_DIR2, "auto-update.log");
82761
82939
  PENDING_TIMEOUT_MS = 10 * 60 * 1e3;
82762
82940
  }
82763
82941
  });
@@ -82810,10 +82988,10 @@ function renderRootHelp() {
82810
82988
  lines.push(`Run ${c.cyan("hyperframes <command> --help")} for more information about a command.`);
82811
82989
  return lines.join("\n");
82812
82990
  }
82813
- function formatExamples(examples20) {
82991
+ function formatExamples(examples21) {
82814
82992
  const lines = [];
82815
82993
  lines.push(c.bold("Examples:"));
82816
- for (const [comment, command2] of examples20) {
82994
+ for (const [comment, command2] of examples21) {
82817
82995
  lines.push(` ${c.gray(`# ${comment}`)}`);
82818
82996
  lines.push(` ${command2}`);
82819
82997
  lines.push("");
@@ -82830,9 +83008,9 @@ async function showUsage2(cmd, parent) {
82830
83008
  console.log(usage + "\n");
82831
83009
  const name = meta?.name;
82832
83010
  if (name) {
82833
- const examples20 = STATIC_EXAMPLES[name] ?? await loadExamples(name);
82834
- if (examples20) {
82835
- console.log(formatExamples(examples20) + "\n");
83011
+ const examples21 = STATIC_EXAMPLES[name] ?? await loadExamples(name);
83012
+ if (examples21) {
83013
+ console.log(formatExamples(examples21) + "\n");
82836
83014
  }
82837
83015
  }
82838
83016
  }
@@ -82853,6 +83031,7 @@ var init_help = __esm({
82853
83031
  ["capture", "Capture a website for video production"],
82854
83032
  ["catalog", "Browse and install blocks and components"],
82855
83033
  ["preview", "Start the studio for previewing compositions"],
83034
+ ["publish", "Upload a project and get a stable public URL"],
82856
83035
  ["render", "Render a composition to MP4 or WebM"]
82857
83036
  ]
82858
83037
  },
@@ -82897,6 +83076,7 @@ var init_help = __esm({
82897
83076
  ROOT_EXAMPLES = [
82898
83077
  ["Create a new project", "hyperframes init my-video"],
82899
83078
  ["Start the live preview studio", "hyperframes preview"],
83079
+ ["Publish to hyperframes.dev", "hyperframes publish"],
82900
83080
  ["Render to MP4", "hyperframes render -o out.mp4"],
82901
83081
  ["Transparent WebM overlay", "hyperframes render --format webm -o out.webm"],
82902
83082
  ["Validate your composition", "hyperframes lint"],
@@ -82922,6 +83102,7 @@ var subCommands = {
82922
83102
  catalog: () => Promise.resolve().then(() => (init_catalog(), catalog_exports)).then((m2) => m2.default),
82923
83103
  play: () => Promise.resolve().then(() => (init_play(), play_exports)).then((m2) => m2.default),
82924
83104
  preview: () => Promise.resolve().then(() => (init_preview2(), preview_exports)).then((m2) => m2.default),
83105
+ publish: () => Promise.resolve().then(() => (init_publish(), publish_exports)).then((m2) => m2.default),
82925
83106
  render: () => Promise.resolve().then(() => (init_render2(), render_exports)).then((m2) => m2.default),
82926
83107
  lint: () => Promise.resolve().then(() => (init_lint3(), lint_exports2)).then((m2) => m2.default),
82927
83108
  info: () => Promise.resolve().then(() => (init_info(), info_exports)).then((m2) => m2.default),