@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.cjs +421 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -3
- package/dist/index.d.ts +125 -3
- package/dist/index.js +413 -52
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3568,7 +3568,9 @@ function useHlsPlayback({
|
|
|
3568
3568
|
autoPlay = false,
|
|
3569
3569
|
muted = false,
|
|
3570
3570
|
onError,
|
|
3571
|
-
onPlayingChange
|
|
3571
|
+
onPlayingChange,
|
|
3572
|
+
onRebuffer,
|
|
3573
|
+
onQualityChange
|
|
3572
3574
|
}) {
|
|
3573
3575
|
const videoRef = React9__namespace.useRef(null);
|
|
3574
3576
|
const hlsRef = React9__namespace.useRef(null);
|
|
@@ -3580,10 +3582,14 @@ function useHlsPlayback({
|
|
|
3580
3582
|
const [reloadKey, setReloadKey] = React9__namespace.useState(0);
|
|
3581
3583
|
const onErrorRef = React9__namespace.useRef(onError);
|
|
3582
3584
|
const onPlayingChangeRef = React9__namespace.useRef(onPlayingChange);
|
|
3585
|
+
const onRebufferRef = React9__namespace.useRef(onRebuffer);
|
|
3586
|
+
const onQualityChangeRef = React9__namespace.useRef(onQualityChange);
|
|
3583
3587
|
React9__namespace.useEffect(() => {
|
|
3584
3588
|
onErrorRef.current = onError;
|
|
3585
3589
|
onPlayingChangeRef.current = onPlayingChange;
|
|
3586
|
-
|
|
3590
|
+
onRebufferRef.current = onRebuffer;
|
|
3591
|
+
onQualityChangeRef.current = onQualityChange;
|
|
3592
|
+
}, [onError, onPlayingChange, onRebuffer, onQualityChange]);
|
|
3587
3593
|
const retry = React9__namespace.useCallback(() => {
|
|
3588
3594
|
setError(null);
|
|
3589
3595
|
setState("loading");
|
|
@@ -3719,6 +3725,8 @@ function useHlsPlayback({
|
|
|
3719
3725
|
}
|
|
3720
3726
|
});
|
|
3721
3727
|
}
|
|
3728
|
+
let hasPlayed = false;
|
|
3729
|
+
let waitingSince = null;
|
|
3722
3730
|
function onPlaying() {
|
|
3723
3731
|
manifestParsed = true;
|
|
3724
3732
|
mediaErrorRetries = 0;
|
|
@@ -3727,18 +3735,30 @@ function useHlsPlayback({
|
|
|
3727
3735
|
setAutoplayState(
|
|
3728
3736
|
(prev) => prev === "blocked" || prev === "none" ? "playing" : prev
|
|
3729
3737
|
);
|
|
3738
|
+
if (waitingSince != null) {
|
|
3739
|
+
const seconds = (performance.now() - waitingSince) / 1e3;
|
|
3740
|
+
waitingSince = null;
|
|
3741
|
+
if (seconds > 0) onRebufferRef.current?.(seconds);
|
|
3742
|
+
}
|
|
3743
|
+
hasPlayed = true;
|
|
3730
3744
|
onPlayingChangeRef.current?.(true);
|
|
3731
3745
|
}
|
|
3732
3746
|
function onPaused() {
|
|
3733
3747
|
onPlayingChangeRef.current?.(false);
|
|
3734
3748
|
}
|
|
3749
|
+
function onWaiting() {
|
|
3750
|
+
if (!hasPlayed || waitingSince != null) return;
|
|
3751
|
+
waitingSince = performance.now();
|
|
3752
|
+
}
|
|
3735
3753
|
media.addEventListener("playing", onPlaying);
|
|
3736
3754
|
media.addEventListener("pause", onPaused);
|
|
3737
3755
|
media.addEventListener("ended", onPaused);
|
|
3756
|
+
media.addEventListener("waiting", onWaiting);
|
|
3738
3757
|
teardown.push(() => {
|
|
3739
3758
|
media.removeEventListener("playing", onPlaying);
|
|
3740
3759
|
media.removeEventListener("pause", onPaused);
|
|
3741
3760
|
media.removeEventListener("ended", onPaused);
|
|
3761
|
+
media.removeEventListener("waiting", onWaiting);
|
|
3742
3762
|
});
|
|
3743
3763
|
startDriftWatchdog(media);
|
|
3744
3764
|
function initNative() {
|
|
@@ -3804,6 +3824,10 @@ function useHlsPlayback({
|
|
|
3804
3824
|
hls.on(Hls.Events.LEVEL_SWITCHED, (_e, data) => {
|
|
3805
3825
|
if (hls.autoLevelEnabled) setActiveLevel(-1);
|
|
3806
3826
|
else setActiveLevel(data.level);
|
|
3827
|
+
const height = hls.levels?.[data.level]?.height;
|
|
3828
|
+
onQualityChangeRef.current?.(
|
|
3829
|
+
typeof height === "number" && height > 0 ? `${height}p` : "auto"
|
|
3830
|
+
);
|
|
3807
3831
|
});
|
|
3808
3832
|
hls.on(Hls.Events.ERROR, (_e, data) => {
|
|
3809
3833
|
onErrorRef.current?.(
|
|
@@ -3934,22 +3958,6 @@ function stabilizeLiveLagMs(previous, next) {
|
|
|
3934
3958
|
function isCaptionLocale(value) {
|
|
3935
3959
|
return CAPTION_LOCALES.includes(value);
|
|
3936
3960
|
}
|
|
3937
|
-
function isLivePlaylistSrc(src) {
|
|
3938
|
-
return /\/live\//i.test(src);
|
|
3939
|
-
}
|
|
3940
|
-
function zeroAnchorCaptionCues(cues) {
|
|
3941
|
-
if (cues.length === 0) return cues;
|
|
3942
|
-
let origin = Number.POSITIVE_INFINITY;
|
|
3943
|
-
for (const cue of cues) {
|
|
3944
|
-
if (Number.isFinite(cue.start) && cue.start < origin) origin = cue.start;
|
|
3945
|
-
}
|
|
3946
|
-
if (!Number.isFinite(origin) || origin <= 0) return cues;
|
|
3947
|
-
return cues.map((cue) => ({
|
|
3948
|
-
...cue,
|
|
3949
|
-
start: Math.max(0, cue.start - origin),
|
|
3950
|
-
end: Math.max(0, cue.end - origin)
|
|
3951
|
-
}));
|
|
3952
|
-
}
|
|
3953
3961
|
function captionsVttUrlFromPlayback(src, locale) {
|
|
3954
3962
|
const trimmed = src.trim();
|
|
3955
3963
|
if (!trimmed) return null;
|
|
@@ -4363,32 +4371,6 @@ function syncNativeCaptionCue(video, track, text, holdSeconds = NATIVE_CAPTION_H
|
|
|
4363
4371
|
const hold = Number.isFinite(holdSeconds) ? Math.max(0.2, holdSeconds) : NATIVE_CAPTION_HOLD_S;
|
|
4364
4372
|
track.addCue(new VTTCue(start, start + hold, trimmed));
|
|
4365
4373
|
}
|
|
4366
|
-
function zeroAnchorNativeTrackCues(track) {
|
|
4367
|
-
const list = track.cues;
|
|
4368
|
-
if (!list || list.length === 0) return;
|
|
4369
|
-
let origin = Number.POSITIVE_INFINITY;
|
|
4370
|
-
for (let index = 0; index < list.length; index += 1) {
|
|
4371
|
-
const cue = list[index];
|
|
4372
|
-
if (cue && Number.isFinite(cue.startTime) && cue.startTime < origin) {
|
|
4373
|
-
origin = cue.startTime;
|
|
4374
|
-
}
|
|
4375
|
-
}
|
|
4376
|
-
if (!Number.isFinite(origin) || origin <= 0) return;
|
|
4377
|
-
const next = [];
|
|
4378
|
-
for (let index = 0; index < list.length; index += 1) {
|
|
4379
|
-
const cue = list[index];
|
|
4380
|
-
if (!(cue instanceof VTTCue)) continue;
|
|
4381
|
-
next.push(
|
|
4382
|
-
new VTTCue(
|
|
4383
|
-
Math.max(0, cue.startTime - origin),
|
|
4384
|
-
Math.max(0, cue.endTime - origin),
|
|
4385
|
-
cue.text
|
|
4386
|
-
)
|
|
4387
|
-
);
|
|
4388
|
-
}
|
|
4389
|
-
clearNativeCaptionCues(track);
|
|
4390
|
-
for (const cue of next) track.addCue(cue);
|
|
4391
|
-
}
|
|
4392
4374
|
function listenTextTracksChange(tracks, onChange) {
|
|
4393
4375
|
if (typeof tracks.addEventListener === "function") {
|
|
4394
4376
|
tracks.addEventListener("change", onChange);
|
|
@@ -4440,6 +4422,7 @@ var PLAYBACK_RATES = [0.75, 1, 1.25, 1.5, 2];
|
|
|
4440
4422
|
var CONTROLS_HIDE_MS = 3e3;
|
|
4441
4423
|
var LIVE_EDGE_THRESHOLD_S = 8;
|
|
4442
4424
|
var SEEK_STEP_S = 5;
|
|
4425
|
+
var PROGRESS_THROTTLE_MS = 5e3;
|
|
4443
4426
|
var LIVE_CAPTION_PLAYOUT_MS = 250;
|
|
4444
4427
|
var COMPACT_CHROME_PX = 640;
|
|
4445
4428
|
var VIDEO_MEDIA_STYLE = `
|
|
@@ -4488,6 +4471,9 @@ function VideoPlayer({
|
|
|
4488
4471
|
onPlayingChange,
|
|
4489
4472
|
onFirstPlay,
|
|
4490
4473
|
onError,
|
|
4474
|
+
onPlaybackProgress,
|
|
4475
|
+
onRebuffer,
|
|
4476
|
+
onQualityChange,
|
|
4491
4477
|
fit = "aspect-video",
|
|
4492
4478
|
className,
|
|
4493
4479
|
defaultCaptionLocale,
|
|
@@ -4496,6 +4482,9 @@ function VideoPlayer({
|
|
|
4496
4482
|
const t = { ...DEFAULT_LABELS3, ...labels };
|
|
4497
4483
|
const containerRef = React9__namespace.useRef(null);
|
|
4498
4484
|
const firstPlayFiredRef = React9__namespace.useRef(false);
|
|
4485
|
+
const lastProgressAtRef = React9__namespace.useRef(-PROGRESS_THROTTLE_MS);
|
|
4486
|
+
const onPlaybackProgressRef = React9__namespace.useRef(onPlaybackProgress);
|
|
4487
|
+
onPlaybackProgressRef.current = onPlaybackProgress;
|
|
4499
4488
|
const applyingTrackModesRef = React9__namespace.useRef(false);
|
|
4500
4489
|
const captionLocaleRef = React9__namespace.useRef("off");
|
|
4501
4490
|
const cssFullscreenRef = React9__namespace.useRef(false);
|
|
@@ -4530,7 +4519,9 @@ function VideoPlayer({
|
|
|
4530
4519
|
autoPlay: autoplayActive,
|
|
4531
4520
|
muted,
|
|
4532
4521
|
onError,
|
|
4533
|
-
onPlayingChange: handlePlayingChange
|
|
4522
|
+
onPlayingChange: handlePlayingChange,
|
|
4523
|
+
onRebuffer,
|
|
4524
|
+
onQualityChange
|
|
4534
4525
|
});
|
|
4535
4526
|
const [isPlaying, setIsPlaying] = React9__namespace.useState(false);
|
|
4536
4527
|
const [isMuted, setIsMuted] = React9__namespace.useState(muted);
|
|
@@ -4598,6 +4589,17 @@ function VideoPlayer({
|
|
|
4598
4589
|
if (video.buffered.length > 0) {
|
|
4599
4590
|
setBuffered(video.buffered.end(video.buffered.length - 1));
|
|
4600
4591
|
}
|
|
4592
|
+
const progress = onPlaybackProgressRef.current;
|
|
4593
|
+
if (progress) {
|
|
4594
|
+
const now = performance.now();
|
|
4595
|
+
if (now - lastProgressAtRef.current >= PROGRESS_THROTTLE_MS) {
|
|
4596
|
+
lastProgressAtRef.current = now;
|
|
4597
|
+
progress(
|
|
4598
|
+
video.currentTime,
|
|
4599
|
+
finitePlaybackDuration(video.duration, video.seekable, mode)
|
|
4600
|
+
);
|
|
4601
|
+
}
|
|
4602
|
+
}
|
|
4601
4603
|
if (mode === "live" && video.seekable.length > 0) {
|
|
4602
4604
|
const edge = video.seekable.end(video.seekable.length - 1);
|
|
4603
4605
|
const lagSeconds = edge - video.currentTime;
|
|
@@ -4670,9 +4672,6 @@ function VideoPlayer({
|
|
|
4670
4672
|
function onSidecarTrackLoad(event) {
|
|
4671
4673
|
const track = event.currentTarget.track;
|
|
4672
4674
|
if (!track) return;
|
|
4673
|
-
if (isLivePlaylistSrc(src)) {
|
|
4674
|
-
zeroAnchorNativeTrackCues(track);
|
|
4675
|
-
}
|
|
4676
4675
|
const video = videoRef.current;
|
|
4677
4676
|
if (video) {
|
|
4678
4677
|
applyNativeTrackModes(
|
|
@@ -4772,8 +4771,7 @@ function VideoPlayer({
|
|
|
4772
4771
|
return;
|
|
4773
4772
|
}
|
|
4774
4773
|
const cues = await loadCaptionVtt(url);
|
|
4775
|
-
|
|
4776
|
-
if (!cancelled) setCaptionCues(next);
|
|
4774
|
+
if (!cancelled) setCaptionCues(cues);
|
|
4777
4775
|
};
|
|
4778
4776
|
void load();
|
|
4779
4777
|
if (!liveCaptionsBaseUrl) return;
|
|
@@ -6380,10 +6378,374 @@ function avatarFallbackStyle(name) {
|
|
|
6380
6378
|
return getAvatarColors(name);
|
|
6381
6379
|
}
|
|
6382
6380
|
|
|
6381
|
+
// src/lib/playbackBeacon.ts
|
|
6382
|
+
var DEFAULT_INTERVAL_MS = 5e3;
|
|
6383
|
+
function canUseWindow() {
|
|
6384
|
+
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
6385
|
+
}
|
|
6386
|
+
function createPlaybackBeaconClient({
|
|
6387
|
+
endpoint,
|
|
6388
|
+
sessionId,
|
|
6389
|
+
surface,
|
|
6390
|
+
getContext,
|
|
6391
|
+
fetchFn,
|
|
6392
|
+
intervalMs = DEFAULT_INTERVAL_MS,
|
|
6393
|
+
now = () => Date.now()
|
|
6394
|
+
}) {
|
|
6395
|
+
let queue = [];
|
|
6396
|
+
let destroyed = false;
|
|
6397
|
+
let timer = null;
|
|
6398
|
+
let flushing = null;
|
|
6399
|
+
function enqueue(event) {
|
|
6400
|
+
if (destroyed) return;
|
|
6401
|
+
const context = getContext?.() ?? {};
|
|
6402
|
+
queue.push({
|
|
6403
|
+
type: event.type,
|
|
6404
|
+
...context,
|
|
6405
|
+
...event,
|
|
6406
|
+
surface,
|
|
6407
|
+
ts: event.ts ?? now()
|
|
6408
|
+
});
|
|
6409
|
+
}
|
|
6410
|
+
async function send(events, keepalive) {
|
|
6411
|
+
if (events.length === 0) return;
|
|
6412
|
+
const body = JSON.stringify({ sessionId, events });
|
|
6413
|
+
const post = fetchFn ?? (typeof fetch === "function" ? fetch : void 0);
|
|
6414
|
+
if (!post) return;
|
|
6415
|
+
try {
|
|
6416
|
+
await post(endpoint, {
|
|
6417
|
+
method: "POST",
|
|
6418
|
+
headers: { "Content-Type": "application/json" },
|
|
6419
|
+
body,
|
|
6420
|
+
keepalive
|
|
6421
|
+
});
|
|
6422
|
+
} catch {
|
|
6423
|
+
}
|
|
6424
|
+
}
|
|
6425
|
+
async function flush(keepalive = false) {
|
|
6426
|
+
if (queue.length === 0) return;
|
|
6427
|
+
const events = queue;
|
|
6428
|
+
queue = [];
|
|
6429
|
+
await send(events, keepalive);
|
|
6430
|
+
}
|
|
6431
|
+
function scheduleFlush() {
|
|
6432
|
+
if (flushing) return flushing;
|
|
6433
|
+
flushing = flush(false).finally(() => {
|
|
6434
|
+
flushing = null;
|
|
6435
|
+
});
|
|
6436
|
+
return flushing;
|
|
6437
|
+
}
|
|
6438
|
+
function onPageHide() {
|
|
6439
|
+
void flush(true);
|
|
6440
|
+
}
|
|
6441
|
+
function onVisibility() {
|
|
6442
|
+
if (document.visibilityState === "hidden") void flush(true);
|
|
6443
|
+
}
|
|
6444
|
+
if (canUseWindow()) {
|
|
6445
|
+
timer = setInterval(() => {
|
|
6446
|
+
void scheduleFlush();
|
|
6447
|
+
}, intervalMs);
|
|
6448
|
+
window.addEventListener("pagehide", onPageHide);
|
|
6449
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
6450
|
+
}
|
|
6451
|
+
return {
|
|
6452
|
+
track(event) {
|
|
6453
|
+
enqueue(event);
|
|
6454
|
+
},
|
|
6455
|
+
flush() {
|
|
6456
|
+
return flush(false);
|
|
6457
|
+
},
|
|
6458
|
+
destroy() {
|
|
6459
|
+
if (destroyed) return;
|
|
6460
|
+
destroyed = true;
|
|
6461
|
+
if (timer !== null) {
|
|
6462
|
+
clearInterval(timer);
|
|
6463
|
+
timer = null;
|
|
6464
|
+
}
|
|
6465
|
+
if (canUseWindow()) {
|
|
6466
|
+
window.removeEventListener("pagehide", onPageHide);
|
|
6467
|
+
document.removeEventListener("visibilitychange", onVisibility);
|
|
6468
|
+
}
|
|
6469
|
+
void flush(true);
|
|
6470
|
+
}
|
|
6471
|
+
};
|
|
6472
|
+
}
|
|
6473
|
+
function StatHighlightCard({
|
|
6474
|
+
label,
|
|
6475
|
+
value,
|
|
6476
|
+
hint,
|
|
6477
|
+
delta,
|
|
6478
|
+
deltaTone = "neutral",
|
|
6479
|
+
className
|
|
6480
|
+
}) {
|
|
6481
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6482
|
+
"div",
|
|
6483
|
+
{
|
|
6484
|
+
className: cn(
|
|
6485
|
+
"bg-card text-card-foreground rounded-xl border p-6 shadow-sm",
|
|
6486
|
+
className
|
|
6487
|
+
),
|
|
6488
|
+
children: [
|
|
6489
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: label }),
|
|
6490
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-2xl font-semibold tracking-tight", children: value }),
|
|
6491
|
+
delta ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6492
|
+
"p",
|
|
6493
|
+
{
|
|
6494
|
+
className: cn(
|
|
6495
|
+
"mt-1 text-sm",
|
|
6496
|
+
deltaTone === "up" && "text-emerald-600 dark:text-emerald-400",
|
|
6497
|
+
deltaTone === "down" && "text-destructive",
|
|
6498
|
+
deltaTone === "neutral" && "text-muted-foreground"
|
|
6499
|
+
),
|
|
6500
|
+
children: delta
|
|
6501
|
+
}
|
|
6502
|
+
) : null,
|
|
6503
|
+
hint ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mt-1 text-xs", children: hint }) : null
|
|
6504
|
+
]
|
|
6505
|
+
}
|
|
6506
|
+
);
|
|
6507
|
+
}
|
|
6508
|
+
function MetricChartCard({
|
|
6509
|
+
title,
|
|
6510
|
+
description,
|
|
6511
|
+
action,
|
|
6512
|
+
children,
|
|
6513
|
+
className
|
|
6514
|
+
}) {
|
|
6515
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6516
|
+
"div",
|
|
6517
|
+
{
|
|
6518
|
+
className: cn(
|
|
6519
|
+
"bg-card text-card-foreground rounded-xl border shadow-sm",
|
|
6520
|
+
className
|
|
6521
|
+
),
|
|
6522
|
+
children: [
|
|
6523
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-3 p-6 pb-2", children: [
|
|
6524
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
6525
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "leading-none font-semibold tracking-tight", children: title }),
|
|
6526
|
+
description ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mt-1.5 text-sm", children: description }) : null
|
|
6527
|
+
] }),
|
|
6528
|
+
action
|
|
6529
|
+
] }),
|
|
6530
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6 pt-4", children })
|
|
6531
|
+
]
|
|
6532
|
+
}
|
|
6533
|
+
);
|
|
6534
|
+
}
|
|
6535
|
+
function polyline(points) {
|
|
6536
|
+
if (points.length === 0) return "";
|
|
6537
|
+
const min = Math.min(...points);
|
|
6538
|
+
const max = Math.max(...points);
|
|
6539
|
+
const span = max - min || 1;
|
|
6540
|
+
return points.map((point, index) => {
|
|
6541
|
+
const x = points.length === 1 ? 50 : index / (points.length - 1) * 100;
|
|
6542
|
+
const y = 28 - (point - min) / span * 24;
|
|
6543
|
+
return `${x.toFixed(2)},${y.toFixed(2)}`;
|
|
6544
|
+
}).join(" ");
|
|
6545
|
+
}
|
|
6546
|
+
function SparklineStat({
|
|
6547
|
+
label,
|
|
6548
|
+
value,
|
|
6549
|
+
points,
|
|
6550
|
+
className
|
|
6551
|
+
}) {
|
|
6552
|
+
const reduced = useMediaQuery2("(prefers-reduced-motion: reduce)");
|
|
6553
|
+
const path = polyline(points);
|
|
6554
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6555
|
+
"div",
|
|
6556
|
+
{
|
|
6557
|
+
className: cn(
|
|
6558
|
+
"bg-card text-card-foreground flex items-end justify-between gap-3 rounded-xl border p-4 shadow-sm",
|
|
6559
|
+
className
|
|
6560
|
+
),
|
|
6561
|
+
children: [
|
|
6562
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
6563
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: label }),
|
|
6564
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-lg font-semibold tracking-tight", children: value })
|
|
6565
|
+
] }),
|
|
6566
|
+
path ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6567
|
+
"svg",
|
|
6568
|
+
{
|
|
6569
|
+
viewBox: "0 0 100 32",
|
|
6570
|
+
className: cn(
|
|
6571
|
+
"text-primary h-8 w-24",
|
|
6572
|
+
!reduced && "motion-safe:transition-opacity"
|
|
6573
|
+
),
|
|
6574
|
+
"aria-hidden": "true",
|
|
6575
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6576
|
+
"polyline",
|
|
6577
|
+
{
|
|
6578
|
+
fill: "none",
|
|
6579
|
+
stroke: "currentColor",
|
|
6580
|
+
strokeWidth: "2",
|
|
6581
|
+
strokeLinejoin: "round",
|
|
6582
|
+
strokeLinecap: "round",
|
|
6583
|
+
points: path
|
|
6584
|
+
}
|
|
6585
|
+
)
|
|
6586
|
+
}
|
|
6587
|
+
) : null
|
|
6588
|
+
]
|
|
6589
|
+
}
|
|
6590
|
+
);
|
|
6591
|
+
}
|
|
6592
|
+
var TIME_RANGE_OPTIONS = ["day", "week", "month", "year"];
|
|
6593
|
+
var DEFAULT_LABELS4 = {
|
|
6594
|
+
day: "Day",
|
|
6595
|
+
week: "Week",
|
|
6596
|
+
month: "Month",
|
|
6597
|
+
year: "Year"
|
|
6598
|
+
};
|
|
6599
|
+
function TimeRangePicker({
|
|
6600
|
+
value,
|
|
6601
|
+
onChange,
|
|
6602
|
+
labels,
|
|
6603
|
+
className
|
|
6604
|
+
}) {
|
|
6605
|
+
const copy = { ...DEFAULT_LABELS4, ...labels };
|
|
6606
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6607
|
+
"div",
|
|
6608
|
+
{
|
|
6609
|
+
role: "group",
|
|
6610
|
+
"aria-label": "Time range",
|
|
6611
|
+
className: cn("flex flex-wrap gap-1", className),
|
|
6612
|
+
children: TIME_RANGE_OPTIONS.map((option) => {
|
|
6613
|
+
const selected = option === value;
|
|
6614
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6615
|
+
Button,
|
|
6616
|
+
{
|
|
6617
|
+
type: "button",
|
|
6618
|
+
size: "sm",
|
|
6619
|
+
variant: selected ? "default" : "outline",
|
|
6620
|
+
"aria-pressed": selected,
|
|
6621
|
+
onClick: () => onChange(option),
|
|
6622
|
+
children: copy[option]
|
|
6623
|
+
},
|
|
6624
|
+
option
|
|
6625
|
+
);
|
|
6626
|
+
})
|
|
6627
|
+
}
|
|
6628
|
+
);
|
|
6629
|
+
}
|
|
6630
|
+
function DimensionBreakdownTable({
|
|
6631
|
+
title,
|
|
6632
|
+
rows,
|
|
6633
|
+
empty,
|
|
6634
|
+
className
|
|
6635
|
+
}) {
|
|
6636
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6637
|
+
"div",
|
|
6638
|
+
{
|
|
6639
|
+
className: cn(
|
|
6640
|
+
"bg-card text-card-foreground overflow-hidden rounded-xl border shadow-sm",
|
|
6641
|
+
className
|
|
6642
|
+
),
|
|
6643
|
+
children: [
|
|
6644
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "px-6 pt-6 text-sm font-semibold tracking-tight", children: title }) : null,
|
|
6645
|
+
rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: empty }) : /* @__PURE__ */ jsxRuntime.jsx("table", { className: "w-full text-sm", children: /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-t first:border-t-0", children: [
|
|
6646
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { scope: "row", className: "px-6 py-3 text-left font-medium", children: row.label }),
|
|
6647
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-3 text-right tabular-nums", children: row.value }),
|
|
6648
|
+
row.share ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: "text-muted-foreground px-6 py-3 text-right tabular-nums", children: row.share }) : null
|
|
6649
|
+
] }, row.id)) }) })
|
|
6650
|
+
]
|
|
6651
|
+
}
|
|
6652
|
+
);
|
|
6653
|
+
}
|
|
6654
|
+
function CostBreakdownCard({
|
|
6655
|
+
title,
|
|
6656
|
+
total,
|
|
6657
|
+
items,
|
|
6658
|
+
className
|
|
6659
|
+
}) {
|
|
6660
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6661
|
+
"div",
|
|
6662
|
+
{
|
|
6663
|
+
className: cn(
|
|
6664
|
+
"bg-card text-card-foreground rounded-xl border p-6 shadow-sm",
|
|
6665
|
+
className
|
|
6666
|
+
),
|
|
6667
|
+
children: [
|
|
6668
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between gap-3", children: [
|
|
6669
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold tracking-tight", children: title }),
|
|
6670
|
+
total ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-semibold tabular-nums", children: total }) : null
|
|
6671
|
+
] }),
|
|
6672
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "mt-4 space-y-2", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6673
|
+
"li",
|
|
6674
|
+
{
|
|
6675
|
+
className: "flex items-baseline justify-between gap-3 text-sm",
|
|
6676
|
+
children: [
|
|
6677
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
6678
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: item.label }),
|
|
6679
|
+
item.basis ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: item.basis }) : null
|
|
6680
|
+
] }),
|
|
6681
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "tabular-nums", children: item.amount })
|
|
6682
|
+
]
|
|
6683
|
+
},
|
|
6684
|
+
item.id
|
|
6685
|
+
)) })
|
|
6686
|
+
]
|
|
6687
|
+
}
|
|
6688
|
+
);
|
|
6689
|
+
}
|
|
6690
|
+
function MetricEmptyState({
|
|
6691
|
+
title,
|
|
6692
|
+
description,
|
|
6693
|
+
action,
|
|
6694
|
+
icon = lucideReact.BarChart3,
|
|
6695
|
+
className
|
|
6696
|
+
}) {
|
|
6697
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6698
|
+
EmptyState,
|
|
6699
|
+
{
|
|
6700
|
+
title,
|
|
6701
|
+
description,
|
|
6702
|
+
action,
|
|
6703
|
+
icon,
|
|
6704
|
+
className
|
|
6705
|
+
}
|
|
6706
|
+
);
|
|
6707
|
+
}
|
|
6708
|
+
function MetricSkeleton({ className, bars = 4 }) {
|
|
6709
|
+
const reduced = useMediaQuery2("(prefers-reduced-motion: reduce)");
|
|
6710
|
+
const count = Math.max(1, bars);
|
|
6711
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6712
|
+
"div",
|
|
6713
|
+
{
|
|
6714
|
+
role: "status",
|
|
6715
|
+
"aria-live": "polite",
|
|
6716
|
+
className: cn("bg-card rounded-xl border p-6 shadow-sm", className),
|
|
6717
|
+
children: [
|
|
6718
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6719
|
+
"div",
|
|
6720
|
+
{
|
|
6721
|
+
className: cn(
|
|
6722
|
+
"bg-muted mb-4 h-4 w-32 rounded",
|
|
6723
|
+
!reduced && "animate-pulse"
|
|
6724
|
+
)
|
|
6725
|
+
}
|
|
6726
|
+
),
|
|
6727
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-32 items-end gap-2", children: Array.from({ length: count }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6728
|
+
"div",
|
|
6729
|
+
{
|
|
6730
|
+
className: cn(
|
|
6731
|
+
"bg-muted flex-1 rounded-t",
|
|
6732
|
+
!reduced && "animate-pulse"
|
|
6733
|
+
),
|
|
6734
|
+
style: { height: `${40 + index * 17 % 50}%` }
|
|
6735
|
+
},
|
|
6736
|
+
index
|
|
6737
|
+
)) }),
|
|
6738
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading metrics" })
|
|
6739
|
+
]
|
|
6740
|
+
}
|
|
6741
|
+
);
|
|
6742
|
+
}
|
|
6743
|
+
|
|
6383
6744
|
exports.AvatarEditor = AvatarEditor;
|
|
6384
6745
|
exports.AvatarEditorDialog = AvatarEditorDialog;
|
|
6385
6746
|
exports.CAPTION_LOCALES = CAPTION_LOCALES;
|
|
6386
6747
|
exports.ConfirmDestructiveDialog = ConfirmDestructiveDialog;
|
|
6748
|
+
exports.CostBreakdownCard = CostBreakdownCard;
|
|
6387
6749
|
exports.CurtainPicker = CurtainPicker;
|
|
6388
6750
|
exports.CurtainPickerSkeleton = CurtainPickerSkeleton;
|
|
6389
6751
|
exports.CurtainPreview = CurtainPreview;
|
|
@@ -6396,6 +6758,7 @@ exports.DEFAULT_FILE_UPLOAD_TRAY_LABELS = DEFAULT_FILE_UPLOAD_TRAY_LABELS;
|
|
|
6396
6758
|
exports.DEFAULT_NOTIFICATION_BELL_LABELS = DEFAULT_NOTIFICATION_BELL_LABELS;
|
|
6397
6759
|
exports.DataList = DataList;
|
|
6398
6760
|
exports.DataListItem = DataListItem;
|
|
6761
|
+
exports.DimensionBreakdownTable = DimensionBreakdownTable;
|
|
6399
6762
|
exports.EditableSection = EditableSection;
|
|
6400
6763
|
exports.Empty = Empty;
|
|
6401
6764
|
exports.EmptyContent = EmptyContent;
|
|
@@ -6413,9 +6776,16 @@ exports.FileUploadTray = FileUploadTray;
|
|
|
6413
6776
|
exports.LanguageContext = LanguageContext;
|
|
6414
6777
|
exports.LanguageSwitcher = LanguageSwitcher;
|
|
6415
6778
|
exports.LoadingState = LoadingState;
|
|
6779
|
+
exports.MetricChartCard = MetricChartCard;
|
|
6780
|
+
exports.MetricEmptyState = MetricEmptyState;
|
|
6781
|
+
exports.MetricSkeleton = MetricSkeleton;
|
|
6416
6782
|
exports.NotificationBell = NotificationBell;
|
|
6417
6783
|
exports.SafeImage = SafeImage;
|
|
6784
|
+
exports.SparklineStat = SparklineStat;
|
|
6785
|
+
exports.StatHighlightCard = StatHighlightCard;
|
|
6786
|
+
exports.TIME_RANGE_OPTIONS = TIME_RANGE_OPTIONS;
|
|
6418
6787
|
exports.ThemeSwitcher = ThemeSwitcher;
|
|
6788
|
+
exports.TimeRangePicker = TimeRangePicker;
|
|
6419
6789
|
exports.VideoPlayer = VideoPlayer;
|
|
6420
6790
|
exports.WaitingRoom = WaitingRoom;
|
|
6421
6791
|
exports.avatarFallbackStyle = avatarFallbackStyle;
|
|
@@ -6424,6 +6794,7 @@ exports.castHlsUrl = castHlsUrl;
|
|
|
6424
6794
|
exports.cn = cn;
|
|
6425
6795
|
exports.createLiveHlsConfig = createLiveHlsConfig;
|
|
6426
6796
|
exports.createMultipartUploadController = createMultipartUploadController;
|
|
6797
|
+
exports.createPlaybackBeaconClient = createPlaybackBeaconClient;
|
|
6427
6798
|
exports.createVodHlsConfig = createVodHlsConfig;
|
|
6428
6799
|
exports.defaultLanguages = defaultLanguages;
|
|
6429
6800
|
exports.describeAvResync = describeAvResync;
|