@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.js CHANGED
@@ -1,16 +1,16 @@
1
1
  "use client";
2
- import * as React7 from 'react';
2
+ import * as React8 from 'react';
3
3
  import { createContext, useContext, useState, useRef, useId, useEffect, useCallback, useLayoutEffect } from 'react';
4
- import { Loader2, AlertTriangle, Inbox, Monitor, Sun, Moon, Languages, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, X, User, Pencil, Check, Play, AlertCircle, VolumeX, Pause, Volume1, Volume2, Settings, Cast, PictureInPicture2, Minimize, Maximize, XIcon } from 'lucide-react';
4
+ import { Loader2, AlertTriangle, Inbox, Bell, Monitor, Sun, Moon, Languages, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, X, User, Pencil, Check, Play, AlertCircle, VolumeX, Pause, Volume1, Volume2, Settings, Cast, PictureInPicture2, Minimize, Maximize, XIcon } from 'lucide-react';
5
5
  import { clsx } from 'clsx';
6
6
  import { twMerge } from 'tailwind-merge';
7
7
  import { cva } from 'class-variance-authority';
8
8
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
9
  import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
10
10
  import { Slot } from '@radix-ui/react-slot';
11
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
11
12
  import { useTheme } from 'next-themes';
12
13
  import { useReducedMotion, AnimatePresence, motion } from 'framer-motion';
13
- import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
14
14
  import * as SliderPrimitive from '@radix-ui/react-slider';
15
15
  import * as TogglePrimitive from '@radix-ui/react-toggle';
16
16
  import * as DialogPrimitive from '@radix-ui/react-dialog';
@@ -417,6 +417,179 @@ function ConfirmDestructiveDialog({
417
417
  ] })
418
418
  ] }) });
419
419
  }
420
+ var miniMenuContentClassName = "max-h-none overflow-x-visible overflow-y-visible";
421
+ var miniMenuContentDefaults = {
422
+ sideOffset: 8,
423
+ collisionPadding: 12
424
+ };
425
+ function DropdownMenu({
426
+ ...props
427
+ }) {
428
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
429
+ }
430
+ function DropdownMenuTrigger({
431
+ ...props
432
+ }) {
433
+ return /* @__PURE__ */ jsx(
434
+ DropdownMenuPrimitive.Trigger,
435
+ {
436
+ "data-slot": "dropdown-menu-trigger",
437
+ ...props
438
+ }
439
+ );
440
+ }
441
+ function DropdownMenuContent({
442
+ className,
443
+ sideOffset = 4,
444
+ ...props
445
+ }) {
446
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
447
+ DropdownMenuPrimitive.Content,
448
+ {
449
+ "data-slot": "dropdown-menu-content",
450
+ sideOffset,
451
+ className: cn(
452
+ "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",
453
+ className
454
+ ),
455
+ ...props
456
+ }
457
+ ) });
458
+ }
459
+ function DropdownMenuItem({
460
+ className,
461
+ inset,
462
+ variant = "default",
463
+ ...props
464
+ }) {
465
+ return /* @__PURE__ */ jsx(
466
+ DropdownMenuPrimitive.Item,
467
+ {
468
+ "data-slot": "dropdown-menu-item",
469
+ "data-inset": inset,
470
+ "data-variant": variant,
471
+ className: cn(
472
+ "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",
473
+ className
474
+ ),
475
+ ...props
476
+ }
477
+ );
478
+ }
479
+ var DEFAULT_NOTIFICATION_BELL_LABELS = {
480
+ title: "Notifications",
481
+ empty: "You're all caught up.",
482
+ viewAll: "View all"
483
+ };
484
+ function formatUnreadBadge(count) {
485
+ return count > 9 ? "9+" : String(count);
486
+ }
487
+ function defaultFormatTime(iso) {
488
+ const date = new Date(iso);
489
+ if (Number.isNaN(date.getTime())) return iso;
490
+ return date.toLocaleString(void 0, {
491
+ dateStyle: "short",
492
+ timeStyle: "short"
493
+ });
494
+ }
495
+ function NotificationListSkeleton({ rows = 3 }) {
496
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col", "aria-hidden": "true", children: Array.from({ length: rows }, (_, index) => /* @__PURE__ */ jsxs("div", { children: [
497
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2 px-4 py-3", children: [
498
+ /* @__PURE__ */ jsx(
499
+ "div",
500
+ {
501
+ "data-slot": "skeleton",
502
+ className: "bg-muted h-4 w-36 animate-pulse rounded-md motion-reduce:animate-none"
503
+ }
504
+ ),
505
+ /* @__PURE__ */ jsx(
506
+ "div",
507
+ {
508
+ "data-slot": "skeleton",
509
+ className: "bg-muted h-3 w-full animate-pulse rounded-md motion-reduce:animate-none"
510
+ }
511
+ ),
512
+ /* @__PURE__ */ jsx(
513
+ "div",
514
+ {
515
+ "data-slot": "skeleton",
516
+ className: "bg-muted h-3 w-20 animate-pulse rounded-md motion-reduce:animate-none"
517
+ }
518
+ )
519
+ ] }),
520
+ index < rows - 1 ? /* @__PURE__ */ jsx("div", { className: "bg-border h-px" }) : null
521
+ ] }, index)) });
522
+ }
523
+ function NotificationBell({
524
+ items,
525
+ unreadCount,
526
+ isLoading = false,
527
+ labels: labelOverrides,
528
+ viewAllHref,
529
+ formatTime: formatTime2 = defaultFormatTime,
530
+ onOpenChange,
531
+ align = "end",
532
+ className
533
+ }) {
534
+ const labels = { ...DEFAULT_NOTIFICATION_BELL_LABELS, ...labelOverrides };
535
+ return /* @__PURE__ */ jsxs(DropdownMenu, { modal: false, onOpenChange, children: [
536
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
537
+ Button,
538
+ {
539
+ type: "button",
540
+ variant: "ghost",
541
+ size: "icon",
542
+ className: cn("relative size-9", className),
543
+ "aria-label": labels.title,
544
+ children: [
545
+ /* @__PURE__ */ jsx(Bell, { className: "size-4" }),
546
+ unreadCount > 0 ? /* @__PURE__ */ 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
547
+ ]
548
+ }
549
+ ) }),
550
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { align, className: "w-80 p-0", children: [
551
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between border-b px-4 py-3", children: /* @__PURE__ */ jsx("h4", { className: "font-semibold", children: labels.title }) }),
552
+ /* @__PURE__ */ jsx("div", { className: "max-h-80 overflow-y-auto", children: isLoading ? /* @__PURE__ */ jsx(NotificationListSkeleton, {}) : items.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground px-4 py-8 text-center text-sm", children: labels.empty }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: items.map((item, index) => {
553
+ const body = /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-1", children: [
554
+ /* @__PURE__ */ jsx("p", { className: "text-sm leading-none font-medium", children: item.title }),
555
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground line-clamp-2 text-xs", children: item.message }),
556
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground/70 text-xs", children: formatTime2(item.createdAt) })
557
+ ] });
558
+ return /* @__PURE__ */ jsxs("div", { children: [
559
+ item.href ? /* @__PURE__ */ jsx(
560
+ "a",
561
+ {
562
+ href: item.href,
563
+ className: cn(
564
+ "hover:bg-muted/50 flex gap-3 px-4 py-3 motion-safe:transition-colors",
565
+ !item.read && "bg-muted/30"
566
+ ),
567
+ children: body
568
+ }
569
+ ) : /* @__PURE__ */ jsx(
570
+ "div",
571
+ {
572
+ className: cn(
573
+ "flex gap-3 px-4 py-3",
574
+ !item.read && "bg-muted/30"
575
+ ),
576
+ children: body
577
+ }
578
+ ),
579
+ index < items.length - 1 ? /* @__PURE__ */ jsx("div", { className: "bg-border h-px" }) : null
580
+ ] }, item.id);
581
+ }) }) }),
582
+ /* @__PURE__ */ jsx("div", { className: "border-t px-4 py-2", children: /* @__PURE__ */ jsx(
583
+ "a",
584
+ {
585
+ href: viewAllHref,
586
+ className: "text-primary block text-center text-sm font-medium hover:underline",
587
+ children: labels.viewAll
588
+ }
589
+ ) })
590
+ ] })
591
+ ] });
592
+ }
420
593
 
421
594
  // src/components/editable/types.ts
422
595
  var DEFAULT_EDITABLE_SECTION_LABELS = {
@@ -798,65 +971,6 @@ function SafeImage({
798
971
  }
799
972
  );
800
973
  }
801
- var miniMenuContentClassName = "max-h-none overflow-x-visible overflow-y-visible";
802
- var miniMenuContentDefaults = {
803
- sideOffset: 8,
804
- collisionPadding: 12
805
- };
806
- function DropdownMenu({
807
- ...props
808
- }) {
809
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
810
- }
811
- function DropdownMenuTrigger({
812
- ...props
813
- }) {
814
- return /* @__PURE__ */ jsx(
815
- DropdownMenuPrimitive.Trigger,
816
- {
817
- "data-slot": "dropdown-menu-trigger",
818
- ...props
819
- }
820
- );
821
- }
822
- function DropdownMenuContent({
823
- className,
824
- sideOffset = 4,
825
- ...props
826
- }) {
827
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
828
- DropdownMenuPrimitive.Content,
829
- {
830
- "data-slot": "dropdown-menu-content",
831
- sideOffset,
832
- className: cn(
833
- "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",
834
- className
835
- ),
836
- ...props
837
- }
838
- ) });
839
- }
840
- function DropdownMenuItem({
841
- className,
842
- inset,
843
- variant = "default",
844
- ...props
845
- }) {
846
- return /* @__PURE__ */ jsx(
847
- DropdownMenuPrimitive.Item,
848
- {
849
- "data-slot": "dropdown-menu-item",
850
- "data-inset": inset,
851
- "data-variant": variant,
852
- className: cn(
853
- "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",
854
- className
855
- ),
856
- ...props
857
- }
858
- );
859
- }
860
974
  var defaultLabels = {
861
975
  theme: "Theme",
862
976
  system: "System",
@@ -1196,7 +1310,7 @@ function Slider({
1196
1310
  max = 100,
1197
1311
  ...props
1198
1312
  }) {
1199
- const _values = React7.useMemo(
1313
+ const _values = React8.useMemo(
1200
1314
  () => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
1201
1315
  [value, defaultValue, min, max]
1202
1316
  );
@@ -2264,8 +2378,8 @@ function probeVideoAudio(el) {
2264
2378
  return "unknown";
2265
2379
  }
2266
2380
  function usePrefersReducedMotion() {
2267
- const [reduced, setReduced] = React7.useState(false);
2268
- React7.useEffect(() => {
2381
+ const [reduced, setReduced] = React8.useState(false);
2382
+ React8.useEffect(() => {
2269
2383
  const media = window.matchMedia("(prefers-reduced-motion: reduce)");
2270
2384
  const sync = () => setReduced(media.matches);
2271
2385
  sync();
@@ -2282,11 +2396,11 @@ function CurtainVideo({
2282
2396
  allowSound,
2283
2397
  labels
2284
2398
  }) {
2285
- const videoRef = React7.useRef(null);
2286
- const [playback, setPlayback] = React7.useState("pending");
2287
- const [muted, setMuted] = React7.useState(true);
2288
- const [audio, setAudio] = React7.useState("unknown");
2289
- React7.useEffect(() => {
2399
+ const videoRef = React8.useRef(null);
2400
+ const [playback, setPlayback] = React8.useState("pending");
2401
+ const [muted, setMuted] = React8.useState(true);
2402
+ const [audio, setAudio] = React8.useState("unknown");
2403
+ React8.useEffect(() => {
2290
2404
  const el = videoRef.current;
2291
2405
  if (!el) return;
2292
2406
  el.setAttribute("webkit-playsinline", "");
@@ -2327,7 +2441,7 @@ function CurtainVideo({
2327
2441
  el.removeEventListener("loadedmetadata", applyAudio);
2328
2442
  };
2329
2443
  }, [url, freeze]);
2330
- const startPlayback = React7.useCallback(() => {
2444
+ const startPlayback = React8.useCallback(() => {
2331
2445
  const el = videoRef.current;
2332
2446
  if (!el) return;
2333
2447
  el.muted = true;
@@ -2343,7 +2457,7 @@ function CurtainVideo({
2343
2457
  }
2344
2458
  );
2345
2459
  }, []);
2346
- const setVideoMuted = React7.useCallback((next) => {
2460
+ const setVideoMuted = React8.useCallback((next) => {
2347
2461
  const el = videoRef.current;
2348
2462
  if (el) el.muted = next;
2349
2463
  setMuted(next);
@@ -2450,9 +2564,9 @@ function isVideoKind(kind) {
2450
2564
  return kind === "video";
2451
2565
  }
2452
2566
  function useElementInView(enabled) {
2453
- const [node, setNode] = React7.useState(null);
2454
- const [inView, setInView] = React7.useState(false);
2455
- React7.useEffect(() => {
2567
+ const [node, setNode] = React8.useState(null);
2568
+ const [inView, setInView] = React8.useState(false);
2569
+ React8.useEffect(() => {
2456
2570
  if (!enabled || !node || typeof IntersectionObserver === "undefined") {
2457
2571
  setInView(false);
2458
2572
  return;
@@ -2624,7 +2738,7 @@ function CurtainPicker({
2624
2738
  actionsPending = false
2625
2739
  }) {
2626
2740
  const copy = { ...DEFAULT_CURTAIN_PICKER_LABELS, ...labels };
2627
- const groupName = React7.useId();
2741
+ const groupName = React8.useId();
2628
2742
  const selectable = typeof onChange === "function";
2629
2743
  const compact = variant === "compact";
2630
2744
  const selectedId = value === "" ? null : value ?? null;
@@ -2640,7 +2754,7 @@ function CurtainPicker({
2640
2754
  canMakeDefault,
2641
2755
  canDelete
2642
2756
  ) : {};
2643
- const grouped = React7.useMemo(() => {
2757
+ const grouped = React8.useMemo(() => {
2644
2758
  if (!groupByOwner) {
2645
2759
  return [{ group: null, items: ready }];
2646
2760
  }
@@ -2965,8 +3079,8 @@ function WaitingRoom({
2965
3079
  labels,
2966
3080
  className
2967
3081
  }) {
2968
- const [now, setNow] = React7.useState(nowMs ?? Date.now());
2969
- React7.useEffect(() => {
3082
+ const [now, setNow] = React8.useState(nowMs ?? Date.now());
3083
+ React8.useEffect(() => {
2970
3084
  if (nowMs != null) {
2971
3085
  setNow(nowMs);
2972
3086
  return;
@@ -3061,6 +3175,187 @@ async function castHlsUrl(hlsUrl) {
3061
3175
  await session.loadMedia(request);
3062
3176
  }
3063
3177
 
3178
+ // src/components/video/seekPreview.ts
3179
+ var XYWH_RE = /#xywh=(\d+),(\d+),(\d+),(\d+)\s*$/;
3180
+ function thumbnailsVttUrlFromPlayback(src) {
3181
+ const trimmed = src.trim();
3182
+ if (!trimmed) return null;
3183
+ const replaced = trimmed.replace(
3184
+ /index\.m3u8(?:\?.*)?$/i,
3185
+ "thumbs/preview.vtt"
3186
+ );
3187
+ if (replaced === trimmed) return null;
3188
+ return replaced;
3189
+ }
3190
+ function parseVttTimestamp(value) {
3191
+ const parts = value.trim().split(":");
3192
+ if (parts.length === 3) {
3193
+ const hours = Number(parts[0]);
3194
+ const minutes = Number(parts[1]);
3195
+ const seconds2 = Number(parts[2]);
3196
+ if ([hours, minutes, seconds2].some((n) => Number.isNaN(n))) return 0;
3197
+ return hours * 3600 + minutes * 60 + seconds2;
3198
+ }
3199
+ if (parts.length === 2) {
3200
+ const minutes = Number(parts[0]);
3201
+ const seconds2 = Number(parts[1]);
3202
+ if ([minutes, seconds2].some((n) => Number.isNaN(n))) return 0;
3203
+ return minutes * 60 + seconds2;
3204
+ }
3205
+ const seconds = Number(value);
3206
+ return Number.isFinite(seconds) ? seconds : 0;
3207
+ }
3208
+ function parseThumbnailsVtt(text, vttUrl) {
3209
+ const cues = [];
3210
+ const blocks = text.replace(/^\uFEFF?WEBVTT[^\n]*\n/i, "").split(/\n\s*\n/);
3211
+ for (const block of blocks) {
3212
+ const lines = block.split("\n").map((line) => line.trim()).filter(Boolean);
3213
+ const timing = lines.find((line) => line.includes("-->"));
3214
+ const payload = lines.find((line) => XYWH_RE.test(line));
3215
+ if (!timing || !payload) continue;
3216
+ const [startRaw, endRaw] = timing.split("-->").map((part) => part.trim());
3217
+ const match = payload.match(XYWH_RE);
3218
+ if (!startRaw || !endRaw || !match) continue;
3219
+ const spriteName = payload.slice(0, match.index);
3220
+ cues.push({
3221
+ start: parseVttTimestamp(startRaw),
3222
+ end: parseVttTimestamp(endRaw),
3223
+ spriteUrl: new URL(spriteName, vttUrl).toString(),
3224
+ x: Number(match[1]),
3225
+ y: Number(match[2]),
3226
+ width: Number(match[3]),
3227
+ height: Number(match[4])
3228
+ });
3229
+ }
3230
+ return cues;
3231
+ }
3232
+ function cueAtTime(cues, time) {
3233
+ if (cues.length === 0) return null;
3234
+ const hit = cues.find((cue) => time >= cue.start && time < cue.end);
3235
+ if (hit) return hit;
3236
+ const last = cues[cues.length - 1];
3237
+ if (last && time >= last.start) return last;
3238
+ return cues[0] ?? null;
3239
+ }
3240
+ function hoverTimeFromClientX(clientX, rect, duration) {
3241
+ if (rect.width <= 0 || duration <= 0) return 0;
3242
+ const ratio = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width));
3243
+ return ratio * duration;
3244
+ }
3245
+ async function loadThumbnailsVtt(src) {
3246
+ const vttUrl = thumbnailsVttUrlFromPlayback(src);
3247
+ if (!vttUrl) return [];
3248
+ try {
3249
+ const response = await fetch(vttUrl);
3250
+ if (!response.ok) return [];
3251
+ const text = await response.text();
3252
+ return parseThumbnailsVtt(text, vttUrl);
3253
+ } catch {
3254
+ return [];
3255
+ }
3256
+ }
3257
+ function SeekBar({
3258
+ src,
3259
+ duration,
3260
+ currentTime,
3261
+ buffered,
3262
+ onSeek,
3263
+ formatTime: formatTime2
3264
+ }) {
3265
+ const trackRef = React8.useRef(null);
3266
+ const [hoverTime, setHoverTime] = React8.useState(null);
3267
+ const [cues, setCues] = React8.useState(null);
3268
+ const loadedSrc = React8.useRef(null);
3269
+ React8.useEffect(() => {
3270
+ setCues(null);
3271
+ loadedSrc.current = null;
3272
+ }, [src]);
3273
+ const ensureCues = React8.useCallback(() => {
3274
+ if (loadedSrc.current === src) return;
3275
+ loadedSrc.current = src;
3276
+ void loadThumbnailsVtt(src).then((next) => {
3277
+ setCues(next);
3278
+ });
3279
+ }, [src]);
3280
+ const updateHover = React8.useCallback(
3281
+ (clientX) => {
3282
+ const rect = trackRef.current?.getBoundingClientRect();
3283
+ if (!rect) return;
3284
+ setHoverTime(hoverTimeFromClientX(clientX, rect, duration));
3285
+ },
3286
+ [duration]
3287
+ );
3288
+ const cue = hoverTime !== null && cues && cues.length > 0 ? cueAtTime(cues, hoverTime) : null;
3289
+ const hoverPercent = hoverTime !== null && duration > 0 ? Math.min(100, Math.max(0, hoverTime / duration * 100)) : 0;
3290
+ return /* @__PURE__ */ jsxs(
3291
+ "div",
3292
+ {
3293
+ ref: trackRef,
3294
+ className: "relative w-full",
3295
+ onPointerEnter: ensureCues,
3296
+ onPointerDown: (event) => {
3297
+ ensureCues();
3298
+ updateHover(event.clientX);
3299
+ },
3300
+ onPointerMove: (event) => {
3301
+ ensureCues();
3302
+ updateHover(event.clientX);
3303
+ },
3304
+ onPointerLeave: () => setHoverTime(null),
3305
+ onPointerUp: () => setHoverTime(null),
3306
+ children: [
3307
+ hoverTime !== null ? /* @__PURE__ */ jsxs(
3308
+ "div",
3309
+ {
3310
+ className: "pointer-events-none absolute bottom-full mb-2 flex flex-col items-center gap-1",
3311
+ style: { left: `${hoverPercent}%`, transform: "translateX(-50%)" },
3312
+ "data-slot": "seek-preview",
3313
+ children: [
3314
+ cue ? /* @__PURE__ */ jsx(
3315
+ "div",
3316
+ {
3317
+ "aria-hidden": "true",
3318
+ className: "overflow-hidden rounded border border-white/20 bg-black shadow-md",
3319
+ style: {
3320
+ width: cue.width,
3321
+ height: cue.height,
3322
+ backgroundImage: `url(${cue.spriteUrl})`,
3323
+ backgroundPosition: `-${cue.x}px -${cue.y}px`,
3324
+ backgroundRepeat: "no-repeat"
3325
+ }
3326
+ }
3327
+ ) : null,
3328
+ /* @__PURE__ */ jsx("span", { className: "rounded-full bg-black/80 px-1.5 py-0.5 text-[10px] tabular-nums text-white", children: formatTime2(hoverTime) })
3329
+ ]
3330
+ }
3331
+ ) : null,
3332
+ /* @__PURE__ */ jsx(
3333
+ Slider,
3334
+ {
3335
+ "aria-label": "Seek",
3336
+ min: 0,
3337
+ max: duration || 0,
3338
+ step: 0.1,
3339
+ value: [Math.min(currentTime, duration || 0)],
3340
+ onValueChange: (value) => onSeek(value[0] ?? 0),
3341
+ className: "w-full"
3342
+ }
3343
+ ),
3344
+ duration > 0 && buffered > currentTime ? /* @__PURE__ */ jsx(
3345
+ "span",
3346
+ {
3347
+ "aria-hidden": "true",
3348
+ className: "pointer-events-none absolute top-1/2 left-0 h-1.5 -translate-y-1/2 rounded-full bg-white/25",
3349
+ style: {
3350
+ width: `${Math.min(buffered / duration * 100, 100)}%`
3351
+ }
3352
+ }
3353
+ ) : null
3354
+ ]
3355
+ }
3356
+ );
3357
+ }
3358
+
3064
3359
  // src/components/video/hls-config.ts
3065
3360
  function shouldRetryLiveEdge404(retryConfig, retryCount, _isTimeout, loaderResponse, defaultRetry) {
3066
3361
  if (loaderResponse?.code === 404) {
@@ -3239,27 +3534,27 @@ function useHlsPlayback({
3239
3534
  onError,
3240
3535
  onPlayingChange
3241
3536
  }) {
3242
- const videoRef = React7.useRef(null);
3243
- const hlsRef = React7.useRef(null);
3244
- const [state, setState] = React7.useState("idle");
3245
- const [qualities, setQualities] = React7.useState([]);
3246
- const [activeLevel, setActiveLevel] = React7.useState(-1);
3247
- const [autoplayState, setAutoplayState] = React7.useState("none");
3248
- const [error, setError] = React7.useState(null);
3249
- const [reloadKey, setReloadKey] = React7.useState(0);
3250
- const onErrorRef = React7.useRef(onError);
3251
- const onPlayingChangeRef = React7.useRef(onPlayingChange);
3252
- React7.useEffect(() => {
3537
+ const videoRef = React8.useRef(null);
3538
+ const hlsRef = React8.useRef(null);
3539
+ const [state, setState] = React8.useState("idle");
3540
+ const [qualities, setQualities] = React8.useState([]);
3541
+ const [activeLevel, setActiveLevel] = React8.useState(-1);
3542
+ const [autoplayState, setAutoplayState] = React8.useState("none");
3543
+ const [error, setError] = React8.useState(null);
3544
+ const [reloadKey, setReloadKey] = React8.useState(0);
3545
+ const onErrorRef = React8.useRef(onError);
3546
+ const onPlayingChangeRef = React8.useRef(onPlayingChange);
3547
+ React8.useEffect(() => {
3253
3548
  onErrorRef.current = onError;
3254
3549
  onPlayingChangeRef.current = onPlayingChange;
3255
3550
  }, [onError, onPlayingChange]);
3256
- const retry = React7.useCallback(() => {
3551
+ const retry = React8.useCallback(() => {
3257
3552
  setError(null);
3258
3553
  setState("loading");
3259
3554
  setAutoplayState("none");
3260
3555
  setReloadKey((k) => k + 1);
3261
3556
  }, []);
3262
- React7.useEffect(() => {
3557
+ React8.useEffect(() => {
3263
3558
  const media = videoRef.current;
3264
3559
  if (!media || !src || !active) {
3265
3560
  setState("idle");
@@ -3529,7 +3824,7 @@ function useHlsPlayback({
3529
3824
  destroyHls();
3530
3825
  };
3531
3826
  }, [src, mode, active, autoPlay, muted, reloadKey]);
3532
- const setLevel = React7.useCallback((index) => {
3827
+ const setLevel = React8.useCallback((index) => {
3533
3828
  const hls = hlsRef.current;
3534
3829
  if (!hls) return;
3535
3830
  hls.nextLevel = index;
@@ -3615,12 +3910,12 @@ function VideoPlayer({
3615
3910
  className
3616
3911
  }) {
3617
3912
  const t = { ...DEFAULT_LABELS3, ...labels };
3618
- const containerRef = React7.useRef(null);
3619
- const firstPlayFiredRef = React7.useRef(false);
3620
- const [userStarted, setUserStarted] = React7.useState(false);
3913
+ const containerRef = React8.useRef(null);
3914
+ const firstPlayFiredRef = React8.useRef(false);
3915
+ const [userStarted, setUserStarted] = React8.useState(false);
3621
3916
  const active = autoPlay || !poster || userStarted;
3622
3917
  const autoplayActive = autoPlay || userStarted;
3623
- const handlePlayingChange = React7.useCallback(
3918
+ const handlePlayingChange = React8.useCallback(
3624
3919
  (playing) => {
3625
3920
  setIsPlaying(playing);
3626
3921
  if (playing && !firstPlayFiredRef.current) {
@@ -3649,25 +3944,25 @@ function VideoPlayer({
3649
3944
  onError,
3650
3945
  onPlayingChange: handlePlayingChange
3651
3946
  });
3652
- const [isPlaying, setIsPlaying] = React7.useState(false);
3653
- const [isMuted, setIsMuted] = React7.useState(muted);
3654
- const [volume, setVolume] = React7.useState(1);
3655
- const [currentTime, setCurrentTime] = React7.useState(0);
3656
- const [duration, setDuration] = React7.useState(0);
3657
- const [buffered, setBuffered] = React7.useState(0);
3658
- const [isFullscreen, setIsFullscreen] = React7.useState(false);
3659
- const [pipActive, setPipActive] = React7.useState(false);
3660
- const [controlsVisible, setControlsVisible] = React7.useState(true);
3661
- const [playbackRate, setPlaybackRate] = React7.useState(1);
3662
- const [openMenu, setOpenMenu] = React7.useState(
3947
+ const [isPlaying, setIsPlaying] = React8.useState(false);
3948
+ const [isMuted, setIsMuted] = React8.useState(muted);
3949
+ const [volume, setVolume] = React8.useState(1);
3950
+ const [currentTime, setCurrentTime] = React8.useState(0);
3951
+ const [duration, setDuration] = React8.useState(0);
3952
+ const [buffered, setBuffered] = React8.useState(0);
3953
+ const [isFullscreen, setIsFullscreen] = React8.useState(false);
3954
+ const [pipActive, setPipActive] = React8.useState(false);
3955
+ const [controlsVisible, setControlsVisible] = React8.useState(true);
3956
+ const [playbackRate, setPlaybackRate] = React8.useState(1);
3957
+ const [openMenu, setOpenMenu] = React8.useState(
3663
3958
  null
3664
3959
  );
3665
- const [behindLive, setBehindLive] = React7.useState(false);
3666
- const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React7.useState(false);
3667
- const hideTimerRef = React7.useRef(null);
3960
+ const [behindLive, setBehindLive] = React8.useState(false);
3961
+ const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React8.useState(false);
3962
+ const hideTimerRef = React8.useRef(null);
3668
3963
  const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
3669
3964
  const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported;
3670
- React7.useEffect(() => {
3965
+ React8.useEffect(() => {
3671
3966
  const video = videoRef.current;
3672
3967
  if (!video || !active) return;
3673
3968
  const onTimeUpdate = () => {
@@ -3700,21 +3995,21 @@ function VideoPlayer({
3700
3995
  video.removeEventListener("ratechange", onRate);
3701
3996
  };
3702
3997
  }, [videoRef, active, mode]);
3703
- React7.useEffect(() => {
3998
+ React8.useEffect(() => {
3704
3999
  const video = videoRef.current;
3705
4000
  if (!paused || !video || !isPlaying) return;
3706
4001
  video.pause();
3707
4002
  }, [paused, videoRef, isPlaying]);
3708
- React7.useEffect(() => {
4003
+ React8.useEffect(() => {
3709
4004
  setWebkitFullscreenSupported(hasWebkitVideoFullscreen(videoRef.current));
3710
4005
  videoRef.current?.setAttribute("x-webkit-airplay", "allow");
3711
4006
  }, [videoRef, active]);
3712
- React7.useEffect(() => {
4007
+ React8.useEffect(() => {
3713
4008
  const onFsChange = () => setIsFullscreen(document.fullscreenElement === containerRef.current);
3714
4009
  document.addEventListener("fullscreenchange", onFsChange);
3715
4010
  return () => document.removeEventListener("fullscreenchange", onFsChange);
3716
4011
  }, []);
3717
- React7.useEffect(() => {
4012
+ React8.useEffect(() => {
3718
4013
  const video = asWebkitVideo(videoRef.current);
3719
4014
  if (!video) return;
3720
4015
  const onBegin = () => setIsFullscreen(true);
@@ -3726,7 +4021,7 @@ function VideoPlayer({
3726
4021
  video.removeEventListener("webkitendfullscreen", onEnd);
3727
4022
  };
3728
4023
  }, [videoRef, active]);
3729
- React7.useEffect(() => {
4024
+ React8.useEffect(() => {
3730
4025
  const video = videoRef.current;
3731
4026
  if (!video) return;
3732
4027
  const onEnter = () => setPipActive(true);
@@ -3738,18 +4033,18 @@ function VideoPlayer({
3738
4033
  video.removeEventListener("leavepictureinpicture", onLeave);
3739
4034
  };
3740
4035
  }, [videoRef]);
3741
- const scheduleHide = React7.useCallback(() => {
4036
+ const scheduleHide = React8.useCallback(() => {
3742
4037
  if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
3743
4038
  hideTimerRef.current = setTimeout(() => {
3744
4039
  setControlsVisible(false);
3745
4040
  setOpenMenu(null);
3746
4041
  }, CONTROLS_HIDE_MS);
3747
4042
  }, []);
3748
- const revealControls = React7.useCallback(() => {
4043
+ const revealControls = React8.useCallback(() => {
3749
4044
  setControlsVisible(true);
3750
4045
  scheduleHide();
3751
4046
  }, [scheduleHide]);
3752
- React7.useEffect(() => {
4047
+ React8.useEffect(() => {
3753
4048
  return () => {
3754
4049
  if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
3755
4050
  };
@@ -3991,30 +4286,17 @@ function VideoPlayer({
3991
4286
  ),
3992
4287
  "data-slot": "video-controls",
3993
4288
  children: [
3994
- mode === "vod" && /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
3995
- /* @__PURE__ */ jsx(
3996
- Slider,
3997
- {
3998
- "aria-label": "Seek",
3999
- min: 0,
4000
- max: duration || 0,
4001
- step: 0.1,
4002
- value: [Math.min(currentTime, duration || 0)],
4003
- onValueChange: (v) => seekTo(v[0] ?? 0),
4004
- className: "w-full"
4005
- }
4006
- ),
4007
- duration > 0 && buffered > currentTime && /* @__PURE__ */ jsx(
4008
- "span",
4009
- {
4010
- "aria-hidden": "true",
4011
- className: "pointer-events-none absolute top-1/2 left-0 h-1.5 -translate-y-1/2 rounded-full bg-white/25",
4012
- style: {
4013
- width: `${Math.min(buffered / duration * 100, 100)}%`
4014
- }
4015
- }
4016
- )
4017
- ] }),
4289
+ mode === "vod" && /* @__PURE__ */ jsx(
4290
+ SeekBar,
4291
+ {
4292
+ src,
4293
+ duration,
4294
+ currentTime,
4295
+ buffered,
4296
+ onSeek: seekTo,
4297
+ formatTime
4298
+ }
4299
+ ),
4018
4300
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4019
4301
  /* @__PURE__ */ jsx(
4020
4302
  ControlButton,
@@ -4252,16 +4534,16 @@ function videoInPictureInPicture(container) {
4252
4534
  return container.contains(pip);
4253
4535
  }
4254
4536
  function useFeedExclusivePlayback(playbackId) {
4255
- const containerRef = React7.useRef(null);
4256
- const [forcePaused, setForcePaused] = React7.useState(false);
4257
- const requestPause = React7.useCallback(() => {
4537
+ const containerRef = React8.useRef(null);
4538
+ const [forcePaused, setForcePaused] = React8.useState(false);
4539
+ const requestPause = React8.useCallback(() => {
4258
4540
  if (videoInPictureInPicture(containerRef.current)) return;
4259
4541
  setForcePaused(true);
4260
4542
  }, []);
4261
- React7.useEffect(() => {
4543
+ React8.useEffect(() => {
4262
4544
  return registerFeedPlayer(playbackId, requestPause);
4263
4545
  }, [playbackId, requestPause]);
4264
- React7.useEffect(() => {
4546
+ React8.useEffect(() => {
4265
4547
  const node = containerRef.current;
4266
4548
  if (!node || typeof IntersectionObserver === "undefined") return;
4267
4549
  const observer = new IntersectionObserver(
@@ -4277,14 +4559,14 @@ function useFeedExclusivePlayback(playbackId) {
4277
4559
  observer.observe(node);
4278
4560
  return () => observer.disconnect();
4279
4561
  }, [requestPause]);
4280
- React7.useEffect(() => {
4562
+ React8.useEffect(() => {
4281
4563
  const onVisibility = () => {
4282
4564
  if (document.hidden) requestPause();
4283
4565
  };
4284
4566
  document.addEventListener("visibilitychange", onVisibility);
4285
4567
  return () => document.removeEventListener("visibilitychange", onVisibility);
4286
4568
  }, [requestPause]);
4287
- const onPlayingChange = React7.useCallback(
4569
+ const onPlayingChange = React8.useCallback(
4288
4570
  (playing) => {
4289
4571
  if (!playing) return;
4290
4572
  setForcePaused(false);
@@ -4311,7 +4593,7 @@ function FeedVideoPlayer({
4311
4593
  paused: exclusivePaused,
4312
4594
  onPlayingChange: onExclusivePlayingChange
4313
4595
  } = useFeedExclusivePlayback(playbackId);
4314
- const handlePlayingChange = React7.useCallback(
4596
+ const handlePlayingChange = React8.useCallback(
4315
4597
  (playing) => {
4316
4598
  onExclusivePlayingChange(playing);
4317
4599
  onPlayingChange?.(playing);
@@ -4338,8 +4620,8 @@ function FeedVideoPlayer({
4338
4620
  );
4339
4621
  }
4340
4622
  function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {}) {
4341
- const [stats, setStats] = React7.useState({});
4342
- React7.useEffect(() => {
4623
+ const [stats, setStats] = React8.useState({});
4624
+ React8.useEffect(() => {
4343
4625
  if (!statsUrl || !enabled) return;
4344
4626
  let cancelled = false;
4345
4627
  const controller = new AbortController();
@@ -4580,83 +4862,138 @@ function FileUploadTray({
4580
4862
  const labels = { ...DEFAULT_FILE_UPLOAD_TRAY_LABELS, ...labelOverrides };
4581
4863
  const visible = jobs.filter((job) => job.status !== "cancelled");
4582
4864
  if (visible.length === 0) return null;
4865
+ return /* @__PURE__ */ jsx("section", { "aria-label": labels.title, className: cn("grid gap-3", className), children: /* @__PURE__ */ jsx("ul", { className: "grid gap-3", children: visible.map((job) => {
4866
+ const active = job.status === "uploading" || job.status === "completing";
4867
+ const canPause = job.status === "uploading";
4868
+ const canResume = job.status === "paused";
4869
+ const canCancel = job.status === "uploading" || job.status === "paused" || job.status === "error";
4870
+ return /* @__PURE__ */ jsxs("li", { className: "grid gap-1.5", children: [
4871
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4872
+ /* @__PURE__ */ jsx("p", { className: "min-w-0 flex-1 truncate text-sm font-medium", children: job.name }),
4873
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: statusLabel(job.status, labels) }),
4874
+ canPause ? /* @__PURE__ */ jsx(
4875
+ Button,
4876
+ {
4877
+ type: "button",
4878
+ variant: "ghost",
4879
+ size: "icon-sm",
4880
+ "aria-label": `${labels.pause} ${job.name}`,
4881
+ onClick: () => onPause(job.id),
4882
+ children: /* @__PURE__ */ jsx(Pause, {})
4883
+ }
4884
+ ) : null,
4885
+ canResume ? /* @__PURE__ */ jsx(
4886
+ Button,
4887
+ {
4888
+ type: "button",
4889
+ variant: "ghost",
4890
+ size: "icon-sm",
4891
+ "aria-label": `${labels.resume} ${job.name}`,
4892
+ onClick: () => onResume(job.id),
4893
+ children: /* @__PURE__ */ jsx(Play, {})
4894
+ }
4895
+ ) : null,
4896
+ canCancel ? /* @__PURE__ */ jsx(
4897
+ Button,
4898
+ {
4899
+ type: "button",
4900
+ variant: "ghost",
4901
+ size: "icon-sm",
4902
+ "aria-label": `${labels.cancel} ${job.name}`,
4903
+ onClick: () => onCancel(job.id),
4904
+ children: /* @__PURE__ */ jsx(X, {})
4905
+ }
4906
+ ) : null
4907
+ ] }),
4908
+ /* @__PURE__ */ jsx(
4909
+ "div",
4910
+ {
4911
+ role: "progressbar",
4912
+ "aria-valuemin": 0,
4913
+ "aria-valuemax": 100,
4914
+ "aria-valuenow": job.percent,
4915
+ "aria-label": job.name,
4916
+ className: "bg-muted h-2 overflow-hidden rounded-full",
4917
+ children: /* @__PURE__ */ jsx(
4918
+ "div",
4919
+ {
4920
+ className: cn(
4921
+ "bg-primary h-full",
4922
+ active && "motion-safe:transition-[width]"
4923
+ ),
4924
+ style: { width: `${job.percent}%` }
4925
+ }
4926
+ )
4927
+ }
4928
+ ),
4929
+ job.error ? /* @__PURE__ */ jsx("p", { role: "alert", className: "text-destructive text-xs", children: job.error }) : null
4930
+ ] }, job.id);
4931
+ }) }) });
4932
+ }
4933
+ function formatActiveBadge(count) {
4934
+ return count > 9 ? "9+" : String(count);
4935
+ }
4936
+ function isActiveStatus(status) {
4937
+ return status === "uploading" || status === "paused" || status === "completing";
4938
+ }
4939
+ function FileUploadMenu({
4940
+ jobs,
4941
+ labels: labelOverrides,
4942
+ onPause,
4943
+ onResume,
4944
+ onCancel,
4945
+ open,
4946
+ onOpenChange,
4947
+ align = "end",
4948
+ className
4949
+ }) {
4950
+ const labels = { ...DEFAULT_FILE_UPLOAD_TRAY_LABELS, ...labelOverrides };
4951
+ const visible = jobs.filter((job) => job.status !== "cancelled");
4952
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
4953
+ const isControlled = open !== void 0;
4954
+ const resolvedOpen = isControlled ? open : uncontrolledOpen;
4955
+ function setResolvedOpen(next) {
4956
+ if (!isControlled) setUncontrolledOpen(next);
4957
+ onOpenChange?.(next);
4958
+ }
4959
+ if (visible.length === 0) return null;
4960
+ const activeCount = visible.filter(
4961
+ (job) => isActiveStatus(job.status)
4962
+ ).length;
4583
4963
  return /* @__PURE__ */ jsxs(
4584
- "section",
4964
+ DropdownMenu,
4585
4965
  {
4586
- "aria-label": labels.title,
4587
- className: cn(
4588
- "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",
4589
- className
4590
- ),
4966
+ modal: false,
4967
+ open: resolvedOpen,
4968
+ onOpenChange: setResolvedOpen,
4591
4969
  children: [
4592
- /* @__PURE__ */ jsx("h2", { className: "mb-2 text-sm font-medium", children: labels.title }),
4593
- /* @__PURE__ */ jsx("ul", { className: "grid gap-3", children: visible.map((job) => {
4594
- const active = job.status === "uploading" || job.status === "completing";
4595
- const canPause = job.status === "uploading";
4596
- const canResume = job.status === "paused";
4597
- const canCancel = job.status === "uploading" || job.status === "paused" || job.status === "error";
4598
- return /* @__PURE__ */ jsxs("li", { className: "grid gap-1.5", children: [
4599
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4600
- /* @__PURE__ */ jsx("p", { className: "min-w-0 flex-1 truncate text-sm font-medium", children: job.name }),
4601
- /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: statusLabel(job.status, labels) }),
4602
- canPause ? /* @__PURE__ */ jsx(
4603
- Button,
4604
- {
4605
- type: "button",
4606
- variant: "ghost",
4607
- size: "icon-sm",
4608
- "aria-label": `${labels.pause} ${job.name}`,
4609
- onClick: () => onPause(job.id),
4610
- children: /* @__PURE__ */ jsx(Pause, {})
4611
- }
4612
- ) : null,
4613
- canResume ? /* @__PURE__ */ jsx(
4614
- Button,
4615
- {
4616
- type: "button",
4617
- variant: "ghost",
4618
- size: "icon-sm",
4619
- "aria-label": `${labels.resume} ${job.name}`,
4620
- onClick: () => onResume(job.id),
4621
- children: /* @__PURE__ */ jsx(Play, {})
4622
- }
4623
- ) : null,
4624
- canCancel ? /* @__PURE__ */ jsx(
4625
- Button,
4626
- {
4627
- type: "button",
4628
- variant: "ghost",
4629
- size: "icon-sm",
4630
- "aria-label": `${labels.cancel} ${job.name}`,
4631
- onClick: () => onCancel(job.id),
4632
- children: /* @__PURE__ */ jsx(X, {})
4633
- }
4634
- ) : null
4635
- ] }),
4636
- /* @__PURE__ */ jsx(
4637
- "div",
4638
- {
4639
- role: "progressbar",
4640
- "aria-valuemin": 0,
4641
- "aria-valuemax": 100,
4642
- "aria-valuenow": job.percent,
4643
- "aria-label": job.name,
4644
- className: "bg-muted h-2 overflow-hidden rounded-full",
4645
- children: /* @__PURE__ */ jsx(
4646
- "div",
4647
- {
4648
- className: cn(
4649
- "bg-primary h-full",
4650
- active && "motion-safe:transition-[width]"
4651
- ),
4652
- style: { width: `${job.percent}%` }
4653
- }
4654
- )
4655
- }
4656
- ),
4657
- job.error ? /* @__PURE__ */ jsx("p", { role: "alert", className: "text-destructive text-xs", children: job.error }) : null
4658
- ] }, job.id);
4659
- }) })
4970
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
4971
+ Button,
4972
+ {
4973
+ type: "button",
4974
+ variant: "ghost",
4975
+ size: "icon",
4976
+ className: cn("relative size-9", className),
4977
+ "aria-label": labels.title,
4978
+ children: [
4979
+ /* @__PURE__ */ jsx(Upload, { className: "size-4" }),
4980
+ activeCount > 0 ? /* @__PURE__ */ 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
4981
+ ]
4982
+ }
4983
+ ) }),
4984
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { align, className: "w-80 p-0", children: [
4985
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between border-b px-4 py-3", children: /* @__PURE__ */ jsx("h4", { className: "font-semibold", children: labels.title }) }),
4986
+ /* @__PURE__ */ jsx("div", { className: "max-h-80 overflow-y-auto p-3", children: /* @__PURE__ */ jsx(
4987
+ FileUploadTray,
4988
+ {
4989
+ jobs: visible,
4990
+ labels,
4991
+ onPause,
4992
+ onResume,
4993
+ onCancel
4994
+ }
4995
+ ) })
4996
+ ] })
4660
4997
  ]
4661
4998
  }
4662
4999
  );
@@ -4878,6 +5215,6 @@ function avatarFallbackStyle(name) {
4878
5215
  return getAvatarColors(name);
4879
5216
  }
4880
5217
 
4881
- export { AvatarEditor, AvatarEditorDialog, ConfirmDestructiveDialog, CurtainPicker, CurtainPickerSkeleton, CurtainPreview, CurtainStage, DEFAULT_CURTAIN_PICKER_LABELS, DEFAULT_EDITABLE_SECTION_LABELS, DEFAULT_FILE_DROPZONE_LABELS, DEFAULT_FILE_UPLOAD_LABELS, DEFAULT_FILE_UPLOAD_TRAY_LABELS, DataList, DataListItem, EditableSection, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, FeedVideoPlayer, FieldMessage, FileDropzone, FileUploadTray, LanguageContext, LanguageSwitcher, LoadingState, SafeImage, ThemeSwitcher, VideoPlayer, WaitingRoom, avatarFallbackStyle, castHlsUrl, cn, createLiveHlsConfig, createMultipartUploadController, createVodHlsConfig, defaultLanguages, describeAvResync, describePlaybackError, fileMatchesAccept, getAvatarColors, getInitials, loadCastSender, partRanges, progressFromBytes, shouldRetryLiveEdge404, useEditableSection, useFeedExclusivePlayback, useHlsPlayback, useLanguageContext, useMediaQuery2 as useMediaQuery, usePlaybackStats };
5218
+ export { AvatarEditor, AvatarEditorDialog, ConfirmDestructiveDialog, CurtainPicker, CurtainPickerSkeleton, CurtainPreview, CurtainStage, DEFAULT_CURTAIN_PICKER_LABELS, DEFAULT_EDITABLE_SECTION_LABELS, DEFAULT_FILE_DROPZONE_LABELS, DEFAULT_FILE_UPLOAD_LABELS, DEFAULT_FILE_UPLOAD_TRAY_LABELS, DEFAULT_NOTIFICATION_BELL_LABELS, DataList, DataListItem, EditableSection, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, FeedVideoPlayer, FieldMessage, FileDropzone, FileUploadMenu, FileUploadTray, LanguageContext, LanguageSwitcher, LoadingState, NotificationBell, SafeImage, ThemeSwitcher, VideoPlayer, WaitingRoom, avatarFallbackStyle, castHlsUrl, cn, createLiveHlsConfig, createMultipartUploadController, createVodHlsConfig, defaultLanguages, describeAvResync, describePlaybackError, fileMatchesAccept, getAvatarColors, getInitials, loadCastSender, partRanges, progressFromBytes, shouldRetryLiveEdge404, useEditableSection, useFeedExclusivePlayback, useHlsPlayback, useLanguageContext, useMediaQuery2 as useMediaQuery, usePlaybackStats };
4882
5219
  //# sourceMappingURL=index.js.map
4883
5220
  //# sourceMappingURL=index.js.map