voice-ring 0.1.0 → 0.1.2

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,25 +1,25 @@
1
- import { jsx as In } from "react/jsx-runtime";
2
- import { useState as _t, useEffect as kt, useRef as Rt, useCallback as En } from "react";
3
- let qt = null;
4
- function Nn() {
1
+ import { jsx as Xn } from "react/jsx-runtime";
2
+ import { useState as Bt, useEffect as It, useRef as St, useCallback as Gn } from "react";
3
+ let Ut = null;
4
+ function Vn() {
5
5
  if (typeof window > "u") return null;
6
6
  const t = window;
7
7
  return t.AudioContext ?? t.webkitAudioContext ?? null;
8
8
  }
9
- function ce() {
10
- return Nn() != null;
9
+ function Re() {
10
+ return Vn() != null;
11
11
  }
12
- function Bn() {
13
- const t = Nn();
14
- return t ? (qt || (qt = new t()), qt.state === "suspended" && qt.resume().catch(() => {
15
- }), qt) : null;
12
+ function Hn() {
13
+ const t = Vn();
14
+ return t ? (Ut || (Ut = new t()), Ut.state === "suspended" && Ut.resume().catch(() => {
15
+ }), Ut) : null;
16
16
  }
17
- const en = /* @__PURE__ */ new WeakMap();
18
- function ts(t) {
19
- const n = Bn();
17
+ const fn = /* @__PURE__ */ new WeakMap();
18
+ function ps(t) {
19
+ const n = Hn();
20
20
  if (!n || t.getAudioTracks().length === 0) return null;
21
- let e = en.get(t);
22
- e || (e = { node: n.createMediaStreamSource(t), refs: 0 }, en.set(t, e)), e.refs += 1;
21
+ let e = fn.get(t);
22
+ e || (e = { node: n.createMediaStreamSource(t), refs: 0 }, fn.set(t, e)), e.refs += 1;
23
23
  const s = n.createAnalyser();
24
24
  s.fftSize = 1024, s.smoothingTimeConstant = 0.5, e.node.connect(s);
25
25
  let o = !1;
@@ -37,36 +37,58 @@ function ts(t) {
37
37
  e.node.disconnect();
38
38
  } catch {
39
39
  }
40
- en.delete(t);
40
+ fn.delete(t);
41
41
  }
42
42
  }
43
43
  }
44
44
  };
45
45
  }
46
- const Ht = {
46
+ const tn = {
47
47
  positive: { r: 92, g: 224, b: 150 },
48
48
  negative: { r: 255, g: 104, b: 104 },
49
49
  calm: { r: 104, g: 162, b: 255 }
50
- }, ns = {
51
- green: Ht.positive,
52
- red: Ht.negative,
53
- blue: Ht.calm
54
- }, ss = 0.7, es = 1.1, os = 0.6;
55
- class as {
50
+ }, ms = {
51
+ green: tn.positive,
52
+ red: tn.negative,
53
+ blue: tn.calm
54
+ }, Ms = 0.7, gs = 1.1, bs = 0.6;
55
+ class vs {
56
56
  constructor() {
57
57
  this.glow = { r: 0, g: 0, b: 0, amount: 0, t: 0, size: 0 };
58
58
  }
59
59
  /** Advance toward `target` (null: fade out). `still` jumps straight there. */
60
- step(n, e, s, o, r) {
61
- const c = this.glow, l = (a) => r ? 1 : 1 - Math.exp(-n / a), i = e ? 1 : 0;
62
- if (c.amount += (i - c.amount) * l(i > c.amount ? ss : es), e) {
63
- const a = c.amount < 0.03 ? 1 : l(os);
64
- c.r += (e.r - c.r) * a, c.g += (e.g - c.g) * a, c.b += (e.b - c.b) * a;
60
+ step(n, e, s, o, c) {
61
+ const r = this.glow, l = (a) => c ? 1 : 1 - Math.exp(-n / a), i = e ? 1 : 0;
62
+ if (r.amount += (i - r.amount) * l(i > r.amount ? Ms : gs), e) {
63
+ const a = r.amount < 0.03 ? 1 : l(bs);
64
+ r.r += (e.r - r.r) * a, r.g += (e.g - r.g) * a, r.b += (e.b - r.b) * a;
65
65
  }
66
- return c.t = s, c.size = o, c;
66
+ return r.t = s, r.size = o, r;
67
67
  }
68
68
  }
69
- const dt = {
69
+ const Kn = (t, n) => {
70
+ var e;
71
+ return ((e = t.light) == null ? void 0 : e.r) ?? n * 0.28;
72
+ };
73
+ function xs(t, n, e) {
74
+ const o = (Kn(t, n) * 0.7) ** 2, c = 0.9 * Math.min(1, Math.max(0, e.amount)), r = (l, i) => {
75
+ const a = e.x - l, d = e.y - i, h = c * Math.exp(-(a * a + d * d) / o);
76
+ return [l + a * h, i + d * h];
77
+ };
78
+ return {
79
+ ...t,
80
+ strokes: t.strokes.map((l) => {
81
+ const i = l.pts.slice();
82
+ for (let a = 0; a < i.length; a += 2) [i[a], i[a + 1]] = r(i[a], i[a + 1]);
83
+ return { ...l, pts: i };
84
+ }),
85
+ dots: t.dots.map((l) => {
86
+ const [i, a] = r(l.x, l.y);
87
+ return { ...l, x: i, y: a };
88
+ })
89
+ };
90
+ }
91
+ const ys = (t, n) => Math.min(1, Math.max(0, (0.8 * n - t) / (0.6 * n))), bt = {
70
92
  move: 2,
71
93
  pull: 0.7,
72
94
  deform: 0.1,
@@ -77,11 +99,11 @@ const dt = {
77
99
  blur: 1,
78
100
  bounce: 1
79
101
  };
80
- function cs(t, n) {
102
+ function ws(t, n) {
81
103
  const e = Math.abs(t.move) + Math.abs(t.pull) + 2 * Math.abs(t.deform);
82
104
  return e === 0 ? 0 : Math.ceil(n * 0.36 * e) + 2;
83
105
  }
84
- class rs {
106
+ class Es {
85
107
  constructor() {
86
108
  this.x = 0, this.v = 0, this.landed = !1;
87
109
  }
@@ -91,253 +113,258 @@ class rs {
91
113
  * never backs off the edge before it has pressed into it.
92
114
  */
93
115
  step(n, e) {
94
- const r = Math.max(1, Math.ceil(e * 240)), c = e / r;
95
- for (let i = 0; i < r; i++)
96
- this.v += (15 * 15 * (n - this.x) - 2 * 0.3 * 15 * this.v) * c, this.x += this.v * c;
116
+ const c = Math.max(1, Math.ceil(e * 240)), r = e / c;
117
+ for (let i = 0; i < c; i++)
118
+ this.v += (15 * 15 * (n - this.x) - 2 * 0.3 * 15 * this.v) * r, this.x += this.v * r;
97
119
  const l = this.x - n;
98
120
  return n <= 0 ? this.landed = !1 : l >= 0 && (this.landed = !0), l < 0 && !this.landed ? 0 : l;
99
121
  }
100
122
  }
101
- function is(t, n, e, s, o = [1 / 0, 1 / 0], r = 0) {
123
+ function Ss(t, n, e, s, o = [1 / 0, 1 / 0], c = 0) {
102
124
  if (Math.abs(n) < 2e-3 || s.move === 0 && s.pull === 0 && s.deform === 0) return t;
103
- const c = e / 2, l = e * 0.36, i = n < 0 ? -1 : 1, a = Math.abs(n), M = (b, S) => {
104
- const x = (b - c) / l, F = (S - c) / l, A = Math.max(0, Math.min(1, (x * i + 1) / 2)), B = Math.max(0, x * i);
105
- return n * l * (s.move + s.pull * A * A + s.deform * B * B * Math.exp(-F * F * 1.5));
106
- }, h = Math.max(0, Math.min(2, s.lens ?? 1)), f = l * 0.9, p = i > 0 ? o[1] : o[0], d = Number.isFinite(p) ? Math.min(f * 0.45, l * 0.3 * h * Math.max(0, s.stretch ?? 1)) : 0;
107
- let m = 1, v = 1 / 0, _ = 1;
108
- if (Number.isFinite(p)) {
109
- v = i > 0 ? e + p : -p;
110
- const b = (S, x, F) => {
111
- _ = Math.max(_, F);
112
- const A = M(S, x) * i;
113
- A > 1e-9 && (m = Math.min(m, Math.max(0, ((v - S) * i - F - d) / A)));
125
+ const r = e / 2, l = e * 0.36, i = n < 0 ? -1 : 1, a = Math.abs(n), d = (b, E) => {
126
+ const y = (b - r) / l, I = (E - r) / l, R = Math.max(0, Math.min(1, (y * i + 1) / 2)), G = Math.max(0, y * i);
127
+ return n * l * (s.move + s.pull * R * R + s.deform * G * G * Math.exp(-I * I * 1.5));
128
+ }, h = Math.max(0, Math.min(2, s.lens ?? 1)), f = l * 0.9, m = i > 0 ? o[1] : o[0], p = Number.isFinite(m) ? Math.min(f * 0.45, l * 0.3 * h * Math.max(0, s.stretch ?? 1)) : 0;
129
+ let M = 1, v = 1 / 0, A = 1;
130
+ if (Number.isFinite(m)) {
131
+ v = i > 0 ? e + m : -m;
132
+ const b = (E, y, I) => {
133
+ A = Math.max(A, I);
134
+ const R = d(E, y) * i;
135
+ R > 1e-9 && (M = Math.min(M, Math.max(0, ((v - E) * i - I - p) / R)));
114
136
  };
115
- for (const S of t.dots) b(S.x, S.y, S.r);
116
- for (const S of t.strokes) for (let x = 0; x < S.pts.length; x += 2) b(S.pts[x], S.pts[x + 1], 1);
137
+ for (const E of t.dots) b(E.x, E.y, E.r);
138
+ for (const E of t.strokes) for (let y = 0; y < E.pts.length; y += 2) b(E.pts[y], E.pts[y + 1], 1);
117
139
  }
118
- const u = m < 1 ? Math.min(1, (1 - m) / 0.35) : 0, g = u > 0 ? r * (s.bounce ?? 1) : 0, y = Math.min(1.4, u + Math.max(0, g)), N = l * 0.12 * Math.max(0, -g), T = v - i * _, z = T - i * d, w = l * 0.55 * y * (s.squash ?? 0);
119
- let k = 1 / 0, P = -1 / 0, D = !0;
120
- const O = (b, S) => {
121
- const x = Math.max(0, Math.min(1, ((b - c) / l * i + 1) / 2)), F = 1 - 0.15 * s.deform * a * m * x;
122
- let A = b + M(b, S) * m + i * (w * 0.5 - N), B = c + (S - c) * F;
140
+ const u = M < 1 ? Math.min(1, (1 - M) / 0.35) : 0, g = u > 0 ? c * (s.bounce ?? 1) : 0, x = Math.min(1.4, u + Math.max(0, g)), B = l * 0.12 * Math.max(0, -g), S = v - i * A, L = S - i * p, w = l * 0.55 * x * (s.squash ?? 0);
141
+ let k = 1 / 0, _ = -1 / 0, q = !0;
142
+ const U = (b, E) => {
143
+ const y = Math.max(0, Math.min(1, ((b - r) / l * i + 1) / 2)), I = 1 - 0.15 * s.deform * a * M * y;
144
+ let R = b + d(b, E) * M + i * (w * 0.5 - B), G = r + (E - r) * I;
123
145
  if (w > 0) {
124
- const C = (A - (z - i * w)) * i;
146
+ const C = (R - (L - i * w)) * i;
125
147
  if (C > 0) {
126
- const I = C / w, E = w * (I / Math.sqrt(1 + I * I));
127
- A = z - i * w + i * E, B = c + (B - c) * (1 + 0.18 * y * (s.squash ?? 0) * (E / w));
148
+ const F = C / w, T = w * (F / Math.sqrt(1 + F * F));
149
+ R = L - i * w + i * T, G = r + (G - r) * (1 + 0.18 * x * (s.squash ?? 0) * (T / w));
128
150
  }
129
151
  }
130
- return D && (z - A) * i < Math.max(w, f * 0.3) && (k = Math.min(k, B), P = Math.max(P, B)), [A, B];
152
+ return q && (L - R) * i < Math.max(w, f * 0.3) && (k = Math.min(k, G), _ = Math.max(_, G)), [R, G];
131
153
  };
132
154
  for (const b of t.dots)
133
- [b.x, b.y] = O(b.x, b.y);
155
+ [b.x, b.y] = U(b.x, b.y);
134
156
  for (const b of t.strokes)
135
- for (let S = 0; S < b.pts.length; S += 2) {
136
- const [x, F] = O(b.pts[S], b.pts[S + 1]);
137
- b.pts[S] = x, b.pts[S + 1] = F;
157
+ for (let E = 0; E < b.pts.length; E += 2) {
158
+ const [y, I] = U(b.pts[E], b.pts[E + 1]);
159
+ b.pts[E] = y, b.pts[E + 1] = I;
138
160
  }
139
- if (u > 0 && P > k) {
140
- const b = h * y;
161
+ if (u > 0 && _ > k) {
162
+ const b = h * x;
141
163
  t.contact = {
142
164
  side: i,
143
- x: T,
165
+ x: S,
144
166
  y0: k,
145
- y1: P,
167
+ y1: _,
146
168
  depth: w,
147
169
  press: u,
148
170
  lens: b > 0.02 ? {
149
171
  zone: f,
150
172
  // drawn across the gap as it presses, all the way at full press
151
- gap: d * Math.min(1, y),
173
+ gap: p * Math.min(1, x),
152
174
  flare: 0.22 * b * Math.max(0, s.stretch ?? 1),
153
175
  split: f * 0.1 * b * Math.max(0, s.split ?? 1),
154
176
  blur: f * 0.075 * b * Math.max(0, s.blur ?? 1),
155
- cy: c
177
+ cy: r
156
178
  } : void 0
157
179
  };
158
180
  }
159
- if (D = !1, t.light) {
181
+ if (q = !1, t.light) {
160
182
  const b = t.light;
161
- [b.cx, b.cy] = O(b.cx, b.cy);
162
- for (const S of b.spec) [S.x, S.y] = O(S.x, S.y);
183
+ [b.cx, b.cy] = U(b.cx, b.cy);
184
+ for (const E of b.spec) [E.x, E.y] = U(E.x, E.y);
163
185
  }
164
186
  return t;
165
187
  }
166
- const ht = Math.PI * 2;
167
- function Et(t, n, e) {
188
+ const Mt = Math.PI * 2;
189
+ function Ct(t, n, e) {
168
190
  return t + (n - t) * e;
169
191
  }
170
- function K(t) {
192
+ function j(t) {
171
193
  return t < 0 ? 0 : t > 1 ? 1 : t;
172
194
  }
173
- function pn(t, n, e) {
174
- const s = K((e - t) / (n - t));
195
+ function wn(t, n, e) {
196
+ const s = j((e - t) / (n - t));
175
197
  return s * s * (3 - 2 * s);
176
198
  }
177
- const Wt = (t) => t < 1e-6 ? 1 : Math.sin(t) / t, ls = Math.hypot(2.1, 1.3), hs = Math.hypot(1.9, 1.7), us = Math.hypot(4.3 - 2.9, -3.7, -3.1), fs = Math.hypot(4.3 + 2.9, 3.7, -3.1);
178
- function Mn(t, n, e, s = 1) {
179
- const o = 1 / Math.max(0.05, s), r = 0.9 * e, c = -0.7 * e + 1.3, l = 2.1 * e, i = -1.6 * e, a = t * (0.55 * Math.sin(r) * Wt(ls * o) + 0.45 * Math.sin(c) * Wt(hs * o)) + n * 0.5 * (Math.cos(l - i) * Wt(us * o) - Math.cos(l + i) * Wt(fs * o));
180
- return (M, h, f) => (M *= o, h *= o, f *= o, t * (0.55 * Math.sin(2.1 * M + 1.3 * h + r) + 0.45 * Math.sin(1.7 * f - 1.9 * h + c)) + n * Math.sin(4.3 * M - 3.1 * f + l) * Math.sin(3.7 * h + 2.9 * M + i) - a);
199
+ const jt = (t) => t < 1e-6 ? 1 : Math.sin(t) / t, Ts = Math.hypot(2.1, 1.3), Rs = Math.hypot(1.9, 1.7), As = Math.hypot(4.3 - 2.9, -3.7, -3.1), _s = Math.hypot(4.3 + 2.9, 3.7, -3.1);
200
+ function En(t, n, e, s = 1) {
201
+ const o = 1 / Math.max(0.05, s), c = 0.9 * e, r = -0.7 * e + 1.3, l = 2.1 * e, i = -1.6 * e, a = t * (0.55 * Math.sin(c) * jt(Ts * o) + 0.45 * Math.sin(r) * jt(Rs * o)) + n * 0.5 * (Math.cos(l - i) * jt(As * o) - Math.cos(l + i) * jt(_s * o));
202
+ return (d, h, f) => (d *= o, h *= o, f *= o, t * (0.55 * Math.sin(2.1 * d + 1.3 * h + c) + 0.45 * Math.sin(1.7 * f - 1.9 * h + r)) + n * Math.sin(4.3 * d - 3.1 * f + l) * Math.sin(3.7 * h + 2.9 * d + i) - a);
181
203
  }
182
- function xt(t, n) {
204
+ function Tt(t, n) {
183
205
  const e = Math.sin(t * 12.9898 + n * 78.233) * 43758.5453;
184
206
  return e - Math.floor(e);
185
207
  }
186
- function yt(t, n, e) {
208
+ function Et(t, n, e) {
187
209
  const s = Math.sin(t * 127.1 + n * 311.7 + e * 74.7) * 43758.5453;
188
210
  return s - Math.floor(s);
189
211
  }
190
- function Gt(t, n, e) {
191
- const s = Math.floor(t), o = Math.floor(n), r = Math.floor(e);
192
- let c = t - s, l = n - o, i = e - r;
193
- c = c * c * (3 - 2 * c), l = l * l * (3 - 2 * l), i = i * i * (3 - 2 * i);
194
- const a = Et(yt(s, o, r), yt(s + 1, o, r), c), M = Et(yt(s, o + 1, r), yt(s + 1, o + 1, r), c), h = Et(yt(s, o, r + 1), yt(s + 1, o, r + 1), c), f = Et(yt(s, o + 1, r + 1), yt(s + 1, o + 1, r + 1), c);
195
- return Et(Et(a, M, l), Et(h, f, l), i);
212
+ function zt(t, n, e) {
213
+ const s = Math.floor(t), o = Math.floor(n), c = Math.floor(e);
214
+ let r = t - s, l = n - o, i = e - c;
215
+ r = r * r * (3 - 2 * r), l = l * l * (3 - 2 * l), i = i * i * (3 - 2 * i);
216
+ const a = Ct(Et(s, o, c), Et(s + 1, o, c), r), d = Ct(Et(s, o + 1, c), Et(s + 1, o + 1, c), r), h = Ct(Et(s, o, c + 1), Et(s + 1, o, c + 1), r), f = Ct(Et(s, o + 1, c + 1), Et(s + 1, o + 1, c + 1), r);
217
+ return Ct(Ct(a, d, l), Ct(h, f, l), i);
196
218
  }
197
- function mn(t, n) {
198
- const e = Math.PI * (3 - Math.sqrt(5)), s = 1 - 2 * (t + 0.5) / n, o = Math.sqrt(1 - s * s), r = t * e;
199
- return [o * Math.cos(r), s, o * Math.sin(r)];
219
+ function Sn(t, n) {
220
+ const e = Math.PI * (3 - Math.sqrt(5)), s = 1 - 2 * (t + 0.5) / n, o = Math.sqrt(1 - s * s), c = t * e;
221
+ return [o * Math.cos(c), s, o * Math.sin(c)];
200
222
  }
201
- function Yt(t, n, e, s, o) {
202
- const r = Math.sin(n), c = Math.cos(n), l = Math.sin(t), i = Math.cos(t);
203
- return (a, M, h) => {
204
- const f = a * i + h * l, p = -a * l + h * i, d = M * c - p * r, m = M * r + p * c;
205
- return [e + f * o, s - d * o, m];
223
+ function nn(t, n, e, s, o) {
224
+ const c = Math.sin(n), r = Math.cos(n), l = Math.sin(t), i = Math.cos(t);
225
+ return (a, d, h) => {
226
+ const f = a * i + h * l, m = -a * l + h * i, p = d * r - m * c, M = d * c + m * r;
227
+ return [e + f * o, s - p * o, M];
206
228
  };
207
229
  }
208
- function Lt(t, n = 0.6) {
230
+ function $t(t, n = 0.6) {
209
231
  return (t / 200) ** n;
210
232
  }
211
- function Ct(t, n, e = 0.3) {
233
+ function Gt(t, n, e = 0.3) {
212
234
  const s = [];
213
235
  for (const o of t)
214
236
  (o.a ?? 1) < 0.02 || (o.r = Math.max(e, o.r), s.push(o));
215
- return s.sort((o, r) => o.z - r.z), { dots: s, strokes: n };
237
+ return s.sort((o, c) => o.z - c.z), { dots: s, strokes: n };
216
238
  }
217
- const Xt = 32;
218
- function ds(t, n = 0, e = 0, s = 1) {
219
- const o = t.r / 255, r = t.g / 255, c = t.b / 255, l = Math.max(o, r, c), i = Math.min(o, r, c);
220
- let a = (l + i) / 2, M = l === i ? 0 : (l - i) / (1 - Math.abs(2 * a - 1)), h = 0;
239
+ const Zt = 32;
240
+ function Ps(t, n = 0, e = 0, s = 1) {
241
+ const o = t.r / 255, c = t.g / 255, r = t.b / 255, l = Math.max(o, c, r), i = Math.min(o, c, r);
242
+ let a = (l + i) / 2, d = l === i ? 0 : (l - i) / (1 - Math.abs(2 * a - 1)), h = 0;
221
243
  if (l !== i) {
222
- const m = l - i;
223
- h = l === o ? (r - c) / m % 6 : l === r ? (c - o) / m + 2 : (o - r) / m + 4, h *= 60;
244
+ const M = l - i;
245
+ h = l === o ? (c - r) / M % 6 : l === c ? (r - o) / M + 2 : (o - c) / M + 4, h *= 60;
224
246
  }
225
- h = ((h + n) % 360 + 360) % 360, M = Math.min(1, M * (1 + e)), a = 0.5 + (a - 0.5) * (1 - 0.6 * e), a = Math.max(0, Math.min(1, a * s));
226
- const f = (m) => (m + h / 30) % 12, p = M * Math.min(a, 1 - a), d = (m) => a - p * Math.max(-1, Math.min(f(m) - 3, 9 - f(m), 1));
227
- return [Math.round(d(0) * 255), Math.round(d(8) * 255), Math.round(d(4) * 255)];
247
+ h = ((h + n) % 360 + 360) % 360, d = Math.min(1, d * (1 + e)), a = 0.5 + (a - 0.5) * (1 - 0.6 * e), a = Math.max(0, Math.min(1, a * s));
248
+ const f = (M) => (M + h / 30) % 12, m = d * Math.min(a, 1 - a), p = (M) => a - m * Math.max(-1, Math.min(f(M) - 3, 9 - f(M), 1));
249
+ return [Math.round(p(0) * 255), Math.round(p(8) * 255), Math.round(p(4) * 255)];
228
250
  }
229
- function ps(t) {
230
- const n = Math.max(0, Math.min(1, t.saturation)), e = Math.max(0, Math.min(1, t.neutral)), s = t.start ?? 0.1, o = Math.max(0.05, t.width ?? 0.6), r = [];
231
- for (let h = 0; h < Xt; h++) {
232
- const f = h / (Xt - 1), p = Math.max(0, Math.min(1, (f - s) / o)), d = p * p * (3 - 2 * p);
233
- r.push(n * (1 - e * (1 - d)));
251
+ function ks(t) {
252
+ const n = Math.max(0, Math.min(1, t.saturation)), e = Math.max(0, Math.min(1, t.neutral)), s = t.start ?? 0.1, o = Math.max(0.05, t.width ?? 0.6), c = [];
253
+ for (let h = 0; h < Zt; h++) {
254
+ const f = h / (Zt - 1), m = Math.max(0, Math.min(1, (f - s) / o)), p = m * m * (3 - 2 * m);
255
+ c.push(n * (1 - e * (1 - p)));
234
256
  }
235
- const c = t.angle * Math.PI / 180, l = Math.cos(c), i = Math.sin(c), a = t.size / 2, M = t.size * 0.8;
257
+ const r = t.angle * Math.PI / 180, l = Math.cos(r), i = Math.sin(r), a = t.size / 2, d = t.size * 0.8;
236
258
  return {
237
- rgb: ds(t.accent, t.hue, Math.max(0, Math.min(1, t.vivid ?? 0)), t.brightness),
238
- mix: r,
259
+ rgb: Ps(t.accent, t.hue, Math.max(0, Math.min(1, t.vivid ?? 0)), t.brightness),
260
+ mix: c,
239
261
  saturation: n,
240
262
  at: (h, f) => {
241
- const p = ((h - a) * l + (f - a) * i) / M + 0.5;
242
- return Math.max(0, Math.min(Xt - 1, Math.round(p * (Xt - 1))));
263
+ const m = ((h - a) * l + (f - a) * i) / d + 0.5;
264
+ return Math.max(0, Math.min(Zt - 1, Math.round(m * (Zt - 1))));
243
265
  }
244
266
  };
245
267
  }
246
- const Ms = [120, 232, 214], ms = [64, 72, 255];
247
- function An(t, n, e) {
268
+ const Cs = [120, 232, 214], Fs = [64, 72, 255];
269
+ function Dn(t, n, e) {
248
270
  t /= 255, n /= 255, e /= 255;
249
- const s = Math.max(t, n, e), o = Math.min(t, n, e), r = (s + o) / 2;
250
- if (s === o) return [0, 0, r];
251
- const c = s - o, l = r > 0.5 ? c / (2 - s - o) : c / (s + o);
252
- return [(s === t ? (n - e) / c + (n < e ? 6 : 0) : s === n ? (e - t) / c + 2 : (t - n) / c + 4) / 6, l, r];
271
+ const s = Math.max(t, n, e), o = Math.min(t, n, e), c = (s + o) / 2;
272
+ if (s === o) return [0, 0, c];
273
+ const r = s - o, l = c > 0.5 ? r / (2 - s - o) : r / (s + o);
274
+ return [(s === t ? (n - e) / r + (n < e ? 6 : 0) : s === n ? (e - t) / r + 2 : (t - n) / r + 4) / 6, l, c];
253
275
  }
254
- function gs(t, n, e) {
255
- const s = (c) => (c + t * 12) % 12, o = n * Math.min(e, 1 - e), r = (c) => e - o * Math.max(-1, Math.min(s(c) - 3, 9 - s(c), 1));
256
- return [r(0) * 255, r(8) * 255, r(4) * 255];
276
+ function Is(t, n, e) {
277
+ const s = (r) => (r + t * 12) % 12, o = n * Math.min(e, 1 - e), c = (r) => e - o * Math.max(-1, Math.min(s(r) - 3, 9 - s(r), 1));
278
+ return [c(0) * 255, c(8) * 255, c(4) * 255];
257
279
  }
258
- const on = (t) => (t /= 255) <= 0.04045 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4, bs = (t) => 255 * (t <= 31308e-7 ? 12.92 * t : 1.055 * Math.max(0, t) ** (1 / 2.4) - 0.055);
259
- function dn(t, n, e) {
260
- const [s, o, r] = [on(t), on(n), on(e)], c = Math.cbrt(0.4122214708 * s + 0.5363325363 * o + 0.0514459929 * r), l = Math.cbrt(0.2119034982 * s + 0.6806995451 * o + 0.1073969566 * r), i = Math.cbrt(0.0883024619 * s + 0.2817188376 * o + 0.6299787005 * r);
280
+ const dn = (t) => (t /= 255) <= 0.04045 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4, Ns = (t) => 255 * (t <= 31308e-7 ? 12.92 * t : 1.055 * Math.max(0, t) ** (1 / 2.4) - 0.055);
281
+ function yn(t, n, e) {
282
+ const [s, o, c] = [dn(t), dn(n), dn(e)], r = Math.cbrt(0.4122214708 * s + 0.5363325363 * o + 0.0514459929 * c), l = Math.cbrt(0.2119034982 * s + 0.6806995451 * o + 0.1073969566 * c), i = Math.cbrt(0.0883024619 * s + 0.2817188376 * o + 0.6299787005 * c);
261
283
  return [
262
- 0.2104542553 * c + 0.793617785 * l - 0.0040720468 * i,
263
- 1.9779984951 * c - 2.428592205 * l + 0.4505937099 * i,
264
- 0.0259040371 * c + 0.7827717662 * l - 0.808675766 * i
284
+ 0.2104542553 * r + 0.793617785 * l - 0.0040720468 * i,
285
+ 1.9779984951 * r - 2.428592205 * l + 0.4505937099 * i,
286
+ 0.0259040371 * r + 0.7827717662 * l - 0.808675766 * i
265
287
  ];
266
288
  }
267
- function zn(t, n, e) {
268
- const s = (t + 0.3963377774 * n + 0.2158037573 * e) ** 3, o = (t - 0.1055613458 * n - 0.0638541728 * e) ** 3, r = (t - 0.0894841775 * n - 1.291485548 * e) ** 3, c = (l) => Math.max(0, Math.min(255, bs(l)));
289
+ function Yn(t, n, e) {
290
+ const s = (t + 0.3963377774 * n + 0.2158037573 * e) ** 3, o = (t - 0.1055613458 * n - 0.0638541728 * e) ** 3, c = (t - 0.0894841775 * n - 1.291485548 * e) ** 3, r = (l) => Math.max(0, Math.min(255, Ns(l)));
269
291
  return [
270
- c(4.0767416621 * s - 3.3077115913 * o + 0.2309699292 * r),
271
- c(-1.2684380046 * s + 2.6097574011 * o - 0.3413193965 * r),
272
- c(-0.0041960863 * s - 0.7034186147 * o + 1.707614701 * r)
292
+ r(4.0767416621 * s - 3.3077115913 * o + 0.2309699292 * c),
293
+ r(-1.2684380046 * s + 2.6097574011 * o - 0.3413193965 * c),
294
+ r(-0.0041960863 * s - 0.7034186147 * o + 1.707614701 * c)
273
295
  ];
274
296
  }
275
- function vs(t, n, e, s) {
276
- const o = s && s.amount > 5e-3 ? s : void 0;
277
- return t.map(([r, c, l, i]) => {
278
- if (e && (c += (e.r - c) * 0.85, l += (e.g - l) * 0.85, i += (e.b - i) * 0.85), o) {
279
- const [, M, h] = An(c, l, i), [f] = An(o.r, o.g, o.b), p = gs((f + 0.1 * Math.sin(2 * Math.PI * r) + 1) % 1, M, h), d = dn(c, l, i), m = dn(p[0], p[1], p[2]), v = o.amount;
280
- [c, l, i] = zn(d[0] + (m[0] - d[0]) * v, d[1] + (m[1] - d[1]) * v, d[2] + (m[2] - d[2]) * v);
297
+ const Bs = 146 / 360, Gs = [81, 136], Ln = 0.1;
298
+ function Ds(t, n = Gs) {
299
+ const e = (n[0] + n[1]) / 720, s = (n[1] - n[0]) / 720, o = Math.abs((t - Bs + 1.5) % 1 - 0.5), c = Math.max(0, 1 - o / (40 / 360));
300
+ return [t + (e - t) * c, Ln + (s - Ln) * c];
301
+ }
302
+ function Ls(t, n, e, s, o) {
303
+ const c = s && s.amount > 5e-3 ? s : void 0;
304
+ return t.map(([r, l, i, a]) => {
305
+ if (e && (l += (e.r - l) * 0.85, i += (e.g - i) * 0.85, a += (e.b - a) * 0.85), c) {
306
+ const [, h, f] = Dn(l, i, a), [m, p] = Ds(Dn(c.r, c.g, c.b)[0], o), M = Is((m + p * Math.sin(2 * Math.PI * r) + 1) % 1, h, f), v = yn(l, i, a), A = yn(M[0], M[1], M[2]), u = c.amount;
307
+ [l, i, a] = Yn(v[0] + (A[0] - v[0]) * u, v[1] + (A[1] - v[1]) * u, v[2] + (A[2] - v[2]) * u);
281
308
  }
282
- const a = n ? 1 : 0.82;
283
- return [r, c * a, l * a, i * a];
309
+ const d = n ? 1 : 0.82;
310
+ return [r, l * d, i * d, a * d];
284
311
  });
285
312
  }
286
- const Dn = (t, n, e) => `rgb(${Math.round(t)},${Math.round(n)},${Math.round(e)})`;
287
- function ys(t, n = 36) {
313
+ const jn = (t, n, e) => `rgb(${Math.round(t)},${Math.round(n)},${Math.round(e)})`;
314
+ function qs(t, n = 36) {
288
315
  const e = t.filter(([a]) => a < 1), s = e.length;
289
316
  if (s < 3) return t;
290
- const o = e.map(([, a, M, h]) => dn(a, M, h)), r = (a) => (a % s + s) % s, c = (a) => e[r(a)][0] + Math.floor(a / s), l = (a) => {
291
- const M = c(a + 1) - c(a - 1);
292
- return o[r(a + 1)].map((h, f) => (h - o[r(a - 1)][f]) / M);
317
+ const o = e.map(([, a, d, h]) => yn(a, d, h)), c = (a) => (a % s + s) % s, r = (a) => e[c(a)][0] + Math.floor(a / s), l = (a) => {
318
+ const d = r(a + 1) - r(a - 1);
319
+ return o[c(a + 1)].map((h, f) => (h - o[c(a - 1)][f]) / d);
293
320
  }, i = [];
294
321
  for (let a = 0; a <= n; a++) {
295
- const M = a / n;
322
+ const d = a / n;
296
323
  let h = -1;
297
- for (; h < s - 1 && c(h + 1) <= M; ) h++;
298
- const f = c(h + 1) - c(h), p = (M - c(h)) / f, d = p * p, m = d * p, v = o[r(h)], _ = o[r(h + 1)], u = l(h), g = l(h + 1), y = [0, 1, 2].map(
299
- (w) => (2 * m - 3 * d + 1) * v[w] + (m - 2 * d + p) * f * u[w] + (-2 * m + 3 * d) * _[w] + (m - d) * f * g[w]
300
- ), [N, T, z] = zn(y[0], y[1], y[2]);
301
- i.push([M, N, T, z]);
324
+ for (; h < s - 1 && r(h + 1) <= d; ) h++;
325
+ const f = r(h + 1) - r(h), m = (d - r(h)) / f, p = m * m, M = p * m, v = o[c(h)], A = o[c(h + 1)], u = l(h), g = l(h + 1), x = [0, 1, 2].map(
326
+ (w) => (2 * M - 3 * p + 1) * v[w] + (M - 2 * p + m) * f * u[w] + (-2 * M + 3 * p) * A[w] + (M - p) * f * g[w]
327
+ ), [B, S, L] = Yn(x[0], x[1], x[2]);
328
+ i.push([d, B, S, L]);
302
329
  }
303
330
  return i;
304
331
  }
305
- const xs = 1.5, qn = typeof CanvasRenderingContext2D == "function" && "filter" in CanvasRenderingContext2D.prototype, Rn = /* @__PURE__ */ new WeakMap();
306
- function an(t, n) {
332
+ const Os = 1.5, Zn = typeof CanvasRenderingContext2D == "function" && "filter" in CanvasRenderingContext2D.prototype, qn = /* @__PURE__ */ new WeakMap();
333
+ function pn(t, n) {
307
334
  return (typeof OffscreenCanvas == "function" ? new OffscreenCanvas(t, n) : Object.assign(document.createElement("canvas"), { width: t, height: n })).getContext("2d");
308
335
  }
309
- function ws(t) {
336
+ function Us(t) {
310
337
  const { width: n, height: e } = t.canvas;
311
- let s = Rn.get(t);
312
- return (!s || s.full.canvas.width !== n || s.full.canvas.height !== e) && (s = { full: an(n, e) }, qn || (s.half = an(Math.ceil(n / 2), Math.ceil(e / 2)), s.quarter = an(Math.ceil(n / 4), Math.ceil(e / 4))), Rn.set(t, s)), s.full.setTransform(1, 0, 0, 1, 0, 0), s.full.clearRect(0, 0, n, e), s.full.setTransform(t.getTransform()), s;
338
+ let s = qn.get(t);
339
+ return (!s || s.full.canvas.width !== n || s.full.canvas.height !== e) && (s = { full: pn(n, e) }, Zn || (s.half = pn(Math.ceil(n / 2), Math.ceil(e / 2)), s.quarter = pn(Math.ceil(n / 4), Math.ceil(e / 4))), qn.set(t, s)), s.full.setTransform(1, 0, 0, 1, 0, 0), s.full.clearRect(0, 0, n, e), s.full.setTransform(t.getTransform()), s;
313
340
  }
314
- function cn(t, n) {
341
+ function mn(t, n) {
315
342
  t.globalCompositeOperation = "copy", t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high", t.drawImage(n.canvas, 0, 0, t.canvas.width, t.canvas.height);
316
343
  }
317
- function Ss(t, n, e) {
344
+ function zs(t, n, e) {
318
345
  const s = t.getTransform();
319
- t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.globalCompositeOperation = e, t.globalAlpha = 1, t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high", qn ? (t.filter = `blur(${xs * Math.hypot(s.a, s.b)}px)`, t.drawImage(n.full.canvas, 0, 0)) : n.half && n.quarter && (cn(n.half, n.full), cn(n.quarter, n.half), cn(n.half, n.quarter), t.drawImage(n.half.canvas, 0, 0, n.half.canvas.width * 2, n.half.canvas.height * 2)), t.restore();
346
+ t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.globalCompositeOperation = e, t.globalAlpha = 1, t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high", Zn ? (t.filter = `blur(${Os * Math.hypot(s.a, s.b)}px)`, t.drawImage(n.full.canvas, 0, 0)) : n.half && n.quarter && (mn(n.half, n.full), mn(n.quarter, n.half), mn(n.half, n.quarter), t.drawImage(n.half.canvas, 0, 0, n.half.canvas.width * 2, n.half.canvas.height * 2)), t.restore();
320
347
  }
321
- function Pn(t, n, e) {
348
+ function On(t, n, e) {
322
349
  const s = typeof t.createConicGradient == "function" ? t.createConicGradient(n.angle, n.cx, n.cy) : t.createLinearGradient(n.cx - n.r, n.cy - n.r, n.cx + n.r, n.cy + n.r);
323
- for (const [o, r, c, l] of e) s.addColorStop(K(o), Dn(r, c, l));
350
+ for (const [o, c, r, l] of e) s.addColorStop(j(o), jn(c, r, l));
324
351
  return s;
325
352
  }
326
- function Ts(t, n, e, s, o, r) {
327
- const c = ys(vs(e.stops, s, o, r)), l = Pn(t, e, c), i = n.strokes.map((u) => {
328
- const g = new Path2D(), y = u.pts.length >> 1;
329
- let N = 0;
330
- for (let T = 0; T < y; T++)
331
- T === 0 ? g.moveTo(u.pts[0], u.pts[1]) : g.lineTo(u.pts[2 * T], u.pts[2 * T + 1]), N += u.a[T];
332
- return u.closed && g.closePath(), { p: g, a: y ? N / y : 1, w: u.w };
333
- }), a = Math.max(1, i.length), M = e.intensity, h = s ? "lighter" : "source-over", f = (u, g, y = t) => {
334
- for (const N of i)
335
- y.lineWidth = u(N.w), y.globalAlpha = K(g(N.a)), y.stroke(N.p);
336
- }, p = (u, g) => {
353
+ function $s(t, n, e, s, o, c) {
354
+ const r = qs(Ls(e.stops, s, o, c, e.green)), l = On(t, e, r), i = n.strokes.map((u) => {
355
+ const g = new Path2D(), x = u.pts.length >> 1;
356
+ let B = 0;
357
+ for (let S = 0; S < x; S++)
358
+ S === 0 ? g.moveTo(u.pts[0], u.pts[1]) : g.lineTo(u.pts[2 * S], u.pts[2 * S + 1]), B += u.a[S];
359
+ return u.closed && g.closePath(), { p: g, a: x ? B / x : 1, w: u.w };
360
+ }), a = Math.max(1, i.length), d = e.intensity, h = s ? "lighter" : "source-over", f = (u, g, x = t) => {
361
+ for (const B of i)
362
+ x.lineWidth = u(B.w), x.globalAlpha = j(g(B.a)), x.stroke(B.p);
363
+ }, m = (u, g) => {
337
364
  u.lineCap = "round", u.lineJoin = "round", u.globalCompositeOperation = h, u.strokeStyle = g;
338
- }, d = ws(t), m = d.full;
339
- p(m, Pn(m, e, c));
340
- const v = e.halo * M * (s ? 1 : 0.2) / a;
365
+ }, p = Us(t), M = p.full;
366
+ m(M, On(M, e, r));
367
+ const v = e.halo * d * (s ? 1 : 0.2) / a;
341
368
  for (const [u, g] of [
342
369
  [0.7, 0.045],
343
370
  [0.42, 0.075],
@@ -347,50 +374,50 @@ function Ts(t, n, e, s, o, r) {
347
374
  f(
348
375
  () => e.r * u,
349
376
  () => g * v,
350
- m
377
+ M
351
378
  );
352
- const _ = M * (s ? 1 : 0.6);
379
+ const A = d * (s ? 1 : 0.6);
353
380
  for (const [u, g] of [
354
381
  [16, 0.05],
355
382
  [8, 0.11],
356
383
  [4, 0.2]
357
384
  ])
358
385
  f(
359
- (y) => y * u,
360
- (y) => g * _ * y,
361
- m
386
+ (x) => x * u,
387
+ (x) => g * A * x,
388
+ M
362
389
  );
363
- if (Ss(t, d, h), t.save(), p(t, l), s && e.fringe > 0) {
364
- for (const [u, g, y] of [
365
- [1 + e.fringe, Ms, 0.16],
366
- [1 - e.fringe, ms, 0.22]
390
+ if (zs(t, p, h), t.save(), m(t, l), s && e.fringe > 0) {
391
+ for (const [u, g, x] of [
392
+ [1 + e.fringe, Cs, 0.16],
393
+ [1 - e.fringe, Fs, 0.22]
367
394
  ])
368
- t.save(), t.translate(e.cx, e.cy), t.scale(u, u), t.translate(-e.cx, -e.cy), t.strokeStyle = Dn(g[0], g[1], g[2]), f(
369
- (N) => N * 1.4 / u,
370
- (N) => y * M * N
395
+ t.save(), t.translate(e.cx, e.cy), t.scale(u, u), t.translate(-e.cx, -e.cy), t.strokeStyle = jn(g[0], g[1], g[2]), f(
396
+ (B) => B * 1.4 / u,
397
+ (B) => x * d * B
371
398
  ), t.restore();
372
399
  t.strokeStyle = l;
373
400
  }
374
401
  if (f(
375
402
  (u) => u,
376
- (u) => 0.7 * u * (0.75 + 0.25 * M)
403
+ (u) => 0.7 * u * (0.75 + 0.25 * d)
377
404
  ), s)
378
405
  for (const u of e.spec) {
379
406
  const g = t.createRadialGradient(u.x, u.y, 0, u.x, u.y, u.r);
380
407
  g.addColorStop(0, "rgba(255,255,255,1)"), g.addColorStop(0.35, "rgba(255,255,255,0.45)"), g.addColorStop(1, "rgba(255,255,255,0)"), t.strokeStyle = g, f(
381
- (y) => y * 2.2,
382
- (y) => u.a * y
408
+ (x) => x * 2.2,
409
+ (x) => u.a * x
383
410
  );
384
411
  }
385
412
  t.restore();
386
413
  }
387
- const Es = `
414
+ const Ws = `
388
415
  attribute vec2 aPos;
389
416
  varying vec2 vUv;
390
417
  void main() {
391
418
  vUv = vec2(aPos.x + 1.0, 1.0 - aPos.y) * 0.5;
392
419
  gl_Position = vec4(aPos, 0.0, 1.0);
393
- }`, As = `
420
+ }`, Xs = `
394
421
  precision highp float;
395
422
  uniform sampler2D uTex;
396
423
  uniform vec2 uSize;
@@ -425,88 +452,88 @@ void main() {
425
452
  }
426
453
  gl_FragColor = vec4(rgb, a) / float(TAPS);
427
454
  }`;
428
- let Vt;
429
- function Rs() {
455
+ let Jt;
456
+ function Vs() {
430
457
  if (typeof document > "u") return null;
431
458
  const t = document.createElement("canvas"), n = t.getContext("webgl", { premultipliedAlpha: !0, antialias: !1, depth: !1 });
432
459
  if (!n) return null;
433
460
  const e = (i, a) => {
434
- const M = n.createShader(i);
435
- return n.shaderSource(M, a), n.compileShader(M), M;
461
+ const d = n.createShader(i);
462
+ return n.shaderSource(d, a), n.compileShader(d), d;
436
463
  }, s = n.createProgram();
437
- if (n.attachShader(s, e(n.VERTEX_SHADER, Es)), n.attachShader(s, e(n.FRAGMENT_SHADER, As)), n.linkProgram(s), !n.getProgramParameter(s, n.LINK_STATUS)) return null;
464
+ if (n.attachShader(s, e(n.VERTEX_SHADER, Ws)), n.attachShader(s, e(n.FRAGMENT_SHADER, Xs)), n.linkProgram(s), !n.getProgramParameter(s, n.LINK_STATUS)) return null;
438
465
  n.useProgram(s);
439
466
  const o = n.createBuffer();
440
467
  n.bindBuffer(n.ARRAY_BUFFER, o), n.bufferData(n.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), n.STATIC_DRAW);
441
- const r = n.getAttribLocation(s, "aPos");
442
- n.enableVertexAttribArray(r), n.vertexAttribPointer(r, 2, n.FLOAT, !1, 0, 0);
443
- const c = n.createTexture();
444
- n.bindTexture(n.TEXTURE_2D, c), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.LINEAR), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.LINEAR), n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0);
468
+ const c = n.getAttribLocation(s, "aPos");
469
+ n.enableVertexAttribArray(c), n.vertexAttribPointer(c, 2, n.FLOAT, !1, 0, 0);
470
+ const r = n.createTexture();
471
+ n.bindTexture(n.TEXTURE_2D, r), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.LINEAR), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.LINEAR), n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0);
445
472
  const l = {};
446
473
  for (const i of ["uSize", "uWall", "uSide", "uZone", "uGap", "uFlare", "uSplit", "uBlur", "uCy"])
447
474
  l[i] = n.getUniformLocation(s, i);
448
- return { gl: n, canvas: t, source: document.createElement("canvas"), tex: c, u: l };
475
+ return { gl: n, canvas: t, source: document.createElement("canvas"), tex: r, u: l };
449
476
  }
450
- function Ps(t, n, e, s) {
451
- if (Vt === void 0 && (Vt = Rs()), !Vt) return !1;
452
- const { gl: o, canvas: r, source: c, tex: l, u: i } = Vt, a = t.getTransform(), M = Math.hypot(a.a, a.b) || 1, h = t.canvas.width, f = t.canvas.height, p = a.a * e + a.e, d = s.zone * M, m = s.blur * M, v = Math.max(0, Math.floor(n > 0 ? p - d - 2 * m - 4 : 0)), u = Math.min(h, Math.ceil(n > 0 ? h : p + d + 2 * m + 4)) - v;
477
+ function Hs(t, n, e, s) {
478
+ if (Jt === void 0 && (Jt = Vs()), !Jt) return !1;
479
+ const { gl: o, canvas: c, source: r, tex: l, u: i } = Jt, a = t.getTransform(), d = Math.hypot(a.a, a.b) || 1, h = t.canvas.width, f = t.canvas.height, m = a.a * e + a.e, p = s.zone * d, M = s.blur * d, v = Math.max(0, Math.floor(n > 0 ? m - p - 2 * M - 4 : 0)), u = Math.min(h, Math.ceil(n > 0 ? h : m + p + 2 * M + 4)) - v;
453
480
  if (u < 2 || f < 2) return !1;
454
- (c.width !== u || c.height !== f) && (c.width = u, c.height = f);
455
- const g = c.getContext("2d");
456
- return g.clearRect(0, 0, u, f), g.drawImage(t.canvas, v, 0, u, f, 0, 0, u, f), (r.width !== u || r.height !== f) && (r.width = u, r.height = f), o.viewport(0, 0, u, f), o.bindTexture(o.TEXTURE_2D, l), o.texImage2D(o.TEXTURE_2D, 0, o.RGBA, o.RGBA, o.UNSIGNED_BYTE, c), o.uniform2f(i.uSize, u, f), o.uniform1f(i.uWall, p - v), o.uniform1f(i.uSide, n), o.uniform1f(i.uZone, d), o.uniform1f(i.uGap, s.gap * M), o.uniform1f(i.uFlare, s.flare), o.uniform1f(i.uSplit, s.split * M), o.uniform1f(i.uBlur, m), o.uniform1f(i.uCy, a.d * s.cy + a.f), o.clearColor(0, 0, 0, 0), o.clear(o.COLOR_BUFFER_BIT), o.drawArrays(o.TRIANGLE_STRIP, 0, 4), t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.globalCompositeOperation = "copy", t.beginPath(), t.rect(v, 0, u, f), t.clip(), t.drawImage(r, v, 0), t.restore(), !0;
481
+ (r.width !== u || r.height !== f) && (r.width = u, r.height = f);
482
+ const g = r.getContext("2d");
483
+ return g.clearRect(0, 0, u, f), g.drawImage(t.canvas, v, 0, u, f, 0, 0, u, f), (c.width !== u || c.height !== f) && (c.width = u, c.height = f), o.viewport(0, 0, u, f), o.bindTexture(o.TEXTURE_2D, l), o.texImage2D(o.TEXTURE_2D, 0, o.RGBA, o.RGBA, o.UNSIGNED_BYTE, r), o.uniform2f(i.uSize, u, f), o.uniform1f(i.uWall, m - v), o.uniform1f(i.uSide, n), o.uniform1f(i.uZone, p), o.uniform1f(i.uGap, s.gap * d), o.uniform1f(i.uFlare, s.flare), o.uniform1f(i.uSplit, s.split * d), o.uniform1f(i.uBlur, M), o.uniform1f(i.uCy, a.d * s.cy + a.f), o.clearColor(0, 0, 0, 0), o.clear(o.COLOR_BUFFER_BIT), o.drawArrays(o.TRIANGLE_STRIP, 0, 4), t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.globalCompositeOperation = "copy", t.beginPath(), t.rect(v, 0, u, f), t.clip(), t.drawImage(c, v, 0), t.restore(), !0;
457
484
  }
458
- function Gn(t, n, e, s) {
459
- const o = 2.2 / s.size, r = Gt(t * o + s.t * 0.11, n * o - s.t * 0.08, s.t * 0.07), c = pn(0.3, 0.75, r);
460
- return s.amount * (0.2 + 0.75 * c) * K(1.3 - e);
485
+ function Jn(t, n, e, s) {
486
+ const o = 2.2 / s.size, c = zt(t * o + s.t * 0.11, n * o - s.t * 0.08, s.t * 0.07), r = wn(0.3, 0.75, c);
487
+ return s.amount * (0.2 + 0.75 * r) * j(1.3 - e);
461
488
  }
462
- function Ln(t, n, e, s, o, r = 0, c, l = 0) {
463
- const i = Math.round(n * 1e3) / 1e3, a = (d) => e ? d * (1 - t) : d + (255 - d) * t, M = (e ? 1 - t : t) * 255;
464
- let h = s ? a(s.r) : M, f = s ? a(s.g) : M, p = s ? a(s.b) : M;
465
- return c && l > 0 && (h += (a(c[0]) - h) * l, f += (a(c[1]) - f) * l, p += (a(c[2]) - p) * l), o && r > 0 && (h += (a(o.r) - h) * r, f += (a(o.g) - f) * r, p += (a(o.b) - p) * r), `rgba(${Math.round(h)},${Math.round(f)},${Math.round(p)},${i})`;
489
+ function Qn(t, n, e, s, o, c = 0, r, l = 0) {
490
+ const i = Math.round(n * 1e3) / 1e3, a = (p) => e ? p * (1 - t) : p + (255 - p) * t, d = (e ? 1 - t : t) * 255;
491
+ let h = s ? a(s.r) : d, f = s ? a(s.g) : d, m = s ? a(s.b) : d;
492
+ return r && l > 0 && (h += (a(r[0]) - h) * l, f += (a(r[1]) - f) * l, m += (a(r[2]) - m) * l), o && c > 0 && (h += (a(o.r) - h) * c, f += (a(o.g) - f) * c, m += (a(o.b) - m) * c), `rgba(${Math.round(h)},${Math.round(f)},${Math.round(m)},${i})`;
466
493
  }
467
- const _n = 24, kn = 8;
468
- function _s(t, n, e, s, o, r) {
469
- const c = o && o.amount > 5e-3 ? o : void 0, l = r && r.saturation > 0 ? r : void 0, i = /* @__PURE__ */ new Map();
494
+ const Un = 24, zn = 8;
495
+ function Ks(t, n, e, s, o, c) {
496
+ const r = o && o.amount > 5e-3 ? o : void 0, l = c && c.saturation > 0 ? c : void 0, i = /* @__PURE__ */ new Map();
470
497
  for (const a of n) {
471
- const M = a.pts.length >> 1, h = a.closed ? M : M - 1;
472
- let f = "", p;
473
- for (let d = 0; d < h; d++) {
474
- const m = d + 1 === M ? 0 : d + 1, v = Math.round(K((a.a[d] + a.a[m]) / 2) * _n);
498
+ const d = a.pts.length >> 1, h = a.closed ? d : d - 1;
499
+ let f = "", m;
500
+ for (let p = 0; p < h; p++) {
501
+ const M = p + 1 === d ? 0 : p + 1, v = Math.round(j((a.a[p] + a.a[M]) / 2) * Un);
475
502
  if (v === 0) {
476
503
  f = "";
477
504
  continue;
478
505
  }
479
- const _ = c ? Math.round(
480
- Gn((a.pts[2 * d] + a.pts[2 * m]) / 2, (a.pts[2 * d + 1] + a.pts[2 * m + 1]) / 2, a.white, c) * kn
481
- ) : 0, u = l ? l.at((a.pts[2 * d] + a.pts[2 * m]) / 2, (a.pts[2 * d + 1] + a.pts[2 * m + 1]) / 2) : 0, g = `${v}|${a.white}|${Math.round(a.w * 20)}|${_}|${u}`;
506
+ const A = r ? Math.round(
507
+ Jn((a.pts[2 * p] + a.pts[2 * M]) / 2, (a.pts[2 * p + 1] + a.pts[2 * M + 1]) / 2, a.white, r) * zn
508
+ ) : 0, u = l ? l.at((a.pts[2 * p] + a.pts[2 * M]) / 2, (a.pts[2 * p + 1] + a.pts[2 * M + 1]) / 2) : 0, g = `${v}|${a.white}|${Math.round(a.w * 20)}|${A}|${u}`;
482
509
  if (g !== f) {
483
- let y = i.get(g);
484
- y || (y = { path: new Path2D(), white: a.white, w: a.w, a: v / _n, gw: _ / kn, ci: u }, i.set(g, y)), p = y, f = g, y.path.moveTo(a.pts[2 * d], a.pts[2 * d + 1]);
510
+ let x = i.get(g);
511
+ x || (x = { path: new Path2D(), white: a.white, w: a.w, a: v / Un, gw: A / zn, ci: u }, i.set(g, x)), m = x, f = g, x.path.moveTo(a.pts[2 * p], a.pts[2 * p + 1]);
485
512
  }
486
- p.path.lineTo(a.pts[2 * m], a.pts[2 * m + 1]);
513
+ m.path.lineTo(a.pts[2 * M], a.pts[2 * M + 1]);
487
514
  }
488
515
  }
489
516
  t.lineCap = "round", t.lineJoin = "round";
490
517
  for (const a of i.values())
491
- t.strokeStyle = Ln(K(a.white), a.a, e, s, c, a.gw, l == null ? void 0 : l.rgb, l == null ? void 0 : l.mix[a.ci]), t.lineWidth = a.w, t.stroke(a.path);
518
+ t.strokeStyle = Qn(j(a.white), a.a, e, s, r, a.gw, l == null ? void 0 : l.rgb, l == null ? void 0 : l.mix[a.ci]), t.lineWidth = a.w, t.stroke(a.path);
492
519
  }
493
- function ks(t, n, e, s, o, r, c = !1) {
494
- const l = o && o.amount > 5e-3 ? o : void 0, i = r && r.saturation > 0 ? r : void 0;
520
+ function Ys(t, n, e, s, o, c, r = !1) {
521
+ const l = o && o.amount > 5e-3 ? o : void 0, i = c && c.saturation > 0 ? c : void 0;
495
522
  for (const a of n) {
496
- const M = K(a.white), h = l ? Gn(a.x, a.y, M, l) : 0, f = i ? i.at(a.x, a.y) : 0;
497
- if (t.fillStyle = Ln(M, K(a.a ?? 1), e, s, l, h, i == null ? void 0 : i.rgb, i == null ? void 0 : i.mix[f]), c) {
523
+ const d = j(a.white), h = l ? Jn(a.x, a.y, d, l) : 0, f = i ? i.at(a.x, a.y) : 0;
524
+ if (t.fillStyle = Qn(d, j(a.a ?? 1), e, s, l, h, i == null ? void 0 : i.rgb, i == null ? void 0 : i.mix[f]), r) {
498
525
  t.fillRect(a.x - a.r, a.y - a.r, 2 * a.r, 2 * a.r);
499
526
  continue;
500
527
  }
501
- t.beginPath(), t.arc(a.x, a.y, a.r, 0, ht), t.fill();
528
+ t.beginPath(), t.arc(a.x, a.y, a.r, 0, Mt), t.fill();
502
529
  }
503
530
  }
504
- function Cs(t, n, e, s, o, r) {
531
+ function js(t, n, e, s, o, c) {
505
532
  var l;
506
- const c = r && r.saturation > 0 && !n.light ? ps(r) : void 0;
507
- n.light ? Ts(t, n, n.light, e, s, o) : n.strokes.length && _s(t, n.strokes, e, s, o, c), ks(t, n.dots, e, s, o, c, n.square), (l = n.contact) != null && l.lens && Ps(t, n.contact.side, n.contact.x, n.contact.lens);
533
+ const r = c && c.saturation > 0 && !n.light ? ks(c) : void 0;
534
+ n.light ? $s(t, n, n.light, e, s, o) : n.strokes.length && Ks(t, n.strokes, e, s, o, r), Ys(t, n.dots, e, s, o, r, n.square), (l = n.contact) != null && l.lens && Hs(t, n.contact.side, n.contact.x, n.contact.lens);
508
535
  }
509
- const Fs = [
536
+ const Zs = [
510
537
  [0, 255, 150, 90],
511
538
  [0.12, 255, 110, 120],
512
539
  [0.24, 255, 80, 170],
@@ -518,171 +545,172 @@ const Fs = [
518
545
  [0.84, 170, 90, 255],
519
546
  [0.93, 240, 104, 165],
520
547
  [1, 255, 150, 90]
521
- ], Is = (t, n, e, s) => {
522
- const o = t / 2, r = e.level, [c, l] = e.softBands, i = e.bands[2], a = e.drive, M = e.processing, h = 0.5 * r + 0.5 * e.soft, f = o * (s.radius ?? 0.56) * (1 + (s.zoom ?? 0.17) * e.soft) * (1 - 0.06 * M), p = s.deform ?? 1.45, d = 0.02 + (0.14 * c + 0.06 * r) * p, m = 0.01 + (0.07 * l + 0.03 * i) * p, v = Mn(d, m, a, s.deformRadius ?? 1.75), _ = Math.max(0.6, (s.lineW ?? 1.85) * Lt(t, 0.5)), u = Math.max(1, Math.round(s.rings ?? 6)), g = Math.max(24, Math.round(s.segs ?? 140)), y = s.lean ?? 0.91, N = s.ringGap ?? 0.02, T = [];
523
- let z = 0, w = 0;
524
- for (let x = 0; x < u; x++) {
525
- const F = 0.16 * (0.5 + xt(x, 2.1)) * (x % 2 ? 1 : -1), A = Math.max(
548
+ ], Js = (t, n, e, s) => {
549
+ const o = t / 2, c = e.level, [r, l] = e.softBands, i = e.bands[2], a = e.drive, d = e.processing, h = 0.5 * c + 0.5 * e.soft, f = o * (s.radius ?? 0.56) * (1 + (s.zoom ?? 0.17) * e.soft) * (1 - 0.06 * d), m = s.deform ?? 1.45, p = 0.02 + (0.14 * r + 0.06 * c) * m, M = 0.01 + (0.07 * l + 0.03 * i) * m, v = En(p, M, a, s.deformRadius ?? 1.75), A = Math.max(0.6, (s.lineW ?? 1.85) * $t(t, 0.5)), u = Math.max(1, Math.round(s.rings ?? 6)), g = Math.max(24, Math.round(s.segs ?? 140)), x = s.lean ?? 0.91, B = s.ringGap ?? 0.02, S = [];
550
+ let L = 0, w = 0;
551
+ for (let y = 0; y < u; y++) {
552
+ const I = 0.16 * (0.5 + Tt(y, 2.1)) * (y % 2 ? 1 : -1), R = Math.max(
526
553
  0.02,
527
- y * (0.2 + 0.8 * xt(x, 3.1)) + 0.03 * Math.sin(n * 0.27 + x * 1.3) + 0.08 * Math.sin(a * 0.35 + x * 1.7)
528
- ), B = xt(x, 7.7) * ht + n * 0.05 * (x % 2 ? 1 : -1) + a * F, C = Math.sin(A) * Math.cos(B), I = Math.sin(A) * Math.sin(B), E = Math.cos(A), R = Math.hypot(C, E), q = E / R, L = -C / R, U = I * L, $ = E * q - C * L, j = -I * q, tt = f * (1 + N * (x - (u - 1) / 2)), H = Math.sin(A), X = [], at = [], Z = [];
529
- for (let J = 0; J < g; J++) {
530
- const W = J / g * ht, ut = Math.cos(W), ct = Math.sin(W), rt = q * ut + U * ct, nt = $ * ct, Mt = L * ut + j * ct, lt = v(rt, nt, Mt);
531
- X.push(rt, nt), at.push(lt), z += lt, w++, Z.push(0.62 + 0.38 * K((Mt / H + 1) / 2));
554
+ x * (0.2 + 0.8 * Tt(y, 3.1)) + 0.03 * Math.sin(n * 0.27 + y * 1.3) + 0.08 * Math.sin(a * 0.35 + y * 1.7)
555
+ ), G = Tt(y, 7.7) * Mt + n * 0.05 * (y % 2 ? 1 : -1) + a * I, C = Math.sin(R) * Math.cos(G), F = Math.sin(R) * Math.sin(G), T = Math.cos(R), P = Math.hypot(C, T), N = T / P, O = -C / P, z = F * O, W = T * N - C * O, X = -F * N, Q = f * (1 + B * (y - (u - 1) / 2)), Z = Math.sin(R), V = [], at = [], nt = [];
556
+ for (let H = 0; H < g; H++) {
557
+ const st = H / g * Mt, $ = Math.cos(st), ht = Math.sin(st), ut = N * $ + z * ht, tt = W * ht, ft = O * $ + X * ht, dt = v(ut, tt, ft);
558
+ V.push(ut, tt), at.push(dt), L += dt, w++, nt.push(0.62 + 0.38 * j((ft / Z + 1) / 2));
532
559
  }
533
- T.push({ dirs: X, f: at, a: Z, rk: tt });
560
+ S.push({ dirs: V, f: at, a: nt, rk: Q });
534
561
  }
535
- const k = w ? z / w : 0;
536
- let P = 0, D = 0;
537
- for (const { dirs: x, f: F } of T)
538
- for (let A = 0; A < F.length; A++) {
539
- const B = x[2 * A], C = x[2 * A + 1], I = Math.hypot(B, C) || 1;
540
- P += (F[A] - k) * (B / I), D += (F[A] - k) * (C / I);
562
+ const k = w ? L / w : 0;
563
+ let _ = 0, q = 0;
564
+ for (const { dirs: y, f: I } of S)
565
+ for (let R = 0; R < I.length; R++) {
566
+ const G = y[2 * R], C = y[2 * R + 1], F = Math.hypot(G, C) || 1;
567
+ _ += (I[R] - k) * (G / F), q += (I[R] - k) * (C / F);
541
568
  }
542
- P = w ? 2 * P / w : 0, D = w ? 2 * D / w : 0;
543
- const O = T.map(({ dirs: x, f: F, a: A, rk: B }) => {
569
+ _ = w ? 2 * _ / w : 0, q = w ? 2 * q / w : 0;
570
+ const U = S.map(({ dirs: y, f: I, a: R, rk: G }) => {
544
571
  const C = [];
545
- for (let I = 0; I < F.length; I++) {
546
- const E = x[2 * I], R = x[2 * I + 1], q = Math.hypot(E, R) || 1, L = B * (1 + F[I] - k - P * (E / q) - D * (R / q));
547
- C.push(o + E * L, o - R * L);
572
+ for (let F = 0; F < I.length; F++) {
573
+ const T = y[2 * F], P = y[2 * F + 1], N = Math.hypot(T, P) || 1, O = G * (1 + I[F] - k - _ * (T / N) - q * (P / N));
574
+ C.push(o + T * O, o - P * O);
548
575
  }
549
- return { pts: C, a: A, white: 0, w: _, closed: !0 };
550
- }), b = 2.3 + 0.25 * Math.sin(n * 0.21) + 2 * e.spin, S = {
576
+ return { pts: C, a: R, white: 0, w: A, closed: !0 };
577
+ }), b = 2.3 + 0.25 * Math.sin(n * 0.21) + 2 * e.spin, E = {
551
578
  cx: o,
552
579
  cy: o,
553
580
  r: f,
554
- stops: Fs,
581
+ stops: Zs,
555
582
  // warm at the top, cool below, swaying rather than turning — the
556
583
  // spectrum flows with the voice but keeps its sense of up; processing
557
584
  // spins it all the way round
558
585
  angle: -Math.PI / 2 - 0.35 + 0.5 * Math.sin(n * 0.07) + 0.4 * Math.sin(a * 0.2) + e.spin,
559
586
  // processing lights the ring up: brighter bloom and a bigger halo
560
- intensity: 0.62 + 0.55 * h + 0.5 * M,
561
- halo: (s.halo ?? 0.5) * (1 + 0.6 * M),
587
+ intensity: 0.62 + 0.55 * h + 0.5 * d,
588
+ halo: (s.halo ?? 0.5) * (1 + 0.6 * d),
562
589
  spec: [
563
590
  {
564
591
  x: o + Math.cos(b) * f,
565
592
  y: o + Math.sin(b) * f,
566
- r: f * (0.5 + 0.25 * M),
567
- a: 0.5 + 0.35 * h + 0.4 * M
593
+ r: f * (0.5 + 0.25 * d),
594
+ a: 0.5 + 0.35 * h + 0.4 * d
568
595
  }
569
596
  ],
570
- fringe: 0.016 + 0.012 * h
597
+ fringe: 0.016 + 0.012 * h,
598
+ green: [s.greenFrom ?? 81, s.greenTo ?? 136]
571
599
  };
572
- return { ...Ct([], O), light: S };
573
- }, On = -0.45, Un = 0.55, $n = 0.7, Ns = Math.hypot(On, Un, $n), Bs = (t, n, e, s) => {
574
- const o = t / 2, r = e.level, [c, l, i] = e.bands, a = e.drive, M = e.processing, h = o * (s.radius ?? 0.72), f = h * (1 + (s.zoom ?? 0.3) * r) * (1 - 0.06 * M), p = s.rMul ?? 1, d = Math.max(4, Math.round(s.cells ?? 17)), m = 2 * h / d, v = m / 2 - Math.max(0.5, m * (s.gap ?? 0.24) / 2), _ = Math.ceil(f * 1.25 / m), u = (s.turn ?? 0.12) * n + 0.1 * a + 0.5 * e.spin, g = Math.sin(u), y = Math.cos(u), N = Math.sin(0.35), T = Math.cos(0.35), z = s.shade ?? 0.7, w = s.texture ?? 0.35, k = s.fade ?? 1.3, P = s.strength ?? 1.38, D = s.deform ?? 1.7, O = 0.012 + (0.09 * c + 0.03 * r) * D, b = (0.035 * l + 0.025 * i) * D, S = (C) => O * (0.55 * Math.sin(2 * C + 0.9 * a) + 0.45 * Math.sin(3 * C - 0.7 * a + 1.3)) + b * Math.sin(7 * C + 2.3 * a) * Math.sin(5 * C - 1.7 * a), x = 0.95 * Math.sin(n * 1.3), F = e.spectrum, A = F.length, B = [];
575
- for (let C = -_; C <= _; C++)
576
- for (let I = -_; I <= _; I++) {
577
- const E = o + I * m, R = o + C * m, q = (E - o) / f, L = -(R - o) / f, U = S(Math.atan2(L, q)), $ = Math.hypot(q, L) / (1 + U);
578
- if ($ >= 1) continue;
579
- const j = 1 / (1 + U), tt = q * j, H = L * j, X = Math.sqrt(Math.max(0, 1 - tt * tt - H * H)), at = K((tt * On + H * Un + X * $n) / Ns), Z = 1 - z + z * at, J = H * T + X * N, W = -H * N + X * T, ut = tt * y - W * g, ct = tt * g + W * y, rt = 0.65 * Gt(ut * 2.2 + a * 0.15, J * 2.2, ct * 2.2 - a * 0.1) + 0.35 * Gt(ut * 4.6 - a * 0.2, J * 4.6 + 7.3, ct * 4.6), nt = 1 - w + w * pn(0.32, 0.68, rt), Mt = A ? F[Math.min(A - 1, Math.floor($ * A))] : r, lt = 0.35 * r + 0.85 * Mt, mt = Math.exp(-((H - x) ** 2) / 0.01) * M, it = 1 - 0.4 * k * (1 - X), wt = (0.35 + 0.75 * Z * nt + 0.3 * lt + 0.2 * mt) * it * p, Ft = 0.22 + 0.62 * Z * nt + 0.22 * lt + 0.3 * mt;
580
- B.push({
581
- x: E,
582
- y: R,
583
- z: X * f,
584
- r: v * Math.min(1, wt),
585
- white: K(1 - Ft * P),
586
- a: K((1 - 0.75 * k * (1 - Math.sqrt(X))) * P)
600
+ return { ...Gt([], U), light: E };
601
+ }, ts = -0.45, ns = 0.55, ss = 0.7, Qs = Math.hypot(ts, ns, ss), te = (t, n, e, s) => {
602
+ const o = t / 2, c = e.level, [r, l, i] = e.bands, a = e.drive, d = e.processing, h = o * (s.radius ?? 0.72), f = h * (1 + (s.zoom ?? 0.3) * c) * (1 - 0.06 * d), m = s.rMul ?? 1, p = Math.max(4, Math.round(s.cells ?? 17)), M = 2 * h / p, v = M / 2 - Math.max(0.5, M * (s.gap ?? 0.24) / 2), A = Math.ceil(f * 1.25 / M), u = (s.turn ?? 0.12) * n + 0.1 * a + 0.5 * e.spin, g = Math.sin(u), x = Math.cos(u), B = Math.sin(0.35), S = Math.cos(0.35), L = s.shade ?? 0.7, w = s.texture ?? 0.35, k = s.fade ?? 1.3, _ = s.strength ?? 1.38, q = s.deform ?? 1.7, U = 0.012 + (0.09 * r + 0.03 * c) * q, b = (0.035 * l + 0.025 * i) * q, E = (C) => U * (0.55 * Math.sin(2 * C + 0.9 * a) + 0.45 * Math.sin(3 * C - 0.7 * a + 1.3)) + b * Math.sin(7 * C + 2.3 * a) * Math.sin(5 * C - 1.7 * a), y = 0.95 * Math.sin(n * 1.3), I = e.spectrum, R = I.length, G = [];
603
+ for (let C = -A; C <= A; C++)
604
+ for (let F = -A; F <= A; F++) {
605
+ const T = o + F * M, P = o + C * M, N = (T - o) / f, O = -(P - o) / f, z = E(Math.atan2(O, N)), W = Math.hypot(N, O) / (1 + z);
606
+ if (W >= 1) continue;
607
+ const X = 1 / (1 + z), Q = N * X, Z = O * X, V = Math.sqrt(Math.max(0, 1 - Q * Q - Z * Z)), at = j((Q * ts + Z * ns + V * ss) / Qs), nt = 1 - L + L * at, H = Z * S + V * B, st = -Z * B + V * S, $ = Q * x - st * g, ht = Q * g + st * x, ut = 0.65 * zt($ * 2.2 + a * 0.15, H * 2.2, ht * 2.2 - a * 0.1) + 0.35 * zt($ * 4.6 - a * 0.2, H * 4.6 + 7.3, ht * 4.6), tt = 1 - w + w * wn(0.32, 0.68, ut), ft = R ? I[Math.min(R - 1, Math.floor(W * R))] : c, dt = 0.35 * c + 0.85 * ft, Rt = Math.exp(-((Z - y) ** 2) / 0.01) * d, Wt = 1 - 0.4 * k * (1 - V), ct = (0.35 + 0.75 * nt * tt + 0.3 * dt + 0.2 * Rt) * Wt * m, At = 0.22 + 0.62 * nt * tt + 0.22 * dt + 0.3 * Rt;
608
+ G.push({
609
+ x: T,
610
+ y: P,
611
+ z: V * f,
612
+ r: v * Math.min(1, ct),
613
+ white: j(1 - At * _),
614
+ a: j((1 - 0.75 * k * (1 - Math.sqrt(V))) * _)
587
615
  });
588
616
  }
589
- return { ...Ct(B, [], s.rMin ?? 0.4), square: !0 };
590
- }, zs = (t, n, e, s) => {
591
- const o = t / 2, r = t / 2, c = 0.5 * e.level + 0.5 * e.soft, l = (1 + (s.swell ?? 0.49) * c) * (1 - 0.14 * e.processing), i = t / 2 * (s.radius ?? 0.56), a = s.persp ?? 0.25, M = Yt(n * 0.12 + e.drive * 0.03, 0.3, 0, 0, 1), h = Lt(t, s.rsPow ?? 0.9) * (s.rMul ?? 1), f = [], p = s.orbitN ?? 12, d = s.particles ?? 6;
592
- for (let m = 0; m < p; m++) {
593
- const v = xt(m, 1.7), _ = xt(m, 5.2), u = xt(m, 8.9), g = i * (0.45 + 0.52 * v), y = v * ht, N = Math.acos(2 * _ - 1), T = Math.sin(N) * Math.cos(y), z = Math.cos(N), w = Math.sin(N) * Math.sin(y);
594
- let k = -z, P = T;
595
- const D = Math.max(1e-6, Math.sqrt(k * k + P * P));
596
- k /= D, P /= D;
597
- const O = -w * P, b = w * k, S = T * P - z * k, x = (0.25 + 0.55 * u) * (u > 0.5 ? 1 : -1);
598
- for (let F = 0; F < d; F++) {
599
- const A = e.drive * x + F / d * ht + _ * 6, B = Math.cos(A), C = Math.sin(A), [I, E, R] = M((k * B + O * C) * g, (P * B + b * C) * g, S * C * g), q = K((R / i + 1) / 2), L = l / (1 - a * R / i);
617
+ return { ...Gt(G, [], s.rMin ?? 0.4), square: !0 };
618
+ }, ne = (t, n, e, s) => {
619
+ const o = t / 2, c = t / 2, r = 0.5 * e.level + 0.5 * e.soft, l = (1 + (s.swell ?? 0.49) * r) * (1 - 0.14 * e.processing), i = t / 2 * (s.radius ?? 0.56), a = s.persp ?? 0.25, d = nn(n * 0.12 + e.drive * 0.03, 0.3, 0, 0, 1), h = $t(t, s.rsPow ?? 0.9) * (s.rMul ?? 1), f = [], m = s.orbitN ?? 12, p = s.particles ?? 6;
620
+ for (let M = 0; M < m; M++) {
621
+ const v = Tt(M, 1.7), A = Tt(M, 5.2), u = Tt(M, 8.9), g = i * (0.45 + 0.52 * v), x = v * Mt, B = Math.acos(2 * A - 1), S = Math.sin(B) * Math.cos(x), L = Math.cos(B), w = Math.sin(B) * Math.sin(x);
622
+ let k = -L, _ = S;
623
+ const q = Math.max(1e-6, Math.sqrt(k * k + _ * _));
624
+ k /= q, _ /= q;
625
+ const U = -w * _, b = w * k, E = S * _ - L * k, y = (0.25 + 0.55 * u) * (u > 0.5 ? 1 : -1);
626
+ for (let I = 0; I < p; I++) {
627
+ const R = e.drive * y + I / p * Mt + A * 6, G = Math.cos(R), C = Math.sin(R), [F, T, P] = d((k * G + U * C) * g, (_ * G + b * C) * g, E * C * g), N = j((P / i + 1) / 2), O = l / (1 - a * P / i);
600
628
  f.push({
601
- x: o + I * L,
602
- y: r + E * L,
603
- z: R,
604
- r: ((s.partR ?? 0.47) + (s.partRDepth ?? 0.65) * q) * h * L,
605
- white: 0.32 - 0.24 * q
629
+ x: o + F * O,
630
+ y: c + T * O,
631
+ z: P,
632
+ r: ((s.partR ?? 0.47) + (s.partRDepth ?? 0.65) * N) * h * O,
633
+ white: 0.32 - 0.24 * N
606
634
  });
607
635
  }
608
636
  }
609
- return Ct(f, [], s.rMin);
610
- }, Ds = (t, n, e, s) => {
611
- const o = t / 2, r = t / 2, c = e.soft, [l, i] = e.softBands, a = t / 2 * (s.radius ?? 0.66) * (1 + (s.zoom ?? 0.21) * e.level), M = e.drive, h = s.deform ?? 1, f = s.wave ?? 1, p = 0.015 + (0.1 * l + 0.05 * e.level) * h, d = 0.04 * i * h, m = Mn(p, d, M), v = 0.55 + 0.05 * Math.sin(n * 0.37), _ = Math.cos(v), u = Math.sin(v);
637
+ return Gt(f, [], s.rMin);
638
+ }, se = (t, n, e, s) => {
639
+ const o = t / 2, c = t / 2, r = e.soft, [l, i] = e.softBands, a = t / 2 * (s.radius ?? 0.66) * (1 + (s.zoom ?? 0.21) * e.level), d = e.drive, h = s.deform ?? 1, f = s.wave ?? 1, m = 0.015 + (0.1 * l + 0.05 * e.level) * h, p = 0.04 * i * h, M = En(m, p, d), v = 0.55 + 0.05 * Math.sin(n * 0.37), A = Math.cos(v), u = Math.sin(v);
612
640
  let g = 0;
613
- for (let E = 0; E < 48; E++) {
614
- const R = E / 48 * ht;
615
- g += m(Math.cos(R), Math.sin(R) * _, Math.sin(R) * u);
641
+ for (let T = 0; T < 48; T++) {
642
+ const P = T / 48 * Mt;
643
+ g += M(Math.cos(P), Math.sin(P) * A, Math.sin(P) * u);
616
644
  }
617
645
  g /= 48;
618
- const y = (E, R, q) => 1 + m(E, R, q) - g, T = Yt(0, 0.3, o, r, 1), z = Lt(t, s.rsPow ?? 0.6) * (s.rMul ?? 1), w = e.drive, k = [], P = s.ghostN ?? 60;
619
- for (let E = 0; E < P; E++) {
620
- const R = mn(E, P), q = a * y(R[0], R[1], R[2]), [L, U, $] = T(R[0] * q, R[1] * q, R[2] * q), j = ($ / a + 1) / 2;
621
- k.push({ x: L, y: U, z: $, r: 0.65 * z, white: 0.78, a: 0.1 + 0.22 * j });
646
+ const x = (T, P, N) => 1 + M(T, P, N) - g, S = nn(0, 0.3, o, c, 1), L = $t(t, s.rsPow ?? 0.6) * (s.rMul ?? 1), w = e.drive, k = [], _ = s.ghostN ?? 60;
647
+ for (let T = 0; T < _; T++) {
648
+ const P = Sn(T, _), N = a * x(P[0], P[1], P[2]), [O, z, W] = S(P[0] * N, P[1] * N, P[2] * N), X = (W / a + 1) / 2;
649
+ k.push({ x: O, y: z, z: W, r: 0.65 * L, white: 0.78, a: 0.1 + 0.22 * X });
622
650
  }
623
- const D = -u, O = _, b = Math.max(1, Math.round(s.lanes ?? 10)), S = Math.max(8, Math.round(s.segs ?? 56)), x = e.processing, F = (s.laneGap ?? 0.062) * (1 + 0.25 * c) * (1 - 0.4 * x), A = w * 1.6, B = 0.15 * (0.55 + 0.9 * l * f) * (1 - 0.6 * x), C = 0.06 * (0.5 + 1.2 * i * f), I = 0.05 + 0.05 * c;
624
- for (let E = 0; E < b; E++) {
625
- const R = (E - (b - 1) / 2) * F, q = Math.abs(E - (b - 1) / 2) / Math.max(1, (b - 1) / 2);
626
- for (let L = 0; L < S; L++) {
627
- const U = L / S * ht, $ = B * Math.sin(U * 3 - w * 0.95 + E * 0.18) + C * Math.sin(U * 5 + w * 0.6) + I * Math.sin(U * 2 + n * 0.31 + Math.sin(n * 0.17) * 1.5), j = R + $, tt = Math.cos(U), H = Math.sin(U), X = tt, at = H * _ + D * j, Z = H * u + O * j, J = Math.sqrt(X * X + at * at + Z * Z), W = a * y(X / J, at / J, Z / J) / J, [ut, ct, rt] = T(X * W, at * W, Z * W), nt = (rt / a + 1) / 2, Mt = Math.max(0, $) * c, lt = Math.atan2(Math.sin(U - A), Math.cos(U - A)), mt = Math.exp(-(lt * lt) / 0.18) * x;
651
+ const q = -u, U = A, b = Math.max(1, Math.round(s.lanes ?? 10)), E = Math.max(8, Math.round(s.segs ?? 56)), y = e.processing, I = (s.laneGap ?? 0.062) * (1 + 0.25 * r) * (1 - 0.4 * y), R = w * 1.6, G = 0.15 * (0.55 + 0.9 * l * f) * (1 - 0.6 * y), C = 0.06 * (0.5 + 1.2 * i * f), F = 0.05 + 0.05 * r;
652
+ for (let T = 0; T < b; T++) {
653
+ const P = (T - (b - 1) / 2) * I, N = Math.abs(T - (b - 1) / 2) / Math.max(1, (b - 1) / 2);
654
+ for (let O = 0; O < E; O++) {
655
+ const z = O / E * Mt, W = G * Math.sin(z * 3 - w * 0.95 + T * 0.18) + C * Math.sin(z * 5 + w * 0.6) + F * Math.sin(z * 2 + n * 0.31 + Math.sin(n * 0.17) * 1.5), X = P + W, Q = Math.cos(z), Z = Math.sin(z), V = Q, at = Z * A + q * X, nt = Z * u + U * X, H = Math.sqrt(V * V + at * at + nt * nt), st = a * x(V / H, at / H, nt / H) / H, [$, ht, ut] = S(V * st, at * st, nt * st), tt = (ut / a + 1) / 2, ft = Math.max(0, W) * r, dt = Math.atan2(Math.sin(z - R), Math.cos(z - R)), Rt = Math.exp(-(dt * dt) / 0.18) * y;
628
656
  k.push({
629
- x: ut,
630
- y: ct,
631
- z: rt,
632
- r: ((s.rBase ?? 0.49) + (s.rDepth ?? 0.78) * nt) * (1 - 0.25 * q) * (1 + 1.2 * Mt + 0.5 * mt) * z,
633
- white: 0.52 - 0.44 * nt + 0.18 * q - 0.3 * mt,
634
- a: 0.4 + 0.6 * nt
657
+ x: $,
658
+ y: ht,
659
+ z: ut,
660
+ r: ((s.rBase ?? 0.49) + (s.rDepth ?? 0.78) * tt) * (1 - 0.25 * N) * (1 + 1.2 * ft + 0.5 * Rt) * L,
661
+ white: 0.52 - 0.44 * tt + 0.18 * N - 0.3 * Rt,
662
+ a: 0.4 + 0.6 * tt
635
663
  });
636
664
  }
637
665
  }
638
- return Ct(k, [], s.rMin);
639
- }, qs = (t, n, e, s) => {
640
- const o = t / 2, r = e.level, [c, l] = e.softBands, i = e.bands[2], a = e.drive, M = o * (s.radius ?? 0.6) * (1 + (s.zoom ?? 0.06) * e.soft) * (1 - 0.08 * e.processing), h = Yt((s.yaw ?? 0.42) + 0.08 * Math.sin(n * 0.23), s.tilt ?? 0.32, o, o, 1), f = Math.max(0.4, (s.lineW ?? 0.6) * Lt(t, 0.5)), p = (T) => 0.06 + 0.94 * K((T / M + 1) / 2) ** 2, d = s.deform ?? 1, m = 0.02 + (0.14 * c + 0.06 * r) * d, v = 0.01 + (0.07 * l + 0.03 * i) * d, _ = Mn(m, v, a), u = [], g = Math.max(24, Math.round(s.segs ?? 96)), y = Math.max(0, Math.round(s.limbs ?? 2));
641
- for (let T = 0; T < y; T++) {
642
- const z = 0.1 + 0.05 * Math.sin(n * 0.31 + T * 2.1), w = n * 0.17 * (T % 2 ? 1 : -1) + T * 2.4, k = Math.sin(z) * Math.cos(w), P = Math.sin(z) * Math.sin(w), D = Math.cos(z), O = Math.hypot(k, D), b = D / O, S = -k / O, x = P * S, F = D * b - k * S, A = -P * b, B = [], C = [];
643
- for (let I = 0; I < g; I++) {
644
- const E = I / g * ht, R = b * Math.cos(E) + x * Math.sin(E), q = F * Math.sin(E), L = S * Math.cos(E) + A * Math.sin(E), U = M * (1 + 6e-3 * T + _(R, q, L));
645
- B.push(o + R * U, o - q * U), C.push(0.55 + 0.35 * K((L / Math.sin(z) + 1) / 2));
666
+ return Gt(k, [], s.rMin);
667
+ }, ee = (t, n, e, s) => {
668
+ const o = t / 2, c = e.level, [r, l] = e.softBands, i = e.bands[2], a = e.drive, d = o * (s.radius ?? 0.6) * (1 + (s.zoom ?? 0.06) * e.soft) * (1 - 0.08 * e.processing), h = nn((s.yaw ?? 0.42) + 0.08 * Math.sin(n * 0.23), s.tilt ?? 0.32, o, o, 1), f = Math.max(0.4, (s.lineW ?? 0.6) * $t(t, 0.5)), m = (S) => 0.06 + 0.94 * j((S / d + 1) / 2) ** 2, p = s.deform ?? 1, M = 0.02 + (0.14 * r + 0.06 * c) * p, v = 0.01 + (0.07 * l + 0.03 * i) * p, A = En(M, v, a), u = [], g = Math.max(24, Math.round(s.segs ?? 96)), x = Math.max(0, Math.round(s.limbs ?? 2));
669
+ for (let S = 0; S < x; S++) {
670
+ const L = 0.1 + 0.05 * Math.sin(n * 0.31 + S * 2.1), w = n * 0.17 * (S % 2 ? 1 : -1) + S * 2.4, k = Math.sin(L) * Math.cos(w), _ = Math.sin(L) * Math.sin(w), q = Math.cos(L), U = Math.hypot(k, q), b = q / U, E = -k / U, y = _ * E, I = q * b - k * E, R = -_ * b, G = [], C = [];
671
+ for (let F = 0; F < g; F++) {
672
+ const T = F / g * Mt, P = b * Math.cos(T) + y * Math.sin(T), N = I * Math.sin(T), O = E * Math.cos(T) + R * Math.sin(T), z = d * (1 + 6e-3 * S + A(P, N, O));
673
+ G.push(o + P * z, o - N * z), C.push(0.55 + 0.35 * j((O / Math.sin(L) + 1) / 2));
646
674
  }
647
- u.push({ pts: B, a: C, white: 0, w: f, closed: !0 });
675
+ u.push({ pts: G, a: C, white: 0, w: f, closed: !0 });
648
676
  }
649
- const N = Math.max(2, Math.round(s.circles ?? 8));
650
- for (let T = 0; T < N; T++) {
651
- const [z, w, k] = mn(T, N), P = a * 0.16 * (0.5 + xt(T, 2.1)) * (T % 2 ? 1 : -1) + xt(T, 6.6) * ht, D = w * Math.cos(P) - k * Math.sin(P), O = w * Math.sin(P) + k * Math.cos(P), b = Math.max(1e-6, Math.hypot(O, z)), S = O / b, x = -z / b, F = D * x, A = O * S - z * x, B = -D * S, C = [], I = [];
652
- for (let E = 0; E < g; E++) {
653
- const R = E / g * ht, q = S * Math.cos(R) + F * Math.sin(R), L = A * Math.sin(R), U = x * Math.cos(R) + B * Math.sin(R), $ = M * (1 + _(q, L, U)), [j, tt, H] = h(q * $, L * $, U * $);
654
- C.push(j, tt), I.push(p(H));
677
+ const B = Math.max(2, Math.round(s.circles ?? 8));
678
+ for (let S = 0; S < B; S++) {
679
+ const [L, w, k] = Sn(S, B), _ = a * 0.16 * (0.5 + Tt(S, 2.1)) * (S % 2 ? 1 : -1) + Tt(S, 6.6) * Mt, q = w * Math.cos(_) - k * Math.sin(_), U = w * Math.sin(_) + k * Math.cos(_), b = Math.max(1e-6, Math.hypot(U, L)), E = U / b, y = -L / b, I = q * y, R = U * E - L * y, G = -q * E, C = [], F = [];
680
+ for (let T = 0; T < g; T++) {
681
+ const P = T / g * Mt, N = E * Math.cos(P) + I * Math.sin(P), O = R * Math.sin(P), z = y * Math.cos(P) + G * Math.sin(P), W = d * (1 + A(N, O, z)), [X, Q, Z] = h(N * W, O * W, z * W);
682
+ C.push(X, Q), F.push(m(Z));
655
683
  }
656
- u.push({ pts: C, a: I, white: 0, w: f, closed: !0 });
684
+ u.push({ pts: C, a: F, white: 0, w: f, closed: !0 });
657
685
  }
658
- return Ct([], u, s.rMin);
659
- }, Gs = (t, n, e, s) => {
660
- const o = t / 2, r = e.level, [c, l, i] = e.bands, a = e.drive, M = e.processing, h = o * (s.radius ?? 0.6) * (1 + (s.zoom ?? 0.1) * r) * (1 - 0.08 * M), f = 0.95 * Math.sin(n * 1.3), p = Yt(n * 0.14, 0.32, o, o, 1), d = Lt(t, s.rsPow ?? 0.6) * (s.rMul ?? 1), m = Math.max(40, Math.round(s.dotN ?? 900)), v = s.cloudFreq ?? 2.3, _ = s.deform ?? 1, u = 0.018 + (0.12 * c + 0.04 * r) * _, g = (0.045 * l + 0.03 * i) * _, y = [], N = [];
661
- let T = 0;
662
- for (let w = 0; w < m; w++) {
663
- const k = mn(w, m), [P, D, O] = k, b = 0.55 * Math.sin(2.1 * P + 1.3 * D + 0.9 * a) + 0.45 * Math.sin(1.7 * O - 1.9 * D - 0.7 * a + 1.3), S = Math.sin(5.3 * P - 4.1 * O + 2.3 * a) * Math.sin(4.7 * D + 3.1 * P - 1.7 * a), x = u * b + g * S;
664
- y.push(k), N.push(x), T += x / m;
686
+ return Gt([], u, s.rMin);
687
+ }, oe = (t, n, e, s) => {
688
+ const o = t / 2, c = e.level, [r, l, i] = e.bands, a = e.drive, d = e.processing, h = o * (s.radius ?? 0.6) * (1 + (s.zoom ?? 0.1) * c) * (1 - 0.08 * d), f = 0.95 * Math.sin(n * 1.3), m = nn(n * 0.14, 0.32, o, o, 1), p = $t(t, s.rsPow ?? 0.6) * (s.rMul ?? 1), M = Math.max(40, Math.round(s.dotN ?? 900)), v = s.cloudFreq ?? 2.3, A = s.deform ?? 1, u = 0.018 + (0.12 * r + 0.04 * c) * A, g = (0.045 * l + 0.03 * i) * A, x = [], B = [];
689
+ let S = 0;
690
+ for (let w = 0; w < M; w++) {
691
+ const k = Sn(w, M), [_, q, U] = k, b = 0.55 * Math.sin(2.1 * _ + 1.3 * q + 0.9 * a) + 0.45 * Math.sin(1.7 * U - 1.9 * q - 0.7 * a + 1.3), E = Math.sin(5.3 * _ - 4.1 * U + 2.3 * a) * Math.sin(4.7 * q + 3.1 * _ - 1.7 * a), y = u * b + g * E;
692
+ x.push(k), B.push(y), S += y / M;
665
693
  }
666
- const z = [];
667
- for (let w = 0; w < m; w++) {
668
- const [k, P, D] = y[w], O = N[w] - T, b = h * (1 + O), [S, x, F] = p(k * b, P * b, D * b), A = K((F / h + 1) / 2), B = 0.65 * Gt(k * v + a * 0.21, P * v - a * 0.15, D * v + a * 0.1) + 0.35 * Gt(k * v * 2.1 - a * 0.29, P * v * 2.1 + 7.3, D * v * 2.1 + a * 0.24), C = pn(0.34, 0.68, B), I = Math.exp(-((P - f) ** 2) / 0.012) * M, E = Math.max(0, O) / 0.16;
669
- z.push({
670
- x: S,
671
- y: x,
672
- z: F,
673
- r: ((s.rBase ?? 0.27) + (s.rDepth ?? 0.84) * A) * (0.22 + 0.95 * C + 0.6 * I) * (1 + 0.5 * E) * d,
674
- white: 0.62 - 0.52 * A - 0.16 * C - 0.3 * I,
675
- a: 0.3 + 0.7 * A
694
+ const L = [];
695
+ for (let w = 0; w < M; w++) {
696
+ const [k, _, q] = x[w], U = B[w] - S, b = h * (1 + U), [E, y, I] = m(k * b, _ * b, q * b), R = j((I / h + 1) / 2), G = 0.65 * zt(k * v + a * 0.21, _ * v - a * 0.15, q * v + a * 0.1) + 0.35 * zt(k * v * 2.1 - a * 0.29, _ * v * 2.1 + 7.3, q * v * 2.1 + a * 0.24), C = wn(0.34, 0.68, G), F = Math.exp(-((_ - f) ** 2) / 0.012) * d, T = Math.max(0, U) / 0.16;
697
+ L.push({
698
+ x: E,
699
+ y,
700
+ z: I,
701
+ r: ((s.rBase ?? 0.27) + (s.rDepth ?? 0.84) * R) * (0.22 + 0.95 * C + 0.6 * F) * (1 + 0.5 * T) * p,
702
+ white: 0.62 - 0.52 * R - 0.16 * C - 0.3 * F,
703
+ a: 0.3 + 0.7 * R
676
704
  });
677
705
  }
678
- return Ct(z, [], s.rMin ?? 0.25);
679
- }, re = ["orbit", "sash", "signal", "swell", "pixel", "aura"], Ls = {
680
- orbit: zs,
681
- sash: Ds,
682
- signal: qs,
683
- swell: Gs,
684
- pixel: Bs,
685
- aura: Is
706
+ return Gt(L, [], s.rMin ?? 0.25);
707
+ }, Ae = ["orbit", "sash", "signal", "swell", "pixel", "aura"], ae = {
708
+ orbit: ne,
709
+ sash: se,
710
+ signal: ee,
711
+ swell: oe,
712
+ pixel: te,
713
+ aura: Js
686
714
  }, ot = {
687
715
  orbit: {
688
716
  speed: 1.05,
@@ -729,15 +757,15 @@ const Fs = [
729
757
  counts: { segs: 0.5 }
730
758
  }
731
759
  };
732
- function Os(t, n, e = 1, s = 1) {
733
- const o = t in ot ? t : "orbit", r = ot[o], c = Math.min(1.4, Math.max(0.2, n / 200)) * Math.max(0.1, e), l = { ...r.opts };
734
- for (const [i, a] of Object.entries(r.counts)) {
735
- const M = l[i];
736
- M != null && (l[i] = Math.max(1, Math.round(M * c ** a)));
760
+ function ce(t, n, e = 1, s = 1) {
761
+ const o = t in ot ? t : "orbit", c = ot[o], r = Math.min(1.4, Math.max(0.2, n / 200)) * Math.max(0.1, e), l = { ...c.opts };
762
+ for (const [i, a] of Object.entries(c.counts)) {
763
+ const d = l[i];
764
+ d != null && (l[i] = Math.max(1, Math.round(d * r ** a)));
737
765
  }
738
- return s !== 1 && (l.rMul = Math.max(0.1, s)), { frame: Ls[o], speed: r.speed, driveGain: r.driveGain, gain: r.gain ?? 1, opts: l };
766
+ return s !== 1 && (l.rMul = Math.max(0.1, s)), { frame: ae[o], speed: c.speed, driveGain: c.driveGain, gain: c.gain ?? 1, opts: l };
739
767
  }
740
- function Us(t) {
768
+ function re(t) {
741
769
  let n = t;
742
770
  for (; n; ) {
743
771
  const e = n.getAttribute("data-theme");
@@ -749,12 +777,12 @@ function Us(t) {
749
777
  }
750
778
  return null;
751
779
  }
752
- function $s() {
780
+ function ie() {
753
781
  return typeof matchMedia > "u" || matchMedia("(prefers-color-scheme: dark)").matches;
754
782
  }
755
- function Ws(t, n) {
756
- const [e, s] = _t(!0);
757
- return kt(() => {
783
+ function le(t, n) {
784
+ const [e, s] = Bt(!0);
785
+ return It(() => {
758
786
  if (t === "dark") {
759
787
  s(!0);
760
788
  return;
@@ -764,25 +792,25 @@ function Ws(t, n) {
764
792
  return;
765
793
  }
766
794
  const o = () => {
767
- const i = Us(n.current);
768
- s(i ?? $s());
795
+ const i = re(n.current);
796
+ s(i ?? ie());
769
797
  };
770
798
  o();
771
- const r = typeof matchMedia < "u" ? matchMedia("(prefers-color-scheme: dark)") : null, c = () => o();
772
- r == null || r.addEventListener("change", c);
799
+ const c = typeof matchMedia < "u" ? matchMedia("(prefers-color-scheme: dark)") : null, r = () => o();
800
+ c == null || c.addEventListener("change", r);
773
801
  let l = null;
774
802
  return typeof MutationObserver < "u" && n.current && (l = new MutationObserver(o), l.observe(document.documentElement, {
775
803
  attributes: !0,
776
804
  attributeFilter: ["class", "data-theme"],
777
805
  subtree: !0
778
806
  })), () => {
779
- r == null || r.removeEventListener("change", c), l == null || l.disconnect();
807
+ c == null || c.removeEventListener("change", r), l == null || l.disconnect();
780
808
  };
781
809
  }, [t, n]), e;
782
810
  }
783
- function Xs() {
784
- const [t, n] = _t(!1);
785
- return kt(() => {
811
+ function he() {
812
+ const [t, n] = Bt(!1);
813
+ return It(() => {
786
814
  if (typeof matchMedia > "u") return;
787
815
  const e = matchMedia("(prefers-reduced-motion: reduce)");
788
816
  n(e.matches);
@@ -790,26 +818,26 @@ function Xs() {
790
818
  return e.addEventListener("change", s), () => e.removeEventListener("change", s);
791
819
  }, []), t;
792
820
  }
793
- const pt = 16, Vs = 2.1, Ks = 0.3, Hs = 2.5, Ys = 1.6, js = 5, Cn = 2.2, Fn = [
821
+ const vt = 16, ue = 2.1, fe = 0.3, de = 2.5, pe = 1.6, me = 5, $n = 2.2, Wn = [
794
822
  [80, 300],
795
823
  [300, 2e3],
796
824
  [2e3, 6e3]
797
- ], rn = 90, Zs = 7e3, ln = Math.PI * 2, hn = 0.35, un = 0.9;
798
- function Wn(t) {
825
+ ], Mn = 90, Me = 7e3, gn = Math.PI * 2, bn = 0.35, vn = 0.9;
826
+ function es(t) {
799
827
  return t < 0 ? 0 : t > 1 ? 1 : t;
800
828
  }
801
- function fn(t, n) {
829
+ function xn(t, n) {
802
830
  if (t <= n) return 0;
803
831
  const e = (t - n) / Math.max(1e-3, 1 - n);
804
- return Wn((1 - Math.exp(-3 * e)) / (1 - Math.exp(-3)));
832
+ return es((1 - Math.exp(-3 * e)) / (1 - Math.exp(-3)));
805
833
  }
806
- function At(t, n, e, s, o) {
807
- const r = n > t ? s : o;
808
- return t + (n - t) * (1 - Math.exp(-e / Math.max(1e-3, r)));
834
+ function Ft(t, n, e, s, o) {
835
+ const c = n > t ? s : o;
836
+ return t + (n - t) * (1 - Math.exp(-e / Math.max(1e-3, c)));
809
837
  }
810
- class Js {
838
+ class ge {
811
839
  constructor() {
812
- this.clock = 0, this.t = 0, this.drive = 0, this.level = 0, this.bands = [0, 0, 0], this.spectrum = new Float32Array(pt), this.floor = new Float32Array(pt + 3).fill(1), this.heard = 0, this.proc = 0, this.spin = 0, this.pan = 0, this.panVel = 0, this.raw = { level: 0, bands: [0, 0, 0], spectrum: new Float32Array(pt) }, this.timeBuf = null, this.freqBuf = null, this.out = {
840
+ this.clock = 0, this.t = 0, this.drive = 0, this.level = 0, this.bands = [0, 0, 0], this.spectrum = new Float32Array(vt), this.floor = new Float32Array(vt + 3).fill(1), this.heard = 0, this.proc = 0, this.spin = 0, this.pan = 0, this.panVel = 0, this.raw = { level: 0, bands: [0, 0, 0], spectrum: new Float32Array(vt) }, this.timeBuf = null, this.freqBuf = null, this.out = {
813
841
  level: 0,
814
842
  bands: [0, 0, 0],
815
843
  soft: 0,
@@ -824,26 +852,26 @@ class Js {
824
852
  /** Read an analyser: RMS loudness, three voice bands and the spectrum. */
825
853
  readAnalyser(n, e, s) {
826
854
  (!this.timeBuf || this.timeBuf.length !== n.fftSize) && (this.timeBuf = new Float32Array(n.fftSize)), (!this.freqBuf || this.freqBuf.length !== n.frequencyBinCount) && (this.freqBuf = new Uint8Array(n.frequencyBinCount));
827
- const o = this.timeBuf, r = this.freqBuf;
855
+ const o = this.timeBuf, c = this.freqBuf;
828
856
  n.getFloatTimeDomainData(o);
829
- let c = 0;
830
- for (let h = 0; h < o.length; h++) c += o[h] * o[h];
831
- this.raw.level = Math.sqrt(c / o.length) * js * e, n.getByteFrequencyData(r);
857
+ let r = 0;
858
+ for (let h = 0; h < o.length; h++) r += o[h] * o[h];
859
+ this.raw.level = Math.sqrt(r / o.length) * me * e, n.getByteFrequencyData(c);
832
860
  const l = n.context.sampleRate / n.fftSize, i = (h, f) => {
833
- const p = Math.max(0, Math.floor(h / l)), d = Math.max(p, Math.min(r.length - 1, Math.ceil(f / l)));
834
- let m = 0;
835
- for (let v = p; v <= d; v++) m += r[v];
836
- return m / (d - p + 1) / 255;
861
+ const m = Math.max(0, Math.floor(h / l)), p = Math.max(m, Math.min(c.length - 1, Math.ceil(f / l)));
862
+ let M = 0;
863
+ for (let v = m; v <= p; v++) M += c[v];
864
+ return M / (p - m + 1) / 255;
837
865
  }, a = (h, f) => {
838
- const p = this.floor[h];
839
- return this.floor[h] = f < p ? f : p + (f - p) * (1 - Math.exp(-s / 8)), Math.max(0, f - this.floor[h]) / Math.max(0.05, 1 - this.floor[h]);
866
+ const m = this.floor[h];
867
+ return this.floor[h] = f < m ? f : m + (f - m) * (1 - Math.exp(-s / 8)), Math.max(0, f - this.floor[h]) / Math.max(0.05, 1 - this.floor[h]);
840
868
  };
841
869
  for (let h = 0; h < 3; h++)
842
- this.raw.bands[h] = a(h, i(Fn[h][0], Fn[h][1])) * Cn * e;
843
- const M = Zs / rn;
844
- for (let h = 0; h < pt; h++) {
845
- const f = rn * M ** (h / pt), p = rn * M ** ((h + 1) / pt);
846
- this.raw.spectrum[h] = a(3 + h, i(f, p)) * Cn * e;
870
+ this.raw.bands[h] = a(h, i(Wn[h][0], Wn[h][1])) * $n * e;
871
+ const d = Me / Mn;
872
+ for (let h = 0; h < vt; h++) {
873
+ const f = Mn * d ** (h / vt), m = Mn * d ** ((h + 1) / vt);
874
+ this.raw.spectrum[h] = a(3 + h, i(f, m)) * $n * e;
847
875
  }
848
876
  }
849
877
  /**
@@ -853,11 +881,11 @@ class Js {
853
881
  * spectrum — so a level-driven orb still moves like a voice.
854
882
  */
855
883
  readLevel(n, e) {
856
- const s = Wn(n) * e, o = this.clock;
884
+ const s = es(n) * e, o = this.clock;
857
885
  this.raw.level = s, this.raw.bands[0] = s, this.raw.bands[1] = s * (0.72 + 0.28 * Math.sin(o * 2.3)), this.raw.bands[2] = s * (0.6 + 0.4 * Math.sin(o * 3.7 + 2));
858
- const r = 0.28 + 0.1 * Math.sin(o * 2.3) + 0.05 * Math.sin(o * 5.1), c = 0.64 + 0.1 * Math.sin(o * 1.7 + 1);
859
- for (let l = 0; l < pt; l++) {
860
- const i = l / (pt - 1), a = Math.exp(-((i - r) ** 2) / 0.012) + 0.6 * Math.exp(-((i - c) ** 2) / 8e-3);
886
+ const c = 0.28 + 0.1 * Math.sin(o * 2.3) + 0.05 * Math.sin(o * 5.1), r = 0.64 + 0.1 * Math.sin(o * 1.7 + 1);
887
+ for (let l = 0; l < vt; l++) {
888
+ const i = l / (vt - 1), a = Math.exp(-((i - c) ** 2) / 0.012) + 0.6 * Math.exp(-((i - r) ** 2) / 8e-3);
861
889
  this.raw.spectrum[l] = s * (0.25 + 0.75 * a) * (1 - 0.4 * i);
862
890
  }
863
891
  }
@@ -867,320 +895,345 @@ class Js {
867
895
  }
868
896
  /** Advance by `dt` real seconds. `still` (reduced motion) holds the clocks. */
869
897
  step(n, e, s) {
870
- const { threshold: o, attack: r, release: c, rate: l } = e, i = this.proc = At(this.proc, e.processing ? 1 : 0, n, 0.35, 0.5), a = e.calm + (1 - e.calm) * Math.min(1, Math.max(this.heard * 2.5, i));
898
+ const { threshold: o, attack: c, release: r, rate: l } = e, i = this.proc = Ft(this.proc, e.processing ? 1 : 0, n, 0.35, 0.5), a = e.calm + (1 - e.calm) * Math.min(1, Math.max(this.heard * 2.5, i));
871
899
  s || (this.clock += n, this.t += n * l * a * (1 + 0.5 * i));
872
- const M = fn(this.raw.level, o);
873
- this.level = At(this.level, M, n, r, c), this.heard = At(this.heard, this.level, n, hn, un);
900
+ const d = xn(this.raw.level, o);
901
+ this.level = Ft(this.level, d, n, c, r), this.heard = Ft(this.heard, this.level, n, bn, vn);
874
902
  for (let u = 0; u < 3; u++)
875
- this.bands[u] = At(this.bands[u], fn(this.raw.bands[u], o * 0.6), n, r, c * 1.15);
876
- for (let u = 0; u < pt; u++)
877
- this.spectrum[u] = At(this.spectrum[u], fn(this.raw.spectrum[u], o * 0.6), n, r, c);
878
- const h = this.clock, f = s ? 0.5 : 0.5 + 0.5 * Math.sin(ln * h / 6), p = e.idle * f * (1 - i), d = this.out;
879
- d.level = this.level + (1 - this.level) * p;
880
- for (let u = 0; u < 3; u++) d.bands[u] = this.bands[u] + (1 - this.bands[u]) * p * 0.6;
881
- d.soft = At(d.soft, d.level, n, hn, un);
882
- for (let u = 0; u < 3; u++) d.softBands[u] = At(d.softBands[u], d.bands[u], n, hn, un);
883
- if (s || (this.drive += n * l * (a + e.driveGain * this.level + 1.3 * i)), d.drive = this.drive, d.processing = i, !s) {
884
- const u = Math.ceil(this.spin / ln - 1e-6) * ln, g = Math.min(Ks, (u - this.spin) * 0.6);
885
- this.spin += n * (Vs * l * i + g * (1 - i));
903
+ this.bands[u] = Ft(this.bands[u], xn(this.raw.bands[u], o * 0.6), n, c, r * 1.15);
904
+ for (let u = 0; u < vt; u++)
905
+ this.spectrum[u] = Ft(this.spectrum[u], xn(this.raw.spectrum[u], o * 0.6), n, c, r);
906
+ const h = this.clock, f = s ? 0.5 : 0.5 + 0.5 * Math.sin(gn * h / 6), m = e.idle * f * (1 - i), p = this.out;
907
+ p.level = this.level + (1 - this.level) * m;
908
+ for (let u = 0; u < 3; u++) p.bands[u] = this.bands[u] + (1 - this.bands[u]) * m * 0.6;
909
+ p.soft = Ft(p.soft, p.level, n, bn, vn);
910
+ for (let u = 0; u < 3; u++) p.softBands[u] = Ft(p.softBands[u], p.bands[u], n, bn, vn);
911
+ if (s || (this.drive += n * l * (a + e.driveGain * this.level + 1.3 * i)), p.drive = this.drive, p.processing = i, !s) {
912
+ const u = Math.ceil(this.spin / gn - 1e-6) * gn, g = Math.min(fe, (u - this.spin) * 0.6);
913
+ this.spin += n * (ue * l * i + g * (1 - i));
886
914
  }
887
- d.spin = this.spin;
888
- const m = Math.max(-1, Math.min(1, e.direction || 0)), v = this.heard > 0.06 && !e.processing ? m : 0, _ = Math.abs(v) > Math.abs(this.pan) ? Hs : Ys;
889
- return this.panVel += (_ * _ * (v - this.pan) - 2 * _ * this.panVel) * n, this.pan += this.panVel * n, d.pan = this.pan, d;
915
+ p.spin = this.spin;
916
+ const M = Math.max(-1, Math.min(1, e.direction || 0)), v = this.heard > 0.06 && !e.processing ? M : 0, A = Math.abs(v) > Math.abs(this.pan) ? de : pe;
917
+ return this.panVel += (A * A * (v - this.pan) - 2 * A * this.panVel) * n, this.pan += this.panVel * n, p.pan = this.pan, p;
890
918
  }
891
919
  }
892
- function Qs(t) {
920
+ function be(t) {
893
921
  if (!t) return;
894
922
  const n = t.trim().match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);
895
923
  if (n) {
896
924
  let s = n[1];
897
- s.length === 3 && (s = s.replace(/./g, (r) => r + r));
925
+ s.length === 3 && (s = s.replace(/./g, (c) => c + c));
898
926
  const o = parseInt(s, 16);
899
927
  return { r: o >> 16 & 255, g: o >> 8 & 255, b: o & 255 };
900
928
  }
901
929
  const e = t.trim().match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);
902
930
  if (e) return { r: Number(e[1]), g: Number(e[2]), b: Number(e[3]) };
903
931
  }
904
- const te = {
932
+ const ve = {
905
933
  idle: "Waiting",
906
934
  listening: "Listening",
907
935
  speaking: "Speaking",
908
936
  processing: "Thinking"
909
- }, ne = 1e3 / 62;
910
- function se({
937
+ }, xe = 0.55, ye = 1e3 / 62;
938
+ function we({
911
939
  type: t = "orbit",
912
940
  state: n = "listening",
913
941
  size: e = 160,
914
942
  stream: s,
915
943
  analyser: o,
916
- level: r,
917
- sensitivity: c = 0.85,
944
+ level: c,
945
+ sensitivity: r = 0.85,
918
946
  threshold: l = 0.04,
919
947
  attack: i,
920
948
  release: a = 0.32,
921
- idle: M = 0.1,
949
+ idle: d = 0.1,
922
950
  calm: h = 0.4,
923
951
  voiceSpeed: f,
924
- emotion: p = null,
925
- emotionColors: d,
926
- saturation: m = 2,
952
+ emotion: m = null,
953
+ emotionColors: p,
954
+ saturation: M = 2,
927
955
  accent: v = null,
928
- gradientAngle: _ = 99,
956
+ gradientAngle: A = 99,
929
957
  gradientSpin: u = 12,
930
958
  neutral: g = 1,
931
- colorBrightness: y = 1.02,
932
- colorHue: N = 0,
933
- gradientStart: T = 0.1,
934
- gradientWidth: z = 0.6,
959
+ colorBrightness: x = 1.02,
960
+ colorHue: B = 0,
961
+ gradientStart: S = 0.1,
962
+ gradientWidth: L = 0.6,
935
963
  direction: w,
936
964
  directionMove: k,
937
- directionPull: P,
938
- directionDeform: D,
939
- directionSquash: O,
965
+ directionPull: _,
966
+ directionDeform: q,
967
+ directionSquash: U,
940
968
  directionLens: b,
941
- directionStretch: S,
942
- directionSplit: x,
943
- directionBlur: F,
944
- directionBounce: A,
945
- directionMargin: B,
969
+ directionStretch: E,
970
+ directionSplit: y,
971
+ directionBlur: I,
972
+ directionBounce: R,
973
+ directionMargin: G,
946
974
  directionBounds: C,
947
- theme: I = "auto",
948
- speed: E = 1,
949
- paused: R = !1,
950
- color: q,
951
- dots: L = 1,
952
- dotSize: U,
953
- opts: $,
954
- frame: j,
955
- onLevel: tt,
956
- style: H,
957
- "aria-label": X,
958
- ...at
975
+ hoverBend: F = !1,
976
+ theme: T = "auto",
977
+ speed: P = 1,
978
+ paused: N = !1,
979
+ color: O,
980
+ dots: z = 1,
981
+ dotSize: W,
982
+ opts: X,
983
+ frame: Q,
984
+ onLevel: Z,
985
+ style: V,
986
+ "aria-label": at,
987
+ ...nt
959
988
  }) {
960
- const Z = Rt(null), J = Ws(I, Z), W = Xs(), ut = $ ? JSON.stringify($) : "", ct = !!(s || o || r != null || n === "processing"), rt = Rt(null);
961
- rt.current || (rt.current = new Js());
962
- const nt = Rt(null);
963
- nt.current || (nt.current = new as());
964
- const Mt = p ? (d == null ? void 0 : d[p]) ?? Ht[p] : null, lt = {
965
- saturation: Math.min(1, m),
966
- vivid: Math.max(0, Math.min(1, m - 1)),
967
- brightness: y,
968
- hue: N,
969
- start: T,
970
- width: z,
971
- accent: v ? ns[v] : null,
972
- angle: _,
989
+ const H = St(null), st = le(T, H), $ = he(), ht = X ? JSON.stringify(X) : "", ut = !!(s || o || c != null || n === "processing"), tt = St(null);
990
+ tt.current || (tt.current = new ge());
991
+ const ft = St(null);
992
+ ft.current || (ft.current = new vs());
993
+ const dt = m ? (p == null ? void 0 : p[m]) ?? tn[m] : null, Rt = {
994
+ saturation: Math.min(1, M),
995
+ vivid: Math.max(0, Math.min(1, M - 1)),
996
+ brightness: x,
997
+ hue: B,
998
+ start: S,
999
+ width: L,
1000
+ accent: v ? ms[v] : null,
1001
+ angle: A,
973
1002
  spin: u,
974
1003
  neutral: g,
975
1004
  size: e
976
- }, mt = U ?? ot[t in ot ? t : "orbit"].dotSize ?? 1, it = ot[t in ot ? t : "orbit"].lean ?? {}, wt = B ?? ot[t in ot ? t : "orbit"].margin ?? 32, Ft = {
1005
+ }, Wt = W ?? ot[t in ot ? t : "orbit"].dotSize ?? 1, ct = ot[t in ot ? t : "orbit"].lean ?? {}, At = G ?? ot[t in ot ? t : "orbit"].margin ?? 32, Xt = {
977
1006
  state: n,
978
- level: r,
1007
+ level: c,
979
1008
  analyser: o,
980
- sensitivity: c,
1009
+ sensitivity: r,
981
1010
  threshold: l,
982
1011
  attack: i ?? ot[t in ot ? t : "orbit"].attack ?? 0.06,
983
1012
  release: a,
984
- idle: M,
1013
+ idle: d,
985
1014
  calm: h,
986
1015
  voiceSpeed: f ?? ot[t in ot ? t : "orbit"].voiceSpeed ?? 1,
987
- onLevel: tt,
988
- emotionTint: Mt,
989
- colors: lt,
1016
+ onLevel: Z,
1017
+ emotionTint: dt,
1018
+ colors: Rt,
990
1019
  direction: w,
991
1020
  bounds: C,
1021
+ bend: F === !0 ? xe : typeof F == "number" ? Math.max(0, Math.min(1, F)) : 0,
992
1022
  // each amount: the prop, else the type's own, else the shared default
993
1023
  lean: {
994
- move: k ?? it.move ?? dt.move,
995
- pull: P ?? it.pull ?? dt.pull,
996
- deform: D ?? it.deform ?? dt.deform,
997
- squash: O ?? it.squash ?? dt.squash,
998
- lens: b ?? it.lens ?? dt.lens,
999
- stretch: S ?? it.stretch ?? dt.stretch,
1000
- split: x ?? it.split ?? dt.split,
1001
- blur: F ?? it.blur ?? dt.blur,
1002
- bounce: A ?? it.bounce ?? dt.bounce
1024
+ move: k ?? ct.move ?? bt.move,
1025
+ pull: _ ?? ct.pull ?? bt.pull,
1026
+ deform: q ?? ct.deform ?? bt.deform,
1027
+ squash: U ?? ct.squash ?? bt.squash,
1028
+ lens: b ?? ct.lens ?? bt.lens,
1029
+ stretch: E ?? ct.stretch ?? bt.stretch,
1030
+ split: y ?? ct.split ?? bt.split,
1031
+ blur: I ?? ct.blur ?? bt.blur,
1032
+ bounce: R ?? ct.bounce ?? bt.bounce
1003
1033
  }
1004
- }, It = Rt(Ft);
1005
- It.current = Ft;
1006
- const Pt = w == null ? 0 : cs(Ft.lean, e), [gn, Xn] = _t([1 / 0, 1 / 0]), jt = Math.min(Pt, gn[0]), Zt = Math.min(Pt, gn[1]), gt = Pt ? jt + wt : 0, Nt = Pt ? Zt + wt : 0, Jt = Rt(null);
1007
- return kt(() => {
1034
+ }, xt = St(Xt);
1035
+ xt.current = Xt;
1036
+ const Nt = w == null ? 0 : ws(Xt.lean, e), [Tn, os] = Bt([1 / 0, 1 / 0]), sn = Math.min(Nt, Tn[0]), en = Math.min(Nt, Tn[1]), rt = Nt ? sn + At : 0, _t = Nt ? en + At : 0, Vt = St({ x: 0, y: 0, over: !1 }), Rn = Xt.bend > 0 && !$;
1037
+ It(() => {
1038
+ const K = H.current;
1039
+ if (!Rn || !K || typeof matchMedia != "function" || !matchMedia("(hover: hover) and (pointer: fine)").matches) return;
1040
+ const yt = (it) => {
1041
+ if (it.pointerType === "touch") return;
1042
+ const Dt = K.getBoundingClientRect(), Ht = (e + rt + _t) / (Dt.width || 1);
1043
+ Vt.current = { x: (it.clientX - Dt.left) * Ht - rt, y: (it.clientY - Dt.top) * Ht, over: !0 };
1044
+ }, Pt = () => {
1045
+ Vt.current.over = !1;
1046
+ };
1047
+ return window.addEventListener("pointermove", yt, { passive: !0 }), document.documentElement.addEventListener("pointerleave", Pt), () => {
1048
+ window.removeEventListener("pointermove", yt), document.documentElement.removeEventListener("pointerleave", Pt), Vt.current.over = !1;
1049
+ };
1050
+ }, [Rn, e, rt, _t]);
1051
+ const on = St(null);
1052
+ return It(() => {
1008
1053
  if (!s) return;
1009
- const st = ts(s);
1010
- return Jt.current = (st == null ? void 0 : st.analyser) ?? null, () => {
1011
- Jt.current = null, st == null || st.release();
1054
+ const K = ps(s);
1055
+ return on.current = (K == null ? void 0 : K.analyser) ?? null, () => {
1056
+ on.current = null, K == null || K.release();
1012
1057
  };
1013
- }, [s]), kt(() => {
1014
- const st = Z.current;
1015
- if (!st) return;
1016
- const Bt = Math.min(2, typeof devicePixelRatio < "u" && devicePixelRatio || 1);
1017
- st.width = Math.round((e + gt + Nt) * Bt), st.height = Math.round(e * Bt);
1018
- const Ot = st.getContext("2d");
1019
- if (!Ot) return;
1020
- const St = Os(t, e, L, mt), Vn = $ ? { ...St.opts, ...$ } : St.opts, Kn = j ?? St.frame, Hn = Qs(q), bt = rt.current, Yn = nt.current, jn = new rs();
1021
- let bn = 0;
1022
- const Zn = (Y, V, G) => {
1023
- var Tn;
1024
- Ot.setTransform(Bt, 0, 0, Bt, gt * Bt, 0), Ot.clearRect(-gt, 0, e + gt + Nt, e);
1025
- const zt = R || W ? 0 : jn.step(bn, G), vt = is(Kn(e, bt.t, Y, Vn), Y.pan, e, It.current.lean, [jt, Zt], zt);
1026
- bn = ((Tn = vt.contact) == null ? void 0 : Tn.press) ?? 0;
1027
- const et = It.current.colors, ft = V.amount, Q = et.accent, Dt = Q ? { r: Q.r + (V.r - Q.r) * ft, g: Q.g + (V.g - Q.g) * ft, b: Q.b + (V.b - Q.b) * ft } : { r: V.r, g: V.g, b: V.b }, Qn = {
1028
- ...et,
1029
- accent: Dt,
1030
- saturation: et.saturation * (Q ? 1 : ft),
1031
- angle: et.angle + et.spin * bt.clock
1058
+ }, [s]), It(() => {
1059
+ const K = H.current;
1060
+ if (!K) return;
1061
+ const yt = Math.min(2, typeof devicePixelRatio < "u" && devicePixelRatio || 1);
1062
+ K.width = Math.round((e + rt + _t) * yt), K.height = Math.round(e * yt);
1063
+ const Pt = K.getContext("2d");
1064
+ if (!Pt) return;
1065
+ const it = ce(t, e, z, Wt), Dt = X ? { ...it.opts, ...X } : it.opts, Ht = Q ?? it.frame, as = be(O), wt = tt.current, cs = ft.current, rs = new Es();
1066
+ let An = 0, Lt = 0, an = e / 2, cn = e / 2;
1067
+ const is = (J, Y, D) => {
1068
+ var In;
1069
+ Pt.setTransform(yt, 0, 0, yt, rt * yt, 0), Pt.clearRect(-rt, 0, e + rt + _t, e);
1070
+ const qt = N || $ ? 0 : rs.step(An, D);
1071
+ let lt = Ss(Ht(e, wt.t, J, Dt), J.pan, e, xt.current.lean, [sn, en], qt);
1072
+ An = ((In = lt.contact) == null ? void 0 : In.press) ?? 0;
1073
+ const gt = xt.current.bend;
1074
+ if (gt > 0) {
1075
+ const Ot = Vt.current, Nn = Kn(lt, e), fs = xt.current.state === "idle" || xt.current.state === "processing", ds = Ot.over && fs && !N && !$ ? ys(Math.hypot(Ot.x - e / 2, Ot.y - e / 2) - Nn, Nn) : 0;
1076
+ Lt += (ds - Lt) * (1 - Math.exp(-D / 0.14));
1077
+ const Bn = Lt < 0.01 ? 1 : 1 - Math.exp(-D / 0.05);
1078
+ an += (Ot.x - an) * Bn, cn += (Ot.y - cn) * Bn, Lt > 2e-3 && (lt = xs(lt, e, { x: an, y: cn, amount: Lt * gt }));
1079
+ }
1080
+ const pt = xt.current.colors, mt = Y.amount, et = pt.accent, hs = et ? { r: et.r + (Y.r - et.r) * mt, g: et.g + (Y.g - et.g) * mt, b: et.b + (Y.b - et.b) * mt } : { r: Y.r, g: Y.g, b: Y.b }, us = {
1081
+ ...pt,
1082
+ accent: hs,
1083
+ saturation: pt.saturation * (et ? 1 : mt),
1084
+ angle: pt.angle + pt.spin * wt.clock
1032
1085
  };
1033
- Cs(Ot, vt, J, Hn, vt.light ? V : void 0, Qn);
1086
+ js(Pt, lt, st, as, lt.light ? Y : void 0, us);
1034
1087
  };
1035
- let vn = -1 / 0;
1036
- const Jn = (Y) => {
1037
- var ft, Q;
1038
- if (!Pt || Y - vn < 500) return;
1039
- vn = Y;
1040
- const V = st.getBoundingClientRect().left + gt, G = (Q = (ft = It.current.bounds) == null ? void 0 : ft.current) == null ? void 0 : Q.getBoundingClientRect(), zt = G ? G.left : 0, vt = G ? G.right : document.documentElement.clientWidth, et = [
1041
- Math.max(0, Math.floor(V - zt - wt)),
1042
- Math.max(0, Math.floor(vt - V - e - wt))
1088
+ let _n = -1 / 0;
1089
+ const ls = (J) => {
1090
+ var pt, mt;
1091
+ if (!Nt || J - _n < 500) return;
1092
+ _n = J;
1093
+ const Y = K.getBoundingClientRect().left + rt, D = (mt = (pt = xt.current.bounds) == null ? void 0 : pt.current) == null ? void 0 : mt.getBoundingClientRect(), qt = D ? D.left : 0, lt = D ? D.right : document.documentElement.clientWidth, gt = [
1094
+ Math.max(0, Math.floor(Y - qt - At)),
1095
+ Math.max(0, Math.floor(lt - Y - e - At))
1043
1096
  ];
1044
- Xn((Dt) => Math.abs(Dt[0] - et[0]) > 1 || Math.abs(Dt[1] - et[1]) > 1 ? et : Dt);
1097
+ os((et) => Math.abs(et[0] - gt[0]) > 1 || Math.abs(et[1] - gt[1]) > 1 ? gt : et);
1045
1098
  };
1046
- let Ut = 0;
1047
- const yn = (Y) => {
1048
- var Q;
1049
- Jn(Y);
1050
- const V = Ut ? Math.min(0.05, (Y - Ut) / 1e3) : 1 / 60;
1051
- Ut = Y;
1052
- const G = It.current, zt = G.state === "listening" || G.state === "speaking", vt = Jt.current ?? G.analyser ?? null;
1053
- zt ? vt ? bt.readAnalyser(vt, G.sensitivity * St.gain, V) : G.level != null ? bt.readLevel(typeof G.level == "function" ? G.level() : G.level, G.sensitivity * St.gain) : bt.readSilence() : bt.readSilence();
1054
- const et = bt.step(
1055
- V,
1099
+ let Kt = 0;
1100
+ const Pn = (J) => {
1101
+ var mt;
1102
+ ls(J);
1103
+ const Y = Kt ? Math.min(0.05, (J - Kt) / 1e3) : 1 / 60;
1104
+ Kt = J;
1105
+ const D = xt.current, qt = D.state === "listening" || D.state === "speaking", lt = on.current ?? D.analyser ?? null;
1106
+ qt ? lt ? wt.readAnalyser(lt, D.sensitivity * it.gain, Y) : D.level != null ? wt.readLevel(typeof D.level == "function" ? D.level() : D.level, D.sensitivity * it.gain) : wt.readSilence() : wt.readSilence();
1107
+ const gt = wt.step(
1108
+ Y,
1056
1109
  {
1057
- sensitivity: G.sensitivity,
1058
- threshold: G.threshold,
1059
- attack: G.attack,
1060
- release: G.release,
1061
- idle: G.idle,
1062
- driveGain: St.driveGain * G.voiceSpeed,
1063
- calm: G.calm,
1064
- rate: St.speed * E,
1065
- processing: G.state === "processing",
1066
- direction: typeof G.direction == "function" ? G.direction() : G.direction ?? 0
1110
+ sensitivity: D.sensitivity,
1111
+ threshold: D.threshold,
1112
+ attack: D.attack,
1113
+ release: D.release,
1114
+ idle: D.idle,
1115
+ driveGain: it.driveGain * D.voiceSpeed,
1116
+ calm: D.calm,
1117
+ rate: it.speed * P,
1118
+ processing: D.state === "processing",
1119
+ direction: typeof D.direction == "function" ? D.direction() : D.direction ?? 0
1067
1120
  },
1068
- W
1121
+ $
1069
1122
  );
1070
- (Q = G.onLevel) == null || Q.call(G, et.level);
1071
- const ft = Yn.step(V, G.emotionTint, bt.clock, e, R || W);
1072
- Zn(et, ft, V);
1123
+ (mt = D.onLevel) == null || mt.call(D, gt.level);
1124
+ const pt = cs.step(Y, D.emotionTint, wt.clock, e, N || $);
1125
+ is(gt, pt, Y);
1073
1126
  };
1074
- if (yn(performance.now()), R || W && !ct) return;
1075
- let Qt = 0, $t = !1, xn = 0;
1076
- const wn = (Y) => {
1077
- $t && (Qt = requestAnimationFrame(wn), !(Y - xn < ne) && (xn = Y, yn(Y)));
1078
- }, tn = () => {
1079
- $t || ($t = !0, Ut = 0, Qt = requestAnimationFrame(wn));
1080
- }, nn = () => {
1081
- $t = !1, cancelAnimationFrame(Qt);
1127
+ if (Pn(performance.now()), N || $ && !ut) return;
1128
+ let rn = 0, Yt = !1, kn = 0;
1129
+ const Cn = (J) => {
1130
+ Yt && (rn = requestAnimationFrame(Cn), !(J - kn < ye) && (kn = J, Pn(J)));
1131
+ }, ln = () => {
1132
+ Yt || (Yt = !0, Kt = 0, rn = requestAnimationFrame(Cn));
1133
+ }, hn = () => {
1134
+ Yt = !1, cancelAnimationFrame(rn);
1082
1135
  };
1083
- let sn = !0;
1084
- const Tt = typeof IntersectionObserver < "u" ? new IntersectionObserver(([Y]) => {
1085
- sn = Y.isIntersecting, sn && document.visibilityState !== "hidden" ? tn() : nn();
1136
+ let un = !0;
1137
+ const kt = typeof IntersectionObserver < "u" ? new IntersectionObserver(([J]) => {
1138
+ un = J.isIntersecting, un && document.visibilityState !== "hidden" ? ln() : hn();
1086
1139
  }) : null;
1087
- Tt == null || Tt.observe(st);
1088
- const Sn = () => {
1089
- document.visibilityState === "hidden" ? nn() : sn && tn();
1140
+ kt == null || kt.observe(K);
1141
+ const Fn = () => {
1142
+ document.visibilityState === "hidden" ? hn() : un && ln();
1090
1143
  };
1091
- return document.addEventListener("visibilitychange", Sn), Tt || tn(), () => {
1092
- nn(), Tt == null || Tt.disconnect(), document.removeEventListener("visibilitychange", Sn);
1144
+ return document.addEventListener("visibilitychange", Fn), kt || ln(), () => {
1145
+ hn(), kt == null || kt.disconnect(), document.removeEventListener("visibilitychange", Fn);
1093
1146
  };
1094
1147
  }, [
1095
1148
  t,
1096
1149
  e,
1097
- Pt,
1098
- jt,
1099
- Zt,
1100
- gt,
1101
1150
  Nt,
1102
- wt,
1103
- J,
1104
- E,
1105
- R,
1106
- W,
1107
- ct,
1108
- q,
1109
- L,
1110
- mt,
1151
+ sn,
1152
+ en,
1153
+ rt,
1154
+ _t,
1155
+ At,
1156
+ st,
1157
+ P,
1158
+ N,
1159
+ $,
1111
1160
  ut,
1112
- j,
1113
- R || W ? p : null,
1114
- R || W ? `${m}|${v}|${_}|${u}|${g}|${y}|${N}|${T}|${z}` : null
1115
- ]), /* @__PURE__ */ In(
1161
+ O,
1162
+ z,
1163
+ Wt,
1164
+ ht,
1165
+ Q,
1166
+ N || $ ? m : null,
1167
+ N || $ ? `${M}|${v}|${A}|${u}|${g}|${x}|${B}|${S}|${L}` : null
1168
+ ]), /* @__PURE__ */ Xn(
1116
1169
  "canvas",
1117
1170
  {
1118
- ref: Z,
1171
+ ref: H,
1119
1172
  role: "img",
1120
- "aria-label": X ?? te[n],
1121
- style: { width: e + gt + Nt, height: e, display: "block", marginLeft: -gt, marginRight: -Nt, ...H },
1122
- ...at
1173
+ "aria-label": at ?? ve[n],
1174
+ style: { width: e + rt + _t, height: e, display: "block", marginLeft: -rt, marginRight: -_t, ...V },
1175
+ ...nt
1123
1176
  }
1124
1177
  );
1125
1178
  }
1126
- const ee = {
1179
+ const Ee = {
1127
1180
  echoCancellation: !1,
1128
1181
  noiseSuppression: !1,
1129
1182
  autoGainControl: !1
1130
1183
  };
1131
- function Kt() {
1184
+ function Qt() {
1132
1185
  return typeof navigator < "u" && typeof navigator.mediaDevices < "u" && typeof navigator.mediaDevices.getUserMedia == "function";
1133
1186
  }
1134
- function ie(t = {}) {
1135
- const { constraints: n, autoStart: e = !1 } = t, [s, o] = _t(null), [r, c] = _t(() => Kt() ? "idle" : "unsupported"), [l, i] = _t(null), a = Rt(null), M = Rt(n);
1136
- M.current = n;
1137
- const h = En(() => {
1138
- const p = a.current;
1139
- a.current = null, p && p.getTracks().forEach((d) => d.stop()), o(null), c(Kt() ? "idle" : "unsupported");
1140
- }, []), f = En(async () => {
1141
- if (!Kt())
1142
- return c("unsupported"), null;
1187
+ function _e(t = {}) {
1188
+ const { constraints: n, autoStart: e = !1 } = t, [s, o] = Bt(null), [c, r] = Bt(() => Qt() ? "idle" : "unsupported"), [l, i] = Bt(null), a = St(null), d = St(n);
1189
+ d.current = n;
1190
+ const h = Gn(() => {
1191
+ const m = a.current;
1192
+ a.current = null, m && m.getTracks().forEach((p) => p.stop()), o(null), r(Qt() ? "idle" : "unsupported");
1193
+ }, []), f = Gn(async () => {
1194
+ if (!Qt())
1195
+ return r("unsupported"), null;
1143
1196
  if (a.current) return a.current;
1144
- Bn(), c("requesting"), i(null);
1197
+ Hn(), r("requesting"), i(null);
1145
1198
  try {
1146
- const p = await navigator.mediaDevices.getUserMedia({
1147
- audio: { ...ee, ...M.current ?? {} }
1199
+ const m = await navigator.mediaDevices.getUserMedia({
1200
+ audio: { ...Ee, ...d.current ?? {} }
1148
1201
  });
1149
- a.current = p, o(p), c("live");
1150
- const d = () => {
1151
- a.current === p && (a.current = null, o(null), c("idle"));
1202
+ a.current = m, o(m), r("live");
1203
+ const p = () => {
1204
+ a.current === m && (a.current = null, o(null), r("idle"));
1152
1205
  };
1153
- return p.getAudioTracks().forEach((m) => m.addEventListener("ended", d)), p;
1154
- } catch (p) {
1155
- const d = p instanceof Error ? p : new Error(String(p));
1156
- return i(d), c(d.name === "NotAllowedError" || d.name === "SecurityError" ? "denied" : "error"), null;
1206
+ return m.getAudioTracks().forEach((M) => M.addEventListener("ended", p)), m;
1207
+ } catch (m) {
1208
+ const p = m instanceof Error ? m : new Error(String(m));
1209
+ return i(p), r(p.name === "NotAllowedError" || p.name === "SecurityError" ? "denied" : "error"), null;
1157
1210
  }
1158
1211
  }, []);
1159
- return kt(() => {
1212
+ return It(() => {
1160
1213
  e && f();
1161
- }, [e]), kt(
1214
+ }, [e]), It(
1162
1215
  () => () => {
1163
- const p = a.current;
1164
- a.current = null, p && p.getTracks().forEach((d) => d.stop());
1216
+ const m = a.current;
1217
+ a.current = null, m && m.getTracks().forEach((p) => p.stop());
1165
1218
  },
1166
1219
  []
1167
- ), { stream: s, state: r, error: l, supported: Kt(), start: f, stop: h };
1220
+ ), { stream: s, state: c, error: l, supported: Qt(), start: f, stop: h };
1168
1221
  }
1169
- function le(t) {
1170
- return /* @__PURE__ */ In(se, { ...t, type: "aura" });
1222
+ function Pe(t) {
1223
+ return /* @__PURE__ */ Xn(we, { ...t, type: "aura" });
1171
1224
  }
1172
1225
  export {
1173
- ns as ACCENT_COLORS,
1174
- Ht as EMOTION_COLORS,
1226
+ ms as ACCENT_COLORS,
1227
+ tn as EMOTION_COLORS,
1175
1228
  ot as PRESETS,
1176
- pt as SPECTRUM_N,
1177
- re as VOICE_ORB_TYPES,
1178
- Js as VoiceFollower,
1179
- se as VoiceOrb,
1180
- le as VoiceRing,
1181
- ts as acquireAnalyser,
1182
- Bn as getAudioContext,
1183
- ce as isAudioSupported,
1184
- Os as resolvePreset,
1185
- ie as useMicrophone
1229
+ vt as SPECTRUM_N,
1230
+ Ae as VOICE_ORB_TYPES,
1231
+ ge as VoiceFollower,
1232
+ we as VoiceOrb,
1233
+ Pe as VoiceRing,
1234
+ ps as acquireAnalyser,
1235
+ Hn as getAudioContext,
1236
+ Re as isAudioSupported,
1237
+ ce as resolvePreset,
1238
+ _e as useMicrophone
1186
1239
  };