@waveform-playlist/browser 5.2.0-next.4 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +10 -4
- package/dist/index.js +21 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +617 -589
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as zr from "tone";
|
|
2
|
-
import { Volume as Sn, getDestination as $n, start as Mn, now as kt, getTransport as lt, getContext as Ae, Context as Hr, setContext as Xr, Panner as Gr, Gain as on, Player as sn, Analyser as
|
|
2
|
+
import { Volume as Sn, getDestination as $n, start as Mn, now as kt, getTransport as lt, getContext as Ae, Context as Hr, setContext as Xr, Panner as Gr, Gain as on, Player as sn, Analyser as Dn, Meter as Nr, connect as Lr, StereoWidener as Yr, Gate as Or, Limiter as Kr, Compressor as Ur, Chebyshev as jr, BitCrusher as Jr, Distortion as Qr, EQ3 as qr, AutoWah as ea, AutoFilter as ta, AutoPanner as na, Vibrato as ra, Tremolo as aa, Phaser as oa, Chorus as sa, PingPongDelay as ia, FeedbackDelay as la, JCReverb as ca, Freeverb as ua, Reverb as da } from "tone";
|
|
3
3
|
import { jsx as x, jsxs as re, Fragment as Le } from "react/jsx-runtime";
|
|
4
4
|
import * as Y from "react";
|
|
5
|
-
import We, { createContext as ke, useContext as
|
|
6
|
-
import k, { withTheme as
|
|
7
|
-
import { useDraggable as gt, useSensor as
|
|
5
|
+
import We, { createContext as ke, useContext as Be, useState as _, useEffect as Q, Fragment as ma, useRef as E, useCallback as D, useLayoutEffect as fa, useMemo as Ne } from "react";
|
|
6
|
+
import k, { withTheme as Bn, ThemeContext as ha, useTheme as pa, ThemeProvider as Tn } from "styled-components";
|
|
7
|
+
import { useDraggable as gt, useSensor as Vt, MouseSensor as ga, TouchSensor as ba, PointerSensor as va, useSensors as wa, DndContext as ya } from "@dnd-kit/core";
|
|
8
8
|
import { restrictToHorizontalAxis as Ca } from "@dnd-kit/modifiers";
|
|
9
9
|
function ln(e, t) {
|
|
10
10
|
const n = new Float32Array(e), r = e - 1;
|
|
@@ -36,7 +36,7 @@ function Aa(e, t, n = 10) {
|
|
|
36
36
|
}
|
|
37
37
|
return r;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function En(e, t, n) {
|
|
40
40
|
switch (e) {
|
|
41
41
|
case "linear":
|
|
42
42
|
return ln(t, n);
|
|
@@ -57,7 +57,7 @@ function cn(e, t, n, r = "linear", a = 0, s = 1) {
|
|
|
57
57
|
else if (r === "exponential")
|
|
58
58
|
e.setValueAtTime(Math.max(a, 1e-3), t), e.exponentialRampToValueAtTime(Math.max(s, 1e-3), t + n);
|
|
59
59
|
else {
|
|
60
|
-
const o =
|
|
60
|
+
const o = En(r, 1e4, !0), i = new Float32Array(o.length), l = s - a;
|
|
61
61
|
for (let c = 0; c < o.length; c++)
|
|
62
62
|
i[c] = a + o[c] * l;
|
|
63
63
|
e.setValueCurveAtTime(i, t, n);
|
|
@@ -70,7 +70,7 @@ function un(e, t, n, r = "linear", a = 1, s = 0) {
|
|
|
70
70
|
else if (r === "exponential")
|
|
71
71
|
e.setValueAtTime(Math.max(a, 1e-3), t), e.exponentialRampToValueAtTime(Math.max(s, 1e-3), t + n);
|
|
72
72
|
else {
|
|
73
|
-
const o =
|
|
73
|
+
const o = En(r, 1e4, !1), i = new Float32Array(o.length), l = a - s;
|
|
74
74
|
for (let c = 0; c < o.length; c++)
|
|
75
75
|
i[c] = s + o[c] * l;
|
|
76
76
|
e.setValueCurveAtTime(i, t, n);
|
|
@@ -376,11 +376,11 @@ var ka = class {
|
|
|
376
376
|
function $a() {
|
|
377
377
|
return xt || (xt = new Hr(), Xr(xt)), xt;
|
|
378
378
|
}
|
|
379
|
-
async function
|
|
379
|
+
async function Pt() {
|
|
380
380
|
const e = $a();
|
|
381
381
|
e.state !== "running" && await e.resume();
|
|
382
382
|
}
|
|
383
|
-
const
|
|
383
|
+
const Xt = /* @__PURE__ */ Object.freeze({
|
|
384
384
|
Translate: {
|
|
385
385
|
toString(e) {
|
|
386
386
|
if (!e)
|
|
@@ -406,7 +406,7 @@ const Ht = /* @__PURE__ */ Object.freeze({
|
|
|
406
406
|
Transform: {
|
|
407
407
|
toString(e) {
|
|
408
408
|
if (e)
|
|
409
|
-
return [
|
|
409
|
+
return [Xt.Translate.toString(e), Xt.Scale.toString(e)].join(" ");
|
|
410
410
|
}
|
|
411
411
|
},
|
|
412
412
|
Transition: {
|
|
@@ -444,7 +444,7 @@ const Ht = /* @__PURE__ */ Object.freeze({
|
|
|
444
444
|
"thin",
|
|
445
445
|
/* @__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.78Zm47-111.61a36,36,0,0,1,0,47.59,4,4,0,1,1-6-5.3,28,28,0,0,0,0-37,4,4,0,0,1,6-5.28ZM244,128a75.88,75.88,0,0,1-19.35,50.67,4,4,0,0,1-6-5.34,68,68,0,0,0,0-90.66,4,4,0,0,1,6-5.34A75.88,75.88,0,0,1,244,128Z" }))
|
|
446
446
|
]
|
|
447
|
-
]),
|
|
447
|
+
]), Da = /* @__PURE__ */ new Map([
|
|
448
448
|
[
|
|
449
449
|
"bold",
|
|
450
450
|
/* @__PURE__ */ Y.createElement(Y.Fragment, null, /* @__PURE__ */ Y.createElement("path", { d: "M157.27,21.22a12,12,0,0,0-12.64,1.31L75.88,76H32A20,20,0,0,0,12,96v64a20,20,0,0,0,20,20H75.88l68.75,53.47A12,12,0,0,0,164,224V32A12,12,0,0,0,157.27,21.22ZM36,100H68v56H36Zm104,99.46L92,162.13V93.87l48-37.33ZM212,128a44,44,0,0,1-11,29.11,12,12,0,0,1-18-15.88,20,20,0,0,0,0-26.44,12,12,0,0,1,18-15.85A43.94,43.94,0,0,1,212,128Z" }))
|
|
@@ -469,12 +469,12 @@ const Ht = /* @__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
|
-
]),
|
|
472
|
+
]), Ba = ke({
|
|
473
473
|
color: "currentColor",
|
|
474
474
|
size: "1em",
|
|
475
475
|
weight: "regular",
|
|
476
476
|
mirrored: !1
|
|
477
|
-
}),
|
|
477
|
+
}), Yt = Y.forwardRef(
|
|
478
478
|
(e, t) => {
|
|
479
479
|
const {
|
|
480
480
|
alt: n,
|
|
@@ -491,7 +491,7 @@ const Ht = /* @__PURE__ */ Object.freeze({
|
|
|
491
491
|
weight: p = "regular",
|
|
492
492
|
mirrored: d = !1,
|
|
493
493
|
...b
|
|
494
|
-
} = Y.useContext(
|
|
494
|
+
} = Y.useContext(Ba);
|
|
495
495
|
return /* @__PURE__ */ Y.createElement(
|
|
496
496
|
"svg",
|
|
497
497
|
{
|
|
@@ -511,10 +511,10 @@ const Ht = /* @__PURE__ */ Object.freeze({
|
|
|
511
511
|
);
|
|
512
512
|
}
|
|
513
513
|
);
|
|
514
|
-
|
|
515
|
-
const
|
|
516
|
-
|
|
517
|
-
const Wn = Y.forwardRef((e, t) => /* @__PURE__ */ Y.createElement(
|
|
514
|
+
Yt.displayName = "IconBase";
|
|
515
|
+
const Rn = Y.forwardRef((e, t) => /* @__PURE__ */ Y.createElement(Yt, { ref: t, ...e, weights: Ma }));
|
|
516
|
+
Rn.displayName = "SpeakerHighIcon";
|
|
517
|
+
const Wn = Y.forwardRef((e, t) => /* @__PURE__ */ Y.createElement(Yt, { ref: t, ...e, weights: Da }));
|
|
518
518
|
Wn.displayName = "SpeakerLowIcon";
|
|
519
519
|
k.span`
|
|
520
520
|
font-family: 'Courier New', Monaco, monospace;
|
|
@@ -523,7 +523,7 @@ k.span`
|
|
|
523
523
|
color: ${(e) => e.theme?.textColor || "#333"};
|
|
524
524
|
user-select: none;
|
|
525
525
|
`;
|
|
526
|
-
var
|
|
526
|
+
var Ot = k.button`
|
|
527
527
|
display: inline-flex;
|
|
528
528
|
align-items: center;
|
|
529
529
|
justify-content: center;
|
|
@@ -553,26 +553,26 @@ var Yt = k.button`
|
|
|
553
553
|
cursor: not-allowed;
|
|
554
554
|
}
|
|
555
555
|
`;
|
|
556
|
-
k(
|
|
556
|
+
k(Ot)`
|
|
557
557
|
padding: 0.25rem 0.5rem;
|
|
558
558
|
font-size: ${(e) => e.theme.fontSizeSmall};
|
|
559
559
|
`;
|
|
560
|
-
k(
|
|
560
|
+
k(Ot)`
|
|
561
561
|
padding: 0.5rem;
|
|
562
562
|
min-width: 2.25rem;
|
|
563
563
|
min-height: 2.25rem;
|
|
564
564
|
`;
|
|
565
|
-
k(
|
|
565
|
+
k(Ot)`
|
|
566
566
|
padding: 0.25rem;
|
|
567
567
|
min-width: 1.75rem;
|
|
568
568
|
min-height: 1.75rem;
|
|
569
569
|
font-size: ${(e) => e.theme.fontSizeSmall};
|
|
570
570
|
`;
|
|
571
|
-
var
|
|
571
|
+
var Dt = k.div`
|
|
572
572
|
display: inline-flex;
|
|
573
573
|
align-items: center;
|
|
574
574
|
gap: 0.5rem;
|
|
575
|
-
`,
|
|
575
|
+
`, Bt = k.input`
|
|
576
576
|
cursor: pointer;
|
|
577
577
|
accent-color: ${(e) => e.theme.inputFocusBorder};
|
|
578
578
|
|
|
@@ -668,7 +668,7 @@ var Ta = k.span`
|
|
|
668
668
|
clip: rect(0, 0, 0, 0);
|
|
669
669
|
white-space: nowrap;
|
|
670
670
|
border: 0;
|
|
671
|
-
`,
|
|
671
|
+
`, Kt = k.select`
|
|
672
672
|
padding: 0.5rem 2rem 0.5rem 0.75rem;
|
|
673
673
|
font-family: ${(e) => e.theme.fontFamily};
|
|
674
674
|
font-size: ${(e) => e.theme.fontSize};
|
|
@@ -700,7 +700,7 @@ var Ta = k.span`
|
|
|
700
700
|
background-color: ${(e) => e.theme.inputBackground};
|
|
701
701
|
}
|
|
702
702
|
`;
|
|
703
|
-
k(
|
|
703
|
+
k(Kt)`
|
|
704
704
|
padding: 0.25rem 1.75rem 0.25rem 0.5rem;
|
|
705
705
|
font-size: ${(e) => e.theme.fontSizeSmall};
|
|
706
706
|
`;
|
|
@@ -780,14 +780,14 @@ var Zn = k.input.attrs({ type: "range" })`
|
|
|
780
780
|
&:disabled::-moz-range-thumb {
|
|
781
781
|
cursor: not-allowed;
|
|
782
782
|
}
|
|
783
|
-
`,
|
|
783
|
+
`, Ea = ({
|
|
784
784
|
checked: e,
|
|
785
785
|
onChange: t,
|
|
786
786
|
disabled: n = !1,
|
|
787
787
|
className: r
|
|
788
|
-
}) => /* @__PURE__ */ re(
|
|
788
|
+
}) => /* @__PURE__ */ re(Dt, { className: r, children: [
|
|
789
789
|
/* @__PURE__ */ x(
|
|
790
|
-
|
|
790
|
+
Bt,
|
|
791
791
|
{
|
|
792
792
|
type: "checkbox",
|
|
793
793
|
id: "automatic-scroll",
|
|
@@ -876,7 +876,7 @@ var Pn = {
|
|
|
876
876
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif',
|
|
877
877
|
fontSize: "14px",
|
|
878
878
|
fontSizeSmall: "12px"
|
|
879
|
-
},
|
|
879
|
+
}, Ra = 1e3;
|
|
880
880
|
function Wa(e, t, n, r) {
|
|
881
881
|
if (!Vn(t))
|
|
882
882
|
return t;
|
|
@@ -926,7 +926,7 @@ var _a = k.canvas.attrs((e) => ({
|
|
|
926
926
|
barGap: g = 0,
|
|
927
927
|
transparentBackground: p = !1,
|
|
928
928
|
drawMode: d = "inverted"
|
|
929
|
-
} = e, b =
|
|
929
|
+
} = e, b = E([]), y = D(
|
|
930
930
|
(w) => {
|
|
931
931
|
if (w !== null) {
|
|
932
932
|
const C = parseInt(w.dataset.index, 10);
|
|
@@ -938,30 +938,30 @@ var _a = k.canvas.attrs((e) => ({
|
|
|
938
938
|
fa(() => {
|
|
939
939
|
const w = b.current, C = u + g;
|
|
940
940
|
let A = 0;
|
|
941
|
-
for (let
|
|
942
|
-
const
|
|
943
|
-
if (
|
|
944
|
-
|
|
945
|
-
const T =
|
|
941
|
+
for (let S = 0; S < w.length; S++) {
|
|
942
|
+
const B = w[S], M = B.getContext("2d"), $ = Math.floor(i / 2), V = 2 ** (n - 1);
|
|
943
|
+
if (M) {
|
|
944
|
+
M.resetTransform(), M.clearRect(0, 0, B.width, B.height), M.imageSmoothingEnabled = !1, M.scale(o, o);
|
|
945
|
+
const T = B.width / o;
|
|
946
946
|
let P;
|
|
947
|
-
d === "normal" ? P = c : P = l,
|
|
948
|
-
|
|
947
|
+
d === "normal" ? P = c : P = l, M.fillStyle = Wa(
|
|
948
|
+
M,
|
|
949
949
|
P,
|
|
950
950
|
T,
|
|
951
951
|
i
|
|
952
952
|
);
|
|
953
|
-
const
|
|
953
|
+
const G = A, U = A + T, z = Math.floor((G - u + C) / C) * C;
|
|
954
954
|
for (let ee = Math.max(0, z); ee < U; ee += C) {
|
|
955
|
-
const W = ee -
|
|
955
|
+
const W = ee - G;
|
|
956
956
|
if (W + u <= 0) continue;
|
|
957
957
|
const te = ee;
|
|
958
958
|
if (te * 2 + 1 < t.length) {
|
|
959
|
-
const q = t[te * 2] / V, le = t[te * 2 + 1] / V, ne = Math.abs(q *
|
|
960
|
-
d === "normal" ?
|
|
959
|
+
const q = t[te * 2] / V, le = t[te * 2 + 1] / V, ne = Math.abs(q * $), ae = Math.abs(le * $);
|
|
960
|
+
d === "normal" ? M.fillRect(W, $ - ae, u, ae + ne) : (M.fillRect(W, 0, u, $ - ae), M.fillRect(W, $ + ne, u, $ - ne));
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
A +=
|
|
964
|
+
A += B.width / o;
|
|
965
965
|
}
|
|
966
966
|
}, [
|
|
967
967
|
t,
|
|
@@ -978,7 +978,7 @@ var _a = k.canvas.attrs((e) => ({
|
|
|
978
978
|
let f = r, h = 0;
|
|
979
979
|
const I = [];
|
|
980
980
|
for (; f > 0; ) {
|
|
981
|
-
const w = Math.min(f,
|
|
981
|
+
const w = Math.min(f, Ra), C = /* @__PURE__ */ x(
|
|
982
982
|
_a,
|
|
983
983
|
{
|
|
984
984
|
$cssWidth: w,
|
|
@@ -1216,7 +1216,7 @@ var mn = ({
|
|
|
1216
1216
|
flex: 1;
|
|
1217
1217
|
position: relative;
|
|
1218
1218
|
overflow: ${(e) => e.$isOverlay ? "visible" : "hidden"};
|
|
1219
|
-
`,
|
|
1219
|
+
`, Gt = ({
|
|
1220
1220
|
children: e,
|
|
1221
1221
|
className: t,
|
|
1222
1222
|
clipId: n,
|
|
@@ -1238,17 +1238,17 @@ var mn = ({
|
|
|
1238
1238
|
showFades: I = !1,
|
|
1239
1239
|
touchOptimized: v = !1
|
|
1240
1240
|
}) => {
|
|
1241
|
-
const m = Math.floor(o / l), C = Math.floor((o + i) / l) - m, A = c && !u && !g,
|
|
1242
|
-
id:
|
|
1241
|
+
const m = Math.floor(o / l), C = Math.floor((o + i) / l) - m, A = c && !u && !g, S = `clip-${r}-${a}`, { attributes: B, listeners: M, setNodeRef: $, setActivatorNodeRef: V, transform: T, isDragging: P } = gt({
|
|
1242
|
+
id: S,
|
|
1243
1243
|
data: { clipId: n, trackIndex: r, clipIndex: a },
|
|
1244
1244
|
disabled: !A
|
|
1245
|
-
}),
|
|
1245
|
+
}), G = `clip-boundary-left-${r}-${a}`, {
|
|
1246
1246
|
attributes: U,
|
|
1247
1247
|
listeners: z,
|
|
1248
1248
|
setActivatorNodeRef: ee,
|
|
1249
1249
|
isDragging: W
|
|
1250
1250
|
} = gt({
|
|
1251
|
-
id:
|
|
1251
|
+
id: G,
|
|
1252
1252
|
data: { clipId: n, trackIndex: r, clipIndex: a, boundary: "left" },
|
|
1253
1253
|
disabled: !A
|
|
1254
1254
|
}), te = `clip-boundary-right-${r}-${a}`, {
|
|
@@ -1261,14 +1261,14 @@ var mn = ({
|
|
|
1261
1261
|
data: { clipId: n, trackIndex: r, clipIndex: a, boundary: "right" },
|
|
1262
1262
|
disabled: !A
|
|
1263
1263
|
}), ge = T ? {
|
|
1264
|
-
transform:
|
|
1264
|
+
transform: Xt.Translate.toString(T),
|
|
1265
1265
|
zIndex: P ? 100 : void 0
|
|
1266
1266
|
// Below controls (z-index: 999) but above other clips
|
|
1267
1267
|
} : void 0;
|
|
1268
1268
|
return /* @__PURE__ */ re(
|
|
1269
1269
|
Ya,
|
|
1270
1270
|
{
|
|
1271
|
-
ref:
|
|
1271
|
+
ref: $,
|
|
1272
1272
|
style: ge,
|
|
1273
1273
|
className: t,
|
|
1274
1274
|
$left: m,
|
|
@@ -1287,7 +1287,7 @@ var mn = ({
|
|
|
1287
1287
|
trackName: s,
|
|
1288
1288
|
isSelected: p,
|
|
1289
1289
|
disableDrag: u,
|
|
1290
|
-
dragHandleProps: A ? { attributes:
|
|
1290
|
+
dragHandleProps: A ? { attributes: B, listeners: M, setActivatorNodeRef: V } : void 0
|
|
1291
1291
|
}
|
|
1292
1292
|
),
|
|
1293
1293
|
/* @__PURE__ */ re(Oa, { $isOverlay: g, children: [
|
|
@@ -1454,7 +1454,7 @@ var Qa = k.div`
|
|
|
1454
1454
|
cursor: crosshair;
|
|
1455
1455
|
/* When selecting, raise z-index above clip boundaries (z-index: 105) to prevent interference */
|
|
1456
1456
|
z-index: ${(e) => e.$isSelecting ? 110 : 1};
|
|
1457
|
-
`,
|
|
1457
|
+
`, Ut = ({
|
|
1458
1458
|
children: e,
|
|
1459
1459
|
backgroundColor: t,
|
|
1460
1460
|
timescaleBackgroundColor: n,
|
|
@@ -1494,7 +1494,7 @@ var Qa = k.div`
|
|
|
1494
1494
|
]
|
|
1495
1495
|
}
|
|
1496
1496
|
) });
|
|
1497
|
-
|
|
1497
|
+
Bn(Ut);
|
|
1498
1498
|
var ro = k.div.attrs((e) => ({
|
|
1499
1499
|
style: {
|
|
1500
1500
|
left: `${e.$left}px`,
|
|
@@ -1622,27 +1622,27 @@ var fn = k.div.attrs((e) => ({
|
|
|
1622
1622
|
minPosition: i = 0,
|
|
1623
1623
|
maxPosition: l = 1 / 0
|
|
1624
1624
|
}) => {
|
|
1625
|
-
const [c, u] = _(null), g =
|
|
1625
|
+
const [c, u] = _(null), g = E(0), p = E(0), d = E(0), b = Math.max(0, t - e), y = D((h, I) => {
|
|
1626
1626
|
h.preventDefault(), h.stopPropagation(), u(I), g.current = h.clientX, p.current = I === "start" ? e : t;
|
|
1627
1627
|
const v = (w) => {
|
|
1628
1628
|
const C = w.clientX - g.current, A = p.current + C;
|
|
1629
1629
|
if (I === "start") {
|
|
1630
|
-
const
|
|
1631
|
-
a?.(
|
|
1630
|
+
const S = Math.max(i, Math.min(t - 10, A));
|
|
1631
|
+
a?.(S);
|
|
1632
1632
|
} else {
|
|
1633
|
-
const
|
|
1634
|
-
s?.(
|
|
1633
|
+
const S = Math.max(e + 10, Math.min(l, A));
|
|
1634
|
+
s?.(S);
|
|
1635
1635
|
}
|
|
1636
1636
|
}, m = () => {
|
|
1637
1637
|
u(null), document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", m);
|
|
1638
1638
|
};
|
|
1639
1639
|
document.addEventListener("mousemove", v), document.addEventListener("mouseup", m);
|
|
1640
|
-
}, [e, t, i, l, a, s]), f =
|
|
1640
|
+
}, [e, t, i, l, a, s]), f = D((h) => {
|
|
1641
1641
|
h.preventDefault(), h.stopPropagation(), u("region"), g.current = h.clientX, p.current = e, d.current = t;
|
|
1642
1642
|
const I = t - e, v = (w) => {
|
|
1643
1643
|
const C = w.clientX - g.current;
|
|
1644
|
-
let A = p.current + C,
|
|
1645
|
-
A < i && (A = i,
|
|
1644
|
+
let A = p.current + C, S = d.current + C;
|
|
1645
|
+
A < i && (A = i, S = i + I), S > l && (S = l, A = l - I), o?.(A, S);
|
|
1646
1646
|
}, m = () => {
|
|
1647
1647
|
u(null), document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", m);
|
|
1648
1648
|
};
|
|
@@ -1704,7 +1704,7 @@ var fn = k.div.attrs((e) => ({
|
|
|
1704
1704
|
maxPosition: o = 1 / 0,
|
|
1705
1705
|
controlsOffset: i = 0
|
|
1706
1706
|
}) => {
|
|
1707
|
-
const [l, c] = _(!1), u =
|
|
1707
|
+
const [l, c] = _(!1), u = E(0), g = E(null), p = 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;
|
|
@@ -1714,8 +1714,8 @@ var fn = k.div.attrs((e) => ({
|
|
|
1714
1714
|
const h = b.clientX - f.left, I = Math.max(s, Math.min(o, h));
|
|
1715
1715
|
u.current = I, a?.(I, I);
|
|
1716
1716
|
const v = (w) => {
|
|
1717
|
-
const C = w.clientX - f.left, A = Math.max(s, Math.min(o, C)),
|
|
1718
|
-
a?.(
|
|
1717
|
+
const C = w.clientX - f.left, A = Math.max(s, Math.min(o, C)), S = Math.min(u.current, A), B = Math.max(u.current, A);
|
|
1718
|
+
a?.(S, B);
|
|
1719
1719
|
}, m = () => {
|
|
1720
1720
|
c(!1), document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", m);
|
|
1721
1721
|
};
|
|
@@ -1881,7 +1881,7 @@ var Ln = ke(St()), Yn = ({ children: e }) => {
|
|
|
1881
1881
|
},
|
|
1882
1882
|
{ once: !0 }
|
|
1883
1883
|
), /* @__PURE__ */ x(Ln.Provider, { value: Math.ceil(t), children: e });
|
|
1884
|
-
}, On = () =>
|
|
1884
|
+
}, On = () => Be(Ln), Et = ke({
|
|
1885
1885
|
sampleRate: 48e3,
|
|
1886
1886
|
samplesPerPixel: 1e3,
|
|
1887
1887
|
zoomLevels: [1e3, 1500, 2e3, 2500],
|
|
@@ -1894,7 +1894,7 @@ var Ln = ke(St()), Yn = ({ children: e }) => {
|
|
|
1894
1894
|
duration: 3e4,
|
|
1895
1895
|
barWidth: 1,
|
|
1896
1896
|
barGap: 0
|
|
1897
|
-
}), bt = () =>
|
|
1897
|
+
}), bt = () => Be(Et), vt = () => Be(ha), jt = ke(/* @__PURE__ */ x(ma, {})), co = () => Be(jt), uo = 0, mo = !1, fo = 0, ho = 0, po = {
|
|
1898
1898
|
progress: uo,
|
|
1899
1899
|
isPlaying: mo,
|
|
1900
1900
|
selectionStart: fo,
|
|
@@ -1973,12 +1973,12 @@ var vo = k.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 = E(null), {
|
|
1977
1977
|
sampleRate: u,
|
|
1978
1978
|
samplesPerPixel: g,
|
|
1979
1979
|
timeScaleHeight: p,
|
|
1980
1980
|
controls: { show: d, width: b }
|
|
1981
|
-
} =
|
|
1981
|
+
} = Be(Et), y = On();
|
|
1982
1982
|
Q(() => {
|
|
1983
1983
|
if (c.current !== null) {
|
|
1984
1984
|
const v = c.current, m = v.getContext("2d");
|
|
@@ -2031,7 +2031,7 @@ var vo = k.div.attrs((e) => ({
|
|
|
2031
2031
|
]
|
|
2032
2032
|
}
|
|
2033
2033
|
);
|
|
2034
|
-
}, Un =
|
|
2034
|
+
}, Un = Bn(Co), xo = k.div`
|
|
2035
2035
|
display: inline-flex;
|
|
2036
2036
|
align-items: center;
|
|
2037
2037
|
gap: 0.5rem;
|
|
@@ -2048,7 +2048,7 @@ var vo = k.div.attrs((e) => ({
|
|
|
2048
2048
|
disabled: n = !1,
|
|
2049
2049
|
className: r
|
|
2050
2050
|
}) => /* @__PURE__ */ x(xo, { className: r, children: /* @__PURE__ */ x(
|
|
2051
|
-
|
|
2051
|
+
Kt,
|
|
2052
2052
|
{
|
|
2053
2053
|
className: "time-format",
|
|
2054
2054
|
value: e,
|
|
@@ -2215,7 +2215,7 @@ var vo = k.div.attrs((e) => ({
|
|
|
2215
2215
|
border-top-right-radius: 0;
|
|
2216
2216
|
border-bottom-right-radius: 0;
|
|
2217
2217
|
}
|
|
2218
|
-
`,
|
|
2218
|
+
`, Do = k.div`
|
|
2219
2219
|
background: transparent;
|
|
2220
2220
|
width: 100%;
|
|
2221
2221
|
height: 100%;
|
|
@@ -2228,7 +2228,7 @@ var vo = k.div.attrs((e) => ({
|
|
|
2228
2228
|
text-align: center;
|
|
2229
2229
|
border: 1px solid ${(e) => e.theme.borderColor};
|
|
2230
2230
|
border-radius: ${(e) => e.theme.borderRadius};
|
|
2231
|
-
`,
|
|
2231
|
+
`, Bo = k.header`
|
|
2232
2232
|
overflow: hidden;
|
|
2233
2233
|
height: 26px;
|
|
2234
2234
|
width: 100%;
|
|
@@ -2239,7 +2239,7 @@ var vo = k.div.attrs((e) => ({
|
|
|
2239
2239
|
font-size: ${(e) => e.theme.fontSizeSmall};
|
|
2240
2240
|
color: ${(e) => e.theme.textColor};
|
|
2241
2241
|
background-color: transparent;
|
|
2242
|
-
`, To = (e) => /* @__PURE__ */ x(Wn, { weight: "light", ...e }),
|
|
2242
|
+
`, To = (e) => /* @__PURE__ */ x(Wn, { weight: "light", ...e }), Eo = (e) => /* @__PURE__ */ x(Rn, { weight: "light", ...e }), gn = k(Zn)`
|
|
2243
2243
|
width: 75%;
|
|
2244
2244
|
height: 5px;
|
|
2245
2245
|
background: ${(e) => e.theme.sliderTrackColor};
|
|
@@ -2338,7 +2338,7 @@ k.button`
|
|
|
2338
2338
|
transform: scale(0.9);
|
|
2339
2339
|
}
|
|
2340
2340
|
`;
|
|
2341
|
-
function
|
|
2341
|
+
function Ro(e) {
|
|
2342
2342
|
let t = 1 / 0, n = -1 / 0;
|
|
2343
2343
|
for (let r = 0; r < e.length; r++) {
|
|
2344
2344
|
const a = e[r];
|
|
@@ -2361,7 +2361,7 @@ function Jn(e, t) {
|
|
|
2361
2361
|
function wn(e, t, n) {
|
|
2362
2362
|
const r = e.length, a = Math.ceil(r / t), s = Jn(n, a * 2);
|
|
2363
2363
|
for (let o = 0; o < a; o++) {
|
|
2364
|
-
const i = o * t, l = Math.min((o + 1) * t, r), c = e.subarray(i, l), u =
|
|
2364
|
+
const i = o * t, l = Math.min((o + 1) * t, r), c = e.subarray(i, l), u = Ro(c), g = vn(u.min, n), p = vn(u.max, n);
|
|
2365
2365
|
s[o * 2] = g, s[o * 2 + 1] = p;
|
|
2366
2366
|
}
|
|
2367
2367
|
return s;
|
|
@@ -2435,8 +2435,8 @@ function Ho(e, t) {
|
|
|
2435
2435
|
return r > 0 && n++, n;
|
|
2436
2436
|
}
|
|
2437
2437
|
function Xo(e) {
|
|
2438
|
-
for (var t = e.scale, n = e.amplitude_scale, r = e.split_channels, a = e.length, s = e.sample_rate, o = e.channels.map(function(
|
|
2439
|
-
return new Float32Array(
|
|
2438
|
+
for (var t = e.scale, n = e.amplitude_scale, r = e.split_channels, a = e.length, s = e.sample_rate, o = e.channels.map(function($) {
|
|
2439
|
+
return new Float32Array($);
|
|
2440
2440
|
}), i = r ? o.length : 1, l = 24, c = Ho(a, t), u = e.bits === 8 ? 1 : 2, g = l + c * 2 * u * i, p = new ArrayBuffer(g), d = new DataView(p), b = 0, y = l, f = new Array(i), h = new Array(i), I = 0; I < i; I++)
|
|
2441
2441
|
f[I] = 1 / 0, h[I] = -1 / 0;
|
|
2442
2442
|
var v = e.bits === 8 ? Vo : zo, m = e.bits === 8 ? Zo : Po;
|
|
@@ -2448,17 +2448,17 @@ function Xo(e) {
|
|
|
2448
2448
|
C += o[A][w];
|
|
2449
2449
|
C = Math.floor(m * C * n / o.length), C < f[0] && (f[0] = C, f[0] < v && (f[0] = v)), C > h[0] && (h[0] = C, h[0] > m && (h[0] = m));
|
|
2450
2450
|
} else
|
|
2451
|
-
for (var
|
|
2452
|
-
C = Math.floor(m * o[
|
|
2451
|
+
for (var S = 0; S < i; ++S)
|
|
2452
|
+
C = Math.floor(m * o[S][w] * n), C < f[S] && (f[S] = C, f[S] < v && (f[S] = v)), C > h[S] && (h[S] = C, h[S] > m && (h[S] = m));
|
|
2453
2453
|
if (++b === t) {
|
|
2454
|
-
for (var
|
|
2455
|
-
e.bits === 8 ? (d.setInt8(y++, f[
|
|
2454
|
+
for (var B = 0; B < i; B++)
|
|
2455
|
+
e.bits === 8 ? (d.setInt8(y++, f[B]), d.setInt8(y++, h[B])) : (d.setInt16(y, f[B], !0), d.setInt16(y + 2, h[B], !0), y += 4), f[B] = 1 / 0, h[B] = -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++, f[
|
|
2460
|
+
for (var M = 0; M < i; M++)
|
|
2461
|
+
e.bits === 8 ? (d.setInt8(y++, f[M]), d.setInt8(y++, h[M])) : (d.setInt16(y, f[M], !0), d.setInt16(y + 2, h[M], !0));
|
|
2462
2462
|
return p;
|
|
2463
2463
|
}
|
|
2464
2464
|
function $t(e) {
|
|
@@ -2597,7 +2597,7 @@ Ze.createFromAudio = function(e, t) {
|
|
|
2597
2597
|
"WaveformData.createFromAudio(): Pass either an AudioContext and ArrayBuffer, or an AudioBuffer object"
|
|
2598
2598
|
);
|
|
2599
2599
|
};
|
|
2600
|
-
function
|
|
2600
|
+
function Rt(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
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 Ze(this._output_data), this._input_index = 0, this._output_index = 0;
|
|
@@ -2607,10 +2607,10 @@ function Et(e) {
|
|
|
2607
2607
|
this._input_buffer_size > 0 ? (this._min[i] = this._inputData.channel(i).min_sample(this._input_index), this._max[i] = this._inputData.channel(i).max_sample(this._input_index)) : (this._min[i] = 0, this._max[i] = 0);
|
|
2608
2608
|
this._min_value = this._inputData.bits === 8 ? -128 : -32768, this._max_value = this._inputData.bits === 8 ? 127 : 32767, this._where = 0, this._prev_where = 0, this._stop = 0, this._last_input_index = 0;
|
|
2609
2609
|
}
|
|
2610
|
-
|
|
2610
|
+
Rt.prototype.sample_at_pixel = function(e) {
|
|
2611
2611
|
return Math.floor(e * this._output_samples_per_pixel);
|
|
2612
2612
|
};
|
|
2613
|
-
|
|
2613
|
+
Rt.prototype.next = function() {
|
|
2614
2614
|
for (var e = 0, t = 1e3, n = this._inputData.channels, r; this._input_index < this._input_buffer_size && e < t; ) {
|
|
2615
2615
|
for (; Math.floor(this.sample_at_pixel(this._output_index) / this._scale) === this._input_index; ) {
|
|
2616
2616
|
if (this._output_index > 0)
|
|
@@ -2637,7 +2637,7 @@ Et.prototype.next = function() {
|
|
|
2637
2637
|
r = this._outputWaveformData.channel(l), r.set_min_sample(this._output_index - 1, this._min[l]), r.set_max_sample(this._output_index - 1, this._max[l]);
|
|
2638
2638
|
return !0;
|
|
2639
2639
|
};
|
|
2640
|
-
|
|
2640
|
+
Rt.prototype.getOutputData = function() {
|
|
2641
2641
|
return this._output_data;
|
|
2642
2642
|
};
|
|
2643
2643
|
Ze.prototype = {
|
|
@@ -2655,7 +2655,7 @@ Ze.prototype = {
|
|
|
2655
2655
|
},
|
|
2656
2656
|
resample: function(t) {
|
|
2657
2657
|
t = this._getResampleOptions(t), t.waveformData = this;
|
|
2658
|
-
for (var n = new
|
|
2658
|
+
for (var n = new Rt(t); !n.next(); )
|
|
2659
2659
|
;
|
|
2660
2660
|
return new Ze(n.getOutputData());
|
|
2661
2661
|
},
|
|
@@ -3311,7 +3311,7 @@ var is = k.div`
|
|
|
3311
3311
|
onAnnotationUpdate: u,
|
|
3312
3312
|
renderAnnotationItem: g
|
|
3313
3313
|
}) => {
|
|
3314
|
-
const p =
|
|
3314
|
+
const p = E(null), d = E(null), b = E(void 0);
|
|
3315
3315
|
Q(() => {
|
|
3316
3316
|
}), Q(() => {
|
|
3317
3317
|
const m = d.current;
|
|
@@ -3383,7 +3383,10 @@ var is = k.div`
|
|
|
3383
3383
|
$isEditable: s,
|
|
3384
3384
|
contentEditable: s,
|
|
3385
3385
|
suppressContentEditableWarning: !0,
|
|
3386
|
-
onBlur: (
|
|
3386
|
+
onBlur: (S) => h(w, S.currentTarget.textContent || ""),
|
|
3387
|
+
onKeyDown: (S) => {
|
|
3388
|
+
S.key === "Enter" && (S.preventDefault(), S.currentTarget.blur());
|
|
3389
|
+
},
|
|
3387
3390
|
children: m.id
|
|
3388
3391
|
}
|
|
3389
3392
|
),
|
|
@@ -3393,14 +3396,14 @@ var is = k.div`
|
|
|
3393
3396
|
y(m.end)
|
|
3394
3397
|
] })
|
|
3395
3398
|
] }),
|
|
3396
|
-
o.length > 0 && /* @__PURE__ */ x(fs, { onClick: (
|
|
3399
|
+
o.length > 0 && /* @__PURE__ */ x(fs, { onClick: (S) => S.stopPropagation(), children: o.map((S, B) => /* @__PURE__ */ x(
|
|
3397
3400
|
hs,
|
|
3398
3401
|
{
|
|
3399
|
-
title:
|
|
3400
|
-
onClick: () => I(
|
|
3401
|
-
children:
|
|
3402
|
+
title: S.title,
|
|
3403
|
+
onClick: () => I(S, m, w),
|
|
3404
|
+
children: S.text ? S.text : /* @__PURE__ */ x("i", { className: v(S.class || "") })
|
|
3402
3405
|
},
|
|
3403
|
-
|
|
3406
|
+
B
|
|
3404
3407
|
)) })
|
|
3405
3408
|
] }),
|
|
3406
3409
|
/* @__PURE__ */ x(
|
|
@@ -3409,7 +3412,10 @@ var is = k.div`
|
|
|
3409
3412
|
$isEditable: s,
|
|
3410
3413
|
contentEditable: s,
|
|
3411
3414
|
suppressContentEditableWarning: !0,
|
|
3412
|
-
onBlur: (
|
|
3415
|
+
onBlur: (S) => f(w, S.currentTarget.textContent || ""),
|
|
3416
|
+
onKeyDown: (S) => {
|
|
3417
|
+
S.key === "Enter" && (S.preventDefault(), S.currentTarget.blur());
|
|
3418
|
+
},
|
|
3413
3419
|
children: m.lines.join(`
|
|
3414
3420
|
`)
|
|
3415
3421
|
}
|
|
@@ -3424,9 +3430,9 @@ var is = k.div`
|
|
|
3424
3430
|
onChange: t,
|
|
3425
3431
|
disabled: n = !1,
|
|
3426
3432
|
className: r
|
|
3427
|
-
}) => /* @__PURE__ */ re(
|
|
3433
|
+
}) => /* @__PURE__ */ re(Dt, { className: r, children: [
|
|
3428
3434
|
/* @__PURE__ */ x(
|
|
3429
|
-
|
|
3435
|
+
Bt,
|
|
3430
3436
|
{
|
|
3431
3437
|
type: "checkbox",
|
|
3432
3438
|
id: "continuous-play",
|
|
@@ -3444,9 +3450,9 @@ var is = k.div`
|
|
|
3444
3450
|
onChange: t,
|
|
3445
3451
|
disabled: n = !1,
|
|
3446
3452
|
className: r
|
|
3447
|
-
}) => /* @__PURE__ */ re(
|
|
3453
|
+
}) => /* @__PURE__ */ re(Dt, { className: r, children: [
|
|
3448
3454
|
/* @__PURE__ */ x(
|
|
3449
|
-
|
|
3455
|
+
Bt,
|
|
3450
3456
|
{
|
|
3451
3457
|
type: "checkbox",
|
|
3452
3458
|
id: "link-endpoints",
|
|
@@ -3463,9 +3469,9 @@ var is = k.div`
|
|
|
3463
3469
|
checked: e,
|
|
3464
3470
|
onChange: t,
|
|
3465
3471
|
className: n
|
|
3466
|
-
}) => /* @__PURE__ */ re(
|
|
3472
|
+
}) => /* @__PURE__ */ re(Dt, { className: n, children: [
|
|
3467
3473
|
/* @__PURE__ */ x(
|
|
3468
|
-
|
|
3474
|
+
Bt,
|
|
3469
3475
|
{
|
|
3470
3476
|
type: "checkbox",
|
|
3471
3477
|
id: "editable-annotations",
|
|
@@ -3538,9 +3544,9 @@ function As({
|
|
|
3538
3544
|
const [n, r] = _(() => {
|
|
3539
3545
|
const c = t.indexOf(e);
|
|
3540
3546
|
return c !== -1 ? c : Math.floor(t.length / 2);
|
|
3541
|
-
}), a = t[n], s = n > 0, o = n < t.length - 1, i =
|
|
3547
|
+
}), a = t[n], s = n > 0, o = n < t.length - 1, i = D(() => {
|
|
3542
3548
|
r((c) => Math.max(0, c - 1));
|
|
3543
|
-
}, []), l =
|
|
3549
|
+
}, []), l = D(() => {
|
|
3544
3550
|
r((c) => Math.min(t.length - 1, c + 1));
|
|
3545
3551
|
}, [t.length]);
|
|
3546
3552
|
return {
|
|
@@ -3556,7 +3562,7 @@ function ks({
|
|
|
3556
3562
|
initialVolume: t = 1,
|
|
3557
3563
|
onVolumeChange: n
|
|
3558
3564
|
}) {
|
|
3559
|
-
const [r, a] = _(t), s =
|
|
3565
|
+
const [r, a] = _(t), s = D((o) => {
|
|
3560
3566
|
a(o), e.current && e.current.setMasterGain(o), n?.(o);
|
|
3561
3567
|
}, [e, n]);
|
|
3562
3568
|
return {
|
|
@@ -3565,15 +3571,15 @@ function ks({
|
|
|
3565
3571
|
};
|
|
3566
3572
|
}
|
|
3567
3573
|
const Si = (e = 256) => {
|
|
3568
|
-
const t =
|
|
3569
|
-
const o = new
|
|
3574
|
+
const t = E(null), n = D((r, a, s) => {
|
|
3575
|
+
const o = new Dn("fft", e);
|
|
3570
3576
|
return r.connect(o), r.connect(a), t.current = o, function() {
|
|
3571
3577
|
o.dispose(), t.current = null;
|
|
3572
3578
|
};
|
|
3573
3579
|
}, [e]);
|
|
3574
3580
|
return { analyserRef: t, masterEffects: n };
|
|
3575
3581
|
};
|
|
3576
|
-
function
|
|
3582
|
+
function Nt(e) {
|
|
3577
3583
|
const {
|
|
3578
3584
|
audioBuffer: t,
|
|
3579
3585
|
startSample: n,
|
|
@@ -3630,7 +3636,7 @@ function Ss(e) {
|
|
|
3630
3636
|
`Sample rate mismatch: audioBuffer (${t.sampleRate}) vs waveformData (${c.sample_rate}). Using audioBuffer sample rate. Waveform visualization may be slightly off.`
|
|
3631
3637
|
);
|
|
3632
3638
|
const p = e.duration ?? g;
|
|
3633
|
-
return
|
|
3639
|
+
return Nt({
|
|
3634
3640
|
audioBuffer: t,
|
|
3635
3641
|
startSample: Math.round(n * u),
|
|
3636
3642
|
durationSamples: Math.round(p * u),
|
|
@@ -3715,16 +3721,16 @@ function $i(e, t = {}) {
|
|
|
3715
3721
|
o(!0), l(null), u(0);
|
|
3716
3722
|
const f = zr.getContext().rawContext, h = e.map(async (v, m) => {
|
|
3717
3723
|
if (v.audioBuffer) {
|
|
3718
|
-
const
|
|
3719
|
-
return n && !p && (d.set(m,
|
|
3720
|
-
Array.from({ length: e.length }, (
|
|
3721
|
-
)),
|
|
3724
|
+
const B = b(v, m, v.audioBuffer);
|
|
3725
|
+
return n && !p && (d.set(m, B), u((M) => M + 1), a(
|
|
3726
|
+
Array.from({ length: e.length }, (M, $) => d.get($)).filter((M) => M !== void 0)
|
|
3727
|
+
)), B;
|
|
3722
3728
|
}
|
|
3723
3729
|
if (!v.src && v.waveformData) {
|
|
3724
|
-
const
|
|
3725
|
-
return n && !p && (d.set(m,
|
|
3726
|
-
Array.from({ length: e.length }, (
|
|
3727
|
-
)),
|
|
3730
|
+
const B = b(v, m);
|
|
3731
|
+
return n && !p && (d.set(m, B), u((M) => M + 1), a(
|
|
3732
|
+
Array.from({ length: e.length }, (M, $) => d.get($)).filter((M) => M !== void 0)
|
|
3733
|
+
)), B;
|
|
3728
3734
|
}
|
|
3729
3735
|
if (!v.src)
|
|
3730
3736
|
throw new Error(`Track ${m + 1}: Must provide src, audioBuffer, or waveformData`);
|
|
@@ -3734,10 +3740,10 @@ function $i(e, t = {}) {
|
|
|
3734
3740
|
const C = await w.arrayBuffer(), A = await f.decodeAudioData(C);
|
|
3735
3741
|
if (!A || !A.sampleRate || !A.duration)
|
|
3736
3742
|
throw new Error(`Invalid audio buffer for ${v.src}`);
|
|
3737
|
-
const
|
|
3738
|
-
return n && !p && (d.set(m,
|
|
3739
|
-
Array.from({ length: e.length }, (
|
|
3740
|
-
)),
|
|
3743
|
+
const S = b(v, m, A);
|
|
3744
|
+
return n && !p && (d.set(m, S), u((B) => B + 1), a(
|
|
3745
|
+
Array.from({ length: e.length }, (B, M) => d.get(M)).filter((B) => B !== void 0)
|
|
3746
|
+
)), S;
|
|
3741
3747
|
}), I = await Promise.all(h);
|
|
3742
3748
|
p || (n || (a(I), u(I.length)), o(!1));
|
|
3743
3749
|
} catch (f) {
|
|
@@ -3770,22 +3776,22 @@ function Mi({
|
|
|
3770
3776
|
if (!f) return { ...u, scaleX: 1, scaleY: 1 };
|
|
3771
3777
|
const h = f.startSample / r, I = f.durationSamples / r, v = u.x * n / r;
|
|
3772
3778
|
let m = h + v;
|
|
3773
|
-
const w = [...y.clips].sort((
|
|
3779
|
+
const w = [...y.clips].sort(($, V) => $.startSample - V.startSample), C = w.findIndex(($) => $ === f);
|
|
3774
3780
|
m = Math.max(0, m);
|
|
3775
3781
|
const A = C > 0 ? w[C - 1] : null;
|
|
3776
3782
|
if (A) {
|
|
3777
|
-
const
|
|
3778
|
-
m = Math.max(m,
|
|
3783
|
+
const $ = (A.startSample + A.durationSamples) / r;
|
|
3784
|
+
m = Math.max(m, $);
|
|
3779
3785
|
}
|
|
3780
|
-
const
|
|
3781
|
-
if (
|
|
3782
|
-
const
|
|
3783
|
-
|
|
3786
|
+
const S = C < w.length - 1 ? w[C + 1] : null;
|
|
3787
|
+
if (S) {
|
|
3788
|
+
const $ = m + I, V = S.startSample / r;
|
|
3789
|
+
$ > V && (m = V - I);
|
|
3784
3790
|
}
|
|
3785
|
-
const
|
|
3791
|
+
const M = (m - h) * r / n;
|
|
3786
3792
|
return {
|
|
3787
3793
|
...u,
|
|
3788
|
-
x:
|
|
3794
|
+
x: M,
|
|
3789
3795
|
scaleX: 1,
|
|
3790
3796
|
scaleY: 1
|
|
3791
3797
|
};
|
|
@@ -3812,34 +3818,34 @@ function Mi({
|
|
|
3812
3818
|
if (!p || !a.current) return;
|
|
3813
3819
|
const { trackIndex: d, clipIndex: b } = u.data.current, y = g.x * n, f = Math.floor(0.1 * r), h = a.current, I = e.map((v, m) => {
|
|
3814
3820
|
if (m !== d) return v;
|
|
3815
|
-
const w = [...v.clips].sort((
|
|
3816
|
-
if (
|
|
3817
|
-
const
|
|
3821
|
+
const w = [...v.clips].sort((S, B) => S.startSample - B.startSample), C = w.findIndex((S) => S === v.clips[b]), A = v.clips.map((S, B) => {
|
|
3822
|
+
if (B !== b) return S;
|
|
3823
|
+
const M = S.sourceDurationSamples;
|
|
3818
3824
|
if (p === "left") {
|
|
3819
|
-
let
|
|
3825
|
+
let $ = Math.floor(y);
|
|
3820
3826
|
const V = -h.startSample;
|
|
3821
|
-
|
|
3827
|
+
$ < V && ($ = V);
|
|
3822
3828
|
const T = -h.offsetSamples;
|
|
3823
|
-
|
|
3829
|
+
$ < T && ($ = T);
|
|
3824
3830
|
const P = C > 0 ? w[C - 1] : null;
|
|
3825
3831
|
if (P) {
|
|
3826
3832
|
const te = P.startSample + P.durationSamples - h.startSample;
|
|
3827
|
-
|
|
3833
|
+
$ < te && ($ = te);
|
|
3828
3834
|
}
|
|
3829
|
-
const
|
|
3830
|
-
|
|
3831
|
-
const U = h.offsetSamples +
|
|
3835
|
+
const G = h.durationSamples - f;
|
|
3836
|
+
$ > G && ($ = G);
|
|
3837
|
+
const U = h.offsetSamples + $, z = h.durationSamples - $, ee = h.startSample + $;
|
|
3832
3838
|
return {
|
|
3833
|
-
...
|
|
3839
|
+
...S,
|
|
3834
3840
|
offsetSamples: U,
|
|
3835
3841
|
durationSamples: z,
|
|
3836
3842
|
startSample: ee
|
|
3837
3843
|
};
|
|
3838
3844
|
} else {
|
|
3839
|
-
let
|
|
3840
|
-
|
|
3845
|
+
let $ = Math.floor(h.durationSamples + y);
|
|
3846
|
+
$ = Math.max(f, $), h.offsetSamples + $ > M && ($ = M - h.offsetSamples);
|
|
3841
3847
|
const V = C < w.length - 1 ? w[C + 1] : null;
|
|
3842
|
-
return V && h.startSample +
|
|
3848
|
+
return V && h.startSample + $ > V.startSample && ($ = V.startSample - h.startSample, $ = Math.max(f, $)), { ...S, durationSamples: $ };
|
|
3843
3849
|
}
|
|
3844
3850
|
});
|
|
3845
3851
|
return { ...v, clips: A };
|
|
@@ -3858,17 +3864,17 @@ function Mi({
|
|
|
3858
3864
|
if (I !== p) return h;
|
|
3859
3865
|
const v = [...h.clips].sort((C, A) => C.startSample - A.startSample), m = v.findIndex((C) => C === h.clips[d]), w = h.clips.map((C, A) => {
|
|
3860
3866
|
if (A !== d) return C;
|
|
3861
|
-
let
|
|
3862
|
-
|
|
3863
|
-
const
|
|
3864
|
-
if (
|
|
3865
|
-
const
|
|
3866
|
-
|
|
3867
|
+
let S = Math.floor(C.startSample + y);
|
|
3868
|
+
S = Math.max(0, S);
|
|
3869
|
+
const B = m > 0 ? v[m - 1] : null;
|
|
3870
|
+
if (B) {
|
|
3871
|
+
const $ = B.startSample + B.durationSamples;
|
|
3872
|
+
S = Math.max(S, $);
|
|
3867
3873
|
}
|
|
3868
|
-
const
|
|
3869
|
-
return
|
|
3874
|
+
const M = m < v.length - 1 ? v[m + 1] : null;
|
|
3875
|
+
return M && S + C.durationSamples > M.startSample && (S = M.startSample - C.durationSamples), {
|
|
3870
3876
|
...C,
|
|
3871
|
-
startSample:
|
|
3877
|
+
startSample: S
|
|
3872
3878
|
};
|
|
3873
3879
|
});
|
|
3874
3880
|
return {
|
|
@@ -3887,7 +3893,7 @@ function Mi({
|
|
|
3887
3893
|
collisionModifier: s
|
|
3888
3894
|
};
|
|
3889
3895
|
}
|
|
3890
|
-
const
|
|
3896
|
+
const zt = 0.01;
|
|
3891
3897
|
function Ms({
|
|
3892
3898
|
annotations: e,
|
|
3893
3899
|
onAnnotationsChange: t,
|
|
@@ -3918,7 +3924,7 @@ function Ms({
|
|
|
3918
3924
|
return;
|
|
3919
3925
|
const d = g.data.current;
|
|
3920
3926
|
if (!d) return;
|
|
3921
|
-
const { edge: b, annotationIndex: y } = d, f = o.current, h = p.x * n / r, I = b === "start" ? f.start + h : f.end + h, v =
|
|
3927
|
+
const { edge: b, annotationIndex: y } = d, f = o.current, h = p.x * n / r, I = b === "start" ? f.start + h : f.end + h, v = Ds({
|
|
3922
3928
|
annotationIndex: y,
|
|
3923
3929
|
newTime: I,
|
|
3924
3930
|
isDraggingStart: b === "start",
|
|
@@ -3938,7 +3944,7 @@ function Ms({
|
|
|
3938
3944
|
onDragEnd: c
|
|
3939
3945
|
};
|
|
3940
3946
|
}
|
|
3941
|
-
function
|
|
3947
|
+
function Ds({
|
|
3942
3948
|
annotationIndex: e,
|
|
3943
3949
|
newTime: t,
|
|
3944
3950
|
isDraggingStart: n,
|
|
@@ -3954,7 +3960,7 @@ function Bs({
|
|
|
3954
3960
|
start: l
|
|
3955
3961
|
}, s && e > 0) {
|
|
3956
3962
|
const u = o[e - 1];
|
|
3957
|
-
Math.abs(u.end - i.start) <
|
|
3963
|
+
Math.abs(u.end - i.start) < zt ? o[e - 1] = {
|
|
3958
3964
|
...u,
|
|
3959
3965
|
end: Math.max(u.start + 0.1, u.end + c)
|
|
3960
3966
|
} : l <= u.end && (o[e] = {
|
|
@@ -3972,7 +3978,7 @@ function Bs({
|
|
|
3972
3978
|
end: l
|
|
3973
3979
|
}, s && e < o.length - 1) {
|
|
3974
3980
|
const u = o[e + 1];
|
|
3975
|
-
if (Math.abs(u.start - i.end) <
|
|
3981
|
+
if (Math.abs(u.start - i.end) < zt) {
|
|
3976
3982
|
const g = u.start + c;
|
|
3977
3983
|
o[e + 1] = {
|
|
3978
3984
|
...u,
|
|
@@ -3981,7 +3987,7 @@ function Bs({
|
|
|
3981
3987
|
let p = e + 1;
|
|
3982
3988
|
for (; p < o.length - 1; ) {
|
|
3983
3989
|
const d = o[p], b = o[p + 1];
|
|
3984
|
-
if (Math.abs(b.start - d.end) <
|
|
3990
|
+
if (Math.abs(b.start - d.end) < zt) {
|
|
3985
3991
|
const y = d.end - r[p].end;
|
|
3986
3992
|
o[p + 1] = {
|
|
3987
3993
|
...b,
|
|
@@ -4015,17 +4021,17 @@ function Bs({
|
|
|
4015
4021
|
}
|
|
4016
4022
|
return o;
|
|
4017
4023
|
}
|
|
4018
|
-
function
|
|
4024
|
+
function Di(e = {}) {
|
|
4019
4025
|
const {
|
|
4020
4026
|
touchOptimized: t = !1,
|
|
4021
4027
|
touchDelay: n = 250,
|
|
4022
4028
|
touchTolerance: r = 5,
|
|
4023
4029
|
mouseDistance: a = 1
|
|
4024
|
-
} = e, s =
|
|
4030
|
+
} = e, s = Vt(ga, {
|
|
4025
4031
|
activationConstraint: {
|
|
4026
4032
|
distance: a
|
|
4027
4033
|
}
|
|
4028
|
-
}), o =
|
|
4034
|
+
}), o = Vt(ba, {
|
|
4029
4035
|
activationConstraint: t ? {
|
|
4030
4036
|
// Delay-based activation for mobile - wait before starting drag
|
|
4031
4037
|
// This allows users to scroll without accidentally triggering drag
|
|
@@ -4035,7 +4041,7 @@ function Bi(e = {}) {
|
|
|
4035
4041
|
// Distance-based activation for non-optimized mode
|
|
4036
4042
|
distance: a
|
|
4037
4043
|
}
|
|
4038
|
-
}), i =
|
|
4044
|
+
}), i = Vt(va, {
|
|
4039
4045
|
activationConstraint: {
|
|
4040
4046
|
distance: a
|
|
4041
4047
|
}
|
|
@@ -4044,8 +4050,8 @@ function Bi(e = {}) {
|
|
|
4044
4050
|
...t ? [s, o] : [i]
|
|
4045
4051
|
);
|
|
4046
4052
|
}
|
|
4047
|
-
const
|
|
4048
|
-
const { tracks: t, onTracksChange: n, sampleRate: r } = e, { currentTimeRef: a } = _e(), { selectedTrackId: s } = Fe(), o =
|
|
4053
|
+
const Bi = (e) => {
|
|
4054
|
+
const { tracks: t, onTracksChange: n, sampleRate: r } = e, { currentTimeRef: a } = _e(), { selectedTrackId: s } = Fe(), o = D(
|
|
4049
4055
|
(l, c, u) => {
|
|
4050
4056
|
const { sampleRate: g, samplesPerPixel: p } = e, d = t[l];
|
|
4051
4057
|
if (!d) return !1;
|
|
@@ -4054,7 +4060,7 @@ const Di = (e) => {
|
|
|
4054
4060
|
const y = b.startSample / g, f = (b.startSample + b.durationSamples) / g;
|
|
4055
4061
|
if (u <= y || u >= f)
|
|
4056
4062
|
return console.warn("Split time is outside clip bounds"), !1;
|
|
4057
|
-
const h = Math.round(u * g), I = Math.floor(h / p), v = b.startSample + b.durationSamples, m = I * p, w = b.startSample, C = m - w, A = m,
|
|
4063
|
+
const h = Math.round(u * g), I = Math.floor(h / p), v = b.startSample + b.durationSamples, m = I * p, w = b.startSample, C = m - w, A = m, S = v - A, B = m - b.startSample, M = Nt({
|
|
4058
4064
|
audioBuffer: b.audioBuffer,
|
|
4059
4065
|
startSample: w,
|
|
4060
4066
|
durationSamples: C,
|
|
@@ -4068,11 +4074,11 @@ const Di = (e) => {
|
|
|
4068
4074
|
waveformData: b.waveformData
|
|
4069
4075
|
// Share waveformData - slicing happens at render time
|
|
4070
4076
|
// Note: fadeOut removed for first clip since it's cut
|
|
4071
|
-
}),
|
|
4077
|
+
}), $ = Nt({
|
|
4072
4078
|
audioBuffer: b.audioBuffer,
|
|
4073
4079
|
startSample: A,
|
|
4074
|
-
durationSamples:
|
|
4075
|
-
offsetSamples: b.offsetSamples +
|
|
4080
|
+
durationSamples: S,
|
|
4081
|
+
offsetSamples: b.offsetSamples + B,
|
|
4076
4082
|
sampleRate: b.sampleRate,
|
|
4077
4083
|
sourceDurationSamples: b.sourceDurationSamples,
|
|
4078
4084
|
gain: b.gain,
|
|
@@ -4083,7 +4089,7 @@ const Di = (e) => {
|
|
|
4083
4089
|
// Note: fadeIn removed for second clip since it's cut
|
|
4084
4090
|
fadeOut: b.fadeOut
|
|
4085
4091
|
}), V = [...d.clips];
|
|
4086
|
-
V.splice(c, 1,
|
|
4092
|
+
V.splice(c, 1, M, $);
|
|
4087
4093
|
const T = [...t];
|
|
4088
4094
|
return T[l] = {
|
|
4089
4095
|
...d,
|
|
@@ -4093,7 +4099,7 @@ const Di = (e) => {
|
|
|
4093
4099
|
[t, n, e]
|
|
4094
4100
|
);
|
|
4095
4101
|
return {
|
|
4096
|
-
splitClipAtPlayhead:
|
|
4102
|
+
splitClipAtPlayhead: D(() => {
|
|
4097
4103
|
if (!s)
|
|
4098
4104
|
return console.log("No track selected - click a clip to select a track first"), !1;
|
|
4099
4105
|
const l = t.findIndex((g) => g.id === s);
|
|
@@ -4109,8 +4115,8 @@ const Di = (e) => {
|
|
|
4109
4115
|
}, [t, a, s, o, r]),
|
|
4110
4116
|
splitClipAt: o
|
|
4111
4117
|
};
|
|
4112
|
-
},
|
|
4113
|
-
const { shortcuts: t, enabled: n = !0 } = e, r =
|
|
4118
|
+
}, Lt = (e) => {
|
|
4119
|
+
const { shortcuts: t, enabled: n = !0 } = e, r = D(
|
|
4114
4120
|
(a) => {
|
|
4115
4121
|
if (!n) return;
|
|
4116
4122
|
const s = a.target;
|
|
@@ -4133,12 +4139,12 @@ const Di = (e) => {
|
|
|
4133
4139
|
}, Ti = (e) => {
|
|
4134
4140
|
const t = [], n = typeof navigator < "u" && navigator.platform.includes("Mac");
|
|
4135
4141
|
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
|
-
},
|
|
4137
|
-
const { enabled: t = !0, additionalShortcuts: n = [], shortcuts: r } = e, { isPlaying: a } = _e(), { setCurrentTime: s, play: o, pause: i, stop: l } = pe(), { playoutRef: c } = Se(), u =
|
|
4142
|
+
}, Ei = (e = {}) => {
|
|
4143
|
+
const { enabled: t = !0, additionalShortcuts: n = [], shortcuts: r } = e, { isPlaying: a } = _e(), { setCurrentTime: s, play: o, pause: i, stop: l } = pe(), { playoutRef: c } = Se(), u = D(() => {
|
|
4138
4144
|
a ? i() : o();
|
|
4139
|
-
}, [a, o, i]), g =
|
|
4145
|
+
}, [a, o, i]), g = D(() => {
|
|
4140
4146
|
l();
|
|
4141
|
-
}, [l]), p =
|
|
4147
|
+
}, [l]), p = D(() => {
|
|
4142
4148
|
a && c.current ? (c.current.stop(), s(0), o(0)) : s(0);
|
|
4143
4149
|
}, [a, c, s, o]), b = r ?? [...[
|
|
4144
4150
|
{
|
|
@@ -4160,7 +4166,7 @@ const Di = (e) => {
|
|
|
4160
4166
|
preventDefault: !0
|
|
4161
4167
|
}
|
|
4162
4168
|
], ...n];
|
|
4163
|
-
return
|
|
4169
|
+
return Lt({
|
|
4164
4170
|
shortcuts: b,
|
|
4165
4171
|
enabled: t
|
|
4166
4172
|
}), {
|
|
@@ -4169,8 +4175,8 @@ const Di = (e) => {
|
|
|
4169
4175
|
stopPlayback: g,
|
|
4170
4176
|
shortcuts: b
|
|
4171
4177
|
};
|
|
4172
|
-
},
|
|
4173
|
-
function
|
|
4178
|
+
}, Ht = 0.01, It = 0.01;
|
|
4179
|
+
function Ri({
|
|
4174
4180
|
annotations: e,
|
|
4175
4181
|
activeAnnotationId: t,
|
|
4176
4182
|
onAnnotationsChange: n,
|
|
@@ -4185,15 +4191,15 @@ function Ei({
|
|
|
4185
4191
|
controlsWidth: g = 0,
|
|
4186
4192
|
onPlay: p
|
|
4187
4193
|
}) {
|
|
4188
|
-
const d = Ne(() => t ? e.findIndex((
|
|
4189
|
-
(
|
|
4194
|
+
const d = Ne(() => t ? e.findIndex((B) => B.id === t) : -1, [e, t]), b = D(
|
|
4195
|
+
(B) => {
|
|
4190
4196
|
if (!l?.current || !c || !u) return;
|
|
4191
|
-
const
|
|
4192
|
-
if (
|
|
4193
|
-
const
|
|
4197
|
+
const M = e.find((W) => W.id === B);
|
|
4198
|
+
if (!M) return;
|
|
4199
|
+
const $ = l.current, V = $.clientWidth, T = M.start * u / c + g, P = M.end * u / c + g, G = (T + P) / 2, U = $.scrollLeft, z = U, ee = U + V;
|
|
4194
4200
|
if (T < z || P > ee) {
|
|
4195
|
-
const W = Math.max(0,
|
|
4196
|
-
|
|
4201
|
+
const W = Math.max(0, G - V / 2);
|
|
4202
|
+
$.scrollTo({
|
|
4197
4203
|
left: W,
|
|
4198
4204
|
behavior: "smooth"
|
|
4199
4205
|
});
|
|
@@ -4204,48 +4210,48 @@ function Ei({
|
|
|
4204
4210
|
Q(() => {
|
|
4205
4211
|
t && l?.current && c && u && b(t);
|
|
4206
4212
|
}, [t, b, l, c, u]);
|
|
4207
|
-
const y =
|
|
4208
|
-
(
|
|
4213
|
+
const y = D(
|
|
4214
|
+
(B) => {
|
|
4209
4215
|
if (d < 0) return;
|
|
4210
|
-
const
|
|
4216
|
+
const M = e[d], $ = Math.max(0, Math.min(M.end - 0.1, M.start + B)), V = $ - M.start, T = [...e];
|
|
4211
4217
|
if (T[d] = {
|
|
4212
|
-
|
|
4213
|
-
start:
|
|
4218
|
+
...M,
|
|
4219
|
+
start: $
|
|
4214
4220
|
}, s && d > 0) {
|
|
4215
4221
|
const P = T[d - 1];
|
|
4216
|
-
Math.abs(P.end -
|
|
4222
|
+
Math.abs(P.end - M.start) < Ht && (T[d - 1] = {
|
|
4217
4223
|
...P,
|
|
4218
4224
|
end: Math.max(P.start + 0.1, P.end + V)
|
|
4219
4225
|
});
|
|
4220
4226
|
} else if (!s && d > 0) {
|
|
4221
4227
|
const P = T[d - 1];
|
|
4222
|
-
|
|
4228
|
+
$ < P.end && (T[d - 1] = {
|
|
4223
4229
|
...P,
|
|
4224
|
-
end:
|
|
4230
|
+
end: $
|
|
4225
4231
|
});
|
|
4226
4232
|
}
|
|
4227
4233
|
n(T);
|
|
4228
4234
|
},
|
|
4229
4235
|
[e, d, s, n]
|
|
4230
|
-
), f =
|
|
4231
|
-
(
|
|
4236
|
+
), f = D(
|
|
4237
|
+
(B) => {
|
|
4232
4238
|
if (d < 0) return;
|
|
4233
|
-
const
|
|
4239
|
+
const M = e[d], $ = Math.max(M.start + 0.1, Math.min(a, M.end + B)), V = $ - M.end, T = [...e];
|
|
4234
4240
|
if (T[d] = {
|
|
4235
|
-
|
|
4236
|
-
end:
|
|
4241
|
+
...M,
|
|
4242
|
+
end: $
|
|
4237
4243
|
}, s && d < e.length - 1) {
|
|
4238
4244
|
const P = T[d + 1];
|
|
4239
|
-
if (Math.abs(P.start -
|
|
4240
|
-
const
|
|
4245
|
+
if (Math.abs(P.start - M.end) < Ht) {
|
|
4246
|
+
const G = Math.min(P.end - 0.1, P.start + V);
|
|
4241
4247
|
T[d + 1] = {
|
|
4242
4248
|
...P,
|
|
4243
|
-
start:
|
|
4249
|
+
start: G
|
|
4244
4250
|
};
|
|
4245
4251
|
let U = d + 1;
|
|
4246
4252
|
for (; U < T.length - 1; ) {
|
|
4247
4253
|
const z = T[U], ee = T[U + 1];
|
|
4248
|
-
if (Math.abs(ee.start - e[U].end) <
|
|
4254
|
+
if (Math.abs(ee.start - e[U].end) < Ht) {
|
|
4249
4255
|
const W = z.end - e[U].end;
|
|
4250
4256
|
T[U + 1] = {
|
|
4251
4257
|
...ee,
|
|
@@ -4257,19 +4263,19 @@ function Ei({
|
|
|
4257
4263
|
}
|
|
4258
4264
|
} else if (!s && d < e.length - 1) {
|
|
4259
4265
|
const P = T[d + 1];
|
|
4260
|
-
if (
|
|
4266
|
+
if ($ > P.start) {
|
|
4261
4267
|
T[d + 1] = {
|
|
4262
4268
|
...P,
|
|
4263
|
-
start:
|
|
4269
|
+
start: $
|
|
4264
4270
|
};
|
|
4265
|
-
let
|
|
4266
|
-
for (;
|
|
4267
|
-
const U = T[
|
|
4271
|
+
let G = d + 1;
|
|
4272
|
+
for (; G < T.length - 1; ) {
|
|
4273
|
+
const U = T[G], z = T[G + 1];
|
|
4268
4274
|
if (U.end > z.start)
|
|
4269
|
-
T[
|
|
4275
|
+
T[G + 1] = {
|
|
4270
4276
|
...z,
|
|
4271
4277
|
start: U.end
|
|
4272
|
-
},
|
|
4278
|
+
}, G++;
|
|
4273
4279
|
else
|
|
4274
4280
|
break;
|
|
4275
4281
|
}
|
|
@@ -4278,20 +4284,20 @@ function Ei({
|
|
|
4278
4284
|
n(T);
|
|
4279
4285
|
},
|
|
4280
4286
|
[e, d, a, s, n]
|
|
4281
|
-
), h =
|
|
4287
|
+
), h = D(() => {
|
|
4282
4288
|
!r || e.length === 0 || (d <= 0 ? r(e[e.length - 1].id) : r(e[d - 1].id));
|
|
4283
|
-
}, [e, d, r]), I =
|
|
4289
|
+
}, [e, d, r]), I = D(() => {
|
|
4284
4290
|
!r || e.length === 0 || (d < 0 || d >= e.length - 1 ? r(e[0].id) : r(e[d + 1].id));
|
|
4285
|
-
}, [e, d, r]), v =
|
|
4291
|
+
}, [e, d, r]), v = D(() => {
|
|
4286
4292
|
!r || e.length === 0 || r(e[0].id);
|
|
4287
|
-
}, [e, r]), m =
|
|
4293
|
+
}, [e, r]), m = D(() => {
|
|
4288
4294
|
!r || e.length === 0 || r(e[e.length - 1].id);
|
|
4289
|
-
}, [e, r]), w =
|
|
4295
|
+
}, [e, r]), w = D(() => {
|
|
4290
4296
|
r && r(null);
|
|
4291
|
-
}, [r]), C =
|
|
4297
|
+
}, [r]), C = D(() => {
|
|
4292
4298
|
if (d < 0 || !p) return;
|
|
4293
|
-
const
|
|
4294
|
-
p(
|
|
4299
|
+
const B = e[d], M = o ? void 0 : B.end - B.start;
|
|
4300
|
+
p(B.start, M);
|
|
4295
4301
|
}, [e, d, o, p]), A = Ne(
|
|
4296
4302
|
() => [
|
|
4297
4303
|
{
|
|
@@ -4328,7 +4334,7 @@ function Ei({
|
|
|
4328
4334
|
}
|
|
4329
4335
|
],
|
|
4330
4336
|
[y, f, C]
|
|
4331
|
-
),
|
|
4337
|
+
), S = Ne(
|
|
4332
4338
|
() => [
|
|
4333
4339
|
{
|
|
4334
4340
|
key: "ArrowUp",
|
|
@@ -4375,11 +4381,11 @@ function Ei({
|
|
|
4375
4381
|
],
|
|
4376
4382
|
[h, I, v, m, w]
|
|
4377
4383
|
);
|
|
4378
|
-
return
|
|
4384
|
+
return Lt({
|
|
4379
4385
|
shortcuts: A,
|
|
4380
4386
|
enabled: i && d >= 0
|
|
4381
|
-
}),
|
|
4382
|
-
shortcuts:
|
|
4387
|
+
}), Lt({
|
|
4388
|
+
shortcuts: S,
|
|
4383
4389
|
enabled: i && e.length > 0 && !!r
|
|
4384
4390
|
}), {
|
|
4385
4391
|
moveStartBoundary: y,
|
|
@@ -4393,7 +4399,7 @@ function Ei({
|
|
|
4393
4399
|
playActiveAnnotation: C
|
|
4394
4400
|
};
|
|
4395
4401
|
}
|
|
4396
|
-
function
|
|
4402
|
+
function Bs(e) {
|
|
4397
4403
|
const t = e.reduce((a, s) => a + s.length, 0), n = new Float32Array(t);
|
|
4398
4404
|
let r = 0;
|
|
4399
4405
|
for (const a of e)
|
|
@@ -4421,7 +4427,7 @@ function Cn(e, t, n = 16) {
|
|
|
4421
4427
|
}
|
|
4422
4428
|
return a;
|
|
4423
4429
|
}
|
|
4424
|
-
function
|
|
4430
|
+
function Es(e, t, n, r, a = 16) {
|
|
4425
4431
|
const s = 2 ** (a - 1), o = r % n;
|
|
4426
4432
|
let i = 0;
|
|
4427
4433
|
if (o > 0 && e.length > 0) {
|
|
@@ -4439,11 +4445,11 @@ function Rs(e, t, n, r, a = 16) {
|
|
|
4439
4445
|
const l = Cn(t.slice(i), n, a), c = new (a === 8 ? Int8Array : Int16Array)(e.length + l.length);
|
|
4440
4446
|
return c.set(e), c.set(l, e.length), c;
|
|
4441
4447
|
}
|
|
4442
|
-
function
|
|
4448
|
+
function Rs(e, t = {}) {
|
|
4443
4449
|
const {
|
|
4444
4450
|
channelCount: n = 1,
|
|
4445
4451
|
samplesPerPixel: r = 1024
|
|
4446
|
-
} = t, [a, s] = _(!1), [o, i] = _(!1), [l, c] = _(0), [u, g] = _(new Int16Array(0)), [p, d] = _(null), [b, y] = _(null), [f, h] = _(0), [I, v] = _(0), m = 16, w =
|
|
4452
|
+
} = t, [a, s] = _(!1), [o, i] = _(!1), [l, c] = _(0), [u, g] = _(new Int16Array(0)), [p, d] = _(null), [b, y] = _(null), [f, h] = _(0), [I, v] = _(0), m = 16, w = E(!1), C = E(null), A = E(null), S = E([]), B = E(0), M = E(null), $ = E(0), V = E(!1), T = E(!1), P = D(async () => {
|
|
4447
4453
|
if (!w.current)
|
|
4448
4454
|
try {
|
|
4449
4455
|
const W = Ae(), te = new URL("data:text/javascript;base64,InVzZSBzdHJpY3QiOwoKLy8gc3JjL3dvcmtsZXQvcmVjb3JkaW5nLXByb2Nlc3Nvci53b3JrbGV0LnRzCnZhciBSZWNvcmRpbmdQcm9jZXNzb3IgPSBjbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3NvciB7CiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5idWZmZXJTaXplID0gMDsKICAgIHRoaXMuYnVmZmVycyA9IFtdOwogICAgdGhpcy5zYW1wbGVzQ29sbGVjdGVkID0gMDsKICAgIHRoaXMuaXNSZWNvcmRpbmcgPSBmYWxzZTsKICAgIHRoaXMuY2hhbm5lbENvdW50ID0gMTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSAoZXZlbnQpID0+IHsKICAgICAgY29uc3QgeyBjb21tYW5kLCBzYW1wbGVSYXRlOiBzYW1wbGVSYXRlMiwgY2hhbm5lbENvdW50IH0gPSBldmVudC5kYXRhOwogICAgICBpZiAoY29tbWFuZCA9PT0gInN0YXJ0IikgewogICAgICAgIHRoaXMuaXNSZWNvcmRpbmcgPSB0cnVlOwogICAgICAgIHRoaXMuY2hhbm5lbENvdW50ID0gY2hhbm5lbENvdW50IHx8IDE7CiAgICAgICAgdGhpcy5idWZmZXJTaXplID0gTWF0aC5mbG9vcigoc2FtcGxlUmF0ZTIgfHwgNDhlMykgKiAwLjAxNik7CiAgICAgICAgdGhpcy5idWZmZXJzID0gW107CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCB0aGlzLmNoYW5uZWxDb3VudDsgaSsrKSB7CiAgICAgICAgICB0aGlzLmJ1ZmZlcnNbaV0gPSBuZXcgRmxvYXQzMkFycmF5KHRoaXMuYnVmZmVyU2l6ZSk7CiAgICAgICAgfQogICAgICAgIHRoaXMuc2FtcGxlc0NvbGxlY3RlZCA9IDA7CiAgICAgIH0gZWxzZSBpZiAoY29tbWFuZCA9PT0gInN0b3AiKSB7CiAgICAgICAgdGhpcy5pc1JlY29yZGluZyA9IGZhbHNlOwogICAgICAgIGlmICh0aGlzLnNhbXBsZXNDb2xsZWN0ZWQgPiAwKSB7CiAgICAgICAgICB0aGlzLmZsdXNoQnVmZmVycygpOwogICAgICAgIH0KICAgICAgfQogICAgfTsKICB9CiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMsIHBhcmFtZXRlcnMpIHsKICAgIGlmICghdGhpcy5pc1JlY29yZGluZykgewogICAgICByZXR1cm4gdHJ1ZTsKICAgIH0KICAgIGNvbnN0IGlucHV0ID0gaW5wdXRzWzBdOwogICAgaWYgKCFpbnB1dCB8fCBpbnB1dC5sZW5ndGggPT09IDApIHsKICAgICAgcmV0dXJuIHRydWU7CiAgICB9CiAgICBjb25zdCBmcmFtZUNvdW50ID0gaW5wdXRbMF0ubGVuZ3RoOwogICAgZm9yIChsZXQgY2hhbm5lbCA9IDA7IGNoYW5uZWwgPCBNYXRoLm1pbihpbnB1dC5sZW5ndGgsIHRoaXMuY2hhbm5lbENvdW50KTsgY2hhbm5lbCsrKSB7CiAgICAgIGNvbnN0IGlucHV0Q2hhbm5lbCA9IGlucHV0W2NoYW5uZWxdOwogICAgICBjb25zdCBidWZmZXIgPSB0aGlzLmJ1ZmZlcnNbY2hhbm5lbF07CiAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZnJhbWVDb3VudDsgaSsrKSB7CiAgICAgICAgYnVmZmVyW3RoaXMuc2FtcGxlc0NvbGxlY3RlZCArIGldID0gaW5wdXRDaGFubmVsW2ldOwogICAgICB9CiAgICB9CiAgICB0aGlzLnNhbXBsZXNDb2xsZWN0ZWQgKz0gZnJhbWVDb3VudDsKICAgIGlmICh0aGlzLnNhbXBsZXNDb2xsZWN0ZWQgPj0gdGhpcy5idWZmZXJTaXplKSB7CiAgICAgIHRoaXMuZmx1c2hCdWZmZXJzKCk7CiAgICB9CiAgICByZXR1cm4gdHJ1ZTsKICB9CiAgZmx1c2hCdWZmZXJzKCkgewogICAgY29uc3Qgc2FtcGxlcyA9IHRoaXMuYnVmZmVyc1swXS5zbGljZSgwLCB0aGlzLnNhbXBsZXNDb2xsZWN0ZWQpOwogICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgc2FtcGxlcywKICAgICAgc2FtcGxlUmF0ZSwKICAgICAgY2hhbm5lbENvdW50OiB0aGlzLmNoYW5uZWxDb3VudAogICAgfSk7CiAgICB0aGlzLnNhbXBsZXNDb2xsZWN0ZWQgPSAwOwogIH0KfTsKcmVnaXN0ZXJQcm9jZXNzb3IoInJlY29yZGluZy1wcm9jZXNzb3IiLCBSZWNvcmRpbmdQcm9jZXNzb3IpOwovLyMgc291cmNlTWFwcGluZ1VSTD1yZWNvcmRpbmctcHJvY2Vzc29yLndvcmtsZXQuanMubWFw", import.meta.url).href;
|
|
@@ -4451,7 +4457,7 @@ function Es(e, t = {}) {
|
|
|
4451
4457
|
} catch (W) {
|
|
4452
4458
|
throw console.error("Failed to load AudioWorklet module:", W), new Error("Failed to load recording processor");
|
|
4453
4459
|
}
|
|
4454
|
-
}, []),
|
|
4460
|
+
}, []), G = D(async () => {
|
|
4455
4461
|
if (!e) {
|
|
4456
4462
|
y(new Error("No microphone stream available"));
|
|
4457
4463
|
return;
|
|
@@ -4465,12 +4471,12 @@ function Es(e, t = {}) {
|
|
|
4465
4471
|
const q = W.createAudioWorkletNode("recording-processor");
|
|
4466
4472
|
C.current = q, te.connect(q), q.port.onmessage = (ne) => {
|
|
4467
4473
|
const { samples: ae } = ne.data;
|
|
4468
|
-
|
|
4469
|
-
(ge) =>
|
|
4474
|
+
S.current.push(ae), B.current += ae.length, g(
|
|
4475
|
+
(ge) => Es(
|
|
4470
4476
|
ge,
|
|
4471
4477
|
ae,
|
|
4472
4478
|
r,
|
|
4473
|
-
|
|
4479
|
+
B.current - ae.length,
|
|
4474
4480
|
m
|
|
4475
4481
|
)
|
|
4476
4482
|
);
|
|
@@ -4478,18 +4484,18 @@ function Es(e, t = {}) {
|
|
|
4478
4484
|
command: "start",
|
|
4479
4485
|
sampleRate: W.sampleRate,
|
|
4480
4486
|
channelCount: n
|
|
4481
|
-
}),
|
|
4487
|
+
}), S.current = [], B.current = 0, g(new Int16Array(0)), d(null), h(0), v(0), V.current = !0, T.current = !1, s(!0), i(!1), $.current = performance.now();
|
|
4482
4488
|
const le = () => {
|
|
4483
4489
|
if (V.current && !T.current) {
|
|
4484
|
-
const ne = (performance.now() -
|
|
4485
|
-
c(ne),
|
|
4490
|
+
const ne = (performance.now() - $.current) / 1e3;
|
|
4491
|
+
c(ne), M.current = requestAnimationFrame(le);
|
|
4486
4492
|
}
|
|
4487
4493
|
};
|
|
4488
4494
|
le();
|
|
4489
4495
|
} catch (W) {
|
|
4490
4496
|
console.error("Failed to start recording:", W), y(W instanceof Error ? W : new Error("Failed to start recording"));
|
|
4491
4497
|
}
|
|
4492
|
-
}, [e, n, r, P, a, o]), U =
|
|
4498
|
+
}, [e, n, r, P, a, o]), U = D(async () => {
|
|
4493
4499
|
if (!a)
|
|
4494
4500
|
return null;
|
|
4495
4501
|
try {
|
|
@@ -4501,8 +4507,8 @@ function Es(e, t = {}) {
|
|
|
4501
4507
|
}
|
|
4502
4508
|
C.current.disconnect();
|
|
4503
4509
|
}
|
|
4504
|
-
|
|
4505
|
-
const W =
|
|
4510
|
+
M.current !== null && (cancelAnimationFrame(M.current), M.current = null);
|
|
4511
|
+
const W = Bs(S.current), q = Ae().rawContext, le = Ts(
|
|
4506
4512
|
q,
|
|
4507
4513
|
W,
|
|
4508
4514
|
q.sampleRate,
|
|
@@ -4512,15 +4518,15 @@ function Es(e, t = {}) {
|
|
|
4512
4518
|
} catch (W) {
|
|
4513
4519
|
return console.error("Failed to stop recording:", W), y(W instanceof Error ? W : new Error("Failed to stop recording")), null;
|
|
4514
4520
|
}
|
|
4515
|
-
}, [a, n]), z =
|
|
4516
|
-
a && !o && (
|
|
4517
|
-
}, [a, o]), ee =
|
|
4521
|
+
}, [a, n]), z = D(() => {
|
|
4522
|
+
a && !o && (M.current !== null && (cancelAnimationFrame(M.current), M.current = null), T.current = !0, i(!0));
|
|
4523
|
+
}, [a, o]), ee = D(() => {
|
|
4518
4524
|
if (a && o) {
|
|
4519
|
-
T.current = !1, i(!1),
|
|
4525
|
+
T.current = !1, i(!1), $.current = performance.now() - l * 1e3;
|
|
4520
4526
|
const W = () => {
|
|
4521
4527
|
if (V.current && !T.current) {
|
|
4522
|
-
const te = (performance.now() -
|
|
4523
|
-
c(te),
|
|
4528
|
+
const te = (performance.now() - $.current) / 1e3;
|
|
4529
|
+
c(te), M.current = requestAnimationFrame(W);
|
|
4524
4530
|
}
|
|
4525
4531
|
};
|
|
4526
4532
|
W();
|
|
@@ -4535,7 +4541,7 @@ function Es(e, t = {}) {
|
|
|
4535
4541
|
}
|
|
4536
4542
|
C.current.disconnect();
|
|
4537
4543
|
}
|
|
4538
|
-
|
|
4544
|
+
M.current !== null && cancelAnimationFrame(M.current);
|
|
4539
4545
|
}, []), {
|
|
4540
4546
|
isRecording: a,
|
|
4541
4547
|
isPaused: o,
|
|
@@ -4544,7 +4550,7 @@ function Es(e, t = {}) {
|
|
|
4544
4550
|
audioBuffer: p,
|
|
4545
4551
|
level: f,
|
|
4546
4552
|
peakLevel: I,
|
|
4547
|
-
startRecording:
|
|
4553
|
+
startRecording: G,
|
|
4548
4554
|
stopRecording: U,
|
|
4549
4555
|
pauseRecording: z,
|
|
4550
4556
|
resumeRecording: ee,
|
|
@@ -4552,7 +4558,7 @@ function Es(e, t = {}) {
|
|
|
4552
4558
|
};
|
|
4553
4559
|
}
|
|
4554
4560
|
function Ws() {
|
|
4555
|
-
const [e, t] = _(null), [n, r] = _([]), [a, s] = _(!1), [o, i] = _(!1), [l, c] = _(null), u =
|
|
4561
|
+
const [e, t] = _(null), [n, r] = _([]), [a, s] = _(!1), [o, i] = _(!1), [l, c] = _(null), u = D(async () => {
|
|
4556
4562
|
try {
|
|
4557
4563
|
const b = (await navigator.mediaDevices.enumerateDevices()).filter((y) => y.kind === "audioinput").map((y) => ({
|
|
4558
4564
|
deviceId: y.deviceId,
|
|
@@ -4563,7 +4569,7 @@ function Ws() {
|
|
|
4563
4569
|
} catch (d) {
|
|
4564
4570
|
console.error("Failed to enumerate devices:", d), c(d instanceof Error ? d : new Error("Failed to enumerate devices"));
|
|
4565
4571
|
}
|
|
4566
|
-
}, []), g =
|
|
4572
|
+
}, []), g = D(async (d, b) => {
|
|
4567
4573
|
i(!0), c(null);
|
|
4568
4574
|
try {
|
|
4569
4575
|
e && e.getTracks().forEach((I) => I.stop());
|
|
@@ -4590,7 +4596,7 @@ function Ws() {
|
|
|
4590
4596
|
} finally {
|
|
4591
4597
|
i(!1);
|
|
4592
4598
|
}
|
|
4593
|
-
}, [e, u]), p =
|
|
4599
|
+
}, [e, u]), p = D(() => {
|
|
4594
4600
|
e && (e.getTracks().forEach((d) => d.stop()), t(null), s(!1));
|
|
4595
4601
|
}, [e]);
|
|
4596
4602
|
return Q(() => (u(), () => {
|
|
@@ -4609,7 +4615,7 @@ function _s(e, t = {}) {
|
|
|
4609
4615
|
const {
|
|
4610
4616
|
updateRate: n = 60,
|
|
4611
4617
|
smoothingTimeConstant: r = 0.8
|
|
4612
|
-
} = t, [a, s] = _(0), [o, i] = _(0), l =
|
|
4618
|
+
} = t, [a, s] = _(0), [o, i] = _(0), l = E(null), c = E(null), u = E(null), g = () => i(0);
|
|
4613
4619
|
return Q(() => {
|
|
4614
4620
|
if (!e) {
|
|
4615
4621
|
s(0), i(0);
|
|
@@ -4631,7 +4637,7 @@ function _s(e, t = {}) {
|
|
|
4631
4637
|
if (m - I >= h) {
|
|
4632
4638
|
I = m;
|
|
4633
4639
|
const w = l.current.getValue(), C = typeof w == "number" ? w : w[0], A = Math.max(0, Math.min(1, (C + 100) / 100));
|
|
4634
|
-
s(A), i((
|
|
4640
|
+
s(A), i((S) => Math.max(S, A));
|
|
4635
4641
|
}
|
|
4636
4642
|
u.current = requestAnimationFrame(v);
|
|
4637
4643
|
}
|
|
@@ -4703,7 +4709,7 @@ k.span`
|
|
|
4703
4709
|
}
|
|
4704
4710
|
}
|
|
4705
4711
|
`;
|
|
4706
|
-
k(
|
|
4712
|
+
k(Kt)`
|
|
4707
4713
|
min-width: 200px;
|
|
4708
4714
|
`;
|
|
4709
4715
|
k(Fn)`
|
|
@@ -4832,17 +4838,17 @@ function Wi(e, t, n, r = {}) {
|
|
|
4832
4838
|
peaks: w,
|
|
4833
4839
|
startRecording: C,
|
|
4834
4840
|
stopRecording: A,
|
|
4835
|
-
pauseRecording:
|
|
4836
|
-
resumeRecording:
|
|
4837
|
-
error:
|
|
4838
|
-
} =
|
|
4839
|
-
n && (i || (await
|
|
4840
|
-
}, [n, i, C]), V =
|
|
4841
|
-
const
|
|
4842
|
-
if (
|
|
4841
|
+
pauseRecording: S,
|
|
4842
|
+
resumeRecording: B,
|
|
4843
|
+
error: M
|
|
4844
|
+
} = Rs(g, o), $ = D(async () => {
|
|
4845
|
+
n && (i || (await Pt(), l(!0)), await C());
|
|
4846
|
+
}, [n, i, C]), V = D(async () => {
|
|
4847
|
+
const G = await A();
|
|
4848
|
+
if (G && n) {
|
|
4843
4849
|
const U = e.findIndex((ne) => ne.id === n);
|
|
4844
4850
|
if (U === -1) return;
|
|
4845
|
-
const z = e[U], ee = Math.floor(a *
|
|
4851
|
+
const z = e[U], ee = Math.floor(a * G.sampleRate);
|
|
4846
4852
|
let W = 0;
|
|
4847
4853
|
if (z.clips.length > 0) {
|
|
4848
4854
|
const ne = z.clips.map(
|
|
@@ -4852,12 +4858,12 @@ function Wi(e, t, n, r = {}) {
|
|
|
4852
4858
|
}
|
|
4853
4859
|
const te = Math.max(ee, W), q = {
|
|
4854
4860
|
id: `clip-${Date.now()}`,
|
|
4855
|
-
audioBuffer:
|
|
4861
|
+
audioBuffer: G,
|
|
4856
4862
|
startSample: te,
|
|
4857
|
-
durationSamples:
|
|
4863
|
+
durationSamples: G.length,
|
|
4858
4864
|
offsetSamples: 0,
|
|
4859
|
-
sampleRate:
|
|
4860
|
-
sourceDurationSamples:
|
|
4865
|
+
sampleRate: G.sampleRate,
|
|
4866
|
+
sourceDurationSamples: G.length,
|
|
4861
4867
|
gain: 1,
|
|
4862
4868
|
name: `Recording ${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`
|
|
4863
4869
|
}, le = e.map((ne, ae) => ae === U ? {
|
|
@@ -4870,10 +4876,10 @@ function Wi(e, t, n, r = {}) {
|
|
|
4870
4876
|
Q(() => {
|
|
4871
4877
|
d && p.length > 0 && c === null && u(p[0].deviceId);
|
|
4872
4878
|
}, [d, p.length]);
|
|
4873
|
-
const T =
|
|
4874
|
-
await b(void 0, s), await
|
|
4875
|
-
}, [b, s]), P =
|
|
4876
|
-
u(
|
|
4879
|
+
const T = D(async () => {
|
|
4880
|
+
await b(void 0, s), await Pt(), l(!0);
|
|
4881
|
+
}, [b, s]), P = D(async (G) => {
|
|
4882
|
+
u(G), await b(G, s), await Pt(), l(!0);
|
|
4877
4883
|
}, [b, s]);
|
|
4878
4884
|
return {
|
|
4879
4885
|
// Recording state
|
|
@@ -4882,17 +4888,17 @@ function Wi(e, t, n, r = {}) {
|
|
|
4882
4888
|
duration: m,
|
|
4883
4889
|
level: f,
|
|
4884
4890
|
peakLevel: h,
|
|
4885
|
-
error: y ||
|
|
4891
|
+
error: y || M,
|
|
4886
4892
|
// Microphone state
|
|
4887
4893
|
stream: g,
|
|
4888
4894
|
devices: p,
|
|
4889
4895
|
hasPermission: d,
|
|
4890
4896
|
selectedDevice: c,
|
|
4891
4897
|
// Recording controls
|
|
4892
|
-
startRecording:
|
|
4898
|
+
startRecording: $,
|
|
4893
4899
|
stopRecording: V,
|
|
4894
|
-
pauseRecording:
|
|
4895
|
-
resumeRecording:
|
|
4900
|
+
pauseRecording: S,
|
|
4901
|
+
resumeRecording: B,
|
|
4896
4902
|
requestMicAccess: T,
|
|
4897
4903
|
changeDevice: P,
|
|
4898
4904
|
// Track state
|
|
@@ -5213,9 +5219,9 @@ function Zi(e) {
|
|
|
5213
5219
|
};
|
|
5214
5220
|
}
|
|
5215
5221
|
function Vi(e = 256) {
|
|
5216
|
-
const [t, n] = _([]), r =
|
|
5222
|
+
const [t, n] = _([]), r = E(t);
|
|
5217
5223
|
r.current = t;
|
|
5218
|
-
const a =
|
|
5224
|
+
const a = E(/* @__PURE__ */ new Map()), s = E(null), o = E(null), i = D((f) => {
|
|
5219
5225
|
const h = o.current;
|
|
5220
5226
|
if (!h) return;
|
|
5221
5227
|
const { masterGainNode: I, destination: v, analyserNode: m } = h;
|
|
@@ -5236,7 +5242,7 @@ function Vi(e = 256) {
|
|
|
5236
5242
|
C.connect(A.effect), C = A.effect;
|
|
5237
5243
|
}), C.connect(m), m.connect(v);
|
|
5238
5244
|
}
|
|
5239
|
-
}, []), l =
|
|
5245
|
+
}, []), l = D((f) => {
|
|
5240
5246
|
const h = sr(f);
|
|
5241
5247
|
if (!h) {
|
|
5242
5248
|
console.error(`Unknown effect: ${f}`);
|
|
@@ -5256,10 +5262,10 @@ function Vi(e = 256) {
|
|
|
5256
5262
|
bypassed: !1
|
|
5257
5263
|
};
|
|
5258
5264
|
n((w) => [...w, m]);
|
|
5259
|
-
}, []), c =
|
|
5265
|
+
}, []), c = D((f) => {
|
|
5260
5266
|
const h = a.current.get(f);
|
|
5261
5267
|
h && (h.dispose(), a.current.delete(f)), n((I) => I.filter((v) => v.instanceId !== f));
|
|
5262
|
-
}, []), u =
|
|
5268
|
+
}, []), u = D(
|
|
5263
5269
|
(f, h, I) => {
|
|
5264
5270
|
const v = a.current.get(f);
|
|
5265
5271
|
v && v.setParameter(h, I), n(
|
|
@@ -5269,7 +5275,7 @@ function Vi(e = 256) {
|
|
|
5269
5275
|
);
|
|
5270
5276
|
},
|
|
5271
5277
|
[]
|
|
5272
|
-
), g =
|
|
5278
|
+
), g = D(
|
|
5273
5279
|
(f) => {
|
|
5274
5280
|
const h = r.current.find((m) => m.instanceId === f);
|
|
5275
5281
|
if (!h) return;
|
|
@@ -5285,20 +5291,20 @@ function Vi(e = 256) {
|
|
|
5285
5291
|
);
|
|
5286
5292
|
},
|
|
5287
5293
|
[]
|
|
5288
|
-
), p =
|
|
5294
|
+
), p = D((f, h) => {
|
|
5289
5295
|
n((I) => {
|
|
5290
5296
|
const v = [...I], [m] = v.splice(f, 1);
|
|
5291
5297
|
return v.splice(h, 0, m), v;
|
|
5292
5298
|
});
|
|
5293
|
-
}, []), d =
|
|
5299
|
+
}, []), d = D(() => {
|
|
5294
5300
|
a.current.forEach((f) => f.dispose()), a.current.clear(), n([]);
|
|
5295
5301
|
}, []);
|
|
5296
5302
|
Q(() => {
|
|
5297
5303
|
i(t);
|
|
5298
5304
|
}, [t, i]);
|
|
5299
|
-
const b =
|
|
5305
|
+
const b = D(
|
|
5300
5306
|
(f, h, I) => {
|
|
5301
|
-
const v = new
|
|
5307
|
+
const v = new Dn("fft", e);
|
|
5302
5308
|
s.current = v, o.current = {
|
|
5303
5309
|
masterGainNode: f,
|
|
5304
5310
|
destination: h,
|
|
@@ -5323,7 +5329,7 @@ function Vi(e = 256) {
|
|
|
5323
5329
|
Q(() => () => {
|
|
5324
5330
|
a.current.forEach((f) => f.dispose()), a.current.clear();
|
|
5325
5331
|
}, []);
|
|
5326
|
-
const y =
|
|
5332
|
+
const y = D(() => {
|
|
5327
5333
|
const f = t.filter((h) => !h.bypassed);
|
|
5328
5334
|
if (f.length !== 0)
|
|
5329
5335
|
return (h, I, v) => {
|
|
@@ -5362,7 +5368,7 @@ function Vi(e = 256) {
|
|
|
5362
5368
|
function Pi() {
|
|
5363
5369
|
const [e, t] = _(
|
|
5364
5370
|
/* @__PURE__ */ new Map()
|
|
5365
|
-
), n =
|
|
5371
|
+
), n = E(/* @__PURE__ */ new Map()), r = E(/* @__PURE__ */ new Map()), a = D((d, b) => {
|
|
5366
5372
|
const y = r.current.get(d);
|
|
5367
5373
|
if (!y) return;
|
|
5368
5374
|
const { graphEnd: f, masterGainNode: h } = y, I = n.current.get(d);
|
|
@@ -5383,7 +5389,7 @@ function Pi() {
|
|
|
5383
5389
|
m.connect(w.effect), m = w.effect;
|
|
5384
5390
|
}), m.connect(h);
|
|
5385
5391
|
}
|
|
5386
|
-
}, []), s =
|
|
5392
|
+
}, []), s = D((d, b) => {
|
|
5387
5393
|
const y = sr(b);
|
|
5388
5394
|
if (!y) {
|
|
5389
5395
|
console.error(`Unknown effect: ${b}`);
|
|
@@ -5406,13 +5412,13 @@ function Pi() {
|
|
|
5406
5412
|
const m = new Map(v), w = m.get(d) || [];
|
|
5407
5413
|
return m.set(d, [...w, I]), m;
|
|
5408
5414
|
});
|
|
5409
|
-
}, []), o =
|
|
5415
|
+
}, []), o = D((d, b) => {
|
|
5410
5416
|
const y = n.current.get(d), f = y?.get(b);
|
|
5411
5417
|
f && (f.dispose(), y?.delete(b)), t((h) => {
|
|
5412
5418
|
const I = new Map(h), v = I.get(d) || [];
|
|
5413
5419
|
return I.set(d, v.filter((m) => m.instanceId !== b)), I;
|
|
5414
5420
|
});
|
|
5415
|
-
}, []), i =
|
|
5421
|
+
}, []), i = D(
|
|
5416
5422
|
(d, b, y, f) => {
|
|
5417
5423
|
const I = n.current.get(d)?.get(b);
|
|
5418
5424
|
I && I.setParameter(y, f), t((v) => {
|
|
@@ -5426,7 +5432,7 @@ function Pi() {
|
|
|
5426
5432
|
});
|
|
5427
5433
|
},
|
|
5428
5434
|
[]
|
|
5429
|
-
), l =
|
|
5435
|
+
), l = D(
|
|
5430
5436
|
(d, b) => {
|
|
5431
5437
|
const f = (u.current.get(d) || []).find((m) => m.instanceId === b);
|
|
5432
5438
|
if (!f) return;
|
|
@@ -5446,15 +5452,15 @@ function Pi() {
|
|
|
5446
5452
|
});
|
|
5447
5453
|
},
|
|
5448
5454
|
[]
|
|
5449
|
-
), c =
|
|
5455
|
+
), c = D((d) => {
|
|
5450
5456
|
const b = n.current.get(d);
|
|
5451
5457
|
b && (b.forEach((y) => y.dispose()), b.clear()), t((y) => {
|
|
5452
5458
|
const f = new Map(y);
|
|
5453
5459
|
return f.set(d, []), f;
|
|
5454
5460
|
});
|
|
5455
|
-
}, []), u =
|
|
5461
|
+
}, []), u = E(e);
|
|
5456
5462
|
u.current = e;
|
|
5457
|
-
const g =
|
|
5463
|
+
const g = D(
|
|
5458
5464
|
(d) => (b, y, f) => {
|
|
5459
5465
|
r.current.set(d, {
|
|
5460
5466
|
graphEnd: b,
|
|
@@ -5485,7 +5491,7 @@ function Pi() {
|
|
|
5485
5491
|
d.forEach((b) => b.dispose()), d.clear();
|
|
5486
5492
|
}), n.current.clear();
|
|
5487
5493
|
}, []);
|
|
5488
|
-
const p =
|
|
5494
|
+
const p = D(
|
|
5489
5495
|
(d) => {
|
|
5490
5496
|
const y = (e.get(d) || []).filter((f) => !f.bypassed);
|
|
5491
5497
|
if (y.length !== 0)
|
|
@@ -5552,7 +5558,7 @@ function Ys(e, t) {
|
|
|
5552
5558
|
function Os() {
|
|
5553
5559
|
const [e, t] = _(!1), [n, r] = _(0), [a, s] = _(null);
|
|
5554
5560
|
return {
|
|
5555
|
-
exportWav:
|
|
5561
|
+
exportWav: D(async (i, l, c = {}) => {
|
|
5556
5562
|
const {
|
|
5557
5563
|
filename: u = "export",
|
|
5558
5564
|
mode: g = "master",
|
|
@@ -5572,16 +5578,16 @@ function Os() {
|
|
|
5572
5578
|
throw new Error("Invalid track index for individual export");
|
|
5573
5579
|
const v = i[0].clips[0]?.sampleRate || 44100;
|
|
5574
5580
|
let m = 0;
|
|
5575
|
-
for (const
|
|
5576
|
-
for (const V of
|
|
5581
|
+
for (const $ of i)
|
|
5582
|
+
for (const V of $.clips) {
|
|
5577
5583
|
const T = V.startSample + V.durationSamples;
|
|
5578
5584
|
m = Math.max(m, T);
|
|
5579
5585
|
}
|
|
5580
5586
|
m += Math.round(v * 0.1);
|
|
5581
|
-
const w = m / v, C = g === "individual" ? [{ track: i[p], state: l[p], index: p }] : i.map((
|
|
5582
|
-
let
|
|
5583
|
-
if ((y ||
|
|
5584
|
-
|
|
5587
|
+
const w = m / v, C = g === "individual" ? [{ track: i[p], state: l[p], index: p }] : i.map(($, V) => ({ track: $, state: l[V], index: V })), A = l.some(($) => $.soloed), S = !!f;
|
|
5588
|
+
let B;
|
|
5589
|
+
if ((y || S) && b)
|
|
5590
|
+
B = await Ks(
|
|
5585
5591
|
C,
|
|
5586
5592
|
l,
|
|
5587
5593
|
A,
|
|
@@ -5589,32 +5595,32 @@ function Os() {
|
|
|
5589
5595
|
v,
|
|
5590
5596
|
y,
|
|
5591
5597
|
f,
|
|
5592
|
-
(
|
|
5593
|
-
r(
|
|
5598
|
+
($) => {
|
|
5599
|
+
r($), I?.($);
|
|
5594
5600
|
}
|
|
5595
5601
|
);
|
|
5596
5602
|
else {
|
|
5597
|
-
const
|
|
5603
|
+
const $ = new OfflineAudioContext(2, m, v);
|
|
5598
5604
|
let V = 0;
|
|
5599
|
-
const T = C.reduce((P, { track:
|
|
5600
|
-
for (const { track: P, state:
|
|
5601
|
-
if (!(
|
|
5605
|
+
const T = C.reduce((P, { track: G }) => P + G.clips.length, 0);
|
|
5606
|
+
for (const { track: P, state: G } of C)
|
|
5607
|
+
if (!(G.muted && !G.soloed) && !(A && !G.soloed))
|
|
5602
5608
|
for (const U of P.clips) {
|
|
5603
|
-
await js(
|
|
5609
|
+
await js($, U, G, v, b), V++;
|
|
5604
5610
|
const z = V / T * 0.5;
|
|
5605
5611
|
r(z), I?.(z);
|
|
5606
5612
|
}
|
|
5607
|
-
r(0.5), I?.(0.5),
|
|
5613
|
+
r(0.5), I?.(0.5), B = await $.startRendering();
|
|
5608
5614
|
}
|
|
5609
5615
|
r(0.9), I?.(0.9);
|
|
5610
|
-
const
|
|
5616
|
+
const M = Ls(B, { bitDepth: h });
|
|
5611
5617
|
if (r(1), I?.(1), d) {
|
|
5612
|
-
const
|
|
5613
|
-
Ys(
|
|
5618
|
+
const $ = g === "individual" ? `${u}_${i[p].name}` : u;
|
|
5619
|
+
Ys(M, `${$}.wav`);
|
|
5614
5620
|
}
|
|
5615
5621
|
return {
|
|
5616
|
-
audioBuffer:
|
|
5617
|
-
blob:
|
|
5622
|
+
audioBuffer: B,
|
|
5623
|
+
blob: M,
|
|
5618
5624
|
duration: w
|
|
5619
5625
|
};
|
|
5620
5626
|
} catch (v) {
|
|
@@ -5641,12 +5647,12 @@ async function Ks(e, t, n, r, a, s, o, i) {
|
|
|
5641
5647
|
s ? I = s(h, f, !0) : h.connect(f);
|
|
5642
5648
|
for (const { track: v, state: m } of e) {
|
|
5643
5649
|
if (m.muted && !m.soloed || n && !m.soloed) continue;
|
|
5644
|
-
const w = new c(Us(m.volume)), C = new g(m.pan), A = new u(m.muted ? 0 : 1),
|
|
5645
|
-
|
|
5646
|
-
for (const
|
|
5647
|
-
const { audioBuffer:
|
|
5648
|
-
if (q.connect(le), le.connect(w),
|
|
5649
|
-
const ne = z, ae = z +
|
|
5650
|
+
const w = new c(Us(m.volume)), C = new g(m.pan), A = new u(m.muted ? 0 : 1), S = o?.(v.id);
|
|
5651
|
+
S ? S(A, h, !0) : A.connect(h), C.connect(A), w.connect(C);
|
|
5652
|
+
for (const B of v.clips) {
|
|
5653
|
+
const { audioBuffer: M, startSample: $, durationSamples: V, offsetSamples: T, gain: P, fadeIn: G, fadeOut: U } = B, z = $ / a, ee = V / a, W = T / a, te = new d(M), q = new p(te), le = new u(P);
|
|
5654
|
+
if (q.connect(le), le.connect(w), G) {
|
|
5655
|
+
const ne = z, ae = z + G.duration, ge = le.gain._param;
|
|
5650
5656
|
ge.setValueAtTime(0, ne), ge.linearRampToValueAtTime(P, ae);
|
|
5651
5657
|
}
|
|
5652
5658
|
if (U) {
|
|
@@ -5745,20 +5751,20 @@ const ir = ke(null), lr = ke(null), cr = ke(null), ur = ke(null), dr = ke(null),
|
|
|
5745
5751
|
progressBarWidth: f,
|
|
5746
5752
|
children: h
|
|
5747
5753
|
}) => {
|
|
5748
|
-
const I = f ?? b + y, v = Ne(() => c?.annotations ? c.annotations.map((
|
|
5754
|
+
const I = f ?? b + y, v = Ne(() => c?.annotations ? c.annotations.map((R) => typeof R.start == "number" ? R : tr(R)) : [], [c?.annotations]), m = E(v);
|
|
5749
5755
|
m.current = v;
|
|
5750
|
-
const [w, C] = _(null), [A,
|
|
5751
|
-
ie.current =
|
|
5752
|
-
}, []), it =
|
|
5753
|
-
me.current =
|
|
5754
|
-
}, []), yr =
|
|
5755
|
-
Me.current =
|
|
5756
|
-
}, []), ft =
|
|
5757
|
-
|
|
5758
|
-
}, []), Cr =
|
|
5759
|
-
const
|
|
5760
|
-
|
|
5761
|
-
}, [ft]), xr =
|
|
5756
|
+
const [w, C] = _(null), [A, S] = _(!1), [B, M] = _(0), [$, V] = _(0), [T, P] = _([]), [G, U] = _([]), [z, ee] = _([]), [W, te] = _(0), [q, le] = _(0), [ne, ae] = _(null), [ge, Pe] = _(o), [H, j] = _(c?.isContinuousPlay ?? !1), [oe, ce] = _(c?.linkEndpoints ?? !1), [fe, J] = _(c?.editable ?? !1), [$e, Ye] = _(!1), [Ge, rt] = _(0), [Oe, je] = _(0), [dt, at] = _(!1), F = E(null), xe = E(0), be = E(0), he = E(null), ot = E(z), N = E(0), se = E(0), Te = E(null), Z = E(null), L = E(!1), ie = E(c?.isContinuousPlay ?? !1), me = E(null), ve = E(a), Me = E(!1), de = E(0), Xe = E(0), De = E(0), ze = E(0), { timeFormat: Ke, setTimeFormat: st, formatTime: mt } = xs(), Je = As({ initialSamplesPerPixel: a, zoomLevels: s }), Qe = Je.samplesPerPixel, { masterVolume: br, setMasterVolume: vr } = ks({ playoutRef: F, initialVolume: 1 }), wr = D((R) => {
|
|
5757
|
+
ie.current = R, j(R);
|
|
5758
|
+
}, []), it = D((R) => {
|
|
5759
|
+
me.current = R, C(R);
|
|
5760
|
+
}, []), yr = D((R) => {
|
|
5761
|
+
Me.current = R, Ye(R);
|
|
5762
|
+
}, []), ft = D((R, X) => {
|
|
5763
|
+
De.current = R, ze.current = X, rt(R), je(X);
|
|
5764
|
+
}, []), Cr = D(() => {
|
|
5765
|
+
const R = de.current, X = Xe.current;
|
|
5766
|
+
R !== X && X > R && ft(R, X);
|
|
5767
|
+
}, [ft]), xr = D(() => {
|
|
5762
5768
|
ft(0, 0);
|
|
5763
5769
|
}, [ft]);
|
|
5764
5770
|
Q(() => {
|
|
@@ -5769,19 +5775,19 @@ const ir = ke(null), lr = ke(null), cr = ke(null), ur = ke(null), dr = ke(null),
|
|
|
5769
5775
|
de.current = W, Xe.current = q;
|
|
5770
5776
|
}, [W, q]), Q(() => {
|
|
5771
5777
|
if (!Z.current || !T.length) return;
|
|
5772
|
-
const
|
|
5773
|
-
if (
|
|
5774
|
-
const ue = l.show ? l.width : 0, O =
|
|
5775
|
-
|
|
5778
|
+
const R = Z.current, X = ve.current, K = Qe;
|
|
5779
|
+
if (X === K) return;
|
|
5780
|
+
const ue = l.show ? l.width : 0, O = R.clientWidth, ye = R.scrollLeft + O / 2 - ue, Ue = T[0].sampleRate, Ce = ye * X / Ue * Ue / K, Ee = Math.max(0, Ce + ue - O / 2);
|
|
5781
|
+
R.scrollLeft = Ee, ve.current = K;
|
|
5776
5782
|
}, [Qe, T, l]);
|
|
5777
|
-
const wt =
|
|
5783
|
+
const wt = E(null);
|
|
5778
5784
|
Q(() => {
|
|
5779
5785
|
if (at(!1), e.length === 0) {
|
|
5780
5786
|
P([]), V(0), ee([]), U([]), F.current && (F.current.dispose(), F.current = null);
|
|
5781
5787
|
return;
|
|
5782
5788
|
}
|
|
5783
|
-
const
|
|
5784
|
-
return F.current &&
|
|
5789
|
+
const R = A, X = be.current;
|
|
5790
|
+
return F.current && R && (F.current.stop(), he.current && (cancelAnimationFrame(he.current), he.current = null), wt.current = { position: X }), (async () => {
|
|
5785
5791
|
try {
|
|
5786
5792
|
const ue = [];
|
|
5787
5793
|
e.forEach((we) => {
|
|
@@ -5790,12 +5796,12 @@ const ir = ke(null), lr = ke(null), cr = ke(null), ur = ke(null), dr = ke(null),
|
|
|
5790
5796
|
let O = 0;
|
|
5791
5797
|
e.forEach((we) => {
|
|
5792
5798
|
we.clips.forEach((Ce) => {
|
|
5793
|
-
const
|
|
5799
|
+
const Ee = Ce.sampleRate, yt = (Ce.startSample + Ce.durationSamples) / Ee;
|
|
5794
5800
|
O = Math.max(O, yt);
|
|
5795
5801
|
});
|
|
5796
|
-
}), P(ue), V(O), ee((we) => we.length === e.length ? we.map((Ce,
|
|
5802
|
+
}), P(ue), V(O), ee((we) => we.length === e.length ? we.map((Ce, Ee) => ({
|
|
5797
5803
|
...Ce,
|
|
5798
|
-
name: e[
|
|
5804
|
+
name: e[Ee].name
|
|
5799
5805
|
})) : e.map((Ce) => ({
|
|
5800
5806
|
name: Ce.name,
|
|
5801
5807
|
muted: Ce.muted,
|
|
@@ -5807,9 +5813,9 @@ const ir = ke(null), lr = ke(null), cr = ke(null), ur = ke(null), dr = ke(null),
|
|
|
5807
5813
|
effects: u
|
|
5808
5814
|
}), ye = ot.current;
|
|
5809
5815
|
e.forEach((we, Ce) => {
|
|
5810
|
-
const
|
|
5811
|
-
if (
|
|
5812
|
-
const et =
|
|
5816
|
+
const Ee = we.clips.filter((et) => et.audioBuffer);
|
|
5817
|
+
if (Ee.length > 0) {
|
|
5818
|
+
const et = Ee[0].sampleRate, yt = Math.min(...Ee.map((Re) => Re.startSample / et)), Zr = Math.max(...Ee.map((Re) => (Re.startSample + Re.durationSamples) / et)), Ct = ye[Ce], Vr = {
|
|
5813
5819
|
id: `track-${Ce}`,
|
|
5814
5820
|
// Use consistent index-based ID for track controls
|
|
5815
5821
|
name: we.name,
|
|
@@ -5819,18 +5825,18 @@ const ir = ke(null), lr = ke(null), cr = ke(null), ur = ke(null), dr = ke(null),
|
|
|
5819
5825
|
stereoPan: Ct?.pan ?? we.pan,
|
|
5820
5826
|
startTime: yt,
|
|
5821
5827
|
endTime: Zr
|
|
5822
|
-
}, Pr =
|
|
5823
|
-
const
|
|
5828
|
+
}, Pr = Ee.map((Re) => {
|
|
5829
|
+
const Zt = Re.sampleRate;
|
|
5824
5830
|
return {
|
|
5825
|
-
buffer:
|
|
5831
|
+
buffer: Re.audioBuffer,
|
|
5826
5832
|
// We filtered for audioBuffer above
|
|
5827
|
-
startTime:
|
|
5833
|
+
startTime: Re.startSample / Zt - yt,
|
|
5828
5834
|
// Make relative to track start
|
|
5829
|
-
duration:
|
|
5830
|
-
offset:
|
|
5831
|
-
fadeIn:
|
|
5832
|
-
fadeOut:
|
|
5833
|
-
gain:
|
|
5835
|
+
duration: Re.durationSamples / Zt,
|
|
5836
|
+
offset: Re.offsetSamples / Zt,
|
|
5837
|
+
fadeIn: Re.fadeIn,
|
|
5838
|
+
fadeOut: Re.fadeOut,
|
|
5839
|
+
gain: Re.gain
|
|
5834
5840
|
};
|
|
5835
5841
|
});
|
|
5836
5842
|
Ie.addTrack({
|
|
@@ -5856,7 +5862,7 @@ const ir = ke(null), lr = ke(null), cr = ke(null), ur = ke(null), dr = ke(null),
|
|
|
5856
5862
|
};
|
|
5857
5863
|
}, [e, g, A]), Q(() => {
|
|
5858
5864
|
if (e.length === 0) return;
|
|
5859
|
-
const
|
|
5865
|
+
const R = 16, X = e.map((K) => K.clips.map((O) => {
|
|
5860
5866
|
if (O.waveformData) {
|
|
5861
5867
|
const ye = er(
|
|
5862
5868
|
O.waveformData,
|
|
@@ -5889,7 +5895,7 @@ const ir = ke(null), lr = ke(null), cr = ke(null), ur = ke(null), dr = ke(null),
|
|
|
5889
5895
|
peaks: {
|
|
5890
5896
|
length: 0,
|
|
5891
5897
|
data: [],
|
|
5892
|
-
bits:
|
|
5898
|
+
bits: R
|
|
5893
5899
|
},
|
|
5894
5900
|
startSample: O.startSample,
|
|
5895
5901
|
durationSamples: O.durationSamples,
|
|
@@ -5900,7 +5906,7 @@ const ir = ke(null), lr = ke(null), cr = ke(null), ur = ke(null), dr = ke(null),
|
|
|
5900
5906
|
O.audioBuffer,
|
|
5901
5907
|
Qe,
|
|
5902
5908
|
n,
|
|
5903
|
-
|
|
5909
|
+
R,
|
|
5904
5910
|
O.offsetSamples,
|
|
5905
5911
|
O.durationSamples
|
|
5906
5912
|
);
|
|
@@ -5914,13 +5920,13 @@ const ir = ke(null), lr = ke(null), cr = ke(null), ur = ke(null), dr = ke(null),
|
|
|
5914
5920
|
fadeOut: O.fadeOut
|
|
5915
5921
|
};
|
|
5916
5922
|
}));
|
|
5917
|
-
U(
|
|
5923
|
+
U(X);
|
|
5918
5924
|
}, [e, Qe, n]);
|
|
5919
|
-
const qe =
|
|
5925
|
+
const qe = D(() => {
|
|
5920
5926
|
he.current && (cancelAnimationFrame(he.current), he.current = null);
|
|
5921
|
-
const
|
|
5922
|
-
const
|
|
5923
|
-
be.current = K,
|
|
5927
|
+
const R = () => {
|
|
5928
|
+
const X = Ae().currentTime - N.current, K = se.current + X;
|
|
5929
|
+
be.current = K, M(K);
|
|
5924
5930
|
const ue = m.current;
|
|
5925
5931
|
if (ue.length > 0) {
|
|
5926
5932
|
const Ie = ue.find(
|
|
@@ -5931,121 +5937,127 @@ const ir = ke(null), lr = ke(null), cr = ke(null), ur = ke(null), dr = ke(null),
|
|
|
5931
5937
|
else if (me.current) {
|
|
5932
5938
|
const ye = ue.find((Ue) => Ue.id === me.current);
|
|
5933
5939
|
if (ye && K >= ye.end) {
|
|
5934
|
-
F.current && F.current.stop(),
|
|
5940
|
+
F.current && F.current.stop(), S(!1), be.current = xe.current, M(xe.current);
|
|
5935
5941
|
return;
|
|
5936
5942
|
}
|
|
5937
5943
|
} else
|
|
5938
5944
|
Ie && it(Ie.id);
|
|
5939
5945
|
}
|
|
5940
5946
|
if (L.current && Z.current && T.length > 0) {
|
|
5941
|
-
const Ie = Z.current, ye = T[0].sampleRate, Ue = K * ye / ve.current, we = Ie.clientWidth, Ce = l.show ? l.width : 0,
|
|
5947
|
+
const Ie = Z.current, ye = T[0].sampleRate, Ue = K * ye / ve.current, we = Ie.clientWidth, Ce = l.show ? l.width : 0, Ee = Ue + Ce, et = Math.max(0, Ee - we / 2);
|
|
5942
5948
|
Ie.scrollLeft = et;
|
|
5943
5949
|
}
|
|
5944
5950
|
if (Te.current !== null && K >= Te.current) {
|
|
5945
|
-
F.current && F.current.stop(),
|
|
5951
|
+
F.current && F.current.stop(), S(!1), be.current = Te.current, M(Te.current), Te.current = null;
|
|
5946
5952
|
return;
|
|
5947
5953
|
}
|
|
5948
|
-
const O =
|
|
5954
|
+
const O = De.current !== ze.current && ze.current > De.current;
|
|
5949
5955
|
if (Me.current && O && K >= ze.current) {
|
|
5950
5956
|
F.current?.stop();
|
|
5951
5957
|
const ye = Ae().currentTime;
|
|
5952
|
-
N.current = ye, se.current =
|
|
5958
|
+
N.current = ye, se.current = De.current, be.current = De.current, F.current?.play(ye, De.current), he.current = requestAnimationFrame(R);
|
|
5953
5959
|
return;
|
|
5954
5960
|
}
|
|
5955
|
-
if (K >=
|
|
5956
|
-
F.current && F.current.stop(),
|
|
5961
|
+
if (K >= $) {
|
|
5962
|
+
F.current && F.current.stop(), S(!1), be.current = xe.current, M(xe.current), it(null);
|
|
5957
5963
|
return;
|
|
5958
5964
|
}
|
|
5959
|
-
he.current = requestAnimationFrame(
|
|
5965
|
+
he.current = requestAnimationFrame(R);
|
|
5960
5966
|
};
|
|
5961
|
-
he.current = requestAnimationFrame(
|
|
5962
|
-
}, [
|
|
5967
|
+
he.current = requestAnimationFrame(R);
|
|
5968
|
+
}, [$, T, Qe, H]), He = D(() => {
|
|
5963
5969
|
he.current && (cancelAnimationFrame(he.current), he.current = null);
|
|
5964
5970
|
}, []);
|
|
5965
5971
|
Q(() => {
|
|
5966
5972
|
(async () => {
|
|
5967
5973
|
if (A && he.current && F.current)
|
|
5968
|
-
if (
|
|
5969
|
-
const
|
|
5974
|
+
if (H) {
|
|
5975
|
+
const X = be.current;
|
|
5970
5976
|
F.current.stop(), He(), await F.current.init(), F.current.setOnPlaybackComplete(() => {
|
|
5971
5977
|
});
|
|
5972
5978
|
const ue = Ae().currentTime;
|
|
5973
|
-
N.current = ue, se.current =
|
|
5979
|
+
N.current = ue, se.current = X, F.current.play(ue, X), qe();
|
|
5974
5980
|
} else
|
|
5975
5981
|
He(), qe();
|
|
5976
5982
|
})();
|
|
5977
|
-
}, [
|
|
5983
|
+
}, [H, A, qe, He]), Q(() => {
|
|
5978
5984
|
(async () => {
|
|
5979
5985
|
if (wt.current && F.current) {
|
|
5980
|
-
const { position:
|
|
5986
|
+
const { position: X } = wt.current;
|
|
5981
5987
|
wt.current = null, await F.current.init(), F.current.setOnPlaybackComplete(() => {
|
|
5982
5988
|
});
|
|
5983
5989
|
const ue = Ae().currentTime;
|
|
5984
|
-
N.current = ue, se.current =
|
|
5990
|
+
N.current = ue, se.current = X, F.current.play(ue, X), S(!0), qe();
|
|
5985
5991
|
}
|
|
5986
5992
|
})();
|
|
5987
5993
|
}, [e, qe]);
|
|
5988
|
-
const _t =
|
|
5994
|
+
const _t = D(async (R, X) => {
|
|
5989
5995
|
if (!F.current || T.length === 0) return;
|
|
5990
5996
|
await F.current.init(), await Mn();
|
|
5991
|
-
const K =
|
|
5997
|
+
const K = R ?? be.current;
|
|
5992
5998
|
xe.current = K, be.current = K, F.current.setOnPlaybackComplete(() => {
|
|
5993
5999
|
}), F.current.stop(), He();
|
|
5994
6000
|
const O = Ae().currentTime;
|
|
5995
|
-
N.current = O, se.current = K, Te.current =
|
|
5996
|
-
}, [T.length, qe, He]), Ir =
|
|
6001
|
+
N.current = O, se.current = K, Te.current = X !== void 0 ? K + X : null, F.current.play(O, K, X), S(!0), qe();
|
|
6002
|
+
}, [T.length, qe, He]), Ir = D(() => {
|
|
5997
6003
|
if (!F.current) return;
|
|
5998
|
-
const
|
|
5999
|
-
F.current.pause(),
|
|
6000
|
-
}, [He]), Ar =
|
|
6001
|
-
F.current && (F.current.stop(),
|
|
6002
|
-
}, [He]), kr =
|
|
6003
|
-
const
|
|
6004
|
-
be.current =
|
|
6005
|
-
}, [
|
|
6004
|
+
const R = Ae().currentTime - N.current, X = se.current + R;
|
|
6005
|
+
F.current.pause(), S(!1), He(), be.current = X, M(X);
|
|
6006
|
+
}, [He]), Ar = D(() => {
|
|
6007
|
+
F.current && (F.current.stop(), S(!1), He(), be.current = xe.current, M(xe.current), it(null));
|
|
6008
|
+
}, [He]), kr = D((R) => {
|
|
6009
|
+
const X = Math.max(0, Math.min(R, $));
|
|
6010
|
+
be.current = X, M(X), A && F.current && (F.current.stop(), He(), _t(X));
|
|
6011
|
+
}, [$, A, _t, He]), Sr = D((R, X) => {
|
|
6006
6012
|
const K = [...z];
|
|
6007
|
-
if (K[
|
|
6008
|
-
const ue = `track-${
|
|
6009
|
-
F.current.setMute(ue,
|
|
6013
|
+
if (K[R] = { ...K[R], muted: X }, ee(K), F.current) {
|
|
6014
|
+
const ue = `track-${R}`;
|
|
6015
|
+
F.current.setMute(ue, X);
|
|
6010
6016
|
}
|
|
6011
|
-
}, [z]), $r =
|
|
6017
|
+
}, [z]), $r = D((R, X) => {
|
|
6012
6018
|
const K = [...z];
|
|
6013
|
-
if (K[
|
|
6014
|
-
const ue = `track-${
|
|
6015
|
-
F.current.setSolo(ue,
|
|
6019
|
+
if (K[R] = { ...K[R], soloed: X }, ee(K), F.current) {
|
|
6020
|
+
const ue = `track-${R}`;
|
|
6021
|
+
F.current.setSolo(ue, X);
|
|
6016
6022
|
}
|
|
6017
|
-
}, [z]), Mr =
|
|
6023
|
+
}, [z]), Mr = D((R, X) => {
|
|
6018
6024
|
const K = [...z];
|
|
6019
|
-
if (K[
|
|
6020
|
-
const ue = `track-${
|
|
6021
|
-
O && O.setVolume(
|
|
6025
|
+
if (K[R] = { ...K[R], volume: X }, ee(K), F.current) {
|
|
6026
|
+
const ue = `track-${R}`, O = F.current.getTrack(ue);
|
|
6027
|
+
O && O.setVolume(X);
|
|
6022
6028
|
}
|
|
6023
|
-
}, [z]),
|
|
6029
|
+
}, [z]), Dr = D((R, X) => {
|
|
6024
6030
|
const K = [...z];
|
|
6025
|
-
if (K[
|
|
6026
|
-
const ue = `track-${
|
|
6027
|
-
O && O.setPan(
|
|
6031
|
+
if (K[R] = { ...K[R], pan: X }, ee(K), F.current) {
|
|
6032
|
+
const ue = `track-${R}`, O = F.current.getTrack(ue);
|
|
6033
|
+
O && O.setPan(X);
|
|
6028
6034
|
}
|
|
6029
|
-
}, [z]),
|
|
6030
|
-
te(
|
|
6031
|
-
}, [A]), Tr =
|
|
6032
|
-
Z.current =
|
|
6033
|
-
}, []),
|
|
6034
|
-
|
|
6035
|
-
const
|
|
6036
|
-
(
|
|
6037
|
-
const
|
|
6038
|
-
|
|
6035
|
+
}, [z]), Br = D((R, X) => {
|
|
6036
|
+
te(R), le(X), be.current = R, M(R), A && F.current && (F.current.stop(), F.current.play(Ae().currentTime, R));
|
|
6037
|
+
}, [A]), Tr = D((R) => {
|
|
6038
|
+
Z.current = R;
|
|
6039
|
+
}, []), Ft = E(d);
|
|
6040
|
+
Ft.current = d;
|
|
6041
|
+
const Er = D(
|
|
6042
|
+
(R) => {
|
|
6043
|
+
const X = typeof R == "function" ? R(m.current) : R;
|
|
6044
|
+
if (!Ft.current) {
|
|
6045
|
+
process.env.NODE_ENV !== "production" && console.warn(
|
|
6046
|
+
"waveform-playlist: setAnnotations was called but no onAnnotationsChange callback is provided. Annotation edits will not persist. Pass onAnnotationsChange to WaveformPlaylistProvider to handle annotation updates."
|
|
6047
|
+
);
|
|
6048
|
+
return;
|
|
6049
|
+
}
|
|
6050
|
+
Ft.current(X);
|
|
6039
6051
|
},
|
|
6040
6052
|
[]
|
|
6041
|
-
),
|
|
6053
|
+
), Rr = T[0]?.sampleRate || 44100, en = t ? 30 : 0, Wr = e.length * r + en, tn = {
|
|
6042
6054
|
isPlaying: A,
|
|
6043
|
-
currentTime:
|
|
6055
|
+
currentTime: B,
|
|
6044
6056
|
currentTimeRef: be,
|
|
6045
6057
|
playbackStartTimeRef: N,
|
|
6046
6058
|
audioStartPositionRef: se
|
|
6047
6059
|
}, nn = {
|
|
6048
|
-
continuousPlay:
|
|
6060
|
+
continuousPlay: H,
|
|
6049
6061
|
linkEndpoints: oe,
|
|
6050
6062
|
annotationsEditable: fe,
|
|
6051
6063
|
isAutomaticScroll: ge,
|
|
@@ -6063,16 +6075,16 @@ const ir = ke(null), lr = ke(null), cr = ke(null), ur = ke(null), dr = ke(null),
|
|
|
6063
6075
|
pause: Ir,
|
|
6064
6076
|
stop: Ar,
|
|
6065
6077
|
seekTo: kr,
|
|
6066
|
-
setCurrentTime: (
|
|
6067
|
-
be.current =
|
|
6078
|
+
setCurrentTime: (R) => {
|
|
6079
|
+
be.current = R, M(R);
|
|
6068
6080
|
},
|
|
6069
6081
|
// Track controls
|
|
6070
6082
|
setTrackMute: Sr,
|
|
6071
6083
|
setTrackSolo: $r,
|
|
6072
6084
|
setTrackVolume: Mr,
|
|
6073
|
-
setTrackPan:
|
|
6085
|
+
setTrackPan: Dr,
|
|
6074
6086
|
// Selection
|
|
6075
|
-
setSelection:
|
|
6087
|
+
setSelection: Br,
|
|
6076
6088
|
setSelectedTrackId: ae,
|
|
6077
6089
|
// Time format
|
|
6078
6090
|
setTimeFormat: st,
|
|
@@ -6083,16 +6095,16 @@ const ir = ke(null), lr = ke(null), cr = ke(null), ur = ke(null), dr = ke(null),
|
|
|
6083
6095
|
// Master volume
|
|
6084
6096
|
setMasterVolume: vr,
|
|
6085
6097
|
// Automatic scroll
|
|
6086
|
-
setAutomaticScroll: (
|
|
6087
|
-
Pe(
|
|
6098
|
+
setAutomaticScroll: (R) => {
|
|
6099
|
+
Pe(R);
|
|
6088
6100
|
},
|
|
6089
6101
|
setScrollContainer: Tr,
|
|
6090
6102
|
scrollContainerRef: Z,
|
|
6091
6103
|
// Annotation controls
|
|
6092
6104
|
setContinuousPlay: wr,
|
|
6093
6105
|
setLinkEndpoints: ce,
|
|
6094
|
-
setAnnotationsEditable:
|
|
6095
|
-
setAnnotations:
|
|
6106
|
+
setAnnotationsEditable: J,
|
|
6107
|
+
setAnnotations: Er,
|
|
6096
6108
|
setActiveAnnotationId: it,
|
|
6097
6109
|
// Loop controls
|
|
6098
6110
|
setLoopEnabled: yr,
|
|
@@ -6100,12 +6112,12 @@ const ir = ke(null), lr = ke(null), cr = ke(null), ur = ke(null), dr = ke(null),
|
|
|
6100
6112
|
setLoopRegionFromSelection: Cr,
|
|
6101
6113
|
clearLoopRegion: xr
|
|
6102
6114
|
}, an = {
|
|
6103
|
-
duration:
|
|
6115
|
+
duration: $,
|
|
6104
6116
|
audioBuffers: T,
|
|
6105
|
-
peaksDataArray:
|
|
6117
|
+
peaksDataArray: G,
|
|
6106
6118
|
trackStates: z,
|
|
6107
6119
|
tracks: e,
|
|
6108
|
-
sampleRate:
|
|
6120
|
+
sampleRate: Rr,
|
|
6109
6121
|
waveHeight: r,
|
|
6110
6122
|
timeScaleHeight: en,
|
|
6111
6123
|
minimumPlaylistHeight: Wr,
|
|
@@ -6128,27 +6140,27 @@ const ir = ke(null), lr = ke(null), cr = ke(null), ur = ke(null), dr = ke(null),
|
|
|
6128
6140
|
}, Fr = { ...Pn, ...i };
|
|
6129
6141
|
return /* @__PURE__ */ x(Tn, { theme: Fr, children: /* @__PURE__ */ x(ir.Provider, { value: tn, children: /* @__PURE__ */ x(lr.Provider, { value: nn, children: /* @__PURE__ */ x(cr.Provider, { value: rn, children: /* @__PURE__ */ x(ur.Provider, { value: an, children: /* @__PURE__ */ x(dr.Provider, { value: _r, children: h }) }) }) }) }) });
|
|
6130
6142
|
}, _e = () => {
|
|
6131
|
-
const e =
|
|
6143
|
+
const e = Be(ir);
|
|
6132
6144
|
if (!e)
|
|
6133
6145
|
throw new Error("usePlaybackAnimation must be used within WaveformPlaylistProvider");
|
|
6134
6146
|
return e;
|
|
6135
6147
|
}, Fe = () => {
|
|
6136
|
-
const e =
|
|
6148
|
+
const e = Be(lr);
|
|
6137
6149
|
if (!e)
|
|
6138
6150
|
throw new Error("usePlaylistState must be used within WaveformPlaylistProvider");
|
|
6139
6151
|
return e;
|
|
6140
6152
|
}, pe = () => {
|
|
6141
|
-
const e =
|
|
6153
|
+
const e = Be(cr);
|
|
6142
6154
|
if (!e)
|
|
6143
6155
|
throw new Error("usePlaylistControls must be used within WaveformPlaylistProvider");
|
|
6144
6156
|
return e;
|
|
6145
6157
|
}, Se = () => {
|
|
6146
|
-
const e =
|
|
6158
|
+
const e = Be(ur);
|
|
6147
6159
|
if (!e)
|
|
6148
6160
|
throw new Error("usePlaylistData must be used within WaveformPlaylistProvider");
|
|
6149
6161
|
return e;
|
|
6150
6162
|
}, Hi = () => {
|
|
6151
|
-
const e =
|
|
6163
|
+
const e = Be(dr);
|
|
6152
6164
|
if (!e)
|
|
6153
6165
|
throw new Error("useWaveformPlaylist must be used within WaveformPlaylistProvider");
|
|
6154
6166
|
return e;
|
|
@@ -6411,21 +6423,21 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
6411
6423
|
onReady: d,
|
|
6412
6424
|
children: b
|
|
6413
6425
|
}) => {
|
|
6414
|
-
const y = g ?? c + u, [f, h] = _(!1), [I, v] = _(0), [m, w] = _(0), [C, A] = _([]), [
|
|
6415
|
-
|
|
6416
|
-
const [V, T] = _(null), [P,
|
|
6426
|
+
const y = g ?? c + u, [f, h] = _(!1), [I, v] = _(0), [m, w] = _(0), [C, A] = _([]), [S, B] = _(a), M = Ne(() => l?.annotations ? l.annotations.map((N) => typeof N.start == "number" ? N : tr(N)) : [], [l?.annotations]), $ = E(M);
|
|
6427
|
+
$.current = M;
|
|
6428
|
+
const [V, T] = _(null), [P, G] = _(
|
|
6417
6429
|
l?.isContinuousPlay ?? !1
|
|
6418
|
-
), [U] = _(t), [z, ee] = _(s), W =
|
|
6430
|
+
), [U] = _(t), [z, ee] = _(s), W = E(null), te = E(0), q = E(null), le = E(P), ne = E(null), ae = E(null), ge = E(s), Pe = E(t);
|
|
6419
6431
|
Q(() => {
|
|
6420
6432
|
le.current = P;
|
|
6421
6433
|
}, [P]), Q(() => {
|
|
6422
6434
|
ge.current = z;
|
|
6423
6435
|
}, [z]);
|
|
6424
|
-
const
|
|
6436
|
+
const H = D((N) => {
|
|
6425
6437
|
ne.current = N, T(N);
|
|
6426
|
-
}, []),
|
|
6427
|
-
le.current = N,
|
|
6428
|
-
}, []), oe =
|
|
6438
|
+
}, []), j = D((N) => {
|
|
6439
|
+
le.current = N, G(N);
|
|
6440
|
+
}, []), oe = D((N) => {
|
|
6429
6441
|
ae.current = N;
|
|
6430
6442
|
}, []), ce = e.waveformData.sample_rate;
|
|
6431
6443
|
Q(() => {
|
|
@@ -6441,7 +6453,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
6441
6453
|
return se && se.setOnTimeUpdateCallback((Te) => {
|
|
6442
6454
|
te.current = Te;
|
|
6443
6455
|
}), N.setOnPlaybackComplete(() => {
|
|
6444
|
-
q.current && (cancelAnimationFrame(q.current), q.current = null), h(!1),
|
|
6456
|
+
q.current && (cancelAnimationFrame(q.current), q.current = null), h(!1), H(null), te.current = 0, v(0);
|
|
6445
6457
|
}), W.current = N, w(e.waveformData.duration), d?.(), () => {
|
|
6446
6458
|
q.current && cancelAnimationFrame(q.current), N.dispose();
|
|
6447
6459
|
};
|
|
@@ -6468,18 +6480,18 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
6468
6480
|
};
|
|
6469
6481
|
A([[se]]);
|
|
6470
6482
|
}, [e.waveformData, e.name, U, ce]);
|
|
6471
|
-
const fe =
|
|
6483
|
+
const fe = D(() => {
|
|
6472
6484
|
q.current && cancelAnimationFrame(q.current);
|
|
6473
6485
|
const N = () => {
|
|
6474
6486
|
const se = W.current?.getCurrentTime() ?? 0;
|
|
6475
6487
|
te.current = se, v(se);
|
|
6476
|
-
const Te =
|
|
6488
|
+
const Te = $.current;
|
|
6477
6489
|
if (Te.length > 0) {
|
|
6478
6490
|
const Z = Te.find(
|
|
6479
6491
|
(L) => se >= L.start && se < L.end
|
|
6480
6492
|
);
|
|
6481
6493
|
if (le.current)
|
|
6482
|
-
Z && Z.id !== ne.current ?
|
|
6494
|
+
Z && Z.id !== ne.current ? H(Z.id) : !Z && ne.current !== null && H(null);
|
|
6483
6495
|
else if (ne.current) {
|
|
6484
6496
|
const L = Te.find(
|
|
6485
6497
|
(ie) => ie.id === ne.current
|
|
@@ -6488,7 +6500,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
6488
6500
|
W.current?.stop(), h(!1);
|
|
6489
6501
|
return;
|
|
6490
6502
|
}
|
|
6491
|
-
} else Z &&
|
|
6503
|
+
} else Z && H(Z.id);
|
|
6492
6504
|
}
|
|
6493
6505
|
if (ge.current && ae.current) {
|
|
6494
6506
|
const Z = ae.current, L = se * ce / Pe.current, ie = Z.clientWidth, me = i.show ? i.width : 0, ve = L + me, Me = Math.max(0, ve - ie / 2);
|
|
@@ -6497,28 +6509,28 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
6497
6509
|
q.current = requestAnimationFrame(N);
|
|
6498
6510
|
};
|
|
6499
6511
|
q.current = requestAnimationFrame(N);
|
|
6500
|
-
}, [
|
|
6512
|
+
}, [H, ce, i]), J = D(() => {
|
|
6501
6513
|
q.current && (cancelAnimationFrame(q.current), q.current = null);
|
|
6502
|
-
}, []), $e =
|
|
6514
|
+
}, []), $e = D(
|
|
6503
6515
|
(N) => {
|
|
6504
6516
|
if (!W.current) return;
|
|
6505
6517
|
const se = N ?? te.current;
|
|
6506
6518
|
W.current.play(void 0, se), h(!0), fe();
|
|
6507
6519
|
},
|
|
6508
6520
|
[fe]
|
|
6509
|
-
), Ye =
|
|
6510
|
-
W.current && (W.current.pause(), h(!1),
|
|
6511
|
-
}, [
|
|
6512
|
-
W.current && (W.current.stop(), h(!1),
|
|
6513
|
-
}, [
|
|
6521
|
+
), Ye = D(() => {
|
|
6522
|
+
W.current && (W.current.pause(), h(!1), J(), v(W.current.getCurrentTime()));
|
|
6523
|
+
}, [J]), Ge = D(() => {
|
|
6524
|
+
W.current && (W.current.stop(), h(!1), J(), te.current = 0, v(0), H(null));
|
|
6525
|
+
}, [J, H]), rt = D(
|
|
6514
6526
|
(N) => {
|
|
6515
6527
|
const se = Math.max(0, Math.min(N, m));
|
|
6516
6528
|
te.current = se, v(se), W.current && W.current.seekTo(se);
|
|
6517
6529
|
},
|
|
6518
6530
|
[m]
|
|
6519
|
-
), Oe =
|
|
6531
|
+
), Oe = D((N) => {
|
|
6520
6532
|
const se = Math.max(0.5, Math.min(2, N));
|
|
6521
|
-
|
|
6533
|
+
B(se), W.current && W.current.setPlaybackRate(se);
|
|
6522
6534
|
}, []), je = r ? 30 : 0, dt = Ne(
|
|
6523
6535
|
() => ({
|
|
6524
6536
|
isPlaying: f,
|
|
@@ -6529,18 +6541,24 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
6529
6541
|
), at = Ne(
|
|
6530
6542
|
() => ({
|
|
6531
6543
|
continuousPlay: P,
|
|
6532
|
-
annotations:
|
|
6544
|
+
annotations: M,
|
|
6533
6545
|
activeAnnotationId: V,
|
|
6534
|
-
playbackRate:
|
|
6546
|
+
playbackRate: S,
|
|
6535
6547
|
isAutomaticScroll: z
|
|
6536
6548
|
}),
|
|
6537
|
-
[P,
|
|
6538
|
-
), F =
|
|
6549
|
+
[P, M, V, S, z]
|
|
6550
|
+
), F = E(p);
|
|
6539
6551
|
F.current = p;
|
|
6540
|
-
const xe =
|
|
6552
|
+
const xe = D(
|
|
6541
6553
|
(N) => {
|
|
6542
|
-
const se = typeof N == "function" ? N(
|
|
6543
|
-
F.current
|
|
6554
|
+
const se = typeof N == "function" ? N($.current) : N;
|
|
6555
|
+
if (!F.current) {
|
|
6556
|
+
process.env.NODE_ENV !== "production" && console.warn(
|
|
6557
|
+
"waveform-playlist: setAnnotations was called but no onAnnotationsChange callback is provided. Annotation edits will not persist. Pass onAnnotationsChange to MediaElementPlaylistProvider to handle annotation updates."
|
|
6558
|
+
);
|
|
6559
|
+
return;
|
|
6560
|
+
}
|
|
6561
|
+
F.current(se);
|
|
6544
6562
|
},
|
|
6545
6563
|
[]
|
|
6546
6564
|
), be = Ne(
|
|
@@ -6550,16 +6568,16 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
6550
6568
|
stop: Ge,
|
|
6551
6569
|
seekTo: rt,
|
|
6552
6570
|
setPlaybackRate: Oe,
|
|
6553
|
-
setContinuousPlay:
|
|
6571
|
+
setContinuousPlay: j,
|
|
6554
6572
|
setAnnotations: xe,
|
|
6555
|
-
setActiveAnnotationId:
|
|
6573
|
+
setActiveAnnotationId: H,
|
|
6556
6574
|
setAutomaticScroll: (N) => {
|
|
6557
6575
|
ee(N);
|
|
6558
6576
|
},
|
|
6559
6577
|
setScrollContainer: oe,
|
|
6560
6578
|
scrollContainerRef: ae
|
|
6561
6579
|
}),
|
|
6562
|
-
[$e, Ye, Ge, rt, Oe,
|
|
6580
|
+
[$e, Ye, Ge, rt, Oe, j, xe, H, oe]
|
|
6563
6581
|
), he = Ne(
|
|
6564
6582
|
() => ({
|
|
6565
6583
|
duration: m,
|
|
@@ -6588,29 +6606,29 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
6588
6606
|
]
|
|
6589
6607
|
), ot = { ...Pn, ...o };
|
|
6590
6608
|
return /* @__PURE__ */ x(Tn, { theme: ot, children: /* @__PURE__ */ x(mr.Provider, { value: dt, children: /* @__PURE__ */ x(fr.Provider, { value: at, children: /* @__PURE__ */ x(hr.Provider, { value: be, children: /* @__PURE__ */ x(pr.Provider, { value: he, children: b }) }) }) }) });
|
|
6591
|
-
},
|
|
6592
|
-
const e =
|
|
6609
|
+
}, Jt = () => {
|
|
6610
|
+
const e = Be(mr);
|
|
6593
6611
|
if (!e)
|
|
6594
6612
|
throw new Error(
|
|
6595
6613
|
"useMediaElementAnimation must be used within MediaElementPlaylistProvider"
|
|
6596
6614
|
);
|
|
6597
6615
|
return e;
|
|
6598
|
-
},
|
|
6599
|
-
const e =
|
|
6616
|
+
}, Qt = () => {
|
|
6617
|
+
const e = Be(fr);
|
|
6600
6618
|
if (!e)
|
|
6601
6619
|
throw new Error(
|
|
6602
6620
|
"useMediaElementState must be used within MediaElementPlaylistProvider"
|
|
6603
6621
|
);
|
|
6604
6622
|
return e;
|
|
6605
6623
|
}, gr = () => {
|
|
6606
|
-
const e =
|
|
6624
|
+
const e = Be(hr);
|
|
6607
6625
|
if (!e)
|
|
6608
6626
|
throw new Error(
|
|
6609
6627
|
"useMediaElementControls must be used within MediaElementPlaylistProvider"
|
|
6610
6628
|
);
|
|
6611
6629
|
return e;
|
|
6612
|
-
},
|
|
6613
|
-
const e =
|
|
6630
|
+
}, qt = () => {
|
|
6631
|
+
const e = Be(pr);
|
|
6614
6632
|
if (!e)
|
|
6615
6633
|
throw new Error(
|
|
6616
6634
|
"useMediaElementData must be used within MediaElementPlaylistProvider"
|
|
@@ -6727,7 +6745,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
6727
6745
|
color: ${(e) => e.theme?.textColor || "#333"};
|
|
6728
6746
|
user-select: none;
|
|
6729
6747
|
`, nl = ({ className: e }) => {
|
|
6730
|
-
const t =
|
|
6748
|
+
const t = E(null), n = E(null), { isPlaying: r, currentTimeRef: a, playbackStartTimeRef: s, audioStartPositionRef: o } = _e(), { timeFormat: i } = Se(), l = i;
|
|
6731
6749
|
return Q(() => {
|
|
6732
6750
|
const c = () => {
|
|
6733
6751
|
if (t.current) {
|
|
@@ -6761,7 +6779,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
6761
6779
|
}, al = ({ className: e }) => {
|
|
6762
6780
|
const { isAutomaticScroll: t } = Fe(), { setAutomaticScroll: n } = pe();
|
|
6763
6781
|
return /* @__PURE__ */ x(
|
|
6764
|
-
|
|
6782
|
+
Ea,
|
|
6765
6783
|
{
|
|
6766
6784
|
checked: t,
|
|
6767
6785
|
onChange: n,
|
|
@@ -6864,7 +6882,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
6864
6882
|
color: e = "#ff0000",
|
|
6865
6883
|
controlsOffset: t = 0
|
|
6866
6884
|
}) => {
|
|
6867
|
-
const n =
|
|
6885
|
+
const n = E(null), r = E(null), { isPlaying: a, currentTimeRef: s, playbackStartTimeRef: o, audioStartPositionRef: i } = _e(), { samplesPerPixel: l, sampleRate: c, progressBarWidth: u } = Se();
|
|
6868
6886
|
return Q(() => {
|
|
6869
6887
|
const g = () => {
|
|
6870
6888
|
if (n.current) {
|
|
@@ -6919,7 +6937,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
6919
6937
|
clipDurationSamples: t,
|
|
6920
6938
|
...n
|
|
6921
6939
|
}) => {
|
|
6922
|
-
const r =
|
|
6940
|
+
const r = E(null), a = E(null), s = vt(), { waveHeight: o } = bt(), { isPlaying: i, currentTimeRef: l, playbackStartTimeRef: c, audioStartPositionRef: u } = _e(), { samplesPerPixel: g, sampleRate: p } = Se(), d = s?.waveProgressColor || "rgba(0, 0, 0, 0.1)";
|
|
6923
6941
|
Q(() => {
|
|
6924
6942
|
const h = () => {
|
|
6925
6943
|
if (r.current) {
|
|
@@ -7008,15 +7026,15 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7008
7026
|
linkEndpoints: w,
|
|
7009
7027
|
continuousPlay: C,
|
|
7010
7028
|
selectedTrackId: A,
|
|
7011
|
-
loopStart:
|
|
7012
|
-
loopEnd:
|
|
7013
|
-
isLoopEnabled:
|
|
7029
|
+
loopStart: S,
|
|
7030
|
+
loopEnd: B,
|
|
7031
|
+
isLoopEnabled: M
|
|
7014
7032
|
} = Fe(), {
|
|
7015
|
-
setAnnotations:
|
|
7033
|
+
setAnnotations: $,
|
|
7016
7034
|
setActiveAnnotationId: V,
|
|
7017
7035
|
setTrackMute: T,
|
|
7018
7036
|
setTrackSolo: P,
|
|
7019
|
-
setTrackVolume:
|
|
7037
|
+
setTrackVolume: G,
|
|
7020
7038
|
setTrackPan: U,
|
|
7021
7039
|
setSelection: z,
|
|
7022
7040
|
play: ee,
|
|
@@ -7029,79 +7047,83 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7029
7047
|
peaksDataArray: ae,
|
|
7030
7048
|
trackStates: ge,
|
|
7031
7049
|
tracks: Pe,
|
|
7032
|
-
duration:
|
|
7033
|
-
samplesPerPixel:
|
|
7050
|
+
duration: H,
|
|
7051
|
+
samplesPerPixel: j,
|
|
7034
7052
|
sampleRate: oe,
|
|
7035
7053
|
waveHeight: ce,
|
|
7036
7054
|
timeScaleHeight: fe,
|
|
7037
|
-
controls:
|
|
7055
|
+
controls: J,
|
|
7038
7056
|
playoutRef: $e,
|
|
7039
7057
|
barWidth: Ye,
|
|
7040
7058
|
barGap: Ge,
|
|
7041
7059
|
isReady: rt
|
|
7042
|
-
} = Se(), [Oe, je] = _(!1), dt =
|
|
7060
|
+
} = Se(), [Oe, je] = _(!1), dt = E(null), at = D((Z) => {
|
|
7043
7061
|
dt.current = Z, W(Z);
|
|
7044
7062
|
}, [W]);
|
|
7045
|
-
let F = ne.length > 0 ?
|
|
7063
|
+
let F = ne.length > 0 ? H : si;
|
|
7046
7064
|
if (u?.isRecording) {
|
|
7047
7065
|
const L = (u.startSample + u.durationSamples) / oe;
|
|
7048
7066
|
F = Math.max(F, L + 10);
|
|
7049
7067
|
}
|
|
7050
|
-
const xe = Math.floor(F * oe /
|
|
7051
|
-
|
|
7068
|
+
const xe = Math.floor(F * oe / j), be = async (Z) => {
|
|
7069
|
+
V(Z.id);
|
|
7052
7070
|
const L = C ? void 0 : Z.end - Z.start;
|
|
7053
|
-
|
|
7054
|
-
|
|
7071
|
+
try {
|
|
7072
|
+
await ee(Z.start, L);
|
|
7073
|
+
} catch (ie) {
|
|
7074
|
+
console.error("waveform-playlist: Failed to start playback for annotation", Z.id, ie);
|
|
7075
|
+
}
|
|
7076
|
+
}, he = D((Z) => {
|
|
7055
7077
|
if (Z >= 0 && Z < Pe.length) {
|
|
7056
7078
|
const L = Pe[Z];
|
|
7057
7079
|
te(L.id);
|
|
7058
7080
|
}
|
|
7059
7081
|
}, [Pe, te]), ot = (Z) => {
|
|
7060
|
-
const L = Z.currentTarget.getBoundingClientRect(), ie =
|
|
7061
|
-
let Xe = 0,
|
|
7082
|
+
const L = Z.currentTarget.getBoundingClientRect(), ie = J.show ? J.width : 0, ve = (Z.clientX - L.left - ie) * j / oe, de = Z.clientY - L.top;
|
|
7083
|
+
let Xe = 0, De = -1;
|
|
7062
7084
|
for (let ze = 0; ze < ae.length; ze++) {
|
|
7063
7085
|
const Ke = ae[ze], mt = (Ke.length > 0 ? Math.max(...Ke.map((Je) => Je.peaks.data.length)) : 1) * ce + (o ? 22 : 0);
|
|
7064
7086
|
if (de >= Xe && de < Xe + mt) {
|
|
7065
|
-
|
|
7087
|
+
De = ze;
|
|
7066
7088
|
break;
|
|
7067
7089
|
}
|
|
7068
7090
|
Xe += mt;
|
|
7069
7091
|
}
|
|
7070
|
-
|
|
7092
|
+
De !== -1 && he(De), je(!0), q(ve), z(ve, ve);
|
|
7071
7093
|
}, N = (Z) => {
|
|
7072
7094
|
if (!Oe) return;
|
|
7073
|
-
const L = Z.currentTarget.getBoundingClientRect(), ie =
|
|
7095
|
+
const L = Z.currentTarget.getBoundingClientRect(), ie = J.show ? J.width : 0, ve = (Z.clientX - L.left - ie) * j / oe, Me = Math.min(f, ve), de = Math.max(f, ve);
|
|
7074
7096
|
z(Me, de);
|
|
7075
7097
|
}, se = (Z) => {
|
|
7076
7098
|
if (!Oe) return;
|
|
7077
7099
|
je(!1);
|
|
7078
|
-
const L = Z.currentTarget.getBoundingClientRect(), ie =
|
|
7100
|
+
const L = Z.currentTarget.getBoundingClientRect(), ie = J.show ? J.width : 0, ve = (Z.clientX - L.left - ie) * j / oe, Me = Math.min(f, ve), de = Math.max(f, ve);
|
|
7079
7101
|
Math.abs(de - Me) < 0.1 ? (q(Me), p && $e.current ? ($e.current.stop(), ee(Me)) : $e.current && $e.current.stop()) : z(Me, de);
|
|
7080
7102
|
};
|
|
7081
7103
|
return Pe.some((Z) => Z.clips.length > 0) && (ne.length === 0 || ae.length === 0) ? /* @__PURE__ */ x("div", { className: s, children: "Loading waveform..." }) : /* @__PURE__ */ x(Yn, { children: /* @__PURE__ */ x(
|
|
7082
|
-
|
|
7104
|
+
Et.Provider,
|
|
7083
7105
|
{
|
|
7084
7106
|
value: {
|
|
7085
|
-
samplesPerPixel:
|
|
7107
|
+
samplesPerPixel: j,
|
|
7086
7108
|
sampleRate: oe,
|
|
7087
|
-
zoomLevels: [
|
|
7109
|
+
zoomLevels: [j],
|
|
7088
7110
|
waveHeight: ce,
|
|
7089
7111
|
timeScaleHeight: fe,
|
|
7090
7112
|
duration: F,
|
|
7091
|
-
controls:
|
|
7113
|
+
controls: J,
|
|
7092
7114
|
barWidth: Ye,
|
|
7093
7115
|
barGap: Ge
|
|
7094
7116
|
},
|
|
7095
7117
|
children: /* @__PURE__ */ x(
|
|
7096
|
-
|
|
7118
|
+
Ut,
|
|
7097
7119
|
{
|
|
7098
7120
|
theme: g,
|
|
7099
7121
|
backgroundColor: tt(g.waveOutlineColor),
|
|
7100
7122
|
timescaleBackgroundColor: g.timescaleBackgroundColor,
|
|
7101
|
-
scrollContainerWidth: xe + (
|
|
7123
|
+
scrollContainerWidth: xe + (J.show ? J.width : 0),
|
|
7102
7124
|
timescaleWidth: xe,
|
|
7103
7125
|
tracksWidth: xe,
|
|
7104
|
-
controlsWidth:
|
|
7126
|
+
controlsWidth: J.show ? J.width : 0,
|
|
7105
7127
|
onTracksMouseDown: ot,
|
|
7106
7128
|
onTracksMouseMove: N,
|
|
7107
7129
|
onTracksMouseUp: se,
|
|
@@ -7119,18 +7141,18 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7119
7141
|
renderTimestamp: t
|
|
7120
7142
|
}
|
|
7121
7143
|
),
|
|
7122
|
-
|
|
7144
|
+
M && /* @__PURE__ */ x(
|
|
7123
7145
|
io,
|
|
7124
7146
|
{
|
|
7125
|
-
startPosition: Math.min(
|
|
7126
|
-
endPosition: Math.max(
|
|
7147
|
+
startPosition: Math.min(S, B) * oe / j,
|
|
7148
|
+
endPosition: Math.max(S, B) * oe / j,
|
|
7127
7149
|
markerColor: g.loopMarkerColor,
|
|
7128
7150
|
regionColor: g.loopRegionColor,
|
|
7129
7151
|
minPosition: 0,
|
|
7130
7152
|
maxPosition: xe,
|
|
7131
|
-
controlsOffset:
|
|
7153
|
+
controlsOffset: J.show ? J.width : 0,
|
|
7132
7154
|
onLoopRegionChange: (Z, L) => {
|
|
7133
|
-
const ie = Z *
|
|
7155
|
+
const ie = Z * j / oe, me = L * j / oe;
|
|
7134
7156
|
le(ie, me);
|
|
7135
7157
|
}
|
|
7136
7158
|
}
|
|
@@ -7146,8 +7168,8 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7146
7168
|
soloed: !1,
|
|
7147
7169
|
volume: 1,
|
|
7148
7170
|
pan: 0
|
|
7149
|
-
}, ve = e ? e(L) : /* @__PURE__ */ re(
|
|
7150
|
-
/* @__PURE__ */ x(
|
|
7171
|
+
}, ve = e ? e(L) : /* @__PURE__ */ re(Do, { onClick: () => he(L), children: [
|
|
7172
|
+
/* @__PURE__ */ x(Bo, { style: { justifyContent: "center" }, children: me.name || `Track ${L + 1}` }),
|
|
7151
7173
|
/* @__PURE__ */ re(Mo, { children: [
|
|
7152
7174
|
/* @__PURE__ */ x(
|
|
7153
7175
|
pn,
|
|
@@ -7175,10 +7197,10 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7175
7197
|
max: "1",
|
|
7176
7198
|
step: "0.01",
|
|
7177
7199
|
value: me.volume,
|
|
7178
|
-
onChange: (de) =>
|
|
7200
|
+
onChange: (de) => G(L, parseFloat(de.target.value))
|
|
7179
7201
|
}
|
|
7180
7202
|
),
|
|
7181
|
-
/* @__PURE__ */ x(
|
|
7203
|
+
/* @__PURE__ */ x(Eo, {})
|
|
7182
7204
|
] }),
|
|
7183
7205
|
/* @__PURE__ */ re(bn, { children: [
|
|
7184
7206
|
/* @__PURE__ */ x("span", { children: "L" }),
|
|
@@ -7195,7 +7217,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7195
7217
|
/* @__PURE__ */ x("span", { children: "R" })
|
|
7196
7218
|
] })
|
|
7197
7219
|
] }), Me = Z.length > 0 ? Math.max(...Z.map((de) => de.peaks.data.length)) : 1;
|
|
7198
|
-
return /* @__PURE__ */ x(
|
|
7220
|
+
return /* @__PURE__ */ x(jt.Provider, { value: ve, children: /* @__PURE__ */ re(
|
|
7199
7221
|
jn,
|
|
7200
7222
|
{
|
|
7201
7223
|
numChannels: Me,
|
|
@@ -7207,9 +7229,9 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7207
7229
|
isSelected: ie.id === A,
|
|
7208
7230
|
children: [
|
|
7209
7231
|
Z.map((de, Xe) => {
|
|
7210
|
-
const
|
|
7232
|
+
const De = de.peaks, ze = De.length;
|
|
7211
7233
|
return /* @__PURE__ */ x(
|
|
7212
|
-
|
|
7234
|
+
Gt,
|
|
7213
7235
|
{
|
|
7214
7236
|
clipId: de.clipId,
|
|
7215
7237
|
trackIndex: L,
|
|
@@ -7217,7 +7239,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7217
7239
|
trackName: de.trackName,
|
|
7218
7240
|
startSample: de.startSample,
|
|
7219
7241
|
durationSamples: de.durationSamples,
|
|
7220
|
-
samplesPerPixel:
|
|
7242
|
+
samplesPerPixel: j,
|
|
7221
7243
|
showHeader: o,
|
|
7222
7244
|
disableHeaderDrag: !i,
|
|
7223
7245
|
isSelected: ie.id === A,
|
|
@@ -7230,12 +7252,12 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7230
7252
|
onMouseDown: (Ke) => {
|
|
7231
7253
|
Ke.target.closest('[role="button"][aria-roledescription="draggable"]') || he(L);
|
|
7232
7254
|
},
|
|
7233
|
-
children:
|
|
7255
|
+
children: De.data.map((Ke, st) => /* @__PURE__ */ x(
|
|
7234
7256
|
kn,
|
|
7235
7257
|
{
|
|
7236
7258
|
index: st,
|
|
7237
7259
|
data: Ke,
|
|
7238
|
-
bits:
|
|
7260
|
+
bits: De.bits,
|
|
7239
7261
|
length: ze,
|
|
7240
7262
|
isSelected: ie.id === A,
|
|
7241
7263
|
clipStartSample: de.startSample,
|
|
@@ -7248,7 +7270,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7248
7270
|
);
|
|
7249
7271
|
}),
|
|
7250
7272
|
u?.isRecording && u.trackId === ie.id && u.peaks.length > 0 && /* @__PURE__ */ x(
|
|
7251
|
-
|
|
7273
|
+
Gt,
|
|
7252
7274
|
{
|
|
7253
7275
|
clipId: "recording-preview",
|
|
7254
7276
|
trackIndex: L,
|
|
@@ -7256,7 +7278,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7256
7278
|
trackName: "Recording...",
|
|
7257
7279
|
startSample: u.startSample,
|
|
7258
7280
|
durationSamples: u.durationSamples,
|
|
7259
|
-
samplesPerPixel:
|
|
7281
|
+
samplesPerPixel: j,
|
|
7260
7282
|
showHeader: o,
|
|
7261
7283
|
disableHeaderDrag: !0,
|
|
7262
7284
|
isSelected: ie.id === A,
|
|
@@ -7282,7 +7304,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7282
7304
|
) }, ie.id);
|
|
7283
7305
|
}),
|
|
7284
7306
|
I.length > 0 && /* @__PURE__ */ x(rr, { height: 30, width: xe, children: I.map((Z, L) => {
|
|
7285
|
-
const ie = Z.start * oe /
|
|
7307
|
+
const ie = Z.start * oe / j, me = Z.end * oe / j, ve = a ? a(Z, L) : Z.id;
|
|
7286
7308
|
return /* @__PURE__ */ x(
|
|
7287
7309
|
nr,
|
|
7288
7310
|
{
|
|
@@ -7302,27 +7324,27 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7302
7324
|
f !== h && /* @__PURE__ */ x(
|
|
7303
7325
|
Gn,
|
|
7304
7326
|
{
|
|
7305
|
-
startPosition: Math.min(f, h) * oe /
|
|
7306
|
-
endPosition: Math.max(f, h) * oe /
|
|
7327
|
+
startPosition: Math.min(f, h) * oe / j + (J.show ? J.width : 0),
|
|
7328
|
+
endPosition: Math.max(f, h) * oe / j + (J.show ? J.width : 0),
|
|
7307
7329
|
color: g.selectionColor
|
|
7308
7330
|
}
|
|
7309
7331
|
),
|
|
7310
7332
|
(p || f === h) && (n ? n({
|
|
7311
|
-
position: (d.current ?? 0) * oe /
|
|
7333
|
+
position: (d.current ?? 0) * oe / j + (J.show ? J.width : 0),
|
|
7312
7334
|
color: g.playheadColor,
|
|
7313
7335
|
isPlaying: p,
|
|
7314
7336
|
currentTimeRef: d,
|
|
7315
7337
|
playbackStartTimeRef: b,
|
|
7316
7338
|
audioStartPositionRef: y,
|
|
7317
|
-
samplesPerPixel:
|
|
7339
|
+
samplesPerPixel: j,
|
|
7318
7340
|
sampleRate: oe,
|
|
7319
|
-
controlsOffset:
|
|
7341
|
+
controlsOffset: J.show ? J.width : 0,
|
|
7320
7342
|
getAudioContextTime: () => Ae().currentTime
|
|
7321
7343
|
}) : /* @__PURE__ */ x(
|
|
7322
7344
|
ti,
|
|
7323
7345
|
{
|
|
7324
7346
|
color: g.playheadColor,
|
|
7325
|
-
controlsOffset:
|
|
7347
|
+
controlsOffset: J.show ? J.width : 0
|
|
7326
7348
|
}
|
|
7327
7349
|
))
|
|
7328
7350
|
] })
|
|
@@ -7345,7 +7367,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7345
7367
|
annotationsEditable: c,
|
|
7346
7368
|
linkEndpoints: u,
|
|
7347
7369
|
continuousPlay: g
|
|
7348
|
-
} = Fe(), { setAnnotations: p } = pe(), d = a ?? { linkEndpoints: u, continuousPlay: g }, b =
|
|
7370
|
+
} = Fe(), { setAnnotations: p } = pe(), d = a ?? { linkEndpoints: u, continuousPlay: g }, b = D((y) => {
|
|
7349
7371
|
p(y), n?.(y);
|
|
7350
7372
|
}, [p, n]);
|
|
7351
7373
|
return /* @__PURE__ */ x(
|
|
@@ -7426,7 +7448,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7426
7448
|
color: e = "#ff0000",
|
|
7427
7449
|
controlsOffset: t = 0
|
|
7428
7450
|
}) => {
|
|
7429
|
-
const n =
|
|
7451
|
+
const n = E(null), r = E(null), { isPlaying: a, currentTimeRef: s } = Jt(), { samplesPerPixel: o, sampleRate: i, progressBarWidth: l } = qt();
|
|
7430
7452
|
return Q(() => {
|
|
7431
7453
|
const c = () => {
|
|
7432
7454
|
if (n.current) {
|
|
@@ -7474,7 +7496,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7474
7496
|
clipDurationSamples: t,
|
|
7475
7497
|
...n
|
|
7476
7498
|
}) => {
|
|
7477
|
-
const r =
|
|
7499
|
+
const r = E(null), a = E(null), s = vt(), { waveHeight: o } = bt(), { isPlaying: i, currentTimeRef: l } = Jt(), { samplesPerPixel: c, sampleRate: u } = qt(), g = s?.waveProgressColor || "rgba(0, 0, 0, 0.1)";
|
|
7478
7500
|
Q(() => {
|
|
7479
7501
|
const y = () => {
|
|
7480
7502
|
if (r.current) {
|
|
@@ -7542,7 +7564,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7542
7564
|
onAnnotationUpdate: r,
|
|
7543
7565
|
className: a
|
|
7544
7566
|
}) => {
|
|
7545
|
-
const s = vt(), { isPlaying: o, currentTimeRef: i } =
|
|
7567
|
+
const s = vt(), { isPlaying: o, currentTimeRef: i } = Jt(), { annotations: l, activeAnnotationId: c } = Qt(), { play: u, seekTo: g, setActiveAnnotationId: p, setAnnotations: d, setScrollContainer: b } = gr(), {
|
|
7546
7568
|
duration: y,
|
|
7547
7569
|
peaksDataArray: f,
|
|
7548
7570
|
sampleRate: h,
|
|
@@ -7552,13 +7574,18 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7552
7574
|
controls: w,
|
|
7553
7575
|
playoutRef: C,
|
|
7554
7576
|
barWidth: A,
|
|
7555
|
-
barGap:
|
|
7556
|
-
} =
|
|
7557
|
-
|
|
7558
|
-
}, [b]), z = Math.floor(y * h / m), ee =
|
|
7559
|
-
p(
|
|
7560
|
-
|
|
7561
|
-
|
|
7577
|
+
barGap: S
|
|
7578
|
+
} = qt(), [B, M] = _(0), [$, V] = _(0), [T, P] = _(!1), G = E(null), U = D((H) => {
|
|
7579
|
+
G.current = H, b(H);
|
|
7580
|
+
}, [b]), z = Math.floor(y * h / m), ee = D(async (H) => {
|
|
7581
|
+
p(H.id);
|
|
7582
|
+
try {
|
|
7583
|
+
await u(H.start);
|
|
7584
|
+
} catch (j) {
|
|
7585
|
+
console.error("waveform-playlist: Failed to start playback for annotation", H.id, j);
|
|
7586
|
+
}
|
|
7587
|
+
}, [p, u]), W = D((H) => {
|
|
7588
|
+
d(H), r?.(H);
|
|
7562
7589
|
}, [d, r]), { onDragStart: te, onDragMove: q, onDragEnd: le } = Ms({
|
|
7563
7590
|
annotations: l,
|
|
7564
7591
|
onAnnotationsChange: W,
|
|
@@ -7566,24 +7593,24 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7566
7593
|
sampleRate: h,
|
|
7567
7594
|
duration: y,
|
|
7568
7595
|
linkEndpoints: n
|
|
7569
|
-
}), ne =
|
|
7570
|
-
const
|
|
7571
|
-
P(!0),
|
|
7572
|
-
}, [w, m, h]), ae =
|
|
7596
|
+
}), ne = D((H) => {
|
|
7597
|
+
const j = H.currentTarget.getBoundingClientRect(), oe = w.show ? w.width : 0, fe = (H.clientX - j.left - oe) * m / h;
|
|
7598
|
+
P(!0), M(fe), V(fe);
|
|
7599
|
+
}, [w, m, h]), ae = D((H) => {
|
|
7573
7600
|
if (!T) return;
|
|
7574
|
-
const
|
|
7601
|
+
const j = H.currentTarget.getBoundingClientRect(), oe = w.show ? w.width : 0, fe = (H.clientX - j.left - oe) * m / h;
|
|
7575
7602
|
V(fe);
|
|
7576
|
-
}, [T, w, m, h]), ge =
|
|
7603
|
+
}, [T, w, m, h]), ge = D((H) => {
|
|
7577
7604
|
if (!T) return;
|
|
7578
7605
|
P(!1);
|
|
7579
|
-
const
|
|
7580
|
-
Math.abs($e -
|
|
7581
|
-
}, [T,
|
|
7606
|
+
const j = H.currentTarget.getBoundingClientRect(), oe = w.show ? w.width : 0, fe = (H.clientX - j.left - oe) * m / h, J = Math.min(B, fe), $e = Math.max(B, fe);
|
|
7607
|
+
Math.abs($e - J) < 0.1 ? (g(J), M(J), V(J), o && C.current && (C.current.stop(), u(J))) : (M(J), V($e));
|
|
7608
|
+
}, [T, B, m, h, w, g, o, C, u]);
|
|
7582
7609
|
if (f.length === 0)
|
|
7583
7610
|
return /* @__PURE__ */ x("div", { className: a, children: "Loading waveform..." });
|
|
7584
7611
|
const Pe = null;
|
|
7585
7612
|
return /* @__PURE__ */ x(Yn, { children: /* @__PURE__ */ x(
|
|
7586
|
-
|
|
7613
|
+
Et.Provider,
|
|
7587
7614
|
{
|
|
7588
7615
|
value: {
|
|
7589
7616
|
samplesPerPixel: m,
|
|
@@ -7594,10 +7621,10 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7594
7621
|
duration: y,
|
|
7595
7622
|
controls: w,
|
|
7596
7623
|
barWidth: A,
|
|
7597
|
-
barGap:
|
|
7624
|
+
barGap: S
|
|
7598
7625
|
},
|
|
7599
7626
|
children: /* @__PURE__ */ x(
|
|
7600
|
-
|
|
7627
|
+
Ut,
|
|
7601
7628
|
{
|
|
7602
7629
|
theme: s,
|
|
7603
7630
|
backgroundColor: tt(s.waveOutlineColor),
|
|
@@ -7621,9 +7648,9 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7621
7648
|
}
|
|
7622
7649
|
) : void 0,
|
|
7623
7650
|
children: /* @__PURE__ */ re(Le, { children: [
|
|
7624
|
-
f.map((
|
|
7625
|
-
const oe =
|
|
7626
|
-
return /* @__PURE__ */ x(
|
|
7651
|
+
f.map((H, j) => {
|
|
7652
|
+
const oe = H.length > 0 ? Math.max(...H.map((ce) => ce.peaks.data.length)) : 1;
|
|
7653
|
+
return /* @__PURE__ */ x(jt.Provider, { value: Pe, children: /* @__PURE__ */ x(
|
|
7627
7654
|
jn,
|
|
7628
7655
|
{
|
|
7629
7656
|
numChannels: oe,
|
|
@@ -7631,15 +7658,15 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7631
7658
|
offset: 0,
|
|
7632
7659
|
width: z,
|
|
7633
7660
|
hasClipHeaders: !1,
|
|
7634
|
-
trackId: `media-element-track-${
|
|
7661
|
+
trackId: `media-element-track-${j}`,
|
|
7635
7662
|
isSelected: !0,
|
|
7636
|
-
children:
|
|
7637
|
-
const
|
|
7663
|
+
children: H.map((ce, fe) => {
|
|
7664
|
+
const J = ce.peaks, $e = J.length;
|
|
7638
7665
|
return /* @__PURE__ */ x(
|
|
7639
|
-
|
|
7666
|
+
Gt,
|
|
7640
7667
|
{
|
|
7641
7668
|
clipId: ce.clipId,
|
|
7642
|
-
trackIndex:
|
|
7669
|
+
trackIndex: j,
|
|
7643
7670
|
clipIndex: fe,
|
|
7644
7671
|
trackName: ce.trackName,
|
|
7645
7672
|
startSample: ce.startSample,
|
|
@@ -7648,25 +7675,25 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7648
7675
|
showHeader: !1,
|
|
7649
7676
|
disableHeaderDrag: !0,
|
|
7650
7677
|
isSelected: !0,
|
|
7651
|
-
trackId: `media-element-track-${
|
|
7652
|
-
children:
|
|
7678
|
+
trackId: `media-element-track-${j}`,
|
|
7679
|
+
children: J.data.map((Ye, Ge) => /* @__PURE__ */ x(
|
|
7653
7680
|
pi,
|
|
7654
7681
|
{
|
|
7655
7682
|
index: Ge,
|
|
7656
7683
|
data: Ye,
|
|
7657
|
-
bits:
|
|
7684
|
+
bits: J.bits,
|
|
7658
7685
|
length: $e,
|
|
7659
7686
|
clipStartSample: ce.startSample,
|
|
7660
7687
|
clipDurationSamples: ce.durationSamples
|
|
7661
7688
|
},
|
|
7662
|
-
`${
|
|
7689
|
+
`${j}-${fe}-${Ge}`
|
|
7663
7690
|
))
|
|
7664
7691
|
},
|
|
7665
|
-
`${
|
|
7692
|
+
`${j}-${fe}`
|
|
7666
7693
|
);
|
|
7667
7694
|
})
|
|
7668
7695
|
}
|
|
7669
|
-
) },
|
|
7696
|
+
) }, j);
|
|
7670
7697
|
}),
|
|
7671
7698
|
l.length > 0 && /* @__PURE__ */ x(
|
|
7672
7699
|
ya,
|
|
@@ -7675,31 +7702,31 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7675
7702
|
onDragMove: q,
|
|
7676
7703
|
onDragEnd: le,
|
|
7677
7704
|
modifiers: t ? [Ca] : [],
|
|
7678
|
-
children: /* @__PURE__ */ x(rr, { height: 30, width: z, children: l.map((
|
|
7679
|
-
const oe =
|
|
7705
|
+
children: /* @__PURE__ */ x(rr, { height: 30, width: z, children: l.map((H, j) => {
|
|
7706
|
+
const oe = H.start * h / m, ce = H.end * h / m, fe = e ? e(H, j) : H.id;
|
|
7680
7707
|
return /* @__PURE__ */ x(
|
|
7681
7708
|
nr,
|
|
7682
7709
|
{
|
|
7683
|
-
annotationId:
|
|
7684
|
-
annotationIndex:
|
|
7710
|
+
annotationId: H.id,
|
|
7711
|
+
annotationIndex: j,
|
|
7685
7712
|
startPosition: oe,
|
|
7686
7713
|
endPosition: ce,
|
|
7687
7714
|
label: fe,
|
|
7688
7715
|
color: "#ff9800",
|
|
7689
|
-
isActive:
|
|
7690
|
-
onClick: () => ee(
|
|
7716
|
+
isActive: H.id === c,
|
|
7717
|
+
onClick: () => ee(H),
|
|
7691
7718
|
editable: t
|
|
7692
7719
|
},
|
|
7693
|
-
|
|
7720
|
+
H.id
|
|
7694
7721
|
);
|
|
7695
7722
|
}) })
|
|
7696
7723
|
}
|
|
7697
7724
|
),
|
|
7698
|
-
|
|
7725
|
+
B !== $ && /* @__PURE__ */ x(
|
|
7699
7726
|
Gn,
|
|
7700
7727
|
{
|
|
7701
|
-
startPosition: Math.min(
|
|
7702
|
-
endPosition: Math.max(
|
|
7728
|
+
startPosition: Math.min(B, $) * h / m + (w.show ? w.width : 0),
|
|
7729
|
+
endPosition: Math.max(B, $) * h / m + (w.show ? w.width : 0),
|
|
7703
7730
|
color: s.selectionColor
|
|
7704
7731
|
}
|
|
7705
7732
|
),
|
|
@@ -7720,12 +7747,12 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7720
7747
|
renderAnnotationItem: t,
|
|
7721
7748
|
onAnnotationUpdate: n,
|
|
7722
7749
|
editable: r = !1,
|
|
7723
|
-
|
|
7724
|
-
|
|
7750
|
+
controls: a,
|
|
7751
|
+
annotationListConfig: s,
|
|
7725
7752
|
scrollActivePosition: o = "center",
|
|
7726
7753
|
scrollActiveContainer: i = "nearest"
|
|
7727
7754
|
}) => {
|
|
7728
|
-
const { annotations: l, activeAnnotationId: c, continuousPlay: u } =
|
|
7755
|
+
const { annotations: l, activeAnnotationId: c, continuousPlay: u } = Qt(), { setAnnotations: g } = gr(), p = s ?? { linkEndpoints: !1, continuousPlay: u }, d = D((b) => {
|
|
7729
7756
|
g(b), n?.(b);
|
|
7730
7757
|
}, [g, n]);
|
|
7731
7758
|
return /* @__PURE__ */ x(
|
|
@@ -7737,7 +7764,8 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7737
7764
|
scrollActivePosition: o,
|
|
7738
7765
|
scrollActiveContainer: i,
|
|
7739
7766
|
editable: r,
|
|
7740
|
-
|
|
7767
|
+
controls: r ? a : void 0,
|
|
7768
|
+
annotationListConfig: p,
|
|
7741
7769
|
height: e,
|
|
7742
7770
|
onAnnotationUpdate: d,
|
|
7743
7771
|
renderAnnotationItem: t
|
|
@@ -7754,7 +7782,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7754
7782
|
scrollActiveContainer: i = "nearest",
|
|
7755
7783
|
className: l
|
|
7756
7784
|
}) => {
|
|
7757
|
-
const { annotations: c } =
|
|
7785
|
+
const { annotations: c } = Qt();
|
|
7758
7786
|
return /* @__PURE__ */ re(Le, { children: [
|
|
7759
7787
|
/* @__PURE__ */ x(
|
|
7760
7788
|
gi,
|
|
@@ -7773,7 +7801,7 @@ const mr = ke(null), fr = ke(null), hr = ke(null), pr = ke(null), Xi = ({
|
|
|
7773
7801
|
renderAnnotationItem: n,
|
|
7774
7802
|
onAnnotationUpdate: s,
|
|
7775
7803
|
editable: r,
|
|
7776
|
-
linkEndpoints: a,
|
|
7804
|
+
annotationListConfig: { linkEndpoints: a, continuousPlay: !1 },
|
|
7777
7805
|
scrollActivePosition: o,
|
|
7778
7806
|
scrollActiveContainer: i
|
|
7779
7807
|
}
|
|
@@ -7822,23 +7850,23 @@ export {
|
|
|
7822
7850
|
Ai as loadPeaksFromWaveformData,
|
|
7823
7851
|
qn as loadWaveformData,
|
|
7824
7852
|
Ms as useAnnotationDragHandlers,
|
|
7825
|
-
|
|
7853
|
+
Ri as useAnnotationKeyboardControls,
|
|
7826
7854
|
$i as useAudioTracks,
|
|
7827
7855
|
Mi as useClipDragHandlers,
|
|
7828
|
-
|
|
7829
|
-
|
|
7856
|
+
Bi as useClipSplitting,
|
|
7857
|
+
Di as useDragSensors,
|
|
7830
7858
|
Vi as useDynamicEffects,
|
|
7831
7859
|
Os as useExportWav,
|
|
7832
7860
|
Wi as useIntegratedRecording,
|
|
7833
|
-
|
|
7861
|
+
Lt as useKeyboardShortcuts,
|
|
7834
7862
|
Si as useMasterAnalyser,
|
|
7835
7863
|
ks as useMasterVolume,
|
|
7836
|
-
|
|
7864
|
+
Jt as useMediaElementAnimation,
|
|
7837
7865
|
gr as useMediaElementControls,
|
|
7838
|
-
|
|
7839
|
-
|
|
7866
|
+
qt as useMediaElementData,
|
|
7867
|
+
Qt as useMediaElementState,
|
|
7840
7868
|
_e as usePlaybackAnimation,
|
|
7841
|
-
|
|
7869
|
+
Ei as usePlaybackShortcuts,
|
|
7842
7870
|
pe as usePlaylistControls,
|
|
7843
7871
|
Se as usePlaylistData,
|
|
7844
7872
|
Fe as usePlaylistState,
|