@wave3d/core 0.4.1 → 0.5.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.
@@ -11490,6 +11490,8 @@ function wl() {
11490
11490
  z: 0
11491
11491
  },
11492
11492
  cameraZoom: 1,
11493
+ cameraFit: "cover",
11494
+ cameraMinVisibleWidth: 0,
11493
11495
  grain: 1.1,
11494
11496
  blur: .02,
11495
11497
  blurSamples: 6,
@@ -11565,7 +11567,7 @@ function Dl(e) {
11565
11567
  x: 0,
11566
11568
  y: 0,
11567
11569
  z: 0
11568
- }, typeof e.cameraZoom != "number" && (e.cameraZoom = 1);
11570
+ }, typeof e.cameraZoom != "number" && (e.cameraZoom = 1), Vl.includes(e.cameraFit) || (e.cameraFit = "cover"), e.cameraMinVisibleWidth = typeof e.cameraMinVisibleWidth == "number" ? pl(e.cameraMinVisibleWidth, 0, 1) : 0;
11569
11571
  }
11570
11572
  function Ol(e) {
11571
11573
  Tl(e), typeof e.gradientAngle != "number" && (e.gradientAngle = 90), typeof e.gradientShift != "number" && (e.gradientShift = .15), typeof e.usePaletteTexture != "boolean" && (e.usePaletteTexture = !0), typeof e.paletteSource != "string" && (e.paletteSource = "hero"), typeof e.paletteEdgeColor != "string" && (e.paletteEdgeColor = "#8e9dff"), typeof e.paletteEdgeAmount != "number" && (e.paletteEdgeAmount = .3), typeof e.paletteDriftX != "number" && (e.paletteDriftX = 0), typeof e.paletteDriftY != "number" && (e.paletteDriftY = 0), typeof e.hueShift != "number" && (e.hueShift = 0), typeof e.colorContrast != "number" && (e.colorContrast = 1), typeof e.colorSaturation != "number" && (e.colorSaturation = 1), typeof e.fiberCount != "number" && (e.fiberCount = 600), typeof e.fiberStrength != "number" && (e.fiberStrength = .2), Array.isArray(e.noiseBands) || (e.noiseBands = []), typeof e.texture != "number" && (e.texture = 0), typeof e.creaseLight != "number" && (e.creaseLight = .6), typeof e.creaseSharpness != "number" && (e.creaseSharpness = .589), typeof e.creaseSoftness != "number" && (e.creaseSoftness = 1), typeof e.sheen != "number" && (e.sheen = 0), typeof e.roundness != "number" && (e.roundness = 0), typeof e.iridescence != "number" && (e.iridescence = 0), typeof e.edgeFade != "number" && (e.edgeFade = .04), typeof e.edgeFeather != "number" && (e.edgeFeather = .1), typeof e.depthTint != "number" && (e.depthTint = 0), typeof e.depthTintColor != "string" && (e.depthTintColor = "#0a2540"), e.displaceFrequency ||= {
@@ -11601,7 +11603,7 @@ function Al(e, t, n, r) {
11601
11603
  return Number.isFinite(i) ? pl(i, t, n) : r;
11602
11604
  }
11603
11605
  function jl(e) {
11604
- return typeof e == "string" && (Hl.includes(e) || e.startsWith("custom:") && e.length > 7);
11606
+ return typeof e == "string" && (Ul.includes(e) || e.startsWith("custom:") && e.length > 7);
11605
11607
  }
11606
11608
  function Ml(e, t) {
11607
11609
  let n = [];
@@ -11629,22 +11631,27 @@ function Nl(e) {
11629
11631
  let t = e.interaction;
11630
11632
  if (!t) return;
11631
11633
  let n = t.hover;
11632
- n && (n.agitate !== void 0 && (n.agitate = Al(n.agitate, 0, 60, 0)), n.push !== void 0 && (n.push = Al(n.push, -40, 40, 0)), n.wake !== void 0 && (n.wake = Al(n.wake, 0, 40, 0)), n.thin !== void 0 && (n.thin = Al(n.thin, 0, 1, 0)), n.hueShift !== void 0 && (n.hueShift = Al(n.hueShift, -360, 360, 0)), n.lighten !== void 0 && (n.lighten = Al(n.lighten, -1, 1, 0)), n.smoothing !== void 0 && (n.smoothing = Al(n.smoothing, 0, 2, .12))), t.press && t.press.ripple !== void 0 && (t.press.ripple = Al(t.press.ripple, 0, 60, 0)), t.bindings !== void 0 && (t.bindings = Ml(t.bindings, Ul));
11634
+ n && (n.agitate !== void 0 && (n.agitate = Al(n.agitate, 0, 60, 0)), n.push !== void 0 && (n.push = Al(n.push, -40, 40, 0)), n.wake !== void 0 && (n.wake = Al(n.wake, 0, 40, 0)), n.thin !== void 0 && (n.thin = Al(n.thin, 0, 1, 0)), n.hueShift !== void 0 && (n.hueShift = Al(n.hueShift, -360, 360, 0)), n.lighten !== void 0 && (n.lighten = Al(n.lighten, -1, 1, 0)), n.smoothing !== void 0 && (n.smoothing = Al(n.smoothing, 0, 2, .12))), t.press && t.press.ripple !== void 0 && (t.press.ripple = Al(t.press.ripple, 0, 60, 0)), t.bindings !== void 0 && (t.bindings = Ml(t.bindings, Wl));
11633
11635
  }
11634
11636
  function Pl(e) {
11635
11637
  let t = e.interaction;
11636
- t && (t.radius !== void 0 && (t.radius = Al(t.radius, .02, 2, .3)), t.ribbonFlow !== void 0 && (t.ribbonFlow = Al(t.ribbonFlow, 0, 1, .8)), t.bindings !== void 0 && (t.bindings = Ml(t.bindings, Wl)));
11638
+ t && (t.radius !== void 0 && (t.radius = Al(t.radius, .02, 2, .3)), t.ribbonFlow !== void 0 && (t.ribbonFlow = Al(t.ribbonFlow, 0, 1, .8)), t.bindings !== void 0 && (t.bindings = Ml(t.bindings, Gl)));
11637
11639
  }
11638
11640
  function Fl(e) {
11639
11641
  let t = e;
11640
11642
  return kl(t), (!Array.isArray(t.waves) || t.waves.length === 0) && (t.waves = [Sl()]), t.waves.forEach(Ol), t.waveCount = t.waves.length, t.interaction && Pl(t), t;
11641
11643
  }
11642
- var Il, Ll, Rl, zl, Bl, Vl, Hl, Ul, Wl, Gl = t((() => {
11643
- hl(), Il = 8, Ll = 8, Rl = 8, zl = 4, Bl = 6, Vl = {
11644
+ var Il, Ll, Rl, zl, Bl, Vl, Hl, Ul, Wl, Gl, Kl = t((() => {
11645
+ hl(), Il = 8, Ll = 8, Rl = 8, zl = 4, Bl = 6, Vl = [
11646
+ "cover",
11647
+ "contain",
11648
+ "width",
11649
+ "height"
11650
+ ], Hl = {
11644
11651
  x: 800,
11645
11652
  y: 900,
11646
11653
  z: 1100
11647
- }, Hl = [
11654
+ }, Ul = [
11648
11655
  "scroll",
11649
11656
  "hover",
11650
11657
  "pointerX",
@@ -11653,7 +11660,7 @@ var Il, Ll, Rl, zl, Bl, Vl, Hl, Ul, Wl, Gl = t((() => {
11653
11660
  "press",
11654
11661
  "scrollVelocity",
11655
11662
  "appear"
11656
- ], Ul = [
11663
+ ], Wl = [
11657
11664
  "displaceAmount",
11658
11665
  "detailAmount",
11659
11666
  "twistPowerX",
@@ -11673,15 +11680,15 @@ var Il, Ll, Rl, zl, Bl, Vl, Hl, Ul, Wl, Gl = t((() => {
11673
11680
  "iridescence",
11674
11681
  "positionX",
11675
11682
  "positionY"
11676
- ], Wl = [
11683
+ ], Gl = [
11677
11684
  "timeOffset",
11678
11685
  "cameraZoom",
11679
11686
  "blur",
11680
11687
  "grain"
11681
11688
  ];
11682
- })), Kl, ql, Jl, Yl, Xl, Zl, Ql, $l, eu, tu, nu, ru, iu, au, ou = t((() => {
11683
- Gl(), Kl = "\nfloat xxhash(vec2 x){\n uvec2 t = floatBitsToUint(x);\n uint h = 0xc2b2ae3du * t.x + 0x165667b9u;\n h = (h << 17u | h >> 15u) * 0x27d4eb2fu;\n h += 0xc2b2ae3du * t.y;\n h = (h << 17u | h >> 15u) * 0x27d4eb2fu;\n h ^= h >> 15u;\n h *= 0x85ebca77u;\n h ^= h >> 13u;\n h *= 0xc2b2ae3du;\n h ^= h >> 16u;\n return uintBitsToFloat(h >> 9u | 0x3f800000u) - 1.0;\n}\nvec2 hash(vec2 x){\n float k = 6.283185307 * xxhash(x);\n return vec2(cos(k), sin(k));\n}\nfloat simplexNoise(in vec2 p){\n const float K1 = 0.366025404; // (sqrt(3)-1)/2\n const float K2 = 0.211324865; // (3-sqrt(3))/6\n vec2 i = floor(p + (p.x + p.y) * K1);\n vec2 a = p - i + (i.x + i.y) * K2;\n float m = step(a.y, a.x);\n vec2 o = vec2(m, 1.0 - m);\n vec2 b = a - o + K2;\n vec2 c = a - 1.0 + 2.0 * K2;\n vec3 h = max(0.5 - vec3(dot(a, a), dot(b, b), dot(c, c)), 0.0);\n vec3 n = h * h * h * vec3(dot(a, hash(i + 0.0)), dot(b, hash(i + o)), dot(c, hash(i + 1.0)));\n return dot(n, vec3(32.99)); // analytic factor (= 2916*sqrt(2)/125)\n}\n", ql = "\nuniform vec3 uColors[MAX_COLORS];\nuniform float uColorPos[MAX_COLORS];\nuniform int uColorCount;\nuniform int uGradType;\nuniform float uGradAngle;\nuniform float uGradShift;\nuniform vec2 uMeshPointPos[MAX_MESH_POINTS];\nuniform vec3 uMeshPointColor[MAX_MESH_POINTS];\nuniform float uMeshPointInfluence[MAX_MESH_POINTS];\nuniform int uMeshPointCount;\nuniform float uMeshSoftness;\nuniform sampler2D uPalette; // baked 2D palette texture\nuniform float uUsePalette; // >0.5 = sample the texture; else procedural grad()\nuniform float uPaletteRaw; // >0.5 = sample palette by raw (uv.x,uv.y), not gradCoord\nuniform vec2 uPaletteScale;\nuniform vec2 uPaletteOffset;\nuniform float uPaletteRotation;\nuniform float uHueShift;\nuniform float uContrast;\nuniform float uSaturation;\nuniform float uOpacity;\nuniform float uSquared; // 1 = square the output colour (the deep \"squared\" hero look)\n", Jl = "\nvec3 contrastFn(vec3 v, float a){ return (v - 0.5) * a + 0.5; }\nvec3 desaturate(vec3 color, float factor){\n vec3 gray = vec3(dot(vec3(0.299, 0.587, 0.114), color));\n return mix(color, gray, factor);\n}\nvec3 hueShift(vec3 color, float shift){\n vec3 g = vec3(0.57735);\n vec3 proj = g * dot(g, color);\n vec3 U = color - proj;\n vec3 W = cross(g, U);\n return U * cos(shift) + W * sin(shift) + proj;\n}\n\n// Our gradient: interpolate stops by their positions (uColorPos sorted ascending).\nvec3 grad(float u){\n u = clamp(u, 0.0, 1.0);\n vec3 col = uColors[0];\n for (int i = 0; i < MAX_COLORS - 1; i++){\n if (i >= uColorCount - 1) break;\n float p0 = uColorPos[i];\n float p1 = uColorPos[i + 1];\n if (u >= p0){\n float t = clamp((u - p0) / max(p1 - p0, 1e-5), 0.0, 1.0);\n col = mix(uColors[i], uColors[i + 1], t);\n }\n }\n return col;\n}\n\n// iOS-style 2D colour field. Each control point contributes an inverse-distance\n// weight; normalising the sum fills the whole surface without dark seams.\nvec3 meshGradient(vec2 uv){\n vec3 colorSum = vec3(0.0);\n float weightSum = 0.0;\n float exponent = mix(4.8, 1.35, clamp(uMeshSoftness, 0.0, 1.0));\n for (int i = 0; i < MAX_MESH_POINTS; i++){\n if (i >= uMeshPointCount) break;\n float influence = max(uMeshPointInfluence[i], 0.05);\n float distanceFromPoint = length(uv - uMeshPointPos[i]) / influence;\n float weight = 1.0 / (pow(max(distanceFromPoint, 0.012), exponent) + 0.002);\n colorSum += uMeshPointColor[i] * weight;\n weightSum += weight;\n }\n return colorSum / max(weightSum, 0.0001);\n}\n\n// Map a surface uv to the 0–1 gradient coordinate per gradient type. uGradShift\n// adds a low-frequency simplex warp so the colour varies in 2D (along the length\n// as well as across the width) — a 2D palette feel instead\n// of flat 1-D bands.\nfloat gradCoord(vec2 uv){\n float warp = uGradShift * simplexNoise(uv * 1.6 + 4.0);\n if (uGradType == 1){ return clamp(length(uv - 0.5) * 2.0 + warp, 0.0, 1.0); } // radial\n if (uGradType == 2){ return fract(atan(uv.y - 0.5, uv.x - 0.5) / (2.0 * PI) + 0.5 + warp); } // conic\n vec2 dir = vec2(sin(uGradAngle), cos(uGradAngle)); // linear, angled\n return clamp(dot(uv - 0.5, dir) + 0.5 + warp, 0.0, 1.0);\n}\n\n// One base-colour sample for the whole surface: rotate/scale/offset the raw-palette uv,\n// then pick the mesh field / baked 2D texture / procedural stops by mode. The raw palette\n// is sampled by (uv.x, uv.y) directly; the stops-generated texture is sampled via\n// gradCoord so its angle/type/warp still apply.\nvec3 waveBaseColor(vec2 uv){\n float gc = gradCoord(uv);\n vec2 mediaUv = uv - 0.5;\n float mediaCos = cos(uPaletteRotation);\n float mediaSin = sin(uPaletteRotation);\n mediaUv = vec2(\n mediaCos * mediaUv.x + mediaSin * mediaUv.y,\n -mediaSin * mediaUv.x + mediaCos * mediaUv.y\n );\n mediaUv = mediaUv * uPaletteScale + 0.5 + uPaletteOffset;\n vec2 puv = uPaletteRaw > 0.5\n ? clamp(mediaUv, 0.0, 1.0)\n : vec2(gc, clamp(uv.y, 0.0, 1.0));\n return uGradType == 3\n ? meshGradient(uv)\n : (uUsePalette > 0.5 ? texture2D(uPalette, puv).rgb : grad(gc));\n}\n\n// The shared colour grade: contrast → desaturate → hue rotate (degrees).\nvec3 applyColorGrade(vec3 c){\n c = contrastFn(c, uContrast);\n c = desaturate(c, 1.0 - uSaturation);\n return hueShift(c, radians(uHueShift));\n}\n", Yl = `
11684
- ${Kl}
11689
+ })), ql, Jl, Yl, Xl, Zl, Ql, $l, eu, tu, nu, ru, iu, au, ou, su = t((() => {
11690
+ Kl(), ql = "\nfloat xxhash(vec2 x){\n uvec2 t = floatBitsToUint(x);\n uint h = 0xc2b2ae3du * t.x + 0x165667b9u;\n h = (h << 17u | h >> 15u) * 0x27d4eb2fu;\n h += 0xc2b2ae3du * t.y;\n h = (h << 17u | h >> 15u) * 0x27d4eb2fu;\n h ^= h >> 15u;\n h *= 0x85ebca77u;\n h ^= h >> 13u;\n h *= 0xc2b2ae3du;\n h ^= h >> 16u;\n return uintBitsToFloat(h >> 9u | 0x3f800000u) - 1.0;\n}\nvec2 hash(vec2 x){\n float k = 6.283185307 * xxhash(x);\n return vec2(cos(k), sin(k));\n}\nfloat simplexNoise(in vec2 p){\n const float K1 = 0.366025404; // (sqrt(3)-1)/2\n const float K2 = 0.211324865; // (3-sqrt(3))/6\n vec2 i = floor(p + (p.x + p.y) * K1);\n vec2 a = p - i + (i.x + i.y) * K2;\n float m = step(a.y, a.x);\n vec2 o = vec2(m, 1.0 - m);\n vec2 b = a - o + K2;\n vec2 c = a - 1.0 + 2.0 * K2;\n vec3 h = max(0.5 - vec3(dot(a, a), dot(b, b), dot(c, c)), 0.0);\n vec3 n = h * h * h * vec3(dot(a, hash(i + 0.0)), dot(b, hash(i + o)), dot(c, hash(i + 1.0)));\n return dot(n, vec3(32.99)); // analytic factor (= 2916*sqrt(2)/125)\n}\n", Jl = "\nuniform vec3 uColors[MAX_COLORS];\nuniform float uColorPos[MAX_COLORS];\nuniform int uColorCount;\nuniform int uGradType;\nuniform float uGradAngle;\nuniform float uGradShift;\nuniform vec2 uMeshPointPos[MAX_MESH_POINTS];\nuniform vec3 uMeshPointColor[MAX_MESH_POINTS];\nuniform float uMeshPointInfluence[MAX_MESH_POINTS];\nuniform int uMeshPointCount;\nuniform float uMeshSoftness;\nuniform sampler2D uPalette; // baked 2D palette texture\nuniform float uUsePalette; // >0.5 = sample the texture; else procedural grad()\nuniform float uPaletteRaw; // >0.5 = sample palette by raw (uv.x,uv.y), not gradCoord\nuniform vec2 uPaletteScale;\nuniform vec2 uPaletteOffset;\nuniform float uPaletteRotation;\nuniform float uHueShift;\nuniform float uContrast;\nuniform float uSaturation;\nuniform float uOpacity;\nuniform float uSquared; // 1 = square the output colour (the deep \"squared\" hero look)\n", Yl = "\nvec3 contrastFn(vec3 v, float a){ return (v - 0.5) * a + 0.5; }\nvec3 desaturate(vec3 color, float factor){\n vec3 gray = vec3(dot(vec3(0.299, 0.587, 0.114), color));\n return mix(color, gray, factor);\n}\nvec3 hueShift(vec3 color, float shift){\n vec3 g = vec3(0.57735);\n vec3 proj = g * dot(g, color);\n vec3 U = color - proj;\n vec3 W = cross(g, U);\n return U * cos(shift) + W * sin(shift) + proj;\n}\n\n// Our gradient: interpolate stops by their positions (uColorPos sorted ascending).\nvec3 grad(float u){\n u = clamp(u, 0.0, 1.0);\n vec3 col = uColors[0];\n for (int i = 0; i < MAX_COLORS - 1; i++){\n if (i >= uColorCount - 1) break;\n float p0 = uColorPos[i];\n float p1 = uColorPos[i + 1];\n if (u >= p0){\n float t = clamp((u - p0) / max(p1 - p0, 1e-5), 0.0, 1.0);\n col = mix(uColors[i], uColors[i + 1], t);\n }\n }\n return col;\n}\n\n// iOS-style 2D colour field. Each control point contributes an inverse-distance\n// weight; normalising the sum fills the whole surface without dark seams.\nvec3 meshGradient(vec2 uv){\n vec3 colorSum = vec3(0.0);\n float weightSum = 0.0;\n float exponent = mix(4.8, 1.35, clamp(uMeshSoftness, 0.0, 1.0));\n for (int i = 0; i < MAX_MESH_POINTS; i++){\n if (i >= uMeshPointCount) break;\n float influence = max(uMeshPointInfluence[i], 0.05);\n float distanceFromPoint = length(uv - uMeshPointPos[i]) / influence;\n float weight = 1.0 / (pow(max(distanceFromPoint, 0.012), exponent) + 0.002);\n colorSum += uMeshPointColor[i] * weight;\n weightSum += weight;\n }\n return colorSum / max(weightSum, 0.0001);\n}\n\n// Map a surface uv to the 0–1 gradient coordinate per gradient type. uGradShift\n// adds a low-frequency simplex warp so the colour varies in 2D (along the length\n// as well as across the width) — a 2D palette feel instead\n// of flat 1-D bands.\nfloat gradCoord(vec2 uv){\n float warp = uGradShift * simplexNoise(uv * 1.6 + 4.0);\n if (uGradType == 1){ return clamp(length(uv - 0.5) * 2.0 + warp, 0.0, 1.0); } // radial\n if (uGradType == 2){ return fract(atan(uv.y - 0.5, uv.x - 0.5) / (2.0 * PI) + 0.5 + warp); } // conic\n vec2 dir = vec2(sin(uGradAngle), cos(uGradAngle)); // linear, angled\n return clamp(dot(uv - 0.5, dir) + 0.5 + warp, 0.0, 1.0);\n}\n\n// One base-colour sample for the whole surface: rotate/scale/offset the raw-palette uv,\n// then pick the mesh field / baked 2D texture / procedural stops by mode. The raw palette\n// is sampled by (uv.x, uv.y) directly; the stops-generated texture is sampled via\n// gradCoord so its angle/type/warp still apply.\nvec3 waveBaseColor(vec2 uv){\n float gc = gradCoord(uv);\n vec2 mediaUv = uv - 0.5;\n float mediaCos = cos(uPaletteRotation);\n float mediaSin = sin(uPaletteRotation);\n mediaUv = vec2(\n mediaCos * mediaUv.x + mediaSin * mediaUv.y,\n -mediaSin * mediaUv.x + mediaCos * mediaUv.y\n );\n mediaUv = mediaUv * uPaletteScale + 0.5 + uPaletteOffset;\n vec2 puv = uPaletteRaw > 0.5\n ? clamp(mediaUv, 0.0, 1.0)\n : vec2(gc, clamp(uv.y, 0.0, 1.0));\n return uGradType == 3\n ? meshGradient(uv)\n : (uUsePalette > 0.5 ? texture2D(uPalette, puv).rgb : grad(gc));\n}\n\n// The shared colour grade: contrast → desaturate → hue rotate (degrees).\nvec3 applyColorGrade(vec3 c){\n c = contrastFn(c, uContrast);\n c = desaturate(c, 1.0 - uSaturation);\n return hueShift(c, radians(uHueShift));\n}\n", Xl = `
11691
+ ${ql}
11685
11692
 
11686
11693
  uniform float uTime, uSpeed, uSeed;
11687
11694
  uniform float uDispFreqX, uDispFreqZ, uDispAmount;
@@ -11884,16 +11891,16 @@ void main(){
11884
11891
  gl_Position = projectionMatrix * viewMatrix * world;
11885
11892
  vClipPosition = gl_Position;
11886
11893
  }
11887
- `, Xl = `
11894
+ `, Zl = `
11888
11895
  #define MAX_COLORS 8
11889
11896
  #define MAX_MESH_POINTS 8
11890
11897
  #define MAX_LIGHTS 8
11891
11898
  #define MAX_NOISE_BANDS 4
11892
11899
  #define PI 3.14159265359
11893
11900
 
11894
- ${Kl}
11895
-
11896
11901
  ${ql}
11902
+
11903
+ ${Jl}
11897
11904
  uniform float uDebug; // dev: 1 = show crease, 2 = show derivative normal
11898
11905
  uniform float uSheen; // white-lift on the flat (low-crease) areas (1 = full)
11899
11906
  uniform float uRoundness; // pose-robust normal-based roundness/thickness strength
@@ -11940,7 +11947,7 @@ float grainHash(vec2 p){ return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758
11940
11947
  float parabola(float x, float k){ return pow(4.0 * x * (1.0 - x), k); }
11941
11948
  float mapLinear(float v, float a, float b, float c, float d){ return c + (v - a) * (d - c) / (b - a); }
11942
11949
 
11943
- ${Jl}
11950
+ ${Yl}
11944
11951
 
11945
11952
  // Striations: a subtle high-frequency simplex-noise grain ADDED to the
11946
11953
  // colour — colour-matched (weaker where blue is high), only near folds (crease), and
@@ -12089,14 +12096,14 @@ void main(){
12089
12096
  gl_FragColor.rgb *= gl_FragColor.a;
12090
12097
  #endif
12091
12098
  }
12092
- `, Zl = `
12099
+ `, Ql = `
12093
12100
  #define MAX_COLORS 8
12094
12101
  #define MAX_MESH_POINTS 8
12095
12102
  #define PI 3.14159265359
12096
12103
 
12097
- ${Kl}
12098
-
12099
12104
  ${ql}
12105
+
12106
+ ${Jl}
12100
12107
  uniform float uLineAmount; // default 425
12101
12108
  uniform float uLineThickness; // default 1
12102
12109
  uniform float uLineDerivativePower; // default 0.95
@@ -12112,7 +12119,7 @@ uniform float uPointerLighten; // -1..1 local brightness lift near the cursor
12112
12119
  varying float vPointerFall; // falloff × presence, written by the vertex shader
12113
12120
  #endif
12114
12121
 
12115
- ${Jl}
12122
+ ${Yl}
12116
12123
 
12117
12124
  void main(){
12118
12125
  // Same 2D palette sample + colour ops as the solid theme.
@@ -12145,9 +12152,9 @@ void main(){
12145
12152
  gl_FragColor.rgb *= gl_FragColor.a;
12146
12153
  #endif
12147
12154
  }
12148
- `, Ql = "\nvarying vec2 vUv;\nvoid main(){\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n", $l = "\nuniform sampler2D tDiffuse;\nuniform vec2 uResolution;\nuniform float uBlurAmount;\nuniform int uBlurSamples;\nuniform float uGrainAmount;\nuniform float uTime;\nvarying vec2 vUv;\n\nfloat random2(vec2 st){ return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453); }\n\n// Angular (spin) blur: rotate the sample coord around the centre and\n// accumulate — a tangential smear that grows toward the edges. Carries alpha so a\n// transparent background survives the post pass.\nvec4 blurAngular(sampler2D tex, vec2 uv, float angle, int samples){\n vec4 total = vec4(0.0);\n vec2 coord = uv - 0.5;\n float dist = 1.0 / float(samples);\n vec2 dir = vec2(cos(angle * dist), sin(angle * dist));\n mat2 rot = mat2(dir.x, dir.y, -dir.y, dir.x);\n for (int i = 0; i < 64; i++){\n if (i >= samples) break;\n total += texture2D(tex, coord + 0.5);\n coord = coord * rot; // row-vector order (coord * rot) sets the spin direction\n }\n return total * dist;\n}\n\nvoid main(){\n vec4 sceneColor = texture2D(tDiffuse, vUv);\n vec4 blurColor = blurAngular(tDiffuse, vUv, uBlurAmount, uBlurSamples);\n // blurPower: keep a sharp band weighted to the middle, blurring toward top & bottom.\n float blurPower = smoothstep(0.0, 0.7, vUv.y) - smoothstep(0.2, 1.0, vUv.y);\n vec4 color = mix(blurColor, sceneColor, blurPower);\n // Static film grain: keyed off gl_FragCoord only (no uTime), so it doesn't flicker.\n color.rgb += mix(uGrainAmount, -uGrainAmount, random2(gl_FragCoord.xy * 0.01)) * (4.0 / 255.0);\n gl_FragColor = color; // preserve alpha → transparent background works\n}\n", eu = "\nuniform sampler2D tDiffuse;\nuniform vec2 uResolution;\nuniform float uDitherStrength; // 0..1 mix back toward the original\nuniform float uDitherScale; // pixel-block size in device px (paper: u_pxSize)\nuniform float uDitherSteps; // quantization levels (paper: u_colorSteps)\nvarying vec2 vUv;\n\nconst int bayer2x2[4] = int[4](0, 2, 3, 1);\nconst int bayer4x4[16] = int[16](0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5);\nconst int bayer8x8[64] = int[64](\n 0, 32, 8, 40, 2, 34, 10, 42, 48, 16, 56, 24, 50, 18, 58, 26,\n 12, 44, 4, 36, 14, 46, 6, 38, 60, 28, 52, 20, 62, 30, 54, 22,\n 3, 35, 11, 43, 1, 33, 9, 41, 51, 19, 59, 27, 49, 17, 57, 25,\n 15, 47, 7, 39, 13, 45, 5, 37, 63, 31, 55, 23, 61, 29, 53, 21\n);\nfloat getBayerValue(vec2 uv, int size){\n ivec2 pos = ivec2(fract(uv / float(size)) * float(size));\n int index = pos.y * size + pos.x;\n if (size == 2) return float(bayer2x2[index]) / 4.0;\n else if (size == 4) return float(bayer4x4[index]) / 16.0;\n else if (size == 8) return float(bayer8x8[index]) / 64.0;\n return 0.0;\n}\n\nvoid main(){\n float pxSize = max(uDitherScale, 1.0);\n vec2 pxSizeUV = gl_FragCoord.xy / pxSize;\n vec2 sampleUV = (floor(gl_FragCoord.xy / pxSize) + 0.5) * pxSize / max(uResolution, vec2(1.0));\n vec4 image = texture2D(tDiffuse, sampleUV);\n\n float lum = dot(vec3(0.2126, 0.7152, 0.0722), image.rgb);\n float colorSteps = max(floor(uDitherSteps), 1.0);\n\n float dithering = getBayerValue(pxSizeUV, 8) - 0.5; // paper's default 8x8 ordered screen\n float brightness = clamp(lum + dithering / colorSteps, 0.0, 1.0);\n brightness = mix(0.0, brightness, image.a);\n float quantLum = floor(brightness * colorSteps + 0.5) / colorSteps;\n\n // paper's \"original colours\" path: keep the source hue, quantize luminance.\n vec3 color = image.rgb / max(lum, 0.001) * quantLum;\n float quantAlpha = floor(image.a * colorSteps + 0.5) / colorSteps;\n float opacity = mix(quantLum, 1.0, quantAlpha);\n\n gl_FragColor = mix(image, vec4(color, opacity), clamp(uDitherStrength, 0.0, 1.0));\n}\n", tu = "\nuniform sampler2D tDiffuse;\nuniform float uInnerLight; // 0..1 strength of the added light\nuniform float uInnerLightDensity; // ray length / spread\nuniform float uInnerLightDecay; // per-sample falloff (<1)\nuniform vec2 uInnerLightCenter; // light source, UV (0..1)\nvarying vec2 vUv;\n\nconst int LIGHT_SAMPLES = 24;\n\nfloat luma(vec3 c){ return dot(c, vec3(0.2126, 0.7152, 0.0722)); }\n\nvoid main(){\n vec4 src = texture2D(tDiffuse, vUv);\n vec2 delta = (vUv - uInnerLightCenter) * (uInnerLightDensity / float(LIGHT_SAMPLES));\n vec2 coord = vUv;\n float decay = 1.0;\n vec3 rays = vec3(0.0);\n for (int i = 0; i < LIGHT_SAMPLES; i++){\n coord -= delta;\n vec4 s = texture2D(tDiffuse, coord);\n rays += s.rgb * s.a * decay; // only opaque (wave) pixels emit light\n decay *= uInnerLightDecay;\n }\n rays /= float(LIGHT_SAMPLES);\n vec3 outc = src.rgb + rays * uInnerLight;\n float outA = max(src.a, luma(rays) * uInnerLight); // shafts stay visible over the transparent bg\n gl_FragColor = vec4(outc, clamp(outA, 0.0, 1.0));\n}\n", nu = "\nuniform sampler2D tDiffuse;\nuniform vec2 uResolution;\nuniform float uHalftone; // 0..1 mix\nuniform float uHalftoneCell; // dot cell size in device px (paper: u_size)\nuniform float uHalftoneAngle; // screen rotation (radians, paper: u_rotation)\nvarying vec2 vUv;\n\nfloat sigmoid(float x, float k){ return 1.0 / (1.0 + exp(-k * (x - 0.5))); }\n// paper's classic dot: radius grows as the sampled cell darkens (1 - lum), soft edge via fwidth.\nfloat getCircle(vec2 uv, float lum, float baseR){\n float r = mix(0.25 * baseR, 0.0, lum);\n float d = length(uv - 0.5);\n float aa = fwidth(d);\n return 1.0 - smoothstep(r - aa, r + aa, d);\n}\n\nvoid main(){\n float ca = cos(uHalftoneAngle);\n float sa = sin(uHalftoneAngle);\n mat2 rot = mat2(ca, sa, -sa, ca);\n float cell = max(uHalftoneCell, 2.0);\n vec2 gridPx = rot * gl_FragCoord.xy; // rotate the screen into the dot grid\n vec2 cellId = floor(gridPx / cell);\n vec2 inCell = fract(gridPx / cell); // position within the cell (0..1)\n vec2 centrePx = transpose(rot) * ((cellId + 0.5) * cell); // cell centre, back in screen px\n vec4 tex = texture2D(tDiffuse, centrePx / max(uResolution, vec2(1.0)));\n\n float k = 2.0; // sigmoid contrast (paper default)\n vec3 c = vec3(sigmoid(tex.r, k), sigmoid(tex.g, k), sigmoid(tex.b, k));\n float lum = dot(vec3(0.2126, 0.7152, 0.0722), c);\n lum = mix(1.0, lum, tex.a);\n float dot = getCircle(inCell, lum, 1.3); // baseR 1.3 ≈ paper original-colours default\n vec4 dots = vec4(tex.rgb, tex.a * dot); // wave-coloured dots, transparent between\n gl_FragColor = mix(texture2D(tDiffuse, vUv), dots, clamp(uHalftone, 0.0, 1.0));\n}\n", ru = "\nuniform sampler2D tDiffuse;\nuniform float uHeatmap; // 0..1 mix\nvarying vec2 vUv;\nvec3 heat(float t){\n t = clamp(t, 0.0, 1.0);\n vec3 c = mix(vec3(0.0, 0.0, 0.4), vec3(0.0, 0.6, 1.0), smoothstep(0.0, 0.25, t));\n c = mix(c, vec3(0.0, 1.0, 0.4), smoothstep(0.25, 0.5, t));\n c = mix(c, vec3(1.0, 1.0, 0.0), smoothstep(0.5, 0.75, t));\n c = mix(c, vec3(1.0, 0.1, 0.0), smoothstep(0.75, 1.0, t));\n return c;\n}\nvoid main(){\n vec4 src = texture2D(tDiffuse, vUv);\n float l = dot(src.rgb, vec3(0.299, 0.587, 0.114));\n gl_FragColor = vec4(mix(src.rgb, heat(l), clamp(uHeatmap, 0.0, 1.0)), src.a);\n}\n", iu = "\nuniform sampler2D tDiffuse;\nuniform float uPaper; // 0..1 strength\nuniform float uPaperScale; // grain scale\nvarying vec2 vUv;\nfloat h21(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }\nvoid main(){\n vec4 src = texture2D(tDiffuse, vUv);\n vec2 p = gl_FragCoord.xy / max(uPaperScale, 0.5);\n float fiber = h21(floor(p)) * 0.5 + h21(floor(p * vec2(0.3, 3.0))) * 0.5; // directional fibers\n float tex = mix(fiber, h21(gl_FragCoord.xy), 0.3); // + fine speckle\n float shade = 1.0 - (tex - 0.5) * 0.35;\n gl_FragColor = vec4(src.rgb * mix(1.0, shade, clamp(uPaper, 0.0, 1.0)), src.a);\n}\n", au = "\nuniform sampler2D tDiffuse;\nuniform float uHalftoneCmyk; // 0..1 mix\nuniform float uHalftoneCmykCell; // dot cell size in device px\nvarying vec2 vUv;\n// One rotated halftone dot screen for a channel value.\nfloat dotScreen(vec2 coord, float value, float angle, float cell){\n float ca = cos(angle);\n float sa = sin(angle);\n vec2 r = mat2(ca, sa, -sa, ca) * coord;\n vec2 c = fract(r / max(cell, 2.0)) - 0.5;\n float radius = sqrt(clamp(value, 0.0, 1.0)) * 0.5;\n return smoothstep(radius, radius - 0.06, length(c));\n}\nvoid main(){\n vec4 src = texture2D(tDiffuse, vUv);\n float k = 1.0 - max(max(src.r, src.g), src.b); // RGB → CMYK\n float invK = max(1.0 - k, 1e-3);\n float cyan = (1.0 - src.r - k) / invK;\n float mag = (1.0 - src.g - k) / invK;\n float yel = (1.0 - src.b - k) / invK;\n vec2 coord = gl_FragCoord.xy;\n float cell = uHalftoneCmykCell;\n float dc = dotScreen(coord, cyan, 1.309, cell); // 75°\n float dm = dotScreen(coord, mag, 0.262, cell); // 15°\n float dy = dotScreen(coord, yel, 0.0, cell); // 0°\n float dk = dotScreen(coord, k, 0.785, cell); // 45°\n // Subtractive: cyan ink absorbs red, magenta absorbs green, yellow absorbs blue, black absorbs all.\n vec3 outc = vec3(1.0) - vec3(dc, 0.0, 0.0) - vec3(0.0, dm, 0.0) - vec3(0.0, 0.0, dy) - vec3(dk);\n outc = clamp(outc, 0.0, 1.0);\n gl_FragColor = vec4(mix(src.rgb, outc, clamp(uHalftoneCmyk, 0.0, 1.0)), src.a);\n}\n";
12149
- })), su, cu, lu, uu, du, fu, pu = t((() => {
12150
- Vc(), su = 400, cu = 16, lu = su / 4, uu = new K(1, 0, 0), du = new K(0, 1, 0), fu = class {
12155
+ `, $l = "\nvarying vec2 vUv;\nvoid main(){\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n", eu = "\nuniform sampler2D tDiffuse;\nuniform vec2 uResolution;\nuniform float uBlurAmount;\nuniform int uBlurSamples;\nuniform float uGrainAmount;\nuniform float uTime;\nvarying vec2 vUv;\n\nfloat random2(vec2 st){ return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453); }\n\n// Angular (spin) blur: rotate the sample coord around the centre and\n// accumulate — a tangential smear that grows toward the edges. Carries alpha so a\n// transparent background survives the post pass.\nvec4 blurAngular(sampler2D tex, vec2 uv, float angle, int samples){\n vec4 total = vec4(0.0);\n vec2 coord = uv - 0.5;\n float dist = 1.0 / float(samples);\n vec2 dir = vec2(cos(angle * dist), sin(angle * dist));\n mat2 rot = mat2(dir.x, dir.y, -dir.y, dir.x);\n for (int i = 0; i < 64; i++){\n if (i >= samples) break;\n total += texture2D(tex, coord + 0.5);\n coord = coord * rot; // row-vector order (coord * rot) sets the spin direction\n }\n return total * dist;\n}\n\nvoid main(){\n vec4 sceneColor = texture2D(tDiffuse, vUv);\n vec4 blurColor = blurAngular(tDiffuse, vUv, uBlurAmount, uBlurSamples);\n // blurPower: keep a sharp band weighted to the middle, blurring toward top & bottom.\n float blurPower = smoothstep(0.0, 0.7, vUv.y) - smoothstep(0.2, 1.0, vUv.y);\n vec4 color = mix(blurColor, sceneColor, blurPower);\n // Static film grain: keyed off gl_FragCoord only (no uTime), so it doesn't flicker.\n color.rgb += mix(uGrainAmount, -uGrainAmount, random2(gl_FragCoord.xy * 0.01)) * (4.0 / 255.0);\n gl_FragColor = color; // preserve alpha → transparent background works\n}\n", tu = "\nuniform sampler2D tDiffuse;\nuniform vec2 uResolution;\nuniform float uDitherStrength; // 0..1 mix back toward the original\nuniform float uDitherScale; // pixel-block size in device px (paper: u_pxSize)\nuniform float uDitherSteps; // quantization levels (paper: u_colorSteps)\nvarying vec2 vUv;\n\nconst int bayer2x2[4] = int[4](0, 2, 3, 1);\nconst int bayer4x4[16] = int[16](0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5);\nconst int bayer8x8[64] = int[64](\n 0, 32, 8, 40, 2, 34, 10, 42, 48, 16, 56, 24, 50, 18, 58, 26,\n 12, 44, 4, 36, 14, 46, 6, 38, 60, 28, 52, 20, 62, 30, 54, 22,\n 3, 35, 11, 43, 1, 33, 9, 41, 51, 19, 59, 27, 49, 17, 57, 25,\n 15, 47, 7, 39, 13, 45, 5, 37, 63, 31, 55, 23, 61, 29, 53, 21\n);\nfloat getBayerValue(vec2 uv, int size){\n ivec2 pos = ivec2(fract(uv / float(size)) * float(size));\n int index = pos.y * size + pos.x;\n if (size == 2) return float(bayer2x2[index]) / 4.0;\n else if (size == 4) return float(bayer4x4[index]) / 16.0;\n else if (size == 8) return float(bayer8x8[index]) / 64.0;\n return 0.0;\n}\n\nvoid main(){\n float pxSize = max(uDitherScale, 1.0);\n vec2 pxSizeUV = gl_FragCoord.xy / pxSize;\n vec2 sampleUV = (floor(gl_FragCoord.xy / pxSize) + 0.5) * pxSize / max(uResolution, vec2(1.0));\n vec4 image = texture2D(tDiffuse, sampleUV);\n\n float lum = dot(vec3(0.2126, 0.7152, 0.0722), image.rgb);\n float colorSteps = max(floor(uDitherSteps), 1.0);\n\n float dithering = getBayerValue(pxSizeUV, 8) - 0.5; // paper's default 8x8 ordered screen\n float brightness = clamp(lum + dithering / colorSteps, 0.0, 1.0);\n brightness = mix(0.0, brightness, image.a);\n float quantLum = floor(brightness * colorSteps + 0.5) / colorSteps;\n\n // paper's \"original colours\" path: keep the source hue, quantize luminance.\n vec3 color = image.rgb / max(lum, 0.001) * quantLum;\n float quantAlpha = floor(image.a * colorSteps + 0.5) / colorSteps;\n float opacity = mix(quantLum, 1.0, quantAlpha);\n\n gl_FragColor = mix(image, vec4(color, opacity), clamp(uDitherStrength, 0.0, 1.0));\n}\n", nu = "\nuniform sampler2D tDiffuse;\nuniform float uInnerLight; // 0..1 strength of the added light\nuniform float uInnerLightDensity; // ray length / spread\nuniform float uInnerLightDecay; // per-sample falloff (<1)\nuniform vec2 uInnerLightCenter; // light source, UV (0..1)\nvarying vec2 vUv;\n\nconst int LIGHT_SAMPLES = 24;\n\nfloat luma(vec3 c){ return dot(c, vec3(0.2126, 0.7152, 0.0722)); }\n\nvoid main(){\n vec4 src = texture2D(tDiffuse, vUv);\n vec2 delta = (vUv - uInnerLightCenter) * (uInnerLightDensity / float(LIGHT_SAMPLES));\n vec2 coord = vUv;\n float decay = 1.0;\n vec3 rays = vec3(0.0);\n for (int i = 0; i < LIGHT_SAMPLES; i++){\n coord -= delta;\n vec4 s = texture2D(tDiffuse, coord);\n rays += s.rgb * s.a * decay; // only opaque (wave) pixels emit light\n decay *= uInnerLightDecay;\n }\n rays /= float(LIGHT_SAMPLES);\n vec3 outc = src.rgb + rays * uInnerLight;\n float outA = max(src.a, luma(rays) * uInnerLight); // shafts stay visible over the transparent bg\n gl_FragColor = vec4(outc, clamp(outA, 0.0, 1.0));\n}\n", ru = "\nuniform sampler2D tDiffuse;\nuniform vec2 uResolution;\nuniform float uHalftone; // 0..1 mix\nuniform float uHalftoneCell; // dot cell size in device px (paper: u_size)\nuniform float uHalftoneAngle; // screen rotation (radians, paper: u_rotation)\nvarying vec2 vUv;\n\nfloat sigmoid(float x, float k){ return 1.0 / (1.0 + exp(-k * (x - 0.5))); }\n// paper's classic dot: radius grows as the sampled cell darkens (1 - lum), soft edge via fwidth.\nfloat getCircle(vec2 uv, float lum, float baseR){\n float r = mix(0.25 * baseR, 0.0, lum);\n float d = length(uv - 0.5);\n float aa = fwidth(d);\n return 1.0 - smoothstep(r - aa, r + aa, d);\n}\n\nvoid main(){\n float ca = cos(uHalftoneAngle);\n float sa = sin(uHalftoneAngle);\n mat2 rot = mat2(ca, sa, -sa, ca);\n float cell = max(uHalftoneCell, 2.0);\n vec2 gridPx = rot * gl_FragCoord.xy; // rotate the screen into the dot grid\n vec2 cellId = floor(gridPx / cell);\n vec2 inCell = fract(gridPx / cell); // position within the cell (0..1)\n vec2 centrePx = transpose(rot) * ((cellId + 0.5) * cell); // cell centre, back in screen px\n vec4 tex = texture2D(tDiffuse, centrePx / max(uResolution, vec2(1.0)));\n\n float k = 2.0; // sigmoid contrast (paper default)\n vec3 c = vec3(sigmoid(tex.r, k), sigmoid(tex.g, k), sigmoid(tex.b, k));\n float lum = dot(vec3(0.2126, 0.7152, 0.0722), c);\n lum = mix(1.0, lum, tex.a);\n float dot = getCircle(inCell, lum, 1.3); // baseR 1.3 ≈ paper original-colours default\n vec4 dots = vec4(tex.rgb, tex.a * dot); // wave-coloured dots, transparent between\n gl_FragColor = mix(texture2D(tDiffuse, vUv), dots, clamp(uHalftone, 0.0, 1.0));\n}\n", iu = "\nuniform sampler2D tDiffuse;\nuniform float uHeatmap; // 0..1 mix\nvarying vec2 vUv;\nvec3 heat(float t){\n t = clamp(t, 0.0, 1.0);\n vec3 c = mix(vec3(0.0, 0.0, 0.4), vec3(0.0, 0.6, 1.0), smoothstep(0.0, 0.25, t));\n c = mix(c, vec3(0.0, 1.0, 0.4), smoothstep(0.25, 0.5, t));\n c = mix(c, vec3(1.0, 1.0, 0.0), smoothstep(0.5, 0.75, t));\n c = mix(c, vec3(1.0, 0.1, 0.0), smoothstep(0.75, 1.0, t));\n return c;\n}\nvoid main(){\n vec4 src = texture2D(tDiffuse, vUv);\n float l = dot(src.rgb, vec3(0.299, 0.587, 0.114));\n gl_FragColor = vec4(mix(src.rgb, heat(l), clamp(uHeatmap, 0.0, 1.0)), src.a);\n}\n", au = "\nuniform sampler2D tDiffuse;\nuniform float uPaper; // 0..1 strength\nuniform float uPaperScale; // grain scale\nvarying vec2 vUv;\nfloat h21(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }\nvoid main(){\n vec4 src = texture2D(tDiffuse, vUv);\n vec2 p = gl_FragCoord.xy / max(uPaperScale, 0.5);\n float fiber = h21(floor(p)) * 0.5 + h21(floor(p * vec2(0.3, 3.0))) * 0.5; // directional fibers\n float tex = mix(fiber, h21(gl_FragCoord.xy), 0.3); // + fine speckle\n float shade = 1.0 - (tex - 0.5) * 0.35;\n gl_FragColor = vec4(src.rgb * mix(1.0, shade, clamp(uPaper, 0.0, 1.0)), src.a);\n}\n", ou = "\nuniform sampler2D tDiffuse;\nuniform float uHalftoneCmyk; // 0..1 mix\nuniform float uHalftoneCmykCell; // dot cell size in device px\nvarying vec2 vUv;\n// One rotated halftone dot screen for a channel value.\nfloat dotScreen(vec2 coord, float value, float angle, float cell){\n float ca = cos(angle);\n float sa = sin(angle);\n vec2 r = mat2(ca, sa, -sa, ca) * coord;\n vec2 c = fract(r / max(cell, 2.0)) - 0.5;\n float radius = sqrt(clamp(value, 0.0, 1.0)) * 0.5;\n return smoothstep(radius, radius - 0.06, length(c));\n}\nvoid main(){\n vec4 src = texture2D(tDiffuse, vUv);\n float k = 1.0 - max(max(src.r, src.g), src.b); // RGB → CMYK\n float invK = max(1.0 - k, 1e-3);\n float cyan = (1.0 - src.r - k) / invK;\n float mag = (1.0 - src.g - k) / invK;\n float yel = (1.0 - src.b - k) / invK;\n vec2 coord = gl_FragCoord.xy;\n float cell = uHalftoneCmykCell;\n float dc = dotScreen(coord, cyan, 1.309, cell); // 75°\n float dm = dotScreen(coord, mag, 0.262, cell); // 15°\n float dy = dotScreen(coord, yel, 0.0, cell); // 0°\n float dk = dotScreen(coord, k, 0.785, cell); // 45°\n // Subtractive: cyan ink absorbs red, magenta absorbs green, yellow absorbs blue, black absorbs all.\n vec3 outc = vec3(1.0) - vec3(dc, 0.0, 0.0) - vec3(0.0, dm, 0.0) - vec3(0.0, 0.0, dy) - vec3(dk);\n outc = clamp(outc, 0.0, 1.0);\n gl_FragColor = vec4(mix(src.rgb, outc, clamp(uHalftoneCmyk, 0.0, 1.0)), src.a);\n}\n";
12156
+ })), cu, lu, uu, du, fu, pu, mu = t((() => {
12157
+ Vc(), cu = 400, lu = 16, uu = cu / 4, du = new K(1, 0, 0), fu = new K(0, 1, 0), pu = class {
12151
12158
  geometry;
12152
12159
  segments = -1;
12153
12160
  constructor(e) {
@@ -12156,11 +12163,11 @@ void main(){
12156
12163
  resize(e) {
12157
12164
  if (e === this.segments) return;
12158
12165
  this.segments = e;
12159
- let t = Gt.clamp(Math.round(e), 48, 200), n = t * 2, r = new wi(su, su, t, n), i = r.attributes.position, a = r.attributes.uv, o = new K();
12166
+ let t = Gt.clamp(Math.round(e), 48, 200), n = t * 2, r = new wi(cu, cu, t, n), i = r.attributes.position, a = r.attributes.uv, o = new K();
12160
12167
  for (let e = 0; e < i.count; e++) {
12161
12168
  o.fromBufferAttribute(i, e);
12162
12169
  let t = a.getY(e), n = 4 - 2 * (4 * t * (1 - t)) ** 9.5;
12163
- o.x < -16 ? o.z += n : o.x < cu ? (o.z = Math.cos(Gt.mapLinear(o.x, -16, cu, 0, Math.PI)) * n, o.x = Math.cos(Gt.mapLinear(o.x, -16, cu, -Math.PI / 2, Math.PI / 2)) * n - cu) : (o.z -= n, o.x = -o.x), o.x += lu, o.applyAxisAngle(uu, -Math.PI / 2), o.applyAxisAngle(du, -Math.PI / 2), i.setXYZ(e, o.x, o.y, o.z);
12170
+ o.x < -16 ? o.z += n : o.x < lu ? (o.z = Math.cos(Gt.mapLinear(o.x, -16, lu, 0, Math.PI)) * n, o.x = Math.cos(Gt.mapLinear(o.x, -16, lu, -Math.PI / 2, Math.PI / 2)) * n - lu) : (o.z -= n, o.x = -o.x), o.x += uu, o.applyAxisAngle(du, -Math.PI / 2), o.applyAxisAngle(fu, -Math.PI / 2), i.setXYZ(e, o.x, o.y, o.z);
12164
12171
  }
12165
12172
  i.needsUpdate = !0;
12166
12173
  let s = t + 1, c = r.getIndex(), l = c ? Array.from(c.array) : [];
@@ -12181,115 +12188,115 @@ void main(){
12181
12188
  }));
12182
12189
  //#endregion
12183
12190
  //#region src/renderer/interaction.ts
12184
- function mu(e, t) {
12191
+ function hu(e, t) {
12185
12192
  return e > 0 ? 1 - Math.exp(-t / e) : 1;
12186
12193
  }
12187
- function hu(e, t, n, r, i, a) {
12194
+ function gu(e, t, n, r, i, a) {
12188
12195
  if (a <= 0) return;
12189
- let o = a > ju ? Math.min(Math.ceil(a / ju), Mu) : 1, s = a / o, c = r * r, l = 2 * i * r;
12196
+ let o = a > Mu ? Math.min(Math.ceil(a / Mu), Nu) : 1, s = a / o, c = r * r, l = 2 * i * r;
12190
12197
  for (let r = 0; r < o; r++) t.x += (c * (n.x - e.x) - l * t.x) * s, t.y += (c * (n.y - e.y) - l * t.y) * s, e.x += t.x * s, e.y += t.y * s;
12191
12198
  }
12192
- function gu(e) {
12199
+ function _u(e) {
12193
12200
  return e.interaction?.enabled !== !1;
12194
12201
  }
12195
- function _u(e) {
12202
+ function vu(e) {
12196
12203
  let t = e.interaction;
12197
12204
  return !!t && (!!t.hover || (t.press?.ripple ?? 0) > 0);
12198
12205
  }
12199
- function vu(e, t) {
12200
- return gu(e) && _u(t);
12201
- }
12202
12206
  function yu(e, t) {
12203
- return gu(e) && (t.interaction?.press?.ripple ?? 0) > 0;
12207
+ return _u(e) && vu(t);
12204
12208
  }
12205
- function bu(e) {
12206
- return gu(e) && e.waves.some(_u);
12209
+ function bu(e, t) {
12210
+ return _u(e) && (t.interaction?.press?.ripple ?? 0) > 0;
12207
12211
  }
12208
12212
  function xu(e) {
12209
- return gu(e) ? (e.interaction?.bindings?.length ?? 0) > 0 ? !0 : e.waves.some((e) => {
12213
+ return _u(e) && e.waves.some(vu);
12214
+ }
12215
+ function Su(e) {
12216
+ return _u(e) ? (e.interaction?.bindings?.length ?? 0) > 0 ? !0 : e.waves.some((e) => {
12210
12217
  let t = e.interaction;
12211
12218
  return !!t && (!!t.hover || (t.press?.ripple ?? 0) > 0 || (t.bindings?.length ?? 0) > 0);
12212
12219
  }) : !1;
12213
12220
  }
12214
- var Su, Cu, wu, Tu, Eu, Du, Ou, ku, Au, ju, Mu, Nu, Pu, Fu, Iu, Lu, Ru = t((() => {
12215
- Vc(), hl(), Su = 1.5, Cu = .08, wu = 4, Tu = 2, Eu = .15, Du = .12, Ou = .25, ku = .7, Au = .02, ju = 1 / 120, Mu = 6, Nu = (e, t) => ({
12221
+ var Cu, wu, Tu, Eu, Du, Ou, ku, Au, ju, Mu, Nu, Pu, Fu, Iu, Lu, Ru, zu = t((() => {
12222
+ Vc(), hl(), Cu = 1.5, wu = .08, Tu = 4, Eu = 2, Du = .15, Ou = .12, ku = .25, Au = .7, ju = .02, Mu = 1 / 120, Nu = 6, Pu = (e, t) => ({
12216
12223
  base: e,
12217
12224
  apply: t
12218
- }), Pu = (e, t) => ({
12225
+ }), Fu = (e, t) => ({
12219
12226
  base: e,
12220
12227
  apply: t
12221
- }), Fu = {
12222
- displaceAmount: Nu((e) => e.displaceAmount, (e, t) => {
12228
+ }), Iu = {
12229
+ displaceAmount: Pu((e) => e.displaceAmount, (e, t) => {
12223
12230
  t.u.uDispAmount.value = e;
12224
12231
  }),
12225
- detailAmount: Nu((e) => e.detailAmount ?? 0, (e, t) => {
12232
+ detailAmount: Pu((e) => e.detailAmount ?? 0, (e, t) => {
12226
12233
  t.u.uDetailAmount.value = e;
12227
12234
  }),
12228
- twistPowerX: Nu((e) => e.twistPower.x, (e, t) => {
12235
+ twistPowerX: Pu((e) => e.twistPower.x, (e, t) => {
12229
12236
  t.u.uTwPowX.value = e;
12230
12237
  }),
12231
- twistPowerY: Nu((e) => e.twistPower.y, (e, t) => {
12238
+ twistPowerY: Pu((e) => e.twistPower.y, (e, t) => {
12232
12239
  t.u.uTwPowY.value = e;
12233
12240
  }),
12234
- twistPowerZ: Nu((e) => e.twistPower.z, (e, t) => {
12241
+ twistPowerZ: Pu((e) => e.twistPower.z, (e, t) => {
12235
12242
  t.u.uTwPowZ.value = e;
12236
12243
  }),
12237
- twistFrequencyX: Nu((e) => e.twistFrequency.x, (e, t) => {
12244
+ twistFrequencyX: Pu((e) => e.twistFrequency.x, (e, t) => {
12238
12245
  t.u.uTwFreqX.value = e;
12239
12246
  }),
12240
- twistFrequencyY: Nu((e) => e.twistFrequency.y, (e, t) => {
12247
+ twistFrequencyY: Pu((e) => e.twistFrequency.y, (e, t) => {
12241
12248
  t.u.uTwFreqY.value = e;
12242
12249
  }),
12243
- twistFrequencyZ: Nu((e) => e.twistFrequency.z, (e, t) => {
12250
+ twistFrequencyZ: Pu((e) => e.twistFrequency.z, (e, t) => {
12244
12251
  t.u.uTwFreqZ.value = e;
12245
12252
  }),
12246
- hueShift: Nu((e) => e.hueShift, (e, t) => {
12253
+ hueShift: Pu((e) => e.hueShift, (e, t) => {
12247
12254
  t.u.uHueShift.value = e;
12248
12255
  }),
12249
- gradientShift: Nu((e) => e.gradientShift ?? 0, (e, t) => {
12256
+ gradientShift: Pu((e) => e.gradientShift ?? 0, (e, t) => {
12250
12257
  t.u.uGradShift.value = e;
12251
12258
  }),
12252
- colorSaturation: Nu((e) => e.colorSaturation, (e, t) => {
12259
+ colorSaturation: Pu((e) => e.colorSaturation, (e, t) => {
12253
12260
  t.u.uSaturation.value = e;
12254
12261
  }),
12255
- opacity: Nu((e) => e.opacity, (e, t) => {
12262
+ opacity: Pu((e) => e.opacity, (e, t) => {
12256
12263
  t.u.uOpacity.value = e;
12257
12264
  }),
12258
- lineThickness: Nu((e) => e.lineThickness ?? 1, (e, t) => {
12265
+ lineThickness: Pu((e) => e.lineThickness ?? 1, (e, t) => {
12259
12266
  t.u.uLineThickness.value = e;
12260
12267
  }),
12261
- lineAmount: Nu((e) => e.lineAmount ?? 425, (e, t) => {
12268
+ lineAmount: Pu((e) => e.lineAmount ?? 425, (e, t) => {
12262
12269
  t.u.uLineAmount.value = e;
12263
12270
  }),
12264
- fiberStrength: Nu((e) => e.fiberStrength, (e, t) => {
12271
+ fiberStrength: Pu((e) => e.fiberStrength, (e, t) => {
12265
12272
  t.u.uFiberStrength.value = e;
12266
12273
  }),
12267
- sheen: Nu((e) => e.sheen ?? 1, (e, t) => {
12274
+ sheen: Pu((e) => e.sheen ?? 1, (e, t) => {
12268
12275
  t.u.uSheen.value = e;
12269
12276
  }),
12270
- iridescence: Nu((e) => e.iridescence ?? 0, (e, t) => {
12277
+ iridescence: Pu((e) => e.iridescence ?? 0, (e, t) => {
12271
12278
  t.u.uIridescence.value = e;
12272
12279
  }),
12273
- positionX: Nu((e) => e.position.x, (e, t) => {
12280
+ positionX: Pu((e) => e.position.x, (e, t) => {
12274
12281
  t.mesh.position.x = e;
12275
12282
  }),
12276
- positionY: Nu((e) => e.position.y, (e, t) => {
12283
+ positionY: Pu((e) => e.position.y, (e, t) => {
12277
12284
  t.mesh.position.y = e;
12278
12285
  })
12279
- }, Iu = {
12280
- timeOffset: Pu((e) => e.timeOffset ?? 0, (e, t) => {
12286
+ }, Lu = {
12287
+ timeOffset: Fu((e) => e.timeOffset ?? 0, (e, t) => {
12281
12288
  t.out.timeOffset = e;
12282
12289
  }),
12283
- cameraZoom: Pu((e) => e.cameraZoom ?? 1, (e, t) => {
12290
+ cameraZoom: Fu((e) => e.cameraZoom ?? 1, (e, t) => {
12284
12291
  t.out.zoom = e;
12285
12292
  }),
12286
- blur: Pu((e) => e.blur, (e, t) => {
12293
+ blur: Fu((e) => e.blur, (e, t) => {
12287
12294
  t.post.uBlurAmount.value = e;
12288
12295
  }),
12289
- grain: Pu((e) => e.grain, (e, t) => {
12296
+ grain: Fu((e) => e.grain, (e, t) => {
12290
12297
  t.post.uGrainAmount.value = e;
12291
12298
  })
12292
- }, Lu = class {
12299
+ }, Ru = class {
12293
12300
  container;
12294
12301
  cfg;
12295
12302
  scrollOverride = null;
@@ -12367,12 +12374,12 @@ var Su, Cu, wu, Tu, Eu, Du, Ou, ku, Au, ju, Mu, Nu, Pu, Fu, Iu, Lu, Ru = t((() =
12367
12374
  update(e) {
12368
12375
  let t = this.cfg();
12369
12376
  if (!t) return;
12370
- let n = Math.max(e, 0), r = mu(Du, n);
12377
+ let n = Math.max(e, 0), r = hu(Ou, n);
12371
12378
  if (this.ndcPrev.copy(this.ndc), this.ndc.lerp(this.ndcTarget, r), this.presence += (this.presenceTarget - this.presence) * r, this.press += (this.pressTarget - this.press) * r, n > 1e-5) {
12372
- let e = mu(Cu, n);
12379
+ let e = hu(wu, n);
12373
12380
  this.velNdc.x += ((this.ndc.x - this.ndcPrev.x) / n - this.velNdc.x) * e, this.velNdc.y += ((this.ndc.y - this.ndcPrev.y) / n - this.velNdc.y) * e;
12374
12381
  }
12375
- this.pointerSpeed = this.presence * ml(this.velNdc.length() / wu);
12382
+ this.pointerSpeed = this.presence * ml(this.velNdc.length() / Tu);
12376
12383
  let i = t.waves;
12377
12384
  this.fields.length > i.length && (this.fields.length = i.length);
12378
12385
  for (let e = 0; e < i.length; e++) {
@@ -12382,19 +12389,19 @@ var Su, Cu, wu, Tu, Eu, Du, Ou, ku, Au, ju, Mu, Nu, Pu, Fu, Iu, Lu, Ru = t((() =
12382
12389
  vel: new G(),
12383
12390
  presence: this.presenceTarget
12384
12391
  }, this.fields[e] = t);
12385
- let r = Math.max(i[e].interaction?.hover?.smoothing ?? Du, Au);
12386
- hu(t.ndc, t.vel, this.ndcTarget, 1 / r, ku, n), t.presence += (this.presenceTarget - t.presence) * mu(r, n);
12392
+ let r = Math.max(i[e].interaction?.hover?.smoothing ?? Ou, ju);
12393
+ gu(t.ndc, t.vel, this.ndcTarget, 1 / r, Au, n), t.presence += (this.presenceTarget - t.presence) * hu(r, n);
12387
12394
  }
12388
12395
  let a = this.scrollOverride ?? this.computeScroll();
12389
12396
  if (n > 1e-5) {
12390
12397
  let e = Math.abs(a - this.scrollPrev) / n;
12391
- this.scrollVel += (e - this.scrollVel) * mu(Eu, n);
12398
+ this.scrollVel += (e - this.scrollVel) * hu(Du, n);
12392
12399
  }
12393
12400
  this.scrollPrev = a, this.scroll = a, this.appearLatched = !0;
12394
12401
  for (let e of this.ripples) {
12395
12402
  if (!e.active) continue;
12396
12403
  e.age += n;
12397
- let t = Math.max(0, 1 - e.age / Su);
12404
+ let t = Math.max(0, 1 - e.age / Cu);
12398
12405
  e.amp = t * t, e.amp <= 0 && (e.active = !1);
12399
12406
  }
12400
12407
  this.updateBindings(t, n);
@@ -12416,7 +12423,7 @@ var Su, Cu, wu, Tu, Eu, Du, Ou, ku, Au, ju, Mu, Nu, Pu, Fu, Iu, Lu, Ru = t((() =
12416
12423
  (!r || r.source !== e.source) && (r = {
12417
12424
  value: e.source === "appear" ? 0 : n,
12418
12425
  source: e.source
12419
- }, this.bindingState.set(e, r)), r.value += (n - r.value) * mu(e.smoothing ?? Ou, t);
12426
+ }, this.bindingState.set(e, r)), r.value += (n - r.value) * hu(e.smoothing ?? ku, t);
12420
12427
  }
12421
12428
  bindingValue(e) {
12422
12429
  return this.bindingState.get(e)?.value ?? 0;
@@ -12429,7 +12436,7 @@ var Su, Cu, wu, Tu, Eu, Du, Ou, ku, Au, ju, Mu, Nu, Pu, Fu, Iu, Lu, Ru = t((() =
12429
12436
  case "pointerY": return (this.ndc.y + 1) * .5;
12430
12437
  case "pointerSpeed": return this.pointerSpeed;
12431
12438
  case "press": return this.press;
12432
- case "scrollVelocity": return ml(this.scrollVel / Tu);
12439
+ case "scrollVelocity": return ml(this.scrollVel / Eu);
12433
12440
  case "appear": return +!!this.appearLatched;
12434
12441
  default: return this.customInputs.get(e.slice(7)) ?? 0;
12435
12442
  }
@@ -12494,42 +12501,42 @@ var Su, Cu, wu, Tu, Eu, Du, Ou, ku, Au, ju, Mu, Nu, Pu, Fu, Iu, Lu, Ru = t((() =
12494
12501
  }));
12495
12502
  //#endregion
12496
12503
  //#region src/renderer/palette.ts
12497
- function zu(e) {
12504
+ function Bu(e) {
12498
12505
  return e * e * (3 - 2 * e);
12499
12506
  }
12500
- function Bu(e, t) {
12507
+ function Vu(e, t) {
12501
12508
  let n = new X(e).clone().convertLinearToSRGB();
12502
12509
  return `rgba(${Math.round(n.r * 255)}, ${Math.round(n.g * 255)}, ${Math.round(n.b * 255)}, ${t})`;
12503
12510
  }
12504
- function Vu(e) {
12511
+ function Hu(e) {
12505
12512
  let t = document.createElement("canvas");
12506
- t.width = od, t.height = sd;
12513
+ t.width = sd, t.height = cd;
12507
12514
  let n = t.getContext("2d");
12508
12515
  if (!n) return t;
12509
- let r = [...e.stops].sort((e, t) => e.pos - t.pos), i = n.createLinearGradient(0, 0, od, 0);
12516
+ let r = [...e.stops].sort((e, t) => e.pos - t.pos), i = n.createLinearGradient(0, 0, sd, 0);
12510
12517
  if (r.length === 0) i.addColorStop(0, "#ffffff");
12511
12518
  else for (let e of r) i.addColorStop(ml(e.pos), e.color);
12512
- n.fillStyle = i, n.fillRect(0, 0, od, sd);
12519
+ n.fillStyle = i, n.fillRect(0, 0, sd, cd);
12513
12520
  let a = ml(e.edgeAmount);
12514
12521
  if (a > .001) {
12515
- let t = n.createLinearGradient(0, 0, 0, sd);
12516
- t.addColorStop(0, Bu(e.edgeColor, a)), t.addColorStop(.5, Bu(e.edgeColor, 0)), t.addColorStop(1, Bu(e.edgeColor, a)), n.fillStyle = t, n.fillRect(0, 0, od, sd);
12522
+ let t = n.createLinearGradient(0, 0, 0, cd);
12523
+ t.addColorStop(0, Vu(e.edgeColor, a)), t.addColorStop(.5, Vu(e.edgeColor, 0)), t.addColorStop(1, Vu(e.edgeColor, a)), n.fillStyle = t, n.fillRect(0, 0, sd, cd);
12517
12524
  }
12518
12525
  return t;
12519
12526
  }
12520
- function Hu(e) {
12521
- return `${e.stops.map((e) => `${e.color}@${e.pos.toFixed(3)}`).join(",")}|${e.edgeColor}|${e.edgeAmount.toFixed(3)}`;
12522
- }
12523
12527
  function Uu(e) {
12524
- return e.colorSpace = At, e.minFilter = z, e.magFilter = z, e.wrapS = he, e.wrapT = he, e.generateMipmaps = !1, e;
12528
+ return `${e.stops.map((e) => `${e.color}@${e.pos.toFixed(3)}`).join(",")}|${e.edgeColor}|${e.edgeAmount.toFixed(3)}`;
12525
12529
  }
12526
12530
  function Wu(e) {
12527
- return Uu(new yi(e));
12531
+ return e.colorSpace = At, e.minFilter = z, e.magFilter = z, e.wrapS = he, e.wrapT = he, e.generateMipmaps = !1, e;
12528
12532
  }
12529
12533
  function Gu(e) {
12530
- return Wu(Vu(e));
12534
+ return Wu(new yi(e));
12531
12535
  }
12532
12536
  function Ku(e) {
12537
+ return Gu(Hu(e));
12538
+ }
12539
+ function qu(e) {
12533
12540
  let t = document.createElement("canvas");
12534
12541
  t.width = Math.max(1, Math.round(e.width)), t.height = Math.max(1, Math.round(e.height));
12535
12542
  let n = t.getContext("2d");
@@ -12546,11 +12553,11 @@ function Ku(e) {
12546
12553
  else for (let e of l) c.addColorStop(ml(e.pos), e.color);
12547
12554
  return n.fillStyle = c, n.fillRect(0, 0, r, i), t;
12548
12555
  }
12549
- function qu(e) {
12556
+ function Ju(e) {
12550
12557
  let t = ml(e), n = t <= .0031308 ? t * 12.92 : 1.055 * t ** (1 / 2.4) - .055;
12551
12558
  return Math.round(ml(n) * 255);
12552
12559
  }
12553
- function Ju(e, t, n, r) {
12560
+ function Yu(e, t, n, r) {
12554
12561
  let i = Math.max(1, Math.round(n)), a = Math.max(1, Math.round(r)), o = new ImageData(i, a), s = o.data, c = e.length >= 2 ? e : yl(), l = c.map((e) => new X(e.color)), u = 4.8 + -3.4499999999999997 * ml(t);
12555
12562
  for (let e = 0; e < a; e++) {
12556
12563
  let t = 1 - e / Math.max(1, a - 1);
@@ -12561,12 +12568,12 @@ function Ju(e, t, n, r) {
12561
12568
  a += l[e].r * s, o += l[e].g * s, d += l[e].b * s, f += s;
12562
12569
  }
12563
12570
  let p = Math.max(f, 1e-4), m = (e * i + n) * 4;
12564
- s[m] = qu(a / p), s[m + 1] = qu(o / p), s[m + 2] = qu(d / p), s[m + 3] = 255;
12571
+ s[m] = Ju(a / p), s[m + 1] = Ju(o / p), s[m + 2] = Ju(d / p), s[m + 3] = 255;
12565
12572
  }
12566
12573
  }
12567
12574
  return o;
12568
12575
  }
12569
- function Yu(e, t, n, r) {
12576
+ function Xu(e, t, n, r) {
12570
12577
  let i = document.createElement("canvas");
12571
12578
  i.width = Math.max(1, Math.round(n)), i.height = Math.max(1, Math.round(r));
12572
12579
  let a = i.getContext("2d");
@@ -12574,42 +12581,42 @@ function Yu(e, t, n, r) {
12574
12581
  let o = Math.min(1, 320 / Math.max(i.width, i.height)), s = Math.max(2, Math.round(i.width * o)), c = Math.max(2, Math.round(i.height * o)), l = document.createElement("canvas");
12575
12582
  l.width = s, l.height = c;
12576
12583
  let u = l.getContext("2d");
12577
- return u ? (u.putImageData(Ju(e, t, s, c), 0, 0), a.imageSmoothingEnabled = !0, a.imageSmoothingQuality = "high", a.drawImage(l, 0, 0, s, c, 0, 0, i.width, i.height), i) : i;
12584
+ return u ? (u.putImageData(Yu(e, t, s, c), 0, 0), a.imageSmoothingEnabled = !0, a.imageSmoothingQuality = "high", a.drawImage(l, 0, 0, s, c, 0, 0, i.width, i.height), i) : i;
12578
12585
  }
12579
- function Xu(e, t, n, r, i, a, o, s = 1, c = 0, l = 0) {
12586
+ function Zu(e, t, n, r, i, a, o, s = 1, c = 0, l = 0) {
12580
12587
  let u = document.createElement("canvas");
12581
- return u.width = Math.max(1, Math.round(r)), u.height = Math.max(1, Math.round(i)), Zu(u, e, t, n, a, o, s, c, l), u;
12588
+ return u.width = Math.max(1, Math.round(r)), u.height = Math.max(1, Math.round(i)), Qu(u, e, t, n, a, o, s, c, l), u;
12582
12589
  }
12583
- function Zu(e, t, n, r, i, a, o = 1, s = 0, c = 0) {
12590
+ function Qu(e, t, n, r, i, a, o = 1, s = 0, c = 0) {
12584
12591
  let l = e.getContext("2d");
12585
12592
  if (!l) return;
12586
12593
  l.fillStyle = a, l.fillRect(0, 0, e.width, e.height);
12587
12594
  let u = Math.max(.1, o), d = i === "stretch" ? e.width : n * (i === "contain" ? Math.min(e.width / n, e.height / r) : Math.max(e.width / n, e.height / r)), f = i === "stretch" ? e.height : r * (i === "contain" ? Math.min(e.width / n, e.height / r) : Math.max(e.width / n, e.height / r)), p = d * u, m = f * u, h = s / 100 * e.width, g = c / 100 * e.height;
12588
12595
  l.drawImage(t, (e.width - p) / 2 + h, (e.height - m) / 2 + g, p, m);
12589
12596
  }
12590
- function Qu(e) {
12597
+ function $u(e) {
12591
12598
  let t = (t, n) => {
12592
12599
  let r = t * 374761393 + n * 668265263 + e * 1442695041 | 0;
12593
12600
  return r = Math.imul(r ^ r >>> 13, 1274126177), ((r ^ r >>> 16) >>> 0) / 4294967295;
12594
12601
  };
12595
12602
  return (e, n) => {
12596
- let r = Math.floor(e), i = Math.floor(n), a = zu(e - r), o = zu(n - i), s = t(r, i), c = t(r + 1, i), l = t(r, i + 1), u = t(r + 1, i + 1);
12603
+ let r = Math.floor(e), i = Math.floor(n), a = Bu(e - r), o = Bu(n - i), s = t(r, i), c = t(r + 1, i), l = t(r, i + 1), u = t(r + 1, i + 1);
12597
12604
  return s * (1 - a) * (1 - o) + c * a * (1 - o) + l * (1 - a) * o + u * a * o;
12598
12605
  };
12599
12606
  }
12600
- function $u(e, t, n, r) {
12607
+ function ed(e, t, n, r) {
12601
12608
  let i = 0, a = .5, o = 1, s = 0;
12602
12609
  for (let c = 0; c < r; c++) i += a * e(t * o, n * o), s += a, o *= 2, a *= .5;
12603
12610
  return i / s;
12604
12611
  }
12605
- function ed(e = 220) {
12606
- let t = Math.max(64, Math.min(1280, Math.round(e))), n = ld.get(t);
12612
+ function td(e = 220) {
12613
+ let t = Math.max(64, Math.min(1280, Math.round(e))), n = ud.get(t);
12607
12614
  if (n) return n;
12608
12615
  let r = document.createElement("canvas");
12609
12616
  r.width = t, r.height = t;
12610
12617
  let i = r.getContext("2d");
12611
12618
  if (!i) return r;
12612
- let a = i.createImageData(t, t), o = Qu(11), s = Qu(91), c = Qu(47), l = [
12619
+ let a = i.createImageData(t, t), o = $u(11), s = $u(91), c = $u(47), l = [
12613
12620
  [0, [
12614
12621
  34,
12615
12622
  26,
@@ -12653,24 +12660,24 @@ function ed(e = 220) {
12653
12660
  return l[l.length - 1][1];
12654
12661
  };
12655
12662
  for (let e = 0; e < t; e++) for (let n = 0; n < t; n++) {
12656
- let r = n / t * 3, i = e / t * 3, l = r + .7 * s(r * .7 + 5, i * .7), d = i + .7 * s(r * .7, i * .7 + 9), [f, p, m] = u($u(o, l, d, 4)), h = Math.max(0, $u(c, l * 1.6 + 3, d * 1.6, 3) - .55) * 1.7;
12663
+ let r = n / t * 3, i = e / t * 3, l = r + .7 * s(r * .7 + 5, i * .7), d = i + .7 * s(r * .7, i * .7 + 9), [f, p, m] = u(ed(o, l, d, 4)), h = Math.max(0, ed(c, l * 1.6 + 3, d * 1.6, 3) - .55) * 1.7;
12657
12664
  f = f * (1 - h) + 70 * h, p = p * (1 - h) + 210 * h, m = m * (1 - h) + 200 * h;
12658
12665
  let g = (e * t + n) * 4;
12659
12666
  a.data[g] = f, a.data[g + 1] = p, a.data[g + 2] = m, a.data[g + 3] = 255;
12660
12667
  }
12661
- return i.putImageData(a, 0, 0), ld.set(t, r), r;
12668
+ return i.putImageData(a, 0, 0), ud.set(t, r), r;
12662
12669
  }
12663
- function td(e, t, n, r) {
12664
- let i = `${e}|${t}x${n}`, a = ud.get(i);
12670
+ function nd(e, t, n, r) {
12671
+ let i = `${e}|${t}x${n}`, a = dd.get(i);
12665
12672
  if (a) return a;
12666
12673
  let o = document.createElement("canvas");
12667
12674
  o.width = t, o.height = n;
12668
12675
  let s = o.getContext("2d");
12669
- return s && r(s, t, n), ud.set(i, o), o;
12676
+ return s && r(s, t, n), dd.set(i, o), o;
12670
12677
  }
12671
- function nd(e = 240) {
12678
+ function rd(e = 240) {
12672
12679
  let t = Math.max(120, Math.min(2048, Math.round(e)));
12673
- return td("vaporwave", t, Math.round(t * 2 / 3), (e, t, n) => {
12680
+ return nd("vaporwave", t, Math.round(t * 2 / 3), (e, t, n) => {
12674
12681
  let r = t / 240, i = e.createLinearGradient(0, 0, 0, n);
12675
12682
  i.addColorStop(0, "#120638"), i.addColorStop(.56, "#8e2de2"), i.addColorStop(1, "#ff2fa8"), e.fillStyle = i, e.fillRect(0, 0, t, n);
12676
12683
  let a = n * .48, o = n * .28, s = e.createLinearGradient(0, a - o, 0, a + o);
@@ -12686,9 +12693,9 @@ function nd(e = 240) {
12686
12693
  e.globalAlpha = 1;
12687
12694
  });
12688
12695
  }
12689
- function rd(e = 220) {
12696
+ function id(e = 220) {
12690
12697
  let t = Math.max(110, Math.min(2048, Math.round(e)));
12691
- return td("kaleidoscope", t, t, (e, t, n) => {
12698
+ return nd("kaleidoscope", t, t, (e, t, n) => {
12692
12699
  let r = t / 220, i = [
12693
12700
  "#00e5ff",
12694
12701
  "#6c3bff",
@@ -12704,25 +12711,25 @@ function rd(e = 220) {
12704
12711
  for (let t = 1; t <= 4; t++) e.strokeStyle = t % 2 ? "rgba(255,255,255,.55)" : "rgba(8,5,35,.6)", e.lineWidth = 5 * r, e.beginPath(), e.arc(a, o, t * 25 * r, 0, Math.PI * 2), e.stroke();
12705
12712
  });
12706
12713
  }
12707
- function id(e, t) {
12708
- return e.build ? e.build(t) : Vu({
12714
+ function ad(e, t) {
12715
+ return e.build ? e.build(t) : Hu({
12709
12716
  stops: e.stops ?? [],
12710
12717
  edgeColor: e.edgeColor ?? "#8e9dff",
12711
12718
  edgeAmount: e.edgeAmount ?? 0
12712
12719
  });
12713
12720
  }
12714
- function ad(e) {
12715
- return Uu(new Zi().load(e));
12721
+ function od(e) {
12722
+ return Wu(new Zi().load(e));
12716
12723
  }
12717
- var od, sd, cd, ld, ud, dd, fd = t((() => {
12718
- Vc(), hl(), Gl(), od = 256, sd = 64, cd = (e) => e.map(([e, t]) => ({
12724
+ var sd, cd, ld, ud, dd, fd, pd = t((() => {
12725
+ Vc(), hl(), Kl(), sd = 256, cd = 64, ld = (e) => e.map(([e, t]) => ({
12719
12726
  color: e,
12720
12727
  pos: t
12721
- })), ld = /* @__PURE__ */ new Map(), ud = /* @__PURE__ */ new Map(), dd = {
12728
+ })), ud = /* @__PURE__ */ new Map(), dd = /* @__PURE__ */ new Map(), fd = {
12722
12729
  palestine: {
12723
12730
  label: "Palestine",
12724
12731
  kind: "gradient",
12725
- stops: cd([
12732
+ stops: ld([
12726
12733
  ["#000000", 0],
12727
12734
  ["#f7f7f2", .34],
12728
12735
  ["#149954", .67],
@@ -12734,7 +12741,7 @@ var od, sd, cd, ld, ud, dd, fd = t((() => {
12734
12741
  spain: {
12735
12742
  label: "Spain",
12736
12743
  kind: "gradient",
12737
- stops: cd([
12744
+ stops: ld([
12738
12745
  ["#aa151b", 0],
12739
12746
  ["#aa151b", .24],
12740
12747
  ["#f1bf00", .34],
@@ -12748,7 +12755,7 @@ var od, sd, cd, ld, ud, dd, fd = t((() => {
12748
12755
  grandLine: {
12749
12756
  label: "Grand Line",
12750
12757
  kind: "gradient",
12751
- stops: cd([
12758
+ stops: ld([
12752
12759
  ["#071b33", 0],
12753
12760
  ["#087ea4", .22],
12754
12761
  ["#45d4c5", .4],
@@ -12763,22 +12770,22 @@ var od, sd, cd, ld, ud, dd, fd = t((() => {
12763
12770
  vaporwave: {
12764
12771
  label: "Vaporwave Sunset",
12765
12772
  kind: "image",
12766
- build: nd
12773
+ build: rd
12767
12774
  },
12768
12775
  kaleidoscope: {
12769
12776
  label: "Kaleidoscope",
12770
12777
  kind: "image",
12771
- build: rd
12778
+ build: id
12772
12779
  },
12773
12780
  nebula: {
12774
12781
  label: "Nebula (2D)",
12775
12782
  kind: "image",
12776
- build: ed
12783
+ build: td
12777
12784
  },
12778
12785
  sunset: {
12779
12786
  label: "Sunset",
12780
12787
  kind: "gradient",
12781
- stops: cd([
12788
+ stops: ld([
12782
12789
  ["#3b1c6b", 0],
12783
12790
  ["#8b2fa0", .3],
12784
12791
  ["#e0457a", .56],
@@ -12791,7 +12798,7 @@ var od, sd, cd, ld, ud, dd, fd = t((() => {
12791
12798
  aurora: {
12792
12799
  label: "Aurora",
12793
12800
  kind: "gradient",
12794
- stops: cd([
12801
+ stops: ld([
12795
12802
  ["#0b3d4f", 0],
12796
12803
  ["#1fb89e", .3],
12797
12804
  ["#5ee0a0", .52],
@@ -12804,7 +12811,7 @@ var od, sd, cd, ld, ud, dd, fd = t((() => {
12804
12811
  ocean: {
12805
12812
  label: "Ocean",
12806
12813
  kind: "gradient",
12807
- stops: cd([
12814
+ stops: ld([
12808
12815
  ["#0a1f4d", 0],
12809
12816
  ["#1f6fb8", .36],
12810
12817
  ["#2bd0d0", .66],
@@ -12816,7 +12823,7 @@ var od, sd, cd, ld, ud, dd, fd = t((() => {
12816
12823
  ember: {
12817
12824
  label: "Ember",
12818
12825
  kind: "gradient",
12819
- stops: cd([
12826
+ stops: ld([
12820
12827
  ["#2a0707", 0],
12821
12828
  ["#a81e1e", .34],
12822
12829
  ["#ff5a2e", .64],
@@ -12828,7 +12835,7 @@ var od, sd, cd, ld, ud, dd, fd = t((() => {
12828
12835
  iris: {
12829
12836
  label: "Iris",
12830
12837
  kind: "gradient",
12831
- stops: cd([
12838
+ stops: ld([
12832
12839
  ["#2e1065", 0],
12833
12840
  ["#7c3aed", .34],
12834
12841
  ["#db2777", .64],
@@ -12840,7 +12847,7 @@ var od, sd, cd, ld, ud, dd, fd = t((() => {
12840
12847
  mono: {
12841
12848
  label: "Mono",
12842
12849
  kind: "gradient",
12843
- stops: cd([
12850
+ stops: ld([
12844
12851
  ["#16161e", 0],
12845
12852
  ["#6b7280", .4],
12846
12853
  ["#c2c8d2", .72],
@@ -12853,39 +12860,55 @@ var od, sd, cd, ld, ud, dd, fd = t((() => {
12853
12860
  }));
12854
12861
  //#endregion
12855
12862
  //#region src/util/base64.ts
12856
- function pd(e) {
12863
+ function md(e) {
12857
12864
  let t = atob(e.replace(/-/g, "+").replace(/_/g, "/")), n = new Uint8Array(new ArrayBuffer(t.length));
12858
12865
  for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
12859
12866
  return n;
12860
12867
  }
12861
- var md = t((() => {}));
12868
+ var hd = t((() => {}));
12862
12869
  //#endregion
12863
12870
  //#region src/renderer/heroPalette.ts
12864
- function hd() {
12871
+ function gd() {
12865
12872
  let e = document.createElement("canvas");
12866
- e.width = _d, e.height = _d;
12873
+ e.width = vd, e.height = vd;
12867
12874
  let t = e.getContext("2d");
12868
12875
  if (t) {
12869
- let e = pd(vd);
12870
- t.putImageData(new ImageData(new Uint8ClampedArray(e.buffer), _d, _d), 0, 0);
12876
+ let e = md(yd);
12877
+ t.putImageData(new ImageData(new Uint8ClampedArray(e.buffer), vd, vd), 0, 0);
12871
12878
  }
12872
12879
  return e;
12873
12880
  }
12874
- function gd() {
12875
- let e = Uu(new ci(pd(vd), _d, _d, U, Se));
12881
+ function _d() {
12882
+ let e = Wu(new ci(md(yd), vd, vd, U, Se));
12876
12883
  return e.needsUpdate = !0, e;
12877
12884
  }
12878
- var _d, vd, yd = t((() => {
12879
- Vc(), md(), fd(), _d = 32, vd = "7PP//97s///O4/7/xt77/8vc7f/Y1sr/5c2f/+/EcP/2vEX/+rQp//2xGP/+rRv//J5M//uUf//7jp7/+4a3//2Ax//9g83//4vD//2bu//5kpv/83V+//Nbb//3VnT/81Sf/+tdxf/pid3/56Pr/+a58v/q1/P/6On3/+Xy/P/o8f//2ur+/8/j/P/O4ff/1tzc/+PSr//sx4X/879d//i3Of/8siD//rEP//6vD//9nz7//JJ4//uNnP/6h7f//IDJ//yEz//+jMX//Jq8//aOnf/xa3n/9Fxq//dief/1Y5v/8G62/+2K0v/tq+b/6Lby/+rP8v/q5fb/5vH7/+Pv///X6P7/0uT6/9bi8P/h2sf/682R//LCa//3ukn/+rQs//yxGv/+sQ7//q4T//2eRP/8knv/+o2e//eIuf/6g8v/+obR//yMx//6mb3/84uh//Bnef/1YWn/+nVx//lzj//1g6X/8pjC//Gz3f/stO//6cDx/+rf9P/m8fv/3uz//9Xm/f/V4vj/3d/r/+fWtP/xyHT/9r9R//m3N//7siP//bAW//6xDv/+qxr//ZpP//yPf//4jZ//9Yq6//eHzP/4itL/+o/K//iYvv/wiab/7mZ9//Zpbv/7gG///Il+//iYk//1pa//9LTO//Cx5v/qru7/69fy/+fw+v/Y6f7/1eL7/9nb9v/h2Of/7M+n//XCW//5uj3/+7Ur//yxHf/9rhX//q8Q//6mJP/9k1f/+4x///aNnv/zjbr/9Y3N//aR1f/4lM7/+JnC//COrv/ua4f/9m5y//uGc//8k3z/+qKI//aupP/1tMT/8J3b/+iJ6v/qzfD/6O75/9fl/f/Y3vn/3NPz/+TM4P/uxpr/+LxJ//u3MP/8syX//a8c//2sF//+rBb//p8w//2OX//7ioD/9o6e//KQu//zk8//9ZjX//ec0//4nsn/85i7//B3mf/1cHz/+oZ4//uSgf/6oYX/97Kg//Wpvv/vcdH/5W7n/+vG7f/p6vf/1d78/9nX9//fyu3/6MDN//O8fv/6uDv/+7Qr//yxJf/9rB///akd//6oIP/+mz3//oxm//uMg//2kaD/8pW9//Ob0f/2oNj/+aPX//ul1P/4o83/9Iyy//d7kP/6in3/+5OB//qhgv/5rpX/9pyy/+9czf/kZ+D/7L7q/+vk9f/S0/v/2s30/+O+4//ttK3/+LRW//u0Mf/8si7//K8q//2pJv/9pSj//qMu//6WSP/+jWv/+46F//aVo//zmr//9KHS//em2v/8qNr//qra//2q2P/5n8z/+Iuv//uOjP/7loH//KGA//ukjf/5kab/8VjD/+dq2P/tt+b/7t3y/9XJ+P/gwvD/6bPa//Osmf/6sEn/+7E1//ywNf/8ri///agu//2jNf/+nz3//pRT//6Pb//8k4j/95um//Shwv/1p9T/+Krc//yr2//+rdv//q3c//yp2v/5mM3/+pKp//ubhv/8oIH//J6L//yPmv/2a7D/63fL/++z4//w1u7/48D0/+257f/zr9n/96ic//urU//8rT//+689//yyMv/9ry///qk///6jUP/+nGT//pt6//yfj//4pKz/9ajG//at1v/6r9z//azb//+u3f//r93//q7e//ug3P/6lcn/+52g//ujhP/9nIz//ZKb//qJpP/zjrr/8rHc//PN6v/zuO//+7Ts//uw4f/7qK7//KVo//ynTf/7rEb//bU0//27Jv/9tz3//bJj//6weP/+sIj//a+a//mwsv/2scn/+LTY//uz3f/9rtz//7De//6w3//+reL//aXl//ya4P/8nML//KSZ//2cm//9mrD//aGz//uitf/4r87/9sPk//u07f//tO3//rLo//ymwP/8nYL//J9g//unU//8skL//b0v//zBQP/8xHD//saJ//7FlP/9waP/+725//i5y//5u9j/+rjd//yv3f/+r9///q7i//6r5v/9quj//aTp//2e2v/9oLr//aC1//2ouv/+s7b//rSz//ywwP/6uNn//bPs//6z6//+ruP//J7G//uRmv/7knn/+51m//yrUv/9tkb//MBZ//3Lf//+0pP//tSa//7PqP/8yb7/+sLM//vC1v/6v9z/+bHd//io4v/7pej//arp//2x6P/8ren//KHg//2hxf/9p7v//rC3//+4s///u7D//rS5//2x0f//tO3//7Lr//6n3f/8ksL/+oKl//mDkf/5kXz//KNi//2vWP/+vnH//suQ//7Umv/+2Zz//tan//7SwP/9ysn//srO//vF1P/3sdH/7p7b/+2c6P/2o+3/9Kvs//Gn7f/xn+L//KXF//6uuv//sLj//7S1//+5sf/+tLn//q7Q//+z7f//sen//p/W//uEuv/5daf/9ned//aFjv/6l3f//adp//65ff/+ypr//tGh//7Vn//+1af//ta9///Rv///0r///cvD//m1uP/vn8n/5Jff/96b6//Um/H/zZvy/9Wb6v/ypc7//6+8//+xuf//tLb//7mx//22vf/+rtT//q/q//2n4v/9jsr/+3Wy//drqP/0cKL/9H2Z//iOhv/8oHT//rV///7Hnv/+zqf//tGm//7Uqv/+2Ln//9az///Xsv/90bT//MSj//m6r//tqcn/0aDh/76a8v+9m/b/vZn0/9ue4f/8q8L//rO0//+5rv/+vqn//LrB//6v2v/8qef//JnY//x7vv/6Zq3/9mSn//NtpP/ze53/94qN//yceP/+sn3//sWb//7Oqf/+0an//tas//7cuf//27D//96r//7aqv/+1Jz//tSe//rLrP/htc3/waPr/7if9v+ymvn/zJzt//eoxf/+t6D//8WV//7Kmf/8v8L//a/c//yk5f/7jtL/+224//lcqv/2X6b/9Gyj//R8mv/4jIr//J53//6zfv/+xZr//s2o//7Sqf/+2K7//uC8///htf//46z//t2m//7XnP/+2Z///tmh//XLt//Osdr/s6Lx/7Kd9v/Ro+z/9qvH//64mf//y4j//s+S//zBwf/9sNv//aHk//uI0P/7Zbf/+Feq//Vdpv/0bqD/+IKR//uWfv/+qHf//rqI//7Gnv/+zaf//tSp//7bsP/+477//+W4///mrv//3qT//tic//7Yn//+2qH//NWr/967zP+6pOj/waTt/+Gt4P/4r8j//bWi///Hiv/+zpP//cDB//6v2//9oOT/+4bR//pkuf/3WK3/9F+o//Vynf/6jIX//qR1//61fv/+v5H//seg//7Npv/+1an//t2y//7kwP//5rj//+ex///fpv/+2J3//tie//7ZoP/91qb/5r7E/8am3//Yq97/9LbN//qzxf/8sa///r+R//7MlP/9vcL//q7b//yh5f/6iNP/+Gi8//Vdr//0Zan/93qW//yXev/+rXH//rp///6/kf/+xp///s6l//7WrP/+37j//uXE///kuP//57X//+Os//7Znv/+2J3//tme//3Sof/vu7z/4KvW/+6xz//7tsP/+7PC//uruf/9rJ7//bWd//yzxv/+rtv/+6Ll//iM1P/2b77/9GWw//Vvpf/5hoz//KBy//6ya//+unn//r+Q//7HoP/+z6n//tmz//7iwv/+58j//+K2///mt//+5rT//9ui//7Wnv/+057//smg//u5rv/4ssX/+rTF//u0wP/7sL//+p+7//mRrf/5lK3/+qXL//6u2//4o+X/9JDU//R5vf/1cq7/93ud//qQhf/7pW///bJm//67dP/+wY///smj//7Sr//+3Lz//uXK//7ny///37T//+O0//7isv/+0Jb//8WH///AjP/+upf//rSh//2zsf/7tLz/+7S7//yttf/6lbX/94Oz//WEtv/2n8///a7c//Gn5f/wltH/9IO5//h+pv/7h5X/+5WD//ukcP/9smL//r1t//7Dif/+yaD//tOy//7gw//+6M3//ujM///dsv//3q3//tur//7Agf//r2j//6px//+og//+pY3//qiX//ywov/8r6f//Kei//yVo//6hKv/9Ie3//Og0P/8rtz/563k/+mZzv/zibP/+oag//qLlf/5k4n/+6Jx//2zXf/+vWL//sJ5//7Hkv/+0av//uDC//3pyv/96Mz//tux///apf/+1qb//7h+//+lZf//nGf//5dt//+Tc///lXn//qN+//unjP/5nJ3//JWb//2Knv/2i7L/8KLR//uu3P/druT/4ZXN/+2FtP/1g6X/94Wd//iMj//6nXX//a5f//64Xv/+vW3//sKB//7KmP/+2bP//ebE//3nzf/+2bH//tWf//7Vpf/+toX//5xk//+RW///iFj//4Nc//+FYv/+l2j/+599//eQmv/3iKT/94aj/++HtP/tn9H/+q7d/9aq5f/ajND/5Hq7/+13rv/yeaL/9YCU//mPgf/8oW3//q1m//60a//+uHb//sKJ//7Spv/+48D//ufO//7Xsv/+0Zr//tSk//68kv//mGn//4ZP//9+S///elD//oJa//2Qav/5kIT/9YOX//N7pP/ueK7/5nu7/+iX0//5rd3/0aXp/9KB1v/ba8P/5Wa2/+xoqf/yb5v/936M//uUef/9pWz//qxr//6ucf/+u4X//tGl//7jwv/959H//tez//7PmP/+0KL//sWh//6rh//+i2D//3xQ//59VP/+iF///It1//d9j//ybpv/7Wmn/+Zmtv/dasP/447W//es3v/LpO7/yHnd/89czf/bU8H/5VW1/+5dpv/1cJT/+419//6ibf/+pWj//qZt//63hf/+0ar//eTJ//3o1f/+1rX//c2X//3Lof/+x6b//cCh//6dev/+hlz//ohd//6TZP/8iXn/9m2V/+5apv/mVbb/20/B/89YzP/ahdv/9are/8eo8v+/eeX/xFXW/9FIzP/fSML/6VC0//Nlnv/7ioH//qFt//6jaP/+q3H//rqL//3Ssf/95s///efa//7WuP/8y5j//Mik//7FqP/9xan//a6J//6caf/+kmL//ptn//yKe//0X5//6ky2/99Ew//RQcv/wk/V/9CB4f/yq+D/x7L3/76I7f/AZOH/zFXX/9pS0P/mVsb/8Guw//mRkP/8p3z//K15//y4hP/8w5v/+9W7//vm1v/75t///NbC//nMpP/6yq7//Mmy//vIs//7vZv//LWC//yldf/8o3X/+paM//FgtP/kT8n/20zR/8pN1v+9W+D/y4jn//Cs4f/Pw/v/xqL0/8aF6//PeeT/23Xf/+V32P/uhsf/9qWs//i3mv/4v5j/+Meh//jPsv/43Mn/9+jf//fm5v/31tb/9dXB//XWyP/31sr/99XI//fOt//3yqj/98Of//e9nv/2r6//7oXO/+R63f/beeH/z3vl/8aF7P/Soe3/8bHj/w==";
12885
+ var vd, yd, bd = t((() => {
12886
+ Vc(), hd(), pd(), vd = 32, yd = "7PP//97s///O4/7/xt77/8vc7f/Y1sr/5c2f/+/EcP/2vEX/+rQp//2xGP/+rRv//J5M//uUf//7jp7/+4a3//2Ax//9g83//4vD//2bu//5kpv/83V+//Nbb//3VnT/81Sf/+tdxf/pid3/56Pr/+a58v/q1/P/6On3/+Xy/P/o8f//2ur+/8/j/P/O4ff/1tzc/+PSr//sx4X/879d//i3Of/8siD//rEP//6vD//9nz7//JJ4//uNnP/6h7f//IDJ//yEz//+jMX//Jq8//aOnf/xa3n/9Fxq//dief/1Y5v/8G62/+2K0v/tq+b/6Lby/+rP8v/q5fb/5vH7/+Pv///X6P7/0uT6/9bi8P/h2sf/682R//LCa//3ukn/+rQs//yxGv/+sQ7//q4T//2eRP/8knv/+o2e//eIuf/6g8v/+obR//yMx//6mb3/84uh//Bnef/1YWn/+nVx//lzj//1g6X/8pjC//Gz3f/stO//6cDx/+rf9P/m8fv/3uz//9Xm/f/V4vj/3d/r/+fWtP/xyHT/9r9R//m3N//7siP//bAW//6xDv/+qxr//ZpP//yPf//4jZ//9Yq6//eHzP/4itL/+o/K//iYvv/wiab/7mZ9//Zpbv/7gG///Il+//iYk//1pa//9LTO//Cx5v/qru7/69fy/+fw+v/Y6f7/1eL7/9nb9v/h2Of/7M+n//XCW//5uj3/+7Ur//yxHf/9rhX//q8Q//6mJP/9k1f/+4x///aNnv/zjbr/9Y3N//aR1f/4lM7/+JnC//COrv/ua4f/9m5y//uGc//8k3z/+qKI//aupP/1tMT/8J3b/+iJ6v/qzfD/6O75/9fl/f/Y3vn/3NPz/+TM4P/uxpr/+LxJ//u3MP/8syX//a8c//2sF//+rBb//p8w//2OX//7ioD/9o6e//KQu//zk8//9ZjX//ec0//4nsn/85i7//B3mf/1cHz/+oZ4//uSgf/6oYX/97Kg//Wpvv/vcdH/5W7n/+vG7f/p6vf/1d78/9nX9//fyu3/6MDN//O8fv/6uDv/+7Qr//yxJf/9rB///akd//6oIP/+mz3//oxm//uMg//2kaD/8pW9//Ob0f/2oNj/+aPX//ul1P/4o83/9Iyy//d7kP/6in3/+5OB//qhgv/5rpX/9pyy/+9czf/kZ+D/7L7q/+vk9f/S0/v/2s30/+O+4//ttK3/+LRW//u0Mf/8si7//K8q//2pJv/9pSj//qMu//6WSP/+jWv/+46F//aVo//zmr//9KHS//em2v/8qNr//qra//2q2P/5n8z/+Iuv//uOjP/7loH//KGA//ukjf/5kab/8VjD/+dq2P/tt+b/7t3y/9XJ+P/gwvD/6bPa//Osmf/6sEn/+7E1//ywNf/8ri///agu//2jNf/+nz3//pRT//6Pb//8k4j/95um//Shwv/1p9T/+Krc//yr2//+rdv//q3c//yp2v/5mM3/+pKp//ubhv/8oIH//J6L//yPmv/2a7D/63fL/++z4//w1u7/48D0/+257f/zr9n/96ic//urU//8rT//+689//yyMv/9ry///qk///6jUP/+nGT//pt6//yfj//4pKz/9ajG//at1v/6r9z//azb//+u3f//r93//q7e//ug3P/6lcn/+52g//ujhP/9nIz//ZKb//qJpP/zjrr/8rHc//PN6v/zuO//+7Ts//uw4f/7qK7//KVo//ynTf/7rEb//bU0//27Jv/9tz3//bJj//6weP/+sIj//a+a//mwsv/2scn/+LTY//uz3f/9rtz//7De//6w3//+reL//aXl//ya4P/8nML//KSZ//2cm//9mrD//aGz//uitf/4r87/9sPk//u07f//tO3//rLo//ymwP/8nYL//J9g//unU//8skL//b0v//zBQP/8xHD//saJ//7FlP/9waP/+725//i5y//5u9j/+rjd//yv3f/+r9///q7i//6r5v/9quj//aTp//2e2v/9oLr//aC1//2ouv/+s7b//rSz//ywwP/6uNn//bPs//6z6//+ruP//J7G//uRmv/7knn/+51m//yrUv/9tkb//MBZ//3Lf//+0pP//tSa//7PqP/8yb7/+sLM//vC1v/6v9z/+bHd//io4v/7pej//arp//2x6P/8ren//KHg//2hxf/9p7v//rC3//+4s///u7D//rS5//2x0f//tO3//7Lr//6n3f/8ksL/+oKl//mDkf/5kXz//KNi//2vWP/+vnH//suQ//7Umv/+2Zz//tan//7SwP/9ysn//srO//vF1P/3sdH/7p7b/+2c6P/2o+3/9Kvs//Gn7f/xn+L//KXF//6uuv//sLj//7S1//+5sf/+tLn//q7Q//+z7f//sen//p/W//uEuv/5daf/9ned//aFjv/6l3f//adp//65ff/+ypr//tGh//7Vn//+1af//ta9///Rv///0r///cvD//m1uP/vn8n/5Jff/96b6//Um/H/zZvy/9Wb6v/ypc7//6+8//+xuf//tLb//7mx//22vf/+rtT//q/q//2n4v/9jsr/+3Wy//drqP/0cKL/9H2Z//iOhv/8oHT//rV///7Hnv/+zqf//tGm//7Uqv/+2Ln//9az///Xsv/90bT//MSj//m6r//tqcn/0aDh/76a8v+9m/b/vZn0/9ue4f/8q8L//rO0//+5rv/+vqn//LrB//6v2v/8qef//JnY//x7vv/6Zq3/9mSn//NtpP/ze53/94qN//yceP/+sn3//sWb//7Oqf/+0an//tas//7cuf//27D//96r//7aqv/+1Jz//tSe//rLrP/htc3/waPr/7if9v+ymvn/zJzt//eoxf/+t6D//8WV//7Kmf/8v8L//a/c//yk5f/7jtL/+224//lcqv/2X6b/9Gyj//R8mv/4jIr//J53//6zfv/+xZr//s2o//7Sqf/+2K7//uC8///htf//46z//t2m//7XnP/+2Z///tmh//XLt//Osdr/s6Lx/7Kd9v/Ro+z/9qvH//64mf//y4j//s+S//zBwf/9sNv//aHk//uI0P/7Zbf/+Feq//Vdpv/0bqD/+IKR//uWfv/+qHf//rqI//7Gnv/+zaf//tSp//7bsP/+477//+W4///mrv//3qT//tic//7Yn//+2qH//NWr/967zP+6pOj/waTt/+Gt4P/4r8j//bWi///Hiv/+zpP//cDB//6v2//9oOT/+4bR//pkuf/3WK3/9F+o//Vynf/6jIX//qR1//61fv/+v5H//seg//7Npv/+1an//t2y//7kwP//5rj//+ex///fpv/+2J3//tie//7ZoP/91qb/5r7E/8am3//Yq97/9LbN//qzxf/8sa///r+R//7MlP/9vcL//q7b//yh5f/6iNP/+Gi8//Vdr//0Zan/93qW//yXev/+rXH//rp///6/kf/+xp///s6l//7WrP/+37j//uXE///kuP//57X//+Os//7Znv/+2J3//tme//3Sof/vu7z/4KvW/+6xz//7tsP/+7PC//uruf/9rJ7//bWd//yzxv/+rtv/+6Ll//iM1P/2b77/9GWw//Vvpf/5hoz//KBy//6ya//+unn//r+Q//7HoP/+z6n//tmz//7iwv/+58j//+K2///mt//+5rT//9ui//7Wnv/+057//smg//u5rv/4ssX/+rTF//u0wP/7sL//+p+7//mRrf/5lK3/+qXL//6u2//4o+X/9JDU//R5vf/1cq7/93ud//qQhf/7pW///bJm//67dP/+wY///smj//7Sr//+3Lz//uXK//7ny///37T//+O0//7isv/+0Jb//8WH///AjP/+upf//rSh//2zsf/7tLz/+7S7//yttf/6lbX/94Oz//WEtv/2n8///a7c//Gn5f/wltH/9IO5//h+pv/7h5X/+5WD//ukcP/9smL//r1t//7Dif/+yaD//tOy//7gw//+6M3//ujM///dsv//3q3//tur//7Agf//r2j//6px//+og//+pY3//qiX//ywov/8r6f//Kei//yVo//6hKv/9Ie3//Og0P/8rtz/563k/+mZzv/zibP/+oag//qLlf/5k4n/+6Jx//2zXf/+vWL//sJ5//7Hkv/+0av//uDC//3pyv/96Mz//tux///apf/+1qb//7h+//+lZf//nGf//5dt//+Tc///lXn//qN+//unjP/5nJ3//JWb//2Knv/2i7L/8KLR//uu3P/druT/4ZXN/+2FtP/1g6X/94Wd//iMj//6nXX//a5f//64Xv/+vW3//sKB//7KmP/+2bP//ebE//3nzf/+2bH//tWf//7Vpf/+toX//5xk//+RW///iFj//4Nc//+FYv/+l2j/+599//eQmv/3iKT/94aj/++HtP/tn9H/+q7d/9aq5f/ajND/5Hq7/+13rv/yeaL/9YCU//mPgf/8oW3//q1m//60a//+uHb//sKJ//7Spv/+48D//ufO//7Xsv/+0Zr//tSk//68kv//mGn//4ZP//9+S///elD//oJa//2Qav/5kIT/9YOX//N7pP/ueK7/5nu7/+iX0//5rd3/0aXp/9KB1v/ba8P/5Wa2/+xoqf/yb5v/936M//uUef/9pWz//qxr//6ucf/+u4X//tGl//7jwv/959H//tez//7PmP/+0KL//sWh//6rh//+i2D//3xQ//59VP/+iF///It1//d9j//ybpv/7Wmn/+Zmtv/dasP/447W//es3v/LpO7/yHnd/89czf/bU8H/5VW1/+5dpv/1cJT/+419//6ibf/+pWj//qZt//63hf/+0ar//eTJ//3o1f/+1rX//c2X//3Lof/+x6b//cCh//6dev/+hlz//ohd//6TZP/8iXn/9m2V/+5apv/mVbb/20/B/89YzP/ahdv/9are/8eo8v+/eeX/xFXW/9FIzP/fSML/6VC0//Nlnv/7ioH//qFt//6jaP/+q3H//rqL//3Ssf/95s///efa//7WuP/8y5j//Mik//7FqP/9xan//a6J//6caf/+kmL//ptn//yKe//0X5//6ky2/99Ew//RQcv/wk/V/9CB4f/yq+D/x7L3/76I7f/AZOH/zFXX/9pS0P/mVsb/8Guw//mRkP/8p3z//K15//y4hP/8w5v/+9W7//vm1v/75t///NbC//nMpP/6yq7//Mmy//vIs//7vZv//LWC//yldf/8o3X/+paM//FgtP/kT8n/20zR/8pN1v+9W+D/y4jn//Cs4f/Pw/v/xqL0/8aF6//PeeT/23Xf/+V32P/uhsf/9qWs//i3mv/4v5j/+Meh//jPsv/43Mn/9+jf//fm5v/31tb/9dXB//XWyP/31sr/99XI//fOt//3yqj/98Of//e9nv/2r6//7oXO/+R63f/beeH/z3vl/8aF7P/Soe3/8bHj/w==";
12880
12887
  }));
12881
12888
  //#endregion
12882
12889
  //#region src/renderer/WaveRenderer.ts
12883
- function bd(e, t) {
12884
- let n = wd.set(e);
12890
+ function xd(e, t, n, r = 0) {
12891
+ let i = e / wd, a = t / 750, o;
12892
+ switch (n) {
12893
+ case "contain":
12894
+ o = Math.min(i, a);
12895
+ break;
12896
+ case "width":
12897
+ o = i;
12898
+ break;
12899
+ case "height":
12900
+ o = a;
12901
+ break;
12902
+ default: o = Math.max(i, a);
12903
+ }
12904
+ return r > 0 && (o = Math.min(o, e / (wd * r))), o;
12905
+ }
12906
+ function Sd(e, t) {
12907
+ let n = Ed.set(e);
12885
12908
  return t.set(n.r, n.g, n.b);
12886
12909
  }
12887
- var xd, Sd, Cd, wd, Td, Ed = t((() => {
12888
- Vc(), nl(), il(), cl(), Zc(), fl(), ou(), pu(), Ru(), fd(), yd(), Gl(), xd = 220, Sd = 1333, Cd = class {
12910
+ var Cd, wd, Td, Ed, Dd, Od = t((() => {
12911
+ Vc(), nl(), il(), cl(), Zc(), fl(), su(), mu(), zu(), pd(), bd(), Kl(), Cd = 220, wd = 1333, Td = class {
12889
12912
  makeVideo;
12890
12913
  onVideoReady;
12891
12914
  texture;
@@ -12898,8 +12921,8 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
12898
12921
  }
12899
12922
  apply(e, t) {
12900
12923
  let n = e.paletteVideoUrl, r = e.paletteImageUrl, i = e.paletteSource ?? "hero", a, o;
12901
- if (n) this.ensureVideo(n), this.video?.readyState && this.video.readyState >= 2 ? (a = "video|" + n, o = () => Uu(new _i(this.video))) : (a = "video-loading|" + n, o = () => gd());
12902
- else if (r) this.clearVideo(), a = "url|" + r, o = () => ad(r);
12924
+ if (n) this.ensureVideo(n), this.video?.readyState && this.video.readyState >= 2 ? (a = "video|" + n, o = () => Wu(new _i(this.video))) : (a = "video-loading|" + n, o = () => _d());
12925
+ else if (r) this.clearVideo(), a = "url|" + r, o = () => od(r);
12903
12926
  else if (i === "stops") {
12904
12927
  this.clearVideo();
12905
12928
  let t = {
@@ -12907,8 +12930,8 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
12907
12930
  edgeColor: e.paletteEdgeColor ?? "#8e9dff",
12908
12931
  edgeAmount: e.paletteEdgeAmount ?? .3
12909
12932
  };
12910
- a = "stops|" + Hu(t), o = () => Gu(t);
12911
- } else dd[i] ? (this.clearVideo(), a = "map|" + i, o = () => Wu(id(dd[i]))) : (this.clearVideo(), a = "hero", o = () => gd());
12933
+ a = "stops|" + Uu(t), o = () => Ku(t);
12934
+ } else fd[i] ? (this.clearVideo(), a = "map|" + i, o = () => Gu(ad(fd[i]))) : (this.clearVideo(), a = "hero", o = () => _d());
12912
12935
  (a !== this.sig || !this.texture) && (this.texture?.dispose(), this.texture = o(), this.sig = a), t.uPalette.value = this.texture, t.uUsePalette.value = e.usePaletteTexture === !1 ? 0 : 1, t.uPaletteRaw.value = 1;
12913
12936
  }
12914
12937
  syncPlayback(e, t) {
@@ -12931,7 +12954,7 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
12931
12954
  dispose() {
12932
12955
  this.texture?.dispose(), this.texture = void 0, this.clearVideo(), this.failedUrl = "";
12933
12956
  }
12934
- }, wd = new X(), Td = class {
12957
+ }, Ed = new X(), Dd = class {
12935
12958
  renderer;
12936
12959
  scene = new Gn();
12937
12960
  camera;
@@ -12984,6 +13007,9 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
12984
13007
  resizeObserver;
12985
13008
  intersectionObserver;
12986
13009
  motionQuery;
13010
+ dprQuery;
13011
+ resizeRaf = 0;
13012
+ lastResize;
12987
13013
  capturing = !1;
12988
13014
  outputSize;
12989
13015
  constructor(e, t, n = {}) {
@@ -13001,15 +13027,15 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13001
13027
  uGrainAmount: { value: t.grain },
13002
13028
  uTime: { value: 0 }
13003
13029
  },
13004
- vertexShader: Ql,
13005
- fragmentShader: $l
13030
+ vertexShader: $l,
13031
+ fragmentShader: eu
13006
13032
  }), this.composer.addPass(this.postPass), this.composer.addPass(new sl()), this.motionQuery = window.matchMedia("(prefers-reduced-motion: reduce)"), this.reducedMotion = this.respectReducedMotion && this.motionQuery.matches, this.motionQuery.addEventListener("change", this.onMotionChange), document.addEventListener("visibilitychange", this.onVisibilityChange), this.intersectionObserver = new IntersectionObserver((e) => {
13007
13033
  this.visible = e[0]?.isIntersecting ?? !0, this.updateRunning();
13008
- }, { rootMargin: "100px" }), this.intersectionObserver.observe(e), this.resizeObserver = new ResizeObserver(this.onResize), this.resizeObserver.observe(e), this.applyBackground(), this.buildWaves(), this.resize();
13034
+ }, { rootMargin: "100px" }), this.intersectionObserver.observe(e), this.resizeObserver = new ResizeObserver(this.onResize), this.resizeObserver.observe(e), this.watchDpr(), this.applyBackground(), this.buildWaves(), this.resize();
13009
13035
  }
13010
13036
  get segments() {
13011
13037
  let e = this.config.quality / Math.sqrt(Math.max(1, this.config.waves.length));
13012
- return Gt.clamp(Math.round(xd * e), 24, 360);
13038
+ return Gt.clamp(Math.round(Cd * e), 24, 360);
13013
13039
  }
13014
13040
  makeUniforms() {
13015
13041
  let e = [], t = [];
@@ -13111,14 +13137,14 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13111
13137
  let t = {};
13112
13138
  e?.twistMotion && (t.TWIST_MOTION = ""), (this.config.loopSeconds ?? 0) > 0 && (t.LOOP_MOTION = "");
13113
13139
  let n = e?.interaction?.bindings?.some((e) => e.target === "detailAmount") ?? !1;
13114
- return ((e?.detailAmount ?? 0) !== 0 || n) && (t.DETAIL_OCTAVE = ""), (e?.depthTint ?? 0) > 0 && (t.DEPTH_TINT = ""), (e?.edgeFeather ?? .1) !== .1 && (t.EDGE_FEATHER = ""), e && vu(this.config, e) && (t.POINTER_FX = "", yu(this.config, e) && (t.POINTER_RIPPLES = "")), t;
13140
+ return ((e?.detailAmount ?? 0) !== 0 || n) && (t.DETAIL_OCTAVE = ""), (e?.depthTint ?? 0) > 0 && (t.DEPTH_TINT = ""), (e?.edgeFeather ?? .1) !== .1 && (t.EDGE_FEATHER = ""), e && yu(this.config, e) && (t.POINTER_FX = "", bu(this.config, e) && (t.POINTER_RIPPLES = "")), t;
13115
13141
  }
13116
13142
  addWave() {
13117
- let e = new fu(this.segments), t = this.config.waves[this.waves.length] ?? this.config.waves[0], n = new Oi({
13143
+ let e = new pu(this.segments), t = this.config.waves[this.waves.length] ?? this.config.waves[0], n = new Oi({
13118
13144
  uniforms: this.makeUniforms(),
13119
13145
  defines: this.waveDefines(t),
13120
- vertexShader: Yl,
13121
- fragmentShader: t?.theme === "wireframe" ? Zl : Xl,
13146
+ vertexShader: Xl,
13147
+ fragmentShader: t?.theme === "wireframe" ? Ql : Zl,
13122
13148
  transparent: !0,
13123
13149
  depthTest: !0,
13124
13150
  depthWrite: !0,
@@ -13127,7 +13153,7 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13127
13153
  this.applyBlendMode(n, t?.blendMode ?? "squared");
13128
13154
  let r = new si(e.geometry, n);
13129
13155
  r.frustumCulled = !1, this.group.add(r);
13130
- let i = new Cd((e) => this.createLoopingVideo(e), () => {
13156
+ let i = new Td((e) => this.createLoopingVideo(e), () => {
13131
13157
  this.updatePaletteTextures(), this.syncVideoPlayback(), this.running || this.renderOnce();
13132
13158
  });
13133
13159
  this.waves.push({
@@ -13168,7 +13194,7 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13168
13194
  this.applyBlendMode(e.material, n.blendMode) && (e.material.needsUpdate = !0);
13169
13195
  let i = this.waveDefines(n), a = e.material.defines ?? {};
13170
13196
  Object.keys(i).sort().join(",") !== Object.keys(a).sort().join(",") && (e.material.defines = i, e.material.needsUpdate = !0);
13171
- let o = n.theme === "wireframe" ? Zl : Xl;
13197
+ let o = n.theme === "wireframe" ? Ql : Zl;
13172
13198
  e.material.fragmentShader !== o && (e.material.fragmentShader = o, e.material.needsUpdate = !0);
13173
13199
  let s = [...n.palette].sort((e, t) => e.pos - t.pos), c = Math.max(1, Math.min(s.length, 8)), l = r.uColors.value, u = r.uColorPos.value;
13174
13200
  for (let e = 0; e < 8; e++) {
@@ -13176,21 +13202,21 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13176
13202
  color: "#ffffff",
13177
13203
  pos: 0
13178
13204
  };
13179
- bd(t.color, l[e]), u[e] = t.pos;
13205
+ Sd(t.color, l[e]), u[e] = t.pos;
13180
13206
  }
13181
13207
  r.uColorCount.value = c, r.uGradType.value = n.gradientType === "radial" ? 1 : n.gradientType === "conic" ? 2 : n.gradientType === "mesh" ? 3 : 0, r.uGradAngle.value = (n.gradientAngle ?? 0) * Math.PI / 180, r.uGradShift.value = n.gradientShift ?? 0;
13182
13208
  let d = n.meshGradientPoints.slice(0, 8), f = r.uMeshPointPos.value, p = r.uMeshPointColor.value, m = r.uMeshPointInfluence.value;
13183
13209
  for (let e = 0; e < 8; e++) {
13184
13210
  let t = d[e] ?? d[d.length - 1];
13185
- t && (f[e].set(t.x, t.y), bd(t.color, p[e]), m[e] = t.influence);
13211
+ t && (f[e].set(t.x, t.y), Sd(t.color, p[e]), m[e] = t.influence);
13186
13212
  }
13187
- r.uMeshPointCount.value = d.length, r.uMeshSoftness.value = n.meshGradientSoftness, r.uPaletteScale.value.set(n.paletteTextureScale?.x ?? 1, n.paletteTextureScale?.y ?? 1), r.uPaletteOffset.value.set(n.paletteTextureOffset?.x ?? 0, n.paletteTextureOffset?.y ?? 0), r.uPaletteRotation.value = (n.paletteTextureRotation ?? 0) * Math.PI / 180, r.uHueShift.value = n.hueShift, r.uContrast.value = n.colorContrast, r.uSaturation.value = n.colorSaturation, r.uLineAmount.value = n.lineAmount ?? 425, r.uLineThickness.value = n.lineThickness ?? 1, r.uLineDerivativePower.value = n.lineDerivativePower ?? .95, r.uMaxWidth.value = n.maxWidth ?? 1232, bd(this.config.background, r.uClearColor.value), r.uFiberCount.value = n.fiberCount, r.uFiberStrength.value = n.fiberStrength, r.uTexture.value = n.texture, r.uCreaseLight.value = n.creaseLight, r.uCreaseSharpness.value = n.creaseSharpness, r.uCreaseSoftness.value = n.creaseSoftness, r.uSheen.value = n.sheen ?? 1, r.uRoundness.value = n.roundness ?? .35, r.uIridescence.value = n.iridescence ?? 0, r.uDepthTint.value = n.depthTint ?? 0, bd(n.depthTintColor ?? "#0a2540", r.uDepthTintColor.value), r.uEdgeFade.value = n.edgeFade, r.uEdgeFeather.value = n.edgeFeather ?? .1;
13213
+ r.uMeshPointCount.value = d.length, r.uMeshSoftness.value = n.meshGradientSoftness, r.uPaletteScale.value.set(n.paletteTextureScale?.x ?? 1, n.paletteTextureScale?.y ?? 1), r.uPaletteOffset.value.set(n.paletteTextureOffset?.x ?? 0, n.paletteTextureOffset?.y ?? 0), r.uPaletteRotation.value = (n.paletteTextureRotation ?? 0) * Math.PI / 180, r.uHueShift.value = n.hueShift, r.uContrast.value = n.colorContrast, r.uSaturation.value = n.colorSaturation, r.uLineAmount.value = n.lineAmount ?? 425, r.uLineThickness.value = n.lineThickness ?? 1, r.uLineDerivativePower.value = n.lineDerivativePower ?? .95, r.uMaxWidth.value = n.maxWidth ?? 1232, Sd(this.config.background, r.uClearColor.value), r.uFiberCount.value = n.fiberCount, r.uFiberStrength.value = n.fiberStrength, r.uTexture.value = n.texture, r.uCreaseLight.value = n.creaseLight, r.uCreaseSharpness.value = n.creaseSharpness, r.uCreaseSoftness.value = n.creaseSoftness, r.uSheen.value = n.sheen ?? 1, r.uRoundness.value = n.roundness ?? .35, r.uIridescence.value = n.iridescence ?? 0, r.uDepthTint.value = n.depthTint ?? 0, Sd(n.depthTintColor ?? "#0a2540", r.uDepthTintColor.value), r.uEdgeFade.value = n.edgeFade, r.uEdgeFeather.value = n.edgeFeather ?? .1;
13188
13214
  let h = this.config.lights ?? [];
13189
13215
  r.uAmbient.value = this.config.ambient ?? .45, r.uNumLights.value = Math.min(h.length, 8);
13190
13216
  let g = r.uLightPos.value, _ = r.uLightColor.value, v = r.uLightIntensity.value;
13191
13217
  for (let e = 0; e < 8; e++) {
13192
13218
  let t = h[e];
13193
- t ? (g[e].set(t.position.x, t.position.y, t.position.z), bd(t.color, _[e]), v[e] = t.intensity) : v[e] = 0;
13219
+ t ? (g[e].set(t.position.x, t.position.y, t.position.z), Sd(t.color, _[e]), v[e] = t.intensity) : v[e] = 0;
13194
13220
  }
13195
13221
  let y = n.noiseBands ?? [];
13196
13222
  r.uNumNoiseBands.value = Math.min(y.length, 4);
@@ -13204,7 +13230,7 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13204
13230
  let e = (this.config.interaction?.radius ?? .3) * 2, t = this.config.interaction?.ribbonFlow ?? .8;
13205
13231
  this.waves.forEach((n, r) => {
13206
13232
  let i = this.config.waves[r] ?? this.config.waves[this.config.waves.length - 1];
13207
- if (!vu(this.config, i)) return;
13233
+ if (!yu(this.config, i)) return;
13208
13234
  let a = n.material.uniforms, o = i.interaction?.hover;
13209
13235
  a.uPointerRadius.value = e, a.uPointerAgitate.value = o?.agitate ?? 0, a.uPointerPush.value = o?.push ?? 0, a.uPointerWake.value = o?.wake ?? 0, a.uPointerThin.value = o?.thin ?? 0, a.uPointerHue.value = o?.hueShift ?? 0, a.uPointerLighten.value = o?.lighten ?? 0, a.uPointerRipple.value = i.interaction?.press?.ripple ?? 0, a.uShapeFlow.value = t;
13210
13236
  }), this.updatePaletteTextures(), this.syncVideoPlayback(), this.group.scale.set(this.config.mirrorH ? -1 : 1, this.config.mirrorV ? -1 : 1, 1), this.onAfterRefresh(), this.running || this.renderOnce();
@@ -13250,13 +13276,13 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13250
13276
  t
13251
13277
  ].join("|");
13252
13278
  if (a !== this.backgroundSig || !this.backgroundTexture) {
13253
- let i = Yu(n, r, e, t);
13254
- this.backgroundTexture?.dispose(), this.backgroundTexture = Wu(i), this.backgroundSig = a;
13279
+ let i = Xu(n, r, e, t);
13280
+ this.backgroundTexture?.dispose(), this.backgroundTexture = Gu(i), this.backgroundSig = a;
13255
13281
  }
13256
13282
  this.scene.background = this.backgroundTexture;
13257
13283
  return;
13258
13284
  }
13259
- let r = this.config.backgroundGradientSource ?? "stops", i = dd[r], a = r !== "stops" && i?.kind === "gradient" && i.stops ? i.stops : this.config.backgroundPalette, o = a.map((e) => `${e.color}@${e.pos.toFixed(3)}`).join(","), s = [
13285
+ let r = this.config.backgroundGradientSource ?? "stops", i = fd[r], a = r !== "stops" && i?.kind === "gradient" && i.stops ? i.stops : this.config.backgroundPalette, o = a.map((e) => `${e.color}@${e.pos.toFixed(3)}`).join(","), s = [
13260
13286
  "gradient",
13261
13287
  r,
13262
13288
  n,
@@ -13266,14 +13292,14 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13266
13292
  t
13267
13293
  ].join("|");
13268
13294
  if (s !== this.backgroundSig || !this.backgroundTexture) {
13269
- let r = Ku({
13295
+ let r = qu({
13270
13296
  stops: a,
13271
13297
  type: n,
13272
13298
  angle: this.config.backgroundGradientAngle,
13273
13299
  width: e,
13274
13300
  height: t
13275
13301
  });
13276
- this.backgroundTexture?.dispose(), this.backgroundTexture = Wu(r), this.backgroundSig = s;
13302
+ this.backgroundTexture?.dispose(), this.backgroundTexture = Gu(r), this.backgroundSig = s;
13277
13303
  }
13278
13304
  this.scene.background = this.backgroundTexture;
13279
13305
  }
@@ -13296,7 +13322,7 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13296
13322
  c = this.backgroundImage, l = this.backgroundImage.naturalWidth, u = this.backgroundImage.naturalHeight, d = `custom|${s}`;
13297
13323
  } else {
13298
13324
  this.clearBackgroundVideo();
13299
- let r = this.config.backgroundImageSource ?? "vaporwave", i = r === "hero" ? hd() : dd[r]?.kind === "image" ? id(dd[r], Math.max(t, n)) : null;
13325
+ let r = this.config.backgroundImageSource ?? "vaporwave", i = r === "hero" ? gd() : fd[r]?.kind === "image" ? ad(fd[r], Math.max(t, n)) : null;
13300
13326
  if (!i) {
13301
13327
  this.scene.background = e;
13302
13328
  return;
@@ -13315,8 +13341,8 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13315
13341
  n
13316
13342
  ].join("|");
13317
13343
  if (f !== this.backgroundSig || !this.backgroundTexture) {
13318
- let e = Xu(c, l, u, t, n, r, this.config.background, i, a.x, a.y);
13319
- this.backgroundTexture?.dispose(), this.backgroundTexture = Wu(e), this.backgroundSig = f, this.backgroundVideoCanvas = o ? e : void 0;
13344
+ let e = Zu(c, l, u, t, n, r, this.config.background, i, a.x, a.y);
13345
+ this.backgroundTexture?.dispose(), this.backgroundTexture = Gu(e), this.backgroundSig = f, this.backgroundVideoCanvas = o ? e : void 0;
13320
13346
  }
13321
13347
  this.scene.background = this.backgroundTexture;
13322
13348
  }
@@ -13368,7 +13394,7 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13368
13394
  x: 0,
13369
13395
  y: 0
13370
13396
  };
13371
- Zu(t, e, e.videoWidth, e.videoHeight, this.config.backgroundImageFit ?? "cover", this.config.background, this.config.backgroundImageZoom ?? 1, n.x, n.y), this.backgroundTexture.needsUpdate = !0;
13397
+ Qu(t, e, e.videoWidth, e.videoHeight, this.config.backgroundImageFit ?? "cover", this.config.background, this.config.backgroundImageZoom ?? 1, n.x, n.y), this.backgroundTexture.needsUpdate = !0;
13372
13398
  }
13373
13399
  applyPost() {
13374
13400
  let e = this.postPass.uniforms;
@@ -13395,8 +13421,8 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13395
13421
  uDitherScale: { value: this.config.ditherScale ?? 2 },
13396
13422
  uDitherSteps: { value: this.config.ditherSteps ?? 4 }
13397
13423
  },
13398
- vertexShader: Ql,
13399
- fragmentShader: eu
13424
+ vertexShader: $l,
13425
+ fragmentShader: tu
13400
13426
  }), this.composer.addPass(this.ditherPass));
13401
13427
  let t = this.ditherPass.uniforms;
13402
13428
  t.uDitherStrength.value = e, t.uDitherScale.value = Math.max(1, this.config.ditherScale ?? 2), t.uDitherSteps.value = Math.max(2, Math.round(this.config.ditherSteps ?? 4));
@@ -13414,8 +13440,8 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13414
13440
  uInnerLightDecay: { value: this.config.innerLightDecay ?? .95 },
13415
13441
  uInnerLightCenter: { value: new G(t, n) }
13416
13442
  },
13417
- vertexShader: Ql,
13418
- fragmentShader: tu
13443
+ vertexShader: $l,
13444
+ fragmentShader: nu
13419
13445
  }), this.composer.insertPass(this.innerLightPass, 1));
13420
13446
  let r = this.innerLightPass.uniforms;
13421
13447
  r.uInnerLight.value = e, r.uInnerLightDensity.value = this.config.innerLightDensity ?? .5, r.uInnerLightDecay.value = this.config.innerLightDecay ?? .95, r.uInnerLightCenter.value.set(t, n);
@@ -13432,8 +13458,8 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13432
13458
  uHalftoneCell: { value: this.config.halftoneCell ?? 6 },
13433
13459
  uHalftoneAngle: { value: this.config.halftoneAngle ?? .4 }
13434
13460
  },
13435
- vertexShader: Ql,
13436
- fragmentShader: nu
13461
+ vertexShader: $l,
13462
+ fragmentShader: ru
13437
13463
  }), this.composer.addPass(this.halftonePass));
13438
13464
  let t = this.halftonePass.uniforms;
13439
13465
  t.uHalftone.value = e, t.uHalftoneCell.value = Math.max(2, this.config.halftoneCell ?? 6), t.uHalftoneAngle.value = this.config.halftoneAngle ?? .4;
@@ -13446,8 +13472,8 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13446
13472
  tDiffuse: { value: null },
13447
13473
  uHeatmap: { value: e }
13448
13474
  },
13449
- vertexShader: Ql,
13450
- fragmentShader: ru
13475
+ vertexShader: $l,
13476
+ fragmentShader: iu
13451
13477
  }), this.composer.addPass(this.heatmapPass)), this.heatmapPass.uniforms.uHeatmap.value = e) : this.heatmapPass &&= (this.composer.removePass(this.heatmapPass), this.heatmapPass.dispose(), void 0);
13452
13478
  }
13453
13479
  applyPaperTexture() {
@@ -13459,8 +13485,8 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13459
13485
  uPaper: { value: e },
13460
13486
  uPaperScale: { value: this.config.paperTextureScale ?? 2 }
13461
13487
  },
13462
- vertexShader: Ql,
13463
- fragmentShader: iu
13488
+ vertexShader: $l,
13489
+ fragmentShader: au
13464
13490
  }), this.composer.addPass(this.paperTexturePass));
13465
13491
  let t = this.paperTexturePass.uniforms;
13466
13492
  t.uPaper.value = e, t.uPaperScale.value = Math.max(.5, this.config.paperTextureScale ?? 2);
@@ -13475,16 +13501,33 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13475
13501
  uHalftoneCmyk: { value: e },
13476
13502
  uHalftoneCmykCell: { value: this.config.halftoneCmykCell ?? 6 }
13477
13503
  },
13478
- vertexShader: Ql,
13479
- fragmentShader: au
13504
+ vertexShader: $l,
13505
+ fragmentShader: ou
13480
13506
  }), this.composer.addPass(this.halftoneCmykPass));
13481
13507
  let t = this.halftoneCmykPass.uniforms;
13482
13508
  t.uHalftoneCmyk.value = e, t.uHalftoneCmykCell.value = Math.max(2, this.config.halftoneCmykCell ?? 6);
13483
13509
  } else this.halftoneCmykPass &&= (this.composer.removePass(this.halftoneCmykPass), this.halftoneCmykPass.dispose(), void 0);
13484
13510
  }
13485
13511
  onResize = () => {
13486
- this.resize();
13512
+ this.resizeRaf ||= requestAnimationFrame(() => {
13513
+ this.resizeRaf = 0;
13514
+ let e = this.viewportMetrics(), t = this.lastResize;
13515
+ t && e.w === t.w && e.h === t.h && e.dpr === t.dpr || this.resize();
13516
+ });
13517
+ };
13518
+ onDprChange = () => {
13519
+ this.watchDpr(), this.resize();
13487
13520
  };
13521
+ watchDpr() {
13522
+ this.dprQuery?.removeEventListener("change", this.onDprChange), this.dprQuery = window.matchMedia(`(resolution: ${window.devicePixelRatio || 1}dppx)`), this.dprQuery.addEventListener("change", this.onDprChange);
13523
+ }
13524
+ viewportMetrics() {
13525
+ return {
13526
+ w: this.outputSize?.width ?? Math.max(1, this.container.clientWidth),
13527
+ h: this.outputSize?.height ?? Math.max(1, this.container.clientHeight),
13528
+ dpr: this.outputSize ? 1 : Math.min(window.devicePixelRatio || 1, this.config.dprMax)
13529
+ };
13530
+ }
13488
13531
  onContextLost = (e) => {
13489
13532
  e.preventDefault(), cancelAnimationFrame(this.rafId), this.running = !1;
13490
13533
  };
@@ -13492,8 +13535,12 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13492
13535
  this.disposeWaves(), this.backgroundTexture?.dispose(), this.backgroundTexture = void 0, this.backgroundSig = "", this.buildWaves(), this.resize(), this.updateRunning();
13493
13536
  };
13494
13537
  resize() {
13495
- let e = this.outputSize?.width ?? Math.max(1, this.container.clientWidth), t = this.outputSize?.height ?? Math.max(1, this.container.clientHeight), n = this.outputSize ? 1 : Math.min(window.devicePixelRatio || 1, this.config.dprMax);
13496
- this.renderer.setPixelRatio(n), this.renderer.setSize(e, t, !this.outputSize), this.outputSize && (this.renderer.domElement.style.width = "100%", this.renderer.domElement.style.height = "100%"), this.composer.setPixelRatio(n), this.composer.setSize(e, t);
13538
+ let { w: e, h: t, dpr: n } = this.viewportMetrics();
13539
+ this.lastResize = {
13540
+ w: e,
13541
+ h: t,
13542
+ dpr: n
13543
+ }, this.renderer.setPixelRatio(n), this.renderer.setSize(e, t, !this.outputSize), this.outputSize && (this.renderer.domElement.style.width = "100%", this.renderer.domElement.style.height = "100%"), this.composer.setPixelRatio(n), this.composer.setSize(e, t);
13497
13544
  let r = e * n, i = t * n;
13498
13545
  this.postPass.uniforms.uResolution.value.set(r, i), this.ditherPass && this.ditherPass.uniforms.uResolution.value.set(r, i), this.halftonePass && this.halftonePass.uniforms.uResolution.value.set(r, i);
13499
13546
  for (let e of this.waves) e.material.uniforms.uResolution.value.set(r, i);
@@ -13544,8 +13591,8 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13544
13591
  this.updateBackgroundVideoFrame(), this.updateTime(), this.applyInteraction(), this.updateClipPlanes(), this.composer.render(), this.onAfterRenderFrame();
13545
13592
  }
13546
13593
  syncInteraction() {
13547
- let e = xu(this.config);
13548
- e && !this.interaction ? this.interaction = new Lu(this.container, () => this.config) : !e && this.interaction && (this.interaction.dispose(), this.interaction = void 0, this.interactionTimeOffset = 0, this.interactionZoom !== 1 && (this.interactionZoom = 1, this.applyZoom()));
13594
+ let e = Su(this.config);
13595
+ e && !this.interaction ? this.interaction = new Ru(this.container, () => this.config) : !e && this.interaction && (this.interaction.dispose(), this.interaction = void 0, this.interactionTimeOffset = 0, this.interactionZoom !== 1 && (this.interactionZoom = 1, this.applyZoom()));
13549
13596
  }
13550
13597
  applyInteraction() {
13551
13598
  if (this.interaction) {
@@ -13553,13 +13600,13 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13553
13600
  this.applyInteractionRest();
13554
13601
  return;
13555
13602
  }
13556
- bu(this.config) && this.applyPointerField(this.interaction), this.applyBindings(this.interaction);
13603
+ xu(this.config) && this.applyPointerField(this.interaction), this.applyBindings(this.interaction);
13557
13604
  }
13558
13605
  }
13559
13606
  applyInteractionRest() {
13560
13607
  for (let e = 0; e < this.waves.length; e++) {
13561
13608
  let t = this.config.waves[e] ?? this.config.waves[this.config.waves.length - 1];
13562
- if (!vu(this.config, t)) continue;
13609
+ if (!yu(this.config, t)) continue;
13563
13610
  let n = this.waves[e].material.uniforms;
13564
13611
  n.uPointerActive.value = 0;
13565
13612
  let r = n.uRippleAmp.value;
@@ -13573,7 +13620,7 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13573
13620
  out: this.interactionSceneOut
13574
13621
  };
13575
13622
  for (let n of e) {
13576
- let e = Iu[n.target];
13623
+ let e = Lu[n.target];
13577
13624
  e.apply(e.base(this.config), t);
13578
13625
  }
13579
13626
  }
@@ -13583,7 +13630,7 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13583
13630
  if (!t || !n || n.length === 0) continue;
13584
13631
  let r = this.waves[e];
13585
13632
  for (let e of n) {
13586
- let n = Fu[e.target];
13633
+ let n = Iu[e.target];
13587
13634
  n.apply(n.base(t), {
13588
13635
  u: r.material.uniforms,
13589
13636
  mesh: r.mesh
@@ -13595,7 +13642,7 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13595
13642
  let t = this.camera.right - this.camera.left, n = this.camera.top - this.camera.bottom, r = n === 0 ? 1 : t / n, i = e.sample().ripples, a = Math.min(1, .2 + .85 * e.pointerFlux()), o = e.pointerVelocity();
13596
13643
  for (let t = 0; t < this.waves.length; t++) {
13597
13644
  let n = this.config.waves[t] ?? this.config.waves[this.config.waves.length - 1];
13598
- if (!vu(this.config, n)) continue;
13645
+ if (!yu(this.config, n)) continue;
13599
13646
  let s = this.waves[t].material.uniforms;
13600
13647
  s.uPointerAgitate.value = (n.interaction?.hover?.agitate ?? 0) * a, s.uPointerVel.value.copy(o);
13601
13648
  let c = e.fieldFor(t);
@@ -13611,7 +13658,7 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13611
13658
  out: this.interactionSceneOut
13612
13659
  };
13613
13660
  for (let n of this.config.interaction?.bindings ?? []) {
13614
- let r = Iu[n.target], i = Gt.lerp(n.from ?? r.base(this.config), n.to, e.bindingValue(n));
13661
+ let r = Lu[n.target], i = Gt.lerp(n.from ?? r.base(this.config), n.to, e.bindingValue(n));
13615
13662
  r.apply(i, t);
13616
13663
  }
13617
13664
  for (let t = 0; t < this.waves.length; t++) {
@@ -13619,7 +13666,7 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13619
13666
  if (!n || !r || r.length === 0) continue;
13620
13667
  let i = this.waves[t];
13621
13668
  for (let t of r) {
13622
- let r = Fu[t.target], a = Gt.lerp(t.from ?? r.base(n), t.to, e.bindingValue(t));
13669
+ let r = Iu[t.target], a = Gt.lerp(t.from ?? r.base(n), t.to, e.bindingValue(t));
13623
13670
  r.apply(a, {
13624
13671
  u: i.material.uniforms,
13625
13672
  mesh: i.mesh
@@ -13648,7 +13695,10 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13648
13695
  onAfterResize() {}
13649
13696
  applyZoom() {
13650
13697
  let e = this.camera.right - this.camera.left, t = this.camera.top - this.camera.bottom;
13651
- this.camera.zoom = Math.max(e / Sd, t / 750) * (this.config.cameraZoom ?? 1) * this.interactionZoom, this.camera.updateProjectionMatrix();
13698
+ this.camera.zoom = this.baseFrameZoom(e, t) * (this.config.cameraZoom ?? 1) * this.interactionZoom, this.camera.updateProjectionMatrix();
13699
+ }
13700
+ baseFrameZoom(e, t) {
13701
+ return xd(e, t, this.config.cameraFit ?? "cover", this.config.cameraMinVisibleWidth ?? 0);
13652
13702
  }
13653
13703
  updateClipPlanes() {
13654
13704
  this.clipBox.makeEmpty();
@@ -13658,7 +13708,7 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13658
13708
  let r = n.geometry.boundingSphere;
13659
13709
  if (!r) continue;
13660
13710
  let i = this.clipTmpA.setFromMatrixPosition(n.matrixWorld), a = Math.abs(Number(t.material.uniforms.uDispAmount.value) || 0), o = this.config.waves[e] ?? this.config.waves[this.config.waves.length - 1], s = 0;
13661
- if (vu(this.config, o)) {
13711
+ if (yu(this.config, o)) {
13662
13712
  let e = o.interaction?.hover;
13663
13713
  s = (e?.agitate ?? 0) + Math.abs(e?.push ?? 0) + (e?.wake ?? 0) + (o.interaction?.press?.ripple ?? 0);
13664
13714
  }
@@ -13698,21 +13748,21 @@ var xd, Sd, Cd, wd, Td, Ed = t((() => {
13698
13748
  this.config = t, n ? this.rebuild() : this.refresh(), this.applyCameraFromConfig();
13699
13749
  }
13700
13750
  dispose() {
13701
- cancelAnimationFrame(this.rafId), this.running = !1, this.interaction?.dispose(), this.interaction = void 0, this.resizeObserver.disconnect(), this.intersectionObserver.disconnect(), this.motionQuery.removeEventListener("change", this.onMotionChange), document.removeEventListener("visibilitychange", this.onVisibilityChange), this.renderer.domElement.removeEventListener("webglcontextlost", this.onContextLost), this.renderer.domElement.removeEventListener("webglcontextrestored", this.onContextRestored), this.clearBackgroundVideo(), this.backgroundTexture?.dispose();
13751
+ cancelAnimationFrame(this.rafId), cancelAnimationFrame(this.resizeRaf), this.running = !1, this.interaction?.dispose(), this.interaction = void 0, this.resizeObserver.disconnect(), this.intersectionObserver.disconnect(), this.motionQuery.removeEventListener("change", this.onMotionChange), this.dprQuery?.removeEventListener("change", this.onDprChange), document.removeEventListener("visibilitychange", this.onVisibilityChange), this.renderer.domElement.removeEventListener("webglcontextlost", this.onContextLost), this.renderer.domElement.removeEventListener("webglcontextrestored", this.onContextRestored), this.clearBackgroundVideo(), this.backgroundTexture?.dispose();
13702
13752
  for (let e of this.waves) e.material.dispose(), e.geometry.dispose(), e.palette.dispose();
13703
13753
  this.bloomPass?.dispose(), this.ditherPass?.dispose(), this.innerLightPass?.dispose(), this.halftonePass?.dispose(), this.heatmapPass?.dispose(), this.paperTexturePass?.dispose(), this.halftoneCmykPass?.dispose(), this.composer.dispose(), this.renderer.dispose(), this.renderer.domElement.remove();
13704
13754
  }
13705
13755
  };
13706
- })), Dd = /* @__PURE__ */ n({
13707
- WaveRenderer: () => Td,
13756
+ })), kd = /* @__PURE__ */ n({
13757
+ WaveRenderer: () => Dd,
13708
13758
  createDefaultConfig: () => wl
13709
13759
  });
13710
13760
  //#endregion
13711
13761
  //#region src/shell/probe.ts
13712
13762
  t((() => {
13713
- Ed(), Gl();
13763
+ Od(), Kl();
13714
13764
  }))();
13715
- function Od() {
13765
+ function Ad() {
13716
13766
  if (typeof document > "u") return !1;
13717
13767
  try {
13718
13768
  let e = document.createElement("canvas"), t = { failIfMajorPerformanceCaveat: !0 }, n = e.getContext("webgl2", t) ?? e.getContext("webgl", t);
@@ -13721,22 +13771,22 @@ function Od() {
13721
13771
  return !1;
13722
13772
  }
13723
13773
  }
13724
- function kd() {
13774
+ function jd() {
13725
13775
  return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
13726
13776
  }
13727
- function Ad() {
13777
+ function Md() {
13728
13778
  return typeof navigator > "u" ? !1 : navigator.connection?.saveData === !0;
13729
13779
  }
13730
13780
  //#endregion
13731
13781
  //#region src/shell/poster.ts
13732
- var jd = "data-wave3d-poster";
13733
- function Md(e) {
13782
+ var Nd = "data-wave3d-poster";
13783
+ function Pd(e) {
13734
13784
  getComputedStyle(e).position === "static" && (e.style.position = "relative");
13735
13785
  }
13736
- function Nd(e, t, n = "fill") {
13737
- let r = e.querySelector(`img[${jd}]`);
13786
+ function Fd(e, t, n = "fill") {
13787
+ let r = e.querySelector(`img[${Nd}]`);
13738
13788
  if (!r && !t) return null;
13739
- r || (r = document.createElement("img"), r.setAttribute(jd, ""), r.decoding = "async", r.alt = "", r.setAttribute("aria-hidden", "true"), e.appendChild(r)), t && (r.src = t), Object.assign(r.style, {
13789
+ r || (r = document.createElement("img"), r.setAttribute(Nd, ""), r.decoding = "async", r.alt = "", r.setAttribute("aria-hidden", "true"), e.appendChild(r)), t && (r.src = t), Object.assign(r.style, {
13740
13790
  position: "absolute",
13741
13791
  inset: "0",
13742
13792
  width: "100%",
@@ -13769,12 +13819,12 @@ function Nd(e, t, n = "fill") {
13769
13819
  }
13770
13820
  //#endregion
13771
13821
  //#region src/shell/createWave.ts
13772
- function Pd(e, t, n, r) {
13822
+ function Id(e, t, n, r) {
13773
13823
  let { lazy: i = !0, rootMargin: a = "200px", webgl: o = "auto", respectReducedMotion: s = !0, reducedMotionBehavior: c = "static", respectSaveData: l = !0, fadeMs: u = 300 } = r, d = "poster", f = null, p = { ...n };
13774
13824
  r.paused !== void 0 && (p.paused = r.paused);
13775
13825
  let m = /* @__PURE__ */ new Map(), h = !1, g = null, _, v = 0;
13776
- Md(t);
13777
- let y = Nd(t, r.poster, r.posterFit);
13826
+ Pd(t);
13827
+ let y = Fd(t, r.poster, r.posterFit);
13778
13828
  function b(e) {
13779
13829
  d !== e && (d = e, r.onStateChange?.(e));
13780
13830
  }
@@ -13822,7 +13872,7 @@ function Pd(e, t, n, r) {
13822
13872
  }
13823
13873
  function E() {
13824
13874
  if (!h) {
13825
- if (o === "auto" && !Od()) {
13875
+ if (o === "auto" && !Ad()) {
13826
13876
  x("no-webgl");
13827
13877
  return;
13828
13878
  }
@@ -13831,8 +13881,8 @@ function Pd(e, t, n, r) {
13831
13881
  }
13832
13882
  function D() {
13833
13883
  if (o !== "off") {
13834
- if (l && Ad()) return x("save-data");
13835
- if (s && c === "poster" && kd()) return x("reduced-motion");
13884
+ if (l && Md()) return x("save-data");
13885
+ if (s && c === "poster" && jd()) return x("reduced-motion");
13836
13886
  i && typeof IntersectionObserver < "u" ? (g = new IntersectionObserver((e) => {
13837
13887
  e.some((e) => e.isIntersecting) && (g?.disconnect(), g = null, E());
13838
13888
  }, { rootMargin: a }), g.observe(t)) : E();
@@ -13875,11 +13925,11 @@ function Pd(e, t, n, r) {
13875
13925
  }
13876
13926
  //#endregion
13877
13927
  //#region src/presets.ts
13878
- Gl();
13879
- var Fd = 180 / Math.PI;
13880
- function Id(e) {
13928
+ Kl();
13929
+ var Ld = 180 / Math.PI;
13930
+ function Rd(e) {
13881
13931
  let t = wl(), n = t.waves[0];
13882
- return n.speed = e.speed, n.colorContrast = e.contrast, n.colorSaturation = e.sat, n.hueShift = e.hueRad * Fd, n.displaceFrequency = {
13932
+ return n.speed = e.speed, n.colorContrast = e.contrast, n.colorSaturation = e.sat, n.hueShift = e.hueRad * Ld, n.displaceFrequency = {
13883
13933
  x: e.dispX,
13884
13934
  y: e.dispZ
13885
13935
  }, n.displaceAmount = e.dispAmt, n.position = {
@@ -13887,9 +13937,9 @@ function Id(e) {
13887
13937
  y: e.pos[1],
13888
13938
  z: e.pos[2]
13889
13939
  }, n.rotation = {
13890
- x: e.rotRad[0] * Fd,
13891
- y: e.rotRad[1] * Fd,
13892
- z: e.rotRad[2] * Fd
13940
+ x: e.rotRad[0] * Ld,
13941
+ y: e.rotRad[1] * Ld,
13942
+ z: e.rotRad[2] * Ld
13893
13943
  }, n.scale = {
13894
13944
  x: e.scale[0],
13895
13945
  y: e.scale[1],
@@ -13912,8 +13962,8 @@ function Id(e) {
13912
13962
  z: 0
13913
13963
  }, t.cameraZoom = e.zoom, t;
13914
13964
  }
13915
- var Ld = {
13916
- Hero: () => Id({
13965
+ var zd = {
13966
+ Hero: () => Rd({
13917
13967
  speed: .04,
13918
13968
  contrast: 1,
13919
13969
  sat: 1,
@@ -13957,7 +14007,7 @@ var Ld = {
13957
14007
  camTarget: [-420, -200]
13958
14008
  }),
13959
14009
  "Wave 2": () => wl(),
13960
- "Wave 3": () => Id({
14010
+ "Wave 3": () => Rd({
13961
14011
  speed: .08,
13962
14012
  contrast: 1,
13963
14013
  sat: 1,
@@ -14000,7 +14050,7 @@ var Ld = {
14000
14050
  zoom: 1.3,
14001
14051
  camTarget: [-104, 13]
14002
14052
  }),
14003
- "Wave 4": () => Id({
14053
+ "Wave 4": () => Rd({
14004
14054
  speed: .0525,
14005
14055
  contrast: .969,
14006
14056
  sat: 1.383,
@@ -14080,7 +14130,7 @@ var Ld = {
14080
14130
  ]), t.creaseLight = 1, e.background = "#05060c", e.transparentBackground = !1, e.waves = bl(t, 3), e.waveCount = 3, e;
14081
14131
  },
14082
14132
  "Mesh Gradient": () => {
14083
- let e = Ld.Hero(), t = e.waves[0];
14133
+ let e = zd.Hero(), t = e.waves[0];
14084
14134
  return t.gradientType = "mesh", t.meshGradientPoints = [
14085
14135
  {
14086
14136
  color: "#0a84ff",
@@ -14121,7 +14171,7 @@ var Ld = {
14121
14171
  ], t.meshGradientSoftness = .68, t.blendMode = "normal", t.hueShift = 0, t.colorContrast = 1.06, t.colorSaturation = 1.12, t.fiberStrength = .14, e.grain = .3, e.blur = .008, e.background = "#070914", e.backgroundMode = "color", e.transparentBackground = !1, e;
14122
14172
  },
14123
14173
  "Solar Bloom": () => {
14124
- let e = Ld.Hero(), t = e.waves[0];
14174
+ let e = zd.Hero(), t = e.waves[0];
14125
14175
  return t.usePaletteTexture = !1, t.gradientType = "radial", t.gradientShift = .14, t.palette = [
14126
14176
  {
14127
14177
  color: "#fff3c4",
@@ -14150,7 +14200,7 @@ var Ld = {
14150
14200
  ], t.blendMode = "normal", t.hueShift = 0, t.colorContrast = 1.05, t.colorSaturation = 1.18, t.fiberStrength = .12, e.grain = .3, e.blur = .01, e.background = "#0a0714", e.backgroundMode = "gradient", e.backgroundGradientType = "radial", e.backgroundGradientSource = "stops", e.backgroundPalette = vl(["#2a1330", "#08040f"]), e.transparentBackground = !1, e;
14151
14201
  },
14152
14202
  Holographic: () => {
14153
- let e = Ld.Hero(), t = e.waves[0];
14203
+ let e = zd.Hero(), t = e.waves[0];
14154
14204
  return t.usePaletteTexture = !1, t.gradientType = "conic", t.gradientShift = .08, t.palette = [
14155
14205
  {
14156
14206
  color: "#8ef6e4",
@@ -14183,7 +14233,7 @@ var Ld = {
14183
14233
  ], t.blendMode = "normal", t.hueShift = 0, t.colorContrast = 1.04, t.colorSaturation = 1.12, t.fiberStrength = .12, e.grain = .28, e.blur = .01, e.background = "#05060c", e.backgroundMode = "gradient", e.backgroundGradientType = "linear", e.backgroundGradientAngle = 135, e.backgroundGradientSource = "stops", e.backgroundPalette = vl(["#04121a", "#0a0518"]), e.transparentBackground = !1, e;
14184
14234
  },
14185
14235
  Aurora: () => {
14186
- let e = Ld.Hero(), t = e.waves[0];
14236
+ let e = zd.Hero(), t = e.waves[0];
14187
14237
  return t.gradientType = "mesh", t.meshGradientPoints = [
14188
14238
  {
14189
14239
  color: "#0a1f3c",
@@ -14255,31 +14305,31 @@ var Ld = {
14255
14305
  ], e.backgroundMeshSoftness = .75, e.transparentBackground = !1, e;
14256
14306
  },
14257
14307
  Palestine: () => {
14258
- let e = Ld.Hero(), t = e.waves[0];
14308
+ let e = zd.Hero(), t = e.waves[0];
14259
14309
  return t.paletteSource = "palestine", t.blendMode = "normal", t.hueShift = 0, t.colorContrast = 1, t.colorSaturation = 1, e.grain = .35, e.background = "#f2efe8", e.transparentBackground = !0, e;
14260
14310
  },
14261
14311
  Spain: () => {
14262
- let e = Ld.Hero(), t = e.waves[0];
14312
+ let e = zd.Hero(), t = e.waves[0];
14263
14313
  return t.paletteSource = "spain", t.blendMode = "normal", t.hueShift = 0, t.colorContrast = 1.18, t.colorSaturation = 1.25, t.creaseLight = 1.6, e.grain = .3, e.background = "#1a0608", e.backgroundMode = "color", e.transparentBackground = !1, e;
14264
14314
  },
14265
14315
  "Vaporwave Sunset": () => {
14266
- let e = Ld.Hero(), t = e.waves[0];
14267
- return t.position.x = 525, t.rotation.x = -.64 * Fd, t.rotation.z = 1.68 * Fd, t.paletteSource = "vaporwave", t.blendMode = "normal", t.hueShift = 0, t.colorContrast = 1.08, t.colorSaturation = 1.15, t.creaseLight = 1.25, e.cameraZoom = 1.1, e.cameraTarget = {
14316
+ let e = zd.Hero(), t = e.waves[0];
14317
+ return t.position.x = 525, t.rotation.x = -.64 * Ld, t.rotation.z = 1.68 * Ld, t.paletteSource = "vaporwave", t.blendMode = "normal", t.hueShift = 0, t.colorContrast = 1.08, t.colorSaturation = 1.15, t.creaseLight = 1.25, e.cameraZoom = 1.1, e.cameraTarget = {
14268
14318
  x: 150,
14269
14319
  y: 360,
14270
14320
  z: 0
14271
14321
  }, e.background = "#09051f", e.transparentBackground = !1, e;
14272
14322
  },
14273
14323
  Kaleidoscope: () => {
14274
- let e = Ld["Wave 3"](), t = e.waves[0];
14324
+ let e = zd["Wave 3"](), t = e.waves[0];
14275
14325
  return t.paletteSource = "kaleidoscope", t.blendMode = "normal", t.hueShift = 0, t.colorContrast = 1.05, t.colorSaturation = 1.12, e.grain = .5, e;
14276
14326
  }
14277
14327
  };
14278
- Ed(), Gl();
14279
- var Rd = () => Promise.resolve(Dd);
14280
- function zd(e, t = {}, n = {}) {
14281
- return Pd(Rd, e, t, n);
14328
+ Od(), Kl();
14329
+ var Bd = () => Promise.resolve(kd);
14330
+ function Vd(e, t = {}, n = {}) {
14331
+ return Id(Bd, e, t, n);
14282
14332
  }
14283
- var Bd = zd;
14333
+ var Hd = Vd;
14284
14334
  //#endregion
14285
- export { Vl as DEFAULT_LIGHT_POSITION, Il as MAX_COLORS, Rl as MAX_LIGHTS, Ll as MAX_MESH_POINTS, zl as MAX_NOISE_BANDS, Bl as MAX_WAVES, Ld as PRESETS, Td as WaveRenderer, wl as createDefaultConfig, yl as createDefaultMeshPoints, gl as createLight, _l as createNoiseBand, zd as createWave, Dl as ensureCamera, kl as ensureSceneDefaults, Fl as ensureStudioConfig, vl as makeStops, Sl as makeWave, bl as makeWaveSpread, Bd as mountWave, El as normalizeBackground, Pl as normalizeSceneInteraction, Ol as normalizeWave, Nl as normalizeWaveInteraction, Cl as resizeWaves };
14335
+ export { Vl as CAMERA_FITS, Hl as DEFAULT_LIGHT_POSITION, Il as MAX_COLORS, Rl as MAX_LIGHTS, Ll as MAX_MESH_POINTS, zl as MAX_NOISE_BANDS, Bl as MAX_WAVES, zd as PRESETS, Dd as WaveRenderer, wl as createDefaultConfig, yl as createDefaultMeshPoints, gl as createLight, _l as createNoiseBand, Vd as createWave, Dl as ensureCamera, kl as ensureSceneDefaults, Fl as ensureStudioConfig, vl as makeStops, Sl as makeWave, bl as makeWaveSpread, Hd as mountWave, El as normalizeBackground, Pl as normalizeSceneInteraction, Ol as normalizeWave, Nl as normalizeWaveInteraction, Cl as resizeWaves };