@waveform-playlist/browser 6.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +78 -78
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +998 -996
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Vr from "tone";
|
|
2
|
-
import { Volume as Fn, getDestination as Rn, start as Hr, now as Dt, getTransport as gt, getContext as
|
|
3
|
-
import { jsx as w, jsxs as
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
2
|
+
import { Volume as Fn, getDestination as Rn, start as Hr, now as Dt, getTransport as gt, getContext as ze, Panner as zr, Gain as fn, Player as hn, Analyser as Wn, StereoWidener as Lr, Gate as Xr, Limiter as Or, Compressor as Gr, Chebyshev as Nr, BitCrusher as Yr, Distortion as Kr, EQ3 as Ur, AutoWah as jr, AutoFilter as qr, AutoPanner as Jr, Vibrato as Qr, Tremolo as ea, Phaser as ta, Chorus as na, PingPongDelay as ra, FeedbackDelay as aa, JCReverb as oa, Freeverb as sa, Reverb as ia } from "tone";
|
|
3
|
+
import { jsx as w, jsxs as le, Fragment as et } from "react/jsx-runtime";
|
|
4
|
+
import * as $ from "react";
|
|
5
|
+
import Ne, { createContext as _e, useContext as Se, useState as H, useEffect as re, Fragment as la, useRef as R, useLayoutEffect as Jt, useCallback as E, useMemo as Qe } from "react";
|
|
6
6
|
import _, { ThemeContext as ca, withTheme as Zn, useTheme as ua, ThemeProvider as Pn } from "styled-components";
|
|
7
7
|
import { useDraggable as Xt, useSensor as Ot, MouseSensor as da, TouchSensor as ma, PointerSensor as fa, useSensors as ha, DndContext as pa } from "@dnd-kit/core";
|
|
8
8
|
import { createPortal as Vn } from "react-dom";
|
|
@@ -367,10 +367,10 @@ var wa = class {
|
|
|
367
367
|
}), this.tracks.clear(), this.effectsCleanup && this.effectsCleanup(), this.masterVolume.dispose();
|
|
368
368
|
}
|
|
369
369
|
get context() {
|
|
370
|
-
return
|
|
370
|
+
return ze();
|
|
371
371
|
}
|
|
372
372
|
get sampleRate() {
|
|
373
|
-
return
|
|
373
|
+
return ze().sampleRate;
|
|
374
374
|
}
|
|
375
375
|
setOnPlaybackComplete(e) {
|
|
376
376
|
this.onPlaybackCompleteCallback = e;
|
|
@@ -418,121 +418,121 @@ const Kt = /* @__PURE__ */ Object.freeze({
|
|
|
418
418
|
}), xa = /* @__PURE__ */ new Map([
|
|
419
419
|
[
|
|
420
420
|
"bold",
|
|
421
|
-
/* @__PURE__ */
|
|
421
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128ZM60,112a16,16,0,1,0,16,16A16,16,0,0,0,60,112Zm136,0a16,16,0,1,0,16,16A16,16,0,0,0,196,112Z" }))
|
|
422
422
|
],
|
|
423
423
|
[
|
|
424
424
|
"duotone",
|
|
425
|
-
/* @__PURE__ */
|
|
425
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement(
|
|
426
426
|
"path",
|
|
427
427
|
{
|
|
428
428
|
d: "M240,96v64a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V96A16,16,0,0,1,32,80H224A16,16,0,0,1,240,96Z",
|
|
429
429
|
opacity: "0.2"
|
|
430
430
|
}
|
|
431
|
-
), /* @__PURE__ */
|
|
431
|
+
), /* @__PURE__ */ $.createElement("path", { d: "M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z" }))
|
|
432
432
|
],
|
|
433
433
|
[
|
|
434
434
|
"fill",
|
|
435
|
-
/* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M224,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V96A16,16,0,0,0,224,80ZM60,140a12,12,0,1,1,12-12A12,12,0,0,1,60,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,196,140Z" }))
|
|
436
436
|
],
|
|
437
437
|
[
|
|
438
438
|
"light",
|
|
439
|
-
/* @__PURE__ */
|
|
439
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM60,118a10,10,0,1,0,10,10A10,10,0,0,0,60,118Zm136,0a10,10,0,1,0,10,10A10,10,0,0,0,196,118Z" }))
|
|
440
440
|
],
|
|
441
441
|
[
|
|
442
442
|
"regular",
|
|
443
|
-
/* @__PURE__ */
|
|
443
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z" }))
|
|
444
444
|
],
|
|
445
445
|
[
|
|
446
446
|
"thin",
|
|
447
|
-
/* @__PURE__ */
|
|
447
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-76-8a8,8,0,1,0,8,8A8,8,0,0,0,60,120Zm136,0a8,8,0,1,0,8,8A8,8,0,0,0,196,120Z" }))
|
|
448
448
|
]
|
|
449
449
|
]), Sa = /* @__PURE__ */ new Map([
|
|
450
450
|
[
|
|
451
451
|
"bold",
|
|
452
|
-
/* @__PURE__ */
|
|
452
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.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,1,1-18-15.88,20,20,0,0,0,0-26.43,12,12,0,0,1,18-15.86A43.94,43.94,0,0,1,212,128Zm40,0a83.87,83.87,0,0,1-21.39,56,12,12,0,0,1-17.89-16,60,60,0,0,0,0-80,12,12,0,1,1,17.88-16A83.87,83.87,0,0,1,252,128Z" }))
|
|
453
453
|
],
|
|
454
454
|
[
|
|
455
455
|
"duotone",
|
|
456
|
-
/* @__PURE__ */
|
|
456
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M80,88v80H32a8,8,0,0,1-8-8V96a8,8,0,0,1,8-8Z", opacity: "0.2" }), /* @__PURE__ */ $.createElement("path", { d: "M155.51,24.81a8,8,0,0,0-8.42.88L77.25,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H77.25l69.84,54.31A8,8,0,0,0,160,224V32A8,8,0,0,0,155.51,24.81ZM32,96H72v64H32ZM144,207.64,88,164.09V91.91l56-43.55Zm54-106.08a40,40,0,0,1,0,52.88,8,8,0,0,1-12-10.58,24,24,0,0,0,0-31.72,8,8,0,0,1,12-10.58ZM248,128a79.9,79.9,0,0,1-20.37,53.34,8,8,0,0,1-11.92-10.67,64,64,0,0,0,0-85.33,8,8,0,1,1,11.92-10.67A79.83,79.83,0,0,1,248,128Z" }))
|
|
457
457
|
],
|
|
458
458
|
[
|
|
459
459
|
"fill",
|
|
460
|
-
/* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M160,32.25V223.69a8.29,8.29,0,0,1-3.91,7.18,8,8,0,0,1-9-.56l-65.57-51A4,4,0,0,1,80,176.16V79.84a4,4,0,0,1,1.55-3.15l65.57-51a8,8,0,0,1,10,.16A8.27,8.27,0,0,1,160,32.25ZM60,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H60a4,4,0,0,0,4-4V84A4,4,0,0,0,60,80Zm126.77,20.84a8,8,0,0,0-.72,11.3,24,24,0,0,1,0,31.72,8,8,0,1,0,12,10.58,40,40,0,0,0,0-52.88A8,8,0,0,0,186.74,100.84Zm40.89-26.17a8,8,0,1,0-11.92,10.66,64,64,0,0,1,0,85.34,8,8,0,1,0,11.92,10.66,80,80,0,0,0,0-106.66Z" }))
|
|
461
461
|
],
|
|
462
462
|
[
|
|
463
463
|
"light",
|
|
464
|
-
/* @__PURE__ */
|
|
464
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M154.64,26.61a6,6,0,0,0-6.32.65L77.94,82H32A14,14,0,0,0,18,96v64a14,14,0,0,0,14,14H77.94l70.38,54.74A6,6,0,0,0,158,224V32A6,6,0,0,0,154.64,26.61ZM30,160V96a2,2,0,0,1,2-2H74v68H32A2,2,0,0,1,30,160Zm116,51.73L86,165.07V90.93l60-46.66Zm50.53-108.85a38,38,0,0,1,0,50.24,6,6,0,1,1-9-7.94,26,26,0,0,0,0-34.37,6,6,0,0,1,9-7.93ZM246,128a77.86,77.86,0,0,1-19.86,52,6,6,0,1,1-8.94-8,66,66,0,0,0,0-88,6,6,0,1,1,8.94-8A77.86,77.86,0,0,1,246,128Z" }))
|
|
465
465
|
],
|
|
466
466
|
[
|
|
467
467
|
"regular",
|
|
468
|
-
/* @__PURE__ */
|
|
468
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M155.51,24.81a8,8,0,0,0-8.42.88L77.25,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H77.25l69.84,54.31A8,8,0,0,0,160,224V32A8,8,0,0,0,155.51,24.81ZM32,96H72v64H32ZM144,207.64,88,164.09V91.91l56-43.55Zm54-106.08a40,40,0,0,1,0,52.88,8,8,0,0,1-12-10.58,24,24,0,0,0,0-31.72,8,8,0,0,1,12-10.58ZM248,128a79.9,79.9,0,0,1-20.37,53.34,8,8,0,0,1-11.92-10.67,64,64,0,0,0,0-85.33,8,8,0,1,1,11.92-10.67A79.83,79.83,0,0,1,248,128Z" }))
|
|
469
469
|
],
|
|
470
470
|
[
|
|
471
471
|
"thin",
|
|
472
|
-
/* @__PURE__ */
|
|
472
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.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" }))
|
|
473
473
|
]
|
|
474
474
|
]), ka = /* @__PURE__ */ new Map([
|
|
475
475
|
[
|
|
476
476
|
"bold",
|
|
477
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.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" }))
|
|
478
478
|
],
|
|
479
479
|
[
|
|
480
480
|
"duotone",
|
|
481
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M80,88v80H32a8,8,0,0,1-8-8V96a8,8,0,0,1,8-8Z", opacity: "0.2" }), /* @__PURE__ */ $.createElement("path", { d: "M155.51,24.81a8,8,0,0,0-8.42.88L77.25,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H77.25l69.84,54.31A8,8,0,0,0,160,224V32A8,8,0,0,0,155.51,24.81ZM32,96H72v64H32ZM144,207.64,88,164.09V91.91l56-43.55ZM208,128a39.93,39.93,0,0,1-10,26.46,8,8,0,0,1-12-10.58,24,24,0,0,0,0-31.72,8,8,0,1,1,12-10.58A40,40,0,0,1,208,128Z" }))
|
|
482
482
|
],
|
|
483
483
|
[
|
|
484
484
|
"fill",
|
|
485
|
-
/* @__PURE__ */
|
|
485
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M160,32.25V223.69a8.29,8.29,0,0,1-3.91,7.18,8,8,0,0,1-9-.56l-65.57-51A4,4,0,0,1,80,176.16V79.84a4,4,0,0,1,1.55-3.15l65.57-51a8,8,0,0,1,10,.16A8.27,8.27,0,0,1,160,32.25ZM60,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H60a4,4,0,0,0,4-4V84A4,4,0,0,0,60,80ZM198,101.56a8,8,0,1,0-12,10.58,24,24,0,0,1,0,31.72,8,8,0,1,0,12,10.58,40,40,0,0,0,0-52.88Z" }))
|
|
486
486
|
],
|
|
487
487
|
[
|
|
488
488
|
"light",
|
|
489
|
-
/* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M154.64,26.61a6,6,0,0,0-6.32.65L77.94,82H32A14,14,0,0,0,18,96v64a14,14,0,0,0,14,14H77.94l70.38,54.74A6,6,0,0,0,158,224V32A6,6,0,0,0,154.64,26.61ZM30,160V96a2,2,0,0,1,2-2H74v68H32A2,2,0,0,1,30,160Zm116,51.73L86,165.07V90.93l60-46.66ZM206,128a37.94,37.94,0,0,1-9.5,25.14,6,6,0,1,1-9-7.94,26,26,0,0,0,0-34.37,6,6,0,0,1,9-7.93A38,38,0,0,1,206,128Z" }))
|
|
490
490
|
],
|
|
491
491
|
[
|
|
492
492
|
"regular",
|
|
493
|
-
/* @__PURE__ */
|
|
493
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M155.51,24.81a8,8,0,0,0-8.42.88L77.25,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H77.25l69.84,54.31A8,8,0,0,0,160,224V32A8,8,0,0,0,155.51,24.81ZM32,96H72v64H32ZM144,207.64,88,164.09V91.91l56-43.55ZM208,128a39.93,39.93,0,0,1-10,26.46,8,8,0,0,1-12-10.58,24,24,0,0,0,0-31.72,8,8,0,1,1,12-10.58A40,40,0,0,1,208,128Z" }))
|
|
494
494
|
],
|
|
495
495
|
[
|
|
496
496
|
"thin",
|
|
497
|
-
/* @__PURE__ */
|
|
497
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.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" }))
|
|
498
498
|
]
|
|
499
499
|
]), Aa = /* @__PURE__ */ new Map([
|
|
500
500
|
[
|
|
501
501
|
"bold",
|
|
502
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z" }))
|
|
503
503
|
],
|
|
504
504
|
[
|
|
505
505
|
"duotone",
|
|
506
|
-
/* @__PURE__ */
|
|
506
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement(
|
|
507
507
|
"path",
|
|
508
508
|
{
|
|
509
509
|
d: "M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",
|
|
510
510
|
opacity: "0.2"
|
|
511
511
|
}
|
|
512
|
-
), /* @__PURE__ */
|
|
512
|
+
), /* @__PURE__ */ $.createElement("path", { d: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z" }))
|
|
513
513
|
],
|
|
514
514
|
[
|
|
515
515
|
"fill",
|
|
516
|
-
/* @__PURE__ */
|
|
516
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z" }))
|
|
517
517
|
],
|
|
518
518
|
[
|
|
519
519
|
"light",
|
|
520
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z" }))
|
|
521
521
|
],
|
|
522
522
|
[
|
|
523
523
|
"regular",
|
|
524
|
-
/* @__PURE__ */
|
|
524
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z" }))
|
|
525
525
|
],
|
|
526
526
|
[
|
|
527
527
|
"thin",
|
|
528
|
-
/* @__PURE__ */
|
|
528
|
+
/* @__PURE__ */ $.createElement($.Fragment, null, /* @__PURE__ */ $.createElement("path", { d: "M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z" }))
|
|
529
529
|
]
|
|
530
530
|
]), Ia = _e({
|
|
531
531
|
color: "currentColor",
|
|
532
532
|
size: "1em",
|
|
533
533
|
weight: "regular",
|
|
534
534
|
mirrored: !1
|
|
535
|
-
}), kt =
|
|
535
|
+
}), kt = $.forwardRef(
|
|
536
536
|
(e, t) => {
|
|
537
537
|
const {
|
|
538
538
|
alt: n,
|
|
@@ -549,8 +549,8 @@ const Kt = /* @__PURE__ */ Object.freeze({
|
|
|
549
549
|
weight: f = "regular",
|
|
550
550
|
mirrored: d = !1,
|
|
551
551
|
...v
|
|
552
|
-
} =
|
|
553
|
-
return /* @__PURE__ */
|
|
552
|
+
} = $.useContext(Ia);
|
|
553
|
+
return /* @__PURE__ */ $.createElement(
|
|
554
554
|
"svg",
|
|
555
555
|
{
|
|
556
556
|
ref: t,
|
|
@@ -563,20 +563,20 @@ const Kt = /* @__PURE__ */ Object.freeze({
|
|
|
563
563
|
...v,
|
|
564
564
|
...c
|
|
565
565
|
},
|
|
566
|
-
!!n && /* @__PURE__ */
|
|
566
|
+
!!n && /* @__PURE__ */ $.createElement("title", null, n),
|
|
567
567
|
i,
|
|
568
568
|
l.get(s ?? f)
|
|
569
569
|
);
|
|
570
570
|
}
|
|
571
571
|
);
|
|
572
572
|
kt.displayName = "IconBase";
|
|
573
|
-
const zn =
|
|
573
|
+
const zn = $.forwardRef((e, t) => /* @__PURE__ */ $.createElement(kt, { ref: t, ...e, weights: xa }));
|
|
574
574
|
zn.displayName = "DotsThreeIcon";
|
|
575
|
-
const Ln =
|
|
575
|
+
const Ln = $.forwardRef((e, t) => /* @__PURE__ */ $.createElement(kt, { ref: t, ...e, weights: Sa }));
|
|
576
576
|
Ln.displayName = "SpeakerHighIcon";
|
|
577
|
-
const Xn =
|
|
577
|
+
const Xn = $.forwardRef((e, t) => /* @__PURE__ */ $.createElement(kt, { ref: t, ...e, weights: ka }));
|
|
578
578
|
Xn.displayName = "SpeakerLowIcon";
|
|
579
|
-
const On =
|
|
579
|
+
const On = $.forwardRef((e, t) => /* @__PURE__ */ $.createElement(kt, { ref: t, ...e, weights: Aa }));
|
|
580
580
|
On.displayName = "XIcon";
|
|
581
581
|
const Ma = On;
|
|
582
582
|
_.span`
|
|
@@ -649,7 +649,7 @@ var $a = _.div`
|
|
|
649
649
|
font-family: ${(e) => e.theme.fontFamily};
|
|
650
650
|
font-size: ${(e) => e.theme.fontSize};
|
|
651
651
|
color: ${(e) => e.theme.textColor};
|
|
652
|
-
`,
|
|
652
|
+
`, Ke = _.button`
|
|
653
653
|
padding: 0.5rem 1rem;
|
|
654
654
|
background: ${(e) => e.theme.buttonBackground || "#007bff"};
|
|
655
655
|
color: ${(e) => e.theme.buttonText || "white"};
|
|
@@ -848,7 +848,7 @@ var Yn = _.input.attrs({ type: "range" })`
|
|
|
848
848
|
onChange: t,
|
|
849
849
|
disabled: n = !1,
|
|
850
850
|
className: r
|
|
851
|
-
}) => /* @__PURE__ */
|
|
851
|
+
}) => /* @__PURE__ */ le($a, { className: r, children: [
|
|
852
852
|
/* @__PURE__ */ w(
|
|
853
853
|
Ea,
|
|
854
854
|
{
|
|
@@ -989,7 +989,7 @@ var Wa = _.canvas.attrs((e) => ({
|
|
|
989
989
|
barGap: p = 0,
|
|
990
990
|
transparentBackground: f = !1,
|
|
991
991
|
drawMode: d = "inverted"
|
|
992
|
-
} = e, v = R([]), y =
|
|
992
|
+
} = e, v = R([]), y = E(
|
|
993
993
|
(x) => {
|
|
994
994
|
if (x !== null) {
|
|
995
995
|
const S = parseInt(x.dataset.index, 10);
|
|
@@ -1001,30 +1001,30 @@ var Wa = _.canvas.attrs((e) => ({
|
|
|
1001
1001
|
Jt(() => {
|
|
1002
1002
|
const x = v.current, S = u + p;
|
|
1003
1003
|
let M = 0;
|
|
1004
|
-
for (let
|
|
1005
|
-
const
|
|
1006
|
-
if (
|
|
1007
|
-
|
|
1008
|
-
const B =
|
|
1004
|
+
for (let I = 0; I < x.length; I++) {
|
|
1005
|
+
const T = x[I], A = T.getContext("2d"), k = Math.floor(i / 2), F = 2 ** (n - 1);
|
|
1006
|
+
if (A) {
|
|
1007
|
+
A.resetTransform(), A.clearRect(0, 0, T.width, T.height), A.imageSmoothingEnabled = !1, A.scale(o, o);
|
|
1008
|
+
const B = T.width / o;
|
|
1009
1009
|
let W;
|
|
1010
|
-
d === "normal" ? W = c : W = l,
|
|
1011
|
-
|
|
1010
|
+
d === "normal" ? W = c : W = l, A.fillStyle = Ra(
|
|
1011
|
+
A,
|
|
1012
1012
|
W,
|
|
1013
1013
|
B,
|
|
1014
1014
|
i
|
|
1015
1015
|
);
|
|
1016
|
-
const
|
|
1017
|
-
for (let
|
|
1018
|
-
const
|
|
1019
|
-
if (
|
|
1020
|
-
const
|
|
1021
|
-
if (
|
|
1022
|
-
const
|
|
1023
|
-
d === "normal" ?
|
|
1016
|
+
const N = M, Y = M + B, z = Math.floor((N - u + S) / S) * S;
|
|
1017
|
+
for (let J = Math.max(0, z); J < Y; J += S) {
|
|
1018
|
+
const K = J - N;
|
|
1019
|
+
if (K + u <= 0) continue;
|
|
1020
|
+
const se = J;
|
|
1021
|
+
if (se * 2 + 1 < t.length) {
|
|
1022
|
+
const Q = t[se * 2] / F, ie = t[se * 2 + 1] / F, ue = Math.abs(Q * k), he = Math.abs(ie * k);
|
|
1023
|
+
d === "normal" ? A.fillRect(K, k - he, u, he + ue) : (A.fillRect(K, 0, u, k - he), A.fillRect(K, k + ue, u, k - ue));
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
|
-
M +=
|
|
1027
|
+
M += T.width / o;
|
|
1028
1028
|
}
|
|
1029
1029
|
}, [
|
|
1030
1030
|
t,
|
|
@@ -1176,7 +1176,7 @@ var Wa = _.canvas.attrs((e) => ({
|
|
|
1176
1176
|
dragHandleProps: a,
|
|
1177
1177
|
touchOptimized: s = !1
|
|
1178
1178
|
}) => {
|
|
1179
|
-
const [o, i] =
|
|
1179
|
+
const [o, i] = Ne.useState(!1);
|
|
1180
1180
|
if (!a)
|
|
1181
1181
|
return null;
|
|
1182
1182
|
const { attributes: l, listeners: c, setActivatorNodeRef: u, isDragging: p } = a;
|
|
@@ -1301,38 +1301,38 @@ var wn = ({
|
|
|
1301
1301
|
showFades: C = !1,
|
|
1302
1302
|
touchOptimized: b = !1
|
|
1303
1303
|
}) => {
|
|
1304
|
-
const g = Math.floor(o / l), S = Math.floor((o + i) / l) - g, M = c && !u && !p,
|
|
1305
|
-
id:
|
|
1304
|
+
const g = Math.floor(o / l), S = Math.floor((o + i) / l) - g, M = c && !u && !p, I = `clip-${r}-${a}`, { attributes: T, listeners: A, setNodeRef: k, setActivatorNodeRef: F, transform: B, isDragging: W } = Xt({
|
|
1305
|
+
id: I,
|
|
1306
1306
|
data: { clipId: n, trackIndex: r, clipIndex: a },
|
|
1307
1307
|
disabled: !M
|
|
1308
|
-
}),
|
|
1309
|
-
attributes:
|
|
1310
|
-
listeners:
|
|
1311
|
-
setActivatorNodeRef:
|
|
1312
|
-
isDragging:
|
|
1308
|
+
}), N = `clip-boundary-left-${r}-${a}`, {
|
|
1309
|
+
attributes: Y,
|
|
1310
|
+
listeners: z,
|
|
1311
|
+
setActivatorNodeRef: J,
|
|
1312
|
+
isDragging: K
|
|
1313
1313
|
} = Xt({
|
|
1314
|
-
id:
|
|
1314
|
+
id: N,
|
|
1315
1315
|
data: { clipId: n, trackIndex: r, clipIndex: a, boundary: "left" },
|
|
1316
1316
|
disabled: !M
|
|
1317
|
-
}),
|
|
1318
|
-
attributes:
|
|
1319
|
-
listeners:
|
|
1320
|
-
setActivatorNodeRef:
|
|
1321
|
-
isDragging:
|
|
1317
|
+
}), se = `clip-boundary-right-${r}-${a}`, {
|
|
1318
|
+
attributes: Q,
|
|
1319
|
+
listeners: ie,
|
|
1320
|
+
setActivatorNodeRef: ue,
|
|
1321
|
+
isDragging: he
|
|
1322
1322
|
} = Xt({
|
|
1323
|
-
id:
|
|
1323
|
+
id: se,
|
|
1324
1324
|
data: { clipId: n, trackIndex: r, clipIndex: a, boundary: "right" },
|
|
1325
1325
|
disabled: !M
|
|
1326
|
-
}),
|
|
1326
|
+
}), pe = B ? {
|
|
1327
1327
|
transform: Kt.Translate.toString(B),
|
|
1328
1328
|
zIndex: W ? 100 : void 0
|
|
1329
1329
|
// Below controls (z-index: 999) but above other clips
|
|
1330
1330
|
} : void 0;
|
|
1331
|
-
return /* @__PURE__ */
|
|
1331
|
+
return /* @__PURE__ */ le(
|
|
1332
1332
|
Na,
|
|
1333
1333
|
{
|
|
1334
|
-
ref:
|
|
1335
|
-
style:
|
|
1334
|
+
ref: k,
|
|
1335
|
+
style: pe,
|
|
1336
1336
|
className: t,
|
|
1337
1337
|
$left: g,
|
|
1338
1338
|
$width: S,
|
|
@@ -1350,10 +1350,10 @@ var wn = ({
|
|
|
1350
1350
|
trackName: s,
|
|
1351
1351
|
isSelected: f,
|
|
1352
1352
|
disableDrag: u,
|
|
1353
|
-
dragHandleProps: M ? { attributes:
|
|
1353
|
+
dragHandleProps: M ? { attributes: T, listeners: A, setActivatorNodeRef: F } : void 0
|
|
1354
1354
|
}
|
|
1355
1355
|
),
|
|
1356
|
-
/* @__PURE__ */
|
|
1356
|
+
/* @__PURE__ */ le(Ya, { $isOverlay: p, children: [
|
|
1357
1357
|
e,
|
|
1358
1358
|
C && y && y.duration > 0 && /* @__PURE__ */ w(
|
|
1359
1359
|
wn,
|
|
@@ -1374,7 +1374,7 @@ var wn = ({
|
|
|
1374
1374
|
}
|
|
1375
1375
|
)
|
|
1376
1376
|
] }),
|
|
1377
|
-
c && !u && !p && /* @__PURE__ */
|
|
1377
|
+
c && !u && !p && /* @__PURE__ */ le(et, { children: [
|
|
1378
1378
|
/* @__PURE__ */ w(
|
|
1379
1379
|
yn,
|
|
1380
1380
|
{
|
|
@@ -1384,10 +1384,10 @@ var wn = ({
|
|
|
1384
1384
|
edge: "left",
|
|
1385
1385
|
touchOptimized: b,
|
|
1386
1386
|
dragHandleProps: {
|
|
1387
|
-
attributes:
|
|
1388
|
-
listeners:
|
|
1389
|
-
setActivatorNodeRef:
|
|
1390
|
-
isDragging:
|
|
1387
|
+
attributes: Y,
|
|
1388
|
+
listeners: z,
|
|
1389
|
+
setActivatorNodeRef: J,
|
|
1390
|
+
isDragging: K
|
|
1391
1391
|
}
|
|
1392
1392
|
}
|
|
1393
1393
|
),
|
|
@@ -1400,10 +1400,10 @@ var wn = ({
|
|
|
1400
1400
|
edge: "right",
|
|
1401
1401
|
touchOptimized: b,
|
|
1402
1402
|
dragHandleProps: {
|
|
1403
|
-
attributes:
|
|
1404
|
-
listeners:
|
|
1405
|
-
setActivatorNodeRef:
|
|
1406
|
-
isDragging:
|
|
1403
|
+
attributes: Q,
|
|
1404
|
+
listeners: ie,
|
|
1405
|
+
setActivatorNodeRef: ue,
|
|
1406
|
+
isDragging: he
|
|
1407
1407
|
}
|
|
1408
1408
|
}
|
|
1409
1409
|
)
|
|
@@ -1429,7 +1429,7 @@ var wn = ({
|
|
|
1429
1429
|
const a = (s) => {
|
|
1430
1430
|
t(parseFloat(s.target.value) / 100);
|
|
1431
1431
|
};
|
|
1432
|
-
return /* @__PURE__ */
|
|
1432
|
+
return /* @__PURE__ */ le(Ka, { className: r, children: [
|
|
1433
1433
|
/* @__PURE__ */ w(Ua, { htmlFor: "master-gain", children: "Master Volume" }),
|
|
1434
1434
|
/* @__PURE__ */ w(
|
|
1435
1435
|
ja,
|
|
@@ -1533,14 +1533,14 @@ var Ja = _.div`
|
|
|
1533
1533
|
scrollContainerRef: f,
|
|
1534
1534
|
isSelecting: d,
|
|
1535
1535
|
"data-playlist-state": v
|
|
1536
|
-
}) => /* @__PURE__ */ w(Ja, { "data-scroll-container": "true", "data-playlist-state": v, ref: f, children: /* @__PURE__ */
|
|
1536
|
+
}) => /* @__PURE__ */ w(Ja, { "data-scroll-container": "true", "data-playlist-state": v, ref: f, children: /* @__PURE__ */ le(
|
|
1537
1537
|
Qa,
|
|
1538
1538
|
{
|
|
1539
1539
|
$backgroundColor: t,
|
|
1540
1540
|
$width: o,
|
|
1541
1541
|
children: [
|
|
1542
1542
|
r && /* @__PURE__ */ w(eo, { $width: a, $backgroundColor: n, children: r }),
|
|
1543
|
-
/* @__PURE__ */
|
|
1543
|
+
/* @__PURE__ */ le(to, { $width: s, $backgroundColor: t, children: [
|
|
1544
1544
|
e,
|
|
1545
1545
|
(l || c) && /* @__PURE__ */ w(
|
|
1546
1546
|
no,
|
|
@@ -1685,33 +1685,33 @@ var Cn = _.div.attrs((e) => ({
|
|
|
1685
1685
|
minPosition: i = 0,
|
|
1686
1686
|
maxPosition: l = 1 / 0
|
|
1687
1687
|
}) => {
|
|
1688
|
-
const [c, u] =
|
|
1688
|
+
const [c, u] = H(null), p = R(0), f = R(0), d = R(0), v = Math.max(0, t - e), y = E((h, C) => {
|
|
1689
1689
|
h.preventDefault(), h.stopPropagation(), u(C), p.current = h.clientX, f.current = C === "start" ? e : t;
|
|
1690
1690
|
const b = (x) => {
|
|
1691
1691
|
const S = x.clientX - p.current, M = f.current + S;
|
|
1692
1692
|
if (C === "start") {
|
|
1693
|
-
const
|
|
1694
|
-
a?.(
|
|
1693
|
+
const I = Math.max(i, Math.min(t - 10, M));
|
|
1694
|
+
a?.(I);
|
|
1695
1695
|
} else {
|
|
1696
|
-
const
|
|
1697
|
-
s?.(
|
|
1696
|
+
const I = Math.max(e + 10, Math.min(l, M));
|
|
1697
|
+
s?.(I);
|
|
1698
1698
|
}
|
|
1699
1699
|
}, g = () => {
|
|
1700
1700
|
u(null), document.removeEventListener("mousemove", b), document.removeEventListener("mouseup", g);
|
|
1701
1701
|
};
|
|
1702
1702
|
document.addEventListener("mousemove", b), document.addEventListener("mouseup", g);
|
|
1703
|
-
}, [e, t, i, l, a, s]), m =
|
|
1703
|
+
}, [e, t, i, l, a, s]), m = E((h) => {
|
|
1704
1704
|
h.preventDefault(), h.stopPropagation(), u("region"), p.current = h.clientX, f.current = e, d.current = t;
|
|
1705
1705
|
const C = t - e, b = (x) => {
|
|
1706
1706
|
const S = x.clientX - p.current;
|
|
1707
|
-
let M = f.current + S,
|
|
1708
|
-
M < i && (M = i,
|
|
1707
|
+
let M = f.current + S, I = d.current + S;
|
|
1708
|
+
M < i && (M = i, I = i + C), I > l && (I = l, M = l - C), o?.(M, I);
|
|
1709
1709
|
}, g = () => {
|
|
1710
1710
|
u(null), document.removeEventListener("mousemove", b), document.removeEventListener("mouseup", g);
|
|
1711
1711
|
};
|
|
1712
1712
|
document.addEventListener("mousemove", b), document.addEventListener("mouseup", g);
|
|
1713
1713
|
}, [e, t, i, l, o]);
|
|
1714
|
-
return v <= 0 ? null : /* @__PURE__ */
|
|
1714
|
+
return v <= 0 ? null : /* @__PURE__ */ le(et, { children: [
|
|
1715
1715
|
/* @__PURE__ */ w(
|
|
1716
1716
|
ao,
|
|
1717
1717
|
{
|
|
@@ -1767,7 +1767,7 @@ var Cn = _.div.attrs((e) => ({
|
|
|
1767
1767
|
maxPosition: o = 1 / 0,
|
|
1768
1768
|
controlsOffset: i = 0
|
|
1769
1769
|
}) => {
|
|
1770
|
-
const [l, c] =
|
|
1770
|
+
const [l, c] = H(!1), u = R(0), p = R(null), f = t > e, d = E((v) => {
|
|
1771
1771
|
const y = v.target;
|
|
1772
1772
|
if (y.closest("[data-loop-marker-handle]") || y.closest("[data-loop-region-timescale]"))
|
|
1773
1773
|
return;
|
|
@@ -1777,8 +1777,8 @@ var Cn = _.div.attrs((e) => ({
|
|
|
1777
1777
|
const h = v.clientX - m.left, C = Math.max(s, Math.min(o, h));
|
|
1778
1778
|
u.current = C, a?.(C, C);
|
|
1779
1779
|
const b = (x) => {
|
|
1780
|
-
const S = x.clientX - m.left, M = Math.max(s, Math.min(o, S)),
|
|
1781
|
-
a?.(
|
|
1780
|
+
const S = x.clientX - m.left, M = Math.max(s, Math.min(o, S)), I = Math.min(u.current, M), T = Math.max(u.current, M);
|
|
1781
|
+
a?.(I, T);
|
|
1782
1782
|
}, g = () => {
|
|
1783
1783
|
c(!1), document.removeEventListener("mousemove", b), document.removeEventListener("mouseup", g);
|
|
1784
1784
|
};
|
|
@@ -1858,11 +1858,11 @@ var xn = ({
|
|
|
1858
1858
|
onChange: s,
|
|
1859
1859
|
readOnly: o = !1
|
|
1860
1860
|
}) => {
|
|
1861
|
-
const [i, l] =
|
|
1861
|
+
const [i, l] = H("");
|
|
1862
1862
|
return re(() => {
|
|
1863
1863
|
const f = vt(n, r);
|
|
1864
1864
|
l(f);
|
|
1865
|
-
}, [n, r, e]), /* @__PURE__ */
|
|
1865
|
+
}, [n, r, e]), /* @__PURE__ */ le(et, { children: [
|
|
1866
1866
|
/* @__PURE__ */ w(Da, { as: "label", htmlFor: e, children: t }),
|
|
1867
1867
|
/* @__PURE__ */ w(
|
|
1868
1868
|
Gn,
|
|
@@ -1895,7 +1895,7 @@ var xn = ({
|
|
|
1895
1895
|
onSelectionChange: n,
|
|
1896
1896
|
className: r
|
|
1897
1897
|
}) => {
|
|
1898
|
-
const [a, s] =
|
|
1898
|
+
const [a, s] = H("hh:mm:ss.uuu");
|
|
1899
1899
|
return re(() => {
|
|
1900
1900
|
const l = document.querySelector(".time-format"), c = () => {
|
|
1901
1901
|
l && s(l.value);
|
|
@@ -1903,7 +1903,7 @@ var xn = ({
|
|
|
1903
1903
|
return l && (s(l.value), l.addEventListener("change", c)), () => {
|
|
1904
1904
|
l?.removeEventListener("change", c);
|
|
1905
1905
|
};
|
|
1906
|
-
}, []), /* @__PURE__ */
|
|
1906
|
+
}, []), /* @__PURE__ */ le(et, { children: [
|
|
1907
1907
|
/* @__PURE__ */ w(
|
|
1908
1908
|
xn,
|
|
1909
1909
|
{
|
|
@@ -1936,7 +1936,7 @@ function Bt() {
|
|
|
1936
1936
|
return window.devicePixelRatio;
|
|
1937
1937
|
}
|
|
1938
1938
|
var tr = _e(Bt()), nr = ({ children: e }) => {
|
|
1939
|
-
const [t, n] =
|
|
1939
|
+
const [t, n] = H(Bt());
|
|
1940
1940
|
return matchMedia(`(resolution: ${Bt()}dppx)`).addEventListener(
|
|
1941
1941
|
"change",
|
|
1942
1942
|
() => {
|
|
@@ -2003,115 +2003,116 @@ function vo() {
|
|
|
2003
2003
|
}
|
|
2004
2004
|
var Sn = ({
|
|
2005
2005
|
index: e,
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2006
|
+
channelIndex: t,
|
|
2007
|
+
data: n,
|
|
2008
|
+
length: r,
|
|
2009
|
+
waveHeight: a,
|
|
2010
|
+
devicePixelRatio: s = 1,
|
|
2011
|
+
samplesPerPixel: o,
|
|
2012
|
+
colorLUT: i,
|
|
2013
|
+
frequencyScaleFn: l,
|
|
2014
|
+
minFrequency: c = 0,
|
|
2015
|
+
maxFrequency: u,
|
|
2016
|
+
workerApi: p,
|
|
2017
|
+
clipId: f,
|
|
2018
|
+
onCanvasesReady: d
|
|
2018
2019
|
}) => {
|
|
2019
|
-
const
|
|
2020
|
-
(
|
|
2021
|
-
if (
|
|
2022
|
-
const
|
|
2023
|
-
|
|
2020
|
+
const v = t ?? e, y = R([]), m = R([]), h = R(/* @__PURE__ */ new WeakSet()), C = !!(p && f), b = E(
|
|
2021
|
+
(A) => {
|
|
2022
|
+
if (A !== null) {
|
|
2023
|
+
const k = parseInt(A.dataset.index, 10);
|
|
2024
|
+
y.current[k] = A;
|
|
2024
2025
|
}
|
|
2025
2026
|
},
|
|
2026
2027
|
[]
|
|
2027
2028
|
);
|
|
2028
2029
|
re(() => {
|
|
2029
|
-
if (!
|
|
2030
|
-
const
|
|
2031
|
-
|
|
2032
|
-
const
|
|
2033
|
-
for (let
|
|
2034
|
-
const
|
|
2035
|
-
if (!
|
|
2036
|
-
const
|
|
2030
|
+
if (!C) return;
|
|
2031
|
+
const A = Math.ceil(r / Et);
|
|
2032
|
+
y.current.length = A;
|
|
2033
|
+
const k = y.current, F = [], B = [];
|
|
2034
|
+
for (let W = 0; W < k.length; W++) {
|
|
2035
|
+
const N = k[W];
|
|
2036
|
+
if (!N || h.current.has(N)) continue;
|
|
2037
|
+
const Y = `${f}-ch${v}-chunk${W}`;
|
|
2037
2038
|
try {
|
|
2038
|
-
const
|
|
2039
|
-
|
|
2040
|
-
} catch (
|
|
2041
|
-
console.warn(`[spectrogram] transferControlToOffscreen failed for ${
|
|
2039
|
+
const z = N.transferControlToOffscreen();
|
|
2040
|
+
p.registerCanvas(Y, z), h.current.add(N), F.push(Y), B.push(Math.min(r - W * Et, Et));
|
|
2041
|
+
} catch (z) {
|
|
2042
|
+
console.warn(`[spectrogram] transferControlToOffscreen failed for ${Y}:`, z);
|
|
2042
2043
|
continue;
|
|
2043
2044
|
}
|
|
2044
2045
|
}
|
|
2045
|
-
return
|
|
2046
|
-
for (const
|
|
2047
|
-
|
|
2048
|
-
|
|
2046
|
+
return m.current = F, F.length > 0 && d && d(F, B), () => {
|
|
2047
|
+
for (const W of m.current)
|
|
2048
|
+
p.unregisterCanvas(W);
|
|
2049
|
+
m.current = [];
|
|
2049
2050
|
};
|
|
2050
|
-
}, [
|
|
2051
|
-
const
|
|
2051
|
+
}, [C, f, v, r]);
|
|
2052
|
+
const g = i ?? vo(), x = u ?? (n ? n.sampleRate / 2 : 22050), S = l ?? ((A, k, F) => (A - k) / (F - k));
|
|
2052
2053
|
Jt(() => {
|
|
2053
|
-
if (
|
|
2054
|
-
const
|
|
2054
|
+
if (C || !n) return;
|
|
2055
|
+
const A = y.current, { frequencyBinCount: k, frameCount: F, hopSize: B, sampleRate: W, gainDb: N, rangeDb: Y } = n, z = Y === 0 ? 1 : Y;
|
|
2055
2056
|
let J = 0;
|
|
2056
|
-
const
|
|
2057
|
-
for (let
|
|
2058
|
-
const
|
|
2059
|
-
if (!H) continue;
|
|
2060
|
-
const Q = H.getContext("2d");
|
|
2057
|
+
const K = (se) => se / k * (W / 2);
|
|
2058
|
+
for (let se = 0; se < A.length; se++) {
|
|
2059
|
+
const Q = A[se];
|
|
2061
2060
|
if (!Q) continue;
|
|
2062
|
-
const
|
|
2063
|
-
|
|
2064
|
-
const
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
const
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2061
|
+
const ie = Q.getContext("2d");
|
|
2062
|
+
if (!ie) continue;
|
|
2063
|
+
const ue = Q.width / s, he = a;
|
|
2064
|
+
ie.resetTransform(), ie.clearRect(0, 0, Q.width, Q.height), ie.imageSmoothingEnabled = !1, ie.scale(s, s);
|
|
2065
|
+
const pe = ie.createImageData(ue, he), De = pe.data;
|
|
2066
|
+
for (let de = 0; de < ue; de++) {
|
|
2067
|
+
const fe = (J + de) * o, U = Math.floor(fe / B);
|
|
2068
|
+
if (U < 0 || U >= F) continue;
|
|
2069
|
+
const q = U * k;
|
|
2070
|
+
for (let ce = 0; ce < he; ce++) {
|
|
2071
|
+
const ve = 1 - ce / he;
|
|
2072
|
+
let ee = Math.floor(ve * k);
|
|
2073
|
+
if (l) {
|
|
2074
|
+
let te = 0, qe = k - 1;
|
|
2075
|
+
for (; te < qe; ) {
|
|
2076
|
+
const Z = te + qe >> 1, be = K(Z);
|
|
2077
|
+
S(be, c, x) < ve ? te = Z + 1 : qe = Z;
|
|
2077
2078
|
}
|
|
2078
|
-
|
|
2079
|
+
ee = te;
|
|
2079
2080
|
}
|
|
2080
|
-
if (
|
|
2081
|
-
const
|
|
2082
|
-
|
|
2081
|
+
if (ee < 0 || ee >= k) continue;
|
|
2082
|
+
const Ze = n.data[q + ee], Ue = Math.max(0, Math.min(1, (Ze + z + N) / z)), tt = Math.floor(Ue * 255), je = (ce * ue + de) * 4;
|
|
2083
|
+
De[je] = g[tt * 3], De[je + 1] = g[tt * 3 + 1], De[je + 2] = g[tt * 3 + 2], De[je + 3] = 255;
|
|
2083
2084
|
}
|
|
2084
2085
|
}
|
|
2085
|
-
if (
|
|
2086
|
-
const
|
|
2087
|
-
|
|
2088
|
-
const
|
|
2089
|
-
if (!
|
|
2090
|
-
|
|
2086
|
+
if (ie.resetTransform(), ie.putImageData(pe, 0, 0), s !== 1) {
|
|
2087
|
+
const de = document.createElement("canvas");
|
|
2088
|
+
de.width = ue, de.height = he;
|
|
2089
|
+
const V = de.getContext("2d");
|
|
2090
|
+
if (!V) continue;
|
|
2091
|
+
V.putImageData(pe, 0, 0), ie.clearRect(0, 0, Q.width, Q.height), ie.imageSmoothingEnabled = !1, ie.drawImage(de, 0, 0, Q.width, Q.height);
|
|
2091
2092
|
}
|
|
2092
|
-
J +=
|
|
2093
|
+
J += ue;
|
|
2093
2094
|
}
|
|
2094
|
-
}, [
|
|
2095
|
-
let
|
|
2096
|
-
const
|
|
2097
|
-
for (;
|
|
2098
|
-
const
|
|
2099
|
-
|
|
2095
|
+
}, [C, n, r, a, s, o, g, l, c, x, S]);
|
|
2096
|
+
let M = r, I = 0;
|
|
2097
|
+
const T = [];
|
|
2098
|
+
for (; M > 0; ) {
|
|
2099
|
+
const A = Math.min(M, Et);
|
|
2100
|
+
T.push(
|
|
2100
2101
|
/* @__PURE__ */ w(
|
|
2101
2102
|
bo,
|
|
2102
2103
|
{
|
|
2103
|
-
$cssWidth:
|
|
2104
|
-
width:
|
|
2105
|
-
height:
|
|
2106
|
-
$waveHeight:
|
|
2107
|
-
"data-index":
|
|
2108
|
-
ref:
|
|
2104
|
+
$cssWidth: A,
|
|
2105
|
+
width: A * s,
|
|
2106
|
+
height: a * s,
|
|
2107
|
+
$waveHeight: a,
|
|
2108
|
+
"data-index": I,
|
|
2109
|
+
ref: b
|
|
2109
2110
|
},
|
|
2110
|
-
`${
|
|
2111
|
+
`${r}-${I}`
|
|
2111
2112
|
)
|
|
2112
|
-
),
|
|
2113
|
+
), M -= A, I++;
|
|
2113
2114
|
}
|
|
2114
|
-
return /* @__PURE__ */ w(go, { $index: e, $cssWidth:
|
|
2115
|
+
return /* @__PURE__ */ w(go, { $index: e, $cssWidth: r, $waveHeight: a, children: T });
|
|
2115
2116
|
}, rr = ({
|
|
2116
2117
|
isSelected: e,
|
|
2117
2118
|
transparentBackground: t,
|
|
@@ -2148,15 +2149,16 @@ var Sn = ({
|
|
|
2148
2149
|
}
|
|
2149
2150
|
);
|
|
2150
2151
|
if (n === "both" && M) {
|
|
2151
|
-
const
|
|
2152
|
-
return /* @__PURE__ */
|
|
2152
|
+
const I = Math.floor(v / 2);
|
|
2153
|
+
return /* @__PURE__ */ le(et, { children: [
|
|
2153
2154
|
/* @__PURE__ */ w(
|
|
2154
2155
|
Sn,
|
|
2155
2156
|
{
|
|
2156
2157
|
index: f.index * 2,
|
|
2158
|
+
channelIndex: f.index,
|
|
2157
2159
|
data: r,
|
|
2158
2160
|
length: f.length,
|
|
2159
|
-
waveHeight:
|
|
2161
|
+
waveHeight: I,
|
|
2160
2162
|
devicePixelRatio: C,
|
|
2161
2163
|
samplesPerPixel: b,
|
|
2162
2164
|
colorLUT: a,
|
|
@@ -2168,7 +2170,7 @@ var Sn = ({
|
|
|
2168
2170
|
onCanvasesReady: p
|
|
2169
2171
|
}
|
|
2170
2172
|
),
|
|
2171
|
-
/* @__PURE__ */ w("div", { style: { position: "absolute", top: (f.index * 2 + 1) *
|
|
2173
|
+
/* @__PURE__ */ w("div", { style: { position: "absolute", top: (f.index * 2 + 1) * I, width: f.length, height: I }, children: /* @__PURE__ */ w(
|
|
2172
2174
|
vn,
|
|
2173
2175
|
{
|
|
2174
2176
|
...f,
|
|
@@ -2176,7 +2178,7 @@ var Sn = ({
|
|
|
2176
2178
|
index: 0,
|
|
2177
2179
|
waveOutlineColor: g,
|
|
2178
2180
|
waveFillColor: x,
|
|
2179
|
-
waveHeight:
|
|
2181
|
+
waveHeight: I,
|
|
2180
2182
|
devicePixelRatio: C,
|
|
2181
2183
|
barWidth: y,
|
|
2182
2184
|
barGap: m,
|
|
@@ -2259,8 +2261,8 @@ var Co = ({
|
|
|
2259
2261
|
for (const b of m) {
|
|
2260
2262
|
const g = n(b, r, a);
|
|
2261
2263
|
if (g < 0 || g > 1) continue;
|
|
2262
|
-
const x = C + p * (1 - g), S = b >= 1e3 ? `${(b / 1e3).toFixed(1)}k` : `${b} Hz`, M = y.measureText(S),
|
|
2263
|
-
y.fillStyle = o, y.fillRect(0, x - 7, M.width +
|
|
2264
|
+
const x = C + p * (1 - g), S = b >= 1e3 ? `${(b / 1e3).toFixed(1)}k` : `${b} Hz`, M = y.measureText(S), I = 3;
|
|
2265
|
+
y.fillStyle = o, y.fillRect(0, x - 7, M.width + I * 2, 14), y.fillStyle = s, y.fillText(S, I, x);
|
|
2264
2266
|
}
|
|
2265
2267
|
}
|
|
2266
2268
|
}, [e, t, n, r, a, s, o, u, p, d]), /* @__PURE__ */ w(yo, { $height: f + d, children: /* @__PURE__ */ w(
|
|
@@ -2355,12 +2357,12 @@ var ko = _.div.attrs((e) => ({
|
|
|
2355
2357
|
for (let b = 0; b < m; b += h * s / 1e3) {
|
|
2356
2358
|
const g = Math.floor(b);
|
|
2357
2359
|
if (C % r === 0) {
|
|
2358
|
-
const x = C, S = So(x), M = o ? /* @__PURE__ */ w(
|
|
2360
|
+
const x = C, S = So(x), M = o ? /* @__PURE__ */ w(Ne.Fragment, { children: o(x, g) }, `timestamp-${C}`) : /* @__PURE__ */ w(Io, { $left: g, children: S }, S);
|
|
2359
2361
|
l.push(M), i.set(g, f);
|
|
2360
2362
|
} else C % a === 0 ? i.set(g, Math.floor(f / 2)) : C % s === 0 && i.set(g, Math.floor(f / 5));
|
|
2361
2363
|
C += s;
|
|
2362
2364
|
}
|
|
2363
|
-
return /* @__PURE__ */
|
|
2365
|
+
return /* @__PURE__ */ le(
|
|
2364
2366
|
ko,
|
|
2365
2367
|
{
|
|
2366
2368
|
$cssWidth: m,
|
|
@@ -2540,7 +2542,7 @@ var ar = ({ renderTimestamp: e }) => {
|
|
|
2540
2542
|
waveHeight: u,
|
|
2541
2543
|
controls: { show: p, width: f }
|
|
2542
2544
|
} = Wt(), d = co();
|
|
2543
|
-
return /* @__PURE__ */
|
|
2545
|
+
return /* @__PURE__ */ le(
|
|
2544
2546
|
Bo,
|
|
2545
2547
|
{
|
|
2546
2548
|
$numChannels: e,
|
|
@@ -2786,7 +2788,7 @@ var ar = ({ renderTimestamp: e }) => {
|
|
|
2786
2788
|
`, Ko = ({
|
|
2787
2789
|
items: e
|
|
2788
2790
|
}) => {
|
|
2789
|
-
const [t, n] =
|
|
2791
|
+
const [t, n] = H(!1), a = typeof e == "function" ? e(() => n(!1)) : e, [s, o] = H({ top: 0, left: 0 }), i = R(null), l = R(null);
|
|
2790
2792
|
return re(() => {
|
|
2791
2793
|
if (t && i.current) {
|
|
2792
2794
|
const c = i.current.getBoundingClientRect();
|
|
@@ -2802,7 +2804,7 @@ var ar = ({ renderTimestamp: e }) => {
|
|
|
2802
2804
|
i.current && !i.current.contains(p) && l.current && !l.current.contains(p) && n(!1);
|
|
2803
2805
|
};
|
|
2804
2806
|
return document.addEventListener("mousedown", c), () => document.removeEventListener("mousedown", c);
|
|
2805
|
-
}, [t]), /* @__PURE__ */
|
|
2807
|
+
}, [t]), /* @__PURE__ */ le(Oo, { children: [
|
|
2806
2808
|
/* @__PURE__ */ w(
|
|
2807
2809
|
Go,
|
|
2808
2810
|
{
|
|
@@ -2824,7 +2826,7 @@ var ar = ({ renderTimestamp: e }) => {
|
|
|
2824
2826
|
$top: s.top,
|
|
2825
2827
|
$left: s.left,
|
|
2826
2828
|
onMouseDown: (c) => c.stopPropagation(),
|
|
2827
|
-
children: a.map((c, u) => /* @__PURE__ */
|
|
2829
|
+
children: a.map((c, u) => /* @__PURE__ */ le(Ne.Fragment, { children: [
|
|
2828
2830
|
u > 0 && /* @__PURE__ */ w(Yo, {}),
|
|
2829
2831
|
c.content
|
|
2830
2832
|
] }, c.id))
|
|
@@ -2931,8 +2933,8 @@ function rs(e, t) {
|
|
|
2931
2933
|
return r > 0 && n++, n;
|
|
2932
2934
|
}
|
|
2933
2935
|
function as(e) {
|
|
2934
|
-
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(
|
|
2935
|
-
return new Float32Array(
|
|
2936
|
+
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(k) {
|
|
2937
|
+
return new Float32Array(k);
|
|
2936
2938
|
}), i = r ? o.length : 1, l = 24, c = rs(a, t), u = e.bits === 8 ? 1 : 2, p = l + c * 2 * u * i, f = new ArrayBuffer(p), d = new DataView(f), v = 0, y = l, m = new Array(i), h = new Array(i), C = 0; C < i; C++)
|
|
2937
2939
|
m[C] = 1 / 0, h[C] = -1 / 0;
|
|
2938
2940
|
var b = e.bits === 8 ? es : ns, g = e.bits === 8 ? Qo : ts;
|
|
@@ -2944,17 +2946,17 @@ function as(e) {
|
|
|
2944
2946
|
S += o[M][x];
|
|
2945
2947
|
S = Math.floor(g * S * n / o.length), S < m[0] && (m[0] = S, m[0] < b && (m[0] = b)), S > h[0] && (h[0] = S, h[0] > g && (h[0] = g));
|
|
2946
2948
|
} else
|
|
2947
|
-
for (var
|
|
2948
|
-
S = Math.floor(g * o[
|
|
2949
|
+
for (var I = 0; I < i; ++I)
|
|
2950
|
+
S = Math.floor(g * o[I][x] * n), S < m[I] && (m[I] = S, m[I] < b && (m[I] = b)), S > h[I] && (h[I] = S, h[I] > g && (h[I] = g));
|
|
2949
2951
|
if (++v === t) {
|
|
2950
|
-
for (var
|
|
2951
|
-
e.bits === 8 ? (d.setInt8(y++, m[
|
|
2952
|
+
for (var T = 0; T < i; T++)
|
|
2953
|
+
e.bits === 8 ? (d.setInt8(y++, m[T]), d.setInt8(y++, h[T])) : (d.setInt16(y, m[T], !0), d.setInt16(y + 2, h[T], !0), y += 4), m[T] = 1 / 0, h[T] = -1 / 0;
|
|
2952
2954
|
v = 0;
|
|
2953
2955
|
}
|
|
2954
2956
|
}
|
|
2955
2957
|
if (v > 0)
|
|
2956
|
-
for (var
|
|
2957
|
-
e.bits === 8 ? (d.setInt8(y++, m[
|
|
2958
|
+
for (var A = 0; A < i; A++)
|
|
2959
|
+
e.bits === 8 ? (d.setInt8(y++, m[A]), d.setInt8(y++, h[A])) : (d.setInt16(y, m[A], !0), d.setInt16(y + 2, h[A], !0));
|
|
2958
2960
|
return f;
|
|
2959
2961
|
}
|
|
2960
2962
|
function Ft(e) {
|
|
@@ -3011,7 +3013,7 @@ function us(e, t, n) {
|
|
|
3011
3013
|
};
|
|
3012
3014
|
}
|
|
3013
3015
|
var ds = /* @__PURE__ */ us("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICd1c2Ugc3RyaWN0JzsKCiAgLyoqCiAgICogQXVkaW9CdWZmZXItYmFzZWQgV2F2ZWZvcm1EYXRhIGdlbmVyYXRvcgogICAqCiAgICogQWRhcHRlZCBmcm9tIEJsb2NrRmlsZTo6Q2FsY1N1bW1hcnkgaW4gQXVkYWNpdHksIHdpdGggcGVybWlzc2lvbi4KICAgKiBTZWUgaHR0cHM6Ly9naXRodWIuY29tL2F1ZGFjaXR5L2F1ZGFjaXR5L2Jsb2IvCiAgICogICAxMTA4YzEzNzZjMDkxNjYxNjIzMzVmYWI0NzQzMDA4Y2JhNTdjNGVlL3NyYy9CbG9ja0ZpbGUuY3BwI0wxOTgKICAgKi8KCiAgdmFyIElOVDhfTUFYID0gMTI3OwogIHZhciBJTlQ4X01JTiA9IC0xMjg7CiAgdmFyIElOVDE2X01BWCA9IDMyNzY3OwogIHZhciBJTlQxNl9NSU4gPSAtMzI3Njg7CiAgZnVuY3Rpb24gY2FsY3VsYXRlV2F2ZWZvcm1EYXRhTGVuZ3RoKGF1ZGlvX3NhbXBsZV9jb3VudCwgc2NhbGUpIHsKICAgIHZhciBkYXRhX2xlbmd0aCA9IE1hdGguZmxvb3IoYXVkaW9fc2FtcGxlX2NvdW50IC8gc2NhbGUpOwogICAgdmFyIHNhbXBsZXNfcmVtYWluaW5nID0gYXVkaW9fc2FtcGxlX2NvdW50IC0gZGF0YV9sZW5ndGggKiBzY2FsZTsKICAgIGlmIChzYW1wbGVzX3JlbWFpbmluZyA+IDApIHsKICAgICAgZGF0YV9sZW5ndGgrKzsKICAgIH0KICAgIHJldHVybiBkYXRhX2xlbmd0aDsKICB9CiAgZnVuY3Rpb24gZ2VuZXJhdGVXYXZlZm9ybURhdGEob3B0aW9ucykgewogICAgdmFyIHNjYWxlID0gb3B0aW9ucy5zY2FsZTsKICAgIHZhciBhbXBsaXR1ZGVfc2NhbGUgPSBvcHRpb25zLmFtcGxpdHVkZV9zY2FsZTsKICAgIHZhciBzcGxpdF9jaGFubmVscyA9IG9wdGlvbnMuc3BsaXRfY2hhbm5lbHM7CiAgICB2YXIgbGVuZ3RoID0gb3B0aW9ucy5sZW5ndGg7CiAgICB2YXIgc2FtcGxlX3JhdGUgPSBvcHRpb25zLnNhbXBsZV9yYXRlOwogICAgdmFyIGNoYW5uZWxzID0gb3B0aW9ucy5jaGFubmVscy5tYXAoZnVuY3Rpb24gKGNoYW5uZWwpIHsKICAgICAgcmV0dXJuIG5ldyBGbG9hdDMyQXJyYXkoY2hhbm5lbCk7CiAgICB9KTsKICAgIHZhciBvdXRwdXRfY2hhbm5lbHMgPSBzcGxpdF9jaGFubmVscyA/IGNoYW5uZWxzLmxlbmd0aCA6IDE7CiAgICB2YXIgaGVhZGVyX3NpemUgPSAyNDsKICAgIHZhciBkYXRhX2xlbmd0aCA9IGNhbGN1bGF0ZVdhdmVmb3JtRGF0YUxlbmd0aChsZW5ndGgsIHNjYWxlKTsKICAgIHZhciBieXRlc19wZXJfc2FtcGxlID0gb3B0aW9ucy5iaXRzID09PSA4ID8gMSA6IDI7CiAgICB2YXIgdG90YWxfc2l6ZSA9IGhlYWRlcl9zaXplICsgZGF0YV9sZW5ndGggKiAyICogYnl0ZXNfcGVyX3NhbXBsZSAqIG91dHB1dF9jaGFubmVsczsKICAgIHZhciBidWZmZXIgPSBuZXcgQXJyYXlCdWZmZXIodG90YWxfc2l6ZSk7CiAgICB2YXIgZGF0YV92aWV3ID0gbmV3IERhdGFWaWV3KGJ1ZmZlcik7CiAgICB2YXIgc2NhbGVfY291bnRlciA9IDA7CiAgICB2YXIgb2Zmc2V0ID0gaGVhZGVyX3NpemU7CiAgICB2YXIgbWluX3ZhbHVlID0gbmV3IEFycmF5KG91dHB1dF9jaGFubmVscyk7CiAgICB2YXIgbWF4X3ZhbHVlID0gbmV3IEFycmF5KG91dHB1dF9jaGFubmVscyk7CiAgICBmb3IgKHZhciBjaGFubmVsID0gMDsgY2hhbm5lbCA8IG91dHB1dF9jaGFubmVsczsgY2hhbm5lbCsrKSB7CiAgICAgIG1pbl92YWx1ZVtjaGFubmVsXSA9IEluZmluaXR5OwogICAgICBtYXhfdmFsdWVbY2hhbm5lbF0gPSAtSW5maW5pdHk7CiAgICB9CiAgICB2YXIgcmFuZ2VfbWluID0gb3B0aW9ucy5iaXRzID09PSA4ID8gSU5UOF9NSU4gOiBJTlQxNl9NSU47CiAgICB2YXIgcmFuZ2VfbWF4ID0gb3B0aW9ucy5iaXRzID09PSA4ID8gSU5UOF9NQVggOiBJTlQxNl9NQVg7CiAgICBkYXRhX3ZpZXcuc2V0SW50MzIoMCwgMiwgdHJ1ZSk7IC8vIFZlcnNpb24KICAgIGRhdGFfdmlldy5zZXRVaW50MzIoNCwgb3B0aW9ucy5iaXRzID09PSA4LCB0cnVlKTsgLy8gSXMgOCBiaXQ/CiAgICBkYXRhX3ZpZXcuc2V0SW50MzIoOCwgc2FtcGxlX3JhdGUsIHRydWUpOyAvLyBTYW1wbGUgcmF0ZQogICAgZGF0YV92aWV3LnNldEludDMyKDEyLCBzY2FsZSwgdHJ1ZSk7IC8vIFNjYWxlCiAgICBkYXRhX3ZpZXcuc2V0SW50MzIoMTYsIGRhdGFfbGVuZ3RoLCB0cnVlKTsgLy8gTGVuZ3RoCiAgICBkYXRhX3ZpZXcuc2V0SW50MzIoMjAsIG91dHB1dF9jaGFubmVscywgdHJ1ZSk7CiAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKSB7CiAgICAgIHZhciBzYW1wbGUgPSAwOwogICAgICBpZiAob3V0cHV0X2NoYW5uZWxzID09PSAxKSB7CiAgICAgICAgZm9yICh2YXIgX2NoYW5uZWwgPSAwOyBfY2hhbm5lbCA8IGNoYW5uZWxzLmxlbmd0aDsgKytfY2hhbm5lbCkgewogICAgICAgICAgc2FtcGxlICs9IGNoYW5uZWxzW19jaGFubmVsXVtpXTsKICAgICAgICB9CiAgICAgICAgc2FtcGxlID0gTWF0aC5mbG9vcihyYW5nZV9tYXggKiBzYW1wbGUgKiBhbXBsaXR1ZGVfc2NhbGUgLyBjaGFubmVscy5sZW5ndGgpOwogICAgICAgIGlmIChzYW1wbGUgPCBtaW5fdmFsdWVbMF0pIHsKICAgICAgICAgIG1pbl92YWx1ZVswXSA9IHNhbXBsZTsKICAgICAgICAgIGlmIChtaW5fdmFsdWVbMF0gPCByYW5nZV9taW4pIHsKICAgICAgICAgICAgbWluX3ZhbHVlWzBdID0gcmFuZ2VfbWluOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoc2FtcGxlID4gbWF4X3ZhbHVlWzBdKSB7CiAgICAgICAgICBtYXhfdmFsdWVbMF0gPSBzYW1wbGU7CiAgICAgICAgICBpZiAobWF4X3ZhbHVlWzBdID4gcmFuZ2VfbWF4KSB7CiAgICAgICAgICAgIG1heF92YWx1ZVswXSA9IHJhbmdlX21heDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZm9yICh2YXIgX2NoYW5uZWwyID0gMDsgX2NoYW5uZWwyIDwgb3V0cHV0X2NoYW5uZWxzOyArK19jaGFubmVsMikgewogICAgICAgICAgc2FtcGxlID0gTWF0aC5mbG9vcihyYW5nZV9tYXggKiBjaGFubmVsc1tfY2hhbm5lbDJdW2ldICogYW1wbGl0dWRlX3NjYWxlKTsKICAgICAgICAgIGlmIChzYW1wbGUgPCBtaW5fdmFsdWVbX2NoYW5uZWwyXSkgewogICAgICAgICAgICBtaW5fdmFsdWVbX2NoYW5uZWwyXSA9IHNhbXBsZTsKICAgICAgICAgICAgaWYgKG1pbl92YWx1ZVtfY2hhbm5lbDJdIDwgcmFuZ2VfbWluKSB7CiAgICAgICAgICAgICAgbWluX3ZhbHVlW19jaGFubmVsMl0gPSByYW5nZV9taW47CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzYW1wbGUgPiBtYXhfdmFsdWVbX2NoYW5uZWwyXSkgewogICAgICAgICAgICBtYXhfdmFsdWVbX2NoYW5uZWwyXSA9IHNhbXBsZTsKICAgICAgICAgICAgaWYgKG1heF92YWx1ZVtfY2hhbm5lbDJdID4gcmFuZ2VfbWF4KSB7CiAgICAgICAgICAgICAgbWF4X3ZhbHVlW19jaGFubmVsMl0gPSByYW5nZV9tYXg7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgaWYgKCsrc2NhbGVfY291bnRlciA9PT0gc2NhbGUpIHsKICAgICAgICBmb3IgKHZhciBfY2hhbm5lbDMgPSAwOyBfY2hhbm5lbDMgPCBvdXRwdXRfY2hhbm5lbHM7IF9jaGFubmVsMysrKSB7CiAgICAgICAgICBpZiAob3B0aW9ucy5iaXRzID09PSA4KSB7CiAgICAgICAgICAgIGRhdGFfdmlldy5zZXRJbnQ4KG9mZnNldCsrLCBtaW5fdmFsdWVbX2NoYW5uZWwzXSk7CiAgICAgICAgICAgIGRhdGFfdmlldy5zZXRJbnQ4KG9mZnNldCsrLCBtYXhfdmFsdWVbX2NoYW5uZWwzXSk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBkYXRhX3ZpZXcuc2V0SW50MTYob2Zmc2V0LCBtaW5fdmFsdWVbX2NoYW5uZWwzXSwgdHJ1ZSk7CiAgICAgICAgICAgIGRhdGFfdmlldy5zZXRJbnQxNihvZmZzZXQgKyAyLCBtYXhfdmFsdWVbX2NoYW5uZWwzXSwgdHJ1ZSk7CiAgICAgICAgICAgIG9mZnNldCArPSA0OwogICAgICAgICAgfQogICAgICAgICAgbWluX3ZhbHVlW19jaGFubmVsM10gPSBJbmZpbml0eTsKICAgICAgICAgIG1heF92YWx1ZVtfY2hhbm5lbDNdID0gLUluZmluaXR5OwogICAgICAgIH0KICAgICAgICBzY2FsZV9jb3VudGVyID0gMDsKICAgICAgfQogICAgfQogICAgaWYgKHNjYWxlX2NvdW50ZXIgPiAwKSB7CiAgICAgIGZvciAodmFyIF9jaGFubmVsNCA9IDA7IF9jaGFubmVsNCA8IG91dHB1dF9jaGFubmVsczsgX2NoYW5uZWw0KyspIHsKICAgICAgICBpZiAob3B0aW9ucy5iaXRzID09PSA4KSB7CiAgICAgICAgICBkYXRhX3ZpZXcuc2V0SW50OChvZmZzZXQrKywgbWluX3ZhbHVlW19jaGFubmVsNF0pOwogICAgICAgICAgZGF0YV92aWV3LnNldEludDgob2Zmc2V0KyssIG1heF92YWx1ZVtfY2hhbm5lbDRdKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgZGF0YV92aWV3LnNldEludDE2KG9mZnNldCwgbWluX3ZhbHVlW19jaGFubmVsNF0sIHRydWUpOwogICAgICAgICAgZGF0YV92aWV3LnNldEludDE2KG9mZnNldCArIDIsIG1heF92YWx1ZVtfY2hhbm5lbDRdLCB0cnVlKTsKICAgICAgICB9CiAgICAgIH0KICAgIH0KICAgIHJldHVybiBidWZmZXI7CiAgfQoKICBvbm1lc3NhZ2UgPSBmdW5jdGlvbiBvbm1lc3NhZ2UoZXZ0KSB7CiAgICB2YXIgYnVmZmVyID0gZ2VuZXJhdGVXYXZlZm9ybURhdGEoZXZ0LmRhdGEpOwoKICAgIC8vIFRyYW5zZmVyIGJ1ZmZlciB0byB0aGUgY2FsbGluZyB0aHJlYWQKICAgIHRoaXMucG9zdE1lc3NhZ2UoYnVmZmVyLCBbYnVmZmVyXSk7CiAgICB0aGlzLmNsb3NlKCk7CiAgfTsKCn0pKCk7Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPXdhdmVmb3JtLWRhdGEtd29ya2VyLmpzLm1hcAoK");
|
|
3014
|
-
function
|
|
3016
|
+
function Ye(e) {
|
|
3015
3017
|
if (os(e) && (e = is(e)), ss(e)) {
|
|
3016
3018
|
this._data = new DataView(e), this._offset = this._version() === 2 ? 24 : 20, this._channels = [];
|
|
3017
3019
|
for (var t = 0; t < this.channels; t++)
|
|
@@ -3053,11 +3055,11 @@ function ir(e, t, n) {
|
|
|
3053
3055
|
sample_rate: e.sampleRate,
|
|
3054
3056
|
channels: r
|
|
3055
3057
|
});
|
|
3056
|
-
n(void 0, new
|
|
3058
|
+
n(void 0, new Ye(a), e);
|
|
3057
3059
|
} else {
|
|
3058
3060
|
var s = new ds();
|
|
3059
3061
|
s.onmessage = function(o) {
|
|
3060
|
-
n(void 0, new
|
|
3062
|
+
n(void 0, new Ye(o.data), e);
|
|
3061
3063
|
}, s.postMessage({
|
|
3062
3064
|
scale: t.scale,
|
|
3063
3065
|
bits: t.bits,
|
|
@@ -3079,10 +3081,10 @@ function hs(e, t, n, r) {
|
|
|
3079
3081
|
}, a);
|
|
3080
3082
|
s && s.catch(a);
|
|
3081
3083
|
}
|
|
3082
|
-
|
|
3083
|
-
return new
|
|
3084
|
+
Ye.create = function(t) {
|
|
3085
|
+
return new Ye(t);
|
|
3084
3086
|
};
|
|
3085
|
-
|
|
3087
|
+
Ye.createFromAudio = function(e, t) {
|
|
3086
3088
|
var n = ms(e);
|
|
3087
3089
|
if (e.audio_context && e.array_buffer)
|
|
3088
3090
|
return hs(e.audio_context, e.array_buffer, n, t);
|
|
@@ -3096,7 +3098,7 @@ Ke.createFromAudio = function(e, t) {
|
|
|
3096
3098
|
function Zt(e) {
|
|
3097
3099
|
this._inputData = e.waveformData, this._output_samples_per_pixel = e.scale, this._scale = this._inputData.scale, this._input_buffer_size = this._inputData.length;
|
|
3098
3100
|
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;
|
|
3099
|
-
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
|
|
3101
|
+
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 Ye(this._output_data), this._input_index = 0, this._output_index = 0;
|
|
3100
3102
|
var o = this._inputData.channels;
|
|
3101
3103
|
this._min = new Array(o), this._max = new Array(o);
|
|
3102
3104
|
for (var i = 0; i < o; ++i)
|
|
@@ -3136,7 +3138,7 @@ Zt.prototype.next = function() {
|
|
|
3136
3138
|
Zt.prototype.getOutputData = function() {
|
|
3137
3139
|
return this._output_data;
|
|
3138
3140
|
};
|
|
3139
|
-
|
|
3141
|
+
Ye.prototype = {
|
|
3140
3142
|
_getResampleOptions: function(t) {
|
|
3141
3143
|
var n = {};
|
|
3142
3144
|
if (n.scale = t.scale, n.width = t.width, !bt(n.width) && (typeof n.width != "number" || n.width <= 0))
|
|
@@ -3153,7 +3155,7 @@ Ke.prototype = {
|
|
|
3153
3155
|
t = this._getResampleOptions(t), t.waveformData = this;
|
|
3154
3156
|
for (var n = new Zt(t); !n.next(); )
|
|
3155
3157
|
;
|
|
3156
|
-
return new
|
|
3158
|
+
return new Ye(n.getOutputData());
|
|
3157
3159
|
},
|
|
3158
3160
|
/**
|
|
3159
3161
|
* Concatenates with one or more other waveforms, returning a new WaveformData object.
|
|
@@ -3165,7 +3167,7 @@ Ke.prototype = {
|
|
|
3165
3167
|
throw new Error("WaveformData.concat(): Waveforms are incompatible");
|
|
3166
3168
|
});
|
|
3167
3169
|
var r = this._concatBuffers.apply(this, n);
|
|
3168
|
-
return
|
|
3170
|
+
return Ye.create(r);
|
|
3169
3171
|
},
|
|
3170
3172
|
/**
|
|
3171
3173
|
* Returns a new ArrayBuffer with the concatenated waveform.
|
|
@@ -3200,7 +3202,7 @@ Ke.prototype = {
|
|
|
3200
3202
|
var p = this._at(n * this.channels * 2 + u);
|
|
3201
3203
|
this.bits === 8 ? c.setInt8(s + u, p) : c.setInt16(s + u * 2, p, !0);
|
|
3202
3204
|
}
|
|
3203
|
-
return new
|
|
3205
|
+
return new Ye(l);
|
|
3204
3206
|
},
|
|
3205
3207
|
/**
|
|
3206
3208
|
* Returns the data format version number.
|
|
@@ -3319,10 +3321,10 @@ async function lr(e) {
|
|
|
3319
3321
|
throw new Error(`Failed to fetch waveform data: ${t.statusText}`);
|
|
3320
3322
|
if (e.endsWith(".dat")) {
|
|
3321
3323
|
const r = await t.arrayBuffer();
|
|
3322
|
-
return
|
|
3324
|
+
return Ye.create(r);
|
|
3323
3325
|
} else {
|
|
3324
3326
|
const r = await t.json();
|
|
3325
|
-
return
|
|
3327
|
+
return Ye.create(r);
|
|
3326
3328
|
}
|
|
3327
3329
|
}
|
|
3328
3330
|
function ps(e, t = 0) {
|
|
@@ -3364,7 +3366,7 @@ function cr(e, t, n = 0, r, a) {
|
|
|
3364
3366
|
return { data: p, bits: i, length: u };
|
|
3365
3367
|
}
|
|
3366
3368
|
function gs() {
|
|
3367
|
-
const [e, t] =
|
|
3369
|
+
const [e, t] = H("hh:mm:ss.uuu");
|
|
3368
3370
|
return {
|
|
3369
3371
|
timeFormat: e,
|
|
3370
3372
|
setTimeFormat: t,
|
|
@@ -3377,12 +3379,12 @@ function vs({
|
|
|
3377
3379
|
initialSamplesPerPixel: e,
|
|
3378
3380
|
zoomLevels: t = bs
|
|
3379
3381
|
}) {
|
|
3380
|
-
const [n, r] =
|
|
3382
|
+
const [n, r] = H(() => {
|
|
3381
3383
|
const c = t.indexOf(e);
|
|
3382
3384
|
return c !== -1 ? c : Math.floor(t.length / 2);
|
|
3383
|
-
}), a = t[n], s = n > 0, o = n < t.length - 1, i =
|
|
3385
|
+
}), a = t[n], s = n > 0, o = n < t.length - 1, i = E(() => {
|
|
3384
3386
|
r((c) => Math.max(0, c - 1));
|
|
3385
|
-
}, []), l =
|
|
3387
|
+
}, []), l = E(() => {
|
|
3386
3388
|
r((c) => Math.min(t.length - 1, c + 1));
|
|
3387
3389
|
}, [t.length]);
|
|
3388
3390
|
return {
|
|
@@ -3398,7 +3400,7 @@ function ys({
|
|
|
3398
3400
|
initialVolume: t = 1,
|
|
3399
3401
|
onVolumeChange: n
|
|
3400
3402
|
}) {
|
|
3401
|
-
const [r, a] =
|
|
3403
|
+
const [r, a] = H(t), s = E((o) => {
|
|
3402
3404
|
a(o), e.current && e.current.setMasterGain(o), n?.(o);
|
|
3403
3405
|
}, [e, n]);
|
|
3404
3406
|
return {
|
|
@@ -3407,7 +3409,7 @@ function ys({
|
|
|
3407
3409
|
};
|
|
3408
3410
|
}
|
|
3409
3411
|
const li = (e = 256) => {
|
|
3410
|
-
const t = R(null), n =
|
|
3412
|
+
const t = R(null), n = E((r, a, s) => {
|
|
3411
3413
|
const o = new Wn("fft", e);
|
|
3412
3414
|
return r.connect(o), r.connect(a), t.current = o, function() {
|
|
3413
3415
|
o.dispose(), t.current = null;
|
|
@@ -3514,7 +3516,7 @@ function ur() {
|
|
|
3514
3516
|
return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
3515
3517
|
}
|
|
3516
3518
|
function ci(e, t = {}) {
|
|
3517
|
-
const { progressive: n = !1 } = t, [r, a] =
|
|
3519
|
+
const { progressive: n = !1 } = t, [r, a] = H([]), [s, o] = H(!0), [i, l] = H(null), [c, u] = H(0), p = e.length;
|
|
3518
3520
|
return re(() => {
|
|
3519
3521
|
if (e.length === 0) {
|
|
3520
3522
|
a([]), o(!1), u(0);
|
|
@@ -3560,16 +3562,16 @@ function ci(e, t = {}) {
|
|
|
3560
3562
|
o(!0), l(null), u(0);
|
|
3561
3563
|
const m = Vr.getContext().rawContext, h = e.map(async (b, g) => {
|
|
3562
3564
|
if (b.audioBuffer) {
|
|
3563
|
-
const
|
|
3564
|
-
return n && !f && (d.set(g,
|
|
3565
|
-
Array.from({ length: e.length }, (
|
|
3566
|
-
)),
|
|
3565
|
+
const T = v(b, g, b.audioBuffer);
|
|
3566
|
+
return n && !f && (d.set(g, T), u((A) => A + 1), a(
|
|
3567
|
+
Array.from({ length: e.length }, (A, k) => d.get(k)).filter((A) => A !== void 0)
|
|
3568
|
+
)), T;
|
|
3567
3569
|
}
|
|
3568
3570
|
if (!b.src && b.waveformData) {
|
|
3569
|
-
const
|
|
3570
|
-
return n && !f && (d.set(g,
|
|
3571
|
-
Array.from({ length: e.length }, (
|
|
3572
|
-
)),
|
|
3571
|
+
const T = v(b, g);
|
|
3572
|
+
return n && !f && (d.set(g, T), u((A) => A + 1), a(
|
|
3573
|
+
Array.from({ length: e.length }, (A, k) => d.get(k)).filter((A) => A !== void 0)
|
|
3574
|
+
)), T;
|
|
3573
3575
|
}
|
|
3574
3576
|
if (!b.src)
|
|
3575
3577
|
throw new Error(`Track ${g + 1}: Must provide src, audioBuffer, or waveformData`);
|
|
@@ -3579,10 +3581,10 @@ function ci(e, t = {}) {
|
|
|
3579
3581
|
const S = await x.arrayBuffer(), M = await m.decodeAudioData(S);
|
|
3580
3582
|
if (!M || !M.sampleRate || !M.duration)
|
|
3581
3583
|
throw new Error(`Invalid audio buffer for ${b.src}`);
|
|
3582
|
-
const
|
|
3583
|
-
return n && !f && (d.set(g,
|
|
3584
|
-
Array.from({ length: e.length }, (
|
|
3585
|
-
)),
|
|
3584
|
+
const I = v(b, g, M);
|
|
3585
|
+
return n && !f && (d.set(g, I), u((T) => T + 1), a(
|
|
3586
|
+
Array.from({ length: e.length }, (T, A) => d.get(A)).filter((T) => T !== void 0)
|
|
3587
|
+
)), I;
|
|
3586
3588
|
}), C = await Promise.all(h);
|
|
3587
3589
|
f || (n || (a(C), u(C.length)), o(!1));
|
|
3588
3590
|
} catch (m) {
|
|
@@ -3602,7 +3604,7 @@ function ui({
|
|
|
3602
3604
|
samplesPerPixel: n,
|
|
3603
3605
|
sampleRate: r
|
|
3604
3606
|
}) {
|
|
3605
|
-
const a =
|
|
3607
|
+
const a = Ne.useRef(null), s = Ne.useCallback(
|
|
3606
3608
|
(c) => {
|
|
3607
3609
|
const { transform: u, active: p } = c;
|
|
3608
3610
|
if (!p?.data?.current) return { ...u, scaleX: 1, scaleY: 1 };
|
|
@@ -3615,28 +3617,28 @@ function ui({
|
|
|
3615
3617
|
if (!m) return { ...u, scaleX: 1, scaleY: 1 };
|
|
3616
3618
|
const h = m.startSample / r, C = m.durationSamples / r, b = u.x * n / r;
|
|
3617
3619
|
let g = h + b;
|
|
3618
|
-
const x = [...y.clips].sort((
|
|
3620
|
+
const x = [...y.clips].sort((k, F) => k.startSample - F.startSample), S = x.findIndex((k) => k === m);
|
|
3619
3621
|
g = Math.max(0, g);
|
|
3620
3622
|
const M = S > 0 ? x[S - 1] : null;
|
|
3621
3623
|
if (M) {
|
|
3622
|
-
const
|
|
3623
|
-
g = Math.max(g,
|
|
3624
|
+
const k = (M.startSample + M.durationSamples) / r;
|
|
3625
|
+
g = Math.max(g, k);
|
|
3624
3626
|
}
|
|
3625
|
-
const
|
|
3626
|
-
if (
|
|
3627
|
-
const
|
|
3628
|
-
|
|
3627
|
+
const I = S < x.length - 1 ? x[S + 1] : null;
|
|
3628
|
+
if (I) {
|
|
3629
|
+
const k = g + C, F = I.startSample / r;
|
|
3630
|
+
k > F && (g = F - C);
|
|
3629
3631
|
}
|
|
3630
|
-
const
|
|
3632
|
+
const A = (g - h) * r / n;
|
|
3631
3633
|
return {
|
|
3632
3634
|
...u,
|
|
3633
|
-
x:
|
|
3635
|
+
x: A,
|
|
3634
3636
|
scaleX: 1,
|
|
3635
3637
|
scaleY: 1
|
|
3636
3638
|
};
|
|
3637
3639
|
},
|
|
3638
3640
|
[e, n, r]
|
|
3639
|
-
), o =
|
|
3641
|
+
), o = Ne.useCallback(
|
|
3640
3642
|
(c) => {
|
|
3641
3643
|
const { active: u } = c, { boundary: p } = u.data.current;
|
|
3642
3644
|
if (!p) {
|
|
@@ -3651,40 +3653,40 @@ function ui({
|
|
|
3651
3653
|
});
|
|
3652
3654
|
},
|
|
3653
3655
|
[e]
|
|
3654
|
-
), i =
|
|
3656
|
+
), i = Ne.useCallback(
|
|
3655
3657
|
(c) => {
|
|
3656
3658
|
const { active: u, delta: p } = c, { boundary: f } = u.data.current;
|
|
3657
3659
|
if (!f || !a.current) return;
|
|
3658
3660
|
const { trackIndex: d, clipIndex: v } = u.data.current, y = p.x * n, m = Math.floor(0.1 * r), h = a.current, C = e.map((b, g) => {
|
|
3659
3661
|
if (g !== d) return b;
|
|
3660
|
-
const x = [...b.clips].sort((
|
|
3661
|
-
if (
|
|
3662
|
-
const
|
|
3662
|
+
const x = [...b.clips].sort((I, T) => I.startSample - T.startSample), S = x.findIndex((I) => I === b.clips[v]), M = b.clips.map((I, T) => {
|
|
3663
|
+
if (T !== v) return I;
|
|
3664
|
+
const A = I.sourceDurationSamples;
|
|
3663
3665
|
if (f === "left") {
|
|
3664
|
-
let
|
|
3666
|
+
let k = Math.floor(y);
|
|
3665
3667
|
const F = -h.startSample;
|
|
3666
|
-
|
|
3668
|
+
k < F && (k = F);
|
|
3667
3669
|
const B = -h.offsetSamples;
|
|
3668
|
-
|
|
3670
|
+
k < B && (k = B);
|
|
3669
3671
|
const W = S > 0 ? x[S - 1] : null;
|
|
3670
3672
|
if (W) {
|
|
3671
|
-
const
|
|
3672
|
-
|
|
3673
|
+
const se = W.startSample + W.durationSamples - h.startSample;
|
|
3674
|
+
k < se && (k = se);
|
|
3673
3675
|
}
|
|
3674
|
-
const
|
|
3675
|
-
|
|
3676
|
-
const
|
|
3676
|
+
const N = h.durationSamples - m;
|
|
3677
|
+
k > N && (k = N);
|
|
3678
|
+
const Y = h.offsetSamples + k, z = h.durationSamples - k, J = h.startSample + k;
|
|
3677
3679
|
return {
|
|
3678
|
-
...
|
|
3679
|
-
offsetSamples:
|
|
3680
|
-
durationSamples:
|
|
3681
|
-
startSample:
|
|
3680
|
+
...I,
|
|
3681
|
+
offsetSamples: Y,
|
|
3682
|
+
durationSamples: z,
|
|
3683
|
+
startSample: J
|
|
3682
3684
|
};
|
|
3683
3685
|
} else {
|
|
3684
|
-
let
|
|
3685
|
-
|
|
3686
|
+
let k = Math.floor(h.durationSamples + y);
|
|
3687
|
+
k = Math.max(m, k), h.offsetSamples + k > A && (k = A - h.offsetSamples);
|
|
3686
3688
|
const F = S < x.length - 1 ? x[S + 1] : null;
|
|
3687
|
-
return F && h.startSample +
|
|
3689
|
+
return F && h.startSample + k > F.startSample && (k = F.startSample - h.startSample, k = Math.max(m, k)), { ...I, durationSamples: k };
|
|
3688
3690
|
}
|
|
3689
3691
|
});
|
|
3690
3692
|
return { ...b, clips: M };
|
|
@@ -3692,7 +3694,7 @@ function ui({
|
|
|
3692
3694
|
t(C);
|
|
3693
3695
|
},
|
|
3694
3696
|
[e, t, n, r]
|
|
3695
|
-
), l =
|
|
3697
|
+
), l = Ne.useCallback(
|
|
3696
3698
|
(c) => {
|
|
3697
3699
|
const { active: u, delta: p } = c, { trackIndex: f, clipIndex: d, boundary: v } = u.data.current, y = p.x * n;
|
|
3698
3700
|
if (v) {
|
|
@@ -3703,17 +3705,17 @@ function ui({
|
|
|
3703
3705
|
if (C !== f) return h;
|
|
3704
3706
|
const b = [...h.clips].sort((S, M) => S.startSample - M.startSample), g = b.findIndex((S) => S === h.clips[d]), x = h.clips.map((S, M) => {
|
|
3705
3707
|
if (M !== d) return S;
|
|
3706
|
-
let
|
|
3707
|
-
|
|
3708
|
-
const
|
|
3709
|
-
if (
|
|
3710
|
-
const
|
|
3711
|
-
|
|
3708
|
+
let I = Math.floor(S.startSample + y);
|
|
3709
|
+
I = Math.max(0, I);
|
|
3710
|
+
const T = g > 0 ? b[g - 1] : null;
|
|
3711
|
+
if (T) {
|
|
3712
|
+
const k = T.startSample + T.durationSamples;
|
|
3713
|
+
I = Math.max(I, k);
|
|
3712
3714
|
}
|
|
3713
|
-
const
|
|
3714
|
-
return
|
|
3715
|
+
const A = g < b.length - 1 ? b[g + 1] : null;
|
|
3716
|
+
return A && I + S.durationSamples > A.startSample && (I = A.startSample - S.durationSamples), {
|
|
3715
3717
|
...S,
|
|
3716
|
-
startSample:
|
|
3718
|
+
startSample: I
|
|
3717
3719
|
};
|
|
3718
3720
|
});
|
|
3719
3721
|
return {
|
|
@@ -3741,7 +3743,7 @@ function xs({
|
|
|
3741
3743
|
duration: a,
|
|
3742
3744
|
linkEndpoints: s
|
|
3743
3745
|
}) {
|
|
3744
|
-
const o =
|
|
3746
|
+
const o = Ne.useRef(null), i = Ne.useCallback(
|
|
3745
3747
|
(u) => {
|
|
3746
3748
|
const { active: p } = u, f = p.data.current;
|
|
3747
3749
|
if (!f || f.annotationIndex === void 0) {
|
|
@@ -3756,7 +3758,7 @@ function xs({
|
|
|
3756
3758
|
});
|
|
3757
3759
|
},
|
|
3758
3760
|
[e]
|
|
3759
|
-
), l =
|
|
3761
|
+
), l = Ne.useCallback(
|
|
3760
3762
|
(u) => {
|
|
3761
3763
|
const { active: p, delta: f } = u;
|
|
3762
3764
|
if (!o.current)
|
|
@@ -3774,7 +3776,7 @@ function xs({
|
|
|
3774
3776
|
t(b);
|
|
3775
3777
|
},
|
|
3776
3778
|
[e, t, n, r, a, s]
|
|
3777
|
-
), c =
|
|
3779
|
+
), c = Ne.useCallback(() => {
|
|
3778
3780
|
o.current = null;
|
|
3779
3781
|
}, []);
|
|
3780
3782
|
return {
|
|
@@ -3890,7 +3892,7 @@ function di(e = {}) {
|
|
|
3890
3892
|
);
|
|
3891
3893
|
}
|
|
3892
3894
|
const mi = (e) => {
|
|
3893
|
-
const { tracks: t, onTracksChange: n, sampleRate: r } = e, { currentTimeRef: a } =
|
|
3895
|
+
const { tracks: t, onTracksChange: n, sampleRate: r } = e, { currentTimeRef: a } = Le(), { selectedTrackId: s } = Xe(), o = E(
|
|
3894
3896
|
(l, c, u) => {
|
|
3895
3897
|
const { sampleRate: p, samplesPerPixel: f } = e, d = t[l];
|
|
3896
3898
|
if (!d) return !1;
|
|
@@ -3899,7 +3901,7 @@ const mi = (e) => {
|
|
|
3899
3901
|
const y = v.startSample / p, m = (v.startSample + v.durationSamples) / p;
|
|
3900
3902
|
if (u <= y || u >= m)
|
|
3901
3903
|
return console.warn("Split time is outside clip bounds"), !1;
|
|
3902
|
-
const h = Math.round(u * p), C = Math.floor(h / f), b = v.startSample + v.durationSamples, g = C * f, x = v.startSample, S = g - x, M = g,
|
|
3904
|
+
const h = Math.round(u * p), C = Math.floor(h / f), b = v.startSample + v.durationSamples, g = C * f, x = v.startSample, S = g - x, M = g, I = b - M, T = g - v.startSample, A = jt({
|
|
3903
3905
|
audioBuffer: v.audioBuffer,
|
|
3904
3906
|
startSample: x,
|
|
3905
3907
|
durationSamples: S,
|
|
@@ -3913,11 +3915,11 @@ const mi = (e) => {
|
|
|
3913
3915
|
waveformData: v.waveformData
|
|
3914
3916
|
// Share waveformData - slicing happens at render time
|
|
3915
3917
|
// Note: fadeOut removed for first clip since it's cut
|
|
3916
|
-
}),
|
|
3918
|
+
}), k = jt({
|
|
3917
3919
|
audioBuffer: v.audioBuffer,
|
|
3918
3920
|
startSample: M,
|
|
3919
|
-
durationSamples:
|
|
3920
|
-
offsetSamples: v.offsetSamples +
|
|
3921
|
+
durationSamples: I,
|
|
3922
|
+
offsetSamples: v.offsetSamples + T,
|
|
3921
3923
|
sampleRate: v.sampleRate,
|
|
3922
3924
|
sourceDurationSamples: v.sourceDurationSamples,
|
|
3923
3925
|
gain: v.gain,
|
|
@@ -3928,7 +3930,7 @@ const mi = (e) => {
|
|
|
3928
3930
|
// Note: fadeIn removed for second clip since it's cut
|
|
3929
3931
|
fadeOut: v.fadeOut
|
|
3930
3932
|
}), F = [...d.clips];
|
|
3931
|
-
F.splice(c, 1,
|
|
3933
|
+
F.splice(c, 1, A, k);
|
|
3932
3934
|
const B = [...t];
|
|
3933
3935
|
return B[l] = {
|
|
3934
3936
|
...d,
|
|
@@ -3938,7 +3940,7 @@ const mi = (e) => {
|
|
|
3938
3940
|
[t, n, e]
|
|
3939
3941
|
);
|
|
3940
3942
|
return {
|
|
3941
|
-
splitClipAtPlayhead:
|
|
3943
|
+
splitClipAtPlayhead: E(() => {
|
|
3942
3944
|
if (!s)
|
|
3943
3945
|
return console.log("No track selected - click a clip to select a track first"), !1;
|
|
3944
3946
|
const l = t.findIndex((p) => p.id === s);
|
|
@@ -3955,7 +3957,7 @@ const mi = (e) => {
|
|
|
3955
3957
|
splitClipAt: o
|
|
3956
3958
|
};
|
|
3957
3959
|
}, qt = (e) => {
|
|
3958
|
-
const { shortcuts: t, enabled: n = !0 } = e, r =
|
|
3960
|
+
const { shortcuts: t, enabled: n = !0 } = e, r = E(
|
|
3959
3961
|
(a) => {
|
|
3960
3962
|
if (!n) return;
|
|
3961
3963
|
const s = a.target;
|
|
@@ -3979,11 +3981,11 @@ const mi = (e) => {
|
|
|
3979
3981
|
const t = [], n = typeof navigator < "u" && navigator.platform.includes("Mac");
|
|
3980
3982
|
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("+");
|
|
3981
3983
|
}, hi = (e = {}) => {
|
|
3982
|
-
const { enabled: t = !0, additionalShortcuts: n = [], shortcuts: r } = e, { isPlaying: a } =
|
|
3984
|
+
const { enabled: t = !0, additionalShortcuts: n = [], shortcuts: r } = e, { isPlaying: a } = Le(), { setCurrentTime: s, play: o, pause: i, stop: l } = Ce(), { playoutRef: c } = Be(), u = E(() => {
|
|
3983
3985
|
a ? i() : o();
|
|
3984
|
-
}, [a, o, i]), p =
|
|
3986
|
+
}, [a, o, i]), p = E(() => {
|
|
3985
3987
|
l();
|
|
3986
|
-
}, [l]), f =
|
|
3988
|
+
}, [l]), f = E(() => {
|
|
3987
3989
|
a && c.current ? (c.current.stop(), s(0), o(0)) : s(0);
|
|
3988
3990
|
}, [a, c, s, o]), v = r ?? [...[
|
|
3989
3991
|
{
|
|
@@ -4030,16 +4032,16 @@ function pi({
|
|
|
4030
4032
|
controlsWidth: p = 0,
|
|
4031
4033
|
onPlay: f
|
|
4032
4034
|
}) {
|
|
4033
|
-
const d =
|
|
4034
|
-
(
|
|
4035
|
+
const d = Qe(() => t ? e.findIndex((T) => T.id === t) : -1, [e, t]), v = E(
|
|
4036
|
+
(T) => {
|
|
4035
4037
|
if (!l?.current || !c || !u) return;
|
|
4036
|
-
const
|
|
4037
|
-
if (!
|
|
4038
|
-
const
|
|
4039
|
-
if (B <
|
|
4040
|
-
const
|
|
4041
|
-
|
|
4042
|
-
left:
|
|
4038
|
+
const A = e.find((K) => K.id === T);
|
|
4039
|
+
if (!A) return;
|
|
4040
|
+
const k = l.current, F = k.clientWidth, B = A.start * u / c + p, W = A.end * u / c + p, N = (B + W) / 2, Y = k.scrollLeft, z = Y, J = Y + F;
|
|
4041
|
+
if (B < z || W > J) {
|
|
4042
|
+
const K = Math.max(0, N - F / 2);
|
|
4043
|
+
k.scrollTo({
|
|
4044
|
+
left: K,
|
|
4043
4045
|
behavior: "smooth"
|
|
4044
4046
|
});
|
|
4045
4047
|
}
|
|
@@ -4049,72 +4051,72 @@ function pi({
|
|
|
4049
4051
|
re(() => {
|
|
4050
4052
|
t && l?.current && c && u && v(t);
|
|
4051
4053
|
}, [t, v, l, c, u]);
|
|
4052
|
-
const y =
|
|
4053
|
-
(
|
|
4054
|
+
const y = E(
|
|
4055
|
+
(T) => {
|
|
4054
4056
|
if (d < 0) return;
|
|
4055
|
-
const
|
|
4057
|
+
const A = e[d], k = Math.max(0, Math.min(A.end - 0.1, A.start + T)), F = k - A.start, B = [...e];
|
|
4056
4058
|
if (B[d] = {
|
|
4057
|
-
...
|
|
4058
|
-
start:
|
|
4059
|
+
...A,
|
|
4060
|
+
start: k
|
|
4059
4061
|
}, s && d > 0) {
|
|
4060
4062
|
const W = B[d - 1];
|
|
4061
|
-
Math.abs(W.end -
|
|
4063
|
+
Math.abs(W.end - A.start) < Nt && (B[d - 1] = {
|
|
4062
4064
|
...W,
|
|
4063
4065
|
end: Math.max(W.start + 0.1, W.end + F)
|
|
4064
4066
|
});
|
|
4065
4067
|
} else if (!s && d > 0) {
|
|
4066
4068
|
const W = B[d - 1];
|
|
4067
|
-
|
|
4069
|
+
k < W.end && (B[d - 1] = {
|
|
4068
4070
|
...W,
|
|
4069
|
-
end:
|
|
4071
|
+
end: k
|
|
4070
4072
|
});
|
|
4071
4073
|
}
|
|
4072
4074
|
n(B);
|
|
4073
4075
|
},
|
|
4074
4076
|
[e, d, s, n]
|
|
4075
|
-
), m =
|
|
4076
|
-
(
|
|
4077
|
+
), m = E(
|
|
4078
|
+
(T) => {
|
|
4077
4079
|
if (d < 0) return;
|
|
4078
|
-
const
|
|
4080
|
+
const A = e[d], k = Math.max(A.start + 0.1, Math.min(a, A.end + T)), F = k - A.end, B = [...e];
|
|
4079
4081
|
if (B[d] = {
|
|
4080
|
-
...
|
|
4081
|
-
end:
|
|
4082
|
+
...A,
|
|
4083
|
+
end: k
|
|
4082
4084
|
}, s && d < e.length - 1) {
|
|
4083
4085
|
const W = B[d + 1];
|
|
4084
|
-
if (Math.abs(W.start -
|
|
4085
|
-
const
|
|
4086
|
+
if (Math.abs(W.start - A.end) < Nt) {
|
|
4087
|
+
const N = Math.min(W.end - 0.1, W.start + F);
|
|
4086
4088
|
B[d + 1] = {
|
|
4087
4089
|
...W,
|
|
4088
|
-
start:
|
|
4090
|
+
start: N
|
|
4089
4091
|
};
|
|
4090
|
-
let
|
|
4091
|
-
for (;
|
|
4092
|
-
const
|
|
4093
|
-
if (Math.abs(
|
|
4094
|
-
const
|
|
4095
|
-
B[
|
|
4096
|
-
...
|
|
4097
|
-
start: Math.min(
|
|
4098
|
-
},
|
|
4092
|
+
let Y = d + 1;
|
|
4093
|
+
for (; Y < B.length - 1; ) {
|
|
4094
|
+
const z = B[Y], J = B[Y + 1];
|
|
4095
|
+
if (Math.abs(J.start - e[Y].end) < Nt) {
|
|
4096
|
+
const K = z.end - e[Y].end;
|
|
4097
|
+
B[Y + 1] = {
|
|
4098
|
+
...J,
|
|
4099
|
+
start: Math.min(J.end - 0.1, J.start + K)
|
|
4100
|
+
}, Y++;
|
|
4099
4101
|
} else
|
|
4100
4102
|
break;
|
|
4101
4103
|
}
|
|
4102
4104
|
}
|
|
4103
4105
|
} else if (!s && d < e.length - 1) {
|
|
4104
4106
|
const W = B[d + 1];
|
|
4105
|
-
if (
|
|
4107
|
+
if (k > W.start) {
|
|
4106
4108
|
B[d + 1] = {
|
|
4107
4109
|
...W,
|
|
4108
|
-
start:
|
|
4110
|
+
start: k
|
|
4109
4111
|
};
|
|
4110
|
-
let
|
|
4111
|
-
for (;
|
|
4112
|
-
const
|
|
4113
|
-
if (
|
|
4114
|
-
B[
|
|
4115
|
-
...
|
|
4116
|
-
start:
|
|
4117
|
-
},
|
|
4112
|
+
let N = d + 1;
|
|
4113
|
+
for (; N < B.length - 1; ) {
|
|
4114
|
+
const Y = B[N], z = B[N + 1];
|
|
4115
|
+
if (Y.end > z.start)
|
|
4116
|
+
B[N + 1] = {
|
|
4117
|
+
...z,
|
|
4118
|
+
start: Y.end
|
|
4119
|
+
}, N++;
|
|
4118
4120
|
else
|
|
4119
4121
|
break;
|
|
4120
4122
|
}
|
|
@@ -4123,21 +4125,21 @@ function pi({
|
|
|
4123
4125
|
n(B);
|
|
4124
4126
|
},
|
|
4125
4127
|
[e, d, a, s, n]
|
|
4126
|
-
), h =
|
|
4128
|
+
), h = E(() => {
|
|
4127
4129
|
!r || e.length === 0 || (d <= 0 ? r(e[e.length - 1].id) : r(e[d - 1].id));
|
|
4128
|
-
}, [e, d, r]), C =
|
|
4130
|
+
}, [e, d, r]), C = E(() => {
|
|
4129
4131
|
!r || e.length === 0 || (d < 0 || d >= e.length - 1 ? r(e[0].id) : r(e[d + 1].id));
|
|
4130
|
-
}, [e, d, r]), b =
|
|
4132
|
+
}, [e, d, r]), b = E(() => {
|
|
4131
4133
|
!r || e.length === 0 || r(e[0].id);
|
|
4132
|
-
}, [e, r]), g =
|
|
4134
|
+
}, [e, r]), g = E(() => {
|
|
4133
4135
|
!r || e.length === 0 || r(e[e.length - 1].id);
|
|
4134
|
-
}, [e, r]), x =
|
|
4136
|
+
}, [e, r]), x = E(() => {
|
|
4135
4137
|
r && r(null);
|
|
4136
|
-
}, [r]), S =
|
|
4138
|
+
}, [r]), S = E(() => {
|
|
4137
4139
|
if (d < 0 || !f) return;
|
|
4138
|
-
const
|
|
4139
|
-
f(
|
|
4140
|
-
}, [e, d, o, f]), M =
|
|
4140
|
+
const T = e[d], A = o ? void 0 : T.end - T.start;
|
|
4141
|
+
f(T.start, A);
|
|
4142
|
+
}, [e, d, o, f]), M = Qe(
|
|
4141
4143
|
() => [
|
|
4142
4144
|
{
|
|
4143
4145
|
key: "[",
|
|
@@ -4173,7 +4175,7 @@ function pi({
|
|
|
4173
4175
|
}
|
|
4174
4176
|
],
|
|
4175
4177
|
[y, m, S]
|
|
4176
|
-
),
|
|
4178
|
+
), I = Qe(
|
|
4177
4179
|
() => [
|
|
4178
4180
|
{
|
|
4179
4181
|
key: "ArrowUp",
|
|
@@ -4224,7 +4226,7 @@ function pi({
|
|
|
4224
4226
|
shortcuts: M,
|
|
4225
4227
|
enabled: i && d >= 0
|
|
4226
4228
|
}), qt({
|
|
4227
|
-
shortcuts:
|
|
4229
|
+
shortcuts: I,
|
|
4228
4230
|
enabled: i && e.length > 0 && !!r
|
|
4229
4231
|
}), {
|
|
4230
4232
|
moveStartBoundary: y,
|
|
@@ -4552,9 +4554,9 @@ function vi(e) {
|
|
|
4552
4554
|
};
|
|
4553
4555
|
}
|
|
4554
4556
|
function yi(e = 256) {
|
|
4555
|
-
const [t, n] =
|
|
4557
|
+
const [t, n] = H([]), r = R(t);
|
|
4556
4558
|
r.current = t;
|
|
4557
|
-
const a = R(/* @__PURE__ */ new Map()), s = R(null), o = R(null), i =
|
|
4559
|
+
const a = R(/* @__PURE__ */ new Map()), s = R(null), o = R(null), i = E((m) => {
|
|
4558
4560
|
const h = o.current;
|
|
4559
4561
|
if (!h) return;
|
|
4560
4562
|
const { masterGainNode: C, destination: b, analyserNode: g } = h;
|
|
@@ -4575,7 +4577,7 @@ function yi(e = 256) {
|
|
|
4575
4577
|
S.connect(M.effect), S = M.effect;
|
|
4576
4578
|
}), S.connect(g), g.connect(b);
|
|
4577
4579
|
}
|
|
4578
|
-
}, []), l =
|
|
4580
|
+
}, []), l = E((m) => {
|
|
4579
4581
|
const h = dr(m);
|
|
4580
4582
|
if (!h) {
|
|
4581
4583
|
console.error(`Unknown effect: ${m}`);
|
|
@@ -4595,10 +4597,10 @@ function yi(e = 256) {
|
|
|
4595
4597
|
bypassed: !1
|
|
4596
4598
|
};
|
|
4597
4599
|
n((x) => [...x, g]);
|
|
4598
|
-
}, []), c =
|
|
4600
|
+
}, []), c = E((m) => {
|
|
4599
4601
|
const h = a.current.get(m);
|
|
4600
4602
|
h && (h.dispose(), a.current.delete(m)), n((C) => C.filter((b) => b.instanceId !== m));
|
|
4601
|
-
}, []), u =
|
|
4603
|
+
}, []), u = E(
|
|
4602
4604
|
(m, h, C) => {
|
|
4603
4605
|
const b = a.current.get(m);
|
|
4604
4606
|
b && b.setParameter(h, C), n(
|
|
@@ -4608,7 +4610,7 @@ function yi(e = 256) {
|
|
|
4608
4610
|
);
|
|
4609
4611
|
},
|
|
4610
4612
|
[]
|
|
4611
|
-
), p =
|
|
4613
|
+
), p = E(
|
|
4612
4614
|
(m) => {
|
|
4613
4615
|
const h = r.current.find((g) => g.instanceId === m);
|
|
4614
4616
|
if (!h) return;
|
|
@@ -4624,18 +4626,18 @@ function yi(e = 256) {
|
|
|
4624
4626
|
);
|
|
4625
4627
|
},
|
|
4626
4628
|
[]
|
|
4627
|
-
), f =
|
|
4629
|
+
), f = E((m, h) => {
|
|
4628
4630
|
n((C) => {
|
|
4629
4631
|
const b = [...C], [g] = b.splice(m, 1);
|
|
4630
4632
|
return b.splice(h, 0, g), b;
|
|
4631
4633
|
});
|
|
4632
|
-
}, []), d =
|
|
4634
|
+
}, []), d = E(() => {
|
|
4633
4635
|
a.current.forEach((m) => m.dispose()), a.current.clear(), n([]);
|
|
4634
4636
|
}, []);
|
|
4635
4637
|
re(() => {
|
|
4636
4638
|
i(t);
|
|
4637
4639
|
}, [t, i]);
|
|
4638
|
-
const v =
|
|
4640
|
+
const v = E(
|
|
4639
4641
|
(m, h, C) => {
|
|
4640
4642
|
const b = new Wn("fft", e);
|
|
4641
4643
|
s.current = b, o.current = {
|
|
@@ -4662,7 +4664,7 @@ function yi(e = 256) {
|
|
|
4662
4664
|
re(() => () => {
|
|
4663
4665
|
a.current.forEach((m) => m.dispose()), a.current.clear();
|
|
4664
4666
|
}, []);
|
|
4665
|
-
const y =
|
|
4667
|
+
const y = E(() => {
|
|
4666
4668
|
const m = t.filter((h) => !h.bypassed);
|
|
4667
4669
|
if (m.length !== 0)
|
|
4668
4670
|
return (h, C, b) => {
|
|
@@ -4699,9 +4701,9 @@ function yi(e = 256) {
|
|
|
4699
4701
|
};
|
|
4700
4702
|
}
|
|
4701
4703
|
function wi() {
|
|
4702
|
-
const [e, t] =
|
|
4704
|
+
const [e, t] = H(
|
|
4703
4705
|
/* @__PURE__ */ new Map()
|
|
4704
|
-
), n = R(/* @__PURE__ */ new Map()), r = R(/* @__PURE__ */ new Map()), a =
|
|
4706
|
+
), n = R(/* @__PURE__ */ new Map()), r = R(/* @__PURE__ */ new Map()), a = E((d, v) => {
|
|
4705
4707
|
const y = r.current.get(d);
|
|
4706
4708
|
if (!y) return;
|
|
4707
4709
|
const { graphEnd: m, masterGainNode: h } = y, C = n.current.get(d);
|
|
@@ -4722,7 +4724,7 @@ function wi() {
|
|
|
4722
4724
|
g.connect(x.effect), g = x.effect;
|
|
4723
4725
|
}), g.connect(h);
|
|
4724
4726
|
}
|
|
4725
|
-
}, []), s =
|
|
4727
|
+
}, []), s = E((d, v) => {
|
|
4726
4728
|
const y = dr(v);
|
|
4727
4729
|
if (!y) {
|
|
4728
4730
|
console.error(`Unknown effect: ${v}`);
|
|
@@ -4745,13 +4747,13 @@ function wi() {
|
|
|
4745
4747
|
const g = new Map(b), x = g.get(d) || [];
|
|
4746
4748
|
return g.set(d, [...x, C]), g;
|
|
4747
4749
|
});
|
|
4748
|
-
}, []), o =
|
|
4750
|
+
}, []), o = E((d, v) => {
|
|
4749
4751
|
const y = n.current.get(d), m = y?.get(v);
|
|
4750
4752
|
m && (m.dispose(), y?.delete(v)), t((h) => {
|
|
4751
4753
|
const C = new Map(h), b = C.get(d) || [];
|
|
4752
4754
|
return C.set(d, b.filter((g) => g.instanceId !== v)), C;
|
|
4753
4755
|
});
|
|
4754
|
-
}, []), i =
|
|
4756
|
+
}, []), i = E(
|
|
4755
4757
|
(d, v, y, m) => {
|
|
4756
4758
|
const C = n.current.get(d)?.get(v);
|
|
4757
4759
|
C && C.setParameter(y, m), t((b) => {
|
|
@@ -4765,7 +4767,7 @@ function wi() {
|
|
|
4765
4767
|
});
|
|
4766
4768
|
},
|
|
4767
4769
|
[]
|
|
4768
|
-
), l =
|
|
4770
|
+
), l = E(
|
|
4769
4771
|
(d, v) => {
|
|
4770
4772
|
const m = (u.current.get(d) || []).find((g) => g.instanceId === v);
|
|
4771
4773
|
if (!m) return;
|
|
@@ -4785,7 +4787,7 @@ function wi() {
|
|
|
4785
4787
|
});
|
|
4786
4788
|
},
|
|
4787
4789
|
[]
|
|
4788
|
-
), c =
|
|
4790
|
+
), c = E((d) => {
|
|
4789
4791
|
const v = n.current.get(d);
|
|
4790
4792
|
v && (v.forEach((y) => y.dispose()), v.clear()), t((y) => {
|
|
4791
4793
|
const m = new Map(y);
|
|
@@ -4793,7 +4795,7 @@ function wi() {
|
|
|
4793
4795
|
});
|
|
4794
4796
|
}, []), u = R(e);
|
|
4795
4797
|
u.current = e;
|
|
4796
|
-
const p =
|
|
4798
|
+
const p = E(
|
|
4797
4799
|
(d) => (v, y, m) => {
|
|
4798
4800
|
r.current.set(d, {
|
|
4799
4801
|
graphEnd: v,
|
|
@@ -4824,7 +4826,7 @@ function wi() {
|
|
|
4824
4826
|
d.forEach((v) => v.dispose()), d.clear();
|
|
4825
4827
|
}), n.current.clear();
|
|
4826
4828
|
}, []);
|
|
4827
|
-
const f =
|
|
4829
|
+
const f = E(
|
|
4828
4830
|
(d) => {
|
|
4829
4831
|
const y = (e.get(d) || []).filter((m) => !m.bypassed);
|
|
4830
4832
|
if (y.length !== 0)
|
|
@@ -4889,9 +4891,9 @@ function $s(e, t) {
|
|
|
4889
4891
|
r.href = n, r.download = t, r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
|
|
4890
4892
|
}
|
|
4891
4893
|
function Es() {
|
|
4892
|
-
const [e, t] =
|
|
4894
|
+
const [e, t] = H(!1), [n, r] = H(0), [a, s] = H(null);
|
|
4893
4895
|
return {
|
|
4894
|
-
exportWav:
|
|
4896
|
+
exportWav: E(async (i, l, c = {}) => {
|
|
4895
4897
|
const {
|
|
4896
4898
|
filename: u = "export",
|
|
4897
4899
|
mode: p = "master",
|
|
@@ -4911,16 +4913,16 @@ function Es() {
|
|
|
4911
4913
|
throw new Error("Invalid track index for individual export");
|
|
4912
4914
|
const b = i[0].clips[0]?.sampleRate || 44100;
|
|
4913
4915
|
let g = 0;
|
|
4914
|
-
for (const
|
|
4915
|
-
for (const F of
|
|
4916
|
+
for (const k of i)
|
|
4917
|
+
for (const F of k.clips) {
|
|
4916
4918
|
const B = F.startSample + F.durationSamples;
|
|
4917
4919
|
g = Math.max(g, B);
|
|
4918
4920
|
}
|
|
4919
4921
|
g += Math.round(b * 0.1);
|
|
4920
|
-
const x = g / b, S = p === "individual" ? [{ track: i[f], state: l[f], index: f }] : i.map((
|
|
4921
|
-
let
|
|
4922
|
-
if ((y ||
|
|
4923
|
-
|
|
4922
|
+
const x = g / b, S = p === "individual" ? [{ track: i[f], state: l[f], index: f }] : i.map((k, F) => ({ track: k, state: l[F], index: F })), M = l.some((k) => k.soloed), I = !!m;
|
|
4923
|
+
let T;
|
|
4924
|
+
if ((y || I) && v)
|
|
4925
|
+
T = await Ts(
|
|
4924
4926
|
S,
|
|
4925
4927
|
l,
|
|
4926
4928
|
M,
|
|
@@ -4928,32 +4930,32 @@ function Es() {
|
|
|
4928
4930
|
b,
|
|
4929
4931
|
y,
|
|
4930
4932
|
m,
|
|
4931
|
-
(
|
|
4932
|
-
r(
|
|
4933
|
+
(k) => {
|
|
4934
|
+
r(k), C?.(k);
|
|
4933
4935
|
}
|
|
4934
4936
|
);
|
|
4935
4937
|
else {
|
|
4936
|
-
const
|
|
4938
|
+
const k = new OfflineAudioContext(2, g, b);
|
|
4937
4939
|
let F = 0;
|
|
4938
|
-
const B = S.reduce((W, { track:
|
|
4939
|
-
for (const { track: W, state:
|
|
4940
|
-
if (!(
|
|
4941
|
-
for (const
|
|
4942
|
-
await Ds(
|
|
4943
|
-
const
|
|
4944
|
-
r(
|
|
4940
|
+
const B = S.reduce((W, { track: N }) => W + N.clips.length, 0);
|
|
4941
|
+
for (const { track: W, state: N } of S)
|
|
4942
|
+
if (!(N.muted && !N.soloed) && !(M && !N.soloed))
|
|
4943
|
+
for (const Y of W.clips) {
|
|
4944
|
+
await Ds(k, Y, N, b, v), F++;
|
|
4945
|
+
const z = F / B * 0.5;
|
|
4946
|
+
r(z), C?.(z);
|
|
4945
4947
|
}
|
|
4946
|
-
r(0.5), C?.(0.5),
|
|
4948
|
+
r(0.5), C?.(0.5), T = await k.startRendering();
|
|
4947
4949
|
}
|
|
4948
4950
|
r(0.9), C?.(0.9);
|
|
4949
|
-
const
|
|
4951
|
+
const A = Ms(T, { bitDepth: h });
|
|
4950
4952
|
if (r(1), C?.(1), d) {
|
|
4951
|
-
const
|
|
4952
|
-
$s(
|
|
4953
|
+
const k = p === "individual" ? `${u}_${i[f].name}` : u;
|
|
4954
|
+
$s(A, `${k}.wav`);
|
|
4953
4955
|
}
|
|
4954
4956
|
return {
|
|
4955
|
-
audioBuffer:
|
|
4956
|
-
blob:
|
|
4957
|
+
audioBuffer: T,
|
|
4958
|
+
blob: A,
|
|
4957
4959
|
duration: x
|
|
4958
4960
|
};
|
|
4959
4961
|
} catch (b) {
|
|
@@ -4980,19 +4982,19 @@ async function Ts(e, t, n, r, a, s, o, i) {
|
|
|
4980
4982
|
s ? C = s(h, m, !0) : h.connect(m);
|
|
4981
4983
|
for (const { track: b, state: g } of e) {
|
|
4982
4984
|
if (g.muted && !g.soloed || n && !g.soloed) continue;
|
|
4983
|
-
const x = new c(_s(g.volume)), S = new p(g.pan), M = new u(g.muted ? 0 : 1),
|
|
4984
|
-
|
|
4985
|
-
for (const
|
|
4986
|
-
const { audioBuffer:
|
|
4987
|
-
if (
|
|
4988
|
-
const
|
|
4989
|
-
|
|
4985
|
+
const x = new c(_s(g.volume)), S = new p(g.pan), M = new u(g.muted ? 0 : 1), I = o?.(b.id);
|
|
4986
|
+
I ? I(M, h, !0) : M.connect(h), S.connect(M), x.connect(S);
|
|
4987
|
+
for (const T of b.clips) {
|
|
4988
|
+
const { audioBuffer: A, startSample: k, durationSamples: F, offsetSamples: B, gain: W, fadeIn: N, fadeOut: Y } = T, z = k / a, J = F / a, K = B / a, se = new d(A), Q = new f(se), ie = new u(W);
|
|
4989
|
+
if (Q.connect(ie), ie.connect(x), N) {
|
|
4990
|
+
const ue = z, he = z + N.duration, pe = ie.gain._param;
|
|
4991
|
+
pe.setValueAtTime(0, ue), pe.linearRampToValueAtTime(W, he);
|
|
4990
4992
|
}
|
|
4991
|
-
if (
|
|
4992
|
-
const
|
|
4993
|
-
|
|
4993
|
+
if (Y) {
|
|
4994
|
+
const ue = z + J - Y.duration, he = z + J, pe = ie.gain._param;
|
|
4995
|
+
pe.setValueAtTime(W, ue), pe.linearRampToValueAtTime(0, he);
|
|
4994
4996
|
}
|
|
4995
|
-
|
|
4997
|
+
Q.start(z, K, J);
|
|
4996
4998
|
}
|
|
4997
4999
|
}
|
|
4998
5000
|
y.start(0);
|
|
@@ -5084,7 +5086,7 @@ const mr = _e(null), fr = _e(null), hr = _e(null), pr = _e(null), gr = _e(null),
|
|
|
5084
5086
|
progressBarWidth: m,
|
|
5085
5087
|
children: h
|
|
5086
5088
|
}) => {
|
|
5087
|
-
const C = m ?? v + y, b =
|
|
5089
|
+
const C = m ?? v + y, b = Qe(() => {
|
|
5088
5090
|
if (!c?.annotations) return [];
|
|
5089
5091
|
if (process.env.NODE_ENV !== "production" && c.annotations.length > 0) {
|
|
5090
5092
|
const D = c.annotations[0];
|
|
@@ -5096,55 +5098,55 @@ const mr = _e(null), fr = _e(null), hr = _e(null), pr = _e(null), gr = _e(null),
|
|
|
5096
5098
|
return c.annotations;
|
|
5097
5099
|
}, [c?.annotations]), g = R(b);
|
|
5098
5100
|
g.current = b;
|
|
5099
|
-
const [x, S] =
|
|
5100
|
-
|
|
5101
|
-
}, []),
|
|
5101
|
+
const [x, S] = H(null), [M, I] = H(!1), [T, A] = H(0), [k, F] = H(0), [B, W] = H([]), [N, Y] = H([]), [z, J] = H([]), [K, se] = H(0), [Q, ie] = H(0), [ue, he] = H(null), [pe, De] = H(o), [de, V] = H(c?.isContinuousPlay ?? !1), [fe, U] = H(c?.linkEndpoints ?? !1), [q, ce] = H(c?.editable ?? !1), [ve, ee] = H(!1), [Ze, Ue] = H(0), [tt, je] = H(0), [te, qe] = H(!1), Z = R(null), be = R(0), ye = R(0), we = R(null), ut = R(z), O = R(0), oe = R(0), Ee = R(null), ge = R(null), Oe = R(!1), nt = R(c?.isContinuousPlay ?? !1), at = R(null), dt = R(a), ht = R(!1), Ht = R(0), P = R(0), L = R(0), ne = R(0), { timeFormat: ke, setTimeFormat: xe, formatTime: Fe } = gs(), Re = vs({ initialSamplesPerPixel: a, zoomLevels: s }), We = Re.samplesPerPixel, { masterVolume: ae, setMasterVolume: Ie } = ys({ playoutRef: Z, initialVolume: 1 }), ot = E((D) => {
|
|
5102
|
+
nt.current = D, V(D);
|
|
5103
|
+
}, []), Je = E((D) => {
|
|
5102
5104
|
at.current = D, S(D);
|
|
5103
|
-
}, []), pt =
|
|
5104
|
-
ht.current = D,
|
|
5105
|
-
}, []),
|
|
5106
|
-
L.current = D,
|
|
5107
|
-
}, []), st =
|
|
5105
|
+
}, []), pt = E((D) => {
|
|
5106
|
+
ht.current = D, ee(D);
|
|
5107
|
+
}, []), Ge = E((D, X) => {
|
|
5108
|
+
L.current = D, ne.current = X, Ue(D), je(X);
|
|
5109
|
+
}, []), st = E(() => {
|
|
5108
5110
|
const D = Ht.current, X = P.current;
|
|
5109
|
-
D !== X && X > D &&
|
|
5110
|
-
}, [
|
|
5111
|
-
|
|
5112
|
-
}, [
|
|
5111
|
+
D !== X && X > D && Ge(D, X);
|
|
5112
|
+
}, [Ge]), wt = E(() => {
|
|
5113
|
+
Ge(0, 0);
|
|
5114
|
+
}, [Ge]);
|
|
5113
5115
|
re(() => {
|
|
5114
|
-
|
|
5115
|
-
}, [
|
|
5116
|
-
ut.current =
|
|
5117
|
-
}, [
|
|
5118
|
-
Ht.current =
|
|
5119
|
-
}, [
|
|
5120
|
-
if (!
|
|
5121
|
-
const D =
|
|
5122
|
-
if (X ===
|
|
5123
|
-
const
|
|
5124
|
-
D.scrollLeft =
|
|
5125
|
-
}, [
|
|
5116
|
+
Oe.current = pe;
|
|
5117
|
+
}, [pe]), re(() => {
|
|
5118
|
+
ut.current = z;
|
|
5119
|
+
}, [z]), re(() => {
|
|
5120
|
+
Ht.current = K, P.current = Q;
|
|
5121
|
+
}, [K, Q]), re(() => {
|
|
5122
|
+
if (!ge.current || !B.length) return;
|
|
5123
|
+
const D = ge.current, X = dt.current, j = We;
|
|
5124
|
+
if (X === j) return;
|
|
5125
|
+
const me = l.show ? l.width : 0, G = D.clientWidth, Me = D.scrollLeft + G / 2 - me, lt = B[0].sampleRate, $e = Me * X / lt * lt / j, Ve = Math.max(0, $e + me - G / 2);
|
|
5126
|
+
D.scrollLeft = Ve, dt.current = j;
|
|
5127
|
+
}, [We, B, l]);
|
|
5126
5128
|
const it = R(null);
|
|
5127
5129
|
re(() => {
|
|
5128
|
-
if (
|
|
5129
|
-
W([]), F(0),
|
|
5130
|
+
if (qe(!1), e.length === 0) {
|
|
5131
|
+
W([]), F(0), J([]), Y([]), Z.current && (Z.current.dispose(), Z.current = null);
|
|
5130
5132
|
return;
|
|
5131
5133
|
}
|
|
5132
|
-
const D = M, X =
|
|
5133
|
-
return Z.current && D && (Z.current.stop(),
|
|
5134
|
+
const D = M, X = ye.current;
|
|
5135
|
+
return Z.current && D && (Z.current.stop(), we.current && (cancelAnimationFrame(we.current), we.current = null), it.current = { position: X }), (async () => {
|
|
5134
5136
|
try {
|
|
5135
|
-
const
|
|
5137
|
+
const me = [];
|
|
5136
5138
|
e.forEach((Ae) => {
|
|
5137
|
-
Ae.clips.length > 0 && Ae.clips[0].audioBuffer &&
|
|
5139
|
+
Ae.clips.length > 0 && Ae.clips[0].audioBuffer && me.push(Ae.clips[0].audioBuffer);
|
|
5138
5140
|
});
|
|
5139
|
-
let
|
|
5141
|
+
let G = 0;
|
|
5140
5142
|
e.forEach((Ae) => {
|
|
5141
5143
|
Ae.clips.forEach(($e) => {
|
|
5142
|
-
const
|
|
5143
|
-
|
|
5144
|
+
const Ve = $e.sampleRate, Mt = ($e.startSample + $e.durationSamples) / Ve;
|
|
5145
|
+
G = Math.max(G, Mt);
|
|
5144
5146
|
});
|
|
5145
|
-
}), W(
|
|
5147
|
+
}), W(me), F(G), J((Ae) => Ae.length === e.length ? Ae.map(($e, Ve) => ({
|
|
5146
5148
|
...$e,
|
|
5147
|
-
name: e[
|
|
5149
|
+
name: e[Ve].name
|
|
5148
5150
|
})) : e.map(($e) => ({
|
|
5149
5151
|
name: $e.name,
|
|
5150
5152
|
muted: $e.muted,
|
|
@@ -5156,9 +5158,9 @@ const mr = _e(null), fr = _e(null), hr = _e(null), pr = _e(null), gr = _e(null),
|
|
|
5156
5158
|
effects: u
|
|
5157
5159
|
}), Me = ut.current;
|
|
5158
5160
|
e.forEach((Ae, $e) => {
|
|
5159
|
-
const
|
|
5160
|
-
if (
|
|
5161
|
-
const mt =
|
|
5161
|
+
const Ve = Ae.clips.filter((mt) => mt.audioBuffer);
|
|
5162
|
+
if (Ve.length > 0) {
|
|
5163
|
+
const mt = Ve[0].sampleRate, Mt = Math.min(...Ve.map((He) => He.startSample / mt)), Wr = Math.max(...Ve.map((He) => (He.startSample + He.durationSamples) / mt)), $t = Me[$e], Zr = {
|
|
5162
5164
|
id: `track-${$e}`,
|
|
5163
5165
|
// Use consistent index-based ID for track controls
|
|
5164
5166
|
name: Ae.name,
|
|
@@ -5168,18 +5170,18 @@ const mr = _e(null), fr = _e(null), hr = _e(null), pr = _e(null), gr = _e(null),
|
|
|
5168
5170
|
stereoPan: $t?.pan ?? Ae.pan,
|
|
5169
5171
|
startTime: Mt,
|
|
5170
5172
|
endTime: Wr
|
|
5171
|
-
}, Pr =
|
|
5172
|
-
const Lt =
|
|
5173
|
+
}, Pr = Ve.map((He) => {
|
|
5174
|
+
const Lt = He.sampleRate;
|
|
5173
5175
|
return {
|
|
5174
|
-
buffer:
|
|
5176
|
+
buffer: He.audioBuffer,
|
|
5175
5177
|
// We filtered for audioBuffer above
|
|
5176
|
-
startTime:
|
|
5178
|
+
startTime: He.startSample / Lt - Mt,
|
|
5177
5179
|
// Make relative to track start
|
|
5178
|
-
duration:
|
|
5179
|
-
offset:
|
|
5180
|
-
fadeIn:
|
|
5181
|
-
fadeOut:
|
|
5182
|
-
gain:
|
|
5180
|
+
duration: He.durationSamples / Lt,
|
|
5181
|
+
offset: He.offsetSamples / Lt,
|
|
5182
|
+
fadeIn: He.fadeIn,
|
|
5183
|
+
fadeOut: He.fadeOut,
|
|
5184
|
+
gain: He.gain
|
|
5183
5185
|
};
|
|
5184
5186
|
});
|
|
5185
5187
|
Te.addTrack({
|
|
@@ -5189,199 +5191,199 @@ const mr = _e(null), fr = _e(null), hr = _e(null), pr = _e(null), gr = _e(null),
|
|
|
5189
5191
|
// Pass track effects
|
|
5190
5192
|
});
|
|
5191
5193
|
}
|
|
5192
|
-
}), Te.applyInitialSoloState(), Z.current = Te,
|
|
5194
|
+
}), Te.applyInitialSoloState(), Z.current = Te, qe(!0);
|
|
5193
5195
|
const lt = new CustomEvent("waveform-playlist:ready", {
|
|
5194
5196
|
detail: {
|
|
5195
5197
|
trackCount: e.length,
|
|
5196
|
-
duration:
|
|
5198
|
+
duration: G
|
|
5197
5199
|
}
|
|
5198
5200
|
});
|
|
5199
5201
|
window.dispatchEvent(lt), p?.();
|
|
5200
|
-
} catch (
|
|
5201
|
-
console.error("Error loading audio:",
|
|
5202
|
+
} catch (me) {
|
|
5203
|
+
console.error("Error loading audio:", me);
|
|
5202
5204
|
}
|
|
5203
5205
|
})(), () => {
|
|
5204
|
-
|
|
5206
|
+
we.current && cancelAnimationFrame(we.current), Z.current && Z.current.dispose();
|
|
5205
5207
|
};
|
|
5206
5208
|
}, [e, p, M]), re(() => {
|
|
5207
5209
|
if (e.length === 0) return;
|
|
5208
|
-
const D = 16, X = e.map((
|
|
5209
|
-
if (
|
|
5210
|
+
const D = 16, X = e.map((j) => j.clips.map((G) => {
|
|
5211
|
+
if (G.waveformData) {
|
|
5210
5212
|
const Me = cr(
|
|
5211
|
-
|
|
5213
|
+
G.waveformData,
|
|
5212
5214
|
// Cast to WaveformData type
|
|
5213
|
-
|
|
5215
|
+
We,
|
|
5214
5216
|
0,
|
|
5215
5217
|
// channel index
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
+
G.offsetSamples,
|
|
5219
|
+
G.durationSamples
|
|
5218
5220
|
);
|
|
5219
5221
|
return {
|
|
5220
|
-
clipId:
|
|
5221
|
-
trackName:
|
|
5222
|
+
clipId: G.id,
|
|
5223
|
+
trackName: j.name,
|
|
5222
5224
|
peaks: {
|
|
5223
5225
|
length: Me.length,
|
|
5224
5226
|
data: [Me.data],
|
|
5225
5227
|
// Wrap in array for channel compatibility
|
|
5226
5228
|
bits: Me.bits
|
|
5227
5229
|
},
|
|
5228
|
-
startSample:
|
|
5229
|
-
durationSamples:
|
|
5230
|
-
fadeIn:
|
|
5231
|
-
fadeOut:
|
|
5230
|
+
startSample: G.startSample,
|
|
5231
|
+
durationSamples: G.durationSamples,
|
|
5232
|
+
fadeIn: G.fadeIn,
|
|
5233
|
+
fadeOut: G.fadeOut
|
|
5232
5234
|
};
|
|
5233
5235
|
}
|
|
5234
|
-
if (!
|
|
5235
|
-
return console.warn(`Clip "${
|
|
5236
|
-
clipId:
|
|
5237
|
-
trackName:
|
|
5236
|
+
if (!G.audioBuffer)
|
|
5237
|
+
return console.warn(`Clip "${G.name || G.id}" has neither waveformData nor audioBuffer - rendering empty`), {
|
|
5238
|
+
clipId: G.id,
|
|
5239
|
+
trackName: j.name,
|
|
5238
5240
|
peaks: {
|
|
5239
5241
|
length: 0,
|
|
5240
5242
|
data: [],
|
|
5241
5243
|
bits: D
|
|
5242
5244
|
},
|
|
5243
|
-
startSample:
|
|
5244
|
-
durationSamples:
|
|
5245
|
-
fadeIn:
|
|
5246
|
-
fadeOut:
|
|
5245
|
+
startSample: G.startSample,
|
|
5246
|
+
durationSamples: G.durationSamples,
|
|
5247
|
+
fadeIn: G.fadeIn,
|
|
5248
|
+
fadeOut: G.fadeOut
|
|
5247
5249
|
};
|
|
5248
5250
|
const Te = Jo(
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
+
G.audioBuffer,
|
|
5252
|
+
We,
|
|
5251
5253
|
n,
|
|
5252
5254
|
D,
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
+
G.offsetSamples,
|
|
5256
|
+
G.durationSamples
|
|
5255
5257
|
);
|
|
5256
5258
|
return {
|
|
5257
|
-
clipId:
|
|
5258
|
-
trackName:
|
|
5259
|
+
clipId: G.id,
|
|
5260
|
+
trackName: j.name,
|
|
5259
5261
|
peaks: Te,
|
|
5260
|
-
startSample:
|
|
5261
|
-
durationSamples:
|
|
5262
|
-
fadeIn:
|
|
5263
|
-
fadeOut:
|
|
5262
|
+
startSample: G.startSample,
|
|
5263
|
+
durationSamples: G.durationSamples,
|
|
5264
|
+
fadeIn: G.fadeIn,
|
|
5265
|
+
fadeOut: G.fadeOut
|
|
5264
5266
|
};
|
|
5265
5267
|
}));
|
|
5266
|
-
|
|
5267
|
-
}, [e,
|
|
5268
|
-
const
|
|
5269
|
-
|
|
5268
|
+
Y(X);
|
|
5269
|
+
}, [e, We, n]);
|
|
5270
|
+
const rt = E(() => {
|
|
5271
|
+
we.current && (cancelAnimationFrame(we.current), we.current = null);
|
|
5270
5272
|
const D = () => {
|
|
5271
|
-
const X =
|
|
5272
|
-
|
|
5273
|
-
const
|
|
5274
|
-
if (
|
|
5275
|
-
const Te =
|
|
5276
|
-
(Me) =>
|
|
5273
|
+
const X = ze().currentTime - O.current, j = oe.current + X;
|
|
5274
|
+
ye.current = j, A(j);
|
|
5275
|
+
const me = g.current;
|
|
5276
|
+
if (me.length > 0) {
|
|
5277
|
+
const Te = me.find(
|
|
5278
|
+
(Me) => j >= Me.start && j < Me.end
|
|
5277
5279
|
);
|
|
5278
|
-
if (
|
|
5279
|
-
Te && Te.id !== at.current ?
|
|
5280
|
+
if (nt.current)
|
|
5281
|
+
Te && Te.id !== at.current ? Je(Te.id) : !Te && at.current !== null && Je(null);
|
|
5280
5282
|
else if (at.current) {
|
|
5281
|
-
const Me =
|
|
5282
|
-
if (Me &&
|
|
5283
|
-
Z.current && Z.current.stop(),
|
|
5283
|
+
const Me = me.find((lt) => lt.id === at.current);
|
|
5284
|
+
if (Me && j >= Me.end) {
|
|
5285
|
+
Z.current && Z.current.stop(), I(!1), ye.current = be.current, A(be.current);
|
|
5284
5286
|
return;
|
|
5285
5287
|
}
|
|
5286
5288
|
} else
|
|
5287
|
-
Te &&
|
|
5289
|
+
Te && Je(Te.id);
|
|
5288
5290
|
}
|
|
5289
|
-
if (
|
|
5290
|
-
const Te =
|
|
5291
|
+
if (Oe.current && ge.current && B.length > 0) {
|
|
5292
|
+
const Te = ge.current, Me = B[0].sampleRate, lt = j * Me / dt.current, Ae = Te.clientWidth, $e = l.show ? l.width : 0, Ve = lt + $e, mt = Math.max(0, Ve - Ae / 2);
|
|
5291
5293
|
Te.scrollLeft = mt;
|
|
5292
5294
|
}
|
|
5293
|
-
if (Ee.current !== null &&
|
|
5294
|
-
Z.current && Z.current.stop(),
|
|
5295
|
+
if (Ee.current !== null && j >= Ee.current) {
|
|
5296
|
+
Z.current && Z.current.stop(), I(!1), ye.current = Ee.current, A(Ee.current), Ee.current = null;
|
|
5295
5297
|
return;
|
|
5296
5298
|
}
|
|
5297
|
-
const
|
|
5298
|
-
if (ht.current &&
|
|
5299
|
+
const G = L.current !== ne.current && ne.current > L.current;
|
|
5300
|
+
if (ht.current && G && j >= ne.current) {
|
|
5299
5301
|
Z.current?.stop();
|
|
5300
|
-
const Me =
|
|
5301
|
-
O.current = Me,
|
|
5302
|
+
const Me = ze().currentTime;
|
|
5303
|
+
O.current = Me, oe.current = L.current, ye.current = L.current, Z.current?.play(Me, L.current), we.current = requestAnimationFrame(D);
|
|
5302
5304
|
return;
|
|
5303
5305
|
}
|
|
5304
|
-
if (
|
|
5305
|
-
Z.current && Z.current.stop(),
|
|
5306
|
+
if (j >= k) {
|
|
5307
|
+
Z.current && Z.current.stop(), I(!1), ye.current = be.current, A(be.current), Je(null);
|
|
5306
5308
|
return;
|
|
5307
5309
|
}
|
|
5308
|
-
|
|
5310
|
+
we.current = requestAnimationFrame(D);
|
|
5309
5311
|
};
|
|
5310
|
-
|
|
5311
|
-
}, [
|
|
5312
|
-
|
|
5312
|
+
we.current = requestAnimationFrame(D);
|
|
5313
|
+
}, [k, B, We, de]), Pe = E(() => {
|
|
5314
|
+
we.current && (cancelAnimationFrame(we.current), we.current = null);
|
|
5313
5315
|
}, []);
|
|
5314
5316
|
re(() => {
|
|
5315
5317
|
(async () => {
|
|
5316
|
-
if (M &&
|
|
5317
|
-
if (
|
|
5318
|
-
const X =
|
|
5319
|
-
Z.current.stop(),
|
|
5318
|
+
if (M && we.current && Z.current)
|
|
5319
|
+
if (de) {
|
|
5320
|
+
const X = ye.current;
|
|
5321
|
+
Z.current.stop(), Pe(), await Z.current.init(), Z.current.setOnPlaybackComplete(() => {
|
|
5320
5322
|
});
|
|
5321
|
-
const
|
|
5322
|
-
O.current =
|
|
5323
|
+
const me = ze().currentTime;
|
|
5324
|
+
O.current = me, oe.current = X, Z.current.play(me, X), rt();
|
|
5323
5325
|
} else
|
|
5324
|
-
|
|
5326
|
+
Pe(), rt();
|
|
5325
5327
|
})();
|
|
5326
|
-
}, [
|
|
5328
|
+
}, [de, M, rt, Pe]), re(() => {
|
|
5327
5329
|
(async () => {
|
|
5328
5330
|
if (it.current && Z.current) {
|
|
5329
5331
|
const { position: X } = it.current;
|
|
5330
5332
|
it.current = null, await Z.current.init(), Z.current.setOnPlaybackComplete(() => {
|
|
5331
5333
|
});
|
|
5332
|
-
const
|
|
5333
|
-
O.current =
|
|
5334
|
+
const me = ze().currentTime;
|
|
5335
|
+
O.current = me, oe.current = X, Z.current.play(me, X), I(!0), rt();
|
|
5334
5336
|
}
|
|
5335
5337
|
})();
|
|
5336
|
-
}, [e,
|
|
5337
|
-
const Ct =
|
|
5338
|
+
}, [e, rt]);
|
|
5339
|
+
const Ct = E(async (D, X) => {
|
|
5338
5340
|
if (!Z.current || B.length === 0) return;
|
|
5339
5341
|
await Z.current.init();
|
|
5340
|
-
const
|
|
5341
|
-
|
|
5342
|
-
}), Z.current.stop(),
|
|
5343
|
-
const
|
|
5344
|
-
O.current =
|
|
5345
|
-
}, [B.length,
|
|
5342
|
+
const j = D ?? ye.current;
|
|
5343
|
+
be.current = j, ye.current = j, Z.current.setOnPlaybackComplete(() => {
|
|
5344
|
+
}), Z.current.stop(), Pe();
|
|
5345
|
+
const G = ze().currentTime;
|
|
5346
|
+
O.current = G, oe.current = j, Ee.current = X !== void 0 ? j + X : null, Z.current.play(G, j, X), I(!0), rt();
|
|
5347
|
+
}, [B.length, rt, Pe]), xr = E(() => {
|
|
5346
5348
|
if (!Z.current) return;
|
|
5347
|
-
const D =
|
|
5348
|
-
Z.current.pause(),
|
|
5349
|
-
}, [
|
|
5350
|
-
Z.current && (Z.current.stop(),
|
|
5351
|
-
}, [
|
|
5352
|
-
const X = Math.max(0, Math.min(D,
|
|
5353
|
-
|
|
5354
|
-
}, [
|
|
5355
|
-
const
|
|
5356
|
-
if (
|
|
5357
|
-
const
|
|
5358
|
-
Z.current.setMute(
|
|
5349
|
+
const D = ze().currentTime - O.current, X = oe.current + D;
|
|
5350
|
+
Z.current.pause(), I(!1), Pe(), ye.current = X, A(X);
|
|
5351
|
+
}, [Pe]), Sr = E(() => {
|
|
5352
|
+
Z.current && (Z.current.stop(), I(!1), Pe(), ye.current = be.current, A(be.current), Je(null));
|
|
5353
|
+
}, [Pe]), kr = E((D) => {
|
|
5354
|
+
const X = Math.max(0, Math.min(D, k));
|
|
5355
|
+
ye.current = X, A(X), M && Z.current && (Z.current.stop(), Pe(), Ct(X));
|
|
5356
|
+
}, [k, M, Ct, Pe]), Ar = E((D, X) => {
|
|
5357
|
+
const j = [...z];
|
|
5358
|
+
if (j[D] = { ...j[D], muted: X }, J(j), Z.current) {
|
|
5359
|
+
const me = `track-${D}`;
|
|
5360
|
+
Z.current.setMute(me, X);
|
|
5359
5361
|
}
|
|
5360
|
-
}, [
|
|
5361
|
-
const
|
|
5362
|
-
if (
|
|
5363
|
-
const
|
|
5364
|
-
Z.current.setSolo(
|
|
5362
|
+
}, [z]), Ir = E((D, X) => {
|
|
5363
|
+
const j = [...z];
|
|
5364
|
+
if (j[D] = { ...j[D], soloed: X }, J(j), Z.current) {
|
|
5365
|
+
const me = `track-${D}`;
|
|
5366
|
+
Z.current.setSolo(me, X);
|
|
5365
5367
|
}
|
|
5366
|
-
}, [
|
|
5367
|
-
const
|
|
5368
|
-
if (
|
|
5369
|
-
const
|
|
5370
|
-
|
|
5368
|
+
}, [z]), Mr = E((D, X) => {
|
|
5369
|
+
const j = [...z];
|
|
5370
|
+
if (j[D] = { ...j[D], volume: X }, J(j), Z.current) {
|
|
5371
|
+
const me = `track-${D}`, G = Z.current.getTrack(me);
|
|
5372
|
+
G && G.setVolume(X);
|
|
5371
5373
|
}
|
|
5372
|
-
}, [
|
|
5373
|
-
const
|
|
5374
|
-
if (
|
|
5375
|
-
const
|
|
5376
|
-
|
|
5374
|
+
}, [z]), $r = E((D, X) => {
|
|
5375
|
+
const j = [...z];
|
|
5376
|
+
if (j[D] = { ...j[D], pan: X }, J(j), Z.current) {
|
|
5377
|
+
const me = `track-${D}`, G = Z.current.getTrack(me);
|
|
5378
|
+
G && G.setPan(X);
|
|
5377
5379
|
}
|
|
5378
|
-
}, [
|
|
5379
|
-
|
|
5380
|
-
}, [M]), Tr =
|
|
5381
|
-
|
|
5380
|
+
}, [z]), Er = E((D, X) => {
|
|
5381
|
+
se(D), ie(X), ye.current = D, A(D), M && Z.current && (Z.current.stop(), Z.current.play(ze().currentTime, D));
|
|
5382
|
+
}, [M]), Tr = E((D) => {
|
|
5383
|
+
ge.current = D;
|
|
5382
5384
|
}, []), zt = R(d);
|
|
5383
5385
|
zt.current = d;
|
|
5384
|
-
const _r =
|
|
5386
|
+
const _r = E(
|
|
5385
5387
|
(D) => {
|
|
5386
5388
|
const X = typeof D == "function" ? D(g.current) : D;
|
|
5387
5389
|
if (!zt.current) {
|
|
@@ -5395,23 +5397,23 @@ const mr = _e(null), fr = _e(null), hr = _e(null), pr = _e(null), gr = _e(null),
|
|
|
5395
5397
|
[]
|
|
5396
5398
|
), Dr = B[0]?.sampleRate || 44100, ln = t ? 30 : 0, Br = e.length * r + ln, cn = {
|
|
5397
5399
|
isPlaying: M,
|
|
5398
|
-
currentTime:
|
|
5399
|
-
currentTimeRef:
|
|
5400
|
+
currentTime: T,
|
|
5401
|
+
currentTimeRef: ye,
|
|
5400
5402
|
playbackStartTimeRef: O,
|
|
5401
|
-
audioStartPositionRef:
|
|
5403
|
+
audioStartPositionRef: oe
|
|
5402
5404
|
}, un = {
|
|
5403
|
-
continuousPlay:
|
|
5404
|
-
linkEndpoints:
|
|
5405
|
+
continuousPlay: de,
|
|
5406
|
+
linkEndpoints: fe,
|
|
5405
5407
|
annotationsEditable: q,
|
|
5406
|
-
isAutomaticScroll:
|
|
5407
|
-
isLoopEnabled:
|
|
5408
|
+
isAutomaticScroll: pe,
|
|
5409
|
+
isLoopEnabled: ve,
|
|
5408
5410
|
annotations: b,
|
|
5409
5411
|
activeAnnotationId: x,
|
|
5410
|
-
selectionStart:
|
|
5411
|
-
selectionEnd:
|
|
5412
|
-
selectedTrackId:
|
|
5413
|
-
loopStart:
|
|
5414
|
-
loopEnd:
|
|
5412
|
+
selectionStart: K,
|
|
5413
|
+
selectionEnd: Q,
|
|
5414
|
+
selectedTrackId: ue,
|
|
5415
|
+
loopStart: Ze,
|
|
5416
|
+
loopEnd: tt
|
|
5415
5417
|
}, dn = {
|
|
5416
5418
|
// Playback controls
|
|
5417
5419
|
play: Ct,
|
|
@@ -5419,7 +5421,7 @@ const mr = _e(null), fr = _e(null), hr = _e(null), pr = _e(null), gr = _e(null),
|
|
|
5419
5421
|
stop: Sr,
|
|
5420
5422
|
seekTo: kr,
|
|
5421
5423
|
setCurrentTime: (D) => {
|
|
5422
|
-
|
|
5424
|
+
ye.current = D, A(D);
|
|
5423
5425
|
},
|
|
5424
5426
|
// Track controls
|
|
5425
5427
|
setTrackMute: Ar,
|
|
@@ -5428,37 +5430,37 @@ const mr = _e(null), fr = _e(null), hr = _e(null), pr = _e(null), gr = _e(null),
|
|
|
5428
5430
|
setTrackPan: $r,
|
|
5429
5431
|
// Selection
|
|
5430
5432
|
setSelection: Er,
|
|
5431
|
-
setSelectedTrackId:
|
|
5433
|
+
setSelectedTrackId: he,
|
|
5432
5434
|
// Time format
|
|
5433
5435
|
setTimeFormat: xe,
|
|
5434
|
-
formatTime:
|
|
5436
|
+
formatTime: Fe,
|
|
5435
5437
|
// Zoom
|
|
5436
|
-
zoomIn:
|
|
5437
|
-
zoomOut:
|
|
5438
|
+
zoomIn: Re.zoomIn,
|
|
5439
|
+
zoomOut: Re.zoomOut,
|
|
5438
5440
|
// Master volume
|
|
5439
5441
|
setMasterVolume: Ie,
|
|
5440
5442
|
// Automatic scroll
|
|
5441
5443
|
setAutomaticScroll: (D) => {
|
|
5442
|
-
|
|
5444
|
+
De(D);
|
|
5443
5445
|
},
|
|
5444
5446
|
setScrollContainer: Tr,
|
|
5445
|
-
scrollContainerRef:
|
|
5447
|
+
scrollContainerRef: ge,
|
|
5446
5448
|
// Annotation controls
|
|
5447
5449
|
setContinuousPlay: ot,
|
|
5448
|
-
setLinkEndpoints:
|
|
5450
|
+
setLinkEndpoints: U,
|
|
5449
5451
|
setAnnotationsEditable: ce,
|
|
5450
5452
|
setAnnotations: _r,
|
|
5451
|
-
setActiveAnnotationId:
|
|
5453
|
+
setActiveAnnotationId: Je,
|
|
5452
5454
|
// Loop controls
|
|
5453
5455
|
setLoopEnabled: pt,
|
|
5454
|
-
setLoopRegion:
|
|
5456
|
+
setLoopRegion: Ge,
|
|
5455
5457
|
setLoopRegionFromSelection: st,
|
|
5456
5458
|
clearLoopRegion: wt
|
|
5457
5459
|
}, mn = {
|
|
5458
|
-
duration:
|
|
5460
|
+
duration: k,
|
|
5459
5461
|
audioBuffers: B,
|
|
5460
|
-
peaksDataArray:
|
|
5461
|
-
trackStates:
|
|
5462
|
+
peaksDataArray: N,
|
|
5463
|
+
trackStates: z,
|
|
5462
5464
|
tracks: e,
|
|
5463
5465
|
sampleRate: Dr,
|
|
5464
5466
|
waveHeight: r,
|
|
@@ -5466,15 +5468,15 @@ const mr = _e(null), fr = _e(null), hr = _e(null), pr = _e(null), gr = _e(null),
|
|
|
5466
5468
|
minimumPlaylistHeight: Br,
|
|
5467
5469
|
controls: l,
|
|
5468
5470
|
playoutRef: Z,
|
|
5469
|
-
samplesPerPixel:
|
|
5471
|
+
samplesPerPixel: We,
|
|
5470
5472
|
timeFormat: ke,
|
|
5471
|
-
masterVolume:
|
|
5472
|
-
canZoomIn:
|
|
5473
|
-
canZoomOut:
|
|
5473
|
+
masterVolume: ae,
|
|
5474
|
+
canZoomIn: Re.canZoomIn,
|
|
5475
|
+
canZoomOut: Re.canZoomOut,
|
|
5474
5476
|
barWidth: v,
|
|
5475
5477
|
barGap: y,
|
|
5476
5478
|
progressBarWidth: C,
|
|
5477
|
-
isReady:
|
|
5479
|
+
isReady: te,
|
|
5478
5480
|
mono: n
|
|
5479
5481
|
}, Fr = {
|
|
5480
5482
|
...cn,
|
|
@@ -5483,17 +5485,17 @@ const mr = _e(null), fr = _e(null), hr = _e(null), pr = _e(null), gr = _e(null),
|
|
|
5483
5485
|
...mn
|
|
5484
5486
|
}, Rr = { ...Un, ...i };
|
|
5485
5487
|
return /* @__PURE__ */ w(Pn, { theme: Rr, children: /* @__PURE__ */ w(mr.Provider, { value: cn, children: /* @__PURE__ */ w(fr.Provider, { value: un, children: /* @__PURE__ */ w(hr.Provider, { value: dn, children: /* @__PURE__ */ w(pr.Provider, { value: mn, children: /* @__PURE__ */ w(gr.Provider, { value: Fr, children: h }) }) }) }) }) });
|
|
5486
|
-
},
|
|
5488
|
+
}, Le = () => {
|
|
5487
5489
|
const e = Se(mr);
|
|
5488
5490
|
if (!e)
|
|
5489
5491
|
throw new Error("usePlaybackAnimation must be used within WaveformPlaylistProvider");
|
|
5490
5492
|
return e;
|
|
5491
|
-
},
|
|
5493
|
+
}, Xe = () => {
|
|
5492
5494
|
const e = Se(fr);
|
|
5493
5495
|
if (!e)
|
|
5494
5496
|
throw new Error("usePlaylistState must be used within WaveformPlaylistProvider");
|
|
5495
5497
|
return e;
|
|
5496
|
-
},
|
|
5498
|
+
}, Ce = () => {
|
|
5497
5499
|
const e = Se(hr);
|
|
5498
5500
|
if (!e)
|
|
5499
5501
|
throw new Error("usePlaylistControls must be used within WaveformPlaylistProvider");
|
|
@@ -5767,7 +5769,7 @@ const br = _e(null), vr = _e(null), yr = _e(null), wr = _e(null), Si = ({
|
|
|
5767
5769
|
onReady: d,
|
|
5768
5770
|
children: v
|
|
5769
5771
|
}) => {
|
|
5770
|
-
const y = p ?? c + u, [m, h] =
|
|
5772
|
+
const y = p ?? c + u, [m, h] = H(!1), [C, b] = H(0), [g, x] = H(0), [S, M] = H([]), [I, T] = H(a), A = Qe(() => {
|
|
5771
5773
|
if (!l?.annotations) return [];
|
|
5772
5774
|
if (process.env.NODE_ENV !== "production" && l.annotations.length > 0) {
|
|
5773
5775
|
const O = l.annotations[0];
|
|
@@ -5777,23 +5779,23 @@ const br = _e(null), vr = _e(null), yr = _e(null), wr = _e(null), Si = ({
|
|
|
5777
5779
|
), [];
|
|
5778
5780
|
}
|
|
5779
5781
|
return l.annotations;
|
|
5780
|
-
}, [l?.annotations]),
|
|
5781
|
-
|
|
5782
|
-
const [F, B] =
|
|
5782
|
+
}, [l?.annotations]), k = R(A);
|
|
5783
|
+
k.current = A;
|
|
5784
|
+
const [F, B] = H(null), [W, N] = H(
|
|
5783
5785
|
l?.isContinuousPlay ?? !1
|
|
5784
|
-
), [
|
|
5786
|
+
), [Y] = H(t), [z, J] = H(s), K = R(null), se = R(0), Q = R(null), ie = R(W), ue = R(null), he = R(null), pe = R(s), De = R(t);
|
|
5785
5787
|
re(() => {
|
|
5786
|
-
|
|
5788
|
+
ie.current = W;
|
|
5787
5789
|
}, [W]), re(() => {
|
|
5788
|
-
|
|
5789
|
-
}, [
|
|
5790
|
-
const
|
|
5791
|
-
|
|
5792
|
-
}, []), V =
|
|
5793
|
-
|
|
5794
|
-
}, []),
|
|
5795
|
-
|
|
5796
|
-
}, []),
|
|
5790
|
+
pe.current = z;
|
|
5791
|
+
}, [z]);
|
|
5792
|
+
const de = E((O) => {
|
|
5793
|
+
ue.current = O, B(O);
|
|
5794
|
+
}, []), V = E((O) => {
|
|
5795
|
+
ie.current = O, N(O);
|
|
5796
|
+
}, []), fe = E((O) => {
|
|
5797
|
+
he.current = O;
|
|
5798
|
+
}, []), U = e.waveformData.sample_rate;
|
|
5797
5799
|
re(() => {
|
|
5798
5800
|
const O = new Fs({
|
|
5799
5801
|
playbackRate: a
|
|
@@ -5803,25 +5805,25 @@ const br = _e(null), vr = _e(null), yr = _e(null), wr = _e(null), Si = ({
|
|
|
5803
5805
|
peaks: e.waveformData,
|
|
5804
5806
|
name: e.name
|
|
5805
5807
|
});
|
|
5806
|
-
const
|
|
5807
|
-
return
|
|
5808
|
-
|
|
5808
|
+
const oe = O.getTrack(O.track?.id ?? "");
|
|
5809
|
+
return oe && oe.setOnTimeUpdateCallback((Ee) => {
|
|
5810
|
+
se.current = Ee;
|
|
5809
5811
|
}), O.setOnPlaybackComplete(() => {
|
|
5810
|
-
|
|
5811
|
-
}),
|
|
5812
|
-
|
|
5812
|
+
Q.current && (cancelAnimationFrame(Q.current), Q.current = null), h(!1), de(null), se.current = 0, b(0);
|
|
5813
|
+
}), K.current = O, x(e.waveformData.duration), d?.(), () => {
|
|
5814
|
+
Q.current && cancelAnimationFrame(Q.current), O.dispose();
|
|
5813
5815
|
};
|
|
5814
5816
|
}, [e.source, e.waveformData, e.name, a, d]), re(() => {
|
|
5815
5817
|
const O = cr(
|
|
5816
5818
|
e.waveformData,
|
|
5817
|
-
|
|
5819
|
+
Y,
|
|
5818
5820
|
0,
|
|
5819
5821
|
// channel index
|
|
5820
5822
|
0,
|
|
5821
5823
|
// offset
|
|
5822
|
-
Math.ceil(e.waveformData.duration *
|
|
5824
|
+
Math.ceil(e.waveformData.duration * U)
|
|
5823
5825
|
// duration in samples
|
|
5824
|
-
),
|
|
5826
|
+
), oe = {
|
|
5825
5827
|
clipId: "media-element-clip",
|
|
5826
5828
|
trackName: e.name ?? "Track",
|
|
5827
5829
|
peaks: {
|
|
@@ -5830,117 +5832,117 @@ const br = _e(null), vr = _e(null), yr = _e(null), wr = _e(null), Si = ({
|
|
|
5830
5832
|
bits: O.bits
|
|
5831
5833
|
},
|
|
5832
5834
|
startSample: 0,
|
|
5833
|
-
durationSamples: Math.ceil(e.waveformData.duration *
|
|
5835
|
+
durationSamples: Math.ceil(e.waveformData.duration * U)
|
|
5834
5836
|
};
|
|
5835
|
-
M([[
|
|
5836
|
-
}, [e.waveformData, e.name,
|
|
5837
|
-
const q =
|
|
5838
|
-
|
|
5837
|
+
M([[oe]]);
|
|
5838
|
+
}, [e.waveformData, e.name, Y, U]);
|
|
5839
|
+
const q = E(() => {
|
|
5840
|
+
Q.current && cancelAnimationFrame(Q.current);
|
|
5839
5841
|
const O = () => {
|
|
5840
|
-
const
|
|
5841
|
-
|
|
5842
|
-
const Ee =
|
|
5842
|
+
const oe = K.current?.getCurrentTime() ?? 0;
|
|
5843
|
+
se.current = oe, b(oe);
|
|
5844
|
+
const Ee = k.current;
|
|
5843
5845
|
if (Ee.length > 0) {
|
|
5844
|
-
const
|
|
5845
|
-
(
|
|
5846
|
+
const ge = Ee.find(
|
|
5847
|
+
(Oe) => oe >= Oe.start && oe < Oe.end
|
|
5846
5848
|
);
|
|
5847
|
-
if (
|
|
5848
|
-
|
|
5849
|
-
else if (
|
|
5850
|
-
const
|
|
5851
|
-
(
|
|
5849
|
+
if (ie.current)
|
|
5850
|
+
ge && ge.id !== ue.current ? de(ge.id) : !ge && ue.current !== null && de(null);
|
|
5851
|
+
else if (ue.current) {
|
|
5852
|
+
const Oe = Ee.find(
|
|
5853
|
+
(nt) => nt.id === ue.current
|
|
5852
5854
|
);
|
|
5853
|
-
if (
|
|
5854
|
-
|
|
5855
|
+
if (Oe && oe >= Oe.end) {
|
|
5856
|
+
K.current?.stop(), h(!1);
|
|
5855
5857
|
return;
|
|
5856
5858
|
}
|
|
5857
|
-
} else
|
|
5859
|
+
} else ge && de(ge.id);
|
|
5858
5860
|
}
|
|
5859
|
-
if (
|
|
5860
|
-
const
|
|
5861
|
-
|
|
5861
|
+
if (pe.current && he.current) {
|
|
5862
|
+
const ge = he.current, Oe = oe * U / De.current, nt = ge.clientWidth, at = i.show ? i.width : 0, dt = Oe + at, ht = Math.max(0, dt - nt / 2);
|
|
5863
|
+
ge.scrollLeft = ht;
|
|
5862
5864
|
}
|
|
5863
|
-
|
|
5865
|
+
Q.current = requestAnimationFrame(O);
|
|
5864
5866
|
};
|
|
5865
|
-
|
|
5866
|
-
}, [
|
|
5867
|
-
|
|
5868
|
-
}, []),
|
|
5867
|
+
Q.current = requestAnimationFrame(O);
|
|
5868
|
+
}, [de, U, i]), ce = E(() => {
|
|
5869
|
+
Q.current && (cancelAnimationFrame(Q.current), Q.current = null);
|
|
5870
|
+
}, []), ve = E(
|
|
5869
5871
|
(O) => {
|
|
5870
|
-
if (!
|
|
5871
|
-
const
|
|
5872
|
-
|
|
5872
|
+
if (!K.current) return;
|
|
5873
|
+
const oe = O ?? se.current;
|
|
5874
|
+
K.current.play(void 0, oe), h(!0), q();
|
|
5873
5875
|
},
|
|
5874
5876
|
[q]
|
|
5875
|
-
),
|
|
5876
|
-
|
|
5877
|
-
}, [ce]),
|
|
5878
|
-
|
|
5879
|
-
}, [ce,
|
|
5877
|
+
), ee = E(() => {
|
|
5878
|
+
K.current && (K.current.pause(), h(!1), ce(), b(K.current.getCurrentTime()));
|
|
5879
|
+
}, [ce]), Ze = E(() => {
|
|
5880
|
+
K.current && (K.current.stop(), h(!1), ce(), se.current = 0, b(0), de(null));
|
|
5881
|
+
}, [ce, de]), Ue = E(
|
|
5880
5882
|
(O) => {
|
|
5881
|
-
const
|
|
5882
|
-
|
|
5883
|
+
const oe = Math.max(0, Math.min(O, g));
|
|
5884
|
+
se.current = oe, b(oe), K.current && K.current.seekTo(oe);
|
|
5883
5885
|
},
|
|
5884
5886
|
[g]
|
|
5885
|
-
),
|
|
5886
|
-
const
|
|
5887
|
-
|
|
5888
|
-
}, []),
|
|
5887
|
+
), tt = E((O) => {
|
|
5888
|
+
const oe = Math.max(0.5, Math.min(2, O));
|
|
5889
|
+
T(oe), K.current && K.current.setPlaybackRate(oe);
|
|
5890
|
+
}, []), je = r ? 30 : 0, te = Qe(
|
|
5889
5891
|
() => ({
|
|
5890
5892
|
isPlaying: m,
|
|
5891
5893
|
currentTime: C,
|
|
5892
|
-
currentTimeRef:
|
|
5894
|
+
currentTimeRef: se
|
|
5893
5895
|
}),
|
|
5894
5896
|
[m, C]
|
|
5895
|
-
),
|
|
5897
|
+
), qe = Qe(
|
|
5896
5898
|
() => ({
|
|
5897
5899
|
continuousPlay: W,
|
|
5898
|
-
annotations:
|
|
5900
|
+
annotations: A,
|
|
5899
5901
|
activeAnnotationId: F,
|
|
5900
|
-
playbackRate:
|
|
5901
|
-
isAutomaticScroll:
|
|
5902
|
+
playbackRate: I,
|
|
5903
|
+
isAutomaticScroll: z
|
|
5902
5904
|
}),
|
|
5903
|
-
[W,
|
|
5905
|
+
[W, A, F, I, z]
|
|
5904
5906
|
), Z = R(f);
|
|
5905
5907
|
Z.current = f;
|
|
5906
|
-
const
|
|
5908
|
+
const be = E(
|
|
5907
5909
|
(O) => {
|
|
5908
|
-
const
|
|
5910
|
+
const oe = typeof O == "function" ? O(k.current) : O;
|
|
5909
5911
|
if (!Z.current) {
|
|
5910
5912
|
process.env.NODE_ENV !== "production" && console.warn(
|
|
5911
5913
|
"waveform-playlist: setAnnotations was called but no onAnnotationsChange callback is provided. Annotation edits will not persist. Pass onAnnotationsChange to MediaElementPlaylistProvider to handle annotation updates."
|
|
5912
5914
|
);
|
|
5913
5915
|
return;
|
|
5914
5916
|
}
|
|
5915
|
-
Z.current(
|
|
5917
|
+
Z.current(oe);
|
|
5916
5918
|
},
|
|
5917
5919
|
[]
|
|
5918
|
-
),
|
|
5920
|
+
), ye = Qe(
|
|
5919
5921
|
() => ({
|
|
5920
|
-
play:
|
|
5921
|
-
pause:
|
|
5922
|
-
stop:
|
|
5923
|
-
seekTo:
|
|
5924
|
-
setPlaybackRate:
|
|
5922
|
+
play: ve,
|
|
5923
|
+
pause: ee,
|
|
5924
|
+
stop: Ze,
|
|
5925
|
+
seekTo: Ue,
|
|
5926
|
+
setPlaybackRate: tt,
|
|
5925
5927
|
setContinuousPlay: V,
|
|
5926
|
-
setAnnotations:
|
|
5927
|
-
setActiveAnnotationId:
|
|
5928
|
+
setAnnotations: be,
|
|
5929
|
+
setActiveAnnotationId: de,
|
|
5928
5930
|
setAutomaticScroll: (O) => {
|
|
5929
|
-
|
|
5931
|
+
J(O);
|
|
5930
5932
|
},
|
|
5931
|
-
setScrollContainer:
|
|
5932
|
-
scrollContainerRef:
|
|
5933
|
+
setScrollContainer: fe,
|
|
5934
|
+
scrollContainerRef: he
|
|
5933
5935
|
}),
|
|
5934
|
-
[
|
|
5935
|
-
),
|
|
5936
|
+
[ve, ee, Ze, Ue, tt, V, be, de, fe]
|
|
5937
|
+
), we = Qe(
|
|
5936
5938
|
() => ({
|
|
5937
5939
|
duration: g,
|
|
5938
5940
|
peaksDataArray: S,
|
|
5939
|
-
sampleRate:
|
|
5941
|
+
sampleRate: U,
|
|
5940
5942
|
waveHeight: n,
|
|
5941
|
-
timeScaleHeight:
|
|
5942
|
-
samplesPerPixel:
|
|
5943
|
-
playoutRef:
|
|
5943
|
+
timeScaleHeight: je,
|
|
5944
|
+
samplesPerPixel: Y,
|
|
5945
|
+
playoutRef: K,
|
|
5944
5946
|
controls: i,
|
|
5945
5947
|
barWidth: c,
|
|
5946
5948
|
barGap: u,
|
|
@@ -5949,17 +5951,17 @@ const br = _e(null), vr = _e(null), yr = _e(null), wr = _e(null), Si = ({
|
|
|
5949
5951
|
[
|
|
5950
5952
|
g,
|
|
5951
5953
|
S,
|
|
5952
|
-
|
|
5954
|
+
U,
|
|
5953
5955
|
n,
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
+
je,
|
|
5957
|
+
Y,
|
|
5956
5958
|
i,
|
|
5957
5959
|
c,
|
|
5958
5960
|
u,
|
|
5959
5961
|
y
|
|
5960
5962
|
]
|
|
5961
5963
|
), ut = { ...Un, ...o };
|
|
5962
|
-
return /* @__PURE__ */ w(Pn, { theme: ut, children: /* @__PURE__ */ w(br.Provider, { value:
|
|
5964
|
+
return /* @__PURE__ */ w(Pn, { theme: ut, children: /* @__PURE__ */ w(br.Provider, { value: te, children: /* @__PURE__ */ w(vr.Provider, { value: qe, children: /* @__PURE__ */ w(yr.Provider, { value: ye, children: /* @__PURE__ */ w(wr.Provider, { value: we, children: v }) }) }) }) });
|
|
5963
5965
|
}, rn = () => {
|
|
5964
5966
|
const e = Se(br);
|
|
5965
5967
|
if (!e)
|
|
@@ -5989,8 +5991,8 @@ const br = _e(null), vr = _e(null), yr = _e(null), wr = _e(null), Si = ({
|
|
|
5989
5991
|
);
|
|
5990
5992
|
return e;
|
|
5991
5993
|
}, ki = ({ className: e }) => {
|
|
5992
|
-
const { isPlaying: t, currentTimeRef: n } =
|
|
5993
|
-
return /* @__PURE__ */ w(
|
|
5994
|
+
const { isPlaying: t, currentTimeRef: n } = Le(), { selectionStart: r, selectionEnd: a, isLoopEnabled: s } = Xe(), { play: o } = Ce();
|
|
5995
|
+
return /* @__PURE__ */ w(Ke, { onClick: async () => {
|
|
5994
5996
|
if (r !== a && a > r)
|
|
5995
5997
|
if (s)
|
|
5996
5998
|
await o(r);
|
|
@@ -6002,27 +6004,27 @@ const br = _e(null), vr = _e(null), yr = _e(null), wr = _e(null), Si = ({
|
|
|
6002
6004
|
await o(n.current ?? 0);
|
|
6003
6005
|
}, disabled: t, className: e, children: "Play" });
|
|
6004
6006
|
}, Ai = ({ className: e }) => {
|
|
6005
|
-
const { isPlaying: t } =
|
|
6006
|
-
return /* @__PURE__ */ w(
|
|
6007
|
+
const { isPlaying: t } = Le(), { pause: n } = Ce();
|
|
6008
|
+
return /* @__PURE__ */ w(Ke, { onClick: n, disabled: !t, className: e, children: "Pause" });
|
|
6007
6009
|
}, Ii = ({ className: e }) => {
|
|
6008
|
-
const { isPlaying: t } =
|
|
6009
|
-
return /* @__PURE__ */ w(
|
|
6010
|
+
const { isPlaying: t } = Le(), { stop: n } = Ce();
|
|
6011
|
+
return /* @__PURE__ */ w(Ke, { onClick: n, disabled: !t, className: e, children: "Stop" });
|
|
6010
6012
|
}, Mi = ({ className: e }) => {
|
|
6011
|
-
const { isPlaying: t } =
|
|
6012
|
-
return /* @__PURE__ */ w(
|
|
6013
|
+
const { isPlaying: t } = Le(), { play: n, setCurrentTime: r } = Ce(), { playoutRef: a } = Be();
|
|
6014
|
+
return /* @__PURE__ */ w(Ke, { onClick: () => {
|
|
6013
6015
|
r(0), t && a.current && (a.current.stop(), n(0));
|
|
6014
6016
|
}, className: e, children: "Rewind" });
|
|
6015
6017
|
}, $i = ({ className: e }) => {
|
|
6016
|
-
const { isPlaying: t } =
|
|
6017
|
-
return /* @__PURE__ */ w(
|
|
6018
|
+
const { isPlaying: t } = Le(), { play: n, setCurrentTime: r } = Ce(), { duration: a, playoutRef: s } = Be();
|
|
6019
|
+
return /* @__PURE__ */ w(Ke, { onClick: () => {
|
|
6018
6020
|
r(a), t && s.current && (s.current.stop(), n(a));
|
|
6019
6021
|
}, className: e, children: "Fast Forward" });
|
|
6020
6022
|
}, Ei = ({
|
|
6021
6023
|
skipAmount: e = 5,
|
|
6022
6024
|
className: t
|
|
6023
6025
|
}) => {
|
|
6024
|
-
const { currentTimeRef: n, isPlaying: r } =
|
|
6025
|
-
return /* @__PURE__ */ w(
|
|
6026
|
+
const { currentTimeRef: n, isPlaying: r } = Le(), { play: a, setCurrentTime: s } = Ce(), { playoutRef: o } = Be();
|
|
6027
|
+
return /* @__PURE__ */ w(Ke, { onClick: () => {
|
|
6026
6028
|
const l = Math.max(0, (n.current ?? 0) - e);
|
|
6027
6029
|
s(l), r && o.current && (o.current.stop(), a(l));
|
|
6028
6030
|
}, className: t, children: "Skip Backward" });
|
|
@@ -6030,15 +6032,15 @@ const br = _e(null), vr = _e(null), yr = _e(null), wr = _e(null), Si = ({
|
|
|
6030
6032
|
skipAmount: e = 5,
|
|
6031
6033
|
className: t
|
|
6032
6034
|
}) => {
|
|
6033
|
-
const { currentTimeRef: n, isPlaying: r } =
|
|
6034
|
-
return /* @__PURE__ */ w(
|
|
6035
|
+
const { currentTimeRef: n, isPlaying: r } = Le(), { play: a, setCurrentTime: s } = Ce(), { duration: o, playoutRef: i } = Be();
|
|
6036
|
+
return /* @__PURE__ */ w(Ke, { onClick: () => {
|
|
6035
6037
|
const c = Math.min(o, (n.current ?? 0) + e);
|
|
6036
6038
|
s(c), r && i.current && (i.current.stop(), a(c));
|
|
6037
6039
|
}, className: t, children: "Skip Forward" });
|
|
6038
6040
|
}, _i = ({ className: e }) => {
|
|
6039
|
-
const { isLoopEnabled: t, loopStart: n, loopEnd: r } =
|
|
6041
|
+
const { isLoopEnabled: t, loopStart: n, loopEnd: r } = Xe(), { setLoopEnabled: a, setLoopRegion: s } = Ce(), { duration: o } = Be(), i = n !== r && r > n;
|
|
6040
6042
|
return /* @__PURE__ */ w(
|
|
6041
|
-
|
|
6043
|
+
Ke,
|
|
6042
6044
|
{
|
|
6043
6045
|
onClick: () => {
|
|
6044
6046
|
if (!t && !i) {
|
|
@@ -6053,9 +6055,9 @@ const br = _e(null), vr = _e(null), yr = _e(null), wr = _e(null), Si = ({
|
|
|
6053
6055
|
}
|
|
6054
6056
|
);
|
|
6055
6057
|
}, Di = ({ className: e }) => {
|
|
6056
|
-
const { selectionStart: t, selectionEnd: n, loopStart: r, loopEnd: a } =
|
|
6058
|
+
const { selectionStart: t, selectionEnd: n, loopStart: r, loopEnd: a } = Xe(), { setLoopRegionFromSelection: s, clearLoopRegion: o } = Ce(), i = t !== n && n > t, l = r !== a && a > r;
|
|
6057
6059
|
return /* @__PURE__ */ w(
|
|
6058
|
-
|
|
6060
|
+
Ke,
|
|
6059
6061
|
{
|
|
6060
6062
|
onClick: () => {
|
|
6061
6063
|
l ? o() : s();
|
|
@@ -6067,13 +6069,13 @@ const br = _e(null), vr = _e(null), yr = _e(null), wr = _e(null), Si = ({
|
|
|
6067
6069
|
}
|
|
6068
6070
|
);
|
|
6069
6071
|
}, Bi = ({ className: e, disabled: t }) => {
|
|
6070
|
-
const { zoomIn: n } =
|
|
6071
|
-
return /* @__PURE__ */ w(
|
|
6072
|
+
const { zoomIn: n } = Ce(), { canZoomIn: r } = Be();
|
|
6073
|
+
return /* @__PURE__ */ w(Ke, { onClick: n, disabled: t || !r, className: e, children: "Zoom In" });
|
|
6072
6074
|
}, Fi = ({ className: e, disabled: t }) => {
|
|
6073
|
-
const { zoomOut: n } =
|
|
6074
|
-
return /* @__PURE__ */ w(
|
|
6075
|
+
const { zoomOut: n } = Ce(), { canZoomOut: r } = Be();
|
|
6076
|
+
return /* @__PURE__ */ w(Ke, { onClick: n, disabled: t || !r, className: e, children: "Zoom Out" });
|
|
6075
6077
|
}, Ri = ({ className: e }) => {
|
|
6076
|
-
const { masterVolume: t } = Be(), { setMasterVolume: n } =
|
|
6078
|
+
const { masterVolume: t } = Be(), { setMasterVolume: n } = Ce();
|
|
6077
6079
|
return /* @__PURE__ */ w(
|
|
6078
6080
|
qa,
|
|
6079
6081
|
{
|
|
@@ -6083,7 +6085,7 @@ const br = _e(null), vr = _e(null), yr = _e(null), wr = _e(null), Si = ({
|
|
|
6083
6085
|
}
|
|
6084
6086
|
);
|
|
6085
6087
|
}, Wi = ({ className: e }) => {
|
|
6086
|
-
const { timeFormat: t } = Be(), { setTimeFormat: n } =
|
|
6088
|
+
const { timeFormat: t } = Be(), { setTimeFormat: n } = Ce();
|
|
6087
6089
|
return /* @__PURE__ */ w(
|
|
6088
6090
|
Do,
|
|
6089
6091
|
{
|
|
@@ -6099,13 +6101,13 @@ const br = _e(null), vr = _e(null), yr = _e(null), wr = _e(null), Si = ({
|
|
|
6099
6101
|
color: ${(e) => e.theme?.textColor || "#333"};
|
|
6100
6102
|
user-select: none;
|
|
6101
6103
|
`, Zi = ({ className: e }) => {
|
|
6102
|
-
const t = R(null), n = R(null), { isPlaying: r, currentTimeRef: a, playbackStartTimeRef: s, audioStartPositionRef: o } =
|
|
6104
|
+
const t = R(null), n = R(null), { isPlaying: r, currentTimeRef: a, playbackStartTimeRef: s, audioStartPositionRef: o } = Le(), { timeFormat: i } = Be(), l = i;
|
|
6103
6105
|
return re(() => {
|
|
6104
6106
|
const c = () => {
|
|
6105
6107
|
if (t.current) {
|
|
6106
6108
|
let u;
|
|
6107
6109
|
if (r) {
|
|
6108
|
-
const p =
|
|
6110
|
+
const p = ze().currentTime - (s.current ?? 0);
|
|
6109
6111
|
u = (o.current ?? 0) + p;
|
|
6110
6112
|
} else
|
|
6111
6113
|
u = a.current ?? 0;
|
|
@@ -6120,7 +6122,7 @@ const br = _e(null), vr = _e(null), yr = _e(null), wr = _e(null), Si = ({
|
|
|
6120
6122
|
!r && t.current && (t.current.textContent = vt(a.current ?? 0, l));
|
|
6121
6123
|
}), /* @__PURE__ */ w(Rs, { ref: t, className: e, "aria-label": "Audio position", children: vt(a.current ?? 0, l) });
|
|
6122
6124
|
}, Pi = ({ className: e }) => {
|
|
6123
|
-
const { selectionStart: t, selectionEnd: n } =
|
|
6125
|
+
const { selectionStart: t, selectionEnd: n } = Xe(), { setSelection: r } = Ce();
|
|
6124
6126
|
return /* @__PURE__ */ w(
|
|
6125
6127
|
lo,
|
|
6126
6128
|
{
|
|
@@ -6131,7 +6133,7 @@ const br = _e(null), vr = _e(null), yr = _e(null), wr = _e(null), Si = ({
|
|
|
6131
6133
|
}
|
|
6132
6134
|
);
|
|
6133
6135
|
}, Vi = ({ className: e }) => {
|
|
6134
|
-
const { isAutomaticScroll: t } =
|
|
6136
|
+
const { isAutomaticScroll: t } = Xe(), { setAutomaticScroll: n } = Ce();
|
|
6135
6137
|
return /* @__PURE__ */ w(
|
|
6136
6138
|
Ba,
|
|
6137
6139
|
{
|
|
@@ -6150,19 +6152,19 @@ function yt() {
|
|
|
6150
6152
|
return e;
|
|
6151
6153
|
}
|
|
6152
6154
|
const zi = ({ className: e }) => {
|
|
6153
|
-
const { ContinuousPlayCheckbox: t } = yt(), { continuousPlay: n } =
|
|
6155
|
+
const { ContinuousPlayCheckbox: t } = yt(), { continuousPlay: n } = Xe(), { setContinuousPlay: r } = Ce();
|
|
6154
6156
|
return /* @__PURE__ */ w(t, { checked: n, onChange: r, className: e });
|
|
6155
6157
|
}, Li = ({ className: e }) => {
|
|
6156
|
-
const { LinkEndpointsCheckbox: t } = yt(), { linkEndpoints: n } =
|
|
6158
|
+
const { LinkEndpointsCheckbox: t } = yt(), { linkEndpoints: n } = Xe(), { setLinkEndpoints: r } = Ce();
|
|
6157
6159
|
return /* @__PURE__ */ w(t, { checked: n, onChange: r, className: e });
|
|
6158
6160
|
}, Xi = ({ className: e }) => {
|
|
6159
|
-
const { EditableCheckbox: t } = yt(), { annotationsEditable: n } =
|
|
6161
|
+
const { EditableCheckbox: t } = yt(), { annotationsEditable: n } = Xe(), { setAnnotationsEditable: r } = Ce();
|
|
6160
6162
|
return /* @__PURE__ */ w(t, { checked: n, onChange: r, className: e });
|
|
6161
6163
|
}, Oi = ({
|
|
6162
6164
|
filename: e,
|
|
6163
6165
|
className: t
|
|
6164
6166
|
}) => {
|
|
6165
|
-
const { DownloadAnnotationsButton: n } = yt(), { annotations: r } =
|
|
6167
|
+
const { DownloadAnnotationsButton: n } = yt(), { annotations: r } = Xe();
|
|
6166
6168
|
return /* @__PURE__ */ w(n, { annotations: r, filename: e, className: t });
|
|
6167
6169
|
}, Gi = ({
|
|
6168
6170
|
label: e = "Export WAV",
|
|
@@ -6195,7 +6197,7 @@ const zi = ({ className: e }) => {
|
|
|
6195
6197
|
}
|
|
6196
6198
|
}, h = v ? `Exporting ${Math.round(y * 100)}%` : e;
|
|
6197
6199
|
return /* @__PURE__ */ w(
|
|
6198
|
-
|
|
6200
|
+
Ke,
|
|
6199
6201
|
{
|
|
6200
6202
|
onClick: m,
|
|
6201
6203
|
disabled: v || p.length === 0,
|
|
@@ -6220,13 +6222,13 @@ const zi = ({ className: e }) => {
|
|
|
6220
6222
|
color: e = "#ff0000",
|
|
6221
6223
|
controlsOffset: t = 0
|
|
6222
6224
|
}) => {
|
|
6223
|
-
const n = R(null), r = R(null), { isPlaying: a, currentTimeRef: s, playbackStartTimeRef: o, audioStartPositionRef: i } =
|
|
6225
|
+
const n = R(null), r = R(null), { isPlaying: a, currentTimeRef: s, playbackStartTimeRef: o, audioStartPositionRef: i } = Le(), { samplesPerPixel: l, sampleRate: c, progressBarWidth: u } = Be();
|
|
6224
6226
|
return re(() => {
|
|
6225
6227
|
const p = () => {
|
|
6226
6228
|
if (n.current) {
|
|
6227
6229
|
let f;
|
|
6228
6230
|
if (a) {
|
|
6229
|
-
const v =
|
|
6231
|
+
const v = ze().currentTime - (o.current ?? 0);
|
|
6230
6232
|
f = (i.current ?? 0) + v;
|
|
6231
6233
|
} else
|
|
6232
6234
|
f = s.current ?? 0;
|
|
@@ -6281,27 +6283,27 @@ const zi = ({ className: e }) => {
|
|
|
6281
6283
|
clipDurationSamples: t,
|
|
6282
6284
|
...n
|
|
6283
6285
|
}) => {
|
|
6284
|
-
const r = R(null), a = R(null), s = It(), { waveHeight: o } = Wt(), { isPlaying: i, currentTimeRef: l, playbackStartTimeRef: c, audioStartPositionRef: u } =
|
|
6286
|
+
const r = R(null), a = R(null), s = It(), { waveHeight: o } = Wt(), { isPlaying: i, currentTimeRef: l, playbackStartTimeRef: c, audioStartPositionRef: u } = Le(), { samplesPerPixel: p, sampleRate: f } = Be(), d = s?.waveProgressColor || "rgba(0, 0, 0, 0.1)";
|
|
6285
6287
|
re(() => {
|
|
6286
6288
|
const M = () => {
|
|
6287
6289
|
if (r.current) {
|
|
6288
|
-
let
|
|
6290
|
+
let I;
|
|
6289
6291
|
if (i) {
|
|
6290
|
-
const F =
|
|
6291
|
-
|
|
6292
|
+
const F = ze().currentTime - (c.current ?? 0);
|
|
6293
|
+
I = (u.current ?? 0) + F;
|
|
6292
6294
|
} else
|
|
6293
|
-
|
|
6294
|
-
const
|
|
6295
|
-
let
|
|
6296
|
-
if (
|
|
6297
|
-
|
|
6298
|
-
else if (
|
|
6299
|
-
|
|
6295
|
+
I = l.current ?? 0;
|
|
6296
|
+
const T = I * f, A = e + t;
|
|
6297
|
+
let k = 0;
|
|
6298
|
+
if (T <= e)
|
|
6299
|
+
k = 0;
|
|
6300
|
+
else if (T >= A)
|
|
6301
|
+
k = n.length;
|
|
6300
6302
|
else {
|
|
6301
|
-
const F =
|
|
6302
|
-
|
|
6303
|
+
const F = T - e;
|
|
6304
|
+
k = Math.floor(F / p);
|
|
6303
6305
|
}
|
|
6304
|
-
r.current.style.width = `${
|
|
6306
|
+
r.current.style.width = `${k}px`;
|
|
6305
6307
|
}
|
|
6306
6308
|
i && (a.current = requestAnimationFrame(M));
|
|
6307
6309
|
};
|
|
@@ -6310,25 +6312,25 @@ const zi = ({ className: e }) => {
|
|
|
6310
6312
|
};
|
|
6311
6313
|
}, [i, f, p, e, t, n.length, l, c, u]), re(() => {
|
|
6312
6314
|
if (!i && r.current) {
|
|
6313
|
-
const
|
|
6314
|
-
let
|
|
6315
|
-
if (
|
|
6316
|
-
|
|
6317
|
-
else if (
|
|
6318
|
-
|
|
6315
|
+
const I = (l.current ?? 0) * f, T = e + t;
|
|
6316
|
+
let A = 0;
|
|
6317
|
+
if (I <= e)
|
|
6318
|
+
A = 0;
|
|
6319
|
+
else if (I >= T)
|
|
6320
|
+
A = n.length;
|
|
6319
6321
|
else {
|
|
6320
|
-
const
|
|
6321
|
-
|
|
6322
|
+
const k = I - e;
|
|
6323
|
+
A = Math.floor(k / p);
|
|
6322
6324
|
}
|
|
6323
|
-
r.current.style.width = `${
|
|
6325
|
+
r.current.style.width = `${A}px`;
|
|
6324
6326
|
}
|
|
6325
6327
|
});
|
|
6326
6328
|
const v = s?.waveformDrawMode || "inverted";
|
|
6327
6329
|
let y;
|
|
6328
6330
|
v === "inverted" ? y = n.isSelected && s ? s.selectedWaveFillColor : s?.waveFillColor || "white" : y = n.isSelected && s ? s.selectedWaveOutlineColor : s?.waveOutlineColor || "grey";
|
|
6329
6331
|
const m = n.renderMode === "spectrogram" || n.renderMode === "both", h = n.renderMode === "both", C = m ? "#000" : ct(y), b = Math.floor(o / 2), g = o, x = n.index * o, S = ct(y);
|
|
6330
|
-
return /* @__PURE__ */
|
|
6331
|
-
h ? /* @__PURE__ */
|
|
6332
|
+
return /* @__PURE__ */ le(Ps, { children: [
|
|
6333
|
+
h ? /* @__PURE__ */ le(et, { children: [
|
|
6332
6334
|
/* @__PURE__ */ w(
|
|
6333
6335
|
Yt,
|
|
6334
6336
|
{
|
|
@@ -6390,7 +6392,7 @@ const zs = 60, Ls = ({
|
|
|
6390
6392
|
onRemoveTrack: u,
|
|
6391
6393
|
recordingState: p
|
|
6392
6394
|
}) => {
|
|
6393
|
-
const f = It(), { isPlaying: d, currentTimeRef: v, playbackStartTimeRef: y, audioStartPositionRef: m } =
|
|
6395
|
+
const f = It(), { isPlaying: d, currentTimeRef: v, playbackStartTimeRef: y, audioStartPositionRef: m } = Le(), {
|
|
6394
6396
|
selectionStart: h,
|
|
6395
6397
|
selectionEnd: C,
|
|
6396
6398
|
annotations: b,
|
|
@@ -6398,113 +6400,113 @@ const zs = 60, Ls = ({
|
|
|
6398
6400
|
annotationsEditable: x,
|
|
6399
6401
|
linkEndpoints: S,
|
|
6400
6402
|
continuousPlay: M,
|
|
6401
|
-
selectedTrackId:
|
|
6402
|
-
loopStart:
|
|
6403
|
-
loopEnd:
|
|
6404
|
-
isLoopEnabled:
|
|
6405
|
-
} =
|
|
6403
|
+
selectedTrackId: I,
|
|
6404
|
+
loopStart: T,
|
|
6405
|
+
loopEnd: A,
|
|
6406
|
+
isLoopEnabled: k
|
|
6407
|
+
} = Xe(), F = Se(Vt), {
|
|
6406
6408
|
setAnnotations: B,
|
|
6407
6409
|
setActiveAnnotationId: W,
|
|
6408
|
-
setTrackMute:
|
|
6409
|
-
setTrackSolo:
|
|
6410
|
-
setTrackVolume:
|
|
6411
|
-
setTrackPan:
|
|
6412
|
-
setSelection:
|
|
6413
|
-
play:
|
|
6414
|
-
setScrollContainer:
|
|
6415
|
-
setSelectedTrackId:
|
|
6416
|
-
setCurrentTime:
|
|
6417
|
-
setLoopRegion:
|
|
6418
|
-
} =
|
|
6419
|
-
audioBuffers:
|
|
6420
|
-
peaksDataArray:
|
|
6421
|
-
trackStates:
|
|
6410
|
+
setTrackMute: N,
|
|
6411
|
+
setTrackSolo: Y,
|
|
6412
|
+
setTrackVolume: z,
|
|
6413
|
+
setTrackPan: J,
|
|
6414
|
+
setSelection: K,
|
|
6415
|
+
play: se,
|
|
6416
|
+
setScrollContainer: Q,
|
|
6417
|
+
setSelectedTrackId: ie,
|
|
6418
|
+
setCurrentTime: ue,
|
|
6419
|
+
setLoopRegion: he
|
|
6420
|
+
} = Ce(), {
|
|
6421
|
+
audioBuffers: pe,
|
|
6422
|
+
peaksDataArray: De,
|
|
6423
|
+
trackStates: de,
|
|
6422
6424
|
tracks: V,
|
|
6423
|
-
duration:
|
|
6424
|
-
samplesPerPixel:
|
|
6425
|
+
duration: fe,
|
|
6426
|
+
samplesPerPixel: U,
|
|
6425
6427
|
sampleRate: q,
|
|
6426
6428
|
waveHeight: ce,
|
|
6427
|
-
timeScaleHeight:
|
|
6428
|
-
controls:
|
|
6429
|
-
playoutRef:
|
|
6430
|
-
barWidth:
|
|
6431
|
-
barGap:
|
|
6432
|
-
isReady:
|
|
6433
|
-
} = Be(),
|
|
6434
|
-
if (!
|
|
6429
|
+
timeScaleHeight: ve,
|
|
6430
|
+
controls: ee,
|
|
6431
|
+
playoutRef: Ze,
|
|
6432
|
+
barWidth: Ue,
|
|
6433
|
+
barGap: tt,
|
|
6434
|
+
isReady: je
|
|
6435
|
+
} = Be(), te = Se(sn), qe = Qe(() => {
|
|
6436
|
+
if (!te) return /* @__PURE__ */ new Map();
|
|
6435
6437
|
const P = /* @__PURE__ */ new Map();
|
|
6436
6438
|
return V.forEach((L) => {
|
|
6437
|
-
if ((
|
|
6438
|
-
const ke =
|
|
6439
|
+
if ((te.trackSpectrogramOverrides.get(L.id)?.renderMode ?? L.renderMode ?? "waveform") === "waveform") return;
|
|
6440
|
+
const ke = te.trackSpectrogramOverrides.get(L.id), xe = ke?.colorMap ?? L.spectrogramColorMap ?? te.spectrogramColorMap ?? "viridis", Fe = ke?.config ?? L.spectrogramConfig ?? te.spectrogramConfig;
|
|
6439
6441
|
P.set(L.id, {
|
|
6440
|
-
colorLUT:
|
|
6441
|
-
frequencyScaleFn:
|
|
6442
|
-
config:
|
|
6442
|
+
colorLUT: te.getColorMap(xe),
|
|
6443
|
+
frequencyScaleFn: te.getFrequencyScale(Fe?.frequencyScale ?? "mel"),
|
|
6444
|
+
config: Fe
|
|
6443
6445
|
});
|
|
6444
6446
|
}), P;
|
|
6445
|
-
}, [V,
|
|
6446
|
-
if (
|
|
6447
|
+
}, [V, te]), Z = Qe(() => {
|
|
6448
|
+
if (te?.spectrogramWorkerApi)
|
|
6447
6449
|
return {
|
|
6448
|
-
registerCanvas:
|
|
6449
|
-
unregisterCanvas:
|
|
6450
|
+
registerCanvas: te.spectrogramWorkerApi.registerCanvas.bind(te.spectrogramWorkerApi),
|
|
6451
|
+
unregisterCanvas: te.spectrogramWorkerApi.unregisterCanvas.bind(te.spectrogramWorkerApi)
|
|
6450
6452
|
};
|
|
6451
|
-
}, [
|
|
6452
|
-
O.current = P,
|
|
6453
|
-
}, [
|
|
6454
|
-
let Ee =
|
|
6453
|
+
}, [te?.spectrogramWorkerApi]), [be, ye] = H(null), [we, ut] = H(!1), O = R(null), oe = E((P) => {
|
|
6454
|
+
O.current = P, Q(P);
|
|
6455
|
+
}, [Q]);
|
|
6456
|
+
let Ee = pe.length > 0 ? fe : zs;
|
|
6455
6457
|
if (p?.isRecording) {
|
|
6456
6458
|
const L = (p.startSample + p.durationSamples) / q;
|
|
6457
6459
|
Ee = Math.max(Ee, L + 10);
|
|
6458
6460
|
}
|
|
6459
|
-
const
|
|
6461
|
+
const ge = Math.floor(Ee * q / U), Oe = async (P) => {
|
|
6460
6462
|
W(P.id);
|
|
6461
6463
|
const L = M ? void 0 : P.end - P.start;
|
|
6462
6464
|
try {
|
|
6463
|
-
await
|
|
6464
|
-
} catch (
|
|
6465
|
-
console.error("waveform-playlist: Failed to start playback for annotation", P.id,
|
|
6465
|
+
await se(P.start, L);
|
|
6466
|
+
} catch (ne) {
|
|
6467
|
+
console.error("waveform-playlist: Failed to start playback for annotation", P.id, ne);
|
|
6466
6468
|
}
|
|
6467
|
-
},
|
|
6469
|
+
}, nt = E((P) => {
|
|
6468
6470
|
if (P >= 0 && P < V.length) {
|
|
6469
6471
|
const L = V[P];
|
|
6470
|
-
|
|
6472
|
+
ie(L.id);
|
|
6471
6473
|
}
|
|
6472
|
-
}, [V,
|
|
6473
|
-
const L = P.currentTarget.getBoundingClientRect(),
|
|
6474
|
-
let
|
|
6475
|
-
for (let Ie = 0; Ie <
|
|
6476
|
-
const ot =
|
|
6477
|
-
if (
|
|
6478
|
-
|
|
6474
|
+
}, [V, ie]), at = (P) => {
|
|
6475
|
+
const L = P.currentTarget.getBoundingClientRect(), ne = ee.show ? ee.width : 0, xe = (P.clientX - L.left - ne) * U / q, Re = P.clientY - L.top;
|
|
6476
|
+
let We = 0, ae = -1;
|
|
6477
|
+
for (let Ie = 0; Ie < De.length; Ie++) {
|
|
6478
|
+
const ot = De[Ie], Je = ot.length > 0 ? Math.max(...ot.map((wt) => wt.peaks.data.length)) : 1, st = ((te?.trackSpectrogramOverrides.get(V[Ie]?.id)?.renderMode ?? V[Ie]?.renderMode ?? "waveform") === "both" ? Je * 2 : Je) * ce + (o ? 22 : 0);
|
|
6479
|
+
if (Re >= We && Re < We + st) {
|
|
6480
|
+
ae = Ie;
|
|
6479
6481
|
break;
|
|
6480
6482
|
}
|
|
6481
|
-
|
|
6483
|
+
We += st;
|
|
6482
6484
|
}
|
|
6483
|
-
|
|
6485
|
+
ae !== -1 && nt(ae), ut(!0), ue(xe), K(xe, xe);
|
|
6484
6486
|
}, dt = (P) => {
|
|
6485
|
-
if (!
|
|
6486
|
-
const L = P.currentTarget.getBoundingClientRect(),
|
|
6487
|
-
|
|
6487
|
+
if (!we) return;
|
|
6488
|
+
const L = P.currentTarget.getBoundingClientRect(), ne = ee.show ? ee.width : 0, xe = (P.clientX - L.left - ne) * U / q, Fe = Math.min(h, xe), Re = Math.max(h, xe);
|
|
6489
|
+
K(Fe, Re);
|
|
6488
6490
|
}, ht = (P) => {
|
|
6489
|
-
if (!
|
|
6491
|
+
if (!we) return;
|
|
6490
6492
|
ut(!1);
|
|
6491
|
-
const L = P.currentTarget.getBoundingClientRect(),
|
|
6492
|
-
Math.abs(
|
|
6493
|
+
const L = P.currentTarget.getBoundingClientRect(), ne = ee.show ? ee.width : 0, xe = (P.clientX - L.left - ne) * U / q, Fe = Math.min(h, xe), Re = Math.max(h, xe);
|
|
6494
|
+
Math.abs(Re - Fe) < 0.1 ? (ue(Fe), d && Ze.current ? (Ze.current.stop(), se(Fe)) : Ze.current && Ze.current.stop()) : K(Fe, Re);
|
|
6493
6495
|
};
|
|
6494
|
-
return V.some((P) => P.clips.length > 0) && (
|
|
6496
|
+
return V.some((P) => P.clips.length > 0) && (pe.length === 0 || De.length === 0) ? /* @__PURE__ */ w("div", { className: s, children: "Loading waveform..." }) : /* @__PURE__ */ le(nr, { children: [
|
|
6495
6497
|
/* @__PURE__ */ w(
|
|
6496
6498
|
At.Provider,
|
|
6497
6499
|
{
|
|
6498
6500
|
value: {
|
|
6499
|
-
samplesPerPixel:
|
|
6501
|
+
samplesPerPixel: U,
|
|
6500
6502
|
sampleRate: q,
|
|
6501
|
-
zoomLevels: [
|
|
6503
|
+
zoomLevels: [U],
|
|
6502
6504
|
waveHeight: ce,
|
|
6503
|
-
timeScaleHeight:
|
|
6505
|
+
timeScaleHeight: ve,
|
|
6504
6506
|
duration: Ee * 1e3,
|
|
6505
|
-
controls:
|
|
6506
|
-
barWidth:
|
|
6507
|
-
barGap:
|
|
6507
|
+
controls: ee,
|
|
6508
|
+
barWidth: Ue,
|
|
6509
|
+
barGap: tt
|
|
6508
6510
|
},
|
|
6509
6511
|
children: /* @__PURE__ */ w(
|
|
6510
6512
|
en,
|
|
@@ -6512,49 +6514,49 @@ const zs = 60, Ls = ({
|
|
|
6512
6514
|
theme: f,
|
|
6513
6515
|
backgroundColor: ct(f.waveOutlineColor),
|
|
6514
6516
|
timescaleBackgroundColor: f.timescaleBackgroundColor,
|
|
6515
|
-
scrollContainerWidth:
|
|
6516
|
-
timescaleWidth:
|
|
6517
|
-
tracksWidth:
|
|
6518
|
-
controlsWidth:
|
|
6517
|
+
scrollContainerWidth: ge + (ee.show ? ee.width : 0),
|
|
6518
|
+
timescaleWidth: ge,
|
|
6519
|
+
tracksWidth: ge,
|
|
6520
|
+
controlsWidth: ee.show ? ee.width : 0,
|
|
6519
6521
|
onTracksMouseDown: at,
|
|
6520
6522
|
onTracksMouseMove: dt,
|
|
6521
6523
|
onTracksMouseUp: ht,
|
|
6522
|
-
scrollContainerRef:
|
|
6523
|
-
isSelecting:
|
|
6524
|
-
"data-playlist-state":
|
|
6525
|
-
timescale:
|
|
6524
|
+
scrollContainerRef: oe,
|
|
6525
|
+
isSelecting: we,
|
|
6526
|
+
"data-playlist-state": je ? "ready" : "loading",
|
|
6527
|
+
timescale: ve > 0 ? /* @__PURE__ */ le(et, { children: [
|
|
6526
6528
|
/* @__PURE__ */ w(ar, { renderTimestamp: t }),
|
|
6527
|
-
|
|
6529
|
+
k && /* @__PURE__ */ w(
|
|
6528
6530
|
io,
|
|
6529
6531
|
{
|
|
6530
|
-
startPosition: Math.min(
|
|
6531
|
-
endPosition: Math.max(
|
|
6532
|
+
startPosition: Math.min(T, A) * q / U,
|
|
6533
|
+
endPosition: Math.max(T, A) * q / U,
|
|
6532
6534
|
markerColor: f.loopMarkerColor,
|
|
6533
6535
|
regionColor: f.loopRegionColor,
|
|
6534
6536
|
minPosition: 0,
|
|
6535
|
-
maxPosition:
|
|
6536
|
-
controlsOffset:
|
|
6537
|
+
maxPosition: ge,
|
|
6538
|
+
controlsOffset: ee.show ? ee.width : 0,
|
|
6537
6539
|
onLoopRegionChange: (P, L) => {
|
|
6538
|
-
const
|
|
6539
|
-
|
|
6540
|
+
const ne = P * U / q, ke = L * U / q;
|
|
6541
|
+
he(ne, ke);
|
|
6540
6542
|
}
|
|
6541
6543
|
}
|
|
6542
6544
|
)
|
|
6543
6545
|
] }) : void 0,
|
|
6544
|
-
children: /* @__PURE__ */
|
|
6545
|
-
|
|
6546
|
-
const
|
|
6547
|
-
if (!
|
|
6548
|
-
const ke =
|
|
6546
|
+
children: /* @__PURE__ */ le(et, { children: [
|
|
6547
|
+
De.map((P, L) => {
|
|
6548
|
+
const ne = V[L];
|
|
6549
|
+
if (!ne) return null;
|
|
6550
|
+
const ke = de[L] || {
|
|
6549
6551
|
name: `Track ${L + 1}`,
|
|
6550
6552
|
muted: !1,
|
|
6551
6553
|
soloed: !1,
|
|
6552
6554
|
volume: 1,
|
|
6553
6555
|
pan: 0
|
|
6554
|
-
}, xe =
|
|
6555
|
-
/* @__PURE__ */
|
|
6556
|
-
u && /* @__PURE__ */ w(Po, { onClick: (
|
|
6557
|
-
|
|
6556
|
+
}, xe = te?.trackSpectrogramOverrides.get(ne.id)?.renderMode ?? ne.renderMode ?? "waveform", Fe = e ? e(L) : /* @__PURE__ */ le(Vo, { onClick: () => nt(L), children: [
|
|
6557
|
+
/* @__PURE__ */ le(Ho, { style: { justifyContent: "center", position: "relative" }, children: [
|
|
6558
|
+
u && /* @__PURE__ */ w(Po, { onClick: (ae) => {
|
|
6559
|
+
ae.stopPropagation(), u(L);
|
|
6558
6560
|
} }),
|
|
6559
6561
|
/* @__PURE__ */ w("span", { style: {
|
|
6560
6562
|
overflow: "hidden",
|
|
@@ -6563,24 +6565,24 @@ const zs = 60, Ls = ({
|
|
|
6563
6565
|
padding: "0 24px",
|
|
6564
6566
|
display: "block"
|
|
6565
6567
|
}, children: ke.name || `Track ${L + 1}` }),
|
|
6566
|
-
|
|
6568
|
+
te?.renderMenuItems && /* @__PURE__ */ w("span", { style: { position: "absolute", right: 0, top: 0 }, children: /* @__PURE__ */ w(
|
|
6567
6569
|
Ko,
|
|
6568
6570
|
{
|
|
6569
|
-
items: (
|
|
6571
|
+
items: (ae) => te.renderMenuItems({
|
|
6570
6572
|
renderMode: xe,
|
|
6571
|
-
onRenderModeChange: (Ie) =>
|
|
6572
|
-
onOpenSettings: () =>
|
|
6573
|
-
onClose:
|
|
6573
|
+
onRenderModeChange: (Ie) => te.setTrackRenderMode(ne.id, Ie),
|
|
6574
|
+
onOpenSettings: () => ye(ne.id),
|
|
6575
|
+
onClose: ae
|
|
6574
6576
|
})
|
|
6575
6577
|
}
|
|
6576
6578
|
) })
|
|
6577
6579
|
] }),
|
|
6578
|
-
/* @__PURE__ */
|
|
6580
|
+
/* @__PURE__ */ le(Wo, { children: [
|
|
6579
6581
|
/* @__PURE__ */ w(
|
|
6580
6582
|
In,
|
|
6581
6583
|
{
|
|
6582
6584
|
$variant: ke.muted ? "danger" : "outline",
|
|
6583
|
-
onClick: () =>
|
|
6585
|
+
onClick: () => N(L, !ke.muted),
|
|
6584
6586
|
children: "Mute"
|
|
6585
6587
|
}
|
|
6586
6588
|
),
|
|
@@ -6588,12 +6590,12 @@ const zs = 60, Ls = ({
|
|
|
6588
6590
|
In,
|
|
6589
6591
|
{
|
|
6590
6592
|
$variant: ke.soloed ? "info" : "outline",
|
|
6591
|
-
onClick: () =>
|
|
6593
|
+
onClick: () => Y(L, !ke.soloed),
|
|
6592
6594
|
children: "Solo"
|
|
6593
6595
|
}
|
|
6594
6596
|
)
|
|
6595
6597
|
] }),
|
|
6596
|
-
/* @__PURE__ */
|
|
6598
|
+
/* @__PURE__ */ le($n, { children: [
|
|
6597
6599
|
/* @__PURE__ */ w(zo, {}),
|
|
6598
6600
|
/* @__PURE__ */ w(
|
|
6599
6601
|
Mn,
|
|
@@ -6602,12 +6604,12 @@ const zs = 60, Ls = ({
|
|
|
6602
6604
|
max: "1",
|
|
6603
6605
|
step: "0.01",
|
|
6604
6606
|
value: ke.volume,
|
|
6605
|
-
onChange: (
|
|
6607
|
+
onChange: (ae) => z(L, parseFloat(ae.target.value))
|
|
6606
6608
|
}
|
|
6607
6609
|
),
|
|
6608
6610
|
/* @__PURE__ */ w(Lo, {})
|
|
6609
6611
|
] }),
|
|
6610
|
-
/* @__PURE__ */
|
|
6612
|
+
/* @__PURE__ */ le($n, { children: [
|
|
6611
6613
|
/* @__PURE__ */ w("span", { children: "L" }),
|
|
6612
6614
|
/* @__PURE__ */ w(
|
|
6613
6615
|
Mn,
|
|
@@ -6616,31 +6618,31 @@ const zs = 60, Ls = ({
|
|
|
6616
6618
|
max: "1",
|
|
6617
6619
|
step: "0.01",
|
|
6618
6620
|
value: ke.pan,
|
|
6619
|
-
onChange: (
|
|
6621
|
+
onChange: (ae) => J(L, parseFloat(ae.target.value))
|
|
6620
6622
|
}
|
|
6621
6623
|
),
|
|
6622
6624
|
/* @__PURE__ */ w("span", { children: "R" })
|
|
6623
6625
|
] })
|
|
6624
|
-
] }),
|
|
6625
|
-
return /* @__PURE__ */ w(nn.Provider, { value:
|
|
6626
|
+
] }), We = P.length > 0 ? Math.max(...P.map((ae) => ae.peaks.data.length)) : 1;
|
|
6627
|
+
return /* @__PURE__ */ w(nn.Provider, { value: Fe, children: /* @__PURE__ */ le(
|
|
6626
6628
|
or,
|
|
6627
6629
|
{
|
|
6628
|
-
numChannels:
|
|
6630
|
+
numChannels: We,
|
|
6629
6631
|
backgroundColor: ct(f.waveOutlineColor),
|
|
6630
6632
|
offset: 0,
|
|
6631
|
-
width:
|
|
6633
|
+
width: ge,
|
|
6632
6634
|
hasClipHeaders: o,
|
|
6633
|
-
trackId:
|
|
6634
|
-
isSelected:
|
|
6635
|
+
trackId: ne.id,
|
|
6636
|
+
isSelected: ne.id === I,
|
|
6635
6637
|
children: [
|
|
6636
6638
|
xe !== "waveform" && (() => {
|
|
6637
|
-
const
|
|
6638
|
-
return !Ie?.labels || !
|
|
6639
|
+
const ae = qe.get(ne.id), Ie = ae?.config;
|
|
6640
|
+
return !Ie?.labels || !ae ? null : /* @__PURE__ */ w(
|
|
6639
6641
|
Co,
|
|
6640
6642
|
{
|
|
6641
6643
|
waveHeight: ce,
|
|
6642
|
-
numChannels:
|
|
6643
|
-
frequencyScaleFn:
|
|
6644
|
+
numChannels: We,
|
|
6645
|
+
frequencyScaleFn: ae.frequencyScaleFn,
|
|
6644
6646
|
minFrequency: Ie.minFrequency ?? 0,
|
|
6645
6647
|
maxFrequency: Ie.maxFrequency ?? q / 2,
|
|
6646
6648
|
labelsColor: Ie.labelsColor,
|
|
@@ -6650,63 +6652,63 @@ const zs = 60, Ls = ({
|
|
|
6650
6652
|
}
|
|
6651
6653
|
);
|
|
6652
6654
|
})(),
|
|
6653
|
-
P.map((
|
|
6654
|
-
const ot =
|
|
6655
|
+
P.map((ae, Ie) => {
|
|
6656
|
+
const ot = ae.peaks, Je = ot.length;
|
|
6655
6657
|
return /* @__PURE__ */ w(
|
|
6656
6658
|
Ut,
|
|
6657
6659
|
{
|
|
6658
|
-
clipId:
|
|
6660
|
+
clipId: ae.clipId,
|
|
6659
6661
|
trackIndex: L,
|
|
6660
6662
|
clipIndex: Ie,
|
|
6661
|
-
trackName:
|
|
6662
|
-
startSample:
|
|
6663
|
-
durationSamples:
|
|
6664
|
-
samplesPerPixel:
|
|
6663
|
+
trackName: ae.trackName,
|
|
6664
|
+
startSample: ae.startSample,
|
|
6665
|
+
durationSamples: ae.durationSamples,
|
|
6666
|
+
samplesPerPixel: U,
|
|
6665
6667
|
showHeader: o,
|
|
6666
6668
|
disableHeaderDrag: !i,
|
|
6667
|
-
isSelected:
|
|
6668
|
-
trackId:
|
|
6669
|
-
fadeIn:
|
|
6670
|
-
fadeOut:
|
|
6669
|
+
isSelected: ne.id === I,
|
|
6670
|
+
trackId: ne.id,
|
|
6671
|
+
fadeIn: ae.fadeIn,
|
|
6672
|
+
fadeOut: ae.fadeOut,
|
|
6671
6673
|
sampleRate: q,
|
|
6672
6674
|
showFades: l,
|
|
6673
6675
|
touchOptimized: c,
|
|
6674
6676
|
onMouseDown: (pt) => {
|
|
6675
|
-
pt.target.closest('[role="button"][aria-roledescription="draggable"]') ||
|
|
6677
|
+
pt.target.closest('[role="button"][aria-roledescription="draggable"]') || nt(L);
|
|
6676
6678
|
},
|
|
6677
|
-
children: ot.data.map((pt,
|
|
6678
|
-
const st =
|
|
6679
|
+
children: ot.data.map((pt, Ge) => {
|
|
6680
|
+
const st = te?.spectrogramDataMap.get(ae.clipId), wt = st?.[Ge] ?? st?.[0], it = qe.get(ne.id), rt = it?.config;
|
|
6679
6681
|
return /* @__PURE__ */ w(
|
|
6680
6682
|
Bn,
|
|
6681
6683
|
{
|
|
6682
|
-
index:
|
|
6684
|
+
index: Ge,
|
|
6683
6685
|
data: pt,
|
|
6684
6686
|
bits: ot.bits,
|
|
6685
|
-
length:
|
|
6686
|
-
isSelected:
|
|
6687
|
-
clipStartSample:
|
|
6688
|
-
clipDurationSamples:
|
|
6687
|
+
length: Je,
|
|
6688
|
+
isSelected: ne.id === I,
|
|
6689
|
+
clipStartSample: ae.startSample,
|
|
6690
|
+
clipDurationSamples: ae.durationSamples,
|
|
6689
6691
|
renderMode: xe,
|
|
6690
6692
|
spectrogramData: wt,
|
|
6691
|
-
samplesPerPixel:
|
|
6693
|
+
samplesPerPixel: U,
|
|
6692
6694
|
spectrogramColorLUT: it?.colorLUT,
|
|
6693
6695
|
spectrogramFrequencyScaleFn: it?.frequencyScaleFn,
|
|
6694
|
-
spectrogramMinFrequency:
|
|
6695
|
-
spectrogramMaxFrequency:
|
|
6696
|
+
spectrogramMinFrequency: rt?.minFrequency,
|
|
6697
|
+
spectrogramMaxFrequency: rt?.maxFrequency,
|
|
6696
6698
|
spectrogramWorkerApi: Z,
|
|
6697
|
-
spectrogramClipId:
|
|
6698
|
-
spectrogramOnCanvasesReady:
|
|
6699
|
-
|
|
6699
|
+
spectrogramClipId: ae.clipId,
|
|
6700
|
+
spectrogramOnCanvasesReady: te ? (Pe, Ct) => {
|
|
6701
|
+
te.registerSpectrogramCanvases(ae.clipId, Ge, Pe, Ct);
|
|
6700
6702
|
} : void 0
|
|
6701
6703
|
},
|
|
6702
|
-
`${
|
|
6704
|
+
`${ae.clipId}-${Ge}`
|
|
6703
6705
|
);
|
|
6704
6706
|
})
|
|
6705
6707
|
},
|
|
6706
|
-
|
|
6708
|
+
ae.clipId
|
|
6707
6709
|
);
|
|
6708
6710
|
}),
|
|
6709
|
-
p?.isRecording && p.trackId ===
|
|
6711
|
+
p?.isRecording && p.trackId === ne.id && p.peaks.length > 0 && /* @__PURE__ */ w(
|
|
6710
6712
|
Ut,
|
|
6711
6713
|
{
|
|
6712
6714
|
clipId: "recording-preview",
|
|
@@ -6715,11 +6717,11 @@ const zs = 60, Ls = ({
|
|
|
6715
6717
|
trackName: "Recording...",
|
|
6716
6718
|
startSample: p.startSample,
|
|
6717
6719
|
durationSamples: p.durationSamples,
|
|
6718
|
-
samplesPerPixel:
|
|
6720
|
+
samplesPerPixel: U,
|
|
6719
6721
|
showHeader: o,
|
|
6720
6722
|
disableHeaderDrag: !0,
|
|
6721
|
-
isSelected:
|
|
6722
|
-
trackId:
|
|
6723
|
+
isSelected: ne.id === I,
|
|
6724
|
+
trackId: ne.id,
|
|
6723
6725
|
children: /* @__PURE__ */ w(
|
|
6724
6726
|
Bn,
|
|
6725
6727
|
{
|
|
@@ -6727,32 +6729,32 @@ const zs = 60, Ls = ({
|
|
|
6727
6729
|
data: p.peaks,
|
|
6728
6730
|
bits: 16,
|
|
6729
6731
|
length: Math.floor(p.peaks.length / 2),
|
|
6730
|
-
isSelected:
|
|
6732
|
+
isSelected: ne.id === I,
|
|
6731
6733
|
clipStartSample: p.startSample,
|
|
6732
6734
|
clipDurationSamples: p.durationSamples
|
|
6733
6735
|
},
|
|
6734
|
-
`${
|
|
6736
|
+
`${ne.id}-recording-0`
|
|
6735
6737
|
)
|
|
6736
6738
|
},
|
|
6737
|
-
`${
|
|
6739
|
+
`${ne.id}-recording`
|
|
6738
6740
|
)
|
|
6739
6741
|
]
|
|
6740
6742
|
}
|
|
6741
|
-
) },
|
|
6743
|
+
) }, ne.id);
|
|
6742
6744
|
}),
|
|
6743
|
-
b.length > 0 && F && /* @__PURE__ */ w(F.AnnotationBoxesWrapper, { height: 30, width:
|
|
6744
|
-
const
|
|
6745
|
+
b.length > 0 && F && /* @__PURE__ */ w(F.AnnotationBoxesWrapper, { height: 30, width: ge, children: b.map((P, L) => {
|
|
6746
|
+
const ne = P.start * q / U, ke = P.end * q / U, xe = a ? a(P, L) : P.id;
|
|
6745
6747
|
return /* @__PURE__ */ w(
|
|
6746
6748
|
F.AnnotationBox,
|
|
6747
6749
|
{
|
|
6748
6750
|
annotationId: P.id,
|
|
6749
6751
|
annotationIndex: L,
|
|
6750
|
-
startPosition:
|
|
6752
|
+
startPosition: ne,
|
|
6751
6753
|
endPosition: ke,
|
|
6752
6754
|
label: xe,
|
|
6753
6755
|
color: "#ff9800",
|
|
6754
6756
|
isActive: P.id === g,
|
|
6755
|
-
onClick: () =>
|
|
6757
|
+
onClick: () => Oe(P),
|
|
6756
6758
|
editable: x
|
|
6757
6759
|
},
|
|
6758
6760
|
P.id
|
|
@@ -6761,27 +6763,27 @@ const zs = 60, Ls = ({
|
|
|
6761
6763
|
h !== C && /* @__PURE__ */ w(
|
|
6762
6764
|
Qn,
|
|
6763
6765
|
{
|
|
6764
|
-
startPosition: Math.min(h, C) * q /
|
|
6765
|
-
endPosition: Math.max(h, C) * q /
|
|
6766
|
+
startPosition: Math.min(h, C) * q / U + (ee.show ? ee.width : 0),
|
|
6767
|
+
endPosition: Math.max(h, C) * q / U + (ee.show ? ee.width : 0),
|
|
6766
6768
|
color: f.selectionColor
|
|
6767
6769
|
}
|
|
6768
6770
|
),
|
|
6769
6771
|
(d || h === C) && (n ? n({
|
|
6770
|
-
position: (v.current ?? 0) * q /
|
|
6772
|
+
position: (v.current ?? 0) * q / U + (ee.show ? ee.width : 0),
|
|
6771
6773
|
color: f.playheadColor,
|
|
6772
6774
|
isPlaying: d,
|
|
6773
6775
|
currentTimeRef: v,
|
|
6774
6776
|
playbackStartTimeRef: y,
|
|
6775
6777
|
audioStartPositionRef: m,
|
|
6776
|
-
samplesPerPixel:
|
|
6778
|
+
samplesPerPixel: U,
|
|
6777
6779
|
sampleRate: q,
|
|
6778
|
-
controlsOffset:
|
|
6779
|
-
getAudioContextTime: () =>
|
|
6780
|
+
controlsOffset: ee.show ? ee.width : 0,
|
|
6781
|
+
getAudioContextTime: () => ze().currentTime
|
|
6780
6782
|
}) : /* @__PURE__ */ w(
|
|
6781
6783
|
Zs,
|
|
6782
6784
|
{
|
|
6783
6785
|
color: f.playheadColor,
|
|
6784
|
-
controlsOffset:
|
|
6786
|
+
controlsOffset: ee.show ? ee.width : 0
|
|
6785
6787
|
}
|
|
6786
6788
|
))
|
|
6787
6789
|
] })
|
|
@@ -6789,16 +6791,16 @@ const zs = 60, Ls = ({
|
|
|
6789
6791
|
)
|
|
6790
6792
|
}
|
|
6791
6793
|
),
|
|
6792
|
-
|
|
6794
|
+
te?.SettingsModal && typeof document < "u" && Vn(
|
|
6793
6795
|
/* @__PURE__ */ w(
|
|
6794
|
-
|
|
6796
|
+
te.SettingsModal,
|
|
6795
6797
|
{
|
|
6796
|
-
open:
|
|
6797
|
-
onClose: () =>
|
|
6798
|
-
config:
|
|
6799
|
-
colorMap:
|
|
6798
|
+
open: be !== null,
|
|
6799
|
+
onClose: () => ye(null),
|
|
6800
|
+
config: be !== null ? te.trackSpectrogramOverrides.get(be)?.config ?? V.find((P) => P.id === be)?.spectrogramConfig ?? te.spectrogramConfig ?? {} : {},
|
|
6801
|
+
colorMap: be !== null ? te.trackSpectrogramOverrides.get(be)?.colorMap ?? V.find((P) => P.id === be)?.spectrogramColorMap ?? te.spectrogramColorMap ?? "viridis" : "viridis",
|
|
6800
6802
|
onApply: (P, L) => {
|
|
6801
|
-
|
|
6803
|
+
be !== null && te.setTrackSpectrogramConfig(be, P, L);
|
|
6802
6804
|
}
|
|
6803
6805
|
}
|
|
6804
6806
|
),
|
|
@@ -6820,7 +6822,7 @@ const zs = 60, Ls = ({
|
|
|
6820
6822
|
annotationsEditable: c,
|
|
6821
6823
|
linkEndpoints: u,
|
|
6822
6824
|
continuousPlay: p
|
|
6823
|
-
} =
|
|
6825
|
+
} = Xe(), f = yt(), { setAnnotations: d } = Ce(), v = a ?? { linkEndpoints: u, continuousPlay: p }, y = E((h) => {
|
|
6824
6826
|
d(h), n?.(h);
|
|
6825
6827
|
}, [d, n]), { AnnotationText: m } = f;
|
|
6826
6828
|
return /* @__PURE__ */ w(
|
|
@@ -6858,8 +6860,8 @@ const zs = 60, Ls = ({
|
|
|
6858
6860
|
onRemoveTrack: y,
|
|
6859
6861
|
recordingState: m
|
|
6860
6862
|
}) => {
|
|
6861
|
-
const { annotations: h } =
|
|
6862
|
-
return /* @__PURE__ */
|
|
6863
|
+
const { annotations: h } = Xe();
|
|
6864
|
+
return /* @__PURE__ */ le(et, { children: [
|
|
6863
6865
|
/* @__PURE__ */ w(
|
|
6864
6866
|
Ls,
|
|
6865
6867
|
{
|
|
@@ -6991,7 +6993,7 @@ const zs = 60, Ls = ({
|
|
|
6991
6993
|
let d;
|
|
6992
6994
|
f === "inverted" ? d = s?.selectedWaveFillColor || s?.waveFillColor || "white" : d = s?.selectedWaveOutlineColor || s?.waveOutlineColor || "grey";
|
|
6993
6995
|
const v = ct(d);
|
|
6994
|
-
return /* @__PURE__ */
|
|
6996
|
+
return /* @__PURE__ */ le(Ns, { children: [
|
|
6995
6997
|
/* @__PURE__ */ w(
|
|
6996
6998
|
Ys,
|
|
6997
6999
|
{
|
|
@@ -7028,42 +7030,42 @@ const zs = 60, Ls = ({
|
|
|
7028
7030
|
samplesPerPixel: x,
|
|
7029
7031
|
controls: S,
|
|
7030
7032
|
playoutRef: M,
|
|
7031
|
-
barWidth:
|
|
7032
|
-
barGap:
|
|
7033
|
-
} = on(), [
|
|
7034
|
-
|
|
7035
|
-
}, [y]),
|
|
7033
|
+
barWidth: I,
|
|
7034
|
+
barGap: T
|
|
7035
|
+
} = on(), [A, k] = H(0), [F, B] = H(0), [W, N] = H(!1), Y = R(null), z = E((V) => {
|
|
7036
|
+
Y.current = V, y(V);
|
|
7037
|
+
}, [y]), J = Math.floor(m * C / x), K = E(async (V) => {
|
|
7036
7038
|
d(V.id);
|
|
7037
7039
|
try {
|
|
7038
7040
|
await p(V.start);
|
|
7039
|
-
} catch (
|
|
7040
|
-
console.error("waveform-playlist: Failed to start playback for annotation", V.id,
|
|
7041
|
+
} catch (fe) {
|
|
7042
|
+
console.error("waveform-playlist: Failed to start playback for annotation", V.id, fe);
|
|
7041
7043
|
}
|
|
7042
|
-
}, [d, p]),
|
|
7044
|
+
}, [d, p]), se = E((V) => {
|
|
7043
7045
|
v(V), r?.(V);
|
|
7044
|
-
}, [v, r]), { onDragStart:
|
|
7046
|
+
}, [v, r]), { onDragStart: Q, onDragMove: ie, onDragEnd: ue } = xs({
|
|
7045
7047
|
annotations: l,
|
|
7046
|
-
onAnnotationsChange:
|
|
7048
|
+
onAnnotationsChange: se,
|
|
7047
7049
|
samplesPerPixel: x,
|
|
7048
7050
|
sampleRate: C,
|
|
7049
7051
|
duration: m,
|
|
7050
7052
|
linkEndpoints: n
|
|
7051
|
-
}),
|
|
7052
|
-
const
|
|
7053
|
-
|
|
7054
|
-
}, [S, x, C]),
|
|
7053
|
+
}), he = E((V) => {
|
|
7054
|
+
const fe = V.currentTarget.getBoundingClientRect(), U = S.show ? S.width : 0, ce = (V.clientX - fe.left - U) * x / C;
|
|
7055
|
+
N(!0), k(ce), B(ce);
|
|
7056
|
+
}, [S, x, C]), pe = E((V) => {
|
|
7055
7057
|
if (!W) return;
|
|
7056
|
-
const
|
|
7058
|
+
const fe = V.currentTarget.getBoundingClientRect(), U = S.show ? S.width : 0, ce = (V.clientX - fe.left - U) * x / C;
|
|
7057
7059
|
B(ce);
|
|
7058
|
-
}, [W, S, x, C]),
|
|
7060
|
+
}, [W, S, x, C]), De = E((V) => {
|
|
7059
7061
|
if (!W) return;
|
|
7060
|
-
|
|
7061
|
-
const
|
|
7062
|
-
Math.abs(
|
|
7063
|
-
}, [W,
|
|
7062
|
+
N(!1);
|
|
7063
|
+
const fe = V.currentTarget.getBoundingClientRect(), U = S.show ? S.width : 0, ce = (V.clientX - fe.left - U) * x / C, ve = Math.min(A, ce), ee = Math.max(A, ce);
|
|
7064
|
+
Math.abs(ee - ve) < 0.1 ? (f(ve), k(ve), B(ve), o && M.current && (M.current.stop(), p(ve))) : (k(ve), B(ee));
|
|
7065
|
+
}, [W, A, x, C, S, f, o, M, p]);
|
|
7064
7066
|
if (h.length === 0)
|
|
7065
7067
|
return /* @__PURE__ */ w("div", { className: a, children: "Loading waveform..." });
|
|
7066
|
-
const
|
|
7068
|
+
const de = null;
|
|
7067
7069
|
return /* @__PURE__ */ w(nr, { children: /* @__PURE__ */ w(
|
|
7068
7070
|
At.Provider,
|
|
7069
7071
|
{
|
|
@@ -7075,8 +7077,8 @@ const zs = 60, Ls = ({
|
|
|
7075
7077
|
timeScaleHeight: g,
|
|
7076
7078
|
duration: m * 1e3,
|
|
7077
7079
|
controls: S,
|
|
7078
|
-
barWidth:
|
|
7079
|
-
barGap:
|
|
7080
|
+
barWidth: I,
|
|
7081
|
+
barGap: T
|
|
7080
7082
|
},
|
|
7081
7083
|
children: /* @__PURE__ */ w(
|
|
7082
7084
|
en,
|
|
@@ -7084,36 +7086,36 @@ const zs = 60, Ls = ({
|
|
|
7084
7086
|
theme: s,
|
|
7085
7087
|
backgroundColor: ct(s.waveOutlineColor),
|
|
7086
7088
|
timescaleBackgroundColor: s.timescaleBackgroundColor,
|
|
7087
|
-
scrollContainerWidth:
|
|
7088
|
-
timescaleWidth:
|
|
7089
|
-
tracksWidth:
|
|
7089
|
+
scrollContainerWidth: J + (S.show ? S.width : 0),
|
|
7090
|
+
timescaleWidth: J,
|
|
7091
|
+
tracksWidth: J,
|
|
7090
7092
|
controlsWidth: S.show ? S.width : 0,
|
|
7091
|
-
onTracksMouseDown:
|
|
7092
|
-
onTracksMouseMove:
|
|
7093
|
-
onTracksMouseUp:
|
|
7094
|
-
scrollContainerRef:
|
|
7093
|
+
onTracksMouseDown: he,
|
|
7094
|
+
onTracksMouseMove: pe,
|
|
7095
|
+
onTracksMouseUp: De,
|
|
7096
|
+
scrollContainerRef: z,
|
|
7095
7097
|
isSelecting: W,
|
|
7096
7098
|
timescale: g > 0 ? /* @__PURE__ */ w(ar, {}) : void 0,
|
|
7097
|
-
children: /* @__PURE__ */
|
|
7098
|
-
h.map((V,
|
|
7099
|
-
const
|
|
7100
|
-
return /* @__PURE__ */ w(nn.Provider, { value:
|
|
7099
|
+
children: /* @__PURE__ */ le(et, { children: [
|
|
7100
|
+
h.map((V, fe) => {
|
|
7101
|
+
const U = V.length > 0 ? Math.max(...V.map((q) => q.peaks.data.length)) : 1;
|
|
7102
|
+
return /* @__PURE__ */ w(nn.Provider, { value: de, children: /* @__PURE__ */ w(
|
|
7101
7103
|
or,
|
|
7102
7104
|
{
|
|
7103
|
-
numChannels:
|
|
7105
|
+
numChannels: U,
|
|
7104
7106
|
backgroundColor: ct(s.waveOutlineColor),
|
|
7105
7107
|
offset: 0,
|
|
7106
|
-
width:
|
|
7108
|
+
width: J,
|
|
7107
7109
|
hasClipHeaders: !1,
|
|
7108
|
-
trackId: `media-element-track-${
|
|
7110
|
+
trackId: `media-element-track-${fe}`,
|
|
7109
7111
|
isSelected: !0,
|
|
7110
7112
|
children: V.map((q, ce) => {
|
|
7111
|
-
const
|
|
7113
|
+
const ve = q.peaks, ee = ve.length;
|
|
7112
7114
|
return /* @__PURE__ */ w(
|
|
7113
7115
|
Ut,
|
|
7114
7116
|
{
|
|
7115
7117
|
clipId: q.clipId,
|
|
7116
|
-
trackIndex:
|
|
7118
|
+
trackIndex: fe,
|
|
7117
7119
|
clipIndex: ce,
|
|
7118
7120
|
trackName: q.trackName,
|
|
7119
7121
|
startSample: q.startSample,
|
|
@@ -7122,46 +7124,46 @@ const zs = 60, Ls = ({
|
|
|
7122
7124
|
showHeader: !1,
|
|
7123
7125
|
disableHeaderDrag: !0,
|
|
7124
7126
|
isSelected: !0,
|
|
7125
|
-
trackId: `media-element-track-${
|
|
7126
|
-
children:
|
|
7127
|
+
trackId: `media-element-track-${fe}`,
|
|
7128
|
+
children: ve.data.map((Ze, Ue) => /* @__PURE__ */ w(
|
|
7127
7129
|
js,
|
|
7128
7130
|
{
|
|
7129
|
-
index:
|
|
7130
|
-
data:
|
|
7131
|
-
bits:
|
|
7132
|
-
length:
|
|
7131
|
+
index: Ue,
|
|
7132
|
+
data: Ze,
|
|
7133
|
+
bits: ve.bits,
|
|
7134
|
+
length: ee,
|
|
7133
7135
|
clipStartSample: q.startSample,
|
|
7134
7136
|
clipDurationSamples: q.durationSamples
|
|
7135
7137
|
},
|
|
7136
|
-
`${
|
|
7138
|
+
`${fe}-${ce}-${Ue}`
|
|
7137
7139
|
))
|
|
7138
7140
|
},
|
|
7139
|
-
`${
|
|
7141
|
+
`${fe}-${ce}`
|
|
7140
7142
|
);
|
|
7141
7143
|
})
|
|
7142
7144
|
}
|
|
7143
|
-
) },
|
|
7145
|
+
) }, fe);
|
|
7144
7146
|
}),
|
|
7145
7147
|
l.length > 0 && u && /* @__PURE__ */ w(
|
|
7146
7148
|
pa,
|
|
7147
7149
|
{
|
|
7148
|
-
onDragStart:
|
|
7149
|
-
onDragMove:
|
|
7150
|
-
onDragEnd:
|
|
7150
|
+
onDragStart: Q,
|
|
7151
|
+
onDragMove: ie,
|
|
7152
|
+
onDragEnd: ue,
|
|
7151
7153
|
modifiers: t ? [ga] : [],
|
|
7152
|
-
children: /* @__PURE__ */ w(u.AnnotationBoxesWrapper, { height: 30, width:
|
|
7153
|
-
const
|
|
7154
|
+
children: /* @__PURE__ */ w(u.AnnotationBoxesWrapper, { height: 30, width: J, children: l.map((V, fe) => {
|
|
7155
|
+
const U = V.start * C / x, q = V.end * C / x, ce = e ? e(V, fe) : V.id;
|
|
7154
7156
|
return /* @__PURE__ */ w(
|
|
7155
7157
|
u.AnnotationBox,
|
|
7156
7158
|
{
|
|
7157
7159
|
annotationId: V.id,
|
|
7158
|
-
annotationIndex:
|
|
7159
|
-
startPosition:
|
|
7160
|
+
annotationIndex: fe,
|
|
7161
|
+
startPosition: U,
|
|
7160
7162
|
endPosition: q,
|
|
7161
7163
|
label: ce,
|
|
7162
7164
|
color: "#ff9800",
|
|
7163
7165
|
isActive: V.id === c,
|
|
7164
|
-
onClick: () =>
|
|
7166
|
+
onClick: () => K(V),
|
|
7165
7167
|
editable: t
|
|
7166
7168
|
},
|
|
7167
7169
|
V.id
|
|
@@ -7169,11 +7171,11 @@ const zs = 60, Ls = ({
|
|
|
7169
7171
|
}) })
|
|
7170
7172
|
}
|
|
7171
7173
|
),
|
|
7172
|
-
|
|
7174
|
+
A !== F && /* @__PURE__ */ w(
|
|
7173
7175
|
Qn,
|
|
7174
7176
|
{
|
|
7175
|
-
startPosition: Math.min(
|
|
7176
|
-
endPosition: Math.max(
|
|
7177
|
+
startPosition: Math.min(A, F) * C / x + (S.show ? S.width : 0),
|
|
7178
|
+
endPosition: Math.max(A, F) * C / x + (S.show ? S.width : 0),
|
|
7177
7179
|
color: s.selectionColor
|
|
7178
7180
|
}
|
|
7179
7181
|
),
|
|
@@ -7199,7 +7201,7 @@ const zs = 60, Ls = ({
|
|
|
7199
7201
|
scrollActivePosition: o = "center",
|
|
7200
7202
|
scrollActiveContainer: i = "nearest"
|
|
7201
7203
|
}) => {
|
|
7202
|
-
const { annotations: l, activeAnnotationId: c, continuousPlay: u } = an(), p = yt(), { setAnnotations: f } = Cr(), d = s ?? { linkEndpoints: !1, continuousPlay: u }, v =
|
|
7204
|
+
const { annotations: l, activeAnnotationId: c, continuousPlay: u } = an(), p = yt(), { setAnnotations: f } = Cr(), d = s ?? { linkEndpoints: !1, continuousPlay: u }, v = E((m) => {
|
|
7203
7205
|
f(m), n?.(m);
|
|
7204
7206
|
}, [f, n]), { AnnotationText: y } = p;
|
|
7205
7207
|
return /* @__PURE__ */ w(
|
|
@@ -7230,7 +7232,7 @@ const zs = 60, Ls = ({
|
|
|
7230
7232
|
className: l
|
|
7231
7233
|
}) => {
|
|
7232
7234
|
const { annotations: c } = an();
|
|
7233
|
-
return /* @__PURE__ */
|
|
7235
|
+
return /* @__PURE__ */ le(et, { children: [
|
|
7234
7236
|
/* @__PURE__ */ w(
|
|
7235
7237
|
qs,
|
|
7236
7238
|
{
|
|
@@ -7314,11 +7316,11 @@ export {
|
|
|
7314
7316
|
Cr as useMediaElementControls,
|
|
7315
7317
|
on as useMediaElementData,
|
|
7316
7318
|
an as useMediaElementState,
|
|
7317
|
-
|
|
7319
|
+
Le as usePlaybackAnimation,
|
|
7318
7320
|
hi as usePlaybackShortcuts,
|
|
7319
|
-
|
|
7321
|
+
Ce as usePlaylistControls,
|
|
7320
7322
|
Be as usePlaylistData,
|
|
7321
|
-
|
|
7323
|
+
Xe as usePlaylistState,
|
|
7322
7324
|
Yi as useSpectrogramIntegration,
|
|
7323
7325
|
gs as useTimeFormat,
|
|
7324
7326
|
wi as useTrackDynamicEffects,
|