@tsogtoodev/shingen-metal 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,41 +1,41 @@
1
- import { defineComponent as gt, ref as Y, computed as ue, watch as z, onMounted as Qe, nextTick as Ce, onBeforeUnmount as Je, openBlock as xt, createElementBlock as vt, normalizeStyle as ke, unref as bt, createElementVNode as te, renderSlot as wt, toValue as yt } from "vue";
2
- function _t(e) {
3
- let t = e.replace("#", "");
4
- return t.length === 3 && (t = t[0] + t[0] + t[1] + t[1] + t[2] + t[2]), [parseInt(t.slice(0, 2), 16) / 255, parseInt(t.slice(2, 4), 16) / 255, parseInt(t.slice(4, 6), 16) / 255];
5
- }
6
- function Mt(e, t, a) {
7
- e /= 255, t /= 255, a /= 255;
8
- const n = Math.max(e, t, a), o = Math.min(e, t, a), r = n - o;
1
+ import { defineComponent as ge, ref as V, computed as ut, watch as D, onMounted as Qt, nextTick as Tt, onBeforeUnmount as Zt, openBlock as xe, createElementBlock as ve, normalizeStyle as Et, unref as _e, createElementVNode as et, renderSlot as be, toValue as we } from "vue";
2
+ function ye(t) {
3
+ let e = t.replace("#", "");
4
+ return e.length === 3 && (e = e[0] + e[0] + e[1] + e[1] + e[2] + e[2]), [parseInt(e.slice(0, 2), 16) / 255, parseInt(e.slice(2, 4), 16) / 255, parseInt(e.slice(4, 6), 16) / 255];
5
+ }
6
+ function Me(t, e, o) {
7
+ t /= 255, e /= 255, o /= 255;
8
+ const n = Math.max(t, e, o), a = Math.min(t, e, o), r = n - a;
9
9
  let s = 0;
10
10
  const c = n === 0 ? 0 : r / n;
11
- return r !== 0 && (n === e ? s = ((t - a) / r + 6) % 6 : n === t ? s = (a - e) / r + 2 : s = (e - t) / r + 4, s /= 6), [s, c, n];
11
+ return r !== 0 && (n === t ? s = ((e - o) / r + 6) % 6 : n === e ? s = (o - t) / r + 2 : s = (t - e) / r + 4, s /= 6), [s, c, n];
12
12
  }
13
- function St(e, t, a) {
14
- const n = Math.floor(e * 6), o = e * 6 - n, r = a * (1 - t), s = a * (1 - o * t), c = a * (1 - (1 - o) * t);
15
- let l = 0, d = 0, f = 0;
13
+ function Re(t, e, o) {
14
+ const n = Math.floor(t * 6), a = t * 6 - n, r = o * (1 - e), s = o * (1 - a * e), c = o * (1 - (1 - a) * e);
15
+ let l = 0, f = 0, d = 0;
16
16
  switch (n % 6) {
17
17
  case 0:
18
- l = a, d = c, f = r;
18
+ l = o, f = c, d = r;
19
19
  break;
20
20
  case 1:
21
- l = s, d = a, f = r;
21
+ l = s, f = o, d = r;
22
22
  break;
23
23
  case 2:
24
- l = r, d = a, f = c;
24
+ l = r, f = o, d = c;
25
25
  break;
26
26
  case 3:
27
- l = r, d = s, f = a;
27
+ l = r, f = s, d = o;
28
28
  break;
29
29
  case 4:
30
- l = c, d = r, f = a;
30
+ l = c, f = r, d = o;
31
31
  break;
32
32
  case 5:
33
- l = a, d = r, f = s;
33
+ l = o, f = r, d = s;
34
34
  break;
35
35
  }
36
- return [Math.round(l * 255), Math.round(d * 255), Math.round(f * 255)];
36
+ return [Math.round(l * 255), Math.round(f * 255), Math.round(d * 255)];
37
37
  }
38
- const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot = 2, It = {
38
+ const Ae = 66, Se = 66, Ce = 1500, Te = 1, kt = 16, Ee = 16, ke = 8, Ie = 96, Le = 2, Oe = {
39
39
  name: "chromatic",
40
40
  modes: {
41
41
  dark: {
@@ -71,7 +71,7 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
71
71
  shaderOpacity: 1
72
72
  }
73
73
  }
74
- }, Pt = {
74
+ }, Pe = {
75
75
  name: "silver",
76
76
  modes: {
77
77
  dark: {
@@ -107,7 +107,7 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
107
107
  shaderOpacity: 1
108
108
  }
109
109
  }
110
- }, Ft = {
110
+ }, Fe = {
111
111
  name: "gold",
112
112
  modes: {
113
113
  dark: {
@@ -143,19 +143,14 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
143
143
  shaderOpacity: 1
144
144
  }
145
145
  }
146
- }, Ze = {
147
- chromatic: It,
148
- silver: Pt,
149
- gold: Ft
150
- }, $t = (
151
- /* glsl */
152
- `
146
+ }, Jt = {
147
+ chromatic: Oe,
148
+ silver: Pe,
149
+ gold: Fe
150
+ }, $e = `
153
151
  attribute vec2 a_position;
154
152
  void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
155
- `
156
- ), Ht = (
157
- /* glsl */
158
- `
153
+ `, He = `
159
154
  precision highp float;
160
155
 
161
156
  uniform vec2 u_resolution;
@@ -207,8 +202,6 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
207
202
 
208
203
  float nfbm(vec2 p) { return fbm(p, 3.0 + u_complexity * 4.0); }
209
204
 
210
- /* 5-stop palette used by effect 1 (Plasma) — direct port of \`palette\` from
211
- * the canonical engine. Stops at t = 0, 0.25, 0.5, 0.75, 1.0. */
212
205
  vec3 palette(float t) {
213
206
  t = clamp(t, 0.0, 1.0);
214
207
  t = t * t * (3.0 - 2.0 * t);
@@ -223,10 +216,6 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
223
216
  u_color4 * w4 + u_color5 * w5) / total;
224
217
  }
225
218
 
226
- /* Per-pixel alpha that re-introduces transparency when the user dials any
227
- * palette stop's alpha below 1. Same \`paletteAlpha\` from the canonical
228
- * engine. With every preset shipping all-1 alphas, this returns ~1 for every
229
- * pixel — but mirroring it keeps custom-preset behaviour identical. */
230
219
  float paletteAlpha(float t) {
231
220
  t = clamp(t, 0.0, 1.0);
232
221
  t = t * t * (3.0 - 2.0 * t);
@@ -254,8 +243,6 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
254
243
  ) * str;
255
244
  }
256
245
 
257
- /* Plasma: four sine bands warped by an FBM field, mapped through the
258
- * 5-stop palette. Identical to effect 1 in the canonical engine. */
259
246
  vec3 computeEffect(vec2 uv, float aspect, float t, float dist, float cpx) {
260
247
  vec2 p = (uv - 0.5) * u_scale;
261
248
  p.x *= aspect;
@@ -277,15 +264,10 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
277
264
  void main() {
278
265
  vec2 uv = gl_FragCoord.xy / u_resolution;
279
266
  float aspect = u_resolution.x / u_resolution.y;
280
- float t = u_time; // JS already multiplied u_time by preset.speed.
267
+ float t = u_time;
281
268
  float dist = u_distortion;
282
269
  float cpx = u_complexity;
283
270
 
284
- /* 5-tap cross blur (center + cardinal offsets). The chromatic/silver/gold
285
- * presets all ship with blur=1 so this path is always active. 5 taps
286
- * instead of the canonical engine's 9 saves ~44% fragment work; the
287
- * perceptual difference is nil because the output is already soft from
288
- * the plasma's low spatial frequency and CSS blur on reflections. */
289
271
  vec3 col;
290
272
  if (u_blur < 0.01) {
291
273
  col = computeEffect(uv, aspect, t, dist, cpx);
@@ -298,13 +280,8 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
298
280
  col += computeEffect(uv + vec2(0.0, -r), aspect, t, dist, cpx) * 0.15;
299
281
  }
300
282
 
301
- /* Gamma punch — adds the contrast pop that defines the chromatic
302
- * highlights. From the canonical engine: \`col = pow(col, vec3(1.3))\`. */
303
283
  col = pow(col, vec3(1.3));
304
284
 
305
- /* Vignette — soft edge darkening so corners read as recessed. The 40-px
306
- * scale at the bottom of the formula is hard-coded in the canonical
307
- * engine; we keep it for visual parity. */
308
285
  float edgeDist = min(min(uv.x, 1.0 - uv.x), min(uv.y, 1.0 - uv.y));
309
286
  float vigPx = 40.0 / min(u_resolution.x, u_resolution.y);
310
287
  float vigRange = vigPx * (1.0 + u_vignette * 3.0);
@@ -312,9 +289,6 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
312
289
  vig = smoothstep(0.0, 1.0, vig);
313
290
  col *= mix(1.0, vig, u_vignette * u_vigOpacity);
314
291
 
315
- /* Per-pixel alpha. With all-1 alphas the formula collapses to ~1 but the
316
- * computation matches the canonical engine so custom presets behave the
317
- * same. */
318
292
  float colorAlpha = (u_alpha1 + u_alpha2 + u_alpha3 + u_alpha4 + u_alpha5) / 5.0;
319
293
  if (colorAlpha < 0.999) {
320
294
  vec3 c1d = col - u_color1, c2d = col - u_color2, c3d = col - u_color3,
@@ -330,41 +304,37 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
330
304
  }
331
305
  float alpha = colorAlpha;
332
306
 
333
- /* Touch the unused-at-effect-1 uniforms so GL drivers that complain about
334
- * declared-but-unread uniforms (some Mali / Adreno builds do) keep them
335
- * live. The contribution is provably zero. */
336
307
  alpha += 0.0 * (u_softness + u_shape +
337
308
  u_alpha6 + u_alpha7 +
338
309
  u_color6.x + u_color7.x);
339
310
 
340
311
  gl_FragColor = vec4(col, alpha * u_shaderOpacity);
341
312
  }
342
- `
343
- );
344
- function Le(e, t, a) {
345
- const n = e.createShader(t);
313
+ `;
314
+ function It(t, e, o) {
315
+ const n = t.createShader(e);
346
316
  if (!n) throw new Error("metal-fx: gl.createShader returned null");
347
- if (e.shaderSource(n, a), e.compileShader(n), !e.getShaderParameter(n, e.COMPILE_STATUS)) {
348
- const o = e.getShaderInfoLog(n);
349
- throw e.deleteShader(n), new Error(`metal-fx: shader compile failed: ${o ?? "(no info log)"}`);
317
+ if (t.shaderSource(n, o), t.compileShader(n), !t.getShaderParameter(n, t.COMPILE_STATUS)) {
318
+ const a = t.getShaderInfoLog(n);
319
+ throw t.deleteShader(n), new Error(`metal-fx: shader compile failed: ${a ?? "(no info log)"}`);
350
320
  }
351
321
  return n;
352
322
  }
353
- function Nt(e, t, a) {
354
- const n = e.createProgram();
323
+ function Ne(t, e, o) {
324
+ const n = t.createProgram();
355
325
  if (!n) throw new Error("metal-fx: gl.createProgram returned null");
356
- if (e.attachShader(n, t), e.attachShader(n, a), e.linkProgram(n), !e.getProgramParameter(n, e.LINK_STATUS)) {
357
- const o = e.getProgramInfoLog(n);
358
- throw e.deleteProgram(n), new Error(`metal-fx: program link failed: ${o ?? "(no info log)"}`);
326
+ if (t.attachShader(n, e), t.attachShader(n, o), t.linkProgram(n), !t.getProgramParameter(n, t.LINK_STATUS)) {
327
+ const a = t.getProgramInfoLog(n);
328
+ throw t.deleteProgram(n), new Error(`metal-fx: program link failed: ${a ?? "(no info log)"}`);
359
329
  }
360
330
  return n;
361
331
  }
362
- const et = 140, tt = 40, at = 1.6, nt = 1.3;
363
- let i = null, ne = null;
364
- function Gt(e) {
365
- ne = e;
332
+ const te = 140, ee = 40, oe = 1.6, ne = 1.3;
333
+ let i = null, nt = null;
334
+ function We(t) {
335
+ nt = t;
366
336
  }
367
- const Wt = [
337
+ const Ge = [
368
338
  "u_resolution",
369
339
  "u_time",
370
340
  "u_color1",
@@ -393,430 +363,427 @@ const Wt = [
393
363
  "u_blur",
394
364
  "u_shaderOpacity"
395
365
  ];
396
- function Oe(e) {
397
- e.enable(e.BLEND), e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA);
398
- const t = Le(e, e.VERTEX_SHADER, $t), a = Le(e, e.FRAGMENT_SHADER, Ht), n = Nt(e, t, a);
399
- e.useProgram(n);
400
- const o = e.createBuffer();
401
- if (!o) throw new Error("metal-fx: gl.createBuffer returned null");
402
- e.bindBuffer(e.ARRAY_BUFFER, o), e.bufferData(e.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]), e.STATIC_DRAW);
403
- const r = e.getAttribLocation(n, "a_position");
404
- e.enableVertexAttribArray(r), e.vertexAttribPointer(r, 2, e.FLOAT, !1, 0, 0);
366
+ function Lt(t) {
367
+ t.enable(t.BLEND), t.blendFunc(t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA);
368
+ const e = It(t, t.VERTEX_SHADER, $e), o = It(t, t.FRAGMENT_SHADER, He), n = Ne(t, e, o);
369
+ t.useProgram(n);
370
+ const a = t.createBuffer();
371
+ if (!a) throw new Error("metal-fx: gl.createBuffer returned null");
372
+ t.bindBuffer(t.ARRAY_BUFFER, a), t.bufferData(t.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]), t.STATIC_DRAW);
373
+ const r = t.getAttribLocation(n, "a_position");
374
+ t.enableVertexAttribArray(r), t.vertexAttribPointer(r, 2, t.FLOAT, !1, 0, 0);
405
375
  const s = {};
406
- for (const c of Wt) s[c] = e.getUniformLocation(n, c);
407
- return { program: n, buffer: o, uniforms: s };
376
+ for (const c of Ge) s[c] = t.getUniformLocation(n, c);
377
+ return { program: n, buffer: a, uniforms: s };
408
378
  }
409
- function ot() {
379
+ function ae() {
410
380
  if (i) return i;
411
- const e = Math.min(Ot, typeof window < "u" && window.devicePixelRatio || 1), t = Math.round(Lt * e), a = typeof OffscreenCanvas < "u";
412
- let n, o;
413
- if (a)
414
- n = new OffscreenCanvas(t, t), o = n.getContext("webgl", {
381
+ const t = Math.min(Le, typeof window < "u" && window.devicePixelRatio || 1), e = Math.round(Ie * t), o = typeof OffscreenCanvas < "u";
382
+ let n, a;
383
+ if (o)
384
+ n = new OffscreenCanvas(e, e), a = n.getContext("webgl", {
415
385
  alpha: !0,
416
386
  premultipliedAlpha: !1,
417
387
  antialias: !1
418
388
  });
419
389
  else {
420
- const f = document.createElement("canvas");
421
- f.width = t, f.height = t, o = f.getContext("webgl", {
390
+ const d = document.createElement("canvas");
391
+ d.width = e, d.height = e, a = d.getContext("webgl", {
422
392
  alpha: !0,
423
393
  premultipliedAlpha: !1,
424
394
  antialias: !1,
425
395
  preserveDrawingBuffer: !0
426
- }) ?? f.getContext("experimental-webgl"), n = f;
396
+ }) ?? d.getContext("experimental-webgl"), n = d;
427
397
  }
428
- if (!o) throw new Error("metal-fx: WebGL not supported");
429
- const { program: r, buffer: s, uniforms: c } = Oe(o), l = (f) => {
430
- f.preventDefault(), i && (i.contextLost = !0);
431
- }, d = () => {
398
+ if (!a) throw new Error("metal-fx: WebGL not supported");
399
+ const { program: r, buffer: s, uniforms: c } = Lt(a), l = (d) => {
400
+ d.preventDefault(), i && (i.contextLost = !0);
401
+ }, f = () => {
432
402
  if (!i) return;
433
- const f = Oe(i.gl);
434
- i.program = f.program, i.buffer = f.buffer, i.uniforms = f.uniforms, i.presetDirty = !0, i.contextLost = !1, ne == null || ne();
403
+ const d = Lt(i.gl);
404
+ i.program = d.program, i.buffer = d.buffer, i.uniforms = d.uniforms, i.presetDirty = !0, i.contextLost = !1, nt == null || nt();
435
405
  };
436
- return n.addEventListener("webglcontextlost", l, !1), n.addEventListener("webglcontextrestored", d, !1), i = {
406
+ return n.addEventListener("webglcontextlost", l, !1), n.addEventListener("webglcontextrestored", f, !1), i = {
437
407
  glCanvas: n,
438
- gl: o,
408
+ gl: a,
439
409
  program: r,
440
410
  buffer: s,
441
411
  uniforms: c,
442
- preset: Ze.chromatic.modes.dark,
412
+ preset: Jt.chromatic.modes.dark,
443
413
  presetDirty: !0,
444
414
  contextLost: !1,
445
- useOffscreen: a,
415
+ useOffscreen: o,
446
416
  frameBitmap: null,
447
417
  startMs: performance.now(),
448
418
  pausedMs: 0,
449
419
  pausedAtMs: null,
450
420
  rafId: 0,
451
- dpr: e,
421
+ dpr: t,
452
422
  instances: /* @__PURE__ */ new Set(),
453
423
  frameCount: 0,
454
424
  glowQueue: [],
455
425
  glowIdx: 0,
456
426
  glowSkip: 0,
457
- glowPixels: new Uint8Array(t * t * 4),
458
- glowPixelsW: t,
459
- glowPixelsH: t
427
+ glowPixels: new Uint8Array(e * e * 4),
428
+ glowPixelsW: e,
429
+ glowPixelsH: e
460
430
  }, i;
461
431
  }
462
- function zt() {
463
- var o;
432
+ function De() {
433
+ var a;
464
434
  if (!i) return;
465
- const { gl: e, program: t, buffer: a, frameBitmap: n } = i;
435
+ const { gl: t, program: e, buffer: o, frameBitmap: n } = i;
466
436
  try {
467
- n == null || n.close(), e.deleteBuffer(a), e.deleteProgram(t), (o = e.getExtension("WEBGL_lose_context")) == null || o.loseContext();
437
+ n == null || n.close(), t.deleteBuffer(o), t.deleteProgram(e), (a = t.getExtension("WEBGL_lose_context")) == null || a.loseContext();
468
438
  } catch {
469
439
  }
470
440
  i = null;
471
441
  }
472
- let Ie = 0;
473
- function ie() {
442
+ let Ot = 0;
443
+ function it() {
474
444
  if (!i) return;
475
- const e = performance.now();
476
- if (e - Ie < Tt) return;
477
- Ie = e;
478
- const { gl: t, glCanvas: a } = i, n = a.width, o = a.height;
479
- (i.glowPixelsW !== n || i.glowPixelsH !== o) && (i.glowPixelsW = n, i.glowPixelsH = o, i.glowPixels = new Uint8Array(n * o * 4)), t.readPixels(0, 0, n, o, t.RGBA, t.UNSIGNED_BYTE, i.glowPixels);
445
+ const t = performance.now();
446
+ if (t - Ot < Ce) return;
447
+ Ot = t;
448
+ const { gl: e, glCanvas: o } = i, n = o.width, a = o.height;
449
+ (i.glowPixelsW !== n || i.glowPixelsH !== a) && (i.glowPixelsW = n, i.glowPixelsH = a, i.glowPixels = new Uint8Array(n * a * 4)), e.readPixels(0, 0, n, a, e.RGBA, e.UNSIGNED_BYTE, i.glowPixels);
480
450
  }
481
451
  const X = { bx: 0, by: 0 };
482
- function ye(e, t, a) {
452
+ function wt(t, e, o) {
483
453
  if (!i)
484
454
  return X.bx = 0, X.by = 0, X;
485
- const { glCanvas: n } = i, o = n.width, r = n.height, s = e.dpr, c = e.cssWidth * s, l = e.cssHeight * s, d = et * s, f = tt * s;
486
- let g = c * (o / d) / e.shaderScale, u = l * (r / f) / e.shaderScale;
487
- g > o && (g = o), u > r && (u = r);
488
- const p = (o - g) / 2, h = (r - u) / 2, m = p + t / e.cssWidth * g, A = h + a / e.cssHeight * u;
489
- return X.bx = Math.round(m), X.by = Math.round(r - 1 - A), X;
455
+ const { glCanvas: n } = i, a = n.width, r = n.height, s = t.dpr, c = t.cssWidth * s, l = t.cssHeight * s, f = te * s, d = ee * s;
456
+ let g = c * (a / f) / t.shaderScale, u = l * (r / d) / t.shaderScale;
457
+ g > a && (g = a), u > r && (u = r);
458
+ const h = (a - g) / 2, p = (r - u) / 2, m = h + e / t.cssWidth * g, S = p + o / t.cssHeight * u;
459
+ return X.bx = Math.round(m), X.by = Math.round(r - 1 - S), X;
490
460
  }
491
461
  const N = { r: 0, g: 0, b: 0, lum: 0, count: 0 };
492
- function rt(e, t, a, n, o, r) {
493
- const s = Math.max(1, r | 0), c = Math.max(0, n - s), l = Math.min(t, n + s + 1), d = Math.max(0, o - s), f = Math.min(a, o + s + 1);
462
+ function re(t, e, o, n, a, r) {
463
+ const s = Math.max(1, r | 0), c = Math.max(0, n - s), l = Math.min(e, n + s + 1), f = Math.max(0, a - s), d = Math.min(o, a + s + 1);
494
464
  N.r = 0, N.g = 0, N.b = 0, N.lum = 0, N.count = 0;
495
- for (let g = d; g < f; g++) {
496
- const u = g * t;
497
- for (let p = c; p < l; p++) {
498
- const h = (u + p) * 4;
499
- N.r += e[h], N.g += e[h + 1], N.b += e[h + 2], N.lum += (0.2126 * e[h] + 0.7152 * e[h + 1] + 0.0722 * e[h + 2]) / 255, N.count++;
465
+ for (let g = f; g < d; g++) {
466
+ const u = g * e;
467
+ for (let h = c; h < l; h++) {
468
+ const p = (u + h) * 4;
469
+ N.r += t[p], N.g += t[p + 1], N.b += t[p + 2], N.lum += (0.2126 * t[p] + 0.7152 * t[p + 1] + 0.0722 * t[p + 2]) / 255, N.count++;
500
470
  }
501
471
  }
502
472
  return N;
503
473
  }
504
- const T = { r: 255, g: 255, b: 255 };
505
- function Pe(e, t, a, n) {
474
+ const C = { r: 255, g: 255, b: 255 };
475
+ function Pt(t, e, o, n) {
506
476
  if (!i) return 0;
507
- ie();
508
- const o = ye(e, t, a), r = rt(i.glowPixels, i.glowPixelsW, i.glowPixelsH, o.bx, o.by, n);
477
+ it();
478
+ const a = wt(t, e, o), r = re(i.glowPixels, i.glowPixelsW, i.glowPixelsH, a.bx, a.by, n);
509
479
  return r.count > 0 ? r.lum / r.count : 0;
510
480
  }
511
- function Bt(e, t, a, n) {
481
+ function Be(t, e, o, n) {
512
482
  if (!i)
513
- return T.r = 255, T.g = 255, T.b = 255, T;
514
- ie();
515
- const o = ye(e, t, a), r = rt(i.glowPixels, i.glowPixelsW, i.glowPixelsH, o.bx, o.by, n);
516
- return r.count === 0 ? (T.r = 255, T.g = 255, T.b = 255, T) : (T.r = r.r / r.count, T.g = r.g / r.count, T.b = r.b / r.count, T);
483
+ return C.r = 255, C.g = 255, C.b = 255, C;
484
+ it();
485
+ const a = wt(t, e, o), r = re(i.glowPixels, i.glowPixelsW, i.glowPixelsH, a.bx, a.by, n);
486
+ return r.count === 0 ? (C.r = 255, C.g = 255, C.b = 255, C) : (C.r = r.r / r.count, C.g = r.g / r.count, C.b = r.b / r.count, C);
517
487
  }
518
- function Dt(e, t, a, n) {
488
+ function ze(t, e, o, n) {
519
489
  if (!i)
520
- return T.r = 255, T.g = 255, T.b = 255, T;
521
- ie();
522
- const o = ye(e, t, a), { glowPixels: r, glowPixelsW: s, glowPixelsH: c } = i, l = Math.max(1, n | 0), d = Math.max(0, o.bx - l), f = Math.min(s, o.bx + l + 1), g = Math.max(0, o.by - l), u = Math.min(c, o.by + l + 1);
523
- let p = -1;
524
- T.r = 255, T.g = 255, T.b = 255;
525
- for (let h = g; h < u; h++) {
526
- const m = h * s;
527
- for (let A = d; A < f; A++) {
528
- const x = (m + A) * 4, E = r[x], M = r[x + 1], O = r[x + 2], P = Math.max(E, M, O), y = Math.min(E, M, O), S = (P > 0 ? (P - y) / P : 0) * (0.35 + 0.65 * (P / 255));
529
- S > p && (p = S, T.r = E, T.g = M, T.b = O);
490
+ return C.r = 255, C.g = 255, C.b = 255, C;
491
+ it();
492
+ const a = wt(t, e, o), { glowPixels: r, glowPixelsW: s, glowPixelsH: c } = i, l = Math.max(1, n | 0), f = Math.max(0, a.bx - l), d = Math.min(s, a.bx + l + 1), g = Math.max(0, a.by - l), u = Math.min(c, a.by + l + 1);
493
+ let h = -1;
494
+ C.r = 255, C.g = 255, C.b = 255;
495
+ for (let p = g; p < u; p++) {
496
+ const m = p * s;
497
+ for (let S = f; S < d; S++) {
498
+ const x = (m + S) * 4, k = r[x], M = r[x + 1], L = r[x + 2], P = Math.max(k, M, L), w = Math.min(k, M, L), R = (P > 0 ? (P - w) / P : 0) * (0.35 + 0.65 * (P / 255));
499
+ R > h && (h = R, C.r = k, C.g = M, C.b = L);
530
500
  }
531
501
  }
532
- return T;
502
+ return C;
533
503
  }
534
- Gt(() => {
504
+ We(() => {
535
505
  i && i.instances.size > 0 && i.pausedAtMs === null && K();
536
506
  });
537
507
  typeof document < "u" && document.addEventListener("visibilitychange", () => {
538
- !i || i.pausedAtMs !== null || i.contextLost || (document.hidden ? _e() : i.instances.size > 0 && K());
508
+ !i || i.pausedAtMs !== null || i.contextLost || (document.hidden ? yt() : i.instances.size > 0 && K());
539
509
  });
540
- function Ut(e) {
541
- const t = ot(), a = e.hostCanvas.getContext("2d", { alpha: !0 });
542
- if (!a) throw new Error("metal-fx: canvas 2D context unavailable");
543
- const n = e.scale ?? 1, o = {
544
- canvas: e.hostCanvas,
545
- ctx: a,
546
- cssWidth: e.cssWidth,
547
- cssHeight: e.cssHeight,
548
- cornerRadius: e.cornerRadius,
549
- kind: e.kind,
550
- ringCssPx: e.ringCssPx ?? (e.kind === "circle" ? 2 : 1) * n,
551
- shaderScale: e.shaderScale ?? (e.kind === "circle" ? nt : at) * n,
552
- opacityMul: e.opacityMul ?? 1,
510
+ function Ue(t) {
511
+ const e = ae(), o = t.hostCanvas.getContext("2d", { alpha: !0 });
512
+ if (!o) throw new Error("metal-fx: canvas 2D context unavailable");
513
+ const n = t.scale ?? 1, a = {
514
+ canvas: t.hostCanvas,
515
+ ctx: o,
516
+ cssWidth: t.cssWidth,
517
+ cssHeight: t.cssHeight,
518
+ cornerRadius: t.cornerRadius,
519
+ kind: t.kind,
520
+ ringCssPx: t.ringCssPx ?? (t.kind === "circle" ? 2 : 1) * n,
521
+ shaderScale: t.shaderScale ?? (t.kind === "circle" ? ne : oe) * n,
522
+ opacityMul: t.opacityMul ?? 1,
553
523
  visible: !0,
554
- paused: e.paused ?? !1,
524
+ paused: t.paused ?? !1,
555
525
  everCopied: !1,
556
526
  dpr: typeof window < "u" && window.devicePixelRatio || 1,
557
527
  scale: n,
558
- onAfterFrame: e.onAfterFrame,
559
- onFirstCopy: e.onFirstCopy
528
+ onAfterFrame: t.onAfterFrame,
529
+ onFirstCopy: t.onFirstCopy
560
530
  };
561
- return it(o), t.instances.add(o), t.rafId === 0 && t.pausedAtMs === null && K(), o;
531
+ return ie(a), e.instances.add(a), e.rafId === 0 && e.pausedAtMs === null && K(), a;
562
532
  }
563
- function Xt(e) {
533
+ function Xe(t) {
564
534
  if (!i) return;
565
- i.instances.delete(e);
566
- const t = i.glowQueue.indexOf(e);
567
- t !== -1 && i.glowQueue.splice(t, 1), i.instances.size === 0 && (_e(), zt());
535
+ i.instances.delete(t);
536
+ const e = i.glowQueue.indexOf(t);
537
+ e !== -1 && i.glowQueue.splice(e, 1), i.instances.size === 0 && (yt(), De());
568
538
  }
569
- function Vt(e) {
570
- i && (i.glowQueue.includes(e) || i.glowQueue.push(e));
539
+ function qe(t) {
540
+ i && (i.glowQueue.includes(t) || i.glowQueue.push(t));
571
541
  }
572
- function qt(e) {
542
+ function Ye(t) {
573
543
  if (!i) return;
574
- const t = i.glowQueue.indexOf(e);
575
- t !== -1 && i.glowQueue.splice(t, 1);
544
+ const e = i.glowQueue.indexOf(t);
545
+ e !== -1 && i.glowQueue.splice(e, 1);
576
546
  }
577
- function J(e, t) {
578
- let a = !1;
579
- t.cssWidth !== void 0 && t.cssWidth !== e.cssWidth && (e.cssWidth = t.cssWidth, a = !0), t.cssHeight !== void 0 && t.cssHeight !== e.cssHeight && (e.cssHeight = t.cssHeight, a = !0), t.cornerRadius !== void 0 && (e.cornerRadius = t.cornerRadius), t.scale !== void 0 && (e.scale = t.scale), t.kind !== void 0 && t.kind !== e.kind && (e.kind = t.kind, t.shaderScale === void 0 && (e.shaderScale = (t.kind === "circle" ? nt : at) * e.scale), t.ringCssPx === void 0 && (e.ringCssPx = (t.kind === "circle" ? 2 : 1) * e.scale)), t.shaderScale !== void 0 && (e.shaderScale = t.shaderScale), t.ringCssPx !== void 0 && (e.ringCssPx = t.ringCssPx), t.opacityMul !== void 0 && (e.opacityMul = t.opacityMul), t.paused !== void 0 && t.paused !== e.paused && (e.paused = t.paused, !t.paused && i && i.rafId === 0 && i.pausedAtMs === null && !i.contextLost && K()), a && it(e);
547
+ function Z(t, e) {
548
+ let o = !1;
549
+ e.cssWidth !== void 0 && e.cssWidth !== t.cssWidth && (t.cssWidth = e.cssWidth, o = !0), e.cssHeight !== void 0 && e.cssHeight !== t.cssHeight && (t.cssHeight = e.cssHeight, o = !0), e.cornerRadius !== void 0 && (t.cornerRadius = e.cornerRadius), e.scale !== void 0 && (t.scale = e.scale), e.kind !== void 0 && e.kind !== t.kind && (t.kind = e.kind, e.shaderScale === void 0 && (t.shaderScale = (e.kind === "circle" ? ne : oe) * t.scale), e.ringCssPx === void 0 && (t.ringCssPx = (e.kind === "circle" ? 2 : 1) * t.scale)), e.shaderScale !== void 0 && (t.shaderScale = e.shaderScale), e.ringCssPx !== void 0 && (t.ringCssPx = e.ringCssPx), e.opacityMul !== void 0 && (t.opacityMul = e.opacityMul), e.paused !== void 0 && e.paused !== t.paused && (t.paused = e.paused, !e.paused && i && i.rafId === 0 && i.pausedAtMs === null && !i.contextLost && K()), o && ie(t);
580
550
  }
581
- function Yt(e, t) {
582
- e.visible = t, t && i && i.rafId === 0 && i.pausedAtMs === null && !i.contextLost && K();
551
+ function Ve(t, e) {
552
+ t.visible = e, e && i && i.rafId === 0 && i.pausedAtMs === null && !i.contextLost && K();
583
553
  }
584
- function jt(e, t) {
585
- const a = ot();
586
- a.preset = Ze[e].modes[t], a.presetDirty = !0;
554
+ function je(t, e) {
555
+ const o = ae();
556
+ o.preset = Jt[t].modes[e], o.presetDirty = !0;
587
557
  }
588
- function un() {
589
- !i || i.pausedAtMs !== null || (i.pausedAtMs = performance.now(), _e());
558
+ function pn() {
559
+ !i || i.pausedAtMs !== null || (i.pausedAtMs = performance.now(), yt());
590
560
  }
591
561
  function hn() {
592
562
  !i || i.pausedAtMs === null || (i.pausedMs += performance.now() - i.pausedAtMs, i.pausedAtMs = null, i.instances.size > 0 && K());
593
563
  }
594
- let be = null;
595
- function Kt(e) {
596
- be = e;
564
+ let _t = null;
565
+ function Ke(t) {
566
+ _t = t;
597
567
  }
598
- function it(e) {
599
- e.dpr = typeof window < "u" && window.devicePixelRatio || 1;
600
- const t = Math.max(1, Math.round(e.cssWidth * e.dpr)), a = Math.max(1, Math.round(e.cssHeight * e.dpr));
601
- e.canvas.width !== t && (e.canvas.width = t), e.canvas.height !== a && (e.canvas.height = a);
568
+ function ie(t) {
569
+ t.dpr = typeof window < "u" && window.devicePixelRatio || 1;
570
+ const e = Math.max(1, Math.round(t.cssWidth * t.dpr)), o = Math.max(1, Math.round(t.cssHeight * t.dpr));
571
+ t.canvas.width !== e && (t.canvas.width = e), t.canvas.height !== o && (t.canvas.height = o);
602
572
  }
603
- function Qt(e) {
604
- const { ctx: t, dpr: a, canvas: n } = e, o = e.ringCssPx * a, r = n.width, s = n.height, c = Math.max(0, (e.cornerRadius - e.ringCssPx) * a);
605
- t.save(), t.globalCompositeOperation = "destination-out", t.fillStyle = "#000", t.beginPath(), t.roundRect(o, o, r - 2 * o, s - 2 * o, c), t.fill(), t.restore();
573
+ function Qe(t) {
574
+ const { ctx: e, dpr: o, canvas: n } = t, a = t.ringCssPx * o, r = n.width, s = n.height, c = Math.max(0, (t.cornerRadius - t.ringCssPx) * o);
575
+ e.save(), e.globalCompositeOperation = "destination-out", e.fillStyle = "#000", e.beginPath(), e.roundRect(a, a, r - 2 * a, s - 2 * a, c), e.fill(), e.restore();
606
576
  }
607
- function Jt(e) {
608
- var p;
577
+ function Ze(t) {
578
+ var h;
609
579
  if (!i) return;
610
- const t = i.frameBitmap ?? i.glCanvas, a = e.dpr, n = e.canvas.width, o = e.canvas.height;
611
- if (n < 1 || o < 1) return;
612
- const r = i.glCanvas.width, s = i.glCanvas.height, c = et * a, l = tt * a;
613
- let d = n * (r / c) / e.shaderScale, f = o * (s / l) / e.shaderScale;
614
- d > r && (d = r), f > s && (f = s);
615
- const g = Math.max(0, (r - d) / 2), u = Math.max(0, (s - f) / 2);
616
- if (e.ctx.clearRect(0, 0, n, o), e.opacityMul < 1 && (e.ctx.globalAlpha = e.opacityMul), e.ctx.drawImage(t, g, u, d, f, 0, 0, n, o), e.opacityMul < 1 && (e.ctx.globalAlpha = 1), Qt(e), e.onFirstCopy) {
617
- const h = e.onFirstCopy;
618
- e.onFirstCopy = void 0, h();
580
+ const e = i.frameBitmap ?? i.glCanvas, o = t.dpr, n = t.canvas.width, a = t.canvas.height;
581
+ if (n < 1 || a < 1) return;
582
+ const r = i.glCanvas.width, s = i.glCanvas.height, c = te * o, l = ee * o;
583
+ let f = n * (r / c) / t.shaderScale, d = a * (s / l) / t.shaderScale;
584
+ f > r && (f = r), d > s && (d = s);
585
+ const g = Math.max(0, (r - f) / 2), u = Math.max(0, (s - d) / 2);
586
+ if (t.ctx.clearRect(0, 0, n, a), t.opacityMul < 1 && (t.ctx.globalAlpha = t.opacityMul), t.ctx.drawImage(e, g, u, f, d, 0, 0, n, a), t.opacityMul < 1 && (t.ctx.globalAlpha = 1), Qe(t), t.onFirstCopy) {
587
+ const p = t.onFirstCopy;
588
+ t.onFirstCopy = void 0, p();
619
589
  }
620
- (p = e.onAfterFrame) == null || p.call(e);
590
+ (h = t.onAfterFrame) == null || h.call(t);
621
591
  }
622
- function Zt() {
592
+ function Je() {
623
593
  if (!i) return;
624
- const { gl: e, uniforms: t, preset: a, glCanvas: n } = i;
625
- t.u_resolution && e.uniform2f(t.u_resolution, n.width, n.height);
626
- for (let o = 0; o < 7; o++) {
627
- const r = t[`u_color${o + 1}`];
594
+ const { gl: t, uniforms: e, preset: o, glCanvas: n } = i;
595
+ e.u_resolution && t.uniform2f(e.u_resolution, n.width, n.height);
596
+ for (let a = 0; a < 7; a++) {
597
+ const r = e[`u_color${a + 1}`];
628
598
  if (r) {
629
- const [c, l, d] = _t(a.colors[o]);
630
- e.uniform3f(r, c, l, d);
599
+ const [c, l, f] = ye(o.colors[a]);
600
+ t.uniform3f(r, c, l, f);
631
601
  }
632
- const s = t[`u_alpha${o + 1}`];
633
- s && e.uniform1f(s, a.alphas[o]);
602
+ const s = e[`u_alpha${a + 1}`];
603
+ s && t.uniform1f(s, o.alphas[a]);
634
604
  }
635
- t.u_intensity && e.uniform1f(t.u_intensity, a.intensity), t.u_scale && e.uniform1f(t.u_scale, a.scale), t.u_direction && e.uniform1f(t.u_direction, a.direction * Math.PI / 180), t.u_softness && e.uniform1f(t.u_softness, a.softness), t.u_distortion && e.uniform1f(t.u_distortion, a.distortion), t.u_complexity && e.uniform1f(t.u_complexity, a.complexity), t.u_shape && e.uniform1f(t.u_shape, a.shape), t.u_vignette && e.uniform1f(t.u_vignette, a.vignette), t.u_vigOpacity && e.uniform1f(t.u_vigOpacity, a.vigOpacity), t.u_blur && e.uniform1f(t.u_blur, a.blur), t.u_shaderOpacity && e.uniform1f(t.u_shaderOpacity, a.shaderOpacity), i.presetDirty = !1;
605
+ e.u_intensity && t.uniform1f(e.u_intensity, o.intensity), e.u_scale && t.uniform1f(e.u_scale, o.scale), e.u_direction && t.uniform1f(e.u_direction, o.direction * Math.PI / 180), e.u_softness && t.uniform1f(e.u_softness, o.softness), e.u_distortion && t.uniform1f(e.u_distortion, o.distortion), e.u_complexity && t.uniform1f(e.u_complexity, o.complexity), e.u_shape && t.uniform1f(e.u_shape, o.shape), e.u_vignette && t.uniform1f(e.u_vignette, o.vignette), e.u_vigOpacity && t.uniform1f(e.u_vigOpacity, o.vigOpacity), e.u_blur && t.uniform1f(e.u_blur, o.blur), e.u_shaderOpacity && t.uniform1f(e.u_shaderOpacity, o.shaderOpacity), i.presetDirty = !1;
636
606
  }
637
- function ea(e) {
607
+ function to(t) {
638
608
  if (!i) return;
639
- const { gl: t, uniforms: a, preset: n, glCanvas: o } = i, r = (e - i.startMs - i.pausedMs) / 1e3 * n.speed;
640
- t.viewport(0, 0, o.width, o.height), t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), i.presetDirty && Zt(), a.u_time && t.uniform1f(a.u_time, r), t.drawArrays(t.TRIANGLES, 0, 6), i.frameCount++;
609
+ const { gl: e, uniforms: o, preset: n, glCanvas: a } = i, r = (t - i.startMs - i.pausedMs) / 1e3 * n.speed;
610
+ e.viewport(0, 0, a.width, a.height), e.clearColor(0, 0, 0, 0), e.clear(e.COLOR_BUFFER_BIT), i.presetDirty && Je(), o.u_time && e.uniform1f(o.u_time, r), e.drawArrays(e.TRIANGLES, 0, 6), i.frameCount++;
641
611
  }
642
- let Fe = 0;
643
- function st(e) {
644
- var a;
612
+ let Ft = 0;
613
+ function se(t) {
614
+ var o;
645
615
  if (!i) return;
646
616
  if (i.contextLost) {
647
617
  i.rafId = 0;
648
618
  return;
649
619
  }
650
- let t = !1;
620
+ let e = !1;
651
621
  for (const n of i.instances)
652
622
  if (n.visible && (!n.paused || !n.everCopied)) {
653
- t = !0;
623
+ e = !0;
654
624
  break;
655
625
  }
656
- if (!t) {
626
+ if (!e) {
657
627
  i.rafId = 0;
658
628
  return;
659
629
  }
660
- if (i.rafId = requestAnimationFrame(st), !(e - Fe < Rt)) {
661
- Fe = e, ea(e), i.useOffscreen && (i.glowQueue.length > 0 && ie(), (a = i.frameBitmap) == null || a.close(), i.frameBitmap = i.glCanvas.transferToImageBitmap());
630
+ if (i.rafId = requestAnimationFrame(se), !(t - Ft < Ae)) {
631
+ Ft = t, to(t), i.useOffscreen && (i.glowQueue.length > 0 && it(), (o = i.frameBitmap) == null || o.close(), i.frameBitmap = i.glCanvas.transferToImageBitmap());
662
632
  for (const n of i.instances)
663
- n.visible && (n.paused && n.everCopied || (Jt(n), n.everCopied = !0));
664
- if (be && i.glowQueue.length > 0 && ++i.glowSkip % Ct === 0) {
633
+ n.visible && (n.paused && n.everCopied || (Ze(n), n.everCopied = !0));
634
+ if (_t && i.glowQueue.length > 0 && ++i.glowSkip % Te === 0) {
665
635
  const n = i.glowQueue;
666
636
  i.glowIdx >= n.length && (i.glowIdx = 0);
667
- const o = n[i.glowIdx];
668
- o.visible && !o.paused && be(o, e), i.glowIdx++;
637
+ const a = n[i.glowIdx];
638
+ a.visible && !a.paused && _t(a, t), i.glowIdx++;
669
639
  }
670
640
  }
671
641
  }
672
642
  function K() {
673
- !i || i.rafId !== 0 || (i.rafId = requestAnimationFrame(st));
643
+ !i || i.rafId !== 0 || (i.rafId = requestAnimationFrame(se));
674
644
  }
675
- function _e() {
645
+ function yt() {
676
646
  i && (i.rafId !== 0 && cancelAnimationFrame(i.rafId), i.rafId = 0);
677
647
  }
678
- const oe = {
679
- linear: (e) => e,
680
- smoothstep: (e) => e * e * (3 - 2 * e)
648
+ const at = {
649
+ linear: (t) => t,
650
+ smoothstep: (t) => t * t * (3 - 2 * t)
681
651
  };
682
- function V(e, t, a, n = oe.linear) {
683
- return { from: e, to: t, dur: a, ease: n, startMs: -1, val: e, done: !1 };
652
+ function q(t, e, o, n = at.linear) {
653
+ return { from: t, to: e, dur: o, ease: n, startMs: -1, val: t, done: !1 };
684
654
  }
685
- function q(e, t) {
686
- e.startMs = t, e.val = e.from, e.done = !1;
655
+ function Y(t, e) {
656
+ t.startMs = e, t.val = t.from, t.done = !1;
687
657
  }
688
- function $e(e, t) {
689
- if (e.done || e.startMs < 0) return e.val;
690
- const a = Math.min(1, (t - e.startMs) / e.dur);
691
- return e.val = e.from + (e.to - e.from) * e.ease(a), a >= 1 && (e.done = !0), e.val;
658
+ function $t(t, e) {
659
+ if (t.done || t.startMs < 0) return t.val;
660
+ const o = Math.min(1, (e - t.startMs) / t.dur);
661
+ return t.val = t.from + (t.to - t.from) * t.ease(o), o >= 1 && (t.done = !0), t.val;
692
662
  }
693
- const ta = 1.5, ee = 1 / 3, aa = 4 * ee, na = 2 * ee, oa = 2 * ee, ra = 1.35 * ee, ia = 13 * ee;
694
- function Me(e, t, a) {
695
- const n = Math.max(0, Math.min(a, Math.min(e, t) / 2));
696
- return 2 * Math.max(0, e - 2 * n) + 2 * Math.max(0, t - 2 * n) + 2 * Math.PI * n;
663
+ const eo = 1.5, tt = 1 / 3, oo = 4 * tt, no = 2 * tt, ao = 2 * tt, ro = 1.35 * tt, io = 13 * tt;
664
+ function Mt(t, e, o) {
665
+ const n = Math.max(0, Math.min(o, Math.min(t, e) / 2));
666
+ return 2 * Math.max(0, t - 2 * n) + 2 * Math.max(0, e - 2 * n) + 2 * Math.PI * n;
697
667
  }
698
- function Se(e, t, a, n) {
699
- return n === "circle" ? 2 * Math.PI * Math.max(0, Math.min(a, Math.min(e, t) / 2)) : Me(e, t, a);
668
+ function Rt(t, e, o, n) {
669
+ return n === "circle" ? 2 * Math.PI * Math.max(0, Math.min(o, Math.min(t, e) / 2)) : Mt(t, e, o);
700
670
  }
701
- function Z(e, t, a, n, o, r, s, c) {
702
- const l = c || { x: 0, y: 0 }, d = Math.max(0, Math.min(n, Math.min(t, a) / 2));
671
+ function J(t, e, o, n, a, r, s, c) {
672
+ const l = c || { x: 0, y: 0 }, f = Math.max(0, Math.min(n, Math.min(e, o) / 2));
703
673
  if (s === "circle") {
704
- const x = 2 * Math.PI * d;
674
+ const x = 2 * Math.PI * f;
705
675
  if (x <= 1e-4)
706
- return l.x = t * 0.5, l.y = a * 0.5, l;
707
- e = (e % x + x) % x;
708
- const E = -Math.PI / 2 + e / x * Math.PI * 2, M = Math.max(0, d - o + r);
709
- return l.x = t * 0.5 + M * Math.cos(E), l.y = a * 0.5 + M * Math.sin(E), l;
676
+ return l.x = e * 0.5, l.y = o * 0.5, l;
677
+ t = (t % x + x) % x;
678
+ const k = -Math.PI / 2 + t / x * Math.PI * 2, M = Math.max(0, f - a + r);
679
+ return l.x = e * 0.5 + M * Math.cos(k), l.y = o * 0.5 + M * Math.sin(k), l;
710
680
  }
711
- const f = Math.max(0, t - 2 * d), g = Math.max(0, a - 2 * d), u = Math.PI * d / 2, p = 2 * (f + g) + 4 * u;
712
- e = (e % p + p) % p;
713
- const h = Math.max(0, d - o + r);
714
- let m = e;
715
- if (m < f)
716
- return l.x = d + m, l.y = o - r, l;
717
- if (m -= f, m < u) {
681
+ const d = Math.max(0, e - 2 * f), g = Math.max(0, o - 2 * f), u = Math.PI * f / 2, h = 2 * (d + g) + 4 * u;
682
+ t = (t % h + h) % h;
683
+ const p = Math.max(0, f - a + r);
684
+ let m = t;
685
+ if (m < d)
686
+ return l.x = f + m, l.y = a - r, l;
687
+ if (m -= d, m < u) {
718
688
  const x = -Math.PI / 2 + (u > 0 ? m / u : 0) * (Math.PI / 2);
719
- return l.x = t - d + h * Math.cos(x), l.y = d + h * Math.sin(x), l;
689
+ return l.x = e - f + p * Math.cos(x), l.y = f + p * Math.sin(x), l;
720
690
  }
721
691
  if (m -= u, m < g)
722
- return l.x = t - o + r, l.y = d + m, l;
692
+ return l.x = e - a + r, l.y = f + m, l;
723
693
  if (m -= g, m < u) {
724
694
  const x = (u > 0 ? m / u : 0) * (Math.PI / 2);
725
- return l.x = t - d + h * Math.cos(x), l.y = a - d + h * Math.sin(x), l;
695
+ return l.x = e - f + p * Math.cos(x), l.y = o - f + p * Math.sin(x), l;
726
696
  }
727
- if (m -= u, m < f)
728
- return l.x = t - d - m, l.y = a - o + r, l;
729
- if (m -= f, m < u) {
697
+ if (m -= u, m < d)
698
+ return l.x = e - f - m, l.y = o - a + r, l;
699
+ if (m -= d, m < u) {
730
700
  const x = Math.PI / 2 + (u > 0 ? m / u : 0) * (Math.PI / 2);
731
- return l.x = d + h * Math.cos(x), l.y = a - d + h * Math.sin(x), l;
701
+ return l.x = f + p * Math.cos(x), l.y = o - f + p * Math.sin(x), l;
732
702
  }
733
703
  if (m -= u, m < g)
734
- return l.x = o - r, l.y = a - d - m, l;
704
+ return l.x = a - r, l.y = o - f - m, l;
735
705
  m -= g;
736
- const A = Math.PI + (u > 0 ? m / u : 0) * (Math.PI / 2);
737
- return l.x = d + h * Math.cos(A), l.y = d + h * Math.sin(A), l;
706
+ const S = Math.PI + (u > 0 ? m / u : 0) * (Math.PI / 2);
707
+ return l.x = f + p * Math.cos(S), l.y = f + p * Math.sin(S), l;
738
708
  }
739
- function He(e, t) {
740
- const a = e * 2 / t;
709
+ function Ht(t, e) {
710
+ const o = t * 2 / e;
741
711
  let n = "";
742
- for (let o = 0; o <= t; o++) {
743
- const r = -e + o * a;
744
- n += (o === 0 ? "M " : "L ") + r.toFixed(3) + " 0 ";
712
+ for (let a = 0; a <= e; a++) {
713
+ const r = -t + a * o;
714
+ n += (a === 0 ? "M " : "L ") + r.toFixed(3) + " 0 ";
745
715
  }
746
716
  return n;
747
717
  }
748
- const he = { x: 0, y: 0 }, pe = { x: 0, y: 0 };
749
- function sa(e, t, a, n, o, r) {
750
- return Z(e - 0.1, t, a, n, o, 0, r, he), Z(e + 0.1, t, a, n, o, 0, r, pe), Math.atan2(pe.y - he.y, pe.x - he.x);
718
+ const pt = { x: 0, y: 0 }, ht = { x: 0, y: 0 };
719
+ function so(t, e, o, n, a, r) {
720
+ return J(t - 0.1, e, o, n, a, 0, r, pt), J(t + 0.1, e, o, n, a, 0, r, ht), Math.atan2(ht.y - pt.y, ht.x - pt.x);
751
721
  }
752
- function Ne(e, t, a) {
753
- const n = Math.max(0, Math.min(1, (a - e) / (t - e)));
722
+ function Nt(t, e, o) {
723
+ const n = Math.max(0, Math.min(1, (o - t) / (e - t)));
754
724
  return n * n * (3 - 2 * n);
755
725
  }
756
- function la(e) {
757
- const t = Se(e.width, e.height, e.cornerRadius, e.kind), a = ta * (e.scale ?? 1), n = [];
758
- for (let o = 0; o < Ee; o++) {
759
- const r = o / Ee * t, s = Z(r, e.width, e.height, e.cornerRadius, a, 0, e.kind);
726
+ function lo(t) {
727
+ const e = Rt(t.width, t.height, t.cornerRadius, t.kind), o = eo * (t.scale ?? 1), n = [];
728
+ for (let a = 0; a < kt; a++) {
729
+ const r = a / kt * e, s = J(r, t.width, t.height, t.cornerRadius, o, 0, t.kind);
760
730
  n.push({ x: s.x, y: s.y, arc: r });
761
731
  }
762
732
  return n;
763
733
  }
764
- function ca(e, t) {
765
- const { width: a, height: n, cornerRadius: o } = e, r = e.scale ?? 1, s = e.kind === "circle" ? 2 : 1, c = Math.max(0, o - s), l = (-200 * r).toFixed(0), d = l, f = (540 * r).toFixed(0), g = (440 * r).toFixed(0), u = `x="${l}" y="${d}" width="${f}" height="${g}"`, p = `${u} filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"`, h = (A) => (A * r).toFixed(3), m = (A) => (A * r).toFixed(3);
734
+ function co(t, e) {
735
+ const { width: o, height: n, cornerRadius: a } = t, r = t.scale ?? 1, s = t.kind === "circle" ? 2 : 1, c = Math.max(0, a - s), l = (-200 * r).toFixed(0), f = l, d = (540 * r).toFixed(0), g = (440 * r).toFixed(0), u = `x="${l}" y="${f}" width="${d}" height="${g}"`, h = `${u} filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"`, p = (S) => (S * r).toFixed(3), m = (S) => (S * r).toFixed(3);
766
736
  return [
767
737
  "<defs>",
768
- `<filter id="${t}_bXl" ${p}><feGaussianBlur stdDeviation="${m(8.4)}"/></filter>`,
769
- `<filter id="${t}_bLg" ${p}><feGaussianBlur stdDeviation="${m(4.8)}"/></filter>`,
770
- `<filter id="${t}_bMd" ${p}><feGaussianBlur stdDeviation="${m(2.1)}"/></filter>`,
771
- `<filter id="${t}_bSm" ${p}><feGaussianBlur stdDeviation="${m(0.9)}"/></filter>`,
772
- `<filter id="${t}_ebO" ${p}><feGaussianBlur stdDeviation="${m(oa)}"/></filter>`,
773
- `<filter id="${t}_ebC" ${p}><feGaussianBlur stdDeviation="${m(ra)}"/></filter>`,
774
- `<radialGradient id="${t}_fg" cx="0.5" cy="0.5" r="0.5"><stop offset="0" stop-color="white"/><stop offset="0.30" stop-color="white"/><stop offset="0.65" stop-color="#404040"/><stop offset="1" stop-color="black"/></radialGradient>`,
775
- `<mask id="${t}_fm" maskUnits="userSpaceOnUse" ${u}><rect ${u} fill="black"/><circle id="${t}_fc" cx="0" cy="0" r="${(ia * r).toFixed(3)}" fill="url(#${t}_fg)"/></mask>`,
776
- `<mask id="${t}_rm" maskUnits="userSpaceOnUse" ${u}><rect ${u} fill="#808080"/><rect x="0" y="0" width="${a}" height="${n}" rx="${o}" ry="${o}" fill="white"/><rect x="${s}" y="${s}" width="${a - s * 2}" height="${n - s * 2}" rx="${c}" ry="${c}" fill="black"/></mask>`,
738
+ `<filter id="${e}_bXl" ${h}><feGaussianBlur stdDeviation="${m(8.4)}"/></filter>`,
739
+ `<filter id="${e}_bLg" ${h}><feGaussianBlur stdDeviation="${m(4.8)}"/></filter>`,
740
+ `<filter id="${e}_bMd" ${h}><feGaussianBlur stdDeviation="${m(2.1)}"/></filter>`,
741
+ `<filter id="${e}_bSm" ${h}><feGaussianBlur stdDeviation="${m(0.9)}"/></filter>`,
742
+ `<filter id="${e}_ebO" ${h}><feGaussianBlur stdDeviation="${m(ao)}"/></filter>`,
743
+ `<filter id="${e}_ebC" ${h}><feGaussianBlur stdDeviation="${m(ro)}"/></filter>`,
744
+ `<radialGradient id="${e}_fg" cx="0.5" cy="0.5" r="0.5"><stop offset="0" stop-color="white"/><stop offset="0.30" stop-color="white"/><stop offset="0.65" stop-color="#404040"/><stop offset="1" stop-color="black"/></radialGradient>`,
745
+ `<mask id="${e}_fm" maskUnits="userSpaceOnUse" ${u}><rect ${u} fill="black"/><circle id="${e}_fc" cx="0" cy="0" r="${(io * r).toFixed(3)}" fill="url(#${e}_fg)"/></mask>`,
746
+ `<mask id="${e}_rm" maskUnits="userSpaceOnUse" ${u}><rect ${u} fill="#808080"/><rect x="0" y="0" width="${o}" height="${n}" rx="${a}" ry="${a}" fill="white"/><rect x="${s}" y="${s}" width="${o - s * 2}" height="${n - s * 2}" rx="${c}" ry="${c}" fill="black"/></mask>`,
777
747
  "</defs>",
778
- // Safari clips mask to the masked element's bbox; our horizontal strokes
779
- // have zero height, so the mask becomes a sliver. These spacer rects
780
- // inflate the bbox to the full filter region.
781
- `<g id="${t}_h" mask="url(#${t}_rm)" opacity="0">`,
748
+ `<g id="${e}_h" mask="url(#${e}_rm)" opacity="0">`,
782
749
  `<rect ${u} fill="none" pointer-events="none"/>`,
783
- `<g id="${t}_hI" stroke="white">`,
784
- `<path id="${t}_pXl" stroke-width="${h(26.4)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.385" filter="url(#${t}_bXl)"/>`,
785
- `<path id="${t}_pLg" stroke-width="${h(15.6)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.595" filter="url(#${t}_bLg)"/>`,
786
- `<path id="${t}_pMd" stroke-width="${h(7.2)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${t}_bMd)"/>`,
787
- `<path id="${t}_pSm" stroke-width="${h(3)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${t}_bSm)"/>`,
750
+ `<g id="${e}_hI" stroke="white">`,
751
+ `<path id="${e}_pXl" stroke-width="${p(26.4)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.385" filter="url(#${e}_bXl)"/>`,
752
+ `<path id="${e}_pLg" stroke-width="${p(15.6)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.595" filter="url(#${e}_bLg)"/>`,
753
+ `<path id="${e}_pMd" stroke-width="${p(7.2)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bMd)"/>`,
754
+ `<path id="${e}_pSm" stroke-width="${p(3)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bSm)"/>`,
788
755
  "</g></g>",
789
- `<g id="${t}_e" mask="url(#${t}_rm)" opacity="0">`,
756
+ `<g id="${e}_e" mask="url(#${e}_rm)" opacity="0">`,
790
757
  `<rect ${u} fill="none" pointer-events="none"/>`,
791
- `<g mask="url(#${t}_fm)">`,
792
- `<g id="${t}_eI" stroke="white">`,
793
- `<path id="${t}_eO" stroke-width="${h(aa)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.85" filter="url(#${t}_ebO)"/>`,
794
- `<path id="${t}_eC" stroke-width="${h(na)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="1.0" filter="url(#${t}_ebC)"/>`,
758
+ `<g mask="url(#${e}_fm)">`,
759
+ `<g id="${e}_eI" stroke="white">`,
760
+ `<path id="${e}_eO" stroke-width="${p(oo)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.85" filter="url(#${e}_ebO)"/>`,
761
+ `<path id="${e}_eC" stroke-width="${p(no)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="1.0" filter="url(#${e}_ebC)"/>`,
795
762
  "</g></g></g>"
796
763
  ].join("");
797
764
  }
798
- const da = 875e-5, Ge = 0.08, We = 0.32, fa = 0.05, ua = 3e3, ze = 0.85, ae = 0.34, me = 1500, ha = 15, pa = 75e-4, ma = 120, ga = 1.5, xa = 7.8, va = 9.13952, ba = 1, wa = 1 / 3, ya = 0.8, _a = 3.51, Be = 2e3, ge = 400, Ma = 2.625, Sa = 1.008, Ra = 0.31, lt = 140, ct = 40, dt = 20;
799
- let Aa = 0;
800
- const W = { x: 0, y: 0 };
801
- function De(e, t) {
802
- const a = `mfxg_${++Aa}`, n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
803
- n.setAttribute("class", "metal-fx-glow-svg"), n.setAttribute("preserveAspectRatio", "none"), n.setAttribute("viewBox", `0 0 ${t.width} ${t.height}`), n.innerHTML = ca(t, a), e.appendChild(n);
804
- const o = (x) => n.querySelector(`#${a}_${x}`), r = o("h"), s = o("hI"), c = o("e"), l = o("eI"), d = o("fc"), f = Se(t.width, t.height, t.cornerRadius, t.kind) / Me(lt, ct, dt), g = Math.max(1, xa * f), u = Math.max(0.6, va * wa * f), p = He(g, kt), h = He(u, Et), m = [o("pXl"), o("pLg"), o("pMd"), o("pSm")], A = [o("eO"), o("eC")];
805
- for (const x of m) x.setAttribute("d", p);
806
- for (const x of A) x.setAttribute("d", h);
807
- return s.style.transformOrigin = "0 0", l.style.transformOrigin = "0 0", s.style.willChange = "transform", l.style.willChange = "transform", s.style.transition = "transform 100ms linear", l.style.transition = "transform 100ms linear", r.style.willChange = "opacity", c.style.willChange = "opacity", r.style.transition = "opacity 100ms linear", c.style.transition = "opacity 100ms linear", d.style.willChange = "transform", {
765
+ const fo = 875e-5, Wt = 0.08, Gt = 0.32, uo = 0.05, po = 3e3, Dt = 0.85, ot = 0.34, mt = 1500, ho = 15, mo = 75e-4, go = 120, xo = 1.5, vo = 7.8, _o = 9.13952, bo = 1, wo = 1 / 3, yo = 0.8, Mo = 3.51, Bt = 2e3, gt = 400, Ro = 2.625, Ao = 1.008, So = 0.31, le = 140, ce = 40, fe = 20;
766
+ let Co = 0;
767
+ const G = { x: 0, y: 0 };
768
+ function zt(t, e) {
769
+ const o = `mfxg_${++Co}`, n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
770
+ n.setAttribute("class", "metal-fx-glow-svg"), n.setAttribute("preserveAspectRatio", "none"), n.setAttribute("viewBox", `0 0 ${e.width} ${e.height}`), n.innerHTML = co(e, o), t.appendChild(n);
771
+ const a = (x) => n.querySelector(`#${o}_${x}`), r = a("h"), s = a("hI"), c = a("e"), l = a("eI"), f = a("fc"), d = Rt(e.width, e.height, e.cornerRadius, e.kind) / Mt(le, ce, fe), g = Math.max(1, vo * d), u = Math.max(0.6, _o * wo * d), h = Ht(g, Ee), p = Ht(u, ke), m = [a("pXl"), a("pLg"), a("pMd"), a("pSm")], S = [a("eO"), a("eC")];
772
+ for (const x of m) x.setAttribute("d", h);
773
+ for (const x of S) x.setAttribute("d", p);
774
+ return s.style.transformOrigin = "0 0", l.style.transformOrigin = "0 0", s.style.willChange = "transform", l.style.willChange = "transform", s.style.transition = "transform 100ms linear", l.style.transition = "transform 100ms linear", r.style.willChange = "opacity", c.style.willChange = "opacity", r.style.transition = "opacity 100ms linear", c.style.transition = "opacity 100ms linear", f.style.willChange = "transform", {
808
775
  svg: n,
809
776
  haloGroup: r,
810
777
  haloInner: s,
811
778
  extraGroup: c,
812
779
  extraInner: l,
813
- fadeCircle: d,
814
- width: t.width,
815
- height: t.height,
816
- cornerRadius: t.cornerRadius,
817
- kind: t.kind,
818
- scale: t.scale ?? 1,
819
- perim: la(t),
780
+ fadeCircle: f,
781
+ width: e.width,
782
+ height: e.height,
783
+ cornerRadius: e.cornerRadius,
784
+ kind: e.kind,
785
+ scale: e.scale ?? 1,
786
+ perim: lo(e),
820
787
  currentIdx: 0,
821
788
  appearedAt: 0,
822
789
  glowOpacity: 0,
@@ -833,311 +800,309 @@ function De(e, t) {
833
800
  lastExtraStroke: ""
834
801
  };
835
802
  }
836
- function Ta(e, t, a, n, o = "dark") {
803
+ function To(t, e, o, n, a = "dark") {
837
804
  var B;
838
- const { width: r, height: s, cornerRadius: c, perim: l } = e;
805
+ const { width: r, height: s, cornerRadius: c, perim: l } = t;
839
806
  if (l.length === 0) return;
840
- const d = 2;
841
- let f = -1, g = e.currentIdx, u = 0;
842
- for (let k = 0; k < l.length; k++) {
843
- const I = l[k], H = Pe(t, I.x, I.y, d);
844
- H > f && (f = H, g = k), k === e.currentIdx && (u = H);
807
+ const f = 2;
808
+ let d = -1, g = t.currentIdx, u = 0;
809
+ for (let E = 0; E < l.length; E++) {
810
+ const O = l[E], H = Pt(e, O.x, O.y, f);
811
+ H > d && (d = H, g = E), E === t.currentIdx && (u = H);
845
812
  }
846
- const p = e.appearedAt > 0 && a - e.appearedAt < ua, h = ae + (ze - ae) * Ne(Ge, We, u), m = !p && f - u > fa;
847
- if (!e.relocTween || e.relocTween.done)
848
- if (e.appearedAt === 0)
849
- e.currentIdx = g, e.appearedAt = a, e.wanderS = 0, e.wanderTargetS = 0, e.wanderFrames = 0, e.relocTween = V(0, h, me, oe.smoothstep), q(e.relocTween, a);
850
- else if ((B = e.relocTween) != null && B.done && e.relocTween.to === 0) {
851
- e.currentIdx = e.relocNextIdx, e.appearedAt = a, e.wanderS = 0, e.wanderTargetS = 0, e.wanderFrames = 0;
852
- const k = l[e.currentIdx], I = Pe(t, k.x, k.y, d), H = ae + (ze - ae) * Ne(Ge, We, I);
853
- e.relocTween = V(0, H, me, oe.smoothstep), q(e.relocTween, a);
854
- } else m ? (e.relocNextIdx = g, e.relocTween = V(e.glowOpacity, 0, me, oe.smoothstep), q(e.relocTween, a)) : e.glowOpacity += (h - e.glowOpacity) * da;
855
- e.relocTween && (e.glowOpacity = $e(e.relocTween, a)), e.glowOpacity = Math.max(0, Math.min(1, e.glowOpacity));
856
- const A = Se(r, s, c, e.kind) / Me(lt, ct, dt), x = ha * A;
857
- e.wanderFrames++ >= ma && (e.wanderTargetS = (Math.random() * 2 - 1) * x, e.wanderFrames = 0), e.wanderS += (e.wanderTargetS - e.wanderS) * pa;
858
- const E = l[e.currentIdx].arc + e.wanderS, M = ga * e.scale;
859
- Z(E, r, s, c, M, 0, e.kind, W);
860
- const O = W.x, P = W.y, y = sa(E, r, s, c, M, e.kind), w = `translate(${O.toFixed(3)}px,${P.toFixed(3)}px) rotate(${y.toFixed(4)}rad)`;
861
- e.haloInner.style.transform = w;
862
- const S = ba * A * e.scale;
863
- Z(E, r, s, c, M, S, e.kind, W), e.extraInner.style.transform = `translate(${W.x.toFixed(3)}px,${W.y.toFixed(3)}px) rotate(${y.toFixed(4)}rad)`, e.fadeCircle.style.transform = `translate(${W.x.toFixed(3)}px,${W.y.toFixed(3)}px)`;
864
- const R = o === "light", v = R ? Dt(t, O, P, d) : Bt(t, O, P, d);
865
- e.tintTween ? e.tintTween.done && (R ? (e.tintFrom = {
866
- r: e.tintFrom.r + (e.tintTarget.r - e.tintFrom.r) * e.tintTween.val,
867
- g: e.tintFrom.g + (e.tintTarget.g - e.tintFrom.g) * e.tintTween.val,
868
- b: e.tintFrom.b + (e.tintTarget.b - e.tintFrom.b) * e.tintTween.val
869
- }, e.tintTarget = { ...v }, e.tintTween = V(0, 1, ge), q(e.tintTween, a)) : a >= e.tintHoldUntil && (e.tintFrom = { ...e.tintTarget }, e.tintTarget = { ...v }, e.tintTween = V(0, 1, ge), q(e.tintTween, a), e.tintHoldUntil = a + Be)) : (e.tintFrom = { ...v }, e.tintTarget = { ...v }, e.tintTween = V(0, 1, ge), q(e.tintTween, a), e.tintHoldUntil = R ? 0 : a + Be), $e(e.tintTween, a);
870
- const b = e.tintTween.val;
871
- let F, L, _;
872
- if (R)
873
- F = Math.round(e.tintFrom.r + (e.tintTarget.r - e.tintFrom.r) * b), L = Math.round(e.tintFrom.g + (e.tintTarget.g - e.tintFrom.g) * b), _ = Math.round(e.tintFrom.b + (e.tintTarget.b - e.tintFrom.b) * b);
813
+ const h = t.appearedAt > 0 && o - t.appearedAt < po, p = ot + (Dt - ot) * Nt(Wt, Gt, u), m = !h && d - u > uo;
814
+ if (!t.relocTween || t.relocTween.done)
815
+ if (t.appearedAt === 0)
816
+ t.currentIdx = g, t.appearedAt = o, t.wanderS = 0, t.wanderTargetS = 0, t.wanderFrames = 0, t.relocTween = q(0, p, mt, at.smoothstep), Y(t.relocTween, o);
817
+ else if ((B = t.relocTween) != null && B.done && t.relocTween.to === 0) {
818
+ t.currentIdx = t.relocNextIdx, t.appearedAt = o, t.wanderS = 0, t.wanderTargetS = 0, t.wanderFrames = 0;
819
+ const E = l[t.currentIdx], O = Pt(e, E.x, E.y, f), H = ot + (Dt - ot) * Nt(Wt, Gt, O);
820
+ t.relocTween = q(0, H, mt, at.smoothstep), Y(t.relocTween, o);
821
+ } else m ? (t.relocNextIdx = g, t.relocTween = q(t.glowOpacity, 0, mt, at.smoothstep), Y(t.relocTween, o)) : t.glowOpacity += (p - t.glowOpacity) * fo;
822
+ t.relocTween && (t.glowOpacity = $t(t.relocTween, o)), t.glowOpacity = Math.max(0, Math.min(1, t.glowOpacity));
823
+ const S = Rt(r, s, c, t.kind) / Mt(le, ce, fe), x = ho * S;
824
+ t.wanderFrames++ >= go && (t.wanderTargetS = (Math.random() * 2 - 1) * x, t.wanderFrames = 0), t.wanderS += (t.wanderTargetS - t.wanderS) * mo;
825
+ const k = l[t.currentIdx].arc + t.wanderS, M = xo * t.scale;
826
+ J(k, r, s, c, M, 0, t.kind, G);
827
+ const L = G.x, P = G.y, w = so(k, r, s, c, M, t.kind), b = `translate(${L.toFixed(3)}px,${P.toFixed(3)}px) rotate(${w.toFixed(4)}rad)`;
828
+ t.haloInner.style.transform = b;
829
+ const R = bo * S * t.scale;
830
+ J(k, r, s, c, M, R, t.kind, G), t.extraInner.style.transform = `translate(${G.x.toFixed(3)}px,${G.y.toFixed(3)}px) rotate(${w.toFixed(4)}rad)`, t.fadeCircle.style.transform = `translate(${G.x.toFixed(3)}px,${G.y.toFixed(3)}px)`;
831
+ const A = a === "light", v = A ? ze(e, L, P, f) : Be(e, L, P, f);
832
+ t.tintTween ? t.tintTween.done && (A ? (t.tintFrom = {
833
+ r: t.tintFrom.r + (t.tintTarget.r - t.tintFrom.r) * t.tintTween.val,
834
+ g: t.tintFrom.g + (t.tintTarget.g - t.tintFrom.g) * t.tintTween.val,
835
+ b: t.tintFrom.b + (t.tintTarget.b - t.tintFrom.b) * t.tintTween.val
836
+ }, t.tintTarget = { ...v }, t.tintTween = q(0, 1, gt), Y(t.tintTween, o)) : o >= t.tintHoldUntil && (t.tintFrom = { ...t.tintTarget }, t.tintTarget = { ...v }, t.tintTween = q(0, 1, gt), Y(t.tintTween, o), t.tintHoldUntil = o + Bt)) : (t.tintFrom = { ...v }, t.tintTarget = { ...v }, t.tintTween = q(0, 1, gt), Y(t.tintTween, o), t.tintHoldUntil = A ? 0 : o + Bt), $t(t.tintTween, o);
837
+ const _ = t.tintTween.val;
838
+ let F, I, y;
839
+ if (A)
840
+ F = Math.round(t.tintFrom.r + (t.tintTarget.r - t.tintFrom.r) * _), I = Math.round(t.tintFrom.g + (t.tintTarget.g - t.tintFrom.g) * _), y = Math.round(t.tintFrom.b + (t.tintTarget.b - t.tintFrom.b) * _);
874
841
  else {
875
- const k = e.tintFrom.r + (e.tintTarget.r - e.tintFrom.r) * b, I = e.tintFrom.g + (e.tintTarget.g - e.tintFrom.g) * b, H = e.tintFrom.b + (e.tintTarget.b - e.tintFrom.b) * b, G = Math.max(k, I, H) || 1;
876
- F = Math.round(255 * (k / G)), L = Math.round(255 * (I / G)), _ = Math.round(255 * (H / G));
842
+ const E = t.tintFrom.r + (t.tintTarget.r - t.tintFrom.r) * _, O = t.tintFrom.g + (t.tintTarget.g - t.tintFrom.g) * _, H = t.tintFrom.b + (t.tintTarget.b - t.tintFrom.b) * _, W = Math.max(E, O, H) || 1;
843
+ F = Math.round(255 * (E / W)), I = Math.round(255 * (O / W)), y = Math.round(255 * (H / W));
877
844
  }
878
- const C = `rgb(${F},${L},${_})`;
879
- if (C !== e.lastHaloStroke && (e.lastHaloStroke = C, e.haloInner.style.stroke = C), R) {
880
- const k = Mt(F, L, _), [I, H, G] = St(k[0], Math.min(1, k[1] * Ma), Math.max(Ra, k[2] * Sa)), D = `rgb(${I},${H},${G})`;
881
- D !== e.lastExtraStroke && (e.lastExtraStroke = D, e.extraInner.style.stroke = D);
882
- } else e.lastExtraStroke !== "#ffffff" && (e.lastExtraStroke = "#ffffff", e.extraInner.style.stroke = "#ffffff");
845
+ const T = `rgb(${F},${I},${y})`;
846
+ if (T !== t.lastHaloStroke && (t.lastHaloStroke = T, t.haloInner.style.stroke = T), A) {
847
+ const E = Me(F, I, y), [O, H, W] = Re(E[0], Math.min(1, E[1] * Ro), Math.max(So, E[2] * Ao)), z = `rgb(${O},${H},${W})`;
848
+ z !== t.lastExtraStroke && (t.lastExtraStroke = z, t.extraInner.style.stroke = z);
849
+ } else t.lastExtraStroke !== "#ffffff" && (t.lastExtraStroke = "#ffffff", t.extraInner.style.stroke = "#ffffff");
883
850
  const $ = Math.max(0, Math.min(1, n));
884
- e.haloGroup.style.opacity = (e.glowOpacity * ya * $).toFixed(3), e.extraGroup.style.opacity = Math.min(1, e.glowOpacity * _a * $).toFixed(3);
851
+ t.haloGroup.style.opacity = (t.glowOpacity * yo * $).toFixed(3), t.extraGroup.style.opacity = Math.min(1, t.glowOpacity * Mo * $).toFixed(3);
885
852
  }
886
- const we = 12, Ue = 32, Xe = 1, Ve = 0.55, Ca = 1, ka = 1, Ea = 0.85, La = 0, Oa = 1.3, qe = 3.6, Ia = 0.7, Pa = 1, Fa = 0.52, $a = 1, Ha = 0.044, Na = 235, Ga = 2.535, Wa = 0.7, za = 0.5, Ba = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT", "OPTION"]);
887
- function Da(e, t) {
888
- const a = Math.max(e.left - t.right, t.left - e.right, 0), n = Math.max(e.top - t.bottom, t.top - e.bottom, 0);
889
- return Math.sqrt(a * a + n * n);
853
+ const bt = 12, Ut = 32, Xt = 1, qt = 0.55, Eo = 1, ko = 1, Io = 0.85, Lo = 0, Oo = 1.3, Yt = 3.6, Po = 0.7, Fo = 1, $o = 0.52, Ho = 1, No = 0.044, Wo = 235, Go = 2.535, Do = 0.7, Bo = 0.5, zo = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT", "OPTION"]);
854
+ function Uo(t, e) {
855
+ const o = Math.max(t.left - e.right, e.left - t.right, 0), n = Math.max(t.top - e.bottom, e.top - t.bottom, 0);
856
+ return Math.sqrt(o * o + n * n);
890
857
  }
891
- function Ua(e, t, a, n) {
892
- return !(Math.min(e.bottom, t.bottom) - Math.max(e.top, t.top) < a || Math.max(
893
- e.left - t.right,
858
+ function Xo(t, e, o, n) {
859
+ return !(Math.min(t.bottom, e.bottom) - Math.max(t.top, e.top) < o || Math.max(
894
860
  t.left - e.right,
861
+ e.left - t.right,
895
862
  0
896
863
  ) > n);
897
864
  }
898
- function Xa(e, t, a, n) {
899
- return Math.min(e.right, t.right) - Math.max(e.left, t.left) < a ? !1 : Math.max(
900
- e.top - t.bottom,
865
+ function qo(t, e, o, n) {
866
+ return Math.min(t.right, e.right) - Math.max(t.left, e.left) < o ? !1 : Math.max(
901
867
  t.top - e.bottom,
868
+ e.top - t.bottom,
902
869
  0
903
870
  ) <= n;
904
871
  }
905
- function U(e, t, a, n, o, r) {
906
- const s = Math.max(0, Math.min(r, n * 0.5, o * 0.5)), c = e.roundRect;
872
+ function U(t, e, o, n, a, r) {
873
+ const s = Math.max(0, Math.min(r, n * 0.5, a * 0.5)), c = t.roundRect;
907
874
  if (typeof c == "function") {
908
- c.call(e, t, a, n, o, s);
875
+ c.call(t, e, o, n, a, s);
909
876
  return;
910
877
  }
911
- e.moveTo(t + s, a), e.lineTo(t + n - s, a), e.quadraticCurveTo(t + n, a, t + n, a + s), e.lineTo(t + n, a + o - s), e.quadraticCurveTo(t + n, a + o, t + n - s, a + o), e.lineTo(t + s, a + o), e.quadraticCurveTo(t, a + o, t, a + o - s), e.lineTo(t, a + s), e.quadraticCurveTo(t, a, t + s, a);
878
+ t.moveTo(e + s, o), t.lineTo(e + n - s, o), t.quadraticCurveTo(e + n, o, e + n, o + s), t.lineTo(e + n, o + a - s), t.quadraticCurveTo(e + n, o + a, e + n - s, o + a), t.lineTo(e + s, o + a), t.quadraticCurveTo(e, o + a, e, o + a - s), t.lineTo(e, o + s), t.quadraticCurveTo(e, o, e + s, o);
912
879
  }
913
- function ft(e, t, a, n, o) {
914
- if (!o.flipX && !o.flipY) {
915
- e.drawImage(t, 0, 0, a, n, o.x, o.y, o.w, o.h);
880
+ function de(t, e, o, n, a) {
881
+ if (!a.flipX && !a.flipY) {
882
+ t.drawImage(e, 0, 0, o, n, a.x, a.y, a.w, a.h);
916
883
  return;
917
884
  }
918
- e.save(), o.flipX && (e.translate(o.x + o.w, 0), e.scale(-1, 1)), o.flipY && (e.translate(0, o.y + o.h), e.scale(1, -1)), e.drawImage(
919
- t,
885
+ t.save(), a.flipX && (t.translate(a.x + a.w, 0), t.scale(-1, 1)), a.flipY && (t.translate(0, a.y + a.h), t.scale(1, -1)), t.drawImage(
886
+ e,
920
887
  0,
921
888
  0,
922
- a,
889
+ o,
923
890
  n,
924
- o.flipX ? 0 : o.x,
925
- o.flipY ? 0 : o.y,
926
- o.w,
927
- o.h
928
- ), e.restore();
929
- }
930
- const Va = 4;
931
- function qa(e, t, a, n, o, r, s) {
932
- if (n <= 2 * s || o <= 2 * s) {
933
- e.beginPath(), U(e, t, a, n, o, r), e.clip();
891
+ a.flipX ? 0 : a.x,
892
+ a.flipY ? 0 : a.y,
893
+ a.w,
894
+ a.h
895
+ ), t.restore();
896
+ }
897
+ const Yo = 4;
898
+ function Vo(t, e, o, n, a, r, s) {
899
+ if (n <= 2 * s || a <= 2 * s) {
900
+ t.beginPath(), U(t, e, o, n, a, r), t.clip();
934
901
  return;
935
902
  }
936
- e.beginPath(), U(e, t, a, n, o, r), U(e, t + s, a + s, n - 2 * s, o - 2 * s, Math.max(0, r - s)), e.clip("evenodd");
903
+ t.beginPath(), U(t, e, o, n, a, r), U(t, e + s, o + s, n - 2 * s, a - 2 * s, Math.max(0, r - s)), t.clip("evenodd");
937
904
  }
938
- function Ya(e, t, a, n, o, r, s, c, l, d, f) {
939
- const g = Math.max(1, Math.round((we + Va * 3) * f));
940
- let u = Math.max(0, s), p = !0;
941
- for (let h = 0; h < 3 && u > 1e-4; h++) {
905
+ function jo(t, e, o, n, a, r, s, c, l, f, d) {
906
+ const g = Math.max(1, Math.round((bt + Yo * 3) * d));
907
+ let u = Math.max(0, s), h = !0;
908
+ for (let p = 0; p < 3 && u > 1e-4; p++) {
942
909
  const m = Math.min(1, u);
943
- e.save(), qa(e, d.x, d.y, d.w, d.h, d.r, g), e.globalCompositeOperation = p ? "source-over" : "lighter", p = !1, e.globalAlpha = m, ft(e, t, a, n, l), e.globalAlpha = 1, e.globalCompositeOperation = "destination-in", e.fillStyle = c, e.fillRect(0, 0, o, r), e.restore(), u -= m;
910
+ t.save(), Vo(t, f.x, f.y, f.w, f.h, f.r, g), t.globalCompositeOperation = h ? "source-over" : "lighter", h = !1, t.globalAlpha = m, de(t, e, o, n, l), t.globalAlpha = 1, t.globalCompositeOperation = "destination-in", t.fillStyle = c, t.fillRect(0, 0, a, r), t.restore(), u -= m;
944
911
  }
945
912
  }
946
- function ut(e, t, a, n, o, r, s) {
913
+ function ue(t, e, o, n, a, r, s) {
947
914
  const c = s | 0;
948
- if (c < 1 || n <= 2 * c || o <= 2 * c) {
949
- e.beginPath(), U(e, t, a, n, o, r), e.clip();
915
+ if (c < 1 || n <= 2 * c || a <= 2 * c) {
916
+ t.beginPath(), U(t, e, o, n, a, r), t.clip();
950
917
  return;
951
918
  }
952
- e.beginPath(), U(e, t, a, n, o, r), U(e, t + c, a + c, n - 2 * c, o - 2 * c, Math.max(0, r - c)), e.clip("evenodd");
919
+ t.beginPath(), U(t, e, o, n, a, r), U(t, e + c, o + c, n - 2 * c, a - 2 * c, Math.max(0, r - c)), t.clip("evenodd");
953
920
  }
954
- function ja(e, t, a, n, o, r, s, c, l, d, f, g) {
955
- let u = c * f, p = !0;
956
- for (let h = 0; h < 3 && u > 1e-4; h++) {
921
+ function Ko(t, e, o, n, a, r, s, c, l, f, d, g) {
922
+ let u = c * d, h = !0;
923
+ for (let p = 0; p < 3 && u > 1e-4; p++) {
957
924
  const m = Math.min(1, u);
958
- e.save(), ut(e, s.x, s.y, s.w, s.h, s.r, l), e.globalCompositeOperation = p ? "source-over" : "lighter", p = !1, e.globalAlpha = m, ft(e, t, a, n, g), e.globalAlpha = 1, e.globalCompositeOperation = "destination-in", e.fillStyle = d, e.fillRect(0, 0, o, r), e.restore(), u -= m;
925
+ t.save(), ue(t, s.x, s.y, s.w, s.h, s.r, l), t.globalCompositeOperation = h ? "source-over" : "lighter", h = !1, t.globalAlpha = m, de(t, e, o, n, g), t.globalAlpha = 1, t.globalCompositeOperation = "destination-in", t.fillStyle = f, t.fillRect(0, 0, a, r), t.restore(), u -= m;
959
926
  }
960
927
  }
961
- function Ka(e, t, a, n, o, r, s, c) {
962
- const l = e.createLinearGradient(n, o, r, s);
963
- l.addColorStop(0, `rgba(255,255,255,${c.toFixed(3)})`), l.addColorStop(0.5, `rgba(255,255,255,${(c * 0.45).toFixed(3)})`), l.addColorStop(1, "rgba(255,255,255,0)"), e.save(), ut(e, t.x, t.y, t.w, t.h, t.r, a), e.globalCompositeOperation = "lighter", e.lineWidth = a * 2, e.strokeStyle = l, e.beginPath(), U(e, t.x, t.y, t.w, t.h, t.r), e.stroke(), e.restore();
928
+ function Qo(t, e, o, n, a, r, s, c) {
929
+ const l = t.createLinearGradient(n, a, r, s);
930
+ l.addColorStop(0, `rgba(255,255,255,${c.toFixed(3)})`), l.addColorStop(0.5, `rgba(255,255,255,${(c * 0.45).toFixed(3)})`), l.addColorStop(1, "rgba(255,255,255,0)"), t.save(), ue(t, e.x, e.y, e.w, e.h, e.r, o), t.globalCompositeOperation = "lighter", t.lineWidth = o * 2, t.strokeStyle = l, t.beginPath(), U(t, e.x, e.y, e.w, e.h, e.r), t.stroke(), t.restore();
964
931
  }
965
- function ht(e) {
966
- const t = getComputedStyle(e), a = [
967
- parseFloat(t.borderTopLeftRadius) || 0,
968
- parseFloat(t.borderTopRightRadius) || 0,
969
- parseFloat(t.borderBottomRightRadius) || 0,
970
- parseFloat(t.borderBottomLeftRadius) || 0
932
+ function pe(t) {
933
+ const e = getComputedStyle(t), o = [
934
+ parseFloat(e.borderTopLeftRadius) || 0,
935
+ parseFloat(e.borderTopRightRadius) || 0,
936
+ parseFloat(e.borderBottomRightRadius) || 0,
937
+ parseFloat(e.borderBottomLeftRadius) || 0
971
938
  ].filter((n) => n > 0);
972
- return a.length ? Math.min.apply(null, a) : 0;
973
- }
974
- function pt(e) {
975
- const t = getComputedStyle(e), a = Math.max(
976
- parseFloat(t.borderTopWidth) || 0,
977
- parseFloat(t.borderRightWidth) || 0,
978
- parseFloat(t.borderBottomWidth) || 0,
979
- parseFloat(t.borderLeftWidth) || 0
939
+ return o.length ? Math.min.apply(null, o) : 0;
940
+ }
941
+ function he(t) {
942
+ const e = getComputedStyle(t), o = Math.max(
943
+ parseFloat(e.borderTopWidth) || 0,
944
+ parseFloat(e.borderRightWidth) || 0,
945
+ parseFloat(e.borderBottomWidth) || 0,
946
+ parseFloat(e.borderLeftWidth) || 0
980
947
  );
981
- let n = 0, o = 0;
982
- const r = t.boxShadow;
948
+ let n = 0, a = 0;
949
+ const r = e.boxShadow;
983
950
  if (r && r !== "none") {
984
- const d = r.replace(/rgba?\([^)]*\)/g, (u) => u.replace(/,/g, "\0")).split(/,\s*/);
985
- let f = 1 / 0, g = 1 / 0;
986
- for (const u of d) {
987
- const p = u.match(/-?\d+(?:\.\d+)?px/g);
988
- if (!p || p.length < 4) continue;
989
- const h = parseFloat(p[3]);
990
- h > 0 && (/\binset\b/.test(u) ? h < f && (f = h) : h < g && (g = h));
951
+ const f = r.replace(/rgba?\([^)]*\)/g, (u) => u.replace(/,/g, "\0")).split(/,\s*/);
952
+ let d = 1 / 0, g = 1 / 0;
953
+ for (const u of f) {
954
+ const h = u.match(/-?\d+(?:\.\d+)?px/g);
955
+ if (!h || h.length < 4) continue;
956
+ const p = parseFloat(h[3]);
957
+ p > 0 && (/\binset\b/.test(u) ? p < d && (d = p) : p < g && (g = p));
991
958
  }
992
- Number.isFinite(f) && (n = f), Number.isFinite(g) && (o = g);
959
+ Number.isFinite(d) && (n = d), Number.isFinite(g) && (a = g);
993
960
  }
994
- const s = Math.max(a, o);
995
- return { width: Math.max(a, n, o) || 1, outerCssPx: s };
961
+ const s = Math.max(o, a);
962
+ return { width: Math.max(o, n, a) || 1, outerCssPx: s };
996
963
  }
997
- function Ye(e) {
998
- e.cornerRadius = ht(e.el);
999
- const t = pt(e.el);
1000
- e.hairlineWidth = t.width, e.hairlineOuterCssPx = t.outerCssPx;
964
+ function Vt(t) {
965
+ t.cornerRadius = pe(t.el);
966
+ const e = he(t.el);
967
+ t.hairlineWidth = e.width, t.hairlineOuterCssPx = e.outerCssPx;
1001
968
  }
1002
- function Qa(e) {
1003
- typeof ResizeObserver < "u" && (e.resizeObserver = new ResizeObserver(() => Ye(e)), e.resizeObserver.observe(e.el)), typeof MutationObserver < "u" && (e.mutationObserver = new MutationObserver(() => Ye(e)), e.mutationObserver.observe(e.el, {
969
+ function Zo(t) {
970
+ typeof ResizeObserver < "u" && (t.resizeObserver = new ResizeObserver(() => Vt(t)), t.resizeObserver.observe(t.el)), typeof MutationObserver < "u" && (t.mutationObserver = new MutationObserver(() => Vt(t)), t.mutationObserver.observe(t.el, {
1004
971
  attributes: !0,
1005
972
  attributeFilter: ["style", "class"]
1006
973
  }));
1007
974
  }
1008
- function Ja(e) {
1009
- var t, a;
1010
- (t = e.resizeObserver) == null || t.disconnect(), e.resizeObserver = null, (a = e.mutationObserver) == null || a.disconnect(), e.mutationObserver = null;
975
+ function Jo(t) {
976
+ var e, o;
977
+ (e = t.resizeObserver) == null || e.disconnect(), t.resizeObserver = null, (o = t.mutationObserver) == null || o.disconnect(), t.mutationObserver = null;
1011
978
  }
1012
979
  const j = /* @__PURE__ */ new Set();
1013
- function Za(e, t, a) {
1014
- if (typeof document > "u" || Ba.has(e.tagName)) return null;
1015
- for (const p of j)
1016
- if (p.el === e) return p;
980
+ function tn(t, e, o) {
981
+ if (typeof document > "u" || zo.has(t.tagName)) return null;
982
+ for (const h of j)
983
+ if (h.el === t) return h;
1017
984
  const n = document.createElement("div");
1018
985
  n.setAttribute("data-metal-fx-reflection", ""), n.setAttribute("aria-hidden", "true");
1019
- const o = document.createElement("canvas");
1020
- o.className = "metal-fx-reflection-canvas";
1021
- const r = o.getContext("2d", { alpha: !0 });
986
+ const a = document.createElement("canvas");
987
+ a.className = "metal-fx-reflection-canvas";
988
+ const r = a.getContext("2d", { alpha: !0 });
1022
989
  if (!r) return null;
1023
990
  const s = document.createElement("canvas");
1024
991
  s.className = "metal-fx-reflection-stroke-canvas";
1025
992
  const c = s.getContext("2d", { alpha: !0 });
1026
993
  if (!c) return null;
1027
- n.appendChild(o), n.appendChild(s);
1028
- const l = getComputedStyle(e);
1029
- let d = !1;
1030
- l.position === "static" && (e.style.position = "relative", d = !0);
994
+ n.appendChild(a), n.appendChild(s);
995
+ const l = getComputedStyle(t);
1031
996
  let f = !1;
1032
- l.isolation !== "isolate" && (e.style.isolation = "isolate", f = !0), e.setAttribute("data-metal-fx-reflect-host", ""), e.insertBefore(n, e.firstChild);
1033
- const g = pt(e), u = {
1034
- el: e,
1035
- anchor: t,
1036
- anchorEl: a,
997
+ l.position === "static" && (t.style.position = "relative", f = !0);
998
+ let d = !1;
999
+ l.isolation !== "isolate" && (t.style.isolation = "isolate", d = !0), t.setAttribute("data-metal-fx-reflect-host", ""), t.insertBefore(n, t.firstChild);
1000
+ const g = he(t), u = {
1001
+ el: t,
1002
+ anchor: e,
1003
+ anchorEl: o,
1037
1004
  wrap: n,
1038
- canvas: o,
1005
+ canvas: a,
1039
1006
  ctx: r,
1040
1007
  strokeCanvas: s,
1041
1008
  strokeCtx: c,
1042
- cornerRadius: ht(e),
1009
+ cornerRadius: pe(t),
1043
1010
  hairlineWidth: g.width,
1044
1011
  hairlineOuterCssPx: g.outerCssPx,
1045
- appliedPositionRelative: d,
1046
- appliedIsolation: f,
1012
+ appliedPositionRelative: f,
1013
+ appliedIsolation: d,
1047
1014
  resizeObserver: null,
1048
1015
  mutationObserver: null
1049
1016
  };
1050
- return Qa(u), j.add(u), u;
1017
+ return Zo(u), j.add(u), u;
1051
1018
  }
1052
- function en(e) {
1053
- for (const t of j)
1054
- if (t.el === e) {
1055
- Ja(t), t.canvas.width = 0, t.canvas.height = 0, t.strokeCanvas.width = 0, t.strokeCanvas.height = 0, t.wrap.parentNode === t.el && t.el.removeChild(t.wrap), t.el.removeAttribute("data-metal-fx-reflect-host"), t.appliedPositionRelative && (t.el.style.position = ""), t.appliedIsolation && (t.el.style.isolation = ""), j.delete(t);
1019
+ function en(t) {
1020
+ for (const e of j)
1021
+ if (e.el === t) {
1022
+ Jo(e), e.canvas.width = 0, e.canvas.height = 0, e.strokeCanvas.width = 0, e.strokeCanvas.height = 0, e.wrap.parentNode === e.el && e.el.removeChild(e.wrap), e.el.removeAttribute("data-metal-fx-reflect-host"), e.appliedPositionRelative && (e.el.style.position = ""), e.appliedIsolation && (e.el.style.isolation = ""), j.delete(e);
1056
1023
  return;
1057
1024
  }
1058
1025
  }
1059
- function tn() {
1026
+ function on() {
1060
1027
  if (j.size === 0) return;
1061
- const e = typeof window < "u" && window.devicePixelRatio || 1, t = /* @__PURE__ */ new Map();
1062
- for (const a of j) {
1063
- const n = a.el.getBoundingClientRect();
1064
- let o = t.get(a.anchorEl);
1065
- if (o || (o = a.anchorEl.getBoundingClientRect(), t.set(a.anchorEl, o)), n.width < 1 || n.height < 1 || o.width < 1 || o.height < 1) continue;
1066
- if (!Ua(o, n, Xe, Ue) && !Xa(o, n, Xe, Ue)) {
1067
- a.canvas.width !== 1 && (a.canvas.width = 1, a.canvas.height = 1), a.strokeCanvas.width !== 1 && (a.strokeCanvas.width = 1, a.strokeCanvas.height = 1);
1028
+ const t = typeof window < "u" && window.devicePixelRatio || 1, e = /* @__PURE__ */ new Map();
1029
+ for (const o of j) {
1030
+ const n = o.el.getBoundingClientRect();
1031
+ let a = e.get(o.anchorEl);
1032
+ if (a || (a = o.anchorEl.getBoundingClientRect(), e.set(o.anchorEl, a)), n.width < 1 || n.height < 1 || a.width < 1 || a.height < 1) continue;
1033
+ if (!Xo(a, n, Xt, Ut) && !qo(a, n, Xt, Ut)) {
1034
+ o.canvas.width !== 1 && (o.canvas.width = 1, o.canvas.height = 1), o.strokeCanvas.width !== 1 && (o.strokeCanvas.width = 1, o.strokeCanvas.height = 1);
1068
1035
  continue;
1069
1036
  }
1070
- const r = a.anchor.canvas, s = r.width | 0, c = r.height | 0;
1037
+ const r = o.anchor.canvas, s = r.width | 0, c = r.height | 0;
1071
1038
  if (s < 4 || c < 4) continue;
1072
- const l = (o.left + o.right) * 0.5, d = (o.top + o.bottom) * 0.5, f = (n.left + n.right) * 0.5, g = (n.top + n.bottom) * 0.5, u = l - f, p = d - g, h = Math.max(o.left - n.right, n.left - o.right, 0), m = Math.max(o.top - n.bottom, n.top - o.bottom, 0), A = h >= m, x = Da(o, n);
1073
- let E = 1 - Math.min(1, x / we);
1074
- E = E * E * (3 - 2 * E);
1075
- const M = Ve + (Ca - Ve) * E, O = Math.min(
1076
- qe,
1077
- M * Oa * Ia
1078
- ), P = a.anchor.scale ?? 1, y = Math.max(Pa * P, a.hairlineWidth), w = Math.max(1, Math.round(y * e)), S = Math.max(
1039
+ const l = (a.left + a.right) * 0.5, f = (a.top + a.bottom) * 0.5, d = (n.left + n.right) * 0.5, g = (n.top + n.bottom) * 0.5, u = l - d, h = f - g, p = Math.max(a.left - n.right, n.left - a.right, 0), m = Math.max(a.top - n.bottom, n.top - a.bottom, 0), S = p >= m, x = Uo(a, n);
1040
+ let k = 1 - Math.min(1, x / bt);
1041
+ k = k * k * (3 - 2 * k);
1042
+ const M = qt + (Eo - qt) * k, L = Math.min(
1043
+ Yt,
1044
+ M * Oo * Po
1045
+ ), P = o.anchor.scale ?? 1, w = Math.max(Fo * P, o.hairlineWidth), b = Math.max(1, Math.round(w * t)), R = Math.max(
1079
1046
  1,
1080
- Math.round(Math.max($a * P, a.hairlineWidth) * e)
1081
- ), R = a.hairlineOuterCssPx;
1082
- a.wrap.style.inset = `${-R}px`, a.wrap.style.borderRadius = `${Math.max(0, a.cornerRadius)}px`;
1083
- const v = Math.max(1, Math.round((n.width + R * 2) * e)), b = Math.max(1, Math.round((n.height + R * 2) * e));
1084
- a.canvas.width !== v && (a.canvas.width = v), a.canvas.height !== b && (a.canvas.height = b), a.strokeCanvas.width !== v && (a.strokeCanvas.width = v), a.strokeCanvas.height !== b && (a.strokeCanvas.height = b);
1085
- const F = a.ctx;
1086
- F.setTransform(1, 0, 0, 1, 0, 0), F.clearRect(0, 0, v, b);
1087
- const L = a.strokeCtx;
1088
- L.setTransform(1, 0, 0, 1, 0, 0), L.clearRect(0, 0, v, b);
1089
- const _ = Math.min(we * e, Math.max(v, b));
1090
- let C, $, B, k;
1091
- A ? (C = u > 0 ? v : 0, B = u > 0 ? v - _ : _, $ = b * 0.5, k = b * 0.5) : ($ = p > 0 ? b : 0, k = p > 0 ? b - _ : _, C = v * 0.5, B = v * 0.5);
1092
- const I = F.createLinearGradient(C, $, B, k);
1093
- I.addColorStop(0, `rgba(0,0,0,${ka})`), I.addColorStop(0.5, `rgba(0,0,0,${Ea})`), I.addColorStop(1, `rgba(0,0,0,${La})`);
1094
- const H = s / e, G = Math.max(1, Math.round(Na * Math.max(0.1, H / 140) * e));
1095
- let D, se, le, ce, Re = !1, Ae = !1;
1096
- if (A) {
1097
- const Q = Math.max(o.top, n.top), fe = Math.min(o.bottom, n.bottom);
1098
- Re = !0, D = u > 0 ? v - G : 0, se = Math.round((Q - n.top + R) * e), le = G, ce = Math.max(1, Math.round((fe - Q) * e));
1047
+ Math.round(Math.max(Ho * P, o.hairlineWidth) * t)
1048
+ ), A = o.hairlineOuterCssPx;
1049
+ o.wrap.style.inset = `${-A}px`, o.wrap.style.borderRadius = `${Math.max(0, o.cornerRadius)}px`;
1050
+ const v = Math.max(1, Math.round((n.width + A * 2) * t)), _ = Math.max(1, Math.round((n.height + A * 2) * t));
1051
+ o.canvas.width !== v && (o.canvas.width = v), o.canvas.height !== _ && (o.canvas.height = _), o.strokeCanvas.width !== v && (o.strokeCanvas.width = v), o.strokeCanvas.height !== _ && (o.strokeCanvas.height = _);
1052
+ const F = o.ctx;
1053
+ F.setTransform(1, 0, 0, 1, 0, 0), F.clearRect(0, 0, v, _);
1054
+ const I = o.strokeCtx;
1055
+ I.setTransform(1, 0, 0, 1, 0, 0), I.clearRect(0, 0, v, _);
1056
+ const y = Math.min(bt * t, Math.max(v, _));
1057
+ let T, $, B, E;
1058
+ S ? (T = u > 0 ? v : 0, B = u > 0 ? v - y : y, $ = _ * 0.5, E = _ * 0.5) : ($ = h > 0 ? _ : 0, E = h > 0 ? _ - y : y, T = v * 0.5, B = v * 0.5);
1059
+ const O = F.createLinearGradient(T, $, B, E);
1060
+ O.addColorStop(0, `rgba(0,0,0,${ko})`), O.addColorStop(0.5, `rgba(0,0,0,${Io})`), O.addColorStop(1, `rgba(0,0,0,${Lo})`);
1061
+ const H = s / t, W = Math.max(1, Math.round(Wo * Math.max(0.1, H / 140) * t));
1062
+ let z, st, lt, ct, At = !1, St = !1;
1063
+ if (S) {
1064
+ const Q = Math.max(a.top, n.top), dt = Math.min(a.bottom, n.bottom);
1065
+ At = !0, z = u > 0 ? v - W : 0, st = Math.round((Q - n.top + A) * t), lt = W, ct = Math.max(1, Math.round((dt - Q) * t));
1099
1066
  } else {
1100
- const Q = Math.max(o.left, n.left), fe = Math.min(o.right, n.right);
1101
- Ae = !0, D = Math.round((Q - n.left + R) * e), se = p > 0 ? b - G : 0, le = Math.max(1, Math.round((fe - Q) * e)), ce = G;
1067
+ const Q = Math.max(a.left, n.left), dt = Math.min(a.right, n.right);
1068
+ St = !0, z = Math.round((Q - n.left + A) * t), st = h > 0 ? _ - W : 0, lt = Math.max(1, Math.round((dt - Q) * t)), ct = W;
1102
1069
  }
1103
- const Te = { x: D, y: se, w: le, h: ce, flipX: Re, flipY: Ae }, de = { x: 0, y: 0, w: v, h: b, r: Math.max(0, a.cornerRadius * e) }, mt = Math.min(
1104
- qe,
1105
- O * Ga * Wa * za
1070
+ const Ct = { x: z, y: st, w: lt, h: ct, flipX: At, flipY: St }, ft = { x: 0, y: 0, w: v, h: _, r: Math.max(0, o.cornerRadius * t) }, me = Math.min(
1071
+ Yt,
1072
+ L * Go * Do * Bo
1106
1073
  );
1107
- Ya(F, r, s, c, v, b, mt, I, Te, de, e), ja(
1108
- L,
1074
+ jo(F, r, s, c, v, _, me, O, Ct, ft, t), Ko(
1075
+ I,
1109
1076
  r,
1110
1077
  s,
1111
1078
  c,
1112
1079
  v,
1080
+ _,
1081
+ ft,
1082
+ L,
1113
1083
  b,
1114
- de,
1115
1084
  O,
1116
- w,
1085
+ $o,
1086
+ Ct
1087
+ ), Qo(
1117
1088
  I,
1118
- Fa,
1119
- Te
1120
- ), Ka(
1121
- L,
1122
- de,
1123
- S,
1124
- C,
1089
+ ft,
1090
+ R,
1091
+ T,
1125
1092
  $,
1126
1093
  B,
1127
- k,
1128
- Math.min(0.85, Ha * O)
1129
- ), F.globalCompositeOperation = "source-over", L.globalCompositeOperation = "source-over";
1094
+ E,
1095
+ Math.min(0.85, No * L)
1096
+ ), F.globalCompositeOperation = "source-over", I.globalCompositeOperation = "source-over";
1130
1097
  }
1131
1098
  }
1132
- let xe = !1, je = 0;
1133
- function an() {
1134
- xe || (xe = !0, !(typeof requestAnimationFrame > "u") && requestAnimationFrame((e) => {
1135
- xe = !1, !(e - je < At) && (je = e, tn());
1099
+ let xt = !1, jt = 0;
1100
+ function nn() {
1101
+ xt || (xt = !0, !(typeof requestAnimationFrame > "u") && requestAnimationFrame((t) => {
1102
+ xt = !1, !(t - jt < Se) && (jt = t, on());
1136
1103
  }));
1137
1104
  }
1138
- const Ke = "metal-fx-styles", nn = (
1139
- /* css */
1140
- `
1105
+ const Kt = "metal-fx-styles", an = `
1141
1106
  .metal-fx-root {
1142
1107
  position: relative;
1143
1108
  display: inline-flex;
@@ -1178,7 +1143,6 @@ const Ke = "metal-fx-styles", nn = (
1178
1143
  .metal-fx-root[data-theme='light']::after {
1179
1144
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
1180
1145
  }
1181
- /* Circle variant gets a thicker outer rim than the button variant. */
1182
1146
  .metal-fx-root[data-variant='circle']::after {
1183
1147
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
1184
1148
  }
@@ -1197,12 +1161,6 @@ const Ke = "metal-fx-styles", nn = (
1197
1161
  border-radius: inherit;
1198
1162
  }
1199
1163
 
1200
- /* The inner spacer — defines the inset geometry where the metal ring meets
1201
- the interior (3 px for Button, 1-2 px for Circle) and carries the Circle dark
1202
- hairline ('box-shadow: inset' rules below). Intentionally transparent so
1203
- the wrapper's background propagates through to the punched shader centre,
1204
- giving consumers a single surface tone to override. See "Single-surface
1205
- background" in the file header for the rationale. */
1206
1164
  .metal-fx-inner {
1207
1165
  position: absolute;
1208
1166
  inset: 3px;
@@ -1227,41 +1185,11 @@ const Ke = "metal-fx-styles", nn = (
1227
1185
  border-radius: var(--mfx-radius, 16px);
1228
1186
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
1229
1187
  }
1230
- /* Circle-variant hairline alpha — light mode.
1231
- Source-of-truth: index.html L2261-2267. The 0.45-alpha black inset that
1232
- reads as a single-pixel frame against the dark interior is too heavy
1233
- on a #ffffff inner: it ends up looking like a hard 2-px black ring
1234
- against the iridescent shader. Suppressed entirely (alpha 0) — the
1235
- shader's own iridescent rim already defines the silhouette in light
1236
- mode, so an extra dark hairline only competes with it. The rule is
1237
- kept (rather than deleted) as a tunable hook in case a future variant
1238
- wants to re-introduce a soft edge. NOTE: we keep the dark-mode inset
1239
- and border-radius values because — unlike index.html — our renderer
1240
- does NOT overscan the canvas in light mode, so there is no 1-px gap
1241
- between inner element and shader to compensate for. */
1242
1188
  .metal-fx-root[data-theme='light'][data-variant='circle'][data-shape='pill'] .metal-fx-inner,
1243
1189
  .metal-fx-root[data-theme='light'][data-variant='circle'][data-shape='circle'] .metal-fx-inner {
1244
1190
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0);
1245
1191
  }
1246
1192
 
1247
- /* ─── Combined glow SVG (z=3) ──────────────────────────────────────────────
1248
- Single SVG per instance that holds BOTH the wide-halo group
1249
- (#mfx_haloTravel) and the catch-light group (#mfx_extraTravel), exactly
1250
- mirroring canonical's _buildGlowSvgInner (index.html L8078). One
1251
- mix-blend-mode: screen lifts the combined composite onto the shader
1252
- ring; per-frame opacity attributes on each inner group still drive the
1253
- independent fade-in / fade-out cycles for the halo and the catch-light.
1254
-
1255
- Why a single SVG: the circle variant anchors halo + catch-light at the same
1256
- perimeter point, so they overlap in the bright zone. Two separately-
1257
- screened SVGs would double-screen the overlap (A + B + C - AB - AC -
1258
- BC + ABC instead of A + B + C - AB - AC once both groups composite
1259
- in source-over inside one SVG and then screen against the host once).
1260
- That overlap looked muted versus canonical specifically on the circle
1261
- variant where both layers travel together.
1262
-
1263
- Source-of-truth opacity: #btnGlowSvg drops to 0.7 in dark and 0.2746 in
1264
- light (index.html L632/L643). */
1265
1193
  .metal-fx-glow-svg {
1266
1194
  position: absolute;
1267
1195
  inset: 0;
@@ -1273,28 +1201,17 @@ const Ke = "metal-fx-styles", nn = (
1273
1201
  opacity: 0.7;
1274
1202
  }
1275
1203
  .metal-fx-root[data-theme='light'] .metal-fx-glow-svg {
1276
- /* Light-mode 1-px overscan mirrors .btn-glow-svg in metal.html so the
1277
- halo stays glued to the visible silhouette (the shader ring there sits
1278
- 1 px outside the host's padding box). */
1279
1204
  inset: -1px;
1280
1205
  width: calc(100% + 2px);
1281
1206
  height: calc(100% + 2px);
1282
1207
  mix-blend-mode: multiply;
1283
- /* Source-of-truth: html[data-theme="light"] #btnGlowSvg { opacity: 0.2746 }
1284
- → −35 % from 0.4225 from the original 0.7 dark-mode opacity. */
1285
1208
  opacity: 0.2746;
1286
1209
  filter: saturate(5.355) brightness(0.78);
1287
1210
  }
1288
- /* Circle light-mode small variants (e.g. 36×36 send button): the geometrically
1289
- shrunk halo loses density when multiplied against #ffffff. Mirror the
1290
- canonical override at index.html L2316 — bump saturation + drop brightness
1291
- so the small glow holds together visually. */
1292
1211
  .metal-fx-root[data-variant='circle'][data-shape='circle'][data-theme='light'] .metal-fx-glow-svg {
1293
1212
  filter: saturate(7.5) brightness(0.6);
1294
1213
  }
1295
1214
 
1296
- /* The wrapped child — hoisted into z=5 so it sits above every overlay, with
1297
- normalized chrome so consumer button styles don't fight the metal frame. */
1298
1215
  .metal-fx-content {
1299
1216
  position: relative;
1300
1217
  z-index: 5;
@@ -1312,30 +1229,6 @@ const Ke = "metal-fx-styles", nn = (
1312
1229
  border: 0 !important;
1313
1230
  outline: 0 !important;
1314
1231
  box-shadow: none !important;
1315
- /* Sizing: we deliberately DO NOT force \`width: 100%; height: 100%\` on the
1316
- child here. That used to be the contract ("the wrapper is the visible
1317
- button surface; the child stretches to fill it"), but it created a cyclic
1318
- percentage dependency: the wrapper is \`inline-flex\` with no intrinsic
1319
- size, .metal-fx-content is \`width/height: 100%\` of the wrapper, and the
1320
- child was \`100%\` of .metal-fx-content. With nothing breaking the cycle,
1321
- icon-only / class-sized children collapsed.
1322
-
1323
- The new contract: the child sizes itself (intrinsic content, CSS class,
1324
- or inline style — all work), and the wrapper's \`inline-flex\` wraps it
1325
- tightly. Consumers who want a metal frame BIGGER than the child (e.g.
1326
- padding around an icon) size <MetalFx style={{ width, height }}> AND
1327
- explicitly set width/height on the child to fill (or accept that the
1328
- child renders at its intrinsic size, centered).
1329
-
1330
- Typography is intentionally NOT touched. We used to apply
1331
- \`color: inherit; font: inherit;\` here to "match" the wrapper, but
1332
- \`font: inherit\` is a shorthand that overrides font-family, font-size,
1333
- font-weight, AND line-height on the child — which (a) shrank the
1334
- button height (line-height changes propagate through the flex
1335
- content box) and (b) scaled em-based icons / font-icons inside the
1336
- child to whatever the wrapper inherited. The wrapper now stays out
1337
- of the child's typography entirely; consumers who want typographic
1338
- normalization can apply it themselves on the child element. */
1339
1232
  }
1340
1233
 
1341
1234
  [data-metal-fx-reflection] {
@@ -1363,50 +1256,45 @@ const Ke = "metal-fx-styles", nn = (
1363
1256
  display: block;
1364
1257
  filter: saturate(1.35) brightness(1.75);
1365
1258
  }
1366
- /* Hosts that participate as reflection targets need positioning + isolation
1367
- so the wrap composites only against the host (not the parent stack). The
1368
- wrap injects these inline as well, but stating them here keeps reflections
1369
- working on hosts that already have other inline styles applied. */
1370
1259
  [data-metal-fx-reflect-host] {
1371
1260
  isolation: isolate;
1372
1261
  }
1373
- `
1374
- );
1375
- let ve = !1;
1376
- function on() {
1377
- if (ve || typeof document > "u") return;
1378
- if (document.getElementById(Ke)) {
1379
- ve = !0;
1262
+ `;
1263
+ let vt = !1;
1264
+ function rn() {
1265
+ if (vt || typeof document > "u") return;
1266
+ if (document.getElementById(Kt)) {
1267
+ vt = !0;
1380
1268
  return;
1381
1269
  }
1382
- const e = document.createElement("style");
1383
- e.id = Ke, e.textContent = nn, document.head.appendChild(e), ve = !0;
1384
- }
1385
- const rn = ["data-variant", "data-shape", "data-theme", "data-paused", "data-normalize"];
1386
- on();
1387
- const sn = { position: "absolute", inset: "0", width: "100%", height: "100%" }, ln = { position: "absolute", inset: "3px" }, cn = { position: "absolute", inset: "0", pointerEvents: "none", zIndex: 3, borderRadius: "inherit" }, re = /* @__PURE__ */ new Map();
1388
- Kt((e, t) => {
1389
- const a = re.get(e);
1390
- a && Ta(a.handles, e, t, e.opacityMul, a.themeRef.current);
1270
+ const t = document.createElement("style");
1271
+ t.id = Kt, t.textContent = an, document.head.appendChild(t), vt = !0;
1272
+ }
1273
+ const sn = ["data-variant", "data-shape", "data-theme", "data-paused", "data-normalize"];
1274
+ rn();
1275
+ const ln = { position: "absolute", inset: "0", width: "100%", height: "100%" }, cn = { position: "absolute", inset: "3px" }, fn = { position: "absolute", inset: "0", pointerEvents: "none", zIndex: 3, borderRadius: "inherit" }, rt = /* @__PURE__ */ new Map();
1276
+ Ke((t, e) => {
1277
+ const o = rt.get(t);
1278
+ o && To(o.handles, t, e, t.opacityMul, o.themeRef.current);
1391
1279
  });
1392
- function dn(e) {
1393
- const a = Y(((c) => c !== "auto" ? c : typeof window > "u" || !window.matchMedia || window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light")(e()));
1280
+ function dn(t) {
1281
+ const o = V(((c) => c !== "auto" ? c : typeof window > "u" || !window.matchMedia || window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light")(t()));
1394
1282
  let n = null;
1395
- const o = () => {
1396
- n && (a.value = n.matches ? "dark" : "light");
1283
+ const a = () => {
1284
+ n && (o.value = n.matches ? "dark" : "light");
1397
1285
  }, r = () => {
1398
- n == null || n.removeEventListener("change", o), n = null;
1286
+ n == null || n.removeEventListener("change", a), n = null;
1399
1287
  }, s = () => {
1400
- if (r(), e() !== "auto") {
1401
- a.value = e();
1288
+ if (r(), t() !== "auto") {
1289
+ o.value = t();
1402
1290
  return;
1403
1291
  }
1404
- typeof window > "u" || !window.matchMedia || (n = window.matchMedia("(prefers-color-scheme: dark)"), o(), n.addEventListener("change", o));
1292
+ typeof window > "u" || !window.matchMedia || (n = window.matchMedia("(prefers-color-scheme: dark)"), a(), n.addEventListener("change", a));
1405
1293
  };
1406
- return Qe(s), z(e, s), Je(r), a;
1294
+ return Qt(s), D(t, s), Zt(r), o;
1407
1295
  }
1408
- const pn = /* @__PURE__ */ gt({
1409
- __name: "MetalFx",
1296
+ const mn = /* @__PURE__ */ ge({
1297
+ __name: "ShingenMetal",
1410
1298
  props: {
1411
1299
  variant: { default: "button" },
1412
1300
  preset: { default: "chromatic" },
@@ -1421,185 +1309,184 @@ const pn = /* @__PURE__ */ gt({
1421
1309
  ringCssPx: {},
1422
1310
  scale: { default: 1 }
1423
1311
  },
1424
- setup(e, { expose: t }) {
1425
- const a = e, n = Y(null), o = Y(null), r = Y(null), s = Y(null);
1426
- let c = null, l = null, d = 0;
1427
- const f = Y(!1), g = dn(() => a.theme), u = { get current() {
1312
+ setup(t, { expose: e }) {
1313
+ const o = t, n = V(null), a = V(null), r = V(null), s = V(null);
1314
+ let c = null, l = null, f = 0;
1315
+ const d = V(!1), g = dn(() => o.theme), u = { get current() {
1428
1316
  return g.value;
1429
- } }, p = ue(() => a.variant === "circle" ? "circle" : "pill"), h = ue(() => !a.disableGlow);
1430
- t({
1431
- /** The wrapper element, mirroring the React version's forwarded ref. */
1317
+ } }, h = ut(() => o.variant === "circle" ? "circle" : "pill"), p = ut(() => !o.disableGlow);
1318
+ e({
1432
1319
  rootEl: n
1433
1320
  });
1434
- const m = (y, w) => {
1435
- if (p.value === "circle") return Math.min(y, w) / 2;
1436
- const S = typeof a.borderRadius == "number" ? a.borderRadius : (() => {
1321
+ const m = (w, b) => {
1322
+ if (h.value === "circle") return Math.min(w, b) / 2;
1323
+ const R = typeof o.borderRadius == "number" ? o.borderRadius : (() => {
1437
1324
  var v;
1438
- const R = (v = s.value) == null ? void 0 : v.firstElementChild;
1439
- if (R) {
1440
- const b = parseFloat(getComputedStyle(R).borderTopLeftRadius);
1441
- if (Number.isFinite(b) && b > 0) return b;
1325
+ const A = (v = s.value) == null ? void 0 : v.firstElementChild;
1326
+ if (A) {
1327
+ const _ = parseFloat(getComputedStyle(A).borderTopLeftRadius);
1328
+ if (Number.isFinite(_) && _ > 0) return _;
1442
1329
  }
1443
- return d;
1330
+ return f;
1444
1331
  })();
1445
- return Math.min(S, Math.min(y, w) / 2);
1332
+ return Math.min(R, Math.min(w, b) / 2);
1446
1333
  };
1447
- z([() => a.preset, g], ([y, w]) => {
1448
- jt(y, w);
1449
- }, { immediate: !0 }), z(() => a.paused, (y) => {
1450
- c && J(c, { paused: y });
1451
- }), z([() => a.shaderScale, () => a.ringCssPx, () => a.scale], ([y, w, S]) => {
1334
+ D([() => o.preset, g], ([w, b]) => {
1335
+ je(w, b);
1336
+ }, { immediate: !0 }), D(() => o.paused, (w) => {
1337
+ c && Z(c, { paused: w });
1338
+ }), D([() => o.shaderScale, () => o.ringCssPx, () => o.scale], ([w, b, R]) => {
1452
1339
  if (!c) return;
1453
- const R = {};
1454
- y !== void 0 && (R.shaderScale = y), w !== void 0 && (R.ringCssPx = w), S !== void 0 && (R.scale = S), Object.keys(R).length > 0 && J(c, R);
1340
+ const A = {};
1341
+ w !== void 0 && (A.shaderScale = w), b !== void 0 && (A.ringCssPx = b), R !== void 0 && (A.scale = R), Object.keys(A).length > 0 && Z(c, A);
1455
1342
  });
1456
- const A = () => {
1457
- c && J(c, { opacityMul: Math.max(0, Math.min(1, a.strength)) });
1343
+ const S = () => {
1344
+ c && Z(c, { opacityMul: Math.max(0, Math.min(1, o.strength)) });
1458
1345
  };
1459
- z([() => a.strength, () => a.variant], A);
1346
+ D([() => o.strength, () => o.variant], S);
1460
1347
  let x = null;
1461
- const E = () => {
1462
- const y = o.value, w = n.value, S = r.value;
1463
- if (!y || !w) return;
1348
+ const k = () => {
1349
+ const w = a.value, b = n.value, R = r.value;
1350
+ if (!w || !b) return;
1464
1351
  {
1465
- const _ = getComputedStyle(w), C = parseFloat(_.borderTopLeftRadius);
1466
- d = Number.isFinite(C) ? C : 0;
1352
+ const y = getComputedStyle(b), T = parseFloat(y.borderTopLeftRadius);
1353
+ f = Number.isFinite(T) ? T : 0;
1467
1354
  }
1468
- const R = () => {
1469
- const _ = w.getBoundingClientRect(), C = Math.max(1, Math.round(_.width)), $ = Math.max(1, Math.round(_.height));
1470
- return { cssWidth: C, cssHeight: $, cornerRadius: m(C, $) };
1471
- }, v = R();
1472
- c = Ut({
1473
- hostCanvas: y,
1355
+ const A = () => {
1356
+ const y = b.getBoundingClientRect(), T = Math.max(1, Math.round(y.width)), $ = Math.max(1, Math.round(y.height));
1357
+ return { cssWidth: T, cssHeight: $, cornerRadius: m(T, $) };
1358
+ }, v = A();
1359
+ c = Ue({
1360
+ hostCanvas: w,
1474
1361
  cssWidth: v.cssWidth,
1475
1362
  cssHeight: v.cssHeight,
1476
1363
  cornerRadius: v.cornerRadius,
1477
- kind: p.value,
1478
- paused: a.paused,
1479
- shaderScale: a.shaderScale,
1480
- ringCssPx: a.ringCssPx,
1481
- scale: a.scale,
1364
+ kind: h.value,
1365
+ paused: o.paused,
1366
+ shaderScale: o.shaderScale,
1367
+ ringCssPx: o.ringCssPx,
1368
+ scale: o.scale,
1482
1369
  onFirstCopy: () => {
1483
- f.value = !0;
1370
+ d.value = !0;
1484
1371
  }
1485
- }), w.style.setProperty("--mfx-radius", `${v.cornerRadius}px`), w.style.borderRadius = `${v.cornerRadius}px`, A(), S && (l = De(S, {
1372
+ }), b.style.setProperty("--mfx-radius", `${v.cornerRadius}px`), b.style.borderRadius = `${v.cornerRadius}px`, S(), R && (l = zt(R, {
1486
1373
  width: v.cssWidth,
1487
1374
  height: v.cssHeight,
1488
1375
  cornerRadius: v.cornerRadius,
1489
- kind: p.value,
1490
- scale: a.scale
1376
+ kind: h.value,
1377
+ scale: o.scale
1491
1378
  }));
1492
- let b = 0;
1379
+ let _ = 0;
1493
1380
  const F = new ResizeObserver(() => {
1494
- b === 0 && (b = requestAnimationFrame(() => {
1495
- b = 0;
1496
- const _ = R(), C = c;
1497
- C && (J(C, { cssWidth: _.cssWidth, cssHeight: _.cssHeight, cornerRadius: _.cornerRadius }), w.style.setProperty("--mfx-radius", `${_.cornerRadius}px`), w.style.borderRadius = `${_.cornerRadius}px`, S && (S.innerHTML = "", l = De(S, {
1498
- width: _.cssWidth,
1499
- height: _.cssHeight,
1500
- cornerRadius: _.cornerRadius,
1501
- kind: p.value,
1502
- scale: a.scale
1503
- }), C && l && re.set(C, { handles: l, themeRef: u })));
1381
+ _ === 0 && (_ = requestAnimationFrame(() => {
1382
+ _ = 0;
1383
+ const y = A(), T = c;
1384
+ T && (Z(T, { cssWidth: y.cssWidth, cssHeight: y.cssHeight, cornerRadius: y.cornerRadius }), b.style.setProperty("--mfx-radius", `${y.cornerRadius}px`), b.style.borderRadius = `${y.cornerRadius}px`, R && (R.innerHTML = "", l = zt(R, {
1385
+ width: y.cssWidth,
1386
+ height: y.cssHeight,
1387
+ cornerRadius: y.cornerRadius,
1388
+ kind: h.value,
1389
+ scale: o.scale
1390
+ }), T && l && rt.set(T, { handles: l, themeRef: u })));
1504
1391
  }));
1505
1392
  });
1506
- F.observe(w);
1507
- let L = null;
1508
- typeof IntersectionObserver < "u" && (L = new IntersectionObserver(
1509
- (_) => {
1510
- const C = c;
1511
- if (C)
1512
- for (const $ of _) Yt(C, $.isIntersecting);
1393
+ F.observe(b);
1394
+ let I = null;
1395
+ typeof IntersectionObserver < "u" && (I = new IntersectionObserver(
1396
+ (y) => {
1397
+ const T = c;
1398
+ if (T)
1399
+ for (const $ of y) Ve(T, $.isIntersecting);
1513
1400
  },
1514
1401
  { rootMargin: "64px" }
1515
- ), L.observe(w)), c && l && (re.set(c, { handles: l, themeRef: u }), Vt(c)), x = () => {
1516
- F.disconnect(), L == null || L.disconnect(), b !== 0 && cancelAnimationFrame(b);
1517
- const _ = c;
1518
- _ && (re.delete(_), qt(_), Xt(_)), c = null, l = null, S && (S.innerHTML = "");
1402
+ ), I.observe(b)), c && l && (rt.set(c, { handles: l, themeRef: u }), qe(c)), x = () => {
1403
+ F.disconnect(), I == null || I.disconnect(), _ !== 0 && cancelAnimationFrame(_);
1404
+ const y = c;
1405
+ y && (rt.delete(y), Ye(y), Xe(y)), c = null, l = null, R && (R.innerHTML = "");
1519
1406
  };
1520
1407
  };
1521
1408
  let M = null;
1522
- const O = () => {
1409
+ const L = () => {
1523
1410
  M == null || M(), M = null;
1524
- const y = c, w = n.value, S = a.reflectionTargets;
1525
- if (!y || !w || !S || g.value !== "dark") return;
1526
- y.onAfterFrame = an;
1527
- const R = S.flatMap((v) => {
1528
- const b = yt(v);
1529
- return b ? [b] : [];
1411
+ const w = c, b = n.value, R = o.reflectionTargets;
1412
+ if (!w || !b || !R || g.value !== "dark") return;
1413
+ w.onAfterFrame = nn;
1414
+ const A = R.flatMap((v) => {
1415
+ const _ = we(v);
1416
+ return _ ? [_] : [];
1530
1417
  });
1531
- for (const v of R) Za(v, y, w);
1418
+ for (const v of A) tn(v, w, b);
1532
1419
  M = () => {
1533
- y.onAfterFrame = void 0;
1534
- for (const v of R) en(v);
1420
+ w.onAfterFrame = void 0;
1421
+ for (const v of A) en(v);
1535
1422
  };
1536
1423
  };
1537
- Qe(() => {
1538
- E(), Ce(O);
1539
- }), z(p, () => {
1540
- x == null || x(), x = null, M == null || M(), M = null, E(), Ce(O);
1541
- }, { flush: "post" }), z([() => a.reflectionTargets, g], () => {
1542
- O();
1543
- }, { flush: "post" }), Je(() => {
1424
+ Qt(() => {
1425
+ k(), Tt(L);
1426
+ }), D(h, () => {
1427
+ x == null || x(), x = null, M == null || M(), M = null, k(), Tt(L);
1428
+ }, { flush: "post" }), D([() => o.reflectionTargets, g], () => {
1429
+ L();
1430
+ }, { flush: "post" }), Zt(() => {
1544
1431
  M == null || M(), M = null, x == null || x(), x = null;
1545
- }), z([() => a.borderRadius, g, () => a.variant], () => {
1546
- const y = n.value, w = c;
1547
- if (!y || !w) return;
1548
- const S = m(w.cssWidth, w.cssHeight);
1549
- J(w, { cornerRadius: S }), y.style.setProperty("--mfx-radius", `${S}px`), y.style.borderRadius = `${S}px`;
1432
+ }), D([() => o.borderRadius, g, () => o.variant], () => {
1433
+ const w = n.value, b = c;
1434
+ if (!w || !b) return;
1435
+ const R = m(b.cssWidth, b.cssHeight);
1436
+ Z(b, { cornerRadius: R }), w.style.setProperty("--mfx-radius", `${R}px`), w.style.borderRadius = `${R}px`;
1550
1437
  }, { flush: "post" });
1551
- const P = ue(() => ({
1552
- "--mfx-strength": String(Math.min(1, Math.max(0, a.strength))),
1553
- opacity: f.value ? 1 : 0,
1554
- visibility: f.value ? "visible" : "hidden",
1555
- transition: f.value ? "opacity 0.15s ease-out" : "none"
1438
+ const P = ut(() => ({
1439
+ "--mfx-strength": String(Math.min(1, Math.max(0, o.strength))),
1440
+ opacity: d.value ? 1 : 0,
1441
+ visibility: d.value ? "visible" : "hidden",
1442
+ transition: d.value ? "opacity 0.15s ease-out" : "none"
1556
1443
  }));
1557
- return (y, w) => (xt(), vt("div", {
1444
+ return (w, b) => (xe(), ve("div", {
1558
1445
  ref_key: "rootRef",
1559
1446
  ref: n,
1560
1447
  class: "metal-fx-root",
1561
- "data-variant": e.variant,
1562
- "data-shape": p.value,
1563
- "data-theme": bt(g),
1564
- "data-paused": e.paused ? "true" : void 0,
1565
- "data-normalize": e.normalizeHostStyles ? "true" : "false",
1566
- style: ke(P.value)
1448
+ "data-variant": t.variant,
1449
+ "data-shape": h.value,
1450
+ "data-theme": _e(g),
1451
+ "data-paused": t.paused ? "true" : void 0,
1452
+ "data-normalize": t.normalizeHostStyles ? "true" : "false",
1453
+ style: Et(P.value)
1567
1454
  }, [
1568
- te("canvas", {
1455
+ et("canvas", {
1569
1456
  ref_key: "canvasRef",
1570
- ref: o,
1457
+ ref: a,
1571
1458
  class: "metal-fx-canvas",
1572
- style: sn
1459
+ style: ln
1573
1460
  }, null, 512),
1574
- te("div", {
1461
+ et("div", {
1575
1462
  class: "metal-fx-inner",
1576
1463
  "aria-hidden": "true",
1577
- style: ln
1464
+ style: cn
1578
1465
  }),
1579
- te("div", {
1466
+ et("div", {
1580
1467
  ref_key: "glowHostRef",
1581
1468
  ref: r,
1582
1469
  "aria-hidden": "true",
1583
- style: ke([cn, h.value ? null : { display: "none" }])
1470
+ style: Et([fn, p.value ? null : { display: "none" }])
1584
1471
  }, null, 4),
1585
- te("div", {
1472
+ et("div", {
1586
1473
  ref_key: "contentRef",
1587
1474
  ref: s,
1588
1475
  class: "metal-fx-content"
1589
1476
  }, [
1590
- wt(y.$slots, "default")
1477
+ be(w.$slots, "default")
1591
1478
  ], 512)
1592
- ], 12, rn));
1479
+ ], 12, sn));
1593
1480
  }
1594
1481
  });
1595
1482
  export {
1596
- pn as MetalFx,
1597
- Ze as PRESETS,
1598
- Ut as createInstance,
1599
- Xt as destroyInstance,
1600
- _t as hexToRgb,
1601
- un as pauseShared,
1483
+ Jt as PRESETS,
1484
+ mn as ShingenMetal,
1485
+ Ue as createInstance,
1486
+ Xe as destroyInstance,
1487
+ ye as hexToRgb,
1488
+ pn as pauseShared,
1602
1489
  hn as resumeShared,
1603
- jt as setSharedPreset,
1604
- J as updateInstance
1490
+ je as setSharedPreset,
1491
+ Z as updateInstance
1605
1492
  };