@hyperframes/studio 0.8.212 → 0.8.214

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-HD6NXWGI.js";
57
+ } from "./chunk-UNZTUFD7.js";
58
58
  import {
59
59
  Button,
60
60
  ContextMenu,
@@ -492,8 +492,8 @@ function studioRouteKind(hash) {
492
492
  }
493
493
  var ROUTE_IDS_KEY = "hyperframes-studio:routeIds";
494
494
  var routeIds;
495
- function isRouteIdEntry(entry2) {
496
- return Array.isArray(entry2) && entry2.length === 2 && typeof entry2[0] === "string" && typeof entry2[1] === "string" && /^[0-9a-f]{8}$/.test(entry2[1]);
495
+ function isRouteIdEntry(entry3) {
496
+ return Array.isArray(entry3) && entry3.length === 2 && typeof entry3[0] === "string" && typeof entry3[1] === "string" && /^[0-9a-f]{8}$/.test(entry3[1]);
497
497
  }
498
498
  function readRouteIds() {
499
499
  try {
@@ -2109,15 +2109,15 @@ function getTimelineBeatEntries(beatTimes, beatStrengths, range, pinnedIndexes =
2109
2109
  const start = range?.start ?? Number.NEGATIVE_INFINITY;
2110
2110
  const end = range?.end ?? Number.POSITIVE_INFINITY;
2111
2111
  const selected = /* @__PURE__ */ new Set();
2112
- for (let index = findFirstTimeAtOrAfter(beatTimes, start); index < beatTimes.length; index++) {
2113
- const time = beatTimes[index];
2112
+ for (let index2 = findFirstTimeAtOrAfter(beatTimes, start); index2 < beatTimes.length; index2++) {
2113
+ const time = beatTimes[index2];
2114
2114
  if (time === void 0 || time >= end) break;
2115
- selected.add(index);
2115
+ selected.add(index2);
2116
2116
  }
2117
- for (const index of pinnedIndexes) {
2118
- if (index >= 0 && index < beatTimes.length) selected.add(index);
2117
+ for (const index2 of pinnedIndexes) {
2118
+ if (index2 >= 0 && index2 < beatTimes.length) selected.add(index2);
2119
2119
  }
2120
- return [...selected].sort((left, right) => left - right).map((index) => ({ index, time: beatTimes[index], strength: beatStrengths?.[index] }));
2120
+ return [...selected].sort((left, right) => left - right).map((index2) => ({ index: index2, time: beatTimes[index2], strength: beatStrengths?.[index2] }));
2121
2121
  }
2122
2122
  function getTimelineLaneTop(laneIndex) {
2123
2123
  return TRACK_H + Math.max(0, Math.trunc(laneIndex)) * LANE_H;
@@ -2875,8 +2875,8 @@ function buildPushUpCandidate(input) {
2875
2875
  });
2876
2876
  let siblingChanges = 0;
2877
2877
  let requiredZIndex = draggedZIndex + 1;
2878
- for (let index = input.beforeIndex; index >= 0; index -= 1) {
2879
- const layer = input.layers[index];
2878
+ for (let index2 = input.beforeIndex; index2 >= 0; index2 -= 1) {
2879
+ const layer = input.layers[index2];
2880
2880
  if (!layer) continue;
2881
2881
  const nextZIndex = layer.zIndex >= requiredZIndex ? layer.zIndex : requiredZIndex;
2882
2882
  siblingChanges += addLayerChanges(changes, layer, nextZIndex, draggedKey);
@@ -2893,8 +2893,8 @@ function buildPushDownCandidate(input) {
2893
2893
  });
2894
2894
  let siblingChanges = 0;
2895
2895
  let requiredZIndex = draggedZIndex - 1;
2896
- for (let index = input.afterIndex; index < input.layers.length; index += 1) {
2897
- const layer = input.layers[index];
2896
+ for (let index2 = input.afterIndex; index2 < input.layers.length; index2 += 1) {
2897
+ const layer = input.layers[index2];
2898
2898
  if (!layer) continue;
2899
2899
  const nextZIndex = layer.zIndex <= requiredZIndex ? layer.zIndex : requiredZIndex;
2900
2900
  siblingChanges += addLayerChanges(changes, layer, nextZIndex, draggedKey);
@@ -3235,9 +3235,9 @@ function buildTimelineGroupResizeMembers(elements, selectedKeys, grabbedKey, edg
3235
3235
  }
3236
3236
  function resolveTimelineGroupResizeChanges(members, edge, rawDelta, minDuration = resolveTimelineMinDuration()) {
3237
3237
  const result = resolveTimelineGroupResize(members, edge, rawDelta, minDuration);
3238
- return result.members.map((member, index) => ({
3239
- element: members[index].element,
3240
- key: members[index].key,
3238
+ return result.members.map((member, index2) => ({
3239
+ element: members[index2].element,
3240
+ key: members[index2].key,
3241
3241
  start: member.start,
3242
3242
  duration: member.duration,
3243
3243
  playbackStart: member.playbackStart
@@ -4355,8 +4355,8 @@ function generateTicks(duration, pixelsPerSecond, frameRate, range) {
4355
4355
  const maxTicks = 2e3;
4356
4356
  const tickRange = getTickRange(duration, range);
4357
4357
  const firstMajorIndex = Math.max(0, Math.floor(tickRange.start / majorInterval));
4358
- for (let index = firstMajorIndex; major.length < maxTicks; index++) {
4359
- const time = index * majorInterval;
4358
+ for (let index2 = firstMajorIndex; major.length < maxTicks; index2++) {
4359
+ const time = index2 * majorInterval;
4360
4360
  if (time > tickRange.end + 1e-3) break;
4361
4361
  if (time >= tickRange.start - 1e-3) major.push(roundTickValue(time));
4362
4362
  appendMinorTicks(minor, time, minorInterval, subdivisions, tickRange, maxTicks, major.length);
@@ -5210,9 +5210,9 @@ function structuralSelector(element) {
5210
5210
  }
5211
5211
  const parent = node.parentElement;
5212
5212
  if (!parent) break;
5213
- const index = [...parent.children].indexOf(node) + 1;
5214
- if (index < 1) return null;
5215
- parts.unshift(`${node.tagName.toLowerCase()}:nth-child(${index})`);
5213
+ const index2 = [...parent.children].indexOf(node) + 1;
5214
+ if (index2 < 1) return null;
5215
+ parts.unshift(`${node.tagName.toLowerCase()}:nth-child(${index2})`);
5216
5216
  }
5217
5217
  if (parts.length === 0) return null;
5218
5218
  const selector = parts.join(" > ");
@@ -5275,9 +5275,9 @@ function queryIframeElement(iframe, selector) {
5275
5275
  return null;
5276
5276
  }
5277
5277
  }
5278
- function collectAnimatableKeyframeProperties(entry2) {
5278
+ function collectAnimatableKeyframeProperties(entry3) {
5279
5279
  const properties = {};
5280
- for (const [property, value] of Object.entries(entry2)) {
5280
+ for (const [property, value] of Object.entries(entry3)) {
5281
5281
  if (property === "ease") continue;
5282
5282
  if (typeof value === "number") properties[property] = Math.round(value * 1e3) / 1e3;
5283
5283
  else if (typeof value === "string") properties[property] = value;
@@ -5290,12 +5290,12 @@ function parsePercentageKeyframes(kfObj) {
5290
5290
  if (Array.isArray(kfObj)) {
5291
5291
  const steps = kfObj;
5292
5292
  const timing = getObjectArrayKeyframeTiming(
5293
- steps.map((entry2) => entry2?.duration)
5293
+ steps.map((entry3) => entry3?.duration)
5294
5294
  );
5295
5295
  if (!timing) return null;
5296
- steps.forEach((entry2, i) => {
5297
- if (!entry2 || typeof entry2 !== "object") return;
5298
- const properties = collectAnimatableKeyframeProperties(entry2);
5296
+ steps.forEach((entry3, i) => {
5297
+ if (!entry3 || typeof entry3 !== "object") return;
5298
+ const properties = collectAnimatableKeyframeProperties(entry3);
5299
5299
  if (Object.keys(properties).length > 0) {
5300
5300
  keyframes.push({ percentage: timing.percentages[i], properties, step: i });
5301
5301
  }
@@ -6231,9 +6231,9 @@ var ADD_METHOD_LABELS = {
6231
6231
  // src/components/editor/easeCurveSvg.tsx
6232
6232
  import { jsx as jsx9 } from "react/jsx-runtime";
6233
6233
  function sampledPath(samples, x, y, evaluate) {
6234
- return Array.from({ length: samples + 1 }, (_, index) => {
6235
- const progress = index / samples;
6236
- return `${index === 0 ? "M" : "L"}${x(progress)},${y(evaluate(progress))}`;
6234
+ return Array.from({ length: samples + 1 }, (_, index2) => {
6235
+ const progress = index2 / samples;
6236
+ return `${index2 === 0 ? "M" : "L"}${x(progress)},${y(evaluate(progress))}`;
6237
6237
  }).join(" ");
6238
6238
  }
6239
6239
  function holdCurvePath(left, bottom, right, top) {
@@ -8113,13 +8113,13 @@ var TimelineDiamondLane = memo9(function TimelineDiamondLane2({
8113
8113
  }
8114
8114
  return percentage / 100 * clipWidthPx2;
8115
8115
  };
8116
- const markers = sorted.map((keyframe, index) => {
8116
+ const markers = sorted.map((keyframe, index2) => {
8117
8117
  const centerX = centerXOf(keyframe);
8118
8118
  if (keyframe.percentage < 0 || keyframe.percentage > 100) {
8119
8119
  return { keyframe, centerX, hitWidth: diamondSize, visualSize: diamondSize };
8120
8120
  }
8121
- const previous = sorted[index - 1];
8122
- const next = sorted[index + 1];
8121
+ const previous = sorted[index2 - 1];
8122
+ const next = sorted[index2 + 1];
8123
8123
  const previousGap = previous ? centerX - centerXOf(previous) : Infinity;
8124
8124
  const nextGap = next ? centerXOf(next) - centerX : Infinity;
8125
8125
  const nearestGap = Math.max(1, Math.min(previousGap, nextGap));
@@ -8841,9 +8841,9 @@ function computeLaneCounts(tracks, gsapAnimations) {
8841
8841
  function applyGroupStripHeights(tracks, rowHeights, groups, expandedLaneOwnerIds) {
8842
8842
  if (groups.length === 0) return rowHeights;
8843
8843
  const groupByAnchor = new Map(groups.map((group) => [group.anchorKey, group]));
8844
- return tracks.map(([track2], index) => {
8844
+ return tracks.map(([track2], index2) => {
8845
8845
  const group = groupByAnchor.get(track2);
8846
- if (!group || !expandedLaneOwnerIds.has(group.id)) return rowHeights[index] ?? TRACK_H;
8846
+ if (!group || !expandedLaneOwnerIds.has(group.id)) return rowHeights[index2] ?? TRACK_H;
8847
8847
  return TRACK_H + groupOwnLaneCount(group) * AUTOMATION_LANE_H;
8848
8848
  });
8849
8849
  }
@@ -9071,9 +9071,9 @@ function propertyItems(rowId, clip, keyframes) {
9071
9071
  ([leftKey, left], [rightKey, right]) => left.time - right.time || leftKey.localeCompare(rightKey)
9072
9072
  );
9073
9073
  const items = [];
9074
- for (let index = 0; index < ordered.length; index += 1) {
9075
- const [, current] = ordered[index];
9076
- const previous = ordered[index - 1]?.[1];
9074
+ for (let index2 = 0; index2 < ordered.length; index2 += 1) {
9075
+ const [, current] = ordered[index2];
9076
+ const previous = ordered[index2 - 1]?.[1];
9077
9077
  if (previous && current.time > previous.time && current.target.animationId !== void 0) {
9078
9078
  items.push({
9079
9079
  id: timelineEaseFocusId(id, current.target),
@@ -9261,12 +9261,12 @@ function resolveTimelineFocusFallback(previousRows, nextRows, currentId) {
9261
9261
  const previous = locateTimelineLogicalTarget(previousRows, currentId);
9262
9262
  if (!previous) return null;
9263
9263
  if (previous.itemIndex >= 0) {
9264
- for (let index = previous.itemIndex - 1; index >= 0; index -= 1) {
9265
- const candidate = locateTimelineLogicalTarget(nextRows, previous.row.items[index].id);
9264
+ for (let index2 = previous.itemIndex - 1; index2 >= 0; index2 -= 1) {
9265
+ const candidate = locateTimelineLogicalTarget(nextRows, previous.row.items[index2].id);
9266
9266
  if (candidate) return candidate.target;
9267
9267
  }
9268
- for (let index = previous.itemIndex + 1; index < previous.row.items.length; index += 1) {
9269
- const candidate = locateTimelineLogicalTarget(nextRows, previous.row.items[index].id);
9268
+ for (let index2 = previous.itemIndex + 1; index2 < previous.row.items.length; index2 += 1) {
9269
+ const candidate = locateTimelineLogicalTarget(nextRows, previous.row.items[index2].id);
9270
9270
  if (candidate) return candidate.target;
9271
9271
  }
9272
9272
  }
@@ -9353,8 +9353,8 @@ function viewportPageSize(logicalRowCountByTrack, focusedTrackKey, geometry, vie
9353
9353
  Math.floor(geometry.getRowFromY(pageTop + Math.max(0, viewport2.clientHeight - 1e-3)))
9354
9354
  );
9355
9355
  let count = 0;
9356
- for (let index = first; index <= last; index += 1) {
9357
- count += logicalRowCountByTrack.get(geometry.rowKeys[index]) ?? 0;
9356
+ for (let index2 = first; index2 <= last; index2 += 1) {
9357
+ count += logicalRowCountByTrack.get(geometry.rowKeys[index2]) ?? 0;
9358
9358
  }
9359
9359
  return Math.max(1, count);
9360
9360
  }
@@ -9453,9 +9453,9 @@ function isTransitionPair(a, b) {
9453
9453
  function deriveTimelineTransitionSeams(elements) {
9454
9454
  const sorted = [...elements].sort((left, right) => left.start - right.start);
9455
9455
  const seams = [];
9456
- for (let index = 0; index < sorted.length - 1; index += 1) {
9457
- const outgoing = sorted[index];
9458
- const incoming = sorted[index + 1];
9456
+ for (let index2 = 0; index2 < sorted.length - 1; index2 += 1) {
9457
+ const outgoing = sorted[index2];
9458
+ const incoming = sorted[index2 + 1];
9459
9459
  if (outgoing.track !== incoming.track || !isTransitionPair(outgoing, incoming)) continue;
9460
9460
  const outgoingEnd = outgoing.start + outgoing.duration;
9461
9461
  const overlapStart = Math.max(outgoing.start, incoming.start);
@@ -9525,11 +9525,11 @@ function packZoneLanes(clips, base2, laneOf) {
9525
9525
  if (list) list.push(el);
9526
9526
  else byTrack.set(el.track, [el]);
9527
9527
  }
9528
- let used = 0;
9528
+ let used2 = 0;
9529
9529
  for (const track2 of [...byTrack.keys()].sort((a, b) => a - b)) {
9530
- used += packTrackLanes(byTrack.get(track2), base2 + used, laneOf);
9530
+ used2 += packTrackLanes(byTrack.get(track2), base2 + used2, laneOf);
9531
9531
  }
9532
- return used;
9532
+ return used2;
9533
9533
  }
9534
9534
  function normalizeToZones(elements) {
9535
9535
  if (elements.length === 0) return elements;
@@ -9594,7 +9594,7 @@ function layoutAfterTrackInsert(element, previewStart, insertRow, multi, deps) {
9594
9594
  const writableTracks = new Set(topologyOrder);
9595
9595
  topologyOrder = grouped.trackOrder.filter((track2) => writableTracks.has(track2));
9596
9596
  topologyInsertRow = grouped.trackOrder.slice(0, grouped.topologyRows[insertRow]).filter((track2) => writableTracks.has(track2)).length;
9597
- ranks = new Map(topologyOrder.map((track2, index) => [track2, index]));
9597
+ ranks = new Map(topologyOrder.map((track2, index2) => [track2, index2]));
9598
9598
  }
9599
9599
  const topologyTargetTrack = ranks ? topologyInsertRow - 0.5 : insertTrackValue(topologyOrder, topologyInsertRow);
9600
9600
  const normalized = normalizeToZones(
@@ -10077,13 +10077,13 @@ function beginStudioPendingEdit(revert) {
10077
10077
  commitOlderDebouncedEdits();
10078
10078
  let settle;
10079
10079
  const promise = trackStudioPendingEdit(new Promise((resolve) => settle = resolve));
10080
- const entry2 = pendingEdits.get(promise);
10081
- entry2.revert = revert;
10080
+ const entry3 = pendingEdits.get(promise);
10081
+ entry3.revert = revert;
10082
10082
  let landed = Promise.resolve(false);
10083
10083
  let saved2 = false;
10084
- entry2.landed = () => landed;
10084
+ entry3.landed = () => landed;
10085
10085
  const inFlight = {
10086
- reverted: () => entry2.revert === null && revert !== null,
10086
+ reverted: () => entry3.revert === null && revert !== null,
10087
10087
  within(run) {
10088
10088
  const outer = adopting;
10089
10089
  adopting = inFlight;
@@ -10094,16 +10094,16 @@ function beginStudioPendingEdit(revert) {
10094
10094
  }
10095
10095
  },
10096
10096
  drawUnlessUndone(draw) {
10097
- if (inFlight.reverted()) entry2.redraws.push(draw);
10097
+ if (inFlight.reverted()) entry3.redraws.push(draw);
10098
10098
  else draw();
10099
10099
  },
10100
10100
  drawKeepingUndone(draw) {
10101
10101
  if (!inFlight.reverted()) return draw();
10102
- entry2.showAgain?.();
10102
+ entry3.showAgain?.();
10103
10103
  try {
10104
10104
  return draw();
10105
10105
  } finally {
10106
- entry2.showAgain = revert();
10106
+ entry3.showAgain = revert();
10107
10107
  }
10108
10108
  },
10109
10109
  markSaved: () => void (saved2 = true)
@@ -11596,10 +11596,10 @@ function createTimelineClipMaxTrees(intervals) {
11596
11596
  const treeLeafCount = timelineClipTreeLeafCount(intervals.length);
11597
11597
  const maxPositiveEndTree = Array(treeLeafCount * 2).fill(Number.NEGATIVE_INFINITY);
11598
11598
  const maxPointStartTree = Array(treeLeafCount * 2).fill(Number.NEGATIVE_INFINITY);
11599
- for (let index = 0; index < intervals.length; index += 1) {
11600
- const interval = intervals[index];
11599
+ for (let index2 = 0; index2 < intervals.length; index2 += 1) {
11600
+ const interval = intervals[index2];
11601
11601
  if (!interval) continue;
11602
- const leaf = treeLeafCount + index;
11602
+ const leaf = treeLeafCount + index2;
11603
11603
  if (interval.end > interval.start) maxPositiveEndTree[leaf] = interval.end;
11604
11604
  else maxPointStartTree[leaf] = interval.start;
11605
11605
  }
@@ -11678,8 +11678,8 @@ function selectTimelineClipOverlap(interval, range, selected, identities) {
11678
11678
  if (identities !== void 0 && !identities.has(interval.identity)) return;
11679
11679
  selected.add(interval);
11680
11680
  }
11681
- function queryTimelineClipIndex(index, rowKey, range, pinnedIdentities = /* @__PURE__ */ new Set(), actorWindows = []) {
11682
- const row = index.rows.get(rowKey);
11681
+ function queryTimelineClipIndex(index2, rowKey, range, pinnedIdentities = /* @__PURE__ */ new Set(), actorWindows = []) {
11682
+ const row = index2.rows.get(rowKey);
11683
11683
  if (!row) return Object.freeze([]);
11684
11684
  const selected = /* @__PURE__ */ new Set();
11685
11685
  if (range.end > range.start) {
@@ -13209,7 +13209,7 @@ function rectsIntersect(a, b) {
13209
13209
  }
13210
13210
  function getOverlappingFamily(target, entries, isVisible) {
13211
13211
  const visibleEntries = entries.filter(
13212
- (entry2) => entry2.element === target || isVisible(entry2.element)
13212
+ (entry3) => entry3.element === target || isVisible(entry3.element)
13213
13213
  );
13214
13214
  let targetRect;
13215
13215
  try {
@@ -13224,10 +13224,10 @@ function getOverlappingFamily(target, entries, isVisible) {
13224
13224
  right: targetRect.right,
13225
13225
  bottom: targetRect.bottom
13226
13226
  };
13227
- return visibleEntries.filter((entry2) => {
13228
- if (entry2.element === target) return true;
13227
+ return visibleEntries.filter((entry3) => {
13228
+ if (entry3.element === target) return true;
13229
13229
  try {
13230
- const r = entry2.element.getBoundingClientRect();
13230
+ const r = entry3.element.getBoundingClientRect();
13231
13231
  return rectsIntersect(tr, { left: r.left, top: r.top, right: r.right, bottom: r.bottom });
13232
13232
  } catch {
13233
13233
  return false;
@@ -13281,16 +13281,16 @@ function renumberScoped(currentOrder, desiredOrder, target, family) {
13281
13281
  let start = Math.max(lo, minStart);
13282
13282
  if (hasUpper) start = Math.min(start, maxStart);
13283
13283
  const patches2 = [];
13284
- desiredOrder.forEach((entry2, i) => {
13285
- if (entry2.zIndex !== start + i) patches2.push({ element: entry2.element, zIndex: start + i });
13284
+ desiredOrder.forEach((entry3, i) => {
13285
+ if (entry3.zIndex !== start + i) patches2.push({ element: entry3.element, zIndex: start + i });
13286
13286
  });
13287
13287
  return patches2.length === 0 ? null : patches2;
13288
13288
  }
13289
13289
  }
13290
13290
  const desiredGlobal = buildGlobalOrder(family, desiredOrder, target);
13291
13291
  const patches = [];
13292
- desiredGlobal.forEach((entry2, i) => {
13293
- if (entry2.zIndex !== i) patches.push({ element: entry2.element, zIndex: i });
13292
+ desiredGlobal.forEach((entry3, i) => {
13293
+ if (entry3.zIndex !== i) patches.push({ element: entry3.element, zIndex: i });
13294
13294
  });
13295
13295
  return patches.length === 0 ? null : patches;
13296
13296
  }
@@ -13349,16 +13349,16 @@ function resolveZOrderChange(target, action, options) {
13349
13349
  function resolveZOrderReposition(target, desiredOrderBottomToTop) {
13350
13350
  const { entries } = getFamily(target);
13351
13351
  if (entries.length < 2) return null;
13352
- const byElement = new Map(entries.map((entry2) => [entry2.element, entry2]));
13352
+ const byElement = new Map(entries.map((entry3) => [entry3.element, entry3]));
13353
13353
  const desired = [];
13354
13354
  for (const el of desiredOrderBottomToTop) {
13355
- const entry2 = byElement.get(el);
13356
- if (!entry2) return null;
13357
- desired.push(entry2);
13355
+ const entry3 = byElement.get(el);
13356
+ if (!entry3) return null;
13357
+ desired.push(entry3);
13358
13358
  }
13359
- if (desired.length < 2 || !desired.some((entry2) => entry2.element === target)) return null;
13359
+ if (desired.length < 2 || !desired.some((entry3) => entry3.element === target)) return null;
13360
13360
  const currentOrder = toRenderOrder(desired);
13361
- if (currentOrder.every((entry2, i) => entry2.element === desired[i].element)) return null;
13361
+ if (currentOrder.every((entry3, i) => entry3.element === desired[i].element)) return null;
13362
13362
  return realizeOrder(currentOrder, desired, target, entries);
13363
13363
  }
13364
13364
  function resolveCrossedNeighbor(target, action, options) {
@@ -13882,8 +13882,8 @@ var MIN_EVENT_INTERVAL_MS = 6e4;
13882
13882
  function percentile(values, fraction) {
13883
13883
  if (values.length === 0) return void 0;
13884
13884
  const sorted = [...values].sort((a, b) => a - b);
13885
- const index = Math.min(sorted.length - 1, Math.ceil(sorted.length * fraction) - 1);
13886
- return Number(sorted[Math.max(0, index)].toFixed(2));
13885
+ const index2 = Math.min(sorted.length - 1, Math.ceil(sorted.length * fraction) - 1);
13886
+ return Number(sorted[Math.max(0, index2)].toFixed(2));
13887
13887
  }
13888
13888
  function summarizeTimelinePerformance(scroll, context, frameLatencies, frameIntervals) {
13889
13889
  const latencyP95 = percentile(frameLatencies, 0.95);
@@ -14412,16 +14412,16 @@ import { useCallback as useCallback20, useEffect as useEffect20, useMemo as useM
14412
14412
  import { defaultRangeExtractor, useVirtualizer } from "@tanstack/react-virtual";
14413
14413
  function extractTimelineVirtualRowRange(range, pinnedRowIndexes) {
14414
14414
  const indexes = new Set(defaultRangeExtractor(range));
14415
- for (const index of pinnedRowIndexes) {
14416
- if (index >= 0 && index < range.count) indexes.add(index);
14415
+ for (const index2 of pinnedRowIndexes) {
14416
+ if (index2 >= 0 && index2 < range.count) indexes.add(index2);
14417
14417
  }
14418
14418
  return [...indexes].sort((left, right) => left - right);
14419
14419
  }
14420
14420
  function extractTimelineVirtualRowSeed(count, pinnedRowIndexes) {
14421
14421
  const seedCount = Math.min(count, TIMELINE_VIEWPORT_BUDGETS.rowOverscanPerSide * 2 + 1);
14422
- const indexes = new Set(Array.from({ length: seedCount }, (_, index) => index));
14423
- for (const index of pinnedRowIndexes) {
14424
- if (index >= 0 && index < count) indexes.add(index);
14422
+ const indexes = new Set(Array.from({ length: seedCount }, (_, index2) => index2));
14423
+ for (const index2 of pinnedRowIndexes) {
14424
+ if (index2 >= 0 && index2 < count) indexes.add(index2);
14425
14425
  }
14426
14426
  return [...indexes].sort((left, right) => left - right);
14427
14427
  }
@@ -14446,11 +14446,11 @@ function useTimelineVirtualRows({
14446
14446
  [focusedRowKey, pinnedRowKeys, rowGeometry]
14447
14447
  );
14448
14448
  const estimateSize = useCallback20(
14449
- (index) => rowGeometry.getRowHeight(index),
14449
+ (index2) => rowGeometry.getRowHeight(index2),
14450
14450
  [rowGeometry]
14451
14451
  );
14452
14452
  const getItemKey = useCallback20(
14453
- (index) => rowGeometry.rowKeys[index] ?? index,
14453
+ (index2) => rowGeometry.rowKeys[index2] ?? index2,
14454
14454
  [rowGeometry]
14455
14455
  );
14456
14456
  const rangeExtractor = useCallback20(
@@ -14484,21 +14484,21 @@ function useTimelineVirtualRows({
14484
14484
  }
14485
14485
  }, [enabled, focusedRowHeight, focusedRowIndex, sessionEpoch, viewportReady, virtualizer]);
14486
14486
  const compatibilityRows = useMemo22(
14487
- () => enabled ? null : rowGeometry.rowKeys.map((rowKey, index) => ({ index, rowKey })),
14487
+ () => enabled ? null : rowGeometry.rowKeys.map((rowKey, index2) => ({ index: index2, rowKey })),
14488
14488
  [enabled, rowGeometry]
14489
14489
  );
14490
14490
  if (compatibilityRows) return compatibilityRows;
14491
14491
  if (!viewportReady) {
14492
14492
  return extractTimelineVirtualRowSeed(rowGeometry.rowKeys.length, pinnedRowIndexes).map(
14493
- (index) => ({
14494
- index,
14495
- rowKey: rowGeometry.rowKeys[index] ?? index
14493
+ (index2) => ({
14494
+ index: index2,
14495
+ rowKey: rowGeometry.rowKeys[index2] ?? index2
14496
14496
  })
14497
14497
  );
14498
14498
  }
14499
- return virtualizer.getVirtualItems().map(({ index }) => ({
14500
- index,
14501
- rowKey: rowGeometry.rowKeys[index] ?? index
14499
+ return virtualizer.getVirtualItems().map(({ index: index2 }) => ({
14500
+ index: index2,
14501
+ rowKey: rowGeometry.rowKeys[index2] ?? index2
14502
14502
  }));
14503
14503
  }
14504
14504
 
@@ -15289,10 +15289,10 @@ var HeaderSlicedLabelMask = memo10(function HeaderSlicedLabelMask2({
15289
15289
  background
15290
15290
  }) {
15291
15291
  const settledScrollLeft = useSettledScrollLeft(scrollRef);
15292
- const index = settledScrollLeft === null ? -1 : tickIndexUnderHeader(major, pps, settledScrollLeft);
15293
- if (index < 0) return null;
15294
- const labelLeft = major[index] * pps - 0.5 + TICK_LABEL_INSET_PX;
15295
- const next = major[index + 1];
15292
+ const index2 = settledScrollLeft === null ? -1 : tickIndexUnderHeader(major, pps, settledScrollLeft);
15293
+ if (index2 < 0) return null;
15294
+ const labelLeft = major[index2] * pps - 0.5 + TICK_LABEL_INSET_PX;
15295
+ const next = major[index2 + 1];
15296
15296
  return /* @__PURE__ */ jsx26(
15297
15297
  "div",
15298
15298
  {
@@ -15303,7 +15303,7 @@ var HeaderSlicedLabelMask = memo10(function HeaderSlicedLabelMask2({
15303
15303
  top: 4,
15304
15304
  height: 12,
15305
15305
  // Up to the next label, so only this label's text band is covered.
15306
- width: next === void 0 ? 80 : (next - major[index]) * pps - TICK_LABEL_INSET_PX,
15306
+ width: next === void 0 ? 80 : (next - major[index2]) * pps - TICK_LABEL_INSET_PX,
15307
15307
  background
15308
15308
  }
15309
15309
  }
@@ -16077,7 +16077,7 @@ function errorFrom(reason) {
16077
16077
  return reason instanceof Error ? reason : new Error(String(reason));
16078
16078
  }
16079
16079
  function createThumbnailKey(parts) {
16080
- return Object.entries(parts).filter((entry2) => entry2[1] !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([name, value]) => `${encodeURIComponent(name)}=${encodeURIComponent(String(value))}`).join("&");
16080
+ return Object.entries(parts).filter((entry3) => entry3[1] !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([name, value]) => `${encodeURIComponent(name)}=${encodeURIComponent(String(value))}`).join("&");
16081
16081
  }
16082
16082
  function createThumbnailRequestIdentity(request2) {
16083
16083
  return createThumbnailKey({
@@ -16113,13 +16113,13 @@ var ThumbnailScheduler = class {
16113
16113
  }
16114
16114
  acquire(request2, listener2) {
16115
16115
  const scopedKey = createThumbnailRequestIdentity(request2);
16116
- let entry2 = this.entries.get(scopedKey);
16117
- if (entry2?.state === "error" && entry2.failedAt !== void 0 && this.now() - entry2.failedAt >= this.budgets.metadataFailureTtlMs) {
16118
- this.deleteEntry(scopedKey, entry2);
16119
- entry2 = this.entries.get(scopedKey);
16116
+ let entry3 = this.entries.get(scopedKey);
16117
+ if (entry3?.state === "error" && entry3.failedAt !== void 0 && this.now() - entry3.failedAt >= this.budgets.metadataFailureTtlMs) {
16118
+ this.deleteEntry(scopedKey, entry3);
16119
+ entry3 = this.entries.get(scopedKey);
16120
16120
  }
16121
- if (!entry2) {
16122
- entry2 = {
16121
+ if (!entry3) {
16122
+ entry3 = {
16123
16123
  request: request2,
16124
16124
  scopedKey,
16125
16125
  state: "queued",
@@ -16133,12 +16133,12 @@ var ThumbnailScheduler = class {
16133
16133
  snapshot: Object.freeze({ status: "queued" }),
16134
16134
  preempted: false
16135
16135
  };
16136
- this.entries.set(scopedKey, entry2);
16136
+ this.entries.set(scopedKey, entry3);
16137
16137
  }
16138
16138
  const leaseId = this.nextLeaseId++;
16139
- entry2.leases.set(leaseId, request2.priority);
16140
- entry2.listeners.set(leaseId, listener2);
16141
- entry2.lastAccess = this.nextSequence++;
16139
+ entry3.leases.set(leaseId, request2.priority);
16140
+ entry3.listeners.set(leaseId, listener2);
16141
+ entry3.lastAccess = this.nextSequence++;
16142
16142
  this.pump();
16143
16143
  let released2 = false;
16144
16144
  return {
@@ -16171,9 +16171,9 @@ var ThumbnailScheduler = class {
16171
16171
  };
16172
16172
  }
16173
16173
  getSnapshot(request2) {
16174
- const entry2 = this.entries.get(createThumbnailRequestIdentity(request2));
16175
- if (!entry2) return EMPTY_SNAPSHOT;
16176
- return entry2.snapshot;
16174
+ const entry3 = this.entries.get(createThumbnailRequestIdentity(request2));
16175
+ if (!entry3) return EMPTY_SNAPSHOT;
16176
+ return entry3.snapshot;
16177
16177
  }
16178
16178
  setScrolling(scrolling) {
16179
16179
  if (this.scrolling === scrolling) return;
@@ -16188,9 +16188,9 @@ var ThumbnailScheduler = class {
16188
16188
  this.pump();
16189
16189
  return;
16190
16190
  }
16191
- for (const entry2 of this.entries.values()) {
16192
- if (entry2.state !== "loading" || entry2.request.kind !== "composition") continue;
16193
- this.preempt(entry2);
16191
+ for (const entry3 of this.entries.values()) {
16192
+ if (entry3.state !== "loading" || entry3.request.kind !== "composition") continue;
16193
+ this.preempt(entry3);
16194
16194
  }
16195
16195
  }
16196
16196
  setPlaybackActive(active) {
@@ -16205,21 +16205,21 @@ var ThumbnailScheduler = class {
16205
16205
  this.pump();
16206
16206
  return;
16207
16207
  }
16208
- for (const entry2 of this.entries.values()) {
16209
- if (entry2.state === "loading") this.preempt(entry2);
16208
+ for (const entry3 of this.entries.values()) {
16209
+ if (entry3.state === "loading") this.preempt(entry3);
16210
16210
  }
16211
16211
  }
16212
- preempt(entry2) {
16213
- entry2.preempted = true;
16214
- entry2.controller?.abort();
16212
+ preempt(entry3) {
16213
+ entry3.preempted = true;
16214
+ entry3.controller?.abort();
16215
16215
  }
16216
16216
  /** Evict project cache entries that are no longer owned by mounted consumers. */
16217
16217
  invalidateProject(projectId) {
16218
- for (const [key2, entry2] of this.entries) {
16219
- if (entry2.request.projectId !== projectId) continue;
16220
- if (entry2.leases.size > 0) continue;
16221
- entry2.controller?.abort();
16222
- this.deleteEntry(key2, entry2);
16218
+ for (const [key2, entry3] of this.entries) {
16219
+ if (entry3.request.projectId !== projectId) continue;
16220
+ if (entry3.leases.size > 0) continue;
16221
+ entry3.controller?.abort();
16222
+ this.deleteEntry(key2, entry3);
16223
16223
  }
16224
16224
  }
16225
16225
  getDiagnostics() {
@@ -16228,14 +16228,14 @@ var ThumbnailScheduler = class {
16228
16228
  let leases = 0;
16229
16229
  let cacheEntries = 0;
16230
16230
  let waveformCacheEntries = 0;
16231
- for (const entry2 of this.entries.values()) {
16232
- if (entry2.state === "queued") queued++;
16233
- if (entry2.state === "loading") active++;
16234
- if (entry2.cached) {
16235
- if (entry2.request.kind === "waveform") waveformCacheEntries++;
16231
+ for (const entry3 of this.entries.values()) {
16232
+ if (entry3.state === "queued") queued++;
16233
+ if (entry3.state === "loading") active++;
16234
+ if (entry3.cached) {
16235
+ if (entry3.request.kind === "waveform") waveformCacheEntries++;
16236
16236
  else cacheEntries++;
16237
16237
  }
16238
- leases += entry2.leases.size;
16238
+ leases += entry3.leases.size;
16239
16239
  }
16240
16240
  return {
16241
16241
  queued,
@@ -16250,83 +16250,83 @@ var ThumbnailScheduler = class {
16250
16250
  }
16251
16251
  pump() {
16252
16252
  if (this.pageHidden) return;
16253
- const queued = Array.from(this.entries.values()).filter((entry2) => entry2.state === "queued" && entry2.leases.size > 0).sort((left, right) => {
16253
+ const queued = Array.from(this.entries.values()).filter((entry3) => entry3.state === "queued" && entry3.leases.size > 0).sort((left, right) => {
16254
16254
  const priorityDelta = this.entryPriority(right) - this.entryPriority(left);
16255
16255
  return priorityDelta || left.lastAccess - right.lastAccess;
16256
16256
  });
16257
- for (const entry2 of queued) {
16258
- if (this.isHeld(entry2)) continue;
16259
- const bucket = concurrencyBucket(entry2.request.kind);
16257
+ for (const entry3 of queued) {
16258
+ if (this.isHeld(entry3)) continue;
16259
+ const bucket = concurrencyBucket(entry3.request.kind);
16260
16260
  if (this.activeByBucket[bucket] >= this.bucketLimit(bucket)) continue;
16261
- this.start(entry2, bucket);
16261
+ this.start(entry3, bucket);
16262
16262
  }
16263
16263
  }
16264
- isHeld(entry2) {
16265
- const { kind, rich } = entry2.request;
16264
+ isHeld(entry3) {
16265
+ const { kind, rich } = entry3.request;
16266
16266
  if (this.scrolling && rich) return true;
16267
16267
  if (this.previewReloading && kind === "composition") return true;
16268
- return this.playbackActive && kind === "video" && this.entryPriority(entry2) < PRIORITY_SCORE.interaction;
16268
+ return this.playbackActive && kind === "video" && this.entryPriority(entry3) < PRIORITY_SCORE.interaction;
16269
16269
  }
16270
- start(entry2, bucket) {
16271
- entry2.state = "loading";
16272
- entry2.snapshot = Object.freeze({ status: "loading" });
16270
+ start(entry3, bucket) {
16271
+ entry3.state = "loading";
16272
+ entry3.snapshot = Object.freeze({ status: "loading" });
16273
16273
  const controller = new AbortController();
16274
- entry2.controller = controller;
16274
+ entry3.controller = controller;
16275
16275
  this.activeByBucket[bucket]++;
16276
- this.activeByKind[entry2.request.kind]++;
16276
+ this.activeByKind[entry3.request.kind]++;
16277
16277
  let slotFree = false;
16278
16278
  const freeSlot = () => {
16279
16279
  if (slotFree) return;
16280
16280
  slotFree = true;
16281
16281
  this.activeByBucket[bucket]--;
16282
- this.activeByKind[entry2.request.kind]--;
16282
+ this.activeByKind[entry3.request.kind]--;
16283
16283
  queueMicrotask(() => this.pump());
16284
16284
  };
16285
16285
  controller.signal.addEventListener("abort", freeSlot, { once: true });
16286
- this.notify(entry2);
16287
- const pending2 = this.loadWithTimeout(entry2, controller);
16288
- void pending2.then((result) => this.acceptResult(entry2, controller, result)).catch((reason) => {
16289
- if (this.entries.get(entry2.scopedKey) !== entry2) return;
16290
- if (controller.signal.aborted && entry2.leases.size === 0) {
16291
- this.deleteEntry(entry2.scopedKey, entry2);
16286
+ this.notify(entry3);
16287
+ const pending2 = this.loadWithTimeout(entry3, controller);
16288
+ void pending2.then((result) => this.acceptResult(entry3, controller, result)).catch((reason) => {
16289
+ if (this.entries.get(entry3.scopedKey) !== entry3) return;
16290
+ if (controller.signal.aborted && entry3.leases.size === 0) {
16291
+ this.deleteEntry(entry3.scopedKey, entry3);
16292
16292
  return;
16293
16293
  }
16294
- if (this.requeuePreempted(entry2)) return;
16295
- entry2.state = "error";
16296
- entry2.error = errorFrom(reason);
16297
- entry2.failedAt = this.now();
16298
- entry2.snapshot = Object.freeze({ status: "error", error: entry2.error });
16299
- this.notify(entry2);
16294
+ if (this.requeuePreempted(entry3)) return;
16295
+ entry3.state = "error";
16296
+ entry3.error = errorFrom(reason);
16297
+ entry3.failedAt = this.now();
16298
+ entry3.snapshot = Object.freeze({ status: "error", error: entry3.error });
16299
+ this.notify(entry3);
16300
16300
  this.evictFailures();
16301
16301
  }).finally(() => {
16302
- if (entry2.controller === controller) entry2.controller = null;
16302
+ if (entry3.controller === controller) entry3.controller = null;
16303
16303
  freeSlot();
16304
16304
  this.pump();
16305
16305
  });
16306
16306
  }
16307
- acceptResult(entry2, controller, result) {
16308
- if (controller.signal.aborted || this.entries.get(entry2.scopedKey) !== entry2) {
16307
+ acceptResult(entry3, controller, result) {
16308
+ if (controller.signal.aborted || this.entries.get(entry3.scopedKey) !== entry3) {
16309
16309
  this.safeDispose(result.dispose);
16310
- this.requeuePreempted(entry2);
16310
+ this.requeuePreempted(entry3);
16311
16311
  return;
16312
16312
  }
16313
16313
  this.validateResult(result);
16314
- entry2.state = "ready";
16315
- entry2.value = result.value;
16316
- entry2.weight = result.weight;
16317
- entry2.dispose = result.dispose;
16318
- this.cacheResult(entry2);
16319
- entry2.snapshot = Object.freeze({ status: "ready", value: result.value });
16320
- this.notify(entry2);
16314
+ entry3.state = "ready";
16315
+ entry3.value = result.value;
16316
+ entry3.weight = result.weight;
16317
+ entry3.dispose = result.dispose;
16318
+ this.cacheResult(entry3);
16319
+ entry3.snapshot = Object.freeze({ status: "ready", value: result.value });
16320
+ this.notify(entry3);
16321
16321
  this.evict();
16322
- if (!entry2.cached && entry2.leases.size === 0) this.deleteEntry(entry2.scopedKey, entry2);
16323
- }
16324
- requeuePreempted(entry2) {
16325
- if (!entry2.preempted || this.entries.get(entry2.scopedKey) !== entry2) return false;
16326
- entry2.preempted = false;
16327
- entry2.state = "queued";
16328
- entry2.snapshot = Object.freeze({ status: "queued" });
16329
- this.notify(entry2);
16322
+ if (!entry3.cached && entry3.leases.size === 0) this.deleteEntry(entry3.scopedKey, entry3);
16323
+ }
16324
+ requeuePreempted(entry3) {
16325
+ if (!entry3.preempted || this.entries.get(entry3.scopedKey) !== entry3) return false;
16326
+ entry3.preempted = false;
16327
+ entry3.state = "queued";
16328
+ entry3.snapshot = Object.freeze({ status: "queued" });
16329
+ this.notify(entry3);
16330
16330
  return true;
16331
16331
  }
16332
16332
  validateResult(result) {
@@ -16334,17 +16334,17 @@ var ThumbnailScheduler = class {
16334
16334
  this.safeDispose(result.dispose);
16335
16335
  throw new RangeError("Thumbnail result weight must be finite and non-negative");
16336
16336
  }
16337
- cacheResult(entry2) {
16338
- const isWaveform = entry2.request.kind === "waveform";
16337
+ cacheResult(entry3) {
16338
+ const isWaveform = entry3.request.kind === "waveform";
16339
16339
  const byteBudget = isWaveform ? this.budgets.waveformCacheBytes : this.budgets.thumbnailCacheBytes;
16340
- entry2.cached = !entry2.request.discardWhenReleased && entry2.weight <= byteBudget;
16341
- if (!entry2.cached) return;
16342
- if (isWaveform) this.waveformCacheBytes += entry2.weight;
16343
- else this.cacheBytes += entry2.weight;
16340
+ entry3.cached = !entry3.request.discardWhenReleased && entry3.weight <= byteBudget;
16341
+ if (!entry3.cached) return;
16342
+ if (isWaveform) this.waveformCacheBytes += entry3.weight;
16343
+ else this.cacheBytes += entry3.weight;
16344
16344
  }
16345
- entryPriority(entry2) {
16345
+ entryPriority(entry3) {
16346
16346
  let score = -1;
16347
- for (const priority of entry2.leases.values()) {
16347
+ for (const priority of entry3.leases.values()) {
16348
16348
  score = Math.max(score, PRIORITY_SCORE[priority]);
16349
16349
  }
16350
16350
  return score;
@@ -16360,21 +16360,21 @@ var ThumbnailScheduler = class {
16360
16360
  }
16361
16361
  evictPartition(waveform) {
16362
16362
  const cached5 = Array.from(this.entries.values()).filter(
16363
- (entry2) => entry2.cached && entry2.request.kind === "waveform" === waveform
16363
+ (entry3) => entry3.cached && entry3.request.kind === "waveform" === waveform
16364
16364
  );
16365
16365
  const perProject = /* @__PURE__ */ new Map();
16366
- for (const entry2 of cached5) {
16367
- perProject.set(entry2.request.projectId, (perProject.get(entry2.request.projectId) ?? 0) + 1);
16366
+ for (const entry3 of cached5) {
16367
+ perProject.set(entry3.request.projectId, (perProject.get(entry3.request.projectId) ?? 0) + 1);
16368
16368
  }
16369
16369
  cached5.sort((left, right) => left.lastAccess - right.lastAccess);
16370
16370
  let cacheEntries = cached5.length;
16371
- for (const entry2 of cached5) {
16372
- const projectEntries = perProject.get(entry2.request.projectId) ?? 0;
16371
+ for (const entry3 of cached5) {
16372
+ const projectEntries = perProject.get(entry3.request.projectId) ?? 0;
16373
16373
  if (!this.isCacheOverBudget(waveform, cacheEntries, projectEntries)) continue;
16374
- this.uncache(entry2);
16374
+ this.uncache(entry3);
16375
16375
  cacheEntries--;
16376
- perProject.set(entry2.request.projectId, projectEntries - 1);
16377
- if (entry2.leases.size === 0) this.deleteEntry(entry2.scopedKey, entry2);
16376
+ perProject.set(entry3.request.projectId, projectEntries - 1);
16377
+ if (entry3.leases.size === 0) this.deleteEntry(entry3.scopedKey, entry3);
16378
16378
  }
16379
16379
  }
16380
16380
  isCacheOverBudget(waveform, cacheEntries, projectEntries) {
@@ -16384,18 +16384,18 @@ var ThumbnailScheduler = class {
16384
16384
  const projectOverBudget = !waveform && projectEntries > this.budgets.thumbnailCacheEntriesPerProject;
16385
16385
  return cacheEntries > entryBudget || cacheBytes > byteBudget || projectOverBudget;
16386
16386
  }
16387
- uncache(entry2) {
16388
- entry2.cached = false;
16389
- if (entry2.request.kind === "waveform") this.waveformCacheBytes -= entry2.weight;
16390
- else this.cacheBytes -= entry2.weight;
16387
+ uncache(entry3) {
16388
+ entry3.cached = false;
16389
+ if (entry3.request.kind === "waveform") this.waveformCacheBytes -= entry3.weight;
16390
+ else this.cacheBytes -= entry3.weight;
16391
16391
  }
16392
- notify(entry2) {
16393
- for (const listener2 of new Set(entry2.listeners.values())) listener2();
16392
+ notify(entry3) {
16393
+ for (const listener2 of new Set(entry3.listeners.values())) listener2();
16394
16394
  }
16395
- loadWithTimeout(entry2, controller) {
16395
+ loadWithTimeout(entry3, controller) {
16396
16396
  let load;
16397
16397
  try {
16398
- load = entry2.request.load(controller.signal);
16398
+ load = entry3.request.load(controller.signal);
16399
16399
  } catch (reason) {
16400
16400
  load = Promise.reject(reason);
16401
16401
  }
@@ -16427,28 +16427,28 @@ var ThumbnailScheduler = class {
16427
16427
  );
16428
16428
  });
16429
16429
  }
16430
- deleteEntry(key2, entry2) {
16431
- if (this.entries.get(key2) !== entry2) return;
16430
+ deleteEntry(key2, entry3) {
16431
+ if (this.entries.get(key2) !== entry3) return;
16432
16432
  this.entries.delete(key2);
16433
- entry2.snapshot = EMPTY_SNAPSHOT;
16434
- this.notify(entry2);
16435
- if (entry2.cached) {
16436
- entry2.cached = false;
16437
- if (entry2.request.kind === "waveform") this.waveformCacheBytes -= entry2.weight;
16438
- else this.cacheBytes -= entry2.weight;
16433
+ entry3.snapshot = EMPTY_SNAPSHOT;
16434
+ this.notify(entry3);
16435
+ if (entry3.cached) {
16436
+ entry3.cached = false;
16437
+ if (entry3.request.kind === "waveform") this.waveformCacheBytes -= entry3.weight;
16438
+ else this.cacheBytes -= entry3.weight;
16439
16439
  }
16440
- if (!entry2.disposed) {
16441
- entry2.disposed = true;
16442
- this.safeDispose(entry2.dispose);
16440
+ if (!entry3.disposed) {
16441
+ entry3.disposed = true;
16442
+ this.safeDispose(entry3.dispose);
16443
16443
  }
16444
- entry2.listeners.clear();
16445
- entry2.leases.clear();
16444
+ entry3.listeners.clear();
16445
+ entry3.leases.clear();
16446
16446
  }
16447
16447
  evictFailures() {
16448
- const failed2 = Array.from(this.entries.values()).filter((entry2) => entry2.state === "error" && entry2.leases.size === 0).sort((left, right) => left.lastAccess - right.lastAccess);
16448
+ const failed2 = Array.from(this.entries.values()).filter((entry3) => entry3.state === "error" && entry3.leases.size === 0).sort((left, right) => left.lastAccess - right.lastAccess);
16449
16449
  const overflow = failed2.length - this.budgets.thumbnailCacheEntries;
16450
- for (const entry2 of failed2.slice(0, Math.max(0, overflow))) {
16451
- this.deleteEntry(entry2.scopedKey, entry2);
16450
+ for (const entry3 of failed2.slice(0, Math.max(0, overflow))) {
16451
+ this.deleteEntry(entry3.scopedKey, entry3);
16452
16452
  }
16453
16453
  }
16454
16454
  safeDispose(dispose2) {
@@ -16576,7 +16576,7 @@ var measure = (entries) => isTimelineZoomPreviewing() || commit(
16576
16576
  return strip ? [[strip.apply, { ...size, ...read(target, strip) }]] : [];
16577
16577
  })
16578
16578
  );
16579
- var onPresence = (entries) => measure(entries.filter((entry2) => entry2.isIntersecting));
16579
+ var onPresence = (entries) => measure(entries.filter((entry3) => entry3.isIntersecting));
16580
16580
  var pendingSizes = /* @__PURE__ */ new Map();
16581
16581
  var pendingSizesFrame = 0;
16582
16582
  var applyPendingSizes = () => {
@@ -16597,7 +16597,7 @@ function acquire() {
16597
16597
  resize: new ResizeObserver(applyResizesNextFrame),
16598
16598
  presence: observeIntersections(onPresence),
16599
16599
  gaps: observeIntersections(
16600
- (entries) => entries.some((entry2) => entry2.isIntersecting) && scheduleRefresh()
16600
+ (entries) => entries.some((entry3) => entry3.isIntersecting) && scheduleRefresh()
16601
16601
  ),
16602
16602
  stopZoomWatch: subscribeTimelineZoomPreview(remeasureAfterPreview)
16603
16603
  };
@@ -16682,9 +16682,9 @@ function decimatePeaks(peaks, startFraction, endFraction, barCount) {
16682
16682
  const end = Math.max(start + 1, Math.min(peaks.length, endIndex));
16683
16683
  const span = end - start;
16684
16684
  const bars = [];
16685
- for (let index = 0; index < barCount; index++) {
16686
- let from = start + Math.floor(index * span / barCount);
16687
- let to = start + Math.floor((index + 1) * span / barCount);
16685
+ for (let index2 = 0; index2 < barCount; index2++) {
16686
+ let from = start + Math.floor(index2 * span / barCount);
16687
+ let to = start + Math.floor((index2 + 1) * span / barCount);
16688
16688
  if (to <= from) {
16689
16689
  from = Math.min(from, end - 1);
16690
16690
  to = from + 1;
@@ -16707,8 +16707,8 @@ var FADE_GHOST_OPACITY = 0.27;
16707
16707
  var WAVEFORM_LAYER_Z = 10;
16708
16708
  var WHOLE_CLIP = { from: 0, to: 1 };
16709
16709
  function paintWaveformBars(context, bars, height, waveformBarRgb, waveformBaselineRgb, amplitudes) {
16710
- bars.forEach((bar, index) => {
16711
- const opacity = loudnessToOpacity(amplitudes[index] ?? 0);
16710
+ bars.forEach((bar, index2) => {
16711
+ const opacity = loudnessToOpacity(amplitudes[index2] ?? 0);
16712
16712
  context.fillStyle = `rgb(${waveformBaselineRgb})`;
16713
16713
  context.fillRect(bar.x, height - 2, bar.width, 2);
16714
16714
  const paint2 = (alpha, top, barHeight) => {
@@ -16739,12 +16739,12 @@ function drawWaveformCanvas(canvas, peaks, muted, trimStartFraction, trimEndFrac
16739
16739
  trimStartFraction + trim * span.to,
16740
16740
  Math.max(1, Math.ceil(width / BAR_STEP))
16741
16741
  );
16742
- const clipFraction = (index) => span.from + (index + 0.5) / amplitudes.length * (span.to - span.from);
16743
- const bars = amplitudes.map((amplitude, index) => ({
16744
- x: index * width / amplitudes.length,
16742
+ const clipFraction = (index2) => span.from + (index2 + 0.5) / amplitudes.length * (span.to - span.from);
16743
+ const bars = amplitudes.map((amplitude, index2) => ({
16744
+ x: index2 * width / amplitudes.length,
16745
16745
  width: Math.max(1, width / amplitudes.length),
16746
16746
  height: Math.max(3, amplitude * height),
16747
- gain: fades ? fadeGain(clipFraction(index) * fades.duration, fades.duration, fades) : 1
16747
+ gain: fades ? fadeGain(clipFraction(index2) * fades.duration, fades.duration, fades) : 1
16748
16748
  }));
16749
16749
  const channelToken = muted ? "--timeline-waveform-muted-rgb" : "--timeline-waveform-bar-rgb";
16750
16750
  const waveformBarRgb = getComputedStyle(canvas).getPropertyValue(channelToken);
@@ -16757,9 +16757,9 @@ function extractPeaks(channelData, barCount) {
16757
16757
  const peaks = [];
16758
16758
  const samplesPerBar = Math.floor(channelData.length / barCount);
16759
16759
  if (samplesPerBar === 0) return Array(barCount).fill(0);
16760
- for (let index = 0; index < barCount; index++) {
16760
+ for (let index2 = 0; index2 < barCount; index2++) {
16761
16761
  let max = 0;
16762
- const start = index * samplesPerBar;
16762
+ const start = index2 * samplesPerBar;
16763
16763
  const end = Math.min(start + samplesPerBar, channelData.length);
16764
16764
  for (let sample = start; sample < end; sample++) {
16765
16765
  max = Math.max(max, Math.abs(channelData[sample] ?? 0));
@@ -16806,7 +16806,7 @@ function useNearScreen(element) {
16806
16806
  useEffect22(() => {
16807
16807
  if (!element || typeof IntersectionObserver === "undefined") return;
16808
16808
  nearScreen ??= new IntersectionObserver(
16809
- (entries) => entries.forEach((entry2) => nearScreenListeners.get(entry2.target)?.(entry2.isIntersecting)),
16809
+ (entries) => entries.forEach((entry3) => nearScreenListeners.get(entry3.target)?.(entry3.isIntersecting)),
16810
16810
  NEAR_SCREEN
16811
16811
  );
16812
16812
  nearScreenListeners.set(element, setNear);
@@ -17584,10 +17584,10 @@ function serializeStudioFileMutation(writer, targetPath, task) {
17584
17584
  }
17585
17585
  function serializeStudioFileMutations(writer, targetPaths, task) {
17586
17586
  const paths = [...new Set(targetPaths)].sort();
17587
- const acquire2 = (index) => {
17588
- const path = paths[index];
17587
+ const acquire2 = (index2) => {
17588
+ const path = paths[index2];
17589
17589
  if (path === void 0) return task();
17590
- return serializeStudioFileMutation(writer, path, () => acquire2(index + 1));
17590
+ return serializeStudioFileMutation(writer, path, () => acquire2(index2 + 1));
17591
17591
  };
17592
17592
  return acquire2(0);
17593
17593
  }
@@ -18223,8 +18223,8 @@ function consumeStudioWriteToken(token, now2 = Date.now()) {
18223
18223
  }
18224
18224
  async function studioFileContentVersion(content) {
18225
18225
  const bytes = new TextEncoder().encode(content);
18226
- const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
18227
- const hex = Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join(
18226
+ const digest2 = await globalThis.crypto.subtle.digest("SHA-256", bytes);
18227
+ const hex = Array.from(new Uint8Array(digest2), (byte) => byte.toString(16).padStart(2, "0")).join(
18228
18228
  ""
18229
18229
  );
18230
18230
  return `"sha256:${hex}"`;
@@ -18384,8 +18384,8 @@ function planLiveRetime(before, after) {
18384
18384
  const now2 = parseGsapScriptAcorn(after).animations.filter(onTimeline);
18385
18385
  if (was.length !== now2.length) return RERUN;
18386
18386
  const tweens = [];
18387
- for (const [index, next] of now2.entries()) {
18388
- const prev = was[index];
18387
+ for (const [index2, next] of now2.entries()) {
18388
+ const prev = was[index2];
18389
18389
  if (untimedShape(prev) !== untimedShape(next)) return RERUN;
18390
18390
  if (!placedAlone(next) || !placedAlone(prev)) return RERUN;
18391
18391
  const duration = lengthOf(next);
@@ -18398,7 +18398,7 @@ function planLiveRetime(before, after) {
18398
18398
  wasStart: prev.resolvedStart,
18399
18399
  wasDuration,
18400
18400
  moved: next.resolvedStart !== prev.resolvedStart || duration !== wasDuration,
18401
- source: index
18401
+ source: index2
18402
18402
  });
18403
18403
  }
18404
18404
  tweens.sort((x, y) => x.wasStart - y.wasStart || x.source - y.source);
@@ -18474,7 +18474,7 @@ function animatedElsewhere(own, registry3, targets) {
18474
18474
  return timeline.getChildren(false, true, false).some((tween) => tween.targets?.().some((target) => targets.has(target))) || timeline.getChildren(false, false, true).some(visit);
18475
18475
  };
18476
18476
  const timelines = registry3.filter(
18477
- (entry2) => typeof entry2?.getChildren === "function"
18477
+ (entry3) => typeof entry3?.getChildren === "function"
18478
18478
  );
18479
18479
  return own.getChildren(false, false, true).some(visit) || timelines.some(visit);
18480
18480
  }
@@ -18608,8 +18608,8 @@ function timingGestureStep(kind, given) {
18608
18608
  }
18609
18609
  async function rollbackMutatedFiles(projectId, ownedSteps, onError) {
18610
18610
  let convergenceRequired = false;
18611
- for (let index = ownedSteps.length - 1; index >= 0; index -= 1) {
18612
- const step = ownedSteps[index];
18611
+ for (let index2 = ownedSteps.length - 1; index2 >= 0; index2 -= 1) {
18612
+ const step = ownedSteps[index2];
18613
18613
  if (!step || step.before === step.after) continue;
18614
18614
  try {
18615
18615
  if (await rollbackOwnedMutation(projectId, step.path, step.after, step.before) === "conflict") {
@@ -18850,10 +18850,10 @@ function deleteSelectedKeyframes(session) {
18850
18850
  coalesceKey: `delete-keyframes:${++deleteKeyframesCommitCounter}`,
18851
18851
  coalesceMs: Number.POSITIVE_INFINITY
18852
18852
  };
18853
- for (const [index, target] of targets.entries()) {
18853
+ for (const [index2, target] of targets.entries()) {
18854
18854
  session.handleGsapRemoveKeyframe(target.animationId, target.percentage, {
18855
18855
  ...coalesceOptions,
18856
- ...index === targets.length - 1 ? { softReload: true } : { skipReload: true }
18856
+ ...index2 === targets.length - 1 ? { softReload: true } : { skipReload: true }
18857
18857
  });
18858
18858
  }
18859
18859
  }
@@ -19075,13 +19075,23 @@ function operationChanges(elements, operation) {
19075
19075
  buildPatches: (html2, target) => applyPatchByTarget(html2, target, operation)
19076
19076
  }));
19077
19077
  }
19078
+ var RENAMED_MOUNT = /__hf\d+"?\]?$/;
19079
+ var lookup = (value, kind) => RENAMED_MOUNT.test(value) ? `runtime-renamed ${kind}` : kind;
19080
+ var selectorLookup = (selector) => selector.startsWith("[data-composition-id=") ? lookup(selector, "composition id") : /^\.[\w-]+$/.test(selector) && "class";
19081
+ function missedLookups(element, target) {
19082
+ const kinds = [target.hfId && "hf-id", target.id && lookup(target.id, "id")];
19083
+ const by = [...kinds, target.selector && selectorLookup(target.selector)].filter(Boolean);
19084
+ return `by ${by.join(", ") || "nothing"}; ${element.sourceFile ? "file from the clip" : "no file on the clip"}`;
19085
+ }
19078
19086
  function patchTimelineChangesInSource(source, targetPath, changes) {
19079
19087
  let current = source;
19080
19088
  for (const { element, buildPatches } of changes) {
19081
19089
  const target = buildPatchTarget(element);
19082
19090
  if (!target) throw new Error(`Timeline element ${element.id} is missing a patchable target`);
19083
19091
  if (!findTagByTarget(current, target)) {
19084
- throw new Error(`Unable to patch timeline element ${element.id} in ${targetPath}`);
19092
+ throw new Error(
19093
+ `Unable to patch timeline element ${element.id} in ${targetPath} (${missedLookups(element, target)})`
19094
+ );
19085
19095
  }
19086
19096
  current = buildPatches(current, target);
19087
19097
  }
@@ -20132,9 +20142,9 @@ function snapLaneTime(t2, targets, thresholdSec) {
20132
20142
  return best;
20133
20143
  }
20134
20144
  function segmentLineCommands(input) {
20135
- const { lane, range, index, xOf, yOf } = input;
20136
- const a = lane.points[index];
20137
- const b = lane.points[index + 1];
20145
+ const { lane, range, index: index2, xOf, yOf } = input;
20146
+ const a = lane.points[index2];
20147
+ const b = lane.points[index2 + 1];
20138
20148
  if (!a || !b) return [];
20139
20149
  if (!a.curve && a.viaX === void 0 && range.scale === "linear") {
20140
20150
  return [`L ${xOf(b.t)} ${yOf(b.v)}`];
@@ -20160,13 +20170,13 @@ function envelopePath(input) {
20160
20170
  return pts.join(" ");
20161
20171
  }
20162
20172
  function envelopeSegmentPath(input) {
20163
- const { lane, range, index, xOf, yOf } = input;
20164
- const a = lane.points[index];
20165
- const b = lane.points[index + 1];
20173
+ const { lane, range, index: index2, xOf, yOf } = input;
20174
+ const a = lane.points[index2];
20175
+ const b = lane.points[index2 + 1];
20166
20176
  if (!a || !b) return null;
20167
20177
  const pts = [
20168
20178
  `M ${xOf(a.t)} ${yOf(a.v)}`,
20169
- ...segmentLineCommands({ lane, range, index, xOf, yOf })
20179
+ ...segmentLineCommands({ lane, range, index: index2, xOf, yOf })
20170
20180
  ];
20171
20181
  return pts.join(" ");
20172
20182
  }
@@ -20396,13 +20406,13 @@ function armGroupDrag(lane, pressed, rangeSelection) {
20396
20406
  selection: rangeSelection ? { ...rangeSelection } : { t0: 0, t1: 0, v0: 0, v1: 0 }
20397
20407
  };
20398
20408
  }
20399
- function armSegmentDrag(lane, index, anchor2) {
20400
- const a = lane.points[index];
20401
- const b = lane.points[index + 1];
20409
+ function armSegmentDrag(lane, index2, anchor2) {
20410
+ const a = lane.points[index2];
20411
+ const b = lane.points[index2 + 1];
20402
20412
  if (!a || !b) return null;
20403
20413
  return {
20404
20414
  points: lane.points.map((p) => ({ ...p })),
20405
- indices: [index, index + 1],
20415
+ indices: [index2, index2 + 1],
20406
20416
  anchor: { ...anchor2 },
20407
20417
  selection: {
20408
20418
  t0: a.t,
@@ -20564,19 +20574,19 @@ function useAutomationSegmentDrag({
20564
20574
  (clientX, clientY) => {
20565
20575
  const box = getBox();
20566
20576
  if (!box) return null;
20567
- const index = segmentIndex(clientX, clientY);
20568
- if (index === null) return null;
20577
+ const index2 = segmentIndex(clientX, clientY);
20578
+ if (index2 === null) return null;
20569
20579
  const { t: t2 } = pointAt(clientX, clientY);
20570
20580
  const value = sampleAutomationLane3(lane, t2, range.scale);
20571
- return Math.abs(yOf(value) - (clientY - box.top)) <= SEGMENT_GRAB_PX ? index : null;
20581
+ return Math.abs(yOf(value) - (clientY - box.top)) <= SEGMENT_GRAB_PX ? index2 : null;
20572
20582
  },
20573
20583
  [getBox, lane, pointAt, range.scale, segmentIndex, yOf]
20574
20584
  );
20575
20585
  const arm = useCallback31(
20576
- (index, clientX, clientY) => {
20577
- snapshot3.current = armSegmentDrag(lane, index, pointAt(clientX, clientY));
20586
+ (index2, clientX, clientY) => {
20587
+ snapshot3.current = armSegmentDrag(lane, index2, pointAt(clientX, clientY));
20578
20588
  setHoverIndex(null);
20579
- setDragIndex(index);
20589
+ setDragIndex(index2);
20580
20590
  },
20581
20591
  [lane, pointAt]
20582
20592
  );
@@ -20734,8 +20744,8 @@ function useAutomationLaneGestures({
20734
20744
  });
20735
20745
  const gestureAt = useCallback32(
20736
20746
  (e) => {
20737
- const index = hitIndex(e.clientX, e.clientY);
20738
- if (index !== null) return { kind: "point", index };
20747
+ const index2 = hitIndex(e.clientX, e.clientY);
20748
+ if (index2 !== null) return { kind: "point", index: index2 };
20739
20749
  const segment = e.altKey ? segmentIndex(e.clientX, e.clientY) : segmentDrag.hitIndex(e.clientX, e.clientY);
20740
20750
  if (segment === null) return null;
20741
20751
  return { kind: e.altKey ? "curve" : "segment", index: segment };
@@ -20923,8 +20933,8 @@ function useAutomationLaneGestures({
20923
20933
  }
20924
20934
  if (dragIndex === null && curveIndex === null && segmentDrag.dragIndex === null) return;
20925
20935
  e.stopPropagation();
20926
- const index = dragIndex;
20927
- const shiftClicked = index !== null && e.shiftKey && !pressTravelled.current;
20936
+ const index2 = dragIndex;
20937
+ const shiftClicked = index2 !== null && e.shiftKey && !pressTravelled.current;
20928
20938
  setDragIndex(null);
20929
20939
  setCurveIndex(null);
20930
20940
  segmentDrag.finish();
@@ -20935,7 +20945,7 @@ function useAutomationLaneGestures({
20935
20945
  setHint(null);
20936
20946
  if (shiftClicked) {
20937
20947
  commitPoints(
20938
- lane.points.filter((_, i) => i !== index),
20948
+ lane.points.filter((_, i) => i !== index2),
20939
20949
  true
20940
20950
  );
20941
20951
  return;
@@ -21378,10 +21388,10 @@ function TimelineAutomationLane({
21378
21388
  if (draft && draft.basedOn !== automation && !gestureLive) setDraft(null);
21379
21389
  }, [automation, draft, gestureLive]);
21380
21390
  const removeAt = useCallback33(
21381
- (index) => {
21391
+ (index2) => {
21382
21392
  if (readOnly) return;
21383
21393
  commitPoints(
21384
- lane.points.filter((_, i) => i !== index),
21394
+ lane.points.filter((_, i) => i !== index2),
21385
21395
  true
21386
21396
  );
21387
21397
  },
@@ -21680,11 +21690,11 @@ function TimelineAutomationLaneSlot({
21680
21690
  const clips = elements.filter(isAudioOrVideoTimelineElement);
21681
21691
  const rowsByClip = /* @__PURE__ */ new Map();
21682
21692
  groupAutomationLanes(clips).forEach((group, rowIndex) => {
21683
- for (const entry2 of group.entries) {
21684
- const key2 = getTimelineElementIdentity(entry2.element);
21693
+ for (const entry3 of group.entries) {
21694
+ const key2 = getTimelineElementIdentity(entry3.element);
21685
21695
  const rows = rowsByClip.get(key2);
21686
- if (rows) rows.push({ lane: entry2.lane, rowIndex });
21687
- else rowsByClip.set(key2, [{ lane: entry2.lane, rowIndex }]);
21696
+ if (rows) rows.push({ lane: entry3.lane, rowIndex });
21697
+ else rowsByClip.set(key2, [{ lane: entry3.lane, rowIndex }]);
21688
21698
  }
21689
21699
  });
21690
21700
  const top = topOffset ?? getTimelineLaneTop(laneCount);
@@ -22676,9 +22686,9 @@ function clampedStyle(anchorRect) {
22676
22686
  const spaceBelow = window.innerHeight - anchorRect.bottom;
22677
22687
  const spaceAbove = anchorRect.top;
22678
22688
  const openUpward = spaceBelow < 260 && spaceAbove > spaceBelow;
22679
- const available = (openUpward ? spaceAbove : spaceBelow) - VIEWPORT_MARGIN - 4;
22689
+ const available2 = (openUpward ? spaceAbove : spaceBelow) - VIEWPORT_MARGIN - 4;
22680
22690
  const height = Math.min(
22681
- Math.max(MIN_POPOVER_HEIGHT, available),
22691
+ Math.max(MIN_POPOVER_HEIGHT, available2),
22682
22692
  window.innerHeight - VIEWPORT_MARGIN * 2
22683
22693
  );
22684
22694
  const inset = (desired) => Math.max(
@@ -23171,10 +23181,10 @@ function valuesBefore(animation2, animations) {
23171
23181
  const start = resolveTweenStart(animation2);
23172
23182
  if (start == null) return {};
23173
23183
  const endOf2 = (other) => (resolveTweenStart(other) ?? Infinity) + (other.method === "set" ? 0 : resolveTweenDuration(other));
23174
- const index = animations.indexOf(animation2);
23184
+ const index2 = animations.indexOf(animation2);
23175
23185
  const finished = animations.filter((other, i) => {
23176
- if (other.method === "from" || i === index) return false;
23177
- return endOf2(other) < start || endOf2(other) === start && i < index;
23186
+ if (other.method === "from" || i === index2) return false;
23187
+ return endOf2(other) < start || endOf2(other) === start && i < index2;
23178
23188
  }).sort((a, b) => endOf2(a) - endOf2(b));
23179
23189
  const values = {};
23180
23190
  for (const other of finished) {
@@ -23591,7 +23601,7 @@ function TimelineTrackHeader({
23591
23601
  const automationRows = useMemo30(
23592
23602
  () => groupAutomationLanes(trackElements).map((group) => {
23593
23603
  const active = group.entries.find(
23594
- (entry2) => (entry2.element.key ?? entry2.element.id) === activeKey
23604
+ (entry3) => (entry3.element.key ?? entry3.element.id) === activeKey
23595
23605
  );
23596
23606
  return {
23597
23607
  key: group.key,
@@ -23602,8 +23612,8 @@ function TimelineTrackHeader({
23602
23612
  // Every entry in a row is the same parameter, so the first answers for the
23603
23613
  // row when the active clip is absent from it.
23604
23614
  isCarve: (() => {
23605
- const entry2 = active ?? group.entries[0];
23606
- return entry2 ? isCarveLane(entry2.lane.target, elementFxChain(entry2.element)) : false;
23615
+ const entry3 = active ?? group.entries[0];
23616
+ return entry3 ? isCarveLane(entry3.lane.target, elementFxChain(entry3.element)) : false;
23607
23617
  })()
23608
23618
  };
23609
23619
  }),
@@ -23764,7 +23774,7 @@ function TimelineTrackHeader({
23764
23774
  },
23765
23775
  lane.group
23766
23776
  )),
23767
- isExpanded && automationRows.map((row, index) => {
23777
+ isExpanded && automationRows.map((row, index2) => {
23768
23778
  const revealTarget = row.target;
23769
23779
  return /* @__PURE__ */ jsx53(
23770
23780
  AutomationLaneHeaderRow,
@@ -23774,8 +23784,8 @@ function TimelineTrackHeader({
23774
23784
  name: row.name,
23775
23785
  param: row.param,
23776
23786
  alsoAutomatedBy: groupAutomatedTargets.has(row.key) ? groupLabelForNote ?? groupOwner : void 0,
23777
- top: getTimelineLaneTop(lanes.length) + index * AUTOMATION_LANE_H,
23778
- isLastLane: index === automationRows.length - 1,
23787
+ top: getTimelineLaneTop(lanes.length) + index2 * AUTOMATION_LANE_H,
23788
+ isLastLane: index2 === automationRows.length - 1,
23779
23789
  gutterBackground: gutterFill(theme.gutterBackground, isGroupMember),
23780
23790
  columnWidth: showTrackLabel ? LABEL_COL_W : contentOrigin,
23781
23791
  onRemove: onRemoveAutomationLane,
@@ -23805,7 +23815,7 @@ import {
23805
23815
  // src/player/components/TimelineTrackRow.tsx
23806
23816
  import { jsx as jsx54, jsxs as jsxs31 } from "react/jsx-runtime";
23807
23817
  function TimelineTrackRow({
23808
- index,
23818
+ index: index2,
23809
23819
  rowKey,
23810
23820
  logicalRow,
23811
23821
  propertyRows,
@@ -23823,8 +23833,8 @@ function TimelineTrackRow({
23823
23833
  "div",
23824
23834
  {
23825
23835
  role: "rowgroup",
23826
- "data-index": index,
23827
- "data-timeline-row": index,
23836
+ "data-index": index2,
23837
+ "data-timeline-row": index2,
23828
23838
  "data-timeline-row-key": rowKey,
23829
23839
  className: virtualized ? "absolute left-0 right-0" : "relative",
23830
23840
  style: {
@@ -24083,7 +24093,7 @@ function TimelineGroupLaneLabels({
24083
24093
  }) {
24084
24094
  const currentTime = useLivePlayheadTime();
24085
24095
  const laneGroups = groupAutomationLanes([groupElement]);
24086
- return /* @__PURE__ */ jsx56(Fragment16, { children: laneGroups.map((laneGroup, index) => {
24096
+ return /* @__PURE__ */ jsx56(Fragment16, { children: laneGroups.map((laneGroup, index2) => {
24087
24097
  const lane = laneGroup.entries[0]?.lane;
24088
24098
  if (!lane) return null;
24089
24099
  const parts = { name: laneGroup.name, param: laneGroup.param };
@@ -24098,7 +24108,7 @@ function TimelineGroupLaneLabels({
24098
24108
  disabled: !onReveal,
24099
24109
  className: "absolute left-0 flex items-center gap-1.5 overflow-hidden border-0 px-1.5 text-left text-[10px] text-[var(--timeline-text-secondary)] enabled:hover:text-[var(--timeline-text-solid)] focus-visible:outline-solid focus-visible:outline-1 focus-visible:outline-[var(--timeline-accent)]",
24100
24110
  style: {
24101
- top: top + index * AUTOMATION_LANE_H,
24111
+ top: top + index2 * AUTOMATION_LANE_H,
24102
24112
  width: columnWidth,
24103
24113
  height: AUTOMATION_LANE_H,
24104
24114
  background: gutterBackground,
@@ -24135,7 +24145,7 @@ function TimelineGroupLaneLabels({
24135
24145
  import { jsx as jsx57, jsxs as jsxs34 } from "react/jsx-runtime";
24136
24146
  var GROUP_LANE_ACCENT = "var(--timeline-accent)";
24137
24147
  function TimelineGroupRow({
24138
- index,
24148
+ index: index2,
24139
24149
  rowKey,
24140
24150
  group,
24141
24151
  logicalRow,
@@ -24192,7 +24202,7 @@ function TimelineGroupRow({
24192
24202
  return /* @__PURE__ */ jsxs34(
24193
24203
  TimelineTrackRow,
24194
24204
  {
24195
- index,
24205
+ index: index2,
24196
24206
  rowKey,
24197
24207
  logicalRow,
24198
24208
  propertyRows: [],
@@ -24409,10 +24419,10 @@ import { jsx as jsx59 } from "react/jsx-runtime";
24409
24419
  function deriveTimelineClipJoins(elements) {
24410
24420
  const sorted = sortedLaneClips(elements);
24411
24421
  const joins = [];
24412
- for (let index = 1; index < sorted.length; index += 1) {
24413
- const previous = sorted[index - 1];
24422
+ for (let index2 = 1; index2 < sorted.length; index2 += 1) {
24423
+ const previous = sorted[index2 - 1];
24414
24424
  const end = previous.start + previous.duration;
24415
- if (Math.abs(sorted[index].start - end) < TRACK_GAP_EPSILON_S) joins.push(end);
24425
+ if (Math.abs(sorted[index2].start - end) < TRACK_GAP_EPSILON_S) joins.push(end);
24416
24426
  }
24417
24427
  return joins;
24418
24428
  }
@@ -25364,11 +25374,11 @@ function quantizeThumbnailFrameCount(frameCount) {
25364
25374
  const cap = 2 ** Math.floor(Math.log2(MAX_VISIBLE_THUMBNAIL_FRAMES));
25365
25375
  return Math.min(cap, 2 ** Math.ceil(Math.log2(safeCount)));
25366
25376
  }
25367
- function thumbnailFrameForTile(index, tileCount, frameCount) {
25377
+ function thumbnailFrameForTile(index2, tileCount, frameCount) {
25368
25378
  if (frameCount < 2) return 0;
25369
- if (tileCount > 1 && index >= tileCount - 1) return frameCount - 1;
25379
+ if (tileCount > 1 && index2 >= tileCount - 1) return frameCount - 1;
25370
25380
  const slices = frameCount - 1;
25371
- return Math.min(slices - 1, Math.floor((index + 0.5) * slices / tileCount));
25381
+ return Math.min(slices - 1, Math.floor((index2 + 0.5) * slices / tileCount));
25372
25382
  }
25373
25383
  function probeImageAspect(imageSrc, signal, tolerateSvgError = false) {
25374
25384
  return new Promise((resolve, reject) => {
@@ -25565,7 +25575,7 @@ async function normalizeClipsLoudness(projectId, elements, writers) {
25565
25575
  if (elements.some(volumeLaneOwnsGain)) throw new Error(VOLUME_LANE_REFUSAL);
25566
25576
  const plans = await Promise.all(elements.map((el) => requestNormalizePlan(projectId, el)));
25567
25577
  await writeClipGains(
25568
- elements.map((element, index) => ({ element, gain: plans[index]?.volume ?? 1 })),
25578
+ elements.map((element, index2) => ({ element, gain: plans[index2]?.volume ?? 1 })),
25569
25579
  writers,
25570
25580
  "Normalize loudness"
25571
25581
  );
@@ -26235,8 +26245,8 @@ function useHoverPreview(preview2) {
26235
26245
  function focusSibling(menu, step) {
26236
26246
  if (!menu) return;
26237
26247
  const items = Array.from(menu.querySelectorAll('[role="menuitemradio"]'));
26238
- const index = items.findIndex((item) => item === document.activeElement);
26239
- items[(index + step + items.length) % items.length]?.focus();
26248
+ const index2 = items.findIndex((item) => item === document.activeElement);
26249
+ items[(index2 + step + items.length) % items.length]?.focus();
26240
26250
  }
26241
26251
  function ChoiceSubmenu({
26242
26252
  label,
@@ -26337,13 +26347,13 @@ function ChoiceSubmenu({
26337
26347
  onKeyDown: onSubmenuKeyDown,
26338
26348
  children: [
26339
26349
  choiceRow(null, "None"),
26340
- sections.map((section, index) => /* @__PURE__ */ jsxs43("div", { children: [
26350
+ sections.map((section, index2) => /* @__PURE__ */ jsxs43("div", { children: [
26341
26351
  section.heading && /* @__PURE__ */ jsxs43(Fragment19, { children: [
26342
26352
  /* @__PURE__ */ jsx67("div", { className: menuClasses.divider }),
26343
26353
  /* @__PURE__ */ jsx67("div", { className: "px-3 py-1 text-[9px] uppercase tracking-wide text-neutral-500", children: section.heading })
26344
26354
  ] }),
26345
26355
  section.choices.map((choice) => choiceRow(choice.id, choice.label))
26346
- ] }, section.heading ?? index))
26356
+ ] }, section.heading ?? index2))
26347
26357
  ]
26348
26358
  }
26349
26359
  )
@@ -27019,11 +27029,11 @@ function mintLinkId(doc) {
27019
27029
  return mintLinkIdFrom(taken);
27020
27030
  }
27021
27031
  function firstFreeTrackIndex(source) {
27022
- const used = new Set(
27032
+ const used2 = new Set(
27023
27033
  Array.from(source.matchAll(/\bdata-track-index=["'](-?\d+)["']/g), (m) => Number(m[1]))
27024
27034
  );
27025
27035
  let track2 = 0;
27026
- while (used.has(track2)) track2 += 1;
27036
+ while (used2.has(track2)) track2 += 1;
27027
27037
  return track2;
27028
27038
  }
27029
27039
  function splitAutomation(raw) {
@@ -27863,8 +27873,8 @@ function TimelineKeyframeMenuOverlay() {
27863
27873
  } : void 0
27864
27874
  ),
27865
27875
  onCopyProperties: (elementId2, keyframe) => {
27866
- const entry2 = keyframeCache.get(elementId2);
27867
- const keyframeValue = entry2?.keyframes.find(
27876
+ const entry3 = keyframeCache.get(elementId2);
27877
+ const keyframeValue = entry3?.keyframes.find(
27868
27878
  (item) => Math.abs(item.percentage - keyframe.percentage) < 0.5
27869
27879
  );
27870
27880
  if (!keyframeValue) return false;
@@ -28271,6 +28281,8 @@ function mediaUrlSourceOptions(reader) {
28271
28281
  const failuresByStart = /* @__PURE__ */ new Map();
28272
28282
  const inFlightReads = new AbortController();
28273
28283
  let ranges = reader === "thumbnail" ? "unknown" : "hidden";
28284
+ let etag;
28285
+ const noteEtag = (response) => void (etag ??= response.headers.get("ETag") ?? void 0);
28274
28286
  const fetchFn = async (input, init) => {
28275
28287
  const sent = ranges === "readable" ? boundedRange(init) : init;
28276
28288
  const asked = Number(rangeStart(sent, true) ?? 0);
@@ -28281,6 +28293,7 @@ function mediaUrlSourceOptions(reader) {
28281
28293
  );
28282
28294
  const response = await typedFetch(reader, input, sent ?? {}, asked, request2);
28283
28295
  if (ranges !== "hidden") ranges = rangesReadable(sent, response) ? "readable" : "hidden";
28296
+ noteEtag(response);
28284
28297
  return typedResponse(response, asked, request2);
28285
28298
  };
28286
28299
  const getRetryDelay = (_previousAttempts, error) => {
@@ -28293,8 +28306,9 @@ function mediaUrlSourceOptions(reader) {
28293
28306
  return 0.5 * (failed2 + 1);
28294
28307
  };
28295
28308
  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 };
28309
+ const etagOf = () => etag;
28310
+ if (reader === "probe") return { fetchFn, getRetryDelay, cancelReads, etagOf };
28311
+ return { fetchFn, getRetryDelay, cancelReads, etagOf, maxCacheSize: POOLED_READER_CACHE_BYTES };
28298
28312
  }
28299
28313
  function reportMediaFetchFailure(error) {
28300
28314
  if (!(error instanceof MediaFetchError)) return;
@@ -28308,23 +28322,23 @@ var loadMediabunny = () => mediabunnyModule ??= import("mediabunny");
28308
28322
  var abortError = () => new DOMException("Aborted", "AbortError");
28309
28323
  var timedOut = (signal) => signal.reason?.name === "TimeoutError";
28310
28324
  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);
28325
+ function dispose(source, entry3) {
28326
+ if (entry3.disposed) return;
28327
+ entry3.disposed = true;
28328
+ if (entry3.idleTimer !== null) clearTimeout(entry3.idleTimer);
28329
+ if (pool.get(source) === entry3) pool.delete(source);
28330
+ entry3.input?.dispose();
28331
+ entry3.cancelReads?.();
28332
+ }
28333
+ function retire(source, entry3) {
28334
+ if (pool.get(source) === entry3) pool.delete(source);
28335
+ if (entry3.users === 0) dispose(source, entry3);
28322
28336
  }
28323
28337
  async function open(source, pooled) {
28324
28338
  const mediabunny = await loadMediabunny();
28325
- const entry2 = pooled();
28339
+ const entry3 = pooled();
28326
28340
  const live = () => {
28327
- if (entry2.disposed) throw abortError();
28341
+ if (entry3.disposed) throw abortError();
28328
28342
  };
28329
28343
  live();
28330
28344
  const options = mediaUrlSourceOptions("thumbnail");
@@ -28332,8 +28346,8 @@ async function open(source, pooled) {
28332
28346
  source: new mediabunny.UrlSource(source, options),
28333
28347
  formats: mediabunny.ALL_FORMATS
28334
28348
  });
28335
- entry2.input = input;
28336
- entry2.cancelReads = options.cancelReads;
28349
+ entry3.input = input;
28350
+ entry3.cancelReads = options.cancelReads;
28337
28351
  const track2 = await input.getPrimaryVideoTrack();
28338
28352
  live();
28339
28353
  if (!track2) throw new Error("Video source has no decodable video track");
@@ -28347,29 +28361,30 @@ async function open(source, pooled) {
28347
28361
  }
28348
28362
  const metadataDuration = await track2.getDurationFromMetadata({ skipLiveWait: true });
28349
28363
  live();
28350
- return { mediabunny, track: track2, info: { aspect: displayWidth / displayHeight, metadataDuration } };
28364
+ const info = { aspect: displayWidth / displayHeight, metadataDuration };
28365
+ return { mediabunny, track: track2, info, etag: options.etagOf() };
28351
28366
  }
28352
28367
  function pooledSource(source, version) {
28353
28368
  const current = pool.get(source);
28354
28369
  if (current && current.version === version) return current;
28355
28370
  if (current) retire(source, current);
28356
- const entry2 = {
28371
+ const entry3 = {
28357
28372
  version,
28358
28373
  input: null,
28359
28374
  cancelReads: null,
28360
28375
  ready: false,
28361
- opened: open(source, () => entry2),
28376
+ opened: open(source, () => entry3),
28362
28377
  users: 0,
28363
28378
  progress: { framesFromAnyJob: 0 },
28364
28379
  idleTimer: null,
28365
28380
  disposed: false
28366
28381
  };
28367
- entry2.opened.then(
28368
- () => entry2.ready = true,
28369
- () => retire(source, entry2)
28382
+ entry3.opened.then(
28383
+ () => entry3.ready = true,
28384
+ () => retire(source, entry3)
28370
28385
  );
28371
- pool.set(source, entry2);
28372
- return entry2;
28386
+ pool.set(source, entry3);
28387
+ return entry3;
28373
28388
  }
28374
28389
  function untilAborted(pending2, signal) {
28375
28390
  if (signal.aborted) return Promise.reject(abortError());
@@ -28380,27 +28395,27 @@ function untilAborted(pending2, signal) {
28380
28395
  });
28381
28396
  }
28382
28397
  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;
28398
+ const entry3 = pooledSource(source, version);
28399
+ const waitedForOpen = !entry3.ready;
28400
+ entry3.users += 1;
28401
+ if (entry3.idleTimer !== null) clearTimeout(entry3.idleTimer);
28402
+ entry3.idleTimer = null;
28388
28403
  let released2 = false;
28389
28404
  const release2 = (failed2) => {
28390
28405
  if (released2) return;
28391
28406
  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);
28407
+ entry3.users -= 1;
28408
+ if (failed2) retire(source, entry3);
28409
+ if (entry3.users > 0 || entry3.disposed) return;
28410
+ if (pool.get(source) === entry3 && idleMs > 0) {
28411
+ entry3.idleTimer = setTimeout(() => dispose(source, entry3), idleMs);
28397
28412
  } else {
28398
- dispose(source, entry2);
28413
+ dispose(source, entry3);
28399
28414
  }
28400
28415
  };
28401
28416
  try {
28402
- const { progress } = entry2;
28403
- return { ...await untilAborted(entry2.opened, signal), release: release2, waitedForOpen, progress };
28417
+ const { progress } = entry3;
28418
+ return { ...await untilAborted(entry3.opened, signal), release: release2, waitedForOpen, progress };
28404
28419
  } catch (error) {
28405
28420
  release2(!isAbortError(error) || timedOut(signal));
28406
28421
  throw error;
@@ -28450,6 +28465,162 @@ function releaseSharedFrames(held, budgetBytes) {
28450
28465
  }
28451
28466
  }
28452
28467
 
28468
+ // src/player/lib/thumbnailDiskCache.ts
28469
+ var CACHE_PREFIX = "hf-thumbnails:";
28470
+ var INDEX_KEY = "hf-thumbnails-index";
28471
+ var ENTRY_ORIGIN = "https://hf-thumbnail.invalid/";
28472
+ var STORED_THUMBNAIL_BYTES = 256 * 1024 * 1024;
28473
+ var index;
28474
+ var dropped = /* @__PURE__ */ new Set();
28475
+ var sourcesThisTabMovedOn = /* @__PURE__ */ new Set();
28476
+ var saveTimer;
28477
+ var warned = false;
28478
+ var available = () => typeof caches !== "undefined" && typeof crypto?.subtle !== "undefined";
28479
+ async function quietly(work) {
28480
+ if (!available()) return void 0;
28481
+ try {
28482
+ return await work();
28483
+ } catch (error) {
28484
+ if (!warned) console.warn("[Studio] timeline thumbnails stay in memory:", error);
28485
+ warned = true;
28486
+ return void 0;
28487
+ }
28488
+ }
28489
+ async function digest(text) {
28490
+ const bytes = new Uint8Array(
28491
+ await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text))
28492
+ );
28493
+ return Array.from(bytes.subarray(0, 12), (byte) => byte.toString(16).padStart(2, "0")).join("");
28494
+ }
28495
+ var cacheNameOf = async ({ source, etag }) => `${CACHE_PREFIX}${await digest(source)}:${await digest(etag)}`;
28496
+ function savedIndex() {
28497
+ try {
28498
+ const saved2 = JSON.parse(localStorage.getItem(INDEX_KEY) ?? "null");
28499
+ return saved2?.etags && saved2.caches ? saved2 : void 0;
28500
+ } catch {
28501
+ return void 0;
28502
+ }
28503
+ }
28504
+ function loadIndex() {
28505
+ return index ??= savedIndex() ?? { etags: {}, caches: {} };
28506
+ }
28507
+ function laterOf(own, theirs) {
28508
+ if (own && own.usedAt >= theirs.usedAt) return void 0;
28509
+ return { usedAt: theirs.usedAt, bytes: Math.max(theirs.bytes, own?.bytes ?? 0) };
28510
+ }
28511
+ function savedEtagsButThisTabsMoves(mine, theirs) {
28512
+ const etags = { ...mine, ...theirs };
28513
+ for (const key2 of sourcesThisTabMovedOn) etags[key2] = mine[key2];
28514
+ sourcesThisTabMovedOn.clear();
28515
+ return etags;
28516
+ }
28517
+ function mergedIndex() {
28518
+ const mine = loadIndex();
28519
+ const theirs = savedIndex() ?? { etags: {}, caches: {} };
28520
+ for (const [name, entry3] of Object.entries(theirs.caches)) {
28521
+ const later = dropped.has(name) ? void 0 : laterOf(mine.caches[name], entry3);
28522
+ if (later) mine.caches[name] = later;
28523
+ }
28524
+ mine.etags = savedEtagsButThisTabsMoves(mine.etags, theirs.etags);
28525
+ dropped.clear();
28526
+ return mine;
28527
+ }
28528
+ function saveIndexSoon() {
28529
+ saveTimer ??= setTimeout(() => {
28530
+ saveTimer = void 0;
28531
+ try {
28532
+ localStorage.setItem(INDEX_KEY, JSON.stringify(mergedIndex()));
28533
+ } catch {
28534
+ }
28535
+ }, 1e3);
28536
+ }
28537
+ function used(name, addedBytes = 0) {
28538
+ const caches2 = loadIndex().caches;
28539
+ caches2[name] = { usedAt: Date.now(), bytes: (caches2[name]?.bytes ?? 0) + addedBytes };
28540
+ saveIndexSoon();
28541
+ }
28542
+ var storedVersion = (source) => quietly(async () => {
28543
+ const etag = loadIndex().etags[await digest(source)];
28544
+ if (!etag) return void 0;
28545
+ const response = await fetch(source, {
28546
+ headers: { Range: "bytes=0-0", "If-None-Match": etag }
28547
+ });
28548
+ await response.body?.cancel();
28549
+ return response.status === 304 ? { source, etag } : void 0;
28550
+ });
28551
+ var rememberVersion = (stored) => quietly(async () => {
28552
+ const key2 = await digest(stored.source);
28553
+ const saved2 = loadIndex();
28554
+ if (saved2.etags[key2] === stored.etag) return;
28555
+ saved2.etags[key2] = stored.etag;
28556
+ sourcesThisTabMovedOn.add(key2);
28557
+ saveIndexSoon();
28558
+ const keep = await cacheNameOf(stored);
28559
+ for (const name of await caches.keys()) {
28560
+ if (!name.startsWith(`${CACHE_PREFIX}${key2}:`) || name === keep) continue;
28561
+ await caches.delete(name);
28562
+ delete saved2.caches[name];
28563
+ dropped.add(name);
28564
+ }
28565
+ });
28566
+ async function entry2(stored, path) {
28567
+ const name = await cacheNameOf(stored);
28568
+ return { name, cache: await caches.open(name), url: `${ENTRY_ORIGIN}${path}` };
28569
+ }
28570
+ async function storedEntry(stored, path) {
28571
+ const name = await cacheNameOf(stored);
28572
+ return await caches.has(name) ? entry2(stored, path) : void 0;
28573
+ }
28574
+ var readStoredInfo = (stored) => quietly(async () => {
28575
+ const found = await storedEntry(stored, "info");
28576
+ if (!found) return void 0;
28577
+ const { name, cache: cache2, url } = found;
28578
+ const info = await (await cache2.match(url))?.json();
28579
+ if (!(info && info.aspect > 0)) return void 0;
28580
+ used(name);
28581
+ return info;
28582
+ });
28583
+ var storeInfo = (stored, info) => quietly(async () => {
28584
+ const { name, cache: cache2, url } = await entry2(stored, "info");
28585
+ await cache2.put(url, new Response(JSON.stringify(info)));
28586
+ used(name);
28587
+ });
28588
+ var readStoredFrame = (stored, frame3) => quietly(async () => {
28589
+ const found = await storedEntry(stored, `frame?${encodeURIComponent(frame3)}`);
28590
+ if (!found) return void 0;
28591
+ const { name, cache: cache2, url } = found;
28592
+ const response = await cache2.match(url);
28593
+ const decodedAt = Number(response?.headers.get("x-decoded-at"));
28594
+ if (!response || !Number.isFinite(decodedAt)) return void 0;
28595
+ used(name);
28596
+ return { blob: await response.blob(), decodedAt };
28597
+ });
28598
+ var storeFrame = (stored, frame3, decodedAt, blob) => quietly(async () => {
28599
+ const { name, cache: cache2, url } = await entry2(stored, `frame?${encodeURIComponent(frame3)}`);
28600
+ const replaced = Number((await cache2.match(url))?.headers.get("x-bytes")) || 0;
28601
+ const headers = {
28602
+ "content-type": blob.type,
28603
+ "x-decoded-at": String(decodedAt),
28604
+ "x-bytes": String(blob.size)
28605
+ };
28606
+ await cache2.put(url, new Response(blob, { headers }));
28607
+ used(name, blob.size - replaced);
28608
+ await dropLeastUsed(STORED_THUMBNAIL_BYTES);
28609
+ });
28610
+ async function dropLeastUsed(budgetBytes) {
28611
+ const saved2 = loadIndex();
28612
+ let total = Object.values(saved2.caches).reduce((sum, { bytes }) => sum + bytes, 0);
28613
+ const oldestFirst = Object.entries(saved2.caches).sort(([, a], [, b]) => a.usedAt - b.usedAt);
28614
+ for (const [name, { bytes }] of oldestFirst) {
28615
+ if (total <= budgetBytes) break;
28616
+ await caches.delete(name);
28617
+ delete saved2.caches[name];
28618
+ dropped.add(name);
28619
+ total -= bytes;
28620
+ }
28621
+ saveIndexSoon();
28622
+ }
28623
+
28453
28624
  // src/player/lib/thumbnailVideoDecoder.ts
28454
28625
  var LAST_FRAME_INSET_S = 1e-3;
28455
28626
  function videoThumbnailTimestamps(start, duration, frameCount) {
@@ -28459,11 +28630,19 @@ function videoThumbnailTimestamps(start, duration, frameCount) {
28459
28630
  if (count === 1) return [safeStart + safeDuration / 2];
28460
28631
  const edges = Array.from(
28461
28632
  { length: count },
28462
- (_, index) => safeStart + safeDuration * index / count
28633
+ (_, index2) => safeStart + safeDuration * index2 / count
28463
28634
  );
28464
28635
  return [...edges, safeStart + Math.max(0, safeDuration - LAST_FRAME_INSET_S)];
28465
28636
  }
28466
28637
  var sourceInfos = /* @__PURE__ */ new Map();
28638
+ var storedVersions = /* @__PURE__ */ new Map();
28639
+ var storedInfos = /* @__PURE__ */ new Set();
28640
+ var openOf = (request2) => `${request2.source}\0${request2.contentVersion ?? ""}`;
28641
+ function storedVersionOf(request2) {
28642
+ let pending2 = storedVersions.get(openOf(request2));
28643
+ if (!pending2) storedVersions.set(openOf(request2), pending2 = storedVersion(request2.source));
28644
+ return pending2;
28645
+ }
28467
28646
  var accepts = (window2, time, decodedAt) => decodedAt >= window2.sourceStart && time - decodedAt <= (time >= window2.end ? 0 : window2.lead);
28468
28647
  var ClipResultError = class extends Error {
28469
28648
  };
@@ -28553,6 +28732,7 @@ async function decodeFrames(sink, times, slots, signal, resources, progress) {
28553
28732
  throwIfAborted(signal);
28554
28733
  const frame3 = shareFrame(target.key, target.decodedAt, URL.createObjectURL(blob), blob.size);
28555
28734
  progress.framesFromAnyJob += 1;
28735
+ resources.store?.(target.slot, target.decodedAt, blob);
28556
28736
  resources.urls[target.slot] = frame3.url;
28557
28737
  resources.held.push({ key: target.key, frame: frame3 });
28558
28738
  }
@@ -28575,6 +28755,42 @@ function loadedResult(resources, aspect, budgets, frameCount = resources.urls.le
28575
28755
  dispose: () => releaseDecodedResources(resources)
28576
28756
  };
28577
28757
  }
28758
+ var storedFrameName = (fit, info, budgets) => (time) => {
28759
+ const { width, height } = targetDimensions(info.aspect, budgets);
28760
+ return `${fit} ${width}x${height} ${time}`;
28761
+ };
28762
+ async function takeStoredFrames({ timestamps, window: window2 }, slots, keyOf17, nameOf, resources, stored) {
28763
+ const found = await Promise.all(
28764
+ slots.map((slot) => readStoredFrame(stored, nameOf(timestamps[slot])))
28765
+ );
28766
+ return slots.filter((slot, i) => {
28767
+ const time = timestamps[slot];
28768
+ const hit = found[i];
28769
+ if (!hit || !accepts(window2, time, hit.decodedAt)) return true;
28770
+ const key2 = keyOf17(time);
28771
+ const frame3 = shareFrame(key2, hit.decodedAt, URL.createObjectURL(hit.blob), hit.blob.size);
28772
+ resources.urls[slot] = frame3.url;
28773
+ resources.held.push({ key: key2, frame: frame3 });
28774
+ return false;
28775
+ });
28776
+ }
28777
+ function versionRead(request2, source) {
28778
+ if (!source.etag) return void 0;
28779
+ const version = { source: request2.source, etag: source.etag };
28780
+ storedVersions.set(openOf(request2), Promise.resolve(version));
28781
+ return version;
28782
+ }
28783
+ function storeForNextSession(request2, info, budgets, resources, version) {
28784
+ if (!version) return;
28785
+ const id = `${version.source}\0${version.etag}`;
28786
+ if (!storedInfos.has(id)) {
28787
+ storedInfos.add(id);
28788
+ void rememberVersion(version).then(() => storeInfo(version, info));
28789
+ }
28790
+ const nameOf = storedFrameName(request2.fit ?? "cover", info, budgets);
28791
+ const { timestamps } = stripTimes(request2, info, budgets);
28792
+ resources.store = (slot, decodedAt, blob) => void storeFrame(version, nameOf(timestamps[slot]), decodedAt, blob);
28793
+ }
28578
28794
  async function decodeVideoThumbnail(request2, signal, budgets = TIMELINE_VIEWPORT_BUDGETS) {
28579
28795
  const fit = request2.fit ?? "cover";
28580
28796
  const sourceKey = createThumbnailKey({ source: request2.source, version: request2.contentVersion });
@@ -28585,24 +28801,30 @@ async function decodeVideoThumbnail(request2, signal, budgets = TIMELINE_VIEWPOR
28585
28801
  canvases: /* @__PURE__ */ new Set(),
28586
28802
  releasedFrameBytes: budgets.sharedFrameCacheBytes
28587
28803
  };
28588
- const entry2 = sourceInfos.get(request2.source);
28589
- const known = entry2?.version === request2.contentVersion ? entry2?.info : void 0;
28804
+ const entry3 = sourceInfos.get(request2.source);
28590
28805
  try {
28806
+ const stored = await storedVersionOf(request2);
28807
+ const known = entry3 && entry3.version === request2.contentVersion ? entry3.info : stored && await readStoredInfo(stored);
28591
28808
  if (known) {
28592
- if (takeDecodedFrames(stripTimes(request2, known, budgets), keyOf17, resources).length === 0) {
28809
+ sourceInfos.set(request2.source, { version: request2.contentVersion, info: known });
28810
+ const strip = stripTimes(request2, known, budgets);
28811
+ const missing = takeDecodedFrames(strip, keyOf17, resources);
28812
+ const nameOf = storedFrameName(fit, known, budgets);
28813
+ const left = stored && missing.length > 0 ? await takeStoredFrames(strip, missing, keyOf17, nameOf, resources, stored) : missing;
28814
+ if (left.length === 0) {
28593
28815
  throwIfAborted(signal);
28594
28816
  return loadedResult(resources, known.aspect, budgets);
28595
28817
  }
28596
28818
  releaseDecodedResources(resources);
28597
28819
  }
28598
- return await decodeMissingFrames(request2, signal, budgets, keyOf17, resources);
28820
+ return await decodeMissingFrames(request2, signal, budgets, keyOf17, resources, stored);
28599
28821
  } catch (error) {
28600
28822
  releaseDecodedResources(resources);
28601
28823
  reportMediaFetchFailure(error);
28602
28824
  throw error;
28603
28825
  }
28604
28826
  }
28605
- async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources) {
28827
+ async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources, stored) {
28606
28828
  let source;
28607
28829
  try {
28608
28830
  source = await acquireThumbnailSource(
@@ -28629,6 +28851,7 @@ async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources
28629
28851
  sourceInfos.set(request2.source, { version: request2.contentVersion, info });
28630
28852
  const strip = stripTimes(request2, info, budgets);
28631
28853
  const { timestamps, window: window2 } = strip;
28854
+ storeForNextSession(request2, info, budgets, resources, stored ?? versionRead(request2, source));
28632
28855
  const slots = takeDecodedFrames(
28633
28856
  strip,
28634
28857
  keyOf17,
@@ -28812,8 +29035,8 @@ var VideoThumbnail = memo22(function VideoThumbnail2({
28812
29035
  frameW,
28813
29036
  frameCount,
28814
29037
  watchGap: watchGap2,
28815
- children: (index) => {
28816
- const src = urls[thumbnailFrameForTile(index, frameCount, urls.length)];
29038
+ children: (index2) => {
29039
+ const src = urls[thumbnailFrameForTile(index2, frameCount, urls.length)];
28817
29040
  return /* @__PURE__ */ jsx78(
28818
29041
  "div",
28819
29042
  {
@@ -28829,7 +29052,7 @@ var VideoThumbnail = memo22(function VideoThumbnail2({
28829
29052
  }
28830
29053
  )
28831
29054
  },
28832
- index
29055
+ index2
28833
29056
  );
28834
29057
  }
28835
29058
  }
@@ -28979,7 +29202,7 @@ var CompositionThumbnail = memo23(function CompositionThumbnail2({
28979
29202
  animation: "hf-thumb-fade 200ms ease-out",
28980
29203
  mixBlendMode: "var(--timeline-composition-thumbnail-blend)"
28981
29204
  },
28982
- children: (index) => /* @__PURE__ */ jsx79(
29205
+ children: (index2) => /* @__PURE__ */ jsx79(
28983
29206
  "div",
28984
29207
  {
28985
29208
  className: "relative h-full shrink-0 overflow-hidden",
@@ -28995,7 +29218,7 @@ var CompositionThumbnail = memo23(function CompositionThumbnail2({
28995
29218
  }
28996
29219
  )
28997
29220
  },
28998
- index
29221
+ index2
28999
29222
  )
29000
29223
  }
29001
29224
  ),
@@ -29922,11 +30145,11 @@ function nonEmpty(value, fallback) {
29922
30145
  function optionalNonEmpty(value) {
29923
30146
  return value || void 0;
29924
30147
  }
29925
- function attachCompositionSource(entry2, element, compositionSrc) {
29926
- if (compositionSrc) return { ...entry2, compositionSrc };
30148
+ function attachCompositionSource(entry3, element, compositionSrc) {
30149
+ if (compositionSrc) return { ...entry3, compositionSrc };
29927
30150
  const innerVideo = element.querySelector("video[src]");
29928
- if (!innerVideo) return entry2;
29929
- return { ...entry2, src: optionalNonEmpty(innerVideo.getAttribute("src")), tag: "video" };
30151
+ if (!innerVideo) return entry3;
30152
+ return { ...entry3, src: optionalNonEmpty(innerVideo.getAttribute("src")), tag: "video" };
29930
30153
  }
29931
30154
  function buildMissingCompositionEntry(params) {
29932
30155
  const { doc, iframeWin, element, compositionId, rootDuration, fallbackIndex } = params;
@@ -29960,7 +30183,7 @@ function buildMissingCompositionEntry(params) {
29960
30183
  selectorIndex,
29961
30184
  sourceFile
29962
30185
  });
29963
- const entry2 = {
30186
+ const entry3 = {
29964
30187
  id: identity.id,
29965
30188
  label,
29966
30189
  transitionLabel: transitionLabels.get(element) ?? element.getAttribute("data-transition-label") ?? void 0,
@@ -29979,7 +30202,7 @@ function buildMissingCompositionEntry(params) {
29979
30202
  zIndex: readTimelineElementZIndex(element),
29980
30203
  src: optionalNonEmpty(element.getAttribute("src")) ? new URL(element.getAttribute("src"), element.baseURI).href : void 0
29981
30204
  };
29982
- return attachCompositionSource(entry2, element, compositionSrc);
30205
+ return attachCompositionSource(entry3, element, compositionSrc);
29983
30206
  }
29984
30207
  function buildMissingCompositionElements(doc, iframeWin, currentEls, rootDuration) {
29985
30208
  const existingIds = new Set(currentEls.map((e) => e.id));
@@ -29999,7 +30222,7 @@ function buildMissingCompositionElements(doc, iframeWin, currentEls, rootDuratio
29999
30222
  if (!compId || compId === rootCompId) continue;
30000
30223
  if (existingIds.has(el.id) || existingIds.has(compId)) continue;
30001
30224
  resolveEnd ??= createReferenceEndResolver(createTimedElementLookup(doc), iframeWin);
30002
- const entry2 = buildMissingCompositionEntry({
30225
+ const entry3 = buildMissingCompositionEntry({
30003
30226
  doc,
30004
30227
  iframeWin,
30005
30228
  element: el,
@@ -30009,7 +30232,7 @@ function buildMissingCompositionElements(doc, iframeWin, currentEls, rootDuratio
30009
30232
  resolveEnd,
30010
30233
  masterTime
30011
30234
  });
30012
- if (entry2) missing.push(entry2);
30235
+ if (entry3) missing.push(entry3);
30013
30236
  }
30014
30237
  if (!doc.querySelector("[data-composition-src], [data-composition-file]"))
30015
30238
  return { missing, updatedEls: currentEls, patched: false };
@@ -30063,7 +30286,7 @@ function createTimelineElementFromManifestClip(params) {
30063
30286
  selectorIndex,
30064
30287
  sourceFile
30065
30288
  });
30066
- const entry2 = {
30289
+ const entry3 = {
30067
30290
  id: identity.id,
30068
30291
  label,
30069
30292
  transitionLabel: hostEl && transitionLabels.get(hostEl) || hostEl?.getAttribute("data-transition-label") || void 0,
@@ -30091,42 +30314,42 @@ function createTimelineElementFromManifestClip(params) {
30091
30314
  playbackRate: clip.playbackRate
30092
30315
  };
30093
30316
  if (hostEl) {
30094
- applyMediaMetadataFromElement(entry2, hostEl);
30095
- if (!entry2.src) {
30317
+ applyMediaMetadataFromElement(entry3, hostEl);
30318
+ if (!entry3.src) {
30096
30319
  const rawSrc = hostEl.getAttribute("src");
30097
- if (rawSrc) entry2.src = new URL(rawSrc, hostEl.baseURI).href;
30320
+ if (rawSrc) entry3.src = new URL(rawSrc, hostEl.baseURI).href;
30098
30321
  }
30099
- if (hostEl.hasAttribute("data-hidden")) entry2.hidden = true;
30322
+ if (hostEl.hasAttribute("data-hidden")) entry3.hidden = true;
30100
30323
  const timelineRole = hostEl.getAttribute("data-timeline-role");
30101
- if (timelineRole) entry2.timelineRole = timelineRole;
30324
+ if (timelineRole) entry3.timelineRole = timelineRole;
30102
30325
  const link = hostEl.getAttribute("data-link");
30103
- if (link) entry2.link = link;
30326
+ if (link) entry3.link = link;
30104
30327
  const compositionScope = linkScopeOf(hostEl)?.getAttribute("data-composition-id");
30105
- if (compositionScope) entry2.compositionScope = compositionScope;
30328
+ if (compositionScope) entry3.compositionScope = compositionScope;
30106
30329
  const syncOrigin = hostEl.getAttribute("data-sync-origin");
30107
- if (syncOrigin) entry2.syncOrigin = syncOrigin;
30330
+ if (syncOrigin) entry3.syncOrigin = syncOrigin;
30108
30331
  const audioGroup = hostEl.getAttribute("data-audio-group");
30109
30332
  if (audioGroup) {
30110
- entry2.audioGroup = audioGroup;
30333
+ entry3.audioGroup = audioGroup;
30111
30334
  const info = groupInfoFor(doc ?? hostEl.ownerDocument, audioGroup);
30112
- entry2.audioGroupLabel = info.label;
30113
- entry2.audioGroupVolume = info.volume;
30114
- entry2.audioGroupHidden = info.hidden;
30115
- if (info.fxChain) entry2.audioGroupFxChain = info.fxChain;
30116
- if (info.automation) entry2.audioGroupAutomation = info.automation;
30335
+ entry3.audioGroupLabel = info.label;
30336
+ entry3.audioGroupVolume = info.volume;
30337
+ entry3.audioGroupHidden = info.hidden;
30338
+ if (info.fxChain) entry3.audioGroupFxChain = info.fxChain;
30339
+ if (info.automation) entry3.audioGroupAutomation = info.automation;
30117
30340
  }
30118
30341
  const masterChain = readMasterFxChain(doc ?? hostEl.ownerDocument);
30119
- if (masterChain) entry2.masterChain = masterChain;
30342
+ if (masterChain) entry3.masterChain = masterChain;
30120
30343
  const fxChain = hostEl.getAttribute("data-fx-chain");
30121
- if (fxChain) entry2.fxChain = fxChain;
30344
+ if (fxChain) entry3.fxChain = fxChain;
30122
30345
  const automation = hostEl.getAttribute("data-automation");
30123
- if (automation) entry2.automation = automation;
30124
- entry2.zIndex = readTimelineElementZIndex(hostEl);
30346
+ if (automation) entry3.automation = automation;
30347
+ entry3.zIndex = readTimelineElementZIndex(hostEl);
30125
30348
  }
30126
- if (clip.assetUrl) entry2.src = clip.assetUrl;
30349
+ if (clip.assetUrl) entry3.src = clip.assetUrl;
30127
30350
  if (clip.kind === "composition" && clip.compositionId) {
30128
- entry2.playbackStart ??= 0;
30129
- entry2.playbackRate ??= 1;
30351
+ entry3.playbackStart ??= 0;
30352
+ entry3.playbackRate ??= 1;
30130
30353
  let resolvedSrc = clip.compositionSrc;
30131
30354
  if (!resolvedSrc) {
30132
30355
  if (hostEl?.getAttribute("data-composition-id") !== clip.compositionId) {
@@ -30135,34 +30358,34 @@ function createTimelineElementFromManifestClip(params) {
30135
30358
  resolvedSrc = hostEl?.getAttribute("data-composition-src") ?? hostEl?.getAttribute("data-composition-file") ?? null;
30136
30359
  }
30137
30360
  if (resolvedSrc) {
30138
- entry2.compositionSrc = resolvedSrc;
30361
+ entry3.compositionSrc = resolvedSrc;
30139
30362
  } else if (hostEl) {
30140
30363
  const innerVideo = hostEl.querySelector("video[src]");
30141
30364
  if (innerVideo) {
30142
- entry2.src = innerVideo.getAttribute("src") || void 0;
30143
- entry2.tag = "video";
30365
+ entry3.src = innerVideo.getAttribute("src") || void 0;
30366
+ entry3.tag = "video";
30144
30367
  }
30145
30368
  }
30146
30369
  if (hostEl) {
30147
- entry2.domId = hostEl.id || void 0;
30148
- entry2.hfId = hostEl.getAttribute("data-hf-id") || void 0;
30149
- entry2.selector = getTimelineElementSelector(hostEl);
30150
- entry2.selectorIndex = doc && entry2.selector ? getTimelineElementSelectorIndex(doc, hostEl, entry2.selector) : void 0;
30151
- entry2.sourceFile = getTimelineElementSourceFile(hostEl);
30370
+ entry3.domId = hostEl.id || void 0;
30371
+ entry3.hfId = hostEl.getAttribute("data-hf-id") || void 0;
30372
+ entry3.selector = getTimelineElementSelector(hostEl);
30373
+ entry3.selectorIndex = doc && entry3.selector ? getTimelineElementSelectorIndex(doc, hostEl, entry3.selector) : void 0;
30374
+ entry3.sourceFile = getTimelineElementSourceFile(hostEl);
30152
30375
  const nextIdentity = buildTimelineElementIdentity({
30153
30376
  preferredId: clip.id,
30154
30377
  label,
30155
30378
  fallbackIndex,
30156
- domId: entry2.domId,
30157
- selector: entry2.selector,
30158
- selectorIndex: entry2.selectorIndex,
30159
- sourceFile: entry2.sourceFile
30379
+ domId: entry3.domId,
30380
+ selector: entry3.selector,
30381
+ selectorIndex: entry3.selectorIndex,
30382
+ sourceFile: entry3.sourceFile
30160
30383
  });
30161
- entry2.id = nextIdentity.id;
30162
- entry2.key = nextIdentity.key;
30384
+ entry3.id = nextIdentity.id;
30385
+ entry3.key = nextIdentity.key;
30163
30386
  }
30164
30387
  }
30165
- return entry2;
30388
+ return entry3;
30166
30389
  }
30167
30390
  function parseTimelineFromDOM(doc, rootDuration, timelines) {
30168
30391
  const rootComp = doc.querySelector("[data-composition-id]");
@@ -30210,7 +30433,7 @@ function parseTimelineFromDOM(doc, rootDuration, timelines) {
30210
30433
  selectorIndex,
30211
30434
  sourceFile
30212
30435
  });
30213
- const entry2 = {
30436
+ const entry3 = {
30214
30437
  id: identity.id,
30215
30438
  label,
30216
30439
  transitionLabel: transitionLabels.get(el) ?? el.getAttribute("data-transition-label") ?? void 0,
@@ -30231,59 +30454,59 @@ function parseTimelineFromDOM(doc, rootDuration, timelines) {
30231
30454
  zIndex: readTimelineElementZIndex(el)
30232
30455
  };
30233
30456
  const mediaEl = resolveMediaElement(el);
30234
- applyMediaMetadataFromElement(entry2, el);
30457
+ applyMediaMetadataFromElement(entry3, el);
30235
30458
  if (mediaEl) {
30236
30459
  if (mediaEl.tagName === "IMG") {
30237
- entry2.tag = "img";
30460
+ entry3.tag = "img";
30238
30461
  }
30239
30462
  const resolvedSrc = mediaEl.src || void 0;
30240
- if (resolvedSrc) entry2.src = resolvedSrc;
30463
+ if (resolvedSrc) entry3.src = resolvedSrc;
30241
30464
  }
30242
30465
  const domMasterChain = readMasterFxChain(doc);
30243
- if (domMasterChain) entry2.masterChain = domMasterChain;
30466
+ if (domMasterChain) entry3.masterChain = domMasterChain;
30244
30467
  const domFxChain = el.getAttribute("data-fx-chain");
30245
- if (domFxChain) entry2.fxChain = domFxChain;
30468
+ if (domFxChain) entry3.fxChain = domFxChain;
30246
30469
  const domAutomation = el.getAttribute("data-automation");
30247
- if (domAutomation) entry2.automation = domAutomation;
30470
+ if (domAutomation) entry3.automation = domAutomation;
30248
30471
  if (el.hasAttribute("data-timeline-locked")) {
30249
- entry2.timelineLocked = true;
30472
+ entry3.timelineLocked = true;
30250
30473
  }
30251
30474
  if (el.hasAttribute("data-hidden")) {
30252
- entry2.hidden = true;
30475
+ entry3.hidden = true;
30253
30476
  }
30254
30477
  const timelineRole = el.getAttribute("data-timeline-role");
30255
- if (timelineRole) entry2.timelineRole = timelineRole;
30478
+ if (timelineRole) entry3.timelineRole = timelineRole;
30256
30479
  const domLink = el.getAttribute("data-link");
30257
- if (domLink) entry2.link = domLink;
30480
+ if (domLink) entry3.link = domLink;
30258
30481
  const domCompositionScope = linkScopeOf(el)?.getAttribute("data-composition-id");
30259
- if (domCompositionScope) entry2.compositionScope = domCompositionScope;
30482
+ if (domCompositionScope) entry3.compositionScope = domCompositionScope;
30260
30483
  const domSyncOrigin = el.getAttribute("data-sync-origin");
30261
- if (domSyncOrigin) entry2.syncOrigin = domSyncOrigin;
30484
+ if (domSyncOrigin) entry3.syncOrigin = domSyncOrigin;
30262
30485
  const domAudioGroup = el.getAttribute("data-audio-group");
30263
30486
  if (domAudioGroup) {
30264
- entry2.audioGroup = domAudioGroup;
30487
+ entry3.audioGroup = domAudioGroup;
30265
30488
  const domGroupInfo = groupInfoFor(doc, domAudioGroup);
30266
- entry2.audioGroupLabel = domGroupInfo.label;
30267
- entry2.audioGroupVolume = domGroupInfo.volume;
30268
- entry2.audioGroupHidden = domGroupInfo.hidden;
30269
- if (domGroupInfo.fxChain) entry2.audioGroupFxChain = domGroupInfo.fxChain;
30270
- if (domGroupInfo.automation) entry2.audioGroupAutomation = domGroupInfo.automation;
30489
+ entry3.audioGroupLabel = domGroupInfo.label;
30490
+ entry3.audioGroupVolume = domGroupInfo.volume;
30491
+ entry3.audioGroupHidden = domGroupInfo.hidden;
30492
+ if (domGroupInfo.fxChain) entry3.audioGroupFxChain = domGroupInfo.fxChain;
30493
+ if (domGroupInfo.automation) entry3.audioGroupAutomation = domGroupInfo.automation;
30271
30494
  }
30272
30495
  const compSrc = el.getAttribute("data-composition-src") || el.getAttribute("data-composition-file");
30273
30496
  if (compSrc) {
30274
- entry2.compositionSrc = compSrc;
30497
+ entry3.compositionSrc = compSrc;
30275
30498
  } else if (compId && compId !== rootComp?.getAttribute("data-composition-id")) {
30276
30499
  const innerMedia = el.querySelector("video[src], img[src]");
30277
30500
  if (innerMedia) {
30278
- entry2.src = innerMedia.getAttribute("src") || void 0;
30279
- entry2.tag = innerMedia.tagName === "IMG" ? "img" : "video";
30501
+ entry3.src = innerMedia.getAttribute("src") || void 0;
30502
+ entry3.tag = innerMedia.tagName === "IMG" ? "img" : "video";
30280
30503
  }
30281
30504
  }
30282
- if (entry2.kind === "composition") {
30283
- entry2.playbackStart ??= 0;
30284
- entry2.playbackRate ??= 1;
30505
+ if (entry3.kind === "composition") {
30506
+ entry3.playbackStart ??= 0;
30507
+ entry3.playbackRate ??= 1;
30285
30508
  }
30286
- els.push(entry2);
30509
+ els.push(entry3);
30287
30510
  });
30288
30511
  return els;
30289
30512
  }
@@ -30440,11 +30663,11 @@ function safeContentDocument(iframe) {
30440
30663
  }
30441
30664
  function buildTimelineElementsFromClips(clips, iframeDoc) {
30442
30665
  const resolveHost = iframeDoc ? createTimelineDomNodeResolver(iframeDoc) : null;
30443
- return clips.map((clip, index) => {
30444
- const hostEl = resolveHost?.(clip, index) ?? null;
30666
+ return clips.map((clip, index2) => {
30667
+ const hostEl = resolveHost?.(clip, index2) ?? null;
30445
30668
  return createTimelineElementFromManifestClip({
30446
30669
  clip,
30447
- fallbackIndex: index,
30670
+ fallbackIndex: index2,
30448
30671
  doc: iframeDoc,
30449
30672
  hostEl
30450
30673
  });
@@ -30855,7 +31078,7 @@ function withTweenIndex(run) {
30855
31078
  }
30856
31079
  }
30857
31080
  function indexTweens(children) {
30858
- const index = { byElement: /* @__PURE__ */ new Map(), byId: /* @__PURE__ */ new Map() };
31081
+ const index2 = { byElement: /* @__PURE__ */ new Map(), byId: /* @__PURE__ */ new Map() };
30859
31082
  const add = (map, key2, tween) => {
30860
31083
  const list = map.get(key2);
30861
31084
  if (!list) map.set(key2, [tween]);
@@ -30863,19 +31086,19 @@ function indexTweens(children) {
30863
31086
  };
30864
31087
  for (const tween of children) {
30865
31088
  for (const target of tween.targets?.() ?? []) {
30866
- add(index.byElement, target, tween);
31089
+ add(index2.byElement, target, tween);
30867
31090
  const id = target.id;
30868
- if (id) add(index.byId, id, tween);
31091
+ if (id) add(index2.byId, id, tween);
30869
31092
  }
30870
31093
  }
30871
- return index;
31094
+ return index2;
30872
31095
  }
30873
31096
  function tweensTargeting(timeline, el) {
30874
31097
  if (!timeline || typeof timeline !== "object" || !tweenIndexes)
30875
31098
  return (timeline?.getChildren?.(true) ?? []).filter((tween) => matchesElement(tween, el));
30876
- let index = tweenIndexes.get(timeline);
30877
- if (!index) tweenIndexes.set(timeline, index = indexTweens(timeline.getChildren?.(true) ?? []));
30878
- return (el.id ? index.byId.get(el.id) : index.byElement.get(el)) ?? [];
31099
+ let index2 = tweenIndexes.get(timeline);
31100
+ if (!index2) tweenIndexes.set(timeline, index2 = indexTweens(timeline.getChildren?.(true) ?? []));
31101
+ return (el.id ? index2.byId.get(el.id) : index2.byElement.get(el)) ?? [];
30879
31102
  }
30880
31103
 
30881
31104
  // src/hooks/gsapParsedTween.ts
@@ -32384,17 +32607,17 @@ function validateFixtureSpec(spec) {
32384
32607
  const geometry = PROFILE_GEOMETRY[spec.profile];
32385
32608
  return geometry;
32386
32609
  }
32387
- function fixtureTrack(index, spec) {
32388
- if (index < TRACK_COUNT) return index;
32389
- if (spec.profile !== "dense-short") return index % TRACK_COUNT;
32610
+ function fixtureTrack(index2, spec) {
32611
+ if (index2 < TRACK_COUNT) return index2;
32612
+ if (spec.profile !== "dense-short") return index2 % TRACK_COUNT;
32390
32613
  const denseTrackCount = Math.ceil((spec.elementCount - TRACK_COUNT) / 127);
32391
- return (index - TRACK_COUNT) % Math.max(1, denseTrackCount);
32614
+ return (index2 - TRACK_COUNT) % Math.max(1, denseTrackCount);
32392
32615
  }
32393
- function fixtureStart(index, profile, duration, clipDuration2) {
32394
- const available = Math.max(0, duration - clipDuration2);
32395
- if (profile === "dense-short") return index % 128 * 0.5;
32396
- if (profile === "long-overlap") return index * 37 % Math.max(1, available);
32397
- return index * 17 % Math.max(1, available);
32616
+ function fixtureStart(index2, profile, duration, clipDuration2) {
32617
+ const available2 = Math.max(0, duration - clipDuration2);
32618
+ if (profile === "dense-short") return index2 % 128 * 0.5;
32619
+ if (profile === "long-overlap") return index2 * 37 % Math.max(1, available2);
32620
+ return index2 * 17 % Math.max(1, available2);
32398
32621
  }
32399
32622
  function keyframeData() {
32400
32623
  return {
@@ -32427,26 +32650,26 @@ function createTimelinePerformanceFixture(spec) {
32427
32650
  const keyframeCache = /* @__PURE__ */ new Map();
32428
32651
  const gsapAnimations = /* @__PURE__ */ new Map();
32429
32652
  const expandedClipIds = /* @__PURE__ */ new Set();
32430
- for (let index = 0; index < spec.elementCount; index += 1) {
32431
- const id = `perf-${spec.profile}-${spec.elementCount}-${index}`;
32432
- const start = fixtureStart(index, spec.profile, geometry.duration, geometry.clipDuration);
32433
- const track2 = fixtureTrack(index, spec);
32653
+ for (let index2 = 0; index2 < spec.elementCount; index2 += 1) {
32654
+ const id = `perf-${spec.profile}-${spec.elementCount}-${index2}`;
32655
+ const start = fixtureStart(index2, spec.profile, geometry.duration, geometry.clipDuration);
32656
+ const track2 = fixtureTrack(index2, spec);
32434
32657
  const element = {
32435
32658
  id,
32436
32659
  key: id,
32437
32660
  domId: id,
32438
32661
  selector: `#${id}`,
32439
- label: `Fixture ${index + 1}`,
32440
- tag: spec.profile === "remote-unsupported" && index % 2 === 0 ? "video" : "div",
32662
+ label: `Fixture ${index2 + 1}`,
32663
+ tag: spec.profile === "remote-unsupported" && index2 % 2 === 0 ? "video" : "div",
32441
32664
  start,
32442
32665
  duration: geometry.clipDuration,
32443
32666
  track: track2,
32444
32667
  authoredTrack: track2
32445
32668
  };
32446
32669
  if (spec.profile === "composition-heavy") {
32447
- element.compositionSrc = `compositions/perf-${index % 32}.html`;
32670
+ element.compositionSrc = `compositions/perf-${index2 % 32}.html`;
32448
32671
  } else if (spec.profile === "remote-unsupported") {
32449
- element.src = index % 2 === 0 ? `https://media.invalid/perf-${index % 32}.mp4` : `assets/perf-${index % 32}.unsupported`;
32672
+ element.src = index2 % 2 === 0 ? `https://media.invalid/perf-${index2 % 32}.mp4` : `assets/perf-${index2 % 32}.unsupported`;
32450
32673
  }
32451
32674
  if (spec.profile === "keyframe-heavy-expanded") {
32452
32675
  keyframeCache.set(id, keyframeData());
@@ -32539,9 +32762,9 @@ function evictMetadataOverflow() {
32539
32762
  ...Array.from(cache, ([key2, value]) => ({ key: key2, at: value.lastAccess, failed: false })),
32540
32763
  ...Array.from(failed, ([key2, value]) => ({ key: key2, at: value.lastAccess, failed: true }))
32541
32764
  ].sort((left, right) => left.at - right.at);
32542
- for (const entry2 of entries.slice(0, overflow)) {
32543
- if (entry2.failed) failed.delete(entry2.key);
32544
- else cache.delete(entry2.key);
32765
+ for (const entry3 of entries.slice(0, overflow)) {
32766
+ if (entry3.failed) failed.delete(entry3.key);
32767
+ else cache.delete(entry3.key);
32545
32768
  }
32546
32769
  }
32547
32770
  function applyCachedSourceDurations(elements, projectId) {
@@ -32624,6 +32847,10 @@ function shouldStopAfterSeek(input) {
32624
32847
  }
32625
32848
 
32626
32849
  // src/player/hooks/previewMessageRouter.ts
32850
+ import {
32851
+ parseMediaLoadFailure,
32852
+ RUNTIME_MEDIA_LOAD_FAILED
32853
+ } from "@hyperframes/core/runtime/protocol";
32627
32854
  function isForeignSource(e, iframe) {
32628
32855
  return Boolean(e.source && iframe && e.source !== iframe.contentWindow);
32629
32856
  }
@@ -32680,6 +32907,12 @@ function applyStoreReport(data) {
32680
32907
  case "preview-facts":
32681
32908
  store.setPreviewFacts(parsePreviewFacts(data.facts));
32682
32909
  return true;
32910
+ case "diagnostic": {
32911
+ if (data.code !== RUNTIME_MEDIA_LOAD_FAILED) return false;
32912
+ const failure = parseMediaLoadFailure(data.details);
32913
+ if (failure) store.setMediaLoadFailure(failure);
32914
+ return true;
32915
+ }
32683
32916
  default:
32684
32917
  return false;
32685
32918
  }
@@ -32748,8 +32981,8 @@ var RENDERED_FIELDS = [
32748
32981
  ];
32749
32982
  function timelineElementsChanged(previous, next) {
32750
32983
  if (next.length !== previous.length) return true;
32751
- return next.some((element, index) => {
32752
- const prior = previous[index];
32984
+ return next.some((element, index2) => {
32985
+ const prior = previous[index2];
32753
32986
  return !prior || RENDERED_FIELDS.some((key2) => element[key2] !== prior[key2]) || !sameTimelineText(element.text, prior.text);
32754
32987
  });
32755
32988
  }
@@ -33274,9 +33507,9 @@ function useCompositionStack({
33274
33507
  const compIdToSrcRef = useRef50(compIdToSrc);
33275
33508
  compIdToSrcRef.current = compIdToSrc;
33276
33509
  const handleNavigateComposition = useCallback42(
33277
- (index) => {
33510
+ (index2) => {
33278
33511
  usePlayerStore.getState().setElements([]);
33279
- updateCompositionStack((prev) => prev.slice(0, index + 1));
33512
+ updateCompositionStack((prev) => prev.slice(0, index2 + 1));
33280
33513
  },
33281
33514
  // eslint-disable-next-line react-hooks/exhaustive-deps
33282
33515
  []
@@ -36590,9 +36823,9 @@ function hasAuthorPointerEventsNone(el) {
36590
36823
  }
36591
36824
  function collectPointerEventsNoneTargets(elements) {
36592
36825
  const disabled = /* @__PURE__ */ new WeakSet();
36593
- for (const entry2 of elements) {
36594
- if (isHtmlElement(entry2) && hasAuthorPointerEventsNone(entry2)) {
36595
- disabled.add(entry2);
36826
+ for (const entry3 of elements) {
36827
+ if (isHtmlElement(entry3) && hasAuthorPointerEventsNone(entry3)) {
36828
+ disabled.add(entry3);
36596
36829
  }
36597
36830
  }
36598
36831
  return disabled;
@@ -37300,8 +37533,8 @@ function rectsEqual(a, b) {
37300
37533
  function groupOverlayItemsEqual(a, b) {
37301
37534
  if (a === b) return true;
37302
37535
  if (a.length !== b.length) return false;
37303
- return a.every((item, index) => {
37304
- const other = b[index];
37536
+ return a.every((item, index2) => {
37537
+ const other = b[index2];
37305
37538
  return Boolean(
37306
37539
  other && item.key === other.key && item.element === other.element && item.selection === other.selection && rectsEqual(item.rect, other.rect)
37307
37540
  );
@@ -37923,7 +38156,7 @@ function useDomEditOverlayRects({
37923
38156
  sel && hoverSel && selectionCacheKey(sel) === selectionCacheKey(hoverSel)
37924
38157
  );
37925
38158
  const hoverMatchesGroup = Boolean(
37926
- hoverSel && group.some((entry2) => selectionCacheKey(entry2) === selectionCacheKey(hoverSel))
38159
+ hoverSel && group.some((entry3) => selectionCacheKey(entry3) === selectionCacheKey(hoverSel))
37927
38160
  );
37928
38161
  if (!hoverSel || hoverMatchesSelection || hoverMatchesGroup) {
37929
38162
  resolvedHoverElementRef.current = null;
@@ -38057,7 +38290,7 @@ function OffCanvasIndicators({
38057
38290
  function ChildRectOutlines({
38058
38291
  rects
38059
38292
  }) {
38060
- return /* @__PURE__ */ jsx95(Fragment28, { children: rects.map((rect, index) => /* @__PURE__ */ jsx95(
38293
+ return /* @__PURE__ */ jsx95(Fragment28, { children: rects.map((rect, index2) => /* @__PURE__ */ jsx95(
38061
38294
  "div",
38062
38295
  {
38063
38296
  className: "pointer-events-none absolute border border-dashed border-white/20 rounded-xs",
@@ -38070,7 +38303,7 @@ function ChildRectOutlines({
38070
38303
  transform: rect.angle ? `rotate(${rect.angle}deg)` : void 0
38071
38304
  }
38072
38305
  },
38073
- index
38306
+ index2
38074
38307
  )) });
38075
38308
  }
38076
38309
 
@@ -38251,21 +38484,21 @@ function hasEditMarks(doc) {
38251
38484
  if (!Observer) return scanForEditMarks(doc);
38252
38485
  let cache2 = editMarkCaches.get(doc);
38253
38486
  if (!cache2) {
38254
- const entry2 = {
38487
+ const entry3 = {
38255
38488
  observer: new Observer(() => {
38256
- entry2.stale = true;
38489
+ entry3.stale = true;
38257
38490
  }),
38258
38491
  stale: true,
38259
38492
  has: false
38260
38493
  };
38261
- entry2.observer.observe(doc, {
38494
+ entry3.observer.observe(doc, {
38262
38495
  subtree: true,
38263
38496
  childList: true,
38264
38497
  attributes: true,
38265
38498
  attributeFilter: STUDIO_EDIT_ATTRS
38266
38499
  });
38267
- editMarkCaches.set(doc, entry2);
38268
- cache2 = entry2;
38500
+ editMarkCaches.set(doc, entry3);
38501
+ cache2 = entry3;
38269
38502
  }
38270
38503
  if (cache2.observer.takeRecords().length > 0) cache2.stale = true;
38271
38504
  if (cache2.stale) {
@@ -40775,8 +41008,8 @@ function createDomEditOverlayGestureHandlers(opts) {
40775
41008
  pointer: `${Math.round(rawDx)},${Math.round(rawDy)}`,
40776
41009
  applied: `${Math.round(dx)},${Math.round(dy)}`,
40777
41010
  committed: Object.fromEntries(
40778
- updates.map((update, index) => [
40779
- groupG.members[index]?.key ?? String(index),
41011
+ updates.map((update, index2) => [
41012
+ groupG.members[index2]?.key ?? String(index2),
40780
41013
  `${Math.round(update.next.x)},${Math.round(update.next.y)}`
40781
41014
  ])
40782
41015
  ),
@@ -42419,8 +42652,8 @@ function graphemeBounds(runs, start, end) {
42419
42652
  end: boundaries.find((boundary) => boundary >= end) ?? end
42420
42653
  };
42421
42654
  }
42422
- function atEndOfSegment({ index, segment }) {
42423
- return index + segment.length;
42655
+ function atEndOfSegment({ index: index2, segment }) {
42656
+ return index2 + segment.length;
42424
42657
  }
42425
42658
  function boundaryAtOrBefore(boundaries, offset) {
42426
42659
  let previous = offset;
@@ -42440,7 +42673,7 @@ function readCoveredInlineStyleChars(range) {
42440
42673
  const end = offsetOf2(host, range.endContainer, range.endOffset);
42441
42674
  if (start === null || end === null) return null;
42442
42675
  const collapsed = start === end;
42443
- const covered = charRuns(readRuns(host)).slice(collapsed ? Math.max(0, start - 1) : start, collapsed ? Math.max(1, start) : end).map((entry2) => ({ char: entry2.char, style: entry2.style, painter: entry2.painter ?? null }));
42676
+ const covered = charRuns(readRuns(host)).slice(collapsed ? Math.max(0, start - 1) : start, collapsed ? Math.max(1, start) : end).map((entry3) => ({ char: entry3.char, style: entry3.style, painter: entry3.painter ?? null }));
42444
42677
  return covered.length > 0 ? covered : null;
42445
42678
  }
42446
42679
  function editingHost(node) {
@@ -42501,8 +42734,8 @@ function identityOf(element) {
42501
42734
  }
42502
42735
  function ownStyle(element) {
42503
42736
  const style = {};
42504
- for (let index = 0; index < element.style.length; index += 1) {
42505
- const property = element.style.item(index);
42737
+ for (let index2 = 0; index2 < element.style.length; index2 += 1) {
42738
+ const property = element.style.item(index2);
42506
42739
  if (!property) continue;
42507
42740
  const value = element.style.getPropertyValue(property);
42508
42741
  if (isRichTextFormattingStyle(property, value)) style[property] = value;
@@ -42512,9 +42745,9 @@ function ownStyle(element) {
42512
42745
  function charRuns(runs) {
42513
42746
  const perChar = [];
42514
42747
  for (const run of runs) {
42515
- for (let index = 0; index < run.text.length; index += 1) {
42748
+ for (let index2 = 0; index2 < run.text.length; index2 += 1) {
42516
42749
  perChar.push({
42517
- char: run.text[index] ?? "",
42750
+ char: run.text[index2] ?? "",
42518
42751
  style: run.style,
42519
42752
  origin: run.origin,
42520
42753
  identity: run.identity,
@@ -42528,11 +42761,11 @@ function restyle(runs, start, end, delta) {
42528
42761
  const text = runs.map((run) => run.text).join("");
42529
42762
  const perChar = charRuns(runs);
42530
42763
  const next = [];
42531
- for (let index = 0; index < text.length; index += 1) {
42764
+ for (let index2 = 0; index2 < text.length; index2 += 1) {
42532
42765
  appendChar(
42533
42766
  next,
42534
- text[index] ?? "",
42535
- charAfter(perChar[index], index >= start && index < end, delta)
42767
+ text[index2] ?? "",
42768
+ charAfter(perChar[index2], index2 >= start && index2 < end, delta)
42536
42769
  );
42537
42770
  }
42538
42771
  return next;
@@ -42592,8 +42825,8 @@ function runNodes(doc, runs) {
42592
42825
  function runNode(doc, run, carried) {
42593
42826
  const key2 = styleKey(run.style);
42594
42827
  const nodes = [];
42595
- for (const [index, piece] of run.text.split(BREAK).entries()) {
42596
- if (index > 0) nodes.push(doc.createElement("br"));
42828
+ for (const [index2, piece] of run.text.split(BREAK).entries()) {
42829
+ if (index2 > 0) nodes.push(doc.createElement("br"));
42597
42830
  if (!piece) continue;
42598
42831
  if (!key2 && carried.size === 0) {
42599
42832
  nodes.push(doc.createTextNode(piece));
@@ -42858,7 +43091,7 @@ function swatchBackground(distinctColours, agreed) {
42858
43091
  if (distinctColours.length === 0) return agreed || DEFAULT_COLOR;
42859
43092
  if (distinctColours.length === 1) return distinctColours[0];
42860
43093
  const stops = distinctColours.map(
42861
- (colour, index) => `${colour} ${(index / (distinctColours.length - 1) * 100).toFixed(2)}%`
43094
+ (colour, index2) => `${colour} ${(index2 / (distinctColours.length - 1) * 100).toFixed(2)}%`
42862
43095
  );
42863
43096
  return `linear-gradient(135deg, ${stops.join(", ")})`;
42864
43097
  }
@@ -45309,7 +45542,7 @@ function useElementLifecycleOps({
45309
45542
  (entries, gestureCoalesceKey, actionKind) => {
45310
45543
  if (entries.length === 0) return Promise.resolve();
45311
45544
  return (async () => {
45312
- const releaseZPersists = entries.map((entry2) => beginLayerZPersist(entry2.element));
45545
+ const releaseZPersists = entries.map((entry3) => beginLayerZPersist(entry3.element));
45313
45546
  try {
45314
45547
  onReorderShadow?.(
45315
45548
  entries.map((e) => readHfId(e.element)).filter((id) => id != null)
@@ -45318,58 +45551,58 @@ function useElementLifecycleOps({
45318
45551
  const patchesBySourceFile = /* @__PURE__ */ new Map();
45319
45552
  const rollbacks = [];
45320
45553
  const revealCommits = [];
45321
- for (const entry2 of entries) {
45322
- const priorZIndex = entry2.element.style.zIndex;
45323
- const priorPosition = entry2.element.style.position;
45324
- const priorStoreEntry = entry2.key ? usePlayerStore.getState().elements.find((el) => (el.key ?? el.id) === entry2.key) : void 0;
45554
+ for (const entry3 of entries) {
45555
+ const priorZIndex = entry3.element.style.zIndex;
45556
+ const priorPosition = entry3.element.style.position;
45557
+ const priorStoreEntry = entry3.key ? usePlayerStore.getState().elements.find((el) => (el.key ?? el.id) === entry3.key) : void 0;
45325
45558
  let positionChanged = false;
45326
- const liftPriorPosition = entry2.element.getAttribute(LAYER_REVEAL_PRIOR_POSITION_ATTR);
45327
- const revealOwnership = beginLayerRevealCommit(entry2.element);
45559
+ const liftPriorPosition = entry3.element.getAttribute(LAYER_REVEAL_PRIOR_POSITION_ATTR);
45560
+ const revealOwnership = beginLayerRevealCommit(entry3.element);
45328
45561
  if (revealOwnership) {
45329
- revealCommits.push({ element: entry2.element, ownership: revealOwnership });
45562
+ revealCommits.push({ element: entry3.element, ownership: revealOwnership });
45330
45563
  }
45331
- entry2.element.style.zIndex = String(entry2.zIndex);
45564
+ entry3.element.style.zIndex = String(entry3.zIndex);
45332
45565
  const patches = [
45333
- { type: "inline-style", property: "z-index", value: String(entry2.zIndex) }
45566
+ { type: "inline-style", property: "z-index", value: String(entry3.zIndex) }
45334
45567
  ];
45335
45568
  try {
45336
- const win = entry2.element.ownerDocument?.defaultView;
45337
- const effectivePosition = liftPriorPosition ?? (win ? win.getComputedStyle(entry2.element).position : void 0);
45569
+ const win = entry3.element.ownerDocument?.defaultView;
45570
+ const effectivePosition = liftPriorPosition ?? (win ? win.getComputedStyle(entry3.element).position : void 0);
45338
45571
  if (effectivePosition === "static") {
45339
- entry2.element.style.position = "relative";
45572
+ entry3.element.style.position = "relative";
45340
45573
  positionChanged = true;
45341
45574
  patches.push({ type: "inline-style", property: "position", value: "relative" });
45342
45575
  }
45343
45576
  } catch {
45344
45577
  }
45345
- if (entry2.key) {
45346
- usePlayerStore.getState().updateElement(entry2.key, { zIndex: entry2.zIndex, hasExplicitZIndex: true });
45578
+ if (entry3.key) {
45579
+ usePlayerStore.getState().updateElement(entry3.key, { zIndex: entry3.zIndex, hasExplicitZIndex: true });
45347
45580
  }
45348
45581
  rollbacks.push(() => {
45349
45582
  if (revealOwnership) {
45350
- rollbackLayerRevealCommit(entry2.element, revealOwnership);
45583
+ rollbackLayerRevealCommit(entry3.element, revealOwnership);
45351
45584
  } else {
45352
- entry2.element.style.zIndex = priorZIndex;
45353
- if (positionChanged) entry2.element.style.position = priorPosition;
45585
+ entry3.element.style.zIndex = priorZIndex;
45586
+ if (positionChanged) entry3.element.style.position = priorPosition;
45354
45587
  }
45355
- if (entry2.key && priorStoreEntry) {
45356
- usePlayerStore.getState().updateElement(entry2.key, {
45588
+ if (entry3.key && priorStoreEntry) {
45589
+ usePlayerStore.getState().updateElement(entry3.key, {
45357
45590
  zIndex: priorStoreEntry.zIndex,
45358
45591
  hasExplicitZIndex: priorStoreEntry.hasExplicitZIndex
45359
45592
  });
45360
45593
  }
45361
45594
  });
45362
- const filePatches = patchesBySourceFile.get(entry2.sourceFile) ?? [];
45595
+ const filePatches = patchesBySourceFile.get(entry3.sourceFile) ?? [];
45363
45596
  filePatches.push({
45364
45597
  target: buildDomEditPatchTarget({
45365
- id: entry2.id,
45366
- hfId: readHfId(entry2.element),
45367
- selector: entry2.selector,
45368
- selectorIndex: entry2.selectorIndex
45598
+ id: entry3.id,
45599
+ hfId: readHfId(entry3.element),
45600
+ selector: entry3.selector,
45601
+ selectorIndex: entry3.selectorIndex
45369
45602
  }),
45370
45603
  operations: patches
45371
45604
  });
45372
- patchesBySourceFile.set(entry2.sourceFile, filePatches);
45605
+ patchesBySourceFile.set(entry3.sourceFile, filePatches);
45373
45606
  }
45374
45607
  const batches = [...patchesBySourceFile].map(([sourceFile, patches]) => ({
45375
45608
  sourceFile,
@@ -45675,17 +45908,17 @@ function describeZIndexElement(element) {
45675
45908
  }
45676
45909
  function resolveZIndexEntries(sel, patches, activeCompPath) {
45677
45910
  const entries = [];
45678
- const dropped = [];
45911
+ const dropped2 = [];
45679
45912
  for (const patch of patches) {
45680
45913
  if (patch.element === sel.element) {
45681
45914
  entries.push(selectedZIndexEntry(sel, patch.zIndex));
45682
45915
  continue;
45683
45916
  }
45684
- const entry2 = siblingZIndexEntry(patch.element, patch.zIndex, sel.sourceFile, activeCompPath);
45685
- if (entry2) entries.push(entry2);
45686
- else dropped.push(patch);
45917
+ const entry3 = siblingZIndexEntry(patch.element, patch.zIndex, sel.sourceFile, activeCompPath);
45918
+ if (entry3) entries.push(entry3);
45919
+ else dropped2.push(patch);
45687
45920
  }
45688
- return { entries, dropped };
45921
+ return { entries, dropped: dropped2 };
45689
45922
  }
45690
45923
  var isLive = (element) => element.isConnected && element.ownerDocument.defaultView !== null;
45691
45924
  function useDomEditZOrder() {
@@ -45700,12 +45933,12 @@ function useDomEditZOrder() {
45700
45933
  const commit2 = useCallback63(
45701
45934
  (sel, patches, action, crossed) => {
45702
45935
  if (readOnly) return false;
45703
- const { entries, dropped } = resolveZIndexEntries(sel, patches, activeCompPath);
45704
- if (dropped.length > 0) {
45705
- for (const patch of dropped) patch.element.style.zIndex = String(patch.zIndex);
45936
+ const { entries, dropped: dropped2 } = resolveZIndexEntries(sel, patches, activeCompPath);
45937
+ if (dropped2.length > 0) {
45938
+ for (const patch of dropped2) patch.element.style.zIndex = String(patch.zIndex);
45706
45939
  console.warn(
45707
45940
  "[studio] z-index reorder: dropping sibling(s) with no stable id/selector (will revert on reload):",
45708
- dropped.map((patch) => describeZIndexElement(patch.element)).join(", ")
45941
+ dropped2.map((patch) => describeZIndexElement(patch.element)).join(", ")
45709
45942
  );
45710
45943
  }
45711
45944
  if (entries.length === 0) return false;
@@ -45838,8 +46071,8 @@ function mintElementHandle(address) {
45838
46071
  if (address.hfId) return `hf${SEPARATOR}${scoped(address.hfId)}`;
45839
46072
  if (address.domId) return `dom${SEPARATOR}${scoped(address.domId)}`;
45840
46073
  if (address.selector) {
45841
- const index = address.selectorIndex ?? 0;
45842
- return `sel${SEPARATOR}${scoped(address.selector)}${INDEX_SEPARATOR}${index}`;
46074
+ const index2 = address.selectorIndex ?? 0;
46075
+ return `sel${SEPARATOR}${scoped(address.selector)}${INDEX_SEPARATOR}${index2}`;
45843
46076
  }
45844
46077
  return null;
45845
46078
  }
@@ -45909,13 +46142,13 @@ function parseElementHandle(handle) {
45909
46142
  const scoped2 = parseScopedValue(rest);
45910
46143
  return scoped2 ? { scheme, ...scoped2, index: 0 } : null;
45911
46144
  }
45912
- const index = Number(rest.slice(indexAt + 1));
45913
- if (!Number.isInteger(index) || index < 0) {
46145
+ const index2 = Number(rest.slice(indexAt + 1));
46146
+ if (!Number.isInteger(index2) || index2 < 0) {
45914
46147
  const scoped2 = parseScopedValue(rest);
45915
46148
  return scoped2 ? { scheme, ...scoped2, index: 0 } : null;
45916
46149
  }
45917
46150
  const scoped = parseScopedValue(rest.slice(0, indexAt));
45918
- return scoped ? { scheme, ...scoped, index } : null;
46151
+ return scoped ? { scheme, ...scoped, index: index2 } : null;
45919
46152
  }
45920
46153
  function resolveElementHandle(doc, handle) {
45921
46154
  const parsed = parseElementHandle(handle);
@@ -46492,11 +46725,11 @@ function findSourceContextIndex(items, targetIndex) {
46492
46725
  const target = items[targetIndex];
46493
46726
  let contextIndex = targetIndex;
46494
46727
  let parentDepth = target.depth - 1;
46495
- for (let index = targetIndex - 1; index >= 0 && parentDepth >= 0; index--) {
46496
- const item = items[index];
46728
+ for (let index2 = targetIndex - 1; index2 >= 0 && parentDepth >= 0; index2--) {
46729
+ const item = items[index2];
46497
46730
  if (item.depth !== parentDepth) continue;
46498
46731
  if (item.sourceFile !== target.sourceFile) break;
46499
- contextIndex = index;
46732
+ contextIndex = index2;
46500
46733
  parentDepth -= 1;
46501
46734
  }
46502
46735
  return contextIndex;
@@ -46504,8 +46737,8 @@ function findSourceContextIndex(items, targetIndex) {
46504
46737
  function collectSourceContours(items, contextIndex, target) {
46505
46738
  const context = items[contextIndex];
46506
46739
  const contours = [];
46507
- for (let index = contextIndex + 1; index < items.length; index++) {
46508
- const item = items[index];
46740
+ for (let index2 = contextIndex + 1; index2 < items.length; index2++) {
46741
+ const item = items[index2];
46509
46742
  if (item.depth <= context.depth) break;
46510
46743
  if (item.sourceFile === target.sourceFile && item.element !== target.element) {
46511
46744
  contours.push(item.element);
@@ -46557,8 +46790,8 @@ function measureTopologyLensGeometry(input) {
46557
46790
  rect: fieldUsesContext ? measuredField : target
46558
46791
  },
46559
46792
  target: { label: elements.target.tagName.toLowerCase(), rect: target },
46560
- contours: measured.slice(contourOffset).map((rect, index) => ({
46561
- label: elements.contours[index].tagName.toLowerCase(),
46793
+ contours: measured.slice(contourOffset).map((rect, index2) => ({
46794
+ label: elements.contours[index2].tagName.toLowerCase(),
46562
46795
  rect
46563
46796
  })).filter((item) => isRenderableRect(item.rect))
46564
46797
  };
@@ -46720,7 +46953,7 @@ function TopologyLens({ iframeRef, activeCompositionPath }) {
46720
46953
  }
46721
46954
  ),
46722
46955
  (state.phase === "acquiring" || state.phase === "sealing") && /* @__PURE__ */ jsxs74(Fragment32, { children: [
46723
- geometry.contours.map(({ label, rect }, index) => /* @__PURE__ */ jsx107(
46956
+ geometry.contours.map(({ label, rect }, index2) => /* @__PURE__ */ jsx107(
46724
46957
  "div",
46725
46958
  {
46726
46959
  "data-topology-contour": "true",
@@ -46728,10 +46961,10 @@ function TopologyLens({ iframeRef, activeCompositionPath }) {
46728
46961
  className: "hf-topology-contour pointer-events-none absolute z-1 rounded-sm",
46729
46962
  style: {
46730
46963
  ...rectStyle(rect),
46731
- animationDelay: `${Math.min(index, 5) * 28}ms`
46964
+ animationDelay: `${Math.min(index2, 5) * 28}ms`
46732
46965
  }
46733
46966
  },
46734
- index
46967
+ index2
46735
46968
  )),
46736
46969
  !reducedMotion2 && /* @__PURE__ */ jsx107(
46737
46970
  "div",
@@ -46833,17 +47066,17 @@ function updateKeyframeCacheFromParsed(animations, targetPath, selectionId, muta
46833
47066
  const mutated = mutationSelector ? resolveSelectorElementIds(mutationSelector, doc) : [];
46834
47067
  const targetIds = mutated.length > 0 ? mutated : selectionId ? [selectionId] : [];
46835
47068
  publishKeyframeCache((draft) => {
46836
- for (const [id, entry2] of merged) {
46837
- writeElementIntoDraft(draft, targetPath, id, entry2, sourceAnimations.get(id));
47069
+ for (const [id, entry3] of merged) {
47070
+ writeElementIntoDraft(draft, targetPath, id, entry3, sourceAnimations.get(id));
46838
47071
  }
46839
47072
  for (const targetId of targetIds) {
46840
47073
  if (!idsWithKeyframes.has(targetId)) deleteElementFromDraft(draft, targetPath, targetId);
46841
47074
  }
46842
47075
  });
46843
47076
  }
46844
- function writeElementIntoDraft(draft, sourceFile, elementId2, entry2, animations) {
47077
+ function writeElementIntoDraft(draft, sourceFile, elementId2, entry3, animations) {
46845
47078
  for (const key2 of elementCacheKeys(sourceFile, elementId2)) {
46846
- draft.keyframeCache.set(key2, entry2);
47079
+ draft.keyframeCache.set(key2, entry3);
46847
47080
  if (animations) draft.gsapAnimations.set(key2, animations);
46848
47081
  else draft.gsapAnimations.delete(key2);
46849
47082
  }
@@ -46864,10 +47097,10 @@ function cachedElementIdsForFile(sourceFile, keyframeCache, gsapAnimations) {
46864
47097
  if (key2.startsWith(sfPrefix)) ids.add(key2.slice(sfPrefix.length));
46865
47098
  }
46866
47099
  if (sourceFile !== "index.html") return ids;
46867
- for (const [key2, entry2] of keyframeCache) {
47100
+ for (const [key2, entry3] of keyframeCache) {
46868
47101
  const hash = key2.indexOf("#");
46869
47102
  const id = key2.slice(hash + 1);
46870
- if (hash > 0 && !key2.startsWith(sfPrefix) && keyframeCache.get(sfPrefix + id) === entry2) {
47103
+ if (hash > 0 && !key2.startsWith(sfPrefix) && keyframeCache.get(sfPrefix + id) === entry3) {
46871
47104
  ids.delete(id);
46872
47105
  }
46873
47106
  }
@@ -46919,8 +47152,8 @@ function replaceKeyframeCacheForFile(sourceFile, entries, animationsByElement) {
46919
47152
  )) {
46920
47153
  deleteElementFromDraft(draft, sourceFile, id);
46921
47154
  }
46922
- for (const [id, entry2] of entries) {
46923
- writeElementIntoDraft(draft, sourceFile, id, entry2, animationsByElement.get(id));
47155
+ for (const [id, entry3] of entries) {
47156
+ writeElementIntoDraft(draft, sourceFile, id, entry3, animationsByElement.get(id));
46924
47157
  }
46925
47158
  });
46926
47159
  }
@@ -47842,8 +48075,8 @@ function MotionPathLine(props) {
47842
48075
  // src/utils/keyframeUsage.ts
47843
48076
  function keyframeUsageActions(mutations, semanticActions) {
47844
48077
  const actions = /* @__PURE__ */ new Set();
47845
- for (const [index, mutation] of mutations.entries()) {
47846
- const semanticAction = semanticActions?.[index];
48078
+ for (const [index2, mutation] of mutations.entries()) {
48079
+ const semanticAction = semanticActions?.[index2];
47847
48080
  if (semanticAction) {
47848
48081
  actions.add(semanticAction);
47849
48082
  continue;
@@ -47875,16 +48108,16 @@ function changedMutationIndices(result, count, options) {
47875
48108
  if (!Array.isArray(changes) || changes.length !== count || changes.some((value) => typeof value !== "boolean"))
47876
48109
  return [];
47877
48110
  return changes.flatMap(
47878
- (changed, index) => changed && options?.[index]?.keyframeTelemetry !== false ? [index] : []
48111
+ (changed, index2) => changed && options?.[index2]?.keyframeTelemetry !== false ? [index2] : []
47879
48112
  );
47880
48113
  }
47881
48114
  function trackKeyframeCommit(mutations, result, options, memberOptions) {
47882
48115
  if (!result.ok || result.changed !== true || options.keyframeTelemetry === false) return;
47883
48116
  const indices = changedMutationIndices(result, mutations.length, memberOptions);
47884
48117
  const actions = keyframeUsageActions(
47885
- indices.map((index) => mutations[index]),
48118
+ indices.map((index2) => mutations[index2]),
47886
48119
  indices.map(
47887
- (index) => memberOptions?.[index]?.keyframeAction ?? (mutations.length === 1 ? options.keyframeAction : void 0)
48120
+ (index2) => memberOptions?.[index2]?.keyframeAction ?? (mutations.length === 1 ? options.keyframeAction : void 0)
47888
48121
  )
47889
48122
  );
47890
48123
  const action = primaryKeyframeAction(actions);
@@ -47914,7 +48147,7 @@ function observeGsapGesture(writer) {
47914
48147
  result,
47915
48148
  calls.length,
47916
48149
  calls.map((call) => call.options)
47917
- ).map((index) => calls[index]);
48150
+ ).map((index2) => calls[index2]);
47918
48151
  for (const action of keyframeUsageActions(
47919
48152
  members.map((call) => call.mutation),
47920
48153
  members.map((call) => call.options.keyframeAction)
@@ -48271,9 +48504,9 @@ function commitNodeDrop(drop) {
48271
48504
  }
48272
48505
  return done.then(() => trackPreviewEditResult("motion_path", "drag", writes.finish()));
48273
48506
  }
48274
- function commitAddWaypoint(animationId, index, x, y, commit2) {
48507
+ function commitAddWaypoint(animationId, index2, x, y, commit2) {
48275
48508
  return commit2(
48276
- { type: "add-motion-path-point", animationId, index, x, y },
48509
+ { type: "add-motion-path-point", animationId, index: index2, x, y },
48277
48510
  motionPathCommitOptions("Add waypoint", "button")
48278
48511
  );
48279
48512
  }
@@ -48283,9 +48516,9 @@ function commitAddKeyframe(animationId, percentage, x, y, commit2) {
48283
48516
  motionPathCommitOptions("Add keyframe", "button")
48284
48517
  );
48285
48518
  }
48286
- function commitRemoveWaypoint(animationId, index, commit2) {
48519
+ function commitRemoveWaypoint(animationId, index2, commit2) {
48287
48520
  return commit2(
48288
- { type: "remove-motion-path-point", animationId, index },
48521
+ { type: "remove-motion-path-point", animationId, index: index2 },
48289
48522
  motionPathCommitOptions("Remove waypoint", "button")
48290
48523
  );
48291
48524
  }
@@ -48612,15 +48845,15 @@ var MotionPathOverlay = memo31(function MotionPathOverlay2({
48612
48845
  const top = vr ? vr.top : rect.top;
48613
48846
  return { x: (e.clientX - left) / scale, y: (e.clientY - top) / scale };
48614
48847
  };
48615
- const onDown = (e, index, x, y, ref) => {
48848
+ const onDown = (e, index2, x, y, ref) => {
48616
48849
  if (!interactive) return;
48617
48850
  if (e.button !== 0) return;
48618
48851
  e.stopPropagation();
48619
48852
  const live = readGsapPositionFromIframe(iframeRef.current, selectorFor(selection) ?? "");
48620
- if (pressControl(e, controlForNode(e, abs[index], live))) return;
48853
+ if (pressControl(e, controlForNode(e, abs[index2], live))) return;
48621
48854
  e.target.setPointerCapture(e.pointerId);
48622
48855
  dragRef.current = {
48623
- index,
48856
+ index: index2,
48624
48857
  startX: e.clientX,
48625
48858
  startY: e.clientY,
48626
48859
  initX: x,
@@ -48629,7 +48862,7 @@ var MotionPathOverlay = memo31(function MotionPathOverlay2({
48629
48862
  pScale,
48630
48863
  ref
48631
48864
  };
48632
- setDraft({ index, x, y });
48865
+ setDraft({ index: index2, x, y });
48633
48866
  };
48634
48867
  const onMove = (e) => {
48635
48868
  const d = dragRef.current;
@@ -48719,11 +48952,11 @@ var MotionPathOverlay = memo31(function MotionPathOverlay2({
48719
48952
  }
48720
48953
  setGhost(null);
48721
48954
  };
48722
- const onRemove = (e, index) => {
48955
+ const onRemove = (e, index2) => {
48723
48956
  e.stopPropagation();
48724
48957
  if (!animId) return;
48725
48958
  setHoverNode(null);
48726
- void commitRemoveWaypoint(animId, index, commitMutation);
48959
+ void commitRemoveWaypoint(animId, index2, commitMutation);
48727
48960
  };
48728
48961
  const elementId2 = selection?.id ?? null;
48729
48962
  const onNodeContextMenu = (e, ref) => {
@@ -50090,12 +50323,12 @@ function usePopulateKeyframeCacheForFile(projectId, sourceFile, version, iframeR
50090
50323
  if (isPosOnly) {
50091
50324
  continue;
50092
50325
  }
50093
- const entry2 = {
50326
+ const entry3 = {
50094
50327
  format: "percentage",
50095
50328
  keyframes: data.keyframes,
50096
50329
  ...data.easeEach ? { easeEach: data.easeEach } : {}
50097
50330
  };
50098
- for (const key2 of keys) draft.keyframeCache.set(key2, entry2);
50331
+ for (const key2 of keys) draft.keyframeCache.set(key2, entry3);
50099
50332
  }
50100
50333
  });
50101
50334
  runtimeScanDoneRef.current = `kf-cache:${projectId}:${sf}:${version}`;
@@ -51223,7 +51456,7 @@ async function studioSetStyle(deps, input, signal = new AbortController().signal
51223
51456
  );
51224
51457
  }
51225
51458
  const entries = Object.entries(styles).filter(
51226
- (entry2) => typeof entry2[1] === "string"
51459
+ (entry3) => typeof entry3[1] === "string"
51227
51460
  );
51228
51461
  if (entries.length === 0) {
51229
51462
  return preDispatchFailure(
@@ -52167,11 +52400,11 @@ function onTabKeyDown(event, tab, api) {
52167
52400
  const tabs = [
52168
52401
  ...tab.closest('[role="tablist"]')?.querySelectorAll('[role="tab"]') ?? []
52169
52402
  ];
52170
- const index = tabs.indexOf(tab);
52403
+ const index2 = tabs.indexOf(tab);
52171
52404
  const last = tabs.length - 1;
52172
52405
  const targets = {
52173
- ArrowRight: index === last ? 0 : index + 1,
52174
- ArrowLeft: index === 0 ? last : index - 1,
52406
+ ArrowRight: index2 === last ? 0 : index2 + 1,
52407
+ ArrowLeft: index2 === 0 ? last : index2 - 1,
52175
52408
  Home: 0,
52176
52409
  End: last
52177
52410
  };
@@ -53184,7 +53417,7 @@ var ImageThumbnail = memo36(function ImageThumbnail2({
53184
53417
  frameW,
53185
53418
  frameCount,
53186
53419
  watchGap: watchGap2,
53187
- children: (index) => /* @__PURE__ */ jsx118(
53420
+ children: (index2) => /* @__PURE__ */ jsx118(
53188
53421
  "div",
53189
53422
  {
53190
53423
  className: "relative h-full shrink-0 overflow-hidden bg-neutral-900",
@@ -53200,7 +53433,7 @@ var ImageThumbnail = memo36(function ImageThumbnail2({
53200
53433
  }
53201
53434
  )
53202
53435
  },
53203
- index
53436
+ index2
53204
53437
  )
53205
53438
  }
53206
53439
  ),
@@ -54231,14 +54464,14 @@ function splitCssFunctions(value) {
54231
54464
  const functions = [];
54232
54465
  let depth = 0;
54233
54466
  let start = 0;
54234
- for (let index = 0; index < source.length; index += 1) {
54235
- const char = source[index];
54467
+ for (let index2 = 0; index2 < source.length; index2 += 1) {
54468
+ const char = source[index2];
54236
54469
  if (char === "(") depth += 1;
54237
54470
  if (char === ")") depth = Math.max(0, depth - 1);
54238
54471
  if (/\s/.test(char) && depth === 0) {
54239
- const part = source.slice(start, index).trim();
54472
+ const part = source.slice(start, index2).trim();
54240
54473
  if (part) functions.push(part);
54241
- start = index + 1;
54474
+ start = index2 + 1;
54242
54475
  }
54243
54476
  }
54244
54477
  const lastPart = source.slice(start).trim();
@@ -54260,7 +54493,7 @@ function setCssFilterFunctionPx(value, name, nextPx) {
54260
54493
  const nextValue = clampPanelNumber(nextPx, 0, 200, 0);
54261
54494
  const functions = splitCssFunctions(value && value.trim() !== EMPTY_FILTER_VALUE ? value : "");
54262
54495
  const lowerName = name.toLowerCase();
54263
- const filtered = functions.filter((entry2) => !entry2.toLowerCase().startsWith(`${lowerName}(`));
54496
+ const filtered = functions.filter((entry3) => !entry3.toLowerCase().startsWith(`${lowerName}(`));
54264
54497
  if (nextValue > 0) filtered.push(`${name}(${formatNumericValue(nextValue)}px)`);
54265
54498
  return filtered.length > 0 ? filtered.join(" ") : EMPTY_FILTER_VALUE;
54266
54499
  }
@@ -54306,19 +54539,19 @@ function extractBackgroundImageUrl(value) {
54306
54539
  const lowerValue = value.toLowerCase();
54307
54540
  const urlStart = lowerValue.indexOf("url(");
54308
54541
  if (urlStart < 0) return "";
54309
- let index = urlStart + 4;
54310
- while (index < value.length && (value[index] === " " || value[index] === "\n" || value[index] === "\r" || value[index] === " " || value[index] === "\f")) {
54311
- index += 1;
54542
+ let index2 = urlStart + 4;
54543
+ while (index2 < value.length && (value[index2] === " " || value[index2] === "\n" || value[index2] === "\r" || value[index2] === " " || value[index2] === "\f")) {
54544
+ index2 += 1;
54312
54545
  }
54313
- const quote = value[index] === '"' || value[index] === "'" ? value[index] : null;
54546
+ const quote = value[index2] === '"' || value[index2] === "'" ? value[index2] : null;
54314
54547
  if (quote) {
54315
- index += 1;
54316
- const endQuote = value.indexOf(quote, index);
54317
- return endQuote >= index ? value.slice(index, endQuote) : "";
54548
+ index2 += 1;
54549
+ const endQuote = value.indexOf(quote, index2);
54550
+ return endQuote >= index2 ? value.slice(index2, endQuote) : "";
54318
54551
  }
54319
- const endParen = value.indexOf(")", index);
54320
- if (endParen < index) return "";
54321
- return value.slice(index, endParen).trim();
54552
+ const endParen = value.indexOf(")", index2);
54553
+ if (endParen < index2) return "";
54554
+ return value.slice(index2, endParen).trim();
54322
54555
  }
54323
54556
  var ALWAYS_READ_CHANNELS = [
54324
54557
  "x",
@@ -56501,9 +56734,9 @@ function stripPreviewAssetPath(src, projectId) {
56501
56734
  const projectMarker = `/api/projects/${encodeURIComponent(projectId)}/preview/`;
56502
56735
  const genericMarker = "/preview/";
56503
56736
  const marker = pathname.includes(projectMarker) ? projectMarker : genericMarker;
56504
- const index = pathname.indexOf(marker);
56505
- if (index < 0) return null;
56506
- const assetPath = decodeURIComponent(pathname.slice(index + marker.length)).replace(/^\/+/, "");
56737
+ const index2 = pathname.indexOf(marker);
56738
+ if (index2 < 0) return null;
56739
+ const assetPath = decodeURIComponent(pathname.slice(index2 + marker.length)).replace(/^\/+/, "");
56507
56740
  if (!assetPath || assetPath.startsWith("comp/")) return null;
56508
56741
  return assetPath;
56509
56742
  }
@@ -57884,7 +58117,7 @@ function FontFamilyField({
57884
58117
  const importLocalFont = async (family) => {
57885
58118
  if (!onImportFonts) return null;
57886
58119
  const candidates = localFontData.filter((f) => fontFamilyFromAssetPath(`${f.family}.ttf`) === family).sort((a, b) => localFontSortScore(a) - localFontSortScore(b));
57887
- const font = candidates.find((entry2) => typeof entry2.blob === "function");
58120
+ const font = candidates.find((entry3) => typeof entry3.blob === "function");
57888
58121
  if (!font?.blob) return null;
57889
58122
  const blob = await font.blob();
57890
58123
  const style = sanitizeFontFilePart(font.style ?? "Regular") || "Regular";
@@ -58013,13 +58246,13 @@ function FontFamilyField({
58013
58246
  )
58014
58247
  ] }),
58015
58248
  fontNotice && /* @__PURE__ */ jsx132("div", { className: "border-b border-neutral-800 px-3 py-2 text-[10px] leading-4 text-neutral-500", children: fontNotice }),
58016
- /* @__PURE__ */ jsx132("div", { className: "max-h-64 overflow-y-auto p-1", children: filteredOptions.length === 0 ? /* @__PURE__ */ jsx132("div", { className: "px-2 py-3 text-[11px] text-neutral-500", children: "No fonts found." }) : filteredOptions.map((option, index) => /* @__PURE__ */ jsxs94(
58249
+ /* @__PURE__ */ jsx132("div", { className: "max-h-64 overflow-y-auto p-1", children: filteredOptions.length === 0 ? /* @__PURE__ */ jsx132("div", { className: "px-2 py-3 text-[11px] text-neutral-500", children: "No fonts found." }) : filteredOptions.map((option, index2) => /* @__PURE__ */ jsxs94(
58017
58250
  "button",
58018
58251
  {
58019
58252
  type: "button",
58020
- "data-font-option-index": index,
58253
+ "data-font-option-index": index2,
58021
58254
  onClick: () => commitFamily(option),
58022
- className: `flex w-full min-w-0 items-center justify-between gap-3 rounded-lg px-2 py-2 text-left text-[11px] transition-colors ${index === activeIndex ? "bg-neutral-800 text-neutral-50" : option.family === currentFamily ? "bg-studio-accent/15 text-neutral-50" : "text-neutral-300 hover:bg-neutral-900 hover:text-neutral-100"}`,
58255
+ className: `flex w-full min-w-0 items-center justify-between gap-3 rounded-lg px-2 py-2 text-left text-[11px] transition-colors ${index2 === activeIndex ? "bg-neutral-800 text-neutral-50" : option.family === currentFamily ? "bg-studio-accent/15 text-neutral-50" : "text-neutral-300 hover:bg-neutral-900 hover:text-neutral-100"}`,
58023
58256
  children: [
58024
58257
  /* @__PURE__ */ jsxs94("span", { className: "flex min-w-0 items-center gap-1.5", children: [
58025
58258
  /* @__PURE__ */ jsx132("span", { className: "truncate font-medium", style: { fontFamily: `"${option.family}"` }, children: option.family }),
@@ -58647,20 +58880,20 @@ function isDigit(char) {
58647
58880
  }
58648
58881
  function isSimpleNumber(value) {
58649
58882
  if (!value) return false;
58650
- let index = value[0] === "-" ? 1 : 0;
58883
+ let index2 = value[0] === "-" ? 1 : 0;
58651
58884
  let digits = 0;
58652
- while (isDigit(value[index])) {
58653
- index += 1;
58885
+ while (isDigit(value[index2])) {
58886
+ index2 += 1;
58654
58887
  digits += 1;
58655
58888
  }
58656
- if (value[index] === ".") {
58657
- index += 1;
58658
- while (isDigit(value[index])) {
58659
- index += 1;
58889
+ if (value[index2] === ".") {
58890
+ index2 += 1;
58891
+ while (isDigit(value[index2])) {
58892
+ index2 += 1;
58660
58893
  digits += 1;
58661
58894
  }
58662
58895
  }
58663
- return digits > 0 && index === value.length;
58896
+ return digits > 0 && index2 === value.length;
58664
58897
  }
58665
58898
  function parseCssNumber(value) {
58666
58899
  if (!value) return null;
@@ -58744,9 +58977,9 @@ function normalizeStops(stops) {
58744
58977
  { color: stops[0].color, position: 100 }
58745
58978
  ];
58746
58979
  }
58747
- const result = stops.map((stop2, index) => ({
58980
+ const result = stops.map((stop2, index2) => ({
58748
58981
  color: stop2.color,
58749
- position: stop2.position ?? index / (stops.length - 1) * 100
58982
+ position: stop2.position ?? index2 / (stops.length - 1) * 100
58750
58983
  }));
58751
58984
  return result.map((stop2) => ({
58752
58985
  color: stop2.color,
@@ -59171,8 +59404,8 @@ function GradientField({
59171
59404
  const parsed = parseGradient(value) ?? buildDefaultGradientModel(fallbackColor);
59172
59405
  const commit2 = (next) => onCommit(serializeGradient(next));
59173
59406
  const patch = (partial) => commit2({ ...parsed, ...partial });
59174
- const updateStop = (index, partial) => {
59175
- const stops = parsed.stops.map((stop2, i) => i === index ? { ...stop2, ...partial } : stop2);
59407
+ const updateStop = (index2, partial) => {
59408
+ const stops = parsed.stops.map((stop2, i) => i === index2 ? { ...stop2, ...partial } : stop2);
59176
59409
  commit2({ ...parsed, stops });
59177
59410
  };
59178
59411
  const addStop = (position) => {
@@ -59183,10 +59416,10 @@ function GradientField({
59183
59416
  track2("button", "Add gradient stop");
59184
59417
  commit2(nextGradient);
59185
59418
  };
59186
- const removeStop = (index) => {
59419
+ const removeStop = (index2) => {
59187
59420
  if (parsed.stops.length <= 2) return;
59188
- track2("button", `Remove gradient stop ${index + 1}`);
59189
- commit2({ ...parsed, stops: parsed.stops.filter((_, i) => i !== index) });
59421
+ track2("button", `Remove gradient stop ${index2 + 1}`);
59422
+ commit2({ ...parsed, stops: parsed.stops.filter((_, i) => i !== index2) });
59190
59423
  };
59191
59424
  const previewStyle = { backgroundImage: serializeGradient(parsed) };
59192
59425
  return /* @__PURE__ */ jsxs99("div", { className: "space-y-4", children: [
@@ -59203,12 +59436,12 @@ function GradientField({
59203
59436
  if (!rect || rect.width <= 0) return;
59204
59437
  addStop((event.clientX - rect.left) / rect.width * 100);
59205
59438
  },
59206
- children: parsed.stops.map((stop2, index) => /* @__PURE__ */ jsx138(
59439
+ children: parsed.stops.map((stop2, index2) => /* @__PURE__ */ jsx138(
59207
59440
  "div",
59208
59441
  {
59209
59442
  role: "slider",
59210
59443
  tabIndex: disabled ? -1 : 0,
59211
- "aria-label": `Stop ${index + 1} position`,
59444
+ "aria-label": `Stop ${index2 + 1} position`,
59212
59445
  "aria-valuenow": Math.round(stop2.position),
59213
59446
  "aria-valuemin": 0,
59214
59447
  "aria-valuemax": 100,
@@ -59218,7 +59451,7 @@ function GradientField({
59218
59451
  event.preventDefault();
59219
59452
  const step = event.shiftKey ? 10 : 1;
59220
59453
  const delta = event.key === "ArrowRight" ? step : -step;
59221
- updateStop(index, {
59454
+ updateStop(index2, {
59222
59455
  position: Math.max(0, Math.min(100, Math.round(stop2.position + delta)))
59223
59456
  });
59224
59457
  },
@@ -59241,7 +59474,7 @@ function GradientField({
59241
59474
  0,
59242
59475
  Math.min(100, (event.clientX - rect.left) / rect.width * 100)
59243
59476
  );
59244
- updateStop(index, { position: Math.round(next * 10) / 10 });
59477
+ updateStop(index2, { position: Math.round(next * 10) / 10 });
59245
59478
  },
59246
59479
  onPointerUp: (event) => {
59247
59480
  event.currentTarget.releasePointerCapture(event.pointerId);
@@ -59250,7 +59483,7 @@ function GradientField({
59250
59483
  event.currentTarget.releasePointerCapture(event.pointerId);
59251
59484
  }
59252
59485
  },
59253
- `stop-preview-${index}`
59486
+ `stop-preview-${index2}`
59254
59487
  ))
59255
59488
  }
59256
59489
  ),
@@ -59402,7 +59635,7 @@ function GradientField({
59402
59635
  }
59403
59636
  )
59404
59637
  ] }),
59405
- /* @__PURE__ */ jsx138("div", { className: "space-y-3", children: parsed.stops.map((stop2, index) => /* @__PURE__ */ jsxs99(
59638
+ /* @__PURE__ */ jsx138("div", { className: "space-y-3", children: parsed.stops.map((stop2, index2) => /* @__PURE__ */ jsxs99(
59406
59639
  "div",
59407
59640
  {
59408
59641
  className: "grid min-w-0 grid-cols-[minmax(0,1fr)_68px_28px] gap-2",
@@ -59410,10 +59643,10 @@ function GradientField({
59410
59643
  /* @__PURE__ */ jsx138(
59411
59644
  ColorField,
59412
59645
  {
59413
- label: `Stop ${index + 1}`,
59646
+ label: `Stop ${index2 + 1}`,
59414
59647
  value: stop2.color,
59415
59648
  disabled,
59416
- onCommit: (next) => updateStop(index, { color: next })
59649
+ onCommit: (next) => updateStop(index2, { color: next })
59417
59650
  }
59418
59651
  ),
59419
59652
  /* @__PURE__ */ jsx138(
@@ -59422,7 +59655,7 @@ function GradientField({
59422
59655
  label: "Pos",
59423
59656
  value: `${Math.round(stop2.position)}%`,
59424
59657
  disabled,
59425
- onCommit: (next) => updateStop(index, {
59658
+ onCommit: (next) => updateStop(index2, {
59426
59659
  position: Number.parseFloat(next.replace("%", "")) || 0
59427
59660
  })
59428
59661
  }
@@ -59432,15 +59665,15 @@ function GradientField({
59432
59665
  {
59433
59666
  type: "button",
59434
59667
  disabled: disabled || parsed.stops.length <= 2,
59435
- onClick: () => removeStop(index),
59668
+ onClick: () => removeStop(index2),
59436
59669
  className: "mt-[22px] flex h-10 items-center justify-center rounded-lg border border-neutral-700 bg-neutral-950 text-neutral-400 transition-colors hover:border-neutral-600 hover:text-text-0 disabled:cursor-not-allowed disabled:text-text-off",
59437
- "aria-label": `Remove stop ${index + 1}`,
59670
+ "aria-label": `Remove stop ${index2 + 1}`,
59438
59671
  children: /* @__PURE__ */ jsx138(X, { size: 12 })
59439
59672
  }
59440
59673
  )
59441
59674
  ]
59442
59675
  },
59443
- `stop-editor-${index}`
59676
+ `stop-editor-${index2}`
59444
59677
  )) })
59445
59678
  ] })
59446
59679
  ] });
@@ -60104,11 +60337,11 @@ function detectAvailableWeights(fontFamily) {
60104
60337
  if (!fonts) return ALL_WEIGHTS;
60105
60338
  const family = fontFamily.split(",")[0]?.trim().replace(/['"]/g, "");
60106
60339
  if (!family) return ALL_WEIGHTS;
60107
- const available = [];
60340
+ const available2 = [];
60108
60341
  for (const w of ALL_WEIGHTS) {
60109
- if (fonts.check(`${w} 16px "${family}"`)) available.push(w);
60342
+ if (fonts.check(`${w} 16px "${family}"`)) available2.push(w);
60110
60343
  }
60111
- return available.length > 0 ? available : ALL_WEIGHTS;
60344
+ return available2.length > 0 ? available2 : ALL_WEIGHTS;
60112
60345
  }
60113
60346
  function TextAreaField({
60114
60347
  label,
@@ -60483,7 +60716,7 @@ function TextSection({
60483
60716
  }
60484
60717
  )
60485
60718
  ] }),
60486
- /* @__PURE__ */ jsx141("div", { className: "grid gap-2", children: textFields.map((field, index) => {
60719
+ /* @__PURE__ */ jsx141("div", { className: "grid gap-2", children: textFields.map((field, index2) => {
60487
60720
  const active = field.key === activeField.key;
60488
60721
  return /* @__PURE__ */ jsx141(
60489
60722
  "button",
@@ -60500,7 +60733,7 @@ function TextSection({
60500
60733
  style: { backgroundColor: getTextFieldColor(field, styles) }
60501
60734
  }
60502
60735
  ),
60503
- /* @__PURE__ */ jsx141("span", { className: "min-w-0 truncate text-[11px] font-medium text-neutral-100", children: formatTextFieldPreview(field.value) || `Text ${index + 1}` })
60736
+ /* @__PURE__ */ jsx141("span", { className: "min-w-0 truncate text-[11px] font-medium text-neutral-100", children: formatTextFieldPreview(field.value) || `Text ${index2 + 1}` })
60504
60737
  ] }),
60505
60738
  /* @__PURE__ */ jsx141("span", { className: "shrink-0 rounded-md border border-neutral-700 bg-neutral-950 px-1.5 py-0.5 text-[10px] text-neutral-500", children: field.tagName })
60506
60739
  ] })
@@ -61014,7 +61247,7 @@ function PropertyRow({
61014
61247
  }
61015
61248
  function AddPropertyTrigger({
61016
61249
  adding,
61017
- available,
61250
+ available: available2,
61018
61251
  addLabel,
61019
61252
  addTitle,
61020
61253
  onAdd,
@@ -61022,7 +61255,7 @@ function AddPropertyTrigger({
61022
61255
  onClose,
61023
61256
  buttonClassName
61024
61257
  }) {
61025
- if (adding && available.length > 0) {
61258
+ if (adding && available2.length > 0) {
61026
61259
  return /* @__PURE__ */ jsxs106(
61027
61260
  "select",
61028
61261
  {
@@ -61036,12 +61269,12 @@ function AddPropertyTrigger({
61036
61269
  onBlur: onClose,
61037
61270
  children: [
61038
61271
  /* @__PURE__ */ jsx145("option", { value: "", disabled: true, children: "Choose property\u2026" }),
61039
- available.map((p) => /* @__PURE__ */ jsx145("option", { value: p, children: PROP_LABELS[p] ?? p }, p))
61272
+ available2.map((p) => /* @__PURE__ */ jsx145("option", { value: p, children: PROP_LABELS[p] ?? p }, p))
61040
61273
  ]
61041
61274
  }
61042
61275
  );
61043
61276
  }
61044
- if (available.length === 0) return null;
61277
+ if (available2.length === 0) return null;
61045
61278
  return /* @__PURE__ */ jsx145("button", { type: "button", onClick: onOpen, className: buttonClassName, title: addTitle, children: addLabel });
61046
61279
  }
61047
61280
  function parseNumericOrString(raw) {
@@ -61409,7 +61642,7 @@ var AnimationCard = memo39(function AnimationCard2({
61409
61642
  enabled,
61410
61643
  segments: animation2.arcPath?.segments
61411
61644
  }),
61412
- onUpdateSegment: (index, update) => onUpdateArcSegment?.(animation2.id, index, update),
61645
+ onUpdateSegment: (index2, update) => onUpdateArcSegment?.(animation2.id, index2, update),
61413
61646
  onToggleAutoRotate: (autoRotate) => onSetArcPath(animation2.id, {
61414
61647
  enabled: true,
61415
61648
  autoRotate,
@@ -61615,13 +61848,13 @@ function GsapAnimationList({
61615
61848
  }, [focusedHere]);
61616
61849
  return /* @__PURE__ */ jsxs109("div", { className: "space-y-2", children: [
61617
61850
  animations.length === 0 && /* @__PURE__ */ jsx148("p", { className: "text-[11px] leading-4 text-neutral-500", children: "No animations on this element yet. Add an effect below to animate it." }),
61618
- animations.map((animation2, index) => /* @__PURE__ */ createElement2(
61851
+ animations.map((animation2, index2) => /* @__PURE__ */ createElement2(
61619
61852
  AnimationCard,
61620
61853
  {
61621
61854
  ...trackedCallbacks,
61622
61855
  key: animation2.id,
61623
61856
  animation: animation2,
61624
- defaultExpanded: index === 0,
61857
+ defaultExpanded: index2 === 0,
61625
61858
  flat: variant === "flat",
61626
61859
  focusedSegment: focusedHere?.animationId === animation2.id ? focusedHere : null,
61627
61860
  onFocusSegmentConsumed: consumeFocusedEaseSegment
@@ -62807,7 +63040,7 @@ function FlatSegmentedRow({
62807
63040
  const track2 = useTrackDesignInput();
62808
63041
  return /* @__PURE__ */ jsxs116("div", { className: "flex min-h-[32px] items-center justify-between", children: [
62809
63042
  /* @__PURE__ */ jsx156("span", { className: "text-[11px] text-panel-text-3", children: label }),
62810
- /* @__PURE__ */ jsx156("span", { className: "flex items-center gap-0.5", children: options.map((option, index) => /* @__PURE__ */ jsxs116("span", { className: "flex items-center", children: [
63043
+ /* @__PURE__ */ jsx156("span", { className: "flex items-center gap-0.5", children: options.map((option, index2) => /* @__PURE__ */ jsxs116("span", { className: "flex items-center", children: [
62811
63044
  /* @__PURE__ */ jsx156(
62812
63045
  "button",
62813
63046
  {
@@ -62824,7 +63057,7 @@ function FlatSegmentedRow({
62824
63057
  children: option.node
62825
63058
  }
62826
63059
  ),
62827
- spacerAfterIndex === index && /* @__PURE__ */ jsx156("span", { className: "w-3", "aria-hidden": "true" })
63060
+ spacerAfterIndex === index2 && /* @__PURE__ */ jsx156("span", { className: "w-3", "aria-hidden": "true" })
62828
63061
  ] }, option.key)) })
62829
63062
  ] });
62830
63063
  }
@@ -63437,7 +63670,7 @@ function FlatTextLayerList({
63437
63670
  const track2 = useTrackDesignInput();
63438
63671
  return /* @__PURE__ */ jsxs117("div", { className: "mb-2 border-l-2 border-panel-border-input py-0.5 pl-[10px]", children: [
63439
63672
  /* @__PURE__ */ jsx158("div", { className: "mb-1.5 text-[9px] font-semibold uppercase tracking-[0.12em] text-panel-text-5", children: "Text layers" }),
63440
- /* @__PURE__ */ jsx158("div", { className: "space-y-1", children: fields.map((field, index) => {
63673
+ /* @__PURE__ */ jsx158("div", { className: "space-y-1", children: fields.map((field, index2) => {
63441
63674
  const active = field.key === activeFieldKey;
63442
63675
  return /* @__PURE__ */ jsxs117(
63443
63676
  "div",
@@ -63454,7 +63687,7 @@ function FlatTextLayerList({
63454
63687
  style: { backgroundColor: getTextFieldColor(field, styles) }
63455
63688
  }
63456
63689
  ),
63457
- /* @__PURE__ */ jsx158("span", { className: "min-w-0 flex-1 truncate text-[11px] text-panel-text-1", children: formatTextFieldPreview(field.value) || `Text ${index + 1}` }),
63690
+ /* @__PURE__ */ jsx158("span", { className: "min-w-0 flex-1 truncate text-[11px] text-panel-text-1", children: formatTextFieldPreview(field.value) || `Text ${index2 + 1}` }),
63458
63691
  /* @__PURE__ */ jsx158("span", { className: "shrink-0 font-mono text-[9px] text-panel-text-4", children: field.tagName }),
63459
63692
  fields.length > 1 && /* @__PURE__ */ jsx158(
63460
63693
  "button",
@@ -64546,11 +64779,11 @@ function audioFxRevealTarget(target, chain) {
64546
64779
  if (parsed.kind === "volume") return { kind: "volume" };
64547
64780
  if (parsed.kind === "rate") return null;
64548
64781
  if (parsed.kind === "preset") {
64549
- const index2 = (chain?.nodes ?? []).findIndex((node2) => node2.fromPreset === parsed.presetId);
64550
- return index2 >= 0 ? { kind: "preset", runKey: `${parsed.presetId}-${index2}` } : null;
64782
+ const index3 = (chain?.nodes ?? []).findIndex((node2) => node2.fromPreset === parsed.presetId);
64783
+ return index3 >= 0 ? { kind: "preset", runKey: `${parsed.presetId}-${index3}` } : null;
64551
64784
  }
64552
- const index = (chain?.nodes ?? []).findIndex((node2) => node2.id === parsed.nodeId);
64553
- const node = index >= 0 ? chain?.nodes[index] : void 0;
64785
+ const index2 = (chain?.nodes ?? []).findIndex((node2) => node2.id === parsed.nodeId);
64786
+ const node = index2 >= 0 ? chain?.nodes[index2] : void 0;
64554
64787
  if (!node) return null;
64555
64788
  if (node.fromCarve) return { kind: "carve" };
64556
64789
  if (node.fromEq) return { kind: "eq", eqId: node.fromEq };
@@ -64558,7 +64791,7 @@ function audioFxRevealTarget(target, chain) {
64558
64791
  const first = (chain?.nodes ?? []).findIndex((n) => n.fromPreset === node.fromPreset);
64559
64792
  return { kind: "preset", runKey: `${node.fromPreset}-${first}` };
64560
64793
  }
64561
- return { kind: "node", index, nodeId: parsed.nodeId };
64794
+ return { kind: "node", index: index2, nodeId: parsed.nodeId };
64562
64795
  }
64563
64796
  function revealRowSelector(where) {
64564
64797
  if (!where) return null;
@@ -64853,8 +65086,8 @@ function fxFamilyOf(node) {
64853
65086
  function fxFamilyTint(node) {
64854
65087
  const family = fxFamilyOf(node);
64855
65088
  const siblings = HF_AUDIO_FX.filter((def) => fxFamilyOf({ type: def.id }) === family);
64856
- const index = siblings.findIndex((def) => def.id === node.type);
64857
- const step = siblings.length > 1 ? Math.max(0, index) / (siblings.length - 1) : 0;
65089
+ const index2 = siblings.findIndex((def) => def.id === node.type);
65090
+ const step = siblings.length > 1 ? Math.max(0, index2) / (siblings.length - 1) : 0;
64858
65091
  return `hsl(${FAMILY_HUE[family]}, 32%, ${(62 + step * 14).toFixed(1)}%)`;
64859
65092
  }
64860
65093
 
@@ -65561,7 +65794,7 @@ function automatedKeysOf(node, params, automatedTargets) {
65561
65794
  function FxNodeParams({
65562
65795
  node,
65563
65796
  def,
65564
- index,
65797
+ index: index2,
65565
65798
  disabled,
65566
65799
  automatedTargets,
65567
65800
  liveAutomationValues,
@@ -65589,7 +65822,7 @@ function FxNodeParams({
65589
65822
  params: node.params ?? defaultAudioFxParams3(node.type),
65590
65823
  liveValues,
65591
65824
  disabled,
65592
- onChange: (params) => onPreview(index, params),
65825
+ onChange: (params) => onPreview(index2, params),
65593
65826
  onCommit: (next) => {
65594
65827
  const before = node.params ?? defaultAudioFxParams3(node.type);
65595
65828
  for (const [key2, value] of Object.entries(next)) {
@@ -65598,7 +65831,7 @@ function FxNodeParams({
65598
65831
  trackParamCommitted(node.type, key2, value, "details", { trackKind });
65599
65832
  trackInput(typeof value === "number" ? "slider" : "select", key2);
65600
65833
  }
65601
- onUpdate(index, { params: next });
65834
+ onUpdate(index2, { params: next });
65602
65835
  },
65603
65836
  automatedKeys: automatedKeysOf(node, def.params, automatedTargets),
65604
65837
  onAutomate: nodeId && onAutomateParam ? (key2) => {
@@ -65622,7 +65855,7 @@ function FxNodeDerivedKnob({
65622
65855
  disabled,
65623
65856
  bypassed,
65624
65857
  params,
65625
- index,
65858
+ index: index2,
65626
65859
  onPreview,
65627
65860
  onUpdate,
65628
65861
  trackKind
@@ -65636,10 +65869,10 @@ function FxNodeDerivedKnob({
65636
65869
  param: derived,
65637
65870
  value: audioFxProfileStrength(node.type, params),
65638
65871
  disabled: Boolean(disabled) || bypassed,
65639
- onChange: (_k, v) => onPreview(index, applyAudioFxProfile(node.type, Number(v), params)),
65872
+ onChange: (_k, v) => onPreview(index2, applyAudioFxProfile(node.type, Number(v), params)),
65640
65873
  onCommit: (_k, v) => {
65641
65874
  trackProfileCommitted(node.type, Number(v), { trackKind });
65642
- onUpdate(index, { params: applyAudioFxProfile(node.type, Number(v), params) });
65875
+ onUpdate(index2, { params: applyAudioFxProfile(node.type, Number(v), params) });
65643
65876
  trackInput("slider", "profile-strength");
65644
65877
  }
65645
65878
  }
@@ -65656,7 +65889,7 @@ function FxNodePrimaryKnob({
65656
65889
  primary,
65657
65890
  copy,
65658
65891
  params,
65659
- index,
65892
+ index: index2,
65660
65893
  disabled,
65661
65894
  bypassed,
65662
65895
  automatedTargets,
@@ -65674,7 +65907,7 @@ function FxNodePrimaryKnob({
65674
65907
  {
65675
65908
  node,
65676
65909
  def: onlyPrimary,
65677
- index,
65910
+ index: index2,
65678
65911
  disabled: Boolean(disabled) || bypassed,
65679
65912
  automatedTargets,
65680
65913
  liveAutomationValues,
@@ -65705,7 +65938,7 @@ function FxNodeOpenBody({
65705
65938
  onToggleDetails,
65706
65939
  copy,
65707
65940
  params,
65708
- index,
65941
+ index: index2,
65709
65942
  disabled,
65710
65943
  bypassed,
65711
65944
  automatedTargets,
@@ -65727,7 +65960,7 @@ function FxNodeOpenBody({
65727
65960
  disabled,
65728
65961
  bypassed,
65729
65962
  params,
65730
- index,
65963
+ index: index2,
65731
65964
  onPreview,
65732
65965
  onUpdate,
65733
65966
  trackKind
@@ -65741,7 +65974,7 @@ function FxNodeOpenBody({
65741
65974
  primary,
65742
65975
  copy,
65743
65976
  params,
65744
- index,
65977
+ index: index2,
65745
65978
  disabled,
65746
65979
  bypassed,
65747
65980
  automatedTargets,
@@ -65775,7 +66008,7 @@ function FxNodeOpenBody({
65775
66008
  {
65776
66009
  node,
65777
66010
  def,
65778
- index,
66011
+ index: index2,
65779
66012
  disabled: Boolean(disabled) || bypassed,
65780
66013
  automatedTargets,
65781
66014
  liveAutomationValues,
@@ -65913,7 +66146,7 @@ function FxNodeHeader({
65913
66146
  }
65914
66147
  function FxNodeRow({
65915
66148
  node,
65916
- index,
66149
+ index: index2,
65917
66150
  position,
65918
66151
  automatedTargets,
65919
66152
  liveAutomationValues,
@@ -65963,17 +66196,17 @@ function FxNodeRow({
65963
66196
  label: node.label ?? EFFECT_COPY[node.type]?.title ?? registryDef.label,
65964
66197
  open: open2,
65965
66198
  bypassed,
65966
- first: index === 0,
66199
+ first: index2 === 0,
65967
66200
  last,
65968
66201
  disabled,
65969
66202
  onToggleOpen,
65970
66203
  onToggleBypass: () => {
65971
66204
  trackNodeBypassed(node.type, !bypassed, { trackKind });
65972
- onUpdate(index, { enabled: bypassed });
66205
+ onUpdate(index2, { enabled: bypassed });
65973
66206
  trackInput("toggle", "effect-bypass");
65974
66207
  },
65975
- onMove: (delta) => onMove(index, delta),
65976
- onRemove: () => onRemove(index)
66208
+ onMove: (delta) => onMove(index2, delta),
66209
+ onRemove: () => onRemove(index2)
65977
66210
  }
65978
66211
  ),
65979
66212
  summary ? /* @__PURE__ */ jsx170(
@@ -65999,7 +66232,7 @@ function FxNodeRow({
65999
66232
  onToggleDetails: () => setDetails((was) => !was),
66000
66233
  copy,
66001
66234
  params,
66002
- index,
66235
+ index: index2,
66003
66236
  disabled,
66004
66237
  bypassed,
66005
66238
  automatedTargets,
@@ -66520,9 +66753,9 @@ function FxSection({
66520
66753
  [chain, onChainChange, trackInput]
66521
66754
  );
66522
66755
  const previewNode = useCallback90(
66523
- (index, params) => onChainPreview?.({
66756
+ (index2, params) => onChainPreview?.({
66524
66757
  ...chain,
66525
- nodes: chain.nodes.map((n, i) => i === index ? { ...n, params } : n)
66758
+ nodes: chain.nodes.map((n, i) => i === index2 ? { ...n, params } : n)
66526
66759
  }),
66527
66760
  [chain, onChainPreview]
66528
66761
  );
@@ -66563,7 +66796,7 @@ function FxSection({
66563
66796
  [chain, mutate, clearAudition, trackKind]
66564
66797
  );
66565
66798
  const updateNode = useCallback90(
66566
- (index, patch) => mutate(chain.nodes.map((n, i) => i === index ? { ...n, ...patch } : n)),
66799
+ (index2, patch) => mutate(chain.nodes.map((n, i) => i === index2 ? { ...n, ...patch } : n)),
66567
66800
  [chain.nodes, mutate]
66568
66801
  );
66569
66802
  const setRunAmount = useCallback90(
@@ -66593,13 +66826,13 @@ function FxSection({
66593
66826
  [chain.nodes, mutate, onRemoveNodesAutomation, trackKind]
66594
66827
  );
66595
66828
  const removeNode = useCallback90(
66596
- (index) => {
66597
- const removed = chain.nodes[index];
66829
+ (index2) => {
66830
+ const removed = chain.nodes[index2];
66598
66831
  const removedId = removed?.id;
66599
66832
  if (removedId) onRemoveNodeAutomation?.(removedId);
66600
66833
  if (removed) trackNodeRemoved(removed.type, nodeOrigin(removed), { trackKind });
66601
66834
  mutate(
66602
- chain.nodes.filter((_, i) => i !== index),
66835
+ chain.nodes.filter((_, i) => i !== index2),
66603
66836
  "remove-effect"
66604
66837
  );
66605
66838
  setOpenNode(null);
@@ -66683,11 +66916,11 @@ function FxSection({
66683
66916
  [chain, mutate, onRemoveNodesAutomation]
66684
66917
  );
66685
66918
  const moveNode = useCallback90(
66686
- (index, delta) => {
66687
- const target = index + delta;
66919
+ (index2, delta) => {
66920
+ const target = index2 + delta;
66688
66921
  if (target < 0 || target >= chain.nodes.length) return;
66689
66922
  const next = [...chain.nodes];
66690
- const [moved] = next.splice(index, 1);
66923
+ const [moved] = next.splice(index2, 1);
66691
66924
  next.splice(target, 0, moved);
66692
66925
  if (moved) trackNodeMoved(moved.type, delta < 0 ? "up" : "down", { trackKind });
66693
66926
  mutate(next, "move-effect");
@@ -68014,10 +68247,10 @@ function valueFromPointer(clientX, clientY, rect, tab) {
68014
68247
  };
68015
68248
  }
68016
68249
  function curvePath(samples, tab) {
68017
- return [...samples].map((sample, index) => {
68018
- const input = tab.kind === "rgb" ? index / (samples.length - 1) : index / samples.length * 360;
68250
+ return [...samples].map((sample, index2) => {
68251
+ const input = tab.kind === "rgb" ? index2 / (samples.length - 1) : index2 / samples.length * 360;
68019
68252
  const point = graphPoint(input, sample, tab);
68020
- return `${index === 0 ? "M" : "L"}${point.x.toFixed(2)},${point.y.toFixed(2)}`;
68253
+ return `${index2 === 0 ? "M" : "L"}${point.x.toFixed(2)},${point.y.toFixed(2)}`;
68021
68254
  }).join(" ");
68022
68255
  }
68023
68256
  function samplesFor(points, tab) {
@@ -68053,10 +68286,10 @@ function nearestInputPointIndex(points, input, tab) {
68053
68286
  const inputSpan = tab.kind === "rgb" ? 1 : 360;
68054
68287
  let closest = -1;
68055
68288
  let distance = 12 / (GRAPH_SIZE - GRAPH_PADDING * 2);
68056
- points.forEach((point, index) => {
68289
+ points.forEach((point, index2) => {
68057
68290
  const nextDistance = (tab.kind === "hue" ? circularHueDistance(point[0], input) : Math.abs(point[0] - input)) / inputSpan;
68058
68291
  if (nextDistance < distance) {
68059
- closest = index;
68292
+ closest = index2;
68060
68293
  distance = nextDistance;
68061
68294
  }
68062
68295
  });
@@ -68066,12 +68299,12 @@ function nearestGraphPointIndex(points, input, output, tab) {
68066
68299
  const target = graphPoint(input, output, tab);
68067
68300
  let closest = -1;
68068
68301
  let distance = 12;
68069
- points.forEach((point, index) => {
68302
+ points.forEach((point, index2) => {
68070
68303
  const candidate = graphPoint(point[0], point[1], tab);
68071
68304
  const xDistance = tab.kind === "hue" ? circularHueDistance(point[0], input) / 360 * (GRAPH_SIZE - GRAPH_PADDING * 2) : candidate.x - target.x;
68072
68305
  const nextDistance = Math.hypot(xDistance, candidate.y - target.y);
68073
68306
  if (nextDistance < distance) {
68074
- closest = index;
68307
+ closest = index2;
68075
68308
  distance = nextDistance;
68076
68309
  }
68077
68310
  });
@@ -68094,37 +68327,37 @@ function insertPoint(points, input, output, tab) {
68094
68327
  next.sort((a, b) => a[0] - b[0]);
68095
68328
  return { points: next, selected: next.indexOf(point) };
68096
68329
  }
68097
- function safeRgbInput(points, index, input) {
68098
- if (index === 0) return 0;
68099
- if (index === points.length - 1) return 1;
68330
+ function safeRgbInput(points, index2, input) {
68331
+ if (index2 === 0) return 0;
68332
+ if (index2 === points.length - 1) return 1;
68100
68333
  return clampNumber(
68101
68334
  input,
68102
- (points[index - 1]?.[0] ?? 0) + INPUT_EPSILON,
68103
- (points[index + 1]?.[0] ?? 1) - INPUT_EPSILON
68335
+ (points[index2 - 1]?.[0] ?? 0) + INPUT_EPSILON,
68336
+ (points[index2 + 1]?.[0] ?? 1) - INPUT_EPSILON
68104
68337
  );
68105
68338
  }
68106
- function hueInputCollides(points, index, input) {
68339
+ function hueInputCollides(points, index2, input) {
68107
68340
  return points.some(
68108
- (point, pointIndex) => pointIndex !== index && circularHueDistance(point[0], input) < INPUT_EPSILON * 360
68341
+ (point, pointIndex) => pointIndex !== index2 && circularHueDistance(point[0], input) < INPUT_EPSILON * 360
68109
68342
  );
68110
68343
  }
68111
- function safeHueInput(points, index, input) {
68344
+ function safeHueInput(points, index2, input) {
68112
68345
  const initial = clampNumber(input, 0, 359.999);
68113
- if (!hueInputCollides(points, index, initial)) return initial;
68346
+ if (!hueInputCollides(points, index2, initial)) return initial;
68114
68347
  const spacing = INPUT_EPSILON * 360;
68115
68348
  for (let step = 1; step <= points.length + 1; step += 1) {
68116
68349
  const clockwise = (initial + spacing * step) % 360;
68117
- if (!hueInputCollides(points, index, clockwise)) return clockwise;
68350
+ if (!hueInputCollides(points, index2, clockwise)) return clockwise;
68118
68351
  const counterClockwise = (initial - spacing * step + 360) % 360;
68119
- if (!hueInputCollides(points, index, counterClockwise)) return counterClockwise;
68352
+ if (!hueInputCollides(points, index2, counterClockwise)) return counterClockwise;
68120
68353
  }
68121
68354
  return initial;
68122
68355
  }
68123
- function movePoint(points, index, input, output, tab) {
68356
+ function movePoint(points, index2, input, output, tab) {
68124
68357
  const next = [...points];
68125
- const safeInput = tab.kind === "rgb" ? safeRgbInput(next, index, input) : safeHueInput(next, index, input);
68358
+ const safeInput = tab.kind === "rgb" ? safeRgbInput(next, index2, input) : safeHueInput(next, index2, input);
68126
68359
  const moved = tab.kind === "rgb" ? [safeInput, clampNumber(output, 0, 1)] : [safeInput, clampNumber(output, tab.min, tab.max)];
68127
- next[index] = moved;
68360
+ next[index2] = moved;
68128
68361
  next.sort((a, b) => a[0] - b[0]);
68129
68362
  return { points: next, selected: next.indexOf(moved) };
68130
68363
  }
@@ -68273,19 +68506,19 @@ function CurveGraph({
68273
68506
  event.currentTarget.getBoundingClientRect(),
68274
68507
  tab
68275
68508
  );
68276
- let index = nearestGraphPointIndex(points, value.input, value.output, tab);
68509
+ let index2 = nearestGraphPointIndex(points, value.input, value.output, tab);
68277
68510
  let nextPoints = points;
68278
- if (index < 0) {
68511
+ if (index2 < 0) {
68279
68512
  const inserted = insertPoint(points, value.input, value.output, tab);
68280
68513
  if (!inserted) return;
68281
68514
  nextPoints = inserted.points;
68282
- index = inserted.selected;
68515
+ index2 = inserted.selected;
68283
68516
  }
68284
68517
  event.currentTarget.setPointerCapture(event.pointerId);
68285
- pointerRef.current = { pointerId: event.pointerId, index, points: nextPoints };
68518
+ pointerRef.current = { pointerId: event.pointerId, index: index2, points: nextPoints };
68286
68519
  onBegin();
68287
- onSelect(index);
68288
- const moved = movePoint(nextPoints, index, value.input, value.output, tab);
68520
+ onSelect(index2);
68521
+ const moved = movePoint(nextPoints, index2, value.input, value.output, tab);
68289
68522
  pointerRef.current.index = moved.selected;
68290
68523
  pointerRef.current.points = moved.points;
68291
68524
  onPreview(moved.points, moved.selected);
@@ -68365,20 +68598,20 @@ function CurveGraph({
68365
68598
  strokeWidth: "1.5"
68366
68599
  }
68367
68600
  ),
68368
- points.map(([input, output], index) => {
68601
+ points.map(([input, output], index2) => {
68369
68602
  const point = graphPoint(input, output, tab);
68370
68603
  return /* @__PURE__ */ jsx178(
68371
68604
  "circle",
68372
68605
  {
68373
- "data-color-curve-point": index,
68606
+ "data-color-curve-point": index2,
68374
68607
  cx: point.x,
68375
68608
  cy: point.y,
68376
- r: selectedIndex === index ? 3.5 : 2.5,
68377
- fill: selectedIndex === index ? "#fff" : tab.color,
68609
+ r: selectedIndex === index2 ? 3.5 : 2.5,
68610
+ fill: selectedIndex === index2 ? "#fff" : tab.color,
68378
68611
  stroke: "#111",
68379
68612
  strokeWidth: "1"
68380
68613
  },
68381
- `${input}-${index}`
68614
+ `${input}-${index2}`
68382
68615
  );
68383
68616
  })
68384
68617
  ]
@@ -68524,7 +68757,7 @@ function ColorCurves({
68524
68757
  if (selectedIndex === null) return;
68525
68758
  if (tab.kind === "rgb" && (selectedIndex === 0 || selectedIndex === points.length - 1)) return;
68526
68759
  transaction.cancel();
68527
- const nextPoints = tab.kind === "hue" && points.length <= 3 ? [] : points.filter((_, index) => index !== selectedIndex);
68760
+ const nextPoints = tab.kind === "hue" && points.length <= 3 ? [] : points.filter((_, index2) => index2 !== selectedIndex);
68528
68761
  const next = withPoints(draft, tab, nextPoints);
68529
68762
  setDraft(next);
68530
68763
  setSelectedIndex(null);
@@ -68878,8 +69111,8 @@ function drawHistogram(context, analysis, width, height) {
68878
69111
  const maximum = maximumDensity(analysis.histogram);
68879
69112
  context.beginPath();
68880
69113
  context.moveTo(0, height);
68881
- analysis.histogram.forEach((count, index) => {
68882
- context.lineTo(index / 255 * width, height - densityAlpha(count, maximum) * height);
69114
+ analysis.histogram.forEach((count, index2) => {
69115
+ context.lineTo(index2 / 255 * width, height - densityAlpha(count, maximum) * height);
68883
69116
  });
68884
69117
  context.lineTo(width, height);
68885
69118
  context.closePath();
@@ -68892,7 +69125,7 @@ function drawDensity(context, density, columnOffset, columnCount, color, xOffset
68892
69125
  let maximum = 0;
68893
69126
  const start = columnOffset * 256;
68894
69127
  const end = (columnOffset + columnCount) * 256;
68895
- for (let index = start; index < end; index += 1) maximum = Math.max(maximum, density[index] ?? 0);
69128
+ for (let index2 = start; index2 < end; index2 += 1) maximum = Math.max(maximum, density[index2] ?? 0);
68896
69129
  context.fillStyle = `rgb(${color.join(" ")})`;
68897
69130
  for (let x = 0; x < columnCount; x += 1) {
68898
69131
  for (let y = 0; y < 256; y += 1) {
@@ -69126,7 +69359,7 @@ function PropertyPanelColorSecondary({
69126
69359
  }, [sampleFrame, samplePixels, selected, showMatte]);
69127
69360
  const replaceSelected = (next) => {
69128
69361
  if (!selected) return;
69129
- onCommit(secondaries.map((secondary, index) => index === activeIndex ? next : secondary));
69362
+ onCommit(secondaries.map((secondary, index2) => index2 === activeIndex ? next : secondary));
69130
69363
  };
69131
69364
  const addSecondary = () => {
69132
69365
  if (secondaries.length >= SECONDARY_CAPABILITIES.max) return;
@@ -69135,7 +69368,7 @@ function PropertyPanelColorSecondary({
69135
69368
  };
69136
69369
  const removeSelected = () => {
69137
69370
  if (!selected) return;
69138
- const next = secondaries.filter((_, index) => index !== activeIndex);
69371
+ const next = secondaries.filter((_, index2) => index2 !== activeIndex);
69139
69372
  onCommit(next);
69140
69373
  setSelectedIndex(Math.max(0, Math.min(activeIndex, next.length - 1)));
69141
69374
  setSampleFrame(null);
@@ -69144,21 +69377,21 @@ function PropertyPanelColorSecondary({
69144
69377
  };
69145
69378
  return /* @__PURE__ */ jsxs139("div", { className: "space-y-1.5", "data-flat-grade-secondary": "true", children: [
69146
69379
  /* @__PURE__ */ jsxs139("div", { className: "flex items-center justify-between gap-2", children: [
69147
- /* @__PURE__ */ jsx182("span", { className: "flex items-center gap-1", children: secondaries.map((_, index) => /* @__PURE__ */ jsx182(
69380
+ /* @__PURE__ */ jsx182("span", { className: "flex items-center gap-1", children: secondaries.map((_, index2) => /* @__PURE__ */ jsx182(
69148
69381
  "button",
69149
69382
  {
69150
69383
  type: "button",
69151
- "aria-pressed": activeIndex === index,
69384
+ "aria-pressed": activeIndex === index2,
69152
69385
  onClick: () => {
69153
- setSelectedIndex(index);
69386
+ setSelectedIndex(index2);
69154
69387
  setSampleFrame(null);
69155
69388
  setSamplePixels(null);
69156
69389
  setCaptureError(null);
69157
69390
  },
69158
- className: `h-6 min-w-6 border-b-2 px-1 font-mono text-[10px] ${activeIndex === index ? "border-panel-accent text-panel-text-0" : "border-transparent text-panel-text-4 hover:text-panel-text-2"}`,
69159
- children: index + 1
69391
+ className: `h-6 min-w-6 border-b-2 px-1 font-mono text-[10px] ${activeIndex === index2 ? "border-panel-accent text-panel-text-0" : "border-transparent text-panel-text-4 hover:text-panel-text-2"}`,
69392
+ children: index2 + 1
69160
69393
  },
69161
- index
69394
+ index2
69162
69395
  )) }),
69163
69396
  /* @__PURE__ */ jsxs139("span", { className: "flex items-center gap-2", children: [
69164
69397
  /* @__PURE__ */ jsx182(
@@ -70373,7 +70606,7 @@ function enumOptions(key2, labels) {
70373
70606
  const first = control?.min ?? 0;
70374
70607
  const count = (control?.max ?? labels.length - 1) - first + 1;
70375
70608
  if (labels.length !== count) throw new Error(`${key2} labels do not match Core capabilities`);
70376
- return labels.map((label, index) => ({ value: String(first + index), label }));
70609
+ return labels.map((label, index2) => ({ value: String(first + index2), label }));
70377
70610
  }
70378
70611
  var ASCII_STYLES = enumOptions("asciiStyle", [
70379
70612
  "Standard",
@@ -70770,7 +71003,7 @@ function FlatEffectsSection({
70770
71003
  const palette = grading.palette;
70771
71004
  return /* @__PURE__ */ jsxs143("div", { "data-flat-effects-palette": "true", className: "space-y-2 py-1", children: [
70772
71005
  /* @__PURE__ */ jsx187("div", { className: "grid grid-cols-3 gap-1", children: HF_COLOR_GRADING_PALETTES.map((preset) => {
70773
- const selected = palette?.length === preset.colors.length && palette.every((color, index) => color === preset.colors[index]);
71006
+ const selected = palette?.length === preset.colors.length && palette.every((color, index2) => color === preset.colors[index2]);
70774
71007
  return /* @__PURE__ */ jsxs143(
70775
71008
  "button",
70776
71009
  {
@@ -70821,16 +71054,16 @@ function FlatEffectsSection({
70821
71054
  )
70822
71055
  ] }),
70823
71056
  /* @__PURE__ */ jsxs143("div", { className: "flex flex-wrap items-center gap-1.5", children: [
70824
- palette.map((color, index) => /* @__PURE__ */ jsxs143("span", { className: "group/swatch relative", children: [
71057
+ palette.map((color, index2) => /* @__PURE__ */ jsxs143("span", { className: "group/swatch relative", children: [
70825
71058
  /* @__PURE__ */ jsx187(
70826
71059
  "input",
70827
71060
  {
70828
71061
  type: "color",
70829
- "aria-label": `Palette color ${index + 1}`,
71062
+ "aria-label": `Palette color ${index2 + 1}`,
70830
71063
  value: color,
70831
71064
  onChange: (event) => {
70832
71065
  const nextPalette = [...palette];
70833
- nextPalette[index] = event.target.value;
71066
+ nextPalette[index2] = event.target.value;
70834
71067
  onCommitColorGrading({ ...grading, palette: nextPalette });
70835
71068
  },
70836
71069
  className: "h-6 w-6 cursor-pointer rounded-xs border border-panel-border-input bg-transparent p-0"
@@ -70840,16 +71073,16 @@ function FlatEffectsSection({
70840
71073
  "button",
70841
71074
  {
70842
71075
  type: "button",
70843
- "aria-label": `Remove palette color ${index + 1}`,
71076
+ "aria-label": `Remove palette color ${index2 + 1}`,
70844
71077
  onClick: () => onCommitColorGrading({
70845
71078
  ...grading,
70846
- palette: palette.filter((_, colorIndex) => colorIndex !== index)
71079
+ palette: palette.filter((_, colorIndex) => colorIndex !== index2)
70847
71080
  }),
70848
71081
  className: "absolute -right-1 -top-1 hidden h-3.5 w-3.5 items-center justify-center rounded-full bg-panel-bg text-panel-text-2 shadow-sm group-hover/swatch:flex",
70849
71082
  children: /* @__PURE__ */ jsx187(X, { size: 8 })
70850
71083
  }
70851
71084
  )
70852
- ] }, `${index}-${color}`)),
71085
+ ] }, `${index2}-${color}`)),
70853
71086
  palette.length < 6 && /* @__PURE__ */ jsx187(
70854
71087
  "button",
70855
71088
  {
@@ -75151,20 +75384,20 @@ function buildOverrides(model) {
75151
75384
  for (const segId of group.segmentIds) {
75152
75385
  const seg = model.segments.get(segId);
75153
75386
  if (seg && Object.keys(seg.style).length > 0) {
75154
- const entry2 = { wordIndex: globalWordIndex };
75155
- if (seg.wordId) entry2.wordId = seg.wordId;
75387
+ const entry3 = { wordIndex: globalWordIndex };
75388
+ if (seg.wordId) entry3.wordId = seg.wordId;
75156
75389
  const s = seg.style;
75157
- if (s.x !== void 0) entry2.x = s.x;
75158
- if (s.y !== void 0) entry2.y = s.y;
75159
- if (s.scaleX !== void 0) entry2.scale = s.scaleX;
75160
- if (s.rotation !== void 0) entry2.rotation = s.rotation;
75161
- if (s.activeColor !== void 0) entry2.activeColor = s.activeColor;
75162
- if (s.dimColor !== void 0) entry2.dimColor = s.dimColor;
75163
- if (s.opacity !== void 0) entry2.opacity = s.opacity;
75164
- if (s.fontSize !== void 0) entry2.fontSize = s.fontSize;
75165
- if (s.fontWeight !== void 0) entry2.fontWeight = s.fontWeight;
75166
- if (s.fontFamily !== void 0) entry2.fontFamily = s.fontFamily;
75167
- entries.push(entry2);
75390
+ if (s.x !== void 0) entry3.x = s.x;
75391
+ if (s.y !== void 0) entry3.y = s.y;
75392
+ if (s.scaleX !== void 0) entry3.scale = s.scaleX;
75393
+ if (s.rotation !== void 0) entry3.rotation = s.rotation;
75394
+ if (s.activeColor !== void 0) entry3.activeColor = s.activeColor;
75395
+ if (s.dimColor !== void 0) entry3.dimColor = s.dimColor;
75396
+ if (s.opacity !== void 0) entry3.opacity = s.opacity;
75397
+ if (s.fontSize !== void 0) entry3.fontSize = s.fontSize;
75398
+ if (s.fontWeight !== void 0) entry3.fontWeight = s.fontWeight;
75399
+ if (s.fontFamily !== void 0) entry3.fontFamily = s.fontFamily;
75400
+ entries.push(entry3);
75168
75401
  }
75169
75402
  globalWordIndex++;
75170
75403
  }
@@ -75342,16 +75575,16 @@ function createOwnHistory() {
75342
75575
  noteClaim: (id) => {
75343
75576
  claimed = { count: claimed.count + 1, id };
75344
75577
  },
75345
- stepped: (entry2) => {
75346
- if (entry2.undoes) undoneIds.add(entry2.undoes);
75578
+ stepped: (entry3) => {
75579
+ if (entry3.undoes) undoneIds.add(entry3.undoes);
75347
75580
  if (undoneIds.size > OWN_ENTRIES_KEPT) undoneIds.delete(undoneIds.values().next().value);
75348
- const undone = entry2.undoes ? own.get(entry2.undoes) : void 0;
75581
+ const undone = entry3.undoes ? own.get(entry3.undoes) : void 0;
75349
75582
  if (!undone) return;
75350
75583
  const swapped = Object.entries(undone).map(([path, f]) => [
75351
75584
  path,
75352
75585
  { before: f.after, after: f.before }
75353
75586
  ]);
75354
- remember(entry2.id, Object.fromEntries(swapped));
75587
+ remember(entry3.id, Object.fromEntries(swapped));
75355
75588
  },
75356
75589
  afterOf: (id) => Object.fromEntries(Object.entries(id && own.get(id) || {}).map(([p, f]) => [p, f.after])),
75357
75590
  predict: (direction) => {
@@ -75433,8 +75666,8 @@ async function restoredFiles(paths, previous, readFile) {
75433
75666
  );
75434
75667
  }
75435
75668
  function redoneAt(view) {
75436
- const undo = view.entries.find((entry2) => entry2.id === view.forward?.id);
75437
- return view.entries.find((entry2) => entry2.id === undo?.undoes)?.endedAt ?? null;
75669
+ const undo = view.entries.find((entry3) => entry3.id === view.forward?.id);
75670
+ return view.entries.find((entry3) => entry3.id === undo?.undoes)?.endedAt ?? null;
75438
75671
  }
75439
75672
  function usePersistentEditHistory({ projectId }) {
75440
75673
  const [view, setView] = useState115(EMPTY3);
@@ -76149,11 +76382,11 @@ function useFileManager({
76149
76382
  showToast(`Skipped (too large): ${data.skipped.join(", ")}`);
76150
76383
  }
76151
76384
  if (data.invalid?.length) {
76152
- const why = data.invalid.map((entry2) => `${entry2.name} (${entry2.reason})`).join(", ");
76385
+ const why = data.invalid.map((entry3) => `${entry3.name} (${entry3.reason})`).join(", ");
76153
76386
  showToast(`Not added: ${why}`);
76154
76387
  }
76155
76388
  if (data.unchecked?.length) {
76156
- const names = data.unchecked.map((entry2) => entry2.name).join(", ");
76389
+ const names = data.unchecked.map((entry3) => entry3.name).join(", ");
76157
76390
  showToast(`Added ${names}, ${data.unchecked[0].reason}`, "info");
76158
76391
  }
76159
76392
  await refreshFileTree();
@@ -76476,7 +76709,7 @@ function syncStaleEditMarks(doc, file) {
76476
76709
  }
76477
76710
  function hasAmbiguousGsapScriptChange(previousScripts, restoredScripts) {
76478
76711
  if (previousScripts.length <= 1 && restoredScripts.length <= 1) return false;
76479
- return previousScripts.length !== restoredScripts.length || previousScripts.some((script, index) => script !== restoredScripts[index]);
76712
+ return previousScripts.length !== restoredScripts.length || previousScripts.some((script, index2) => script !== restoredScripts[index2]);
76480
76713
  }
76481
76714
  function restoreScripted(prevDoc, nextDoc, isActive) {
76482
76715
  const [before, after] = [prevDoc, nextDoc].map(
@@ -77228,16 +77461,16 @@ import { useCallback as useCallback109 } from "react";
77228
77461
 
77229
77462
  // src/utils/timelineDropTrackInsert.ts
77230
77463
  function planDropTrackInsert(input) {
77231
- const { elements, trackOrder, insertRow, dropped } = input;
77464
+ const { elements, trackOrder, insertRow, dropped: dropped2 } = input;
77232
77465
  const newElement = {
77233
- ...dropped,
77234
- key: dropped.id,
77466
+ ...dropped2,
77467
+ key: dropped2.id,
77235
77468
  // Parked on an existing lane so it adds no lane of its own to the topology.
77236
77469
  track: elements[0]?.track ?? 0,
77237
77470
  // sameSourceFile compares this raw field: borrow the peers' value, not the resolved path.
77238
77471
  sourceFile: elements[0]?.sourceFile
77239
77472
  };
77240
- const layout = layoutAfterTrackInsert(newElement, dropped.start, insertRow, null, {
77473
+ const layout = layoutAfterTrackInsert(newElement, dropped2.start, insertRow, null, {
77241
77474
  elements: [...elements, newElement],
77242
77475
  trackOrder: [...trackOrder]
77243
77476
  });
@@ -77246,13 +77479,13 @@ function planDropTrackInsert(input) {
77246
77479
  const renumbers = [];
77247
77480
  for (const norm of layout.normalized) {
77248
77481
  const key2 = norm.key ?? norm.id;
77249
- if (key2 === dropped.id) continue;
77482
+ if (key2 === dropped2.id) continue;
77250
77483
  const src = byKey.get(key2);
77251
77484
  if (!src || norm.track === (src.authoredTrack ?? src.track)) continue;
77252
77485
  if (!canMoveTimelineElement(src)) return null;
77253
77486
  renumbers.push({ element: src, track: norm.track });
77254
77487
  }
77255
- const track2 = layout.normalized.find((n) => (n.key ?? n.id) === dropped.id)?.track;
77488
+ const track2 = layout.normalized.find((n) => (n.key ?? n.id) === dropped2.id)?.track;
77256
77489
  return track2 == null ? null : { track: track2, renumbers };
77257
77490
  }
77258
77491
  function applyTrackRenumbers(source, plan) {
@@ -77270,27 +77503,27 @@ function applyTrackRenumbers(source, plan) {
77270
77503
  }
77271
77504
  return out;
77272
77505
  }
77273
- function resolveRowDrop(elements, placed, lane, dropped) {
77274
- const audio = isAudioTimelineElement(dropped);
77506
+ function resolveRowDrop(elements, placed, lane, dropped2) {
77507
+ const audio = isAudioTimelineElement(dropped2);
77275
77508
  const row = elements.filter((e) => e.track === lane);
77276
77509
  const otherKindRow = row.length > 0 && !row.some((e) => isAudioTimelineElement(e) === audio);
77277
- const asClip = { ...dropped, key: dropped.id, track: lane, sourceFile: elements[0]?.sourceFile };
77510
+ const asClip = { ...dropped2, key: dropped2.id, track: lane, sourceFile: elements[0]?.sourceFile };
77278
77511
  const track2 = otherKindRow ? lane : authoredTrackForLane(lane, elements, asClip);
77279
77512
  const onTrack = [...elements, ...placed].filter((e) => isAudioTimelineElement(e) === audio && (e.authoredTrack ?? e.track) === track2).map((e) => ({ ...e, track: track2 }));
77280
77513
  return {
77281
77514
  track: track2,
77282
- start: resolveNearestFreeStart(onTrack, track2, dropped.start, dropped.duration, null)
77515
+ start: resolveNearestFreeStart(onTrack, track2, dropped2.start, dropped2.duration, null)
77283
77516
  };
77284
77517
  }
77285
77518
  function resolveDropTrack(input) {
77286
- const { source, elements, placement, dropped } = input;
77519
+ const { source, elements, placement, dropped: dropped2 } = input;
77287
77520
  if (placement.insertRow == null) {
77288
- return { source, ...resolveRowDrop(elements, input.placed ?? [], placement.track, dropped) };
77521
+ return { source, ...resolveRowDrop(elements, input.placed ?? [], placement.track, dropped2) };
77289
77522
  }
77290
77523
  const { insertRow, trackOrder } = placement;
77291
- const plan = planDropTrackInsert({ elements, trackOrder, insertRow, dropped });
77524
+ const plan = planDropTrackInsert({ elements, trackOrder, insertRow, dropped: dropped2 });
77292
77525
  if (!plan) throw new Error("Cannot open a new track here: a locked clip would have to move.");
77293
- return { source: applyTrackRenumbers(source, plan), track: plan.track, start: dropped.start };
77526
+ return { source: applyTrackRenumbers(source, plan), track: plan.track, start: dropped2.start };
77294
77527
  }
77295
77528
 
77296
77529
  // src/utils/timelineCompositionInsert.ts
@@ -77359,8 +77592,8 @@ function selectAndRevealTimelineElement(key2) {
77359
77592
  }
77360
77593
 
77361
77594
  // src/hooks/useTimelineAssetDropOps.ts
77362
- function fileDropPlacement(index, next, dropped, previous) {
77363
- if (index === 0) return { ...dropped, ...next };
77595
+ function fileDropPlacement(index2, next, dropped2, previous) {
77596
+ if (index2 === 0) return { ...dropped2, ...next };
77364
77597
  return previous ? { start: previous.start + previous.duration, track: previous.track } : next;
77365
77598
  }
77366
77599
  function timelineDropTarget(sourceFile, placement) {
@@ -77529,17 +77762,17 @@ function useTimelineAssetDropOps({
77529
77762
  durations
77530
77763
  );
77531
77764
  const gesture = { placed: [], onNewTrack: false };
77532
- for (const [index, assetPath] of uploaded.entries()) {
77533
- const next = placements[index] ?? placements[0];
77765
+ for (const [index2, assetPath] of uploaded.entries()) {
77766
+ const next = placements[index2] ?? placements[0];
77534
77767
  const clip = await dropAssetAt(
77535
77768
  assetPath,
77536
- fileDropPlacement(index, next, placement, gesture.placed.at(-1)),
77537
- durations[index],
77769
+ fileDropPlacement(index2, next, placement, gesture.placed.at(-1)),
77770
+ durations[index2],
77538
77771
  gesture
77539
77772
  );
77540
77773
  if (!clip) continue;
77541
77774
  gesture.placed.push(clip);
77542
- if (index === 0 && placement?.insertRow != null) gesture.onNewTrack = true;
77775
+ if (index2 === 0 && placement?.insertRow != null) gesture.onNewTrack = true;
77543
77776
  }
77544
77777
  },
77545
77778
  [
@@ -78360,17 +78593,17 @@ function useTimelineEditGuard(canEdit, showToast) {
78360
78593
  cached5.onRefused = onRefused;
78361
78594
  return cached5.wrapped;
78362
78595
  }
78363
- const entry2 = {};
78364
- entry2.resolveTargets = resolveTargets;
78365
- entry2.onRefused = onRefused;
78366
- entry2.wrapped = ((...args) => {
78367
- const reason = refuseEditRef.current(entry2.resolveTargets(...args));
78596
+ const entry3 = {};
78597
+ entry3.resolveTargets = resolveTargets;
78598
+ entry3.onRefused = onRefused;
78599
+ entry3.wrapped = ((...args) => {
78600
+ const reason = refuseEditRef.current(entry3.resolveTargets(...args));
78368
78601
  if (reason !== null)
78369
- return Promise.resolve(entry2.onRefused?.(reason, ...args));
78602
+ return Promise.resolve(entry3.onRefused?.(reason, ...args));
78370
78603
  return fn(...args);
78371
78604
  });
78372
- guardedRef.current.set(key2, entry2);
78373
- return entry2.wrapped;
78605
+ guardedRef.current.set(key2, entry3);
78606
+ return entry3.wrapped;
78374
78607
  },
78375
78608
  []
78376
78609
  );
@@ -80059,18 +80292,18 @@ function domEditSelectionsEqual(a, b) {
80059
80292
  }
80060
80293
  function domEditSelectionInGroup(group, selection) {
80061
80294
  if (!selection) return false;
80062
- return group.some((entry2) => domEditSelectionsTargetSame(entry2, selection));
80295
+ return group.some((entry3) => domEditSelectionsTargetSame(entry3, selection));
80063
80296
  }
80064
80297
  function toggleDomEditGroupSelection(group, selection) {
80065
80298
  if (domEditSelectionInGroup(group, selection)) {
80066
- return group.filter((entry2) => !domEditSelectionsTargetSame(entry2, selection));
80299
+ return group.filter((entry3) => !domEditSelectionsTargetSame(entry3, selection));
80067
80300
  }
80068
80301
  return [...group, selection];
80069
80302
  }
80070
80303
  function replaceDomEditGroupSelection(group, selection) {
80071
80304
  let replaced = false;
80072
- const nextGroup = group.map((entry2) => {
80073
- if (!domEditSelectionsTargetSame(entry2, selection)) return entry2;
80305
+ const nextGroup = group.map((entry3) => {
80306
+ if (!domEditSelectionsTargetSame(entry3, selection)) return entry3;
80074
80307
  replaced = true;
80075
80308
  return selection;
80076
80309
  });
@@ -80974,7 +81207,7 @@ function describeBatchPatchTarget(patch) {
80974
81207
  return patch.target.id ?? patch.target.hfId ?? patch.target.selector ?? "(unaddressed)";
80975
81208
  }
80976
81209
  function reportUnmatchedBatchPatches(batch, matched) {
80977
- const unmatchedIds = batch.patches.filter((_, index) => matched[index] === false).map(describeBatchPatchTarget);
81210
+ const unmatchedIds = batch.patches.filter((_, index2) => matched[index2] === false).map(describeBatchPatchTarget);
80978
81211
  if (unmatchedIds.length === 0) return;
80979
81212
  console.warn(
80980
81213
  `[studio] z-index reorder: server could not match ${unmatchedIds.length} patch target(s) in ${batch.sourceFile} (the whole z-order gesture will revert on reload):`,
@@ -81015,8 +81248,8 @@ async function patchElementBatches(projectId, batches) {
81015
81248
  if (typeof result !== "object" || result === null || !("durable" in result) || typeof result.durable !== "boolean" || !("files" in result) || !Array.isArray(result.files) || result.files.length !== batches.length || !result.files.every(isAtomicElementPatchFile) || !result.durable && result.files.some((file) => file.changed)) {
81016
81249
  throw new StudioSaveHttpError("Invalid atomic element patch response", 502);
81017
81250
  }
81018
- const files = result.files.map((file, index) => {
81019
- const batch = batches[index];
81251
+ const files = result.files.map((file, index2) => {
81252
+ const batch = batches[index2];
81020
81253
  const matched = file.matched ?? [];
81021
81254
  if (!batch || file.sourceFile !== batch.sourceFile || matched.length !== 0 && matched.length !== batch.patches.length) {
81022
81255
  throw new StudioSaveHttpError("Invalid atomic element patch response", 502);
@@ -81322,7 +81555,7 @@ function refreshTimelineRowText(el) {
81322
81555
 
81323
81556
  // src/hooks/domEditTextFieldCommitOps.ts
81324
81557
  function hasSameKeysInSamePositions(originalFields, nextFields) {
81325
- return originalFields.every((field, index) => nextFields[index]?.key === field.key);
81558
+ return originalFields.every((field, index2) => nextFields[index2]?.key === field.key);
81326
81559
  }
81327
81560
  function inlineStyleValue(styles, property) {
81328
81561
  return Object.prototype.hasOwnProperty.call(styles, property) ? styles[property] : null;
@@ -81589,13 +81822,13 @@ function useDomEditAttributeCommits({
81589
81822
  iframe?.contentDocument,
81590
81823
  selection,
81591
81824
  activeCompPath,
81592
- entries.map((entry2) => entry2.fullAttr)
81825
+ entries.map((entry3) => entry3.fullAttr)
81593
81826
  );
81594
81827
  },
81595
81828
  apply: () => {
81596
81829
  if (!captured) return;
81597
- for (const entry2 of entries) {
81598
- setOrRemovePreviewAttribute(captured.element, entry2.fullAttr, entry2.value);
81830
+ for (const entry3 of entries) {
81831
+ setOrRemovePreviewAttribute(captured.element, entry3.fullAttr, entry3.value);
81599
81832
  }
81600
81833
  },
81601
81834
  persist: () => persistDomEditOperations(selection, ops, {
@@ -81607,11 +81840,11 @@ function useDomEditAttributeCommits({
81607
81840
  shouldRevert: (error) => isLatestCommit() && !(error instanceof DomEditPersistPreparedWriteError),
81608
81841
  revert: () => {
81609
81842
  if (!captured) return;
81610
- for (const entry2 of entries) {
81843
+ for (const entry3 of entries) {
81611
81844
  setOrRemovePreviewAttribute(
81612
81845
  captured.element,
81613
- entry2.fullAttr,
81614
- captured.previousValues.get(entry2.fullAttr) ?? null
81846
+ entry3.fullAttr,
81847
+ captured.previousValues.get(entry3.fullAttr) ?? null
81615
81848
  );
81616
81849
  }
81617
81850
  },
@@ -82055,7 +82288,7 @@ function useDomEditTextCommits({
82055
82288
  const handleDomTextFieldStyleCommit = useCallback130(
82056
82289
  async (fieldKey, property, value) => {
82057
82290
  if (!domEditSelection) return;
82058
- const field = domEditSelection.textFields.find((entry2) => entry2.key === fieldKey);
82291
+ const field = domEditSelection.textFields.find((entry3) => entry3.key === fieldKey);
82059
82292
  if (!field) return;
82060
82293
  if (field.source === "self") {
82061
82294
  await handleDomStyleCommit(property, value);
@@ -82071,17 +82304,17 @@ function useDomEditTextCommits({
82071
82304
  }
82072
82305
  }
82073
82306
  const nextTextFields = domEditSelection.textFields.map(
82074
- (entry2) => entry2.key === fieldKey ? {
82075
- ...entry2,
82307
+ (entry3) => entry3.key === fieldKey ? {
82308
+ ...entry3,
82076
82309
  inlineStyles: {
82077
- ...entry2.inlineStyles,
82310
+ ...entry3.inlineStyles,
82078
82311
  [property]: normalizedValue
82079
82312
  },
82080
82313
  computedStyles: {
82081
- ...entry2.computedStyles,
82314
+ ...entry3.computedStyles,
82082
82315
  [property]: normalizedValue
82083
82316
  }
82084
- } : entry2
82317
+ } : entry3
82085
82318
  );
82086
82319
  await commitDomTextFields(domEditSelection, nextTextFields, { importedFont });
82087
82320
  },
@@ -82116,13 +82349,13 @@ function useDomEditTextCommits({
82116
82349
  const handleDomRemoveTextField = useCallback130(
82117
82350
  async (fieldKey) => {
82118
82351
  if (!domEditSelection) return;
82119
- const field = domEditSelection.textFields.find((entry2) => entry2.key === fieldKey);
82352
+ const field = domEditSelection.textFields.find((entry3) => entry3.key === fieldKey);
82120
82353
  if (!field) return;
82121
82354
  if (field.source === "self") {
82122
82355
  await handleDomTextCommit("", fieldKey);
82123
82356
  return;
82124
82357
  }
82125
- const nextTextFields = domEditSelection.textFields.filter((entry2) => entry2.key !== fieldKey);
82358
+ const nextTextFields = domEditSelection.textFields.filter((entry3) => entry3.key !== fieldKey);
82126
82359
  await commitDomTextFields(domEditSelection, nextTextFields);
82127
82360
  },
82128
82361
  [commitDomTextFields, domEditSelection, handleDomTextCommit]
@@ -83970,12 +84203,12 @@ function applyPreviewSync(iframe, result, options, reloadPreview, nestedFiles) {
83970
84203
  if (patches.length > 0) {
83971
84204
  const deferSeek = options.deferPreviewSync === true;
83972
84205
  const missed = patches.find(
83973
- (patch, index) => !patchRuntimeTweenInPlace(
84206
+ (patch, index2) => !patchRuntimeTweenInPlace(
83974
84207
  iframe,
83975
84208
  patch.selector,
83976
84209
  patch.change,
83977
84210
  void 0,
83978
- deferSeek || index < patches.length - 1
84211
+ deferSeek || index2 < patches.length - 1
83979
84212
  )
83980
84213
  );
83981
84214
  if (missed) {
@@ -84767,9 +85000,9 @@ import { useCallback as useCallback143 } from "react";
84767
85000
 
84768
85001
  // src/hooks/gsapGroupPreflight.ts
84769
85002
  function firstPreflightFailure(results, updates, savedOnElement, activeCompPath) {
84770
- for (const [index, result] of results.entries()) {
85003
+ for (const [index2, result] of results.entries()) {
84771
85004
  if (result.status !== "rejected") continue;
84772
- const selection = updates[index]?.selection;
85005
+ const selection = updates[index2]?.selection;
84773
85006
  if (selection) return { error: result.reason, selection };
84774
85007
  }
84775
85008
  return secondFile(updates, savedOnElement, activeCompPath);
@@ -84878,8 +85111,8 @@ function useGsapAwareGroupMove({
84878
85111
  const lastScriptWrite = updates.findLastIndex(
84879
85112
  ({ selection }) => !offsetMembers.has(selection)
84880
85113
  );
84881
- for (const [index, { selection, next }] of updates.entries()) {
84882
- renderOnCommit = index === lastScriptWrite;
85114
+ for (const [index2, { selection, next }] of updates.entries()) {
85115
+ renderOnCommit = index2 === lastScriptWrite;
84883
85116
  const plain = offsetMembers.get(selection);
84884
85117
  if (plain !== void 0) {
84885
85118
  const staged = writes.drawKeepingUndone(
@@ -85199,7 +85432,7 @@ async function applyArcKeyframeAtPlayhead(session, sel, arcAnim, t2, iframe) {
85199
85432
  targetSelector,
85200
85433
  position: roundTo3(start),
85201
85434
  duration: roundTo3(duration),
85202
- keyframes: nodes.filter((_, index) => index !== timedNodeIndex),
85435
+ keyframes: nodes.filter((_, index2) => index2 !== timedNodeIndex),
85203
85436
  ease: "none"
85204
85437
  },
85205
85438
  { label: "Remove keyframe", softReload: true }
@@ -85694,10 +85927,10 @@ async function commitStaticSet(selection, propEntries, selector, animations, com
85694
85927
  }
85695
85928
  function groupStaticSetEntries(propEntries) {
85696
85929
  const byGroup = /* @__PURE__ */ new Map();
85697
- for (const entry2 of propEntries) {
85698
- const group = classifyPropertyGroup4(entry2[0]);
85930
+ for (const entry3 of propEntries) {
85931
+ const group = classifyPropertyGroup4(entry3[0]);
85699
85932
  const batch = byGroup.get(group) ?? [];
85700
- batch.push(entry2);
85933
+ batch.push(entry3);
85701
85934
  byGroup.set(group, batch);
85702
85935
  }
85703
85936
  return byGroup;
@@ -86674,9 +86907,9 @@ async function moveDomGroupBy(moves, commitGroup) {
86674
86907
  restoreManualOffsetDragMembers(members);
86675
86908
  throw error;
86676
86909
  }
86677
- const updates = members.map((member, index) => ({
86910
+ const updates = members.map((member, index2) => ({
86678
86911
  selection: member.selection,
86679
- next: applyManualOffsetDragCommit(member, screens[index].x, screens[index].y),
86912
+ next: applyManualOffsetDragCommit(member, screens[index2].x, screens[index2].y),
86680
86913
  plainTranslate: member.plainTranslate
86681
86914
  }));
86682
86915
  try {
@@ -88903,8 +89136,8 @@ function renamedIds(before, after) {
88903
89136
  const ids = (html2) => Array.from(html2.matchAll(ID_ATTRS), (match) => match[1]);
88904
89137
  const renamed = ids(after);
88905
89138
  const renames = /* @__PURE__ */ new Map();
88906
- ids(before).forEach((from, index) => {
88907
- const to = renamed[index];
89139
+ ids(before).forEach((from, index2) => {
89140
+ const to = renamed[index2];
88908
89141
  if (to && to !== from) renames.set(from, to);
88909
89142
  });
88910
89143
  return renames;
@@ -88943,13 +89176,13 @@ function selectorList(text) {
88943
89176
  const selectors = [];
88944
89177
  let depth = 0;
88945
89178
  let start = 0;
88946
- for (let index = 0; index < text.length; index++) {
88947
- const char = text[index];
89179
+ for (let index2 = 0; index2 < text.length; index2++) {
89180
+ const char = text[index2];
88948
89181
  if (char === "(" || char === "[") depth++;
88949
89182
  else if (char === ")" || char === "]") depth--;
88950
89183
  else if (char === "," && depth === 0) {
88951
- selectors.push(text.slice(start, index).trim());
88952
- start = index + 1;
89184
+ selectors.push(text.slice(start, index2).trim());
89185
+ start = index2 + 1;
88953
89186
  }
88954
89187
  }
88955
89188
  selectors.push(text.slice(start).trim());
@@ -88994,10 +89227,10 @@ function savedMarkupElseLive(saved2, live, sourceFile) {
88994
89227
  async function readSavedMarkup(readSaved, paths, lives) {
88995
89228
  const sources = /* @__PURE__ */ new Map();
88996
89229
  return Promise.all(
88997
- paths.map(async (path, index) => {
89230
+ paths.map(async (path, index2) => {
88998
89231
  if (!sources.has(path)) sources.set(path, readSaved(path).then(parseSavedSource));
88999
89232
  const saved2 = await sources.get(path);
89000
- return savedMarkupElseLive(saved2, lives[index], path);
89233
+ return savedMarkupElseLive(saved2, lives[index2], path);
89001
89234
  })
89002
89235
  );
89003
89236
  }
@@ -89122,8 +89355,8 @@ function useClipboard({
89122
89355
  async (targets) => {
89123
89356
  const paths = targets.elements.map((el) => el.sourceFile || activeCompPath || "index.html");
89124
89357
  const markup = await readSavedMarkup(readSaved, paths, targets.lives);
89125
- return targets.elements.map((element, index) => ({
89126
- html: markup[index],
89358
+ return targets.elements.map((element, index2) => ({
89359
+ html: markup[index2],
89127
89360
  start: element.start,
89128
89361
  duration: element.duration,
89129
89362
  // authoredTrack, not track: `track` can be a display-lane number
@@ -90027,8 +90260,8 @@ function useToast() {
90027
90260
  setToasts((prev) => {
90028
90261
  const next = [...prev, { id, message, tone }];
90029
90262
  while (next.length > MAX_TOASTS) {
90030
- const dropped = next.shift();
90031
- if (dropped) clearTimer(dropped.id);
90263
+ const dropped2 = next.shift();
90264
+ if (dropped2) clearTimer(dropped2.id);
90032
90265
  }
90033
90266
  return next;
90034
90267
  });
@@ -90936,7 +91169,7 @@ function useImpression(anchor2, route) {
90936
91169
  };
90937
91170
  if (typeof IntersectionObserver === "undefined") return record();
90938
91171
  const seen = new IntersectionObserver((entries) => {
90939
- if (!entries.some((entry2) => entry2.isIntersecting)) return;
91172
+ if (!entries.some((entry3) => entry3.isIntersecting)) return;
90940
91173
  seen.disconnect();
90941
91174
  record();
90942
91175
  });
@@ -91888,8 +92121,8 @@ function partitionKeyframesByGroup(keyframes) {
91888
92121
  }
91889
92122
  return groupOrder.map((group) => byGroup.get(group));
91890
92123
  }
91891
- function reloadOnlyLast(index, count) {
91892
- return index === count - 1 ? { softReload: true } : { skipReload: true };
92124
+ function reloadOnlyLast(index2, count) {
92125
+ return index2 === count - 1 ? { softReload: true } : { skipReload: true };
91893
92126
  }
91894
92127
  function recordingEnd(selection) {
91895
92128
  const start = Number.parseFloat(selection.dataAttributes?.start ?? "0") || 0;
@@ -92034,7 +92267,7 @@ function useGestureCommit({
92034
92267
  ...kf.ease ? { ease: kf.ease } : {}
92035
92268
  }));
92036
92269
  const constantSpeed = { ease: "none" };
92037
- const mapped = keyframes.map((kf, index) => ({
92270
+ const mapped = keyframes.map((kf, index2) => ({
92038
92271
  percentage: roundPct3(
92039
92272
  progressAtTime(
92040
92273
  runEase,
@@ -92042,7 +92275,7 @@ function useGestureCommit({
92042
92275
  )
92043
92276
  ),
92044
92277
  properties: kf.properties,
92045
- ...kf.ease ? { ease: kf.ease } : index > 0 ? constantSpeed : {}
92278
+ ...kf.ease ? { ease: kf.ease } : index2 > 0 ? constantSpeed : {}
92046
92279
  }));
92047
92280
  const merged = [...preserved, ...mapped].sort((a, b) => a.percentage - b.percentage);
92048
92281
  await commit2(
@@ -92059,7 +92292,7 @@ function useGestureCommit({
92059
92292
  );
92060
92293
  } else {
92061
92294
  const keyframeGroups = partitionKeyframesByGroup(keyframes);
92062
- for (const [index, groupKfs] of keyframeGroups.entries()) {
92295
+ for (const [index2, groupKfs] of keyframeGroups.entries()) {
92063
92296
  await commit2(
92064
92297
  {
92065
92298
  type: "add-with-keyframes",
@@ -92076,7 +92309,7 @@ function useGestureCommit({
92076
92309
  {
92077
92310
  label: "Gesture recording (new range)",
92078
92311
  ...coalesceOptions,
92079
- ...reloadOnlyLast(index, keyframeGroups.length)
92312
+ ...reloadOnlyLast(index2, keyframeGroups.length)
92080
92313
  }
92081
92314
  );
92082
92315
  }
@@ -92084,7 +92317,7 @@ function useGestureCommit({
92084
92317
  }
92085
92318
  } else {
92086
92319
  const keyframeGroups = partitionKeyframesByGroup(keyframes);
92087
- for (const [index, groupKfs] of keyframeGroups.entries()) {
92320
+ for (const [index2, groupKfs] of keyframeGroups.entries()) {
92088
92321
  await commit2(
92089
92322
  {
92090
92323
  type: "add-with-keyframes",
@@ -92098,7 +92331,7 @@ function useGestureCommit({
92098
92331
  {
92099
92332
  label: "Gesture recording",
92100
92333
  ...coalesceOptions,
92101
- ...reloadOnlyLast(index, keyframeGroups.length)
92334
+ ...reloadOnlyLast(index2, keyframeGroups.length)
92102
92335
  }
92103
92336
  );
92104
92337
  }
@@ -92823,7 +93056,7 @@ var stopCurrentPreview = null;
92823
93056
  function AudioRow({
92824
93057
  projectId,
92825
93058
  asset,
92826
- used,
93059
+ used: used2,
92827
93060
  meta,
92828
93061
  onCopy,
92829
93062
  copyFeedback,
@@ -92856,7 +93089,7 @@ function AudioRow({
92856
93089
  const setPreviewAsset = useAssetPreviewStore((s) => s.setPreviewAsset);
92857
93090
  const clearPreviewAsset = useAssetPreviewStore((s) => s.clearPreviewAsset);
92858
93091
  const activateRow = useCallback166(() => {
92859
- if (used) {
93092
+ if (used2) {
92860
93093
  const clip = findClipForAsset(elements, asset);
92861
93094
  if (clip) {
92862
93095
  clearPreviewAsset();
@@ -92868,7 +93101,7 @@ function AudioRow({
92868
93101
  }
92869
93102
  setPreviewAsset(asset, projectId);
92870
93103
  }, [
92871
- used,
93104
+ used2,
92872
93105
  elements,
92873
93106
  asset,
92874
93107
  projectId,
@@ -93014,7 +93247,7 @@ function AudioRow({
93014
93247
  /* @__PURE__ */ jsx217(
93015
93248
  "span",
93016
93249
  {
93017
- className: `text-[12px] font-medium truncate ${used ? "text-panel-text-1" : "text-panel-text-3"}`,
93250
+ className: `text-[12px] font-medium truncate ${used2 ? "text-panel-text-1" : "text-panel-text-3"}`,
93018
93251
  children: name
93019
93252
  }
93020
93253
  ),
@@ -93022,7 +93255,7 @@ function AudioRow({
93022
93255
  meta?.duration ? `${meta.duration}s \xB7 ` : "",
93023
93256
  subtype
93024
93257
  ] }),
93025
- used && /* @__PURE__ */ jsx217("span", { className: "text-[9px] font-medium text-accent-ink bg-panel-accent/10 px-1.5 py-px rounded-sm shrink-0", children: "in use" }),
93258
+ used2 && /* @__PURE__ */ jsx217("span", { className: "text-[9px] font-medium text-accent-ink bg-panel-accent/10 px-1.5 py-px rounded-sm shrink-0", children: "in use" }),
93026
93259
  (isCopied || copyFailed) && /* @__PURE__ */ jsx217(
93027
93260
  "span",
93028
93261
  {
@@ -93244,7 +93477,7 @@ function useProbedDuration(src, skip) {
93244
93477
  function AssetCard({
93245
93478
  projectId,
93246
93479
  asset,
93247
- used,
93480
+ used: used2,
93248
93481
  duration,
93249
93482
  onCopy,
93250
93483
  copyFeedback,
@@ -93275,7 +93508,7 @@ function AssetCard({
93275
93508
  pointerDownRef.current = { x: e.clientX, y: e.clientY };
93276
93509
  }, []);
93277
93510
  const activateCard = useCallback167(() => {
93278
- if (used) {
93511
+ if (used2) {
93279
93512
  const clip = findClipForAsset(elements, asset);
93280
93513
  if (clip) {
93281
93514
  clearPreviewAsset();
@@ -93287,7 +93520,7 @@ function AssetCard({
93287
93520
  }
93288
93521
  setPreviewAsset(asset, projectId);
93289
93522
  }, [
93290
- used,
93523
+ used2,
93291
93524
  elements,
93292
93525
  asset,
93293
93526
  projectId,
@@ -93355,14 +93588,14 @@ function AssetCard({
93355
93588
  )
93356
93589
  ] }),
93357
93590
  (!isImage && !isVideo || isImage && imgError) && /* @__PURE__ */ jsx220("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx220("span", { className: "text-[10px] font-medium text-neutral-600", children: extension }) }),
93358
- used && /* @__PURE__ */ jsx220("span", { className: "absolute top-1 left-1 text-[9px] font-semibold leading-none px-1.5 py-[3px] rounded-sm bg-neutral-950/80 text-panel-text-1", children: "Added" }),
93591
+ used2 && /* @__PURE__ */ jsx220("span", { className: "absolute top-1 left-1 text-[9px] font-semibold leading-none px-1.5 py-[3px] rounded-sm bg-neutral-950/80 text-panel-text-1", children: "Added" }),
93359
93592
  durationLabel && /* @__PURE__ */ jsx220("span", { className: "absolute top-1 right-1 text-[9px] font-medium leading-none px-1.5 py-[3px] rounded-sm bg-neutral-950/80 text-panel-text-2 tabular-nums", children: durationLabel })
93360
93593
  ] }),
93361
93594
  /* @__PURE__ */ jsxs172("div", { className: "flex items-center justify-center gap-1", children: [
93362
93595
  /* @__PURE__ */ jsx220(
93363
93596
  "span",
93364
93597
  {
93365
- className: `text-[10px] leading-tight text-center ${used ? "text-panel-text-2" : "text-panel-text-4"}`,
93598
+ className: `text-[10px] leading-tight text-center ${used2 ? "text-panel-text-2" : "text-panel-text-4"}`,
93366
93599
  title: fullName,
93367
93600
  children: truncateMiddle(fullName, 22)
93368
93601
  }
@@ -93389,7 +93622,7 @@ function AssetCard({
93389
93622
  }
93390
93623
  function FontRow({
93391
93624
  asset,
93392
- used,
93625
+ used: used2,
93393
93626
  onCopy,
93394
93627
  copyFeedback,
93395
93628
  onDelete,
@@ -93425,13 +93658,13 @@ function FontRow({
93425
93658
  /* @__PURE__ */ jsx220(
93426
93659
  "span",
93427
93660
  {
93428
- className: `text-xs font-medium truncate block ${used ? "text-panel-text-1" : "text-panel-text-3"}`,
93661
+ className: `text-xs font-medium truncate block ${used2 ? "text-panel-text-1" : "text-panel-text-3"}`,
93429
93662
  children: name
93430
93663
  }
93431
93664
  ),
93432
93665
  /* @__PURE__ */ jsxs172("div", { className: "flex items-center gap-1.5", children: [
93433
93666
  /* @__PURE__ */ jsx220("span", { className: "text-[10px] text-neutral-600 truncate", children: extension }),
93434
- used && /* @__PURE__ */ jsx220("span", { className: "text-[9px] font-medium text-accent-ink bg-panel-accent/10 px-1.5 py-px rounded-sm", children: "in use" }),
93667
+ used2 && /* @__PURE__ */ jsx220("span", { className: "text-[9px] font-medium text-accent-ink bg-panel-accent/10 px-1.5 py-px rounded-sm", children: "in use" }),
93435
93668
  /* @__PURE__ */ jsx220(CopyChip, { feedback: copyFeedback, asset })
93436
93669
  ] })
93437
93670
  ] })
@@ -93462,9 +93695,9 @@ function filterByUsage(assets, usedPaths, usageFilter) {
93462
93695
  return assets;
93463
93696
  }
93464
93697
  function countUsage(assets, usedPaths) {
93465
- let used = 0;
93466
- for (const a of assets) if (usedPaths.has(a)) used++;
93467
- return { used, unused: assets.length - used };
93698
+ let used2 = 0;
93699
+ for (const a of assets) if (usedPaths.has(a)) used2++;
93700
+ return { used: used2, unused: assets.length - used2 };
93468
93701
  }
93469
93702
  function deriveUsedPaths(elements) {
93470
93703
  const paths = /* @__PURE__ */ new Set();
@@ -94433,7 +94666,7 @@ function useNearViewport() {
94433
94666
  if (!element || near4) return;
94434
94667
  if (typeof IntersectionObserver === "undefined") return setNear(true);
94435
94668
  const observer = new IntersectionObserver(
94436
- (entries) => entries.some((entry2) => entry2.isIntersecting) && setNear(true),
94669
+ (entries) => entries.some((entry3) => entry3.isIntersecting) && setNear(true),
94437
94670
  { root: element.closest("[data-composition-list]"), rootMargin: "200px" }
94438
94671
  );
94439
94672
  observer.observe(element);
@@ -95546,7 +95779,7 @@ var LayersPanel = memo52(function LayersPanel2({ host }) {
95546
95779
  ]
95547
95780
  }
95548
95781
  ),
95549
- visibleLayers.map((layer, index) => {
95782
+ visibleLayers.map((layer, index2) => {
95550
95783
  const selected = layer.key === selectedKey;
95551
95784
  const isDragged = layer.key === dragKey;
95552
95785
  const draggable = isLayerDraggable(layer);
@@ -95560,12 +95793,12 @@ var LayersPanel = memo52(function LayersPanel2({ host }) {
95560
95793
  return /* @__PURE__ */ jsxs179(
95561
95794
  "div",
95562
95795
  {
95563
- "data-layer-index": index,
95796
+ "data-layer-index": index2,
95564
95797
  role: "button",
95565
95798
  tabIndex: 0,
95566
95799
  onClick: () => !dragKey && handleSelectLayer(layer),
95567
95800
  onDoubleClick: () => !dragKey && handleLayerDoubleClick(layer),
95568
- onPointerDown: (e) => handleRowPointerDown(index, e),
95801
+ onPointerDown: (e) => handleRowPointerDown(index2, e),
95569
95802
  onPointerEnter: () => !dragKey && handleLayerHover(layer),
95570
95803
  onKeyDown: (e) => {
95571
95804
  if (e.key === "Enter" || e.key === " ") {