@waveform-playlist/browser 15.3.3 → 15.4.0

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.mjs CHANGED
@@ -588,7 +588,7 @@ function useClipDragHandlers({
588
588
  (event) => {
589
589
  var _a;
590
590
  const data = (_a = event.operation.source) == null ? void 0 : _a.data;
591
- if (!data) return;
591
+ if (!data || data.kind === "track-reorder") return;
592
592
  if (!data.boundary) {
593
593
  originalClipStateRef.current = null;
594
594
  if (engineRef.current) {
@@ -624,7 +624,7 @@ function useClipDragHandlers({
624
624
  (event) => {
625
625
  var _a, _b, _c;
626
626
  const data = (_a = event.operation.source) == null ? void 0 : _a.data;
627
- if (!data) return;
627
+ if (!data || data.kind === "track-reorder") return;
628
628
  if (!data.boundary) return;
629
629
  if (!originalClipStateRef.current) return;
630
630
  const { boundary, trackIndex, clipIndex } = data;
@@ -684,10 +684,12 @@ function useClipDragHandlers({
684
684
  );
685
685
  const onDragEnd = React.useCallback(
686
686
  (event) => {
687
- var _a, _b, _c, _d, _e, _f, _g;
687
+ var _a, _b, _c, _d, _e, _f, _g, _h;
688
+ const kindData = (_a = event.operation.source) == null ? void 0 : _a.data;
689
+ if ((kindData == null ? void 0 : kindData.kind) === "track-reorder") return;
688
690
  if (event.canceled) {
689
691
  if (originalClipStateRef.current) {
690
- const cancelData = (_a = event.operation.source) == null ? void 0 : _a.data;
692
+ const cancelData = (_b = event.operation.source) == null ? void 0 : _b.data;
691
693
  if (cancelData) {
692
694
  const { trackIndex: trackIndex2, clipIndex } = cancelData;
693
695
  const original = originalClipStateRef.current;
@@ -709,25 +711,25 @@ function useClipDragHandlers({
709
711
  isDraggingRef.current = false;
710
712
  originalClipStateRef.current = null;
711
713
  lastBoundaryDeltaRef.current = 0;
712
- (_b = engineRef.current) == null ? void 0 : _b.abortTransaction();
714
+ (_c = engineRef.current) == null ? void 0 : _c.abortTransaction();
713
715
  return;
714
716
  }
715
- const data = (_c = event.operation.source) == null ? void 0 : _c.data;
717
+ const data = (_d = event.operation.source) == null ? void 0 : _d.data;
716
718
  if (!data) {
717
719
  isDraggingRef.current = false;
718
- (_d = engineRef.current) == null ? void 0 : _d.abortTransaction();
720
+ (_e = engineRef.current) == null ? void 0 : _e.abortTransaction();
719
721
  return;
720
722
  }
721
723
  const { trackIndex, clipId, boundary } = data;
722
724
  const sampleDelta = boundary ? lastBoundaryDeltaRef.current : event.operation.transform.x * samplesPerPixel;
723
- const trackId = (_e = tracks[trackIndex]) == null ? void 0 : _e.id;
725
+ const trackId = (_f = tracks[trackIndex]) == null ? void 0 : _f.id;
724
726
  if (boundary) {
725
727
  isDraggingRef.current = false;
726
728
  if (!trackId) {
727
729
  console.warn(
728
730
  `[waveform-playlist] onDragEnd: track at index ${trackIndex} not found \u2014 trim not synced to adapter`
729
731
  );
730
- (_f = engineRef.current) == null ? void 0 : _f.abortTransaction();
732
+ (_g = engineRef.current) == null ? void 0 : _g.abortTransaction();
731
733
  } else if (!engineRef.current) {
732
734
  console.warn("[waveform-playlist] engineRef is null \u2014 trim not synced to adapter");
733
735
  } else {
@@ -742,7 +744,7 @@ function useClipDragHandlers({
742
744
  console.warn(
743
745
  `[waveform-playlist] onDragEnd: track at index ${trackIndex} not found \u2014 move not synced to adapter`
744
746
  );
745
- (_g = engineRef.current) == null ? void 0 : _g.abortTransaction();
747
+ (_h = engineRef.current) == null ? void 0 : _h.abortTransaction();
746
748
  } else if (!engineRef.current) {
747
749
  console.warn("[waveform-playlist] engineRef is null \u2014 move not synced to adapter");
748
750
  } else {
@@ -1849,6 +1851,8 @@ var WaveformPlaylistProvider = ({
1849
1851
  const [linkEndpoints, setLinkEndpoints] = useState9((_b = annotationList == null ? void 0 : annotationList.linkEndpoints) != null ? _b : false);
1850
1852
  const [annotationsEditable, setAnnotationsEditable] = useState9((_c = annotationList == null ? void 0 : annotationList.editable) != null ? _c : false);
1851
1853
  const [isReady, setIsReady] = useState9(false);
1854
+ const [trackReorderEpoch, setTrackReorderEpoch] = useState9(0);
1855
+ const [trackDragPreview, setTrackDragPreview] = useState9(null);
1852
1856
  const engineRef = useRef9(null);
1853
1857
  const adapterRef = useRef9(null);
1854
1858
  const audioInitializedRef = useRef9(false);
@@ -1886,6 +1890,7 @@ var WaveformPlaylistProvider = ({
1886
1890
  const playbackStartTimeRef = useRef9(0);
1887
1891
  const audioStartPositionRef = useRef9(0);
1888
1892
  const playbackEndTimeRef = useRef9(null);
1893
+ const suppressEngineStopMirrorRef = useRef9(false);
1889
1894
  const scrollContainerRef = useRef9(null);
1890
1895
  const isAutomaticScrollRef = useRef9(false);
1891
1896
  const frameCallbacksRef = useRef9(/* @__PURE__ */ new Map());
@@ -2094,7 +2099,9 @@ var WaveformPlaylistProvider = ({
2094
2099
  const wasPlaying = isPlayingRef.current;
2095
2100
  const resumePosition = currentTimeRef.current;
2096
2101
  if (engineRef.current && wasPlaying) {
2102
+ suppressEngineStopMirrorRef.current = true;
2097
2103
  engineRef.current.stop();
2104
+ suppressEngineStopMirrorRef.current = false;
2098
2105
  stopAnimationFrameLoop();
2099
2106
  pendingResumeRef.current = { position: resumePosition };
2100
2107
  }
@@ -2185,6 +2192,19 @@ var WaveformPlaylistProvider = ({
2185
2192
  if (!suppressTracksMirroring && state.tracksVersion !== lastTracksVersionRef.current) {
2186
2193
  lastTracksVersionRef.current = state.tracksVersion;
2187
2194
  engineTracksRef.current = state.tracks;
2195
+ const oldTracks = tracksRef.current;
2196
+ const oldStates = trackStatesRef.current;
2197
+ if (oldTracks.length === oldStates.length && oldTracks.length === state.tracks.length) {
2198
+ const idToState = new Map(oldTracks.map((t, i) => [t.id, oldStates[i]]));
2199
+ const reordered = state.tracks.map((t, i) => {
2200
+ var _a4;
2201
+ return (_a4 = idToState.get(t.id)) != null ? _a4 : oldStates[i];
2202
+ });
2203
+ const orderChanged = reordered.some((s, i) => s !== oldStates[i]);
2204
+ if (orderChanged) {
2205
+ setTrackStates(reordered);
2206
+ }
2207
+ }
2188
2208
  if (onTracksChange) {
2189
2209
  onTracksChange(state.tracks);
2190
2210
  } else {
@@ -2194,6 +2214,14 @@ var WaveformPlaylistProvider = ({
2194
2214
  }
2195
2215
  }
2196
2216
  });
2217
+ engine.on("stop", () => {
2218
+ if (suppressEngineStopMirrorRef.current) return;
2219
+ setIsPlaying(false);
2220
+ stopAnimationFrameLoop();
2221
+ const stoppedAt = engine.getCurrentTime();
2222
+ setCurrentTimeRefs(stoppedAt);
2223
+ setCurrentTime(stoppedAt);
2224
+ });
2197
2225
  engine.setTracks(tracksWithState);
2198
2226
  suppressTracksMirroring = false;
2199
2227
  lastTracksVersionRef.current = engine.getState().tracksVersion;
@@ -2491,7 +2519,9 @@ var WaveformPlaylistProvider = ({
2491
2519
  if (isPlaying && animationFrameRef.current && engineRef.current) {
2492
2520
  if (continuousPlay) {
2493
2521
  const currentPos = currentTimeRef.current;
2522
+ suppressEngineStopMirrorRef.current = true;
2494
2523
  engineRef.current.stop();
2524
+ suppressEngineStopMirrorRef.current = false;
2495
2525
  stopAnimationLoop();
2496
2526
  const timeNow = getAudioContextTime();
2497
2527
  playbackStartTimeRef.current = timeNow;
@@ -2546,7 +2576,9 @@ var WaveformPlaylistProvider = ({
2546
2576
  const actualStartTime = startTime != null ? startTime : currentTimeRef.current;
2547
2577
  playStartPositionRef.current = actualStartTime;
2548
2578
  setCurrentTimeRefs(actualStartTime);
2579
+ suppressEngineStopMirrorRef.current = true;
2549
2580
  engineRef.current.stop();
2581
+ suppressEngineStopMirrorRef.current = false;
2550
2582
  engineRef.current.seek(actualStartTime);
2551
2583
  stopAnimationLoop();
2552
2584
  const startTimeNow = getAudioContextTime();
@@ -2655,13 +2687,28 @@ var WaveformPlaylistProvider = ({
2655
2687
  },
2656
2688
  [trackStates]
2657
2689
  );
2690
+ const reorderTrack = useCallback13(
2691
+ (trackId, toIndex) => {
2692
+ if (!engineRef.current) {
2693
+ console.warn("[waveform-playlist] reorderTrack: engine not ready, call ignored");
2694
+ return;
2695
+ }
2696
+ engineRef.current.reorderTrack(trackId, toIndex);
2697
+ },
2698
+ [engineRef]
2699
+ );
2700
+ const bumpTrackReorderEpoch = useCallback13(() => {
2701
+ setTrackReorderEpoch((epoch) => epoch + 1);
2702
+ }, []);
2658
2703
  const setSelection = useCallback13(
2659
2704
  (start, end) => {
2660
2705
  setSelectionEngine(start, end);
2661
2706
  setCurrentTimeRefs(start);
2662
2707
  setCurrentTime(start);
2663
2708
  if (isPlaying && engineRef.current) {
2709
+ suppressEngineStopMirrorRef.current = true;
2664
2710
  engineRef.current.stop();
2711
+ suppressEngineStopMirrorRef.current = false;
2665
2712
  engineRef.current.seek(start);
2666
2713
  engineRef.current.play(start);
2667
2714
  }
@@ -2782,6 +2829,9 @@ var WaveformPlaylistProvider = ({
2782
2829
  setTrackSolo,
2783
2830
  setTrackVolume,
2784
2831
  setTrackPan,
2832
+ reorderTrack,
2833
+ bumpTrackReorderEpoch,
2834
+ setTrackDragPreview,
2785
2835
  // Selection
2786
2836
  setSelection,
2787
2837
  setSelectedTrackId: setSelectedTrackIdControl,
@@ -2824,6 +2874,9 @@ var WaveformPlaylistProvider = ({
2824
2874
  setTrackSolo,
2825
2875
  setTrackVolume,
2826
2876
  setTrackPan,
2877
+ reorderTrack,
2878
+ bumpTrackReorderEpoch,
2879
+ setTrackDragPreview,
2827
2880
  setSelection,
2828
2881
  setSelectedTrackIdControl,
2829
2882
  setTimeFormat,
@@ -2871,6 +2924,8 @@ var WaveformPlaylistProvider = ({
2871
2924
  roundedBars,
2872
2925
  progressBarWidth,
2873
2926
  isReady,
2927
+ trackReorderEpoch,
2928
+ trackDragPreview,
2874
2929
  mono,
2875
2930
  isDraggingRef,
2876
2931
  onTracksChange
@@ -2897,6 +2952,8 @@ var WaveformPlaylistProvider = ({
2897
2952
  roundedBars,
2898
2953
  progressBarWidth,
2899
2954
  isReady,
2955
+ trackReorderEpoch,
2956
+ trackDragPreview,
2900
2957
  mono,
2901
2958
  isDraggingRef,
2902
2959
  onTracksChange
@@ -3672,11 +3729,11 @@ function useClipInteractionEnabled() {
3672
3729
  // src/components/PlaylistVisualization.tsx
3673
3730
  import {
3674
3731
  useContext as useContext6,
3675
- useEffect as useEffect10,
3676
- useRef as useRef14,
3677
- useState as useState11,
3732
+ useEffect as useEffect12,
3733
+ useRef as useRef15,
3734
+ useState as useState12,
3678
3735
  useMemo as useMemo5,
3679
- useCallback as useCallback16
3736
+ useCallback as useCallback17
3680
3737
  } from "react";
3681
3738
  import { createPortal } from "react-dom";
3682
3739
  import styled4 from "styled-components";
@@ -3702,14 +3759,146 @@ import {
3702
3759
  useTheme as useTheme2,
3703
3760
  waveformColorToCss as waveformColorToCss2,
3704
3761
  SpectrogramLabels,
3705
- CLIP_HEADER_HEIGHT
3762
+ CLIP_HEADER_HEIGHT,
3763
+ ReorderRail
3706
3764
  } from "@waveform-playlist/ui-components";
3765
+
3766
+ // src/components/SortableTrackControls.tsx
3767
+ import { useCallback as useCallback16, useEffect as useEffect8, useRef as useRef12 } from "react";
3768
+ import { useSortable } from "@dnd-kit/react/sortable";
3769
+ import { RestrictToVerticalAxis } from "@dnd-kit/abstract/modifiers";
3770
+
3771
+ // src/utils/dragPopoverHealer.ts
3772
+ function createDragPopoverHealer(element) {
3773
+ if (typeof element.showPopover !== "function") {
3774
+ return () => {
3775
+ };
3776
+ }
3777
+ const heal = () => {
3778
+ if (!element.isConnected || !element.hasAttribute("popover")) return;
3779
+ let open = false;
3780
+ try {
3781
+ open = element.matches(":popover-open");
3782
+ } catch (e) {
3783
+ }
3784
+ if (open) return;
3785
+ try {
3786
+ element.showPopover();
3787
+ } catch (e) {
3788
+ }
3789
+ };
3790
+ const observer = new MutationObserver(heal);
3791
+ observer.observe(element.ownerDocument.body, {
3792
+ childList: true,
3793
+ subtree: true
3794
+ });
3795
+ return () => observer.disconnect();
3796
+ }
3797
+
3798
+ // src/components/SortableTrackControls.tsx
3799
+ import { Fragment, jsx as jsx7 } from "react/jsx-runtime";
3800
+ var SortableTrackControls = ({
3801
+ trackId,
3802
+ index,
3803
+ disabled = false,
3804
+ children
3805
+ }) => {
3806
+ const { ref, handleRef, isDragSource } = useSortable({
3807
+ id: `track-reorder-${trackId}`,
3808
+ index,
3809
+ group: "playlist-tracks",
3810
+ type: "track",
3811
+ accept: ["track"],
3812
+ data: { kind: "track-reorder", trackId },
3813
+ modifiers: [RestrictToVerticalAxis],
3814
+ disabled,
3815
+ // feedback: 'move' (NOT 'none' — see below) disables the Feedback
3816
+ // plugin's placeholder/clone splicing for this sortable while KEEPING its
3817
+ // dragOperation.shape computation alive. That plugin does raw,
3818
+ // React-bypassing DOM surgery on ANY pointer movement during an activated
3819
+ // drag (insertAdjacentElement to splice in a placeholder, then
3820
+ // `placeholder.replaceWith(element)` on drop) — confirmed via
3821
+ // MutationObserver instrumentation to relocate the React-owned row 6
3822
+ // times during a single one-slot drag, leaving its final parent/sibling
3823
+ // different from what React's fiber tree still believes. That desync is
3824
+ // permanent for the session: every later React-driven reorder (button OR
3825
+ // drag) computes the correct data but silently fails to update the DOM
3826
+ // for these rows. The placeholder splice is created only when
3827
+ // `feedback !== 'move'` (@dnd-kit/dom Feedback.ts) — 'move' keeps the
3828
+ // dragged element in the live DOM (no clone/placeholder) while still
3829
+ // running the *unconditional* `dragOperation.shape = ...` assignment.
3830
+ // `feedback: 'none'` looked like the boundary-trim precedent (Clip.tsx /
3831
+ // AnnotationBox.tsx) but is wrong here: 'none' bails out of Feedback's
3832
+ // render function BEFORE dragOperation.shape is ever set, and shape is
3833
+ // the ONLY input CollisionObserver.computeCollisions() checks — with
3834
+ // 'none', collision (and therefore sortable.index) never updates, so
3835
+ // drag-based reordering silently never commits. Boundary trims don't hit
3836
+ // this because they're plain useDraggable (no collision-based commit) —
3837
+ // sortables need shape. `isDragSource` (box-shadow lift feedback below)
3838
+ // is a reactive signal, unaffected either way. See browser/CLAUDE.md
3839
+ // "Track Reordering".
3840
+ feedback: "move"
3841
+ });
3842
+ const elementRef = useRef12(null);
3843
+ const composedRef = useCallback16(
3844
+ (element) => {
3845
+ elementRef.current = element instanceof HTMLElement ? element : null;
3846
+ ref(element);
3847
+ },
3848
+ [ref]
3849
+ );
3850
+ useEffect8(() => {
3851
+ if (!isDragSource || !elementRef.current) return void 0;
3852
+ return createDragPopoverHealer(elementRef.current);
3853
+ }, [isDragSource]);
3854
+ return /* @__PURE__ */ jsx7(Fragment, { children: children({ ref: composedRef, handleRef, isDragSource }) });
3855
+ };
3856
+
3857
+ // src/utils/trackOrderPreview.ts
3858
+ function applyTrackOrderPreview(tracks, preview) {
3859
+ if (!preview) return tracks;
3860
+ const fromIndex = tracks.findIndex((t) => t.id === preview.trackId);
3861
+ if (fromIndex === -1) return tracks;
3862
+ const toIndex = Math.max(0, Math.min(tracks.length - 1, preview.toIndex));
3863
+ if (toIndex === fromIndex) return tracks;
3864
+ const next = tracks.slice();
3865
+ const [moved] = next.splice(fromIndex, 1);
3866
+ next.splice(toIndex, 0, moved);
3867
+ return next;
3868
+ }
3869
+ function computeTrackLayout(orderedIds, heightById) {
3870
+ var _a;
3871
+ const topById = /* @__PURE__ */ new Map();
3872
+ let top = 0;
3873
+ for (const id of orderedIds) {
3874
+ topById.set(id, top);
3875
+ top += (_a = heightById.get(id)) != null ? _a : 0;
3876
+ }
3877
+ return { topById, totalHeight: top };
3878
+ }
3879
+
3880
+ // src/hooks/useTrailingActive.ts
3881
+ import { useEffect as useEffect9, useState as useState11 } from "react";
3882
+ function useTrailingActive(active, trailingMs) {
3883
+ const [trailing, setTrailing] = useState11(active);
3884
+ useEffect9(() => {
3885
+ if (active) {
3886
+ setTrailing(true);
3887
+ return void 0;
3888
+ }
3889
+ const timer = setTimeout(() => setTrailing(false), trailingMs);
3890
+ return () => clearTimeout(timer);
3891
+ }, [active, trailingMs]);
3892
+ return trailing || active;
3893
+ }
3894
+
3895
+ // src/components/PlaylistVisualization.tsx
3707
3896
  import { resolveRecordingOffsetSamples } from "@waveform-playlist/core";
3708
3897
 
3709
3898
  // src/components/AnimatedPlayhead.tsx
3710
- import { useRef as useRef12, useEffect as useEffect8 } from "react";
3899
+ import { useRef as useRef13, useEffect as useEffect10 } from "react";
3711
3900
  import styled2 from "styled-components";
3712
- import { jsx as jsx7 } from "react/jsx-runtime";
3901
+ import { jsx as jsx8 } from "react/jsx-runtime";
3713
3902
  var PlayheadLine = styled2.div.attrs((props) => ({
3714
3903
  style: {
3715
3904
  width: `${props.$width}px`,
@@ -3725,7 +3914,7 @@ var PlayheadLine = styled2.div.attrs((props) => ({
3725
3914
  will-change: transform;
3726
3915
  `;
3727
3916
  var AnimatedPlayhead = ({ color = "#ff0000" }) => {
3728
- const playheadRef = useRef12(null);
3917
+ const playheadRef = useRef13(null);
3729
3918
  const {
3730
3919
  isPlaying,
3731
3920
  currentTimeRef,
@@ -3734,7 +3923,7 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
3734
3923
  unregisterFrameCallback
3735
3924
  } = usePlaybackAnimation();
3736
3925
  const { samplesPerPixel, sampleRate, progressBarWidth } = usePlaylistData();
3737
- useEffect8(() => {
3926
+ useEffect10(() => {
3738
3927
  const id = "playhead";
3739
3928
  if (isPlaying) {
3740
3929
  registerFrameCallback(id, ({ visualTime, sampleRate: sr, samplesPerPixel: spp }) => {
@@ -3746,7 +3935,7 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
3746
3935
  }
3747
3936
  return () => unregisterFrameCallback(id);
3748
3937
  }, [isPlaying, registerFrameCallback, unregisterFrameCallback]);
3749
- useEffect8(() => {
3938
+ useEffect10(() => {
3750
3939
  var _a, _b;
3751
3940
  if (!isPlaying && playheadRef.current) {
3752
3941
  const time = (_b = (_a = visualTimeRef.current) != null ? _a : currentTimeRef.current) != null ? _b : 0;
@@ -3754,11 +3943,11 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
3754
3943
  playheadRef.current.style.transform = `translate3d(${position}px, 0, 0)`;
3755
3944
  }
3756
3945
  });
3757
- return /* @__PURE__ */ jsx7(PlayheadLine, { ref: playheadRef, $color: color, $width: progressBarWidth, "data-playhead": true });
3946
+ return /* @__PURE__ */ jsx8(PlayheadLine, { ref: playheadRef, $color: color, $width: progressBarWidth, "data-playhead": true });
3758
3947
  };
3759
3948
 
3760
3949
  // src/components/ChannelWithProgress.tsx
3761
- import { useId, useRef as useRef13, useEffect as useEffect9 } from "react";
3950
+ import { useId, useRef as useRef14, useEffect as useEffect11 } from "react";
3762
3951
  import styled3 from "styled-components";
3763
3952
  import {
3764
3953
  clipPixelWidth as computeClipPixelWidth
@@ -3769,7 +3958,7 @@ import {
3769
3958
  usePlaylistInfo,
3770
3959
  waveformColorToCss
3771
3960
  } from "@waveform-playlist/ui-components";
3772
- import { Fragment, jsx as jsx8, jsxs } from "react/jsx-runtime";
3961
+ import { Fragment as Fragment2, jsx as jsx9, jsxs } from "react/jsx-runtime";
3773
3962
  var ChannelWrapper = styled3.div`
3774
3963
  position: relative;
3775
3964
  `;
@@ -3823,7 +4012,7 @@ var ChannelWithProgress = (_a) => {
3823
4012
  "clipSampleRate",
3824
4013
  "clipOffsetSeconds"
3825
4014
  ]);
3826
- const progressRef = useRef13(null);
4015
+ const progressRef = useRef14(null);
3827
4016
  const callbackId = useId();
3828
4017
  const theme = useTheme();
3829
4018
  const { waveHeight } = usePlaylistInfo();
@@ -3841,7 +4030,7 @@ var ChannelWithProgress = (_a) => {
3841
4030
  clipDurationSamples,
3842
4031
  samplesPerPixel
3843
4032
  );
3844
- useEffect9(() => {
4033
+ useEffect11(() => {
3845
4034
  if (isPlaying) {
3846
4035
  registerFrameCallback(callbackId, ({ visualTime, sampleRate: sr }) => {
3847
4036
  if (progressRef.current) {
@@ -3869,7 +4058,7 @@ var ChannelWithProgress = (_a) => {
3869
4058
  registerFrameCallback,
3870
4059
  unregisterFrameCallback
3871
4060
  ]);
3872
- useEffect9(() => {
4061
+ useEffect11(() => {
3873
4062
  var _a2, _b2;
3874
4063
  if (!isPlaying && progressRef.current) {
3875
4064
  const currentTime = (_b2 = (_a2 = visualTimeRef.current) != null ? _a2 : currentTimeRef.current) != null ? _b2 : 0;
@@ -3903,8 +4092,8 @@ var ChannelWithProgress = (_a) => {
3903
4092
  const effectiveTop = isBothMode ? smartChannelProps.index * waveHeight : smartChannelProps.index * waveHeight;
3904
4093
  const waveformBackgroundCss = waveformColorToCss(backgroundColor);
3905
4094
  return /* @__PURE__ */ jsxs(ChannelWrapper, { children: [
3906
- isBothMode ? /* @__PURE__ */ jsxs(Fragment, { children: [
3907
- /* @__PURE__ */ jsx8(
4095
+ isBothMode ? /* @__PURE__ */ jsxs(Fragment2, { children: [
4096
+ /* @__PURE__ */ jsx9(
3908
4097
  Background,
3909
4098
  {
3910
4099
  $color: "#000",
@@ -3913,7 +4102,7 @@ var ChannelWithProgress = (_a) => {
3913
4102
  $width: smartChannelProps.length
3914
4103
  }
3915
4104
  ),
3916
- /* @__PURE__ */ jsx8(
4105
+ /* @__PURE__ */ jsx9(
3917
4106
  Background,
3918
4107
  {
3919
4108
  $color: waveformBackgroundCss,
@@ -3922,7 +4111,7 @@ var ChannelWithProgress = (_a) => {
3922
4111
  $width: smartChannelProps.length
3923
4112
  }
3924
4113
  )
3925
- ] }) : /* @__PURE__ */ jsx8(
4114
+ ] }) : /* @__PURE__ */ jsx9(
3926
4115
  Background,
3927
4116
  {
3928
4117
  $color: backgroundCss,
@@ -3931,7 +4120,7 @@ var ChannelWithProgress = (_a) => {
3931
4120
  $width: smartChannelProps.length
3932
4121
  }
3933
4122
  ),
3934
- !isPianoRollMode && /* @__PURE__ */ jsx8(
4123
+ !isPianoRollMode && /* @__PURE__ */ jsx9(
3935
4124
  ProgressOverlay,
3936
4125
  {
3937
4126
  ref: progressRef,
@@ -3941,7 +4130,7 @@ var ChannelWithProgress = (_a) => {
3941
4130
  $width: clipPixelWidth
3942
4131
  }
3943
4132
  ),
3944
- /* @__PURE__ */ jsx8(ChannelContainer, { children: /* @__PURE__ */ jsx8(
4133
+ /* @__PURE__ */ jsx9(ChannelContainer, { children: /* @__PURE__ */ jsx9(
3945
4134
  SmartChannel,
3946
4135
  __spreadProps(__spreadValues({}, smartChannelProps), {
3947
4136
  transparentBackground: true,
@@ -3968,15 +4157,42 @@ function useSpectrogramIntegration() {
3968
4157
  }
3969
4158
 
3970
4159
  // src/components/PlaylistVisualization.tsx
3971
- import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
4160
+ import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
3972
4161
  var DEFAULT_EMPTY_TRACK_DURATION = 60;
3973
- var ControlSlot = styled4.div.attrs((props) => ({
4162
+ var DRAG_SOURCE_SHADOW = "0 4px 12px rgba(0, 0, 0, 0.35)";
4163
+ var TracksLayout = styled4.div.attrs((props) => ({
3974
4164
  style: { height: `${props.$height}px` }
3975
4165
  }))`
4166
+ position: relative;
4167
+ `;
4168
+ var TrackRowPositioner = styled4.div.attrs((props) => ({
4169
+ style: { top: `${props.$top}px` }
4170
+ }))`
4171
+ position: absolute;
4172
+ left: 0;
4173
+ right: 0;
4174
+ ${(props) => props.$animate && "transition: top 150ms ease;"}
4175
+ @media (prefers-reduced-motion: reduce) {
4176
+ transition: none;
4177
+ }
4178
+ `;
4179
+ var ControlSlot = styled4.div.attrs((props) => ({
4180
+ style: {
4181
+ height: `${props.$height}px`,
4182
+ top: `${props.$top}px`
4183
+ }
4184
+ }))`
4185
+ position: absolute;
4186
+ left: 0;
4187
+ right: 0;
3976
4188
  overflow: hidden;
3977
4189
  pointer-events: auto;
3978
4190
  background: ${(props) => props.theme.surfaceColor};
3979
4191
  transition: background 0.15s ease-in-out;
4192
+ ${(props) => props.$animate && "transition: top 150ms ease, background 0.15s ease-in-out;"}
4193
+ @media (prefers-reduced-motion: reduce) {
4194
+ transition: background 0.15s ease-in-out;
4195
+ }
3980
4196
  ${(props) => props.$isSelected && `background: ${props.theme.selectedTrackControlsBackground};`}
3981
4197
  `;
3982
4198
  var CustomPlayhead = ({ renderPlayhead, color, samplesPerPixel, sampleRate }) => {
@@ -4011,6 +4227,133 @@ function getTrackChannelCount(trackClipPeaks, recordingState, trackId, mono) {
4011
4227
  const recordingChannels = (recordingState == null ? void 0 : recordingState.isRecording) && recordingState.trackId === trackId ? mono ? 1 : recordingState.peaks.length : 0;
4012
4228
  return Math.max(clipChannels, recordingChannels);
4013
4229
  }
4230
+ function DefaultTrackControls({
4231
+ trackIndex,
4232
+ track,
4233
+ trackState,
4234
+ effectiveRenderMode,
4235
+ selectTrack,
4236
+ onRemoveTrack,
4237
+ setTrackMute,
4238
+ setTrackSolo,
4239
+ setTrackVolume,
4240
+ setTrackPan,
4241
+ spectrogram,
4242
+ setSettingsModalTrackId,
4243
+ trackReordering,
4244
+ reorderTrack,
4245
+ trackCount,
4246
+ gripRef
4247
+ }) {
4248
+ return /* @__PURE__ */ jsxs2(
4249
+ Controls,
4250
+ {
4251
+ onClick: () => selectTrack(trackIndex),
4252
+ style: trackReordering ? { position: "relative", paddingLeft: 18, paddingRight: 18 } : void 0,
4253
+ children: [
4254
+ /* @__PURE__ */ jsxs2(Header, { style: { justifyContent: "center", position: "relative" }, children: [
4255
+ onRemoveTrack && /* @__PURE__ */ jsx10(
4256
+ CloseButton,
4257
+ {
4258
+ onClick: (e) => {
4259
+ e.stopPropagation();
4260
+ onRemoveTrack(trackIndex);
4261
+ }
4262
+ }
4263
+ ),
4264
+ /* @__PURE__ */ jsx10(
4265
+ "span",
4266
+ {
4267
+ style: {
4268
+ overflow: "hidden",
4269
+ textOverflow: "ellipsis",
4270
+ whiteSpace: "nowrap",
4271
+ padding: "0 24px",
4272
+ display: "block"
4273
+ },
4274
+ children: trackState.name || `Track ${trackIndex + 1}`
4275
+ }
4276
+ ),
4277
+ (spectrogram == null ? void 0 : spectrogram.renderMenuItems) && /* @__PURE__ */ jsx10("span", { style: { position: "absolute", right: 0, top: 0 }, children: /* @__PURE__ */ jsx10(
4278
+ TrackMenu,
4279
+ {
4280
+ items: (onClose) => spectrogram.renderMenuItems({
4281
+ renderMode: effectiveRenderMode,
4282
+ onRenderModeChange: (mode) => spectrogram.setTrackRenderMode(track.id, mode),
4283
+ onOpenSettings: () => setSettingsModalTrackId(track.id),
4284
+ onClose
4285
+ })
4286
+ }
4287
+ ) })
4288
+ ] }),
4289
+ /* @__PURE__ */ jsxs2(ButtonGroup, { children: [
4290
+ /* @__PURE__ */ jsx10(
4291
+ Button,
4292
+ {
4293
+ $variant: trackState.muted ? "danger" : "outline",
4294
+ onClick: () => setTrackMute(trackIndex, !trackState.muted),
4295
+ children: "Mute"
4296
+ }
4297
+ ),
4298
+ /* @__PURE__ */ jsx10(
4299
+ Button,
4300
+ {
4301
+ $variant: trackState.soloed ? "info" : "outline",
4302
+ onClick: () => setTrackSolo(trackIndex, !trackState.soloed),
4303
+ children: "Solo"
4304
+ }
4305
+ )
4306
+ ] }),
4307
+ /* @__PURE__ */ jsxs2(SliderWrapper, { children: [
4308
+ /* @__PURE__ */ jsx10(VolumeDownIcon, {}),
4309
+ /* @__PURE__ */ jsx10(
4310
+ Slider,
4311
+ {
4312
+ min: "0",
4313
+ max: "1",
4314
+ step: "0.01",
4315
+ value: trackState.volume,
4316
+ onChange: (e) => setTrackVolume(trackIndex, parseFloat(e.target.value))
4317
+ }
4318
+ ),
4319
+ /* @__PURE__ */ jsx10(VolumeUpIcon, {})
4320
+ ] }),
4321
+ /* @__PURE__ */ jsxs2(SliderWrapper, { children: [
4322
+ /* @__PURE__ */ jsx10("span", { children: "L" }),
4323
+ /* @__PURE__ */ jsx10(
4324
+ Slider,
4325
+ {
4326
+ min: "-1",
4327
+ max: "1",
4328
+ step: "0.01",
4329
+ value: trackState.pan,
4330
+ onChange: (e) => setTrackPan(trackIndex, parseFloat(e.target.value))
4331
+ }
4332
+ ),
4333
+ /* @__PURE__ */ jsx10("span", { children: "R" })
4334
+ ] }),
4335
+ trackReordering && /* @__PURE__ */ jsx10(
4336
+ ReorderRail,
4337
+ {
4338
+ style: { position: "absolute", right: 2, top: "50%", transform: "translateY(-50%)" },
4339
+ gripRef,
4340
+ onGripClick: (e) => e.stopPropagation(),
4341
+ upDisabled: trackIndex === 0,
4342
+ downDisabled: trackIndex === trackCount - 1,
4343
+ onMoveUp: (e) => {
4344
+ e.stopPropagation();
4345
+ reorderTrack(track.id, trackIndex - 1);
4346
+ },
4347
+ onMoveDown: (e) => {
4348
+ e.stopPropagation();
4349
+ reorderTrack(track.id, trackIndex + 1);
4350
+ }
4351
+ }
4352
+ )
4353
+ ]
4354
+ }
4355
+ );
4356
+ }
4014
4357
  var PlaylistVisualization = ({
4015
4358
  renderTrackControls,
4016
4359
  renderTick,
@@ -4023,7 +4366,8 @@ var PlaylistVisualization = ({
4023
4366
  showFades = false,
4024
4367
  touchOptimized = false,
4025
4368
  onRemoveTrack,
4026
- recordingState
4369
+ recordingState,
4370
+ trackReordering = false
4027
4371
  }) => {
4028
4372
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
4029
4373
  const theme = useTheme2();
@@ -4057,7 +4401,8 @@ var PlaylistVisualization = ({
4057
4401
  setSelectedTrackId,
4058
4402
  setCurrentTime,
4059
4403
  setLoopRegion,
4060
- setRecordingActive
4404
+ setRecordingActive,
4405
+ reorderTrack
4061
4406
  } = usePlaylistControls();
4062
4407
  const {
4063
4408
  peaksDataArray,
@@ -4073,12 +4418,14 @@ var PlaylistVisualization = ({
4073
4418
  barGap,
4074
4419
  roundedBars,
4075
4420
  isReady,
4076
- mono
4421
+ trackReorderEpoch,
4422
+ mono,
4423
+ trackDragPreview
4077
4424
  } = usePlaylistData();
4078
4425
  const spectrogram = useContext6(SpectrogramIntegrationContext);
4079
4426
  const recordingActive = !!(recordingState == null ? void 0 : recordingState.isRecording);
4080
4427
  const armedTrackId = (_a = recordingState == null ? void 0 : recordingState.trackId) != null ? _a : null;
4081
- useEffect10(() => {
4428
+ useEffect12(() => {
4082
4429
  if (!recordingActive) return void 0;
4083
4430
  setRecordingActive(true, armedTrackId);
4084
4431
  return () => setRecordingActive(false);
@@ -4102,11 +4449,11 @@ var PlaylistVisualization = ({
4102
4449
  });
4103
4450
  return helpers;
4104
4451
  }, [tracks, spectrogram]);
4105
- const [settingsModalTrackId, setSettingsModalTrackId] = useState11(null);
4106
- const [isSelecting, setIsSelecting] = useState11(false);
4107
- const mouseDownTimeRef = useRef14(0);
4108
- const scrollContainerRef = useRef14(null);
4109
- const handleScrollContainerRef = useCallback16(
4452
+ const [settingsModalTrackId, setSettingsModalTrackId] = useState12(null);
4453
+ const [isSelecting, setIsSelecting] = useState12(false);
4454
+ const mouseDownTimeRef = useRef15(0);
4455
+ const scrollContainerRef = useRef15(null);
4456
+ const handleScrollContainerRef = useCallback17(
4110
4457
  (element) => {
4111
4458
  scrollContainerRef.current = element;
4112
4459
  setScrollContainer(element);
@@ -4144,7 +4491,7 @@ var PlaylistVisualization = ({
4144
4491
  );
4145
4492
  }
4146
4493
  });
4147
- const selectTrack = useCallback16(
4494
+ const selectTrack = useCallback17(
4148
4495
  (trackIndex) => {
4149
4496
  if (trackIndex >= 0 && trackIndex < tracks.length) {
4150
4497
  const track = tracks[trackIndex];
@@ -4212,120 +4559,99 @@ var PlaylistVisualization = ({
4212
4559
  setSelection(start, end);
4213
4560
  }
4214
4561
  };
4562
+ const trackHeightById = useMemo5(() => {
4563
+ const m = /* @__PURE__ */ new Map();
4564
+ peaksDataArray.forEach((trackClipPeaks, trackIndex) => {
4565
+ const track = tracks[trackIndex];
4566
+ if (!track) return;
4567
+ const maxChannels = getTrackChannelCount(trackClipPeaks, recordingState, track.id, mono);
4568
+ m.set(track.id, waveHeight * maxChannels + (showClipHeaders ? CLIP_HEADER_HEIGHT : 0));
4569
+ });
4570
+ return m;
4571
+ }, [peaksDataArray, tracks, recordingState, mono, waveHeight, showClipHeaders]);
4572
+ const displayOrderIds = useMemo5(
4573
+ () => applyTrackOrderPreview(tracks, trackDragPreview).map((t) => t.id),
4574
+ [tracks, trackDragPreview]
4575
+ );
4576
+ const trackLayout = useMemo5(
4577
+ () => computeTrackLayout(displayOrderIds, trackHeightById),
4578
+ [displayOrderIds, trackHeightById]
4579
+ );
4580
+ const animateTrackLayout = useTrailingActive(trackDragPreview !== null, 200);
4215
4581
  const hasClips = tracks.some((track) => track.clips.length > 0);
4216
4582
  if (hasClips && peaksDataArray.length === 0) {
4217
- return /* @__PURE__ */ jsx9("div", { className, children: "Loading waveform..." });
4583
+ return /* @__PURE__ */ jsx10("div", { className, children: "Loading waveform..." });
4218
4584
  }
4219
- const trackControlsSlots = controls.show ? peaksDataArray.map((trackClipPeaks, trackIndex) => {
4220
- var _a2, _b2, _c2;
4221
- const track = tracks[trackIndex];
4222
- if (!track) return null;
4223
- const trackState = trackStates[trackIndex] || {
4224
- name: `Track ${trackIndex + 1}`,
4225
- muted: false,
4226
- soloed: false,
4227
- volume: 1,
4228
- pan: 0
4229
- };
4230
- const hasMidiNotes = track.clips.some((c) => c.midiNotes && c.midiNotes.length > 0);
4231
- const effectiveRenderMode = (_c2 = (_b2 = (_a2 = spectrogram == null ? void 0 : spectrogram.trackSpectrogramOverrides.get(track.id)) == null ? void 0 : _a2.renderMode) != null ? _b2 : track.renderMode) != null ? _c2 : hasMidiNotes ? "piano-roll" : "waveform";
4232
- const maxChannels = getTrackChannelCount(trackClipPeaks, recordingState, track.id, mono);
4233
- const slotHeight = waveHeight * maxChannels + (showClipHeaders ? CLIP_HEADER_HEIGHT : 0);
4234
- const trackControlContent = renderTrackControls ? renderTrackControls(trackIndex) : /* @__PURE__ */ jsxs2(Controls, { onClick: () => selectTrack(trackIndex), children: [
4235
- /* @__PURE__ */ jsxs2(Header, { style: { justifyContent: "center", position: "relative" }, children: [
4236
- onRemoveTrack && /* @__PURE__ */ jsx9(
4237
- CloseButton,
4238
- {
4239
- onClick: (e) => {
4240
- e.stopPropagation();
4241
- onRemoveTrack(trackIndex);
4242
- }
4243
- }
4244
- ),
4245
- /* @__PURE__ */ jsx9(
4246
- "span",
4247
- {
4248
- style: {
4249
- overflow: "hidden",
4250
- textOverflow: "ellipsis",
4251
- whiteSpace: "nowrap",
4252
- padding: "0 24px",
4253
- display: "block"
4254
- },
4255
- children: trackState.name || `Track ${trackIndex + 1}`
4256
- }
4257
- ),
4258
- (spectrogram == null ? void 0 : spectrogram.renderMenuItems) && /* @__PURE__ */ jsx9("span", { style: { position: "absolute", right: 0, top: 0 }, children: /* @__PURE__ */ jsx9(
4259
- TrackMenu,
4260
- {
4261
- items: (onClose) => spectrogram.renderMenuItems({
4262
- renderMode: effectiveRenderMode,
4263
- onRenderModeChange: (mode) => spectrogram.setTrackRenderMode(track.id, mode),
4264
- onOpenSettings: () => setSettingsModalTrackId(track.id),
4265
- onClose
4266
- })
4267
- }
4268
- ) })
4269
- ] }),
4270
- /* @__PURE__ */ jsxs2(ButtonGroup, { children: [
4271
- /* @__PURE__ */ jsx9(
4272
- Button,
4273
- {
4274
- $variant: trackState.muted ? "danger" : "outline",
4275
- onClick: () => setTrackMute(trackIndex, !trackState.muted),
4276
- children: "Mute"
4277
- }
4278
- ),
4279
- /* @__PURE__ */ jsx9(
4280
- Button,
4585
+ const trackControlsSlots = controls.show ? [
4586
+ /* @__PURE__ */ jsx10(TracksLayout, { $height: trackLayout.totalHeight, children: peaksDataArray.map((trackClipPeaks, trackIndex) => {
4587
+ var _a2, _b2, _c2, _d2, _e2;
4588
+ const track = tracks[trackIndex];
4589
+ if (!track) return null;
4590
+ const trackState = trackStates[trackIndex] || {
4591
+ name: `Track ${trackIndex + 1}`,
4592
+ muted: false,
4593
+ soloed: false,
4594
+ volume: 1,
4595
+ pan: 0
4596
+ };
4597
+ const hasMidiNotes = track.clips.some((c) => c.midiNotes && c.midiNotes.length > 0);
4598
+ const effectiveRenderMode = (_c2 = (_b2 = (_a2 = spectrogram == null ? void 0 : spectrogram.trackSpectrogramOverrides.get(track.id)) == null ? void 0 : _a2.renderMode) != null ? _b2 : track.renderMode) != null ? _c2 : hasMidiNotes ? "piano-roll" : "waveform";
4599
+ const slotHeight = (_d2 = trackHeightById.get(track.id)) != null ? _d2 : 0;
4600
+ const defaultControlProps = {
4601
+ trackIndex,
4602
+ track,
4603
+ trackState,
4604
+ effectiveRenderMode,
4605
+ selectTrack,
4606
+ onRemoveTrack,
4607
+ setTrackMute,
4608
+ setTrackSolo,
4609
+ setTrackVolume,
4610
+ setTrackPan,
4611
+ spectrogram,
4612
+ setSettingsModalTrackId,
4613
+ trackReordering,
4614
+ reorderTrack,
4615
+ trackCount: peaksDataArray.length
4616
+ };
4617
+ const trackControlContent = renderTrackControls ? renderTrackControls(trackIndex) : trackReordering ? /* @__PURE__ */ jsx10(SortableTrackControls, { trackId: track.id, index: trackIndex, children: ({ ref, handleRef, isDragSource }) => /* @__PURE__ */ jsx10(
4618
+ "div",
4619
+ {
4620
+ ref,
4621
+ style: {
4622
+ height: "100%",
4623
+ boxShadow: isDragSource ? DRAG_SOURCE_SHADOW : void 0,
4624
+ // Opaque background for the floating (top-layer, popover-based)
4625
+ // drag-source row — without it the row underneath shows through.
4626
+ // onDragStart selects the dragged track, so its slot always shows
4627
+ // the selected-track background while lifted.
4628
+ background: isDragSource ? theme.selectedTrackControlsBackground : void 0
4629
+ },
4630
+ children: /* @__PURE__ */ jsx10(DefaultTrackControls, __spreadProps(__spreadValues({}, defaultControlProps), { gripRef: handleRef }))
4631
+ }
4632
+ ) }) : /* @__PURE__ */ jsx10(DefaultTrackControls, __spreadValues({}, defaultControlProps));
4633
+ return (
4634
+ // key includes trackReorderEpoch: forces a remount after every
4635
+ // track-reorder drag, discarding @dnd-kit sortable-plugin DOM
4636
+ // corruption (see bumpTrackReorderEpoch's doc comment in
4637
+ // WaveformPlaylistContext). Stays at `-0` — a no-op suffix — for
4638
+ // consumers that never enable trackReordering.
4639
+ /* @__PURE__ */ jsx10(
4640
+ ControlSlot,
4281
4641
  {
4282
- $variant: trackState.soloed ? "info" : "outline",
4283
- onClick: () => setTrackSolo(trackIndex, !trackState.soloed),
4284
- children: "Solo"
4285
- }
4642
+ $height: slotHeight,
4643
+ $top: (_e2 = trackLayout.topById.get(track.id)) != null ? _e2 : 0,
4644
+ $animate: animateTrackLayout,
4645
+ $isSelected: track.id === selectedTrackId,
4646
+ children: trackControlContent
4647
+ },
4648
+ `${track.id}-${trackReorderEpoch}`
4286
4649
  )
4287
- ] }),
4288
- /* @__PURE__ */ jsxs2(SliderWrapper, { children: [
4289
- /* @__PURE__ */ jsx9(VolumeDownIcon, {}),
4290
- /* @__PURE__ */ jsx9(
4291
- Slider,
4292
- {
4293
- min: "0",
4294
- max: "1",
4295
- step: "0.01",
4296
- value: trackState.volume,
4297
- onChange: (e) => setTrackVolume(trackIndex, parseFloat(e.target.value))
4298
- }
4299
- ),
4300
- /* @__PURE__ */ jsx9(VolumeUpIcon, {})
4301
- ] }),
4302
- /* @__PURE__ */ jsxs2(SliderWrapper, { children: [
4303
- /* @__PURE__ */ jsx9("span", { children: "L" }),
4304
- /* @__PURE__ */ jsx9(
4305
- Slider,
4306
- {
4307
- min: "-1",
4308
- max: "1",
4309
- step: "0.01",
4310
- value: trackState.pan,
4311
- onChange: (e) => setTrackPan(trackIndex, parseFloat(e.target.value))
4312
- }
4313
- ),
4314
- /* @__PURE__ */ jsx9("span", { children: "R" })
4315
- ] })
4316
- ] });
4317
- return /* @__PURE__ */ jsx9(
4318
- ControlSlot,
4319
- {
4320
- $height: slotHeight,
4321
- $isSelected: track.id === selectedTrackId,
4322
- children: trackControlContent
4323
- },
4324
- track.id
4325
- );
4326
- }) : void 0;
4650
+ );
4651
+ }) }, "control-slots-layout")
4652
+ ] : void 0;
4327
4653
  return /* @__PURE__ */ jsxs2(DevicePixelRatioProvider, { children: [
4328
- /* @__PURE__ */ jsx9(
4654
+ /* @__PURE__ */ jsx10(
4329
4655
  PlaylistInfoContext.Provider,
4330
4656
  {
4331
4657
  value: {
@@ -4340,7 +4666,7 @@ var PlaylistVisualization = ({
4340
4666
  barGap,
4341
4667
  roundedBars
4342
4668
  },
4343
- children: /* @__PURE__ */ jsx9(
4669
+ children: /* @__PURE__ */ jsx10(
4344
4670
  Playlist,
4345
4671
  {
4346
4672
  theme,
@@ -4357,9 +4683,9 @@ var PlaylistVisualization = ({
4357
4683
  "data-playlist-state": isReady ? "ready" : "loading",
4358
4684
  trackControlsSlots,
4359
4685
  timescaleGapHeight: timeScaleHeight > 0 ? timeScaleHeight + 1 : 0,
4360
- timescale: timeScaleHeight > 0 ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
4361
- /* @__PURE__ */ jsx9(SmartScale, { renderTick }),
4362
- isLoopEnabled && /* @__PURE__ */ jsx9(
4686
+ timescale: timeScaleHeight > 0 ? /* @__PURE__ */ jsxs2(Fragment3, { children: [
4687
+ /* @__PURE__ */ jsx10(SmartScale, { renderTick }),
4688
+ isLoopEnabled && /* @__PURE__ */ jsx10(
4363
4689
  TimescaleLoopRegion,
4364
4690
  {
4365
4691
  startPosition: Math.min(loopStart, loopEnd) * sampleRate / samplesPerPixel,
@@ -4376,9 +4702,9 @@ var PlaylistVisualization = ({
4376
4702
  }
4377
4703
  )
4378
4704
  ] }) : void 0,
4379
- children: /* @__PURE__ */ jsxs2(Fragment2, { children: [
4380
- peaksDataArray.map((trackClipPeaks, trackIndex) => {
4381
- var _a2, _b2, _c2, _d2;
4705
+ children: /* @__PURE__ */ jsxs2(Fragment3, { children: [
4706
+ /* @__PURE__ */ jsx10(TracksLayout, { $height: trackLayout.totalHeight, children: peaksDataArray.map((trackClipPeaks, trackIndex) => {
4707
+ var _a2, _b2, _c2, _d2, _e2;
4382
4708
  const track = tracks[trackIndex];
4383
4709
  if (!track) return null;
4384
4710
  const hasMidiNotes = track.clips.some((c) => c.midiNotes && c.midiNotes.length > 0);
@@ -4389,153 +4715,163 @@ var PlaylistVisualization = ({
4389
4715
  track.id,
4390
4716
  mono
4391
4717
  );
4392
- return /* @__PURE__ */ jsxs2(
4393
- TrackComponent,
4718
+ return /* @__PURE__ */ jsx10(
4719
+ TrackRowPositioner,
4394
4720
  {
4395
- numChannels: maxChannels,
4396
- backgroundColor: effectiveRenderMode === "piano-roll" ? theme.pianoRollBackgroundColor || "#1a1a2e" : waveformColorToCss2(theme.waveOutlineColor),
4397
- offset: 0,
4398
- width: tracksFullWidth,
4399
- hasClipHeaders: showClipHeaders,
4400
- trackId: track.id,
4401
- isSelected: track.id === selectedTrackId,
4402
- children: [
4403
- effectiveRenderMode !== "waveform" && (() => {
4404
- var _a3, _b3;
4405
- const helpers = perTrackSpectrogramHelpers.get(track.id);
4406
- const trackCfg = helpers == null ? void 0 : helpers.config;
4407
- if (!(trackCfg == null ? void 0 : trackCfg.labels) || !helpers) return null;
4408
- return /* @__PURE__ */ jsx9(
4409
- SpectrogramLabels,
4410
- {
4411
- waveHeight,
4412
- numChannels: maxChannels,
4413
- frequencyScaleFn: helpers.frequencyScaleFn,
4414
- minFrequency: (_a3 = trackCfg.minFrequency) != null ? _a3 : 0,
4415
- maxFrequency: (_b3 = trackCfg.maxFrequency) != null ? _b3 : sampleRate / 2,
4416
- labelsColor: trackCfg.labelsColor,
4417
- labelsBackground: trackCfg.labelsBackground,
4418
- renderMode: effectiveRenderMode,
4419
- hasClipHeaders: showClipHeaders
4420
- }
4421
- );
4422
- })(),
4423
- trackClipPeaks.map((clip, clipIndex) => {
4424
- const peaksData = clip.peaks;
4425
- const width = peaksData.length;
4426
- return /* @__PURE__ */ jsx9(
4427
- Clip,
4428
- {
4429
- clipId: clip.clipId,
4430
- trackIndex,
4431
- clipIndex,
4432
- trackName: clip.trackName,
4433
- startSample: clip.startSample,
4434
- durationSamples: clip.durationSamples,
4435
- samplesPerPixel,
4436
- showHeader: showClipHeaders,
4437
- disableHeaderDrag: !interactiveClips,
4438
- isSelected: track.id === selectedTrackId,
4439
- trackId: track.id,
4440
- fadeIn: clip.fadeIn,
4441
- fadeOut: clip.fadeOut,
4442
- sampleRate,
4443
- showFades,
4444
- touchOptimized,
4445
- onMouseDown: (e) => {
4446
- const target = e.target;
4447
- const isDraggable = target.closest(
4448
- '[role="button"][aria-roledescription="draggable"]'
4449
- );
4450
- if (isDraggable) {
4451
- return;
4721
+ $top: (_d2 = trackLayout.topById.get(track.id)) != null ? _d2 : 0,
4722
+ $animate: animateTrackLayout,
4723
+ "data-track-row": "",
4724
+ "data-track-id": track.id,
4725
+ "data-track-drag-source": (trackDragPreview == null ? void 0 : trackDragPreview.trackId) === track.id ? "true" : void 0,
4726
+ children: /* @__PURE__ */ jsxs2(
4727
+ TrackComponent,
4728
+ {
4729
+ numChannels: maxChannels,
4730
+ backgroundColor: effectiveRenderMode === "piano-roll" ? theme.pianoRollBackgroundColor || "#1a1a2e" : waveformColorToCss2(theme.waveOutlineColor),
4731
+ offset: 0,
4732
+ width: tracksFullWidth,
4733
+ hasClipHeaders: showClipHeaders,
4734
+ trackId: track.id,
4735
+ isSelected: track.id === selectedTrackId,
4736
+ children: [
4737
+ effectiveRenderMode !== "waveform" && (() => {
4738
+ var _a3, _b3;
4739
+ const helpers = perTrackSpectrogramHelpers.get(track.id);
4740
+ const trackCfg = helpers == null ? void 0 : helpers.config;
4741
+ if (!(trackCfg == null ? void 0 : trackCfg.labels) || !helpers) return null;
4742
+ return /* @__PURE__ */ jsx10(
4743
+ SpectrogramLabels,
4744
+ {
4745
+ waveHeight,
4746
+ numChannels: maxChannels,
4747
+ frequencyScaleFn: helpers.frequencyScaleFn,
4748
+ minFrequency: (_a3 = trackCfg.minFrequency) != null ? _a3 : 0,
4749
+ maxFrequency: (_b3 = trackCfg.maxFrequency) != null ? _b3 : sampleRate / 2,
4750
+ labelsColor: trackCfg.labelsColor,
4751
+ labelsBackground: trackCfg.labelsBackground,
4752
+ renderMode: effectiveRenderMode,
4753
+ hasClipHeaders: showClipHeaders
4452
4754
  }
4453
- selectTrack(trackIndex);
4454
- },
4455
- children: peaksData.data.map((channelPeaks, channelIndex) => {
4456
- return /* @__PURE__ */ jsx9(
4457
- ChannelWithProgress,
4458
- {
4459
- index: channelIndex,
4460
- data: channelPeaks,
4461
- bits: peaksData.bits,
4462
- length: width,
4463
- isSelected: track.id === selectedTrackId,
4464
- clipStartSample: clip.startSample,
4465
- clipDurationSamples: clip.durationSamples,
4466
- renderMode: clip.midiNotes ? "piano-roll" : effectiveRenderMode,
4467
- midiNotes: clip.midiNotes,
4468
- clipSampleRate: clip.sampleRate,
4469
- clipOffsetSeconds: clip.offsetSamples != null ? clip.offsetSamples / (clip.sampleRate || sampleRate) : 0,
4470
- samplesPerPixel,
4471
- spectrogramClipId: clip.clipId,
4472
- spectrogramOnCanvasRegister: spectrogram ? spectrogram.registerSpectrogramCanvas : void 0,
4473
- spectrogramOnCanvasUnregister: spectrogram ? spectrogram.unregisterSpectrogramCanvas : void 0
4755
+ );
4756
+ })(),
4757
+ trackClipPeaks.map((clip, clipIndex) => {
4758
+ const peaksData = clip.peaks;
4759
+ const width = peaksData.length;
4760
+ return /* @__PURE__ */ jsx10(
4761
+ Clip,
4762
+ {
4763
+ clipId: clip.clipId,
4764
+ trackIndex,
4765
+ clipIndex,
4766
+ trackName: clip.trackName,
4767
+ startSample: clip.startSample,
4768
+ durationSamples: clip.durationSamples,
4769
+ samplesPerPixel,
4770
+ showHeader: showClipHeaders,
4771
+ disableHeaderDrag: !interactiveClips,
4772
+ isSelected: track.id === selectedTrackId,
4773
+ trackId: track.id,
4774
+ fadeIn: clip.fadeIn,
4775
+ fadeOut: clip.fadeOut,
4776
+ sampleRate,
4777
+ showFades,
4778
+ touchOptimized,
4779
+ onMouseDown: (e) => {
4780
+ const target = e.target;
4781
+ const isDraggable = target.closest(
4782
+ '[role="button"][aria-roledescription="draggable"]'
4783
+ );
4784
+ if (isDraggable) {
4785
+ return;
4786
+ }
4787
+ selectTrack(trackIndex);
4474
4788
  },
4475
- `${clip.clipId}-${channelIndex}`
4476
- );
4477
- })
4478
- },
4479
- clip.clipId
4480
- );
4481
- }),
4482
- (recordingState == null ? void 0 : recordingState.isRecording) && recordingState.trackId === track.id && ((_d2 = recordingState.peaks[0]) == null ? void 0 : _d2.length) > 0 && (() => {
4483
- const latencyOffsetSamples = resolveRecordingOffsetSamples({
4484
- overrideSeconds: recordingState.latencyOffset,
4485
- outputLatency: getOutputLatency(),
4486
- lookAhead: getLookAhead(),
4487
- sampleRate
4488
- });
4489
- const latencyPixels = Math.floor(latencyOffsetSamples / samplesPerPixel);
4490
- const skipPeakElements = latencyPixels * 2;
4491
- const previewDuration = Math.max(
4492
- 0,
4493
- recordingState.durationSamples - latencyOffsetSamples
4494
- );
4495
- const previewChannels = (mono ? recordingState.peaks.slice(0, 1) : recordingState.peaks).map(
4496
- (channelPeaks) => skipPeakElements > 0 && skipPeakElements < channelPeaks.length ? channelPeaks.subarray(skipPeakElements) : channelPeaks
4497
- );
4498
- return /* @__PURE__ */ jsx9(
4499
- Clip,
4500
- {
4501
- clipId: "recording-preview",
4502
- trackIndex,
4503
- clipIndex: trackClipPeaks.length,
4504
- trackName: "Recording...",
4505
- startSample: recordingState.startSample,
4506
- durationSamples: previewDuration,
4507
- samplesPerPixel,
4508
- showHeader: showClipHeaders,
4509
- disableHeaderDrag: true,
4510
- isSelected: track.id === selectedTrackId,
4511
- trackId: track.id,
4512
- children: previewChannels.map((channelPeaks, chIdx) => /* @__PURE__ */ jsx9(
4513
- ChannelWithProgress,
4789
+ children: peaksData.data.map((channelPeaks, channelIndex) => {
4790
+ return /* @__PURE__ */ jsx10(
4791
+ ChannelWithProgress,
4792
+ {
4793
+ index: channelIndex,
4794
+ data: channelPeaks,
4795
+ bits: peaksData.bits,
4796
+ length: width,
4797
+ isSelected: track.id === selectedTrackId,
4798
+ clipStartSample: clip.startSample,
4799
+ clipDurationSamples: clip.durationSamples,
4800
+ renderMode: clip.midiNotes ? "piano-roll" : effectiveRenderMode,
4801
+ midiNotes: clip.midiNotes,
4802
+ clipSampleRate: clip.sampleRate,
4803
+ clipOffsetSeconds: clip.offsetSamples != null ? clip.offsetSamples / (clip.sampleRate || sampleRate) : 0,
4804
+ samplesPerPixel,
4805
+ spectrogramClipId: clip.clipId,
4806
+ spectrogramOnCanvasRegister: spectrogram ? spectrogram.registerSpectrogramCanvas : void 0,
4807
+ spectrogramOnCanvasUnregister: spectrogram ? spectrogram.unregisterSpectrogramCanvas : void 0
4808
+ },
4809
+ `${clip.clipId}-${channelIndex}`
4810
+ );
4811
+ })
4812
+ },
4813
+ clip.clipId
4814
+ );
4815
+ }),
4816
+ (recordingState == null ? void 0 : recordingState.isRecording) && recordingState.trackId === track.id && ((_e2 = recordingState.peaks[0]) == null ? void 0 : _e2.length) > 0 && (() => {
4817
+ const latencyOffsetSamples = resolveRecordingOffsetSamples({
4818
+ overrideSeconds: recordingState.latencyOffset,
4819
+ outputLatency: getOutputLatency(),
4820
+ lookAhead: getLookAhead(),
4821
+ sampleRate
4822
+ });
4823
+ const latencyPixels = Math.floor(latencyOffsetSamples / samplesPerPixel);
4824
+ const skipPeakElements = latencyPixels * 2;
4825
+ const previewDuration = Math.max(
4826
+ 0,
4827
+ recordingState.durationSamples - latencyOffsetSamples
4828
+ );
4829
+ const previewChannels = (mono ? recordingState.peaks.slice(0, 1) : recordingState.peaks).map(
4830
+ (channelPeaks) => skipPeakElements > 0 && skipPeakElements < channelPeaks.length ? channelPeaks.subarray(skipPeakElements) : channelPeaks
4831
+ );
4832
+ return /* @__PURE__ */ jsx10(
4833
+ Clip,
4514
4834
  {
4515
- index: chIdx,
4516
- data: channelPeaks,
4517
- bits: recordingState.bits,
4518
- length: Math.floor(channelPeaks.length / 2),
4835
+ clipId: "recording-preview",
4836
+ trackIndex,
4837
+ clipIndex: trackClipPeaks.length,
4838
+ trackName: "Recording...",
4839
+ startSample: recordingState.startSample,
4840
+ durationSamples: previewDuration,
4841
+ samplesPerPixel,
4842
+ showHeader: showClipHeaders,
4843
+ disableHeaderDrag: true,
4519
4844
  isSelected: track.id === selectedTrackId,
4520
- clipStartSample: recordingState.startSample,
4521
- clipDurationSamples: previewDuration
4845
+ trackId: track.id,
4846
+ children: previewChannels.map((channelPeaks, chIdx) => /* @__PURE__ */ jsx10(
4847
+ ChannelWithProgress,
4848
+ {
4849
+ index: chIdx,
4850
+ data: channelPeaks,
4851
+ bits: recordingState.bits,
4852
+ length: Math.floor(channelPeaks.length / 2),
4853
+ isSelected: track.id === selectedTrackId,
4854
+ clipStartSample: recordingState.startSample,
4855
+ clipDurationSamples: previewDuration
4856
+ },
4857
+ `${track.id}-recording-${chIdx}`
4858
+ ))
4522
4859
  },
4523
- `${track.id}-recording-${chIdx}`
4524
- ))
4525
- },
4526
- `${track.id}-recording`
4527
- );
4528
- })()
4529
- ]
4860
+ `${track.id}-recording`
4861
+ );
4862
+ })()
4863
+ ]
4864
+ }
4865
+ )
4530
4866
  },
4531
4867
  track.id
4532
4868
  );
4533
- }),
4534
- annotations.length > 0 && annotationIntegration && /* @__PURE__ */ jsx9(annotationIntegration.AnnotationBoxesWrapper, { height: 30, width: tracksFullWidth, children: annotations.map((annotation, index) => {
4869
+ }) }),
4870
+ annotations.length > 0 && annotationIntegration && /* @__PURE__ */ jsx10(annotationIntegration.AnnotationBoxesWrapper, { height: 30, width: tracksFullWidth, children: annotations.map((annotation, index) => {
4535
4871
  const startPosition = annotation.start * sampleRate / samplesPerPixel;
4536
4872
  const endPosition = annotation.end * sampleRate / samplesPerPixel;
4537
4873
  const label = getAnnotationBoxLabel ? getAnnotationBoxLabel(annotation, index) : annotation.id;
4538
- return /* @__PURE__ */ jsx9(
4874
+ return /* @__PURE__ */ jsx10(
4539
4875
  annotationIntegration.AnnotationBox,
4540
4876
  {
4541
4877
  annotationId: annotation.id,
@@ -4551,7 +4887,7 @@ var PlaylistVisualization = ({
4551
4887
  annotation.id
4552
4888
  );
4553
4889
  }) }),
4554
- selectionStart !== selectionEnd && /* @__PURE__ */ jsx9(
4890
+ selectionStart !== selectionEnd && /* @__PURE__ */ jsx10(
4555
4891
  Selection,
4556
4892
  {
4557
4893
  startPosition: Math.min(selectionStart, selectionEnd) * sampleRate / samplesPerPixel,
@@ -4559,7 +4895,7 @@ var PlaylistVisualization = ({
4559
4895
  color: theme.selectionColor
4560
4896
  }
4561
4897
  ),
4562
- (isPlaying || selectionStart === selectionEnd) && (renderPlayhead ? /* @__PURE__ */ jsx9(
4898
+ (isPlaying || selectionStart === selectionEnd) && (renderPlayhead ? /* @__PURE__ */ jsx10(
4563
4899
  CustomPlayhead,
4564
4900
  {
4565
4901
  renderPlayhead,
@@ -4567,14 +4903,14 @@ var PlaylistVisualization = ({
4567
4903
  samplesPerPixel,
4568
4904
  sampleRate
4569
4905
  }
4570
- ) : /* @__PURE__ */ jsx9(AnimatedPlayhead, { color: theme.playheadColor }))
4906
+ ) : /* @__PURE__ */ jsx10(AnimatedPlayhead, { color: theme.playheadColor }))
4571
4907
  ] })
4572
4908
  }
4573
4909
  )
4574
4910
  }
4575
4911
  ),
4576
4912
  (spectrogram == null ? void 0 : spectrogram.SettingsModal) && typeof document !== "undefined" && createPortal(
4577
- /* @__PURE__ */ jsx9(
4913
+ /* @__PURE__ */ jsx10(
4578
4914
  spectrogram.SettingsModal,
4579
4915
  {
4580
4916
  open: settingsModalTrackId !== null,
@@ -4594,8 +4930,8 @@ var PlaylistVisualization = ({
4594
4930
  };
4595
4931
 
4596
4932
  // src/components/PlaylistAnnotationList.tsx
4597
- import { useCallback as useCallback17 } from "react";
4598
- import { jsx as jsx10 } from "react/jsx-runtime";
4933
+ import { useCallback as useCallback18 } from "react";
4934
+ import { jsx as jsx11 } from "react/jsx-runtime";
4599
4935
  var PlaylistAnnotationList = ({
4600
4936
  height,
4601
4937
  renderAnnotationItem,
@@ -4609,7 +4945,7 @@ var PlaylistAnnotationList = ({
4609
4945
  const integration = useAnnotationIntegration();
4610
4946
  const { setAnnotations } = usePlaylistControls();
4611
4947
  const resolvedConfig = annotationListConfig != null ? annotationListConfig : { linkEndpoints, continuousPlay };
4612
- const handleAnnotationUpdate = useCallback17(
4948
+ const handleAnnotationUpdate = useCallback18(
4613
4949
  (updatedAnnotations) => {
4614
4950
  setAnnotations(updatedAnnotations);
4615
4951
  onAnnotationUpdate == null ? void 0 : onAnnotationUpdate(updatedAnnotations);
@@ -4617,7 +4953,7 @@ var PlaylistAnnotationList = ({
4617
4953
  [setAnnotations, onAnnotationUpdate]
4618
4954
  );
4619
4955
  const { AnnotationText } = integration;
4620
- return /* @__PURE__ */ jsx10(
4956
+ return /* @__PURE__ */ jsx11(
4621
4957
  AnnotationText,
4622
4958
  {
4623
4959
  annotations,
@@ -4636,7 +4972,7 @@ var PlaylistAnnotationList = ({
4636
4972
  };
4637
4973
 
4638
4974
  // src/components/Waveform.tsx
4639
- import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
4975
+ import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
4640
4976
  var Waveform = ({
4641
4977
  renderTrackControls,
4642
4978
  renderTick,
@@ -4655,13 +4991,14 @@ var Waveform = ({
4655
4991
  showFades = false,
4656
4992
  touchOptimized = false,
4657
4993
  onRemoveTrack,
4994
+ trackReordering = false,
4658
4995
  recordingState
4659
4996
  }) => {
4660
4997
  const { annotations } = usePlaylistState();
4661
4998
  const clipInteractionEnabled = useClipInteractionEnabled();
4662
4999
  const effectiveInteractiveClips = interactiveClips || clipInteractionEnabled;
4663
- return /* @__PURE__ */ jsxs3(Fragment3, { children: [
4664
- /* @__PURE__ */ jsx11(
5000
+ return /* @__PURE__ */ jsxs3(Fragment4, { children: [
5001
+ /* @__PURE__ */ jsx12(
4665
5002
  PlaylistVisualization,
4666
5003
  {
4667
5004
  renderTrackControls,
@@ -4675,10 +5012,11 @@ var Waveform = ({
4675
5012
  showFades,
4676
5013
  touchOptimized,
4677
5014
  onRemoveTrack,
5015
+ trackReordering,
4678
5016
  recordingState
4679
5017
  }
4680
5018
  ),
4681
- annotations.length > 0 && /* @__PURE__ */ jsx11(
5019
+ annotations.length > 0 && /* @__PURE__ */ jsx12(
4682
5020
  PlaylistAnnotationList,
4683
5021
  {
4684
5022
  height: annotationTextHeight,
@@ -4693,7 +5031,7 @@ var Waveform = ({
4693
5031
  };
4694
5032
 
4695
5033
  // src/components/MediaElementPlaylist.tsx
4696
- import { useContext as useContext7, useRef as useRef17, useState as useState12, useCallback as useCallback18 } from "react";
5034
+ import { useContext as useContext7, useRef as useRef18, useState as useState13, useCallback as useCallback19 } from "react";
4697
5035
  import { DragDropProvider } from "@dnd-kit/react";
4698
5036
  import { RestrictToHorizontalAxis } from "@dnd-kit/abstract/modifiers";
4699
5037
  import {
@@ -4729,9 +5067,9 @@ var noDropAnimationPlugins = (defaults) => {
4729
5067
  };
4730
5068
 
4731
5069
  // src/components/AnimatedMediaElementPlayhead.tsx
4732
- import { useRef as useRef15, useEffect as useEffect11 } from "react";
5070
+ import { useRef as useRef16, useEffect as useEffect13 } from "react";
4733
5071
  import styled5 from "styled-components";
4734
- import { jsx as jsx12 } from "react/jsx-runtime";
5072
+ import { jsx as jsx13 } from "react/jsx-runtime";
4735
5073
  var PlayheadLine2 = styled5.div`
4736
5074
  position: absolute;
4737
5075
  top: 0;
@@ -4746,11 +5084,11 @@ var PlayheadLine2 = styled5.div`
4746
5084
  var AnimatedMediaElementPlayhead = ({
4747
5085
  color = "#ff0000"
4748
5086
  }) => {
4749
- const playheadRef = useRef15(null);
4750
- const animationFrameRef = useRef15(null);
5087
+ const playheadRef = useRef16(null);
5088
+ const animationFrameRef = useRef16(null);
4751
5089
  const { isPlaying, currentTimeRef } = useMediaElementAnimation();
4752
5090
  const { samplesPerPixel, sampleRate, progressBarWidth } = useMediaElementData();
4753
- useEffect11(() => {
5091
+ useEffect13(() => {
4754
5092
  const updatePosition = () => {
4755
5093
  var _a;
4756
5094
  if (playheadRef.current) {
@@ -4774,7 +5112,7 @@ var AnimatedMediaElementPlayhead = ({
4774
5112
  }
4775
5113
  };
4776
5114
  }, [isPlaying, sampleRate, samplesPerPixel, currentTimeRef]);
4777
- useEffect11(() => {
5115
+ useEffect13(() => {
4778
5116
  var _a;
4779
5117
  if (!isPlaying && playheadRef.current) {
4780
5118
  const time = (_a = currentTimeRef.current) != null ? _a : 0;
@@ -4782,11 +5120,11 @@ var AnimatedMediaElementPlayhead = ({
4782
5120
  playheadRef.current.style.transform = `translate3d(${position}px, 0, 0)`;
4783
5121
  }
4784
5122
  });
4785
- return /* @__PURE__ */ jsx12(PlayheadLine2, { ref: playheadRef, $color: color, $width: progressBarWidth, "data-playhead": true });
5123
+ return /* @__PURE__ */ jsx13(PlayheadLine2, { ref: playheadRef, $color: color, $width: progressBarWidth, "data-playhead": true });
4786
5124
  };
4787
5125
 
4788
5126
  // src/components/ChannelWithMediaElementProgress.tsx
4789
- import { useRef as useRef16, useEffect as useEffect12 } from "react";
5127
+ import { useRef as useRef17, useEffect as useEffect14 } from "react";
4790
5128
  import styled6 from "styled-components";
4791
5129
  import {
4792
5130
  SmartChannel as SmartChannel2,
@@ -4794,7 +5132,7 @@ import {
4794
5132
  usePlaylistInfo as usePlaylistInfo2,
4795
5133
  waveformColorToCss as waveformColorToCss3
4796
5134
  } from "@waveform-playlist/ui-components";
4797
- import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
5135
+ import { jsx as jsx14, jsxs as jsxs4 } from "react/jsx-runtime";
4798
5136
  var ChannelWrapper2 = styled6.div`
4799
5137
  position: relative;
4800
5138
  `;
@@ -4831,14 +5169,14 @@ var ChannelWithMediaElementProgress = (_a) => {
4831
5169
  "clipStartSample",
4832
5170
  "clipDurationSamples"
4833
5171
  ]);
4834
- const progressRef = useRef16(null);
4835
- const animationFrameRef = useRef16(null);
5172
+ const progressRef = useRef17(null);
5173
+ const animationFrameRef = useRef17(null);
4836
5174
  const theme = useTheme3();
4837
5175
  const { waveHeight } = usePlaylistInfo2();
4838
5176
  const { isPlaying, currentTimeRef } = useMediaElementAnimation();
4839
5177
  const { samplesPerPixel, sampleRate } = useMediaElementData();
4840
5178
  const progressColor = (theme == null ? void 0 : theme.waveProgressColor) || "rgba(0, 0, 0, 0.1)";
4841
- useEffect12(() => {
5179
+ useEffect14(() => {
4842
5180
  const updateProgress = () => {
4843
5181
  var _a2;
4844
5182
  if (progressRef.current) {
@@ -4880,7 +5218,7 @@ var ChannelWithMediaElementProgress = (_a) => {
4880
5218
  smartChannelProps.length,
4881
5219
  currentTimeRef
4882
5220
  ]);
4883
- useEffect12(() => {
5221
+ useEffect14(() => {
4884
5222
  var _a2;
4885
5223
  if (!isPlaying && progressRef.current) {
4886
5224
  const currentTime = (_a2 = currentTimeRef.current) != null ? _a2 : 0;
@@ -4907,7 +5245,7 @@ var ChannelWithMediaElementProgress = (_a) => {
4907
5245
  }
4908
5246
  const backgroundCss = waveformColorToCss3(backgroundColor);
4909
5247
  return /* @__PURE__ */ jsxs4(ChannelWrapper2, { children: [
4910
- /* @__PURE__ */ jsx13(
5248
+ /* @__PURE__ */ jsx14(
4911
5249
  Background2,
4912
5250
  {
4913
5251
  $color: backgroundCss,
@@ -4916,7 +5254,7 @@ var ChannelWithMediaElementProgress = (_a) => {
4916
5254
  $width: smartChannelProps.length
4917
5255
  }
4918
5256
  ),
4919
- /* @__PURE__ */ jsx13(
5257
+ /* @__PURE__ */ jsx14(
4920
5258
  ProgressOverlay2,
4921
5259
  {
4922
5260
  ref: progressRef,
@@ -4925,12 +5263,12 @@ var ChannelWithMediaElementProgress = (_a) => {
4925
5263
  $top: smartChannelProps.index * waveHeight
4926
5264
  }
4927
5265
  ),
4928
- /* @__PURE__ */ jsx13(ChannelContainer2, { children: /* @__PURE__ */ jsx13(SmartChannel2, __spreadProps(__spreadValues({}, smartChannelProps), { isSelected: true, transparentBackground: true })) })
5266
+ /* @__PURE__ */ jsx14(ChannelContainer2, { children: /* @__PURE__ */ jsx14(SmartChannel2, __spreadProps(__spreadValues({}, smartChannelProps), { isSelected: true, transparentBackground: true })) })
4929
5267
  ] });
4930
5268
  };
4931
5269
 
4932
5270
  // src/components/MediaElementPlaylist.tsx
4933
- import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
5271
+ import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
4934
5272
  var ZERO_REF = { current: 0 };
4935
5273
  var CustomMediaElementPlayhead = ({ renderPlayhead, color, samplesPerPixel, sampleRate }) => {
4936
5274
  var _a;
@@ -4976,11 +5314,11 @@ var MediaElementPlaylist = ({
4976
5314
  fadeIn,
4977
5315
  fadeOut
4978
5316
  } = useMediaElementData();
4979
- const [selectionStart, setSelectionStart] = useState12(0);
4980
- const [selectionEnd, setSelectionEnd] = useState12(0);
4981
- const [isSelecting, setIsSelecting] = useState12(false);
4982
- const scrollContainerRef = useRef17(null);
4983
- const handleScrollContainerRef = useCallback18(
5317
+ const [selectionStart, setSelectionStart] = useState13(0);
5318
+ const [selectionEnd, setSelectionEnd] = useState13(0);
5319
+ const [isSelecting, setIsSelecting] = useState13(false);
5320
+ const scrollContainerRef = useRef18(null);
5321
+ const handleScrollContainerRef = useCallback19(
4984
5322
  (el) => {
4985
5323
  scrollContainerRef.current = el;
4986
5324
  setScrollContainer(el);
@@ -4988,7 +5326,7 @@ var MediaElementPlaylist = ({
4988
5326
  [setScrollContainer]
4989
5327
  );
4990
5328
  const tracksFullWidth = Math.floor(duration * sampleRate / samplesPerPixel);
4991
- const handleAnnotationClick = useCallback18(
5329
+ const handleAnnotationClick = useCallback19(
4992
5330
  (annotation) => __async(null, null, function* () {
4993
5331
  setActiveAnnotationId(annotation.id);
4994
5332
  try {
@@ -5003,7 +5341,7 @@ var MediaElementPlaylist = ({
5003
5341
  }),
5004
5342
  [setActiveAnnotationId, play]
5005
5343
  );
5006
- const handleAnnotationUpdate = useCallback18(
5344
+ const handleAnnotationUpdate = useCallback19(
5007
5345
  (updatedAnnotations) => {
5008
5346
  setAnnotations(updatedAnnotations);
5009
5347
  onAnnotationUpdate == null ? void 0 : onAnnotationUpdate(updatedAnnotations);
@@ -5017,8 +5355,8 @@ var MediaElementPlaylist = ({
5017
5355
  duration,
5018
5356
  linkEndpoints: linkEndpointsProp
5019
5357
  });
5020
- const mouseDownTimeRef = useRef17(0);
5021
- const handleMouseDown = useCallback18(
5358
+ const mouseDownTimeRef = useRef18(0);
5359
+ const handleMouseDown = useCallback19(
5022
5360
  (e) => {
5023
5361
  const rect = e.currentTarget.getBoundingClientRect();
5024
5362
  const x = e.clientX - rect.left;
@@ -5030,7 +5368,7 @@ var MediaElementPlaylist = ({
5030
5368
  },
5031
5369
  [samplesPerPixel, sampleRate]
5032
5370
  );
5033
- const handleMouseMove = useCallback18(
5371
+ const handleMouseMove = useCallback19(
5034
5372
  (e) => {
5035
5373
  if (!isSelecting) return;
5036
5374
  const rect = e.currentTarget.getBoundingClientRect();
@@ -5040,7 +5378,7 @@ var MediaElementPlaylist = ({
5040
5378
  },
5041
5379
  [isSelecting, samplesPerPixel, sampleRate]
5042
5380
  );
5043
- const handleMouseUp = useCallback18(
5381
+ const handleMouseUp = useCallback19(
5044
5382
  (e) => {
5045
5383
  if (!isSelecting) return;
5046
5384
  setIsSelecting(false);
@@ -5070,9 +5408,9 @@ var MediaElementPlaylist = ({
5070
5408
  [isSelecting, selectionStart, samplesPerPixel, sampleRate, seekTo, isPlaying, playoutRef, play]
5071
5409
  );
5072
5410
  if (peaksDataArray.length === 0) {
5073
- return /* @__PURE__ */ jsx14("div", { className, children: "Loading waveform..." });
5411
+ return /* @__PURE__ */ jsx15("div", { className, children: "Loading waveform..." });
5074
5412
  }
5075
- return /* @__PURE__ */ jsx14(DevicePixelRatioProvider2, { children: /* @__PURE__ */ jsx14(
5413
+ return /* @__PURE__ */ jsx15(DevicePixelRatioProvider2, { children: /* @__PURE__ */ jsx15(
5076
5414
  PlaylistInfoContext2.Provider,
5077
5415
  {
5078
5416
  value: {
@@ -5087,7 +5425,7 @@ var MediaElementPlaylist = ({
5087
5425
  barGap,
5088
5426
  roundedBars
5089
5427
  },
5090
- children: /* @__PURE__ */ jsx14(
5428
+ children: /* @__PURE__ */ jsx15(
5091
5429
  Playlist2,
5092
5430
  {
5093
5431
  theme,
@@ -5101,11 +5439,11 @@ var MediaElementPlaylist = ({
5101
5439
  onTracksMouseUp: handleMouseUp,
5102
5440
  scrollContainerRef: handleScrollContainerRef,
5103
5441
  isSelecting,
5104
- timescale: timeScaleHeight > 0 ? /* @__PURE__ */ jsx14(SmartScale2, {}) : void 0,
5105
- children: /* @__PURE__ */ jsxs5(Fragment4, { children: [
5442
+ timescale: timeScaleHeight > 0 ? /* @__PURE__ */ jsx15(SmartScale2, {}) : void 0,
5443
+ children: /* @__PURE__ */ jsxs5(Fragment5, { children: [
5106
5444
  peaksDataArray.map((trackClipPeaks, trackIndex) => {
5107
5445
  const maxChannels = trackClipPeaks.length > 0 ? Math.max(...trackClipPeaks.map((clip) => clip.peaks.data.length)) : 1;
5108
- return /* @__PURE__ */ jsx14(
5446
+ return /* @__PURE__ */ jsx15(
5109
5447
  TrackComponent2,
5110
5448
  {
5111
5449
  numChannels: maxChannels,
@@ -5133,7 +5471,7 @@ var MediaElementPlaylist = ({
5133
5471
  isSelected: true,
5134
5472
  trackId: `media-element-track-${trackIndex}`,
5135
5473
  children: [
5136
- peaksData.data.map((channelPeaks, channelIndex) => /* @__PURE__ */ jsx14(
5474
+ peaksData.data.map((channelPeaks, channelIndex) => /* @__PURE__ */ jsx15(
5137
5475
  ChannelWithMediaElementProgress,
5138
5476
  {
5139
5477
  index: channelIndex,
@@ -5145,7 +5483,7 @@ var MediaElementPlaylist = ({
5145
5483
  },
5146
5484
  `${trackIndex}-${clipIndex}-${channelIndex}`
5147
5485
  )),
5148
- showFades && fadeIn && fadeIn.duration > 0 && /* @__PURE__ */ jsx14(
5486
+ showFades && fadeIn && fadeIn.duration > 0 && /* @__PURE__ */ jsx15(
5149
5487
  FadeOverlay,
5150
5488
  {
5151
5489
  left: 0,
@@ -5154,7 +5492,7 @@ var MediaElementPlaylist = ({
5154
5492
  curveType: fadeIn.type
5155
5493
  }
5156
5494
  ),
5157
- showFades && fadeOut && fadeOut.duration > 0 && /* @__PURE__ */ jsx14(
5495
+ showFades && fadeOut && fadeOut.duration > 0 && /* @__PURE__ */ jsx15(
5158
5496
  FadeOverlay,
5159
5497
  {
5160
5498
  left: width - Math.floor(fadeOut.duration * sampleRate / samplesPerPixel),
@@ -5172,7 +5510,7 @@ var MediaElementPlaylist = ({
5172
5510
  trackIndex
5173
5511
  );
5174
5512
  }),
5175
- annotations.length > 0 && annotationIntegration && /* @__PURE__ */ jsx14(
5513
+ annotations.length > 0 && annotationIntegration && /* @__PURE__ */ jsx15(
5176
5514
  DragDropProvider,
5177
5515
  {
5178
5516
  onDragStart,
@@ -5180,11 +5518,11 @@ var MediaElementPlaylist = ({
5180
5518
  onDragEnd,
5181
5519
  modifiers: editable ? [RestrictToHorizontalAxis] : [],
5182
5520
  plugins: noDropAnimationPlugins,
5183
- children: /* @__PURE__ */ jsx14(annotationIntegration.AnnotationBoxesWrapper, { height: 30, width: tracksFullWidth, children: annotations.map((annotation, index) => {
5521
+ children: /* @__PURE__ */ jsx15(annotationIntegration.AnnotationBoxesWrapper, { height: 30, width: tracksFullWidth, children: annotations.map((annotation, index) => {
5184
5522
  const startPosition = annotation.start * sampleRate / samplesPerPixel;
5185
5523
  const endPosition = annotation.end * sampleRate / samplesPerPixel;
5186
5524
  const label = getAnnotationBoxLabel ? getAnnotationBoxLabel(annotation, index) : annotation.id;
5187
- return /* @__PURE__ */ jsx14(
5525
+ return /* @__PURE__ */ jsx15(
5188
5526
  annotationIntegration.AnnotationBox,
5189
5527
  {
5190
5528
  annotationId: annotation.id,
@@ -5202,7 +5540,7 @@ var MediaElementPlaylist = ({
5202
5540
  }) })
5203
5541
  }
5204
5542
  ),
5205
- selectionStart !== selectionEnd && /* @__PURE__ */ jsx14(
5543
+ selectionStart !== selectionEnd && /* @__PURE__ */ jsx15(
5206
5544
  Selection2,
5207
5545
  {
5208
5546
  startPosition: Math.min(selectionStart, selectionEnd) * sampleRate / samplesPerPixel,
@@ -5210,7 +5548,7 @@ var MediaElementPlaylist = ({
5210
5548
  color: theme.selectionColor
5211
5549
  }
5212
5550
  ),
5213
- renderPlayhead ? /* @__PURE__ */ jsx14(
5551
+ renderPlayhead ? /* @__PURE__ */ jsx15(
5214
5552
  CustomMediaElementPlayhead,
5215
5553
  {
5216
5554
  renderPlayhead,
@@ -5218,7 +5556,7 @@ var MediaElementPlaylist = ({
5218
5556
  samplesPerPixel,
5219
5557
  sampleRate
5220
5558
  }
5221
- ) : /* @__PURE__ */ jsx14(AnimatedMediaElementPlayhead, { color: theme.playheadColor })
5559
+ ) : /* @__PURE__ */ jsx15(AnimatedMediaElementPlayhead, { color: theme.playheadColor })
5222
5560
  ] })
5223
5561
  }
5224
5562
  )
@@ -5227,8 +5565,8 @@ var MediaElementPlaylist = ({
5227
5565
  };
5228
5566
 
5229
5567
  // src/components/MediaElementAnnotationList.tsx
5230
- import { useCallback as useCallback19 } from "react";
5231
- import { jsx as jsx15 } from "react/jsx-runtime";
5568
+ import { useCallback as useCallback20 } from "react";
5569
+ import { jsx as jsx16 } from "react/jsx-runtime";
5232
5570
  var MediaElementAnnotationList = ({
5233
5571
  height,
5234
5572
  renderAnnotationItem,
@@ -5243,7 +5581,7 @@ var MediaElementAnnotationList = ({
5243
5581
  const integration = useAnnotationIntegration();
5244
5582
  const { setAnnotations } = useMediaElementControls();
5245
5583
  const resolvedConfig = annotationListConfig != null ? annotationListConfig : { linkEndpoints: false, continuousPlay };
5246
- const handleAnnotationUpdate = useCallback19(
5584
+ const handleAnnotationUpdate = useCallback20(
5247
5585
  (updatedAnnotations) => {
5248
5586
  setAnnotations(updatedAnnotations);
5249
5587
  onAnnotationUpdate == null ? void 0 : onAnnotationUpdate(updatedAnnotations);
@@ -5251,7 +5589,7 @@ var MediaElementAnnotationList = ({
5251
5589
  [setAnnotations, onAnnotationUpdate]
5252
5590
  );
5253
5591
  const { AnnotationText } = integration;
5254
- return /* @__PURE__ */ jsx15(
5592
+ return /* @__PURE__ */ jsx16(
5255
5593
  AnnotationText,
5256
5594
  {
5257
5595
  annotations,
@@ -5270,7 +5608,7 @@ var MediaElementAnnotationList = ({
5270
5608
  };
5271
5609
 
5272
5610
  // src/components/MediaElementWaveform.tsx
5273
- import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
5611
+ import { Fragment as Fragment6, jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
5274
5612
  var MediaElementWaveform = ({
5275
5613
  annotationTextHeight,
5276
5614
  getAnnotationBoxLabel,
@@ -5285,8 +5623,8 @@ var MediaElementWaveform = ({
5285
5623
  className
5286
5624
  }) => {
5287
5625
  const { annotations } = useMediaElementState();
5288
- return /* @__PURE__ */ jsxs6(Fragment5, { children: [
5289
- /* @__PURE__ */ jsx16(
5626
+ return /* @__PURE__ */ jsxs6(Fragment6, { children: [
5627
+ /* @__PURE__ */ jsx17(
5290
5628
  MediaElementPlaylist,
5291
5629
  {
5292
5630
  getAnnotationBoxLabel,
@@ -5298,7 +5636,7 @@ var MediaElementWaveform = ({
5298
5636
  className
5299
5637
  }
5300
5638
  ),
5301
- annotations.length > 0 && /* @__PURE__ */ jsx16(
5639
+ annotations.length > 0 && /* @__PURE__ */ jsx17(
5302
5640
  MediaElementAnnotationList,
5303
5641
  {
5304
5642
  height: annotationTextHeight,
@@ -5373,7 +5711,7 @@ var KeyboardShortcuts = ({
5373
5711
  };
5374
5712
 
5375
5713
  // src/components/ClipInteractionProvider.tsx
5376
- import React16, { useEffect as useEffect13, useMemo as useMemo6 } from "react";
5714
+ import React17, { useEffect as useEffect15, useMemo as useMemo6 } from "react";
5377
5715
  import { DragDropProvider as DragDropProvider2 } from "@dnd-kit/react";
5378
5716
  import { RestrictToHorizontalAxis as RestrictToHorizontalAxis2 } from "@dnd-kit/abstract/modifiers";
5379
5717
  import {
@@ -5463,7 +5801,7 @@ _SnapToGridModifier.configure = configurator2(_SnapToGridModifier);
5463
5801
  var SnapToGridModifier = _SnapToGridModifier;
5464
5802
 
5465
5803
  // src/components/ClipInteractionProvider.tsx
5466
- import { jsx as jsx17 } from "react/jsx-runtime";
5804
+ import { jsx as jsx18 } from "react/jsx-runtime";
5467
5805
  var NOOP_TRACKS_CHANGE = () => {
5468
5806
  };
5469
5807
  var ClipInteractionProvider = ({
@@ -5472,11 +5810,11 @@ var ClipInteractionProvider = ({
5472
5810
  children
5473
5811
  }) => {
5474
5812
  const { tracks, samplesPerPixel, sampleRate, playoutRef, isDraggingRef, onTracksChange } = usePlaylistData();
5475
- const { setSelectedTrackId } = usePlaylistControls();
5813
+ const { setSelectedTrackId, reorderTrack, bumpTrackReorderEpoch, setTrackDragPreview } = usePlaylistControls();
5476
5814
  const beatsAndBars = useBeatsAndBars();
5477
5815
  const useBeatsSnap = snap && beatsAndBars != null && beatsAndBars.scaleMode === "beats" && beatsAndBars.snapTo !== "off";
5478
5816
  const useTimescaleSnap = snap && !useBeatsSnap;
5479
- useEffect13(() => {
5817
+ useEffect15(() => {
5480
5818
  if (onTracksChange == null) {
5481
5819
  console.warn(
5482
5820
  "[waveform-playlist] ClipInteractionProvider: onTracksChange is not set on WaveformPlaylistProvider. Drag and trim edits will not be persisted."
@@ -5512,10 +5850,15 @@ var ClipInteractionProvider = ({
5512
5850
  isDraggingRef,
5513
5851
  snapSamplePosition
5514
5852
  });
5515
- const onDragStart = React16.useCallback(
5853
+ const onDragStart = React17.useCallback(
5516
5854
  (event) => {
5517
- var _a, _b, _c;
5518
- const trackIndex = (_c = (_b = (_a = event.operation) == null ? void 0 : _a.source) == null ? void 0 : _b.data) == null ? void 0 : _c.trackIndex;
5855
+ var _a, _b;
5856
+ const data = (_b = (_a = event.operation) == null ? void 0 : _a.source) == null ? void 0 : _b.data;
5857
+ if ((data == null ? void 0 : data.kind) === "track-reorder") {
5858
+ if (data.trackId) setSelectedTrackId(data.trackId);
5859
+ return;
5860
+ }
5861
+ const trackIndex = data == null ? void 0 : data.trackIndex;
5519
5862
  if (trackIndex !== void 0 && tracks[trackIndex]) {
5520
5863
  setSelectedTrackId(tracks[trackIndex].id);
5521
5864
  }
@@ -5523,6 +5866,39 @@ var ClipInteractionProvider = ({
5523
5866
  },
5524
5867
  [handleDragStart, tracks, setSelectedTrackId]
5525
5868
  );
5869
+ const handleDragOver = React17.useCallback(
5870
+ (event) => {
5871
+ var _a;
5872
+ const data = (_a = event.operation.source) == null ? void 0 : _a.data;
5873
+ if ((data == null ? void 0 : data.kind) !== "track-reorder" || !data.trackId) return;
5874
+ const sortable = event.operation.source.sortable;
5875
+ if (!sortable) return;
5876
+ const trackId = data.trackId;
5877
+ const toIndex = sortable.index;
5878
+ setTrackDragPreview(
5879
+ (prev) => prev && prev.trackId === trackId && prev.toIndex === toIndex ? prev : { trackId, toIndex }
5880
+ );
5881
+ },
5882
+ [setTrackDragPreview]
5883
+ );
5884
+ const handleDragEnd = React17.useCallback(
5885
+ (event) => {
5886
+ var _a;
5887
+ const data = (_a = event.operation.source) == null ? void 0 : _a.data;
5888
+ if ((data == null ? void 0 : data.kind) === "track-reorder") {
5889
+ bumpTrackReorderEpoch();
5890
+ setTrackDragPreview(null);
5891
+ if (event.canceled || !data.trackId) return;
5892
+ const sortable = event.operation.source.sortable;
5893
+ if (sortable && sortable.index !== sortable.initialIndex) {
5894
+ reorderTrack(data.trackId, sortable.index);
5895
+ }
5896
+ return;
5897
+ }
5898
+ onDragEnd(event);
5899
+ },
5900
+ [onDragEnd, reorderTrack, bumpTrackReorderEpoch, setTrackDragPreview]
5901
+ );
5526
5902
  const modifiers = useMemo6(() => {
5527
5903
  const mods = [RestrictToHorizontalAxis2];
5528
5904
  if (useBeatsSnap && beatsAndBars) {
@@ -5548,13 +5924,14 @@ var ClipInteractionProvider = ({
5548
5924
  mods.push(ClipCollisionModifier.configure({ tracks, samplesPerPixel }));
5549
5925
  return mods;
5550
5926
  }, [useBeatsSnap, useTimescaleSnap, beatsAndBars, tracks, samplesPerPixel, sampleRate]);
5551
- return /* @__PURE__ */ jsx17(ClipInteractionContextProvider, { value: true, children: /* @__PURE__ */ jsx17(
5927
+ return /* @__PURE__ */ jsx18(ClipInteractionContextProvider, { value: true, children: /* @__PURE__ */ jsx18(
5552
5928
  DragDropProvider2,
5553
5929
  {
5554
5930
  sensors,
5555
5931
  onDragStart,
5556
5932
  onDragMove,
5557
- onDragEnd,
5933
+ onDragOver: handleDragOver,
5934
+ onDragEnd: handleDragEnd,
5558
5935
  modifiers,
5559
5936
  plugins: noDropAnimationPlugins,
5560
5937
  children
@@ -5590,6 +5967,7 @@ export {
5590
5967
  SkipBackwardButton,
5591
5968
  SkipForwardButton,
5592
5969
  SnapToGridModifier,
5970
+ SortableTrackControls,
5593
5971
  SpectrogramIntegrationProvider,
5594
5972
  StopButton,
5595
5973
  TimeFormatSelect,