@hyperframes/studio 0.8.210 → 0.8.212

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.
package/dist/index.js CHANGED
@@ -54,7 +54,7 @@ import {
54
54
  whenPreviewBooted,
55
55
  writeStudioUiPreferences,
56
56
  zoomToSelectedClips
57
- } from "./chunk-7SREYKIC.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,304 @@ 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, end) {
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, end };
28225
+ }
28226
+ function typedBody(body, start, request2) {
28159
28227
  const source = body.getReader();
28228
+ const stopped = () => request2.end?.atTarget?.aborted && request2.end.ended(start);
28229
+ request2.signal.addEventListener("abort", stopped, { once: true });
28160
28230
  return new ReadableStream({
28161
28231
  async pull(controller) {
28162
28232
  try {
28163
- const { done, value } = await source.read();
28164
- if (done) controller.close();
28165
- else controller.enqueue(value);
28233
+ const { done, value } = await request2.wait(source.read());
28234
+ if (!done) return controller.enqueue(value);
28235
+ request2.done();
28236
+ request2.end?.ended(start);
28237
+ controller.close();
28166
28238
  } catch (error) {
28167
- controller.error(typedFailure(reader, error));
28239
+ request2.done();
28240
+ controller.error(request2.failure(error, start));
28168
28241
  }
28169
28242
  },
28170
- cancel: (reason) => source.cancel(reason)
28243
+ cancel: (reason) => {
28244
+ request2.done();
28245
+ return source.cancel(reason);
28246
+ }
28171
28247
  });
28172
28248
  }
28249
+ async function typedFetch(reader, input, sent, asked, request2) {
28250
+ let response;
28251
+ try {
28252
+ response = await fetch(input, { ...sent, signal: request2.signal });
28253
+ } catch (error) {
28254
+ request2.done();
28255
+ throw request2.failure(error, asked);
28256
+ }
28257
+ if (response.ok) return response;
28258
+ request2.done();
28259
+ throw new MediaFetchError(reader, response.status, null, asked);
28260
+ }
28261
+ function typedResponse(response, asked, request2) {
28262
+ if (!response.body) {
28263
+ request2.done();
28264
+ return response;
28265
+ }
28266
+ const { status, statusText, headers } = response;
28267
+ const body = typedBody(response.body, status === 206 ? asked : 0, request2);
28268
+ return new Response(body, { status, statusText, headers });
28269
+ }
28173
28270
  function mediaUrlSourceOptions(reader) {
28174
- let failures = 0;
28271
+ const failuresByStart = /* @__PURE__ */ new Map();
28272
+ const inFlightReads = new AbortController();
28273
+ let ranges = reader === "thumbnail" ? "unknown" : "hidden";
28175
28274
  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 });
28275
+ const sent = ranges === "readable" ? boundedRange(init) : init;
28276
+ const asked = Number(rangeStart(sent, true) ?? 0);
28277
+ const request2 = watchedRequest(
28278
+ reader,
28279
+ init?.signal ? [inFlightReads.signal, init.signal] : [inFlightReads.signal],
28280
+ { ended: (start) => failuresByStart.delete(start), atTarget: init?.signal }
28281
+ );
28282
+ const response = await typedFetch(reader, input, sent ?? {}, asked, request2);
28283
+ if (ranges !== "hidden") ranges = rangesReadable(sent, response) ? "readable" : "hidden";
28284
+ return typedResponse(response, asked, request2);
28186
28285
  };
28187
28286
  const getRetryDelay = (_previousAttempts, error) => {
28287
+ const start = error instanceof MediaFetchError ? error.start : null;
28288
+ const failed2 = failuresByStart.get(start) ?? 0;
28188
28289
  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;
28290
+ if (error instanceof MediaFetchError) error.setRetries(failed2);
28291
+ if (clientError || failed2 >= MAX_RETRIES) return null;
28292
+ failuresByStart.set(start, failed2 + 1);
28293
+ return 0.5 * (failed2 + 1);
28193
28294
  };
28194
- return { fetchFn, getRetryDelay };
28295
+ const cancelReads = () => inFlightReads.abort(new DOMException("Media reads cancelled", "AbortError"));
28296
+ if (reader === "probe") return { fetchFn, getRetryDelay, cancelReads };
28297
+ return { fetchFn, getRetryDelay, cancelReads, maxCacheSize: POOLED_READER_CACHE_BYTES };
28195
28298
  }
28196
28299
  function reportMediaFetchFailure(error) {
28197
28300
  if (!(error instanceof MediaFetchError)) return;
28198
28301
  console.warn(`[Studio] ${error.message}`);
28199
28302
  }
28200
28303
 
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
28304
+ // src/player/lib/thumbnailSourcePool.ts
28305
+ var pool = /* @__PURE__ */ new Map();
28306
+ var mediabunnyModule = null;
28307
+ var loadMediabunny = () => mediabunnyModule ??= import("mediabunny");
28308
+ var abortError = () => new DOMException("Aborted", "AbortError");
28309
+ var timedOut = (signal) => signal.reason?.name === "TimeoutError";
28310
+ var isAbortError = (error) => error?.name === "AbortError";
28311
+ function dispose(source, entry2) {
28312
+ if (entry2.disposed) return;
28313
+ entry2.disposed = true;
28314
+ if (entry2.idleTimer !== null) clearTimeout(entry2.idleTimer);
28315
+ if (pool.get(source) === entry2) pool.delete(source);
28316
+ entry2.input?.dispose();
28317
+ entry2.cancelReads?.();
28318
+ }
28319
+ function retire(source, entry2) {
28320
+ if (pool.get(source) === entry2) pool.delete(source);
28321
+ if (entry2.users === 0) dispose(source, entry2);
28322
+ }
28323
+ async function open(source, pooled) {
28324
+ const mediabunny = await loadMediabunny();
28325
+ const entry2 = pooled();
28326
+ const live = () => {
28327
+ if (entry2.disposed) throw abortError();
28328
+ };
28329
+ live();
28330
+ const options = mediaUrlSourceOptions("thumbnail");
28331
+ const input = new mediabunny.Input({
28332
+ source: new mediabunny.UrlSource(source, options),
28333
+ formats: mediabunny.ALL_FORMATS
28334
+ });
28335
+ entry2.input = input;
28336
+ entry2.cancelReads = options.cancelReads;
28337
+ const track2 = await input.getPrimaryVideoTrack();
28338
+ live();
28339
+ if (!track2) throw new Error("Video source has no decodable video track");
28340
+ const [displayWidth, displayHeight] = await Promise.all([
28341
+ track2.getDisplayWidth(),
28342
+ track2.getDisplayHeight()
28343
+ ]);
28344
+ live();
28345
+ if (!(displayWidth > 0 && displayHeight > 0)) {
28346
+ throw new Error("Video source has invalid dimensions");
28347
+ }
28348
+ const metadataDuration = await track2.getDurationFromMetadata({ skipLiveWait: true });
28349
+ live();
28350
+ return { mediabunny, track: track2, info: { aspect: displayWidth / displayHeight, metadataDuration } };
28351
+ }
28352
+ function pooledSource(source, version) {
28353
+ const current = pool.get(source);
28354
+ if (current && current.version === version) return current;
28355
+ if (current) retire(source, current);
28356
+ const entry2 = {
28357
+ version,
28358
+ input: null,
28359
+ cancelReads: null,
28360
+ ready: false,
28361
+ opened: open(source, () => entry2),
28362
+ users: 0,
28363
+ progress: { framesFromAnyJob: 0 },
28364
+ idleTimer: null,
28365
+ disposed: false
28366
+ };
28367
+ entry2.opened.then(
28368
+ () => entry2.ready = true,
28369
+ () => retire(source, entry2)
28211
28370
  );
28212
- return [...edges, safeStart + Math.max(0, safeDuration - LAST_FRAME_INSET_S)];
28371
+ pool.set(source, entry2);
28372
+ return entry2;
28213
28373
  }
28374
+ function untilAborted(pending2, signal) {
28375
+ if (signal.aborted) return Promise.reject(abortError());
28376
+ return new Promise((resolve, reject) => {
28377
+ const onAbort = () => reject(abortError());
28378
+ signal.addEventListener("abort", onAbort, { once: true });
28379
+ void pending2.then(resolve, reject).finally(() => signal.removeEventListener("abort", onAbort));
28380
+ });
28381
+ }
28382
+ async function acquireThumbnailSource(source, version, signal, idleMs) {
28383
+ const entry2 = pooledSource(source, version);
28384
+ const waitedForOpen = !entry2.ready;
28385
+ entry2.users += 1;
28386
+ if (entry2.idleTimer !== null) clearTimeout(entry2.idleTimer);
28387
+ entry2.idleTimer = null;
28388
+ let released2 = false;
28389
+ const release2 = (failed2) => {
28390
+ if (released2) return;
28391
+ released2 = true;
28392
+ entry2.users -= 1;
28393
+ if (failed2) retire(source, entry2);
28394
+ if (entry2.users > 0 || entry2.disposed) return;
28395
+ if (pool.get(source) === entry2 && idleMs > 0) {
28396
+ entry2.idleTimer = setTimeout(() => dispose(source, entry2), idleMs);
28397
+ } else {
28398
+ dispose(source, entry2);
28399
+ }
28400
+ };
28401
+ try {
28402
+ const { progress } = entry2;
28403
+ return { ...await untilAborted(entry2.opened, signal), release: release2, waitedForOpen, progress };
28404
+ } catch (error) {
28405
+ release2(!isAbortError(error) || timedOut(signal));
28406
+ throw error;
28407
+ }
28408
+ }
28409
+
28410
+ // src/player/lib/thumbnailFrameCache.ts
28214
28411
  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;
28412
+ var released = /* @__PURE__ */ new Map();
28413
+ var releasedBytes = 0;
28414
+ function use(frame3) {
28415
+ if (frame3.users++ === 0 && released.delete(frame3)) releasedBytes -= frame3.bytes;
28220
28416
  return frame3;
28221
28417
  }
28222
- function shareFrame(key2, decodedAt, url) {
28418
+ function takeSharedFrame(key2, accepts2) {
28419
+ const frame3 = sharedFrames.get(key2)?.find((shared2) => accepts2(shared2.decodedAt));
28420
+ return frame3 && use(frame3);
28421
+ }
28422
+ function shareFrame(key2, decodedAt, url, bytes) {
28223
28423
  const frames = sharedFrames.get(key2) ?? [];
28224
28424
  const existing = frames.find((shared2) => shared2.decodedAt === decodedAt);
28225
28425
  if (existing) {
28226
- existing.users += 1;
28227
28426
  URL.revokeObjectURL(url);
28228
- return existing;
28427
+ return use(existing);
28229
28428
  }
28230
- const frame3 = { url, decodedAt, users: 1 };
28429
+ const frame3 = { url, decodedAt, bytes, users: 1 };
28231
28430
  sharedFrames.set(key2, [...frames, frame3]);
28232
28431
  return frame3;
28233
28432
  }
28234
- function releaseSharedFrames(held) {
28433
+ function evict(frame3, key2) {
28434
+ released.delete(frame3);
28435
+ releasedBytes -= frame3.bytes;
28436
+ const rest = sharedFrames.get(key2)?.filter((shared2) => shared2 !== frame3) ?? [];
28437
+ if (rest.length > 0) sharedFrames.set(key2, rest);
28438
+ else sharedFrames.delete(key2);
28439
+ URL.revokeObjectURL(frame3.url);
28440
+ }
28441
+ function releaseSharedFrames(held, budgetBytes) {
28235
28442
  for (const { key: key2, frame: frame3 } of held.splice(0)) {
28236
28443
  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);
28444
+ released.set(frame3, key2);
28445
+ releasedBytes += frame3.bytes;
28446
+ }
28447
+ for (const [frame3, key2] of released) {
28448
+ if (releasedBytes <= budgetBytes) break;
28449
+ evict(frame3, key2);
28241
28450
  }
28242
28451
  }
28452
+
28453
+ // src/player/lib/thumbnailVideoDecoder.ts
28454
+ var LAST_FRAME_INSET_S = 1e-3;
28455
+ function videoThumbnailTimestamps(start, duration, frameCount) {
28456
+ const safeStart = Math.max(0, Number.isFinite(start) ? start : 0);
28457
+ const safeDuration = Math.max(0, Number.isFinite(duration) ? duration : 0);
28458
+ const count = Math.max(1, Number.isFinite(frameCount) ? Math.floor(frameCount) : 1);
28459
+ if (count === 1) return [safeStart + safeDuration / 2];
28460
+ const edges = Array.from(
28461
+ { length: count },
28462
+ (_, index) => safeStart + safeDuration * index / count
28463
+ );
28464
+ return [...edges, safeStart + Math.max(0, safeDuration - LAST_FRAME_INSET_S)];
28465
+ }
28466
+ var sourceInfos = /* @__PURE__ */ new Map();
28467
+ var accepts = (window2, time, decodedAt) => decodedAt >= window2.sourceStart && time - decodedAt <= (time >= window2.end ? 0 : window2.lead);
28468
+ var ClipResultError = class extends Error {
28469
+ };
28243
28470
  async function canvasToBlob(canvas) {
28244
28471
  if (canvas instanceof HTMLCanvasElement) {
28245
28472
  return new Promise((resolve, reject) => {
28246
28473
  canvas.toBlob(
28247
- (blob) => blob ? resolve(blob) : reject(new Error("Video thumbnail encode failed")),
28474
+ (blob) => blob ? resolve(blob) : reject(new ClipResultError("Video thumbnail encode failed")),
28248
28475
  "image/jpeg",
28249
28476
  0.72
28250
28477
  );
28251
28478
  });
28252
28479
  }
28253
- return canvas.convertToBlob({ type: "image/jpeg", quality: 0.72 });
28480
+ return canvas.convertToBlob({ type: "image/jpeg", quality: 0.72 }).catch(() => {
28481
+ throw new ClipResultError("Video thumbnail encode failed");
28482
+ });
28254
28483
  }
28484
+ var timeoutWithoutProgress = () => new MediaFetchError("thumbnail", null, "timeout");
28485
+ var isAbortError2 = (error) => error?.name === "AbortError";
28486
+ var isSourceFailure = (error) => !isAbortError2(error) && !(error instanceof ClipResultError);
28255
28487
  function throwIfAborted(signal) {
28256
28488
  if (signal.aborted) throw new DOMException("Aborted", "AbortError");
28257
28489
  }
28258
28490
  function releaseDecodedResources(resources) {
28259
28491
  resources.urls.length = 0;
28260
- releaseSharedFrames(resources.held);
28492
+ releaseSharedFrames(resources.held, resources.releasedFrameBytes);
28261
28493
  for (const canvas of resources.canvases) {
28262
28494
  canvas.width = 0;
28263
28495
  canvas.height = 0;
@@ -28303,14 +28535,14 @@ function takeDecodedFrames({ timestamps, window: window2 }, keyOf17, resources)
28303
28535
  const missing = [];
28304
28536
  timestamps.forEach((time, slot) => {
28305
28537
  const key2 = keyOf17(time);
28306
- const frame3 = takeSharedFrame(key2, time, window2);
28538
+ const frame3 = takeSharedFrame(key2, (decodedAt) => accepts(window2, time, decodedAt));
28307
28539
  if (!frame3) return void missing.push(slot);
28308
28540
  resources.urls[slot] = frame3.url;
28309
28541
  resources.held.push({ key: key2, frame: frame3 });
28310
28542
  });
28311
28543
  return missing;
28312
28544
  }
28313
- async function decodeFrames(sink, times, slots, signal, resources) {
28545
+ async function decodeFrames(sink, times, slots, signal, resources, progress) {
28314
28546
  let next = 0;
28315
28547
  for await (const wrapped of sink.canvasesAtTimestamps(times)) {
28316
28548
  throwIfAborted(signal);
@@ -28319,7 +28551,8 @@ async function decodeFrames(sink, times, slots, signal, resources) {
28319
28551
  resources.canvases.add(wrapped.canvas);
28320
28552
  const blob = await canvasToBlob(wrapped.canvas);
28321
28553
  throwIfAborted(signal);
28322
- const frame3 = shareFrame(target.key, target.decodedAt, URL.createObjectURL(blob));
28554
+ const frame3 = shareFrame(target.key, target.decodedAt, URL.createObjectURL(blob), blob.size);
28555
+ progress.framesFromAnyJob += 1;
28323
28556
  resources.urls[target.slot] = frame3.url;
28324
28557
  resources.held.push({ key: target.key, frame: frame3 });
28325
28558
  }
@@ -28328,7 +28561,7 @@ async function decodeFrames(sink, times, slots, signal, resources) {
28328
28561
  function loadedResult(resources, aspect, budgets, frameCount = resources.urls.length) {
28329
28562
  const decoded = resources.urls.filter((url) => url !== void 0);
28330
28563
  const firstUrl = decoded[0];
28331
- if (!firstUrl) throw new Error("Video source returned no thumbnail frames");
28564
+ if (!firstUrl) throw new ClipResultError("Video source returned no thumbnail frames");
28332
28565
  let nearest = firstUrl;
28333
28566
  const urls = Array.from(
28334
28567
  { length: frameCount },
@@ -28346,7 +28579,12 @@ async function decodeVideoThumbnail(request2, signal, budgets = TIMELINE_VIEWPOR
28346
28579
  const fit = request2.fit ?? "cover";
28347
28580
  const sourceKey = createThumbnailKey({ source: request2.source, version: request2.contentVersion });
28348
28581
  const keyOf17 = (time) => `${sourceKey}\0${fit}\0${time}`;
28349
- const resources = { urls: [], held: [], canvases: /* @__PURE__ */ new Set() };
28582
+ const resources = {
28583
+ urls: [],
28584
+ held: [],
28585
+ canvases: /* @__PURE__ */ new Set(),
28586
+ releasedFrameBytes: budgets.sharedFrameCacheBytes
28587
+ };
28350
28588
  const entry2 = sourceInfos.get(request2.source);
28351
28589
  const known = entry2?.version === request2.contentVersion ? entry2?.info : void 0;
28352
28590
  try {
@@ -28365,27 +28603,29 @@ async function decodeVideoThumbnail(request2, signal, budgets = TIMELINE_VIEWPOR
28365
28603
  }
28366
28604
  }
28367
28605
  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
- });
28606
+ let source;
28607
+ try {
28608
+ source = await acquireThumbnailSource(
28609
+ request2.source,
28610
+ request2.contentVersion,
28611
+ signal,
28612
+ budgets.thumbnailSourceIdleMs
28613
+ );
28614
+ } catch (error) {
28615
+ if (timedOut(signal)) reportMediaFetchFailure(timeoutWithoutProgress());
28616
+ throw error;
28617
+ }
28618
+ const framesBefore = source.progress.framesFromAnyJob;
28619
+ const releaseOnAbort = () => {
28620
+ const madeProgress = source.waitedForOpen || source.progress.framesFromAnyJob > framesBefore;
28621
+ const failed2 = timedOut(signal) && !madeProgress;
28622
+ if (failed2) reportMediaFetchFailure(timeoutWithoutProgress());
28623
+ source.release(failed2);
28624
+ };
28625
+ signal.addEventListener("abort", releaseOnAbort, { once: true });
28374
28626
  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
28627
  throwIfAborted(signal);
28388
- const info = { aspect: displayWidth / displayHeight, metadataDuration };
28628
+ const { mediabunny, track: track2, info } = source;
28389
28629
  sourceInfos.set(request2.source, { version: request2.contentVersion, info });
28390
28630
  const strip = stripTimes(request2, info, budgets);
28391
28631
  const { timestamps, window: window2 } = strip;
@@ -28412,11 +28652,17 @@ async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources
28412
28652
  fit: request2.fit ?? "cover",
28413
28653
  poolSize: 1
28414
28654
  });
28415
- await decodeFrames(sink, decodeTimesAtNearbyKeyframes(), slots, signal, resources);
28655
+ const times = decodeTimesAtNearbyKeyframes();
28656
+ await decodeFrames(sink, times, slots, signal, resources, source.progress);
28416
28657
  }
28417
- return loadedResult(resources, info.aspect, budgets, timestamps.length);
28658
+ const result = loadedResult(resources, info.aspect, budgets, timestamps.length);
28659
+ source.release(false);
28660
+ return result;
28661
+ } catch (error) {
28662
+ source.release(isSourceFailure(error));
28663
+ throw error;
28418
28664
  } finally {
28419
- input.dispose();
28665
+ signal.removeEventListener("abort", releaseOnAbort);
28420
28666
  }
28421
28667
  }
28422
28668
 
@@ -28457,6 +28703,8 @@ function ThumbnailTiles({
28457
28703
 
28458
28704
  // src/player/components/VideoThumbnail.tsx
28459
28705
  import { jsx as jsx78, jsxs as jsxs53 } from "react/jsx-runtime";
28706
+ var unbindPlaybackHold = bindThumbnailPlaybackHold(usePlayerStore, thumbnailScheduler);
28707
+ import.meta.hot?.dispose(unbindPlaybackHold);
28460
28708
  function createVideoThumbnailRequest(props, frameCount, rich) {
28461
28709
  const {
28462
28710
  videoSrc,
@@ -29072,10 +29320,10 @@ var SHUTTLE_SPEEDS = [1, 2, 4];
29072
29320
  var claims = 0;
29073
29321
  function acquireCanvasNudgeKeys() {
29074
29322
  claims += 1;
29075
- let released = false;
29323
+ let released2 = false;
29076
29324
  return () => {
29077
- if (released) return;
29078
- released = true;
29325
+ if (released2) return;
29326
+ released2 = true;
29079
29327
  claims -= 1;
29080
29328
  };
29081
29329
  }
@@ -32230,15 +32478,15 @@ var accessSequence = 0;
32230
32478
  var activeProbes = 0;
32231
32479
  var registryEpoch = 0;
32232
32480
  var probeQueue = [];
32233
- var mediabunnyModule = null;
32234
- async function loadMediabunny() {
32235
- if (mediabunnyModule === false) return null;
32236
- if (mediabunnyModule) return mediabunnyModule;
32481
+ var mediabunnyModule2 = null;
32482
+ async function loadMediabunny2() {
32483
+ if (mediabunnyModule2 === false) return null;
32484
+ if (mediabunnyModule2) return mediabunnyModule2;
32237
32485
  try {
32238
- mediabunnyModule = await import("mediabunny");
32239
- return mediabunnyModule;
32486
+ mediabunnyModule2 = await import("mediabunny");
32487
+ return mediabunnyModule2;
32240
32488
  } catch {
32241
- mediabunnyModule = false;
32489
+ mediabunnyModule2 = false;
32242
32490
  return null;
32243
32491
  }
32244
32492
  }
@@ -32250,7 +32498,7 @@ function normalizeUrl(url) {
32250
32498
  }
32251
32499
  }
32252
32500
  async function probeOne(url) {
32253
- const mb = await loadMediabunny();
32501
+ const mb = await loadMediabunny2();
32254
32502
  if (!mb) return null;
32255
32503
  const input = new mb.Input({
32256
32504
  source: new mb.UrlSource(url, mediaUrlSourceOptions("probe")),
@@ -39248,21 +39496,21 @@ function pickBest(candidates) {
39248
39496
  (c) => c.source === "element" || c.source === "composition"
39249
39497
  );
39250
39498
  const gridCandidates = candidates.filter((c) => c.source === "grid");
39251
- let pool;
39499
+ let pool2;
39252
39500
  const bestElem = elementCandidates.length ? Math.min(...elementCandidates.map((c) => c.distance)) : Infinity;
39253
39501
  const bestGrid = gridCandidates.length ? Math.min(...gridCandidates.map((c) => c.distance)) : Infinity;
39254
39502
  if (bestElem <= bestGrid) {
39255
- pool = elementCandidates;
39503
+ pool2 = elementCandidates;
39256
39504
  } else {
39257
- pool = gridCandidates;
39505
+ pool2 = gridCandidates;
39258
39506
  }
39259
- const minDist = Math.min(...pool.map((c) => c.distance));
39260
- const winners = pool.filter((c) => c.distance === minDist);
39507
+ const minDist = Math.min(...pool2.map((c) => c.distance));
39508
+ const winners = pool2.filter((c) => c.distance === minDist);
39261
39509
  const hasPositive = winners.some((c) => c.adjustment > 0);
39262
39510
  const hasNegative = winners.some((c) => c.adjustment < 0);
39263
39511
  if (hasPositive && hasNegative) return null;
39264
39512
  const adjustment = winners[0].adjustment;
39265
- const matches = pool.filter((c) => c.adjustment === adjustment);
39513
+ const matches = pool2.filter((c) => c.adjustment === adjustment);
39266
39514
  return { adjustment, matches };
39267
39515
  }
39268
39516
  function computeGuideExtent(axis, movingRect, matchedTargetIds, targetMap) {
@@ -40225,7 +40473,7 @@ function createDomEditSaveQueue(options = {}) {
40225
40473
  drainError = null;
40226
40474
  if (notify && wasOpen) options.onReset?.();
40227
40475
  };
40228
- const open = (error) => {
40476
+ const open2 = (error) => {
40229
40477
  if (breakerOpen) return;
40230
40478
  breakerOpen = true;
40231
40479
  options.onOpen?.({
@@ -40246,7 +40494,7 @@ function createDomEditSaveQueue(options = {}) {
40246
40494
  drainError = error;
40247
40495
  consecutiveFailures += 1;
40248
40496
  if (getStudioSaveStatusCode(error) === 409 || consecutiveFailures >= failureThreshold)
40249
- open(error);
40497
+ open2(error);
40250
40498
  throw error;
40251
40499
  }
40252
40500
  };
@@ -42699,28 +42947,28 @@ function useInlineTextEdit({
42699
42947
  const openRef = useRef69(null);
42700
42948
  const framesRef = useRef69(null);
42701
42949
  const teardown = useCallback59(() => {
42702
- const open = openRef.current;
42703
- if (!open) return null;
42950
+ const open2 = openRef.current;
42951
+ if (!open2) return null;
42704
42952
  if (framesRef.current !== null) {
42705
- open.element.ownerDocument.defaultView?.cancelAnimationFrame(framesRef.current);
42953
+ open2.element.ownerDocument.defaultView?.cancelAnimationFrame(framesRef.current);
42706
42954
  framesRef.current = null;
42707
42955
  }
42708
42956
  openRef.current = null;
42709
- endStudioManualEditGesture(open.element, open.gesture);
42957
+ endStudioManualEditGesture(open2.element, open2.gesture);
42710
42958
  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;
42959
+ if (open2.element.isConnected) {
42960
+ open2.element.removeAttribute("contenteditable");
42961
+ open2.element.style.outline = open2.outline;
42962
+ open2.element.style.outlineOffset = open2.outlineOffset;
42963
+ clearSelectionWithin(open2.element);
42964
+ open2.element.blur();
42965
+ }
42966
+ return open2;
42719
42967
  }, []);
42720
42968
  const start = useCallback59(
42721
42969
  (element, caretAt) => {
42722
42970
  if (openRef.current || readOnly) return false;
42723
- const open = {
42971
+ const open2 = {
42724
42972
  element,
42725
42973
  original: element.innerHTML,
42726
42974
  outline: element.style.outline,
@@ -42729,8 +42977,8 @@ function useInlineTextEdit({
42729
42977
  };
42730
42978
  element.style.outline = EDITING_OUTLINE;
42731
42979
  element.style.outlineOffset = "2px";
42732
- openRef.current = open;
42733
- setSession(open);
42980
+ openRef.current = open2;
42981
+ setSession(open2);
42734
42982
  onPause?.();
42735
42983
  element.setAttribute("contenteditable", EDITABLE);
42736
42984
  const view = element.ownerDocument.defaultView;
@@ -42746,23 +42994,23 @@ function useInlineTextEdit({
42746
42994
  [onPause, readOnly]
42747
42995
  );
42748
42996
  const commit2 = useCallback59(() => {
42749
- const open = openRef.current;
42750
- if (!open) return;
42751
- sanitizeRichTextChildren(open.element);
42752
- const html2 = open.element.innerHTML;
42997
+ const open2 = openRef.current;
42998
+ if (!open2) return;
42999
+ sanitizeRichTextChildren(open2.element);
43000
+ const html2 = open2.element.innerHTML;
42753
43001
  let save = () => {
42754
43002
  };
42755
43003
  trackStudioPendingEdit(new Promise((resolve) => save = resolve));
42756
43004
  const commitText = () => {
42757
43005
  teardown();
42758
- return onCommit({ element: open.element, html: html2, previousHtml: open.original });
43006
+ return onCommit({ element: open2.element, html: html2, previousHtml: open2.original });
42759
43007
  };
42760
- save(countStudioManualEditSave(open.element, commitText));
43008
+ save(countStudioManualEditSave(open2.element, commitText));
42761
43009
  }, [onCommit, teardown]);
42762
43010
  const cancel = useCallback59(() => {
42763
- const open = openRef.current;
42764
- if (!open) return;
42765
- if (open.element.isConnected) open.element.innerHTML = open.original;
43011
+ const open2 = openRef.current;
43012
+ if (!open2) return;
43013
+ if (open2.element.isConnected) open2.element.innerHTML = open2.original;
42766
43014
  teardown();
42767
43015
  }, [teardown]);
42768
43016
  useEffect53(() => {
@@ -43560,10 +43808,10 @@ var zPersistCounts = /* @__PURE__ */ new WeakMap();
43560
43808
  var REVEAL_RETRY_MS = 16;
43561
43809
  function beginLayerZPersist(element) {
43562
43810
  zPersistCounts.set(element, (zPersistCounts.get(element) ?? 0) + 1);
43563
- let released = false;
43811
+ let released2 = false;
43564
43812
  return () => {
43565
- if (released) return;
43566
- released = true;
43813
+ if (released2) return;
43814
+ released2 = true;
43567
43815
  const remaining = (zPersistCounts.get(element) ?? 1) - 1;
43568
43816
  if (remaining > 0) zPersistCounts.set(element, remaining);
43569
43817
  else zPersistCounts.delete(element);
@@ -50517,7 +50765,7 @@ function findToolDefinitionError(tool) {
50517
50765
  if (!tool.description.trim()) return "description must not be empty";
50518
50766
  return null;
50519
50767
  }
50520
- function isAbortError(error) {
50768
+ function isAbortError3(error) {
50521
50769
  return error instanceof DOMException && error.name === "AbortError";
50522
50770
  }
50523
50771
  function invalidState(tool, message) {
@@ -50532,7 +50780,7 @@ async function registerOne(modelContext, tool, signal) {
50532
50780
  await modelContext.registerTool(tool, { signal });
50533
50781
  return { status: "registered" };
50534
50782
  } catch (error) {
50535
- if (isAbortError(error)) return { status: "aborted" };
50783
+ if (isAbortError3(error)) return { status: "aborted" };
50536
50784
  return {
50537
50785
  status: "failed",
50538
50786
  failure: {
@@ -52369,7 +52617,7 @@ function snapshot(api) {
52369
52617
  };
52370
52618
  }
52371
52619
  function createController(api, options) {
52372
- const open = (id) => {
52620
+ const open2 = (id) => {
52373
52621
  if (api.getPanel(id)) return;
52374
52622
  const { zone, reopen: preferred } = PANEL_DEFINITIONS[id];
52375
52623
  const reopen = zone === "center" || options.panels.includes(preferred.near) ? preferred : { near: "preview", direction: zone };
@@ -52383,9 +52631,9 @@ function createController(api, options) {
52383
52631
  addRegisteredPanel(api, id, hasAnchor ? position : void 0);
52384
52632
  };
52385
52633
  return {
52386
- open,
52634
+ open: open2,
52387
52635
  activate: (id) => {
52388
- open(id);
52636
+ open2(id);
52389
52637
  api.getPanel(id)?.api.setActive();
52390
52638
  },
52391
52639
  close: (id) => {
@@ -52505,11 +52753,11 @@ function Panel({ id, title, children }) {
52505
52753
  const element = useSlots().slots[id];
52506
52754
  const visible = useDockLayoutStore((state) => state.visiblePanels.has(id));
52507
52755
  const controller = useDockLayoutStore((state) => state.controller);
52508
- const open = useDockLayoutStore((state) => state.openPanels.has(id));
52756
+ const open2 = useDockLayoutStore((state) => state.openPanels.has(id));
52509
52757
  const label = title ?? PANEL_DEFINITIONS[id].title;
52510
52758
  useEffect67(() => {
52511
- if (open) controller?.setTitle(id, label);
52512
- }, [controller, id, label, open]);
52759
+ if (open2) controller?.setTitle(id, label);
52760
+ }, [controller, id, label, open2]);
52513
52761
  const definition = PANEL_DEFINITIONS[id];
52514
52762
  const shown3 = visible || definition.keepMounted;
52515
52763
  return element && shown3 ? createPortal12(children, element) : null;
@@ -52519,29 +52767,29 @@ function WindowMenu() {
52519
52767
  const panels = useDockLayoutStore((state) => state.panels);
52520
52768
  const togglePanel = useDockLayoutStore((state) => state.togglePanel);
52521
52769
  const resetLayout = useDockLayoutStore((state) => state.resetLayout);
52522
- const [open, setOpen] = useState60(false);
52770
+ const [open2, setOpen] = useState60(false);
52523
52771
  const rootRef = useRef82(null);
52524
52772
  useEffect67(() => {
52525
- if (!open) return;
52773
+ if (!open2) return;
52526
52774
  const close = (event) => {
52527
52775
  if (!rootRef.current?.contains(event.target)) setOpen(false);
52528
52776
  };
52529
52777
  document.addEventListener("pointerdown", close);
52530
52778
  return () => document.removeEventListener("pointerdown", close);
52531
- }, [open]);
52779
+ }, [open2]);
52532
52780
  return /* @__PURE__ */ jsxs82("div", { ref: rootRef, className: "relative", children: [
52533
52781
  /* @__PURE__ */ jsx116(
52534
52782
  "button",
52535
52783
  {
52536
52784
  type: "button",
52537
52785
  "aria-haspopup": "menu",
52538
- "aria-expanded": open,
52786
+ "aria-expanded": open2,
52539
52787
  onClick: () => setOpen((value) => !value),
52540
52788
  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
52789
  children: "Window"
52542
52790
  }
52543
52791
  ),
52544
- open && /* @__PURE__ */ jsxs82("div", { role: "menu", className: `${menuClasses.panel} absolute right-0 top-8 z-50 w-44`, children: [
52792
+ open2 && /* @__PURE__ */ jsxs82("div", { role: "menu", className: `${menuClasses.panel} absolute right-0 top-8 z-50 w-44`, children: [
52545
52793
  panels.map((id) => /* @__PURE__ */ jsxs82(
52546
52794
  "button",
52547
52795
  {
@@ -56067,7 +56315,7 @@ function useColorGradingPreviews({
56067
56315
  let cancelled = false;
56068
56316
  let complete = false;
56069
56317
  let inFlight = false;
56070
- let timedOut = false;
56318
+ let timedOut2 = false;
56071
56319
  const timers = [];
56072
56320
  setState((current) => ({
56073
56321
  ...current,
@@ -56094,7 +56342,7 @@ function useColorGradingPreviews({
56094
56342
  previews: {
56095
56343
  ...current.previews,
56096
56344
  [kind]: {
56097
- status: result.complete ? "ready" : timedOut ? "unavailable" : "loading",
56345
+ status: result.complete ? "ready" : timedOut2 ? "unavailable" : "loading",
56098
56346
  images: kind === "effects" ? { ...current.previews[kind].images, ...result.images } : result.images,
56099
56347
  width: result.width,
56100
56348
  height: result.height
@@ -56119,7 +56367,7 @@ function useColorGradingPreviews({
56119
56367
  timers.push(
56120
56368
  window.setTimeout(() => {
56121
56369
  if (cancelled || complete) return;
56122
- timedOut = true;
56370
+ timedOut2 = true;
56123
56371
  setState((current) => ({
56124
56372
  ...current,
56125
56373
  previews: {
@@ -56961,7 +57209,7 @@ function ColorField({
56961
57209
  const track2 = useTrackDesignInput();
56962
57210
  const buttonRef = useRef91(null);
56963
57211
  const panelRef = useRef91(null);
56964
- const [open, setOpen] = useState70(false);
57212
+ const [open2, setOpen] = useState70(false);
56965
57213
  const [panelPosition, setPanelPosition] = useState70(null);
56966
57214
  const [draftColor, setDraftColor] = useState70(() => colorFromCss(value));
56967
57215
  const draftColorRef = useRef91(draftColor);
@@ -57042,7 +57290,7 @@ function ColorField({
57042
57290
  );
57043
57291
  }, []);
57044
57292
  useLayoutEffect12(() => {
57045
- if (!open) return;
57293
+ if (!open2) return;
57046
57294
  updatePanelPosition();
57047
57295
  const handlePositionInvalidated = () => updatePanelPosition();
57048
57296
  window.addEventListener("resize", handlePositionInvalidated);
@@ -57051,9 +57299,9 @@ function ColorField({
57051
57299
  window.removeEventListener("resize", handlePositionInvalidated);
57052
57300
  window.removeEventListener("scroll", handlePositionInvalidated, true);
57053
57301
  };
57054
- }, [open, updatePanelPosition]);
57302
+ }, [open2, updatePanelPosition]);
57055
57303
  useEffect77(() => {
57056
- if (!open) return;
57304
+ if (!open2) return;
57057
57305
  panelRef.current?.focus();
57058
57306
  const restoreTarget = buttonRef.current;
57059
57307
  const handlePointerDown = (event) => {
@@ -57076,7 +57324,7 @@ function ColorField({
57076
57324
  document.removeEventListener("pointerdown", handlePointerDown);
57077
57325
  document.removeEventListener("keydown", handleKeyDown);
57078
57326
  };
57079
- }, [cancelColorGesture, open, settleColorGesture]);
57327
+ }, [cancelColorGesture, open2, settleColorGesture]);
57080
57328
  const previewColor = (nextColor) => {
57081
57329
  previewColorGesture(formatCssColor(nextColor));
57082
57330
  };
@@ -57100,7 +57348,7 @@ function ColorField({
57100
57348
  beginColorGesture();
57101
57349
  previewColorGesture(normalized);
57102
57350
  };
57103
- const picker = open ? createPortal13(
57351
+ const picker = open2 ? createPortal13(
57104
57352
  /* @__PURE__ */ jsxs93(
57105
57353
  "div",
57106
57354
  {
@@ -57259,9 +57507,9 @@ function ColorField({
57259
57507
  ) : null;
57260
57508
  const openPicker = () => {
57261
57509
  if (disabled) return;
57262
- if (open) settleColorGesture();
57510
+ if (open2) settleColorGesture();
57263
57511
  setOpen((current) => !current);
57264
- if (!open) {
57512
+ if (!open2) {
57265
57513
  requestAnimationFrame(updatePanelPosition);
57266
57514
  }
57267
57515
  };
@@ -57283,10 +57531,10 @@ function ColorField({
57283
57531
  "span",
57284
57532
  {
57285
57533
  className: "h-4 w-4 shrink-0 rounded-[4px]",
57286
- style: { backgroundColor: open ? currentColor : value || "transparent" }
57534
+ style: { backgroundColor: open2 ? currentColor : value || "transparent" }
57287
57535
  }
57288
57536
  ),
57289
- /* @__PURE__ */ jsx131("span", { className: "font-mono text-[11px] text-panel-text-0", children: open ? currentColor : value }),
57537
+ /* @__PURE__ */ jsx131("span", { className: "font-mono text-[11px] text-panel-text-0", children: open2 ? currentColor : value }),
57290
57538
  mixed && /* @__PURE__ */ jsx131(
57291
57539
  "span",
57292
57540
  {
@@ -57323,7 +57571,7 @@ function ColorField({
57323
57571
  "aria-label": `Pick ${label.toLowerCase()} color`,
57324
57572
  ref: buttonRef,
57325
57573
  onClick: openPicker,
57326
- className: `${FIELD} flex items-center gap-3 text-left hover:border-neutral-700 disabled:cursor-not-allowed ${open ? "border-neutral-600" : ""}`,
57574
+ className: `${FIELD} flex items-center gap-3 text-left hover:border-neutral-700 disabled:cursor-not-allowed ${open2 ? "border-neutral-600" : ""}`,
57327
57575
  children: [
57328
57576
  /* @__PURE__ */ jsx131(
57329
57577
  "div",
@@ -57511,7 +57759,7 @@ function FontFamilyField({
57511
57759
  const containerRef = useRef92(null);
57512
57760
  const inputRef = useRef92(null);
57513
57761
  const fontInputRef = useRef92(null);
57514
- const [open, setOpen] = useState71(false);
57762
+ const [open2, setOpen] = useState71(false);
57515
57763
  const [query, setQuery] = useState71("");
57516
57764
  const [activeIndex, setActiveIndex] = useState71(-1);
57517
57765
  const [localFonts, setLocalFonts] = useState71([]);
@@ -57526,7 +57774,7 @@ function FontFamilyField({
57526
57774
  onCommit(nextValue);
57527
57775
  };
57528
57776
  useEffect78(() => {
57529
- if (!open) return;
57777
+ if (!open2) return;
57530
57778
  const handlePointerDown = (event) => {
57531
57779
  const target = event.target;
57532
57780
  if (!(target instanceof Node)) return;
@@ -57534,14 +57782,14 @@ function FontFamilyField({
57534
57782
  };
57535
57783
  document.addEventListener("pointerdown", handlePointerDown);
57536
57784
  return () => document.removeEventListener("pointerdown", handlePointerDown);
57537
- }, [open]);
57785
+ }, [open2]);
57538
57786
  useEffect78(() => {
57539
- if (!open) return;
57787
+ if (!open2) return;
57540
57788
  requestAnimationFrame(() => inputRef.current?.focus());
57541
- }, [open]);
57789
+ }, [open2]);
57542
57790
  useEffect78(() => {
57543
- if (open) loadFontLists();
57544
- }, [open]);
57791
+ if (open2) loadFontLists();
57792
+ }, [open2]);
57545
57793
  useEffect78(() => {
57546
57794
  if (lists.googleKeys.has(currentFamily.toLowerCase())) {
57547
57795
  loadGoogleFontStylesheet(currentFamily);
@@ -57602,7 +57850,7 @@ function FontFamilyField({
57602
57850
  [importedFonts]
57603
57851
  );
57604
57852
  const options = useMemo53(() => {
57605
- if (!open) return [];
57853
+ if (!open2) return [];
57606
57854
  const documentFonts = collectDocumentFontFamilies();
57607
57855
  return sortFontOptions(
57608
57856
  uniqueFontOptions([
@@ -57616,7 +57864,7 @@ function FontFamilyField({
57616
57864
  ...DEFAULT_FONT_FAMILIES.map((f) => ({ family: f, source: "System" }))
57617
57865
  ])
57618
57866
  );
57619
- }, [open, currentFamily, lists, localFonts, projectFontAssets]);
57867
+ }, [open2, currentFamily, lists, localFonts, projectFontAssets]);
57620
57868
  const filteredOptions = useMemo53(() => {
57621
57869
  const matches = options.filter((o) => fontMatchesQuery(o.family, query));
57622
57870
  if (query.trim()) return matches.slice(0, 200);
@@ -57686,7 +57934,7 @@ function FontFamilyField({
57686
57934
  setQuery("");
57687
57935
  setOpen(false);
57688
57936
  };
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: [
57937
+ 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
57938
  /* @__PURE__ */ jsxs94("div", { className: "grid grid-cols-[minmax(0,1fr)_auto_auto] gap-2 border-b border-neutral-800 p-2", children: [
57691
57939
  /* @__PURE__ */ jsx132(
57692
57940
  "input",
@@ -57722,7 +57970,7 @@ function FontFamilyField({
57722
57970
  }
57723
57971
  },
57724
57972
  role: "combobox",
57725
- "aria-expanded": open,
57973
+ "aria-expanded": open2,
57726
57974
  "aria-autocomplete": "list",
57727
57975
  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
57976
  }
@@ -61215,14 +61463,14 @@ var STYLES = {
61215
61463
  }
61216
61464
  };
61217
61465
  function GsapAddAnimationControl({
61218
- open,
61466
+ open: open2,
61219
61467
  setOpen,
61220
61468
  onAddAnimation,
61221
61469
  track: track2,
61222
61470
  variant
61223
61471
  }) {
61224
61472
  const styles = STYLES[variant];
61225
- return /* @__PURE__ */ jsx147("div", { className: "relative pt-1", children: open ? /* @__PURE__ */ jsxs108("div", { className: "flex gap-1.5", children: [
61473
+ return /* @__PURE__ */ jsx147("div", { className: "relative pt-1", children: open2 ? /* @__PURE__ */ jsxs108("div", { className: "flex gap-1.5", children: [
61226
61474
  ADD_METHODS.map((method) => /* @__PURE__ */ jsx147(
61227
61475
  "button",
61228
61476
  {
@@ -64851,7 +65099,7 @@ function FxCarveModule({
64851
65099
  sourceOptions,
64852
65100
  automatedTargets,
64853
65101
  liveAutomationValues,
64854
- open,
65102
+ open: open2,
64855
65103
  disabled,
64856
65104
  analysing,
64857
65105
  onToggleOpen,
@@ -64881,7 +65129,7 @@ function FxCarveModule({
64881
65129
  className: `hf-fx-node-name min-w-0 flex-1 truncate text-left text-[13px] uppercase hover:opacity-80 ${FX_FAMILY_TYPE.smart}`,
64882
65130
  style: { color: tint, letterSpacing: "0.16em" },
64883
65131
  title: "Voiceover carve",
64884
- "aria-expanded": open,
65132
+ "aria-expanded": open2,
64885
65133
  onClick: onToggleOpen,
64886
65134
  children: "Voiceover carve"
64887
65135
  }
@@ -64903,7 +65151,7 @@ function FxCarveModule({
64903
65151
  }
64904
65152
  )
64905
65153
  ] }),
64906
- open && on ? /* @__PURE__ */ jsxs124("div", { className: "hf-fx-carve-body border-t border-panel-border-input", children: [
65154
+ open2 && on ? /* @__PURE__ */ jsxs124("div", { className: "hf-fx-carve-body border-t border-panel-border-input", children: [
64907
65155
  /* @__PURE__ */ jsxs124("div", { className: "hf-fx-carve-controls space-y-0.5 px-1.5 py-1.5", children: [
64908
65156
  /* @__PURE__ */ jsx165(
64909
65157
  CarveSourceRow,
@@ -65172,7 +65420,7 @@ function Fader2({
65172
65420
  function FxEqModule({
65173
65421
  eqId,
65174
65422
  bands,
65175
- open,
65423
+ open: open2,
65176
65424
  disabled,
65177
65425
  onToggleOpen,
65178
65426
  onPreview,
@@ -65196,7 +65444,7 @@ function FxEqModule({
65196
65444
  {
65197
65445
  type: "button",
65198
65446
  className: `hf-fx-node-name flex-1 text-left text-[11px] text-panel-text-0 ${FX_FAMILY_TYPE.smart}`,
65199
- "aria-expanded": open,
65447
+ "aria-expanded": open2,
65200
65448
  onClick: onToggleOpen,
65201
65449
  children: "Tone"
65202
65450
  }
@@ -65217,7 +65465,7 @@ function FxEqModule({
65217
65465
  }
65218
65466
  )
65219
65467
  ] }),
65220
- open ? /* @__PURE__ */ jsxs125("div", { className: "hf-fx-eq-body px-2 pb-2", children: [
65468
+ open2 ? /* @__PURE__ */ jsxs125("div", { className: "hf-fx-eq-body px-2 pb-2", children: [
65221
65469
  /* @__PURE__ */ jsx166("div", { className: "flex gap-1.5", children: bands.map((band) => /* @__PURE__ */ jsx166(
65222
65470
  Fader2,
65223
65471
  {
@@ -65597,7 +65845,7 @@ function FxNodeHeader({
65597
65845
  label,
65598
65846
  family,
65599
65847
  position,
65600
- open,
65848
+ open: open2,
65601
65849
  bypassed,
65602
65850
  first,
65603
65851
  last,
@@ -65615,7 +65863,7 @@ function FxNodeHeader({
65615
65863
  type: "button",
65616
65864
  className: `hf-fx-node-name flex-1 truncate text-left text-[11px] text-panel-text-1 hover:text-panel-text-0 ${family}`,
65617
65865
  title: label,
65618
- "aria-expanded": open,
65866
+ "aria-expanded": open2,
65619
65867
  onClick: onToggleOpen,
65620
65868
  children: label
65621
65869
  }
@@ -65671,7 +65919,7 @@ function FxNodeRow({
65671
65919
  liveAutomationValues,
65672
65920
  onAutomateParam,
65673
65921
  onRemoveParamAutomation,
65674
- open,
65922
+ open: open2,
65675
65923
  last,
65676
65924
  disabled,
65677
65925
  onToggleOpen,
@@ -65713,7 +65961,7 @@ function FxNodeRow({
65713
65961
  family: FX_FAMILY_TYPE[fxFamilyOf(node)],
65714
65962
  position,
65715
65963
  label: node.label ?? EFFECT_COPY[node.type]?.title ?? registryDef.label,
65716
- open,
65964
+ open: open2,
65717
65965
  bypassed,
65718
65966
  first: index === 0,
65719
65967
  last,
@@ -65736,7 +65984,7 @@ function FxNodeRow({
65736
65984
  children: summary
65737
65985
  }
65738
65986
  ) : null,
65739
- open ? /* @__PURE__ */ jsx170(
65987
+ open2 ? /* @__PURE__ */ jsx170(
65740
65988
  FxNodeOpenBody,
65741
65989
  {
65742
65990
  node,
@@ -68552,7 +68800,7 @@ function sampleColorGradingSecondary(pixels, width, height, x, y, radius = 2) {
68552
68800
  // src/components/editor/useColorGradingScopes.ts
68553
68801
  var CAPTURE_DEBOUNCE_MS = 180;
68554
68802
  function useColorGradingScopes({
68555
- open,
68803
+ open: open2,
68556
68804
  captureFrame,
68557
68805
  refreshKey
68558
68806
  }) {
@@ -68562,7 +68810,7 @@ function useColorGradingScopes({
68562
68810
  const captureRef = useRef107(captureFrame);
68563
68811
  captureRef.current = captureFrame;
68564
68812
  useEffect97(() => {
68565
- if (!open) {
68813
+ if (!open2) {
68566
68814
  setAnalysis(null);
68567
68815
  setStatus("idle");
68568
68816
  return;
@@ -68593,7 +68841,7 @@ function useColorGradingScopes({
68593
68841
  cancelled = true;
68594
68842
  window.clearTimeout(timer);
68595
68843
  };
68596
- }, [open, refreshKey, refreshVersion]);
68844
+ }, [open2, refreshKey, refreshVersion]);
68597
68845
  return { analysis, status, refresh: () => setRefreshVersion((version) => version + 1) };
68598
68846
  }
68599
68847
 
@@ -68735,11 +68983,11 @@ function PropertyPanelColorScopes({
68735
68983
  captureFrame,
68736
68984
  refreshKey
68737
68985
  }) {
68738
- const [open, setOpen] = useState98(false);
68986
+ const [open2, setOpen] = useState98(false);
68739
68987
  const [mode, setMode] = useState98("waveform");
68740
68988
  const canvasRef = useRef108(null);
68741
68989
  const { analysis, status, refresh: refresh2 } = useColorGradingScopes({
68742
- open,
68990
+ open: open2,
68743
68991
  captureFrame,
68744
68992
  refreshKey
68745
68993
  });
@@ -68763,11 +69011,11 @@ function PropertyPanelColorScopes({
68763
69011
  className: "flex min-h-7 flex-1 items-center justify-between text-left",
68764
69012
  children: [
68765
69013
  /* @__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" })
69014
+ /* @__PURE__ */ jsx181("span", { className: "text-[9px] text-panel-text-5", children: open2 ? status : "Off" })
68767
69015
  ]
68768
69016
  }
68769
69017
  ),
68770
- /* @__PURE__ */ jsx181("span", { className: "flex items-center gap-2", children: open && /* @__PURE__ */ jsx181(
69018
+ /* @__PURE__ */ jsx181("span", { className: "flex items-center gap-2", children: open2 && /* @__PURE__ */ jsx181(
68771
69019
  "button",
68772
69020
  {
68773
69021
  type: "button",
@@ -68779,7 +69027,7 @@ function PropertyPanelColorScopes({
68779
69027
  }
68780
69028
  ) })
68781
69029
  ] }),
68782
- open && /* @__PURE__ */ jsxs138("div", { className: "space-y-1.5", children: [
69030
+ open2 && /* @__PURE__ */ jsxs138("div", { className: "space-y-1.5", children: [
68783
69031
  /* @__PURE__ */ jsx181("div", { className: "flex items-center gap-2 overflow-x-auto", children: MODES.map((candidate) => /* @__PURE__ */ jsx181(
68784
69032
  "button",
68785
69033
  {
@@ -70705,7 +70953,7 @@ function FlatEffectsSection({
70705
70953
  type: "button",
70706
70954
  "data-flat-effects-add-toggle": "true",
70707
70955
  "aria-expanded": catalogOpen,
70708
- onClick: () => setCatalogOpen((open) => !open),
70956
+ onClick: () => setCatalogOpen((open2) => !open2),
70709
70957
  className: "flex min-h-[30px] items-center gap-1 text-[10px] font-medium text-accent-ink hover:text-accent-ink/80",
70710
70958
  children: [
70711
70959
  /* @__PURE__ */ jsx187(Plus, { size: 11 }),
@@ -73835,7 +74083,7 @@ import { XIcon, WarningIcon, CheckCircleIcon, CaretRightIcon } from "@phosphor-i
73835
74083
  import { useEffect as useEffect109, useCallback as useCallback96, useRef as useRef121 } from "react";
73836
74084
  var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary, [contenteditable="true"], [tabindex]:not([tabindex="-1"])';
73837
74085
  function useDialogBehavior({
73838
- open,
74086
+ open: open2,
73839
74087
  onClose,
73840
74088
  containerRef,
73841
74089
  canClose
@@ -73851,7 +74099,7 @@ function useDialogBehavior({
73851
74099
  onCloseRef.current();
73852
74100
  }, []);
73853
74101
  useEffect109(() => {
73854
- if (!open) return;
74102
+ if (!open2) return;
73855
74103
  const previouslyFocused = document.activeElement;
73856
74104
  restoreRef.current = previouslyFocused instanceof HTMLElement ? previouslyFocused : null;
73857
74105
  const container = containerRef.current;
@@ -73885,7 +74133,7 @@ function useDialogBehavior({
73885
74133
  restoreRef.current?.focus();
73886
74134
  restoreRef.current = null;
73887
74135
  };
73888
- }, [open, containerRef, requestClose]);
74136
+ }, [open2, containerRef, requestClose]);
73889
74137
  return { requestClose };
73890
74138
  }
73891
74139
 
@@ -77444,7 +77692,7 @@ ${laneKey}`;
77444
77692
  // and the preview only while no drag is live.
77445
77693
  claim(laneKey, apply, source) {
77446
77694
  const key2 = scoped(laneKey);
77447
- const open = () => scoped(laneKey) === key2;
77695
+ const open2 = () => scoped(laneKey) === key2;
77448
77696
  const trusted = clean.has(key2);
77449
77697
  const claimed = take(key2);
77450
77698
  const mine = ++saves;
@@ -77452,7 +77700,7 @@ ${laneKey}`;
77452
77700
  if (claimed !== void 0 && trusted) verified2.set(key2, claimed);
77453
77701
  pending2.set(key2, (pending2.get(key2) ?? /* @__PURE__ */ new Set()).add(mine));
77454
77702
  const preview2 = (value) => {
77455
- if (open() && !before.has(key2) && !overtaken(key2, mine)) apply.preview(value);
77703
+ if (open2() && !before.has(key2) && !overtaken(key2, mine)) apply.preview(value);
77456
77704
  };
77457
77705
  return {
77458
77706
  preview: preview2,
@@ -77469,7 +77717,7 @@ ${laneKey}`;
77469
77717
  verified2.delete(key2);
77470
77718
  if (!before.has(key2)) sources.delete(key2);
77471
77719
  }
77472
- if (value === void 0 || overtaken(key2, mine) || !open()) return;
77720
+ if (value === void 0 || overtaken(key2, mine) || !open2()) return;
77473
77721
  if (before.has(key2)) {
77474
77722
  before.set(key2, value);
77475
77723
  clean.add(key2);
@@ -90531,7 +90779,7 @@ function DownloadStep({ progress, onDownload }) {
90531
90779
  const installed = isInstalled(progress);
90532
90780
  if (!progress.downloaded && !installed)
90533
90781
  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." }),
90782
+ /* @__PURE__ */ jsx208("p", { className: NOTE, children: "Free. Opens hyperframes.studio in a new tab." }),
90535
90783
  /* @__PURE__ */ jsxs162(
90536
90784
  Button,
90537
90785
  {
@@ -90802,7 +91050,7 @@ function useGuide(route, setRoute) {
90802
91050
  else setFailed(true);
90803
91051
  showCard(true);
90804
91052
  };
90805
- const open = async () => {
91053
+ const open2 = async () => {
90806
91054
  if (opening) return;
90807
91055
  setOpening(true);
90808
91056
  setFailed(false);
@@ -90822,7 +91070,7 @@ function useGuide(route, setRoute) {
90822
91070
  }
90823
91071
  };
90824
91072
  const progress = { route, opening, failed: failed2, downloaded, slow, arrived };
90825
- return { progress, cardOpen, showCard, download, open };
91073
+ return { progress, cardOpen, showCard, download, open: open2 };
90826
91074
  }
90827
91075
  function OpenInDesktopButton() {
90828
91076
  const projectDir = useFileManagerContextOptional()?.projectDir ?? null;
@@ -90833,7 +91081,7 @@ function OpenInDesktopButton() {
90833
91081
  useImpression(trigger, route);
90834
91082
  const guide = useGuide(route, setRoute);
90835
91083
  if (!guide) return null;
90836
- const { progress, cardOpen, showCard, download, open } = guide;
91084
+ const { progress, cardOpen, showCard, download, open: open2 } = guide;
90837
91085
  const label = labelOf(progress);
90838
91086
  const waiting = isWaiting(progress);
90839
91087
  return /* @__PURE__ */ jsx209(
@@ -90841,7 +91089,7 @@ function OpenInDesktopButton() {
90841
91089
  {
90842
91090
  open: cardOpen,
90843
91091
  onOpenChange: (next) => {
90844
- if (next && progress.route.handoff && !progress.failed) return void open();
91092
+ if (next && progress.route.handoff && !progress.failed) return void open2();
90845
91093
  showCard(next);
90846
91094
  },
90847
91095
  side: "bottom",
@@ -90871,7 +91119,7 @@ function OpenInDesktopButton() {
90871
91119
  progress,
90872
91120
  projectDir,
90873
91121
  onDownload: download,
90874
- onOpen: () => void open()
91122
+ onOpen: () => void open2()
90875
91123
  }
90876
91124
  )
90877
91125
  }
@@ -96618,7 +96866,7 @@ function scaleOptionLabel(scale, dims) {
96618
96866
  }
96619
96867
  var FORMAT_PANEL_SIZE = { width: 208, height: 210 };
96620
96868
  function FormatInfoTooltip({ format }) {
96621
- const [open, setOpen] = useState154(false);
96869
+ const [open2, setOpen] = useState154(false);
96622
96870
  const [position, setPosition] = useState154(null);
96623
96871
  const triggerRef = useRef183(null);
96624
96872
  const timeoutRef = useRef183(void 0);
@@ -96632,7 +96880,7 @@ function FormatInfoTooltip({ format }) {
96632
96880
  };
96633
96881
  useEffect152(() => () => clearTimeout(timeoutRef.current), []);
96634
96882
  useLayoutEffect16(() => {
96635
- if (!open) return;
96883
+ if (!open2) return;
96636
96884
  const el = triggerRef.current;
96637
96885
  if (!el) return;
96638
96886
  setPosition(
@@ -96643,15 +96891,15 @@ function FormatInfoTooltip({ format }) {
96643
96891
  { offset: 6 }
96644
96892
  )
96645
96893
  );
96646
- }, [open]);
96894
+ }, [open2]);
96647
96895
  useEffect152(() => {
96648
- if (!open) return;
96896
+ if (!open2) return;
96649
96897
  const onKeyDown = (e) => {
96650
96898
  if (e.key === "Escape") setOpen(false);
96651
96899
  };
96652
96900
  document.addEventListener("keydown", onKeyDown);
96653
96901
  return () => document.removeEventListener("keydown", onKeyDown);
96654
- }, [open]);
96902
+ }, [open2]);
96655
96903
  const info = FORMAT_INFO[format];
96656
96904
  return /* @__PURE__ */ jsxs191("div", { ref: triggerRef, className: "relative", onPointerEnter: show, onPointerLeave: hide, children: [
96657
96905
  /* @__PURE__ */ jsx239(
@@ -96659,8 +96907,8 @@ function FormatInfoTooltip({ format }) {
96659
96907
  {
96660
96908
  type: "button",
96661
96909
  "aria-label": "About video formats",
96662
- "aria-expanded": open,
96663
- "aria-describedby": open ? panelId : void 0,
96910
+ "aria-expanded": open2,
96911
+ "aria-describedby": open2 ? panelId : void 0,
96664
96912
  onFocus: show,
96665
96913
  onBlur: hide,
96666
96914
  onClick: () => setOpen((prev) => !prev),
@@ -96686,7 +96934,7 @@ function FormatInfoTooltip({ format }) {
96686
96934
  )
96687
96935
  }
96688
96936
  ),
96689
- open && createPortal15(
96937
+ open2 && createPortal15(
96690
96938
  /* @__PURE__ */ jsxs191(
96691
96939
  "div",
96692
96940
  {