@livo-tv/blocks 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var React7 = require('react');
4
+ var React8 = require('react');
5
5
  var lucideReact = require('lucide-react');
6
6
  var clsx = require('clsx');
7
7
  var tailwindMerge = require('tailwind-merge');
@@ -9,9 +9,9 @@ var classVarianceAuthority = require('class-variance-authority');
9
9
  var jsxRuntime = require('react/jsx-runtime');
10
10
  var AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
11
11
  var reactSlot = require('@radix-ui/react-slot');
12
+ var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
12
13
  var nextThemes = require('next-themes');
13
14
  var framerMotion = require('framer-motion');
14
- var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
15
15
  var SliderPrimitive = require('@radix-ui/react-slider');
16
16
  var TogglePrimitive = require('@radix-ui/react-toggle');
17
17
  var DialogPrimitive = require('@radix-ui/react-dialog');
@@ -35,16 +35,16 @@ function _interopNamespace(e) {
35
35
  return Object.freeze(n);
36
36
  }
37
37
 
38
- var React7__namespace = /*#__PURE__*/_interopNamespace(React7);
38
+ var React8__namespace = /*#__PURE__*/_interopNamespace(React8);
39
39
  var AlertDialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(AlertDialogPrimitive);
40
40
  var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
41
41
  var SliderPrimitive__namespace = /*#__PURE__*/_interopNamespace(SliderPrimitive);
42
42
  var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive);
43
43
  var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
44
44
 
45
- var LanguageContext = React7.createContext(null);
45
+ var LanguageContext = React8.createContext(null);
46
46
  function useLanguageContext() {
47
- return React7.useContext(LanguageContext);
47
+ return React8.useContext(LanguageContext);
48
48
  }
49
49
  function cn(...inputs) {
50
50
  return tailwindMerge.twMerge(clsx.clsx(inputs));
@@ -443,6 +443,179 @@ function ConfirmDestructiveDialog({
443
443
  ] })
444
444
  ] }) });
445
445
  }
446
+ var miniMenuContentClassName = "max-h-none overflow-x-visible overflow-y-visible";
447
+ var miniMenuContentDefaults = {
448
+ sideOffset: 8,
449
+ collisionPadding: 12
450
+ };
451
+ function DropdownMenu({
452
+ ...props
453
+ }) {
454
+ return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Root, { "data-slot": "dropdown-menu", ...props });
455
+ }
456
+ function DropdownMenuTrigger({
457
+ ...props
458
+ }) {
459
+ return /* @__PURE__ */ jsxRuntime.jsx(
460
+ DropdownMenuPrimitive__namespace.Trigger,
461
+ {
462
+ "data-slot": "dropdown-menu-trigger",
463
+ ...props
464
+ }
465
+ );
466
+ }
467
+ function DropdownMenuContent({
468
+ className,
469
+ sideOffset = 4,
470
+ ...props
471
+ }) {
472
+ return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
473
+ DropdownMenuPrimitive__namespace.Content,
474
+ {
475
+ "data-slot": "dropdown-menu-content",
476
+ sideOffset,
477
+ className: cn(
478
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[200] max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
479
+ className
480
+ ),
481
+ ...props
482
+ }
483
+ ) });
484
+ }
485
+ function DropdownMenuItem({
486
+ className,
487
+ inset,
488
+ variant = "default",
489
+ ...props
490
+ }) {
491
+ return /* @__PURE__ */ jsxRuntime.jsx(
492
+ DropdownMenuPrimitive__namespace.Item,
493
+ {
494
+ "data-slot": "dropdown-menu-item",
495
+ "data-inset": inset,
496
+ "data-variant": variant,
497
+ className: cn(
498
+ "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[highlighted]:[&_svg:not([class*='text-'])]:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:[&_svg:not([class*='text-'])]:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:data-[highlighted]:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:data-[highlighted]:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
499
+ className
500
+ ),
501
+ ...props
502
+ }
503
+ );
504
+ }
505
+ var DEFAULT_NOTIFICATION_BELL_LABELS = {
506
+ title: "Notifications",
507
+ empty: "You're all caught up.",
508
+ viewAll: "View all"
509
+ };
510
+ function formatUnreadBadge(count) {
511
+ return count > 9 ? "9+" : String(count);
512
+ }
513
+ function defaultFormatTime(iso) {
514
+ const date = new Date(iso);
515
+ if (Number.isNaN(date.getTime())) return iso;
516
+ return date.toLocaleString(void 0, {
517
+ dateStyle: "short",
518
+ timeStyle: "short"
519
+ });
520
+ }
521
+ function NotificationListSkeleton({ rows = 3 }) {
522
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col", "aria-hidden": "true", children: Array.from({ length: rows }, (_, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
523
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 px-4 py-3", children: [
524
+ /* @__PURE__ */ jsxRuntime.jsx(
525
+ "div",
526
+ {
527
+ "data-slot": "skeleton",
528
+ className: "bg-muted h-4 w-36 animate-pulse rounded-md motion-reduce:animate-none"
529
+ }
530
+ ),
531
+ /* @__PURE__ */ jsxRuntime.jsx(
532
+ "div",
533
+ {
534
+ "data-slot": "skeleton",
535
+ className: "bg-muted h-3 w-full animate-pulse rounded-md motion-reduce:animate-none"
536
+ }
537
+ ),
538
+ /* @__PURE__ */ jsxRuntime.jsx(
539
+ "div",
540
+ {
541
+ "data-slot": "skeleton",
542
+ className: "bg-muted h-3 w-20 animate-pulse rounded-md motion-reduce:animate-none"
543
+ }
544
+ )
545
+ ] }),
546
+ index < rows - 1 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-border h-px" }) : null
547
+ ] }, index)) });
548
+ }
549
+ function NotificationBell({
550
+ items,
551
+ unreadCount,
552
+ isLoading = false,
553
+ labels: labelOverrides,
554
+ viewAllHref,
555
+ formatTime: formatTime2 = defaultFormatTime,
556
+ onOpenChange,
557
+ align = "end",
558
+ className
559
+ }) {
560
+ const labels = { ...DEFAULT_NOTIFICATION_BELL_LABELS, ...labelOverrides };
561
+ return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { modal: false, onOpenChange, children: [
562
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
563
+ Button,
564
+ {
565
+ type: "button",
566
+ variant: "ghost",
567
+ size: "icon",
568
+ className: cn("relative size-9", className),
569
+ "aria-label": labels.title,
570
+ children: [
571
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bell, { className: "size-4" }),
572
+ unreadCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-destructive text-destructive-foreground absolute -top-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full text-[10px] leading-none font-medium tabular-nums", children: formatUnreadBadge(unreadCount) }) : null
573
+ ]
574
+ }
575
+ ) }),
576
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align, className: "w-80 p-0", children: [
577
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between border-b px-4 py-3", children: /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-semibold", children: labels.title }) }),
578
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-80 overflow-y-auto", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(NotificationListSkeleton, {}) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground px-4 py-8 text-center text-sm", children: labels.empty }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col", children: items.map((item, index) => {
579
+ const body = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-1", children: [
580
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm leading-none font-medium", children: item.title }),
581
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground line-clamp-2 text-xs", children: item.message }),
582
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground/70 text-xs", children: formatTime2(item.createdAt) })
583
+ ] });
584
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
585
+ item.href ? /* @__PURE__ */ jsxRuntime.jsx(
586
+ "a",
587
+ {
588
+ href: item.href,
589
+ className: cn(
590
+ "hover:bg-muted/50 flex gap-3 px-4 py-3 motion-safe:transition-colors",
591
+ !item.read && "bg-muted/30"
592
+ ),
593
+ children: body
594
+ }
595
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
596
+ "div",
597
+ {
598
+ className: cn(
599
+ "flex gap-3 px-4 py-3",
600
+ !item.read && "bg-muted/30"
601
+ ),
602
+ children: body
603
+ }
604
+ ),
605
+ index < items.length - 1 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-border h-px" }) : null
606
+ ] }, item.id);
607
+ }) }) }),
608
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t px-4 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
609
+ "a",
610
+ {
611
+ href: viewAllHref,
612
+ className: "text-primary block text-center text-sm font-medium hover:underline",
613
+ children: labels.viewAll
614
+ }
615
+ ) })
616
+ ] })
617
+ ] });
618
+ }
446
619
 
447
620
  // src/components/editable/types.ts
448
621
  var DEFAULT_EDITABLE_SECTION_LABELS = {
@@ -478,20 +651,20 @@ function useEditableSection({
478
651
  ...DEFAULT_EDITABLE_SECTION_LABELS,
479
652
  ...labels
480
653
  };
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();
654
+ const [mode, setMode] = React8.useState("reading");
655
+ const [status, setStatus] = React8.useState(null);
656
+ const [confirmOpen, setConfirmOpen] = React8.useState(false);
657
+ const [minHeightPx, setMinHeightPx] = React8.useState(void 0);
658
+ const contentRef = React8.useRef(null);
659
+ const editButtonRef = React8.useRef(null);
660
+ const measuredHeightRef = React8.useRef(0);
661
+ const shouldFocusEditRef = React8.useRef(false);
662
+ const shouldFocusFirstFieldRef = React8.useRef(false);
663
+ const editButtonId = React8.useId();
664
+ const contentFormId = React8.useId();
492
665
  const isEditing = mode === "editing" || mode === "saving";
493
666
  const isSaving = mode === "saving";
494
- React7.useEffect(() => {
667
+ React8.useEffect(() => {
495
668
  if (mode === "reading" && shouldFocusEditRef.current) {
496
669
  shouldFocusEditRef.current = false;
497
670
  editButtonRef.current?.focus();
@@ -509,18 +682,18 @@ function useEditableSection({
509
682
  focusFirstField(contentRef.current);
510
683
  }
511
684
  }, [mode]);
512
- const exitToReading = React7.useCallback(() => {
685
+ const exitToReading = React8.useCallback(() => {
513
686
  setConfirmOpen(false);
514
687
  shouldFocusEditRef.current = true;
515
688
  setMode("reading");
516
689
  onDiscard?.();
517
690
  }, [onDiscard]);
518
- const startEdit = React7.useCallback(() => {
691
+ const startEdit = React8.useCallback(() => {
519
692
  setStatus(null);
520
693
  shouldFocusFirstFieldRef.current = true;
521
694
  setMode("editing");
522
695
  }, []);
523
- const requestCancel = React7.useCallback(() => {
696
+ const requestCancel = React8.useCallback(() => {
524
697
  if (isSaving) return;
525
698
  if (isDirty) {
526
699
  setConfirmOpen(true);
@@ -528,7 +701,7 @@ function useEditableSection({
528
701
  }
529
702
  exitToReading();
530
703
  }, [exitToReading, isDirty, isSaving]);
531
- const handleSubmit = React7.useCallback(
704
+ const handleSubmit = React8.useCallback(
532
705
  (event) => {
533
706
  event.preventDefault();
534
707
  if (isSaving) return;
@@ -548,7 +721,7 @@ function useEditableSection({
548
721
  },
549
722
  [isSaving, onSave, resolvedLabels.saved]
550
723
  );
551
- const handleFormKeyDown = React7.useCallback(
724
+ const handleFormKeyDown = React8.useCallback(
552
725
  (event) => {
553
726
  if (event.key !== "Escape") return;
554
727
  event.preventDefault();
@@ -556,7 +729,7 @@ function useEditableSection({
556
729
  },
557
730
  [requestCancel]
558
731
  );
559
- React7.useEffect(() => {
732
+ React8.useEffect(() => {
560
733
  if (!stableHeight || !isEditing) return;
561
734
  const el = contentRef.current;
562
735
  if (!el) return;
@@ -795,13 +968,13 @@ function SafeImage({
795
968
  onError,
796
969
  ...imgProps
797
970
  }) {
798
- const [failed, setFailed] = React7.useState(false);
799
- const imgRef = React7.useRef(null);
971
+ const [failed, setFailed] = React8.useState(false);
972
+ const imgRef = React8.useRef(null);
800
973
  const resolvedSrc = typeof src === "string" && src.length > 0 ? src : null;
801
- React7.useLayoutEffect(() => {
974
+ React8.useLayoutEffect(() => {
802
975
  setFailed(false);
803
976
  }, [resolvedSrc]);
804
- React7.useLayoutEffect(() => {
977
+ React8.useLayoutEffect(() => {
805
978
  const img = imgRef.current;
806
979
  if (img && isBrokenImage(img)) {
807
980
  setFailed(true);
@@ -824,65 +997,6 @@ function SafeImage({
824
997
  }
825
998
  );
826
999
  }
827
- var miniMenuContentClassName = "max-h-none overflow-x-visible overflow-y-visible";
828
- var miniMenuContentDefaults = {
829
- sideOffset: 8,
830
- collisionPadding: 12
831
- };
832
- function DropdownMenu({
833
- ...props
834
- }) {
835
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Root, { "data-slot": "dropdown-menu", ...props });
836
- }
837
- function DropdownMenuTrigger({
838
- ...props
839
- }) {
840
- return /* @__PURE__ */ jsxRuntime.jsx(
841
- DropdownMenuPrimitive__namespace.Trigger,
842
- {
843
- "data-slot": "dropdown-menu-trigger",
844
- ...props
845
- }
846
- );
847
- }
848
- function DropdownMenuContent({
849
- className,
850
- sideOffset = 4,
851
- ...props
852
- }) {
853
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
854
- DropdownMenuPrimitive__namespace.Content,
855
- {
856
- "data-slot": "dropdown-menu-content",
857
- sideOffset,
858
- className: cn(
859
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[200] max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
860
- className
861
- ),
862
- ...props
863
- }
864
- ) });
865
- }
866
- function DropdownMenuItem({
867
- className,
868
- inset,
869
- variant = "default",
870
- ...props
871
- }) {
872
- return /* @__PURE__ */ jsxRuntime.jsx(
873
- DropdownMenuPrimitive__namespace.Item,
874
- {
875
- "data-slot": "dropdown-menu-item",
876
- "data-inset": inset,
877
- "data-variant": variant,
878
- className: cn(
879
- "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[highlighted]:[&_svg:not([class*='text-'])]:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:[&_svg:not([class*='text-'])]:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:data-[highlighted]:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:data-[highlighted]:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
880
- className
881
- ),
882
- ...props
883
- }
884
- );
885
- }
886
1000
  var defaultLabels = {
887
1001
  theme: "Theme",
888
1002
  system: "System",
@@ -931,18 +1045,18 @@ function ThemeSwitcher({
931
1045
  labels: userLabels
932
1046
  }) {
933
1047
  const { theme, setTheme } = nextThemes.useTheme();
934
- const [mounted, setMounted] = React7.useState(false);
1048
+ const [mounted, setMounted] = React8.useState(false);
935
1049
  const reduceMotion = framerMotion.useReducedMotion();
936
1050
  const sizes = sizeClasses[size];
937
1051
  const shapeClass = shapeClasses[shape];
938
1052
  const labels = { ...defaultLabels, ...userLabels };
939
- const handleThemeClick = React7.useCallback(
1053
+ const handleThemeClick = React8.useCallback(
940
1054
  (themeKey) => {
941
1055
  setTheme(themeKey);
942
1056
  },
943
1057
  [setTheme]
944
1058
  );
945
- React7.useEffect(() => {
1059
+ React8.useEffect(() => {
946
1060
  setMounted(true);
947
1061
  }, []);
948
1062
  if (!mounted) {
@@ -1222,7 +1336,7 @@ function Slider({
1222
1336
  max = 100,
1223
1337
  ...props
1224
1338
  }) {
1225
- const _values = React7__namespace.useMemo(
1339
+ const _values = React8__namespace.useMemo(
1226
1340
  () => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
1227
1341
  [value, defaultValue, min, max]
1228
1342
  );
@@ -1333,18 +1447,18 @@ function AvatarEditor({
1333
1447
  labels
1334
1448
  }) {
1335
1449
  const t = { ...DEFAULT_LABELS, ...labels };
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(() => {
1450
+ const canvasRef = React8.useRef(null);
1451
+ const fileInputRef = React8.useRef(null);
1452
+ const containerRef = React8.useRef(null);
1453
+ const [image, setImage] = React8.useState(null);
1454
+ const [imageLoaded, setImageLoaded] = React8.useState(false);
1455
+ const [zoom, setZoom] = React8.useState(1);
1456
+ const [rotation, setRotation] = React8.useState(0);
1457
+ const [position, setPosition] = React8.useState({ x: 0, y: 0 });
1458
+ const [isDragging, setIsDragging] = React8.useState(false);
1459
+ const [dragStart, setDragStart] = React8.useState({ x: 0, y: 0 });
1460
+ const [showGrid, setShowGrid] = React8.useState(initialShowGrid);
1461
+ const generateOutput = React8.useCallback(() => {
1348
1462
  if (!canvasRef.current || !image) return null;
1349
1463
  const outputCanvas = document.createElement("canvas");
1350
1464
  outputCanvas.width = outputSize;
@@ -1355,7 +1469,7 @@ function AvatarEditor({
1355
1469
  const mimeType = `image/${outputFormat}`;
1356
1470
  return outputCanvas.toDataURL(mimeType, outputQuality);
1357
1471
  }, [image, outputSize, outputFormat, outputQuality]);
1358
- React7.useEffect(() => {
1472
+ React8.useEffect(() => {
1359
1473
  if (!canvasRef.current || !image || !imageLoaded) return;
1360
1474
  const canvas = canvasRef.current;
1361
1475
  const ctx = canvas.getContext("2d");
@@ -1399,12 +1513,12 @@ function AvatarEditor({
1399
1513
  generateOutput,
1400
1514
  onChange
1401
1515
  ]);
1402
- const resetTransforms = React7.useCallback(() => {
1516
+ const resetTransforms = React8.useCallback(() => {
1403
1517
  setZoom(1);
1404
1518
  setRotation(0);
1405
1519
  setPosition({ x: 0, y: 0 });
1406
1520
  }, []);
1407
- const handleFileSelect = React7.useCallback(
1521
+ const handleFileSelect = React8.useCallback(
1408
1522
  (e) => {
1409
1523
  const file = e.target.files?.[0];
1410
1524
  if (!file) return;
@@ -1423,7 +1537,7 @@ function AvatarEditor({
1423
1537
  },
1424
1538
  [resetTransforms]
1425
1539
  );
1426
- const handleMouseDown = React7.useCallback(
1540
+ const handleMouseDown = React8.useCallback(
1427
1541
  (e) => {
1428
1542
  if (!imageLoaded) return;
1429
1543
  setIsDragging(true);
@@ -1431,7 +1545,7 @@ function AvatarEditor({
1431
1545
  },
1432
1546
  [imageLoaded, position]
1433
1547
  );
1434
- const handleMouseMove = React7.useCallback(
1548
+ const handleMouseMove = React8.useCallback(
1435
1549
  (e) => {
1436
1550
  if (!isDragging) return;
1437
1551
  setPosition({
@@ -1441,10 +1555,10 @@ function AvatarEditor({
1441
1555
  },
1442
1556
  [isDragging, dragStart]
1443
1557
  );
1444
- const handleMouseUp = React7.useCallback(() => {
1558
+ const handleMouseUp = React8.useCallback(() => {
1445
1559
  setIsDragging(false);
1446
1560
  }, []);
1447
- const handleTouchStart = React7.useCallback(
1561
+ const handleTouchStart = React8.useCallback(
1448
1562
  (e) => {
1449
1563
  if (!imageLoaded) return;
1450
1564
  const touch = e.touches[0];
@@ -1456,7 +1570,7 @@ function AvatarEditor({
1456
1570
  },
1457
1571
  [imageLoaded, position]
1458
1572
  );
1459
- const handleTouchMove = React7.useCallback(
1573
+ const handleTouchMove = React8.useCallback(
1460
1574
  (e) => {
1461
1575
  if (!isDragging) return;
1462
1576
  const touch = e.touches[0];
@@ -1467,7 +1581,7 @@ function AvatarEditor({
1467
1581
  },
1468
1582
  [isDragging, dragStart]
1469
1583
  );
1470
- const handleDiscard = React7.useCallback(() => {
1584
+ const handleDiscard = React8.useCallback(() => {
1471
1585
  setImage(null);
1472
1586
  setImageLoaded(false);
1473
1587
  resetTransforms();
@@ -2035,8 +2149,8 @@ function DrawerTitle({
2035
2149
  );
2036
2150
  }
2037
2151
  function useMediaQuery(query) {
2038
- const [matches, setMatches] = React7.useState(false);
2039
- React7.useEffect(() => {
2152
+ const [matches, setMatches] = React8.useState(false);
2153
+ React8.useEffect(() => {
2040
2154
  const media = window.matchMedia(query);
2041
2155
  if (media.matches !== matches) {
2042
2156
  setMatches(media.matches);
@@ -2066,17 +2180,17 @@ function AvatarEditorDialog({
2066
2180
  className,
2067
2181
  editorLabels
2068
2182
  }) {
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(() => {
2183
+ const [isOpen, setIsOpen] = React8.useState(false);
2184
+ const [editedValue, setEditedValue] = React8.useState(value ?? null);
2185
+ const [displaySrc, setDisplaySrc] = React8.useState(value ?? null);
2186
+ const [isSaving, setIsSaving] = React8.useState(false);
2187
+ const [feedback, setFeedback] = React8.useState(null);
2188
+ React8.useEffect(() => {
2075
2189
  setDisplaySrc(value ?? null);
2076
2190
  }, [value]);
2077
2191
  const isMobile = useMediaQuery("(max-width: 640px)");
2078
2192
  const caption = (placeholder ?? "").trim();
2079
- const handleOpenChange = React7.useCallback(
2193
+ const handleOpenChange = React8.useCallback(
2080
2194
  (open) => {
2081
2195
  if (open) {
2082
2196
  setEditedValue(value ?? null);
@@ -2086,7 +2200,7 @@ function AvatarEditorDialog({
2086
2200
  },
2087
2201
  [value]
2088
2202
  );
2089
- const handleAccept = React7.useCallback(async () => {
2203
+ const handleAccept = React8.useCallback(async () => {
2090
2204
  if (!editedValue) return;
2091
2205
  setIsSaving(true);
2092
2206
  setFeedback(null);
@@ -2290,8 +2404,8 @@ function probeVideoAudio(el) {
2290
2404
  return "unknown";
2291
2405
  }
2292
2406
  function usePrefersReducedMotion() {
2293
- const [reduced, setReduced] = React7__namespace.useState(false);
2294
- React7__namespace.useEffect(() => {
2407
+ const [reduced, setReduced] = React8__namespace.useState(false);
2408
+ React8__namespace.useEffect(() => {
2295
2409
  const media = window.matchMedia("(prefers-reduced-motion: reduce)");
2296
2410
  const sync = () => setReduced(media.matches);
2297
2411
  sync();
@@ -2308,11 +2422,11 @@ function CurtainVideo({
2308
2422
  allowSound,
2309
2423
  labels
2310
2424
  }) {
2311
- const videoRef = React7__namespace.useRef(null);
2312
- const [playback, setPlayback] = React7__namespace.useState("pending");
2313
- const [muted, setMuted] = React7__namespace.useState(true);
2314
- const [audio, setAudio] = React7__namespace.useState("unknown");
2315
- React7__namespace.useEffect(() => {
2425
+ const videoRef = React8__namespace.useRef(null);
2426
+ const [playback, setPlayback] = React8__namespace.useState("pending");
2427
+ const [muted, setMuted] = React8__namespace.useState(true);
2428
+ const [audio, setAudio] = React8__namespace.useState("unknown");
2429
+ React8__namespace.useEffect(() => {
2316
2430
  const el = videoRef.current;
2317
2431
  if (!el) return;
2318
2432
  el.setAttribute("webkit-playsinline", "");
@@ -2353,7 +2467,7 @@ function CurtainVideo({
2353
2467
  el.removeEventListener("loadedmetadata", applyAudio);
2354
2468
  };
2355
2469
  }, [url, freeze]);
2356
- const startPlayback = React7__namespace.useCallback(() => {
2470
+ const startPlayback = React8__namespace.useCallback(() => {
2357
2471
  const el = videoRef.current;
2358
2472
  if (!el) return;
2359
2473
  el.muted = true;
@@ -2369,7 +2483,7 @@ function CurtainVideo({
2369
2483
  }
2370
2484
  );
2371
2485
  }, []);
2372
- const setVideoMuted = React7__namespace.useCallback((next) => {
2486
+ const setVideoMuted = React8__namespace.useCallback((next) => {
2373
2487
  const el = videoRef.current;
2374
2488
  if (el) el.muted = next;
2375
2489
  setMuted(next);
@@ -2461,8 +2575,8 @@ function CurtainStage({
2461
2575
  );
2462
2576
  }
2463
2577
  function useMediaQuery2(query) {
2464
- const [matches, setMatches] = React7.useState(false);
2465
- React7.useEffect(() => {
2578
+ const [matches, setMatches] = React8.useState(false);
2579
+ React8.useEffect(() => {
2466
2580
  if (typeof window === "undefined" || !window.matchMedia) return;
2467
2581
  const mql = window.matchMedia(query);
2468
2582
  const onChange = () => setMatches(mql.matches);
@@ -2476,9 +2590,9 @@ function isVideoKind(kind) {
2476
2590
  return kind === "video";
2477
2591
  }
2478
2592
  function useElementInView(enabled) {
2479
- const [node, setNode] = React7__namespace.useState(null);
2480
- const [inView, setInView] = React7__namespace.useState(false);
2481
- React7__namespace.useEffect(() => {
2593
+ const [node, setNode] = React8__namespace.useState(null);
2594
+ const [inView, setInView] = React8__namespace.useState(false);
2595
+ React8__namespace.useEffect(() => {
2482
2596
  if (!enabled || !node || typeof IntersectionObserver === "undefined") {
2483
2597
  setInView(false);
2484
2598
  return;
@@ -2650,7 +2764,7 @@ function CurtainPicker({
2650
2764
  actionsPending = false
2651
2765
  }) {
2652
2766
  const copy = { ...DEFAULT_CURTAIN_PICKER_LABELS, ...labels };
2653
- const groupName = React7__namespace.useId();
2767
+ const groupName = React8__namespace.useId();
2654
2768
  const selectable = typeof onChange === "function";
2655
2769
  const compact = variant === "compact";
2656
2770
  const selectedId = value === "" ? null : value ?? null;
@@ -2666,7 +2780,7 @@ function CurtainPicker({
2666
2780
  canMakeDefault,
2667
2781
  canDelete
2668
2782
  ) : {};
2669
- const grouped = React7__namespace.useMemo(() => {
2783
+ const grouped = React8__namespace.useMemo(() => {
2670
2784
  if (!groupByOwner) {
2671
2785
  return [{ group: null, items: ready }];
2672
2786
  }
@@ -2991,8 +3105,8 @@ function WaitingRoom({
2991
3105
  labels,
2992
3106
  className
2993
3107
  }) {
2994
- const [now, setNow] = React7__namespace.useState(nowMs ?? Date.now());
2995
- React7__namespace.useEffect(() => {
3108
+ const [now, setNow] = React8__namespace.useState(nowMs ?? Date.now());
3109
+ React8__namespace.useEffect(() => {
2996
3110
  if (nowMs != null) {
2997
3111
  setNow(nowMs);
2998
3112
  return;
@@ -3087,6 +3201,187 @@ async function castHlsUrl(hlsUrl) {
3087
3201
  await session.loadMedia(request);
3088
3202
  }
3089
3203
 
3204
+ // src/components/video/seekPreview.ts
3205
+ var XYWH_RE = /#xywh=(\d+),(\d+),(\d+),(\d+)\s*$/;
3206
+ function thumbnailsVttUrlFromPlayback(src) {
3207
+ const trimmed = src.trim();
3208
+ if (!trimmed) return null;
3209
+ const replaced = trimmed.replace(
3210
+ /index\.m3u8(?:\?.*)?$/i,
3211
+ "thumbs/preview.vtt"
3212
+ );
3213
+ if (replaced === trimmed) return null;
3214
+ return replaced;
3215
+ }
3216
+ function parseVttTimestamp(value) {
3217
+ const parts = value.trim().split(":");
3218
+ if (parts.length === 3) {
3219
+ const hours = Number(parts[0]);
3220
+ const minutes = Number(parts[1]);
3221
+ const seconds2 = Number(parts[2]);
3222
+ if ([hours, minutes, seconds2].some((n) => Number.isNaN(n))) return 0;
3223
+ return hours * 3600 + minutes * 60 + seconds2;
3224
+ }
3225
+ if (parts.length === 2) {
3226
+ const minutes = Number(parts[0]);
3227
+ const seconds2 = Number(parts[1]);
3228
+ if ([minutes, seconds2].some((n) => Number.isNaN(n))) return 0;
3229
+ return minutes * 60 + seconds2;
3230
+ }
3231
+ const seconds = Number(value);
3232
+ return Number.isFinite(seconds) ? seconds : 0;
3233
+ }
3234
+ function parseThumbnailsVtt(text, vttUrl) {
3235
+ const cues = [];
3236
+ const blocks = text.replace(/^\uFEFF?WEBVTT[^\n]*\n/i, "").split(/\n\s*\n/);
3237
+ for (const block of blocks) {
3238
+ const lines = block.split("\n").map((line) => line.trim()).filter(Boolean);
3239
+ const timing = lines.find((line) => line.includes("-->"));
3240
+ const payload = lines.find((line) => XYWH_RE.test(line));
3241
+ if (!timing || !payload) continue;
3242
+ const [startRaw, endRaw] = timing.split("-->").map((part) => part.trim());
3243
+ const match = payload.match(XYWH_RE);
3244
+ if (!startRaw || !endRaw || !match) continue;
3245
+ const spriteName = payload.slice(0, match.index);
3246
+ cues.push({
3247
+ start: parseVttTimestamp(startRaw),
3248
+ end: parseVttTimestamp(endRaw),
3249
+ spriteUrl: new URL(spriteName, vttUrl).toString(),
3250
+ x: Number(match[1]),
3251
+ y: Number(match[2]),
3252
+ width: Number(match[3]),
3253
+ height: Number(match[4])
3254
+ });
3255
+ }
3256
+ return cues;
3257
+ }
3258
+ function cueAtTime(cues, time) {
3259
+ if (cues.length === 0) return null;
3260
+ const hit = cues.find((cue) => time >= cue.start && time < cue.end);
3261
+ if (hit) return hit;
3262
+ const last = cues[cues.length - 1];
3263
+ if (last && time >= last.start) return last;
3264
+ return cues[0] ?? null;
3265
+ }
3266
+ function hoverTimeFromClientX(clientX, rect, duration) {
3267
+ if (rect.width <= 0 || duration <= 0) return 0;
3268
+ const ratio = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width));
3269
+ return ratio * duration;
3270
+ }
3271
+ async function loadThumbnailsVtt(src) {
3272
+ const vttUrl = thumbnailsVttUrlFromPlayback(src);
3273
+ if (!vttUrl) return [];
3274
+ try {
3275
+ const response = await fetch(vttUrl);
3276
+ if (!response.ok) return [];
3277
+ const text = await response.text();
3278
+ return parseThumbnailsVtt(text, vttUrl);
3279
+ } catch {
3280
+ return [];
3281
+ }
3282
+ }
3283
+ function SeekBar({
3284
+ src,
3285
+ duration,
3286
+ currentTime,
3287
+ buffered,
3288
+ onSeek,
3289
+ formatTime: formatTime2
3290
+ }) {
3291
+ const trackRef = React8__namespace.useRef(null);
3292
+ const [hoverTime, setHoverTime] = React8__namespace.useState(null);
3293
+ const [cues, setCues] = React8__namespace.useState(null);
3294
+ const loadedSrc = React8__namespace.useRef(null);
3295
+ React8__namespace.useEffect(() => {
3296
+ setCues(null);
3297
+ loadedSrc.current = null;
3298
+ }, [src]);
3299
+ const ensureCues = React8__namespace.useCallback(() => {
3300
+ if (loadedSrc.current === src) return;
3301
+ loadedSrc.current = src;
3302
+ void loadThumbnailsVtt(src).then((next) => {
3303
+ setCues(next);
3304
+ });
3305
+ }, [src]);
3306
+ const updateHover = React8__namespace.useCallback(
3307
+ (clientX) => {
3308
+ const rect = trackRef.current?.getBoundingClientRect();
3309
+ if (!rect) return;
3310
+ setHoverTime(hoverTimeFromClientX(clientX, rect, duration));
3311
+ },
3312
+ [duration]
3313
+ );
3314
+ const cue = hoverTime !== null && cues && cues.length > 0 ? cueAtTime(cues, hoverTime) : null;
3315
+ const hoverPercent = hoverTime !== null && duration > 0 ? Math.min(100, Math.max(0, hoverTime / duration * 100)) : 0;
3316
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3317
+ "div",
3318
+ {
3319
+ ref: trackRef,
3320
+ className: "relative w-full",
3321
+ onPointerEnter: ensureCues,
3322
+ onPointerDown: (event) => {
3323
+ ensureCues();
3324
+ updateHover(event.clientX);
3325
+ },
3326
+ onPointerMove: (event) => {
3327
+ ensureCues();
3328
+ updateHover(event.clientX);
3329
+ },
3330
+ onPointerLeave: () => setHoverTime(null),
3331
+ onPointerUp: () => setHoverTime(null),
3332
+ children: [
3333
+ hoverTime !== null ? /* @__PURE__ */ jsxRuntime.jsxs(
3334
+ "div",
3335
+ {
3336
+ className: "pointer-events-none absolute bottom-full mb-2 flex flex-col items-center gap-1",
3337
+ style: { left: `${hoverPercent}%`, transform: "translateX(-50%)" },
3338
+ "data-slot": "seek-preview",
3339
+ children: [
3340
+ cue ? /* @__PURE__ */ jsxRuntime.jsx(
3341
+ "div",
3342
+ {
3343
+ "aria-hidden": "true",
3344
+ className: "overflow-hidden rounded border border-white/20 bg-black shadow-md",
3345
+ style: {
3346
+ width: cue.width,
3347
+ height: cue.height,
3348
+ backgroundImage: `url(${cue.spriteUrl})`,
3349
+ backgroundPosition: `-${cue.x}px -${cue.y}px`,
3350
+ backgroundRepeat: "no-repeat"
3351
+ }
3352
+ }
3353
+ ) : null,
3354
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-black/80 px-1.5 py-0.5 text-[10px] tabular-nums text-white", children: formatTime2(hoverTime) })
3355
+ ]
3356
+ }
3357
+ ) : null,
3358
+ /* @__PURE__ */ jsxRuntime.jsx(
3359
+ Slider,
3360
+ {
3361
+ "aria-label": "Seek",
3362
+ min: 0,
3363
+ max: duration || 0,
3364
+ step: 0.1,
3365
+ value: [Math.min(currentTime, duration || 0)],
3366
+ onValueChange: (value) => onSeek(value[0] ?? 0),
3367
+ className: "w-full"
3368
+ }
3369
+ ),
3370
+ duration > 0 && buffered > currentTime ? /* @__PURE__ */ jsxRuntime.jsx(
3371
+ "span",
3372
+ {
3373
+ "aria-hidden": "true",
3374
+ className: "pointer-events-none absolute top-1/2 left-0 h-1.5 -translate-y-1/2 rounded-full bg-white/25",
3375
+ style: {
3376
+ width: `${Math.min(buffered / duration * 100, 100)}%`
3377
+ }
3378
+ }
3379
+ ) : null
3380
+ ]
3381
+ }
3382
+ );
3383
+ }
3384
+
3090
3385
  // src/components/video/hls-config.ts
3091
3386
  function shouldRetryLiveEdge404(retryConfig, retryCount, _isTimeout, loaderResponse, defaultRetry) {
3092
3387
  if (loaderResponse?.code === 404) {
@@ -3265,27 +3560,27 @@ function useHlsPlayback({
3265
3560
  onError,
3266
3561
  onPlayingChange
3267
3562
  }) {
3268
- const videoRef = React7__namespace.useRef(null);
3269
- const hlsRef = React7__namespace.useRef(null);
3270
- const [state, setState] = React7__namespace.useState("idle");
3271
- const [qualities, setQualities] = React7__namespace.useState([]);
3272
- const [activeLevel, setActiveLevel] = React7__namespace.useState(-1);
3273
- const [autoplayState, setAutoplayState] = React7__namespace.useState("none");
3274
- const [error, setError] = React7__namespace.useState(null);
3275
- const [reloadKey, setReloadKey] = React7__namespace.useState(0);
3276
- const onErrorRef = React7__namespace.useRef(onError);
3277
- const onPlayingChangeRef = React7__namespace.useRef(onPlayingChange);
3278
- React7__namespace.useEffect(() => {
3563
+ const videoRef = React8__namespace.useRef(null);
3564
+ const hlsRef = React8__namespace.useRef(null);
3565
+ const [state, setState] = React8__namespace.useState("idle");
3566
+ const [qualities, setQualities] = React8__namespace.useState([]);
3567
+ const [activeLevel, setActiveLevel] = React8__namespace.useState(-1);
3568
+ const [autoplayState, setAutoplayState] = React8__namespace.useState("none");
3569
+ const [error, setError] = React8__namespace.useState(null);
3570
+ const [reloadKey, setReloadKey] = React8__namespace.useState(0);
3571
+ const onErrorRef = React8__namespace.useRef(onError);
3572
+ const onPlayingChangeRef = React8__namespace.useRef(onPlayingChange);
3573
+ React8__namespace.useEffect(() => {
3279
3574
  onErrorRef.current = onError;
3280
3575
  onPlayingChangeRef.current = onPlayingChange;
3281
3576
  }, [onError, onPlayingChange]);
3282
- const retry = React7__namespace.useCallback(() => {
3577
+ const retry = React8__namespace.useCallback(() => {
3283
3578
  setError(null);
3284
3579
  setState("loading");
3285
3580
  setAutoplayState("none");
3286
3581
  setReloadKey((k) => k + 1);
3287
3582
  }, []);
3288
- React7__namespace.useEffect(() => {
3583
+ React8__namespace.useEffect(() => {
3289
3584
  const media = videoRef.current;
3290
3585
  if (!media || !src || !active) {
3291
3586
  setState("idle");
@@ -3555,7 +3850,7 @@ function useHlsPlayback({
3555
3850
  destroyHls();
3556
3851
  };
3557
3852
  }, [src, mode, active, autoPlay, muted, reloadKey]);
3558
- const setLevel = React7__namespace.useCallback((index) => {
3853
+ const setLevel = React8__namespace.useCallback((index) => {
3559
3854
  const hls = hlsRef.current;
3560
3855
  if (!hls) return;
3561
3856
  hls.nextLevel = index;
@@ -3641,12 +3936,12 @@ function VideoPlayer({
3641
3936
  className
3642
3937
  }) {
3643
3938
  const t = { ...DEFAULT_LABELS3, ...labels };
3644
- const containerRef = React7__namespace.useRef(null);
3645
- const firstPlayFiredRef = React7__namespace.useRef(false);
3646
- const [userStarted, setUserStarted] = React7__namespace.useState(false);
3939
+ const containerRef = React8__namespace.useRef(null);
3940
+ const firstPlayFiredRef = React8__namespace.useRef(false);
3941
+ const [userStarted, setUserStarted] = React8__namespace.useState(false);
3647
3942
  const active = autoPlay || !poster || userStarted;
3648
3943
  const autoplayActive = autoPlay || userStarted;
3649
- const handlePlayingChange = React7__namespace.useCallback(
3944
+ const handlePlayingChange = React8__namespace.useCallback(
3650
3945
  (playing) => {
3651
3946
  setIsPlaying(playing);
3652
3947
  if (playing && !firstPlayFiredRef.current) {
@@ -3675,25 +3970,25 @@ function VideoPlayer({
3675
3970
  onError,
3676
3971
  onPlayingChange: handlePlayingChange
3677
3972
  });
3678
- const [isPlaying, setIsPlaying] = React7__namespace.useState(false);
3679
- const [isMuted, setIsMuted] = React7__namespace.useState(muted);
3680
- const [volume, setVolume] = React7__namespace.useState(1);
3681
- const [currentTime, setCurrentTime] = React7__namespace.useState(0);
3682
- const [duration, setDuration] = React7__namespace.useState(0);
3683
- const [buffered, setBuffered] = React7__namespace.useState(0);
3684
- const [isFullscreen, setIsFullscreen] = React7__namespace.useState(false);
3685
- const [pipActive, setPipActive] = React7__namespace.useState(false);
3686
- const [controlsVisible, setControlsVisible] = React7__namespace.useState(true);
3687
- const [playbackRate, setPlaybackRate] = React7__namespace.useState(1);
3688
- const [openMenu, setOpenMenu] = React7__namespace.useState(
3973
+ const [isPlaying, setIsPlaying] = React8__namespace.useState(false);
3974
+ const [isMuted, setIsMuted] = React8__namespace.useState(muted);
3975
+ const [volume, setVolume] = React8__namespace.useState(1);
3976
+ const [currentTime, setCurrentTime] = React8__namespace.useState(0);
3977
+ const [duration, setDuration] = React8__namespace.useState(0);
3978
+ const [buffered, setBuffered] = React8__namespace.useState(0);
3979
+ const [isFullscreen, setIsFullscreen] = React8__namespace.useState(false);
3980
+ const [pipActive, setPipActive] = React8__namespace.useState(false);
3981
+ const [controlsVisible, setControlsVisible] = React8__namespace.useState(true);
3982
+ const [playbackRate, setPlaybackRate] = React8__namespace.useState(1);
3983
+ const [openMenu, setOpenMenu] = React8__namespace.useState(
3689
3984
  null
3690
3985
  );
3691
- const [behindLive, setBehindLive] = React7__namespace.useState(false);
3692
- const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React7__namespace.useState(false);
3693
- const hideTimerRef = React7__namespace.useRef(null);
3986
+ const [behindLive, setBehindLive] = React8__namespace.useState(false);
3987
+ const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React8__namespace.useState(false);
3988
+ const hideTimerRef = React8__namespace.useRef(null);
3694
3989
  const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
3695
3990
  const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported;
3696
- React7__namespace.useEffect(() => {
3991
+ React8__namespace.useEffect(() => {
3697
3992
  const video = videoRef.current;
3698
3993
  if (!video || !active) return;
3699
3994
  const onTimeUpdate = () => {
@@ -3726,21 +4021,21 @@ function VideoPlayer({
3726
4021
  video.removeEventListener("ratechange", onRate);
3727
4022
  };
3728
4023
  }, [videoRef, active, mode]);
3729
- React7__namespace.useEffect(() => {
4024
+ React8__namespace.useEffect(() => {
3730
4025
  const video = videoRef.current;
3731
4026
  if (!paused || !video || !isPlaying) return;
3732
4027
  video.pause();
3733
4028
  }, [paused, videoRef, isPlaying]);
3734
- React7__namespace.useEffect(() => {
4029
+ React8__namespace.useEffect(() => {
3735
4030
  setWebkitFullscreenSupported(hasWebkitVideoFullscreen(videoRef.current));
3736
4031
  videoRef.current?.setAttribute("x-webkit-airplay", "allow");
3737
4032
  }, [videoRef, active]);
3738
- React7__namespace.useEffect(() => {
4033
+ React8__namespace.useEffect(() => {
3739
4034
  const onFsChange = () => setIsFullscreen(document.fullscreenElement === containerRef.current);
3740
4035
  document.addEventListener("fullscreenchange", onFsChange);
3741
4036
  return () => document.removeEventListener("fullscreenchange", onFsChange);
3742
4037
  }, []);
3743
- React7__namespace.useEffect(() => {
4038
+ React8__namespace.useEffect(() => {
3744
4039
  const video = asWebkitVideo(videoRef.current);
3745
4040
  if (!video) return;
3746
4041
  const onBegin = () => setIsFullscreen(true);
@@ -3752,7 +4047,7 @@ function VideoPlayer({
3752
4047
  video.removeEventListener("webkitendfullscreen", onEnd);
3753
4048
  };
3754
4049
  }, [videoRef, active]);
3755
- React7__namespace.useEffect(() => {
4050
+ React8__namespace.useEffect(() => {
3756
4051
  const video = videoRef.current;
3757
4052
  if (!video) return;
3758
4053
  const onEnter = () => setPipActive(true);
@@ -3764,18 +4059,18 @@ function VideoPlayer({
3764
4059
  video.removeEventListener("leavepictureinpicture", onLeave);
3765
4060
  };
3766
4061
  }, [videoRef]);
3767
- const scheduleHide = React7__namespace.useCallback(() => {
4062
+ const scheduleHide = React8__namespace.useCallback(() => {
3768
4063
  if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
3769
4064
  hideTimerRef.current = setTimeout(() => {
3770
4065
  setControlsVisible(false);
3771
4066
  setOpenMenu(null);
3772
4067
  }, CONTROLS_HIDE_MS);
3773
4068
  }, []);
3774
- const revealControls = React7__namespace.useCallback(() => {
4069
+ const revealControls = React8__namespace.useCallback(() => {
3775
4070
  setControlsVisible(true);
3776
4071
  scheduleHide();
3777
4072
  }, [scheduleHide]);
3778
- React7__namespace.useEffect(() => {
4073
+ React8__namespace.useEffect(() => {
3779
4074
  return () => {
3780
4075
  if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
3781
4076
  };
@@ -4017,30 +4312,17 @@ function VideoPlayer({
4017
4312
  ),
4018
4313
  "data-slot": "video-controls",
4019
4314
  children: [
4020
- mode === "vod" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full", children: [
4021
- /* @__PURE__ */ jsxRuntime.jsx(
4022
- Slider,
4023
- {
4024
- "aria-label": "Seek",
4025
- min: 0,
4026
- max: duration || 0,
4027
- step: 0.1,
4028
- value: [Math.min(currentTime, duration || 0)],
4029
- onValueChange: (v) => seekTo(v[0] ?? 0),
4030
- className: "w-full"
4031
- }
4032
- ),
4033
- duration > 0 && buffered > currentTime && /* @__PURE__ */ jsxRuntime.jsx(
4034
- "span",
4035
- {
4036
- "aria-hidden": "true",
4037
- className: "pointer-events-none absolute top-1/2 left-0 h-1.5 -translate-y-1/2 rounded-full bg-white/25",
4038
- style: {
4039
- width: `${Math.min(buffered / duration * 100, 100)}%`
4040
- }
4041
- }
4042
- )
4043
- ] }),
4315
+ mode === "vod" && /* @__PURE__ */ jsxRuntime.jsx(
4316
+ SeekBar,
4317
+ {
4318
+ src,
4319
+ duration,
4320
+ currentTime,
4321
+ buffered,
4322
+ onSeek: seekTo,
4323
+ formatTime
4324
+ }
4325
+ ),
4044
4326
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
4045
4327
  /* @__PURE__ */ jsxRuntime.jsx(
4046
4328
  ControlButton,
@@ -4278,16 +4560,16 @@ function videoInPictureInPicture(container) {
4278
4560
  return container.contains(pip);
4279
4561
  }
4280
4562
  function useFeedExclusivePlayback(playbackId) {
4281
- const containerRef = React7__namespace.useRef(null);
4282
- const [forcePaused, setForcePaused] = React7__namespace.useState(false);
4283
- const requestPause = React7__namespace.useCallback(() => {
4563
+ const containerRef = React8__namespace.useRef(null);
4564
+ const [forcePaused, setForcePaused] = React8__namespace.useState(false);
4565
+ const requestPause = React8__namespace.useCallback(() => {
4284
4566
  if (videoInPictureInPicture(containerRef.current)) return;
4285
4567
  setForcePaused(true);
4286
4568
  }, []);
4287
- React7__namespace.useEffect(() => {
4569
+ React8__namespace.useEffect(() => {
4288
4570
  return registerFeedPlayer(playbackId, requestPause);
4289
4571
  }, [playbackId, requestPause]);
4290
- React7__namespace.useEffect(() => {
4572
+ React8__namespace.useEffect(() => {
4291
4573
  const node = containerRef.current;
4292
4574
  if (!node || typeof IntersectionObserver === "undefined") return;
4293
4575
  const observer = new IntersectionObserver(
@@ -4303,14 +4585,14 @@ function useFeedExclusivePlayback(playbackId) {
4303
4585
  observer.observe(node);
4304
4586
  return () => observer.disconnect();
4305
4587
  }, [requestPause]);
4306
- React7__namespace.useEffect(() => {
4588
+ React8__namespace.useEffect(() => {
4307
4589
  const onVisibility = () => {
4308
4590
  if (document.hidden) requestPause();
4309
4591
  };
4310
4592
  document.addEventListener("visibilitychange", onVisibility);
4311
4593
  return () => document.removeEventListener("visibilitychange", onVisibility);
4312
4594
  }, [requestPause]);
4313
- const onPlayingChange = React7__namespace.useCallback(
4595
+ const onPlayingChange = React8__namespace.useCallback(
4314
4596
  (playing) => {
4315
4597
  if (!playing) return;
4316
4598
  setForcePaused(false);
@@ -4337,7 +4619,7 @@ function FeedVideoPlayer({
4337
4619
  paused: exclusivePaused,
4338
4620
  onPlayingChange: onExclusivePlayingChange
4339
4621
  } = useFeedExclusivePlayback(playbackId);
4340
- const handlePlayingChange = React7__namespace.useCallback(
4622
+ const handlePlayingChange = React8__namespace.useCallback(
4341
4623
  (playing) => {
4342
4624
  onExclusivePlayingChange(playing);
4343
4625
  onPlayingChange?.(playing);
@@ -4364,8 +4646,8 @@ function FeedVideoPlayer({
4364
4646
  );
4365
4647
  }
4366
4648
  function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {}) {
4367
- const [stats, setStats] = React7__namespace.useState({});
4368
- React7__namespace.useEffect(() => {
4649
+ const [stats, setStats] = React8__namespace.useState({});
4650
+ React8__namespace.useEffect(() => {
4369
4651
  if (!statsUrl || !enabled) return;
4370
4652
  let cancelled = false;
4371
4653
  const controller = new AbortController();
@@ -4470,10 +4752,10 @@ function FileDropzone({
4470
4752
  className
4471
4753
  }) {
4472
4754
  const labels = { ...DEFAULT_FILE_DROPZONE_LABELS, ...labelOverrides };
4473
- const inputId = React7.useId();
4474
- const inputRef = React7.useRef(null);
4475
- const [dragging, setDragging] = React7.useState(false);
4476
- const [message, setMessage] = React7.useState(null);
4755
+ const inputId = React8.useId();
4756
+ const inputRef = React8.useRef(null);
4757
+ const [dragging, setDragging] = React8.useState(false);
4758
+ const [message, setMessage] = React8.useState(null);
4477
4759
  function takeFile(file) {
4478
4760
  if (!file || disabled) return;
4479
4761
  if (!fileMatchesAccept(file, accept)) {
@@ -4606,83 +4888,138 @@ function FileUploadTray({
4606
4888
  const labels = { ...DEFAULT_FILE_UPLOAD_TRAY_LABELS, ...labelOverrides };
4607
4889
  const visible = jobs.filter((job) => job.status !== "cancelled");
4608
4890
  if (visible.length === 0) return null;
4891
+ return /* @__PURE__ */ jsxRuntime.jsx("section", { "aria-label": labels.title, className: cn("grid gap-3", className), children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "grid gap-3", children: visible.map((job) => {
4892
+ const active = job.status === "uploading" || job.status === "completing";
4893
+ const canPause = job.status === "uploading";
4894
+ const canResume = job.status === "paused";
4895
+ const canCancel = job.status === "uploading" || job.status === "paused" || job.status === "error";
4896
+ return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "grid gap-1.5", children: [
4897
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
4898
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "min-w-0 flex-1 truncate text-sm font-medium", children: job.name }),
4899
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: statusLabel(job.status, labels) }),
4900
+ canPause ? /* @__PURE__ */ jsxRuntime.jsx(
4901
+ Button,
4902
+ {
4903
+ type: "button",
4904
+ variant: "ghost",
4905
+ size: "icon-sm",
4906
+ "aria-label": `${labels.pause} ${job.name}`,
4907
+ onClick: () => onPause(job.id),
4908
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pause, {})
4909
+ }
4910
+ ) : null,
4911
+ canResume ? /* @__PURE__ */ jsxRuntime.jsx(
4912
+ Button,
4913
+ {
4914
+ type: "button",
4915
+ variant: "ghost",
4916
+ size: "icon-sm",
4917
+ "aria-label": `${labels.resume} ${job.name}`,
4918
+ onClick: () => onResume(job.id),
4919
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, {})
4920
+ }
4921
+ ) : null,
4922
+ canCancel ? /* @__PURE__ */ jsxRuntime.jsx(
4923
+ Button,
4924
+ {
4925
+ type: "button",
4926
+ variant: "ghost",
4927
+ size: "icon-sm",
4928
+ "aria-label": `${labels.cancel} ${job.name}`,
4929
+ onClick: () => onCancel(job.id),
4930
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {})
4931
+ }
4932
+ ) : null
4933
+ ] }),
4934
+ /* @__PURE__ */ jsxRuntime.jsx(
4935
+ "div",
4936
+ {
4937
+ role: "progressbar",
4938
+ "aria-valuemin": 0,
4939
+ "aria-valuemax": 100,
4940
+ "aria-valuenow": job.percent,
4941
+ "aria-label": job.name,
4942
+ className: "bg-muted h-2 overflow-hidden rounded-full",
4943
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4944
+ "div",
4945
+ {
4946
+ className: cn(
4947
+ "bg-primary h-full",
4948
+ active && "motion-safe:transition-[width]"
4949
+ ),
4950
+ style: { width: `${job.percent}%` }
4951
+ }
4952
+ )
4953
+ }
4954
+ ),
4955
+ job.error ? /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", className: "text-destructive text-xs", children: job.error }) : null
4956
+ ] }, job.id);
4957
+ }) }) });
4958
+ }
4959
+ function formatActiveBadge(count) {
4960
+ return count > 9 ? "9+" : String(count);
4961
+ }
4962
+ function isActiveStatus(status) {
4963
+ return status === "uploading" || status === "paused" || status === "completing";
4964
+ }
4965
+ function FileUploadMenu({
4966
+ jobs,
4967
+ labels: labelOverrides,
4968
+ onPause,
4969
+ onResume,
4970
+ onCancel,
4971
+ open,
4972
+ onOpenChange,
4973
+ align = "end",
4974
+ className
4975
+ }) {
4976
+ const labels = { ...DEFAULT_FILE_UPLOAD_TRAY_LABELS, ...labelOverrides };
4977
+ const visible = jobs.filter((job) => job.status !== "cancelled");
4978
+ const [uncontrolledOpen, setUncontrolledOpen] = React8.useState(false);
4979
+ const isControlled = open !== void 0;
4980
+ const resolvedOpen = isControlled ? open : uncontrolledOpen;
4981
+ function setResolvedOpen(next) {
4982
+ if (!isControlled) setUncontrolledOpen(next);
4983
+ onOpenChange?.(next);
4984
+ }
4985
+ if (visible.length === 0) return null;
4986
+ const activeCount = visible.filter(
4987
+ (job) => isActiveStatus(job.status)
4988
+ ).length;
4609
4989
  return /* @__PURE__ */ jsxRuntime.jsxs(
4610
- "section",
4990
+ DropdownMenu,
4611
4991
  {
4612
- "aria-label": labels.title,
4613
- className: cn(
4614
- "bg-background/95 supports-backdrop-filter:bg-background/80 fixed right-4 bottom-4 z-40 w-[min(100%-2rem,22rem)] rounded-xl border p-3 shadow-lg backdrop-blur",
4615
- className
4616
- ),
4992
+ modal: false,
4993
+ open: resolvedOpen,
4994
+ onOpenChange: setResolvedOpen,
4617
4995
  children: [
4618
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "mb-2 text-sm font-medium", children: labels.title }),
4619
- /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "grid gap-3", children: visible.map((job) => {
4620
- const active = job.status === "uploading" || job.status === "completing";
4621
- const canPause = job.status === "uploading";
4622
- const canResume = job.status === "paused";
4623
- const canCancel = job.status === "uploading" || job.status === "paused" || job.status === "error";
4624
- return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "grid gap-1.5", children: [
4625
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
4626
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "min-w-0 flex-1 truncate text-sm font-medium", children: job.name }),
4627
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: statusLabel(job.status, labels) }),
4628
- canPause ? /* @__PURE__ */ jsxRuntime.jsx(
4629
- Button,
4630
- {
4631
- type: "button",
4632
- variant: "ghost",
4633
- size: "icon-sm",
4634
- "aria-label": `${labels.pause} ${job.name}`,
4635
- onClick: () => onPause(job.id),
4636
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pause, {})
4637
- }
4638
- ) : null,
4639
- canResume ? /* @__PURE__ */ jsxRuntime.jsx(
4640
- Button,
4641
- {
4642
- type: "button",
4643
- variant: "ghost",
4644
- size: "icon-sm",
4645
- "aria-label": `${labels.resume} ${job.name}`,
4646
- onClick: () => onResume(job.id),
4647
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, {})
4648
- }
4649
- ) : null,
4650
- canCancel ? /* @__PURE__ */ jsxRuntime.jsx(
4651
- Button,
4652
- {
4653
- type: "button",
4654
- variant: "ghost",
4655
- size: "icon-sm",
4656
- "aria-label": `${labels.cancel} ${job.name}`,
4657
- onClick: () => onCancel(job.id),
4658
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {})
4659
- }
4660
- ) : null
4661
- ] }),
4662
- /* @__PURE__ */ jsxRuntime.jsx(
4663
- "div",
4664
- {
4665
- role: "progressbar",
4666
- "aria-valuemin": 0,
4667
- "aria-valuemax": 100,
4668
- "aria-valuenow": job.percent,
4669
- "aria-label": job.name,
4670
- className: "bg-muted h-2 overflow-hidden rounded-full",
4671
- children: /* @__PURE__ */ jsxRuntime.jsx(
4672
- "div",
4673
- {
4674
- className: cn(
4675
- "bg-primary h-full",
4676
- active && "motion-safe:transition-[width]"
4677
- ),
4678
- style: { width: `${job.percent}%` }
4679
- }
4680
- )
4681
- }
4682
- ),
4683
- job.error ? /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", className: "text-destructive text-xs", children: job.error }) : null
4684
- ] }, job.id);
4685
- }) })
4996
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
4997
+ Button,
4998
+ {
4999
+ type: "button",
5000
+ variant: "ghost",
5001
+ size: "icon",
5002
+ className: cn("relative size-9", className),
5003
+ "aria-label": labels.title,
5004
+ children: [
5005
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: "size-4" }),
5006
+ activeCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-destructive text-destructive-foreground absolute -top-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full text-[10px] leading-none font-medium tabular-nums", children: formatActiveBadge(activeCount) }) : null
5007
+ ]
5008
+ }
5009
+ ) }),
5010
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align, className: "w-80 p-0", children: [
5011
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between border-b px-4 py-3", children: /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-semibold", children: labels.title }) }),
5012
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-80 overflow-y-auto p-3", children: /* @__PURE__ */ jsxRuntime.jsx(
5013
+ FileUploadTray,
5014
+ {
5015
+ jobs: visible,
5016
+ labels,
5017
+ onPause,
5018
+ onResume,
5019
+ onCancel
5020
+ }
5021
+ ) })
5022
+ ] })
4686
5023
  ]
4687
5024
  }
4688
5025
  );
@@ -4916,6 +5253,7 @@ exports.DEFAULT_EDITABLE_SECTION_LABELS = DEFAULT_EDITABLE_SECTION_LABELS;
4916
5253
  exports.DEFAULT_FILE_DROPZONE_LABELS = DEFAULT_FILE_DROPZONE_LABELS;
4917
5254
  exports.DEFAULT_FILE_UPLOAD_LABELS = DEFAULT_FILE_UPLOAD_LABELS;
4918
5255
  exports.DEFAULT_FILE_UPLOAD_TRAY_LABELS = DEFAULT_FILE_UPLOAD_TRAY_LABELS;
5256
+ exports.DEFAULT_NOTIFICATION_BELL_LABELS = DEFAULT_NOTIFICATION_BELL_LABELS;
4919
5257
  exports.DataList = DataList;
4920
5258
  exports.DataListItem = DataListItem;
4921
5259
  exports.EditableSection = EditableSection;
@@ -4930,10 +5268,12 @@ exports.ErrorState = ErrorState;
4930
5268
  exports.FeedVideoPlayer = FeedVideoPlayer;
4931
5269
  exports.FieldMessage = FieldMessage;
4932
5270
  exports.FileDropzone = FileDropzone;
5271
+ exports.FileUploadMenu = FileUploadMenu;
4933
5272
  exports.FileUploadTray = FileUploadTray;
4934
5273
  exports.LanguageContext = LanguageContext;
4935
5274
  exports.LanguageSwitcher = LanguageSwitcher;
4936
5275
  exports.LoadingState = LoadingState;
5276
+ exports.NotificationBell = NotificationBell;
4937
5277
  exports.SafeImage = SafeImage;
4938
5278
  exports.ThemeSwitcher = ThemeSwitcher;
4939
5279
  exports.VideoPlayer = VideoPlayer;