orb-ui 0.2.3 → 0.3.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 +105 -29
- package/dist/adapters/elevenlabs/index.d.ts +85 -0
- package/dist/adapters/index.d.ts +4 -0
- package/dist/adapters/livekit/index.d.ts +129 -0
- package/dist/adapters/types.d.ts +7 -0
- package/dist/adapters/vapi/index.d.ts +42 -0
- package/dist/adapters.cjs +1 -1
- package/dist/adapters.js +482 -134
- package/dist/components/Orb/Orb.d.ts +2 -0
- package/dist/components/Orb/Orb.types.d.ts +89 -0
- package/dist/components/Orb/index.d.ts +2 -0
- package/dist/components/Orb/signals.d.ts +5 -0
- package/dist/index.d.ts +4 -0
- package/dist/orb-ui.cjs +2 -2
- package/dist/orb-ui.js +534 -511
- package/dist/themes/bars/BarsTheme.d.ts +14 -0
- package/dist/themes/bars/index.d.ts +1 -0
- package/dist/themes/circle/CircleTheme.d.ts +14 -0
- package/dist/themes/circle/index.d.ts +1 -0
- package/dist/themes/debug/DebugTheme.d.ts +15 -0
- package/dist/themes/debug/index.d.ts +1 -0
- package/dist/themes/index.d.ts +3 -0
- package/package.json +54 -28
- package/dist/adapters.d.ts +0 -145
- package/dist/orb-ui.d.ts +0 -56
package/dist/orb-ui.js
CHANGED
|
@@ -1,522 +1,545 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { useCallback as e, useEffect as t, useLayoutEffect as n, useRef as r, useState as i } from "react";
|
|
2
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/Orb/signals.ts
|
|
4
|
+
function s(e, t, n) {
|
|
5
|
+
return e ?? t?.state ?? n.state;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"connecting",
|
|
10
|
-
"listening",
|
|
11
|
-
"speaking",
|
|
12
|
-
"error"
|
|
13
|
-
], Q = {
|
|
14
|
-
idle: "#888",
|
|
15
|
-
connecting: "#f0c040",
|
|
16
|
-
listening: "#40c0f0",
|
|
17
|
-
speaking: "#40f080",
|
|
18
|
-
error: "#f04040"
|
|
19
|
-
};
|
|
20
|
-
function le({
|
|
21
|
-
state: n,
|
|
22
|
-
volume: o,
|
|
23
|
-
size: e,
|
|
24
|
-
className: k,
|
|
25
|
-
style: A,
|
|
26
|
-
onStart: d,
|
|
27
|
-
onStop: M
|
|
28
|
-
}) {
|
|
29
|
-
return /* @__PURE__ */ N(
|
|
30
|
-
"div",
|
|
31
|
-
{
|
|
32
|
-
className: k,
|
|
33
|
-
style: {
|
|
34
|
-
width: e,
|
|
35
|
-
fontFamily: "monospace",
|
|
36
|
-
fontSize: 12,
|
|
37
|
-
background: "#111",
|
|
38
|
-
color: "#ccc",
|
|
39
|
-
border: "1px solid #333",
|
|
40
|
-
borderRadius: 8,
|
|
41
|
-
padding: 12,
|
|
42
|
-
boxSizing: "border-box",
|
|
43
|
-
userSelect: "none",
|
|
44
|
-
...A
|
|
45
|
-
},
|
|
46
|
-
children: [
|
|
47
|
-
/* @__PURE__ */ l("div", { style: { color: "#555", marginBottom: 10, fontSize: 10, letterSpacing: 1 }, children: "ORB DEBUG" }),
|
|
48
|
-
/* @__PURE__ */ N("div", { style: { marginBottom: 8 }, children: [
|
|
49
|
-
/* @__PURE__ */ l("span", { style: { color: "#555" }, children: "state " }),
|
|
50
|
-
/* @__PURE__ */ l("span", { style: { color: Q[n], fontWeight: "bold" }, children: n })
|
|
51
|
-
] }),
|
|
52
|
-
/* @__PURE__ */ N("div", { style: { marginBottom: 10 }, children: [
|
|
53
|
-
/* @__PURE__ */ l("span", { style: { color: "#555" }, children: "volume " }),
|
|
54
|
-
/* @__PURE__ */ l("span", { style: { color: "#ccc" }, children: o.toFixed(2) }),
|
|
55
|
-
/* @__PURE__ */ l(
|
|
56
|
-
"div",
|
|
57
|
-
{
|
|
58
|
-
style: {
|
|
59
|
-
marginTop: 4,
|
|
60
|
-
height: 4,
|
|
61
|
-
background: "#222",
|
|
62
|
-
borderRadius: 2,
|
|
63
|
-
overflow: "hidden"
|
|
64
|
-
},
|
|
65
|
-
children: /* @__PURE__ */ l(
|
|
66
|
-
"div",
|
|
67
|
-
{
|
|
68
|
-
style: {
|
|
69
|
-
height: "100%",
|
|
70
|
-
width: `${o * 100}%`,
|
|
71
|
-
background: Q[n],
|
|
72
|
-
borderRadius: 2,
|
|
73
|
-
transition: "width 50ms linear"
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
)
|
|
79
|
-
] }),
|
|
80
|
-
/* @__PURE__ */ N("div", { style: { marginBottom: 10 }, children: [
|
|
81
|
-
/* @__PURE__ */ l("div", { style: { color: "#555", marginBottom: 4, fontSize: 10 }, children: "force state" }),
|
|
82
|
-
/* @__PURE__ */ l("div", { style: { display: "flex", flexWrap: "wrap", gap: 4 }, children: se.map((t) => /* @__PURE__ */ l(
|
|
83
|
-
"button",
|
|
84
|
-
{
|
|
85
|
-
style: {
|
|
86
|
-
fontSize: 10,
|
|
87
|
-
padding: "2px 6px",
|
|
88
|
-
background: n === t ? Q[t] : "#222",
|
|
89
|
-
color: n === t ? "#000" : "#888",
|
|
90
|
-
border: `1px solid ${n === t ? Q[t] : "#333"}`,
|
|
91
|
-
borderRadius: 3,
|
|
92
|
-
cursor: "pointer"
|
|
93
|
-
},
|
|
94
|
-
onClick: () => {
|
|
95
|
-
console.warn(
|
|
96
|
-
`[orb-ui debug] To force state '${t}', use controlled mode: <Orb state="${t}" />`
|
|
97
|
-
);
|
|
98
|
-
},
|
|
99
|
-
children: t
|
|
100
|
-
},
|
|
101
|
-
t
|
|
102
|
-
)) })
|
|
103
|
-
] }),
|
|
104
|
-
/* @__PURE__ */ N("div", { style: { display: "flex", gap: 6 }, children: [
|
|
105
|
-
/* @__PURE__ */ l(
|
|
106
|
-
"button",
|
|
107
|
-
{
|
|
108
|
-
onClick: d,
|
|
109
|
-
style: {
|
|
110
|
-
flex: 1,
|
|
111
|
-
padding: "4px 0",
|
|
112
|
-
background: "#1a3a1a",
|
|
113
|
-
color: "#40f080",
|
|
114
|
-
border: "1px solid #40f080",
|
|
115
|
-
borderRadius: 4,
|
|
116
|
-
cursor: "pointer",
|
|
117
|
-
fontSize: 11
|
|
118
|
-
},
|
|
119
|
-
children: "Start"
|
|
120
|
-
}
|
|
121
|
-
),
|
|
122
|
-
/* @__PURE__ */ l(
|
|
123
|
-
"button",
|
|
124
|
-
{
|
|
125
|
-
onClick: M,
|
|
126
|
-
style: {
|
|
127
|
-
flex: 1,
|
|
128
|
-
padding: "4px 0",
|
|
129
|
-
background: "#3a1a1a",
|
|
130
|
-
color: "#f04040",
|
|
131
|
-
border: "1px solid #f04040",
|
|
132
|
-
borderRadius: 4,
|
|
133
|
-
cursor: "pointer",
|
|
134
|
-
fontSize: 11
|
|
135
|
-
},
|
|
136
|
-
children: "Stop"
|
|
137
|
-
}
|
|
138
|
-
)
|
|
139
|
-
] })
|
|
140
|
-
]
|
|
141
|
-
}
|
|
142
|
-
);
|
|
7
|
+
function c(e, t, n) {
|
|
8
|
+
return e === void 0 ? t === "listening" ? n.inputVolume ?? n.volume ?? 0 : t === "speaking" ? n.outputVolume ?? n.volume ?? 0 : n.volume ?? 0 : e;
|
|
143
9
|
}
|
|
144
|
-
function
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
10
|
+
function l(e, t) {
|
|
11
|
+
let n = { state: "idle" }, r = (t) => {
|
|
12
|
+
n = t, e(t);
|
|
13
|
+
}, i = ((e) => {
|
|
14
|
+
r(e);
|
|
15
|
+
});
|
|
16
|
+
return i.onStateChange = (e) => {
|
|
17
|
+
t(), r({
|
|
18
|
+
...n,
|
|
19
|
+
state: e
|
|
20
|
+
});
|
|
21
|
+
}, i.onVolumeChange = (e) => {
|
|
22
|
+
t(), r({
|
|
23
|
+
...n,
|
|
24
|
+
volume: e
|
|
25
|
+
});
|
|
26
|
+
}, i;
|
|
150
27
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/themes/debug/DebugTheme.tsx
|
|
30
|
+
var u = [
|
|
31
|
+
"idle",
|
|
32
|
+
"connecting",
|
|
33
|
+
"listening",
|
|
34
|
+
"thinking",
|
|
35
|
+
"speaking",
|
|
36
|
+
"error"
|
|
37
|
+
], d = {
|
|
38
|
+
idle: "#888",
|
|
39
|
+
connecting: "#f0c040",
|
|
40
|
+
listening: "#40c0f0",
|
|
41
|
+
thinking: "#c084fc",
|
|
42
|
+
speaking: "#40f080",
|
|
43
|
+
error: "#f04040"
|
|
44
|
+
};
|
|
45
|
+
function f({ state: e, volume: t, size: n, className: r, style: i, disabled: s = !1, onStart: c, onStop: l, ...f }) {
|
|
46
|
+
return /* @__PURE__ */ o("div", {
|
|
47
|
+
...f,
|
|
48
|
+
className: r,
|
|
49
|
+
style: {
|
|
50
|
+
width: n,
|
|
51
|
+
fontFamily: "monospace",
|
|
52
|
+
fontSize: 12,
|
|
53
|
+
background: "#111",
|
|
54
|
+
color: "#ccc",
|
|
55
|
+
border: "1px solid #333",
|
|
56
|
+
borderRadius: 8,
|
|
57
|
+
padding: 12,
|
|
58
|
+
boxSizing: "border-box",
|
|
59
|
+
userSelect: "none",
|
|
60
|
+
...i
|
|
61
|
+
},
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ a("div", {
|
|
64
|
+
style: {
|
|
65
|
+
color: "#555",
|
|
66
|
+
marginBottom: 10,
|
|
67
|
+
fontSize: 10,
|
|
68
|
+
letterSpacing: 1
|
|
69
|
+
},
|
|
70
|
+
children: "ORB DEBUG"
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ o("div", {
|
|
73
|
+
style: { marginBottom: 8 },
|
|
74
|
+
children: [/* @__PURE__ */ a("span", {
|
|
75
|
+
style: { color: "#555" },
|
|
76
|
+
children: "state "
|
|
77
|
+
}), /* @__PURE__ */ a("span", {
|
|
78
|
+
style: {
|
|
79
|
+
color: d[e],
|
|
80
|
+
fontWeight: "bold"
|
|
81
|
+
},
|
|
82
|
+
children: e
|
|
83
|
+
})]
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ o("div", {
|
|
86
|
+
style: { marginBottom: 10 },
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ a("span", {
|
|
89
|
+
style: { color: "#555" },
|
|
90
|
+
children: "volume "
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ a("span", {
|
|
93
|
+
style: { color: "#ccc" },
|
|
94
|
+
children: t.toFixed(2)
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ a("div", {
|
|
97
|
+
style: {
|
|
98
|
+
marginTop: 4,
|
|
99
|
+
height: 4,
|
|
100
|
+
background: "#222",
|
|
101
|
+
borderRadius: 2,
|
|
102
|
+
overflow: "hidden"
|
|
103
|
+
},
|
|
104
|
+
children: /* @__PURE__ */ a("div", { style: {
|
|
105
|
+
height: "100%",
|
|
106
|
+
width: `${t * 100}%`,
|
|
107
|
+
background: d[e],
|
|
108
|
+
borderRadius: 2,
|
|
109
|
+
transition: "width 50ms linear"
|
|
110
|
+
} })
|
|
111
|
+
})
|
|
112
|
+
]
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ o("div", {
|
|
115
|
+
style: { marginBottom: 10 },
|
|
116
|
+
children: [/* @__PURE__ */ a("div", {
|
|
117
|
+
style: {
|
|
118
|
+
color: "#555",
|
|
119
|
+
marginBottom: 4,
|
|
120
|
+
fontSize: 10
|
|
121
|
+
},
|
|
122
|
+
children: "force state"
|
|
123
|
+
}), /* @__PURE__ */ a("div", {
|
|
124
|
+
style: {
|
|
125
|
+
display: "flex",
|
|
126
|
+
flexWrap: "wrap",
|
|
127
|
+
gap: 4
|
|
128
|
+
},
|
|
129
|
+
children: u.map((t) => /* @__PURE__ */ a("button", {
|
|
130
|
+
disabled: s,
|
|
131
|
+
style: {
|
|
132
|
+
fontSize: 10,
|
|
133
|
+
padding: "2px 6px",
|
|
134
|
+
background: e === t ? d[t] : "#222",
|
|
135
|
+
color: e === t ? "#000" : "#888",
|
|
136
|
+
border: `1px solid ${e === t ? d[t] : "#333"}`,
|
|
137
|
+
borderRadius: 3,
|
|
138
|
+
cursor: s ? "not-allowed" : "pointer"
|
|
139
|
+
},
|
|
140
|
+
onClick: () => {
|
|
141
|
+
console.warn(`[orb-ui debug] To force state '${t}', use controlled mode: <Orb state="${t}" />`);
|
|
142
|
+
},
|
|
143
|
+
children: t
|
|
144
|
+
}, t))
|
|
145
|
+
})]
|
|
146
|
+
}),
|
|
147
|
+
/* @__PURE__ */ o("div", {
|
|
148
|
+
style: {
|
|
149
|
+
display: "flex",
|
|
150
|
+
gap: 6
|
|
151
|
+
},
|
|
152
|
+
children: [/* @__PURE__ */ a("button", {
|
|
153
|
+
disabled: s,
|
|
154
|
+
onClick: c,
|
|
155
|
+
style: {
|
|
156
|
+
flex: 1,
|
|
157
|
+
padding: "4px 0",
|
|
158
|
+
background: "#1a3a1a",
|
|
159
|
+
color: "#40f080",
|
|
160
|
+
border: "1px solid #40f080",
|
|
161
|
+
borderRadius: 4,
|
|
162
|
+
cursor: s ? "not-allowed" : "pointer",
|
|
163
|
+
fontSize: 11
|
|
164
|
+
},
|
|
165
|
+
children: "Start"
|
|
166
|
+
}), /* @__PURE__ */ a("button", {
|
|
167
|
+
disabled: s,
|
|
168
|
+
onClick: l,
|
|
169
|
+
style: {
|
|
170
|
+
flex: 1,
|
|
171
|
+
padding: "4px 0",
|
|
172
|
+
background: "#3a1a1a",
|
|
173
|
+
color: "#f04040",
|
|
174
|
+
border: "1px solid #f04040",
|
|
175
|
+
borderRadius: 4,
|
|
176
|
+
cursor: s ? "not-allowed" : "pointer",
|
|
177
|
+
fontSize: 11
|
|
178
|
+
},
|
|
179
|
+
children: "Stop"
|
|
180
|
+
})]
|
|
181
|
+
})
|
|
182
|
+
]
|
|
183
|
+
});
|
|
161
184
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/themes/circle/CircleTheme.tsx
|
|
187
|
+
var p = typeof window < "u" ? n : t;
|
|
188
|
+
function m(e) {
|
|
189
|
+
return [
|
|
190
|
+
parseInt(e.slice(1, 3), 16),
|
|
191
|
+
parseInt(e.slice(3, 5), 16),
|
|
192
|
+
parseInt(e.slice(5, 7), 16)
|
|
193
|
+
];
|
|
166
194
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
195
|
+
var h = {
|
|
196
|
+
idle: "#cccccc",
|
|
197
|
+
connecting: "#cccccc",
|
|
198
|
+
listening: "#999999",
|
|
199
|
+
thinking: "#d8d8d8",
|
|
200
|
+
speaking: "#e8e8e8",
|
|
201
|
+
error: "#f87171"
|
|
202
|
+
}, g = "\n@keyframes orb-circle-idle-pulse {\n from { transform: scale(1); }\n to { transform: scale(1.06); }\n}\n@keyframes orb-circle-connecting-pulse {\n 0% { opacity: 1; transform: scale(1); }\n 50% { opacity: 0.6; transform: scale(0.95); }\n 100% { opacity: 1; transform: scale(1); }\n}\n", _ = .95, v = .08, y = .82, b = .18, x = 24, S = 0, C = .55, w = .12, T = .002;
|
|
203
|
+
function E({ state: e, volume: n, size: i, className: s, style: c, disabled: l = !1, interactive: u = !1, onClick: d, ...f }) {
|
|
204
|
+
let E = r(null), D = r(null), O = r(null), k = r(0), A = r(n);
|
|
205
|
+
p(() => {
|
|
206
|
+
A.current = n;
|
|
207
|
+
}, [n]);
|
|
208
|
+
let j = r(1), M = r(0), N = r(m(h.idle)), P = .06, F = r(y), I = r(b);
|
|
209
|
+
t(() => {
|
|
210
|
+
let e = "orb-circle-keyframes";
|
|
211
|
+
if (!document.getElementById(e)) {
|
|
212
|
+
let t = document.createElement("style");
|
|
213
|
+
t.id = e, t.textContent = g, document.head.appendChild(t);
|
|
214
|
+
}
|
|
215
|
+
}, []), t(() => {
|
|
216
|
+
let t = E.current;
|
|
217
|
+
if (t) if (e === "listening" || e === "speaking") {
|
|
218
|
+
let n = e === "speaking" ? _ : y, r = e === "speaking" ? v : b, i = e === "speaking" ? x : S, a = () => {
|
|
219
|
+
let o = A.current;
|
|
220
|
+
F.current += (n - F.current) * P, I.current += (r - I.current) * P;
|
|
221
|
+
let s = F.current + o * I.current, c = o * i;
|
|
222
|
+
e === "listening" ? (j.current += (s - j.current) * C, M.current += (c - M.current) * C) : (j.current = s, M.current = c);
|
|
223
|
+
let l = m(h[e]), [u, d, f] = N.current;
|
|
224
|
+
N.current = [
|
|
225
|
+
u + (l[0] - u) * .05,
|
|
226
|
+
d + (l[1] - d) * .05,
|
|
227
|
+
f + (l[2] - f) * .05
|
|
228
|
+
];
|
|
229
|
+
let [p, g, _] = N.current.map(Math.round);
|
|
230
|
+
t.style.transform = `scale(${j.current})`, t.style.background = `rgb(${p},${g},${_})`, t.style.boxShadow = "none", t.style.animation = "none";
|
|
231
|
+
let v = D.current;
|
|
232
|
+
if (v) {
|
|
233
|
+
let e = M.current;
|
|
234
|
+
v.style.transform = `scale(${j.current})`, v.style.boxShadow = e > .5 ? `0 0 ${e}px ${e * .4}px rgb(${p},${g},${_})` : "none";
|
|
235
|
+
}
|
|
236
|
+
k.current = requestAnimationFrame(a);
|
|
237
|
+
};
|
|
238
|
+
return k.current = requestAnimationFrame(a), () => {
|
|
239
|
+
cancelAnimationFrame(k.current);
|
|
240
|
+
};
|
|
241
|
+
} else {
|
|
242
|
+
cancelAnimationFrame(k.current);
|
|
243
|
+
let n = h[e] ?? h.idle, r = m(n), i = () => {
|
|
244
|
+
j.current += (1 - j.current) * w, M.current += (0 - M.current) * w;
|
|
245
|
+
let [a, o, s] = N.current;
|
|
246
|
+
N.current = [
|
|
247
|
+
a + (r[0] - a) * w,
|
|
248
|
+
o + (r[1] - o) * w,
|
|
249
|
+
s + (r[2] - s) * w
|
|
250
|
+
];
|
|
251
|
+
let [c, l, u] = N.current.map(Math.round);
|
|
252
|
+
t.style.transform = `scale(${j.current})`, t.style.background = `rgb(${c},${l},${u})`, t.style.boxShadow = "none", t.style.animation = "none", D.current && (D.current.style.transform = `scale(${j.current})`, D.current.style.boxShadow = "none");
|
|
253
|
+
let d = Math.abs(j.current - 1) < T, f = M.current < .1, p = N.current.every((e, t) => Math.abs(e - r[t]) < 1);
|
|
254
|
+
if (d && f && p) {
|
|
255
|
+
j.current = 1, M.current = 0, N.current = r, t.style.transform = "", t.style.boxShadow = "none", t.style.background = n, D.current && (D.current.style.transform = "scale(1)", D.current.style.boxShadow = "none"), e === "idle" ? t.style.animation = "orb-circle-idle-pulse 3s ease-in-out infinite alternate" : e === "connecting" || e === "thinking" ? t.style.animation = "orb-circle-connecting-pulse 1.5s ease-in-out infinite" : t.style.animation = "none";
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
k.current = requestAnimationFrame(i);
|
|
259
|
+
};
|
|
260
|
+
return k.current = requestAnimationFrame(i), () => cancelAnimationFrame(k.current);
|
|
261
|
+
}
|
|
262
|
+
}, [e]);
|
|
263
|
+
let L = i * .55, R = {
|
|
264
|
+
width: i,
|
|
265
|
+
height: i,
|
|
266
|
+
display: "flex",
|
|
267
|
+
alignItems: "center",
|
|
268
|
+
justifyContent: "center",
|
|
269
|
+
position: "relative",
|
|
270
|
+
...c
|
|
271
|
+
}, z = /* @__PURE__ */ o("span", {
|
|
272
|
+
ref: O,
|
|
273
|
+
onMouseEnter: () => {
|
|
274
|
+
O.current && !l && (O.current.style.transform = "scale(1.06)", O.current.style.filter = "brightness(1.12)");
|
|
275
|
+
},
|
|
276
|
+
onMouseLeave: () => {
|
|
277
|
+
O.current && (O.current.style.transform = "scale(1)", O.current.style.filter = "brightness(1)");
|
|
278
|
+
},
|
|
279
|
+
onTouchEnd: () => {
|
|
280
|
+
setTimeout(() => {
|
|
281
|
+
O.current && (O.current.style.transform = "scale(1)", O.current.style.filter = "brightness(1)");
|
|
282
|
+
}, 200);
|
|
283
|
+
},
|
|
284
|
+
style: {
|
|
285
|
+
position: "relative",
|
|
286
|
+
display: "inline-block",
|
|
287
|
+
transition: "transform 0.3s ease, filter 0.3s ease",
|
|
288
|
+
cursor: u ? l ? "not-allowed" : "pointer" : "default",
|
|
289
|
+
borderRadius: "50%",
|
|
290
|
+
lineHeight: 0
|
|
291
|
+
},
|
|
292
|
+
children: [/* @__PURE__ */ a("span", {
|
|
293
|
+
ref: D,
|
|
294
|
+
style: {
|
|
295
|
+
position: "absolute",
|
|
296
|
+
display: "block",
|
|
297
|
+
width: L,
|
|
298
|
+
height: L,
|
|
299
|
+
borderRadius: "50%",
|
|
300
|
+
pointerEvents: "none"
|
|
301
|
+
}
|
|
302
|
+
}), /* @__PURE__ */ a("span", {
|
|
303
|
+
ref: E,
|
|
304
|
+
style: {
|
|
305
|
+
position: "relative",
|
|
306
|
+
display: "block",
|
|
307
|
+
width: L,
|
|
308
|
+
height: L,
|
|
309
|
+
borderRadius: "50%",
|
|
310
|
+
background: h[e]
|
|
311
|
+
}
|
|
312
|
+
})]
|
|
313
|
+
});
|
|
314
|
+
return u ? /* @__PURE__ */ a("button", {
|
|
315
|
+
...f,
|
|
316
|
+
type: "button",
|
|
317
|
+
className: s,
|
|
318
|
+
disabled: l,
|
|
319
|
+
onClick: l ? void 0 : d,
|
|
320
|
+
style: {
|
|
321
|
+
appearance: "none",
|
|
322
|
+
WebkitAppearance: "none",
|
|
323
|
+
border: 0,
|
|
324
|
+
padding: 0,
|
|
325
|
+
margin: 0,
|
|
326
|
+
background: "transparent",
|
|
327
|
+
color: "inherit",
|
|
328
|
+
font: "inherit",
|
|
329
|
+
cursor: l ? "not-allowed" : "pointer",
|
|
330
|
+
...R
|
|
331
|
+
},
|
|
332
|
+
children: z
|
|
333
|
+
}) : /* @__PURE__ */ a("div", {
|
|
334
|
+
...f,
|
|
335
|
+
className: s,
|
|
336
|
+
style: R,
|
|
337
|
+
children: z
|
|
338
|
+
});
|
|
281
339
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region src/themes/bars/BarsTheme.tsx
|
|
342
|
+
var D = 5, O = 1.4, k = Math.PI * 2 / D, A = {
|
|
343
|
+
idle: "#cccccc",
|
|
344
|
+
connecting: "#cccccc",
|
|
345
|
+
listening: "#999999",
|
|
346
|
+
thinking: "#d8d8d8",
|
|
347
|
+
speaking: "#e8e8e8",
|
|
348
|
+
error: "#f87171"
|
|
288
349
|
};
|
|
289
|
-
function
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
350
|
+
function j(e) {
|
|
351
|
+
return [
|
|
352
|
+
parseInt(e.slice(1, 3), 16),
|
|
353
|
+
parseInt(e.slice(3, 5), 16),
|
|
354
|
+
parseInt(e.slice(5, 7), 16)
|
|
355
|
+
];
|
|
295
356
|
}
|
|
296
|
-
function
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
357
|
+
function M({ state: e, volume: n, size: i, className: o, style: s, disabled: c = !1, interactive: l = !1, onClick: u, ...d }) {
|
|
358
|
+
let f = r([]), p = r(null), m = r(0), h = r(Array(D).fill(0)), g = r(n), _ = r(!1), v = r(0), y = r(j(A.idle)), b = r(null), x = r(Array(D).fill(0)), S = r(e);
|
|
359
|
+
t(() => {
|
|
360
|
+
e !== S.current && (x.current = [...h.current], b.current = Date.now(), S.current = e);
|
|
361
|
+
}, [e]), t(() => {
|
|
362
|
+
g.current = n;
|
|
363
|
+
}, [n]), t(() => {
|
|
364
|
+
let t = i * .55, n = i * .06, r = A[e] ?? A.idle, a = i * .1, o = Array.from({ length: D }, (e, t) => {
|
|
365
|
+
let n = (D - 1) / 2;
|
|
366
|
+
return 1 - .7 * (Math.abs(t - n) / n);
|
|
367
|
+
}), s = () => {
|
|
368
|
+
let e = _.current ? a : 0;
|
|
369
|
+
v.current += (e - v.current) * .15;
|
|
370
|
+
}, c = (n, r) => {
|
|
371
|
+
s();
|
|
372
|
+
let i = j(r), [a, c, l] = y.current;
|
|
373
|
+
y.current = [
|
|
374
|
+
a + (i[0] - a) * .08,
|
|
375
|
+
c + (i[1] - c) * .08,
|
|
376
|
+
l + (i[2] - l) * .08
|
|
377
|
+
];
|
|
378
|
+
let [u, d, p] = y.current.map(Math.round), m = `rgb(${u},${d},${p})`;
|
|
379
|
+
for (let r = 0; r < D; r++) {
|
|
380
|
+
let i = f.current[r];
|
|
381
|
+
if (!i) continue;
|
|
382
|
+
let a = e === "idle" ? o[r] : 1, s = v.current * a;
|
|
383
|
+
i.style.height = `${Math.min(n[r] + s, t)}px`, i.style.background = m, i.style.animation = "none";
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
if (e === "listening" || e === "speaking") {
|
|
387
|
+
let i = e === "speaking" ? 1 : .4, a = () => {
|
|
388
|
+
let o = g.current, s = Date.now() / 1e3;
|
|
389
|
+
for (let r = 0; r < D; r++) {
|
|
390
|
+
let a = .5 + .15 * Math.sin(s * O * i * Math.PI * 2 + r * k), c = n + (t - n) * o * a;
|
|
391
|
+
if (b.current !== null) {
|
|
392
|
+
let e = Date.now() - b.current, t = Math.min(e / 300, 1), n = 1 - (1 - t) * (1 - t);
|
|
393
|
+
c = x.current[r] + (c - x.current[r]) * n, t >= 1 && (b.current = null);
|
|
394
|
+
}
|
|
395
|
+
let l = e === "listening" ? .45 : 1;
|
|
396
|
+
h.current[r] += (c - h.current[r]) * l;
|
|
397
|
+
}
|
|
398
|
+
c(h.current, r), m.current = requestAnimationFrame(a);
|
|
399
|
+
};
|
|
400
|
+
return m.current = requestAnimationFrame(a), () => cancelAnimationFrame(m.current);
|
|
401
|
+
}
|
|
402
|
+
if (e === "connecting" || e === "thinking") {
|
|
403
|
+
let e = Date.now(), i = () => {
|
|
404
|
+
let a = (Date.now() - e) / 1e3;
|
|
405
|
+
s();
|
|
406
|
+
for (let e = 0; e < D; e++) {
|
|
407
|
+
let r = (a * .6 + e / D * .5) % 1, i = r < .5 ? Math.sin(r / .5 * Math.PI) : 0, o = n + (t * .4 - n) * i;
|
|
408
|
+
h.current[e] += (o - h.current[e]) * .15;
|
|
409
|
+
}
|
|
410
|
+
c(h.current, r), m.current = requestAnimationFrame(i);
|
|
411
|
+
};
|
|
412
|
+
return m.current = requestAnimationFrame(i), () => cancelAnimationFrame(m.current);
|
|
413
|
+
}
|
|
414
|
+
cancelAnimationFrame(m.current);
|
|
415
|
+
let l = () => {
|
|
416
|
+
s();
|
|
417
|
+
for (let e = 0; e < D; e++) h.current[e] += (n - h.current[e]) * .16;
|
|
418
|
+
c(h.current, r), m.current = requestAnimationFrame(l);
|
|
419
|
+
};
|
|
420
|
+
return m.current = requestAnimationFrame(l), () => cancelAnimationFrame(m.current);
|
|
421
|
+
}, [e, i]);
|
|
422
|
+
let C = i * .055, w = i * .035, T = i * .03, E = i * .55, M = i * .06, N = {
|
|
423
|
+
width: i,
|
|
424
|
+
height: i,
|
|
425
|
+
display: "flex",
|
|
426
|
+
alignItems: "center",
|
|
427
|
+
justifyContent: "center",
|
|
428
|
+
position: "relative",
|
|
429
|
+
...s
|
|
430
|
+
}, P = /* @__PURE__ */ a("span", {
|
|
431
|
+
ref: p,
|
|
432
|
+
onMouseEnter: () => {
|
|
433
|
+
c || (_.current = !0, p.current && (p.current.style.filter = "brightness(1.35)"));
|
|
434
|
+
},
|
|
435
|
+
onMouseLeave: () => {
|
|
436
|
+
_.current = !1, p.current && (p.current.style.filter = "brightness(1)");
|
|
437
|
+
},
|
|
438
|
+
onTouchEnd: () => {
|
|
439
|
+
setTimeout(() => {
|
|
440
|
+
_.current = !1, p.current && (p.current.style.filter = "brightness(1)");
|
|
441
|
+
}, 200);
|
|
442
|
+
},
|
|
443
|
+
style: {
|
|
444
|
+
display: "flex",
|
|
445
|
+
alignItems: "center",
|
|
446
|
+
justifyContent: "center",
|
|
447
|
+
gap: w,
|
|
448
|
+
transition: "filter 0.3s ease",
|
|
449
|
+
cursor: l ? c ? "not-allowed" : "pointer" : "default"
|
|
450
|
+
},
|
|
451
|
+
children: Array.from({ length: D }, (t, n) => /* @__PURE__ */ a("span", {
|
|
452
|
+
ref: (e) => {
|
|
453
|
+
f.current[n] = e;
|
|
454
|
+
},
|
|
455
|
+
style: {
|
|
456
|
+
width: C,
|
|
457
|
+
minHeight: M,
|
|
458
|
+
maxHeight: E,
|
|
459
|
+
height: M,
|
|
460
|
+
borderRadius: T,
|
|
461
|
+
background: A[e] ?? A.idle
|
|
462
|
+
}
|
|
463
|
+
}, n))
|
|
464
|
+
});
|
|
465
|
+
return l ? /* @__PURE__ */ a("button", {
|
|
466
|
+
...d,
|
|
467
|
+
type: "button",
|
|
468
|
+
className: o,
|
|
469
|
+
disabled: c,
|
|
470
|
+
onClick: c ? void 0 : u,
|
|
471
|
+
style: {
|
|
472
|
+
appearance: "none",
|
|
473
|
+
WebkitAppearance: "none",
|
|
474
|
+
border: 0,
|
|
475
|
+
padding: 0,
|
|
476
|
+
margin: 0,
|
|
477
|
+
background: "transparent",
|
|
478
|
+
color: "inherit",
|
|
479
|
+
font: "inherit",
|
|
480
|
+
cursor: c ? "not-allowed" : "pointer",
|
|
481
|
+
...N
|
|
482
|
+
},
|
|
483
|
+
children: P
|
|
484
|
+
}) : /* @__PURE__ */ a("div", {
|
|
485
|
+
...d,
|
|
486
|
+
className: o,
|
|
487
|
+
style: N,
|
|
488
|
+
children: P
|
|
489
|
+
});
|
|
424
490
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
navigator.mediaDevices.getUserMedia = async (c) => {
|
|
431
|
-
const u = await h(c);
|
|
432
|
-
return c != null && c.audio && (d = u), u;
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
function M(h) {
|
|
436
|
-
if (!(!d || o))
|
|
437
|
-
try {
|
|
438
|
-
n = new AudioContext(), o = n.createAnalyser(), o.fftSize = 256, e = n.createMediaStreamSource(d), e.connect(o);
|
|
439
|
-
const c = new Uint8Array(o.frequencyBinCount), u = () => {
|
|
440
|
-
if (!o) return;
|
|
441
|
-
o.getByteFrequencyData(c);
|
|
442
|
-
let p = 0;
|
|
443
|
-
for (let g = 0; g < c.length; g++) p += c[g] * c[g];
|
|
444
|
-
const T = Math.sqrt(p / c.length) / 255, S = T > A ? 0.7 : 0.3;
|
|
445
|
-
A += (T - A) * S, h(ie(A)), k = requestAnimationFrame(u);
|
|
446
|
-
};
|
|
447
|
-
k = requestAnimationFrame(u);
|
|
448
|
-
} catch (c) {
|
|
449
|
-
console.warn("[orb-ui] Mic monitor failed:", c);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
function t() {
|
|
453
|
-
cancelAnimationFrame(k), k = 0, A = 0, e == null || e.disconnect(), e = null, o = null;
|
|
454
|
-
}
|
|
455
|
-
function r() {
|
|
456
|
-
t(), n && (n.close().catch(() => {
|
|
457
|
-
}), n = null), d == null || d.getTracks().forEach((h) => {
|
|
458
|
-
h.readyState === "live" && h.stop();
|
|
459
|
-
}), d = null;
|
|
460
|
-
}
|
|
461
|
-
return { start: M, stop: t, release: r };
|
|
491
|
+
//#endregion
|
|
492
|
+
//#region src/components/Orb/Orb.tsx
|
|
493
|
+
var N = !1;
|
|
494
|
+
function P() {
|
|
495
|
+
return globalThis.process?.env?.NODE_ENV === "production";
|
|
462
496
|
}
|
|
463
|
-
function
|
|
464
|
-
|
|
465
|
-
volume: o,
|
|
466
|
-
adapter: e,
|
|
467
|
-
theme: k = "debug",
|
|
468
|
-
size: A = 200,
|
|
469
|
-
className: d,
|
|
470
|
-
style: M,
|
|
471
|
-
onStart: t,
|
|
472
|
-
onStop: r
|
|
473
|
-
}) {
|
|
474
|
-
const [m, h] = Z("idle"), [c, u] = Z(0), [p, T] = Z(0), S = s(ve()), g = s(!1);
|
|
475
|
-
B(() => (h("idle"), u(0), T(0), e ? e.subscribe({
|
|
476
|
-
onStateChange: h,
|
|
477
|
-
onVolumeChange: u
|
|
478
|
-
}) : void 0), [e]);
|
|
479
|
-
const y = n ?? m;
|
|
480
|
-
B(() => {
|
|
481
|
-
const i = S.current;
|
|
482
|
-
if (y === "listening" && e) {
|
|
483
|
-
const w = setTimeout(() => {
|
|
484
|
-
i.start(T), g.current = !0;
|
|
485
|
-
}, 500);
|
|
486
|
-
return () => {
|
|
487
|
-
clearTimeout(w), i.stop(), g.current = !1, T(0);
|
|
488
|
-
};
|
|
489
|
-
} else
|
|
490
|
-
i.stop(), g.current = !1, T(0);
|
|
491
|
-
}, [y, e]), B(() => () => S.current.release(), []);
|
|
492
|
-
const f = o ?? (y === "listening" && g.current ? p : c), x = y !== "idle" && y !== "error", q = oe(() => {
|
|
493
|
-
var i, w;
|
|
494
|
-
x ? r ? r() : (i = e == null ? void 0 : e.stop) == null || i.call(e) : t ? t() : (w = e == null ? void 0 : e.start) == null || w.call(e);
|
|
495
|
-
}, [e, x, t, r]), L = !!(e != null && e.start || t || r), F = { state: y, volume: f, size: A, className: d, style: M }, $ = L ? q : void 0;
|
|
496
|
-
switch (k) {
|
|
497
|
-
case "circle":
|
|
498
|
-
return /* @__PURE__ */ l(ge, { ...F, onClick: $ });
|
|
499
|
-
case "bars":
|
|
500
|
-
return /* @__PURE__ */ l(ye, { ...F, onClick: $ });
|
|
501
|
-
case "debug":
|
|
502
|
-
default:
|
|
503
|
-
return /* @__PURE__ */ l(
|
|
504
|
-
le,
|
|
505
|
-
{
|
|
506
|
-
...F,
|
|
507
|
-
onStart: t ?? (() => {
|
|
508
|
-
var i;
|
|
509
|
-
return (i = e == null ? void 0 : e.start) == null ? void 0 : i.call(e);
|
|
510
|
-
}),
|
|
511
|
-
onStop: r ?? (() => {
|
|
512
|
-
var i;
|
|
513
|
-
return (i = e == null ? void 0 : e.stop) == null ? void 0 : i.call(e);
|
|
514
|
-
})
|
|
515
|
-
}
|
|
516
|
-
);
|
|
517
|
-
}
|
|
497
|
+
function F() {
|
|
498
|
+
N || P() || (N = !0, console.warn("[orb-ui] Callback-object adapters are deprecated. Use subscribe(listener) and emit OrbSignal objects instead. Legacy adapters will be removed in 0.5.0."));
|
|
518
499
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
};
|
|
500
|
+
function I({ signal: n, state: r, volume: o, adapter: u, theme: d = "debug", size: p = 200, className: m, style: h, disabled: g = !1, onStart: _, onStop: v, ...y }) {
|
|
501
|
+
let [b, x] = i({ state: "idle" });
|
|
502
|
+
t(() => {
|
|
503
|
+
if (x({ state: "idle" }), !u) return;
|
|
504
|
+
let e = l(x, F);
|
|
505
|
+
return u.subscribe(e);
|
|
506
|
+
}, [u]);
|
|
507
|
+
let S = n ?? b, C = s(r, n, b), w = c(o, C, S), T = C !== "idle" && C !== "error", D = e(() => {
|
|
508
|
+
g || (T ? v ? v() : u?.stop?.() : _ ? _() : u?.start?.());
|
|
509
|
+
}, [
|
|
510
|
+
u,
|
|
511
|
+
g,
|
|
512
|
+
T,
|
|
513
|
+
_,
|
|
514
|
+
v
|
|
515
|
+
]), O = T ? !!(u?.stop || v) : !!(u?.start || _), k = O && !g ? D : void 0, A = {
|
|
516
|
+
state: C,
|
|
517
|
+
volume: w,
|
|
518
|
+
size: p,
|
|
519
|
+
className: m,
|
|
520
|
+
style: h,
|
|
521
|
+
disabled: g,
|
|
522
|
+
...y,
|
|
523
|
+
"aria-label": y["aria-label"] ?? (O ? `${T ? "Stop" : "Start"} voice session` : void 0)
|
|
524
|
+
}, j = {
|
|
525
|
+
...A,
|
|
526
|
+
interactive: O
|
|
527
|
+
};
|
|
528
|
+
switch (d) {
|
|
529
|
+
case "circle": return /* @__PURE__ */ a(E, {
|
|
530
|
+
...j,
|
|
531
|
+
onClick: k
|
|
532
|
+
});
|
|
533
|
+
case "bars": return /* @__PURE__ */ a(M, {
|
|
534
|
+
...j,
|
|
535
|
+
onClick: k
|
|
536
|
+
});
|
|
537
|
+
default: return /* @__PURE__ */ a(f, {
|
|
538
|
+
...A,
|
|
539
|
+
onStart: g ? void 0 : _ ?? (() => u?.start?.()),
|
|
540
|
+
onStop: g ? void 0 : v ?? (() => u?.stop?.())
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
//#endregion
|
|
545
|
+
export { I as Orb, I as VoiceOrb };
|