@aberhamm/liquid-glass-react 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,1314 @@
1
+ import { useState as C, useEffect as N, useRef as te, useId as St, forwardRef as be, isValidElement as jt, Children as Wt, cloneElement as zt, useMemo as Qt, useCallback as tt, useLayoutEffect as Kt } from "react";
2
+ import { jsxs as _, jsx as d, Fragment as nt } from "react/jsx-runtime";
3
+ const Zt = {
4
+ supportsBackdropFilter: !1,
5
+ isChromium: !1,
6
+ supportsSvgBackdropDisplacement: !1,
7
+ isFirefox: !1,
8
+ prefersReducedMotion: !1,
9
+ prefersReducedTransparency: !1,
10
+ prefersContrastMore: !1,
11
+ canRefract: !1
12
+ };
13
+ function vt() {
14
+ return { ...Zt };
15
+ }
16
+ function Jt() {
17
+ return typeof window < "u" && typeof document < "u" && typeof navigator < "u";
18
+ }
19
+ function en() {
20
+ return typeof CSS > "u" || typeof CSS.supports != "function" ? !1 : CSS.supports("backdrop-filter", "blur(1px)") || CSS.supports("-webkit-backdrop-filter", "blur(1px)");
21
+ }
22
+ function tn(n) {
23
+ return /Firefox/i.test(n);
24
+ }
25
+ function nn(n, t) {
26
+ return t ? !1 : /Chrome|Chromium|Edg|OPR/i.test(n);
27
+ }
28
+ function rn() {
29
+ return typeof window.matchMedia != "function" ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches;
30
+ }
31
+ function sn() {
32
+ return typeof window.matchMedia != "function" ? !1 : window.matchMedia("(prefers-reduced-transparency: reduce)").matches;
33
+ }
34
+ function on() {
35
+ return typeof window.matchMedia != "function" ? !1 : window.matchMedia("(prefers-contrast: more)").matches;
36
+ }
37
+ function an() {
38
+ if (!Jt())
39
+ return vt();
40
+ const n = navigator.userAgent ?? "", t = en(), e = tn(n), r = nn(n, e), s = r, o = rn(), a = sn(), i = on();
41
+ return {
42
+ supportsBackdropFilter: t,
43
+ isChromium: r,
44
+ supportsSvgBackdropDisplacement: s,
45
+ isFirefox: e,
46
+ prefersReducedMotion: o,
47
+ prefersReducedTransparency: a,
48
+ prefersContrastMore: i,
49
+ canRefract: t && s
50
+ };
51
+ }
52
+ function cn() {
53
+ const [n, t] = C(
54
+ vt
55
+ );
56
+ return N(() => {
57
+ t(an());
58
+ }, []), n;
59
+ }
60
+ function le(n, t, e, r, s) {
61
+ const o = e / 2, a = r / 2, i = Math.max(0, Math.min(s, Math.min(o, a))), c = Math.abs(n) - (o - i), u = Math.abs(t) - (a - i), g = Math.max(c, 0), b = Math.max(u, 0), h = Math.sqrt(g * g + b * b), f = Math.min(Math.max(c, u), 0);
62
+ return h + f - i;
63
+ }
64
+ function ue(n, t, e) {
65
+ if (n === t) return e < n ? 0 : 1;
66
+ const r = Math.max(0, Math.min(1, (e - n) / (t - n)));
67
+ return r * r * (3 - 2 * r);
68
+ }
69
+ function rt(n) {
70
+ const t = Math.round(128 + n * 127);
71
+ return t < 0 ? 0 : t > 255 ? 255 : t;
72
+ }
73
+ function ln(n, t, e) {
74
+ const r = new Uint8ClampedArray(t * e * 4), s = t / 2, o = e / 2, a = Math.min(t, e) * 0.35;
75
+ for (let i = 0; i < e; i++)
76
+ for (let c = 0; c < t; c++) {
77
+ const u = c + 0.5 - s, g = i + 0.5 - o;
78
+ let b = 0, h = 0;
79
+ if (n === "polar") {
80
+ const l = Math.sqrt(u * u + g * g), m = le(u, g, t, e, a), p = ue(-Math.min(t, e) * 0.5, 0, m), R = l === 0 ? 0 : u / l, x = l === 0 ? 0 : g / l;
81
+ b = R * p * 0.9, h = x * p * 0.9;
82
+ } else {
83
+ let l, m, p;
84
+ n === "standard" ? (l = -Math.min(t, e) * 0.18, m = 0, p = 0.7) : n === "prominent" ? (l = -Math.min(t, e) * 0.4, m = 0, p = 1) : (l = -Math.min(t, e) * 0.1, m = Math.min(t, e) * 0.04, p = 0.85);
85
+ const R = le(u - 1, g, t, e, a), x = le(u + 1, g, t, e, a), T = le(u, g - 1, t, e, a), S = le(u, g + 1, t, e, a), E = ue(l, m, R), ne = ue(l, m, x), re = ue(l, m, T), G = ue(l, m, S);
86
+ b = (ne - E) * 0.5 * p, h = (G - re) * 0.5 * p;
87
+ }
88
+ const f = (i * t + c) * 4;
89
+ r[f] = rt(b), r[f + 1] = 0, r[f + 2] = rt(h), r[f + 3] = 255;
90
+ }
91
+ return r;
92
+ }
93
+ const un = (() => {
94
+ const n = new Uint32Array(256);
95
+ for (let t = 0; t < 256; t++) {
96
+ let e = t;
97
+ for (let r = 0; r < 8; r++)
98
+ e = e & 1 ? 3988292384 ^ e >>> 1 : e >>> 1;
99
+ n[t] = e >>> 0;
100
+ }
101
+ return n;
102
+ })();
103
+ function dn(n) {
104
+ let t = 4294967295;
105
+ for (let e = 0; e < n.length; e++)
106
+ t = un[(t ^ n[e]) & 255] ^ t >>> 8;
107
+ return (t ^ 4294967295) >>> 0;
108
+ }
109
+ function fn(n) {
110
+ let t = 1, e = 0;
111
+ const r = 65521;
112
+ for (let s = 0; s < n.length; s++)
113
+ t = (t + n[s]) % r, e = (e + t) % r;
114
+ return (e << 16 | t) >>> 0;
115
+ }
116
+ function mn(n) {
117
+ const e = Math.max(1, Math.ceil(n.length / 65535)), r = new Uint8Array(2 + e * 5 + n.length + 4);
118
+ let s = 0;
119
+ r[s++] = 120, r[s++] = 1;
120
+ let o = 0;
121
+ do {
122
+ const i = Math.min(n.length - o, 65535), c = o + i >= n.length;
123
+ r[s++] = c ? 1 : 0, r[s++] = i & 255, r[s++] = i >>> 8 & 255;
124
+ const u = ~i & 65535;
125
+ r[s++] = u & 255, r[s++] = u >>> 8 & 255, r.set(n.subarray(o, o + i), s), s += i, o += i;
126
+ } while (o < n.length);
127
+ const a = fn(n);
128
+ return r[s++] = a >>> 24 & 255, r[s++] = a >>> 16 & 255, r[s++] = a >>> 8 & 255, r[s++] = a & 255, r;
129
+ }
130
+ function Ie(n, t) {
131
+ const e = t.length, r = new Uint8Array(12 + e);
132
+ r[0] = e >>> 24 & 255, r[1] = e >>> 16 & 255, r[2] = e >>> 8 & 255, r[3] = e & 255, r[4] = n.charCodeAt(0), r[5] = n.charCodeAt(1), r[6] = n.charCodeAt(2), r[7] = n.charCodeAt(3), r.set(t, 8);
133
+ const s = dn(r.subarray(4, 8 + e));
134
+ return r[8 + e] = s >>> 24 & 255, r[9 + e] = s >>> 16 & 255, r[10 + e] = s >>> 8 & 255, r[11 + e] = s & 255, r;
135
+ }
136
+ function At(n, t, e) {
137
+ const r = t * 4, s = new Uint8Array(e * (r + 1));
138
+ for (let l = 0; l < e; l++) {
139
+ const m = l * (r + 1);
140
+ s[m] = 0, s.set(n.subarray(l * r, l * r + r), m + 1);
141
+ }
142
+ const o = mn(s), a = new Uint8Array(13);
143
+ a[0] = t >>> 24 & 255, a[1] = t >>> 16 & 255, a[2] = t >>> 8 & 255, a[3] = t & 255, a[4] = e >>> 24 & 255, a[5] = e >>> 16 & 255, a[6] = e >>> 8 & 255, a[7] = e & 255, a[8] = 8, a[9] = 6, a[10] = 0, a[11] = 0, a[12] = 0;
144
+ const i = Uint8Array.from([137, 80, 78, 71, 13, 10, 26, 10]), c = Ie("IHDR", a), u = Ie("IDAT", o), g = Ie("IEND", new Uint8Array(0)), b = i.length + c.length + u.length + g.length, h = new Uint8Array(b);
145
+ let f = 0;
146
+ for (const l of [i, c, u, g])
147
+ h.set(l, f), f += l.length;
148
+ return h;
149
+ }
150
+ const L = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
151
+ function Ct(n) {
152
+ let t = "", e = 0;
153
+ for (; e + 2 < n.length; e += 3) {
154
+ const s = n[e] << 16 | n[e + 1] << 8 | n[e + 2];
155
+ t += L.charAt(s >>> 18 & 63) + L.charAt(s >>> 12 & 63) + L.charAt(s >>> 6 & 63) + L.charAt(s & 63);
156
+ }
157
+ const r = n.length - e;
158
+ if (r === 1) {
159
+ const s = n[e] << 16;
160
+ t += `${L.charAt(s >>> 18 & 63)}${L.charAt(s >>> 12 & 63)}==`;
161
+ } else if (r === 2) {
162
+ const s = n[e] << 16 | n[e + 1] << 8;
163
+ t += `${L.charAt(s >>> 18 & 63)}${L.charAt(s >>> 12 & 63)}${L.charAt(s >>> 6 & 63)}=`;
164
+ }
165
+ return t;
166
+ }
167
+ function pn() {
168
+ const n = new Uint8ClampedArray([0, 0, 0, 0]);
169
+ return `data:image/png;base64,${Ct(At(n, 1, 1))}`;
170
+ }
171
+ const gn = 32, ke = 16, q = /* @__PURE__ */ new Map();
172
+ function st(n) {
173
+ return Math.max(ke, Math.round(n / ke) * ke);
174
+ }
175
+ function hn(n, t, e) {
176
+ if (!Number.isFinite(t) || !Number.isFinite(e) || t <= 0 || e <= 0)
177
+ return pn();
178
+ const r = st(t), s = st(e), o = `${n}:${r}x${s}`, a = q.get(o);
179
+ if (a !== void 0)
180
+ return q.delete(o), q.set(o, a), a;
181
+ const i = ln(n, r, s), c = `data:image/png;base64,${Ct(At(i, r, s))}`;
182
+ if (q.set(o, c), q.size > gn) {
183
+ const u = q.keys().next().value;
184
+ u !== void 0 && q.delete(u);
185
+ }
186
+ return c;
187
+ }
188
+ const bn = [
189
+ "inset 0 1px 1px 0 rgba(255, 255, 255, 0.75)",
190
+ "inset 1px 0 1px 0 rgba(255, 255, 255, 0.4)",
191
+ "inset 0 -1px 2px 0 rgba(0, 0, 0, 0.18)",
192
+ "inset -1px 0 2px 0 rgba(0, 0, 0, 0.12)",
193
+ "inset 0 0 0 1px rgba(255, 255, 255, 0.22)"
194
+ ].join(", "), yn = [
195
+ "inset 0 1px 1px 0 rgba(255, 255, 255, 0.35)",
196
+ "inset 1px 0 1px 0 rgba(255, 255, 255, 0.18)",
197
+ "inset 0 -1px 2px 0 rgba(0, 0, 0, 0.55)",
198
+ "inset -1px 0 2px 0 rgba(0, 0, 0, 0.45)",
199
+ "inset 0 0 0 1px rgba(255, 255, 255, 0.1)"
200
+ ].join(", ");
201
+ function ye(n) {
202
+ return n === "dark" ? yn : bn;
203
+ }
204
+ const Rn = 200, xn = 300, ot = 0.3, at = 0.15, it = 0.8, ct = 0.1;
205
+ function De(n, t, e) {
206
+ return Math.min(e, Math.max(t, n));
207
+ }
208
+ function Et(n) {
209
+ return Number.isFinite(n) ? De(1 - n / Rn, 0, 1) : 0;
210
+ }
211
+ function Sn(n, t, e, r, s) {
212
+ if (!(s > 0))
213
+ return { scaleX: 1, scaleY: 1 };
214
+ const o = n - e, a = t - r, i = Math.hypot(o, a);
215
+ if (i === 0 || !Number.isFinite(i))
216
+ return { scaleX: 1, scaleY: 1 };
217
+ const c = Et(i);
218
+ if (c === 0)
219
+ return { scaleX: 1, scaleY: 1 };
220
+ const u = o / i, g = a / i, b = Math.abs(u), h = Math.abs(g), f = Math.min(i / xn, 1) * s * c, l = De(
221
+ 1 + b * f * ot - h * f * at,
222
+ it,
223
+ Number.POSITIVE_INFINITY
224
+ ), m = De(
225
+ 1 + h * f * ot - b * f * at,
226
+ it,
227
+ Number.POSITIVE_INFINITY
228
+ );
229
+ return { scaleX: l, scaleY: m };
230
+ }
231
+ function vn(n, t, e, r, s) {
232
+ if (!(s > 0))
233
+ return { x: 0, y: 0 };
234
+ const o = n - e, a = t - r, i = Math.hypot(o, a);
235
+ if (i === 0 || !Number.isFinite(i))
236
+ return { x: 0, y: 0 };
237
+ const c = Et(i);
238
+ return c === 0 ? { x: 0, y: 0 } : {
239
+ x: o * s * ct * c,
240
+ y: a * s * ct * c
241
+ };
242
+ }
243
+ const O = {
244
+ displacementScale: 70,
245
+ blurAmount: 0.0625,
246
+ saturation: 140,
247
+ aberrationIntensity: 2,
248
+ cornerRadius: 999,
249
+ mode: "standard",
250
+ padding: "24px 32px",
251
+ elasticity: 0.15
252
+ }, An = 16, Cn = {
253
+ light: "rgba(255, 255, 255, 0.75)",
254
+ dark: "rgba(30, 30, 35, 0.75)"
255
+ }, En = {
256
+ light: "rgba(255, 255, 255, 0.92)",
257
+ dark: "rgba(30, 30, 35, 0.92)"
258
+ }, wn = {
259
+ light: "rgba(0, 0, 0, 0.92)",
260
+ dark: "rgba(255, 255, 255, 0.92)"
261
+ }, Mn = 2, Nn = {
262
+ light: "rgba(255, 255, 255, 0.92)",
263
+ dark: "rgba(22, 22, 26, 0.92)"
264
+ }, Tn = 100, he = {
265
+ light: "rgba(255, 255, 255, 0.96)",
266
+ dark: "rgba(17, 17, 20, 0.96)"
267
+ }, lt = "50%", ut = "0%", dt = { rest: 0.55, hover: 0.85 }, In = "70%", ft = 0.5, kn = "60%", mt = {
268
+ /** Conservative fallback: byte-for-byte the existing static shadow. */
269
+ static: 1,
270
+ /** Dark/dense backdrop ⇒ deeper, darker shadow. */
271
+ dark: 1.35,
272
+ /** Light/solid backdrop ⇒ shallower, lighter shadow. */
273
+ light: 0.7
274
+ }, pt = {
275
+ rest: [
276
+ { y: 8, blur: 24, alpha: 0.22 },
277
+ { y: 1, blur: 4, alpha: 0.14 }
278
+ ],
279
+ hover: [
280
+ { y: 12, blur: 32, alpha: 0.28 },
281
+ { y: 2, blur: 8, alpha: 0.18 }
282
+ ]
283
+ }, Fn = {
284
+ regular: {
285
+ /** Multiplier on the requested `saturation` (1 = unchanged). */
286
+ saturationFactor: 1,
287
+ /** Force the adaptive-tint path off regardless of `adaptiveTint`. */
288
+ forceNonAdaptive: !1,
289
+ /** Scheme-aware dimming-scrim color behind the content, or `null` for none. */
290
+ scrim: null
291
+ },
292
+ clear: {
293
+ // Reduce the tint/vibrancy so the material reads as clearer (more of the
294
+ // backdrop shows through), per the Clear aesthetic.
295
+ saturationFactor: 0.7,
296
+ // Clear has NO adaptive behavior by definition — it never samples.
297
+ forceNonAdaptive: !0,
298
+ // A subtle scheme-aware scrim so foreground labels stay readable over busy
299
+ // media even though the surface itself is more transparent.
300
+ scrim: {
301
+ light: "rgba(0, 0, 0, 0.18)",
302
+ dark: "rgba(0, 0, 0, 0.28)"
303
+ }
304
+ }
305
+ }, Ln = "rgba(255, 255, 255, 0.1)", gt = {
306
+ /** Inset ring color (translucent white). */
307
+ color: "rgba(255, 255, 255, 0.5)",
308
+ /** Ring width in px (hairline). */
309
+ width: 1
310
+ }, B = {
311
+ luminance: null,
312
+ scheme: null,
313
+ sampled: !1
314
+ }, _n = 0.5;
315
+ function Fe(n) {
316
+ const t = n / 255;
317
+ return t <= 0.03928 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4;
318
+ }
319
+ function Dn(n, t, e) {
320
+ const r = Fe(n), s = Fe(t), o = Fe(e);
321
+ return 0.2126 * r + 0.7152 * s + 0.0722 * o;
322
+ }
323
+ function $n(n) {
324
+ return n >= _n ? "light" : "dark";
325
+ }
326
+ function wt(n) {
327
+ const t = Dn(n.r, n.g, n.b);
328
+ return {
329
+ luminance: t,
330
+ scheme: $n(t),
331
+ sampled: !0
332
+ };
333
+ }
334
+ function On(n) {
335
+ if (!n)
336
+ return { r: 0, g: 0, b: 0, a: 0 };
337
+ const t = n.trim().toLowerCase();
338
+ if (t === "transparent" || t === "none")
339
+ return { r: 0, g: 0, b: 0, a: 0 };
340
+ const e = t.match(/rgba?\(([^)]+)\)/);
341
+ if (!(e != null && e[1]))
342
+ return { r: 0, g: 0, b: 0, a: 0 };
343
+ const r = e[1].split(/[\s,/]+/).filter(Boolean);
344
+ if (r.length < 3)
345
+ return { r: 0, g: 0, b: 0, a: 0 };
346
+ const s = Le(Number.parseFloat(r[0])), o = Le(Number.parseFloat(r[1])), a = Le(Number.parseFloat(r[2]));
347
+ let i = 1;
348
+ const c = r[3];
349
+ return c !== void 0 && (i = c.endsWith("%") ? Number.parseFloat(c) / 100 : Number.parseFloat(c), Number.isFinite(i) || (i = 1)), { r: s, g: o, b: a, a: Bn(i) };
350
+ }
351
+ function Le(n) {
352
+ return Number.isFinite(n) ? Math.max(0, Math.min(255, Math.round(n))) : 0;
353
+ }
354
+ function Bn(n) {
355
+ return Math.max(0, Math.min(1, n));
356
+ }
357
+ function Gn(n, t) {
358
+ const e = n.a;
359
+ return {
360
+ r: n.r * e + t.r * (1 - e),
361
+ g: n.g * e + t.g * (1 - e),
362
+ b: n.b * e + t.b * (1 - e)
363
+ };
364
+ }
365
+ function Pn(n, t) {
366
+ try {
367
+ return n(t);
368
+ } catch {
369
+ return B;
370
+ }
371
+ }
372
+ function Un(n, t) {
373
+ if (typeof document > "u" || typeof document.elementsFromPoint != "function" || typeof getComputedStyle != "function")
374
+ return B;
375
+ const e = document.elementsFromPoint(n.x, n.y);
376
+ if (!e || e.length === 0)
377
+ return B;
378
+ let r = { r: 255, g: 255, b: 255 };
379
+ const s = [];
380
+ for (const o of e) {
381
+ if (t && (o === t || t.contains(o)))
382
+ continue;
383
+ const a = getComputedStyle(o), i = a.backgroundImage && a.backgroundImage !== "none", c = On(a.backgroundColor);
384
+ if (i) {
385
+ s.push({ r: 128, g: 128, b: 128, a: 1 });
386
+ break;
387
+ }
388
+ if (c.a > 0 && (s.push(c), c.a >= 1))
389
+ break;
390
+ }
391
+ for (let o = s.length - 1; o >= 0; o--) {
392
+ const a = s[o];
393
+ a && (r = Gn(a, r));
394
+ }
395
+ return wt(r);
396
+ }
397
+ function Yn(n, t = {}) {
398
+ const { strategy: e, ignore: r } = t;
399
+ return Pn(e ?? ((o) => Un(o, r)), n);
400
+ }
401
+ function br(n, t = 8) {
402
+ return () => {
403
+ if (typeof document > "u" || typeof document.createElement != "function")
404
+ return B;
405
+ const e = document.createElement("canvas");
406
+ e.width = t, e.height = t;
407
+ const r = e.getContext("2d");
408
+ if (!r)
409
+ return B;
410
+ n(r, t, t);
411
+ const { data: s } = r.getImageData(0, 0, t, t);
412
+ let o = 0, a = 0, i = 0, c = 0;
413
+ for (let u = 0; u < s.length; u += 4)
414
+ o += s[u] ?? 0, a += s[u + 1] ?? 0, i += s[u + 2] ?? 0, c++;
415
+ return c === 0 ? B : wt({ r: o / c, g: a / c, b: i / c });
416
+ };
417
+ }
418
+ function Mt(n, t = {}) {
419
+ const { strategy: e, resampleOnScroll: r = !0, resampleOnResize: s = !0, disabled: o = !1 } = t, [a, i] = C(B), c = te(e);
420
+ return c.current = e, N(() => {
421
+ if (o) {
422
+ i((f) => f.sampled ? B : f);
423
+ return;
424
+ }
425
+ if (typeof window > "u" || typeof document > "u")
426
+ return;
427
+ let u = 0, g = !1;
428
+ const b = () => {
429
+ const f = n.current;
430
+ if (!f)
431
+ return;
432
+ const l = f.getBoundingClientRect(), m = {
433
+ x: l.left + l.width / 2,
434
+ y: l.top + l.height / 2
435
+ }, p = Yn(m, {
436
+ strategy: c.current,
437
+ ignore: f
438
+ });
439
+ g || i(
440
+ (R) => R.sampled === p.sampled && R.luminance === p.luminance && R.scheme === p.scheme ? R : p
441
+ );
442
+ }, h = () => {
443
+ u || (u = requestAnimationFrame(() => {
444
+ u = 0, b();
445
+ }));
446
+ };
447
+ return h(), r && window.addEventListener("scroll", h, { passive: !0, capture: !0 }), s && window.addEventListener("resize", h, { passive: !0 }), () => {
448
+ g = !0, u && cancelAnimationFrame(u), r && window.removeEventListener("scroll", h, { capture: !0 }), s && window.removeEventListener("resize", h);
449
+ };
450
+ }, [n, o, r, s]), a;
451
+ }
452
+ function Oe(n) {
453
+ const [t, e] = C(!1);
454
+ return N(() => {
455
+ if (typeof window > "u" || typeof window.matchMedia != "function")
456
+ return;
457
+ const r = window.matchMedia(n);
458
+ e(r.matches);
459
+ const s = (o) => {
460
+ e(o.matches);
461
+ };
462
+ return typeof r.addEventListener == "function" ? (r.addEventListener("change", s), () => r.removeEventListener("change", s)) : (r.addListener(s), () => r.removeListener(s));
463
+ }, [n]), t;
464
+ }
465
+ const Xn = "(prefers-reduced-motion: reduce)";
466
+ function Be() {
467
+ return Oe(Xn);
468
+ }
469
+ const $e = { x: 0, y: 0 }, ht = {
470
+ mousePos: $e,
471
+ offset: $e,
472
+ isActive: !1
473
+ };
474
+ function bt(n) {
475
+ return n ? n instanceof HTMLElement ? n : n.current ?? null : null;
476
+ }
477
+ function Hn() {
478
+ return typeof window > "u" ? !1 : "ontouchstart" in window || ((navigator == null ? void 0 : navigator.maxTouchPoints) ?? 0) > 0;
479
+ }
480
+ function qn(n = {}) {
481
+ const { container: t, globalMousePos: e, mouseOffset: r, elementRef: s } = n, o = Be(), [a, i] = C(!1), [c, u] = C(ht), g = te({ container: t, elementRef: s });
482
+ g.current = { container: t, elementRef: s }, N(() => {
483
+ i(Hn());
484
+ }, []);
485
+ const b = o || a, h = e !== void 0;
486
+ if (N(() => {
487
+ if (h || b || typeof window > "u" || typeof document > "u")
488
+ return;
489
+ const f = (l) => {
490
+ const { container: m, elementRef: p } = g.current, R = bt(m) ?? (p == null ? void 0 : p.current) ?? null;
491
+ if (!R)
492
+ return;
493
+ const x = R.getBoundingClientRect(), T = x.left + x.width / 2, S = x.top + x.height / 2;
494
+ u({
495
+ mousePos: { x: l.clientX, y: l.clientY },
496
+ offset: { x: l.clientX - T, y: l.clientY - S },
497
+ isActive: !0
498
+ });
499
+ };
500
+ return document.addEventListener("mousemove", f), () => document.removeEventListener("mousemove", f);
501
+ }, [h, b]), b)
502
+ return ht;
503
+ if (h) {
504
+ const f = e;
505
+ let l = r;
506
+ if (l === void 0) {
507
+ const m = bt(t) ?? (s == null ? void 0 : s.current) ?? null;
508
+ if (m) {
509
+ const p = m.getBoundingClientRect();
510
+ l = {
511
+ x: f.x - (p.left + p.width / 2),
512
+ y: f.y - (p.top + p.height / 2)
513
+ };
514
+ } else
515
+ l = $e;
516
+ }
517
+ return { mousePos: f, offset: l, isActive: !0 };
518
+ }
519
+ return c;
520
+ }
521
+ const Vn = "(prefers-contrast: more)";
522
+ function jn() {
523
+ return Oe(Vn);
524
+ }
525
+ const Wn = "(prefers-reduced-transparency: reduce)";
526
+ function zn() {
527
+ return Oe(Wn);
528
+ }
529
+ const _e = 16, Qn = 0.015;
530
+ function Kn(n, t) {
531
+ return (n ? pt.hover : pt.rest).map((r) => {
532
+ const s = Math.round(r.y * t * 100) / 100, o = Math.round(r.blur * t * 100) / 100, a = Math.round(Math.min(r.alpha * t, 0.6) * 1e3) / 1e3;
533
+ return `0 ${s}px ${o}px rgba(0, 0, 0, ${a})`;
534
+ }).join(", ");
535
+ }
536
+ function yt(n) {
537
+ return Math.max(_e, Math.round(n / _e) * _e);
538
+ }
539
+ function Zn() {
540
+ const [n, t] = C(!1);
541
+ return N(() => {
542
+ if (typeof window > "u" || typeof window.matchMedia != "function")
543
+ return;
544
+ const e = window.matchMedia("(prefers-color-scheme: dark)");
545
+ t(e.matches);
546
+ const r = (s) => t(s.matches);
547
+ return typeof e.addEventListener == "function" ? (e.addEventListener("change", r), () => e.removeEventListener("change", r)) : (e.addListener(r), () => e.removeListener(r));
548
+ }, []), n;
549
+ }
550
+ function Rt(n) {
551
+ return typeof n == "number" ? `${n}px` : n;
552
+ }
553
+ function Jn(n, t, e) {
554
+ return e || `blur(${n}px) saturate(${t}%)`;
555
+ }
556
+ function xt({
557
+ filterId: n,
558
+ mode: t,
559
+ width: e,
560
+ height: r,
561
+ effectiveScale: s,
562
+ aberrationIntensity: o,
563
+ blurStdDeviation: a,
564
+ saturation: i
565
+ }) {
566
+ const c = t === "turbulence", u = s + o, g = s, b = s - o, h = c ? /* @__PURE__ */ _(nt, { children: [
567
+ /* @__PURE__ */ d(
568
+ "feTurbulence",
569
+ {
570
+ type: "fractalNoise",
571
+ baseFrequency: Qn,
572
+ numOctaves: 2,
573
+ seed: 1,
574
+ result: "noise"
575
+ }
576
+ ),
577
+ /* @__PURE__ */ d("feGaussianBlur", { in: "noise", stdDeviation: 1.5, result: "dispSource" })
578
+ ] }) : /* @__PURE__ */ d(
579
+ "feImage",
580
+ {
581
+ href: hn(t, e, r),
582
+ x: "0",
583
+ y: "0",
584
+ width: e,
585
+ height: r,
586
+ preserveAspectRatio: "none",
587
+ result: "dispSource"
588
+ }
589
+ ), f = (x, T, S) => {
590
+ const E = T === "R" ? "1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0" : T === "G" ? "0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0" : "0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0";
591
+ return /* @__PURE__ */ _(nt, { children: [
592
+ /* @__PURE__ */ d(
593
+ "feDisplacementMap",
594
+ {
595
+ in: "SourceGraphic",
596
+ in2: "dispSource",
597
+ scale: x,
598
+ xChannelSelector: "R",
599
+ yChannelSelector: "B",
600
+ result: `${S}_disp`
601
+ }
602
+ ),
603
+ /* @__PURE__ */ d(
604
+ "feColorMatrix",
605
+ {
606
+ in: `${S}_disp`,
607
+ type: "matrix",
608
+ values: E,
609
+ result: S
610
+ }
611
+ )
612
+ ] });
613
+ }, l = Math.min(e, r) * 0.5, m = Math.min(Math.max(a, 0), l), p = e * 0.5 + m * 3, R = r * 0.5 + m * 3;
614
+ return /* @__PURE__ */ d(
615
+ "svg",
616
+ {
617
+ "aria-hidden": "true",
618
+ width: "0",
619
+ height: "0",
620
+ style: { position: "absolute", width: 0, height: 0, overflow: "hidden" },
621
+ children: /* @__PURE__ */ d("defs", { children: /* @__PURE__ */ _(
622
+ "filter",
623
+ {
624
+ id: n,
625
+ primitiveUnits: "userSpaceOnUse",
626
+ x: -p,
627
+ y: -R,
628
+ width: e + p * 2,
629
+ height: r + R * 2,
630
+ filterUnits: "userSpaceOnUse",
631
+ colorInterpolationFilters: "sRGB",
632
+ children: [
633
+ h,
634
+ f(u, "R", "chanR"),
635
+ f(g, "G", "chanG"),
636
+ f(b, "B", "chanB"),
637
+ /* @__PURE__ */ d(
638
+ "feComposite",
639
+ {
640
+ in: "chanR",
641
+ in2: "chanG",
642
+ operator: "arithmetic",
643
+ k1: "0",
644
+ k2: "1",
645
+ k3: "1",
646
+ k4: "0",
647
+ result: "chanRG"
648
+ }
649
+ ),
650
+ /* @__PURE__ */ d(
651
+ "feComposite",
652
+ {
653
+ in: "chanRG",
654
+ in2: "chanB",
655
+ operator: "arithmetic",
656
+ k1: "0",
657
+ k2: "1",
658
+ k3: "1",
659
+ k4: "0",
660
+ result: "aberrated"
661
+ }
662
+ ),
663
+ /* @__PURE__ */ d("feGaussianBlur", { in: "aberrated", stdDeviation: 0.5, result: "softened" }),
664
+ /* @__PURE__ */ _("radialGradient", { id: `${n}-edge`, cx: "50%", cy: "50%", r: "50%", children: [
665
+ /* @__PURE__ */ d("stop", { offset: "0%", stopColor: "#000000", stopOpacity: "0" }),
666
+ /* @__PURE__ */ d("stop", { offset: "70%", stopColor: "#000000", stopOpacity: "0" }),
667
+ /* @__PURE__ */ d("stop", { offset: "100%", stopColor: "#ffffff", stopOpacity: "1" })
668
+ ] }),
669
+ /* @__PURE__ */ d(
670
+ "feImage",
671
+ {
672
+ href: `#${n}-edge`,
673
+ x: "0",
674
+ y: "0",
675
+ width: e,
676
+ height: r,
677
+ preserveAspectRatio: "none",
678
+ result: "edgeMask"
679
+ }
680
+ ),
681
+ /* @__PURE__ */ d("feComposite", { in: "softened", in2: "edgeMask", operator: "in", result: "edgeOnly" }),
682
+ /* @__PURE__ */ d("feComposite", { in: "edgeOnly", in2: "SourceGraphic", operator: "over", result: "refracted" }),
683
+ /* @__PURE__ */ d("feGaussianBlur", { in: "refracted", stdDeviation: m, result: "blurred" }),
684
+ /* @__PURE__ */ d("feColorMatrix", { in: "blurred", type: "saturate", values: `${i / 100}` })
685
+ ]
686
+ }
687
+ ) })
688
+ }
689
+ );
690
+ }
691
+ function er({ targetRef: n, onScheme: t }) {
692
+ const { sampled: e, scheme: r } = Mt(n);
693
+ return N(() => {
694
+ t(e ? r : null);
695
+ }, [e, r, t]), null;
696
+ }
697
+ function tr({ targetRef: n, onScheme: t }) {
698
+ const { sampled: e, scheme: r } = Mt(n);
699
+ return N(() => {
700
+ t(e ? r : null);
701
+ }, [e, r, t]), null;
702
+ }
703
+ function Ge({
704
+ children: n,
705
+ displacement: t = !1,
706
+ displacementScale: e = O.displacementScale,
707
+ blurAmount: r = O.blurAmount,
708
+ saturation: s = O.saturation,
709
+ aberrationIntensity: o = O.aberrationIntensity,
710
+ elasticity: a = O.elasticity,
711
+ cornerRadius: i = O.cornerRadius,
712
+ padding: c = O.padding,
713
+ overLight: u,
714
+ adaptiveTint: g = !1,
715
+ scrollAwareShadow: b = !1,
716
+ variant: h = "regular",
717
+ mode: f = O.mode,
718
+ refract: l,
719
+ size: m,
720
+ center: p,
721
+ behind: R,
722
+ className: x,
723
+ style: T,
724
+ onClick: S,
725
+ globalMousePos: E,
726
+ mouseOffset: ne,
727
+ mouseContainer: re
728
+ }) {
729
+ const { canRefract: G, supportsBackdropFilter: P } = cn(), k = te(null), [w, V] = C(null), U = Be(), j = zn(), I = jn(), se = Zn(), [W, oe] = C(!1), [de, ae] = C(!1), [z, y] = C(null), [v, M] = C(null), { offset: A, isActive: Y } = qn({
730
+ container: re,
731
+ globalMousePos: E,
732
+ mouseOffset: ne,
733
+ elementRef: k
734
+ }), D = `lg-${St().replace(/:/g, "")}`;
735
+ N(() => {
736
+ const ie = k.current;
737
+ if (!ie) return;
738
+ let H = 0;
739
+ const ce = () => {
740
+ const ee = ie.getBoundingClientRect();
741
+ if (!Number.isFinite(ee.width) || !Number.isFinite(ee.height) || ee.width <= 0 || ee.height <= 0)
742
+ return;
743
+ const Je = yt(ee.width), et = yt(ee.height);
744
+ V(
745
+ (ge) => ge && ge.width === Je && ge.height === et ? ge : { width: Je, height: et }
746
+ );
747
+ };
748
+ if (ce(), typeof ResizeObserver > "u")
749
+ return;
750
+ const pe = new ResizeObserver(() => {
751
+ H || (H = requestAnimationFrame(() => {
752
+ H = 0, ce();
753
+ }));
754
+ });
755
+ return pe.observe(ie), () => {
756
+ H && cancelAnimationFrame(H), pe.disconnect();
757
+ };
758
+ }, []);
759
+ const F = Fn[h], fe = g && !F.forceNonAdaptive, Re = u ?? (fe && z ? z === "light" : !1), Ue = Re ? e / 2 : e, xe = I ? Tn : s * F.saturationFactor, Ye = I ? 0 : o, Q = w !== null && w.width > 0 && w.height > 0, Se = t && G && Q && !j, Tt = Se ? `url(#${D})` : null, It = l !== void 0 || m !== void 0 || p !== void 0, ve = (m == null ? void 0 : m.width) ?? (Q ? w.width : 0), Ae = (m == null ? void 0 : m.height) ?? (Q ? w.height : 0), Xe = It && !j && Number.isFinite(ve) && Number.isFinite(Ae) && ve > 0 && Ae > 0, He = `${D}-copy`, kt = l !== void 0 ? l : n, Ft = `${(((p == null ? void 0 : p.x) ?? 0.5) * 100).toFixed(2)}% ${(((p == null ? void 0 : p.y) ?? 0.5) * 100).toFixed(2)}%`, qe = P && !Se && !j && !I, Ce = r * An * (Re ? 1.5 : 1), Ee = P ? Jn(Ce, xe, Tt) : void 0, $ = Rt(i), K = Y && !U, Ve = K ? Sn(A.x, A.y, 0, 0, a) : { scaleX: 1, scaleY: 1 }, je = K ? vn(A.x, A.y, 0, 0, a) : { x: 0, y: 0 }, We = typeof S == "function" && de ? 0.96 : 1, X = `translate(${je.x.toFixed(2)}px, ${je.y.toFixed(
760
+ 2
761
+ )}px) scale(${(Ve.scaleX * We).toFixed(4)}, ${(Ve.scaleY * We).toFixed(4)})`, Lt = 135 + (K ? A.x * 0.15 : 0);
762
+ let we = lt, Me = ut;
763
+ if (K && Q) {
764
+ const ie = 50 + A.x / (w.width / 2) * 50, H = 50 + A.y / (w.height / 2) * 50, ce = (pe) => Math.max(-20, Math.min(120, pe));
765
+ we = `${ce(ie).toFixed(2)}%`, Me = `${ce(H).toFixed(2)}%`;
766
+ }
767
+ const _t = de, Dt = K && Q ? we : "50%", $t = K && Q ? Me : "50%", Ne = ye(se ? "dark" : "light");
768
+ let Te = Ne;
769
+ I ? Te = `inset 0 0 0 ${Mn}px ${wn[se ? "dark" : "light"]}, ${Ne}` : qe && (Te = `inset 0 0 0 ${gt.width}px ${gt.color}, ${Ne}`);
770
+ const ze = W ? dt.hover : dt.rest, Qe = W ? 0.55 : 0.35, Ot = {
771
+ position: "relative",
772
+ display: "inline-block",
773
+ padding: Rt(c),
774
+ borderRadius: $,
775
+ ...T
776
+ }, Bt = b ? mt[v ?? "static"] : mt.static, Gt = {
777
+ position: "absolute",
778
+ inset: 0,
779
+ borderRadius: $,
780
+ transform: X,
781
+ // Scroll-aware + reduced motion: drop the box-shadow transition so the depth
782
+ // SNAPS between scroll-aware states instead of animating. Only applies on the
783
+ // opt-in path under reduced motion, so the default render (and the default
784
+ // reduced-motion render) keeps the existing transition byte-for-byte. The
785
+ // transform transition always stays (already reduced-motion-neutral via
786
+ // surfaceTransform).
787
+ transition: b && U ? "transform 120ms ease-out" : "box-shadow 200ms ease, transform 120ms ease-out",
788
+ boxShadow: Kn(W, Bt),
789
+ zIndex: -1,
790
+ pointerEvents: "none"
791
+ }, Z = se ? "dark" : "light";
792
+ let J;
793
+ I ? J = Nn[Z] : j ? J = P ? Cn[Z] : En[Z] : P ? qe && (J = Ln) : J = Z === "dark" ? "rgba(30, 30, 35, 0.55)" : "rgba(255, 255, 255, 0.55)";
794
+ const Pt = {
795
+ position: "absolute",
796
+ inset: 0,
797
+ borderRadius: $,
798
+ overflow: "hidden",
799
+ // Tiers 1/2 carry the frosted backdrop (with -webkit- prefix); tier 3 omits
800
+ // the filter entirely (no orphaned/unsupported declaration). The `background`
801
+ // is unset by default on tiers 1/2 (the backdrop carries the look), the ~0.55
802
+ // solid on tier 3, and a more-opaque frosting fill on EVERY tier when
803
+ // reduced-transparency is active (layered over the retained blur on 1/2).
804
+ ...Ee ? { backdropFilter: Ee, WebkitBackdropFilter: Ee } : {},
805
+ ...J ? { background: J } : {},
806
+ // Pure-CSS beveled rim — renders in every browser, independent of canRefract.
807
+ // Under increased contrast a solid inset border ring is prepended (geometry
808
+ // unchanged); otherwise this is exactly the bevel.
809
+ boxShadow: Te,
810
+ transform: X,
811
+ transition: "transform 120ms ease-out",
812
+ // Keep the surface strictly behind the content layer.
813
+ zIndex: 0,
814
+ pointerEvents: "none"
815
+ }, Ut = {
816
+ position: "absolute",
817
+ inset: 0,
818
+ borderRadius: $,
819
+ transform: X,
820
+ transition: U ? "transform 120ms ease-out" : "transform 120ms ease-out, background-position 120ms ease-out",
821
+ mixBlendMode: "screen",
822
+ // Custom props expose the tracked center; the gradient consumes them so a
823
+ // re-render (pointer move) only changes the variables, not the layer markup.
824
+ "--lg-spec-x": we,
825
+ "--lg-spec-y": Me,
826
+ background: `radial-gradient(circle ${In} at var(--lg-spec-x, ${lt}) var(--lg-spec-y, ${ut}), rgba(255,255,255,${ze}) 0%, rgba(255,255,255,${(ze * 0.4).toFixed(3)}) 30%, rgba(255,255,255,0) 65%)`,
827
+ zIndex: 0,
828
+ pointerEvents: "none"
829
+ }, Yt = {
830
+ position: "absolute",
831
+ inset: 0,
832
+ borderRadius: $,
833
+ transform: X,
834
+ mixBlendMode: "screen",
835
+ "--lg-spec-x": Dt,
836
+ "--lg-spec-y": $t,
837
+ background: `radial-gradient(circle ${kn} at var(--lg-spec-x, 50%) var(--lg-spec-y, 50%), rgba(255,255,255,${ft}) 0%, rgba(255,255,255,${(ft * 0.5).toFixed(3)}) 25%, rgba(255,255,255,0) 55%)`,
838
+ opacity: _t ? 1 : 0,
839
+ transition: U ? "transform 120ms ease-out" : "transform 120ms ease-out, opacity 360ms ease-out",
840
+ zIndex: 0,
841
+ pointerEvents: "none"
842
+ }, Xt = {
843
+ position: "absolute",
844
+ inset: 0,
845
+ borderRadius: $,
846
+ transform: X,
847
+ transition: "transform 120ms ease-out",
848
+ mixBlendMode: "overlay",
849
+ padding: "1px",
850
+ background: `linear-gradient(${Lt}deg, rgba(255,255,255,${Qe}) 0%, rgba(255,255,255,0) 50%, rgba(0,0,0,${Qe * 0.6}) 100%)`,
851
+ zIndex: 0,
852
+ pointerEvents: "none"
853
+ };
854
+ let me;
855
+ fe && I ? me = Z === "light" ? he.dark : he.light : fe && z && (me = Re ? he.dark : he.light);
856
+ const Ht = {
857
+ position: "relative",
858
+ zIndex: 1,
859
+ ...me ? { color: me } : {}
860
+ }, qt = {
861
+ position: "absolute",
862
+ inset: 0,
863
+ borderRadius: $,
864
+ overflow: "hidden",
865
+ transform: X,
866
+ transition: "transform 120ms ease-out",
867
+ zIndex: 0,
868
+ pointerEvents: "none"
869
+ }, Vt = {
870
+ position: "absolute",
871
+ inset: 0,
872
+ filter: Xe ? `url(#${He})` : void 0,
873
+ transformOrigin: Ft,
874
+ ...R ? { background: R } : {}
875
+ }, Ke = F.scrim ? F.scrim[Z] : null, Ze = Ke ? {
876
+ position: "absolute",
877
+ inset: 0,
878
+ borderRadius: $,
879
+ transform: X,
880
+ transition: "transform 120ms ease-out",
881
+ background: Ke,
882
+ // Above the surface/highlight/border layers (all zIndex 0) but strictly
883
+ // BELOW the content layer (zIndex 1), so it dims the backdrop for the
884
+ // content without veiling the content itself.
885
+ zIndex: 0,
886
+ pointerEvents: "none"
887
+ } : null;
888
+ return (
889
+ // onClick is a pass-through forwarded from the public API; the wrapper is a
890
+ // non-semantic presentational container, and consumers supply their own
891
+ // interactive (and keyboard-accessible) elements as children. Forcing
892
+ // keyboard handlers here would invent semantics the consumer didn't request.
893
+ // biome-ignore lint/a11y/useKeyWithClickEvents: presentational pass-through; children own interactivity
894
+ /* @__PURE__ */ _(
895
+ "div",
896
+ {
897
+ ref: k,
898
+ className: x,
899
+ style: Ot,
900
+ onClick: S,
901
+ onMouseEnter: () => oe(!0),
902
+ onMouseLeave: () => {
903
+ oe(!1), ae(!1);
904
+ },
905
+ onMouseDown: () => ae(!0),
906
+ onMouseUp: () => ae(!1),
907
+ children: [
908
+ /* @__PURE__ */ d("div", { "data-lg-shadow": "", style: Gt, "aria-hidden": "true" }),
909
+ /* @__PURE__ */ d("div", { "data-lg-surface": "", style: Pt, children: Se ? /* @__PURE__ */ d(
910
+ xt,
911
+ {
912
+ filterId: D,
913
+ mode: f,
914
+ width: w.width,
915
+ height: w.height,
916
+ effectiveScale: Ue,
917
+ aberrationIntensity: Ye,
918
+ blurStdDeviation: Ce,
919
+ saturation: xe
920
+ }
921
+ ) : null }),
922
+ Xe ? /* @__PURE__ */ _(
923
+ "div",
924
+ {
925
+ "data-lg-refraction": "",
926
+ style: qt,
927
+ "aria-hidden": "true",
928
+ inert: "true",
929
+ children: [
930
+ /* @__PURE__ */ d(
931
+ xt,
932
+ {
933
+ filterId: He,
934
+ mode: f,
935
+ width: ve,
936
+ height: Ae,
937
+ effectiveScale: Ue,
938
+ aberrationIntensity: Ye,
939
+ blurStdDeviation: Ce,
940
+ saturation: xe
941
+ }
942
+ ),
943
+ /* @__PURE__ */ d("div", { "data-lg-refraction-copy": "", style: Vt, children: kt })
944
+ ]
945
+ }
946
+ ) : null,
947
+ /* @__PURE__ */ d("span", { "data-lg-highlight": "", style: Ut, "aria-hidden": "true" }),
948
+ /* @__PURE__ */ d("span", { "data-lg-press-glow": "", style: Yt, "aria-hidden": "true" }),
949
+ /* @__PURE__ */ d("span", { "data-lg-border": "", style: Xt, "aria-hidden": "true" }),
950
+ Ze ? /* @__PURE__ */ d("span", { "data-lg-scrim": "", style: Ze, "aria-hidden": "true" }) : null,
951
+ fe ? /* @__PURE__ */ d(er, { targetRef: k, onScheme: y }) : null,
952
+ b ? /* @__PURE__ */ d(tr, { targetRef: k, onScheme: M }) : null,
953
+ /* @__PURE__ */ d("div", { "data-lg-content": "", style: Ht, children: n })
954
+ ]
955
+ }
956
+ )
957
+ );
958
+ }
959
+ function nr(...n) {
960
+ return (t) => {
961
+ for (const e of n)
962
+ e && (typeof e == "function" ? e(t) : e.current = t);
963
+ };
964
+ }
965
+ function rr(n, t) {
966
+ return n ? t ? (...e) => {
967
+ n(...e);
968
+ const r = e[0];
969
+ (!r || !r.defaultPrevented) && t(...e);
970
+ } : n : t;
971
+ }
972
+ function sr(n, t) {
973
+ const e = { ...t };
974
+ for (const r in n) {
975
+ const s = n[r], o = t[r];
976
+ r === "className" ? e.className = [o, s].filter(Boolean).join(" ") : r === "style" ? e.style = { ...o, ...s } : /^on[A-Z]/.test(r) ? e[r] = rr(
977
+ o,
978
+ s
979
+ ) : s !== void 0 && (e[r] = s);
980
+ }
981
+ return e;
982
+ }
983
+ const Nt = be(function(t, e) {
984
+ const { children: r, ...s } = t;
985
+ if (!jt(r) || Wt.count(r) !== 1)
986
+ throw new Error(
987
+ 'Slot (asChild) expects exactly one valid React element child. Pass a single element, e.g. <GlassButton asChild><a href="…">Link</a></GlassButton>.'
988
+ );
989
+ const o = r, a = o.props, i = o.ref ?? a.ref, c = sr(s, a);
990
+ return c.ref = nr(e, i), zt(o, c);
991
+ });
992
+ function or(...n) {
993
+ return n.filter(Boolean).join(" ");
994
+ }
995
+ function Pe(n) {
996
+ const { base: t, variants: e, defaultVariants: r } = n;
997
+ return (s = {}) => {
998
+ var a;
999
+ const o = [t];
1000
+ for (const i in e) {
1001
+ const c = s[i] ?? (r == null ? void 0 : r[i]);
1002
+ c !== void 0 && o.push((a = e[i]) == null ? void 0 : a[c]);
1003
+ }
1004
+ return o.push(s.className), or(...o);
1005
+ };
1006
+ }
1007
+ const ar = {
1008
+ primary: { displacementScale: 80, blurAmount: 0.0625, saturation: 160 },
1009
+ secondary: { displacementScale: 60, blurAmount: 0.0625, saturation: 140 },
1010
+ subtle: { displacementScale: 40, blurAmount: 0.05, saturation: 120 }
1011
+ }, ir = {
1012
+ sm: { cornerRadius: 999, padding: "6px 14px" },
1013
+ md: { cornerRadius: 999, padding: "10px 20px" },
1014
+ lg: { cornerRadius: 999, padding: "14px 28px" },
1015
+ icon: { cornerRadius: 999, padding: "10px" }
1016
+ }, cr = Pe({
1017
+ base: "lg-button",
1018
+ variants: {
1019
+ variant: {
1020
+ primary: "lg-button--primary",
1021
+ secondary: "lg-button--secondary",
1022
+ subtle: "lg-button--subtle"
1023
+ },
1024
+ size: {
1025
+ sm: "lg-button--sm",
1026
+ md: "lg-button--md",
1027
+ lg: "lg-button--lg",
1028
+ icon: "lg-button--icon"
1029
+ }
1030
+ },
1031
+ defaultVariants: { variant: "primary", size: "md" }
1032
+ }), yr = be(function({
1033
+ variant: t = "primary",
1034
+ size: e = "md",
1035
+ asChild: r = !1,
1036
+ shine: s = !0,
1037
+ contentClassName: o,
1038
+ glassProps: a,
1039
+ className: i,
1040
+ children: c,
1041
+ style: u,
1042
+ type: g,
1043
+ disabled: b,
1044
+ ...h
1045
+ }, f) {
1046
+ const l = cr({ variant: t, size: e, className: i }), m = {
1047
+ "--lg-edge-shadow": ye("light"),
1048
+ ...u
1049
+ }, p = /* @__PURE__ */ d("span", { className: ["lg-content", o].filter(Boolean).join(" "), children: c }), R = r ? /* @__PURE__ */ d(
1050
+ Nt,
1051
+ {
1052
+ ref: f,
1053
+ className: l,
1054
+ style: m,
1055
+ "data-shine": s ? "true" : "false",
1056
+ ...h,
1057
+ children: c
1058
+ }
1059
+ ) : /* @__PURE__ */ d(
1060
+ "button",
1061
+ {
1062
+ ref: f,
1063
+ type: g ?? "button",
1064
+ disabled: b,
1065
+ className: l,
1066
+ style: m,
1067
+ "data-shine": s ? "true" : "false",
1068
+ ...h,
1069
+ children: p
1070
+ }
1071
+ ), x = {
1072
+ ...ar[t],
1073
+ ...ir[e]
1074
+ };
1075
+ return /* @__PURE__ */ d(Ge, { ...x, ...a, children: R });
1076
+ }), lr = Pe({
1077
+ base: "lg-card",
1078
+ variants: {
1079
+ elevation: {
1080
+ flat: "lg-card--flat",
1081
+ raised: "lg-card--raised",
1082
+ floating: "lg-card--floating"
1083
+ }
1084
+ },
1085
+ defaultVariants: { elevation: "raised" }
1086
+ }), ur = {
1087
+ cornerRadius: 28,
1088
+ padding: "24px 28px",
1089
+ displacementScale: 50
1090
+ }, Rr = be(function({
1091
+ elevation: t = "raised",
1092
+ asChild: e = !1,
1093
+ contentClassName: r,
1094
+ glassProps: s,
1095
+ className: o,
1096
+ children: a,
1097
+ style: i,
1098
+ ...c
1099
+ }, u) {
1100
+ const g = lr({ elevation: t, className: o }), b = {
1101
+ "--lg-edge-shadow": ye("light"),
1102
+ ...i
1103
+ }, h = /* @__PURE__ */ d("div", { className: ["lg-content", r].filter(Boolean).join(" "), children: a }), f = e ? /* @__PURE__ */ d(
1104
+ Nt,
1105
+ {
1106
+ ref: u,
1107
+ className: g,
1108
+ style: b,
1109
+ "data-elevation": t,
1110
+ ...c,
1111
+ children: a
1112
+ }
1113
+ ) : /* @__PURE__ */ d(
1114
+ "div",
1115
+ {
1116
+ ref: u,
1117
+ className: g,
1118
+ style: b,
1119
+ "data-elevation": t,
1120
+ ...c,
1121
+ children: h
1122
+ }
1123
+ );
1124
+ return /* @__PURE__ */ d(Ge, { ...ur, ...s, children: f });
1125
+ }), dr = typeof window < "u" ? Kt : N, fr = {
1126
+ sm: { displacementScale: 40, blurAmount: 0.05, saturation: 130 },
1127
+ md: { displacementScale: 56, blurAmount: 0.0625, saturation: 140 },
1128
+ lg: { displacementScale: 72, blurAmount: 0.0625, saturation: 150 }
1129
+ }, mr = Pe({
1130
+ base: "lg-segmented",
1131
+ variants: {
1132
+ size: {
1133
+ sm: "lg-segmented--sm",
1134
+ md: "lg-segmented--md",
1135
+ lg: "lg-segmented--lg"
1136
+ }
1137
+ },
1138
+ defaultVariants: { size: "md" }
1139
+ }), xr = be(
1140
+ function({
1141
+ options: t,
1142
+ value: e,
1143
+ defaultValue: r,
1144
+ onValueChange: s,
1145
+ size: o = "md",
1146
+ label: a,
1147
+ "aria-label": i,
1148
+ showLabel: c = !1,
1149
+ className: u,
1150
+ style: g,
1151
+ name: b,
1152
+ glassProps: h
1153
+ }, f) {
1154
+ var z;
1155
+ const l = St(), m = b ?? `lg-seg-${l.replace(/:/g, "")}`, p = (z = t[0]) == null ? void 0 : z.value, R = e !== void 0, [x, T] = C(
1156
+ r ?? p
1157
+ ), S = R ? e : x, E = Qt(() => {
1158
+ const y = t.findIndex((v) => v.value === S);
1159
+ return y < 0 ? 0 : y;
1160
+ }, [t, S]), ne = t.length || 1, re = Be(), G = te(null), P = te([]), [k, w] = C(null), V = tt(() => {
1161
+ const y = G.current, v = P.current[E];
1162
+ if (!y || !v) return;
1163
+ const M = y.getBoundingClientRect(), A = v.getBoundingClientRect();
1164
+ if (!Number.isFinite(M.width) || M.width <= 0) return;
1165
+ const Y = A.left - M.left, D = A.width;
1166
+ !Number.isFinite(Y) || !Number.isFinite(D) || D <= 0 || w(
1167
+ (F) => F && F.left === Y && F.width === D ? F : { left: Y, width: D }
1168
+ );
1169
+ }, [E]), U = te(V);
1170
+ U.current = V, dr(() => {
1171
+ V();
1172
+ }, [V]), N(() => {
1173
+ const y = G.current;
1174
+ if (!y || typeof ResizeObserver > "u") return;
1175
+ let v = 0;
1176
+ const M = new ResizeObserver(() => {
1177
+ v || (v = requestAnimationFrame(() => {
1178
+ v = 0, U.current();
1179
+ }));
1180
+ });
1181
+ return M.observe(y), () => {
1182
+ v && cancelAnimationFrame(v), M.disconnect();
1183
+ };
1184
+ }, []);
1185
+ const j = tt(
1186
+ (y) => {
1187
+ R || T(y), s == null || s(y);
1188
+ },
1189
+ [R, s]
1190
+ ), I = fr[o], se = ye("light"), W = k !== null, oe = W ? {
1191
+ width: `${k.width}px`,
1192
+ transform: `translateX(${k.left}px)`
1193
+ } : {
1194
+ width: `${100 / ne}%`,
1195
+ transform: `translateX(${E * 100}%)`
1196
+ };
1197
+ oe.transition = re ? "none" : "transform 320ms cubic-bezier(0.32, 0.72, 0, 1), width 320ms cubic-bezier(0.32, 0.72, 0, 1)";
1198
+ const de = {
1199
+ "--lg-edge-shadow": se,
1200
+ ...g
1201
+ }, ae = /* @__PURE__ */ d(
1202
+ "legend",
1203
+ {
1204
+ className: c ? "lg-segmented-legend lg-segmented-legend--visible" : "lg-segmented-legend",
1205
+ children: a ?? i ?? "Options"
1206
+ }
1207
+ );
1208
+ return /* @__PURE__ */ _(
1209
+ "fieldset",
1210
+ {
1211
+ ref: f,
1212
+ className: mr({ size: o, className: u }),
1213
+ style: de,
1214
+ "aria-label": i,
1215
+ "data-selected-index": E,
1216
+ "data-measured": W ? "true" : "false",
1217
+ children: [
1218
+ ae,
1219
+ /* @__PURE__ */ _("div", { className: "lg-segmented-track", ref: G, children: [
1220
+ /* @__PURE__ */ d(
1221
+ "div",
1222
+ {
1223
+ className: "lg-segmented-indicator",
1224
+ style: oe,
1225
+ "data-selected-index": E,
1226
+ "aria-hidden": "true",
1227
+ children: /* @__PURE__ */ d(
1228
+ Ge,
1229
+ {
1230
+ cornerRadius: "inherit",
1231
+ padding: 0,
1232
+ displacementScale: I.displacementScale,
1233
+ blurAmount: I.blurAmount,
1234
+ saturation: I.saturation,
1235
+ ...h,
1236
+ className: "lg-segmented-glass",
1237
+ style: { width: "100%", height: "100%", display: "block" },
1238
+ children: /* @__PURE__ */ d("span", { "aria-hidden": "true", className: "lg-segmented-glass-fill" })
1239
+ }
1240
+ )
1241
+ }
1242
+ ),
1243
+ t.map((y, v) => {
1244
+ const M = y.value === S, A = `${m}-${y.value}`;
1245
+ return /* @__PURE__ */ _(
1246
+ "label",
1247
+ {
1248
+ htmlFor: A,
1249
+ className: "lg-segmented-option",
1250
+ "data-active": M ? "true" : "false",
1251
+ "data-icon-only": y.icon != null && y.label == null ? "true" : "false",
1252
+ ref: (Y) => {
1253
+ P.current[v] = Y;
1254
+ },
1255
+ children: [
1256
+ /* @__PURE__ */ d(
1257
+ "input",
1258
+ {
1259
+ id: A,
1260
+ className: "lg-segmented-input",
1261
+ type: "radio",
1262
+ name: m,
1263
+ value: y.value,
1264
+ checked: M,
1265
+ disabled: y.disabled,
1266
+ onChange: () => j(y.value)
1267
+ }
1268
+ ),
1269
+ y.icon != null ? /* @__PURE__ */ d("span", { className: "lg-segmented-icon", "aria-hidden": "true", children: y.icon }) : null,
1270
+ y.label != null ? /* @__PURE__ */ d("span", { className: "lg-segmented-label", children: y.label }) : null
1271
+ ]
1272
+ },
1273
+ y.value
1274
+ );
1275
+ })
1276
+ ] })
1277
+ ]
1278
+ }
1279
+ );
1280
+ }
1281
+ ), Sr = "0.0.0";
1282
+ export {
1283
+ yn as GLASS_EDGE_DARK,
1284
+ bn as GLASS_EDGE_LIGHT,
1285
+ yr as GlassButton,
1286
+ Rr as GlassCard,
1287
+ xr as GlassSegmentedControl,
1288
+ _n as LIGHT_DARK_THRESHOLD,
1289
+ Ge as LiquidGlass,
1290
+ B as UNSAMPLED,
1291
+ Sr as VERSION,
1292
+ wt as averageColorToSample,
1293
+ Sn as calculateDirectionalScale,
1294
+ vn as calculateElasticTranslation,
1295
+ br as createCanvasSnapshotStrategy,
1296
+ an as detectGlassCapabilities,
1297
+ Un as domBackgroundStrategy,
1298
+ vt as getConservativeGlassCapabilities,
1299
+ hn as getDisplacementMap,
1300
+ ye as getGlassEdgeShadow,
1301
+ $n as luminanceToScheme,
1302
+ On as parseCssColor,
1303
+ Dn as relativeLuminance,
1304
+ le as roundedRectSDF,
1305
+ Pn as safeSample,
1306
+ Yn as sampleBackdropLuminance,
1307
+ ue as smoothStep,
1308
+ Mt as useBackdropLuminance,
1309
+ cn as useGlassCapabilities,
1310
+ qn as useMousePosition,
1311
+ jn as usePrefersContrast,
1312
+ Be as useReducedMotion,
1313
+ zn as useReducedTransparency
1314
+ };