@epam/ai-dial-conversation-input 1.1.0-dev.162 → 1.1.0-dev.168
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/components/Input/Input.d.ts.map +1 -1
- package/components/VoiceBar/VoiceBar.d.ts +1 -5
- package/components/VoiceBar/VoiceBar.d.ts.map +1 -1
- package/hooks/useVoiceRecorder.d.ts +0 -2
- package/hooks/useVoiceRecorder.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.js +413 -425
- package/models/ConversationInput.d.ts +0 -2
- package/models/ConversationInput.d.ts.map +1 -1
- package/models/Input.d.ts +0 -2
- package/models/Input.d.ts.map +1 -1
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, RequestStatus as r, ResponseFormat as i, buildCssVars as a, mergeClasses as o, useIsMobile as s } from "@epam/ai-dial-chat-shared";
|
|
2
2
|
import { BASE_ICON_SIZE as c, Button as l, CloseButton as u, DIAL_ICON_SIZE as d, DialDropdownIcon as f, DialRadioGroup as p, DialSearch as m, DialSlider as h, DialTooltip as g, Dropdown as _, ElementSize as v, ErrorText as y, GhostIconButton as b, Highlight as x, Input as S, NeutralButton as C, Popup as w, PopupSize as T, PrimaryButton as E, PrimaryIconButton as D, RadioGroupOrientation as O, Skeleton as k, SkeletonVariant as A, StaticIconButton as j } from "@epam/ai-dial-ui-kit";
|
|
3
|
-
import { IconArrowLeft as
|
|
3
|
+
import { IconArrowLeft as M, IconArrowNarrowRight as N, IconCheck as ee, IconChevronDown as P, IconChevronRight as te, IconFile as ne, IconMicrophone as re, IconPaperclip as F, IconPlayerStopFilled as ie, IconPlaystationSquare as ae, IconPlus as oe, IconSettings as se, IconTool as ce, IconX as le } from "@tabler/icons-react";
|
|
4
4
|
import { createPortal as ue } from "react-dom";
|
|
5
|
-
import { createElement as de, memo as
|
|
5
|
+
import { createElement as de, memo as I, useCallback as L, useEffect as R, useImperativeHandle as fe, useLayoutEffect as pe, useMemo as z, useRef as B, useState as V } from "react";
|
|
6
6
|
import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
|
|
7
|
-
import { AttachmentCard as me, AttachmentGroup as
|
|
7
|
+
import { AttachmentCard as me, AttachmentGroup as G, AttachmentTray as he, AttachmentTray as ge, FileDndOverlay as _e, MAX_UPLOADS_PER_MINUTE as ve, generateAttachmentId as ye, getAttachmentIcon as be, useClipboardPaste as xe } from "@epam/ai-dial-attachment-input";
|
|
8
8
|
//#region src/hooks/useBottomSheet.ts
|
|
9
|
-
var
|
|
10
|
-
|
|
9
|
+
var Se = (e, t) => {
|
|
10
|
+
R(() => {
|
|
11
11
|
if (!e) return;
|
|
12
12
|
let n = (e) => {
|
|
13
13
|
e.key === "Escape" && t();
|
|
14
14
|
};
|
|
15
15
|
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
16
|
-
}, [e, t]),
|
|
16
|
+
}, [e, t]), R(() => {
|
|
17
17
|
if (e) return document.body.style.overflow = "hidden", () => {
|
|
18
18
|
document.body.style.overflow = "";
|
|
19
19
|
};
|
|
20
20
|
}, [e]);
|
|
21
|
-
},
|
|
21
|
+
}, Ce = {
|
|
22
22
|
backdrop: "_backdrop_1d50f_9",
|
|
23
23
|
sheet: "_sheet_1d50f_13",
|
|
24
24
|
"slide-up": "_slide-up_1d50f_1",
|
|
25
25
|
title: "_title_1d50f_18",
|
|
26
26
|
divider: "_divider_1d50f_22"
|
|
27
|
-
},
|
|
28
|
-
if (
|
|
27
|
+
}, K = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: s, "aria-label": c, style: l, titleClassName: f = "dial-body-semi-text", className: p, colors: m, children: h }) => {
|
|
28
|
+
if (Se(e, r), !e || typeof document > "u") return null;
|
|
29
29
|
let g = a({
|
|
30
30
|
"--ci-backdrop": m?.backdrop,
|
|
31
31
|
"--ci-sheet-bg": m?.sheetBg,
|
|
@@ -33,7 +33,7 @@ var Ce = (e, t) => {
|
|
|
33
33
|
"--ci-sheet-divider": m?.divider
|
|
34
34
|
});
|
|
35
35
|
return ue(/* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("div", {
|
|
36
|
-
className: o(
|
|
36
|
+
className: o(Ce.backdrop, "fixed inset-0 z-[55]"),
|
|
37
37
|
style: g,
|
|
38
38
|
onPointerDown: r,
|
|
39
39
|
"aria-hidden": !0
|
|
@@ -45,14 +45,14 @@ var Ce = (e, t) => {
|
|
|
45
45
|
...g,
|
|
46
46
|
...l
|
|
47
47
|
},
|
|
48
|
-
className: o(
|
|
48
|
+
className: o(Ce.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col rounded-t-lg", p),
|
|
49
49
|
children: [t != null && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ W("div", {
|
|
50
50
|
className: "relative flex h-[60px] flex-shrink-0 items-center justify-center px-4",
|
|
51
51
|
children: [
|
|
52
52
|
i && /* @__PURE__ */ U("div", {
|
|
53
53
|
className: "absolute start-4",
|
|
54
54
|
children: /* @__PURE__ */ U(b, {
|
|
55
|
-
icon: /* @__PURE__ */ U(
|
|
55
|
+
icon: /* @__PURE__ */ U(M, {
|
|
56
56
|
size: d.LG,
|
|
57
57
|
stroke: 1.5,
|
|
58
58
|
className: "rtl:scale-x-[-1]"
|
|
@@ -62,7 +62,7 @@ var Ce = (e, t) => {
|
|
|
62
62
|
})
|
|
63
63
|
}),
|
|
64
64
|
/* @__PURE__ */ U("span", {
|
|
65
|
-
className: o(
|
|
65
|
+
className: o(Ce.title, f),
|
|
66
66
|
children: t
|
|
67
67
|
}),
|
|
68
68
|
/* @__PURE__ */ U("div", {
|
|
@@ -74,28 +74,28 @@ var Ce = (e, t) => {
|
|
|
74
74
|
})
|
|
75
75
|
})
|
|
76
76
|
]
|
|
77
|
-
}), /* @__PURE__ */ U("div", { className: o(
|
|
77
|
+
}), /* @__PURE__ */ U("div", { className: o(Ce.divider, "h-px flex-shrink-0") })] }), /* @__PURE__ */ U("div", {
|
|
78
78
|
className: "overflow-y-auto",
|
|
79
79
|
children: h
|
|
80
80
|
})]
|
|
81
81
|
})] }), document.body);
|
|
82
|
-
},
|
|
82
|
+
}, we = async (e, t, n) => {
|
|
83
83
|
let r = 6e4 / t, i = [];
|
|
84
84
|
for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
|
|
85
85
|
await Promise.allSettled(i);
|
|
86
|
-
},
|
|
86
|
+
}, Te = ({ initialAttachments: n, onUploadAttachment: i, onAttachmentsChange: a, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, pendingAttachments: l, onPendingAttachmentsConsumed: u, onExpandPastedText: d, maximumAttachmentsAmount: f, baseAttachmentsAmount: p = 0, onAttachmentsLimitExceeded: m }) => {
|
|
87
87
|
let [h, g] = V(n), _ = B(h);
|
|
88
|
-
|
|
88
|
+
R(() => {
|
|
89
89
|
_.current = h;
|
|
90
|
-
}, [h]),
|
|
90
|
+
}, [h]), R(() => () => {
|
|
91
91
|
_.current.forEach((e) => {
|
|
92
92
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
93
93
|
});
|
|
94
94
|
}, []);
|
|
95
|
-
let v =
|
|
95
|
+
let v = L((e) => e.map((e) => {
|
|
96
96
|
let n = e.type.startsWith("image/"), i = e.type.startsWith("audio/"), a = n ? URL.createObjectURL(e) : void 0, o = i ? URL.createObjectURL(e) : void 0;
|
|
97
97
|
return {
|
|
98
|
-
id:
|
|
98
|
+
id: ye(),
|
|
99
99
|
name: e.name,
|
|
100
100
|
contentType: e.type,
|
|
101
101
|
file: e,
|
|
@@ -105,25 +105,25 @@ var Ce = (e, t) => {
|
|
|
105
105
|
playUrl: o
|
|
106
106
|
};
|
|
107
107
|
}), []), y = B(a);
|
|
108
|
-
|
|
108
|
+
R(() => {
|
|
109
109
|
y.current = a;
|
|
110
110
|
}, [a]);
|
|
111
|
-
let b = B(!0), x =
|
|
111
|
+
let b = B(!0), x = L((e) => {
|
|
112
112
|
g((t) => {
|
|
113
113
|
let n = e(t);
|
|
114
114
|
return n === t ? t : n;
|
|
115
115
|
});
|
|
116
116
|
}, []);
|
|
117
|
-
|
|
117
|
+
R(() => {
|
|
118
118
|
if (b.current) {
|
|
119
119
|
b.current = !1;
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
y.current?.(h);
|
|
123
123
|
}, [h]);
|
|
124
|
-
let S =
|
|
124
|
+
let S = L((e) => {
|
|
125
125
|
g(e);
|
|
126
|
-
}, []), C =
|
|
126
|
+
}, []), C = L(async (t) => {
|
|
127
127
|
if (i) {
|
|
128
128
|
x((e) => e.map((e) => e.id === t.id ? {
|
|
129
129
|
...e,
|
|
@@ -145,7 +145,7 @@ var Ce = (e, t) => {
|
|
|
145
145
|
} : e));
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
}, [i, x]), w =
|
|
148
|
+
}, [i, x]), w = L((e, t = !0) => {
|
|
149
149
|
let n = new Set(_.current.map((e) => e.id)), i = e.filter((e) => !n.has(e.id));
|
|
150
150
|
if (i.length !== 0) {
|
|
151
151
|
if (f != null && f > 0 && Number.isFinite(f)) {
|
|
@@ -166,7 +166,7 @@ var Ce = (e, t) => {
|
|
|
166
166
|
status: r.Error,
|
|
167
167
|
errorReason: n
|
|
168
168
|
} : e));
|
|
169
|
-
}),
|
|
169
|
+
}), we(e, ve, C);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
}, [
|
|
@@ -177,20 +177,20 @@ var Ce = (e, t) => {
|
|
|
177
177
|
C,
|
|
178
178
|
o
|
|
179
179
|
]);
|
|
180
|
-
|
|
180
|
+
R(() => {
|
|
181
181
|
s.length !== 0 && (w(v(s)), c?.());
|
|
182
182
|
}, [
|
|
183
183
|
w,
|
|
184
184
|
v,
|
|
185
185
|
c,
|
|
186
186
|
s
|
|
187
|
-
]),
|
|
187
|
+
]), R(() => {
|
|
188
188
|
l.length !== 0 && (w(l, !1), u?.());
|
|
189
189
|
}, [
|
|
190
190
|
w,
|
|
191
191
|
u,
|
|
192
192
|
l
|
|
193
|
-
]),
|
|
193
|
+
]), R(() => {
|
|
194
194
|
if (!o) return;
|
|
195
195
|
let t = !1, n = [], i = _.current.map((i) => {
|
|
196
196
|
if (i.status === r.Loading) return i;
|
|
@@ -217,7 +217,7 @@ var Ce = (e, t) => {
|
|
|
217
217
|
x,
|
|
218
218
|
C
|
|
219
219
|
]);
|
|
220
|
-
let T =
|
|
220
|
+
let T = L((e) => {
|
|
221
221
|
x((t) => {
|
|
222
222
|
let n = t.find((t) => t.id === e);
|
|
223
223
|
return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
|
|
@@ -229,11 +229,11 @@ var Ce = (e, t) => {
|
|
|
229
229
|
addAttachments: w,
|
|
230
230
|
resetAttachments: S,
|
|
231
231
|
handleRemove: T,
|
|
232
|
-
handleRetry:
|
|
232
|
+
handleRetry: L((e) => {
|
|
233
233
|
let t = h.find((t) => t.id === e);
|
|
234
234
|
t && C(t);
|
|
235
235
|
}, [h, C]),
|
|
236
|
-
handleExpand:
|
|
236
|
+
handleExpand: L(async (e) => {
|
|
237
237
|
let n = h.find((t) => t.id === e);
|
|
238
238
|
if (!n || n.type !== t.Pasted) return;
|
|
239
239
|
let r = await n.file.text();
|
|
@@ -245,9 +245,9 @@ var Ce = (e, t) => {
|
|
|
245
245
|
]),
|
|
246
246
|
hasBlockedAttachments: h.some((e) => e.status === r.Loading || e.status === r.Error)
|
|
247
247
|
};
|
|
248
|
-
},
|
|
248
|
+
}, Ee = (e, t) => {
|
|
249
249
|
let [n, r] = V(e), [i, a] = V(!1), [o, s] = V(0);
|
|
250
|
-
return
|
|
250
|
+
return R(() => {
|
|
251
251
|
if (e) {
|
|
252
252
|
r(!0), a(!1), s((e) => e + 1);
|
|
253
253
|
return;
|
|
@@ -263,15 +263,15 @@ var Ce = (e, t) => {
|
|
|
263
263
|
isExiting: i,
|
|
264
264
|
instanceKey: o
|
|
265
265
|
};
|
|
266
|
-
},
|
|
266
|
+
}, De = (e, t) => !e.slice(0, t).includes("\n"), Oe = (e, t) => !e.slice(t).includes("\n"), ke = (e) => {
|
|
267
267
|
let t = B(e);
|
|
268
268
|
t.current = e;
|
|
269
|
-
let n = B(-1), r = B(""), i =
|
|
269
|
+
let n = B(-1), r = B(""), i = L((e, i, a) => {
|
|
270
270
|
let o = t.current;
|
|
271
|
-
return !o || o.length === 0 ? null : e === "up" ? !
|
|
272
|
-
}, []), a =
|
|
271
|
+
return !o || o.length === 0 ? null : e === "up" ? !De(i, a) || n.current === 0 ? null : (n.current === -1 ? (r.current = i, n.current = o.length - 1) : --n.current, o[n.current]) : n.current === -1 || !Oe(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
|
|
272
|
+
}, []), a = L(() => {
|
|
273
273
|
n.current = -1, r.current = "";
|
|
274
|
-
}, []), o =
|
|
274
|
+
}, []), o = L(() => {
|
|
275
275
|
n.current = -1, r.current = "";
|
|
276
276
|
}, []);
|
|
277
277
|
return z(() => ({
|
|
@@ -283,13 +283,13 @@ var Ce = (e, t) => {
|
|
|
283
283
|
a,
|
|
284
284
|
o
|
|
285
285
|
]);
|
|
286
|
-
},
|
|
286
|
+
}, Ae = ({ messageProp: e, messageRevision: t }) => {
|
|
287
287
|
let [n, r] = V(e), i = B(null), a = B(0), [o, s] = V(!1);
|
|
288
|
-
return
|
|
288
|
+
return R(() => {
|
|
289
289
|
r(e);
|
|
290
|
-
}, [e, t]),
|
|
290
|
+
}, [e, t]), R(() => {
|
|
291
291
|
i.current && (a.current = i.current.offsetHeight);
|
|
292
|
-
}, []),
|
|
292
|
+
}, []), pe(() => {
|
|
293
293
|
if (!i.current || a.current === 0) return;
|
|
294
294
|
let e = i.current.offsetHeight > a.current;
|
|
295
295
|
s((t) => e ? !0 : n === "" ? !1 : t);
|
|
@@ -299,67 +299,62 @@ var Ce = (e, t) => {
|
|
|
299
299
|
textareaRef: i,
|
|
300
300
|
isMultiLine: o
|
|
301
301
|
};
|
|
302
|
-
},
|
|
302
|
+
}, je = /* @__PURE__ */ function(e) {
|
|
303
303
|
return e.Idle = "idle", e.Recording = "recording", e.Error = "error", e;
|
|
304
|
-
}({}),
|
|
304
|
+
}({}), Me = [
|
|
305
305
|
"audio/webm;codecs=opus",
|
|
306
306
|
"audio/ogg;codecs=opus",
|
|
307
307
|
"audio/webm"
|
|
308
|
-
],
|
|
309
|
-
let [t, n] = V("idle"), [r, i] = V(null),
|
|
310
|
-
|
|
311
|
-
let
|
|
312
|
-
|
|
313
|
-
}, []),
|
|
314
|
-
h(), s.current &&= (s.current.getTracks().forEach((e) => e.stop()), null), c.current &&= (c.current.close(), null), l.current = null, u.current = null;
|
|
315
|
-
}, [h]), _ = I(() => {
|
|
308
|
+
], Ne = () => Me.find((e) => MediaRecorder.isTypeSupported(e)) ?? "", Pe = ({ onAttachAudio: e }) => {
|
|
309
|
+
let [t, n] = V("idle"), [r, i] = V(null), a = B(null), o = B(null), s = B(null), c = B(null), l = B([]), u = B(""), d = B(e);
|
|
310
|
+
d.current = e;
|
|
311
|
+
let f = L(() => {
|
|
312
|
+
a.current &&= (a.current.getTracks().forEach((e) => e.stop()), null), o.current &&= (o.current.close(), null), s.current = null, c.current = null;
|
|
313
|
+
}, []), p = L(() => {
|
|
316
314
|
(async () => {
|
|
317
315
|
try {
|
|
318
316
|
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
319
|
-
|
|
317
|
+
a.current = e;
|
|
320
318
|
let t = new AudioContext();
|
|
321
|
-
|
|
319
|
+
o.current = t;
|
|
322
320
|
let r = t.createAnalyser();
|
|
323
|
-
r.fftSize = 256,
|
|
324
|
-
let i =
|
|
325
|
-
|
|
326
|
-
let
|
|
327
|
-
|
|
328
|
-
e.data.size > 0 &&
|
|
329
|
-
},
|
|
330
|
-
o((e) => e + 1);
|
|
331
|
-
}, 1e3);
|
|
321
|
+
r.fftSize = 256, s.current = r, t.createMediaStreamSource(e).connect(r);
|
|
322
|
+
let i = Ne();
|
|
323
|
+
u.current = i, l.current = [];
|
|
324
|
+
let d = new MediaRecorder(e, i ? { mimeType: i } : void 0);
|
|
325
|
+
c.current = d, d.ondataavailable = (e) => {
|
|
326
|
+
e.data.size > 0 && l.current.push(e.data);
|
|
327
|
+
}, d.start(), n("recording");
|
|
332
328
|
} catch (e) {
|
|
333
329
|
i(e instanceof Error ? e.message : "Microphone access denied"), n("error");
|
|
334
330
|
}
|
|
335
331
|
})();
|
|
336
|
-
}, []),
|
|
337
|
-
let e =
|
|
338
|
-
!e || e.state !== "recording" || (
|
|
339
|
-
let e =
|
|
340
|
-
|
|
332
|
+
}, []), m = L(() => {
|
|
333
|
+
let e = c.current;
|
|
334
|
+
!e || e.state !== "recording" || (e.onstop = () => {
|
|
335
|
+
let e = u.current || "audio/webm", t = new Blob(l.current, { type: e }), r = e.split(";")[0], a = r.split("/")[1] ?? "webm", o = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, -1), s = new File([t], `voice-${o}.${a}`, { type: r });
|
|
336
|
+
d.current(s), f(), i(null), n("idle");
|
|
341
337
|
}, e.stop());
|
|
342
|
-
}, [
|
|
343
|
-
let e =
|
|
344
|
-
e && e.state === "recording" && (e.ondataavailable = null, e.onstop = null, e.stop()),
|
|
345
|
-
}, [
|
|
346
|
-
return
|
|
347
|
-
|
|
348
|
-
}, [
|
|
338
|
+
}, [f]), h = L(() => {
|
|
339
|
+
let e = c.current;
|
|
340
|
+
e && e.state === "recording" && (e.ondataavailable = null, e.onstop = null, e.stop()), f(), i(null), n("idle");
|
|
341
|
+
}, [f]);
|
|
342
|
+
return R(() => () => {
|
|
343
|
+
f();
|
|
344
|
+
}, [f]), {
|
|
349
345
|
state: t,
|
|
350
|
-
analyserNodeRef:
|
|
351
|
-
elapsedSeconds: a,
|
|
346
|
+
analyserNodeRef: s,
|
|
352
347
|
errorMessage: r,
|
|
353
|
-
startRecording:
|
|
354
|
-
stopRecording:
|
|
355
|
-
discardRecording:
|
|
348
|
+
startRecording: p,
|
|
349
|
+
stopRecording: m,
|
|
350
|
+
discardRecording: h
|
|
356
351
|
};
|
|
357
|
-
},
|
|
352
|
+
}, Fe = /* @__PURE__ */ function(e) {
|
|
358
353
|
return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
|
|
359
|
-
}({}),
|
|
354
|
+
}({}), Ie = {
|
|
360
355
|
item: "_item_5iycw_1",
|
|
361
356
|
itemIcon: "_itemIcon_5iycw_11"
|
|
362
|
-
},
|
|
357
|
+
}, Le = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: s, className: c, titleClassName: u = "dial-body-semi-text", itemLabelClassName: d = "dial-small-text", btnTextClassName: f = "", colors: p }) => {
|
|
363
358
|
let m = (e) => {
|
|
364
359
|
e(), r();
|
|
365
360
|
}, h = a({
|
|
@@ -368,7 +363,7 @@ var Ce = (e, t) => {
|
|
|
368
363
|
"--ci-sheet-item-active": p?.itemActiveBg,
|
|
369
364
|
"--ci-sheet-icon": p?.itemIcon
|
|
370
365
|
});
|
|
371
|
-
return /* @__PURE__ */ U(
|
|
366
|
+
return /* @__PURE__ */ U(K, {
|
|
372
367
|
isOpen: e,
|
|
373
368
|
title: t,
|
|
374
369
|
closeLabel: n,
|
|
@@ -383,9 +378,9 @@ var Ce = (e, t) => {
|
|
|
383
378
|
style: h,
|
|
384
379
|
children: s.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ U("li", { children: /* @__PURE__ */ U(l, {
|
|
385
380
|
type: "button",
|
|
386
|
-
className: o(
|
|
381
|
+
className: o(Ie.item, "w-full gap-3 px-4 py-[10px] text-start"),
|
|
387
382
|
iconBefore: /* @__PURE__ */ U("span", {
|
|
388
|
-
className:
|
|
383
|
+
className: Ie.itemIcon,
|
|
389
384
|
children: n
|
|
390
385
|
}),
|
|
391
386
|
iconAfter: r ? /* @__PURE__ */ U("span", {
|
|
@@ -401,9 +396,9 @@ var Ce = (e, t) => {
|
|
|
401
396
|
}) }, e))
|
|
402
397
|
})
|
|
403
398
|
});
|
|
404
|
-
},
|
|
399
|
+
}, Re = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
405
400
|
let [s, c] = V(t), [l, u] = V(n), [d, f] = V(r), p = B(o);
|
|
406
|
-
|
|
401
|
+
R(() => {
|
|
407
402
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
408
403
|
}, [
|
|
409
404
|
o,
|
|
@@ -420,7 +415,7 @@ var Ce = (e, t) => {
|
|
|
420
415
|
setResponseFormat: c,
|
|
421
416
|
setSystemPrompt: u,
|
|
422
417
|
setTemperature: f,
|
|
423
|
-
handleSubmit:
|
|
418
|
+
handleSubmit: L(() => {
|
|
424
419
|
if (!m) return;
|
|
425
420
|
let t = {};
|
|
426
421
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -434,12 +429,12 @@ var Ce = (e, t) => {
|
|
|
434
429
|
a
|
|
435
430
|
])
|
|
436
431
|
};
|
|
437
|
-
},
|
|
432
|
+
}, ze = { label: "_label_14i7c_1" }, Be = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: s, onSystemPromptChange: c, onTemperatureChange: l, responseFormatLabel: u = "Response format", responseFormatHint: d = "Applies to new and existing messages", responseFormatMarkdownLabel: f = "Markdown", responseFormatPlainTextLabel: m = "Plain text", systemPromptLabel: g = "System prompt", systemPromptTooltip: _ = "Enter a prompt", temperatureLabel: v = "Temperature", temperatureLabels: y = [
|
|
438
433
|
"Precise",
|
|
439
434
|
"Neutral",
|
|
440
435
|
"Creative"
|
|
441
436
|
], temperatureHint: b, labelClassName: x = "!dial-small-semi-text", colors: C }) => {
|
|
442
|
-
let w = a({ "--csf-label-text": C?.labelText }), T = o(x,
|
|
437
|
+
let w = a({ "--csf-label-text": C?.labelText }), T = o(x, ze.label, "gap-1");
|
|
443
438
|
return /* @__PURE__ */ W("div", {
|
|
444
439
|
className: "flex flex-col gap-4 px-6 py-3",
|
|
445
440
|
style: w,
|
|
@@ -484,8 +479,8 @@ var Ce = (e, t) => {
|
|
|
484
479
|
})
|
|
485
480
|
]
|
|
486
481
|
});
|
|
487
|
-
},
|
|
488
|
-
let { responseFormat: T, systemPrompt: D, temperature: O, canSubmit: k, setResponseFormat: A, setSystemPrompt: j, setTemperature:
|
|
482
|
+
}, Ve = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: s, initialResponseFormat: c, initialSystemPrompt: l, initialTemperature: u, onSave: d, title: f = "Chat settings", responseFormatLabel: p, responseFormatHint: m, responseFormatMarkdownLabel: h, responseFormatPlainTextLabel: _, systemPromptLabel: v, systemPromptTooltip: y, temperatureLabel: b, temperatureLabels: x, temperatureHint: S, saveLabel: C = "Apply changes", saveDisabledTooltip: w }) => {
|
|
483
|
+
let { responseFormat: T, systemPrompt: D, temperature: O, canSubmit: k, setResponseFormat: A, setSystemPrompt: j, setTemperature: M, handleSubmit: N } = Re({
|
|
489
484
|
isOpen: e,
|
|
490
485
|
features: s,
|
|
491
486
|
initialResponseFormat: c,
|
|
@@ -494,7 +489,7 @@ var Ce = (e, t) => {
|
|
|
494
489
|
onSave: d,
|
|
495
490
|
onClose: r
|
|
496
491
|
});
|
|
497
|
-
return /* @__PURE__ */ W(
|
|
492
|
+
return /* @__PURE__ */ W(K, {
|
|
498
493
|
isOpen: e,
|
|
499
494
|
title: f,
|
|
500
495
|
closeLabel: i,
|
|
@@ -502,14 +497,14 @@ var Ce = (e, t) => {
|
|
|
502
497
|
onBack: t,
|
|
503
498
|
backLabel: n,
|
|
504
499
|
style: a,
|
|
505
|
-
children: [/* @__PURE__ */ U(
|
|
500
|
+
children: [/* @__PURE__ */ U(Be, {
|
|
506
501
|
features: s,
|
|
507
502
|
responseFormat: T,
|
|
508
503
|
systemPrompt: D,
|
|
509
504
|
temperature: O,
|
|
510
505
|
onResponseFormatChange: A,
|
|
511
506
|
onSystemPromptChange: j,
|
|
512
|
-
onTemperatureChange:
|
|
507
|
+
onTemperatureChange: M,
|
|
513
508
|
responseFormatLabel: p,
|
|
514
509
|
responseFormatHint: m,
|
|
515
510
|
responseFormatMarkdownLabel: h,
|
|
@@ -527,15 +522,15 @@ var Ce = (e, t) => {
|
|
|
527
522
|
triggerClassName: "w-full",
|
|
528
523
|
children: /* @__PURE__ */ U(E, {
|
|
529
524
|
label: C,
|
|
530
|
-
onClick:
|
|
525
|
+
onClick: N,
|
|
531
526
|
disabled: !k,
|
|
532
527
|
className: "w-full"
|
|
533
528
|
})
|
|
534
529
|
})
|
|
535
530
|
})]
|
|
536
531
|
});
|
|
537
|
-
},
|
|
538
|
-
let { responseFormat: b, systemPrompt: x, temperature: S, canSubmit: C, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit: A } =
|
|
532
|
+
}, He = { modal: "_modal_od073_1" }, Ue = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", responseFormatLabel: s, responseFormatHint: c, responseFormatMarkdownLabel: l, responseFormatPlainTextLabel: u, systemPromptLabel: d, systemPromptTooltip: f, temperatureLabel: p, temperatureLabels: m, temperatureHint: h, saveLabel: _ = "Apply changes", saveDisabledTooltip: v, backgroundClassName: y = He.modal }) => {
|
|
533
|
+
let { responseFormat: b, systemPrompt: x, temperature: S, canSubmit: C, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit: A } = Re({
|
|
539
534
|
features: e,
|
|
540
535
|
initialResponseFormat: t,
|
|
541
536
|
initialSystemPrompt: n,
|
|
@@ -561,7 +556,7 @@ var Ce = (e, t) => {
|
|
|
561
556
|
})
|
|
562
557
|
})
|
|
563
558
|
}),
|
|
564
|
-
children: /* @__PURE__ */ U(
|
|
559
|
+
children: /* @__PURE__ */ U(Be, {
|
|
565
560
|
features: e,
|
|
566
561
|
responseFormat: b,
|
|
567
562
|
systemPrompt: x,
|
|
@@ -581,11 +576,11 @@ var Ce = (e, t) => {
|
|
|
581
576
|
})
|
|
582
577
|
});
|
|
583
578
|
};
|
|
584
|
-
|
|
585
|
-
var
|
|
579
|
+
I(Ue);
|
|
580
|
+
var We = {
|
|
586
581
|
icon: "_icon_1fv6z_1",
|
|
587
582
|
selectedIcon: "_selectedIcon_1fv6z_5"
|
|
588
|
-
},
|
|
583
|
+
}, Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: s, title: u = "Tools", items: d, onToolToggle: f, colors: p }) => /* @__PURE__ */ U(K, {
|
|
589
584
|
isOpen: e,
|
|
590
585
|
title: u,
|
|
591
586
|
closeLabel: i,
|
|
@@ -608,12 +603,12 @@ var Ge = {
|
|
|
608
603
|
"aria-checked": e.isSelected,
|
|
609
604
|
className: "w-full gap-3 px-4 py-[10px] text-start",
|
|
610
605
|
iconBefore: /* @__PURE__ */ U("span", {
|
|
611
|
-
className: o("flex items-center",
|
|
606
|
+
className: o("flex items-center", We.icon),
|
|
612
607
|
children: e.icon
|
|
613
608
|
}),
|
|
614
609
|
iconAfter: e.isSelected ? /* @__PURE__ */ U("span", {
|
|
615
|
-
className: o("ms-auto",
|
|
616
|
-
children: /* @__PURE__ */ U(
|
|
610
|
+
className: o("ms-auto", We.selectedIcon),
|
|
611
|
+
children: /* @__PURE__ */ U(ee, {
|
|
617
612
|
size: c,
|
|
618
613
|
"aria-hidden": !0
|
|
619
614
|
})
|
|
@@ -626,7 +621,7 @@ var Ge = {
|
|
|
626
621
|
})
|
|
627
622
|
}, e.id))
|
|
628
623
|
})
|
|
629
|
-
}),
|
|
624
|
+
}), Ke = {
|
|
630
625
|
selectedToolIcon: "_selectedToolIcon_r268y_1",
|
|
631
626
|
toolIcon: "_toolIcon_r268y_5",
|
|
632
627
|
chevronIcon: "_chevronIcon_r268y_9"
|
|
@@ -639,23 +634,23 @@ var Ge = {
|
|
|
639
634
|
C?.selectedToolIcon,
|
|
640
635
|
C?.toolIcon,
|
|
641
636
|
C?.chevronIcon
|
|
642
|
-
]),
|
|
637
|
+
]), M = g.length > 0 && y != null, N = z(() => g.map((e) => ({
|
|
643
638
|
key: e.id,
|
|
644
639
|
label: /* @__PURE__ */ W("span", {
|
|
645
640
|
className: "flex flex-1 items-center gap-2",
|
|
646
641
|
children: [/* @__PURE__ */ U("span", {
|
|
647
642
|
className: "flex-1",
|
|
648
643
|
children: e.label
|
|
649
|
-
}), e.isSelected && /* @__PURE__ */ U(
|
|
644
|
+
}), e.isSelected && /* @__PURE__ */ U(ee, {
|
|
650
645
|
size: c,
|
|
651
646
|
style: j,
|
|
652
|
-
className:
|
|
647
|
+
className: Ke.selectedToolIcon,
|
|
653
648
|
"aria-hidden": !0
|
|
654
649
|
})]
|
|
655
650
|
}),
|
|
656
651
|
icon: /* @__PURE__ */ U("span", {
|
|
657
652
|
style: j,
|
|
658
|
-
className: o("flex items-center",
|
|
653
|
+
className: o("flex items-center", Ke.toolIcon),
|
|
659
654
|
children: e.icon
|
|
660
655
|
}),
|
|
661
656
|
onClick: () => y?.(e.id)
|
|
@@ -667,14 +662,14 @@ var Ge = {
|
|
|
667
662
|
...e == null ? [] : [{
|
|
668
663
|
key: "attach",
|
|
669
664
|
label: t,
|
|
670
|
-
icon: /* @__PURE__ */ U(
|
|
665
|
+
icon: /* @__PURE__ */ U(F, {
|
|
671
666
|
size: c,
|
|
672
667
|
"aria-hidden": !0
|
|
673
668
|
}),
|
|
674
669
|
onClick: e
|
|
675
670
|
}],
|
|
676
671
|
...h ?? [],
|
|
677
|
-
...
|
|
672
|
+
...M ? [{
|
|
678
673
|
key: "tools",
|
|
679
674
|
label: x,
|
|
680
675
|
icon: /* @__PURE__ */ U(ce, {
|
|
@@ -684,13 +679,13 @@ var Ge = {
|
|
|
684
679
|
onClick: w ? () => {
|
|
685
680
|
A(!0), E(!1);
|
|
686
681
|
} : () => void 0,
|
|
687
|
-
...w ? { iconAfter: /* @__PURE__ */ U(
|
|
682
|
+
...w ? { iconAfter: /* @__PURE__ */ U(te, {
|
|
688
683
|
size: c,
|
|
689
684
|
stroke: 1.5,
|
|
690
685
|
style: j,
|
|
691
|
-
className: o("rtl:scale-x-[-1]",
|
|
686
|
+
className: o("rtl:scale-x-[-1]", Ke.chevronIcon),
|
|
692
687
|
"aria-hidden": !0
|
|
693
|
-
}) } : { children:
|
|
688
|
+
}) } : { children: N }
|
|
694
689
|
}] : [],
|
|
695
690
|
...m == null ? [] : [{
|
|
696
691
|
key: "chat-settings",
|
|
@@ -699,11 +694,11 @@ var Ge = {
|
|
|
699
694
|
size: c,
|
|
700
695
|
"aria-hidden": !0
|
|
701
696
|
}),
|
|
702
|
-
iconAfter: w ? /* @__PURE__ */ U(
|
|
697
|
+
iconAfter: w ? /* @__PURE__ */ U(te, {
|
|
703
698
|
size: c,
|
|
704
699
|
stroke: 1.5,
|
|
705
700
|
style: j,
|
|
706
|
-
className: o("rtl:scale-x-[-1]",
|
|
701
|
+
className: o("rtl:scale-x-[-1]", Ke.chevronIcon),
|
|
707
702
|
"aria-hidden": !0
|
|
708
703
|
}) : null,
|
|
709
704
|
onClick: () => O(!0)
|
|
@@ -714,9 +709,9 @@ var Ge = {
|
|
|
714
709
|
m,
|
|
715
710
|
h,
|
|
716
711
|
w,
|
|
717
|
-
ee,
|
|
718
|
-
x,
|
|
719
712
|
M,
|
|
713
|
+
x,
|
|
714
|
+
N,
|
|
720
715
|
j
|
|
721
716
|
]);
|
|
722
717
|
return P.length === 0 ? null : /* @__PURE__ */ U(H, { children: w ? /* @__PURE__ */ W(H, { children: [
|
|
@@ -731,7 +726,7 @@ var Ge = {
|
|
|
731
726
|
disabled: p,
|
|
732
727
|
onClick: () => E(!0)
|
|
733
728
|
}),
|
|
734
|
-
/* @__PURE__ */ U(
|
|
729
|
+
/* @__PURE__ */ U(Le, {
|
|
735
730
|
isOpen: T,
|
|
736
731
|
title: r,
|
|
737
732
|
closeLabel: l,
|
|
@@ -741,7 +736,7 @@ var Ge = {
|
|
|
741
736
|
className: "pb-4",
|
|
742
737
|
btnTextClassName: "flex-1"
|
|
743
738
|
}),
|
|
744
|
-
|
|
739
|
+
M && /* @__PURE__ */ U(Ge, {
|
|
745
740
|
isOpen: k,
|
|
746
741
|
onBack: () => {
|
|
747
742
|
A(!1), E(!0);
|
|
@@ -754,7 +749,7 @@ var Ge = {
|
|
|
754
749
|
items: g,
|
|
755
750
|
onToolToggle: y
|
|
756
751
|
}),
|
|
757
|
-
m != null && /* @__PURE__ */ U(
|
|
752
|
+
m != null && /* @__PURE__ */ U(Ve, {
|
|
758
753
|
isOpen: D,
|
|
759
754
|
onBack: () => {
|
|
760
755
|
O(!1), E(!0);
|
|
@@ -795,7 +790,7 @@ var Ge = {
|
|
|
795
790
|
tooltipProps: { tooltip: n },
|
|
796
791
|
disabled: p
|
|
797
792
|
})
|
|
798
|
-
}), m != null && D && /* @__PURE__ */ U(
|
|
793
|
+
}), m != null && D && /* @__PURE__ */ U(Ue, {
|
|
799
794
|
features: m.features,
|
|
800
795
|
initialResponseFormat: m.responseFormat ?? i.Markdown,
|
|
801
796
|
initialSystemPrompt: m.systemPrompt,
|
|
@@ -888,34 +883,33 @@ var Ge = {
|
|
|
888
883
|
modelSelectorCaret: "_modelSelectorCaret_teqwe_24",
|
|
889
884
|
modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_teqwe_33"
|
|
890
885
|
}, Xe = {
|
|
891
|
-
wrapperError: "
|
|
892
|
-
waveformCanvas: "
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
let p = B(null), m = B(new Float32Array(Z)), h = B(0), g = B(0), _ = e === Me.Recording, v = e === Me.Error, x = I((e) => {
|
|
886
|
+
wrapperError: "_wrapperError_129ri_1",
|
|
887
|
+
waveformCanvas: "_waveformCanvas_129ri_5",
|
|
888
|
+
recordingDot: "_recordingDot_129ri_19",
|
|
889
|
+
"recording-pulse": "_recording-pulse_129ri_1"
|
|
890
|
+
}, X = 3, Ze = 4, Z = 200, Qe = ({ state: e, analyserNodeRef: t, errorMessage: n, onStop: r, onDiscard: i, stopLabel: a = "Stop recording", discardLabel: s = "Discard recording", style: c, className: l }) => {
|
|
891
|
+
let u = B(null), f = B(new Float32Array(Z)), p = B(0), m = B(0), h = e === je.Recording, g = e === je.Error, _ = L((e) => {
|
|
898
892
|
let t = e.getContext("2d");
|
|
899
893
|
if (!t) return;
|
|
900
894
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
901
895
|
let { width: n, height: r } = e;
|
|
902
896
|
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
903
|
-
let i = Math.min(Math.max(1, Math.floor(n /
|
|
897
|
+
let i = Math.min(Math.max(1, Math.floor(n / Ze)), Z - 1), a = p.current, o = m.current;
|
|
904
898
|
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
905
899
|
for (let e = 0; e <= i; e++) {
|
|
906
|
-
let n = ((a - i + e) % Z + Z) % Z, o =
|
|
907
|
-
t.fillRect(e *
|
|
900
|
+
let n = ((a - i + e) % Z + Z) % Z, o = f.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
901
|
+
t.fillRect(e * Ze, (r - c) / 2, X, c);
|
|
908
902
|
}
|
|
909
903
|
t.restore();
|
|
910
904
|
}, []);
|
|
911
|
-
|
|
912
|
-
if (!
|
|
913
|
-
let e =
|
|
905
|
+
R(() => {
|
|
906
|
+
if (!h) return;
|
|
907
|
+
let e = u.current;
|
|
914
908
|
if (!e) return;
|
|
915
|
-
|
|
909
|
+
f.current.fill(0), p.current = 0, m.current = 0;
|
|
916
910
|
let n, r = () => {
|
|
917
|
-
if (
|
|
918
|
-
|
|
911
|
+
if (m.current += 1, m.current >= Ze) {
|
|
912
|
+
m.current -= Ze;
|
|
919
913
|
let e = t.current;
|
|
920
914
|
if (e) {
|
|
921
915
|
let t = new Uint8Array(e.frequencyBinCount);
|
|
@@ -925,88 +919,84 @@ var Ge = {
|
|
|
925
919
|
let r = (t[e] - 128) / 128;
|
|
926
920
|
n += r * r;
|
|
927
921
|
}
|
|
928
|
-
|
|
922
|
+
f.current[p.current % Z] = Math.sqrt(n / t.length), p.current++;
|
|
929
923
|
}
|
|
930
924
|
}
|
|
931
|
-
|
|
925
|
+
_(e), n = requestAnimationFrame(r);
|
|
932
926
|
};
|
|
933
927
|
return n = requestAnimationFrame(r), () => {
|
|
934
928
|
cancelAnimationFrame(n);
|
|
935
929
|
};
|
|
936
930
|
}, [
|
|
937
|
-
|
|
931
|
+
h,
|
|
938
932
|
t,
|
|
939
|
-
|
|
940
|
-
]),
|
|
941
|
-
let e =
|
|
933
|
+
_
|
|
934
|
+
]), R(() => {
|
|
935
|
+
let e = u.current;
|
|
942
936
|
if (!e) return;
|
|
943
937
|
let t = new ResizeObserver(() => {
|
|
944
|
-
|
|
938
|
+
_(e);
|
|
945
939
|
});
|
|
946
940
|
return t.observe(e), () => t.disconnect();
|
|
947
|
-
}, [
|
|
948
|
-
let
|
|
941
|
+
}, [_]);
|
|
942
|
+
let v = /* @__PURE__ */ W("div", {
|
|
949
943
|
className: "flex flex-shrink-0 items-center justify-end gap-1",
|
|
950
944
|
children: [/* @__PURE__ */ U(b, {
|
|
951
945
|
icon: /* @__PURE__ */ U(le, {
|
|
952
946
|
size: d.LG,
|
|
953
947
|
"aria-hidden": !0
|
|
954
948
|
}),
|
|
955
|
-
"aria-label":
|
|
956
|
-
onClick:
|
|
957
|
-
}),
|
|
949
|
+
"aria-label": s,
|
|
950
|
+
onClick: i
|
|
951
|
+
}), h && /* @__PURE__ */ U(D, {
|
|
958
952
|
icon: /* @__PURE__ */ U(ie, {
|
|
959
953
|
size: d.LG,
|
|
960
954
|
"aria-hidden": !0
|
|
961
955
|
}),
|
|
962
|
-
onClick: () =>
|
|
963
|
-
"aria-label":
|
|
956
|
+
onClick: () => r?.(),
|
|
957
|
+
"aria-label": a
|
|
964
958
|
})]
|
|
965
959
|
});
|
|
966
960
|
return /* @__PURE__ */ W("div", {
|
|
967
|
-
className:
|
|
961
|
+
className: l,
|
|
968
962
|
children: [/* @__PURE__ */ W("div", {
|
|
969
|
-
style:
|
|
970
|
-
className: o(Y.wrapper, "flex min-h-[64px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border px-3 shadow-md desktop:flex-row desktop:items-center desktop:gap-2 desktop:py-2",
|
|
963
|
+
style: c,
|
|
964
|
+
className: o(Y.wrapper, "flex min-h-[64px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border px-3 shadow-md desktop:flex-row desktop:items-center desktop:gap-2 desktop:py-2", g && Xe.wrapperError),
|
|
971
965
|
children: [/* @__PURE__ */ W("div", {
|
|
972
966
|
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
973
|
-
children: [
|
|
967
|
+
children: [h && /* @__PURE__ */ U("span", {
|
|
974
968
|
className: o(Xe.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
|
|
975
969
|
"aria-hidden": !0
|
|
976
|
-
}), /* @__PURE__ */ U("
|
|
977
|
-
|
|
978
|
-
"aria-label": l,
|
|
979
|
-
children: Qe(n)
|
|
980
|
-
})] }), /* @__PURE__ */ U("canvas", {
|
|
981
|
-
ref: p,
|
|
970
|
+
}), /* @__PURE__ */ U("canvas", {
|
|
971
|
+
ref: u,
|
|
982
972
|
height: 32,
|
|
983
973
|
className: o(Xe.waveformCanvas, "h-8 min-w-0 flex-1 desktop:h-6")
|
|
984
974
|
})]
|
|
985
|
-
}),
|
|
986
|
-
}),
|
|
987
|
-
text:
|
|
975
|
+
}), v]
|
|
976
|
+
}), g && n && /* @__PURE__ */ U(y, {
|
|
977
|
+
text: n,
|
|
988
978
|
className: "mt-1 px-1"
|
|
989
979
|
})]
|
|
990
980
|
});
|
|
991
|
-
},
|
|
981
|
+
}, $e = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", isExiting: r = !1 }) => /* @__PURE__ */ U(D, {
|
|
992
982
|
"aria-label": n,
|
|
993
983
|
onClick: () => e?.(),
|
|
994
984
|
disabled: t,
|
|
995
985
|
"aria-hidden": r,
|
|
996
|
-
icon: /* @__PURE__ */ U(
|
|
986
|
+
icon: /* @__PURE__ */ U(N, {
|
|
997
987
|
size: d.LG,
|
|
998
988
|
className: "rtl:scale-x-[-1]"
|
|
999
989
|
})
|
|
1000
|
-
}),
|
|
990
|
+
}), et = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ U(j, {
|
|
1001
991
|
icon: /* @__PURE__ */ U(ae, { size: d.LG }),
|
|
1002
992
|
onClick: () => e?.(),
|
|
1003
993
|
"aria-label": t
|
|
1004
|
-
}),
|
|
994
|
+
}), tt = ({ size: e = 20 }) => /* @__PURE__ */ U(k, {
|
|
1005
995
|
variant: A.Circular,
|
|
1006
996
|
width: e,
|
|
1007
997
|
height: e,
|
|
1008
998
|
active: !0
|
|
1009
|
-
}),
|
|
999
|
+
}), nt = ({ loadingLabel: e }) => /* @__PURE__ */ W("span", {
|
|
1010
1000
|
className: "flex min-w-0 flex-1 items-center",
|
|
1011
1001
|
children: [/* @__PURE__ */ U(k, {
|
|
1012
1002
|
variant: A.Text,
|
|
@@ -1017,28 +1007,28 @@ var Ge = {
|
|
|
1017
1007
|
className: "sr-only",
|
|
1018
1008
|
children: e
|
|
1019
1009
|
})]
|
|
1020
|
-
}),
|
|
1010
|
+
}), rt = ({ loadingLabel: e }) => /* @__PURE__ */ U("div", {
|
|
1021
1011
|
role: "status",
|
|
1022
1012
|
"aria-label": e,
|
|
1023
1013
|
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ W("div", {
|
|
1024
1014
|
className: "flex h-11 items-center gap-3 px-4",
|
|
1025
1015
|
"aria-hidden": "true",
|
|
1026
|
-
children: [/* @__PURE__ */ U(
|
|
1016
|
+
children: [/* @__PURE__ */ U(tt, {}), /* @__PURE__ */ U(nt, {})]
|
|
1027
1017
|
}, t))
|
|
1028
|
-
}),
|
|
1018
|
+
}), it = (e) => e.displayName ?? e.id, at = (e, t) => {
|
|
1029
1019
|
let n = t.trim().toLowerCase();
|
|
1030
|
-
return n ? e.filter((e) =>
|
|
1031
|
-
},
|
|
1020
|
+
return n ? e.filter((e) => it(e).toLowerCase().includes(n)) : e;
|
|
1021
|
+
}, ot = (e, t, r, i = 18, a) => /* @__PURE__ */ U(n, {
|
|
1032
1022
|
src: e,
|
|
1033
1023
|
size: i,
|
|
1034
1024
|
labels: { tooltip: a },
|
|
1035
1025
|
initialsName: r
|
|
1036
|
-
}),
|
|
1026
|
+
}), st = {
|
|
1037
1027
|
searchHeader: "_searchHeader_ibyso_1",
|
|
1038
1028
|
selectedItem: "_selectedItem_ibyso_5",
|
|
1039
1029
|
selectedItemCheck: "_selectedItemCheck_ibyso_9"
|
|
1040
|
-
},
|
|
1041
|
-
let [u, f] = V(""), p = z(() => e?.find((e) => e.id === t), [e, t]), h = r?.loading !== void 0, g = z(() => h ? /* @__PURE__ */ U(
|
|
1030
|
+
}, ct = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, searchHeaderClassName: i = st.searchHeader, selectedItemClassName: s = st.selectedItem, selectedItemCheckClassName: c = st.selectedItemCheck, colors: l }) => {
|
|
1031
|
+
let [u, f] = V(""), p = z(() => e?.find((e) => e.id === t), [e, t]), h = r?.loading !== void 0, g = z(() => h ? /* @__PURE__ */ U(tt, { size: d.LG }) : ot(p?.iconUrl, p?.type, p?.displayName ?? p?.id ?? "", d.LG), [h, p]), _ = p?.displayName ?? p?.id;
|
|
1042
1032
|
return {
|
|
1043
1033
|
selectorIcon: g,
|
|
1044
1034
|
selectorAriaLabel: _ ? `${r?.ariaLabel ?? "Select model"}: ${_}` : r?.ariaLabel ?? "Select model",
|
|
@@ -1046,8 +1036,8 @@ var Ge = {
|
|
|
1046
1036
|
menuItems: z(() => {
|
|
1047
1037
|
if (h) return Array.from({ length: 7 }, (e, t) => ({
|
|
1048
1038
|
key: `__loading-${t}`,
|
|
1049
|
-
icon: /* @__PURE__ */ U(
|
|
1050
|
-
label: /* @__PURE__ */ U(
|
|
1039
|
+
icon: /* @__PURE__ */ U(tt, {}),
|
|
1040
|
+
label: /* @__PURE__ */ U(nt, { loadingLabel: t === 0 ? r?.loading : void 0 }),
|
|
1051
1041
|
disabled: !0
|
|
1052
1042
|
}));
|
|
1053
1043
|
if (!e || e.length === 0) {
|
|
@@ -1058,7 +1048,7 @@ var Ge = {
|
|
|
1058
1048
|
disabled: !0
|
|
1059
1049
|
}] : [];
|
|
1060
1050
|
}
|
|
1061
|
-
return
|
|
1051
|
+
return at(e, u).map((e) => {
|
|
1062
1052
|
let r = e.id === t;
|
|
1063
1053
|
return {
|
|
1064
1054
|
key: e.id,
|
|
@@ -1066,17 +1056,17 @@ var Ge = {
|
|
|
1066
1056
|
className: "flex w-full items-center justify-between gap-2",
|
|
1067
1057
|
style: a({ "--ms-selected-item-check": l?.selectedItemCheck }),
|
|
1068
1058
|
children: [/* @__PURE__ */ U(x, {
|
|
1069
|
-
text:
|
|
1059
|
+
text: it(e),
|
|
1070
1060
|
query: u,
|
|
1071
1061
|
maxLines: 1
|
|
1072
|
-
}), r && /* @__PURE__ */ U(
|
|
1062
|
+
}), r && /* @__PURE__ */ U(ee, {
|
|
1073
1063
|
size: d.SM,
|
|
1074
1064
|
stroke: 2,
|
|
1075
1065
|
className: c,
|
|
1076
1066
|
"aria-hidden": !0
|
|
1077
1067
|
})]
|
|
1078
1068
|
}),
|
|
1079
|
-
icon:
|
|
1069
|
+
icon: ot(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
1080
1070
|
onClick: () => n?.(e.id),
|
|
1081
1071
|
className: r ? s : void 0
|
|
1082
1072
|
};
|
|
@@ -1114,8 +1104,8 @@ var Ge = {
|
|
|
1114
1104
|
e || f("");
|
|
1115
1105
|
}
|
|
1116
1106
|
};
|
|
1117
|
-
},
|
|
1118
|
-
function
|
|
1107
|
+
}, lt = typeof window < "u" ? pe : R;
|
|
1108
|
+
function ut(e) {
|
|
1119
1109
|
if (e !== void 0) switch (typeof e) {
|
|
1120
1110
|
case "number": return e;
|
|
1121
1111
|
case "string":
|
|
@@ -1123,15 +1113,15 @@ function dt(e) {
|
|
|
1123
1113
|
break;
|
|
1124
1114
|
}
|
|
1125
1115
|
}
|
|
1126
|
-
function
|
|
1116
|
+
function dt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
1127
1117
|
let { styleHeight: s, styleWidth: c } = z(() => ({
|
|
1128
|
-
styleHeight:
|
|
1129
|
-
styleWidth:
|
|
1118
|
+
styleHeight: ut(o?.height),
|
|
1119
|
+
styleWidth: ut(o?.width)
|
|
1130
1120
|
}), [o?.height, o?.width]), [l, u] = V({
|
|
1131
1121
|
height: t,
|
|
1132
1122
|
width: n
|
|
1133
1123
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
1134
|
-
return
|
|
1124
|
+
return lt(() => {
|
|
1135
1125
|
if (i === null || d) return;
|
|
1136
1126
|
let t = new ResizeObserver((e) => {
|
|
1137
1127
|
for (let t of e) {
|
|
@@ -1160,26 +1150,26 @@ function ft({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1160
1150
|
c
|
|
1161
1151
|
]);
|
|
1162
1152
|
}
|
|
1163
|
-
function
|
|
1153
|
+
function ft(e) {
|
|
1164
1154
|
let t = B(() => {
|
|
1165
1155
|
throw Error("Cannot call during render.");
|
|
1166
1156
|
});
|
|
1167
|
-
return
|
|
1157
|
+
return lt(() => {
|
|
1168
1158
|
t.current = e;
|
|
1169
|
-
}, [e]),
|
|
1159
|
+
}, [e]), L((e) => t.current?.(e), [t]);
|
|
1170
1160
|
}
|
|
1171
|
-
var
|
|
1172
|
-
function
|
|
1173
|
-
if (
|
|
1161
|
+
var pt = null;
|
|
1162
|
+
function mt(e = !1) {
|
|
1163
|
+
if (pt === null || e) {
|
|
1174
1164
|
let e = document.createElement("div"), t = e.style;
|
|
1175
1165
|
t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
|
|
1176
1166
|
let n = document.createElement("div"), r = n.style;
|
|
1177
|
-
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ?
|
|
1167
|
+
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? pt = "positive-descending" : (e.scrollLeft = 1, pt = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), pt;
|
|
1178
1168
|
}
|
|
1179
|
-
return
|
|
1169
|
+
return pt;
|
|
1180
1170
|
}
|
|
1181
|
-
function
|
|
1182
|
-
if (t === "horizontal" && n) switch (
|
|
1171
|
+
function ht({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1172
|
+
if (t === "horizontal" && n) switch (mt()) {
|
|
1183
1173
|
case "negative": return -r;
|
|
1184
1174
|
case "positive-descending":
|
|
1185
1175
|
if (e) {
|
|
@@ -1193,13 +1183,13 @@ function gt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
|
1193
1183
|
function Q(e, t = "Assertion error") {
|
|
1194
1184
|
if (!e) throw console.error(t), Error(t);
|
|
1195
1185
|
}
|
|
1196
|
-
function
|
|
1186
|
+
function gt(e, t) {
|
|
1197
1187
|
if (e === t) return !0;
|
|
1198
1188
|
if (!!e != !!t || (Q(e !== void 0), Q(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1199
1189
|
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
1200
1190
|
return !0;
|
|
1201
1191
|
}
|
|
1202
|
-
function
|
|
1192
|
+
function _t({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
1203
1193
|
if (t === 0) return 0;
|
|
1204
1194
|
if (typeof n == "number") return t * n;
|
|
1205
1195
|
{
|
|
@@ -1207,9 +1197,9 @@ function vt({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
|
1207
1197
|
return Q(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
|
|
1208
1198
|
}
|
|
1209
1199
|
}
|
|
1210
|
-
function
|
|
1200
|
+
function vt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
|
|
1211
1201
|
if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
|
|
1212
|
-
let s =
|
|
1202
|
+
let s = _t({
|
|
1213
1203
|
cachedBounds: t,
|
|
1214
1204
|
itemCount: r,
|
|
1215
1205
|
itemSize: i
|
|
@@ -1221,7 +1211,7 @@ function yt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, co
|
|
|
1221
1211
|
default: return a >= u && a <= l ? a : a < u ? u : l;
|
|
1222
1212
|
}
|
|
1223
1213
|
}
|
|
1224
|
-
function
|
|
1214
|
+
function yt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
|
|
1225
1215
|
let a = r - 1, o = 0, s = -1, c = 0, l = -1, u = 0;
|
|
1226
1216
|
for (; u < a;) {
|
|
1227
1217
|
let n = e.get(u);
|
|
@@ -1240,7 +1230,7 @@ function bt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemC
|
|
|
1240
1230
|
stopIndexOverscan: l
|
|
1241
1231
|
};
|
|
1242
1232
|
}
|
|
1243
|
-
function
|
|
1233
|
+
function bt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1244
1234
|
let r = /* @__PURE__ */ new Map();
|
|
1245
1235
|
return {
|
|
1246
1236
|
get(i) {
|
|
@@ -1277,8 +1267,8 @@ function xt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1277
1267
|
}
|
|
1278
1268
|
};
|
|
1279
1269
|
}
|
|
1280
|
-
function
|
|
1281
|
-
return z(() =>
|
|
1270
|
+
function $({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1271
|
+
return z(() => bt({
|
|
1282
1272
|
itemCount: e,
|
|
1283
1273
|
itemProps: t,
|
|
1284
1274
|
itemSize: n
|
|
@@ -1288,7 +1278,7 @@ function St({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1288
1278
|
n
|
|
1289
1279
|
]);
|
|
1290
1280
|
}
|
|
1291
|
-
function
|
|
1281
|
+
function xt({ containerSize: e, itemSize: t }) {
|
|
1292
1282
|
let n;
|
|
1293
1283
|
switch (typeof t) {
|
|
1294
1284
|
case "string":
|
|
@@ -1300,8 +1290,8 @@ function $({ containerSize: e, itemSize: t }) {
|
|
|
1300
1290
|
}
|
|
1301
1291
|
return n;
|
|
1302
1292
|
}
|
|
1303
|
-
function
|
|
1304
|
-
let { height: u = n, width: d = n } =
|
|
1293
|
+
function St({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
|
|
1294
|
+
let { height: u = n, width: d = n } = dt({
|
|
1305
1295
|
defaultHeight: r === "vertical" ? n : void 0,
|
|
1306
1296
|
defaultWidth: r === "horizontal" ? n : void 0,
|
|
1307
1297
|
element: e,
|
|
@@ -1310,11 +1300,11 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1310
1300
|
}), f = B({
|
|
1311
1301
|
height: 0,
|
|
1312
1302
|
width: 0
|
|
1313
|
-
}), p = r === "vertical" ? u : d, m =
|
|
1303
|
+
}), p = r === "vertical" ? u : d, m = xt({
|
|
1314
1304
|
containerSize: p,
|
|
1315
1305
|
itemSize: s
|
|
1316
1306
|
});
|
|
1317
|
-
|
|
1307
|
+
pe(() => {
|
|
1318
1308
|
if (typeof c == "function") {
|
|
1319
1309
|
let e = f.current;
|
|
1320
1310
|
(e.height !== u || e.width !== d) && (c({
|
|
@@ -1327,11 +1317,11 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1327
1317
|
c,
|
|
1328
1318
|
d
|
|
1329
1319
|
]);
|
|
1330
|
-
let h =
|
|
1320
|
+
let h = $({
|
|
1331
1321
|
itemCount: a,
|
|
1332
1322
|
itemProps: o,
|
|
1333
1323
|
itemSize: m
|
|
1334
|
-
}), g =
|
|
1324
|
+
}), g = L((e) => h.get(e), [h]), [_, v] = V(() => yt({
|
|
1335
1325
|
cachedBounds: h,
|
|
1336
1326
|
containerScrollOffset: 0,
|
|
1337
1327
|
containerSize: p,
|
|
@@ -1342,7 +1332,7 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1342
1332
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1343
1333
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1344
1334
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1345
|
-
}, C =
|
|
1335
|
+
}, C = L(() => _t({
|
|
1346
1336
|
cachedBounds: h,
|
|
1347
1337
|
itemCount: a,
|
|
1348
1338
|
itemSize: m
|
|
@@ -1350,9 +1340,9 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1350
1340
|
h,
|
|
1351
1341
|
a,
|
|
1352
1342
|
m
|
|
1353
|
-
]), w =
|
|
1343
|
+
]), w = L((t) => yt({
|
|
1354
1344
|
cachedBounds: h,
|
|
1355
|
-
containerScrollOffset:
|
|
1345
|
+
containerScrollOffset: ht({
|
|
1356
1346
|
containerElement: e,
|
|
1357
1347
|
direction: r,
|
|
1358
1348
|
isRtl: i,
|
|
@@ -1370,19 +1360,19 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1370
1360
|
a,
|
|
1371
1361
|
l
|
|
1372
1362
|
]);
|
|
1373
|
-
return
|
|
1363
|
+
return lt(() => {
|
|
1374
1364
|
v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
|
|
1375
1365
|
}, [
|
|
1376
1366
|
e,
|
|
1377
1367
|
r,
|
|
1378
1368
|
w
|
|
1379
|
-
]),
|
|
1369
|
+
]), lt(() => {
|
|
1380
1370
|
if (!e) return;
|
|
1381
1371
|
let t = () => {
|
|
1382
1372
|
v((t) => {
|
|
1383
|
-
let { scrollLeft: n, scrollTop: o } = e, s =
|
|
1373
|
+
let { scrollLeft: n, scrollTop: o } = e, s = yt({
|
|
1384
1374
|
cachedBounds: h,
|
|
1385
|
-
containerScrollOffset:
|
|
1375
|
+
containerScrollOffset: ht({
|
|
1386
1376
|
containerElement: e,
|
|
1387
1377
|
direction: r,
|
|
1388
1378
|
isRtl: i,
|
|
@@ -1392,7 +1382,7 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1392
1382
|
itemCount: a,
|
|
1393
1383
|
overscanCount: l
|
|
1394
1384
|
});
|
|
1395
|
-
return
|
|
1385
|
+
return gt(s, t) ? t : s;
|
|
1396
1386
|
});
|
|
1397
1387
|
};
|
|
1398
1388
|
return e.addEventListener("scroll", t), () => {
|
|
@@ -1408,8 +1398,8 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1408
1398
|
]), {
|
|
1409
1399
|
getCellBounds: g,
|
|
1410
1400
|
getEstimatedSize: C,
|
|
1411
|
-
scrollToIndex:
|
|
1412
|
-
let s =
|
|
1401
|
+
scrollToIndex: ft(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
|
|
1402
|
+
let s = vt({
|
|
1413
1403
|
align: t,
|
|
1414
1404
|
cachedBounds: h,
|
|
1415
1405
|
containerScrollOffset: n,
|
|
@@ -1419,14 +1409,14 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1419
1409
|
itemSize: m
|
|
1420
1410
|
});
|
|
1421
1411
|
if (e) {
|
|
1422
|
-
if (s =
|
|
1412
|
+
if (s = ht({
|
|
1423
1413
|
containerElement: e,
|
|
1424
1414
|
direction: r,
|
|
1425
1415
|
isRtl: i,
|
|
1426
1416
|
scrollOffset: s
|
|
1427
1417
|
}), typeof e.scrollTo != "function") {
|
|
1428
1418
|
let e = w(s);
|
|
1429
|
-
|
|
1419
|
+
gt(_, e) || v(e);
|
|
1430
1420
|
}
|
|
1431
1421
|
return s;
|
|
1432
1422
|
}
|
|
@@ -1437,19 +1427,19 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1437
1427
|
stopIndexVisible: x
|
|
1438
1428
|
};
|
|
1439
1429
|
}
|
|
1440
|
-
function
|
|
1430
|
+
function Ct(e) {
|
|
1441
1431
|
return z(() => e, Object.values(e));
|
|
1442
1432
|
}
|
|
1443
|
-
function
|
|
1433
|
+
function wt(e, t) {
|
|
1444
1434
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1445
|
-
return
|
|
1435
|
+
return gt(n, a) && gt(r, o) && gt(i, s);
|
|
1446
1436
|
}
|
|
1447
|
-
function
|
|
1437
|
+
function Tt(e) {
|
|
1448
1438
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1449
1439
|
}
|
|
1450
|
-
var
|
|
1451
|
-
function
|
|
1452
|
-
let m =
|
|
1440
|
+
var Et = "data-react-window-index";
|
|
1441
|
+
function Dt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onResize: i, onRowsRendered: a, overscanCount: o = 3, rowComponent: s, rowCount: c, rowHeight: l, rowProps: u, tagName: d = "div", style: f, ...p }) {
|
|
1442
|
+
let m = Ct(u), h = z(() => I(s, wt), [s]), [g, _] = V(null), v = Tt(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = St({
|
|
1453
1443
|
containerElement: g,
|
|
1454
1444
|
containerStyle: f,
|
|
1455
1445
|
defaultContainerSize: n,
|
|
@@ -1460,7 +1450,7 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1460
1450
|
onResize: i,
|
|
1461
1451
|
overscanCount: o
|
|
1462
1452
|
});
|
|
1463
|
-
|
|
1453
|
+
fe(r, () => ({
|
|
1464
1454
|
get element() {
|
|
1465
1455
|
return g;
|
|
1466
1456
|
},
|
|
@@ -1475,12 +1465,12 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1475
1465
|
top: r
|
|
1476
1466
|
});
|
|
1477
1467
|
}
|
|
1478
|
-
}), [g, x]),
|
|
1468
|
+
}), [g, x]), lt(() => {
|
|
1479
1469
|
if (!g) return;
|
|
1480
1470
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1481
1471
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
1482
1472
|
let n = `${S + t}`;
|
|
1483
|
-
return e.setAttribute(
|
|
1473
|
+
return e.setAttribute(Et, n), !0;
|
|
1484
1474
|
});
|
|
1485
1475
|
if (v) return l.observeRowElements(e);
|
|
1486
1476
|
}, [
|
|
@@ -1489,7 +1479,7 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1489
1479
|
l,
|
|
1490
1480
|
S,
|
|
1491
1481
|
w
|
|
1492
|
-
]),
|
|
1482
|
+
]), R(() => {
|
|
1493
1483
|
S >= 0 && w >= 0 && a && a({
|
|
1494
1484
|
startIndex: C,
|
|
1495
1485
|
stopIndex: T
|
|
@@ -1557,22 +1547,22 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1557
1547
|
}
|
|
1558
1548
|
}, E, e, D);
|
|
1559
1549
|
}
|
|
1560
|
-
var
|
|
1550
|
+
var Ot = {
|
|
1561
1551
|
divider: "_divider_s5khb_1",
|
|
1562
1552
|
item: "_item_s5khb_5",
|
|
1563
1553
|
itemIcon: "_itemIcon_s5khb_15",
|
|
1564
1554
|
checkIcon: "_checkIcon_s5khb_19",
|
|
1565
1555
|
stateLabel: "_stateLabel_s5khb_23"
|
|
1566
|
-
},
|
|
1567
|
-
let u = r[e], f =
|
|
1556
|
+
}, kt = 44, At = 8, jt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: s, onSelect: c }) => {
|
|
1557
|
+
let u = r[e], f = ot(u.iconUrl, u.type, u.displayName ?? u.id, d.SM), p = u.id === i;
|
|
1568
1558
|
return /* @__PURE__ */ U("div", {
|
|
1569
1559
|
style: t,
|
|
1570
1560
|
...n,
|
|
1571
1561
|
children: /* @__PURE__ */ U(l, {
|
|
1572
1562
|
type: "button",
|
|
1573
|
-
className: o(
|
|
1563
|
+
className: o(Ot.item, "h-full w-full gap-3 px-4"),
|
|
1574
1564
|
iconBefore: /* @__PURE__ */ U("span", {
|
|
1575
|
-
className:
|
|
1565
|
+
className: Ot.itemIcon,
|
|
1576
1566
|
children: f
|
|
1577
1567
|
}),
|
|
1578
1568
|
label: /* @__PURE__ */ W("span", {
|
|
@@ -1582,21 +1572,21 @@ var kt = {
|
|
|
1582
1572
|
query: s,
|
|
1583
1573
|
maxLines: 1,
|
|
1584
1574
|
className: o(a, "min-w-0 flex-1 text-start")
|
|
1585
|
-
}), p && /* @__PURE__ */ U(
|
|
1575
|
+
}), p && /* @__PURE__ */ U(ee, {
|
|
1586
1576
|
size: d.SM,
|
|
1587
|
-
className:
|
|
1577
|
+
className: Ot.checkIcon,
|
|
1588
1578
|
"aria-hidden": !0
|
|
1589
1579
|
})]
|
|
1590
1580
|
}),
|
|
1591
1581
|
onClick: () => c(u.id)
|
|
1592
1582
|
})
|
|
1593
1583
|
});
|
|
1594
|
-
},
|
|
1584
|
+
}, Mt = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: s, selectedDeploymentId: c, onSelect: l, loadingLabel: u, errorLabel: d, emptyLabel: f, style: p, titleClassName: h = "dial-body-semi-text", labelClassName: g = "dial-small-text", colors: _ }) => {
|
|
1595
1585
|
let [y, b] = V("");
|
|
1596
|
-
|
|
1586
|
+
R(() => {
|
|
1597
1587
|
e || b("");
|
|
1598
1588
|
}, [e]);
|
|
1599
|
-
let x = s && s.length > 0, S = u !== void 0, C = !x && !S ? d ?? f : void 0, w = x ?
|
|
1589
|
+
let x = s && s.length > 0, S = u !== void 0, C = !x && !S ? d ?? f : void 0, w = x ? at(s, y) : [], T = (e) => {
|
|
1600
1590
|
l(e), i();
|
|
1601
1591
|
}, E = a({
|
|
1602
1592
|
"--ci-sheet-divider": _?.divider,
|
|
@@ -1606,7 +1596,7 @@ var kt = {
|
|
|
1606
1596
|
"--ci-sheet-icon": _?.itemIcon,
|
|
1607
1597
|
"--ci-check-icon": _?.checkIcon
|
|
1608
1598
|
});
|
|
1609
|
-
return /* @__PURE__ */ U(
|
|
1599
|
+
return /* @__PURE__ */ U(K, {
|
|
1610
1600
|
isOpen: e,
|
|
1611
1601
|
title: t,
|
|
1612
1602
|
closeLabel: n,
|
|
@@ -1626,17 +1616,17 @@ var kt = {
|
|
|
1626
1616
|
size: v.Standard,
|
|
1627
1617
|
onChange: b
|
|
1628
1618
|
})
|
|
1629
|
-
}), /* @__PURE__ */ U("div", { className: o(
|
|
1619
|
+
}), /* @__PURE__ */ U("div", { className: o(Ot.divider, "h-px flex-shrink-0") })] }), S ? /* @__PURE__ */ U(rt, { loadingLabel: u }) : C ? /* @__PURE__ */ U("div", {
|
|
1630
1620
|
role: "list",
|
|
1631
|
-
className: o(
|
|
1621
|
+
className: o(Ot.stateLabel, g, "px-4 py-4"),
|
|
1632
1622
|
children: C
|
|
1633
|
-
}) : /* @__PURE__ */ U(
|
|
1623
|
+
}) : /* @__PURE__ */ U(Dt, {
|
|
1634
1624
|
role: "list",
|
|
1635
1625
|
className: "overflow-y-auto",
|
|
1636
|
-
style: { height: Math.min(w.length,
|
|
1637
|
-
rowComponent:
|
|
1626
|
+
style: { height: Math.min(w.length, At) * kt },
|
|
1627
|
+
rowComponent: jt,
|
|
1638
1628
|
rowCount: w.length,
|
|
1639
|
-
rowHeight:
|
|
1629
|
+
rowHeight: kt,
|
|
1640
1630
|
rowProps: {
|
|
1641
1631
|
items: w,
|
|
1642
1632
|
selectedDeploymentId: c,
|
|
@@ -1647,8 +1637,8 @@ var kt = {
|
|
|
1647
1637
|
})]
|
|
1648
1638
|
})
|
|
1649
1639
|
});
|
|
1650
|
-
},
|
|
1651
|
-
let [h, y] = V(!1), { selectorIcon: x, selectorAriaLabel: S, selectedLabel: C, menuItems: w, menuHeader: T, onOpenChange: E } =
|
|
1640
|
+
}, Nt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, isStreaming: i, isMobile: a, isDisabled: s = !1, style: c, modelPickerOverlay: l, isPickerOpen: u, onPickerToggle: p, onPickerOpenChange: m }) => {
|
|
1641
|
+
let [h, y] = V(!1), { selectorIcon: x, selectorAriaLabel: S, selectedLabel: C, menuItems: w, menuHeader: T, onOpenChange: E } = ct({
|
|
1652
1642
|
deployments: e,
|
|
1653
1643
|
selectedDeploymentId: t,
|
|
1654
1644
|
onDeploymentChange: n,
|
|
@@ -1673,14 +1663,14 @@ var kt = {
|
|
|
1673
1663
|
},
|
|
1674
1664
|
className: o("w-[50px]", Y.modelSelectorButton, D)
|
|
1675
1665
|
})
|
|
1676
|
-
}), l ? /* @__PURE__ */ U(
|
|
1666
|
+
}), l ? /* @__PURE__ */ U(K, {
|
|
1677
1667
|
isOpen: h,
|
|
1678
1668
|
title: r?.ariaLabel ?? "Select model",
|
|
1679
1669
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1680
1670
|
onClose: () => y(!1),
|
|
1681
1671
|
style: c,
|
|
1682
1672
|
children: l(() => y(!1))
|
|
1683
|
-
}) : /* @__PURE__ */ U(
|
|
1673
|
+
}) : /* @__PURE__ */ U(Mt, {
|
|
1684
1674
|
isOpen: h,
|
|
1685
1675
|
title: r?.ariaLabel ?? "Select model",
|
|
1686
1676
|
closeLabel: r?.closeLabel ?? "Close",
|
|
@@ -1736,239 +1726,237 @@ var kt = {
|
|
|
1736
1726
|
})
|
|
1737
1727
|
})
|
|
1738
1728
|
});
|
|
1739
|
-
},
|
|
1740
|
-
let
|
|
1741
|
-
"--ci-bg":
|
|
1742
|
-
"--ci-text":
|
|
1743
|
-
"--ci-border":
|
|
1744
|
-
"--ci-border-focus":
|
|
1745
|
-
"--ci-placeholder":
|
|
1746
|
-
"--ci-text-disabled":
|
|
1747
|
-
"--ci-model-selector-caret-color":
|
|
1748
|
-
"--ci-model-selector-hover-bg":
|
|
1749
|
-
"--ci-model-selector-disabled-color":
|
|
1750
|
-
"--ci-voice-error":
|
|
1751
|
-
"--ci-voice-waveform":
|
|
1752
|
-
"--ci-voice-accent":
|
|
1753
|
-
}), [
|
|
1729
|
+
}, Pt = 160, Ft = ({ message: e = "", messageRevision: t, onSend: n, onUploadAttachment: r, onStop: i, isStreaming: l = !1, onChange: u, onAttachmentsChange: f, placeholder: p = "Type a message...", ariaLabel: m, attachLabel: h = "Attach file", fileAccept: g, addMenuTitle: _ = "Add", menuTitle: v = "Menu", menuCloseLabel: y = "Close", removeLabel: b, retryLabel: x, sendLabel: S, stopLabel: C, micLabel: w = "Record voice message", stopRecordingLabel: T, discardRecordingLabel: E, colors: D, typography: O, className: k, pendingDropFiles: A = [], onDropFilesConsumed: M, pendingAttachments: N = [], onPendingAttachmentsConsumed: ee, pasteTextThreshold: P = 4e3, deployments: te, selectedDeploymentId: F, onDeploymentChange: ie, modelSelectorLabels: ae, initialAttachments: oe = [], isStacked: se = !1, hideAddButton: ce = !1, hideAttachFile: le = !1, hideActionBar: ue = !1, renderFooterActions: de, isInputDisabled: I = !1, isModelSelectorDisabled: R = !1, isSendDisabled: fe = !1, isAudioMessageSupported: pe = !1, sendOnEnter: me = Fe.Enter, prefixAttachments: G = [], onRemovePrefixAttachment: he, chatSettings: _e, toolsMenuItems: ve, onToolToggle: ye, toolsMenuTitle: be, toolsBackLabel: Se, toolsChipLabels: Ce, autoFocus: K = !1, messageHistory: we, onDialFileSystemClick: De, dialFileSystemLabel: Oe, validateAttachment: je, onAttachmentClick: Me, modelPickerOverlay: Ne, maximumAttachmentsAmount: Ie, onAttachmentsLimitExceeded: Le, isAttachmentsEnabled: Re = !0, usageLimitsSlot: ze, onMessageTooLong: Be }) => {
|
|
1730
|
+
let Ve = s(), [He, Ue] = V(!1), We = ke(we), Ge = z(() => a({
|
|
1731
|
+
"--ci-bg": D?.background,
|
|
1732
|
+
"--ci-text": D?.text,
|
|
1733
|
+
"--ci-border": D?.border,
|
|
1734
|
+
"--ci-border-focus": D?.borderFocus,
|
|
1735
|
+
"--ci-placeholder": D?.placeholder,
|
|
1736
|
+
"--ci-text-disabled": D?.textDisabled,
|
|
1737
|
+
"--ci-model-selector-caret-color": D?.modelSelectorCaret,
|
|
1738
|
+
"--ci-model-selector-hover-bg": D?.modelSelectorHoverBg,
|
|
1739
|
+
"--ci-model-selector-disabled-color": D?.modelSelectorDisabled,
|
|
1740
|
+
"--ci-voice-error": D?.voiceError,
|
|
1741
|
+
"--ci-voice-waveform": D?.voiceWaveform,
|
|
1742
|
+
"--ci-voice-accent": D?.voiceAccent
|
|
1743
|
+
}), [D]), Ke = z(() => De ? [{
|
|
1754
1744
|
key: "dial-fs",
|
|
1755
|
-
label:
|
|
1756
|
-
icon: /* @__PURE__ */ U(
|
|
1745
|
+
label: Oe ?? "DIAL file system",
|
|
1746
|
+
icon: /* @__PURE__ */ U(ne, {
|
|
1757
1747
|
size: c,
|
|
1758
1748
|
"aria-hidden": !0
|
|
1759
1749
|
}),
|
|
1760
|
-
onClick:
|
|
1761
|
-
}] : [], [
|
|
1750
|
+
onClick: De
|
|
1751
|
+
}] : [], [De, Oe]), { message: q, setMessage: J, textareaRef: Je, isMultiLine: Xe } = Ae({
|
|
1762
1752
|
messageProp: e,
|
|
1763
1753
|
messageRevision: t
|
|
1764
|
-
}), { attachments: X, buildAttachments:
|
|
1765
|
-
initialAttachments:
|
|
1754
|
+
}), { attachments: X, buildAttachments: Ze, addAttachments: Z, resetAttachments: tt, handleRemove: nt, handleRetry: rt, handleExpand: it, hasBlockedAttachments: at } = Te({
|
|
1755
|
+
initialAttachments: oe,
|
|
1766
1756
|
onUploadAttachment: r,
|
|
1767
1757
|
onAttachmentsChange: f,
|
|
1768
|
-
validateAttachment:
|
|
1769
|
-
pendingDropFiles:
|
|
1758
|
+
validateAttachment: je,
|
|
1759
|
+
pendingDropFiles: A,
|
|
1770
1760
|
onDropFilesConsumed: M,
|
|
1771
1761
|
pendingAttachments: N,
|
|
1772
|
-
onPendingAttachmentsConsumed:
|
|
1773
|
-
onExpandPastedText:
|
|
1774
|
-
|
|
1775
|
-
}, [
|
|
1776
|
-
maximumAttachmentsAmount:
|
|
1777
|
-
baseAttachmentsAmount:
|
|
1778
|
-
onAttachmentsLimitExceeded:
|
|
1779
|
-
}), { state:
|
|
1780
|
-
|
|
1781
|
-
}, [
|
|
1782
|
-
if (!
|
|
1762
|
+
onPendingAttachmentsConsumed: ee,
|
|
1763
|
+
onExpandPastedText: L((e) => {
|
|
1764
|
+
J((t) => t ? `${t}\n${e}` : e);
|
|
1765
|
+
}, [J]),
|
|
1766
|
+
maximumAttachmentsAmount: Ie,
|
|
1767
|
+
baseAttachmentsAmount: G.length,
|
|
1768
|
+
onAttachmentsLimitExceeded: Le
|
|
1769
|
+
}), { state: ot, analyserNodeRef: st, errorMessage: ct, startRecording: lt, stopRecording: ut, discardRecording: dt } = Pe({ onAttachAudio: L((e) => {
|
|
1770
|
+
Z(Ze([e]));
|
|
1771
|
+
}, [Z, Ze]) }), ft = B(null), pt = B(null), { handlePaste: mt } = xe(Z, Re ? P : Infinity), ht = L((e) => {
|
|
1772
|
+
if (!Re) {
|
|
1783
1773
|
let t = e.clipboardData.getData("text/plain");
|
|
1784
|
-
t.length >=
|
|
1774
|
+
t.length >= P && Be?.(t.length, P);
|
|
1785
1775
|
}
|
|
1786
|
-
|
|
1776
|
+
mt(e);
|
|
1787
1777
|
}, [
|
|
1778
|
+
Re,
|
|
1779
|
+
P,
|
|
1788
1780
|
Be,
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
me,
|
|
1794
|
-
bt,
|
|
1781
|
+
mt
|
|
1782
|
+
]), Q = q.trim().length > 0 || X.length > 0, gt = Q && !at && !fe, { shouldRender: _t, isExiting: vt, instanceKey: yt } = Ee(!l && Q, Pt), bt = (ve?.some((e) => e.isSelected) ?? !1) && ye != null, $ = se || q.includes("\n") || Xe || bt, xt = te === void 0 || F != null, St = z(() => pe && !vt && !l, [
|
|
1783
|
+
pe,
|
|
1784
|
+
vt,
|
|
1795
1785
|
l
|
|
1796
|
-
]),
|
|
1797
|
-
if (
|
|
1798
|
-
if (!
|
|
1799
|
-
|
|
1786
|
+
]), Ct = async () => {
|
|
1787
|
+
if (fe) return;
|
|
1788
|
+
if (!Re && q.length >= P) {
|
|
1789
|
+
Be?.(q.length, P);
|
|
1800
1790
|
return;
|
|
1801
1791
|
}
|
|
1802
|
-
let e =
|
|
1803
|
-
|
|
1792
|
+
let e = q, t = X;
|
|
1793
|
+
J(""), We.reset();
|
|
1804
1794
|
try {
|
|
1805
1795
|
await n?.(e, t), t.forEach((e) => {
|
|
1806
1796
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
1807
|
-
}),
|
|
1797
|
+
}), tt([]);
|
|
1808
1798
|
} catch {
|
|
1809
|
-
|
|
1799
|
+
J(e), tt(t);
|
|
1810
1800
|
}
|
|
1811
|
-
},
|
|
1812
|
-
if (!e.nativeEvent.isComposing && !
|
|
1813
|
-
let t = e.currentTarget.selectionStart ?? 0, n =
|
|
1801
|
+
}, wt = (e) => {
|
|
1802
|
+
if (!e.nativeEvent.isComposing && !I && !l && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
1803
|
+
let t = e.currentTarget.selectionStart ?? 0, n = We.navigate(e.key === "ArrowUp" ? "up" : "down", q, t);
|
|
1814
1804
|
if (n !== null) {
|
|
1815
|
-
e.preventDefault(),
|
|
1805
|
+
e.preventDefault(), J(n);
|
|
1816
1806
|
return;
|
|
1817
1807
|
}
|
|
1818
1808
|
}
|
|
1819
|
-
e.key === "Enter" && (
|
|
1820
|
-
},
|
|
1809
|
+
e.key === "Enter" && (me === Fe.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !l && gt && xt && !I && Ct());
|
|
1810
|
+
}, Tt = (e) => {
|
|
1821
1811
|
let t = Array.from(e.target.files ?? []);
|
|
1822
1812
|
if (t.length === 0) return;
|
|
1823
|
-
let n =
|
|
1824
|
-
e.target.value = "",
|
|
1813
|
+
let n = Ze(t);
|
|
1814
|
+
e.target.value = "", Z(n);
|
|
1825
1815
|
};
|
|
1826
|
-
if (
|
|
1827
|
-
state:
|
|
1828
|
-
analyserNodeRef:
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
onDiscard: pt,
|
|
1816
|
+
if (ot !== "idle") return /* @__PURE__ */ U(Qe, {
|
|
1817
|
+
state: ot,
|
|
1818
|
+
analyserNodeRef: st,
|
|
1819
|
+
errorMessage: ct,
|
|
1820
|
+
onStop: ut,
|
|
1821
|
+
onDiscard: dt,
|
|
1833
1822
|
stopLabel: T,
|
|
1834
1823
|
discardLabel: E,
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
className: A
|
|
1824
|
+
style: Ge,
|
|
1825
|
+
className: k
|
|
1838
1826
|
});
|
|
1839
|
-
let
|
|
1840
|
-
className: o(Y.textarea,
|
|
1841
|
-
ref:
|
|
1842
|
-
autoFocus:
|
|
1843
|
-
value:
|
|
1827
|
+
let Et = /* @__PURE__ */ U("textarea", {
|
|
1828
|
+
className: o(Y.textarea, O?.fontClassName || "dial-body-paragraph-text", "max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent outline-none [field-sizing:content]"),
|
|
1829
|
+
ref: Je,
|
|
1830
|
+
autoFocus: K,
|
|
1831
|
+
value: q,
|
|
1844
1832
|
onChange: (e) => {
|
|
1845
|
-
|
|
1833
|
+
J(e.target.value), We.notifyChange(), u?.(e.target.value);
|
|
1846
1834
|
},
|
|
1847
|
-
onKeyDown:
|
|
1848
|
-
onPaste:
|
|
1835
|
+
onKeyDown: wt,
|
|
1836
|
+
onPaste: ht,
|
|
1849
1837
|
placeholder: p,
|
|
1850
1838
|
"aria-label": m,
|
|
1851
|
-
disabled:
|
|
1839
|
+
disabled: I,
|
|
1852
1840
|
rows: 1
|
|
1853
1841
|
});
|
|
1854
1842
|
return /* @__PURE__ */ W("div", {
|
|
1855
|
-
ref:
|
|
1856
|
-
style:
|
|
1857
|
-
className: o(Y.wrapper,
|
|
1858
|
-
children: [(
|
|
1859
|
-
attachments: [...
|
|
1843
|
+
ref: pt,
|
|
1844
|
+
style: Ge,
|
|
1845
|
+
className: o(Y.wrapper, I && Y.wrapperDisabled, "flex min-h-[64px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border shadow-md", "focus-within:outline focus-within:-outline-offset-1 active:outline active:-outline-offset-1", X.length > 6 ? "py-3 ps-3" : "p-3", k),
|
|
1846
|
+
children: [(G.length > 0 || X.length > 0) && /* @__PURE__ */ U(ge, {
|
|
1847
|
+
attachments: [...G, ...X],
|
|
1860
1848
|
onRemove: (e) => {
|
|
1861
|
-
|
|
1849
|
+
G.some((t) => t.id === e) ? he?.(e) : nt(e);
|
|
1862
1850
|
},
|
|
1863
|
-
onRetry:
|
|
1864
|
-
onExpand:
|
|
1851
|
+
onRetry: rt,
|
|
1852
|
+
onExpand: it,
|
|
1865
1853
|
labels: {
|
|
1866
1854
|
removeLabel: b,
|
|
1867
1855
|
retryLabel: x
|
|
1868
1856
|
},
|
|
1869
|
-
onAttachmentClick:
|
|
1870
|
-
let t = [...
|
|
1871
|
-
t != null &&
|
|
1857
|
+
onAttachmentClick: Me == null ? void 0 : (e) => {
|
|
1858
|
+
let t = [...G, ...X].find((t) => t.id === e);
|
|
1859
|
+
t != null && Me(t);
|
|
1872
1860
|
}
|
|
1873
|
-
}),
|
|
1861
|
+
}), ue ? $ && Et : /* @__PURE__ */ W("div", {
|
|
1874
1862
|
className: o("flex items-center gap-2", $ ? "flex-wrap" : "flex-wrap desktop:flex-nowrap"),
|
|
1875
1863
|
children: [
|
|
1876
|
-
!
|
|
1864
|
+
!ce && /* @__PURE__ */ W("div", {
|
|
1877
1865
|
className: o("flex", "order-2", !$ && "desktop:order-1"),
|
|
1878
1866
|
children: [/* @__PURE__ */ U("input", {
|
|
1879
|
-
ref:
|
|
1867
|
+
ref: ft,
|
|
1880
1868
|
type: "file",
|
|
1881
1869
|
multiple: !0,
|
|
1882
1870
|
accept: g,
|
|
1883
1871
|
className: "sr-only",
|
|
1884
1872
|
"aria-hidden": !0,
|
|
1885
1873
|
tabIndex: -1,
|
|
1886
|
-
onChange:
|
|
1874
|
+
onChange: Tt
|
|
1887
1875
|
}), /* @__PURE__ */ U(qe, {
|
|
1888
|
-
onAttachClick:
|
|
1876
|
+
onAttachClick: le ? void 0 : () => ft.current?.click(),
|
|
1889
1877
|
attachLabel: h,
|
|
1890
1878
|
addMenuTitle: _,
|
|
1891
1879
|
menuTitle: v,
|
|
1892
1880
|
menuCloseLabel: y,
|
|
1893
|
-
style:
|
|
1894
|
-
isDisabled:
|
|
1895
|
-
chatSettings:
|
|
1896
|
-
extraMenuItems:
|
|
1897
|
-
toolsMenuItems:
|
|
1898
|
-
onToolToggle:
|
|
1899
|
-
toolsMenuTitle:
|
|
1900
|
-
toolsBackLabel:
|
|
1881
|
+
style: Ge,
|
|
1882
|
+
isDisabled: I,
|
|
1883
|
+
chatSettings: _e,
|
|
1884
|
+
extraMenuItems: Ke,
|
|
1885
|
+
toolsMenuItems: ve,
|
|
1886
|
+
onToolToggle: ye,
|
|
1887
|
+
toolsMenuTitle: be,
|
|
1888
|
+
toolsBackLabel: Se
|
|
1901
1889
|
})]
|
|
1902
1890
|
}),
|
|
1903
|
-
$ &&
|
|
1891
|
+
$ && bt && /* @__PURE__ */ U("div", {
|
|
1904
1892
|
className: "order-3 min-w-0 flex-1",
|
|
1905
1893
|
children: /* @__PURE__ */ U(Ye, {
|
|
1906
|
-
items:
|
|
1907
|
-
onToolToggle:
|
|
1908
|
-
isMobile:
|
|
1909
|
-
countLabel:
|
|
1910
|
-
removeLabel:
|
|
1894
|
+
items: ve ?? [],
|
|
1895
|
+
onToolToggle: ye,
|
|
1896
|
+
isMobile: Ve,
|
|
1897
|
+
countLabel: Ce?.countLabel,
|
|
1898
|
+
removeLabel: Ce?.removeLabel
|
|
1911
1899
|
})
|
|
1912
1900
|
}),
|
|
1913
1901
|
/* @__PURE__ */ U("div", {
|
|
1914
1902
|
className: o("order-1 flex w-full min-w-0 items-center self-stretch", !$ && "desktop:order-2 desktop:w-auto desktop:flex-1"),
|
|
1915
|
-
children:
|
|
1903
|
+
children: Et
|
|
1916
1904
|
}),
|
|
1917
1905
|
/* @__PURE__ */ W("div", {
|
|
1918
|
-
className: o("flex flex-shrink-0 items-center gap-2", $ &&
|
|
1919
|
-
children: [
|
|
1920
|
-
canSend:
|
|
1921
|
-
onSend:
|
|
1906
|
+
className: o("flex flex-shrink-0 items-center gap-2", $ && bt ? "order-4" : "order-3", "ms-auto", !$ && "desktop:ms-0"),
|
|
1907
|
+
children: [de ? de({
|
|
1908
|
+
canSend: gt,
|
|
1909
|
+
onSend: Ct
|
|
1922
1910
|
}) : /* @__PURE__ */ W(H, { children: [
|
|
1923
|
-
|
|
1924
|
-
/* @__PURE__ */ U(
|
|
1925
|
-
deployments:
|
|
1926
|
-
selectedDeploymentId:
|
|
1927
|
-
onDeploymentChange:
|
|
1928
|
-
modelSelectorLabels:
|
|
1911
|
+
ze,
|
|
1912
|
+
/* @__PURE__ */ U(Nt, {
|
|
1913
|
+
deployments: te,
|
|
1914
|
+
selectedDeploymentId: F,
|
|
1915
|
+
onDeploymentChange: ie,
|
|
1916
|
+
modelSelectorLabels: ae,
|
|
1929
1917
|
isStreaming: l,
|
|
1930
|
-
isMobile:
|
|
1931
|
-
isDisabled:
|
|
1932
|
-
style:
|
|
1933
|
-
modelPickerOverlay:
|
|
1934
|
-
isPickerOpen:
|
|
1935
|
-
onPickerToggle: () =>
|
|
1936
|
-
onPickerOpenChange:
|
|
1918
|
+
isMobile: Ve,
|
|
1919
|
+
isDisabled: R,
|
|
1920
|
+
style: Ge,
|
|
1921
|
+
modelPickerOverlay: Ne,
|
|
1922
|
+
isPickerOpen: He,
|
|
1923
|
+
onPickerToggle: () => Ue((e) => !e),
|
|
1924
|
+
onPickerOpenChange: Ue
|
|
1937
1925
|
}),
|
|
1938
|
-
l && i ? /* @__PURE__ */ U(
|
|
1926
|
+
l && i ? /* @__PURE__ */ U(et, {
|
|
1939
1927
|
onStop: i,
|
|
1940
1928
|
ariaLabel: C
|
|
1941
|
-
}) : !l &&
|
|
1942
|
-
onSend:
|
|
1943
|
-
isDisabled: !
|
|
1929
|
+
}) : !l && _t && /* @__PURE__ */ U($e, {
|
|
1930
|
+
onSend: Ct,
|
|
1931
|
+
isDisabled: !xt || at || fe,
|
|
1944
1932
|
ariaLabel: S,
|
|
1945
|
-
isExiting:
|
|
1946
|
-
},
|
|
1947
|
-
] }),
|
|
1948
|
-
icon: /* @__PURE__ */ U(
|
|
1933
|
+
isExiting: vt
|
|
1934
|
+
}, yt)
|
|
1935
|
+
] }), St && /* @__PURE__ */ U(j, {
|
|
1936
|
+
icon: /* @__PURE__ */ U(re, {
|
|
1949
1937
|
size: d.LG,
|
|
1950
1938
|
"aria-hidden": !0
|
|
1951
1939
|
}),
|
|
1952
1940
|
"aria-label": w,
|
|
1953
1941
|
className: "size-8 flex-shrink-0",
|
|
1954
|
-
onClick:
|
|
1955
|
-
disabled:
|
|
1942
|
+
onClick: lt,
|
|
1943
|
+
disabled: I || l
|
|
1956
1944
|
})]
|
|
1957
1945
|
})
|
|
1958
1946
|
]
|
|
1959
1947
|
})]
|
|
1960
1948
|
});
|
|
1961
|
-
},
|
|
1949
|
+
}, It = { welcome: "_welcome_n2ph8_1" }, Lt = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, styles: r, className: i, inputClassName: s, isInputDisabled: c = !1, ...l }) => {
|
|
1962
1950
|
let { colors: u, typography: d } = r ?? {};
|
|
1963
1951
|
return /* @__PURE__ */ W("div", {
|
|
1964
1952
|
style: a({ "--ci-welcome-color": u?.welcomeText }),
|
|
1965
1953
|
className: o("relative flex w-full flex-col items-center gap-6 px-4 py-5 desktop:p-5", i),
|
|
1966
1954
|
children: [n && /* @__PURE__ */ U("h1", {
|
|
1967
|
-
className: o(
|
|
1955
|
+
className: o(It.welcome, "m-0 text-center", d?.welcomeClassName || "dial-display2-text"),
|
|
1968
1956
|
children: n
|
|
1969
1957
|
}), /* @__PURE__ */ U("div", {
|
|
1970
1958
|
className: "relative w-full max-w-[748px]",
|
|
1971
|
-
children: /* @__PURE__ */ U(
|
|
1959
|
+
children: /* @__PURE__ */ U(Ft, {
|
|
1972
1960
|
placeholder: t,
|
|
1973
1961
|
isStreaming: e,
|
|
1974
1962
|
isInputDisabled: c,
|
|
@@ -1979,30 +1967,30 @@ var kt = {
|
|
|
1979
1967
|
})
|
|
1980
1968
|
})]
|
|
1981
1969
|
});
|
|
1982
|
-
},
|
|
1983
|
-
let P = B(null), [
|
|
1984
|
-
|
|
1985
|
-
v?.length && (
|
|
1970
|
+
}, Rt = ({ message: e, initialAttachments: t = [], onCancel: n, onSave: i, onUploadAttachment: a, cancelLabel: s = "Cancel", saveLabel: l = "Save & Submit", ariaLabel: u, removeLabel: d, retryLabel: f, addMenuTitle: p = "Add", attachLabel: m = "Attach file", menuTitle: h = "Menu", menuCloseLabel: g = "Close", className: _, pendingDropFiles: v, onDropFilesConsumed: y, validateAttachment: b, isAttachmentsEnabled: x, hideAttachFile: S = !1, fileAccept: w, maximumAttachmentsAmount: T, onAttachmentsLimitExceeded: D, onDialFileSystemClick: O, dialFileSystemLabel: k, pendingAttachments: A, onPendingAttachmentsConsumed: j, onAttachmentClick: M, pasteTextThreshold: N, onMessageTooLong: ee }) => {
|
|
1971
|
+
let P = B(null), [te, re] = V([]);
|
|
1972
|
+
R(() => {
|
|
1973
|
+
v?.length && (re(v), y?.());
|
|
1986
1974
|
}, [v, y]);
|
|
1987
|
-
let [
|
|
1975
|
+
let [F, ie] = V(e ?? ""), [ae, oe] = V([]), [se, ce] = V(t), le = ae.some((e) => e.status === r.Loading || e.status === r.Error), ue = (F.trim().length > 0 || ae.length > 0 || se.length > 0) && !le, de = (e) => {
|
|
1988
1976
|
ce((t) => t.filter((t) => t.id !== e));
|
|
1989
|
-
},
|
|
1977
|
+
}, I = L((e, t) => {
|
|
1990
1978
|
i(e, se, t);
|
|
1991
|
-
}, [se, i]),
|
|
1979
|
+
}, [se, i]), fe = () => {
|
|
1992
1980
|
if (ue) {
|
|
1993
|
-
if (!x &&
|
|
1994
|
-
|
|
1981
|
+
if (!x && F.length >= (N ?? 4e3)) {
|
|
1982
|
+
ee?.(F.length, N ?? 4e3);
|
|
1995
1983
|
return;
|
|
1996
1984
|
}
|
|
1997
|
-
|
|
1985
|
+
I(F, ae);
|
|
1998
1986
|
}
|
|
1999
|
-
},
|
|
1987
|
+
}, pe = L(() => re([]), []), me = L((e) => {
|
|
2000
1988
|
let t = Array.from(e.target.files ?? []);
|
|
2001
|
-
t.length !== 0 && (e.target.value = "",
|
|
2002
|
-
}, []),
|
|
1989
|
+
t.length !== 0 && (e.target.value = "", re(t));
|
|
1990
|
+
}, []), G = z(() => O ? [{
|
|
2003
1991
|
key: "dial-fs",
|
|
2004
1992
|
label: k ?? "DIAL file system",
|
|
2005
|
-
icon: /* @__PURE__ */ U(
|
|
1993
|
+
icon: /* @__PURE__ */ U(ne, {
|
|
2006
1994
|
size: c,
|
|
2007
1995
|
"aria-hidden": !0
|
|
2008
1996
|
}),
|
|
@@ -2010,14 +1998,14 @@ var kt = {
|
|
|
2010
1998
|
}] : [], [O, k]);
|
|
2011
1999
|
return /* @__PURE__ */ W("div", {
|
|
2012
2000
|
className: o("flex w-full flex-col gap-2", _),
|
|
2013
|
-
children: [/* @__PURE__ */ U(
|
|
2001
|
+
children: [/* @__PURE__ */ U(Ft, {
|
|
2014
2002
|
message: e,
|
|
2015
2003
|
ariaLabel: u,
|
|
2016
2004
|
isStacked: !0,
|
|
2017
2005
|
hideActionBar: !0,
|
|
2018
|
-
pendingDropFiles:
|
|
2019
|
-
onDropFilesConsumed:
|
|
2020
|
-
onSend:
|
|
2006
|
+
pendingDropFiles: te,
|
|
2007
|
+
onDropFilesConsumed: pe,
|
|
2008
|
+
onSend: I,
|
|
2021
2009
|
onUploadAttachment: a,
|
|
2022
2010
|
onChange: ie,
|
|
2023
2011
|
onAttachmentsChange: oe,
|
|
@@ -2032,9 +2020,9 @@ var kt = {
|
|
|
2032
2020
|
onAttachmentsLimitExceeded: D,
|
|
2033
2021
|
pendingAttachments: A,
|
|
2034
2022
|
onPendingAttachmentsConsumed: j,
|
|
2035
|
-
onAttachmentClick:
|
|
2036
|
-
pasteTextThreshold:
|
|
2037
|
-
onMessageTooLong:
|
|
2023
|
+
onAttachmentClick: M,
|
|
2024
|
+
pasteTextThreshold: N,
|
|
2025
|
+
onMessageTooLong: ee
|
|
2038
2026
|
}), /* @__PURE__ */ W("div", {
|
|
2039
2027
|
className: "flex items-center justify-between",
|
|
2040
2028
|
children: [/* @__PURE__ */ U("div", {
|
|
@@ -2054,7 +2042,7 @@ var kt = {
|
|
|
2054
2042
|
addMenuTitle: p,
|
|
2055
2043
|
menuTitle: h,
|
|
2056
2044
|
menuCloseLabel: g,
|
|
2057
|
-
extraMenuItems:
|
|
2045
|
+
extraMenuItems: G
|
|
2058
2046
|
})] })
|
|
2059
2047
|
}), /* @__PURE__ */ W("div", {
|
|
2060
2048
|
className: "flex gap-2",
|
|
@@ -2063,7 +2051,7 @@ var kt = {
|
|
|
2063
2051
|
onClick: n
|
|
2064
2052
|
}), /* @__PURE__ */ U(E, {
|
|
2065
2053
|
label: l,
|
|
2066
|
-
onClick:
|
|
2054
|
+
onClick: fe,
|
|
2067
2055
|
disabled: !ue
|
|
2068
2056
|
})]
|
|
2069
2057
|
})]
|
|
@@ -2071,4 +2059,4 @@ var kt = {
|
|
|
2071
2059
|
});
|
|
2072
2060
|
};
|
|
2073
2061
|
//#endregion
|
|
2074
|
-
export { me as AttachmentCard,
|
|
2062
|
+
export { me as AttachmentCard, G as AttachmentGroup, he as AttachmentTray, K as BottomSheetShell, Ue as ChatSettingsModal, Lt as ConversationInput, Rt as EditMessageInput, _e as FileDndOverlay, Ft as Input, Fe as SendOnEnter, be as getAttachmentIcon };
|