@livo-tv/blocks 1.28.0 → 1.30.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 +1323 -215
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +121 -5
- package/dist/index.d.ts +121 -5
- package/dist/index.js +1248 -150
- package/dist/index.js.map +1 -1
- package/package.json +22 -2
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import * as
|
|
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 {
|
|
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 =
|
|
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] =
|
|
2383
|
-
|
|
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 =
|
|
2401
|
-
const [playback, setPlayback] =
|
|
2402
|
-
const [muted, setMuted] =
|
|
2403
|
-
const [audio, setAudio] =
|
|
2404
|
-
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
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] =
|
|
2569
|
-
const [inView, setInView] =
|
|
2570
|
-
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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] =
|
|
3084
|
-
|
|
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("
|
|
3112
|
-
|
|
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,627 @@ 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__ */ jsx(
|
|
3652
|
+
"input",
|
|
3653
|
+
{
|
|
3654
|
+
type: "range",
|
|
3655
|
+
min,
|
|
3656
|
+
max,
|
|
3657
|
+
step,
|
|
3658
|
+
value,
|
|
3659
|
+
onChange: (event) => onChange(Number(event.target.value))
|
|
3660
|
+
}
|
|
3661
|
+
),
|
|
3662
|
+
/* @__PURE__ */ jsx(
|
|
3663
|
+
"input",
|
|
3664
|
+
{
|
|
3665
|
+
type: "number",
|
|
3666
|
+
min,
|
|
3667
|
+
max,
|
|
3668
|
+
step,
|
|
3669
|
+
value,
|
|
3670
|
+
onChange: (event) => onChange(Number(event.target.value)),
|
|
3671
|
+
className: "border-input bg-background rounded-md border px-2 py-1"
|
|
3672
|
+
}
|
|
3673
|
+
)
|
|
3674
|
+
] });
|
|
3675
|
+
}
|
|
3676
|
+
function SelectField({
|
|
3677
|
+
label,
|
|
3678
|
+
value,
|
|
3679
|
+
options,
|
|
3680
|
+
onChange
|
|
3681
|
+
}) {
|
|
3682
|
+
return /* @__PURE__ */ jsxs("label", { className: "grid gap-1 text-xs", children: [
|
|
3683
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: label }),
|
|
3684
|
+
/* @__PURE__ */ jsx(
|
|
3685
|
+
"select",
|
|
3686
|
+
{
|
|
3687
|
+
value,
|
|
3688
|
+
onChange: (event) => onChange(event.target.value),
|
|
3689
|
+
className: "border-input bg-background rounded-md border px-2 py-1",
|
|
3690
|
+
children: options.map((option) => /* @__PURE__ */ jsx("option", { value: option, children: option }, option))
|
|
3691
|
+
}
|
|
3692
|
+
)
|
|
3693
|
+
] });
|
|
3694
|
+
}
|
|
3695
|
+
function ColorField({
|
|
3696
|
+
label,
|
|
3697
|
+
value,
|
|
3698
|
+
onChange
|
|
3699
|
+
}) {
|
|
3700
|
+
return /* @__PURE__ */ jsxs("label", { className: "grid gap-1 text-xs", children: [
|
|
3701
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: label }),
|
|
3702
|
+
/* @__PURE__ */ jsx(
|
|
3703
|
+
"input",
|
|
3704
|
+
{
|
|
3705
|
+
type: "color",
|
|
3706
|
+
value,
|
|
3707
|
+
onChange: (event) => onChange(event.target.value),
|
|
3708
|
+
className: "h-9 w-full cursor-pointer rounded-md border"
|
|
3709
|
+
}
|
|
3710
|
+
)
|
|
3711
|
+
] });
|
|
3712
|
+
}
|
|
3713
|
+
var ShaderCurtainEditor = React11.forwardRef(function ShaderCurtainEditor2({ value, onChange, envBasePath, className, labels }, ref) {
|
|
3714
|
+
const copy = { ...DEFAULT_SHADER_CURTAIN_EDITOR_LABELS, ...labels };
|
|
3715
|
+
const [config, setConfig] = React11.useState(
|
|
3716
|
+
() => mergeShaderCurtainConfig(value)
|
|
3717
|
+
);
|
|
3718
|
+
const [tab, setTab] = React11.useState("shape");
|
|
3719
|
+
const [url, setUrl] = React11.useState("");
|
|
3720
|
+
const [urlError, setUrlError] = React11.useState(null);
|
|
3721
|
+
const previewRef = React11.useRef(null);
|
|
3722
|
+
const update = React11.useCallback(
|
|
3723
|
+
(patch) => {
|
|
3724
|
+
setConfig((current) => {
|
|
3725
|
+
const next = { ...current, ...patch };
|
|
3726
|
+
onChange?.(next);
|
|
3727
|
+
return next;
|
|
3728
|
+
});
|
|
3729
|
+
},
|
|
3730
|
+
[onChange]
|
|
3731
|
+
);
|
|
3732
|
+
const replace = React11.useCallback(
|
|
3733
|
+
(next) => {
|
|
3734
|
+
setConfig(next);
|
|
3735
|
+
onChange?.(next);
|
|
3736
|
+
},
|
|
3737
|
+
[onChange]
|
|
3738
|
+
);
|
|
3739
|
+
React11.useImperativeHandle(ref, () => ({
|
|
3740
|
+
getConfig: () => config,
|
|
3741
|
+
capturePoster: async () => {
|
|
3742
|
+
if (!previewRef.current) return null;
|
|
3743
|
+
return captureShaderPoster(previewRef.current);
|
|
3744
|
+
}
|
|
3745
|
+
}));
|
|
3746
|
+
const applyUrl = () => {
|
|
3747
|
+
const parsed = parseShaderGradientUrl(url);
|
|
3748
|
+
if (!parsed) {
|
|
3749
|
+
setUrlError(copy.importError);
|
|
3750
|
+
return;
|
|
3751
|
+
}
|
|
3752
|
+
setUrlError(null);
|
|
3753
|
+
replace(parsed);
|
|
3754
|
+
};
|
|
3755
|
+
return /* @__PURE__ */ jsxs(
|
|
3756
|
+
"div",
|
|
3757
|
+
{
|
|
3758
|
+
className: cn("grid gap-4 lg:grid-cols-[minmax(0,1fr)_20rem]", className),
|
|
3759
|
+
children: [
|
|
3760
|
+
/* @__PURE__ */ jsx(
|
|
3761
|
+
"div",
|
|
3762
|
+
{
|
|
3763
|
+
ref: previewRef,
|
|
3764
|
+
className: "relative aspect-video overflow-hidden rounded-lg bg-zinc-950",
|
|
3765
|
+
children: /* @__PURE__ */ jsx(
|
|
3766
|
+
ShaderCurtain,
|
|
3767
|
+
{
|
|
3768
|
+
config,
|
|
3769
|
+
envBasePath,
|
|
3770
|
+
preserveDrawingBuffer: true,
|
|
3771
|
+
className: "absolute inset-0"
|
|
3772
|
+
}
|
|
3773
|
+
)
|
|
3774
|
+
}
|
|
3775
|
+
),
|
|
3776
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
3777
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: [
|
|
3778
|
+
["shape", copy.shape],
|
|
3779
|
+
["colors", copy.colors],
|
|
3780
|
+
["light", copy.light],
|
|
3781
|
+
["camera", copy.camera]
|
|
3782
|
+
].map(([id, label]) => /* @__PURE__ */ jsx(
|
|
3783
|
+
Button,
|
|
3784
|
+
{
|
|
3785
|
+
type: "button",
|
|
3786
|
+
size: "sm",
|
|
3787
|
+
variant: tab === id ? "default" : "secondary",
|
|
3788
|
+
onClick: () => setTab(id),
|
|
3789
|
+
children: label
|
|
3790
|
+
},
|
|
3791
|
+
id
|
|
3792
|
+
)) }),
|
|
3793
|
+
tab === "shape" ? /* @__PURE__ */ jsxs("div", { className: "grid gap-3", children: [
|
|
3794
|
+
/* @__PURE__ */ jsx(
|
|
3795
|
+
SelectField,
|
|
3796
|
+
{
|
|
3797
|
+
label: "Type",
|
|
3798
|
+
value: config.type,
|
|
3799
|
+
options: SHADER_CURTAIN_TYPES,
|
|
3800
|
+
onChange: (type) => update({ type })
|
|
3801
|
+
}
|
|
3802
|
+
),
|
|
3803
|
+
/* @__PURE__ */ jsx(
|
|
3804
|
+
SelectField,
|
|
3805
|
+
{
|
|
3806
|
+
label: "Shader",
|
|
3807
|
+
value: config.shader,
|
|
3808
|
+
options: SHADER_VARIANTS,
|
|
3809
|
+
onChange: (shader) => update({ shader })
|
|
3810
|
+
}
|
|
3811
|
+
),
|
|
3812
|
+
/* @__PURE__ */ jsx(
|
|
3813
|
+
SelectField,
|
|
3814
|
+
{
|
|
3815
|
+
label: "Animate",
|
|
3816
|
+
value: config.animate,
|
|
3817
|
+
options: ["on", "off"],
|
|
3818
|
+
onChange: (animate) => update({ animate })
|
|
3819
|
+
}
|
|
3820
|
+
),
|
|
3821
|
+
/* @__PURE__ */ jsx(
|
|
3822
|
+
SelectField,
|
|
3823
|
+
{
|
|
3824
|
+
label: "Loop",
|
|
3825
|
+
value: config.loop,
|
|
3826
|
+
options: ["on", "off"],
|
|
3827
|
+
onChange: (loop) => update({ loop })
|
|
3828
|
+
}
|
|
3829
|
+
),
|
|
3830
|
+
/* @__PURE__ */ jsx(
|
|
3831
|
+
NumberField,
|
|
3832
|
+
{
|
|
3833
|
+
label: "Speed",
|
|
3834
|
+
value: config.uSpeed,
|
|
3835
|
+
min: 0,
|
|
3836
|
+
max: 4,
|
|
3837
|
+
step: 0.05,
|
|
3838
|
+
onChange: (uSpeed) => update({ uSpeed })
|
|
3839
|
+
}
|
|
3840
|
+
),
|
|
3841
|
+
/* @__PURE__ */ jsx(
|
|
3842
|
+
NumberField,
|
|
3843
|
+
{
|
|
3844
|
+
label: "Strength",
|
|
3845
|
+
value: config.uStrength,
|
|
3846
|
+
min: 0,
|
|
3847
|
+
max: 10,
|
|
3848
|
+
step: 0.1,
|
|
3849
|
+
onChange: (uStrength) => update({ uStrength })
|
|
3850
|
+
}
|
|
3851
|
+
),
|
|
3852
|
+
/* @__PURE__ */ jsx(
|
|
3853
|
+
NumberField,
|
|
3854
|
+
{
|
|
3855
|
+
label: "Density",
|
|
3856
|
+
value: config.uDensity,
|
|
3857
|
+
min: 0,
|
|
3858
|
+
max: 8,
|
|
3859
|
+
step: 0.1,
|
|
3860
|
+
onChange: (uDensity) => update({ uDensity })
|
|
3861
|
+
}
|
|
3862
|
+
),
|
|
3863
|
+
/* @__PURE__ */ jsx(
|
|
3864
|
+
NumberField,
|
|
3865
|
+
{
|
|
3866
|
+
label: "Frequency",
|
|
3867
|
+
value: config.uFrequency,
|
|
3868
|
+
min: 0,
|
|
3869
|
+
max: 12,
|
|
3870
|
+
step: 0.1,
|
|
3871
|
+
onChange: (uFrequency) => update({ uFrequency })
|
|
3872
|
+
}
|
|
3873
|
+
),
|
|
3874
|
+
/* @__PURE__ */ jsx(
|
|
3875
|
+
NumberField,
|
|
3876
|
+
{
|
|
3877
|
+
label: "Amplitude",
|
|
3878
|
+
value: config.uAmplitude,
|
|
3879
|
+
min: 0,
|
|
3880
|
+
max: 8,
|
|
3881
|
+
step: 0.1,
|
|
3882
|
+
onChange: (uAmplitude) => update({ uAmplitude })
|
|
3883
|
+
}
|
|
3884
|
+
),
|
|
3885
|
+
/* @__PURE__ */ jsx(
|
|
3886
|
+
NumberField,
|
|
3887
|
+
{
|
|
3888
|
+
label: "Time",
|
|
3889
|
+
value: config.uTime,
|
|
3890
|
+
min: 0,
|
|
3891
|
+
max: 40,
|
|
3892
|
+
step: 0.1,
|
|
3893
|
+
onChange: (uTime) => update({ uTime })
|
|
3894
|
+
}
|
|
3895
|
+
),
|
|
3896
|
+
/* @__PURE__ */ jsx(
|
|
3897
|
+
NumberField,
|
|
3898
|
+
{
|
|
3899
|
+
label: "Loop duration",
|
|
3900
|
+
value: config.loopDuration,
|
|
3901
|
+
min: 1,
|
|
3902
|
+
max: 60,
|
|
3903
|
+
step: 1,
|
|
3904
|
+
onChange: (loopDuration) => update({ loopDuration })
|
|
3905
|
+
}
|
|
3906
|
+
),
|
|
3907
|
+
/* @__PURE__ */ jsx(
|
|
3908
|
+
SelectField,
|
|
3909
|
+
{
|
|
3910
|
+
label: "Range",
|
|
3911
|
+
value: config.range,
|
|
3912
|
+
options: ["enabled", "disabled"],
|
|
3913
|
+
onChange: (range) => update({ range })
|
|
3914
|
+
}
|
|
3915
|
+
),
|
|
3916
|
+
/* @__PURE__ */ jsx(
|
|
3917
|
+
NumberField,
|
|
3918
|
+
{
|
|
3919
|
+
label: "Range start",
|
|
3920
|
+
value: config.rangeStart,
|
|
3921
|
+
min: 0,
|
|
3922
|
+
max: 40,
|
|
3923
|
+
step: 0.1,
|
|
3924
|
+
onChange: (rangeStart) => update({ rangeStart })
|
|
3925
|
+
}
|
|
3926
|
+
),
|
|
3927
|
+
/* @__PURE__ */ jsx(
|
|
3928
|
+
NumberField,
|
|
3929
|
+
{
|
|
3930
|
+
label: "Range end",
|
|
3931
|
+
value: config.rangeEnd,
|
|
3932
|
+
min: 0,
|
|
3933
|
+
max: 40,
|
|
3934
|
+
step: 0.1,
|
|
3935
|
+
onChange: (rangeEnd) => update({ rangeEnd })
|
|
3936
|
+
}
|
|
3937
|
+
),
|
|
3938
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-xs", children: [
|
|
3939
|
+
/* @__PURE__ */ jsx(
|
|
3940
|
+
"input",
|
|
3941
|
+
{
|
|
3942
|
+
type: "checkbox",
|
|
3943
|
+
checked: config.wireframe,
|
|
3944
|
+
onChange: (event) => update({ wireframe: event.target.checked })
|
|
3945
|
+
}
|
|
3946
|
+
),
|
|
3947
|
+
"Wireframe"
|
|
3948
|
+
] })
|
|
3949
|
+
] }) : null,
|
|
3950
|
+
tab === "colors" ? /* @__PURE__ */ jsxs("div", { className: "grid gap-3", children: [
|
|
3951
|
+
/* @__PURE__ */ jsx(
|
|
3952
|
+
ColorField,
|
|
3953
|
+
{
|
|
3954
|
+
label: "Color 1",
|
|
3955
|
+
value: config.color1,
|
|
3956
|
+
onChange: (color1) => update({ color1 })
|
|
3957
|
+
}
|
|
3958
|
+
),
|
|
3959
|
+
/* @__PURE__ */ jsx(
|
|
3960
|
+
ColorField,
|
|
3961
|
+
{
|
|
3962
|
+
label: "Color 2",
|
|
3963
|
+
value: config.color2,
|
|
3964
|
+
onChange: (color2) => update({ color2 })
|
|
3965
|
+
}
|
|
3966
|
+
),
|
|
3967
|
+
/* @__PURE__ */ jsx(
|
|
3968
|
+
ColorField,
|
|
3969
|
+
{
|
|
3970
|
+
label: "Color 3",
|
|
3971
|
+
value: config.color3,
|
|
3972
|
+
onChange: (color3) => update({ color3 })
|
|
3973
|
+
}
|
|
3974
|
+
),
|
|
3975
|
+
/* @__PURE__ */ jsx(
|
|
3976
|
+
NumberField,
|
|
3977
|
+
{
|
|
3978
|
+
label: "Reflection",
|
|
3979
|
+
value: config.reflection,
|
|
3980
|
+
min: 0,
|
|
3981
|
+
max: 1,
|
|
3982
|
+
step: 0.05,
|
|
3983
|
+
onChange: (reflection) => update({ reflection })
|
|
3984
|
+
}
|
|
3985
|
+
),
|
|
3986
|
+
/* @__PURE__ */ jsx(
|
|
3987
|
+
NumberField,
|
|
3988
|
+
{
|
|
3989
|
+
label: "Brightness",
|
|
3990
|
+
value: config.brightness,
|
|
3991
|
+
min: 0,
|
|
3992
|
+
max: 4,
|
|
3993
|
+
step: 0.05,
|
|
3994
|
+
onChange: (brightness) => update({ brightness })
|
|
3995
|
+
}
|
|
3996
|
+
)
|
|
3997
|
+
] }) : null,
|
|
3998
|
+
tab === "light" ? /* @__PURE__ */ jsxs("div", { className: "grid gap-3", children: [
|
|
3999
|
+
/* @__PURE__ */ jsx(
|
|
4000
|
+
SelectField,
|
|
4001
|
+
{
|
|
4002
|
+
label: "Light",
|
|
4003
|
+
value: config.lightType,
|
|
4004
|
+
options: SHADER_LIGHT_TYPES,
|
|
4005
|
+
onChange: (lightType) => update({ lightType })
|
|
4006
|
+
}
|
|
4007
|
+
),
|
|
4008
|
+
/* @__PURE__ */ jsx(
|
|
4009
|
+
SelectField,
|
|
4010
|
+
{
|
|
4011
|
+
label: "Environment",
|
|
4012
|
+
value: config.envPreset,
|
|
4013
|
+
options: SHADER_ENV_PRESETS,
|
|
4014
|
+
onChange: (envPreset) => update({ envPreset })
|
|
4015
|
+
}
|
|
4016
|
+
),
|
|
4017
|
+
/* @__PURE__ */ jsx(
|
|
4018
|
+
SelectField,
|
|
4019
|
+
{
|
|
4020
|
+
label: "Grain",
|
|
4021
|
+
value: config.grain,
|
|
4022
|
+
options: ["on", "off"],
|
|
4023
|
+
onChange: (grain) => update({ grain })
|
|
4024
|
+
}
|
|
4025
|
+
),
|
|
4026
|
+
/* @__PURE__ */ jsx(
|
|
4027
|
+
NumberField,
|
|
4028
|
+
{
|
|
4029
|
+
label: "Grain blending",
|
|
4030
|
+
value: config.grainBlending,
|
|
4031
|
+
min: 0,
|
|
4032
|
+
max: 1,
|
|
4033
|
+
step: 0.05,
|
|
4034
|
+
onChange: (grainBlending) => update({ grainBlending })
|
|
4035
|
+
}
|
|
4036
|
+
)
|
|
4037
|
+
] }) : null,
|
|
4038
|
+
tab === "camera" ? /* @__PURE__ */ jsxs("div", { className: "grid gap-3", children: [
|
|
4039
|
+
/* @__PURE__ */ jsx(
|
|
4040
|
+
NumberField,
|
|
4041
|
+
{
|
|
4042
|
+
label: "Azimuth",
|
|
4043
|
+
value: config.cAzimuthAngle,
|
|
4044
|
+
min: 0,
|
|
4045
|
+
max: 360,
|
|
4046
|
+
step: 1,
|
|
4047
|
+
onChange: (cAzimuthAngle) => update({ cAzimuthAngle })
|
|
4048
|
+
}
|
|
4049
|
+
),
|
|
4050
|
+
/* @__PURE__ */ jsx(
|
|
4051
|
+
NumberField,
|
|
4052
|
+
{
|
|
4053
|
+
label: "Polar",
|
|
4054
|
+
value: config.cPolarAngle,
|
|
4055
|
+
min: 0,
|
|
4056
|
+
max: 180,
|
|
4057
|
+
step: 1,
|
|
4058
|
+
onChange: (cPolarAngle) => update({ cPolarAngle })
|
|
4059
|
+
}
|
|
4060
|
+
),
|
|
4061
|
+
/* @__PURE__ */ jsx(
|
|
4062
|
+
NumberField,
|
|
4063
|
+
{
|
|
4064
|
+
label: "Distance",
|
|
4065
|
+
value: config.cDistance,
|
|
4066
|
+
min: 0.1,
|
|
4067
|
+
max: 40,
|
|
4068
|
+
step: 0.1,
|
|
4069
|
+
onChange: (cDistance) => update({ cDistance })
|
|
4070
|
+
}
|
|
4071
|
+
),
|
|
4072
|
+
/* @__PURE__ */ jsx(
|
|
4073
|
+
NumberField,
|
|
4074
|
+
{
|
|
4075
|
+
label: "Zoom",
|
|
4076
|
+
value: config.cameraZoom,
|
|
4077
|
+
min: 0.1,
|
|
4078
|
+
max: 50,
|
|
4079
|
+
step: 0.1,
|
|
4080
|
+
onChange: (cameraZoom) => update({ cameraZoom })
|
|
4081
|
+
}
|
|
4082
|
+
),
|
|
4083
|
+
/* @__PURE__ */ jsx(
|
|
4084
|
+
NumberField,
|
|
4085
|
+
{
|
|
4086
|
+
label: "FOV",
|
|
4087
|
+
value: config.fov,
|
|
4088
|
+
min: 10,
|
|
4089
|
+
max: 120,
|
|
4090
|
+
step: 1,
|
|
4091
|
+
onChange: (fov) => update({ fov })
|
|
4092
|
+
}
|
|
4093
|
+
),
|
|
4094
|
+
/* @__PURE__ */ jsx(
|
|
4095
|
+
NumberField,
|
|
4096
|
+
{
|
|
4097
|
+
label: "Pixel density",
|
|
4098
|
+
value: config.pixelDensity,
|
|
4099
|
+
min: 0.5,
|
|
4100
|
+
max: 2,
|
|
4101
|
+
step: 0.1,
|
|
4102
|
+
onChange: (pixelDensity) => update({ pixelDensity })
|
|
4103
|
+
}
|
|
4104
|
+
),
|
|
4105
|
+
/* @__PURE__ */ jsx(
|
|
4106
|
+
NumberField,
|
|
4107
|
+
{
|
|
4108
|
+
label: "Position X",
|
|
4109
|
+
value: config.positionX,
|
|
4110
|
+
min: -20,
|
|
4111
|
+
max: 20,
|
|
4112
|
+
step: 0.1,
|
|
4113
|
+
onChange: (positionX) => update({ positionX })
|
|
4114
|
+
}
|
|
4115
|
+
),
|
|
4116
|
+
/* @__PURE__ */ jsx(
|
|
4117
|
+
NumberField,
|
|
4118
|
+
{
|
|
4119
|
+
label: "Position Y",
|
|
4120
|
+
value: config.positionY,
|
|
4121
|
+
min: -20,
|
|
4122
|
+
max: 20,
|
|
4123
|
+
step: 0.1,
|
|
4124
|
+
onChange: (positionY) => update({ positionY })
|
|
4125
|
+
}
|
|
4126
|
+
),
|
|
4127
|
+
/* @__PURE__ */ jsx(
|
|
4128
|
+
NumberField,
|
|
4129
|
+
{
|
|
4130
|
+
label: "Position Z",
|
|
4131
|
+
value: config.positionZ,
|
|
4132
|
+
min: -20,
|
|
4133
|
+
max: 20,
|
|
4134
|
+
step: 0.1,
|
|
4135
|
+
onChange: (positionZ) => update({ positionZ })
|
|
4136
|
+
}
|
|
4137
|
+
),
|
|
4138
|
+
/* @__PURE__ */ jsx(
|
|
4139
|
+
NumberField,
|
|
4140
|
+
{
|
|
4141
|
+
label: "Rotation X",
|
|
4142
|
+
value: config.rotationX,
|
|
4143
|
+
min: 0,
|
|
4144
|
+
max: 360,
|
|
4145
|
+
step: 1,
|
|
4146
|
+
onChange: (rotationX) => update({ rotationX })
|
|
4147
|
+
}
|
|
4148
|
+
),
|
|
4149
|
+
/* @__PURE__ */ jsx(
|
|
4150
|
+
NumberField,
|
|
4151
|
+
{
|
|
4152
|
+
label: "Rotation Y",
|
|
4153
|
+
value: config.rotationY,
|
|
4154
|
+
min: 0,
|
|
4155
|
+
max: 360,
|
|
4156
|
+
step: 1,
|
|
4157
|
+
onChange: (rotationY) => update({ rotationY })
|
|
4158
|
+
}
|
|
4159
|
+
),
|
|
4160
|
+
/* @__PURE__ */ jsx(
|
|
4161
|
+
NumberField,
|
|
4162
|
+
{
|
|
4163
|
+
label: "Rotation Z",
|
|
4164
|
+
value: config.rotationZ,
|
|
4165
|
+
min: 0,
|
|
4166
|
+
max: 360,
|
|
4167
|
+
step: 1,
|
|
4168
|
+
onChange: (rotationZ) => update({ rotationZ })
|
|
4169
|
+
}
|
|
4170
|
+
),
|
|
4171
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-xs", children: [
|
|
4172
|
+
/* @__PURE__ */ jsx(
|
|
4173
|
+
"input",
|
|
4174
|
+
{
|
|
4175
|
+
type: "checkbox",
|
|
4176
|
+
checked: config.zoomOut,
|
|
4177
|
+
onChange: (event) => update({ zoomOut: event.target.checked })
|
|
4178
|
+
}
|
|
4179
|
+
),
|
|
4180
|
+
"Zoom out"
|
|
4181
|
+
] })
|
|
4182
|
+
] }) : null,
|
|
4183
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
4184
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: copy.presets }),
|
|
4185
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: SHADER_CURTAIN_PRESETS.map((preset) => /* @__PURE__ */ jsx(
|
|
4186
|
+
Button,
|
|
4187
|
+
{
|
|
4188
|
+
type: "button",
|
|
4189
|
+
size: "sm",
|
|
4190
|
+
variant: "secondary",
|
|
4191
|
+
onClick: () => replace(preset.config),
|
|
4192
|
+
children: preset.title
|
|
4193
|
+
},
|
|
4194
|
+
preset.id
|
|
4195
|
+
)) })
|
|
4196
|
+
] }),
|
|
4197
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
4198
|
+
/* @__PURE__ */ jsxs("label", { className: "grid gap-1 text-xs", children: [
|
|
4199
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: copy.importUrl }),
|
|
4200
|
+
/* @__PURE__ */ jsx(
|
|
4201
|
+
"input",
|
|
4202
|
+
{
|
|
4203
|
+
value: url,
|
|
4204
|
+
onChange: (event) => setUrl(event.target.value),
|
|
4205
|
+
className: "border-input bg-background rounded-md border px-2 py-1"
|
|
4206
|
+
}
|
|
4207
|
+
)
|
|
4208
|
+
] }),
|
|
4209
|
+
/* @__PURE__ */ jsx(
|
|
4210
|
+
Button,
|
|
4211
|
+
{
|
|
4212
|
+
type: "button",
|
|
4213
|
+
size: "sm",
|
|
4214
|
+
variant: "secondary",
|
|
4215
|
+
onClick: applyUrl,
|
|
4216
|
+
children: copy.importApply
|
|
4217
|
+
}
|
|
4218
|
+
),
|
|
4219
|
+
urlError ? /* @__PURE__ */ jsx("p", { className: "text-destructive text-xs", role: "alert", children: urlError }) : null
|
|
4220
|
+
] })
|
|
4221
|
+
] })
|
|
4222
|
+
]
|
|
4223
|
+
}
|
|
4224
|
+
);
|
|
4225
|
+
});
|
|
4226
|
+
|
|
3134
4227
|
// src/components/video/castHls.ts
|
|
3135
4228
|
var CAST_SENDER_SRC = "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";
|
|
3136
4229
|
var DEFAULT_RECEIVER_ID = "CC1AD845";
|
|
@@ -3271,22 +4364,22 @@ function SeekBar({
|
|
|
3271
4364
|
onSeek,
|
|
3272
4365
|
formatTime: formatTime2
|
|
3273
4366
|
}) {
|
|
3274
|
-
const trackRef =
|
|
3275
|
-
const [hoverTime, setHoverTime] =
|
|
3276
|
-
const [cues, setCues] =
|
|
3277
|
-
const loadedSrc =
|
|
3278
|
-
|
|
4367
|
+
const trackRef = React11.useRef(null);
|
|
4368
|
+
const [hoverTime, setHoverTime] = React11.useState(null);
|
|
4369
|
+
const [cues, setCues] = React11.useState(null);
|
|
4370
|
+
const loadedSrc = React11.useRef(null);
|
|
4371
|
+
React11.useEffect(() => {
|
|
3279
4372
|
setCues(null);
|
|
3280
4373
|
loadedSrc.current = null;
|
|
3281
4374
|
}, [src]);
|
|
3282
|
-
const ensureCues =
|
|
4375
|
+
const ensureCues = React11.useCallback(() => {
|
|
3283
4376
|
if (loadedSrc.current === src) return;
|
|
3284
4377
|
loadedSrc.current = src;
|
|
3285
4378
|
void loadThumbnailsVtt(src).then((next) => {
|
|
3286
4379
|
setCues(next);
|
|
3287
4380
|
});
|
|
3288
4381
|
}, [src]);
|
|
3289
|
-
const updateHover =
|
|
4382
|
+
const updateHover = React11.useCallback(
|
|
3290
4383
|
(clientX) => {
|
|
3291
4384
|
const rect = trackRef.current?.getBoundingClientRect();
|
|
3292
4385
|
if (!rect) return;
|
|
@@ -3890,40 +4983,40 @@ function useHlsPlayback({
|
|
|
3890
4983
|
onRebuffer,
|
|
3891
4984
|
onQualityChange
|
|
3892
4985
|
}) {
|
|
3893
|
-
const videoRef =
|
|
3894
|
-
const hlsRef =
|
|
3895
|
-
const [state, setState] =
|
|
3896
|
-
const [qualities, setQualities] =
|
|
3897
|
-
const [activeLevel, setActiveLevel] =
|
|
3898
|
-
const [autoplayState, setAutoplayState] =
|
|
3899
|
-
const [error, setError] =
|
|
3900
|
-
const [reloadKey, setReloadKey] =
|
|
3901
|
-
const [sealed, setSealed] =
|
|
3902
|
-
const modeRef =
|
|
3903
|
-
const lastSrcRef =
|
|
3904
|
-
const sealedRef =
|
|
3905
|
-
const sawLiveRef =
|
|
3906
|
-
const sealedDuringSessionRef =
|
|
3907
|
-
|
|
4986
|
+
const videoRef = React11.useRef(null);
|
|
4987
|
+
const hlsRef = React11.useRef(null);
|
|
4988
|
+
const [state, setState] = React11.useState("idle");
|
|
4989
|
+
const [qualities, setQualities] = React11.useState([]);
|
|
4990
|
+
const [activeLevel, setActiveLevel] = React11.useState(-1);
|
|
4991
|
+
const [autoplayState, setAutoplayState] = React11.useState("none");
|
|
4992
|
+
const [error, setError] = React11.useState(null);
|
|
4993
|
+
const [reloadKey, setReloadKey] = React11.useState(0);
|
|
4994
|
+
const [sealed, setSealed] = React11.useState(false);
|
|
4995
|
+
const modeRef = React11.useRef(mode);
|
|
4996
|
+
const lastSrcRef = React11.useRef(src);
|
|
4997
|
+
const sealedRef = React11.useRef(false);
|
|
4998
|
+
const sawLiveRef = React11.useRef(false);
|
|
4999
|
+
const sealedDuringSessionRef = React11.useRef(false);
|
|
5000
|
+
React11.useEffect(() => {
|
|
3908
5001
|
modeRef.current = mode;
|
|
3909
5002
|
}, [mode]);
|
|
3910
|
-
const onErrorRef =
|
|
3911
|
-
const onPlayingChangeRef =
|
|
3912
|
-
const onRebufferRef =
|
|
3913
|
-
const onQualityChangeRef =
|
|
3914
|
-
|
|
5003
|
+
const onErrorRef = React11.useRef(onError);
|
|
5004
|
+
const onPlayingChangeRef = React11.useRef(onPlayingChange);
|
|
5005
|
+
const onRebufferRef = React11.useRef(onRebuffer);
|
|
5006
|
+
const onQualityChangeRef = React11.useRef(onQualityChange);
|
|
5007
|
+
React11.useEffect(() => {
|
|
3915
5008
|
onErrorRef.current = onError;
|
|
3916
5009
|
onPlayingChangeRef.current = onPlayingChange;
|
|
3917
5010
|
onRebufferRef.current = onRebuffer;
|
|
3918
5011
|
onQualityChangeRef.current = onQualityChange;
|
|
3919
5012
|
}, [onError, onPlayingChange, onRebuffer, onQualityChange]);
|
|
3920
|
-
const retry =
|
|
5013
|
+
const retry = React11.useCallback(() => {
|
|
3921
5014
|
setError(null);
|
|
3922
5015
|
setState("loading");
|
|
3923
5016
|
setAutoplayState("none");
|
|
3924
5017
|
setReloadKey((k) => k + 1);
|
|
3925
5018
|
}, []);
|
|
3926
|
-
|
|
5019
|
+
React11.useEffect(() => {
|
|
3927
5020
|
const media = videoRef.current;
|
|
3928
5021
|
if (!media || !src || !active) {
|
|
3929
5022
|
setState("idle");
|
|
@@ -4270,7 +5363,7 @@ function useHlsPlayback({
|
|
|
4270
5363
|
destroyHls();
|
|
4271
5364
|
};
|
|
4272
5365
|
}, [src, active, autoPlay, muted, reloadKey]);
|
|
4273
|
-
const setLevel =
|
|
5366
|
+
const setLevel = React11.useCallback((index) => {
|
|
4274
5367
|
const hls = hlsRef.current;
|
|
4275
5368
|
if (!hls) return;
|
|
4276
5369
|
hls.nextLevel = index;
|
|
@@ -4310,9 +5403,9 @@ function isEmbeddedWindow(win = window) {
|
|
|
4310
5403
|
}
|
|
4311
5404
|
}
|
|
4312
5405
|
function CaptionOverlay({ screen }) {
|
|
4313
|
-
const lastSpeakerRef =
|
|
5406
|
+
const lastSpeakerRef = React11.useRef(void 0);
|
|
4314
5407
|
const lastSpeaker = lastSpeakerRef.current;
|
|
4315
|
-
|
|
5408
|
+
React11.useLayoutEffect(() => {
|
|
4316
5409
|
if (screen?.speaker != null) lastSpeakerRef.current = screen.speaker;
|
|
4317
5410
|
}, [screen]);
|
|
4318
5411
|
if (!screen) return null;
|
|
@@ -4505,19 +5598,19 @@ function VideoPlayer({
|
|
|
4505
5598
|
liveCaptionsBaseUrl
|
|
4506
5599
|
}) {
|
|
4507
5600
|
const t = { ...DEFAULT_LABELS3, ...labels };
|
|
4508
|
-
const containerRef =
|
|
4509
|
-
const firstPlayFiredRef =
|
|
4510
|
-
const lastProgressAtRef =
|
|
4511
|
-
const onPlaybackProgressRef =
|
|
5601
|
+
const containerRef = React11.useRef(null);
|
|
5602
|
+
const firstPlayFiredRef = React11.useRef(false);
|
|
5603
|
+
const lastProgressAtRef = React11.useRef(-PROGRESS_THROTTLE_MS);
|
|
5604
|
+
const onPlaybackProgressRef = React11.useRef(onPlaybackProgress);
|
|
4512
5605
|
onPlaybackProgressRef.current = onPlaybackProgress;
|
|
4513
|
-
const applyingTrackModesRef =
|
|
4514
|
-
const captionLocaleRef =
|
|
4515
|
-
const cssFullscreenRef =
|
|
4516
|
-
const webkitFsRef =
|
|
4517
|
-
const [userStarted, setUserStarted] =
|
|
5606
|
+
const applyingTrackModesRef = React11.useRef(false);
|
|
5607
|
+
const captionLocaleRef = React11.useRef("off");
|
|
5608
|
+
const cssFullscreenRef = React11.useRef(false);
|
|
5609
|
+
const webkitFsRef = React11.useRef(false);
|
|
5610
|
+
const [userStarted, setUserStarted] = React11.useState(false);
|
|
4518
5611
|
const active = autoPlay || !poster || userStarted;
|
|
4519
5612
|
const autoplayActive = autoPlay || userStarted;
|
|
4520
|
-
const handlePlayingChange =
|
|
5613
|
+
const handlePlayingChange = React11.useCallback(
|
|
4521
5614
|
(playing) => {
|
|
4522
5615
|
setIsPlaying(playing);
|
|
4523
5616
|
if (playing && !firstPlayFiredRef.current) {
|
|
@@ -4549,45 +5642,45 @@ function VideoPlayer({
|
|
|
4549
5642
|
onRebuffer,
|
|
4550
5643
|
onQualityChange
|
|
4551
5644
|
});
|
|
4552
|
-
const [isPlaying, setIsPlaying] =
|
|
4553
|
-
const [isMuted, setIsMuted] =
|
|
4554
|
-
const isMutedRef =
|
|
5645
|
+
const [isPlaying, setIsPlaying] = React11.useState(false);
|
|
5646
|
+
const [isMuted, setIsMuted] = React11.useState(muted);
|
|
5647
|
+
const isMutedRef = React11.useRef(isMuted);
|
|
4555
5648
|
isMutedRef.current = isMuted;
|
|
4556
|
-
const [volume, setVolume] =
|
|
4557
|
-
const [currentTime, setCurrentTime] =
|
|
4558
|
-
const [duration, setDuration] =
|
|
4559
|
-
const [buffered, setBuffered] =
|
|
4560
|
-
const [isFullscreen, setIsFullscreen] =
|
|
4561
|
-
const [pipActive, setPipActive] =
|
|
4562
|
-
const [controlsVisible, setControlsVisible] =
|
|
4563
|
-
const [playbackRate, setPlaybackRate] =
|
|
4564
|
-
const [openMenu, setOpenMenu] =
|
|
4565
|
-
const [morePane, setMorePane] =
|
|
5649
|
+
const [volume, setVolume] = React11.useState(1);
|
|
5650
|
+
const [currentTime, setCurrentTime] = React11.useState(0);
|
|
5651
|
+
const [duration, setDuration] = React11.useState(0);
|
|
5652
|
+
const [buffered, setBuffered] = React11.useState(0);
|
|
5653
|
+
const [isFullscreen, setIsFullscreen] = React11.useState(false);
|
|
5654
|
+
const [pipActive, setPipActive] = React11.useState(false);
|
|
5655
|
+
const [controlsVisible, setControlsVisible] = React11.useState(true);
|
|
5656
|
+
const [playbackRate, setPlaybackRate] = React11.useState(1);
|
|
5657
|
+
const [openMenu, setOpenMenu] = React11.useState(null);
|
|
5658
|
+
const [morePane, setMorePane] = React11.useState(
|
|
4566
5659
|
"root"
|
|
4567
5660
|
);
|
|
4568
|
-
const [compactChrome, setCompactChrome] =
|
|
4569
|
-
const [captionLocale, setCaptionLocale] =
|
|
4570
|
-
const [captionCues, setCaptionCues] =
|
|
4571
|
-
const [liveCaptionCues, setLiveCaptionCues] =
|
|
4572
|
-
const [livePlayout, setLivePlayout] =
|
|
5661
|
+
const [compactChrome, setCompactChrome] = React11.useState(false);
|
|
5662
|
+
const [captionLocale, setCaptionLocale] = React11.useState(defaultCaptionLocale ?? "off");
|
|
5663
|
+
const [captionCues, setCaptionCues] = React11.useState([]);
|
|
5664
|
+
const [liveCaptionCues, setLiveCaptionCues] = React11.useState([]);
|
|
5665
|
+
const [livePlayout, setLivePlayout] = React11.useState(
|
|
4573
5666
|
EMPTY_LIVE_CAPTION_PLAYOUT
|
|
4574
5667
|
);
|
|
4575
|
-
const [liveLagMs, setLiveLagMs] =
|
|
4576
|
-
const [behindLive, setBehindLive] =
|
|
4577
|
-
const [webkitFullscreenSupported, setWebkitFullscreenSupported] =
|
|
4578
|
-
const [embedded, setEmbedded] =
|
|
4579
|
-
const [cssFullscreen, setCssFullscreen] =
|
|
4580
|
-
const [webkitNativeFs, setWebkitNativeFs] =
|
|
4581
|
-
const hideTimerRef =
|
|
4582
|
-
const liveCaptionCuesRef =
|
|
4583
|
-
const liveLagMsRef =
|
|
4584
|
-
const compactChromeRef =
|
|
5668
|
+
const [liveLagMs, setLiveLagMs] = React11.useState(null);
|
|
5669
|
+
const [behindLive, setBehindLive] = React11.useState(false);
|
|
5670
|
+
const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React11.useState(false);
|
|
5671
|
+
const [embedded, setEmbedded] = React11.useState(false);
|
|
5672
|
+
const [cssFullscreen, setCssFullscreen] = React11.useState(false);
|
|
5673
|
+
const [webkitNativeFs, setWebkitNativeFs] = React11.useState(false);
|
|
5674
|
+
const hideTimerRef = React11.useRef(null);
|
|
5675
|
+
const liveCaptionCuesRef = React11.useRef(liveCaptionCues);
|
|
5676
|
+
const liveLagMsRef = React11.useRef(liveLagMs);
|
|
5677
|
+
const compactChromeRef = React11.useRef(compactChrome);
|
|
4585
5678
|
liveCaptionCuesRef.current = liveCaptionCues;
|
|
4586
5679
|
liveLagMsRef.current = liveLagMs;
|
|
4587
5680
|
compactChromeRef.current = compactChrome;
|
|
4588
5681
|
cssFullscreenRef.current = cssFullscreen;
|
|
4589
5682
|
captionLocaleRef.current = captionLocale;
|
|
4590
|
-
|
|
5683
|
+
React11.useEffect(() => {
|
|
4591
5684
|
const el = containerRef.current;
|
|
4592
5685
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
4593
5686
|
const apply = (width) => {
|
|
@@ -4602,12 +5695,12 @@ function VideoPlayer({
|
|
|
4602
5695
|
observer.observe(el);
|
|
4603
5696
|
return () => observer.disconnect();
|
|
4604
5697
|
}, [active]);
|
|
4605
|
-
|
|
5698
|
+
React11.useEffect(() => {
|
|
4606
5699
|
if (openMenu !== "more") setMorePane("root");
|
|
4607
5700
|
}, [openMenu]);
|
|
4608
5701
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
4609
5702
|
const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported || !embedded;
|
|
4610
|
-
|
|
5703
|
+
React11.useEffect(() => {
|
|
4611
5704
|
const video = videoRef.current;
|
|
4612
5705
|
if (!video || !active) return;
|
|
4613
5706
|
const onTimeUpdate = () => {
|
|
@@ -4666,22 +5759,22 @@ function VideoPlayer({
|
|
|
4666
5759
|
video.removeEventListener("playing", onPlaying);
|
|
4667
5760
|
};
|
|
4668
5761
|
}, [videoRef, active, effectiveMode, liveCaptionsBaseUrl]);
|
|
4669
|
-
|
|
5762
|
+
React11.useLayoutEffect(() => {
|
|
4670
5763
|
const video = videoRef.current;
|
|
4671
5764
|
if (video) video.muted = isMuted;
|
|
4672
5765
|
}, [isMuted, active, videoRef]);
|
|
4673
|
-
|
|
5766
|
+
React11.useEffect(() => {
|
|
4674
5767
|
const video = videoRef.current;
|
|
4675
5768
|
if (!paused || !video || !isPlaying) return;
|
|
4676
5769
|
video.pause();
|
|
4677
5770
|
}, [paused, videoRef, isPlaying]);
|
|
4678
|
-
|
|
5771
|
+
React11.useEffect(() => {
|
|
4679
5772
|
setEmbedded(isEmbeddedWindow());
|
|
4680
5773
|
setWebkitFullscreenSupported(hasWebkitVideoFullscreen(videoRef.current));
|
|
4681
5774
|
videoRef.current?.setAttribute("x-webkit-airplay", "allow");
|
|
4682
5775
|
videoRef.current?.setAttribute("webkit-playsinline", "");
|
|
4683
5776
|
}, [videoRef, active]);
|
|
4684
|
-
|
|
5777
|
+
React11.useEffect(() => {
|
|
4685
5778
|
const onFsChange = () => {
|
|
4686
5779
|
if (document.fullscreenElement === containerRef.current) {
|
|
4687
5780
|
setIsFullscreen(true);
|
|
@@ -4713,7 +5806,7 @@ function VideoPlayer({
|
|
|
4713
5806
|
);
|
|
4714
5807
|
}
|
|
4715
5808
|
}
|
|
4716
|
-
|
|
5809
|
+
React11.useEffect(() => {
|
|
4717
5810
|
const video = asWebkitVideo(videoRef.current);
|
|
4718
5811
|
if (!video) return;
|
|
4719
5812
|
const onBegin = () => {
|
|
@@ -4735,7 +5828,7 @@ function VideoPlayer({
|
|
|
4735
5828
|
video.removeEventListener("webkitendfullscreen", onEnd);
|
|
4736
5829
|
};
|
|
4737
5830
|
}, [videoRef, active]);
|
|
4738
|
-
|
|
5831
|
+
React11.useEffect(() => {
|
|
4739
5832
|
if (!cssFullscreen) return;
|
|
4740
5833
|
const previousOverflow = document.body.style.overflow;
|
|
4741
5834
|
document.body.style.overflow = "hidden";
|
|
@@ -4750,7 +5843,7 @@ function VideoPlayer({
|
|
|
4750
5843
|
document.removeEventListener("keydown", onKey);
|
|
4751
5844
|
};
|
|
4752
5845
|
}, [cssFullscreen]);
|
|
4753
|
-
|
|
5846
|
+
React11.useEffect(() => {
|
|
4754
5847
|
const video = videoRef.current;
|
|
4755
5848
|
if (!video) return;
|
|
4756
5849
|
const onEnter = () => setPipActive(true);
|
|
@@ -4762,23 +5855,23 @@ function VideoPlayer({
|
|
|
4762
5855
|
video.removeEventListener("leavepictureinpicture", onLeave);
|
|
4763
5856
|
};
|
|
4764
5857
|
}, [videoRef]);
|
|
4765
|
-
const scheduleHide =
|
|
5858
|
+
const scheduleHide = React11.useCallback(() => {
|
|
4766
5859
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
4767
5860
|
hideTimerRef.current = setTimeout(() => {
|
|
4768
5861
|
setControlsVisible(false);
|
|
4769
5862
|
setOpenMenu(null);
|
|
4770
5863
|
}, CONTROLS_HIDE_MS);
|
|
4771
5864
|
}, []);
|
|
4772
|
-
const revealControls =
|
|
5865
|
+
const revealControls = React11.useCallback(() => {
|
|
4773
5866
|
setControlsVisible(true);
|
|
4774
5867
|
scheduleHide();
|
|
4775
5868
|
}, [scheduleHide]);
|
|
4776
|
-
|
|
5869
|
+
React11.useEffect(() => {
|
|
4777
5870
|
return () => {
|
|
4778
5871
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
4779
5872
|
};
|
|
4780
5873
|
}, []);
|
|
4781
|
-
|
|
5874
|
+
React11.useEffect(() => {
|
|
4782
5875
|
if (captionLocale === "off") {
|
|
4783
5876
|
setCaptionCues([]);
|
|
4784
5877
|
setLiveCaptionCues([]);
|
|
@@ -4813,7 +5906,7 @@ function VideoPlayer({
|
|
|
4813
5906
|
window.clearInterval(timer);
|
|
4814
5907
|
};
|
|
4815
5908
|
}, [captionLocale, liveCaptionsBaseUrl, src]);
|
|
4816
|
-
|
|
5909
|
+
React11.useEffect(() => {
|
|
4817
5910
|
if (!liveCaptionsBaseUrl || captionLocale === "off") {
|
|
4818
5911
|
setLivePlayout(EMPTY_LIVE_CAPTION_PLAYOUT);
|
|
4819
5912
|
return;
|
|
@@ -4835,7 +5928,7 @@ function VideoPlayer({
|
|
|
4835
5928
|
}, [liveCaptionsBaseUrl, captionLocale]);
|
|
4836
5929
|
const captionWrapWidth = compactChrome ? CAPTION_COMPACT_CHARS_PER_LINE : CAPTION_MAX_CHARS_PER_LINE;
|
|
4837
5930
|
const captionScreen = liveCaptionsBaseUrl ? livePlayout.screen : captionScreenAtTime(captionCues, currentTime, captionWrapWidth);
|
|
4838
|
-
|
|
5931
|
+
React11.useEffect(() => {
|
|
4839
5932
|
const video = videoRef.current;
|
|
4840
5933
|
if (!video || !liveCaptionsBaseUrl) return;
|
|
4841
5934
|
try {
|
|
@@ -4857,12 +5950,12 @@ function VideoPlayer({
|
|
|
4857
5950
|
t.captionsEs,
|
|
4858
5951
|
t.captionsPt
|
|
4859
5952
|
]);
|
|
4860
|
-
|
|
5953
|
+
React11.useEffect(() => {
|
|
4861
5954
|
const video = videoRef.current;
|
|
4862
5955
|
if (!video) return;
|
|
4863
5956
|
applyNativeTrackModes(video, captionLocale, webkitFsRef.current);
|
|
4864
5957
|
}, [videoRef, active, captionLocale, src]);
|
|
4865
|
-
|
|
5958
|
+
React11.useEffect(() => {
|
|
4866
5959
|
const video = videoRef.current;
|
|
4867
5960
|
if (!video) return;
|
|
4868
5961
|
const onChange = () => {
|
|
@@ -4876,7 +5969,7 @@ function VideoPlayer({
|
|
|
4876
5969
|
};
|
|
4877
5970
|
return listenTextTracksChange(video.textTracks, onChange);
|
|
4878
5971
|
}, [videoRef, active, src, liveCaptionsBaseUrl]);
|
|
4879
|
-
|
|
5972
|
+
React11.useEffect(() => {
|
|
4880
5973
|
const video = videoRef.current;
|
|
4881
5974
|
if (!video || captionLocale === "off" || !liveCaptionsBaseUrl) return;
|
|
4882
5975
|
const track = findSubtitleTrack(video, captionLocale);
|
|
@@ -4942,12 +6035,17 @@ function VideoPlayer({
|
|
|
4942
6035
|
exitCssFullscreen();
|
|
4943
6036
|
return;
|
|
4944
6037
|
}
|
|
4945
|
-
if (
|
|
4946
|
-
|
|
6038
|
+
if (video && typeof video.webkitEnterFullscreen === "function") {
|
|
6039
|
+
try {
|
|
6040
|
+
video.webkitEnterFullscreen();
|
|
6041
|
+
} catch {
|
|
6042
|
+
setCssFullscreen(true);
|
|
6043
|
+
setIsFullscreen(true);
|
|
6044
|
+
}
|
|
4947
6045
|
return;
|
|
4948
6046
|
}
|
|
4949
|
-
if (
|
|
4950
|
-
|
|
6047
|
+
if (el && hasStandardFullscreen() && typeof el.requestFullscreen === "function") {
|
|
6048
|
+
void el.requestFullscreen();
|
|
4951
6049
|
return;
|
|
4952
6050
|
}
|
|
4953
6051
|
setCssFullscreen(true);
|
|
@@ -5620,16 +6718,16 @@ function videoInPictureInPicture(container) {
|
|
|
5620
6718
|
return container.contains(pip);
|
|
5621
6719
|
}
|
|
5622
6720
|
function useFeedExclusivePlayback(playbackId) {
|
|
5623
|
-
const containerRef =
|
|
5624
|
-
const [forcePaused, setForcePaused] =
|
|
5625
|
-
const requestPause =
|
|
6721
|
+
const containerRef = React11.useRef(null);
|
|
6722
|
+
const [forcePaused, setForcePaused] = React11.useState(false);
|
|
6723
|
+
const requestPause = React11.useCallback(() => {
|
|
5626
6724
|
if (videoInPictureInPicture(containerRef.current)) return;
|
|
5627
6725
|
setForcePaused(true);
|
|
5628
6726
|
}, []);
|
|
5629
|
-
|
|
6727
|
+
React11.useEffect(() => {
|
|
5630
6728
|
return registerFeedPlayer(playbackId, requestPause);
|
|
5631
6729
|
}, [playbackId, requestPause]);
|
|
5632
|
-
|
|
6730
|
+
React11.useEffect(() => {
|
|
5633
6731
|
const node = containerRef.current;
|
|
5634
6732
|
if (!node || typeof IntersectionObserver === "undefined") return;
|
|
5635
6733
|
const observer = new IntersectionObserver(
|
|
@@ -5645,14 +6743,14 @@ function useFeedExclusivePlayback(playbackId) {
|
|
|
5645
6743
|
observer.observe(node);
|
|
5646
6744
|
return () => observer.disconnect();
|
|
5647
6745
|
}, [requestPause]);
|
|
5648
|
-
|
|
6746
|
+
React11.useEffect(() => {
|
|
5649
6747
|
const onVisibility = () => {
|
|
5650
6748
|
if (document.hidden) requestPause();
|
|
5651
6749
|
};
|
|
5652
6750
|
document.addEventListener("visibilitychange", onVisibility);
|
|
5653
6751
|
return () => document.removeEventListener("visibilitychange", onVisibility);
|
|
5654
6752
|
}, [requestPause]);
|
|
5655
|
-
const onPlayingChange =
|
|
6753
|
+
const onPlayingChange = React11.useCallback(
|
|
5656
6754
|
(playing) => {
|
|
5657
6755
|
if (!playing) return;
|
|
5658
6756
|
setForcePaused(false);
|
|
@@ -5679,7 +6777,7 @@ function FeedVideoPlayer({
|
|
|
5679
6777
|
paused: exclusivePaused,
|
|
5680
6778
|
onPlayingChange: onExclusivePlayingChange
|
|
5681
6779
|
} = useFeedExclusivePlayback(playbackId);
|
|
5682
|
-
const handlePlayingChange =
|
|
6780
|
+
const handlePlayingChange = React11.useCallback(
|
|
5683
6781
|
(playing) => {
|
|
5684
6782
|
onExclusivePlayingChange(playing);
|
|
5685
6783
|
onPlayingChange?.(playing);
|
|
@@ -5706,8 +6804,8 @@ function FeedVideoPlayer({
|
|
|
5706
6804
|
);
|
|
5707
6805
|
}
|
|
5708
6806
|
function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {}) {
|
|
5709
|
-
const [stats, setStats] =
|
|
5710
|
-
|
|
6807
|
+
const [stats, setStats] = React11.useState({});
|
|
6808
|
+
React11.useEffect(() => {
|
|
5711
6809
|
if (!statsUrl || !enabled) return;
|
|
5712
6810
|
let cancelled = false;
|
|
5713
6811
|
const controller = new AbortController();
|
|
@@ -6785,6 +7883,6 @@ function MetricSkeleton({ className, bars = 4 }) {
|
|
|
6785
7883
|
);
|
|
6786
7884
|
}
|
|
6787
7885
|
|
|
6788
|
-
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 };
|
|
7886
|
+
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 };
|
|
6789
7887
|
//# sourceMappingURL=index.js.map
|
|
6790
7888
|
//# sourceMappingURL=index.js.map
|