@waveform-playlist/ui-components 6.0.2 → 7.0.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.js CHANGED
@@ -64,6 +64,7 @@ __export(index_exports, {
64
64
  Playhead: () => Playhead,
65
65
  PlayheadWithMarker: () => PlayheadWithMarker,
66
66
  Playlist: () => Playlist,
67
+ PlaylistErrorBoundary: () => PlaylistErrorBoundary,
67
68
  PlaylistInfoContext: () => PlaylistInfoContext,
68
69
  PlayoutProvider: () => PlayoutProvider,
69
70
  ScreenReaderOnly: () => ScreenReaderOnly,
@@ -766,6 +767,44 @@ var Channel = (props) => {
766
767
  );
767
768
  };
768
769
 
770
+ // src/components/ErrorBoundary.tsx
771
+ var import_react2 = __toESM(require("react"));
772
+ var import_jsx_runtime4 = require("react/jsx-runtime");
773
+ var errorContainerStyle = {
774
+ padding: "16px",
775
+ background: "#1a1a2e",
776
+ color: "#e0e0e0",
777
+ border: "1px solid #d08070",
778
+ borderRadius: "4px",
779
+ fontFamily: "monospace",
780
+ fontSize: "13px",
781
+ minHeight: "60px",
782
+ display: "flex",
783
+ alignItems: "center",
784
+ justifyContent: "center"
785
+ };
786
+ var PlaylistErrorBoundary = class extends import_react2.default.Component {
787
+ constructor(props) {
788
+ super(props);
789
+ this.state = { hasError: false, error: null };
790
+ }
791
+ static getDerivedStateFromError(error) {
792
+ return { hasError: true, error };
793
+ }
794
+ componentDidCatch(error, errorInfo) {
795
+ console.error("[waveform-playlist] Render error:", error, errorInfo.componentStack);
796
+ }
797
+ render() {
798
+ if (this.state.hasError) {
799
+ if (this.props.fallback) {
800
+ return this.props.fallback;
801
+ }
802
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: errorContainerStyle, children: "Waveform playlist encountered an error. Check console for details." });
803
+ }
804
+ return this.props.children;
805
+ }
806
+ };
807
+
769
808
  // src/components/Clip.tsx
770
809
  var import_styled_components13 = __toESM(require("styled-components"));
771
810
  var import_core = require("@dnd-kit/core");
@@ -773,7 +812,7 @@ var import_utilities = require("@dnd-kit/utilities");
773
812
 
774
813
  // src/components/ClipHeader.tsx
775
814
  var import_styled_components10 = __toESM(require("styled-components"));
776
- var import_jsx_runtime4 = require("react/jsx-runtime");
815
+ var import_jsx_runtime5 = require("react/jsx-runtime");
777
816
  var CLIP_HEADER_HEIGHT = 22;
778
817
  var HeaderContainer = import_styled_components10.default.div`
779
818
  position: relative;
@@ -813,13 +852,13 @@ var ClipHeaderPresentational = ({
813
852
  trackName,
814
853
  isSelected = false
815
854
  }) => {
816
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
855
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
817
856
  HeaderContainer,
818
857
  {
819
858
  $isDragging: false,
820
859
  $interactive: false,
821
860
  $isSelected: isSelected,
822
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TrackName, { children: trackName })
861
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TrackName, { children: trackName })
823
862
  }
824
863
  );
825
864
  };
@@ -833,7 +872,7 @@ var ClipHeader = ({
833
872
  dragHandleProps
834
873
  }) => {
835
874
  if (disableDrag || !dragHandleProps) {
836
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
875
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
837
876
  ClipHeaderPresentational,
838
877
  {
839
878
  trackName,
@@ -842,7 +881,7 @@ var ClipHeader = ({
842
881
  );
843
882
  }
844
883
  const { attributes, listeners, setActivatorNodeRef } = dragHandleProps;
845
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
884
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
846
885
  HeaderContainer,
847
886
  {
848
887
  ref: setActivatorNodeRef,
@@ -851,15 +890,15 @@ var ClipHeader = ({
851
890
  $isSelected: isSelected,
852
891
  ...listeners,
853
892
  ...attributes,
854
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TrackName, { children: trackName })
893
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TrackName, { children: trackName })
855
894
  }
856
895
  );
857
896
  };
858
897
 
859
898
  // src/components/ClipBoundary.tsx
860
- var import_react2 = __toESM(require("react"));
899
+ var import_react3 = __toESM(require("react"));
861
900
  var import_styled_components11 = __toESM(require("styled-components"));
862
- var import_jsx_runtime5 = require("react/jsx-runtime");
901
+ var import_jsx_runtime6 = require("react/jsx-runtime");
863
902
  var CLIP_BOUNDARY_WIDTH = 8;
864
903
  var CLIP_BOUNDARY_WIDTH_TOUCH = 24;
865
904
  var BoundaryContainer = import_styled_components11.default.div`
@@ -899,12 +938,12 @@ var ClipBoundary = ({
899
938
  dragHandleProps,
900
939
  touchOptimized = false
901
940
  }) => {
902
- const [isHovered, setIsHovered] = import_react2.default.useState(false);
941
+ const [isHovered, setIsHovered] = import_react3.default.useState(false);
903
942
  if (!dragHandleProps) {
904
943
  return null;
905
944
  }
906
945
  const { attributes, listeners, setActivatorNodeRef, isDragging } = dragHandleProps;
907
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
946
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
908
947
  BoundaryContainer,
909
948
  {
910
949
  ref: setActivatorNodeRef,
@@ -924,7 +963,7 @@ var ClipBoundary = ({
924
963
 
925
964
  // src/components/FadeOverlay.tsx
926
965
  var import_styled_components12 = __toESM(require("styled-components"));
927
- var import_jsx_runtime6 = require("react/jsx-runtime");
966
+ var import_jsx_runtime7 = require("react/jsx-runtime");
928
967
  var FadeContainer = import_styled_components12.default.div.attrs((props) => ({
929
968
  style: {
930
969
  left: `${props.$left}px`,
@@ -981,7 +1020,7 @@ var FadeOverlay = ({
981
1020
  const theme = (0, import_styled_components12.useTheme)();
982
1021
  if (width < 1) return null;
983
1022
  const fillColor = color || theme?.fadeOverlayColor || "rgba(0, 0, 0, 0.4)";
984
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FadeContainer, { $left: left, $width: width, $type: type, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FadeSvg, { $type: type, viewBox: `0 0 ${width} 100`, preserveAspectRatio: "none", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1023
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FadeContainer, { $left: left, $width: width, $type: type, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FadeSvg, { $type: type, viewBox: `0 0 ${width} 100`, preserveAspectRatio: "none", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
985
1024
  "path",
986
1025
  {
987
1026
  d: generateFadePath(width, 100, curveType),
@@ -991,7 +1030,7 @@ var FadeOverlay = ({
991
1030
  };
992
1031
 
993
1032
  // src/components/Clip.tsx
994
- var import_jsx_runtime7 = require("react/jsx-runtime");
1033
+ var import_jsx_runtime8 = require("react/jsx-runtime");
995
1034
  var ClipContainer = import_styled_components13.default.div.attrs((props) => ({
996
1035
  style: props.$isOverlay ? {} : {
997
1036
  left: `${props.$left}px`,
@@ -1076,7 +1115,7 @@ var Clip = ({
1076
1115
  zIndex: isDragging ? 100 : void 0
1077
1116
  // Below controls (z-index: 999) but above other clips
1078
1117
  } : void 0;
1079
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1118
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1080
1119
  ClipContainer,
1081
1120
  {
1082
1121
  ref: setNodeRef,
@@ -1089,7 +1128,7 @@ var Clip = ({
1089
1128
  "data-track-id": trackId,
1090
1129
  onMouseDown,
1091
1130
  children: [
1092
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1131
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1093
1132
  ClipHeader,
1094
1133
  {
1095
1134
  clipId,
@@ -1101,9 +1140,9 @@ var Clip = ({
1101
1140
  dragHandleProps: enableDrag ? { attributes, listeners, setActivatorNodeRef } : void 0
1102
1141
  }
1103
1142
  ),
1104
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(ChannelsWrapper, { $isOverlay: isOverlay, children: [
1143
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(ChannelsWrapper, { $isOverlay: isOverlay, children: [
1105
1144
  children,
1106
- showFades && fadeIn && fadeIn.duration > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1145
+ showFades && fadeIn && fadeIn.duration > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1107
1146
  FadeOverlay,
1108
1147
  {
1109
1148
  left: 0,
@@ -1112,7 +1151,7 @@ var Clip = ({
1112
1151
  curveType: fadeIn.type
1113
1152
  }
1114
1153
  ),
1115
- showFades && fadeOut && fadeOut.duration > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1154
+ showFades && fadeOut && fadeOut.duration > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1116
1155
  FadeOverlay,
1117
1156
  {
1118
1157
  left: width - Math.floor(fadeOut.duration * sampleRate / samplesPerPixel),
@@ -1122,8 +1161,8 @@ var Clip = ({
1122
1161
  }
1123
1162
  )
1124
1163
  ] }),
1125
- showHeader && !disableHeaderDrag && !isOverlay && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1126
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1164
+ showHeader && !disableHeaderDrag && !isOverlay && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1165
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1127
1166
  ClipBoundary,
1128
1167
  {
1129
1168
  clipId,
@@ -1139,7 +1178,7 @@ var Clip = ({
1139
1178
  }
1140
1179
  }
1141
1180
  ),
1142
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1181
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1143
1182
  ClipBoundary,
1144
1183
  {
1145
1184
  clipId,
@@ -1163,7 +1202,7 @@ var Clip = ({
1163
1202
 
1164
1203
  // src/components/MasterVolumeControl.tsx
1165
1204
  var import_styled_components14 = __toESM(require("styled-components"));
1166
- var import_jsx_runtime8 = require("react/jsx-runtime");
1205
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1167
1206
  var VolumeContainer = import_styled_components14.default.div`
1168
1207
  display: inline-flex;
1169
1208
  align-items: center;
@@ -1185,9 +1224,9 @@ var MasterVolumeControl = ({
1185
1224
  const handleChange = (e) => {
1186
1225
  onChange(parseFloat(e.target.value) / 100);
1187
1226
  };
1188
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(VolumeContainer, { className, children: [
1189
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(VolumeLabel, { htmlFor: "master-gain", children: "Master Volume" }),
1190
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1227
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(VolumeContainer, { className, children: [
1228
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(VolumeLabel, { htmlFor: "master-gain", children: "Master Volume" }),
1229
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1191
1230
  VolumeSlider,
1192
1231
  {
1193
1232
  min: "0",
@@ -1202,9 +1241,9 @@ var MasterVolumeControl = ({
1202
1241
  };
1203
1242
 
1204
1243
  // src/components/Playhead.tsx
1205
- var import_react3 = require("react");
1244
+ var import_react4 = require("react");
1206
1245
  var import_styled_components15 = __toESM(require("styled-components"));
1207
- var import_jsx_runtime9 = require("react/jsx-runtime");
1246
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1208
1247
  var PlayheadLine = import_styled_components15.default.div.attrs((props) => ({
1209
1248
  style: {
1210
1249
  transform: `translate3d(${props.$position}px, 0, 0)`
@@ -1221,7 +1260,7 @@ var PlayheadLine = import_styled_components15.default.div.attrs((props) => ({
1221
1260
  will-change: transform;
1222
1261
  `;
1223
1262
  var Playhead = ({ position, color = "#ff0000" }) => {
1224
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PlayheadLine, { $position: position, $color: color });
1263
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PlayheadLine, { $position: position, $color: color });
1225
1264
  };
1226
1265
  var PlayheadWithMarkerContainer = import_styled_components15.default.div`
1227
1266
  position: absolute;
@@ -1261,9 +1300,9 @@ var PlayheadWithMarker = ({
1261
1300
  controlsOffset,
1262
1301
  getAudioContextTime
1263
1302
  }) => {
1264
- const containerRef = (0, import_react3.useRef)(null);
1265
- const animationFrameRef = (0, import_react3.useRef)(null);
1266
- (0, import_react3.useEffect)(() => {
1303
+ const containerRef = (0, import_react4.useRef)(null);
1304
+ const animationFrameRef = (0, import_react4.useRef)(null);
1305
+ (0, import_react4.useEffect)(() => {
1267
1306
  const updatePosition = () => {
1268
1307
  if (containerRef.current) {
1269
1308
  let time;
@@ -1292,22 +1331,22 @@ var PlayheadWithMarker = ({
1292
1331
  }
1293
1332
  };
1294
1333
  }, [isPlaying, sampleRate, samplesPerPixel, controlsOffset, currentTimeRef, playbackStartTimeRef, audioStartPositionRef, getAudioContextTime]);
1295
- (0, import_react3.useEffect)(() => {
1334
+ (0, import_react4.useEffect)(() => {
1296
1335
  if (!isPlaying && containerRef.current) {
1297
1336
  const time = currentTimeRef.current ?? 0;
1298
1337
  const pos = time * sampleRate / samplesPerPixel + controlsOffset;
1299
1338
  containerRef.current.style.transform = `translate3d(${pos}px, 0, 0)`;
1300
1339
  }
1301
1340
  });
1302
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(PlayheadWithMarkerContainer, { ref: containerRef, $color: color, children: [
1303
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MarkerTriangle, { $color: color }),
1304
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MarkerLine, { $color: color })
1341
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(PlayheadWithMarkerContainer, { ref: containerRef, $color: color, children: [
1342
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MarkerTriangle, { $color: color }),
1343
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MarkerLine, { $color: color })
1305
1344
  ] });
1306
1345
  };
1307
1346
 
1308
1347
  // src/components/Playlist.tsx
1309
1348
  var import_styled_components16 = __toESM(require("styled-components"));
1310
- var import_jsx_runtime10 = require("react/jsx-runtime");
1349
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1311
1350
  var Wrapper2 = import_styled_components16.default.div`
1312
1351
  overflow-y: hidden;
1313
1352
  overflow-x: auto;
@@ -1361,16 +1400,16 @@ var Playlist = ({
1361
1400
  isSelecting,
1362
1401
  "data-playlist-state": playlistState
1363
1402
  }) => {
1364
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Wrapper2, { "data-scroll-container": "true", "data-playlist-state": playlistState, ref: scrollContainerRef, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1403
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Wrapper2, { "data-scroll-container": "true", "data-playlist-state": playlistState, ref: scrollContainerRef, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1365
1404
  ScrollContainer,
1366
1405
  {
1367
1406
  $backgroundColor: backgroundColor,
1368
1407
  $width: scrollContainerWidth,
1369
1408
  children: [
1370
- timescale && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TimescaleWrapper, { $width: timescaleWidth, $backgroundColor: timescaleBackgroundColor, children: timescale }),
1371
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(TracksContainer, { $width: tracksWidth, $backgroundColor: backgroundColor, children: [
1409
+ timescale && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TimescaleWrapper, { $width: timescaleWidth, $backgroundColor: timescaleBackgroundColor, children: timescale }),
1410
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(TracksContainer, { $width: tracksWidth, $backgroundColor: backgroundColor, children: [
1372
1411
  children,
1373
- (onTracksClick || onTracksMouseDown) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1412
+ (onTracksClick || onTracksMouseDown) && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1374
1413
  ClickOverlay,
1375
1414
  {
1376
1415
  $controlsWidth: controlsWidth,
@@ -1390,7 +1429,7 @@ var StyledPlaylist = (0, import_styled_components16.withTheme)(Playlist);
1390
1429
 
1391
1430
  // src/components/Selection.tsx
1392
1431
  var import_styled_components17 = __toESM(require("styled-components"));
1393
- var import_jsx_runtime11 = require("react/jsx-runtime");
1432
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1394
1433
  var SelectionOverlay = import_styled_components17.default.div.attrs((props) => ({
1395
1434
  style: {
1396
1435
  left: `${props.$left}px`,
@@ -1414,13 +1453,13 @@ var Selection = ({
1414
1453
  if (width <= 0) {
1415
1454
  return null;
1416
1455
  }
1417
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SelectionOverlay, { $left: startPosition, $width: width, $color: color, "data-selection": true });
1456
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SelectionOverlay, { $left: startPosition, $width: width, $color: color, "data-selection": true });
1418
1457
  };
1419
1458
 
1420
1459
  // src/components/LoopRegion.tsx
1421
- var import_react4 = require("react");
1460
+ var import_react5 = require("react");
1422
1461
  var import_styled_components18 = __toESM(require("styled-components"));
1423
- var import_jsx_runtime12 = require("react/jsx-runtime");
1462
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1424
1463
  var LoopRegionOverlayDiv = import_styled_components18.default.div.attrs((props) => ({
1425
1464
  style: {
1426
1465
  left: `${props.$left}px`,
@@ -1469,8 +1508,8 @@ var LoopRegion = ({
1469
1508
  if (width <= 0) {
1470
1509
  return null;
1471
1510
  }
1472
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1473
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1511
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1512
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1474
1513
  LoopRegionOverlayDiv,
1475
1514
  {
1476
1515
  $left: startPosition,
@@ -1479,7 +1518,7 @@ var LoopRegion = ({
1479
1518
  "data-loop-region": true
1480
1519
  }
1481
1520
  ),
1482
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1521
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1483
1522
  LoopMarker,
1484
1523
  {
1485
1524
  $left: startPosition,
@@ -1488,7 +1527,7 @@ var LoopRegion = ({
1488
1527
  "data-loop-marker": "start"
1489
1528
  }
1490
1529
  ),
1491
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1530
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1492
1531
  LoopMarker,
1493
1532
  {
1494
1533
  $left: endPosition - 2,
@@ -1569,12 +1608,12 @@ var LoopRegionMarkers = ({
1569
1608
  minPosition = 0,
1570
1609
  maxPosition = Infinity
1571
1610
  }) => {
1572
- const [draggingMarker, setDraggingMarker] = (0, import_react4.useState)(null);
1573
- const dragStartX = (0, import_react4.useRef)(0);
1574
- const dragStartPosition = (0, import_react4.useRef)(0);
1575
- const dragStartEnd = (0, import_react4.useRef)(0);
1611
+ const [draggingMarker, setDraggingMarker] = (0, import_react5.useState)(null);
1612
+ const dragStartX = (0, import_react5.useRef)(0);
1613
+ const dragStartPosition = (0, import_react5.useRef)(0);
1614
+ const dragStartEnd = (0, import_react5.useRef)(0);
1576
1615
  const width = Math.max(0, endPosition - startPosition);
1577
- const handleMarkerMouseDown = (0, import_react4.useCallback)((e, marker) => {
1616
+ const handleMarkerMouseDown = (0, import_react5.useCallback)((e, marker) => {
1578
1617
  e.preventDefault();
1579
1618
  e.stopPropagation();
1580
1619
  setDraggingMarker(marker);
@@ -1599,7 +1638,7 @@ var LoopRegionMarkers = ({
1599
1638
  document.addEventListener("mousemove", handleMouseMove);
1600
1639
  document.addEventListener("mouseup", handleMouseUp);
1601
1640
  }, [startPosition, endPosition, minPosition, maxPosition, onLoopStartChange, onLoopEndChange]);
1602
- const handleRegionMouseDown = (0, import_react4.useCallback)((e) => {
1641
+ const handleRegionMouseDown = (0, import_react5.useCallback)((e) => {
1603
1642
  e.preventDefault();
1604
1643
  e.stopPropagation();
1605
1644
  setDraggingMarker("region");
@@ -1632,8 +1671,8 @@ var LoopRegionMarkers = ({
1632
1671
  if (width <= 0) {
1633
1672
  return null;
1634
1673
  }
1635
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1636
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1674
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1675
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1637
1676
  TimescaleLoopShade,
1638
1677
  {
1639
1678
  $left: startPosition,
@@ -1644,7 +1683,7 @@ var LoopRegionMarkers = ({
1644
1683
  "data-loop-region-timescale": true
1645
1684
  }
1646
1685
  ),
1647
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1686
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1648
1687
  DraggableMarkerHandle,
1649
1688
  {
1650
1689
  $left: startPosition,
@@ -1655,7 +1694,7 @@ var LoopRegionMarkers = ({
1655
1694
  "data-loop-marker-handle": "start"
1656
1695
  }
1657
1696
  ),
1658
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1697
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1659
1698
  DraggableMarkerHandle,
1660
1699
  {
1661
1700
  $left: endPosition,
@@ -1690,11 +1729,11 @@ var TimescaleLoopRegion = ({
1690
1729
  maxPosition = Infinity,
1691
1730
  controlsOffset = 0
1692
1731
  }) => {
1693
- const [isCreating, setIsCreating] = (0, import_react4.useState)(false);
1694
- const createStartX = (0, import_react4.useRef)(0);
1695
- const containerRef = (0, import_react4.useRef)(null);
1732
+ const [isCreating, setIsCreating] = (0, import_react5.useState)(false);
1733
+ const createStartX = (0, import_react5.useRef)(0);
1734
+ const containerRef = (0, import_react5.useRef)(null);
1696
1735
  const hasLoopRegion = endPosition > startPosition;
1697
- const handleBackgroundMouseDown = (0, import_react4.useCallback)((e) => {
1736
+ const handleBackgroundMouseDown = (0, import_react5.useCallback)((e) => {
1698
1737
  const target = e.target;
1699
1738
  if (target.closest("[data-loop-marker-handle]") || target.closest("[data-loop-region-timescale]")) {
1700
1739
  return;
@@ -1722,14 +1761,14 @@ var TimescaleLoopRegion = ({
1722
1761
  document.addEventListener("mousemove", handleMouseMove);
1723
1762
  document.addEventListener("mouseup", handleMouseUp);
1724
1763
  }, [minPosition, maxPosition, onLoopRegionChange]);
1725
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1764
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1726
1765
  TimescaleLoopCreator,
1727
1766
  {
1728
1767
  ref: containerRef,
1729
1768
  $leftOffset: controlsOffset,
1730
1769
  onMouseDown: handleBackgroundMouseDown,
1731
1770
  "data-timescale-loop-creator": true,
1732
- children: hasLoopRegion && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1771
+ children: hasLoopRegion && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1733
1772
  LoopRegionMarkers,
1734
1773
  {
1735
1774
  startPosition,
@@ -1748,10 +1787,10 @@ var TimescaleLoopRegion = ({
1748
1787
  };
1749
1788
 
1750
1789
  // src/components/SelectionTimeInputs.tsx
1751
- var import_react6 = require("react");
1790
+ var import_react7 = require("react");
1752
1791
 
1753
1792
  // src/components/TimeInput.tsx
1754
- var import_react5 = require("react");
1793
+ var import_react6 = require("react");
1755
1794
 
1756
1795
  // src/utils/timeFormat.ts
1757
1796
  function clockFormat(seconds, decimals) {
@@ -1801,7 +1840,7 @@ function parseTime(timeStr, format) {
1801
1840
  }
1802
1841
 
1803
1842
  // src/components/TimeInput.tsx
1804
- var import_jsx_runtime13 = require("react/jsx-runtime");
1843
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1805
1844
  var TimeInput = ({
1806
1845
  id,
1807
1846
  label,
@@ -1811,8 +1850,8 @@ var TimeInput = ({
1811
1850
  onChange,
1812
1851
  readOnly = false
1813
1852
  }) => {
1814
- const [displayValue, setDisplayValue] = (0, import_react5.useState)("");
1815
- (0, import_react5.useEffect)(() => {
1853
+ const [displayValue, setDisplayValue] = (0, import_react6.useState)("");
1854
+ (0, import_react6.useEffect)(() => {
1816
1855
  const formatted = formatTime(value, format);
1817
1856
  setDisplayValue(formatted);
1818
1857
  }, [value, format, id]);
@@ -1832,9 +1871,9 @@ var TimeInput = ({
1832
1871
  e.currentTarget.blur();
1833
1872
  }
1834
1873
  };
1835
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1836
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ScreenReaderOnly, { as: "label", htmlFor: id, children: label }),
1837
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1874
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1875
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ScreenReaderOnly, { as: "label", htmlFor: id, children: label }),
1876
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1838
1877
  BaseInput,
1839
1878
  {
1840
1879
  type: "text",
@@ -1851,15 +1890,15 @@ var TimeInput = ({
1851
1890
  };
1852
1891
 
1853
1892
  // src/components/SelectionTimeInputs.tsx
1854
- var import_jsx_runtime14 = require("react/jsx-runtime");
1893
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1855
1894
  var SelectionTimeInputs = ({
1856
1895
  selectionStart,
1857
1896
  selectionEnd,
1858
1897
  onSelectionChange,
1859
1898
  className
1860
1899
  }) => {
1861
- const [timeFormat, setTimeFormat] = (0, import_react6.useState)("hh:mm:ss.uuu");
1862
- (0, import_react6.useEffect)(() => {
1900
+ const [timeFormat, setTimeFormat] = (0, import_react7.useState)("hh:mm:ss.uuu");
1901
+ (0, import_react7.useEffect)(() => {
1863
1902
  const timeFormatSelect = document.querySelector(".time-format");
1864
1903
  const handleFormatChange = () => {
1865
1904
  if (timeFormatSelect) {
@@ -1884,8 +1923,8 @@ var SelectionTimeInputs = ({
1884
1923
  onSelectionChange(selectionStart, value);
1885
1924
  }
1886
1925
  };
1887
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1888
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1926
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
1927
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1889
1928
  TimeInput,
1890
1929
  {
1891
1930
  id: "audio_start",
@@ -1896,7 +1935,7 @@ var SelectionTimeInputs = ({
1896
1935
  onChange: handleStartChange
1897
1936
  }
1898
1937
  ),
1899
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1938
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1900
1939
  TimeInput,
1901
1940
  {
1902
1941
  id: "audio_end",
@@ -1911,14 +1950,14 @@ var SelectionTimeInputs = ({
1911
1950
  };
1912
1951
 
1913
1952
  // src/contexts/DevicePixelRatio.tsx
1914
- var import_react7 = require("react");
1915
- var import_jsx_runtime15 = require("react/jsx-runtime");
1953
+ var import_react8 = require("react");
1954
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1916
1955
  function getScale() {
1917
1956
  return window.devicePixelRatio;
1918
1957
  }
1919
- var DevicePixelRatioContext = (0, import_react7.createContext)(getScale());
1958
+ var DevicePixelRatioContext = (0, import_react8.createContext)(getScale());
1920
1959
  var DevicePixelRatioProvider = ({ children }) => {
1921
- const [scale, setScale] = (0, import_react7.useState)(getScale());
1960
+ const [scale, setScale] = (0, import_react8.useState)(getScale());
1922
1961
  matchMedia(`(resolution: ${getScale()}dppx)`).addEventListener(
1923
1962
  "change",
1924
1963
  () => {
@@ -1926,13 +1965,13 @@ var DevicePixelRatioProvider = ({ children }) => {
1926
1965
  },
1927
1966
  { once: true }
1928
1967
  );
1929
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DevicePixelRatioContext.Provider, { value: Math.ceil(scale), children });
1968
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DevicePixelRatioContext.Provider, { value: Math.ceil(scale), children });
1930
1969
  };
1931
- var useDevicePixelRatio = () => (0, import_react7.useContext)(DevicePixelRatioContext);
1970
+ var useDevicePixelRatio = () => (0, import_react8.useContext)(DevicePixelRatioContext);
1932
1971
 
1933
1972
  // src/contexts/PlaylistInfo.tsx
1934
- var import_react8 = require("react");
1935
- var PlaylistInfoContext = (0, import_react8.createContext)({
1973
+ var import_react9 = require("react");
1974
+ var PlaylistInfoContext = (0, import_react9.createContext)({
1936
1975
  sampleRate: 48e3,
1937
1976
  samplesPerPixel: 1e3,
1938
1977
  zoomLevels: [1e3, 1500, 2e3, 2500],
@@ -1946,22 +1985,22 @@ var PlaylistInfoContext = (0, import_react8.createContext)({
1946
1985
  barWidth: 1,
1947
1986
  barGap: 0
1948
1987
  });
1949
- var usePlaylistInfo = () => (0, import_react8.useContext)(PlaylistInfoContext);
1988
+ var usePlaylistInfo = () => (0, import_react9.useContext)(PlaylistInfoContext);
1950
1989
 
1951
1990
  // src/contexts/Theme.tsx
1952
- var import_react9 = require("react");
1991
+ var import_react10 = require("react");
1953
1992
  var import_styled_components19 = require("styled-components");
1954
- var useTheme2 = () => (0, import_react9.useContext)(import_styled_components19.ThemeContext);
1993
+ var useTheme2 = () => (0, import_react10.useContext)(import_styled_components19.ThemeContext);
1955
1994
 
1956
1995
  // src/contexts/TrackControls.tsx
1957
- var import_react10 = require("react");
1958
- var import_jsx_runtime16 = require("react/jsx-runtime");
1959
- var TrackControlsContext = (0, import_react10.createContext)(/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react10.Fragment, {}));
1960
- var useTrackControls = () => (0, import_react10.useContext)(TrackControlsContext);
1961
-
1962
- // src/contexts/Playout.tsx
1963
1996
  var import_react11 = require("react");
1964
1997
  var import_jsx_runtime17 = require("react/jsx-runtime");
1998
+ var TrackControlsContext = (0, import_react11.createContext)(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react11.Fragment, {}));
1999
+ var useTrackControls = () => (0, import_react11.useContext)(TrackControlsContext);
2000
+
2001
+ // src/contexts/Playout.tsx
2002
+ var import_react12 = require("react");
2003
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1965
2004
  var defaultProgress = 0;
1966
2005
  var defaultIsPlaying = false;
1967
2006
  var defaultSelectionStart = 0;
@@ -1972,8 +2011,8 @@ var defaultPlayout = {
1972
2011
  selectionStart: defaultSelectionStart,
1973
2012
  selectionEnd: defaultSelectionEnd
1974
2013
  };
1975
- var PlayoutStatusContext = (0, import_react11.createContext)(defaultPlayout);
1976
- var PlayoutStatusUpdateContext = (0, import_react11.createContext)({
2014
+ var PlayoutStatusContext = (0, import_react12.createContext)(defaultPlayout);
2015
+ var PlayoutStatusUpdateContext = (0, import_react12.createContext)({
1977
2016
  setIsPlaying: () => {
1978
2017
  },
1979
2018
  setProgress: () => {
@@ -1982,23 +2021,23 @@ var PlayoutStatusUpdateContext = (0, import_react11.createContext)({
1982
2021
  }
1983
2022
  });
1984
2023
  var PlayoutProvider = ({ children }) => {
1985
- const [isPlaying, setIsPlaying] = (0, import_react11.useState)(defaultIsPlaying);
1986
- const [progress, setProgress] = (0, import_react11.useState)(defaultProgress);
1987
- const [selectionStart, setSelectionStart] = (0, import_react11.useState)(defaultSelectionStart);
1988
- const [selectionEnd, setSelectionEnd] = (0, import_react11.useState)(defaultSelectionEnd);
2024
+ const [isPlaying, setIsPlaying] = (0, import_react12.useState)(defaultIsPlaying);
2025
+ const [progress, setProgress] = (0, import_react12.useState)(defaultProgress);
2026
+ const [selectionStart, setSelectionStart] = (0, import_react12.useState)(defaultSelectionStart);
2027
+ const [selectionEnd, setSelectionEnd] = (0, import_react12.useState)(defaultSelectionEnd);
1989
2028
  const setSelection = (start, end) => {
1990
2029
  setSelectionStart(start);
1991
2030
  setSelectionEnd(end);
1992
2031
  };
1993
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PlayoutStatusUpdateContext.Provider, { value: { setIsPlaying, setProgress, setSelection }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PlayoutStatusContext.Provider, { value: { isPlaying, progress, selectionStart, selectionEnd }, children }) });
2032
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PlayoutStatusUpdateContext.Provider, { value: { setIsPlaying, setProgress, setSelection }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PlayoutStatusContext.Provider, { value: { isPlaying, progress, selectionStart, selectionEnd }, children }) });
1994
2033
  };
1995
- var usePlayoutStatus = () => (0, import_react11.useContext)(PlayoutStatusContext);
1996
- var usePlayoutStatusUpdate = () => (0, import_react11.useContext)(PlayoutStatusUpdateContext);
2034
+ var usePlayoutStatus = () => (0, import_react12.useContext)(PlayoutStatusContext);
2035
+ var usePlayoutStatusUpdate = () => (0, import_react12.useContext)(PlayoutStatusUpdateContext);
1997
2036
 
1998
2037
  // src/components/SpectrogramChannel.tsx
1999
- var import_react12 = require("react");
2038
+ var import_react13 = require("react");
2000
2039
  var import_styled_components20 = __toESM(require("styled-components"));
2001
- var import_jsx_runtime18 = require("react/jsx-runtime");
2040
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2002
2041
  var MAX_CANVAS_WIDTH2 = 1e3;
2003
2042
  var Wrapper3 = import_styled_components20.default.div.attrs((props) => ({
2004
2043
  style: {
@@ -2048,11 +2087,11 @@ var SpectrogramChannel = ({
2048
2087
  onCanvasesReady
2049
2088
  }) => {
2050
2089
  const channelIndex = channelIndexProp ?? index;
2051
- const canvasesRef = (0, import_react12.useRef)([]);
2052
- const registeredIdsRef = (0, import_react12.useRef)([]);
2053
- const transferredCanvasesRef = (0, import_react12.useRef)(/* @__PURE__ */ new WeakSet());
2090
+ const canvasesRef = (0, import_react13.useRef)([]);
2091
+ const registeredIdsRef = (0, import_react13.useRef)([]);
2092
+ const transferredCanvasesRef = (0, import_react13.useRef)(/* @__PURE__ */ new WeakSet());
2054
2093
  const isWorkerMode = !!(workerApi && clipId);
2055
- const canvasRef = (0, import_react12.useCallback)(
2094
+ const canvasRef = (0, import_react13.useCallback)(
2056
2095
  (canvas) => {
2057
2096
  if (canvas !== null) {
2058
2097
  const idx = parseInt(canvas.dataset.index, 10);
@@ -2061,7 +2100,7 @@ var SpectrogramChannel = ({
2061
2100
  },
2062
2101
  []
2063
2102
  );
2064
- (0, import_react12.useEffect)(() => {
2103
+ (0, import_react13.useEffect)(() => {
2065
2104
  if (!isWorkerMode) return;
2066
2105
  const canvasCount2 = Math.ceil(length / MAX_CANVAS_WIDTH2);
2067
2106
  canvasesRef.current.length = canvasCount2;
@@ -2098,7 +2137,7 @@ var SpectrogramChannel = ({
2098
2137
  const lut = colorLUT ?? defaultGetColorMap();
2099
2138
  const maxF = maxFrequency ?? (data ? data.sampleRate / 2 : 22050);
2100
2139
  const scaleFn = frequencyScaleFn ?? ((f, minF, maxF2) => (f - minF) / (maxF2 - minF));
2101
- (0, import_react12.useLayoutEffect)(() => {
2140
+ (0, import_react13.useLayoutEffect)(() => {
2102
2141
  if (isWorkerMode || !data) return;
2103
2142
  const canvases2 = canvasesRef.current;
2104
2143
  const { frequencyBinCount, frameCount, hopSize, sampleRate, gainDb, rangeDb: rawRangeDb } = data;
@@ -2175,7 +2214,7 @@ var SpectrogramChannel = ({
2175
2214
  while (totalWidth > 0) {
2176
2215
  const currentWidth = Math.min(totalWidth, MAX_CANVAS_WIDTH2);
2177
2216
  canvases.push(
2178
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2217
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2179
2218
  SpectrogramCanvas,
2180
2219
  {
2181
2220
  $cssWidth: currentWidth,
@@ -2191,11 +2230,11 @@ var SpectrogramChannel = ({
2191
2230
  totalWidth -= currentWidth;
2192
2231
  canvasCount++;
2193
2232
  }
2194
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Wrapper3, { $index: index, $cssWidth: length, $waveHeight: waveHeight, children: canvases });
2233
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Wrapper3, { $index: index, $cssWidth: length, $waveHeight: waveHeight, children: canvases });
2195
2234
  };
2196
2235
 
2197
2236
  // src/components/SmartChannel.tsx
2198
- var import_jsx_runtime19 = require("react/jsx-runtime");
2237
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2199
2238
  var SmartChannel = ({
2200
2239
  isSelected,
2201
2240
  transparentBackground,
@@ -2220,7 +2259,7 @@ var SmartChannel = ({
2220
2259
  const drawMode = theme?.waveformDrawMode || "inverted";
2221
2260
  const hasSpectrogram = spectrogramData || spectrogramWorkerApi;
2222
2261
  if (renderMode === "spectrogram" && hasSpectrogram) {
2223
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2262
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2224
2263
  SpectrogramChannel,
2225
2264
  {
2226
2265
  index: props.index,
@@ -2241,8 +2280,8 @@ var SmartChannel = ({
2241
2280
  }
2242
2281
  if (renderMode === "both" && hasSpectrogram) {
2243
2282
  const halfHeight = Math.floor(waveHeight / 2);
2244
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2245
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2283
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
2284
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2246
2285
  SpectrogramChannel,
2247
2286
  {
2248
2287
  index: props.index * 2,
@@ -2261,11 +2300,10 @@ var SmartChannel = ({
2261
2300
  onCanvasesReady: spectrogramOnCanvasesReady
2262
2301
  }
2263
2302
  ),
2264
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { position: "absolute", top: (props.index * 2 + 1) * halfHeight, width: props.length, height: halfHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2303
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { position: "absolute", top: (props.index * 2 + 1) * halfHeight, width: props.length, height: halfHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2265
2304
  Channel,
2266
2305
  {
2267
2306
  ...props,
2268
- ...theme,
2269
2307
  index: 0,
2270
2308
  waveOutlineColor,
2271
2309
  waveFillColor,
@@ -2279,11 +2317,10 @@ var SmartChannel = ({
2279
2317
  ) })
2280
2318
  ] });
2281
2319
  }
2282
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2320
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2283
2321
  Channel,
2284
2322
  {
2285
2323
  ...props,
2286
- ...theme,
2287
2324
  waveOutlineColor,
2288
2325
  waveFillColor,
2289
2326
  waveHeight,
@@ -2297,9 +2334,9 @@ var SmartChannel = ({
2297
2334
  };
2298
2335
 
2299
2336
  // src/components/SpectrogramLabels.tsx
2300
- var import_react13 = require("react");
2337
+ var import_react14 = require("react");
2301
2338
  var import_styled_components21 = __toESM(require("styled-components"));
2302
- var import_jsx_runtime20 = require("react/jsx-runtime");
2339
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2303
2340
  var LABELS_WIDTH = 72;
2304
2341
  var LabelsStickyWrapper = import_styled_components21.default.div`
2305
2342
  position: sticky;
@@ -2349,12 +2386,12 @@ var SpectrogramLabels = ({
2349
2386
  renderMode = "spectrogram",
2350
2387
  hasClipHeaders = false
2351
2388
  }) => {
2352
- const canvasRef = (0, import_react13.useRef)(null);
2389
+ const canvasRef = (0, import_react14.useRef)(null);
2353
2390
  const devicePixelRatio = useDevicePixelRatio();
2354
2391
  const spectrogramHeight = renderMode === "both" ? Math.floor(waveHeight / 2) : waveHeight;
2355
2392
  const totalHeight = numChannels * waveHeight;
2356
2393
  const clipHeaderOffset = hasClipHeaders ? 22 : 0;
2357
- (0, import_react13.useLayoutEffect)(() => {
2394
+ (0, import_react14.useLayoutEffect)(() => {
2358
2395
  const canvas = canvasRef.current;
2359
2396
  if (!canvas) return;
2360
2397
  const ctx = canvas.getContext("2d");
@@ -2381,7 +2418,7 @@ var SpectrogramLabels = ({
2381
2418
  }
2382
2419
  }
2383
2420
  }, [waveHeight, numChannels, frequencyScaleFn, minFrequency, maxFrequency, labelsColor, labelsBackground, devicePixelRatio, spectrogramHeight, clipHeaderOffset]);
2384
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LabelsStickyWrapper, { $height: totalHeight + clipHeaderOffset, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2421
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(LabelsStickyWrapper, { $height: totalHeight + clipHeaderOffset, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2385
2422
  "canvas",
2386
2423
  {
2387
2424
  ref: canvasRef,
@@ -2397,10 +2434,10 @@ var SpectrogramLabels = ({
2397
2434
  };
2398
2435
 
2399
2436
  // src/components/SmartScale.tsx
2400
- var import_react15 = require("react");
2437
+ var import_react16 = require("react");
2401
2438
 
2402
2439
  // src/components/TimeScale.tsx
2403
- var import_react14 = __toESM(require("react"));
2440
+ var import_react15 = __toESM(require("react"));
2404
2441
  var import_styled_components22 = __toESM(require("styled-components"));
2405
2442
 
2406
2443
  // src/utils/conversions.ts
@@ -2424,7 +2461,7 @@ function secondsToPixels(seconds, samplesPerPixel, sampleRate) {
2424
2461
  }
2425
2462
 
2426
2463
  // src/components/TimeScale.tsx
2427
- var import_jsx_runtime21 = require("react/jsx-runtime");
2464
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2428
2465
  function formatTime2(milliseconds) {
2429
2466
  const seconds = Math.floor(milliseconds / 1e3);
2430
2467
  const s = seconds % 60;
@@ -2476,15 +2513,15 @@ var TimeScale = (props) => {
2476
2513
  } = props;
2477
2514
  const canvasInfo = /* @__PURE__ */ new Map();
2478
2515
  const timeMarkers = [];
2479
- const canvasRef = (0, import_react14.useRef)(null);
2516
+ const canvasRef = (0, import_react15.useRef)(null);
2480
2517
  const {
2481
2518
  sampleRate,
2482
2519
  samplesPerPixel,
2483
2520
  timeScaleHeight,
2484
2521
  controls: { show: showControls, width: controlWidth }
2485
- } = (0, import_react14.useContext)(PlaylistInfoContext);
2522
+ } = (0, import_react15.useContext)(PlaylistInfoContext);
2486
2523
  const devicePixelRatio = useDevicePixelRatio();
2487
- (0, import_react14.useEffect)(() => {
2524
+ (0, import_react15.useEffect)(() => {
2488
2525
  if (canvasRef.current !== null) {
2489
2526
  const canvas = canvasRef.current;
2490
2527
  const ctx = canvas.getContext("2d");
@@ -2518,7 +2555,7 @@ var TimeScale = (props) => {
2518
2555
  if (counter % marker === 0) {
2519
2556
  const timeMs = counter;
2520
2557
  const timestamp = formatTime2(timeMs);
2521
- const timestampContent = renderTimestamp ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react14.default.Fragment, { children: renderTimestamp(timeMs, pix) }, `timestamp-${counter}`) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TimeStamp, { $left: pix, children: timestamp }, timestamp);
2558
+ const timestampContent = renderTimestamp ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react15.default.Fragment, { children: renderTimestamp(timeMs, pix) }, `timestamp-${counter}`) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TimeStamp, { $left: pix, children: timestamp }, timestamp);
2522
2559
  timeMarkers.push(timestampContent);
2523
2560
  canvasInfo.set(pix, timeScaleHeight);
2524
2561
  } else if (counter % bigStep === 0) {
@@ -2528,7 +2565,7 @@ var TimeScale = (props) => {
2528
2565
  }
2529
2566
  counter += secondStep;
2530
2567
  }
2531
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2568
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2532
2569
  PlaylistTimeScaleScroll,
2533
2570
  {
2534
2571
  $cssWidth: widthX,
@@ -2536,7 +2573,7 @@ var TimeScale = (props) => {
2536
2573
  $timeScaleHeight: timeScaleHeight,
2537
2574
  children: [
2538
2575
  timeMarkers,
2539
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2576
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2540
2577
  TimeTicks,
2541
2578
  {
2542
2579
  $cssWidth: widthX,
@@ -2553,7 +2590,7 @@ var TimeScale = (props) => {
2553
2590
  var StyledTimeScale = (0, import_styled_components22.withTheme)(TimeScale);
2554
2591
 
2555
2592
  // src/components/SmartScale.tsx
2556
- var import_jsx_runtime22 = require("react/jsx-runtime");
2593
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2557
2594
  var timeinfo = /* @__PURE__ */ new Map([
2558
2595
  [
2559
2596
  700,
@@ -2627,9 +2664,9 @@ function getScaleInfo(samplesPerPixel) {
2627
2664
  return config;
2628
2665
  }
2629
2666
  var SmartScale = ({ renderTimestamp }) => {
2630
- const { samplesPerPixel, duration } = (0, import_react15.useContext)(PlaylistInfoContext);
2667
+ const { samplesPerPixel, duration } = (0, import_react16.useContext)(PlaylistInfoContext);
2631
2668
  let config = getScaleInfo(samplesPerPixel);
2632
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2669
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2633
2670
  StyledTimeScale,
2634
2671
  {
2635
2672
  marker: config.marker,
@@ -2643,7 +2680,7 @@ var SmartScale = ({ renderTimestamp }) => {
2643
2680
 
2644
2681
  // src/components/TimeFormatSelect.tsx
2645
2682
  var import_styled_components23 = __toESM(require("styled-components"));
2646
- var import_jsx_runtime23 = require("react/jsx-runtime");
2683
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2647
2684
  var SelectWrapper = import_styled_components23.default.div`
2648
2685
  display: inline-flex;
2649
2686
  align-items: center;
@@ -2666,7 +2703,7 @@ var TimeFormatSelect = ({
2666
2703
  const handleChange = (e) => {
2667
2704
  onChange(e.target.value);
2668
2705
  };
2669
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SelectWrapper, { className, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2706
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SelectWrapper, { className, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2670
2707
  BaseSelect,
2671
2708
  {
2672
2709
  className: "time-format",
@@ -2674,14 +2711,14 @@ var TimeFormatSelect = ({
2674
2711
  onChange: handleChange,
2675
2712
  disabled,
2676
2713
  "aria-label": "Time format selection",
2677
- children: TIME_FORMAT_OPTIONS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: option.value, children: option.label }, option.value))
2714
+ children: TIME_FORMAT_OPTIONS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: option.value, children: option.label }, option.value))
2678
2715
  }
2679
2716
  ) });
2680
2717
  };
2681
2718
 
2682
2719
  // src/components/Track.tsx
2683
2720
  var import_styled_components24 = __toESM(require("styled-components"));
2684
- var import_jsx_runtime24 = require("react/jsx-runtime");
2721
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2685
2722
  var Container = import_styled_components24.default.div.attrs((props) => ({
2686
2723
  style: {
2687
2724
  height: `${props.$waveHeight * props.$numChannels + (props.$hasClipHeaders ? CLIP_HEADER_HEIGHT : 0)}px`
@@ -2736,7 +2773,7 @@ var Track = ({
2736
2773
  controls: { show, width: controlWidth }
2737
2774
  } = usePlaylistInfo();
2738
2775
  const controls = useTrackControls();
2739
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2776
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2740
2777
  Container,
2741
2778
  {
2742
2779
  $numChannels: numChannels,
@@ -2747,7 +2784,7 @@ var Track = ({
2747
2784
  $hasClipHeaders: hasClipHeaders,
2748
2785
  $isSelected: isSelected,
2749
2786
  children: [
2750
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2787
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2751
2788
  ControlsWrapper,
2752
2789
  {
2753
2790
  $controlWidth: show ? controlWidth : 0,
@@ -2755,7 +2792,7 @@ var Track = ({
2755
2792
  children: controls
2756
2793
  }
2757
2794
  ),
2758
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2795
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2759
2796
  ChannelContainer,
2760
2797
  {
2761
2798
  $controlWidth: show ? controlWidth : 0,
@@ -2862,8 +2899,8 @@ var ButtonGroup = import_styled_components26.default.div`
2862
2899
 
2863
2900
  // src/components/TrackControls/CloseButton.tsx
2864
2901
  var import_styled_components27 = __toESM(require("styled-components"));
2865
- var import_react16 = require("@phosphor-icons/react");
2866
- var import_jsx_runtime25 = require("react/jsx-runtime");
2902
+ var import_react17 = require("@phosphor-icons/react");
2903
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2867
2904
  var StyledCloseButton = import_styled_components27.default.button`
2868
2905
  position: absolute;
2869
2906
  left: 0;
@@ -2888,7 +2925,7 @@ var StyledCloseButton = import_styled_components27.default.button`
2888
2925
  var CloseButton = ({
2889
2926
  onClick,
2890
2927
  title = "Remove track"
2891
- }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StyledCloseButton, { onClick, title, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react16.X, { size: 12, weight: "bold" }) });
2928
+ }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(StyledCloseButton, { onClick, title, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react17.X, { size: 12, weight: "bold" }) });
2892
2929
 
2893
2930
  // src/components/TrackControls/Controls.tsx
2894
2931
  var import_styled_components28 = __toESM(require("styled-components"));
@@ -2923,24 +2960,24 @@ var Header = import_styled_components29.default.header`
2923
2960
  `;
2924
2961
 
2925
2962
  // src/components/TrackControls/VolumeDownIcon.tsx
2926
- var import_react17 = require("@phosphor-icons/react");
2927
- var import_jsx_runtime26 = require("react/jsx-runtime");
2928
- var VolumeDownIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react17.SpeakerLowIcon, { weight: "light", ...props });
2929
-
2930
- // src/components/TrackControls/VolumeUpIcon.tsx
2931
2963
  var import_react18 = require("@phosphor-icons/react");
2932
2964
  var import_jsx_runtime27 = require("react/jsx-runtime");
2933
- var VolumeUpIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react18.SpeakerHighIcon, { weight: "light", ...props });
2965
+ var VolumeDownIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react18.SpeakerLowIcon, { weight: "light", ...props });
2934
2966
 
2935
- // src/components/TrackControls/TrashIcon.tsx
2967
+ // src/components/TrackControls/VolumeUpIcon.tsx
2936
2968
  var import_react19 = require("@phosphor-icons/react");
2937
2969
  var import_jsx_runtime28 = require("react/jsx-runtime");
2938
- var TrashIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react19.TrashIcon, { weight: "light", ...props });
2970
+ var VolumeUpIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react19.SpeakerHighIcon, { weight: "light", ...props });
2939
2971
 
2940
- // src/components/TrackControls/DotsIcon.tsx
2972
+ // src/components/TrackControls/TrashIcon.tsx
2941
2973
  var import_react20 = require("@phosphor-icons/react");
2942
2974
  var import_jsx_runtime29 = require("react/jsx-runtime");
2943
- var DotsIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react20.DotsThreeIcon, { weight: "bold", ...props });
2975
+ var TrashIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react20.TrashIcon, { weight: "light", ...props });
2976
+
2977
+ // src/components/TrackControls/DotsIcon.tsx
2978
+ var import_react21 = require("@phosphor-icons/react");
2979
+ var import_jsx_runtime30 = require("react/jsx-runtime");
2980
+ var DotsIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react21.DotsThreeIcon, { weight: "bold", ...props });
2944
2981
 
2945
2982
  // src/components/TrackControls/Slider.tsx
2946
2983
  var import_styled_components30 = __toESM(require("styled-components"));
@@ -3008,10 +3045,10 @@ var SliderWrapper = import_styled_components31.default.label`
3008
3045
  `;
3009
3046
 
3010
3047
  // src/components/TrackMenu.tsx
3011
- var import_react21 = __toESM(require("react"));
3048
+ var import_react22 = __toESM(require("react"));
3012
3049
  var import_react_dom = require("react-dom");
3013
3050
  var import_styled_components32 = __toESM(require("styled-components"));
3014
- var import_jsx_runtime30 = require("react/jsx-runtime");
3051
+ var import_jsx_runtime31 = require("react/jsx-runtime");
3015
3052
  var MenuContainer = import_styled_components32.default.div`
3016
3053
  position: relative;
3017
3054
  display: inline-block;
@@ -3052,13 +3089,13 @@ var Divider = import_styled_components32.default.hr`
3052
3089
  var TrackMenu = ({
3053
3090
  items: itemsProp
3054
3091
  }) => {
3055
- const [open, setOpen] = (0, import_react21.useState)(false);
3092
+ const [open, setOpen] = (0, import_react22.useState)(false);
3056
3093
  const close = () => setOpen(false);
3057
3094
  const items = typeof itemsProp === "function" ? itemsProp(close) : itemsProp;
3058
- const [dropdownPos, setDropdownPos] = (0, import_react21.useState)({ top: 0, left: 0 });
3059
- const buttonRef = (0, import_react21.useRef)(null);
3060
- const dropdownRef = (0, import_react21.useRef)(null);
3061
- (0, import_react21.useEffect)(() => {
3095
+ const [dropdownPos, setDropdownPos] = (0, import_react22.useState)({ top: 0, left: 0 });
3096
+ const buttonRef = (0, import_react22.useRef)(null);
3097
+ const dropdownRef = (0, import_react22.useRef)(null);
3098
+ (0, import_react22.useEffect)(() => {
3062
3099
  if (open && buttonRef.current) {
3063
3100
  const rect = buttonRef.current.getBoundingClientRect();
3064
3101
  setDropdownPos({
@@ -3067,7 +3104,7 @@ var TrackMenu = ({
3067
3104
  });
3068
3105
  }
3069
3106
  }, [open]);
3070
- (0, import_react21.useEffect)(() => {
3107
+ (0, import_react22.useEffect)(() => {
3071
3108
  if (!open) return;
3072
3109
  const handleClick = (e) => {
3073
3110
  const target = e.target;
@@ -3078,8 +3115,8 @@ var TrackMenu = ({
3078
3115
  document.addEventListener("mousedown", handleClick);
3079
3116
  return () => document.removeEventListener("mousedown", handleClick);
3080
3117
  }, [open]);
3081
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(MenuContainer, { children: [
3082
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3118
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(MenuContainer, { children: [
3119
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3083
3120
  MenuButton,
3084
3121
  {
3085
3122
  ref: buttonRef,
@@ -3090,19 +3127,19 @@ var TrackMenu = ({
3090
3127
  onMouseDown: (e) => e.stopPropagation(),
3091
3128
  title: "Track menu",
3092
3129
  "aria-label": "Track menu",
3093
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DotsIcon, { size: 16 })
3130
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DotsIcon, { size: 16 })
3094
3131
  }
3095
3132
  ),
3096
3133
  open && typeof document !== "undefined" && (0, import_react_dom.createPortal)(
3097
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3134
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3098
3135
  Dropdown,
3099
3136
  {
3100
3137
  ref: dropdownRef,
3101
3138
  $top: dropdownPos.top,
3102
3139
  $left: dropdownPos.left,
3103
3140
  onMouseDown: (e) => e.stopPropagation(),
3104
- children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react21.default.Fragment, { children: [
3105
- index > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Divider, {}),
3141
+ children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react22.default.Fragment, { children: [
3142
+ index > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Divider, {}),
3106
3143
  item.content
3107
3144
  ] }, item.id))
3108
3145
  }
@@ -3147,6 +3184,7 @@ var TrackMenu = ({
3147
3184
  Playhead,
3148
3185
  PlayheadWithMarker,
3149
3186
  Playlist,
3187
+ PlaylistErrorBoundary,
3150
3188
  PlaylistInfoContext,
3151
3189
  PlayoutProvider,
3152
3190
  ScreenReaderOnly,