react-ai-avatar 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +310 -0
- package/dist/lib/GlbArkitAvatar-CcPWCsQV.cjs +1 -0
- package/dist/lib/GlbArkitAvatar-Dm9STiyR.js +232 -0
- package/dist/lib/VrmAvatar-CehRzj0J.js +224 -0
- package/dist/lib/VrmAvatar-D_jr2TOG.cjs +1 -0
- package/dist/lib/components/AudioVisualizer.d.ts +17 -0
- package/dist/lib/components/ContractAvatar.d.ts +25 -0
- package/dist/lib/components/DefaultAvatar.d.ts +37 -0
- package/dist/lib/components/DiceBearAvatar.d.ts +48 -0
- package/dist/lib/components/DiceBearThumb.d.ts +15 -0
- package/dist/lib/components/DoodleAvatar.d.ts +21 -0
- package/dist/lib/components/GeometricAvatar.d.ts +22 -0
- package/dist/lib/components/GlbArkitAvatar.d.ts +7 -0
- package/dist/lib/components/MemojiAvatar.d.ts +19 -0
- package/dist/lib/components/PixelArtAvatar.d.ts +23 -0
- package/dist/lib/components/RealtimeAvatar.d.ts +74 -0
- package/dist/lib/components/SquirrelAvatar.d.ts +29 -0
- package/dist/lib/components/VrmAvatar.d.ts +6 -0
- package/dist/lib/index.cjs +6 -0
- package/dist/lib/index.js +1231 -0
- package/dist/lib/lib/color.d.ts +6 -0
- package/dist/lib/lib/dicebear.d.ts +110 -0
- package/dist/lib/lib/index.d.ts +34 -0
- package/dist/lib/lib/mouthEngine.d.ts +37 -0
- package/dist/lib/lib/speechActivity.d.ts +51 -0
- package/dist/lib/lib/types.d.ts +22 -0
- package/dist/lib/lib/useAudioMouth.d.ts +20 -0
- package/dist/lib/lib/useAvatarRuntime.d.ts +39 -0
- package/dist/lib/lib/useReducedMotion.d.ts +5 -0
- package/dist/lib/lib/useStreamingTextActivity.d.ts +46 -0
- package/dist/lib/lib/vrm.d.ts +9 -0
- package/dist/lib/react-ai-avatar.css +1 -0
- package/dist/lib/useReducedMotion-BDcEizfP.js +104 -0
- package/dist/lib/useReducedMotion-BRDEmRNI.cjs +1 -0
- package/dist/lib/vrm.cjs +1 -0
- package/dist/lib/vrm.js +4 -0
- package/package.json +127 -0
|
@@ -0,0 +1,1231 @@
|
|
|
1
|
+
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import le, { useRef as O, useEffect as ee, useId as xe, useState as ce, Suspense as he } from "react";
|
|
3
|
+
import { u as se, c as de, a as we } from "./useReducedMotion-BDcEizfP.js";
|
|
4
|
+
import { S as He, i as Ke } from "./useReducedMotion-BDcEizfP.js";
|
|
5
|
+
import { useMotionValue as pe, motion as ae } from "motion/react";
|
|
6
|
+
const ve = {
|
|
7
|
+
idle: "#4b5563",
|
|
8
|
+
listening: "#3b82f6",
|
|
9
|
+
thinking: "#8b5cf6",
|
|
10
|
+
speaking: "#10b981",
|
|
11
|
+
working: "#f59e0b"
|
|
12
|
+
};
|
|
13
|
+
function Me(i, n) {
|
|
14
|
+
const l = se(), o = O(n);
|
|
15
|
+
o.current = n;
|
|
16
|
+
const a = O({ x: 0, y: 0 });
|
|
17
|
+
ee(() => {
|
|
18
|
+
if (l) return;
|
|
19
|
+
const t = (d) => {
|
|
20
|
+
a.current.x = Math.max(-1, Math.min(1, d.clientX / window.innerWidth * 2 - 1)), a.current.y = Math.max(-1, Math.min(1, d.clientY / window.innerHeight * 2 - 1));
|
|
21
|
+
};
|
|
22
|
+
return window.addEventListener("mousemove", t), () => window.removeEventListener("mousemove", t);
|
|
23
|
+
}, [l]), ee(() => {
|
|
24
|
+
const t = i.current;
|
|
25
|
+
if (t === null || typeof window > "u") return;
|
|
26
|
+
const d = (A, D) => D > 0 ? Math.round(A / D) * D : A;
|
|
27
|
+
let s = null, h = null, p = null, g = [], r = [], z = [], S = !1, T = 3, V = 9, w = 0, m = 1, F = [], f = [], k = [];
|
|
28
|
+
const M = () => {
|
|
29
|
+
var $;
|
|
30
|
+
s = t.querySelector("#rra-ring"), h = t.querySelector("#rra-mouth"), p = t.querySelector("#rra-think"), g = p ? Array.from(p.querySelectorAll("circle, rect")) : [], r = Array.from(t.querySelectorAll(".rra-pupil")), z = Array.from(t.querySelectorAll(".rra-lid")), S = (h == null ? void 0 : h.tagName.toLowerCase()) === "rect", T = h ? parseFloat(h.getAttribute(S ? "height" : "ry") ?? "3") : 3, V = h ? parseFloat(h.getAttribute(S ? "width" : "rx") ?? "9") : 9, w = h ? parseFloat(h.getAttribute("data-quantize") ?? "0") : 0, F = r.map((Q) => {
|
|
31
|
+
const Z = Q.tagName.toLowerCase() === "rect";
|
|
32
|
+
return {
|
|
33
|
+
isRect: Z,
|
|
34
|
+
x: parseFloat(Q.getAttribute("data-base-x") ?? Q.getAttribute(Z ? "x" : "cx") ?? "0"),
|
|
35
|
+
y: parseFloat(Q.getAttribute("data-base-y") ?? Q.getAttribute(Z ? "y" : "cy") ?? "0"),
|
|
36
|
+
quantize: parseFloat(Q.getAttribute("data-quantize") ?? "0")
|
|
37
|
+
};
|
|
38
|
+
}), f = z.map((Q) => parseFloat(Q.getAttribute("data-max-height") ?? "16")), k = r.map(() => ({ x: 0, y: 0 }));
|
|
39
|
+
const A = t.querySelector("svg"), D = parseFloat((($ = A == null ? void 0 : A.getAttribute("viewBox")) == null ? void 0 : $.split(/[\s,]+/)[2]) ?? "200");
|
|
40
|
+
m = D > 0 ? D / 200 : 1;
|
|
41
|
+
}, y = () => (h ? !h.isConnected : t.querySelector("#rra-mouth") !== null) || (s ? !s.isConnected : t.querySelector("#rra-ring") !== null);
|
|
42
|
+
M();
|
|
43
|
+
let N = null, J = null, v = !1, u = 0, W = 1, I = 1, R = 1500 + Math.random() * 2e3, C = 0, x = !1, q = 0, H = 0, U = 0, P = performance.now();
|
|
44
|
+
const K = (A) => {
|
|
45
|
+
const D = Math.min(100, A - P);
|
|
46
|
+
P = A, y() && M();
|
|
47
|
+
const $ = o.current, { state: Q } = $, Z = { ...ve, ...$.stateColors }, G = ($.maxMouthOpening ?? 30) * m, Y = l ? 0 : $.mouseTrackingIntensity ?? 1, X = $.blinkIntervalMin ?? 2e3, ie = $.blinkIntervalMax ?? 6e3, te = $.blinkDuration ?? 100;
|
|
48
|
+
if (s == null || s.setAttribute("stroke", Z[Q]), h) {
|
|
49
|
+
const L = Q === "speaking";
|
|
50
|
+
L && (!v || J !== $.analyser) && (N = de($.analyser), J = $.analyser, v = !0), L || (v = !1);
|
|
51
|
+
let b = 0, E = 1, B = 1;
|
|
52
|
+
if (L && N) {
|
|
53
|
+
const j = N.read();
|
|
54
|
+
b = j.level, j.shape === "e" ? (E = 1.35, B = 0.55) : j.shape === "o" && (E = 0.65, B = 1.35);
|
|
55
|
+
}
|
|
56
|
+
if (u += (b - u) * 0.3, W += (E - W) * 0.25, I += (B - I) * 0.25, S) {
|
|
57
|
+
const j = d(T + u * I * G * 0.4, w);
|
|
58
|
+
h.setAttribute("height", String(Math.max(T, j)));
|
|
59
|
+
} else
|
|
60
|
+
h.setAttribute("ry", String(T + u * I * G * 0.4)), h.setAttribute("rx", String(V * (1 + (W - 1) * Math.min(1, u * 2))));
|
|
61
|
+
}
|
|
62
|
+
if (!l && z.length > 0) {
|
|
63
|
+
x ? (C += D / te, C >= 2 && (x = !1, C = 0, R = X + Math.random() * Math.max(0, ie - X))) : (R -= D, R <= 0 && (x = !0, C = 0));
|
|
64
|
+
const L = x ? 1 - Math.abs(1 - Math.min(2, C)) : 0;
|
|
65
|
+
z.forEach((b, E) => b.setAttribute("height", String(L * f[E])));
|
|
66
|
+
}
|
|
67
|
+
if (r.length > 0) {
|
|
68
|
+
let L = a.current.x * 3 * Y, b = a.current.y * 2.2 * Y;
|
|
69
|
+
Q === "thinking" ? (L = -2.5, b = -3) : Q === "working" ? (L = 0, b = 3.5) : Q === "listening" && !l && (L += Math.sin(A * 21e-4) * 0.5, b += Math.cos(A * 17e-4) * 0.4), L *= m, b *= m, r.forEach((E, B) => {
|
|
70
|
+
const j = F[B];
|
|
71
|
+
k[B].x += (L - k[B].x) * 0.12, k[B].y += (b - k[B].y) * 0.12;
|
|
72
|
+
const re = j.x + d(k[B].x, j.quantize), ne = j.y + d(k[B].y, j.quantize);
|
|
73
|
+
j.isRect ? (E.setAttribute("x", String(re)), E.setAttribute("y", String(ne))) : (E.setAttribute("cx", String(re)), E.setAttribute("cy", String(ne)));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
p && (q += ((Q === "thinking" ? 1 : 0) - q) * 0.12, p.setAttribute("opacity", String(q < 0.01 ? 0 : q)), Q === "thinking" && !l ? (H += D * 4e-3, g.forEach((b, E) => {
|
|
77
|
+
const B = 0.35 + 0.65 * Math.max(0, Math.sin(H - E * 0.9));
|
|
78
|
+
b.setAttribute("opacity", String(B));
|
|
79
|
+
})) : g.forEach((b) => b.setAttribute("opacity", "1"))), U = requestAnimationFrame(K);
|
|
80
|
+
};
|
|
81
|
+
return U = requestAnimationFrame(K), () => cancelAnimationFrame(U);
|
|
82
|
+
}, [i, l]);
|
|
83
|
+
}
|
|
84
|
+
function ue({
|
|
85
|
+
state: i,
|
|
86
|
+
analyser: n,
|
|
87
|
+
size: l = 300,
|
|
88
|
+
className: o = "",
|
|
89
|
+
style: a,
|
|
90
|
+
maxMouthOpening: t,
|
|
91
|
+
mouseTrackingIntensity: d,
|
|
92
|
+
blinkIntervalMin: s,
|
|
93
|
+
blinkIntervalMax: h,
|
|
94
|
+
blinkDuration: p,
|
|
95
|
+
stateColors: g,
|
|
96
|
+
children: r
|
|
97
|
+
}) {
|
|
98
|
+
const z = O(null);
|
|
99
|
+
return Me(z, {
|
|
100
|
+
state: i,
|
|
101
|
+
analyser: n,
|
|
102
|
+
stateColors: g,
|
|
103
|
+
maxMouthOpening: t,
|
|
104
|
+
mouseTrackingIntensity: d,
|
|
105
|
+
blinkIntervalMin: s,
|
|
106
|
+
blinkIntervalMax: h,
|
|
107
|
+
blinkDuration: p
|
|
108
|
+
}), /* @__PURE__ */ e(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
ref: z,
|
|
112
|
+
className: `relative flex items-center justify-center ${o}`,
|
|
113
|
+
style: { width: l, height: l, ...a },
|
|
114
|
+
children: r
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
function ge({
|
|
119
|
+
size: i = 300,
|
|
120
|
+
customization: n,
|
|
121
|
+
mouthColor: l = "#7a3b2e",
|
|
122
|
+
className: o,
|
|
123
|
+
style: a
|
|
124
|
+
}) {
|
|
125
|
+
const {
|
|
126
|
+
skinColor: t = "#f5c7a9",
|
|
127
|
+
hairColor: d = "#2c2c2c",
|
|
128
|
+
clothingColor: s = "#3b7b9b",
|
|
129
|
+
hoodieColor: h = "#3a3e45",
|
|
130
|
+
bgColor: p = "#88c0b7",
|
|
131
|
+
glasses: g = !0,
|
|
132
|
+
glassesColor: r = "#2c2c2c",
|
|
133
|
+
headphones: z = !0,
|
|
134
|
+
headphonesColor: S = "#3a3b40"
|
|
135
|
+
} = n ?? {};
|
|
136
|
+
return /* @__PURE__ */ c(
|
|
137
|
+
"svg",
|
|
138
|
+
{
|
|
139
|
+
viewBox: "0 0 200 200",
|
|
140
|
+
width: i,
|
|
141
|
+
height: i,
|
|
142
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
143
|
+
role: "img",
|
|
144
|
+
"aria-label": "Avatar",
|
|
145
|
+
className: o,
|
|
146
|
+
style: a,
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "78", fill: p }),
|
|
149
|
+
/* @__PURE__ */ e("clipPath", { id: "rra-clip", children: /* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "78" }) }),
|
|
150
|
+
/* @__PURE__ */ c("g", { clipPath: "url(#rra-clip)", children: [
|
|
151
|
+
/* @__PURE__ */ e("rect", { id: "rra-clothing", x: "48", y: "150", width: "104", height: "60", rx: "20", fill: s }),
|
|
152
|
+
/* @__PURE__ */ e("path", { id: "rra-hoodie", d: "M52 168 Q52 140 100 140 Q148 140 148 168 L148 210 L52 210 Z", fill: h }),
|
|
153
|
+
/* @__PURE__ */ e("rect", { id: "rra-neck", x: "88", y: "120", width: "24", height: "28", rx: "10", fill: t, opacity: "0.85" }),
|
|
154
|
+
/* @__PURE__ */ e("ellipse", { id: "rra-head", cx: "100", cy: "92", rx: "42", ry: "46", fill: t }),
|
|
155
|
+
/* @__PURE__ */ e("path", { id: "rra-hair", d: "M58 88 Q56 44 100 44 Q144 44 142 88 Q142 70 128 62 Q120 76 100 74 Q80 76 72 62 Q58 70 58 88 Z", fill: d }),
|
|
156
|
+
z && /* @__PURE__ */ c("g", { id: "rra-headphones", children: [
|
|
157
|
+
/* @__PURE__ */ e("rect", { x: "50", y: "84", width: "12", height: "26", rx: "6", fill: S }),
|
|
158
|
+
/* @__PURE__ */ e("rect", { x: "138", y: "84", width: "12", height: "26", rx: "6", fill: S }),
|
|
159
|
+
/* @__PURE__ */ e("path", { d: "M56 90 Q56 50 100 50 Q144 50 144 90", fill: "none", stroke: S, strokeWidth: "7", strokeLinecap: "round" })
|
|
160
|
+
] }),
|
|
161
|
+
/* @__PURE__ */ c("g", { id: "rra-eyeL", children: [
|
|
162
|
+
/* @__PURE__ */ e("ellipse", { cx: "84", cy: "90", rx: "9", ry: "7", fill: "#ffffff" }),
|
|
163
|
+
/* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": "84", "data-base-y": "90", cx: "84", cy: "90", r: "4", fill: "#2c2c2c" }),
|
|
164
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "17", x: "74", y: "80", width: "20", height: "0", fill: t })
|
|
165
|
+
] }),
|
|
166
|
+
/* @__PURE__ */ c("g", { id: "rra-eyeR", children: [
|
|
167
|
+
/* @__PURE__ */ e("ellipse", { cx: "116", cy: "90", rx: "9", ry: "7", fill: "#ffffff" }),
|
|
168
|
+
/* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": "116", "data-base-y": "90", cx: "116", cy: "90", r: "4", fill: "#2c2c2c" }),
|
|
169
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "17", x: "106", y: "80", width: "20", height: "0", fill: t })
|
|
170
|
+
] }),
|
|
171
|
+
g && /* @__PURE__ */ c("g", { id: "rra-glasses", children: [
|
|
172
|
+
/* @__PURE__ */ e("rect", { x: "72", y: "82", width: "24", height: "16", rx: "6", fill: "none", stroke: r, strokeWidth: "2.5" }),
|
|
173
|
+
/* @__PURE__ */ e("rect", { x: "104", y: "82", width: "24", height: "16", rx: "6", fill: "none", stroke: r, strokeWidth: "2.5" }),
|
|
174
|
+
/* @__PURE__ */ e("line", { x1: "96", y1: "90", x2: "104", y2: "90", stroke: r, strokeWidth: "2.5" })
|
|
175
|
+
] }),
|
|
176
|
+
/* @__PURE__ */ e("ellipse", { id: "rra-mouth", cx: "100", cy: "112", rx: "9", ry: "3", fill: l })
|
|
177
|
+
] }),
|
|
178
|
+
/* @__PURE__ */ c("g", { id: "rra-think", opacity: "0", children: [
|
|
179
|
+
/* @__PURE__ */ e("circle", { cx: "150", cy: "56", r: "4", fill: "#8b5cf6" }),
|
|
180
|
+
/* @__PURE__ */ e("circle", { cx: "164", cy: "44", r: "5.5", fill: "#8b5cf6" }),
|
|
181
|
+
/* @__PURE__ */ e("circle", { cx: "181", cy: "30", r: "7", fill: "#8b5cf6" })
|
|
182
|
+
] })
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
function Ae({
|
|
188
|
+
size: i = 300,
|
|
189
|
+
customization: n,
|
|
190
|
+
className: l,
|
|
191
|
+
style: o
|
|
192
|
+
}) {
|
|
193
|
+
const {
|
|
194
|
+
skinColor: a = "#f6c8a8",
|
|
195
|
+
hairColor: t = "#5b3a23",
|
|
196
|
+
bgColor: d = "#dbe7f4"
|
|
197
|
+
} = n ?? {}, s = xe().replace(/[^a-zA-Z0-9]/g, ""), h = `rra-skin-${s}`, p = `rra-bg-${s}`, g = `rra-hair-${s}`, r = `rra-mouthg-${s}`;
|
|
198
|
+
return /* @__PURE__ */ c(
|
|
199
|
+
"svg",
|
|
200
|
+
{
|
|
201
|
+
viewBox: "0 0 200 200",
|
|
202
|
+
width: i,
|
|
203
|
+
height: i,
|
|
204
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
205
|
+
role: "img",
|
|
206
|
+
"aria-label": "Avatar",
|
|
207
|
+
className: l,
|
|
208
|
+
style: o,
|
|
209
|
+
children: [
|
|
210
|
+
/* @__PURE__ */ c("defs", { children: [
|
|
211
|
+
/* @__PURE__ */ c("radialGradient", { id: h, cx: "0.38", cy: "0.32", r: "0.85", children: [
|
|
212
|
+
/* @__PURE__ */ e("stop", { offset: "0%", stopColor: "#ffffff", stopOpacity: "0.55" }),
|
|
213
|
+
/* @__PURE__ */ e("stop", { offset: "35%", stopColor: a }),
|
|
214
|
+
/* @__PURE__ */ e("stop", { offset: "100%", stopColor: a, stopOpacity: "1" })
|
|
215
|
+
] }),
|
|
216
|
+
/* @__PURE__ */ c("radialGradient", { id: p, cx: "0.5", cy: "0.35", r: "0.9", children: [
|
|
217
|
+
/* @__PURE__ */ e("stop", { offset: "0%", stopColor: "#ffffff", stopOpacity: "0.9" }),
|
|
218
|
+
/* @__PURE__ */ e("stop", { offset: "100%", stopColor: d })
|
|
219
|
+
] }),
|
|
220
|
+
/* @__PURE__ */ c("linearGradient", { id: g, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
221
|
+
/* @__PURE__ */ e("stop", { offset: "0%", stopColor: t, stopOpacity: "0.85" }),
|
|
222
|
+
/* @__PURE__ */ e("stop", { offset: "100%", stopColor: t })
|
|
223
|
+
] }),
|
|
224
|
+
/* @__PURE__ */ c("linearGradient", { id: r, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
225
|
+
/* @__PURE__ */ e("stop", { offset: "0%", stopColor: "#7c2f33" }),
|
|
226
|
+
/* @__PURE__ */ e("stop", { offset: "100%", stopColor: "#52181c" })
|
|
227
|
+
] })
|
|
228
|
+
] }),
|
|
229
|
+
/* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "78", fill: `url(#${p})` }),
|
|
230
|
+
/* @__PURE__ */ e("clipPath", { id: `rra-memoji-clip-${s}`, children: /* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "78" }) }),
|
|
231
|
+
/* @__PURE__ */ c("g", { clipPath: `url(#rra-memoji-clip-${s})`, children: [
|
|
232
|
+
/* @__PURE__ */ e("rect", { x: "86", y: "128", width: "28", height: "30", rx: "12", fill: a }),
|
|
233
|
+
/* @__PURE__ */ e("ellipse", { cx: "100", cy: "178", rx: "52", ry: "28", fill: "#ffffff", opacity: "0.85" }),
|
|
234
|
+
/* @__PURE__ */ e("ellipse", { id: "rra-head", cx: "100", cy: "94", rx: "44", ry: "48", fill: `url(#${h})` }),
|
|
235
|
+
/* @__PURE__ */ e("ellipse", { cx: "100", cy: "132", rx: "20", ry: "7", fill: "#000000", opacity: "0.06" }),
|
|
236
|
+
/* @__PURE__ */ e("ellipse", { cx: "55", cy: "96", rx: "7", ry: "11", fill: a }),
|
|
237
|
+
/* @__PURE__ */ e("ellipse", { cx: "145", cy: "96", rx: "7", ry: "11", fill: a }),
|
|
238
|
+
/* @__PURE__ */ e(
|
|
239
|
+
"path",
|
|
240
|
+
{
|
|
241
|
+
id: "rra-hair",
|
|
242
|
+
d: "M54 92 Q50 38 100 40 Q150 38 146 92 Q146 66 126 58 Q120 72 96 68 Q72 72 66 58 Q54 66 54 92 Z",
|
|
243
|
+
fill: `url(#${g})`
|
|
244
|
+
}
|
|
245
|
+
),
|
|
246
|
+
/* @__PURE__ */ e("path", { d: "M70 76 Q82 70 92 75", fill: "none", stroke: t, strokeWidth: "4", strokeLinecap: "round", opacity: "0.9" }),
|
|
247
|
+
/* @__PURE__ */ e("path", { d: "M108 75 Q118 70 130 76", fill: "none", stroke: t, strokeWidth: "4", strokeLinecap: "round", opacity: "0.9" }),
|
|
248
|
+
/* @__PURE__ */ c("g", { id: "rra-eyeL", children: [
|
|
249
|
+
/* @__PURE__ */ e("ellipse", { cx: "81", cy: "92", rx: "10.5", ry: "8.5", fill: "#ffffff" }),
|
|
250
|
+
/* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": "81", "data-base-y": "92", cx: "81", cy: "92", r: "5", fill: "#3d2c20" }),
|
|
251
|
+
/* @__PURE__ */ e("circle", { cx: "83", cy: "89.5", r: "1.7", fill: "#ffffff", opacity: "0.95" }),
|
|
252
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "19", x: "69", y: "82", width: "24", height: "0", rx: "3", fill: a })
|
|
253
|
+
] }),
|
|
254
|
+
/* @__PURE__ */ c("g", { id: "rra-eyeR", children: [
|
|
255
|
+
/* @__PURE__ */ e("ellipse", { cx: "119", cy: "92", rx: "10.5", ry: "8.5", fill: "#ffffff" }),
|
|
256
|
+
/* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": "119", "data-base-y": "92", cx: "119", cy: "92", r: "5", fill: "#3d2c20" }),
|
|
257
|
+
/* @__PURE__ */ e("circle", { cx: "121", cy: "89.5", r: "1.7", fill: "#ffffff", opacity: "0.95" }),
|
|
258
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "19", x: "107", y: "82", width: "24", height: "0", rx: "3", fill: a })
|
|
259
|
+
] }),
|
|
260
|
+
/* @__PURE__ */ e("ellipse", { cx: "70", cy: "108", rx: "8", ry: "4.5", fill: "#e98a7a", opacity: "0.35" }),
|
|
261
|
+
/* @__PURE__ */ e("ellipse", { cx: "130", cy: "108", rx: "8", ry: "4.5", fill: "#e98a7a", opacity: "0.35" }),
|
|
262
|
+
/* @__PURE__ */ e("path", { d: "M97 100 Q95 108 100 110 Q105 108 103 100", fill: "none", stroke: "#c98f6f", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.8" }),
|
|
263
|
+
/* @__PURE__ */ e("ellipse", { id: "rra-mouth", cx: "100", cy: "120", rx: "9.5", ry: "3.5", fill: `url(#${r})` })
|
|
264
|
+
] }),
|
|
265
|
+
/* @__PURE__ */ c("g", { id: "rra-think", opacity: "0", children: [
|
|
266
|
+
/* @__PURE__ */ e("circle", { cx: "150", cy: "56", r: "4", fill: "#8b5cf6" }),
|
|
267
|
+
/* @__PURE__ */ e("circle", { cx: "164", cy: "44", r: "5.5", fill: "#8b5cf6" }),
|
|
268
|
+
/* @__PURE__ */ e("circle", { cx: "181", cy: "30", r: "7", fill: "#8b5cf6" })
|
|
269
|
+
] })
|
|
270
|
+
]
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
function Le({
|
|
275
|
+
size: i = 300,
|
|
276
|
+
customization: n,
|
|
277
|
+
className: l,
|
|
278
|
+
style: o
|
|
279
|
+
}) {
|
|
280
|
+
const {
|
|
281
|
+
skinColor: a = "#f0b58a",
|
|
282
|
+
hairColor: t = "#3a2a1e",
|
|
283
|
+
clothingColor: d = "#2f6f8f",
|
|
284
|
+
bgColor: s = "#9ad1c8"
|
|
285
|
+
} = n ?? {};
|
|
286
|
+
return /* @__PURE__ */ c(
|
|
287
|
+
"svg",
|
|
288
|
+
{
|
|
289
|
+
viewBox: "0 0 32 32",
|
|
290
|
+
width: i,
|
|
291
|
+
height: i,
|
|
292
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
293
|
+
role: "img",
|
|
294
|
+
"aria-label": "Avatar",
|
|
295
|
+
className: l,
|
|
296
|
+
style: { imageRendering: "pixelated", ...o },
|
|
297
|
+
shapeRendering: "crispEdges",
|
|
298
|
+
children: [
|
|
299
|
+
/* @__PURE__ */ e("rect", { x: "2", y: "2", width: "28", height: "28", fill: s }),
|
|
300
|
+
/* @__PURE__ */ e("rect", { id: "rra-clothing", x: "8", y: "26", width: "16", height: "4", fill: d }),
|
|
301
|
+
/* @__PURE__ */ e("rect", { x: "10", y: "25", width: "12", height: "1", fill: d }),
|
|
302
|
+
/* @__PURE__ */ e("rect", { x: "14", y: "23", width: "4", height: "3", fill: a }),
|
|
303
|
+
/* @__PURE__ */ e("rect", { id: "rra-head", x: "9", y: "7", width: "14", height: "16", fill: a }),
|
|
304
|
+
/* @__PURE__ */ c("g", { id: "rra-hair", children: [
|
|
305
|
+
/* @__PURE__ */ e("rect", { x: "8", y: "4", width: "16", height: "4", fill: t }),
|
|
306
|
+
/* @__PURE__ */ e("rect", { x: "8", y: "8", width: "2", height: "5", fill: t }),
|
|
307
|
+
/* @__PURE__ */ e("rect", { x: "22", y: "8", width: "2", height: "5", fill: t }),
|
|
308
|
+
/* @__PURE__ */ e("rect", { x: "11", y: "8", width: "3", height: "1", fill: t }),
|
|
309
|
+
/* @__PURE__ */ e("rect", { x: "17", y: "8", width: "4", height: "1", fill: t })
|
|
310
|
+
] }),
|
|
311
|
+
/* @__PURE__ */ c("g", { id: "rra-eyeL", children: [
|
|
312
|
+
/* @__PURE__ */ e("rect", { x: "11", y: "12", width: "3", height: "2", fill: "#ffffff" }),
|
|
313
|
+
/* @__PURE__ */ e("rect", { className: "rra-pupil", "data-base-x": "12", "data-base-y": "12.5", "data-quantize": "1", x: "12", y: "12.5", width: "1", height: "1", fill: "#1c1c1c" }),
|
|
314
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "2", x: "11", y: "12", width: "3", height: "0", fill: a })
|
|
315
|
+
] }),
|
|
316
|
+
/* @__PURE__ */ c("g", { id: "rra-eyeR", children: [
|
|
317
|
+
/* @__PURE__ */ e("rect", { x: "18", y: "12", width: "3", height: "2", fill: "#ffffff" }),
|
|
318
|
+
/* @__PURE__ */ e("rect", { className: "rra-pupil", "data-base-x": "19", "data-base-y": "12.5", "data-quantize": "1", x: "19", y: "12.5", width: "1", height: "1", fill: "#1c1c1c" }),
|
|
319
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "2", x: "18", y: "12", width: "3", height: "0", fill: a })
|
|
320
|
+
] }),
|
|
321
|
+
/* @__PURE__ */ e("rect", { x: "15", y: "15", width: "2", height: "1", fill: "#d49a72" }),
|
|
322
|
+
/* @__PURE__ */ e("rect", { id: "rra-mouth", "data-quantize": "1", x: "13", y: "18", width: "6", height: "1", fill: "#5a1f1f" }),
|
|
323
|
+
/* @__PURE__ */ c("g", { id: "rra-think", opacity: "0", children: [
|
|
324
|
+
/* @__PURE__ */ e("rect", { x: "24", y: "9", width: "1", height: "1", fill: "#8b5cf6" }),
|
|
325
|
+
/* @__PURE__ */ e("rect", { x: "26", y: "7", width: "1.5", height: "1.5", fill: "#8b5cf6" }),
|
|
326
|
+
/* @__PURE__ */ e("rect", { x: "28", y: "4", width: "2", height: "2", fill: "#8b5cf6" })
|
|
327
|
+
] })
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
function Ne({
|
|
333
|
+
size: i = 300,
|
|
334
|
+
customization: n,
|
|
335
|
+
inkColor: l = "#2f2a26",
|
|
336
|
+
className: o,
|
|
337
|
+
style: a
|
|
338
|
+
}) {
|
|
339
|
+
const {
|
|
340
|
+
skinColor: t = "#fdf6ec",
|
|
341
|
+
// paper tone by default
|
|
342
|
+
hairColor: d = "#2f2a26",
|
|
343
|
+
bgColor: s = "#fffdf8"
|
|
344
|
+
} = n ?? {};
|
|
345
|
+
return /* @__PURE__ */ c(
|
|
346
|
+
"svg",
|
|
347
|
+
{
|
|
348
|
+
viewBox: "0 0 200 200",
|
|
349
|
+
width: i,
|
|
350
|
+
height: i,
|
|
351
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
352
|
+
role: "img",
|
|
353
|
+
"aria-label": "Avatar",
|
|
354
|
+
className: o,
|
|
355
|
+
style: a,
|
|
356
|
+
children: [
|
|
357
|
+
/* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "79", fill: s }),
|
|
358
|
+
/* @__PURE__ */ e("clipPath", { id: "rra-doodle-clip", children: /* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "79" }) }),
|
|
359
|
+
/* @__PURE__ */ c("g", { clipPath: "url(#rra-doodle-clip)", children: [
|
|
360
|
+
/* @__PURE__ */ e("path", { d: "M52 182 Q60 148 100 146 Q140 148 148 182", fill: "#ffffff", stroke: l, strokeWidth: "3", strokeLinecap: "round" }),
|
|
361
|
+
/* @__PURE__ */ e("path", { d: "M88 150 L86 134 M112 150 L114 134", fill: "none", stroke: l, strokeWidth: "2.5", strokeLinecap: "round" }),
|
|
362
|
+
/* @__PURE__ */ e(
|
|
363
|
+
"path",
|
|
364
|
+
{
|
|
365
|
+
id: "rra-head",
|
|
366
|
+
d: `M100 46
|
|
367
|
+
Q140 44 143 90
|
|
368
|
+
Q145 122 122 134
|
|
369
|
+
Q101 143 79 133
|
|
370
|
+
Q56 121 58 88
|
|
371
|
+
Q62 45 100 46 Z`,
|
|
372
|
+
fill: t,
|
|
373
|
+
stroke: l,
|
|
374
|
+
strokeWidth: "3.5",
|
|
375
|
+
strokeLinecap: "round"
|
|
376
|
+
}
|
|
377
|
+
),
|
|
378
|
+
/* @__PURE__ */ c("g", { id: "rra-hair", fill: "none", stroke: d, strokeWidth: "3", strokeLinecap: "round", children: [
|
|
379
|
+
/* @__PURE__ */ e("path", { d: "M62 84 Q58 52 88 47 Q72 56 74 64 Q80 50 104 46 Q92 54 96 60 Q106 48 126 52 Q116 58 120 64 Q130 56 140 78 Q132 66 122 68" }),
|
|
380
|
+
/* @__PURE__ */ e("path", { d: "M66 76 Q70 62 82 58", opacity: "0.7" }),
|
|
381
|
+
/* @__PURE__ */ e("path", { d: "M118 56 Q130 62 134 76", opacity: "0.7" })
|
|
382
|
+
] }),
|
|
383
|
+
/* @__PURE__ */ e("path", { d: "M70 80 Q80 74 90 78", fill: "none", stroke: l, strokeWidth: "3", strokeLinecap: "round" }),
|
|
384
|
+
/* @__PURE__ */ e("path", { d: "M110 78 Q120 74 130 80", fill: "none", stroke: l, strokeWidth: "3", strokeLinecap: "round" }),
|
|
385
|
+
/* @__PURE__ */ c("g", { id: "rra-eyeL", children: [
|
|
386
|
+
/* @__PURE__ */ e("ellipse", { cx: "82", cy: "92", rx: "9", ry: "7.5", fill: "#ffffff", stroke: l, strokeWidth: "2.5" }),
|
|
387
|
+
/* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": "82", "data-base-y": "92", cx: "82", cy: "92", r: "3.4", fill: l }),
|
|
388
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "17", x: "72", y: "83", width: "20", height: "0", fill: t })
|
|
389
|
+
] }),
|
|
390
|
+
/* @__PURE__ */ c("g", { id: "rra-eyeR", children: [
|
|
391
|
+
/* @__PURE__ */ e("ellipse", { cx: "118", cy: "92", rx: "9", ry: "7.5", fill: "#ffffff", stroke: l, strokeWidth: "2.5" }),
|
|
392
|
+
/* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": "118", "data-base-y": "92", cx: "118", cy: "92", r: "3.4", fill: l }),
|
|
393
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "17", x: "108", y: "83", width: "20", height: "0", fill: t })
|
|
394
|
+
] }),
|
|
395
|
+
/* @__PURE__ */ e("path", { d: "M99 100 Q96 110 103 112", fill: "none", stroke: l, strokeWidth: "2.5", strokeLinecap: "round" }),
|
|
396
|
+
/* @__PURE__ */ e("ellipse", { id: "rra-mouth", cx: "100", cy: "122", rx: "9", ry: "2.5", fill: "#3a2e28", stroke: l, strokeWidth: "2" }),
|
|
397
|
+
/* @__PURE__ */ e("path", { d: "M64 106 L70 102 M67 110 L73 106", stroke: l, strokeWidth: "1.5", strokeLinecap: "round", opacity: "0.45" })
|
|
398
|
+
] }),
|
|
399
|
+
/* @__PURE__ */ c("g", { id: "rra-think", opacity: "0", children: [
|
|
400
|
+
/* @__PURE__ */ e("circle", { cx: "150", cy: "56", r: "4", fill: "#ffffff", stroke: "#8b5cf6", strokeWidth: "2" }),
|
|
401
|
+
/* @__PURE__ */ e("circle", { cx: "164", cy: "44", r: "5.5", fill: "#ffffff", stroke: "#8b5cf6", strokeWidth: "2" }),
|
|
402
|
+
/* @__PURE__ */ e("circle", { cx: "181", cy: "30", r: "7", fill: "#ffffff", stroke: "#8b5cf6", strokeWidth: "2.5" })
|
|
403
|
+
] })
|
|
404
|
+
]
|
|
405
|
+
}
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
function fe(i) {
|
|
409
|
+
return i.replace(/-([a-z])/g, (n, l) => l.toUpperCase());
|
|
410
|
+
}
|
|
411
|
+
const Qe = [
|
|
412
|
+
["pixel-art", "Pixel Art"],
|
|
413
|
+
["pixel-art-neutral", "Pixel Art Neutral"],
|
|
414
|
+
["lorelei", "Lorelei"],
|
|
415
|
+
["lorelei-neutral", "Lorelei Neutral"],
|
|
416
|
+
["notionists", "Notionists"],
|
|
417
|
+
["notionists-neutral", "Notionists Neutral"],
|
|
418
|
+
["open-peeps", "Open Peeps"],
|
|
419
|
+
["thumbs", "Thumbs"]
|
|
420
|
+
].map(([i, n]) => ({
|
|
421
|
+
id: i,
|
|
422
|
+
exportName: fe(i),
|
|
423
|
+
label: n,
|
|
424
|
+
license: "CC0 1.0"
|
|
425
|
+
}));
|
|
426
|
+
function me(i, n) {
|
|
427
|
+
const l = /* @__PURE__ */ new Set(), o = /\bid="([^"]+)"/g;
|
|
428
|
+
let a;
|
|
429
|
+
for (; a = o.exec(i); ) l.add(a[1]);
|
|
430
|
+
let t = i;
|
|
431
|
+
for (const d of l) {
|
|
432
|
+
const s = d.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
433
|
+
t = t.replace(new RegExp(`id="${s}"`, "g"), `id="${n}-${d}"`).replace(new RegExp(`url\\(#${s}\\)`, "g"), `url(#${n}-${d})`).replace(new RegExp(`(xlink:href|href)="#${s}"`, "g"), `$1="#${n}-${d}"`);
|
|
434
|
+
}
|
|
435
|
+
return t;
|
|
436
|
+
}
|
|
437
|
+
const We = {
|
|
438
|
+
"pixel-art": { part: "mouth", visemes: ["happy01", "happy11", "happy12"] },
|
|
439
|
+
"pixel-art-neutral": { part: "mouth", visemes: ["happy01", "happy11", "happy12"] },
|
|
440
|
+
lorelei: { part: "mouth", visemes: ["happy01", "happy08", "happy06"] },
|
|
441
|
+
"lorelei-neutral": { part: "mouth", visemes: ["happy01", "happy08", "happy06"] },
|
|
442
|
+
notionists: {
|
|
443
|
+
part: "lips",
|
|
444
|
+
visemes: ["variant23", "variant26", "variant30"],
|
|
445
|
+
blink: { open: "variant03", closed: "variant01" }
|
|
446
|
+
},
|
|
447
|
+
"notionists-neutral": {
|
|
448
|
+
part: "lips",
|
|
449
|
+
visemes: ["variant23", "variant26", "variant30"],
|
|
450
|
+
blink: { open: "variant03", closed: "variant01" }
|
|
451
|
+
},
|
|
452
|
+
thumbs: { part: "mouth", visemes: ["variant3", "variant1", "variant2"] },
|
|
453
|
+
"open-peeps": { part: "face", visemes: ["calm", "smile", "smileBig"], faceBlink: "eyesClosed" }
|
|
454
|
+
// Every curated style is rigged. A non-rigged style id (e.g. an abstract one
|
|
455
|
+
// a host passes itself) gets the audio-reactive bounce fallback instead.
|
|
456
|
+
}, ye = [
|
|
457
|
+
{ collection: "notionists", seed: "lg9gf48i" },
|
|
458
|
+
{ collection: "notionists", seed: "8c1jvg09" },
|
|
459
|
+
{ collection: "notionists", seed: "glk0g9uv" },
|
|
460
|
+
{ collection: "notionists", seed: "pp70crp6" },
|
|
461
|
+
{ collection: "open-peeps", seed: "2ehwdy6e" },
|
|
462
|
+
{ collection: "open-peeps", seed: "1q3sb396" },
|
|
463
|
+
{ collection: "open-peeps", seed: "k8adqmt7" },
|
|
464
|
+
{ collection: "open-peeps", seed: "x6kn3bke" },
|
|
465
|
+
{ collection: "lorelei", seed: "b2wi3z2j" },
|
|
466
|
+
{ collection: "lorelei", seed: "lp1iegj9" },
|
|
467
|
+
{ collection: "lorelei", seed: "6umh2s52" },
|
|
468
|
+
{ collection: "pixel-art", seed: "smmje3r6" },
|
|
469
|
+
{ collection: "pixel-art", seed: "wxhz14w1" },
|
|
470
|
+
{ collection: "pixel-art", seed: "uovelmrj" }
|
|
471
|
+
], Se = ye[0].collection, Re = ye[0].seed, Ze = Object.fromEntries(Qe.map((i) => [i.id, i]));
|
|
472
|
+
let oe = null;
|
|
473
|
+
function ke() {
|
|
474
|
+
return oe || (oe = Promise.all([
|
|
475
|
+
import("@dicebear/core"),
|
|
476
|
+
import("@dicebear/collection")
|
|
477
|
+
]).then(([i, n]) => ({
|
|
478
|
+
createAvatar: i.createAvatar,
|
|
479
|
+
collection: n
|
|
480
|
+
}))), oe;
|
|
481
|
+
}
|
|
482
|
+
async function $e(i, n, l = {}) {
|
|
483
|
+
const { createAvatar: o, collection: a } = await ke(), t = a[fe(String(i))];
|
|
484
|
+
if (!t) throw new Error(`Unknown DiceBear style "${i}"`);
|
|
485
|
+
return o(t, { seed: n, ...l }).toString();
|
|
486
|
+
}
|
|
487
|
+
function Ee(i, n, l, o, a) {
|
|
488
|
+
const t = [], d = (s, h) => t.push({
|
|
489
|
+
key: s,
|
|
490
|
+
html: me(i(n, { ...l, ...h }).toString(), `${a}-${s}`)
|
|
491
|
+
});
|
|
492
|
+
if (o.part === "face")
|
|
493
|
+
o.visemes.forEach((s, h) => d(`m${h}`, { face: [s] })), o.faceBlink && d("blink", { face: [o.faceBlink] });
|
|
494
|
+
else {
|
|
495
|
+
const s = o.blink ? [
|
|
496
|
+
["o", { eyes: [o.blink.open] }],
|
|
497
|
+
["c", { eyes: [o.blink.closed] }]
|
|
498
|
+
] : [["o", {}]];
|
|
499
|
+
o.visemes.forEach((h, p) => {
|
|
500
|
+
for (const [g, r] of s) d(`m${p}-${g}`, { [o.part]: [h], ...r });
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
return t;
|
|
504
|
+
}
|
|
505
|
+
function Be({
|
|
506
|
+
state: i,
|
|
507
|
+
analyser: n,
|
|
508
|
+
size: l = 300,
|
|
509
|
+
collection: o = Se,
|
|
510
|
+
seed: a = Re,
|
|
511
|
+
backgroundColor: t,
|
|
512
|
+
radius: d,
|
|
513
|
+
className: s = "",
|
|
514
|
+
style: h,
|
|
515
|
+
maxMouthOpening: p = 30,
|
|
516
|
+
stateColors: g
|
|
517
|
+
}) {
|
|
518
|
+
const r = se(), S = `rra-db-${xe().replace(/[^a-zA-Z0-9]/g, "")}`, T = O(null), V = O(/* @__PURE__ */ new Map()), w = O(null), [m, F] = ce(null), [f, k] = ce(null), [M, y] = ce(null), N = O({ state: i, analyser: n, maxMouthOpening: p });
|
|
519
|
+
N.current = { state: i, analyser: n, maxMouthOpening: p };
|
|
520
|
+
const J = (t == null ? void 0 : t.join(",")) ?? "";
|
|
521
|
+
ee(() => {
|
|
522
|
+
let u = !1;
|
|
523
|
+
return F(null), y(null), ke().then(({ createAvatar: W, collection: I }) => {
|
|
524
|
+
if (u) return;
|
|
525
|
+
const R = I[fe(String(o))];
|
|
526
|
+
if (!R) {
|
|
527
|
+
y(`Unknown DiceBear style "${o}"`);
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
const C = { seed: a };
|
|
531
|
+
t && t.length && (C.backgroundColor = t), d != null && (C.radius = d);
|
|
532
|
+
const x = We[String(o)] ?? null;
|
|
533
|
+
V.current = /* @__PURE__ */ new Map(), x ? (k(x), F(Ee(W, R, C, x, S))) : (k(null), F([{ key: "base", html: me(W(R, C).toString(), `${S}-base`) }]));
|
|
534
|
+
}).catch((W) => {
|
|
535
|
+
if (u) return;
|
|
536
|
+
const I = (W == null ? void 0 : W.message) || String(W);
|
|
537
|
+
y(/Cannot find module|Failed to (resolve|fetch)|dicebear/i.test(I) ? "missing" : I);
|
|
538
|
+
}), () => {
|
|
539
|
+
u = !0;
|
|
540
|
+
};
|
|
541
|
+
}, [o, a, d, J]), ee(() => {
|
|
542
|
+
const u = T.current;
|
|
543
|
+
if (!u || !m || m.length === 0 || typeof window > "u") return;
|
|
544
|
+
const W = V.current, I = !!(f && (f.blink || f.faceBlink));
|
|
545
|
+
let R = null, C = null, x = 0, q = 0, H = 1500 + Math.random() * 2500, U = 0, P = !1, K = 0, A = "", D = performance.now();
|
|
546
|
+
const $ = (Z) => {
|
|
547
|
+
if (Z === A) return;
|
|
548
|
+
const G = W.get(Z) ?? W.get(m[0].key);
|
|
549
|
+
W.forEach((Y) => {
|
|
550
|
+
Y.style.visibility = Y === G ? "visible" : "hidden";
|
|
551
|
+
}), A = Z;
|
|
552
|
+
}, Q = (Z) => {
|
|
553
|
+
const G = Math.min(100, Z - D);
|
|
554
|
+
D = Z;
|
|
555
|
+
const { state: Y, analyser: X, maxMouthOpening: ie } = N.current, te = Y === "speaking", L = ie / 30;
|
|
556
|
+
if (te ? ((!R || C !== X) && (R = de(X), C = X), x += (R.read().level - x) * 0.3) : (R = null, C = null, x += (0 - x) * 0.25), I && !r && (P ? (U += G, U >= 160 && (P = !1, H = 1800 + Math.random() * 3500)) : (H -= G, H <= 0 && (P = !0, U = 0))), f) {
|
|
557
|
+
let b = K;
|
|
558
|
+
if (K === 0 ? x > 0.13 && (b = x > 0.36 ? 2 : 1) : K === 1 ? x > 0.36 ? b = 2 : x < 0.09 && (b = 0) : x < 0.1 ? b = 0 : x < 0.3 && (b = 1), K = te ? b : 0, f.part === "face")
|
|
559
|
+
$(P && f.faceBlink ? "blink" : `m${K}`);
|
|
560
|
+
else {
|
|
561
|
+
const be = P && f.blink ? "c" : "o";
|
|
562
|
+
$(`m${K}-${be}`);
|
|
563
|
+
}
|
|
564
|
+
let E = 0, B = 0;
|
|
565
|
+
r || (q += G * 2e-3, E = Math.sin(q) * 8e-3, Y === "listening" && (B = Math.sin(q * 1.6) * 1.2));
|
|
566
|
+
const j = x * 4 * L, re = 1 + x * 0.04 * L + E, ne = 1 - x * 0.02 * L + E;
|
|
567
|
+
u.style.transform = `translateY(${(-j + B).toFixed(2)}px) scale(${ne.toFixed(4)}, ${re.toFixed(4)})`;
|
|
568
|
+
} else {
|
|
569
|
+
let b = 0;
|
|
570
|
+
r || (q += G * 2e-3, b = Math.sin(q) * 0.012);
|
|
571
|
+
const E = x * 10 * L, B = 1 + x * 0.1 * L + b, j = 1 - x * 0.05 * L + b, re = Y === "thinking" && !r ? -4 : 0;
|
|
572
|
+
u.style.transform = `translateY(${(-E).toFixed(2)}px) scale(${j.toFixed(4)}, ${B.toFixed(4)}) rotate(${re}deg)`;
|
|
573
|
+
}
|
|
574
|
+
w.current = requestAnimationFrame(Q);
|
|
575
|
+
};
|
|
576
|
+
return u.style.transformOrigin = "center bottom", w.current = requestAnimationFrame(Q), () => {
|
|
577
|
+
w.current && cancelAnimationFrame(w.current);
|
|
578
|
+
};
|
|
579
|
+
}, [m, f, r]);
|
|
580
|
+
const v = (g == null ? void 0 : g[i]) ?? "#10b981";
|
|
581
|
+
return /* @__PURE__ */ c(
|
|
582
|
+
"div",
|
|
583
|
+
{
|
|
584
|
+
className: `relative flex items-center justify-center ${s}`,
|
|
585
|
+
style: { width: l, height: l, ...h },
|
|
586
|
+
children: [
|
|
587
|
+
m && /* @__PURE__ */ e("div", { ref: T, className: "relative w-full h-full", role: "img", "aria-label": "Avatar", children: m.map((u, W) => /* @__PURE__ */ e(
|
|
588
|
+
"div",
|
|
589
|
+
{
|
|
590
|
+
ref: (I) => {
|
|
591
|
+
I ? V.current.set(u.key, I) : V.current.delete(u.key);
|
|
592
|
+
},
|
|
593
|
+
dangerouslySetInnerHTML: { __html: u.html },
|
|
594
|
+
className: "absolute inset-0 [&>svg]:w-full [&>svg]:h-full",
|
|
595
|
+
style: { visibility: W === 0 ? "visible" : "hidden" }
|
|
596
|
+
},
|
|
597
|
+
u.key
|
|
598
|
+
)) }),
|
|
599
|
+
!m && !M && /* @__PURE__ */ c("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
600
|
+
/* @__PURE__ */ e(
|
|
601
|
+
"div",
|
|
602
|
+
{
|
|
603
|
+
className: "w-8 h-8 border-4 rounded-full animate-spin mb-2",
|
|
604
|
+
style: { borderColor: `${v}33`, borderTopColor: v }
|
|
605
|
+
}
|
|
606
|
+
),
|
|
607
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-mono font-bold tracking-widest text-zinc-400 animate-pulse", children: "GENERATING AVATAR…" })
|
|
608
|
+
] }),
|
|
609
|
+
M === "missing" && /* @__PURE__ */ c("div", { className: "absolute inset-0 flex flex-col items-center justify-center bg-zinc-950/90 backdrop-blur-md rounded-2xl p-4 text-center", children: [
|
|
610
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-mono font-bold text-amber-400 uppercase tracking-wider mb-2", children: "DiceBear not installed" }),
|
|
611
|
+
/* @__PURE__ */ e("p", { className: "text-[10px] text-zinc-500 max-w-[220px] leading-relaxed mb-2", children: "Install the optional peer dependencies to use this variant:" }),
|
|
612
|
+
/* @__PURE__ */ e("code", { className: "text-[10px] text-zinc-300 bg-zinc-900 px-2 py-1 rounded border border-zinc-800 break-all", children: "npm i @dicebear/core @dicebear/collection" })
|
|
613
|
+
] }),
|
|
614
|
+
M && M !== "missing" && /* @__PURE__ */ c("div", { className: "absolute inset-0 flex flex-col items-center justify-center bg-zinc-950/90 backdrop-blur-md rounded-2xl p-4 text-center", children: [
|
|
615
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-mono font-bold text-red-400 uppercase tracking-wider mb-2", children: "Failed to generate" }),
|
|
616
|
+
/* @__PURE__ */ e("p", { className: "text-[10px] text-zinc-500 max-w-[220px] leading-relaxed break-all", children: M })
|
|
617
|
+
] })
|
|
618
|
+
]
|
|
619
|
+
}
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
function Te(i, n) {
|
|
623
|
+
return n === i ? { type: "none" } : n.length > i.length && n.startsWith(i) ? { type: "push", text: n.slice(i.length) } : { type: "reset", seed: n };
|
|
624
|
+
}
|
|
625
|
+
function Fe(i) {
|
|
626
|
+
const n = O(null);
|
|
627
|
+
n.current === null && (n.current = we());
|
|
628
|
+
const l = O("");
|
|
629
|
+
return ee(() => {
|
|
630
|
+
if (i === void 0) return;
|
|
631
|
+
const o = n.current, a = Te(l.current, i);
|
|
632
|
+
a.type === "push" ? o.push(a.text) : a.type === "reset" && (o.reset(), a.seed && o.push(a.seed)), l.current = i;
|
|
633
|
+
}, [i]), i === void 0 ? null : n.current;
|
|
634
|
+
}
|
|
635
|
+
function _(i, n) {
|
|
636
|
+
if (!i || !i.startsWith("#")) return i || "transparent";
|
|
637
|
+
const l = i.replace("#", "");
|
|
638
|
+
let o = 0, a = 0, t = 0;
|
|
639
|
+
return l.length === 3 ? (o = parseInt(l[0] + l[0], 16), a = parseInt(l[1] + l[1], 16), t = parseInt(l[2] + l[2], 16)) : l.length === 6 && (o = parseInt(l.substring(0, 2), 16), a = parseInt(l.substring(2, 4), 16), t = parseInt(l.substring(4, 6), 16)), `rgba(${o}, ${a}, ${t}, ${n})`;
|
|
640
|
+
}
|
|
641
|
+
const Ce = le.lazy(
|
|
642
|
+
() => import("./VrmAvatar-CehRzj0J.js").then((i) => ({ default: i.VrmAvatar }))
|
|
643
|
+
), qe = le.lazy(
|
|
644
|
+
() => import("./GlbArkitAvatar-Dm9STiyR.js").then((i) => ({ default: i.GlbArkitAvatar }))
|
|
645
|
+
);
|
|
646
|
+
function je({
|
|
647
|
+
state: i,
|
|
648
|
+
analyser: n = null,
|
|
649
|
+
speechActivity: l,
|
|
650
|
+
streamingText: o,
|
|
651
|
+
size: a = 280,
|
|
652
|
+
variant: t = "geometric",
|
|
653
|
+
children: d,
|
|
654
|
+
vrmUrl: s,
|
|
655
|
+
glbUrl: h,
|
|
656
|
+
subtitle: p,
|
|
657
|
+
thought: g,
|
|
658
|
+
tool: r,
|
|
659
|
+
showGlow: z = !0,
|
|
660
|
+
showStatePill: S = !0,
|
|
661
|
+
showThought: T = !0,
|
|
662
|
+
showSubtitle: V = !0,
|
|
663
|
+
className: w = "",
|
|
664
|
+
style: m,
|
|
665
|
+
dicebearCollection: F,
|
|
666
|
+
dicebearSeed: f,
|
|
667
|
+
maxMouthOpening: k,
|
|
668
|
+
blinkIntervalMin: M,
|
|
669
|
+
blinkIntervalMax: y,
|
|
670
|
+
blinkDuration: N,
|
|
671
|
+
mouseTrackingIntensity: J,
|
|
672
|
+
stateColors: v,
|
|
673
|
+
stateLabels: u,
|
|
674
|
+
customization: W
|
|
675
|
+
}) {
|
|
676
|
+
const I = Fe(o), R = l ?? I, C = R ?? n, x = {
|
|
677
|
+
state: i,
|
|
678
|
+
analyser: C,
|
|
679
|
+
size: a,
|
|
680
|
+
maxMouthOpening: k,
|
|
681
|
+
blinkIntervalMin: M,
|
|
682
|
+
blinkIntervalMax: y,
|
|
683
|
+
blinkDuration: N,
|
|
684
|
+
mouseTrackingIntensity: J,
|
|
685
|
+
stateColors: v,
|
|
686
|
+
customization: W
|
|
687
|
+
};
|
|
688
|
+
let q;
|
|
689
|
+
if (t === "vrm")
|
|
690
|
+
q = /* @__PURE__ */ e(he, { fallback: null, children: /* @__PURE__ */ e(Ce, { ...x, vrmUrl: s }) });
|
|
691
|
+
else if (t === "glb")
|
|
692
|
+
q = /* @__PURE__ */ e(he, { fallback: null, children: /* @__PURE__ */ e(qe, { ...x, glbUrl: h }) });
|
|
693
|
+
else if (t === "dicebear")
|
|
694
|
+
q = /* @__PURE__ */ e(
|
|
695
|
+
Be,
|
|
696
|
+
{
|
|
697
|
+
state: i,
|
|
698
|
+
analyser: C,
|
|
699
|
+
size: a,
|
|
700
|
+
maxMouthOpening: k,
|
|
701
|
+
stateColors: v,
|
|
702
|
+
collection: F,
|
|
703
|
+
seed: f
|
|
704
|
+
}
|
|
705
|
+
);
|
|
706
|
+
else if (t === "byos")
|
|
707
|
+
q = /* @__PURE__ */ e(ue, { ...x, children: d });
|
|
708
|
+
else {
|
|
709
|
+
const Z = {
|
|
710
|
+
geometric: ge,
|
|
711
|
+
memoji: Ae,
|
|
712
|
+
pixelart: Le,
|
|
713
|
+
doodle: Ne
|
|
714
|
+
}[t] ?? ge;
|
|
715
|
+
q = // Keyed by variant so switching presets remounts the runtime cleanly
|
|
716
|
+
/* @__PURE__ */ e(ue, { ...x, children: /* @__PURE__ */ e(Z, { size: a, customization: W, state: i }) }, t);
|
|
717
|
+
}
|
|
718
|
+
const H = pe(1), U = pe(0.15), P = O(null), K = se(), A = {
|
|
719
|
+
idle: (v == null ? void 0 : v.idle) ?? "#4b5563",
|
|
720
|
+
// gray-600
|
|
721
|
+
listening: (v == null ? void 0 : v.listening) ?? "#3b82f6",
|
|
722
|
+
// blue-500
|
|
723
|
+
thinking: (v == null ? void 0 : v.thinking) ?? "#8b5cf6",
|
|
724
|
+
// purple-500
|
|
725
|
+
speaking: (v == null ? void 0 : v.speaking) ?? "#10b981",
|
|
726
|
+
// emerald-500
|
|
727
|
+
working: (v == null ? void 0 : v.working) ?? "#f59e0b"
|
|
728
|
+
// amber-500
|
|
729
|
+
}, D = {
|
|
730
|
+
idle: (u == null ? void 0 : u.idle) ?? "Idle",
|
|
731
|
+
listening: (u == null ? void 0 : u.listening) ?? "Listening",
|
|
732
|
+
thinking: (u == null ? void 0 : u.thinking) ?? "Thinking...",
|
|
733
|
+
speaking: (u == null ? void 0 : u.speaking) ?? "Speaking",
|
|
734
|
+
working: (u == null ? void 0 : u.working) ?? "Working"
|
|
735
|
+
}, $ = {
|
|
736
|
+
idle: _(A.idle, 0.15),
|
|
737
|
+
listening: _(A.listening, 0.35),
|
|
738
|
+
thinking: _(A.thinking, 0.4),
|
|
739
|
+
speaking: _(A.speaking, 0.45),
|
|
740
|
+
working: _(A.working, 0.4)
|
|
741
|
+
};
|
|
742
|
+
return ee(() => {
|
|
743
|
+
if (!(n && (i === "speaking" || i === "listening")) && !(!n && R && i === "speaking")) {
|
|
744
|
+
H.set(i === "thinking" || i === "working" ? 1.05 : 1), U.set(i === "thinking" || i === "working" ? 0.35 : 0.15), P.current && cancelAnimationFrame(P.current);
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
const G = n ? new Uint8Array(n.frequencyBinCount) : null, Y = () => {
|
|
748
|
+
let X;
|
|
749
|
+
if (n && G) {
|
|
750
|
+
n.getByteTimeDomainData(G);
|
|
751
|
+
let ie = 0;
|
|
752
|
+
for (let te = 0; te < G.length; te++) {
|
|
753
|
+
const L = Math.abs(G[te] - 128);
|
|
754
|
+
L > ie && (ie = L);
|
|
755
|
+
}
|
|
756
|
+
X = Math.min(1, ie / 128);
|
|
757
|
+
} else
|
|
758
|
+
X = R ? R.sample() : 0;
|
|
759
|
+
H.set(1 + X * 0.35), U.set(0.15 + X * 0.35), P.current = requestAnimationFrame(Y);
|
|
760
|
+
};
|
|
761
|
+
return P.current = requestAnimationFrame(Y), () => {
|
|
762
|
+
P.current && cancelAnimationFrame(P.current);
|
|
763
|
+
};
|
|
764
|
+
}, [n, R, i, H, U]), /* @__PURE__ */ c("div", { className: `relative flex flex-col items-center justify-center ${w}`, style: { width: a, height: a, ...m }, children: [
|
|
765
|
+
z && /* @__PURE__ */ e(
|
|
766
|
+
ae.div,
|
|
767
|
+
{
|
|
768
|
+
className: "absolute rounded-[1.75rem] pointer-events-none filter blur-2xl",
|
|
769
|
+
style: {
|
|
770
|
+
width: a * 0.9,
|
|
771
|
+
height: a * 0.9,
|
|
772
|
+
backgroundColor: A[i],
|
|
773
|
+
scale: H,
|
|
774
|
+
opacity: U
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
),
|
|
778
|
+
/* @__PURE__ */ e("div", { className: "w-full h-full relative flex items-center justify-center z-10", children: q }),
|
|
779
|
+
T && g && /* @__PURE__ */ e(
|
|
780
|
+
ae.div,
|
|
781
|
+
{
|
|
782
|
+
initial: { opacity: 0, y: 15, scale: 0.95 },
|
|
783
|
+
animate: { opacity: 1, y: 0, scale: 1 },
|
|
784
|
+
transition: { duration: 0.3 },
|
|
785
|
+
className: "absolute bottom-[108%] left-1/2 -translate-x-1/2 w-[90vw] max-w-[340px] md:max-w-[420px] text-left pointer-events-none z-40",
|
|
786
|
+
children: /* @__PURE__ */ c("div", { className: "relative bg-zinc-900/90 backdrop-blur-xl text-zinc-100 px-5 py-4 rounded-3xl shadow-[0_10px_30px_rgba(139,92,246,0.15)] border border-purple-500/25 text-sm italic break-words", children: [
|
|
787
|
+
/* @__PURE__ */ c("div", { className: "text-purple-400 text-[10px] uppercase tracking-widest font-mono font-bold mb-1 flex items-center gap-1.5", children: [
|
|
788
|
+
/* @__PURE__ */ e("span", { className: "w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse" }),
|
|
789
|
+
"Thought process"
|
|
790
|
+
] }),
|
|
791
|
+
/* @__PURE__ */ e("p", { className: "leading-relaxed text-zinc-200", children: g }),
|
|
792
|
+
/* @__PURE__ */ e("div", { className: "absolute -bottom-3 left-1/2 -translate-x-1/2 w-4 h-4 bg-zinc-900/90 rounded-full border border-purple-500/20 shadow-md backdrop-blur-md" }),
|
|
793
|
+
/* @__PURE__ */ e("div", { className: "absolute -bottom-6 left-[48%] -translate-x-1/2 w-2.5 h-2.5 bg-zinc-900/90 rounded-full border border-purple-500/15 shadow-sm backdrop-blur-md" }),
|
|
794
|
+
/* @__PURE__ */ e("div", { className: "absolute -bottom-8 left-[47%] -translate-x-1/2 w-1.5 h-1.5 bg-zinc-900/90 rounded-full border border-purple-500/10 backdrop-blur-md" })
|
|
795
|
+
] })
|
|
796
|
+
}
|
|
797
|
+
),
|
|
798
|
+
S && /* @__PURE__ */ e(
|
|
799
|
+
ae.div,
|
|
800
|
+
{
|
|
801
|
+
role: "status",
|
|
802
|
+
"aria-live": "polite",
|
|
803
|
+
className: "absolute -bottom-6 px-4 py-1.5 rounded-full text-xs font-bold text-white uppercase tracking-widest shadow-lg z-30 cursor-default select-none border border-white/10",
|
|
804
|
+
animate: {
|
|
805
|
+
backgroundColor: A[i],
|
|
806
|
+
boxShadow: `0 4px 14px rgba(0,0,0,0.4), 0 0 16px ${$[i]}`
|
|
807
|
+
},
|
|
808
|
+
transition: { duration: 0.3 },
|
|
809
|
+
children: /* @__PURE__ */ c("span", { className: "flex items-center gap-1.5", children: [
|
|
810
|
+
/* @__PURE__ */ e("span", { className: `w-2 h-2 rounded-full bg-white ${!K && (i === "speaking" || i === "thinking") ? "animate-ping" : ""}` }),
|
|
811
|
+
i === "working" && r ? `Working: ${r}` : D[i]
|
|
812
|
+
] })
|
|
813
|
+
}
|
|
814
|
+
),
|
|
815
|
+
V && p && /* @__PURE__ */ e(
|
|
816
|
+
ae.div,
|
|
817
|
+
{
|
|
818
|
+
initial: { opacity: 0, y: -10 },
|
|
819
|
+
animate: { opacity: 1, y: 0 },
|
|
820
|
+
transition: { duration: 0.2 },
|
|
821
|
+
className: "absolute top-[115%] left-1/2 -translate-x-1/2 w-[90vw] max-w-[500px] md:max-w-[640px] text-center pointer-events-none z-50 pb-8",
|
|
822
|
+
children: /* @__PURE__ */ e(
|
|
823
|
+
"span",
|
|
824
|
+
{
|
|
825
|
+
className: "inline-block px-6 py-4 text-base md:text-lg font-medium text-zinc-100 break-words leading-relaxed shadow-2xl border",
|
|
826
|
+
style: {
|
|
827
|
+
textShadow: "0px 1px 3px rgba(0,0,0,0.5)",
|
|
828
|
+
background: "rgba(9, 9, 11, 0.8)",
|
|
829
|
+
// zinc-950 at 0.8
|
|
830
|
+
backdropFilter: "blur(12px)",
|
|
831
|
+
borderColor: "rgba(63, 63, 70, 0.4)",
|
|
832
|
+
borderRadius: "20px"
|
|
833
|
+
},
|
|
834
|
+
children: p
|
|
835
|
+
}
|
|
836
|
+
)
|
|
837
|
+
}
|
|
838
|
+
)
|
|
839
|
+
] });
|
|
840
|
+
}
|
|
841
|
+
function _e({
|
|
842
|
+
size: i = "100%",
|
|
843
|
+
customization: n,
|
|
844
|
+
state: l,
|
|
845
|
+
className: o,
|
|
846
|
+
style: a
|
|
847
|
+
}) {
|
|
848
|
+
const {
|
|
849
|
+
skinColor: t = "#cf6b34",
|
|
850
|
+
// fur — also used for the eyelids
|
|
851
|
+
bgColor: d = "#6fb3bd"
|
|
852
|
+
} = n ?? {}, [s, h] = le.useState(
|
|
853
|
+
() => Math.random() < 0.5 ? "wires" : "paper"
|
|
854
|
+
), p = le.useRef(l);
|
|
855
|
+
return le.useEffect(() => {
|
|
856
|
+
l === "working" && p.current !== "working" && h(Math.random() < 0.5 ? "wires" : "paper"), p.current = l;
|
|
857
|
+
}, [l]), /* @__PURE__ */ c(
|
|
858
|
+
"svg",
|
|
859
|
+
{
|
|
860
|
+
viewBox: "0 0 200 200",
|
|
861
|
+
width: i,
|
|
862
|
+
height: i,
|
|
863
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
864
|
+
role: "img",
|
|
865
|
+
"aria-label": "Avatar",
|
|
866
|
+
className: o,
|
|
867
|
+
style: a,
|
|
868
|
+
children: [
|
|
869
|
+
/* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "79", fill: d }),
|
|
870
|
+
/* @__PURE__ */ e("clipPath", { id: "rra-squirrel-clip", children: /* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "79" }) }),
|
|
871
|
+
/* @__PURE__ */ c("g", { clipPath: "url(#rra-squirrel-clip)", children: [
|
|
872
|
+
/* @__PURE__ */ e("path", { d: "M150 158 C182 150 188 96 162 66 C150 52 130 52 124 66 C140 70 150 92 146 110 C142 132 132 148 150 158 Z", fill: t }),
|
|
873
|
+
/* @__PURE__ */ e("path", { d: "M150 150 C172 142 176 100 156 76 C150 90 156 104 152 120 C148 134 140 142 150 150 Z", fill: "#e3a368" }),
|
|
874
|
+
/* @__PURE__ */ e("path", { d: "M84 118 Q82 140 78 150 L122 150 Q118 140 116 118 Z", fill: t }),
|
|
875
|
+
/* @__PURE__ */ e("path", { d: "M85 122 Q100 133 115 122 Q100 129 85 122 Z", fill: "#b05418", opacity: "0.55" }),
|
|
876
|
+
/* @__PURE__ */ e("path", { d: "M36 182 Q42 148 72 144 Q86 158 100 158 Q114 158 128 144 Q158 148 164 182 Z", fill: "#2b2f36" }),
|
|
877
|
+
/* @__PURE__ */ e("path", { d: "M78 146 Q100 156 122 146", fill: "none", stroke: "#3c424b", strokeWidth: "3", strokeLinecap: "round" }),
|
|
878
|
+
/* @__PURE__ */ e("path", { d: "M88 152 L100 182 L112 152 Z", fill: "#1f6fb0" }),
|
|
879
|
+
/* @__PURE__ */ c("g", { stroke: "#6cc0ee", strokeWidth: "1.1", fill: "none", opacity: "0.85", children: [
|
|
880
|
+
/* @__PURE__ */ e("path", { d: "M100 158 L100 178 M94 164 L106 164 M97 172 L103 172" }),
|
|
881
|
+
/* @__PURE__ */ e("circle", { cx: "100", cy: "162", r: "1.4", fill: "#6cc0ee", stroke: "none" })
|
|
882
|
+
] }),
|
|
883
|
+
/* @__PURE__ */ e("path", { d: "M96 150 L94 170 M104 150 L106 170", stroke: "#e9eef2", strokeWidth: "1.6", strokeLinecap: "round", fill: "none" }),
|
|
884
|
+
/* @__PURE__ */ c("g", { id: "rra-squirrel-head", transform: l === "thinking" ? "rotate(6 100 120)" : void 0, children: [
|
|
885
|
+
/* @__PURE__ */ e("path", { d: "M66 80 L58 42 Q74 50 86 72 Z", fill: t }),
|
|
886
|
+
/* @__PURE__ */ e("path", { d: "M134 80 L142 42 Q126 50 114 72 Z", fill: t }),
|
|
887
|
+
/* @__PURE__ */ e("path", { d: "M68 74 L63 52 Q72 56 80 70 Z", fill: "#a8451c" }),
|
|
888
|
+
/* @__PURE__ */ e("path", { d: "M132 74 L137 52 Q128 56 120 70 Z", fill: "#a8451c" }),
|
|
889
|
+
/* @__PURE__ */ c("g", { stroke: "#f0d9b8", strokeWidth: "1.4", strokeLinecap: "round", fill: "none", children: [
|
|
890
|
+
/* @__PURE__ */ e("path", { d: "M60 46 L57 38 M63 47 L62 39 M66 49 L66 41" }),
|
|
891
|
+
/* @__PURE__ */ e("path", { d: "M140 46 L143 38 M137 47 L138 39 M134 49 L134 41" })
|
|
892
|
+
] }),
|
|
893
|
+
/* @__PURE__ */ e("ellipse", { cx: "100", cy: "98", rx: "40", ry: "37", fill: t }),
|
|
894
|
+
/* @__PURE__ */ e("path", { d: "M62 96 Q54 90 58 100 Q56 108 64 106 Z", fill: t }),
|
|
895
|
+
/* @__PURE__ */ e("path", { d: "M138 96 Q146 90 142 100 Q144 108 136 106 Z", fill: t }),
|
|
896
|
+
/* @__PURE__ */ e("ellipse", { cx: "100", cy: "112", rx: "23", ry: "18", fill: "#ecc090" }),
|
|
897
|
+
/* @__PURE__ */ e("path", { d: "M64 78 Q60 50 86 46 Q78 54 82 60 Q92 44 110 48 Q102 56 106 60 Q120 50 134 74 Q124 62 112 66 Q100 56 88 66 Q76 64 64 78 Z", fill: "#3a2820" }),
|
|
898
|
+
/* @__PURE__ */ c("g", { stroke: "#5a3a22", strokeWidth: "3", strokeLinecap: "round", fill: "none", children: [
|
|
899
|
+
/* @__PURE__ */ e("path", { d: "M70 80 Q78 75 88 79" }),
|
|
900
|
+
/* @__PURE__ */ e("path", { d: "M112 79 Q122 75 130 80" })
|
|
901
|
+
] }),
|
|
902
|
+
/* @__PURE__ */ c("g", { stroke: "#1a1a1a", strokeWidth: "3", fill: "none", children: [
|
|
903
|
+
/* @__PURE__ */ e("path", { d: "M95 92 Q100 89 105 92" }),
|
|
904
|
+
/* @__PURE__ */ e("path", { d: "M69 90 L60 86" }),
|
|
905
|
+
/* @__PURE__ */ e("path", { d: "M131 90 L140 86" })
|
|
906
|
+
] }),
|
|
907
|
+
/* @__PURE__ */ e("circle", { cx: "82", cy: "92", r: "13.5", fill: "#fbf7ef", stroke: "#1a1a1a", strokeWidth: "3" }),
|
|
908
|
+
/* @__PURE__ */ e("circle", { cx: "118", cy: "92", r: "13.5", fill: "#fbf7ef", stroke: "#1a1a1a", strokeWidth: "3" }),
|
|
909
|
+
/* @__PURE__ */ c("g", { children: [
|
|
910
|
+
/* @__PURE__ */ e("ellipse", { cx: "82", cy: "93", rx: "8", ry: "8.5", fill: "#ffffff" }),
|
|
911
|
+
/* @__PURE__ */ e("g", { transform: l === "thinking" ? "translate(5, 0)" : void 0, children: /* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": 82, "data-base-y": 93, cx: "82", cy: "93", r: "4.6", fill: "#2b1b12" }) }),
|
|
912
|
+
/* @__PURE__ */ e("circle", { cx: "84", cy: "90", r: "1.5", fill: "#ffffff" }),
|
|
913
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "18", x: "73", y: "83", width: "18", height: "0", fill: t })
|
|
914
|
+
] }),
|
|
915
|
+
/* @__PURE__ */ c("g", { children: [
|
|
916
|
+
/* @__PURE__ */ e("ellipse", { cx: "118", cy: "93", rx: "8", ry: "8.5", fill: "#ffffff" }),
|
|
917
|
+
/* @__PURE__ */ e("g", { transform: l === "thinking" ? "translate(5, 0)" : void 0, children: /* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": 118, "data-base-y": 93, cx: "118", cy: "93", r: "4.6", fill: "#2b1b12" }) }),
|
|
918
|
+
/* @__PURE__ */ e("circle", { cx: "120", cy: "90", r: "1.5", fill: "#ffffff" }),
|
|
919
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "18", x: "109", y: "83", width: "18", height: "0", fill: t })
|
|
920
|
+
] }),
|
|
921
|
+
l === "working" && s === "wires" && /* @__PURE__ */ c("g", { id: "rra-safety-goggles", children: [
|
|
922
|
+
/* @__PURE__ */ e("path", { d: "M 52 92 C 45 92, 45 96, 40 96 M 148 92 C 155 92, 155 96, 160 96", fill: "none", stroke: "#2d3748", strokeWidth: "4", strokeLinecap: "round" }),
|
|
923
|
+
/* @__PURE__ */ e("rect", { x: "58", y: "78", width: "84", height: "28", rx: "14", fill: "none", stroke: "#e2e8f0", strokeWidth: "4" }),
|
|
924
|
+
/* @__PURE__ */ e("rect", { x: "60", y: "80", width: "80", height: "24", rx: "12", fill: "#e0f2fe", fillOpacity: "0.15" }),
|
|
925
|
+
/* @__PURE__ */ e("circle", { cx: "56", cy: "92", r: "3", fill: "#475569" }),
|
|
926
|
+
/* @__PURE__ */ e("circle", { cx: "144", cy: "92", r: "3", fill: "#475569" })
|
|
927
|
+
] }),
|
|
928
|
+
/* @__PURE__ */ e("path", { d: "M93 107 Q100 101 107 107 Q100 113 93 107 Z", fill: "#7a4a32" }),
|
|
929
|
+
/* @__PURE__ */ e("path", { d: "M100 113 L100 118", stroke: "#7a4a32", strokeWidth: "1.6", strokeLinecap: "round" }),
|
|
930
|
+
/* @__PURE__ */ e("ellipse", { id: "rra-mouth", cx: "100", cy: "121", rx: "7", ry: "2.3", fill: "#5a3324" }),
|
|
931
|
+
/* @__PURE__ */ e("g", { stroke: "#caa074", strokeWidth: "1", strokeLinecap: "round", opacity: "0.8", fill: "none", children: /* @__PURE__ */ e("path", { d: "M80 116 L62 113 M80 120 L62 121 M120 116 L138 113 M120 120 L138 121" }) }),
|
|
932
|
+
l === "thinking" && /* @__PURE__ */ c("g", { id: "rra-thinking-hand", children: [
|
|
933
|
+
/* @__PURE__ */ e(
|
|
934
|
+
"path",
|
|
935
|
+
{
|
|
936
|
+
d: "M136 182 L112 144 L124 138 L152 182 Z",
|
|
937
|
+
fill: "#2b2f36",
|
|
938
|
+
stroke: "#1e293b",
|
|
939
|
+
strokeWidth: "1.2"
|
|
940
|
+
}
|
|
941
|
+
),
|
|
942
|
+
/* @__PURE__ */ c("g", { fill: t, stroke: "#b05418", strokeWidth: "1.2", strokeLinejoin: "round", strokeLinecap: "round", children: [
|
|
943
|
+
/* @__PURE__ */ e("path", { d: "M112 144 C110 138, 107 130, 105 124 C104 121, 108 121, 109 124 C111 130, 113 136, 115 141" }),
|
|
944
|
+
/* @__PURE__ */ e("path", { d: "M115 141 C117 139, 120 140, 119 143 C121 142, 123 144, 121 147 C122 147, 123 149, 121 151 C120 152, 116 150, 115 145" }),
|
|
945
|
+
/* @__PURE__ */ e("path", { d: "M110 139 C104 139, 96 135, 92 132 C90 130, 93 128, 95 130 C100 133, 106 135, 110 136" })
|
|
946
|
+
] })
|
|
947
|
+
] })
|
|
948
|
+
] }),
|
|
949
|
+
l === "working" && s === "wires" && /* @__PURE__ */ c("g", { id: "rra-working-workspace-wires", children: [
|
|
950
|
+
/* @__PURE__ */ e("circle", { cx: "100", cy: "162", r: "22", fill: "#fef08a", fillOpacity: "0.25", children: /* @__PURE__ */ e("animate", { attributeName: "opacity", values: "1;0.2;0.9;0.1;0.8;0.3;1", dur: "1.2s", repeatCount: "indefinite" }) }),
|
|
951
|
+
/* @__PURE__ */ e("rect", { x: "94", y: "172", width: "12", height: "8", fill: "#94a3b8", rx: "1" }),
|
|
952
|
+
/* @__PURE__ */ e("rect", { x: "96", y: "175", width: "8", height: "2", fill: "#64748b" }),
|
|
953
|
+
/* @__PURE__ */ e("path", { d: "M92 165 C92 153, 108 153, 108 165 C108 171, 104 172, 104 174 L96 174 C96 172, 92 171, 92 165 Z", fill: "#fef08a", stroke: "#ca8a04", strokeWidth: "1.5", children: /* @__PURE__ */ e("animate", { attributeName: "fill", values: "#fef08a;#fef08a;#78350f;#fef08a;#fef08a;#78350f;#fef08a", dur: "1.2s", repeatCount: "indefinite" }) }),
|
|
954
|
+
/* @__PURE__ */ e("path", { d: "M97 167 L99 160 L101 160 L103 167", fill: "none", stroke: "#ca8a04", strokeWidth: "1", children: /* @__PURE__ */ e("animate", { attributeName: "stroke", values: "#ca8a04;#ca8a04;#78350f;#ca8a04;#ca8a04;#78350f;#ca8a04", dur: "1.2s", repeatCount: "indefinite" }) }),
|
|
955
|
+
/* @__PURE__ */ c("g", { id: "rra-left-arm-cable", children: [
|
|
956
|
+
/* @__PURE__ */ e(
|
|
957
|
+
"animateTransform",
|
|
958
|
+
{
|
|
959
|
+
attributeName: "transform",
|
|
960
|
+
type: "translate",
|
|
961
|
+
values: "0,0; -0.6,0.3; 0.4,-0.2; -0.3,-0.5; 0,0",
|
|
962
|
+
dur: "0.18s",
|
|
963
|
+
repeatCount: "indefinite"
|
|
964
|
+
}
|
|
965
|
+
),
|
|
966
|
+
/* @__PURE__ */ e("path", { d: "M36 182 L55 162 L64 168 L45 182 Z", fill: "#2b2f36", stroke: "#1e293b", strokeWidth: "1" }),
|
|
967
|
+
/* @__PURE__ */ e("path", { d: "M 45 180 C 45 165, 80 170, 94 174", fill: "none", stroke: "#ef4444", strokeWidth: "2.5", strokeLinecap: "round" }),
|
|
968
|
+
/* @__PURE__ */ c("g", { fill: t, stroke: "#b05418", strokeWidth: "1", children: [
|
|
969
|
+
/* @__PURE__ */ e("rect", { x: "58", y: "160", width: "10", height: "12", rx: "4", transform: "rotate(-10 63 166)" }),
|
|
970
|
+
/* @__PURE__ */ e("rect", { x: "62", y: "163", width: "9", height: "10", rx: "3", transform: "rotate(-15 66.5 168)" })
|
|
971
|
+
] })
|
|
972
|
+
] }),
|
|
973
|
+
/* @__PURE__ */ c("g", { id: "rra-right-arm-cable", children: [
|
|
974
|
+
/* @__PURE__ */ e(
|
|
975
|
+
"animateTransform",
|
|
976
|
+
{
|
|
977
|
+
attributeName: "transform",
|
|
978
|
+
type: "translate",
|
|
979
|
+
values: "0,0; 0.5,-0.3; -0.4,0.2; 0.3,0.4; 0,0",
|
|
980
|
+
dur: "0.15s",
|
|
981
|
+
repeatCount: "indefinite"
|
|
982
|
+
}
|
|
983
|
+
),
|
|
984
|
+
/* @__PURE__ */ e("path", { d: "M164 182 L145 162 L136 168 L155 182 Z", fill: "#2b2f36", stroke: "#1e293b", strokeWidth: "1" }),
|
|
985
|
+
/* @__PURE__ */ e("path", { d: "M 155 180 C 155 165, 120 170, 106 174", fill: "none", stroke: "#1e293b", strokeWidth: "2.5", strokeLinecap: "round" }),
|
|
986
|
+
/* @__PURE__ */ c("g", { fill: t, stroke: "#b05418", strokeWidth: "1", children: [
|
|
987
|
+
/* @__PURE__ */ e("rect", { x: "132", y: "160", width: "10", height: "12", rx: "4", transform: "rotate(10 137 166)" }),
|
|
988
|
+
/* @__PURE__ */ e("rect", { x: "129", y: "163", width: "9", height: "10", rx: "3", transform: "rotate(15 133.5 168)" })
|
|
989
|
+
] })
|
|
990
|
+
] })
|
|
991
|
+
] }),
|
|
992
|
+
l === "working" && s === "paper" && /* @__PURE__ */ c("g", { id: "rra-working-workspace-paper", children: [
|
|
993
|
+
/* @__PURE__ */ e(
|
|
994
|
+
"animateTransform",
|
|
995
|
+
{
|
|
996
|
+
attributeName: "transform",
|
|
997
|
+
type: "translate",
|
|
998
|
+
values: "0,0; 0,1; 0,0; 0,1; 0,0",
|
|
999
|
+
dur: "3.2s",
|
|
1000
|
+
repeatCount: "indefinite"
|
|
1001
|
+
}
|
|
1002
|
+
),
|
|
1003
|
+
/* @__PURE__ */ e("path", { d: "M36 182 L54 168 L64 176 L48 182 Z", fill: "#2b2f36", stroke: "#1e293b", strokeWidth: "1" }),
|
|
1004
|
+
/* @__PURE__ */ e("path", { d: "M164 182 L146 168 L136 176 L152 182 Z", fill: "#2b2f36", stroke: "#1e293b", strokeWidth: "1" }),
|
|
1005
|
+
/* @__PURE__ */ e("path", { d: "M50 118 C 66 120 84 128 100 134 C 116 128 134 120 150 118 L 148 124 C 134 126 116 134 100 150 C 84 134 66 126 52 124 Z", fill: "#f8fafc", stroke: "#d9d2c4", strokeWidth: "1" }),
|
|
1006
|
+
/* @__PURE__ */ c("g", { stroke: "#9aa4b2", strokeWidth: "1.1", strokeLinecap: "round", children: [
|
|
1007
|
+
/* @__PURE__ */ e("line", { x1: "60", y1: "124", x2: "92", y2: "137" }),
|
|
1008
|
+
/* @__PURE__ */ e("line", { x1: "140", y1: "124", x2: "108", y2: "137" })
|
|
1009
|
+
] }),
|
|
1010
|
+
/* @__PURE__ */ e("path", { d: "M100 148 C 84 136 68 130 52 126 L 60 182 C 78 178 90 177 100 176 Z", fill: "#20242b", stroke: "#0f1216", strokeWidth: "1.5" }),
|
|
1011
|
+
/* @__PURE__ */ e("path", { d: "M100 148 C 116 136 132 130 148 126 L 140 182 C 122 178 110 177 100 176 Z", fill: "#20242b", stroke: "#0f1216", strokeWidth: "1.5" }),
|
|
1012
|
+
/* @__PURE__ */ e("line", { x1: "100", y1: "134", x2: "100", y2: "176", stroke: "#0f1216", strokeWidth: "1.4" }),
|
|
1013
|
+
/* @__PURE__ */ c("g", { fill: t, stroke: "#b05418", strokeWidth: "1", children: [
|
|
1014
|
+
/* @__PURE__ */ e("circle", { cx: "60", cy: "180", r: "7" }),
|
|
1015
|
+
/* @__PURE__ */ e("rect", { x: "57", y: "170", width: "7", height: "12", rx: "3" }),
|
|
1016
|
+
/* @__PURE__ */ e("rect", { x: "62", y: "172", width: "7", height: "11", rx: "3" }),
|
|
1017
|
+
/* @__PURE__ */ e("rect", { x: "67", y: "173", width: "6", height: "10", rx: "3" })
|
|
1018
|
+
] }),
|
|
1019
|
+
/* @__PURE__ */ c("g", { fill: t, stroke: "#b05418", strokeWidth: "1", children: [
|
|
1020
|
+
/* @__PURE__ */ e("circle", { cx: "140", cy: "180", r: "7" }),
|
|
1021
|
+
/* @__PURE__ */ e("rect", { x: "136", y: "170", width: "7", height: "12", rx: "3" }),
|
|
1022
|
+
/* @__PURE__ */ e("rect", { x: "131", y: "172", width: "7", height: "11", rx: "3" }),
|
|
1023
|
+
/* @__PURE__ */ e("rect", { x: "127", y: "173", width: "6", height: "10", rx: "3" })
|
|
1024
|
+
] })
|
|
1025
|
+
] })
|
|
1026
|
+
] }),
|
|
1027
|
+
/* @__PURE__ */ c("g", { id: "rra-think", opacity: "0", children: [
|
|
1028
|
+
/* @__PURE__ */ e("circle", { cx: "150", cy: "54", r: "4", fill: "#ffffff", stroke: "#8b5cf6", strokeWidth: "2" }),
|
|
1029
|
+
/* @__PURE__ */ e("circle", { cx: "165", cy: "42", r: "5.5", fill: "#ffffff", stroke: "#8b5cf6", strokeWidth: "2" }),
|
|
1030
|
+
/* @__PURE__ */ e("circle", { cx: "182", cy: "28", r: "7", fill: "#ffffff", stroke: "#8b5cf6", strokeWidth: "2.5" })
|
|
1031
|
+
] })
|
|
1032
|
+
]
|
|
1033
|
+
}
|
|
1034
|
+
);
|
|
1035
|
+
}
|
|
1036
|
+
function Oe({ collection: i, seed: n, size: l = 44, className: o = "" }) {
|
|
1037
|
+
const [a, t] = ce(null);
|
|
1038
|
+
return ee(() => {
|
|
1039
|
+
let d = !1;
|
|
1040
|
+
return t(null), $e(i, n).then((s) => {
|
|
1041
|
+
d || t(s);
|
|
1042
|
+
}).catch(() => {
|
|
1043
|
+
d || t(null);
|
|
1044
|
+
}), () => {
|
|
1045
|
+
d = !0;
|
|
1046
|
+
};
|
|
1047
|
+
}, [i, n]), /* @__PURE__ */ e(
|
|
1048
|
+
"div",
|
|
1049
|
+
{
|
|
1050
|
+
className: `flex items-center justify-center overflow-hidden ${o}`,
|
|
1051
|
+
style: { width: l, height: l },
|
|
1052
|
+
"aria-hidden": !0,
|
|
1053
|
+
children: a ? /* @__PURE__ */ e(
|
|
1054
|
+
"div",
|
|
1055
|
+
{
|
|
1056
|
+
className: "w-full h-full [&>svg]:w-full [&>svg]:h-full",
|
|
1057
|
+
dangerouslySetInnerHTML: { __html: a }
|
|
1058
|
+
}
|
|
1059
|
+
) : /* @__PURE__ */ e("div", { className: "w-full h-full rounded-md bg-zinc-800/40 animate-pulse" })
|
|
1060
|
+
}
|
|
1061
|
+
);
|
|
1062
|
+
}
|
|
1063
|
+
function Ge({
|
|
1064
|
+
analyser: i,
|
|
1065
|
+
state: n,
|
|
1066
|
+
height: l = 80,
|
|
1067
|
+
className: o = "",
|
|
1068
|
+
style: a,
|
|
1069
|
+
stateColors: t
|
|
1070
|
+
}) {
|
|
1071
|
+
const d = O(null), s = O(null), h = O(0), p = {
|
|
1072
|
+
idle: (t == null ? void 0 : t.idle) ?? "#9ca3af",
|
|
1073
|
+
listening: (t == null ? void 0 : t.listening) ?? "#3b82f6",
|
|
1074
|
+
thinking: (t == null ? void 0 : t.thinking) ?? "#8b5cf6",
|
|
1075
|
+
speaking: (t == null ? void 0 : t.speaking) ?? "#10b981",
|
|
1076
|
+
working: (t == null ? void 0 : t.working) ?? "#f59e0b"
|
|
1077
|
+
};
|
|
1078
|
+
return ee(() => {
|
|
1079
|
+
const g = d.current;
|
|
1080
|
+
if (!g) return;
|
|
1081
|
+
const r = g.getContext("2d");
|
|
1082
|
+
if (!r) return;
|
|
1083
|
+
const z = () => {
|
|
1084
|
+
const w = window.devicePixelRatio || 1, m = g.getBoundingClientRect();
|
|
1085
|
+
g.width = m.width * w, g.height = m.height * w, r.scale(w, w);
|
|
1086
|
+
};
|
|
1087
|
+
z(), window.addEventListener("resize", z);
|
|
1088
|
+
let S = 0, T = new Uint8Array(0);
|
|
1089
|
+
i && (i.fftSize = 128, S = i.frequencyBinCount, T = new Uint8Array(S));
|
|
1090
|
+
const V = () => {
|
|
1091
|
+
const w = g.width / (window.devicePixelRatio || 1), m = g.height / (window.devicePixelRatio || 1);
|
|
1092
|
+
r.fillStyle = "rgba(9, 9, 11, 0.2)", r.fillRect(0, 0, w, m), h.current += 0.05;
|
|
1093
|
+
const F = h.current;
|
|
1094
|
+
if (n === "speaking" && i) {
|
|
1095
|
+
i.getByteFrequencyData(T), r.lineWidth = 3, r.strokeStyle = p.speaking, r.shadowBlur = 15, r.shadowColor = _(p.speaking, 0.6), r.beginPath();
|
|
1096
|
+
const f = w / S;
|
|
1097
|
+
let k = 0;
|
|
1098
|
+
for (let M = 0; M < S; M++) {
|
|
1099
|
+
const y = T[M] / 255, N = m / 2 + Math.sin(M * 0.15 + F * 2) * (y * m * 0.4);
|
|
1100
|
+
M === 0 ? r.moveTo(k, N) : r.lineTo(k, N), k += f;
|
|
1101
|
+
}
|
|
1102
|
+
r.lineTo(w, m / 2), r.stroke(), r.shadowBlur = 0;
|
|
1103
|
+
} else if (n === "listening") {
|
|
1104
|
+
let f = 0;
|
|
1105
|
+
if (i && T.length > 0) {
|
|
1106
|
+
i.getByteTimeDomainData(T);
|
|
1107
|
+
let y = 0;
|
|
1108
|
+
for (let N = 0; N < T.length; N++) {
|
|
1109
|
+
const J = Math.abs(T[N] - 128);
|
|
1110
|
+
J > y && (y = J);
|
|
1111
|
+
}
|
|
1112
|
+
f = Math.min(1, y / 128);
|
|
1113
|
+
}
|
|
1114
|
+
const k = 4 + f * 36, M = 3 + f * 27;
|
|
1115
|
+
r.shadowBlur = 12, r.lineWidth = 2.5, r.strokeStyle = _(p.listening, 0.7), r.shadowColor = _(p.listening, 0.4), r.beginPath();
|
|
1116
|
+
for (let y = 0; y < w; y++) {
|
|
1117
|
+
const N = m / 2 + Math.sin(y * 0.02 + F * 1.5) * Math.sin(y * 5e-3) * k;
|
|
1118
|
+
y === 0 ? r.moveTo(y, N) : r.lineTo(y, N);
|
|
1119
|
+
}
|
|
1120
|
+
r.stroke(), r.strokeStyle = _(p.listening, 0.5), r.shadowColor = _(p.listening, 0.3), r.beginPath();
|
|
1121
|
+
for (let y = 0; y < w; y++) {
|
|
1122
|
+
const N = m / 2 + Math.sin(y * 0.015 - F * 1.2 + Math.PI) * Math.sin(y * 5e-3) * M;
|
|
1123
|
+
y === 0 ? r.moveTo(y, N) : r.lineTo(y, N);
|
|
1124
|
+
}
|
|
1125
|
+
r.stroke(), r.shadowBlur = 0;
|
|
1126
|
+
} else if (n === "thinking") {
|
|
1127
|
+
r.shadowBlur = 10, r.shadowColor = _(p.thinking, 0.4), r.lineWidth = 2, r.strokeStyle = _(p.thinking, 0.7), r.beginPath();
|
|
1128
|
+
for (let f = 0; f < w; f++) {
|
|
1129
|
+
const k = m / 2 + Math.sin(f * 0.03 + F) * 5 + Math.sin(f * 0.01 - F * 0.5) * 8;
|
|
1130
|
+
f === 0 ? r.moveTo(f, k) : r.lineTo(f, k);
|
|
1131
|
+
}
|
|
1132
|
+
r.stroke(), r.shadowBlur = 0;
|
|
1133
|
+
} else if (n === "working") {
|
|
1134
|
+
r.shadowBlur = 10, r.shadowColor = _(p.working, 0.4), r.lineWidth = 2, r.strokeStyle = _(p.working, 0.7), r.beginPath();
|
|
1135
|
+
for (let f = 0; f < w; f += 8) {
|
|
1136
|
+
const k = m / 2 + Math.sin(f * 0.04 + F * 2.5) * 12 + Math.cos(f * 0.01 - F) * 6, M = m / 2 + Math.round((k - m / 2) / 6) * 6;
|
|
1137
|
+
f === 0 ? r.moveTo(f, M) : (r.lineTo(f, M), r.lineTo(Math.min(w, f + 8), M));
|
|
1138
|
+
}
|
|
1139
|
+
r.stroke(), r.shadowBlur = 0;
|
|
1140
|
+
} else {
|
|
1141
|
+
r.lineWidth = 1.5, r.strokeStyle = _(p.idle, 0.3), r.beginPath();
|
|
1142
|
+
for (let f = 0; f < w; f++) {
|
|
1143
|
+
const k = m / 2 + Math.sin(f * 0.01 + F * 0.2) * 2;
|
|
1144
|
+
f === 0 ? r.moveTo(f, k) : r.lineTo(f, k);
|
|
1145
|
+
}
|
|
1146
|
+
r.stroke();
|
|
1147
|
+
}
|
|
1148
|
+
s.current = requestAnimationFrame(V);
|
|
1149
|
+
};
|
|
1150
|
+
return V(), () => {
|
|
1151
|
+
window.removeEventListener("resize", z), s.current && cancelAnimationFrame(s.current);
|
|
1152
|
+
};
|
|
1153
|
+
}, [i, n, t]), /* @__PURE__ */ c("div", { className: `w-full bg-zinc-950/80 border border-zinc-800/40 rounded-xl overflow-hidden p-2 ${o}`, style: a, children: [
|
|
1154
|
+
/* @__PURE__ */ c("div", { className: "flex justify-between items-center px-2 mb-1", children: [
|
|
1155
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] text-zinc-500 uppercase tracking-widest font-mono font-bold", children: "Audio Waveform Telemetry" }),
|
|
1156
|
+
/* @__PURE__ */ c("span", { className: "flex h-2 w-2 relative", children: [
|
|
1157
|
+
/* @__PURE__ */ e(
|
|
1158
|
+
"span",
|
|
1159
|
+
{
|
|
1160
|
+
className: "animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",
|
|
1161
|
+
style: { backgroundColor: p[n] }
|
|
1162
|
+
}
|
|
1163
|
+
),
|
|
1164
|
+
/* @__PURE__ */ e(
|
|
1165
|
+
"span",
|
|
1166
|
+
{
|
|
1167
|
+
className: "relative inline-flex rounded-full h-2 w-2",
|
|
1168
|
+
style: { backgroundColor: p[n] }
|
|
1169
|
+
}
|
|
1170
|
+
)
|
|
1171
|
+
] })
|
|
1172
|
+
] }),
|
|
1173
|
+
/* @__PURE__ */ e(
|
|
1174
|
+
"canvas",
|
|
1175
|
+
{
|
|
1176
|
+
ref: d,
|
|
1177
|
+
className: "w-full block",
|
|
1178
|
+
style: { height: l }
|
|
1179
|
+
}
|
|
1180
|
+
)
|
|
1181
|
+
] });
|
|
1182
|
+
}
|
|
1183
|
+
function Ve({ analyser: i, enabled: n, onFrame: l, onStop: o }) {
|
|
1184
|
+
const a = O(l), t = O(o);
|
|
1185
|
+
a.current = l, t.current = o, ee(() => {
|
|
1186
|
+
var p;
|
|
1187
|
+
if (!n) {
|
|
1188
|
+
(p = t.current) == null || p.call(t);
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
const d = de(i);
|
|
1192
|
+
let s;
|
|
1193
|
+
const h = () => {
|
|
1194
|
+
a.current(d.read()), s = requestAnimationFrame(h);
|
|
1195
|
+
};
|
|
1196
|
+
return s = requestAnimationFrame(h), () => {
|
|
1197
|
+
var g;
|
|
1198
|
+
cancelAnimationFrame(s), (g = t.current) == null || g.call(t);
|
|
1199
|
+
};
|
|
1200
|
+
}, [i, n]);
|
|
1201
|
+
}
|
|
1202
|
+
export {
|
|
1203
|
+
Ge as AudioVisualizer,
|
|
1204
|
+
ue as ContractAvatar,
|
|
1205
|
+
Se as DEFAULT_DICEBEAR_COLLECTION,
|
|
1206
|
+
Re as DEFAULT_DICEBEAR_SEED,
|
|
1207
|
+
ye as DICEBEAR_FEATURED_FACES,
|
|
1208
|
+
We as DICEBEAR_RIGS,
|
|
1209
|
+
Qe as DICEBEAR_STYLES,
|
|
1210
|
+
Ze as DICEBEAR_STYLE_BY_ID,
|
|
1211
|
+
Be as DiceBearAvatar,
|
|
1212
|
+
Oe as DiceBearThumb,
|
|
1213
|
+
Ne as DoodleAvatar,
|
|
1214
|
+
ge as GeometricAvatar,
|
|
1215
|
+
Ae as MemojiAvatar,
|
|
1216
|
+
Le as PixelArtAvatar,
|
|
1217
|
+
je as RealtimeAvatar,
|
|
1218
|
+
He as SPEECH_ACTIVITY_BRAND,
|
|
1219
|
+
_e as SquirrelAvatar,
|
|
1220
|
+
fe as collectionExportName,
|
|
1221
|
+
de as createMouthEngine,
|
|
1222
|
+
we as createSpeechActivity,
|
|
1223
|
+
Ke as isSpeechActivity,
|
|
1224
|
+
ke as loadDiceBear,
|
|
1225
|
+
$e as renderDiceBearSvg,
|
|
1226
|
+
me as scopeSvgIds,
|
|
1227
|
+
Ve as useAudioMouth,
|
|
1228
|
+
Me as useAvatarRuntime,
|
|
1229
|
+
se as useReducedMotion,
|
|
1230
|
+
Fe as useStreamingTextActivity
|
|
1231
|
+
};
|