@livo-tv/blocks 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +327 -159
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +261 -93
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var React8 = require('react');
|
|
5
5
|
var lucideReact = require('lucide-react');
|
|
6
6
|
var clsx = require('clsx');
|
|
7
7
|
var tailwindMerge = require('tailwind-merge');
|
|
@@ -35,16 +35,16 @@ function _interopNamespace(e) {
|
|
|
35
35
|
return Object.freeze(n);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var React8__namespace = /*#__PURE__*/_interopNamespace(React8);
|
|
39
39
|
var AlertDialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(AlertDialogPrimitive);
|
|
40
40
|
var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
|
|
41
41
|
var SliderPrimitive__namespace = /*#__PURE__*/_interopNamespace(SliderPrimitive);
|
|
42
42
|
var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive);
|
|
43
43
|
var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
|
|
44
44
|
|
|
45
|
-
var LanguageContext =
|
|
45
|
+
var LanguageContext = React8.createContext(null);
|
|
46
46
|
function useLanguageContext() {
|
|
47
|
-
return
|
|
47
|
+
return React8.useContext(LanguageContext);
|
|
48
48
|
}
|
|
49
49
|
function cn(...inputs) {
|
|
50
50
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
@@ -651,20 +651,20 @@ function useEditableSection({
|
|
|
651
651
|
...DEFAULT_EDITABLE_SECTION_LABELS,
|
|
652
652
|
...labels
|
|
653
653
|
};
|
|
654
|
-
const [mode, setMode] =
|
|
655
|
-
const [status, setStatus] =
|
|
656
|
-
const [confirmOpen, setConfirmOpen] =
|
|
657
|
-
const [minHeightPx, setMinHeightPx] =
|
|
658
|
-
const contentRef =
|
|
659
|
-
const editButtonRef =
|
|
660
|
-
const measuredHeightRef =
|
|
661
|
-
const shouldFocusEditRef =
|
|
662
|
-
const shouldFocusFirstFieldRef =
|
|
663
|
-
const editButtonId =
|
|
664
|
-
const contentFormId =
|
|
654
|
+
const [mode, setMode] = React8.useState("reading");
|
|
655
|
+
const [status, setStatus] = React8.useState(null);
|
|
656
|
+
const [confirmOpen, setConfirmOpen] = React8.useState(false);
|
|
657
|
+
const [minHeightPx, setMinHeightPx] = React8.useState(void 0);
|
|
658
|
+
const contentRef = React8.useRef(null);
|
|
659
|
+
const editButtonRef = React8.useRef(null);
|
|
660
|
+
const measuredHeightRef = React8.useRef(0);
|
|
661
|
+
const shouldFocusEditRef = React8.useRef(false);
|
|
662
|
+
const shouldFocusFirstFieldRef = React8.useRef(false);
|
|
663
|
+
const editButtonId = React8.useId();
|
|
664
|
+
const contentFormId = React8.useId();
|
|
665
665
|
const isEditing = mode === "editing" || mode === "saving";
|
|
666
666
|
const isSaving = mode === "saving";
|
|
667
|
-
|
|
667
|
+
React8.useEffect(() => {
|
|
668
668
|
if (mode === "reading" && shouldFocusEditRef.current) {
|
|
669
669
|
shouldFocusEditRef.current = false;
|
|
670
670
|
editButtonRef.current?.focus();
|
|
@@ -682,18 +682,18 @@ function useEditableSection({
|
|
|
682
682
|
focusFirstField(contentRef.current);
|
|
683
683
|
}
|
|
684
684
|
}, [mode]);
|
|
685
|
-
const exitToReading =
|
|
685
|
+
const exitToReading = React8.useCallback(() => {
|
|
686
686
|
setConfirmOpen(false);
|
|
687
687
|
shouldFocusEditRef.current = true;
|
|
688
688
|
setMode("reading");
|
|
689
689
|
onDiscard?.();
|
|
690
690
|
}, [onDiscard]);
|
|
691
|
-
const startEdit =
|
|
691
|
+
const startEdit = React8.useCallback(() => {
|
|
692
692
|
setStatus(null);
|
|
693
693
|
shouldFocusFirstFieldRef.current = true;
|
|
694
694
|
setMode("editing");
|
|
695
695
|
}, []);
|
|
696
|
-
const requestCancel =
|
|
696
|
+
const requestCancel = React8.useCallback(() => {
|
|
697
697
|
if (isSaving) return;
|
|
698
698
|
if (isDirty) {
|
|
699
699
|
setConfirmOpen(true);
|
|
@@ -701,7 +701,7 @@ function useEditableSection({
|
|
|
701
701
|
}
|
|
702
702
|
exitToReading();
|
|
703
703
|
}, [exitToReading, isDirty, isSaving]);
|
|
704
|
-
const handleSubmit =
|
|
704
|
+
const handleSubmit = React8.useCallback(
|
|
705
705
|
(event) => {
|
|
706
706
|
event.preventDefault();
|
|
707
707
|
if (isSaving) return;
|
|
@@ -721,7 +721,7 @@ function useEditableSection({
|
|
|
721
721
|
},
|
|
722
722
|
[isSaving, onSave, resolvedLabels.saved]
|
|
723
723
|
);
|
|
724
|
-
const handleFormKeyDown =
|
|
724
|
+
const handleFormKeyDown = React8.useCallback(
|
|
725
725
|
(event) => {
|
|
726
726
|
if (event.key !== "Escape") return;
|
|
727
727
|
event.preventDefault();
|
|
@@ -729,7 +729,7 @@ function useEditableSection({
|
|
|
729
729
|
},
|
|
730
730
|
[requestCancel]
|
|
731
731
|
);
|
|
732
|
-
|
|
732
|
+
React8.useEffect(() => {
|
|
733
733
|
if (!stableHeight || !isEditing) return;
|
|
734
734
|
const el = contentRef.current;
|
|
735
735
|
if (!el) return;
|
|
@@ -968,13 +968,13 @@ function SafeImage({
|
|
|
968
968
|
onError,
|
|
969
969
|
...imgProps
|
|
970
970
|
}) {
|
|
971
|
-
const [failed, setFailed] =
|
|
972
|
-
const imgRef =
|
|
971
|
+
const [failed, setFailed] = React8.useState(false);
|
|
972
|
+
const imgRef = React8.useRef(null);
|
|
973
973
|
const resolvedSrc = typeof src === "string" && src.length > 0 ? src : null;
|
|
974
|
-
|
|
974
|
+
React8.useLayoutEffect(() => {
|
|
975
975
|
setFailed(false);
|
|
976
976
|
}, [resolvedSrc]);
|
|
977
|
-
|
|
977
|
+
React8.useLayoutEffect(() => {
|
|
978
978
|
const img = imgRef.current;
|
|
979
979
|
if (img && isBrokenImage(img)) {
|
|
980
980
|
setFailed(true);
|
|
@@ -1045,18 +1045,18 @@ function ThemeSwitcher({
|
|
|
1045
1045
|
labels: userLabels
|
|
1046
1046
|
}) {
|
|
1047
1047
|
const { theme, setTheme } = nextThemes.useTheme();
|
|
1048
|
-
const [mounted, setMounted] =
|
|
1048
|
+
const [mounted, setMounted] = React8.useState(false);
|
|
1049
1049
|
const reduceMotion = framerMotion.useReducedMotion();
|
|
1050
1050
|
const sizes = sizeClasses[size];
|
|
1051
1051
|
const shapeClass = shapeClasses[shape];
|
|
1052
1052
|
const labels = { ...defaultLabels, ...userLabels };
|
|
1053
|
-
const handleThemeClick =
|
|
1053
|
+
const handleThemeClick = React8.useCallback(
|
|
1054
1054
|
(themeKey) => {
|
|
1055
1055
|
setTheme(themeKey);
|
|
1056
1056
|
},
|
|
1057
1057
|
[setTheme]
|
|
1058
1058
|
);
|
|
1059
|
-
|
|
1059
|
+
React8.useEffect(() => {
|
|
1060
1060
|
setMounted(true);
|
|
1061
1061
|
}, []);
|
|
1062
1062
|
if (!mounted) {
|
|
@@ -1336,7 +1336,7 @@ function Slider({
|
|
|
1336
1336
|
max = 100,
|
|
1337
1337
|
...props
|
|
1338
1338
|
}) {
|
|
1339
|
-
const _values =
|
|
1339
|
+
const _values = React8__namespace.useMemo(
|
|
1340
1340
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
1341
1341
|
[value, defaultValue, min, max]
|
|
1342
1342
|
);
|
|
@@ -1447,18 +1447,18 @@ function AvatarEditor({
|
|
|
1447
1447
|
labels
|
|
1448
1448
|
}) {
|
|
1449
1449
|
const t = { ...DEFAULT_LABELS, ...labels };
|
|
1450
|
-
const canvasRef =
|
|
1451
|
-
const fileInputRef =
|
|
1452
|
-
const containerRef =
|
|
1453
|
-
const [image, setImage] =
|
|
1454
|
-
const [imageLoaded, setImageLoaded] =
|
|
1455
|
-
const [zoom, setZoom] =
|
|
1456
|
-
const [rotation, setRotation] =
|
|
1457
|
-
const [position, setPosition] =
|
|
1458
|
-
const [isDragging, setIsDragging] =
|
|
1459
|
-
const [dragStart, setDragStart] =
|
|
1460
|
-
const [showGrid, setShowGrid] =
|
|
1461
|
-
const generateOutput =
|
|
1450
|
+
const canvasRef = React8.useRef(null);
|
|
1451
|
+
const fileInputRef = React8.useRef(null);
|
|
1452
|
+
const containerRef = React8.useRef(null);
|
|
1453
|
+
const [image, setImage] = React8.useState(null);
|
|
1454
|
+
const [imageLoaded, setImageLoaded] = React8.useState(false);
|
|
1455
|
+
const [zoom, setZoom] = React8.useState(1);
|
|
1456
|
+
const [rotation, setRotation] = React8.useState(0);
|
|
1457
|
+
const [position, setPosition] = React8.useState({ x: 0, y: 0 });
|
|
1458
|
+
const [isDragging, setIsDragging] = React8.useState(false);
|
|
1459
|
+
const [dragStart, setDragStart] = React8.useState({ x: 0, y: 0 });
|
|
1460
|
+
const [showGrid, setShowGrid] = React8.useState(initialShowGrid);
|
|
1461
|
+
const generateOutput = React8.useCallback(() => {
|
|
1462
1462
|
if (!canvasRef.current || !image) return null;
|
|
1463
1463
|
const outputCanvas = document.createElement("canvas");
|
|
1464
1464
|
outputCanvas.width = outputSize;
|
|
@@ -1469,7 +1469,7 @@ function AvatarEditor({
|
|
|
1469
1469
|
const mimeType = `image/${outputFormat}`;
|
|
1470
1470
|
return outputCanvas.toDataURL(mimeType, outputQuality);
|
|
1471
1471
|
}, [image, outputSize, outputFormat, outputQuality]);
|
|
1472
|
-
|
|
1472
|
+
React8.useEffect(() => {
|
|
1473
1473
|
if (!canvasRef.current || !image || !imageLoaded) return;
|
|
1474
1474
|
const canvas = canvasRef.current;
|
|
1475
1475
|
const ctx = canvas.getContext("2d");
|
|
@@ -1513,12 +1513,12 @@ function AvatarEditor({
|
|
|
1513
1513
|
generateOutput,
|
|
1514
1514
|
onChange
|
|
1515
1515
|
]);
|
|
1516
|
-
const resetTransforms =
|
|
1516
|
+
const resetTransforms = React8.useCallback(() => {
|
|
1517
1517
|
setZoom(1);
|
|
1518
1518
|
setRotation(0);
|
|
1519
1519
|
setPosition({ x: 0, y: 0 });
|
|
1520
1520
|
}, []);
|
|
1521
|
-
const handleFileSelect =
|
|
1521
|
+
const handleFileSelect = React8.useCallback(
|
|
1522
1522
|
(e) => {
|
|
1523
1523
|
const file = e.target.files?.[0];
|
|
1524
1524
|
if (!file) return;
|
|
@@ -1537,7 +1537,7 @@ function AvatarEditor({
|
|
|
1537
1537
|
},
|
|
1538
1538
|
[resetTransforms]
|
|
1539
1539
|
);
|
|
1540
|
-
const handleMouseDown =
|
|
1540
|
+
const handleMouseDown = React8.useCallback(
|
|
1541
1541
|
(e) => {
|
|
1542
1542
|
if (!imageLoaded) return;
|
|
1543
1543
|
setIsDragging(true);
|
|
@@ -1545,7 +1545,7 @@ function AvatarEditor({
|
|
|
1545
1545
|
},
|
|
1546
1546
|
[imageLoaded, position]
|
|
1547
1547
|
);
|
|
1548
|
-
const handleMouseMove =
|
|
1548
|
+
const handleMouseMove = React8.useCallback(
|
|
1549
1549
|
(e) => {
|
|
1550
1550
|
if (!isDragging) return;
|
|
1551
1551
|
setPosition({
|
|
@@ -1555,10 +1555,10 @@ function AvatarEditor({
|
|
|
1555
1555
|
},
|
|
1556
1556
|
[isDragging, dragStart]
|
|
1557
1557
|
);
|
|
1558
|
-
const handleMouseUp =
|
|
1558
|
+
const handleMouseUp = React8.useCallback(() => {
|
|
1559
1559
|
setIsDragging(false);
|
|
1560
1560
|
}, []);
|
|
1561
|
-
const handleTouchStart =
|
|
1561
|
+
const handleTouchStart = React8.useCallback(
|
|
1562
1562
|
(e) => {
|
|
1563
1563
|
if (!imageLoaded) return;
|
|
1564
1564
|
const touch = e.touches[0];
|
|
@@ -1570,7 +1570,7 @@ function AvatarEditor({
|
|
|
1570
1570
|
},
|
|
1571
1571
|
[imageLoaded, position]
|
|
1572
1572
|
);
|
|
1573
|
-
const handleTouchMove =
|
|
1573
|
+
const handleTouchMove = React8.useCallback(
|
|
1574
1574
|
(e) => {
|
|
1575
1575
|
if (!isDragging) return;
|
|
1576
1576
|
const touch = e.touches[0];
|
|
@@ -1581,7 +1581,7 @@ function AvatarEditor({
|
|
|
1581
1581
|
},
|
|
1582
1582
|
[isDragging, dragStart]
|
|
1583
1583
|
);
|
|
1584
|
-
const handleDiscard =
|
|
1584
|
+
const handleDiscard = React8.useCallback(() => {
|
|
1585
1585
|
setImage(null);
|
|
1586
1586
|
setImageLoaded(false);
|
|
1587
1587
|
resetTransforms();
|
|
@@ -2149,8 +2149,8 @@ function DrawerTitle({
|
|
|
2149
2149
|
);
|
|
2150
2150
|
}
|
|
2151
2151
|
function useMediaQuery(query) {
|
|
2152
|
-
const [matches, setMatches] =
|
|
2153
|
-
|
|
2152
|
+
const [matches, setMatches] = React8.useState(false);
|
|
2153
|
+
React8.useEffect(() => {
|
|
2154
2154
|
const media = window.matchMedia(query);
|
|
2155
2155
|
if (media.matches !== matches) {
|
|
2156
2156
|
setMatches(media.matches);
|
|
@@ -2180,17 +2180,17 @@ function AvatarEditorDialog({
|
|
|
2180
2180
|
className,
|
|
2181
2181
|
editorLabels
|
|
2182
2182
|
}) {
|
|
2183
|
-
const [isOpen, setIsOpen] =
|
|
2184
|
-
const [editedValue, setEditedValue] =
|
|
2185
|
-
const [displaySrc, setDisplaySrc] =
|
|
2186
|
-
const [isSaving, setIsSaving] =
|
|
2187
|
-
const [feedback, setFeedback] =
|
|
2188
|
-
|
|
2183
|
+
const [isOpen, setIsOpen] = React8.useState(false);
|
|
2184
|
+
const [editedValue, setEditedValue] = React8.useState(value ?? null);
|
|
2185
|
+
const [displaySrc, setDisplaySrc] = React8.useState(value ?? null);
|
|
2186
|
+
const [isSaving, setIsSaving] = React8.useState(false);
|
|
2187
|
+
const [feedback, setFeedback] = React8.useState(null);
|
|
2188
|
+
React8.useEffect(() => {
|
|
2189
2189
|
setDisplaySrc(value ?? null);
|
|
2190
2190
|
}, [value]);
|
|
2191
2191
|
const isMobile = useMediaQuery("(max-width: 640px)");
|
|
2192
2192
|
const caption = (placeholder ?? "").trim();
|
|
2193
|
-
const handleOpenChange =
|
|
2193
|
+
const handleOpenChange = React8.useCallback(
|
|
2194
2194
|
(open) => {
|
|
2195
2195
|
if (open) {
|
|
2196
2196
|
setEditedValue(value ?? null);
|
|
@@ -2200,7 +2200,7 @@ function AvatarEditorDialog({
|
|
|
2200
2200
|
},
|
|
2201
2201
|
[value]
|
|
2202
2202
|
);
|
|
2203
|
-
const handleAccept =
|
|
2203
|
+
const handleAccept = React8.useCallback(async () => {
|
|
2204
2204
|
if (!editedValue) return;
|
|
2205
2205
|
setIsSaving(true);
|
|
2206
2206
|
setFeedback(null);
|
|
@@ -2404,8 +2404,8 @@ function probeVideoAudio(el) {
|
|
|
2404
2404
|
return "unknown";
|
|
2405
2405
|
}
|
|
2406
2406
|
function usePrefersReducedMotion() {
|
|
2407
|
-
const [reduced, setReduced] =
|
|
2408
|
-
|
|
2407
|
+
const [reduced, setReduced] = React8__namespace.useState(false);
|
|
2408
|
+
React8__namespace.useEffect(() => {
|
|
2409
2409
|
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
2410
2410
|
const sync = () => setReduced(media.matches);
|
|
2411
2411
|
sync();
|
|
@@ -2422,11 +2422,11 @@ function CurtainVideo({
|
|
|
2422
2422
|
allowSound,
|
|
2423
2423
|
labels
|
|
2424
2424
|
}) {
|
|
2425
|
-
const videoRef =
|
|
2426
|
-
const [playback, setPlayback] =
|
|
2427
|
-
const [muted, setMuted] =
|
|
2428
|
-
const [audio, setAudio] =
|
|
2429
|
-
|
|
2425
|
+
const videoRef = React8__namespace.useRef(null);
|
|
2426
|
+
const [playback, setPlayback] = React8__namespace.useState("pending");
|
|
2427
|
+
const [muted, setMuted] = React8__namespace.useState(true);
|
|
2428
|
+
const [audio, setAudio] = React8__namespace.useState("unknown");
|
|
2429
|
+
React8__namespace.useEffect(() => {
|
|
2430
2430
|
const el = videoRef.current;
|
|
2431
2431
|
if (!el) return;
|
|
2432
2432
|
el.setAttribute("webkit-playsinline", "");
|
|
@@ -2467,7 +2467,7 @@ function CurtainVideo({
|
|
|
2467
2467
|
el.removeEventListener("loadedmetadata", applyAudio);
|
|
2468
2468
|
};
|
|
2469
2469
|
}, [url, freeze]);
|
|
2470
|
-
const startPlayback =
|
|
2470
|
+
const startPlayback = React8__namespace.useCallback(() => {
|
|
2471
2471
|
const el = videoRef.current;
|
|
2472
2472
|
if (!el) return;
|
|
2473
2473
|
el.muted = true;
|
|
@@ -2483,7 +2483,7 @@ function CurtainVideo({
|
|
|
2483
2483
|
}
|
|
2484
2484
|
);
|
|
2485
2485
|
}, []);
|
|
2486
|
-
const setVideoMuted =
|
|
2486
|
+
const setVideoMuted = React8__namespace.useCallback((next) => {
|
|
2487
2487
|
const el = videoRef.current;
|
|
2488
2488
|
if (el) el.muted = next;
|
|
2489
2489
|
setMuted(next);
|
|
@@ -2575,8 +2575,8 @@ function CurtainStage({
|
|
|
2575
2575
|
);
|
|
2576
2576
|
}
|
|
2577
2577
|
function useMediaQuery2(query) {
|
|
2578
|
-
const [matches, setMatches] =
|
|
2579
|
-
|
|
2578
|
+
const [matches, setMatches] = React8.useState(false);
|
|
2579
|
+
React8.useEffect(() => {
|
|
2580
2580
|
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
2581
2581
|
const mql = window.matchMedia(query);
|
|
2582
2582
|
const onChange = () => setMatches(mql.matches);
|
|
@@ -2590,9 +2590,9 @@ function isVideoKind(kind) {
|
|
|
2590
2590
|
return kind === "video";
|
|
2591
2591
|
}
|
|
2592
2592
|
function useElementInView(enabled) {
|
|
2593
|
-
const [node, setNode] =
|
|
2594
|
-
const [inView, setInView] =
|
|
2595
|
-
|
|
2593
|
+
const [node, setNode] = React8__namespace.useState(null);
|
|
2594
|
+
const [inView, setInView] = React8__namespace.useState(false);
|
|
2595
|
+
React8__namespace.useEffect(() => {
|
|
2596
2596
|
if (!enabled || !node || typeof IntersectionObserver === "undefined") {
|
|
2597
2597
|
setInView(false);
|
|
2598
2598
|
return;
|
|
@@ -2764,7 +2764,7 @@ function CurtainPicker({
|
|
|
2764
2764
|
actionsPending = false
|
|
2765
2765
|
}) {
|
|
2766
2766
|
const copy = { ...DEFAULT_CURTAIN_PICKER_LABELS, ...labels };
|
|
2767
|
-
const groupName =
|
|
2767
|
+
const groupName = React8__namespace.useId();
|
|
2768
2768
|
const selectable = typeof onChange === "function";
|
|
2769
2769
|
const compact = variant === "compact";
|
|
2770
2770
|
const selectedId = value === "" ? null : value ?? null;
|
|
@@ -2780,7 +2780,7 @@ function CurtainPicker({
|
|
|
2780
2780
|
canMakeDefault,
|
|
2781
2781
|
canDelete
|
|
2782
2782
|
) : {};
|
|
2783
|
-
const grouped =
|
|
2783
|
+
const grouped = React8__namespace.useMemo(() => {
|
|
2784
2784
|
if (!groupByOwner) {
|
|
2785
2785
|
return [{ group: null, items: ready }];
|
|
2786
2786
|
}
|
|
@@ -3105,8 +3105,8 @@ function WaitingRoom({
|
|
|
3105
3105
|
labels,
|
|
3106
3106
|
className
|
|
3107
3107
|
}) {
|
|
3108
|
-
const [now, setNow] =
|
|
3109
|
-
|
|
3108
|
+
const [now, setNow] = React8__namespace.useState(nowMs ?? Date.now());
|
|
3109
|
+
React8__namespace.useEffect(() => {
|
|
3110
3110
|
if (nowMs != null) {
|
|
3111
3111
|
setNow(nowMs);
|
|
3112
3112
|
return;
|
|
@@ -3201,6 +3201,187 @@ async function castHlsUrl(hlsUrl) {
|
|
|
3201
3201
|
await session.loadMedia(request);
|
|
3202
3202
|
}
|
|
3203
3203
|
|
|
3204
|
+
// src/components/video/seekPreview.ts
|
|
3205
|
+
var XYWH_RE = /#xywh=(\d+),(\d+),(\d+),(\d+)\s*$/;
|
|
3206
|
+
function thumbnailsVttUrlFromPlayback(src) {
|
|
3207
|
+
const trimmed = src.trim();
|
|
3208
|
+
if (!trimmed) return null;
|
|
3209
|
+
const replaced = trimmed.replace(
|
|
3210
|
+
/index\.m3u8(?:\?.*)?$/i,
|
|
3211
|
+
"thumbs/preview.vtt"
|
|
3212
|
+
);
|
|
3213
|
+
if (replaced === trimmed) return null;
|
|
3214
|
+
return replaced;
|
|
3215
|
+
}
|
|
3216
|
+
function parseVttTimestamp(value) {
|
|
3217
|
+
const parts = value.trim().split(":");
|
|
3218
|
+
if (parts.length === 3) {
|
|
3219
|
+
const hours = Number(parts[0]);
|
|
3220
|
+
const minutes = Number(parts[1]);
|
|
3221
|
+
const seconds2 = Number(parts[2]);
|
|
3222
|
+
if ([hours, minutes, seconds2].some((n) => Number.isNaN(n))) return 0;
|
|
3223
|
+
return hours * 3600 + minutes * 60 + seconds2;
|
|
3224
|
+
}
|
|
3225
|
+
if (parts.length === 2) {
|
|
3226
|
+
const minutes = Number(parts[0]);
|
|
3227
|
+
const seconds2 = Number(parts[1]);
|
|
3228
|
+
if ([minutes, seconds2].some((n) => Number.isNaN(n))) return 0;
|
|
3229
|
+
return minutes * 60 + seconds2;
|
|
3230
|
+
}
|
|
3231
|
+
const seconds = Number(value);
|
|
3232
|
+
return Number.isFinite(seconds) ? seconds : 0;
|
|
3233
|
+
}
|
|
3234
|
+
function parseThumbnailsVtt(text, vttUrl) {
|
|
3235
|
+
const cues = [];
|
|
3236
|
+
const blocks = text.replace(/^\uFEFF?WEBVTT[^\n]*\n/i, "").split(/\n\s*\n/);
|
|
3237
|
+
for (const block of blocks) {
|
|
3238
|
+
const lines = block.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
3239
|
+
const timing = lines.find((line) => line.includes("-->"));
|
|
3240
|
+
const payload = lines.find((line) => XYWH_RE.test(line));
|
|
3241
|
+
if (!timing || !payload) continue;
|
|
3242
|
+
const [startRaw, endRaw] = timing.split("-->").map((part) => part.trim());
|
|
3243
|
+
const match = payload.match(XYWH_RE);
|
|
3244
|
+
if (!startRaw || !endRaw || !match) continue;
|
|
3245
|
+
const spriteName = payload.slice(0, match.index);
|
|
3246
|
+
cues.push({
|
|
3247
|
+
start: parseVttTimestamp(startRaw),
|
|
3248
|
+
end: parseVttTimestamp(endRaw),
|
|
3249
|
+
spriteUrl: new URL(spriteName, vttUrl).toString(),
|
|
3250
|
+
x: Number(match[1]),
|
|
3251
|
+
y: Number(match[2]),
|
|
3252
|
+
width: Number(match[3]),
|
|
3253
|
+
height: Number(match[4])
|
|
3254
|
+
});
|
|
3255
|
+
}
|
|
3256
|
+
return cues;
|
|
3257
|
+
}
|
|
3258
|
+
function cueAtTime(cues, time) {
|
|
3259
|
+
if (cues.length === 0) return null;
|
|
3260
|
+
const hit = cues.find((cue) => time >= cue.start && time < cue.end);
|
|
3261
|
+
if (hit) return hit;
|
|
3262
|
+
const last = cues[cues.length - 1];
|
|
3263
|
+
if (last && time >= last.start) return last;
|
|
3264
|
+
return cues[0] ?? null;
|
|
3265
|
+
}
|
|
3266
|
+
function hoverTimeFromClientX(clientX, rect, duration) {
|
|
3267
|
+
if (rect.width <= 0 || duration <= 0) return 0;
|
|
3268
|
+
const ratio = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width));
|
|
3269
|
+
return ratio * duration;
|
|
3270
|
+
}
|
|
3271
|
+
async function loadThumbnailsVtt(src) {
|
|
3272
|
+
const vttUrl = thumbnailsVttUrlFromPlayback(src);
|
|
3273
|
+
if (!vttUrl) return [];
|
|
3274
|
+
try {
|
|
3275
|
+
const response = await fetch(vttUrl);
|
|
3276
|
+
if (!response.ok) return [];
|
|
3277
|
+
const text = await response.text();
|
|
3278
|
+
return parseThumbnailsVtt(text, vttUrl);
|
|
3279
|
+
} catch {
|
|
3280
|
+
return [];
|
|
3281
|
+
}
|
|
3282
|
+
}
|
|
3283
|
+
function SeekBar({
|
|
3284
|
+
src,
|
|
3285
|
+
duration,
|
|
3286
|
+
currentTime,
|
|
3287
|
+
buffered,
|
|
3288
|
+
onSeek,
|
|
3289
|
+
formatTime: formatTime2
|
|
3290
|
+
}) {
|
|
3291
|
+
const trackRef = React8__namespace.useRef(null);
|
|
3292
|
+
const [hoverTime, setHoverTime] = React8__namespace.useState(null);
|
|
3293
|
+
const [cues, setCues] = React8__namespace.useState(null);
|
|
3294
|
+
const loadedSrc = React8__namespace.useRef(null);
|
|
3295
|
+
React8__namespace.useEffect(() => {
|
|
3296
|
+
setCues(null);
|
|
3297
|
+
loadedSrc.current = null;
|
|
3298
|
+
}, [src]);
|
|
3299
|
+
const ensureCues = React8__namespace.useCallback(() => {
|
|
3300
|
+
if (loadedSrc.current === src) return;
|
|
3301
|
+
loadedSrc.current = src;
|
|
3302
|
+
void loadThumbnailsVtt(src).then((next) => {
|
|
3303
|
+
setCues(next);
|
|
3304
|
+
});
|
|
3305
|
+
}, [src]);
|
|
3306
|
+
const updateHover = React8__namespace.useCallback(
|
|
3307
|
+
(clientX) => {
|
|
3308
|
+
const rect = trackRef.current?.getBoundingClientRect();
|
|
3309
|
+
if (!rect) return;
|
|
3310
|
+
setHoverTime(hoverTimeFromClientX(clientX, rect, duration));
|
|
3311
|
+
},
|
|
3312
|
+
[duration]
|
|
3313
|
+
);
|
|
3314
|
+
const cue = hoverTime !== null && cues && cues.length > 0 ? cueAtTime(cues, hoverTime) : null;
|
|
3315
|
+
const hoverPercent = hoverTime !== null && duration > 0 ? Math.min(100, Math.max(0, hoverTime / duration * 100)) : 0;
|
|
3316
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3317
|
+
"div",
|
|
3318
|
+
{
|
|
3319
|
+
ref: trackRef,
|
|
3320
|
+
className: "relative w-full",
|
|
3321
|
+
onPointerEnter: ensureCues,
|
|
3322
|
+
onPointerDown: (event) => {
|
|
3323
|
+
ensureCues();
|
|
3324
|
+
updateHover(event.clientX);
|
|
3325
|
+
},
|
|
3326
|
+
onPointerMove: (event) => {
|
|
3327
|
+
ensureCues();
|
|
3328
|
+
updateHover(event.clientX);
|
|
3329
|
+
},
|
|
3330
|
+
onPointerLeave: () => setHoverTime(null),
|
|
3331
|
+
onPointerUp: () => setHoverTime(null),
|
|
3332
|
+
children: [
|
|
3333
|
+
hoverTime !== null ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3334
|
+
"div",
|
|
3335
|
+
{
|
|
3336
|
+
className: "pointer-events-none absolute bottom-full mb-2 flex flex-col items-center gap-1",
|
|
3337
|
+
style: { left: `${hoverPercent}%`, transform: "translateX(-50%)" },
|
|
3338
|
+
"data-slot": "seek-preview",
|
|
3339
|
+
children: [
|
|
3340
|
+
cue ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3341
|
+
"div",
|
|
3342
|
+
{
|
|
3343
|
+
"aria-hidden": "true",
|
|
3344
|
+
className: "overflow-hidden rounded border border-white/20 bg-black shadow-md",
|
|
3345
|
+
style: {
|
|
3346
|
+
width: cue.width,
|
|
3347
|
+
height: cue.height,
|
|
3348
|
+
backgroundImage: `url(${cue.spriteUrl})`,
|
|
3349
|
+
backgroundPosition: `-${cue.x}px -${cue.y}px`,
|
|
3350
|
+
backgroundRepeat: "no-repeat"
|
|
3351
|
+
}
|
|
3352
|
+
}
|
|
3353
|
+
) : null,
|
|
3354
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-black/80 px-1.5 py-0.5 text-[10px] tabular-nums text-white", children: formatTime2(hoverTime) })
|
|
3355
|
+
]
|
|
3356
|
+
}
|
|
3357
|
+
) : null,
|
|
3358
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3359
|
+
Slider,
|
|
3360
|
+
{
|
|
3361
|
+
"aria-label": "Seek",
|
|
3362
|
+
min: 0,
|
|
3363
|
+
max: duration || 0,
|
|
3364
|
+
step: 0.1,
|
|
3365
|
+
value: [Math.min(currentTime, duration || 0)],
|
|
3366
|
+
onValueChange: (value) => onSeek(value[0] ?? 0),
|
|
3367
|
+
className: "w-full"
|
|
3368
|
+
}
|
|
3369
|
+
),
|
|
3370
|
+
duration > 0 && buffered > currentTime ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3371
|
+
"span",
|
|
3372
|
+
{
|
|
3373
|
+
"aria-hidden": "true",
|
|
3374
|
+
className: "pointer-events-none absolute top-1/2 left-0 h-1.5 -translate-y-1/2 rounded-full bg-white/25",
|
|
3375
|
+
style: {
|
|
3376
|
+
width: `${Math.min(buffered / duration * 100, 100)}%`
|
|
3377
|
+
}
|
|
3378
|
+
}
|
|
3379
|
+
) : null
|
|
3380
|
+
]
|
|
3381
|
+
}
|
|
3382
|
+
);
|
|
3383
|
+
}
|
|
3384
|
+
|
|
3204
3385
|
// src/components/video/hls-config.ts
|
|
3205
3386
|
function shouldRetryLiveEdge404(retryConfig, retryCount, _isTimeout, loaderResponse, defaultRetry) {
|
|
3206
3387
|
if (loaderResponse?.code === 404) {
|
|
@@ -3379,27 +3560,27 @@ function useHlsPlayback({
|
|
|
3379
3560
|
onError,
|
|
3380
3561
|
onPlayingChange
|
|
3381
3562
|
}) {
|
|
3382
|
-
const videoRef =
|
|
3383
|
-
const hlsRef =
|
|
3384
|
-
const [state, setState] =
|
|
3385
|
-
const [qualities, setQualities] =
|
|
3386
|
-
const [activeLevel, setActiveLevel] =
|
|
3387
|
-
const [autoplayState, setAutoplayState] =
|
|
3388
|
-
const [error, setError] =
|
|
3389
|
-
const [reloadKey, setReloadKey] =
|
|
3390
|
-
const onErrorRef =
|
|
3391
|
-
const onPlayingChangeRef =
|
|
3392
|
-
|
|
3563
|
+
const videoRef = React8__namespace.useRef(null);
|
|
3564
|
+
const hlsRef = React8__namespace.useRef(null);
|
|
3565
|
+
const [state, setState] = React8__namespace.useState("idle");
|
|
3566
|
+
const [qualities, setQualities] = React8__namespace.useState([]);
|
|
3567
|
+
const [activeLevel, setActiveLevel] = React8__namespace.useState(-1);
|
|
3568
|
+
const [autoplayState, setAutoplayState] = React8__namespace.useState("none");
|
|
3569
|
+
const [error, setError] = React8__namespace.useState(null);
|
|
3570
|
+
const [reloadKey, setReloadKey] = React8__namespace.useState(0);
|
|
3571
|
+
const onErrorRef = React8__namespace.useRef(onError);
|
|
3572
|
+
const onPlayingChangeRef = React8__namespace.useRef(onPlayingChange);
|
|
3573
|
+
React8__namespace.useEffect(() => {
|
|
3393
3574
|
onErrorRef.current = onError;
|
|
3394
3575
|
onPlayingChangeRef.current = onPlayingChange;
|
|
3395
3576
|
}, [onError, onPlayingChange]);
|
|
3396
|
-
const retry =
|
|
3577
|
+
const retry = React8__namespace.useCallback(() => {
|
|
3397
3578
|
setError(null);
|
|
3398
3579
|
setState("loading");
|
|
3399
3580
|
setAutoplayState("none");
|
|
3400
3581
|
setReloadKey((k) => k + 1);
|
|
3401
3582
|
}, []);
|
|
3402
|
-
|
|
3583
|
+
React8__namespace.useEffect(() => {
|
|
3403
3584
|
const media = videoRef.current;
|
|
3404
3585
|
if (!media || !src || !active) {
|
|
3405
3586
|
setState("idle");
|
|
@@ -3669,7 +3850,7 @@ function useHlsPlayback({
|
|
|
3669
3850
|
destroyHls();
|
|
3670
3851
|
};
|
|
3671
3852
|
}, [src, mode, active, autoPlay, muted, reloadKey]);
|
|
3672
|
-
const setLevel =
|
|
3853
|
+
const setLevel = React8__namespace.useCallback((index) => {
|
|
3673
3854
|
const hls = hlsRef.current;
|
|
3674
3855
|
if (!hls) return;
|
|
3675
3856
|
hls.nextLevel = index;
|
|
@@ -3755,12 +3936,12 @@ function VideoPlayer({
|
|
|
3755
3936
|
className
|
|
3756
3937
|
}) {
|
|
3757
3938
|
const t = { ...DEFAULT_LABELS3, ...labels };
|
|
3758
|
-
const containerRef =
|
|
3759
|
-
const firstPlayFiredRef =
|
|
3760
|
-
const [userStarted, setUserStarted] =
|
|
3939
|
+
const containerRef = React8__namespace.useRef(null);
|
|
3940
|
+
const firstPlayFiredRef = React8__namespace.useRef(false);
|
|
3941
|
+
const [userStarted, setUserStarted] = React8__namespace.useState(false);
|
|
3761
3942
|
const active = autoPlay || !poster || userStarted;
|
|
3762
3943
|
const autoplayActive = autoPlay || userStarted;
|
|
3763
|
-
const handlePlayingChange =
|
|
3944
|
+
const handlePlayingChange = React8__namespace.useCallback(
|
|
3764
3945
|
(playing) => {
|
|
3765
3946
|
setIsPlaying(playing);
|
|
3766
3947
|
if (playing && !firstPlayFiredRef.current) {
|
|
@@ -3789,25 +3970,25 @@ function VideoPlayer({
|
|
|
3789
3970
|
onError,
|
|
3790
3971
|
onPlayingChange: handlePlayingChange
|
|
3791
3972
|
});
|
|
3792
|
-
const [isPlaying, setIsPlaying] =
|
|
3793
|
-
const [isMuted, setIsMuted] =
|
|
3794
|
-
const [volume, setVolume] =
|
|
3795
|
-
const [currentTime, setCurrentTime] =
|
|
3796
|
-
const [duration, setDuration] =
|
|
3797
|
-
const [buffered, setBuffered] =
|
|
3798
|
-
const [isFullscreen, setIsFullscreen] =
|
|
3799
|
-
const [pipActive, setPipActive] =
|
|
3800
|
-
const [controlsVisible, setControlsVisible] =
|
|
3801
|
-
const [playbackRate, setPlaybackRate] =
|
|
3802
|
-
const [openMenu, setOpenMenu] =
|
|
3973
|
+
const [isPlaying, setIsPlaying] = React8__namespace.useState(false);
|
|
3974
|
+
const [isMuted, setIsMuted] = React8__namespace.useState(muted);
|
|
3975
|
+
const [volume, setVolume] = React8__namespace.useState(1);
|
|
3976
|
+
const [currentTime, setCurrentTime] = React8__namespace.useState(0);
|
|
3977
|
+
const [duration, setDuration] = React8__namespace.useState(0);
|
|
3978
|
+
const [buffered, setBuffered] = React8__namespace.useState(0);
|
|
3979
|
+
const [isFullscreen, setIsFullscreen] = React8__namespace.useState(false);
|
|
3980
|
+
const [pipActive, setPipActive] = React8__namespace.useState(false);
|
|
3981
|
+
const [controlsVisible, setControlsVisible] = React8__namespace.useState(true);
|
|
3982
|
+
const [playbackRate, setPlaybackRate] = React8__namespace.useState(1);
|
|
3983
|
+
const [openMenu, setOpenMenu] = React8__namespace.useState(
|
|
3803
3984
|
null
|
|
3804
3985
|
);
|
|
3805
|
-
const [behindLive, setBehindLive] =
|
|
3806
|
-
const [webkitFullscreenSupported, setWebkitFullscreenSupported] =
|
|
3807
|
-
const hideTimerRef =
|
|
3986
|
+
const [behindLive, setBehindLive] = React8__namespace.useState(false);
|
|
3987
|
+
const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React8__namespace.useState(false);
|
|
3988
|
+
const hideTimerRef = React8__namespace.useRef(null);
|
|
3808
3989
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
3809
3990
|
const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported;
|
|
3810
|
-
|
|
3991
|
+
React8__namespace.useEffect(() => {
|
|
3811
3992
|
const video = videoRef.current;
|
|
3812
3993
|
if (!video || !active) return;
|
|
3813
3994
|
const onTimeUpdate = () => {
|
|
@@ -3840,21 +4021,21 @@ function VideoPlayer({
|
|
|
3840
4021
|
video.removeEventListener("ratechange", onRate);
|
|
3841
4022
|
};
|
|
3842
4023
|
}, [videoRef, active, mode]);
|
|
3843
|
-
|
|
4024
|
+
React8__namespace.useEffect(() => {
|
|
3844
4025
|
const video = videoRef.current;
|
|
3845
4026
|
if (!paused || !video || !isPlaying) return;
|
|
3846
4027
|
video.pause();
|
|
3847
4028
|
}, [paused, videoRef, isPlaying]);
|
|
3848
|
-
|
|
4029
|
+
React8__namespace.useEffect(() => {
|
|
3849
4030
|
setWebkitFullscreenSupported(hasWebkitVideoFullscreen(videoRef.current));
|
|
3850
4031
|
videoRef.current?.setAttribute("x-webkit-airplay", "allow");
|
|
3851
4032
|
}, [videoRef, active]);
|
|
3852
|
-
|
|
4033
|
+
React8__namespace.useEffect(() => {
|
|
3853
4034
|
const onFsChange = () => setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
3854
4035
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
3855
4036
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
3856
4037
|
}, []);
|
|
3857
|
-
|
|
4038
|
+
React8__namespace.useEffect(() => {
|
|
3858
4039
|
const video = asWebkitVideo(videoRef.current);
|
|
3859
4040
|
if (!video) return;
|
|
3860
4041
|
const onBegin = () => setIsFullscreen(true);
|
|
@@ -3866,7 +4047,7 @@ function VideoPlayer({
|
|
|
3866
4047
|
video.removeEventListener("webkitendfullscreen", onEnd);
|
|
3867
4048
|
};
|
|
3868
4049
|
}, [videoRef, active]);
|
|
3869
|
-
|
|
4050
|
+
React8__namespace.useEffect(() => {
|
|
3870
4051
|
const video = videoRef.current;
|
|
3871
4052
|
if (!video) return;
|
|
3872
4053
|
const onEnter = () => setPipActive(true);
|
|
@@ -3878,18 +4059,18 @@ function VideoPlayer({
|
|
|
3878
4059
|
video.removeEventListener("leavepictureinpicture", onLeave);
|
|
3879
4060
|
};
|
|
3880
4061
|
}, [videoRef]);
|
|
3881
|
-
const scheduleHide =
|
|
4062
|
+
const scheduleHide = React8__namespace.useCallback(() => {
|
|
3882
4063
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
3883
4064
|
hideTimerRef.current = setTimeout(() => {
|
|
3884
4065
|
setControlsVisible(false);
|
|
3885
4066
|
setOpenMenu(null);
|
|
3886
4067
|
}, CONTROLS_HIDE_MS);
|
|
3887
4068
|
}, []);
|
|
3888
|
-
const revealControls =
|
|
4069
|
+
const revealControls = React8__namespace.useCallback(() => {
|
|
3889
4070
|
setControlsVisible(true);
|
|
3890
4071
|
scheduleHide();
|
|
3891
4072
|
}, [scheduleHide]);
|
|
3892
|
-
|
|
4073
|
+
React8__namespace.useEffect(() => {
|
|
3893
4074
|
return () => {
|
|
3894
4075
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
3895
4076
|
};
|
|
@@ -4131,30 +4312,17 @@ function VideoPlayer({
|
|
|
4131
4312
|
),
|
|
4132
4313
|
"data-slot": "video-controls",
|
|
4133
4314
|
children: [
|
|
4134
|
-
mode === "vod" && /* @__PURE__ */ jsxRuntime.
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
}
|
|
4146
|
-
),
|
|
4147
|
-
duration > 0 && buffered > currentTime && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4148
|
-
"span",
|
|
4149
|
-
{
|
|
4150
|
-
"aria-hidden": "true",
|
|
4151
|
-
className: "pointer-events-none absolute top-1/2 left-0 h-1.5 -translate-y-1/2 rounded-full bg-white/25",
|
|
4152
|
-
style: {
|
|
4153
|
-
width: `${Math.min(buffered / duration * 100, 100)}%`
|
|
4154
|
-
}
|
|
4155
|
-
}
|
|
4156
|
-
)
|
|
4157
|
-
] }),
|
|
4315
|
+
mode === "vod" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4316
|
+
SeekBar,
|
|
4317
|
+
{
|
|
4318
|
+
src,
|
|
4319
|
+
duration,
|
|
4320
|
+
currentTime,
|
|
4321
|
+
buffered,
|
|
4322
|
+
onSeek: seekTo,
|
|
4323
|
+
formatTime
|
|
4324
|
+
}
|
|
4325
|
+
),
|
|
4158
4326
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4159
4327
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4160
4328
|
ControlButton,
|
|
@@ -4392,16 +4560,16 @@ function videoInPictureInPicture(container) {
|
|
|
4392
4560
|
return container.contains(pip);
|
|
4393
4561
|
}
|
|
4394
4562
|
function useFeedExclusivePlayback(playbackId) {
|
|
4395
|
-
const containerRef =
|
|
4396
|
-
const [forcePaused, setForcePaused] =
|
|
4397
|
-
const requestPause =
|
|
4563
|
+
const containerRef = React8__namespace.useRef(null);
|
|
4564
|
+
const [forcePaused, setForcePaused] = React8__namespace.useState(false);
|
|
4565
|
+
const requestPause = React8__namespace.useCallback(() => {
|
|
4398
4566
|
if (videoInPictureInPicture(containerRef.current)) return;
|
|
4399
4567
|
setForcePaused(true);
|
|
4400
4568
|
}, []);
|
|
4401
|
-
|
|
4569
|
+
React8__namespace.useEffect(() => {
|
|
4402
4570
|
return registerFeedPlayer(playbackId, requestPause);
|
|
4403
4571
|
}, [playbackId, requestPause]);
|
|
4404
|
-
|
|
4572
|
+
React8__namespace.useEffect(() => {
|
|
4405
4573
|
const node = containerRef.current;
|
|
4406
4574
|
if (!node || typeof IntersectionObserver === "undefined") return;
|
|
4407
4575
|
const observer = new IntersectionObserver(
|
|
@@ -4417,14 +4585,14 @@ function useFeedExclusivePlayback(playbackId) {
|
|
|
4417
4585
|
observer.observe(node);
|
|
4418
4586
|
return () => observer.disconnect();
|
|
4419
4587
|
}, [requestPause]);
|
|
4420
|
-
|
|
4588
|
+
React8__namespace.useEffect(() => {
|
|
4421
4589
|
const onVisibility = () => {
|
|
4422
4590
|
if (document.hidden) requestPause();
|
|
4423
4591
|
};
|
|
4424
4592
|
document.addEventListener("visibilitychange", onVisibility);
|
|
4425
4593
|
return () => document.removeEventListener("visibilitychange", onVisibility);
|
|
4426
4594
|
}, [requestPause]);
|
|
4427
|
-
const onPlayingChange =
|
|
4595
|
+
const onPlayingChange = React8__namespace.useCallback(
|
|
4428
4596
|
(playing) => {
|
|
4429
4597
|
if (!playing) return;
|
|
4430
4598
|
setForcePaused(false);
|
|
@@ -4451,7 +4619,7 @@ function FeedVideoPlayer({
|
|
|
4451
4619
|
paused: exclusivePaused,
|
|
4452
4620
|
onPlayingChange: onExclusivePlayingChange
|
|
4453
4621
|
} = useFeedExclusivePlayback(playbackId);
|
|
4454
|
-
const handlePlayingChange =
|
|
4622
|
+
const handlePlayingChange = React8__namespace.useCallback(
|
|
4455
4623
|
(playing) => {
|
|
4456
4624
|
onExclusivePlayingChange(playing);
|
|
4457
4625
|
onPlayingChange?.(playing);
|
|
@@ -4478,8 +4646,8 @@ function FeedVideoPlayer({
|
|
|
4478
4646
|
);
|
|
4479
4647
|
}
|
|
4480
4648
|
function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {}) {
|
|
4481
|
-
const [stats, setStats] =
|
|
4482
|
-
|
|
4649
|
+
const [stats, setStats] = React8__namespace.useState({});
|
|
4650
|
+
React8__namespace.useEffect(() => {
|
|
4483
4651
|
if (!statsUrl || !enabled) return;
|
|
4484
4652
|
let cancelled = false;
|
|
4485
4653
|
const controller = new AbortController();
|
|
@@ -4584,10 +4752,10 @@ function FileDropzone({
|
|
|
4584
4752
|
className
|
|
4585
4753
|
}) {
|
|
4586
4754
|
const labels = { ...DEFAULT_FILE_DROPZONE_LABELS, ...labelOverrides };
|
|
4587
|
-
const inputId =
|
|
4588
|
-
const inputRef =
|
|
4589
|
-
const [dragging, setDragging] =
|
|
4590
|
-
const [message, setMessage] =
|
|
4755
|
+
const inputId = React8.useId();
|
|
4756
|
+
const inputRef = React8.useRef(null);
|
|
4757
|
+
const [dragging, setDragging] = React8.useState(false);
|
|
4758
|
+
const [message, setMessage] = React8.useState(null);
|
|
4591
4759
|
function takeFile(file) {
|
|
4592
4760
|
if (!file || disabled) return;
|
|
4593
4761
|
if (!fileMatchesAccept(file, accept)) {
|
|
@@ -4807,7 +4975,7 @@ function FileUploadMenu({
|
|
|
4807
4975
|
}) {
|
|
4808
4976
|
const labels = { ...DEFAULT_FILE_UPLOAD_TRAY_LABELS, ...labelOverrides };
|
|
4809
4977
|
const visible = jobs.filter((job) => job.status !== "cancelled");
|
|
4810
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
4978
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React8.useState(false);
|
|
4811
4979
|
const isControlled = open !== void 0;
|
|
4812
4980
|
const resolvedOpen = isControlled ? open : uncontrolledOpen;
|
|
4813
4981
|
function setResolvedOpen(next) {
|