@livo-tv/blocks 1.29.0 → 1.30.1

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,11 +1,11 @@
1
1
  "use client";
2
- import * as React9 from 'react';
2
+ import * as React11 from 'react';
3
3
  import { createContext, useContext, useState, useRef, useId, useEffect, useCallback, useLayoutEffect } from 'react';
4
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';
8
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
+ import { jsxs, jsx, 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
11
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
@@ -1311,7 +1311,7 @@ function Slider({
1311
1311
  max = 100,
1312
1312
  ...props
1313
1313
  }) {
1314
- const _values = React9.useMemo(
1314
+ const _values = React11.useMemo(
1315
1315
  () => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
1316
1316
  [value, defaultValue, min, max]
1317
1317
  );
@@ -2347,6 +2347,424 @@ function AvatarEditorDialog({
2347
2347
  ] }) })
2348
2348
  ] });
2349
2349
  }
2350
+
2351
+ // src/components/video/shader-config.ts
2352
+ var SHADER_CURTAIN_TYPES = ["plane", "sphere", "waterPlane"];
2353
+ var SHADER_VARIANTS = [
2354
+ "defaults",
2355
+ "cosmic",
2356
+ "glass",
2357
+ "positionMix"
2358
+ ];
2359
+ var SHADER_LIGHT_TYPES = ["3d", "env"];
2360
+ var SHADER_ENV_PRESETS = ["city", "dawn", "lobby"];
2361
+ var SHADER_ON_OFF = ["on", "off"];
2362
+ var SHADER_RANGE = ["enabled", "disabled"];
2363
+ var DEFAULT_SHADER_CURTAIN_CONFIG = {
2364
+ type: "plane",
2365
+ shader: "defaults",
2366
+ animate: "on",
2367
+ uTime: 0,
2368
+ uSpeed: 0.4,
2369
+ uStrength: 2,
2370
+ uDensity: 1.2,
2371
+ uFrequency: 5.5,
2372
+ uAmplitude: 1,
2373
+ wireframe: false,
2374
+ loop: "on",
2375
+ loopDuration: 10,
2376
+ range: "disabled",
2377
+ rangeStart: 0,
2378
+ rangeEnd: 10,
2379
+ positionX: 0,
2380
+ positionY: 0,
2381
+ positionZ: 0,
2382
+ rotationX: 0,
2383
+ rotationY: 0,
2384
+ rotationZ: 0,
2385
+ color1: "#52ff89",
2386
+ color2: "#dbba95",
2387
+ color3: "#d0bce1",
2388
+ reflection: 0.1,
2389
+ brightness: 1.2,
2390
+ cAzimuthAngle: 180,
2391
+ cPolarAngle: 90,
2392
+ cDistance: 3.6,
2393
+ cameraZoom: 1,
2394
+ fov: 45,
2395
+ zoomOut: false,
2396
+ lightType: "3d",
2397
+ envPreset: "city",
2398
+ grain: "off",
2399
+ grainBlending: 0.3,
2400
+ pixelDensity: 1
2401
+ };
2402
+ var SHADER_CURTAIN_PRESETS = [
2403
+ { id: "halo", title: "Halo", config: { ...DEFAULT_SHADER_CURTAIN_CONFIG } },
2404
+ {
2405
+ id: "pensive",
2406
+ title: "Pensive",
2407
+ config: {
2408
+ ...DEFAULT_SHADER_CURTAIN_CONFIG,
2409
+ type: "waterPlane",
2410
+ color1: "#809bd6",
2411
+ color2: "#910aff",
2412
+ color3: "#af38ff",
2413
+ uSpeed: 0.3,
2414
+ uStrength: 0.3,
2415
+ uDensity: 0.8
2416
+ }
2417
+ },
2418
+ {
2419
+ id: "mint",
2420
+ title: "Mint",
2421
+ config: {
2422
+ ...DEFAULT_SHADER_CURTAIN_CONFIG,
2423
+ type: "waterPlane",
2424
+ color1: "#73bfc4",
2425
+ color2: "#ffcc81",
2426
+ color3: "#c9f5d3",
2427
+ uSpeed: 0.2,
2428
+ uStrength: 1.1
2429
+ }
2430
+ },
2431
+ {
2432
+ id: "interstella",
2433
+ title: "Interstella",
2434
+ config: {
2435
+ ...DEFAULT_SHADER_CURTAIN_CONFIG,
2436
+ type: "sphere",
2437
+ color1: "#000000",
2438
+ color2: "#0d57c8",
2439
+ color3: "#7a2150",
2440
+ uDensity: 1.8,
2441
+ cDistance: 7.1,
2442
+ cameraZoom: 15
2443
+ }
2444
+ },
2445
+ {
2446
+ id: "nightyNight",
2447
+ title: "Nighty night",
2448
+ config: {
2449
+ ...DEFAULT_SHADER_CURTAIN_CONFIG,
2450
+ type: "waterPlane",
2451
+ color1: "#1a1a2e",
2452
+ color2: "#16213e",
2453
+ color3: "#0f3460",
2454
+ grain: "on"
2455
+ }
2456
+ },
2457
+ {
2458
+ id: "violaOrientalis",
2459
+ title: "Viola orientalis",
2460
+ config: {
2461
+ ...DEFAULT_SHADER_CURTAIN_CONFIG,
2462
+ type: "plane",
2463
+ color1: "#611e69",
2464
+ color2: "#ff7eb3",
2465
+ color3: "#c9b1ff",
2466
+ uStrength: 3.2
2467
+ }
2468
+ },
2469
+ {
2470
+ id: "universe",
2471
+ title: "Universe",
2472
+ config: {
2473
+ ...DEFAULT_SHADER_CURTAIN_CONFIG,
2474
+ type: "waterPlane",
2475
+ color1: "#0b1026",
2476
+ color2: "#3d5afe",
2477
+ color3: "#00e5ff",
2478
+ uDensity: 2.2,
2479
+ lightType: "env",
2480
+ envPreset: "city"
2481
+ }
2482
+ },
2483
+ {
2484
+ id: "sunset",
2485
+ title: "Sunset",
2486
+ config: {
2487
+ ...DEFAULT_SHADER_CURTAIN_CONFIG,
2488
+ type: "plane",
2489
+ color1: "#ff6a1a",
2490
+ color2: "#ffb347",
2491
+ color3: "#fd4912",
2492
+ cPolarAngle: 125,
2493
+ cDistance: 5
2494
+ }
2495
+ },
2496
+ {
2497
+ id: "mandarin",
2498
+ title: "Mandarin",
2499
+ config: {
2500
+ ...DEFAULT_SHADER_CURTAIN_CONFIG,
2501
+ type: "sphere",
2502
+ color1: "#ff7a33",
2503
+ color2: "#33a0ff",
2504
+ color3: "#ffc53d",
2505
+ uSpeed: 0.1,
2506
+ uStrength: 0.4,
2507
+ uDensity: 1.1,
2508
+ uAmplitude: 1.4
2509
+ }
2510
+ },
2511
+ {
2512
+ id: "cottonCandy",
2513
+ title: "Cotton candy",
2514
+ config: {
2515
+ ...DEFAULT_SHADER_CURTAIN_CONFIG,
2516
+ type: "sphere",
2517
+ color1: "#ffd1dc",
2518
+ color2: "#c5e1ff",
2519
+ color3: "#fff5ba",
2520
+ uSpeed: 0.15,
2521
+ grain: "on"
2522
+ }
2523
+ }
2524
+ ];
2525
+ var HEX = /^#([0-9a-fA-F]{6})$/;
2526
+ var ON_OFF = new Set(SHADER_ON_OFF);
2527
+ var TYPES = new Set(SHADER_CURTAIN_TYPES);
2528
+ var VARIANTS = new Set(SHADER_VARIANTS);
2529
+ var LIGHTS = new Set(SHADER_LIGHT_TYPES);
2530
+ var ENVS = new Set(SHADER_ENV_PRESETS);
2531
+ var RANGES = new Set(SHADER_RANGE);
2532
+ function clamp(value, min, max) {
2533
+ return Math.min(max, Math.max(min, value));
2534
+ }
2535
+ function numberParam(raw, fallback, min, max) {
2536
+ if (raw == null || raw === "") return fallback;
2537
+ const parsed = Number(raw);
2538
+ if (!Number.isFinite(parsed)) return fallback;
2539
+ return clamp(parsed, min, max);
2540
+ }
2541
+ function hexParam(raw, fallback) {
2542
+ if (!raw) return fallback;
2543
+ const value = raw.startsWith("#") ? raw : `#${raw}`;
2544
+ return HEX.test(value) ? value : fallback;
2545
+ }
2546
+ function enumParam(raw, allowed, fallback) {
2547
+ if (!raw) return fallback;
2548
+ return allowed.has(raw) ? raw : fallback;
2549
+ }
2550
+ function boolParam(raw, fallback) {
2551
+ if (raw == null) return fallback;
2552
+ if (raw === "true" || raw === "1" || raw === "on") return true;
2553
+ if (raw === "false" || raw === "0" || raw === "off") return false;
2554
+ return fallback;
2555
+ }
2556
+ function mergeShaderCurtainConfig(partial) {
2557
+ return { ...DEFAULT_SHADER_CURTAIN_CONFIG, ...partial };
2558
+ }
2559
+ function parseShaderGradientUrl(input) {
2560
+ const trimmed = input.trim();
2561
+ if (!trimmed) return null;
2562
+ let url;
2563
+ try {
2564
+ url = new URL(trimmed);
2565
+ } catch {
2566
+ try {
2567
+ url = new URL(`https://www.shadergradient.co/customize?${trimmed}`);
2568
+ } catch {
2569
+ return null;
2570
+ }
2571
+ }
2572
+ const q = url.searchParams;
2573
+ const known = [
2574
+ "type",
2575
+ "shader",
2576
+ "animate",
2577
+ "color1",
2578
+ "uSpeed",
2579
+ "uStrength",
2580
+ "cDistance",
2581
+ "lightType"
2582
+ ];
2583
+ if (!known.some((key) => q.has(key))) return null;
2584
+ const base = DEFAULT_SHADER_CURTAIN_CONFIG;
2585
+ return {
2586
+ type: enumParam(q.get("type"), TYPES, base.type),
2587
+ shader: enumParam(q.get("shader"), VARIANTS, base.shader),
2588
+ animate: enumParam(q.get("animate"), ON_OFF, base.animate),
2589
+ uTime: numberParam(q.get("uTime"), base.uTime, 0, 40),
2590
+ uSpeed: numberParam(q.get("uSpeed"), base.uSpeed, 0, 4),
2591
+ uStrength: numberParam(q.get("uStrength"), base.uStrength, 0, 10),
2592
+ uDensity: numberParam(q.get("uDensity"), base.uDensity, 0, 8),
2593
+ uFrequency: numberParam(q.get("uFrequency"), base.uFrequency, 0, 12),
2594
+ uAmplitude: numberParam(q.get("uAmplitude"), base.uAmplitude, 0, 8),
2595
+ wireframe: boolParam(q.get("wireframe"), base.wireframe),
2596
+ loop: enumParam(q.get("loop"), ON_OFF, base.loop),
2597
+ loopDuration: numberParam(q.get("loopDuration"), base.loopDuration, 1, 60),
2598
+ range: enumParam(q.get("range"), RANGES, base.range),
2599
+ rangeStart: numberParam(q.get("rangeStart"), base.rangeStart, 0, 40),
2600
+ rangeEnd: numberParam(q.get("rangeEnd"), base.rangeEnd, 0, 40),
2601
+ positionX: numberParam(q.get("positionX"), base.positionX, -20, 20),
2602
+ positionY: numberParam(q.get("positionY"), base.positionY, -20, 20),
2603
+ positionZ: numberParam(q.get("positionZ"), base.positionZ, -20, 20),
2604
+ rotationX: numberParam(q.get("rotationX"), base.rotationX, 0, 360),
2605
+ rotationY: numberParam(q.get("rotationY"), base.rotationY, 0, 360),
2606
+ rotationZ: numberParam(q.get("rotationZ"), base.rotationZ, 0, 360),
2607
+ color1: hexParam(q.get("color1"), base.color1),
2608
+ color2: hexParam(q.get("color2"), base.color2),
2609
+ color3: hexParam(q.get("color3"), base.color3),
2610
+ reflection: numberParam(q.get("reflection"), base.reflection, 0, 1),
2611
+ brightness: numberParam(q.get("brightness"), base.brightness, 0, 4),
2612
+ cAzimuthAngle: numberParam(
2613
+ q.get("cAzimuthAngle"),
2614
+ base.cAzimuthAngle,
2615
+ 0,
2616
+ 360
2617
+ ),
2618
+ cPolarAngle: numberParam(q.get("cPolarAngle"), base.cPolarAngle, 0, 180),
2619
+ cDistance: numberParam(q.get("cDistance"), base.cDistance, 0.1, 40),
2620
+ cameraZoom: numberParam(q.get("cameraZoom"), base.cameraZoom, 0.1, 50),
2621
+ fov: numberParam(q.get("fov"), base.fov, 10, 120),
2622
+ zoomOut: boolParam(q.get("zoomOut"), base.zoomOut),
2623
+ lightType: enumParam(q.get("lightType"), LIGHTS, base.lightType),
2624
+ envPreset: enumParam(q.get("envPreset"), ENVS, base.envPreset),
2625
+ grain: enumParam(q.get("grain"), ON_OFF, base.grain),
2626
+ grainBlending: numberParam(
2627
+ q.get("grainBlending"),
2628
+ base.grainBlending,
2629
+ 0,
2630
+ 1
2631
+ ),
2632
+ pixelDensity: numberParam(q.get("pixelDensity"), base.pixelDensity, 0.5, 2)
2633
+ };
2634
+ }
2635
+ function toShaderGradientUrl(config) {
2636
+ const params = new URLSearchParams();
2637
+ Object.keys(DEFAULT_SHADER_CURTAIN_CONFIG).forEach((key) => {
2638
+ params.set(key, String(config[key]));
2639
+ });
2640
+ return `https://www.shadergradient.co/customize?${params.toString()}`;
2641
+ }
2642
+ function isShaderCurtainKind(kind) {
2643
+ return kind === "shader";
2644
+ }
2645
+ function webglAvailable() {
2646
+ if (typeof document === "undefined") return false;
2647
+ try {
2648
+ const canvas = document.createElement("canvas");
2649
+ return Boolean(
2650
+ canvas.getContext("webgl") || canvas.getContext("experimental-webgl")
2651
+ );
2652
+ } catch {
2653
+ return false;
2654
+ }
2655
+ }
2656
+ function Poster({
2657
+ url,
2658
+ alt,
2659
+ className
2660
+ }) {
2661
+ if (!url) {
2662
+ return /* @__PURE__ */ jsx(
2663
+ "div",
2664
+ {
2665
+ className: cn("h-full w-full bg-zinc-950", className),
2666
+ "aria-hidden": alt ? void 0 : true
2667
+ }
2668
+ );
2669
+ }
2670
+ return /* @__PURE__ */ jsx(
2671
+ "img",
2672
+ {
2673
+ src: url,
2674
+ alt,
2675
+ className: cn("h-full w-full object-cover", className)
2676
+ }
2677
+ );
2678
+ }
2679
+ function ShaderCurtain({
2680
+ config,
2681
+ posterUrl,
2682
+ envBasePath,
2683
+ className,
2684
+ preserveDrawingBuffer = false,
2685
+ reducedMotion = false,
2686
+ alt = ""
2687
+ }) {
2688
+ const [module, setModule] = React11.useState(null);
2689
+ const [failed, setFailed] = React11.useState(false);
2690
+ const resolved = mergeShaderCurtainConfig(config);
2691
+ React11.useEffect(() => {
2692
+ if (reducedMotion || !webglAvailable()) {
2693
+ setFailed(true);
2694
+ return;
2695
+ }
2696
+ let cancelled = false;
2697
+ void import('@shadergradient/react').then((loaded) => {
2698
+ if (cancelled) return;
2699
+ if (!loaded.ShaderGradientCanvas || !loaded.ShaderGradient) {
2700
+ setFailed(true);
2701
+ return;
2702
+ }
2703
+ setModule(loaded);
2704
+ }).catch(() => {
2705
+ if (!cancelled) setFailed(true);
2706
+ });
2707
+ return () => {
2708
+ cancelled = true;
2709
+ };
2710
+ }, [reducedMotion]);
2711
+ if (failed || reducedMotion || !module) {
2712
+ return /* @__PURE__ */ jsx(Poster, { url: posterUrl, alt, className });
2713
+ }
2714
+ const { ShaderGradientCanvas, ShaderGradient } = module;
2715
+ const animate = resolved.animate === "off" || reducedMotion ? "off" : "on";
2716
+ return /* @__PURE__ */ jsx("div", { className: cn("relative h-full w-full overflow-hidden", className), children: /* @__PURE__ */ jsx(
2717
+ ShaderGradientCanvas,
2718
+ {
2719
+ style: { position: "absolute", inset: 0 },
2720
+ pixelDensity: resolved.pixelDensity,
2721
+ fov: resolved.fov,
2722
+ envBasePath,
2723
+ preserveDrawingBuffer,
2724
+ children: /* @__PURE__ */ jsx(
2725
+ ShaderGradient,
2726
+ {
2727
+ control: "props",
2728
+ type: resolved.type,
2729
+ shader: resolved.shader,
2730
+ animate,
2731
+ uTime: resolved.uTime,
2732
+ uSpeed: resolved.uSpeed,
2733
+ uStrength: resolved.uStrength,
2734
+ uDensity: resolved.uDensity,
2735
+ uFrequency: resolved.uFrequency,
2736
+ uAmplitude: resolved.uAmplitude,
2737
+ wireframe: resolved.wireframe,
2738
+ loop: resolved.loop,
2739
+ loopDuration: resolved.loopDuration,
2740
+ range: resolved.range,
2741
+ rangeStart: resolved.rangeStart,
2742
+ rangeEnd: resolved.rangeEnd,
2743
+ positionX: resolved.positionX,
2744
+ positionY: resolved.positionY,
2745
+ positionZ: resolved.positionZ,
2746
+ rotationX: resolved.rotationX,
2747
+ rotationY: resolved.rotationY,
2748
+ rotationZ: resolved.rotationZ,
2749
+ color1: resolved.color1,
2750
+ color2: resolved.color2,
2751
+ color3: resolved.color3,
2752
+ reflection: resolved.reflection,
2753
+ brightness: resolved.brightness,
2754
+ cAzimuthAngle: resolved.cAzimuthAngle,
2755
+ cPolarAngle: resolved.cPolarAngle,
2756
+ cDistance: resolved.cDistance,
2757
+ cameraZoom: resolved.cameraZoom,
2758
+ zoomOut: resolved.zoomOut,
2759
+ lightType: resolved.lightType,
2760
+ envPreset: resolved.envPreset,
2761
+ grain: resolved.grain,
2762
+ grainBlending: resolved.grainBlending
2763
+ }
2764
+ )
2765
+ }
2766
+ ) });
2767
+ }
2350
2768
  var DEFAULT_LABELS2 = {
2351
2769
  play: "Play",
2352
2770
  tapToUnmute: "Tap to unmute",
@@ -2379,8 +2797,8 @@ function probeVideoAudio(el) {
2379
2797
  return "unknown";
2380
2798
  }
2381
2799
  function usePrefersReducedMotion() {
2382
- const [reduced, setReduced] = React9.useState(false);
2383
- React9.useEffect(() => {
2800
+ const [reduced, setReduced] = React11.useState(false);
2801
+ React11.useEffect(() => {
2384
2802
  const media = window.matchMedia("(prefers-reduced-motion: reduce)");
2385
2803
  const sync = () => setReduced(media.matches);
2386
2804
  sync();
@@ -2397,11 +2815,11 @@ function CurtainVideo({
2397
2815
  allowSound,
2398
2816
  labels
2399
2817
  }) {
2400
- const videoRef = React9.useRef(null);
2401
- const [playback, setPlayback] = React9.useState("pending");
2402
- const [muted, setMuted] = React9.useState(true);
2403
- const [audio, setAudio] = React9.useState("unknown");
2404
- React9.useEffect(() => {
2818
+ const videoRef = React11.useRef(null);
2819
+ const [playback, setPlayback] = React11.useState("pending");
2820
+ const [muted, setMuted] = React11.useState(true);
2821
+ const [audio, setAudio] = React11.useState("unknown");
2822
+ React11.useEffect(() => {
2405
2823
  const el = videoRef.current;
2406
2824
  if (!el) return;
2407
2825
  el.setAttribute("webkit-playsinline", "");
@@ -2442,7 +2860,7 @@ function CurtainVideo({
2442
2860
  el.removeEventListener("loadedmetadata", applyAudio);
2443
2861
  };
2444
2862
  }, [url, freeze]);
2445
- const startPlayback = React9.useCallback(() => {
2863
+ const startPlayback = React11.useCallback(() => {
2446
2864
  const el = videoRef.current;
2447
2865
  if (!el) return;
2448
2866
  el.muted = true;
@@ -2458,7 +2876,7 @@ function CurtainVideo({
2458
2876
  }
2459
2877
  );
2460
2878
  }, []);
2461
- const setVideoMuted = React9.useCallback((next) => {
2879
+ const setVideoMuted = React11.useCallback((next) => {
2462
2880
  const el = videoRef.current;
2463
2881
  if (el) el.muted = next;
2464
2882
  setMuted(next);
@@ -2520,6 +2938,8 @@ function CurtainStage({
2520
2938
  url,
2521
2939
  alt = "",
2522
2940
  className,
2941
+ config,
2942
+ envBasePath,
2523
2943
  reducedMotion,
2524
2944
  allowSound = false,
2525
2945
  labels
@@ -2527,27 +2947,45 @@ function CurtainStage({
2527
2947
  const prefersReduced = usePrefersReducedMotion();
2528
2948
  const freeze = reducedMotion ?? prefersReduced;
2529
2949
  const copy = { ...DEFAULT_LABELS2, ...labels };
2530
- if (kind === "video") {
2531
- return /* @__PURE__ */ jsx(
2532
- CurtainVideo,
2533
- {
2534
- url,
2535
- alt,
2536
- className,
2537
- freeze,
2538
- allowSound,
2539
- labels: copy
2540
- }
2541
- );
2542
- }
2543
- return /* @__PURE__ */ jsx(
2544
- "img",
2545
- {
2546
- src: url,
2547
- alt,
2548
- className: cn("h-full w-full object-cover", className)
2950
+ switch (kind) {
2951
+ case "video":
2952
+ return /* @__PURE__ */ jsx(
2953
+ CurtainVideo,
2954
+ {
2955
+ url,
2956
+ alt,
2957
+ className,
2958
+ freeze,
2959
+ allowSound,
2960
+ labels: copy
2961
+ }
2962
+ );
2963
+ case "shader":
2964
+ return /* @__PURE__ */ jsx(
2965
+ ShaderCurtain,
2966
+ {
2967
+ config: mergeShaderCurtainConfig(config),
2968
+ posterUrl: url,
2969
+ envBasePath,
2970
+ reducedMotion: freeze,
2971
+ alt,
2972
+ className
2973
+ }
2974
+ );
2975
+ case "image":
2976
+ return /* @__PURE__ */ jsx(
2977
+ "img",
2978
+ {
2979
+ src: url,
2980
+ alt,
2981
+ className: cn("h-full w-full object-cover", className)
2982
+ }
2983
+ );
2984
+ default: {
2985
+ const _exhaustive = kind;
2986
+ return _exhaustive;
2549
2987
  }
2550
- );
2988
+ }
2551
2989
  }
2552
2990
  function useMediaQuery2(query) {
2553
2991
  const [matches, setMatches] = useState(false);
@@ -2565,9 +3003,9 @@ function isVideoKind(kind) {
2565
3003
  return kind === "video";
2566
3004
  }
2567
3005
  function useElementInView(enabled) {
2568
- const [node, setNode] = React9.useState(null);
2569
- const [inView, setInView] = React9.useState(false);
2570
- React9.useEffect(() => {
3006
+ const [node, setNode] = React11.useState(null);
3007
+ const [inView, setInView] = React11.useState(false);
3008
+ React11.useEffect(() => {
2571
3009
  if (!enabled || !node || typeof IntersectionObserver === "undefined") {
2572
3010
  setInView(false);
2573
3011
  return;
@@ -2635,9 +3073,11 @@ var DEFAULT_CURTAIN_PICKER_LABELS = {
2635
3073
  noneDescription: "Use the default curtain",
2636
3074
  defaultBadge: "Default",
2637
3075
  makeDefault: "Set as default",
3076
+ edit: "Edit",
2638
3077
  delete: "Delete",
2639
3078
  image: "Image",
2640
3079
  video: "Video",
3080
+ shader: "Shader",
2641
3081
  organization: "Organization",
2642
3082
  platform: "Catalog",
2643
3083
  groupOrganization: "Your curtains",
@@ -2662,7 +3102,9 @@ function ownerGroup(ownerType) {
2662
3102
  }
2663
3103
  }
2664
3104
  function kindLabel(kind, copy) {
2665
- return kind === "video" ? copy.video : copy.image;
3105
+ if (kind === "video") return copy.video;
3106
+ if (kind === "shader") return copy.shader;
3107
+ return copy.image;
2666
3108
  }
2667
3109
  function ownerLabel(ownerType, copy) {
2668
3110
  if (ownerType === "organization") return copy.organization;
@@ -2690,10 +3132,11 @@ function resolvePreviewItem(selectedId, ready, allowNone) {
2690
3132
  if (allowNone) return null;
2691
3133
  return ready[0] ?? null;
2692
3134
  }
2693
- function itemActions(item, onMakeDefault, onDelete, canMakeDefault, canDelete) {
3135
+ function itemActions(item, onMakeDefault, onEdit, onDelete, canMakeDefault, canDelete) {
2694
3136
  if (!item) return {};
2695
3137
  return {
2696
3138
  onMakeDefault: onMakeDefault && (canMakeDefault ? canMakeDefault(item) : !item.isDefault) ? () => onMakeDefault(item) : void 0,
3139
+ onEdit: onEdit ? () => onEdit(item) : void 0,
2697
3140
  onDelete: onDelete && (canDelete ? canDelete(item) : true) ? () => onDelete(item) : void 0
2698
3141
  };
2699
3142
  }
@@ -2730,6 +3173,7 @@ function CurtainPicker({
2730
3173
  variant = "default",
2731
3174
  groupByOwner = false,
2732
3175
  onMakeDefault,
3176
+ onEdit,
2733
3177
  onDelete,
2734
3178
  canMakeDefault,
2735
3179
  canDelete,
@@ -2739,7 +3183,7 @@ function CurtainPicker({
2739
3183
  actionsPending = false
2740
3184
  }) {
2741
3185
  const copy = { ...DEFAULT_CURTAIN_PICKER_LABELS, ...labels };
2742
- const groupName = React9.useId();
3186
+ const groupName = React11.useId();
2743
3187
  const selectable = typeof onChange === "function";
2744
3188
  const compact = variant === "compact";
2745
3189
  const selectedId = value === "" ? null : value ?? null;
@@ -2751,11 +3195,12 @@ function CurtainPicker({
2751
3195
  const compactActions = compact ? itemActions(
2752
3196
  actionTarget,
2753
3197
  onMakeDefault,
3198
+ onEdit,
2754
3199
  onDelete,
2755
3200
  canMakeDefault,
2756
3201
  canDelete
2757
3202
  ) : {};
2758
- const grouped = React9.useMemo(() => {
3203
+ const grouped = React11.useMemo(() => {
2759
3204
  if (!groupByOwner) {
2760
3205
  return [{ group: null, items: ready }];
2761
3206
  }
@@ -2796,6 +3241,7 @@ function CurtainPicker({
2796
3241
  disabled,
2797
3242
  actionsPending,
2798
3243
  onMakeDefault: compactActions.onMakeDefault,
3244
+ onEdit: compactActions.onEdit,
2799
3245
  onDelete: compactActions.onDelete
2800
3246
  }
2801
3247
  ) : null,
@@ -2818,13 +3264,23 @@ function CurtainPicker({
2818
3264
  onMakeDefault: compact ? void 0 : itemActions(
2819
3265
  item,
2820
3266
  onMakeDefault,
3267
+ onEdit,
2821
3268
  onDelete,
2822
3269
  canMakeDefault,
2823
3270
  canDelete
2824
3271
  ).onMakeDefault,
3272
+ onEdit: compact ? void 0 : itemActions(
3273
+ item,
3274
+ onMakeDefault,
3275
+ onEdit,
3276
+ onDelete,
3277
+ canMakeDefault,
3278
+ canDelete
3279
+ ).onEdit,
2825
3280
  onDelete: compact ? void 0 : itemActions(
2826
3281
  item,
2827
3282
  onMakeDefault,
3283
+ onEdit,
2828
3284
  onDelete,
2829
3285
  canMakeDefault,
2830
3286
  canDelete
@@ -2841,6 +3297,7 @@ function SelectedPreview({
2841
3297
  disabled,
2842
3298
  actionsPending,
2843
3299
  onMakeDefault,
3300
+ onEdit,
2844
3301
  onDelete
2845
3302
  }) {
2846
3303
  const owner = item ? ownerLabel(item.ownerType, copy) : null;
@@ -2884,6 +3341,7 @@ function SelectedPreview({
2884
3341
  actionsPending,
2885
3342
  copy,
2886
3343
  onMakeDefault,
3344
+ onEdit,
2887
3345
  onDelete
2888
3346
  }
2889
3347
  )
@@ -2908,9 +3366,10 @@ function ManageActions({
2908
3366
  actionsPending,
2909
3367
  copy,
2910
3368
  onMakeDefault,
3369
+ onEdit,
2911
3370
  onDelete
2912
3371
  }) {
2913
- if (!onMakeDefault && !onDelete) return null;
3372
+ if (!onMakeDefault && !onEdit && !onDelete) return null;
2914
3373
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
2915
3374
  onMakeDefault ? /* @__PURE__ */ jsx(
2916
3375
  Button,
@@ -2923,6 +3382,17 @@ function ManageActions({
2923
3382
  children: copy.makeDefault
2924
3383
  }
2925
3384
  ) : null,
3385
+ onEdit ? /* @__PURE__ */ jsx(
3386
+ Button,
3387
+ {
3388
+ type: "button",
3389
+ size: "sm",
3390
+ variant: "secondary",
3391
+ disabled: disabled || actionsPending,
3392
+ onClick: onEdit,
3393
+ children: copy.edit
3394
+ }
3395
+ ) : null,
2926
3396
  onDelete ? /* @__PURE__ */ jsx(
2927
3397
  Button,
2928
3398
  {
@@ -2987,6 +3457,7 @@ function CurtainPickerCard({
2987
3457
  compact,
2988
3458
  onSelect,
2989
3459
  onMakeDefault,
3460
+ onEdit,
2990
3461
  onDelete
2991
3462
  }) {
2992
3463
  const owner = ownerLabel(item.ownerType, copy);
@@ -3052,6 +3523,7 @@ function CurtainPickerCard({
3052
3523
  actionsPending,
3053
3524
  copy,
3054
3525
  onMakeDefault,
3526
+ onEdit,
3055
3527
  onDelete
3056
3528
  }
3057
3529
  )
@@ -3076,12 +3548,14 @@ function WaitingRoom({
3076
3548
  startsAt,
3077
3549
  durationSeconds,
3078
3550
  curtain,
3551
+ hideBranding = false,
3552
+ hideStatus = false,
3079
3553
  nowMs,
3080
3554
  labels,
3081
3555
  className
3082
3556
  }) {
3083
- const [now, setNow] = React9.useState(nowMs ?? Date.now());
3084
- React9.useEffect(() => {
3557
+ const [now, setNow] = React11.useState(nowMs ?? Date.now());
3558
+ React11.useEffect(() => {
3085
3559
  if (nowMs != null) {
3086
3560
  setNow(nowMs);
3087
3561
  return;
@@ -3104,12 +3578,18 @@ function WaitingRoom({
3104
3578
  {
3105
3579
  kind: curtain.kind,
3106
3580
  url: curtain.url,
3581
+ config: curtain.config,
3582
+ envBasePath: curtain.envBasePath,
3107
3583
  allowSound: true,
3108
3584
  className: "absolute inset-0"
3109
3585
  }
3110
3586
  ) : /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-br from-zinc-900 to-zinc-950" }),
3111
- /* @__PURE__ */ jsxs("div", { className: "relative z-10 flex w-full flex-col justify-end gap-3 bg-gradient-to-t from-black/70 via-black/30 to-transparent p-6", children: [
3112
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
3587
+ /* @__PURE__ */ jsxs("p", { className: "sr-only", role: "status", children: [
3588
+ title,
3589
+ remaining != null ? remaining > 0 ? ` ${labels?.startsIn ?? "Starts in"} ${formatCountdown(remaining)}` : ` ${labels?.started ?? "Starting soon"}` : ""
3590
+ ] }),
3591
+ hideBranding && hideStatus ? null : /* @__PURE__ */ jsxs("div", { className: "relative z-10 flex w-full flex-col justify-end gap-3 bg-gradient-to-t from-black/70 via-black/30 to-transparent p-6", children: [
3592
+ hideBranding ? null : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
3113
3593
  organizationImage ? /* @__PURE__ */ jsx(
3114
3594
  "img",
3115
3595
  {
@@ -3123,14 +3603,637 @@ function WaitingRoom({
3123
3603
  organizationName ? /* @__PURE__ */ jsx("p", { className: "text-sm text-white/80", children: organizationName }) : null
3124
3604
  ] })
3125
3605
  ] }),
3126
- remaining != null ? /* @__PURE__ */ jsx("p", { className: "text-sm tabular-nums", children: remaining > 0 ? `${labels?.startsIn ?? "Starts in"} ${formatCountdown(remaining)}` : labels?.started ?? "Starting soon" }) : null,
3127
- durationMinutes != null ? /* @__PURE__ */ jsx("p", { className: "text-xs text-white/70", children: labels?.duration ? labels.duration(durationMinutes) : `${durationMinutes} min` }) : null
3606
+ hideStatus ? null : remaining != null ? /* @__PURE__ */ jsx("p", { className: "text-sm tabular-nums", children: remaining > 0 ? `${labels?.startsIn ?? "Starts in"} ${formatCountdown(remaining)}` : labels?.started ?? "Starting soon" }) : null,
3607
+ hideStatus ? null : durationMinutes != null ? /* @__PURE__ */ jsx("p", { className: "text-xs text-white/70", children: labels?.duration ? labels.duration(durationMinutes) : `${durationMinutes} min` }) : null
3128
3608
  ] })
3129
3609
  ]
3130
3610
  }
3131
3611
  );
3132
3612
  }
3133
3613
 
3614
+ // src/components/video/captureShaderPoster.ts
3615
+ function canvasFromRoot(root) {
3616
+ return root.querySelector("canvas");
3617
+ }
3618
+ function captureShaderPoster(root, options = {}) {
3619
+ const canvas = canvasFromRoot(root);
3620
+ if (!canvas) return Promise.resolve(null);
3621
+ const type = options.type ?? "image/jpeg";
3622
+ const quality = options.quality ?? 0.92;
3623
+ return new Promise((resolve) => {
3624
+ canvas.toBlob(
3625
+ (blob) => resolve(blob),
3626
+ type,
3627
+ type === "image/jpeg" ? quality : void 0
3628
+ );
3629
+ });
3630
+ }
3631
+ var DEFAULT_SHADER_CURTAIN_EDITOR_LABELS = {
3632
+ shape: "Shape",
3633
+ colors: "Colors",
3634
+ light: "Light & effects",
3635
+ camera: "Camera",
3636
+ presets: "Presets",
3637
+ importUrl: "Paste a shadergradient.co URL",
3638
+ importApply: "Apply URL",
3639
+ importError: "Could not read that URL"
3640
+ };
3641
+ function NumberField({
3642
+ label,
3643
+ value,
3644
+ min,
3645
+ max,
3646
+ step,
3647
+ onChange
3648
+ }) {
3649
+ return /* @__PURE__ */ jsxs("label", { className: "grid gap-1 text-xs", children: [
3650
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: label }),
3651
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
3652
+ /* @__PURE__ */ jsx(
3653
+ "input",
3654
+ {
3655
+ type: "range",
3656
+ min,
3657
+ max,
3658
+ step,
3659
+ value,
3660
+ onChange: (event) => onChange(Number(event.target.value)),
3661
+ className: "min-w-0 flex-1"
3662
+ }
3663
+ ),
3664
+ /* @__PURE__ */ jsx(
3665
+ "input",
3666
+ {
3667
+ type: "number",
3668
+ min,
3669
+ max,
3670
+ step,
3671
+ value,
3672
+ onChange: (event) => onChange(Number(event.target.value)),
3673
+ className: "border-input bg-background w-16 shrink-0 rounded-md border px-2 py-1"
3674
+ }
3675
+ )
3676
+ ] })
3677
+ ] });
3678
+ }
3679
+ function SelectField({
3680
+ label,
3681
+ value,
3682
+ options,
3683
+ onChange
3684
+ }) {
3685
+ return /* @__PURE__ */ jsxs("label", { className: "grid gap-1 text-xs", children: [
3686
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: label }),
3687
+ /* @__PURE__ */ jsx(
3688
+ "select",
3689
+ {
3690
+ value,
3691
+ onChange: (event) => onChange(event.target.value),
3692
+ className: "border-input bg-background rounded-md border px-2 py-1",
3693
+ children: options.map((option) => /* @__PURE__ */ jsx("option", { value: option, children: option }, option))
3694
+ }
3695
+ )
3696
+ ] });
3697
+ }
3698
+ function ColorField({
3699
+ label,
3700
+ value,
3701
+ onChange
3702
+ }) {
3703
+ return /* @__PURE__ */ jsxs("label", { className: "grid gap-1 text-xs", children: [
3704
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: label }),
3705
+ /* @__PURE__ */ jsx(
3706
+ "input",
3707
+ {
3708
+ type: "color",
3709
+ value,
3710
+ onChange: (event) => onChange(event.target.value),
3711
+ className: "h-9 w-full cursor-pointer rounded-md border"
3712
+ }
3713
+ )
3714
+ ] });
3715
+ }
3716
+ var ShaderCurtainEditor = React11.forwardRef(function ShaderCurtainEditor2({ value, onChange, envBasePath, className, labels }, ref) {
3717
+ const copy = { ...DEFAULT_SHADER_CURTAIN_EDITOR_LABELS, ...labels };
3718
+ const [config, setConfig] = React11.useState(
3719
+ () => mergeShaderCurtainConfig(value)
3720
+ );
3721
+ const [tab, setTab] = React11.useState("shape");
3722
+ const [url, setUrl] = React11.useState("");
3723
+ const [urlError, setUrlError] = React11.useState(null);
3724
+ const previewRef = React11.useRef(null);
3725
+ const update = React11.useCallback(
3726
+ (patch) => {
3727
+ setConfig((current) => {
3728
+ const next = { ...current, ...patch };
3729
+ onChange?.(next);
3730
+ return next;
3731
+ });
3732
+ },
3733
+ [onChange]
3734
+ );
3735
+ const replace = React11.useCallback(
3736
+ (next) => {
3737
+ setConfig(next);
3738
+ onChange?.(next);
3739
+ },
3740
+ [onChange]
3741
+ );
3742
+ React11.useImperativeHandle(ref, () => ({
3743
+ getConfig: () => config,
3744
+ capturePoster: async () => {
3745
+ if (!previewRef.current) return null;
3746
+ return captureShaderPoster(previewRef.current);
3747
+ }
3748
+ }));
3749
+ const applyUrl = () => {
3750
+ const parsed = parseShaderGradientUrl(url);
3751
+ if (!parsed) {
3752
+ setUrlError(copy.importError);
3753
+ return;
3754
+ }
3755
+ setUrlError(null);
3756
+ replace(parsed);
3757
+ };
3758
+ return /* @__PURE__ */ jsxs(
3759
+ "div",
3760
+ {
3761
+ className: cn(
3762
+ "grid min-h-0 gap-4 md:grid-cols-2 md:items-start",
3763
+ className
3764
+ ),
3765
+ children: [
3766
+ /* @__PURE__ */ jsx(
3767
+ "div",
3768
+ {
3769
+ ref: previewRef,
3770
+ className: "relative aspect-video overflow-hidden rounded-lg bg-zinc-950 md:sticky md:top-0",
3771
+ children: /* @__PURE__ */ jsx(
3772
+ ShaderCurtain,
3773
+ {
3774
+ config,
3775
+ envBasePath,
3776
+ preserveDrawingBuffer: true,
3777
+ className: "absolute inset-0"
3778
+ }
3779
+ )
3780
+ }
3781
+ ),
3782
+ /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-col gap-3", children: [
3783
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: [
3784
+ ["shape", copy.shape],
3785
+ ["colors", copy.colors],
3786
+ ["light", copy.light],
3787
+ ["camera", copy.camera]
3788
+ ].map(([id, label]) => /* @__PURE__ */ jsx(
3789
+ Button,
3790
+ {
3791
+ type: "button",
3792
+ size: "sm",
3793
+ variant: tab === id ? "default" : "secondary",
3794
+ onClick: () => setTab(id),
3795
+ children: label
3796
+ },
3797
+ id
3798
+ )) }),
3799
+ /* @__PURE__ */ jsxs("div", { className: "min-h-0 max-h-[min(22rem,40dvh)] overflow-y-auto pr-1", children: [
3800
+ tab === "shape" ? /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
3801
+ /* @__PURE__ */ jsx(
3802
+ SelectField,
3803
+ {
3804
+ label: "Type",
3805
+ value: config.type,
3806
+ options: SHADER_CURTAIN_TYPES,
3807
+ onChange: (type) => update({ type })
3808
+ }
3809
+ ),
3810
+ /* @__PURE__ */ jsx(
3811
+ SelectField,
3812
+ {
3813
+ label: "Shader",
3814
+ value: config.shader,
3815
+ options: SHADER_VARIANTS,
3816
+ onChange: (shader) => update({ shader })
3817
+ }
3818
+ ),
3819
+ /* @__PURE__ */ jsx(
3820
+ SelectField,
3821
+ {
3822
+ label: "Animate",
3823
+ value: config.animate,
3824
+ options: ["on", "off"],
3825
+ onChange: (animate) => update({ animate })
3826
+ }
3827
+ ),
3828
+ /* @__PURE__ */ jsx(
3829
+ SelectField,
3830
+ {
3831
+ label: "Loop",
3832
+ value: config.loop,
3833
+ options: ["on", "off"],
3834
+ onChange: (loop) => update({ loop })
3835
+ }
3836
+ ),
3837
+ /* @__PURE__ */ jsx(
3838
+ NumberField,
3839
+ {
3840
+ label: "Speed",
3841
+ value: config.uSpeed,
3842
+ min: 0,
3843
+ max: 4,
3844
+ step: 0.05,
3845
+ onChange: (uSpeed) => update({ uSpeed })
3846
+ }
3847
+ ),
3848
+ /* @__PURE__ */ jsx(
3849
+ NumberField,
3850
+ {
3851
+ label: "Strength",
3852
+ value: config.uStrength,
3853
+ min: 0,
3854
+ max: 10,
3855
+ step: 0.1,
3856
+ onChange: (uStrength) => update({ uStrength })
3857
+ }
3858
+ ),
3859
+ /* @__PURE__ */ jsx(
3860
+ NumberField,
3861
+ {
3862
+ label: "Density",
3863
+ value: config.uDensity,
3864
+ min: 0,
3865
+ max: 8,
3866
+ step: 0.1,
3867
+ onChange: (uDensity) => update({ uDensity })
3868
+ }
3869
+ ),
3870
+ /* @__PURE__ */ jsx(
3871
+ NumberField,
3872
+ {
3873
+ label: "Frequency",
3874
+ value: config.uFrequency,
3875
+ min: 0,
3876
+ max: 12,
3877
+ step: 0.1,
3878
+ onChange: (uFrequency) => update({ uFrequency })
3879
+ }
3880
+ ),
3881
+ /* @__PURE__ */ jsx(
3882
+ NumberField,
3883
+ {
3884
+ label: "Amplitude",
3885
+ value: config.uAmplitude,
3886
+ min: 0,
3887
+ max: 8,
3888
+ step: 0.1,
3889
+ onChange: (uAmplitude) => update({ uAmplitude })
3890
+ }
3891
+ ),
3892
+ /* @__PURE__ */ jsx(
3893
+ NumberField,
3894
+ {
3895
+ label: "Time",
3896
+ value: config.uTime,
3897
+ min: 0,
3898
+ max: 40,
3899
+ step: 0.1,
3900
+ onChange: (uTime) => update({ uTime })
3901
+ }
3902
+ ),
3903
+ /* @__PURE__ */ jsx(
3904
+ NumberField,
3905
+ {
3906
+ label: "Loop duration",
3907
+ value: config.loopDuration,
3908
+ min: 1,
3909
+ max: 60,
3910
+ step: 1,
3911
+ onChange: (loopDuration) => update({ loopDuration })
3912
+ }
3913
+ ),
3914
+ /* @__PURE__ */ jsx(
3915
+ SelectField,
3916
+ {
3917
+ label: "Range",
3918
+ value: config.range,
3919
+ options: ["enabled", "disabled"],
3920
+ onChange: (range) => update({ range })
3921
+ }
3922
+ ),
3923
+ /* @__PURE__ */ jsx(
3924
+ NumberField,
3925
+ {
3926
+ label: "Range start",
3927
+ value: config.rangeStart,
3928
+ min: 0,
3929
+ max: 40,
3930
+ step: 0.1,
3931
+ onChange: (rangeStart) => update({ rangeStart })
3932
+ }
3933
+ ),
3934
+ /* @__PURE__ */ jsx(
3935
+ NumberField,
3936
+ {
3937
+ label: "Range end",
3938
+ value: config.rangeEnd,
3939
+ min: 0,
3940
+ max: 40,
3941
+ step: 0.1,
3942
+ onChange: (rangeEnd) => update({ rangeEnd })
3943
+ }
3944
+ ),
3945
+ /* @__PURE__ */ jsxs("label", { className: "col-span-2 flex items-center gap-2 text-xs", children: [
3946
+ /* @__PURE__ */ jsx(
3947
+ "input",
3948
+ {
3949
+ type: "checkbox",
3950
+ checked: config.wireframe,
3951
+ onChange: (event) => update({ wireframe: event.target.checked })
3952
+ }
3953
+ ),
3954
+ "Wireframe"
3955
+ ] })
3956
+ ] }) : null,
3957
+ tab === "colors" ? /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
3958
+ /* @__PURE__ */ jsx(
3959
+ ColorField,
3960
+ {
3961
+ label: "Color 1",
3962
+ value: config.color1,
3963
+ onChange: (color1) => update({ color1 })
3964
+ }
3965
+ ),
3966
+ /* @__PURE__ */ jsx(
3967
+ ColorField,
3968
+ {
3969
+ label: "Color 2",
3970
+ value: config.color2,
3971
+ onChange: (color2) => update({ color2 })
3972
+ }
3973
+ ),
3974
+ /* @__PURE__ */ jsx(
3975
+ ColorField,
3976
+ {
3977
+ label: "Color 3",
3978
+ value: config.color3,
3979
+ onChange: (color3) => update({ color3 })
3980
+ }
3981
+ ),
3982
+ /* @__PURE__ */ jsx(
3983
+ NumberField,
3984
+ {
3985
+ label: "Reflection",
3986
+ value: config.reflection,
3987
+ min: 0,
3988
+ max: 1,
3989
+ step: 0.05,
3990
+ onChange: (reflection) => update({ reflection })
3991
+ }
3992
+ ),
3993
+ /* @__PURE__ */ jsx(
3994
+ NumberField,
3995
+ {
3996
+ label: "Brightness",
3997
+ value: config.brightness,
3998
+ min: 0,
3999
+ max: 4,
4000
+ step: 0.05,
4001
+ onChange: (brightness) => update({ brightness })
4002
+ }
4003
+ )
4004
+ ] }) : null,
4005
+ tab === "light" ? /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
4006
+ /* @__PURE__ */ jsx(
4007
+ SelectField,
4008
+ {
4009
+ label: "Light",
4010
+ value: config.lightType,
4011
+ options: SHADER_LIGHT_TYPES,
4012
+ onChange: (lightType) => update({ lightType })
4013
+ }
4014
+ ),
4015
+ /* @__PURE__ */ jsx(
4016
+ SelectField,
4017
+ {
4018
+ label: "Environment",
4019
+ value: config.envPreset,
4020
+ options: SHADER_ENV_PRESETS,
4021
+ onChange: (envPreset) => update({ envPreset })
4022
+ }
4023
+ ),
4024
+ /* @__PURE__ */ jsx(
4025
+ SelectField,
4026
+ {
4027
+ label: "Grain",
4028
+ value: config.grain,
4029
+ options: ["on", "off"],
4030
+ onChange: (grain) => update({ grain })
4031
+ }
4032
+ ),
4033
+ /* @__PURE__ */ jsx(
4034
+ NumberField,
4035
+ {
4036
+ label: "Grain blending",
4037
+ value: config.grainBlending,
4038
+ min: 0,
4039
+ max: 1,
4040
+ step: 0.05,
4041
+ onChange: (grainBlending) => update({ grainBlending })
4042
+ }
4043
+ )
4044
+ ] }) : null,
4045
+ tab === "camera" ? /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
4046
+ /* @__PURE__ */ jsx(
4047
+ NumberField,
4048
+ {
4049
+ label: "Azimuth",
4050
+ value: config.cAzimuthAngle,
4051
+ min: 0,
4052
+ max: 360,
4053
+ step: 1,
4054
+ onChange: (cAzimuthAngle) => update({ cAzimuthAngle })
4055
+ }
4056
+ ),
4057
+ /* @__PURE__ */ jsx(
4058
+ NumberField,
4059
+ {
4060
+ label: "Polar",
4061
+ value: config.cPolarAngle,
4062
+ min: 0,
4063
+ max: 180,
4064
+ step: 1,
4065
+ onChange: (cPolarAngle) => update({ cPolarAngle })
4066
+ }
4067
+ ),
4068
+ /* @__PURE__ */ jsx(
4069
+ NumberField,
4070
+ {
4071
+ label: "Distance",
4072
+ value: config.cDistance,
4073
+ min: 0.1,
4074
+ max: 40,
4075
+ step: 0.1,
4076
+ onChange: (cDistance) => update({ cDistance })
4077
+ }
4078
+ ),
4079
+ /* @__PURE__ */ jsx(
4080
+ NumberField,
4081
+ {
4082
+ label: "Zoom",
4083
+ value: config.cameraZoom,
4084
+ min: 0.1,
4085
+ max: 50,
4086
+ step: 0.1,
4087
+ onChange: (cameraZoom) => update({ cameraZoom })
4088
+ }
4089
+ ),
4090
+ /* @__PURE__ */ jsx(
4091
+ NumberField,
4092
+ {
4093
+ label: "FOV",
4094
+ value: config.fov,
4095
+ min: 10,
4096
+ max: 120,
4097
+ step: 1,
4098
+ onChange: (fov) => update({ fov })
4099
+ }
4100
+ ),
4101
+ /* @__PURE__ */ jsx(
4102
+ NumberField,
4103
+ {
4104
+ label: "Pixel density",
4105
+ value: config.pixelDensity,
4106
+ min: 0.5,
4107
+ max: 2,
4108
+ step: 0.1,
4109
+ onChange: (pixelDensity) => update({ pixelDensity })
4110
+ }
4111
+ ),
4112
+ /* @__PURE__ */ jsx(
4113
+ NumberField,
4114
+ {
4115
+ label: "Position X",
4116
+ value: config.positionX,
4117
+ min: -20,
4118
+ max: 20,
4119
+ step: 0.1,
4120
+ onChange: (positionX) => update({ positionX })
4121
+ }
4122
+ ),
4123
+ /* @__PURE__ */ jsx(
4124
+ NumberField,
4125
+ {
4126
+ label: "Position Y",
4127
+ value: config.positionY,
4128
+ min: -20,
4129
+ max: 20,
4130
+ step: 0.1,
4131
+ onChange: (positionY) => update({ positionY })
4132
+ }
4133
+ ),
4134
+ /* @__PURE__ */ jsx(
4135
+ NumberField,
4136
+ {
4137
+ label: "Position Z",
4138
+ value: config.positionZ,
4139
+ min: -20,
4140
+ max: 20,
4141
+ step: 0.1,
4142
+ onChange: (positionZ) => update({ positionZ })
4143
+ }
4144
+ ),
4145
+ /* @__PURE__ */ jsx(
4146
+ NumberField,
4147
+ {
4148
+ label: "Rotation X",
4149
+ value: config.rotationX,
4150
+ min: 0,
4151
+ max: 360,
4152
+ step: 1,
4153
+ onChange: (rotationX) => update({ rotationX })
4154
+ }
4155
+ ),
4156
+ /* @__PURE__ */ jsx(
4157
+ NumberField,
4158
+ {
4159
+ label: "Rotation Y",
4160
+ value: config.rotationY,
4161
+ min: 0,
4162
+ max: 360,
4163
+ step: 1,
4164
+ onChange: (rotationY) => update({ rotationY })
4165
+ }
4166
+ ),
4167
+ /* @__PURE__ */ jsx(
4168
+ NumberField,
4169
+ {
4170
+ label: "Rotation Z",
4171
+ value: config.rotationZ,
4172
+ min: 0,
4173
+ max: 360,
4174
+ step: 1,
4175
+ onChange: (rotationZ) => update({ rotationZ })
4176
+ }
4177
+ ),
4178
+ /* @__PURE__ */ jsxs("label", { className: "col-span-2 flex items-center gap-2 text-xs", children: [
4179
+ /* @__PURE__ */ jsx(
4180
+ "input",
4181
+ {
4182
+ type: "checkbox",
4183
+ checked: config.zoomOut,
4184
+ onChange: (event) => update({ zoomOut: event.target.checked })
4185
+ }
4186
+ ),
4187
+ "Zoom out"
4188
+ ] })
4189
+ ] }) : null
4190
+ ] }),
4191
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
4192
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: copy.presets }),
4193
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: SHADER_CURTAIN_PRESETS.map((preset) => /* @__PURE__ */ jsx(
4194
+ Button,
4195
+ {
4196
+ type: "button",
4197
+ size: "sm",
4198
+ variant: "secondary",
4199
+ onClick: () => replace(preset.config),
4200
+ children: preset.title
4201
+ },
4202
+ preset.id
4203
+ )) })
4204
+ ] }),
4205
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
4206
+ /* @__PURE__ */ jsxs("label", { className: "grid gap-1 text-xs", children: [
4207
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: copy.importUrl }),
4208
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
4209
+ /* @__PURE__ */ jsx(
4210
+ "input",
4211
+ {
4212
+ value: url,
4213
+ onChange: (event) => setUrl(event.target.value),
4214
+ className: "border-input bg-background min-w-0 flex-1 rounded-md border px-2 py-1"
4215
+ }
4216
+ ),
4217
+ /* @__PURE__ */ jsx(
4218
+ Button,
4219
+ {
4220
+ type: "button",
4221
+ size: "sm",
4222
+ variant: "secondary",
4223
+ onClick: applyUrl,
4224
+ children: copy.importApply
4225
+ }
4226
+ )
4227
+ ] })
4228
+ ] }),
4229
+ urlError ? /* @__PURE__ */ jsx("p", { className: "text-destructive text-xs", role: "alert", children: urlError }) : null
4230
+ ] })
4231
+ ] })
4232
+ ]
4233
+ }
4234
+ );
4235
+ });
4236
+
3134
4237
  // src/components/video/castHls.ts
3135
4238
  var CAST_SENDER_SRC = "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";
3136
4239
  var DEFAULT_RECEIVER_ID = "CC1AD845";
@@ -3271,22 +4374,22 @@ function SeekBar({
3271
4374
  onSeek,
3272
4375
  formatTime: formatTime2
3273
4376
  }) {
3274
- const trackRef = React9.useRef(null);
3275
- const [hoverTime, setHoverTime] = React9.useState(null);
3276
- const [cues, setCues] = React9.useState(null);
3277
- const loadedSrc = React9.useRef(null);
3278
- React9.useEffect(() => {
4377
+ const trackRef = React11.useRef(null);
4378
+ const [hoverTime, setHoverTime] = React11.useState(null);
4379
+ const [cues, setCues] = React11.useState(null);
4380
+ const loadedSrc = React11.useRef(null);
4381
+ React11.useEffect(() => {
3279
4382
  setCues(null);
3280
4383
  loadedSrc.current = null;
3281
4384
  }, [src]);
3282
- const ensureCues = React9.useCallback(() => {
4385
+ const ensureCues = React11.useCallback(() => {
3283
4386
  if (loadedSrc.current === src) return;
3284
4387
  loadedSrc.current = src;
3285
4388
  void loadThumbnailsVtt(src).then((next) => {
3286
4389
  setCues(next);
3287
4390
  });
3288
4391
  }, [src]);
3289
- const updateHover = React9.useCallback(
4392
+ const updateHover = React11.useCallback(
3290
4393
  (clientX) => {
3291
4394
  const rect = trackRef.current?.getBoundingClientRect();
3292
4395
  if (!rect) return;
@@ -3890,40 +4993,40 @@ function useHlsPlayback({
3890
4993
  onRebuffer,
3891
4994
  onQualityChange
3892
4995
  }) {
3893
- const videoRef = React9.useRef(null);
3894
- const hlsRef = React9.useRef(null);
3895
- const [state, setState] = React9.useState("idle");
3896
- const [qualities, setQualities] = React9.useState([]);
3897
- const [activeLevel, setActiveLevel] = React9.useState(-1);
3898
- const [autoplayState, setAutoplayState] = React9.useState("none");
3899
- const [error, setError] = React9.useState(null);
3900
- const [reloadKey, setReloadKey] = React9.useState(0);
3901
- const [sealed, setSealed] = React9.useState(false);
3902
- const modeRef = React9.useRef(mode);
3903
- const lastSrcRef = React9.useRef(src);
3904
- const sealedRef = React9.useRef(false);
3905
- const sawLiveRef = React9.useRef(false);
3906
- const sealedDuringSessionRef = React9.useRef(false);
3907
- React9.useEffect(() => {
4996
+ const videoRef = React11.useRef(null);
4997
+ const hlsRef = React11.useRef(null);
4998
+ const [state, setState] = React11.useState("idle");
4999
+ const [qualities, setQualities] = React11.useState([]);
5000
+ const [activeLevel, setActiveLevel] = React11.useState(-1);
5001
+ const [autoplayState, setAutoplayState] = React11.useState("none");
5002
+ const [error, setError] = React11.useState(null);
5003
+ const [reloadKey, setReloadKey] = React11.useState(0);
5004
+ const [sealed, setSealed] = React11.useState(false);
5005
+ const modeRef = React11.useRef(mode);
5006
+ const lastSrcRef = React11.useRef(src);
5007
+ const sealedRef = React11.useRef(false);
5008
+ const sawLiveRef = React11.useRef(false);
5009
+ const sealedDuringSessionRef = React11.useRef(false);
5010
+ React11.useEffect(() => {
3908
5011
  modeRef.current = mode;
3909
5012
  }, [mode]);
3910
- const onErrorRef = React9.useRef(onError);
3911
- const onPlayingChangeRef = React9.useRef(onPlayingChange);
3912
- const onRebufferRef = React9.useRef(onRebuffer);
3913
- const onQualityChangeRef = React9.useRef(onQualityChange);
3914
- React9.useEffect(() => {
5013
+ const onErrorRef = React11.useRef(onError);
5014
+ const onPlayingChangeRef = React11.useRef(onPlayingChange);
5015
+ const onRebufferRef = React11.useRef(onRebuffer);
5016
+ const onQualityChangeRef = React11.useRef(onQualityChange);
5017
+ React11.useEffect(() => {
3915
5018
  onErrorRef.current = onError;
3916
5019
  onPlayingChangeRef.current = onPlayingChange;
3917
5020
  onRebufferRef.current = onRebuffer;
3918
5021
  onQualityChangeRef.current = onQualityChange;
3919
5022
  }, [onError, onPlayingChange, onRebuffer, onQualityChange]);
3920
- const retry = React9.useCallback(() => {
5023
+ const retry = React11.useCallback(() => {
3921
5024
  setError(null);
3922
5025
  setState("loading");
3923
5026
  setAutoplayState("none");
3924
5027
  setReloadKey((k) => k + 1);
3925
5028
  }, []);
3926
- React9.useEffect(() => {
5029
+ React11.useEffect(() => {
3927
5030
  const media = videoRef.current;
3928
5031
  if (!media || !src || !active) {
3929
5032
  setState("idle");
@@ -4270,7 +5373,7 @@ function useHlsPlayback({
4270
5373
  destroyHls();
4271
5374
  };
4272
5375
  }, [src, active, autoPlay, muted, reloadKey]);
4273
- const setLevel = React9.useCallback((index) => {
5376
+ const setLevel = React11.useCallback((index) => {
4274
5377
  const hls = hlsRef.current;
4275
5378
  if (!hls) return;
4276
5379
  hls.nextLevel = index;
@@ -4310,9 +5413,9 @@ function isEmbeddedWindow(win = window) {
4310
5413
  }
4311
5414
  }
4312
5415
  function CaptionOverlay({ screen }) {
4313
- const lastSpeakerRef = React9.useRef(void 0);
5416
+ const lastSpeakerRef = React11.useRef(void 0);
4314
5417
  const lastSpeaker = lastSpeakerRef.current;
4315
- React9.useLayoutEffect(() => {
5418
+ React11.useLayoutEffect(() => {
4316
5419
  if (screen?.speaker != null) lastSpeakerRef.current = screen.speaker;
4317
5420
  }, [screen]);
4318
5421
  if (!screen) return null;
@@ -4505,19 +5608,19 @@ function VideoPlayer({
4505
5608
  liveCaptionsBaseUrl
4506
5609
  }) {
4507
5610
  const t = { ...DEFAULT_LABELS3, ...labels };
4508
- const containerRef = React9.useRef(null);
4509
- const firstPlayFiredRef = React9.useRef(false);
4510
- const lastProgressAtRef = React9.useRef(-PROGRESS_THROTTLE_MS);
4511
- const onPlaybackProgressRef = React9.useRef(onPlaybackProgress);
5611
+ const containerRef = React11.useRef(null);
5612
+ const firstPlayFiredRef = React11.useRef(false);
5613
+ const lastProgressAtRef = React11.useRef(-PROGRESS_THROTTLE_MS);
5614
+ const onPlaybackProgressRef = React11.useRef(onPlaybackProgress);
4512
5615
  onPlaybackProgressRef.current = onPlaybackProgress;
4513
- const applyingTrackModesRef = React9.useRef(false);
4514
- const captionLocaleRef = React9.useRef("off");
4515
- const cssFullscreenRef = React9.useRef(false);
4516
- const webkitFsRef = React9.useRef(false);
4517
- const [userStarted, setUserStarted] = React9.useState(false);
5616
+ const applyingTrackModesRef = React11.useRef(false);
5617
+ const captionLocaleRef = React11.useRef("off");
5618
+ const cssFullscreenRef = React11.useRef(false);
5619
+ const webkitFsRef = React11.useRef(false);
5620
+ const [userStarted, setUserStarted] = React11.useState(false);
4518
5621
  const active = autoPlay || !poster || userStarted;
4519
5622
  const autoplayActive = autoPlay || userStarted;
4520
- const handlePlayingChange = React9.useCallback(
5623
+ const handlePlayingChange = React11.useCallback(
4521
5624
  (playing) => {
4522
5625
  setIsPlaying(playing);
4523
5626
  if (playing && !firstPlayFiredRef.current) {
@@ -4549,45 +5652,45 @@ function VideoPlayer({
4549
5652
  onRebuffer,
4550
5653
  onQualityChange
4551
5654
  });
4552
- const [isPlaying, setIsPlaying] = React9.useState(false);
4553
- const [isMuted, setIsMuted] = React9.useState(muted);
4554
- const isMutedRef = React9.useRef(isMuted);
5655
+ const [isPlaying, setIsPlaying] = React11.useState(false);
5656
+ const [isMuted, setIsMuted] = React11.useState(muted);
5657
+ const isMutedRef = React11.useRef(isMuted);
4555
5658
  isMutedRef.current = isMuted;
4556
- const [volume, setVolume] = React9.useState(1);
4557
- const [currentTime, setCurrentTime] = React9.useState(0);
4558
- const [duration, setDuration] = React9.useState(0);
4559
- const [buffered, setBuffered] = React9.useState(0);
4560
- const [isFullscreen, setIsFullscreen] = React9.useState(false);
4561
- const [pipActive, setPipActive] = React9.useState(false);
4562
- const [controlsVisible, setControlsVisible] = React9.useState(true);
4563
- const [playbackRate, setPlaybackRate] = React9.useState(1);
4564
- const [openMenu, setOpenMenu] = React9.useState(null);
4565
- const [morePane, setMorePane] = React9.useState(
5659
+ const [volume, setVolume] = React11.useState(1);
5660
+ const [currentTime, setCurrentTime] = React11.useState(0);
5661
+ const [duration, setDuration] = React11.useState(0);
5662
+ const [buffered, setBuffered] = React11.useState(0);
5663
+ const [isFullscreen, setIsFullscreen] = React11.useState(false);
5664
+ const [pipActive, setPipActive] = React11.useState(false);
5665
+ const [controlsVisible, setControlsVisible] = React11.useState(true);
5666
+ const [playbackRate, setPlaybackRate] = React11.useState(1);
5667
+ const [openMenu, setOpenMenu] = React11.useState(null);
5668
+ const [morePane, setMorePane] = React11.useState(
4566
5669
  "root"
4567
5670
  );
4568
- const [compactChrome, setCompactChrome] = React9.useState(false);
4569
- const [captionLocale, setCaptionLocale] = React9.useState(defaultCaptionLocale ?? "off");
4570
- const [captionCues, setCaptionCues] = React9.useState([]);
4571
- const [liveCaptionCues, setLiveCaptionCues] = React9.useState([]);
4572
- const [livePlayout, setLivePlayout] = React9.useState(
5671
+ const [compactChrome, setCompactChrome] = React11.useState(false);
5672
+ const [captionLocale, setCaptionLocale] = React11.useState(defaultCaptionLocale ?? "off");
5673
+ const [captionCues, setCaptionCues] = React11.useState([]);
5674
+ const [liveCaptionCues, setLiveCaptionCues] = React11.useState([]);
5675
+ const [livePlayout, setLivePlayout] = React11.useState(
4573
5676
  EMPTY_LIVE_CAPTION_PLAYOUT
4574
5677
  );
4575
- const [liveLagMs, setLiveLagMs] = React9.useState(null);
4576
- const [behindLive, setBehindLive] = React9.useState(false);
4577
- const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React9.useState(false);
4578
- const [embedded, setEmbedded] = React9.useState(false);
4579
- const [cssFullscreen, setCssFullscreen] = React9.useState(false);
4580
- const [webkitNativeFs, setWebkitNativeFs] = React9.useState(false);
4581
- const hideTimerRef = React9.useRef(null);
4582
- const liveCaptionCuesRef = React9.useRef(liveCaptionCues);
4583
- const liveLagMsRef = React9.useRef(liveLagMs);
4584
- const compactChromeRef = React9.useRef(compactChrome);
5678
+ const [liveLagMs, setLiveLagMs] = React11.useState(null);
5679
+ const [behindLive, setBehindLive] = React11.useState(false);
5680
+ const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React11.useState(false);
5681
+ const [embedded, setEmbedded] = React11.useState(false);
5682
+ const [cssFullscreen, setCssFullscreen] = React11.useState(false);
5683
+ const [webkitNativeFs, setWebkitNativeFs] = React11.useState(false);
5684
+ const hideTimerRef = React11.useRef(null);
5685
+ const liveCaptionCuesRef = React11.useRef(liveCaptionCues);
5686
+ const liveLagMsRef = React11.useRef(liveLagMs);
5687
+ const compactChromeRef = React11.useRef(compactChrome);
4585
5688
  liveCaptionCuesRef.current = liveCaptionCues;
4586
5689
  liveLagMsRef.current = liveLagMs;
4587
5690
  compactChromeRef.current = compactChrome;
4588
5691
  cssFullscreenRef.current = cssFullscreen;
4589
5692
  captionLocaleRef.current = captionLocale;
4590
- React9.useEffect(() => {
5693
+ React11.useEffect(() => {
4591
5694
  const el = containerRef.current;
4592
5695
  if (!el || typeof ResizeObserver === "undefined") return;
4593
5696
  const apply = (width) => {
@@ -4602,12 +5705,12 @@ function VideoPlayer({
4602
5705
  observer.observe(el);
4603
5706
  return () => observer.disconnect();
4604
5707
  }, [active]);
4605
- React9.useEffect(() => {
5708
+ React11.useEffect(() => {
4606
5709
  if (openMenu !== "more") setMorePane("root");
4607
5710
  }, [openMenu]);
4608
5711
  const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
4609
5712
  const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported || !embedded;
4610
- React9.useEffect(() => {
5713
+ React11.useEffect(() => {
4611
5714
  const video = videoRef.current;
4612
5715
  if (!video || !active) return;
4613
5716
  const onTimeUpdate = () => {
@@ -4666,22 +5769,22 @@ function VideoPlayer({
4666
5769
  video.removeEventListener("playing", onPlaying);
4667
5770
  };
4668
5771
  }, [videoRef, active, effectiveMode, liveCaptionsBaseUrl]);
4669
- React9.useLayoutEffect(() => {
5772
+ React11.useLayoutEffect(() => {
4670
5773
  const video = videoRef.current;
4671
5774
  if (video) video.muted = isMuted;
4672
5775
  }, [isMuted, active, videoRef]);
4673
- React9.useEffect(() => {
5776
+ React11.useEffect(() => {
4674
5777
  const video = videoRef.current;
4675
5778
  if (!paused || !video || !isPlaying) return;
4676
5779
  video.pause();
4677
5780
  }, [paused, videoRef, isPlaying]);
4678
- React9.useEffect(() => {
5781
+ React11.useEffect(() => {
4679
5782
  setEmbedded(isEmbeddedWindow());
4680
5783
  setWebkitFullscreenSupported(hasWebkitVideoFullscreen(videoRef.current));
4681
5784
  videoRef.current?.setAttribute("x-webkit-airplay", "allow");
4682
5785
  videoRef.current?.setAttribute("webkit-playsinline", "");
4683
5786
  }, [videoRef, active]);
4684
- React9.useEffect(() => {
5787
+ React11.useEffect(() => {
4685
5788
  const onFsChange = () => {
4686
5789
  if (document.fullscreenElement === containerRef.current) {
4687
5790
  setIsFullscreen(true);
@@ -4713,7 +5816,7 @@ function VideoPlayer({
4713
5816
  );
4714
5817
  }
4715
5818
  }
4716
- React9.useEffect(() => {
5819
+ React11.useEffect(() => {
4717
5820
  const video = asWebkitVideo(videoRef.current);
4718
5821
  if (!video) return;
4719
5822
  const onBegin = () => {
@@ -4735,7 +5838,7 @@ function VideoPlayer({
4735
5838
  video.removeEventListener("webkitendfullscreen", onEnd);
4736
5839
  };
4737
5840
  }, [videoRef, active]);
4738
- React9.useEffect(() => {
5841
+ React11.useEffect(() => {
4739
5842
  if (!cssFullscreen) return;
4740
5843
  const previousOverflow = document.body.style.overflow;
4741
5844
  document.body.style.overflow = "hidden";
@@ -4750,7 +5853,7 @@ function VideoPlayer({
4750
5853
  document.removeEventListener("keydown", onKey);
4751
5854
  };
4752
5855
  }, [cssFullscreen]);
4753
- React9.useEffect(() => {
5856
+ React11.useEffect(() => {
4754
5857
  const video = videoRef.current;
4755
5858
  if (!video) return;
4756
5859
  const onEnter = () => setPipActive(true);
@@ -4762,23 +5865,23 @@ function VideoPlayer({
4762
5865
  video.removeEventListener("leavepictureinpicture", onLeave);
4763
5866
  };
4764
5867
  }, [videoRef]);
4765
- const scheduleHide = React9.useCallback(() => {
5868
+ const scheduleHide = React11.useCallback(() => {
4766
5869
  if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
4767
5870
  hideTimerRef.current = setTimeout(() => {
4768
5871
  setControlsVisible(false);
4769
5872
  setOpenMenu(null);
4770
5873
  }, CONTROLS_HIDE_MS);
4771
5874
  }, []);
4772
- const revealControls = React9.useCallback(() => {
5875
+ const revealControls = React11.useCallback(() => {
4773
5876
  setControlsVisible(true);
4774
5877
  scheduleHide();
4775
5878
  }, [scheduleHide]);
4776
- React9.useEffect(() => {
5879
+ React11.useEffect(() => {
4777
5880
  return () => {
4778
5881
  if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
4779
5882
  };
4780
5883
  }, []);
4781
- React9.useEffect(() => {
5884
+ React11.useEffect(() => {
4782
5885
  if (captionLocale === "off") {
4783
5886
  setCaptionCues([]);
4784
5887
  setLiveCaptionCues([]);
@@ -4813,7 +5916,7 @@ function VideoPlayer({
4813
5916
  window.clearInterval(timer);
4814
5917
  };
4815
5918
  }, [captionLocale, liveCaptionsBaseUrl, src]);
4816
- React9.useEffect(() => {
5919
+ React11.useEffect(() => {
4817
5920
  if (!liveCaptionsBaseUrl || captionLocale === "off") {
4818
5921
  setLivePlayout(EMPTY_LIVE_CAPTION_PLAYOUT);
4819
5922
  return;
@@ -4835,7 +5938,7 @@ function VideoPlayer({
4835
5938
  }, [liveCaptionsBaseUrl, captionLocale]);
4836
5939
  const captionWrapWidth = compactChrome ? CAPTION_COMPACT_CHARS_PER_LINE : CAPTION_MAX_CHARS_PER_LINE;
4837
5940
  const captionScreen = liveCaptionsBaseUrl ? livePlayout.screen : captionScreenAtTime(captionCues, currentTime, captionWrapWidth);
4838
- React9.useEffect(() => {
5941
+ React11.useEffect(() => {
4839
5942
  const video = videoRef.current;
4840
5943
  if (!video || !liveCaptionsBaseUrl) return;
4841
5944
  try {
@@ -4857,12 +5960,12 @@ function VideoPlayer({
4857
5960
  t.captionsEs,
4858
5961
  t.captionsPt
4859
5962
  ]);
4860
- React9.useEffect(() => {
5963
+ React11.useEffect(() => {
4861
5964
  const video = videoRef.current;
4862
5965
  if (!video) return;
4863
5966
  applyNativeTrackModes(video, captionLocale, webkitFsRef.current);
4864
5967
  }, [videoRef, active, captionLocale, src]);
4865
- React9.useEffect(() => {
5968
+ React11.useEffect(() => {
4866
5969
  const video = videoRef.current;
4867
5970
  if (!video) return;
4868
5971
  const onChange = () => {
@@ -4876,7 +5979,7 @@ function VideoPlayer({
4876
5979
  };
4877
5980
  return listenTextTracksChange(video.textTracks, onChange);
4878
5981
  }, [videoRef, active, src, liveCaptionsBaseUrl]);
4879
- React9.useEffect(() => {
5982
+ React11.useEffect(() => {
4880
5983
  const video = videoRef.current;
4881
5984
  if (!video || captionLocale === "off" || !liveCaptionsBaseUrl) return;
4882
5985
  const track = findSubtitleTrack(video, captionLocale);
@@ -5625,16 +6728,16 @@ function videoInPictureInPicture(container) {
5625
6728
  return container.contains(pip);
5626
6729
  }
5627
6730
  function useFeedExclusivePlayback(playbackId) {
5628
- const containerRef = React9.useRef(null);
5629
- const [forcePaused, setForcePaused] = React9.useState(false);
5630
- const requestPause = React9.useCallback(() => {
6731
+ const containerRef = React11.useRef(null);
6732
+ const [forcePaused, setForcePaused] = React11.useState(false);
6733
+ const requestPause = React11.useCallback(() => {
5631
6734
  if (videoInPictureInPicture(containerRef.current)) return;
5632
6735
  setForcePaused(true);
5633
6736
  }, []);
5634
- React9.useEffect(() => {
6737
+ React11.useEffect(() => {
5635
6738
  return registerFeedPlayer(playbackId, requestPause);
5636
6739
  }, [playbackId, requestPause]);
5637
- React9.useEffect(() => {
6740
+ React11.useEffect(() => {
5638
6741
  const node = containerRef.current;
5639
6742
  if (!node || typeof IntersectionObserver === "undefined") return;
5640
6743
  const observer = new IntersectionObserver(
@@ -5650,14 +6753,14 @@ function useFeedExclusivePlayback(playbackId) {
5650
6753
  observer.observe(node);
5651
6754
  return () => observer.disconnect();
5652
6755
  }, [requestPause]);
5653
- React9.useEffect(() => {
6756
+ React11.useEffect(() => {
5654
6757
  const onVisibility = () => {
5655
6758
  if (document.hidden) requestPause();
5656
6759
  };
5657
6760
  document.addEventListener("visibilitychange", onVisibility);
5658
6761
  return () => document.removeEventListener("visibilitychange", onVisibility);
5659
6762
  }, [requestPause]);
5660
- const onPlayingChange = React9.useCallback(
6763
+ const onPlayingChange = React11.useCallback(
5661
6764
  (playing) => {
5662
6765
  if (!playing) return;
5663
6766
  setForcePaused(false);
@@ -5684,7 +6787,7 @@ function FeedVideoPlayer({
5684
6787
  paused: exclusivePaused,
5685
6788
  onPlayingChange: onExclusivePlayingChange
5686
6789
  } = useFeedExclusivePlayback(playbackId);
5687
- const handlePlayingChange = React9.useCallback(
6790
+ const handlePlayingChange = React11.useCallback(
5688
6791
  (playing) => {
5689
6792
  onExclusivePlayingChange(playing);
5690
6793
  onPlayingChange?.(playing);
@@ -5711,8 +6814,8 @@ function FeedVideoPlayer({
5711
6814
  );
5712
6815
  }
5713
6816
  function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {}) {
5714
- const [stats, setStats] = React9.useState({});
5715
- React9.useEffect(() => {
6817
+ const [stats, setStats] = React11.useState({});
6818
+ React11.useEffect(() => {
5716
6819
  if (!statsUrl || !enabled) return;
5717
6820
  let cancelled = false;
5718
6821
  const controller = new AbortController();
@@ -6790,6 +7893,6 @@ function MetricSkeleton({ className, bars = 4 }) {
6790
7893
  );
6791
7894
  }
6792
7895
 
6793
- 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 };
7896
+ 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, DEFAULT_SHADER_CURTAIN_CONFIG, DEFAULT_SHADER_CURTAIN_EDITOR_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, SHADER_CURTAIN_PRESETS, SafeImage, ShaderCurtain, ShaderCurtainEditor, SparklineStat, StatHighlightCard, TIME_RANGE_OPTIONS, ThemeSwitcher, TimeRangePicker, VideoPlayer, WaitingRoom, avatarFallbackStyle, captionsVttUrlFromPlayback, captureShaderPoster, castHlsUrl, cn, createLiveHlsConfig, createMultipartUploadController, createPlaybackBeaconClient, createVodHlsConfig, defaultLanguages, describeAvResync, describePlaybackError, fileMatchesAccept, getAvatarColors, getInitials, isCaptionLocale, isShaderCurtainKind, loadCastSender, mergeShaderCurtainConfig, parseShaderGradientUrl, partRanges, progressFromBytes, shouldRetryLiveEdge404, toShaderGradientUrl, useEditableSection, useFeedExclusivePlayback, useHlsPlayback, useLanguageContext, useMediaQuery2 as useMediaQuery, usePlaybackStats };
6794
7897
  //# sourceMappingURL=index.js.map
6795
7898
  //# sourceMappingURL=index.js.map