@livo-tv/blocks 1.25.0 → 1.26.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,7 +1,7 @@
1
1
  "use client";
2
2
  import * as React9 from 'react';
3
3
  import { createContext, useContext, useState, useRef, useId, useEffect, useCallback, useLayoutEffect } from '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, Captions, Settings, Cast, PictureInPicture2, Gauge, EllipsisVertical, Minimize, Maximize, ChevronRight, ChevronLeft, 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, Captions, Settings, Cast, PictureInPicture2, Gauge, EllipsisVertical, Minimize, Maximize, ChevronRight, ChevronLeft, BarChart3, 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';
@@ -3542,7 +3542,9 @@ function useHlsPlayback({
3542
3542
  autoPlay = false,
3543
3543
  muted = false,
3544
3544
  onError,
3545
- onPlayingChange
3545
+ onPlayingChange,
3546
+ onRebuffer,
3547
+ onQualityChange
3546
3548
  }) {
3547
3549
  const videoRef = React9.useRef(null);
3548
3550
  const hlsRef = React9.useRef(null);
@@ -3554,10 +3556,14 @@ function useHlsPlayback({
3554
3556
  const [reloadKey, setReloadKey] = React9.useState(0);
3555
3557
  const onErrorRef = React9.useRef(onError);
3556
3558
  const onPlayingChangeRef = React9.useRef(onPlayingChange);
3559
+ const onRebufferRef = React9.useRef(onRebuffer);
3560
+ const onQualityChangeRef = React9.useRef(onQualityChange);
3557
3561
  React9.useEffect(() => {
3558
3562
  onErrorRef.current = onError;
3559
3563
  onPlayingChangeRef.current = onPlayingChange;
3560
- }, [onError, onPlayingChange]);
3564
+ onRebufferRef.current = onRebuffer;
3565
+ onQualityChangeRef.current = onQualityChange;
3566
+ }, [onError, onPlayingChange, onRebuffer, onQualityChange]);
3561
3567
  const retry = React9.useCallback(() => {
3562
3568
  setError(null);
3563
3569
  setState("loading");
@@ -3693,6 +3699,8 @@ function useHlsPlayback({
3693
3699
  }
3694
3700
  });
3695
3701
  }
3702
+ let hasPlayed = false;
3703
+ let waitingSince = null;
3696
3704
  function onPlaying() {
3697
3705
  manifestParsed = true;
3698
3706
  mediaErrorRetries = 0;
@@ -3701,18 +3709,30 @@ function useHlsPlayback({
3701
3709
  setAutoplayState(
3702
3710
  (prev) => prev === "blocked" || prev === "none" ? "playing" : prev
3703
3711
  );
3712
+ if (waitingSince != null) {
3713
+ const seconds = (performance.now() - waitingSince) / 1e3;
3714
+ waitingSince = null;
3715
+ if (seconds > 0) onRebufferRef.current?.(seconds);
3716
+ }
3717
+ hasPlayed = true;
3704
3718
  onPlayingChangeRef.current?.(true);
3705
3719
  }
3706
3720
  function onPaused() {
3707
3721
  onPlayingChangeRef.current?.(false);
3708
3722
  }
3723
+ function onWaiting() {
3724
+ if (!hasPlayed || waitingSince != null) return;
3725
+ waitingSince = performance.now();
3726
+ }
3709
3727
  media.addEventListener("playing", onPlaying);
3710
3728
  media.addEventListener("pause", onPaused);
3711
3729
  media.addEventListener("ended", onPaused);
3730
+ media.addEventListener("waiting", onWaiting);
3712
3731
  teardown.push(() => {
3713
3732
  media.removeEventListener("playing", onPlaying);
3714
3733
  media.removeEventListener("pause", onPaused);
3715
3734
  media.removeEventListener("ended", onPaused);
3735
+ media.removeEventListener("waiting", onWaiting);
3716
3736
  });
3717
3737
  startDriftWatchdog(media);
3718
3738
  function initNative() {
@@ -3778,6 +3798,10 @@ function useHlsPlayback({
3778
3798
  hls.on(Hls.Events.LEVEL_SWITCHED, (_e, data) => {
3779
3799
  if (hls.autoLevelEnabled) setActiveLevel(-1);
3780
3800
  else setActiveLevel(data.level);
3801
+ const height = hls.levels?.[data.level]?.height;
3802
+ onQualityChangeRef.current?.(
3803
+ typeof height === "number" && height > 0 ? `${height}p` : "auto"
3804
+ );
3781
3805
  });
3782
3806
  hls.on(Hls.Events.ERROR, (_e, data) => {
3783
3807
  onErrorRef.current?.(
@@ -3908,22 +3932,6 @@ function stabilizeLiveLagMs(previous, next) {
3908
3932
  function isCaptionLocale(value) {
3909
3933
  return CAPTION_LOCALES.includes(value);
3910
3934
  }
3911
- function isLivePlaylistSrc(src) {
3912
- return /\/live\//i.test(src);
3913
- }
3914
- function zeroAnchorCaptionCues(cues) {
3915
- if (cues.length === 0) return cues;
3916
- let origin = Number.POSITIVE_INFINITY;
3917
- for (const cue of cues) {
3918
- if (Number.isFinite(cue.start) && cue.start < origin) origin = cue.start;
3919
- }
3920
- if (!Number.isFinite(origin) || origin <= 0) return cues;
3921
- return cues.map((cue) => ({
3922
- ...cue,
3923
- start: Math.max(0, cue.start - origin),
3924
- end: Math.max(0, cue.end - origin)
3925
- }));
3926
- }
3927
3935
  function captionsVttUrlFromPlayback(src, locale) {
3928
3936
  const trimmed = src.trim();
3929
3937
  if (!trimmed) return null;
@@ -4337,32 +4345,6 @@ function syncNativeCaptionCue(video, track, text, holdSeconds = NATIVE_CAPTION_H
4337
4345
  const hold = Number.isFinite(holdSeconds) ? Math.max(0.2, holdSeconds) : NATIVE_CAPTION_HOLD_S;
4338
4346
  track.addCue(new VTTCue(start, start + hold, trimmed));
4339
4347
  }
4340
- function zeroAnchorNativeTrackCues(track) {
4341
- const list = track.cues;
4342
- if (!list || list.length === 0) return;
4343
- let origin = Number.POSITIVE_INFINITY;
4344
- for (let index = 0; index < list.length; index += 1) {
4345
- const cue = list[index];
4346
- if (cue && Number.isFinite(cue.startTime) && cue.startTime < origin) {
4347
- origin = cue.startTime;
4348
- }
4349
- }
4350
- if (!Number.isFinite(origin) || origin <= 0) return;
4351
- const next = [];
4352
- for (let index = 0; index < list.length; index += 1) {
4353
- const cue = list[index];
4354
- if (!(cue instanceof VTTCue)) continue;
4355
- next.push(
4356
- new VTTCue(
4357
- Math.max(0, cue.startTime - origin),
4358
- Math.max(0, cue.endTime - origin),
4359
- cue.text
4360
- )
4361
- );
4362
- }
4363
- clearNativeCaptionCues(track);
4364
- for (const cue of next) track.addCue(cue);
4365
- }
4366
4348
  function listenTextTracksChange(tracks, onChange) {
4367
4349
  if (typeof tracks.addEventListener === "function") {
4368
4350
  tracks.addEventListener("change", onChange);
@@ -4414,6 +4396,7 @@ var PLAYBACK_RATES = [0.75, 1, 1.25, 1.5, 2];
4414
4396
  var CONTROLS_HIDE_MS = 3e3;
4415
4397
  var LIVE_EDGE_THRESHOLD_S = 8;
4416
4398
  var SEEK_STEP_S = 5;
4399
+ var PROGRESS_THROTTLE_MS = 5e3;
4417
4400
  var LIVE_CAPTION_PLAYOUT_MS = 250;
4418
4401
  var COMPACT_CHROME_PX = 640;
4419
4402
  var VIDEO_MEDIA_STYLE = `
@@ -4462,6 +4445,9 @@ function VideoPlayer({
4462
4445
  onPlayingChange,
4463
4446
  onFirstPlay,
4464
4447
  onError,
4448
+ onPlaybackProgress,
4449
+ onRebuffer,
4450
+ onQualityChange,
4465
4451
  fit = "aspect-video",
4466
4452
  className,
4467
4453
  defaultCaptionLocale,
@@ -4470,6 +4456,9 @@ function VideoPlayer({
4470
4456
  const t = { ...DEFAULT_LABELS3, ...labels };
4471
4457
  const containerRef = React9.useRef(null);
4472
4458
  const firstPlayFiredRef = React9.useRef(false);
4459
+ const lastProgressAtRef = React9.useRef(-PROGRESS_THROTTLE_MS);
4460
+ const onPlaybackProgressRef = React9.useRef(onPlaybackProgress);
4461
+ onPlaybackProgressRef.current = onPlaybackProgress;
4473
4462
  const applyingTrackModesRef = React9.useRef(false);
4474
4463
  const captionLocaleRef = React9.useRef("off");
4475
4464
  const cssFullscreenRef = React9.useRef(false);
@@ -4504,7 +4493,9 @@ function VideoPlayer({
4504
4493
  autoPlay: autoplayActive,
4505
4494
  muted,
4506
4495
  onError,
4507
- onPlayingChange: handlePlayingChange
4496
+ onPlayingChange: handlePlayingChange,
4497
+ onRebuffer,
4498
+ onQualityChange
4508
4499
  });
4509
4500
  const [isPlaying, setIsPlaying] = React9.useState(false);
4510
4501
  const [isMuted, setIsMuted] = React9.useState(muted);
@@ -4572,6 +4563,17 @@ function VideoPlayer({
4572
4563
  if (video.buffered.length > 0) {
4573
4564
  setBuffered(video.buffered.end(video.buffered.length - 1));
4574
4565
  }
4566
+ const progress = onPlaybackProgressRef.current;
4567
+ if (progress) {
4568
+ const now = performance.now();
4569
+ if (now - lastProgressAtRef.current >= PROGRESS_THROTTLE_MS) {
4570
+ lastProgressAtRef.current = now;
4571
+ progress(
4572
+ video.currentTime,
4573
+ finitePlaybackDuration(video.duration, video.seekable, mode)
4574
+ );
4575
+ }
4576
+ }
4575
4577
  if (mode === "live" && video.seekable.length > 0) {
4576
4578
  const edge = video.seekable.end(video.seekable.length - 1);
4577
4579
  const lagSeconds = edge - video.currentTime;
@@ -4644,9 +4646,6 @@ function VideoPlayer({
4644
4646
  function onSidecarTrackLoad(event) {
4645
4647
  const track = event.currentTarget.track;
4646
4648
  if (!track) return;
4647
- if (isLivePlaylistSrc(src)) {
4648
- zeroAnchorNativeTrackCues(track);
4649
- }
4650
4649
  const video = videoRef.current;
4651
4650
  if (video) {
4652
4651
  applyNativeTrackModes(
@@ -4746,8 +4745,7 @@ function VideoPlayer({
4746
4745
  return;
4747
4746
  }
4748
4747
  const cues = await loadCaptionVtt(url);
4749
- const next = isLivePlaylistSrc(src) ? zeroAnchorCaptionCues(cues) : cues;
4750
- if (!cancelled) setCaptionCues(next);
4748
+ if (!cancelled) setCaptionCues(cues);
4751
4749
  };
4752
4750
  void load();
4753
4751
  if (!liveCaptionsBaseUrl) return;
@@ -6354,6 +6352,369 @@ function avatarFallbackStyle(name) {
6354
6352
  return getAvatarColors(name);
6355
6353
  }
6356
6354
 
6357
- export { AvatarEditor, AvatarEditorDialog, CAPTION_LOCALES, 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, captionsVttUrlFromPlayback, castHlsUrl, cn, createLiveHlsConfig, createMultipartUploadController, createVodHlsConfig, defaultLanguages, describeAvResync, describePlaybackError, fileMatchesAccept, getAvatarColors, getInitials, isCaptionLocale, loadCastSender, partRanges, progressFromBytes, shouldRetryLiveEdge404, useEditableSection, useFeedExclusivePlayback, useHlsPlayback, useLanguageContext, useMediaQuery2 as useMediaQuery, usePlaybackStats };
6355
+ // src/lib/playbackBeacon.ts
6356
+ var DEFAULT_INTERVAL_MS = 5e3;
6357
+ function canUseWindow() {
6358
+ return typeof window !== "undefined" && typeof document !== "undefined";
6359
+ }
6360
+ function createPlaybackBeaconClient({
6361
+ endpoint,
6362
+ sessionId,
6363
+ surface,
6364
+ getContext,
6365
+ fetchFn,
6366
+ intervalMs = DEFAULT_INTERVAL_MS,
6367
+ now = () => Date.now()
6368
+ }) {
6369
+ let queue = [];
6370
+ let destroyed = false;
6371
+ let timer = null;
6372
+ let flushing = null;
6373
+ function enqueue(event) {
6374
+ if (destroyed) return;
6375
+ const context = getContext?.() ?? {};
6376
+ queue.push({
6377
+ type: event.type,
6378
+ ...context,
6379
+ ...event,
6380
+ surface,
6381
+ ts: event.ts ?? now()
6382
+ });
6383
+ }
6384
+ async function send(events, keepalive) {
6385
+ if (events.length === 0) return;
6386
+ const body = JSON.stringify({ sessionId, events });
6387
+ const post = fetchFn ?? (typeof fetch === "function" ? fetch : void 0);
6388
+ if (!post) return;
6389
+ try {
6390
+ await post(endpoint, {
6391
+ method: "POST",
6392
+ headers: { "Content-Type": "application/json" },
6393
+ body,
6394
+ keepalive
6395
+ });
6396
+ } catch {
6397
+ }
6398
+ }
6399
+ async function flush(keepalive = false) {
6400
+ if (queue.length === 0) return;
6401
+ const events = queue;
6402
+ queue = [];
6403
+ await send(events, keepalive);
6404
+ }
6405
+ function scheduleFlush() {
6406
+ if (flushing) return flushing;
6407
+ flushing = flush(false).finally(() => {
6408
+ flushing = null;
6409
+ });
6410
+ return flushing;
6411
+ }
6412
+ function onPageHide() {
6413
+ void flush(true);
6414
+ }
6415
+ function onVisibility() {
6416
+ if (document.visibilityState === "hidden") void flush(true);
6417
+ }
6418
+ if (canUseWindow()) {
6419
+ timer = setInterval(() => {
6420
+ void scheduleFlush();
6421
+ }, intervalMs);
6422
+ window.addEventListener("pagehide", onPageHide);
6423
+ document.addEventListener("visibilitychange", onVisibility);
6424
+ }
6425
+ return {
6426
+ track(event) {
6427
+ enqueue(event);
6428
+ },
6429
+ flush() {
6430
+ return flush(false);
6431
+ },
6432
+ destroy() {
6433
+ if (destroyed) return;
6434
+ destroyed = true;
6435
+ if (timer !== null) {
6436
+ clearInterval(timer);
6437
+ timer = null;
6438
+ }
6439
+ if (canUseWindow()) {
6440
+ window.removeEventListener("pagehide", onPageHide);
6441
+ document.removeEventListener("visibilitychange", onVisibility);
6442
+ }
6443
+ void flush(true);
6444
+ }
6445
+ };
6446
+ }
6447
+ function StatHighlightCard({
6448
+ label,
6449
+ value,
6450
+ hint,
6451
+ delta,
6452
+ deltaTone = "neutral",
6453
+ className
6454
+ }) {
6455
+ return /* @__PURE__ */ jsxs(
6456
+ "div",
6457
+ {
6458
+ className: cn(
6459
+ "bg-card text-card-foreground rounded-xl border p-6 shadow-sm",
6460
+ className
6461
+ ),
6462
+ children: [
6463
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: label }),
6464
+ /* @__PURE__ */ jsx("p", { className: "mt-2 text-2xl font-semibold tracking-tight", children: value }),
6465
+ delta ? /* @__PURE__ */ jsx(
6466
+ "p",
6467
+ {
6468
+ className: cn(
6469
+ "mt-1 text-sm",
6470
+ deltaTone === "up" && "text-emerald-600 dark:text-emerald-400",
6471
+ deltaTone === "down" && "text-destructive",
6472
+ deltaTone === "neutral" && "text-muted-foreground"
6473
+ ),
6474
+ children: delta
6475
+ }
6476
+ ) : null,
6477
+ hint ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1 text-xs", children: hint }) : null
6478
+ ]
6479
+ }
6480
+ );
6481
+ }
6482
+ function MetricChartCard({
6483
+ title,
6484
+ description,
6485
+ action,
6486
+ children,
6487
+ className
6488
+ }) {
6489
+ return /* @__PURE__ */ jsxs(
6490
+ "div",
6491
+ {
6492
+ className: cn(
6493
+ "bg-card text-card-foreground rounded-xl border shadow-sm",
6494
+ className
6495
+ ),
6496
+ children: [
6497
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3 p-6 pb-2", children: [
6498
+ /* @__PURE__ */ jsxs("div", { children: [
6499
+ /* @__PURE__ */ jsx("h3", { className: "leading-none font-semibold tracking-tight", children: title }),
6500
+ description ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1.5 text-sm", children: description }) : null
6501
+ ] }),
6502
+ action
6503
+ ] }),
6504
+ /* @__PURE__ */ jsx("div", { className: "p-6 pt-4", children })
6505
+ ]
6506
+ }
6507
+ );
6508
+ }
6509
+ function polyline(points) {
6510
+ if (points.length === 0) return "";
6511
+ const min = Math.min(...points);
6512
+ const max = Math.max(...points);
6513
+ const span = max - min || 1;
6514
+ return points.map((point, index) => {
6515
+ const x = points.length === 1 ? 50 : index / (points.length - 1) * 100;
6516
+ const y = 28 - (point - min) / span * 24;
6517
+ return `${x.toFixed(2)},${y.toFixed(2)}`;
6518
+ }).join(" ");
6519
+ }
6520
+ function SparklineStat({
6521
+ label,
6522
+ value,
6523
+ points,
6524
+ className
6525
+ }) {
6526
+ const reduced = useMediaQuery2("(prefers-reduced-motion: reduce)");
6527
+ const path = polyline(points);
6528
+ return /* @__PURE__ */ jsxs(
6529
+ "div",
6530
+ {
6531
+ className: cn(
6532
+ "bg-card text-card-foreground flex items-end justify-between gap-3 rounded-xl border p-4 shadow-sm",
6533
+ className
6534
+ ),
6535
+ children: [
6536
+ /* @__PURE__ */ jsxs("div", { children: [
6537
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: label }),
6538
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-lg font-semibold tracking-tight", children: value })
6539
+ ] }),
6540
+ path ? /* @__PURE__ */ jsx(
6541
+ "svg",
6542
+ {
6543
+ viewBox: "0 0 100 32",
6544
+ className: cn(
6545
+ "text-primary h-8 w-24",
6546
+ !reduced && "motion-safe:transition-opacity"
6547
+ ),
6548
+ "aria-hidden": "true",
6549
+ children: /* @__PURE__ */ jsx(
6550
+ "polyline",
6551
+ {
6552
+ fill: "none",
6553
+ stroke: "currentColor",
6554
+ strokeWidth: "2",
6555
+ strokeLinejoin: "round",
6556
+ strokeLinecap: "round",
6557
+ points: path
6558
+ }
6559
+ )
6560
+ }
6561
+ ) : null
6562
+ ]
6563
+ }
6564
+ );
6565
+ }
6566
+ var TIME_RANGE_OPTIONS = ["day", "week", "month", "year"];
6567
+ var DEFAULT_LABELS4 = {
6568
+ day: "Day",
6569
+ week: "Week",
6570
+ month: "Month",
6571
+ year: "Year"
6572
+ };
6573
+ function TimeRangePicker({
6574
+ value,
6575
+ onChange,
6576
+ labels,
6577
+ className
6578
+ }) {
6579
+ const copy = { ...DEFAULT_LABELS4, ...labels };
6580
+ return /* @__PURE__ */ jsx(
6581
+ "div",
6582
+ {
6583
+ role: "group",
6584
+ "aria-label": "Time range",
6585
+ className: cn("flex flex-wrap gap-1", className),
6586
+ children: TIME_RANGE_OPTIONS.map((option) => {
6587
+ const selected = option === value;
6588
+ return /* @__PURE__ */ jsx(
6589
+ Button,
6590
+ {
6591
+ type: "button",
6592
+ size: "sm",
6593
+ variant: selected ? "default" : "outline",
6594
+ "aria-pressed": selected,
6595
+ onClick: () => onChange(option),
6596
+ children: copy[option]
6597
+ },
6598
+ option
6599
+ );
6600
+ })
6601
+ }
6602
+ );
6603
+ }
6604
+ function DimensionBreakdownTable({
6605
+ title,
6606
+ rows,
6607
+ empty,
6608
+ className
6609
+ }) {
6610
+ return /* @__PURE__ */ jsxs(
6611
+ "div",
6612
+ {
6613
+ className: cn(
6614
+ "bg-card text-card-foreground overflow-hidden rounded-xl border shadow-sm",
6615
+ className
6616
+ ),
6617
+ children: [
6618
+ title ? /* @__PURE__ */ jsx("h3", { className: "px-6 pt-6 text-sm font-semibold tracking-tight", children: title }) : null,
6619
+ rows.length === 0 ? /* @__PURE__ */ jsx("div", { className: "p-6", children: empty }) : /* @__PURE__ */ jsx("table", { className: "w-full text-sm", children: /* @__PURE__ */ jsx("tbody", { children: rows.map((row) => /* @__PURE__ */ jsxs("tr", { className: "border-t first:border-t-0", children: [
6620
+ /* @__PURE__ */ jsx("th", { scope: "row", className: "px-6 py-3 text-left font-medium", children: row.label }),
6621
+ /* @__PURE__ */ jsx("td", { className: "px-6 py-3 text-right tabular-nums", children: row.value }),
6622
+ row.share ? /* @__PURE__ */ jsx("td", { className: "text-muted-foreground px-6 py-3 text-right tabular-nums", children: row.share }) : null
6623
+ ] }, row.id)) }) })
6624
+ ]
6625
+ }
6626
+ );
6627
+ }
6628
+ function CostBreakdownCard({
6629
+ title,
6630
+ total,
6631
+ items,
6632
+ className
6633
+ }) {
6634
+ return /* @__PURE__ */ jsxs(
6635
+ "div",
6636
+ {
6637
+ className: cn(
6638
+ "bg-card text-card-foreground rounded-xl border p-6 shadow-sm",
6639
+ className
6640
+ ),
6641
+ children: [
6642
+ /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-3", children: [
6643
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold tracking-tight", children: title }),
6644
+ total ? /* @__PURE__ */ jsx("p", { className: "text-lg font-semibold tabular-nums", children: total }) : null
6645
+ ] }),
6646
+ /* @__PURE__ */ jsx("ul", { className: "mt-4 space-y-2", children: items.map((item) => /* @__PURE__ */ jsxs(
6647
+ "li",
6648
+ {
6649
+ className: "flex items-baseline justify-between gap-3 text-sm",
6650
+ children: [
6651
+ /* @__PURE__ */ jsxs("div", { children: [
6652
+ /* @__PURE__ */ jsx("p", { children: item.label }),
6653
+ item.basis ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: item.basis }) : null
6654
+ ] }),
6655
+ /* @__PURE__ */ jsx("p", { className: "tabular-nums", children: item.amount })
6656
+ ]
6657
+ },
6658
+ item.id
6659
+ )) })
6660
+ ]
6661
+ }
6662
+ );
6663
+ }
6664
+ function MetricEmptyState({
6665
+ title,
6666
+ description,
6667
+ action,
6668
+ icon = BarChart3,
6669
+ className
6670
+ }) {
6671
+ return /* @__PURE__ */ jsx(
6672
+ EmptyState,
6673
+ {
6674
+ title,
6675
+ description,
6676
+ action,
6677
+ icon,
6678
+ className
6679
+ }
6680
+ );
6681
+ }
6682
+ function MetricSkeleton({ className, bars = 4 }) {
6683
+ const reduced = useMediaQuery2("(prefers-reduced-motion: reduce)");
6684
+ const count = Math.max(1, bars);
6685
+ return /* @__PURE__ */ jsxs(
6686
+ "div",
6687
+ {
6688
+ role: "status",
6689
+ "aria-live": "polite",
6690
+ className: cn("bg-card rounded-xl border p-6 shadow-sm", className),
6691
+ children: [
6692
+ /* @__PURE__ */ jsx(
6693
+ "div",
6694
+ {
6695
+ className: cn(
6696
+ "bg-muted mb-4 h-4 w-32 rounded",
6697
+ !reduced && "animate-pulse"
6698
+ )
6699
+ }
6700
+ ),
6701
+ /* @__PURE__ */ jsx("div", { className: "flex h-32 items-end gap-2", children: Array.from({ length: count }, (_, index) => /* @__PURE__ */ jsx(
6702
+ "div",
6703
+ {
6704
+ className: cn(
6705
+ "bg-muted flex-1 rounded-t",
6706
+ !reduced && "animate-pulse"
6707
+ ),
6708
+ style: { height: `${40 + index * 17 % 50}%` }
6709
+ },
6710
+ index
6711
+ )) }),
6712
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading metrics" })
6713
+ ]
6714
+ }
6715
+ );
6716
+ }
6717
+
6718
+ export { AvatarEditor, AvatarEditorDialog, CAPTION_LOCALES, ConfirmDestructiveDialog, CostBreakdownCard, 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, DimensionBreakdownTable, EditableSection, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, FeedVideoPlayer, FieldMessage, FileDropzone, FileUploadMenu, FileUploadTray, LanguageContext, LanguageSwitcher, LoadingState, MetricChartCard, MetricEmptyState, MetricSkeleton, NotificationBell, SafeImage, SparklineStat, StatHighlightCard, TIME_RANGE_OPTIONS, ThemeSwitcher, TimeRangePicker, VideoPlayer, WaitingRoom, avatarFallbackStyle, captionsVttUrlFromPlayback, castHlsUrl, cn, createLiveHlsConfig, createMultipartUploadController, createPlaybackBeaconClient, createVodHlsConfig, defaultLanguages, describeAvResync, describePlaybackError, fileMatchesAccept, getAvatarColors, getInitials, isCaptionLocale, loadCastSender, partRanges, progressFromBytes, shouldRetryLiveEdge404, useEditableSection, useFeedExclusivePlayback, useHlsPlayback, useLanguageContext, useMediaQuery2 as useMediaQuery, usePlaybackStats };
6358
6719
  //# sourceMappingURL=index.js.map
6359
6720
  //# sourceMappingURL=index.js.map