@waveform-playlist/browser 5.3.0 → 5.3.2
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 +21 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1011 -1002
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as Jr from "tone";
|
|
2
2
|
import { Volume as zn, getDestination as Hn, start as Xn, now as Wt, getTransport as pt, getContext as Me, Context as qr, setContext as Qr, Panner as ea, Gain as gn, Player as bn, Analyser as Ln, Meter as ta, connect as na, StereoWidener as ra, Gate as aa, Limiter as oa, Compressor as sa, Chebyshev as ia, BitCrusher as la, Distortion as ca, EQ3 as ua, AutoWah as da, AutoFilter as ma, AutoPanner as fa, Vibrato as ha, Tremolo as pa, Phaser as ga, Chorus as ba, PingPongDelay as va, FeedbackDelay as wa, JCReverb as ya, Freeverb as Ca, Reverb as xa } from "tone";
|
|
3
|
-
import { jsx as C, jsxs as
|
|
3
|
+
import { jsx as C, jsxs as te, Fragment as qe } from "react/jsx-runtime";
|
|
4
4
|
import * as T from "react";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import We, { createContext as Ee, useContext as De, useState as Z, useEffect as ee, Fragment as Ia, useRef as R, useLayoutEffect as tn, useCallback as D, useMemo as Je } from "react";
|
|
6
|
+
import M, { ThemeContext as Aa, withTheme as Gn, useTheme as ka, ThemeProvider as Nn } from "styled-components";
|
|
7
7
|
import { useDraggable as It, useSensor as Yt, MouseSensor as Sa, TouchSensor as $a, PointerSensor as Ma, useSensors as Ea, DndContext as Da } from "@dnd-kit/core";
|
|
8
8
|
import { createPortal as Yn } from "react-dom";
|
|
9
9
|
import { restrictToHorizontalAxis as Ta } from "@dnd-kit/modifiers";
|
|
@@ -586,14 +586,14 @@ jn.displayName = "SpeakerLowIcon";
|
|
|
586
586
|
const Jn = T.forwardRef((e, t) => /* @__PURE__ */ T.createElement(At, { ref: t, ...e, weights: Ha }));
|
|
587
587
|
Jn.displayName = "XIcon";
|
|
588
588
|
const La = Jn;
|
|
589
|
-
|
|
589
|
+
M.span`
|
|
590
590
|
font-family: 'Courier New', Monaco, monospace;
|
|
591
591
|
font-size: 1rem;
|
|
592
592
|
font-weight: 600;
|
|
593
593
|
color: ${(e) => e.theme?.textColor || "#333"};
|
|
594
594
|
user-select: none;
|
|
595
595
|
`;
|
|
596
|
-
var nn =
|
|
596
|
+
var nn = M.button`
|
|
597
597
|
display: inline-flex;
|
|
598
598
|
align-items: center;
|
|
599
599
|
justify-content: center;
|
|
@@ -623,40 +623,40 @@ var nn = $.button`
|
|
|
623
623
|
cursor: not-allowed;
|
|
624
624
|
}
|
|
625
625
|
`;
|
|
626
|
-
|
|
626
|
+
M(nn)`
|
|
627
627
|
padding: 0.25rem 0.5rem;
|
|
628
628
|
font-size: ${(e) => e.theme.fontSizeSmall};
|
|
629
629
|
`;
|
|
630
|
-
|
|
630
|
+
M(nn)`
|
|
631
631
|
padding: 0.5rem;
|
|
632
632
|
min-width: 2.25rem;
|
|
633
633
|
min-height: 2.25rem;
|
|
634
634
|
`;
|
|
635
|
-
|
|
635
|
+
M(nn)`
|
|
636
636
|
padding: 0.25rem;
|
|
637
637
|
min-width: 1.75rem;
|
|
638
638
|
min-height: 1.75rem;
|
|
639
639
|
font-size: ${(e) => e.theme.fontSizeSmall};
|
|
640
640
|
`;
|
|
641
|
-
var Vt =
|
|
641
|
+
var Vt = M.div`
|
|
642
642
|
display: inline-flex;
|
|
643
643
|
align-items: center;
|
|
644
644
|
gap: 0.5rem;
|
|
645
|
-
`, Pt =
|
|
645
|
+
`, Pt = M.input`
|
|
646
646
|
cursor: pointer;
|
|
647
647
|
accent-color: ${(e) => e.theme.inputFocusBorder};
|
|
648
648
|
|
|
649
649
|
&:disabled {
|
|
650
650
|
cursor: not-allowed;
|
|
651
651
|
}
|
|
652
|
-
`, zt =
|
|
652
|
+
`, zt = M.label`
|
|
653
653
|
margin: 0;
|
|
654
654
|
cursor: pointer;
|
|
655
655
|
user-select: none;
|
|
656
656
|
font-family: ${(e) => e.theme.fontFamily};
|
|
657
657
|
font-size: ${(e) => e.theme.fontSize};
|
|
658
658
|
color: ${(e) => e.theme.textColor};
|
|
659
|
-
`, Ye =
|
|
659
|
+
`, Ye = M.button`
|
|
660
660
|
padding: 0.5rem 1rem;
|
|
661
661
|
background: ${(e) => e.theme.buttonBackground || "#007bff"};
|
|
662
662
|
color: ${(e) => e.theme.buttonText || "white"};
|
|
@@ -682,7 +682,7 @@ var Vt = $.div`
|
|
|
682
682
|
cursor: not-allowed;
|
|
683
683
|
opacity: 0.6;
|
|
684
684
|
}
|
|
685
|
-
`, qn =
|
|
685
|
+
`, qn = M.input`
|
|
686
686
|
padding: 0.5rem 0.75rem;
|
|
687
687
|
font-family: ${(e) => e.theme.fontFamily};
|
|
688
688
|
font-size: ${(e) => e.theme.fontSize};
|
|
@@ -707,11 +707,11 @@ var Vt = $.div`
|
|
|
707
707
|
cursor: not-allowed;
|
|
708
708
|
}
|
|
709
709
|
`;
|
|
710
|
-
|
|
710
|
+
M(qn)`
|
|
711
711
|
padding: 0.25rem 0.5rem;
|
|
712
712
|
font-size: ${(e) => e.theme.fontSizeSmall};
|
|
713
713
|
`;
|
|
714
|
-
var Qn =
|
|
714
|
+
var Qn = M.label`
|
|
715
715
|
font-family: ${(e) => e.theme.fontFamily};
|
|
716
716
|
font-size: ${(e) => e.theme.fontSizeSmall};
|
|
717
717
|
font-weight: 500;
|
|
@@ -719,7 +719,7 @@ var Qn = $.label`
|
|
|
719
719
|
margin-bottom: 0.25rem;
|
|
720
720
|
display: block;
|
|
721
721
|
`;
|
|
722
|
-
|
|
722
|
+
M.label`
|
|
723
723
|
font-family: ${(e) => e.theme.fontFamily};
|
|
724
724
|
font-size: ${(e) => e.theme.fontSize};
|
|
725
725
|
color: ${(e) => e.theme.textColor};
|
|
@@ -728,7 +728,7 @@ $.label`
|
|
|
728
728
|
gap: 0.5rem;
|
|
729
729
|
cursor: pointer;
|
|
730
730
|
`;
|
|
731
|
-
var Ga =
|
|
731
|
+
var Ga = M.span`
|
|
732
732
|
position: absolute;
|
|
733
733
|
width: 1px;
|
|
734
734
|
height: 1px;
|
|
@@ -738,7 +738,7 @@ var Ga = $.span`
|
|
|
738
738
|
clip: rect(0, 0, 0, 0);
|
|
739
739
|
white-space: nowrap;
|
|
740
740
|
border: 0;
|
|
741
|
-
`, rn =
|
|
741
|
+
`, rn = M.select`
|
|
742
742
|
padding: 0.5rem 2rem 0.5rem 0.75rem;
|
|
743
743
|
font-family: ${(e) => e.theme.fontFamily};
|
|
744
744
|
font-size: ${(e) => e.theme.fontSize};
|
|
@@ -770,11 +770,11 @@ var Ga = $.span`
|
|
|
770
770
|
background-color: ${(e) => e.theme.inputBackground};
|
|
771
771
|
}
|
|
772
772
|
`;
|
|
773
|
-
|
|
773
|
+
M(rn)`
|
|
774
774
|
padding: 0.25rem 1.75rem 0.25rem 0.5rem;
|
|
775
775
|
font-size: ${(e) => e.theme.fontSizeSmall};
|
|
776
776
|
`;
|
|
777
|
-
var er =
|
|
777
|
+
var er = M.input.attrs({ type: "range" })`
|
|
778
778
|
-webkit-appearance: none;
|
|
779
779
|
appearance: none;
|
|
780
780
|
width: 100%;
|
|
@@ -855,7 +855,7 @@ var er = $.input.attrs({ type: "range" })`
|
|
|
855
855
|
onChange: t,
|
|
856
856
|
disabled: n = !1,
|
|
857
857
|
className: r
|
|
858
|
-
}) => /* @__PURE__ */
|
|
858
|
+
}) => /* @__PURE__ */ te(Vt, { className: r, children: [
|
|
859
859
|
/* @__PURE__ */ C(
|
|
860
860
|
Pt,
|
|
861
861
|
{
|
|
@@ -874,7 +874,7 @@ var er = $.input.attrs({ type: "range" })`
|
|
|
874
874
|
function tr(e) {
|
|
875
875
|
return typeof e == "object" && e !== null && "type" in e;
|
|
876
876
|
}
|
|
877
|
-
function
|
|
877
|
+
function lt(e) {
|
|
878
878
|
if (!tr(e))
|
|
879
879
|
return e;
|
|
880
880
|
const t = e.direction === "vertical" ? "to bottom" : "to right", n = e.stops.map((r) => `${r.color} ${r.offset * 100}%`).join(", ");
|
|
@@ -956,7 +956,7 @@ function Oa(e, t, n, r) {
|
|
|
956
956
|
a.addColorStop(s.offset, s.color);
|
|
957
957
|
return a;
|
|
958
958
|
}
|
|
959
|
-
var Ka =
|
|
959
|
+
var Ka = M.canvas.attrs((e) => ({
|
|
960
960
|
style: {
|
|
961
961
|
width: `${e.$cssWidth}px`,
|
|
962
962
|
height: `${e.$waveHeight}px`
|
|
@@ -969,7 +969,7 @@ var Ka = $.canvas.attrs((e) => ({
|
|
|
969
969
|
/* Disable image rendering interpolation */
|
|
970
970
|
image-rendering: pixelated;
|
|
971
971
|
image-rendering: crisp-edges;
|
|
972
|
-
`, Ua =
|
|
972
|
+
`, Ua = M.div.attrs((e) => ({
|
|
973
973
|
style: {
|
|
974
974
|
top: `${e.$waveHeight * e.$index}px`,
|
|
975
975
|
width: `${e.$cssWidth}px`,
|
|
@@ -996,7 +996,7 @@ var Ka = $.canvas.attrs((e) => ({
|
|
|
996
996
|
barGap: g = 0,
|
|
997
997
|
transparentBackground: f = !1,
|
|
998
998
|
drawMode: d = "inverted"
|
|
999
|
-
} = e, b =
|
|
999
|
+
} = e, b = R([]), v = D(
|
|
1000
1000
|
(y) => {
|
|
1001
1001
|
if (y !== null) {
|
|
1002
1002
|
const x = parseInt(y.dataset.index, 10);
|
|
@@ -1009,25 +1009,25 @@ var Ka = $.canvas.attrs((e) => ({
|
|
|
1009
1009
|
const y = b.current, x = u + g;
|
|
1010
1010
|
let k = 0;
|
|
1011
1011
|
for (let A = 0; A < y.length; A++) {
|
|
1012
|
-
const E = y[A],
|
|
1013
|
-
if (
|
|
1014
|
-
|
|
1012
|
+
const E = y[A], S = E.getContext("2d"), $ = Math.floor(i / 2), _ = 2 ** (n - 1);
|
|
1013
|
+
if (S) {
|
|
1014
|
+
S.resetTransform(), S.clearRect(0, 0, E.width, E.height), S.imageSmoothingEnabled = !1, S.scale(o, o);
|
|
1015
1015
|
const B = E.width / o;
|
|
1016
1016
|
let P;
|
|
1017
|
-
d === "normal" ? P = c : P = l,
|
|
1018
|
-
|
|
1017
|
+
d === "normal" ? P = c : P = l, S.fillStyle = Oa(
|
|
1018
|
+
S,
|
|
1019
1019
|
P,
|
|
1020
1020
|
B,
|
|
1021
1021
|
i
|
|
1022
1022
|
);
|
|
1023
|
-
const
|
|
1024
|
-
for (let
|
|
1025
|
-
const
|
|
1026
|
-
if (
|
|
1027
|
-
const
|
|
1028
|
-
if (
|
|
1029
|
-
const
|
|
1030
|
-
d === "normal" ?
|
|
1023
|
+
const H = k, K = k + B, X = Math.floor((H - u + x) / x) * x;
|
|
1024
|
+
for (let U = Math.max(0, X); U < K; U += x) {
|
|
1025
|
+
const W = U - H;
|
|
1026
|
+
if (W + u <= 0) continue;
|
|
1027
|
+
const Y = U;
|
|
1028
|
+
if (Y * 2 + 1 < t.length) {
|
|
1029
|
+
const j = t[Y * 2] / _, ue = t[Y * 2 + 1] / _, ae = Math.abs(j * $), se = Math.abs(ue * $);
|
|
1030
|
+
d === "normal" ? S.fillRect(W, $ - se, u, se + ae) : (S.fillRect(W, 0, u, $ - se), S.fillRect(W, $ + ae, u, $ - ae));
|
|
1031
1031
|
}
|
|
1032
1032
|
}
|
|
1033
1033
|
}
|
|
@@ -1062,7 +1062,7 @@ var Ka = $.canvas.attrs((e) => ({
|
|
|
1062
1062
|
);
|
|
1063
1063
|
I.push(x), p -= y, h += 1;
|
|
1064
1064
|
}
|
|
1065
|
-
const m = f ? "transparent" :
|
|
1065
|
+
const m = f ? "transparent" : lt(c);
|
|
1066
1066
|
return /* @__PURE__ */ C(
|
|
1067
1067
|
Ua,
|
|
1068
1068
|
{
|
|
@@ -1074,7 +1074,7 @@ var Ka = $.canvas.attrs((e) => ({
|
|
|
1074
1074
|
children: I
|
|
1075
1075
|
}
|
|
1076
1076
|
);
|
|
1077
|
-
}, rr = 22, ar =
|
|
1077
|
+
}, rr = 22, ar = M.div`
|
|
1078
1078
|
position: relative;
|
|
1079
1079
|
height: ${rr}px;
|
|
1080
1080
|
background: ${(e) => e.$isSelected ? e.theme.selectedClipHeaderBackgroundColor : e.theme.clipHeaderBackgroundColor};
|
|
@@ -1098,7 +1098,7 @@ var Ka = $.canvas.attrs((e) => ({
|
|
|
1098
1098
|
cursor: grabbing;
|
|
1099
1099
|
}
|
|
1100
1100
|
`}
|
|
1101
|
-
`, or =
|
|
1101
|
+
`, or = M.span`
|
|
1102
1102
|
font-size: 11px;
|
|
1103
1103
|
font-weight: 600;
|
|
1104
1104
|
font-family: ${(e) => e.theme.clipHeaderFontFamily};
|
|
@@ -1147,7 +1147,7 @@ var Ka = $.canvas.attrs((e) => ({
|
|
|
1147
1147
|
children: /* @__PURE__ */ C(or, { children: r })
|
|
1148
1148
|
}
|
|
1149
1149
|
);
|
|
1150
|
-
}, qa = 8, Qa = 24, eo =
|
|
1150
|
+
}, qa = 8, Qa = 24, eo = M.div`
|
|
1151
1151
|
position: absolute;
|
|
1152
1152
|
${(e) => e.$edge === "left" ? "left: 0;" : "right: 0;"}
|
|
1153
1153
|
top: 0;
|
|
@@ -1183,7 +1183,7 @@ var Ka = $.canvas.attrs((e) => ({
|
|
|
1183
1183
|
dragHandleProps: a,
|
|
1184
1184
|
touchOptimized: s = !1
|
|
1185
1185
|
}) => {
|
|
1186
|
-
const [o, i] =
|
|
1186
|
+
const [o, i] = We.useState(!1);
|
|
1187
1187
|
if (!a)
|
|
1188
1188
|
return null;
|
|
1189
1189
|
const { attributes: l, listeners: c, setActivatorNodeRef: u, isDragging: g } = a;
|
|
@@ -1203,7 +1203,7 @@ var Ka = $.canvas.attrs((e) => ({
|
|
|
1203
1203
|
...l
|
|
1204
1204
|
}
|
|
1205
1205
|
);
|
|
1206
|
-
}, to =
|
|
1206
|
+
}, to = M.div.attrs((e) => ({
|
|
1207
1207
|
style: {
|
|
1208
1208
|
left: `${e.$left}px`,
|
|
1209
1209
|
width: `${e.$width}px`
|
|
@@ -1214,7 +1214,7 @@ var Ka = $.canvas.attrs((e) => ({
|
|
|
1214
1214
|
bottom: 0;
|
|
1215
1215
|
pointer-events: none;
|
|
1216
1216
|
z-index: 50;
|
|
1217
|
-
`, no =
|
|
1217
|
+
`, no = M.svg`
|
|
1218
1218
|
width: 100%;
|
|
1219
1219
|
height: 100%;
|
|
1220
1220
|
display: block;
|
|
@@ -1263,7 +1263,7 @@ var In = ({
|
|
|
1263
1263
|
fill: o
|
|
1264
1264
|
}
|
|
1265
1265
|
) }) });
|
|
1266
|
-
}, ao =
|
|
1266
|
+
}, ao = M.div.attrs((e) => ({
|
|
1267
1267
|
style: e.$isOverlay ? {} : {
|
|
1268
1268
|
left: `${e.$left}px`,
|
|
1269
1269
|
width: `${e.$width}px`
|
|
@@ -1282,7 +1282,7 @@ var In = ({
|
|
|
1282
1282
|
&:hover {
|
|
1283
1283
|
background: rgba(255, 255, 255, 0.08);
|
|
1284
1284
|
}
|
|
1285
|
-
`, oo =
|
|
1285
|
+
`, oo = M.div`
|
|
1286
1286
|
flex: 1;
|
|
1287
1287
|
position: relative;
|
|
1288
1288
|
overflow: ${(e) => e.$isOverlay ? "visible" : "hidden"};
|
|
@@ -1308,26 +1308,26 @@ var In = ({
|
|
|
1308
1308
|
showFades: I = !1,
|
|
1309
1309
|
touchOptimized: w = !1
|
|
1310
1310
|
}) => {
|
|
1311
|
-
const m = Math.floor(o / l), x = Math.floor((o + i) / l) - m, k = c && !u && !g, A = `clip-${r}-${a}`, { attributes: E, listeners:
|
|
1311
|
+
const m = Math.floor(o / l), x = Math.floor((o + i) / l) - m, k = c && !u && !g, A = `clip-${r}-${a}`, { attributes: E, listeners: S, setNodeRef: $, setActivatorNodeRef: _, transform: B, isDragging: P } = It({
|
|
1312
1312
|
id: A,
|
|
1313
1313
|
data: { clipId: n, trackIndex: r, clipIndex: a },
|
|
1314
1314
|
disabled: !k
|
|
1315
|
-
}),
|
|
1315
|
+
}), H = `clip-boundary-left-${r}-${a}`, {
|
|
1316
1316
|
attributes: K,
|
|
1317
|
-
listeners:
|
|
1318
|
-
setActivatorNodeRef:
|
|
1319
|
-
isDragging:
|
|
1317
|
+
listeners: X,
|
|
1318
|
+
setActivatorNodeRef: U,
|
|
1319
|
+
isDragging: W
|
|
1320
1320
|
} = It({
|
|
1321
|
-
id:
|
|
1321
|
+
id: H,
|
|
1322
1322
|
data: { clipId: n, trackIndex: r, clipIndex: a, boundary: "left" },
|
|
1323
1323
|
disabled: !k
|
|
1324
|
-
}),
|
|
1325
|
-
attributes:
|
|
1324
|
+
}), Y = `clip-boundary-right-${r}-${a}`, {
|
|
1325
|
+
attributes: j,
|
|
1326
1326
|
listeners: ue,
|
|
1327
1327
|
setActivatorNodeRef: ae,
|
|
1328
|
-
isDragging:
|
|
1328
|
+
isDragging: se
|
|
1329
1329
|
} = It({
|
|
1330
|
-
id:
|
|
1330
|
+
id: Y,
|
|
1331
1331
|
data: { clipId: n, trackIndex: r, clipIndex: a, boundary: "right" },
|
|
1332
1332
|
disabled: !k
|
|
1333
1333
|
}), de = B ? {
|
|
@@ -1335,10 +1335,10 @@ var In = ({
|
|
|
1335
1335
|
zIndex: P ? 100 : void 0
|
|
1336
1336
|
// Below controls (z-index: 999) but above other clips
|
|
1337
1337
|
} : void 0;
|
|
1338
|
-
return /* @__PURE__ */
|
|
1338
|
+
return /* @__PURE__ */ te(
|
|
1339
1339
|
ao,
|
|
1340
1340
|
{
|
|
1341
|
-
ref:
|
|
1341
|
+
ref: $,
|
|
1342
1342
|
style: de,
|
|
1343
1343
|
className: t,
|
|
1344
1344
|
$left: m,
|
|
@@ -1357,10 +1357,10 @@ var In = ({
|
|
|
1357
1357
|
trackName: s,
|
|
1358
1358
|
isSelected: f,
|
|
1359
1359
|
disableDrag: u,
|
|
1360
|
-
dragHandleProps: k ? { attributes: E, listeners:
|
|
1360
|
+
dragHandleProps: k ? { attributes: E, listeners: S, setActivatorNodeRef: _ } : void 0
|
|
1361
1361
|
}
|
|
1362
1362
|
),
|
|
1363
|
-
/* @__PURE__ */
|
|
1363
|
+
/* @__PURE__ */ te(oo, { $isOverlay: g, children: [
|
|
1364
1364
|
e,
|
|
1365
1365
|
I && v && v.duration > 0 && /* @__PURE__ */ C(
|
|
1366
1366
|
In,
|
|
@@ -1381,7 +1381,7 @@ var In = ({
|
|
|
1381
1381
|
}
|
|
1382
1382
|
)
|
|
1383
1383
|
] }),
|
|
1384
|
-
c && !u && !g && /* @__PURE__ */
|
|
1384
|
+
c && !u && !g && /* @__PURE__ */ te(qe, { children: [
|
|
1385
1385
|
/* @__PURE__ */ C(
|
|
1386
1386
|
xn,
|
|
1387
1387
|
{
|
|
@@ -1392,9 +1392,9 @@ var In = ({
|
|
|
1392
1392
|
touchOptimized: w,
|
|
1393
1393
|
dragHandleProps: {
|
|
1394
1394
|
attributes: K,
|
|
1395
|
-
listeners:
|
|
1396
|
-
setActivatorNodeRef:
|
|
1397
|
-
isDragging:
|
|
1395
|
+
listeners: X,
|
|
1396
|
+
setActivatorNodeRef: U,
|
|
1397
|
+
isDragging: W
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
1400
1400
|
),
|
|
@@ -1407,10 +1407,10 @@ var In = ({
|
|
|
1407
1407
|
edge: "right",
|
|
1408
1408
|
touchOptimized: w,
|
|
1409
1409
|
dragHandleProps: {
|
|
1410
|
-
attributes:
|
|
1410
|
+
attributes: j,
|
|
1411
1411
|
listeners: ue,
|
|
1412
1412
|
setActivatorNodeRef: ae,
|
|
1413
|
-
isDragging:
|
|
1413
|
+
isDragging: se
|
|
1414
1414
|
}
|
|
1415
1415
|
}
|
|
1416
1416
|
)
|
|
@@ -1418,14 +1418,14 @@ var In = ({
|
|
|
1418
1418
|
]
|
|
1419
1419
|
}
|
|
1420
1420
|
);
|
|
1421
|
-
}, so =
|
|
1421
|
+
}, so = M.div`
|
|
1422
1422
|
display: inline-flex;
|
|
1423
1423
|
align-items: center;
|
|
1424
1424
|
gap: 0.5rem;
|
|
1425
|
-
`, io =
|
|
1425
|
+
`, io = M(Qn)`
|
|
1426
1426
|
margin: 0;
|
|
1427
1427
|
white-space: nowrap;
|
|
1428
|
-
`, lo =
|
|
1428
|
+
`, lo = M(er)`
|
|
1429
1429
|
width: 120px;
|
|
1430
1430
|
`, co = ({
|
|
1431
1431
|
volume: e,
|
|
@@ -1436,7 +1436,7 @@ var In = ({
|
|
|
1436
1436
|
const a = (s) => {
|
|
1437
1437
|
t(parseFloat(s.target.value) / 100);
|
|
1438
1438
|
};
|
|
1439
|
-
return /* @__PURE__ */
|
|
1439
|
+
return /* @__PURE__ */ te(so, { className: r, children: [
|
|
1440
1440
|
/* @__PURE__ */ C(io, { htmlFor: "master-gain", children: "Master Volume" }),
|
|
1441
1441
|
/* @__PURE__ */ C(
|
|
1442
1442
|
lo,
|
|
@@ -1451,7 +1451,7 @@ var In = ({
|
|
|
1451
1451
|
)
|
|
1452
1452
|
] });
|
|
1453
1453
|
};
|
|
1454
|
-
|
|
1454
|
+
M.div.attrs((e) => ({
|
|
1455
1455
|
style: {
|
|
1456
1456
|
transform: `translate3d(${e.$position}px, 0, 0)`
|
|
1457
1457
|
}
|
|
@@ -1466,7 +1466,7 @@ $.div.attrs((e) => ({
|
|
|
1466
1466
|
pointer-events: none;
|
|
1467
1467
|
will-change: transform;
|
|
1468
1468
|
`;
|
|
1469
|
-
|
|
1469
|
+
M.div`
|
|
1470
1470
|
position: absolute;
|
|
1471
1471
|
top: 0;
|
|
1472
1472
|
left: 0;
|
|
@@ -1475,7 +1475,7 @@ $.div`
|
|
|
1475
1475
|
pointer-events: none;
|
|
1476
1476
|
will-change: transform;
|
|
1477
1477
|
`;
|
|
1478
|
-
|
|
1478
|
+
M.div`
|
|
1479
1479
|
position: absolute;
|
|
1480
1480
|
top: -10px;
|
|
1481
1481
|
left: -6px;
|
|
@@ -1485,7 +1485,7 @@ $.div`
|
|
|
1485
1485
|
border-right: 7px solid transparent;
|
|
1486
1486
|
border-top: 10px solid ${(e) => e.$color};
|
|
1487
1487
|
`;
|
|
1488
|
-
|
|
1488
|
+
M.div`
|
|
1489
1489
|
position: absolute;
|
|
1490
1490
|
top: 0;
|
|
1491
1491
|
left: 0;
|
|
@@ -1493,29 +1493,29 @@ $.div`
|
|
|
1493
1493
|
height: 100%;
|
|
1494
1494
|
background: ${(e) => e.$color};
|
|
1495
1495
|
`;
|
|
1496
|
-
var uo =
|
|
1496
|
+
var uo = M.div`
|
|
1497
1497
|
overflow-y: hidden;
|
|
1498
1498
|
overflow-x: auto;
|
|
1499
1499
|
position: relative;
|
|
1500
|
-
`, mo =
|
|
1500
|
+
`, mo = M.div.attrs((e) => ({
|
|
1501
1501
|
style: e.$width !== void 0 ? { width: `${e.$width}px` } : {}
|
|
1502
1502
|
}))`
|
|
1503
1503
|
position: relative;
|
|
1504
1504
|
background: ${(e) => e.$backgroundColor || "transparent"};
|
|
1505
|
-
`, fo =
|
|
1505
|
+
`, fo = M.div.attrs((e) => ({
|
|
1506
1506
|
style: e.$width ? { minWidth: `${e.$width}px` } : {}
|
|
1507
1507
|
}))`
|
|
1508
1508
|
background: ${(e) => e.$backgroundColor || "white"};
|
|
1509
1509
|
width: 100%;
|
|
1510
1510
|
position: relative;
|
|
1511
1511
|
overflow: hidden; /* Constrain loop region to timescale area */
|
|
1512
|
-
`, ho =
|
|
1512
|
+
`, ho = M.div.attrs((e) => ({
|
|
1513
1513
|
style: e.$width !== void 0 ? { minWidth: `${e.$width}px` } : {}
|
|
1514
1514
|
}))`
|
|
1515
1515
|
position: relative;
|
|
1516
1516
|
background: ${(e) => e.$backgroundColor || "transparent"};
|
|
1517
1517
|
width: 100%;
|
|
1518
|
-
`, po =
|
|
1518
|
+
`, po = M.div`
|
|
1519
1519
|
position: absolute;
|
|
1520
1520
|
top: 0;
|
|
1521
1521
|
left: 0;
|
|
@@ -1540,14 +1540,14 @@ var uo = $.div`
|
|
|
1540
1540
|
scrollContainerRef: f,
|
|
1541
1541
|
isSelecting: d,
|
|
1542
1542
|
"data-playlist-state": b
|
|
1543
|
-
}) => /* @__PURE__ */ C(uo, { "data-scroll-container": "true", "data-playlist-state": b, ref: f, children: /* @__PURE__ */
|
|
1543
|
+
}) => /* @__PURE__ */ C(uo, { "data-scroll-container": "true", "data-playlist-state": b, ref: f, children: /* @__PURE__ */ te(
|
|
1544
1544
|
mo,
|
|
1545
1545
|
{
|
|
1546
1546
|
$backgroundColor: t,
|
|
1547
1547
|
$width: o,
|
|
1548
1548
|
children: [
|
|
1549
1549
|
r && /* @__PURE__ */ C(fo, { $width: a, $backgroundColor: n, children: r }),
|
|
1550
|
-
/* @__PURE__ */
|
|
1550
|
+
/* @__PURE__ */ te(ho, { $width: s, $backgroundColor: t, children: [
|
|
1551
1551
|
e,
|
|
1552
1552
|
(l || c) && /* @__PURE__ */ C(
|
|
1553
1553
|
po,
|
|
@@ -1565,7 +1565,7 @@ var uo = $.div`
|
|
|
1565
1565
|
}
|
|
1566
1566
|
) });
|
|
1567
1567
|
Gn(an);
|
|
1568
|
-
var go =
|
|
1568
|
+
var go = M.div.attrs((e) => ({
|
|
1569
1569
|
style: {
|
|
1570
1570
|
left: `${e.$left}px`,
|
|
1571
1571
|
width: `${e.$width}px`
|
|
@@ -1586,7 +1586,7 @@ var go = $.div.attrs((e) => ({
|
|
|
1586
1586
|
const r = Math.max(0, t - e);
|
|
1587
1587
|
return r <= 0 ? null : /* @__PURE__ */ C(go, { $left: e, $width: r, $color: n, "data-selection": !0 });
|
|
1588
1588
|
};
|
|
1589
|
-
|
|
1589
|
+
M.div.attrs((e) => ({
|
|
1590
1590
|
style: {
|
|
1591
1591
|
left: `${e.$left}px`,
|
|
1592
1592
|
width: `${e.$width}px`
|
|
@@ -1599,7 +1599,7 @@ $.div.attrs((e) => ({
|
|
|
1599
1599
|
z-index: 55; /* Between clips (z-index: 50) and selection (z-index: 60) */
|
|
1600
1600
|
pointer-events: none;
|
|
1601
1601
|
`;
|
|
1602
|
-
|
|
1602
|
+
M.div.attrs((e) => ({
|
|
1603
1603
|
style: {
|
|
1604
1604
|
left: `${e.$left}px`
|
|
1605
1605
|
}
|
|
@@ -1624,7 +1624,7 @@ $.div.attrs((e) => ({
|
|
|
1624
1624
|
${(e) => e.$isStart ? "border-right: 8px solid transparent;" : "border-left: 8px solid transparent;"}
|
|
1625
1625
|
}
|
|
1626
1626
|
`;
|
|
1627
|
-
var An =
|
|
1627
|
+
var An = M.div.attrs((e) => ({
|
|
1628
1628
|
style: {
|
|
1629
1629
|
left: `${e.$left}px`
|
|
1630
1630
|
}
|
|
@@ -1665,7 +1665,7 @@ var An = $.div.attrs((e) => ({
|
|
|
1665
1665
|
&:hover::before {
|
|
1666
1666
|
opacity: 1;
|
|
1667
1667
|
}
|
|
1668
|
-
`, bo =
|
|
1668
|
+
`, bo = M.div.attrs((e) => ({
|
|
1669
1669
|
style: {
|
|
1670
1670
|
left: `${e.$left}px`,
|
|
1671
1671
|
width: `${e.$width}px`
|
|
@@ -1692,7 +1692,7 @@ var An = $.div.attrs((e) => ({
|
|
|
1692
1692
|
minPosition: i = 0,
|
|
1693
1693
|
maxPosition: l = 1 / 0
|
|
1694
1694
|
}) => {
|
|
1695
|
-
const [c, u] =
|
|
1695
|
+
const [c, u] = Z(null), g = R(0), f = R(0), d = R(0), b = Math.max(0, t - e), v = D((h, I) => {
|
|
1696
1696
|
h.preventDefault(), h.stopPropagation(), u(I), g.current = h.clientX, f.current = I === "start" ? e : t;
|
|
1697
1697
|
const w = (y) => {
|
|
1698
1698
|
const x = y.clientX - g.current, k = f.current + x;
|
|
@@ -1718,7 +1718,7 @@ var An = $.div.attrs((e) => ({
|
|
|
1718
1718
|
};
|
|
1719
1719
|
document.addEventListener("mousemove", w), document.addEventListener("mouseup", m);
|
|
1720
1720
|
}, [e, t, i, l, o]);
|
|
1721
|
-
return b <= 0 ? null : /* @__PURE__ */
|
|
1721
|
+
return b <= 0 ? null : /* @__PURE__ */ te(qe, { children: [
|
|
1722
1722
|
/* @__PURE__ */ C(
|
|
1723
1723
|
bo,
|
|
1724
1724
|
{
|
|
@@ -1753,7 +1753,7 @@ var An = $.div.attrs((e) => ({
|
|
|
1753
1753
|
}
|
|
1754
1754
|
)
|
|
1755
1755
|
] });
|
|
1756
|
-
}, wo =
|
|
1756
|
+
}, wo = M.div.attrs((e) => ({
|
|
1757
1757
|
style: {
|
|
1758
1758
|
left: `${e.$leftOffset || 0}px`
|
|
1759
1759
|
}
|
|
@@ -1774,7 +1774,7 @@ var An = $.div.attrs((e) => ({
|
|
|
1774
1774
|
maxPosition: o = 1 / 0,
|
|
1775
1775
|
controlsOffset: i = 0
|
|
1776
1776
|
}) => {
|
|
1777
|
-
const [l, c] =
|
|
1777
|
+
const [l, c] = Z(!1), u = R(0), g = R(null), f = t > e, d = D((b) => {
|
|
1778
1778
|
const v = b.target;
|
|
1779
1779
|
if (v.closest("[data-loop-marker-handle]") || v.closest("[data-loop-region-timescale]"))
|
|
1780
1780
|
return;
|
|
@@ -1865,11 +1865,11 @@ var kn = ({
|
|
|
1865
1865
|
onChange: s,
|
|
1866
1866
|
readOnly: o = !1
|
|
1867
1867
|
}) => {
|
|
1868
|
-
const [i, l] =
|
|
1869
|
-
return
|
|
1868
|
+
const [i, l] = Z("");
|
|
1869
|
+
return ee(() => {
|
|
1870
1870
|
const f = bt(n, r);
|
|
1871
1871
|
l(f);
|
|
1872
|
-
}, [n, r, e]), /* @__PURE__ */
|
|
1872
|
+
}, [n, r, e]), /* @__PURE__ */ te(qe, { children: [
|
|
1873
1873
|
/* @__PURE__ */ C(Ga, { as: "label", htmlFor: e, children: t }),
|
|
1874
1874
|
/* @__PURE__ */ C(
|
|
1875
1875
|
qn,
|
|
@@ -1902,15 +1902,15 @@ var kn = ({
|
|
|
1902
1902
|
onSelectionChange: n,
|
|
1903
1903
|
className: r
|
|
1904
1904
|
}) => {
|
|
1905
|
-
const [a, s] =
|
|
1906
|
-
return
|
|
1905
|
+
const [a, s] = Z("hh:mm:ss.uuu");
|
|
1906
|
+
return ee(() => {
|
|
1907
1907
|
const l = document.querySelector(".time-format"), c = () => {
|
|
1908
1908
|
l && s(l.value);
|
|
1909
1909
|
};
|
|
1910
1910
|
return l && (s(l.value), l.addEventListener("change", c)), () => {
|
|
1911
1911
|
l?.removeEventListener("change", c);
|
|
1912
1912
|
};
|
|
1913
|
-
}, []), /* @__PURE__ */
|
|
1913
|
+
}, []), /* @__PURE__ */ te(qe, { children: [
|
|
1914
1914
|
/* @__PURE__ */ C(
|
|
1915
1915
|
kn,
|
|
1916
1916
|
{
|
|
@@ -1943,7 +1943,7 @@ function Ft() {
|
|
|
1943
1943
|
return window.devicePixelRatio;
|
|
1944
1944
|
}
|
|
1945
1945
|
var lr = Ee(Ft()), cr = ({ children: e }) => {
|
|
1946
|
-
const [t, n] =
|
|
1946
|
+
const [t, n] = Z(Ft());
|
|
1947
1947
|
return matchMedia(`(resolution: ${Ft()}dppx)`).addEventListener(
|
|
1948
1948
|
"change",
|
|
1949
1949
|
() => {
|
|
@@ -1979,7 +1979,7 @@ Ee({
|
|
|
1979
1979
|
setSelection: () => {
|
|
1980
1980
|
}
|
|
1981
1981
|
});
|
|
1982
|
-
var Tt = 1e3, Mo =
|
|
1982
|
+
var Tt = 1e3, Mo = M.div.attrs((e) => ({
|
|
1983
1983
|
style: {
|
|
1984
1984
|
top: `${e.$waveHeight * e.$index}px`,
|
|
1985
1985
|
width: `${e.$cssWidth}px`,
|
|
@@ -1990,7 +1990,7 @@ var Tt = 1e3, Mo = $.div.attrs((e) => ({
|
|
|
1990
1990
|
background: #000;
|
|
1991
1991
|
transform: translateZ(0);
|
|
1992
1992
|
backface-visibility: hidden;
|
|
1993
|
-
`, Eo =
|
|
1993
|
+
`, Eo = M.canvas.attrs((e) => ({
|
|
1994
1994
|
style: {
|
|
1995
1995
|
width: `${e.$cssWidth}px`,
|
|
1996
1996
|
height: `${e.$waveHeight}px`
|
|
@@ -2023,102 +2023,102 @@ var Sn = ({
|
|
|
2023
2023
|
clipId: g,
|
|
2024
2024
|
onCanvasesReady: f
|
|
2025
2025
|
}) => {
|
|
2026
|
-
const d =
|
|
2027
|
-
(
|
|
2028
|
-
if (
|
|
2029
|
-
const
|
|
2030
|
-
d.current[
|
|
2026
|
+
const d = R([]), b = R([]), v = R(/* @__PURE__ */ new WeakSet()), p = !!(u && g), h = D(
|
|
2027
|
+
(A) => {
|
|
2028
|
+
if (A !== null) {
|
|
2029
|
+
const E = parseInt(A.dataset.index, 10);
|
|
2030
|
+
d.current[E] = A;
|
|
2031
2031
|
}
|
|
2032
2032
|
},
|
|
2033
2033
|
[]
|
|
2034
2034
|
);
|
|
2035
|
-
|
|
2036
|
-
if (!
|
|
2037
|
-
const
|
|
2038
|
-
d.current.length =
|
|
2039
|
-
const
|
|
2040
|
-
for (let
|
|
2041
|
-
const
|
|
2042
|
-
if (!
|
|
2043
|
-
const
|
|
2035
|
+
ee(() => {
|
|
2036
|
+
if (!p) return;
|
|
2037
|
+
const A = Math.ceil(n / Tt);
|
|
2038
|
+
d.current.length = A;
|
|
2039
|
+
const E = d.current, S = [], $ = [];
|
|
2040
|
+
for (let _ = 0; _ < E.length; _++) {
|
|
2041
|
+
const B = E[_];
|
|
2042
|
+
if (!B || v.current.has(B)) continue;
|
|
2043
|
+
const P = `${g}-ch${e}-chunk${_}`;
|
|
2044
2044
|
try {
|
|
2045
|
-
const
|
|
2046
|
-
u.registerCanvas(
|
|
2047
|
-
} catch (
|
|
2048
|
-
console.warn(`[spectrogram] transferControlToOffscreen failed for ${
|
|
2045
|
+
const H = B.transferControlToOffscreen();
|
|
2046
|
+
u.registerCanvas(P, H), v.current.add(B), S.push(P), $.push(Math.min(n - _ * Tt, Tt));
|
|
2047
|
+
} catch (H) {
|
|
2048
|
+
console.warn(`[spectrogram] transferControlToOffscreen failed for ${P}:`, H);
|
|
2049
2049
|
continue;
|
|
2050
2050
|
}
|
|
2051
2051
|
}
|
|
2052
|
-
return b.current =
|
|
2053
|
-
for (const
|
|
2054
|
-
u.unregisterCanvas(
|
|
2052
|
+
return b.current = S, S.length > 0 && f && f(S, $), () => {
|
|
2053
|
+
for (const _ of b.current)
|
|
2054
|
+
u.unregisterCanvas(_);
|
|
2055
2055
|
b.current = [];
|
|
2056
2056
|
};
|
|
2057
|
-
}, [
|
|
2058
|
-
const
|
|
2057
|
+
}, [p, g, e, n]);
|
|
2058
|
+
const I = o ?? Do(), w = c ?? (t ? t.sampleRate / 2 : 22050), m = i ?? ((A, E, S) => (A - E) / (S - E));
|
|
2059
2059
|
tn(() => {
|
|
2060
|
-
if (
|
|
2061
|
-
const
|
|
2062
|
-
let
|
|
2063
|
-
const
|
|
2064
|
-
for (let
|
|
2065
|
-
const
|
|
2066
|
-
if (!
|
|
2067
|
-
const
|
|
2068
|
-
if (!
|
|
2069
|
-
const
|
|
2070
|
-
|
|
2071
|
-
const
|
|
2072
|
-
for (let
|
|
2073
|
-
const
|
|
2074
|
-
if (
|
|
2075
|
-
const
|
|
2076
|
-
for (let
|
|
2077
|
-
const
|
|
2078
|
-
let
|
|
2060
|
+
if (p || !t) return;
|
|
2061
|
+
const A = d.current, { frequencyBinCount: E, frameCount: S, hopSize: $, sampleRate: _, gainDb: B, rangeDb: P } = t, H = P === 0 ? 1 : P;
|
|
2062
|
+
let K = 0;
|
|
2063
|
+
const X = (U) => U / E * (_ / 2);
|
|
2064
|
+
for (let U = 0; U < A.length; U++) {
|
|
2065
|
+
const W = A[U];
|
|
2066
|
+
if (!W) continue;
|
|
2067
|
+
const Y = W.getContext("2d");
|
|
2068
|
+
if (!Y) continue;
|
|
2069
|
+
const j = W.width / a, ue = r;
|
|
2070
|
+
Y.resetTransform(), Y.clearRect(0, 0, W.width, W.height), Y.imageSmoothingEnabled = !1, Y.scale(a, a);
|
|
2071
|
+
const ae = Y.createImageData(j, ue), se = ae.data;
|
|
2072
|
+
for (let de = 0; de < j; de++) {
|
|
2073
|
+
const z = (K + de) * s, me = Math.floor(z / $);
|
|
2074
|
+
if (me < 0 || me >= S) continue;
|
|
2075
|
+
const ie = me * E;
|
|
2076
|
+
for (let G = 0; G < ue; G++) {
|
|
2077
|
+
const he = 1 - G / ue;
|
|
2078
|
+
let pe = Math.floor(he * E);
|
|
2079
2079
|
if (i) {
|
|
2080
|
-
let
|
|
2081
|
-
for (;
|
|
2082
|
-
const
|
|
2083
|
-
|
|
2080
|
+
let Ue = 0, oe = E - 1;
|
|
2081
|
+
for (; Ue < oe; ) {
|
|
2082
|
+
const Qe = Ue + oe >> 1, rt = X(Qe);
|
|
2083
|
+
m(rt, l, w) < he ? Ue = Qe + 1 : oe = Qe;
|
|
2084
2084
|
}
|
|
2085
|
-
|
|
2085
|
+
pe = Ue;
|
|
2086
2086
|
}
|
|
2087
|
-
if (
|
|
2088
|
-
const
|
|
2089
|
-
|
|
2087
|
+
if (pe < 0 || pe >= E) continue;
|
|
2088
|
+
const le = t.data[ie + pe], Fe = Math.max(0, Math.min(1, (le + H + B) / H)), _e = Math.floor(Fe * 255), Ke = (G * j + de) * 4;
|
|
2089
|
+
se[Ke] = I[_e * 3], se[Ke + 1] = I[_e * 3 + 1], se[Ke + 2] = I[_e * 3 + 2], se[Ke + 3] = 255;
|
|
2090
2090
|
}
|
|
2091
2091
|
}
|
|
2092
|
-
if (
|
|
2093
|
-
const
|
|
2094
|
-
|
|
2095
|
-
const
|
|
2096
|
-
if (!
|
|
2097
|
-
|
|
2092
|
+
if (Y.resetTransform(), Y.putImageData(ae, 0, 0), a !== 1) {
|
|
2093
|
+
const de = document.createElement("canvas");
|
|
2094
|
+
de.width = j, de.height = ue;
|
|
2095
|
+
const Oe = de.getContext("2d");
|
|
2096
|
+
if (!Oe) continue;
|
|
2097
|
+
Oe.putImageData(ae, 0, 0), Y.clearRect(0, 0, W.width, W.height), Y.imageSmoothingEnabled = !1, Y.drawImage(de, 0, 0, W.width, W.height);
|
|
2098
2098
|
}
|
|
2099
|
-
|
|
2099
|
+
K += j;
|
|
2100
2100
|
}
|
|
2101
|
-
}, [
|
|
2102
|
-
let
|
|
2103
|
-
const
|
|
2104
|
-
for (;
|
|
2105
|
-
const
|
|
2106
|
-
|
|
2101
|
+
}, [p, t, n, r, a, s, I, i, l, w, m]);
|
|
2102
|
+
let y = n, x = 0;
|
|
2103
|
+
const k = [];
|
|
2104
|
+
for (; y > 0; ) {
|
|
2105
|
+
const A = Math.min(y, Tt);
|
|
2106
|
+
k.push(
|
|
2107
2107
|
/* @__PURE__ */ C(
|
|
2108
2108
|
Eo,
|
|
2109
2109
|
{
|
|
2110
|
-
$cssWidth:
|
|
2111
|
-
width:
|
|
2110
|
+
$cssWidth: A,
|
|
2111
|
+
width: A * a,
|
|
2112
2112
|
height: r * a,
|
|
2113
2113
|
$waveHeight: r,
|
|
2114
|
-
"data-index":
|
|
2115
|
-
ref:
|
|
2114
|
+
"data-index": x,
|
|
2115
|
+
ref: h
|
|
2116
2116
|
},
|
|
2117
|
-
`${n}-${
|
|
2117
|
+
`${n}-${x}`
|
|
2118
2118
|
)
|
|
2119
|
-
),
|
|
2119
|
+
), y -= A, x++;
|
|
2120
2120
|
}
|
|
2121
|
-
return /* @__PURE__ */ C(Mo, { $index: e, $cssWidth: n, $waveHeight: r, children:
|
|
2121
|
+
return /* @__PURE__ */ C(Mo, { $index: e, $cssWidth: n, $waveHeight: r, children: k });
|
|
2122
2122
|
}, ur = ({
|
|
2123
2123
|
isSelected: e,
|
|
2124
2124
|
transparentBackground: t,
|
|
@@ -2156,7 +2156,7 @@ var Sn = ({
|
|
|
2156
2156
|
);
|
|
2157
2157
|
if (n === "both" && k) {
|
|
2158
2158
|
const A = Math.floor(b / 2);
|
|
2159
|
-
return /* @__PURE__ */
|
|
2159
|
+
return /* @__PURE__ */ te(qe, { children: [
|
|
2160
2160
|
/* @__PURE__ */ C(
|
|
2161
2161
|
Sn,
|
|
2162
2162
|
{
|
|
@@ -2208,7 +2208,7 @@ var Sn = ({
|
|
|
2208
2208
|
drawMode: x
|
|
2209
2209
|
}
|
|
2210
2210
|
);
|
|
2211
|
-
}, $n = 72, To =
|
|
2211
|
+
}, $n = 72, To = M.div`
|
|
2212
2212
|
position: sticky;
|
|
2213
2213
|
left: 0;
|
|
2214
2214
|
z-index: 101;
|
|
@@ -2252,7 +2252,7 @@ var Ro = ({
|
|
|
2252
2252
|
renderMode: i = "spectrogram",
|
|
2253
2253
|
hasClipHeaders: l = !1
|
|
2254
2254
|
}) => {
|
|
2255
|
-
const c =
|
|
2255
|
+
const c = R(null), u = on(), g = i === "both" ? Math.floor(e / 2) : e, f = t * e, d = l ? 22 : 0;
|
|
2256
2256
|
return tn(() => {
|
|
2257
2257
|
const b = c.current;
|
|
2258
2258
|
if (!b) return;
|
|
@@ -2291,7 +2291,7 @@ function Fo(e) {
|
|
|
2291
2291
|
const t = Math.floor(e / 1e3), n = t % 60;
|
|
2292
2292
|
return `${(t - n) / 60}:${String(n).padStart(2, "0")}`;
|
|
2293
2293
|
}
|
|
2294
|
-
var _o =
|
|
2294
|
+
var _o = M.div.attrs((e) => ({
|
|
2295
2295
|
style: {
|
|
2296
2296
|
width: `${e.$cssWidth}px`,
|
|
2297
2297
|
marginLeft: `${e.$controlWidth}px`,
|
|
@@ -2302,7 +2302,7 @@ var _o = $.div.attrs((e) => ({
|
|
|
2302
2302
|
overflow: visible; /* Allow time labels to render above the container */
|
|
2303
2303
|
border-bottom: 1px solid ${(e) => e.theme.timeColor};
|
|
2304
2304
|
box-sizing: border-box;
|
|
2305
|
-
`, Zo =
|
|
2305
|
+
`, Zo = M.canvas.attrs((e) => ({
|
|
2306
2306
|
style: {
|
|
2307
2307
|
width: `${e.$cssWidth}px`,
|
|
2308
2308
|
height: `${e.$timeScaleHeight}px`
|
|
@@ -2312,7 +2312,7 @@ var _o = $.div.attrs((e) => ({
|
|
|
2312
2312
|
left: 0;
|
|
2313
2313
|
right: 0;
|
|
2314
2314
|
bottom: 0;
|
|
2315
|
-
`, Vo =
|
|
2315
|
+
`, Vo = M.div.attrs((e) => ({
|
|
2316
2316
|
style: {
|
|
2317
2317
|
left: `${e.$left + 4}px`
|
|
2318
2318
|
// Offset 4px to the right of the tick
|
|
@@ -2330,13 +2330,13 @@ var _o = $.div.attrs((e) => ({
|
|
|
2330
2330
|
bigStep: a,
|
|
2331
2331
|
secondStep: s,
|
|
2332
2332
|
renderTimestamp: o
|
|
2333
|
-
} = e, i = /* @__PURE__ */ new Map(), l = [], c =
|
|
2333
|
+
} = e, i = /* @__PURE__ */ new Map(), l = [], c = R(null), {
|
|
2334
2334
|
sampleRate: u,
|
|
2335
2335
|
samplesPerPixel: g,
|
|
2336
2336
|
timeScaleHeight: f,
|
|
2337
2337
|
controls: { show: d, width: b }
|
|
2338
2338
|
} = De(kt), v = on();
|
|
2339
|
-
|
|
2339
|
+
ee(() => {
|
|
2340
2340
|
if (c.current !== null) {
|
|
2341
2341
|
const w = c.current, m = w.getContext("2d");
|
|
2342
2342
|
if (m) {
|
|
@@ -2362,12 +2362,12 @@ var _o = $.div.attrs((e) => ({
|
|
|
2362
2362
|
for (let w = 0; w < p; w += h * s / 1e3) {
|
|
2363
2363
|
const m = Math.floor(w);
|
|
2364
2364
|
if (I % r === 0) {
|
|
2365
|
-
const y = I, x = Fo(y), k = o ? /* @__PURE__ */ C(
|
|
2365
|
+
const y = I, x = Fo(y), k = o ? /* @__PURE__ */ C(We.Fragment, { children: o(y, m) }, `timestamp-${I}`) : /* @__PURE__ */ C(Vo, { $left: m, children: x }, x);
|
|
2366
2366
|
l.push(k), i.set(m, f);
|
|
2367
2367
|
} else I % a === 0 ? i.set(m, Math.floor(f / 2)) : I % s === 0 && i.set(m, Math.floor(f / 5));
|
|
2368
2368
|
I += s;
|
|
2369
2369
|
}
|
|
2370
|
-
return /* @__PURE__ */
|
|
2370
|
+
return /* @__PURE__ */ te(
|
|
2371
2371
|
_o,
|
|
2372
2372
|
{
|
|
2373
2373
|
$cssWidth: p,
|
|
@@ -2469,7 +2469,7 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2469
2469
|
renderTimestamp: e
|
|
2470
2470
|
}
|
|
2471
2471
|
);
|
|
2472
|
-
}, Xo =
|
|
2472
|
+
}, Xo = M.div`
|
|
2473
2473
|
display: inline-flex;
|
|
2474
2474
|
align-items: center;
|
|
2475
2475
|
gap: 0.5rem;
|
|
@@ -2497,7 +2497,7 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2497
2497
|
"aria-label": "Time format selection",
|
|
2498
2498
|
children: Lo.map((s) => /* @__PURE__ */ C("option", { value: s.value, children: s.label }, s.value))
|
|
2499
2499
|
}
|
|
2500
|
-
) }), No =
|
|
2500
|
+
) }), No = M.div.attrs((e) => ({
|
|
2501
2501
|
style: {
|
|
2502
2502
|
height: `${e.$waveHeight * e.$numChannels + (e.$hasClipHeaders ? rr : 0)}px`
|
|
2503
2503
|
}
|
|
@@ -2505,7 +2505,7 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2505
2505
|
position: relative;
|
|
2506
2506
|
display: flex;
|
|
2507
2507
|
${(e) => e.$width !== void 0 && `width: ${e.$width}px;`}
|
|
2508
|
-
`, Yo =
|
|
2508
|
+
`, Yo = M.div.attrs((e) => ({
|
|
2509
2509
|
style: {
|
|
2510
2510
|
paddingLeft: `${e.$offset || 0}px`
|
|
2511
2511
|
}
|
|
@@ -2513,7 +2513,7 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2513
2513
|
position: relative;
|
|
2514
2514
|
background: ${(e) => e.$backgroundColor || "transparent"};
|
|
2515
2515
|
flex: 1;
|
|
2516
|
-
`, Oo =
|
|
2516
|
+
`, Oo = M.div.attrs((e) => ({
|
|
2517
2517
|
style: {
|
|
2518
2518
|
width: `${e.$controlWidth}px`
|
|
2519
2519
|
}
|
|
@@ -2547,7 +2547,7 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2547
2547
|
waveHeight: u,
|
|
2548
2548
|
controls: { show: g, width: f }
|
|
2549
2549
|
} = St(), d = xo();
|
|
2550
|
-
return /* @__PURE__ */
|
|
2550
|
+
return /* @__PURE__ */ te(
|
|
2551
2551
|
No,
|
|
2552
2552
|
{
|
|
2553
2553
|
$numChannels: e,
|
|
@@ -2580,7 +2580,7 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2580
2580
|
]
|
|
2581
2581
|
}
|
|
2582
2582
|
);
|
|
2583
|
-
}, En =
|
|
2583
|
+
}, En = M.button.attrs({
|
|
2584
2584
|
type: "button"
|
|
2585
2585
|
})`
|
|
2586
2586
|
display: inline-block;
|
|
@@ -2641,7 +2641,7 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2641
2641
|
box-shadow: 0 0 0 0.2rem ${e.theme.inputFocusBorder}33;
|
|
2642
2642
|
}
|
|
2643
2643
|
`}
|
|
2644
|
-
`, Ko =
|
|
2644
|
+
`, Ko = M.div`
|
|
2645
2645
|
margin-bottom: 0.3rem;
|
|
2646
2646
|
|
|
2647
2647
|
button:not(:first-child) {
|
|
@@ -2653,7 +2653,7 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2653
2653
|
border-top-right-radius: 0;
|
|
2654
2654
|
border-bottom-right-radius: 0;
|
|
2655
2655
|
}
|
|
2656
|
-
`, Uo =
|
|
2656
|
+
`, Uo = M.button`
|
|
2657
2657
|
position: absolute;
|
|
2658
2658
|
left: 0;
|
|
2659
2659
|
top: 0;
|
|
@@ -2676,7 +2676,7 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2676
2676
|
`, jo = ({
|
|
2677
2677
|
onClick: e,
|
|
2678
2678
|
title: t = "Remove track"
|
|
2679
|
-
}) => /* @__PURE__ */ C(Uo, { onClick: e, title: t, children: /* @__PURE__ */ C(La, { size: 12, weight: "bold" }) }), Jo =
|
|
2679
|
+
}) => /* @__PURE__ */ C(Uo, { onClick: e, title: t, children: /* @__PURE__ */ C(La, { size: 12, weight: "bold" }) }), Jo = M.div`
|
|
2680
2680
|
background: transparent;
|
|
2681
2681
|
width: 100%;
|
|
2682
2682
|
height: 100%;
|
|
@@ -2689,7 +2689,7 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2689
2689
|
text-align: center;
|
|
2690
2690
|
border: 1px solid ${(e) => e.theme.borderColor};
|
|
2691
2691
|
border-radius: ${(e) => e.theme.borderRadius};
|
|
2692
|
-
`, qo =
|
|
2692
|
+
`, qo = M.header`
|
|
2693
2693
|
overflow: hidden;
|
|
2694
2694
|
height: 26px;
|
|
2695
2695
|
width: 100%;
|
|
@@ -2700,7 +2700,7 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2700
2700
|
font-size: ${(e) => e.theme.fontSizeSmall};
|
|
2701
2701
|
color: ${(e) => e.theme.textColor};
|
|
2702
2702
|
background-color: transparent;
|
|
2703
|
-
`, Qo = (e) => /* @__PURE__ */ C(jn, { weight: "light", ...e }), es = (e) => /* @__PURE__ */ C(Un, { weight: "light", ...e }), ts = (e) => /* @__PURE__ */ C(Kn, { weight: "bold", ...e }), Dn =
|
|
2703
|
+
`, Qo = (e) => /* @__PURE__ */ C(jn, { weight: "light", ...e }), es = (e) => /* @__PURE__ */ C(Un, { weight: "light", ...e }), ts = (e) => /* @__PURE__ */ C(Kn, { weight: "bold", ...e }), Dn = M(er)`
|
|
2704
2704
|
width: 75%;
|
|
2705
2705
|
height: 5px;
|
|
2706
2706
|
background: ${(e) => e.theme.sliderTrackColor};
|
|
@@ -2749,7 +2749,7 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2749
2749
|
&:focus::-moz-range-thumb {
|
|
2750
2750
|
border: 2px solid ${(e) => e.theme.textColor};
|
|
2751
2751
|
}
|
|
2752
|
-
`, Tn =
|
|
2752
|
+
`, Tn = M.label`
|
|
2753
2753
|
width: 100%;
|
|
2754
2754
|
display: flex;
|
|
2755
2755
|
justify-content: space-between;
|
|
@@ -2757,10 +2757,10 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2757
2757
|
padding: 0 1rem;
|
|
2758
2758
|
margin-bottom: 0.2rem;
|
|
2759
2759
|
font-size: 14px;
|
|
2760
|
-
`, ns =
|
|
2760
|
+
`, ns = M.div`
|
|
2761
2761
|
position: relative;
|
|
2762
2762
|
display: inline-block;
|
|
2763
|
-
`, rs =
|
|
2763
|
+
`, rs = M.button`
|
|
2764
2764
|
background: none;
|
|
2765
2765
|
border: none;
|
|
2766
2766
|
cursor: pointer;
|
|
@@ -2774,7 +2774,7 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2774
2774
|
&:hover {
|
|
2775
2775
|
opacity: 1;
|
|
2776
2776
|
}
|
|
2777
|
-
`, as =
|
|
2777
|
+
`, as = M.div`
|
|
2778
2778
|
position: fixed;
|
|
2779
2779
|
top: ${(e) => e.$top}px;
|
|
2780
2780
|
left: ${(e) => e.$left}px;
|
|
@@ -2786,15 +2786,15 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2786
2786
|
padding: 0.5rem 0;
|
|
2787
2787
|
min-width: 180px;
|
|
2788
2788
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
2789
|
-
`, os =
|
|
2789
|
+
`, os = M.hr`
|
|
2790
2790
|
border: none;
|
|
2791
2791
|
border-top: 1px solid rgba(128, 128, 128, 0.3);
|
|
2792
2792
|
margin: 0.35rem 0;
|
|
2793
2793
|
`, ss = ({
|
|
2794
2794
|
items: e
|
|
2795
2795
|
}) => {
|
|
2796
|
-
const [t, n] =
|
|
2797
|
-
return
|
|
2796
|
+
const [t, n] = Z(!1), a = typeof e == "function" ? e(() => n(!1)) : e, [s, o] = Z({ top: 0, left: 0 }), i = R(null), l = R(null);
|
|
2797
|
+
return ee(() => {
|
|
2798
2798
|
if (t && i.current) {
|
|
2799
2799
|
const c = i.current.getBoundingClientRect();
|
|
2800
2800
|
o({
|
|
@@ -2802,14 +2802,14 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2802
2802
|
left: Math.max(0, c.right - 180)
|
|
2803
2803
|
});
|
|
2804
2804
|
}
|
|
2805
|
-
}, [t]),
|
|
2805
|
+
}, [t]), ee(() => {
|
|
2806
2806
|
if (!t) return;
|
|
2807
2807
|
const c = (u) => {
|
|
2808
2808
|
const g = u.target;
|
|
2809
2809
|
i.current && !i.current.contains(g) && l.current && !l.current.contains(g) && n(!1);
|
|
2810
2810
|
};
|
|
2811
2811
|
return document.addEventListener("mousedown", c), () => document.removeEventListener("mousedown", c);
|
|
2812
|
-
}, [t]), /* @__PURE__ */
|
|
2812
|
+
}, [t]), /* @__PURE__ */ te(ns, { children: [
|
|
2813
2813
|
/* @__PURE__ */ C(
|
|
2814
2814
|
rs,
|
|
2815
2815
|
{
|
|
@@ -2831,7 +2831,7 @@ var dr = ({ renderTimestamp: e }) => {
|
|
|
2831
2831
|
$top: s.top,
|
|
2832
2832
|
$left: s.left,
|
|
2833
2833
|
onMouseDown: (c) => c.stopPropagation(),
|
|
2834
|
-
children: a.map((c, u) => /* @__PURE__ */
|
|
2834
|
+
children: a.map((c, u) => /* @__PURE__ */ te(We.Fragment, { children: [
|
|
2835
2835
|
u > 0 && /* @__PURE__ */ C(os, {}),
|
|
2836
2836
|
c.content
|
|
2837
2837
|
] }, c.id))
|
|
@@ -2938,8 +2938,8 @@ function ps(e, t) {
|
|
|
2938
2938
|
return r > 0 && n++, n;
|
|
2939
2939
|
}
|
|
2940
2940
|
function gs(e) {
|
|
2941
|
-
for (var t = e.scale, n = e.amplitude_scale, r = e.split_channels, a = e.length, s = e.sample_rate, o = e.channels.map(function(
|
|
2942
|
-
return new Float32Array(
|
|
2941
|
+
for (var t = e.scale, n = e.amplitude_scale, r = e.split_channels, a = e.length, s = e.sample_rate, o = e.channels.map(function($) {
|
|
2942
|
+
return new Float32Array($);
|
|
2943
2943
|
}), i = r ? o.length : 1, l = 24, c = ps(a, t), u = e.bits === 8 ? 1 : 2, g = l + c * 2 * u * i, f = new ArrayBuffer(g), d = new DataView(f), b = 0, v = l, p = new Array(i), h = new Array(i), I = 0; I < i; I++)
|
|
2944
2944
|
p[I] = 1 / 0, h[I] = -1 / 0;
|
|
2945
2945
|
var w = e.bits === 8 ? ms : hs, m = e.bits === 8 ? ds : fs;
|
|
@@ -2960,8 +2960,8 @@ function gs(e) {
|
|
|
2960
2960
|
}
|
|
2961
2961
|
}
|
|
2962
2962
|
if (b > 0)
|
|
2963
|
-
for (var
|
|
2964
|
-
e.bits === 8 ? (d.setInt8(v++, p[
|
|
2963
|
+
for (var S = 0; S < i; S++)
|
|
2964
|
+
e.bits === 8 ? (d.setInt8(v++, p[S]), d.setInt8(v++, h[S])) : (d.setInt16(v, p[S], !0), d.setInt16(v + 2, h[S], !0));
|
|
2965
2965
|
return f;
|
|
2966
2966
|
}
|
|
2967
2967
|
function _t(e) {
|
|
@@ -3388,7 +3388,7 @@ function Ms(e) {
|
|
|
3388
3388
|
language: e.lang || "en"
|
|
3389
3389
|
};
|
|
3390
3390
|
}
|
|
3391
|
-
|
|
3391
|
+
M.div.attrs((e) => ({
|
|
3392
3392
|
style: {
|
|
3393
3393
|
left: `${e.$left}px`,
|
|
3394
3394
|
width: `${e.$width}px`
|
|
@@ -3410,7 +3410,7 @@ $.div.attrs((e) => ({
|
|
|
3410
3410
|
border-color: ${(e) => e.$color};
|
|
3411
3411
|
}
|
|
3412
3412
|
`;
|
|
3413
|
-
|
|
3413
|
+
M.div`
|
|
3414
3414
|
position: absolute;
|
|
3415
3415
|
bottom: 0;
|
|
3416
3416
|
left: 0;
|
|
@@ -3427,7 +3427,7 @@ $.div`
|
|
|
3427
3427
|
white-space: pre-wrap;
|
|
3428
3428
|
word-break: break-word;
|
|
3429
3429
|
`;
|
|
3430
|
-
|
|
3430
|
+
M.textarea`
|
|
3431
3431
|
position: absolute;
|
|
3432
3432
|
bottom: 0;
|
|
3433
3433
|
left: 0;
|
|
@@ -3448,7 +3448,7 @@ $.textarea`
|
|
|
3448
3448
|
border-color: #4CAF50;
|
|
3449
3449
|
}
|
|
3450
3450
|
`;
|
|
3451
|
-
|
|
3451
|
+
M.div`
|
|
3452
3452
|
position: absolute;
|
|
3453
3453
|
top: 0;
|
|
3454
3454
|
left: 0;
|
|
@@ -3460,7 +3460,7 @@ $.div`
|
|
|
3460
3460
|
justify-content: flex-start;
|
|
3461
3461
|
align-items: center;
|
|
3462
3462
|
`;
|
|
3463
|
-
|
|
3463
|
+
M.button`
|
|
3464
3464
|
background: transparent;
|
|
3465
3465
|
border: 1px solid rgba(255, 255, 255, 0.5);
|
|
3466
3466
|
color: white;
|
|
@@ -3483,7 +3483,7 @@ $.button`
|
|
|
3483
3483
|
background: rgba(255, 255, 255, 0.3);
|
|
3484
3484
|
}
|
|
3485
3485
|
`;
|
|
3486
|
-
var Es =
|
|
3486
|
+
var Es = M.div.attrs((e) => ({
|
|
3487
3487
|
style: {
|
|
3488
3488
|
left: `${e.$left}px`,
|
|
3489
3489
|
width: `${e.$width}px`
|
|
@@ -3493,7 +3493,7 @@ var Es = $.div.attrs((e) => ({
|
|
|
3493
3493
|
top: 0;
|
|
3494
3494
|
height: 100%;
|
|
3495
3495
|
pointer-events: none; /* Let events pass through to children */
|
|
3496
|
-
`, Ds =
|
|
3496
|
+
`, Ds = M.div`
|
|
3497
3497
|
position: absolute;
|
|
3498
3498
|
top: 0;
|
|
3499
3499
|
left: 0;
|
|
@@ -3517,7 +3517,7 @@ var Es = $.div.attrs((e) => ({
|
|
|
3517
3517
|
border-width: 3px;
|
|
3518
3518
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
|
|
3519
3519
|
}
|
|
3520
|
-
`, Ts =
|
|
3520
|
+
`, Ts = M.span`
|
|
3521
3521
|
font-size: 12px;
|
|
3522
3522
|
font-weight: 600;
|
|
3523
3523
|
color: ${(e) => e.theme?.annotationLabelColor || "#2a2a2a"};
|
|
@@ -3527,7 +3527,7 @@ var Es = $.div.attrs((e) => ({
|
|
|
3527
3527
|
padding: 0 6px;
|
|
3528
3528
|
letter-spacing: 0.3px;
|
|
3529
3529
|
user-select: none;
|
|
3530
|
-
`, Wn =
|
|
3530
|
+
`, Wn = M.div`
|
|
3531
3531
|
position: absolute;
|
|
3532
3532
|
top: 0;
|
|
3533
3533
|
${(e) => e.$position === "left" ? "left: 0" : "right: 0"};
|
|
@@ -3599,7 +3599,7 @@ var Es = $.div.attrs((e) => ({
|
|
|
3599
3599
|
}, y = (x) => {
|
|
3600
3600
|
x.stopPropagation();
|
|
3601
3601
|
};
|
|
3602
|
-
return /* @__PURE__ */
|
|
3602
|
+
return /* @__PURE__ */ te(Es, { $left: n, $width: c, children: [
|
|
3603
3603
|
/* @__PURE__ */ C(
|
|
3604
3604
|
Ds,
|
|
3605
3605
|
{
|
|
@@ -3634,7 +3634,7 @@ var Es = $.div.attrs((e) => ({
|
|
|
3634
3634
|
}
|
|
3635
3635
|
)
|
|
3636
3636
|
] });
|
|
3637
|
-
}, Bs =
|
|
3637
|
+
}, Bs = M.div.attrs((e) => ({
|
|
3638
3638
|
style: {
|
|
3639
3639
|
height: `${e.$height}px`
|
|
3640
3640
|
}
|
|
@@ -3644,7 +3644,7 @@ var Es = $.div.attrs((e) => ({
|
|
|
3644
3644
|
${(e) => e.$width !== void 0 && `width: ${e.$width}px;`}
|
|
3645
3645
|
background: transparent;
|
|
3646
3646
|
z-index: 110;
|
|
3647
|
-
`, Rs =
|
|
3647
|
+
`, Rs = M.div`
|
|
3648
3648
|
position: sticky;
|
|
3649
3649
|
z-index: 200;
|
|
3650
3650
|
left: 0;
|
|
@@ -3652,7 +3652,7 @@ var Es = $.div.attrs((e) => ({
|
|
|
3652
3652
|
width: ${(e) => e.$controlWidth}px;
|
|
3653
3653
|
flex-shrink: 0;
|
|
3654
3654
|
background: transparent;
|
|
3655
|
-
`, Ws =
|
|
3655
|
+
`, Ws = M.div`
|
|
3656
3656
|
position: relative;
|
|
3657
3657
|
flex: 1;
|
|
3658
3658
|
padding-left: ${(e) => e.$offset || 0}px;
|
|
@@ -3666,7 +3666,7 @@ var Es = $.div.attrs((e) => ({
|
|
|
3666
3666
|
const {
|
|
3667
3667
|
controls: { show: s, width: o }
|
|
3668
3668
|
} = St();
|
|
3669
|
-
return /* @__PURE__ */
|
|
3669
|
+
return /* @__PURE__ */ te(
|
|
3670
3670
|
Bs,
|
|
3671
3671
|
{
|
|
3672
3672
|
className: t,
|
|
@@ -3680,7 +3680,7 @@ var Es = $.div.attrs((e) => ({
|
|
|
3680
3680
|
}
|
|
3681
3681
|
);
|
|
3682
3682
|
};
|
|
3683
|
-
|
|
3683
|
+
M.div.attrs((e) => ({
|
|
3684
3684
|
style: {
|
|
3685
3685
|
height: `${e.$height}px`
|
|
3686
3686
|
}
|
|
@@ -3690,7 +3690,7 @@ $.div.attrs((e) => ({
|
|
|
3690
3690
|
${(e) => e.$width !== void 0 && `width: ${e.$width}px;`}
|
|
3691
3691
|
background: transparent;
|
|
3692
3692
|
`;
|
|
3693
|
-
|
|
3693
|
+
M.div`
|
|
3694
3694
|
position: sticky;
|
|
3695
3695
|
z-index: 200;
|
|
3696
3696
|
left: 0;
|
|
@@ -3705,17 +3705,17 @@ $.div`
|
|
|
3705
3705
|
color: ${(e) => e.theme?.textColorMuted || "#666"};
|
|
3706
3706
|
font-weight: bold;
|
|
3707
3707
|
`;
|
|
3708
|
-
|
|
3708
|
+
M.div`
|
|
3709
3709
|
position: relative;
|
|
3710
3710
|
flex: 1;
|
|
3711
3711
|
padding-left: ${(e) => e.$offset || 0}px;
|
|
3712
3712
|
`;
|
|
3713
|
-
var Fs =
|
|
3713
|
+
var Fs = M.div`
|
|
3714
3714
|
background: ${(e) => e.theme?.backgroundColor || "#fff"};
|
|
3715
3715
|
${(e) => e.$height ? `height: ${e.$height}px;` : "max-height: 200px;"}
|
|
3716
3716
|
overflow-y: auto;
|
|
3717
3717
|
padding: 8px;
|
|
3718
|
-
`, _s =
|
|
3718
|
+
`, _s = M.div`
|
|
3719
3719
|
padding: 12px;
|
|
3720
3720
|
margin-bottom: 6px;
|
|
3721
3721
|
border-left: 4px solid ${(e) => e.$isActive ? "#ff9800" : "transparent"};
|
|
@@ -3734,16 +3734,16 @@ var Fs = $.div`
|
|
|
3734
3734
|
outline: 2px solid #ff9800;
|
|
3735
3735
|
outline-offset: 2px;
|
|
3736
3736
|
}
|
|
3737
|
-
`, Zs =
|
|
3737
|
+
`, Zs = M.div`
|
|
3738
3738
|
display: flex;
|
|
3739
3739
|
justify-content: space-between;
|
|
3740
3740
|
align-items: center;
|
|
3741
3741
|
margin-bottom: 6px;
|
|
3742
|
-
`, Vs =
|
|
3742
|
+
`, Vs = M.div`
|
|
3743
3743
|
display: flex;
|
|
3744
3744
|
align-items: center;
|
|
3745
3745
|
gap: 8px;
|
|
3746
|
-
`, Ps =
|
|
3746
|
+
`, Ps = M.span`
|
|
3747
3747
|
font-size: 11px;
|
|
3748
3748
|
font-weight: 600;
|
|
3749
3749
|
color: ${(e) => e.theme?.textColorMuted || "#666"};
|
|
@@ -3757,16 +3757,16 @@ var Fs = $.div`
|
|
|
3757
3757
|
outline: 2px solid #ff9800;
|
|
3758
3758
|
background: rgba(255, 152, 0, 0.1);
|
|
3759
3759
|
}
|
|
3760
|
-
`, zs =
|
|
3760
|
+
`, zs = M.span`
|
|
3761
3761
|
font-size: 12px;
|
|
3762
3762
|
font-weight: 500;
|
|
3763
3763
|
color: ${(e) => e.theme?.textColorMuted || "#555"};
|
|
3764
3764
|
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
3765
3765
|
letter-spacing: 0.5px;
|
|
3766
|
-
`, Hs =
|
|
3766
|
+
`, Hs = M.div`
|
|
3767
3767
|
display: flex;
|
|
3768
3768
|
gap: 6px;
|
|
3769
|
-
`, Xs =
|
|
3769
|
+
`, Xs = M.button`
|
|
3770
3770
|
background: ${(e) => e.theme?.surfaceColor || "#f5f5f5"};
|
|
3771
3771
|
border: 1px solid ${(e) => e.theme?.borderColor || "#ccc"};
|
|
3772
3772
|
color: ${(e) => e.theme?.textColor || "#333"};
|
|
@@ -3785,7 +3785,7 @@ var Fs = $.div`
|
|
|
3785
3785
|
&:active {
|
|
3786
3786
|
transform: scale(0.95);
|
|
3787
3787
|
}
|
|
3788
|
-
`, Ls =
|
|
3788
|
+
`, Ls = M.div`
|
|
3789
3789
|
font-size: 14px;
|
|
3790
3790
|
line-height: 1.6;
|
|
3791
3791
|
color: ${(e) => e.theme?.textColor || "#2a2a2a"};
|
|
@@ -3814,15 +3814,15 @@ var Fs = $.div`
|
|
|
3814
3814
|
onAnnotationUpdate: u,
|
|
3815
3815
|
renderAnnotationItem: g
|
|
3816
3816
|
}) => {
|
|
3817
|
-
const f =
|
|
3818
|
-
|
|
3819
|
-
}),
|
|
3817
|
+
const f = R(null), d = R(null), b = R(void 0);
|
|
3818
|
+
ee(() => {
|
|
3819
|
+
}), ee(() => {
|
|
3820
3820
|
const m = d.current;
|
|
3821
3821
|
if (!m) return;
|
|
3822
3822
|
const y = () => {
|
|
3823
3823
|
};
|
|
3824
3824
|
return m.addEventListener("scroll", y), () => m.removeEventListener("scroll", y);
|
|
3825
|
-
}, []),
|
|
3825
|
+
}, []), ee(() => {
|
|
3826
3826
|
t && f.current && n && f.current.scrollIntoView({
|
|
3827
3827
|
behavior: "smooth",
|
|
3828
3828
|
block: r,
|
|
@@ -3871,15 +3871,15 @@ var Fs = $.div`
|
|
|
3871
3871
|
})
|
|
3872
3872
|
},
|
|
3873
3873
|
m.id
|
|
3874
|
-
) : /* @__PURE__ */
|
|
3874
|
+
) : /* @__PURE__ */ te(
|
|
3875
3875
|
_s,
|
|
3876
3876
|
{
|
|
3877
3877
|
ref: x ? f : null,
|
|
3878
3878
|
$isActive: x,
|
|
3879
3879
|
onClick: k,
|
|
3880
3880
|
children: [
|
|
3881
|
-
/* @__PURE__ */
|
|
3882
|
-
/* @__PURE__ */
|
|
3881
|
+
/* @__PURE__ */ te(Zs, { children: [
|
|
3882
|
+
/* @__PURE__ */ te(Vs, { children: [
|
|
3883
3883
|
/* @__PURE__ */ C(
|
|
3884
3884
|
Ps,
|
|
3885
3885
|
{
|
|
@@ -3893,7 +3893,7 @@ var Fs = $.div`
|
|
|
3893
3893
|
children: m.id
|
|
3894
3894
|
}
|
|
3895
3895
|
),
|
|
3896
|
-
/* @__PURE__ */
|
|
3896
|
+
/* @__PURE__ */ te(zs, { children: [
|
|
3897
3897
|
v(m.start),
|
|
3898
3898
|
" - ",
|
|
3899
3899
|
v(m.end)
|
|
@@ -3928,12 +3928,12 @@ var Fs = $.div`
|
|
|
3928
3928
|
m.id
|
|
3929
3929
|
);
|
|
3930
3930
|
}) });
|
|
3931
|
-
}, yr =
|
|
3931
|
+
}, yr = We.memo(Gs), Ns = ({
|
|
3932
3932
|
checked: e,
|
|
3933
3933
|
onChange: t,
|
|
3934
3934
|
disabled: n = !1,
|
|
3935
3935
|
className: r
|
|
3936
|
-
}) => /* @__PURE__ */
|
|
3936
|
+
}) => /* @__PURE__ */ te(Vt, { className: r, children: [
|
|
3937
3937
|
/* @__PURE__ */ C(
|
|
3938
3938
|
Pt,
|
|
3939
3939
|
{
|
|
@@ -3953,7 +3953,7 @@ var Fs = $.div`
|
|
|
3953
3953
|
onChange: t,
|
|
3954
3954
|
disabled: n = !1,
|
|
3955
3955
|
className: r
|
|
3956
|
-
}) => /* @__PURE__ */
|
|
3956
|
+
}) => /* @__PURE__ */ te(Vt, { className: r, children: [
|
|
3957
3957
|
/* @__PURE__ */ C(
|
|
3958
3958
|
Pt,
|
|
3959
3959
|
{
|
|
@@ -3972,7 +3972,7 @@ var Fs = $.div`
|
|
|
3972
3972
|
checked: e,
|
|
3973
3973
|
onChange: t,
|
|
3974
3974
|
className: n
|
|
3975
|
-
}) => /* @__PURE__ */
|
|
3975
|
+
}) => /* @__PURE__ */ te(Vt, { className: n, children: [
|
|
3976
3976
|
/* @__PURE__ */ C(
|
|
3977
3977
|
Pt,
|
|
3978
3978
|
{
|
|
@@ -3983,7 +3983,7 @@ var Fs = $.div`
|
|
|
3983
3983
|
}
|
|
3984
3984
|
),
|
|
3985
3985
|
/* @__PURE__ */ C(zt, { htmlFor: "editable-annotations", children: "Editable Annotations" })
|
|
3986
|
-
] }), Ks =
|
|
3986
|
+
] }), Ks = M.button`
|
|
3987
3987
|
padding: 0.5rem 1rem;
|
|
3988
3988
|
background: ${(e) => e.theme?.surfaceColor || "#f5f5f5"};
|
|
3989
3989
|
color: ${(e) => e.theme?.textColor || "#333"};
|
|
@@ -4031,7 +4031,7 @@ var Fs = $.div`
|
|
|
4031
4031
|
}
|
|
4032
4032
|
);
|
|
4033
4033
|
function js() {
|
|
4034
|
-
const [e, t] =
|
|
4034
|
+
const [e, t] = Z("hh:mm:ss.uuu");
|
|
4035
4035
|
return {
|
|
4036
4036
|
timeFormat: e,
|
|
4037
4037
|
setTimeFormat: t,
|
|
@@ -4044,7 +4044,7 @@ function qs({
|
|
|
4044
4044
|
initialSamplesPerPixel: e,
|
|
4045
4045
|
zoomLevels: t = Js
|
|
4046
4046
|
}) {
|
|
4047
|
-
const [n, r] =
|
|
4047
|
+
const [n, r] = Z(() => {
|
|
4048
4048
|
const c = t.indexOf(e);
|
|
4049
4049
|
return c !== -1 ? c : Math.floor(t.length / 2);
|
|
4050
4050
|
}), a = t[n], s = n > 0, o = n < t.length - 1, i = D(() => {
|
|
@@ -4065,7 +4065,7 @@ function Qs({
|
|
|
4065
4065
|
initialVolume: t = 1,
|
|
4066
4066
|
onVolumeChange: n
|
|
4067
4067
|
}) {
|
|
4068
|
-
const [r, a] =
|
|
4068
|
+
const [r, a] = Z(t), s = D((o) => {
|
|
4069
4069
|
a(o), e.current && e.current.setMasterGain(o), n?.(o);
|
|
4070
4070
|
}, [e, n]);
|
|
4071
4071
|
return {
|
|
@@ -4074,7 +4074,7 @@ function Qs({
|
|
|
4074
4074
|
};
|
|
4075
4075
|
}
|
|
4076
4076
|
const tl = (e = 256) => {
|
|
4077
|
-
const t =
|
|
4077
|
+
const t = R(null), n = D((r, a, s) => {
|
|
4078
4078
|
const o = new Ln("fft", e);
|
|
4079
4079
|
return r.connect(o), r.connect(a), t.current = o, function() {
|
|
4080
4080
|
o.dispose(), t.current = null;
|
|
@@ -4181,8 +4181,8 @@ function Cr() {
|
|
|
4181
4181
|
return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
4182
4182
|
}
|
|
4183
4183
|
function nl(e, t = {}) {
|
|
4184
|
-
const { progressive: n = !1 } = t, [r, a] =
|
|
4185
|
-
return
|
|
4184
|
+
const { progressive: n = !1 } = t, [r, a] = Z([]), [s, o] = Z(!0), [i, l] = Z(null), [c, u] = Z(0), g = e.length;
|
|
4185
|
+
return ee(() => {
|
|
4186
4186
|
if (e.length === 0) {
|
|
4187
4187
|
a([]), o(!1), u(0);
|
|
4188
4188
|
return;
|
|
@@ -4228,14 +4228,14 @@ function nl(e, t = {}) {
|
|
|
4228
4228
|
const p = Jr.getContext().rawContext, h = e.map(async (w, m) => {
|
|
4229
4229
|
if (w.audioBuffer) {
|
|
4230
4230
|
const E = b(w, m, w.audioBuffer);
|
|
4231
|
-
return n && !f && (d.set(m, E), u((
|
|
4232
|
-
Array.from({ length: e.length }, (
|
|
4231
|
+
return n && !f && (d.set(m, E), u((S) => S + 1), a(
|
|
4232
|
+
Array.from({ length: e.length }, (S, $) => d.get($)).filter((S) => S !== void 0)
|
|
4233
4233
|
)), E;
|
|
4234
4234
|
}
|
|
4235
4235
|
if (!w.src && w.waveformData) {
|
|
4236
4236
|
const E = b(w, m);
|
|
4237
|
-
return n && !f && (d.set(m, E), u((
|
|
4238
|
-
Array.from({ length: e.length }, (
|
|
4237
|
+
return n && !f && (d.set(m, E), u((S) => S + 1), a(
|
|
4238
|
+
Array.from({ length: e.length }, (S, $) => d.get($)).filter((S) => S !== void 0)
|
|
4239
4239
|
)), E;
|
|
4240
4240
|
}
|
|
4241
4241
|
if (!w.src)
|
|
@@ -4248,7 +4248,7 @@ function nl(e, t = {}) {
|
|
|
4248
4248
|
throw new Error(`Invalid audio buffer for ${w.src}`);
|
|
4249
4249
|
const A = b(w, m, k);
|
|
4250
4250
|
return n && !f && (d.set(m, A), u((E) => E + 1), a(
|
|
4251
|
-
Array.from({ length: e.length }, (E,
|
|
4251
|
+
Array.from({ length: e.length }, (E, S) => d.get(S)).filter((E) => E !== void 0)
|
|
4252
4252
|
)), A;
|
|
4253
4253
|
}), I = await Promise.all(h);
|
|
4254
4254
|
f || (n || (a(I), u(I.length)), o(!1));
|
|
@@ -4269,7 +4269,7 @@ function rl({
|
|
|
4269
4269
|
samplesPerPixel: n,
|
|
4270
4270
|
sampleRate: r
|
|
4271
4271
|
}) {
|
|
4272
|
-
const a =
|
|
4272
|
+
const a = We.useRef(null), s = We.useCallback(
|
|
4273
4273
|
(c) => {
|
|
4274
4274
|
const { transform: u, active: g } = c;
|
|
4275
4275
|
if (!g?.data?.current) return { ...u, scaleX: 1, scaleY: 1 };
|
|
@@ -4282,28 +4282,28 @@ function rl({
|
|
|
4282
4282
|
if (!p) return { ...u, scaleX: 1, scaleY: 1 };
|
|
4283
4283
|
const h = p.startSample / r, I = p.durationSamples / r, w = u.x * n / r;
|
|
4284
4284
|
let m = h + w;
|
|
4285
|
-
const y = [...v.clips].sort((
|
|
4285
|
+
const y = [...v.clips].sort(($, _) => $.startSample - _.startSample), x = y.findIndex(($) => $ === p);
|
|
4286
4286
|
m = Math.max(0, m);
|
|
4287
4287
|
const k = x > 0 ? y[x - 1] : null;
|
|
4288
4288
|
if (k) {
|
|
4289
|
-
const
|
|
4290
|
-
m = Math.max(m,
|
|
4289
|
+
const $ = (k.startSample + k.durationSamples) / r;
|
|
4290
|
+
m = Math.max(m, $);
|
|
4291
4291
|
}
|
|
4292
4292
|
const A = x < y.length - 1 ? y[x + 1] : null;
|
|
4293
4293
|
if (A) {
|
|
4294
|
-
const
|
|
4295
|
-
|
|
4294
|
+
const $ = m + I, _ = A.startSample / r;
|
|
4295
|
+
$ > _ && (m = _ - I);
|
|
4296
4296
|
}
|
|
4297
|
-
const
|
|
4297
|
+
const S = (m - h) * r / n;
|
|
4298
4298
|
return {
|
|
4299
4299
|
...u,
|
|
4300
|
-
x:
|
|
4300
|
+
x: S,
|
|
4301
4301
|
scaleX: 1,
|
|
4302
4302
|
scaleY: 1
|
|
4303
4303
|
};
|
|
4304
4304
|
},
|
|
4305
4305
|
[e, n, r]
|
|
4306
|
-
), o =
|
|
4306
|
+
), o = We.useCallback(
|
|
4307
4307
|
(c) => {
|
|
4308
4308
|
const { active: u } = c, { boundary: g } = u.data.current;
|
|
4309
4309
|
if (!g) {
|
|
@@ -4318,7 +4318,7 @@ function rl({
|
|
|
4318
4318
|
});
|
|
4319
4319
|
},
|
|
4320
4320
|
[e]
|
|
4321
|
-
), i =
|
|
4321
|
+
), i = We.useCallback(
|
|
4322
4322
|
(c) => {
|
|
4323
4323
|
const { active: u, delta: g } = c, { boundary: f } = u.data.current;
|
|
4324
4324
|
if (!f || !a.current) return;
|
|
@@ -4326,32 +4326,32 @@ function rl({
|
|
|
4326
4326
|
if (m !== d) return w;
|
|
4327
4327
|
const y = [...w.clips].sort((A, E) => A.startSample - E.startSample), x = y.findIndex((A) => A === w.clips[b]), k = w.clips.map((A, E) => {
|
|
4328
4328
|
if (E !== b) return A;
|
|
4329
|
-
const
|
|
4329
|
+
const S = A.sourceDurationSamples;
|
|
4330
4330
|
if (f === "left") {
|
|
4331
|
-
let
|
|
4332
|
-
const
|
|
4333
|
-
|
|
4331
|
+
let $ = Math.floor(v);
|
|
4332
|
+
const _ = -h.startSample;
|
|
4333
|
+
$ < _ && ($ = _);
|
|
4334
4334
|
const B = -h.offsetSamples;
|
|
4335
|
-
|
|
4335
|
+
$ < B && ($ = B);
|
|
4336
4336
|
const P = x > 0 ? y[x - 1] : null;
|
|
4337
4337
|
if (P) {
|
|
4338
|
-
const
|
|
4339
|
-
|
|
4338
|
+
const Y = P.startSample + P.durationSamples - h.startSample;
|
|
4339
|
+
$ < Y && ($ = Y);
|
|
4340
4340
|
}
|
|
4341
|
-
const
|
|
4342
|
-
|
|
4343
|
-
const K = h.offsetSamples +
|
|
4341
|
+
const H = h.durationSamples - p;
|
|
4342
|
+
$ > H && ($ = H);
|
|
4343
|
+
const K = h.offsetSamples + $, X = h.durationSamples - $, U = h.startSample + $;
|
|
4344
4344
|
return {
|
|
4345
4345
|
...A,
|
|
4346
4346
|
offsetSamples: K,
|
|
4347
|
-
durationSamples:
|
|
4348
|
-
startSample:
|
|
4347
|
+
durationSamples: X,
|
|
4348
|
+
startSample: U
|
|
4349
4349
|
};
|
|
4350
4350
|
} else {
|
|
4351
|
-
let
|
|
4352
|
-
|
|
4353
|
-
const
|
|
4354
|
-
return
|
|
4351
|
+
let $ = Math.floor(h.durationSamples + v);
|
|
4352
|
+
$ = Math.max(p, $), h.offsetSamples + $ > S && ($ = S - h.offsetSamples);
|
|
4353
|
+
const _ = x < y.length - 1 ? y[x + 1] : null;
|
|
4354
|
+
return _ && h.startSample + $ > _.startSample && ($ = _.startSample - h.startSample, $ = Math.max(p, $)), { ...A, durationSamples: $ };
|
|
4355
4355
|
}
|
|
4356
4356
|
});
|
|
4357
4357
|
return { ...w, clips: k };
|
|
@@ -4359,7 +4359,7 @@ function rl({
|
|
|
4359
4359
|
t(I);
|
|
4360
4360
|
},
|
|
4361
4361
|
[e, t, n, r]
|
|
4362
|
-
), l =
|
|
4362
|
+
), l = We.useCallback(
|
|
4363
4363
|
(c) => {
|
|
4364
4364
|
const { active: u, delta: g } = c, { trackIndex: f, clipIndex: d, boundary: b } = u.data.current, v = g.x * n;
|
|
4365
4365
|
if (b) {
|
|
@@ -4374,11 +4374,11 @@ function rl({
|
|
|
4374
4374
|
A = Math.max(0, A);
|
|
4375
4375
|
const E = m > 0 ? w[m - 1] : null;
|
|
4376
4376
|
if (E) {
|
|
4377
|
-
const
|
|
4378
|
-
A = Math.max(A,
|
|
4377
|
+
const $ = E.startSample + E.durationSamples;
|
|
4378
|
+
A = Math.max(A, $);
|
|
4379
4379
|
}
|
|
4380
|
-
const
|
|
4381
|
-
return
|
|
4380
|
+
const S = m < w.length - 1 ? w[m + 1] : null;
|
|
4381
|
+
return S && A + x.durationSamples > S.startSample && (A = S.startSample - x.durationSamples), {
|
|
4382
4382
|
...x,
|
|
4383
4383
|
startSample: A
|
|
4384
4384
|
};
|
|
@@ -4408,7 +4408,7 @@ function ni({
|
|
|
4408
4408
|
duration: a,
|
|
4409
4409
|
linkEndpoints: s
|
|
4410
4410
|
}) {
|
|
4411
|
-
const o =
|
|
4411
|
+
const o = We.useRef(null), i = We.useCallback(
|
|
4412
4412
|
(u) => {
|
|
4413
4413
|
const { active: g } = u, f = g.data.current;
|
|
4414
4414
|
if (!f || f.annotationIndex === void 0) {
|
|
@@ -4423,7 +4423,7 @@ function ni({
|
|
|
4423
4423
|
});
|
|
4424
4424
|
},
|
|
4425
4425
|
[e]
|
|
4426
|
-
), l =
|
|
4426
|
+
), l = We.useCallback(
|
|
4427
4427
|
(u) => {
|
|
4428
4428
|
const { active: g, delta: f } = u;
|
|
4429
4429
|
if (!o.current)
|
|
@@ -4441,7 +4441,7 @@ function ni({
|
|
|
4441
4441
|
t(w);
|
|
4442
4442
|
},
|
|
4443
4443
|
[e, t, n, r, a, s]
|
|
4444
|
-
), c =
|
|
4444
|
+
), c = We.useCallback(() => {
|
|
4445
4445
|
o.current = null;
|
|
4446
4446
|
}, []);
|
|
4447
4447
|
return {
|
|
@@ -4566,7 +4566,7 @@ const ol = (e) => {
|
|
|
4566
4566
|
const v = b.startSample / g, p = (b.startSample + b.durationSamples) / g;
|
|
4567
4567
|
if (u <= v || u >= p)
|
|
4568
4568
|
return console.warn("Split time is outside clip bounds"), !1;
|
|
4569
|
-
const h = Math.round(u * g), I = Math.floor(h / f), w = b.startSample + b.durationSamples, m = I * f, y = b.startSample, x = m - y, k = m, A = w - k, E = m - b.startSample,
|
|
4569
|
+
const h = Math.round(u * g), I = Math.floor(h / f), w = b.startSample + b.durationSamples, m = I * f, y = b.startSample, x = m - y, k = m, A = w - k, E = m - b.startSample, S = Qt({
|
|
4570
4570
|
audioBuffer: b.audioBuffer,
|
|
4571
4571
|
startSample: y,
|
|
4572
4572
|
durationSamples: x,
|
|
@@ -4580,7 +4580,7 @@ const ol = (e) => {
|
|
|
4580
4580
|
waveformData: b.waveformData
|
|
4581
4581
|
// Share waveformData - slicing happens at render time
|
|
4582
4582
|
// Note: fadeOut removed for first clip since it's cut
|
|
4583
|
-
}),
|
|
4583
|
+
}), $ = Qt({
|
|
4584
4584
|
audioBuffer: b.audioBuffer,
|
|
4585
4585
|
startSample: k,
|
|
4586
4586
|
durationSamples: A,
|
|
@@ -4594,12 +4594,12 @@ const ol = (e) => {
|
|
|
4594
4594
|
// Share waveformData - slicing happens at render time
|
|
4595
4595
|
// Note: fadeIn removed for second clip since it's cut
|
|
4596
4596
|
fadeOut: b.fadeOut
|
|
4597
|
-
}),
|
|
4598
|
-
|
|
4597
|
+
}), _ = [...d.clips];
|
|
4598
|
+
_.splice(c, 1, S, $);
|
|
4599
4599
|
const B = [...t];
|
|
4600
4600
|
return B[l] = {
|
|
4601
4601
|
...d,
|
|
4602
|
-
clips:
|
|
4602
|
+
clips: _
|
|
4603
4603
|
}, n(B), !0;
|
|
4604
4604
|
},
|
|
4605
4605
|
[t, n, e]
|
|
@@ -4636,7 +4636,7 @@ const ol = (e) => {
|
|
|
4636
4636
|
},
|
|
4637
4637
|
[t, n]
|
|
4638
4638
|
);
|
|
4639
|
-
|
|
4639
|
+
ee(() => {
|
|
4640
4640
|
if (n)
|
|
4641
4641
|
return window.addEventListener("keydown", r), () => {
|
|
4642
4642
|
window.removeEventListener("keydown", r);
|
|
@@ -4646,7 +4646,7 @@ const ol = (e) => {
|
|
|
4646
4646
|
const t = [], n = typeof navigator < "u" && navigator.platform.includes("Mac");
|
|
4647
4647
|
return e.metaKey && t.push(n ? "Cmd" : "Ctrl"), e.ctrlKey && !e.metaKey && t.push("Ctrl"), e.altKey && t.push(n ? "Option" : "Alt"), e.shiftKey && t.push("Shift"), t.push(e.key.toUpperCase()), t.join("+");
|
|
4648
4648
|
}, il = (e = {}) => {
|
|
4649
|
-
const { enabled: t = !0, additionalShortcuts: n = [], shortcuts: r } = e, { isPlaying: a } = He(), { setCurrentTime: s, play: o, pause: i, stop: l } = ve(), { playoutRef: c } =
|
|
4649
|
+
const { enabled: t = !0, additionalShortcuts: n = [], shortcuts: r } = e, { isPlaying: a } = He(), { setCurrentTime: s, play: o, pause: i, stop: l } = ve(), { playoutRef: c } = Te(), u = D(() => {
|
|
4650
4650
|
a ? i() : o();
|
|
4651
4651
|
}, [a, o, i]), g = D(() => {
|
|
4652
4652
|
l();
|
|
@@ -4697,43 +4697,43 @@ function ll({
|
|
|
4697
4697
|
controlsWidth: g = 0,
|
|
4698
4698
|
onPlay: f
|
|
4699
4699
|
}) {
|
|
4700
|
-
const d =
|
|
4700
|
+
const d = Je(() => t ? e.findIndex((E) => E.id === t) : -1, [e, t]), b = D(
|
|
4701
4701
|
(E) => {
|
|
4702
4702
|
if (!l?.current || !c || !u) return;
|
|
4703
|
-
const
|
|
4704
|
-
if (!
|
|
4705
|
-
const
|
|
4706
|
-
if (B <
|
|
4707
|
-
const
|
|
4708
|
-
|
|
4709
|
-
left:
|
|
4703
|
+
const S = e.find((W) => W.id === E);
|
|
4704
|
+
if (!S) return;
|
|
4705
|
+
const $ = l.current, _ = $.clientWidth, B = S.start * u / c + g, P = S.end * u / c + g, H = (B + P) / 2, K = $.scrollLeft, X = K, U = K + _;
|
|
4706
|
+
if (B < X || P > U) {
|
|
4707
|
+
const W = Math.max(0, H - _ / 2);
|
|
4708
|
+
$.scrollTo({
|
|
4709
|
+
left: W,
|
|
4710
4710
|
behavior: "smooth"
|
|
4711
4711
|
});
|
|
4712
4712
|
}
|
|
4713
4713
|
},
|
|
4714
4714
|
[e, l, c, u, g]
|
|
4715
4715
|
);
|
|
4716
|
-
|
|
4716
|
+
ee(() => {
|
|
4717
4717
|
t && l?.current && c && u && b(t);
|
|
4718
4718
|
}, [t, b, l, c, u]);
|
|
4719
4719
|
const v = D(
|
|
4720
4720
|
(E) => {
|
|
4721
4721
|
if (d < 0) return;
|
|
4722
|
-
const
|
|
4722
|
+
const S = e[d], $ = Math.max(0, Math.min(S.end - 0.1, S.start + E)), _ = $ - S.start, B = [...e];
|
|
4723
4723
|
if (B[d] = {
|
|
4724
|
-
...
|
|
4725
|
-
start:
|
|
4724
|
+
...S,
|
|
4725
|
+
start: $
|
|
4726
4726
|
}, s && d > 0) {
|
|
4727
4727
|
const P = B[d - 1];
|
|
4728
|
-
Math.abs(P.end -
|
|
4728
|
+
Math.abs(P.end - S.start) < Ut && (B[d - 1] = {
|
|
4729
4729
|
...P,
|
|
4730
|
-
end: Math.max(P.start + 0.1, P.end +
|
|
4730
|
+
end: Math.max(P.start + 0.1, P.end + _)
|
|
4731
4731
|
});
|
|
4732
4732
|
} else if (!s && d > 0) {
|
|
4733
4733
|
const P = B[d - 1];
|
|
4734
|
-
|
|
4734
|
+
$ < P.end && (B[d - 1] = {
|
|
4735
4735
|
...P,
|
|
4736
|
-
end:
|
|
4736
|
+
end: $
|
|
4737
4737
|
});
|
|
4738
4738
|
}
|
|
4739
4739
|
n(B);
|
|
@@ -4742,26 +4742,26 @@ function ll({
|
|
|
4742
4742
|
), p = D(
|
|
4743
4743
|
(E) => {
|
|
4744
4744
|
if (d < 0) return;
|
|
4745
|
-
const
|
|
4745
|
+
const S = e[d], $ = Math.max(S.start + 0.1, Math.min(a, S.end + E)), _ = $ - S.end, B = [...e];
|
|
4746
4746
|
if (B[d] = {
|
|
4747
|
-
...
|
|
4748
|
-
end:
|
|
4747
|
+
...S,
|
|
4748
|
+
end: $
|
|
4749
4749
|
}, s && d < e.length - 1) {
|
|
4750
4750
|
const P = B[d + 1];
|
|
4751
|
-
if (Math.abs(P.start -
|
|
4752
|
-
const
|
|
4751
|
+
if (Math.abs(P.start - S.end) < Ut) {
|
|
4752
|
+
const H = Math.min(P.end - 0.1, P.start + _);
|
|
4753
4753
|
B[d + 1] = {
|
|
4754
4754
|
...P,
|
|
4755
|
-
start:
|
|
4755
|
+
start: H
|
|
4756
4756
|
};
|
|
4757
4757
|
let K = d + 1;
|
|
4758
4758
|
for (; K < B.length - 1; ) {
|
|
4759
|
-
const
|
|
4760
|
-
if (Math.abs(
|
|
4761
|
-
const
|
|
4759
|
+
const X = B[K], U = B[K + 1];
|
|
4760
|
+
if (Math.abs(U.start - e[K].end) < Ut) {
|
|
4761
|
+
const W = X.end - e[K].end;
|
|
4762
4762
|
B[K + 1] = {
|
|
4763
|
-
...
|
|
4764
|
-
start: Math.min(
|
|
4763
|
+
...U,
|
|
4764
|
+
start: Math.min(U.end - 0.1, U.start + W)
|
|
4765
4765
|
}, K++;
|
|
4766
4766
|
} else
|
|
4767
4767
|
break;
|
|
@@ -4769,19 +4769,19 @@ function ll({
|
|
|
4769
4769
|
}
|
|
4770
4770
|
} else if (!s && d < e.length - 1) {
|
|
4771
4771
|
const P = B[d + 1];
|
|
4772
|
-
if (
|
|
4772
|
+
if ($ > P.start) {
|
|
4773
4773
|
B[d + 1] = {
|
|
4774
4774
|
...P,
|
|
4775
|
-
start:
|
|
4775
|
+
start: $
|
|
4776
4776
|
};
|
|
4777
|
-
let
|
|
4778
|
-
for (;
|
|
4779
|
-
const K = B[
|
|
4780
|
-
if (K.end >
|
|
4781
|
-
B[
|
|
4782
|
-
...
|
|
4777
|
+
let H = d + 1;
|
|
4778
|
+
for (; H < B.length - 1; ) {
|
|
4779
|
+
const K = B[H], X = B[H + 1];
|
|
4780
|
+
if (K.end > X.start)
|
|
4781
|
+
B[H + 1] = {
|
|
4782
|
+
...X,
|
|
4783
4783
|
start: K.end
|
|
4784
|
-
},
|
|
4784
|
+
}, H++;
|
|
4785
4785
|
else
|
|
4786
4786
|
break;
|
|
4787
4787
|
}
|
|
@@ -4802,9 +4802,9 @@ function ll({
|
|
|
4802
4802
|
r && r(null);
|
|
4803
4803
|
}, [r]), x = D(() => {
|
|
4804
4804
|
if (d < 0 || !f) return;
|
|
4805
|
-
const E = e[d],
|
|
4806
|
-
f(E.start,
|
|
4807
|
-
}, [e, d, o, f]), k =
|
|
4805
|
+
const E = e[d], S = o ? void 0 : E.end - E.start;
|
|
4806
|
+
f(E.start, S);
|
|
4807
|
+
}, [e, d, o, f]), k = Je(
|
|
4808
4808
|
() => [
|
|
4809
4809
|
{
|
|
4810
4810
|
key: "[",
|
|
@@ -4840,7 +4840,7 @@ function ll({
|
|
|
4840
4840
|
}
|
|
4841
4841
|
],
|
|
4842
4842
|
[v, p, x]
|
|
4843
|
-
), A =
|
|
4843
|
+
), A = Je(
|
|
4844
4844
|
() => [
|
|
4845
4845
|
{
|
|
4846
4846
|
key: "ArrowUp",
|
|
@@ -4955,51 +4955,51 @@ function ii(e, t = {}) {
|
|
|
4955
4955
|
const {
|
|
4956
4956
|
channelCount: n = 1,
|
|
4957
4957
|
samplesPerPixel: r = 1024
|
|
4958
|
-
} = t, [a, s] =
|
|
4958
|
+
} = t, [a, s] = Z(!1), [o, i] = Z(!1), [l, c] = Z(0), [u, g] = Z(new Int16Array(0)), [f, d] = Z(null), [b, v] = Z(null), [p, h] = Z(0), [I, w] = Z(0), m = 16, y = R(!1), x = R(null), k = R(null), A = R([]), E = R(0), S = R(null), $ = R(0), _ = R(!1), B = R(!1), P = D(async () => {
|
|
4959
4959
|
if (!y.current)
|
|
4960
4960
|
try {
|
|
4961
|
-
const
|
|
4962
|
-
await
|
|
4963
|
-
} catch (
|
|
4964
|
-
throw console.error("Failed to load AudioWorklet module:",
|
|
4961
|
+
const W = Me(), Y = new URL("data:text/javascript;base64,InVzZSBzdHJpY3QiOwoKLy8gc3JjL3dvcmtsZXQvcmVjb3JkaW5nLXByb2Nlc3Nvci53b3JrbGV0LnRzCnZhciBSZWNvcmRpbmdQcm9jZXNzb3IgPSBjbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3NvciB7CiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5idWZmZXJTaXplID0gMDsKICAgIHRoaXMuYnVmZmVycyA9IFtdOwogICAgdGhpcy5zYW1wbGVzQ29sbGVjdGVkID0gMDsKICAgIHRoaXMuaXNSZWNvcmRpbmcgPSBmYWxzZTsKICAgIHRoaXMuY2hhbm5lbENvdW50ID0gMTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSAoZXZlbnQpID0+IHsKICAgICAgY29uc3QgeyBjb21tYW5kLCBzYW1wbGVSYXRlOiBzYW1wbGVSYXRlMiwgY2hhbm5lbENvdW50IH0gPSBldmVudC5kYXRhOwogICAgICBpZiAoY29tbWFuZCA9PT0gInN0YXJ0IikgewogICAgICAgIHRoaXMuaXNSZWNvcmRpbmcgPSB0cnVlOwogICAgICAgIHRoaXMuY2hhbm5lbENvdW50ID0gY2hhbm5lbENvdW50IHx8IDE7CiAgICAgICAgdGhpcy5idWZmZXJTaXplID0gTWF0aC5mbG9vcigoc2FtcGxlUmF0ZTIgfHwgNDhlMykgKiAwLjAxNik7CiAgICAgICAgdGhpcy5idWZmZXJzID0gW107CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCB0aGlzLmNoYW5uZWxDb3VudDsgaSsrKSB7CiAgICAgICAgICB0aGlzLmJ1ZmZlcnNbaV0gPSBuZXcgRmxvYXQzMkFycmF5KHRoaXMuYnVmZmVyU2l6ZSk7CiAgICAgICAgfQogICAgICAgIHRoaXMuc2FtcGxlc0NvbGxlY3RlZCA9IDA7CiAgICAgIH0gZWxzZSBpZiAoY29tbWFuZCA9PT0gInN0b3AiKSB7CiAgICAgICAgdGhpcy5pc1JlY29yZGluZyA9IGZhbHNlOwogICAgICAgIGlmICh0aGlzLnNhbXBsZXNDb2xsZWN0ZWQgPiAwKSB7CiAgICAgICAgICB0aGlzLmZsdXNoQnVmZmVycygpOwogICAgICAgIH0KICAgICAgfQogICAgfTsKICB9CiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMsIHBhcmFtZXRlcnMpIHsKICAgIGlmICghdGhpcy5pc1JlY29yZGluZykgewogICAgICByZXR1cm4gdHJ1ZTsKICAgIH0KICAgIGNvbnN0IGlucHV0ID0gaW5wdXRzWzBdOwogICAgaWYgKCFpbnB1dCB8fCBpbnB1dC5sZW5ndGggPT09IDApIHsKICAgICAgcmV0dXJuIHRydWU7CiAgICB9CiAgICBjb25zdCBmcmFtZUNvdW50ID0gaW5wdXRbMF0ubGVuZ3RoOwogICAgZm9yIChsZXQgY2hhbm5lbCA9IDA7IGNoYW5uZWwgPCBNYXRoLm1pbihpbnB1dC5sZW5ndGgsIHRoaXMuY2hhbm5lbENvdW50KTsgY2hhbm5lbCsrKSB7CiAgICAgIGNvbnN0IGlucHV0Q2hhbm5lbCA9IGlucHV0W2NoYW5uZWxdOwogICAgICBjb25zdCBidWZmZXIgPSB0aGlzLmJ1ZmZlcnNbY2hhbm5lbF07CiAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZnJhbWVDb3VudDsgaSsrKSB7CiAgICAgICAgYnVmZmVyW3RoaXMuc2FtcGxlc0NvbGxlY3RlZCArIGldID0gaW5wdXRDaGFubmVsW2ldOwogICAgICB9CiAgICB9CiAgICB0aGlzLnNhbXBsZXNDb2xsZWN0ZWQgKz0gZnJhbWVDb3VudDsKICAgIGlmICh0aGlzLnNhbXBsZXNDb2xsZWN0ZWQgPj0gdGhpcy5idWZmZXJTaXplKSB7CiAgICAgIHRoaXMuZmx1c2hCdWZmZXJzKCk7CiAgICB9CiAgICByZXR1cm4gdHJ1ZTsKICB9CiAgZmx1c2hCdWZmZXJzKCkgewogICAgY29uc3Qgc2FtcGxlcyA9IHRoaXMuYnVmZmVyc1swXS5zbGljZSgwLCB0aGlzLnNhbXBsZXNDb2xsZWN0ZWQpOwogICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgc2FtcGxlcywKICAgICAgc2FtcGxlUmF0ZSwKICAgICAgY2hhbm5lbENvdW50OiB0aGlzLmNoYW5uZWxDb3VudAogICAgfSk7CiAgICB0aGlzLnNhbXBsZXNDb2xsZWN0ZWQgPSAwOwogIH0KfTsKcmVnaXN0ZXJQcm9jZXNzb3IoInJlY29yZGluZy1wcm9jZXNzb3IiLCBSZWNvcmRpbmdQcm9jZXNzb3IpOwovLyMgc291cmNlTWFwcGluZ1VSTD1yZWNvcmRpbmctcHJvY2Vzc29yLndvcmtsZXQuanMubWFw", import.meta.url).href;
|
|
4962
|
+
await W.addAudioWorkletModule(Y), y.current = !0;
|
|
4963
|
+
} catch (W) {
|
|
4964
|
+
throw console.error("Failed to load AudioWorklet module:", W), new Error("Failed to load recording processor");
|
|
4965
4965
|
}
|
|
4966
|
-
}, []),
|
|
4966
|
+
}, []), H = D(async () => {
|
|
4967
4967
|
if (!e) {
|
|
4968
4968
|
v(new Error("No microphone stream available"));
|
|
4969
4969
|
return;
|
|
4970
4970
|
}
|
|
4971
4971
|
try {
|
|
4972
4972
|
v(null);
|
|
4973
|
-
const
|
|
4974
|
-
|
|
4975
|
-
const
|
|
4976
|
-
k.current =
|
|
4977
|
-
const
|
|
4978
|
-
x.current =
|
|
4979
|
-
const { samples:
|
|
4980
|
-
A.current.push(
|
|
4973
|
+
const W = Me();
|
|
4974
|
+
W.state === "suspended" && await W.resume(), await P();
|
|
4975
|
+
const Y = W.createMediaStreamSource(e);
|
|
4976
|
+
k.current = Y;
|
|
4977
|
+
const j = W.createAudioWorkletNode("recording-processor");
|
|
4978
|
+
x.current = j, Y.connect(j), j.port.onmessage = (ae) => {
|
|
4979
|
+
const { samples: se } = ae.data;
|
|
4980
|
+
A.current.push(se), E.current += se.length, g(
|
|
4981
4981
|
(de) => si(
|
|
4982
4982
|
de,
|
|
4983
|
-
|
|
4983
|
+
se,
|
|
4984
4984
|
r,
|
|
4985
|
-
E.current -
|
|
4985
|
+
E.current - se.length,
|
|
4986
4986
|
m
|
|
4987
4987
|
)
|
|
4988
4988
|
);
|
|
4989
|
-
},
|
|
4989
|
+
}, j.port.postMessage({
|
|
4990
4990
|
command: "start",
|
|
4991
|
-
sampleRate:
|
|
4991
|
+
sampleRate: W.sampleRate,
|
|
4992
4992
|
channelCount: n
|
|
4993
|
-
}), A.current = [], E.current = 0, g(new Int16Array(0)), d(null), h(0), w(0),
|
|
4993
|
+
}), A.current = [], E.current = 0, g(new Int16Array(0)), d(null), h(0), w(0), _.current = !0, B.current = !1, s(!0), i(!1), $.current = performance.now();
|
|
4994
4994
|
const ue = () => {
|
|
4995
|
-
if (
|
|
4996
|
-
const ae = (performance.now() -
|
|
4997
|
-
c(ae),
|
|
4995
|
+
if (_.current && !B.current) {
|
|
4996
|
+
const ae = (performance.now() - $.current) / 1e3;
|
|
4997
|
+
c(ae), S.current = requestAnimationFrame(ue);
|
|
4998
4998
|
}
|
|
4999
4999
|
};
|
|
5000
5000
|
ue();
|
|
5001
|
-
} catch (
|
|
5002
|
-
console.error("Failed to start recording:",
|
|
5001
|
+
} catch (W) {
|
|
5002
|
+
console.error("Failed to start recording:", W), v(W instanceof Error ? W : new Error("Failed to start recording"));
|
|
5003
5003
|
}
|
|
5004
5004
|
}, [e, n, r, P, a, o]), K = D(async () => {
|
|
5005
5005
|
if (!a)
|
|
@@ -5013,32 +5013,32 @@ function ii(e, t = {}) {
|
|
|
5013
5013
|
}
|
|
5014
5014
|
x.current.disconnect();
|
|
5015
5015
|
}
|
|
5016
|
-
|
|
5017
|
-
const
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5016
|
+
S.current !== null && (cancelAnimationFrame(S.current), S.current = null);
|
|
5017
|
+
const W = ai(A.current), j = Me().rawContext, ue = oi(
|
|
5018
|
+
j,
|
|
5019
|
+
W,
|
|
5020
|
+
j.sampleRate,
|
|
5021
5021
|
n
|
|
5022
5022
|
);
|
|
5023
|
-
return d(ue), c(ue.duration),
|
|
5024
|
-
} catch (
|
|
5025
|
-
return console.error("Failed to stop recording:",
|
|
5023
|
+
return d(ue), c(ue.duration), _.current = !1, B.current = !1, s(!1), i(!1), h(0), ue;
|
|
5024
|
+
} catch (W) {
|
|
5025
|
+
return console.error("Failed to stop recording:", W), v(W instanceof Error ? W : new Error("Failed to stop recording")), null;
|
|
5026
5026
|
}
|
|
5027
|
-
}, [a, n]),
|
|
5028
|
-
a && !o && (
|
|
5029
|
-
}, [a, o]),
|
|
5027
|
+
}, [a, n]), X = D(() => {
|
|
5028
|
+
a && !o && (S.current !== null && (cancelAnimationFrame(S.current), S.current = null), B.current = !0, i(!0));
|
|
5029
|
+
}, [a, o]), U = D(() => {
|
|
5030
5030
|
if (a && o) {
|
|
5031
|
-
B.current = !1, i(!1),
|
|
5032
|
-
const
|
|
5033
|
-
if (
|
|
5034
|
-
const
|
|
5035
|
-
c(
|
|
5031
|
+
B.current = !1, i(!1), $.current = performance.now() - l * 1e3;
|
|
5032
|
+
const W = () => {
|
|
5033
|
+
if (_.current && !B.current) {
|
|
5034
|
+
const Y = (performance.now() - $.current) / 1e3;
|
|
5035
|
+
c(Y), S.current = requestAnimationFrame(W);
|
|
5036
5036
|
}
|
|
5037
5037
|
};
|
|
5038
|
-
|
|
5038
|
+
W();
|
|
5039
5039
|
}
|
|
5040
5040
|
}, [a, o, l]);
|
|
5041
|
-
return
|
|
5041
|
+
return ee(() => () => {
|
|
5042
5042
|
if (x.current) {
|
|
5043
5043
|
if (x.current.port.postMessage({ command: "stop" }), k.current)
|
|
5044
5044
|
try {
|
|
@@ -5047,7 +5047,7 @@ function ii(e, t = {}) {
|
|
|
5047
5047
|
}
|
|
5048
5048
|
x.current.disconnect();
|
|
5049
5049
|
}
|
|
5050
|
-
|
|
5050
|
+
S.current !== null && cancelAnimationFrame(S.current);
|
|
5051
5051
|
}, []), {
|
|
5052
5052
|
isRecording: a,
|
|
5053
5053
|
isPaused: o,
|
|
@@ -5056,15 +5056,15 @@ function ii(e, t = {}) {
|
|
|
5056
5056
|
audioBuffer: f,
|
|
5057
5057
|
level: p,
|
|
5058
5058
|
peakLevel: I,
|
|
5059
|
-
startRecording:
|
|
5059
|
+
startRecording: H,
|
|
5060
5060
|
stopRecording: K,
|
|
5061
|
-
pauseRecording:
|
|
5062
|
-
resumeRecording:
|
|
5061
|
+
pauseRecording: X,
|
|
5062
|
+
resumeRecording: U,
|
|
5063
5063
|
error: b
|
|
5064
5064
|
};
|
|
5065
5065
|
}
|
|
5066
5066
|
function li() {
|
|
5067
|
-
const [e, t] =
|
|
5067
|
+
const [e, t] = Z(null), [n, r] = Z([]), [a, s] = Z(!1), [o, i] = Z(!1), [l, c] = Z(null), u = D(async () => {
|
|
5068
5068
|
try {
|
|
5069
5069
|
const b = (await navigator.mediaDevices.enumerateDevices()).filter((v) => v.kind === "audioinput").map((v) => ({
|
|
5070
5070
|
deviceId: v.deviceId,
|
|
@@ -5105,7 +5105,7 @@ function li() {
|
|
|
5105
5105
|
}, [e, u]), f = D(() => {
|
|
5106
5106
|
e && (e.getTracks().forEach((d) => d.stop()), t(null), s(!1));
|
|
5107
5107
|
}, [e]);
|
|
5108
|
-
return
|
|
5108
|
+
return ee(() => (u(), () => {
|
|
5109
5109
|
e && e.getTracks().forEach((d) => d.stop());
|
|
5110
5110
|
}), []), {
|
|
5111
5111
|
stream: e,
|
|
@@ -5121,8 +5121,8 @@ function ci(e, t = {}) {
|
|
|
5121
5121
|
const {
|
|
5122
5122
|
updateRate: n = 60,
|
|
5123
5123
|
smoothingTimeConstant: r = 0.8
|
|
5124
|
-
} = t, [a, s] =
|
|
5125
|
-
return
|
|
5124
|
+
} = t, [a, s] = Z(0), [o, i] = Z(0), l = R(null), c = R(null), u = R(null), g = () => i(0);
|
|
5125
|
+
return ee(() => {
|
|
5126
5126
|
if (!e) {
|
|
5127
5127
|
s(0), i(0);
|
|
5128
5128
|
return;
|
|
@@ -5165,7 +5165,7 @@ function ci(e, t = {}) {
|
|
|
5165
5165
|
resetPeak: g
|
|
5166
5166
|
};
|
|
5167
5167
|
}
|
|
5168
|
-
|
|
5168
|
+
M.button`
|
|
5169
5169
|
padding: 0.5rem 1rem;
|
|
5170
5170
|
font-size: 0.875rem;
|
|
5171
5171
|
font-weight: 500;
|
|
@@ -5196,7 +5196,7 @@ $.button`
|
|
|
5196
5196
|
box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.3);
|
|
5197
5197
|
}
|
|
5198
5198
|
`;
|
|
5199
|
-
|
|
5199
|
+
M.span`
|
|
5200
5200
|
display: inline-block;
|
|
5201
5201
|
width: 8px;
|
|
5202
5202
|
height: 8px;
|
|
@@ -5215,15 +5215,15 @@ $.span`
|
|
|
5215
5215
|
}
|
|
5216
5216
|
}
|
|
5217
5217
|
`;
|
|
5218
|
-
|
|
5218
|
+
M(rn)`
|
|
5219
5219
|
min-width: 200px;
|
|
5220
5220
|
`;
|
|
5221
|
-
|
|
5221
|
+
M(Qn)`
|
|
5222
5222
|
display: flex;
|
|
5223
5223
|
flex-direction: column;
|
|
5224
5224
|
gap: 0.25rem;
|
|
5225
5225
|
`;
|
|
5226
|
-
|
|
5226
|
+
M.div`
|
|
5227
5227
|
display: flex;
|
|
5228
5228
|
align-items: center;
|
|
5229
5229
|
gap: 0.75rem;
|
|
@@ -5232,7 +5232,7 @@ $.div`
|
|
|
5232
5232
|
border-radius: 0.25rem;
|
|
5233
5233
|
transition: background 0.2s ease-in-out;
|
|
5234
5234
|
`;
|
|
5235
|
-
|
|
5235
|
+
M.div`
|
|
5236
5236
|
width: 12px;
|
|
5237
5237
|
height: 12px;
|
|
5238
5238
|
border-radius: 50%;
|
|
@@ -5253,20 +5253,20 @@ $.div`
|
|
|
5253
5253
|
}
|
|
5254
5254
|
`}
|
|
5255
5255
|
`;
|
|
5256
|
-
|
|
5256
|
+
M.span`
|
|
5257
5257
|
font-family: 'Courier New', Monaco, monospace;
|
|
5258
5258
|
font-size: 1rem;
|
|
5259
5259
|
font-weight: 600;
|
|
5260
5260
|
color: #495057;
|
|
5261
5261
|
min-width: 70px;
|
|
5262
5262
|
`;
|
|
5263
|
-
|
|
5263
|
+
M.span`
|
|
5264
5264
|
font-size: 0.75rem;
|
|
5265
5265
|
font-weight: 500;
|
|
5266
5266
|
color: ${(e) => e.$isPaused ? "#ffc107" : "#dc3545"};
|
|
5267
5267
|
text-transform: uppercase;
|
|
5268
5268
|
`;
|
|
5269
|
-
var ui =
|
|
5269
|
+
var ui = M.div`
|
|
5270
5270
|
position: relative;
|
|
5271
5271
|
width: ${(e) => e.$width}px;
|
|
5272
5272
|
height: ${(e) => e.$height}px;
|
|
@@ -5274,7 +5274,7 @@ var ui = $.div`
|
|
|
5274
5274
|
border-radius: 4px;
|
|
5275
5275
|
overflow: hidden;
|
|
5276
5276
|
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
5277
|
-
`, di = (e) => e < 0.6 ? "linear-gradient(90deg, #27ae60, #2ecc71)" : e < 0.85 ? "linear-gradient(90deg, #f39c12, #f1c40f)" : "linear-gradient(90deg, #c0392b, #e74c3c)", mi =
|
|
5277
|
+
`, di = (e) => e < 0.6 ? "linear-gradient(90deg, #27ae60, #2ecc71)" : e < 0.85 ? "linear-gradient(90deg, #f39c12, #f1c40f)" : "linear-gradient(90deg, #c0392b, #e74c3c)", mi = M.div.attrs((e) => ({
|
|
5278
5278
|
style: {
|
|
5279
5279
|
width: `${e.$level * 100}%`,
|
|
5280
5280
|
height: `${e.$height}px`,
|
|
@@ -5286,7 +5286,7 @@ var ui = $.div`
|
|
|
5286
5286
|
left: 0;
|
|
5287
5287
|
top: 0;
|
|
5288
5288
|
transition: width 0.05s ease-out, background 0.1s ease-out;
|
|
5289
|
-
`, fi =
|
|
5289
|
+
`, fi = M.div.attrs((e) => ({
|
|
5290
5290
|
style: {
|
|
5291
5291
|
left: `${e.$peakLevel * 100}%`,
|
|
5292
5292
|
height: `${e.$height}px`
|
|
@@ -5298,14 +5298,14 @@ var ui = $.div`
|
|
|
5298
5298
|
background: #ecf0f1;
|
|
5299
5299
|
box-shadow: 0 0 4px rgba(236, 240, 241, 0.8);
|
|
5300
5300
|
transition: left 0.1s ease-out;
|
|
5301
|
-
`, hi =
|
|
5301
|
+
`, hi = M.div`
|
|
5302
5302
|
position: absolute;
|
|
5303
5303
|
top: 0;
|
|
5304
5304
|
left: 0;
|
|
5305
5305
|
width: 100%;
|
|
5306
5306
|
height: ${(e) => e.$height}px;
|
|
5307
5307
|
pointer-events: none;
|
|
5308
|
-
`, _n =
|
|
5308
|
+
`, _n = M.div`
|
|
5309
5309
|
position: absolute;
|
|
5310
5310
|
left: ${(e) => e.$position}%;
|
|
5311
5311
|
top: 0;
|
|
@@ -5320,18 +5320,18 @@ var ui = $.div`
|
|
|
5320
5320
|
className: a
|
|
5321
5321
|
}) => {
|
|
5322
5322
|
const s = Math.max(0, Math.min(1, e)), o = t !== void 0 ? Math.max(0, Math.min(1, t)) : 0;
|
|
5323
|
-
return /* @__PURE__ */
|
|
5323
|
+
return /* @__PURE__ */ te(ui, { $width: n, $height: r, className: a, children: [
|
|
5324
5324
|
/* @__PURE__ */ C(mi, { $level: s, $height: r }),
|
|
5325
5325
|
t !== void 0 && o > 0 && /* @__PURE__ */ C(fi, { $peakLevel: o, $height: r }),
|
|
5326
|
-
/* @__PURE__ */
|
|
5326
|
+
/* @__PURE__ */ te(hi, { $height: r, children: [
|
|
5327
5327
|
/* @__PURE__ */ C(_n, { $position: 60, $height: r }),
|
|
5328
5328
|
/* @__PURE__ */ C(_n, { $position: 85, $height: r })
|
|
5329
5329
|
] })
|
|
5330
5330
|
] });
|
|
5331
5331
|
};
|
|
5332
|
-
|
|
5332
|
+
We.memo(pi);
|
|
5333
5333
|
function cl(e, t, n, r = {}) {
|
|
5334
|
-
const { currentTime: a = 0, audioConstraints: s, ...o } = r, [i, l] =
|
|
5334
|
+
const { currentTime: a = 0, audioConstraints: s, ...o } = r, [i, l] = Z(!1), [c, u] = Z(null), {
|
|
5335
5335
|
stream: g,
|
|
5336
5336
|
devices: f,
|
|
5337
5337
|
hasPermission: d,
|
|
@@ -5346,46 +5346,46 @@ function cl(e, t, n, r = {}) {
|
|
|
5346
5346
|
stopRecording: k,
|
|
5347
5347
|
pauseRecording: A,
|
|
5348
5348
|
resumeRecording: E,
|
|
5349
|
-
error:
|
|
5350
|
-
} = ii(g, o),
|
|
5349
|
+
error: S
|
|
5350
|
+
} = ii(g, o), $ = D(async () => {
|
|
5351
5351
|
n && (i || (await Ot(), l(!0)), await x());
|
|
5352
|
-
}, [n, i, x]),
|
|
5353
|
-
const
|
|
5354
|
-
if (
|
|
5352
|
+
}, [n, i, x]), _ = D(async () => {
|
|
5353
|
+
const H = await k();
|
|
5354
|
+
if (H && n) {
|
|
5355
5355
|
const K = e.findIndex((ae) => ae.id === n);
|
|
5356
5356
|
if (K === -1) return;
|
|
5357
|
-
const
|
|
5358
|
-
let
|
|
5359
|
-
if (
|
|
5360
|
-
const ae =
|
|
5361
|
-
(
|
|
5357
|
+
const X = e[K], U = Math.floor(a * H.sampleRate);
|
|
5358
|
+
let W = 0;
|
|
5359
|
+
if (X.clips.length > 0) {
|
|
5360
|
+
const ae = X.clips.map(
|
|
5361
|
+
(se) => se.startSample + se.durationSamples
|
|
5362
5362
|
);
|
|
5363
|
-
|
|
5363
|
+
W = Math.max(...ae);
|
|
5364
5364
|
}
|
|
5365
|
-
const
|
|
5365
|
+
const Y = Math.max(U, W), j = {
|
|
5366
5366
|
id: `clip-${Date.now()}`,
|
|
5367
|
-
audioBuffer:
|
|
5368
|
-
startSample:
|
|
5369
|
-
durationSamples:
|
|
5367
|
+
audioBuffer: H,
|
|
5368
|
+
startSample: Y,
|
|
5369
|
+
durationSamples: H.length,
|
|
5370
5370
|
offsetSamples: 0,
|
|
5371
|
-
sampleRate:
|
|
5372
|
-
sourceDurationSamples:
|
|
5371
|
+
sampleRate: H.sampleRate,
|
|
5372
|
+
sourceDurationSamples: H.length,
|
|
5373
5373
|
gain: 1,
|
|
5374
5374
|
name: `Recording ${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`
|
|
5375
|
-
}, ue = e.map((ae,
|
|
5375
|
+
}, ue = e.map((ae, se) => se === K ? {
|
|
5376
5376
|
...ae,
|
|
5377
|
-
clips: [...ae.clips,
|
|
5377
|
+
clips: [...ae.clips, j]
|
|
5378
5378
|
} : ae);
|
|
5379
5379
|
t(ue);
|
|
5380
5380
|
}
|
|
5381
5381
|
}, [n, e, t, a, k]);
|
|
5382
|
-
|
|
5382
|
+
ee(() => {
|
|
5383
5383
|
d && f.length > 0 && c === null && u(f[0].deviceId);
|
|
5384
5384
|
}, [d, f.length]);
|
|
5385
5385
|
const B = D(async () => {
|
|
5386
5386
|
await b(void 0, s), await Ot(), l(!0);
|
|
5387
|
-
}, [b, s]), P = D(async (
|
|
5388
|
-
u(
|
|
5387
|
+
}, [b, s]), P = D(async (H) => {
|
|
5388
|
+
u(H), await b(H, s), await Ot(), l(!0);
|
|
5389
5389
|
}, [b, s]);
|
|
5390
5390
|
return {
|
|
5391
5391
|
// Recording state
|
|
@@ -5394,15 +5394,15 @@ function cl(e, t, n, r = {}) {
|
|
|
5394
5394
|
duration: m,
|
|
5395
5395
|
level: p,
|
|
5396
5396
|
peakLevel: h,
|
|
5397
|
-
error: v ||
|
|
5397
|
+
error: v || S,
|
|
5398
5398
|
// Microphone state
|
|
5399
5399
|
stream: g,
|
|
5400
5400
|
devices: f,
|
|
5401
5401
|
hasPermission: d,
|
|
5402
5402
|
selectedDevice: c,
|
|
5403
5403
|
// Recording controls
|
|
5404
|
-
startRecording:
|
|
5405
|
-
stopRecording:
|
|
5404
|
+
startRecording: $,
|
|
5405
|
+
stopRecording: _,
|
|
5406
5406
|
pauseRecording: A,
|
|
5407
5407
|
resumeRecording: E,
|
|
5408
5408
|
requestMicAccess: B,
|
|
@@ -5725,9 +5725,9 @@ function ml(e) {
|
|
|
5725
5725
|
};
|
|
5726
5726
|
}
|
|
5727
5727
|
function fl(e = 256) {
|
|
5728
|
-
const [t, n] =
|
|
5728
|
+
const [t, n] = Z([]), r = R(t);
|
|
5729
5729
|
r.current = t;
|
|
5730
|
-
const a =
|
|
5730
|
+
const a = R(/* @__PURE__ */ new Map()), s = R(null), o = R(null), i = D((p) => {
|
|
5731
5731
|
const h = o.current;
|
|
5732
5732
|
if (!h) return;
|
|
5733
5733
|
const { masterGainNode: I, destination: w, analyserNode: m } = h;
|
|
@@ -5805,7 +5805,7 @@ function fl(e = 256) {
|
|
|
5805
5805
|
}, []), d = D(() => {
|
|
5806
5806
|
a.current.forEach((p) => p.dispose()), a.current.clear(), n([]);
|
|
5807
5807
|
}, []);
|
|
5808
|
-
|
|
5808
|
+
ee(() => {
|
|
5809
5809
|
i(t);
|
|
5810
5810
|
}, [t, i]);
|
|
5811
5811
|
const b = D(
|
|
@@ -5832,7 +5832,7 @@ function fl(e = 256) {
|
|
|
5832
5832
|
[e]
|
|
5833
5833
|
// Only fftSize - reads effects from ref
|
|
5834
5834
|
);
|
|
5835
|
-
|
|
5835
|
+
ee(() => () => {
|
|
5836
5836
|
a.current.forEach((p) => p.dispose()), a.current.clear();
|
|
5837
5837
|
}, []);
|
|
5838
5838
|
const v = D(() => {
|
|
@@ -5872,9 +5872,9 @@ function fl(e = 256) {
|
|
|
5872
5872
|
};
|
|
5873
5873
|
}
|
|
5874
5874
|
function hl() {
|
|
5875
|
-
const [e, t] =
|
|
5875
|
+
const [e, t] = Z(
|
|
5876
5876
|
/* @__PURE__ */ new Map()
|
|
5877
|
-
), n =
|
|
5877
|
+
), n = R(/* @__PURE__ */ new Map()), r = R(/* @__PURE__ */ new Map()), a = D((d, b) => {
|
|
5878
5878
|
const v = r.current.get(d);
|
|
5879
5879
|
if (!v) return;
|
|
5880
5880
|
const { graphEnd: p, masterGainNode: h } = v, I = n.current.get(d);
|
|
@@ -5964,7 +5964,7 @@ function hl() {
|
|
|
5964
5964
|
const p = new Map(v);
|
|
5965
5965
|
return p.set(d, []), p;
|
|
5966
5966
|
});
|
|
5967
|
-
}, []), u =
|
|
5967
|
+
}, []), u = R(e);
|
|
5968
5968
|
u.current = e;
|
|
5969
5969
|
const g = D(
|
|
5970
5970
|
(d) => (b, v, p) => {
|
|
@@ -5988,11 +5988,11 @@ function hl() {
|
|
|
5988
5988
|
[]
|
|
5989
5989
|
// No dependencies - stable function that reads from refs
|
|
5990
5990
|
);
|
|
5991
|
-
|
|
5991
|
+
ee(() => {
|
|
5992
5992
|
e.forEach((d, b) => {
|
|
5993
5993
|
a(b, d);
|
|
5994
5994
|
});
|
|
5995
|
-
}, [e, a]),
|
|
5995
|
+
}, [e, a]), ee(() => () => {
|
|
5996
5996
|
n.current.forEach((d) => {
|
|
5997
5997
|
d.forEach((b) => b.dispose()), d.clear();
|
|
5998
5998
|
}), n.current.clear();
|
|
@@ -6062,7 +6062,7 @@ function yi(e, t) {
|
|
|
6062
6062
|
r.href = n, r.download = t, r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
|
|
6063
6063
|
}
|
|
6064
6064
|
function Ci() {
|
|
6065
|
-
const [e, t] =
|
|
6065
|
+
const [e, t] = Z(!1), [n, r] = Z(0), [a, s] = Z(null);
|
|
6066
6066
|
return {
|
|
6067
6067
|
exportWav: D(async (i, l, c = {}) => {
|
|
6068
6068
|
const {
|
|
@@ -6084,13 +6084,13 @@ function Ci() {
|
|
|
6084
6084
|
throw new Error("Invalid track index for individual export");
|
|
6085
6085
|
const w = i[0].clips[0]?.sampleRate || 44100;
|
|
6086
6086
|
let m = 0;
|
|
6087
|
-
for (const
|
|
6088
|
-
for (const
|
|
6089
|
-
const B =
|
|
6087
|
+
for (const $ of i)
|
|
6088
|
+
for (const _ of $.clips) {
|
|
6089
|
+
const B = _.startSample + _.durationSamples;
|
|
6090
6090
|
m = Math.max(m, B);
|
|
6091
6091
|
}
|
|
6092
6092
|
m += Math.round(w * 0.1);
|
|
6093
|
-
const y = m / w, x = g === "individual" ? [{ track: i[f], state: l[f], index: f }] : i.map((
|
|
6093
|
+
const y = m / w, x = g === "individual" ? [{ track: i[f], state: l[f], index: f }] : i.map(($, _) => ({ track: $, state: l[_], index: _ })), k = l.some(($) => $.soloed), A = !!p;
|
|
6094
6094
|
let E;
|
|
6095
6095
|
if ((v || A) && b)
|
|
6096
6096
|
E = await xi(
|
|
@@ -6101,32 +6101,32 @@ function Ci() {
|
|
|
6101
6101
|
w,
|
|
6102
6102
|
v,
|
|
6103
6103
|
p,
|
|
6104
|
-
(
|
|
6105
|
-
r(
|
|
6104
|
+
($) => {
|
|
6105
|
+
r($), I?.($);
|
|
6106
6106
|
}
|
|
6107
6107
|
);
|
|
6108
6108
|
else {
|
|
6109
|
-
const
|
|
6110
|
-
let
|
|
6111
|
-
const B = x.reduce((P, { track:
|
|
6112
|
-
for (const { track: P, state:
|
|
6113
|
-
if (!(
|
|
6109
|
+
const $ = new OfflineAudioContext(2, m, w);
|
|
6110
|
+
let _ = 0;
|
|
6111
|
+
const B = x.reduce((P, { track: H }) => P + H.clips.length, 0);
|
|
6112
|
+
for (const { track: P, state: H } of x)
|
|
6113
|
+
if (!(H.muted && !H.soloed) && !(k && !H.soloed))
|
|
6114
6114
|
for (const K of P.clips) {
|
|
6115
|
-
await Ai(
|
|
6116
|
-
const
|
|
6117
|
-
r(
|
|
6115
|
+
await Ai($, K, H, w, b), _++;
|
|
6116
|
+
const X = _ / B * 0.5;
|
|
6117
|
+
r(X), I?.(X);
|
|
6118
6118
|
}
|
|
6119
|
-
r(0.5), I?.(0.5), E = await
|
|
6119
|
+
r(0.5), I?.(0.5), E = await $.startRendering();
|
|
6120
6120
|
}
|
|
6121
6121
|
r(0.9), I?.(0.9);
|
|
6122
|
-
const
|
|
6122
|
+
const S = wi(E, { bitDepth: h });
|
|
6123
6123
|
if (r(1), I?.(1), d) {
|
|
6124
|
-
const
|
|
6125
|
-
yi(
|
|
6124
|
+
const $ = g === "individual" ? `${u}_${i[f].name}` : u;
|
|
6125
|
+
yi(S, `${$}.wav`);
|
|
6126
6126
|
}
|
|
6127
6127
|
return {
|
|
6128
6128
|
audioBuffer: E,
|
|
6129
|
-
blob:
|
|
6129
|
+
blob: S,
|
|
6130
6130
|
duration: y
|
|
6131
6131
|
};
|
|
6132
6132
|
} catch (w) {
|
|
@@ -6156,16 +6156,16 @@ async function xi(e, t, n, r, a, s, o, i) {
|
|
|
6156
6156
|
const y = new c(Ii(m.volume)), x = new g(m.pan), k = new u(m.muted ? 0 : 1), A = o?.(w.id);
|
|
6157
6157
|
A ? A(k, h, !0) : k.connect(h), x.connect(k), y.connect(x);
|
|
6158
6158
|
for (const E of w.clips) {
|
|
6159
|
-
const { audioBuffer:
|
|
6160
|
-
if (
|
|
6161
|
-
const ae =
|
|
6162
|
-
de.setValueAtTime(0, ae), de.linearRampToValueAtTime(P,
|
|
6159
|
+
const { audioBuffer: S, startSample: $, durationSamples: _, offsetSamples: B, gain: P, fadeIn: H, fadeOut: K } = E, X = $ / a, U = _ / a, W = B / a, Y = new d(S), j = new f(Y), ue = new u(P);
|
|
6160
|
+
if (j.connect(ue), ue.connect(y), H) {
|
|
6161
|
+
const ae = X, se = X + H.duration, de = ue.gain._param;
|
|
6162
|
+
de.setValueAtTime(0, ae), de.linearRampToValueAtTime(P, se);
|
|
6163
6163
|
}
|
|
6164
6164
|
if (K) {
|
|
6165
|
-
const ae =
|
|
6166
|
-
de.setValueAtTime(P, ae), de.linearRampToValueAtTime(0,
|
|
6165
|
+
const ae = X + U - K.duration, se = X + U, de = ue.gain._param;
|
|
6166
|
+
de.setValueAtTime(P, ae), de.linearRampToValueAtTime(0, se);
|
|
6167
6167
|
}
|
|
6168
|
-
|
|
6168
|
+
j.start(X, W, U);
|
|
6169
6169
|
}
|
|
6170
6170
|
}
|
|
6171
6171
|
v.start(0);
|
|
@@ -6257,39 +6257,39 @@ const Ir = Ee(null), Ar = Ee(null), kr = Ee(null), Sr = Ee(null), $r = Ee(null),
|
|
|
6257
6257
|
progressBarWidth: p,
|
|
6258
6258
|
children: h
|
|
6259
6259
|
}) => {
|
|
6260
|
-
const I = p ?? b + v, w =
|
|
6260
|
+
const I = p ?? b + v, w = Je(() => c?.annotations ? c.annotations.map((F) => typeof F.start == "number" ? F : br(F)) : [], [c?.annotations]), m = R(w);
|
|
6261
6261
|
m.current = w;
|
|
6262
|
-
const [y, x] =
|
|
6263
|
-
|
|
6264
|
-
}, []),
|
|
6265
|
-
|
|
6266
|
-
}, []),
|
|
6267
|
-
vt.current = F,
|
|
6262
|
+
const [y, x] = Z(null), [k, A] = Z(!1), [E, S] = Z(0), [$, _] = Z(0), [B, P] = Z([]), [H, K] = Z([]), [X, U] = Z([]), [W, Y] = Z(0), [j, ue] = Z(0), [ae, se] = Z(null), [de, Oe] = Z(o), [z, me] = Z(c?.isContinuousPlay ?? !1), [ie, G] = Z(c?.linkEndpoints ?? !1), [he, pe] = Z(c?.editable ?? !1), [le, Fe] = Z(!1), [_e, Ke] = Z(0), [Ue, oe] = Z(0), [Qe, rt] = Z(!1), V = R(null), Ze = R(0), be = R(0), we = R(null), ft = R(X), O = R(0), ce = R(0), Ce = R(null), Ie = R(null), Be = R(!1), at = R(c?.isContinuousPlay ?? !1), tt = R(null), ct = R(a), vt = R(!1), L = R(0), J = R(0), re = R(0), ge = R(0), { timeFormat: ye, setTimeFormat: Re, formatTime: et } = js(), Le = qs({ initialSamplesPerPixel: a, zoomLevels: s }), ne = Le.samplesPerPixel, { masterVolume: Ae, setMasterVolume: ot } = Qs({ playoutRef: V, initialVolume: 1 }), ht = D((F) => {
|
|
6263
|
+
at.current = F, me(F);
|
|
6264
|
+
}, []), je = D((F) => {
|
|
6265
|
+
tt.current = F, x(F);
|
|
6266
|
+
}, []), st = D((F) => {
|
|
6267
|
+
vt.current = F, Fe(F);
|
|
6268
6268
|
}, []), Ge = D((F, N) => {
|
|
6269
|
-
|
|
6269
|
+
re.current = F, ge.current = N, Ke(F), oe(N);
|
|
6270
6270
|
}, []), wt = D(() => {
|
|
6271
|
-
const F =
|
|
6271
|
+
const F = L.current, N = J.current;
|
|
6272
6272
|
F !== N && N > F && Ge(F, N);
|
|
6273
6273
|
}, [Ge]), yt = D(() => {
|
|
6274
6274
|
Ge(0, 0);
|
|
6275
6275
|
}, [Ge]);
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
}, [de]),
|
|
6279
|
-
ft.current =
|
|
6280
|
-
}, [
|
|
6281
|
-
|
|
6282
|
-
}, [
|
|
6276
|
+
ee(() => {
|
|
6277
|
+
Be.current = de;
|
|
6278
|
+
}, [de]), ee(() => {
|
|
6279
|
+
ft.current = X;
|
|
6280
|
+
}, [X]), ee(() => {
|
|
6281
|
+
L.current = W, J.current = j;
|
|
6282
|
+
}, [W, j]), ee(() => {
|
|
6283
6283
|
if (!Ie.current || !B.length) return;
|
|
6284
|
-
const F = Ie.current, N = ct.current,
|
|
6285
|
-
if (N ===
|
|
6286
|
-
const fe = l.show ? l.width : 0,
|
|
6287
|
-
F.scrollLeft = Pe, ct.current =
|
|
6288
|
-
}, [
|
|
6289
|
-
const ut =
|
|
6290
|
-
|
|
6291
|
-
if (
|
|
6292
|
-
P([]),
|
|
6284
|
+
const F = Ie.current, N = ct.current, Q = ne;
|
|
6285
|
+
if (N === Q) return;
|
|
6286
|
+
const fe = l.show ? l.width : 0, q = F.clientWidth, ke = F.scrollLeft + q / 2 - fe, it = B[0].sampleRate, Se = ke * N / it * it / Q, Pe = Math.max(0, Se + fe - q / 2);
|
|
6287
|
+
F.scrollLeft = Pe, ct.current = Q;
|
|
6288
|
+
}, [ne, B, l]);
|
|
6289
|
+
const ut = R(null);
|
|
6290
|
+
ee(() => {
|
|
6291
|
+
if (rt(!1), e.length === 0) {
|
|
6292
|
+
P([]), _(0), U([]), K([]), V.current && (V.current.dispose(), V.current = null);
|
|
6293
6293
|
return;
|
|
6294
6294
|
}
|
|
6295
6295
|
const F = k, N = be.current;
|
|
@@ -6299,13 +6299,13 @@ const Ir = Ee(null), Ar = Ee(null), kr = Ee(null), Sr = Ee(null), $r = Ee(null),
|
|
|
6299
6299
|
e.forEach((xe) => {
|
|
6300
6300
|
xe.clips.length > 0 && xe.clips[0].audioBuffer && fe.push(xe.clips[0].audioBuffer);
|
|
6301
6301
|
});
|
|
6302
|
-
let
|
|
6302
|
+
let q = 0;
|
|
6303
6303
|
e.forEach((xe) => {
|
|
6304
6304
|
xe.clips.forEach((Se) => {
|
|
6305
6305
|
const Pe = Se.sampleRate, Mt = (Se.startSample + Se.durationSamples) / Pe;
|
|
6306
|
-
|
|
6306
|
+
q = Math.max(q, Mt);
|
|
6307
6307
|
});
|
|
6308
|
-
}), P(fe),
|
|
6308
|
+
}), P(fe), _(q), U((xe) => xe.length === e.length ? xe.map((Se, Pe) => ({
|
|
6309
6309
|
...Se,
|
|
6310
6310
|
name: e[Pe].name
|
|
6311
6311
|
})) : e.map((Se) => ({
|
|
@@ -6352,129 +6352,129 @@ const Ir = Ee(null), Ar = Ee(null), kr = Ee(null), Sr = Ee(null), $r = Ee(null),
|
|
|
6352
6352
|
// Pass track effects
|
|
6353
6353
|
});
|
|
6354
6354
|
}
|
|
6355
|
-
}), $e.applyInitialSoloState(), V.current = $e,
|
|
6356
|
-
const
|
|
6355
|
+
}), $e.applyInitialSoloState(), V.current = $e, rt(!0);
|
|
6356
|
+
const it = new CustomEvent("waveform-playlist:ready", {
|
|
6357
6357
|
detail: {
|
|
6358
6358
|
trackCount: e.length,
|
|
6359
|
-
duration:
|
|
6359
|
+
duration: q
|
|
6360
6360
|
}
|
|
6361
6361
|
});
|
|
6362
|
-
window.dispatchEvent(
|
|
6362
|
+
window.dispatchEvent(it), g?.();
|
|
6363
6363
|
} catch (fe) {
|
|
6364
6364
|
console.error("Error loading audio:", fe);
|
|
6365
6365
|
}
|
|
6366
6366
|
})(), () => {
|
|
6367
6367
|
we.current && cancelAnimationFrame(we.current), V.current && V.current.dispose();
|
|
6368
6368
|
};
|
|
6369
|
-
}, [e, g, k]),
|
|
6369
|
+
}, [e, g, k]), ee(() => {
|
|
6370
6370
|
if (e.length === 0) return;
|
|
6371
|
-
const F = 16, N = e.map((
|
|
6372
|
-
if (
|
|
6371
|
+
const F = 16, N = e.map((Q) => Q.clips.map((q) => {
|
|
6372
|
+
if (q.waveformData) {
|
|
6373
6373
|
const ke = gr(
|
|
6374
|
-
|
|
6374
|
+
q.waveformData,
|
|
6375
6375
|
// Cast to WaveformData type
|
|
6376
|
-
|
|
6376
|
+
ne,
|
|
6377
6377
|
0,
|
|
6378
6378
|
// channel index
|
|
6379
|
-
|
|
6380
|
-
|
|
6379
|
+
q.offsetSamples,
|
|
6380
|
+
q.durationSamples
|
|
6381
6381
|
);
|
|
6382
6382
|
return {
|
|
6383
|
-
clipId:
|
|
6384
|
-
trackName:
|
|
6383
|
+
clipId: q.id,
|
|
6384
|
+
trackName: Q.name,
|
|
6385
6385
|
peaks: {
|
|
6386
6386
|
length: ke.length,
|
|
6387
6387
|
data: [ke.data],
|
|
6388
6388
|
// Wrap in array for channel compatibility
|
|
6389
6389
|
bits: ke.bits
|
|
6390
6390
|
},
|
|
6391
|
-
startSample:
|
|
6392
|
-
durationSamples:
|
|
6393
|
-
fadeIn:
|
|
6394
|
-
fadeOut:
|
|
6391
|
+
startSample: q.startSample,
|
|
6392
|
+
durationSamples: q.durationSamples,
|
|
6393
|
+
fadeIn: q.fadeIn,
|
|
6394
|
+
fadeOut: q.fadeOut
|
|
6395
6395
|
};
|
|
6396
6396
|
}
|
|
6397
|
-
if (!
|
|
6398
|
-
return console.warn(`Clip "${
|
|
6399
|
-
clipId:
|
|
6400
|
-
trackName:
|
|
6397
|
+
if (!q.audioBuffer)
|
|
6398
|
+
return console.warn(`Clip "${q.name || q.id}" has neither waveformData nor audioBuffer - rendering empty`), {
|
|
6399
|
+
clipId: q.id,
|
|
6400
|
+
trackName: Q.name,
|
|
6401
6401
|
peaks: {
|
|
6402
6402
|
length: 0,
|
|
6403
6403
|
data: [],
|
|
6404
6404
|
bits: F
|
|
6405
6405
|
},
|
|
6406
|
-
startSample:
|
|
6407
|
-
durationSamples:
|
|
6408
|
-
fadeIn:
|
|
6409
|
-
fadeOut:
|
|
6406
|
+
startSample: q.startSample,
|
|
6407
|
+
durationSamples: q.durationSamples,
|
|
6408
|
+
fadeIn: q.fadeIn,
|
|
6409
|
+
fadeOut: q.fadeOut
|
|
6410
6410
|
};
|
|
6411
6411
|
const $e = us(
|
|
6412
|
-
|
|
6413
|
-
|
|
6412
|
+
q.audioBuffer,
|
|
6413
|
+
ne,
|
|
6414
6414
|
n,
|
|
6415
6415
|
F,
|
|
6416
|
-
|
|
6417
|
-
|
|
6416
|
+
q.offsetSamples,
|
|
6417
|
+
q.durationSamples
|
|
6418
6418
|
);
|
|
6419
6419
|
return {
|
|
6420
|
-
clipId:
|
|
6421
|
-
trackName:
|
|
6420
|
+
clipId: q.id,
|
|
6421
|
+
trackName: Q.name,
|
|
6422
6422
|
peaks: $e,
|
|
6423
|
-
startSample:
|
|
6424
|
-
durationSamples:
|
|
6425
|
-
fadeIn:
|
|
6426
|
-
fadeOut:
|
|
6423
|
+
startSample: q.startSample,
|
|
6424
|
+
durationSamples: q.durationSamples,
|
|
6425
|
+
fadeIn: q.fadeIn,
|
|
6426
|
+
fadeOut: q.fadeOut
|
|
6427
6427
|
};
|
|
6428
6428
|
}));
|
|
6429
6429
|
K(N);
|
|
6430
|
-
}, [e,
|
|
6431
|
-
const
|
|
6430
|
+
}, [e, ne, n]);
|
|
6431
|
+
const nt = D(() => {
|
|
6432
6432
|
we.current && (cancelAnimationFrame(we.current), we.current = null);
|
|
6433
6433
|
const F = () => {
|
|
6434
|
-
const N = Me().currentTime -
|
|
6435
|
-
be.current =
|
|
6434
|
+
const N = Me().currentTime - O.current, Q = ce.current + N;
|
|
6435
|
+
be.current = Q, S(Q);
|
|
6436
6436
|
const fe = m.current;
|
|
6437
6437
|
if (fe.length > 0) {
|
|
6438
6438
|
const $e = fe.find(
|
|
6439
|
-
(ke) =>
|
|
6439
|
+
(ke) => Q >= ke.start && Q < ke.end
|
|
6440
6440
|
);
|
|
6441
|
-
if (
|
|
6442
|
-
$e && $e.id !==
|
|
6443
|
-
else if (
|
|
6444
|
-
const ke = fe.find((
|
|
6445
|
-
if (ke &&
|
|
6446
|
-
V.current && V.current.stop(), A(!1), be.current = Ze.current,
|
|
6441
|
+
if (at.current)
|
|
6442
|
+
$e && $e.id !== tt.current ? je($e.id) : !$e && tt.current !== null && je(null);
|
|
6443
|
+
else if (tt.current) {
|
|
6444
|
+
const ke = fe.find((it) => it.id === tt.current);
|
|
6445
|
+
if (ke && Q >= ke.end) {
|
|
6446
|
+
V.current && V.current.stop(), A(!1), be.current = Ze.current, S(Ze.current);
|
|
6447
6447
|
return;
|
|
6448
6448
|
}
|
|
6449
6449
|
} else
|
|
6450
|
-
$e &&
|
|
6450
|
+
$e && je($e.id);
|
|
6451
6451
|
}
|
|
6452
|
-
if (
|
|
6453
|
-
const $e = Ie.current, ke = B[0].sampleRate,
|
|
6452
|
+
if (Be.current && Ie.current && B.length > 0) {
|
|
6453
|
+
const $e = Ie.current, ke = B[0].sampleRate, it = Q * ke / ct.current, xe = $e.clientWidth, Se = l.show ? l.width : 0, Pe = it + Se, dt = Math.max(0, Pe - xe / 2);
|
|
6454
6454
|
$e.scrollLeft = dt;
|
|
6455
6455
|
}
|
|
6456
|
-
if (Ce.current !== null &&
|
|
6457
|
-
V.current && V.current.stop(), A(!1), be.current = Ce.current,
|
|
6456
|
+
if (Ce.current !== null && Q >= Ce.current) {
|
|
6457
|
+
V.current && V.current.stop(), A(!1), be.current = Ce.current, S(Ce.current), Ce.current = null;
|
|
6458
6458
|
return;
|
|
6459
6459
|
}
|
|
6460
|
-
const
|
|
6461
|
-
if (vt.current &&
|
|
6460
|
+
const q = re.current !== ge.current && ge.current > re.current;
|
|
6461
|
+
if (vt.current && q && Q >= ge.current) {
|
|
6462
6462
|
V.current?.stop();
|
|
6463
6463
|
const ke = Me().currentTime;
|
|
6464
|
-
|
|
6464
|
+
O.current = ke, ce.current = re.current, be.current = re.current, V.current?.play(ke, re.current), we.current = requestAnimationFrame(F);
|
|
6465
6465
|
return;
|
|
6466
6466
|
}
|
|
6467
|
-
if (
|
|
6468
|
-
V.current && V.current.stop(), A(!1), be.current = Ze.current,
|
|
6467
|
+
if (Q >= $) {
|
|
6468
|
+
V.current && V.current.stop(), A(!1), be.current = Ze.current, S(Ze.current), je(null);
|
|
6469
6469
|
return;
|
|
6470
6470
|
}
|
|
6471
6471
|
we.current = requestAnimationFrame(F);
|
|
6472
6472
|
};
|
|
6473
6473
|
we.current = requestAnimationFrame(F);
|
|
6474
|
-
}, [
|
|
6474
|
+
}, [$, B, ne, z]), Ve = D(() => {
|
|
6475
6475
|
we.current && (cancelAnimationFrame(we.current), we.current = null);
|
|
6476
6476
|
}, []);
|
|
6477
|
-
|
|
6477
|
+
ee(() => {
|
|
6478
6478
|
(async () => {
|
|
6479
6479
|
if (k && we.current && V.current)
|
|
6480
6480
|
if (z) {
|
|
@@ -6482,67 +6482,67 @@ const Ir = Ee(null), Ar = Ee(null), kr = Ee(null), Sr = Ee(null), $r = Ee(null),
|
|
|
6482
6482
|
V.current.stop(), Ve(), await V.current.init(), V.current.setOnPlaybackComplete(() => {
|
|
6483
6483
|
});
|
|
6484
6484
|
const fe = Me().currentTime;
|
|
6485
|
-
|
|
6485
|
+
O.current = fe, ce.current = N, V.current.play(fe, N), nt();
|
|
6486
6486
|
} else
|
|
6487
|
-
Ve(),
|
|
6487
|
+
Ve(), nt();
|
|
6488
6488
|
})();
|
|
6489
|
-
}, [z, k,
|
|
6489
|
+
}, [z, k, nt, Ve]), ee(() => {
|
|
6490
6490
|
(async () => {
|
|
6491
6491
|
if (ut.current && V.current) {
|
|
6492
6492
|
const { position: N } = ut.current;
|
|
6493
6493
|
ut.current = null, await V.current.init(), V.current.setOnPlaybackComplete(() => {
|
|
6494
6494
|
});
|
|
6495
6495
|
const fe = Me().currentTime;
|
|
6496
|
-
|
|
6496
|
+
O.current = fe, ce.current = N, V.current.play(fe, N), A(!0), nt();
|
|
6497
6497
|
}
|
|
6498
6498
|
})();
|
|
6499
|
-
}, [e,
|
|
6499
|
+
}, [e, nt]);
|
|
6500
6500
|
const Lt = D(async (F, N) => {
|
|
6501
6501
|
if (!V.current || B.length === 0) return;
|
|
6502
6502
|
await V.current.init(), await Xn();
|
|
6503
|
-
const
|
|
6504
|
-
Ze.current =
|
|
6503
|
+
const Q = F ?? be.current;
|
|
6504
|
+
Ze.current = Q, be.current = Q, V.current.setOnPlaybackComplete(() => {
|
|
6505
6505
|
}), V.current.stop(), Ve();
|
|
6506
|
-
const
|
|
6507
|
-
|
|
6508
|
-
}, [B.length,
|
|
6506
|
+
const q = Me().currentTime;
|
|
6507
|
+
O.current = q, ce.current = Q, Ce.current = N !== void 0 ? Q + N : null, V.current.play(q, Q, N), A(!0), nt();
|
|
6508
|
+
}, [B.length, nt, Ve]), Wr = D(() => {
|
|
6509
6509
|
if (!V.current) return;
|
|
6510
|
-
const F = Me().currentTime -
|
|
6511
|
-
V.current.pause(), A(!1), Ve(), be.current = N,
|
|
6510
|
+
const F = Me().currentTime - O.current, N = ce.current + F;
|
|
6511
|
+
V.current.pause(), A(!1), Ve(), be.current = N, S(N);
|
|
6512
6512
|
}, [Ve]), Fr = D(() => {
|
|
6513
|
-
V.current && (V.current.stop(), A(!1), Ve(), be.current = Ze.current,
|
|
6513
|
+
V.current && (V.current.stop(), A(!1), Ve(), be.current = Ze.current, S(Ze.current), je(null));
|
|
6514
6514
|
}, [Ve]), _r = D((F) => {
|
|
6515
|
-
const N = Math.max(0, Math.min(F,
|
|
6516
|
-
be.current = N,
|
|
6517
|
-
}, [
|
|
6518
|
-
const
|
|
6519
|
-
if (
|
|
6515
|
+
const N = Math.max(0, Math.min(F, $));
|
|
6516
|
+
be.current = N, S(N), k && V.current && (V.current.stop(), Ve(), Lt(N));
|
|
6517
|
+
}, [$, k, Lt, Ve]), Zr = D((F, N) => {
|
|
6518
|
+
const Q = [...X];
|
|
6519
|
+
if (Q[F] = { ...Q[F], muted: N }, U(Q), V.current) {
|
|
6520
6520
|
const fe = `track-${F}`;
|
|
6521
6521
|
V.current.setMute(fe, N);
|
|
6522
6522
|
}
|
|
6523
|
-
}, [
|
|
6524
|
-
const
|
|
6525
|
-
if (
|
|
6523
|
+
}, [X]), Vr = D((F, N) => {
|
|
6524
|
+
const Q = [...X];
|
|
6525
|
+
if (Q[F] = { ...Q[F], soloed: N }, U(Q), V.current) {
|
|
6526
6526
|
const fe = `track-${F}`;
|
|
6527
6527
|
V.current.setSolo(fe, N);
|
|
6528
6528
|
}
|
|
6529
|
-
}, [
|
|
6530
|
-
const
|
|
6531
|
-
if (
|
|
6532
|
-
const fe = `track-${F}`,
|
|
6533
|
-
|
|
6529
|
+
}, [X]), Pr = D((F, N) => {
|
|
6530
|
+
const Q = [...X];
|
|
6531
|
+
if (Q[F] = { ...Q[F], volume: N }, U(Q), V.current) {
|
|
6532
|
+
const fe = `track-${F}`, q = V.current.getTrack(fe);
|
|
6533
|
+
q && q.setVolume(N);
|
|
6534
6534
|
}
|
|
6535
|
-
}, [
|
|
6536
|
-
const
|
|
6537
|
-
if (
|
|
6538
|
-
const fe = `track-${F}`,
|
|
6539
|
-
|
|
6535
|
+
}, [X]), zr = D((F, N) => {
|
|
6536
|
+
const Q = [...X];
|
|
6537
|
+
if (Q[F] = { ...Q[F], pan: N }, U(Q), V.current) {
|
|
6538
|
+
const fe = `track-${F}`, q = V.current.getTrack(fe);
|
|
6539
|
+
q && q.setPan(N);
|
|
6540
6540
|
}
|
|
6541
|
-
}, [
|
|
6542
|
-
|
|
6541
|
+
}, [X]), Hr = D((F, N) => {
|
|
6542
|
+
Y(F), ue(N), be.current = F, S(F), k && V.current && (V.current.stop(), V.current.play(Me().currentTime, F));
|
|
6543
6543
|
}, [k]), Xr = D((F) => {
|
|
6544
6544
|
Ie.current = F;
|
|
6545
|
-
}, []), Gt =
|
|
6545
|
+
}, []), Gt = R(d);
|
|
6546
6546
|
Gt.current = d;
|
|
6547
6547
|
const Lr = D(
|
|
6548
6548
|
(F) => {
|
|
@@ -6560,21 +6560,21 @@ const Ir = Ee(null), Ar = Ee(null), kr = Ee(null), Sr = Ee(null), $r = Ee(null),
|
|
|
6560
6560
|
isPlaying: k,
|
|
6561
6561
|
currentTime: E,
|
|
6562
6562
|
currentTimeRef: be,
|
|
6563
|
-
playbackStartTimeRef:
|
|
6563
|
+
playbackStartTimeRef: O,
|
|
6564
6564
|
audioStartPositionRef: ce
|
|
6565
6565
|
}, fn = {
|
|
6566
6566
|
continuousPlay: z,
|
|
6567
|
-
linkEndpoints:
|
|
6568
|
-
annotationsEditable:
|
|
6567
|
+
linkEndpoints: ie,
|
|
6568
|
+
annotationsEditable: he,
|
|
6569
6569
|
isAutomaticScroll: de,
|
|
6570
6570
|
isLoopEnabled: le,
|
|
6571
6571
|
annotations: w,
|
|
6572
6572
|
activeAnnotationId: y,
|
|
6573
|
-
selectionStart:
|
|
6574
|
-
selectionEnd:
|
|
6573
|
+
selectionStart: W,
|
|
6574
|
+
selectionEnd: j,
|
|
6575
6575
|
selectedTrackId: ae,
|
|
6576
|
-
loopStart:
|
|
6577
|
-
loopEnd:
|
|
6576
|
+
loopStart: _e,
|
|
6577
|
+
loopEnd: Ue
|
|
6578
6578
|
}, hn = {
|
|
6579
6579
|
// Playback controls
|
|
6580
6580
|
play: Lt,
|
|
@@ -6582,7 +6582,7 @@ const Ir = Ee(null), Ar = Ee(null), kr = Ee(null), Sr = Ee(null), $r = Ee(null),
|
|
|
6582
6582
|
stop: Fr,
|
|
6583
6583
|
seekTo: _r,
|
|
6584
6584
|
setCurrentTime: (F) => {
|
|
6585
|
-
be.current = F,
|
|
6585
|
+
be.current = F, S(F);
|
|
6586
6586
|
},
|
|
6587
6587
|
// Track controls
|
|
6588
6588
|
setTrackMute: Zr,
|
|
@@ -6591,37 +6591,37 @@ const Ir = Ee(null), Ar = Ee(null), kr = Ee(null), Sr = Ee(null), $r = Ee(null),
|
|
|
6591
6591
|
setTrackPan: zr,
|
|
6592
6592
|
// Selection
|
|
6593
6593
|
setSelection: Hr,
|
|
6594
|
-
setSelectedTrackId:
|
|
6594
|
+
setSelectedTrackId: se,
|
|
6595
6595
|
// Time format
|
|
6596
|
-
setTimeFormat:
|
|
6597
|
-
formatTime:
|
|
6596
|
+
setTimeFormat: Re,
|
|
6597
|
+
formatTime: et,
|
|
6598
6598
|
// Zoom
|
|
6599
6599
|
zoomIn: Le.zoomIn,
|
|
6600
6600
|
zoomOut: Le.zoomOut,
|
|
6601
6601
|
// Master volume
|
|
6602
|
-
setMasterVolume:
|
|
6602
|
+
setMasterVolume: ot,
|
|
6603
6603
|
// Automatic scroll
|
|
6604
6604
|
setAutomaticScroll: (F) => {
|
|
6605
|
-
|
|
6605
|
+
Oe(F);
|
|
6606
6606
|
},
|
|
6607
6607
|
setScrollContainer: Xr,
|
|
6608
6608
|
scrollContainerRef: Ie,
|
|
6609
6609
|
// Annotation controls
|
|
6610
6610
|
setContinuousPlay: ht,
|
|
6611
|
-
setLinkEndpoints:
|
|
6611
|
+
setLinkEndpoints: G,
|
|
6612
6612
|
setAnnotationsEditable: pe,
|
|
6613
6613
|
setAnnotations: Lr,
|
|
6614
|
-
setActiveAnnotationId:
|
|
6614
|
+
setActiveAnnotationId: je,
|
|
6615
6615
|
// Loop controls
|
|
6616
|
-
setLoopEnabled:
|
|
6616
|
+
setLoopEnabled: st,
|
|
6617
6617
|
setLoopRegion: Ge,
|
|
6618
6618
|
setLoopRegionFromSelection: wt,
|
|
6619
6619
|
clearLoopRegion: yt
|
|
6620
6620
|
}, pn = {
|
|
6621
|
-
duration:
|
|
6621
|
+
duration: $,
|
|
6622
6622
|
audioBuffers: B,
|
|
6623
|
-
peaksDataArray:
|
|
6624
|
-
trackStates:
|
|
6623
|
+
peaksDataArray: H,
|
|
6624
|
+
trackStates: X,
|
|
6625
6625
|
tracks: e,
|
|
6626
6626
|
sampleRate: Gr,
|
|
6627
6627
|
waveHeight: r,
|
|
@@ -6629,7 +6629,7 @@ const Ir = Ee(null), Ar = Ee(null), kr = Ee(null), Sr = Ee(null), $r = Ee(null),
|
|
|
6629
6629
|
minimumPlaylistHeight: Nr,
|
|
6630
6630
|
controls: l,
|
|
6631
6631
|
playoutRef: V,
|
|
6632
|
-
samplesPerPixel:
|
|
6632
|
+
samplesPerPixel: ne,
|
|
6633
6633
|
timeFormat: ye,
|
|
6634
6634
|
masterVolume: Ae,
|
|
6635
6635
|
canZoomIn: Le.canZoomIn,
|
|
@@ -6637,7 +6637,7 @@ const Ir = Ee(null), Ar = Ee(null), kr = Ee(null), Sr = Ee(null), $r = Ee(null),
|
|
|
6637
6637
|
barWidth: b,
|
|
6638
6638
|
barGap: v,
|
|
6639
6639
|
progressBarWidth: I,
|
|
6640
|
-
isReady:
|
|
6640
|
+
isReady: Qe,
|
|
6641
6641
|
mono: n
|
|
6642
6642
|
}, Yr = {
|
|
6643
6643
|
...mn,
|
|
@@ -6661,7 +6661,7 @@ const Ir = Ee(null), Ar = Ee(null), kr = Ee(null), Sr = Ee(null), $r = Ee(null),
|
|
|
6661
6661
|
if (!e)
|
|
6662
6662
|
throw new Error("usePlaylistControls must be used within WaveformPlaylistProvider");
|
|
6663
6663
|
return e;
|
|
6664
|
-
},
|
|
6664
|
+
}, Te = () => {
|
|
6665
6665
|
const e = De(Sr);
|
|
6666
6666
|
if (!e)
|
|
6667
6667
|
throw new Error("usePlaylistData must be used within WaveformPlaylistProvider");
|
|
@@ -6930,135 +6930,135 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
6930
6930
|
onReady: d,
|
|
6931
6931
|
children: b
|
|
6932
6932
|
}) => {
|
|
6933
|
-
const v = g ?? c + u, [p, h] =
|
|
6934
|
-
|
|
6935
|
-
const [
|
|
6933
|
+
const v = g ?? c + u, [p, h] = Z(!1), [I, w] = Z(0), [m, y] = Z(0), [x, k] = Z([]), [A, E] = Z(a), S = Je(() => l?.annotations ? l.annotations.map((O) => typeof O.start == "number" ? O : br(O)) : [], [l?.annotations]), $ = R(S);
|
|
6934
|
+
$.current = S;
|
|
6935
|
+
const [_, B] = Z(null), [P, H] = Z(
|
|
6936
6936
|
l?.isContinuousPlay ?? !1
|
|
6937
|
-
), [K] =
|
|
6938
|
-
|
|
6937
|
+
), [K] = Z(t), [X, U] = Z(s), W = R(null), Y = R(0), j = R(null), ue = R(P), ae = R(null), se = R(null), de = R(s), Oe = R(t);
|
|
6938
|
+
ee(() => {
|
|
6939
6939
|
ue.current = P;
|
|
6940
|
-
}, [P]),
|
|
6941
|
-
de.current =
|
|
6942
|
-
}, [
|
|
6943
|
-
const z = D((
|
|
6944
|
-
ae.current =
|
|
6945
|
-
}, []),
|
|
6946
|
-
ue.current =
|
|
6947
|
-
}, []),
|
|
6948
|
-
|
|
6949
|
-
}, []),
|
|
6950
|
-
|
|
6951
|
-
const
|
|
6940
|
+
}, [P]), ee(() => {
|
|
6941
|
+
de.current = X;
|
|
6942
|
+
}, [X]);
|
|
6943
|
+
const z = D((O) => {
|
|
6944
|
+
ae.current = O, B(O);
|
|
6945
|
+
}, []), me = D((O) => {
|
|
6946
|
+
ue.current = O, H(O);
|
|
6947
|
+
}, []), ie = D((O) => {
|
|
6948
|
+
se.current = O;
|
|
6949
|
+
}, []), G = e.waveformData.sample_rate;
|
|
6950
|
+
ee(() => {
|
|
6951
|
+
const O = new Si({
|
|
6952
6952
|
playbackRate: a
|
|
6953
6953
|
});
|
|
6954
|
-
|
|
6954
|
+
O.addTrack({
|
|
6955
6955
|
source: e.source,
|
|
6956
6956
|
peaks: e.waveformData,
|
|
6957
6957
|
name: e.name
|
|
6958
6958
|
});
|
|
6959
|
-
const ce =
|
|
6959
|
+
const ce = O.getTrack(O.track?.id ?? "");
|
|
6960
6960
|
return ce && ce.setOnTimeUpdateCallback((Ce) => {
|
|
6961
|
-
|
|
6962
|
-
}),
|
|
6963
|
-
|
|
6964
|
-
}),
|
|
6965
|
-
|
|
6961
|
+
Y.current = Ce;
|
|
6962
|
+
}), O.setOnPlaybackComplete(() => {
|
|
6963
|
+
j.current && (cancelAnimationFrame(j.current), j.current = null), h(!1), z(null), Y.current = 0, w(0);
|
|
6964
|
+
}), W.current = O, y(e.waveformData.duration), d?.(), () => {
|
|
6965
|
+
j.current && cancelAnimationFrame(j.current), O.dispose();
|
|
6966
6966
|
};
|
|
6967
|
-
}, [e.source, e.waveformData, e.name, a, d]),
|
|
6968
|
-
const
|
|
6967
|
+
}, [e.source, e.waveformData, e.name, a, d]), ee(() => {
|
|
6968
|
+
const O = gr(
|
|
6969
6969
|
e.waveformData,
|
|
6970
6970
|
K,
|
|
6971
6971
|
0,
|
|
6972
6972
|
// channel index
|
|
6973
6973
|
0,
|
|
6974
6974
|
// offset
|
|
6975
|
-
Math.ceil(e.waveformData.duration *
|
|
6975
|
+
Math.ceil(e.waveformData.duration * G)
|
|
6976
6976
|
// duration in samples
|
|
6977
6977
|
), ce = {
|
|
6978
6978
|
clipId: "media-element-clip",
|
|
6979
6979
|
trackName: e.name ?? "Track",
|
|
6980
6980
|
peaks: {
|
|
6981
|
-
length:
|
|
6982
|
-
data: [
|
|
6983
|
-
bits:
|
|
6981
|
+
length: O.length,
|
|
6982
|
+
data: [O.data],
|
|
6983
|
+
bits: O.bits
|
|
6984
6984
|
},
|
|
6985
6985
|
startSample: 0,
|
|
6986
|
-
durationSamples: Math.ceil(e.waveformData.duration *
|
|
6986
|
+
durationSamples: Math.ceil(e.waveformData.duration * G)
|
|
6987
6987
|
};
|
|
6988
6988
|
k([[ce]]);
|
|
6989
|
-
}, [e.waveformData, e.name, K,
|
|
6990
|
-
const
|
|
6991
|
-
|
|
6992
|
-
const
|
|
6993
|
-
const ce =
|
|
6994
|
-
|
|
6995
|
-
const Ce =
|
|
6989
|
+
}, [e.waveformData, e.name, K, G]);
|
|
6990
|
+
const he = D(() => {
|
|
6991
|
+
j.current && cancelAnimationFrame(j.current);
|
|
6992
|
+
const O = () => {
|
|
6993
|
+
const ce = W.current?.getCurrentTime() ?? 0;
|
|
6994
|
+
Y.current = ce, w(ce);
|
|
6995
|
+
const Ce = $.current;
|
|
6996
6996
|
if (Ce.length > 0) {
|
|
6997
6997
|
const Ie = Ce.find(
|
|
6998
|
-
(
|
|
6998
|
+
(Be) => ce >= Be.start && ce < Be.end
|
|
6999
6999
|
);
|
|
7000
7000
|
if (ue.current)
|
|
7001
7001
|
Ie && Ie.id !== ae.current ? z(Ie.id) : !Ie && ae.current !== null && z(null);
|
|
7002
7002
|
else if (ae.current) {
|
|
7003
|
-
const
|
|
7004
|
-
(
|
|
7003
|
+
const Be = Ce.find(
|
|
7004
|
+
(at) => at.id === ae.current
|
|
7005
7005
|
);
|
|
7006
|
-
if (
|
|
7007
|
-
|
|
7006
|
+
if (Be && ce >= Be.end) {
|
|
7007
|
+
W.current?.stop(), h(!1);
|
|
7008
7008
|
return;
|
|
7009
7009
|
}
|
|
7010
7010
|
} else Ie && z(Ie.id);
|
|
7011
7011
|
}
|
|
7012
|
-
if (de.current &&
|
|
7013
|
-
const Ie =
|
|
7012
|
+
if (de.current && se.current) {
|
|
7013
|
+
const Ie = se.current, Be = ce * G / Oe.current, at = Ie.clientWidth, tt = i.show ? i.width : 0, ct = Be + tt, vt = Math.max(0, ct - at / 2);
|
|
7014
7014
|
Ie.scrollLeft = vt;
|
|
7015
7015
|
}
|
|
7016
|
-
|
|
7016
|
+
j.current = requestAnimationFrame(O);
|
|
7017
7017
|
};
|
|
7018
|
-
|
|
7019
|
-
}, [z,
|
|
7020
|
-
|
|
7018
|
+
j.current = requestAnimationFrame(O);
|
|
7019
|
+
}, [z, G, i]), pe = D(() => {
|
|
7020
|
+
j.current && (cancelAnimationFrame(j.current), j.current = null);
|
|
7021
7021
|
}, []), le = D(
|
|
7022
|
-
(
|
|
7023
|
-
if (!
|
|
7024
|
-
const ce =
|
|
7025
|
-
|
|
7022
|
+
(O) => {
|
|
7023
|
+
if (!W.current) return;
|
|
7024
|
+
const ce = O ?? Y.current;
|
|
7025
|
+
W.current.play(void 0, ce), h(!0), he();
|
|
7026
7026
|
},
|
|
7027
|
-
[
|
|
7028
|
-
),
|
|
7029
|
-
|
|
7030
|
-
}, [pe]),
|
|
7031
|
-
|
|
7032
|
-
}, [pe, z]),
|
|
7033
|
-
(
|
|
7034
|
-
const ce = Math.max(0, Math.min(
|
|
7035
|
-
|
|
7027
|
+
[he]
|
|
7028
|
+
), Fe = D(() => {
|
|
7029
|
+
W.current && (W.current.pause(), h(!1), pe(), w(W.current.getCurrentTime()));
|
|
7030
|
+
}, [pe]), _e = D(() => {
|
|
7031
|
+
W.current && (W.current.stop(), h(!1), pe(), Y.current = 0, w(0), z(null));
|
|
7032
|
+
}, [pe, z]), Ke = D(
|
|
7033
|
+
(O) => {
|
|
7034
|
+
const ce = Math.max(0, Math.min(O, m));
|
|
7035
|
+
Y.current = ce, w(ce), W.current && W.current.seekTo(ce);
|
|
7036
7036
|
},
|
|
7037
7037
|
[m]
|
|
7038
|
-
),
|
|
7039
|
-
const ce = Math.max(0.5, Math.min(2,
|
|
7040
|
-
E(ce),
|
|
7041
|
-
}, []),
|
|
7038
|
+
), Ue = D((O) => {
|
|
7039
|
+
const ce = Math.max(0.5, Math.min(2, O));
|
|
7040
|
+
E(ce), W.current && W.current.setPlaybackRate(ce);
|
|
7041
|
+
}, []), oe = r ? 30 : 0, Qe = Je(
|
|
7042
7042
|
() => ({
|
|
7043
7043
|
isPlaying: p,
|
|
7044
7044
|
currentTime: I,
|
|
7045
|
-
currentTimeRef:
|
|
7045
|
+
currentTimeRef: Y
|
|
7046
7046
|
}),
|
|
7047
7047
|
[p, I]
|
|
7048
|
-
),
|
|
7048
|
+
), rt = Je(
|
|
7049
7049
|
() => ({
|
|
7050
7050
|
continuousPlay: P,
|
|
7051
|
-
annotations:
|
|
7052
|
-
activeAnnotationId:
|
|
7051
|
+
annotations: S,
|
|
7052
|
+
activeAnnotationId: _,
|
|
7053
7053
|
playbackRate: A,
|
|
7054
|
-
isAutomaticScroll:
|
|
7054
|
+
isAutomaticScroll: X
|
|
7055
7055
|
}),
|
|
7056
|
-
[P,
|
|
7057
|
-
), V =
|
|
7056
|
+
[P, S, _, A, X]
|
|
7057
|
+
), V = R(f);
|
|
7058
7058
|
V.current = f;
|
|
7059
7059
|
const Ze = D(
|
|
7060
|
-
(
|
|
7061
|
-
const ce = typeof
|
|
7060
|
+
(O) => {
|
|
7061
|
+
const ce = typeof O == "function" ? O($.current) : O;
|
|
7062
7062
|
if (!V.current) {
|
|
7063
7063
|
process.env.NODE_ENV !== "production" && console.warn(
|
|
7064
7064
|
"waveform-playlist: setAnnotations was called but no onAnnotationsChange callback is provided. Annotation edits will not persist. Pass onAnnotationsChange to MediaElementPlaylistProvider to handle annotation updates."
|
|
@@ -7068,32 +7068,32 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7068
7068
|
V.current(ce);
|
|
7069
7069
|
},
|
|
7070
7070
|
[]
|
|
7071
|
-
), be =
|
|
7071
|
+
), be = Je(
|
|
7072
7072
|
() => ({
|
|
7073
7073
|
play: le,
|
|
7074
|
-
pause:
|
|
7075
|
-
stop:
|
|
7076
|
-
seekTo:
|
|
7077
|
-
setPlaybackRate:
|
|
7078
|
-
setContinuousPlay:
|
|
7074
|
+
pause: Fe,
|
|
7075
|
+
stop: _e,
|
|
7076
|
+
seekTo: Ke,
|
|
7077
|
+
setPlaybackRate: Ue,
|
|
7078
|
+
setContinuousPlay: me,
|
|
7079
7079
|
setAnnotations: Ze,
|
|
7080
7080
|
setActiveAnnotationId: z,
|
|
7081
|
-
setAutomaticScroll: (
|
|
7082
|
-
|
|
7081
|
+
setAutomaticScroll: (O) => {
|
|
7082
|
+
U(O);
|
|
7083
7083
|
},
|
|
7084
|
-
setScrollContainer:
|
|
7085
|
-
scrollContainerRef:
|
|
7084
|
+
setScrollContainer: ie,
|
|
7085
|
+
scrollContainerRef: se
|
|
7086
7086
|
}),
|
|
7087
|
-
[le,
|
|
7088
|
-
), we =
|
|
7087
|
+
[le, Fe, _e, Ke, Ue, me, Ze, z, ie]
|
|
7088
|
+
), we = Je(
|
|
7089
7089
|
() => ({
|
|
7090
7090
|
duration: m,
|
|
7091
7091
|
peaksDataArray: x,
|
|
7092
|
-
sampleRate:
|
|
7092
|
+
sampleRate: G,
|
|
7093
7093
|
waveHeight: n,
|
|
7094
|
-
timeScaleHeight:
|
|
7094
|
+
timeScaleHeight: oe,
|
|
7095
7095
|
samplesPerPixel: K,
|
|
7096
|
-
playoutRef:
|
|
7096
|
+
playoutRef: W,
|
|
7097
7097
|
controls: i,
|
|
7098
7098
|
barWidth: c,
|
|
7099
7099
|
barGap: u,
|
|
@@ -7102,9 +7102,9 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7102
7102
|
[
|
|
7103
7103
|
m,
|
|
7104
7104
|
x,
|
|
7105
|
-
|
|
7105
|
+
G,
|
|
7106
7106
|
n,
|
|
7107
|
-
|
|
7107
|
+
oe,
|
|
7108
7108
|
K,
|
|
7109
7109
|
i,
|
|
7110
7110
|
c,
|
|
@@ -7112,7 +7112,7 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7112
7112
|
v
|
|
7113
7113
|
]
|
|
7114
7114
|
), ft = { ...nr, ...o };
|
|
7115
|
-
return /* @__PURE__ */ C(Nn, { theme: ft, children: /* @__PURE__ */ C(Mr.Provider, { value:
|
|
7115
|
+
return /* @__PURE__ */ C(Nn, { theme: ft, children: /* @__PURE__ */ C(Mr.Provider, { value: Qe, children: /* @__PURE__ */ C(Er.Provider, { value: rt, children: /* @__PURE__ */ C(Dr.Provider, { value: be, children: /* @__PURE__ */ C(Tr.Provider, { value: we, children: b }) }) }) }) });
|
|
7116
7116
|
}, ln = () => {
|
|
7117
7117
|
const e = De(Mr);
|
|
7118
7118
|
if (!e)
|
|
@@ -7161,12 +7161,12 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7161
7161
|
const { isPlaying: t } = He(), { stop: n } = ve();
|
|
7162
7162
|
return /* @__PURE__ */ C(Ye, { onClick: n, disabled: !t, className: e, children: "Stop" });
|
|
7163
7163
|
}, Cl = ({ className: e }) => {
|
|
7164
|
-
const { isPlaying: t } = He(), { play: n, setCurrentTime: r } = ve(), { playoutRef: a } =
|
|
7164
|
+
const { isPlaying: t } = He(), { play: n, setCurrentTime: r } = ve(), { playoutRef: a } = Te();
|
|
7165
7165
|
return /* @__PURE__ */ C(Ye, { onClick: () => {
|
|
7166
7166
|
r(0), t && a.current && (a.current.stop(), n(0));
|
|
7167
7167
|
}, className: e, children: "Rewind" });
|
|
7168
7168
|
}, xl = ({ className: e }) => {
|
|
7169
|
-
const { isPlaying: t } = He(), { play: n, setCurrentTime: r } = ve(), { duration: a, playoutRef: s } =
|
|
7169
|
+
const { isPlaying: t } = He(), { play: n, setCurrentTime: r } = ve(), { duration: a, playoutRef: s } = Te();
|
|
7170
7170
|
return /* @__PURE__ */ C(Ye, { onClick: () => {
|
|
7171
7171
|
r(a), t && s.current && (s.current.stop(), n(a));
|
|
7172
7172
|
}, className: e, children: "Fast Forward" });
|
|
@@ -7174,7 +7174,7 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7174
7174
|
skipAmount: e = 5,
|
|
7175
7175
|
className: t
|
|
7176
7176
|
}) => {
|
|
7177
|
-
const { currentTimeRef: n, isPlaying: r } = He(), { play: a, setCurrentTime: s } = ve(), { playoutRef: o } =
|
|
7177
|
+
const { currentTimeRef: n, isPlaying: r } = He(), { play: a, setCurrentTime: s } = ve(), { playoutRef: o } = Te();
|
|
7178
7178
|
return /* @__PURE__ */ C(Ye, { onClick: () => {
|
|
7179
7179
|
const l = Math.max(0, (n.current ?? 0) - e);
|
|
7180
7180
|
s(l), r && o.current && (o.current.stop(), a(l));
|
|
@@ -7183,13 +7183,13 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7183
7183
|
skipAmount: e = 5,
|
|
7184
7184
|
className: t
|
|
7185
7185
|
}) => {
|
|
7186
|
-
const { currentTimeRef: n, isPlaying: r } = He(), { play: a, setCurrentTime: s } = ve(), { duration: o, playoutRef: i } =
|
|
7186
|
+
const { currentTimeRef: n, isPlaying: r } = He(), { play: a, setCurrentTime: s } = ve(), { duration: o, playoutRef: i } = Te();
|
|
7187
7187
|
return /* @__PURE__ */ C(Ye, { onClick: () => {
|
|
7188
7188
|
const c = Math.min(o, (n.current ?? 0) + e);
|
|
7189
7189
|
s(c), r && i.current && (i.current.stop(), a(c));
|
|
7190
7190
|
}, className: t, children: "Skip Forward" });
|
|
7191
7191
|
}, kl = ({ className: e }) => {
|
|
7192
|
-
const { isLoopEnabled: t, loopStart: n, loopEnd: r } = Xe(), { setLoopEnabled: a, setLoopRegion: s } = ve(), { duration: o } =
|
|
7192
|
+
const { isLoopEnabled: t, loopStart: n, loopEnd: r } = Xe(), { setLoopEnabled: a, setLoopRegion: s } = ve(), { duration: o } = Te(), i = n !== r && r > n;
|
|
7193
7193
|
return /* @__PURE__ */ C(
|
|
7194
7194
|
Ye,
|
|
7195
7195
|
{
|
|
@@ -7220,13 +7220,13 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7220
7220
|
}
|
|
7221
7221
|
);
|
|
7222
7222
|
}, $l = ({ className: e, disabled: t }) => {
|
|
7223
|
-
const { zoomIn: n } = ve(), { canZoomIn: r } =
|
|
7224
|
-
return /* @__PURE__ */ C(Ye, {
|
|
7223
|
+
const { zoomIn: n } = ve(), { canZoomIn: r } = Te();
|
|
7224
|
+
return /* @__PURE__ */ C(Ye, { onClick: n, disabled: t || !r, className: e, children: "Zoom In" });
|
|
7225
7225
|
}, Ml = ({ className: e, disabled: t }) => {
|
|
7226
|
-
const { zoomOut: n } = ve(), { canZoomOut: r } =
|
|
7227
|
-
return /* @__PURE__ */ C(Ye, {
|
|
7226
|
+
const { zoomOut: n } = ve(), { canZoomOut: r } = Te();
|
|
7227
|
+
return /* @__PURE__ */ C(Ye, { onClick: n, disabled: t || !r, className: e, children: "Zoom Out" });
|
|
7228
7228
|
}, El = ({ className: e }) => {
|
|
7229
|
-
const { masterVolume: t } =
|
|
7229
|
+
const { masterVolume: t } = Te(), { setMasterVolume: n } = ve();
|
|
7230
7230
|
return /* @__PURE__ */ C(
|
|
7231
7231
|
co,
|
|
7232
7232
|
{
|
|
@@ -7236,7 +7236,7 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7236
7236
|
}
|
|
7237
7237
|
);
|
|
7238
7238
|
}, Dl = ({ className: e }) => {
|
|
7239
|
-
const { timeFormat: t } =
|
|
7239
|
+
const { timeFormat: t } = Te(), { setTimeFormat: n } = ve();
|
|
7240
7240
|
return /* @__PURE__ */ C(
|
|
7241
7241
|
Go,
|
|
7242
7242
|
{
|
|
@@ -7245,15 +7245,15 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7245
7245
|
className: e
|
|
7246
7246
|
}
|
|
7247
7247
|
);
|
|
7248
|
-
}, $i =
|
|
7248
|
+
}, $i = M.span`
|
|
7249
7249
|
font-family: 'Courier New', Monaco, monospace;
|
|
7250
7250
|
font-size: 1rem;
|
|
7251
7251
|
font-weight: 600;
|
|
7252
7252
|
color: ${(e) => e.theme?.textColor || "#333"};
|
|
7253
7253
|
user-select: none;
|
|
7254
7254
|
`, Tl = ({ className: e }) => {
|
|
7255
|
-
const t =
|
|
7256
|
-
return
|
|
7255
|
+
const t = R(null), n = R(null), { isPlaying: r, currentTimeRef: a, playbackStartTimeRef: s, audioStartPositionRef: o } = He(), { timeFormat: i } = Te(), l = i;
|
|
7256
|
+
return ee(() => {
|
|
7257
7257
|
const c = () => {
|
|
7258
7258
|
if (t.current) {
|
|
7259
7259
|
let u;
|
|
@@ -7269,7 +7269,7 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7269
7269
|
return r ? n.current = requestAnimationFrame(c) : c(), () => {
|
|
7270
7270
|
n.current && (cancelAnimationFrame(n.current), n.current = null);
|
|
7271
7271
|
};
|
|
7272
|
-
}, [r, l, a, s, o]),
|
|
7272
|
+
}, [r, l, a, s, o]), ee(() => {
|
|
7273
7273
|
!r && t.current && (t.current.textContent = bt(a.current ?? 0, l));
|
|
7274
7274
|
}), /* @__PURE__ */ C($i, { ref: t, className: e, "aria-label": "Audio position", children: bt(a.current ?? 0, l) });
|
|
7275
7275
|
}, Bl = ({ className: e }) => {
|
|
@@ -7349,7 +7349,7 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7349
7349
|
onExportComplete: c,
|
|
7350
7350
|
onExportError: u
|
|
7351
7351
|
}) => {
|
|
7352
|
-
const { tracks: g, trackStates: f } =
|
|
7352
|
+
const { tracks: g, trackStates: f } = Te(), { exportWav: d, isExporting: b, progress: v } = Ci(), p = async () => {
|
|
7353
7353
|
try {
|
|
7354
7354
|
const I = await d(g, f, {
|
|
7355
7355
|
filename: t,
|
|
@@ -7375,12 +7375,15 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7375
7375
|
children: h
|
|
7376
7376
|
}
|
|
7377
7377
|
);
|
|
7378
|
-
}, Mi =
|
|
7378
|
+
}, Mi = M.div.attrs((e) => ({
|
|
7379
|
+
style: {
|
|
7380
|
+
width: `${e.$width}px`,
|
|
7381
|
+
background: e.$color
|
|
7382
|
+
}
|
|
7383
|
+
}))`
|
|
7379
7384
|
position: absolute;
|
|
7380
7385
|
top: 0;
|
|
7381
7386
|
left: 0;
|
|
7382
|
-
width: ${(e) => e.$width}px;
|
|
7383
|
-
background: ${(e) => e.$color};
|
|
7384
7387
|
height: 100%;
|
|
7385
7388
|
z-index: 100; /* Below sticky controls (z-index: 101) so playhead is hidden when scrolled behind controls */
|
|
7386
7389
|
pointer-events: none;
|
|
@@ -7389,8 +7392,8 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7389
7392
|
color: e = "#ff0000",
|
|
7390
7393
|
controlsOffset: t = 0
|
|
7391
7394
|
}) => {
|
|
7392
|
-
const n =
|
|
7393
|
-
return
|
|
7395
|
+
const n = R(null), r = R(null), { isPlaying: a, currentTimeRef: s, playbackStartTimeRef: o, audioStartPositionRef: i } = He(), { samplesPerPixel: l, sampleRate: c, progressBarWidth: u } = Te();
|
|
7396
|
+
return ee(() => {
|
|
7394
7397
|
const g = () => {
|
|
7395
7398
|
if (n.current) {
|
|
7396
7399
|
let f;
|
|
@@ -7407,36 +7410,42 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7407
7410
|
return a ? r.current = requestAnimationFrame(g) : g(), () => {
|
|
7408
7411
|
r.current && (cancelAnimationFrame(r.current), r.current = null);
|
|
7409
7412
|
};
|
|
7410
|
-
}, [a, c, l, t, s, o, i]),
|
|
7413
|
+
}, [a, c, l, t, s, o, i]), ee(() => {
|
|
7411
7414
|
if (!a && n.current) {
|
|
7412
7415
|
const f = (s.current ?? 0) * c / l + t;
|
|
7413
7416
|
n.current.style.transform = `translate3d(${f}px, 0, 0)`;
|
|
7414
7417
|
}
|
|
7415
7418
|
}), /* @__PURE__ */ C(Mi, { ref: n, $color: e, $width: u, "data-playhead": !0 });
|
|
7416
|
-
}, Di =
|
|
7419
|
+
}, Di = M.div`
|
|
7417
7420
|
position: relative;
|
|
7418
|
-
`, jt =
|
|
7421
|
+
`, jt = M.div.attrs((e) => ({
|
|
7422
|
+
style: {
|
|
7423
|
+
top: `${e.$top}px`,
|
|
7424
|
+
width: `${e.$width}px`,
|
|
7425
|
+
height: `${e.$height}px`,
|
|
7426
|
+
background: e.$color
|
|
7427
|
+
}
|
|
7428
|
+
}))`
|
|
7419
7429
|
position: absolute;
|
|
7420
|
-
top: ${(e) => e.$top}px;
|
|
7421
7430
|
left: 0;
|
|
7422
|
-
width: ${(e) => e.$width}px;
|
|
7423
|
-
height: ${(e) => e.$height}px;
|
|
7424
|
-
background: ${(e) => e.$color};
|
|
7425
7431
|
z-index: 0;
|
|
7426
7432
|
/* Force GPU compositing layer to prevent gradient flickering during scroll */
|
|
7427
7433
|
transform: translateZ(0);
|
|
7428
7434
|
backface-visibility: hidden;
|
|
7429
7435
|
will-change: transform;
|
|
7430
|
-
`, Ti =
|
|
7436
|
+
`, Ti = M.div.attrs((e) => ({
|
|
7437
|
+
style: {
|
|
7438
|
+
top: `${e.$top}px`,
|
|
7439
|
+
height: `${e.$height}px`,
|
|
7440
|
+
background: e.$color
|
|
7441
|
+
}
|
|
7442
|
+
}))`
|
|
7431
7443
|
position: absolute;
|
|
7432
|
-
top: ${(e) => e.$top}px;
|
|
7433
7444
|
left: 0;
|
|
7434
|
-
height: ${(e) => e.$height}px;
|
|
7435
|
-
background: ${(e) => e.$color};
|
|
7436
7445
|
pointer-events: none;
|
|
7437
7446
|
z-index: 1;
|
|
7438
7447
|
will-change: width;
|
|
7439
|
-
`, Bi =
|
|
7448
|
+
`, Bi = M.div`
|
|
7440
7449
|
position: relative;
|
|
7441
7450
|
z-index: 2;
|
|
7442
7451
|
`, Pn = ({
|
|
@@ -7444,54 +7453,54 @@ const Mr = Ee(null), Er = Ee(null), Dr = Ee(null), Tr = Ee(null), bl = ({
|
|
|
7444
7453
|
clipDurationSamples: t,
|
|
7445
7454
|
...n
|
|
7446
7455
|
}) => {
|
|
7447
|
-
const r =
|
|
7448
|
-
|
|
7456
|
+
const r = R(null), a = R(null), s = $t(), { waveHeight: o } = St(), { isPlaying: i, currentTimeRef: l, playbackStartTimeRef: c, audioStartPositionRef: u } = He(), { samplesPerPixel: g, sampleRate: f } = Te(), d = s?.waveProgressColor || "rgba(0, 0, 0, 0.1)";
|
|
7457
|
+
ee(() => {
|
|
7449
7458
|
const k = () => {
|
|
7450
7459
|
if (r.current) {
|
|
7451
7460
|
let A;
|
|
7452
7461
|
if (i) {
|
|
7453
|
-
const
|
|
7454
|
-
A = (u.current ?? 0) +
|
|
7462
|
+
const _ = Me().currentTime - (c.current ?? 0);
|
|
7463
|
+
A = (u.current ?? 0) + _;
|
|
7455
7464
|
} else
|
|
7456
7465
|
A = l.current ?? 0;
|
|
7457
|
-
const E = A * f,
|
|
7458
|
-
let
|
|
7466
|
+
const E = A * f, S = e + t;
|
|
7467
|
+
let $ = 0;
|
|
7459
7468
|
if (E <= e)
|
|
7460
|
-
|
|
7461
|
-
else if (E >=
|
|
7462
|
-
|
|
7469
|
+
$ = 0;
|
|
7470
|
+
else if (E >= S)
|
|
7471
|
+
$ = n.length;
|
|
7463
7472
|
else {
|
|
7464
|
-
const
|
|
7465
|
-
|
|
7473
|
+
const _ = E - e;
|
|
7474
|
+
$ = Math.floor(_ / g);
|
|
7466
7475
|
}
|
|
7467
|
-
r.current.style.width = `${
|
|
7476
|
+
r.current.style.width = `${$}px`;
|
|
7468
7477
|
}
|
|
7469
7478
|
i && (a.current = requestAnimationFrame(k));
|
|
7470
7479
|
};
|
|
7471
7480
|
return i ? a.current = requestAnimationFrame(k) : k(), () => {
|
|
7472
7481
|
a.current && (cancelAnimationFrame(a.current), a.current = null);
|
|
7473
7482
|
};
|
|
7474
|
-
}, [i, f, g, e, t, n.length, l, c, u]),
|
|
7483
|
+
}, [i, f, g, e, t, n.length, l, c, u]), ee(() => {
|
|
7475
7484
|
if (!i && r.current) {
|
|
7476
7485
|
const A = (l.current ?? 0) * f, E = e + t;
|
|
7477
|
-
let
|
|
7486
|
+
let S = 0;
|
|
7478
7487
|
if (A <= e)
|
|
7479
|
-
|
|
7488
|
+
S = 0;
|
|
7480
7489
|
else if (A >= E)
|
|
7481
|
-
|
|
7490
|
+
S = n.length;
|
|
7482
7491
|
else {
|
|
7483
|
-
const
|
|
7484
|
-
|
|
7492
|
+
const $ = A - e;
|
|
7493
|
+
S = Math.floor($ / g);
|
|
7485
7494
|
}
|
|
7486
|
-
r.current.style.width = `${
|
|
7495
|
+
r.current.style.width = `${S}px`;
|
|
7487
7496
|
}
|
|
7488
7497
|
});
|
|
7489
7498
|
const b = s?.waveformDrawMode || "inverted";
|
|
7490
7499
|
let v;
|
|
7491
7500
|
b === "inverted" ? v = n.isSelected && s ? s.selectedWaveFillColor : s?.waveFillColor || "white" : v = n.isSelected && s ? s.selectedWaveOutlineColor : s?.waveOutlineColor || "grey";
|
|
7492
|
-
const p = n.renderMode === "spectrogram" || n.renderMode === "both", h = n.renderMode === "both", I = p ? "#000" :
|
|
7493
|
-
return /* @__PURE__ */
|
|
7494
|
-
h ? /* @__PURE__ */
|
|
7501
|
+
const p = n.renderMode === "spectrogram" || n.renderMode === "both", h = n.renderMode === "both", I = p ? "#000" : lt(v), w = Math.floor(o / 2), m = o, y = n.index * o, x = lt(v);
|
|
7502
|
+
return /* @__PURE__ */ te(Di, { children: [
|
|
7503
|
+
h ? /* @__PURE__ */ te(qe, { children: [
|
|
7495
7504
|
/* @__PURE__ */ C(
|
|
7496
7505
|
jt,
|
|
7497
7506
|
{
|
|
@@ -7558,161 +7567,161 @@ const Wi = 60, Fi = ({
|
|
|
7558
7567
|
continuousPlay: k,
|
|
7559
7568
|
selectedTrackId: A,
|
|
7560
7569
|
loopStart: E,
|
|
7561
|
-
loopEnd:
|
|
7562
|
-
isLoopEnabled:
|
|
7570
|
+
loopEnd: S,
|
|
7571
|
+
isLoopEnabled: $
|
|
7563
7572
|
} = Xe(), {
|
|
7564
|
-
setAnnotations:
|
|
7573
|
+
setAnnotations: _,
|
|
7565
7574
|
setActiveAnnotationId: B,
|
|
7566
7575
|
setTrackMute: P,
|
|
7567
|
-
setTrackSolo:
|
|
7576
|
+
setTrackSolo: H,
|
|
7568
7577
|
setTrackVolume: K,
|
|
7569
|
-
setTrackPan:
|
|
7570
|
-
setSelection:
|
|
7571
|
-
play:
|
|
7572
|
-
setScrollContainer:
|
|
7573
|
-
setSelectedTrackId:
|
|
7578
|
+
setTrackPan: X,
|
|
7579
|
+
setSelection: U,
|
|
7580
|
+
play: W,
|
|
7581
|
+
setScrollContainer: Y,
|
|
7582
|
+
setSelectedTrackId: j,
|
|
7574
7583
|
setCurrentTime: ue,
|
|
7575
7584
|
setLoopRegion: ae
|
|
7576
7585
|
} = ve(), {
|
|
7577
|
-
audioBuffers:
|
|
7586
|
+
audioBuffers: se,
|
|
7578
7587
|
peaksDataArray: de,
|
|
7579
|
-
trackStates:
|
|
7588
|
+
trackStates: Oe,
|
|
7580
7589
|
tracks: z,
|
|
7581
|
-
duration:
|
|
7582
|
-
samplesPerPixel:
|
|
7583
|
-
sampleRate:
|
|
7584
|
-
waveHeight:
|
|
7590
|
+
duration: me,
|
|
7591
|
+
samplesPerPixel: ie,
|
|
7592
|
+
sampleRate: G,
|
|
7593
|
+
waveHeight: he,
|
|
7585
7594
|
timeScaleHeight: pe,
|
|
7586
7595
|
controls: le,
|
|
7587
|
-
playoutRef:
|
|
7588
|
-
barWidth:
|
|
7589
|
-
barGap:
|
|
7590
|
-
isReady:
|
|
7591
|
-
} =
|
|
7592
|
-
if (!
|
|
7593
|
-
const
|
|
7594
|
-
return z.forEach((
|
|
7595
|
-
if ((
|
|
7596
|
-
const ge =
|
|
7597
|
-
|
|
7598
|
-
colorLUT:
|
|
7599
|
-
frequencyScaleFn:
|
|
7600
|
-
config:
|
|
7596
|
+
playoutRef: Fe,
|
|
7597
|
+
barWidth: _e,
|
|
7598
|
+
barGap: Ke,
|
|
7599
|
+
isReady: Ue
|
|
7600
|
+
} = Te(), oe = Ri(), Qe = Je(() => {
|
|
7601
|
+
if (!oe) return /* @__PURE__ */ new Map();
|
|
7602
|
+
const L = /* @__PURE__ */ new Map();
|
|
7603
|
+
return z.forEach((J) => {
|
|
7604
|
+
if ((oe.trackSpectrogramOverrides.get(J.id)?.renderMode ?? J.renderMode ?? "waveform") === "waveform") return;
|
|
7605
|
+
const ge = oe.trackSpectrogramOverrides.get(J.id), ye = ge?.colorMap ?? J.spectrogramColorMap ?? oe.spectrogramColorMap ?? "viridis", Re = ge?.config ?? J.spectrogramConfig ?? oe.spectrogramConfig;
|
|
7606
|
+
L.set(J.id, {
|
|
7607
|
+
colorLUT: oe.getColorMap(ye),
|
|
7608
|
+
frequencyScaleFn: oe.getFrequencyScale(Re?.frequencyScale ?? "mel"),
|
|
7609
|
+
config: Re
|
|
7601
7610
|
});
|
|
7602
|
-
}),
|
|
7603
|
-
}, [z,
|
|
7604
|
-
if (
|
|
7611
|
+
}), L;
|
|
7612
|
+
}, [z, oe]), rt = Je(() => {
|
|
7613
|
+
if (oe?.spectrogramWorkerApi)
|
|
7605
7614
|
return {
|
|
7606
|
-
registerCanvas:
|
|
7607
|
-
unregisterCanvas:
|
|
7615
|
+
registerCanvas: oe.spectrogramWorkerApi.registerCanvas.bind(oe.spectrogramWorkerApi),
|
|
7616
|
+
unregisterCanvas: oe.spectrogramWorkerApi.unregisterCanvas.bind(oe.spectrogramWorkerApi)
|
|
7608
7617
|
};
|
|
7609
|
-
}, [
|
|
7610
|
-
ft.current =
|
|
7611
|
-
}, [
|
|
7612
|
-
let ce =
|
|
7618
|
+
}, [oe?.spectrogramWorkerApi]), [V, Ze] = Z(null), [be, we] = Z(!1), ft = R(null), O = D((L) => {
|
|
7619
|
+
ft.current = L, Y(L);
|
|
7620
|
+
}, [Y]);
|
|
7621
|
+
let ce = se.length > 0 ? me : Wi;
|
|
7613
7622
|
if (g?.isRecording) {
|
|
7614
|
-
const
|
|
7615
|
-
ce = Math.max(ce,
|
|
7623
|
+
const J = (g.startSample + g.durationSamples) / G;
|
|
7624
|
+
ce = Math.max(ce, J + 10);
|
|
7616
7625
|
}
|
|
7617
|
-
const Ce = Math.floor(ce *
|
|
7618
|
-
B(
|
|
7619
|
-
const
|
|
7626
|
+
const Ce = Math.floor(ce * G / ie), Ie = async (L) => {
|
|
7627
|
+
B(L.id);
|
|
7628
|
+
const J = k ? void 0 : L.end - L.start;
|
|
7620
7629
|
try {
|
|
7621
|
-
await
|
|
7622
|
-
} catch (
|
|
7623
|
-
console.error("waveform-playlist: Failed to start playback for annotation",
|
|
7630
|
+
await W(L.start, J);
|
|
7631
|
+
} catch (re) {
|
|
7632
|
+
console.error("waveform-playlist: Failed to start playback for annotation", L.id, re);
|
|
7624
7633
|
}
|
|
7625
|
-
},
|
|
7626
|
-
if (
|
|
7627
|
-
const
|
|
7628
|
-
J
|
|
7634
|
+
}, Be = D((L) => {
|
|
7635
|
+
if (L >= 0 && L < z.length) {
|
|
7636
|
+
const J = z[L];
|
|
7637
|
+
j(J.id);
|
|
7629
7638
|
}
|
|
7630
|
-
}, [z,
|
|
7631
|
-
const
|
|
7632
|
-
let Le = 0,
|
|
7639
|
+
}, [z, j]), at = (L) => {
|
|
7640
|
+
const J = L.currentTarget.getBoundingClientRect(), re = le.show ? le.width : 0, ye = (L.clientX - J.left - re) * ie / G, et = L.clientY - J.top;
|
|
7641
|
+
let Le = 0, ne = -1;
|
|
7633
7642
|
for (let Ae = 0; Ae < de.length; Ae++) {
|
|
7634
|
-
const
|
|
7635
|
-
if (
|
|
7636
|
-
|
|
7643
|
+
const ot = de[Ae], ht = ot.length > 0 ? Math.max(...ot.map((wt) => wt.peaks.data.length)) : 1, Ge = ((oe?.trackSpectrogramOverrides.get(z[Ae]?.id)?.renderMode ?? z[Ae]?.renderMode ?? "waveform") === "both" ? ht * 2 : ht) * he + (o ? 22 : 0);
|
|
7644
|
+
if (et >= Le && et < Le + Ge) {
|
|
7645
|
+
ne = Ae;
|
|
7637
7646
|
break;
|
|
7638
7647
|
}
|
|
7639
7648
|
Le += Ge;
|
|
7640
7649
|
}
|
|
7641
|
-
|
|
7642
|
-
},
|
|
7650
|
+
ne !== -1 && Be(ne), we(!0), ue(ye), U(ye, ye);
|
|
7651
|
+
}, tt = (L) => {
|
|
7643
7652
|
if (!be) return;
|
|
7644
|
-
const
|
|
7645
|
-
|
|
7646
|
-
}, ct = (
|
|
7653
|
+
const J = L.currentTarget.getBoundingClientRect(), re = le.show ? le.width : 0, ye = (L.clientX - J.left - re) * ie / G, Re = Math.min(h, ye), et = Math.max(h, ye);
|
|
7654
|
+
U(Re, et);
|
|
7655
|
+
}, ct = (L) => {
|
|
7647
7656
|
if (!be) return;
|
|
7648
7657
|
we(!1);
|
|
7649
|
-
const
|
|
7650
|
-
Math.abs(
|
|
7658
|
+
const J = L.currentTarget.getBoundingClientRect(), re = le.show ? le.width : 0, ye = (L.clientX - J.left - re) * ie / G, Re = Math.min(h, ye), et = Math.max(h, ye);
|
|
7659
|
+
Math.abs(et - Re) < 0.1 ? (ue(Re), d && Fe.current ? (Fe.current.stop(), W(Re)) : Fe.current && Fe.current.stop()) : U(Re, et);
|
|
7651
7660
|
};
|
|
7652
|
-
return z.some((
|
|
7661
|
+
return z.some((L) => L.clips.length > 0) && (se.length === 0 || de.length === 0) ? /* @__PURE__ */ C("div", { className: s, children: "Loading waveform..." }) : /* @__PURE__ */ te(cr, { children: [
|
|
7653
7662
|
/* @__PURE__ */ C(
|
|
7654
7663
|
kt.Provider,
|
|
7655
7664
|
{
|
|
7656
7665
|
value: {
|
|
7657
|
-
samplesPerPixel:
|
|
7658
|
-
sampleRate:
|
|
7659
|
-
zoomLevels: [
|
|
7660
|
-
waveHeight:
|
|
7666
|
+
samplesPerPixel: ie,
|
|
7667
|
+
sampleRate: G,
|
|
7668
|
+
zoomLevels: [ie],
|
|
7669
|
+
waveHeight: he,
|
|
7661
7670
|
timeScaleHeight: pe,
|
|
7662
7671
|
duration: ce * 1e3,
|
|
7663
7672
|
controls: le,
|
|
7664
|
-
barWidth:
|
|
7665
|
-
barGap:
|
|
7673
|
+
barWidth: _e,
|
|
7674
|
+
barGap: Ke
|
|
7666
7675
|
},
|
|
7667
7676
|
children: /* @__PURE__ */ C(
|
|
7668
7677
|
an,
|
|
7669
7678
|
{
|
|
7670
7679
|
theme: f,
|
|
7671
|
-
backgroundColor:
|
|
7680
|
+
backgroundColor: lt(f.waveOutlineColor),
|
|
7672
7681
|
timescaleBackgroundColor: f.timescaleBackgroundColor,
|
|
7673
7682
|
scrollContainerWidth: Ce + (le.show ? le.width : 0),
|
|
7674
7683
|
timescaleWidth: Ce,
|
|
7675
7684
|
tracksWidth: Ce,
|
|
7676
7685
|
controlsWidth: le.show ? le.width : 0,
|
|
7677
|
-
onTracksMouseDown:
|
|
7678
|
-
onTracksMouseMove:
|
|
7686
|
+
onTracksMouseDown: at,
|
|
7687
|
+
onTracksMouseMove: tt,
|
|
7679
7688
|
onTracksMouseUp: ct,
|
|
7680
|
-
scrollContainerRef:
|
|
7689
|
+
scrollContainerRef: O,
|
|
7681
7690
|
isSelecting: be,
|
|
7682
|
-
"data-playlist-state":
|
|
7683
|
-
timescale: pe > 0 ? /* @__PURE__ */
|
|
7691
|
+
"data-playlist-state": Ue ? "ready" : "loading",
|
|
7692
|
+
timescale: pe > 0 ? /* @__PURE__ */ te(qe, { children: [
|
|
7684
7693
|
/* @__PURE__ */ C(dr, { renderTimestamp: t }),
|
|
7685
|
-
|
|
7694
|
+
$ && /* @__PURE__ */ C(
|
|
7686
7695
|
yo,
|
|
7687
7696
|
{
|
|
7688
|
-
startPosition: Math.min(E,
|
|
7689
|
-
endPosition: Math.max(E,
|
|
7697
|
+
startPosition: Math.min(E, S) * G / ie,
|
|
7698
|
+
endPosition: Math.max(E, S) * G / ie,
|
|
7690
7699
|
markerColor: f.loopMarkerColor,
|
|
7691
7700
|
regionColor: f.loopRegionColor,
|
|
7692
7701
|
minPosition: 0,
|
|
7693
7702
|
maxPosition: Ce,
|
|
7694
7703
|
controlsOffset: le.show ? le.width : 0,
|
|
7695
|
-
onLoopRegionChange: (
|
|
7696
|
-
const
|
|
7697
|
-
ae(
|
|
7704
|
+
onLoopRegionChange: (L, J) => {
|
|
7705
|
+
const re = L * ie / G, ge = J * ie / G;
|
|
7706
|
+
ae(re, ge);
|
|
7698
7707
|
}
|
|
7699
7708
|
}
|
|
7700
7709
|
)
|
|
7701
7710
|
] }) : void 0,
|
|
7702
|
-
children: /* @__PURE__ */
|
|
7703
|
-
de.map((
|
|
7704
|
-
const
|
|
7705
|
-
if (!
|
|
7706
|
-
const ge =
|
|
7707
|
-
name: `Track ${
|
|
7711
|
+
children: /* @__PURE__ */ te(qe, { children: [
|
|
7712
|
+
de.map((L, J) => {
|
|
7713
|
+
const re = z[J];
|
|
7714
|
+
if (!re) return null;
|
|
7715
|
+
const ge = Oe[J] || {
|
|
7716
|
+
name: `Track ${J + 1}`,
|
|
7708
7717
|
muted: !1,
|
|
7709
7718
|
soloed: !1,
|
|
7710
7719
|
volume: 1,
|
|
7711
7720
|
pan: 0
|
|
7712
|
-
}, ye =
|
|
7713
|
-
/* @__PURE__ */
|
|
7714
|
-
u && /* @__PURE__ */ C(jo, { onClick: (
|
|
7715
|
-
|
|
7721
|
+
}, ye = oe?.trackSpectrogramOverrides.get(re.id)?.renderMode ?? re.renderMode ?? "waveform", Re = e ? e(J) : /* @__PURE__ */ te(Jo, { onClick: () => Be(J), children: [
|
|
7722
|
+
/* @__PURE__ */ te(qo, { style: { justifyContent: "center", position: "relative" }, children: [
|
|
7723
|
+
u && /* @__PURE__ */ C(jo, { onClick: (ne) => {
|
|
7724
|
+
ne.stopPropagation(), u(J);
|
|
7716
7725
|
} }),
|
|
7717
7726
|
/* @__PURE__ */ C("span", { style: {
|
|
7718
7727
|
overflow: "hidden",
|
|
@@ -7720,25 +7729,25 @@ const Wi = 60, Fi = ({
|
|
|
7720
7729
|
whiteSpace: "nowrap",
|
|
7721
7730
|
padding: "0 24px",
|
|
7722
7731
|
display: "block"
|
|
7723
|
-
}, children: ge.name || `Track ${
|
|
7724
|
-
|
|
7732
|
+
}, children: ge.name || `Track ${J + 1}` }),
|
|
7733
|
+
oe?.renderMenuItems && /* @__PURE__ */ C("span", { style: { position: "absolute", right: 0, top: 0 }, children: /* @__PURE__ */ C(
|
|
7725
7734
|
ss,
|
|
7726
7735
|
{
|
|
7727
|
-
items: (
|
|
7736
|
+
items: (ne) => oe.renderMenuItems({
|
|
7728
7737
|
renderMode: ye,
|
|
7729
|
-
onRenderModeChange: (Ae) =>
|
|
7730
|
-
onOpenSettings: () => Ze(
|
|
7731
|
-
onClose:
|
|
7738
|
+
onRenderModeChange: (Ae) => oe.setTrackRenderMode(re.id, Ae),
|
|
7739
|
+
onOpenSettings: () => Ze(re.id),
|
|
7740
|
+
onClose: ne
|
|
7732
7741
|
})
|
|
7733
7742
|
}
|
|
7734
7743
|
) })
|
|
7735
7744
|
] }),
|
|
7736
|
-
/* @__PURE__ */
|
|
7745
|
+
/* @__PURE__ */ te(Ko, { children: [
|
|
7737
7746
|
/* @__PURE__ */ C(
|
|
7738
7747
|
En,
|
|
7739
7748
|
{
|
|
7740
7749
|
$variant: ge.muted ? "danger" : "outline",
|
|
7741
|
-
onClick: () => P(
|
|
7750
|
+
onClick: () => P(J, !ge.muted),
|
|
7742
7751
|
children: "Mute"
|
|
7743
7752
|
}
|
|
7744
7753
|
),
|
|
@@ -7746,12 +7755,12 @@ const Wi = 60, Fi = ({
|
|
|
7746
7755
|
En,
|
|
7747
7756
|
{
|
|
7748
7757
|
$variant: ge.soloed ? "info" : "outline",
|
|
7749
|
-
onClick: () =>
|
|
7758
|
+
onClick: () => H(J, !ge.soloed),
|
|
7750
7759
|
children: "Solo"
|
|
7751
7760
|
}
|
|
7752
7761
|
)
|
|
7753
7762
|
] }),
|
|
7754
|
-
/* @__PURE__ */
|
|
7763
|
+
/* @__PURE__ */ te(Tn, { children: [
|
|
7755
7764
|
/* @__PURE__ */ C(Qo, {}),
|
|
7756
7765
|
/* @__PURE__ */ C(
|
|
7757
7766
|
Dn,
|
|
@@ -7760,12 +7769,12 @@ const Wi = 60, Fi = ({
|
|
|
7760
7769
|
max: "1",
|
|
7761
7770
|
step: "0.01",
|
|
7762
7771
|
value: ge.volume,
|
|
7763
|
-
onChange: (
|
|
7772
|
+
onChange: (ne) => K(J, parseFloat(ne.target.value))
|
|
7764
7773
|
}
|
|
7765
7774
|
),
|
|
7766
7775
|
/* @__PURE__ */ C(es, {})
|
|
7767
7776
|
] }),
|
|
7768
|
-
/* @__PURE__ */
|
|
7777
|
+
/* @__PURE__ */ te(Tn, { children: [
|
|
7769
7778
|
/* @__PURE__ */ C("span", { children: "L" }),
|
|
7770
7779
|
/* @__PURE__ */ C(
|
|
7771
7780
|
Dn,
|
|
@@ -7774,33 +7783,33 @@ const Wi = 60, Fi = ({
|
|
|
7774
7783
|
max: "1",
|
|
7775
7784
|
step: "0.01",
|
|
7776
7785
|
value: ge.pan,
|
|
7777
|
-
onChange: (
|
|
7786
|
+
onChange: (ne) => X(J, parseFloat(ne.target.value))
|
|
7778
7787
|
}
|
|
7779
7788
|
),
|
|
7780
7789
|
/* @__PURE__ */ C("span", { children: "R" })
|
|
7781
7790
|
] })
|
|
7782
|
-
] }), Le =
|
|
7783
|
-
return /* @__PURE__ */ C(sn.Provider, { value:
|
|
7791
|
+
] }), Le = L.length > 0 ? Math.max(...L.map((ne) => ne.peaks.data.length)) : 1;
|
|
7792
|
+
return /* @__PURE__ */ C(sn.Provider, { value: Re, children: /* @__PURE__ */ te(
|
|
7784
7793
|
mr,
|
|
7785
7794
|
{
|
|
7786
7795
|
numChannels: Le,
|
|
7787
|
-
backgroundColor:
|
|
7796
|
+
backgroundColor: lt(f.waveOutlineColor),
|
|
7788
7797
|
offset: 0,
|
|
7789
7798
|
width: Ce,
|
|
7790
7799
|
hasClipHeaders: o,
|
|
7791
|
-
trackId:
|
|
7792
|
-
isSelected:
|
|
7800
|
+
trackId: re.id,
|
|
7801
|
+
isSelected: re.id === A,
|
|
7793
7802
|
children: [
|
|
7794
7803
|
ye !== "waveform" && (() => {
|
|
7795
|
-
const
|
|
7796
|
-
return !Ae?.labels || !
|
|
7804
|
+
const ne = Qe.get(re.id), Ae = ne?.config;
|
|
7805
|
+
return !Ae?.labels || !ne ? null : /* @__PURE__ */ C(
|
|
7797
7806
|
Ro,
|
|
7798
7807
|
{
|
|
7799
|
-
waveHeight:
|
|
7808
|
+
waveHeight: he,
|
|
7800
7809
|
numChannels: Le,
|
|
7801
|
-
frequencyScaleFn:
|
|
7810
|
+
frequencyScaleFn: ne.frequencyScaleFn,
|
|
7802
7811
|
minFrequency: Ae.minFrequency ?? 0,
|
|
7803
|
-
maxFrequency: Ae.maxFrequency ??
|
|
7812
|
+
maxFrequency: Ae.maxFrequency ?? G / 2,
|
|
7804
7813
|
labelsColor: Ae.labelsColor,
|
|
7805
7814
|
labelsBackground: Ae.labelsBackground,
|
|
7806
7815
|
renderMode: ye,
|
|
@@ -7808,76 +7817,76 @@ const Wi = 60, Fi = ({
|
|
|
7808
7817
|
}
|
|
7809
7818
|
);
|
|
7810
7819
|
})(),
|
|
7811
|
-
|
|
7812
|
-
const
|
|
7820
|
+
L.map((ne, Ae) => {
|
|
7821
|
+
const ot = ne.peaks, ht = ot.length;
|
|
7813
7822
|
return /* @__PURE__ */ C(
|
|
7814
7823
|
qt,
|
|
7815
7824
|
{
|
|
7816
|
-
clipId:
|
|
7817
|
-
trackIndex:
|
|
7825
|
+
clipId: ne.clipId,
|
|
7826
|
+
trackIndex: J,
|
|
7818
7827
|
clipIndex: Ae,
|
|
7819
|
-
trackName:
|
|
7820
|
-
startSample:
|
|
7821
|
-
durationSamples:
|
|
7822
|
-
samplesPerPixel:
|
|
7828
|
+
trackName: ne.trackName,
|
|
7829
|
+
startSample: ne.startSample,
|
|
7830
|
+
durationSamples: ne.durationSamples,
|
|
7831
|
+
samplesPerPixel: ie,
|
|
7823
7832
|
showHeader: o,
|
|
7824
7833
|
disableHeaderDrag: !i,
|
|
7825
|
-
isSelected:
|
|
7826
|
-
trackId:
|
|
7827
|
-
fadeIn:
|
|
7828
|
-
fadeOut:
|
|
7829
|
-
sampleRate:
|
|
7834
|
+
isSelected: re.id === A,
|
|
7835
|
+
trackId: re.id,
|
|
7836
|
+
fadeIn: ne.fadeIn,
|
|
7837
|
+
fadeOut: ne.fadeOut,
|
|
7838
|
+
sampleRate: G,
|
|
7830
7839
|
showFades: l,
|
|
7831
7840
|
touchOptimized: c,
|
|
7832
|
-
onMouseDown: (
|
|
7833
|
-
|
|
7841
|
+
onMouseDown: (je) => {
|
|
7842
|
+
je.target.closest('[role="button"][aria-roledescription="draggable"]') || Be(J);
|
|
7834
7843
|
},
|
|
7835
|
-
children:
|
|
7836
|
-
const Ge =
|
|
7844
|
+
children: ot.data.map((je, st) => {
|
|
7845
|
+
const Ge = oe?.spectrogramDataMap.get(ne.clipId), wt = Ge?.[st] ?? Ge?.[0], yt = Qe.get(re.id), ut = yt?.config;
|
|
7837
7846
|
return /* @__PURE__ */ C(
|
|
7838
7847
|
Pn,
|
|
7839
7848
|
{
|
|
7840
|
-
index:
|
|
7841
|
-
data:
|
|
7842
|
-
bits:
|
|
7849
|
+
index: st,
|
|
7850
|
+
data: je,
|
|
7851
|
+
bits: ot.bits,
|
|
7843
7852
|
length: ht,
|
|
7844
|
-
isSelected:
|
|
7845
|
-
clipStartSample:
|
|
7846
|
-
clipDurationSamples:
|
|
7853
|
+
isSelected: re.id === A,
|
|
7854
|
+
clipStartSample: ne.startSample,
|
|
7855
|
+
clipDurationSamples: ne.durationSamples,
|
|
7847
7856
|
renderMode: ye,
|
|
7848
7857
|
spectrogramData: wt,
|
|
7849
|
-
samplesPerPixel:
|
|
7858
|
+
samplesPerPixel: ie,
|
|
7850
7859
|
spectrogramColorLUT: yt?.colorLUT,
|
|
7851
7860
|
spectrogramFrequencyScaleFn: yt?.frequencyScaleFn,
|
|
7852
7861
|
spectrogramMinFrequency: ut?.minFrequency,
|
|
7853
7862
|
spectrogramMaxFrequency: ut?.maxFrequency,
|
|
7854
|
-
spectrogramWorkerApi:
|
|
7855
|
-
spectrogramClipId:
|
|
7856
|
-
spectrogramOnCanvasesReady:
|
|
7857
|
-
|
|
7863
|
+
spectrogramWorkerApi: rt,
|
|
7864
|
+
spectrogramClipId: ne.clipId,
|
|
7865
|
+
spectrogramOnCanvasesReady: oe ? (nt, Ve) => {
|
|
7866
|
+
oe.registerSpectrogramCanvases(ne.clipId, st, nt, Ve);
|
|
7858
7867
|
} : void 0
|
|
7859
7868
|
},
|
|
7860
|
-
`${
|
|
7869
|
+
`${ne.clipId}-${st}`
|
|
7861
7870
|
);
|
|
7862
7871
|
})
|
|
7863
7872
|
},
|
|
7864
|
-
|
|
7873
|
+
ne.clipId
|
|
7865
7874
|
);
|
|
7866
7875
|
}),
|
|
7867
|
-
g?.isRecording && g.trackId ===
|
|
7876
|
+
g?.isRecording && g.trackId === re.id && g.peaks.length > 0 && /* @__PURE__ */ C(
|
|
7868
7877
|
qt,
|
|
7869
7878
|
{
|
|
7870
7879
|
clipId: "recording-preview",
|
|
7871
|
-
trackIndex:
|
|
7872
|
-
clipIndex:
|
|
7880
|
+
trackIndex: J,
|
|
7881
|
+
clipIndex: L.length,
|
|
7873
7882
|
trackName: "Recording...",
|
|
7874
7883
|
startSample: g.startSample,
|
|
7875
7884
|
durationSamples: g.durationSamples,
|
|
7876
|
-
samplesPerPixel:
|
|
7885
|
+
samplesPerPixel: ie,
|
|
7877
7886
|
showHeader: o,
|
|
7878
7887
|
disableHeaderDrag: !0,
|
|
7879
|
-
isSelected:
|
|
7880
|
-
trackId:
|
|
7888
|
+
isSelected: re.id === A,
|
|
7889
|
+
trackId: re.id,
|
|
7881
7890
|
children: /* @__PURE__ */ C(
|
|
7882
7891
|
Pn,
|
|
7883
7892
|
{
|
|
@@ -7885,54 +7894,54 @@ const Wi = 60, Fi = ({
|
|
|
7885
7894
|
data: g.peaks,
|
|
7886
7895
|
bits: 16,
|
|
7887
7896
|
length: Math.floor(g.peaks.length / 2),
|
|
7888
|
-
isSelected:
|
|
7897
|
+
isSelected: re.id === A,
|
|
7889
7898
|
clipStartSample: g.startSample,
|
|
7890
7899
|
clipDurationSamples: g.durationSamples
|
|
7891
7900
|
},
|
|
7892
|
-
`${
|
|
7901
|
+
`${re.id}-recording-0`
|
|
7893
7902
|
)
|
|
7894
7903
|
},
|
|
7895
|
-
`${
|
|
7904
|
+
`${re.id}-recording`
|
|
7896
7905
|
)
|
|
7897
7906
|
]
|
|
7898
7907
|
}
|
|
7899
|
-
) },
|
|
7908
|
+
) }, re.id);
|
|
7900
7909
|
}),
|
|
7901
|
-
w.length > 0 && /* @__PURE__ */ C(wr, { height: 30, width: Ce, children: w.map((
|
|
7902
|
-
const
|
|
7910
|
+
w.length > 0 && /* @__PURE__ */ C(wr, { height: 30, width: Ce, children: w.map((L, J) => {
|
|
7911
|
+
const re = L.start * G / ie, ge = L.end * G / ie, ye = a ? a(L, J) : L.id;
|
|
7903
7912
|
return /* @__PURE__ */ C(
|
|
7904
7913
|
vr,
|
|
7905
7914
|
{
|
|
7906
|
-
annotationId:
|
|
7907
|
-
annotationIndex:
|
|
7908
|
-
startPosition:
|
|
7915
|
+
annotationId: L.id,
|
|
7916
|
+
annotationIndex: J,
|
|
7917
|
+
startPosition: re,
|
|
7909
7918
|
endPosition: ge,
|
|
7910
7919
|
label: ye,
|
|
7911
7920
|
color: "#ff9800",
|
|
7912
|
-
isActive:
|
|
7913
|
-
onClick: () => Ie(
|
|
7921
|
+
isActive: L.id === m,
|
|
7922
|
+
onClick: () => Ie(L),
|
|
7914
7923
|
editable: y
|
|
7915
7924
|
},
|
|
7916
|
-
|
|
7925
|
+
L.id
|
|
7917
7926
|
);
|
|
7918
7927
|
}) }),
|
|
7919
7928
|
h !== I && /* @__PURE__ */ C(
|
|
7920
7929
|
sr,
|
|
7921
7930
|
{
|
|
7922
|
-
startPosition: Math.min(h, I) *
|
|
7923
|
-
endPosition: Math.max(h, I) *
|
|
7931
|
+
startPosition: Math.min(h, I) * G / ie + (le.show ? le.width : 0),
|
|
7932
|
+
endPosition: Math.max(h, I) * G / ie + (le.show ? le.width : 0),
|
|
7924
7933
|
color: f.selectionColor
|
|
7925
7934
|
}
|
|
7926
7935
|
),
|
|
7927
7936
|
(d || h === I) && (n ? n({
|
|
7928
|
-
position: (b.current ?? 0) *
|
|
7937
|
+
position: (b.current ?? 0) * G / ie + (le.show ? le.width : 0),
|
|
7929
7938
|
color: f.playheadColor,
|
|
7930
7939
|
isPlaying: d,
|
|
7931
7940
|
currentTimeRef: b,
|
|
7932
7941
|
playbackStartTimeRef: v,
|
|
7933
7942
|
audioStartPositionRef: p,
|
|
7934
|
-
samplesPerPixel:
|
|
7935
|
-
sampleRate:
|
|
7943
|
+
samplesPerPixel: ie,
|
|
7944
|
+
sampleRate: G,
|
|
7936
7945
|
controlsOffset: le.show ? le.width : 0,
|
|
7937
7946
|
getAudioContextTime: () => Me().currentTime
|
|
7938
7947
|
}) : /* @__PURE__ */ C(
|
|
@@ -7947,16 +7956,16 @@ const Wi = 60, Fi = ({
|
|
|
7947
7956
|
)
|
|
7948
7957
|
}
|
|
7949
7958
|
),
|
|
7950
|
-
|
|
7959
|
+
oe?.SettingsModal && typeof document < "u" && Yn(
|
|
7951
7960
|
/* @__PURE__ */ C(
|
|
7952
|
-
|
|
7961
|
+
oe.SettingsModal,
|
|
7953
7962
|
{
|
|
7954
7963
|
open: V !== null,
|
|
7955
7964
|
onClose: () => Ze(null),
|
|
7956
|
-
config: V !== null ?
|
|
7957
|
-
colorMap: V !== null ?
|
|
7958
|
-
onApply: (
|
|
7959
|
-
V !== null &&
|
|
7965
|
+
config: V !== null ? oe.trackSpectrogramOverrides.get(V)?.config ?? z.find((L) => L.id === V)?.spectrogramConfig ?? oe.spectrogramConfig ?? {} : {},
|
|
7966
|
+
colorMap: V !== null ? oe.trackSpectrogramOverrides.get(V)?.colorMap ?? z.find((L) => L.id === V)?.spectrogramColorMap ?? oe.spectrogramColorMap ?? "viridis" : "viridis",
|
|
7967
|
+
onApply: (L, J) => {
|
|
7968
|
+
V !== null && oe.setTrackSpectrogramConfig(V, L, J);
|
|
7960
7969
|
}
|
|
7961
7970
|
}
|
|
7962
7971
|
),
|
|
@@ -8017,7 +8026,7 @@ const Wi = 60, Fi = ({
|
|
|
8017
8026
|
recordingState: p
|
|
8018
8027
|
}) => {
|
|
8019
8028
|
const { annotations: h } = Xe();
|
|
8020
|
-
return /* @__PURE__ */
|
|
8029
|
+
return /* @__PURE__ */ te(qe, { children: [
|
|
8021
8030
|
/* @__PURE__ */ C(
|
|
8022
8031
|
Fi,
|
|
8023
8032
|
{
|
|
@@ -8047,7 +8056,7 @@ const Wi = 60, Fi = ({
|
|
|
8047
8056
|
}
|
|
8048
8057
|
)
|
|
8049
8058
|
] });
|
|
8050
|
-
}, Zi =
|
|
8059
|
+
}, Zi = M.div`
|
|
8051
8060
|
position: absolute;
|
|
8052
8061
|
top: 0;
|
|
8053
8062
|
left: 0;
|
|
@@ -8061,8 +8070,8 @@ const Wi = 60, Fi = ({
|
|
|
8061
8070
|
color: e = "#ff0000",
|
|
8062
8071
|
controlsOffset: t = 0
|
|
8063
8072
|
}) => {
|
|
8064
|
-
const n =
|
|
8065
|
-
return
|
|
8073
|
+
const n = R(null), r = R(null), { isPlaying: a, currentTimeRef: s } = ln(), { samplesPerPixel: o, sampleRate: i, progressBarWidth: l } = un();
|
|
8074
|
+
return ee(() => {
|
|
8066
8075
|
const c = () => {
|
|
8067
8076
|
if (n.current) {
|
|
8068
8077
|
const g = (s.current ?? 0) * i / o + t;
|
|
@@ -8073,15 +8082,15 @@ const Wi = 60, Fi = ({
|
|
|
8073
8082
|
return a ? r.current = requestAnimationFrame(c) : c(), () => {
|
|
8074
8083
|
r.current && (cancelAnimationFrame(r.current), r.current = null);
|
|
8075
8084
|
};
|
|
8076
|
-
}, [a, i, o, t, s]),
|
|
8085
|
+
}, [a, i, o, t, s]), ee(() => {
|
|
8077
8086
|
if (!a && n.current) {
|
|
8078
8087
|
const u = (s.current ?? 0) * i / o + t;
|
|
8079
8088
|
n.current.style.transform = `translate3d(${u}px, 0, 0)`;
|
|
8080
8089
|
}
|
|
8081
8090
|
}), /* @__PURE__ */ C(Zi, { ref: n, $color: e, $width: l, "data-playhead": !0 });
|
|
8082
|
-
}, Pi =
|
|
8091
|
+
}, Pi = M.div`
|
|
8083
8092
|
position: relative;
|
|
8084
|
-
`, zi =
|
|
8093
|
+
`, zi = M.div`
|
|
8085
8094
|
position: absolute;
|
|
8086
8095
|
top: ${(e) => e.$top}px;
|
|
8087
8096
|
left: 0;
|
|
@@ -8092,7 +8101,7 @@ const Wi = 60, Fi = ({
|
|
|
8092
8101
|
transform: translateZ(0);
|
|
8093
8102
|
backface-visibility: hidden;
|
|
8094
8103
|
will-change: transform;
|
|
8095
|
-
`, Hi =
|
|
8104
|
+
`, Hi = M.div`
|
|
8096
8105
|
position: absolute;
|
|
8097
8106
|
top: ${(e) => e.$top}px;
|
|
8098
8107
|
left: 0;
|
|
@@ -8101,7 +8110,7 @@ const Wi = 60, Fi = ({
|
|
|
8101
8110
|
pointer-events: none;
|
|
8102
8111
|
z-index: 1;
|
|
8103
8112
|
will-change: width;
|
|
8104
|
-
`, Xi =
|
|
8113
|
+
`, Xi = M.div`
|
|
8105
8114
|
position: relative;
|
|
8106
8115
|
z-index: 2;
|
|
8107
8116
|
`, Li = ({
|
|
@@ -8109,8 +8118,8 @@ const Wi = 60, Fi = ({
|
|
|
8109
8118
|
clipDurationSamples: t,
|
|
8110
8119
|
...n
|
|
8111
8120
|
}) => {
|
|
8112
|
-
const r =
|
|
8113
|
-
|
|
8121
|
+
const r = R(null), a = R(null), s = $t(), { waveHeight: o } = St(), { isPlaying: i, currentTimeRef: l } = ln(), { samplesPerPixel: c, sampleRate: u } = un(), g = s?.waveProgressColor || "rgba(0, 0, 0, 0.1)";
|
|
8122
|
+
ee(() => {
|
|
8114
8123
|
const v = () => {
|
|
8115
8124
|
if (r.current) {
|
|
8116
8125
|
const h = (l.current ?? 0) * u, I = e + t;
|
|
@@ -8130,7 +8139,7 @@ const Wi = 60, Fi = ({
|
|
|
8130
8139
|
return i ? a.current = requestAnimationFrame(v) : v(), () => {
|
|
8131
8140
|
a.current && (cancelAnimationFrame(a.current), a.current = null);
|
|
8132
8141
|
};
|
|
8133
|
-
}, [i, u, c, e, t, n.length, l]),
|
|
8142
|
+
}, [i, u, c, e, t, n.length, l]), ee(() => {
|
|
8134
8143
|
if (!i && r.current) {
|
|
8135
8144
|
const p = (l.current ?? 0) * u, h = e + t;
|
|
8136
8145
|
let I = 0;
|
|
@@ -8148,8 +8157,8 @@ const Wi = 60, Fi = ({
|
|
|
8148
8157
|
const f = s?.waveformDrawMode || "inverted";
|
|
8149
8158
|
let d;
|
|
8150
8159
|
f === "inverted" ? d = s?.selectedWaveFillColor || s?.waveFillColor || "white" : d = s?.selectedWaveOutlineColor || s?.waveOutlineColor || "grey";
|
|
8151
|
-
const b =
|
|
8152
|
-
return /* @__PURE__ */
|
|
8160
|
+
const b = lt(d);
|
|
8161
|
+
return /* @__PURE__ */ te(Pi, { children: [
|
|
8153
8162
|
/* @__PURE__ */ C(
|
|
8154
8163
|
zi,
|
|
8155
8164
|
{
|
|
@@ -8188,40 +8197,40 @@ const Wi = 60, Fi = ({
|
|
|
8188
8197
|
playoutRef: x,
|
|
8189
8198
|
barWidth: k,
|
|
8190
8199
|
barGap: A
|
|
8191
|
-
} = un(), [E,
|
|
8192
|
-
|
|
8193
|
-
}, [b]),
|
|
8200
|
+
} = un(), [E, S] = Z(0), [$, _] = Z(0), [B, P] = Z(!1), H = R(null), K = D((z) => {
|
|
8201
|
+
H.current = z, b(z);
|
|
8202
|
+
}, [b]), X = Math.floor(v * h / m), U = D(async (z) => {
|
|
8194
8203
|
f(z.id);
|
|
8195
8204
|
try {
|
|
8196
8205
|
await u(z.start);
|
|
8197
|
-
} catch (
|
|
8198
|
-
console.error("waveform-playlist: Failed to start playback for annotation", z.id,
|
|
8206
|
+
} catch (me) {
|
|
8207
|
+
console.error("waveform-playlist: Failed to start playback for annotation", z.id, me);
|
|
8199
8208
|
}
|
|
8200
|
-
}, [f, u]),
|
|
8209
|
+
}, [f, u]), W = D((z) => {
|
|
8201
8210
|
d(z), r?.(z);
|
|
8202
|
-
}, [d, r]), { onDragStart:
|
|
8211
|
+
}, [d, r]), { onDragStart: Y, onDragMove: j, onDragEnd: ue } = ni({
|
|
8203
8212
|
annotations: l,
|
|
8204
|
-
onAnnotationsChange:
|
|
8213
|
+
onAnnotationsChange: W,
|
|
8205
8214
|
samplesPerPixel: m,
|
|
8206
8215
|
sampleRate: h,
|
|
8207
8216
|
duration: v,
|
|
8208
8217
|
linkEndpoints: n
|
|
8209
8218
|
}), ae = D((z) => {
|
|
8210
|
-
const
|
|
8211
|
-
P(!0),
|
|
8212
|
-
}, [y, m, h]),
|
|
8219
|
+
const me = z.currentTarget.getBoundingClientRect(), ie = y.show ? y.width : 0, he = (z.clientX - me.left - ie) * m / h;
|
|
8220
|
+
P(!0), S(he), _(he);
|
|
8221
|
+
}, [y, m, h]), se = D((z) => {
|
|
8213
8222
|
if (!B) return;
|
|
8214
|
-
const
|
|
8215
|
-
|
|
8223
|
+
const me = z.currentTarget.getBoundingClientRect(), ie = y.show ? y.width : 0, he = (z.clientX - me.left - ie) * m / h;
|
|
8224
|
+
_(he);
|
|
8216
8225
|
}, [B, y, m, h]), de = D((z) => {
|
|
8217
8226
|
if (!B) return;
|
|
8218
8227
|
P(!1);
|
|
8219
|
-
const
|
|
8220
|
-
Math.abs(le - pe) < 0.1 ? (g(pe),
|
|
8228
|
+
const me = z.currentTarget.getBoundingClientRect(), ie = y.show ? y.width : 0, he = (z.clientX - me.left - ie) * m / h, pe = Math.min(E, he), le = Math.max(E, he);
|
|
8229
|
+
Math.abs(le - pe) < 0.1 ? (g(pe), S(pe), _(pe), o && x.current && (x.current.stop(), u(pe))) : (S(pe), _(le));
|
|
8221
8230
|
}, [B, E, m, h, y, g, o, x, u]);
|
|
8222
8231
|
if (p.length === 0)
|
|
8223
8232
|
return /* @__PURE__ */ C("div", { className: a, children: "Loading waveform..." });
|
|
8224
|
-
const
|
|
8233
|
+
const Oe = null;
|
|
8225
8234
|
return /* @__PURE__ */ C(cr, { children: /* @__PURE__ */ C(
|
|
8226
8235
|
kt.Provider,
|
|
8227
8236
|
{
|
|
@@ -8240,86 +8249,86 @@ const Wi = 60, Fi = ({
|
|
|
8240
8249
|
an,
|
|
8241
8250
|
{
|
|
8242
8251
|
theme: s,
|
|
8243
|
-
backgroundColor:
|
|
8252
|
+
backgroundColor: lt(s.waveOutlineColor),
|
|
8244
8253
|
timescaleBackgroundColor: s.timescaleBackgroundColor,
|
|
8245
|
-
scrollContainerWidth:
|
|
8246
|
-
timescaleWidth:
|
|
8247
|
-
tracksWidth:
|
|
8254
|
+
scrollContainerWidth: X + (y.show ? y.width : 0),
|
|
8255
|
+
timescaleWidth: X,
|
|
8256
|
+
tracksWidth: X,
|
|
8248
8257
|
controlsWidth: y.show ? y.width : 0,
|
|
8249
8258
|
onTracksMouseDown: ae,
|
|
8250
|
-
onTracksMouseMove:
|
|
8259
|
+
onTracksMouseMove: se,
|
|
8251
8260
|
onTracksMouseUp: de,
|
|
8252
8261
|
scrollContainerRef: K,
|
|
8253
8262
|
isSelecting: B,
|
|
8254
8263
|
timescale: w > 0 ? /* @__PURE__ */ C(dr, {}) : void 0,
|
|
8255
|
-
children: /* @__PURE__ */
|
|
8256
|
-
p.map((z,
|
|
8257
|
-
const
|
|
8258
|
-
return /* @__PURE__ */ C(sn.Provider, { value:
|
|
8264
|
+
children: /* @__PURE__ */ te(qe, { children: [
|
|
8265
|
+
p.map((z, me) => {
|
|
8266
|
+
const ie = z.length > 0 ? Math.max(...z.map((G) => G.peaks.data.length)) : 1;
|
|
8267
|
+
return /* @__PURE__ */ C(sn.Provider, { value: Oe, children: /* @__PURE__ */ C(
|
|
8259
8268
|
mr,
|
|
8260
8269
|
{
|
|
8261
|
-
numChannels:
|
|
8262
|
-
backgroundColor:
|
|
8270
|
+
numChannels: ie,
|
|
8271
|
+
backgroundColor: lt(s.waveOutlineColor),
|
|
8263
8272
|
offset: 0,
|
|
8264
|
-
width:
|
|
8273
|
+
width: X,
|
|
8265
8274
|
hasClipHeaders: !1,
|
|
8266
|
-
trackId: `media-element-track-${
|
|
8275
|
+
trackId: `media-element-track-${me}`,
|
|
8267
8276
|
isSelected: !0,
|
|
8268
|
-
children: z.map((
|
|
8269
|
-
const pe =
|
|
8277
|
+
children: z.map((G, he) => {
|
|
8278
|
+
const pe = G.peaks, le = pe.length;
|
|
8270
8279
|
return /* @__PURE__ */ C(
|
|
8271
8280
|
qt,
|
|
8272
8281
|
{
|
|
8273
|
-
clipId:
|
|
8274
|
-
trackIndex:
|
|
8275
|
-
clipIndex:
|
|
8276
|
-
trackName:
|
|
8277
|
-
startSample:
|
|
8278
|
-
durationSamples:
|
|
8282
|
+
clipId: G.clipId,
|
|
8283
|
+
trackIndex: me,
|
|
8284
|
+
clipIndex: he,
|
|
8285
|
+
trackName: G.trackName,
|
|
8286
|
+
startSample: G.startSample,
|
|
8287
|
+
durationSamples: G.durationSamples,
|
|
8279
8288
|
samplesPerPixel: m,
|
|
8280
8289
|
showHeader: !1,
|
|
8281
8290
|
disableHeaderDrag: !0,
|
|
8282
8291
|
isSelected: !0,
|
|
8283
|
-
trackId: `media-element-track-${
|
|
8284
|
-
children: pe.data.map((
|
|
8292
|
+
trackId: `media-element-track-${me}`,
|
|
8293
|
+
children: pe.data.map((Fe, _e) => /* @__PURE__ */ C(
|
|
8285
8294
|
Li,
|
|
8286
8295
|
{
|
|
8287
|
-
index:
|
|
8288
|
-
data:
|
|
8296
|
+
index: _e,
|
|
8297
|
+
data: Fe,
|
|
8289
8298
|
bits: pe.bits,
|
|
8290
8299
|
length: le,
|
|
8291
|
-
clipStartSample:
|
|
8292
|
-
clipDurationSamples:
|
|
8300
|
+
clipStartSample: G.startSample,
|
|
8301
|
+
clipDurationSamples: G.durationSamples
|
|
8293
8302
|
},
|
|
8294
|
-
`${
|
|
8303
|
+
`${me}-${he}-${_e}`
|
|
8295
8304
|
))
|
|
8296
8305
|
},
|
|
8297
|
-
`${
|
|
8306
|
+
`${me}-${he}`
|
|
8298
8307
|
);
|
|
8299
8308
|
})
|
|
8300
8309
|
}
|
|
8301
|
-
) },
|
|
8310
|
+
) }, me);
|
|
8302
8311
|
}),
|
|
8303
8312
|
l.length > 0 && /* @__PURE__ */ C(
|
|
8304
8313
|
Da,
|
|
8305
8314
|
{
|
|
8306
|
-
onDragStart:
|
|
8307
|
-
onDragMove:
|
|
8315
|
+
onDragStart: Y,
|
|
8316
|
+
onDragMove: j,
|
|
8308
8317
|
onDragEnd: ue,
|
|
8309
8318
|
modifiers: t ? [Ta] : [],
|
|
8310
|
-
children: /* @__PURE__ */ C(wr, { height: 30, width:
|
|
8311
|
-
const
|
|
8319
|
+
children: /* @__PURE__ */ C(wr, { height: 30, width: X, children: l.map((z, me) => {
|
|
8320
|
+
const ie = z.start * h / m, G = z.end * h / m, he = e ? e(z, me) : z.id;
|
|
8312
8321
|
return /* @__PURE__ */ C(
|
|
8313
8322
|
vr,
|
|
8314
8323
|
{
|
|
8315
8324
|
annotationId: z.id,
|
|
8316
|
-
annotationIndex:
|
|
8317
|
-
startPosition:
|
|
8318
|
-
endPosition:
|
|
8319
|
-
label:
|
|
8325
|
+
annotationIndex: me,
|
|
8326
|
+
startPosition: ie,
|
|
8327
|
+
endPosition: G,
|
|
8328
|
+
label: he,
|
|
8320
8329
|
color: "#ff9800",
|
|
8321
8330
|
isActive: z.id === c,
|
|
8322
|
-
onClick: () =>
|
|
8331
|
+
onClick: () => U(z),
|
|
8323
8332
|
editable: t
|
|
8324
8333
|
},
|
|
8325
8334
|
z.id
|
|
@@ -8327,11 +8336,11 @@ const Wi = 60, Fi = ({
|
|
|
8327
8336
|
}) })
|
|
8328
8337
|
}
|
|
8329
8338
|
),
|
|
8330
|
-
E !==
|
|
8339
|
+
E !== $ && /* @__PURE__ */ C(
|
|
8331
8340
|
sr,
|
|
8332
8341
|
{
|
|
8333
|
-
startPosition: Math.min(E,
|
|
8334
|
-
endPosition: Math.max(E,
|
|
8342
|
+
startPosition: Math.min(E, $) * h / m + (y.show ? y.width : 0),
|
|
8343
|
+
endPosition: Math.max(E, $) * h / m + (y.show ? y.width : 0),
|
|
8335
8344
|
color: s.selectionColor
|
|
8336
8345
|
}
|
|
8337
8346
|
),
|
|
@@ -8388,7 +8397,7 @@ const Wi = 60, Fi = ({
|
|
|
8388
8397
|
className: l
|
|
8389
8398
|
}) => {
|
|
8390
8399
|
const { annotations: c } = cn();
|
|
8391
|
-
return /* @__PURE__ */
|
|
8400
|
+
return /* @__PURE__ */ te(qe, { children: [
|
|
8392
8401
|
/* @__PURE__ */ C(
|
|
8393
8402
|
Gi,
|
|
8394
8403
|
{
|
|
@@ -8474,7 +8483,7 @@ export {
|
|
|
8474
8483
|
He as usePlaybackAnimation,
|
|
8475
8484
|
il as usePlaybackShortcuts,
|
|
8476
8485
|
ve as usePlaylistControls,
|
|
8477
|
-
|
|
8486
|
+
Te as usePlaylistData,
|
|
8478
8487
|
Xe as usePlaylistState,
|
|
8479
8488
|
Ri as useSpectrogramIntegration,
|
|
8480
8489
|
js as useTimeFormat,
|