@waveform-playlist/browser 5.1.0 → 5.2.0-next.1
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.d.ts +5 -3
- package/dist/index.js +21 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1282 -1281
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _r from "tone";
|
|
2
|
-
import { Volume as $n, getDestination as Mn, start as Bn, now as St, getTransport as ct, getContext as
|
|
3
|
-
import { jsx as I, jsxs as
|
|
2
|
+
import { Volume as $n, getDestination as Mn, start as Bn, now as St, getTransport as ct, getContext as Ae, Context as Fr, setContext as Zr, Panner as Vr, Gain as sn, Player as ln, Analyser as Dn, Meter as Pr, connect as zr, StereoWidener as Hr, Gate as Xr, Limiter as Gr, Compressor as Nr, Chebyshev as Lr, BitCrusher as Yr, Distortion as Or, EQ3 as Kr, AutoWah as Ur, AutoFilter as jr, AutoPanner as Jr, Vibrato as Qr, Tremolo as qr, Phaser as ea, Chorus as ta, PingPongDelay as na, FeedbackDelay as ra, JCReverb as aa, Freeverb as oa, Reverb as sa } from "tone";
|
|
3
|
+
import { jsx as I, jsxs as ne, Fragment as rt } from "react/jsx-runtime";
|
|
4
4
|
import * as Y from "react";
|
|
5
|
-
import
|
|
5
|
+
import Fe, { createContext as Me, useContext as Te, useState as R, useEffect as U, Fragment as ia, useRef as T, useCallback as D, useLayoutEffect as la, useMemo as nt } from "react";
|
|
6
6
|
import S, { withTheme as Tn, ThemeContext as ca, useTheme as ua, ThemeProvider as Rn } from "styled-components";
|
|
7
7
|
import { useDraggable as bt, useSensor as zt, MouseSensor as da, TouchSensor as ma, PointerSensor as fa, useSensors as ha, DndContext as pa } from "@dnd-kit/core";
|
|
8
8
|
import { restrictToHorizontalAxis as ga } from "@dnd-kit/modifiers";
|
|
@@ -364,10 +364,10 @@ var ya = class {
|
|
|
364
364
|
}), this.tracks.clear(), this.effectsCleanup && this.effectsCleanup(), this.masterVolume.dispose();
|
|
365
365
|
}
|
|
366
366
|
get context() {
|
|
367
|
-
return
|
|
367
|
+
return Ae();
|
|
368
368
|
}
|
|
369
369
|
get sampleRate() {
|
|
370
|
-
return
|
|
370
|
+
return Ae().sampleRate;
|
|
371
371
|
}
|
|
372
372
|
setOnPlaybackComplete(e) {
|
|
373
373
|
this.onPlaybackCompleteCallback = e;
|
|
@@ -469,7 +469,7 @@ const Nt = /* @__PURE__ */ Object.freeze({
|
|
|
469
469
|
"thin",
|
|
470
470
|
/* @__PURE__ */ Y.createElement(Y.Fragment, null, /* @__PURE__ */ Y.createElement("path", { d: "M153.76,28.41a4,4,0,0,0-4.22.43L78.63,84H32A12,12,0,0,0,20,96v64a12,12,0,0,0,12,12H78.63l70.91,55.16A4.07,4.07,0,0,0,152,228a3.92,3.92,0,0,0,1.76-.41A4,4,0,0,0,156,224V32A4,4,0,0,0,153.76,28.41ZM28,160V96a4,4,0,0,1,4-4H76v72H32A4,4,0,0,1,28,160Zm120,55.82L84,166V90l64-49.78ZM204,128a36,36,0,0,1-9,23.82,4,4,0,1,1-6-5.3,28,28,0,0,0,0-37,4,4,0,0,1,6-5.28A36,36,0,0,1,204,128Z" }))
|
|
471
471
|
]
|
|
472
|
-
]), ka =
|
|
472
|
+
]), ka = Me({
|
|
473
473
|
color: "currentColor",
|
|
474
474
|
size: "1em",
|
|
475
475
|
weight: "regular",
|
|
@@ -586,7 +586,7 @@ var Dt = S.div`
|
|
|
586
586
|
font-family: ${(e) => e.theme.fontFamily};
|
|
587
587
|
font-size: ${(e) => e.theme.fontSize};
|
|
588
588
|
color: ${(e) => e.theme.textColor};
|
|
589
|
-
`,
|
|
589
|
+
`, Pe = S.button`
|
|
590
590
|
padding: 0.5rem 1rem;
|
|
591
591
|
background: ${(e) => e.theme.buttonBackground || "#007bff"};
|
|
592
592
|
color: ${(e) => e.theme.buttonText || "white"};
|
|
@@ -785,7 +785,7 @@ var Vn = S.input.attrs({ type: "range" })`
|
|
|
785
785
|
onChange: t,
|
|
786
786
|
disabled: n = !1,
|
|
787
787
|
className: r
|
|
788
|
-
}) => /* @__PURE__ */
|
|
788
|
+
}) => /* @__PURE__ */ ne(Dt, { className: r, children: [
|
|
789
789
|
/* @__PURE__ */ I(
|
|
790
790
|
Tt,
|
|
791
791
|
{
|
|
@@ -926,42 +926,42 @@ var Da = S.canvas.attrs((e) => ({
|
|
|
926
926
|
barGap: g = 0,
|
|
927
927
|
transparentBackground: h = !1,
|
|
928
928
|
drawMode: d = "inverted"
|
|
929
|
-
} = e, b =
|
|
930
|
-
(
|
|
931
|
-
if (
|
|
932
|
-
const
|
|
933
|
-
b.current[
|
|
929
|
+
} = e, b = T([]), y = D(
|
|
930
|
+
(C) => {
|
|
931
|
+
if (C !== null) {
|
|
932
|
+
const v = parseInt(C.dataset.index, 10);
|
|
933
|
+
b.current[v] = C;
|
|
934
934
|
}
|
|
935
935
|
},
|
|
936
936
|
[]
|
|
937
937
|
);
|
|
938
938
|
la(() => {
|
|
939
|
-
const
|
|
940
|
-
let
|
|
941
|
-
for (let
|
|
942
|
-
const
|
|
943
|
-
if (
|
|
944
|
-
|
|
945
|
-
const
|
|
946
|
-
let
|
|
947
|
-
d === "normal" ?
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
939
|
+
const C = b.current, v = u + g;
|
|
940
|
+
let k = 0;
|
|
941
|
+
for (let B = 0; B < C.length; B++) {
|
|
942
|
+
const $ = C[B], A = $.getContext("2d"), M = Math.floor(i / 2), _ = 2 ** (n - 1);
|
|
943
|
+
if (A) {
|
|
944
|
+
A.resetTransform(), A.clearRect(0, 0, $.width, $.height), A.imageSmoothingEnabled = !1, A.scale(o, o);
|
|
945
|
+
const E = $.width / o;
|
|
946
|
+
let V;
|
|
947
|
+
d === "normal" ? V = c : V = l, A.fillStyle = Ba(
|
|
948
|
+
A,
|
|
949
|
+
V,
|
|
950
|
+
E,
|
|
951
951
|
i
|
|
952
952
|
);
|
|
953
|
-
const
|
|
954
|
-
for (let
|
|
955
|
-
const Z =
|
|
953
|
+
const z = k, P = k + E, K = Math.floor((z - u + v) / v) * v;
|
|
954
|
+
for (let X = Math.max(0, K); X < P; X += v) {
|
|
955
|
+
const Z = X - z;
|
|
956
956
|
if (Z + u <= 0) continue;
|
|
957
|
-
const
|
|
958
|
-
if (
|
|
959
|
-
const
|
|
960
|
-
d === "normal" ?
|
|
957
|
+
const Q = X;
|
|
958
|
+
if (Q * 2 + 1 < t.length) {
|
|
959
|
+
const le = t[Q * 2] / _, te = t[Q * 2 + 1] / _, re = Math.abs(le * M), ae = Math.abs(te * M);
|
|
960
|
+
d === "normal" ? A.fillRect(Z, M - ae, u, ae + re) : (A.fillRect(Z, 0, u, M - ae), A.fillRect(Z, M + re, u, M - re));
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
|
|
964
|
+
k += $.width / o;
|
|
965
965
|
}
|
|
966
966
|
}, [
|
|
967
967
|
t,
|
|
@@ -978,11 +978,11 @@ var Da = S.canvas.attrs((e) => ({
|
|
|
978
978
|
let m = r, p = 0;
|
|
979
979
|
const x = [];
|
|
980
980
|
for (; m > 0; ) {
|
|
981
|
-
const
|
|
981
|
+
const C = Math.min(m, Ma), v = /* @__PURE__ */ I(
|
|
982
982
|
Da,
|
|
983
983
|
{
|
|
984
|
-
$cssWidth:
|
|
985
|
-
width:
|
|
984
|
+
$cssWidth: C,
|
|
985
|
+
width: C * o,
|
|
986
986
|
height: i * o,
|
|
987
987
|
$waveHeight: i,
|
|
988
988
|
"data-index": p,
|
|
@@ -990,7 +990,7 @@ var Da = S.canvas.attrs((e) => ({
|
|
|
990
990
|
},
|
|
991
991
|
`${r}-${p}`
|
|
992
992
|
);
|
|
993
|
-
x.push(
|
|
993
|
+
x.push(v), m -= C, p += 1;
|
|
994
994
|
}
|
|
995
995
|
const f = h ? "transparent" : at(c);
|
|
996
996
|
return /* @__PURE__ */ I(
|
|
@@ -1113,7 +1113,7 @@ var Da = S.canvas.attrs((e) => ({
|
|
|
1113
1113
|
dragHandleProps: a,
|
|
1114
1114
|
touchOptimized: s = !1
|
|
1115
1115
|
}) => {
|
|
1116
|
-
const [o, i] =
|
|
1116
|
+
const [o, i] = Fe.useState(!1);
|
|
1117
1117
|
if (!a)
|
|
1118
1118
|
return null;
|
|
1119
1119
|
const { attributes: l, listeners: c, setActivatorNodeRef: u, isDragging: g } = a;
|
|
@@ -1236,43 +1236,43 @@ var fn = ({
|
|
|
1236
1236
|
fadeOut: m,
|
|
1237
1237
|
sampleRate: p = 44100,
|
|
1238
1238
|
showFades: x = !1,
|
|
1239
|
-
touchOptimized:
|
|
1239
|
+
touchOptimized: w = !1
|
|
1240
1240
|
}) => {
|
|
1241
|
-
const f = Math.floor(o / l),
|
|
1242
|
-
id:
|
|
1241
|
+
const f = Math.floor(o / l), v = Math.floor((o + i) / l) - f, k = c && !u && !g, B = `clip-${r}-${a}`, { attributes: $, listeners: A, setNodeRef: M, setActivatorNodeRef: _, transform: E, isDragging: V } = bt({
|
|
1242
|
+
id: B,
|
|
1243
1243
|
data: { clipId: n, trackIndex: r, clipIndex: a },
|
|
1244
|
-
disabled: !
|
|
1245
|
-
}),
|
|
1246
|
-
attributes:
|
|
1247
|
-
listeners:
|
|
1248
|
-
setActivatorNodeRef:
|
|
1244
|
+
disabled: !k
|
|
1245
|
+
}), z = `clip-boundary-left-${r}-${a}`, {
|
|
1246
|
+
attributes: P,
|
|
1247
|
+
listeners: K,
|
|
1248
|
+
setActivatorNodeRef: X,
|
|
1249
1249
|
isDragging: Z
|
|
1250
1250
|
} = bt({
|
|
1251
|
-
id:
|
|
1251
|
+
id: z,
|
|
1252
1252
|
data: { clipId: n, trackIndex: r, clipIndex: a, boundary: "left" },
|
|
1253
|
-
disabled: !
|
|
1254
|
-
}),
|
|
1255
|
-
attributes:
|
|
1256
|
-
listeners:
|
|
1257
|
-
setActivatorNodeRef:
|
|
1258
|
-
isDragging:
|
|
1253
|
+
disabled: !k
|
|
1254
|
+
}), Q = `clip-boundary-right-${r}-${a}`, {
|
|
1255
|
+
attributes: le,
|
|
1256
|
+
listeners: te,
|
|
1257
|
+
setActivatorNodeRef: re,
|
|
1258
|
+
isDragging: ae
|
|
1259
1259
|
} = bt({
|
|
1260
|
-
id:
|
|
1260
|
+
id: Q,
|
|
1261
1261
|
data: { clipId: n, trackIndex: r, clipIndex: a, boundary: "right" },
|
|
1262
|
-
disabled: !
|
|
1263
|
-
}), ye =
|
|
1264
|
-
transform: Nt.Translate.toString(
|
|
1265
|
-
zIndex:
|
|
1262
|
+
disabled: !k
|
|
1263
|
+
}), ye = E ? {
|
|
1264
|
+
transform: Nt.Translate.toString(E),
|
|
1265
|
+
zIndex: V ? 100 : void 0
|
|
1266
1266
|
// Below controls (z-index: 999) but above other clips
|
|
1267
1267
|
} : void 0;
|
|
1268
|
-
return /* @__PURE__ */
|
|
1268
|
+
return /* @__PURE__ */ ne(
|
|
1269
1269
|
Ha,
|
|
1270
1270
|
{
|
|
1271
1271
|
ref: M,
|
|
1272
1272
|
style: ye,
|
|
1273
1273
|
className: t,
|
|
1274
1274
|
$left: f,
|
|
1275
|
-
$width:
|
|
1275
|
+
$width: v,
|
|
1276
1276
|
$isOverlay: g,
|
|
1277
1277
|
"data-clip-container": "true",
|
|
1278
1278
|
"data-track-id": b,
|
|
@@ -1287,10 +1287,10 @@ var fn = ({
|
|
|
1287
1287
|
trackName: s,
|
|
1288
1288
|
isSelected: h,
|
|
1289
1289
|
disableDrag: u,
|
|
1290
|
-
dragHandleProps:
|
|
1290
|
+
dragHandleProps: k ? { attributes: $, listeners: A, setActivatorNodeRef: _ } : void 0
|
|
1291
1291
|
}
|
|
1292
1292
|
),
|
|
1293
|
-
/* @__PURE__ */
|
|
1293
|
+
/* @__PURE__ */ ne(Xa, { $isOverlay: g, children: [
|
|
1294
1294
|
e,
|
|
1295
1295
|
x && y && y.duration > 0 && /* @__PURE__ */ I(
|
|
1296
1296
|
fn,
|
|
@@ -1304,14 +1304,14 @@ var fn = ({
|
|
|
1304
1304
|
x && m && m.duration > 0 && /* @__PURE__ */ I(
|
|
1305
1305
|
fn,
|
|
1306
1306
|
{
|
|
1307
|
-
left:
|
|
1307
|
+
left: v - Math.floor(m.duration * p / l),
|
|
1308
1308
|
width: Math.floor(m.duration * p / l),
|
|
1309
1309
|
type: "fadeOut",
|
|
1310
1310
|
curveType: m.type
|
|
1311
1311
|
}
|
|
1312
1312
|
)
|
|
1313
1313
|
] }),
|
|
1314
|
-
c && !u && !g && /* @__PURE__ */
|
|
1314
|
+
c && !u && !g && /* @__PURE__ */ ne(rt, { children: [
|
|
1315
1315
|
/* @__PURE__ */ I(
|
|
1316
1316
|
mn,
|
|
1317
1317
|
{
|
|
@@ -1319,11 +1319,11 @@ var fn = ({
|
|
|
1319
1319
|
trackIndex: r,
|
|
1320
1320
|
clipIndex: a,
|
|
1321
1321
|
edge: "left",
|
|
1322
|
-
touchOptimized:
|
|
1322
|
+
touchOptimized: w,
|
|
1323
1323
|
dragHandleProps: {
|
|
1324
|
-
attributes:
|
|
1325
|
-
listeners:
|
|
1326
|
-
setActivatorNodeRef:
|
|
1324
|
+
attributes: P,
|
|
1325
|
+
listeners: K,
|
|
1326
|
+
setActivatorNodeRef: X,
|
|
1327
1327
|
isDragging: Z
|
|
1328
1328
|
}
|
|
1329
1329
|
}
|
|
@@ -1335,12 +1335,12 @@ var fn = ({
|
|
|
1335
1335
|
trackIndex: r,
|
|
1336
1336
|
clipIndex: a,
|
|
1337
1337
|
edge: "right",
|
|
1338
|
-
touchOptimized:
|
|
1338
|
+
touchOptimized: w,
|
|
1339
1339
|
dragHandleProps: {
|
|
1340
|
-
attributes:
|
|
1341
|
-
listeners:
|
|
1342
|
-
setActivatorNodeRef:
|
|
1343
|
-
isDragging:
|
|
1340
|
+
attributes: le,
|
|
1341
|
+
listeners: te,
|
|
1342
|
+
setActivatorNodeRef: re,
|
|
1343
|
+
isDragging: ae
|
|
1344
1344
|
}
|
|
1345
1345
|
}
|
|
1346
1346
|
)
|
|
@@ -1366,7 +1366,7 @@ var fn = ({
|
|
|
1366
1366
|
const a = (s) => {
|
|
1367
1367
|
t(parseFloat(s.target.value) / 100);
|
|
1368
1368
|
};
|
|
1369
|
-
return /* @__PURE__ */
|
|
1369
|
+
return /* @__PURE__ */ ne(Ga, { className: r, children: [
|
|
1370
1370
|
/* @__PURE__ */ I(Na, { htmlFor: "master-gain", children: "Master Volume" }),
|
|
1371
1371
|
/* @__PURE__ */ I(
|
|
1372
1372
|
La,
|
|
@@ -1470,14 +1470,14 @@ var Oa = S.div`
|
|
|
1470
1470
|
scrollContainerRef: h,
|
|
1471
1471
|
isSelecting: d,
|
|
1472
1472
|
"data-playlist-state": b
|
|
1473
|
-
}) => /* @__PURE__ */ I(Oa, { "data-scroll-container": "true", "data-playlist-state": b, ref: h, children: /* @__PURE__ */
|
|
1473
|
+
}) => /* @__PURE__ */ I(Oa, { "data-scroll-container": "true", "data-playlist-state": b, ref: h, children: /* @__PURE__ */ ne(
|
|
1474
1474
|
Ka,
|
|
1475
1475
|
{
|
|
1476
1476
|
$backgroundColor: t,
|
|
1477
1477
|
$width: o,
|
|
1478
1478
|
children: [
|
|
1479
1479
|
r && /* @__PURE__ */ I(Ua, { $width: a, $backgroundColor: n, children: r }),
|
|
1480
|
-
/* @__PURE__ */
|
|
1480
|
+
/* @__PURE__ */ ne(ja, { $width: s, $backgroundColor: t, children: [
|
|
1481
1481
|
e,
|
|
1482
1482
|
(l || c) && /* @__PURE__ */ I(
|
|
1483
1483
|
Ja,
|
|
@@ -1622,33 +1622,33 @@ var hn = S.div.attrs((e) => ({
|
|
|
1622
1622
|
minPosition: i = 0,
|
|
1623
1623
|
maxPosition: l = 1 / 0
|
|
1624
1624
|
}) => {
|
|
1625
|
-
const [c, u] =
|
|
1625
|
+
const [c, u] = R(null), g = T(0), h = T(0), d = T(0), b = Math.max(0, t - e), y = D((p, x) => {
|
|
1626
1626
|
p.preventDefault(), p.stopPropagation(), u(x), g.current = p.clientX, h.current = x === "start" ? e : t;
|
|
1627
|
-
const
|
|
1628
|
-
const
|
|
1627
|
+
const w = (C) => {
|
|
1628
|
+
const v = C.clientX - g.current, k = h.current + v;
|
|
1629
1629
|
if (x === "start") {
|
|
1630
|
-
const
|
|
1631
|
-
a?.(
|
|
1630
|
+
const B = Math.max(i, Math.min(t - 10, k));
|
|
1631
|
+
a?.(B);
|
|
1632
1632
|
} else {
|
|
1633
|
-
const
|
|
1634
|
-
s?.(
|
|
1633
|
+
const B = Math.max(e + 10, Math.min(l, k));
|
|
1634
|
+
s?.(B);
|
|
1635
1635
|
}
|
|
1636
1636
|
}, f = () => {
|
|
1637
|
-
u(null), document.removeEventListener("mousemove",
|
|
1637
|
+
u(null), document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", f);
|
|
1638
1638
|
};
|
|
1639
|
-
document.addEventListener("mousemove",
|
|
1639
|
+
document.addEventListener("mousemove", w), document.addEventListener("mouseup", f);
|
|
1640
1640
|
}, [e, t, i, l, a, s]), m = D((p) => {
|
|
1641
1641
|
p.preventDefault(), p.stopPropagation(), u("region"), g.current = p.clientX, h.current = e, d.current = t;
|
|
1642
|
-
const x = t - e,
|
|
1643
|
-
const
|
|
1644
|
-
let
|
|
1645
|
-
|
|
1642
|
+
const x = t - e, w = (C) => {
|
|
1643
|
+
const v = C.clientX - g.current;
|
|
1644
|
+
let k = h.current + v, B = d.current + v;
|
|
1645
|
+
k < i && (k = i, B = i + x), B > l && (B = l, k = l - x), o?.(k, B);
|
|
1646
1646
|
}, f = () => {
|
|
1647
|
-
u(null), document.removeEventListener("mousemove",
|
|
1647
|
+
u(null), document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", f);
|
|
1648
1648
|
};
|
|
1649
|
-
document.addEventListener("mousemove",
|
|
1649
|
+
document.addEventListener("mousemove", w), document.addEventListener("mouseup", f);
|
|
1650
1650
|
}, [e, t, i, l, o]);
|
|
1651
|
-
return b <= 0 ? null : /* @__PURE__ */
|
|
1651
|
+
return b <= 0 ? null : /* @__PURE__ */ ne(rt, { children: [
|
|
1652
1652
|
/* @__PURE__ */ I(
|
|
1653
1653
|
qa,
|
|
1654
1654
|
{
|
|
@@ -1704,7 +1704,7 @@ var hn = S.div.attrs((e) => ({
|
|
|
1704
1704
|
maxPosition: o = 1 / 0,
|
|
1705
1705
|
controlsOffset: i = 0
|
|
1706
1706
|
}) => {
|
|
1707
|
-
const [l, c] =
|
|
1707
|
+
const [l, c] = R(!1), u = T(0), g = T(null), h = t > e, d = D((b) => {
|
|
1708
1708
|
const y = b.target;
|
|
1709
1709
|
if (y.closest("[data-loop-marker-handle]") || y.closest("[data-loop-region-timescale]"))
|
|
1710
1710
|
return;
|
|
@@ -1713,13 +1713,13 @@ var hn = S.div.attrs((e) => ({
|
|
|
1713
1713
|
if (!m) return;
|
|
1714
1714
|
const p = b.clientX - m.left, x = Math.max(s, Math.min(o, p));
|
|
1715
1715
|
u.current = x, a?.(x, x);
|
|
1716
|
-
const
|
|
1717
|
-
const
|
|
1718
|
-
a?.(
|
|
1716
|
+
const w = (C) => {
|
|
1717
|
+
const v = C.clientX - m.left, k = Math.max(s, Math.min(o, v)), B = Math.min(u.current, k), $ = Math.max(u.current, k);
|
|
1718
|
+
a?.(B, $);
|
|
1719
1719
|
}, f = () => {
|
|
1720
|
-
c(!1), document.removeEventListener("mousemove",
|
|
1720
|
+
c(!1), document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", f);
|
|
1721
1721
|
};
|
|
1722
|
-
document.addEventListener("mousemove",
|
|
1722
|
+
document.addEventListener("mousemove", w), document.addEventListener("mouseup", f);
|
|
1723
1723
|
}, [s, o, a]);
|
|
1724
1724
|
return /* @__PURE__ */ I(
|
|
1725
1725
|
to,
|
|
@@ -1795,11 +1795,11 @@ var pn = ({
|
|
|
1795
1795
|
onChange: s,
|
|
1796
1796
|
readOnly: o = !1
|
|
1797
1797
|
}) => {
|
|
1798
|
-
const [i, l] =
|
|
1799
|
-
return
|
|
1798
|
+
const [i, l] = R("");
|
|
1799
|
+
return U(() => {
|
|
1800
1800
|
const h = dt(n, r);
|
|
1801
1801
|
l(h);
|
|
1802
|
-
}, [n, r, e]), /* @__PURE__ */
|
|
1802
|
+
}, [n, r, e]), /* @__PURE__ */ ne(rt, { children: [
|
|
1803
1803
|
/* @__PURE__ */ I(Sa, { as: "label", htmlFor: e, children: t }),
|
|
1804
1804
|
/* @__PURE__ */ I(
|
|
1805
1805
|
Fn,
|
|
@@ -1832,15 +1832,15 @@ var pn = ({
|
|
|
1832
1832
|
onSelectionChange: n,
|
|
1833
1833
|
className: r
|
|
1834
1834
|
}) => {
|
|
1835
|
-
const [a, s] =
|
|
1836
|
-
return
|
|
1835
|
+
const [a, s] = R("hh:mm:ss.uuu");
|
|
1836
|
+
return U(() => {
|
|
1837
1837
|
const l = document.querySelector(".time-format"), c = () => {
|
|
1838
1838
|
l && s(l.value);
|
|
1839
1839
|
};
|
|
1840
1840
|
return l && (s(l.value), l.addEventListener("change", c)), () => {
|
|
1841
1841
|
l?.removeEventListener("change", c);
|
|
1842
1842
|
};
|
|
1843
|
-
}, []), /* @__PURE__ */
|
|
1843
|
+
}, []), /* @__PURE__ */ ne(rt, { children: [
|
|
1844
1844
|
/* @__PURE__ */ I(
|
|
1845
1845
|
pn,
|
|
1846
1846
|
{
|
|
@@ -1872,8 +1872,8 @@ var pn = ({
|
|
|
1872
1872
|
function $t() {
|
|
1873
1873
|
return window.devicePixelRatio;
|
|
1874
1874
|
}
|
|
1875
|
-
var Yn =
|
|
1876
|
-
const [t, n] =
|
|
1875
|
+
var Yn = Me($t()), On = ({ children: e }) => {
|
|
1876
|
+
const [t, n] = R($t());
|
|
1877
1877
|
return matchMedia(`(resolution: ${$t()}dppx)`).addEventListener(
|
|
1878
1878
|
"change",
|
|
1879
1879
|
() => {
|
|
@@ -1881,7 +1881,7 @@ var Yn = Be($t()), On = ({ children: e }) => {
|
|
|
1881
1881
|
},
|
|
1882
1882
|
{ once: !0 }
|
|
1883
1883
|
), /* @__PURE__ */ I(Yn.Provider, { value: Math.ceil(t), children: e });
|
|
1884
|
-
}, Kn = () => Te(Yn), Et =
|
|
1884
|
+
}, Kn = () => Te(Yn), Et = Me({
|
|
1885
1885
|
sampleRate: 48e3,
|
|
1886
1886
|
samplesPerPixel: 1e3,
|
|
1887
1887
|
zoomLevels: [1e3, 1500, 2e3, 2500],
|
|
@@ -1894,14 +1894,14 @@ var Yn = Be($t()), On = ({ children: e }) => {
|
|
|
1894
1894
|
duration: 3e4,
|
|
1895
1895
|
barWidth: 1,
|
|
1896
1896
|
barGap: 0
|
|
1897
|
-
}), vt = () => Te(Et), wt = () => Te(ca), Qt =
|
|
1897
|
+
}), vt = () => Te(Et), wt = () => Te(ca), Qt = Me(/* @__PURE__ */ I(ia, {})), ao = () => Te(Qt), oo = 0, so = !1, io = 0, lo = 0, co = {
|
|
1898
1898
|
progress: oo,
|
|
1899
1899
|
isPlaying: so,
|
|
1900
1900
|
selectionStart: io,
|
|
1901
1901
|
selectionEnd: lo
|
|
1902
1902
|
};
|
|
1903
|
-
|
|
1904
|
-
|
|
1903
|
+
Me(co);
|
|
1904
|
+
Me({
|
|
1905
1905
|
setIsPlaying: () => {
|
|
1906
1906
|
},
|
|
1907
1907
|
setProgress: () => {
|
|
@@ -1973,20 +1973,20 @@ var fo = S.div.attrs((e) => ({
|
|
|
1973
1973
|
bigStep: a,
|
|
1974
1974
|
secondStep: s,
|
|
1975
1975
|
renderTimestamp: o
|
|
1976
|
-
} = e, i = /* @__PURE__ */ new Map(), l = [], c =
|
|
1976
|
+
} = e, i = /* @__PURE__ */ new Map(), l = [], c = T(null), {
|
|
1977
1977
|
sampleRate: u,
|
|
1978
1978
|
samplesPerPixel: g,
|
|
1979
1979
|
timeScaleHeight: h,
|
|
1980
1980
|
controls: { show: d, width: b }
|
|
1981
1981
|
} = Te(Et), y = Kn();
|
|
1982
|
-
|
|
1982
|
+
U(() => {
|
|
1983
1983
|
if (c.current !== null) {
|
|
1984
|
-
const
|
|
1984
|
+
const w = c.current, f = w.getContext("2d");
|
|
1985
1985
|
if (f) {
|
|
1986
|
-
f.resetTransform(), f.clearRect(0, 0,
|
|
1987
|
-
for (const [
|
|
1988
|
-
const
|
|
1989
|
-
f.fillRect(
|
|
1986
|
+
f.resetTransform(), f.clearRect(0, 0, w.width, w.height), f.imageSmoothingEnabled = !1, f.fillStyle = t, f.scale(y, y);
|
|
1987
|
+
for (const [C, v] of i.entries()) {
|
|
1988
|
+
const k = h - v;
|
|
1989
|
+
f.fillRect(C, k, 1, v);
|
|
1990
1990
|
}
|
|
1991
1991
|
}
|
|
1992
1992
|
}
|
|
@@ -2002,15 +2002,15 @@ var fo = S.div.attrs((e) => ({
|
|
|
2002
2002
|
]);
|
|
2003
2003
|
const m = uo(n / 1e3, g, u), p = u / g;
|
|
2004
2004
|
let x = 0;
|
|
2005
|
-
for (let
|
|
2006
|
-
const f = Math.floor(
|
|
2005
|
+
for (let w = 0; w < m; w += p * s / 1e3) {
|
|
2006
|
+
const f = Math.floor(w);
|
|
2007
2007
|
if (x % r === 0) {
|
|
2008
|
-
const
|
|
2009
|
-
l.push(
|
|
2008
|
+
const C = x, v = mo(C), k = o ? /* @__PURE__ */ I(Fe.Fragment, { children: o(C, f) }, `timestamp-${x}`) : /* @__PURE__ */ I(po, { $left: f, children: v }, v);
|
|
2009
|
+
l.push(k), i.set(f, h);
|
|
2010
2010
|
} else x % a === 0 ? i.set(f, Math.floor(h / 2)) : x % s === 0 && i.set(f, Math.floor(h / 5));
|
|
2011
2011
|
x += s;
|
|
2012
2012
|
}
|
|
2013
|
-
return /* @__PURE__ */
|
|
2013
|
+
return /* @__PURE__ */ ne(
|
|
2014
2014
|
fo,
|
|
2015
2015
|
{
|
|
2016
2016
|
$cssWidth: m,
|
|
@@ -2109,7 +2109,7 @@ var fo = S.div.attrs((e) => ({
|
|
|
2109
2109
|
waveHeight: u,
|
|
2110
2110
|
controls: { show: g, width: h }
|
|
2111
2111
|
} = vt(), d = ao();
|
|
2112
|
-
return /* @__PURE__ */
|
|
2112
|
+
return /* @__PURE__ */ ne(
|
|
2113
2113
|
yo,
|
|
2114
2114
|
{
|
|
2115
2115
|
$numChannels: e,
|
|
@@ -2439,26 +2439,26 @@ function Zo(e) {
|
|
|
2439
2439
|
return new Float32Array(M);
|
|
2440
2440
|
}), i = r ? o.length : 1, l = 24, c = Fo(a, t), u = e.bits === 8 ? 1 : 2, g = l + c * 2 * u * i, h = new ArrayBuffer(g), d = new DataView(h), b = 0, y = l, m = new Array(i), p = new Array(i), x = 0; x < i; x++)
|
|
2441
2441
|
m[x] = 1 / 0, p[x] = -1 / 0;
|
|
2442
|
-
var
|
|
2442
|
+
var w = e.bits === 8 ? Eo : _o, f = e.bits === 8 ? Ro : Wo;
|
|
2443
2443
|
d.setInt32(0, 2, !0), d.setUint32(4, e.bits === 8, !0), d.setInt32(8, s, !0), d.setInt32(12, t, !0), d.setInt32(16, c, !0), d.setInt32(20, i, !0);
|
|
2444
|
-
for (var
|
|
2445
|
-
var
|
|
2444
|
+
for (var C = 0; C < a; C++) {
|
|
2445
|
+
var v = 0;
|
|
2446
2446
|
if (i === 1) {
|
|
2447
|
-
for (var
|
|
2448
|
-
|
|
2449
|
-
|
|
2447
|
+
for (var k = 0; k < o.length; ++k)
|
|
2448
|
+
v += o[k][C];
|
|
2449
|
+
v = Math.floor(f * v * n / o.length), v < m[0] && (m[0] = v, m[0] < w && (m[0] = w)), v > p[0] && (p[0] = v, p[0] > f && (p[0] = f));
|
|
2450
2450
|
} else
|
|
2451
|
-
for (var
|
|
2452
|
-
|
|
2451
|
+
for (var B = 0; B < i; ++B)
|
|
2452
|
+
v = Math.floor(f * o[B][C] * n), v < m[B] && (m[B] = v, m[B] < w && (m[B] = w)), v > p[B] && (p[B] = v, p[B] > f && (p[B] = f));
|
|
2453
2453
|
if (++b === t) {
|
|
2454
|
-
for (var
|
|
2455
|
-
e.bits === 8 ? (d.setInt8(y++, m[
|
|
2454
|
+
for (var $ = 0; $ < i; $++)
|
|
2455
|
+
e.bits === 8 ? (d.setInt8(y++, m[$]), d.setInt8(y++, p[$])) : (d.setInt16(y, m[$], !0), d.setInt16(y + 2, p[$], !0), y += 4), m[$] = 1 / 0, p[$] = -1 / 0;
|
|
2456
2456
|
b = 0;
|
|
2457
2457
|
}
|
|
2458
2458
|
}
|
|
2459
2459
|
if (b > 0)
|
|
2460
|
-
for (var
|
|
2461
|
-
e.bits === 8 ? (d.setInt8(y++, m[
|
|
2460
|
+
for (var A = 0; A < i; A++)
|
|
2461
|
+
e.bits === 8 ? (d.setInt8(y++, m[A]), d.setInt8(y++, p[A])) : (d.setInt16(y, m[A], !0), d.setInt16(y + 2, p[A], !0));
|
|
2462
2462
|
return h;
|
|
2463
2463
|
}
|
|
2464
2464
|
function Mt(e) {
|
|
@@ -2515,7 +2515,7 @@ function Go(e, t, n) {
|
|
|
2515
2515
|
};
|
|
2516
2516
|
}
|
|
2517
2517
|
var No = /* @__PURE__ */ Go("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICd1c2Ugc3RyaWN0JzsKCiAgLyoqCiAgICogQXVkaW9CdWZmZXItYmFzZWQgV2F2ZWZvcm1EYXRhIGdlbmVyYXRvcgogICAqCiAgICogQWRhcHRlZCBmcm9tIEJsb2NrRmlsZTo6Q2FsY1N1bW1hcnkgaW4gQXVkYWNpdHksIHdpdGggcGVybWlzc2lvbi4KICAgKiBTZWUgaHR0cHM6Ly9naXRodWIuY29tL2F1ZGFjaXR5L2F1ZGFjaXR5L2Jsb2IvCiAgICogICAxMTA4YzEzNzZjMDkxNjYxNjIzMzVmYWI0NzQzMDA4Y2JhNTdjNGVlL3NyYy9CbG9ja0ZpbGUuY3BwI0wxOTgKICAgKi8KCiAgdmFyIElOVDhfTUFYID0gMTI3OwogIHZhciBJTlQ4X01JTiA9IC0xMjg7CiAgdmFyIElOVDE2X01BWCA9IDMyNzY3OwogIHZhciBJTlQxNl9NSU4gPSAtMzI3Njg7CiAgZnVuY3Rpb24gY2FsY3VsYXRlV2F2ZWZvcm1EYXRhTGVuZ3RoKGF1ZGlvX3NhbXBsZV9jb3VudCwgc2NhbGUpIHsKICAgIHZhciBkYXRhX2xlbmd0aCA9IE1hdGguZmxvb3IoYXVkaW9fc2FtcGxlX2NvdW50IC8gc2NhbGUpOwogICAgdmFyIHNhbXBsZXNfcmVtYWluaW5nID0gYXVkaW9fc2FtcGxlX2NvdW50IC0gZGF0YV9sZW5ndGggKiBzY2FsZTsKICAgIGlmIChzYW1wbGVzX3JlbWFpbmluZyA+IDApIHsKICAgICAgZGF0YV9sZW5ndGgrKzsKICAgIH0KICAgIHJldHVybiBkYXRhX2xlbmd0aDsKICB9CiAgZnVuY3Rpb24gZ2VuZXJhdGVXYXZlZm9ybURhdGEob3B0aW9ucykgewogICAgdmFyIHNjYWxlID0gb3B0aW9ucy5zY2FsZTsKICAgIHZhciBhbXBsaXR1ZGVfc2NhbGUgPSBvcHRpb25zLmFtcGxpdHVkZV9zY2FsZTsKICAgIHZhciBzcGxpdF9jaGFubmVscyA9IG9wdGlvbnMuc3BsaXRfY2hhbm5lbHM7CiAgICB2YXIgbGVuZ3RoID0gb3B0aW9ucy5sZW5ndGg7CiAgICB2YXIgc2FtcGxlX3JhdGUgPSBvcHRpb25zLnNhbXBsZV9yYXRlOwogICAgdmFyIGNoYW5uZWxzID0gb3B0aW9ucy5jaGFubmVscy5tYXAoZnVuY3Rpb24gKGNoYW5uZWwpIHsKICAgICAgcmV0dXJuIG5ldyBGbG9hdDMyQXJyYXkoY2hhbm5lbCk7CiAgICB9KTsKICAgIHZhciBvdXRwdXRfY2hhbm5lbHMgPSBzcGxpdF9jaGFubmVscyA/IGNoYW5uZWxzLmxlbmd0aCA6IDE7CiAgICB2YXIgaGVhZGVyX3NpemUgPSAyNDsKICAgIHZhciBkYXRhX2xlbmd0aCA9IGNhbGN1bGF0ZVdhdmVmb3JtRGF0YUxlbmd0aChsZW5ndGgsIHNjYWxlKTsKICAgIHZhciBieXRlc19wZXJfc2FtcGxlID0gb3B0aW9ucy5iaXRzID09PSA4ID8gMSA6IDI7CiAgICB2YXIgdG90YWxfc2l6ZSA9IGhlYWRlcl9zaXplICsgZGF0YV9sZW5ndGggKiAyICogYnl0ZXNfcGVyX3NhbXBsZSAqIG91dHB1dF9jaGFubmVsczsKICAgIHZhciBidWZmZXIgPSBuZXcgQXJyYXlCdWZmZXIodG90YWxfc2l6ZSk7CiAgICB2YXIgZGF0YV92aWV3ID0gbmV3IERhdGFWaWV3KGJ1ZmZlcik7CiAgICB2YXIgc2NhbGVfY291bnRlciA9IDA7CiAgICB2YXIgb2Zmc2V0ID0gaGVhZGVyX3NpemU7CiAgICB2YXIgbWluX3ZhbHVlID0gbmV3IEFycmF5KG91dHB1dF9jaGFubmVscyk7CiAgICB2YXIgbWF4X3ZhbHVlID0gbmV3IEFycmF5KG91dHB1dF9jaGFubmVscyk7CiAgICBmb3IgKHZhciBjaGFubmVsID0gMDsgY2hhbm5lbCA8IG91dHB1dF9jaGFubmVsczsgY2hhbm5lbCsrKSB7CiAgICAgIG1pbl92YWx1ZVtjaGFubmVsXSA9IEluZmluaXR5OwogICAgICBtYXhfdmFsdWVbY2hhbm5lbF0gPSAtSW5maW5pdHk7CiAgICB9CiAgICB2YXIgcmFuZ2VfbWluID0gb3B0aW9ucy5iaXRzID09PSA4ID8gSU5UOF9NSU4gOiBJTlQxNl9NSU47CiAgICB2YXIgcmFuZ2VfbWF4ID0gb3B0aW9ucy5iaXRzID09PSA4ID8gSU5UOF9NQVggOiBJTlQxNl9NQVg7CiAgICBkYXRhX3ZpZXcuc2V0SW50MzIoMCwgMiwgdHJ1ZSk7IC8vIFZlcnNpb24KICAgIGRhdGFfdmlldy5zZXRVaW50MzIoNCwgb3B0aW9ucy5iaXRzID09PSA4LCB0cnVlKTsgLy8gSXMgOCBiaXQ/CiAgICBkYXRhX3ZpZXcuc2V0SW50MzIoOCwgc2FtcGxlX3JhdGUsIHRydWUpOyAvLyBTYW1wbGUgcmF0ZQogICAgZGF0YV92aWV3LnNldEludDMyKDEyLCBzY2FsZSwgdHJ1ZSk7IC8vIFNjYWxlCiAgICBkYXRhX3ZpZXcuc2V0SW50MzIoMTYsIGRhdGFfbGVuZ3RoLCB0cnVlKTsgLy8gTGVuZ3RoCiAgICBkYXRhX3ZpZXcuc2V0SW50MzIoMjAsIG91dHB1dF9jaGFubmVscywgdHJ1ZSk7CiAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKSB7CiAgICAgIHZhciBzYW1wbGUgPSAwOwogICAgICBpZiAob3V0cHV0X2NoYW5uZWxzID09PSAxKSB7CiAgICAgICAgZm9yICh2YXIgX2NoYW5uZWwgPSAwOyBfY2hhbm5lbCA8IGNoYW5uZWxzLmxlbmd0aDsgKytfY2hhbm5lbCkgewogICAgICAgICAgc2FtcGxlICs9IGNoYW5uZWxzW19jaGFubmVsXVtpXTsKICAgICAgICB9CiAgICAgICAgc2FtcGxlID0gTWF0aC5mbG9vcihyYW5nZV9tYXggKiBzYW1wbGUgKiBhbXBsaXR1ZGVfc2NhbGUgLyBjaGFubmVscy5sZW5ndGgpOwogICAgICAgIGlmIChzYW1wbGUgPCBtaW5fdmFsdWVbMF0pIHsKICAgICAgICAgIG1pbl92YWx1ZVswXSA9IHNhbXBsZTsKICAgICAgICAgIGlmIChtaW5fdmFsdWVbMF0gPCByYW5nZV9taW4pIHsKICAgICAgICAgICAgbWluX3ZhbHVlWzBdID0gcmFuZ2VfbWluOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoc2FtcGxlID4gbWF4X3ZhbHVlWzBdKSB7CiAgICAgICAgICBtYXhfdmFsdWVbMF0gPSBzYW1wbGU7CiAgICAgICAgICBpZiAobWF4X3ZhbHVlWzBdID4gcmFuZ2VfbWF4KSB7CiAgICAgICAgICAgIG1heF92YWx1ZVswXSA9IHJhbmdlX21heDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZm9yICh2YXIgX2NoYW5uZWwyID0gMDsgX2NoYW5uZWwyIDwgb3V0cHV0X2NoYW5uZWxzOyArK19jaGFubmVsMikgewogICAgICAgICAgc2FtcGxlID0gTWF0aC5mbG9vcihyYW5nZV9tYXggKiBjaGFubmVsc1tfY2hhbm5lbDJdW2ldICogYW1wbGl0dWRlX3NjYWxlKTsKICAgICAgICAgIGlmIChzYW1wbGUgPCBtaW5fdmFsdWVbX2NoYW5uZWwyXSkgewogICAgICAgICAgICBtaW5fdmFsdWVbX2NoYW5uZWwyXSA9IHNhbXBsZTsKICAgICAgICAgICAgaWYgKG1pbl92YWx1ZVtfY2hhbm5lbDJdIDwgcmFuZ2VfbWluKSB7CiAgICAgICAgICAgICAgbWluX3ZhbHVlW19jaGFubmVsMl0gPSByYW5nZV9taW47CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzYW1wbGUgPiBtYXhfdmFsdWVbX2NoYW5uZWwyXSkgewogICAgICAgICAgICBtYXhfdmFsdWVbX2NoYW5uZWwyXSA9IHNhbXBsZTsKICAgICAgICAgICAgaWYgKG1heF92YWx1ZVtfY2hhbm5lbDJdID4gcmFuZ2VfbWF4KSB7CiAgICAgICAgICAgICAgbWF4X3ZhbHVlW19jaGFubmVsMl0gPSByYW5nZV9tYXg7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgaWYgKCsrc2NhbGVfY291bnRlciA9PT0gc2NhbGUpIHsKICAgICAgICBmb3IgKHZhciBfY2hhbm5lbDMgPSAwOyBfY2hhbm5lbDMgPCBvdXRwdXRfY2hhbm5lbHM7IF9jaGFubmVsMysrKSB7CiAgICAgICAgICBpZiAob3B0aW9ucy5iaXRzID09PSA4KSB7CiAgICAgICAgICAgIGRhdGFfdmlldy5zZXRJbnQ4KG9mZnNldCsrLCBtaW5fdmFsdWVbX2NoYW5uZWwzXSk7CiAgICAgICAgICAgIGRhdGFfdmlldy5zZXRJbnQ4KG9mZnNldCsrLCBtYXhfdmFsdWVbX2NoYW5uZWwzXSk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBkYXRhX3ZpZXcuc2V0SW50MTYob2Zmc2V0LCBtaW5fdmFsdWVbX2NoYW5uZWwzXSwgdHJ1ZSk7CiAgICAgICAgICAgIGRhdGFfdmlldy5zZXRJbnQxNihvZmZzZXQgKyAyLCBtYXhfdmFsdWVbX2NoYW5uZWwzXSwgdHJ1ZSk7CiAgICAgICAgICAgIG9mZnNldCArPSA0OwogICAgICAgICAgfQogICAgICAgICAgbWluX3ZhbHVlW19jaGFubmVsM10gPSBJbmZpbml0eTsKICAgICAgICAgIG1heF92YWx1ZVtfY2hhbm5lbDNdID0gLUluZmluaXR5OwogICAgICAgIH0KICAgICAgICBzY2FsZV9jb3VudGVyID0gMDsKICAgICAgfQogICAgfQogICAgaWYgKHNjYWxlX2NvdW50ZXIgPiAwKSB7CiAgICAgIGZvciAodmFyIF9jaGFubmVsNCA9IDA7IF9jaGFubmVsNCA8IG91dHB1dF9jaGFubmVsczsgX2NoYW5uZWw0KyspIHsKICAgICAgICBpZiAob3B0aW9ucy5iaXRzID09PSA4KSB7CiAgICAgICAgICBkYXRhX3ZpZXcuc2V0SW50OChvZmZzZXQrKywgbWluX3ZhbHVlW19jaGFubmVsNF0pOwogICAgICAgICAgZGF0YV92aWV3LnNldEludDgob2Zmc2V0KyssIG1heF92YWx1ZVtfY2hhbm5lbDRdKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgZGF0YV92aWV3LnNldEludDE2KG9mZnNldCwgbWluX3ZhbHVlW19jaGFubmVsNF0sIHRydWUpOwogICAgICAgICAgZGF0YV92aWV3LnNldEludDE2KG9mZnNldCArIDIsIG1heF92YWx1ZVtfY2hhbm5lbDRdLCB0cnVlKTsKICAgICAgICB9CiAgICAgIH0KICAgIH0KICAgIHJldHVybiBidWZmZXI7CiAgfQoKICBvbm1lc3NhZ2UgPSBmdW5jdGlvbiBvbm1lc3NhZ2UoZXZ0KSB7CiAgICB2YXIgYnVmZmVyID0gZ2VuZXJhdGVXYXZlZm9ybURhdGEoZXZ0LmRhdGEpOwoKICAgIC8vIFRyYW5zZmVyIGJ1ZmZlciB0byB0aGUgY2FsbGluZyB0aHJlYWQKICAgIHRoaXMucG9zdE1lc3NhZ2UoYnVmZmVyLCBbYnVmZmVyXSk7CiAgICB0aGlzLmNsb3NlKCk7CiAgfTsKCn0pKCk7Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPXdhdmVmb3JtLWRhdGEtd29ya2VyLmpzLm1hcAoK");
|
|
2518
|
-
function
|
|
2518
|
+
function Ve(e) {
|
|
2519
2519
|
if (Vo(e) && (e = zo(e)), Po(e)) {
|
|
2520
2520
|
this._data = new DataView(e), this._offset = this._version() === 2 ? 24 : 20, this._channels = [];
|
|
2521
2521
|
for (var t = 0; t < this.channels; t++)
|
|
@@ -2557,11 +2557,11 @@ function qn(e, t, n) {
|
|
|
2557
2557
|
sample_rate: e.sampleRate,
|
|
2558
2558
|
channels: r
|
|
2559
2559
|
});
|
|
2560
|
-
n(void 0, new
|
|
2560
|
+
n(void 0, new Ve(a), e);
|
|
2561
2561
|
} else {
|
|
2562
2562
|
var s = new No();
|
|
2563
2563
|
s.onmessage = function(o) {
|
|
2564
|
-
n(void 0, new
|
|
2564
|
+
n(void 0, new Ve(o.data), e);
|
|
2565
2565
|
}, s.postMessage({
|
|
2566
2566
|
scale: t.scale,
|
|
2567
2567
|
bits: t.bits,
|
|
@@ -2583,10 +2583,10 @@ function Oo(e, t, n, r) {
|
|
|
2583
2583
|
}, a);
|
|
2584
2584
|
s && s.catch(a);
|
|
2585
2585
|
}
|
|
2586
|
-
|
|
2587
|
-
return new
|
|
2586
|
+
Ve.create = function(t) {
|
|
2587
|
+
return new Ve(t);
|
|
2588
2588
|
};
|
|
2589
|
-
|
|
2589
|
+
Ve.createFromAudio = function(e, t) {
|
|
2590
2590
|
var n = Lo(e);
|
|
2591
2591
|
if (e.audio_context && e.array_buffer)
|
|
2592
2592
|
return Oo(e.audio_context, e.array_buffer, n, t);
|
|
@@ -2600,7 +2600,7 @@ Ze.createFromAudio = function(e, t) {
|
|
|
2600
2600
|
function Wt(e) {
|
|
2601
2601
|
this._inputData = e.waveformData, this._output_samples_per_pixel = e.scale, this._scale = this._inputData.scale, this._input_buffer_size = this._inputData.length;
|
|
2602
2602
|
var t = this._input_buffer_size * this._inputData.scale, n = Math.ceil(t / this._output_samples_per_pixel), r = 24, a = this._inputData.bits === 8 ? 1 : 2, s = r + n * 2 * this._inputData.channels * a;
|
|
2603
|
-
this._output_data = new ArrayBuffer(s), this.output_dataview = new DataView(this._output_data), this.output_dataview.setInt32(0, 2, !0), this.output_dataview.setUint32(4, this._inputData.bits === 8, !0), this.output_dataview.setInt32(8, this._inputData.sample_rate, !0), this.output_dataview.setInt32(12, this._output_samples_per_pixel, !0), this.output_dataview.setInt32(16, n, !0), this.output_dataview.setInt32(20, this._inputData.channels, !0), this._outputWaveformData = new
|
|
2603
|
+
this._output_data = new ArrayBuffer(s), this.output_dataview = new DataView(this._output_data), this.output_dataview.setInt32(0, 2, !0), this.output_dataview.setUint32(4, this._inputData.bits === 8, !0), this.output_dataview.setInt32(8, this._inputData.sample_rate, !0), this.output_dataview.setInt32(12, this._output_samples_per_pixel, !0), this.output_dataview.setInt32(16, n, !0), this.output_dataview.setInt32(20, this._inputData.channels, !0), this._outputWaveformData = new Ve(this._output_data), this._input_index = 0, this._output_index = 0;
|
|
2604
2604
|
var o = this._inputData.channels;
|
|
2605
2605
|
this._min = new Array(o), this._max = new Array(o);
|
|
2606
2606
|
for (var i = 0; i < o; ++i)
|
|
@@ -2640,7 +2640,7 @@ Wt.prototype.next = function() {
|
|
|
2640
2640
|
Wt.prototype.getOutputData = function() {
|
|
2641
2641
|
return this._output_data;
|
|
2642
2642
|
};
|
|
2643
|
-
|
|
2643
|
+
Ve.prototype = {
|
|
2644
2644
|
_getResampleOptions: function(t) {
|
|
2645
2645
|
var n = {};
|
|
2646
2646
|
if (n.scale = t.scale, n.width = t.width, !ut(n.width) && (typeof n.width != "number" || n.width <= 0))
|
|
@@ -2657,7 +2657,7 @@ Ze.prototype = {
|
|
|
2657
2657
|
t = this._getResampleOptions(t), t.waveformData = this;
|
|
2658
2658
|
for (var n = new Wt(t); !n.next(); )
|
|
2659
2659
|
;
|
|
2660
|
-
return new
|
|
2660
|
+
return new Ve(n.getOutputData());
|
|
2661
2661
|
},
|
|
2662
2662
|
/**
|
|
2663
2663
|
* Concatenates with one or more other waveforms, returning a new WaveformData object.
|
|
@@ -2669,7 +2669,7 @@ Ze.prototype = {
|
|
|
2669
2669
|
throw new Error("WaveformData.concat(): Waveforms are incompatible");
|
|
2670
2670
|
});
|
|
2671
2671
|
var r = this._concatBuffers.apply(this, n);
|
|
2672
|
-
return
|
|
2672
|
+
return Ve.create(r);
|
|
2673
2673
|
},
|
|
2674
2674
|
/**
|
|
2675
2675
|
* Returns a new ArrayBuffer with the concatenated waveform.
|
|
@@ -2704,7 +2704,7 @@ Ze.prototype = {
|
|
|
2704
2704
|
var g = this._at(n * this.channels * 2 + u);
|
|
2705
2705
|
this.bits === 8 ? c.setInt8(s + u, g) : c.setInt16(s + u * 2, g, !0);
|
|
2706
2706
|
}
|
|
2707
|
-
return new
|
|
2707
|
+
return new Ve(l);
|
|
2708
2708
|
},
|
|
2709
2709
|
/**
|
|
2710
2710
|
* Returns the data format version number.
|
|
@@ -2823,10 +2823,10 @@ async function er(e) {
|
|
|
2823
2823
|
throw new Error(`Failed to fetch waveform data: ${t.statusText}`);
|
|
2824
2824
|
if (e.endsWith(".dat")) {
|
|
2825
2825
|
const r = await t.arrayBuffer();
|
|
2826
|
-
return
|
|
2826
|
+
return Ve.create(r);
|
|
2827
2827
|
} else {
|
|
2828
2828
|
const r = await t.json();
|
|
2829
|
-
return
|
|
2829
|
+
return Ve.create(r);
|
|
2830
2830
|
}
|
|
2831
2831
|
}
|
|
2832
2832
|
function Ko(e, t = 0) {
|
|
@@ -3027,11 +3027,11 @@ var jo = S.div.attrs((e) => ({
|
|
|
3027
3027
|
`, Cn = S.div`
|
|
3028
3028
|
position: absolute;
|
|
3029
3029
|
top: 0;
|
|
3030
|
-
${(e) => e.$position === "left" ? "left:
|
|
3031
|
-
width:
|
|
3030
|
+
${(e) => e.$position === "left" ? "left: 0" : "right: 0"};
|
|
3031
|
+
width: 8px;
|
|
3032
3032
|
height: 100%;
|
|
3033
3033
|
cursor: ew-resize;
|
|
3034
|
-
z-index: 120;
|
|
3034
|
+
z-index: 120;
|
|
3035
3035
|
background: ${(e) => e.$isDragging ? e.theme?.annotationResizeHandleColor || "rgba(0, 0, 0, 0.2)" : "transparent"};
|
|
3036
3036
|
border-radius: 4px;
|
|
3037
3037
|
touch-action: none; /* Important for @dnd-kit on touch devices */
|
|
@@ -3083,7 +3083,7 @@ var jo = S.div.attrs((e) => ({
|
|
|
3083
3083
|
attributes: m,
|
|
3084
3084
|
listeners: p,
|
|
3085
3085
|
setActivatorNodeRef: x,
|
|
3086
|
-
isDragging:
|
|
3086
|
+
isDragging: w
|
|
3087
3087
|
} = bt({
|
|
3088
3088
|
id: y,
|
|
3089
3089
|
data: { annotationId: e, annotationIndex: t, edge: "end" },
|
|
@@ -3091,12 +3091,12 @@ var jo = S.div.attrs((e) => ({
|
|
|
3091
3091
|
});
|
|
3092
3092
|
if (c <= 0)
|
|
3093
3093
|
return null;
|
|
3094
|
-
const f = (
|
|
3095
|
-
|
|
3096
|
-
},
|
|
3097
|
-
|
|
3094
|
+
const f = (v) => (k) => {
|
|
3095
|
+
k.stopPropagation(), v?.(k);
|
|
3096
|
+
}, C = (v) => {
|
|
3097
|
+
v.stopPropagation();
|
|
3098
3098
|
};
|
|
3099
|
-
return /* @__PURE__ */
|
|
3099
|
+
return /* @__PURE__ */ ne(jo, { $left: n, $width: c, children: [
|
|
3100
3100
|
/* @__PURE__ */ I(
|
|
3101
3101
|
Jo,
|
|
3102
3102
|
{
|
|
@@ -3112,7 +3112,7 @@ var jo = S.div.attrs((e) => ({
|
|
|
3112
3112
|
ref: d,
|
|
3113
3113
|
$position: "left",
|
|
3114
3114
|
$isDragging: b,
|
|
3115
|
-
onClick:
|
|
3115
|
+
onClick: C,
|
|
3116
3116
|
...h,
|
|
3117
3117
|
onPointerDown: f(h?.onPointerDown),
|
|
3118
3118
|
...g
|
|
@@ -3123,8 +3123,8 @@ var jo = S.div.attrs((e) => ({
|
|
|
3123
3123
|
{
|
|
3124
3124
|
ref: x,
|
|
3125
3125
|
$position: "right",
|
|
3126
|
-
$isDragging:
|
|
3127
|
-
onClick:
|
|
3126
|
+
$isDragging: w,
|
|
3127
|
+
onClick: C,
|
|
3128
3128
|
...p,
|
|
3129
3129
|
onPointerDown: f(p?.onPointerDown),
|
|
3130
3130
|
...m
|
|
@@ -3163,7 +3163,7 @@ var jo = S.div.attrs((e) => ({
|
|
|
3163
3163
|
const {
|
|
3164
3164
|
controls: { show: s, width: o }
|
|
3165
3165
|
} = vt();
|
|
3166
|
-
return /* @__PURE__ */
|
|
3166
|
+
return /* @__PURE__ */ ne(
|
|
3167
3167
|
qo,
|
|
3168
3168
|
{
|
|
3169
3169
|
className: t,
|
|
@@ -3311,15 +3311,15 @@ var ns = S.div`
|
|
|
3311
3311
|
onAnnotationUpdate: u,
|
|
3312
3312
|
renderAnnotationItem: g
|
|
3313
3313
|
}) => {
|
|
3314
|
-
const h =
|
|
3315
|
-
|
|
3316
|
-
}),
|
|
3314
|
+
const h = T(null), d = T(null), b = T(void 0);
|
|
3315
|
+
U(() => {
|
|
3316
|
+
}), U(() => {
|
|
3317
3317
|
const f = d.current;
|
|
3318
3318
|
if (!f) return;
|
|
3319
|
-
const
|
|
3319
|
+
const C = () => {
|
|
3320
3320
|
};
|
|
3321
|
-
return f.addEventListener("scroll",
|
|
3322
|
-
}, []),
|
|
3321
|
+
return f.addEventListener("scroll", C), () => f.removeEventListener("scroll", C);
|
|
3322
|
+
}, []), U(() => {
|
|
3323
3323
|
t && h.current && n && h.current.scrollIntoView({
|
|
3324
3324
|
behavior: "smooth",
|
|
3325
3325
|
block: r,
|
|
@@ -3329,78 +3329,78 @@ var ns = S.div`
|
|
|
3329
3329
|
const y = (f) => {
|
|
3330
3330
|
if (isNaN(f) || !isFinite(f))
|
|
3331
3331
|
return "0:00.000";
|
|
3332
|
-
const
|
|
3333
|
-
return `${
|
|
3334
|
-
}, m = (f,
|
|
3332
|
+
const C = Math.floor(f / 60), v = (f % 60).toFixed(3);
|
|
3333
|
+
return `${C}:${v.padStart(6, "0")}`;
|
|
3334
|
+
}, m = (f, C) => {
|
|
3335
3335
|
if (!s || !u) return;
|
|
3336
|
-
const
|
|
3337
|
-
|
|
3338
|
-
...
|
|
3339
|
-
lines:
|
|
3336
|
+
const v = [...e];
|
|
3337
|
+
v[f] = {
|
|
3338
|
+
...v[f],
|
|
3339
|
+
lines: C.split(`
|
|
3340
3340
|
`)
|
|
3341
|
-
}, u(
|
|
3342
|
-
}, p = (f,
|
|
3341
|
+
}, u(v);
|
|
3342
|
+
}, p = (f, C) => {
|
|
3343
3343
|
if (!s || !u) return;
|
|
3344
|
-
const
|
|
3345
|
-
if (!
|
|
3346
|
-
const
|
|
3347
|
-
|
|
3348
|
-
...
|
|
3349
|
-
id:
|
|
3350
|
-
}, u(
|
|
3351
|
-
}, x = (f,
|
|
3344
|
+
const v = C.trim();
|
|
3345
|
+
if (!v) return;
|
|
3346
|
+
const k = [...e];
|
|
3347
|
+
k[f] = {
|
|
3348
|
+
...k[f],
|
|
3349
|
+
id: v
|
|
3350
|
+
}, u(k);
|
|
3351
|
+
}, x = (f, C, v) => {
|
|
3352
3352
|
if (!u) return;
|
|
3353
|
-
const
|
|
3354
|
-
f.action(
|
|
3355
|
-
},
|
|
3356
|
-
return /* @__PURE__ */ I(ns, { ref: d, $height: l, children: e.map((f,
|
|
3357
|
-
const
|
|
3353
|
+
const k = [...e];
|
|
3354
|
+
f.action(k[v], v, k, i || {}), u(k);
|
|
3355
|
+
}, w = (f) => f.replace(/\./g, " ");
|
|
3356
|
+
return /* @__PURE__ */ I(ns, { ref: d, $height: l, children: e.map((f, C) => {
|
|
3357
|
+
const v = f.id === t, k = () => c?.(f);
|
|
3358
3358
|
return g ? /* @__PURE__ */ I(
|
|
3359
3359
|
"div",
|
|
3360
3360
|
{
|
|
3361
|
-
ref:
|
|
3361
|
+
ref: v ? h : null,
|
|
3362
3362
|
children: g({
|
|
3363
3363
|
annotation: f,
|
|
3364
|
-
index:
|
|
3365
|
-
isActive:
|
|
3366
|
-
onClick:
|
|
3364
|
+
index: C,
|
|
3365
|
+
isActive: v,
|
|
3366
|
+
onClick: k,
|
|
3367
3367
|
formatTime: y
|
|
3368
3368
|
})
|
|
3369
3369
|
},
|
|
3370
3370
|
f.id
|
|
3371
|
-
) : /* @__PURE__ */
|
|
3371
|
+
) : /* @__PURE__ */ ne(
|
|
3372
3372
|
rs,
|
|
3373
3373
|
{
|
|
3374
|
-
ref:
|
|
3375
|
-
$isActive:
|
|
3376
|
-
onClick:
|
|
3374
|
+
ref: v ? h : null,
|
|
3375
|
+
$isActive: v,
|
|
3376
|
+
onClick: k,
|
|
3377
3377
|
children: [
|
|
3378
|
-
/* @__PURE__ */
|
|
3379
|
-
/* @__PURE__ */
|
|
3378
|
+
/* @__PURE__ */ ne(as, { children: [
|
|
3379
|
+
/* @__PURE__ */ ne(os, { children: [
|
|
3380
3380
|
/* @__PURE__ */ I(
|
|
3381
3381
|
ss,
|
|
3382
3382
|
{
|
|
3383
3383
|
$isEditable: s,
|
|
3384
3384
|
contentEditable: s,
|
|
3385
3385
|
suppressContentEditableWarning: !0,
|
|
3386
|
-
onBlur: (
|
|
3386
|
+
onBlur: (B) => p(C, B.currentTarget.textContent || ""),
|
|
3387
3387
|
children: f.id
|
|
3388
3388
|
}
|
|
3389
3389
|
),
|
|
3390
|
-
/* @__PURE__ */
|
|
3390
|
+
/* @__PURE__ */ ne(is, { children: [
|
|
3391
3391
|
y(f.start),
|
|
3392
3392
|
" - ",
|
|
3393
3393
|
y(f.end)
|
|
3394
3394
|
] })
|
|
3395
3395
|
] }),
|
|
3396
|
-
o.length > 0 && /* @__PURE__ */ I(ls, { onClick: (
|
|
3396
|
+
o.length > 0 && /* @__PURE__ */ I(ls, { onClick: (B) => B.stopPropagation(), children: o.map((B, $) => /* @__PURE__ */ I(
|
|
3397
3397
|
cs,
|
|
3398
3398
|
{
|
|
3399
|
-
title:
|
|
3400
|
-
onClick: () => x(
|
|
3401
|
-
children:
|
|
3399
|
+
title: B.title,
|
|
3400
|
+
onClick: () => x(B, f, C),
|
|
3401
|
+
children: B.text ? B.text : /* @__PURE__ */ I("i", { className: w(B.class || "") })
|
|
3402
3402
|
},
|
|
3403
|
-
|
|
3403
|
+
$
|
|
3404
3404
|
)) })
|
|
3405
3405
|
] }),
|
|
3406
3406
|
/* @__PURE__ */ I(
|
|
@@ -3409,7 +3409,7 @@ var ns = S.div`
|
|
|
3409
3409
|
$isEditable: s,
|
|
3410
3410
|
contentEditable: s,
|
|
3411
3411
|
suppressContentEditableWarning: !0,
|
|
3412
|
-
onBlur: (
|
|
3412
|
+
onBlur: (B) => m(C, B.currentTarget.textContent || ""),
|
|
3413
3413
|
children: f.lines.join(`
|
|
3414
3414
|
`)
|
|
3415
3415
|
}
|
|
@@ -3419,12 +3419,12 @@ var ns = S.div`
|
|
|
3419
3419
|
f.id
|
|
3420
3420
|
);
|
|
3421
3421
|
}) });
|
|
3422
|
-
}, or =
|
|
3422
|
+
}, or = Fe.memo(ds), ms = ({
|
|
3423
3423
|
checked: e,
|
|
3424
3424
|
onChange: t,
|
|
3425
3425
|
disabled: n = !1,
|
|
3426
3426
|
className: r
|
|
3427
|
-
}) => /* @__PURE__ */
|
|
3427
|
+
}) => /* @__PURE__ */ ne(Dt, { className: r, children: [
|
|
3428
3428
|
/* @__PURE__ */ I(
|
|
3429
3429
|
Tt,
|
|
3430
3430
|
{
|
|
@@ -3444,7 +3444,7 @@ var ns = S.div`
|
|
|
3444
3444
|
onChange: t,
|
|
3445
3445
|
disabled: n = !1,
|
|
3446
3446
|
className: r
|
|
3447
|
-
}) => /* @__PURE__ */
|
|
3447
|
+
}) => /* @__PURE__ */ ne(Dt, { className: r, children: [
|
|
3448
3448
|
/* @__PURE__ */ I(
|
|
3449
3449
|
Tt,
|
|
3450
3450
|
{
|
|
@@ -3463,7 +3463,7 @@ var ns = S.div`
|
|
|
3463
3463
|
checked: e,
|
|
3464
3464
|
onChange: t,
|
|
3465
3465
|
className: n
|
|
3466
|
-
}) => /* @__PURE__ */
|
|
3466
|
+
}) => /* @__PURE__ */ ne(Dt, { className: n, children: [
|
|
3467
3467
|
/* @__PURE__ */ I(
|
|
3468
3468
|
Tt,
|
|
3469
3469
|
{
|
|
@@ -3522,7 +3522,7 @@ var ns = S.div`
|
|
|
3522
3522
|
}
|
|
3523
3523
|
);
|
|
3524
3524
|
function bs() {
|
|
3525
|
-
const [e, t] =
|
|
3525
|
+
const [e, t] = R("hh:mm:ss.uuu");
|
|
3526
3526
|
return {
|
|
3527
3527
|
timeFormat: e,
|
|
3528
3528
|
setTimeFormat: t,
|
|
@@ -3535,7 +3535,7 @@ function ws({
|
|
|
3535
3535
|
initialSamplesPerPixel: e,
|
|
3536
3536
|
zoomLevels: t = vs
|
|
3537
3537
|
}) {
|
|
3538
|
-
const [n, r] =
|
|
3538
|
+
const [n, r] = R(() => {
|
|
3539
3539
|
const c = t.indexOf(e);
|
|
3540
3540
|
return c !== -1 ? c : Math.floor(t.length / 2);
|
|
3541
3541
|
}), a = t[n], s = n > 0, o = n < t.length - 1, i = D(() => {
|
|
@@ -3556,7 +3556,7 @@ function ys({
|
|
|
3556
3556
|
initialVolume: t = 1,
|
|
3557
3557
|
onVolumeChange: n
|
|
3558
3558
|
}) {
|
|
3559
|
-
const [r, a] =
|
|
3559
|
+
const [r, a] = R(t), s = D((o) => {
|
|
3560
3560
|
a(o), e.current && e.current.setMasterGain(o), n?.(o);
|
|
3561
3561
|
}, [e, n]);
|
|
3562
3562
|
return {
|
|
@@ -3565,7 +3565,7 @@ function ys({
|
|
|
3565
3565
|
};
|
|
3566
3566
|
}
|
|
3567
3567
|
const wi = (e = 256) => {
|
|
3568
|
-
const t =
|
|
3568
|
+
const t = T(null), n = D((r, a, s) => {
|
|
3569
3569
|
const o = new Dn("fft", e);
|
|
3570
3570
|
return r.connect(o), r.connect(a), t.current = o, function() {
|
|
3571
3571
|
o.dispose(), t.current = null;
|
|
@@ -3672,21 +3672,21 @@ function sr() {
|
|
|
3672
3672
|
return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
3673
3673
|
}
|
|
3674
3674
|
function yi(e, t = {}) {
|
|
3675
|
-
const { progressive: n = !1 } = t, [r, a] =
|
|
3676
|
-
return
|
|
3675
|
+
const { progressive: n = !1 } = t, [r, a] = R([]), [s, o] = R(!0), [i, l] = R(null), [c, u] = R(0), g = e.length;
|
|
3676
|
+
return U(() => {
|
|
3677
3677
|
if (e.length === 0) {
|
|
3678
3678
|
a([]), o(!1), u(0);
|
|
3679
3679
|
return;
|
|
3680
3680
|
}
|
|
3681
3681
|
let h = !1;
|
|
3682
3682
|
const d = /* @__PURE__ */ new Map(), b = (m, p, x) => {
|
|
3683
|
-
const
|
|
3684
|
-
if (!
|
|
3683
|
+
const w = x ?? m.audioBuffer;
|
|
3684
|
+
if (!w && !m.waveformData)
|
|
3685
3685
|
throw new Error(
|
|
3686
3686
|
`Track ${p + 1}: Must provide src, audioBuffer, or waveformData`
|
|
3687
3687
|
);
|
|
3688
|
-
const f =
|
|
3689
|
-
audioBuffer:
|
|
3688
|
+
const f = w?.duration ?? m.waveformData?.duration, C = Cs({
|
|
3689
|
+
audioBuffer: w,
|
|
3690
3690
|
startTime: m.startTime ?? 0,
|
|
3691
3691
|
duration: m.duration ?? f,
|
|
3692
3692
|
offset: m.offset ?? 0,
|
|
@@ -3695,12 +3695,12 @@ function yi(e, t = {}) {
|
|
|
3695
3695
|
fadeOut: m.fadeOut,
|
|
3696
3696
|
waveformData: m.waveformData
|
|
3697
3697
|
});
|
|
3698
|
-
if (isNaN(
|
|
3699
|
-
throw console.error("Invalid clip values:",
|
|
3698
|
+
if (isNaN(C.startSample) || isNaN(C.durationSamples) || isNaN(C.offsetSamples))
|
|
3699
|
+
throw console.error("Invalid clip values:", C), new Error(`Invalid clip values for track ${p + 1}`);
|
|
3700
3700
|
return {
|
|
3701
3701
|
...xs({
|
|
3702
3702
|
name: m.name || `Track ${p + 1}`,
|
|
3703
|
-
clips: [
|
|
3703
|
+
clips: [C],
|
|
3704
3704
|
muted: m.muted ?? !1,
|
|
3705
3705
|
soloed: m.soloed ?? !1,
|
|
3706
3706
|
volume: m.volume ?? 1,
|
|
@@ -3713,31 +3713,31 @@ function yi(e, t = {}) {
|
|
|
3713
3713
|
return (async () => {
|
|
3714
3714
|
try {
|
|
3715
3715
|
o(!0), l(null), u(0);
|
|
3716
|
-
const m = _r.getContext().rawContext, p = e.map(async (
|
|
3717
|
-
if (
|
|
3718
|
-
const
|
|
3719
|
-
return n && !h && (d.set(f,
|
|
3720
|
-
Array.from({ length: e.length }, (
|
|
3721
|
-
)),
|
|
3716
|
+
const m = _r.getContext().rawContext, p = e.map(async (w, f) => {
|
|
3717
|
+
if (w.audioBuffer) {
|
|
3718
|
+
const $ = b(w, f, w.audioBuffer);
|
|
3719
|
+
return n && !h && (d.set(f, $), u((A) => A + 1), a(
|
|
3720
|
+
Array.from({ length: e.length }, (A, M) => d.get(M)).filter((A) => A !== void 0)
|
|
3721
|
+
)), $;
|
|
3722
3722
|
}
|
|
3723
|
-
if (!
|
|
3724
|
-
const
|
|
3725
|
-
return n && !h && (d.set(f,
|
|
3726
|
-
Array.from({ length: e.length }, (
|
|
3727
|
-
)),
|
|
3723
|
+
if (!w.src && w.waveformData) {
|
|
3724
|
+
const $ = b(w, f);
|
|
3725
|
+
return n && !h && (d.set(f, $), u((A) => A + 1), a(
|
|
3726
|
+
Array.from({ length: e.length }, (A, M) => d.get(M)).filter((A) => A !== void 0)
|
|
3727
|
+
)), $;
|
|
3728
3728
|
}
|
|
3729
|
-
if (!
|
|
3729
|
+
if (!w.src)
|
|
3730
3730
|
throw new Error(`Track ${f + 1}: Must provide src, audioBuffer, or waveformData`);
|
|
3731
|
-
const
|
|
3732
|
-
if (!
|
|
3733
|
-
throw new Error(`Failed to fetch ${
|
|
3734
|
-
const
|
|
3735
|
-
if (!
|
|
3736
|
-
throw new Error(`Invalid audio buffer for ${
|
|
3737
|
-
const
|
|
3738
|
-
return n && !h && (d.set(f,
|
|
3739
|
-
Array.from({ length: e.length }, (
|
|
3740
|
-
)),
|
|
3731
|
+
const C = await fetch(w.src);
|
|
3732
|
+
if (!C.ok)
|
|
3733
|
+
throw new Error(`Failed to fetch ${w.src}: ${C.statusText}`);
|
|
3734
|
+
const v = await C.arrayBuffer(), k = await m.decodeAudioData(v);
|
|
3735
|
+
if (!k || !k.sampleRate || !k.duration)
|
|
3736
|
+
throw new Error(`Invalid audio buffer for ${w.src}`);
|
|
3737
|
+
const B = b(w, f, k);
|
|
3738
|
+
return n && !h && (d.set(f, B), u(($) => $ + 1), a(
|
|
3739
|
+
Array.from({ length: e.length }, ($, A) => d.get(A)).filter(($) => $ !== void 0)
|
|
3740
|
+
)), B;
|
|
3741
3741
|
}), x = await Promise.all(p);
|
|
3742
3742
|
h || (n || (a(x), u(x.length)), o(!1));
|
|
3743
3743
|
} catch (m) {
|
|
@@ -3757,7 +3757,7 @@ function Ci({
|
|
|
3757
3757
|
samplesPerPixel: n,
|
|
3758
3758
|
sampleRate: r
|
|
3759
3759
|
}) {
|
|
3760
|
-
const a =
|
|
3760
|
+
const a = Fe.useRef(null), s = Fe.useCallback(
|
|
3761
3761
|
(c) => {
|
|
3762
3762
|
const { transform: u, active: g } = c;
|
|
3763
3763
|
if (!g?.data?.current) return { ...u, scaleX: 1, scaleY: 1 };
|
|
@@ -3768,30 +3768,30 @@ function Ci({
|
|
|
3768
3768
|
if (!y) return { ...u, scaleX: 1, scaleY: 1 };
|
|
3769
3769
|
const m = y.clips[d];
|
|
3770
3770
|
if (!m) return { ...u, scaleX: 1, scaleY: 1 };
|
|
3771
|
-
const p = m.startSample / r, x = m.durationSamples / r,
|
|
3772
|
-
let f = p +
|
|
3773
|
-
const
|
|
3771
|
+
const p = m.startSample / r, x = m.durationSamples / r, w = u.x * n / r;
|
|
3772
|
+
let f = p + w;
|
|
3773
|
+
const C = [...y.clips].sort((M, _) => M.startSample - _.startSample), v = C.findIndex((M) => M === m);
|
|
3774
3774
|
f = Math.max(0, f);
|
|
3775
|
-
const
|
|
3776
|
-
if (
|
|
3777
|
-
const M = (
|
|
3775
|
+
const k = v > 0 ? C[v - 1] : null;
|
|
3776
|
+
if (k) {
|
|
3777
|
+
const M = (k.startSample + k.durationSamples) / r;
|
|
3778
3778
|
f = Math.max(f, M);
|
|
3779
3779
|
}
|
|
3780
|
-
const
|
|
3781
|
-
if (
|
|
3782
|
-
const M = f + x, _ =
|
|
3780
|
+
const B = v < C.length - 1 ? C[v + 1] : null;
|
|
3781
|
+
if (B) {
|
|
3782
|
+
const M = f + x, _ = B.startSample / r;
|
|
3783
3783
|
M > _ && (f = _ - x);
|
|
3784
3784
|
}
|
|
3785
|
-
const
|
|
3785
|
+
const A = (f - p) * r / n;
|
|
3786
3786
|
return {
|
|
3787
3787
|
...u,
|
|
3788
|
-
x:
|
|
3788
|
+
x: A,
|
|
3789
3789
|
scaleX: 1,
|
|
3790
3790
|
scaleY: 1
|
|
3791
3791
|
};
|
|
3792
3792
|
},
|
|
3793
3793
|
[e, n, r]
|
|
3794
|
-
), o =
|
|
3794
|
+
), o = Fe.useCallback(
|
|
3795
3795
|
(c) => {
|
|
3796
3796
|
const { active: u } = c, { boundary: g } = u.data.current;
|
|
3797
3797
|
if (!g) {
|
|
@@ -3806,48 +3806,48 @@ function Ci({
|
|
|
3806
3806
|
});
|
|
3807
3807
|
},
|
|
3808
3808
|
[e]
|
|
3809
|
-
), i =
|
|
3809
|
+
), i = Fe.useCallback(
|
|
3810
3810
|
(c) => {
|
|
3811
3811
|
const { active: u, delta: g } = c, { boundary: h } = u.data.current;
|
|
3812
3812
|
if (!h || !a.current) return;
|
|
3813
|
-
const { trackIndex: d, clipIndex: b } = u.data.current, y = g.x * n, m = Math.floor(0.1 * r), p = a.current, x = e.map((
|
|
3814
|
-
if (f !== d) return
|
|
3815
|
-
const
|
|
3816
|
-
if (
|
|
3817
|
-
const
|
|
3813
|
+
const { trackIndex: d, clipIndex: b } = u.data.current, y = g.x * n, m = Math.floor(0.1 * r), p = a.current, x = e.map((w, f) => {
|
|
3814
|
+
if (f !== d) return w;
|
|
3815
|
+
const C = [...w.clips].sort((B, $) => B.startSample - $.startSample), v = C.findIndex((B) => B === w.clips[b]), k = w.clips.map((B, $) => {
|
|
3816
|
+
if ($ !== b) return B;
|
|
3817
|
+
const A = B.sourceDurationSamples;
|
|
3818
3818
|
if (h === "left") {
|
|
3819
3819
|
let M = Math.floor(y);
|
|
3820
3820
|
const _ = -p.startSample;
|
|
3821
3821
|
M < _ && (M = _);
|
|
3822
|
-
const
|
|
3823
|
-
M <
|
|
3824
|
-
const
|
|
3825
|
-
if (
|
|
3826
|
-
const
|
|
3827
|
-
M <
|
|
3822
|
+
const E = -p.offsetSamples;
|
|
3823
|
+
M < E && (M = E);
|
|
3824
|
+
const V = v > 0 ? C[v - 1] : null;
|
|
3825
|
+
if (V) {
|
|
3826
|
+
const Q = V.startSample + V.durationSamples - p.startSample;
|
|
3827
|
+
M < Q && (M = Q);
|
|
3828
3828
|
}
|
|
3829
|
-
const
|
|
3830
|
-
M >
|
|
3831
|
-
const
|
|
3829
|
+
const z = p.durationSamples - m;
|
|
3830
|
+
M > z && (M = z);
|
|
3831
|
+
const P = p.offsetSamples + M, K = p.durationSamples - M, X = p.startSample + M;
|
|
3832
3832
|
return {
|
|
3833
|
-
|
|
3834
|
-
offsetSamples:
|
|
3835
|
-
durationSamples:
|
|
3836
|
-
startSample:
|
|
3833
|
+
...B,
|
|
3834
|
+
offsetSamples: P,
|
|
3835
|
+
durationSamples: K,
|
|
3836
|
+
startSample: X
|
|
3837
3837
|
};
|
|
3838
3838
|
} else {
|
|
3839
3839
|
let M = Math.floor(p.durationSamples + y);
|
|
3840
|
-
M = Math.max(m, M), p.offsetSamples + M >
|
|
3841
|
-
const _ =
|
|
3842
|
-
return _ && p.startSample + M > _.startSample && (M = _.startSample - p.startSample, M = Math.max(m, M)), {
|
|
3840
|
+
M = Math.max(m, M), p.offsetSamples + M > A && (M = A - p.offsetSamples);
|
|
3841
|
+
const _ = v < C.length - 1 ? C[v + 1] : null;
|
|
3842
|
+
return _ && p.startSample + M > _.startSample && (M = _.startSample - p.startSample, M = Math.max(m, M)), { ...B, durationSamples: M };
|
|
3843
3843
|
}
|
|
3844
3844
|
});
|
|
3845
|
-
return { ...
|
|
3845
|
+
return { ...w, clips: k };
|
|
3846
3846
|
});
|
|
3847
3847
|
t(x);
|
|
3848
3848
|
},
|
|
3849
3849
|
[e, t, n, r]
|
|
3850
|
-
), l =
|
|
3850
|
+
), l = Fe.useCallback(
|
|
3851
3851
|
(c) => {
|
|
3852
3852
|
const { active: u, delta: g } = c, { trackIndex: h, clipIndex: d, boundary: b } = u.data.current, y = g.x * n;
|
|
3853
3853
|
if (b) {
|
|
@@ -3856,24 +3856,24 @@ function Ci({
|
|
|
3856
3856
|
}
|
|
3857
3857
|
const m = e.map((p, x) => {
|
|
3858
3858
|
if (x !== h) return p;
|
|
3859
|
-
const
|
|
3860
|
-
if (
|
|
3861
|
-
let
|
|
3862
|
-
|
|
3863
|
-
const
|
|
3864
|
-
if (
|
|
3865
|
-
const M =
|
|
3866
|
-
|
|
3859
|
+
const w = [...p.clips].sort((v, k) => v.startSample - k.startSample), f = w.findIndex((v) => v === p.clips[d]), C = p.clips.map((v, k) => {
|
|
3860
|
+
if (k !== d) return v;
|
|
3861
|
+
let B = Math.floor(v.startSample + y);
|
|
3862
|
+
B = Math.max(0, B);
|
|
3863
|
+
const $ = f > 0 ? w[f - 1] : null;
|
|
3864
|
+
if ($) {
|
|
3865
|
+
const M = $.startSample + $.durationSamples;
|
|
3866
|
+
B = Math.max(B, M);
|
|
3867
3867
|
}
|
|
3868
|
-
const
|
|
3869
|
-
return
|
|
3870
|
-
...
|
|
3871
|
-
startSample:
|
|
3868
|
+
const A = f < w.length - 1 ? w[f + 1] : null;
|
|
3869
|
+
return A && B + v.durationSamples > A.startSample && (B = A.startSample - v.durationSamples), {
|
|
3870
|
+
...v,
|
|
3871
|
+
startSample: B
|
|
3872
3872
|
};
|
|
3873
3873
|
});
|
|
3874
3874
|
return {
|
|
3875
3875
|
...p,
|
|
3876
|
-
clips:
|
|
3876
|
+
clips: C
|
|
3877
3877
|
};
|
|
3878
3878
|
});
|
|
3879
3879
|
t(m);
|
|
@@ -3896,7 +3896,7 @@ function Is({
|
|
|
3896
3896
|
duration: a,
|
|
3897
3897
|
linkEndpoints: s
|
|
3898
3898
|
}) {
|
|
3899
|
-
const o =
|
|
3899
|
+
const o = Fe.useRef(null), i = Fe.useCallback(
|
|
3900
3900
|
(u) => {
|
|
3901
3901
|
const { active: g } = u, h = g.data.current;
|
|
3902
3902
|
if (!h || h.annotationIndex === void 0) {
|
|
@@ -3911,14 +3911,14 @@ function Is({
|
|
|
3911
3911
|
});
|
|
3912
3912
|
},
|
|
3913
3913
|
[e]
|
|
3914
|
-
), l =
|
|
3914
|
+
), l = Fe.useCallback(
|
|
3915
3915
|
(u) => {
|
|
3916
3916
|
const { active: g, delta: h } = u;
|
|
3917
3917
|
if (!o.current)
|
|
3918
3918
|
return;
|
|
3919
3919
|
const d = g.data.current;
|
|
3920
3920
|
if (!d) return;
|
|
3921
|
-
const { edge: b, annotationIndex: y } = d, m = o.current, p = h.x * n / r, x = b === "start" ? m.start + p : m.end + p,
|
|
3921
|
+
const { edge: b, annotationIndex: y } = d, m = o.current, p = h.x * n / r, x = b === "start" ? m.start + p : m.end + p, w = As({
|
|
3922
3922
|
annotationIndex: y,
|
|
3923
3923
|
newTime: x,
|
|
3924
3924
|
isDraggingStart: b === "start",
|
|
@@ -3926,10 +3926,10 @@ function Is({
|
|
|
3926
3926
|
duration: a,
|
|
3927
3927
|
linkEndpoints: s
|
|
3928
3928
|
});
|
|
3929
|
-
t(
|
|
3929
|
+
t(w);
|
|
3930
3930
|
},
|
|
3931
3931
|
[e, t, n, r, a, s]
|
|
3932
|
-
), c =
|
|
3932
|
+
), c = Fe.useCallback(() => {
|
|
3933
3933
|
o.current = null;
|
|
3934
3934
|
}, []);
|
|
3935
3935
|
return {
|
|
@@ -4045,7 +4045,7 @@ function xi(e = {}) {
|
|
|
4045
4045
|
);
|
|
4046
4046
|
}
|
|
4047
4047
|
const Ii = (e) => {
|
|
4048
|
-
const { tracks: t, onTracksChange: n, sampleRate: r } = e, { currentTimeRef: a } =
|
|
4048
|
+
const { tracks: t, onTracksChange: n, sampleRate: r } = e, { currentTimeRef: a } = Ze(), { selectedTrackId: s } = Ne(), o = D(
|
|
4049
4049
|
(l, c, u) => {
|
|
4050
4050
|
const { sampleRate: g, samplesPerPixel: h } = e, d = t[l];
|
|
4051
4051
|
if (!d) return !1;
|
|
@@ -4054,10 +4054,10 @@ const Ii = (e) => {
|
|
|
4054
4054
|
const y = b.startSample / g, m = (b.startSample + b.durationSamples) / g;
|
|
4055
4055
|
if (u <= y || u >= m)
|
|
4056
4056
|
return console.warn("Split time is outside clip bounds"), !1;
|
|
4057
|
-
const p = Math.round(u * g), x = Math.floor(p / h),
|
|
4057
|
+
const p = Math.round(u * g), x = Math.floor(p / h), w = b.startSample + b.durationSamples, f = x * h, C = b.startSample, v = f - C, k = f, B = w - k, $ = f - b.startSample, A = Yt({
|
|
4058
4058
|
audioBuffer: b.audioBuffer,
|
|
4059
|
-
startSample:
|
|
4060
|
-
durationSamples:
|
|
4059
|
+
startSample: C,
|
|
4060
|
+
durationSamples: v,
|
|
4061
4061
|
offsetSamples: b.offsetSamples,
|
|
4062
4062
|
sampleRate: b.sampleRate,
|
|
4063
4063
|
sourceDurationSamples: b.sourceDurationSamples,
|
|
@@ -4070,9 +4070,9 @@ const Ii = (e) => {
|
|
|
4070
4070
|
// Note: fadeOut removed for first clip since it's cut
|
|
4071
4071
|
}), M = Yt({
|
|
4072
4072
|
audioBuffer: b.audioBuffer,
|
|
4073
|
-
startSample:
|
|
4074
|
-
durationSamples:
|
|
4075
|
-
offsetSamples: b.offsetSamples +
|
|
4073
|
+
startSample: k,
|
|
4074
|
+
durationSamples: B,
|
|
4075
|
+
offsetSamples: b.offsetSamples + $,
|
|
4076
4076
|
sampleRate: b.sampleRate,
|
|
4077
4077
|
sourceDurationSamples: b.sourceDurationSamples,
|
|
4078
4078
|
gain: b.gain,
|
|
@@ -4083,12 +4083,12 @@ const Ii = (e) => {
|
|
|
4083
4083
|
// Note: fadeIn removed for second clip since it's cut
|
|
4084
4084
|
fadeOut: b.fadeOut
|
|
4085
4085
|
}), _ = [...d.clips];
|
|
4086
|
-
_.splice(c, 1,
|
|
4087
|
-
const
|
|
4088
|
-
return
|
|
4086
|
+
_.splice(c, 1, A, M);
|
|
4087
|
+
const E = [...t];
|
|
4088
|
+
return E[l] = {
|
|
4089
4089
|
...d,
|
|
4090
4090
|
clips: _
|
|
4091
|
-
}, n(
|
|
4091
|
+
}, n(E), !0;
|
|
4092
4092
|
},
|
|
4093
4093
|
[t, n, e]
|
|
4094
4094
|
);
|
|
@@ -4124,7 +4124,7 @@ const Ii = (e) => {
|
|
|
4124
4124
|
},
|
|
4125
4125
|
[t, n]
|
|
4126
4126
|
);
|
|
4127
|
-
|
|
4127
|
+
U(() => {
|
|
4128
4128
|
if (n)
|
|
4129
4129
|
return window.addEventListener("keydown", r), () => {
|
|
4130
4130
|
window.removeEventListener("keydown", r);
|
|
@@ -4134,7 +4134,7 @@ const Ii = (e) => {
|
|
|
4134
4134
|
const t = [], n = typeof navigator < "u" && navigator.platform.includes("Mac");
|
|
4135
4135
|
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("+");
|
|
4136
4136
|
}, ki = (e = {}) => {
|
|
4137
|
-
const { enabled: t = !0, additionalShortcuts: n = [], shortcuts: r } = e, { isPlaying: a } =
|
|
4137
|
+
const { enabled: t = !0, additionalShortcuts: n = [], shortcuts: r } = e, { isPlaying: a } = Ze(), { setCurrentTime: s, play: o, pause: i, stop: l } = ge(), { playoutRef: c } = Be(), u = D(() => {
|
|
4138
4138
|
a ? i() : o();
|
|
4139
4139
|
}, [a, o, i]), g = D(() => {
|
|
4140
4140
|
l();
|
|
@@ -4185,14 +4185,14 @@ function Si({
|
|
|
4185
4185
|
controlsWidth: g = 0,
|
|
4186
4186
|
onPlay: h
|
|
4187
4187
|
}) {
|
|
4188
|
-
const d = nt(() => t ? e.findIndex((
|
|
4189
|
-
(
|
|
4188
|
+
const d = nt(() => t ? e.findIndex(($) => $.id === t) : -1, [e, t]), b = D(
|
|
4189
|
+
($) => {
|
|
4190
4190
|
if (!l?.current || !c || !u) return;
|
|
4191
|
-
const
|
|
4192
|
-
if (!
|
|
4193
|
-
const M = l.current, _ = M.clientWidth,
|
|
4194
|
-
if (
|
|
4195
|
-
const Z = Math.max(0,
|
|
4191
|
+
const A = e.find((Z) => Z.id === $);
|
|
4192
|
+
if (!A) return;
|
|
4193
|
+
const M = l.current, _ = M.clientWidth, E = A.start * u / c + g, V = A.end * u / c + g, z = (E + V) / 2, P = M.scrollLeft, K = P, X = P + _;
|
|
4194
|
+
if (E < K || V > X) {
|
|
4195
|
+
const Z = Math.max(0, z - _ / 2);
|
|
4196
4196
|
M.scrollTo({
|
|
4197
4197
|
left: Z,
|
|
4198
4198
|
behavior: "smooth"
|
|
@@ -4201,98 +4201,98 @@ function Si({
|
|
|
4201
4201
|
},
|
|
4202
4202
|
[e, l, c, u, g]
|
|
4203
4203
|
);
|
|
4204
|
-
|
|
4204
|
+
U(() => {
|
|
4205
4205
|
t && l?.current && c && u && b(t);
|
|
4206
4206
|
}, [t, b, l, c, u]);
|
|
4207
4207
|
const y = D(
|
|
4208
|
-
(
|
|
4208
|
+
($) => {
|
|
4209
4209
|
if (d < 0) return;
|
|
4210
|
-
const
|
|
4211
|
-
if (
|
|
4212
|
-
...
|
|
4210
|
+
const A = e[d], M = Math.max(0, Math.min(A.end - 0.1, A.start + $)), _ = M - A.start, E = [...e];
|
|
4211
|
+
if (E[d] = {
|
|
4212
|
+
...A,
|
|
4213
4213
|
start: M
|
|
4214
4214
|
}, s && d > 0) {
|
|
4215
|
-
const
|
|
4216
|
-
Math.abs(
|
|
4217
|
-
...
|
|
4218
|
-
end: Math.max(
|
|
4215
|
+
const V = E[d - 1];
|
|
4216
|
+
Math.abs(V.end - A.start) < Gt && (E[d - 1] = {
|
|
4217
|
+
...V,
|
|
4218
|
+
end: Math.max(V.start + 0.1, V.end + _)
|
|
4219
4219
|
});
|
|
4220
4220
|
} else if (!s && d > 0) {
|
|
4221
|
-
const
|
|
4222
|
-
M <
|
|
4223
|
-
...
|
|
4221
|
+
const V = E[d - 1];
|
|
4222
|
+
M < V.end && (E[d - 1] = {
|
|
4223
|
+
...V,
|
|
4224
4224
|
end: M
|
|
4225
4225
|
});
|
|
4226
4226
|
}
|
|
4227
|
-
n(
|
|
4227
|
+
n(E);
|
|
4228
4228
|
},
|
|
4229
4229
|
[e, d, s, n]
|
|
4230
4230
|
), m = D(
|
|
4231
|
-
(
|
|
4231
|
+
($) => {
|
|
4232
4232
|
if (d < 0) return;
|
|
4233
|
-
const
|
|
4234
|
-
if (
|
|
4235
|
-
...
|
|
4233
|
+
const A = e[d], M = Math.max(A.start + 0.1, Math.min(a, A.end + $)), _ = M - A.end, E = [...e];
|
|
4234
|
+
if (E[d] = {
|
|
4235
|
+
...A,
|
|
4236
4236
|
end: M
|
|
4237
4237
|
}, s && d < e.length - 1) {
|
|
4238
|
-
const
|
|
4239
|
-
if (Math.abs(
|
|
4240
|
-
const
|
|
4241
|
-
|
|
4242
|
-
...
|
|
4243
|
-
start:
|
|
4238
|
+
const V = E[d + 1];
|
|
4239
|
+
if (Math.abs(V.start - A.end) < Gt) {
|
|
4240
|
+
const z = Math.min(V.end - 0.1, V.start + _);
|
|
4241
|
+
E[d + 1] = {
|
|
4242
|
+
...V,
|
|
4243
|
+
start: z
|
|
4244
4244
|
};
|
|
4245
|
-
let
|
|
4246
|
-
for (;
|
|
4247
|
-
const
|
|
4248
|
-
if (Math.abs(
|
|
4249
|
-
const Z =
|
|
4250
|
-
|
|
4251
|
-
...
|
|
4252
|
-
start: Math.min(
|
|
4253
|
-
},
|
|
4245
|
+
let P = d + 1;
|
|
4246
|
+
for (; P < E.length - 1; ) {
|
|
4247
|
+
const K = E[P], X = E[P + 1];
|
|
4248
|
+
if (Math.abs(X.start - e[P].end) < Gt) {
|
|
4249
|
+
const Z = K.end - e[P].end;
|
|
4250
|
+
E[P + 1] = {
|
|
4251
|
+
...X,
|
|
4252
|
+
start: Math.min(X.end - 0.1, X.start + Z)
|
|
4253
|
+
}, P++;
|
|
4254
4254
|
} else
|
|
4255
4255
|
break;
|
|
4256
4256
|
}
|
|
4257
4257
|
}
|
|
4258
4258
|
} else if (!s && d < e.length - 1) {
|
|
4259
|
-
const
|
|
4260
|
-
if (M >
|
|
4261
|
-
|
|
4262
|
-
...
|
|
4259
|
+
const V = E[d + 1];
|
|
4260
|
+
if (M > V.start) {
|
|
4261
|
+
E[d + 1] = {
|
|
4262
|
+
...V,
|
|
4263
4263
|
start: M
|
|
4264
4264
|
};
|
|
4265
|
-
let
|
|
4266
|
-
for (;
|
|
4267
|
-
const
|
|
4268
|
-
if (
|
|
4269
|
-
|
|
4270
|
-
...
|
|
4271
|
-
start:
|
|
4272
|
-
},
|
|
4265
|
+
let z = d + 1;
|
|
4266
|
+
for (; z < E.length - 1; ) {
|
|
4267
|
+
const P = E[z], K = E[z + 1];
|
|
4268
|
+
if (P.end > K.start)
|
|
4269
|
+
E[z + 1] = {
|
|
4270
|
+
...K,
|
|
4271
|
+
start: P.end
|
|
4272
|
+
}, z++;
|
|
4273
4273
|
else
|
|
4274
4274
|
break;
|
|
4275
4275
|
}
|
|
4276
4276
|
}
|
|
4277
4277
|
}
|
|
4278
|
-
n(
|
|
4278
|
+
n(E);
|
|
4279
4279
|
},
|
|
4280
4280
|
[e, d, a, s, n]
|
|
4281
4281
|
), p = D(() => {
|
|
4282
4282
|
!r || e.length === 0 || (d <= 0 ? r(e[e.length - 1].id) : r(e[d - 1].id));
|
|
4283
4283
|
}, [e, d, r]), x = D(() => {
|
|
4284
4284
|
!r || e.length === 0 || (d < 0 || d >= e.length - 1 ? r(e[0].id) : r(e[d + 1].id));
|
|
4285
|
-
}, [e, d, r]),
|
|
4285
|
+
}, [e, d, r]), w = D(() => {
|
|
4286
4286
|
!r || e.length === 0 || r(e[0].id);
|
|
4287
4287
|
}, [e, r]), f = D(() => {
|
|
4288
4288
|
!r || e.length === 0 || r(e[e.length - 1].id);
|
|
4289
|
-
}, [e, r]),
|
|
4289
|
+
}, [e, r]), C = D(() => {
|
|
4290
4290
|
r && r(null);
|
|
4291
|
-
}, [r]),
|
|
4291
|
+
}, [r]), v = D(() => {
|
|
4292
4292
|
if (d < 0 || !h) return;
|
|
4293
|
-
const
|
|
4294
|
-
h(
|
|
4295
|
-
}, [e, d, o, h]),
|
|
4293
|
+
const $ = e[d], A = o ? void 0 : $.end - $.start;
|
|
4294
|
+
h($.start, A);
|
|
4295
|
+
}, [e, d, o, h]), k = nt(
|
|
4296
4296
|
() => [
|
|
4297
4297
|
{
|
|
4298
4298
|
key: "[",
|
|
@@ -4322,13 +4322,13 @@ function Si({
|
|
|
4322
4322
|
},
|
|
4323
4323
|
{
|
|
4324
4324
|
key: "Enter",
|
|
4325
|
-
action:
|
|
4325
|
+
action: v,
|
|
4326
4326
|
description: "Play selected annotation",
|
|
4327
4327
|
preventDefault: !0
|
|
4328
4328
|
}
|
|
4329
4329
|
],
|
|
4330
|
-
[y, m,
|
|
4331
|
-
),
|
|
4330
|
+
[y, m, v]
|
|
4331
|
+
), B = nt(
|
|
4332
4332
|
() => [
|
|
4333
4333
|
{
|
|
4334
4334
|
key: "ArrowUp",
|
|
@@ -4356,7 +4356,7 @@ function Si({
|
|
|
4356
4356
|
},
|
|
4357
4357
|
{
|
|
4358
4358
|
key: "Home",
|
|
4359
|
-
action:
|
|
4359
|
+
action: w,
|
|
4360
4360
|
description: "Select first annotation",
|
|
4361
4361
|
preventDefault: !0
|
|
4362
4362
|
},
|
|
@@ -4368,29 +4368,29 @@ function Si({
|
|
|
4368
4368
|
},
|
|
4369
4369
|
{
|
|
4370
4370
|
key: "Escape",
|
|
4371
|
-
action:
|
|
4371
|
+
action: C,
|
|
4372
4372
|
description: "Deselect annotation",
|
|
4373
4373
|
preventDefault: !0
|
|
4374
4374
|
}
|
|
4375
4375
|
],
|
|
4376
|
-
[p, x,
|
|
4376
|
+
[p, x, w, f, C]
|
|
4377
4377
|
);
|
|
4378
4378
|
return Ot({
|
|
4379
|
-
shortcuts:
|
|
4379
|
+
shortcuts: k,
|
|
4380
4380
|
enabled: i && d >= 0
|
|
4381
4381
|
}), Ot({
|
|
4382
|
-
shortcuts:
|
|
4382
|
+
shortcuts: B,
|
|
4383
4383
|
enabled: i && e.length > 0 && !!r
|
|
4384
4384
|
}), {
|
|
4385
4385
|
moveStartBoundary: y,
|
|
4386
4386
|
moveEndBoundary: m,
|
|
4387
4387
|
selectPrevious: p,
|
|
4388
4388
|
selectNext: x,
|
|
4389
|
-
selectFirst:
|
|
4389
|
+
selectFirst: w,
|
|
4390
4390
|
selectLast: f,
|
|
4391
|
-
clearSelection:
|
|
4391
|
+
clearSelection: C,
|
|
4392
4392
|
scrollToAnnotation: b,
|
|
4393
|
-
playActiveAnnotation:
|
|
4393
|
+
playActiveAnnotation: v
|
|
4394
4394
|
};
|
|
4395
4395
|
}
|
|
4396
4396
|
function ks(e) {
|
|
@@ -4443,99 +4443,99 @@ function Ms(e, t = {}) {
|
|
|
4443
4443
|
const {
|
|
4444
4444
|
channelCount: n = 1,
|
|
4445
4445
|
samplesPerPixel: r = 1024
|
|
4446
|
-
} = t, [a, s] =
|
|
4447
|
-
if (!
|
|
4446
|
+
} = t, [a, s] = R(!1), [o, i] = R(!1), [l, c] = R(0), [u, g] = R(new Int16Array(0)), [h, d] = R(null), [b, y] = R(null), [m, p] = R(0), [x, w] = R(0), f = 16, C = T(!1), v = T(null), k = T(null), B = T([]), $ = T(0), A = T(null), M = T(0), _ = T(!1), E = T(!1), V = D(async () => {
|
|
4447
|
+
if (!C.current)
|
|
4448
4448
|
try {
|
|
4449
|
-
const Z =
|
|
4450
|
-
await Z.addAudioWorkletModule(
|
|
4449
|
+
const Z = Ae(), Q = new URL("data:text/javascript;base64,InVzZSBzdHJpY3QiOwoKLy8gc3JjL3dvcmtsZXQvcmVjb3JkaW5nLXByb2Nlc3Nvci53b3JrbGV0LnRzCnZhciBSZWNvcmRpbmdQcm9jZXNzb3IgPSBjbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3NvciB7CiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5idWZmZXJTaXplID0gMDsKICAgIHRoaXMuYnVmZmVycyA9IFtdOwogICAgdGhpcy5zYW1wbGVzQ29sbGVjdGVkID0gMDsKICAgIHRoaXMuaXNSZWNvcmRpbmcgPSBmYWxzZTsKICAgIHRoaXMuY2hhbm5lbENvdW50ID0gMTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSAoZXZlbnQpID0+IHsKICAgICAgY29uc3QgeyBjb21tYW5kLCBzYW1wbGVSYXRlOiBzYW1wbGVSYXRlMiwgY2hhbm5lbENvdW50IH0gPSBldmVudC5kYXRhOwogICAgICBpZiAoY29tbWFuZCA9PT0gInN0YXJ0IikgewogICAgICAgIHRoaXMuaXNSZWNvcmRpbmcgPSB0cnVlOwogICAgICAgIHRoaXMuY2hhbm5lbENvdW50ID0gY2hhbm5lbENvdW50IHx8IDE7CiAgICAgICAgdGhpcy5idWZmZXJTaXplID0gTWF0aC5mbG9vcigoc2FtcGxlUmF0ZTIgfHwgNDhlMykgKiAwLjAxNik7CiAgICAgICAgdGhpcy5idWZmZXJzID0gW107CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCB0aGlzLmNoYW5uZWxDb3VudDsgaSsrKSB7CiAgICAgICAgICB0aGlzLmJ1ZmZlcnNbaV0gPSBuZXcgRmxvYXQzMkFycmF5KHRoaXMuYnVmZmVyU2l6ZSk7CiAgICAgICAgfQogICAgICAgIHRoaXMuc2FtcGxlc0NvbGxlY3RlZCA9IDA7CiAgICAgIH0gZWxzZSBpZiAoY29tbWFuZCA9PT0gInN0b3AiKSB7CiAgICAgICAgdGhpcy5pc1JlY29yZGluZyA9IGZhbHNlOwogICAgICAgIGlmICh0aGlzLnNhbXBsZXNDb2xsZWN0ZWQgPiAwKSB7CiAgICAgICAgICB0aGlzLmZsdXNoQnVmZmVycygpOwogICAgICAgIH0KICAgICAgfQogICAgfTsKICB9CiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMsIHBhcmFtZXRlcnMpIHsKICAgIGlmICghdGhpcy5pc1JlY29yZGluZykgewogICAgICByZXR1cm4gdHJ1ZTsKICAgIH0KICAgIGNvbnN0IGlucHV0ID0gaW5wdXRzWzBdOwogICAgaWYgKCFpbnB1dCB8fCBpbnB1dC5sZW5ndGggPT09IDApIHsKICAgICAgcmV0dXJuIHRydWU7CiAgICB9CiAgICBjb25zdCBmcmFtZUNvdW50ID0gaW5wdXRbMF0ubGVuZ3RoOwogICAgZm9yIChsZXQgY2hhbm5lbCA9IDA7IGNoYW5uZWwgPCBNYXRoLm1pbihpbnB1dC5sZW5ndGgsIHRoaXMuY2hhbm5lbENvdW50KTsgY2hhbm5lbCsrKSB7CiAgICAgIGNvbnN0IGlucHV0Q2hhbm5lbCA9IGlucHV0W2NoYW5uZWxdOwogICAgICBjb25zdCBidWZmZXIgPSB0aGlzLmJ1ZmZlcnNbY2hhbm5lbF07CiAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZnJhbWVDb3VudDsgaSsrKSB7CiAgICAgICAgYnVmZmVyW3RoaXMuc2FtcGxlc0NvbGxlY3RlZCArIGldID0gaW5wdXRDaGFubmVsW2ldOwogICAgICB9CiAgICB9CiAgICB0aGlzLnNhbXBsZXNDb2xsZWN0ZWQgKz0gZnJhbWVDb3VudDsKICAgIGlmICh0aGlzLnNhbXBsZXNDb2xsZWN0ZWQgPj0gdGhpcy5idWZmZXJTaXplKSB7CiAgICAgIHRoaXMuZmx1c2hCdWZmZXJzKCk7CiAgICB9CiAgICByZXR1cm4gdHJ1ZTsKICB9CiAgZmx1c2hCdWZmZXJzKCkgewogICAgY29uc3Qgc2FtcGxlcyA9IHRoaXMuYnVmZmVyc1swXS5zbGljZSgwLCB0aGlzLnNhbXBsZXNDb2xsZWN0ZWQpOwogICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgc2FtcGxlcywKICAgICAgc2FtcGxlUmF0ZSwKICAgICAgY2hhbm5lbENvdW50OiB0aGlzLmNoYW5uZWxDb3VudAogICAgfSk7CiAgICB0aGlzLnNhbXBsZXNDb2xsZWN0ZWQgPSAwOwogIH0KfTsKcmVnaXN0ZXJQcm9jZXNzb3IoInJlY29yZGluZy1wcm9jZXNzb3IiLCBSZWNvcmRpbmdQcm9jZXNzb3IpOwovLyMgc291cmNlTWFwcGluZ1VSTD1yZWNvcmRpbmctcHJvY2Vzc29yLndvcmtsZXQuanMubWFw", import.meta.url).href;
|
|
4450
|
+
await Z.addAudioWorkletModule(Q), C.current = !0;
|
|
4451
4451
|
} catch (Z) {
|
|
4452
4452
|
throw console.error("Failed to load AudioWorklet module:", Z), new Error("Failed to load recording processor");
|
|
4453
4453
|
}
|
|
4454
|
-
}, []),
|
|
4454
|
+
}, []), z = D(async () => {
|
|
4455
4455
|
if (!e) {
|
|
4456
4456
|
y(new Error("No microphone stream available"));
|
|
4457
4457
|
return;
|
|
4458
4458
|
}
|
|
4459
4459
|
try {
|
|
4460
4460
|
y(null);
|
|
4461
|
-
const Z =
|
|
4462
|
-
Z.state === "suspended" && await Z.resume(), await
|
|
4463
|
-
const
|
|
4464
|
-
|
|
4465
|
-
const
|
|
4466
|
-
|
|
4467
|
-
const { samples:
|
|
4468
|
-
|
|
4461
|
+
const Z = Ae();
|
|
4462
|
+
Z.state === "suspended" && await Z.resume(), await V();
|
|
4463
|
+
const Q = Z.createMediaStreamSource(e);
|
|
4464
|
+
k.current = Q;
|
|
4465
|
+
const le = Z.createAudioWorkletNode("recording-processor");
|
|
4466
|
+
v.current = le, Q.connect(le), le.port.onmessage = (re) => {
|
|
4467
|
+
const { samples: ae } = re.data;
|
|
4468
|
+
B.current.push(ae), $.current += ae.length, g(
|
|
4469
4469
|
(ye) => $s(
|
|
4470
4470
|
ye,
|
|
4471
|
-
|
|
4471
|
+
ae,
|
|
4472
4472
|
r,
|
|
4473
|
-
|
|
4473
|
+
$.current - ae.length,
|
|
4474
4474
|
f
|
|
4475
4475
|
)
|
|
4476
4476
|
);
|
|
4477
|
-
},
|
|
4477
|
+
}, le.port.postMessage({
|
|
4478
4478
|
command: "start",
|
|
4479
4479
|
sampleRate: Z.sampleRate,
|
|
4480
4480
|
channelCount: n
|
|
4481
|
-
}),
|
|
4482
|
-
const
|
|
4483
|
-
if (_.current && !
|
|
4484
|
-
const
|
|
4485
|
-
c(
|
|
4481
|
+
}), B.current = [], $.current = 0, g(new Int16Array(0)), d(null), p(0), w(0), _.current = !0, E.current = !1, s(!0), i(!1), M.current = performance.now();
|
|
4482
|
+
const te = () => {
|
|
4483
|
+
if (_.current && !E.current) {
|
|
4484
|
+
const re = (performance.now() - M.current) / 1e3;
|
|
4485
|
+
c(re), A.current = requestAnimationFrame(te);
|
|
4486
4486
|
}
|
|
4487
4487
|
};
|
|
4488
|
-
|
|
4488
|
+
te();
|
|
4489
4489
|
} catch (Z) {
|
|
4490
4490
|
console.error("Failed to start recording:", Z), y(Z instanceof Error ? Z : new Error("Failed to start recording"));
|
|
4491
4491
|
}
|
|
4492
|
-
}, [e, n, r,
|
|
4492
|
+
}, [e, n, r, V, a, o]), P = D(async () => {
|
|
4493
4493
|
if (!a)
|
|
4494
4494
|
return null;
|
|
4495
4495
|
try {
|
|
4496
|
-
if (
|
|
4497
|
-
if (
|
|
4496
|
+
if (v.current) {
|
|
4497
|
+
if (v.current.port.postMessage({ command: "stop" }), k.current)
|
|
4498
4498
|
try {
|
|
4499
|
-
|
|
4499
|
+
k.current.disconnect(v.current);
|
|
4500
4500
|
} catch {
|
|
4501
4501
|
}
|
|
4502
|
-
|
|
4502
|
+
v.current.disconnect();
|
|
4503
4503
|
}
|
|
4504
|
-
|
|
4505
|
-
const Z = ks(
|
|
4506
|
-
|
|
4504
|
+
A.current !== null && (cancelAnimationFrame(A.current), A.current = null);
|
|
4505
|
+
const Z = ks(B.current), le = Ae().rawContext, te = Ss(
|
|
4506
|
+
le,
|
|
4507
4507
|
Z,
|
|
4508
|
-
|
|
4508
|
+
le.sampleRate,
|
|
4509
4509
|
n
|
|
4510
4510
|
);
|
|
4511
|
-
return d(
|
|
4511
|
+
return d(te), c(te.duration), _.current = !1, E.current = !1, s(!1), i(!1), p(0), te;
|
|
4512
4512
|
} catch (Z) {
|
|
4513
4513
|
return console.error("Failed to stop recording:", Z), y(Z instanceof Error ? Z : new Error("Failed to stop recording")), null;
|
|
4514
4514
|
}
|
|
4515
|
-
}, [a, n]),
|
|
4516
|
-
a && !o && (
|
|
4517
|
-
}, [a, o]),
|
|
4515
|
+
}, [a, n]), K = D(() => {
|
|
4516
|
+
a && !o && (A.current !== null && (cancelAnimationFrame(A.current), A.current = null), E.current = !0, i(!0));
|
|
4517
|
+
}, [a, o]), X = D(() => {
|
|
4518
4518
|
if (a && o) {
|
|
4519
|
-
|
|
4519
|
+
E.current = !1, i(!1), M.current = performance.now() - l * 1e3;
|
|
4520
4520
|
const Z = () => {
|
|
4521
|
-
if (_.current && !
|
|
4522
|
-
const
|
|
4523
|
-
c(
|
|
4521
|
+
if (_.current && !E.current) {
|
|
4522
|
+
const Q = (performance.now() - M.current) / 1e3;
|
|
4523
|
+
c(Q), A.current = requestAnimationFrame(Z);
|
|
4524
4524
|
}
|
|
4525
4525
|
};
|
|
4526
4526
|
Z();
|
|
4527
4527
|
}
|
|
4528
4528
|
}, [a, o, l]);
|
|
4529
|
-
return
|
|
4530
|
-
if (
|
|
4531
|
-
if (
|
|
4529
|
+
return U(() => () => {
|
|
4530
|
+
if (v.current) {
|
|
4531
|
+
if (v.current.port.postMessage({ command: "stop" }), k.current)
|
|
4532
4532
|
try {
|
|
4533
|
-
|
|
4533
|
+
k.current.disconnect(v.current);
|
|
4534
4534
|
} catch {
|
|
4535
4535
|
}
|
|
4536
|
-
|
|
4536
|
+
v.current.disconnect();
|
|
4537
4537
|
}
|
|
4538
|
-
|
|
4538
|
+
A.current !== null && cancelAnimationFrame(A.current);
|
|
4539
4539
|
}, []), {
|
|
4540
4540
|
isRecording: a,
|
|
4541
4541
|
isPaused: o,
|
|
@@ -4544,15 +4544,15 @@ function Ms(e, t = {}) {
|
|
|
4544
4544
|
audioBuffer: h,
|
|
4545
4545
|
level: m,
|
|
4546
4546
|
peakLevel: x,
|
|
4547
|
-
startRecording:
|
|
4548
|
-
stopRecording:
|
|
4549
|
-
pauseRecording:
|
|
4550
|
-
resumeRecording:
|
|
4547
|
+
startRecording: z,
|
|
4548
|
+
stopRecording: P,
|
|
4549
|
+
pauseRecording: K,
|
|
4550
|
+
resumeRecording: X,
|
|
4551
4551
|
error: b
|
|
4552
4552
|
};
|
|
4553
4553
|
}
|
|
4554
4554
|
function Bs() {
|
|
4555
|
-
const [e, t] =
|
|
4555
|
+
const [e, t] = R(null), [n, r] = R([]), [a, s] = R(!1), [o, i] = R(!1), [l, c] = R(null), u = D(async () => {
|
|
4556
4556
|
try {
|
|
4557
4557
|
const b = (await navigator.mediaDevices.enumerateDevices()).filter((y) => y.kind === "audioinput").map((y) => ({
|
|
4558
4558
|
deviceId: y.deviceId,
|
|
@@ -4593,7 +4593,7 @@ function Bs() {
|
|
|
4593
4593
|
}, [e, u]), h = D(() => {
|
|
4594
4594
|
e && (e.getTracks().forEach((d) => d.stop()), t(null), s(!1));
|
|
4595
4595
|
}, [e]);
|
|
4596
|
-
return
|
|
4596
|
+
return U(() => (u(), () => {
|
|
4597
4597
|
e && e.getTracks().forEach((d) => d.stop());
|
|
4598
4598
|
}), []), {
|
|
4599
4599
|
stream: e,
|
|
@@ -4609,8 +4609,8 @@ function Ds(e, t = {}) {
|
|
|
4609
4609
|
const {
|
|
4610
4610
|
updateRate: n = 60,
|
|
4611
4611
|
smoothingTimeConstant: r = 0.8
|
|
4612
|
-
} = t, [a, s] =
|
|
4613
|
-
return
|
|
4612
|
+
} = t, [a, s] = R(0), [o, i] = R(0), l = T(null), c = T(null), u = T(null), g = () => i(0);
|
|
4613
|
+
return U(() => {
|
|
4614
4614
|
if (!e) {
|
|
4615
4615
|
s(0), i(0);
|
|
4616
4616
|
return;
|
|
@@ -4618,7 +4618,7 @@ function Ds(e, t = {}) {
|
|
|
4618
4618
|
let h = !0;
|
|
4619
4619
|
return (async () => {
|
|
4620
4620
|
if (!h) return;
|
|
4621
|
-
const b =
|
|
4621
|
+
const b = Ae();
|
|
4622
4622
|
if (b.state === "suspended" && await b.resume(), !h) return;
|
|
4623
4623
|
const y = new Pr({ smoothing: r, context: b });
|
|
4624
4624
|
l.current = y;
|
|
@@ -4626,17 +4626,17 @@ function Ds(e, t = {}) {
|
|
|
4626
4626
|
c.current = m, zr(m, y);
|
|
4627
4627
|
const p = 1e3 / n;
|
|
4628
4628
|
let x = 0;
|
|
4629
|
-
const
|
|
4629
|
+
const w = (f) => {
|
|
4630
4630
|
if (!(!h || !l.current)) {
|
|
4631
4631
|
if (f - x >= p) {
|
|
4632
4632
|
x = f;
|
|
4633
|
-
const
|
|
4634
|
-
s(
|
|
4633
|
+
const C = l.current.getValue(), v = typeof C == "number" ? C : C[0], k = Math.max(0, Math.min(1, (v + 100) / 100));
|
|
4634
|
+
s(k), i((B) => Math.max(B, k));
|
|
4635
4635
|
}
|
|
4636
|
-
u.current = requestAnimationFrame(
|
|
4636
|
+
u.current = requestAnimationFrame(w);
|
|
4637
4637
|
}
|
|
4638
4638
|
};
|
|
4639
|
-
u.current = requestAnimationFrame(
|
|
4639
|
+
u.current = requestAnimationFrame(w);
|
|
4640
4640
|
})(), () => {
|
|
4641
4641
|
if (h = !1, u.current && (cancelAnimationFrame(u.current), u.current = null), c.current) {
|
|
4642
4642
|
try {
|
|
@@ -4808,18 +4808,18 @@ var Ts = S.div`
|
|
|
4808
4808
|
className: a
|
|
4809
4809
|
}) => {
|
|
4810
4810
|
const s = Math.max(0, Math.min(1, e)), o = t !== void 0 ? Math.max(0, Math.min(1, t)) : 0;
|
|
4811
|
-
return /* @__PURE__ */
|
|
4811
|
+
return /* @__PURE__ */ ne(Ts, { $width: n, $height: r, className: a, children: [
|
|
4812
4812
|
/* @__PURE__ */ I(Es, { $level: s, $height: r }),
|
|
4813
4813
|
t !== void 0 && o > 0 && /* @__PURE__ */ I(Ws, { $peakLevel: o, $height: r }),
|
|
4814
|
-
/* @__PURE__ */
|
|
4814
|
+
/* @__PURE__ */ ne(_s, { $height: r, children: [
|
|
4815
4815
|
/* @__PURE__ */ I(In, { $position: 60, $height: r }),
|
|
4816
4816
|
/* @__PURE__ */ I(In, { $position: 85, $height: r })
|
|
4817
4817
|
] })
|
|
4818
4818
|
] });
|
|
4819
4819
|
};
|
|
4820
|
-
|
|
4820
|
+
Fe.memo(Fs);
|
|
4821
4821
|
function $i(e, t, n, r = {}) {
|
|
4822
|
-
const { currentTime: a = 0, audioConstraints: s, ...o } = r, [i, l] =
|
|
4822
|
+
const { currentTime: a = 0, audioConstraints: s, ...o } = r, [i, l] = R(!1), [c, u] = R(null), {
|
|
4823
4823
|
stream: g,
|
|
4824
4824
|
devices: h,
|
|
4825
4825
|
hasPermission: d,
|
|
@@ -4827,62 +4827,62 @@ function $i(e, t, n, r = {}) {
|
|
|
4827
4827
|
error: y
|
|
4828
4828
|
} = Bs(), { level: m, peakLevel: p } = Ds(g), {
|
|
4829
4829
|
isRecording: x,
|
|
4830
|
-
isPaused:
|
|
4830
|
+
isPaused: w,
|
|
4831
4831
|
duration: f,
|
|
4832
|
-
peaks:
|
|
4833
|
-
startRecording:
|
|
4834
|
-
stopRecording:
|
|
4835
|
-
pauseRecording:
|
|
4836
|
-
resumeRecording:
|
|
4837
|
-
error:
|
|
4832
|
+
peaks: C,
|
|
4833
|
+
startRecording: v,
|
|
4834
|
+
stopRecording: k,
|
|
4835
|
+
pauseRecording: B,
|
|
4836
|
+
resumeRecording: $,
|
|
4837
|
+
error: A
|
|
4838
4838
|
} = Ms(g, o), M = D(async () => {
|
|
4839
|
-
n && (i || (await Ht(), l(!0)), await
|
|
4840
|
-
}, [n, i,
|
|
4841
|
-
const
|
|
4842
|
-
if (
|
|
4843
|
-
const
|
|
4844
|
-
if (
|
|
4845
|
-
const
|
|
4839
|
+
n && (i || (await Ht(), l(!0)), await v());
|
|
4840
|
+
}, [n, i, v]), _ = D(async () => {
|
|
4841
|
+
const z = await k();
|
|
4842
|
+
if (z && n) {
|
|
4843
|
+
const P = e.findIndex((re) => re.id === n);
|
|
4844
|
+
if (P === -1) return;
|
|
4845
|
+
const K = e[P], X = Math.floor(a * z.sampleRate);
|
|
4846
4846
|
let Z = 0;
|
|
4847
|
-
if (
|
|
4848
|
-
const
|
|
4849
|
-
(
|
|
4847
|
+
if (K.clips.length > 0) {
|
|
4848
|
+
const re = K.clips.map(
|
|
4849
|
+
(ae) => ae.startSample + ae.durationSamples
|
|
4850
4850
|
);
|
|
4851
|
-
Z = Math.max(...
|
|
4851
|
+
Z = Math.max(...re);
|
|
4852
4852
|
}
|
|
4853
|
-
const
|
|
4853
|
+
const Q = Math.max(X, Z), le = {
|
|
4854
4854
|
id: `clip-${Date.now()}`,
|
|
4855
|
-
audioBuffer:
|
|
4856
|
-
startSample:
|
|
4857
|
-
durationSamples:
|
|
4855
|
+
audioBuffer: z,
|
|
4856
|
+
startSample: Q,
|
|
4857
|
+
durationSamples: z.length,
|
|
4858
4858
|
offsetSamples: 0,
|
|
4859
|
-
sampleRate:
|
|
4860
|
-
sourceDurationSamples:
|
|
4859
|
+
sampleRate: z.sampleRate,
|
|
4860
|
+
sourceDurationSamples: z.length,
|
|
4861
4861
|
gain: 1,
|
|
4862
4862
|
name: `Recording ${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`
|
|
4863
|
-
},
|
|
4864
|
-
...
|
|
4865
|
-
clips: [...
|
|
4866
|
-
} :
|
|
4867
|
-
t(
|
|
4863
|
+
}, te = e.map((re, ae) => ae === P ? {
|
|
4864
|
+
...re,
|
|
4865
|
+
clips: [...re.clips, le]
|
|
4866
|
+
} : re);
|
|
4867
|
+
t(te);
|
|
4868
4868
|
}
|
|
4869
|
-
}, [n, e, t, a,
|
|
4870
|
-
|
|
4869
|
+
}, [n, e, t, a, k]);
|
|
4870
|
+
U(() => {
|
|
4871
4871
|
d && h.length > 0 && c === null && u(h[0].deviceId);
|
|
4872
4872
|
}, [d, h.length]);
|
|
4873
|
-
const
|
|
4873
|
+
const E = D(async () => {
|
|
4874
4874
|
await b(void 0, s), await Ht(), l(!0);
|
|
4875
|
-
}, [b, s]),
|
|
4876
|
-
u(
|
|
4875
|
+
}, [b, s]), V = D(async (z) => {
|
|
4876
|
+
u(z), await b(z, s), await Ht(), l(!0);
|
|
4877
4877
|
}, [b, s]);
|
|
4878
4878
|
return {
|
|
4879
4879
|
// Recording state
|
|
4880
4880
|
isRecording: x,
|
|
4881
|
-
isPaused:
|
|
4881
|
+
isPaused: w,
|
|
4882
4882
|
duration: f,
|
|
4883
4883
|
level: m,
|
|
4884
4884
|
peakLevel: p,
|
|
4885
|
-
error: y ||
|
|
4885
|
+
error: y || A,
|
|
4886
4886
|
// Microphone state
|
|
4887
4887
|
stream: g,
|
|
4888
4888
|
devices: h,
|
|
@@ -4891,12 +4891,12 @@ function $i(e, t, n, r = {}) {
|
|
|
4891
4891
|
// Recording controls
|
|
4892
4892
|
startRecording: M,
|
|
4893
4893
|
stopRecording: _,
|
|
4894
|
-
pauseRecording:
|
|
4895
|
-
resumeRecording:
|
|
4896
|
-
requestMicAccess:
|
|
4897
|
-
changeDevice:
|
|
4894
|
+
pauseRecording: B,
|
|
4895
|
+
resumeRecording: $,
|
|
4896
|
+
requestMicAccess: E,
|
|
4897
|
+
changeDevice: V,
|
|
4898
4898
|
// Track state
|
|
4899
|
-
recordingPeaks:
|
|
4899
|
+
recordingPeaks: C
|
|
4900
4900
|
};
|
|
4901
4901
|
}
|
|
4902
4902
|
const _t = [
|
|
@@ -5213,28 +5213,28 @@ function Di(e) {
|
|
|
5213
5213
|
};
|
|
5214
5214
|
}
|
|
5215
5215
|
function Ti(e = 256) {
|
|
5216
|
-
const [t, n] =
|
|
5216
|
+
const [t, n] = R([]), r = T(t);
|
|
5217
5217
|
r.current = t;
|
|
5218
|
-
const a =
|
|
5218
|
+
const a = T(/* @__PURE__ */ new Map()), s = T(null), o = T(null), i = D((m) => {
|
|
5219
5219
|
const p = o.current;
|
|
5220
5220
|
if (!p) return;
|
|
5221
|
-
const { masterGainNode: x, destination:
|
|
5221
|
+
const { masterGainNode: x, destination: w, analyserNode: f } = p;
|
|
5222
5222
|
try {
|
|
5223
5223
|
x.disconnect();
|
|
5224
5224
|
} catch {
|
|
5225
5225
|
}
|
|
5226
|
-
const
|
|
5227
|
-
if (
|
|
5228
|
-
x.connect(f), f.connect(
|
|
5226
|
+
const C = m.map((v) => a.current.get(v.instanceId)).filter((v) => v !== void 0);
|
|
5227
|
+
if (C.length === 0)
|
|
5228
|
+
x.connect(f), f.connect(w);
|
|
5229
5229
|
else {
|
|
5230
|
-
let
|
|
5231
|
-
|
|
5230
|
+
let v = x;
|
|
5231
|
+
C.forEach((k) => {
|
|
5232
5232
|
try {
|
|
5233
|
-
|
|
5233
|
+
k.disconnect();
|
|
5234
5234
|
} catch {
|
|
5235
5235
|
}
|
|
5236
|
-
|
|
5237
|
-
}),
|
|
5236
|
+
v.connect(k.effect), v = k.effect;
|
|
5237
|
+
}), v.connect(f), f.connect(w);
|
|
5238
5238
|
}
|
|
5239
5239
|
}, []), l = D((m) => {
|
|
5240
5240
|
const p = ir(m);
|
|
@@ -5243,28 +5243,28 @@ function Ti(e = 256) {
|
|
|
5243
5243
|
return;
|
|
5244
5244
|
}
|
|
5245
5245
|
const x = {};
|
|
5246
|
-
p.parameters.forEach((
|
|
5247
|
-
x[
|
|
5246
|
+
p.parameters.forEach((C) => {
|
|
5247
|
+
x[C.name] = C.default;
|
|
5248
5248
|
});
|
|
5249
|
-
const
|
|
5250
|
-
a.current.set(
|
|
5249
|
+
const w = Bt(p, x);
|
|
5250
|
+
a.current.set(w.instanceId, w);
|
|
5251
5251
|
const f = {
|
|
5252
|
-
instanceId:
|
|
5252
|
+
instanceId: w.instanceId,
|
|
5253
5253
|
effectId: p.id,
|
|
5254
5254
|
definition: p,
|
|
5255
5255
|
params: x,
|
|
5256
5256
|
bypassed: !1
|
|
5257
5257
|
};
|
|
5258
|
-
n((
|
|
5258
|
+
n((C) => [...C, f]);
|
|
5259
5259
|
}, []), c = D((m) => {
|
|
5260
5260
|
const p = a.current.get(m);
|
|
5261
|
-
p && (p.dispose(), a.current.delete(m)), n((x) => x.filter((
|
|
5261
|
+
p && (p.dispose(), a.current.delete(m)), n((x) => x.filter((w) => w.instanceId !== m));
|
|
5262
5262
|
}, []), u = D(
|
|
5263
5263
|
(m, p, x) => {
|
|
5264
|
-
const
|
|
5265
|
-
|
|
5264
|
+
const w = a.current.get(m);
|
|
5265
|
+
w && w.setParameter(p, x), n(
|
|
5266
5266
|
(f) => f.map(
|
|
5267
|
-
(
|
|
5267
|
+
(C) => C.instanceId === m ? { ...C, params: { ...C.params, [p]: x } } : C
|
|
5268
5268
|
)
|
|
5269
5269
|
);
|
|
5270
5270
|
},
|
|
@@ -5273,75 +5273,75 @@ function Ti(e = 256) {
|
|
|
5273
5273
|
(m) => {
|
|
5274
5274
|
const p = r.current.find((f) => f.instanceId === m);
|
|
5275
5275
|
if (!p) return;
|
|
5276
|
-
const x = !p.bypassed,
|
|
5277
|
-
if (
|
|
5276
|
+
const x = !p.bypassed, w = a.current.get(m);
|
|
5277
|
+
if (w) {
|
|
5278
5278
|
const f = p.params.wet ?? 1;
|
|
5279
|
-
|
|
5279
|
+
w.setParameter("wet", x ? 0 : f);
|
|
5280
5280
|
}
|
|
5281
5281
|
n(
|
|
5282
5282
|
(f) => f.map(
|
|
5283
|
-
(
|
|
5283
|
+
(C) => C.instanceId === m ? { ...C, bypassed: x } : C
|
|
5284
5284
|
)
|
|
5285
5285
|
);
|
|
5286
5286
|
},
|
|
5287
5287
|
[]
|
|
5288
5288
|
), h = D((m, p) => {
|
|
5289
5289
|
n((x) => {
|
|
5290
|
-
const
|
|
5291
|
-
return
|
|
5290
|
+
const w = [...x], [f] = w.splice(m, 1);
|
|
5291
|
+
return w.splice(p, 0, f), w;
|
|
5292
5292
|
});
|
|
5293
5293
|
}, []), d = D(() => {
|
|
5294
5294
|
a.current.forEach((m) => m.dispose()), a.current.clear(), n([]);
|
|
5295
5295
|
}, []);
|
|
5296
|
-
|
|
5296
|
+
U(() => {
|
|
5297
5297
|
i(t);
|
|
5298
5298
|
}, [t, i]);
|
|
5299
5299
|
const b = D(
|
|
5300
5300
|
(m, p, x) => {
|
|
5301
|
-
const
|
|
5302
|
-
s.current =
|
|
5301
|
+
const w = new Dn("fft", e);
|
|
5302
|
+
s.current = w, o.current = {
|
|
5303
5303
|
masterGainNode: m,
|
|
5304
5304
|
destination: p,
|
|
5305
|
-
analyserNode:
|
|
5305
|
+
analyserNode: w
|
|
5306
5306
|
};
|
|
5307
|
-
const
|
|
5308
|
-
if (
|
|
5309
|
-
m.connect(
|
|
5307
|
+
const C = r.current.map((v) => a.current.get(v.instanceId)).filter((v) => v !== void 0);
|
|
5308
|
+
if (C.length === 0)
|
|
5309
|
+
m.connect(w), w.connect(p);
|
|
5310
5310
|
else {
|
|
5311
|
-
let
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
}),
|
|
5311
|
+
let v = m;
|
|
5312
|
+
C.forEach((k) => {
|
|
5313
|
+
v.connect(k.effect), v = k.effect;
|
|
5314
|
+
}), v.connect(w), w.connect(p);
|
|
5315
5315
|
}
|
|
5316
5316
|
return function() {
|
|
5317
|
-
|
|
5317
|
+
w.dispose(), s.current = null, o.current = null;
|
|
5318
5318
|
};
|
|
5319
5319
|
},
|
|
5320
5320
|
[e]
|
|
5321
5321
|
// Only fftSize - reads effects from ref
|
|
5322
5322
|
);
|
|
5323
|
-
|
|
5323
|
+
U(() => () => {
|
|
5324
5324
|
a.current.forEach((m) => m.dispose()), a.current.clear();
|
|
5325
5325
|
}, []);
|
|
5326
5326
|
const y = D(() => {
|
|
5327
5327
|
const m = t.filter((p) => !p.bypassed);
|
|
5328
5328
|
if (m.length !== 0)
|
|
5329
|
-
return (p, x,
|
|
5329
|
+
return (p, x, w) => {
|
|
5330
5330
|
const f = [];
|
|
5331
|
-
for (const
|
|
5332
|
-
const
|
|
5333
|
-
f.push(
|
|
5331
|
+
for (const C of m) {
|
|
5332
|
+
const v = Bt(C.definition, C.params);
|
|
5333
|
+
f.push(v);
|
|
5334
5334
|
}
|
|
5335
5335
|
if (f.length === 0)
|
|
5336
5336
|
p.connect(x);
|
|
5337
5337
|
else {
|
|
5338
|
-
let
|
|
5339
|
-
f.forEach((
|
|
5340
|
-
|
|
5341
|
-
}),
|
|
5338
|
+
let C = p;
|
|
5339
|
+
f.forEach((v) => {
|
|
5340
|
+
C.connect(v.effect), C = v.effect;
|
|
5341
|
+
}), C.connect(x);
|
|
5342
5342
|
}
|
|
5343
5343
|
return function() {
|
|
5344
|
-
f.forEach((
|
|
5344
|
+
f.forEach((v) => v.dispose());
|
|
5345
5345
|
};
|
|
5346
5346
|
};
|
|
5347
5347
|
}, [t]);
|
|
@@ -5360,9 +5360,9 @@ function Ti(e = 256) {
|
|
|
5360
5360
|
};
|
|
5361
5361
|
}
|
|
5362
5362
|
function Ri() {
|
|
5363
|
-
const [e, t] =
|
|
5363
|
+
const [e, t] = R(
|
|
5364
5364
|
/* @__PURE__ */ new Map()
|
|
5365
|
-
), n =
|
|
5365
|
+
), n = T(/* @__PURE__ */ new Map()), r = T(/* @__PURE__ */ new Map()), a = D((d, b) => {
|
|
5366
5366
|
const y = r.current.get(d);
|
|
5367
5367
|
if (!y) return;
|
|
5368
5368
|
const { graphEnd: m, masterGainNode: p } = y, x = n.current.get(d);
|
|
@@ -5370,17 +5370,17 @@ function Ri() {
|
|
|
5370
5370
|
m.disconnect();
|
|
5371
5371
|
} catch {
|
|
5372
5372
|
}
|
|
5373
|
-
const
|
|
5374
|
-
if (
|
|
5373
|
+
const w = b.map((f) => x?.get(f.instanceId)).filter((f) => f !== void 0);
|
|
5374
|
+
if (w.length === 0)
|
|
5375
5375
|
m.connect(p);
|
|
5376
5376
|
else {
|
|
5377
5377
|
let f = m;
|
|
5378
|
-
|
|
5378
|
+
w.forEach((C) => {
|
|
5379
5379
|
try {
|
|
5380
|
-
|
|
5380
|
+
C.disconnect();
|
|
5381
5381
|
} catch {
|
|
5382
5382
|
}
|
|
5383
|
-
f.connect(
|
|
5383
|
+
f.connect(C.effect), f = C.effect;
|
|
5384
5384
|
}), f.connect(p);
|
|
5385
5385
|
}
|
|
5386
5386
|
}, []), s = D((d, b) => {
|
|
@@ -5390,8 +5390,8 @@ function Ri() {
|
|
|
5390
5390
|
return;
|
|
5391
5391
|
}
|
|
5392
5392
|
const m = {};
|
|
5393
|
-
y.parameters.forEach((
|
|
5394
|
-
m[
|
|
5393
|
+
y.parameters.forEach((w) => {
|
|
5394
|
+
m[w.name] = w.default;
|
|
5395
5395
|
});
|
|
5396
5396
|
const p = Bt(y, m);
|
|
5397
5397
|
n.current.has(d) || n.current.set(d, /* @__PURE__ */ new Map()), n.current.get(d).set(p.instanceId, p);
|
|
@@ -5402,25 +5402,25 @@ function Ri() {
|
|
|
5402
5402
|
params: m,
|
|
5403
5403
|
bypassed: !1
|
|
5404
5404
|
};
|
|
5405
|
-
t((
|
|
5406
|
-
const f = new Map(
|
|
5407
|
-
return f.set(d, [...
|
|
5405
|
+
t((w) => {
|
|
5406
|
+
const f = new Map(w), C = f.get(d) || [];
|
|
5407
|
+
return f.set(d, [...C, x]), f;
|
|
5408
5408
|
});
|
|
5409
5409
|
}, []), o = D((d, b) => {
|
|
5410
5410
|
const y = n.current.get(d), m = y?.get(b);
|
|
5411
5411
|
m && (m.dispose(), y?.delete(b)), t((p) => {
|
|
5412
|
-
const x = new Map(p),
|
|
5413
|
-
return x.set(d,
|
|
5412
|
+
const x = new Map(p), w = x.get(d) || [];
|
|
5413
|
+
return x.set(d, w.filter((f) => f.instanceId !== b)), x;
|
|
5414
5414
|
});
|
|
5415
5415
|
}, []), i = D(
|
|
5416
5416
|
(d, b, y, m) => {
|
|
5417
5417
|
const x = n.current.get(d)?.get(b);
|
|
5418
|
-
x && x.setParameter(y, m), t((
|
|
5419
|
-
const f = new Map(
|
|
5418
|
+
x && x.setParameter(y, m), t((w) => {
|
|
5419
|
+
const f = new Map(w), C = f.get(d) || [];
|
|
5420
5420
|
return f.set(
|
|
5421
5421
|
d,
|
|
5422
|
-
|
|
5423
|
-
(
|
|
5422
|
+
C.map(
|
|
5423
|
+
(v) => v.instanceId === b ? { ...v, params: { ...v.params, [y]: m } } : v
|
|
5424
5424
|
)
|
|
5425
5425
|
), f;
|
|
5426
5426
|
});
|
|
@@ -5430,19 +5430,19 @@ function Ri() {
|
|
|
5430
5430
|
(d, b) => {
|
|
5431
5431
|
const m = (u.current.get(d) || []).find((f) => f.instanceId === b);
|
|
5432
5432
|
if (!m) return;
|
|
5433
|
-
const p = !m.bypassed,
|
|
5434
|
-
if (
|
|
5433
|
+
const p = !m.bypassed, w = n.current.get(d)?.get(b);
|
|
5434
|
+
if (w) {
|
|
5435
5435
|
const f = m.params.wet ?? 1;
|
|
5436
|
-
|
|
5436
|
+
w.setParameter("wet", p ? 0 : f);
|
|
5437
5437
|
}
|
|
5438
5438
|
t((f) => {
|
|
5439
|
-
const
|
|
5440
|
-
return
|
|
5439
|
+
const C = new Map(f), v = C.get(d) || [];
|
|
5440
|
+
return C.set(
|
|
5441
5441
|
d,
|
|
5442
|
-
|
|
5443
|
-
(
|
|
5442
|
+
v.map(
|
|
5443
|
+
(k) => k.instanceId === b ? { ...k, bypassed: p } : k
|
|
5444
5444
|
)
|
|
5445
|
-
),
|
|
5445
|
+
), C;
|
|
5446
5446
|
});
|
|
5447
5447
|
},
|
|
5448
5448
|
[]
|
|
@@ -5452,7 +5452,7 @@ function Ri() {
|
|
|
5452
5452
|
const m = new Map(y);
|
|
5453
5453
|
return m.set(d, []), m;
|
|
5454
5454
|
});
|
|
5455
|
-
}, []), u =
|
|
5455
|
+
}, []), u = T(e);
|
|
5456
5456
|
u.current = e;
|
|
5457
5457
|
const g = D(
|
|
5458
5458
|
(d) => (b, y, m) => {
|
|
@@ -5460,13 +5460,13 @@ function Ri() {
|
|
|
5460
5460
|
graphEnd: b,
|
|
5461
5461
|
masterGainNode: y
|
|
5462
5462
|
});
|
|
5463
|
-
const p = u.current.get(d) || [], x = n.current.get(d),
|
|
5464
|
-
if (
|
|
5463
|
+
const p = u.current.get(d) || [], x = n.current.get(d), w = p.map((f) => x?.get(f.instanceId)).filter((f) => f !== void 0);
|
|
5464
|
+
if (w.length === 0)
|
|
5465
5465
|
b.connect(y);
|
|
5466
5466
|
else {
|
|
5467
5467
|
let f = b;
|
|
5468
|
-
|
|
5469
|
-
f.connect(
|
|
5468
|
+
w.forEach((C) => {
|
|
5469
|
+
f.connect(C.effect), f = C.effect;
|
|
5470
5470
|
}), f.connect(y);
|
|
5471
5471
|
}
|
|
5472
5472
|
return function() {
|
|
@@ -5476,11 +5476,11 @@ function Ri() {
|
|
|
5476
5476
|
[]
|
|
5477
5477
|
// No dependencies - stable function that reads from refs
|
|
5478
5478
|
);
|
|
5479
|
-
|
|
5479
|
+
U(() => {
|
|
5480
5480
|
e.forEach((d, b) => {
|
|
5481
5481
|
a(b, d);
|
|
5482
5482
|
});
|
|
5483
|
-
}, [e, a]),
|
|
5483
|
+
}, [e, a]), U(() => () => {
|
|
5484
5484
|
n.current.forEach((d) => {
|
|
5485
5485
|
d.forEach((b) => b.dispose()), d.clear();
|
|
5486
5486
|
}), n.current.clear();
|
|
@@ -5490,21 +5490,21 @@ function Ri() {
|
|
|
5490
5490
|
const y = (e.get(d) || []).filter((m) => !m.bypassed);
|
|
5491
5491
|
if (y.length !== 0)
|
|
5492
5492
|
return (m, p, x) => {
|
|
5493
|
-
const
|
|
5493
|
+
const w = [];
|
|
5494
5494
|
for (const f of y) {
|
|
5495
|
-
const
|
|
5496
|
-
|
|
5495
|
+
const C = Bt(f.definition, f.params);
|
|
5496
|
+
w.push(C);
|
|
5497
5497
|
}
|
|
5498
|
-
if (
|
|
5498
|
+
if (w.length === 0)
|
|
5499
5499
|
m.connect(p);
|
|
5500
5500
|
else {
|
|
5501
5501
|
let f = m;
|
|
5502
|
-
|
|
5503
|
-
f.connect(
|
|
5502
|
+
w.forEach((C) => {
|
|
5503
|
+
f.connect(C.effect), f = C.effect;
|
|
5504
5504
|
}), f.connect(p);
|
|
5505
5505
|
}
|
|
5506
5506
|
return function() {
|
|
5507
|
-
|
|
5507
|
+
w.forEach((C) => C.dispose());
|
|
5508
5508
|
};
|
|
5509
5509
|
};
|
|
5510
5510
|
},
|
|
@@ -5532,7 +5532,7 @@ function zs(e, t = {}) {
|
|
|
5532
5532
|
if (n === 16)
|
|
5533
5533
|
for (let m = 0; m < s; m++)
|
|
5534
5534
|
for (let p = 0; p < r; p++) {
|
|
5535
|
-
const x = b[p][m],
|
|
5535
|
+
const x = b[p][m], w = Math.max(-1, Math.min(1, x)), f = w < 0 ? w * 32768 : w * 32767;
|
|
5536
5536
|
d.setInt16(y, f, !0), y += 2;
|
|
5537
5537
|
}
|
|
5538
5538
|
else
|
|
@@ -5550,7 +5550,7 @@ function Hs(e, t) {
|
|
|
5550
5550
|
r.href = n, r.download = t, r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
|
|
5551
5551
|
}
|
|
5552
5552
|
function Xs() {
|
|
5553
|
-
const [e, t] =
|
|
5553
|
+
const [e, t] = R(!1), [n, r] = R(0), [a, s] = R(null);
|
|
5554
5554
|
return {
|
|
5555
5555
|
exportWav: D(async (i, l, c = {}) => {
|
|
5556
5556
|
const {
|
|
@@ -5570,23 +5570,23 @@ function Xs() {
|
|
|
5570
5570
|
throw new Error("No tracks to export");
|
|
5571
5571
|
if (g === "individual" && (h === void 0 || h < 0 || h >= i.length))
|
|
5572
5572
|
throw new Error("Invalid track index for individual export");
|
|
5573
|
-
const
|
|
5573
|
+
const w = i[0].clips[0]?.sampleRate || 44100;
|
|
5574
5574
|
let f = 0;
|
|
5575
5575
|
for (const M of i)
|
|
5576
5576
|
for (const _ of M.clips) {
|
|
5577
|
-
const
|
|
5578
|
-
f = Math.max(f,
|
|
5577
|
+
const E = _.startSample + _.durationSamples;
|
|
5578
|
+
f = Math.max(f, E);
|
|
5579
5579
|
}
|
|
5580
|
-
f += Math.round(
|
|
5581
|
-
const
|
|
5582
|
-
let
|
|
5583
|
-
if ((y ||
|
|
5584
|
-
|
|
5585
|
-
|
|
5580
|
+
f += Math.round(w * 0.1);
|
|
5581
|
+
const C = f / w, v = g === "individual" ? [{ track: i[h], state: l[h], index: h }] : i.map((M, _) => ({ track: M, state: l[_], index: _ })), k = l.some((M) => M.soloed), B = !!m;
|
|
5582
|
+
let $;
|
|
5583
|
+
if ((y || B) && b)
|
|
5584
|
+
$ = await Gs(
|
|
5585
|
+
v,
|
|
5586
5586
|
l,
|
|
5587
|
-
|
|
5587
|
+
k,
|
|
5588
|
+
C,
|
|
5588
5589
|
w,
|
|
5589
|
-
v,
|
|
5590
5590
|
y,
|
|
5591
5591
|
m,
|
|
5592
5592
|
(M) => {
|
|
@@ -5594,32 +5594,32 @@ function Xs() {
|
|
|
5594
5594
|
}
|
|
5595
5595
|
);
|
|
5596
5596
|
else {
|
|
5597
|
-
const M = new OfflineAudioContext(2, f,
|
|
5597
|
+
const M = new OfflineAudioContext(2, f, w);
|
|
5598
5598
|
let _ = 0;
|
|
5599
|
-
const
|
|
5600
|
-
for (const { track:
|
|
5601
|
-
if (!(
|
|
5602
|
-
for (const
|
|
5603
|
-
await Ls(M,
|
|
5604
|
-
const
|
|
5605
|
-
r(
|
|
5599
|
+
const E = v.reduce((V, { track: z }) => V + z.clips.length, 0);
|
|
5600
|
+
for (const { track: V, state: z } of v)
|
|
5601
|
+
if (!(z.muted && !z.soloed) && !(k && !z.soloed))
|
|
5602
|
+
for (const P of V.clips) {
|
|
5603
|
+
await Ls(M, P, z, w, b), _++;
|
|
5604
|
+
const K = _ / E * 0.5;
|
|
5605
|
+
r(K), x?.(K);
|
|
5606
5606
|
}
|
|
5607
|
-
r(0.5), x?.(0.5),
|
|
5607
|
+
r(0.5), x?.(0.5), $ = await M.startRendering();
|
|
5608
5608
|
}
|
|
5609
5609
|
r(0.9), x?.(0.9);
|
|
5610
|
-
const
|
|
5610
|
+
const A = zs($, { bitDepth: p });
|
|
5611
5611
|
if (r(1), x?.(1), d) {
|
|
5612
5612
|
const M = g === "individual" ? `${u}_${i[h].name}` : u;
|
|
5613
|
-
Hs(
|
|
5613
|
+
Hs(A, `${M}.wav`);
|
|
5614
5614
|
}
|
|
5615
5615
|
return {
|
|
5616
|
-
audioBuffer:
|
|
5617
|
-
blob:
|
|
5618
|
-
duration:
|
|
5616
|
+
audioBuffer: $,
|
|
5617
|
+
blob: A,
|
|
5618
|
+
duration: C
|
|
5619
5619
|
};
|
|
5620
|
-
} catch (
|
|
5621
|
-
const f =
|
|
5622
|
-
throw s(f),
|
|
5620
|
+
} catch (w) {
|
|
5621
|
+
const f = w instanceof Error ? w.message : "Export failed";
|
|
5622
|
+
throw s(f), w;
|
|
5623
5623
|
} finally {
|
|
5624
5624
|
t(!1);
|
|
5625
5625
|
}
|
|
@@ -5639,21 +5639,21 @@ async function Gs(e, t, n, r, a, s, o, i) {
|
|
|
5639
5639
|
const p = new c(0);
|
|
5640
5640
|
let x;
|
|
5641
5641
|
s ? x = s(p, m, !0) : p.connect(m);
|
|
5642
|
-
for (const { track:
|
|
5642
|
+
for (const { track: w, state: f } of e) {
|
|
5643
5643
|
if (f.muted && !f.soloed || n && !f.soloed) continue;
|
|
5644
|
-
const
|
|
5645
|
-
|
|
5646
|
-
for (const
|
|
5647
|
-
const { audioBuffer:
|
|
5648
|
-
if (
|
|
5649
|
-
const
|
|
5650
|
-
ye.setValueAtTime(0,
|
|
5644
|
+
const C = new c(Ns(f.volume)), v = new g(f.pan), k = new u(f.muted ? 0 : 1), B = o?.(w.id);
|
|
5645
|
+
B ? B(k, p, !0) : k.connect(p), v.connect(k), C.connect(v);
|
|
5646
|
+
for (const $ of w.clips) {
|
|
5647
|
+
const { audioBuffer: A, startSample: M, durationSamples: _, offsetSamples: E, gain: V, fadeIn: z, fadeOut: P } = $, K = M / a, X = _ / a, Z = E / a, Q = new d(A), le = new h(Q), te = new u(V);
|
|
5648
|
+
if (le.connect(te), te.connect(C), z) {
|
|
5649
|
+
const re = K, ae = K + z.duration, ye = te.gain._param;
|
|
5650
|
+
ye.setValueAtTime(0, re), ye.linearRampToValueAtTime(V, ae);
|
|
5651
5651
|
}
|
|
5652
|
-
if (
|
|
5653
|
-
const
|
|
5654
|
-
ye.setValueAtTime(
|
|
5652
|
+
if (P) {
|
|
5653
|
+
const re = K + X - P.duration, ae = K + X, ye = te.gain._param;
|
|
5654
|
+
ye.setValueAtTime(V, re), ye.linearRampToValueAtTime(0, ae);
|
|
5655
5655
|
}
|
|
5656
|
-
|
|
5656
|
+
le.start(K, Z, X);
|
|
5657
5657
|
}
|
|
5658
5658
|
}
|
|
5659
5659
|
y.start(0);
|
|
@@ -5682,12 +5682,12 @@ async function Ls(e, t, n, r, a) {
|
|
|
5682
5682
|
const m = e.createGain(), p = c * n.volume, x = e.createStereoPanner();
|
|
5683
5683
|
if (x.pan.value = n.pan, y.connect(m), m.connect(x), x.connect(e.destination), a) {
|
|
5684
5684
|
if (u ? m.gain.setValueAtTime(0, h) : m.gain.setValueAtTime(p, h), u) {
|
|
5685
|
-
const
|
|
5686
|
-
An(m.gain,
|
|
5685
|
+
const w = h, f = h + u.duration;
|
|
5686
|
+
An(m.gain, w, f, 0, p, u.type || "linear");
|
|
5687
5687
|
}
|
|
5688
5688
|
if (g) {
|
|
5689
|
-
const
|
|
5690
|
-
(!u || u.duration < d - g.duration) && m.gain.setValueAtTime(p,
|
|
5689
|
+
const w = h + d - g.duration, f = h + d;
|
|
5690
|
+
(!u || u.duration < d - g.duration) && m.gain.setValueAtTime(p, w), An(m.gain, w, f, p, 0, g.type || "linear");
|
|
5691
5691
|
}
|
|
5692
5692
|
} else
|
|
5693
5693
|
m.gain.setValueAtTime(p, h);
|
|
@@ -5725,7 +5725,7 @@ function kn(e, t, n, r) {
|
|
|
5725
5725
|
}
|
|
5726
5726
|
return a;
|
|
5727
5727
|
}
|
|
5728
|
-
const lr =
|
|
5728
|
+
const lr = Me(null), cr = Me(null), ur = Me(null), dr = Me(null), mr = Me(null), Ei = ({
|
|
5729
5729
|
tracks: e,
|
|
5730
5730
|
timescale: t = !1,
|
|
5731
5731
|
mono: n = !1,
|
|
@@ -5744,70 +5744,70 @@ const lr = Be(null), cr = Be(null), ur = Be(null), dr = Be(null), mr = Be(null),
|
|
|
5744
5744
|
progressBarWidth: y,
|
|
5745
5745
|
children: m
|
|
5746
5746
|
}) => {
|
|
5747
|
-
const p = y ?? d + b, [x,
|
|
5748
|
-
st.current = W,
|
|
5747
|
+
const p = y ?? d + b, [x, w] = R([]), [f, C] = R(null), [v, k] = R(!1), [B, $] = R(0), [A, M] = R(0), [_, E] = R([]), [V, z] = R([]), [P, K] = R([]), [X, Z] = R(0), [Q, le] = R(0), [te, re] = R(null), [ae, ye] = R(o), [be, Ke] = R(c?.isContinuousPlay ?? !1), [Oe, ke] = R(c?.linkEndpoints ?? !1), [Ue, De] = R(c?.editable ?? !1), [ee, j] = R(!1), [oe, de] = R(0), [me, J] = R(0), [Re, je] = R(!1), F = T(null), ze = T(0), fe = T(0), G = T(null), se = T(P), he = T(0), pe = T(0), xe = T(null), Le = T(null), Je = T(!1), st = T(c?.isContinuousPlay ?? !1), et = T(null), mt = T(a), Ft = T(!1), L = T(0), q = T(0), ie = T(0), ve = T(0), { timeFormat: Se, setTimeFormat: He, formatTime: ce } = bs(), Ee = ws({ initialSamplesPerPixel: a, zoomLevels: s }), $e = Ee.samplesPerPixel, { masterVolume: Qe, setMasterVolume: qe } = ys({ playoutRef: F, initialVolume: 1 }), it = D((W) => {
|
|
5748
|
+
st.current = W, Ke(W);
|
|
5749
5749
|
}, []), Ye = D((W) => {
|
|
5750
|
-
et.current = W,
|
|
5750
|
+
et.current = W, C(W);
|
|
5751
5751
|
}, []), Zt = D((W) => {
|
|
5752
|
-
Ft.current = W,
|
|
5753
|
-
}, []), ft = D((W,
|
|
5754
|
-
|
|
5752
|
+
Ft.current = W, j(W);
|
|
5753
|
+
}, []), ft = D((W, N) => {
|
|
5754
|
+
ie.current = W, ve.current = N, de(W), J(N);
|
|
5755
5755
|
}, []), br = D(() => {
|
|
5756
|
-
const W = L.current,
|
|
5757
|
-
W !==
|
|
5756
|
+
const W = L.current, N = q.current;
|
|
5757
|
+
W !== N && N > W && ft(W, N);
|
|
5758
5758
|
}, [ft]), vr = D(() => {
|
|
5759
5759
|
ft(0, 0);
|
|
5760
5760
|
}, [ft]);
|
|
5761
|
-
|
|
5762
|
-
Je.current =
|
|
5763
|
-
}, [
|
|
5764
|
-
|
|
5765
|
-
}, [
|
|
5766
|
-
L.current =
|
|
5767
|
-
}, [
|
|
5761
|
+
U(() => {
|
|
5762
|
+
Je.current = ae;
|
|
5763
|
+
}, [ae]), U(() => {
|
|
5764
|
+
se.current = P;
|
|
5765
|
+
}, [P]), U(() => {
|
|
5766
|
+
L.current = X, q.current = Q;
|
|
5767
|
+
}, [X, Q]), U(() => {
|
|
5768
5768
|
if (!Le.current || !_.length) return;
|
|
5769
|
-
const W = Le.current,
|
|
5770
|
-
if (
|
|
5771
|
-
const ue = l.show ? l.width : 0,
|
|
5772
|
-
W.scrollLeft =
|
|
5773
|
-
}, [
|
|
5774
|
-
const yt =
|
|
5775
|
-
|
|
5776
|
-
if (
|
|
5777
|
-
|
|
5769
|
+
const W = Le.current, N = mt.current, O = $e;
|
|
5770
|
+
if (N === O) return;
|
|
5771
|
+
const ue = l.show ? l.width : 0, H = W.clientWidth, Ge = W.scrollLeft + H / 2 - ue, lt = _[0].sampleRate, Ce = Ge * N / lt * lt / O, We = Math.max(0, Ce + ue - H / 2);
|
|
5772
|
+
W.scrollLeft = We, mt.current = O;
|
|
5773
|
+
}, [$e, _, l]);
|
|
5774
|
+
const yt = T(null);
|
|
5775
|
+
U(() => {
|
|
5776
|
+
if (je(!1), e.length === 0) {
|
|
5777
|
+
E([]), M(0), K([]), z([]), F.current && (F.current.dispose(), F.current = null);
|
|
5778
5778
|
return;
|
|
5779
5779
|
}
|
|
5780
|
-
const W =
|
|
5781
|
-
return
|
|
5780
|
+
const W = v, N = fe.current;
|
|
5781
|
+
return F.current && W && (F.current.stop(), G.current && (cancelAnimationFrame(G.current), G.current = null), yt.current = { position: N }), (async () => {
|
|
5782
5782
|
try {
|
|
5783
5783
|
const ue = [];
|
|
5784
5784
|
e.forEach((we) => {
|
|
5785
5785
|
we.clips.length > 0 && we.clips[0].audioBuffer && ue.push(we.clips[0].audioBuffer);
|
|
5786
5786
|
});
|
|
5787
|
-
let
|
|
5787
|
+
let H = 0;
|
|
5788
5788
|
e.forEach((we) => {
|
|
5789
|
-
we.clips.forEach((
|
|
5790
|
-
const
|
|
5791
|
-
|
|
5789
|
+
we.clips.forEach((Ce) => {
|
|
5790
|
+
const We = Ce.sampleRate, Ct = (Ce.startSample + Ce.durationSamples) / We;
|
|
5791
|
+
H = Math.max(H, Ct);
|
|
5792
5792
|
});
|
|
5793
|
-
}),
|
|
5794
|
-
...
|
|
5795
|
-
name: e[
|
|
5796
|
-
})) : e.map((
|
|
5797
|
-
name:
|
|
5798
|
-
muted:
|
|
5799
|
-
soloed:
|
|
5800
|
-
volume:
|
|
5801
|
-
pan:
|
|
5802
|
-
}))),
|
|
5803
|
-
const
|
|
5793
|
+
}), E(ue), M(H), K((we) => we.length === e.length ? we.map((Ce, We) => ({
|
|
5794
|
+
...Ce,
|
|
5795
|
+
name: e[We].name
|
|
5796
|
+
})) : e.map((Ce) => ({
|
|
5797
|
+
name: Ce.name,
|
|
5798
|
+
muted: Ce.muted,
|
|
5799
|
+
soloed: Ce.soloed,
|
|
5800
|
+
volume: Ce.volume,
|
|
5801
|
+
pan: Ce.pan
|
|
5802
|
+
}))), F.current && F.current.dispose();
|
|
5803
|
+
const Ie = new Ca({
|
|
5804
5804
|
effects: u
|
|
5805
|
-
}),
|
|
5806
|
-
e.forEach((we,
|
|
5807
|
-
const
|
|
5808
|
-
if (
|
|
5809
|
-
const ht =
|
|
5810
|
-
id: `track-${
|
|
5805
|
+
}), Ge = se.current;
|
|
5806
|
+
e.forEach((we, Ce) => {
|
|
5807
|
+
const We = we.clips.filter((ht) => ht.audioBuffer);
|
|
5808
|
+
if (We.length > 0) {
|
|
5809
|
+
const ht = We[0].sampleRate, Ct = Math.min(...We.map((_e) => _e.startSample / ht)), Rr = Math.max(...We.map((_e) => (_e.startSample + _e.durationSamples) / ht)), xt = Ge[Ce], Er = {
|
|
5810
|
+
id: `track-${Ce}`,
|
|
5811
5811
|
// Use consistent index-based ID for track controls
|
|
5812
5812
|
name: we.name,
|
|
5813
5813
|
gain: xt?.volume ?? we.volume,
|
|
@@ -5816,32 +5816,32 @@ const lr = Be(null), cr = Be(null), ur = Be(null), dr = Be(null), mr = Be(null),
|
|
|
5816
5816
|
stereoPan: xt?.pan ?? we.pan,
|
|
5817
5817
|
startTime: Ct,
|
|
5818
5818
|
endTime: Rr
|
|
5819
|
-
}, Wr =
|
|
5820
|
-
const Pt =
|
|
5819
|
+
}, Wr = We.map((_e) => {
|
|
5820
|
+
const Pt = _e.sampleRate;
|
|
5821
5821
|
return {
|
|
5822
|
-
buffer:
|
|
5822
|
+
buffer: _e.audioBuffer,
|
|
5823
5823
|
// We filtered for audioBuffer above
|
|
5824
|
-
startTime:
|
|
5824
|
+
startTime: _e.startSample / Pt - Ct,
|
|
5825
5825
|
// Make relative to track start
|
|
5826
|
-
duration:
|
|
5827
|
-
offset:
|
|
5828
|
-
fadeIn:
|
|
5829
|
-
fadeOut:
|
|
5830
|
-
gain:
|
|
5826
|
+
duration: _e.durationSamples / Pt,
|
|
5827
|
+
offset: _e.offsetSamples / Pt,
|
|
5828
|
+
fadeIn: _e.fadeIn,
|
|
5829
|
+
fadeOut: _e.fadeOut,
|
|
5830
|
+
gain: _e.gain
|
|
5831
5831
|
};
|
|
5832
5832
|
});
|
|
5833
|
-
|
|
5833
|
+
Ie.addTrack({
|
|
5834
5834
|
clips: Wr,
|
|
5835
5835
|
track: Er,
|
|
5836
5836
|
effects: we.effects
|
|
5837
5837
|
// Pass track effects
|
|
5838
5838
|
});
|
|
5839
5839
|
}
|
|
5840
|
-
}),
|
|
5840
|
+
}), Ie.applyInitialSoloState(), F.current = Ie, je(!0);
|
|
5841
5841
|
const lt = new CustomEvent("waveform-playlist:ready", {
|
|
5842
5842
|
detail: {
|
|
5843
5843
|
trackCount: e.length,
|
|
5844
|
-
duration:
|
|
5844
|
+
duration: H
|
|
5845
5845
|
}
|
|
5846
5846
|
});
|
|
5847
5847
|
window.dispatchEvent(lt), g?.();
|
|
@@ -5849,206 +5849,206 @@ const lr = Be(null), cr = Be(null), ur = Be(null), dr = Be(null), mr = Be(null),
|
|
|
5849
5849
|
console.error("Error loading audio:", ue);
|
|
5850
5850
|
}
|
|
5851
5851
|
})(), () => {
|
|
5852
|
-
|
|
5852
|
+
G.current && cancelAnimationFrame(G.current), F.current && F.current.dispose();
|
|
5853
5853
|
};
|
|
5854
|
-
}, [e, g,
|
|
5854
|
+
}, [e, g, v]), U(() => {
|
|
5855
5855
|
if (e.length === 0) return;
|
|
5856
|
-
const W = 16,
|
|
5857
|
-
if (
|
|
5858
|
-
const
|
|
5859
|
-
|
|
5856
|
+
const W = 16, N = e.map((O) => O.clips.map((H) => {
|
|
5857
|
+
if (H.waveformData) {
|
|
5858
|
+
const Ge = tr(
|
|
5859
|
+
H.waveformData,
|
|
5860
5860
|
// Cast to WaveformData type
|
|
5861
|
-
|
|
5861
|
+
$e,
|
|
5862
5862
|
0,
|
|
5863
5863
|
// channel index
|
|
5864
|
-
|
|
5865
|
-
|
|
5864
|
+
H.offsetSamples,
|
|
5865
|
+
H.durationSamples
|
|
5866
5866
|
);
|
|
5867
5867
|
return {
|
|
5868
|
-
clipId:
|
|
5869
|
-
trackName:
|
|
5868
|
+
clipId: H.id,
|
|
5869
|
+
trackName: O.name,
|
|
5870
5870
|
peaks: {
|
|
5871
|
-
length:
|
|
5872
|
-
data: [
|
|
5871
|
+
length: Ge.length,
|
|
5872
|
+
data: [Ge.data],
|
|
5873
5873
|
// Wrap in array for channel compatibility
|
|
5874
|
-
bits:
|
|
5874
|
+
bits: Ge.bits
|
|
5875
5875
|
},
|
|
5876
|
-
startSample:
|
|
5877
|
-
durationSamples:
|
|
5878
|
-
fadeIn:
|
|
5879
|
-
fadeOut:
|
|
5876
|
+
startSample: H.startSample,
|
|
5877
|
+
durationSamples: H.durationSamples,
|
|
5878
|
+
fadeIn: H.fadeIn,
|
|
5879
|
+
fadeOut: H.fadeOut
|
|
5880
5880
|
};
|
|
5881
5881
|
}
|
|
5882
|
-
if (!
|
|
5883
|
-
return console.warn(`Clip "${
|
|
5884
|
-
clipId:
|
|
5885
|
-
trackName:
|
|
5882
|
+
if (!H.audioBuffer)
|
|
5883
|
+
return console.warn(`Clip "${H.name || H.id}" has neither waveformData nor audioBuffer - rendering empty`), {
|
|
5884
|
+
clipId: H.id,
|
|
5885
|
+
trackName: O.name,
|
|
5886
5886
|
peaks: {
|
|
5887
5887
|
length: 0,
|
|
5888
5888
|
data: [],
|
|
5889
5889
|
bits: W
|
|
5890
5890
|
},
|
|
5891
|
-
startSample:
|
|
5892
|
-
durationSamples:
|
|
5893
|
-
fadeIn:
|
|
5894
|
-
fadeOut:
|
|
5891
|
+
startSample: H.startSample,
|
|
5892
|
+
durationSamples: H.durationSamples,
|
|
5893
|
+
fadeIn: H.fadeIn,
|
|
5894
|
+
fadeOut: H.fadeOut
|
|
5895
5895
|
};
|
|
5896
|
-
const
|
|
5897
|
-
|
|
5898
|
-
|
|
5896
|
+
const Ie = To(
|
|
5897
|
+
H.audioBuffer,
|
|
5898
|
+
$e,
|
|
5899
5899
|
n,
|
|
5900
5900
|
W,
|
|
5901
|
-
|
|
5902
|
-
|
|
5901
|
+
H.offsetSamples,
|
|
5902
|
+
H.durationSamples
|
|
5903
5903
|
);
|
|
5904
5904
|
return {
|
|
5905
|
-
clipId:
|
|
5906
|
-
trackName:
|
|
5907
|
-
peaks:
|
|
5908
|
-
startSample:
|
|
5909
|
-
durationSamples:
|
|
5910
|
-
fadeIn:
|
|
5911
|
-
fadeOut:
|
|
5905
|
+
clipId: H.id,
|
|
5906
|
+
trackName: O.name,
|
|
5907
|
+
peaks: Ie,
|
|
5908
|
+
startSample: H.startSample,
|
|
5909
|
+
durationSamples: H.durationSamples,
|
|
5910
|
+
fadeIn: H.fadeIn,
|
|
5911
|
+
fadeOut: H.fadeOut
|
|
5912
5912
|
};
|
|
5913
5913
|
}));
|
|
5914
|
-
|
|
5915
|
-
}, [e,
|
|
5914
|
+
z(N);
|
|
5915
|
+
}, [e, $e, n]), U(() => {
|
|
5916
5916
|
if (c?.annotations) {
|
|
5917
|
-
const W = c.annotations.map((
|
|
5918
|
-
|
|
5917
|
+
const W = c.annotations.map((N) => typeof N.start == "number" ? N : nr(N));
|
|
5918
|
+
w(W);
|
|
5919
5919
|
}
|
|
5920
5920
|
}, [c]);
|
|
5921
5921
|
const tt = D(() => {
|
|
5922
|
-
|
|
5922
|
+
G.current && (cancelAnimationFrame(G.current), G.current = null);
|
|
5923
5923
|
const W = () => {
|
|
5924
|
-
const
|
|
5925
|
-
if (fe.current =
|
|
5926
|
-
const
|
|
5927
|
-
(
|
|
5924
|
+
const N = Ae().currentTime - he.current, O = pe.current + N;
|
|
5925
|
+
if (fe.current = O, $(O), x.length > 0) {
|
|
5926
|
+
const H = x.find(
|
|
5927
|
+
(Ie) => O >= Ie.start && O < Ie.end
|
|
5928
5928
|
);
|
|
5929
5929
|
if (st.current)
|
|
5930
|
-
|
|
5930
|
+
H && H.id !== et.current ? Ye(H.id) : !H && et.current !== null && Ye(null);
|
|
5931
5931
|
else if (et.current) {
|
|
5932
|
-
const
|
|
5933
|
-
if (
|
|
5934
|
-
|
|
5932
|
+
const Ie = x.find((Ge) => Ge.id === et.current);
|
|
5933
|
+
if (Ie && O >= Ie.end) {
|
|
5934
|
+
F.current && F.current.stop(), k(!1), fe.current = ze.current, $(ze.current);
|
|
5935
5935
|
return;
|
|
5936
5936
|
}
|
|
5937
5937
|
} else
|
|
5938
|
-
|
|
5938
|
+
H && Ye(H.id);
|
|
5939
5939
|
}
|
|
5940
5940
|
if (Je.current && Le.current && _.length > 0) {
|
|
5941
|
-
const
|
|
5942
|
-
|
|
5941
|
+
const H = Le.current, Ie = _[0].sampleRate, Ge = O * Ie / mt.current, lt = H.clientWidth, we = l.show ? l.width : 0, Ce = Ge + we, We = Math.max(0, Ce - lt / 2);
|
|
5942
|
+
H.scrollLeft = We;
|
|
5943
5943
|
}
|
|
5944
|
-
if (
|
|
5945
|
-
|
|
5944
|
+
if (xe.current !== null && O >= xe.current) {
|
|
5945
|
+
F.current && F.current.stop(), k(!1), fe.current = xe.current, $(xe.current), xe.current = null;
|
|
5946
5946
|
return;
|
|
5947
5947
|
}
|
|
5948
|
-
const ue =
|
|
5949
|
-
if (Ft.current && ue &&
|
|
5950
|
-
|
|
5951
|
-
const
|
|
5952
|
-
he.current =
|
|
5948
|
+
const ue = ie.current !== ve.current && ve.current > ie.current;
|
|
5949
|
+
if (Ft.current && ue && O >= ve.current) {
|
|
5950
|
+
F.current?.stop();
|
|
5951
|
+
const Ie = Ae().currentTime;
|
|
5952
|
+
he.current = Ie, pe.current = ie.current, fe.current = ie.current, F.current?.play(Ie, ie.current), G.current = requestAnimationFrame(W);
|
|
5953
5953
|
return;
|
|
5954
5954
|
}
|
|
5955
|
-
if (
|
|
5956
|
-
|
|
5955
|
+
if (O >= A) {
|
|
5956
|
+
F.current && F.current.stop(), k(!1), fe.current = ze.current, $(ze.current), Ye(null);
|
|
5957
5957
|
return;
|
|
5958
5958
|
}
|
|
5959
|
-
|
|
5959
|
+
G.current = requestAnimationFrame(W);
|
|
5960
5960
|
};
|
|
5961
|
-
|
|
5962
|
-
}, [
|
|
5963
|
-
|
|
5961
|
+
G.current = requestAnimationFrame(W);
|
|
5962
|
+
}, [A, _, $e, x, be]), Xe = D(() => {
|
|
5963
|
+
G.current && (cancelAnimationFrame(G.current), G.current = null);
|
|
5964
5964
|
}, []);
|
|
5965
|
-
|
|
5965
|
+
U(() => {
|
|
5966
5966
|
(async () => {
|
|
5967
|
-
if (
|
|
5967
|
+
if (v && G.current && F.current)
|
|
5968
5968
|
if (be) {
|
|
5969
|
-
const
|
|
5970
|
-
|
|
5969
|
+
const N = fe.current;
|
|
5970
|
+
F.current.stop(), Xe(), await F.current.init(), F.current.setOnPlaybackComplete(() => {
|
|
5971
5971
|
});
|
|
5972
|
-
const ue =
|
|
5973
|
-
he.current = ue, pe.current =
|
|
5972
|
+
const ue = Ae().currentTime;
|
|
5973
|
+
he.current = ue, pe.current = N, F.current.play(ue, N), tt();
|
|
5974
5974
|
} else
|
|
5975
|
-
|
|
5975
|
+
Xe(), tt();
|
|
5976
5976
|
})();
|
|
5977
|
-
}, [be,
|
|
5977
|
+
}, [be, v, tt, Xe]), U(() => {
|
|
5978
5978
|
(async () => {
|
|
5979
|
-
if (yt.current &&
|
|
5980
|
-
const { position:
|
|
5981
|
-
yt.current = null, await
|
|
5979
|
+
if (yt.current && F.current) {
|
|
5980
|
+
const { position: N } = yt.current;
|
|
5981
|
+
yt.current = null, await F.current.init(), F.current.setOnPlaybackComplete(() => {
|
|
5982
5982
|
});
|
|
5983
|
-
const ue =
|
|
5984
|
-
he.current = ue, pe.current =
|
|
5983
|
+
const ue = Ae().currentTime;
|
|
5984
|
+
he.current = ue, pe.current = N, F.current.play(ue, N), k(!0), tt();
|
|
5985
5985
|
}
|
|
5986
5986
|
})();
|
|
5987
5987
|
}, [e, tt]);
|
|
5988
|
-
const Vt = D(async (W,
|
|
5989
|
-
if (!
|
|
5990
|
-
await
|
|
5991
|
-
const
|
|
5992
|
-
|
|
5993
|
-
}),
|
|
5994
|
-
const
|
|
5995
|
-
he.current =
|
|
5996
|
-
}, [_.length, tt,
|
|
5997
|
-
if (!
|
|
5998
|
-
const W =
|
|
5999
|
-
|
|
6000
|
-
}, [
|
|
6001
|
-
|
|
6002
|
-
}, [
|
|
6003
|
-
const
|
|
6004
|
-
fe.current =
|
|
6005
|
-
}, [
|
|
6006
|
-
const
|
|
6007
|
-
if (
|
|
5988
|
+
const Vt = D(async (W, N) => {
|
|
5989
|
+
if (!F.current || _.length === 0) return;
|
|
5990
|
+
await F.current.init(), await Bn();
|
|
5991
|
+
const O = W ?? fe.current;
|
|
5992
|
+
ze.current = O, fe.current = O, F.current.setOnPlaybackComplete(() => {
|
|
5993
|
+
}), F.current.stop(), Xe();
|
|
5994
|
+
const H = Ae().currentTime;
|
|
5995
|
+
he.current = H, pe.current = O, xe.current = N !== void 0 ? O + N : null, F.current.play(H, O, N), k(!0), tt();
|
|
5996
|
+
}, [_.length, tt, Xe]), wr = D(() => {
|
|
5997
|
+
if (!F.current) return;
|
|
5998
|
+
const W = Ae().currentTime - he.current, N = pe.current + W;
|
|
5999
|
+
F.current.pause(), k(!1), Xe(), fe.current = N, $(N);
|
|
6000
|
+
}, [Xe]), yr = D(() => {
|
|
6001
|
+
F.current && (F.current.stop(), k(!1), Xe(), fe.current = ze.current, $(ze.current), Ye(null));
|
|
6002
|
+
}, [Xe]), Cr = D((W) => {
|
|
6003
|
+
const N = Math.max(0, Math.min(W, A));
|
|
6004
|
+
fe.current = N, $(N), v && F.current && (F.current.stop(), Xe(), Vt(N));
|
|
6005
|
+
}, [A, v, Vt, Xe]), xr = D((W, N) => {
|
|
6006
|
+
const O = [...P];
|
|
6007
|
+
if (O[W] = { ...O[W], muted: N }, K(O), F.current) {
|
|
6008
6008
|
const ue = `track-${W}`;
|
|
6009
|
-
|
|
6009
|
+
F.current.setMute(ue, N);
|
|
6010
6010
|
}
|
|
6011
|
-
}, [
|
|
6012
|
-
const
|
|
6013
|
-
if (
|
|
6011
|
+
}, [P]), Ir = D((W, N) => {
|
|
6012
|
+
const O = [...P];
|
|
6013
|
+
if (O[W] = { ...O[W], soloed: N }, K(O), F.current) {
|
|
6014
6014
|
const ue = `track-${W}`;
|
|
6015
|
-
|
|
6015
|
+
F.current.setSolo(ue, N);
|
|
6016
6016
|
}
|
|
6017
|
-
}, [
|
|
6018
|
-
const
|
|
6019
|
-
if (
|
|
6020
|
-
const ue = `track-${W}`,
|
|
6021
|
-
|
|
6017
|
+
}, [P]), Ar = D((W, N) => {
|
|
6018
|
+
const O = [...P];
|
|
6019
|
+
if (O[W] = { ...O[W], volume: N }, K(O), F.current) {
|
|
6020
|
+
const ue = `track-${W}`, H = F.current.getTrack(ue);
|
|
6021
|
+
H && H.setVolume(N);
|
|
6022
6022
|
}
|
|
6023
|
-
}, [
|
|
6024
|
-
const
|
|
6025
|
-
if (
|
|
6026
|
-
const ue = `track-${W}`,
|
|
6027
|
-
|
|
6023
|
+
}, [P]), kr = D((W, N) => {
|
|
6024
|
+
const O = [...P];
|
|
6025
|
+
if (O[W] = { ...O[W], pan: N }, K(O), F.current) {
|
|
6026
|
+
const ue = `track-${W}`, H = F.current.getTrack(ue);
|
|
6027
|
+
H && H.setPan(N);
|
|
6028
6028
|
}
|
|
6029
|
-
}, [
|
|
6030
|
-
Z(W),
|
|
6031
|
-
}, [
|
|
6029
|
+
}, [P]), Sr = D((W, N) => {
|
|
6030
|
+
Z(W), le(N), fe.current = W, $(W), v && F.current && (F.current.stop(), F.current.play(Ae().currentTime, W));
|
|
6031
|
+
}, [v]), $r = D((W) => {
|
|
6032
6032
|
Le.current = W;
|
|
6033
6033
|
}, []), Mr = _[0]?.sampleRate || 44100, tn = t ? 30 : 0, Br = e.length * r + tn, nn = {
|
|
6034
|
-
isPlaying:
|
|
6035
|
-
currentTime:
|
|
6034
|
+
isPlaying: v,
|
|
6035
|
+
currentTime: B,
|
|
6036
6036
|
currentTimeRef: fe,
|
|
6037
6037
|
playbackStartTimeRef: he,
|
|
6038
6038
|
audioStartPositionRef: pe
|
|
6039
6039
|
}, rn = {
|
|
6040
6040
|
continuousPlay: be,
|
|
6041
6041
|
linkEndpoints: Oe,
|
|
6042
|
-
annotationsEditable:
|
|
6043
|
-
isAutomaticScroll:
|
|
6044
|
-
isLoopEnabled:
|
|
6042
|
+
annotationsEditable: Ue,
|
|
6043
|
+
isAutomaticScroll: ae,
|
|
6044
|
+
isLoopEnabled: ee,
|
|
6045
6045
|
annotations: x,
|
|
6046
6046
|
activeAnnotationId: f,
|
|
6047
|
-
selectionStart:
|
|
6048
|
-
selectionEnd:
|
|
6049
|
-
selectedTrackId:
|
|
6050
|
-
loopStart:
|
|
6051
|
-
loopEnd:
|
|
6047
|
+
selectionStart: X,
|
|
6048
|
+
selectionEnd: Q,
|
|
6049
|
+
selectedTrackId: te,
|
|
6050
|
+
loopStart: oe,
|
|
6051
|
+
loopEnd: me
|
|
6052
6052
|
}, an = {
|
|
6053
6053
|
// Playback controls
|
|
6054
6054
|
play: Vt,
|
|
@@ -6056,7 +6056,7 @@ const lr = Be(null), cr = Be(null), ur = Be(null), dr = Be(null), mr = Be(null),
|
|
|
6056
6056
|
stop: yr,
|
|
6057
6057
|
seekTo: Cr,
|
|
6058
6058
|
setCurrentTime: (W) => {
|
|
6059
|
-
fe.current = W,
|
|
6059
|
+
fe.current = W, $(W);
|
|
6060
6060
|
},
|
|
6061
6061
|
// Track controls
|
|
6062
6062
|
setTrackMute: xr,
|
|
@@ -6065,13 +6065,13 @@ const lr = Be(null), cr = Be(null), ur = Be(null), dr = Be(null), mr = Be(null),
|
|
|
6065
6065
|
setTrackPan: kr,
|
|
6066
6066
|
// Selection
|
|
6067
6067
|
setSelection: Sr,
|
|
6068
|
-
setSelectedTrackId:
|
|
6068
|
+
setSelectedTrackId: re,
|
|
6069
6069
|
// Time format
|
|
6070
|
-
setTimeFormat:
|
|
6070
|
+
setTimeFormat: He,
|
|
6071
6071
|
formatTime: ce,
|
|
6072
6072
|
// Zoom
|
|
6073
|
-
zoomIn:
|
|
6074
|
-
zoomOut:
|
|
6073
|
+
zoomIn: Ee.zoomIn,
|
|
6074
|
+
zoomOut: Ee.zoomOut,
|
|
6075
6075
|
// Master volume
|
|
6076
6076
|
setMasterVolume: qe,
|
|
6077
6077
|
// Automatic scroll
|
|
@@ -6082,9 +6082,9 @@ const lr = Be(null), cr = Be(null), ur = Be(null), dr = Be(null), mr = Be(null),
|
|
|
6082
6082
|
scrollContainerRef: Le,
|
|
6083
6083
|
// Annotation controls
|
|
6084
6084
|
setContinuousPlay: it,
|
|
6085
|
-
setLinkEndpoints:
|
|
6086
|
-
setAnnotationsEditable:
|
|
6087
|
-
setAnnotations:
|
|
6085
|
+
setLinkEndpoints: ke,
|
|
6086
|
+
setAnnotationsEditable: De,
|
|
6087
|
+
setAnnotations: w,
|
|
6088
6088
|
setActiveAnnotationId: Ye,
|
|
6089
6089
|
// Loop controls
|
|
6090
6090
|
setLoopEnabled: Zt,
|
|
@@ -6092,26 +6092,26 @@ const lr = Be(null), cr = Be(null), ur = Be(null), dr = Be(null), mr = Be(null),
|
|
|
6092
6092
|
setLoopRegionFromSelection: br,
|
|
6093
6093
|
clearLoopRegion: vr
|
|
6094
6094
|
}, on = {
|
|
6095
|
-
duration:
|
|
6095
|
+
duration: A,
|
|
6096
6096
|
audioBuffers: _,
|
|
6097
|
-
peaksDataArray:
|
|
6098
|
-
trackStates:
|
|
6097
|
+
peaksDataArray: V,
|
|
6098
|
+
trackStates: P,
|
|
6099
6099
|
tracks: e,
|
|
6100
6100
|
sampleRate: Mr,
|
|
6101
6101
|
waveHeight: r,
|
|
6102
6102
|
timeScaleHeight: tn,
|
|
6103
6103
|
minimumPlaylistHeight: Br,
|
|
6104
6104
|
controls: l,
|
|
6105
|
-
playoutRef:
|
|
6106
|
-
samplesPerPixel:
|
|
6107
|
-
timeFormat:
|
|
6105
|
+
playoutRef: F,
|
|
6106
|
+
samplesPerPixel: $e,
|
|
6107
|
+
timeFormat: Se,
|
|
6108
6108
|
masterVolume: Qe,
|
|
6109
|
-
canZoomIn:
|
|
6110
|
-
canZoomOut:
|
|
6109
|
+
canZoomIn: Ee.canZoomIn,
|
|
6110
|
+
canZoomOut: Ee.canZoomOut,
|
|
6111
6111
|
barWidth: d,
|
|
6112
6112
|
barGap: b,
|
|
6113
6113
|
progressBarWidth: p,
|
|
6114
|
-
isReady:
|
|
6114
|
+
isReady: Re
|
|
6115
6115
|
}, Dr = {
|
|
6116
6116
|
...nn,
|
|
6117
6117
|
...rn,
|
|
@@ -6119,12 +6119,12 @@ const lr = Be(null), cr = Be(null), ur = Be(null), dr = Be(null), mr = Be(null),
|
|
|
6119
6119
|
...on
|
|
6120
6120
|
}, Tr = { ...zn, ...i };
|
|
6121
6121
|
return /* @__PURE__ */ I(Rn, { theme: Tr, children: /* @__PURE__ */ I(lr.Provider, { value: nn, children: /* @__PURE__ */ I(cr.Provider, { value: rn, children: /* @__PURE__ */ I(ur.Provider, { value: an, children: /* @__PURE__ */ I(dr.Provider, { value: on, children: /* @__PURE__ */ I(mr.Provider, { value: Dr, children: m }) }) }) }) }) });
|
|
6122
|
-
},
|
|
6122
|
+
}, Ze = () => {
|
|
6123
6123
|
const e = Te(lr);
|
|
6124
6124
|
if (!e)
|
|
6125
6125
|
throw new Error("usePlaybackAnimation must be used within WaveformPlaylistProvider");
|
|
6126
6126
|
return e;
|
|
6127
|
-
},
|
|
6127
|
+
}, Ne = () => {
|
|
6128
6128
|
const e = Te(cr);
|
|
6129
6129
|
if (!e)
|
|
6130
6130
|
throw new Error("usePlaylistState must be used within WaveformPlaylistProvider");
|
|
@@ -6134,7 +6134,7 @@ const lr = Be(null), cr = Be(null), ur = Be(null), dr = Be(null), mr = Be(null),
|
|
|
6134
6134
|
if (!e)
|
|
6135
6135
|
throw new Error("usePlaylistControls must be used within WaveformPlaylistProvider");
|
|
6136
6136
|
return e;
|
|
6137
|
-
},
|
|
6137
|
+
}, Be = () => {
|
|
6138
6138
|
const e = Te(dr);
|
|
6139
6139
|
if (!e)
|
|
6140
6140
|
throw new Error("usePlaylistData must be used within WaveformPlaylistProvider");
|
|
@@ -6386,7 +6386,7 @@ var Ys = class {
|
|
|
6386
6386
|
return this.track?.peaks.sample_rate ?? 44100;
|
|
6387
6387
|
}
|
|
6388
6388
|
};
|
|
6389
|
-
const fr =
|
|
6389
|
+
const fr = Me(null), hr = Me(null), pr = Me(null), gr = Me(null), _i = ({
|
|
6390
6390
|
track: e,
|
|
6391
6391
|
samplesPerPixel: t = 1024,
|
|
6392
6392
|
waveHeight: n = 100,
|
|
@@ -6402,180 +6402,180 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6402
6402
|
onReady: h,
|
|
6403
6403
|
children: d
|
|
6404
6404
|
}) => {
|
|
6405
|
-
const b = g ?? c + u, [y, m] =
|
|
6405
|
+
const b = g ?? c + u, [y, m] = R(!1), [p, x] = R(0), [w, f] = R(0), [C, v] = R([]), [k, B] = R(a), [$, A] = R([]), [M, _] = R(null), [E, V] = R(
|
|
6406
6406
|
l?.isContinuousPlay ?? !1
|
|
6407
|
-
), [
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
}, [
|
|
6411
|
-
|
|
6412
|
-
}, [
|
|
6413
|
-
const be = D((
|
|
6414
|
-
|
|
6415
|
-
}, []),
|
|
6416
|
-
|
|
6417
|
-
}, []), Oe = D((
|
|
6418
|
-
|
|
6419
|
-
}, []),
|
|
6420
|
-
|
|
6421
|
-
const
|
|
6407
|
+
), [z] = R(t), [P, K] = R(s), X = T(null), Z = T(0), Q = T(null), le = T(E), te = T(null), re = T(null), ae = T(s), ye = T(t);
|
|
6408
|
+
U(() => {
|
|
6409
|
+
le.current = E;
|
|
6410
|
+
}, [E]), U(() => {
|
|
6411
|
+
ae.current = P;
|
|
6412
|
+
}, [P]);
|
|
6413
|
+
const be = D((G) => {
|
|
6414
|
+
te.current = G, _(G);
|
|
6415
|
+
}, []), Ke = D((G) => {
|
|
6416
|
+
le.current = G, V(G);
|
|
6417
|
+
}, []), Oe = D((G) => {
|
|
6418
|
+
re.current = G;
|
|
6419
|
+
}, []), ke = e.waveformData.sample_rate;
|
|
6420
|
+
U(() => {
|
|
6421
|
+
const G = new Os({
|
|
6422
6422
|
playbackRate: a
|
|
6423
6423
|
});
|
|
6424
|
-
|
|
6424
|
+
G.addTrack({
|
|
6425
6425
|
source: e.source,
|
|
6426
6426
|
peaks: e.waveformData,
|
|
6427
6427
|
name: e.name
|
|
6428
6428
|
});
|
|
6429
|
-
const
|
|
6430
|
-
return
|
|
6429
|
+
const se = G.getTrack(G.track?.id ?? "");
|
|
6430
|
+
return se && se.setOnTimeUpdateCallback((he) => {
|
|
6431
6431
|
Z.current = he;
|
|
6432
|
-
}),
|
|
6432
|
+
}), G.setOnPlaybackComplete(() => {
|
|
6433
6433
|
m(!1);
|
|
6434
|
-
}),
|
|
6435
|
-
|
|
6434
|
+
}), X.current = G, f(e.waveformData.duration), h?.(), () => {
|
|
6435
|
+
Q.current && cancelAnimationFrame(Q.current), G.dispose();
|
|
6436
6436
|
};
|
|
6437
|
-
}, [e.source, e.waveformData, e.name, a, h]),
|
|
6438
|
-
const
|
|
6437
|
+
}, [e.source, e.waveformData, e.name, a, h]), U(() => {
|
|
6438
|
+
const G = tr(
|
|
6439
6439
|
e.waveformData,
|
|
6440
|
-
|
|
6440
|
+
z,
|
|
6441
6441
|
0,
|
|
6442
6442
|
// channel index
|
|
6443
6443
|
0,
|
|
6444
6444
|
// offset
|
|
6445
|
-
Math.ceil(e.waveformData.duration *
|
|
6445
|
+
Math.ceil(e.waveformData.duration * ke)
|
|
6446
6446
|
// duration in samples
|
|
6447
|
-
),
|
|
6447
|
+
), se = {
|
|
6448
6448
|
clipId: "media-element-clip",
|
|
6449
6449
|
trackName: e.name ?? "Track",
|
|
6450
6450
|
peaks: {
|
|
6451
|
-
length:
|
|
6452
|
-
data: [
|
|
6453
|
-
bits:
|
|
6451
|
+
length: G.length,
|
|
6452
|
+
data: [G.data],
|
|
6453
|
+
bits: G.bits
|
|
6454
6454
|
},
|
|
6455
6455
|
startSample: 0,
|
|
6456
|
-
durationSamples: Math.ceil(e.waveformData.duration *
|
|
6456
|
+
durationSamples: Math.ceil(e.waveformData.duration * ke)
|
|
6457
6457
|
};
|
|
6458
|
-
|
|
6459
|
-
}, [e.waveformData, e.name,
|
|
6458
|
+
v([[se]]);
|
|
6459
|
+
}, [e.waveformData, e.name, z, ke]), U(() => {
|
|
6460
6460
|
if (l?.annotations) {
|
|
6461
|
-
const
|
|
6462
|
-
|
|
6461
|
+
const G = l.annotations.map((se) => typeof se.start == "number" ? se : nr(se));
|
|
6462
|
+
A(G);
|
|
6463
6463
|
}
|
|
6464
6464
|
}, [l]);
|
|
6465
|
-
const
|
|
6466
|
-
|
|
6467
|
-
const
|
|
6468
|
-
const
|
|
6469
|
-
if (Z.current =
|
|
6470
|
-
const he =
|
|
6471
|
-
(pe) =>
|
|
6465
|
+
const Ue = D(() => {
|
|
6466
|
+
Q.current && cancelAnimationFrame(Q.current);
|
|
6467
|
+
const G = () => {
|
|
6468
|
+
const se = X.current?.getCurrentTime() ?? 0;
|
|
6469
|
+
if (Z.current = se, x(se), $.length > 0) {
|
|
6470
|
+
const he = $.find(
|
|
6471
|
+
(pe) => se >= pe.start && se < pe.end
|
|
6472
6472
|
);
|
|
6473
|
-
if (
|
|
6474
|
-
he && he.id !==
|
|
6475
|
-
else if (
|
|
6476
|
-
const pe =
|
|
6477
|
-
(
|
|
6473
|
+
if (le.current)
|
|
6474
|
+
he && he.id !== te.current ? be(he.id) : !he && te.current !== null && be(null);
|
|
6475
|
+
else if (te.current) {
|
|
6476
|
+
const pe = $.find(
|
|
6477
|
+
(xe) => xe.id === te.current
|
|
6478
6478
|
);
|
|
6479
|
-
if (pe &&
|
|
6480
|
-
|
|
6479
|
+
if (pe && se >= pe.end) {
|
|
6480
|
+
X.current?.stop(), m(!1);
|
|
6481
6481
|
return;
|
|
6482
6482
|
}
|
|
6483
6483
|
} else he && be(he.id);
|
|
6484
6484
|
}
|
|
6485
|
-
if (
|
|
6486
|
-
const he =
|
|
6485
|
+
if (ae.current && re.current) {
|
|
6486
|
+
const he = re.current, pe = se * ke / ye.current, xe = he.clientWidth, Le = i.show ? i.width : 0, Je = pe + Le, st = Math.max(0, Je - xe / 2);
|
|
6487
6487
|
he.scrollLeft = st;
|
|
6488
6488
|
}
|
|
6489
|
-
if (
|
|
6490
|
-
|
|
6489
|
+
if (se >= w) {
|
|
6490
|
+
X.current?.stop(), m(!1), be(null);
|
|
6491
6491
|
return;
|
|
6492
6492
|
}
|
|
6493
|
-
|
|
6493
|
+
Q.current = requestAnimationFrame(G);
|
|
6494
6494
|
};
|
|
6495
|
-
|
|
6496
|
-
}, [
|
|
6497
|
-
|
|
6498
|
-
}, []),
|
|
6499
|
-
(
|
|
6500
|
-
if (!
|
|
6501
|
-
const
|
|
6502
|
-
|
|
6495
|
+
Q.current = requestAnimationFrame(G);
|
|
6496
|
+
}, [w, $, be, ke, i]), De = D(() => {
|
|
6497
|
+
Q.current && (cancelAnimationFrame(Q.current), Q.current = null);
|
|
6498
|
+
}, []), ee = D(
|
|
6499
|
+
(G) => {
|
|
6500
|
+
if (!X.current) return;
|
|
6501
|
+
const se = G ?? Z.current;
|
|
6502
|
+
X.current.play(void 0, se), m(!0), Ue();
|
|
6503
6503
|
},
|
|
6504
|
-
[
|
|
6505
|
-
),
|
|
6506
|
-
|
|
6507
|
-
}, [
|
|
6508
|
-
|
|
6509
|
-
}, [
|
|
6510
|
-
(
|
|
6511
|
-
const
|
|
6512
|
-
Z.current =
|
|
6504
|
+
[Ue]
|
|
6505
|
+
), j = D(() => {
|
|
6506
|
+
X.current && (X.current.pause(), m(!1), De(), x(X.current.getCurrentTime()));
|
|
6507
|
+
}, [De]), oe = D(() => {
|
|
6508
|
+
X.current && (X.current.stop(), m(!1), De(), Z.current = 0, x(0), be(null));
|
|
6509
|
+
}, [De, be]), de = D(
|
|
6510
|
+
(G) => {
|
|
6511
|
+
const se = Math.max(0, Math.min(G, w));
|
|
6512
|
+
Z.current = se, x(se), X.current && X.current.seekTo(se);
|
|
6513
6513
|
},
|
|
6514
|
-
[
|
|
6515
|
-
),
|
|
6516
|
-
const
|
|
6517
|
-
|
|
6518
|
-
}, []),
|
|
6514
|
+
[w]
|
|
6515
|
+
), me = D((G) => {
|
|
6516
|
+
const se = Math.max(0.5, Math.min(2, G));
|
|
6517
|
+
B(se), X.current && X.current.setPlaybackRate(se);
|
|
6518
|
+
}, []), J = r ? 30 : 0, Re = nt(
|
|
6519
6519
|
() => ({
|
|
6520
6520
|
isPlaying: y,
|
|
6521
6521
|
currentTime: p,
|
|
6522
6522
|
currentTimeRef: Z
|
|
6523
6523
|
}),
|
|
6524
6524
|
[y, p]
|
|
6525
|
-
),
|
|
6525
|
+
), je = nt(
|
|
6526
6526
|
() => ({
|
|
6527
|
-
continuousPlay:
|
|
6528
|
-
annotations:
|
|
6527
|
+
continuousPlay: E,
|
|
6528
|
+
annotations: $,
|
|
6529
6529
|
activeAnnotationId: M,
|
|
6530
|
-
playbackRate:
|
|
6531
|
-
isAutomaticScroll:
|
|
6530
|
+
playbackRate: k,
|
|
6531
|
+
isAutomaticScroll: P
|
|
6532
6532
|
}),
|
|
6533
|
-
[
|
|
6534
|
-
),
|
|
6533
|
+
[E, $, M, k, P]
|
|
6534
|
+
), F = nt(
|
|
6535
6535
|
() => ({
|
|
6536
|
-
play:
|
|
6537
|
-
pause:
|
|
6538
|
-
stop:
|
|
6539
|
-
seekTo:
|
|
6540
|
-
setPlaybackRate:
|
|
6541
|
-
setContinuousPlay:
|
|
6542
|
-
setAnnotations:
|
|
6536
|
+
play: ee,
|
|
6537
|
+
pause: j,
|
|
6538
|
+
stop: oe,
|
|
6539
|
+
seekTo: de,
|
|
6540
|
+
setPlaybackRate: me,
|
|
6541
|
+
setContinuousPlay: Ke,
|
|
6542
|
+
setAnnotations: A,
|
|
6543
6543
|
setActiveAnnotationId: be,
|
|
6544
|
-
setAutomaticScroll: (
|
|
6545
|
-
|
|
6544
|
+
setAutomaticScroll: (G) => {
|
|
6545
|
+
K(G);
|
|
6546
6546
|
},
|
|
6547
6547
|
setScrollContainer: Oe,
|
|
6548
|
-
scrollContainerRef:
|
|
6548
|
+
scrollContainerRef: re
|
|
6549
6549
|
}),
|
|
6550
|
-
[
|
|
6551
|
-
),
|
|
6550
|
+
[ee, j, oe, de, me, Ke, be, Oe]
|
|
6551
|
+
), ze = nt(
|
|
6552
6552
|
() => ({
|
|
6553
|
-
duration:
|
|
6554
|
-
peaksDataArray:
|
|
6555
|
-
sampleRate:
|
|
6553
|
+
duration: w,
|
|
6554
|
+
peaksDataArray: C,
|
|
6555
|
+
sampleRate: ke,
|
|
6556
6556
|
waveHeight: n,
|
|
6557
|
-
timeScaleHeight:
|
|
6558
|
-
samplesPerPixel:
|
|
6559
|
-
playoutRef:
|
|
6557
|
+
timeScaleHeight: J,
|
|
6558
|
+
samplesPerPixel: z,
|
|
6559
|
+
playoutRef: X,
|
|
6560
6560
|
controls: i,
|
|
6561
6561
|
barWidth: c,
|
|
6562
6562
|
barGap: u,
|
|
6563
6563
|
progressBarWidth: b
|
|
6564
6564
|
}),
|
|
6565
6565
|
[
|
|
6566
|
-
v,
|
|
6567
6566
|
w,
|
|
6568
|
-
|
|
6567
|
+
C,
|
|
6568
|
+
ke,
|
|
6569
6569
|
n,
|
|
6570
|
-
|
|
6571
|
-
|
|
6570
|
+
J,
|
|
6571
|
+
z,
|
|
6572
6572
|
i,
|
|
6573
6573
|
c,
|
|
6574
6574
|
u,
|
|
6575
6575
|
b
|
|
6576
6576
|
]
|
|
6577
6577
|
), fe = { ...zn, ...o };
|
|
6578
|
-
return /* @__PURE__ */ I(Rn, { theme: fe, children: /* @__PURE__ */ I(fr.Provider, { value:
|
|
6578
|
+
return /* @__PURE__ */ I(Rn, { theme: fe, children: /* @__PURE__ */ I(fr.Provider, { value: Re, children: /* @__PURE__ */ I(hr.Provider, { value: je, children: /* @__PURE__ */ I(pr.Provider, { value: F, children: /* @__PURE__ */ I(gr.Provider, { value: ze, children: d }) }) }) }) });
|
|
6579
6579
|
}, qt = () => {
|
|
6580
6580
|
const e = Te(fr);
|
|
6581
6581
|
if (!e)
|
|
@@ -6605,8 +6605,8 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6605
6605
|
);
|
|
6606
6606
|
return e;
|
|
6607
6607
|
}, Fi = ({ className: e }) => {
|
|
6608
|
-
const { isPlaying: t, currentTimeRef: n } =
|
|
6609
|
-
return /* @__PURE__ */ I(
|
|
6608
|
+
const { isPlaying: t, currentTimeRef: n } = Ze(), { selectionStart: r, selectionEnd: a, isLoopEnabled: s } = Ne(), { play: o } = ge();
|
|
6609
|
+
return /* @__PURE__ */ I(Pe, { onClick: async () => {
|
|
6610
6610
|
if (r !== a && a > r)
|
|
6611
6611
|
if (s)
|
|
6612
6612
|
await o(r);
|
|
@@ -6618,27 +6618,27 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6618
6618
|
await o(n.current ?? 0);
|
|
6619
6619
|
}, disabled: t, className: e, children: "Play" });
|
|
6620
6620
|
}, Zi = ({ className: e }) => {
|
|
6621
|
-
const { isPlaying: t } =
|
|
6622
|
-
return /* @__PURE__ */ I(
|
|
6621
|
+
const { isPlaying: t } = Ze(), { pause: n } = ge();
|
|
6622
|
+
return /* @__PURE__ */ I(Pe, { onClick: n, disabled: !t, className: e, children: "Pause" });
|
|
6623
6623
|
}, Vi = ({ className: e }) => {
|
|
6624
|
-
const { isPlaying: t } =
|
|
6625
|
-
return /* @__PURE__ */ I(
|
|
6624
|
+
const { isPlaying: t } = Ze(), { stop: n } = ge();
|
|
6625
|
+
return /* @__PURE__ */ I(Pe, { onClick: n, disabled: !t, className: e, children: "Stop" });
|
|
6626
6626
|
}, Pi = ({ className: e }) => {
|
|
6627
|
-
const { isPlaying: t } =
|
|
6628
|
-
return /* @__PURE__ */ I(
|
|
6627
|
+
const { isPlaying: t } = Ze(), { play: n, setCurrentTime: r } = ge(), { playoutRef: a } = Be();
|
|
6628
|
+
return /* @__PURE__ */ I(Pe, { onClick: () => {
|
|
6629
6629
|
r(0), t && a.current && (a.current.stop(), n(0));
|
|
6630
6630
|
}, className: e, children: "Rewind" });
|
|
6631
6631
|
}, zi = ({ className: e }) => {
|
|
6632
|
-
const { isPlaying: t } =
|
|
6633
|
-
return /* @__PURE__ */ I(
|
|
6632
|
+
const { isPlaying: t } = Ze(), { play: n, setCurrentTime: r } = ge(), { duration: a, playoutRef: s } = Be();
|
|
6633
|
+
return /* @__PURE__ */ I(Pe, { onClick: () => {
|
|
6634
6634
|
r(a), t && s.current && (s.current.stop(), n(a));
|
|
6635
6635
|
}, className: e, children: "Fast Forward" });
|
|
6636
6636
|
}, Hi = ({
|
|
6637
6637
|
skipAmount: e = 5,
|
|
6638
6638
|
className: t
|
|
6639
6639
|
}) => {
|
|
6640
|
-
const { currentTimeRef: n, isPlaying: r } =
|
|
6641
|
-
return /* @__PURE__ */ I(
|
|
6640
|
+
const { currentTimeRef: n, isPlaying: r } = Ze(), { play: a, setCurrentTime: s } = ge(), { playoutRef: o } = Be();
|
|
6641
|
+
return /* @__PURE__ */ I(Pe, { onClick: () => {
|
|
6642
6642
|
const l = Math.max(0, (n.current ?? 0) - e);
|
|
6643
6643
|
s(l), r && o.current && (o.current.stop(), a(l));
|
|
6644
6644
|
}, className: t, children: "Skip Backward" });
|
|
@@ -6646,15 +6646,15 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6646
6646
|
skipAmount: e = 5,
|
|
6647
6647
|
className: t
|
|
6648
6648
|
}) => {
|
|
6649
|
-
const { currentTimeRef: n, isPlaying: r } =
|
|
6650
|
-
return /* @__PURE__ */ I(
|
|
6649
|
+
const { currentTimeRef: n, isPlaying: r } = Ze(), { play: a, setCurrentTime: s } = ge(), { duration: o, playoutRef: i } = Be();
|
|
6650
|
+
return /* @__PURE__ */ I(Pe, { onClick: () => {
|
|
6651
6651
|
const c = Math.min(o, (n.current ?? 0) + e);
|
|
6652
6652
|
s(c), r && i.current && (i.current.stop(), a(c));
|
|
6653
6653
|
}, className: t, children: "Skip Forward" });
|
|
6654
6654
|
}, Gi = ({ className: e }) => {
|
|
6655
|
-
const { isLoopEnabled: t, loopStart: n, loopEnd: r } =
|
|
6655
|
+
const { isLoopEnabled: t, loopStart: n, loopEnd: r } = Ne(), { setLoopEnabled: a, setLoopRegion: s } = ge(), { duration: o } = Be(), i = n !== r && r > n;
|
|
6656
6656
|
return /* @__PURE__ */ I(
|
|
6657
|
-
|
|
6657
|
+
Pe,
|
|
6658
6658
|
{
|
|
6659
6659
|
onClick: () => {
|
|
6660
6660
|
if (!t && !i) {
|
|
@@ -6669,9 +6669,9 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6669
6669
|
}
|
|
6670
6670
|
);
|
|
6671
6671
|
}, Ni = ({ className: e }) => {
|
|
6672
|
-
const { selectionStart: t, selectionEnd: n, loopStart: r, loopEnd: a } =
|
|
6672
|
+
const { selectionStart: t, selectionEnd: n, loopStart: r, loopEnd: a } = Ne(), { setLoopRegionFromSelection: s, clearLoopRegion: o } = ge(), i = t !== n && n > t, l = r !== a && a > r;
|
|
6673
6673
|
return /* @__PURE__ */ I(
|
|
6674
|
-
|
|
6674
|
+
Pe,
|
|
6675
6675
|
{
|
|
6676
6676
|
onClick: () => {
|
|
6677
6677
|
l ? o() : s();
|
|
@@ -6683,13 +6683,13 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6683
6683
|
}
|
|
6684
6684
|
);
|
|
6685
6685
|
}, Li = ({ className: e, disabled: t }) => {
|
|
6686
|
-
const { zoomIn: n } = ge(), { canZoomIn: r } =
|
|
6687
|
-
return /* @__PURE__ */ I(
|
|
6686
|
+
const { zoomIn: n } = ge(), { canZoomIn: r } = Be();
|
|
6687
|
+
return /* @__PURE__ */ I(Pe, { variant: "success", onClick: n, disabled: t || !r, className: e, children: "Zoom In" });
|
|
6688
6688
|
}, Yi = ({ className: e, disabled: t }) => {
|
|
6689
|
-
const { zoomOut: n } = ge(), { canZoomOut: r } =
|
|
6690
|
-
return /* @__PURE__ */ I(
|
|
6689
|
+
const { zoomOut: n } = ge(), { canZoomOut: r } = Be();
|
|
6690
|
+
return /* @__PURE__ */ I(Pe, { variant: "success", onClick: n, disabled: t || !r, className: e, children: "Zoom Out" });
|
|
6691
6691
|
}, Oi = ({ className: e }) => {
|
|
6692
|
-
const { masterVolume: t } =
|
|
6692
|
+
const { masterVolume: t } = Be(), { setMasterVolume: n } = ge();
|
|
6693
6693
|
return /* @__PURE__ */ I(
|
|
6694
6694
|
Ya,
|
|
6695
6695
|
{
|
|
@@ -6699,7 +6699,7 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6699
6699
|
}
|
|
6700
6700
|
);
|
|
6701
6701
|
}, Ki = ({ className: e }) => {
|
|
6702
|
-
const { timeFormat: t } =
|
|
6702
|
+
const { timeFormat: t } = Be(), { setTimeFormat: n } = ge();
|
|
6703
6703
|
return /* @__PURE__ */ I(
|
|
6704
6704
|
wo,
|
|
6705
6705
|
{
|
|
@@ -6715,13 +6715,13 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6715
6715
|
color: ${(e) => e.theme?.textColor || "#333"};
|
|
6716
6716
|
user-select: none;
|
|
6717
6717
|
`, Ui = ({ className: e }) => {
|
|
6718
|
-
const t =
|
|
6719
|
-
return
|
|
6718
|
+
const t = T(null), n = T(null), { isPlaying: r, currentTimeRef: a, playbackStartTimeRef: s, audioStartPositionRef: o } = Ze(), { timeFormat: i } = Be(), l = i;
|
|
6719
|
+
return U(() => {
|
|
6720
6720
|
const c = () => {
|
|
6721
6721
|
if (t.current) {
|
|
6722
6722
|
let u;
|
|
6723
6723
|
if (r) {
|
|
6724
|
-
const g =
|
|
6724
|
+
const g = Ae().currentTime - (s.current ?? 0);
|
|
6725
6725
|
u = (o.current ?? 0) + g;
|
|
6726
6726
|
} else
|
|
6727
6727
|
u = a.current ?? 0;
|
|
@@ -6732,11 +6732,11 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6732
6732
|
return r ? n.current = requestAnimationFrame(c) : c(), () => {
|
|
6733
6733
|
n.current && (cancelAnimationFrame(n.current), n.current = null);
|
|
6734
6734
|
};
|
|
6735
|
-
}, [r, l, a, s, o]),
|
|
6735
|
+
}, [r, l, a, s, o]), U(() => {
|
|
6736
6736
|
!r && t.current && (t.current.textContent = dt(a.current ?? 0, l));
|
|
6737
6737
|
}), /* @__PURE__ */ I(js, { ref: t, className: e, "aria-label": "Audio position", children: dt(a.current ?? 0, l) });
|
|
6738
6738
|
}, ji = ({ className: e }) => {
|
|
6739
|
-
const { selectionStart: t, selectionEnd: n } =
|
|
6739
|
+
const { selectionStart: t, selectionEnd: n } = Ne(), { setSelection: r } = ge();
|
|
6740
6740
|
return /* @__PURE__ */ I(
|
|
6741
6741
|
ro,
|
|
6742
6742
|
{
|
|
@@ -6747,7 +6747,7 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6747
6747
|
}
|
|
6748
6748
|
);
|
|
6749
6749
|
}, Ji = ({ className: e }) => {
|
|
6750
|
-
const { isAutomaticScroll: t } =
|
|
6750
|
+
const { isAutomaticScroll: t } = Ne(), { setAutomaticScroll: n } = ge();
|
|
6751
6751
|
return /* @__PURE__ */ I(
|
|
6752
6752
|
$a,
|
|
6753
6753
|
{
|
|
@@ -6757,7 +6757,7 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6757
6757
|
}
|
|
6758
6758
|
);
|
|
6759
6759
|
}, Qi = ({ className: e }) => {
|
|
6760
|
-
const { continuousPlay: t } =
|
|
6760
|
+
const { continuousPlay: t } = Ne(), { setContinuousPlay: n } = ge();
|
|
6761
6761
|
return /* @__PURE__ */ I(
|
|
6762
6762
|
ms,
|
|
6763
6763
|
{
|
|
@@ -6767,7 +6767,7 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6767
6767
|
}
|
|
6768
6768
|
);
|
|
6769
6769
|
}, qi = ({ className: e }) => {
|
|
6770
|
-
const { linkEndpoints: t } =
|
|
6770
|
+
const { linkEndpoints: t } = Ne(), { setLinkEndpoints: n } = ge();
|
|
6771
6771
|
return /* @__PURE__ */ I(
|
|
6772
6772
|
fs,
|
|
6773
6773
|
{
|
|
@@ -6777,7 +6777,7 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6777
6777
|
}
|
|
6778
6778
|
);
|
|
6779
6779
|
}, el = ({ className: e }) => {
|
|
6780
|
-
const { annotationsEditable: t } =
|
|
6780
|
+
const { annotationsEditable: t } = Ne(), { setAnnotationsEditable: n } = ge();
|
|
6781
6781
|
return /* @__PURE__ */ I(
|
|
6782
6782
|
hs,
|
|
6783
6783
|
{
|
|
@@ -6790,7 +6790,7 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6790
6790
|
filename: e,
|
|
6791
6791
|
className: t
|
|
6792
6792
|
}) => {
|
|
6793
|
-
const { annotations: n } =
|
|
6793
|
+
const { annotations: n } = Ne();
|
|
6794
6794
|
return /* @__PURE__ */ I(
|
|
6795
6795
|
gs,
|
|
6796
6796
|
{
|
|
@@ -6812,7 +6812,7 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6812
6812
|
onExportComplete: c,
|
|
6813
6813
|
onExportError: u
|
|
6814
6814
|
}) => {
|
|
6815
|
-
const { tracks: g, trackStates: h } =
|
|
6815
|
+
const { tracks: g, trackStates: h } = Be(), { exportWav: d, isExporting: b, progress: y } = Xs(), m = async () => {
|
|
6816
6816
|
try {
|
|
6817
6817
|
const x = await d(g, h, {
|
|
6818
6818
|
filename: t,
|
|
@@ -6830,7 +6830,7 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6830
6830
|
}
|
|
6831
6831
|
}, p = b ? `Exporting ${Math.round(y * 100)}%` : e;
|
|
6832
6832
|
return /* @__PURE__ */ I(
|
|
6833
|
-
|
|
6833
|
+
Pe,
|
|
6834
6834
|
{
|
|
6835
6835
|
onClick: m,
|
|
6836
6836
|
disabled: b || g.length === 0,
|
|
@@ -6852,13 +6852,13 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6852
6852
|
color: e = "#ff0000",
|
|
6853
6853
|
controlsOffset: t = 0
|
|
6854
6854
|
}) => {
|
|
6855
|
-
const n =
|
|
6856
|
-
return
|
|
6855
|
+
const n = T(null), r = T(null), { isPlaying: a, currentTimeRef: s, playbackStartTimeRef: o, audioStartPositionRef: i } = Ze(), { samplesPerPixel: l, sampleRate: c, progressBarWidth: u } = Be();
|
|
6856
|
+
return U(() => {
|
|
6857
6857
|
const g = () => {
|
|
6858
6858
|
if (n.current) {
|
|
6859
6859
|
let h;
|
|
6860
6860
|
if (a) {
|
|
6861
|
-
const b =
|
|
6861
|
+
const b = Ae().currentTime - (o.current ?? 0);
|
|
6862
6862
|
h = (i.current ?? 0) + b;
|
|
6863
6863
|
} else
|
|
6864
6864
|
h = s.current ?? 0;
|
|
@@ -6870,7 +6870,7 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6870
6870
|
return a ? r.current = requestAnimationFrame(g) : g(), () => {
|
|
6871
6871
|
r.current && (cancelAnimationFrame(r.current), r.current = null);
|
|
6872
6872
|
};
|
|
6873
|
-
}, [a, c, l, t, s, o, i]),
|
|
6873
|
+
}, [a, c, l, t, s, o, i]), U(() => {
|
|
6874
6874
|
if (!a && n.current) {
|
|
6875
6875
|
const h = (s.current ?? 0) * c / l + t;
|
|
6876
6876
|
n.current.style.transform = `translate3d(${h}px, 0, 0)`;
|
|
@@ -6907,44 +6907,44 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6907
6907
|
clipDurationSamples: t,
|
|
6908
6908
|
...n
|
|
6909
6909
|
}) => {
|
|
6910
|
-
const r =
|
|
6911
|
-
|
|
6910
|
+
const r = T(null), a = T(null), s = wt(), { waveHeight: o } = vt(), { isPlaying: i, currentTimeRef: l, playbackStartTimeRef: c, audioStartPositionRef: u } = Ze(), { samplesPerPixel: g, sampleRate: h } = Be(), d = s?.waveProgressColor || "rgba(0, 0, 0, 0.1)";
|
|
6911
|
+
U(() => {
|
|
6912
6912
|
const p = () => {
|
|
6913
6913
|
if (r.current) {
|
|
6914
6914
|
let x;
|
|
6915
6915
|
if (i) {
|
|
6916
|
-
const
|
|
6917
|
-
x = (u.current ?? 0) +
|
|
6916
|
+
const v = Ae().currentTime - (c.current ?? 0);
|
|
6917
|
+
x = (u.current ?? 0) + v;
|
|
6918
6918
|
} else
|
|
6919
6919
|
x = l.current ?? 0;
|
|
6920
|
-
const
|
|
6921
|
-
let
|
|
6922
|
-
if (
|
|
6923
|
-
|
|
6924
|
-
else if (
|
|
6925
|
-
|
|
6920
|
+
const w = x * h, f = e + t;
|
|
6921
|
+
let C = 0;
|
|
6922
|
+
if (w <= e)
|
|
6923
|
+
C = 0;
|
|
6924
|
+
else if (w >= f)
|
|
6925
|
+
C = n.length;
|
|
6926
6926
|
else {
|
|
6927
|
-
const
|
|
6928
|
-
|
|
6927
|
+
const v = w - e;
|
|
6928
|
+
C = Math.floor(v / g);
|
|
6929
6929
|
}
|
|
6930
|
-
r.current.style.width = `${
|
|
6930
|
+
r.current.style.width = `${C}px`;
|
|
6931
6931
|
}
|
|
6932
6932
|
i && (a.current = requestAnimationFrame(p));
|
|
6933
6933
|
};
|
|
6934
6934
|
return i ? a.current = requestAnimationFrame(p) : p(), () => {
|
|
6935
6935
|
a.current && (cancelAnimationFrame(a.current), a.current = null);
|
|
6936
6936
|
};
|
|
6937
|
-
}, [i, h, g, e, t, n.length, l, c, u]),
|
|
6937
|
+
}, [i, h, g, e, t, n.length, l, c, u]), U(() => {
|
|
6938
6938
|
if (!i && r.current) {
|
|
6939
|
-
const x = (l.current ?? 0) * h,
|
|
6939
|
+
const x = (l.current ?? 0) * h, w = e + t;
|
|
6940
6940
|
let f = 0;
|
|
6941
6941
|
if (x <= e)
|
|
6942
6942
|
f = 0;
|
|
6943
|
-
else if (x >=
|
|
6943
|
+
else if (x >= w)
|
|
6944
6944
|
f = n.length;
|
|
6945
6945
|
else {
|
|
6946
|
-
const
|
|
6947
|
-
f = Math.floor(
|
|
6946
|
+
const C = x - e;
|
|
6947
|
+
f = Math.floor(C / g);
|
|
6948
6948
|
}
|
|
6949
6949
|
r.current.style.width = `${f}px`;
|
|
6950
6950
|
}
|
|
@@ -6953,7 +6953,7 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6953
6953
|
let y;
|
|
6954
6954
|
b === "inverted" ? y = n.isSelected && s ? s.selectedWaveFillColor : s?.waveFillColor || "white" : y = n.isSelected && s ? s.selectedWaveOutlineColor : s?.waveOutlineColor || "grey";
|
|
6955
6955
|
const m = at(y);
|
|
6956
|
-
return /* @__PURE__ */
|
|
6956
|
+
return /* @__PURE__ */ ne(qs, { children: [
|
|
6957
6957
|
/* @__PURE__ */ I(
|
|
6958
6958
|
ei,
|
|
6959
6959
|
{
|
|
@@ -6992,98 +6992,98 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
6992
6992
|
touchOptimized: b = !1,
|
|
6993
6993
|
recordingState: y
|
|
6994
6994
|
}) => {
|
|
6995
|
-
const m = wt(), { isPlaying: p, currentTimeRef: x, playbackStartTimeRef:
|
|
6996
|
-
selectionStart:
|
|
6997
|
-
selectionEnd:
|
|
6998
|
-
annotations:
|
|
6999
|
-
activeAnnotationId:
|
|
7000
|
-
annotationsEditable:
|
|
7001
|
-
linkEndpoints:
|
|
6995
|
+
const m = wt(), { isPlaying: p, currentTimeRef: x, playbackStartTimeRef: w, audioStartPositionRef: f } = Ze(), {
|
|
6996
|
+
selectionStart: C,
|
|
6997
|
+
selectionEnd: v,
|
|
6998
|
+
annotations: k,
|
|
6999
|
+
activeAnnotationId: B,
|
|
7000
|
+
annotationsEditable: $,
|
|
7001
|
+
linkEndpoints: A,
|
|
7002
7002
|
continuousPlay: M,
|
|
7003
7003
|
selectedTrackId: _,
|
|
7004
|
-
loopStart:
|
|
7005
|
-
loopEnd:
|
|
7006
|
-
isLoopEnabled:
|
|
7007
|
-
} =
|
|
7008
|
-
setAnnotations:
|
|
7009
|
-
setActiveAnnotationId:
|
|
7010
|
-
setTrackMute:
|
|
7004
|
+
loopStart: E,
|
|
7005
|
+
loopEnd: V,
|
|
7006
|
+
isLoopEnabled: z
|
|
7007
|
+
} = Ne(), {
|
|
7008
|
+
setAnnotations: P,
|
|
7009
|
+
setActiveAnnotationId: K,
|
|
7010
|
+
setTrackMute: X,
|
|
7011
7011
|
setTrackSolo: Z,
|
|
7012
|
-
setTrackVolume:
|
|
7013
|
-
setTrackPan:
|
|
7014
|
-
setSelection:
|
|
7015
|
-
play:
|
|
7016
|
-
setScrollContainer:
|
|
7012
|
+
setTrackVolume: Q,
|
|
7013
|
+
setTrackPan: le,
|
|
7014
|
+
setSelection: te,
|
|
7015
|
+
play: re,
|
|
7016
|
+
setScrollContainer: ae,
|
|
7017
7017
|
setSelectedTrackId: ye,
|
|
7018
7018
|
setCurrentTime: be,
|
|
7019
|
-
setLoopRegion:
|
|
7019
|
+
setLoopRegion: Ke
|
|
7020
7020
|
} = ge(), {
|
|
7021
7021
|
audioBuffers: Oe,
|
|
7022
|
-
peaksDataArray:
|
|
7023
|
-
trackStates:
|
|
7024
|
-
tracks:
|
|
7025
|
-
duration:
|
|
7026
|
-
samplesPerPixel:
|
|
7027
|
-
sampleRate:
|
|
7028
|
-
waveHeight:
|
|
7029
|
-
timeScaleHeight:
|
|
7030
|
-
controls:
|
|
7031
|
-
playoutRef:
|
|
7032
|
-
barWidth:
|
|
7033
|
-
barGap:
|
|
7034
|
-
isReady:
|
|
7035
|
-
} =
|
|
7036
|
-
|
|
7037
|
-
}, [
|
|
7038
|
-
let pe = Oe.length > 0 ?
|
|
7022
|
+
peaksDataArray: ke,
|
|
7023
|
+
trackStates: Ue,
|
|
7024
|
+
tracks: De,
|
|
7025
|
+
duration: ee,
|
|
7026
|
+
samplesPerPixel: j,
|
|
7027
|
+
sampleRate: oe,
|
|
7028
|
+
waveHeight: de,
|
|
7029
|
+
timeScaleHeight: me,
|
|
7030
|
+
controls: J,
|
|
7031
|
+
playoutRef: Re,
|
|
7032
|
+
barWidth: je,
|
|
7033
|
+
barGap: F,
|
|
7034
|
+
isReady: ze
|
|
7035
|
+
} = Be(), [fe, G] = R(!1), se = T(null), he = D((L) => {
|
|
7036
|
+
se.current = L, ae(L);
|
|
7037
|
+
}, [ae]);
|
|
7038
|
+
let pe = Oe.length > 0 ? ee : ri;
|
|
7039
7039
|
if (y?.isRecording) {
|
|
7040
|
-
const
|
|
7041
|
-
pe = Math.max(pe,
|
|
7040
|
+
const q = (y.startSample + y.durationSamples) / oe;
|
|
7041
|
+
pe = Math.max(pe, q + 10);
|
|
7042
7042
|
}
|
|
7043
|
-
const
|
|
7044
|
-
console.log("Annotation clicked:", L.id),
|
|
7045
|
-
const
|
|
7046
|
-
await
|
|
7043
|
+
const xe = Math.floor(pe * oe / j), Le = async (L) => {
|
|
7044
|
+
console.log("Annotation clicked:", L.id), K(L.id);
|
|
7045
|
+
const q = M ? void 0 : L.end - L.start;
|
|
7046
|
+
await re(L.start, q);
|
|
7047
7047
|
}, Je = D((L) => {
|
|
7048
|
-
if (L >= 0 && L <
|
|
7049
|
-
const
|
|
7050
|
-
ye(
|
|
7048
|
+
if (L >= 0 && L < De.length) {
|
|
7049
|
+
const q = De[L];
|
|
7050
|
+
ye(q.id);
|
|
7051
7051
|
}
|
|
7052
|
-
}, [
|
|
7053
|
-
const
|
|
7054
|
-
let
|
|
7055
|
-
for (let Qe = 0; Qe <
|
|
7056
|
-
const qe =
|
|
7057
|
-
if (ce >=
|
|
7058
|
-
|
|
7052
|
+
}, [De, ye]), st = (L) => {
|
|
7053
|
+
const q = L.currentTarget.getBoundingClientRect(), ie = J.show ? J.width : 0, Se = (L.clientX - q.left - ie) * j / oe, ce = L.clientY - q.top;
|
|
7054
|
+
let Ee = 0, $e = -1;
|
|
7055
|
+
for (let Qe = 0; Qe < ke.length; Qe++) {
|
|
7056
|
+
const qe = ke[Qe], Ye = (qe.length > 0 ? Math.max(...qe.map((Zt) => Zt.peaks.data.length)) : 1) * de + (g ? 22 : 0);
|
|
7057
|
+
if (ce >= Ee && ce < Ee + Ye) {
|
|
7058
|
+
$e = Qe;
|
|
7059
7059
|
break;
|
|
7060
7060
|
}
|
|
7061
|
-
|
|
7061
|
+
Ee += Ye;
|
|
7062
7062
|
}
|
|
7063
|
-
|
|
7063
|
+
$e !== -1 && Je($e), G(!0), be(Se), te(Se, Se);
|
|
7064
7064
|
}, et = (L) => {
|
|
7065
7065
|
if (!fe) return;
|
|
7066
|
-
const
|
|
7067
|
-
|
|
7066
|
+
const q = L.currentTarget.getBoundingClientRect(), ie = J.show ? J.width : 0, Se = (L.clientX - q.left - ie) * j / oe, He = Math.min(C, Se), ce = Math.max(C, Se);
|
|
7067
|
+
te(He, ce);
|
|
7068
7068
|
}, mt = (L) => {
|
|
7069
7069
|
if (!fe) return;
|
|
7070
|
-
|
|
7071
|
-
const
|
|
7072
|
-
Math.abs(ce -
|
|
7070
|
+
G(!1);
|
|
7071
|
+
const q = L.currentTarget.getBoundingClientRect(), ie = J.show ? J.width : 0, Se = (L.clientX - q.left - ie) * j / oe, He = Math.min(C, Se), ce = Math.max(C, Se);
|
|
7072
|
+
Math.abs(ce - He) < 0.1 ? (be(He), p && Re.current ? (Re.current.stop(), re(He)) : Re.current && Re.current.stop()) : te(He, ce);
|
|
7073
7073
|
};
|
|
7074
|
-
return
|
|
7074
|
+
return De.some((L) => L.clips.length > 0) && (Oe.length === 0 || ke.length === 0) ? /* @__PURE__ */ I("div", { className: u, children: "Loading waveform..." }) : /* @__PURE__ */ I(On, { children: /* @__PURE__ */ ne(
|
|
7075
7075
|
Et.Provider,
|
|
7076
7076
|
{
|
|
7077
7077
|
value: {
|
|
7078
|
-
samplesPerPixel:
|
|
7079
|
-
sampleRate:
|
|
7080
|
-
zoomLevels: [
|
|
7081
|
-
waveHeight:
|
|
7082
|
-
timeScaleHeight:
|
|
7078
|
+
samplesPerPixel: j,
|
|
7079
|
+
sampleRate: oe,
|
|
7080
|
+
zoomLevels: [j],
|
|
7081
|
+
waveHeight: de,
|
|
7082
|
+
timeScaleHeight: me,
|
|
7083
7083
|
duration: pe,
|
|
7084
|
-
controls:
|
|
7085
|
-
barWidth:
|
|
7086
|
-
barGap:
|
|
7084
|
+
controls: J,
|
|
7085
|
+
barWidth: je,
|
|
7086
|
+
barGap: F
|
|
7087
7087
|
},
|
|
7088
7088
|
children: [
|
|
7089
7089
|
/* @__PURE__ */ I(
|
|
@@ -7092,17 +7092,17 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
7092
7092
|
theme: m,
|
|
7093
7093
|
backgroundColor: at(m.waveOutlineColor),
|
|
7094
7094
|
timescaleBackgroundColor: m.timescaleBackgroundColor,
|
|
7095
|
-
scrollContainerWidth:
|
|
7096
|
-
timescaleWidth:
|
|
7097
|
-
tracksWidth:
|
|
7098
|
-
controlsWidth:
|
|
7095
|
+
scrollContainerWidth: xe + (J.show ? J.width : 0),
|
|
7096
|
+
timescaleWidth: xe,
|
|
7097
|
+
tracksWidth: xe,
|
|
7098
|
+
controlsWidth: J.show ? J.width : 0,
|
|
7099
7099
|
onTracksMouseDown: st,
|
|
7100
7100
|
onTracksMouseMove: et,
|
|
7101
7101
|
onTracksMouseUp: mt,
|
|
7102
7102
|
scrollContainerRef: he,
|
|
7103
7103
|
isSelecting: fe,
|
|
7104
|
-
"data-playlist-state":
|
|
7105
|
-
timescale:
|
|
7104
|
+
"data-playlist-state": ze ? "ready" : "loading",
|
|
7105
|
+
timescale: me > 0 ? /* @__PURE__ */ ne(rt, { children: [
|
|
7106
7106
|
/* @__PURE__ */ I(
|
|
7107
7107
|
jn,
|
|
7108
7108
|
{
|
|
@@ -7113,41 +7113,41 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
7113
7113
|
renderTimestamp: t
|
|
7114
7114
|
}
|
|
7115
7115
|
),
|
|
7116
|
-
|
|
7116
|
+
z && /* @__PURE__ */ I(
|
|
7117
7117
|
no,
|
|
7118
7118
|
{
|
|
7119
|
-
startPosition: Math.min(
|
|
7120
|
-
endPosition: Math.max(
|
|
7119
|
+
startPosition: Math.min(E, V) * oe / j,
|
|
7120
|
+
endPosition: Math.max(E, V) * oe / j,
|
|
7121
7121
|
markerColor: m.loopMarkerColor,
|
|
7122
7122
|
regionColor: m.loopRegionColor,
|
|
7123
7123
|
minPosition: 0,
|
|
7124
|
-
maxPosition:
|
|
7125
|
-
controlsOffset:
|
|
7126
|
-
onLoopRegionChange: (L,
|
|
7127
|
-
const
|
|
7128
|
-
|
|
7124
|
+
maxPosition: xe,
|
|
7125
|
+
controlsOffset: J.show ? J.width : 0,
|
|
7126
|
+
onLoopRegionChange: (L, q) => {
|
|
7127
|
+
const ie = L * j / oe, ve = q * j / oe;
|
|
7128
|
+
Ke(ie, ve);
|
|
7129
7129
|
}
|
|
7130
7130
|
}
|
|
7131
7131
|
)
|
|
7132
7132
|
] }) : void 0,
|
|
7133
|
-
children: /* @__PURE__ */
|
|
7134
|
-
|
|
7135
|
-
const
|
|
7136
|
-
if (!
|
|
7137
|
-
const ve =
|
|
7138
|
-
name: `Track ${
|
|
7133
|
+
children: /* @__PURE__ */ ne(rt, { children: [
|
|
7134
|
+
ke.map((L, q) => {
|
|
7135
|
+
const ie = De[q];
|
|
7136
|
+
if (!ie) return null;
|
|
7137
|
+
const ve = Ue[q] || {
|
|
7138
|
+
name: `Track ${q + 1}`,
|
|
7139
7139
|
muted: !1,
|
|
7140
7140
|
soloed: !1,
|
|
7141
7141
|
volume: 1,
|
|
7142
7142
|
pan: 0
|
|
7143
|
-
},
|
|
7144
|
-
/* @__PURE__ */ I(ko, { style: { justifyContent: "center" }, children: ve.name || `Track ${
|
|
7145
|
-
/* @__PURE__ */
|
|
7143
|
+
}, Se = e ? e(q) : /* @__PURE__ */ ne(Ao, { onClick: () => Je(q), children: [
|
|
7144
|
+
/* @__PURE__ */ I(ko, { style: { justifyContent: "center" }, children: ve.name || `Track ${q + 1}` }),
|
|
7145
|
+
/* @__PURE__ */ ne(Io, { children: [
|
|
7146
7146
|
/* @__PURE__ */ I(
|
|
7147
7147
|
gn,
|
|
7148
7148
|
{
|
|
7149
7149
|
$variant: ve.muted ? "danger" : "outline",
|
|
7150
|
-
onClick: () =>
|
|
7150
|
+
onClick: () => X(q, !ve.muted),
|
|
7151
7151
|
children: "Mute"
|
|
7152
7152
|
}
|
|
7153
7153
|
),
|
|
@@ -7155,12 +7155,12 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
7155
7155
|
gn,
|
|
7156
7156
|
{
|
|
7157
7157
|
$variant: ve.soloed ? "info" : "outline",
|
|
7158
|
-
onClick: () => Z(
|
|
7158
|
+
onClick: () => Z(q, !ve.soloed),
|
|
7159
7159
|
children: "Solo"
|
|
7160
7160
|
}
|
|
7161
7161
|
)
|
|
7162
7162
|
] }),
|
|
7163
|
-
/* @__PURE__ */
|
|
7163
|
+
/* @__PURE__ */ ne(vn, { children: [
|
|
7164
7164
|
/* @__PURE__ */ I(So, {}),
|
|
7165
7165
|
/* @__PURE__ */ I(
|
|
7166
7166
|
bn,
|
|
@@ -7169,12 +7169,12 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
7169
7169
|
max: "1",
|
|
7170
7170
|
step: "0.01",
|
|
7171
7171
|
value: ve.volume,
|
|
7172
|
-
onChange: (ce) =>
|
|
7172
|
+
onChange: (ce) => Q(q, parseFloat(ce.target.value))
|
|
7173
7173
|
}
|
|
7174
7174
|
),
|
|
7175
7175
|
/* @__PURE__ */ I($o, {})
|
|
7176
7176
|
] }),
|
|
7177
|
-
/* @__PURE__ */
|
|
7177
|
+
/* @__PURE__ */ ne(vn, { children: [
|
|
7178
7178
|
/* @__PURE__ */ I("span", { children: "L" }),
|
|
7179
7179
|
/* @__PURE__ */ I(
|
|
7180
7180
|
bn,
|
|
@@ -7183,78 +7183,78 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
7183
7183
|
max: "1",
|
|
7184
7184
|
step: "0.01",
|
|
7185
7185
|
value: ve.pan,
|
|
7186
|
-
onChange: (ce) =>
|
|
7186
|
+
onChange: (ce) => le(q, parseFloat(ce.target.value))
|
|
7187
7187
|
}
|
|
7188
7188
|
),
|
|
7189
7189
|
/* @__PURE__ */ I("span", { children: "R" })
|
|
7190
7190
|
] })
|
|
7191
|
-
] }),
|
|
7192
|
-
return /* @__PURE__ */ I(Qt.Provider, { value:
|
|
7191
|
+
] }), He = L.length > 0 ? Math.max(...L.map((ce) => ce.peaks.data.length)) : 1;
|
|
7192
|
+
return /* @__PURE__ */ I(Qt.Provider, { value: Se, children: /* @__PURE__ */ ne(
|
|
7193
7193
|
Jn,
|
|
7194
7194
|
{
|
|
7195
|
-
numChannels:
|
|
7195
|
+
numChannels: He,
|
|
7196
7196
|
backgroundColor: at(m.waveOutlineColor),
|
|
7197
7197
|
offset: 0,
|
|
7198
|
-
width:
|
|
7198
|
+
width: xe,
|
|
7199
7199
|
hasClipHeaders: g,
|
|
7200
|
-
trackId:
|
|
7201
|
-
isSelected:
|
|
7200
|
+
trackId: ie.id,
|
|
7201
|
+
isSelected: ie.id === _,
|
|
7202
7202
|
children: [
|
|
7203
|
-
L.map((ce,
|
|
7204
|
-
const
|
|
7203
|
+
L.map((ce, Ee) => {
|
|
7204
|
+
const $e = ce.peaks, Qe = $e.length;
|
|
7205
7205
|
return /* @__PURE__ */ I(
|
|
7206
7206
|
Lt,
|
|
7207
7207
|
{
|
|
7208
7208
|
clipId: ce.clipId,
|
|
7209
|
-
trackIndex:
|
|
7210
|
-
clipIndex:
|
|
7209
|
+
trackIndex: q,
|
|
7210
|
+
clipIndex: Ee,
|
|
7211
7211
|
trackName: ce.trackName,
|
|
7212
7212
|
startSample: ce.startSample,
|
|
7213
7213
|
durationSamples: ce.durationSamples,
|
|
7214
|
-
samplesPerPixel:
|
|
7214
|
+
samplesPerPixel: j,
|
|
7215
7215
|
showHeader: g,
|
|
7216
7216
|
disableHeaderDrag: !h,
|
|
7217
|
-
isSelected:
|
|
7218
|
-
trackId:
|
|
7217
|
+
isSelected: ie.id === _,
|
|
7218
|
+
trackId: ie.id,
|
|
7219
7219
|
fadeIn: ce.fadeIn,
|
|
7220
7220
|
fadeOut: ce.fadeOut,
|
|
7221
|
-
sampleRate:
|
|
7221
|
+
sampleRate: oe,
|
|
7222
7222
|
showFades: d,
|
|
7223
7223
|
touchOptimized: b,
|
|
7224
7224
|
onMouseDown: (qe) => {
|
|
7225
|
-
qe.target.closest('[role="button"][aria-roledescription="draggable"]') || Je(
|
|
7225
|
+
qe.target.closest('[role="button"][aria-roledescription="draggable"]') || Je(q);
|
|
7226
7226
|
},
|
|
7227
|
-
children:
|
|
7227
|
+
children: $e.data.map((qe, it) => /* @__PURE__ */ I(
|
|
7228
7228
|
Sn,
|
|
7229
7229
|
{
|
|
7230
7230
|
index: it,
|
|
7231
7231
|
data: qe,
|
|
7232
|
-
bits:
|
|
7232
|
+
bits: $e.bits,
|
|
7233
7233
|
length: Qe,
|
|
7234
|
-
isSelected:
|
|
7234
|
+
isSelected: ie.id === _,
|
|
7235
7235
|
clipStartSample: ce.startSample,
|
|
7236
7236
|
clipDurationSamples: ce.durationSamples
|
|
7237
7237
|
},
|
|
7238
|
-
`${
|
|
7238
|
+
`${q}-${Ee}-${it}`
|
|
7239
7239
|
))
|
|
7240
7240
|
},
|
|
7241
|
-
`${
|
|
7241
|
+
`${q}-${Ee}`
|
|
7242
7242
|
);
|
|
7243
7243
|
}),
|
|
7244
|
-
y?.isRecording && y.trackId ===
|
|
7244
|
+
y?.isRecording && y.trackId === ie.id && y.peaks.length > 0 && /* @__PURE__ */ I(
|
|
7245
7245
|
Lt,
|
|
7246
7246
|
{
|
|
7247
7247
|
clipId: "recording-preview",
|
|
7248
|
-
trackIndex:
|
|
7248
|
+
trackIndex: q,
|
|
7249
7249
|
clipIndex: L.length,
|
|
7250
7250
|
trackName: "Recording...",
|
|
7251
7251
|
startSample: y.startSample,
|
|
7252
7252
|
durationSamples: y.durationSamples,
|
|
7253
|
-
samplesPerPixel:
|
|
7253
|
+
samplesPerPixel: j,
|
|
7254
7254
|
showHeader: g,
|
|
7255
7255
|
disableHeaderDrag: !0,
|
|
7256
|
-
isSelected:
|
|
7257
|
-
trackId:
|
|
7256
|
+
isSelected: ie.id === _,
|
|
7257
|
+
trackId: ie.id,
|
|
7258
7258
|
children: /* @__PURE__ */ I(
|
|
7259
7259
|
Sn,
|
|
7260
7260
|
{
|
|
@@ -7262,84 +7262,84 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
7262
7262
|
data: y.peaks,
|
|
7263
7263
|
bits: 16,
|
|
7264
7264
|
length: Math.floor(y.peaks.length / 2),
|
|
7265
|
-
isSelected:
|
|
7265
|
+
isSelected: ie.id === _,
|
|
7266
7266
|
clipStartSample: y.startSample,
|
|
7267
7267
|
clipDurationSamples: y.durationSamples
|
|
7268
7268
|
},
|
|
7269
|
-
`${
|
|
7269
|
+
`${q}-recording-0`
|
|
7270
7270
|
)
|
|
7271
7271
|
},
|
|
7272
|
-
`${
|
|
7272
|
+
`${q}-recording`
|
|
7273
7273
|
)
|
|
7274
7274
|
]
|
|
7275
7275
|
}
|
|
7276
|
-
) },
|
|
7276
|
+
) }, ie.id);
|
|
7277
7277
|
}),
|
|
7278
|
-
|
|
7279
|
-
const
|
|
7278
|
+
k.length > 0 && /* @__PURE__ */ I(ar, { height: 30, width: xe, children: k.map((L, q) => {
|
|
7279
|
+
const ie = L.start * oe / j, ve = L.end * oe / j, Se = i ? i(L, q) : L.id;
|
|
7280
7280
|
return /* @__PURE__ */ I(
|
|
7281
7281
|
rr,
|
|
7282
7282
|
{
|
|
7283
7283
|
annotationId: L.id,
|
|
7284
|
-
annotationIndex:
|
|
7285
|
-
startPosition:
|
|
7284
|
+
annotationIndex: q,
|
|
7285
|
+
startPosition: ie,
|
|
7286
7286
|
endPosition: ve,
|
|
7287
|
-
label:
|
|
7287
|
+
label: Se,
|
|
7288
7288
|
color: "#ff9800",
|
|
7289
|
-
isActive: L.id ===
|
|
7289
|
+
isActive: L.id === B,
|
|
7290
7290
|
onClick: () => Le(L),
|
|
7291
|
-
editable:
|
|
7291
|
+
editable: $
|
|
7292
7292
|
},
|
|
7293
7293
|
L.id
|
|
7294
7294
|
);
|
|
7295
7295
|
}) }),
|
|
7296
|
-
|
|
7296
|
+
C !== v && /* @__PURE__ */ I(
|
|
7297
7297
|
Nn,
|
|
7298
7298
|
{
|
|
7299
|
-
startPosition: Math.min(
|
|
7300
|
-
endPosition: Math.max(
|
|
7299
|
+
startPosition: Math.min(C, v) * oe / j + (J.show ? J.width : 0),
|
|
7300
|
+
endPosition: Math.max(C, v) * oe / j + (J.show ? J.width : 0),
|
|
7301
7301
|
color: m.selectionColor
|
|
7302
7302
|
}
|
|
7303
7303
|
),
|
|
7304
|
-
(p ||
|
|
7304
|
+
(p || C === v) && (n ? (
|
|
7305
7305
|
// Custom playhead - pass all animation refs for smooth 60fps animation
|
|
7306
7306
|
n({
|
|
7307
|
-
position: (x.current ?? 0) *
|
|
7307
|
+
position: (x.current ?? 0) * oe / j + (J.show ? J.width : 0),
|
|
7308
7308
|
color: m.playheadColor,
|
|
7309
7309
|
isPlaying: p,
|
|
7310
7310
|
currentTimeRef: x,
|
|
7311
|
-
playbackStartTimeRef:
|
|
7311
|
+
playbackStartTimeRef: w,
|
|
7312
7312
|
audioStartPositionRef: f,
|
|
7313
|
-
samplesPerPixel:
|
|
7314
|
-
sampleRate:
|
|
7315
|
-
controlsOffset:
|
|
7316
|
-
getAudioContextTime: () =>
|
|
7313
|
+
samplesPerPixel: j,
|
|
7314
|
+
sampleRate: oe,
|
|
7315
|
+
controlsOffset: J.show ? J.width : 0,
|
|
7316
|
+
getAudioContextTime: () => Ae().currentTime
|
|
7317
7317
|
})
|
|
7318
7318
|
) : /* @__PURE__ */ I(
|
|
7319
7319
|
Qs,
|
|
7320
7320
|
{
|
|
7321
7321
|
color: m.playheadColor,
|
|
7322
|
-
controlsOffset:
|
|
7322
|
+
controlsOffset: J.show ? J.width : 0
|
|
7323
7323
|
}
|
|
7324
7324
|
))
|
|
7325
7325
|
] })
|
|
7326
7326
|
}
|
|
7327
7327
|
),
|
|
7328
|
-
|
|
7328
|
+
k.length > 0 && /* @__PURE__ */ I(
|
|
7329
7329
|
or,
|
|
7330
7330
|
{
|
|
7331
|
-
annotations:
|
|
7332
|
-
activeAnnotationId:
|
|
7331
|
+
annotations: k,
|
|
7332
|
+
activeAnnotationId: B ?? void 0,
|
|
7333
7333
|
shouldScrollToActive: !0,
|
|
7334
7334
|
scrollActivePosition: l,
|
|
7335
7335
|
scrollActiveContainer: c,
|
|
7336
|
-
editable:
|
|
7337
|
-
controls:
|
|
7338
|
-
annotationListConfig: { linkEndpoints:
|
|
7336
|
+
editable: $,
|
|
7337
|
+
controls: $ ? r : void 0,
|
|
7338
|
+
annotationListConfig: { linkEndpoints: A, continuousPlay: M },
|
|
7339
7339
|
height: s,
|
|
7340
7340
|
renderAnnotationItem: o,
|
|
7341
7341
|
onAnnotationUpdate: (L) => {
|
|
7342
|
-
|
|
7342
|
+
P(L);
|
|
7343
7343
|
}
|
|
7344
7344
|
}
|
|
7345
7345
|
)
|
|
@@ -7360,8 +7360,8 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
7360
7360
|
color: e = "#ff0000",
|
|
7361
7361
|
controlsOffset: t = 0
|
|
7362
7362
|
}) => {
|
|
7363
|
-
const n =
|
|
7364
|
-
return
|
|
7363
|
+
const n = T(null), r = T(null), { isPlaying: a, currentTimeRef: s } = qt(), { samplesPerPixel: o, sampleRate: i, progressBarWidth: l } = en();
|
|
7364
|
+
return U(() => {
|
|
7365
7365
|
const c = () => {
|
|
7366
7366
|
if (n.current) {
|
|
7367
7367
|
const g = (s.current ?? 0) * i / o + t;
|
|
@@ -7372,7 +7372,7 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
7372
7372
|
return a ? r.current = requestAnimationFrame(c) : c(), () => {
|
|
7373
7373
|
r.current && (cancelAnimationFrame(r.current), r.current = null);
|
|
7374
7374
|
};
|
|
7375
|
-
}, [a, i, o, t, s]),
|
|
7375
|
+
}, [a, i, o, t, s]), U(() => {
|
|
7376
7376
|
if (!a && n.current) {
|
|
7377
7377
|
const u = (s.current ?? 0) * i / o + t;
|
|
7378
7378
|
n.current.style.transform = `translate3d(${u}px, 0, 0)`;
|
|
@@ -7408,28 +7408,28 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
7408
7408
|
clipDurationSamples: t,
|
|
7409
7409
|
...n
|
|
7410
7410
|
}) => {
|
|
7411
|
-
const r =
|
|
7412
|
-
|
|
7411
|
+
const r = T(null), a = T(null), s = wt(), { waveHeight: o } = vt(), { isPlaying: i, currentTimeRef: l } = qt(), { samplesPerPixel: c, sampleRate: u } = en(), g = s?.waveProgressColor || "rgba(0, 0, 0, 0.1)";
|
|
7412
|
+
U(() => {
|
|
7413
7413
|
const y = () => {
|
|
7414
7414
|
if (r.current) {
|
|
7415
7415
|
const p = (l.current ?? 0) * u, x = e + t;
|
|
7416
|
-
let
|
|
7416
|
+
let w = 0;
|
|
7417
7417
|
if (p <= e)
|
|
7418
|
-
|
|
7418
|
+
w = 0;
|
|
7419
7419
|
else if (p >= x)
|
|
7420
|
-
|
|
7420
|
+
w = n.length;
|
|
7421
7421
|
else {
|
|
7422
7422
|
const f = p - e;
|
|
7423
|
-
|
|
7423
|
+
w = Math.floor(f / c);
|
|
7424
7424
|
}
|
|
7425
|
-
r.current.style.width = `${
|
|
7425
|
+
r.current.style.width = `${w}px`;
|
|
7426
7426
|
}
|
|
7427
7427
|
i && (a.current = requestAnimationFrame(y));
|
|
7428
7428
|
};
|
|
7429
7429
|
return i ? a.current = requestAnimationFrame(y) : y(), () => {
|
|
7430
7430
|
a.current && (cancelAnimationFrame(a.current), a.current = null);
|
|
7431
7431
|
};
|
|
7432
|
-
}, [i, u, c, e, t, n.length, l]),
|
|
7432
|
+
}, [i, u, c, e, t, n.length, l]), U(() => {
|
|
7433
7433
|
if (!i && r.current) {
|
|
7434
7434
|
const m = (l.current ?? 0) * u, p = e + t;
|
|
7435
7435
|
let x = 0;
|
|
@@ -7438,8 +7438,8 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
7438
7438
|
else if (m >= p)
|
|
7439
7439
|
x = n.length;
|
|
7440
7440
|
else {
|
|
7441
|
-
const
|
|
7442
|
-
x = Math.floor(
|
|
7441
|
+
const w = m - e;
|
|
7442
|
+
x = Math.floor(w / c);
|
|
7443
7443
|
}
|
|
7444
7444
|
r.current.style.width = `${x}px`;
|
|
7445
7445
|
}
|
|
@@ -7448,7 +7448,7 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
7448
7448
|
let d;
|
|
7449
7449
|
h === "inverted" ? d = s?.selectedWaveFillColor || s?.waveFillColor || "white" : d = s?.selectedWaveOutlineColor || s?.waveOutlineColor || "grey";
|
|
7450
7450
|
const b = at(d);
|
|
7451
|
-
return /* @__PURE__ */
|
|
7451
|
+
return /* @__PURE__ */ ne(si, { children: [
|
|
7452
7452
|
/* @__PURE__ */ I(
|
|
7453
7453
|
ii,
|
|
7454
7454
|
{
|
|
@@ -7474,195 +7474,196 @@ const fr = Be(null), hr = Be(null), pr = Be(null), gr = Be(null), _i = ({
|
|
|
7474
7474
|
getAnnotationBoxLabel: t,
|
|
7475
7475
|
renderAnnotationItem: n,
|
|
7476
7476
|
editable: r = !1,
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7477
|
+
linkEndpoints: a = !1,
|
|
7478
|
+
onAnnotationUpdate: s,
|
|
7479
|
+
scrollActivePosition: o = "center",
|
|
7480
|
+
scrollActiveContainer: i = "nearest",
|
|
7481
|
+
className: l
|
|
7481
7482
|
}) => {
|
|
7482
|
-
const
|
|
7483
|
-
duration:
|
|
7484
|
-
peaksDataArray:
|
|
7485
|
-
sampleRate:
|
|
7486
|
-
waveHeight:
|
|
7487
|
-
timeScaleHeight:
|
|
7483
|
+
const c = wt(), { isPlaying: u, currentTimeRef: g } = qt(), { annotations: h, activeAnnotationId: d, continuousPlay: b } = Ks(), { play: y, seekTo: m, setActiveAnnotationId: p, setAnnotations: x, setScrollContainer: w } = Us(), {
|
|
7484
|
+
duration: f,
|
|
7485
|
+
peaksDataArray: C,
|
|
7486
|
+
sampleRate: v,
|
|
7487
|
+
waveHeight: k,
|
|
7488
|
+
timeScaleHeight: B,
|
|
7488
7489
|
samplesPerPixel: $,
|
|
7489
|
-
controls:
|
|
7490
|
-
playoutRef:
|
|
7491
|
-
barWidth:
|
|
7492
|
-
barGap:
|
|
7493
|
-
} = en(), [
|
|
7494
|
-
|
|
7495
|
-
}, [
|
|
7496
|
-
|
|
7497
|
-
}, [
|
|
7498
|
-
|
|
7499
|
-
}, [
|
|
7500
|
-
annotations:
|
|
7501
|
-
onAnnotationsChange:
|
|
7490
|
+
controls: A,
|
|
7491
|
+
playoutRef: M,
|
|
7492
|
+
barWidth: _,
|
|
7493
|
+
barGap: E
|
|
7494
|
+
} = en(), [V, z] = R(0), [P, K] = R(0), [X, Z] = R(!1), Q = T(null), le = D((ee) => {
|
|
7495
|
+
Q.current = ee, w(ee);
|
|
7496
|
+
}, [w]), te = Math.floor(f * v / $), re = D(async (ee) => {
|
|
7497
|
+
p(ee.id), y(ee.start);
|
|
7498
|
+
}, [p, y]), ae = D((ee) => {
|
|
7499
|
+
x(ee), s?.(ee);
|
|
7500
|
+
}, [x, s]), { onDragStart: ye, onDragMove: be, onDragEnd: Ke } = Is({
|
|
7501
|
+
annotations: h,
|
|
7502
|
+
onAnnotationsChange: ae,
|
|
7502
7503
|
samplesPerPixel: $,
|
|
7503
|
-
sampleRate:
|
|
7504
|
-
duration:
|
|
7505
|
-
linkEndpoints:
|
|
7506
|
-
}),
|
|
7507
|
-
const
|
|
7508
|
-
|
|
7509
|
-
}, [
|
|
7510
|
-
if (!
|
|
7511
|
-
const
|
|
7512
|
-
|
|
7513
|
-
}, [
|
|
7514
|
-
if (!
|
|
7515
|
-
|
|
7516
|
-
const
|
|
7517
|
-
Math.abs(
|
|
7518
|
-
}, [
|
|
7519
|
-
if (
|
|
7520
|
-
return /* @__PURE__ */ I("div", { className:
|
|
7521
|
-
const
|
|
7522
|
-
return /* @__PURE__ */ I(On, { children: /* @__PURE__ */
|
|
7504
|
+
sampleRate: v,
|
|
7505
|
+
duration: f,
|
|
7506
|
+
linkEndpoints: a
|
|
7507
|
+
}), Oe = D((ee) => {
|
|
7508
|
+
const j = ee.currentTarget.getBoundingClientRect(), oe = A.show ? A.width : 0, me = (ee.clientX - j.left - oe) * $ / v;
|
|
7509
|
+
Z(!0), z(me), K(me);
|
|
7510
|
+
}, [A, $, v]), ke = D((ee) => {
|
|
7511
|
+
if (!X) return;
|
|
7512
|
+
const j = ee.currentTarget.getBoundingClientRect(), oe = A.show ? A.width : 0, me = (ee.clientX - j.left - oe) * $ / v;
|
|
7513
|
+
K(me);
|
|
7514
|
+
}, [X, A, $, v]), Ue = D((ee) => {
|
|
7515
|
+
if (!X) return;
|
|
7516
|
+
Z(!1);
|
|
7517
|
+
const j = ee.currentTarget.getBoundingClientRect(), oe = A.show ? A.width : 0, me = (ee.clientX - j.left - oe) * $ / v, J = Math.min(V, me), Re = Math.max(V, me);
|
|
7518
|
+
Math.abs(Re - J) < 0.1 ? (m(J), z(J), K(J), u && M.current && (M.current.stop(), y(J))) : (z(J), K(Re));
|
|
7519
|
+
}, [X, V, $, v, A, m, u, M, y]);
|
|
7520
|
+
if (C.length === 0)
|
|
7521
|
+
return /* @__PURE__ */ I("div", { className: l, children: "Loading waveform..." });
|
|
7522
|
+
const De = null;
|
|
7523
|
+
return /* @__PURE__ */ I(On, { children: /* @__PURE__ */ ne(
|
|
7523
7524
|
Et.Provider,
|
|
7524
7525
|
{
|
|
7525
7526
|
value: {
|
|
7526
7527
|
samplesPerPixel: $,
|
|
7527
|
-
sampleRate:
|
|
7528
|
+
sampleRate: v,
|
|
7528
7529
|
zoomLevels: [$],
|
|
7529
|
-
waveHeight:
|
|
7530
|
-
timeScaleHeight:
|
|
7531
|
-
duration:
|
|
7532
|
-
controls:
|
|
7533
|
-
barWidth:
|
|
7534
|
-
barGap:
|
|
7530
|
+
waveHeight: k,
|
|
7531
|
+
timeScaleHeight: B,
|
|
7532
|
+
duration: f,
|
|
7533
|
+
controls: A,
|
|
7534
|
+
barWidth: _,
|
|
7535
|
+
barGap: E
|
|
7535
7536
|
},
|
|
7536
7537
|
children: [
|
|
7537
7538
|
/* @__PURE__ */ I(
|
|
7538
7539
|
Jt,
|
|
7539
7540
|
{
|
|
7540
|
-
theme:
|
|
7541
|
-
backgroundColor: at(
|
|
7542
|
-
timescaleBackgroundColor:
|
|
7543
|
-
scrollContainerWidth:
|
|
7544
|
-
timescaleWidth:
|
|
7545
|
-
tracksWidth:
|
|
7546
|
-
controlsWidth:
|
|
7547
|
-
onTracksMouseDown:
|
|
7548
|
-
onTracksMouseMove:
|
|
7549
|
-
onTracksMouseUp:
|
|
7550
|
-
scrollContainerRef:
|
|
7551
|
-
isSelecting:
|
|
7552
|
-
timescale:
|
|
7541
|
+
theme: c,
|
|
7542
|
+
backgroundColor: at(c.waveOutlineColor),
|
|
7543
|
+
timescaleBackgroundColor: c.timescaleBackgroundColor,
|
|
7544
|
+
scrollContainerWidth: te + (A.show ? A.width : 0),
|
|
7545
|
+
timescaleWidth: te,
|
|
7546
|
+
tracksWidth: te,
|
|
7547
|
+
controlsWidth: A.show ? A.width : 0,
|
|
7548
|
+
onTracksMouseDown: Oe,
|
|
7549
|
+
onTracksMouseMove: ke,
|
|
7550
|
+
onTracksMouseUp: Ue,
|
|
7551
|
+
scrollContainerRef: le,
|
|
7552
|
+
isSelecting: X,
|
|
7553
|
+
timescale: B > 0 ? /* @__PURE__ */ I(
|
|
7553
7554
|
jn,
|
|
7554
7555
|
{
|
|
7555
|
-
duration:
|
|
7556
|
+
duration: f * 1e3,
|
|
7556
7557
|
marker: 1e4,
|
|
7557
7558
|
bigStep: 5e3,
|
|
7558
7559
|
secondStep: 1e3
|
|
7559
7560
|
}
|
|
7560
7561
|
) : void 0,
|
|
7561
|
-
children: /* @__PURE__ */
|
|
7562
|
-
|
|
7563
|
-
const
|
|
7564
|
-
return /* @__PURE__ */ I(Qt.Provider, { value:
|
|
7562
|
+
children: /* @__PURE__ */ ne(rt, { children: [
|
|
7563
|
+
C.map((ee, j) => {
|
|
7564
|
+
const oe = ee.length > 0 ? Math.max(...ee.map((de) => de.peaks.data.length)) : 1;
|
|
7565
|
+
return /* @__PURE__ */ I(Qt.Provider, { value: De, children: /* @__PURE__ */ I(
|
|
7565
7566
|
Jn,
|
|
7566
7567
|
{
|
|
7567
|
-
numChannels:
|
|
7568
|
-
backgroundColor: at(
|
|
7568
|
+
numChannels: oe,
|
|
7569
|
+
backgroundColor: at(c.waveOutlineColor),
|
|
7569
7570
|
offset: 0,
|
|
7570
|
-
width:
|
|
7571
|
+
width: te,
|
|
7571
7572
|
hasClipHeaders: !1,
|
|
7572
|
-
trackId: `media-element-track-${
|
|
7573
|
+
trackId: `media-element-track-${j}`,
|
|
7573
7574
|
isSelected: !0,
|
|
7574
|
-
children:
|
|
7575
|
-
const
|
|
7575
|
+
children: ee.map((de, me) => {
|
|
7576
|
+
const J = de.peaks, Re = J.length;
|
|
7576
7577
|
return /* @__PURE__ */ I(
|
|
7577
7578
|
Lt,
|
|
7578
7579
|
{
|
|
7579
|
-
clipId:
|
|
7580
|
-
trackIndex:
|
|
7580
|
+
clipId: de.clipId,
|
|
7581
|
+
trackIndex: j,
|
|
7581
7582
|
clipIndex: me,
|
|
7582
|
-
trackName:
|
|
7583
|
-
startSample:
|
|
7584
|
-
durationSamples:
|
|
7583
|
+
trackName: de.trackName,
|
|
7584
|
+
startSample: de.startSample,
|
|
7585
|
+
durationSamples: de.durationSamples,
|
|
7585
7586
|
samplesPerPixel: $,
|
|
7586
7587
|
showHeader: !1,
|
|
7587
7588
|
disableHeaderDrag: !0,
|
|
7588
7589
|
isSelected: !0,
|
|
7589
|
-
trackId: `media-element-track-${
|
|
7590
|
-
children:
|
|
7590
|
+
trackId: `media-element-track-${j}`,
|
|
7591
|
+
children: J.data.map((je, F) => /* @__PURE__ */ I(
|
|
7591
7592
|
ui,
|
|
7592
7593
|
{
|
|
7593
|
-
index:
|
|
7594
|
-
data:
|
|
7595
|
-
bits:
|
|
7596
|
-
length:
|
|
7597
|
-
clipStartSample:
|
|
7598
|
-
clipDurationSamples:
|
|
7594
|
+
index: F,
|
|
7595
|
+
data: je,
|
|
7596
|
+
bits: J.bits,
|
|
7597
|
+
length: Re,
|
|
7598
|
+
clipStartSample: de.startSample,
|
|
7599
|
+
clipDurationSamples: de.durationSamples
|
|
7599
7600
|
},
|
|
7600
|
-
`${
|
|
7601
|
+
`${j}-${me}-${F}`
|
|
7601
7602
|
))
|
|
7602
7603
|
},
|
|
7603
|
-
`${
|
|
7604
|
+
`${j}-${me}`
|
|
7604
7605
|
);
|
|
7605
7606
|
})
|
|
7606
7607
|
}
|
|
7607
|
-
) },
|
|
7608
|
+
) }, j);
|
|
7608
7609
|
}),
|
|
7609
|
-
|
|
7610
|
+
h.length > 0 && /* @__PURE__ */ I(
|
|
7610
7611
|
pa,
|
|
7611
7612
|
{
|
|
7612
|
-
onDragStart:
|
|
7613
|
-
onDragMove:
|
|
7614
|
-
onDragEnd:
|
|
7613
|
+
onDragStart: ye,
|
|
7614
|
+
onDragMove: be,
|
|
7615
|
+
onDragEnd: Ke,
|
|
7615
7616
|
modifiers: r ? [ga] : [],
|
|
7616
|
-
children: /* @__PURE__ */ I(ar, { height: 30, width:
|
|
7617
|
-
const
|
|
7617
|
+
children: /* @__PURE__ */ I(ar, { height: 30, width: te, children: h.map((ee, j) => {
|
|
7618
|
+
const oe = ee.start * v / $, de = ee.end * v / $, me = t ? t(ee, j) : ee.id;
|
|
7618
7619
|
return /* @__PURE__ */ I(
|
|
7619
7620
|
rr,
|
|
7620
7621
|
{
|
|
7621
|
-
annotationId:
|
|
7622
|
-
annotationIndex:
|
|
7623
|
-
startPosition:
|
|
7624
|
-
endPosition:
|
|
7622
|
+
annotationId: ee.id,
|
|
7623
|
+
annotationIndex: j,
|
|
7624
|
+
startPosition: oe,
|
|
7625
|
+
endPosition: de,
|
|
7625
7626
|
label: me,
|
|
7626
7627
|
color: "#ff9800",
|
|
7627
|
-
isActive:
|
|
7628
|
-
onClick: () =>
|
|
7628
|
+
isActive: ee.id === d,
|
|
7629
|
+
onClick: () => re(ee),
|
|
7629
7630
|
editable: r
|
|
7630
7631
|
},
|
|
7631
|
-
|
|
7632
|
+
ee.id
|
|
7632
7633
|
);
|
|
7633
7634
|
}) })
|
|
7634
7635
|
}
|
|
7635
7636
|
),
|
|
7636
|
-
|
|
7637
|
+
V !== P && /* @__PURE__ */ I(
|
|
7637
7638
|
Nn,
|
|
7638
7639
|
{
|
|
7639
|
-
startPosition: Math.min(
|
|
7640
|
-
endPosition: Math.max(
|
|
7641
|
-
color:
|
|
7640
|
+
startPosition: Math.min(V, P) * v / $ + (A.show ? A.width : 0),
|
|
7641
|
+
endPosition: Math.max(V, P) * v / $ + (A.show ? A.width : 0),
|
|
7642
|
+
color: c.selectionColor
|
|
7642
7643
|
}
|
|
7643
7644
|
),
|
|
7644
7645
|
/* @__PURE__ */ I(
|
|
7645
7646
|
oi,
|
|
7646
7647
|
{
|
|
7647
|
-
color:
|
|
7648
|
-
controlsOffset:
|
|
7648
|
+
color: c.playheadColor,
|
|
7649
|
+
controlsOffset: A.show ? A.width : 0
|
|
7649
7650
|
}
|
|
7650
7651
|
)
|
|
7651
7652
|
] })
|
|
7652
7653
|
}
|
|
7653
7654
|
),
|
|
7654
|
-
|
|
7655
|
+
h.length > 0 && /* @__PURE__ */ I(
|
|
7655
7656
|
or,
|
|
7656
7657
|
{
|
|
7657
|
-
annotations:
|
|
7658
|
-
activeAnnotationId:
|
|
7658
|
+
annotations: h,
|
|
7659
|
+
activeAnnotationId: d ?? void 0,
|
|
7659
7660
|
shouldScrollToActive: !0,
|
|
7660
|
-
scrollActivePosition:
|
|
7661
|
-
scrollActiveContainer:
|
|
7661
|
+
scrollActivePosition: o,
|
|
7662
|
+
scrollActiveContainer: i,
|
|
7662
7663
|
editable: r,
|
|
7663
|
-
annotationListConfig: { linkEndpoints:
|
|
7664
|
+
annotationListConfig: { linkEndpoints: a, continuousPlay: b },
|
|
7664
7665
|
height: e,
|
|
7665
|
-
onAnnotationUpdate:
|
|
7666
|
+
onAnnotationUpdate: ae,
|
|
7666
7667
|
renderAnnotationItem: n
|
|
7667
7668
|
}
|
|
7668
7669
|
)
|
|
@@ -7723,11 +7724,11 @@ export {
|
|
|
7723
7724
|
Us as useMediaElementControls,
|
|
7724
7725
|
en as useMediaElementData,
|
|
7725
7726
|
Ks as useMediaElementState,
|
|
7726
|
-
|
|
7727
|
+
Ze as usePlaybackAnimation,
|
|
7727
7728
|
ki as usePlaybackShortcuts,
|
|
7728
7729
|
ge as usePlaylistControls,
|
|
7729
|
-
|
|
7730
|
-
|
|
7730
|
+
Be as usePlaylistData,
|
|
7731
|
+
Ne as usePlaylistState,
|
|
7731
7732
|
bs as useTimeFormat,
|
|
7732
7733
|
Ri as useTrackDynamicEffects,
|
|
7733
7734
|
Wi as useWaveformPlaylist,
|