@hyperframes/studio 0.8.205 → 0.8.207

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 (51) hide show
  1. package/dist/assets/hyperframes-player-Cm5aBiKq.js +478 -0
  2. package/dist/assets/{index-dy6GQJn4.js → index-BF9YeBnC.js} +142 -142
  3. package/dist/assets/{index-C8hp9Y7c.js → index-BrqAmMRt.js} +1 -1
  4. package/dist/{chunk-Z5NKM57J.js → chunk-3EAFE522.js} +8 -4
  5. package/dist/{chunk-2YCKGJFD.js → chunk-HPIJDMWG.js} +5 -5
  6. package/dist/{chunk-T43DM7Q6.js → chunk-OGIOFEC7.js} +4 -2
  7. package/dist/{domEditingLayers-WMDSHU5P.js → domEditingLayers-7Z6J4UOK.js} +2 -2
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.html +1 -1
  10. package/dist/index.js +235 -127
  11. package/dist/player.js +2 -2
  12. package/package.json +8 -8
  13. package/src/components/MediaPreview.test.tsx +69 -0
  14. package/src/components/MediaPreview.tsx +10 -5
  15. package/src/components/editor/domEditLayerWalkCache.test.ts +48 -0
  16. package/src/components/editor/domEditLayerWalkCache.ts +6 -0
  17. package/src/components/editor/domEditingLayers.ts +3 -2
  18. package/src/components/sidebar/PromptPreviewModal.test.tsx +22 -0
  19. package/src/components/sidebar/PromptPreviewModal.tsx +1 -0
  20. package/src/hooks/timelineEditingHelpers.test.ts +59 -0
  21. package/src/hooks/timelineEditingHelpers.ts +4 -5
  22. package/src/hooks/useGestureRecording.ts +5 -3
  23. package/src/player/components/PlayerControls.tsx +5 -2
  24. package/src/player/components/ShortcutsPanel.tsx +4 -2
  25. package/src/player/components/Timeline.test.ts +12 -0
  26. package/src/player/components/TimelineProvider.tsx +1 -0
  27. package/src/player/components/TimelineRuler.tsx +4 -7
  28. package/src/player/components/TimelineRulerPart.tsx +1 -0
  29. package/src/player/components/timelineClipDragPreview.test.ts +10 -0
  30. package/src/player/components/timelineClipDragPreview.ts +4 -5
  31. package/src/player/components/timelineRulerGeometry.ts +14 -3
  32. package/src/player/components/useTimelineClipDrag.ts +5 -2
  33. package/src/player/components/useTimelineProviderState.tsx +2 -1
  34. package/src/player/components/useTimelineTicks.ts +4 -1
  35. package/src/player/hooks/previewMessageRouter.test.ts +34 -0
  36. package/src/player/hooks/previewMessageRouter.ts +14 -3
  37. package/src/player/hooks/usePlaybackKeyboard.test.ts +19 -0
  38. package/src/player/hooks/usePlaybackKeyboard.ts +5 -2
  39. package/src/player/hooks/useShadowPreviewReload.ts +4 -1
  40. package/src/player/hooks/useTimelinePlayer.shadowReload.test.ts +21 -0
  41. package/src/player/lib/mediaFetch.test.ts +163 -0
  42. package/src/player/lib/mediaFetch.ts +98 -0
  43. package/src/player/lib/mediaProbe.test.ts +21 -1
  44. package/src/player/lib/mediaProbe.ts +4 -2
  45. package/src/player/lib/thumbnailVideoDecoder.test.ts +24 -1
  46. package/src/player/lib/thumbnailVideoDecoder.ts +3 -1
  47. package/src/player/lib/time.test.ts +13 -13
  48. package/src/player/lib/time.ts +4 -4
  49. package/src/utils/linkedClipPreferences.ts +2 -0
  50. package/src/utils/sourceScopedSelectorIndex.ts +5 -2
  51. package/dist/assets/hyperframes-player-DzdSmJdB.js +0 -478
package/dist/index.js CHANGED
@@ -54,7 +54,7 @@ import {
54
54
  whenPreviewBooted,
55
55
  writeStudioUiPreferences,
56
56
  zoomToSelectedClips
57
- } from "./chunk-2YCKGJFD.js";
57
+ } from "./chunk-HPIJDMWG.js";
58
58
  import {
59
59
  Button,
60
60
  ContextMenu,
@@ -112,7 +112,7 @@ import {
112
112
  resolveAllVisualDomEditTargets,
113
113
  resolveDomEditSelection,
114
114
  serializeDomEditTextFields
115
- } from "./chunk-Z5NKM57J.js";
115
+ } from "./chunk-3EAFE522.js";
116
116
  import {
117
117
  LAYER_REVEAL_PRIOR_POSITION_ATTR,
118
118
  LAYER_REVEAL_PRIOR_Z_ATTR,
@@ -179,7 +179,7 @@ import {
179
179
  studioApiFetch,
180
180
  toHexColor,
181
181
  wrapTimeline
182
- } from "./chunk-T43DM7Q6.js";
182
+ } from "./chunk-OGIOFEC7.js";
183
183
  import "./chunk-MLKGABMK.js";
184
184
 
185
185
  // src/components/EditorShell.tsx
@@ -598,6 +598,27 @@ if (typeof window !== "undefined") {
598
598
  });
599
599
  }
600
600
 
601
+ // src/utils/linkedClipPreferences.ts
602
+ import { create } from "zustand";
603
+ var useLinkedClipPreferences = create((set) => ({
604
+ linkedSelection: readStudioUiPreferences().linkedSelectionEnabled ?? true,
605
+ setLinkedSelection: (enabled) => {
606
+ writeStudioUiPreferences({ linkedSelectionEnabled: enabled });
607
+ set({ linkedSelection: enabled });
608
+ },
609
+ syncIndicatorsVisible: readStudioUiPreferences().syncIndicatorsVisible ?? true,
610
+ setSyncIndicatorsVisible: (visible) => {
611
+ writeStudioUiPreferences({ syncIndicatorsVisible: visible });
612
+ set({ syncIndicatorsVisible: visible });
613
+ },
614
+ compositionFps: STUDIO_PREVIEW_FPS,
615
+ setCompositionFps: (fps) => {
616
+ if (Number.isFinite(fps) && fps > 0) set({ compositionFps: fps });
617
+ }
618
+ }));
619
+ var useCompositionFps = () => useLinkedClipPreferences((s) => s.compositionFps);
620
+ var isLinkedSelectionOn = () => useLinkedClipPreferences.getState().linkedSelection;
621
+
601
622
  // src/player/components/ShortcutsPanel.tsx
602
623
  import { useState, useCallback, useRef, memo } from "react";
603
624
 
@@ -722,13 +743,14 @@ var ShortcutsPanel = memo(function ShortcutsPanel2({
722
743
  }) {
723
744
  const [showShortcuts, setShowShortcuts] = useState(false);
724
745
  const [jumpFrame, setJumpFrame] = useState("");
746
+ const compositionFps2 = useCompositionFps();
725
747
  const panelBodyRef = useRef(null);
726
748
  const commitJumpFrame = useCallback(() => {
727
749
  if (disabled) return;
728
750
  const frame3 = Number.parseInt(jumpFrame, 10);
729
751
  if (!Number.isFinite(frame3) || duration <= 0) return;
730
- onSeek(Math.min(duration, frameToSeconds(Math.max(0, frame3))));
731
- }, [disabled, duration, jumpFrame, onSeek]);
752
+ onSeek(Math.min(duration, frameToSeconds(Math.max(0, frame3), compositionFps2)));
753
+ }, [compositionFps2, disabled, duration, jumpFrame, onSeek]);
732
754
  const handleJumpSubmit = useCallback(
733
755
  (e) => {
734
756
  e.preventDefault();
@@ -1235,6 +1257,7 @@ var FullscreenButton = memo5(function FullscreenButton2({
1235
1257
  }
1236
1258
  ) });
1237
1259
  });
1260
+ var compositionFps = () => useLinkedClipPreferences.getState().compositionFps;
1238
1261
  var PlayerControls = memo5(function PlayerControls2({
1239
1262
  onTogglePlay,
1240
1263
  onSeek,
@@ -1266,14 +1289,14 @@ var PlayerControls = memo5(function PlayerControls2({
1266
1289
  useEffect3(() => {
1267
1290
  if (!timeDisplayRef.current) return;
1268
1291
  const t2 = currentTimeRef.current;
1269
- timeDisplayRef.current.textContent = timeDisplayMode === "frame" ? formatFrameTime(t2, duration) : formatTime(t2);
1292
+ timeDisplayRef.current.textContent = timeDisplayMode === "frame" ? formatFrameTime(t2, duration, compositionFps()) : formatTime(t2);
1270
1293
  }, [duration, timeDisplayMode]);
1271
1294
  useMountEffect(() => {
1272
1295
  const updateTime = (time) => {
1273
1296
  currentTimeRef.current = time;
1274
1297
  if (!timeDisplayRef.current) return;
1275
1298
  const currentDuration = durationRef.current;
1276
- const text = timeDisplayModeRef.current === "frame" ? formatFrameTime(time, currentDuration) : formatTime(time);
1299
+ const text = timeDisplayModeRef.current === "frame" ? formatFrameTime(time, currentDuration, compositionFps()) : formatTime(time);
1277
1300
  if (timeDisplayRef.current.textContent !== text) timeDisplayRef.current.textContent = text;
1278
1301
  };
1279
1302
  const unsubscribe = liveTime.subscribe(updateTime);
@@ -4313,8 +4336,8 @@ function tickSpacing(duration, pixelsPerSecond, frameRate) {
4313
4336
  const subdivisions = getMinorSubdivisions(majorInterval, pixelsPerSecond, frameRate);
4314
4337
  return { majorInterval, subdivisions };
4315
4338
  }
4316
- function rulerFrameRate(mode) {
4317
- return mode === "frame" ? STUDIO_PREVIEW_FPS : void 0;
4339
+ function rulerFrameRate(mode, fps) {
4340
+ return mode === "frame" ? fps : void 0;
4318
4341
  }
4319
4342
  function getTimelineGridStep(duration, pixelsPerSecond, frameRate) {
4320
4343
  if (!isSupportedTickDuration(duration)) return 0;
@@ -4362,10 +4385,13 @@ function formatTimelineTickLabel(time, duration, majorInterval) {
4362
4385
  }
4363
4386
  return formatTime(safeTime);
4364
4387
  }
4388
+ function rulerTickText(time, frameRate, duration, majorInterval) {
4389
+ return frameRate ? secondsToFrame(time, frameRate) : formatTimelineTickLabel(time, duration, majorInterval);
4390
+ }
4365
4391
 
4366
4392
  // src/player/store/previewFrameStore.ts
4367
- import { create } from "zustand";
4368
- var usePreviewFrameStore = create(() => ({ time: null }));
4393
+ import { create as create2 } from "zustand";
4394
+ var usePreviewFrameStore = create2(() => ({ time: null }));
4369
4395
  var setPreviewFrame = (time) => usePreviewFrameStore.setState({ time });
4370
4396
  function showingPreviewFrame(adapter) {
4371
4397
  let seeked = false;
@@ -4770,9 +4796,9 @@ function guideIfSaved(element, clip, target, pps) {
4770
4796
  const off = Math.min(Math.abs(saved2.start - target.time), Math.abs(saved2.end - target.time));
4771
4797
  return off * pps < 1 ? target : null;
4772
4798
  }
4773
- var TRIM_END_FRAME_LEAD_S = 1 / STUDIO_PREVIEW_FPS;
4774
4799
  function trimPreviewTime(edge, start, duration) {
4775
- return edge === "start" ? start : Math.max(start, start + duration - TRIM_END_FRAME_LEAD_S);
4800
+ const frame3 = 1 / useLinkedClipPreferences.getState().compositionFps;
4801
+ return edge === "start" ? start : Math.max(start, start + duration - frame3);
4776
4802
  }
4777
4803
  function computeResizePreview(resize, clientX, ctx3) {
4778
4804
  const { scroll, pps, buildSnapTargets } = ctx3;
@@ -4859,26 +4885,6 @@ function previewGroupResize(session, next, setResizeState) {
4859
4885
  });
4860
4886
  }
4861
4887
 
4862
- // src/utils/linkedClipPreferences.ts
4863
- import { create as create2 } from "zustand";
4864
- var useLinkedClipPreferences = create2((set) => ({
4865
- linkedSelection: readStudioUiPreferences().linkedSelectionEnabled ?? true,
4866
- setLinkedSelection: (enabled) => {
4867
- writeStudioUiPreferences({ linkedSelectionEnabled: enabled });
4868
- set({ linkedSelection: enabled });
4869
- },
4870
- syncIndicatorsVisible: readStudioUiPreferences().syncIndicatorsVisible ?? true,
4871
- setSyncIndicatorsVisible: (visible) => {
4872
- writeStudioUiPreferences({ syncIndicatorsVisible: visible });
4873
- set({ syncIndicatorsVisible: visible });
4874
- },
4875
- compositionFps: STUDIO_PREVIEW_FPS,
4876
- setCompositionFps: (fps) => {
4877
- if (Number.isFinite(fps) && fps > 0) set({ compositionFps: fps });
4878
- }
4879
- }));
4880
- var isLinkedSelectionOn = () => useLinkedClipPreferences.getState().linkedSelection;
4881
-
4882
4888
  // src/player/components/timelineReadOnly.ts
4883
4889
  import { createContext as createContext2, useContext as useContext2, useEffect as useEffect7, useEffectEvent } from "react";
4884
4890
  var TimelineReadOnlyContext = createContext2(null);
@@ -10941,7 +10947,10 @@ function useTimelineClipDrag({
10941
10947
  );
10942
10948
  const snapGridStep = useCallback8(() => {
10943
10949
  if (!snapContextRef.current.enabled) return 0;
10944
- const frameRate = rulerFrameRate(usePlayerStore.getState().timeDisplayMode);
10950
+ const frameRate = rulerFrameRate(
10951
+ usePlayerStore.getState().timeDisplayMode,
10952
+ useLinkedClipPreferences.getState().compositionFps
10953
+ );
10945
10954
  return getTimelineGridStep(durationRef.current, ppsRef.current, frameRate);
10946
10955
  }, [durationRef, ppsRef]);
10947
10956
  const [draggedClip, setDraggedClipState] = useState8(null);
@@ -13976,13 +13985,15 @@ function useTimelineShiftModifier() {
13976
13985
  // src/player/components/useTimelineTicks.ts
13977
13986
  import { useMemo as useMemo18 } from "react";
13978
13987
  function useTimelineTicks(duration, pixelsPerSecond, timeDisplayMode, renderTimeRange) {
13979
- const frameRate = rulerFrameRate(timeDisplayMode);
13988
+ const compositionFps2 = useCompositionFps();
13989
+ const frameRate = rulerFrameRate(timeDisplayMode, compositionFps2);
13980
13990
  const ticks = useMemo18(
13981
13991
  () => generateTicks(duration, pixelsPerSecond, frameRate, renderTimeRange),
13982
13992
  [duration, frameRate, pixelsPerSecond, renderTimeRange]
13983
13993
  );
13984
13994
  return {
13985
13995
  ...ticks,
13996
+ frameRate,
13986
13997
  majorTickInterval: getTimelineMajorTickInterval(duration, pixelsPerSecond, frameRate)
13987
13998
  };
13988
13999
  }
@@ -15036,7 +15047,7 @@ function useTimelineProviderState({
15036
15047
  dragActive: draggedClip?.started === true || resizingClip != null,
15037
15048
  displayDuration
15038
15049
  });
15039
- const { major, minor, majorTickInterval } = useTimelineTicks(
15050
+ const { major, minor, majorTickInterval, frameRate } = useTimelineTicks(
15040
15051
  displayDuration,
15041
15052
  pps,
15042
15053
  timeDisplayMode,
@@ -15052,6 +15063,7 @@ function useTimelineProviderState({
15052
15063
  totalH: displayLayout.totalH,
15053
15064
  effectiveDuration,
15054
15065
  majorTickInterval,
15066
+ tickFrameRate: frameRate,
15055
15067
  rangeSelection,
15056
15068
  marqueeRect,
15057
15069
  laneGapStrips,
@@ -15303,13 +15315,13 @@ var TimelineRuler = memo10(function TimelineRuler2({
15303
15315
  totalH,
15304
15316
  effectiveDuration,
15305
15317
  majorTickInterval,
15318
+ tickFrameRate,
15306
15319
  theme,
15307
15320
  beatAnalysis,
15308
15321
  contentOrigin,
15309
15322
  renderTimeRange,
15310
15323
  scrollRef
15311
15324
  }) {
15312
- const timeDisplayMode = usePlayerStore((s) => s.timeDisplayMode);
15313
15325
  const beatTimes = beatAnalysis?.beatTimes ?? [];
15314
15326
  const beatStrengths = beatAnalysis?.beatStrengths ?? [];
15315
15327
  const beatEntries = getTimelineBeatEntries(beatTimes, beatStrengths, renderTimeRange);
@@ -15401,7 +15413,7 @@ var TimelineRuler = memo10(function TimelineRuler2({
15401
15413
  top: 5,
15402
15414
  fontSize: 10
15403
15415
  },
15404
- children: timeDisplayMode === "frame" ? secondsToFrame(t2) : formatTimelineTickLabel(t2, effectiveDuration, majorTickInterval)
15416
+ children: rulerTickText(t2, tickFrameRate, effectiveDuration, majorTickInterval)
15405
15417
  }
15406
15418
  ),
15407
15419
  /* @__PURE__ */ jsx26("div", { className: "w-px", style: { height: RULER_H, background: theme.tickMajor } })
@@ -15442,6 +15454,7 @@ function TimelineRulerPart() {
15442
15454
  totalH: props.totalH,
15443
15455
  effectiveDuration: props.effectiveDuration,
15444
15456
  majorTickInterval: props.majorTickInterval,
15457
+ tickFrameRate: props.tickFrameRate,
15445
15458
  theme: props.theme,
15446
15459
  beatAnalysis: props.beatAnalysis,
15447
15460
  contentOrigin: props.contentOrigin,
@@ -19025,7 +19038,6 @@ async function persistTimelineEdit(input) {
19025
19038
  if (!patchTarget) {
19026
19039
  throw new Error(`Timeline element ${input.element.id} is missing a patchable target`);
19027
19040
  }
19028
- input.pendingTimelineEditPathRef.current.add(targetPath);
19029
19041
  await saveProjectFilesWithHistory({
19030
19042
  projectId: input.projectId,
19031
19043
  label: input.label,
@@ -19033,10 +19045,10 @@ async function persistTimelineEdit(input) {
19033
19045
  coalesceMs: input.coalesceMs,
19034
19046
  files: {
19035
19047
  [targetPath]: (current) => {
19036
- const patched = input.buildPatches(current, patchTarget);
19037
- if (patched === current) {
19038
- throw new Error(`Unable to patch timeline element ${input.element.id} in ${targetPath}`);
19039
- }
19048
+ const patched = patchTimelineChangesInSource(current, targetPath, [
19049
+ { element: input.element, buildPatches: input.buildPatches }
19050
+ ]);
19051
+ if (patched !== current) input.pendingTimelineEditPathRef.current.add(targetPath);
19040
19052
  return patched;
19041
19053
  }
19042
19054
  },
@@ -28115,6 +28127,77 @@ var Timeline = Object.assign(TimelineComposed, {
28115
28127
  // src/player/components/VideoThumbnail.tsx
28116
28128
  import { memo as memo22, useMemo as useMemo36, useState as useState35 } from "react";
28117
28129
 
28130
+ // src/player/lib/mediaFetch.ts
28131
+ var describe = (reader, status, code, retries) => `${reader} range fetch failed: ${status === null ? `network ${code}` : `HTTP ${status}`} after ${retries} retries`;
28132
+ var MediaFetchError = class extends Error {
28133
+ constructor(reader, status, code) {
28134
+ super(describe(reader, status, code, 0));
28135
+ this.reader = reader;
28136
+ this.status = status;
28137
+ this.code = code;
28138
+ }
28139
+ reader;
28140
+ status;
28141
+ code;
28142
+ name = "MediaFetchError";
28143
+ retries = 0;
28144
+ setRetries(retries) {
28145
+ this.retries = retries;
28146
+ this.message = describe(this.reader, this.status, this.code, retries);
28147
+ }
28148
+ };
28149
+ var MAX_RETRIES = 2;
28150
+ var isAbort = (error) => error?.name === "AbortError";
28151
+ function networkCode(error) {
28152
+ const cause = error?.cause;
28153
+ if (typeof cause?.code === "string") return cause.code;
28154
+ const name = error?.name;
28155
+ return typeof name === "string" ? name : "unknown";
28156
+ }
28157
+ var typedFailure = (reader, error) => isAbort(error) ? error : new MediaFetchError(reader, null, networkCode(error));
28158
+ function typedBody(reader, body) {
28159
+ const source = body.getReader();
28160
+ return new ReadableStream({
28161
+ async pull(controller) {
28162
+ try {
28163
+ const { done, value } = await source.read();
28164
+ if (done) controller.close();
28165
+ else controller.enqueue(value);
28166
+ } catch (error) {
28167
+ controller.error(typedFailure(reader, error));
28168
+ }
28169
+ },
28170
+ cancel: (reason) => source.cancel(reason)
28171
+ });
28172
+ }
28173
+ function mediaUrlSourceOptions(reader) {
28174
+ let failures = 0;
28175
+ const fetchFn = async (input, init) => {
28176
+ let response;
28177
+ try {
28178
+ response = await fetch(input, init);
28179
+ } catch (error) {
28180
+ throw typedFailure(reader, error);
28181
+ }
28182
+ if (!response.ok) throw new MediaFetchError(reader, response.status, null);
28183
+ if (!response.body) return response;
28184
+ const { status, statusText, headers } = response;
28185
+ return new Response(typedBody(reader, response.body), { status, statusText, headers });
28186
+ };
28187
+ const getRetryDelay = (_previousAttempts, error) => {
28188
+ const clientError = error instanceof MediaFetchError && error.status !== null && error.status < 500;
28189
+ if (error instanceof MediaFetchError) error.setRetries(failures);
28190
+ if (clientError || failures >= MAX_RETRIES) return null;
28191
+ failures++;
28192
+ return 0.5 * failures;
28193
+ };
28194
+ return { fetchFn, getRetryDelay };
28195
+ }
28196
+ function reportMediaFetchFailure(error) {
28197
+ if (!(error instanceof MediaFetchError)) return;
28198
+ console.warn(`[Studio] ${error.message}`);
28199
+ }
28200
+
28118
28201
  // src/player/lib/thumbnailVideoDecoder.ts
28119
28202
  var LAST_FRAME_INSET_S = 1e-3;
28120
28203
  function videoThumbnailTimestamps(start, duration, frameCount) {
@@ -28277,6 +28360,7 @@ async function decodeVideoThumbnail(request2, signal, budgets = TIMELINE_VIEWPOR
28277
28360
  return await decodeMissingFrames(request2, signal, budgets, keyOf17, resources);
28278
28361
  } catch (error) {
28279
28362
  releaseDecodedResources(resources);
28363
+ reportMediaFetchFailure(error);
28280
28364
  throw error;
28281
28365
  }
28282
28366
  }
@@ -28284,7 +28368,7 @@ async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources
28284
28368
  const mediabunny = await import("mediabunny");
28285
28369
  throwIfAborted(signal);
28286
28370
  const input = new mediabunny.Input({
28287
- source: new mediabunny.UrlSource(request2.source),
28371
+ source: new mediabunny.UrlSource(request2.source, mediaUrlSourceOptions("thumbnail")),
28288
28372
  formats: mediabunny.ALL_FORMATS
28289
28373
  });
28290
28374
  try {
@@ -29023,7 +29107,9 @@ function usePlaybackKeyboard({
29023
29107
  (deltaFrames) => {
29024
29108
  const adapter = getAdapter();
29025
29109
  const currentTime = adapter?.getTime() ?? usePlayerStore.getState().currentTime;
29026
- seek(stepFrameTime(currentTime, deltaFrames, STUDIO_PREVIEW_FPS));
29110
+ seek(
29111
+ stepFrameTime(currentTime, deltaFrames, useLinkedClipPreferences.getState().compositionFps)
29112
+ );
29027
29113
  },
29028
29114
  [getAdapter, seek]
29029
29115
  );
@@ -31553,6 +31639,9 @@ function applyStudioRotation(element, rotation) {
31553
31639
  );
31554
31640
  }
31555
31641
 
31642
+ // src/player/hooks/useShadowPreviewReload.ts
31643
+ import { refusedPreviewStatus } from "@hyperframes/core/studio-preview-mark";
31644
+
31556
31645
  // src/utils/studioDebug.ts
31557
31646
  function makeStudioDebugLogger(name) {
31558
31647
  let enabled = null;
@@ -31693,7 +31782,9 @@ function useShadowPreviewReload({
31693
31782
  setPreviewReloading(false);
31694
31783
  const message = `The preview did not reload (${cause}). It was still waiting for ${waitingFor}. The previous preview is still showing.`;
31695
31784
  logReload("shadow-failed", { cause, waitingFor });
31696
- console.error(`[studio] ${message}`);
31785
+ const refused = refusedPreviewStatus(cause);
31786
+ const pageMissingNow = refused !== null && refused < 500;
31787
+ (pageMissingNow ? console.warn : console.error)(`[studio] ${message}`);
31697
31788
  onReloadFailedRef.current?.(message);
31698
31789
  },
31699
31790
  [stopPendingShadow, isRefreshingRef, pendingSeekRef]
@@ -32162,7 +32253,7 @@ async function probeOne(url) {
32162
32253
  const mb = await loadMediabunny();
32163
32254
  if (!mb) return null;
32164
32255
  const input = new mb.Input({
32165
- source: new mb.UrlSource(url),
32256
+ source: new mb.UrlSource(url, mediaUrlSourceOptions("probe")),
32166
32257
  formats: mb.ALL_FORMATS
32167
32258
  });
32168
32259
  try {
@@ -32178,7 +32269,8 @@ async function probeOne(url) {
32178
32269
  hasAudio: audioTracks.length > 0
32179
32270
  };
32180
32271
  return result;
32181
- } catch {
32272
+ } catch (error) {
32273
+ reportMediaFetchFailure(error);
32182
32274
  return null;
32183
32275
  } finally {
32184
32276
  input.dispose();
@@ -32294,7 +32386,13 @@ function acceptedPreviewMessage(e, iframe) {
32294
32386
  if (data?.source !== "hf-preview") return null;
32295
32387
  return acceptStudioRuntimeMessage(data) ? data : null;
32296
32388
  }
32297
- function handleStateMessage(deps, iframe, playingHoldsClipListPosts) {
32389
+ function enrichDue(lastTimelineMessage, enriched) {
32390
+ const now2 = Date.now();
32391
+ if (now2 - lastTimelineMessage <= 500 || now2 - enriched.at <= 500) return false;
32392
+ enriched.at = now2;
32393
+ return true;
32394
+ }
32395
+ function handleStateMessage(deps, iframe, playingHoldsClipListPosts, enriched) {
32298
32396
  try {
32299
32397
  if (usePlayerStore.getState().elements.length === 0) {
32300
32398
  const manifest = iframe?.contentWindow?.__clipManifest;
@@ -32302,7 +32400,7 @@ function handleStateMessage(deps, iframe, playingHoldsClipListPosts) {
32302
32400
  deps.processTimelineMessageRef.current(manifest);
32303
32401
  }
32304
32402
  }
32305
- if (!playingHoldsClipListPosts && Date.now() - deps.lastTimelineMessageRef.current > 500) {
32403
+ if (!playingHoldsClipListPosts && enrichDue(deps.lastTimelineMessageRef.current, enriched)) {
32306
32404
  deps.enrichMissingCompositionsRef.current();
32307
32405
  }
32308
32406
  } catch {
@@ -32339,11 +32437,13 @@ function applyStoreReport(data) {
32339
32437
  }
32340
32438
  }
32341
32439
  function createPreviewMessageHandler(deps) {
32440
+ const enriched = { at: 0 };
32342
32441
  return (e) => {
32343
32442
  const iframe = deps.iframeRef.current;
32344
32443
  const data = acceptedPreviewMessage(e, iframe);
32345
32444
  if (!data) return;
32346
- if (data.type === "state") return handleStateMessage(deps, iframe, data.isPlaying === true);
32445
+ if (data.type === "state")
32446
+ return handleStateMessage(deps, iframe, data.isPlaying === true, enriched);
32347
32447
  if (applyStoreReport(data)) return;
32348
32448
  if (data.type === "ready") {
32349
32449
  const level = usePlayerStore.getState().previewQuality;
@@ -37672,7 +37772,7 @@ function OffCanvasIndicators({
37672
37772
  const selectOffCanvas = async () => {
37673
37773
  const el = elements.current.get(r.key);
37674
37774
  if (!el) return;
37675
- const { resolveDomEditSelection: resolveDomEditSelection2 } = await import("./domEditingLayers-WMDSHU5P.js");
37775
+ const { resolveDomEditSelection: resolveDomEditSelection2 } = await import("./domEditingLayers-7Z6J4UOK.js");
37676
37776
  const acp = activeCompositionPathRef.current ?? "index.html";
37677
37777
  const sel = await resolveDomEditSelection2(el, {
37678
37778
  activeCompositionPath: acp,
@@ -50687,7 +50787,7 @@ function getAnimationEditingBlock(isCurrentSelection, diagnostics) {
50687
50787
  }
50688
50788
  return null;
50689
50789
  }
50690
- function describe(selection, deps, isCurrentSelection, resolvedHandle) {
50790
+ function describe2(selection, deps, isCurrentSelection, resolvedHandle) {
50691
50791
  const { capabilities } = selection;
50692
50792
  const gsap3 = deps.getGsapDiagnostics();
50693
50793
  const animations = isCurrentSelection ? gsap3.animations.map(describeAnimation) : [];
@@ -50738,7 +50838,7 @@ async function studioInspect(deps, input = {}) {
50738
50838
  "Pass a handle from studio_look, or call studio_select first."
50739
50839
  );
50740
50840
  }
50741
- return describe(current, deps, true);
50841
+ return describe2(current, deps, true);
50742
50842
  }
50743
50843
  if (!elementHandleMatchesProject(input.handle, deps.getProjectId())) {
50744
50844
  return toolFailure(
@@ -50772,7 +50872,7 @@ async function studioInspect(deps, input = {}) {
50772
50872
  "Call studio_look again."
50773
50873
  );
50774
50874
  }
50775
- return describe(
50875
+ return describe2(
50776
50876
  resolved2.selection,
50777
50877
  deps,
50778
50878
  current?.element === resolved2.selection.element,
@@ -91082,8 +91182,9 @@ function applyRuntimePreview(runtime, time, properties) {
91082
91182
  usePlayerStore.getState().setCurrentTime(seekTime);
91083
91183
  }
91084
91184
  function recordSample(r, time, properties) {
91085
- const frame3 = secondsToFrame(time);
91086
- const sample = { time: frameToSeconds(frame3), properties: { ...properties } };
91185
+ const fps = useLinkedClipPreferences.getState().compositionFps;
91186
+ const frame3 = secondsToFrame(time, fps);
91187
+ const sample = { time: frameToSeconds(frame3, fps), properties: { ...properties } };
91087
91188
  const lastIndex = r.samples.length - 1;
91088
91189
  const lastSample = r.samples[lastIndex];
91089
91190
  if (lastSample?.time === sample.time) {
@@ -91981,7 +92082,7 @@ import { useMemo as useMemo89 } from "react";
91981
92082
  import { memo as memo51, useCallback as useCallback172 } from "react";
91982
92083
 
91983
92084
  // src/components/MediaPreview.tsx
91984
- import { useState as useState137 } from "react";
92085
+ import { useEffect as useEffect138, useState as useState137 } from "react";
91985
92086
  import { encodeUrlPath as encodeUrlPath7 } from "@hyperframes/parsers";
91986
92087
  import { jsx as jsx214, jsxs as jsxs167 } from "react/jsx-runtime";
91987
92088
  function MediaErrorPanel({ name, filePath }) {
@@ -92012,9 +92113,15 @@ function MediaErrorPanel({ name, filePath }) {
92012
92113
  function MediaPreview({ projectId, filePath }) {
92013
92114
  const serveUrl = buildProjectApiPath(projectId, `/preview/${encodeUrlPath7(filePath)}`);
92014
92115
  const name = filePath.split("/").pop() ?? filePath;
92015
- const [failedPath, setFailedPath] = useState137(null);
92016
- const failed2 = failedPath === filePath;
92017
- const setFailed = () => setFailedPath(filePath);
92116
+ const [failure, setFailure] = useState137({
92117
+ source: serveUrl,
92118
+ failed: false
92119
+ });
92120
+ useEffect138(() => {
92121
+ setFailure({ source: serveUrl, failed: false });
92122
+ }, [serveUrl]);
92123
+ const failed2 = failure.source === serveUrl && failure.failed;
92124
+ const setFailed = () => setFailure({ source: serveUrl, failed: true });
92018
92125
  if (failed2) return /* @__PURE__ */ jsx214(MediaErrorPanel, { name, filePath });
92019
92126
  if (IMAGE_EXT.test(filePath)) {
92020
92127
  return /* @__PURE__ */ jsxs167("div", { className: "flex flex-col items-center justify-center h-full p-4 bg-neutral-950", children: [
@@ -92098,7 +92205,7 @@ function MediaPreview({ projectId, filePath }) {
92098
92205
  }
92099
92206
 
92100
92207
  // src/components/sidebar/AssetsTab.tsx
92101
- import { memo as memo48, useState as useState143, useCallback as useCallback168, useRef as useRef174, useMemo as useMemo84, useEffect as useEffect143 } from "react";
92208
+ import { memo as memo48, useState as useState143, useCallback as useCallback168, useRef as useRef174, useMemo as useMemo84, useEffect as useEffect144 } from "react";
92102
92209
 
92103
92210
  // src/components/ui/SearchInput.tsx
92104
92211
  import { jsx as jsx215, jsxs as jsxs168 } from "react/jsx-runtime";
@@ -92209,11 +92316,11 @@ var CATEGORY_LABELS = {
92209
92316
  var FILTER_ORDER = ["audio", "images", "video", "fonts"];
92210
92317
 
92211
92318
  // src/components/sidebar/AudioRow.tsx
92212
- import { useState as useState139, useRef as useRef172, useEffect as useEffect139, useCallback as useCallback166 } from "react";
92319
+ import { useState as useState139, useRef as useRef172, useEffect as useEffect140, useCallback as useCallback166 } from "react";
92213
92320
  import { classifyWebAudioMediaRoute } from "@hyperframes/core/runtime/web-audio-route";
92214
92321
 
92215
92322
  // src/components/sidebar/AssetContextMenu.tsx
92216
- import { useCallback as useCallback165, useEffect as useEffect138, useLayoutEffect as useLayoutEffect14, useRef as useRef171, useState as useState138 } from "react";
92323
+ import { useCallback as useCallback165, useEffect as useEffect139, useLayoutEffect as useLayoutEffect14, useRef as useRef171, useState as useState138 } from "react";
92217
92324
  import { Fragment as Fragment59, jsx as jsx216, jsxs as jsxs169 } from "react/jsx-runtime";
92218
92325
  function isValidAssetName(name) {
92219
92326
  return name.length > 0 && !/[/\\]/.test(name) && !name.includes("..");
@@ -92243,7 +92350,7 @@ function ContextMenu3({
92243
92350
  y: Math.min(y, window.innerHeight - rect.height - margin)
92244
92351
  });
92245
92352
  }, [x, y, mode]);
92246
- useEffect138(() => {
92353
+ useEffect139(() => {
92247
92354
  const onKeyDown = (e) => {
92248
92355
  if (e.key === "Escape") {
92249
92356
  e.stopPropagation();
@@ -92268,7 +92375,7 @@ function ContextMenu3({
92268
92375
  document.addEventListener("keydown", onKeyDown, true);
92269
92376
  return () => document.removeEventListener("keydown", onKeyDown, true);
92270
92377
  }, [mode, onClose]);
92271
- useEffect138(() => {
92378
+ useEffect139(() => {
92272
92379
  if (mode === "menu") {
92273
92380
  menuRef.current?.querySelector('[role="menuitem"]')?.focus();
92274
92381
  }
@@ -92535,7 +92642,7 @@ function AudioRow({
92535
92642
  },
92536
92643
  [activateRow]
92537
92644
  );
92538
- useEffect139(() => {
92645
+ useEffect140(() => {
92539
92646
  return () => {
92540
92647
  cancelAnimationFrame(animRef.current);
92541
92648
  audioRef.current?.pause();
@@ -92543,7 +92650,7 @@ function AudioRow({
92543
92650
  if (stopCurrentPreview === stopPlayback) stopCurrentPreview = null;
92544
92651
  };
92545
92652
  }, [stopPlayback]);
92546
- useEffect139(() => {
92653
+ useEffect140(() => {
92547
92654
  if (playing) {
92548
92655
  const barCount = 24;
92549
92656
  const loop = () => {
@@ -92710,7 +92817,7 @@ function AudioRow({
92710
92817
  }
92711
92818
 
92712
92819
  // src/components/sidebar/GlobalAssetsView.tsx
92713
- import { useEffect as useEffect140, useMemo as useMemo83, useState as useState140 } from "react";
92820
+ import { useEffect as useEffect141, useMemo as useMemo83, useState as useState140 } from "react";
92714
92821
  import { jsx as jsx218, jsxs as jsxs171 } from "react/jsx-runtime";
92715
92822
  function globalAssetRows(records, query = "") {
92716
92823
  const q = query.trim().toLowerCase();
@@ -92726,7 +92833,7 @@ function globalAssetRows(records, query = "") {
92726
92833
  }
92727
92834
  function GlobalAssetsView({ searchQuery }) {
92728
92835
  const [records, setRecords] = useState140(null);
92729
- useEffect140(() => {
92836
+ useEffect141(() => {
92730
92837
  let cancelled = false;
92731
92838
  studioApiFetch("/api/assets/global").then((r) => r.ok ? r.json() : { assets: [] }).then((d) => {
92732
92839
  if (!cancelled) setRecords(Array.isArray(d.assets) ? d.assets : []);
@@ -92769,10 +92876,10 @@ function GlobalAssetsView({ searchQuery }) {
92769
92876
  }
92770
92877
 
92771
92878
  // src/components/sidebar/AssetCard.tsx
92772
- import { useState as useState142, useEffect as useEffect142, useRef as useRef173, useCallback as useCallback167 } from "react";
92879
+ import { useState as useState142, useEffect as useEffect143, useRef as useRef173, useCallback as useCallback167 } from "react";
92773
92880
 
92774
92881
  // src/components/ui/VideoFrameThumbnail.tsx
92775
- import { useState as useState141, useEffect as useEffect141 } from "react";
92882
+ import { useState as useState141, useEffect as useEffect142 } from "react";
92776
92883
  import { jsx as jsx219 } from "react/jsx-runtime";
92777
92884
  function VideoFrameThumbnail({
92778
92885
  src,
@@ -92780,7 +92887,7 @@ function VideoFrameThumbnail({
92780
92887
  }) {
92781
92888
  const [frame3, setFrame] = useState141(null);
92782
92889
  const [failed2, setFailed] = useState141(false);
92783
- useEffect141(() => {
92890
+ useEffect142(() => {
92784
92891
  setFailed(false);
92785
92892
  const video = document.createElement("video");
92786
92893
  video.crossOrigin = "anonymous";
@@ -92847,7 +92954,7 @@ function openAssetContextMenu(e, setContextMenu) {
92847
92954
  }
92848
92955
  function useProbedDuration(src, skip) {
92849
92956
  const [duration, setDuration] = useState142(void 0);
92850
- useEffect142(() => {
92957
+ useEffect143(() => {
92851
92958
  if (skip) return;
92852
92959
  let cancelled = false;
92853
92960
  let retryTimer;
@@ -93246,7 +93353,7 @@ var AssetsTab = memo48(function AssetsTab2({
93246
93353
  const [manifest, setManifest] = useState143(/* @__PURE__ */ new Map());
93247
93354
  const manifest404Ref = useRef174(/* @__PURE__ */ new Set());
93248
93355
  const assetsKey = assets.join("|");
93249
- useEffect143(() => {
93356
+ useEffect144(() => {
93250
93357
  if (manifest404Ref.current.has(projectId)) return;
93251
93358
  let cancelled = false;
93252
93359
  studioApiFetch(buildProjectApiPath(projectId, `/preview/.media/manifest.jsonl`)).then((r) => {
@@ -93503,11 +93610,11 @@ var AssetsTab = memo48(function AssetsTab2({
93503
93610
  });
93504
93611
 
93505
93612
  // src/components/sidebar/BlocksTab.tsx
93506
- import { memo as memo49, useState as useState145, useCallback as useCallback170, useRef as useRef176, useEffect as useEffect145 } from "react";
93613
+ import { memo as memo49, useState as useState145, useCallback as useCallback170, useRef as useRef176, useEffect as useEffect146 } from "react";
93507
93614
  import { createPortal as createPortal14 } from "react-dom";
93508
93615
 
93509
93616
  // src/components/sidebar/PromptPreviewModal.tsx
93510
- import { useState as useState144, useCallback as useCallback169, useEffect as useEffect144, useRef as useRef175 } from "react";
93617
+ import { useState as useState144, useCallback as useCallback169, useEffect as useEffect145, useRef as useRef175 } from "react";
93511
93618
  import { jsx as jsx222, jsxs as jsxs174 } from "react/jsx-runtime";
93512
93619
  function PromptPreviewModal({
93513
93620
  title,
@@ -93527,7 +93634,7 @@ function PromptPreviewModal({
93527
93634
  containerRef,
93528
93635
  canClose: () => valueRef.current === prompt
93529
93636
  });
93530
- useEffect144(() => {
93637
+ useEffect145(() => {
93531
93638
  requestAnimationFrame(() => {
93532
93639
  setEntered(true);
93533
93640
  textareaRef.current?.focus();
@@ -93595,6 +93702,7 @@ function PromptPreviewModal({
93595
93702
  "textarea",
93596
93703
  {
93597
93704
  ref: textareaRef,
93705
+ "aria-label": "Prompt",
93598
93706
  value,
93599
93707
  onChange: (e) => setValue(e.target.value),
93600
93708
  onKeyDown: (e) => {
@@ -93833,7 +93941,7 @@ function BlockCard({
93833
93941
  setHovered(false);
93834
93942
  onPreview?.(null);
93835
93943
  }, [onPreview]);
93836
- useEffect145(() => {
93944
+ useEffect146(() => {
93837
93945
  return () => {
93838
93946
  if (hoverTimer.current) clearTimeout(hoverTimer.current);
93839
93947
  };
@@ -93994,7 +94102,7 @@ function BlockCard({
93994
94102
  }
93995
94103
 
93996
94104
  // src/components/sidebar/CompositionsTab.tsx
93997
- import { memo as memo50, useCallback as useCallback171, useEffect as useEffect146, useLayoutEffect as useLayoutEffect15, useMemo as useMemo85, useRef as useRef177, useState as useState146 } from "react";
94105
+ import { memo as memo50, useCallback as useCallback171, useEffect as useEffect147, useLayoutEffect as useLayoutEffect15, useMemo as useMemo85, useRef as useRef177, useState as useState146 } from "react";
93998
94106
  import { jsx as jsx224, jsxs as jsxs176 } from "react/jsx-runtime";
93999
94107
  var DEFAULT_PREVIEW_STAGE = { width: 1920, height: 1080 };
94000
94108
  var CARD_W = 80;
@@ -94073,7 +94181,7 @@ function useLastFrame(request2, snapshot3) {
94073
94181
  function useNearViewport() {
94074
94182
  const [element, setElement] = useState146(null);
94075
94183
  const [near4, setNear] = useState146(false);
94076
- useEffect146(() => {
94184
+ useEffect147(() => {
94077
94185
  if (!element || near4) return;
94078
94186
  if (typeof IntersectionObserver === "undefined") return setNear(true);
94079
94187
  const observer = new IntersectionObserver(
@@ -94154,13 +94262,13 @@ function CompCard({
94154
94262
  });
94155
94263
  const thumbnailOffsetX = (CARD_W - stageSize.width * previewScale) / 2;
94156
94264
  const thumbnailOffsetY = (CARD_H - stageSize.height * previewScale) / 2;
94157
- useEffect146(() => {
94265
+ useEffect147(() => {
94158
94266
  if (hovered) requestIframePlaybackSync(true);
94159
94267
  }, [hovered, requestIframePlaybackSync]);
94160
- useEffect146(() => {
94268
+ useEffect147(() => {
94161
94269
  if (livePreviewLoaded) postFrameDisplayScale(iframeRef.current);
94162
94270
  }, [livePreviewLoaded, previewScale]);
94163
- useEffect146(() => {
94271
+ useEffect147(() => {
94164
94272
  if (!hovered) return;
94165
94273
  const onRuntimeReady = (event) => {
94166
94274
  const frame3 = iframeRef.current;
@@ -94171,7 +94279,7 @@ function CompCard({
94171
94279
  window.addEventListener("message", onRuntimeReady);
94172
94280
  return () => window.removeEventListener("message", onRuntimeReady);
94173
94281
  }, [hovered]);
94174
- useEffect146(() => {
94282
+ useEffect147(() => {
94175
94283
  return () => {
94176
94284
  if (hoverTimer.current) clearTimeout(hoverTimer.current);
94177
94285
  if (syncTimer.current) clearTimeout(syncTimer.current);
@@ -94650,7 +94758,7 @@ function CodeBody({
94650
94758
  import { memo as memo62, useCallback as useCallback190 } from "react";
94651
94759
 
94652
94760
  // src/components/editor/LayersPanel.tsx
94653
- import { memo as memo52, useState as useState148, useCallback as useCallback174, useEffect as useEffect147, useRef as useRef179 } from "react";
94761
+ import { memo as memo52, useState as useState148, useCallback as useCallback174, useEffect as useEffect148, useRef as useRef179 } from "react";
94654
94762
 
94655
94763
  // src/components/editor/layerKind.ts
94656
94764
  function isCompositionHost(el) {
@@ -94969,10 +95077,10 @@ var LayersPanel = memo52(function LayersPanel2({ host }) {
94969
95077
  );
94970
95078
  setLayers(sortLayersByZIndex(items));
94971
95079
  }, [previewIframeRef, activeCompPath, isMasterView, activeGroupElement, setActiveGroupElement]);
94972
- useEffect147(() => {
95080
+ useEffect148(() => {
94973
95081
  collectLayers();
94974
95082
  }, [collectLayers, refreshKey, zEditVersion, livePreviewIframe]);
94975
- useEffect147(() => {
95083
+ useEffect148(() => {
94976
95084
  const iframe = previewIframeRef.current;
94977
95085
  if (!iframe) return;
94978
95086
  const handleLoad = () => {
@@ -94981,13 +95089,13 @@ var LayersPanel = memo52(function LayersPanel2({ host }) {
94981
95089
  };
94982
95090
  return onPreviewContentReplaced(iframe, handleLoad);
94983
95091
  }, [previewIframeRef, livePreviewIframe, collectLayers]);
94984
- useEffect147(() => {
95092
+ useEffect148(() => {
94985
95093
  if (!compositionLoading) {
94986
95094
  const timer = setTimeout(collectLayers, 100);
94987
95095
  return () => clearTimeout(timer);
94988
95096
  }
94989
95097
  }, [compositionLoading, collectLayers]);
94990
- useEffect147(() => {
95098
+ useEffect148(() => {
94991
95099
  const throttle = createRafThrottle(collectLayers, 100);
94992
95100
  const unsubscribe = liveTime.subscribe(throttle.invoke);
94993
95101
  return () => {
@@ -95280,7 +95388,7 @@ import { memo as memo54, useCallback as useCallback176, useState as useState150
95280
95388
  import { memo as memo53, useCallback as useCallback175 } from "react";
95281
95389
 
95282
95390
  // src/captions/components/shared.tsx
95283
- import { useEffect as useEffect148, useRef as useRef180, useState as useState149 } from "react";
95391
+ import { useEffect as useEffect149, useRef as useRef180, useState as useState149 } from "react";
95284
95392
  import { jsx as jsx229, jsxs as jsxs180 } from "react/jsx-runtime";
95285
95393
  var inputCls = "w-full bg-neutral-900 border border-neutral-800 rounded-sm px-1.5 py-0.5 text-2xs text-neutral-200 font-mono outline-hidden focus:border-studio-accent disabled:opacity-40 disabled:cursor-not-allowed";
95286
95394
  function Section2({ label, children }) {
@@ -95307,7 +95415,7 @@ function NumberField2({
95307
95415
  }) {
95308
95416
  const [draft, setDraft] = useState149(null);
95309
95417
  const focusedRef = useRef180(false);
95310
- useEffect148(() => {
95418
+ useEffect149(() => {
95311
95419
  if (!focusedRef.current) setDraft(null);
95312
95420
  }, [value]);
95313
95421
  const display2 = draft !== null ? draft : mixed ? "" : String(value ?? 0);
@@ -95799,7 +95907,7 @@ var CaptionPropertyPanel = memo54(function CaptionPropertyPanel2({
95799
95907
  });
95800
95908
 
95801
95909
  // src/components/editor/BlockParamsPanel.tsx
95802
- import { memo as memo55, useCallback as useCallback177, useEffect as useEffect149, useRef as useRef181, useState as useState151 } from "react";
95910
+ import { memo as memo55, useCallback as useCallback177, useEffect as useEffect150, useRef as useRef181, useState as useState151 } from "react";
95803
95911
  import { jsx as jsx232, jsxs as jsxs183 } from "react/jsx-runtime";
95804
95912
  var BlockParamsPanel = memo55(function BlockParamsPanel2({
95805
95913
  blockName,
@@ -95901,7 +96009,7 @@ var BlockParamsPanel = memo55(function BlockParamsPanel2({
95901
96009
  }
95902
96010
  commitTimersRef.current.clear();
95903
96011
  };
95904
- useEffect149(() => () => flushRef.current(), []);
96012
+ useEffect150(() => () => flushRef.current(), []);
95905
96013
  return /* @__PURE__ */ jsxs183("div", { className: "flex flex-col h-full", children: [
95906
96014
  /* @__PURE__ */ jsxs183("div", { className: "flex items-center justify-between px-3 py-2 border-b border-neutral-800", children: [
95907
96015
  /* @__PURE__ */ jsx232("div", { className: "text-[11px] font-semibold text-neutral-200 truncate", children: blockTitle }),
@@ -96033,7 +96141,7 @@ function ParamControl({
96033
96141
  import { memo as memo59 } from "react";
96034
96142
 
96035
96143
  // src/components/renders/RenderQueue.tsx
96036
- import { memo as memo58, useState as useState154, useRef as useRef183, useEffect as useEffect151, useLayoutEffect as useLayoutEffect16, useId as useId4 } from "react";
96144
+ import { memo as memo58, useState as useState154, useRef as useRef183, useEffect as useEffect152, useLayoutEffect as useLayoutEffect16, useId as useId4 } from "react";
96037
96145
  import { createPortal as createPortal15 } from "react-dom";
96038
96146
  import { CANVAS_DIMENSIONS } from "@hyperframes/parsers";
96039
96147
 
@@ -96314,7 +96422,7 @@ var RenderQueueItem = memo56(function RenderQueueItem2({
96314
96422
  });
96315
96423
 
96316
96424
  // src/components/renders/FfmpegRequiredNotice.tsx
96317
- import { memo as memo57, useEffect as useEffect150, useRef as useRef182, useState as useState153 } from "react";
96425
+ import { memo as memo57, useEffect as useEffect151, useRef as useRef182, useState as useState153 } from "react";
96318
96426
  import { jsx as jsx236, jsxs as jsxs188 } from "react/jsx-runtime";
96319
96427
  var DOWNLOAD_URL = "https://ffmpeg.org/download.html";
96320
96428
  var CUE_MS = 1600;
@@ -96328,16 +96436,16 @@ var FfmpegRequiredNotice = memo57(function FfmpegRequiredNotice2({
96328
96436
  const [recheckFailed, setRecheckFailed] = useState153(false);
96329
96437
  const wasChecking = useRef182(false);
96330
96438
  const cueTimer = useRef182(void 0);
96331
- useEffect150(() => {
96439
+ useEffect151(() => {
96332
96440
  if (wasChecking.current && !checking) setRecheckFailed(true);
96333
96441
  wasChecking.current = checking;
96334
96442
  }, [checking]);
96335
- useEffect150(() => {
96443
+ useEffect151(() => {
96336
96444
  if (!recheckFailed) return;
96337
96445
  cueTimer.current = setTimeout(() => setRecheckFailed(false), CUE_MS);
96338
96446
  return () => clearTimeout(cueTimer.current);
96339
96447
  }, [recheckFailed]);
96340
- useEffect150(() => () => clearTimeout(cueTimer.current), []);
96448
+ useEffect151(() => () => clearTimeout(cueTimer.current), []);
96341
96449
  const copy = async (command) => {
96342
96450
  const ok = await copyTextToClipboard(command);
96343
96451
  if (!ok) return;
@@ -96522,7 +96630,7 @@ function FormatInfoTooltip({ format }) {
96522
96630
  const hide = () => {
96523
96631
  timeoutRef.current = setTimeout(() => setOpen(false), 120);
96524
96632
  };
96525
- useEffect151(() => () => clearTimeout(timeoutRef.current), []);
96633
+ useEffect152(() => () => clearTimeout(timeoutRef.current), []);
96526
96634
  useLayoutEffect16(() => {
96527
96635
  if (!open) return;
96528
96636
  const el = triggerRef.current;
@@ -96536,7 +96644,7 @@ function FormatInfoTooltip({ format }) {
96536
96644
  )
96537
96645
  );
96538
96646
  }, [open]);
96539
- useEffect151(() => {
96647
+ useEffect152(() => {
96540
96648
  if (!open) return;
96541
96649
  const onKeyDown = (e) => {
96542
96650
  if (e.key === "Escape") setOpen(false);
@@ -96787,7 +96895,7 @@ var RenderQueue = memo58(function RenderQueue2({
96787
96895
  onRecheckFfmpeg
96788
96896
  }) {
96789
96897
  const listRef = useRef183(null);
96790
- useEffect151(() => {
96898
+ useEffect152(() => {
96791
96899
  if (listRef.current) {
96792
96900
  listRef.current.scrollTo({ top: listRef.current.scrollHeight, behavior: "smooth" });
96793
96901
  }
@@ -96943,7 +97051,7 @@ var RenderQueuePanel = memo59(function RenderQueuePanel2() {
96943
97051
  });
96944
97052
 
96945
97053
  // src/components/panels/SlideshowPanel.tsx
96946
- import { useState as useState156, useEffect as useEffect152, useCallback as useCallback180, useRef as useRef184 } from "react";
97054
+ import { useState as useState156, useEffect as useEffect153, useCallback as useCallback180, useRef as useRef184 } from "react";
96947
97055
  import { parseSlideshowManifest } from "@hyperframes/core/slideshow";
96948
97056
 
96949
97057
  // src/components/panels/SlideshowSubPanels.tsx
@@ -97639,7 +97747,7 @@ function SlideshowPanel({ scenes, onPersist, onPersistNotes }) {
97639
97747
  const { domEditSelection } = useDomEditSelectionContext();
97640
97748
  const manifestRef = useRef184(manifest);
97641
97749
  const notesCtrlRef = useRef184(makeSlideshowNotesController());
97642
- useEffect152(() => {
97750
+ useEffect153(() => {
97643
97751
  if (!compHtml) {
97644
97752
  notesCtrlRef.current.flush();
97645
97753
  setManifest({ slides: [] });
@@ -97701,7 +97809,7 @@ function SlideshowPanel({ scenes, onPersist, onPersistNotes }) {
97701
97809
  },
97702
97810
  [onPersistNotes]
97703
97811
  );
97704
- useEffect152(() => {
97812
+ useEffect153(() => {
97705
97813
  const ctrl = notesCtrlRef.current;
97706
97814
  return () => {
97707
97815
  ctrl.flush();
@@ -97960,7 +98068,7 @@ function SlideshowPanel({ scenes, onPersist, onPersistNotes }) {
97960
98068
  }
97961
98069
 
97962
98070
  // src/components/panels/VariablesPanel.tsx
97963
- import { memo as memo60, useCallback as useCallback184, useEffect as useEffect154, useMemo as useMemo86, useState as useState160 } from "react";
98071
+ import { memo as memo60, useCallback as useCallback184, useEffect as useEffect155, useMemo as useMemo86, useState as useState160 } from "react";
97964
98072
 
97965
98073
  // src/hooks/useVariablesPersist.ts
97966
98074
  import { useCallback as useCallback181 } from "react";
@@ -98011,7 +98119,7 @@ function useVariablesPersist({
98011
98119
  import { useCallback as useCallback183, useState as useState159 } from "react";
98012
98120
 
98013
98121
  // src/hooks/useProjectCompositionVariables.ts
98014
- import { useCallback as useCallback182, useEffect as useEffect153, useState as useState157 } from "react";
98122
+ import { useCallback as useCallback182, useEffect as useEffect154, useState as useState157 } from "react";
98015
98123
  import { openComposition as openComposition4 } from "@hyperframes/sdk";
98016
98124
  async function readGroup(path, readProjectFile) {
98017
98125
  let content;
@@ -98035,7 +98143,7 @@ async function readGroup(path, readProjectFile) {
98035
98143
  }
98036
98144
  function useProjectCompositionVariables(compositionPaths, excludePath, readProjectFile, refreshKey) {
98037
98145
  const [groups, setGroups] = useState157([]);
98038
- useEffect153(() => {
98146
+ useEffect154(() => {
98039
98147
  let cancelled = false;
98040
98148
  const htmlFiles = compositionPaths.filter((p) => p !== excludePath);
98041
98149
  void (async () => {
@@ -98658,7 +98766,7 @@ var VariablesPanel = memo60(function VariablesPanel2({
98658
98766
  const previewValues = usePreviewVariablesStore((s) => s.values);
98659
98767
  const setPreviewValues = usePreviewVariablesStore((s) => s.setValues);
98660
98768
  const [revision, setRevision] = useState160(0);
98661
- useEffect154(() => {
98769
+ useEffect155(() => {
98662
98770
  if (!sdkSession) return;
98663
98771
  return sdkSession.on("change", () => setRevision((r) => r + 1));
98664
98772
  }, [sdkSession]);
@@ -98913,7 +99021,7 @@ var VariablesPanel = memo60(function VariablesPanel2({
98913
99021
  });
98914
99022
 
98915
99023
  // src/components/panels/MotionBlurPanel.tsx
98916
- import { memo as memo61, useCallback as useCallback185, useEffect as useEffect155, useMemo as useMemo87, useReducer as useReducer2, useRef as useRef185, useState as useState161 } from "react";
99024
+ import { memo as memo61, useCallback as useCallback185, useEffect as useEffect156, useMemo as useMemo87, useReducer as useReducer2, useRef as useRef185, useState as useState161 } from "react";
98917
99025
 
98918
99026
  // src/components/panels/motionBlurPanelModel.ts
98919
99027
  import {
@@ -98983,7 +99091,7 @@ var NothingToChange = class extends Error {
98983
99091
  function useLivePreviewAttributes(previewIframeRef, refreshKey) {
98984
99092
  const [live, setLive] = useState161(null);
98985
99093
  const holdUntil = useRef185(0);
98986
- useEffect155(() => {
99094
+ useEffect156(() => {
98987
99095
  const read2 = () => {
98988
99096
  const found = readPreviewRootAttributes(previewIframeRef.current);
98989
99097
  if (found && Date.now() >= holdUntil.current) {
@@ -99011,7 +99119,7 @@ var MotionBlurPanel = memo61(function MotionBlurPanel2({
99011
99119
  const { readProjectFile, writeProjectFile, compositions } = useFileManagerContext();
99012
99120
  const [, rerender] = useReducer2((n) => n + 1, 0);
99013
99121
  const [live, hold] = useLivePreviewAttributes(previewIframeRef, refreshKey);
99014
- useEffect155(() => sdkSession?.on("change", rerender), [sdkSession]);
99122
+ useEffect156(() => sdkSession?.on("change", rerender), [sdkSession]);
99015
99123
  const root = sdkSession ? findCompositionRoot(sdkSession.getRootElements()) : null;
99016
99124
  const attributes = live ?? root?.attributes ?? null;
99017
99125
  const settings = useMemo87(() => attributes ? settingsOf(attributes) : null, [attributes]);
@@ -99239,7 +99347,7 @@ function DesignPanelPromoteProvider({
99239
99347
  }
99240
99348
 
99241
99349
  // src/hooks/useRemoveBackground.ts
99242
- import { useCallback as useCallback188, useEffect as useEffect156, useRef as useRef186 } from "react";
99350
+ import { useCallback as useCallback188, useEffect as useEffect157, useRef as useRef186 } from "react";
99243
99351
 
99244
99352
  // src/components/studioMediaJobs.ts
99245
99353
  var MEDIA_JOB_RECONNECT_TIMEOUT_MS = 15e3;
@@ -99346,7 +99454,7 @@ function waitForMediaJob(jobId, onProgress, signal) {
99346
99454
  // src/hooks/useRemoveBackground.ts
99347
99455
  function useRemoveBackground(projectId, refreshFileTree, showToast) {
99348
99456
  const abortRef = useRef186(null);
99349
- useEffect156(
99457
+ useEffect157(
99350
99458
  () => () => {
99351
99459
  abortRef.current?.abort();
99352
99460
  },
@@ -99812,7 +99920,7 @@ function useStudioSidePanels(left, right, projectId) {
99812
99920
  }
99813
99921
 
99814
99922
  // src/components/TimelineToolbar.tsx
99815
- import { memo as memo63, useEffect as useEffect158, useRef as useRef187 } from "react";
99923
+ import { memo as memo63, useEffect as useEffect159, useRef as useRef187 } from "react";
99816
99924
  import {
99817
99925
  ArrowsOutLineHorizontal,
99818
99926
  FrameCorners as FrameCorners2,
@@ -99823,7 +99931,7 @@ import {
99823
99931
  } from "@phosphor-icons/react";
99824
99932
 
99825
99933
  // src/hooks/useKeyframeKeyboard.ts
99826
- import { useEffect as useEffect157, useCallback as useCallback191 } from "react";
99934
+ import { useEffect as useEffect158, useCallback as useCallback191 } from "react";
99827
99935
  function useKeyframeKeyboard({ enabled, onAddKeyframe }) {
99828
99936
  const handler = useCallback191(
99829
99937
  (e) => {
@@ -99837,7 +99945,7 @@ function useKeyframeKeyboard({ enabled, onAddKeyframe }) {
99837
99945
  },
99838
99946
  [enabled, onAddKeyframe]
99839
99947
  );
99840
- useEffect157(() => {
99948
+ useEffect158(() => {
99841
99949
  if (!enabled) return;
99842
99950
  window.addEventListener("keydown", handler, { capture: true });
99843
99951
  return () => window.removeEventListener("keydown", handler, { capture: true });
@@ -100189,10 +100297,10 @@ var TimelineToolbar = memo63(function TimelineToolbar2({
100189
100297
  enabled: showKeyframes && Boolean(onToggleKeyframe),
100190
100298
  onAddKeyframe: onToggleKeyframe
100191
100299
  });
100192
- useEffect158(() => {
100300
+ useEffect159(() => {
100193
100301
  if (!showKeyframes) setAutoKeyframeEnabled(false);
100194
100302
  }, [showKeyframes, setAutoKeyframeEnabled]);
100195
- useEffect158(() => {
100303
+ useEffect159(() => {
100196
100304
  const onKeyDown = (e) => {
100197
100305
  if (e.key !== "n" && e.key !== "N") return;
100198
100306
  if (e.metaKey || e.ctrlKey || e.altKey) return;
@@ -100490,7 +100598,7 @@ function StudioSplash({ waiting }) {
100490
100598
  }
100491
100599
 
100492
100600
  // src/hooks/useServerConnection.ts
100493
- import { useEffect as useEffect159, useState as useState163 } from "react";
100601
+ import { useEffect as useEffect160, useState as useState163 } from "react";
100494
100602
  async function resolveHashProject(id) {
100495
100603
  try {
100496
100604
  const res = await studioApiFetch(`/api/projects/${encodeURIComponent(id)}`);
@@ -100564,7 +100672,7 @@ function useServerConnection() {
100564
100672
  if (retryTimer !== null) clearTimeout(retryTimer);
100565
100673
  };
100566
100674
  });
100567
- useEffect159(() => {
100675
+ useEffect160(() => {
100568
100676
  const onHashChange = () => {
100569
100677
  const next = parseProjectIdFromHash(window.location.hash);
100570
100678
  if (!next || next === projectId) return;
@@ -100590,9 +100698,9 @@ function useServerConnection() {
100590
100698
  }
100591
100699
 
100592
100700
  // src/hooks/useStudioSessionStart.ts
100593
- import { useEffect as useEffect160 } from "react";
100701
+ import { useEffect as useEffect161 } from "react";
100594
100702
  function useStudioSessionStart(projectId, resolving, waitingForServer) {
100595
- useEffect160(() => {
100703
+ useEffect161(() => {
100596
100704
  if (resolving || waitingForServer || hasFiredSessionStart()) return;
100597
100705
  markSessionStartFired();
100598
100706
  trackStudioSessionStart({ has_project: projectId != null });
@@ -100619,7 +100727,7 @@ function useTimelineAddAtPlayhead(addAsset, addComposition, projectId) {
100619
100727
  import { useState as useState164 } from "react";
100620
100728
 
100621
100729
  // src/hooks/useHydrateActiveCompPathFromUrl.ts
100622
- import { useEffect as useEffect161 } from "react";
100730
+ import { useEffect as useEffect162 } from "react";
100623
100731
  function useHydrateActiveCompPathFromUrl({
100624
100732
  hydrated,
100625
100733
  fileTreeLoaded,
@@ -100628,7 +100736,7 @@ function useHydrateActiveCompPathFromUrl({
100628
100736
  setActiveCompPath,
100629
100737
  setHydrated
100630
100738
  }) {
100631
- useEffect161(() => {
100739
+ useEffect162(() => {
100632
100740
  if (hydrated) return;
100633
100741
  if (!fileTreeLoaded) return;
100634
100742
  const nextCompPath = normalizeStudioCompositionPath(
@@ -100641,7 +100749,7 @@ function useHydrateActiveCompPathFromUrl({
100641
100749
  }
100642
100750
 
100643
100751
  // src/hooks/useAutoOpenRootComposition.ts
100644
- import { useEffect as useEffect162, useRef as useRef188 } from "react";
100752
+ import { useEffect as useEffect163, useRef as useRef188 } from "react";
100645
100753
  function useAutoOpenRootComposition({
100646
100754
  projectId,
100647
100755
  activeCompPath,
@@ -100650,7 +100758,7 @@ function useAutoOpenRootComposition({
100650
100758
  onSelectComposition
100651
100759
  }) {
100652
100760
  const settledForProjectRef = useRef188(void 0);
100653
- useEffect162(() => {
100761
+ useEffect163(() => {
100654
100762
  if (settledForProjectRef.current === projectId) return;
100655
100763
  if (!activeCompPathHydrated) return;
100656
100764
  if (activeCompPath !== null) {