@hyperframes/studio 0.8.209 → 0.8.211

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 (32) hide show
  1. package/dist/assets/{hyperframes-player-CMH8OeX2.js → hyperframes-player-CzrqgMUX.js} +1 -1
  2. package/dist/assets/{index-DjHzuJGR.js → index-B3SPHPi1.js} +1 -1
  3. package/dist/assets/{index-CYbvOVp-.css → index-RUPGNyct.css} +1 -1
  4. package/dist/assets/{index-DQam8zzE.js → index-k4nVfS2D.js} +123 -123
  5. package/dist/{chunk-HPIJDMWG.js → chunk-HD6NXWGI.js} +6 -5
  6. package/dist/index.d.ts +4 -0
  7. package/dist/index.html +2 -2
  8. package/dist/index.js +485 -241
  9. package/dist/player.js +1 -1
  10. package/dist/styles.css +1 -1
  11. package/package.json +8 -8
  12. package/src/components/DesktopGuideCard.tsx +1 -1
  13. package/src/components/nle/NLEPreview.test.ts +9 -0
  14. package/src/components/nle/NLEPreview.tsx +1 -1
  15. package/src/player/components/Player.test.ts +10 -0
  16. package/src/player/components/Player.tsx +0 -12
  17. package/src/player/components/VideoThumbnail.tsx +6 -0
  18. package/src/player/hooks/previewMessageRouter.test.ts +4 -0
  19. package/src/player/lib/mediaFetch.test.ts +466 -0
  20. package/src/player/lib/mediaFetch.ts +133 -26
  21. package/src/player/lib/thumbnailFrameCache.ts +69 -0
  22. package/src/player/lib/thumbnailPlaybackHold.test.ts +86 -0
  23. package/src/player/lib/thumbnailPlaybackHold.ts +15 -0
  24. package/src/player/lib/thumbnailScheduler.test.ts +49 -0
  25. package/src/player/lib/thumbnailScheduler.ts +22 -6
  26. package/src/player/lib/thumbnailSourcePool.ts +163 -0
  27. package/src/player/lib/thumbnailVideoDecoder.test.ts +492 -8
  28. package/src/player/lib/thumbnailVideoDecoder.ts +67 -75
  29. package/src/player/lib/timelineViewportBudgets.test.ts +1 -0
  30. package/src/player/lib/timelineViewportBudgets.ts +4 -0
  31. package/src/player/store/previewQualitySlice.ts +11 -0
  32. package/src/styles/hex-baseline.json +0 -1
package/dist/index.js CHANGED
@@ -54,7 +54,7 @@ import {
54
54
  whenPreviewBooted,
55
55
  writeStudioUiPreferences,
56
56
  zoomToSelectedClips
57
- } from "./chunk-HPIJDMWG.js";
57
+ } from "./chunk-HD6NXWGI.js";
58
58
  import {
59
59
  Button,
60
60
  ContextMenu,
@@ -2359,6 +2359,8 @@ var TIMELINE_VIEWPORT_BUDGETS = Object.freeze({
2359
2359
  concurrentServerPages: 1,
2360
2360
  thumbnailLoadTimeoutMs: 3e4,
2361
2361
  thumbnailCacheBytes: 64 * MEBIBYTE,
2362
+ sharedFrameCacheBytes: 32 * MEBIBYTE,
2363
+ thumbnailSourceIdleMs: 1e4,
2362
2364
  thumbnailCacheEntries: 256,
2363
2365
  thumbnailCacheEntriesPerProject: 96,
2364
2366
  metadataRegistryEntries: 512,
@@ -3356,13 +3358,13 @@ function resolveBlockedTimelineEditIntent(input) {
3356
3358
  return "move";
3357
3359
  }
3358
3360
  function buildTimelineAgentPrompt({
3359
- rangeStart,
3361
+ rangeStart: rangeStart2,
3360
3362
  rangeEnd,
3361
3363
  elements,
3362
3364
  prompt
3363
3365
  }) {
3364
- const start = Math.min(rangeStart, rangeEnd);
3365
- const end = Math.max(rangeStart, rangeEnd);
3366
+ const start = Math.min(rangeStart2, rangeEnd);
3367
+ const end = Math.max(rangeStart2, rangeEnd);
3366
3368
  const elementLines = elements.map(
3367
3369
  (el) => `- #${el.id} (${el.tag}) - ${formatTime(el.start)} to ${formatTime(el.start + el.duration)}, track ${el.track}`
3368
3370
  ).join("\n");
@@ -6585,12 +6587,12 @@ function EaseTypeDropdown({
6585
6587
  label,
6586
6588
  onSelect
6587
6589
  }) {
6588
- const [open, setOpen] = useState6(false);
6590
+ const [open2, setOpen] = useState6(false);
6589
6591
  const triggerRef = useRef9(null);
6590
6592
  const menuRef = useRef9(null);
6591
6593
  const menuId = useId2();
6592
6594
  useEffect9(() => {
6593
- if (!open) return;
6595
+ if (!open2) return;
6594
6596
  const menu = menuRef.current;
6595
6597
  const selected = menu?.querySelector('[role="menuitemradio"][aria-checked="true"]') ?? menu?.querySelector('[role="menuitemradio"]');
6596
6598
  selected?.focus();
@@ -6613,7 +6615,7 @@ function EaseTypeDropdown({
6613
6615
  document.removeEventListener("pointerdown", closeOutside);
6614
6616
  document.removeEventListener("keydown", closeOnEscape);
6615
6617
  };
6616
- }, [open]);
6618
+ }, [open2]);
6617
6619
  const handleMenuKeyDown = (event) => {
6618
6620
  if (event.key === "Tab") {
6619
6621
  setOpen(false);
@@ -6644,8 +6646,8 @@ function EaseTypeDropdown({
6644
6646
  type: "button",
6645
6647
  "data-ease-type-dropdown": "",
6646
6648
  "aria-haspopup": "menu",
6647
- "aria-expanded": open,
6648
- "aria-controls": open ? menuId : void 0,
6649
+ "aria-expanded": open2,
6650
+ "aria-controls": open2 ? menuId : void 0,
6649
6651
  onClick: () => setOpen((prev) => !prev),
6650
6652
  className: "flex w-full items-center gap-2 rounded-md border border-border bg-input px-2 py-1.5 text-left transition-colors hover:border-border-strong",
6651
6653
  children: [
@@ -6658,14 +6660,14 @@ function EaseTypeDropdown({
6658
6660
  height: "8",
6659
6661
  viewBox: "0 0 10 10",
6660
6662
  fill: "currentColor",
6661
- className: `ml-auto text-neutral-500 transition-transform ${open ? "rotate-180" : ""}`,
6663
+ className: `ml-auto text-neutral-500 transition-transform ${open2 ? "rotate-180" : ""}`,
6662
6664
  children: /* @__PURE__ */ jsx12("path", { d: "M2 3l3 4 3-4z" })
6663
6665
  }
6664
6666
  )
6665
6667
  ]
6666
6668
  }
6667
6669
  ),
6668
- open && /* @__PURE__ */ jsx12(
6670
+ open2 && /* @__PURE__ */ jsx12(
6669
6671
  "div",
6670
6672
  {
6671
6673
  ref: menuRef,
@@ -16093,6 +16095,7 @@ var ThumbnailScheduler = class {
16093
16095
  nextSequence = 1;
16094
16096
  scrolling = false;
16095
16097
  previewReloading = false;
16098
+ playbackActive = false;
16096
16099
  pageHidden = false;
16097
16100
  cacheBytes = 0;
16098
16101
  waveformCacheBytes = 0;
@@ -16137,7 +16140,7 @@ var ThumbnailScheduler = class {
16137
16140
  entry2.listeners.set(leaseId, listener2);
16138
16141
  entry2.lastAccess = this.nextSequence++;
16139
16142
  this.pump();
16140
- let released = false;
16143
+ let released2 = false;
16141
16144
  return {
16142
16145
  updatePriority: (priority) => {
16143
16146
  const current = this.entries.get(scopedKey);
@@ -16147,8 +16150,8 @@ var ThumbnailScheduler = class {
16147
16150
  this.pump();
16148
16151
  },
16149
16152
  release: () => {
16150
- if (released) return;
16151
- released = true;
16153
+ if (released2) return;
16154
+ released2 = true;
16152
16155
  const current = this.entries.get(scopedKey);
16153
16156
  if (!current) return;
16154
16157
  current.leases.delete(leaseId);
@@ -16190,6 +16193,11 @@ var ThumbnailScheduler = class {
16190
16193
  this.preempt(entry2);
16191
16194
  }
16192
16195
  }
16196
+ setPlaybackActive(active) {
16197
+ if (this.playbackActive === active) return;
16198
+ this.playbackActive = active;
16199
+ if (!active) this.pump();
16200
+ }
16193
16201
  setPageHidden(hidden) {
16194
16202
  if (this.pageHidden === hidden) return;
16195
16203
  this.pageHidden = hidden;
@@ -16247,13 +16255,18 @@ var ThumbnailScheduler = class {
16247
16255
  return priorityDelta || left.lastAccess - right.lastAccess;
16248
16256
  });
16249
16257
  for (const entry2 of queued) {
16250
- if (this.scrolling && entry2.request.rich) continue;
16251
- if (this.previewReloading && entry2.request.kind === "composition") continue;
16258
+ if (this.isHeld(entry2)) continue;
16252
16259
  const bucket = concurrencyBucket(entry2.request.kind);
16253
16260
  if (this.activeByBucket[bucket] >= this.bucketLimit(bucket)) continue;
16254
16261
  this.start(entry2, bucket);
16255
16262
  }
16256
16263
  }
16264
+ isHeld(entry2) {
16265
+ const { kind, rich } = entry2.request;
16266
+ if (this.scrolling && rich) return true;
16267
+ if (this.previewReloading && kind === "composition") return true;
16268
+ return this.playbackActive && kind === "video" && this.entryPriority(entry2) < PRIORITY_SCORE.interaction;
16269
+ }
16257
16270
  start(entry2, bucket) {
16258
16271
  entry2.state = "loading";
16259
16272
  entry2.snapshot = Object.freeze({ status: "loading" });
@@ -16391,10 +16404,9 @@ var ThumbnailScheduler = class {
16391
16404
  const timeout = setTimeout(() => {
16392
16405
  if (settled) return;
16393
16406
  settled = true;
16394
- controller.abort();
16395
- reject(
16396
- new Error(`Thumbnail load timed out after ${this.budgets.thumbnailLoadTimeoutMs}ms`)
16397
- );
16407
+ const message = `Thumbnail load timed out after ${this.budgets.thumbnailLoadTimeoutMs}ms`;
16408
+ controller.abort(new DOMException(message, "TimeoutError"));
16409
+ reject(new Error(message));
16398
16410
  }, this.budgets.thumbnailLoadTimeoutMs);
16399
16411
  load.then(
16400
16412
  (result) => {
@@ -16439,9 +16451,9 @@ var ThumbnailScheduler = class {
16439
16451
  this.deleteEntry(entry2.scopedKey, entry2);
16440
16452
  }
16441
16453
  }
16442
- safeDispose(dispose) {
16454
+ safeDispose(dispose2) {
16443
16455
  try {
16444
- dispose?.();
16456
+ dispose2?.();
16445
16457
  } catch {
16446
16458
  }
16447
16459
  }
@@ -19463,7 +19475,7 @@ var OutOfSyncBadge = memo13(function OutOfSyncBadge2({ el }) {
19463
19475
  if (!sync) return null;
19464
19476
  const label = formatSyncOffset(sync.frames, fps);
19465
19477
  const partnerName = sync.partner.label || sync.partner.id;
19466
- const open = (e) => {
19478
+ const open2 = (e) => {
19467
19479
  e.preventDefault();
19468
19480
  e.stopPropagation();
19469
19481
  setMenuAt({ x: e.clientX, y: e.clientY });
@@ -19481,8 +19493,8 @@ var OutOfSyncBadge = memo13(function OutOfSyncBadge2({ el }) {
19481
19493
  className: "absolute bottom-0.5 left-1 z-[12] cursor-pointer rounded-[3px] bg-red-600 px-1 font-mono text-[9px] leading-[14px] text-white tabular-nums",
19482
19494
  onPointerDown: stop,
19483
19495
  onDoubleClick: stop,
19484
- onClick: open,
19485
- onContextMenu: open,
19496
+ onClick: open2,
19497
+ onContextMenu: open2,
19486
19498
  children: label
19487
19499
  }
19488
19500
  ),
@@ -22935,7 +22947,7 @@ function parseFxChainOrEmpty(raw) {
22935
22947
  }
22936
22948
  }
22937
22949
  function TimelineFxButton(props) {
22938
- const [open, setOpen] = useState28(false);
22950
+ const [open2, setOpen] = useState28(false);
22939
22951
  const buttonRef = useRef41(null);
22940
22952
  const [anchorRect, setAnchorRect] = useState28(null);
22941
22953
  const transport = useAuditionTransport();
@@ -22965,7 +22977,7 @@ function TimelineFxButton(props) {
22965
22977
  children: "FX"
22966
22978
  }
22967
22979
  ),
22968
- open && anchorRect && createPortal3(
22980
+ open2 && anchorRect && createPortal3(
22969
22981
  /* @__PURE__ */ jsx50(
22970
22982
  GroupNameDialog,
22971
22983
  {
@@ -22995,7 +23007,7 @@ function TimelineFxButton(props) {
22995
23007
  ref: buttonRef,
22996
23008
  "aria-label": nodeCount > 0 ? `Effects: ${nodeCount} applied` : "Effects",
22997
23009
  title: "Effects",
22998
- className: `flex h-6 items-center justify-center gap-0.5 rounded border-0 bg-transparent px-1 text-[10px] font-semibold transition-colors ${open || nodeCount > 0 ? "text-[var(--timeline-accent)]" : "text-[var(--timeline-text-faint)] hover:text-[var(--timeline-text-soft)]"}`,
23010
+ className: `flex h-6 items-center justify-center gap-0.5 rounded border-0 bg-transparent px-1 text-[10px] font-semibold transition-colors ${open2 || nodeCount > 0 ? "text-[var(--timeline-accent)]" : "text-[var(--timeline-text-faint)] hover:text-[var(--timeline-text-soft)]"}`,
22999
23011
  onPointerDown: (event) => event.stopPropagation(),
23000
23012
  onClick: (event) => {
23001
23013
  event.stopPropagation();
@@ -23007,7 +23019,7 @@ function TimelineFxButton(props) {
23007
23019
  ]
23008
23020
  }
23009
23021
  ),
23010
- open && anchorRect && createPortal3(
23022
+ open2 && anchorRect && createPortal3(
23011
23023
  /* @__PURE__ */ jsx50(
23012
23024
  TimelineFxPopover,
23013
23025
  {
@@ -25896,10 +25908,10 @@ function writeDraft(key2, value) {
25896
25908
  } catch {
25897
25909
  }
25898
25910
  }
25899
- function EditPopover({ rangeStart, rangeEnd, anchorX, anchorY, onClose }) {
25911
+ function EditPopover({ rangeStart: rangeStart2, rangeEnd, anchorX, anchorY, onClose }) {
25900
25912
  const elements = usePlayerStore((s) => s.elements);
25901
- const start = Math.min(rangeStart, rangeEnd);
25902
- const end = Math.max(rangeStart, rangeEnd);
25913
+ const start = Math.min(rangeStart2, rangeEnd);
25914
+ const end = Math.max(rangeStart2, rangeEnd);
25903
25915
  const storageKey = draftKey(start, end);
25904
25916
  const [prompt, setPromptState] = useState31(() => readDraft(storageKey));
25905
25917
  const setPrompt = (value) => {
@@ -26233,7 +26245,7 @@ function ChoiceSubmenu({
26233
26245
  onPick,
26234
26246
  preview: preview2
26235
26247
  }) {
26236
- const [open, setOpen] = useState33(false);
26248
+ const [open2, setOpen] = useState33(false);
26237
26249
  const [anchor2, setAnchor] = useState33({ top: 0 });
26238
26250
  const rowRef = useRef45(null);
26239
26251
  const submenuRef = useRef45(null);
@@ -26300,7 +26312,7 @@ function ChoiceSubmenu({
26300
26312
  type: "button",
26301
26313
  role: "menuitem",
26302
26314
  "aria-haspopup": "menu",
26303
- "aria-expanded": open,
26315
+ "aria-expanded": open2,
26304
26316
  className: ROW_CLASS,
26305
26317
  onClick: () => show(true),
26306
26318
  onKeyDown: (event) => {
@@ -26314,7 +26326,7 @@ function ChoiceSubmenu({
26314
26326
  ]
26315
26327
  }
26316
26328
  ),
26317
- open && /* @__PURE__ */ jsxs43(
26329
+ open2 && /* @__PURE__ */ jsxs43(
26318
26330
  "div",
26319
26331
  {
26320
26332
  ref: submenuRef,
@@ -28127,18 +28139,26 @@ var Timeline = Object.assign(TimelineComposed, {
28127
28139
  // src/player/components/VideoThumbnail.tsx
28128
28140
  import { memo as memo22, useMemo as useMemo36, useState as useState35 } from "react";
28129
28141
 
28142
+ // src/player/lib/thumbnailPlaybackHold.ts
28143
+ function bindThumbnailPlaybackHold(store, scheduler) {
28144
+ scheduler.setPlaybackActive(store.getState().isPlaying);
28145
+ return store.subscribe((state) => scheduler.setPlaybackActive(state.isPlaying));
28146
+ }
28147
+
28130
28148
  // src/player/lib/mediaFetch.ts
28131
28149
  var describe = (reader, status, code, retries) => `${reader} range fetch failed: ${status === null ? `network ${code}` : `HTTP ${status}`} after ${retries} retries`;
28132
28150
  var MediaFetchError = class extends Error {
28133
- constructor(reader, status, code) {
28151
+ constructor(reader, status, code, start = null) {
28134
28152
  super(describe(reader, status, code, 0));
28135
28153
  this.reader = reader;
28136
28154
  this.status = status;
28137
28155
  this.code = code;
28156
+ this.start = start;
28138
28157
  }
28139
28158
  reader;
28140
28159
  status;
28141
28160
  code;
28161
+ start;
28142
28162
  name = "MediaFetchError";
28143
28163
  retries = 0;
28144
28164
  setRetries(retries) {
@@ -28147,6 +28167,24 @@ var MediaFetchError = class extends Error {
28147
28167
  }
28148
28168
  };
28149
28169
  var MAX_RETRIES = 2;
28170
+ var SILENT_BODY_STALL_MS = 8e3;
28171
+ var THUMBNAIL_RANGE_BYTES = 512 * 1024;
28172
+ var POOLED_READER_CACHE_BYTES = 16 * 1024 * 1024;
28173
+ var rangeStart = (init, closed) => (closed ? /^bytes=(\d+)-\d*$/ : /^bytes=(\d+)-$/).exec(
28174
+ new Headers(init?.headers).get("Range") ?? ""
28175
+ )?.[1];
28176
+ function boundedRange(init) {
28177
+ const start = rangeStart(init, false);
28178
+ if (start === void 0) return init;
28179
+ const headers = new Headers(init?.headers);
28180
+ headers.set("Range", `bytes=${start}-${Number(start) + THUMBNAIL_RANGE_BYTES - 1}`);
28181
+ return { ...init, headers };
28182
+ }
28183
+ function rangesReadable(init, response) {
28184
+ const asked = rangeStart(init, true);
28185
+ const shown3 = /^bytes (\d+)-\d+\/\d+$/.exec(response.headers.get("Content-Range") ?? "")?.[1];
28186
+ return response.status === 206 && asked !== void 0 && shown3 === asked;
28187
+ }
28150
28188
  var isAbort = (error) => error?.name === "AbortError";
28151
28189
  function networkCode(error) {
28152
28190
  const cause = error?.cause;
@@ -28154,110 +28192,300 @@ function networkCode(error) {
28154
28192
  const name = error?.name;
28155
28193
  return typeof name === "string" ? name : "unknown";
28156
28194
  }
28157
- var typedFailure = (reader, error) => isAbort(error) ? error : new MediaFetchError(reader, null, networkCode(error));
28158
- function typedBody(reader, body) {
28195
+ var typedFailure = (reader, error, start) => isAbort(error) ? error : new MediaFetchError(reader, null, networkCode(error), start);
28196
+ function watchedRequest(reader, parents) {
28197
+ const controller = new AbortController();
28198
+ let stalled = false;
28199
+ let timer;
28200
+ const unlinks = parents.map((parent) => {
28201
+ const follow = () => controller.abort(parent.reason);
28202
+ parent.addEventListener("abort", follow, { once: true });
28203
+ return () => parent.removeEventListener("abort", follow);
28204
+ });
28205
+ const done = () => {
28206
+ clearTimeout(timer);
28207
+ for (const unlink of unlinks.splice(0)) unlink();
28208
+ };
28209
+ controller.signal.addEventListener("abort", done, { once: true });
28210
+ for (const parent of parents) if (parent.aborted) controller.abort(parent.reason);
28211
+ const wait = (pending2) => {
28212
+ if (reader !== "thumbnail") return pending2;
28213
+ return new Promise((resolve, reject) => {
28214
+ timer = setTimeout(() => {
28215
+ stalled = true;
28216
+ const reason = new DOMException(`No bytes for ${SILENT_BODY_STALL_MS} ms`, "TimeoutError");
28217
+ reject(reason);
28218
+ controller.abort(reason);
28219
+ }, SILENT_BODY_STALL_MS);
28220
+ void pending2.then(resolve, reject).finally(() => clearTimeout(timer));
28221
+ });
28222
+ };
28223
+ const failure = (error, start) => stalled ? new MediaFetchError(reader, null, "stalled", start) : typedFailure(reader, error, start);
28224
+ return { signal: controller.signal, wait, done, failure };
28225
+ }
28226
+ function typedBody(body, start, request2) {
28159
28227
  const source = body.getReader();
28160
28228
  return new ReadableStream({
28161
28229
  async pull(controller) {
28162
28230
  try {
28163
- const { done, value } = await source.read();
28164
- if (done) controller.close();
28165
- else controller.enqueue(value);
28231
+ const { done, value } = await request2.wait(source.read());
28232
+ if (!done) return controller.enqueue(value);
28233
+ request2.done();
28234
+ controller.close();
28166
28235
  } catch (error) {
28167
- controller.error(typedFailure(reader, error));
28236
+ request2.done();
28237
+ controller.error(request2.failure(error, start));
28168
28238
  }
28169
28239
  },
28170
- cancel: (reason) => source.cancel(reason)
28240
+ cancel: (reason) => {
28241
+ request2.done();
28242
+ return source.cancel(reason);
28243
+ }
28171
28244
  });
28172
28245
  }
28246
+ async function typedFetch(reader, input, sent, asked, request2) {
28247
+ let response;
28248
+ try {
28249
+ response = await fetch(input, { ...sent, signal: request2.signal });
28250
+ } catch (error) {
28251
+ request2.done();
28252
+ throw request2.failure(error, asked);
28253
+ }
28254
+ if (response.ok) return response;
28255
+ request2.done();
28256
+ throw new MediaFetchError(reader, response.status, null, asked);
28257
+ }
28258
+ function typedResponse(response, asked, request2) {
28259
+ if (!response.body) {
28260
+ request2.done();
28261
+ return response;
28262
+ }
28263
+ const { status, statusText, headers } = response;
28264
+ const body = typedBody(response.body, status === 206 ? asked : 0, request2);
28265
+ return new Response(body, { status, statusText, headers });
28266
+ }
28173
28267
  function mediaUrlSourceOptions(reader) {
28174
- let failures = 0;
28268
+ const failuresByStart = /* @__PURE__ */ new Map();
28269
+ const inFlightReads = new AbortController();
28270
+ let ranges = reader === "thumbnail" ? "unknown" : "hidden";
28175
28271
  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 });
28272
+ const sent = ranges === "readable" ? boundedRange(init) : init;
28273
+ const asked = Number(rangeStart(sent, true) ?? 0);
28274
+ const request2 = watchedRequest(
28275
+ reader,
28276
+ init?.signal ? [inFlightReads.signal, init.signal] : [inFlightReads.signal]
28277
+ );
28278
+ const response = await typedFetch(reader, input, sent ?? {}, asked, request2);
28279
+ if (ranges !== "hidden") ranges = rangesReadable(sent, response) ? "readable" : "hidden";
28280
+ return typedResponse(response, asked, request2);
28186
28281
  };
28187
28282
  const getRetryDelay = (_previousAttempts, error) => {
28283
+ const start = error instanceof MediaFetchError ? error.start : null;
28284
+ const failed2 = failuresByStart.get(start) ?? 0;
28188
28285
  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;
28286
+ if (error instanceof MediaFetchError) error.setRetries(failed2);
28287
+ if (clientError || failed2 >= MAX_RETRIES) return null;
28288
+ failuresByStart.set(start, failed2 + 1);
28289
+ return 0.5 * (failed2 + 1);
28193
28290
  };
28194
- return { fetchFn, getRetryDelay };
28291
+ const cancelReads = () => inFlightReads.abort(new DOMException("Media reads cancelled", "AbortError"));
28292
+ if (reader === "probe") return { fetchFn, getRetryDelay, cancelReads };
28293
+ return { fetchFn, getRetryDelay, cancelReads, maxCacheSize: POOLED_READER_CACHE_BYTES };
28195
28294
  }
28196
28295
  function reportMediaFetchFailure(error) {
28197
28296
  if (!(error instanceof MediaFetchError)) return;
28198
28297
  console.warn(`[Studio] ${error.message}`);
28199
28298
  }
28200
28299
 
28201
- // src/player/lib/thumbnailVideoDecoder.ts
28202
- var LAST_FRAME_INSET_S = 1e-3;
28203
- function videoThumbnailTimestamps(start, duration, frameCount) {
28204
- const safeStart = Math.max(0, Number.isFinite(start) ? start : 0);
28205
- const safeDuration = Math.max(0, Number.isFinite(duration) ? duration : 0);
28206
- const count = Math.max(1, Number.isFinite(frameCount) ? Math.floor(frameCount) : 1);
28207
- if (count === 1) return [safeStart + safeDuration / 2];
28208
- const edges = Array.from(
28209
- { length: count },
28210
- (_, index) => safeStart + safeDuration * index / count
28300
+ // src/player/lib/thumbnailSourcePool.ts
28301
+ var pool = /* @__PURE__ */ new Map();
28302
+ var mediabunnyModule = null;
28303
+ var loadMediabunny = () => mediabunnyModule ??= import("mediabunny");
28304
+ var abortError = () => new DOMException("Aborted", "AbortError");
28305
+ var timedOut = (signal) => signal.reason?.name === "TimeoutError";
28306
+ var isAbortError = (error) => error?.name === "AbortError";
28307
+ function dispose(source, entry2) {
28308
+ if (entry2.disposed) return;
28309
+ entry2.disposed = true;
28310
+ if (entry2.idleTimer !== null) clearTimeout(entry2.idleTimer);
28311
+ if (pool.get(source) === entry2) pool.delete(source);
28312
+ entry2.input?.dispose();
28313
+ entry2.cancelReads?.();
28314
+ }
28315
+ function retire(source, entry2) {
28316
+ if (pool.get(source) === entry2) pool.delete(source);
28317
+ if (entry2.users === 0) dispose(source, entry2);
28318
+ }
28319
+ async function open(source, pooled) {
28320
+ const mediabunny = await loadMediabunny();
28321
+ const entry2 = pooled();
28322
+ const live = () => {
28323
+ if (entry2.disposed) throw abortError();
28324
+ };
28325
+ live();
28326
+ const options = mediaUrlSourceOptions("thumbnail");
28327
+ const input = new mediabunny.Input({
28328
+ source: new mediabunny.UrlSource(source, options),
28329
+ formats: mediabunny.ALL_FORMATS
28330
+ });
28331
+ entry2.input = input;
28332
+ entry2.cancelReads = options.cancelReads;
28333
+ const track2 = await input.getPrimaryVideoTrack();
28334
+ live();
28335
+ if (!track2) throw new Error("Video source has no decodable video track");
28336
+ const [displayWidth, displayHeight] = await Promise.all([
28337
+ track2.getDisplayWidth(),
28338
+ track2.getDisplayHeight()
28339
+ ]);
28340
+ live();
28341
+ if (!(displayWidth > 0 && displayHeight > 0)) {
28342
+ throw new Error("Video source has invalid dimensions");
28343
+ }
28344
+ const metadataDuration = await track2.getDurationFromMetadata({ skipLiveWait: true });
28345
+ live();
28346
+ return { mediabunny, track: track2, info: { aspect: displayWidth / displayHeight, metadataDuration } };
28347
+ }
28348
+ function pooledSource(source, version) {
28349
+ const current = pool.get(source);
28350
+ if (current && current.version === version) return current;
28351
+ if (current) retire(source, current);
28352
+ const entry2 = {
28353
+ version,
28354
+ input: null,
28355
+ cancelReads: null,
28356
+ ready: false,
28357
+ opened: open(source, () => entry2),
28358
+ users: 0,
28359
+ progress: { framesFromAnyJob: 0 },
28360
+ idleTimer: null,
28361
+ disposed: false
28362
+ };
28363
+ entry2.opened.then(
28364
+ () => entry2.ready = true,
28365
+ () => retire(source, entry2)
28211
28366
  );
28212
- return [...edges, safeStart + Math.max(0, safeDuration - LAST_FRAME_INSET_S)];
28367
+ pool.set(source, entry2);
28368
+ return entry2;
28213
28369
  }
28370
+ function untilAborted(pending2, signal) {
28371
+ if (signal.aborted) return Promise.reject(abortError());
28372
+ return new Promise((resolve, reject) => {
28373
+ const onAbort = () => reject(abortError());
28374
+ signal.addEventListener("abort", onAbort, { once: true });
28375
+ void pending2.then(resolve, reject).finally(() => signal.removeEventListener("abort", onAbort));
28376
+ });
28377
+ }
28378
+ async function acquireThumbnailSource(source, version, signal, idleMs) {
28379
+ const entry2 = pooledSource(source, version);
28380
+ const waitedForOpen = !entry2.ready;
28381
+ entry2.users += 1;
28382
+ if (entry2.idleTimer !== null) clearTimeout(entry2.idleTimer);
28383
+ entry2.idleTimer = null;
28384
+ let released2 = false;
28385
+ const release2 = (failed2) => {
28386
+ if (released2) return;
28387
+ released2 = true;
28388
+ entry2.users -= 1;
28389
+ if (failed2) retire(source, entry2);
28390
+ if (entry2.users > 0 || entry2.disposed) return;
28391
+ if (pool.get(source) === entry2 && idleMs > 0) {
28392
+ entry2.idleTimer = setTimeout(() => dispose(source, entry2), idleMs);
28393
+ } else {
28394
+ dispose(source, entry2);
28395
+ }
28396
+ };
28397
+ try {
28398
+ const { progress } = entry2;
28399
+ return { ...await untilAborted(entry2.opened, signal), release: release2, waitedForOpen, progress };
28400
+ } catch (error) {
28401
+ release2(!isAbortError(error) || timedOut(signal));
28402
+ throw error;
28403
+ }
28404
+ }
28405
+
28406
+ // src/player/lib/thumbnailFrameCache.ts
28214
28407
  var sharedFrames = /* @__PURE__ */ new Map();
28215
- var sourceInfos = /* @__PURE__ */ new Map();
28216
- var accepts = (window2, time, decodedAt) => decodedAt >= window2.sourceStart && time - decodedAt <= (time >= window2.end ? 0 : window2.lead);
28217
- function takeSharedFrame(key2, time, window2) {
28218
- const frame3 = sharedFrames.get(key2)?.find((shared2) => accepts(window2, time, shared2.decodedAt));
28219
- if (frame3) frame3.users += 1;
28408
+ var released = /* @__PURE__ */ new Map();
28409
+ var releasedBytes = 0;
28410
+ function use(frame3) {
28411
+ if (frame3.users++ === 0 && released.delete(frame3)) releasedBytes -= frame3.bytes;
28220
28412
  return frame3;
28221
28413
  }
28222
- function shareFrame(key2, decodedAt, url) {
28414
+ function takeSharedFrame(key2, accepts2) {
28415
+ const frame3 = sharedFrames.get(key2)?.find((shared2) => accepts2(shared2.decodedAt));
28416
+ return frame3 && use(frame3);
28417
+ }
28418
+ function shareFrame(key2, decodedAt, url, bytes) {
28223
28419
  const frames = sharedFrames.get(key2) ?? [];
28224
28420
  const existing = frames.find((shared2) => shared2.decodedAt === decodedAt);
28225
28421
  if (existing) {
28226
- existing.users += 1;
28227
28422
  URL.revokeObjectURL(url);
28228
- return existing;
28423
+ return use(existing);
28229
28424
  }
28230
- const frame3 = { url, decodedAt, users: 1 };
28425
+ const frame3 = { url, decodedAt, bytes, users: 1 };
28231
28426
  sharedFrames.set(key2, [...frames, frame3]);
28232
28427
  return frame3;
28233
28428
  }
28234
- function releaseSharedFrames(held) {
28429
+ function evict(frame3, key2) {
28430
+ released.delete(frame3);
28431
+ releasedBytes -= frame3.bytes;
28432
+ const rest = sharedFrames.get(key2)?.filter((shared2) => shared2 !== frame3) ?? [];
28433
+ if (rest.length > 0) sharedFrames.set(key2, rest);
28434
+ else sharedFrames.delete(key2);
28435
+ URL.revokeObjectURL(frame3.url);
28436
+ }
28437
+ function releaseSharedFrames(held, budgetBytes) {
28235
28438
  for (const { key: key2, frame: frame3 } of held.splice(0)) {
28236
28439
  if (--frame3.users > 0) continue;
28237
- const rest = sharedFrames.get(key2)?.filter((shared2) => shared2 !== frame3) ?? [];
28238
- if (rest.length > 0) sharedFrames.set(key2, rest);
28239
- else sharedFrames.delete(key2);
28240
- URL.revokeObjectURL(frame3.url);
28440
+ released.set(frame3, key2);
28441
+ releasedBytes += frame3.bytes;
28442
+ }
28443
+ for (const [frame3, key2] of released) {
28444
+ if (releasedBytes <= budgetBytes) break;
28445
+ evict(frame3, key2);
28241
28446
  }
28242
28447
  }
28448
+
28449
+ // src/player/lib/thumbnailVideoDecoder.ts
28450
+ var LAST_FRAME_INSET_S = 1e-3;
28451
+ function videoThumbnailTimestamps(start, duration, frameCount) {
28452
+ const safeStart = Math.max(0, Number.isFinite(start) ? start : 0);
28453
+ const safeDuration = Math.max(0, Number.isFinite(duration) ? duration : 0);
28454
+ const count = Math.max(1, Number.isFinite(frameCount) ? Math.floor(frameCount) : 1);
28455
+ if (count === 1) return [safeStart + safeDuration / 2];
28456
+ const edges = Array.from(
28457
+ { length: count },
28458
+ (_, index) => safeStart + safeDuration * index / count
28459
+ );
28460
+ return [...edges, safeStart + Math.max(0, safeDuration - LAST_FRAME_INSET_S)];
28461
+ }
28462
+ var sourceInfos = /* @__PURE__ */ new Map();
28463
+ var accepts = (window2, time, decodedAt) => decodedAt >= window2.sourceStart && time - decodedAt <= (time >= window2.end ? 0 : window2.lead);
28464
+ var ClipResultError = class extends Error {
28465
+ };
28243
28466
  async function canvasToBlob(canvas) {
28244
28467
  if (canvas instanceof HTMLCanvasElement) {
28245
28468
  return new Promise((resolve, reject) => {
28246
28469
  canvas.toBlob(
28247
- (blob) => blob ? resolve(blob) : reject(new Error("Video thumbnail encode failed")),
28470
+ (blob) => blob ? resolve(blob) : reject(new ClipResultError("Video thumbnail encode failed")),
28248
28471
  "image/jpeg",
28249
28472
  0.72
28250
28473
  );
28251
28474
  });
28252
28475
  }
28253
- return canvas.convertToBlob({ type: "image/jpeg", quality: 0.72 });
28476
+ return canvas.convertToBlob({ type: "image/jpeg", quality: 0.72 }).catch(() => {
28477
+ throw new ClipResultError("Video thumbnail encode failed");
28478
+ });
28254
28479
  }
28480
+ var timeoutWithoutProgress = () => new MediaFetchError("thumbnail", null, "timeout");
28481
+ var isAbortError2 = (error) => error?.name === "AbortError";
28482
+ var isSourceFailure = (error) => !isAbortError2(error) && !(error instanceof ClipResultError);
28255
28483
  function throwIfAborted(signal) {
28256
28484
  if (signal.aborted) throw new DOMException("Aborted", "AbortError");
28257
28485
  }
28258
28486
  function releaseDecodedResources(resources) {
28259
28487
  resources.urls.length = 0;
28260
- releaseSharedFrames(resources.held);
28488
+ releaseSharedFrames(resources.held, resources.releasedFrameBytes);
28261
28489
  for (const canvas of resources.canvases) {
28262
28490
  canvas.width = 0;
28263
28491
  canvas.height = 0;
@@ -28303,14 +28531,14 @@ function takeDecodedFrames({ timestamps, window: window2 }, keyOf17, resources)
28303
28531
  const missing = [];
28304
28532
  timestamps.forEach((time, slot) => {
28305
28533
  const key2 = keyOf17(time);
28306
- const frame3 = takeSharedFrame(key2, time, window2);
28534
+ const frame3 = takeSharedFrame(key2, (decodedAt) => accepts(window2, time, decodedAt));
28307
28535
  if (!frame3) return void missing.push(slot);
28308
28536
  resources.urls[slot] = frame3.url;
28309
28537
  resources.held.push({ key: key2, frame: frame3 });
28310
28538
  });
28311
28539
  return missing;
28312
28540
  }
28313
- async function decodeFrames(sink, times, slots, signal, resources) {
28541
+ async function decodeFrames(sink, times, slots, signal, resources, progress) {
28314
28542
  let next = 0;
28315
28543
  for await (const wrapped of sink.canvasesAtTimestamps(times)) {
28316
28544
  throwIfAborted(signal);
@@ -28319,7 +28547,8 @@ async function decodeFrames(sink, times, slots, signal, resources) {
28319
28547
  resources.canvases.add(wrapped.canvas);
28320
28548
  const blob = await canvasToBlob(wrapped.canvas);
28321
28549
  throwIfAborted(signal);
28322
- const frame3 = shareFrame(target.key, target.decodedAt, URL.createObjectURL(blob));
28550
+ const frame3 = shareFrame(target.key, target.decodedAt, URL.createObjectURL(blob), blob.size);
28551
+ progress.framesFromAnyJob += 1;
28323
28552
  resources.urls[target.slot] = frame3.url;
28324
28553
  resources.held.push({ key: target.key, frame: frame3 });
28325
28554
  }
@@ -28328,7 +28557,7 @@ async function decodeFrames(sink, times, slots, signal, resources) {
28328
28557
  function loadedResult(resources, aspect, budgets, frameCount = resources.urls.length) {
28329
28558
  const decoded = resources.urls.filter((url) => url !== void 0);
28330
28559
  const firstUrl = decoded[0];
28331
- if (!firstUrl) throw new Error("Video source returned no thumbnail frames");
28560
+ if (!firstUrl) throw new ClipResultError("Video source returned no thumbnail frames");
28332
28561
  let nearest = firstUrl;
28333
28562
  const urls = Array.from(
28334
28563
  { length: frameCount },
@@ -28346,7 +28575,12 @@ async function decodeVideoThumbnail(request2, signal, budgets = TIMELINE_VIEWPOR
28346
28575
  const fit = request2.fit ?? "cover";
28347
28576
  const sourceKey = createThumbnailKey({ source: request2.source, version: request2.contentVersion });
28348
28577
  const keyOf17 = (time) => `${sourceKey}\0${fit}\0${time}`;
28349
- const resources = { urls: [], held: [], canvases: /* @__PURE__ */ new Set() };
28578
+ const resources = {
28579
+ urls: [],
28580
+ held: [],
28581
+ canvases: /* @__PURE__ */ new Set(),
28582
+ releasedFrameBytes: budgets.sharedFrameCacheBytes
28583
+ };
28350
28584
  const entry2 = sourceInfos.get(request2.source);
28351
28585
  const known = entry2?.version === request2.contentVersion ? entry2?.info : void 0;
28352
28586
  try {
@@ -28365,27 +28599,29 @@ async function decodeVideoThumbnail(request2, signal, budgets = TIMELINE_VIEWPOR
28365
28599
  }
28366
28600
  }
28367
28601
  async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources) {
28368
- const mediabunny = await import("mediabunny");
28369
- throwIfAborted(signal);
28370
- const input = new mediabunny.Input({
28371
- source: new mediabunny.UrlSource(request2.source, mediaUrlSourceOptions("thumbnail")),
28372
- formats: mediabunny.ALL_FORMATS
28373
- });
28602
+ let source;
28603
+ try {
28604
+ source = await acquireThumbnailSource(
28605
+ request2.source,
28606
+ request2.contentVersion,
28607
+ signal,
28608
+ budgets.thumbnailSourceIdleMs
28609
+ );
28610
+ } catch (error) {
28611
+ if (timedOut(signal)) reportMediaFetchFailure(timeoutWithoutProgress());
28612
+ throw error;
28613
+ }
28614
+ const framesBefore = source.progress.framesFromAnyJob;
28615
+ const releaseOnAbort = () => {
28616
+ const madeProgress = source.waitedForOpen || source.progress.framesFromAnyJob > framesBefore;
28617
+ const failed2 = timedOut(signal) && !madeProgress;
28618
+ if (failed2) reportMediaFetchFailure(timeoutWithoutProgress());
28619
+ source.release(failed2);
28620
+ };
28621
+ signal.addEventListener("abort", releaseOnAbort, { once: true });
28374
28622
  try {
28375
- const track2 = await input.getPrimaryVideoTrack();
28376
- throwIfAborted(signal);
28377
- if (!track2) throw new Error("Video source has no decodable video track");
28378
- const [displayWidth, displayHeight] = await Promise.all([
28379
- track2.getDisplayWidth(),
28380
- track2.getDisplayHeight()
28381
- ]);
28382
- throwIfAborted(signal);
28383
- if (!(displayWidth > 0 && displayHeight > 0)) {
28384
- throw new Error("Video source has invalid dimensions");
28385
- }
28386
- const metadataDuration = await track2.getDurationFromMetadata({ skipLiveWait: true });
28387
28623
  throwIfAborted(signal);
28388
- const info = { aspect: displayWidth / displayHeight, metadataDuration };
28624
+ const { mediabunny, track: track2, info } = source;
28389
28625
  sourceInfos.set(request2.source, { version: request2.contentVersion, info });
28390
28626
  const strip = stripTimes(request2, info, budgets);
28391
28627
  const { timestamps, window: window2 } = strip;
@@ -28412,11 +28648,17 @@ async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources
28412
28648
  fit: request2.fit ?? "cover",
28413
28649
  poolSize: 1
28414
28650
  });
28415
- await decodeFrames(sink, decodeTimesAtNearbyKeyframes(), slots, signal, resources);
28651
+ const times = decodeTimesAtNearbyKeyframes();
28652
+ await decodeFrames(sink, times, slots, signal, resources, source.progress);
28416
28653
  }
28417
- return loadedResult(resources, info.aspect, budgets, timestamps.length);
28654
+ const result = loadedResult(resources, info.aspect, budgets, timestamps.length);
28655
+ source.release(false);
28656
+ return result;
28657
+ } catch (error) {
28658
+ source.release(isSourceFailure(error));
28659
+ throw error;
28418
28660
  } finally {
28419
- input.dispose();
28661
+ signal.removeEventListener("abort", releaseOnAbort);
28420
28662
  }
28421
28663
  }
28422
28664
 
@@ -28457,6 +28699,8 @@ function ThumbnailTiles({
28457
28699
 
28458
28700
  // src/player/components/VideoThumbnail.tsx
28459
28701
  import { jsx as jsx78, jsxs as jsxs53 } from "react/jsx-runtime";
28702
+ var unbindPlaybackHold = bindThumbnailPlaybackHold(usePlayerStore, thumbnailScheduler);
28703
+ import.meta.hot?.dispose(unbindPlaybackHold);
28460
28704
  function createVideoThumbnailRequest(props, frameCount, rich) {
28461
28705
  const {
28462
28706
  videoSrc,
@@ -29072,10 +29316,10 @@ var SHUTTLE_SPEEDS = [1, 2, 4];
29072
29316
  var claims = 0;
29073
29317
  function acquireCanvasNudgeKeys() {
29074
29318
  claims += 1;
29075
- let released = false;
29319
+ let released2 = false;
29076
29320
  return () => {
29077
- if (released) return;
29078
- released = true;
29321
+ if (released2) return;
29322
+ released2 = true;
29079
29323
  claims -= 1;
29080
29324
  };
29081
29325
  }
@@ -32230,15 +32474,15 @@ var accessSequence = 0;
32230
32474
  var activeProbes = 0;
32231
32475
  var registryEpoch = 0;
32232
32476
  var probeQueue = [];
32233
- var mediabunnyModule = null;
32234
- async function loadMediabunny() {
32235
- if (mediabunnyModule === false) return null;
32236
- if (mediabunnyModule) return mediabunnyModule;
32477
+ var mediabunnyModule2 = null;
32478
+ async function loadMediabunny2() {
32479
+ if (mediabunnyModule2 === false) return null;
32480
+ if (mediabunnyModule2) return mediabunnyModule2;
32237
32481
  try {
32238
- mediabunnyModule = await import("mediabunny");
32239
- return mediabunnyModule;
32482
+ mediabunnyModule2 = await import("mediabunny");
32483
+ return mediabunnyModule2;
32240
32484
  } catch {
32241
- mediabunnyModule = false;
32485
+ mediabunnyModule2 = false;
32242
32486
  return null;
32243
32487
  }
32244
32488
  }
@@ -32250,7 +32494,7 @@ function normalizeUrl(url) {
32250
32494
  }
32251
32495
  }
32252
32496
  async function probeOne(url) {
32253
- const mb = await loadMediabunny();
32497
+ const mb = await loadMediabunny2();
32254
32498
  if (!mb) return null;
32255
32499
  const input = new mb.Input({
32256
32500
  source: new mb.UrlSource(url, mediaUrlSourceOptions("probe")),
@@ -34139,7 +34383,7 @@ var NLEPreview = memo24(function NLEPreview2({
34139
34383
  "div",
34140
34384
  {
34141
34385
  ref: stageRef,
34142
- className: "relative shrink-0 pointer-events-auto",
34386
+ className: "relative shrink-0 pointer-events-auto shadow-[0_0_0_1px_rgba(255,255,255,0.08),0_4px_32px_rgba(0,0,0,0.7)]",
34143
34387
  style: {
34144
34388
  width: `${stageSize.width}px`,
34145
34389
  height: `${stageSize.height}px`,
@@ -39248,21 +39492,21 @@ function pickBest(candidates) {
39248
39492
  (c) => c.source === "element" || c.source === "composition"
39249
39493
  );
39250
39494
  const gridCandidates = candidates.filter((c) => c.source === "grid");
39251
- let pool;
39495
+ let pool2;
39252
39496
  const bestElem = elementCandidates.length ? Math.min(...elementCandidates.map((c) => c.distance)) : Infinity;
39253
39497
  const bestGrid = gridCandidates.length ? Math.min(...gridCandidates.map((c) => c.distance)) : Infinity;
39254
39498
  if (bestElem <= bestGrid) {
39255
- pool = elementCandidates;
39499
+ pool2 = elementCandidates;
39256
39500
  } else {
39257
- pool = gridCandidates;
39501
+ pool2 = gridCandidates;
39258
39502
  }
39259
- const minDist = Math.min(...pool.map((c) => c.distance));
39260
- const winners = pool.filter((c) => c.distance === minDist);
39503
+ const minDist = Math.min(...pool2.map((c) => c.distance));
39504
+ const winners = pool2.filter((c) => c.distance === minDist);
39261
39505
  const hasPositive = winners.some((c) => c.adjustment > 0);
39262
39506
  const hasNegative = winners.some((c) => c.adjustment < 0);
39263
39507
  if (hasPositive && hasNegative) return null;
39264
39508
  const adjustment = winners[0].adjustment;
39265
- const matches = pool.filter((c) => c.adjustment === adjustment);
39509
+ const matches = pool2.filter((c) => c.adjustment === adjustment);
39266
39510
  return { adjustment, matches };
39267
39511
  }
39268
39512
  function computeGuideExtent(axis, movingRect, matchedTargetIds, targetMap) {
@@ -40225,7 +40469,7 @@ function createDomEditSaveQueue(options = {}) {
40225
40469
  drainError = null;
40226
40470
  if (notify && wasOpen) options.onReset?.();
40227
40471
  };
40228
- const open = (error) => {
40472
+ const open2 = (error) => {
40229
40473
  if (breakerOpen) return;
40230
40474
  breakerOpen = true;
40231
40475
  options.onOpen?.({
@@ -40246,7 +40490,7 @@ function createDomEditSaveQueue(options = {}) {
40246
40490
  drainError = error;
40247
40491
  consecutiveFailures += 1;
40248
40492
  if (getStudioSaveStatusCode(error) === 409 || consecutiveFailures >= failureThreshold)
40249
- open(error);
40493
+ open2(error);
40250
40494
  throw error;
40251
40495
  }
40252
40496
  };
@@ -42699,28 +42943,28 @@ function useInlineTextEdit({
42699
42943
  const openRef = useRef69(null);
42700
42944
  const framesRef = useRef69(null);
42701
42945
  const teardown = useCallback59(() => {
42702
- const open = openRef.current;
42703
- if (!open) return null;
42946
+ const open2 = openRef.current;
42947
+ if (!open2) return null;
42704
42948
  if (framesRef.current !== null) {
42705
- open.element.ownerDocument.defaultView?.cancelAnimationFrame(framesRef.current);
42949
+ open2.element.ownerDocument.defaultView?.cancelAnimationFrame(framesRef.current);
42706
42950
  framesRef.current = null;
42707
42951
  }
42708
42952
  openRef.current = null;
42709
- endStudioManualEditGesture(open.element, open.gesture);
42953
+ endStudioManualEditGesture(open2.element, open2.gesture);
42710
42954
  setSession(null);
42711
- if (open.element.isConnected) {
42712
- open.element.removeAttribute("contenteditable");
42713
- open.element.style.outline = open.outline;
42714
- open.element.style.outlineOffset = open.outlineOffset;
42715
- clearSelectionWithin(open.element);
42716
- open.element.blur();
42717
- }
42718
- return open;
42955
+ if (open2.element.isConnected) {
42956
+ open2.element.removeAttribute("contenteditable");
42957
+ open2.element.style.outline = open2.outline;
42958
+ open2.element.style.outlineOffset = open2.outlineOffset;
42959
+ clearSelectionWithin(open2.element);
42960
+ open2.element.blur();
42961
+ }
42962
+ return open2;
42719
42963
  }, []);
42720
42964
  const start = useCallback59(
42721
42965
  (element, caretAt) => {
42722
42966
  if (openRef.current || readOnly) return false;
42723
- const open = {
42967
+ const open2 = {
42724
42968
  element,
42725
42969
  original: element.innerHTML,
42726
42970
  outline: element.style.outline,
@@ -42729,8 +42973,8 @@ function useInlineTextEdit({
42729
42973
  };
42730
42974
  element.style.outline = EDITING_OUTLINE;
42731
42975
  element.style.outlineOffset = "2px";
42732
- openRef.current = open;
42733
- setSession(open);
42976
+ openRef.current = open2;
42977
+ setSession(open2);
42734
42978
  onPause?.();
42735
42979
  element.setAttribute("contenteditable", EDITABLE);
42736
42980
  const view = element.ownerDocument.defaultView;
@@ -42746,23 +42990,23 @@ function useInlineTextEdit({
42746
42990
  [onPause, readOnly]
42747
42991
  );
42748
42992
  const commit2 = useCallback59(() => {
42749
- const open = openRef.current;
42750
- if (!open) return;
42751
- sanitizeRichTextChildren(open.element);
42752
- const html2 = open.element.innerHTML;
42993
+ const open2 = openRef.current;
42994
+ if (!open2) return;
42995
+ sanitizeRichTextChildren(open2.element);
42996
+ const html2 = open2.element.innerHTML;
42753
42997
  let save = () => {
42754
42998
  };
42755
42999
  trackStudioPendingEdit(new Promise((resolve) => save = resolve));
42756
43000
  const commitText = () => {
42757
43001
  teardown();
42758
- return onCommit({ element: open.element, html: html2, previousHtml: open.original });
43002
+ return onCommit({ element: open2.element, html: html2, previousHtml: open2.original });
42759
43003
  };
42760
- save(countStudioManualEditSave(open.element, commitText));
43004
+ save(countStudioManualEditSave(open2.element, commitText));
42761
43005
  }, [onCommit, teardown]);
42762
43006
  const cancel = useCallback59(() => {
42763
- const open = openRef.current;
42764
- if (!open) return;
42765
- if (open.element.isConnected) open.element.innerHTML = open.original;
43007
+ const open2 = openRef.current;
43008
+ if (!open2) return;
43009
+ if (open2.element.isConnected) open2.element.innerHTML = open2.original;
42766
43010
  teardown();
42767
43011
  }, [teardown]);
42768
43012
  useEffect53(() => {
@@ -43560,10 +43804,10 @@ var zPersistCounts = /* @__PURE__ */ new WeakMap();
43560
43804
  var REVEAL_RETRY_MS = 16;
43561
43805
  function beginLayerZPersist(element) {
43562
43806
  zPersistCounts.set(element, (zPersistCounts.get(element) ?? 0) + 1);
43563
- let released = false;
43807
+ let released2 = false;
43564
43808
  return () => {
43565
- if (released) return;
43566
- released = true;
43809
+ if (released2) return;
43810
+ released2 = true;
43567
43811
  const remaining = (zPersistCounts.get(element) ?? 1) - 1;
43568
43812
  if (remaining > 0) zPersistCounts.set(element, remaining);
43569
43813
  else zPersistCounts.delete(element);
@@ -50517,7 +50761,7 @@ function findToolDefinitionError(tool) {
50517
50761
  if (!tool.description.trim()) return "description must not be empty";
50518
50762
  return null;
50519
50763
  }
50520
- function isAbortError(error) {
50764
+ function isAbortError3(error) {
50521
50765
  return error instanceof DOMException && error.name === "AbortError";
50522
50766
  }
50523
50767
  function invalidState(tool, message) {
@@ -50532,7 +50776,7 @@ async function registerOne(modelContext, tool, signal) {
50532
50776
  await modelContext.registerTool(tool, { signal });
50533
50777
  return { status: "registered" };
50534
50778
  } catch (error) {
50535
- if (isAbortError(error)) return { status: "aborted" };
50779
+ if (isAbortError3(error)) return { status: "aborted" };
50536
50780
  return {
50537
50781
  status: "failed",
50538
50782
  failure: {
@@ -52369,7 +52613,7 @@ function snapshot(api) {
52369
52613
  };
52370
52614
  }
52371
52615
  function createController(api, options) {
52372
- const open = (id) => {
52616
+ const open2 = (id) => {
52373
52617
  if (api.getPanel(id)) return;
52374
52618
  const { zone, reopen: preferred } = PANEL_DEFINITIONS[id];
52375
52619
  const reopen = zone === "center" || options.panels.includes(preferred.near) ? preferred : { near: "preview", direction: zone };
@@ -52383,9 +52627,9 @@ function createController(api, options) {
52383
52627
  addRegisteredPanel(api, id, hasAnchor ? position : void 0);
52384
52628
  };
52385
52629
  return {
52386
- open,
52630
+ open: open2,
52387
52631
  activate: (id) => {
52388
- open(id);
52632
+ open2(id);
52389
52633
  api.getPanel(id)?.api.setActive();
52390
52634
  },
52391
52635
  close: (id) => {
@@ -52505,11 +52749,11 @@ function Panel({ id, title, children }) {
52505
52749
  const element = useSlots().slots[id];
52506
52750
  const visible = useDockLayoutStore((state) => state.visiblePanels.has(id));
52507
52751
  const controller = useDockLayoutStore((state) => state.controller);
52508
- const open = useDockLayoutStore((state) => state.openPanels.has(id));
52752
+ const open2 = useDockLayoutStore((state) => state.openPanels.has(id));
52509
52753
  const label = title ?? PANEL_DEFINITIONS[id].title;
52510
52754
  useEffect67(() => {
52511
- if (open) controller?.setTitle(id, label);
52512
- }, [controller, id, label, open]);
52755
+ if (open2) controller?.setTitle(id, label);
52756
+ }, [controller, id, label, open2]);
52513
52757
  const definition = PANEL_DEFINITIONS[id];
52514
52758
  const shown3 = visible || definition.keepMounted;
52515
52759
  return element && shown3 ? createPortal12(children, element) : null;
@@ -52519,29 +52763,29 @@ function WindowMenu() {
52519
52763
  const panels = useDockLayoutStore((state) => state.panels);
52520
52764
  const togglePanel = useDockLayoutStore((state) => state.togglePanel);
52521
52765
  const resetLayout = useDockLayoutStore((state) => state.resetLayout);
52522
- const [open, setOpen] = useState60(false);
52766
+ const [open2, setOpen] = useState60(false);
52523
52767
  const rootRef = useRef82(null);
52524
52768
  useEffect67(() => {
52525
- if (!open) return;
52769
+ if (!open2) return;
52526
52770
  const close = (event) => {
52527
52771
  if (!rootRef.current?.contains(event.target)) setOpen(false);
52528
52772
  };
52529
52773
  document.addEventListener("pointerdown", close);
52530
52774
  return () => document.removeEventListener("pointerdown", close);
52531
- }, [open]);
52775
+ }, [open2]);
52532
52776
  return /* @__PURE__ */ jsxs82("div", { ref: rootRef, className: "relative", children: [
52533
52777
  /* @__PURE__ */ jsx116(
52534
52778
  "button",
52535
52779
  {
52536
52780
  type: "button",
52537
52781
  "aria-haspopup": "menu",
52538
- "aria-expanded": open,
52782
+ "aria-expanded": open2,
52539
52783
  onClick: () => setOpen((value) => !value),
52540
52784
  className: "h-7 px-2.5 rounded-md text-[11px] font-medium text-neutral-400 hover:text-neutral-200 hover:bg-neutral-800 transition-colors",
52541
52785
  children: "Window"
52542
52786
  }
52543
52787
  ),
52544
- open && /* @__PURE__ */ jsxs82("div", { role: "menu", className: `${menuClasses.panel} absolute right-0 top-8 z-50 w-44`, children: [
52788
+ open2 && /* @__PURE__ */ jsxs82("div", { role: "menu", className: `${menuClasses.panel} absolute right-0 top-8 z-50 w-44`, children: [
52545
52789
  panels.map((id) => /* @__PURE__ */ jsxs82(
52546
52790
  "button",
52547
52791
  {
@@ -56067,7 +56311,7 @@ function useColorGradingPreviews({
56067
56311
  let cancelled = false;
56068
56312
  let complete = false;
56069
56313
  let inFlight = false;
56070
- let timedOut = false;
56314
+ let timedOut2 = false;
56071
56315
  const timers = [];
56072
56316
  setState((current) => ({
56073
56317
  ...current,
@@ -56094,7 +56338,7 @@ function useColorGradingPreviews({
56094
56338
  previews: {
56095
56339
  ...current.previews,
56096
56340
  [kind]: {
56097
- status: result.complete ? "ready" : timedOut ? "unavailable" : "loading",
56341
+ status: result.complete ? "ready" : timedOut2 ? "unavailable" : "loading",
56098
56342
  images: kind === "effects" ? { ...current.previews[kind].images, ...result.images } : result.images,
56099
56343
  width: result.width,
56100
56344
  height: result.height
@@ -56119,7 +56363,7 @@ function useColorGradingPreviews({
56119
56363
  timers.push(
56120
56364
  window.setTimeout(() => {
56121
56365
  if (cancelled || complete) return;
56122
- timedOut = true;
56366
+ timedOut2 = true;
56123
56367
  setState((current) => ({
56124
56368
  ...current,
56125
56369
  previews: {
@@ -56961,7 +57205,7 @@ function ColorField({
56961
57205
  const track2 = useTrackDesignInput();
56962
57206
  const buttonRef = useRef91(null);
56963
57207
  const panelRef = useRef91(null);
56964
- const [open, setOpen] = useState70(false);
57208
+ const [open2, setOpen] = useState70(false);
56965
57209
  const [panelPosition, setPanelPosition] = useState70(null);
56966
57210
  const [draftColor, setDraftColor] = useState70(() => colorFromCss(value));
56967
57211
  const draftColorRef = useRef91(draftColor);
@@ -57042,7 +57286,7 @@ function ColorField({
57042
57286
  );
57043
57287
  }, []);
57044
57288
  useLayoutEffect12(() => {
57045
- if (!open) return;
57289
+ if (!open2) return;
57046
57290
  updatePanelPosition();
57047
57291
  const handlePositionInvalidated = () => updatePanelPosition();
57048
57292
  window.addEventListener("resize", handlePositionInvalidated);
@@ -57051,9 +57295,9 @@ function ColorField({
57051
57295
  window.removeEventListener("resize", handlePositionInvalidated);
57052
57296
  window.removeEventListener("scroll", handlePositionInvalidated, true);
57053
57297
  };
57054
- }, [open, updatePanelPosition]);
57298
+ }, [open2, updatePanelPosition]);
57055
57299
  useEffect77(() => {
57056
- if (!open) return;
57300
+ if (!open2) return;
57057
57301
  panelRef.current?.focus();
57058
57302
  const restoreTarget = buttonRef.current;
57059
57303
  const handlePointerDown = (event) => {
@@ -57076,7 +57320,7 @@ function ColorField({
57076
57320
  document.removeEventListener("pointerdown", handlePointerDown);
57077
57321
  document.removeEventListener("keydown", handleKeyDown);
57078
57322
  };
57079
- }, [cancelColorGesture, open, settleColorGesture]);
57323
+ }, [cancelColorGesture, open2, settleColorGesture]);
57080
57324
  const previewColor = (nextColor) => {
57081
57325
  previewColorGesture(formatCssColor(nextColor));
57082
57326
  };
@@ -57100,7 +57344,7 @@ function ColorField({
57100
57344
  beginColorGesture();
57101
57345
  previewColorGesture(normalized);
57102
57346
  };
57103
- const picker = open ? createPortal13(
57347
+ const picker = open2 ? createPortal13(
57104
57348
  /* @__PURE__ */ jsxs93(
57105
57349
  "div",
57106
57350
  {
@@ -57259,9 +57503,9 @@ function ColorField({
57259
57503
  ) : null;
57260
57504
  const openPicker = () => {
57261
57505
  if (disabled) return;
57262
- if (open) settleColorGesture();
57506
+ if (open2) settleColorGesture();
57263
57507
  setOpen((current) => !current);
57264
- if (!open) {
57508
+ if (!open2) {
57265
57509
  requestAnimationFrame(updatePanelPosition);
57266
57510
  }
57267
57511
  };
@@ -57283,10 +57527,10 @@ function ColorField({
57283
57527
  "span",
57284
57528
  {
57285
57529
  className: "h-4 w-4 shrink-0 rounded-[4px]",
57286
- style: { backgroundColor: open ? currentColor : value || "transparent" }
57530
+ style: { backgroundColor: open2 ? currentColor : value || "transparent" }
57287
57531
  }
57288
57532
  ),
57289
- /* @__PURE__ */ jsx131("span", { className: "font-mono text-[11px] text-panel-text-0", children: open ? currentColor : value }),
57533
+ /* @__PURE__ */ jsx131("span", { className: "font-mono text-[11px] text-panel-text-0", children: open2 ? currentColor : value }),
57290
57534
  mixed && /* @__PURE__ */ jsx131(
57291
57535
  "span",
57292
57536
  {
@@ -57323,7 +57567,7 @@ function ColorField({
57323
57567
  "aria-label": `Pick ${label.toLowerCase()} color`,
57324
57568
  ref: buttonRef,
57325
57569
  onClick: openPicker,
57326
- className: `${FIELD} flex items-center gap-3 text-left hover:border-neutral-700 disabled:cursor-not-allowed ${open ? "border-neutral-600" : ""}`,
57570
+ className: `${FIELD} flex items-center gap-3 text-left hover:border-neutral-700 disabled:cursor-not-allowed ${open2 ? "border-neutral-600" : ""}`,
57327
57571
  children: [
57328
57572
  /* @__PURE__ */ jsx131(
57329
57573
  "div",
@@ -57511,7 +57755,7 @@ function FontFamilyField({
57511
57755
  const containerRef = useRef92(null);
57512
57756
  const inputRef = useRef92(null);
57513
57757
  const fontInputRef = useRef92(null);
57514
- const [open, setOpen] = useState71(false);
57758
+ const [open2, setOpen] = useState71(false);
57515
57759
  const [query, setQuery] = useState71("");
57516
57760
  const [activeIndex, setActiveIndex] = useState71(-1);
57517
57761
  const [localFonts, setLocalFonts] = useState71([]);
@@ -57526,7 +57770,7 @@ function FontFamilyField({
57526
57770
  onCommit(nextValue);
57527
57771
  };
57528
57772
  useEffect78(() => {
57529
- if (!open) return;
57773
+ if (!open2) return;
57530
57774
  const handlePointerDown = (event) => {
57531
57775
  const target = event.target;
57532
57776
  if (!(target instanceof Node)) return;
@@ -57534,14 +57778,14 @@ function FontFamilyField({
57534
57778
  };
57535
57779
  document.addEventListener("pointerdown", handlePointerDown);
57536
57780
  return () => document.removeEventListener("pointerdown", handlePointerDown);
57537
- }, [open]);
57781
+ }, [open2]);
57538
57782
  useEffect78(() => {
57539
- if (!open) return;
57783
+ if (!open2) return;
57540
57784
  requestAnimationFrame(() => inputRef.current?.focus());
57541
- }, [open]);
57785
+ }, [open2]);
57542
57786
  useEffect78(() => {
57543
- if (open) loadFontLists();
57544
- }, [open]);
57787
+ if (open2) loadFontLists();
57788
+ }, [open2]);
57545
57789
  useEffect78(() => {
57546
57790
  if (lists.googleKeys.has(currentFamily.toLowerCase())) {
57547
57791
  loadGoogleFontStylesheet(currentFamily);
@@ -57602,7 +57846,7 @@ function FontFamilyField({
57602
57846
  [importedFonts]
57603
57847
  );
57604
57848
  const options = useMemo53(() => {
57605
- if (!open) return [];
57849
+ if (!open2) return [];
57606
57850
  const documentFonts = collectDocumentFontFamilies();
57607
57851
  return sortFontOptions(
57608
57852
  uniqueFontOptions([
@@ -57616,7 +57860,7 @@ function FontFamilyField({
57616
57860
  ...DEFAULT_FONT_FAMILIES.map((f) => ({ family: f, source: "System" }))
57617
57861
  ])
57618
57862
  );
57619
- }, [open, currentFamily, lists, localFonts, projectFontAssets]);
57863
+ }, [open2, currentFamily, lists, localFonts, projectFontAssets]);
57620
57864
  const filteredOptions = useMemo53(() => {
57621
57865
  const matches = options.filter((o) => fontMatchesQuery(o.family, query));
57622
57866
  if (query.trim()) return matches.slice(0, 200);
@@ -57686,7 +57930,7 @@ function FontFamilyField({
57686
57930
  setQuery("");
57687
57931
  setOpen(false);
57688
57932
  };
57689
- const dropdown = open && /* @__PURE__ */ jsxs94("div", { className: "absolute left-0 right-0 top-[calc(100%+6px)] z-50 overflow-hidden rounded-xl border border-neutral-700 bg-neutral-950 shadow-2xl", children: [
57933
+ const dropdown = open2 && /* @__PURE__ */ jsxs94("div", { className: "absolute left-0 right-0 top-[calc(100%+6px)] z-50 overflow-hidden rounded-xl border border-neutral-700 bg-neutral-950 shadow-2xl", children: [
57690
57934
  /* @__PURE__ */ jsxs94("div", { className: "grid grid-cols-[minmax(0,1fr)_auto_auto] gap-2 border-b border-neutral-800 p-2", children: [
57691
57935
  /* @__PURE__ */ jsx132(
57692
57936
  "input",
@@ -57722,7 +57966,7 @@ function FontFamilyField({
57722
57966
  }
57723
57967
  },
57724
57968
  role: "combobox",
57725
- "aria-expanded": open,
57969
+ "aria-expanded": open2,
57726
57970
  "aria-autocomplete": "list",
57727
57971
  className: "min-w-0 rounded-lg border border-neutral-800 bg-neutral-900 px-2.5 py-2 text-[11px] font-medium text-neutral-100 outline-hidden placeholder:text-neutral-600 focus:border-neutral-600"
57728
57972
  }
@@ -61215,14 +61459,14 @@ var STYLES = {
61215
61459
  }
61216
61460
  };
61217
61461
  function GsapAddAnimationControl({
61218
- open,
61462
+ open: open2,
61219
61463
  setOpen,
61220
61464
  onAddAnimation,
61221
61465
  track: track2,
61222
61466
  variant
61223
61467
  }) {
61224
61468
  const styles = STYLES[variant];
61225
- return /* @__PURE__ */ jsx147("div", { className: "relative pt-1", children: open ? /* @__PURE__ */ jsxs108("div", { className: "flex gap-1.5", children: [
61469
+ return /* @__PURE__ */ jsx147("div", { className: "relative pt-1", children: open2 ? /* @__PURE__ */ jsxs108("div", { className: "flex gap-1.5", children: [
61226
61470
  ADD_METHODS.map((method) => /* @__PURE__ */ jsx147(
61227
61471
  "button",
61228
61472
  {
@@ -64851,7 +65095,7 @@ function FxCarveModule({
64851
65095
  sourceOptions,
64852
65096
  automatedTargets,
64853
65097
  liveAutomationValues,
64854
- open,
65098
+ open: open2,
64855
65099
  disabled,
64856
65100
  analysing,
64857
65101
  onToggleOpen,
@@ -64881,7 +65125,7 @@ function FxCarveModule({
64881
65125
  className: `hf-fx-node-name min-w-0 flex-1 truncate text-left text-[13px] uppercase hover:opacity-80 ${FX_FAMILY_TYPE.smart}`,
64882
65126
  style: { color: tint, letterSpacing: "0.16em" },
64883
65127
  title: "Voiceover carve",
64884
- "aria-expanded": open,
65128
+ "aria-expanded": open2,
64885
65129
  onClick: onToggleOpen,
64886
65130
  children: "Voiceover carve"
64887
65131
  }
@@ -64903,7 +65147,7 @@ function FxCarveModule({
64903
65147
  }
64904
65148
  )
64905
65149
  ] }),
64906
- open && on ? /* @__PURE__ */ jsxs124("div", { className: "hf-fx-carve-body border-t border-panel-border-input", children: [
65150
+ open2 && on ? /* @__PURE__ */ jsxs124("div", { className: "hf-fx-carve-body border-t border-panel-border-input", children: [
64907
65151
  /* @__PURE__ */ jsxs124("div", { className: "hf-fx-carve-controls space-y-0.5 px-1.5 py-1.5", children: [
64908
65152
  /* @__PURE__ */ jsx165(
64909
65153
  CarveSourceRow,
@@ -65172,7 +65416,7 @@ function Fader2({
65172
65416
  function FxEqModule({
65173
65417
  eqId,
65174
65418
  bands,
65175
- open,
65419
+ open: open2,
65176
65420
  disabled,
65177
65421
  onToggleOpen,
65178
65422
  onPreview,
@@ -65196,7 +65440,7 @@ function FxEqModule({
65196
65440
  {
65197
65441
  type: "button",
65198
65442
  className: `hf-fx-node-name flex-1 text-left text-[11px] text-panel-text-0 ${FX_FAMILY_TYPE.smart}`,
65199
- "aria-expanded": open,
65443
+ "aria-expanded": open2,
65200
65444
  onClick: onToggleOpen,
65201
65445
  children: "Tone"
65202
65446
  }
@@ -65217,7 +65461,7 @@ function FxEqModule({
65217
65461
  }
65218
65462
  )
65219
65463
  ] }),
65220
- open ? /* @__PURE__ */ jsxs125("div", { className: "hf-fx-eq-body px-2 pb-2", children: [
65464
+ open2 ? /* @__PURE__ */ jsxs125("div", { className: "hf-fx-eq-body px-2 pb-2", children: [
65221
65465
  /* @__PURE__ */ jsx166("div", { className: "flex gap-1.5", children: bands.map((band) => /* @__PURE__ */ jsx166(
65222
65466
  Fader2,
65223
65467
  {
@@ -65597,7 +65841,7 @@ function FxNodeHeader({
65597
65841
  label,
65598
65842
  family,
65599
65843
  position,
65600
- open,
65844
+ open: open2,
65601
65845
  bypassed,
65602
65846
  first,
65603
65847
  last,
@@ -65615,7 +65859,7 @@ function FxNodeHeader({
65615
65859
  type: "button",
65616
65860
  className: `hf-fx-node-name flex-1 truncate text-left text-[11px] text-panel-text-1 hover:text-panel-text-0 ${family}`,
65617
65861
  title: label,
65618
- "aria-expanded": open,
65862
+ "aria-expanded": open2,
65619
65863
  onClick: onToggleOpen,
65620
65864
  children: label
65621
65865
  }
@@ -65671,7 +65915,7 @@ function FxNodeRow({
65671
65915
  liveAutomationValues,
65672
65916
  onAutomateParam,
65673
65917
  onRemoveParamAutomation,
65674
- open,
65918
+ open: open2,
65675
65919
  last,
65676
65920
  disabled,
65677
65921
  onToggleOpen,
@@ -65713,7 +65957,7 @@ function FxNodeRow({
65713
65957
  family: FX_FAMILY_TYPE[fxFamilyOf(node)],
65714
65958
  position,
65715
65959
  label: node.label ?? EFFECT_COPY[node.type]?.title ?? registryDef.label,
65716
- open,
65960
+ open: open2,
65717
65961
  bypassed,
65718
65962
  first: index === 0,
65719
65963
  last,
@@ -65736,7 +65980,7 @@ function FxNodeRow({
65736
65980
  children: summary
65737
65981
  }
65738
65982
  ) : null,
65739
- open ? /* @__PURE__ */ jsx170(
65983
+ open2 ? /* @__PURE__ */ jsx170(
65740
65984
  FxNodeOpenBody,
65741
65985
  {
65742
65986
  node,
@@ -68552,7 +68796,7 @@ function sampleColorGradingSecondary(pixels, width, height, x, y, radius = 2) {
68552
68796
  // src/components/editor/useColorGradingScopes.ts
68553
68797
  var CAPTURE_DEBOUNCE_MS = 180;
68554
68798
  function useColorGradingScopes({
68555
- open,
68799
+ open: open2,
68556
68800
  captureFrame,
68557
68801
  refreshKey
68558
68802
  }) {
@@ -68562,7 +68806,7 @@ function useColorGradingScopes({
68562
68806
  const captureRef = useRef107(captureFrame);
68563
68807
  captureRef.current = captureFrame;
68564
68808
  useEffect97(() => {
68565
- if (!open) {
68809
+ if (!open2) {
68566
68810
  setAnalysis(null);
68567
68811
  setStatus("idle");
68568
68812
  return;
@@ -68593,7 +68837,7 @@ function useColorGradingScopes({
68593
68837
  cancelled = true;
68594
68838
  window.clearTimeout(timer);
68595
68839
  };
68596
- }, [open, refreshKey, refreshVersion]);
68840
+ }, [open2, refreshKey, refreshVersion]);
68597
68841
  return { analysis, status, refresh: () => setRefreshVersion((version) => version + 1) };
68598
68842
  }
68599
68843
 
@@ -68735,11 +68979,11 @@ function PropertyPanelColorScopes({
68735
68979
  captureFrame,
68736
68980
  refreshKey
68737
68981
  }) {
68738
- const [open, setOpen] = useState98(false);
68982
+ const [open2, setOpen] = useState98(false);
68739
68983
  const [mode, setMode] = useState98("waveform");
68740
68984
  const canvasRef = useRef108(null);
68741
68985
  const { analysis, status, refresh: refresh2 } = useColorGradingScopes({
68742
- open,
68986
+ open: open2,
68743
68987
  captureFrame,
68744
68988
  refreshKey
68745
68989
  });
@@ -68763,11 +69007,11 @@ function PropertyPanelColorScopes({
68763
69007
  className: "flex min-h-7 flex-1 items-center justify-between text-left",
68764
69008
  children: [
68765
69009
  /* @__PURE__ */ jsx181("span", { className: "text-[11px] text-panel-text-2", children: "Scopes" }),
68766
- /* @__PURE__ */ jsx181("span", { className: "text-[9px] text-panel-text-5", children: open ? status : "Off" })
69010
+ /* @__PURE__ */ jsx181("span", { className: "text-[9px] text-panel-text-5", children: open2 ? status : "Off" })
68767
69011
  ]
68768
69012
  }
68769
69013
  ),
68770
- /* @__PURE__ */ jsx181("span", { className: "flex items-center gap-2", children: open && /* @__PURE__ */ jsx181(
69014
+ /* @__PURE__ */ jsx181("span", { className: "flex items-center gap-2", children: open2 && /* @__PURE__ */ jsx181(
68771
69015
  "button",
68772
69016
  {
68773
69017
  type: "button",
@@ -68779,7 +69023,7 @@ function PropertyPanelColorScopes({
68779
69023
  }
68780
69024
  ) })
68781
69025
  ] }),
68782
- open && /* @__PURE__ */ jsxs138("div", { className: "space-y-1.5", children: [
69026
+ open2 && /* @__PURE__ */ jsxs138("div", { className: "space-y-1.5", children: [
68783
69027
  /* @__PURE__ */ jsx181("div", { className: "flex items-center gap-2 overflow-x-auto", children: MODES.map((candidate) => /* @__PURE__ */ jsx181(
68784
69028
  "button",
68785
69029
  {
@@ -70705,7 +70949,7 @@ function FlatEffectsSection({
70705
70949
  type: "button",
70706
70950
  "data-flat-effects-add-toggle": "true",
70707
70951
  "aria-expanded": catalogOpen,
70708
- onClick: () => setCatalogOpen((open) => !open),
70952
+ onClick: () => setCatalogOpen((open2) => !open2),
70709
70953
  className: "flex min-h-[30px] items-center gap-1 text-[10px] font-medium text-accent-ink hover:text-accent-ink/80",
70710
70954
  children: [
70711
70955
  /* @__PURE__ */ jsx187(Plus, { size: 11 }),
@@ -73835,7 +74079,7 @@ import { XIcon, WarningIcon, CheckCircleIcon, CaretRightIcon } from "@phosphor-i
73835
74079
  import { useEffect as useEffect109, useCallback as useCallback96, useRef as useRef121 } from "react";
73836
74080
  var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary, [contenteditable="true"], [tabindex]:not([tabindex="-1"])';
73837
74081
  function useDialogBehavior({
73838
- open,
74082
+ open: open2,
73839
74083
  onClose,
73840
74084
  containerRef,
73841
74085
  canClose
@@ -73851,7 +74095,7 @@ function useDialogBehavior({
73851
74095
  onCloseRef.current();
73852
74096
  }, []);
73853
74097
  useEffect109(() => {
73854
- if (!open) return;
74098
+ if (!open2) return;
73855
74099
  const previouslyFocused = document.activeElement;
73856
74100
  restoreRef.current = previouslyFocused instanceof HTMLElement ? previouslyFocused : null;
73857
74101
  const container = containerRef.current;
@@ -73885,7 +74129,7 @@ function useDialogBehavior({
73885
74129
  restoreRef.current?.focus();
73886
74130
  restoreRef.current = null;
73887
74131
  };
73888
- }, [open, containerRef, requestClose]);
74132
+ }, [open2, containerRef, requestClose]);
73889
74133
  return { requestClose };
73890
74134
  }
73891
74135
 
@@ -77444,7 +77688,7 @@ ${laneKey}`;
77444
77688
  // and the preview only while no drag is live.
77445
77689
  claim(laneKey, apply, source) {
77446
77690
  const key2 = scoped(laneKey);
77447
- const open = () => scoped(laneKey) === key2;
77691
+ const open2 = () => scoped(laneKey) === key2;
77448
77692
  const trusted = clean.has(key2);
77449
77693
  const claimed = take(key2);
77450
77694
  const mine = ++saves;
@@ -77452,7 +77696,7 @@ ${laneKey}`;
77452
77696
  if (claimed !== void 0 && trusted) verified2.set(key2, claimed);
77453
77697
  pending2.set(key2, (pending2.get(key2) ?? /* @__PURE__ */ new Set()).add(mine));
77454
77698
  const preview2 = (value) => {
77455
- if (open() && !before.has(key2) && !overtaken(key2, mine)) apply.preview(value);
77699
+ if (open2() && !before.has(key2) && !overtaken(key2, mine)) apply.preview(value);
77456
77700
  };
77457
77701
  return {
77458
77702
  preview: preview2,
@@ -77469,7 +77713,7 @@ ${laneKey}`;
77469
77713
  verified2.delete(key2);
77470
77714
  if (!before.has(key2)) sources.delete(key2);
77471
77715
  }
77472
- if (value === void 0 || overtaken(key2, mine) || !open()) return;
77716
+ if (value === void 0 || overtaken(key2, mine) || !open2()) return;
77473
77717
  if (before.has(key2)) {
77474
77718
  before.set(key2, value);
77475
77719
  clean.add(key2);
@@ -90531,7 +90775,7 @@ function DownloadStep({ progress, onDownload }) {
90531
90775
  const installed = isInstalled(progress);
90532
90776
  if (!progress.downloaded && !installed)
90533
90777
  return /* @__PURE__ */ jsxs162(Step, { n: 1, state: NOW, title: `Download HyperFrames for ${where}`, children: [
90534
- /* @__PURE__ */ jsx208("p", { className: NOTE, children: "Free. Opens hyperframes.dev in a new tab." }),
90778
+ /* @__PURE__ */ jsx208("p", { className: NOTE, children: "Free. Opens hyperframes.studio in a new tab." }),
90535
90779
  /* @__PURE__ */ jsxs162(
90536
90780
  Button,
90537
90781
  {
@@ -90802,7 +91046,7 @@ function useGuide(route, setRoute) {
90802
91046
  else setFailed(true);
90803
91047
  showCard(true);
90804
91048
  };
90805
- const open = async () => {
91049
+ const open2 = async () => {
90806
91050
  if (opening) return;
90807
91051
  setOpening(true);
90808
91052
  setFailed(false);
@@ -90822,7 +91066,7 @@ function useGuide(route, setRoute) {
90822
91066
  }
90823
91067
  };
90824
91068
  const progress = { route, opening, failed: failed2, downloaded, slow, arrived };
90825
- return { progress, cardOpen, showCard, download, open };
91069
+ return { progress, cardOpen, showCard, download, open: open2 };
90826
91070
  }
90827
91071
  function OpenInDesktopButton() {
90828
91072
  const projectDir = useFileManagerContextOptional()?.projectDir ?? null;
@@ -90833,7 +91077,7 @@ function OpenInDesktopButton() {
90833
91077
  useImpression(trigger, route);
90834
91078
  const guide = useGuide(route, setRoute);
90835
91079
  if (!guide) return null;
90836
- const { progress, cardOpen, showCard, download, open } = guide;
91080
+ const { progress, cardOpen, showCard, download, open: open2 } = guide;
90837
91081
  const label = labelOf(progress);
90838
91082
  const waiting = isWaiting(progress);
90839
91083
  return /* @__PURE__ */ jsx209(
@@ -90841,7 +91085,7 @@ function OpenInDesktopButton() {
90841
91085
  {
90842
91086
  open: cardOpen,
90843
91087
  onOpenChange: (next) => {
90844
- if (next && progress.route.handoff && !progress.failed) return void open();
91088
+ if (next && progress.route.handoff && !progress.failed) return void open2();
90845
91089
  showCard(next);
90846
91090
  },
90847
91091
  side: "bottom",
@@ -90871,7 +91115,7 @@ function OpenInDesktopButton() {
90871
91115
  progress,
90872
91116
  projectDir,
90873
91117
  onDownload: download,
90874
- onOpen: () => void open()
91118
+ onOpen: () => void open2()
90875
91119
  }
90876
91120
  )
90877
91121
  }
@@ -96618,7 +96862,7 @@ function scaleOptionLabel(scale, dims) {
96618
96862
  }
96619
96863
  var FORMAT_PANEL_SIZE = { width: 208, height: 210 };
96620
96864
  function FormatInfoTooltip({ format }) {
96621
- const [open, setOpen] = useState154(false);
96865
+ const [open2, setOpen] = useState154(false);
96622
96866
  const [position, setPosition] = useState154(null);
96623
96867
  const triggerRef = useRef183(null);
96624
96868
  const timeoutRef = useRef183(void 0);
@@ -96632,7 +96876,7 @@ function FormatInfoTooltip({ format }) {
96632
96876
  };
96633
96877
  useEffect152(() => () => clearTimeout(timeoutRef.current), []);
96634
96878
  useLayoutEffect16(() => {
96635
- if (!open) return;
96879
+ if (!open2) return;
96636
96880
  const el = triggerRef.current;
96637
96881
  if (!el) return;
96638
96882
  setPosition(
@@ -96643,15 +96887,15 @@ function FormatInfoTooltip({ format }) {
96643
96887
  { offset: 6 }
96644
96888
  )
96645
96889
  );
96646
- }, [open]);
96890
+ }, [open2]);
96647
96891
  useEffect152(() => {
96648
- if (!open) return;
96892
+ if (!open2) return;
96649
96893
  const onKeyDown = (e) => {
96650
96894
  if (e.key === "Escape") setOpen(false);
96651
96895
  };
96652
96896
  document.addEventListener("keydown", onKeyDown);
96653
96897
  return () => document.removeEventListener("keydown", onKeyDown);
96654
- }, [open]);
96898
+ }, [open2]);
96655
96899
  const info = FORMAT_INFO[format];
96656
96900
  return /* @__PURE__ */ jsxs191("div", { ref: triggerRef, className: "relative", onPointerEnter: show, onPointerLeave: hide, children: [
96657
96901
  /* @__PURE__ */ jsx239(
@@ -96659,8 +96903,8 @@ function FormatInfoTooltip({ format }) {
96659
96903
  {
96660
96904
  type: "button",
96661
96905
  "aria-label": "About video formats",
96662
- "aria-expanded": open,
96663
- "aria-describedby": open ? panelId : void 0,
96906
+ "aria-expanded": open2,
96907
+ "aria-describedby": open2 ? panelId : void 0,
96664
96908
  onFocus: show,
96665
96909
  onBlur: hide,
96666
96910
  onClick: () => setOpen((prev) => !prev),
@@ -96686,7 +96930,7 @@ function FormatInfoTooltip({ format }) {
96686
96930
  )
96687
96931
  }
96688
96932
  ),
96689
- open && createPortal15(
96933
+ open2 && createPortal15(
96690
96934
  /* @__PURE__ */ jsxs191(
96691
96935
  "div",
96692
96936
  {