@livo-tv/blocks 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/dist/index.cjs +463 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -1
- package/dist/index.d.ts +80 -1
- package/dist/index.js +401 -70
- 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 React7 = 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 React7__namespace = /*#__PURE__*/_interopNamespace(React7);
|
|
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 = React7.createContext(null);
|
|
46
46
|
function useLanguageContext() {
|
|
47
|
-
return
|
|
47
|
+
return React7.useContext(LanguageContext);
|
|
48
48
|
}
|
|
49
49
|
function cn(...inputs) {
|
|
50
50
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
@@ -478,20 +478,20 @@ function useEditableSection({
|
|
|
478
478
|
...DEFAULT_EDITABLE_SECTION_LABELS,
|
|
479
479
|
...labels
|
|
480
480
|
};
|
|
481
|
-
const [mode, setMode] =
|
|
482
|
-
const [status, setStatus] =
|
|
483
|
-
const [confirmOpen, setConfirmOpen] =
|
|
484
|
-
const [minHeightPx, setMinHeightPx] =
|
|
485
|
-
const contentRef =
|
|
486
|
-
const editButtonRef =
|
|
487
|
-
const measuredHeightRef =
|
|
488
|
-
const shouldFocusEditRef =
|
|
489
|
-
const shouldFocusFirstFieldRef =
|
|
490
|
-
const editButtonId =
|
|
491
|
-
const contentFormId =
|
|
481
|
+
const [mode, setMode] = React7.useState("reading");
|
|
482
|
+
const [status, setStatus] = React7.useState(null);
|
|
483
|
+
const [confirmOpen, setConfirmOpen] = React7.useState(false);
|
|
484
|
+
const [minHeightPx, setMinHeightPx] = React7.useState(void 0);
|
|
485
|
+
const contentRef = React7.useRef(null);
|
|
486
|
+
const editButtonRef = React7.useRef(null);
|
|
487
|
+
const measuredHeightRef = React7.useRef(0);
|
|
488
|
+
const shouldFocusEditRef = React7.useRef(false);
|
|
489
|
+
const shouldFocusFirstFieldRef = React7.useRef(false);
|
|
490
|
+
const editButtonId = React7.useId();
|
|
491
|
+
const contentFormId = React7.useId();
|
|
492
492
|
const isEditing = mode === "editing" || mode === "saving";
|
|
493
493
|
const isSaving = mode === "saving";
|
|
494
|
-
|
|
494
|
+
React7.useEffect(() => {
|
|
495
495
|
if (mode === "reading" && shouldFocusEditRef.current) {
|
|
496
496
|
shouldFocusEditRef.current = false;
|
|
497
497
|
editButtonRef.current?.focus();
|
|
@@ -509,18 +509,18 @@ function useEditableSection({
|
|
|
509
509
|
focusFirstField(contentRef.current);
|
|
510
510
|
}
|
|
511
511
|
}, [mode]);
|
|
512
|
-
const exitToReading =
|
|
512
|
+
const exitToReading = React7.useCallback(() => {
|
|
513
513
|
setConfirmOpen(false);
|
|
514
514
|
shouldFocusEditRef.current = true;
|
|
515
515
|
setMode("reading");
|
|
516
516
|
onDiscard?.();
|
|
517
517
|
}, [onDiscard]);
|
|
518
|
-
const startEdit =
|
|
518
|
+
const startEdit = React7.useCallback(() => {
|
|
519
519
|
setStatus(null);
|
|
520
520
|
shouldFocusFirstFieldRef.current = true;
|
|
521
521
|
setMode("editing");
|
|
522
522
|
}, []);
|
|
523
|
-
const requestCancel =
|
|
523
|
+
const requestCancel = React7.useCallback(() => {
|
|
524
524
|
if (isSaving) return;
|
|
525
525
|
if (isDirty) {
|
|
526
526
|
setConfirmOpen(true);
|
|
@@ -528,7 +528,7 @@ function useEditableSection({
|
|
|
528
528
|
}
|
|
529
529
|
exitToReading();
|
|
530
530
|
}, [exitToReading, isDirty, isSaving]);
|
|
531
|
-
const handleSubmit =
|
|
531
|
+
const handleSubmit = React7.useCallback(
|
|
532
532
|
(event) => {
|
|
533
533
|
event.preventDefault();
|
|
534
534
|
if (isSaving) return;
|
|
@@ -548,7 +548,7 @@ function useEditableSection({
|
|
|
548
548
|
},
|
|
549
549
|
[isSaving, onSave, resolvedLabels.saved]
|
|
550
550
|
);
|
|
551
|
-
const handleFormKeyDown =
|
|
551
|
+
const handleFormKeyDown = React7.useCallback(
|
|
552
552
|
(event) => {
|
|
553
553
|
if (event.key !== "Escape") return;
|
|
554
554
|
event.preventDefault();
|
|
@@ -556,7 +556,7 @@ function useEditableSection({
|
|
|
556
556
|
},
|
|
557
557
|
[requestCancel]
|
|
558
558
|
);
|
|
559
|
-
|
|
559
|
+
React7.useEffect(() => {
|
|
560
560
|
if (!stableHeight || !isEditing) return;
|
|
561
561
|
const el = contentRef.current;
|
|
562
562
|
if (!el) return;
|
|
@@ -795,13 +795,13 @@ function SafeImage({
|
|
|
795
795
|
onError,
|
|
796
796
|
...imgProps
|
|
797
797
|
}) {
|
|
798
|
-
const [failed, setFailed] =
|
|
799
|
-
const imgRef =
|
|
798
|
+
const [failed, setFailed] = React7.useState(false);
|
|
799
|
+
const imgRef = React7.useRef(null);
|
|
800
800
|
const resolvedSrc = typeof src === "string" && src.length > 0 ? src : null;
|
|
801
|
-
|
|
801
|
+
React7.useLayoutEffect(() => {
|
|
802
802
|
setFailed(false);
|
|
803
803
|
}, [resolvedSrc]);
|
|
804
|
-
|
|
804
|
+
React7.useLayoutEffect(() => {
|
|
805
805
|
const img = imgRef.current;
|
|
806
806
|
if (img && isBrokenImage(img)) {
|
|
807
807
|
setFailed(true);
|
|
@@ -931,18 +931,18 @@ function ThemeSwitcher({
|
|
|
931
931
|
labels: userLabels
|
|
932
932
|
}) {
|
|
933
933
|
const { theme, setTheme } = nextThemes.useTheme();
|
|
934
|
-
const [mounted, setMounted] =
|
|
934
|
+
const [mounted, setMounted] = React7.useState(false);
|
|
935
935
|
const reduceMotion = framerMotion.useReducedMotion();
|
|
936
936
|
const sizes = sizeClasses[size];
|
|
937
937
|
const shapeClass = shapeClasses[shape];
|
|
938
938
|
const labels = { ...defaultLabels, ...userLabels };
|
|
939
|
-
const handleThemeClick =
|
|
939
|
+
const handleThemeClick = React7.useCallback(
|
|
940
940
|
(themeKey) => {
|
|
941
941
|
setTheme(themeKey);
|
|
942
942
|
},
|
|
943
943
|
[setTheme]
|
|
944
944
|
);
|
|
945
|
-
|
|
945
|
+
React7.useEffect(() => {
|
|
946
946
|
setMounted(true);
|
|
947
947
|
}, []);
|
|
948
948
|
if (!mounted) {
|
|
@@ -1222,7 +1222,7 @@ function Slider({
|
|
|
1222
1222
|
max = 100,
|
|
1223
1223
|
...props
|
|
1224
1224
|
}) {
|
|
1225
|
-
const _values =
|
|
1225
|
+
const _values = React7__namespace.useMemo(
|
|
1226
1226
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
1227
1227
|
[value, defaultValue, min, max]
|
|
1228
1228
|
);
|
|
@@ -1333,18 +1333,18 @@ function AvatarEditor({
|
|
|
1333
1333
|
labels
|
|
1334
1334
|
}) {
|
|
1335
1335
|
const t = { ...DEFAULT_LABELS, ...labels };
|
|
1336
|
-
const canvasRef =
|
|
1337
|
-
const fileInputRef =
|
|
1338
|
-
const containerRef =
|
|
1339
|
-
const [image, setImage] =
|
|
1340
|
-
const [imageLoaded, setImageLoaded] =
|
|
1341
|
-
const [zoom, setZoom] =
|
|
1342
|
-
const [rotation, setRotation] =
|
|
1343
|
-
const [position, setPosition] =
|
|
1344
|
-
const [isDragging, setIsDragging] =
|
|
1345
|
-
const [dragStart, setDragStart] =
|
|
1346
|
-
const [showGrid, setShowGrid] =
|
|
1347
|
-
const generateOutput =
|
|
1336
|
+
const canvasRef = React7.useRef(null);
|
|
1337
|
+
const fileInputRef = React7.useRef(null);
|
|
1338
|
+
const containerRef = React7.useRef(null);
|
|
1339
|
+
const [image, setImage] = React7.useState(null);
|
|
1340
|
+
const [imageLoaded, setImageLoaded] = React7.useState(false);
|
|
1341
|
+
const [zoom, setZoom] = React7.useState(1);
|
|
1342
|
+
const [rotation, setRotation] = React7.useState(0);
|
|
1343
|
+
const [position, setPosition] = React7.useState({ x: 0, y: 0 });
|
|
1344
|
+
const [isDragging, setIsDragging] = React7.useState(false);
|
|
1345
|
+
const [dragStart, setDragStart] = React7.useState({ x: 0, y: 0 });
|
|
1346
|
+
const [showGrid, setShowGrid] = React7.useState(initialShowGrid);
|
|
1347
|
+
const generateOutput = React7.useCallback(() => {
|
|
1348
1348
|
if (!canvasRef.current || !image) return null;
|
|
1349
1349
|
const outputCanvas = document.createElement("canvas");
|
|
1350
1350
|
outputCanvas.width = outputSize;
|
|
@@ -1355,7 +1355,7 @@ function AvatarEditor({
|
|
|
1355
1355
|
const mimeType = `image/${outputFormat}`;
|
|
1356
1356
|
return outputCanvas.toDataURL(mimeType, outputQuality);
|
|
1357
1357
|
}, [image, outputSize, outputFormat, outputQuality]);
|
|
1358
|
-
|
|
1358
|
+
React7.useEffect(() => {
|
|
1359
1359
|
if (!canvasRef.current || !image || !imageLoaded) return;
|
|
1360
1360
|
const canvas = canvasRef.current;
|
|
1361
1361
|
const ctx = canvas.getContext("2d");
|
|
@@ -1399,12 +1399,12 @@ function AvatarEditor({
|
|
|
1399
1399
|
generateOutput,
|
|
1400
1400
|
onChange
|
|
1401
1401
|
]);
|
|
1402
|
-
const resetTransforms =
|
|
1402
|
+
const resetTransforms = React7.useCallback(() => {
|
|
1403
1403
|
setZoom(1);
|
|
1404
1404
|
setRotation(0);
|
|
1405
1405
|
setPosition({ x: 0, y: 0 });
|
|
1406
1406
|
}, []);
|
|
1407
|
-
const handleFileSelect =
|
|
1407
|
+
const handleFileSelect = React7.useCallback(
|
|
1408
1408
|
(e) => {
|
|
1409
1409
|
const file = e.target.files?.[0];
|
|
1410
1410
|
if (!file) return;
|
|
@@ -1423,7 +1423,7 @@ function AvatarEditor({
|
|
|
1423
1423
|
},
|
|
1424
1424
|
[resetTransforms]
|
|
1425
1425
|
);
|
|
1426
|
-
const handleMouseDown =
|
|
1426
|
+
const handleMouseDown = React7.useCallback(
|
|
1427
1427
|
(e) => {
|
|
1428
1428
|
if (!imageLoaded) return;
|
|
1429
1429
|
setIsDragging(true);
|
|
@@ -1431,7 +1431,7 @@ function AvatarEditor({
|
|
|
1431
1431
|
},
|
|
1432
1432
|
[imageLoaded, position]
|
|
1433
1433
|
);
|
|
1434
|
-
const handleMouseMove =
|
|
1434
|
+
const handleMouseMove = React7.useCallback(
|
|
1435
1435
|
(e) => {
|
|
1436
1436
|
if (!isDragging) return;
|
|
1437
1437
|
setPosition({
|
|
@@ -1441,10 +1441,10 @@ function AvatarEditor({
|
|
|
1441
1441
|
},
|
|
1442
1442
|
[isDragging, dragStart]
|
|
1443
1443
|
);
|
|
1444
|
-
const handleMouseUp =
|
|
1444
|
+
const handleMouseUp = React7.useCallback(() => {
|
|
1445
1445
|
setIsDragging(false);
|
|
1446
1446
|
}, []);
|
|
1447
|
-
const handleTouchStart =
|
|
1447
|
+
const handleTouchStart = React7.useCallback(
|
|
1448
1448
|
(e) => {
|
|
1449
1449
|
if (!imageLoaded) return;
|
|
1450
1450
|
const touch = e.touches[0];
|
|
@@ -1456,7 +1456,7 @@ function AvatarEditor({
|
|
|
1456
1456
|
},
|
|
1457
1457
|
[imageLoaded, position]
|
|
1458
1458
|
);
|
|
1459
|
-
const handleTouchMove =
|
|
1459
|
+
const handleTouchMove = React7.useCallback(
|
|
1460
1460
|
(e) => {
|
|
1461
1461
|
if (!isDragging) return;
|
|
1462
1462
|
const touch = e.touches[0];
|
|
@@ -1467,7 +1467,7 @@ function AvatarEditor({
|
|
|
1467
1467
|
},
|
|
1468
1468
|
[isDragging, dragStart]
|
|
1469
1469
|
);
|
|
1470
|
-
const handleDiscard =
|
|
1470
|
+
const handleDiscard = React7.useCallback(() => {
|
|
1471
1471
|
setImage(null);
|
|
1472
1472
|
setImageLoaded(false);
|
|
1473
1473
|
resetTransforms();
|
|
@@ -2035,8 +2035,8 @@ function DrawerTitle({
|
|
|
2035
2035
|
);
|
|
2036
2036
|
}
|
|
2037
2037
|
function useMediaQuery(query) {
|
|
2038
|
-
const [matches, setMatches] =
|
|
2039
|
-
|
|
2038
|
+
const [matches, setMatches] = React7.useState(false);
|
|
2039
|
+
React7.useEffect(() => {
|
|
2040
2040
|
const media = window.matchMedia(query);
|
|
2041
2041
|
if (media.matches !== matches) {
|
|
2042
2042
|
setMatches(media.matches);
|
|
@@ -2066,17 +2066,17 @@ function AvatarEditorDialog({
|
|
|
2066
2066
|
className,
|
|
2067
2067
|
editorLabels
|
|
2068
2068
|
}) {
|
|
2069
|
-
const [isOpen, setIsOpen] =
|
|
2070
|
-
const [editedValue, setEditedValue] =
|
|
2071
|
-
const [displaySrc, setDisplaySrc] =
|
|
2072
|
-
const [isSaving, setIsSaving] =
|
|
2073
|
-
const [feedback, setFeedback] =
|
|
2074
|
-
|
|
2069
|
+
const [isOpen, setIsOpen] = React7.useState(false);
|
|
2070
|
+
const [editedValue, setEditedValue] = React7.useState(value ?? null);
|
|
2071
|
+
const [displaySrc, setDisplaySrc] = React7.useState(value ?? null);
|
|
2072
|
+
const [isSaving, setIsSaving] = React7.useState(false);
|
|
2073
|
+
const [feedback, setFeedback] = React7.useState(null);
|
|
2074
|
+
React7.useEffect(() => {
|
|
2075
2075
|
setDisplaySrc(value ?? null);
|
|
2076
2076
|
}, [value]);
|
|
2077
2077
|
const isMobile = useMediaQuery("(max-width: 640px)");
|
|
2078
2078
|
const caption = (placeholder ?? "").trim();
|
|
2079
|
-
const handleOpenChange =
|
|
2079
|
+
const handleOpenChange = React7.useCallback(
|
|
2080
2080
|
(open) => {
|
|
2081
2081
|
if (open) {
|
|
2082
2082
|
setEditedValue(value ?? null);
|
|
@@ -2086,7 +2086,7 @@ function AvatarEditorDialog({
|
|
|
2086
2086
|
},
|
|
2087
2087
|
[value]
|
|
2088
2088
|
);
|
|
2089
|
-
const handleAccept =
|
|
2089
|
+
const handleAccept = React7.useCallback(async () => {
|
|
2090
2090
|
if (!editedValue) return;
|
|
2091
2091
|
setIsSaving(true);
|
|
2092
2092
|
setFeedback(null);
|
|
@@ -2259,8 +2259,8 @@ function AvatarEditorDialog({
|
|
|
2259
2259
|
] });
|
|
2260
2260
|
}
|
|
2261
2261
|
function usePrefersReducedMotion() {
|
|
2262
|
-
const [reduced, setReduced] =
|
|
2263
|
-
|
|
2262
|
+
const [reduced, setReduced] = React7__namespace.useState(false);
|
|
2263
|
+
React7__namespace.useEffect(() => {
|
|
2264
2264
|
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
2265
2265
|
const sync = () => setReduced(media.matches);
|
|
2266
2266
|
sync();
|
|
@@ -2314,6 +2314,349 @@ function CurtainStage({
|
|
|
2314
2314
|
}
|
|
2315
2315
|
);
|
|
2316
2316
|
}
|
|
2317
|
+
function useMediaQuery2(query) {
|
|
2318
|
+
const [matches, setMatches] = React7.useState(false);
|
|
2319
|
+
React7.useEffect(() => {
|
|
2320
|
+
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
2321
|
+
const mql = window.matchMedia(query);
|
|
2322
|
+
const onChange = () => setMatches(mql.matches);
|
|
2323
|
+
onChange();
|
|
2324
|
+
mql.addEventListener("change", onChange);
|
|
2325
|
+
return () => mql.removeEventListener("change", onChange);
|
|
2326
|
+
}, [query]);
|
|
2327
|
+
return matches;
|
|
2328
|
+
}
|
|
2329
|
+
function isVideoKind(kind) {
|
|
2330
|
+
return kind === "video";
|
|
2331
|
+
}
|
|
2332
|
+
function useElementInView(enabled) {
|
|
2333
|
+
const [node, setNode] = React7__namespace.useState(null);
|
|
2334
|
+
const [inView, setInView] = React7__namespace.useState(false);
|
|
2335
|
+
React7__namespace.useEffect(() => {
|
|
2336
|
+
if (!enabled || !node || typeof IntersectionObserver === "undefined") {
|
|
2337
|
+
setInView(false);
|
|
2338
|
+
return;
|
|
2339
|
+
}
|
|
2340
|
+
const observer = new IntersectionObserver(
|
|
2341
|
+
(entries) => {
|
|
2342
|
+
const entry = entries[0];
|
|
2343
|
+
setInView(Boolean(entry?.isIntersecting));
|
|
2344
|
+
},
|
|
2345
|
+
{ threshold: 0.35, rootMargin: "32px" }
|
|
2346
|
+
);
|
|
2347
|
+
observer.observe(node);
|
|
2348
|
+
return () => observer.disconnect();
|
|
2349
|
+
}, [enabled, node]);
|
|
2350
|
+
return [setNode, inView];
|
|
2351
|
+
}
|
|
2352
|
+
function CurtainPreview({
|
|
2353
|
+
kind,
|
|
2354
|
+
url,
|
|
2355
|
+
alt = "",
|
|
2356
|
+
className,
|
|
2357
|
+
playWhenVisible = true
|
|
2358
|
+
}) {
|
|
2359
|
+
const prefersReduced = useMediaQuery2("(prefers-reduced-motion: reduce)");
|
|
2360
|
+
const video = isVideoKind(kind);
|
|
2361
|
+
const observe = playWhenVisible && video && !prefersReduced;
|
|
2362
|
+
const [setNode, inView] = useElementInView(observe);
|
|
2363
|
+
const shouldPlay = video && !prefersReduced && (!playWhenVisible || inView);
|
|
2364
|
+
if (!url) {
|
|
2365
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2366
|
+
"div",
|
|
2367
|
+
{
|
|
2368
|
+
ref: setNode,
|
|
2369
|
+
className: cn("aspect-video rounded-md bg-skeleton", className),
|
|
2370
|
+
"aria-hidden": "true"
|
|
2371
|
+
}
|
|
2372
|
+
);
|
|
2373
|
+
}
|
|
2374
|
+
const stageKind = video ? "video" : "image";
|
|
2375
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2376
|
+
"div",
|
|
2377
|
+
{
|
|
2378
|
+
ref: setNode,
|
|
2379
|
+
className: cn(
|
|
2380
|
+
"aspect-video overflow-hidden rounded-md bg-black",
|
|
2381
|
+
className
|
|
2382
|
+
),
|
|
2383
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2384
|
+
CurtainStage,
|
|
2385
|
+
{
|
|
2386
|
+
kind: stageKind,
|
|
2387
|
+
url,
|
|
2388
|
+
alt,
|
|
2389
|
+
reducedMotion: !shouldPlay,
|
|
2390
|
+
className: "h-full w-full"
|
|
2391
|
+
}
|
|
2392
|
+
)
|
|
2393
|
+
}
|
|
2394
|
+
);
|
|
2395
|
+
}
|
|
2396
|
+
var DEFAULT_CURTAIN_PICKER_LABELS = {
|
|
2397
|
+
select: "Curtain",
|
|
2398
|
+
none: "None",
|
|
2399
|
+
noneDescription: "Use the default curtain",
|
|
2400
|
+
defaultBadge: "Default",
|
|
2401
|
+
makeDefault: "Set as default",
|
|
2402
|
+
delete: "Delete",
|
|
2403
|
+
image: "Image",
|
|
2404
|
+
video: "Video",
|
|
2405
|
+
organization: "Organization",
|
|
2406
|
+
platform: "Catalog",
|
|
2407
|
+
groupOrganization: "Your curtains",
|
|
2408
|
+
groupPlatform: "Catalog",
|
|
2409
|
+
groupOther: "Other",
|
|
2410
|
+
emptyTitle: "No curtains yet",
|
|
2411
|
+
emptyDescription: "Upload an image or a short looping video."
|
|
2412
|
+
};
|
|
2413
|
+
var OWNER_GROUPS = [
|
|
2414
|
+
"organization",
|
|
2415
|
+
"platform",
|
|
2416
|
+
"other"
|
|
2417
|
+
];
|
|
2418
|
+
function ownerGroup(ownerType) {
|
|
2419
|
+
switch (ownerType) {
|
|
2420
|
+
case "organization":
|
|
2421
|
+
return "organization";
|
|
2422
|
+
case "platform":
|
|
2423
|
+
return "platform";
|
|
2424
|
+
default:
|
|
2425
|
+
return "other";
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
function kindLabel(kind, copy) {
|
|
2429
|
+
return kind === "video" ? copy.video : copy.image;
|
|
2430
|
+
}
|
|
2431
|
+
function ownerLabel(ownerType, copy) {
|
|
2432
|
+
if (ownerType === "organization") return copy.organization;
|
|
2433
|
+
if (ownerType === "platform") return copy.platform;
|
|
2434
|
+
return null;
|
|
2435
|
+
}
|
|
2436
|
+
function groupHeading(group, copy) {
|
|
2437
|
+
const headings = {
|
|
2438
|
+
organization: copy.groupOrganization,
|
|
2439
|
+
platform: copy.groupPlatform,
|
|
2440
|
+
other: copy.groupOther
|
|
2441
|
+
};
|
|
2442
|
+
return headings[group];
|
|
2443
|
+
}
|
|
2444
|
+
function gridClass(variant) {
|
|
2445
|
+
return variant === "compact" ? "grid gap-3 sm:grid-cols-2" : "grid gap-4 sm:grid-cols-2 lg:grid-cols-3";
|
|
2446
|
+
}
|
|
2447
|
+
function CurtainPickerSkeleton({
|
|
2448
|
+
count = 6,
|
|
2449
|
+
variant = "default",
|
|
2450
|
+
className
|
|
2451
|
+
}) {
|
|
2452
|
+
return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: cn(gridClass(variant), className), "aria-hidden": "true", children: Array.from({ length: count }, (_, index) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "space-y-3 rounded-xl border p-4", children: [
|
|
2453
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "aspect-video rounded-md bg-skeleton" }),
|
|
2454
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-2/3 rounded bg-skeleton" }),
|
|
2455
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 w-1/3 rounded bg-skeleton" })
|
|
2456
|
+
] }, index)) });
|
|
2457
|
+
}
|
|
2458
|
+
function CurtainPicker({
|
|
2459
|
+
curtains,
|
|
2460
|
+
value = null,
|
|
2461
|
+
onChange,
|
|
2462
|
+
allowNone = false,
|
|
2463
|
+
disabled = false,
|
|
2464
|
+
variant = "default",
|
|
2465
|
+
groupByOwner = false,
|
|
2466
|
+
onMakeDefault,
|
|
2467
|
+
onDelete,
|
|
2468
|
+
canMakeDefault,
|
|
2469
|
+
canDelete,
|
|
2470
|
+
labels,
|
|
2471
|
+
emptyAction,
|
|
2472
|
+
className,
|
|
2473
|
+
actionsPending = false
|
|
2474
|
+
}) {
|
|
2475
|
+
const copy = { ...DEFAULT_CURTAIN_PICKER_LABELS, ...labels };
|
|
2476
|
+
const groupName = React7__namespace.useId();
|
|
2477
|
+
const selectable = typeof onChange === "function";
|
|
2478
|
+
const selectedId = value === "" ? null : value ?? null;
|
|
2479
|
+
const ready = curtains.filter((curtain) => curtain.publicUrl);
|
|
2480
|
+
const showEmpty = ready.length === 0 && !allowNone;
|
|
2481
|
+
const grouped = React7__namespace.useMemo(() => {
|
|
2482
|
+
if (!groupByOwner) {
|
|
2483
|
+
return [{ group: null, items: ready }];
|
|
2484
|
+
}
|
|
2485
|
+
return OWNER_GROUPS.map((group) => ({
|
|
2486
|
+
group,
|
|
2487
|
+
items: ready.filter((curtain) => ownerGroup(curtain.ownerType) === group)
|
|
2488
|
+
})).filter((section) => section.items.length > 0);
|
|
2489
|
+
}, [groupByOwner, ready]);
|
|
2490
|
+
if (showEmpty) {
|
|
2491
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2492
|
+
EmptyState,
|
|
2493
|
+
{
|
|
2494
|
+
title: copy.emptyTitle,
|
|
2495
|
+
description: copy.emptyDescription,
|
|
2496
|
+
action: emptyAction,
|
|
2497
|
+
className
|
|
2498
|
+
}
|
|
2499
|
+
);
|
|
2500
|
+
}
|
|
2501
|
+
const noneTile = allowNone && selectable ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2502
|
+
NoneTile,
|
|
2503
|
+
{
|
|
2504
|
+
name: groupName,
|
|
2505
|
+
checked: selectedId === null,
|
|
2506
|
+
disabled,
|
|
2507
|
+
copy,
|
|
2508
|
+
onSelect: () => onChange(null)
|
|
2509
|
+
}
|
|
2510
|
+
) : null;
|
|
2511
|
+
if (grouped.length === 0 && noneTile) {
|
|
2512
|
+
return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: cn(gridClass(variant), className), children: /* @__PURE__ */ jsxRuntime.jsx("li", { children: noneTile }) });
|
|
2513
|
+
}
|
|
2514
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("space-y-6", className), children: grouped.map((section, index) => /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "space-y-3", children: [
|
|
2515
|
+
section.group ? /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-muted-foreground text-sm font-medium", children: groupHeading(section.group, copy) }) : null,
|
|
2516
|
+
/* @__PURE__ */ jsxRuntime.jsxs("ul", { className: gridClass(variant), children: [
|
|
2517
|
+
index === 0 && noneTile ? /* @__PURE__ */ jsxRuntime.jsx("li", { children: noneTile }) : null,
|
|
2518
|
+
section.items.map((item) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2519
|
+
CurtainPickerCard,
|
|
2520
|
+
{
|
|
2521
|
+
item,
|
|
2522
|
+
name: groupName,
|
|
2523
|
+
selectable,
|
|
2524
|
+
checked: selectedId === item.id,
|
|
2525
|
+
disabled,
|
|
2526
|
+
actionsPending,
|
|
2527
|
+
copy,
|
|
2528
|
+
onSelect: onChange ? () => onChange(item.id) : void 0,
|
|
2529
|
+
onMakeDefault: onMakeDefault && (canMakeDefault ? canMakeDefault(item) : !item.isDefault) ? () => onMakeDefault(item) : void 0,
|
|
2530
|
+
onDelete: onDelete && (canDelete ? canDelete(item) : true) ? () => onDelete(item) : void 0
|
|
2531
|
+
}
|
|
2532
|
+
) }, item.id))
|
|
2533
|
+
] })
|
|
2534
|
+
] }, section.group ?? "all")) });
|
|
2535
|
+
}
|
|
2536
|
+
function NoneTile({
|
|
2537
|
+
name,
|
|
2538
|
+
checked,
|
|
2539
|
+
disabled,
|
|
2540
|
+
copy,
|
|
2541
|
+
onSelect
|
|
2542
|
+
}) {
|
|
2543
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2544
|
+
"label",
|
|
2545
|
+
{
|
|
2546
|
+
className: cn(
|
|
2547
|
+
"block cursor-pointer space-y-3 rounded-xl border p-4 transition-shadow",
|
|
2548
|
+
"has-[:checked]:ring-ring has-[:checked]:ring-2",
|
|
2549
|
+
"has-[:focus-visible]:ring-ring has-[:focus-visible]:ring-2",
|
|
2550
|
+
disabled && "pointer-events-none opacity-50"
|
|
2551
|
+
),
|
|
2552
|
+
children: [
|
|
2553
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2554
|
+
"input",
|
|
2555
|
+
{
|
|
2556
|
+
type: "radio",
|
|
2557
|
+
name,
|
|
2558
|
+
value: "",
|
|
2559
|
+
checked,
|
|
2560
|
+
disabled,
|
|
2561
|
+
onChange: onSelect,
|
|
2562
|
+
className: "sr-only"
|
|
2563
|
+
}
|
|
2564
|
+
),
|
|
2565
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "aspect-video rounded-md bg-gradient-to-br from-zinc-900 to-zinc-950" }),
|
|
2566
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2567
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium", children: copy.none }),
|
|
2568
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: copy.noneDescription })
|
|
2569
|
+
] })
|
|
2570
|
+
]
|
|
2571
|
+
}
|
|
2572
|
+
);
|
|
2573
|
+
}
|
|
2574
|
+
function CurtainPickerCard({
|
|
2575
|
+
item,
|
|
2576
|
+
name,
|
|
2577
|
+
selectable,
|
|
2578
|
+
checked,
|
|
2579
|
+
disabled,
|
|
2580
|
+
actionsPending,
|
|
2581
|
+
copy,
|
|
2582
|
+
onSelect,
|
|
2583
|
+
onMakeDefault,
|
|
2584
|
+
onDelete
|
|
2585
|
+
}) {
|
|
2586
|
+
const owner = ownerLabel(item.ownerType, copy);
|
|
2587
|
+
const media = /* @__PURE__ */ jsxRuntime.jsx(CurtainPreview, { kind: item.kind, url: item.publicUrl, alt: item.title });
|
|
2588
|
+
const meta = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-2", children: [
|
|
2589
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
2590
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate font-medium", children: item.title }),
|
|
2591
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: [kindLabel(item.kind, copy), owner].filter(Boolean).join(" \xB7 ") })
|
|
2592
|
+
] }),
|
|
2593
|
+
item.isDefault ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground shrink-0 text-xs", children: copy.defaultBadge }) : null
|
|
2594
|
+
] });
|
|
2595
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2596
|
+
"div",
|
|
2597
|
+
{
|
|
2598
|
+
className: cn(
|
|
2599
|
+
"space-y-3 rounded-xl border p-4",
|
|
2600
|
+
selectable && "has-[:checked]:ring-ring has-[:checked]:ring-2 has-[:focus-visible]:ring-ring has-[:focus-visible]:ring-2",
|
|
2601
|
+
disabled && "opacity-50"
|
|
2602
|
+
),
|
|
2603
|
+
children: [
|
|
2604
|
+
selectable && onSelect ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2605
|
+
"label",
|
|
2606
|
+
{
|
|
2607
|
+
className: cn(
|
|
2608
|
+
"block space-y-3",
|
|
2609
|
+
disabled ? "pointer-events-none" : "cursor-pointer"
|
|
2610
|
+
),
|
|
2611
|
+
children: [
|
|
2612
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2613
|
+
"input",
|
|
2614
|
+
{
|
|
2615
|
+
type: "radio",
|
|
2616
|
+
name,
|
|
2617
|
+
value: item.id,
|
|
2618
|
+
checked,
|
|
2619
|
+
disabled,
|
|
2620
|
+
onChange: onSelect,
|
|
2621
|
+
className: "sr-only"
|
|
2622
|
+
}
|
|
2623
|
+
),
|
|
2624
|
+
media,
|
|
2625
|
+
meta
|
|
2626
|
+
]
|
|
2627
|
+
}
|
|
2628
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
2629
|
+
media,
|
|
2630
|
+
meta
|
|
2631
|
+
] }),
|
|
2632
|
+
onMakeDefault || onDelete ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
2633
|
+
onMakeDefault ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2634
|
+
Button,
|
|
2635
|
+
{
|
|
2636
|
+
type: "button",
|
|
2637
|
+
size: "sm",
|
|
2638
|
+
variant: "secondary",
|
|
2639
|
+
disabled: disabled || actionsPending,
|
|
2640
|
+
onClick: onMakeDefault,
|
|
2641
|
+
children: copy.makeDefault
|
|
2642
|
+
}
|
|
2643
|
+
) : null,
|
|
2644
|
+
onDelete ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2645
|
+
Button,
|
|
2646
|
+
{
|
|
2647
|
+
type: "button",
|
|
2648
|
+
size: "sm",
|
|
2649
|
+
variant: "destructive",
|
|
2650
|
+
disabled: disabled || actionsPending,
|
|
2651
|
+
onClick: onDelete,
|
|
2652
|
+
children: copy.delete
|
|
2653
|
+
}
|
|
2654
|
+
) : null
|
|
2655
|
+
] }) : null
|
|
2656
|
+
]
|
|
2657
|
+
}
|
|
2658
|
+
);
|
|
2659
|
+
}
|
|
2317
2660
|
function formatCountdown(ms) {
|
|
2318
2661
|
if (ms <= 0) return "0:00";
|
|
2319
2662
|
const total = Math.floor(ms / 1e3);
|
|
@@ -2335,8 +2678,8 @@ function WaitingRoom({
|
|
|
2335
2678
|
labels,
|
|
2336
2679
|
className
|
|
2337
2680
|
}) {
|
|
2338
|
-
const [now, setNow] =
|
|
2339
|
-
|
|
2681
|
+
const [now, setNow] = React7__namespace.useState(nowMs ?? Date.now());
|
|
2682
|
+
React7__namespace.useEffect(() => {
|
|
2340
2683
|
if (nowMs != null) {
|
|
2341
2684
|
setNow(nowMs);
|
|
2342
2685
|
return;
|
|
@@ -2608,27 +2951,27 @@ function useHlsPlayback({
|
|
|
2608
2951
|
onError,
|
|
2609
2952
|
onPlayingChange
|
|
2610
2953
|
}) {
|
|
2611
|
-
const videoRef =
|
|
2612
|
-
const hlsRef =
|
|
2613
|
-
const [state, setState] =
|
|
2614
|
-
const [qualities, setQualities] =
|
|
2615
|
-
const [activeLevel, setActiveLevel] =
|
|
2616
|
-
const [autoplayState, setAutoplayState] =
|
|
2617
|
-
const [error, setError] =
|
|
2618
|
-
const [reloadKey, setReloadKey] =
|
|
2619
|
-
const onErrorRef =
|
|
2620
|
-
const onPlayingChangeRef =
|
|
2621
|
-
|
|
2954
|
+
const videoRef = React7__namespace.useRef(null);
|
|
2955
|
+
const hlsRef = React7__namespace.useRef(null);
|
|
2956
|
+
const [state, setState] = React7__namespace.useState("idle");
|
|
2957
|
+
const [qualities, setQualities] = React7__namespace.useState([]);
|
|
2958
|
+
const [activeLevel, setActiveLevel] = React7__namespace.useState(-1);
|
|
2959
|
+
const [autoplayState, setAutoplayState] = React7__namespace.useState("none");
|
|
2960
|
+
const [error, setError] = React7__namespace.useState(null);
|
|
2961
|
+
const [reloadKey, setReloadKey] = React7__namespace.useState(0);
|
|
2962
|
+
const onErrorRef = React7__namespace.useRef(onError);
|
|
2963
|
+
const onPlayingChangeRef = React7__namespace.useRef(onPlayingChange);
|
|
2964
|
+
React7__namespace.useEffect(() => {
|
|
2622
2965
|
onErrorRef.current = onError;
|
|
2623
2966
|
onPlayingChangeRef.current = onPlayingChange;
|
|
2624
2967
|
}, [onError, onPlayingChange]);
|
|
2625
|
-
const retry =
|
|
2968
|
+
const retry = React7__namespace.useCallback(() => {
|
|
2626
2969
|
setError(null);
|
|
2627
2970
|
setState("loading");
|
|
2628
2971
|
setAutoplayState("none");
|
|
2629
2972
|
setReloadKey((k) => k + 1);
|
|
2630
2973
|
}, []);
|
|
2631
|
-
|
|
2974
|
+
React7__namespace.useEffect(() => {
|
|
2632
2975
|
const media = videoRef.current;
|
|
2633
2976
|
if (!media || !src || !active) {
|
|
2634
2977
|
setState("idle");
|
|
@@ -2898,7 +3241,7 @@ function useHlsPlayback({
|
|
|
2898
3241
|
destroyHls();
|
|
2899
3242
|
};
|
|
2900
3243
|
}, [src, mode, active, autoPlay, muted, reloadKey]);
|
|
2901
|
-
const setLevel =
|
|
3244
|
+
const setLevel = React7__namespace.useCallback((index) => {
|
|
2902
3245
|
const hls = hlsRef.current;
|
|
2903
3246
|
if (!hls) return;
|
|
2904
3247
|
hls.nextLevel = index;
|
|
@@ -2984,12 +3327,12 @@ function VideoPlayer({
|
|
|
2984
3327
|
className
|
|
2985
3328
|
}) {
|
|
2986
3329
|
const t = { ...DEFAULT_LABELS2, ...labels };
|
|
2987
|
-
const containerRef =
|
|
2988
|
-
const firstPlayFiredRef =
|
|
2989
|
-
const [userStarted, setUserStarted] =
|
|
3330
|
+
const containerRef = React7__namespace.useRef(null);
|
|
3331
|
+
const firstPlayFiredRef = React7__namespace.useRef(false);
|
|
3332
|
+
const [userStarted, setUserStarted] = React7__namespace.useState(false);
|
|
2990
3333
|
const active = autoPlay || !poster || userStarted;
|
|
2991
3334
|
const autoplayActive = autoPlay || userStarted;
|
|
2992
|
-
const handlePlayingChange =
|
|
3335
|
+
const handlePlayingChange = React7__namespace.useCallback(
|
|
2993
3336
|
(playing) => {
|
|
2994
3337
|
setIsPlaying(playing);
|
|
2995
3338
|
if (playing && !firstPlayFiredRef.current) {
|
|
@@ -3018,25 +3361,25 @@ function VideoPlayer({
|
|
|
3018
3361
|
onError,
|
|
3019
3362
|
onPlayingChange: handlePlayingChange
|
|
3020
3363
|
});
|
|
3021
|
-
const [isPlaying, setIsPlaying] =
|
|
3022
|
-
const [isMuted, setIsMuted] =
|
|
3023
|
-
const [volume, setVolume] =
|
|
3024
|
-
const [currentTime, setCurrentTime] =
|
|
3025
|
-
const [duration, setDuration] =
|
|
3026
|
-
const [buffered, setBuffered] =
|
|
3027
|
-
const [isFullscreen, setIsFullscreen] =
|
|
3028
|
-
const [pipActive, setPipActive] =
|
|
3029
|
-
const [controlsVisible, setControlsVisible] =
|
|
3030
|
-
const [playbackRate, setPlaybackRate] =
|
|
3031
|
-
const [openMenu, setOpenMenu] =
|
|
3364
|
+
const [isPlaying, setIsPlaying] = React7__namespace.useState(false);
|
|
3365
|
+
const [isMuted, setIsMuted] = React7__namespace.useState(muted);
|
|
3366
|
+
const [volume, setVolume] = React7__namespace.useState(1);
|
|
3367
|
+
const [currentTime, setCurrentTime] = React7__namespace.useState(0);
|
|
3368
|
+
const [duration, setDuration] = React7__namespace.useState(0);
|
|
3369
|
+
const [buffered, setBuffered] = React7__namespace.useState(0);
|
|
3370
|
+
const [isFullscreen, setIsFullscreen] = React7__namespace.useState(false);
|
|
3371
|
+
const [pipActive, setPipActive] = React7__namespace.useState(false);
|
|
3372
|
+
const [controlsVisible, setControlsVisible] = React7__namespace.useState(true);
|
|
3373
|
+
const [playbackRate, setPlaybackRate] = React7__namespace.useState(1);
|
|
3374
|
+
const [openMenu, setOpenMenu] = React7__namespace.useState(
|
|
3032
3375
|
null
|
|
3033
3376
|
);
|
|
3034
|
-
const [behindLive, setBehindLive] =
|
|
3035
|
-
const [webkitFullscreenSupported, setWebkitFullscreenSupported] =
|
|
3036
|
-
const hideTimerRef =
|
|
3377
|
+
const [behindLive, setBehindLive] = React7__namespace.useState(false);
|
|
3378
|
+
const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React7__namespace.useState(false);
|
|
3379
|
+
const hideTimerRef = React7__namespace.useRef(null);
|
|
3037
3380
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
3038
3381
|
const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported;
|
|
3039
|
-
|
|
3382
|
+
React7__namespace.useEffect(() => {
|
|
3040
3383
|
const video = videoRef.current;
|
|
3041
3384
|
if (!video || !active) return;
|
|
3042
3385
|
const onTimeUpdate = () => {
|
|
@@ -3069,21 +3412,21 @@ function VideoPlayer({
|
|
|
3069
3412
|
video.removeEventListener("ratechange", onRate);
|
|
3070
3413
|
};
|
|
3071
3414
|
}, [videoRef, active, mode]);
|
|
3072
|
-
|
|
3415
|
+
React7__namespace.useEffect(() => {
|
|
3073
3416
|
const video = videoRef.current;
|
|
3074
3417
|
if (!paused || !video || !isPlaying) return;
|
|
3075
3418
|
video.pause();
|
|
3076
3419
|
}, [paused, videoRef, isPlaying]);
|
|
3077
|
-
|
|
3420
|
+
React7__namespace.useEffect(() => {
|
|
3078
3421
|
setWebkitFullscreenSupported(hasWebkitVideoFullscreen(videoRef.current));
|
|
3079
3422
|
videoRef.current?.setAttribute("x-webkit-airplay", "allow");
|
|
3080
3423
|
}, [videoRef, active]);
|
|
3081
|
-
|
|
3424
|
+
React7__namespace.useEffect(() => {
|
|
3082
3425
|
const onFsChange = () => setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
3083
3426
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
3084
3427
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
3085
3428
|
}, []);
|
|
3086
|
-
|
|
3429
|
+
React7__namespace.useEffect(() => {
|
|
3087
3430
|
const video = asWebkitVideo(videoRef.current);
|
|
3088
3431
|
if (!video) return;
|
|
3089
3432
|
const onBegin = () => setIsFullscreen(true);
|
|
@@ -3095,7 +3438,7 @@ function VideoPlayer({
|
|
|
3095
3438
|
video.removeEventListener("webkitendfullscreen", onEnd);
|
|
3096
3439
|
};
|
|
3097
3440
|
}, [videoRef, active]);
|
|
3098
|
-
|
|
3441
|
+
React7__namespace.useEffect(() => {
|
|
3099
3442
|
const video = videoRef.current;
|
|
3100
3443
|
if (!video) return;
|
|
3101
3444
|
const onEnter = () => setPipActive(true);
|
|
@@ -3107,18 +3450,18 @@ function VideoPlayer({
|
|
|
3107
3450
|
video.removeEventListener("leavepictureinpicture", onLeave);
|
|
3108
3451
|
};
|
|
3109
3452
|
}, [videoRef]);
|
|
3110
|
-
const scheduleHide =
|
|
3453
|
+
const scheduleHide = React7__namespace.useCallback(() => {
|
|
3111
3454
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
3112
3455
|
hideTimerRef.current = setTimeout(() => {
|
|
3113
3456
|
setControlsVisible(false);
|
|
3114
3457
|
setOpenMenu(null);
|
|
3115
3458
|
}, CONTROLS_HIDE_MS);
|
|
3116
3459
|
}, []);
|
|
3117
|
-
const revealControls =
|
|
3460
|
+
const revealControls = React7__namespace.useCallback(() => {
|
|
3118
3461
|
setControlsVisible(true);
|
|
3119
3462
|
scheduleHide();
|
|
3120
3463
|
}, [scheduleHide]);
|
|
3121
|
-
|
|
3464
|
+
React7__namespace.useEffect(() => {
|
|
3122
3465
|
return () => {
|
|
3123
3466
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
3124
3467
|
};
|
|
@@ -3621,16 +3964,16 @@ function videoInPictureInPicture(container) {
|
|
|
3621
3964
|
return container.contains(pip);
|
|
3622
3965
|
}
|
|
3623
3966
|
function useFeedExclusivePlayback(playbackId) {
|
|
3624
|
-
const containerRef =
|
|
3625
|
-
const [forcePaused, setForcePaused] =
|
|
3626
|
-
const requestPause =
|
|
3967
|
+
const containerRef = React7__namespace.useRef(null);
|
|
3968
|
+
const [forcePaused, setForcePaused] = React7__namespace.useState(false);
|
|
3969
|
+
const requestPause = React7__namespace.useCallback(() => {
|
|
3627
3970
|
if (videoInPictureInPicture(containerRef.current)) return;
|
|
3628
3971
|
setForcePaused(true);
|
|
3629
3972
|
}, []);
|
|
3630
|
-
|
|
3973
|
+
React7__namespace.useEffect(() => {
|
|
3631
3974
|
return registerFeedPlayer(playbackId, requestPause);
|
|
3632
3975
|
}, [playbackId, requestPause]);
|
|
3633
|
-
|
|
3976
|
+
React7__namespace.useEffect(() => {
|
|
3634
3977
|
const node = containerRef.current;
|
|
3635
3978
|
if (!node || typeof IntersectionObserver === "undefined") return;
|
|
3636
3979
|
const observer = new IntersectionObserver(
|
|
@@ -3646,14 +3989,14 @@ function useFeedExclusivePlayback(playbackId) {
|
|
|
3646
3989
|
observer.observe(node);
|
|
3647
3990
|
return () => observer.disconnect();
|
|
3648
3991
|
}, [requestPause]);
|
|
3649
|
-
|
|
3992
|
+
React7__namespace.useEffect(() => {
|
|
3650
3993
|
const onVisibility = () => {
|
|
3651
3994
|
if (document.hidden) requestPause();
|
|
3652
3995
|
};
|
|
3653
3996
|
document.addEventListener("visibilitychange", onVisibility);
|
|
3654
3997
|
return () => document.removeEventListener("visibilitychange", onVisibility);
|
|
3655
3998
|
}, [requestPause]);
|
|
3656
|
-
const onPlayingChange =
|
|
3999
|
+
const onPlayingChange = React7__namespace.useCallback(
|
|
3657
4000
|
(playing) => {
|
|
3658
4001
|
if (!playing) return;
|
|
3659
4002
|
setForcePaused(false);
|
|
@@ -3680,7 +4023,7 @@ function FeedVideoPlayer({
|
|
|
3680
4023
|
paused: exclusivePaused,
|
|
3681
4024
|
onPlayingChange: onExclusivePlayingChange
|
|
3682
4025
|
} = useFeedExclusivePlayback(playbackId);
|
|
3683
|
-
const handlePlayingChange =
|
|
4026
|
+
const handlePlayingChange = React7__namespace.useCallback(
|
|
3684
4027
|
(playing) => {
|
|
3685
4028
|
onExclusivePlayingChange(playing);
|
|
3686
4029
|
onPlayingChange?.(playing);
|
|
@@ -3707,8 +4050,8 @@ function FeedVideoPlayer({
|
|
|
3707
4050
|
);
|
|
3708
4051
|
}
|
|
3709
4052
|
function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {}) {
|
|
3710
|
-
const [stats, setStats] =
|
|
3711
|
-
|
|
4053
|
+
const [stats, setStats] = React7__namespace.useState({});
|
|
4054
|
+
React7__namespace.useEffect(() => {
|
|
3712
4055
|
if (!statsUrl || !enabled) return;
|
|
3713
4056
|
let cancelled = false;
|
|
3714
4057
|
const controller = new AbortController();
|
|
@@ -3737,18 +4080,6 @@ function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {})
|
|
|
3737
4080
|
}, [statsUrl, intervalMs, enabled]);
|
|
3738
4081
|
return stats;
|
|
3739
4082
|
}
|
|
3740
|
-
function useMediaQuery2(query) {
|
|
3741
|
-
const [matches, setMatches] = React5.useState(false);
|
|
3742
|
-
React5.useEffect(() => {
|
|
3743
|
-
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
3744
|
-
const mql = window.matchMedia(query);
|
|
3745
|
-
const onChange = () => setMatches(mql.matches);
|
|
3746
|
-
onChange();
|
|
3747
|
-
mql.addEventListener("change", onChange);
|
|
3748
|
-
return () => mql.removeEventListener("change", onChange);
|
|
3749
|
-
}, [query]);
|
|
3750
|
-
return matches;
|
|
3751
|
-
}
|
|
3752
4083
|
|
|
3753
4084
|
// src/lib/avatar.ts
|
|
3754
4085
|
var EMPTY_COLORS = {
|
|
@@ -3834,7 +4165,11 @@ function avatarFallbackStyle(name) {
|
|
|
3834
4165
|
exports.AvatarEditor = AvatarEditor;
|
|
3835
4166
|
exports.AvatarEditorDialog = AvatarEditorDialog;
|
|
3836
4167
|
exports.ConfirmDestructiveDialog = ConfirmDestructiveDialog;
|
|
4168
|
+
exports.CurtainPicker = CurtainPicker;
|
|
4169
|
+
exports.CurtainPickerSkeleton = CurtainPickerSkeleton;
|
|
4170
|
+
exports.CurtainPreview = CurtainPreview;
|
|
3837
4171
|
exports.CurtainStage = CurtainStage;
|
|
4172
|
+
exports.DEFAULT_CURTAIN_PICKER_LABELS = DEFAULT_CURTAIN_PICKER_LABELS;
|
|
3838
4173
|
exports.DEFAULT_EDITABLE_SECTION_LABELS = DEFAULT_EDITABLE_SECTION_LABELS;
|
|
3839
4174
|
exports.DataList = DataList;
|
|
3840
4175
|
exports.DataListItem = DataListItem;
|