@livo-tv/blocks 1.0.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/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var React3 = 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 React3__namespace = /*#__PURE__*/_interopNamespace(React3);
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 = React3.createContext(null);
45
+ var LanguageContext = React7.createContext(null);
46
46
  function useLanguageContext() {
47
- return React3.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] = React3.useState("reading");
482
- const [status, setStatus] = React3.useState(null);
483
- const [confirmOpen, setConfirmOpen] = React3.useState(false);
484
- const [minHeightPx, setMinHeightPx] = React3.useState(void 0);
485
- const contentRef = React3.useRef(null);
486
- const editButtonRef = React3.useRef(null);
487
- const measuredHeightRef = React3.useRef(0);
488
- const shouldFocusEditRef = React3.useRef(false);
489
- const shouldFocusFirstFieldRef = React3.useRef(false);
490
- const editButtonId = React3.useId();
491
- const contentFormId = React3.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
- React3.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 = React3.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 = React3.useCallback(() => {
518
+ const startEdit = React7.useCallback(() => {
519
519
  setStatus(null);
520
520
  shouldFocusFirstFieldRef.current = true;
521
521
  setMode("editing");
522
522
  }, []);
523
- const requestCancel = React3.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 = React3.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 = React3.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
- React3.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] = React3.useState(false);
799
- const imgRef = React3.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
- React3.useLayoutEffect(() => {
801
+ React7.useLayoutEffect(() => {
802
802
  setFailed(false);
803
803
  }, [resolvedSrc]);
804
- React3.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] = React3.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 = React3.useCallback(
939
+ const handleThemeClick = React7.useCallback(
940
940
  (themeKey) => {
941
941
  setTheme(themeKey);
942
942
  },
943
943
  [setTheme]
944
944
  );
945
- React3.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 = React3__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 = React3.useRef(null);
1337
- const fileInputRef = React3.useRef(null);
1338
- const containerRef = React3.useRef(null);
1339
- const [image, setImage] = React3.useState(null);
1340
- const [imageLoaded, setImageLoaded] = React3.useState(false);
1341
- const [zoom, setZoom] = React3.useState(1);
1342
- const [rotation, setRotation] = React3.useState(0);
1343
- const [position, setPosition] = React3.useState({ x: 0, y: 0 });
1344
- const [isDragging, setIsDragging] = React3.useState(false);
1345
- const [dragStart, setDragStart] = React3.useState({ x: 0, y: 0 });
1346
- const [showGrid, setShowGrid] = React3.useState(initialShowGrid);
1347
- const generateOutput = React3.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
- React3.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 = React3.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 = React3.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 = React3.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 = React3.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 = React3.useCallback(() => {
1444
+ const handleMouseUp = React7.useCallback(() => {
1445
1445
  setIsDragging(false);
1446
1446
  }, []);
1447
- const handleTouchStart = React3.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 = React3.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 = React3.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] = React3.useState(false);
2039
- React3.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] = React3.useState(false);
2070
- const [editedValue, setEditedValue] = React3.useState(value ?? null);
2071
- const [displaySrc, setDisplaySrc] = React3.useState(value ?? null);
2072
- const [isSaving, setIsSaving] = React3.useState(false);
2073
- const [feedback, setFeedback] = React3.useState(null);
2074
- React3.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 = React3.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 = React3.useCallback(async () => {
2089
+ const handleAccept = React7.useCallback(async () => {
2090
2090
  if (!editedValue) return;
2091
2091
  setIsSaving(true);
2092
2092
  setFeedback(null);
@@ -2258,6 +2258,520 @@ function AvatarEditorDialog({
2258
2258
  ] }) })
2259
2259
  ] });
2260
2260
  }
2261
+ function usePrefersReducedMotion() {
2262
+ const [reduced, setReduced] = React7__namespace.useState(false);
2263
+ React7__namespace.useEffect(() => {
2264
+ const media = window.matchMedia("(prefers-reduced-motion: reduce)");
2265
+ const sync = () => setReduced(media.matches);
2266
+ sync();
2267
+ media.addEventListener("change", sync);
2268
+ return () => media.removeEventListener("change", sync);
2269
+ }, []);
2270
+ return reduced;
2271
+ }
2272
+ function CurtainStage({
2273
+ kind,
2274
+ url,
2275
+ alt = "",
2276
+ className,
2277
+ reducedMotion
2278
+ }) {
2279
+ const prefersReduced = usePrefersReducedMotion();
2280
+ const freeze = reducedMotion ?? prefersReduced;
2281
+ if (kind === "video" && !freeze) {
2282
+ return /* @__PURE__ */ jsxRuntime.jsx(
2283
+ "video",
2284
+ {
2285
+ src: url,
2286
+ className: cn("h-full w-full object-cover", className),
2287
+ autoPlay: true,
2288
+ muted: true,
2289
+ loop: true,
2290
+ playsInline: true,
2291
+ "aria-hidden": alt ? void 0 : true
2292
+ }
2293
+ );
2294
+ }
2295
+ if (kind === "video" && freeze) {
2296
+ return /* @__PURE__ */ jsxRuntime.jsx(
2297
+ "video",
2298
+ {
2299
+ src: url,
2300
+ className: cn("h-full w-full object-cover", className),
2301
+ muted: true,
2302
+ playsInline: true,
2303
+ preload: "metadata",
2304
+ "aria-hidden": alt ? void 0 : true
2305
+ }
2306
+ );
2307
+ }
2308
+ return /* @__PURE__ */ jsxRuntime.jsx(
2309
+ "img",
2310
+ {
2311
+ src: url,
2312
+ alt,
2313
+ className: cn("h-full w-full object-cover", className)
2314
+ }
2315
+ );
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
+ }
2660
+ function formatCountdown(ms) {
2661
+ if (ms <= 0) return "0:00";
2662
+ const total = Math.floor(ms / 1e3);
2663
+ const h = Math.floor(total / 3600);
2664
+ const m = Math.floor(total % 3600 / 60);
2665
+ const s = total % 60;
2666
+ const mm = String(m).padStart(2, "0");
2667
+ const ss = String(s).padStart(2, "0");
2668
+ return h > 0 ? `${h}:${mm}:${ss}` : `${m}:${ss}`;
2669
+ }
2670
+ function WaitingRoom({
2671
+ title,
2672
+ organizationName,
2673
+ organizationImage,
2674
+ startsAt,
2675
+ durationSeconds,
2676
+ curtain,
2677
+ nowMs,
2678
+ labels,
2679
+ className
2680
+ }) {
2681
+ const [now, setNow] = React7__namespace.useState(nowMs ?? Date.now());
2682
+ React7__namespace.useEffect(() => {
2683
+ if (nowMs != null) {
2684
+ setNow(nowMs);
2685
+ return;
2686
+ }
2687
+ const timer = window.setInterval(() => setNow(Date.now()), 1e3);
2688
+ return () => window.clearInterval(timer);
2689
+ }, [nowMs]);
2690
+ const remaining = startsAt != null ? startsAt - now : null;
2691
+ const durationMinutes = durationSeconds != null ? Math.max(1, Math.round(durationSeconds / 60)) : null;
2692
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2693
+ "div",
2694
+ {
2695
+ className: cn(
2696
+ "relative flex min-h-[16rem] w-full overflow-hidden rounded-lg bg-zinc-950 text-white",
2697
+ className
2698
+ ),
2699
+ children: [
2700
+ curtain ? /* @__PURE__ */ jsxRuntime.jsx(
2701
+ CurtainStage,
2702
+ {
2703
+ kind: curtain.kind,
2704
+ url: curtain.url,
2705
+ className: "absolute inset-0"
2706
+ }
2707
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-gradient-to-br from-zinc-900 to-zinc-950" }),
2708
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative z-10 flex w-full flex-col justify-end gap-3 bg-gradient-to-t from-black/70 via-black/30 to-transparent p-6", children: [
2709
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
2710
+ organizationImage ? /* @__PURE__ */ jsxRuntime.jsx(
2711
+ "img",
2712
+ {
2713
+ src: organizationImage,
2714
+ alt: "",
2715
+ className: "size-10 rounded-lg object-cover"
2716
+ }
2717
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-10 items-center justify-center rounded-lg bg-white/15 text-sm font-semibold", children: (organizationName ?? title).slice(0, 1).toUpperCase() }),
2718
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2719
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-semibold tracking-tight", children: title }),
2720
+ organizationName ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-white/80", children: organizationName }) : null
2721
+ ] })
2722
+ ] }),
2723
+ remaining != null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm tabular-nums", children: remaining > 0 ? `${labels?.startsIn ?? "Starts in"} ${formatCountdown(remaining)}` : labels?.started ?? "Starting soon" }) : null,
2724
+ durationMinutes != null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-white/70", children: labels?.duration ? labels.duration(durationMinutes) : `${durationMinutes} min` }) : null
2725
+ ] })
2726
+ ]
2727
+ }
2728
+ );
2729
+ }
2730
+
2731
+ // src/components/video/castHls.ts
2732
+ var CAST_SENDER_SRC = "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";
2733
+ var DEFAULT_RECEIVER_ID = "CC1AD845";
2734
+ var loadPromise = null;
2735
+ function loadCastSender() {
2736
+ if (typeof window === "undefined") return Promise.resolve();
2737
+ if (window.cast?.framework && window.chrome?.cast) return Promise.resolve();
2738
+ if (loadPromise) return loadPromise;
2739
+ loadPromise = new Promise((resolve, reject) => {
2740
+ window.__onGCastApiAvailable = (available) => {
2741
+ if (available) resolve();
2742
+ else reject(new Error("Cast API unavailable"));
2743
+ };
2744
+ const existing = document.querySelector(`script[src="${CAST_SENDER_SRC}"]`);
2745
+ if (existing) return;
2746
+ const script = document.createElement("script");
2747
+ script.src = CAST_SENDER_SRC;
2748
+ script.async = true;
2749
+ script.onerror = () => reject(new Error("Cast sender failed to load"));
2750
+ document.head.appendChild(script);
2751
+ });
2752
+ return loadPromise;
2753
+ }
2754
+ async function castHlsUrl(hlsUrl) {
2755
+ await loadCastSender();
2756
+ const framework = window.cast?.framework;
2757
+ const chromeCast = window.chrome?.cast;
2758
+ if (!framework || !chromeCast) {
2759
+ throw new Error("Cast API unavailable");
2760
+ }
2761
+ const context = framework.CastContext.getInstance();
2762
+ context.setOptions({
2763
+ receiverApplicationId: chromeCast.media.DEFAULT_MEDIA_RECEIVER_APP_ID || DEFAULT_RECEIVER_ID,
2764
+ autoJoinPolicy: chromeCast.AutoJoinPolicy?.ORIGIN_SCOPED
2765
+ });
2766
+ if (!context.getCurrentSession()) {
2767
+ await context.requestSession();
2768
+ }
2769
+ const session = context.getCurrentSession();
2770
+ if (!session) throw new Error("No Cast session");
2771
+ const media = new chromeCast.media.MediaInfo(hlsUrl, "application/x-mpegURL");
2772
+ const request = new chromeCast.media.LoadRequest(media);
2773
+ await session.loadMedia(request);
2774
+ }
2261
2775
 
2262
2776
  // src/components/video/hls-config.ts
2263
2777
  function shouldRetryLiveEdge404(retryConfig, retryCount, _isTimeout, loaderResponse, defaultRetry) {
@@ -2437,27 +2951,27 @@ function useHlsPlayback({
2437
2951
  onError,
2438
2952
  onPlayingChange
2439
2953
  }) {
2440
- const videoRef = React3__namespace.useRef(null);
2441
- const hlsRef = React3__namespace.useRef(null);
2442
- const [state, setState] = React3__namespace.useState("idle");
2443
- const [qualities, setQualities] = React3__namespace.useState([]);
2444
- const [activeLevel, setActiveLevel] = React3__namespace.useState(-1);
2445
- const [autoplayState, setAutoplayState] = React3__namespace.useState("none");
2446
- const [error, setError] = React3__namespace.useState(null);
2447
- const [reloadKey, setReloadKey] = React3__namespace.useState(0);
2448
- const onErrorRef = React3__namespace.useRef(onError);
2449
- const onPlayingChangeRef = React3__namespace.useRef(onPlayingChange);
2450
- React3__namespace.useEffect(() => {
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(() => {
2451
2965
  onErrorRef.current = onError;
2452
2966
  onPlayingChangeRef.current = onPlayingChange;
2453
2967
  }, [onError, onPlayingChange]);
2454
- const retry = React3__namespace.useCallback(() => {
2968
+ const retry = React7__namespace.useCallback(() => {
2455
2969
  setError(null);
2456
2970
  setState("loading");
2457
2971
  setAutoplayState("none");
2458
2972
  setReloadKey((k) => k + 1);
2459
2973
  }, []);
2460
- React3__namespace.useEffect(() => {
2974
+ React7__namespace.useEffect(() => {
2461
2975
  const media = videoRef.current;
2462
2976
  if (!media || !src || !active) {
2463
2977
  setState("idle");
@@ -2727,7 +3241,7 @@ function useHlsPlayback({
2727
3241
  destroyHls();
2728
3242
  };
2729
3243
  }, [src, mode, active, autoPlay, muted, reloadKey]);
2730
- const setLevel = React3__namespace.useCallback((index) => {
3244
+ const setLevel = React7__namespace.useCallback((index) => {
2731
3245
  const hls = hlsRef.current;
2732
3246
  if (!hls) return;
2733
3247
  hls.nextLevel = index;
@@ -2752,6 +3266,7 @@ var DEFAULT_LABELS2 = {
2752
3266
  enterFullscreen: "Fullscreen",
2753
3267
  exitFullscreen: "Exit fullscreen",
2754
3268
  pictureInPicture: "Picture in picture",
3269
+ cast: "Cast",
2755
3270
  settings: "Settings",
2756
3271
  quality: "Quality",
2757
3272
  auto: "Auto",
@@ -2812,12 +3327,12 @@ function VideoPlayer({
2812
3327
  className
2813
3328
  }) {
2814
3329
  const t = { ...DEFAULT_LABELS2, ...labels };
2815
- const containerRef = React3__namespace.useRef(null);
2816
- const firstPlayFiredRef = React3__namespace.useRef(false);
2817
- const [userStarted, setUserStarted] = React3__namespace.useState(false);
3330
+ const containerRef = React7__namespace.useRef(null);
3331
+ const firstPlayFiredRef = React7__namespace.useRef(false);
3332
+ const [userStarted, setUserStarted] = React7__namespace.useState(false);
2818
3333
  const active = autoPlay || !poster || userStarted;
2819
3334
  const autoplayActive = autoPlay || userStarted;
2820
- const handlePlayingChange = React3__namespace.useCallback(
3335
+ const handlePlayingChange = React7__namespace.useCallback(
2821
3336
  (playing) => {
2822
3337
  setIsPlaying(playing);
2823
3338
  if (playing && !firstPlayFiredRef.current) {
@@ -2846,25 +3361,25 @@ function VideoPlayer({
2846
3361
  onError,
2847
3362
  onPlayingChange: handlePlayingChange
2848
3363
  });
2849
- const [isPlaying, setIsPlaying] = React3__namespace.useState(false);
2850
- const [isMuted, setIsMuted] = React3__namespace.useState(muted);
2851
- const [volume, setVolume] = React3__namespace.useState(1);
2852
- const [currentTime, setCurrentTime] = React3__namespace.useState(0);
2853
- const [duration, setDuration] = React3__namespace.useState(0);
2854
- const [buffered, setBuffered] = React3__namespace.useState(0);
2855
- const [isFullscreen, setIsFullscreen] = React3__namespace.useState(false);
2856
- const [pipActive, setPipActive] = React3__namespace.useState(false);
2857
- const [controlsVisible, setControlsVisible] = React3__namespace.useState(true);
2858
- const [playbackRate, setPlaybackRate] = React3__namespace.useState(1);
2859
- const [openMenu, setOpenMenu] = React3__namespace.useState(
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(
2860
3375
  null
2861
3376
  );
2862
- const [behindLive, setBehindLive] = React3__namespace.useState(false);
2863
- const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React3__namespace.useState(false);
2864
- const hideTimerRef = React3__namespace.useRef(null);
3377
+ const [behindLive, setBehindLive] = React7__namespace.useState(false);
3378
+ const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React7__namespace.useState(false);
3379
+ const hideTimerRef = React7__namespace.useRef(null);
2865
3380
  const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
2866
3381
  const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported;
2867
- React3__namespace.useEffect(() => {
3382
+ React7__namespace.useEffect(() => {
2868
3383
  const video = videoRef.current;
2869
3384
  if (!video || !active) return;
2870
3385
  const onTimeUpdate = () => {
@@ -2897,20 +3412,21 @@ function VideoPlayer({
2897
3412
  video.removeEventListener("ratechange", onRate);
2898
3413
  };
2899
3414
  }, [videoRef, active, mode]);
2900
- React3__namespace.useEffect(() => {
3415
+ React7__namespace.useEffect(() => {
2901
3416
  const video = videoRef.current;
2902
3417
  if (!paused || !video || !isPlaying) return;
2903
3418
  video.pause();
2904
3419
  }, [paused, videoRef, isPlaying]);
2905
- React3__namespace.useEffect(() => {
3420
+ React7__namespace.useEffect(() => {
2906
3421
  setWebkitFullscreenSupported(hasWebkitVideoFullscreen(videoRef.current));
3422
+ videoRef.current?.setAttribute("x-webkit-airplay", "allow");
2907
3423
  }, [videoRef, active]);
2908
- React3__namespace.useEffect(() => {
3424
+ React7__namespace.useEffect(() => {
2909
3425
  const onFsChange = () => setIsFullscreen(document.fullscreenElement === containerRef.current);
2910
3426
  document.addEventListener("fullscreenchange", onFsChange);
2911
3427
  return () => document.removeEventListener("fullscreenchange", onFsChange);
2912
3428
  }, []);
2913
- React3__namespace.useEffect(() => {
3429
+ React7__namespace.useEffect(() => {
2914
3430
  const video = asWebkitVideo(videoRef.current);
2915
3431
  if (!video) return;
2916
3432
  const onBegin = () => setIsFullscreen(true);
@@ -2922,7 +3438,7 @@ function VideoPlayer({
2922
3438
  video.removeEventListener("webkitendfullscreen", onEnd);
2923
3439
  };
2924
3440
  }, [videoRef, active]);
2925
- React3__namespace.useEffect(() => {
3441
+ React7__namespace.useEffect(() => {
2926
3442
  const video = videoRef.current;
2927
3443
  if (!video) return;
2928
3444
  const onEnter = () => setPipActive(true);
@@ -2934,18 +3450,18 @@ function VideoPlayer({
2934
3450
  video.removeEventListener("leavepictureinpicture", onLeave);
2935
3451
  };
2936
3452
  }, [videoRef]);
2937
- const scheduleHide = React3__namespace.useCallback(() => {
3453
+ const scheduleHide = React7__namespace.useCallback(() => {
2938
3454
  if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
2939
3455
  hideTimerRef.current = setTimeout(() => {
2940
3456
  setControlsVisible(false);
2941
3457
  setOpenMenu(null);
2942
3458
  }, CONTROLS_HIDE_MS);
2943
3459
  }, []);
2944
- const revealControls = React3__namespace.useCallback(() => {
3460
+ const revealControls = React7__namespace.useCallback(() => {
2945
3461
  setControlsVisible(true);
2946
3462
  scheduleHide();
2947
3463
  }, [scheduleHide]);
2948
- React3__namespace.useEffect(() => {
3464
+ React7__namespace.useEffect(() => {
2949
3465
  return () => {
2950
3466
  if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
2951
3467
  };
@@ -3316,6 +3832,16 @@ function VideoPlayer({
3316
3832
  ]
3317
3833
  }
3318
3834
  ),
3835
+ /* @__PURE__ */ jsxRuntime.jsx(
3836
+ ControlButton,
3837
+ {
3838
+ label: t.cast,
3839
+ onClick: () => {
3840
+ void castHlsUrl(src).catch(() => void 0);
3841
+ },
3842
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Cast, { className: "size-5" })
3843
+ }
3844
+ ),
3319
3845
  pipSupported && /* @__PURE__ */ jsxRuntime.jsx(ControlButton, { label: t.pictureInPicture, onClick: togglePip, children: /* @__PURE__ */ jsxRuntime.jsx(
3320
3846
  lucideReact.PictureInPicture2,
3321
3847
  {
@@ -3438,16 +3964,16 @@ function videoInPictureInPicture(container) {
3438
3964
  return container.contains(pip);
3439
3965
  }
3440
3966
  function useFeedExclusivePlayback(playbackId) {
3441
- const containerRef = React3__namespace.useRef(null);
3442
- const [forcePaused, setForcePaused] = React3__namespace.useState(false);
3443
- const requestPause = React3__namespace.useCallback(() => {
3967
+ const containerRef = React7__namespace.useRef(null);
3968
+ const [forcePaused, setForcePaused] = React7__namespace.useState(false);
3969
+ const requestPause = React7__namespace.useCallback(() => {
3444
3970
  if (videoInPictureInPicture(containerRef.current)) return;
3445
3971
  setForcePaused(true);
3446
3972
  }, []);
3447
- React3__namespace.useEffect(() => {
3973
+ React7__namespace.useEffect(() => {
3448
3974
  return registerFeedPlayer(playbackId, requestPause);
3449
3975
  }, [playbackId, requestPause]);
3450
- React3__namespace.useEffect(() => {
3976
+ React7__namespace.useEffect(() => {
3451
3977
  const node = containerRef.current;
3452
3978
  if (!node || typeof IntersectionObserver === "undefined") return;
3453
3979
  const observer = new IntersectionObserver(
@@ -3463,14 +3989,14 @@ function useFeedExclusivePlayback(playbackId) {
3463
3989
  observer.observe(node);
3464
3990
  return () => observer.disconnect();
3465
3991
  }, [requestPause]);
3466
- React3__namespace.useEffect(() => {
3992
+ React7__namespace.useEffect(() => {
3467
3993
  const onVisibility = () => {
3468
3994
  if (document.hidden) requestPause();
3469
3995
  };
3470
3996
  document.addEventListener("visibilitychange", onVisibility);
3471
3997
  return () => document.removeEventListener("visibilitychange", onVisibility);
3472
3998
  }, [requestPause]);
3473
- const onPlayingChange = React3__namespace.useCallback(
3999
+ const onPlayingChange = React7__namespace.useCallback(
3474
4000
  (playing) => {
3475
4001
  if (!playing) return;
3476
4002
  setForcePaused(false);
@@ -3497,7 +4023,7 @@ function FeedVideoPlayer({
3497
4023
  paused: exclusivePaused,
3498
4024
  onPlayingChange: onExclusivePlayingChange
3499
4025
  } = useFeedExclusivePlayback(playbackId);
3500
- const handlePlayingChange = React3__namespace.useCallback(
4026
+ const handlePlayingChange = React7__namespace.useCallback(
3501
4027
  (playing) => {
3502
4028
  onExclusivePlayingChange(playing);
3503
4029
  onPlayingChange?.(playing);
@@ -3524,8 +4050,8 @@ function FeedVideoPlayer({
3524
4050
  );
3525
4051
  }
3526
4052
  function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {}) {
3527
- const [stats, setStats] = React3__namespace.useState({});
3528
- React3__namespace.useEffect(() => {
4053
+ const [stats, setStats] = React7__namespace.useState({});
4054
+ React7__namespace.useEffect(() => {
3529
4055
  if (!statsUrl || !enabled) return;
3530
4056
  let cancelled = false;
3531
4057
  const controller = new AbortController();
@@ -3554,18 +4080,6 @@ function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {})
3554
4080
  }, [statsUrl, intervalMs, enabled]);
3555
4081
  return stats;
3556
4082
  }
3557
- function useMediaQuery2(query) {
3558
- const [matches, setMatches] = React3.useState(false);
3559
- React3.useEffect(() => {
3560
- if (typeof window === "undefined" || !window.matchMedia) return;
3561
- const mql = window.matchMedia(query);
3562
- const onChange = () => setMatches(mql.matches);
3563
- onChange();
3564
- mql.addEventListener("change", onChange);
3565
- return () => mql.removeEventListener("change", onChange);
3566
- }, [query]);
3567
- return matches;
3568
- }
3569
4083
 
3570
4084
  // src/lib/avatar.ts
3571
4085
  var EMPTY_COLORS = {
@@ -3651,6 +4165,11 @@ function avatarFallbackStyle(name) {
3651
4165
  exports.AvatarEditor = AvatarEditor;
3652
4166
  exports.AvatarEditorDialog = AvatarEditorDialog;
3653
4167
  exports.ConfirmDestructiveDialog = ConfirmDestructiveDialog;
4168
+ exports.CurtainPicker = CurtainPicker;
4169
+ exports.CurtainPickerSkeleton = CurtainPickerSkeleton;
4170
+ exports.CurtainPreview = CurtainPreview;
4171
+ exports.CurtainStage = CurtainStage;
4172
+ exports.DEFAULT_CURTAIN_PICKER_LABELS = DEFAULT_CURTAIN_PICKER_LABELS;
3654
4173
  exports.DEFAULT_EDITABLE_SECTION_LABELS = DEFAULT_EDITABLE_SECTION_LABELS;
3655
4174
  exports.DataList = DataList;
3656
4175
  exports.DataListItem = DataListItem;
@@ -3671,7 +4190,9 @@ exports.LoadingState = LoadingState;
3671
4190
  exports.SafeImage = SafeImage;
3672
4191
  exports.ThemeSwitcher = ThemeSwitcher;
3673
4192
  exports.VideoPlayer = VideoPlayer;
4193
+ exports.WaitingRoom = WaitingRoom;
3674
4194
  exports.avatarFallbackStyle = avatarFallbackStyle;
4195
+ exports.castHlsUrl = castHlsUrl;
3675
4196
  exports.cn = cn;
3676
4197
  exports.createLiveHlsConfig = createLiveHlsConfig;
3677
4198
  exports.createVodHlsConfig = createVodHlsConfig;
@@ -3680,6 +4201,7 @@ exports.describeAvResync = describeAvResync;
3680
4201
  exports.describePlaybackError = describePlaybackError;
3681
4202
  exports.getAvatarColors = getAvatarColors;
3682
4203
  exports.getInitials = getInitials;
4204
+ exports.loadCastSender = loadCastSender;
3683
4205
  exports.shouldRetryLiveEdge404 = shouldRetryLiveEdge404;
3684
4206
  exports.useEditableSection = useEditableSection;
3685
4207
  exports.useFeedExclusivePlayback = useFeedExclusivePlayback;