@rippleflow/water-distortion 0.1.2 → 0.1.4

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.
@@ -1,16 +1,16 @@
1
1
  var Ye = Object.defineProperty;
2
- var Ve = (r, e, t) => e in r ? Ye(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var f = (r, e, t) => Ve(r, typeof e != "symbol" ? e + "" : e, t);
2
+ var Ve = (r, e, n) => e in r ? Ye(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
+ var f = (r, e, n) => Ve(r, typeof e != "symbol" ? e + "" : e, n);
4
4
  import { jsxs as qe, jsx as de } from "react/jsx-runtime";
5
5
  import { forwardRef as $e, useRef as y, useImperativeHandle as Qe, useEffect as V, useState as je } from "react";
6
- function h(r, e, t) {
7
- return Math.min(t, Math.max(e, r));
6
+ function h(r, e, n) {
7
+ return Math.min(n, Math.max(e, r));
8
8
  }
9
9
  function Ze(r, e) {
10
10
  return Math.hypot(e.x - r.x, e.y - r.y);
11
11
  }
12
- function O(r, e, t) {
13
- return r + (e - r) * t;
12
+ function O(r, e, n) {
13
+ return r + (e - r) * n;
14
14
  }
15
15
  const J = 24, C = 128, oe = 8, se = Math.PI * 2, fe = {
16
16
  causticGain: 0.1,
@@ -132,7 +132,6 @@ uniform sampler2D u_background;
132
132
  uniform sampler2D u_causticMap;
133
133
  uniform vec2 u_texel;
134
134
  uniform float u_domMode;
135
- uniform float u_textureEnabled;
136
135
  uniform float u_normalScale;
137
136
  uniform float u_refractionStrength;
138
137
  uniform float u_specularIntensity;
@@ -144,18 +143,6 @@ const float DOM_CAUSTIC_GAIN = ${fe.causticGain.toFixed(2)};
144
143
  const float DOM_SCREEN_COMPENSATION = ${fe.screenCompensation.toFixed(2)};
145
144
  const float DOM_MAX_ALPHA = ${fe.maxAlpha.toFixed(2)};
146
145
 
147
- vec3 proceduralBackground(vec2 uv) {
148
- vec3 deep = vec3(0.055, 0.075, 0.070);
149
- vec3 teal = vec3(0.060, 0.320, 0.310);
150
- vec3 coral = vec3(0.680, 0.230, 0.190);
151
- vec3 gold = vec3(0.850, 0.710, 0.360);
152
- float diagonal = smoothstep(0.05, 0.95, uv.x * 0.72 + uv.y * 0.28);
153
- vec3 color = mix(deep, teal, diagonal);
154
- color = mix(color, coral, smoothstep(0.18, 0.76, uv.x - uv.y * 0.18) * 0.36);
155
- color = mix(color, gold, smoothstep(0.58, 1.0, uv.y + uv.x * 0.16) * 0.24);
156
- return color;
157
- }
158
-
159
146
  vec4 causticLayer(vec2 uv, vec2 bend, mat2 rotation, float scale, vec2 drift) {
160
147
  vec2 p = rotation * (uv * scale + drift * u_time);
161
148
 
@@ -180,9 +167,7 @@ void main() {
180
167
  vec2(0.999)
181
168
  );
182
169
 
183
- vec3 base = u_textureEnabled > 0.5
184
- ? texture2D(u_background, refractedUv).rgb
185
- : proceduralBackground(refractedUv);
170
+ vec3 base = texture2D(u_background, refractedUv).rgb;
186
171
 
187
172
  float gradient = length(vec2(dx, dy)) * u_normalScale;
188
173
  float crest = smoothstep(0.012, 0.24, gradient);
@@ -272,7 +257,8 @@ void main() {
272
257
  }
273
258
  `;
274
259
  class rt {
275
- constructor(e) {
260
+ constructor(e, n = () => {
261
+ }) {
276
262
  f(this, "gl");
277
263
  f(this, "isWebGL2");
278
264
  f(this, "canLinearFloat");
@@ -296,20 +282,20 @@ class rt {
296
282
  f(this, "wakeAUniforms", new Float32Array(J * 4));
297
283
  f(this, "wakeBUniforms", new Float32Array(J * 4));
298
284
  f(this, "wakeShapeUniforms", new Float32Array(J * 4));
299
- this.canvas = e;
300
- const { gl: t, isWebGL2: n, canLinearFloat: i } = it(e);
301
- this.gl = t, this.isWebGL2 = n, this.canLinearFloat = i, this.quadBuffer = q(t.createBuffer(), "WebGL buffer"), this.simulationProgram = Le(t, Ae, et), this.materialProgram = Le(t, Ae, tt), this.backgroundTexture = q(t.createTexture(), "WebGL texture"), this.causticTexture = q(t.createTexture(), "WebGL texture"), t.bindBuffer(t.ARRAY_BUFFER, this.quadBuffer), t.bufferData(
285
+ this.canvas = e, this.requestRender = n;
286
+ const { gl: t, isWebGL2: i, canLinearFloat: a } = it(e);
287
+ this.gl = t, this.isWebGL2 = i, this.canLinearFloat = a, this.quadBuffer = q(t.createBuffer(), "WebGL buffer"), this.simulationProgram = Le(t, Ae, et), this.materialProgram = Le(t, Ae, tt), this.backgroundTexture = q(t.createTexture(), "WebGL texture"), this.causticTexture = q(t.createTexture(), "WebGL texture"), t.bindBuffer(t.ARRAY_BUFFER, this.quadBuffer), t.bufferData(
302
288
  t.ARRAY_BUFFER,
303
289
  new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
304
290
  t.STATIC_DRAW
305
291
  ), t.disable(t.DEPTH_TEST), t.disable(t.STENCIL_TEST), t.disable(t.BLEND), this.initializeBackgroundTexture(), this.initializeCausticTexture(), this.resize(1, 1, 1, 192);
306
292
  }
307
- resize(e, t, n, i) {
308
- this.cssWidth = Math.max(1, e), this.cssHeight = Math.max(1, t);
309
- const a = Math.min(2, Math.max(1, n || 1)), l = Math.max(1, Math.round(this.cssWidth * a)), c = Math.max(1, Math.round(this.cssHeight * a));
293
+ resize(e, n, t, i) {
294
+ this.cssWidth = Math.max(1, e), this.cssHeight = Math.max(1, n);
295
+ const a = Math.min(2, Math.max(1, t || 1)), l = Math.max(1, Math.round(this.cssWidth * a)), c = Math.max(1, Math.round(this.cssHeight * a));
310
296
  (this.canvas.width !== l || this.canvas.height !== c) && (this.canvas.width = l, this.canvas.height = c);
311
- const s = Math.max(32, Math.round(i)), d = this.cssWidth / this.cssHeight, E = d >= 1 ? s : Math.max(1, Math.round(s * d)), _ = d >= 1 ? Math.max(1, Math.round(s / d)) : s;
312
- E === this.simWidth && _ === this.simHeight || (this.simWidth = E, this.simHeight = _, this.recreateState());
297
+ const s = Math.max(32, Math.round(i)), d = this.cssWidth / this.cssHeight, E = d >= 1 ? s : Math.max(1, Math.round(s * d)), p = d >= 1 ? Math.max(1, Math.round(s / d)) : s;
298
+ E === this.simWidth && p === this.simHeight || (this.simWidth = E, this.simHeight = p, this.recreateState());
313
299
  }
314
300
  setTextureSource(e) {
315
301
  if (e === this.textureSource || (this.textureSource = e, this.textureImage = void 0, this.textureReady = !1, this.textureNeedsUpload = !1, !e))
@@ -318,28 +304,28 @@ class rt {
318
304
  this.textureImage = e, this.textureNeedsUpload = !0;
319
305
  return;
320
306
  }
321
- const t = new Image();
322
- t.crossOrigin = "anonymous", t.onload = () => {
323
- this.textureSource === e && (this.textureImage = t, this.textureNeedsUpload = !0);
324
- }, t.onerror = () => {
307
+ const n = new Image();
308
+ n.crossOrigin = "anonymous", n.onload = () => {
309
+ this.textureSource === e && (this.textureImage = n, this.textureNeedsUpload = !0, this.requestRender());
310
+ }, n.onerror = () => {
325
311
  this.textureSource === e && (this.textureImage = void 0, this.textureReady = !1, this.textureNeedsUpload = !1);
326
- }, t.src = e;
312
+ }, n.src = e;
327
313
  }
328
- step(e, t, n) {
314
+ step(e, n, t) {
329
315
  if (!this.stateTextures || !this.framebuffers)
330
316
  return;
331
317
  const i = this.gl, a = 1 - this.readIndex;
332
- i.useProgram(this.simulationProgram.program), i.bindFramebuffer(i.FRAMEBUFFER, this.framebuffers[a]), i.viewport(0, 0, this.simWidth, this.simHeight), i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_2D, this.stateTextures[this.readIndex]), this.prepareQuad(this.simulationProgram), this.setSimulationUniforms(e, t, n), i.drawArrays(i.TRIANGLE_STRIP, 0, 4), i.bindFramebuffer(i.FRAMEBUFFER, null), this.readIndex = a;
318
+ i.useProgram(this.simulationProgram.program), i.bindFramebuffer(i.FRAMEBUFFER, this.framebuffers[a]), i.viewport(0, 0, this.simWidth, this.simHeight), i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_2D, this.stateTextures[this.readIndex]), this.prepareQuad(this.simulationProgram), this.setSimulationUniforms(e, n, t), i.drawArrays(i.TRIANGLE_STRIP, 0, 4), i.bindFramebuffer(i.FRAMEBUFFER, null), this.readIndex = a;
333
319
  }
334
- render(e, t = 0) {
335
- const n = this.gl;
336
- this.stateTextures && (e.texture ? this.setTextureSource(e.texture) : this.setTextureSource(void 0), this.uploadTextureIfNeeded(e), n.useProgram(this.materialProgram.program), n.bindFramebuffer(n.FRAMEBUFFER, null), n.viewport(0, 0, this.canvas.width, this.canvas.height), n.clearColor(0, 0, 0, 0), n.clear(n.COLOR_BUFFER_BIT), n.activeTexture(n.TEXTURE0), n.bindTexture(n.TEXTURE_2D, this.stateTextures[this.readIndex]), n.activeTexture(n.TEXTURE1), n.bindTexture(n.TEXTURE_2D, this.backgroundTexture), n.activeTexture(n.TEXTURE2), n.bindTexture(n.TEXTURE_2D, this.causticTexture), this.prepareQuad(this.materialProgram), this.setMaterialUniforms(e, t), n.drawArrays(n.TRIANGLE_STRIP, 0, 4));
320
+ render(e, n = 0) {
321
+ const t = this.gl;
322
+ this.stateTextures && (e.texture ? this.setTextureSource(e.texture) : this.setTextureSource(void 0), this.uploadTextureIfNeeded(e), t.useProgram(this.materialProgram.program), t.bindFramebuffer(t.FRAMEBUFFER, null), t.viewport(0, 0, this.canvas.width, this.canvas.height), t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), !(e.mode !== "dom" && !this.textureReady) && (t.activeTexture(t.TEXTURE0), t.bindTexture(t.TEXTURE_2D, this.stateTextures[this.readIndex]), t.activeTexture(t.TEXTURE1), t.bindTexture(t.TEXTURE_2D, this.backgroundTexture), t.activeTexture(t.TEXTURE2), t.bindTexture(t.TEXTURE_2D, this.causticTexture), this.prepareQuad(this.materialProgram), this.setMaterialUniforms(e, n), t.drawArrays(t.TRIANGLE_STRIP, 0, 4)));
337
323
  }
338
324
  hasVisibleActivity() {
339
325
  if (!this.framebuffers)
340
326
  return !1;
341
- const e = this.gl, t = this.framebuffers[this.readIndex], n = this.simWidth * this.simHeight * 4;
342
- (!this.activityPixels || this.activityPixels.length !== n) && (this.activityPixels = new Float32Array(n)), e.bindFramebuffer(e.FRAMEBUFFER, t);
327
+ const e = this.gl, n = this.framebuffers[this.readIndex], t = this.simWidth * this.simHeight * 4;
328
+ (!this.activityPixels || this.activityPixels.length !== t) && (this.activityPixels = new Float32Array(t)), e.bindFramebuffer(e.FRAMEBUFFER, n);
343
329
  try {
344
330
  e.readPixels(
345
331
  0,
@@ -363,26 +349,26 @@ class rt {
363
349
  const e = this.gl;
364
350
  if (this.framebuffers) {
365
351
  e.viewport(0, 0, this.simWidth, this.simHeight);
366
- for (const t of this.framebuffers)
367
- e.bindFramebuffer(e.FRAMEBUFFER, t), e.clearColor(0, 0, 0, 1), e.clear(e.COLOR_BUFFER_BIT);
352
+ for (const n of this.framebuffers)
353
+ e.bindFramebuffer(e.FRAMEBUFFER, n), e.clearColor(0, 0, 0, 1), e.clear(e.COLOR_BUFFER_BIT);
368
354
  }
369
355
  e.bindFramebuffer(e.FRAMEBUFFER, null), e.viewport(0, 0, this.canvas.width, this.canvas.height), e.clearColor(0, 0, 0, 0), e.clear(e.COLOR_BUFFER_BIT);
370
356
  }
371
357
  dispose() {
372
- var t, n;
358
+ var n, t;
373
359
  const e = this.gl;
374
- (t = this.stateTextures) == null || t.forEach((i) => e.deleteTexture(i)), (n = this.framebuffers) == null || n.forEach((i) => e.deleteFramebuffer(i)), e.deleteTexture(this.backgroundTexture), e.deleteTexture(this.causticTexture), e.deleteBuffer(this.quadBuffer), e.deleteProgram(this.simulationProgram.program), e.deleteProgram(this.materialProgram.program);
360
+ (n = this.stateTextures) == null || n.forEach((i) => e.deleteTexture(i)), (t = this.framebuffers) == null || t.forEach((i) => e.deleteFramebuffer(i)), e.deleteTexture(this.backgroundTexture), e.deleteTexture(this.causticTexture), e.deleteBuffer(this.quadBuffer), e.deleteProgram(this.simulationProgram.program), e.deleteProgram(this.materialProgram.program);
375
361
  }
376
362
  recreateState() {
377
363
  var l, c;
378
364
  const e = this.gl;
379
365
  (l = this.stateTextures) == null || l.forEach((s) => e.deleteTexture(s)), (c = this.framebuffers) == null || c.forEach((s) => e.deleteFramebuffer(s));
380
- const t = this.createStateTexture(), n = this.createStateTexture(), i = this.createFramebuffer(t), a = this.createFramebuffer(n);
381
- this.stateTextures = [t, n], this.framebuffers = [i, a], this.readIndex = 0, this.clear();
366
+ const n = this.createStateTexture(), t = this.createStateTexture(), i = this.createFramebuffer(n), a = this.createFramebuffer(t);
367
+ this.stateTextures = [n, t], this.framebuffers = [i, a], this.readIndex = 0, this.clear();
382
368
  }
383
369
  createStateTexture() {
384
- const e = this.gl, t = q(e.createTexture(), "WebGL texture");
385
- if (e.bindTexture(e.TEXTURE_2D, t), e.texParameteri(
370
+ const e = this.gl, n = q(e.createTexture(), "WebGL texture");
371
+ if (e.bindTexture(e.TEXTURE_2D, n), e.texParameteri(
386
372
  e.TEXTURE_2D,
387
373
  e.TEXTURE_MIN_FILTER,
388
374
  this.canLinearFloat ? e.LINEAR : e.NEAREST
@@ -391,16 +377,16 @@ class rt {
391
377
  e.TEXTURE_MAG_FILTER,
392
378
  this.canLinearFloat ? e.LINEAR : e.NEAREST
393
379
  ), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), this.isWebGL2) {
394
- const n = e;
395
- n.texImage2D(
396
- n.TEXTURE_2D,
380
+ const t = e;
381
+ t.texImage2D(
382
+ t.TEXTURE_2D,
397
383
  0,
398
- n.RGBA32F,
384
+ t.RGBA32F,
399
385
  this.simWidth,
400
386
  this.simHeight,
401
387
  0,
402
- n.RGBA,
403
- n.FLOAT,
388
+ t.RGBA,
389
+ t.FLOAT,
404
390
  null
405
391
  );
406
392
  } else
@@ -415,19 +401,19 @@ class rt {
415
401
  e.FLOAT,
416
402
  null
417
403
  );
418
- return t;
404
+ return n;
419
405
  }
420
406
  createFramebuffer(e) {
421
- const t = this.gl, n = q(t.createFramebuffer(), "WebGL framebuffer");
422
- if (t.bindFramebuffer(t.FRAMEBUFFER, n), t.framebufferTexture2D(
423
- t.FRAMEBUFFER,
424
- t.COLOR_ATTACHMENT0,
425
- t.TEXTURE_2D,
407
+ const n = this.gl, t = q(n.createFramebuffer(), "WebGL framebuffer");
408
+ if (n.bindFramebuffer(n.FRAMEBUFFER, t), n.framebufferTexture2D(
409
+ n.FRAMEBUFFER,
410
+ n.COLOR_ATTACHMENT0,
411
+ n.TEXTURE_2D,
426
412
  e,
427
413
  0
428
- ), t.checkFramebufferStatus(t.FRAMEBUFFER) !== t.FRAMEBUFFER_COMPLETE)
414
+ ), n.checkFramebufferStatus(n.FRAMEBUFFER) !== n.FRAMEBUFFER_COMPLETE)
429
415
  throw new Error("WaterDistortion could not create a float simulation target.");
430
- return t.bindFramebuffer(t.FRAMEBUFFER, null), n;
416
+ return n.bindFramebuffer(n.FRAMEBUFFER, null), t;
431
417
  }
432
418
  initializeBackgroundTexture() {
433
419
  const e = this.gl;
@@ -460,71 +446,68 @@ class rt {
460
446
  uploadTextureIfNeeded(e) {
461
447
  if (e.mode === "dom" || !this.textureImage || !this.textureNeedsUpload && !at(this.textureImage))
462
448
  return;
463
- const t = this.gl;
449
+ const n = this.gl;
464
450
  try {
465
- t.bindTexture(t.TEXTURE_2D, this.backgroundTexture), t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL, 1), t.texImage2D(
466
- t.TEXTURE_2D,
451
+ n.bindTexture(n.TEXTURE_2D, this.backgroundTexture), n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, 1), n.texImage2D(
452
+ n.TEXTURE_2D,
467
453
  0,
468
- t.RGBA,
469
- t.RGBA,
470
- t.UNSIGNED_BYTE,
454
+ n.RGBA,
455
+ n.RGBA,
456
+ n.UNSIGNED_BYTE,
471
457
  this.textureImage
472
- ), t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL, 0), this.textureReady = !0, this.textureNeedsUpload = !1;
458
+ ), n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, 0), this.textureReady = !0, this.textureNeedsUpload = !1;
473
459
  } catch {
474
460
  this.textureReady = !1, this.textureNeedsUpload = !1;
475
461
  }
476
462
  }
477
463
  prepareQuad(e) {
478
- const t = this.gl;
479
- t.bindBuffer(t.ARRAY_BUFFER, this.quadBuffer), t.enableVertexAttribArray(e.position), t.vertexAttribPointer(e.position, 2, t.FLOAT, !1, 0, 0);
464
+ const n = this.gl;
465
+ n.bindBuffer(n.ARRAY_BUFFER, this.quadBuffer), n.enableVertexAttribArray(e.position), n.vertexAttribPointer(e.position, 2, n.FLOAT, !1, 0, 0);
480
466
  }
481
- setSimulationUniforms(e, t, n) {
467
+ setSimulationUniforms(e, n, t) {
482
468
  const i = this.gl, a = this.simulationProgram.program, l = Math.min(e.length, J), c = this.wakeAUniforms, s = this.wakeBUniforms, d = this.wakeShapeUniforms, E = Math.max(0, e.length - J);
483
469
  c.fill(0), s.fill(0), d.fill(0);
484
- for (let _ = 0; _ < l; _ += 1) {
485
- const m = e[E + _], v = _ * 4;
470
+ for (let p = 0; p < l; p += 1) {
471
+ const m = e[E + p], v = p * 4;
486
472
  c[v] = m.ax, c[v + 1] = m.ay, c[v + 2] = m.radius, c[v + 3] = m.wakeStrength, s[v] = m.bx, s[v + 1] = m.by, s[v + 2] = m.wakeLength, s[v + 3] = m.velocity, d[v] = m.troughStrength, d[v + 1] = m.ridgeStrength, d[v + 2] = m.ridgeOffset;
487
473
  }
488
- i.uniform1i(p(i, a, "u_state"), 0), i.uniform2f(p(i, a, "u_texel"), 1 / this.simWidth, 1 / this.simHeight), i.uniform1f(p(i, a, "u_delta"), n), i.uniform1f(p(i, a, "u_damping"), t.damping), i.uniform1f(p(i, a, "u_stiffness"), t.waveSpeed), i.uniform1f(p(i, a, "u_aspect"), this.cssWidth / this.cssHeight), i.uniform1i(p(i, a, "u_wakeCount"), l), i.uniform4fv(p(i, a, "u_wakeA[0]"), c), i.uniform4fv(p(i, a, "u_wakeB[0]"), s), i.uniform4fv(p(i, a, "u_wakeShape[0]"), d);
474
+ i.uniform1i(S(i, a, "u_state"), 0), i.uniform2f(S(i, a, "u_texel"), 1 / this.simWidth, 1 / this.simHeight), i.uniform1f(S(i, a, "u_delta"), t), i.uniform1f(S(i, a, "u_damping"), n.damping), i.uniform1f(S(i, a, "u_stiffness"), n.waveSpeed), i.uniform1f(S(i, a, "u_aspect"), this.cssWidth / this.cssHeight), i.uniform1i(S(i, a, "u_wakeCount"), l), i.uniform4fv(S(i, a, "u_wakeA[0]"), c), i.uniform4fv(S(i, a, "u_wakeB[0]"), s), i.uniform4fv(S(i, a, "u_wakeShape[0]"), d);
489
475
  }
490
- setMaterialUniforms(e, t) {
491
- const n = this.gl, i = this.materialProgram.program, a = e.mode !== "dom";
492
- n.uniform1i(p(n, i, "u_state"), 0), n.uniform1i(p(n, i, "u_background"), 1), n.uniform1i(p(n, i, "u_causticMap"), 2), n.uniform2f(p(n, i, "u_texel"), 1 / this.simWidth, 1 / this.simHeight), n.uniform1f(p(n, i, "u_domMode"), e.mode === "dom" ? 1 : 0), n.uniform1f(
493
- p(n, i, "u_textureEnabled"),
494
- a && this.textureReady ? 1 : 0
495
- ), n.uniform1f(p(n, i, "u_normalScale"), e.normalScale), n.uniform1f(p(n, i, "u_refractionStrength"), e.refractionStrength), n.uniform1f(p(n, i, "u_specularIntensity"), e.specularIntensity), n.uniform1f(p(n, i, "u_crestIntensity"), e.crestIntensity), n.uniform1f(p(n, i, "u_causticIntensity"), e.causticIntensity), n.uniform1f(p(n, i, "u_time"), t % 1e3);
476
+ setMaterialUniforms(e, n) {
477
+ const t = this.gl, i = this.materialProgram.program;
478
+ t.uniform1i(S(t, i, "u_state"), 0), t.uniform1i(S(t, i, "u_background"), 1), t.uniform1i(S(t, i, "u_causticMap"), 2), t.uniform2f(S(t, i, "u_texel"), 1 / this.simWidth, 1 / this.simHeight), t.uniform1f(S(t, i, "u_domMode"), e.mode === "dom" ? 1 : 0), t.uniform1f(S(t, i, "u_normalScale"), e.normalScale), t.uniform1f(S(t, i, "u_refractionStrength"), e.refractionStrength), t.uniform1f(S(t, i, "u_specularIntensity"), e.specularIntensity), t.uniform1f(S(t, i, "u_crestIntensity"), e.crestIntensity), t.uniform1f(S(t, i, "u_causticIntensity"), e.causticIntensity), t.uniform1f(S(t, i, "u_time"), n % 1e3);
496
479
  }
497
480
  }
498
481
  function nt() {
499
482
  const r = new Uint8Array(C * C * 4);
500
483
  for (let e = 0; e < C; e += 1)
501
- for (let t = 0; t < C; t += 1) {
502
- const n = (t + 0.5) / C, i = (e + 0.5) / C, a = Math.round(ce(n, i, 0) * 255), l = Math.round(ce(n, i, 11) * 255), c = Math.round(ce(n, i, 23) * 255), s = Math.round(ce(n, i, 37) * 255), d = (e * C + t) * 4;
484
+ for (let n = 0; n < C; n += 1) {
485
+ const t = (n + 0.5) / C, i = (e + 0.5) / C, a = Math.round(ce(t, i, 0) * 255), l = Math.round(ce(t, i, 11) * 255), c = Math.round(ce(t, i, 23) * 255), s = Math.round(ce(t, i, 37) * 255), d = (e * C + n) * 4;
503
486
  r[d] = a, r[d + 1] = l, r[d + 2] = c, r[d + 3] = s;
504
487
  }
505
488
  return r;
506
489
  }
507
- function ce(r, e, t) {
508
- const n = Math.sin(se * (e * 2 + t * 0.013)) * 0.12 + Math.sin(se * (r * 3 + e + t * 0.021)) * 0.06, i = Math.cos(se * (r * 2 + t * 0.017)) * 0.12 + Math.sin(se * (e * 3 - r + t * 0.019)) * 0.06, a = r * oe + n, l = e * oe + i, c = Math.floor(a), s = Math.floor(l);
509
- let d = Number.POSITIVE_INFINITY, E = Number.POSITIVE_INFINITY, _ = 0, m = 0;
490
+ function ce(r, e, n) {
491
+ const t = Math.sin(se * (e * 2 + n * 0.013)) * 0.12 + Math.sin(se * (r * 3 + e + n * 0.021)) * 0.06, i = Math.cos(se * (r * 2 + n * 0.017)) * 0.12 + Math.sin(se * (e * 3 - r + n * 0.019)) * 0.06, a = r * oe + t, l = e * oe + i, c = Math.floor(a), s = Math.floor(l);
492
+ let d = Number.POSITIVE_INFINITY, E = Number.POSITIVE_INFINITY, p = 0, m = 0;
510
493
  for (let P = -1; P <= 1; P += 1)
511
- for (let U = -1; U <= 1; U += 1) {
512
- const k = c + U, B = s + P, M = Ie(k, oe), I = Ie(B, oe), z = k + 0.16 + me(M, I, t) * 0.68, N = B + 0.16 + me(M, I, t + 1) * 0.68, D = Math.hypot(a - z, l - N);
513
- D < d ? (E = d, d = D, _ = M, m = I) : D < E && (E = D);
494
+ for (let D = -1; D <= 1; D += 1) {
495
+ const k = c + D, B = s + P, M = Ie(k, oe), I = Ie(B, oe), z = k + 0.16 + me(M, I, n) * 0.68, N = B + 0.16 + me(M, I, n + 1) * 0.68, U = Math.hypot(a - z, l - N);
496
+ U < d ? (E = d, d = U, p = M, m = I) : U < E && (E = U);
514
497
  }
515
- const v = E - d, A = 1 - Fe(0.025, 0.13, v), w = 1 - Fe(0.08, 0.34, v), W = 0.74 + me(_, m, t + 2) * 0.26, H = A * A * 0.58 + w * 0.34;
498
+ const v = E - d, A = 1 - Fe(0.025, 0.13, v), w = 1 - Fe(0.08, 0.34, v), W = 0.74 + me(p, m, n + 2) * 0.26, H = A * A * 0.58 + w * 0.34;
516
499
  return We(Math.pow(H * W, 1.12));
517
500
  }
518
- function me(r, e, t) {
519
- const n = Math.sin(r * 127.1 + e * 311.7 + t * 74.7) * 43758.5453123;
520
- return n - Math.floor(n);
501
+ function me(r, e, n) {
502
+ const t = Math.sin(r * 127.1 + e * 311.7 + n * 74.7) * 43758.5453123;
503
+ return t - Math.floor(t);
521
504
  }
522
505
  function Ie(r, e) {
523
506
  return (r % e + e) % e;
524
507
  }
525
- function Fe(r, e, t) {
526
- const n = We((t - r) / (e - r));
527
- return n * n * (3 - n * 2);
508
+ function Fe(r, e, n) {
509
+ const t = We((n - r) / (e - r));
510
+ return t * t * (3 - t * 2);
528
511
  }
529
512
  function We(r) {
530
513
  return Math.min(1, Math.max(0, r));
@@ -537,33 +520,33 @@ function it(r) {
537
520
  stencil: !1,
538
521
  premultipliedAlpha: !1,
539
522
  preserveDrawingBuffer: !1
540
- }, t = r.getContext("webgl2", e);
541
- if (t) {
542
- if (!t.getExtension("EXT_color_buffer_float"))
523
+ }, n = r.getContext("webgl2", e);
524
+ if (n) {
525
+ if (!n.getExtension("EXT_color_buffer_float"))
543
526
  throw new Error("WaterDistortion requires float render targets.");
544
527
  return {
545
- gl: t,
528
+ gl: n,
546
529
  isWebGL2: !0,
547
- canLinearFloat: !!t.getExtension("OES_texture_float_linear")
530
+ canLinearFloat: !!n.getExtension("OES_texture_float_linear")
548
531
  };
549
532
  }
550
- const n = r.getContext("webgl", e) || r.getContext(
533
+ const t = r.getContext("webgl", e) || r.getContext(
551
534
  "experimental-webgl",
552
535
  e
553
536
  );
554
- if (!n)
537
+ if (!t)
555
538
  throw new Error("WaterDistortion requires WebGL.");
556
- if (!n.getExtension("OES_texture_float") || !n.getExtension("WEBGL_color_buffer_float") && !n.getExtension("EXT_color_buffer_float"))
539
+ if (!t.getExtension("OES_texture_float") || !t.getExtension("WEBGL_color_buffer_float") && !t.getExtension("EXT_color_buffer_float"))
557
540
  throw new Error("WaterDistortion requires float texture support.");
558
541
  return {
559
- gl: n,
542
+ gl: t,
560
543
  isWebGL2: !1,
561
- canLinearFloat: !!n.getExtension("OES_texture_float_linear")
544
+ canLinearFloat: !!t.getExtension("OES_texture_float_linear")
562
545
  };
563
546
  }
564
- function Le(r, e, t) {
565
- const n = ke(r, r.VERTEX_SHADER, e), i = ke(r, r.FRAGMENT_SHADER, t), a = q(r.createProgram(), "WebGL program");
566
- if (r.attachShader(a, n), r.attachShader(a, i), r.linkProgram(a), r.deleteShader(n), r.deleteShader(i), !r.getProgramParameter(a, r.LINK_STATUS)) {
547
+ function Le(r, e, n) {
548
+ const t = ke(r, r.VERTEX_SHADER, e), i = ke(r, r.FRAGMENT_SHADER, n), a = q(r.createProgram(), "WebGL program");
549
+ if (r.attachShader(a, t), r.attachShader(a, i), r.linkProgram(a), r.deleteShader(t), r.deleteShader(i), !r.getProgramParameter(a, r.LINK_STATUS)) {
567
550
  const c = r.getProgramInfoLog(a) || "Unknown shader link error.";
568
551
  throw r.deleteProgram(a), new Error(c);
569
552
  }
@@ -572,19 +555,19 @@ function Le(r, e, t) {
572
555
  throw new Error("WaterDistortion could not bind its quad attribute.");
573
556
  return { program: a, position: l };
574
557
  }
575
- function ke(r, e, t) {
576
- const n = q(r.createShader(e), "WebGL shader");
577
- if (r.shaderSource(n, t), r.compileShader(n), !r.getShaderParameter(n, r.COMPILE_STATUS)) {
578
- const i = r.getShaderInfoLog(n) || "Unknown shader compile error.";
579
- throw r.deleteShader(n), new Error(i);
558
+ function ke(r, e, n) {
559
+ const t = q(r.createShader(e), "WebGL shader");
560
+ if (r.shaderSource(t, n), r.compileShader(t), !r.getShaderParameter(t, r.COMPILE_STATUS)) {
561
+ const i = r.getShaderInfoLog(t) || "Unknown shader compile error.";
562
+ throw r.deleteShader(t), new Error(i);
580
563
  }
581
- return n;
564
+ return t;
582
565
  }
583
- function p(r, e, t) {
584
- const n = r.getUniformLocation(e, t);
585
- if (!n)
586
- throw new Error(`WaterDistortion could not bind uniform ${t}.`);
587
- return n;
566
+ function S(r, e, n) {
567
+ const t = r.getUniformLocation(e, n);
568
+ if (!t)
569
+ throw new Error(`WaterDistortion could not bind uniform ${n}.`);
570
+ return t;
588
571
  }
589
572
  function q(r, e) {
590
573
  if (!r)
@@ -594,18 +577,18 @@ function q(r, e) {
594
577
  function at(r) {
595
578
  return typeof HTMLCanvasElement < "u" && r instanceof HTMLCanvasElement || typeof HTMLVideoElement < "u" && r instanceof HTMLVideoElement || typeof OffscreenCanvas < "u" && r instanceof OffscreenCanvas;
596
579
  }
597
- function ot(r, e, t, n = Je) {
598
- const i = Math.max(0, Math.floor(e)), a = Math.max(0, Math.floor(t));
580
+ function ot(r, e, n, t = Je) {
581
+ const i = Math.max(0, Math.floor(e)), a = Math.max(0, Math.floor(n));
599
582
  if (i === 0 || a === 0)
600
583
  return !1;
601
584
  const l = (c, s) => r[(s * i + c) * 4] ?? 0;
602
585
  for (let c = 0; c < a; c += 1)
603
586
  for (let s = 0; s < i; s += 1) {
604
- const d = (c * i + s) * 4, E = r[d] ?? 0, _ = r[d + 1] ?? 0;
605
- if (E < -n.trough || Math.abs(_) > n.velocity)
587
+ const d = (c * i + s) * 4, E = r[d] ?? 0, p = r[d + 1] ?? 0;
588
+ if (E < -t.trough || Math.abs(p) > t.velocity)
606
589
  return !0;
607
590
  const m = s > 0 ? l(s - 1, c) : E, v = s < i - 1 ? l(s + 1, c) : E, A = c > 0 ? l(s, c - 1) : E, w = c < a - 1 ? l(s, c + 1) : E, W = Math.hypot(v - m, w - A), H = Math.abs(m + v + A + w - E * 4);
608
- if (W > n.gradient || H > n.curvature)
591
+ if (W > t.gradient || H > t.curvature)
609
592
  return !0;
610
593
  }
611
594
  return !1;
@@ -665,8 +648,8 @@ function ge(r) {
665
648
  )
666
649
  };
667
650
  }
668
- function Ue(r, e, t = r.timeStamp) {
669
- const n = typeof r.getCoalescedEvents == "function" ? r.getCoalescedEvents() : [], i = n.length > 0 ? n : [r], a = t - r.timeStamp;
651
+ function De(r, e, n = r.timeStamp) {
652
+ const t = typeof r.getCoalescedEvents == "function" ? r.getCoalescedEvents() : [], i = t.length > 0 ? t : [r], a = n - r.timeStamp;
670
653
  return i.map((l) => ({
671
654
  x: l.clientX - e.left,
672
655
  y: l.clientY - e.top,
@@ -692,14 +675,14 @@ class ct {
692
675
  }
693
676
  addSample(e) {
694
677
  this.disturbances.length = 0;
695
- const t = this.clampSample(e), n = this.previous;
696
- if (!n)
697
- return this.previous = t, this.disturbances;
698
- t.time <= n.time && (t.time = n.time + 0.01);
699
- const i = this.smoothSample(n, t), a = Ze(n, i);
678
+ const n = this.clampSample(e), t = this.previous;
679
+ if (!t)
680
+ return this.previous = n, this.disturbances;
681
+ n.time <= t.time && (n.time = t.time + 0.01);
682
+ const i = this.smoothSample(t, n), a = Ze(t, i);
700
683
  if (a < 0.35)
701
684
  return this.previous = i, this.disturbances;
702
- const l = a / Math.max(0.01, i.time - n.time), c = h(1 - this.options.cursorSmoothing, 0.12, 1);
685
+ const l = a / Math.max(0.01, i.time - t.time), c = h(1 - this.options.cursorSmoothing, 0.12, 1);
703
686
  this.smoothedVelocity = O(
704
687
  this.smoothedVelocity,
705
688
  l,
@@ -710,11 +693,11 @@ class ct {
710
693
  Math.max(1, Math.ceil(a / this.options.segmentSpacing))
711
694
  );
712
695
  for (let d = 0; d < s; d += 1) {
713
- const E = d / s, _ = (d + 1) / s;
696
+ const E = d / s, p = (d + 1) / s;
714
697
  this.disturbances.push(
715
698
  ve(
716
- De(n, i, E),
717
- De(n, i, _),
699
+ Ue(t, i, E),
700
+ Ue(t, i, p),
718
701
  this.smoothedVelocity,
719
702
  this.options
720
703
  )
@@ -729,18 +712,18 @@ class ct {
729
712
  time: e.time
730
713
  };
731
714
  }
732
- smoothSample(e, t) {
733
- const n = 1 - this.options.cursorSmoothing;
715
+ smoothSample(e, n) {
716
+ const t = 1 - this.options.cursorSmoothing;
734
717
  return {
735
- x: O(e.x, t.x, n),
736
- y: O(e.y, t.y, n),
737
- time: t.time
718
+ x: O(e.x, n.x, t),
719
+ y: O(e.y, n.y, t),
720
+ time: n.time
738
721
  };
739
722
  }
740
723
  }
741
- function ve(r, e, t, n) {
742
- const i = ge(n), a = h(
743
- t * i.velocityScale / i.velocityClamp,
724
+ function ve(r, e, n, t) {
725
+ const i = ge(t), a = h(
726
+ n * i.velocityScale / i.velocityClamp,
744
727
  0,
745
728
  1
746
729
  ), l = h(r.y / i.height, 0, 1), c = h(e.y / i.height, 0, 1), s = i.wakeLength * O(0.55, 1.35, a);
@@ -758,16 +741,16 @@ function ve(r, e, t, n) {
758
741
  velocity: a
759
742
  };
760
743
  }
761
- function De(r, e, t) {
744
+ function Ue(r, e, n) {
762
745
  return {
763
- x: O(r.x, e.x, t),
764
- y: O(r.y, e.y, t),
765
- time: O(r.time, e.time, t)
746
+ x: O(r.x, e.x, n),
747
+ y: O(r.y, e.y, n),
748
+ time: O(r.time, e.time, n)
766
749
  };
767
750
  }
768
751
  function ut(r) {
769
- const e = h(r, 0.85, 0.998), t = Math.ceil(Math.log(0.012) / Math.log(e));
770
- return h(t * (1e3 / 60), 900, 5200);
752
+ const e = h(r, 0.85, 0.998), n = Math.ceil(Math.log(0.012) / Math.log(e));
753
+ return h(n * (1e3 / 60), 900, 5200);
771
754
  }
772
755
  const x = {
773
756
  mode: "texture",
@@ -898,66 +881,66 @@ function ft(r) {
898
881
  pauseKey: r.pauseKey || x.pauseKey
899
882
  };
900
883
  }
901
- function Ce(r, e, t) {
902
- const n = h(r.x, 0, 1) * t.width, i = h(r.y, 0, 1) * t.height, a = Math.max(0.5, e.interactionRadius * 0.08), l = e.velocityClamp / e.velocityScale, c = {
884
+ function Ce(r, e, n) {
885
+ const t = h(r.x, 0, 1) * n.width, i = h(r.y, 0, 1) * n.height, a = Math.max(0.5, e.interactionRadius * 0.08), l = e.velocityClamp / e.velocityScale, c = {
903
886
  ...e,
904
- width: t.width,
905
- height: t.height,
887
+ width: n.width,
888
+ height: n.height,
906
889
  wakeLength: e.interactionRadius * 1.5
907
890
  };
908
891
  return [
909
892
  ve(
910
- { x: n - a, y: i },
911
- { x: n + a, y: i },
893
+ { x: t - a, y: i },
894
+ { x: t + a, y: i },
912
895
  l,
913
896
  c
914
897
  ),
915
898
  ve(
916
- { x: n, y: i - a },
917
- { x: n, y: i + a },
899
+ { x: t, y: i - a },
900
+ { x: t, y: i + a },
918
901
  l,
919
902
  c
920
903
  )
921
904
  ];
922
905
  }
923
906
  function mt(r) {
924
- const [e, t] = je(!1);
907
+ const [e, n] = je(!1);
925
908
  return V(() => {
926
909
  if (!r || typeof window > "u" || !window.matchMedia) {
927
- t(!1);
910
+ n(!1);
928
911
  return;
929
912
  }
930
- const n = window.matchMedia("(prefers-reduced-motion: reduce)");
931
- t(n.matches);
913
+ const t = window.matchMedia("(prefers-reduced-motion: reduce)");
914
+ n(t.matches);
932
915
  const i = (a) => {
933
- t(a.matches);
916
+ n(a.matches);
934
917
  };
935
- return n.addEventListener("change", i), () => {
936
- n.removeEventListener("change", i);
918
+ return t.addEventListener("change", i), () => {
919
+ t.removeEventListener("change", i);
937
920
  };
938
921
  }, [r]), e;
939
922
  }
940
- const gt = $e(function(e, t) {
923
+ const gt = $e(function(e, n) {
941
924
  const {
942
- underlay: n,
925
+ underlay: t,
943
926
  children: i,
944
927
  foreground: a,
945
928
  className: l,
946
929
  style: c,
947
930
  reducedMotion: s = "respect"
948
- } = e, d = y(null), E = y(null), _ = y(null), m = y(new ct()), v = y(null), A = y(null), w = y(() => {
931
+ } = e, d = y(null), E = y(null), p = y(null), m = y(new ct()), v = y(null), A = y(null), w = y(() => {
949
932
  }), W = y(() => {
950
933
  }), H = y(() => {
951
- }), P = y([]), U = y(!0), k = y(!0), B = y(!1), M = y(!1), I = y(null), z = y(0), N = y(0), D = y(0), R = ft(e), g = y(R), $ = y({ width: 1, height: 1 }), Ne = mt(
934
+ }), P = y([]), D = y(!0), k = y(!0), B = y(!1), M = y(!1), I = y(null), z = y(0), N = y(0), U = y(0), R = ft(e), g = y(R), $ = y({ width: 1, height: 1 }), Ne = mt(
952
935
  s === "respect"
953
936
  ), ue = s === "disable" || s === "respect" && Ne, Xe = a ?? i;
954
937
  g.current = R, Qe(
955
- t,
938
+ n,
956
939
  () => ({
957
- triggerRipple(S) {
940
+ triggerRipple(_) {
958
941
  B.current || M.current || H.current(
959
942
  Ce(
960
- S,
943
+ _,
961
944
  g.current,
962
945
  $.current
963
946
  )
@@ -966,19 +949,19 @@ const gt = $e(function(e, t) {
966
949
  }),
967
950
  []
968
951
  ), V(() => {
969
- var S;
970
- B.current = ue, ue && (m.current.reset(), I.current = null, P.current = [], z.current = 0, N.current = 0, D.current = 0, (S = _.current) == null || S.clear()), w.current();
952
+ var _;
953
+ B.current = ue, ue && (m.current.reset(), I.current = null, P.current = [], z.current = 0, N.current = 0, U.current = 0, (_ = p.current) == null || _.clear()), w.current();
971
954
  }, [ue]), V(() => {
972
- const S = _.current;
973
- if (!S)
955
+ const _ = p.current;
956
+ if (!_)
974
957
  return;
975
958
  const { width: K, height: b } = $.current;
976
- S.resize(
959
+ _.resize(
977
960
  K,
978
961
  b,
979
962
  window.devicePixelRatio,
980
963
  R.simulationResolution
981
- ), S.setTextureSource(R.texture), w.current();
964
+ ), _.setTextureSource(R.texture), w.current();
982
965
  }, [
983
966
  R.mode,
984
967
  R.texture,
@@ -991,8 +974,8 @@ const gt = $e(function(e, t) {
991
974
  R.causticIntensity,
992
975
  R.simulationResolution
993
976
  ]), V(() => {
994
- const S = d.current, K = E.current;
995
- if (!S || !K)
977
+ const _ = d.current, K = E.current;
978
+ if (!_ || !K)
996
979
  return;
997
980
  k.current = typeof document.hasFocus == "function" ? document.hasFocus() : !0;
998
981
  let b = null, ie, ee = G, xe = !1, te;
@@ -1021,7 +1004,7 @@ const gt = $e(function(e, t) {
1021
1004
  window.devicePixelRatio,
1022
1005
  g.current.simulationResolution
1023
1006
  );
1024
- }, pe = () => {
1007
+ }, Ee = () => {
1025
1008
  b == null || b.render(g.current, performance.now() * 1e-3);
1026
1009
  }, X = () => {
1027
1010
  ie = void 0, ee = G;
@@ -1030,19 +1013,19 @@ const gt = $e(function(e, t) {
1030
1013
  }, Q = () => {
1031
1014
  const o = g.current;
1032
1015
  let u = !1;
1033
- if (!(!B.current && !M.current && U.current && (o.runInBackground || !document.hidden && k.current))) {
1016
+ if (!(!B.current && !M.current && D.current && (o.runInBackground || !document.hidden && k.current))) {
1034
1017
  X();
1035
1018
  return;
1036
1019
  }
1037
1020
  if (te !== void 0) {
1038
1021
  const T = performance.now() - te;
1039
- z.current += T, N.current += T, D.current += T, te = void 0, u = !0;
1022
+ z.current += T, N.current += T, U.current += T, te = void 0, u = !0;
1040
1023
  }
1041
- (!o.runInBackground || u) && X(), pe(), w.current();
1042
- }, Ee = (o) => {
1024
+ (!o.runInBackground || u) && X(), Ee(), w.current();
1025
+ }, pe = (o) => {
1043
1026
  v.current = null;
1044
1027
  const u = g.current;
1045
- if (!b || M.current || !U.current || !u.runInBackground && (document.hidden || !k.current)) {
1028
+ if (!b || M.current || !D.current || !u.runInBackground && (document.hidden || !k.current)) {
1046
1029
  X();
1047
1030
  return;
1048
1031
  }
@@ -1074,25 +1057,27 @@ const gt = $e(function(e, t) {
1074
1057
  o < N.current ? w.current() : X();
1075
1058
  return;
1076
1059
  }
1077
- if (o < D.current) {
1060
+ if (o < U.current) {
1078
1061
  w.current();
1079
1062
  return;
1080
1063
  }
1081
1064
  try {
1082
- b.hasVisibleActivity() ? (D.current = o + ht, w.current()) : X();
1065
+ b.hasVisibleActivity() ? (U.current = o + ht, w.current()) : X();
1083
1066
  } catch {
1084
1067
  xe = !0, o < N.current ? w.current() : X();
1085
1068
  }
1086
1069
  }, le = () => {
1087
1070
  M.current || v.current !== null || A.current !== null || (g.current.runInBackground && document.hidden ? A.current = window.setTimeout(() => {
1088
- A.current = null, Ee(performance.now());
1089
- }, G) : v.current = window.requestAnimationFrame(Ee));
1071
+ A.current = null, pe(performance.now());
1072
+ }, G) : v.current = window.requestAnimationFrame(pe));
1090
1073
  };
1091
1074
  w.current = le;
1092
1075
  try {
1093
- b = new rt(K), _.current = b, b.setTextureSource(g.current.texture);
1076
+ b = new rt(K, () => {
1077
+ w.current();
1078
+ }), p.current = b, b.setTextureSource(g.current.texture);
1094
1079
  } catch {
1095
- return K.style.display = "none", _.current = null, w.current = () => {
1080
+ return K.style.display = "none", p.current = null, w.current = () => {
1096
1081
  }, () => {
1097
1082
  };
1098
1083
  }
@@ -1100,7 +1085,7 @@ const gt = $e(function(e, t) {
1100
1085
  const o = K.getBoundingClientRect();
1101
1086
  return He(o.width, o.height), o;
1102
1087
  }, ze = () => {
1103
- ae(), pe();
1088
+ ae(), Ee();
1104
1089
  }, he = (o) => {
1105
1090
  if (M.current || o.length === 0)
1106
1091
  return;
@@ -1112,15 +1097,15 @@ const gt = $e(function(e, t) {
1112
1097
  z.current = Math.max(z.current, T), N.current = Math.max(
1113
1098
  N.current,
1114
1099
  T + ut(g.current.damping)
1115
- ), D.current = 0, le();
1100
+ ), U.current = 0, le();
1116
1101
  };
1117
1102
  H.current = he;
1118
1103
  const _e = (o) => {
1119
1104
  const u = g.current;
1120
- if (B.current || M.current || !U.current || u.interactionMode === "event" || !u.runInBackground && (document.hidden || !k.current) || o.pointerType === "touch" && !o.isPrimary)
1105
+ if (B.current || M.current || !D.current || u.interactionMode === "event" || !u.runInBackground && (document.hidden || !k.current) || o.pointerType === "touch" && !o.isPrimary)
1121
1106
  return;
1122
1107
  m.current.reset();
1123
- const F = ae(), [T] = Ue(o, F, performance.now());
1108
+ const F = ae(), [T] = De(o, F, performance.now());
1124
1109
  T && ((u.interactionMode === "click" || u.interactionMode === "drag") && he(
1125
1110
  Ce(
1126
1111
  {
@@ -1133,9 +1118,9 @@ const gt = $e(function(e, t) {
1133
1118
  ), u.interactionMode === "drag" ? (I.current = o.pointerId, m.current.addSample(T)) : u.interactionMode === "move" && m.current.addSample(T));
1134
1119
  }, Se = (o) => {
1135
1120
  const u = g.current;
1136
- if (B.current || M.current || !U.current || u.interactionMode !== "move" && (u.interactionMode !== "drag" || I.current !== o.pointerId) || !u.runInBackground && (document.hidden || !k.current) || o.pointerType === "touch" && !o.isPrimary)
1121
+ if (B.current || M.current || !D.current || u.interactionMode !== "move" && (u.interactionMode !== "drag" || I.current !== o.pointerId) || !u.runInBackground && (document.hidden || !k.current) || o.pointerType === "touch" && !o.isPrimary)
1137
1122
  return;
1138
- const F = ae(), T = Ue(o, F, performance.now());
1123
+ const F = ae(), T = De(o, F, performance.now());
1139
1124
  for (const Z of T)
1140
1125
  he(m.current.addSample(Z));
1141
1126
  }, j = (o) => {
@@ -1160,20 +1145,20 @@ const gt = $e(function(e, t) {
1160
1145
  let ne;
1161
1146
  return "IntersectionObserver" in window && (ne = new IntersectionObserver((o) => {
1162
1147
  const u = o[0];
1163
- U.current = u ? u.isIntersecting : !0, U.current ? Q() : re();
1164
- }), ne.observe(S)), S.addEventListener("pointerdown", _e, {
1148
+ D.current = u ? u.isIntersecting : !0, D.current ? Q() : re();
1149
+ }), ne.observe(_)), _.addEventListener("pointerdown", _e, {
1165
1150
  passive: !0
1166
- }), S.addEventListener("pointermove", Se, {
1151
+ }), _.addEventListener("pointermove", Se, {
1167
1152
  passive: !0
1168
- }), S.addEventListener("pointerup", j, {
1153
+ }), _.addEventListener("pointerup", j, {
1169
1154
  passive: !0
1170
- }), S.addEventListener("pointerleave", j, {
1155
+ }), _.addEventListener("pointerleave", j, {
1171
1156
  passive: !0
1172
- }), S.addEventListener("pointercancel", j, {
1157
+ }), _.addEventListener("pointercancel", j, {
1173
1158
  passive: !0
1174
1159
  }), window.addEventListener("blur", Re), window.addEventListener("focus", we), document.addEventListener("keydown", Te), document.addEventListener("visibilitychange", ye), () => {
1175
1160
  var o;
1176
- Y(), Me.disconnect(), ne == null || ne.disconnect(), S.removeEventListener("pointerdown", _e), S.removeEventListener("pointermove", Se), S.removeEventListener("pointerup", j), S.removeEventListener("pointerleave", j), S.removeEventListener("pointercancel", j), window.removeEventListener("blur", Re), window.removeEventListener("focus", we), document.removeEventListener("keydown", Te), document.removeEventListener("visibilitychange", ye), (o = _.current) == null || o.dispose(), _.current = null, w.current = () => {
1161
+ Y(), Me.disconnect(), ne == null || ne.disconnect(), _.removeEventListener("pointerdown", _e), _.removeEventListener("pointermove", Se), _.removeEventListener("pointerup", j), _.removeEventListener("pointerleave", j), _.removeEventListener("pointercancel", j), window.removeEventListener("blur", Re), window.removeEventListener("focus", we), document.removeEventListener("keydown", Te), document.removeEventListener("visibilitychange", ye), (o = p.current) == null || o.dispose(), p.current = null, w.current = () => {
1177
1162
  }, W.current = () => {
1178
1163
  }, H.current = () => {
1179
1164
  };
@@ -1192,7 +1177,7 @@ const gt = $e(function(e, t) {
1192
1177
  isolation: "isolate"
1193
1178
  };
1194
1179
  return /* @__PURE__ */ qe("div", { ref: d, className: l, style: Ge, children: [
1195
- n ? /* @__PURE__ */ de(
1180
+ t ? /* @__PURE__ */ de(
1196
1181
  "div",
1197
1182
  {
1198
1183
  style: {
@@ -1202,7 +1187,7 @@ const gt = $e(function(e, t) {
1202
1187
  pointerEvents: "none",
1203
1188
  transform: "translateZ(0)"
1204
1189
  },
1205
- children: n
1190
+ children: t
1206
1191
  }
1207
1192
  ) : null,
1208
1193
  /* @__PURE__ */ de(
@@ -1232,9 +1217,9 @@ const gt = $e(function(e, t) {
1232
1217
  }
1233
1218
  )
1234
1219
  ] });
1235
- }), Et = gt;
1220
+ }), pt = gt;
1236
1221
  export {
1237
1222
  gt as WaterDistortion,
1238
- Et as WaterLayer
1223
+ pt as WaterLayer
1239
1224
  };
1240
1225
  //# sourceMappingURL=water-distortion.js.map