nfx-ui 0.6.2 → 0.7.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.
Files changed (116) hide show
  1. package/dist/animations.cjs +2 -2
  2. package/dist/animations.d.ts +0 -101
  3. package/dist/animations.mjs +9 -11
  4. package/dist/apis.cjs +2 -2
  5. package/dist/apis.cjs.map +1 -1
  6. package/dist/apis.d.ts +0 -6
  7. package/dist/apis.mjs +8 -9
  8. package/dist/apis.mjs.map +1 -1
  9. package/dist/{chunk-BounceLoading-B54QEw0n.mjs → chunk-BounceLoading-C5XE8DKc.mjs} +62 -65
  10. package/dist/{chunk-BounceLoading-B54QEw0n.mjs.map → chunk-BounceLoading-C5XE8DKc.mjs.map} +1 -1
  11. package/dist/chunk-BounceLoading-CwvDT5HF.cjs +11 -0
  12. package/dist/{chunk-BounceLoading-C6n4BZVJ.cjs.map → chunk-BounceLoading-CwvDT5HF.cjs.map} +1 -1
  13. package/dist/chunk-animations-CEZ01ALd.mjs +740 -0
  14. package/dist/chunk-animations-CEZ01ALd.mjs.map +1 -0
  15. package/dist/chunk-animations-CO7zKbti.cjs +3 -0
  16. package/dist/chunk-animations-CO7zKbti.cjs.map +1 -0
  17. package/dist/chunk-i18n-BCDF-skF.cjs +3 -0
  18. package/dist/{chunk-i18n-daHSL0Nm.cjs.map → chunk-i18n-BCDF-skF.cjs.map} +1 -1
  19. package/dist/{chunk-i18n-BBPhh6MT.mjs → chunk-i18n-BsyWvA9c.mjs} +44 -69
  20. package/dist/{chunk-i18n-BBPhh6MT.mjs.map → chunk-i18n-BsyWvA9c.mjs.map} +1 -1
  21. package/dist/{chunk-types-SD4MzUGp.mjs → chunk-language-B8sfGadQ.mjs} +2 -2
  22. package/dist/chunk-language-B8sfGadQ.mjs.map +1 -0
  23. package/dist/{chunk-types-BE3JCLff.cjs → chunk-language-Bqmpuf2W.cjs} +1 -1
  24. package/dist/chunk-language-Bqmpuf2W.cjs.map +1 -0
  25. package/dist/{chunk-types-DNPBKfmx.mjs → chunk-layout-C2uqDEMJ.mjs} +2 -2
  26. package/dist/chunk-layout-C2uqDEMJ.mjs.map +1 -0
  27. package/dist/{chunk-types-C_opkZGr.cjs → chunk-layout-D728gccQ.cjs} +1 -1
  28. package/dist/chunk-layout-D728gccQ.cjs.map +1 -0
  29. package/dist/{chunk-lucide-BhgnmTNo.mjs → chunk-lucide-C54WenI6.mjs} +2 -2
  30. package/dist/{chunk-lucide-BhgnmTNo.mjs.map → chunk-lucide-C54WenI6.mjs.map} +1 -1
  31. package/dist/chunk-preference-BWEpbZgC.mjs +50 -0
  32. package/dist/{chunk-preference-By58ZcJ_.mjs.map → chunk-preference-BWEpbZgC.mjs.map} +1 -1
  33. package/dist/chunk-preference-Dbugm0iQ.cjs +3 -0
  34. package/dist/{chunk-preference-C144GkCD.cjs.map → chunk-preference-Dbugm0iQ.cjs.map} +1 -1
  35. package/dist/chunk-theme-9dcwRKw8.mjs +17 -0
  36. package/dist/chunk-theme-9dcwRKw8.mjs.map +1 -0
  37. package/dist/chunk-theme-BFvDRCYS.cjs +3 -0
  38. package/dist/chunk-theme-BFvDRCYS.cjs.map +1 -0
  39. package/dist/components.cjs +3 -3
  40. package/dist/components.cjs.map +1 -1
  41. package/dist/components.d.ts +0 -412
  42. package/dist/components.mjs +628 -642
  43. package/dist/components.mjs.map +1 -1
  44. package/dist/constants.cjs +1 -1
  45. package/dist/constants.d.ts +0 -129
  46. package/dist/constants.mjs +1 -1
  47. package/dist/events.cjs +1 -1
  48. package/dist/events.d.ts +0 -60
  49. package/dist/events.mjs +1 -1
  50. package/dist/hooks.cjs +1 -1
  51. package/dist/hooks.d.ts +0 -315
  52. package/dist/hooks.mjs +1 -1
  53. package/dist/icons.cjs +2 -2
  54. package/dist/icons.d.ts +0 -217
  55. package/dist/icons.mjs +2 -2
  56. package/dist/languages.cjs +2 -2
  57. package/dist/languages.cjs.map +1 -1
  58. package/dist/languages.d.ts +0 -178
  59. package/dist/languages.mjs +4 -4
  60. package/dist/languages.mjs.map +1 -1
  61. package/dist/layouts.cjs +2 -2
  62. package/dist/layouts.cjs.map +1 -1
  63. package/dist/layouts.d.ts +0 -208
  64. package/dist/layouts.mjs +201 -210
  65. package/dist/layouts.mjs.map +1 -1
  66. package/dist/navigations.cjs +1 -1
  67. package/dist/navigations.d.ts +0 -71
  68. package/dist/navigations.mjs +1 -1
  69. package/dist/pixel-blast.cjs +192 -0
  70. package/dist/pixel-blast.cjs.map +1 -0
  71. package/dist/pixel-blast.d.ts +1 -0
  72. package/dist/pixel-blast.mjs +506 -0
  73. package/dist/pixel-blast.mjs.map +1 -0
  74. package/dist/preference.cjs +2 -2
  75. package/dist/preference.d.ts +0 -95
  76. package/dist/preference.mjs +8 -11
  77. package/dist/services.cjs +2 -2
  78. package/dist/services.cjs.map +1 -1
  79. package/dist/services.d.ts +0 -7
  80. package/dist/services.mjs +9 -10
  81. package/dist/services.mjs.map +1 -1
  82. package/dist/stores.cjs +2 -2
  83. package/dist/stores.cjs.map +1 -1
  84. package/dist/stores.d.ts +1 -101
  85. package/dist/stores.mjs +53 -53
  86. package/dist/stores.mjs.map +1 -1
  87. package/dist/themes.cjs +2 -2
  88. package/dist/themes.cjs.map +1 -1
  89. package/dist/themes.d.ts +0 -232
  90. package/dist/themes.mjs +888 -721
  91. package/dist/themes.mjs.map +1 -1
  92. package/dist/types.cjs +1 -1
  93. package/dist/types.d.ts +0 -180
  94. package/dist/types.mjs +1 -1
  95. package/dist/utils.cjs +2 -2
  96. package/dist/utils.cjs.map +1 -1
  97. package/dist/utils.d.ts +0 -485
  98. package/dist/utils.mjs +143 -156
  99. package/dist/utils.mjs.map +1 -1
  100. package/package.json +45 -29
  101. package/dist/chunk-BounceLoading-C6n4BZVJ.cjs +0 -11
  102. package/dist/chunk-animations-Brp-bsaE.mjs +0 -1243
  103. package/dist/chunk-animations-Brp-bsaE.mjs.map +0 -1
  104. package/dist/chunk-animations-e2F3zuP9.cjs +0 -190
  105. package/dist/chunk-animations-e2F3zuP9.cjs.map +0 -1
  106. package/dist/chunk-i18n-daHSL0Nm.cjs +0 -3
  107. package/dist/chunk-preference-By58ZcJ_.mjs +0 -51
  108. package/dist/chunk-preference-C144GkCD.cjs +0 -3
  109. package/dist/chunk-types-BE3JCLff.cjs.map +0 -1
  110. package/dist/chunk-types-BNUlgEkq.cjs +0 -3
  111. package/dist/chunk-types-BNUlgEkq.cjs.map +0 -1
  112. package/dist/chunk-types-BudGuDCK.mjs +0 -20
  113. package/dist/chunk-types-BudGuDCK.mjs.map +0 -1
  114. package/dist/chunk-types-C_opkZGr.cjs.map +0 -1
  115. package/dist/chunk-types-DNPBKfmx.mjs.map +0 -1
  116. package/dist/chunk-types-SD4MzUGp.mjs.map +0 -1
@@ -0,0 +1,740 @@
1
+ import { n as et } from "./chunk-useTheme-oHcq3d0o.mjs";
2
+ import { memo as ct, useCallback as K, useEffect as tt, useMemo as Q, useRef as x } from "react";
3
+ import { jsx as N, jsxs as lt } from "react/jsx-runtime";
4
+ var ht = "style-module__waves___oR3u7", dt = "style-module__wavesCanvas___zkhTC", st = {
5
+ waves: ht,
6
+ wavesCanvas: dt
7
+ }, P = class {
8
+ x;
9
+ y;
10
+ z;
11
+ constructor(r, e, s) {
12
+ this.x = r, this.y = e, this.z = s;
13
+ }
14
+ dot2(r, e) {
15
+ return this.x * r + this.y * e;
16
+ }
17
+ }, ft = class {
18
+ grad3;
19
+ p;
20
+ perm;
21
+ gradP;
22
+ constructor(r = 0) {
23
+ this.grad3 = [
24
+ new P(1, 1, 0),
25
+ new P(-1, 1, 0),
26
+ new P(1, -1, 0),
27
+ new P(-1, -1, 0),
28
+ new P(1, 0, 1),
29
+ new P(-1, 0, 1),
30
+ new P(1, 0, -1),
31
+ new P(-1, 0, -1),
32
+ new P(0, 1, 1),
33
+ new P(0, -1, 1),
34
+ new P(0, 1, -1),
35
+ new P(0, -1, -1)
36
+ ], this.p = [
37
+ 151,
38
+ 160,
39
+ 137,
40
+ 91,
41
+ 90,
42
+ 15,
43
+ 131,
44
+ 13,
45
+ 201,
46
+ 95,
47
+ 96,
48
+ 53,
49
+ 194,
50
+ 233,
51
+ 7,
52
+ 225,
53
+ 140,
54
+ 36,
55
+ 103,
56
+ 30,
57
+ 69,
58
+ 142,
59
+ 8,
60
+ 99,
61
+ 37,
62
+ 240,
63
+ 21,
64
+ 10,
65
+ 23,
66
+ 190,
67
+ 6,
68
+ 148,
69
+ 247,
70
+ 120,
71
+ 234,
72
+ 75,
73
+ 0,
74
+ 26,
75
+ 197,
76
+ 62,
77
+ 94,
78
+ 252,
79
+ 219,
80
+ 203,
81
+ 117,
82
+ 35,
83
+ 11,
84
+ 32,
85
+ 57,
86
+ 177,
87
+ 33,
88
+ 88,
89
+ 237,
90
+ 149,
91
+ 56,
92
+ 87,
93
+ 174,
94
+ 20,
95
+ 125,
96
+ 136,
97
+ 171,
98
+ 168,
99
+ 68,
100
+ 175,
101
+ 74,
102
+ 165,
103
+ 71,
104
+ 134,
105
+ 139,
106
+ 48,
107
+ 27,
108
+ 166,
109
+ 77,
110
+ 146,
111
+ 158,
112
+ 231,
113
+ 83,
114
+ 111,
115
+ 229,
116
+ 122,
117
+ 60,
118
+ 211,
119
+ 133,
120
+ 230,
121
+ 220,
122
+ 105,
123
+ 92,
124
+ 41,
125
+ 55,
126
+ 46,
127
+ 245,
128
+ 40,
129
+ 244,
130
+ 102,
131
+ 143,
132
+ 54,
133
+ 65,
134
+ 25,
135
+ 63,
136
+ 161,
137
+ 1,
138
+ 216,
139
+ 80,
140
+ 73,
141
+ 209,
142
+ 76,
143
+ 132,
144
+ 187,
145
+ 208,
146
+ 89,
147
+ 18,
148
+ 169,
149
+ 200,
150
+ 196,
151
+ 135,
152
+ 130,
153
+ 116,
154
+ 188,
155
+ 159,
156
+ 86,
157
+ 164,
158
+ 100,
159
+ 109,
160
+ 198,
161
+ 173,
162
+ 186,
163
+ 3,
164
+ 64,
165
+ 52,
166
+ 217,
167
+ 226,
168
+ 250,
169
+ 124,
170
+ 123,
171
+ 5,
172
+ 202,
173
+ 38,
174
+ 147,
175
+ 118,
176
+ 126,
177
+ 255,
178
+ 82,
179
+ 85,
180
+ 212,
181
+ 207,
182
+ 206,
183
+ 59,
184
+ 227,
185
+ 47,
186
+ 16,
187
+ 58,
188
+ 17,
189
+ 182,
190
+ 189,
191
+ 28,
192
+ 42,
193
+ 223,
194
+ 183,
195
+ 170,
196
+ 213,
197
+ 119,
198
+ 248,
199
+ 152,
200
+ 2,
201
+ 44,
202
+ 154,
203
+ 163,
204
+ 70,
205
+ 221,
206
+ 153,
207
+ 101,
208
+ 155,
209
+ 167,
210
+ 43,
211
+ 172,
212
+ 9,
213
+ 129,
214
+ 22,
215
+ 39,
216
+ 253,
217
+ 19,
218
+ 98,
219
+ 108,
220
+ 110,
221
+ 79,
222
+ 113,
223
+ 224,
224
+ 232,
225
+ 178,
226
+ 185,
227
+ 112,
228
+ 104,
229
+ 218,
230
+ 246,
231
+ 97,
232
+ 228,
233
+ 251,
234
+ 34,
235
+ 242,
236
+ 193,
237
+ 238,
238
+ 210,
239
+ 144,
240
+ 12,
241
+ 191,
242
+ 179,
243
+ 162,
244
+ 241,
245
+ 81,
246
+ 51,
247
+ 145,
248
+ 235,
249
+ 249,
250
+ 14,
251
+ 239,
252
+ 107,
253
+ 49,
254
+ 192,
255
+ 214,
256
+ 31,
257
+ 181,
258
+ 199,
259
+ 106,
260
+ 157,
261
+ 184,
262
+ 84,
263
+ 204,
264
+ 176,
265
+ 115,
266
+ 121,
267
+ 50,
268
+ 45,
269
+ 127,
270
+ 4,
271
+ 150,
272
+ 254,
273
+ 138,
274
+ 236,
275
+ 205,
276
+ 93,
277
+ 222,
278
+ 114,
279
+ 67,
280
+ 29,
281
+ 24,
282
+ 72,
283
+ 243,
284
+ 141,
285
+ 128,
286
+ 195,
287
+ 78,
288
+ 66,
289
+ 215,
290
+ 61,
291
+ 156,
292
+ 180
293
+ ], this.perm = new Array(512), this.gradP = new Array(512), this.seed(r);
294
+ }
295
+ seed(r) {
296
+ r > 0 && r < 1 && (r *= 65536), r = Math.floor(r), r < 256 && (r |= r << 8);
297
+ for (let e = 0; e < 256; e++) {
298
+ let s = e & 1 ? this.p[e] ^ r & 255 : this.p[e] ^ r >> 8 & 255;
299
+ this.perm[e] = this.perm[e + 256] = s, this.gradP[e] = this.gradP[e + 256] = this.grad3[s % 12];
300
+ }
301
+ }
302
+ fade(r) {
303
+ return r * r * r * (r * (r * 6 - 15) + 10);
304
+ }
305
+ lerp(r, e, s) {
306
+ return (1 - s) * r + s * e;
307
+ }
308
+ perlin2(r, e) {
309
+ let s = Math.floor(r), t = Math.floor(e);
310
+ r -= s, e -= t, s &= 255, t &= 255;
311
+ const h = this.gradP[s + this.perm[t]].dot2(r, e), m = this.gradP[s + this.perm[t + 1]].dot2(r, e - 1), v = this.gradP[s + 1 + this.perm[t]].dot2(r - 1, e), b = this.gradP[s + 1 + this.perm[t + 1]].dot2(r - 1, e - 1), g = this.fade(r);
312
+ return this.lerp(this.lerp(h, v, g), this.lerp(m, b, g), this.fade(e));
313
+ }
314
+ }, mt = ({ lineColor: r = "black", backgroundColor: e = "transparent", waveSpeedX: s = 0.0125, waveSpeedY: t = 5e-3, waveAmpX: h = 32, waveAmpY: m = 16, xGap: v = 10, yGap: b = 32, friction: g = 0.925, tension: $ = 5e-3, maxCursorMove: M = 100, style: d = {}, className: _ = "" }) => {
315
+ const u = x(null), R = x(null), T = x(null), W = x({
316
+ width: 0,
317
+ height: 0,
318
+ left: 0,
319
+ top: 0
320
+ }), H = x(new ft(Math.random())), X = x([]), F = x({
321
+ x: -10,
322
+ y: 0,
323
+ lx: 0,
324
+ ly: 0,
325
+ sx: 0,
326
+ sy: 0,
327
+ v: 0,
328
+ vs: 0,
329
+ a: 0,
330
+ set: !1
331
+ }), y = x({
332
+ lineColor: r,
333
+ waveSpeedX: s,
334
+ waveSpeedY: t,
335
+ waveAmpX: h,
336
+ waveAmpY: m,
337
+ friction: g,
338
+ tension: $,
339
+ maxCursorMove: M,
340
+ xGap: v,
341
+ yGap: b
342
+ }), I = x(null);
343
+ return tt(() => {
344
+ y.current = {
345
+ lineColor: r,
346
+ waveSpeedX: s,
347
+ waveSpeedY: t,
348
+ waveAmpX: h,
349
+ waveAmpY: m,
350
+ friction: g,
351
+ tension: $,
352
+ maxCursorMove: M,
353
+ xGap: v,
354
+ yGap: b
355
+ };
356
+ }, [
357
+ r,
358
+ s,
359
+ t,
360
+ h,
361
+ m,
362
+ g,
363
+ $,
364
+ M,
365
+ v,
366
+ b
367
+ ]), tt(() => {
368
+ const E = R.current, C = u.current;
369
+ if (!E || !C) return;
370
+ T.current = E.getContext("2d");
371
+ function A() {
372
+ if (!C || !E) return;
373
+ const i = C.getBoundingClientRect();
374
+ W.current = {
375
+ width: i.width,
376
+ height: i.height,
377
+ left: i.left,
378
+ top: i.top
379
+ }, E.width = i.width, E.height = i.height;
380
+ }
381
+ function V() {
382
+ const { width: i, height: o } = W.current;
383
+ X.current = [];
384
+ const a = i + 200, p = o + 30, { xGap: L, yGap: D } = y.current, J = Math.ceil(a / L), B = Math.ceil(p / D), O = (i - L * J) / 2, Z = (o - D * B) / 2;
385
+ for (let G = 0; G <= J; G++) {
386
+ const S = [];
387
+ for (let f = 0; f <= B; f++) S.push({
388
+ x: O + L * G,
389
+ y: Z + D * f,
390
+ wave: {
391
+ x: 0,
392
+ y: 0
393
+ },
394
+ cursor: {
395
+ x: 0,
396
+ y: 0,
397
+ vx: 0,
398
+ vy: 0
399
+ }
400
+ });
401
+ X.current.push(S);
402
+ }
403
+ }
404
+ function k(i) {
405
+ const o = X.current, a = F.current, p = H.current, { waveSpeedX: L, waveSpeedY: D, waveAmpX: J, waveAmpY: B, friction: O, tension: Z, maxCursorMove: G } = y.current;
406
+ o.forEach((S) => {
407
+ S.forEach((f) => {
408
+ const nt = p.perlin2((f.x + i * L) * 2e-3, (f.y + i * D) * 15e-4) * 12;
409
+ f.wave.x = Math.cos(nt) * J, f.wave.y = Math.sin(nt) * B;
410
+ const at = f.x - a.sx, it = f.y - a.sy, rt = Math.hypot(at, it), q = Math.max(175, a.vs);
411
+ if (rt < q) {
412
+ const ut = 1 - rt / q, ot = Math.cos(rt * 1e-3) * ut;
413
+ f.cursor.vx += Math.cos(a.a) * ot * q * a.vs * 65e-5, f.cursor.vy += Math.sin(a.a) * ot * q * a.vs * 65e-5;
414
+ }
415
+ f.cursor.vx += (0 - f.cursor.x) * Z, f.cursor.vy += (0 - f.cursor.y) * Z, f.cursor.vx *= O, f.cursor.vy *= O, f.cursor.x += f.cursor.vx * 2, f.cursor.y += f.cursor.vy * 2, f.cursor.x = Math.min(G, Math.max(-G, f.cursor.x)), f.cursor.y = Math.min(G, Math.max(-G, f.cursor.y));
416
+ });
417
+ });
418
+ }
419
+ function Y(i, o = !0) {
420
+ const a = i.x + i.wave.x + (o ? i.cursor.x : 0), p = i.y + i.wave.y + (o ? i.cursor.y : 0);
421
+ return {
422
+ x: Math.round(a * 10) / 10,
423
+ y: Math.round(p * 10) / 10
424
+ };
425
+ }
426
+ function U() {
427
+ const { width: i, height: o } = W.current, a = T.current;
428
+ a && (a.clearRect(0, 0, i, o), a.beginPath(), a.strokeStyle = y.current.lineColor, X.current.forEach((p) => {
429
+ let L = Y(p[0], !1);
430
+ a.moveTo(L.x, L.y), p.forEach((D, J) => {
431
+ const B = J === p.length - 1;
432
+ L = Y(D, !B);
433
+ const O = Y(p[J + 1] || p[p.length - 1], !B);
434
+ a.lineTo(L.x, L.y), B && a.moveTo(O.x, O.y);
435
+ });
436
+ }), a.stroke());
437
+ }
438
+ function j(i) {
439
+ if (!C) return;
440
+ const o = F.current;
441
+ o.sx += (o.x - o.sx) * 0.1, o.sy += (o.y - o.sy) * 0.1;
442
+ const a = o.x - o.lx, p = o.y - o.ly, L = Math.hypot(a, p);
443
+ o.v = L, o.vs += (L - o.vs) * 0.1, o.vs = Math.min(100, o.vs), o.lx = o.x, o.ly = o.y, o.a = Math.atan2(p, a), C.style.setProperty("--x", `${o.sx}px`), C.style.setProperty("--y", `${o.sy}px`), k(i), U(), I.current = requestAnimationFrame(j);
444
+ }
445
+ function n() {
446
+ A(), V();
447
+ }
448
+ function l(i) {
449
+ w(i.clientX, i.clientY);
450
+ }
451
+ function c(i) {
452
+ const o = i.touches[0];
453
+ w(o.clientX, o.clientY);
454
+ }
455
+ function w(i, o) {
456
+ const a = F.current, p = W.current;
457
+ a.x = i - p.left, a.y = o - p.top, a.set || (a.sx = a.x, a.sy = a.y, a.lx = a.x, a.ly = a.y, a.set = !0);
458
+ }
459
+ return A(), V(), I.current = requestAnimationFrame(j), window.addEventListener("resize", n), window.addEventListener("mousemove", l), window.addEventListener("touchmove", c, { passive: !1 }), () => {
460
+ window.removeEventListener("resize", n), window.removeEventListener("mousemove", l), window.removeEventListener("touchmove", c), I.current !== null && cancelAnimationFrame(I.current);
461
+ };
462
+ }, []), /* @__PURE__ */ N("div", {
463
+ ref: u,
464
+ className: `${st.waves} ${_}`,
465
+ style: {
466
+ position: "absolute",
467
+ top: 0,
468
+ left: 0,
469
+ margin: 0,
470
+ padding: 0,
471
+ width: "100%",
472
+ height: "100%",
473
+ overflow: "hidden",
474
+ backgroundColor: e,
475
+ ...d
476
+ },
477
+ children: /* @__PURE__ */ N("canvas", {
478
+ ref: R,
479
+ className: st.wavesCanvas
480
+ })
481
+ });
482
+ }, It = (r) => {
483
+ const { currentTheme: e } = et();
484
+ return /* @__PURE__ */ N(mt, {
485
+ lineColor: Q(() => {
486
+ const s = e.colors.variables.primary || "rgb(59, 130, 246)", t = (v, b, g, $ = 0.4) => `rgb(${Math.round(v + (255 - v) * $)}, ${Math.round(b + (255 - b) * $)}, ${Math.round(g + (255 - g) * $)})`;
487
+ if (s.startsWith("#")) {
488
+ const v = s.slice(1);
489
+ return t(parseInt(v.slice(0, 2), 16), parseInt(v.slice(2, 4), 16), parseInt(v.slice(4, 6), 16));
490
+ }
491
+ const h = s.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
492
+ if (h) return t(parseInt(h[1], 10), parseInt(h[2], 10), parseInt(h[3], 10));
493
+ const m = s.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
494
+ return m ? t(parseInt(m[1], 10), parseInt(m[2], 10), parseInt(m[3], 10)) : s;
495
+ }, [e]),
496
+ backgroundColor: "transparent",
497
+ waveSpeedX: 0.05,
498
+ waveSpeedY: 0.01,
499
+ waveAmpX: 40,
500
+ waveAmpY: 20,
501
+ ...r
502
+ });
503
+ }, vt = "style-module__squaresCanvas___22kMc", gt = { squaresCanvas: vt }, yt = ({ direction: r = "right", speed: e = 1, borderColor: s = "#999", squareSize: t = 40, hoverFillColor: h = "#222", className: m = "", style: v = {} }) => {
504
+ const b = x(null), g = x(null), $ = x(0), M = x(0), d = x({
505
+ x: 0,
506
+ y: 0
507
+ }), _ = x(null);
508
+ return tt(() => {
509
+ const u = b.current;
510
+ if (!u) return;
511
+ const R = u.getContext("2d"), T = () => {
512
+ u.width = u.offsetWidth, u.height = u.offsetHeight, $.current = Math.ceil(u.width / t) + 1, M.current = Math.ceil(u.height / t) + 1;
513
+ };
514
+ window.addEventListener("resize", T), T();
515
+ const W = () => {
516
+ if (!R) return;
517
+ R.clearRect(0, 0, u.width, u.height);
518
+ const y = Math.floor(d.current.x / t) * t, I = Math.floor(d.current.y / t) * t;
519
+ for (let C = y; C < u.width + t; C += t) for (let A = I; A < u.height + t; A += t) {
520
+ const V = C - d.current.x % t, k = A - d.current.y % t;
521
+ _.current && Math.floor((C - y) / t) === _.current.x && Math.floor((A - I) / t) === _.current.y && (R.fillStyle = h, R.fillRect(V, k, t, t)), R.strokeStyle = s, R.strokeRect(V, k, t, t);
522
+ }
523
+ const E = R.createRadialGradient(u.width / 2, u.height / 2, 0, u.width / 2, u.height / 2, Math.sqrt(u.width ** 2 + u.height ** 2) / 2);
524
+ E.addColorStop(0, "rgba(0, 0, 0, 0)"), E.addColorStop(1, "#060010"), R.fillStyle = E, R.fillRect(0, 0, u.width, u.height);
525
+ }, H = () => {
526
+ const y = Math.max(e, 0.1);
527
+ switch (r) {
528
+ case "right":
529
+ d.current.x = (d.current.x - y + t) % t;
530
+ break;
531
+ case "left":
532
+ d.current.x = (d.current.x + y + t) % t;
533
+ break;
534
+ case "up":
535
+ d.current.y = (d.current.y + y + t) % t;
536
+ break;
537
+ case "down":
538
+ d.current.y = (d.current.y - y + t) % t;
539
+ break;
540
+ case "diagonal":
541
+ d.current.x = (d.current.x - y + t) % t, d.current.y = (d.current.y - y + t) % t;
542
+ break;
543
+ default:
544
+ break;
545
+ }
546
+ W(), g.current = requestAnimationFrame(H);
547
+ }, X = (y) => {
548
+ const I = u.getBoundingClientRect(), E = y.clientX - I.left, C = y.clientY - I.top, A = Math.floor(d.current.x / t) * t, V = Math.floor(d.current.y / t) * t, k = Math.floor((E + d.current.x - A) / t), Y = Math.floor((C + d.current.y - V) / t);
549
+ (!_.current || _.current.x !== k || _.current.y !== Y) && (_.current = {
550
+ x: k,
551
+ y: Y
552
+ });
553
+ }, F = () => {
554
+ _.current = null;
555
+ };
556
+ return u.addEventListener("mousemove", X), u.addEventListener("mouseleave", F), g.current = requestAnimationFrame(H), () => {
557
+ window.removeEventListener("resize", T), g.current && cancelAnimationFrame(g.current), u.removeEventListener("mousemove", X), u.removeEventListener("mouseleave", F);
558
+ };
559
+ }, [
560
+ r,
561
+ e,
562
+ s,
563
+ h,
564
+ t
565
+ ]), /* @__PURE__ */ N("canvas", {
566
+ ref: b,
567
+ className: `${gt.squaresCanvas} ${m}`,
568
+ style: v
569
+ });
570
+ }, Lt = (r) => {
571
+ const { currentTheme: e } = et();
572
+ return /* @__PURE__ */ N(yt, {
573
+ borderColor: Q(() => {
574
+ const s = e.colors.variables.border5 || e.colors.variables.fg || "#271E37";
575
+ if (s.startsWith("#")) return s;
576
+ const t = s.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
577
+ return t ? `#${parseInt(t[1], 10).toString(16).padStart(2, "0")}${parseInt(t[2], 10).toString(16).padStart(2, "0")}${parseInt(t[3], 10).toString(16).padStart(2, "0")}` : s;
578
+ }, [e]),
579
+ hoverFillColor: Q(() => {
580
+ const s = e.colors.variables.bg3 || e.colors.variables.border3 || "#222222", t = (m, v, b, g = 0.3) => `rgb(${Math.round(m * (1 - g))}, ${Math.round(v * (1 - g))}, ${Math.round(b * (1 - g))})`;
581
+ if (s.startsWith("#")) {
582
+ const m = s.slice(1);
583
+ return t(parseInt(m.slice(0, 2), 16), parseInt(m.slice(2, 4), 16), parseInt(m.slice(4, 6), 16));
584
+ }
585
+ const h = s.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
586
+ return h ? t(parseInt(h[1], 10), parseInt(h[2], 10), parseInt(h[3], 10)) : s;
587
+ }, [e]),
588
+ speed: 0.5,
589
+ squareSize: 40,
590
+ direction: "diagonal",
591
+ ...r
592
+ });
593
+ }, wt = "style-module__container___HkxIe", xt = "style-module__canvas___MR9JX", Mt = "style-module__outerVignette___i75nw", pt = "style-module__centerVignette___n9uVG", z = {
594
+ container: wt,
595
+ canvas: xt,
596
+ outerVignette: Mt,
597
+ centerVignette: pt
598
+ }, bt = ct(({ glitchColors: r = [
599
+ "#2b4539",
600
+ "#61dca3",
601
+ "#61b3dc"
602
+ ], glitchSpeed: e = 500, centerVignette: s = !1, outerVignette: t = !0, smooth: h = !0, characters: m = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$&*()-_+=/[]{};:<>.,0123456789", className: v = "", style: b = {} }) => {
603
+ const g = x(null), $ = x(null), M = x([]), d = x({
604
+ columns: 0,
605
+ rows: 0
606
+ }), _ = x(null), u = x(Date.now()), R = Q(() => Array.from(m), [m]), T = x(/* @__PURE__ */ new Map()), W = 16, H = 10, X = 20, F = K(() => R[Math.floor(Math.random() * R.length)], [R]), y = K(() => r[Math.floor(Math.random() * r.length)], [r]), I = K((n) => {
607
+ if (T.current.has(n)) return T.current.get(n);
608
+ const l = n.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (i, o, a, p) => o + o + a + a + p + p), c = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(l), w = c ? {
609
+ r: parseInt(c[1], 16),
610
+ g: parseInt(c[2], 16),
611
+ b: parseInt(c[3], 16)
612
+ } : null;
613
+ return T.current.set(n, w), w;
614
+ }, []), E = (n, l, c) => {
615
+ const w = {
616
+ r: Math.round(n.r + (l.r - n.r) * c),
617
+ g: Math.round(n.g + (l.g - n.g) * c),
618
+ b: Math.round(n.b + (l.b - n.b) * c)
619
+ };
620
+ return `rgb(${w.r}, ${w.g}, ${w.b})`;
621
+ }, C = (n, l) => ({
622
+ columns: Math.ceil(n / H),
623
+ rows: Math.ceil(l / X)
624
+ }), A = (n, l) => {
625
+ d.current = {
626
+ columns: n,
627
+ rows: l
628
+ };
629
+ const c = n * l;
630
+ M.current = Array.from({ length: c }, () => ({
631
+ char: F(),
632
+ color: y(),
633
+ targetColor: y(),
634
+ colorProgress: 1
635
+ }));
636
+ }, V = () => {
637
+ const n = g.current;
638
+ if (!n) return;
639
+ const l = n.parentElement;
640
+ if (!l) return;
641
+ const c = window.devicePixelRatio || 1, w = l.getBoundingClientRect();
642
+ n.width = w.width * c, n.height = w.height * c, n.style.width = `${w.width}px`, n.style.height = `${w.height}px`, _.current && _.current.setTransform(c, 0, 0, c, 0, 0);
643
+ const { columns: i, rows: o } = C(w.width, w.height);
644
+ A(i, o), k();
645
+ }, k = K(() => {
646
+ if (!_.current || M.current.length === 0) return;
647
+ const n = _.current, l = g.current;
648
+ l && (n.clearRect(0, 0, l.width, l.height), n.font = `${W}px monospace`, n.textBaseline = "top", n.textAlign = "left", M.current.forEach((c, w) => {
649
+ const i = w % d.current.columns * H, o = Math.floor(w / d.current.columns) * X;
650
+ n.fillStyle = c.color, n.fillText(c.char, i, o);
651
+ }));
652
+ }, []), Y = K(() => {
653
+ if (!M.current || M.current.length === 0) return;
654
+ const n = Math.max(1, Math.floor(M.current.length * 0.02));
655
+ for (let l = 0; l < n; l++) {
656
+ const c = Math.floor(Math.random() * M.current.length);
657
+ M.current[c] && (M.current[c].char = F(), M.current[c].targetColor = y(), h ? M.current[c].colorProgress = 0 : (M.current[c].color = M.current[c].targetColor, M.current[c].colorProgress = 1));
658
+ }
659
+ }, [
660
+ F,
661
+ y,
662
+ h
663
+ ]), U = K(() => {
664
+ let n = !1, l = 0;
665
+ M.current.forEach((c) => {
666
+ if (c.colorProgress < 1) {
667
+ l++, c.colorProgress += 0.03, c.colorProgress > 1 && (c.colorProgress = 1);
668
+ const w = I(c.color), i = I(c.targetColor);
669
+ w && i && (c.color = E(w, i, c.colorProgress), n = !0);
670
+ }
671
+ }), n && l > 0 && k();
672
+ }, [I, k]), j = K(() => {
673
+ const n = Date.now();
674
+ n - u.current >= e ? (Y(), k(), u.current = n) : h && U(), $.current = requestAnimationFrame(j);
675
+ }, [
676
+ e,
677
+ h,
678
+ Y,
679
+ U
680
+ ]);
681
+ return tt(() => {
682
+ const n = g.current;
683
+ if (!n) return;
684
+ _.current = n.getContext("2d"), V(), j();
685
+ let l;
686
+ const c = () => {
687
+ clearTimeout(l), l = setTimeout(() => {
688
+ $.current && cancelAnimationFrame($.current), V(), j();
689
+ }, 100);
690
+ };
691
+ return window.addEventListener("resize", c), () => {
692
+ $.current && cancelAnimationFrame($.current), window.removeEventListener("resize", c), clearTimeout(l), T.current.clear();
693
+ };
694
+ }, [
695
+ e,
696
+ h,
697
+ r,
698
+ j
699
+ ]), /* @__PURE__ */ lt("div", {
700
+ className: `${z.container} ${v}`,
701
+ style: b,
702
+ children: [
703
+ /* @__PURE__ */ N("canvas", {
704
+ ref: g,
705
+ className: z.canvas
706
+ }),
707
+ t && /* @__PURE__ */ N("div", { className: z.outerVignette }),
708
+ s && /* @__PURE__ */ N("div", { className: z.centerVignette })
709
+ ]
710
+ });
711
+ }), _t = ct((r) => {
712
+ const { currentTheme: e } = et();
713
+ return /* @__PURE__ */ N(bt, {
714
+ glitchColors: Q(() => {
715
+ const s = e.colors.variables.primary || "#FA1E16", t = e.colors.variables.info || "#0095ff", h = e.colors.variables.success || "#00d68f", m = (v) => {
716
+ if (v.startsWith("#")) return v;
717
+ const b = v.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
718
+ return b ? `#${parseInt(b[1], 10).toString(16).padStart(2, "0")}${parseInt(b[2], 10).toString(16).padStart(2, "0")}${parseInt(b[3], 10).toString(16).padStart(2, "0")}` : v;
719
+ };
720
+ return [
721
+ m(s),
722
+ m(t),
723
+ m(h)
724
+ ];
725
+ }, [e]),
726
+ glitchSpeed: 300,
727
+ centerVignette: !0,
728
+ outerVignette: !1,
729
+ smooth: !0,
730
+ ...r
731
+ });
732
+ });
733
+ _t.displayName = "LetterGlitchBackground";
734
+ export {
735
+ Lt as n,
736
+ It as r,
737
+ _t as t
738
+ };
739
+
740
+ //# sourceMappingURL=chunk-animations-CEZ01ALd.mjs.map