@epam/ai-dial-conversation-input 1.3.0-dev.241 → 1.3.0-dev.244
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/UsageLimitBannerView/UsageLimitBannerView.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.js +699 -711
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, MIME_TYPE_EXT_MAP as r, RESIZABLE_TEXTAREA_CLASS_NAME as i, RequestStatus as a, ResponseFormat as o, SELECT_LIST_MAX_HEIGHT_PX as s, buildCssVars as c, mergeClasses as l, normalizeMimeType as u, useIsMobile as d } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { BASE_ICON_SIZE as f, BottomSheet as p, Button as m, ButtonVariant as h, CloseButton as g, DIAL_ICON_SIZE as _, DIAL_KIT_ICON_STROKE as v, Dropdown as y, ElementSize as b, ErrorText as x, GhostIconButton as S, Highlight as C, MenuItemMark as w, NeutralButton as T, NeutralIconButton as E,
|
|
3
|
-
import { Fragment as
|
|
4
|
-
import { AttachmentTray as
|
|
5
|
-
import {
|
|
6
|
-
import { createElement as we, forwardRef as Te, memo as Ee, useCallback as
|
|
2
|
+
import { BASE_ICON_SIZE as f, BottomSheet as p, Button as m, ButtonVariant as h, CloseButton as g, DIAL_ICON_SIZE as _, DIAL_KIT_ICON_STROKE as v, Dropdown as y, ElementSize as b, ErrorText as x, GhostIconButton as S, Highlight as C, MenuItemMark as w, NeutralButton as T, NeutralIconButton as E, Notification as D, NotificationType as O, NotificationVariant as k, Popup as A, PopupSize as j, PrimaryButton as M, PrimaryIconButton as N, RadioGroup as ee, RadioGroupOrientation as te, Search as ne, Skeleton as re, SkeletonVariant as ie, Slider as P, Spinner as ae, Textarea as F, TextareaResize as oe, Tooltip as se } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { Fragment as ce, jsx as I, jsxs as L } from "react/jsx-runtime";
|
|
4
|
+
import { AttachmentTray as le, MAX_UPLOADS_PER_MINUTE as ue, generateAttachmentId as de, useClipboardPaste as fe } from "@epam/ai-dial-attachment-input";
|
|
5
|
+
import { IconArrowNarrowRight as pe, IconCheck as me, IconChevronDown as he, IconChevronRight as R, IconFile as ge, IconMicrophone as _e, IconPaperclip as ve, IconPlayerStop as ye, IconPlus as be, IconSettings as xe, IconTool as Se, IconX as Ce } from "@tabler/icons-react";
|
|
6
|
+
import { createElement as we, forwardRef as Te, memo as Ee, useCallback as z, useEffect as B, useId as De, useImperativeHandle as Oe, useLayoutEffect as ke, useMemo as V, useRef as H, useState as U } from "react";
|
|
7
7
|
//#region src/constants/public-class-names.ts
|
|
8
|
-
var
|
|
8
|
+
var W = {
|
|
9
9
|
wrapper: "dial-ci-wrapper",
|
|
10
10
|
actionRow: "dial-ci-action-row",
|
|
11
11
|
textareaWrap: "dial-ci-textarea-wrap",
|
|
@@ -25,14 +25,14 @@ var U = {
|
|
|
25
25
|
sheet: "_sheet_1ym62_12",
|
|
26
26
|
title: "_title_1ym62_16",
|
|
27
27
|
divider: "_divider_1ym62_20"
|
|
28
|
-
},
|
|
28
|
+
}, G = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: a, "aria-label": o, style: s, titleClassName: u = "dial-body-semi-text", className: d, colors: f, portalId: m, overlayClassName: h, overlayStyle: g, children: _ }) => {
|
|
29
29
|
let v = c({
|
|
30
30
|
"--ci-backdrop": f?.backdrop,
|
|
31
31
|
"--ci-sheet-bg": f?.sheetBg,
|
|
32
32
|
"--ci-sheet-text": f?.sheetText,
|
|
33
33
|
"--ci-sheet-divider": f?.divider
|
|
34
34
|
});
|
|
35
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ I(p, {
|
|
36
36
|
open: e,
|
|
37
37
|
onClose: r,
|
|
38
38
|
title: t,
|
|
@@ -55,23 +55,23 @@ var U = {
|
|
|
55
55
|
titleClassName: l(Ae.title, u),
|
|
56
56
|
children: _
|
|
57
57
|
});
|
|
58
|
-
},
|
|
58
|
+
}, je = async (e, t, n) => {
|
|
59
59
|
let r = 6e4 / t, i = [];
|
|
60
60
|
for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
|
|
61
61
|
await Promise.allSettled(i);
|
|
62
|
-
},
|
|
63
|
-
let [g, _] =
|
|
64
|
-
|
|
62
|
+
}, Me = ({ initialAttachments: n, onUploadAttachment: r, onAttachmentsChange: i, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, isDropDisabled: l = !1, pendingAttachments: u, onPendingAttachmentsConsumed: d, onExpandPastedText: f, maximumAttachmentsAmount: p, baseAttachmentsAmount: m = 0, onAttachmentsLimitExceeded: h }) => {
|
|
63
|
+
let [g, _] = U(n), v = H(g);
|
|
64
|
+
B(() => {
|
|
65
65
|
v.current = g;
|
|
66
|
-
}, [g]),
|
|
66
|
+
}, [g]), B(() => () => {
|
|
67
67
|
v.current.forEach((e) => {
|
|
68
68
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
69
69
|
});
|
|
70
70
|
}, []);
|
|
71
|
-
let y =
|
|
71
|
+
let y = z((e) => e.map((e) => {
|
|
72
72
|
let n = e.type.startsWith("image/"), r = e.type.startsWith("audio/"), i = n ? URL.createObjectURL(e) : void 0, o = r ? URL.createObjectURL(e) : void 0;
|
|
73
73
|
return {
|
|
74
|
-
id:
|
|
74
|
+
id: de(),
|
|
75
75
|
name: e.name,
|
|
76
76
|
contentType: e.type,
|
|
77
77
|
file: e,
|
|
@@ -80,22 +80,22 @@ var U = {
|
|
|
80
80
|
previewUrl: i,
|
|
81
81
|
playUrl: o
|
|
82
82
|
};
|
|
83
|
-
}), []), b =
|
|
84
|
-
|
|
83
|
+
}), []), b = H(i);
|
|
84
|
+
B(() => {
|
|
85
85
|
b.current = i;
|
|
86
86
|
}, [i]);
|
|
87
|
-
let x =
|
|
87
|
+
let x = H(!0), S = z((e) => {
|
|
88
88
|
_((t) => {
|
|
89
89
|
let n = e(t);
|
|
90
90
|
return n === t ? t : n;
|
|
91
91
|
});
|
|
92
92
|
}, []);
|
|
93
|
-
|
|
93
|
+
B(() => {
|
|
94
94
|
x.current ? x.current = !1 : b.current?.(g);
|
|
95
95
|
}, [g]);
|
|
96
|
-
let C =
|
|
96
|
+
let C = z((e) => {
|
|
97
97
|
_(e);
|
|
98
|
-
}, []), w =
|
|
98
|
+
}, []), w = z(async (t) => {
|
|
99
99
|
if (r) {
|
|
100
100
|
S((e) => e.map((e) => e.id === t.id ? {
|
|
101
101
|
...e,
|
|
@@ -118,7 +118,7 @@ var U = {
|
|
|
118
118
|
} : e));
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
}, [r, S]), T =
|
|
121
|
+
}, [r, S]), T = z((e, t = !0) => {
|
|
122
122
|
let n = new Set(v.current.map((e) => e.id)), r = e.filter((e) => !n.has(e.id));
|
|
123
123
|
if (r.length !== 0) {
|
|
124
124
|
if (p != null && p > 0 && Number.isFinite(p)) {
|
|
@@ -139,7 +139,7 @@ var U = {
|
|
|
139
139
|
status: a.Error,
|
|
140
140
|
errorReason: n
|
|
141
141
|
} : e));
|
|
142
|
-
}),
|
|
142
|
+
}), je(e, ue, w);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
}, [
|
|
@@ -149,8 +149,8 @@ var U = {
|
|
|
149
149
|
S,
|
|
150
150
|
w,
|
|
151
151
|
o
|
|
152
|
-
]), E =
|
|
153
|
-
|
|
152
|
+
]), E = H(/* @__PURE__ */ new WeakSet());
|
|
153
|
+
B(() => {
|
|
154
154
|
if (s.length === 0) {
|
|
155
155
|
E.current = /* @__PURE__ */ new WeakSet();
|
|
156
156
|
return;
|
|
@@ -163,13 +163,13 @@ var U = {
|
|
|
163
163
|
l,
|
|
164
164
|
c,
|
|
165
165
|
s
|
|
166
|
-
]),
|
|
166
|
+
]), B(() => {
|
|
167
167
|
u.length !== 0 && (T(u, !1), d?.());
|
|
168
168
|
}, [
|
|
169
169
|
T,
|
|
170
170
|
d,
|
|
171
171
|
u
|
|
172
|
-
]),
|
|
172
|
+
]), B(() => {
|
|
173
173
|
if (!o) return;
|
|
174
174
|
let t = !1, n = [], r = v.current.map((r) => {
|
|
175
175
|
if (r.status === a.Loading) return r;
|
|
@@ -196,7 +196,7 @@ var U = {
|
|
|
196
196
|
S,
|
|
197
197
|
w
|
|
198
198
|
]);
|
|
199
|
-
let D =
|
|
199
|
+
let D = z((e) => {
|
|
200
200
|
S((t) => {
|
|
201
201
|
let n = t.find((t) => t.id === e);
|
|
202
202
|
return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
|
|
@@ -208,11 +208,11 @@ var U = {
|
|
|
208
208
|
addAttachments: T,
|
|
209
209
|
resetAttachments: C,
|
|
210
210
|
handleRemove: D,
|
|
211
|
-
handleRetry:
|
|
211
|
+
handleRetry: z((e) => {
|
|
212
212
|
let t = g.find((t) => t.id === e);
|
|
213
213
|
t && w(t);
|
|
214
214
|
}, [g, w]),
|
|
215
|
-
handleExpand:
|
|
215
|
+
handleExpand: z(async (e) => {
|
|
216
216
|
let n = g.find((t) => t.id === e);
|
|
217
217
|
if (!n || n.type !== t.Pasted) return;
|
|
218
218
|
let r = await n.file.text();
|
|
@@ -224,31 +224,31 @@ var U = {
|
|
|
224
224
|
]),
|
|
225
225
|
hasBlockedAttachments: g.some((e) => e.status === a.Loading || e.status === a.Error)
|
|
226
226
|
};
|
|
227
|
-
},
|
|
227
|
+
}, Ne = (e, t) => {
|
|
228
228
|
let n = t;
|
|
229
229
|
for (; n < e.length && !/\s/.test(e[n]);) n++;
|
|
230
230
|
return n;
|
|
231
|
-
},
|
|
231
|
+
}, Pe = (e, t) => {
|
|
232
232
|
let n = t;
|
|
233
233
|
for (; n > 0 && !/\s/.test(e[n - 1]);) n--;
|
|
234
234
|
return {
|
|
235
235
|
start: n,
|
|
236
|
-
end:
|
|
236
|
+
end: Ne(e, n)
|
|
237
237
|
};
|
|
238
|
-
},
|
|
238
|
+
}, Fe = (e, t) => e.startsWith(t) && !e.slice(t.length).includes(t), Ie = "[role=\"option\"]:not([aria-disabled=\"true\"])", Le = /* @__PURE__ */ function(e) {
|
|
239
239
|
return e.Next = "next", e.Previous = "previous", e;
|
|
240
|
-
}({}),
|
|
241
|
-
let [n, r] =
|
|
240
|
+
}({}), Re = ({ config: e, message: t }) => {
|
|
241
|
+
let [n, r] = U(!1), [i, a] = U(null), [o, s] = U(null), c = H(null);
|
|
242
242
|
c.current = i;
|
|
243
243
|
let l = e != null && i != null && i <= t.length ? (() => {
|
|
244
|
-
let n = t.slice(i,
|
|
245
|
-
return
|
|
246
|
-
})() : "", u =
|
|
244
|
+
let n = t.slice(i, Ne(t, i));
|
|
245
|
+
return Fe(n, e.triggerPrefix) ? n.slice(e.triggerPrefix.length) : "";
|
|
246
|
+
})() : "", u = z((t, n, i) => {
|
|
247
247
|
if (e == null || i) return;
|
|
248
|
-
let { start: c, end: l } =
|
|
249
|
-
|
|
248
|
+
let { start: c, end: l } = Pe(t, n), u = t.slice(c, l);
|
|
249
|
+
Fe(u, e.triggerPrefix) ? (a(c), u === e.triggerPrefix || o !== c ? (r(!0), s(null)) : r(!1)) : (r(!1), s(null), a(null));
|
|
250
250
|
}, [e, o]);
|
|
251
|
-
|
|
251
|
+
B(() => {
|
|
252
252
|
if (e == null) {
|
|
253
253
|
r(!1), s(null), a(null);
|
|
254
254
|
return;
|
|
@@ -256,25 +256,25 @@ var U = {
|
|
|
256
256
|
let n = c.current;
|
|
257
257
|
if (n == null) return;
|
|
258
258
|
let i = Math.min(n, t.length);
|
|
259
|
-
|
|
259
|
+
Fe(t.slice(i, Ne(t, i)), e.triggerPrefix) || (r(!1), s(null), a(null));
|
|
260
260
|
}, [e, t]);
|
|
261
|
-
let d =
|
|
261
|
+
let d = z(() => {
|
|
262
262
|
r(!1), s(i);
|
|
263
|
-
}, [i]), f =
|
|
263
|
+
}, [i]), f = z(() => {
|
|
264
264
|
r(!1);
|
|
265
|
-
}, []), p =
|
|
265
|
+
}, []), p = z((n) => {
|
|
266
266
|
if (e == null) return;
|
|
267
|
-
let { start: i, end: s } =
|
|
268
|
-
|
|
267
|
+
let { start: i, end: s } = Pe(t, n);
|
|
268
|
+
Fe(t.slice(i, s), e.triggerPrefix) ? (a(i), r(o !== i)) : (a(null), r(!1));
|
|
269
269
|
}, [
|
|
270
270
|
e,
|
|
271
271
|
t,
|
|
272
272
|
o
|
|
273
|
-
]), m = De(), h =
|
|
274
|
-
|
|
273
|
+
]), m = De(), h = H(null), [g, _] = U(null);
|
|
274
|
+
B(() => {
|
|
275
275
|
_(null);
|
|
276
276
|
}, [n, l]);
|
|
277
|
-
let v =
|
|
277
|
+
let v = z(() => Array.from(h.current?.querySelectorAll(Ie) ?? []), []), y = z((e) => {
|
|
278
278
|
let t = v();
|
|
279
279
|
if (t.length === 0) {
|
|
280
280
|
_(null);
|
|
@@ -282,7 +282,7 @@ var U = {
|
|
|
282
282
|
}
|
|
283
283
|
let n = t.findIndex((e) => e.id === g), r = t[e === "next" ? (n + 1) % t.length : (n <= 0 ? t.length : n) - 1];
|
|
284
284
|
_(r.id), r.scrollIntoView?.({ block: "nearest" });
|
|
285
|
-
}, [v, g]), b =
|
|
285
|
+
}, [v, g]), b = z(() => v().find((e) => e.id === g) ?? null, [v, g]);
|
|
286
286
|
return {
|
|
287
287
|
isMenuOpen: n,
|
|
288
288
|
query: l,
|
|
@@ -297,18 +297,18 @@ var U = {
|
|
|
297
297
|
moveActiveOption: y,
|
|
298
298
|
getActiveOption: b
|
|
299
299
|
};
|
|
300
|
-
},
|
|
301
|
-
let t =
|
|
300
|
+
}, ze = (e, t) => !e.slice(0, t).includes("\n"), Be = (e, t) => !e.slice(t).includes("\n"), Ve = (e) => {
|
|
301
|
+
let t = H(e);
|
|
302
302
|
t.current = e;
|
|
303
|
-
let n =
|
|
303
|
+
let n = H(-1), r = H(""), i = z((e, i, a) => {
|
|
304
304
|
let o = t.current;
|
|
305
|
-
return !o || o.length === 0 ? null : e === "up" ? !
|
|
306
|
-
}, []), a =
|
|
305
|
+
return !o || o.length === 0 ? null : e === "up" ? !ze(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 || !Be(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
|
|
306
|
+
}, []), a = z(() => {
|
|
307
307
|
n.current = -1, r.current = "";
|
|
308
|
-
}, []), o =
|
|
308
|
+
}, []), o = z(() => {
|
|
309
309
|
n.current = -1, r.current = "";
|
|
310
310
|
}, []);
|
|
311
|
-
return
|
|
311
|
+
return V(() => ({
|
|
312
312
|
navigate: i,
|
|
313
313
|
notifyChange: a,
|
|
314
314
|
reset: o
|
|
@@ -317,16 +317,16 @@ var U = {
|
|
|
317
317
|
a,
|
|
318
318
|
o
|
|
319
319
|
]);
|
|
320
|
-
},
|
|
320
|
+
}, He = (e, t, n, r, i) => {
|
|
321
321
|
let a = [...t].sort((e, t) => e.start - t.start), o = [...n].sort((e, t) => e.offset - t.offset), s = [], c = 0, l = 0, u = (t, n) => {
|
|
322
322
|
if (n <= t) return;
|
|
323
323
|
let r = t;
|
|
324
324
|
o.filter((e) => e.offset >= t && e.offset <= n).forEach((t) => {
|
|
325
|
-
t.offset > r && s.push(/* @__PURE__ */
|
|
325
|
+
t.offset > r && s.push(/* @__PURE__ */ I("span", {
|
|
326
326
|
"aria-hidden": !0,
|
|
327
327
|
children: e.slice(r, t.offset)
|
|
328
328
|
}, `text-${l++}`)), s.push(t.node), r = t.offset;
|
|
329
|
-
}), r < n && s.push(/* @__PURE__ */
|
|
329
|
+
}), r < n && s.push(/* @__PURE__ */ I("span", {
|
|
330
330
|
"aria-hidden": !0,
|
|
331
331
|
children: e.slice(r, n)
|
|
332
332
|
}, `text-${l++}`));
|
|
@@ -334,16 +334,16 @@ var U = {
|
|
|
334
334
|
return a.forEach((t, n) => {
|
|
335
335
|
if (u(c, t.start), t.start + t.length <= c) return;
|
|
336
336
|
let a = e.slice(t.start, t.start + t.length);
|
|
337
|
-
s.push(t.render ? /* @__PURE__ */
|
|
337
|
+
s.push(t.render ? /* @__PURE__ */ I("span", {
|
|
338
338
|
className: "pointer-events-auto",
|
|
339
339
|
children: t.render()
|
|
340
|
-
}, `range-${n}`) : /* @__PURE__ */
|
|
340
|
+
}, `range-${n}`) : /* @__PURE__ */ I("span", {
|
|
341
341
|
"aria-hidden": !0,
|
|
342
342
|
className: t.isUnsupported ? i : r,
|
|
343
343
|
children: a
|
|
344
344
|
}, `range-${n}`)), c = Math.max(c, t.start + t.length);
|
|
345
345
|
}), u(c, e.length), s;
|
|
346
|
-
},
|
|
346
|
+
}, Ue = (e, t) => {
|
|
347
347
|
let n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, { acceptNode: (e) => e.parentElement?.closest("[data-mirror-synthetic]") == null ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT }), r = 0;
|
|
348
348
|
for (let e = n.nextNode(); e != null; e = n.nextNode()) {
|
|
349
349
|
let n = e.textContent?.length ?? 0;
|
|
@@ -354,24 +354,24 @@ var U = {
|
|
|
354
354
|
r += n;
|
|
355
355
|
}
|
|
356
356
|
return null;
|
|
357
|
-
},
|
|
358
|
-
let r =
|
|
357
|
+
}, We = (e, t, n) => {
|
|
358
|
+
let r = Ue(e, t), i = Ue(e, n);
|
|
359
359
|
if (r == null || i == null) return null;
|
|
360
360
|
let a = document.createRange();
|
|
361
361
|
return a.setStart(r.node, r.offset), a.setEnd(i.node, i.offset), a;
|
|
362
|
-
},
|
|
363
|
-
let r =
|
|
362
|
+
}, Ge = ({ textareaRef: e, message: t, isMirrorActive: n }) => {
|
|
363
|
+
let r = H(null), [i, a] = U([]), o = z(() => {
|
|
364
364
|
let t = e.current, n = r.current;
|
|
365
365
|
if (t == null || n == null) return;
|
|
366
366
|
let i = t.offsetWidth > t.clientWidth;
|
|
367
367
|
n.style.scrollbarGutter = i ? "stable" : "", n.scrollTop = t.scrollTop;
|
|
368
|
-
}, [e]), s =
|
|
368
|
+
}, [e]), s = z(() => {
|
|
369
369
|
let t = e.current, i = r.current, o = t?.selectionStart, s = t?.selectionEnd;
|
|
370
370
|
if (!n || t == null || i == null || o == null || s == null || o === s) {
|
|
371
371
|
a((e) => e.length === 0 ? e : []);
|
|
372
372
|
return;
|
|
373
373
|
}
|
|
374
|
-
let c =
|
|
374
|
+
let c = We(i, o, s);
|
|
375
375
|
if (c == null) {
|
|
376
376
|
a((e) => e.length === 0 ? e : []);
|
|
377
377
|
return;
|
|
@@ -386,7 +386,7 @@ var U = {
|
|
|
386
386
|
o,
|
|
387
387
|
s,
|
|
388
388
|
t
|
|
389
|
-
]),
|
|
389
|
+
]), B(() => {
|
|
390
390
|
if (!n) return;
|
|
391
391
|
let t = e.current;
|
|
392
392
|
if (t == null || typeof ResizeObserver > "u") return;
|
|
@@ -405,29 +405,29 @@ var U = {
|
|
|
405
405
|
updateSelectionRects: s,
|
|
406
406
|
syncMirrorToTextarea: o
|
|
407
407
|
};
|
|
408
|
-
},
|
|
409
|
-
let [n, r] =
|
|
410
|
-
return
|
|
408
|
+
}, Ke = ({ messageProp: e, messageRevision: t }) => {
|
|
409
|
+
let [n, r] = U(e), i = H(null);
|
|
410
|
+
return B(() => {
|
|
411
411
|
r(e);
|
|
412
412
|
}, [e, t]), {
|
|
413
413
|
message: n,
|
|
414
414
|
setMessage: r,
|
|
415
415
|
textareaRef: i
|
|
416
416
|
};
|
|
417
|
-
},
|
|
417
|
+
}, qe = (e, t, n, r = n) => {
|
|
418
418
|
let i = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set;
|
|
419
419
|
i ? i.call(e, t) : e.value = t, e.setSelectionRange(n, r), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
420
|
-
},
|
|
421
|
-
let n = e?.revision, r =
|
|
420
|
+
}, Je = (e) => e.key.toLowerCase() === "z" && (e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey, Ye = ({ insertion: e, textareaRef: t }) => {
|
|
421
|
+
let n = e?.revision, r = H(e?.text);
|
|
422
422
|
r.current = e?.text;
|
|
423
|
-
let i =
|
|
424
|
-
return
|
|
423
|
+
let i = H(n), a = H(null), o = H(!1);
|
|
424
|
+
return B(() => {
|
|
425
425
|
document.activeElement === t.current && (o.current = !0);
|
|
426
426
|
let e = (e) => {
|
|
427
427
|
e.target === t.current && (o.current = !0);
|
|
428
428
|
};
|
|
429
429
|
return document.addEventListener("focusin", e), () => document.removeEventListener("focusin", e);
|
|
430
|
-
}, [t]),
|
|
430
|
+
}, [t]), B(() => {
|
|
431
431
|
if (n === i.current) return;
|
|
432
432
|
i.current = n;
|
|
433
433
|
let e = r.current;
|
|
@@ -437,7 +437,7 @@ var U = {
|
|
|
437
437
|
let { value: r, selectionStart: i, selectionEnd: s } = n, c = !o.current && r.length > 0 && i === 0 && s === 0, l = c ? r.length : i ?? r.length, u = c ? l : s ?? l;
|
|
438
438
|
if (n.focus(), c && n.setSelectionRange(l, u), a.current = null, typeof document.execCommand == "function" && document.execCommand("insertText", !1, e)) return;
|
|
439
439
|
let d = `${r.slice(0, l)}${e}${r.slice(u)}`;
|
|
440
|
-
|
|
440
|
+
qe(n, d, l + e.length), a.current = {
|
|
441
441
|
insertedValue: d,
|
|
442
442
|
previousValue: r,
|
|
443
443
|
previousSelectionStart: l,
|
|
@@ -447,22 +447,22 @@ var U = {
|
|
|
447
447
|
}, [n, t]), {
|
|
448
448
|
handleUndoKeyDown: (e) => {
|
|
449
449
|
let n = a.current, r = t.current;
|
|
450
|
-
return n == null || r == null || !
|
|
450
|
+
return n == null || r == null || !Je(e) || (a.current = null, r.value !== n.insertedValue) ? !1 : (e.preventDefault(), qe(r, n.previousValue, n.previousSelectionStart, n.previousSelectionEnd), !0);
|
|
451
451
|
},
|
|
452
452
|
markCaretPlaced: () => {
|
|
453
453
|
o.current = !0;
|
|
454
454
|
}
|
|
455
455
|
};
|
|
456
|
-
},
|
|
456
|
+
}, Xe = /* @__PURE__ */ function(e) {
|
|
457
457
|
return e.Idle = "idle", e.Recording = "recording", e.Processing = "processing", e.Error = "error", e;
|
|
458
|
-
}({}),
|
|
458
|
+
}({}), Ze = /* @__PURE__ */ function(e) {
|
|
459
459
|
return e.Dictation = "dictation", e.Attachment = "attachment", e;
|
|
460
|
-
}({}),
|
|
460
|
+
}({}), Qe = [
|
|
461
461
|
"audio/webm;codecs=opus",
|
|
462
462
|
"audio/ogg;codecs=opus",
|
|
463
463
|
"audio/webm"
|
|
464
|
-
],
|
|
465
|
-
let [a, o] =
|
|
464
|
+
], $e = 100, et = 100, tt = .01, nt = ({ onAttachAudio: e, onTranscribeAudio: t, onTranscript: n, errorLabel: i = "Voice input failed" }) => {
|
|
465
|
+
let [a, o] = U("idle"), [s, c] = U(null), l = H(null), d = H(null), f = H({
|
|
466
466
|
onAttachAudio: e,
|
|
467
467
|
onTranscribeAudio: t,
|
|
468
468
|
onTranscript: n,
|
|
@@ -474,7 +474,7 @@ var U = {
|
|
|
474
474
|
onTranscript: n,
|
|
475
475
|
errorLabel: i
|
|
476
476
|
};
|
|
477
|
-
let p =
|
|
477
|
+
let p = z((e = "dictation") => {
|
|
478
478
|
if (d.current) return;
|
|
479
479
|
let t = { controller: new AbortController() };
|
|
480
480
|
d.current = t, c(null), o("recording");
|
|
@@ -492,7 +492,7 @@ var U = {
|
|
|
492
492
|
n.aborted || (t.controller.abort(), d.current = null, c(e instanceof Error ? e.message : f.current.errorLabel), o("error"));
|
|
493
493
|
}, S = () => {
|
|
494
494
|
if (!a || n.aborted) return;
|
|
495
|
-
let e =
|
|
495
|
+
let e = Qe.find((e) => MediaRecorder.isTypeSupported(e)), t = new MediaRecorder(a, e ? { mimeType: e } : void 0);
|
|
496
496
|
p = t;
|
|
497
497
|
let s = Date.now(), c = !1, d = !1, S = new Uint8Array(l.current?.fftSize ?? 256), C = async () => {
|
|
498
498
|
if (!(g || n.aborted)) {
|
|
@@ -500,7 +500,7 @@ var U = {
|
|
|
500
500
|
try {
|
|
501
501
|
let a = t.mimeType || e || "audio/webm", l = new Blob(_, { type: a });
|
|
502
502
|
_.length = 0, y();
|
|
503
|
-
let p = Date.now() - s >=
|
|
503
|
+
let p = Date.now() - s >= et;
|
|
504
504
|
if (l.size && (!i || p && (!c || d))) {
|
|
505
505
|
let e = u(a), t = r[e] ?? e.split("/")[1] ?? "webm", s = new File([l], "voice-" + crypto.randomUUID() + "." + t, { type: a });
|
|
506
506
|
if (i) {
|
|
@@ -526,8 +526,8 @@ var U = {
|
|
|
526
526
|
e.getByteTimeDomainData(S), c = !0;
|
|
527
527
|
let t = 0;
|
|
528
528
|
for (let e of S) t += ((e - 128) / 128) ** 2;
|
|
529
|
-
Math.sqrt(t / S.length) >=
|
|
530
|
-
},
|
|
529
|
+
Math.sqrt(t / S.length) >= tt && (d = !0, v());
|
|
530
|
+
}, $e));
|
|
531
531
|
};
|
|
532
532
|
t.stop = () => {
|
|
533
533
|
h || n.aborted || (h = !0, v(), o("processing"), p?.state === "recording" && p.stop());
|
|
@@ -545,10 +545,10 @@ var U = {
|
|
|
545
545
|
x(e);
|
|
546
546
|
}
|
|
547
547
|
})();
|
|
548
|
-
}, []), m =
|
|
548
|
+
}, []), m = z(() => d.current?.stop?.(), []), h = z(() => {
|
|
549
549
|
d.current?.controller.abort(), d.current = null, c(null), o("idle");
|
|
550
550
|
}, []);
|
|
551
|
-
return
|
|
551
|
+
return B(() => () => {
|
|
552
552
|
d.current?.controller.abort(), d.current = null;
|
|
553
553
|
}, []), {
|
|
554
554
|
state: a,
|
|
@@ -558,14 +558,14 @@ var U = {
|
|
|
558
558
|
stopRecording: m,
|
|
559
559
|
discardRecording: h
|
|
560
560
|
};
|
|
561
|
-
},
|
|
561
|
+
}, rt = /* @__PURE__ */ function(e) {
|
|
562
562
|
return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
|
|
563
|
-
}({}),
|
|
563
|
+
}({}), it = /* @__PURE__ */ function(e) {
|
|
564
564
|
return e.Stacked = "stacked", e.Inline = "inline", e;
|
|
565
|
-
}({}),
|
|
565
|
+
}({}), at = {
|
|
566
566
|
item: "_item_1sr2n_1",
|
|
567
567
|
itemIcon: "_itemIcon_1sr2n_11"
|
|
568
|
-
},
|
|
568
|
+
}, ot = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: a, className: o, titleClassName: s = "dial-body-semi-text", itemLabelClassName: u = "dial-small-text", btnTextClassName: d = "", colors: f }) => {
|
|
569
569
|
let p = (e) => {
|
|
570
570
|
e(), r();
|
|
571
571
|
}, h = c({
|
|
@@ -574,7 +574,7 @@ var U = {
|
|
|
574
574
|
"--ci-sheet-item-active": f?.itemActiveBg,
|
|
575
575
|
"--ci-sheet-icon": f?.itemIcon
|
|
576
576
|
});
|
|
577
|
-
return /* @__PURE__ */
|
|
577
|
+
return /* @__PURE__ */ I(G, {
|
|
578
578
|
isOpen: e,
|
|
579
579
|
title: t,
|
|
580
580
|
closeLabel: n,
|
|
@@ -583,23 +583,23 @@ var U = {
|
|
|
583
583
|
className: o,
|
|
584
584
|
titleClassName: s,
|
|
585
585
|
colors: f?.shell,
|
|
586
|
-
children: /* @__PURE__ */
|
|
586
|
+
children: /* @__PURE__ */ I("ul", {
|
|
587
587
|
role: "list",
|
|
588
588
|
className: "flex flex-col",
|
|
589
589
|
style: h,
|
|
590
|
-
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */
|
|
590
|
+
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ I("li", { children: /* @__PURE__ */ I(m, {
|
|
591
591
|
type: "button",
|
|
592
|
-
className: l(
|
|
593
|
-
iconBefore: /* @__PURE__ */
|
|
594
|
-
className:
|
|
592
|
+
className: l(at.item, "w-full gap-3 px-4 py-[10px] text-start"),
|
|
593
|
+
iconBefore: /* @__PURE__ */ I("span", {
|
|
594
|
+
className: at.itemIcon,
|
|
595
595
|
children: n
|
|
596
596
|
}),
|
|
597
|
-
iconAfter: r ? /* @__PURE__ */
|
|
597
|
+
iconAfter: r ? /* @__PURE__ */ I("span", {
|
|
598
598
|
className: "ms-auto",
|
|
599
599
|
children: r
|
|
600
600
|
}) : null,
|
|
601
601
|
textClassName: d,
|
|
602
|
-
label: /* @__PURE__ */
|
|
602
|
+
label: /* @__PURE__ */ I("span", {
|
|
603
603
|
className: u,
|
|
604
604
|
children: t
|
|
605
605
|
}),
|
|
@@ -607,9 +607,9 @@ var U = {
|
|
|
607
607
|
}) }, e))
|
|
608
608
|
})
|
|
609
609
|
});
|
|
610
|
-
},
|
|
611
|
-
let [s, c] =
|
|
612
|
-
|
|
610
|
+
}, st = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
611
|
+
let [s, c] = U(t), [l, u] = U(n), [d, f] = U(r), p = H(o);
|
|
612
|
+
B(() => {
|
|
613
613
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
614
614
|
}, [
|
|
615
615
|
o,
|
|
@@ -626,7 +626,7 @@ var U = {
|
|
|
626
626
|
setResponseFormat: c,
|
|
627
627
|
setSystemPrompt: u,
|
|
628
628
|
setTemperature: f,
|
|
629
|
-
handleSubmit:
|
|
629
|
+
handleSubmit: z(() => {
|
|
630
630
|
if (!m) return;
|
|
631
631
|
let t = {};
|
|
632
632
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -640,17 +640,17 @@ var U = {
|
|
|
640
640
|
a
|
|
641
641
|
])
|
|
642
642
|
};
|
|
643
|
-
},
|
|
643
|
+
}, ct = { label: "_label_14i7c_1" }, lt = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: a, onSystemPromptChange: s, onTemperatureChange: u, responseFormatLabel: d = "Response format", responseFormatHint: f = "Applies to new and existing messages", responseFormatMarkdownLabel: p = "Markdown", responseFormatPlainTextLabel: m = "Plain text", systemPromptLabel: h = "System prompt", systemPromptTooltip: g = "Enter a prompt", temperatureLabel: _ = "Temperature", temperatureLabels: v = [
|
|
644
644
|
"Precise",
|
|
645
645
|
"Neutral",
|
|
646
646
|
"Creative"
|
|
647
647
|
], temperatureHint: y, labelClassName: b = "!dial-small-semi-text", colors: x }) => {
|
|
648
|
-
let S = c({ "--csf-label-text": x?.labelText }), C = l(b,
|
|
649
|
-
return /* @__PURE__ */
|
|
648
|
+
let S = c({ "--csf-label-text": x?.labelText }), C = l(b, ct.label, "gap-1");
|
|
649
|
+
return /* @__PURE__ */ L("div", {
|
|
650
650
|
className: "flex flex-col gap-4 px-6 pb-3",
|
|
651
651
|
style: S,
|
|
652
652
|
children: [
|
|
653
|
-
e.responseFormat && /* @__PURE__ */
|
|
653
|
+
e.responseFormat && /* @__PURE__ */ I(ee, {
|
|
654
654
|
id: "response-format",
|
|
655
655
|
labelProps: {
|
|
656
656
|
label: d,
|
|
@@ -658,7 +658,7 @@ var U = {
|
|
|
658
658
|
caption: f
|
|
659
659
|
},
|
|
660
660
|
optionsClassName: "mb-2",
|
|
661
|
-
orientation:
|
|
661
|
+
orientation: te.Column,
|
|
662
662
|
value: t ?? o.Markdown,
|
|
663
663
|
items: [{
|
|
664
664
|
value: o.Markdown,
|
|
@@ -669,18 +669,18 @@ var U = {
|
|
|
669
669
|
}],
|
|
670
670
|
onChange: (e) => a(e)
|
|
671
671
|
}),
|
|
672
|
-
e.systemPrompt && /* @__PURE__ */
|
|
672
|
+
e.systemPrompt && /* @__PURE__ */ I(F, {
|
|
673
673
|
value: n,
|
|
674
674
|
placeholder: g,
|
|
675
675
|
className: i,
|
|
676
|
-
resize:
|
|
676
|
+
resize: oe.Vertical,
|
|
677
677
|
labelProps: {
|
|
678
678
|
className: C,
|
|
679
679
|
label: h
|
|
680
680
|
},
|
|
681
681
|
onChange: (e) => s(e ?? "")
|
|
682
682
|
}),
|
|
683
|
-
e.temperature && /* @__PURE__ */ P
|
|
683
|
+
e.temperature && /* @__PURE__ */ I(P, {
|
|
684
684
|
labelProps: {
|
|
685
685
|
label: _,
|
|
686
686
|
className: C,
|
|
@@ -697,8 +697,8 @@ var U = {
|
|
|
697
697
|
})
|
|
698
698
|
]
|
|
699
699
|
});
|
|
700
|
-
},
|
|
701
|
-
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat:
|
|
700
|
+
}, ut = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: o, initialResponseFormat: s, initialSystemPrompt: c, initialTemperature: u, onSave: d, title: f = "Chat settings", responseFormatLabel: p, responseFormatHint: m, responseFormatMarkdownLabel: h, responseFormatPlainTextLabel: g, systemPromptLabel: _, systemPromptTooltip: v, temperatureLabel: y, temperatureLabels: b, temperatureHint: x, saveLabel: S = "Apply changes", saveDisabledTooltip: C }) => {
|
|
701
|
+
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: O, setSystemPrompt: k, setTemperature: A, handleSubmit: j } = st({
|
|
702
702
|
isOpen: e,
|
|
703
703
|
features: o,
|
|
704
704
|
initialResponseFormat: s,
|
|
@@ -707,7 +707,7 @@ var U = {
|
|
|
707
707
|
onSave: d,
|
|
708
708
|
onClose: r
|
|
709
709
|
});
|
|
710
|
-
return /* @__PURE__ */
|
|
710
|
+
return /* @__PURE__ */ L(G, {
|
|
711
711
|
isOpen: e,
|
|
712
712
|
title: f,
|
|
713
713
|
closeLabel: i,
|
|
@@ -715,14 +715,14 @@ var U = {
|
|
|
715
715
|
onBack: t,
|
|
716
716
|
backLabel: n,
|
|
717
717
|
style: a,
|
|
718
|
-
children: [/* @__PURE__ */
|
|
718
|
+
children: [/* @__PURE__ */ I(lt, {
|
|
719
719
|
features: o,
|
|
720
720
|
responseFormat: w,
|
|
721
721
|
systemPrompt: T,
|
|
722
722
|
temperature: E,
|
|
723
|
-
onResponseFormatChange:
|
|
723
|
+
onResponseFormatChange: O,
|
|
724
724
|
onSystemPromptChange: k,
|
|
725
|
-
onTemperatureChange:
|
|
725
|
+
onTemperatureChange: A,
|
|
726
726
|
responseFormatLabel: p,
|
|
727
727
|
responseFormatHint: m,
|
|
728
728
|
responseFormatMarkdownLabel: h,
|
|
@@ -732,23 +732,23 @@ var U = {
|
|
|
732
732
|
temperatureLabel: y,
|
|
733
733
|
temperatureLabels: b,
|
|
734
734
|
temperatureHint: x
|
|
735
|
-
}), /* @__PURE__ */
|
|
735
|
+
}), /* @__PURE__ */ I("div", {
|
|
736
736
|
className: l("px-6 py-4 mobile:pb-8"),
|
|
737
|
-
children: /* @__PURE__ */
|
|
737
|
+
children: /* @__PURE__ */ I(se, {
|
|
738
738
|
tooltip: C,
|
|
739
739
|
hideTooltip: D || !C,
|
|
740
740
|
triggerClassName: "w-full",
|
|
741
|
-
children: /* @__PURE__ */
|
|
741
|
+
children: /* @__PURE__ */ I(M, {
|
|
742
742
|
label: S,
|
|
743
|
-
onClick:
|
|
743
|
+
onClick: j,
|
|
744
744
|
disabled: !D,
|
|
745
745
|
className: "w-full"
|
|
746
746
|
})
|
|
747
747
|
})
|
|
748
748
|
})]
|
|
749
749
|
});
|
|
750
|
-
},
|
|
751
|
-
let { responseFormat: x, systemPrompt: S, temperature: C, canSubmit: w, setResponseFormat: T, setSystemPrompt: E, setTemperature:
|
|
750
|
+
}, dt = { modal: "_modal_kl0h0_1" }, K = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", titleClassName: s = "dial-h1-text", responseFormatLabel: c, responseFormatHint: l, responseFormatMarkdownLabel: u, responseFormatPlainTextLabel: d, systemPromptLabel: f, systemPromptTooltip: p, temperatureLabel: m, temperatureLabels: g, temperatureHint: _, saveLabel: v = "Apply changes", saveDisabledTooltip: y, backgroundClassName: b = dt.modal }) => {
|
|
751
|
+
let { responseFormat: x, systemPrompt: S, temperature: C, canSubmit: w, setResponseFormat: T, setSystemPrompt: E, setTemperature: D, handleSubmit: O } = st({
|
|
752
752
|
features: e,
|
|
753
753
|
initialResponseFormat: t,
|
|
754
754
|
initialSystemPrompt: n,
|
|
@@ -756,31 +756,31 @@ var U = {
|
|
|
756
756
|
onSave: i,
|
|
757
757
|
onClose: a
|
|
758
758
|
});
|
|
759
|
-
return /* @__PURE__ */
|
|
759
|
+
return /* @__PURE__ */ I(A, {
|
|
760
760
|
open: !0,
|
|
761
761
|
header: o,
|
|
762
762
|
titleClassName: s,
|
|
763
|
-
size:
|
|
763
|
+
size: j.Sm,
|
|
764
764
|
onClose: a,
|
|
765
765
|
className: b,
|
|
766
766
|
mainButtons: [{
|
|
767
767
|
label: v,
|
|
768
768
|
variant: h.Primary,
|
|
769
|
-
onClick:
|
|
769
|
+
onClick: O,
|
|
770
770
|
disabled: !w,
|
|
771
771
|
tooltipProps: y ? {
|
|
772
772
|
tooltip: y,
|
|
773
773
|
hideTooltip: w
|
|
774
774
|
} : void 0
|
|
775
775
|
}],
|
|
776
|
-
children: /* @__PURE__ */
|
|
776
|
+
children: /* @__PURE__ */ I(lt, {
|
|
777
777
|
features: e,
|
|
778
778
|
responseFormat: x,
|
|
779
779
|
systemPrompt: S,
|
|
780
780
|
temperature: C,
|
|
781
781
|
onResponseFormatChange: T,
|
|
782
782
|
onSystemPromptChange: E,
|
|
783
|
-
onTemperatureChange:
|
|
783
|
+
onTemperatureChange: D,
|
|
784
784
|
responseFormatLabel: c,
|
|
785
785
|
responseFormatHint: l,
|
|
786
786
|
responseFormatMarkdownLabel: u,
|
|
@@ -792,15 +792,15 @@ var U = {
|
|
|
792
792
|
temperatureHint: _
|
|
793
793
|
})
|
|
794
794
|
});
|
|
795
|
-
},
|
|
795
|
+
}, ft = {
|
|
796
796
|
icon: "_icon_1fv6z_1",
|
|
797
797
|
selectedIcon: "_selectedIcon_1fv6z_5"
|
|
798
|
-
},
|
|
798
|
+
}, pt = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: a, title: o = "Tools", items: s, onToolToggle: u, itemLabelClassName: d = "dial-small-text", colors: p }) => {
|
|
799
799
|
let h = c({
|
|
800
800
|
"--tbs-icon-text": p?.iconText,
|
|
801
801
|
"--tbs-selected-icon-text": p?.selectedIconText
|
|
802
802
|
});
|
|
803
|
-
return /* @__PURE__ */
|
|
803
|
+
return /* @__PURE__ */ I(G, {
|
|
804
804
|
isOpen: e,
|
|
805
805
|
title: o,
|
|
806
806
|
closeLabel: i,
|
|
@@ -808,30 +808,30 @@ var U = {
|
|
|
808
808
|
onBack: t,
|
|
809
809
|
backLabel: n,
|
|
810
810
|
style: a,
|
|
811
|
-
children: /* @__PURE__ */
|
|
811
|
+
children: /* @__PURE__ */ I("ul", {
|
|
812
812
|
role: "menu",
|
|
813
813
|
className: "flex flex-col pb-4",
|
|
814
814
|
style: h,
|
|
815
|
-
children: s.map((e) => /* @__PURE__ */
|
|
815
|
+
children: s.map((e) => /* @__PURE__ */ I("li", {
|
|
816
816
|
role: "none",
|
|
817
|
-
children: /* @__PURE__ */
|
|
817
|
+
children: /* @__PURE__ */ I(m, {
|
|
818
818
|
type: "button",
|
|
819
819
|
role: "menuitemcheckbox",
|
|
820
820
|
"aria-checked": e.isSelected,
|
|
821
821
|
className: "w-full gap-3 px-4 py-[10px] text-start",
|
|
822
|
-
iconBefore: /* @__PURE__ */
|
|
823
|
-
className: l("flex items-center",
|
|
822
|
+
iconBefore: /* @__PURE__ */ I("span", {
|
|
823
|
+
className: l("flex items-center", ft.icon),
|
|
824
824
|
children: e.icon
|
|
825
825
|
}),
|
|
826
|
-
iconAfter: e.isSelected ? /* @__PURE__ */
|
|
827
|
-
className: l("ms-auto",
|
|
828
|
-
children: /* @__PURE__ */
|
|
826
|
+
iconAfter: e.isSelected ? /* @__PURE__ */ I("span", {
|
|
827
|
+
className: l("ms-auto", ft.selectedIcon),
|
|
828
|
+
children: /* @__PURE__ */ I(me, {
|
|
829
829
|
size: f,
|
|
830
830
|
"aria-hidden": !0,
|
|
831
831
|
stroke: v
|
|
832
832
|
})
|
|
833
833
|
}) : null,
|
|
834
|
-
label: /* @__PURE__ */
|
|
834
|
+
label: /* @__PURE__ */ I("span", {
|
|
835
835
|
className: d,
|
|
836
836
|
children: e.label
|
|
837
837
|
}),
|
|
@@ -840,19 +840,19 @@ var U = {
|
|
|
840
840
|
}, e.id))
|
|
841
841
|
})
|
|
842
842
|
});
|
|
843
|
-
},
|
|
843
|
+
}, mt = {
|
|
844
844
|
toolIcon: "_toolIcon_ma5s5_1",
|
|
845
845
|
chevronIcon: "_chevronIcon_ma5s5_5"
|
|
846
|
-
},
|
|
847
|
-
let
|
|
848
|
-
"--aab-tool-icon":
|
|
849
|
-
"--aab-chevron-icon":
|
|
850
|
-
}), [
|
|
846
|
+
}, ht = ({ onAttachClick: e, onRecordVoice: t, recordVoiceLabel: n = "Record voice", attachLabel: r, addMenuTitle: i, menuTitle: a, menuCloseLabel: s, style: u, listClassName: p = "w-[240px]", isDisabled: m = !1, chatSettings: h, extraMenuItems: g, toolsMenuItems: x = [], onToolToggle: C, toolsMenuTitle: T = "Tools", toolsBackLabel: E = "Back", menuOverlays: D, getCaretPosition: O, colors: k }) => {
|
|
847
|
+
let A = d(), [j, M] = U(!1), [N, ee] = U(!1), [te, ne] = U(!1), [re, ie] = U(null), [P, ae] = U(!1), F = V(() => c({
|
|
848
|
+
"--aab-tool-icon": k?.toolIcon,
|
|
849
|
+
"--aab-chevron-icon": k?.chevronIcon
|
|
850
|
+
}), [k?.toolIcon, k?.chevronIcon]), oe = x.length > 0 && C != null, se = D != null && D.length > 0, le = V(() => x.map((e) => ({
|
|
851
851
|
key: e.id,
|
|
852
852
|
label: e.label,
|
|
853
|
-
icon: /* @__PURE__ */
|
|
854
|
-
style:
|
|
855
|
-
className: l("flex items-center",
|
|
853
|
+
icon: /* @__PURE__ */ I("span", {
|
|
854
|
+
style: F,
|
|
855
|
+
className: l("flex items-center", mt.toolIcon),
|
|
856
856
|
children: e.icon
|
|
857
857
|
}),
|
|
858
858
|
selectable: !0,
|
|
@@ -862,12 +862,12 @@ var U = {
|
|
|
862
862
|
})), [
|
|
863
863
|
x,
|
|
864
864
|
C,
|
|
865
|
-
|
|
866
|
-
]),
|
|
865
|
+
F
|
|
866
|
+
]), ue = V(() => [
|
|
867
867
|
...e == null ? [] : [{
|
|
868
868
|
key: "attach",
|
|
869
869
|
label: r,
|
|
870
|
-
icon: /* @__PURE__ */
|
|
870
|
+
icon: /* @__PURE__ */ I(ve, {
|
|
871
871
|
size: f,
|
|
872
872
|
"aria-hidden": !0,
|
|
873
873
|
stroke: v
|
|
@@ -875,74 +875,74 @@ var U = {
|
|
|
875
875
|
onClick: e
|
|
876
876
|
}],
|
|
877
877
|
...g ?? [],
|
|
878
|
-
...
|
|
878
|
+
...oe ? [{
|
|
879
879
|
key: "tools",
|
|
880
880
|
label: T,
|
|
881
|
-
icon: /* @__PURE__ */
|
|
881
|
+
icon: /* @__PURE__ */ I(Se, {
|
|
882
882
|
size: f,
|
|
883
883
|
"aria-hidden": !0,
|
|
884
884
|
stroke: v
|
|
885
885
|
}),
|
|
886
|
-
onClick:
|
|
887
|
-
|
|
886
|
+
onClick: A ? () => {
|
|
887
|
+
ne(!0), M(!1);
|
|
888
888
|
} : () => void 0,
|
|
889
|
-
...
|
|
889
|
+
...A ? { iconAfter: /* @__PURE__ */ I(R, {
|
|
890
890
|
size: f,
|
|
891
891
|
stroke: v,
|
|
892
|
-
style:
|
|
893
|
-
className: l("rtl:scale-x-[-1]",
|
|
892
|
+
style: F,
|
|
893
|
+
className: l("rtl:scale-x-[-1]", mt.chevronIcon),
|
|
894
894
|
"aria-hidden": !0
|
|
895
|
-
}) } : { children:
|
|
895
|
+
}) } : { children: le }
|
|
896
896
|
}] : [],
|
|
897
897
|
...(D ?? []).map((e) => ({
|
|
898
898
|
key: e.key,
|
|
899
899
|
label: e.title,
|
|
900
900
|
icon: e.icon,
|
|
901
|
-
onClick:
|
|
902
|
-
|
|
901
|
+
onClick: A ? () => {
|
|
902
|
+
ie(e.key), M(!1);
|
|
903
903
|
} : () => void 0,
|
|
904
|
-
...
|
|
904
|
+
...A ? { iconAfter: /* @__PURE__ */ I(R, {
|
|
905
905
|
size: f,
|
|
906
906
|
stroke: v,
|
|
907
|
-
style:
|
|
908
|
-
className: l("rtl:scale-x-[-1]",
|
|
907
|
+
style: F,
|
|
908
|
+
className: l("rtl:scale-x-[-1]", mt.chevronIcon),
|
|
909
909
|
"aria-hidden": !0
|
|
910
910
|
}) } : {
|
|
911
911
|
children: [{
|
|
912
912
|
key: `${e.key}-panel`,
|
|
913
913
|
label: ""
|
|
914
914
|
}],
|
|
915
|
-
renderSubMenu: () => e.renderOverlay(() =>
|
|
915
|
+
renderSubMenu: () => e.renderOverlay(() => ae(!1), O?.() ?? 0)
|
|
916
916
|
}
|
|
917
917
|
})),
|
|
918
918
|
...t == null ? [] : [{
|
|
919
919
|
key: "record-voice",
|
|
920
920
|
label: n,
|
|
921
|
-
icon: /* @__PURE__ */
|
|
921
|
+
icon: /* @__PURE__ */ I(_e, {
|
|
922
922
|
size: f,
|
|
923
923
|
"aria-hidden": !0,
|
|
924
924
|
stroke: v
|
|
925
925
|
}),
|
|
926
926
|
onClick: () => {
|
|
927
|
-
|
|
927
|
+
M(!1), ae(!1), t();
|
|
928
928
|
}
|
|
929
929
|
}],
|
|
930
930
|
...h == null ? [] : [{
|
|
931
931
|
key: "chat-settings",
|
|
932
932
|
label: h.menuItemLabel ?? "Chat settings",
|
|
933
|
-
icon: /* @__PURE__ */
|
|
933
|
+
icon: /* @__PURE__ */ I(xe, {
|
|
934
934
|
size: f,
|
|
935
935
|
"aria-hidden": !0,
|
|
936
936
|
stroke: v
|
|
937
937
|
}),
|
|
938
|
-
iconAfter:
|
|
938
|
+
iconAfter: A ? /* @__PURE__ */ I(R, {
|
|
939
939
|
size: f,
|
|
940
940
|
stroke: v,
|
|
941
|
-
style:
|
|
942
|
-
className: l("rtl:scale-x-[-1]",
|
|
941
|
+
style: F,
|
|
942
|
+
className: l("rtl:scale-x-[-1]", mt.chevronIcon),
|
|
943
943
|
"aria-hidden": !0
|
|
944
944
|
}) : null,
|
|
945
|
-
onClick: () =>
|
|
945
|
+
onClick: () => ee(!0)
|
|
946
946
|
}]
|
|
947
947
|
], [
|
|
948
948
|
r,
|
|
@@ -951,26 +951,26 @@ var U = {
|
|
|
951
951
|
n,
|
|
952
952
|
h,
|
|
953
953
|
g,
|
|
954
|
-
|
|
955
|
-
|
|
954
|
+
A,
|
|
955
|
+
oe,
|
|
956
956
|
T,
|
|
957
|
-
|
|
957
|
+
le,
|
|
958
958
|
D,
|
|
959
|
-
|
|
960
|
-
|
|
959
|
+
O,
|
|
960
|
+
F
|
|
961
961
|
]);
|
|
962
|
-
if (
|
|
963
|
-
let
|
|
962
|
+
if (ue.length === 0) return null;
|
|
963
|
+
let de = /* @__PURE__ */ I(y, {
|
|
964
964
|
matchReferenceWidth: !1,
|
|
965
965
|
placement: "bottom-start",
|
|
966
966
|
listClassName: p,
|
|
967
967
|
overlayContentClassName: "flex flex-col gap-1",
|
|
968
|
-
items:
|
|
968
|
+
items: ue,
|
|
969
969
|
disabled: m,
|
|
970
|
-
open:
|
|
971
|
-
onOpenChange:
|
|
972
|
-
children: /* @__PURE__ */
|
|
973
|
-
icon: /* @__PURE__ */
|
|
970
|
+
open: se ? P : void 0,
|
|
971
|
+
onOpenChange: se ? ae : void 0,
|
|
972
|
+
children: /* @__PURE__ */ I(S, {
|
|
973
|
+
icon: /* @__PURE__ */ I(be, {
|
|
974
974
|
size: _.LG,
|
|
975
975
|
"aria-hidden": !0,
|
|
976
976
|
stroke: v
|
|
@@ -980,9 +980,9 @@ var U = {
|
|
|
980
980
|
disabled: m
|
|
981
981
|
})
|
|
982
982
|
});
|
|
983
|
-
return /* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
985
|
-
icon: /* @__PURE__ */
|
|
983
|
+
return /* @__PURE__ */ I(ce, { children: A ? /* @__PURE__ */ L(ce, { children: [
|
|
984
|
+
/* @__PURE__ */ I(S, {
|
|
985
|
+
icon: /* @__PURE__ */ I(be, {
|
|
986
986
|
size: _.LG,
|
|
987
987
|
"aria-hidden": !0,
|
|
988
988
|
stroke: v
|
|
@@ -991,54 +991,54 @@ var U = {
|
|
|
991
991
|
size: b.Large,
|
|
992
992
|
tooltipProps: { tooltip: i },
|
|
993
993
|
disabled: m,
|
|
994
|
-
onClick: () =>
|
|
994
|
+
onClick: () => M(!0)
|
|
995
995
|
}),
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
isOpen:
|
|
996
|
+
/* @__PURE__ */ I(ot, {
|
|
997
|
+
isOpen: j,
|
|
998
998
|
title: a,
|
|
999
999
|
closeLabel: s,
|
|
1000
|
-
onClose: () =>
|
|
1000
|
+
onClose: () => M(!1),
|
|
1001
1001
|
style: u,
|
|
1002
|
-
items:
|
|
1002
|
+
items: ue,
|
|
1003
1003
|
className: "pb-4",
|
|
1004
1004
|
btnTextClassName: "flex-1"
|
|
1005
1005
|
}),
|
|
1006
|
-
|
|
1007
|
-
isOpen:
|
|
1006
|
+
oe && /* @__PURE__ */ I(pt, {
|
|
1007
|
+
isOpen: te,
|
|
1008
1008
|
onBack: () => {
|
|
1009
|
-
|
|
1009
|
+
ne(!1), M(!0);
|
|
1010
1010
|
},
|
|
1011
1011
|
backLabel: E,
|
|
1012
|
-
onClose: () =>
|
|
1012
|
+
onClose: () => ne(!1),
|
|
1013
1013
|
closeLabel: s,
|
|
1014
1014
|
style: u,
|
|
1015
1015
|
title: T,
|
|
1016
1016
|
items: x,
|
|
1017
1017
|
onToolToggle: C
|
|
1018
1018
|
}),
|
|
1019
|
-
D?.map((e) => /* @__PURE__ */
|
|
1020
|
-
isOpen:
|
|
1019
|
+
D?.map((e) => /* @__PURE__ */ I(G, {
|
|
1020
|
+
isOpen: re === e.key,
|
|
1021
1021
|
title: e.title,
|
|
1022
1022
|
closeLabel: s,
|
|
1023
1023
|
onBack: () => {
|
|
1024
|
-
|
|
1024
|
+
ie(null), M(!0);
|
|
1025
1025
|
},
|
|
1026
1026
|
backLabel: e.backLabel ?? "Back",
|
|
1027
|
-
onClose: () =>
|
|
1027
|
+
onClose: () => ie(null),
|
|
1028
1028
|
style: u,
|
|
1029
|
-
children: /* @__PURE__ */
|
|
1029
|
+
children: /* @__PURE__ */ I("div", {
|
|
1030
1030
|
role: "menu",
|
|
1031
1031
|
"aria-label": e.title,
|
|
1032
|
-
children: e.renderOverlay(() =>
|
|
1032
|
+
children: e.renderOverlay(() => ie(null), O?.() ?? 0)
|
|
1033
1033
|
})
|
|
1034
1034
|
}, e.key)),
|
|
1035
|
-
h != null && /* @__PURE__ */
|
|
1036
|
-
isOpen:
|
|
1035
|
+
h != null && /* @__PURE__ */ I(ut, {
|
|
1036
|
+
isOpen: N,
|
|
1037
1037
|
onBack: () => {
|
|
1038
|
-
|
|
1038
|
+
ee(!1), M(!0);
|
|
1039
1039
|
},
|
|
1040
1040
|
backLabel: h.backLabel ?? "Back",
|
|
1041
|
-
onClose: () =>
|
|
1041
|
+
onClose: () => ee(!1),
|
|
1042
1042
|
closeLabel: s,
|
|
1043
1043
|
style: u,
|
|
1044
1044
|
features: h.features,
|
|
@@ -1059,13 +1059,13 @@ var U = {
|
|
|
1059
1059
|
saveLabel: h.saveLabel,
|
|
1060
1060
|
saveDisabledTooltip: h.saveDisabledTooltip
|
|
1061
1061
|
})
|
|
1062
|
-
] }) : /* @__PURE__ */
|
|
1062
|
+
] }) : /* @__PURE__ */ L(ce, { children: [de, h != null && N && /* @__PURE__ */ I(K, {
|
|
1063
1063
|
features: h.features,
|
|
1064
1064
|
initialResponseFormat: h.responseFormat ?? o.Markdown,
|
|
1065
1065
|
initialSystemPrompt: h.systemPrompt,
|
|
1066
1066
|
initialTemperature: h.temperature,
|
|
1067
1067
|
onSave: h.onSave,
|
|
1068
|
-
onClose: () =>
|
|
1068
|
+
onClose: () => ee(!1),
|
|
1069
1069
|
title: h.title,
|
|
1070
1070
|
responseFormatLabel: h.responseFormatLabel,
|
|
1071
1071
|
responseFormatHint: h.responseFormatHint,
|
|
@@ -1079,14 +1079,14 @@ var U = {
|
|
|
1079
1079
|
saveLabel: h.saveLabel,
|
|
1080
1080
|
saveDisabledTooltip: h.saveDisabledTooltip
|
|
1081
1081
|
})] }) });
|
|
1082
|
-
},
|
|
1082
|
+
}, gt = {
|
|
1083
1083
|
chip: "_chip_1lvv5_1",
|
|
1084
1084
|
chipSelected: "_chipSelected_1lvv5_9",
|
|
1085
1085
|
chipIcon: "_chipIcon_1lvv5_16",
|
|
1086
1086
|
chipText: "_chipText_1lvv5_19",
|
|
1087
1087
|
chipState: "_chipState_1lvv5_22",
|
|
1088
1088
|
chipClose: "_chipClose_1lvv5_25"
|
|
1089
|
-
},
|
|
1089
|
+
}, _t = (e) => `Remove ${e}`, vt = ({ items: e, onToolToggle: t, onToolDismiss: n, canRemove: r = !0, removeLabel: i = _t, stateOnLabel: a, stateOffLabel: o, typography: s, colors: u }) => {
|
|
1090
1090
|
if (e.length === 0) return null;
|
|
1091
1091
|
let d = !!(a && o), f = c({
|
|
1092
1092
|
"--ci-chip-bg": u?.chipBg,
|
|
@@ -1102,41 +1102,41 @@ var U = {
|
|
|
1102
1102
|
"--ci-chip-close": u?.chipClose,
|
|
1103
1103
|
"--ci-chip-close-hover": u?.chipCloseHover
|
|
1104
1104
|
});
|
|
1105
|
-
return /* @__PURE__ */
|
|
1105
|
+
return /* @__PURE__ */ I("div", {
|
|
1106
1106
|
className: "flex flex-wrap items-center gap-2",
|
|
1107
1107
|
style: f,
|
|
1108
|
-
children: e.map((e) => /* @__PURE__ */
|
|
1109
|
-
className: l(
|
|
1110
|
-
children: [/* @__PURE__ */
|
|
1108
|
+
children: e.map((e) => /* @__PURE__ */ L("div", {
|
|
1109
|
+
className: l(gt.chip, e.isSelected && gt.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 transition-colors", r ? "ps-2 pe-1" : "px-2"),
|
|
1110
|
+
children: [/* @__PURE__ */ L("button", {
|
|
1111
1111
|
type: "button",
|
|
1112
1112
|
onClick: () => t(e.id),
|
|
1113
1113
|
"aria-pressed": e.isSelected,
|
|
1114
1114
|
className: "flex min-w-0 items-center gap-1.5",
|
|
1115
1115
|
children: [
|
|
1116
|
-
/* @__PURE__ */
|
|
1117
|
-
className: l(
|
|
1116
|
+
/* @__PURE__ */ I("span", {
|
|
1117
|
+
className: l(gt.chipIcon, "shrink-0"),
|
|
1118
1118
|
"aria-hidden": !0,
|
|
1119
1119
|
children: e.icon
|
|
1120
1120
|
}),
|
|
1121
|
-
/* @__PURE__ */
|
|
1122
|
-
className: l(
|
|
1123
|
-
children: [e.label, d && /* @__PURE__ */
|
|
1121
|
+
/* @__PURE__ */ L("span", {
|
|
1122
|
+
className: l(gt.chipText, s?.fontClassName || "dial-small-paragraph-text", "truncate"),
|
|
1123
|
+
children: [e.label, d && /* @__PURE__ */ I("span", {
|
|
1124
1124
|
"aria-hidden": !0,
|
|
1125
1125
|
children: ":"
|
|
1126
1126
|
})]
|
|
1127
1127
|
}),
|
|
1128
|
-
d && /* @__PURE__ */
|
|
1129
|
-
className: l(
|
|
1128
|
+
d && /* @__PURE__ */ I("span", {
|
|
1129
|
+
className: l(gt.chipState, s?.fontClassName || "dial-small-paragraph-text", "ms-1 shrink-0 tracking-wider uppercase"),
|
|
1130
1130
|
"aria-hidden": !0,
|
|
1131
1131
|
children: e.isSelected ? a : o
|
|
1132
1132
|
})
|
|
1133
1133
|
]
|
|
1134
|
-
}), r && /* @__PURE__ */
|
|
1134
|
+
}), r && /* @__PURE__ */ I("button", {
|
|
1135
1135
|
type: "button",
|
|
1136
1136
|
onClick: () => n(e.id),
|
|
1137
1137
|
"aria-label": i(e.label),
|
|
1138
|
-
className: l(
|
|
1139
|
-
children: /* @__PURE__ */
|
|
1138
|
+
className: l(gt.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
|
|
1139
|
+
children: /* @__PURE__ */ I(Ce, {
|
|
1140
1140
|
size: 12,
|
|
1141
1141
|
"aria-hidden": !0,
|
|
1142
1142
|
stroke: v
|
|
@@ -1144,7 +1144,7 @@ var U = {
|
|
|
1144
1144
|
})]
|
|
1145
1145
|
}, e.id))
|
|
1146
1146
|
});
|
|
1147
|
-
},
|
|
1147
|
+
}, q = {
|
|
1148
1148
|
wrapper: "_wrapper_19a9k_2",
|
|
1149
1149
|
wrapperDisabled: "_wrapperDisabled_19a9k_9",
|
|
1150
1150
|
textarea: "_textarea_19a9k_13",
|
|
@@ -1157,33 +1157,33 @@ var U = {
|
|
|
1157
1157
|
modelSelectorName: "_modelSelectorName_19a9k_72",
|
|
1158
1158
|
modelSelectorVersion: "_modelSelectorVersion_19a9k_75",
|
|
1159
1159
|
modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_19a9k_84"
|
|
1160
|
-
},
|
|
1160
|
+
}, yt = {
|
|
1161
1161
|
waveformCanvas: "_waveformCanvas_18zb5_1",
|
|
1162
1162
|
recordingDot: "_recordingDot_18zb5_15",
|
|
1163
1163
|
"recording-pulse": "_recording-pulse_18zb5_1"
|
|
1164
|
-
},
|
|
1165
|
-
let f =
|
|
1164
|
+
}, bt = 3, xt = 4, St = 200, Ct = ({ state: e, analyserNodeRef: t, onStop: n, onDiscard: r, attachButton: i, stopLabel: a = "Stop recording", discardLabel: o = "Discard recording", processingLabel: s = "Transcribing audio…", style: c, className: u, embedded: d = !1 }) => {
|
|
1165
|
+
let f = H(null), p = H(new Float32Array(St)), m = H(0), h = H(0), g = e === Xe.Recording, y = e === Xe.Processing, b = z((e) => {
|
|
1166
1166
|
let t = e.getContext("2d");
|
|
1167
1167
|
if (!t) return;
|
|
1168
1168
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
1169
1169
|
let { width: n, height: r } = e;
|
|
1170
1170
|
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
1171
|
-
let i = Math.min(Math.max(1, Math.floor(n /
|
|
1171
|
+
let i = Math.min(Math.max(1, Math.floor(n / xt)), 199), a = m.current, o = h.current;
|
|
1172
1172
|
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
1173
1173
|
for (let e = 0; e <= i; e++) {
|
|
1174
|
-
let n = ((a - i + e) %
|
|
1175
|
-
t.fillRect(e *
|
|
1174
|
+
let n = ((a - i + e) % St + St) % St, o = p.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
1175
|
+
t.fillRect(e * xt, (r - c) / 2, bt, c);
|
|
1176
1176
|
}
|
|
1177
1177
|
t.restore();
|
|
1178
1178
|
}, []);
|
|
1179
|
-
|
|
1179
|
+
B(() => {
|
|
1180
1180
|
if (!g) return;
|
|
1181
1181
|
let e = f.current;
|
|
1182
1182
|
if (!e) return;
|
|
1183
1183
|
p.current.fill(0), m.current = 0, h.current = 0;
|
|
1184
1184
|
let n, r = () => {
|
|
1185
|
-
if (h.current += 1, h.current >=
|
|
1186
|
-
h.current -=
|
|
1185
|
+
if (h.current += 1, h.current >= xt) {
|
|
1186
|
+
h.current -= xt;
|
|
1187
1187
|
let e = t.current;
|
|
1188
1188
|
if (e) {
|
|
1189
1189
|
let t = new Uint8Array(e.frequencyBinCount);
|
|
@@ -1193,7 +1193,7 @@ var U = {
|
|
|
1193
1193
|
let r = (t[e] - 128) / 128;
|
|
1194
1194
|
n += r * r;
|
|
1195
1195
|
}
|
|
1196
|
-
p.current[m.current %
|
|
1196
|
+
p.current[m.current % St] = Math.sqrt(n / t.length), m.current++;
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
1199
|
b(e), n = requestAnimationFrame(r);
|
|
@@ -1205,7 +1205,7 @@ var U = {
|
|
|
1205
1205
|
g,
|
|
1206
1206
|
t,
|
|
1207
1207
|
b
|
|
1208
|
-
]),
|
|
1208
|
+
]), B(() => {
|
|
1209
1209
|
let e = f.current;
|
|
1210
1210
|
if (!e) return;
|
|
1211
1211
|
let t = new ResizeObserver(() => {
|
|
@@ -1213,11 +1213,11 @@ var U = {
|
|
|
1213
1213
|
});
|
|
1214
1214
|
return t.observe(e), () => t.disconnect();
|
|
1215
1215
|
}, [b]);
|
|
1216
|
-
let x = /* @__PURE__ */
|
|
1216
|
+
let x = /* @__PURE__ */ L("div", {
|
|
1217
1217
|
className: "flex shrink-0 items-center justify-end gap-1",
|
|
1218
1218
|
children: [
|
|
1219
|
-
/* @__PURE__ */
|
|
1220
|
-
icon: /* @__PURE__ */
|
|
1219
|
+
/* @__PURE__ */ I(E, {
|
|
1220
|
+
icon: /* @__PURE__ */ I(Ce, {
|
|
1221
1221
|
size: _.LG,
|
|
1222
1222
|
"aria-hidden": !0,
|
|
1223
1223
|
stroke: v
|
|
@@ -1226,8 +1226,8 @@ var U = {
|
|
|
1226
1226
|
className: "mobile:min-h-11 mobile:min-w-11",
|
|
1227
1227
|
onClick: r
|
|
1228
1228
|
}),
|
|
1229
|
-
g && /* @__PURE__ */
|
|
1230
|
-
icon: /* @__PURE__ */
|
|
1229
|
+
g && /* @__PURE__ */ I(N, {
|
|
1230
|
+
icon: /* @__PURE__ */ I(me, {
|
|
1231
1231
|
size: _.LG,
|
|
1232
1232
|
"aria-hidden": !0,
|
|
1233
1233
|
stroke: v
|
|
@@ -1237,104 +1237,104 @@ var U = {
|
|
|
1237
1237
|
"aria-label": a,
|
|
1238
1238
|
className: "mobile:min-h-11 mobile:min-w-11"
|
|
1239
1239
|
}),
|
|
1240
|
-
y && /* @__PURE__ */
|
|
1240
|
+
y && /* @__PURE__ */ I("span", {
|
|
1241
1241
|
className: "flex size-[40px] shrink-0 items-center justify-center mobile:min-h-11 mobile:min-w-11",
|
|
1242
|
-
children: /* @__PURE__ */
|
|
1242
|
+
children: /* @__PURE__ */ I(ae, {
|
|
1243
1243
|
size: 20,
|
|
1244
1244
|
ariaLabel: s
|
|
1245
1245
|
})
|
|
1246
1246
|
})
|
|
1247
1247
|
]
|
|
1248
1248
|
});
|
|
1249
|
-
return /* @__PURE__ */
|
|
1249
|
+
return /* @__PURE__ */ I("div", {
|
|
1250
1250
|
className: u,
|
|
1251
|
-
children: /* @__PURE__ */
|
|
1251
|
+
children: /* @__PURE__ */ L("div", {
|
|
1252
1252
|
style: c,
|
|
1253
|
-
className: l("flex w-full min-w-0 flex-col justify-center gap-2", !d &&
|
|
1254
|
-
children: [/* @__PURE__ */
|
|
1253
|
+
className: l("flex w-full min-w-0 flex-col justify-center gap-2", !d && q.wrapper, !d && "min-h-[64px] max-w-[748px] rounded-xl border px-3 shadow-md"),
|
|
1254
|
+
children: [/* @__PURE__ */ L("div", {
|
|
1255
1255
|
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
1256
|
-
children: [g && /* @__PURE__ */
|
|
1257
|
-
className: l(
|
|
1256
|
+
children: [g && /* @__PURE__ */ I("span", {
|
|
1257
|
+
className: l(yt.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
|
|
1258
1258
|
"aria-hidden": !0
|
|
1259
|
-
}), /* @__PURE__ */
|
|
1259
|
+
}), /* @__PURE__ */ I("canvas", {
|
|
1260
1260
|
ref: f,
|
|
1261
1261
|
height: 26,
|
|
1262
1262
|
"aria-hidden": !0,
|
|
1263
|
-
className: l(
|
|
1263
|
+
className: l(yt.waveformCanvas, "h-[26px] min-w-0 flex-1")
|
|
1264
1264
|
})]
|
|
1265
|
-
}), /* @__PURE__ */
|
|
1265
|
+
}), /* @__PURE__ */ L("div", {
|
|
1266
1266
|
className: "flex items-center justify-between gap-2",
|
|
1267
|
-
children: [i ?? /* @__PURE__ */
|
|
1267
|
+
children: [i ?? /* @__PURE__ */ I("span", { "aria-hidden": !0 }), x]
|
|
1268
1268
|
})]
|
|
1269
1269
|
})
|
|
1270
1270
|
});
|
|
1271
|
-
},
|
|
1271
|
+
}, wt = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", sendTooltip: r }) => /* @__PURE__ */ I(N, {
|
|
1272
1272
|
"aria-label": n,
|
|
1273
1273
|
onClick: () => e?.(),
|
|
1274
1274
|
disabled: t,
|
|
1275
1275
|
tooltipProps: r ? { tooltip: r } : void 0,
|
|
1276
|
-
icon: /* @__PURE__ */
|
|
1276
|
+
icon: /* @__PURE__ */ I(pe, {
|
|
1277
1277
|
size: _.LG,
|
|
1278
1278
|
className: "rtl:scale-x-[-1]",
|
|
1279
1279
|
stroke: v
|
|
1280
1280
|
})
|
|
1281
|
-
}),
|
|
1282
|
-
icon: /* @__PURE__ */
|
|
1281
|
+
}), Tt = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ I(E, {
|
|
1282
|
+
icon: /* @__PURE__ */ I(ye, {
|
|
1283
1283
|
size: _.LG,
|
|
1284
1284
|
stroke: v
|
|
1285
1285
|
}),
|
|
1286
1286
|
onClick: () => e?.(),
|
|
1287
1287
|
"aria-label": t
|
|
1288
|
-
}),
|
|
1289
|
-
variant:
|
|
1288
|
+
}), Et = ({ size: e = 20 }) => /* @__PURE__ */ I(re, {
|
|
1289
|
+
variant: ie.Circular,
|
|
1290
1290
|
width: e,
|
|
1291
1291
|
height: e,
|
|
1292
1292
|
active: !0
|
|
1293
|
-
}),
|
|
1293
|
+
}), Dt = ({ loadingLabel: e }) => /* @__PURE__ */ L("span", {
|
|
1294
1294
|
className: "flex min-w-0 flex-1 items-center",
|
|
1295
|
-
children: [/* @__PURE__ */
|
|
1296
|
-
variant:
|
|
1295
|
+
children: [/* @__PURE__ */ I(re, {
|
|
1296
|
+
variant: ie.Text,
|
|
1297
1297
|
width: "100%",
|
|
1298
1298
|
height: 16,
|
|
1299
1299
|
active: !0
|
|
1300
|
-
}), e && /* @__PURE__ */
|
|
1300
|
+
}), e && /* @__PURE__ */ I("span", {
|
|
1301
1301
|
className: "sr-only",
|
|
1302
1302
|
children: e
|
|
1303
1303
|
})]
|
|
1304
|
-
}),
|
|
1304
|
+
}), Ot = ({ loadingLabel: e }) => /* @__PURE__ */ I("div", {
|
|
1305
1305
|
role: "status",
|
|
1306
1306
|
"aria-label": e,
|
|
1307
|
-
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */
|
|
1307
|
+
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ L("div", {
|
|
1308
1308
|
className: "flex h-11 items-center gap-3 px-4",
|
|
1309
1309
|
"aria-hidden": "true",
|
|
1310
|
-
children: [/* @__PURE__ */
|
|
1310
|
+
children: [/* @__PURE__ */ I(Et, {}), /* @__PURE__ */ I(Dt, {})]
|
|
1311
1311
|
}, t))
|
|
1312
|
-
}),
|
|
1312
|
+
}), kt = (e) => e.displayName ?? e.id, At = (e, t) => {
|
|
1313
1313
|
let n = t.trim().toLowerCase();
|
|
1314
|
-
return n ? e.filter((e) =>
|
|
1315
|
-
},
|
|
1314
|
+
return n ? e.filter((e) => kt(e).toLowerCase().includes(n)) : e;
|
|
1315
|
+
}, jt = (e, t, r, i = 18, a) => /* @__PURE__ */ I(n, {
|
|
1316
1316
|
src: e,
|
|
1317
1317
|
size: i,
|
|
1318
1318
|
labels: { tooltip: a },
|
|
1319
1319
|
initialsName: r
|
|
1320
|
-
}),
|
|
1320
|
+
}), Mt = {
|
|
1321
1321
|
searchHeader: "_searchHeader_1u7db_1",
|
|
1322
1322
|
itemText: "_itemText_1u7db_13",
|
|
1323
1323
|
itemHover: "_itemHover_1u7db_17",
|
|
1324
1324
|
selectedItemBackground: "_selectedItemBackground_1u7db_22",
|
|
1325
1325
|
selectedItemText: "_selectedItemText_1u7db_26",
|
|
1326
1326
|
checkIcon: "_checkIcon_1u7db_30"
|
|
1327
|
-
},
|
|
1328
|
-
let [a, o] =
|
|
1327
|
+
}, Nt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, styles: i }) => {
|
|
1328
|
+
let [a, o] = U(""), s = V(() => e?.find((e) => e.id === t), [e, t]), u = r?.loading !== void 0, d = !u && !s && !!t, f = V(() => u ? /* @__PURE__ */ I(Et, { size: _.LG }) : jt(s?.iconUrl, s?.type, s?.displayName ?? s?.id ?? "", _.LG, d ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
|
|
1329
1329
|
u,
|
|
1330
1330
|
s,
|
|
1331
1331
|
d,
|
|
1332
1332
|
r?.unavailableTooltip
|
|
1333
|
-
]), p = s?.displayName ?? s?.id, m = s?.displayVersion, h = p ? `${r?.ariaLabel ?? "Select model"}: ${p}` : r?.ariaLabel ?? "Select model", g =
|
|
1333
|
+
]), p = s?.displayName ?? s?.id, m = s?.displayVersion, h = p ? `${r?.ariaLabel ?? "Select model"}: ${p}` : r?.ariaLabel ?? "Select model", g = V(() => {
|
|
1334
1334
|
if (u) return Array.from({ length: 7 }, (e, t) => ({
|
|
1335
1335
|
key: `__loading-${t}`,
|
|
1336
|
-
icon: /* @__PURE__ */
|
|
1337
|
-
label: /* @__PURE__ */
|
|
1336
|
+
icon: /* @__PURE__ */ I(Et, {}),
|
|
1337
|
+
label: /* @__PURE__ */ I(Dt, { loadingLabel: t === 0 ? r?.loading : void 0 }),
|
|
1338
1338
|
disabled: !0
|
|
1339
1339
|
}));
|
|
1340
1340
|
if (!e || e.length === 0) {
|
|
@@ -1346,19 +1346,19 @@ var U = {
|
|
|
1346
1346
|
}] : [];
|
|
1347
1347
|
}
|
|
1348
1348
|
let o = i?.colors;
|
|
1349
|
-
return
|
|
1349
|
+
return At(e, a).map((e) => {
|
|
1350
1350
|
let r = e.id === t;
|
|
1351
1351
|
return {
|
|
1352
1352
|
key: e.id,
|
|
1353
|
-
label: /* @__PURE__ */
|
|
1354
|
-
text:
|
|
1353
|
+
label: /* @__PURE__ */ I(C, {
|
|
1354
|
+
text: kt(e),
|
|
1355
1355
|
query: a,
|
|
1356
1356
|
maxLines: 1
|
|
1357
1357
|
}),
|
|
1358
|
-
icon:
|
|
1358
|
+
icon: jt(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
1359
1359
|
mark: w.Check,
|
|
1360
1360
|
checked: r,
|
|
1361
|
-
className: l(o?.itemText &&
|
|
1361
|
+
className: l(o?.itemText && Mt.itemText, o?.itemHoverBackground && Mt.itemHover, r && o?.selectedItemBackground && Mt.selectedItemBackground, r && o?.selectedItemText && Mt.selectedItemText, r && o?.checkIcon && Mt.checkIcon, i?.itemClassName, r && i?.selectedItemClassName, W.modelMenuItem, r && W.modelMenuItemSelected),
|
|
1362
1362
|
onClick: () => n?.(e.id)
|
|
1363
1363
|
};
|
|
1364
1364
|
});
|
|
@@ -1372,7 +1372,7 @@ var U = {
|
|
|
1372
1372
|
i?.itemClassName,
|
|
1373
1373
|
i?.selectedItemClassName,
|
|
1374
1374
|
i?.colors
|
|
1375
|
-
]), v =
|
|
1375
|
+
]), v = V(() => c({
|
|
1376
1376
|
"--ms-item-text": i?.colors?.itemText,
|
|
1377
1377
|
"--ms-item-hover-bg": i?.colors?.itemHoverBackground,
|
|
1378
1378
|
"--ms-selected-item-bg": i?.colors?.selectedItemBackground,
|
|
@@ -1385,10 +1385,10 @@ var U = {
|
|
|
1385
1385
|
selectedLabel: p,
|
|
1386
1386
|
selectedVersion: m,
|
|
1387
1387
|
menuItems: g,
|
|
1388
|
-
menuHeader:
|
|
1388
|
+
menuHeader: V(() => !u && e && e.length > 0 ? /* @__PURE__ */ I("div", {
|
|
1389
1389
|
style: c({ "--ms-search-header-bg": i?.colors?.searchHeaderBackground }),
|
|
1390
|
-
className: l("sticky top-0 z-10 pe-2 pt-2 pb-1",
|
|
1391
|
-
children: /* @__PURE__ */
|
|
1390
|
+
className: l("sticky top-0 z-10 pe-2 pt-2 pb-1", Mt.searchHeader, i?.searchHeaderClassName, W.modelMenuSearch),
|
|
1391
|
+
children: /* @__PURE__ */ I(ne, {
|
|
1392
1392
|
value: a,
|
|
1393
1393
|
placeholder: r?.searchPlaceholder ?? "Search",
|
|
1394
1394
|
size: b.Small,
|
|
@@ -1408,22 +1408,22 @@ var U = {
|
|
|
1408
1408
|
e || o("");
|
|
1409
1409
|
}
|
|
1410
1410
|
};
|
|
1411
|
-
},
|
|
1412
|
-
function
|
|
1411
|
+
}, J = typeof window < "u" ? ke : B;
|
|
1412
|
+
function Pt(e) {
|
|
1413
1413
|
if (e !== void 0) switch (typeof e) {
|
|
1414
1414
|
case "number": return e;
|
|
1415
1415
|
case "string": if (e.endsWith("px")) return parseFloat(e);
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
|
-
function
|
|
1419
|
-
let { styleHeight: s, styleWidth: c } =
|
|
1420
|
-
styleHeight:
|
|
1421
|
-
styleWidth:
|
|
1422
|
-
}), [o?.height, o?.width]), [l, u] =
|
|
1418
|
+
function Ft({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
1419
|
+
let { styleHeight: s, styleWidth: c } = V(() => ({
|
|
1420
|
+
styleHeight: Pt(o?.height),
|
|
1421
|
+
styleWidth: Pt(o?.width)
|
|
1422
|
+
}), [o?.height, o?.width]), [l, u] = U({
|
|
1423
1423
|
height: t,
|
|
1424
1424
|
width: n
|
|
1425
1425
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
1426
|
-
return
|
|
1426
|
+
return J(() => {
|
|
1427
1427
|
if (i === null || d) return;
|
|
1428
1428
|
let t = new ResizeObserver((e) => {
|
|
1429
1429
|
for (let t of e) {
|
|
@@ -1443,7 +1443,7 @@ function Pt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1443
1443
|
i,
|
|
1444
1444
|
s,
|
|
1445
1445
|
c
|
|
1446
|
-
]),
|
|
1446
|
+
]), V(() => ({
|
|
1447
1447
|
height: s ?? l.height,
|
|
1448
1448
|
width: c ?? l.width
|
|
1449
1449
|
}), [
|
|
@@ -1452,26 +1452,26 @@ function Pt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1452
1452
|
c
|
|
1453
1453
|
]);
|
|
1454
1454
|
}
|
|
1455
|
-
function
|
|
1456
|
-
let t =
|
|
1455
|
+
function It(e) {
|
|
1456
|
+
let t = H(() => {
|
|
1457
1457
|
throw Error("Cannot call during render.");
|
|
1458
1458
|
});
|
|
1459
|
-
return
|
|
1459
|
+
return J(() => {
|
|
1460
1460
|
t.current = e;
|
|
1461
|
-
}, [e]),
|
|
1461
|
+
}, [e]), z((e) => t.current?.(e), [t]);
|
|
1462
1462
|
}
|
|
1463
|
-
var
|
|
1464
|
-
function
|
|
1465
|
-
if (
|
|
1463
|
+
var Lt = null;
|
|
1464
|
+
function Y(e = !1) {
|
|
1465
|
+
if (Lt === null || e) {
|
|
1466
1466
|
let e = document.createElement("div"), t = e.style;
|
|
1467
1467
|
t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
|
|
1468
1468
|
let n = document.createElement("div"), r = n.style;
|
|
1469
|
-
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ?
|
|
1469
|
+
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? Lt = "positive-descending" : (e.scrollLeft = 1, Lt = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), Lt;
|
|
1470
1470
|
}
|
|
1471
|
-
return
|
|
1471
|
+
return Lt;
|
|
1472
1472
|
}
|
|
1473
|
-
function
|
|
1474
|
-
if (t === "horizontal" && n) switch (
|
|
1473
|
+
function X({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1474
|
+
if (t === "horizontal" && n) switch (Y()) {
|
|
1475
1475
|
case "negative": return -r;
|
|
1476
1476
|
case "positive-descending": if (e) {
|
|
1477
1477
|
let { clientWidth: t, scrollLeft: n, scrollWidth: r } = e;
|
|
@@ -1480,26 +1480,26 @@ function Y({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
|
1480
1480
|
}
|
|
1481
1481
|
return r;
|
|
1482
1482
|
}
|
|
1483
|
-
function
|
|
1483
|
+
function Z(e, t = "Assertion error") {
|
|
1484
1484
|
if (!e) throw console.error(t), Error(t);
|
|
1485
1485
|
}
|
|
1486
|
-
function
|
|
1486
|
+
function Rt(e, t) {
|
|
1487
1487
|
if (e === t) return !0;
|
|
1488
|
-
if (!!e != !!t || (
|
|
1488
|
+
if (!!e != !!t || (Z(e !== void 0), Z(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1489
1489
|
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
1490
1490
|
return !0;
|
|
1491
1491
|
}
|
|
1492
|
-
function
|
|
1492
|
+
function zt({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
1493
1493
|
if (t === 0) return 0;
|
|
1494
1494
|
if (typeof n == "number") return t * n;
|
|
1495
1495
|
{
|
|
1496
1496
|
let n = e.get(e.size === 0 ? 0 : e.size - 1);
|
|
1497
|
-
return
|
|
1497
|
+
return Z(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
1500
|
-
function
|
|
1500
|
+
function Bt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
|
|
1501
1501
|
if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
|
|
1502
|
-
let s =
|
|
1502
|
+
let s = zt({
|
|
1503
1503
|
cachedBounds: t,
|
|
1504
1504
|
itemCount: r,
|
|
1505
1505
|
itemSize: i
|
|
@@ -1511,7 +1511,7 @@ function zt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, co
|
|
|
1511
1511
|
default: return a >= u && a <= l ? a : a < u ? u : l;
|
|
1512
1512
|
}
|
|
1513
1513
|
}
|
|
1514
|
-
function
|
|
1514
|
+
function Vt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
|
|
1515
1515
|
let a = r - 1, o = 0, s = -1, c = 0, l = -1, u = 0;
|
|
1516
1516
|
for (; u < a;) {
|
|
1517
1517
|
let n = e.get(u);
|
|
@@ -1530,11 +1530,11 @@ function Bt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemC
|
|
|
1530
1530
|
stopIndexOverscan: l
|
|
1531
1531
|
};
|
|
1532
1532
|
}
|
|
1533
|
-
function
|
|
1533
|
+
function Q({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1534
1534
|
let r = /* @__PURE__ */ new Map();
|
|
1535
1535
|
return {
|
|
1536
1536
|
get(i) {
|
|
1537
|
-
for (
|
|
1537
|
+
for (Z(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
|
|
1538
1538
|
let e = r.size, a;
|
|
1539
1539
|
switch (typeof n) {
|
|
1540
1540
|
case "function":
|
|
@@ -1548,14 +1548,14 @@ function Vt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1548
1548
|
});
|
|
1549
1549
|
else {
|
|
1550
1550
|
let t = r.get(e - 1);
|
|
1551
|
-
|
|
1551
|
+
Z(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
|
|
1552
1552
|
scrollOffset: t.scrollOffset + t.size,
|
|
1553
1553
|
size: a
|
|
1554
1554
|
});
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
1557
|
let a = r.get(i);
|
|
1558
|
-
return
|
|
1558
|
+
return Z(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
|
|
1559
1559
|
},
|
|
1560
1560
|
set(e, t) {
|
|
1561
1561
|
r.set(e, t);
|
|
@@ -1565,8 +1565,8 @@ function Vt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1565
1565
|
}
|
|
1566
1566
|
};
|
|
1567
1567
|
}
|
|
1568
|
-
function
|
|
1569
|
-
return
|
|
1568
|
+
function Ht({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1569
|
+
return V(() => Q({
|
|
1570
1570
|
itemCount: e,
|
|
1571
1571
|
itemProps: t,
|
|
1572
1572
|
itemSize: n
|
|
@@ -1576,27 +1576,27 @@ function Q({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1576
1576
|
n
|
|
1577
1577
|
]);
|
|
1578
1578
|
}
|
|
1579
|
-
function
|
|
1579
|
+
function Ut({ containerSize: e, itemSize: t }) {
|
|
1580
1580
|
let n;
|
|
1581
1581
|
switch (typeof t) {
|
|
1582
1582
|
case "string":
|
|
1583
|
-
|
|
1583
|
+
Z(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), Z(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
|
|
1584
1584
|
break;
|
|
1585
1585
|
default: n = t;
|
|
1586
1586
|
}
|
|
1587
1587
|
return n;
|
|
1588
1588
|
}
|
|
1589
|
-
function
|
|
1590
|
-
let { height: u = n, width: d = n } =
|
|
1589
|
+
function Wt({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
|
|
1590
|
+
let { height: u = n, width: d = n } = Ft({
|
|
1591
1591
|
defaultHeight: r === "vertical" ? n : void 0,
|
|
1592
1592
|
defaultWidth: r === "horizontal" ? n : void 0,
|
|
1593
1593
|
element: e,
|
|
1594
1594
|
mode: r === "vertical" ? "only-height" : "only-width",
|
|
1595
1595
|
style: t
|
|
1596
|
-
}), f =
|
|
1596
|
+
}), f = H({
|
|
1597
1597
|
height: 0,
|
|
1598
1598
|
width: 0
|
|
1599
|
-
}), p = r === "vertical" ? u : d, m =
|
|
1599
|
+
}), p = r === "vertical" ? u : d, m = Ut({
|
|
1600
1600
|
containerSize: p,
|
|
1601
1601
|
itemSize: s
|
|
1602
1602
|
});
|
|
@@ -1613,11 +1613,11 @@ function Ut({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1613
1613
|
c,
|
|
1614
1614
|
d
|
|
1615
1615
|
]);
|
|
1616
|
-
let h =
|
|
1616
|
+
let h = Ht({
|
|
1617
1617
|
itemCount: a,
|
|
1618
1618
|
itemProps: o,
|
|
1619
1619
|
itemSize: m
|
|
1620
|
-
}), g =
|
|
1620
|
+
}), g = z((e) => h.get(e), [h]), [_, v] = U(() => Vt({
|
|
1621
1621
|
cachedBounds: h,
|
|
1622
1622
|
containerScrollOffset: 0,
|
|
1623
1623
|
containerSize: p,
|
|
@@ -1628,7 +1628,7 @@ function Ut({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1628
1628
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1629
1629
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1630
1630
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1631
|
-
}, C =
|
|
1631
|
+
}, C = z(() => zt({
|
|
1632
1632
|
cachedBounds: h,
|
|
1633
1633
|
itemCount: a,
|
|
1634
1634
|
itemSize: m
|
|
@@ -1636,14 +1636,14 @@ function Ut({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1636
1636
|
h,
|
|
1637
1637
|
a,
|
|
1638
1638
|
m
|
|
1639
|
-
]), w =
|
|
1640
|
-
let n =
|
|
1639
|
+
]), w = z((t) => {
|
|
1640
|
+
let n = X({
|
|
1641
1641
|
containerElement: e,
|
|
1642
1642
|
direction: r,
|
|
1643
1643
|
isRtl: i,
|
|
1644
1644
|
scrollOffset: t
|
|
1645
1645
|
});
|
|
1646
|
-
return
|
|
1646
|
+
return Vt({
|
|
1647
1647
|
cachedBounds: h,
|
|
1648
1648
|
containerScrollOffset: n,
|
|
1649
1649
|
containerSize: p,
|
|
@@ -1659,30 +1659,30 @@ function Ut({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1659
1659
|
a,
|
|
1660
1660
|
l
|
|
1661
1661
|
]);
|
|
1662
|
-
return
|
|
1662
|
+
return J(() => {
|
|
1663
1663
|
let t = (r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0;
|
|
1664
1664
|
v(w(t));
|
|
1665
1665
|
}, [
|
|
1666
1666
|
e,
|
|
1667
1667
|
r,
|
|
1668
1668
|
w
|
|
1669
|
-
]),
|
|
1669
|
+
]), J(() => {
|
|
1670
1670
|
if (!e) return;
|
|
1671
1671
|
let t = () => {
|
|
1672
1672
|
v((t) => {
|
|
1673
|
-
let { scrollLeft: n, scrollTop: o } = e, s =
|
|
1673
|
+
let { scrollLeft: n, scrollTop: o } = e, s = X({
|
|
1674
1674
|
containerElement: e,
|
|
1675
1675
|
direction: r,
|
|
1676
1676
|
isRtl: i,
|
|
1677
1677
|
scrollOffset: r === "vertical" ? o : n
|
|
1678
|
-
}), c =
|
|
1678
|
+
}), c = Vt({
|
|
1679
1679
|
cachedBounds: h,
|
|
1680
1680
|
containerScrollOffset: s,
|
|
1681
1681
|
containerSize: p,
|
|
1682
1682
|
itemCount: a,
|
|
1683
1683
|
overscanCount: l
|
|
1684
1684
|
});
|
|
1685
|
-
return
|
|
1685
|
+
return Rt(c, t) ? t : c;
|
|
1686
1686
|
});
|
|
1687
1687
|
};
|
|
1688
1688
|
return e.addEventListener("scroll", t), () => {
|
|
@@ -1698,8 +1698,8 @@ function Ut({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1698
1698
|
]), {
|
|
1699
1699
|
getCellBounds: g,
|
|
1700
1700
|
getEstimatedSize: C,
|
|
1701
|
-
scrollToIndex:
|
|
1702
|
-
let s =
|
|
1701
|
+
scrollToIndex: It(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
|
|
1702
|
+
let s = Bt({
|
|
1703
1703
|
align: t,
|
|
1704
1704
|
cachedBounds: h,
|
|
1705
1705
|
containerScrollOffset: n,
|
|
@@ -1709,14 +1709,14 @@ function Ut({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1709
1709
|
itemSize: m
|
|
1710
1710
|
});
|
|
1711
1711
|
if (e) {
|
|
1712
|
-
if (s =
|
|
1712
|
+
if (s = X({
|
|
1713
1713
|
containerElement: e,
|
|
1714
1714
|
direction: r,
|
|
1715
1715
|
isRtl: i,
|
|
1716
1716
|
scrollOffset: s
|
|
1717
1717
|
}), typeof e.scrollTo != "function") {
|
|
1718
1718
|
let e = w(s);
|
|
1719
|
-
|
|
1719
|
+
Rt(_, e) || v(e);
|
|
1720
1720
|
}
|
|
1721
1721
|
return s;
|
|
1722
1722
|
}
|
|
@@ -1727,26 +1727,26 @@ function Ut({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1727
1727
|
stopIndexVisible: x
|
|
1728
1728
|
};
|
|
1729
1729
|
}
|
|
1730
|
-
function
|
|
1731
|
-
return
|
|
1730
|
+
function Gt(e) {
|
|
1731
|
+
return V(() => e, Object.values(e));
|
|
1732
1732
|
}
|
|
1733
|
-
function
|
|
1733
|
+
function Kt(e, t) {
|
|
1734
1734
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1735
|
-
return
|
|
1735
|
+
return Rt(n, a) && Rt(r, o) && Rt(i, s);
|
|
1736
1736
|
}
|
|
1737
|
-
function
|
|
1737
|
+
function qt(e) {
|
|
1738
1738
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1739
1739
|
}
|
|
1740
|
-
var
|
|
1741
|
-
function
|
|
1742
|
-
let m =
|
|
1740
|
+
var Jt = "data-react-window-index";
|
|
1741
|
+
function Yt({ 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 }) {
|
|
1742
|
+
let m = Gt(u), h = V(() => Ee(s, Kt), [s]), [g, _] = U(null), v = qt(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = Wt({
|
|
1743
1743
|
containerElement: g,
|
|
1744
1744
|
containerStyle: f,
|
|
1745
1745
|
defaultContainerSize: n,
|
|
1746
1746
|
direction: "vertical",
|
|
1747
1747
|
itemCount: c,
|
|
1748
1748
|
itemProps: m,
|
|
1749
|
-
itemSize:
|
|
1749
|
+
itemSize: V(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
|
|
1750
1750
|
onResize: i,
|
|
1751
1751
|
overscanCount: o
|
|
1752
1752
|
});
|
|
@@ -1765,12 +1765,12 @@ function Jt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1765
1765
|
top: r
|
|
1766
1766
|
});
|
|
1767
1767
|
}
|
|
1768
|
-
}), [g, x]),
|
|
1768
|
+
}), [g, x]), J(() => {
|
|
1769
1769
|
if (!g) return;
|
|
1770
1770
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1771
1771
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
1772
1772
|
let n = `${S + t}`;
|
|
1773
|
-
return e.setAttribute(
|
|
1773
|
+
return e.setAttribute(Jt, n), !0;
|
|
1774
1774
|
});
|
|
1775
1775
|
if (v) return l.observeRowElements(e);
|
|
1776
1776
|
}, [
|
|
@@ -1779,7 +1779,7 @@ function Jt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1779
1779
|
l,
|
|
1780
1780
|
S,
|
|
1781
1781
|
w
|
|
1782
|
-
]),
|
|
1782
|
+
]), B(() => {
|
|
1783
1783
|
S >= 0 && w >= 0 && a && a({
|
|
1784
1784
|
startIndex: C,
|
|
1785
1785
|
stopIndex: T
|
|
@@ -1794,7 +1794,7 @@ function Jt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1794
1794
|
w,
|
|
1795
1795
|
T
|
|
1796
1796
|
]);
|
|
1797
|
-
let E =
|
|
1797
|
+
let E = V(() => {
|
|
1798
1798
|
let e = [];
|
|
1799
1799
|
if (c > 0) for (let t = S; t <= w; t++) {
|
|
1800
1800
|
let n = y(t);
|
|
@@ -1825,7 +1825,7 @@ function Jt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1825
1825
|
m,
|
|
1826
1826
|
S,
|
|
1827
1827
|
w
|
|
1828
|
-
]), D = /* @__PURE__ */
|
|
1828
|
+
]), D = /* @__PURE__ */ I("div", {
|
|
1829
1829
|
"aria-hidden": !0,
|
|
1830
1830
|
style: {
|
|
1831
1831
|
height: b(),
|
|
@@ -1847,7 +1847,7 @@ function Jt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1847
1847
|
}
|
|
1848
1848
|
}, E, e, D);
|
|
1849
1849
|
}
|
|
1850
|
-
var
|
|
1850
|
+
var Xt = {
|
|
1851
1851
|
search: "_search_5skzl_1",
|
|
1852
1852
|
divider: "_divider_5skzl_5",
|
|
1853
1853
|
item: "_item_5skzl_9",
|
|
@@ -1856,29 +1856,29 @@ var Yt = {
|
|
|
1856
1856
|
stateLabel: "_stateLabel_5skzl_27",
|
|
1857
1857
|
itemSelectedBackground: "_itemSelectedBackground_5skzl_37",
|
|
1858
1858
|
itemSelectedText: "_itemSelectedText_5skzl_41"
|
|
1859
|
-
},
|
|
1860
|
-
let p = r[e], h =
|
|
1861
|
-
return /* @__PURE__ */
|
|
1859
|
+
}, Zt = 44, Qt = 8, $t = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: o, itemClassName: s, selectedItemClassName: c, hasSelectedBackground: u, hasSelectedText: d, onSelect: f }) => {
|
|
1860
|
+
let p = r[e], h = jt(p.iconUrl, p.type, p.displayName ?? p.id, _.SM), g = p.id === i;
|
|
1861
|
+
return /* @__PURE__ */ I("div", {
|
|
1862
1862
|
style: t,
|
|
1863
1863
|
...n,
|
|
1864
|
-
children: /* @__PURE__ */
|
|
1864
|
+
children: /* @__PURE__ */ I(m, {
|
|
1865
1865
|
type: "button",
|
|
1866
1866
|
"aria-current": g ? "true" : void 0,
|
|
1867
|
-
className: l(
|
|
1868
|
-
iconBefore: /* @__PURE__ */
|
|
1869
|
-
className:
|
|
1867
|
+
className: l(Xt.item, "h-full w-full gap-3 px-4", g && u && Xt.itemSelectedBackground, g && d && Xt.itemSelectedText, s, g && c, W.modelMenuItem, g && W.modelMenuItemSelected),
|
|
1868
|
+
iconBefore: /* @__PURE__ */ I("span", {
|
|
1869
|
+
className: Xt.itemIcon,
|
|
1870
1870
|
children: h
|
|
1871
1871
|
}),
|
|
1872
|
-
label: /* @__PURE__ */
|
|
1872
|
+
label: /* @__PURE__ */ L("span", {
|
|
1873
1873
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
1874
|
-
children: [/* @__PURE__ */
|
|
1874
|
+
children: [/* @__PURE__ */ I(C, {
|
|
1875
1875
|
text: p.displayName ?? p.id,
|
|
1876
1876
|
query: o,
|
|
1877
1877
|
maxLines: 1,
|
|
1878
1878
|
className: l(a, "min-w-0 flex-1 text-start")
|
|
1879
|
-
}), g && /* @__PURE__ */
|
|
1879
|
+
}), g && /* @__PURE__ */ I(me, {
|
|
1880
1880
|
size: _.SM,
|
|
1881
|
-
className:
|
|
1881
|
+
className: Xt.checkIcon,
|
|
1882
1882
|
"aria-hidden": !0,
|
|
1883
1883
|
stroke: v
|
|
1884
1884
|
})]
|
|
@@ -1886,12 +1886,12 @@ var Yt = {
|
|
|
1886
1886
|
onClick: () => f(p.id)
|
|
1887
1887
|
})
|
|
1888
1888
|
});
|
|
1889
|
-
},
|
|
1890
|
-
let [v, y] =
|
|
1891
|
-
|
|
1889
|
+
}, en = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: a, selectedDeploymentId: o, onSelect: s, loadingLabel: u, errorLabel: d, emptyLabel: f, style: p, titleClassName: m = "dial-body-semi-text", labelClassName: h = "dial-small-text", colors: g, menuStyles: _ }) => {
|
|
1890
|
+
let [v, y] = U("");
|
|
1891
|
+
B(() => {
|
|
1892
1892
|
e || y("");
|
|
1893
1893
|
}, [e]);
|
|
1894
|
-
let x = a && a.length > 0, S = u !== void 0, C = !x && !S ? d ?? f : void 0, w = x ?
|
|
1894
|
+
let x = a && a.length > 0, S = u !== void 0, C = !x && !S ? d ?? f : void 0, w = x ? At(a, v) : [], T = (e) => {
|
|
1895
1895
|
s(e), i();
|
|
1896
1896
|
}, E = _?.colors, D = c({
|
|
1897
1897
|
"--ci-sheet-divider": g?.divider,
|
|
@@ -1903,38 +1903,38 @@ var Yt = {
|
|
|
1903
1903
|
"--ci-sheet-selected-bg": E?.selectedItemBackground,
|
|
1904
1904
|
"--ci-sheet-selected-text": E?.selectedItemText
|
|
1905
1905
|
});
|
|
1906
|
-
return /* @__PURE__ */
|
|
1906
|
+
return /* @__PURE__ */ I(G, {
|
|
1907
1907
|
isOpen: e,
|
|
1908
1908
|
title: t,
|
|
1909
1909
|
closeLabel: n,
|
|
1910
1910
|
onClose: i,
|
|
1911
1911
|
style: p,
|
|
1912
1912
|
titleClassName: m,
|
|
1913
|
-
className: l("max-h-[80dvh]", _?.className,
|
|
1913
|
+
className: l("max-h-[80dvh]", _?.className, W.modelMenu),
|
|
1914
1914
|
colors: g?.shell,
|
|
1915
|
-
children: /* @__PURE__ */
|
|
1915
|
+
children: /* @__PURE__ */ L("div", {
|
|
1916
1916
|
className: "contents",
|
|
1917
1917
|
style: D,
|
|
1918
|
-
children: [x && !S && /* @__PURE__ */
|
|
1918
|
+
children: [x && !S && /* @__PURE__ */ L(ce, { children: [/* @__PURE__ */ I("div", {
|
|
1919
1919
|
style: c({ "--ci-sheet-search-bg": _?.colors?.searchHeaderBackground }),
|
|
1920
|
-
className: l("flex-shrink-0 px-4 py-[10px]",
|
|
1921
|
-
children: /* @__PURE__ */
|
|
1920
|
+
className: l("flex-shrink-0 px-4 py-[10px]", Xt.search, _?.searchHeaderClassName, W.modelMenuSearch),
|
|
1921
|
+
children: /* @__PURE__ */ I(ne, {
|
|
1922
1922
|
value: v,
|
|
1923
1923
|
placeholder: r,
|
|
1924
1924
|
size: b.Standard,
|
|
1925
1925
|
onChange: (e) => y(e ?? "")
|
|
1926
1926
|
})
|
|
1927
|
-
}), /* @__PURE__ */
|
|
1927
|
+
}), /* @__PURE__ */ I("div", { className: l(Xt.divider, "h-px flex-shrink-0") })] }), S ? /* @__PURE__ */ I(Ot, { loadingLabel: u }) : C ? /* @__PURE__ */ I("div", {
|
|
1928
1928
|
role: "list",
|
|
1929
|
-
className: l(
|
|
1929
|
+
className: l(Xt.stateLabel, h, "px-4 py-4"),
|
|
1930
1930
|
children: C
|
|
1931
|
-
}) : /* @__PURE__ */
|
|
1931
|
+
}) : /* @__PURE__ */ I(Yt, {
|
|
1932
1932
|
role: "list",
|
|
1933
1933
|
className: "overflow-y-auto",
|
|
1934
|
-
style: { height: Math.min(w.length,
|
|
1935
|
-
rowComponent:
|
|
1934
|
+
style: { height: Math.min(w.length, Qt) * Zt },
|
|
1935
|
+
rowComponent: $t,
|
|
1936
1936
|
rowCount: w.length,
|
|
1937
|
-
rowHeight:
|
|
1937
|
+
rowHeight: Zt,
|
|
1938
1938
|
rowProps: {
|
|
1939
1939
|
items: w,
|
|
1940
1940
|
selectedDeploymentId: o,
|
|
@@ -1949,8 +1949,8 @@ var Yt = {
|
|
|
1949
1949
|
})]
|
|
1950
1950
|
})
|
|
1951
1951
|
});
|
|
1952
|
-
},
|
|
1953
|
-
let [g, b] =
|
|
1952
|
+
}, tn = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, menuStyles: i, isStreaming: a, isMobile: o, isDisabled: c = !1, style: u, modelPickerOverlay: d, isPickerOpen: f, onPickerToggle: p, onPickerOpenChange: h }) => {
|
|
1953
|
+
let [g, b] = U(!1), { selectorIcon: x, selectorAriaLabel: C, selectedLabel: w, selectedVersion: T, menuItems: E, menuHeader: D, menuStyle: O, onOpenChange: k } = Nt({
|
|
1954
1954
|
deployments: e,
|
|
1955
1955
|
selectedDeploymentId: t,
|
|
1956
1956
|
onDeploymentChange: n,
|
|
@@ -1958,36 +1958,36 @@ var Yt = {
|
|
|
1958
1958
|
styles: i
|
|
1959
1959
|
});
|
|
1960
1960
|
if (!e) return null;
|
|
1961
|
-
let
|
|
1961
|
+
let A = a || c, j = A ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, M = /* @__PURE__ */ I(he, {
|
|
1962
1962
|
size: _.SM,
|
|
1963
|
-
className: l(
|
|
1963
|
+
className: l(q.modelSelectorCaret, W.modelSelectorCaret),
|
|
1964
1964
|
"aria-hidden": !0,
|
|
1965
1965
|
stroke: v
|
|
1966
|
-
}),
|
|
1967
|
-
className: l("flex shrink-0 items-center",
|
|
1966
|
+
}), N = /* @__PURE__ */ I("span", {
|
|
1967
|
+
className: l("flex shrink-0 items-center", W.modelSelectorIcon),
|
|
1968
1968
|
children: x
|
|
1969
1969
|
});
|
|
1970
|
-
if (o) return /* @__PURE__ */
|
|
1970
|
+
if (o) return /* @__PURE__ */ L(ce, { children: [/* @__PURE__ */ I(S, {
|
|
1971
1971
|
tooltipProps: { tooltip: w },
|
|
1972
|
-
icon: /* @__PURE__ */
|
|
1972
|
+
icon: /* @__PURE__ */ L("div", {
|
|
1973
1973
|
className: "flex items-center gap-1",
|
|
1974
|
-
children: [
|
|
1974
|
+
children: [N, M]
|
|
1975
1975
|
}),
|
|
1976
1976
|
"aria-label": C,
|
|
1977
|
-
"aria-disabled":
|
|
1977
|
+
"aria-disabled": A || void 0,
|
|
1978
1978
|
onClick: () => {
|
|
1979
|
-
|
|
1979
|
+
A || b(!0);
|
|
1980
1980
|
},
|
|
1981
|
-
className: l("w-[50px]",
|
|
1982
|
-
}), d ? /* @__PURE__ */
|
|
1981
|
+
className: l("w-[50px]", q.modelSelectorButton, j, W.modelSelectorButton)
|
|
1982
|
+
}), d ? /* @__PURE__ */ I(G, {
|
|
1983
1983
|
isOpen: g,
|
|
1984
1984
|
title: r?.ariaLabel ?? "Select model",
|
|
1985
1985
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1986
1986
|
onClose: () => b(!1),
|
|
1987
1987
|
style: u,
|
|
1988
|
-
className: l(i?.className,
|
|
1988
|
+
className: l(i?.className, W.modelMenu),
|
|
1989
1989
|
children: d(() => b(!1))
|
|
1990
|
-
}) : /* @__PURE__ */
|
|
1990
|
+
}) : /* @__PURE__ */ I(en, {
|
|
1991
1991
|
isOpen: g,
|
|
1992
1992
|
title: r?.ariaLabel ?? "Select model",
|
|
1993
1993
|
closeLabel: r?.closeLabel ?? "Close",
|
|
@@ -2004,7 +2004,7 @@ var Yt = {
|
|
|
2004
2004
|
})] });
|
|
2005
2005
|
if (d) {
|
|
2006
2006
|
let e = T ? `${w} · ${T}` : w;
|
|
2007
|
-
return /* @__PURE__ */
|
|
2007
|
+
return /* @__PURE__ */ I(y, {
|
|
2008
2008
|
placement: "top-end",
|
|
2009
2009
|
matchReferenceWidth: !1,
|
|
2010
2010
|
open: f,
|
|
@@ -2012,110 +2012,110 @@ var Yt = {
|
|
|
2012
2012
|
trigger: [],
|
|
2013
2013
|
outsideClosable: !0,
|
|
2014
2014
|
renderOverlay: () => d(() => h?.(!1)),
|
|
2015
|
-
listClassName: l("!w-[368px] !bg-layer-raised", i?.className,
|
|
2016
|
-
children: /* @__PURE__ */
|
|
2015
|
+
listClassName: l("!w-[368px] !bg-layer-raised", i?.className, W.modelMenu),
|
|
2016
|
+
children: /* @__PURE__ */ I(m, {
|
|
2017
2017
|
"aria-label": C,
|
|
2018
|
-
"aria-disabled":
|
|
2018
|
+
"aria-disabled": A || void 0,
|
|
2019
2019
|
tooltipProps: { tooltip: e },
|
|
2020
|
-
className: l("h-auto min-w-0 gap-1.5 !rounded-full !border-0 px-0 py-1.5 ps-1.5 pe-2",
|
|
2020
|
+
className: l("h-auto min-w-0 gap-1.5 !rounded-full !border-0 px-0 py-1.5 ps-1.5 pe-2", q.modelSelectorButton, j, A && q.modelSelectorButtonDisabled, W.modelSelectorButton),
|
|
2021
2021
|
onClick: () => {
|
|
2022
|
-
|
|
2022
|
+
A || p?.();
|
|
2023
2023
|
},
|
|
2024
|
-
iconBefore:
|
|
2025
|
-
iconAfter:
|
|
2024
|
+
iconBefore: N,
|
|
2025
|
+
iconAfter: M,
|
|
2026
2026
|
textClassName: "min-w-0",
|
|
2027
|
-
label: /* @__PURE__ */
|
|
2027
|
+
label: /* @__PURE__ */ L("span", {
|
|
2028
2028
|
className: "flex max-w-[180px] min-w-0 items-baseline gap-1",
|
|
2029
|
-
children: [/* @__PURE__ */
|
|
2030
|
-
className: l("dial-small-text max-w-[180px] shrink-0 truncate",
|
|
2029
|
+
children: [/* @__PURE__ */ I("span", {
|
|
2030
|
+
className: l("dial-small-text max-w-[180px] shrink-0 truncate", q.modelSelectorName),
|
|
2031
2031
|
children: w
|
|
2032
|
-
}), T && /* @__PURE__ */
|
|
2033
|
-
className: l("dial-tiny-text min-w-0 truncate",
|
|
2032
|
+
}), T && /* @__PURE__ */ I("span", {
|
|
2033
|
+
className: l("dial-tiny-text min-w-0 truncate", q.modelSelectorVersion),
|
|
2034
2034
|
children: T
|
|
2035
2035
|
})]
|
|
2036
2036
|
})
|
|
2037
2037
|
})
|
|
2038
2038
|
});
|
|
2039
2039
|
}
|
|
2040
|
-
return /* @__PURE__ */
|
|
2041
|
-
className: l(
|
|
2042
|
-
"aria-disabled":
|
|
2043
|
-
children: /* @__PURE__ */
|
|
2040
|
+
return /* @__PURE__ */ I("div", {
|
|
2041
|
+
className: l(j),
|
|
2042
|
+
"aria-disabled": A || void 0,
|
|
2043
|
+
children: /* @__PURE__ */ I(y, {
|
|
2044
2044
|
items: E,
|
|
2045
2045
|
menuHeader: D,
|
|
2046
2046
|
placement: "bottom-end",
|
|
2047
2047
|
matchReferenceWidth: !1,
|
|
2048
2048
|
maxDropdownHeight: s,
|
|
2049
|
-
listClassName: l("!w-[240px]", i?.className,
|
|
2050
|
-
listStyle:
|
|
2051
|
-
disabled:
|
|
2052
|
-
onOpenChange:
|
|
2053
|
-
children: /* @__PURE__ */
|
|
2049
|
+
listClassName: l("!w-[240px]", i?.className, W.modelMenu),
|
|
2050
|
+
listStyle: O,
|
|
2051
|
+
disabled: A,
|
|
2052
|
+
onOpenChange: A ? void 0 : k,
|
|
2053
|
+
children: /* @__PURE__ */ I(m, {
|
|
2054
2054
|
"aria-label": C,
|
|
2055
|
-
"aria-disabled":
|
|
2055
|
+
"aria-disabled": A || void 0,
|
|
2056
2056
|
tooltipProps: { tooltip: w },
|
|
2057
|
-
iconBefore:
|
|
2058
|
-
iconAfter:
|
|
2059
|
-
className: l("h-auto gap-1 !rounded-full !border-0 p-1.5",
|
|
2057
|
+
iconBefore: N,
|
|
2058
|
+
iconAfter: M,
|
|
2059
|
+
className: l("h-auto gap-1 !rounded-full !border-0 p-1.5", q.modelSelectorButton, A && q.modelSelectorButtonDisabled, W.modelSelectorButton)
|
|
2060
2060
|
})
|
|
2061
2061
|
})
|
|
2062
2062
|
});
|
|
2063
|
-
},
|
|
2064
|
-
let
|
|
2065
|
-
"--ci-bg":
|
|
2066
|
-
"--ci-text":
|
|
2067
|
-
"--ci-border":
|
|
2068
|
-
"--ci-border-focus":
|
|
2069
|
-
"--ci-placeholder":
|
|
2070
|
-
"--ci-text-disabled":
|
|
2071
|
-
"--ci-model-selector-caret-color":
|
|
2072
|
-
"--ci-model-selector-hover-bg":
|
|
2073
|
-
"--ci-model-selector-disabled-color":
|
|
2074
|
-
"--ci-model-selector-name-color":
|
|
2075
|
-
"--ci-model-selector-version-color":
|
|
2076
|
-
"--ci-voice-waveform":
|
|
2077
|
-
"--ci-voice-accent":
|
|
2078
|
-
"--ci-mention-highlight-bg":
|
|
2079
|
-
"--ci-mention-highlight-text":
|
|
2080
|
-
"--ci-mention-highlight-unsupported-bg":
|
|
2081
|
-
"--ci-mention-highlight-unsupported-text":
|
|
2082
|
-
}), [
|
|
2063
|
+
}, nn = Te(({ message: e = "", messageRevision: t, focusRequestId: n, textInsertion: r, onSend: i, onUploadAttachment: a, onStop: o, isStreaming: s = !1, onChange: u, onAttachmentsChange: p, placeholder: m = "Type a message...", ariaLabel: h, attachLabel: g = "Attach file", fileAccept: b, addMenuTitle: C = "Add", menuTitle: w = "Menu", menuCloseLabel: T = "Close", removeLabel: E, retryLabel: D, uploadingLabel: O, expandLabel: k, clickLabel: A, sendLabel: j, sendTooltip: M, emptyMessageTooltip: N, stopLabel: ee, micLabel: te = "Dictate", recordVoiceLabel: ne = "Record voice", stopRecordingLabel: re, discardRecordingLabel: ie, colors: P, typography: ae, attachmentTray: F, modelMenu: oe, className: se, pendingDropFiles: ue = [], onDropFilesConsumed: de, pendingAttachments: pe = [], onPendingAttachmentsConsumed: me, pasteTextThreshold: he = 4e3, maxMessageLength: R = 5e4, deployments: ve, selectedDeploymentId: ye, onDeploymentChange: be, modelSelectorLabels: xe, initialAttachments: Se = [], hideAddButton: Ce = !1, hideAttachFile: we = !1, hideActionBar: Te = !1, actionRowLayout: Ee = it.Stacked, isInlineActionRowAllowedBelowDesktop: De = !1, renderFooterActions: Ae, isInputDisabled: G = !1, isModelSelectorDisabled: je = !1, isSendDisabled: Ne = !1, isAudioMessageSupported: Pe = !1, isVoiceRecordingSupported: Fe = Pe, onTranscribeAudio: Ie, transcribingLabel: ze, voiceErrorLabel: Be, sendOnEnter: Ue = rt.Enter, prefixAttachments: We = [], onRemovePrefixAttachment: Je, chatSettings: Qe, toolsMenuItems: $e, onToolToggle: et, canRemoveTools: tt = !0, toolsMenuTitle: at, toolsBackLabel: ot, toolsChipLabels: st, menuOverlays: ct, activeMentions: lt, onBackspaceAtCaret: ut, caretPositionOverride: dt, commandMenu: K, autoFocus: ft = !1, messageHistory: pt, onDialFileSystemClick: mt, dialFileSystemLabel: gt, validateAttachment: _t, onAttachmentClick: yt, modelPickerOverlay: bt, maximumAttachmentsAmount: xt, onAttachmentsLimitExceeded: St, isAttachmentsEnabled: Et = !0, isTextAttachmentsAllowed: Dt = !0, usageLimitsSlot: Ot, onMessageTooLong: kt }, At) => {
|
|
2064
|
+
let jt = d(), [Mt, Nt] = U(!1), J = Ve(pt), Pt = lt ?? [], Ft = Pt.length > 0, It = V(() => c({
|
|
2065
|
+
"--ci-bg": P?.background,
|
|
2066
|
+
"--ci-text": P?.text,
|
|
2067
|
+
"--ci-border": P?.border,
|
|
2068
|
+
"--ci-border-focus": P?.borderFocus,
|
|
2069
|
+
"--ci-placeholder": P?.placeholder,
|
|
2070
|
+
"--ci-text-disabled": P?.textDisabled,
|
|
2071
|
+
"--ci-model-selector-caret-color": P?.modelSelectorCaret,
|
|
2072
|
+
"--ci-model-selector-hover-bg": P?.modelSelectorHoverBg,
|
|
2073
|
+
"--ci-model-selector-disabled-color": P?.modelSelectorDisabled,
|
|
2074
|
+
"--ci-model-selector-name-color": P?.modelSelectorName,
|
|
2075
|
+
"--ci-model-selector-version-color": P?.modelSelectorVersion,
|
|
2076
|
+
"--ci-voice-waveform": P?.voiceWaveform,
|
|
2077
|
+
"--ci-voice-accent": P?.voiceAccent,
|
|
2078
|
+
"--ci-mention-highlight-bg": P?.mentionHighlightBg,
|
|
2079
|
+
"--ci-mention-highlight-text": P?.mentionHighlightText,
|
|
2080
|
+
"--ci-mention-highlight-unsupported-bg": P?.mentionHighlightUnsupportedBg,
|
|
2081
|
+
"--ci-mention-highlight-unsupported-text": P?.mentionHighlightUnsupportedText
|
|
2082
|
+
}), [P]), Lt = V(() => mt ? [{
|
|
2083
2083
|
key: "dial-fs",
|
|
2084
|
-
label:
|
|
2085
|
-
icon: /* @__PURE__ */
|
|
2084
|
+
label: gt ?? "DIAL file system",
|
|
2085
|
+
icon: /* @__PURE__ */ I(ge, {
|
|
2086
2086
|
size: f,
|
|
2087
2087
|
"aria-hidden": !0,
|
|
2088
2088
|
stroke: v
|
|
2089
2089
|
}),
|
|
2090
|
-
onClick:
|
|
2091
|
-
}] : [], [
|
|
2090
|
+
onClick: mt
|
|
2091
|
+
}] : [], [mt, gt]), { message: Y, setMessage: X, textareaRef: Z } = Ke({
|
|
2092
2092
|
messageProp: e,
|
|
2093
2093
|
messageRevision: t
|
|
2094
2094
|
});
|
|
2095
|
-
|
|
2095
|
+
B(() => {
|
|
2096
2096
|
let e = Z.current;
|
|
2097
2097
|
e != null && e.value.length !== 0 && document.activeElement === e && e.setSelectionRange(e.value.length, e.value.length);
|
|
2098
|
-
}, [Z]),
|
|
2098
|
+
}, [Z]), B(() => {
|
|
2099
2099
|
n !== void 0 && Z.current?.focus();
|
|
2100
|
-
}, [n, Z]), Oe(
|
|
2101
|
-
let { handleUndoKeyDown: Rt, markCaretPlaced: zt } =
|
|
2100
|
+
}, [n, Z]), Oe(At, () => ({ getCaretPosition: () => Z.current?.selectionStart ?? Y.length }), [Y, Z]);
|
|
2101
|
+
let { handleUndoKeyDown: Rt, markCaretPlaced: zt } = Ye({
|
|
2102
2102
|
insertion: r,
|
|
2103
2103
|
textareaRef: Z
|
|
2104
|
-
}), { isMenuOpen: Bt, query: Vt, activeWordStart: Q, dismiss: Ht, closeOnOutsidePress: Ut, handleCaretMove: Wt, handleValueChange: Gt, listboxId: Kt, overlayRef: qt, activeOptionId: Jt, moveActiveOption: Yt, getActiveOption: Xt } =
|
|
2104
|
+
}), { isMenuOpen: Bt, query: Vt, activeWordStart: Q, dismiss: Ht, closeOnOutsidePress: Ut, handleCaretMove: Wt, handleValueChange: Gt, listboxId: Kt, overlayRef: qt, activeOptionId: Jt, moveActiveOption: Yt, getActiveOption: Xt } = Re({
|
|
2105
2105
|
config: K,
|
|
2106
2106
|
message: Y
|
|
2107
|
-
}), Zt =
|
|
2107
|
+
}), Zt = H(Wt);
|
|
2108
2108
|
Zt.current = Wt;
|
|
2109
2109
|
let Qt = () => {
|
|
2110
2110
|
Wt(Z.current?.selectionStart ?? Y.length);
|
|
2111
|
-
}, $t =
|
|
2111
|
+
}, $t = H(!1), en = () => {
|
|
2112
2112
|
$t.current ? $t.current = !1 : requestAnimationFrame(() => {
|
|
2113
2113
|
let e = Z.current;
|
|
2114
2114
|
Zt.current(e?.selectionStart ?? e?.value.length ?? 0);
|
|
2115
2115
|
});
|
|
2116
2116
|
}, nn = (e) => {
|
|
2117
2117
|
(e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "Home" || e.key === "End" || e.key === "PageUp" || e.key === "PageDown") && Wt(e.currentTarget.selectionStart ?? Y.length);
|
|
2118
|
-
}, rn = K?.emptyQueryHint != null, an = K != null && Q != null ? Q + K.triggerPrefix.length : null, on = an != null && Y.slice(an).split("\n", 1)[0] !== "", sn = rn && Bt && Vt === "" && an != null && !on, cn = K != null && Bt ? Q ?? 0 : null, ln =
|
|
2118
|
+
}, rn = K?.emptyQueryHint != null, an = K != null && Q != null ? Q + K.triggerPrefix.length : null, on = an != null && Y.slice(an).split("\n", 1)[0] !== "", sn = rn && Bt && Vt === "" && an != null && !on, cn = K != null && Bt ? Q ?? 0 : null, ln = H(null), un = H(null), [dn, fn] = U(null), pn = z(() => {
|
|
2119
2119
|
let e = ln.current, t = un.current;
|
|
2120
2120
|
if (e == null || t == null) {
|
|
2121
2121
|
fn(null);
|
|
@@ -2127,7 +2127,7 @@ var Yt = {
|
|
|
2127
2127
|
top: n.top - r.top
|
|
2128
2128
|
});
|
|
2129
2129
|
}, []);
|
|
2130
|
-
|
|
2130
|
+
B(() => {
|
|
2131
2131
|
if (cn == null) return;
|
|
2132
2132
|
let e = Z.current;
|
|
2133
2133
|
if (e == null || typeof ResizeObserver > "u") return;
|
|
@@ -2138,12 +2138,12 @@ var Yt = {
|
|
|
2138
2138
|
Z,
|
|
2139
2139
|
pn
|
|
2140
2140
|
]);
|
|
2141
|
-
let mn =
|
|
2141
|
+
let mn = z((e) => {
|
|
2142
2142
|
if (K == null || (Ht(), !e?.consumeQuery) || (e.returnFocus !== !1 && Z.current?.focus(), Q == null)) return;
|
|
2143
2143
|
let t = `${K.triggerPrefix}${Vt}`, n = Q + t.length;
|
|
2144
2144
|
if (Y.slice(Q, n) !== t) return;
|
|
2145
2145
|
let r = Y.slice(0, Q) + Y.slice(n);
|
|
2146
|
-
X(r),
|
|
2146
|
+
X(r), J.notifyChange(), u?.(r);
|
|
2147
2147
|
}, [
|
|
2148
2148
|
K,
|
|
2149
2149
|
Ht,
|
|
@@ -2151,59 +2151,59 @@ var Yt = {
|
|
|
2151
2151
|
Y,
|
|
2152
2152
|
Q,
|
|
2153
2153
|
X,
|
|
2154
|
-
|
|
2154
|
+
J,
|
|
2155
2155
|
u,
|
|
2156
2156
|
Z
|
|
2157
|
-
]), hn =
|
|
2158
|
-
|
|
2157
|
+
]), hn = H(void 0);
|
|
2158
|
+
B(() => {
|
|
2159
2159
|
dt != null && hn.current !== t && (hn.current = t, Z.current?.setSelectionRange(dt, dt), zt(), Wt(dt));
|
|
2160
2160
|
}, [Y]);
|
|
2161
|
-
let gn =
|
|
2161
|
+
let gn = H(Y);
|
|
2162
2162
|
gn.current = Y;
|
|
2163
|
-
let { attachments: _n, buildAttachments: vn, addAttachments: yn, resetAttachments: bn, handleRemove: xn, handleRetry: Sn, handleExpand: Cn, hasBlockedAttachments: wn } =
|
|
2164
|
-
initialAttachments:
|
|
2163
|
+
let { attachments: _n, buildAttachments: vn, addAttachments: yn, resetAttachments: bn, handleRemove: xn, handleRetry: Sn, handleExpand: Cn, hasBlockedAttachments: wn } = Me({
|
|
2164
|
+
initialAttachments: Se,
|
|
2165
2165
|
onUploadAttachment: a,
|
|
2166
2166
|
onAttachmentsChange: p,
|
|
2167
2167
|
validateAttachment: _t,
|
|
2168
|
-
pendingDropFiles:
|
|
2169
|
-
onDropFilesConsumed:
|
|
2168
|
+
pendingDropFiles: ue,
|
|
2169
|
+
onDropFilesConsumed: de,
|
|
2170
2170
|
isDropDisabled: G,
|
|
2171
|
-
pendingAttachments:
|
|
2172
|
-
onPendingAttachmentsConsumed:
|
|
2173
|
-
onExpandPastedText:
|
|
2171
|
+
pendingAttachments: pe,
|
|
2172
|
+
onPendingAttachmentsConsumed: me,
|
|
2173
|
+
onExpandPastedText: z((e) => {
|
|
2174
2174
|
let t = gn.current, n = t ? `${t}\n${e}` : e;
|
|
2175
2175
|
gn.current = n, X(n), u?.(n);
|
|
2176
2176
|
}, [X, u]),
|
|
2177
|
-
maximumAttachmentsAmount:
|
|
2178
|
-
baseAttachmentsAmount:
|
|
2179
|
-
onAttachmentsLimitExceeded:
|
|
2180
|
-
}), Tn =
|
|
2177
|
+
maximumAttachmentsAmount: xt,
|
|
2178
|
+
baseAttachmentsAmount: We.length,
|
|
2179
|
+
onAttachmentsLimitExceeded: St
|
|
2180
|
+
}), Tn = z((e) => {
|
|
2181
2181
|
yn(vn([e]));
|
|
2182
|
-
}, [yn, vn]), En =
|
|
2182
|
+
}, [yn, vn]), En = H(!1), [Dn, On] = U({
|
|
2183
2183
|
text: "",
|
|
2184
2184
|
revision: 0
|
|
2185
|
-
}), { state: kn, analyserNodeRef: An, errorMessage: jn, startRecording: Mn, stopRecording: Nn, discardRecording: Pn } =
|
|
2185
|
+
}), { state: kn, analyserNodeRef: An, errorMessage: jn, startRecording: Mn, stopRecording: Nn, discardRecording: Pn } = nt({
|
|
2186
2186
|
onAttachAudio: Tn,
|
|
2187
|
-
onTranscribeAudio:
|
|
2188
|
-
onTranscript:
|
|
2187
|
+
onTranscribeAudio: Ie,
|
|
2188
|
+
onTranscript: z((e) => {
|
|
2189
2189
|
let t = e.trim();
|
|
2190
2190
|
if (t) {
|
|
2191
2191
|
let e = gn.current, n = `${e}${e && !/\s$/.test(e) ? " " : ""}${t}`;
|
|
2192
2192
|
gn.current = n, X(n), On((e) => ({
|
|
2193
2193
|
text: t,
|
|
2194
2194
|
revision: e.revision + 1
|
|
2195
|
-
})),
|
|
2195
|
+
})), J.notifyChange(), u?.(n);
|
|
2196
2196
|
}
|
|
2197
2197
|
En.current = !0;
|
|
2198
2198
|
}, [
|
|
2199
2199
|
X,
|
|
2200
|
-
|
|
2200
|
+
J,
|
|
2201
2201
|
u
|
|
2202
2202
|
]),
|
|
2203
|
-
errorLabel:
|
|
2204
|
-
}), $ = kn ===
|
|
2205
|
-
|
|
2206
|
-
if (kn ===
|
|
2203
|
+
errorLabel: Be
|
|
2204
|
+
}), $ = kn === Xe.Recording || kn === Xe.Processing;
|
|
2205
|
+
B(() => {
|
|
2206
|
+
if (kn === Xe.Error || kn === Xe.Idle && En.current) {
|
|
2207
2207
|
En.current = !1;
|
|
2208
2208
|
let e = Z.current;
|
|
2209
2209
|
if (e != null) {
|
|
@@ -2213,41 +2213,41 @@ var Yt = {
|
|
|
2213
2213
|
}
|
|
2214
2214
|
}
|
|
2215
2215
|
}, [kn, Z]);
|
|
2216
|
-
let Fn =
|
|
2216
|
+
let Fn = H(null), In = H(null), Ln = Et && Dt, { handlePaste: Rn } = fe(yn, Ln ? he : Infinity), zn = z((e) => {
|
|
2217
2217
|
if (!Ln) {
|
|
2218
2218
|
let t = e.clipboardData.getData("text/plain");
|
|
2219
|
-
t.length >=
|
|
2219
|
+
t.length >= R && kt?.(t.length, R);
|
|
2220
2220
|
}
|
|
2221
2221
|
if (Rn(e), e.defaultPrevented) return;
|
|
2222
2222
|
let t = e.clipboardData.getData("text/plain").replace(/\r\n?/g, "\n");
|
|
2223
2223
|
t !== "" && K?.onTextPaste?.(t);
|
|
2224
2224
|
}, [
|
|
2225
2225
|
Ln,
|
|
2226
|
-
|
|
2227
|
-
|
|
2226
|
+
R,
|
|
2227
|
+
kt,
|
|
2228
2228
|
Rn,
|
|
2229
2229
|
K
|
|
2230
|
-
]), Bn = Y.trim().length > 0 || _n.length > 0, Vn = Bn && !wn && !Ne && !$, [Hn, Un] =
|
|
2231
|
-
|
|
2230
|
+
]), Bn = Y.trim().length > 0 || _n.length > 0, Vn = Bn && !wn && !Ne && !$, [Hn, Un] = U([]), Wn = ($e ?? []).map((e) => e.id).join("|");
|
|
2231
|
+
B(() => {
|
|
2232
2232
|
Un([]);
|
|
2233
2233
|
}, [Wn]);
|
|
2234
|
-
let Gn =
|
|
2234
|
+
let Gn = V(() => {
|
|
2235
2235
|
let e = $e ?? [];
|
|
2236
|
-
return
|
|
2236
|
+
return tt ? e.filter((e) => e.isSelected || !Hn.includes(e.id)) : e;
|
|
2237
2237
|
}, [
|
|
2238
2238
|
$e,
|
|
2239
2239
|
Hn,
|
|
2240
|
-
|
|
2241
|
-
]), Kn =
|
|
2240
|
+
tt
|
|
2241
|
+
]), Kn = z((e) => {
|
|
2242
2242
|
Un((t) => t.includes(e) ? t : [...t, e]), $e?.find((t) => t.id === e)?.isSelected && et?.(e);
|
|
2243
|
-
}, [$e, et]), qn =
|
|
2243
|
+
}, [$e, et]), qn = ve === void 0 || ye != null, Jn = Pe && !s, Yn = async () => {
|
|
2244
2244
|
if (Ne || $) return;
|
|
2245
|
-
if (Y.length >=
|
|
2246
|
-
|
|
2245
|
+
if (Y.length >= R) {
|
|
2246
|
+
kt?.(Y.length, R);
|
|
2247
2247
|
return;
|
|
2248
2248
|
}
|
|
2249
2249
|
let e = Y, t = _n;
|
|
2250
|
-
X(""),
|
|
2250
|
+
X(""), J.reset();
|
|
2251
2251
|
try {
|
|
2252
2252
|
await i?.(e, t), t.forEach((e) => {
|
|
2253
2253
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
@@ -2255,10 +2255,10 @@ var Yt = {
|
|
|
2255
2255
|
} catch {
|
|
2256
2256
|
X(e), bn(t);
|
|
2257
2257
|
}
|
|
2258
|
-
}, Xn = (e) => Ue ===
|
|
2258
|
+
}, Xn = (e) => Ue === rt.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey, Zn = (e) => {
|
|
2259
2259
|
if (!Bt || e.nativeEvent.isComposing) return !1;
|
|
2260
2260
|
if (e.key === "Escape") return e.preventDefault(), e.stopPropagation(), Ht(), !0;
|
|
2261
|
-
if (e.key === "ArrowDown" || e.key === "ArrowUp") return e.preventDefault(), Yt(e.key === "ArrowDown" ?
|
|
2261
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") return e.preventDefault(), Yt(e.key === "ArrowDown" ? Le.Next : Le.Previous), !0;
|
|
2262
2262
|
if (e.key !== "Enter" || e.shiftKey) return !1;
|
|
2263
2263
|
let t = Xt();
|
|
2264
2264
|
return t == null ? Xn(e) ? (e.preventDefault(), !0) : !1 : (e.preventDefault(), t.click(), !0);
|
|
@@ -2266,7 +2266,7 @@ var Yt = {
|
|
|
2266
2266
|
if (!$ && !Rt(e) && !Zn(e)) {
|
|
2267
2267
|
if (!e.nativeEvent.isComposing && !G && !s) {
|
|
2268
2268
|
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
2269
|
-
let t = e.currentTarget.selectionStart ?? 0, n =
|
|
2269
|
+
let t = e.currentTarget.selectionStart ?? 0, n = J.navigate(e.key === "ArrowUp" ? "up" : "down", Y, t);
|
|
2270
2270
|
if (n !== null) {
|
|
2271
2271
|
e.preventDefault(), X(n);
|
|
2272
2272
|
return;
|
|
@@ -2277,7 +2277,7 @@ var Yt = {
|
|
|
2277
2277
|
if (t != null) {
|
|
2278
2278
|
e.preventDefault();
|
|
2279
2279
|
let n = e.currentTarget;
|
|
2280
|
-
n.setSelectionRange(t.start, t.start + t.length), typeof document.execCommand == "function" && document.execCommand("delete", !1) ||
|
|
2280
|
+
n.setSelectionRange(t.start, t.start + t.length), typeof document.execCommand == "function" && document.execCommand("delete", !1) || qe(n, Y.slice(0, t.start) + Y.slice(t.start + t.length), t.start);
|
|
2281
2281
|
return;
|
|
2282
2282
|
}
|
|
2283
2283
|
}
|
|
@@ -2289,19 +2289,19 @@ var Yt = {
|
|
|
2289
2289
|
if (t.length === 0) return;
|
|
2290
2290
|
let n = vn(t);
|
|
2291
2291
|
e.target.value = "", yn(n);
|
|
2292
|
-
}, er =
|
|
2292
|
+
}, er = V(() => {
|
|
2293
2293
|
let e = [];
|
|
2294
2294
|
return cn != null && e.push({
|
|
2295
2295
|
offset: cn,
|
|
2296
|
-
node: /* @__PURE__ */
|
|
2296
|
+
node: /* @__PURE__ */ I("span", {
|
|
2297
2297
|
ref: ln,
|
|
2298
2298
|
"aria-hidden": !0,
|
|
2299
2299
|
className: "inline-block h-lh w-0 align-text-top"
|
|
2300
2300
|
}, "caret-marker")
|
|
2301
2301
|
}), sn && K != null && an != null && e.push({
|
|
2302
2302
|
offset: an,
|
|
2303
|
-
node: /* @__PURE__ */
|
|
2304
|
-
className:
|
|
2303
|
+
node: /* @__PURE__ */ I("span", {
|
|
2304
|
+
className: q.commandHint,
|
|
2305
2305
|
"aria-hidden": !0,
|
|
2306
2306
|
"data-mirror-synthetic": !0,
|
|
2307
2307
|
children: K.emptyQueryHint
|
|
@@ -2312,7 +2312,7 @@ var Yt = {
|
|
|
2312
2312
|
sn,
|
|
2313
2313
|
K,
|
|
2314
2314
|
an
|
|
2315
|
-
]), tr = Ft || er.length > 0, { mirrorRef: nr, selectionRects: rr, updateSelectionRects: ir, syncMirrorToTextarea: ar } =
|
|
2315
|
+
]), tr = Ft || er.length > 0, { mirrorRef: nr, selectionRects: rr, updateSelectionRects: ir, syncMirrorToTextarea: ar } = Ge({
|
|
2316
2316
|
textareaRef: Z,
|
|
2317
2317
|
message: Y,
|
|
2318
2318
|
isMirrorActive: tr
|
|
@@ -2324,13 +2324,13 @@ var Yt = {
|
|
|
2324
2324
|
cn,
|
|
2325
2325
|
Y
|
|
2326
2326
|
]);
|
|
2327
|
-
let or = /* @__PURE__ */
|
|
2328
|
-
className: l(
|
|
2327
|
+
let or = /* @__PURE__ */ I("textarea", {
|
|
2328
|
+
className: l(q.textarea, tr && q.textareaMentionMode, ae?.fontClassName || "dial-body-paragraph-text", "relative z-0 [field-sizing:content] max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent ps-1 pe-1 outline-hidden", "disabled:cursor-not-allowed"),
|
|
2329
2329
|
ref: Z,
|
|
2330
2330
|
autoFocus: ft,
|
|
2331
2331
|
value: Y,
|
|
2332
2332
|
onChange: (e) => {
|
|
2333
|
-
X(e.target.value),
|
|
2333
|
+
X(e.target.value), J.notifyChange();
|
|
2334
2334
|
let t = e.nativeEvent instanceof InputEvent ? e.nativeEvent : void 0;
|
|
2335
2335
|
Gt(e.target.value, e.target.selectionStart ?? e.target.value.length, t?.isComposing ?? !1), u?.(e.target.value);
|
|
2336
2336
|
},
|
|
@@ -2338,7 +2338,7 @@ var Yt = {
|
|
|
2338
2338
|
onScroll: () => {
|
|
2339
2339
|
ar(), cn != null && pn();
|
|
2340
2340
|
},
|
|
2341
|
-
onFocus:
|
|
2341
|
+
onFocus: en,
|
|
2342
2342
|
onClick: Qt,
|
|
2343
2343
|
onKeyDown: Qn,
|
|
2344
2344
|
onKeyUp: nn,
|
|
@@ -2352,14 +2352,14 @@ var Yt = {
|
|
|
2352
2352
|
disabled: G,
|
|
2353
2353
|
readOnly: $,
|
|
2354
2354
|
rows: 1
|
|
2355
|
-
}), sr = /* @__PURE__ */
|
|
2355
|
+
}), sr = /* @__PURE__ */ L(ce, { children: [or, K != null && /* @__PURE__ */ I("div", {
|
|
2356
2356
|
"aria-hidden": !0,
|
|
2357
|
-
className: l("pointer-events-none absolute",
|
|
2357
|
+
className: l("pointer-events-none absolute", ae?.fontClassName || "dial-body-paragraph-text"),
|
|
2358
2358
|
style: {
|
|
2359
2359
|
left: dn?.left ?? 0,
|
|
2360
2360
|
top: dn?.top ?? 0
|
|
2361
2361
|
},
|
|
2362
|
-
children: /* @__PURE__ */
|
|
2362
|
+
children: /* @__PURE__ */ I(y, {
|
|
2363
2363
|
open: Bt,
|
|
2364
2364
|
onOpenChange: (e) => {
|
|
2365
2365
|
e || Ut();
|
|
@@ -2371,7 +2371,7 @@ var Yt = {
|
|
|
2371
2371
|
outsidePressIgnoreRef: Z,
|
|
2372
2372
|
renderOverlay: () => {
|
|
2373
2373
|
let e = K.menuLabel != null;
|
|
2374
|
-
return /* @__PURE__ */
|
|
2374
|
+
return /* @__PURE__ */ I("div", {
|
|
2375
2375
|
ref: qt,
|
|
2376
2376
|
role: e ? "group" : void 0,
|
|
2377
2377
|
"aria-label": K.menuLabel,
|
|
@@ -2384,18 +2384,18 @@ var Yt = {
|
|
|
2384
2384
|
})
|
|
2385
2385
|
});
|
|
2386
2386
|
},
|
|
2387
|
-
children: /* @__PURE__ */
|
|
2387
|
+
children: /* @__PURE__ */ I("span", {
|
|
2388
2388
|
"aria-hidden": !0,
|
|
2389
2389
|
className: "inline-block h-lh w-0"
|
|
2390
2390
|
})
|
|
2391
2391
|
})
|
|
2392
|
-
})] }), cr = /* @__PURE__ */
|
|
2392
|
+
})] }), cr = /* @__PURE__ */ L("div", {
|
|
2393
2393
|
ref: un,
|
|
2394
2394
|
className: "relative -ms-1 -me-1 w-[calc(100%+8px)]",
|
|
2395
|
-
children: [tr && /* @__PURE__ */
|
|
2395
|
+
children: [tr && /* @__PURE__ */ L("div", {
|
|
2396
2396
|
ref: nr,
|
|
2397
|
-
className: l(
|
|
2398
|
-
children: [
|
|
2397
|
+
className: l(q.textarea, ae?.fontClassName || "dial-body-paragraph-text", "pointer-events-none absolute inset-0 z-10 max-h-[272px] w-full overflow-hidden ps-1 pe-1 [overflow-wrap:anywhere] whitespace-pre-wrap"),
|
|
2398
|
+
children: [He(Y, Pt, er, q.mentionHighlight, q.mentionHighlightUnsupported), rr.map((e, t) => /* @__PURE__ */ I("div", {
|
|
2399
2399
|
"aria-hidden": !0,
|
|
2400
2400
|
className: "pointer-events-none absolute rounded-sm bg-control-accent-alpha-active",
|
|
2401
2401
|
style: {
|
|
@@ -2406,8 +2406,8 @@ var Yt = {
|
|
|
2406
2406
|
}
|
|
2407
2407
|
}, `selection-${t}`))]
|
|
2408
2408
|
}), sr]
|
|
2409
|
-
}), lr =
|
|
2410
|
-
onAttachClick:
|
|
2409
|
+
}), lr = Ce ? void 0 : /* @__PURE__ */ I(ht, {
|
|
2410
|
+
onAttachClick: we ? void 0 : () => Fn.current?.click(),
|
|
2411
2411
|
attachLabel: g,
|
|
2412
2412
|
addMenuTitle: C,
|
|
2413
2413
|
menuTitle: w,
|
|
@@ -2416,58 +2416,58 @@ var Yt = {
|
|
|
2416
2416
|
isDisabled: G || $,
|
|
2417
2417
|
chatSettings: Qe,
|
|
2418
2418
|
extraMenuItems: Lt,
|
|
2419
|
-
onRecordVoice: Fe &&
|
|
2420
|
-
recordVoiceLabel:
|
|
2421
|
-
toolsMenuItems:
|
|
2419
|
+
onRecordVoice: Fe && Et && !s && !$ ? () => Mn(Ze.Attachment) : void 0,
|
|
2420
|
+
recordVoiceLabel: ne,
|
|
2421
|
+
toolsMenuItems: tt ? $e : void 0,
|
|
2422
2422
|
onToolToggle: et,
|
|
2423
2423
|
toolsMenuTitle: at,
|
|
2424
2424
|
toolsBackLabel: ot,
|
|
2425
2425
|
menuOverlays: ct,
|
|
2426
2426
|
getCaretPosition: () => Z.current?.selectionStart ?? Y.length
|
|
2427
|
-
}), ur =
|
|
2428
|
-
className: l("flex",
|
|
2427
|
+
}), ur = Ee === it.Inline && (!jt || De), dr = lr && /* @__PURE__ */ I("div", {
|
|
2428
|
+
className: l("flex", W.addCluster),
|
|
2429
2429
|
children: lr
|
|
2430
|
-
}), fr = Gn.length > 0 && et != null && /* @__PURE__ */
|
|
2431
|
-
className: l("min-w-0 flex-1",
|
|
2432
|
-
children: /* @__PURE__ */
|
|
2430
|
+
}), fr = Gn.length > 0 && et != null && /* @__PURE__ */ I("div", {
|
|
2431
|
+
className: l("min-w-0 flex-1", W.toolsChips),
|
|
2432
|
+
children: /* @__PURE__ */ I(vt, {
|
|
2433
2433
|
items: Gn,
|
|
2434
2434
|
onToolToggle: et,
|
|
2435
2435
|
onToolDismiss: Kn,
|
|
2436
|
-
canRemove:
|
|
2436
|
+
canRemove: tt,
|
|
2437
2437
|
removeLabel: st?.removeLabel,
|
|
2438
2438
|
stateOnLabel: st?.stateOnLabel,
|
|
2439
2439
|
stateOffLabel: st?.stateOffLabel
|
|
2440
2440
|
})
|
|
2441
2441
|
});
|
|
2442
|
-
return /* @__PURE__ */
|
|
2442
|
+
return /* @__PURE__ */ L("div", {
|
|
2443
2443
|
ref: In,
|
|
2444
2444
|
style: It,
|
|
2445
|
-
className: l(
|
|
2445
|
+
className: l(q.wrapper, G && q.wrapperDisabled, G && "cursor-not-allowed", "flex w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", "p-4 focus-within:outline focus-within:-outline-offset-1 active:outline active:-outline-offset-1", se, W.wrapper),
|
|
2446
2446
|
children: [
|
|
2447
|
-
(
|
|
2448
|
-
attachments: [...
|
|
2447
|
+
(We.length > 0 || _n.length > 0) && /* @__PURE__ */ I(le, {
|
|
2448
|
+
attachments: [...We, ..._n],
|
|
2449
2449
|
onRemove: (e) => {
|
|
2450
|
-
|
|
2450
|
+
We.some((t) => t.id === e) ? Je?.(e) : xn(e);
|
|
2451
2451
|
},
|
|
2452
2452
|
onRetry: Sn,
|
|
2453
2453
|
onExpand: Cn,
|
|
2454
2454
|
labels: {
|
|
2455
2455
|
removeLabel: E,
|
|
2456
2456
|
retryLabel: D,
|
|
2457
|
-
uploadingLabel:
|
|
2458
|
-
expandLabel:
|
|
2459
|
-
clickLabel:
|
|
2457
|
+
uploadingLabel: O,
|
|
2458
|
+
expandLabel: k,
|
|
2459
|
+
clickLabel: A
|
|
2460
2460
|
},
|
|
2461
2461
|
styles: {
|
|
2462
|
-
...
|
|
2463
|
-
className: l(_n.length > 6 && "-me-4",
|
|
2462
|
+
...F,
|
|
2463
|
+
className: l(_n.length > 6 && "-me-4", F?.className)
|
|
2464
2464
|
},
|
|
2465
|
-
onAttachmentClick:
|
|
2466
|
-
let t = [...
|
|
2467
|
-
t != null &&
|
|
2465
|
+
onAttachmentClick: yt == null ? void 0 : (e) => {
|
|
2466
|
+
let t = [...We, ..._n].find((t) => t.id === e);
|
|
2467
|
+
t != null && yt(t);
|
|
2468
2468
|
}
|
|
2469
2469
|
}),
|
|
2470
|
-
!
|
|
2470
|
+
!Ce && /* @__PURE__ */ I("input", {
|
|
2471
2471
|
ref: Fn,
|
|
2472
2472
|
type: "file",
|
|
2473
2473
|
multiple: !0,
|
|
@@ -2477,127 +2477,127 @@ var Yt = {
|
|
|
2477
2477
|
tabIndex: -1,
|
|
2478
2478
|
onChange: $n
|
|
2479
2479
|
}),
|
|
2480
|
-
jn && /* @__PURE__ */
|
|
2480
|
+
jn && /* @__PURE__ */ I("div", {
|
|
2481
2481
|
role: "alert",
|
|
2482
2482
|
className: "min-w-0 px-1 wrap-break-word",
|
|
2483
|
-
children: /* @__PURE__ */
|
|
2483
|
+
children: /* @__PURE__ */ I(x, { text: jn })
|
|
2484
2484
|
}),
|
|
2485
|
-
$ && /* @__PURE__ */
|
|
2485
|
+
$ && /* @__PURE__ */ I(Ct, {
|
|
2486
2486
|
embedded: !0,
|
|
2487
2487
|
state: kn,
|
|
2488
2488
|
analyserNodeRef: An,
|
|
2489
2489
|
onStop: Nn,
|
|
2490
2490
|
onDiscard: Pn,
|
|
2491
2491
|
attachButton: lr,
|
|
2492
|
-
stopLabel:
|
|
2493
|
-
discardLabel:
|
|
2492
|
+
stopLabel: re,
|
|
2493
|
+
discardLabel: ie,
|
|
2494
2494
|
processingLabel: ze
|
|
2495
2495
|
}),
|
|
2496
|
-
!$ &&
|
|
2497
|
-
!$ && !
|
|
2496
|
+
!$ && Te && cr,
|
|
2497
|
+
!$ && !Te && ur && fr && /* @__PURE__ */ I("div", {
|
|
2498
2498
|
className: "flex",
|
|
2499
2499
|
children: fr
|
|
2500
2500
|
}),
|
|
2501
|
-
!$ && !
|
|
2502
|
-
className: l("flex items-center gap-2", ur ? "flex-nowrap" : "flex-wrap",
|
|
2501
|
+
!$ && !Te && /* @__PURE__ */ L("div", {
|
|
2502
|
+
className: l("flex items-center gap-2", ur ? "flex-nowrap" : "flex-wrap", W.actionRow),
|
|
2503
2503
|
children: [
|
|
2504
2504
|
ur && dr,
|
|
2505
|
-
/* @__PURE__ */
|
|
2506
|
-
className: l("flex min-w-0 items-center self-stretch", ur ? "flex-1" : "w-full",
|
|
2505
|
+
/* @__PURE__ */ I("div", {
|
|
2506
|
+
className: l("flex min-w-0 items-center self-stretch", ur ? "flex-1" : "w-full", W.textareaWrap),
|
|
2507
2507
|
children: cr
|
|
2508
2508
|
}),
|
|
2509
2509
|
!ur && dr,
|
|
2510
2510
|
!ur && fr,
|
|
2511
|
-
/* @__PURE__ */
|
|
2512
|
-
className: l("ms-auto flex flex-shrink-0 items-center gap-2",
|
|
2513
|
-
children:
|
|
2511
|
+
/* @__PURE__ */ I("div", {
|
|
2512
|
+
className: l("ms-auto flex flex-shrink-0 items-center gap-2", W.footerActions),
|
|
2513
|
+
children: Ae ? Ae({
|
|
2514
2514
|
canSend: Vn,
|
|
2515
2515
|
onSend: Yn
|
|
2516
|
-
}) : /* @__PURE__ */
|
|
2517
|
-
|
|
2518
|
-
/* @__PURE__ */
|
|
2519
|
-
deployments:
|
|
2520
|
-
selectedDeploymentId:
|
|
2521
|
-
onDeploymentChange:
|
|
2522
|
-
modelSelectorLabels:
|
|
2523
|
-
menuStyles:
|
|
2516
|
+
}) : /* @__PURE__ */ L(ce, { children: [
|
|
2517
|
+
Ot,
|
|
2518
|
+
/* @__PURE__ */ I(tn, {
|
|
2519
|
+
deployments: ve,
|
|
2520
|
+
selectedDeploymentId: ye,
|
|
2521
|
+
onDeploymentChange: be,
|
|
2522
|
+
modelSelectorLabels: xe,
|
|
2523
|
+
menuStyles: oe,
|
|
2524
2524
|
isStreaming: s,
|
|
2525
|
-
isMobile:
|
|
2526
|
-
isDisabled:
|
|
2525
|
+
isMobile: jt,
|
|
2526
|
+
isDisabled: je,
|
|
2527
2527
|
style: It,
|
|
2528
|
-
modelPickerOverlay:
|
|
2529
|
-
isPickerOpen:
|
|
2530
|
-
onPickerToggle: () =>
|
|
2531
|
-
onPickerOpenChange:
|
|
2528
|
+
modelPickerOverlay: bt,
|
|
2529
|
+
isPickerOpen: Mt,
|
|
2530
|
+
onPickerToggle: () => Nt((e) => !e),
|
|
2531
|
+
onPickerOpenChange: Nt
|
|
2532
2532
|
}),
|
|
2533
|
-
Jn && /* @__PURE__ */
|
|
2534
|
-
icon: /* @__PURE__ */
|
|
2533
|
+
Jn && /* @__PURE__ */ I(S, {
|
|
2534
|
+
icon: /* @__PURE__ */ I(_e, {
|
|
2535
2535
|
size: _.LG,
|
|
2536
2536
|
stroke: v,
|
|
2537
2537
|
"aria-hidden": !0
|
|
2538
2538
|
}),
|
|
2539
|
-
"aria-label":
|
|
2540
|
-
tooltipProps: { tooltip:
|
|
2539
|
+
"aria-label": te,
|
|
2540
|
+
tooltipProps: { tooltip: te },
|
|
2541
2541
|
className: "size-[40px] shrink-0 mobile:min-h-11 mobile:min-w-11",
|
|
2542
|
-
onClick: () => Mn(
|
|
2542
|
+
onClick: () => Mn(Ze.Dictation),
|
|
2543
2543
|
disabled: G || s
|
|
2544
2544
|
}),
|
|
2545
|
-
s && o ? /* @__PURE__ */
|
|
2545
|
+
s && o ? /* @__PURE__ */ I(Tt, {
|
|
2546
2546
|
onStop: o,
|
|
2547
|
-
ariaLabel:
|
|
2548
|
-
}) : !s && /* @__PURE__ */
|
|
2547
|
+
ariaLabel: ee
|
|
2548
|
+
}) : !s && /* @__PURE__ */ I(wt, {
|
|
2549
2549
|
onSend: Yn,
|
|
2550
2550
|
isDisabled: !qn || !Vn,
|
|
2551
|
-
ariaLabel:
|
|
2552
|
-
sendTooltip: Bn ?
|
|
2551
|
+
ariaLabel: j,
|
|
2552
|
+
sendTooltip: Bn ? M : N ?? M
|
|
2553
2553
|
})
|
|
2554
2554
|
] })
|
|
2555
2555
|
})
|
|
2556
2556
|
]
|
|
2557
2557
|
}),
|
|
2558
|
-
/* @__PURE__ */
|
|
2558
|
+
/* @__PURE__ */ I("span", {
|
|
2559
2559
|
className: "sr-only",
|
|
2560
2560
|
role: "status",
|
|
2561
2561
|
"aria-live": "polite",
|
|
2562
2562
|
"aria-atomic": "true",
|
|
2563
|
-
children: /* @__PURE__ */
|
|
2563
|
+
children: /* @__PURE__ */ I("span", { children: Dn.text }, Dn.revision)
|
|
2564
2564
|
})
|
|
2565
2565
|
]
|
|
2566
2566
|
});
|
|
2567
2567
|
});
|
|
2568
|
-
|
|
2569
|
-
var
|
|
2568
|
+
nn.displayName = "Input";
|
|
2569
|
+
var rn = {
|
|
2570
2570
|
welcome: "_welcome_1icyo_1",
|
|
2571
2571
|
description: "_description_1icyo_5"
|
|
2572
|
-
},
|
|
2572
|
+
}, an = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, descriptionText: r, belowWelcomeSlot: i, aboveInputSlot: a, styles: o, className: s, inputClassName: u, isInputDisabled: d = !1, ...f }) => {
|
|
2573
2573
|
let { colors: p, typography: m, attachmentTray: h, modelMenu: g } = o ?? {}, _ = c({
|
|
2574
2574
|
"--ci-welcome-color": p?.welcomeText,
|
|
2575
2575
|
"--ci-description-color": p?.descriptionText
|
|
2576
2576
|
});
|
|
2577
|
-
return /* @__PURE__ */
|
|
2577
|
+
return /* @__PURE__ */ L("div", {
|
|
2578
2578
|
style: _,
|
|
2579
2579
|
className: l("relative flex w-full flex-col items-center gap-9 px-4 py-5 desktop:p-5", s),
|
|
2580
2580
|
children: [
|
|
2581
|
-
n && /* @__PURE__ */
|
|
2581
|
+
n && /* @__PURE__ */ L("div", {
|
|
2582
2582
|
className: "flex flex-col items-center gap-4 text-center",
|
|
2583
|
-
children: [/* @__PURE__ */
|
|
2584
|
-
className: l(
|
|
2583
|
+
children: [/* @__PURE__ */ I("h1", {
|
|
2584
|
+
className: l(rn.welcome, "m-0", m?.welcomeClassName || "dial-display2-text"),
|
|
2585
2585
|
children: n
|
|
2586
|
-
}), r && /* @__PURE__ */
|
|
2587
|
-
className: l(
|
|
2586
|
+
}), r && /* @__PURE__ */ I("p", {
|
|
2587
|
+
className: l(rn.description, "m-0 max-w-[540px]", m?.descriptionClassName || "dial-body-paragraph-text"),
|
|
2588
2588
|
children: r
|
|
2589
2589
|
})]
|
|
2590
2590
|
}),
|
|
2591
|
-
i != null && /* @__PURE__ */
|
|
2591
|
+
i != null && /* @__PURE__ */ I("div", {
|
|
2592
2592
|
className: "flex w-full max-w-[700px] flex-col items-center empty:hidden",
|
|
2593
2593
|
children: i
|
|
2594
2594
|
}),
|
|
2595
|
-
/* @__PURE__ */
|
|
2595
|
+
/* @__PURE__ */ L("div", {
|
|
2596
2596
|
className: l("relative w-full", n ? "max-w-[700px]" : "max-w-[748px]"),
|
|
2597
|
-
children: [a != null && /* @__PURE__ */
|
|
2597
|
+
children: [a != null && /* @__PURE__ */ I("div", {
|
|
2598
2598
|
className: "mb-2",
|
|
2599
2599
|
children: a
|
|
2600
|
-
}), /* @__PURE__ */
|
|
2600
|
+
}), /* @__PURE__ */ I(nn, {
|
|
2601
2601
|
placeholder: t,
|
|
2602
2602
|
isStreaming: e,
|
|
2603
2603
|
isInputDisabled: d,
|
|
@@ -2611,36 +2611,36 @@ var nn = {
|
|
|
2611
2611
|
})
|
|
2612
2612
|
]
|
|
2613
2613
|
});
|
|
2614
|
-
},
|
|
2615
|
-
let
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
}, [
|
|
2619
|
-
let [
|
|
2620
|
-
|
|
2621
|
-
},
|
|
2622
|
-
m(e,
|
|
2623
|
-
}, [
|
|
2624
|
-
|
|
2625
|
-
},
|
|
2626
|
-
|
|
2627
|
-
}, [n]),
|
|
2614
|
+
}, on = ({ message: e, messageRevision: t, onChange: n, activeMentions: r, onBackspaceAtCaret: i, caretPositionOverride: o, commandMenu: s, menuOverlays: c, sendOnEnter: u, initialAttachments: d = [], onCancel: p, onSave: m, onUploadAttachment: h, cancelLabel: g = "Cancel", saveLabel: _ = "Save & Submit", ariaLabel: y, removeLabel: b, retryLabel: x, uploadingLabel: S, expandLabel: C, clickLabel: w, addMenuTitle: E = "Add", attachLabel: D = "Attach file", menuTitle: O = "Menu", menuCloseLabel: k = "Close", className: A, pendingDropFiles: j, onDropFilesConsumed: N, validateAttachment: ee, isAttachmentsEnabled: te, isTextAttachmentsAllowed: ne, hideAttachFile: re = !1, fileAccept: ie, maximumAttachmentsAmount: P, onAttachmentsLimitExceeded: ae, onDialFileSystemClick: F, dialFileSystemLabel: oe, pendingAttachments: se, onPendingAttachmentsConsumed: ce, onAttachmentClick: le, pasteTextThreshold: ue, maxMessageLength: de = 5e4, onMessageTooLong: fe }) => {
|
|
2615
|
+
let pe = H(null), me = H(null), [he, R] = U([]);
|
|
2616
|
+
B(() => {
|
|
2617
|
+
j?.length && (R(j), N?.());
|
|
2618
|
+
}, [j, N]);
|
|
2619
|
+
let [_e, ve] = U(e ?? ""), [ye, be] = U([]), [xe, Se] = U(d), Ce = ye.some((e) => e.status === a.Loading || e.status === a.Error), we = (_e.trim().length > 0 || ye.length > 0 || xe.length > 0) && !Ce, Te = (e) => {
|
|
2620
|
+
Se((t) => t.filter((t) => t.id !== e));
|
|
2621
|
+
}, Ee = z((e, t) => {
|
|
2622
|
+
m(e, xe, t);
|
|
2623
|
+
}, [xe, m]), De = () => {
|
|
2624
|
+
we && (_e.length >= de ? fe?.(_e.length, de) : Ee(_e, ye));
|
|
2625
|
+
}, Oe = z(() => R([]), []), ke = z((e) => {
|
|
2626
|
+
ve(e), n?.(e);
|
|
2627
|
+
}, [n]), W = z((e) => {
|
|
2628
2628
|
let t = Array.from(e.target.files ?? []);
|
|
2629
|
-
t.length !== 0 && (e.target.value = "",
|
|
2630
|
-
}, []),
|
|
2629
|
+
t.length !== 0 && (e.target.value = "", R(t));
|
|
2630
|
+
}, []), Ae = V(() => F ? [{
|
|
2631
2631
|
key: "dial-fs",
|
|
2632
|
-
label:
|
|
2633
|
-
icon: /* @__PURE__ */
|
|
2632
|
+
label: oe ?? "DIAL file system",
|
|
2633
|
+
icon: /* @__PURE__ */ I(ge, {
|
|
2634
2634
|
size: f,
|
|
2635
2635
|
"aria-hidden": !0,
|
|
2636
2636
|
stroke: v
|
|
2637
2637
|
}),
|
|
2638
|
-
onClick:
|
|
2639
|
-
}] : [], [
|
|
2640
|
-
return /* @__PURE__ */
|
|
2641
|
-
className: l("flex w-full flex-col gap-2",
|
|
2642
|
-
children: [/* @__PURE__ */
|
|
2643
|
-
ref:
|
|
2638
|
+
onClick: F
|
|
2639
|
+
}] : [], [F, oe]);
|
|
2640
|
+
return /* @__PURE__ */ L("div", {
|
|
2641
|
+
className: l("flex w-full flex-col gap-2", A),
|
|
2642
|
+
children: [/* @__PURE__ */ I(nn, {
|
|
2643
|
+
ref: me,
|
|
2644
2644
|
message: e,
|
|
2645
2645
|
messageRevision: t,
|
|
2646
2646
|
activeMentions: r,
|
|
@@ -2650,119 +2650,107 @@ var nn = {
|
|
|
2650
2650
|
ariaLabel: y,
|
|
2651
2651
|
hideActionBar: !0,
|
|
2652
2652
|
sendOnEnter: u,
|
|
2653
|
-
pendingDropFiles:
|
|
2654
|
-
onDropFilesConsumed:
|
|
2655
|
-
onSend:
|
|
2653
|
+
pendingDropFiles: he,
|
|
2654
|
+
onDropFilesConsumed: Oe,
|
|
2655
|
+
onSend: Ee,
|
|
2656
2656
|
onUploadAttachment: h,
|
|
2657
|
-
onChange:
|
|
2658
|
-
onAttachmentsChange:
|
|
2657
|
+
onChange: ke,
|
|
2658
|
+
onAttachmentsChange: be,
|
|
2659
2659
|
removeLabel: b,
|
|
2660
2660
|
retryLabel: x,
|
|
2661
2661
|
uploadingLabel: S,
|
|
2662
2662
|
expandLabel: C,
|
|
2663
2663
|
clickLabel: w,
|
|
2664
2664
|
className: "max-w-full",
|
|
2665
|
-
prefixAttachments:
|
|
2666
|
-
onRemovePrefixAttachment:
|
|
2667
|
-
validateAttachment:
|
|
2668
|
-
isAttachmentsEnabled:
|
|
2669
|
-
isTextAttachmentsAllowed:
|
|
2670
|
-
maximumAttachmentsAmount:
|
|
2671
|
-
onAttachmentsLimitExceeded:
|
|
2672
|
-
pendingAttachments:
|
|
2673
|
-
onPendingAttachmentsConsumed:
|
|
2674
|
-
onAttachmentClick:
|
|
2675
|
-
pasteTextThreshold:
|
|
2676
|
-
maxMessageLength:
|
|
2677
|
-
onMessageTooLong:
|
|
2678
|
-
}), /* @__PURE__ */
|
|
2665
|
+
prefixAttachments: xe,
|
|
2666
|
+
onRemovePrefixAttachment: Te,
|
|
2667
|
+
validateAttachment: ee,
|
|
2668
|
+
isAttachmentsEnabled: te,
|
|
2669
|
+
isTextAttachmentsAllowed: ne,
|
|
2670
|
+
maximumAttachmentsAmount: P,
|
|
2671
|
+
onAttachmentsLimitExceeded: ae,
|
|
2672
|
+
pendingAttachments: se,
|
|
2673
|
+
onPendingAttachmentsConsumed: ce,
|
|
2674
|
+
onAttachmentClick: le,
|
|
2675
|
+
pasteTextThreshold: ue,
|
|
2676
|
+
maxMessageLength: de,
|
|
2677
|
+
onMessageTooLong: fe
|
|
2678
|
+
}), /* @__PURE__ */ L("div", {
|
|
2679
2679
|
className: "flex items-center justify-between",
|
|
2680
|
-
children: [/* @__PURE__ */
|
|
2680
|
+
children: [/* @__PURE__ */ L("div", {
|
|
2681
2681
|
className: "flex",
|
|
2682
|
-
children: [!
|
|
2683
|
-
ref:
|
|
2682
|
+
children: [!re && /* @__PURE__ */ I("input", {
|
|
2683
|
+
ref: pe,
|
|
2684
2684
|
type: "file",
|
|
2685
2685
|
multiple: !0,
|
|
2686
|
-
accept:
|
|
2686
|
+
accept: ie,
|
|
2687
2687
|
className: "sr-only",
|
|
2688
2688
|
"aria-hidden": !0,
|
|
2689
2689
|
tabIndex: -1,
|
|
2690
|
-
onChange:
|
|
2691
|
-
}), (!
|
|
2692
|
-
onAttachClick:
|
|
2690
|
+
onChange: W
|
|
2691
|
+
}), (!re || (c?.length ?? 0) > 0) && /* @__PURE__ */ I(ht, {
|
|
2692
|
+
onAttachClick: re ? void 0 : () => pe.current?.click(),
|
|
2693
2693
|
attachLabel: D,
|
|
2694
2694
|
addMenuTitle: E,
|
|
2695
|
-
menuTitle:
|
|
2695
|
+
menuTitle: O,
|
|
2696
2696
|
menuCloseLabel: k,
|
|
2697
|
-
extraMenuItems:
|
|
2697
|
+
extraMenuItems: Ae,
|
|
2698
2698
|
menuOverlays: c,
|
|
2699
|
-
getCaretPosition: () =>
|
|
2699
|
+
getCaretPosition: () => me.current?.getCaretPosition() ?? 0
|
|
2700
2700
|
})]
|
|
2701
|
-
}), /* @__PURE__ */
|
|
2701
|
+
}), /* @__PURE__ */ L("div", {
|
|
2702
2702
|
className: "flex gap-2",
|
|
2703
|
-
children: [/* @__PURE__ */
|
|
2703
|
+
children: [/* @__PURE__ */ I(T, {
|
|
2704
2704
|
label: g,
|
|
2705
2705
|
onClick: p
|
|
2706
|
-
}), /* @__PURE__ */
|
|
2706
|
+
}), /* @__PURE__ */ I(M, {
|
|
2707
2707
|
label: _,
|
|
2708
|
-
onClick:
|
|
2709
|
-
disabled: !
|
|
2708
|
+
onClick: De,
|
|
2709
|
+
disabled: !we
|
|
2710
2710
|
})]
|
|
2711
2711
|
})]
|
|
2712
2712
|
})]
|
|
2713
2713
|
});
|
|
2714
|
-
},
|
|
2714
|
+
}, sn = /* @__PURE__ */ function(e) {
|
|
2715
2715
|
return e.Warning = "warning", e.Reached = "reached", e;
|
|
2716
|
-
}({}),
|
|
2717
|
-
[
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2716
|
+
}({}), cn = {
|
|
2717
|
+
[sn.Warning]: k.Warning,
|
|
2718
|
+
[sn.Reached]: k.Error
|
|
2719
|
+
}, ln = ({ severity: e, limitText: t, reset: n, onClose: r, closeAriaLabel: i = "Close notification", limitTextClassName: a = "dial-small-paragraph-semi-text", resetTextClassName: o = "dial-small-paragraph-text", className: s }) => {
|
|
2720
|
+
let c = /* @__PURE__ */ I("span", {
|
|
2721
|
+
className: a,
|
|
2722
|
+
children: t
|
|
2723
|
+
}), u = n != null && /* @__PURE__ */ L(ce, { children: [
|
|
2724
|
+
" ",
|
|
2725
|
+
/* @__PURE__ */ I("time", {
|
|
2726
|
+
dateTime: n.isoValue,
|
|
2727
|
+
"aria-hidden": n.ariaLabel != null || void 0,
|
|
2728
|
+
className: o,
|
|
2729
|
+
children: n.label
|
|
2730
|
+
}),
|
|
2731
|
+
n.ariaLabel != null && /* @__PURE__ */ I("span", {
|
|
2732
|
+
className: "sr-only",
|
|
2733
|
+
children: n.ariaLabel
|
|
2734
|
+
})
|
|
2735
|
+
] });
|
|
2736
|
+
return /* @__PURE__ */ I(D, {
|
|
2728
2737
|
role: "status",
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
children: /* @__PURE__ */ P(c, { size: 24 })
|
|
2736
|
-
}), /* @__PURE__ */ F("div", {
|
|
2737
|
-
className: "flex min-w-0 flex-row flex-wrap items-baseline gap-x-1 wrap-break-word text-primary",
|
|
2738
|
-
children: [/* @__PURE__ */ P("span", {
|
|
2739
|
-
className: a,
|
|
2740
|
-
children: t
|
|
2741
|
-
}), n != null && /* @__PURE__ */ F(N, { children: [
|
|
2742
|
-
" ",
|
|
2743
|
-
/* @__PURE__ */ P("time", {
|
|
2744
|
-
dateTime: n.isoValue,
|
|
2745
|
-
"aria-hidden": n.ariaLabel != null || void 0,
|
|
2746
|
-
className: o,
|
|
2747
|
-
children: n.label
|
|
2748
|
-
}),
|
|
2749
|
-
n.ariaLabel != null && /* @__PURE__ */ P("span", {
|
|
2750
|
-
className: "sr-only",
|
|
2751
|
-
children: n.ariaLabel
|
|
2752
|
-
})
|
|
2753
|
-
] })]
|
|
2754
|
-
})]
|
|
2755
|
-
}), r != null && /* @__PURE__ */ P(g, {
|
|
2738
|
+
variant: cn[e],
|
|
2739
|
+
type: O.SectionMessage,
|
|
2740
|
+
title: u ? c : void 0,
|
|
2741
|
+
message: u || c,
|
|
2742
|
+
className: l("bg-layer-sunken", W.usageBanner, s),
|
|
2743
|
+
children: r != null && /* @__PURE__ */ I(g, {
|
|
2756
2744
|
className: "shrink-0 self-start",
|
|
2757
2745
|
ariaLabel: i,
|
|
2758
2746
|
onClose: () => r()
|
|
2759
|
-
})
|
|
2747
|
+
})
|
|
2760
2748
|
});
|
|
2761
|
-
},
|
|
2762
|
-
let [t, n] =
|
|
2749
|
+
}, un = (e) => {
|
|
2750
|
+
let [t, n] = U({
|
|
2763
2751
|
text: e?.text,
|
|
2764
2752
|
revision: e?.revision ?? 0
|
|
2765
|
-
}), r =
|
|
2753
|
+
}), r = z((e) => {
|
|
2766
2754
|
n((t) => ({
|
|
2767
2755
|
text: e,
|
|
2768
2756
|
revision: t.revision + 1
|
|
@@ -2773,11 +2761,11 @@ var nn = {
|
|
|
2773
2761
|
messageRevision: t.revision,
|
|
2774
2762
|
seedMessage: r
|
|
2775
2763
|
};
|
|
2776
|
-
},
|
|
2777
|
-
let n =
|
|
2778
|
-
r.current = t,
|
|
2764
|
+
}, dn = (e, t) => {
|
|
2765
|
+
let n = H(e), r = H(t);
|
|
2766
|
+
r.current = t, B(() => {
|
|
2779
2767
|
e !== n.current && (n.current = e, r.current());
|
|
2780
2768
|
}, [e]);
|
|
2781
2769
|
};
|
|
2782
2770
|
//#endregion
|
|
2783
|
-
export {
|
|
2771
|
+
export { it as ActionRowLayout, G as BottomSheetShell, W as CONVERSATION_INPUT_CLASS, K as ChatSettingsModal, an as ConversationInput, on as EditMessageInput, nn as Input, rt as SendOnEnter, sn as UsageLimitBannerSeverity, ln as UsageLimitBannerView, un as useComposerSeed, dn as useComposerSeedSource };
|