@livo-tv/blocks 1.1.0 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var React5 = require('react');
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 React5__namespace = /*#__PURE__*/_interopNamespace(React5);
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 = React5.createContext(null);
45
+ var LanguageContext = React7.createContext(null);
46
46
  function useLanguageContext() {
47
- return React5.useContext(LanguageContext);
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] = React5.useState("reading");
482
- const [status, setStatus] = React5.useState(null);
483
- const [confirmOpen, setConfirmOpen] = React5.useState(false);
484
- const [minHeightPx, setMinHeightPx] = React5.useState(void 0);
485
- const contentRef = React5.useRef(null);
486
- const editButtonRef = React5.useRef(null);
487
- const measuredHeightRef = React5.useRef(0);
488
- const shouldFocusEditRef = React5.useRef(false);
489
- const shouldFocusFirstFieldRef = React5.useRef(false);
490
- const editButtonId = React5.useId();
491
- const contentFormId = React5.useId();
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
- React5.useEffect(() => {
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 = React5.useCallback(() => {
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 = React5.useCallback(() => {
518
+ const startEdit = React7.useCallback(() => {
519
519
  setStatus(null);
520
520
  shouldFocusFirstFieldRef.current = true;
521
521
  setMode("editing");
522
522
  }, []);
523
- const requestCancel = React5.useCallback(() => {
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 = React5.useCallback(
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 = React5.useCallback(
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
- React5.useEffect(() => {
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] = React5.useState(false);
799
- const imgRef = React5.useRef(null);
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
- React5.useLayoutEffect(() => {
801
+ React7.useLayoutEffect(() => {
802
802
  setFailed(false);
803
803
  }, [resolvedSrc]);
804
- React5.useLayoutEffect(() => {
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] = React5.useState(false);
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 = React5.useCallback(
939
+ const handleThemeClick = React7.useCallback(
940
940
  (themeKey) => {
941
941
  setTheme(themeKey);
942
942
  },
943
943
  [setTheme]
944
944
  );
945
- React5.useEffect(() => {
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 = React5__namespace.useMemo(
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 = React5.useRef(null);
1337
- const fileInputRef = React5.useRef(null);
1338
- const containerRef = React5.useRef(null);
1339
- const [image, setImage] = React5.useState(null);
1340
- const [imageLoaded, setImageLoaded] = React5.useState(false);
1341
- const [zoom, setZoom] = React5.useState(1);
1342
- const [rotation, setRotation] = React5.useState(0);
1343
- const [position, setPosition] = React5.useState({ x: 0, y: 0 });
1344
- const [isDragging, setIsDragging] = React5.useState(false);
1345
- const [dragStart, setDragStart] = React5.useState({ x: 0, y: 0 });
1346
- const [showGrid, setShowGrid] = React5.useState(initialShowGrid);
1347
- const generateOutput = React5.useCallback(() => {
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
- React5.useEffect(() => {
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 = React5.useCallback(() => {
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 = React5.useCallback(
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 = React5.useCallback(
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 = React5.useCallback(
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 = React5.useCallback(() => {
1444
+ const handleMouseUp = React7.useCallback(() => {
1445
1445
  setIsDragging(false);
1446
1446
  }, []);
1447
- const handleTouchStart = React5.useCallback(
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 = React5.useCallback(
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 = React5.useCallback(() => {
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] = React5.useState(false);
2039
- React5.useEffect(() => {
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] = React5.useState(false);
2070
- const [editedValue, setEditedValue] = React5.useState(value ?? null);
2071
- const [displaySrc, setDisplaySrc] = React5.useState(value ?? null);
2072
- const [isSaving, setIsSaving] = React5.useState(false);
2073
- const [feedback, setFeedback] = React5.useState(null);
2074
- React5.useEffect(() => {
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 = React5.useCallback(
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 = React5.useCallback(async () => {
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] = React5__namespace.useState(false);
2263
- React5__namespace.useEffect(() => {
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,516 @@ 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
+ frozen = false
2359
+ }) {
2360
+ const prefersReduced = useMediaQuery2("(prefers-reduced-motion: reduce)");
2361
+ const video = isVideoKind(kind);
2362
+ const observe = !frozen && playWhenVisible && video && !prefersReduced;
2363
+ const [setNode, inView] = useElementInView(observe);
2364
+ const shouldPlay = !frozen && video && !prefersReduced && (!playWhenVisible || inView);
2365
+ if (!url) {
2366
+ return /* @__PURE__ */ jsxRuntime.jsx(
2367
+ "div",
2368
+ {
2369
+ ref: setNode,
2370
+ className: cn("aspect-video rounded-md bg-skeleton", className),
2371
+ "aria-hidden": "true"
2372
+ }
2373
+ );
2374
+ }
2375
+ const stageKind = video ? "video" : "image";
2376
+ return /* @__PURE__ */ jsxRuntime.jsx(
2377
+ "div",
2378
+ {
2379
+ ref: setNode,
2380
+ className: cn(
2381
+ "aspect-video overflow-hidden rounded-md bg-black",
2382
+ className
2383
+ ),
2384
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2385
+ CurtainStage,
2386
+ {
2387
+ kind: stageKind,
2388
+ url,
2389
+ alt,
2390
+ reducedMotion: !shouldPlay,
2391
+ className: "h-full w-full"
2392
+ }
2393
+ )
2394
+ }
2395
+ );
2396
+ }
2397
+ var DEFAULT_CURTAIN_PICKER_LABELS = {
2398
+ select: "Curtain",
2399
+ none: "None",
2400
+ noneDescription: "Use the default curtain",
2401
+ defaultBadge: "Default",
2402
+ makeDefault: "Set as default",
2403
+ delete: "Delete",
2404
+ image: "Image",
2405
+ video: "Video",
2406
+ organization: "Organization",
2407
+ platform: "Catalog",
2408
+ groupOrganization: "Your curtains",
2409
+ groupPlatform: "Catalog",
2410
+ groupOther: "Other",
2411
+ emptyTitle: "No curtains yet",
2412
+ emptyDescription: "Upload an image or a short looping video."
2413
+ };
2414
+ var OWNER_GROUPS = [
2415
+ "organization",
2416
+ "platform",
2417
+ "other"
2418
+ ];
2419
+ function ownerGroup(ownerType) {
2420
+ switch (ownerType) {
2421
+ case "organization":
2422
+ return "organization";
2423
+ case "platform":
2424
+ return "platform";
2425
+ default:
2426
+ return "other";
2427
+ }
2428
+ }
2429
+ function kindLabel(kind, copy) {
2430
+ return kind === "video" ? copy.video : copy.image;
2431
+ }
2432
+ function ownerLabel(ownerType, copy) {
2433
+ if (ownerType === "organization") return copy.organization;
2434
+ if (ownerType === "platform") return copy.platform;
2435
+ return null;
2436
+ }
2437
+ function groupHeading(group, copy) {
2438
+ const headings = {
2439
+ organization: copy.groupOrganization,
2440
+ platform: copy.groupPlatform,
2441
+ other: copy.groupOther
2442
+ };
2443
+ return headings[group];
2444
+ }
2445
+ function gridClass(variant) {
2446
+ return variant === "compact" ? "grid grid-cols-3 gap-2 sm:grid-cols-4 lg:grid-cols-6" : "grid gap-4 sm:grid-cols-2 lg:grid-cols-3";
2447
+ }
2448
+ function selectionRing(selectable) {
2449
+ return selectable && "has-[:checked]:ring-ring has-[:checked]:ring-2 has-[:focus-visible]:ring-ring has-[:focus-visible]:ring-2";
2450
+ }
2451
+ function resolvePreviewItem(selectedId, ready, allowNone) {
2452
+ if (selectedId) {
2453
+ return ready.find((curtain) => curtain.id === selectedId) ?? ready[0] ?? null;
2454
+ }
2455
+ if (allowNone) return null;
2456
+ return ready[0] ?? null;
2457
+ }
2458
+ function itemActions(item, onMakeDefault, onDelete, canMakeDefault, canDelete) {
2459
+ if (!item) return {};
2460
+ return {
2461
+ onMakeDefault: onMakeDefault && (canMakeDefault ? canMakeDefault(item) : !item.isDefault) ? () => onMakeDefault(item) : void 0,
2462
+ onDelete: onDelete && (canDelete ? canDelete(item) : true) ? () => onDelete(item) : void 0
2463
+ };
2464
+ }
2465
+ function CurtainPickerSkeleton({
2466
+ count = 6,
2467
+ variant = "default",
2468
+ className
2469
+ }) {
2470
+ if (variant === "compact") {
2471
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-4", className), "aria-hidden": "true", children: [
2472
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-sm space-y-3", children: [
2473
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aspect-video rounded-md bg-skeleton" }),
2474
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-2/3 rounded bg-skeleton" }),
2475
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 w-1/2 rounded bg-skeleton" })
2476
+ ] }),
2477
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: gridClass("compact"), children: Array.from({ length: count }, (_, index) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "space-y-1.5 rounded-lg border p-1.5", children: [
2478
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aspect-video rounded-md bg-skeleton" }),
2479
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 w-3/4 rounded bg-skeleton" })
2480
+ ] }, index)) })
2481
+ ] });
2482
+ }
2483
+ 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: [
2484
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aspect-video rounded-md bg-skeleton" }),
2485
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-2/3 rounded bg-skeleton" }),
2486
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 w-1/3 rounded bg-skeleton" })
2487
+ ] }, index)) });
2488
+ }
2489
+ function CurtainPicker({
2490
+ curtains,
2491
+ value = null,
2492
+ onChange,
2493
+ allowNone = false,
2494
+ disabled = false,
2495
+ variant = "default",
2496
+ groupByOwner = false,
2497
+ onMakeDefault,
2498
+ onDelete,
2499
+ canMakeDefault,
2500
+ canDelete,
2501
+ labels,
2502
+ emptyAction,
2503
+ className,
2504
+ actionsPending = false
2505
+ }) {
2506
+ const copy = { ...DEFAULT_CURTAIN_PICKER_LABELS, ...labels };
2507
+ const groupName = React7__namespace.useId();
2508
+ const selectable = typeof onChange === "function";
2509
+ const compact = variant === "compact";
2510
+ const selectedId = value === "" ? null : value ?? null;
2511
+ const ready = curtains.filter((curtain) => curtain.publicUrl);
2512
+ const showEmpty = ready.length === 0 && !allowNone;
2513
+ const previewItem = resolvePreviewItem(selectedId, ready, allowNone);
2514
+ const selectedItem = selectedId ? ready.find((curtain) => curtain.id === selectedId) ?? null : null;
2515
+ const actionTarget = selectedItem ?? (!selectable ? previewItem : null);
2516
+ const compactActions = compact ? itemActions(
2517
+ actionTarget,
2518
+ onMakeDefault,
2519
+ onDelete,
2520
+ canMakeDefault,
2521
+ canDelete
2522
+ ) : {};
2523
+ const grouped = React7__namespace.useMemo(() => {
2524
+ if (!groupByOwner) {
2525
+ return [{ group: null, items: ready }];
2526
+ }
2527
+ return OWNER_GROUPS.map((group) => ({
2528
+ group,
2529
+ items: ready.filter((curtain) => ownerGroup(curtain.ownerType) === group)
2530
+ })).filter((section) => section.items.length > 0);
2531
+ }, [groupByOwner, ready]);
2532
+ if (showEmpty) {
2533
+ return /* @__PURE__ */ jsxRuntime.jsx(
2534
+ EmptyState,
2535
+ {
2536
+ title: copy.emptyTitle,
2537
+ description: copy.emptyDescription,
2538
+ action: emptyAction,
2539
+ className
2540
+ }
2541
+ );
2542
+ }
2543
+ const noneTile = allowNone && selectable ? /* @__PURE__ */ jsxRuntime.jsx(
2544
+ NoneTile,
2545
+ {
2546
+ name: groupName,
2547
+ checked: selectedId === null,
2548
+ disabled,
2549
+ copy,
2550
+ compact,
2551
+ onSelect: () => onChange(null)
2552
+ }
2553
+ ) : null;
2554
+ const sections = grouped.length === 0 && noneTile ? [{ group: null, items: [] }] : grouped;
2555
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(compact ? "space-y-4" : "space-y-6", className), children: [
2556
+ compact ? /* @__PURE__ */ jsxRuntime.jsx(
2557
+ SelectedPreview,
2558
+ {
2559
+ item: previewItem,
2560
+ copy,
2561
+ disabled,
2562
+ actionsPending,
2563
+ onMakeDefault: compactActions.onMakeDefault,
2564
+ onDelete: compactActions.onDelete
2565
+ }
2566
+ ) : null,
2567
+ sections.map((section, index) => /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "space-y-3", children: [
2568
+ section.group ? /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-muted-foreground text-sm font-medium", children: groupHeading(section.group, copy) }) : null,
2569
+ /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: gridClass(variant), children: [
2570
+ index === 0 && noneTile ? /* @__PURE__ */ jsxRuntime.jsx("li", { children: noneTile }) : null,
2571
+ section.items.map((item) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
2572
+ CurtainPickerCard,
2573
+ {
2574
+ item,
2575
+ name: groupName,
2576
+ selectable,
2577
+ checked: selectedId === item.id,
2578
+ disabled,
2579
+ actionsPending,
2580
+ copy,
2581
+ compact,
2582
+ onSelect: onChange ? () => onChange(item.id) : void 0,
2583
+ onMakeDefault: compact ? void 0 : itemActions(
2584
+ item,
2585
+ onMakeDefault,
2586
+ onDelete,
2587
+ canMakeDefault,
2588
+ canDelete
2589
+ ).onMakeDefault,
2590
+ onDelete: compact ? void 0 : itemActions(
2591
+ item,
2592
+ onMakeDefault,
2593
+ onDelete,
2594
+ canMakeDefault,
2595
+ canDelete
2596
+ ).onDelete
2597
+ }
2598
+ ) }, item.id))
2599
+ ] })
2600
+ ] }, section.group ?? "all"))
2601
+ ] });
2602
+ }
2603
+ function SelectedPreview({
2604
+ item,
2605
+ copy,
2606
+ disabled,
2607
+ actionsPending,
2608
+ onMakeDefault,
2609
+ onDelete
2610
+ }) {
2611
+ const owner = item ? ownerLabel(item.ownerType, copy) : null;
2612
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-sm space-y-3", children: [
2613
+ item ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2614
+ /* @__PURE__ */ jsxRuntime.jsx(
2615
+ CurtainPreview,
2616
+ {
2617
+ kind: item.kind,
2618
+ url: item.publicUrl,
2619
+ alt: "",
2620
+ className: "pointer-events-none"
2621
+ }
2622
+ ),
2623
+ /* @__PURE__ */ jsxRuntime.jsx(
2624
+ ItemMeta,
2625
+ {
2626
+ title: item.title,
2627
+ detail: [kindLabel(item.kind, copy), owner].filter(Boolean).join(" \xB7 "),
2628
+ isDefault: item.isDefault,
2629
+ defaultBadge: copy.defaultBadge
2630
+ }
2631
+ )
2632
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2633
+ /* @__PURE__ */ jsxRuntime.jsx(
2634
+ "div",
2635
+ {
2636
+ className: "aspect-video rounded-md bg-gradient-to-br from-zinc-900 to-zinc-950",
2637
+ "aria-hidden": "true"
2638
+ }
2639
+ ),
2640
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2641
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium", children: copy.none }),
2642
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: copy.noneDescription })
2643
+ ] })
2644
+ ] }),
2645
+ /* @__PURE__ */ jsxRuntime.jsx(
2646
+ ManageActions,
2647
+ {
2648
+ disabled,
2649
+ actionsPending,
2650
+ copy,
2651
+ onMakeDefault,
2652
+ onDelete
2653
+ }
2654
+ )
2655
+ ] });
2656
+ }
2657
+ function ItemMeta({
2658
+ title,
2659
+ detail,
2660
+ isDefault,
2661
+ defaultBadge
2662
+ }) {
2663
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-2", children: [
2664
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
2665
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate font-medium", children: title }),
2666
+ detail ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: detail }) : null
2667
+ ] }),
2668
+ isDefault ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground shrink-0 text-xs", children: defaultBadge }) : null
2669
+ ] });
2670
+ }
2671
+ function ManageActions({
2672
+ disabled,
2673
+ actionsPending,
2674
+ copy,
2675
+ onMakeDefault,
2676
+ onDelete
2677
+ }) {
2678
+ if (!onMakeDefault && !onDelete) return null;
2679
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [
2680
+ onMakeDefault ? /* @__PURE__ */ jsxRuntime.jsx(
2681
+ Button,
2682
+ {
2683
+ type: "button",
2684
+ size: "sm",
2685
+ variant: "secondary",
2686
+ disabled: disabled || actionsPending,
2687
+ onClick: onMakeDefault,
2688
+ children: copy.makeDefault
2689
+ }
2690
+ ) : null,
2691
+ onDelete ? /* @__PURE__ */ jsxRuntime.jsx(
2692
+ Button,
2693
+ {
2694
+ type: "button",
2695
+ size: "sm",
2696
+ variant: "destructive",
2697
+ disabled: disabled || actionsPending,
2698
+ onClick: onDelete,
2699
+ children: copy.delete
2700
+ }
2701
+ ) : null
2702
+ ] });
2703
+ }
2704
+ function NoneTile({
2705
+ name,
2706
+ checked,
2707
+ disabled,
2708
+ copy,
2709
+ compact,
2710
+ onSelect
2711
+ }) {
2712
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2713
+ "label",
2714
+ {
2715
+ className: cn(
2716
+ "block cursor-pointer transition-shadow",
2717
+ compact ? "flex min-h-11 flex-col gap-1.5 rounded-lg border p-1.5" : "space-y-3 rounded-xl border p-4",
2718
+ "has-[:checked]:ring-ring has-[:checked]:ring-2",
2719
+ "has-[:focus-visible]:ring-ring has-[:focus-visible]:ring-2",
2720
+ disabled && "pointer-events-none opacity-50"
2721
+ ),
2722
+ children: [
2723
+ /* @__PURE__ */ jsxRuntime.jsx(
2724
+ "input",
2725
+ {
2726
+ type: "radio",
2727
+ name,
2728
+ value: "",
2729
+ checked,
2730
+ disabled,
2731
+ onChange: onSelect,
2732
+ className: "sr-only"
2733
+ }
2734
+ ),
2735
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aspect-video rounded-md bg-gradient-to-br from-zinc-900 to-zinc-950" }),
2736
+ compact ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-xs font-medium", children: copy.none }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2737
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium", children: copy.none }),
2738
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: copy.noneDescription })
2739
+ ] })
2740
+ ]
2741
+ }
2742
+ );
2743
+ }
2744
+ function CurtainPickerCard({
2745
+ item,
2746
+ name,
2747
+ selectable,
2748
+ checked,
2749
+ disabled,
2750
+ actionsPending,
2751
+ copy,
2752
+ compact,
2753
+ onSelect,
2754
+ onMakeDefault,
2755
+ onDelete
2756
+ }) {
2757
+ const owner = ownerLabel(item.ownerType, copy);
2758
+ const media = /* @__PURE__ */ jsxRuntime.jsx(
2759
+ CurtainPreview,
2760
+ {
2761
+ kind: item.kind,
2762
+ url: item.publicUrl,
2763
+ alt: item.title,
2764
+ frozen: compact
2765
+ }
2766
+ );
2767
+ const meta = compact ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-xs font-medium", children: item.title }) : /* @__PURE__ */ jsxRuntime.jsx(
2768
+ ItemMeta,
2769
+ {
2770
+ title: item.title,
2771
+ detail: [kindLabel(item.kind, copy), owner].filter(Boolean).join(" \xB7 "),
2772
+ isDefault: item.isDefault,
2773
+ defaultBadge: copy.defaultBadge
2774
+ }
2775
+ );
2776
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2777
+ "div",
2778
+ {
2779
+ className: cn(
2780
+ compact ? "rounded-lg border p-1.5" : "space-y-3 rounded-xl border p-4",
2781
+ selectionRing(selectable),
2782
+ disabled && "opacity-50"
2783
+ ),
2784
+ children: [
2785
+ selectable && onSelect ? /* @__PURE__ */ jsxRuntime.jsxs(
2786
+ "label",
2787
+ {
2788
+ className: cn(
2789
+ compact ? "flex min-h-11 flex-col gap-1.5" : "block space-y-3",
2790
+ disabled ? "pointer-events-none" : "cursor-pointer"
2791
+ ),
2792
+ children: [
2793
+ /* @__PURE__ */ jsxRuntime.jsx(
2794
+ "input",
2795
+ {
2796
+ type: "radio",
2797
+ name,
2798
+ value: item.id,
2799
+ checked,
2800
+ disabled,
2801
+ onChange: onSelect,
2802
+ className: "sr-only"
2803
+ }
2804
+ ),
2805
+ media,
2806
+ meta
2807
+ ]
2808
+ }
2809
+ ) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: compact ? "space-y-1.5" : "space-y-3", children: [
2810
+ media,
2811
+ meta
2812
+ ] }),
2813
+ compact ? null : /* @__PURE__ */ jsxRuntime.jsx(
2814
+ ManageActions,
2815
+ {
2816
+ disabled,
2817
+ actionsPending,
2818
+ copy,
2819
+ onMakeDefault,
2820
+ onDelete
2821
+ }
2822
+ )
2823
+ ]
2824
+ }
2825
+ );
2826
+ }
2317
2827
  function formatCountdown(ms) {
2318
2828
  if (ms <= 0) return "0:00";
2319
2829
  const total = Math.floor(ms / 1e3);
@@ -2335,8 +2845,8 @@ function WaitingRoom({
2335
2845
  labels,
2336
2846
  className
2337
2847
  }) {
2338
- const [now, setNow] = React5__namespace.useState(nowMs ?? Date.now());
2339
- React5__namespace.useEffect(() => {
2848
+ const [now, setNow] = React7__namespace.useState(nowMs ?? Date.now());
2849
+ React7__namespace.useEffect(() => {
2340
2850
  if (nowMs != null) {
2341
2851
  setNow(nowMs);
2342
2852
  return;
@@ -2608,27 +3118,27 @@ function useHlsPlayback({
2608
3118
  onError,
2609
3119
  onPlayingChange
2610
3120
  }) {
2611
- const videoRef = React5__namespace.useRef(null);
2612
- const hlsRef = React5__namespace.useRef(null);
2613
- const [state, setState] = React5__namespace.useState("idle");
2614
- const [qualities, setQualities] = React5__namespace.useState([]);
2615
- const [activeLevel, setActiveLevel] = React5__namespace.useState(-1);
2616
- const [autoplayState, setAutoplayState] = React5__namespace.useState("none");
2617
- const [error, setError] = React5__namespace.useState(null);
2618
- const [reloadKey, setReloadKey] = React5__namespace.useState(0);
2619
- const onErrorRef = React5__namespace.useRef(onError);
2620
- const onPlayingChangeRef = React5__namespace.useRef(onPlayingChange);
2621
- React5__namespace.useEffect(() => {
3121
+ const videoRef = React7__namespace.useRef(null);
3122
+ const hlsRef = React7__namespace.useRef(null);
3123
+ const [state, setState] = React7__namespace.useState("idle");
3124
+ const [qualities, setQualities] = React7__namespace.useState([]);
3125
+ const [activeLevel, setActiveLevel] = React7__namespace.useState(-1);
3126
+ const [autoplayState, setAutoplayState] = React7__namespace.useState("none");
3127
+ const [error, setError] = React7__namespace.useState(null);
3128
+ const [reloadKey, setReloadKey] = React7__namespace.useState(0);
3129
+ const onErrorRef = React7__namespace.useRef(onError);
3130
+ const onPlayingChangeRef = React7__namespace.useRef(onPlayingChange);
3131
+ React7__namespace.useEffect(() => {
2622
3132
  onErrorRef.current = onError;
2623
3133
  onPlayingChangeRef.current = onPlayingChange;
2624
3134
  }, [onError, onPlayingChange]);
2625
- const retry = React5__namespace.useCallback(() => {
3135
+ const retry = React7__namespace.useCallback(() => {
2626
3136
  setError(null);
2627
3137
  setState("loading");
2628
3138
  setAutoplayState("none");
2629
3139
  setReloadKey((k) => k + 1);
2630
3140
  }, []);
2631
- React5__namespace.useEffect(() => {
3141
+ React7__namespace.useEffect(() => {
2632
3142
  const media = videoRef.current;
2633
3143
  if (!media || !src || !active) {
2634
3144
  setState("idle");
@@ -2898,7 +3408,7 @@ function useHlsPlayback({
2898
3408
  destroyHls();
2899
3409
  };
2900
3410
  }, [src, mode, active, autoPlay, muted, reloadKey]);
2901
- const setLevel = React5__namespace.useCallback((index) => {
3411
+ const setLevel = React7__namespace.useCallback((index) => {
2902
3412
  const hls = hlsRef.current;
2903
3413
  if (!hls) return;
2904
3414
  hls.nextLevel = index;
@@ -2984,12 +3494,12 @@ function VideoPlayer({
2984
3494
  className
2985
3495
  }) {
2986
3496
  const t = { ...DEFAULT_LABELS2, ...labels };
2987
- const containerRef = React5__namespace.useRef(null);
2988
- const firstPlayFiredRef = React5__namespace.useRef(false);
2989
- const [userStarted, setUserStarted] = React5__namespace.useState(false);
3497
+ const containerRef = React7__namespace.useRef(null);
3498
+ const firstPlayFiredRef = React7__namespace.useRef(false);
3499
+ const [userStarted, setUserStarted] = React7__namespace.useState(false);
2990
3500
  const active = autoPlay || !poster || userStarted;
2991
3501
  const autoplayActive = autoPlay || userStarted;
2992
- const handlePlayingChange = React5__namespace.useCallback(
3502
+ const handlePlayingChange = React7__namespace.useCallback(
2993
3503
  (playing) => {
2994
3504
  setIsPlaying(playing);
2995
3505
  if (playing && !firstPlayFiredRef.current) {
@@ -3018,25 +3528,25 @@ function VideoPlayer({
3018
3528
  onError,
3019
3529
  onPlayingChange: handlePlayingChange
3020
3530
  });
3021
- const [isPlaying, setIsPlaying] = React5__namespace.useState(false);
3022
- const [isMuted, setIsMuted] = React5__namespace.useState(muted);
3023
- const [volume, setVolume] = React5__namespace.useState(1);
3024
- const [currentTime, setCurrentTime] = React5__namespace.useState(0);
3025
- const [duration, setDuration] = React5__namespace.useState(0);
3026
- const [buffered, setBuffered] = React5__namespace.useState(0);
3027
- const [isFullscreen, setIsFullscreen] = React5__namespace.useState(false);
3028
- const [pipActive, setPipActive] = React5__namespace.useState(false);
3029
- const [controlsVisible, setControlsVisible] = React5__namespace.useState(true);
3030
- const [playbackRate, setPlaybackRate] = React5__namespace.useState(1);
3031
- const [openMenu, setOpenMenu] = React5__namespace.useState(
3531
+ const [isPlaying, setIsPlaying] = React7__namespace.useState(false);
3532
+ const [isMuted, setIsMuted] = React7__namespace.useState(muted);
3533
+ const [volume, setVolume] = React7__namespace.useState(1);
3534
+ const [currentTime, setCurrentTime] = React7__namespace.useState(0);
3535
+ const [duration, setDuration] = React7__namespace.useState(0);
3536
+ const [buffered, setBuffered] = React7__namespace.useState(0);
3537
+ const [isFullscreen, setIsFullscreen] = React7__namespace.useState(false);
3538
+ const [pipActive, setPipActive] = React7__namespace.useState(false);
3539
+ const [controlsVisible, setControlsVisible] = React7__namespace.useState(true);
3540
+ const [playbackRate, setPlaybackRate] = React7__namespace.useState(1);
3541
+ const [openMenu, setOpenMenu] = React7__namespace.useState(
3032
3542
  null
3033
3543
  );
3034
- const [behindLive, setBehindLive] = React5__namespace.useState(false);
3035
- const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React5__namespace.useState(false);
3036
- const hideTimerRef = React5__namespace.useRef(null);
3544
+ const [behindLive, setBehindLive] = React7__namespace.useState(false);
3545
+ const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React7__namespace.useState(false);
3546
+ const hideTimerRef = React7__namespace.useRef(null);
3037
3547
  const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
3038
3548
  const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported;
3039
- React5__namespace.useEffect(() => {
3549
+ React7__namespace.useEffect(() => {
3040
3550
  const video = videoRef.current;
3041
3551
  if (!video || !active) return;
3042
3552
  const onTimeUpdate = () => {
@@ -3069,21 +3579,21 @@ function VideoPlayer({
3069
3579
  video.removeEventListener("ratechange", onRate);
3070
3580
  };
3071
3581
  }, [videoRef, active, mode]);
3072
- React5__namespace.useEffect(() => {
3582
+ React7__namespace.useEffect(() => {
3073
3583
  const video = videoRef.current;
3074
3584
  if (!paused || !video || !isPlaying) return;
3075
3585
  video.pause();
3076
3586
  }, [paused, videoRef, isPlaying]);
3077
- React5__namespace.useEffect(() => {
3587
+ React7__namespace.useEffect(() => {
3078
3588
  setWebkitFullscreenSupported(hasWebkitVideoFullscreen(videoRef.current));
3079
3589
  videoRef.current?.setAttribute("x-webkit-airplay", "allow");
3080
3590
  }, [videoRef, active]);
3081
- React5__namespace.useEffect(() => {
3591
+ React7__namespace.useEffect(() => {
3082
3592
  const onFsChange = () => setIsFullscreen(document.fullscreenElement === containerRef.current);
3083
3593
  document.addEventListener("fullscreenchange", onFsChange);
3084
3594
  return () => document.removeEventListener("fullscreenchange", onFsChange);
3085
3595
  }, []);
3086
- React5__namespace.useEffect(() => {
3596
+ React7__namespace.useEffect(() => {
3087
3597
  const video = asWebkitVideo(videoRef.current);
3088
3598
  if (!video) return;
3089
3599
  const onBegin = () => setIsFullscreen(true);
@@ -3095,7 +3605,7 @@ function VideoPlayer({
3095
3605
  video.removeEventListener("webkitendfullscreen", onEnd);
3096
3606
  };
3097
3607
  }, [videoRef, active]);
3098
- React5__namespace.useEffect(() => {
3608
+ React7__namespace.useEffect(() => {
3099
3609
  const video = videoRef.current;
3100
3610
  if (!video) return;
3101
3611
  const onEnter = () => setPipActive(true);
@@ -3107,18 +3617,18 @@ function VideoPlayer({
3107
3617
  video.removeEventListener("leavepictureinpicture", onLeave);
3108
3618
  };
3109
3619
  }, [videoRef]);
3110
- const scheduleHide = React5__namespace.useCallback(() => {
3620
+ const scheduleHide = React7__namespace.useCallback(() => {
3111
3621
  if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
3112
3622
  hideTimerRef.current = setTimeout(() => {
3113
3623
  setControlsVisible(false);
3114
3624
  setOpenMenu(null);
3115
3625
  }, CONTROLS_HIDE_MS);
3116
3626
  }, []);
3117
- const revealControls = React5__namespace.useCallback(() => {
3627
+ const revealControls = React7__namespace.useCallback(() => {
3118
3628
  setControlsVisible(true);
3119
3629
  scheduleHide();
3120
3630
  }, [scheduleHide]);
3121
- React5__namespace.useEffect(() => {
3631
+ React7__namespace.useEffect(() => {
3122
3632
  return () => {
3123
3633
  if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
3124
3634
  };
@@ -3621,16 +4131,16 @@ function videoInPictureInPicture(container) {
3621
4131
  return container.contains(pip);
3622
4132
  }
3623
4133
  function useFeedExclusivePlayback(playbackId) {
3624
- const containerRef = React5__namespace.useRef(null);
3625
- const [forcePaused, setForcePaused] = React5__namespace.useState(false);
3626
- const requestPause = React5__namespace.useCallback(() => {
4134
+ const containerRef = React7__namespace.useRef(null);
4135
+ const [forcePaused, setForcePaused] = React7__namespace.useState(false);
4136
+ const requestPause = React7__namespace.useCallback(() => {
3627
4137
  if (videoInPictureInPicture(containerRef.current)) return;
3628
4138
  setForcePaused(true);
3629
4139
  }, []);
3630
- React5__namespace.useEffect(() => {
4140
+ React7__namespace.useEffect(() => {
3631
4141
  return registerFeedPlayer(playbackId, requestPause);
3632
4142
  }, [playbackId, requestPause]);
3633
- React5__namespace.useEffect(() => {
4143
+ React7__namespace.useEffect(() => {
3634
4144
  const node = containerRef.current;
3635
4145
  if (!node || typeof IntersectionObserver === "undefined") return;
3636
4146
  const observer = new IntersectionObserver(
@@ -3646,14 +4156,14 @@ function useFeedExclusivePlayback(playbackId) {
3646
4156
  observer.observe(node);
3647
4157
  return () => observer.disconnect();
3648
4158
  }, [requestPause]);
3649
- React5__namespace.useEffect(() => {
4159
+ React7__namespace.useEffect(() => {
3650
4160
  const onVisibility = () => {
3651
4161
  if (document.hidden) requestPause();
3652
4162
  };
3653
4163
  document.addEventListener("visibilitychange", onVisibility);
3654
4164
  return () => document.removeEventListener("visibilitychange", onVisibility);
3655
4165
  }, [requestPause]);
3656
- const onPlayingChange = React5__namespace.useCallback(
4166
+ const onPlayingChange = React7__namespace.useCallback(
3657
4167
  (playing) => {
3658
4168
  if (!playing) return;
3659
4169
  setForcePaused(false);
@@ -3680,7 +4190,7 @@ function FeedVideoPlayer({
3680
4190
  paused: exclusivePaused,
3681
4191
  onPlayingChange: onExclusivePlayingChange
3682
4192
  } = useFeedExclusivePlayback(playbackId);
3683
- const handlePlayingChange = React5__namespace.useCallback(
4193
+ const handlePlayingChange = React7__namespace.useCallback(
3684
4194
  (playing) => {
3685
4195
  onExclusivePlayingChange(playing);
3686
4196
  onPlayingChange?.(playing);
@@ -3707,8 +4217,8 @@ function FeedVideoPlayer({
3707
4217
  );
3708
4218
  }
3709
4219
  function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {}) {
3710
- const [stats, setStats] = React5__namespace.useState({});
3711
- React5__namespace.useEffect(() => {
4220
+ const [stats, setStats] = React7__namespace.useState({});
4221
+ React7__namespace.useEffect(() => {
3712
4222
  if (!statsUrl || !enabled) return;
3713
4223
  let cancelled = false;
3714
4224
  const controller = new AbortController();
@@ -3737,18 +4247,6 @@ function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {})
3737
4247
  }, [statsUrl, intervalMs, enabled]);
3738
4248
  return stats;
3739
4249
  }
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
4250
 
3753
4251
  // src/lib/avatar.ts
3754
4252
  var EMPTY_COLORS = {
@@ -3834,7 +4332,11 @@ function avatarFallbackStyle(name) {
3834
4332
  exports.AvatarEditor = AvatarEditor;
3835
4333
  exports.AvatarEditorDialog = AvatarEditorDialog;
3836
4334
  exports.ConfirmDestructiveDialog = ConfirmDestructiveDialog;
4335
+ exports.CurtainPicker = CurtainPicker;
4336
+ exports.CurtainPickerSkeleton = CurtainPickerSkeleton;
4337
+ exports.CurtainPreview = CurtainPreview;
3837
4338
  exports.CurtainStage = CurtainStage;
4339
+ exports.DEFAULT_CURTAIN_PICKER_LABELS = DEFAULT_CURTAIN_PICKER_LABELS;
3838
4340
  exports.DEFAULT_EDITABLE_SECTION_LABELS = DEFAULT_EDITABLE_SECTION_LABELS;
3839
4341
  exports.DataList = DataList;
3840
4342
  exports.DataListItem = DataListItem;