@actioneer/ads 1.0.7 → 1.0.9
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/DESIGN.md +119 -91
- package/README.md +19 -1
- package/components/ai-elements/chart.js +20 -20
- package/components/ai-elements/inline-citation.js +50 -50
- package/components/ai-elements/message.js +1 -1
- package/components/ai-elements/tool.js +5 -5
- package/components/alert.d.ts +3 -2
- package/components/alert.js +25 -25
- package/components/answer.js +1 -1
- package/components/assistant-ui/action-bar.js +1 -1
- package/components/assistant-ui/attachment.js +68 -49
- package/components/assistant-ui/composer-add-context.js +1 -1
- package/components/assistant-ui/composer-harness.js +5 -4
- package/components/assistant-ui/composer-trigger-popover.js +1 -1
- package/components/assistant-ui/composer.js +13 -13
- package/components/assistant-ui/message-timing.js +6 -6
- package/components/assistant-ui/selection-toolbar.js +5 -5
- package/components/assistant-ui/sources.js +15 -15
- package/components/assistant-ui/tooltip-icon-button.js +18 -14
- package/components/audio-waveform.d.ts +21 -8
- package/components/audio-waveform.js +371 -94
- package/components/autocomplete.js +9 -9
- package/components/breadcrumbs.js +36 -42
- package/components/button.d.ts +16 -1
- package/components/button.js +86 -73
- package/components/card.js +1 -1
- package/components/chart.d.ts +31 -4
- package/components/chart.js +900 -666
- package/components/chip.d.ts +2 -1
- package/components/chip.js +56 -51
- package/components/command-palette.js +12 -12
- package/components/connector-card.d.ts +1 -2
- package/components/connector-card.js +17 -17
- package/components/date-range-picker.js +1 -2
- package/components/drawer.js +9 -10
- package/components/dropdown.js +1 -1
- package/components/empty-state.d.ts +2 -0
- package/components/empty-state.js +17 -15
- package/components/field.js +9 -10
- package/components/file-dropzone.d.ts +6 -3
- package/components/file-dropzone.js +72 -60
- package/components/filters.d.ts +37 -0
- package/components/filters.js +129 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +447 -444
- package/components/infinite-canvas.js +9 -9
- package/components/modal.d.ts +2 -1
- package/components/modal.js +102 -91
- package/components/page-body.js +8 -8
- package/components/popover.d.ts +6 -1
- package/components/popover.js +75 -65
- package/components/progress-circle.d.ts +1 -1
- package/components/progress-circle.js +57 -48
- package/components/segmented.d.ts +1 -0
- package/components/segmented.js +34 -36
- package/components/select.js +2 -2
- package/components/selection-action-bar.js +32 -31
- package/components/setting-row.js +10 -10
- package/components/sidebar.d.ts +15 -0
- package/components/sidebar.js +186 -149
- package/components/slider.js +5 -5
- package/components/stepper.d.ts +1 -1
- package/components/stepper.js +1 -1
- package/components/switch.js +10 -10
- package/components/table.d.ts +10 -2
- package/components/table.js +380 -366
- package/components/tabs.d.ts +6 -1
- package/components/tabs.js +32 -29
- package/components/timeline.js +3 -3
- package/components/toast.js +53 -56
- package/components/ui/button.js +4 -4
- package/components/ui/dialog.js +1 -1
- package/components/viz-charts.js +263 -221
- package/demo/components/add-to-artifact.js +3 -2
- package/examples/README.md +31 -0
- package/examples/agents-screen.tsx +477 -0
- package/examples/campaign-analysis-screen.tsx +138 -0
- package/examples/campaigns-screen.tsx +439 -0
- package/examples/settings-screen.tsx +90 -0
- package/examples/workspace-header.tsx +71 -0
- package/lib/icons.d.ts +8 -0
- package/lib/icons.js +171 -118
- package/llms.txt +93 -29
- package/manifest.json +1660 -113
- package/package.json +1 -1
- package/styles.css +55 -68
- package/theme.css +50 -59
|
@@ -1,67 +1,344 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as a, jsxs as b } from "react/jsx-runtime";
|
|
3
3
|
import * as u from "react";
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Spinner as
|
|
6
|
-
import { Warning as
|
|
7
|
-
import { cn as
|
|
8
|
-
function
|
|
9
|
-
if (!
|
|
10
|
-
const
|
|
11
|
-
return
|
|
4
|
+
import { Button as fe, buttonVariants as me } from "./button.js";
|
|
5
|
+
import { Spinner as ce } from "./spinner.js";
|
|
6
|
+
import { Warning as he, Pause as ge, Play as pe, Download as ue } from "../lib/icons.js";
|
|
7
|
+
import { cn as X } from "../lib/cn.js";
|
|
8
|
+
function L(r) {
|
|
9
|
+
if (!r || !Number.isFinite(r) || r < 0) return "0:00";
|
|
10
|
+
const t = Math.floor(r), s = Math.floor(t / 3600), d = Math.floor(t % 3600 / 60), l = t % 60;
|
|
11
|
+
return s > 0 ? `${s}:${String(d).padStart(2, "0")}:${String(l).padStart(2, "0")}` : `${d}:${String(l).padStart(2, "0")}`;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return getComputedStyle(
|
|
13
|
+
function ae(r, t, s) {
|
|
14
|
+
return getComputedStyle(r).getPropertyValue(t).trim() || s;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
var
|
|
18
|
-
if (
|
|
19
|
-
const
|
|
20
|
-
return `${decodeURIComponent(
|
|
16
|
+
function de(r, t, s) {
|
|
17
|
+
var e;
|
|
18
|
+
if (s) return s;
|
|
19
|
+
const d = t != null && t.includes("wav") ? "wav" : t != null && t.includes("mpeg") ? "mp3" : "audio", l = ((e = r.split("/").filter(Boolean).at(-1)) == null ? void 0 : e.split("?")[0]) || "recording";
|
|
20
|
+
return `${decodeURIComponent(l)}.${d}`;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
function Ce({ look: r = "minimal", ...t }) {
|
|
23
|
+
return r === "classic" ? /* @__PURE__ */ a(Ne, { ...t }) : /* @__PURE__ */ a(Me, { ...t });
|
|
24
|
+
}
|
|
25
|
+
const Y = 40, z = 3, se = 5, be = 1024, J = 5;
|
|
26
|
+
function ve(r, t) {
|
|
27
|
+
const s = new Array(t).fill(0);
|
|
28
|
+
if (!r.length) return s;
|
|
29
|
+
let d = 0;
|
|
30
|
+
for (let l = 0; l < t; l++) {
|
|
31
|
+
const e = Math.floor(l / t * r.length), n = Math.max(e + 1, Math.floor((l + 1) / t * r.length));
|
|
32
|
+
let y = 0;
|
|
33
|
+
for (let v = e; v < n && v < r.length; v++) {
|
|
34
|
+
const f = Math.abs(r[v] ?? 0);
|
|
35
|
+
f > y && (y = f);
|
|
36
|
+
}
|
|
37
|
+
s[l] = y, y > d && (d = y);
|
|
38
|
+
}
|
|
39
|
+
return d > 0 ? s.map((l) => l / d) : s;
|
|
40
|
+
}
|
|
41
|
+
function le(r, t, s) {
|
|
42
|
+
if (!r.length) return 0;
|
|
43
|
+
const d = Math.floor(t / s * r.length), l = Math.max(d + 1, Math.floor((t + 1) / s * r.length));
|
|
44
|
+
let e = 0;
|
|
45
|
+
for (let n = d; n < l && n < r.length; n++) e = Math.max(e, r[n] ?? 0);
|
|
46
|
+
return e;
|
|
47
|
+
}
|
|
48
|
+
function Q(r, t, s, d, l) {
|
|
49
|
+
const e = Math.min(l, s / 2, d / 2), n = (y) => Number(y.toFixed(2));
|
|
50
|
+
return `M${n(r + e)} ${n(t)}h${n(s - 2 * e)}a${n(e)} ${n(e)} 0 0 1 ${n(e)} ${n(e)}v${n(d - 2 * e)}a${n(e)} ${n(e)} 0 0 1 ${n(-e)} ${n(e)}h${n(-(s - 2 * e))}a${n(e)} ${n(e)} 0 0 1 ${n(-e)} ${n(-e)}v${n(-(d - 2 * e))}a${n(e)} ${n(e)} 0 0 1 ${n(e)} ${n(-e)}Z`;
|
|
51
|
+
}
|
|
52
|
+
function xe(r, t, s, d, l) {
|
|
53
|
+
const e = { rest: "", hover: "", played: "" }, n = r[0];
|
|
54
|
+
if (!n || t <= 0) return e;
|
|
55
|
+
const y = r[1] ?? n, v = Math.floor(t / se), f = Y / 2, M = z / 2, N = 2.5;
|
|
56
|
+
for (let g = 0; g < v; g++) {
|
|
57
|
+
const x = g * se + 1, m = le(n, g, v), D = le(y, g, v);
|
|
58
|
+
let $;
|
|
59
|
+
if (s) {
|
|
60
|
+
const p = m * (f - 2), P = D * (f - 2);
|
|
61
|
+
p < N && P < N ? $ = Q(x, f - M, z, z, M) : $ = (p >= N ? Q(x, f - 1 - p, z, p, M) : "") + (P >= N ? Q(x, f + 1, z, P, M) : "");
|
|
62
|
+
} else {
|
|
63
|
+
const p = Math.max(z, Math.max(m, D) * (Y - 4));
|
|
64
|
+
$ = Q(x, f - p / 2, z, p, M);
|
|
65
|
+
}
|
|
66
|
+
const C = x + z / 2;
|
|
67
|
+
C <= d ? e.played += $ : C <= l ? e.hover += $ : e.rest += $;
|
|
68
|
+
}
|
|
69
|
+
return e;
|
|
70
|
+
}
|
|
71
|
+
function we() {
|
|
72
|
+
return /* @__PURE__ */ a("svg", { viewBox: "0 0 256 256", "aria-hidden": "true", className: "block size-3.5", children: /* @__PURE__ */ a(
|
|
73
|
+
"path",
|
|
74
|
+
{
|
|
75
|
+
d: "M87 52 L87 204 L210 128 Z",
|
|
76
|
+
className: "fill-current stroke-current",
|
|
77
|
+
strokeWidth: 28,
|
|
78
|
+
strokeLinejoin: "round"
|
|
79
|
+
}
|
|
80
|
+
) });
|
|
81
|
+
}
|
|
82
|
+
function ye() {
|
|
83
|
+
return /* @__PURE__ */ b("svg", { viewBox: "0 0 256 256", "aria-hidden": "true", className: "block size-3.5 fill-current", children: [
|
|
84
|
+
/* @__PURE__ */ a("rect", { x: 56, y: 40, width: 48, height: 176, rx: 16 }),
|
|
85
|
+
/* @__PURE__ */ a("rect", { x: 152, y: 40, width: 48, height: 176, rx: 16 })
|
|
86
|
+
] });
|
|
87
|
+
}
|
|
88
|
+
function Me({
|
|
89
|
+
src: r,
|
|
90
|
+
durationSeconds: t,
|
|
91
|
+
contentType: s,
|
|
92
|
+
channels: d,
|
|
93
|
+
topLabel: l = "Agent",
|
|
94
|
+
bottomLabel: e = "User",
|
|
95
|
+
downloadName: n,
|
|
96
|
+
className: y
|
|
31
97
|
}) {
|
|
32
|
-
const
|
|
98
|
+
const v = u.useRef(null), f = u.useRef(null), M = u.useRef(null), N = u.useRef(!1), [g, x] = u.useState(0), [m, D] = u.useState(t ?? 0), [$, C] = u.useState(!1), [p, P] = u.useState(!1), [E, K] = u.useState(null), [Z, R] = u.useState([]), [I, T] = u.useState(0), [B, j] = u.useState(null), G = (d ?? 0) > 1, ee = de(r, s, n);
|
|
33
99
|
u.useEffect(() => {
|
|
34
|
-
const o =
|
|
100
|
+
const o = f.current;
|
|
101
|
+
if (!o) return;
|
|
102
|
+
const i = () => T(Math.floor(o.clientWidth));
|
|
103
|
+
i();
|
|
104
|
+
const c = new ResizeObserver(i);
|
|
105
|
+
return c.observe(o), () => c.disconnect();
|
|
106
|
+
}, []), u.useEffect(() => {
|
|
107
|
+
const o = v.current;
|
|
35
108
|
if (!o) return;
|
|
36
|
-
let
|
|
37
|
-
return
|
|
109
|
+
let i = !1;
|
|
110
|
+
return x(0), D(t ?? 0), C(!1), P(!1), K(null), R([]), o.replaceChildren(), (async () => {
|
|
111
|
+
try {
|
|
112
|
+
const { default: c } = await import("wavesurfer.js");
|
|
113
|
+
if (i) return;
|
|
114
|
+
const h = c.create({
|
|
115
|
+
container: o,
|
|
116
|
+
url: r,
|
|
117
|
+
duration: t,
|
|
118
|
+
height: 1,
|
|
119
|
+
cursorWidth: 0,
|
|
120
|
+
interact: !1,
|
|
121
|
+
hideScrollbar: !0,
|
|
122
|
+
renderFunction: () => {
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
M.current = h;
|
|
126
|
+
const U = () => {
|
|
127
|
+
const S = h.getDecodedData();
|
|
128
|
+
if (!S) return;
|
|
129
|
+
const V = Math.min(S.numberOfChannels, 2), ie = [];
|
|
130
|
+
for (let oe = 0; oe < V; oe++)
|
|
131
|
+
ie.push(ve(S.getChannelData(oe), be));
|
|
132
|
+
R(ie);
|
|
133
|
+
};
|
|
134
|
+
h.on("decode", U), h.on("ready", (S) => {
|
|
135
|
+
U(), D(S), C(!0);
|
|
136
|
+
}), h.on("timeupdate", (S) => x(S)), h.on("seeking", (S) => x(S)), h.on("play", () => P(!0)), h.on("pause", () => P(!1)), h.on("finish", () => {
|
|
137
|
+
P(!1), x(h.getDuration());
|
|
138
|
+
}), h.on("error", () => {
|
|
139
|
+
K("Recording could not be loaded"), C(!1);
|
|
140
|
+
});
|
|
141
|
+
} catch {
|
|
142
|
+
i || K("Recording could not be loaded");
|
|
143
|
+
}
|
|
144
|
+
})(), () => {
|
|
145
|
+
var c;
|
|
146
|
+
i = !0, (c = M.current) == null || c.destroy(), M.current = null;
|
|
147
|
+
};
|
|
148
|
+
}, [r, t]);
|
|
149
|
+
const w = $ && !E, A = () => {
|
|
150
|
+
var o;
|
|
151
|
+
w && ((o = M.current) == null || o.playPause());
|
|
152
|
+
}, k = (o) => {
|
|
153
|
+
const i = M.current;
|
|
154
|
+
if (!i || !w || m <= 0) return;
|
|
155
|
+
const c = Math.min(Math.max(o, 0), m);
|
|
156
|
+
i.setTime(c), x(c);
|
|
157
|
+
}, H = (o) => {
|
|
158
|
+
const i = f.current;
|
|
159
|
+
if (!i) return null;
|
|
160
|
+
const c = i.getBoundingClientRect();
|
|
161
|
+
return c.width > 0 ? Math.min(1, Math.max(0, (o - c.left) / c.width)) : null;
|
|
162
|
+
}, te = (o) => {
|
|
163
|
+
if (!w || o.button !== 0) return;
|
|
164
|
+
const i = H(o.clientX);
|
|
165
|
+
i != null && (N.current = !0, o.currentTarget.setPointerCapture(o.pointerId), k(i * m));
|
|
166
|
+
}, re = (o) => {
|
|
167
|
+
if (!w) return;
|
|
168
|
+
const i = H(o.clientX);
|
|
169
|
+
i != null && (j(i), N.current && k(i * m));
|
|
170
|
+
}, q = (o) => {
|
|
171
|
+
N.current = !1, o.currentTarget.hasPointerCapture(o.pointerId) && o.currentTarget.releasePointerCapture(o.pointerId);
|
|
172
|
+
}, ne = (o) => {
|
|
173
|
+
if (!w) return;
|
|
174
|
+
const c = {
|
|
175
|
+
ArrowRight: g + J,
|
|
176
|
+
ArrowUp: g + J,
|
|
177
|
+
ArrowLeft: g - J,
|
|
178
|
+
ArrowDown: g - J,
|
|
179
|
+
Home: 0,
|
|
180
|
+
End: m
|
|
181
|
+
}[o.key];
|
|
182
|
+
c !== void 0 && (o.preventDefault(), k(c));
|
|
183
|
+
}, _ = m > 0 ? Math.min(1, g / m) : 0, W = w && B != null, F = u.useMemo(
|
|
184
|
+
() => w ? xe(
|
|
185
|
+
Z,
|
|
186
|
+
I,
|
|
187
|
+
G,
|
|
188
|
+
_ * I,
|
|
189
|
+
W ? (B ?? 0) * I : -1
|
|
190
|
+
) : { rest: "", hover: "", played: "" },
|
|
191
|
+
[Z, I, G, _, W, B, w]
|
|
192
|
+
), O = G ? `Seek recording, ${l} above, ${e} below` : "Seek recording";
|
|
193
|
+
return /* @__PURE__ */ b(
|
|
194
|
+
"div",
|
|
195
|
+
{
|
|
196
|
+
className: X("flex items-center gap-3 rounded-l bg-wg2 py-2 pl-2 pr-4 text-on-warm-grey-primary", y),
|
|
197
|
+
"data-slot": "audio-waveform",
|
|
198
|
+
"data-look": "minimal",
|
|
199
|
+
children: [
|
|
200
|
+
/* @__PURE__ */ a("div", { ref: v, hidden: !0 }),
|
|
201
|
+
/* @__PURE__ */ a(
|
|
202
|
+
"button",
|
|
203
|
+
{
|
|
204
|
+
type: "button",
|
|
205
|
+
onClick: A,
|
|
206
|
+
disabled: !w,
|
|
207
|
+
"aria-label": p ? "Pause recording" : "Play recording",
|
|
208
|
+
className: X(
|
|
209
|
+
"inline-flex size-9 shrink-0 items-center justify-center rounded-full bg-wg12 text-white",
|
|
210
|
+
"outline-none transition-[background-color,transform] motion-reduce:transition-none",
|
|
211
|
+
"enabled:hover:bg-wg11 enabled:active:scale-[0.97] enabled:active:bg-wg11",
|
|
212
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
|
|
213
|
+
"disabled:cursor-default disabled:opacity-30"
|
|
214
|
+
),
|
|
215
|
+
children: p ? /* @__PURE__ */ a(ye, {}) : /* @__PURE__ */ a(we, {})
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
/* @__PURE__ */ b(
|
|
219
|
+
"div",
|
|
220
|
+
{
|
|
221
|
+
ref: f,
|
|
222
|
+
role: "slider",
|
|
223
|
+
tabIndex: w ? 0 : -1,
|
|
224
|
+
"aria-label": O,
|
|
225
|
+
"aria-valuemin": 0,
|
|
226
|
+
"aria-valuemax": Math.round(m),
|
|
227
|
+
"aria-valuenow": Math.round(g),
|
|
228
|
+
"aria-valuetext": `${L(g)} of ${L(m)}`,
|
|
229
|
+
"aria-disabled": !w,
|
|
230
|
+
onPointerDown: te,
|
|
231
|
+
onPointerMove: re,
|
|
232
|
+
onPointerUp: q,
|
|
233
|
+
onPointerCancel: q,
|
|
234
|
+
onPointerLeave: () => j(null),
|
|
235
|
+
onKeyDown: ne,
|
|
236
|
+
className: X(
|
|
237
|
+
"relative h-10 min-w-0 flex-1 touch-none select-none rounded-xs outline-none",
|
|
238
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-wg2",
|
|
239
|
+
w ? "cursor-pointer" : "cursor-default"
|
|
240
|
+
),
|
|
241
|
+
children: [
|
|
242
|
+
/* @__PURE__ */ b(
|
|
243
|
+
"svg",
|
|
244
|
+
{
|
|
245
|
+
width: I,
|
|
246
|
+
height: Y,
|
|
247
|
+
viewBox: `0 0 ${Math.max(I, 1)} ${Y}`,
|
|
248
|
+
preserveAspectRatio: "none",
|
|
249
|
+
"aria-hidden": "true",
|
|
250
|
+
className: "block h-10 w-full",
|
|
251
|
+
children: [
|
|
252
|
+
/* @__PURE__ */ a("path", { d: F.rest, className: "fill-wg7" }),
|
|
253
|
+
/* @__PURE__ */ a("path", { d: F.hover, className: "fill-wg8" }),
|
|
254
|
+
/* @__PURE__ */ a("path", { d: F.played, className: "fill-wg12" })
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
),
|
|
258
|
+
W && /* @__PURE__ */ a(
|
|
259
|
+
"span",
|
|
260
|
+
{
|
|
261
|
+
"aria-hidden": "true",
|
|
262
|
+
className: "pointer-events-none absolute bottom-full z-10 mb-1.5 -translate-x-1/2 whitespace-nowrap rounded-s bg-wg12 px-1.5 py-0.5 font-mono text-xs tabular-nums text-white",
|
|
263
|
+
style: { left: `${(B ?? 0) * 100}%` },
|
|
264
|
+
children: L((B ?? 0) * m)
|
|
265
|
+
}
|
|
266
|
+
),
|
|
267
|
+
!$ && !E && /* @__PURE__ */ b("div", { className: "absolute inset-0 flex items-center gap-2 text-s text-on-warm-grey-secondary", children: [
|
|
268
|
+
/* @__PURE__ */ a(ce, { variant: "content", size: "xs", "aria-hidden": !0 }),
|
|
269
|
+
"Loading recording"
|
|
270
|
+
] }),
|
|
271
|
+
E && /* @__PURE__ */ a("div", { role: "alert", className: "absolute inset-0 flex items-center text-s text-danger-700", children: E })
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
),
|
|
275
|
+
/* @__PURE__ */ b("span", { className: "shrink-0 font-mono text-s tabular-nums text-on-warm-grey-secondary", children: [
|
|
276
|
+
L(g),
|
|
277
|
+
" / ",
|
|
278
|
+
L(m)
|
|
279
|
+
] }),
|
|
280
|
+
/* @__PURE__ */ a(
|
|
281
|
+
"a",
|
|
282
|
+
{
|
|
283
|
+
href: r,
|
|
284
|
+
download: ee,
|
|
285
|
+
"aria-label": "Download recording",
|
|
286
|
+
className: X(
|
|
287
|
+
"-mr-2 inline-flex size-7 shrink-0 items-center justify-center rounded-s text-on-warm-grey-secondary",
|
|
288
|
+
"outline-none transition-[background-color,color,transform] motion-reduce:transition-none",
|
|
289
|
+
"hover:bg-wg4 hover:text-on-warm-grey-primary active:scale-[0.97]",
|
|
290
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-wg2"
|
|
291
|
+
),
|
|
292
|
+
children: /* @__PURE__ */ a(ue, { "aria-hidden": "true", className: "size-4" })
|
|
293
|
+
}
|
|
294
|
+
)
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
function Ne({
|
|
300
|
+
src: r,
|
|
301
|
+
durationSeconds: t,
|
|
302
|
+
contentType: s,
|
|
303
|
+
channels: d,
|
|
304
|
+
topLabel: l = "Agent",
|
|
305
|
+
bottomLabel: e = "User",
|
|
306
|
+
downloadName: n,
|
|
307
|
+
className: y
|
|
308
|
+
}) {
|
|
309
|
+
const v = u.useRef(null), f = u.useRef(null), [M, N] = u.useState(0), [g, x] = u.useState(t ?? 0), [m, D] = u.useState(!1), [$, C] = u.useState(!1), [p, P] = u.useState(null), E = (d ?? 0) > 1, K = de(r, s, n);
|
|
310
|
+
u.useEffect(() => {
|
|
311
|
+
const R = v.current;
|
|
312
|
+
if (!R) return;
|
|
313
|
+
let I = !1;
|
|
314
|
+
return N(0), x(t ?? 0), D(!1), C(!1), P(null), R.replaceChildren(), (async () => {
|
|
38
315
|
try {
|
|
39
|
-
const [{ default:
|
|
316
|
+
const [{ default: T }, { default: B }] = await Promise.all([
|
|
40
317
|
import("wavesurfer.js"),
|
|
41
318
|
import("wavesurfer.js/dist/plugins/hover.esm.js")
|
|
42
319
|
]);
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
47
|
-
const h = Math.floor(
|
|
48
|
-
let
|
|
49
|
-
for (let
|
|
50
|
-
return
|
|
320
|
+
if (I) return;
|
|
321
|
+
const j = ae(R, "--foreground", "currentColor"), G = ae(R, "--muted-foreground", "currentColor"), ee = ae(R, "--background", "Canvas"), w = (k, H) => {
|
|
322
|
+
const te = k[0] ?? [], re = k[1] ?? k[0] ?? [], { width: q, height: ne } = H.canvas, _ = ne / 2, W = 4, F = 2, O = Math.max(1, Math.floor(q / (W + F))), o = (i, c) => {
|
|
323
|
+
if (!i.length) return 0;
|
|
324
|
+
const h = Math.floor(c / O * i.length), U = Math.max(h + 1, Math.floor((c + 1) / O * i.length));
|
|
325
|
+
let S = 0;
|
|
326
|
+
for (let V = h; V < U; V++) S = Math.max(S, Math.abs(Number(i[V]) || 0));
|
|
327
|
+
return S;
|
|
51
328
|
};
|
|
52
|
-
for (let
|
|
53
|
-
const
|
|
54
|
-
|
|
329
|
+
for (let i = 0; i < O; i++) {
|
|
330
|
+
const c = i * (W + F), h = Math.max(1, o(te, i) * (_ - 2)), U = Math.max(1, o(re, i) * (_ - 2));
|
|
331
|
+
H.fillRect(c, _ - h, W, h), H.fillRect(c, _ + 1, W, U);
|
|
55
332
|
}
|
|
56
|
-
},
|
|
57
|
-
container:
|
|
58
|
-
url:
|
|
59
|
-
duration:
|
|
333
|
+
}, A = T.create({
|
|
334
|
+
container: R,
|
|
335
|
+
url: r,
|
|
336
|
+
duration: t,
|
|
60
337
|
height: 92,
|
|
61
338
|
normalize: !0,
|
|
62
|
-
waveColor:
|
|
63
|
-
progressColor:
|
|
64
|
-
cursorColor:
|
|
339
|
+
waveColor: G,
|
|
340
|
+
progressColor: j,
|
|
341
|
+
cursorColor: j,
|
|
65
342
|
cursorWidth: 1,
|
|
66
343
|
barWidth: 2,
|
|
67
344
|
barGap: 1,
|
|
@@ -69,80 +346,80 @@ function ge({
|
|
|
69
346
|
barMinHeight: 1,
|
|
70
347
|
dragToSeek: !0,
|
|
71
348
|
hideScrollbar: !0,
|
|
72
|
-
renderFunction:
|
|
349
|
+
renderFunction: E ? w : void 0,
|
|
73
350
|
plugins: [
|
|
74
|
-
|
|
75
|
-
lineColor:
|
|
76
|
-
labelColor:
|
|
77
|
-
labelBackground:
|
|
351
|
+
B.create({
|
|
352
|
+
lineColor: j,
|
|
353
|
+
labelColor: ee,
|
|
354
|
+
labelBackground: j,
|
|
78
355
|
labelSize: 11,
|
|
79
|
-
formatTimeCallback:
|
|
356
|
+
formatTimeCallback: L
|
|
80
357
|
})
|
|
81
358
|
]
|
|
82
359
|
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}),
|
|
86
|
-
|
|
87
|
-
}),
|
|
88
|
-
|
|
360
|
+
f.current = A, A.on("ready", (k) => {
|
|
361
|
+
x(k), D(!0);
|
|
362
|
+
}), A.on("timeupdate", (k) => N(k)), A.on("seeking", (k) => N(k)), A.on("play", () => C(!0)), A.on("pause", () => C(!1)), A.on("finish", () => {
|
|
363
|
+
C(!1), N(A.getDuration());
|
|
364
|
+
}), A.on("error", () => {
|
|
365
|
+
P("Recording could not be loaded."), D(!1);
|
|
89
366
|
});
|
|
90
367
|
} catch {
|
|
91
|
-
|
|
368
|
+
I || P("Recording could not be loaded.");
|
|
92
369
|
}
|
|
93
370
|
})(), () => {
|
|
94
|
-
var
|
|
95
|
-
|
|
371
|
+
var T;
|
|
372
|
+
I = !0, (T = f.current) == null || T.destroy(), f.current = null;
|
|
96
373
|
};
|
|
97
|
-
}, [
|
|
98
|
-
const
|
|
99
|
-
var
|
|
100
|
-
!
|
|
374
|
+
}, [r, t, E]);
|
|
375
|
+
const Z = () => {
|
|
376
|
+
var R;
|
|
377
|
+
!m || p || (R = f.current) == null || R.playPause();
|
|
101
378
|
};
|
|
102
|
-
return /* @__PURE__ */
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
/* @__PURE__ */
|
|
379
|
+
return /* @__PURE__ */ b("div", { className: X("space-y-3", y), "data-slot": "audio-waveform", "data-look": "classic", children: [
|
|
380
|
+
/* @__PURE__ */ b("div", { className: "flex items-center justify-between gap-3", children: [
|
|
381
|
+
/* @__PURE__ */ b("div", { className: "min-w-0", children: [
|
|
382
|
+
/* @__PURE__ */ a("p", { className: "text-base font-normal", children: "Recording" }),
|
|
383
|
+
/* @__PURE__ */ a("p", { className: "mt-0.5 truncate text-xs text-muted-foreground", children: E ? `${l} above · ${e.toLowerCase()} below` : s ?? "Audio" })
|
|
107
384
|
] }),
|
|
108
|
-
/* @__PURE__ */
|
|
385
|
+
/* @__PURE__ */ a("p", { className: "font-mono text-xs tabular-nums text-muted-foreground", children: L(g) })
|
|
109
386
|
] }),
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
387
|
+
/* @__PURE__ */ b("div", { className: "relative overflow-hidden py-2", children: [
|
|
388
|
+
E && /* @__PURE__ */ b("div", { className: "pointer-events-none absolute inset-x-0 top-2 z-10 flex h-[92px] flex-col items-center justify-between text-xs font-normal uppercase tracking-wide text-muted-foreground", children: [
|
|
389
|
+
/* @__PURE__ */ a("span", { className: "rounded-sm bg-card/85 px-1.5 py-0.5", children: l }),
|
|
390
|
+
/* @__PURE__ */ a("span", { className: "rounded-sm bg-card/85 px-1.5 py-0.5", children: e })
|
|
114
391
|
] }),
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
!
|
|
117
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ a("div", { ref: v, className: "min-h-[92px]" }),
|
|
393
|
+
!m && !p && /* @__PURE__ */ a("div", { className: "absolute inset-0 flex items-center justify-center bg-background/70", children: /* @__PURE__ */ b("div", { className: "inline-flex items-center gap-2 rounded-md bg-background px-3 py-1.5 text-xs text-muted-foreground", children: [
|
|
394
|
+
/* @__PURE__ */ a(ce, { variant: "content", size: "xs", "aria-hidden": !0 }),
|
|
118
395
|
"Loading waveform"
|
|
119
396
|
] }) }),
|
|
120
|
-
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
-
|
|
397
|
+
p && /* @__PURE__ */ a("div", { className: "absolute inset-0 flex items-center justify-center bg-background/80", children: /* @__PURE__ */ b("div", { className: "inline-flex items-center gap-2 rounded-md bg-background px-3 py-1.5 text-xs text-muted-foreground", children: [
|
|
398
|
+
/* @__PURE__ */ a(he, { className: "size-3.5", "aria-hidden": "true" }),
|
|
399
|
+
p
|
|
123
400
|
] }) })
|
|
124
401
|
] }),
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
/* @__PURE__ */
|
|
127
|
-
|
|
402
|
+
/* @__PURE__ */ b("div", { className: "flex items-center justify-between gap-3", children: [
|
|
403
|
+
/* @__PURE__ */ a(
|
|
404
|
+
fe,
|
|
128
405
|
{
|
|
129
406
|
type: "button",
|
|
130
407
|
variant: "secondary",
|
|
131
|
-
onClick:
|
|
132
|
-
disabled: !
|
|
133
|
-
"aria-label":
|
|
134
|
-
startContent:
|
|
408
|
+
onClick: Z,
|
|
409
|
+
disabled: !m || !!p,
|
|
410
|
+
"aria-label": $ ? "Pause recording" : "Play recording",
|
|
411
|
+
startContent: $ ? /* @__PURE__ */ a(ge, { "aria-hidden": "true" }) : /* @__PURE__ */ a(pe, { "aria-hidden": "true" }),
|
|
135
412
|
className: "font-mono tabular-nums",
|
|
136
|
-
children:
|
|
413
|
+
children: L(M)
|
|
137
414
|
}
|
|
138
415
|
),
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
/* @__PURE__ */
|
|
416
|
+
/* @__PURE__ */ b("a", { href: r, download: K, className: me({ variant: "ghost" }), children: [
|
|
417
|
+
/* @__PURE__ */ a(ue, { "aria-hidden": "true", className: "size-4" }),
|
|
141
418
|
"Audio"
|
|
142
419
|
] })
|
|
143
420
|
] })
|
|
144
421
|
] });
|
|
145
422
|
}
|
|
146
423
|
export {
|
|
147
|
-
|
|
424
|
+
Ce as AudioWaveform
|
|
148
425
|
};
|
|
@@ -3,7 +3,7 @@ import { jsxs as x, jsx as c } from "react/jsx-runtime";
|
|
|
3
3
|
import * as i from "react";
|
|
4
4
|
import { MotionConfig as z, AnimatePresence as q, motion as O } from "motion/react";
|
|
5
5
|
import { Search as P, Check as B } from "../lib/icons.js";
|
|
6
|
-
import { cn as
|
|
6
|
+
import { cn as w } from "../lib/cn.js";
|
|
7
7
|
import { inputBaseClass as F } from "./field.js";
|
|
8
8
|
import { floatVariants as K } from "../lib/motion.js";
|
|
9
9
|
import { Ripple as Q } from "./ripple.js";
|
|
@@ -20,7 +20,7 @@ const T = i.forwardRef(
|
|
|
20
20
|
id: I,
|
|
21
21
|
"aria-describedby": M
|
|
22
22
|
}, L) => {
|
|
23
|
-
const d = u.find((e) => e.value === f), [m, h] = i.useState((d == null ? void 0 : d.label) ?? ""), [r, a] = i.useState(!1), [n,
|
|
23
|
+
const d = u.find((e) => e.value === f), [m, h] = i.useState((d == null ? void 0 : d.label) ?? ""), [r, a] = i.useState(!1), [n, y] = i.useState(-1), N = i.useRef(null), k = i.useRef(null), b = i.useId();
|
|
24
24
|
i.useEffect(() => {
|
|
25
25
|
h((d == null ? void 0 : d.label) ?? (p ? f ?? "" : ""));
|
|
26
26
|
}, [d, f, p]);
|
|
@@ -42,7 +42,7 @@ const T = i.forwardRef(
|
|
|
42
42
|
e == null || e.scrollIntoView({ block: "nearest" });
|
|
43
43
|
}, [r, n]);
|
|
44
44
|
const g = (e) => {
|
|
45
|
-
l.length !== 0 &&
|
|
45
|
+
l.length !== 0 && y((t) => {
|
|
46
46
|
let o = t;
|
|
47
47
|
for (let v = 0; v < l.length; v++)
|
|
48
48
|
if (o = (o + e + l.length) % l.length, !l[o].disabled) return o;
|
|
@@ -98,11 +98,11 @@ const T = i.forwardRef(
|
|
|
98
98
|
placeholder: A,
|
|
99
99
|
value: m,
|
|
100
100
|
onChange: (e) => {
|
|
101
|
-
h(e.target.value), a(!0),
|
|
101
|
+
h(e.target.value), a(!0), y(-1), p && (s == null || s(e.target.value));
|
|
102
102
|
},
|
|
103
103
|
onFocus: () => a(!0),
|
|
104
104
|
onKeyDown: $,
|
|
105
|
-
className:
|
|
105
|
+
className: w(F, "h-10 pl-9", S)
|
|
106
106
|
}
|
|
107
107
|
)
|
|
108
108
|
] }),
|
|
@@ -117,9 +117,9 @@ const T = i.forwardRef(
|
|
|
117
117
|
animate: "visible",
|
|
118
118
|
exit: "hidden",
|
|
119
119
|
style: { transformOrigin: "top" },
|
|
120
|
-
className:
|
|
120
|
+
className: w(
|
|
121
121
|
"absolute z-50 mt-1.5 max-h-60 w-full overflow-auto p-1",
|
|
122
|
-
"rounded-md border border-border bg-elevated
|
|
122
|
+
"rounded-md border border-border bg-elevated"
|
|
123
123
|
),
|
|
124
124
|
children: [
|
|
125
125
|
/* @__PURE__ */ c(Q, { origin: "top" }),
|
|
@@ -139,10 +139,10 @@ const T = i.forwardRef(
|
|
|
139
139
|
role: "option",
|
|
140
140
|
"aria-selected": o,
|
|
141
141
|
"aria-disabled": e.disabled || void 0,
|
|
142
|
-
onMouseEnter: () => !e.disabled &&
|
|
142
|
+
onMouseEnter: () => !e.disabled && y(t),
|
|
143
143
|
onMouseDown: (j) => j.preventDefault(),
|
|
144
144
|
onClick: () => D(t),
|
|
145
|
-
className:
|
|
145
|
+
className: w(
|
|
146
146
|
"flex cursor-pointer items-center justify-between gap-2",
|
|
147
147
|
"rounded-sm px-2 py-1.5 text-m text-foreground select-none",
|
|
148
148
|
v && !e.disabled && "bg-action-primary-soft text-brand-text",
|