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/README.md +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +13 -1
- package/dist/index.es.js +687 -634
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
let
|
|
4
|
-
function
|
|
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
|
|
10
|
-
return
|
|
9
|
+
function Re() {
|
|
10
|
+
return Vn() != null;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const t =
|
|
14
|
-
return t ? (
|
|
15
|
-
}),
|
|
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
|
|
18
|
-
function
|
|
19
|
-
const n =
|
|
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 =
|
|
22
|
-
e || (e = { node: n.createMediaStreamSource(t), refs: 0 },
|
|
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
|
-
|
|
40
|
+
fn.delete(t);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
const
|
|
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
|
-
},
|
|
51
|
-
green:
|
|
52
|
-
red:
|
|
53
|
-
blue:
|
|
54
|
-
},
|
|
55
|
-
class
|
|
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,
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
const a =
|
|
64
|
-
|
|
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
|
|
66
|
+
return r.t = s, r.size = o, r;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
const
|
|
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
|
|
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
|
|
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
|
|
95
|
-
for (let i = 0; i <
|
|
96
|
-
this.v += (15 * 15 * (n - this.x) - 2 * 0.3 * 15 * this.v) *
|
|
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
|
|
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
|
|
104
|
-
const
|
|
105
|
-
return n * l * (s.move + s.pull *
|
|
106
|
-
}, h = Math.max(0, Math.min(2, s.lens ?? 1)), f = l * 0.9,
|
|
107
|
-
let
|
|
108
|
-
if (Number.isFinite(
|
|
109
|
-
v = i > 0 ? e +
|
|
110
|
-
const b = (
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
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
|
|
116
|
-
for (const
|
|
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 =
|
|
119
|
-
let k = 1 / 0,
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
let
|
|
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 = (
|
|
146
|
+
const C = (R - (L - i * w)) * i;
|
|
125
147
|
if (C > 0) {
|
|
126
|
-
const
|
|
127
|
-
|
|
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
|
|
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] =
|
|
155
|
+
[b.x, b.y] = U(b.x, b.y);
|
|
134
156
|
for (const b of t.strokes)
|
|
135
|
-
for (let
|
|
136
|
-
const [
|
|
137
|
-
b.pts[
|
|
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 &&
|
|
140
|
-
const b = h *
|
|
161
|
+
if (u > 0 && _ > k) {
|
|
162
|
+
const b = h * x;
|
|
141
163
|
t.contact = {
|
|
142
164
|
side: i,
|
|
143
|
-
x:
|
|
165
|
+
x: S,
|
|
144
166
|
y0: k,
|
|
145
|
-
y1:
|
|
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:
|
|
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:
|
|
177
|
+
cy: r
|
|
156
178
|
} : void 0
|
|
157
179
|
};
|
|
158
180
|
}
|
|
159
|
-
if (
|
|
181
|
+
if (q = !1, t.light) {
|
|
160
182
|
const b = t.light;
|
|
161
|
-
[b.cx, b.cy] =
|
|
162
|
-
for (const
|
|
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
|
|
167
|
-
function
|
|
188
|
+
const Mt = Math.PI * 2;
|
|
189
|
+
function Ct(t, n, e) {
|
|
168
190
|
return t + (n - t) * e;
|
|
169
191
|
}
|
|
170
|
-
function
|
|
192
|
+
function j(t) {
|
|
171
193
|
return t < 0 ? 0 : t > 1 ? 1 : t;
|
|
172
194
|
}
|
|
173
|
-
function
|
|
174
|
-
const s =
|
|
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
|
|
178
|
-
function
|
|
179
|
-
const o = 1 / Math.max(0.05, s),
|
|
180
|
-
return (
|
|
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
|
|
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
|
|
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
|
|
191
|
-
const s = Math.floor(t), o = Math.floor(n),
|
|
192
|
-
let
|
|
193
|
-
|
|
194
|
-
const a = Et(
|
|
195
|
-
return
|
|
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
|
|
198
|
-
const e = Math.PI * (3 - Math.sqrt(5)), s = 1 - 2 * (t + 0.5) / n, o = Math.sqrt(1 - s * s),
|
|
199
|
-
return [o * Math.cos(
|
|
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
|
|
202
|
-
const
|
|
203
|
-
return (a,
|
|
204
|
-
const f = a * i + h * l,
|
|
205
|
-
return [e + f * o, s -
|
|
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
|
|
230
|
+
function $t(t, n = 0.6) {
|
|
209
231
|
return (t / 200) ** n;
|
|
210
232
|
}
|
|
211
|
-
function
|
|
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,
|
|
237
|
+
return s.sort((o, c) => o.z - c.z), { dots: s, strokes: n };
|
|
216
238
|
}
|
|
217
|
-
const
|
|
218
|
-
function
|
|
219
|
-
const o = t.r / 255,
|
|
220
|
-
let a = (l + i) / 2,
|
|
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
|
|
223
|
-
h = l === o ? (
|
|
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,
|
|
226
|
-
const f = (
|
|
227
|
-
return [Math.round(
|
|
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
|
|
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),
|
|
231
|
-
for (let h = 0; h <
|
|
232
|
-
const f = h / (
|
|
233
|
-
|
|
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
|
|
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:
|
|
238
|
-
mix:
|
|
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
|
|
242
|
-
return Math.max(0, Math.min(
|
|
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
|
|
247
|
-
function
|
|
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),
|
|
250
|
-
if (s === o) return [0, 0,
|
|
251
|
-
const
|
|
252
|
-
return [(s === t ? (n - e) /
|
|
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
|
|
255
|
-
const s = (
|
|
256
|
-
return [
|
|
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
|
|
259
|
-
function
|
|
260
|
-
const [s, o,
|
|
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 *
|
|
263
|
-
1.9779984951 *
|
|
264
|
-
0.0259040371 *
|
|
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
|
|
268
|
-
const s = (t + 0.3963377774 * n + 0.2158037573 * e) ** 3, o = (t - 0.1055613458 * n - 0.0638541728 * e) ** 3,
|
|
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
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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
|
|
283
|
-
return [r,
|
|
309
|
+
const d = n ? 1 : 0.82;
|
|
310
|
+
return [r, l * d, i * d, a * d];
|
|
284
311
|
});
|
|
285
312
|
}
|
|
286
|
-
const
|
|
287
|
-
function
|
|
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,
|
|
291
|
-
const
|
|
292
|
-
return o[
|
|
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
|
|
322
|
+
const d = a / n;
|
|
296
323
|
let h = -1;
|
|
297
|
-
for (; h < s - 1 &&
|
|
298
|
-
const f =
|
|
299
|
-
(w) => (2 *
|
|
300
|
-
), [
|
|
301
|
-
i.push([
|
|
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
|
|
306
|
-
function
|
|
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
|
|
336
|
+
function Us(t) {
|
|
310
337
|
const { width: n, height: e } = t.canvas;
|
|
311
|
-
let s =
|
|
312
|
-
return (!s || s.full.canvas.width !== n || s.full.canvas.height !== e) && (s = { full:
|
|
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
|
|
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
|
|
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",
|
|
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
|
|
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,
|
|
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
|
|
327
|
-
const
|
|
328
|
-
const g = new Path2D(),
|
|
329
|
-
let
|
|
330
|
-
for (let
|
|
331
|
-
|
|
332
|
-
return u.closed && g.closePath(), { p: g, a:
|
|
333
|
-
}), a = Math.max(1, i.length),
|
|
334
|
-
for (const
|
|
335
|
-
|
|
336
|
-
},
|
|
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
|
-
},
|
|
339
|
-
|
|
340
|
-
const v = e.halo *
|
|
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
|
-
|
|
377
|
+
M
|
|
351
378
|
);
|
|
352
|
-
const
|
|
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
|
-
(
|
|
360
|
-
(
|
|
361
|
-
|
|
386
|
+
(x) => x * u,
|
|
387
|
+
(x) => g * A * x,
|
|
388
|
+
M
|
|
362
389
|
);
|
|
363
|
-
if (
|
|
364
|
-
for (const [u, g,
|
|
365
|
-
[1 + e.fringe,
|
|
366
|
-
[1 - e.fringe,
|
|
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 =
|
|
369
|
-
(
|
|
370
|
-
(
|
|
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 *
|
|
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
|
-
(
|
|
382
|
-
(
|
|
408
|
+
(x) => x * 2.2,
|
|
409
|
+
(x) => u.a * x
|
|
383
410
|
);
|
|
384
411
|
}
|
|
385
412
|
t.restore();
|
|
386
413
|
}
|
|
387
|
-
const
|
|
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
|
-
}`,
|
|
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
|
|
429
|
-
function
|
|
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
|
|
435
|
-
return n.shaderSource(
|
|
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,
|
|
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
|
|
442
|
-
n.enableVertexAttribArray(
|
|
443
|
-
const
|
|
444
|
-
n.bindTexture(n.TEXTURE_2D,
|
|
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:
|
|
475
|
+
return { gl: n, canvas: t, source: document.createElement("canvas"), tex: r, u: l };
|
|
449
476
|
}
|
|
450
|
-
function
|
|
451
|
-
if (
|
|
452
|
-
const { gl: o, canvas:
|
|
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
|
-
(
|
|
455
|
-
const g =
|
|
456
|
-
return g.clearRect(0, 0, u, f), g.drawImage(t.canvas, v, 0, u, f, 0, 0, u, f), (
|
|
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
|
|
459
|
-
const o = 2.2 / s.size,
|
|
460
|
-
return s.amount * (0.2 + 0.75 *
|
|
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
|
|
463
|
-
const i = Math.round(n * 1e3) / 1e3, a = (
|
|
464
|
-
let h = s ? a(s.r) :
|
|
465
|
-
return
|
|
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
|
|
468
|
-
function
|
|
469
|
-
const
|
|
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
|
|
472
|
-
let f = "",
|
|
473
|
-
for (let
|
|
474
|
-
const
|
|
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
|
|
480
|
-
|
|
481
|
-
) : 0, u = l ? l.at((a.pts[2 *
|
|
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
|
|
484
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
|
494
|
-
const l = o && o.amount > 5e-3 ? o : void 0, i =
|
|
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
|
|
497
|
-
if (t.fillStyle =
|
|
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,
|
|
528
|
+
t.beginPath(), t.arc(a.x, a.y, a.r, 0, Mt), t.fill();
|
|
502
529
|
}
|
|
503
530
|
}
|
|
504
|
-
function
|
|
531
|
+
function js(t, n, e, s, o, c) {
|
|
505
532
|
var l;
|
|
506
|
-
const
|
|
507
|
-
n.light ?
|
|
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
|
|
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
|
-
],
|
|
522
|
-
const o = t / 2,
|
|
523
|
-
let
|
|
524
|
-
for (let
|
|
525
|
-
const
|
|
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
|
-
|
|
528
|
-
),
|
|
529
|
-
for (let
|
|
530
|
-
const
|
|
531
|
-
|
|
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
|
-
|
|
560
|
+
S.push({ dirs: V, f: at, a: nt, rk: Q });
|
|
534
561
|
}
|
|
535
|
-
const k = w ?
|
|
536
|
-
let
|
|
537
|
-
for (const { dirs:
|
|
538
|
-
for (let
|
|
539
|
-
const
|
|
540
|
-
|
|
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
|
-
|
|
543
|
-
const
|
|
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
|
|
546
|
-
const
|
|
547
|
-
C.push(o +
|
|
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:
|
|
550
|
-
}), b = 2.3 + 0.25 * Math.sin(n * 0.21) + 2 * e.spin,
|
|
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:
|
|
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 *
|
|
561
|
-
halo: (s.halo ?? 0.5) * (1 + 0.6 *
|
|
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 *
|
|
567
|
-
a: 0.5 + 0.35 * h + 0.4 *
|
|
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 { ...
|
|
573
|
-
},
|
|
574
|
-
const o = t / 2,
|
|
575
|
-
for (let C = -
|
|
576
|
-
for (let
|
|
577
|
-
const
|
|
578
|
-
if (
|
|
579
|
-
const
|
|
580
|
-
|
|
581
|
-
x:
|
|
582
|
-
y:
|
|
583
|
-
z:
|
|
584
|
-
r: v * Math.min(1,
|
|
585
|
-
white:
|
|
586
|
-
a:
|
|
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 { ...
|
|
590
|
-
},
|
|
591
|
-
const o = t / 2,
|
|
592
|
-
for (let
|
|
593
|
-
const v =
|
|
594
|
-
let k = -
|
|
595
|
-
const
|
|
596
|
-
k /=
|
|
597
|
-
const
|
|
598
|
-
for (let
|
|
599
|
-
const
|
|
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 +
|
|
602
|
-
y:
|
|
603
|
-
z:
|
|
604
|
-
r: ((s.partR ?? 0.47) + (s.partRDepth ?? 0.65) *
|
|
605
|
-
white: 0.32 - 0.24 *
|
|
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
|
|
610
|
-
},
|
|
611
|
-
const o = t / 2,
|
|
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
|
|
614
|
-
const
|
|
615
|
-
g +=
|
|
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
|
|
619
|
-
for (let
|
|
620
|
-
const
|
|
621
|
-
k.push({ x:
|
|
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
|
|
624
|
-
for (let
|
|
625
|
-
const
|
|
626
|
-
for (let
|
|
627
|
-
const
|
|
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:
|
|
630
|
-
y:
|
|
631
|
-
z:
|
|
632
|
-
r: ((s.rBase ?? 0.49) + (s.rDepth ?? 0.78) *
|
|
633
|
-
white: 0.52 - 0.44 *
|
|
634
|
-
a: 0.4 + 0.6 *
|
|
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
|
|
639
|
-
},
|
|
640
|
-
const o = t / 2,
|
|
641
|
-
for (let
|
|
642
|
-
const
|
|
643
|
-
for (let
|
|
644
|
-
const
|
|
645
|
-
|
|
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:
|
|
675
|
+
u.push({ pts: G, a: C, white: 0, w: f, closed: !0 });
|
|
648
676
|
}
|
|
649
|
-
const
|
|
650
|
-
for (let
|
|
651
|
-
const [
|
|
652
|
-
for (let
|
|
653
|
-
const
|
|
654
|
-
C.push(
|
|
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:
|
|
684
|
+
u.push({ pts: C, a: F, white: 0, w: f, closed: !0 });
|
|
657
685
|
}
|
|
658
|
-
return
|
|
659
|
-
},
|
|
660
|
-
const o = t / 2,
|
|
661
|
-
let
|
|
662
|
-
for (let w = 0; w <
|
|
663
|
-
const k =
|
|
664
|
-
|
|
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
|
|
667
|
-
for (let w = 0; w <
|
|
668
|
-
const [k,
|
|
669
|
-
|
|
670
|
-
x:
|
|
671
|
-
y
|
|
672
|
-
z:
|
|
673
|
-
r: ((s.rBase ?? 0.27) + (s.rDepth ?? 0.84) *
|
|
674
|
-
white: 0.62 - 0.52 *
|
|
675
|
-
a: 0.3 + 0.7 *
|
|
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
|
|
679
|
-
},
|
|
680
|
-
orbit:
|
|
681
|
-
sash:
|
|
682
|
-
signal:
|
|
683
|
-
swell:
|
|
684
|
-
pixel:
|
|
685
|
-
aura:
|
|
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
|
|
733
|
-
const o = t in ot ? t : "orbit",
|
|
734
|
-
for (const [i, a] of Object.entries(
|
|
735
|
-
const
|
|
736
|
-
|
|
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:
|
|
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
|
|
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
|
|
780
|
+
function ie() {
|
|
753
781
|
return typeof matchMedia > "u" || matchMedia("(prefers-color-scheme: dark)").matches;
|
|
754
782
|
}
|
|
755
|
-
function
|
|
756
|
-
const [e, s] =
|
|
757
|
-
return
|
|
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 =
|
|
768
|
-
s(i ??
|
|
795
|
+
const i = re(n.current);
|
|
796
|
+
s(i ?? ie());
|
|
769
797
|
};
|
|
770
798
|
o();
|
|
771
|
-
const
|
|
772
|
-
|
|
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
|
-
|
|
807
|
+
c == null || c.removeEventListener("change", r), l == null || l.disconnect();
|
|
780
808
|
};
|
|
781
809
|
}, [t, n]), e;
|
|
782
810
|
}
|
|
783
|
-
function
|
|
784
|
-
const [t, n] =
|
|
785
|
-
return
|
|
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
|
|
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
|
-
],
|
|
798
|
-
function
|
|
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
|
|
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
|
|
832
|
+
return es((1 - Math.exp(-3 * e)) / (1 - Math.exp(-3)));
|
|
805
833
|
}
|
|
806
|
-
function
|
|
807
|
-
const
|
|
808
|
-
return t + (n - t) * (1 - Math.exp(-e / Math.max(1e-3,
|
|
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
|
|
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(
|
|
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,
|
|
855
|
+
const o = this.timeBuf, c = this.freqBuf;
|
|
828
856
|
n.getFloatTimeDomainData(o);
|
|
829
|
-
let
|
|
830
|
-
for (let h = 0; h < o.length; h++)
|
|
831
|
-
this.raw.level = Math.sqrt(
|
|
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
|
|
834
|
-
let
|
|
835
|
-
for (let v =
|
|
836
|
-
return
|
|
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
|
|
839
|
-
return this.floor[h] = f <
|
|
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(
|
|
843
|
-
const
|
|
844
|
-
for (let h = 0; h <
|
|
845
|
-
const f =
|
|
846
|
-
this.raw.spectrum[h] = a(3 + h, i(f,
|
|
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 =
|
|
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
|
|
859
|
-
for (let l = 0; l <
|
|
860
|
-
const i = l / (
|
|
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:
|
|
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
|
|
873
|
-
this.level =
|
|
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] =
|
|
876
|
-
for (let u = 0; u <
|
|
877
|
-
this.spectrum[u] =
|
|
878
|
-
const h = this.clock, f = s ? 0.5 : 0.5 + 0.5 * Math.sin(
|
|
879
|
-
|
|
880
|
-
for (let u = 0; u < 3; u++)
|
|
881
|
-
|
|
882
|
-
for (let u = 0; u < 3; u++)
|
|
883
|
-
if (s || (this.drive += n * l * (a + e.driveGain * this.level + 1.3 * i)),
|
|
884
|
-
const u = Math.ceil(this.spin /
|
|
885
|
-
this.spin += n * (
|
|
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
|
-
|
|
888
|
-
const
|
|
889
|
-
return this.panVel += (
|
|
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
|
|
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, (
|
|
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
|
|
932
|
+
const ve = {
|
|
905
933
|
idle: "Waiting",
|
|
906
934
|
listening: "Listening",
|
|
907
935
|
speaking: "Speaking",
|
|
908
936
|
processing: "Thinking"
|
|
909
|
-
},
|
|
910
|
-
function
|
|
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:
|
|
917
|
-
sensitivity:
|
|
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:
|
|
949
|
+
idle: d = 0.1,
|
|
922
950
|
calm: h = 0.4,
|
|
923
951
|
voiceSpeed: f,
|
|
924
|
-
emotion:
|
|
925
|
-
emotionColors:
|
|
926
|
-
saturation:
|
|
952
|
+
emotion: m = null,
|
|
953
|
+
emotionColors: p,
|
|
954
|
+
saturation: M = 2,
|
|
927
955
|
accent: v = null,
|
|
928
|
-
gradientAngle:
|
|
956
|
+
gradientAngle: A = 99,
|
|
929
957
|
gradientSpin: u = 12,
|
|
930
958
|
neutral: g = 1,
|
|
931
|
-
colorBrightness:
|
|
932
|
-
colorHue:
|
|
933
|
-
gradientStart:
|
|
934
|
-
gradientWidth:
|
|
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:
|
|
938
|
-
directionDeform:
|
|
939
|
-
directionSquash:
|
|
965
|
+
directionPull: _,
|
|
966
|
+
directionDeform: q,
|
|
967
|
+
directionSquash: U,
|
|
940
968
|
directionLens: b,
|
|
941
|
-
directionStretch:
|
|
942
|
-
directionSplit:
|
|
943
|
-
directionBlur:
|
|
944
|
-
directionBounce:
|
|
945
|
-
directionMargin:
|
|
969
|
+
directionStretch: E,
|
|
970
|
+
directionSplit: y,
|
|
971
|
+
directionBlur: I,
|
|
972
|
+
directionBounce: R,
|
|
973
|
+
directionMargin: G,
|
|
946
974
|
directionBounds: C,
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
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
|
|
961
|
-
|
|
962
|
-
const
|
|
963
|
-
|
|
964
|
-
const
|
|
965
|
-
saturation: Math.min(1,
|
|
966
|
-
vivid: Math.max(0, Math.min(1,
|
|
967
|
-
brightness:
|
|
968
|
-
hue:
|
|
969
|
-
start:
|
|
970
|
-
width:
|
|
971
|
-
accent: v ?
|
|
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
|
-
},
|
|
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:
|
|
1007
|
+
level: c,
|
|
979
1008
|
analyser: o,
|
|
980
|
-
sensitivity:
|
|
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:
|
|
1013
|
+
idle: d,
|
|
985
1014
|
calm: h,
|
|
986
1015
|
voiceSpeed: f ?? ot[t in ot ? t : "orbit"].voiceSpeed ?? 1,
|
|
987
|
-
onLevel:
|
|
988
|
-
emotionTint:
|
|
989
|
-
colors:
|
|
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 ??
|
|
995
|
-
pull:
|
|
996
|
-
deform:
|
|
997
|
-
squash:
|
|
998
|
-
lens: b ??
|
|
999
|
-
stretch:
|
|
1000
|
-
split:
|
|
1001
|
-
blur:
|
|
1002
|
-
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
|
-
},
|
|
1005
|
-
|
|
1006
|
-
const
|
|
1007
|
-
|
|
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
|
|
1010
|
-
return
|
|
1011
|
-
|
|
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]),
|
|
1014
|
-
const
|
|
1015
|
-
if (!
|
|
1016
|
-
const
|
|
1017
|
-
|
|
1018
|
-
const
|
|
1019
|
-
if (!
|
|
1020
|
-
const
|
|
1021
|
-
let
|
|
1022
|
-
const
|
|
1023
|
-
var
|
|
1024
|
-
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
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
|
-
|
|
1086
|
+
js(Pt, lt, st, as, lt.light ? Y : void 0, us);
|
|
1034
1087
|
};
|
|
1035
|
-
let
|
|
1036
|
-
const
|
|
1037
|
-
var
|
|
1038
|
-
if (!
|
|
1039
|
-
|
|
1040
|
-
const
|
|
1041
|
-
Math.max(0, Math.floor(
|
|
1042
|
-
Math.max(0, Math.floor(
|
|
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
|
-
|
|
1097
|
+
os((et) => Math.abs(et[0] - gt[0]) > 1 || Math.abs(et[1] - gt[1]) > 1 ? gt : et);
|
|
1045
1098
|
};
|
|
1046
|
-
let
|
|
1047
|
-
const
|
|
1048
|
-
var
|
|
1049
|
-
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1054
|
-
const
|
|
1055
|
-
|
|
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:
|
|
1058
|
-
threshold:
|
|
1059
|
-
attack:
|
|
1060
|
-
release:
|
|
1061
|
-
idle:
|
|
1062
|
-
driveGain:
|
|
1063
|
-
calm:
|
|
1064
|
-
rate:
|
|
1065
|
-
processing:
|
|
1066
|
-
direction: typeof
|
|
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
|
-
|
|
1121
|
+
$
|
|
1069
1122
|
);
|
|
1070
|
-
(
|
|
1071
|
-
const
|
|
1072
|
-
|
|
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 (
|
|
1075
|
-
let
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1078
|
-
},
|
|
1079
|
-
|
|
1080
|
-
},
|
|
1081
|
-
|
|
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
|
|
1084
|
-
const
|
|
1085
|
-
|
|
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
|
-
|
|
1088
|
-
const
|
|
1089
|
-
document.visibilityState === "hidden" ?
|
|
1140
|
+
kt == null || kt.observe(K);
|
|
1141
|
+
const Fn = () => {
|
|
1142
|
+
document.visibilityState === "hidden" ? hn() : un && ln();
|
|
1090
1143
|
};
|
|
1091
|
-
return document.addEventListener("visibilitychange",
|
|
1092
|
-
|
|
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
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1151
|
+
sn,
|
|
1152
|
+
en,
|
|
1153
|
+
rt,
|
|
1154
|
+
_t,
|
|
1155
|
+
At,
|
|
1156
|
+
st,
|
|
1157
|
+
P,
|
|
1158
|
+
N,
|
|
1159
|
+
$,
|
|
1111
1160
|
ut,
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
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:
|
|
1171
|
+
ref: H,
|
|
1119
1172
|
role: "img",
|
|
1120
|
-
"aria-label":
|
|
1121
|
-
style: { width: e +
|
|
1122
|
-
...
|
|
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
|
|
1179
|
+
const Ee = {
|
|
1127
1180
|
echoCancellation: !1,
|
|
1128
1181
|
noiseSuppression: !1,
|
|
1129
1182
|
autoGainControl: !1
|
|
1130
1183
|
};
|
|
1131
|
-
function
|
|
1184
|
+
function Qt() {
|
|
1132
1185
|
return typeof navigator < "u" && typeof navigator.mediaDevices < "u" && typeof navigator.mediaDevices.getUserMedia == "function";
|
|
1133
1186
|
}
|
|
1134
|
-
function
|
|
1135
|
-
const { constraints: n, autoStart: e = !1 } = t, [s, o] =
|
|
1136
|
-
|
|
1137
|
-
const h =
|
|
1138
|
-
const
|
|
1139
|
-
a.current = null,
|
|
1140
|
-
}, []), f =
|
|
1141
|
-
if (!
|
|
1142
|
-
return
|
|
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
|
-
|
|
1197
|
+
Hn(), r("requesting"), i(null);
|
|
1145
1198
|
try {
|
|
1146
|
-
const
|
|
1147
|
-
audio: { ...
|
|
1199
|
+
const m = await navigator.mediaDevices.getUserMedia({
|
|
1200
|
+
audio: { ...Ee, ...d.current ?? {} }
|
|
1148
1201
|
});
|
|
1149
|
-
a.current =
|
|
1150
|
-
const
|
|
1151
|
-
a.current ===
|
|
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
|
|
1154
|
-
} catch (
|
|
1155
|
-
const
|
|
1156
|
-
return i(
|
|
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
|
|
1212
|
+
return It(() => {
|
|
1160
1213
|
e && f();
|
|
1161
|
-
}, [e]),
|
|
1214
|
+
}, [e]), It(
|
|
1162
1215
|
() => () => {
|
|
1163
|
-
const
|
|
1164
|
-
a.current = null,
|
|
1216
|
+
const m = a.current;
|
|
1217
|
+
a.current = null, m && m.getTracks().forEach((p) => p.stop());
|
|
1165
1218
|
},
|
|
1166
1219
|
[]
|
|
1167
|
-
), { stream: s, state:
|
|
1220
|
+
), { stream: s, state: c, error: l, supported: Qt(), start: f, stop: h };
|
|
1168
1221
|
}
|
|
1169
|
-
function
|
|
1170
|
-
return /* @__PURE__ */
|
|
1222
|
+
function Pe(t) {
|
|
1223
|
+
return /* @__PURE__ */ Xn(we, { ...t, type: "aura" });
|
|
1171
1224
|
}
|
|
1172
1225
|
export {
|
|
1173
|
-
|
|
1174
|
-
|
|
1226
|
+
ms as ACCENT_COLORS,
|
|
1227
|
+
tn as EMOTION_COLORS,
|
|
1175
1228
|
ot as PRESETS,
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
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
|
};
|